diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 115b12e2..00000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,25 +0,0 @@ -# Please see the documentation for all configuration options: -# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates - -version: 2 -updates: - - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "weekly" - - - package-ecosystem: "composer" - directory: "/" - schedule: - interval: "weekly" - - - package-ecosystem: "npm" - directory: "/" - schedule: - interval: "weekly" - day: "saturday" - time: "09:00" - timezone: "America/New_York" - ignore: - - dependency-name: "@wordpress/*" diff --git a/.github/workflows/all-pr-tests.yml b/.github/workflows/all-pr-tests.yml deleted file mode 100644 index 0146eba8..00000000 --- a/.github/workflows/all-pr-tests.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: "All Pull Request Tests" - -on: - pull_request: - branches: - - develop - types: [opened, synchronize, reopened, ready_for_review] - -jobs: - # We use a single job to ensure that all steps run in the same environment and - # reduce the number of minutes used. - pr-tests: - # Don't run on draft PRs - if: github.event.pull_request.draft == false - # Timeout after 10 minutes - timeout-minutes: 10 - # Define a matrix of PHP/WordPress versions to test against - strategy: - matrix: - php: [8.1, 8.2, 8.3] - wordpress: ["latest"] - runs-on: ubuntu-latest - # Cancel any existing runs of this workflow - concurrency: - group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}-P${{ matrix.php }}-WP${{ matrix.wordpress }} - cancel-in-progress: true - # Name the job in the matrix - name: "PR Tests PHP ${{ matrix.php }} WordPress ${{ matrix.wordpress }}" - steps: - - uses: actions/checkout@v4 - - - name: Run General Tests - # See https://github.com/alleyinteractive/action-test-general for more options - uses: alleyinteractive/action-test-general@develop - - - name: Run Node Tests - # See https://github.com/alleyinteractive/action-test-node for more options. - # Defaults to the latest LTS version. - uses: alleyinteractive/action-test-node@develop - - - name: Run PHP Tests - # See https://github.com/alleyinteractive/action-test-php for more options - uses: alleyinteractive/action-test-php@develop - with: - php-version: '${{ matrix.php }}' - wordpress-version: '${{ matrix.wordpress }}' - skip-wordpress-install: 'true' diff --git a/.github/workflows/dependabot-auto-approve.yml b/.github/workflows/dependabot-auto-approve.yml deleted file mode 100644 index e2119dec..00000000 --- a/.github/workflows/dependabot-auto-approve.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: dependabot-auto-approve -on: - pull_request: - -permissions: - pull-requests: write - contents: write - -jobs: - dependabot: - uses: alleyinteractive/.github/.github/workflows/dependabot-auto-approve.yml@main diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml deleted file mode 100644 index aaed13d4..00000000 --- a/.github/workflows/dependabot-auto-merge.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: dependabot-auto-merge -on: pull_request_target - -permissions: - pull-requests: write - contents: write - -jobs: - dependabot: - uses: alleyinteractive/.github/.github/workflows/dependabot-auto-merge.yml@main diff --git a/.github/workflows/merge-develop-to-scaffold.yml b/.github/workflows/merge-develop-to-scaffold.yml deleted file mode 100644 index 4f6b2f22..00000000 --- a/.github/workflows/merge-develop-to-scaffold.yml +++ /dev/null @@ -1,40 +0,0 @@ -# This workflow is used on alleyinteractive/create-wordpress-plugin to merge the -# develop branch into the scaffold branch and is NOT meant to be used on other -# repositories. This workflow will be deleted automatically when the -# configuration script is run. - -name: Merge Develop to Scaffold Branch - -on: - push: - branches: - - develop - - remove-scaffold - -jobs: - merge-develop-to-scaffold: - name: merge develop to scaffold - if: ${{ github.repository == 'alleyinteractive/create-wordpress-plugin' }} - runs-on: ubuntu-latest - - steps: - - name: Merge develop to scaffold - shell: bash - env: - DEVELOP_BRANCH: develop - SCAFFOLD_BRANCH: scaffold - - TOKEN: ${{ secrets.GH_TOKEN }} - run: | - git config --global user.name "$GITHUB_ACTOR" - git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" - - echo "Cloning alleyinteractive/create-wordpress-plugin..." - git clone --recursive --quiet https://$TOKEN@github.com/alleyinteractive/create-wordpress-plugin.git create-wordpress-plugin -b $SCAFFOLD_BRANCH - cd create-wordpress-plugin - - git fetch origin $DEVELOP_BRANCH - git fetch origin $SCAFFOLD_BRANCH - - git merge origin/$DEVELOP_BRANCH --no-edit - git push -u origin $SCAFFOLD_BRANCH diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 8ccab9be..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Release - -on: - push: - branches: - - develop - - main - - production - -permissions: - contents: write - -jobs: - release: - name: "Create Release" - runs-on: ubuntu-latest - steps: - - uses: alleyinteractive/action-release@feature diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml deleted file mode 100644 index 0cdea233..00000000 --- a/.github/workflows/update-changelog.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: "Update Changelog" - -on: - release: - types: [released] - -jobs: - update: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - ref: main - - - name: Update Changelog - uses: stefanzweifel/changelog-updater-action@v1 - with: - latest-version: ${{ github.event.release.name }} - release-notes: ${{ github.event.release.body }} - - - name: Commit updated CHANGELOG - uses: stefanzweifel/git-auto-commit-action@v5 - with: - branch: main - commit_message: Update CHANGELOG - file_pattern: CHANGELOG.md diff --git a/.github/workflows/upgrade-wordpress-plugin.yml b/.github/workflows/upgrade-wordpress-plugin.yml deleted file mode 100644 index 22a35737..00000000 --- a/.github/workflows/upgrade-wordpress-plugin.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Update WordPress Plugin - -on: - schedule: - - cron: '0 6 1 * *' # Run on the first day of every month at 6am UTC. - -permissions: - contents: write - pull-requests: write - -jobs: - update-plugin: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: alleyinteractive/action-update-wordpress-plugin@v2.0.0 - with: - plugin-file: 'plugin.php' - upgrade-npm-dependencies: "true" diff --git a/.gitignore b/.gitignore index a8545793..17e6245d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,26 +1,24 @@ -# Build files -build -vendor -composer.lock -node_modules - -# Log files -*.log - -# Cache files -.phpcs/*.json -.phpunit.result.cache - -# Ignore temporary OS files .DS_Store -.DS_Store? -.Spotlight-V100 -.Trashes -ehthumbs.db +.github +.phpcs +.phpcs.xml +.phpunit.result.cache +.scaffolder +.scoper +*.sql +*.tar.gz +*.zip +bin +composer.lock +configure.php +DOCKER_ENV +Dockerfile +Makefile +node_modules/ +output.log +phpunit.xml +phpunit.xml +tests +tests Thumbs.db -.thumbsdb - -# IDE files -*.code-workspace -.idea -.vscode +wp-cli.local.yml diff --git a/.scaffolder/plugin-feature/config.yml b/.scaffolder/plugin-feature/config.yml deleted file mode 100644 index d155b59e..00000000 --- a/.scaffolder/plugin-feature/config.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: create-wordpress-plugin@plugin-feature - -inputs: - - name: featureName - description: "Feature Name" - type: string - - name: tests - description: "Include Tests?" - type: boolean - default: true - -files: - - source: feature.php.hbs - destination: src/features/{{ wpClassFilename inputs.featureName }} - - source: test.php.hbs - if: "{{ inputs.tests }}" - destination: tests/Features/{{ psr4ClassFilename inputs.featureName suffix="Test.php" }} diff --git a/.scaffolder/plugin-feature/feature.php.hbs b/.scaffolder/plugin-feature/feature.php.hbs deleted file mode 100644 index 71ca58ae..00000000 --- a/.scaffolder/plugin-feature/feature.php.hbs +++ /dev/null @@ -1,27 +0,0 @@ -assertTrue( true ); - } -} diff --git a/Makefile b/Makefile deleted file mode 100644 index e652afa4..00000000 --- a/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -MAKEFLAGS += --no-builtin-rules - -setup: - php ./configure.php - -.PHONY: setup diff --git a/build/example/index.asset.php b/build/example/index.asset.php new file mode 100644 index 00000000..e1747c63 --- /dev/null +++ b/build/example/index.asset.php @@ -0,0 +1 @@ + array(), 'version' => '5ac5a16fc4da8e2927c3'); diff --git a/build/example/index.js b/build/example/index.js new file mode 100644 index 00000000..07f93514 --- /dev/null +++ b/build/example/index.js @@ -0,0 +1 @@ +console.log("example"); \ No newline at end of file diff --git a/configure.php b/configure.php deleted file mode 100644 index 71d36662..00000000 --- a/configure.php +++ /dev/null @@ -1,821 +0,0 @@ -#!/usr/bin/env php -] - * : The author name. - * - * [--author_email=] - * : The author email. - * - * phpcs:disable - */ - -namespace Alley\WP\Create_WordPress_Plugin\Configure; - -if ( ! defined( 'STDIN' ) ) { - die( 'Not in CLI mode.' ); -} - -if ( 0 === strpos( strtoupper( PHP_OS ), 'WIN' ) ) { - die( 'Not supported in Windows. 🪟' ); -} - -if ( version_compare( PHP_VERSION, '8.1.0', '<' ) ) { - die( 'PHP 8.1.0 or greater is required.' ); -} - -// Parse the command line arguments from $argv. -$args = []; -$previous_key = null; - -foreach ( $argv as $value ) { - if ( str_starts_with( $value, '--' ) ) { - if ( false !== strpos( $value, '=' ) ) { - [ $arg, $value ] = explode( '=', substr( $value, 2 ), 2 ); - - $args[ $arg ] = trim( $value ); - - $previous_key = null; - } else { - $args[ substr( $value, 2 ) ] = true; - - $previous_key = substr( $value, 2 ); - } - } elseif ( ! empty( $previous_key ) ) { - $args[ $previous_key ] = trim( $value ); - } else { - $previous_key = trim( $value ); - } -} - -$terminal_width = (int) exec( 'tput cols' ); - -function write( string $text ): void { - global $terminal_width; - echo wordwrap( $text, $terminal_width - 1 ) . PHP_EOL; -} - -function ask( string $question, string $default = '', bool $allow_empty = true ): string { - while ( true ) { - write( $question . ( $default ? " [{$default}]" : '' ) . ': ' ); - $answer = readline( '> ' ); - - $value = $answer ?: $default; - - if ( ! $allow_empty && empty( $value ) ) { - echo "This value can't be empty." . PHP_EOL; - continue; - } - - return $value; - } -} - -function confirm( string $question, bool $default = false ): bool { - write( "{$question} (yes/no) [" . ( $default ? 'yes' : 'no' ) . ']: ' ); - - $answer = readline( '> ' ); - - if ( ! $answer ) { - return $default; - } - - return in_array( strtolower( trim( $answer ) ), [ 'y', 'yes', 'true', '1' ], true ); -} - -function run( string $command, string $dir = null ): string { - $command = $dir ? "cd {$dir} && {$command}" : $command; - - return trim( (string) shell_exec( $command ) ); -} - -function str_after( string $subject, string $search ): string { - $pos = strrpos( $subject, $search ); - - if ( $pos === false ) { - return $subject; - } - - return substr( $subject, $pos + strlen( $search ) ); -} - -function slugify( string $subject ): string { - return strtolower( trim( (string) preg_replace( '/[^A-Za-z0-9-]+/', '-', $subject ), '-' ) ); -} - -function title_case( string $subject ): string { - return ensure_capitalp( str_replace( ' ', '_', ucwords( str_replace( [ '-', '_' ], ' ', $subject ) ) ) ); -} - -function ensure_capitalp( string $text ): string { - return str_replace( 'Wordpress', 'WordPress', $text ); -} - -/** - * @param string $file - * @param array $replacements - */ -function replace_in_file( string $file, array $replacements ): void { - $contents = file_get_contents( $file ); - - if ( empty( $contents ) ) { - return; - } - - file_put_contents( - $file, - str_replace( - array_keys( $replacements ), - array_values( $replacements ), - $contents, - ) - ); -} - -function remove_readme_paragraphs( string $file ): void { - $contents = file_get_contents( $file ); - - if ( empty( $contents ) ) { - return; - } - - file_put_contents( - $file, - trim( (string) preg_replace( '/.*/s', '', $contents ) ?: $contents ), - ); -} - -function remove_composer_require(): void { - global $plugin_file; - - $contents = file_get_contents( $plugin_file ); - - if ( empty( $contents ) ) { - return; - } - - file_put_contents( - $plugin_file, - trim( (string) preg_replace( '/\n\/\* Start Composer Loader \*\/.*\/\* End Composer Loader \*\/\n/s', '', $contents ) ?: $contents ) . PHP_EOL, - ); - - echo "Removed Composer's vendor/autoload.php from {$plugin_file}" . PHP_EOL; -} - -function remove_composer_wrapper_comments(): void { - global $plugin_file; - - $contents = file_get_contents( $plugin_file ); - - if ( empty( $contents ) ) { - return; - } - - file_put_contents( - $plugin_file, - trim( preg_replace( '/\n\/\* (Start|End) Composer Loader \*\/\n/', '', $contents ) ?: $contents ) . PHP_EOL, - ); - - echo "Removed Composer's wrapper comments from {$plugin_file}" . PHP_EOL; -} - -function remove_composer_files(): void { - $file_list = [ - 'composer.json', - 'composer.lock', - 'vendor/', - ]; - - delete_files( $file_list ); - - write( sprintf( 'Removed %s files.', implode( ', ', $file_list ) ) ); -} - -function remove_project_files(): void { - $file_list = [ - 'CHANGELOG.md', - '.deployignore', - '.editorconfig', - '.gitignore', - '.gitattributes', - '.github', - 'LICENSE', - ]; - - delete_files( $file_list ); - - write( sprintf( 'Removed %s files.', implode( ', ', $file_list ) ) ); -} - -function rollup_phpcs_to_parent( string $parent_file, string $local_file, string $plugin_name, string $plugin_domain ): void { - $config = ' - - PHP_CodeSniffer standard for ' . $plugin_name . ' - - - - - - - - - - - - - - - - - - -'; - - if ( file_put_contents( $local_file, $config ) ) { - delete_files( '.phpcs' ); - - echo "Updated {$local_file}.\n"; - } -} - -/* Remove the README's assets section. */ -function remove_assets_readme( bool $keep_contents, string $file = 'README.md' ): void { - $contents = file_get_contents( $file ); - - if ( empty( $contents ) ) { - return; - } - - if ( $keep_contents ) { - $contents = str_replace( '', '', $contents ); - $contents = str_replace( '', '', $contents ); - - file_put_contents( $file, $contents ); - } else { - file_put_contents( - $file, - trim( (string) preg_replace( '/.*/s', '', $contents ) ?: $contents ), - ); - } -} - -/* Remove the assets.php require from the main plugin file. */ -function remove_assets_require(): void { - global $plugin_file; - - $contents = file_get_contents( $plugin_file ); - - if ( empty( $contents ) ) { - return; - } - - file_put_contents( - $plugin_file, - trim( (string) preg_replace( '/require_once __DIR__ \. \'\/src\/assets.php\';\\n/s', '', $contents ) ?: $contents ) . PHP_EOL, - ); -} - -/* Remove the node tests from within the all-pr-tests.yml file. */ -function remove_assets_test(): void { - $file = __DIR__ . '/.github/workflows/all-pr-tests.yml'; - - if ( ! file_exists( $file ) ) { - return; - } - - - $contents = preg_replace( - '/(- name: Run Node Tests.*)(- name:)/s', - '$2', - file_get_contents( $file ), - ); - - file_put_contents( $file, $contents ); -} - -function determine_separator( string $path ): string { - return str_replace( '/', DIRECTORY_SEPARATOR, $path ); -} - -/** - * @return array - */ -function list_all_files_for_replacement(): array { - $exclude = [ - 'LICENSE', - 'configure.php', - '.phpunit.result.cache', - '.phpcs', - 'composer.lock', - ]; - - $exclude_dirs = [ - '.git', - 'pantheon-mu-plugin', - 'vendor', - 'node_modules', - '.phpcs', - '.scaffolder', - ]; - - $exclude = array_map( - fn ( string $file ) => "--exclude {$file}", - $exclude, - ); - - $exclude_dirs = array_map( - fn ( string $dir ) => "--exclude-dir {$dir}", - $exclude_dirs, - ); - - return explode( - PHP_EOL, - run( - "grep -R -l . " . implode( ' ', $exclude_dirs ) . ' ' . implode( ' ', $exclude ), - ), - ); -} - -/** - * @param string|array $paths - */ -function delete_files( string|array $paths ): void { - if ( ! is_array( $paths ) ) { - $paths = [ $paths ]; - } - - foreach ( $paths as $path ) { - $path = determine_separator( $path ); - - if ( is_dir( $path ) ) { - run( "rm -rf {$path}" ); - } elseif ( file_exists( $path ) ) { - @unlink( $path ); - } - } -} - -function remove_phpstan(): void { - delete_files( 'phpstan.neon' ); - - // Manually patch the Composer.json file. - if ( file_exists( 'composer.json' ) ) { - $composer_json = (array) json_decode( (string) file_get_contents( 'composer.json' ), true ); - - if ( isset( $composer_json['scripts']['phpstan'] ) ) { // @phpstan-ignore-line - unset( $composer_json['scripts']['phpstan'] ); // @phpstan-ignore-line - - $composer_json['scripts']['test'] = [ // @phpstan-ignore-line - '@phpcs', - '@phpunit', - ]; - - file_put_contents( 'composer.json', json_encode( $composer_json, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ) ); - } - } -} - -function contributing_message( string $message ): void { - write( "\n{$message}\n" ); - echo "\t\e]8;;https://github.com/alleyinteractive/.github/blob/main/CONTRIBUTING.md#best-practices\e\\CONTRIBUTING.md\e]8;;\e\\\n\n"; -} - -/* Enable SQLite testing for the plugin with Mantle Testkit. */ -function enable_sqlite_testing(): void { - if ( ! file_exists( __DIR__ . '/phpunit.xml' ) ) { - return; - } - - file_put_contents( - __DIR__ . '/phpunit.xml', - str_replace( - [ - '', - '', - ], - [ - '', - '', - ], - (string) file_get_contents( __DIR__ . '/phpunit.xml' ), - ), - ); - - if ( file_exists( __DIR__ . '/.github/workflows/all-pr-tests.yml' ) ) { - file_put_contents( - __DIR__ . '/.github/workflows/all-pr-tests.yml', - str_replace( - 'skip-wordpress-install:', - "skip-services: 'true'\n skip-wordpress-install:", - (string) file_get_contents( __DIR__ . '/.github/workflows/all-pr-tests.yml' ), - ), - ); - } -} - -// --------------------------------------------------------- -// Start of the script. Above this line are the functions. -// --------------------------------------------------------- - -echo "\nWelcome friend to alleyinteractive/create-wordpress-plugin! 😀\nLet's setup your WordPress Plugin 🚀\n\n"; - -// Always delete the 'merge-develop-to-scaffold.yml' file (this is never used in -// a scaffolded plugins). -delete_files( '.github/workflows/merge-develop-to-scaffold.yml' ); - -$current_dir = getcwd(); - -if ( ! $current_dir ) { - echo "Could not determine current directory.\n"; - exit( 1 ); -} - -$folder_name = ensure_capitalp( basename( $current_dir ) ); - -$author_email = ask( - question: 'Author email?', - default: (string) ( $args['author_email'] ?? run( 'git config user.email' ) ), - allow_empty: false, -); - -$username_guess = explode( ':', run( 'git config remote.origin.url' ) )[1] ?? ''; -$username_guess = dirname( $username_guess ); -$username_guess = basename( $username_guess ); -$author_username = ask( - question: 'Author username?', - default: $username_guess, - allow_empty: false, -); - -$author_name = ask( - question: 'Author name?', - default: (string) ( $args['author_name'] ?? run( 'git config user.name' ) ), - allow_empty: false, -); - -$vendor_name = ask( - question: 'Vendor name (usually the Github Organization)?', - default: $username_guess, - allow_empty: false, -); - -$vendor_slug = slugify( $vendor_name ); -$is_alley_plugin = 'alleyinteractive' === $vendor_slug; - -$plugin_name = ask( - question: 'Plugin name?', - default: (string) ( $args['plugin_name'] ?? str_replace( '_', ' ', title_case( $folder_name ) ) ), - allow_empty: false, -); - -while ( true ) { - $plugin_name_slug = slugify( ask( - question: 'Plugin slug?', - default: 'wp-' . ltrim( slugify( $plugin_name ), 'wp-' ), - allow_empty: false, - ) ); - - // Suggest a different plugin name if this is an Alley plugin. - if ( $is_alley_plugin && 0 !== strpos( $plugin_name_slug, 'wp-' ) ) { - $example_slug = "wp-{$plugin_name_slug}"; - - contributing_message( "Alley WordPress plugin slugs should be prefixed with \"wp-\". For example, {$example_slug} would be a great slug. If this plugin isn't meant to be published anywhere, this is fine to ignore. See our CONTRIBUTING.md for more details." ); - - if ( ! confirm( 'Do you wish to continue anyway?', false ) ) { - continue; - } - } - - break; -} - -while ( true ) { - $namespace = ask( - question: 'Plugin namespace?', - default: $is_alley_plugin ? 'Alley\\WP\\' . title_case( $plugin_name ) : title_case( $plugin_name ), - allow_empty: false, - ); - - // Check if the namespace is valid. - if ( ! preg_match( '/^[a-zA-Z0-9_\\\\]+$/', $namespace ) ) { - echo "Invalid namespace, please try again.\n"; - continue; - } - - // Offer to fix the namespace if this is an Alley plugin. - if ( $is_alley_plugin && 0 !== strpos( $namespace, 'Alley\\WP\\' ) ) { - $example_namespace = 'Alley\\WP\\' . title_case( $plugin_name ); - contributing_message( "Alley WordPress plugins should be prefixed with \"Alley\\WP\\\". A namespace such as \"{$example_namespace}\" would work well. If this plugin isn't meant to be published anywhere, this is fine to ignore. See our CONTRIBUTING.md for more details." ); - - if ( ! confirm( 'Do you wish to continue anyway?', false ) ) { - continue; - } - } - - break; -} - -$class_name = ask( 'Base class name for plugin?', title_case( $plugin_name ) ); -$description = ask( 'Plugin description?', "This is my plugin {$plugin_name}" ); - -while ( true ) { - $plugin_file = ask( 'Main plugin file?', "{$plugin_name_slug}.php" ); - - // Validate that plugin file is a valid file name. - if ( ! preg_match( '/^[a-zA-Z0-9-_\.]+\.php$/', $plugin_file ) ) { - echo "Invalid plugin file name. Please try again.\n"; - continue; - } - - // Validate that plugin file does not already exist. - if ( file_exists( $plugin_file ) ) { - echo "Plugin file already exists. Please try again.\n"; - continue; - } - - break; -} - -write( '------' ); -write( "Plugin : {$plugin_name} <{$plugin_name_slug}>" ); -write( "Author : {$author_name} ({$author_email})" ); -write( "Vendor : {$vendor_name} ({$vendor_slug})" ); -write( "Description : {$description}" ); -write( "Namespace : {$namespace}" ); -write( "Main File : {$plugin_file}" ); -write( "Main Class : {$class_name}" ); -write( '------' ); - -write( 'This script will replace the above values in all relevant files in the project directory.' ); - -if ( ! confirm( 'Modify files?', true ) ) { - exit( 1 ); -} - -$search_and_replace = [ - 'author_name' => $author_name, - 'author_username' => $author_username, - 'email@domain.com' => $author_email, - - 'A skeleton WordPress plugin' => $description, - - // Extra slashes are here for composer.json. - 'Alley\\\WP\\\Create_WordPress_Plugin\\\\' => str_replace( '\\', '\\\\', $namespace ) . '\\\\', - 'Alley\WP\Create_WordPress_Plugin' => $namespace, - - 'Example_Plugin' => $class_name, - 'create_wordpress_plugin' => str_replace( '-', '_', $plugin_name_slug ), - 'plugin_name' => $plugin_name, - - 'create-wordpress-plugin' => $plugin_name_slug, - 'Create WordPress Plugin' => $plugin_name, - - 'CREATE_WORDPRESS_PLUGIN' => strtoupper( str_replace( '-', '_', $plugin_name_slug ) ), - 'Skeleton' => $class_name, - 'vendor_name' => $vendor_name, - 'alleyinteractive' => $vendor_slug, - 'plugin.php' => $plugin_file, -]; - -foreach ( list_all_files_for_replacement() as $path ) { - echo "Updating $path...\n"; - - replace_in_file( $path, $search_and_replace ); - - if ( str_contains( $path, determine_separator( 'src/class-example-plugin.php' ) ) ) { - rename( $path, determine_separator( './src/class-' . str_replace( '_', '-', strtolower( $class_name ) ) . '.php' ) ); - } - - if ( str_contains( $path, 'README.md' ) ) { - remove_readme_paragraphs( $path ); - } -} - -// Attempt to rename the main plugin file. -if ( 'plugin.php' !== $plugin_file ) { - rename( 'plugin.php', $plugin_file ); - - replace_in_file( './.github/workflows/upgrade-wordpress-plugin.yml', $search_and_replace ); - - echo "Renamed plugin.php to {$plugin_file}\n"; -} - -echo "Done!\n\n"; - -$needs_built_assets = false; -$uses_composer = false; - -if ( confirm( 'Will this plugin be compiling front-end assets (Node)?', true ) ) { - $needs_built_assets = true; - - if ( confirm( 'Do you want to run `npm install` and `npm run build`?', true ) ) { - echo run( 'npm install && npm run build' ); - echo "\n\n\n"; - } - - remove_assets_readme( keep_contents: true ); -} elseif ( confirm( 'Do you want to delete the front-end files? (Such as package.json, etc.)', true ) ) { - echo "Deleting...\n"; - - delete_files( - [ - '.eslintignore', - '.eslintrc.json', - '.nvmrc', - '.stylelintrc.json', - 'babel.config.js', - 'jest.config.js', - 'jsconfig.json', - 'package.json', - 'package-lock.json', - 'tsconfig.json', - 'entries/', - 'blocks/', - 'build/', - 'bin/', - 'node_modules/', - 'scaffold', - 'src/assets.php', - ] - ); - - remove_assets_readme( keep_contents: false ); - remove_assets_require(); - remove_assets_test(); -} - -if ( confirm( 'Will this plugin be using Composer? (WordPress Composer Autoloader is already included! phpcs and phpunit also rely on Composer being installed for testing.)', true ) ) { - $uses_composer = true; - $needs_built_assets = true; - - remove_composer_wrapper_comments(); - - if ( confirm( 'Do you want to run `composer install`?', true ) ) { - if ( file_exists( __DIR__ . '/composer.lock' ) ) { - echo run( 'composer update' ); - } else { - echo run( 'composer install' ); - } - - echo "\n\n"; - } -} elseif ( confirm( 'Do you want to remove the vendor/autoload.php dependency from your main plugin file and the composer.json file?' ) ) { - remove_composer_require(); - - // Prompt the user to delete the composer.json file. Plugins often still - // keep this around for development and Packagist. - if ( confirm( 'Do you want to delete the composer.json and composer.lock files? (This will prevent you from using PHPCS/PHPStan/Composer entirely).', false ) ) { - remove_composer_files(); - } -} - -if ( file_exists( 'composer.json') && ! confirm(' Using PHPStan? (PHPStan is a great static analyzer to help find bugs in your code.)', true) ) { - remove_phpstan(); -} - -$standalone = true; - -// Check if the plugin will be use standalone (as a single repository) or as a -// part of larger project (such as a wp-content-rooted project). Assumes that -// the parent project is located at /wp-content/ and this plugin is located at -// /wp-content/plugins/:plugin/. -if ( - file_exists( '../../.git/index' ) - && is_dir( '../../../wp-admin' ) - && ! confirm( - 'Will this be a standalone plugin, not located within a larger project? For example, a standalone plugin will have a separate repository and will be distributed independently.', - false, - ) -) { - $standalone = false; - - $needs_built_assets = false; - - if ( confirm( 'Do you want to remove project-based files, such as GitHub actions? (If this is a standalone plugin, these are probably in the root directory.)', true ) ) { - remove_project_files(); - } - - // Offer to roll up this plugin's dependencies to the parent project's composer. - if ( $uses_composer && file_exists( '../../composer.json' ) ) { - $parent_composer = (string) realpath( '../../composer.json' ); - $parent_folder = dirname( $parent_composer ); - - if ( confirm( "Do you want to rollup the plugin's Composer dependencies to the parent project's composer.json file ({$parent_composer})? This will copy this plugin's dependencies to the parent project and delete the local composer.json file.", true ) ) { - $composer = (array) json_decode( (string) file_get_contents( $parent_composer ), true ); - $plugin_composer = (array) json_decode( (string) file_get_contents( 'composer.json' ), true ); - - $original = $composer; - - $composer['require'] = array_merge( - (array) ( $composer['require'] ?? [] ), - (array) ( $plugin_composer['require'] ?? [] ), - ); - - $composer['require-dev'] = array_merge( - (array) ( $composer['require-dev'] ?? [] ), - (array) ( $plugin_composer['require-dev'] ?? [] ), - ); - - $composer['config']['allow-plugins']['alleyinteractive/composer-wordpress-autoloader'] = true; - - ksort( $composer['require'] ); - ksort( $composer['require-dev'] ); - ksort( $composer['config']['allow-plugins'] ); - - if ( $composer !== $original ) { - file_put_contents( $parent_composer, json_encode( $composer, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ) ); - echo "Updated {$parent_composer} with the plugin's composer dependencies.\n"; - - remove_composer_require(); - remove_composer_files(); - - echo "\n\n"; - - if ( confirm( "Do you want to run `composer update` in {$parent_folder}?", true ) ) { - echo run( 'composer update', $parent_folder ); - echo "\n\n"; - } - } - - $parent_files = [ - $parent_folder . '/phpcs.xml', - $parent_folder . '/phpcs.xml.dist', - $parent_folder . '/.phpcs.xml', - ]; - - if ( file_exists( __DIR__ . '/.phpcs.xml' ) ) { - foreach ( $parent_files as $parent_file ) { - if ( ! file_exists( $parent_file ) ) { - continue; - } - - if ( confirm( "Do you want to roll up the phpcs configuration to the parent? (This will change the plugin's phpcs configuration to inherit the parent configuration from {$parent_file}.)" ) ) { - rollup_phpcs_to_parent( - parent_file: '../../' . basename( $parent_file ), - local_file: __DIR__ . '/.phpcs.xml', - plugin_name: $plugin_name, - plugin_domain: $plugin_name_slug, - ); - - break; - } - } - } - } - } - - if ( confirm( 'Do you want to remove the git repository for the plugin?', true ) ) { - delete_files( '.git' ); - } -} - -if ( $standalone && confirm( 'Do you want to use SQLite for unit testing? (This is a great way to speed up your tests!)', true ) ) { - enable_sqlite_testing(); -} - -// Offer to delete the built asset workflows if built assets aren't needed. -if ( ! $needs_built_assets && file_exists( '.github/workflows/built-release.yml' ) && confirm( 'Delete the Github actions for built assets?', true ) ) { - delete_files( - [ - '.github/workflows/built-branch.yml', - '.github/workflows/built-release.yml', - ] - ); -} - -if ( confirm( 'Let this script delete itself?', true ) ) { - delete_files( - [ - 'Makefile', - __FILE__, - ] - ); -} - -echo "\n\nWe're done! 🎉\n\n"; - -// Offer some information about built releases if the workflow still exists. -if ( file_exists( '.github/workflows/built-release.yml' ) ) { - echo << - - - - tests/Feature - - - tests/Unit - - - - - - - diff --git a/tests/Feature/ExampleFeatureTest.php b/tests/Feature/ExampleFeatureTest.php deleted file mode 100644 index 510ab6c5..00000000 --- a/tests/Feature/ExampleFeatureTest.php +++ /dev/null @@ -1,25 +0,0 @@ -assertTrue( true ); - $this->assertNotEmpty( home_url() ); - } -} diff --git a/tests/TestCase.php b/tests/TestCase.php deleted file mode 100644 index baec0f07..00000000 --- a/tests/TestCase.php +++ /dev/null @@ -1,17 +0,0 @@ -assertTrue( true ); - } -} diff --git a/tests/bootstrap.php b/tests/bootstrap.php deleted file mode 100644 index 475155b5..00000000 --- a/tests/bootstrap.php +++ /dev/null @@ -1,18 +0,0 @@ -maybe_rsync_plugin() - // Load the main file of the plugin. - ->loaded( fn () => require_once __DIR__ . '/../plugin.php' ) - ->install(); diff --git a/vendor/alleyinteractive/alley-coding-standards/.editorconfig b/vendor/alleyinteractive/alley-coding-standards/.editorconfig new file mode 100644 index 00000000..3f81e6e6 --- /dev/null +++ b/vendor/alleyinteractive/alley-coding-standards/.editorconfig @@ -0,0 +1,18 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +trim_trailing_whitespace = true +insert_final_newline = true +indent_style = tab +indent_size = 4 + +[*.{ts,tsx,js,jsx,scss,css,json,yaml,yml,feature,xml}] +indent_style = space +indent_size = 2 + +# Dotfiles +[.*] +indent_style = space +indent_size = 2 diff --git a/vendor/alleyinteractive/alley-coding-standards/.gitattributes b/vendor/alleyinteractive/alley-coding-standards/.gitattributes new file mode 100644 index 00000000..f628c617 --- /dev/null +++ b/vendor/alleyinteractive/alley-coding-standards/.gitattributes @@ -0,0 +1,24 @@ +# +# Exclude these files from release archives. +# +# This will also make the files unavailable when using Composer with `--prefer-dist`. +# +# Via WPCS. +# +/.github export-ignore +/phpunit.xml export-ignore +/tests export-ignore + +# +# Auto detect text files and perform LF normalization. +# +# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/ +# +* text=auto + +# +# The above will handle all files not found below. +# +*.md text +*.php text +*.inc text diff --git a/vendor/alleyinteractive/alley-coding-standards/.gitignore b/vendor/alleyinteractive/alley-coding-standards/.gitignore new file mode 100644 index 00000000..efceca6b --- /dev/null +++ b/vendor/alleyinteractive/alley-coding-standards/.gitignore @@ -0,0 +1,8 @@ +/vendor/ +composer.lock + +# IDEs +.idea +.vscode +.DS_Store +.phpunit.result.cache diff --git a/vendor/alleyinteractive/alley-coding-standards/Alley-Interactive/ruleset.xml b/vendor/alleyinteractive/alley-coding-standards/Alley-Interactive/ruleset.xml new file mode 100644 index 00000000..e2dda507 --- /dev/null +++ b/vendor/alleyinteractive/alley-coding-standards/Alley-Interactive/ruleset.xml @@ -0,0 +1,133 @@ + + + The Alley Interactive PHP coding standard. + + */node_modules/* + */vendor/* + *\.js$ + *\.css$ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + template-parts/ + vendor/ + + + + + + warning + + + + + + + + error + + + + + (class|trait)-(instance|singleton).php + + + + + tests/*Test.php + + + + + tests/*Test.php + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/alleyinteractive/alley-coding-standards/CHANGELOG.md b/vendor/alleyinteractive/alley-coding-standards/CHANGELOG.md new file mode 100644 index 00000000..29de8b54 --- /dev/null +++ b/vendor/alleyinteractive/alley-coding-standards/CHANGELOG.md @@ -0,0 +1,62 @@ +# Changelog + +This project adheres to [Keep a CHANGELOG](https://keepachangelog.com/en/1.0.0/). + +This project adheres to [Keep a CHANGELOG](https://keepachangelog.com/en/1.0.0/). + +### 2.1.0 + +- Allow PSR-4 style `ClassName.php` file names to support our migration to PSR-4 for test files. +- Remove the `PEAR.Functions.FunctionCallSignature` sniff from the ruleset and + replace it with `PSR2.Methods.FunctionCallSignature`. This change is to allow + for multi-line function calls to be formatted in a more readable way without having to insert a new line before the first argument. +- Allow camelCase'd DOMDocument/DOMElement/etc. property names to not be flagged by `WordPress.NamingConventions.ValidVariableName`. + +### 2.0.2 + +- Fix issue with files with `js`/`css` in the path being ignored. +- Bumping to PHP 8.1. + +### 2.0.1 + +- Update "Prefer array syntax" rule to 3.0. + +### 2.0.0 + +- **Breaking Change:** Upgraded to `automattic/vipwpcs` and + `wp-coding-standards/wpcs` to 3.0. See [Upgrading to 2.0](https://github.com/alleyinteractive/alley-coding-standards/wiki/Upgrading-to-2.0) + for more details. + +### 1.0.1 + +- Ignore deprecation errors in WPCS to allow it work with PHP 8.0+. + +### 1.0.0 + +- No changes, tagging a stable release of Alley Coding Standards. + +### 0.4.1 + +- Upgrading to `automattic/vipwpcs` v2.3.3 and `dealerdirect/phpcodesniffer-composer-installer` v0.7.2. + +### 0.4.0 + +- Add PHPCompatibilityWP sniffs to our rules, configured for PHP 8.0+ +- Make template-parts rule checking more ambiguous to better support scanning standalone plugins and themes +- Added `static analysis` keyword to Composer to promote package to be installed with `--dev`. + +### 0.3.0 + +- Add PHPCompatibilityWP standard as a dependency (#9) +- Exclude plugin template parts from WordPress.NamingConventions.PrefixAllGlobals sniff (#11) +- Remove 'wp_cache_set' from forbidden functions (#12) + +### 0.2.0 + +- Sniff name changed to Alley-Interactive. +- Composer package renamed to `alleyinteractive/alley-coding-standards`. +- Allow short ternary syntax (#6) + +### 0.1.0 + +- Initial release. diff --git a/vendor/alleyinteractive/alley-coding-standards/LICENSE b/vendor/alleyinteractive/alley-coding-standards/LICENSE new file mode 100644 index 00000000..d159169d --- /dev/null +++ b/vendor/alleyinteractive/alley-coding-standards/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + 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/vendor/alleyinteractive/alley-coding-standards/README.md b/vendor/alleyinteractive/alley-coding-standards/README.md new file mode 100644 index 00000000..7216206a --- /dev/null +++ b/vendor/alleyinteractive/alley-coding-standards/README.md @@ -0,0 +1,93 @@ +# Alley Coding Standards + +[![Example of a badge pointing to the readme standard spec](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) + +This is a PHPCS ruleset for [Alley Interactive](https://alley.com). + +## Installation + +To use this standard in a project, declare it as a dependency. + +```bash +composer require --dev alleyinteractive/alley-coding-standards +``` + +This will install the latest compatible version of PHPCS, WPCS, and VIPCS to your vendor directory in order to run sniffs locally. + +You can also manually add this to your project's `composer.json` file as part of the `require` property: + +```json +"require": { + "alleyinteractive/alley-coding-standards": "^2.0" +} +``` + +## Usage + +To use this standard with `phpcs` directly from your command line, use the command: + +```bash +vendor/bin/phpcs --standard=Alley-Interactive . +``` + +Alternatively, you can set this as a composer script, which will automatically reference the correct version of `phpcs` and the dependent standards. + +```json +"scripts": { + "phpcs" : "phpcs --standard=Alley-Interactive ." +} +``` + +Then use the following command: + +```bash +composer run phpcs +``` + +You can also pass arguments to the composer phpcs script, following a `--` operator like this: + +```bash +composer run phpcs -- --report=summary +``` + +### Extending the Ruleset + +You can create a custom ruleset for your project that extends or customizes +these rules by creating your own `phpcs.xml` file in your project, which +references these rules, like this: + +```xml + + + Example project ruleset + + + + + + +``` + +## Testing + +When contributing to this project, modifications to the ruleset should have a +corresponding test in the `tests` directory. For the most part, this takes the +form of a passing test in `tests/fixtures/pass` and a failing one in +`tests/fixtures/fail`. You can run the tests with `composer phpunit`. If you +want to run PHPCS against the test fixtures, you can run +`composer phpcs:fixtures` to ensure that what is passing/failing matches your +expectations. For failing fixtures in `tests/fixtures/fail`, we recommend +keeping the files smaller and focused on the specific sniff being tested. + +## Changelog + +Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. + +## Credits + +This project is actively maintained by [Alley Interactive](https://github.com/alleyinteractive). +Like what you see? [Come work with us](https://alley.com/careers/). + +## License + +The GNU General Public License (GPL) license. Please see [License File](LICENSE) for more information. diff --git a/vendor/alleyinteractive/alley-coding-standards/composer.json b/vendor/alleyinteractive/alley-coding-standards/composer.json new file mode 100644 index 00000000..be8eb8eb --- /dev/null +++ b/vendor/alleyinteractive/alley-coding-standards/composer.json @@ -0,0 +1,38 @@ +{ + "name": "alleyinteractive/alley-coding-standards", + "description": "PHPCS sniffs for Alley Interactive", + "license": "GPL-2.0-or-later", + "type": "phpcodesniffer-standard", + "keywords": [ + "phpcs", + "static analysis" + ], + "require": { + "automattic/vipwpcs": "^3.0", + "phpcompatibility/phpcompatibility-wp": "^2.1.4" + }, + "require-dev": { + "phpunit/phpunit": "^11.2" + }, + "autoload-dev": { + "psr-4": { + "Alley\\WP\\Coding_Standards\\Tests\\": "tests/" + } + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true, + "alleyinteractive/composer-wordpress-autoloader": true + } + }, + "scripts": { + "phpcbf": "phpcbf --standard=Alley-Interactive tests/*Test.php", + "phpcs": "phpcs --standard=Alley-Interactive tests/*Test.php -sn", + "phpcs:fixtures": "phpcs -sn --standard=Alley-Interactive tests/fixtures", + "phpunit": "phpunit", + "test": [ + "@phpcs", + "@phpunit" + ] + } +} diff --git a/vendor/alleyinteractive/composer-wordpress-autoloader/CHANGELOG.md b/vendor/alleyinteractive/composer-wordpress-autoloader/CHANGELOG.md new file mode 100644 index 00000000..1bd5d96c --- /dev/null +++ b/vendor/alleyinteractive/composer-wordpress-autoloader/CHANGELOG.md @@ -0,0 +1,62 @@ +# Changelog + +All notable changes to `alleyinteractive/composer-wordpress-autoloader` will be +documented in this file. + +## Unreleased + +## v1.1.0 + +### Changed + +- Dropped PHP 7.4 support, adding PHP 8.2 and 8.3 support explicitly with testing. +- Added testing against Windows. + +### Fixed + +- Fixed issue with `wordpress-autoload.php` file not properly loading on Windows. + +## v1.0.0 + +No changes, tagging a stable release. + +## v0.8.0 + +- Automatically translate the `vendor-dir` and set the autoloaded files relative to the root directory of the project. + +## v0.7.0 + +- Add APCu autoloader. +- Bump `alleyinteractive/wordpress-autoloader` to `v1.1.0`. + +## v0.6.0 + +- Simplify injection of autoloader. +- Automatically load the autoloader inside of `vendor/autoload.php` without the + need to load `vendor/wordpress-autoload.php` manually. + +## v0.4.1 + +### Updated + +* Fix Composer Injection to `vendor/autoload.php` in https://github.com/alleyinteractive/composer-wordpress-autoloader/pull/10 + +## v0.4.0 + +### Added + +- Bump alleyinteractive/wordpress-autoloader to 0.2 by @srtfisher in https://github.com/alleyinteractive/composer-wordpress-autoloader/pull/7 +- Supports PHP 8.1 + +## 0.3.0 + +- Remove specific Composer version dependency. + +## 0.2.0 + +- Updates autoloader to use non-hard-coded paths. +- Adds support for dependencies to autoload files as well, fixes [#3](https://github.com/alleyinteractive/composer-wordpress-autoloader/issues/3). + +## 0.1.0 + +- Initial release. diff --git a/vendor/alleyinteractive/composer-wordpress-autoloader/README.md b/vendor/alleyinteractive/composer-wordpress-autoloader/README.md new file mode 100644 index 00000000..ee4d45ea --- /dev/null +++ b/vendor/alleyinteractive/composer-wordpress-autoloader/README.md @@ -0,0 +1,94 @@ +# Composer WordPress Autoloader + +[![Latest Version on Packagist](https://img.shields.io/packagist/v/alleyinteractive/composer-wordpress-autoloader.svg?style=flat-square)](https://packagist.org/packages/alleyinteractive/composer-wordpress-autoloader) +[![Tests](https://github.com/alleyinteractive/composer-wordpress-autoloader/actions/workflows/tests.yml/badge.svg)](https://github.com/alleyinteractive/composer-wordpress-autoloader/actions/workflows/tests.yml) + +Autoload WordPress files configured via Composer that support the [Wordpress +Coding +Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/) +using +[alleyinteractive/wordpress-autoloader](https://github.com/alleyinteractive/wordpress-autoloader). +Will load the autoloaded classes defined in your package and all autoloaded +classes in your dependencies. + +## Installation + +You can install the package via composer: + +```bash +composer require alleyinteractive/composer-wordpress-autoloader +``` + +## Usage + +```json +{ + "autoload": { + "wordpress": { + "My_Plugin_Namespace\\": "src/", + } + }, + "autoload-dev": { + "wordpress": { + "My_Plugin_Namespace\\Tests\\": "tests/", + } + } +} +``` + +Once added, you can load `vendor/autoload.php` as normal and the autoloader will +handle the rest. If that doesn't work, see [Automatically Injecting WordPress +Autoloader](#automatically-injecting-wordpress-autoloader). + +### Use Inside Packages Published to Packagist + +Packages published to Packagist are required to be valid and have a +`composer.json` that passed a `composer validate`. Composer does not consider +`wordpress` to be a valid value inside of the `autoload` or `autoload-dev` +property. To allow packages to register autoloading in a valid format, you can +use the following format: + +```json +{ + "extra": { + "wordpress-autoloader": { + "autoload": { + "My_Plugin_Namespace\\": "src/", + }, + "autoload-dev": { + "My_Plugin_Namespace\\Tests\\": "tests/", + } + } + } +} +``` + +### Automatically Injecting WordPress Autoloader + +By default Composer WordPress Autoloader will automatically load the WordPress +autoloader. This is done by adding `src/autoload.php` as an autoloaded file to +Composer. However, this may not always work under some circumstances including +symlinks. When necessary, you can opt to inject the +`vendor/wordpress-autoload.php` file into your `vendor/autoload.php` file. This +is disabled by default and be enabled by setting `inject` to `true` in your +`composer.json`. + +```json +{ + "extra": { + "wordpress-autoloader": { + "inject": true + } + } +} +``` + +## Testing + +```bash +composer test +``` + +## Changelog + +Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. diff --git a/vendor/alleyinteractive/composer-wordpress-autoloader/composer.json b/vendor/alleyinteractive/composer-wordpress-autoloader/composer.json new file mode 100644 index 00000000..779de3d5 --- /dev/null +++ b/vendor/alleyinteractive/composer-wordpress-autoloader/composer.json @@ -0,0 +1,55 @@ +{ + "name": "alleyinteractive/composer-wordpress-autoloader", + "type": "composer-plugin", + "description": "Autoload files using WordPress File Conventions using Composer", + "license": "GPL-2.0-or-later", + "authors": [ + { + "name": "Alley Interactive", + "email": "info@alley.co" + }, + { + "name": "Sean Fisher", + "email": "sean@alley.co" + } + ], + "require": { + "php": "^8.0", + "alleyinteractive/wordpress-autoloader": "^1.1.1", + "composer-plugin-api": "^2.0" + }, + "require-dev": { + "composer/composer": "*", + "phpunit/phpunit": "^9.5.8", + "squizlabs/php_codesniffer": "^4.0" + }, + "extra": { + "class": "ComposerWordPressAutoloader\\Plugin" + }, + "autoload": { + "files": [ + "src/autoload.php" + ], + "psr-4": { + "ComposerWordPressAutoloader\\": "src/" + } + }, + "minimum-stability": "dev", + "prefer-stable": true, + "scripts": { + "lint": "@phpcs", + "lint:fix": "@phpcbf", + "phpcbf": "phpcbf --standard=./phpcs.xml.dist .", + "phpcs": "phpcs --standard=./phpcs.xml.dist .", + "phpunit": "phpunit", + "test": [ + "@phpcs", + "@phpunit" + ] + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + } +} diff --git a/vendor/alleyinteractive/composer-wordpress-autoloader/phpcs.xml.dist b/vendor/alleyinteractive/composer-wordpress-autoloader/phpcs.xml.dist new file mode 100644 index 00000000..616aa35a --- /dev/null +++ b/vendor/alleyinteractive/composer-wordpress-autoloader/phpcs.xml.dist @@ -0,0 +1,21 @@ + + + Coding standards for Composer WordPress Autoload Plugin + + + + + + + + . + */.github/* + */vendor/* + tests/fixtures/* + + + + + + diff --git a/vendor/alleyinteractive/composer-wordpress-autoloader/src/AutoloadFactory.php b/vendor/alleyinteractive/composer-wordpress-autoloader/src/AutoloadFactory.php new file mode 100644 index 00000000..6d741dd0 --- /dev/null +++ b/vendor/alleyinteractive/composer-wordpress-autoloader/src/AutoloadFactory.php @@ -0,0 +1,61 @@ +> $rules Array of rules. + * @return array + */ + public static function generateFromRules(array $rules) + { + $loaders = []; + + foreach ($rules as $namespace => $paths) { + $loaders = array_merge( + $loaders, + array_map(function ($path) use ($namespace) { + $loader = new Autoloader($namespace, $path); + + if (static::$apcuPrefix) { + $loader->set_apcu_prefix(static::$apcuPrefix); + } + + return $loader; + }, $paths), + ); + } + + return $loaders; + } + + /** + * Register autoloaders from rules. + * + * @param array $rules Array of rules. + * @return void + */ + public static function registerFromRules(array $rules) + { + foreach (static::generateFromRules($rules) as $autoloader) { + $autoloader->register(); + } + } +} diff --git a/vendor/alleyinteractive/composer-wordpress-autoloader/src/AutoloadGenerator.php b/vendor/alleyinteractive/composer-wordpress-autoloader/src/AutoloadGenerator.php new file mode 100644 index 00000000..e6d8c279 --- /dev/null +++ b/vendor/alleyinteractive/composer-wordpress-autoloader/src/AutoloadGenerator.php @@ -0,0 +1,327 @@ +getEventDispatcher(), $io); + + $this->composer = $composer; + } + + /** + * @param bool $devMode + * @return void + */ + public function setDevMode($devMode = true) + { + parent::setDevMode($devMode); + + $this->devMode = (bool) $devMode; + } + + /** + * Whether generated autoloader considers APCu caching. + * + * @param bool $apcu + * @param string|null $apcuPrefix + * @return void + */ + public function setApcuMode(bool $apcu, ?string $apcuPrefix = null) + { + parent::setApcu($apcu, $apcuPrefix); + + $this->apcu = $apcu; + $this->apcuPrefix = $apcuPrefix !== null ? $apcuPrefix : $apcuPrefix; + } + + /** + * Generate the autoload file. + * + * @param boolean $beingInjected Flag if the autoload file is being injected. + * @param boolean $isDevMode Flag if dev dependencies are being included. + * @return string + */ + public function generate(bool $beingInjected, bool $isDevMode = true): string + { + $filesystem = new Filesystem(); + $basePath = $filesystem->normalizePath(realpath(realpath(getcwd()))); + $vendorPath = $filesystem->normalizePath(realpath(realpath($this->composer->getConfig()->get('vendor-dir')))); + + $vendorPathCode = '__DIR__'; + + $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true); + $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode); + + $this->setDevMode($isDevMode); + + // Collect all the rules from all the packages. + $rules = array_merge_recursive( + $this->collectAutoloaderRules(), + $this->collectExtraAutoloaderRules(), + ); + + foreach ($rules as $namespace => $paths) { + // Convert the paths to be relative to the vendor/wordpress-autoload.php file. + $rules[$namespace] = array_values(array_unique( + array_map(fn ($path) => $this->getPathCode($filesystem, $basePath, $vendorPath, $path), $paths), + )); + } + + return $this->getAutoloadFileContents($rules, $beingInjected, $vendorPathCode, $appBaseDirCode); + } + + /** + * Create the autoloader file contents to write to vendor/wordpress-autoload.php. + * + * @param array $rules The rules to use to generate the autoloader. + * @param boolean $beingInjected Flag if the autoload file is being injected. + * @param string $vendorPathCode Vendor path code. + * @param string $appBaseDirCode App base dir code. + * @return string + */ + protected function getAutoloadFileContents( + array $rules, + bool $beingInjected, + string $vendorPathCode, + string $appBaseDirCode + ): string { + $autoloadFileContents = <<apcu) { + $apcuPrefix = var_export( + $this->apcuPrefix !== null + ? $this->apcuPrefix + : substr(base64_encode(md5(uniqid('', true), true)), 0, -3), + true, + ); + $autoloadFileContents .= "\n\\ComposerWordPressAutoloader\AutoloadFactory::setApcuPrefix($apcuPrefix);\n"; + } + + // Inject the file paths for the autoloader. + $autoloadFileContents .= << $paths) { + $autoloadFileContents .= sprintf( + ' %s => array(%s),', + var_export($namespace, true), + implode(', ', $paths), + ) . PHP_EOL; + } + + $autoloadFileContents .= "));\n"; + + if (!$beingInjected) { + $autoloadFileContents .= "\nreturn \$autoload;"; + } + + return $autoloadFileContents . "\n"; + } + + /** + * Collect the autoloader rules from 'autoload' and 'autoload-dev' to + * generate rules for. + * + * @return array + */ + protected function collectAutoloaderRules(): array + { + return $this->parseAutoloads( + $this->buildPackageMap( + $this->composer->getInstallationManager(), + $this->composer->getPackage(), + $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages(), + ), + $this->composer->getPackage(), + !$this->devMode, + )['wordpress'] ?? []; + } + + /** + * Collect the autoloader rules registered via 'extra' to generate for. + * + * @return array + */ + protected function collectExtraAutoloaderRules(): array + { + return $this->parseExtraAutoloads( + $this->buildPackageMap( + $this->composer->getInstallationManager(), + $this->composer->getPackage(), + $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages(), + ), + $this->composer->getPackage(), + !$this->devMode, + )['wordpress'] ?? []; + } + + /** + * Compiles an ordered list of namespace => path mappings + * + * @param array $packageMap + * @param PackageInterface $rootPackage + * @param boolean $filteredDevPackages + * @return array> + */ + public function parseAutoloads(array $packageMap, PackageInterface $rootPackage, $filteredDevPackages = false) + { + $rootPackageMap = array_shift($packageMap); + + // Mirroring existing logic in the Composer AutoloadGenerator. + if (is_array($filteredDevPackages)) { + $packageMap = array_filter($packageMap, function ($item) use ($filteredDevPackages) { + return !in_array($item[0]->getName(), $filteredDevPackages, true); + }); + } elseif ($filteredDevPackages) { + $packageMap = $this->filterPackageMap($packageMap, $rootPackage); + } + + if ($filteredDevPackages) { + $packageMap = $this->filterPackageMap($packageMap, $rootPackage); + } + + $sortedPackageMap = $this->sortPackageMap($packageMap); + $sortedPackageMap[] = $rootPackageMap; + array_unshift($packageMap, $rootPackageMap); + + $wordpress = $this->parseAutoloadsType($sortedPackageMap, 'wordpress', $rootPackage); + + krsort($wordpress); + + return [ + 'wordpress' => $wordpress, + ]; + } + + /** + * Compiles an ordered list of namespace => path mappings of autoloads defined in the 'extra' part of a package. + * + * @param array $packageMap + * @param PackageInterface $rootPackage + * @param boolean $filteredDevPackages + * @return array + */ + public function parseExtraAutoloads(array $packageMap, PackageInterface $rootPackage, $filteredDevPackages = false) + { + $rootPackageMap = array_shift($packageMap); + + // Mirroring existing logic in the Composer AutoloadGenerator. + if (is_array($filteredDevPackages)) { + $packageMap = array_filter($packageMap, function ($item) use ($filteredDevPackages) { + return !in_array($item[0]->getName(), $filteredDevPackages, true); + }); + } elseif ($filteredDevPackages) { + $packageMap = $this->filterPackageMap($packageMap, $rootPackage); + } + + if ($filteredDevPackages) { + $packageMap = $this->filterPackageMap($packageMap, $rootPackage); + } + + $sortedPackageMap = $this->sortPackageMap($packageMap); + $sortedPackageMap[] = $rootPackageMap; + array_unshift($packageMap, $rootPackageMap); + + return [ + 'wordpress' => $this->parseExtraAutoloadsType($sortedPackageMap, 'wordpress', $rootPackage), + ]; + } + + /** + * A modified port of the {@see AutoloadGenerator::parseAutoloadsType()} method from Composer. + * + * Imports autoload rules from a package's extra path. + * + * @param array $packageMap + * @param string $type one of: 'wordpress' + * @return array|array>|array + */ + protected function parseExtraAutoloadsType(array $packageMap, $type, RootPackageInterface $rootPackage) + { + $autoloads = []; + + foreach ($packageMap as $item) { + [$package, $installPath] = $item; + $autoload = [ + 'wordpress' => $package->getExtra()['wordpress-autoloader']['autoload'] ?? [], + ]; + + // Include autoload dev if we're in dev mode and this is the root package. + // Non-root package dev dependencies are not loaded. + if ($this->devMode && $package === $rootPackage) { + $autoload = array_merge_recursive( + $autoload, + [ + 'wordpress' => $package->getExtra()['wordpress-autoloader']['autoload-dev'] ?? [], + ], + ); + } + + // Skip misconfigured packages. + if (!isset($autoload[$type]) || !is_array($autoload[$type])) { + continue; + } + + if (null !== $package->getTargetDir() && $package !== $rootPackage) { + $installPath = substr($installPath, 0, -strlen('/' . $package->getTargetDir())); + } + + if ($package !== $rootPackage && $rootPackage->getTargetDir()) { + $installPath = str_replace($rootPackage->getTargetDir(), '', $installPath); + } + + foreach ($autoload[$type] as $namespace => $paths) { + foreach ((array) $paths as $path) { + $relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath . '/' . $path; + $autoloads[$namespace][] = $relativePath; + } + } + } + + return $autoloads; + } +} diff --git a/vendor/alleyinteractive/composer-wordpress-autoloader/src/Plugin.php b/vendor/alleyinteractive/composer-wordpress-autoloader/src/Plugin.php new file mode 100644 index 00000000..90c9c021 --- /dev/null +++ b/vendor/alleyinteractive/composer-wordpress-autoloader/src/Plugin.php @@ -0,0 +1,209 @@ +composer = $composer; + $this->io = $io; + $this->filesystem = new Filesystem(); + } + + /** + * Remove any hooks from Composer + * + * This will be called when a plugin is deactivated before being + * uninstalled, but also before it gets upgraded to a new version + * so the old one can be deactivated and the new one activated. + * + * @param Composer $composer + * @param IOInterface $io + * + * @return void + */ + public function deactivate(Composer $composer, IOInterface $io) + { + } + + /** + * Prepare the plugin to be uninstalled + * + * This will be called after deactivate. + * + * @param Composer $composer + * @param IOInterface $io + * + * @return void + */ + public function uninstall(Composer $composer, IOInterface $io) + { + if ($this->filesystem->remove($this->getAutoloaderFilePath())) { + $this->io->write('Removed WordPress autoloader.'); + } + } + + /** + * Returns an array of event names this subscriber wants to listen to. + * + * @return array + */ + public static function getSubscribedEvents() + { + return [ + 'post-autoload-dump' => 'generateAutoloaderFile', + ]; + } + + /** + * Generate the autoloader file. + * + * @param Event $event + * @return void + */ + public function generateAutoloaderFile(Event $event): void + { + $this->filesystem->ensureDirectoryExists($this->composer->getConfig()->get('vendor-dir')); + + $this->generator = new AutoloadGenerator( + $this->composer, + $this->io, + ); + + $this->generator->setApcuMode( + $this->composer->getConfig()->get('apcu-autoloader') + ); + + // Merge default configuration with the one provided in the composer.json file. + $extra = array_merge( + [ + 'inject' => false, + ], + $this->composer->getPackage()->getExtra()['wordpress-autoloader'] ?? [], + ); + + /** + * Determine if we should inject our autoloader into the + * vendor/autoload.php from Composer. + * + * Injecting is not generally necessary any more since the file will + * automatically be loaded. However, it is still possible to inject it + * for circumstances where it is needed such as when dealing with symlinks. + */ + $injecting = $extra['inject'] ?? false; + + $autoloaderFile = $this->generator->generate($injecting, $event->isDevMode()); + + $partyEmoji = [ + '🪩', + '🎉', + '🎊', + '🍾', + ]; + + $partyEmoji = $partyEmoji[array_rand($partyEmoji)]; + + if ( + $this->filesystem->filePutContentsIfModified( + $this->getAutoloaderFilePath(), + $autoloaderFile, + ) + ) { + if (!$injecting) { + $this->io->write("{$partyEmoji} WordPress autoloader generated"); + } + } + + // Inject the autoloader into the existing autoloader. + if ($injecting) { + if ( + $this->filesystem->filePutContentsIfModified( + $this->composer->getConfig()->get('vendor-dir') . '/autoload.php', + $this->getInjectedAutoloaderFileContents($this->getAutoloaderFilePath()), + ) + ) { + $this->io->write( + "{$partyEmoji} WordPress autoloader genearted and injected into vendor/autoload.php." + ); + } else { + $this->io->write('⚠️ Error injecting Wordpress Autoloader.'); + } + } + } + + /** + * Retrieve the file path for the autoloader file. + * + * @return string + */ + protected function getAutoloaderFilePath(): string + { + $vendorDir = $this->composer->getConfig()->get('vendor-dir'); + return "{$vendorDir}/wordpress-autoload.php"; + } + + /** + * Generate the injected autoloader file. + * + * @param string $autoloaderFileName The path to the WordPress autoloader file. + * @return string + */ + protected function getInjectedAutoloaderFileContents(string $autoloaderFileName): string + { + $filename = basename($autoloaderFileName); + $autoloader = file_get_contents($this->composer->getConfig()->get('vendor-dir') . '/autoload.php'); + + $contents = preg_replace_callback( + '/^return (.*);$/m', + function ($matches) use ($filename) { + $autoloader = << wordpress-autoloader' + section of your composer.json file to false. Injecting the autoloader is + not generally necessary as the autoloader is automatically loaded for you. +*/ +require_once __DIR__ . '/{$filename}'; + +return \$loader; +AUTOLOADER; + + return "$autoloader\n"; + }, + $autoloader, + 1, + $count, + ); + + if (!$count) { + throw new RuntimeException('Error finding proper place to inject autoloader.'); + } + + return $contents; + } +} diff --git a/vendor/alleyinteractive/composer-wordpress-autoloader/src/autoload.php b/vendor/alleyinteractive/composer-wordpress-autoloader/src/autoload.php new file mode 100644 index 00000000..64922229 --- /dev/null +++ b/vendor/alleyinteractive/composer-wordpress-autoloader/src/autoload.php @@ -0,0 +1,30 @@ + + 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/vendor/alleyinteractive/laminas-validator-extensions/README.md b/vendor/alleyinteractive/laminas-validator-extensions/README.md new file mode 100644 index 00000000..9084c84b --- /dev/null +++ b/vendor/alleyinteractive/laminas-validator-extensions/README.md @@ -0,0 +1,377 @@ +# Laminas Validator Extensions + +This package provides additional validation classes for [the Laminas Validator framework](https://docs.laminas.dev/laminas-validator/), plus a custom base validation class. + +## Installation + +Install the latest version with: + +```bash +$ composer require alleyinteractive/laminas-validator-extensions +``` + +## Basic usage + +For more information about what validators do, how to use them, and how to write your own, [visit the Laminas documentation](https://docs.laminas.dev/laminas-validator/). + +## Base validators + +### `ExtendedAbstractValidator` + +The abstract `Alley\Validator\ExtendedAbstractValidator` class standardizes the implementation of custom validators with `\Laminas\Validator\AbstractValidator`. + +When extending `ExtendedAbstractValidator`, validation logic goes into a new `testValue()` method, which is responsible only for applying the logic and adding any validation errors. It's no longer necessary to call `setValue()` prior to evaluating the input, and `isValid()` will return `true` if there are no error messages after evaluating the input and `false` if there are any messages. + +Before: + +```php + "'%value%' is not a floating point value", + ]; + + public function isValid($value) + { + $this->setValue($value); + + if (! is_float($value)) { + $this->error(self::FLOAT); + return false; + } + + return true; + } +} +``` + +After: + +```php + "'%value%' is not a floating point value", + ]; + + public function testValue($value): void + { + if (! is_float($value)) { + $this->error(self::FLOAT); + } + } +} +``` + +### `FreeformValidator` + +The standalone, abstract `Alley\Validator\FreeformValidator` class leaves most of the implementation details to your discretion, but it's often easier to use for validators that are project-specific or not ready for wider distribution. + +Like the `ExtendedAbstractValidator` class, the `FreeformValidator` expects that validation logic goes into a `testValue()` method, and `isValid()` will return `true` or `false` based on whether there are error messages. + +Validation errors can be added using the `error()` method, which accepts the message key and text. + +```php +error('float', 'Please enter a floating point value'); + } + } +} +``` + +## "Any Validator" chains + +`\Alley\Validator\AnyValidator` is like a [Laminas validator chain](https://docs.laminas.dev/laminas-validator/validator-chains/) except that it connects the validators with "OR," marking input as valid as soon it passes one of the given validators. + +Unlike a Laminas validator chain, validators can only be attached, not prepended, and there is no `$priority` argument. + +### Basic usage + +```php + 10])]); +$valid->attach(new \Laminas\Validator\GreaterThan(['min' => 90])); + +$valid->isValid(9); // true +$valid->isValid(99); // true +$valid->isValid(42); // false +``` + +## "Fast fail" validator chains + +`\Alley\Validator\FastFailValidatorChain` is like a [Laminas validator chain](https://docs.laminas.dev/laminas-validator/validator-chains/) except that if a validator fails, the chain will automatically be broken; there is no `$breakChainOnFailure` parameter. + +Unlike a Laminas validator chain, validators can only be attached, not prepended, and there is no `$priority` argument. + +### Basic usage + +```php +$valid = new \Alley\Validator\FastFailValidatorChain([new \Laminas\Validator\LessThan(['max' => 10])]); +$valid->attach(new \Laminas\Validator\GreaterThan(['min' => 90])); + +$valid->isValid(42); // false +count($valid->getMessages()); // 1 +``` + +## Validators by operator name + +`\Alley\Validator\ValidatorByOperator` allows you to access a validator using a readable operator name, such as `REGEX` or `NOT IN`. + +Its primary use case is to allow you to write functions that accept the readable operator names as parameters while using validators internally. Here's a demonstrative function call from [the wp-match-blocks library](https://github.com/alleyinteractive/wp-match-blocks): + +```php + 'core/image', + 'attrs' => [ + [ + 'key' => 'credit', + 'value' => '/(The )?Associated Press/i', + 'operator' => 'REGEX', + ], + ], + ], +); +``` + +The supported operator names are: + +* `CONTAINS` and `NOT CONTAINS`, which forward to `\Alley\Validator\ContainsString` using a case-sensitive search. +* `IN` and `NOT IN`, which forward to `\Alley\Validator\OneOf`. +* `LIKE` and `NOT LIKE`, which forward to `\Alley\Validator\ContainsString` using a case-insensitive search. +* `REGEX` and `NOT REGEX`, which forward to `\Laminas\Validator\Regex`. +* `===`, `!==`, and the other operators supported by `\Alley\Validator\Comparison`. + +Any operator name that isn't forwarded to a different validator must be a valid `Comparison` operator. + +### Basic usage + +```php +$valid = new \Alley\Validator\ValidatorByOperator('REGEX', '/^foo/'); +$valid->isValid('foobar'); // true + +$valid = new \Alley\Validator\ValidatorByOperator('NOT IN', ['bar', 'baz']); +$valid->isValid('bar'); // false + +$valid = new \Alley\Validator\ValidatorByOperator('!==', 42); +$valid->isValid(43); // true +``` + +## Validators + +### `AlwaysValid` + +`\Alley\Validator\AlwaysValid` marks all input as valid. It can be used to satisfy type requirements when full validation needs to be disabled or is impractical. + +#### Supported options + +None. + +#### Basic usage + +```php +isValid(42); // true +$valid->isValid(false); // true +$valid->isValid('abcdefghijklmnopqrstuvwxyz'); // true +``` + +### `Comparison` + +`\Alley\Validator\Comparison` compares input to another value using a PHP [comparison operator](https://www.php.net/manual/en/language.operators.comparison.php). The input passes validation if the comparison is true. Input is placed on the left side of the operator. + +#### Supported options + +The following options are supported for `\Alley\Validator\Comparison`: + +- `compared`: The value the inputs are compared to. It is placed on the right side of the operator. +- `operator`: The PHP comparison operator used to compare the input and `compared`. + +#### Basic usage + +```php + '<=', + 'compared' => 100, + ] +); +$valid->isValid(101); // false + +$valid = new \Alley\Validator\Comparison( + [ + 'operator' => '!==', + 'compared' => false, + ] +); +$valid->isValid(true); // true +``` + +### `ContainsString` + +`\Alley\Validator\ContainsString` is a validator around the `str_contains()` function. Each instance of the validator represents the "needle" string and validates whether the string is found within the input "haystack." Inputs will automatically be cast to strings. + +#### Supported options + +The following options are supported for `\Alley\Validator\ContainsString`: + +- `needle`: The string or instance of `\Stringable` the inputs are searched for. It will automatically be cast to a string at the time of validation. +- `ignoreCase`: Whether to perform a case-insensitive search. False by default. + +#### Basic usage + +```php + 'foo', + ], +); + +$valid->isValid('foobar'); // true +$valid->isValid('barbaz'); // false +``` + +### `DivisibleBy` + +`\Alley\Validator\DivisibleBy` allows you to validate whether the input is evenly divisible by a given numeric value. Inputs will automatically be cast to integers. + +#### Supported options + +The following options are supported for `\Alley\Validator\DivisibleBy`: + +- `divisor`: The value the inputs are divided by. It will automatically be cast to an integer. + +#### Basic usage + +```php + 3, + ], +); + +$valid->isValid(9); // true +$valid->isValid(10); // false +``` + +### `Not` + +`Alley\Validator\Not` inverts the validity of a given validator. It allows for creating validators that test whether input is, for example, "not one of" in addition to "one of." + +#### Supported options + +None. + +#### Basic usage + +```php + ['foo', 'bar']]); +$valid = new \Alley\Validator\Not($origin, 'The input was invalid.'); + +$valid->isValid('foo'); // false +$valid->isValid('baz'); // true +``` + +### `OneOf` + +`Alley\Validator\OneOf` validates whether an array of scalar values contains the input. + +`OneOf` is a simpler version of `\Laminas\Validator\InArray` that accepts only scalar values in the haystack and does only strict comparisons. In return, it produces a friendlier error message that lists the allowed values. + +#### Supported options + +The following options are supported for `\Alley\Validator\OneOf`: + +- `haystack`: The array to be searched for the input. + +#### Basic Usage + +```php + ['one', 'two', 'three']]); +$valid->isValid('four'); // false +$valid->getMessages(); // ['notOneOf' => 'Must be one of [one, two, three] but is four.'] +``` + +### `Type` + +`\Alley\Validator\Type` allows you to validate whether the input is of the given PHP type. The input passes if it is the expected type. + +This validator is inspired by PHPUnit's `\PHPUnit\Framework\Constraint\IsType` class. + +#### Supported options + +The following options are supported for `\Alley\Validator\Type`: + +- `type`: The expected PHP type. Supported types are `array`, `bool`, `boolean`, `callable`, `double`, `float`, `int`, `integer`, `iterable`, `null`, `numeric`, `object`, `real`, `resource`, `string`, and `scalar`. + +#### Basic usage + +```php + 'callable']); +$valid->isValid('date_create_immutable'); // true + +$valid = new \Alley\Validator\Type(['type' => 'bool']); +$valid->isValid([]); // false +``` + +### `WithMessage` + +`Alley\Validator\WithMessage` allows you to decorate a validator with a custom failure code and message, replacing the validator's usual failure messages. + +#### Supported options + +None. + +#### Basic usage + +```php +isValid(41); // false +$valid->getMessages(); // ['tooSmall' => 'Please enter a number greater than 42.'] +``` + +## About + +### License + +[GPL-2.0-or-later](https://github.com/alleyinteractive/laminas-validator-extensions/blob/main/LICENSE) + +### Maintainers + +[Alley Interactive](https://github.com/alleyinteractive) diff --git a/vendor/alleyinteractive/laminas-validator-extensions/composer.json b/vendor/alleyinteractive/laminas-validator-extensions/composer.json new file mode 100644 index 00000000..7334a9e2 --- /dev/null +++ b/vendor/alleyinteractive/laminas-validator-extensions/composer.json @@ -0,0 +1,40 @@ +{ + "name": "alleyinteractive/laminas-validator-extensions", + "description": "Additional validation classes for the laminas-validator framework.", + "type": "library", + "license": "GPL-2.0-or-later", + "authors": [ + { + "name": "Alley", + "email": "info@alley.com" + } + ], + "autoload": { + "psr-4": { + "Alley\\": "src/Alley/" + } + }, + "autoload-dev": { + "psr-4": { + "Alley\\": "tests/Alley/" + } + }, + "config": { + "lock": false + }, + "require": { + "php": "^8.0", + "laminas/laminas-validator": "^2.20" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.8", + "phpunit/phpunit": "^9.5", + "squizlabs/php_codesniffer": "^3.6" + }, + "scripts": { + "fixer": "php-cs-fixer -v fix --allow-risky=yes", + "phpcbf": "phpcbf", + "phpcs": "phpcs", + "phpunit": "phpunit" + } +} diff --git a/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/AlwaysValid.php b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/AlwaysValid.php new file mode 100644 index 00000000..c2f142a9 --- /dev/null +++ b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/AlwaysValid.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Alley\Validator; + +use Laminas\Validator\ValidatorInterface; + +final class AlwaysValid implements ValidatorInterface +{ + public function isValid($value) + { + return true; + } + + public function getMessages() + { + return []; + } +} diff --git a/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/AnyValidator.php b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/AnyValidator.php new file mode 100644 index 00000000..dd9b0c5d --- /dev/null +++ b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/AnyValidator.php @@ -0,0 +1,91 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Alley\Validator; + +use Countable; +use Laminas\Validator\ValidatorInterface; +use ReturnTypeWillChange; + +final class AnyValidator implements Countable, ValidatorInterface +{ + /** + * Validator chain. + * + * @var ValidatorInterface[] + */ + protected array $validators = []; + + /** + * Array of validation failure messages. + * + * @var string[] + */ + protected $messages = []; + + /** + * @param ValidatorInterface[] $validators + */ + public function __construct(array $validators) + { + foreach ($validators as $validator) { + $this->attach($validator); + } + } + + /** + * Attach a validator to the end of the chain. + * + * @param ValidatorInterface $validator + * @return self + */ + public function attach(ValidatorInterface $validator) + { + $this->validators[] = $validator; + + return $this; + } + + public function isValid($value) + { + $this->messages = []; + + if ($this->count() === 0) { + // Consistent with `\Laminas\Validator\ValidatorChain()`. + return true; + } + + foreach ($this->validators as $validator) { + if ($validator->isValid($value)) { + return true; + } + } + + foreach ($this->validators as $validator) { + $this->messages = array_replace($this->messages, $validator->getMessages()); + } + + return false; + } + + public function getMessages() + { + return $this->messages; + } + + #[ReturnTypeWillChange] + public function count() + { + return \count($this->validators); + } +} diff --git a/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/Comparison.php b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/Comparison.php new file mode 100644 index 00000000..d3d45256 --- /dev/null +++ b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/Comparison.php @@ -0,0 +1,109 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Alley\Validator; + +use Laminas\Validator\Exception\InvalidArgumentException; +use Laminas\Validator\ValidatorInterface; + +final class Comparison extends ExtendedAbstractValidator +{ + private const SUPPORTED_OPERATORS = [ + '==', + '===', + '!=', + '<>', + '!==', + '<', + '>', + '<=', + '>=', + ]; + + private const OPERATOR_ERROR_CODES = [ + '==' => 'notEqual', + '===' => 'notIdentical', + '!=' => 'isEqual', + '<>' => 'isEqual', + '!==' => 'isIdentical', + '<' => 'notLessThan', + '>' => 'notGreaterThan', + '<=' => 'notLessThanOrEqualTo', + '>=' => 'notGreaterThanOrEqualTo', + ]; + + protected $messageTemplates = [ + 'notEqual' => 'Must be equal to %compared% but is %value%.', + 'notIdentical' => 'Must be identical to %compared% but is %value%.', + 'isEqual' => 'Must not be equal to %compared% but is %value%.', + 'isIdentical' => 'Must not be identical to %compared%.', + 'notLessThan' => 'Must be less than %compared% but is %value%.', + 'notGreaterThan' => 'Must be greater than %compared% but is %value%.', + 'notLessThanOrEqualTo' => 'Must be less than or equal to %compared% but is %value%.', + 'notGreaterThanOrEqualTo' => 'Must be greater than or equal to %compared% but is %value%.', + ]; + + protected $messageVariables = [ + 'compared' => ['options' => 'compared'], + ]; + + protected $options = [ + 'compared' => null, + 'operator' => '===', + ]; + + protected function testValue($value): void + { + switch ($this->options['operator']) { + case '==': + $result = $value == $this->options['compared']; + break; + case '!=': + case '<>': + $result = $value != $this->options['compared']; + break; + case '!==': + $result = $value !== $this->options['compared']; + break; + case '<': + $result = $value < $this->options['compared']; + break; + case '>': + $result = $value > $this->options['compared']; + break; + case '<=': + $result = $value <= $this->options['compared']; + break; + case '>=': + $result = $value >= $this->options['compared']; + break; + case '===': + default: + $result = $value === $this->options['compared']; + break; + } + + if (!$result) { + $this->error(self::OPERATOR_ERROR_CODES[$this->options['operator']]); + } + } + + protected function setOperator(string $operator) + { + if (!\in_array($operator, self::SUPPORTED_OPERATORS, true)) { + throw new InvalidArgumentException("Invalid 'operator': {$operator}."); + } + + $this->options['operator'] = $operator; + } +} diff --git a/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/ContainsString.php b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/ContainsString.php new file mode 100644 index 00000000..fa478404 --- /dev/null +++ b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/ContainsString.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Alley\Validator; + +use Laminas\Validator\Exception\InvalidArgumentException; +use Laminas\Validator\IsInstanceOf; +use Laminas\Validator\ValidatorInterface; + +final class ContainsString extends ExtendedAbstractValidator +{ + public const NOT_CONTAINS_STRING = 'notContainsString'; + + protected $messageTemplates = [ + self::NOT_CONTAINS_STRING => 'Must contain string "%needle%".', + ]; + + protected $messageVariables = [ + 'needle' => ['options' => 'needle'], + ]; + + protected $options = [ + 'needle' => '', + 'ignoreCase' => false, + ]; + + protected function testValue($value): void + { + if (\is_scalar($value)) { + $haystack = (string) $value; + $needle = (string) $this->options['needle']; + + if ($this->options['ignoreCase']) { + $haystack = strtolower($haystack); + $needle = strtolower($needle); + } + + if (str_contains($haystack, $needle)) { + return; + } + } + + $this->error(self::NOT_CONTAINS_STRING); + } + + protected function setNeedle($needle) + { + if (!\is_string($needle) && !\is_null($needle) && !$needle instanceof \Stringable) { + throw new InvalidArgumentException("Invalid 'needle': Must be string or instance of \Stringable"); + } + + $this->options['needle'] = $needle; + } +} diff --git a/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/DivisibleBy.php b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/DivisibleBy.php new file mode 100644 index 00000000..ddc668d1 --- /dev/null +++ b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/DivisibleBy.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Alley\Validator; + +use Laminas\Validator\Exception\InvalidArgumentException; +use Laminas\Validator\ValidatorInterface; + +final class DivisibleBy extends ExtendedAbstractValidator +{ + public const NOT_DIVISIBLE_BY = 'notDivisibleBy'; + + protected $messageTemplates = [ + self::NOT_DIVISIBLE_BY => 'Must be evenly divisible by %divisor% but %value% is not.', + ]; + + protected $messageVariables = [ + 'divisor' => ['options' => 'divisor'], + ]; + + protected $options = [ + 'divisor' => 1, + ]; + + protected function testValue($value): void + { + $value = (int) $value; + $actual = $value % $this->options['divisor']; + + if ($actual !== 0) { + $this->error(self::NOT_DIVISIBLE_BY); + } + } + + protected function setDivisor($divisor) + { + $divisor = (int) $divisor; + + if ($divisor === 0) { + throw new InvalidArgumentException("Invalid 'divisor': {$divisor}"); + } + + $this->options['divisor'] = $divisor; + } +} diff --git a/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/ExtendedAbstractValidator.php b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/ExtendedAbstractValidator.php new file mode 100644 index 00000000..32efb54e --- /dev/null +++ b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/ExtendedAbstractValidator.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Alley\Validator; + +use Laminas\Validator\AbstractValidator; + +abstract class ExtendedAbstractValidator extends AbstractValidator +{ + final public function isValid($value): bool + { + $this->setValue($value); + $this->testValue($this->value); + return \count($this->getMessages()) === 0; + } + + /** + * Apply validation logic and add any validation errors. + * + * @param mixed $value + * @return void + */ + abstract protected function testValue($value): void; +} diff --git a/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/FastFailValidatorChain.php b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/FastFailValidatorChain.php new file mode 100644 index 00000000..c5d36798 --- /dev/null +++ b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/FastFailValidatorChain.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Alley\Validator; + +use Laminas\Validator\ValidatorChain; +use Laminas\Validator\ValidatorInterface; + +final class FastFailValidatorChain implements ValidatorInterface +{ + private ValidatorChain $origin; + + /** + * @param ValidatorInterface[] $validators + */ + public function __construct(array $validators) + { + $this->origin = new ValidatorChain(); + + foreach ($validators as $validator) { + $this->attach($validator); + } + } + + /** + * Attach a validator to the end of the chain. + * + * @param ValidatorInterface $validator + * @return self + */ + public function attach(ValidatorInterface $validator) + { + $this->origin->attach($validator, true); + + return $this; + } + + public function isValid($value): bool + { + return $this->origin->isValid($value); + } + + public function getMessages(): array + { + return $this->origin->getMessages(); + } +} diff --git a/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/FreeformValidator.php b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/FreeformValidator.php new file mode 100644 index 00000000..69cc2b1b --- /dev/null +++ b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/FreeformValidator.php @@ -0,0 +1,54 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Alley\Validator; + +use Laminas\Validator\ValidatorInterface; +use Stringable; + +abstract class FreeformValidator implements ValidatorInterface +{ + private array $messages = []; + + /** + * Apply validation logic and add any validation errors. + * + * @param mixed $value + * @return void + */ + abstract protected function testValue($value): void; + + final public function isValid($value): bool + { + $this->messages = []; + $this->testValue($value); + return \count($this->getMessages()) === 0; + } + + final public function getMessages() + { + return $this->messages; + } + + /** + * Add validation error. + * + * @param string $key Error key. + * @param string $message Message text. + * @return void + */ + final protected function error(string $key, $message): void + { + $this->messages[$key] = (string) $message; + } +} diff --git a/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/Not.php b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/Not.php new file mode 100644 index 00000000..b6f94c11 --- /dev/null +++ b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/Not.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Alley\Validator; + +use Laminas\Validator\ValidatorInterface; + +final class Not implements ValidatorInterface +{ + public const NOT_VALID = 'notValid'; + + private ValidatorInterface $origin; + + private string $message; + + private bool $ran = false; + + public function __construct(ValidatorInterface $origin, string $message) + { + $this->origin = $origin; + $this->message = $message; + } + + public function isValid($value) + { + $this->ran = true; + return !$this->origin->isValid($value); + } + + public function getMessages() + { + $messages = []; + + if ($this->ran && \count($this->origin->getMessages()) === 0) { + $messages[self::NOT_VALID] = $this->message; + } + + return $messages; + } +} diff --git a/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/OneOf.php b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/OneOf.php new file mode 100644 index 00000000..9bf0d6a2 --- /dev/null +++ b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/OneOf.php @@ -0,0 +1,54 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Alley\Validator; + +use Laminas\Validator\Callback; +use Laminas\Validator\Exception\InvalidArgumentException; +use Laminas\Validator\Explode; +use Laminas\Validator\ValidatorInterface; + +final class OneOf extends ExtendedAbstractValidator +{ + public const NOT_ONE_OF = 'notOneOf'; + + protected $messageTemplates = [ + self::NOT_ONE_OF => "Must be one of %haystack% but is %value%.", + ]; + + protected $messageVariables = [ + 'haystack' => ['options' => 'haystack'], + ]; + + protected $options = [ + 'haystack' => [], + ]; + + protected function testValue($value): void + { + if (!\in_array($value, $this->options['haystack'], true)) { + $this->error(self::NOT_ONE_OF); + } + } + + protected function setHaystack(array $haystack) + { + foreach ($haystack as $item) { + if (!\is_scalar($item)) { + throw new InvalidArgumentException('Haystack must contain only scalar values.'); + } + } + + $this->options['haystack'] = $haystack; + } +} diff --git a/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/Type.php b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/Type.php new file mode 100644 index 00000000..aef48485 --- /dev/null +++ b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/Type.php @@ -0,0 +1,113 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Alley\Validator; + +use Laminas\Validator\Exception\InvalidArgumentException; +use Laminas\Validator\ValidatorInterface; + +final class Type extends ExtendedAbstractValidator +{ + public const NOT_OF_TYPE = 'notOfType'; + + private const SUPPORTED_TYPES = [ + 'array', + 'bool', + 'boolean', + 'callable', + 'double', + 'float', + 'int', + 'integer', + 'iterable', + 'null', + 'numeric', + 'object', + 'real', + 'resource', + 'scalar', + 'string', + ]; + + protected $messageTemplates = [ + self::NOT_OF_TYPE => "Must be of PHP type '%type%' but %value% is not.", + ]; + + protected $messageVariables = [ + 'type' => ['options' => 'type'], + ]; + + protected $options = [ + 'type' => 'null', + ]; + + protected function testValue($value): void + { + switch ($this->options['type']) { + case 'array': + $result = \is_array($value); + break; + case 'bool': + case 'boolean': + $result = \is_bool($value); + break; + case 'int': + case 'integer': + $result = \is_int($value); + break; + case 'double': + case 'float': + case 'real': + $result = \is_float($value); + break; + case 'numeric': + $result = is_numeric($value); + break; + case 'object': + $result = \is_object($value); + break; + case 'resource': + $result = \is_resource($value); + break; + case 'string': + $result = \is_string($value); + break; + case 'scalar': + $result = \is_scalar($value); + break; + case 'callable': + $result = \is_callable($value); + break; + case 'iterable': + $result = is_iterable($value); + break; + case 'null': + default: + $result = \is_null($value); + break; + } + + if (!$result) { + $this->error(self::NOT_OF_TYPE); + } + } + + protected function setType(string $type) + { + if (!\in_array($type, self::SUPPORTED_TYPES, true)) { + throw new InvalidArgumentException("Invalid 'type': {$type}."); + } + + $this->options['type'] = $type; + } +} diff --git a/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/ValidatorByOperator.php b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/ValidatorByOperator.php new file mode 100644 index 00000000..de45e48c --- /dev/null +++ b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/ValidatorByOperator.php @@ -0,0 +1,85 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Alley\Validator; + +use Laminas\Validator\Regex; +use Laminas\Validator\ValidatorInterface; + +final class ValidatorByOperator implements ValidatorInterface +{ + private ValidatorInterface $final; + + public function __construct(string $operator, $param) + { + // Build validator now so that its constructor runs, just as if the validator had been instantiated directly. + $this->final = $this->validator($operator, $param); + } + + public function isValid($value) + { + return $this->final->isValid($value); + } + + public function getMessages() + { + return $this->final->getMessages(); + } + + private function validator(string $operator, $param) + { + switch ($operator) { + case 'CONTAINS': + case 'NOT CONTAINS': + $validator = new ContainsString([ + 'needle' => $param, + 'ignoreCase' => false, + ]); + break; + + case 'IN': + case 'NOT IN': + $validator = new OneOf([ + 'haystack' => $param, + ]); + break; + + case 'LIKE': + case 'NOT LIKE': + $validator = new ContainsString([ + 'needle' => $param, + 'ignoreCase' => true, + ]); + break; + + case 'REGEX': + case 'NOT REGEX': + $validator = new Regex([ + 'pattern' => $param, + ]); + break; + + default: + $validator = new Comparison([ + 'operator' => $operator, + 'compared' => $param, + ]); + } + + if (str_starts_with($operator, 'NOT ')) { + $validator = new Not($validator, 'Invalid comparison.'); + } + + return $validator; + } +} diff --git a/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/WithMessage.php b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/WithMessage.php new file mode 100644 index 00000000..6c4520a5 --- /dev/null +++ b/vendor/alleyinteractive/laminas-validator-extensions/src/Alley/Validator/WithMessage.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Alley\Validator; + +use Laminas\Validator\ValidatorInterface; + +final class WithMessage implements ValidatorInterface +{ + private string $code; + + private string $message; + + private ValidatorInterface $origin; + + public function __construct(string $code, string $message, ValidatorInterface $origin) + { + $this->origin = $origin; + $this->code = $code; + $this->message = $message; + } + + public function isValid($value) + { + return $this->origin->isValid($value); + } + + public function getMessages() + { + $messages = []; + + if (\count($this->origin->getMessages()) > 0) { + $messages[$this->code] = $this->message; + } + + return $messages; + } +} diff --git a/vendor/alleyinteractive/wordpress-autoloader/.editorconfig b/vendor/alleyinteractive/wordpress-autoloader/.editorconfig new file mode 100644 index 00000000..0a064551 --- /dev/null +++ b/vendor/alleyinteractive/wordpress-autoloader/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = tab +indent_size = 2 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.{js,css,scss,yml,json,.babelrc}] +indent_style = space +indent_size = 2 diff --git a/vendor/alleyinteractive/wordpress-autoloader/.gitattributes b/vendor/alleyinteractive/wordpress-autoloader/.gitattributes new file mode 100644 index 00000000..f1a5ab0c --- /dev/null +++ b/vendor/alleyinteractive/wordpress-autoloader/.gitattributes @@ -0,0 +1,26 @@ +# +# Exclude these files from release archives. +# +# This will also make the files unavailable when using Composer with `--prefer-dist`. +# +# Via WPCS. +# +/.github export-ignore +/phpcs.xml.dist export-ignore +/.phpcs export-ignore +/phpunit.xml export-ignore +/tests export-ignore + +# +# Auto detect text files and perform LF normalization. +# +# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/ +# +* text=auto + +# +# The above will handle all files not found below. +# +*.md text +*.php text +*.inc text diff --git a/vendor/alleyinteractive/wordpress-autoloader/.gitignore b/vendor/alleyinteractive/wordpress-autoloader/.gitignore new file mode 100644 index 00000000..0afacaed --- /dev/null +++ b/vendor/alleyinteractive/wordpress-autoloader/.gitignore @@ -0,0 +1,6 @@ +vendor/ +composer.lock +.phpcs.xml +.phpunit.result.cache +.vscode +.idea diff --git a/vendor/alleyinteractive/wordpress-autoloader/CHANGELOG.md b/vendor/alleyinteractive/wordpress-autoloader/CHANGELOG.md new file mode 100644 index 00000000..1a2777c0 --- /dev/null +++ b/vendor/alleyinteractive/wordpress-autoloader/CHANGELOG.md @@ -0,0 +1,34 @@ +# Changelog + +All notable changes to `alleyinteractive/wordpress-autoloader` will be +documented in this file. + +## [Unreleased] + +## 1.1.1 - 2022-08-31 + +- Ensure file is still loaded with APCu. + +## 1.1.0 - 2022-08-09 + +- Adding APCu caching of autoloaded classes. +- Adds check to prevent multiple failed calls to autoload a class. + +## 1.0.0 - 2022-05-25 + +## 0.2.0 + +- Supporting PHP 8.1 +- Removing `preg_replace` with `str_*` functions. + +## 0.1.2 + +- Small performance improvement. + +## 0.1.1 + +- Ensure autoloader root path always has a trailing slash. + +## 0.1.0 + +- Initial release. diff --git a/vendor/alleyinteractive/wordpress-autoloader/README.md b/vendor/alleyinteractive/wordpress-autoloader/README.md new file mode 100644 index 00000000..7cc50e69 --- /dev/null +++ b/vendor/alleyinteractive/wordpress-autoloader/README.md @@ -0,0 +1,51 @@ +# WordPress Autoloader + +[![Latest Version on Packagist](https://img.shields.io/packagist/v/alleyinteractive/wordpress-autoloader.svg?style=flat-square)](https://packagist.org/packages/alleyinteractive/wordpress-autoloader) +[![Tests](https://github.com/alleyinteractive/wordpress-autoloader/actions/workflows/tests.yml/badge.svg)](https://github.com/alleyinteractive/wordpress-autoloader/actions/workflows/tests.yml) + +A PHP Autoloader that supports the [Wordpress Coding +Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/). For example, a folder that looks like this would be autoloaded as: + +``` +src/class-example-class.php -> Root_Namespace\Example_Class +src/trait-reusable-feature.php -> Root_Namesace\Reusable_Feature +src/feature/class-example-feature.php -> Root_Namespace\Feature\Example_Feature +``` + +Supports `class`, `trait`, `interface`, and `enum` files and any level of +namespaces. + +## Installation + +You can install the package via composer: + +```bash +composer require alleyinteractive/wordpress-autoloader +``` + +## Usage + +```php +Alley_Interactive\Autoloader\Autoloader::generate( + 'Plugin\\Namespace', + __DIR__ . '/src', +)->register(); + +// Or register the autoloader manually. +spl_autoload_register( + Alley_Interactive\Autoloader\Autoloader::generate( + 'Plugin\\Namespace', + __DIR__ . '/src', + ) +); +``` + +## Testing + +```bash +composer test +``` + +## Changelog + +Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. diff --git a/vendor/alleyinteractive/wordpress-autoloader/composer.json b/vendor/alleyinteractive/wordpress-autoloader/composer.json new file mode 100644 index 00000000..ee1441e9 --- /dev/null +++ b/vendor/alleyinteractive/wordpress-autoloader/composer.json @@ -0,0 +1,43 @@ +{ + "name": "alleyinteractive/wordpress-autoloader", + "type": "library", + "description": "Autoload files using WordPress File Conventions", + "license": "GPL-2.0-or-later", + "authors": [ + { + "name": "Alley Interactive", + "email": "info@alley.co" + } + ], + "require": { + "php": "^7.4.0|^8.0|^8.1" + }, + "require-dev": { + "alleyinteractive/alley-coding-standards": "^0.3", + "phpunit/phpunit": "^9.5.8" + }, + "config": { + "sort-packages": true, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + }, + "autoload": { + "files": [ + "src/class-autoloader.php" + ] + }, + "minimum-stability": "dev", + "prefer-stable": true, + "scripts": { + "lint": "@phpcs", + "lint:fix": "@phpcbf", + "phpcbf": "phpcbf --standard=./phpcs.xml.dist .", + "phpcs": "phpcs --standard=./phpcs.xml.dist .", + "phpunit": "vendor/bin/phpunit", + "test": [ + "@phpcs", + "@phpunit" + ] + } +} diff --git a/vendor/alleyinteractive/wordpress-autoloader/src/class-autoloader.php b/vendor/alleyinteractive/wordpress-autoloader/src/class-autoloader.php new file mode 100644 index 00000000..f2a08085 --- /dev/null +++ b/vendor/alleyinteractive/wordpress-autoloader/src/class-autoloader.php @@ -0,0 +1,203 @@ + + */ + protected array $missing_classes = []; + + /** + * APCu cache key prefix. + * + * @var ?string + */ + protected ?string $apcu_prefix; + + /** + * Generate an autoloader for the WordPress file naming conventions. + * + * @param string $namespace Namespace to autoload. + * @param string $root_path Path in which to look for files. + * @return static Function for spl_autoload_register(). + */ + public static function generate( string $namespace, string $root_path ): callable { + return new static( $namespace, $root_path ); + } + + /** + * Constructor. + * + * @param string $namespace Namespace to register. + * @param string $root_path Root path of the namespace. + */ + public function __construct( string $namespace, string $root_path ) { + $this->namespace = $namespace; + + // Ensure consistent root. + $this->root_path = rtrim( $root_path, DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $prefix Prefix to use. + * @return static + */ + public function set_apcu_prefix( string $prefix ) { + $this->apcu_prefix = function_exists( 'apcu_fetch' ) && filter_var( ini_get( 'apc.enabled' ), FILTER_VALIDATE_BOOLEAN ) + ? $prefix + : null; + + return $this; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function get_apcu_prefix(): ?string { + return $this->apcu_prefix; + } + + /** + * Check if a class was missing from the autoloader. + * + * @param string $classname Class to check. + * @return bool + */ + public function is_missing_class( string $classname ): bool { + return isset( $this->missing_classes[ $classname ] ); + } + + /** + * Register the autoloader. + */ + public function register() { + spl_autoload_register( $this ); + } + + /** + * Unregister the autoloader. + */ + public function unregister() { + spl_autoload_unregister( $this ); + } + + /** + * Invoke method of the class. + * + * @param string $classname Class being autoloaded. + */ + public function __invoke( string $classname ) { + // Ignore if the base namespace doesn't match. + if ( 0 !== \strpos( $classname, $this->namespace ) ) { + return; + } + + // Check if the class was previously not found. + if ( isset( $this->missing_classes[ $classname ] ) ) { + return; + } + + // Check if the class was previously found with APCu caching. + if ( isset( $this->apcu_prefix ) ) { + $hit = false; + $file = apcu_fetch( $this->apcu_prefix . $classname, $hit ); + + if ( $hit ) { + require_once $file; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.UsingVariable + return $file; + } + } + + $file = $this->find_file( $classname ); + + if ( $file ) { + require_once $file; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.UsingVariable + + // Cache the found file with APCu if enabled. + if ( isset( $this->apcu_prefix ) ) { + apcu_add( $this->apcu_prefix . $classname, $file ); + } + } else { + // Mark the class as not found to save future lookups. + $this->missing_classes[ $classname ] = true; + } + } + + /** + * Find a file for the given class. + * + * @param string $classname Class to find. + * @return string|null + */ + protected function find_file( string $classname ): ?string { + // Break up the classname into parts. + $parts = \explode( '\\', $classname ); + + // Retrieve the class name (last item) and convert it to a filename. + $class = \strtolower( \str_replace( '_', '-', \array_pop( $parts ) ) ); + + $base_path = ''; + + // Build the base path relative to the sub-namespace. + $sub_namespace = \substr( \implode( DIRECTORY_SEPARATOR, $parts ), \strlen( $this->namespace ) ); + + if ( ! empty( $sub_namespace ) ) { + $base_path = \str_replace( '_', '-', \strtolower( $sub_namespace ) ); + } + + // Support multiple locations since the class could be a class, trait or interface. + $paths = [ + '%1$s' . DIRECTORY_SEPARATOR . 'class-%2$s.php', + '%1$s' . DIRECTORY_SEPARATOR . 'trait-%2$s.php', + '%1$s' . DIRECTORY_SEPARATOR . 'interface-%2$s.php', + '%1$s' . DIRECTORY_SEPARATOR . 'enum-%2$s.php', + ]; + + /* + * Attempt to find the file by looping through the various paths. + * + * Autoloading a class will also cause a trait or interface with the + * same fully qualified name to be autoloaded, as it's impossible to + * tell which was requested. + */ + foreach ( $paths as $path ) { + $path = $this->root_path . \sprintf( $path, $base_path, $class ); + + if ( \file_exists( $path ) ) { + return $path; + } + } + + return null; + } +} diff --git a/.deployignore b/vendor/alleyinteractive/wp-concurrent-remote-requests/.deployignore similarity index 87% rename from .deployignore rename to vendor/alleyinteractive/wp-concurrent-remote-requests/.deployignore index 17e6245d..f3f22fe8 100644 --- a/.deployignore +++ b/vendor/alleyinteractive/wp-concurrent-remote-requests/.deployignore @@ -1,24 +1,23 @@ .DS_Store -.github -.phpcs -.phpcs.xml -.phpunit.result.cache -.scaffolder -.scoper +Thumbs.db +wp-cli.local.yml +node_modules/ *.sql *.tar.gz *.zip +.phpunit.result.cache +Dockerfile +output.log +.github +tests bin composer.lock +phpcs.xml +phpunit.xml configure.php DOCKER_ENV -Dockerfile -Makefile -node_modules/ -output.log -phpunit.xml phpunit.xml tests -tests -Thumbs.db -wp-cli.local.yml +.phpcs +phpcs.xml.dist +Makefile diff --git a/vendor/alleyinteractive/wp-concurrent-remote-requests/.editorconfig b/vendor/alleyinteractive/wp-concurrent-remote-requests/.editorconfig new file mode 100644 index 00000000..54852fc2 --- /dev/null +++ b/vendor/alleyinteractive/wp-concurrent-remote-requests/.editorconfig @@ -0,0 +1,23 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +trim_trailing_whitespace = true +insert_final_newline = true +indent_style = tab +indent_size = 4 + +[*.{js,jsx,scss,css,json,yaml,yml,feature}] +indent_style = space +indent_size = 2 + +# Composer File +[composer.{json,lock}] +indent_style = space +indent_size = 4 + +# Dotfiles +[.*] +indent_style = space +indent_size = 2 diff --git a/vendor/alleyinteractive/wp-concurrent-remote-requests/.gitattributes b/vendor/alleyinteractive/wp-concurrent-remote-requests/.gitattributes new file mode 100644 index 00000000..a21ab7f3 --- /dev/null +++ b/vendor/alleyinteractive/wp-concurrent-remote-requests/.gitattributes @@ -0,0 +1,28 @@ +# +# Exclude these files from release archives. +# +# This will also make the files unavailable when using Composer with `--prefer-dist`. +# +# Via WPCS. +# +/.github export-ignore +/phpcs.xml export-ignore +/.phpcs export-ignore +/phpunit.xml export-ignore +/tests export-ignore +/configure.php export-ignore +/Makefile export-ignore + +# +# Auto detect text files and perform LF normalization. +# +# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/ +# +* text=auto + +# +# The above will handle all files not found below. +# +*.md text +*.php text +*.inc text diff --git a/vendor/alleyinteractive/wp-concurrent-remote-requests/.gitignore b/vendor/alleyinteractive/wp-concurrent-remote-requests/.gitignore new file mode 100644 index 00000000..5f9a5257 --- /dev/null +++ b/vendor/alleyinteractive/wp-concurrent-remote-requests/.gitignore @@ -0,0 +1,26 @@ +# Build files +build +vendor + +# Log files +*.log + +# Cache files +.phpcs/*.json +.phpunit.result.cache + +# Ignore temporary OS files +.DS_Store +.DS_Store? +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db +.thumbsdb + +# IDE files +*.code-workspace +.idea +.vscode + +composer.lock diff --git a/vendor/alleyinteractive/wp-concurrent-remote-requests/CHANGELOG.md b/vendor/alleyinteractive/wp-concurrent-remote-requests/CHANGELOG.md new file mode 100644 index 00000000..7511c388 --- /dev/null +++ b/vendor/alleyinteractive/wp-concurrent-remote-requests/CHANGELOG.md @@ -0,0 +1,19 @@ +# Changelog + +All notable changes to `plugin_name` will be documented in this file. + +## v1.0.1 - 2023-03-24 + +- Remove `wordpress-plugin` as a package type. + +## v1.0.0 - 2022-07-30 + +- Removing Mantle as a dependency to fix a circular dependency. + +## v0.1.0 - 2022-07-27 + +Initial release. + +## 0.1.0 - 2022-07-26 + +- Initial release diff --git a/vendor/alleyinteractive/wp-concurrent-remote-requests/LICENSE b/vendor/alleyinteractive/wp-concurrent-remote-requests/LICENSE new file mode 100644 index 00000000..d159169d --- /dev/null +++ b/vendor/alleyinteractive/wp-concurrent-remote-requests/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + 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/vendor/alleyinteractive/wp-concurrent-remote-requests/README.md b/vendor/alleyinteractive/wp-concurrent-remote-requests/README.md new file mode 100644 index 00000000..5ada1dd1 --- /dev/null +++ b/vendor/alleyinteractive/wp-concurrent-remote-requests/README.md @@ -0,0 +1,85 @@ +# Concurrent Remote Requests Feature Plugin + +Stable tag: 0.1.0 + +Requires at least: 5.9 + +Tested up to: 5.9 + +Requires PHP: 7.4 + +License: GPL v2 or later + +Tags: alleyinteractive, wp-concurrent-remote-requests + +Contributors: alleyinteractive, srtfisher + +[![Coding Standards](https://github.com/alleyinteractive/wp-concurrent-remote-requests/actions/workflows/coding-standards.yml/badge.svg)](https://github.com/alleyinteractive/wp-concurrent-remote-requests/actions/workflows/coding-standards.yml) +[![Testing Suite](https://github.com/alleyinteractive/wp-concurrent-remote-requests/actions/workflows/unit-test.yml/badge.svg)](https://github.com/alleyinteractive/wp-concurrent-remote-requests/actions/workflows/unit-test.yml) + +A WordPress Feature plugin for concurrent HTTP remote requests in WordPress. +Adds namespaced helper functions to make concurrent remote requests. Being +tracked in +https://github.com/alleyinteractive/wp-concurrent-remote-requests/pull/2 and +https://core.trac.wordpress.org/ticket/37459. + +## Installation + +You can install the package via composer: + +```bash +composer require alleyinteractive/wp-concurrent-remote-requests +``` + +## Usage + +Activate the plugin in WordPress and use it like so: + +```php +// Supports an array of URLs: +\Alley\WP\Concurrent_Remote_Requests\wp_remote_get( + [ + 'https://alley.co/', + 'https://wordpress.org/', + ] +); + +// Or more complex requests. +\Alley\WP\Concurrent_Remote_Requests\wp_remote_request( + [ + [ + 'https://alley.co/', + [ + 'body' => [ ... ], + 'method' => 'POST', + ], + ], + [ + 'https://wordpress.org/', + [ + 'method' => 'DELETE', + ], + ], + ] +); + +``` + +## Testing + +```bash +composer test +``` + +## Changelog + +Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. + +## Credits + +- [Sean Fisher](https://github.com/srtfisher) +- [All Contributors](../../contributors) + +## License + +The GNU General Public License (GPL) license. Please see [License File](LICENSE) for more information. diff --git a/vendor/alleyinteractive/wp-concurrent-remote-requests/composer.json b/vendor/alleyinteractive/wp-concurrent-remote-requests/composer.json new file mode 100644 index 00000000..6dc688c0 --- /dev/null +++ b/vendor/alleyinteractive/wp-concurrent-remote-requests/composer.json @@ -0,0 +1,59 @@ +{ + "name": "alleyinteractive/wp-concurrent-remote-requests", + "description": "Feature plugin for concurrent HTTP remote requests", + "license": "GPL-2.0-or-later", + "type": "library", + "keywords": [ + "alleyinteractive", + "wp-concurrent-remote-requests" + ], + "authors": [ + { + "name": "Sean Fisher", + "email": "srtfisher@gmail.com" + } + ], + "homepage": "https://github.com/alleyinteractive/wp-concurrent-remote-requests", + "require": { + "php": "^7.4 || ^8.0", + "alleyinteractive/composer-wordpress-autoloader": "*" + }, + "require-dev": { + "alleyinteractive/alley-coding-standards": "^0.3", + "nunomaduro/collision": "^5.0", + "phpunit/phpunit": "^9.3.3" + }, + "minimum-stability": "dev", + "prefer-stable": true, + "config": { + "allow-plugins": { + "alleyinteractive/composer-wordpress-autoloader": true, + "dealerdirect/phpcodesniffer-composer-installer": true + }, + "sort-packages": true + }, + "autoload": { + "files": [ + "src/helpers.php" + ] + }, + "extra": { + "wordpress-autoloader": { + "autoload": { + "Alley\\WP\\Concurrent_Remote_Requests\\": "src" + }, + "autoload-dev": { + "Alley\\WP\\Concurrent_Remote_Requests\\Tests\\": "tests" + } + } + }, + "scripts": { + "phpcbf": "phpcbf --standard=./phpcs.xml.dist .", + "phpcs": "phpcs --standard=./phpcs.xml.dist .", + "phpunit": "phpunit", + "test": [ + "@phpcs", + "@phpunit" + ] + } +} diff --git a/.phpcs.xml b/vendor/alleyinteractive/wp-concurrent-remote-requests/phpcs.xml.dist similarity index 53% rename from .phpcs.xml rename to vendor/alleyinteractive/wp-concurrent-remote-requests/phpcs.xml.dist index b06fd0b6..197702e6 100644 --- a/.phpcs.xml +++ b/vendor/alleyinteractive/wp-concurrent-remote-requests/phpcs.xml.dist @@ -1,9 +1,14 @@ - - PHP_CodeSniffer standard for create-wordpress-plugin. + + PHP_CodeSniffer standard for wp-concurrent-remote-requests. + + + + + + tests/ build/ + inc/blocks/ + inc/fields.php + inc/post-types/ + inc/taxonomies/ vendor/ - - + + - - - - - - - - - - - - src/assets.php - blocks - build - entries - - - - src/assets.php - - - - tests/* - + + + + + + + diff --git a/vendor/alleyinteractive/wp-concurrent-remote-requests/plugin.php b/vendor/alleyinteractive/wp-concurrent-remote-requests/plugin.php new file mode 100644 index 00000000..a9d261c3 --- /dev/null +++ b/vendor/alleyinteractive/wp-concurrent-remote-requests/plugin.php @@ -0,0 +1,39 @@ + +
+

+
+ $request ) { + // Support an array of string URLs. + if ( ! is_array( $request ) ) { + $request = array( $request, array() ); + } + + $request = $this->format_request( $request[0], isset( $request[1] ) ? $request[1] : array() ); + + // Handle an error in the pre-request step. Also allow the request to be + // circumvented if the response was short-circuited. + if ( is_wp_error( $request ) ) { + $responses[ $index ] = $request; + continue; + } elseif ( isset( $request['response'] ) ) { + $responses[ $index ] = $request['response']; + continue; + } + + $pending_requests[ $index ] = $request; + } + + if ( ! empty( $pending_requests ) ) { + // Avoid issues where mbstring.func_overload is enabled. + mbstring_binary_safe_encoding(); + + try { + $raw_responses = Requests::request_multiple( $pending_requests ); + } catch ( Requests_Exception $e ) { + $raw_responses = new WP_Error( 'http_request_failed', $e->getMessage() ); + } + + reset_mbstring_encoding(); + + if ( is_wp_error( $raw_responses ) ) { + return $raw_responses; + } + + foreach ( $pending_requests as $index => $request ) { + $responses[ $index ] = $this->format_response( + $raw_responses[ $index ], + $request['args'], + $request['url'] + ); + } + } + + return $responses; + } + + $formatted = $this->format_request( $url, $args ); + + // Handle an error in the pre-request step. Also allow the request to be + // circumvented if the response was short-circuited. + if ( is_wp_error( $formatted ) ) { + return $formatted; + } elseif ( isset( $formatted['response'] ) ) { + return $formatted['response']; + } + + // Avoid issues where mbstring.func_overload is enabled. + mbstring_binary_safe_encoding(); + + try { + $response = Requests::request( + $formatted['url'], + $formatted['headers'], + $formatted['data'], + $formatted['type'], + $formatted['options'] + ); + } catch ( Requests_Exception $e ) { + $response = new WP_Error( 'http_request_failed', $e->getMessage() ); + } + + reset_mbstring_encoding(); + + return $this->format_response( $response, $formatted['args'], $formatted['url'] ); + } + + /** + * Format a request to be passed to Requests. + * + * @param string $url URL to request. + * @param array $args Arguments to send to request. + * @return array { + * Array of formatted arguments for the request. + * + * @type string $url URL to request. + * @type array $headers Array of headers for the request. + * @type string $data Data to send with the request. + * @type string $type The type of request to make. + * @type array $options Array of options for the request. + * } + */ + protected function format_request( $url, $args ) { + $defaults = array( + 'method' => 'GET', + /** + * Filters the timeout value for an HTTP request. + * + * @since 2.7.0 + * @since 5.1.0 The `$url` parameter was added. + * + * @param float $timeout_value Time in seconds until a request times out. Default 5. + * @param string $url The request URL. + */ + 'timeout' => apply_filters( 'http_request_timeout', 5, $url ), + /** + * Filters the number of redirects allowed during an HTTP request. + * + * @since 2.7.0 + * @since 5.1.0 The `$url` parameter was added. + * + * @param int $redirect_count Number of redirects allowed. Default 5. + * @param string $url The request URL. + */ + 'redirection' => apply_filters( 'http_request_redirection_count', 5, $url ), + /** + * Filters the version of the HTTP protocol used in a request. + * + * @since 2.7.0 + * @since 5.1.0 The `$url` parameter was added. + * + * @param string $version Version of HTTP used. Accepts '1.0' and '1.1'. Default '1.0'. + * @param string $url The request URL. + */ + 'httpversion' => apply_filters( 'http_request_version', '1.0', $url ), + /** + * Filters the user agent value sent with an HTTP request. + * + * @since 2.7.0 + * @since 5.1.0 The `$url` parameter was added. + * + * @param string $user_agent WordPress user agent string. + * @param string $url The request URL. + */ + 'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ), $url ), + /** + * Filters whether to pass URLs through wp_http_validate_url() in an HTTP request. + * + * @since 3.6.0 + * @since 5.1.0 The `$url` parameter was added. + * + * @param bool $pass_url Whether to pass URLs through wp_http_validate_url(). Default false. + * @param string $url The request URL. + */ + 'reject_unsafe_urls' => apply_filters( 'http_request_reject_unsafe_urls', false, $url ), + 'blocking' => true, + 'headers' => array(), + 'cookies' => array(), + 'body' => null, + 'compress' => false, + 'decompress' => true, + 'sslverify' => true, + 'sslcertificates' => ABSPATH . WPINC . '/certificates/ca-bundle.crt', + 'stream' => false, + 'filename' => null, + 'limit_response_size' => null, + ); + + // Pre-parse for the HEAD checks. + $args = wp_parse_args( $args ); + + // By default, HEAD requests do not cause redirections. + if ( isset( $args['method'] ) && 'HEAD' === $args['method'] ) { + $defaults['redirection'] = 0; + } + + $parsed_args = wp_parse_args( $args, $defaults ); + + /** + * Filters the arguments used in an HTTP request. + * + * @since 2.7.0 + * + * @param array $parsed_args An array of HTTP request arguments. + * @param string $url The request URL. + */ + $parsed_args = apply_filters( 'http_request_args', $parsed_args, $url ); + + // The transports decrement this, store a copy of the original value for loop purposes. + if ( ! isset( $parsed_args['_redirection'] ) ) { + $parsed_args['_redirection'] = $parsed_args['redirection']; + } + + /** + * Filters the preemptive return value of an HTTP request. + * + * Returning a non-false value from the filter will short-circuit the HTTP request and return + * early with that value. A filter should return one of: + * + * - An array containing 'headers', 'body', 'response', 'cookies', and 'filename' elements + * - A WP_Error instance + * - boolean false to avoid short-circuiting the response + * + * Returning any other value may result in unexpected behaviour. + * + * @since 2.9.0 + * + * @param false|array|WP_Error $preempt A preemptive return value of an HTTP request. Default false. + * @param array $parsed_args HTTP request arguments. + * @param string $url The request URL. + */ + $pre = apply_filters( 'pre_http_request', false, $parsed_args, $url ); + + if ( false !== $pre ) { + return array( + 'response' => $pre, + ); + } + + if ( function_exists( 'wp_kses_bad_protocol' ) ) { + if ( $parsed_args['reject_unsafe_urls'] ) { + $url = wp_http_validate_url( $url ); + } + if ( $url ) { + $url = wp_kses_bad_protocol( $url, array( 'http', 'https', 'ssl' ) ); + } + } + + $parsed_url = wp_parse_url( $url ); + + if ( empty( $url ) || empty( $parsed_url['scheme'] ) ) { + $response = new WP_Error( 'http_request_failed', __( 'A valid URL was not provided.' ) ); + /** This action is documented in wp-includes/class-wp-http.php */ + do_action( 'http_api_debug', $response, 'response', 'Requests', $parsed_args, $url ); + return $response; + } + + if ( $this->block_request( $url ) ) { + $response = new WP_Error( 'http_request_not_executed', __( 'User has blocked requests through HTTP.' ) ); + /** This action is documented in wp-includes/class-wp-http.php */ + do_action( 'http_api_debug', $response, 'response', 'Requests', $parsed_args, $url ); + return $response; + } + + // If we are streaming to a file but no filename was given drop it in the WP temp dir + // and pick its name using the basename of the $url. + if ( $parsed_args['stream'] ) { + if ( empty( $parsed_args['filename'] ) ) { + $parsed_args['filename'] = get_temp_dir() . basename( $url ); + } + + // Force some settings if we are streaming to a file and check for existence + // and perms of destination directory. + $parsed_args['blocking'] = true; + if ( ! wp_is_writable( dirname( $parsed_args['filename'] ) ) ) { + $response = new WP_Error( 'http_request_failed', __( 'Destination directory for file streaming does not exist or is not writable.' ) ); + /** This action is documented in wp-includes/class-wp-http.php */ + do_action( 'http_api_debug', $response, 'response', 'Requests', $parsed_args, $url ); + return $response; + } + } + + if ( is_null( $parsed_args['headers'] ) ) { + $parsed_args['headers'] = array(); + } + + // WP allows passing in headers as a string, weirdly. + if ( ! is_array( $parsed_args['headers'] ) ) { + $processed_headers = self::processHeaders( $parsed_args['headers'] ); + $parsed_args['headers'] = $processed_headers['headers']; + } + + // Setup arguments. + $headers = $parsed_args['headers']; + $data = $parsed_args['body']; + $type = $parsed_args['method']; + $options = array( + 'timeout' => $parsed_args['timeout'], + 'useragent' => $parsed_args['user-agent'], + 'blocking' => $parsed_args['blocking'], + 'hooks' => new WP_HTTP_Requests_Hooks( $url, $parsed_args ), + ); + + // Ensure redirects follow browser behaviour. + $options['hooks']->register( 'requests.before_redirect', array( get_class(), 'browser_redirect_compatibility' ) ); + + // Validate redirected URLs. + if ( function_exists( 'wp_kses_bad_protocol' ) && $parsed_args['reject_unsafe_urls'] ) { + $options['hooks']->register( 'requests.before_redirect', array( get_class(), 'validate_redirects' ) ); + } + + if ( $parsed_args['stream'] ) { + $options['filename'] = $parsed_args['filename']; + } + if ( empty( $parsed_args['redirection'] ) ) { + $options['follow_redirects'] = false; + } else { + $options['redirects'] = $parsed_args['redirection']; + } + + // Use byte limit, if we can. + if ( isset( $parsed_args['limit_response_size'] ) ) { + $options['max_bytes'] = $parsed_args['limit_response_size']; + } + + // If we've got cookies, use and convert them to Requests_Cookie. + if ( ! empty( $parsed_args['cookies'] ) ) { + $options['cookies'] = self::normalize_cookies( $parsed_args['cookies'] ); + } + + // SSL certificate handling. + if ( ! $parsed_args['sslverify'] ) { + $options['verify'] = false; + $options['verifyname'] = false; + } else { + $options['verify'] = $parsed_args['sslcertificates']; + } + + // All non-GET/HEAD requests should put the arguments in the form body. + if ( 'HEAD' !== $type && 'GET' !== $type ) { + $options['data_format'] = 'body'; + } + + /** + * Filters whether SSL should be verified for non-local requests. + * + * @since 2.8.0 + * @since 5.1.0 The `$url` parameter was added. + * + * @param bool $ssl_verify Whether to verify the SSL connection. Default true. + * @param string $url The request URL. + */ + $options['verify'] = apply_filters( 'https_ssl_verify', $options['verify'], $url ); + + // Check for proxies. + $proxy = new WP_HTTP_Proxy(); + if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) { + $options['proxy'] = new Requests_Proxy_HTTP( $proxy->host() . ':' . $proxy->port() ); + + if ( $proxy->use_authentication() ) { + $options['proxy']->use_authentication = true; + $options['proxy']->user = $proxy->username(); + $options['proxy']->pass = $proxy->password(); + } + } + + return array( + 'args' => $parsed_args, + 'data' => $data, + 'headers' => $headers, + 'options' => $options, + 'type' => $type, + 'url' => $url, + ); + } + + /** + * Format a response into the expected shape. + * + * @param Requests_Response|WP_Error $response Response to format. + * @param array $args Request arguments. + * @param string $url Request URL. + * @return array|WP_Error + */ + protected function format_response( $response, $args, $url ) { + // Convert the response into an array. + if ( ! is_wp_error( $response ) ) { + $http_response = new WP_HTTP_Requests_Response( $response, $args['filename'] ); + $response = $http_response->to_array(); + + // Add the original object to the array. + $response['http_response'] = $http_response; + } + + /** + * Fires after an HTTP API response is received and before the response is returned. + * + * @since 2.8.0 + * + * @param array|WP_Error $response HTTP response or WP_Error object. + * @param string $context Context under which the hook is fired. + * @param string $class HTTP transport used. + * @param array $parsed_args HTTP request arguments. + * @param string $url The request URL. + */ + do_action( 'http_api_debug', $response, 'response', 'Requests', $args, $url ); + + if ( is_wp_error( $response ) ) { + return $response; + } + + if ( ! $args['blocking'] ) { + return array( + 'headers' => array(), + 'body' => '', + 'response' => array( + 'code' => false, + 'message' => false, + ), + 'cookies' => array(), + 'http_response' => null, + ); + } + + /** + * Filters a successful HTTP API response immediately before the response is returned. + * + * @since 2.9.0 + * + * @param array $response HTTP response. + * @param array $parsed_args HTTP request arguments. + * @param string $url The request URL. + */ + return apply_filters( 'http_response', $response, $args, $url ); + } + + /** + * Uses the POST HTTP method. + * + * Used for sending data that is expected to be in the body. + * + * @since 2.7.0 + * + * @param string $url The request URL. + * @param string|array $args Optional. Override the defaults. + * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. + * A WP_Error instance upon error. + */ + public function post( $url, $args = array() ) { + return $this->normalize_request_args( $url, $args, 'POST' ); + } + + /** + * Uses the GET HTTP method. + * + * Used for sending data that is expected to be in the body. + * + * @since 2.7.0 + * + * @param string|array $url The request URL or array of remote requests that will be run in parallel. + * @param string|array $args Optional. Override the defaults. + * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. + * A WP_Error instance upon error. + */ + public function get( $url, $args = array() ) { + return $this->normalize_request_args( $url, $args, 'GET' ); + } + + /** + * Uses the HEAD HTTP method. + * + * Used for sending data that is expected to be in the body. + * + * @since 2.7.0 + * + * @param string $url The request URL. + * @param string|array $args Optional. Override the defaults. + * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. + * A WP_Error instance upon error. + */ + public function head( $url, $args = array() ) { + return $this->normalize_request_args( $url, $args, 'HEAD' ); + } + + /** + * Normalize the request arguments for a GET, HEAD, or POST request. + * + * @param string|array $url The request URL or array of remote requests that will be run in parallel. + * @param string|array $args Request arguments, optional. Override the defaults. + * @param string $method Request method to make. + * @return array Array containing 'headers', 'body', 'response', 'cookies', 'filename'. + * A WP_Error instance upon error. + */ + protected function normalize_request_args( $url, $args, $method ) { + $defaults = array( 'method' => $method ); + + // Support an array of parallel requests. + if ( is_array( $url ) ) { + $parsed_requests = array(); + + if ( ! empty( $args ) ) { + _doing_it_wrong( + __FUNCTION__, + esc_html__( 'Arguments passed to the second $args parameter are ignored when $url is an array of parallel requests.' ), + '6.0.0' + ); + } + + foreach ( $url as $i => $request ) { + // Support an array of string URLs. + if ( ! is_array( $request ) ) { + $request = array( $request, array() ); + } + + list( $request_url, $request_args ) = $request; + + $parsed_requests[ $i ] = array( + $request_url, + wp_parse_args( $request_args, $defaults ), + ); + } + + return $this->request( $parsed_requests ); + } + + $parsed_args = wp_parse_args( $args, $defaults ); + + return $this->request( $url, $parsed_args ); + } +} diff --git a/vendor/alleyinteractive/wp-concurrent-remote-requests/src/helpers.php b/vendor/alleyinteractive/wp-concurrent-remote-requests/src/helpers.php new file mode 100644 index 00000000..a946a1e0 --- /dev/null +++ b/vendor/alleyinteractive/wp-concurrent-remote-requests/src/helpers.php @@ -0,0 +1,114 @@ +request( $url, $args ); +} + +/** + * Performs an HTTP request using the GET method and returns its response. + * + * @since 2.7.0 + * + * @see wp_remote_request() For more information on the response array format. + * @see WP_Http::request() For default arguments information. + * + * @param string|array $url URL to retrieve or array of remote requests that will be run in parallel. + * @param array $args Optional. Request arguments. Default empty array. + * @return array|WP_Error The response or WP_Error on failure. + */ +function wp_remote_get( $url, $args = array() ) { + $http = _wp_http_get_object(); + return $http->get( $url, $args ); +} + +/** + * Performs an HTTP request using the POST method and returns its response. + * + * @since 2.7.0 + * + * @see wp_remote_request() For more information on the response array format. + * @see WP_Http::format_request() For default arguments information. + * + * @param string|array $url URL to retrieve or array of remote requests that will be run in parallel. + * @param array $args Optional. Request arguments. Default empty array. + * @return array|WP_Error The response or WP_Error on failure. + */ +function wp_remote_post( $url, $args = array() ) { + $http = _wp_http_get_object(); + return $http->post( $url, $args ); +} + +/** + * Performs an HTTP request using the HEAD method and returns its response. + * + * @since 2.7.0 + * + * @see wp_remote_request() For more information on the response array format. + * @see WP_Http::format_request() For default arguments information. + * + * @param string|array $url URL to retrieve or array of remote requests that will be run in parallel. + * @param array $args Optional. Request arguments. Default empty array. + * @return array|WP_Error The response or WP_Error on failure. + */ +function wp_remote_head( $url, $args = array() ) { + $http = _wp_http_get_object(); + return $http->head( $url, $args ); +} + +/** + * Returns the initialized WP_Http Object + * + * @since 2.7.0 + * @access private + * + * @return WP_Http HTTP Transport object. + */ +function _wp_http_get_object() { + static $http = null; + + if ( is_null( $http ) ) { + $http = new WP_Http(); + } + + return $http; +} diff --git a/vendor/alleyinteractive/wp-filter-side-effects/.editorconfig b/vendor/alleyinteractive/wp-filter-side-effects/.editorconfig new file mode 100644 index 00000000..2708ec41 --- /dev/null +++ b/vendor/alleyinteractive/wp-filter-side-effects/.editorconfig @@ -0,0 +1,19 @@ +# EditorConfig helps maintain consistent coding styles for developers working on the same project across various editors and IDEs. +# See https://editorconfig.org. + +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.php] +indent_size = 4 +indent_style = tab + +[*.xml] +indent_size = 4 diff --git a/vendor/alleyinteractive/wp-filter-side-effects/.gitattributes b/vendor/alleyinteractive/wp-filter-side-effects/.gitattributes new file mode 100644 index 00000000..f7c02496 --- /dev/null +++ b/vendor/alleyinteractive/wp-filter-side-effects/.gitattributes @@ -0,0 +1,27 @@ +# +# Exclude these files from release archives. +# +# This will also make the files unavailable when using Composer with `--prefer-dist`. +# If you develop using Composer, use `--prefer-source`. +# +# Via WPCS. +# +/phpcs.xml export-ignore +/phpunit.xml export-ignore +/.github export-ignore +/.php-cs-fixer.dist.php export-ignore +/tests export-ignore + +# +# Auto detect text files and perform LF normalization. +# +# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/ +# +* text=auto + +# +# The above will handle all files not found below. +# +*.md text +*.php text +*.inc text diff --git a/vendor/alleyinteractive/wp-filter-side-effects/.gitignore b/vendor/alleyinteractive/wp-filter-side-effects/.gitignore new file mode 100644 index 00000000..f7334559 --- /dev/null +++ b/vendor/alleyinteractive/wp-filter-side-effects/.gitignore @@ -0,0 +1,5 @@ +vendor +composer.lock +.php_cs.cache +.phpunit.result.cache +.php-cs-fixer.cache diff --git a/vendor/alleyinteractive/wp-filter-side-effects/CHANGELOG.md b/vendor/alleyinteractive/wp-filter-side-effects/CHANGELOG.md new file mode 100644 index 00000000..f9f211ea --- /dev/null +++ b/vendor/alleyinteractive/wp-filter-side-effects/CHANGELOG.md @@ -0,0 +1,17 @@ +# Changelog + +This library adheres to [Semantic Versioning](https://semver.org/) and [Keep a CHANGELOG](https://keepachangelog.com/en/1.0.0/). + +## Unreleased + +Nothing yet. + +## 2.0.0 + +### Removed + +- PHP 7.4 support. + +## 1.0.0 + +Initial release. diff --git a/vendor/alleyinteractive/wp-filter-side-effects/LICENSE b/vendor/alleyinteractive/wp-filter-side-effects/LICENSE new file mode 100644 index 00000000..d159169d --- /dev/null +++ b/vendor/alleyinteractive/wp-filter-side-effects/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + 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/vendor/alleyinteractive/wp-filter-side-effects/README.md b/vendor/alleyinteractive/wp-filter-side-effects/README.md new file mode 100644 index 00000000..a43eb15b --- /dev/null +++ b/vendor/alleyinteractive/wp-filter-side-effects/README.md @@ -0,0 +1,46 @@ +# Filter Side Effects + +`add_filter_side_effect()` allows attaching a callback function to a WordPress filter without requiring that the callback function return the filtered value or even return any value. It wraps `add_filter()` and accepts the same arguments with the same defaults. + +The callback function can return `void` or return a value. If the callback function returns a value, that value will be ignored, not passed back to the filter. Filter side effects thus behave like `add_action()` callbacks and can be used in situations where a call to `apply_filters()` signals that some behavior needs to occur, but no convenient action exists to run it. + +## Installation + +Install the latest version with: + +```bash +$ composer require alleyinteractive/wp-filter-side-effects +``` + +## Basic usage + +```php +get_custom_default_language_category( $language_slug ); + + if ( $default_category ) { + add_filter( 'pre_option_default_category', fn() => $default_category ); + } + }, + 10, + 2, +); +``` + +## About + +### License + +[GPL-2.0-or-later](https://github.com/alleyinteractive/wp-filter-side-effects/blob/main/LICENSE) + +### Maintainers + +[Alley Interactive](https://github.com/alleyinteractive) diff --git a/vendor/alleyinteractive/wp-filter-side-effects/composer.json b/vendor/alleyinteractive/wp-filter-side-effects/composer.json new file mode 100644 index 00000000..848c6b53 --- /dev/null +++ b/vendor/alleyinteractive/wp-filter-side-effects/composer.json @@ -0,0 +1,48 @@ +{ + "name": "alleyinteractive/wp-filter-side-effects", + "description": "Use a WordPress filter like an action.", + "type": "library", + "license": "GPL-2.0-or-later", + "authors": [ + { + "name": "Alley", + "email": "info@alley.com" + } + ], + "autoload": { + "files": [ + "src/alley/wp/filter-side-effects.php" + ] + }, + "config": { + "allow-plugins": { + "alleyinteractive/composer-wordpress-autoloader": true, + "dealerdirect/phpcodesniffer-composer-installer": true + }, + "lock": false + }, + "require": { + "php": "^8.0" + }, + "require-dev": { + "alleyinteractive/alley-coding-standards": "^1.0.0", + "friendsofphp/php-cs-fixer": "^3.8", + "mantle-framework/testkit": "^0.5" + }, + "scripts": { + "fixer": "php-cs-fixer -v fix --allow-risky=yes", + "phpcbf": "phpcbf", + "phpcs": "phpcs", + "phpunit": "phpunit" + }, + "extra": { + "wordpress-autoloader": { + "autoload": { + "Alley\\": "src/alley/" + }, + "autoload-dev": { + "Alley\\": "tests/alley/" + } + } + } +} diff --git a/vendor/alleyinteractive/wp-filter-side-effects/src/alley/wp/filter-side-effects.php b/vendor/alleyinteractive/wp-filter-side-effects/src/alley/wp/filter-side-effects.php new file mode 100644 index 00000000..abde14ad --- /dev/null +++ b/vendor/alleyinteractive/wp-filter-side-effects/src/alley/wp/filter-side-effects.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @package wp-filter-side-effects + */ + +namespace Alley\WP; + +/** + * Wrapper for `add_filter()` and `generate_filter_side_effect()`. + * + * @param string $tag Filter name. + * @param callable $function_to_add Callback. + * @param int $priority Priority. + * @param int $accepted_args Accepted arguments. + * @return true|void + */ +function add_filter_side_effect( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) { + return add_filter( $tag, generate_filter_side_effect( $function_to_add ), $priority, $accepted_args ); +} + +/** + * Returns a function that can be added to a filter to use the filter like an action. + * + * @param callable $callback Callback function. + * @return callable Function that returns the filtered value after calling the callable. + */ +function generate_filter_side_effect( $callback ): callable { + return function ( ...$args ) use ( $callback ) { + $callback( ...$args ); + return $args[0]; + }; +} diff --git a/vendor/alleyinteractive/wp-match-blocks/.editorconfig b/vendor/alleyinteractive/wp-match-blocks/.editorconfig new file mode 100644 index 00000000..2708ec41 --- /dev/null +++ b/vendor/alleyinteractive/wp-match-blocks/.editorconfig @@ -0,0 +1,19 @@ +# EditorConfig helps maintain consistent coding styles for developers working on the same project across various editors and IDEs. +# See https://editorconfig.org. + +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.php] +indent_size = 4 +indent_style = tab + +[*.xml] +indent_size = 4 diff --git a/vendor/alleyinteractive/wp-match-blocks/.gitattributes b/vendor/alleyinteractive/wp-match-blocks/.gitattributes new file mode 100644 index 00000000..1f5f3ab0 --- /dev/null +++ b/vendor/alleyinteractive/wp-match-blocks/.gitattributes @@ -0,0 +1,27 @@ +# +# Exclude these files from release archives. +# +# This will also make the files unavailable when using Composer with `--prefer-dist`. +# If you develop using Composer, use `--prefer-source`. +# +# Via WPCS. +# +/.github export-ignore +/.php-cs-fixer.dist.php export-ignore +/phpcs.xml export-ignore +/phpunit.xml export-ignore +/tests export-ignore + +# +# Auto detect text files and perform LF normalization. +# +# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/ +# +* text=auto + +# +# The above will handle all files not found below. +# +*.md text +*.php text +*.inc text diff --git a/vendor/alleyinteractive/wp-match-blocks/.gitignore b/vendor/alleyinteractive/wp-match-blocks/.gitignore new file mode 100644 index 00000000..f7334559 --- /dev/null +++ b/vendor/alleyinteractive/wp-match-blocks/.gitignore @@ -0,0 +1,5 @@ +vendor +composer.lock +.php_cs.cache +.phpunit.result.cache +.php-cs-fixer.cache diff --git a/vendor/alleyinteractive/wp-match-blocks/CHANGELOG.md b/vendor/alleyinteractive/wp-match-blocks/CHANGELOG.md new file mode 100644 index 00000000..37d79b99 --- /dev/null +++ b/vendor/alleyinteractive/wp-match-blocks/CHANGELOG.md @@ -0,0 +1,52 @@ +# Changelog + +This library adheres to [Semantic Versioning](https://semver.org/) and [Keep a CHANGELOG](https://keepachangelog.com/en/1.0.0/). + +## Unreleased + +Nothing yet. + +## 3.1.0 + +### Changed + +* Reduce uses of validators within validators. + +## 3.0.0 + +### Changed + +* "Classic" blocks, which have inner HTML but no block name, are no longer considered empty. + +## 2.0.1 + +### Fixed + +- Missing `alleyinteractive/composer-wordpress-autoloader` dependency. + +## 2.0.0 + +### Added + +- `with_innerhtml` parameter for matching blocks by their inner HTML. Includes companion `\Alley\WP\Validator\Block_InnerHTML` validator. +- `has_innerblocks` parameter for matching blocks by whether they have inner blocks. Includes companion `\Alley\WP\Validator\Block_InnerBlocks_Count` validator. +- `is_valid` parameter for matching blocks by custom validation logic. +- `CONTAINS` and `NOT CONTAINS` (case-sensitive), and `LIKE` and `NOT LIKE` (case-insensitive) operators to `attrs` parameter. + +### Changed + +- Passing a single block instance will return matches within its inner blocks. + +### Removed + +- PHP 7.4 support. + +## 1.0.1 + +### Fixed + +- Incorrect namespace in `README.md` examples. + +## 1.0.0 + +Initial release. diff --git a/vendor/alleyinteractive/wp-match-blocks/LICENSE b/vendor/alleyinteractive/wp-match-blocks/LICENSE new file mode 100644 index 00000000..d159169d --- /dev/null +++ b/vendor/alleyinteractive/wp-match-blocks/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + 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/vendor/alleyinteractive/wp-match-blocks/README.md b/vendor/alleyinteractive/wp-match-blocks/README.md new file mode 100644 index 00000000..9d4505f1 --- /dev/null +++ b/vendor/alleyinteractive/wp-match-blocks/README.md @@ -0,0 +1,669 @@ +# Match Blocks + +`match_blocks()` selects the blocks in post content, or in a given set of blocks, inner blocks, or block HTML, that match the given criteria, such as the block name, block attributes, or position within the set of blocks. + +Blocks can be matched by: + +* Block name or names (`name`) +* Block attributes (`attrs`, `with_attrs`) +* Block inner HTML (`with_innerhtml`) +* The block's positive or negative index within the set (`position`) +* Whether the block represents only space (`skip_empty_blocks`) +* Whether the block has inner blocks (`has_innerblocks`) +* Custom validation classes (`is_valid`) + +Passing matching parameters is optional; all non-empty blocks match by default. + +Additionally: + +* Recursion into inner blocks is supported (`flatten`). +* The set of matching blocks can be limited by size (`limit`) or their position in the set of matches (`nth_of_type`). +* The number of matches can be returned instead of the matched blocks (`count`). +* The companion `match_block()` function reduces the filtered set of results to a single parsed block. +* Passing a single block instance will return matches from its inner blocks. + +`match_blocks()` is powered by a set of block validation classes that utilize the [Laminas Validator](https://docs.laminas.dev/laminas-validator/) framework and [Laminas Validator Extensions](https://github.com/alleyinteractive/laminas-validator-extensions) package. These validators, along with a base class for validating blocks, are included here. [See the validators section for their documentation](#validators). + +## Installation + +Install the latest version with: + +```bash +$ composer require alleyinteractive/wp-match-blocks +``` + +## Basic usage + +Find all paragraph blocks in a post: + +```php + 'core/paragraph' ] ); +``` + +Include paragraphs in inner blocks: + +```php + true, + 'name' => 'core/paragraph', + ] +); +``` + +Get the number of paragraph blocks: + +```php + true, + 'name' => 'core/paragraph', + ] +); +``` + +Get the number of paragraph blocks that are inner blocks of the given group block: + +```php +
' ); + +$count = \Alley\WP\match_blocks( + $blocks[0], + [ + 'count' => true, + 'name' => 'core/paragraph', + ] +); +``` + +Get all paragraphs and headings: + +```php +…', + [ + 'name' => [ 'core/heading', 'core/paragraph' ], + ] +); +``` + +Get only paragraphs that have been explicitly aligned: + +```php + 'core/paragraph', + 'with_attrs' => 'align', + ] +); +``` + +Get only paragraphs that have been right-aligned: + +```php + [ + [ + 'key' => 'align', + 'value' => 'right', + ], + ], + 'name' => 'core/paragraph', + ] +); +``` + +Get only paragraphs that have been aligned, but not to the right: + +```php + [ + [ + 'key' => 'align', + 'value' => 'right', + 'operator' => '!==', + ], + ], + 'name' => 'core/paragraph', + ] +); +``` + +Get only paragraphs that have been aligned to the left or the right: + +```php + [ + [ + 'key' => 'align', + 'value' => [ 'left', 'right' ], + 'operator' => 'IN', + ], + ], + 'name' => 'core/paragraph', + ] +); +``` + +Get all images credited to the Associated Press: + +```php + [ + [ + 'key' => 'credit', + 'value' => '/(The )?Associated Press/i', + 'operator' => 'REGEX', + ], + [ + 'key' => 'credit', + 'value' => 'AP', + ], + 'relation' => 'OR', + ], + 'name' => 'core/image', + ] +); +``` + +Get shortcode blocks with a specific shortcode: + +```php + 'core/shortcode', + 'with_innerhtml' => '[bc_video', + ] +); +``` + +Audit a post for YouTube embed blocks that reference videos that are no longer accessible. + +```php + 'core/embed', + 'attrs' => [ + [ + 'key' => 'providerNameSlug', + 'value' => 'youtube', + ], + ], + 'is_valid' => new \Alley\Validator\Not( new YouTube_Video_Exists(), '…' ), + ], +); +``` + +Get the first three blocks: + +```php + 3, + ] +); +``` + +Get the first three paragraph blocks: + +```php + 3, + 'name' => 'core/paragraph', + ] +); +``` + +Get the third paragraph: + +```php + 'core/paragraph', + 'nth_of_type' => 3, + ] +); + +// Or, skip straight to the parsed block: + +$block = \Alley\WP\match_block( + $post, + [ + 'name' => 'core/paragraph', + 'nth_of_type' => '3n', + ] +); +``` + +Get every third paragraph: + +```php + 'core/paragraph', + 'nth_of_type' => '3n', + ] +); +``` + +Get paragraphs 3-8: + +```php + 'core/paragraph', + 'nth_of_type' => [ 'n+3', '-n+8' ], + ] +); +``` + +Get the block at position 3 in the set if it's a paragraph: + +```php + 'core/paragraph', + 'position' => 3, + ] +); +``` + +Get the last two blocks: + +```php + [ -1, -2 ], + ] +); +``` + +Get all non-empty blocks: + +```php + null, + 'skip_empty_blocks' => false, + ] +); +``` + +Get only blocks with inner blocks: + +```php + true, + ] +); +``` + +Get only blocks without inner blocks: + +```php + false, + ] +); +``` + +## Validators + +This package provides classes for validating blocks based on the [Laminas Validator](https://docs.laminas.dev/laminas-validator/) framework and [Laminas Validator Extensions](https://github.com/alleyinteractive/laminas-validator-extensions) package, plus a custom base block validation class. + +`match_blocks()` also uses these validators internally, and they can be passed as the `is_valid` parameter to `match_blocks()` or used on their own. + +### Base Validator + +The abstract `Alley\WP\Validator\BlockValidator` class extends `Alley\Validator\BaseValidator` and, much like `BaseValidator`, standardizes validation of blocks. + +When extending `BlockValidator`, validation logic goes into a `test_block()` method. `test_block()` always receives a `\WP_Block_Parser_Block` instance; validation will automatically fail if the input is not an instance of `\WP_Block`, `\WP_Block_Parser_Block`, or an array representation of a block. + +### `Block_Attribute` + +`Alley\WP\Validator\Block_Attribute` validates whether the block contains, or does not contain, the specified attribute name, value, or name-value pair. + +The block passes if a name comparison is specified, and the block contains an attribute whose name matches the comparison; if a value comparison is specified, and the block contains an attribute whose value matches the comparison; or if both name and value comparisons are specified, and the block contains an attribute with a matching name and value. + +#### Supported options + +The following options are supported for `Alley\WP\Validator\Block_Attribute`: + +- `key`: The name of a block attribute, or an array of names, or a regular expression pattern. Default none. +- `value`: A block attribute value, or an array of values, or regular expression pattern. Default none. +- `operator`: The operator with which to compare `$value` to block attributes. Accepts `CONTAINS`, `NOT CONTAINS` (case-sensitive), `IN`, `NOT IN`, `LIKE`, `NOT LIKE` (case-insensitive), `REGEX`, `NOT REGEX`, or any operator supported by `\Alley\Validator\Comparison`. Default is `===`. +- `key_operator`: Equivalent to `operator` but for `$key`. + +#### Basic usage + +```php +'; + +$valid = new Alley\WP\Validator\Block_Attribute( + [ + 'key' => 'mediaType', + 'value' => 'image', + ], +); + +$valid = new Alley\WP\Validator\Block_Attribute( + [ + 'key' => [ 'mediaType', 'mediaId' ], + 'key_operator' => 'IN', + ], +); + +$valid = new Alley\WP\Validator\Block_Attribute( + [ + 'key' => '/^media/', + 'key_operator' => 'REGEX', + 'value' => [ 'image', 'video' ], + 'operator' => 'IN', + ], +); + +$valid = new Alley\WP\Validator\Block_Attribute( + [ + 'key' => '/^media/', + 'key_operator' => 'REGEX', + 'value' => [ 'audio', 'document' ], + 'operator' => 'NOT IN', + ], +); +``` +### `Block_InnerHTML` + +`Alley\WP\Validator\Block_InnerHTML` validates whether the block contains, or does not contain, the specified content in its `innerHTML` property. The block passes if it contains an `innerHTML` value that matches the comparison. + +#### Supported options + +The following options are supported for `Alley\WP\Validator\Block_InnerHTML`: + +- `content`: The content to find or a regular expression pattern. +- `operator`: The operator with which to compare `$content` to the block inner HTML. Accepts `CONTAINS`, `NOT CONTAINS` (case-sensitive), `IN`, `NOT IN`, `LIKE`, `NOT LIKE` (case-insensitive), `REGEX`, `NOT REGEX`, or any operator supported by `\Alley\Validator\Comparison`. Default is `LIKE`. + +#### Basic usage + +```php + +//

The goal of this new editor is to make adding rich content to WordPress simple and enjoyable.

+// +// ' + +$valid = new Alley\WP\Validator\Block_InnerHTML( + [ + 'content' => 'wordpress', + 'operator' => 'LIKE', + ], +); + +$valid = new Alley\WP\Validator\Block_InnerHTML( + [ + 'content' => 'WordPress', + 'operator' => 'CONTAINS', + ], +); + +$valid = new Alley\WP\Validator\Block_InnerHTML( + [ + 'content' => '/^\s*

\s*

/', + 'operator' => 'NOT REGEX', + ], +); +``` + +### `Block_Name` + +`Alley\WP\Validator\Block_Name` validates whether a block has a given name or one of a set of names. The block passes validation if the block name is in the set. + +#### Supported options + +The following options are supported for `Alley\WP\Validator\Block_Name`: + +-`name`: The block name or names. + +#### Basic usage + +```php + 'core/paragraph', + ] +); + +$valid = new Alley\WP\Validator\Block_Name( + [ + 'name' => [ 'core/gallery', 'jetpack/slideshow', 'jetpack/tiled-gallery' ], + ] +); +``` + +### `Block_Offset` + +`Alley\WP\Validator\Block_Offset` validates whether the block appears at one of the given numeric offsets within a list of blocks. + +The block matches if it appears at one of the offsets in the list. + +Identity is determined by comparing the `\WP_Block_Parser_Block` instances as arrays. + +#### Supported options + +The following options are supported for `Alley\WP\Validator\Block_Offset`: + +- `blocks`: An array or iterable of blocks. +- `offset`: The expected offset or offsets. Negative offsets count from the end of the list. +- `skip_empty_blocks`: Whether to skip blocks that are "empty" according to the `Nonempty_Block_Validator` when indexing `$blocks`. Default true. + +#### Basic usage + +```php +

Hello, world!

+ + + + +HTML +); + +$valid = new Alley\WP\Validator\Block_Offset( + [ + 'blocks' => $blocks, + 'offset' => 1, + ], +); +$valid->isValid( $blocks[2] ); // true + +$valid = new Alley\WP\Validator\Block_Offset( + [ + 'blocks' => $blocks, + 'offset' => [ 4 ], + 'skip_empty_blocks' => false, + ], +); +$valid->isValid( $blocks[4] ); // true + +$valid = new Alley\WP\Validator\Block_Offset( + [ + 'blocks' => $blocks, + 'offset' => -2, + ], +); +$valid->isValid( $blocks[2] ); // true +``` + +### `Block_InnerBlocks_Count` + +`Alley\WP\Validator\Block_InnerBlocks_Count` validates whether the number of inner blocks in the given block passes the specified comparison. + +The block passes validation if the comparison is true for the count of inner blocks. Inner blocks within inner blocks don't count towards the total. + +#### Supported options + +The following options are supported for `Alley\WP\Validator\Block_InnerBlocks_Count`: + +* `count`: The expected number of inner blocks for the comparison. +* `operator`: The PHP comparison operator used to compare the input block's inner blocks and `count`. + +#### Basic usage + +```php + + + + + +HTML +); + +$valid = new \Alley\WP\Validator\Block_InnerBlocks_Count( + [ + 'count' => 1, + 'operator' => '===', + ] +); +$valid->isValid( $blocks[0] ); // true + +$valid = new \Alley\WP\Validator\Block_InnerBlocks_Count( + [ + 'count' => 0, + 'operator' => '>', + ] +); +$valid->isValid( $blocks[0] ); // true + +$valid = new \Alley\WP\Validator\Block_InnerBlocks_Count( + [ + 'count' => 42, + 'operator' => '<=', + ] +); +$valid->isValid( $blocks[0] ); // true +``` + +### `Nonempty_Block` + +`Alley\WP\Validator\Nonempty_Block` validates that the given block is not "empty" -- for example, not a block representing only line breaks. + +The block passes validation if it has a non-null name. + +#### Supported options + +None. + +#### Basic usage + +```php +isValid( $blocks[0] ); // false +``` + +## About + +### License + +[GPL-2.0-or-later](https://github.com/alleyinteractive/wp-match-blocks/blob/main/LICENSE) + +### Maintainers + +[Alley Interactive](https://github.com/alleyinteractive) diff --git a/vendor/alleyinteractive/wp-match-blocks/composer.json b/vendor/alleyinteractive/wp-match-blocks/composer.json new file mode 100644 index 00000000..37b0535b --- /dev/null +++ b/vendor/alleyinteractive/wp-match-blocks/composer.json @@ -0,0 +1,51 @@ +{ + "name": "alleyinteractive/wp-match-blocks", + "description": "Match WordPress blocks in the given content.", + "type": "library", + "license": "GPL-2.0-or-later", + "authors": [ + { + "name": "Alley", + "email": "info@alley.com" + } + ], + "autoload": { + "files": [ + "src/alley/wp/match-blocks.php", + "src/alley/wp/internals/internals.php" + ] + }, + "config": { + "allow-plugins": { + "alleyinteractive/composer-wordpress-autoloader": true, + "dealerdirect/phpcodesniffer-composer-installer": true + }, + "lock": false + }, + "require": { + "php": "^8.0", + "alleyinteractive/composer-wordpress-autoloader": "^1.0.0", + "alleyinteractive/laminas-validator-extensions": "^2.0.0" + }, + "require-dev": { + "alleyinteractive/alley-coding-standards": "^1.0.0", + "friendsofphp/php-cs-fixer": "^3.8", + "mantle-framework/testkit": "^0.9" + }, + "scripts": { + "fixer": "php-cs-fixer -v fix --allow-risky=yes", + "phpcbf": "phpcbf", + "phpcs": "phpcs", + "phpunit": "phpunit" + }, + "extra": { + "wordpress-autoloader": { + "autoload": { + "Alley\\": "src/alley/" + }, + "autoload-dev": { + "Alley\\": "tests/alley/" + } + } + } +} diff --git a/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/internals/internals.php b/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/internals/internals.php new file mode 100644 index 00000000..f32265e3 --- /dev/null +++ b/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/internals/internals.php @@ -0,0 +1,175 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @package wp-match-blocks + */ + +namespace Alley\WP\Internals; + +use Alley\Validator\AnyValidator; +use Alley\Validator\FastFailValidatorChain; +use Alley\WP\Validator\Block_Attribute; +use Laminas\Validator\ValidatorInterface; + +/** + * Merge inner blocks into the top-level array of blocks. + * + * @param array $blocks Blocks. + * @return array More blocks. + */ +function flatten_blocks( array $blocks ): array { + $out = []; + + while ( $blocks ) { + $block = array_shift( $blocks ); + $out[] = $block; + + if ( ! empty( $block['innerBlocks'] ) ) { + array_unshift( $blocks, ...$block['innerBlocks'] ); + } + } + + return $out; +} + +/** + * Parse 'attrs' clauses into validators. + * + * @throws \Exception If clauses are malformed. + * + * @param array $args 'attrs' argument. + * @return ValidatorInterface + */ +function parse_attrs_clauses( array $args ): ValidatorInterface { + $relation = 'AND'; + + if ( isset( $args['relation'] ) && 'OR' === strtoupper( $args['relation'] ) ) { + $relation = 'OR'; + } + + unset( $args['relation'] ); + + $chain = []; + + foreach ( $args as $clause ) { + if ( ! \is_array( $clause ) ) { + continue; + } + + if ( isset( $clause['relation'] ) || isset( $clause[0] ) ) { + $chain[] = parse_attrs_clauses( $clause ); + continue; + } + + $chain[] = new Block_Attribute( $clause ); + } + + if ( \count( $chain ) === 0 ) { + throw new \Exception(); + } + + if ( 'AND' === $relation ) { + return new FastFailValidatorChain( $chain ); + } + + // If it's not AND then it's OR. + return new AnyValidator( $chain ); +} + +/** + * Parse the 'nth_of_type' parameter into the matching 1-based indices. + * + * @param int|int[]|string|string[] $args 'nth_of_type' argument. + * @param int $max Total number of available blocks. + * @return int[] Matching indices within the set of available blocks. + */ +function parse_nth_of_type( $args, int $max ): array { + if ( \is_int( $args ) ) { + return [ $args ]; + } + + $args = (array) $args; + + if ( array_filter( $args, 'is_int' ) === $args ) { + return $args; + } + + $selectors = $args; + unset( $selectors['relation'] ); + + $matches = []; + + foreach ( $selectors as $selector ) { + if ( 'odd' === $selector ) { + $selector = '2n+1'; + } + + if ( 'even' === $selector ) { + $selector = '2n'; + } + + if ( preg_match( '/^([+-]?\d+)?(-?n)?([+-]\d+)?$/', $selector, $pieces ) ) { + $a = isset( $pieces[1] ) && \strlen( $pieces[1] ) ? $pieces[1] : null; + $n = $pieces[2] ?? null; + $b = $pieces[3] ?? null; + + if ( ! $n ) { + // Matches '\d'. + return [ (int) $a ]; + } + + if ( $n && '0' === $a ) { + // Matches '0n' or '0n+\d'. + return isset( $b ) ? [ (int) $b ] : []; + } + + $indices = []; + $i = 0; + + while ( true ) { + $next = $i; + + if ( '-n' === $n ) { + $next *= -1; + } + + if ( isset( $a ) ) { + $next *= (int) $a; + } + + if ( isset( $b ) ) { + $next += (int) $b; + } + + if ( $max < abs( $next ) ) { + break; + } + + $indices[] = $next; + $i++; + } + + $matches[] = $indices; + } + } + + if ( ! $matches ) { + return []; + } + + if ( \count( $matches ) === 1 ) { + return $matches[0]; + } + + if ( isset( $args['relation'] ) && 'OR' === $args['relation'] ) { + return array_unique( array_merge( ...$matches ) ); + } + + return array_intersect( ...$matches ); +} diff --git a/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/match-blocks.php b/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/match-blocks.php new file mode 100644 index 00000000..2cd52806 --- /dev/null +++ b/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/match-blocks.php @@ -0,0 +1,264 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @package wp-match-blocks + */ + +namespace Alley\WP; + +use Alley\Validator\FastFailValidatorChain; +use Alley\WP\Validator\Block_InnerHTML; +use Alley\WP\Validator\Block_Name; +use Alley\WP\Validator\Block_Offset; +use Alley\WP\Validator\Block_InnerBlocks_Count; +use Alley\WP\Validator\Nonempty_Block; +use Laminas\Validator\ValidatorInterface; + +/** + * Match blocks within the given content. + * + * @param int|\WP_Post|string|array[]|\WP_Block_Parser_Block|array $source Post ID or object with blocks in `post_content`, string of block HTML, + * array of blocks, or a single block instance. Passing a single block + * will return matches from its inner blocks. + * @param array $args { + * Optional. Array of arguments for matching which blocks to return. The defaults match all non-empty blocks. + * + * @type array $attrs { + * Match blocks with the given attributes. + * + * @type string $relation Optional. The keyword used to join the block attribute clauses. Accepts 'AND', or 'OR'. Default 'AND'. + * @type array ...$0 { + * An array of attribute clause parameters, or another fully formed array of attributes to match. + * + * @type string|string[] $key The name of a block attribute, or an array of names, or a regular + * expression pattern. Default none. + * @type mixed $value A block attribute value, or an array of values, or regular + * expression pattern. Default none. + * @type string $operator The operator with which to compare `$value` to block attributes. + * Accepts `CONTAINS`, `NOT CONTAINS` (case-sensitive), `IN`, `NOT IN`, + * `LIKE`, `NOT LIKE` (case-insensitive), `REGEX`, `NOT REGEX`, or any + * operator supported by `\Alley\Validator\Comparison`. Default `===`. + * @type string $key_operator Equivalent to `$operator` but for `$key`. + * } + * } + * @type bool $count Return the number of found blocks instead of the set. + * @type bool $has_innerblocks Return only blocks that have, or don't have, inner blocks. + * @type ValidatorInterface $is_valid Match blocks that pass the given validator. + * @type bool $flatten Recursively descend into inner blocks, test each one against the + * criteria, and count each towards totals. Default false. + * @type int $limit Extract at most this many blocks. Default `-1`, or no limit. + * @type int|int[]|string|string[] $nth_of_type { + * Extract blocks based on their position in the set of found blocks. + * + * @type string $relation Optional. The keyword used to join 'An+B' selectors if more than one is passed. + * Accepts 'AND', or 'OR'. Default 'AND'. Integer arrays are always joined with 'OR'. + * @type int|int[]|string|string[] ...$0 A 1-based integer index or array of indices, a `An+B` pattern (like the `:nth-child` + * pattern in CSS), or an array of `An+B` patterns for matching 1-based indices. + * } + * @type string|string[] $name Match blocks with this block name or names. + * @type int|int[] $position Match blocks that appear at the given index. A negative index counts from the end. + * Note that all blocks with identical HTML to the matched block will also match. + * @type bool $skip_empty_blocks Ignore blocks representing white space. Default true. + * @type string|string[] $with_attrs Match blocks with non-empty values for this attribute or these attributes. + * Blocks must match all of the given `$with_attrs` and `$attrs`. + * @type string $with_innerhtml Match blocks whose `innerHTML` property contains this content, ignoring case. + * } + * @return array[]|int Array of found blocks or count thereof. + */ +function match_blocks( $source, $args = [] ) { + $args = wp_parse_args( + $args, + [ + 'attrs' => [], + 'count' => false, + 'flatten' => false, + 'has_innerblocks' => null, + 'is_valid' => null, + 'limit' => -1, + 'name' => '', + 'nth_of_type' => null, + 'position' => null, + 'skip_empty_blocks' => true, + 'with_attrs' => [], + 'with_innerhtml' => null, + ], + ); + + $blocks = []; + $error = $args['count'] ? 0 : []; + + if ( $source instanceof \WP_Block_Parser_Block ) { + $source = (array) $source; + } + + if ( \is_array( $source ) ) { + $blocks = $source; + } + + if ( is_numeric( $source ) || $source instanceof \WP_Post ) { + $post = get_post( $source ); + + if ( ! $post ) { + return $error; + } + + $blocks = parse_blocks( $post->post_content ); + } + + if ( \is_string( $source ) ) { + $blocks = parse_blocks( $source ); + } + + if ( \is_array( $blocks ) && isset( $blocks['innerBlocks'] ) ) { + $blocks = $blocks['innerBlocks']; + } + + if ( ! wp_is_numeric_array( $blocks ) || 0 === \count( $blocks ) ) { + return $error; + } + + if ( $args['flatten'] ) { + $blocks = Internals\flatten_blocks( $blocks ); + } + + try { + $validator = new FastFailValidatorChain( [] ); + + if ( $args['skip_empty_blocks'] ) { + $validator->attach( new Nonempty_Block() ); + } + + if ( '' !== $args['name'] ) { + $validator->attach( + new Block_Name( + [ + 'name' => $args['name'], + ], + ), + ); + } + + if ( null !== $args['position'] ) { + $validator->attach( + new Block_Offset( + [ + 'blocks' => $blocks, + 'offset' => $args['position'], + 'skip_empty_blocks' => $args['skip_empty_blocks'], + ], + ), + ); + } + + if ( $args['with_attrs'] ) { + $args['attrs'] = [ + 'relation' => 'AND', + [ + 'key' => (array) $args['with_attrs'], + 'key_operator' => 'IN', + 'value' => '', + 'operator' => '!=', + ], + $args['attrs'], + ]; + } + + if ( $args['attrs'] && \is_array( $args['attrs'] ) ) { + $validator->attach( + Internals\parse_attrs_clauses( $args['attrs'] ), + ); + } + + if ( \is_string( $args['with_innerhtml'] ) || $args['with_innerhtml'] instanceof \Stringable ) { + $validator->attach( + new Block_InnerHTML( + [ + 'content' => $args['with_innerhtml'], + 'operator' => 'LIKE', + ], + ), + ); + } + + if ( null !== $args['has_innerblocks'] ) { + $validator->attach( + new Block_InnerBlocks_Count( + [ + 'count' => 0, + 'operator' => $args['has_innerblocks'] ? '>' : '===', + ], + ), + ); + } + + if ( $args['is_valid'] instanceof ValidatorInterface ) { + $validator->attach( $args['is_valid'] ); + } + } catch ( \Exception $exception ) { + return $error; + } + + // Reduce to matching indices. + $matches = array_map( [ $validator, 'isValid' ], $blocks ); + $matches = array_filter( $matches ); + $matches = array_keys( $matches ); + + if ( null !== $args['nth_of_type'] ) { + // These are 1-based indices. Map them to 0-based. + $nth_of_type = Internals\parse_nth_of_type( $args['nth_of_type'], \count( $matches ) ); + $nth_indices = array_map( + fn( $nth ) => (int) $nth - 1, + $nth_of_type + ); + + // Flip indices into array keys, then intersect with keys of matched blocks. + $nth_as_keys = array_flip( $nth_indices ); + $matches = array_intersect_key( $matches, $nth_as_keys ); + } + + if ( $args['limit'] >= 0 ) { + $matches = \array_slice( $matches, 0, $args['limit'] ); + } + + if ( $args['count'] ) { + return \count( $matches ); + } + + // Flip indices into array keys. + $matches = array_flip( $matches ); + + // Intersect matching keys with keys in original list of blocks. + $matches = array_intersect_key( $blocks, $matches ); + + // Return matched blocks in a new list. + return array_values( $matches ); +} + +/** + * Return the first matching block from `match_blocks()`, if any. + * + * @param array|int|\WP_Post|string $source See `match_blocks()`. + * @param array $args See `match_blocks()`. + * @return array|int|null The found block or null. + */ +function match_block( $source, $args = [] ): ?array { + $args['limit'] = 1; + + $blocks = match_blocks( $source, $args ); + + if ( \is_int( $blocks ) ) { + return $blocks; + } + + if ( isset( $blocks[0] ) && \is_array( $blocks[0] ) ) { + return $blocks[0]; + } + + return null; +} diff --git a/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/validator/class-block-attribute.php b/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/validator/class-block-attribute.php new file mode 100644 index 00000000..ebf3f334 --- /dev/null +++ b/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/validator/class-block-attribute.php @@ -0,0 +1,246 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @package wp-match-blocks + */ + +namespace Alley\WP\Validator; + +use Alley\Validator\AlwaysValid; +use Alley\Validator\ValidatorByOperator; +use Laminas\Validator\Exception\InvalidArgumentException; +use Laminas\Validator\ValidatorInterface; +use Traversable; +use WP_Block; +use WP_Block_Parser_Block; +use WP_Error; + +/** + * Validates whether the given block contains the specified attribute. + */ +final class Block_Attribute extends Block_Validator { + /** + * Error code. + * + * @var string + */ + public const NO_MATCHING_KEY = 'no_matching_key'; + + /** + * Error code. + * + * @var string + */ + public const NO_MATCHING_VALUE = 'no_matching_value'; + + /** + * Internal symbol. + * + * @var string + */ + private const UNDEFINED = '__UNDEFINED__'; + + /** + * Array of validation failure message templates. + * + * @var string[] + */ + protected $messageTemplates = [ + self::NO_MATCHING_KEY => '', + self::NO_MATCHING_VALUE => '', + ]; + + /** + * Options for this validator. + * + * @var array + */ + protected $options = [ + 'key' => null, + 'key_operator' => '===', + 'value' => self::UNDEFINED, + 'operator' => '===', + ]; + + /** + * Validates attribute keys based on options. + * + * @var ValidatorInterface + */ + private ValidatorInterface $key_validator; + + /** + * Validates attribute values based on options. + * + * @var ValidatorInterface + */ + private ValidatorInterface $value_validator; + + /** + * Set up. + * + * @param array|Traversable $options Validator options. + */ + public function __construct( $options = null ) { + $this->messageTemplates = [ + self::NO_MATCHING_KEY => __( 'Block must have attribute with eligible key.', 'alley' ), + self::NO_MATCHING_VALUE => __( 'Block must have attribute with eligible value.', 'alley' ), + ]; + + $this->key_validator = new AlwaysValid(); + $this->value_validator = new AlwaysValid(); + + parent::__construct( $options ); + } + + /** + * Sets one or multiple options. Merges new options into existing options, validates them in relation to one + * another, and refreshes the cached validators for the comparisons. + * + * @throws InvalidArgumentException If requested comparisons are invalid. + * + * @param array|Traversable $options Options to set. + * @return self + */ + public function setOptions( $options = [] ) { + $next = $this->options; + + foreach ( $options as $key => $value ) { + if ( \array_key_exists( $key, $next ) ) { + $next[ $key ] = $value; + } + } + + if ( null !== $next['key'] ) { + try { + $this->key_validator = new ValidatorByOperator( $next['key_operator'], $next['key'] ); + } catch ( \Exception $exception ) { + throw new InvalidArgumentException( 'Invalid clause for attribute key: ' . $exception->getMessage() ); + } + } + + if ( self::UNDEFINED !== $next['value'] ) { + try { + $this->value_validator = new ValidatorByOperator( $next['operator'], $next['value'] ); + } catch ( \Exception $exception ) { + throw new InvalidArgumentException( 'Invalid clause for attribute value: ' . $exception->getMessage() ); + } + } + + $options = array_merge( $options, $next ); + + /* + * Temporarily move 'value' option to a new key so that + * `\Laminas\Validator\AbstractValidator::setOptions()` + * doesn't attempt to pass it to `::setValue()`. + */ + $options['val'] = $options['value']; + unset( $options['value'] ); + + return parent::setOptions( $options ); + } + + /** + * Restore 'value' option. + * + * @param mixed $val Value. + */ + protected function setVal( $val ) { + $this->options['value'] = $val; + } + + /** + * Apply block validation logic and add any validation errors. + * + * @param WP_Block_Parser_Block $block The block to test. + */ + protected function test_block( WP_Block_Parser_Block $block ): void { + $attrs = $block->attrs; + + // For each test performed against the attributes, an array of matching attribute indices. + $tests = []; + + // For each test performed against the attributes, the number of failed attributes. + $misses = []; + + [ $hit_indices, $miss_count ] = self::test( + $this->key_validator, + array_keys( $attrs ), + ); + + $tests[] = $hit_indices; + $misses[] = $miss_count; + + if ( ! self::passing( $tests, $misses ) ) { + $this->error( self::NO_MATCHING_KEY ); + return; + } + + [ $hit_indices, $miss_count ] = self::test( + $this->value_validator, + array_values( $attrs ) + ); + + $tests[] = $hit_indices; + $misses[] = $miss_count; + + if ( ! self::passing( $tests, $misses ) ) { + $this->error( self::NO_MATCHING_VALUE ); + return; + } + } + + /** + * Test each of the given values against a configured operator. + * + * @param ValidatorInterface $validator Validator to test against. + * @param array $values Indexed list of values to test. + * @return array The indices of $values that passed the comparison and the + * number of $values that failed the comparison. + */ + private static function test( ValidatorInterface $validator, array $values ): array { + $hit_indices = []; + + foreach ( $values as $i => $value ) { + if ( $validator->isValid( $value ) ) { + $hit_indices[] = $i; + } + } + + return [ $hit_indices, \count( $values ) - \count( $hit_indices ) ]; + } + + /** + * Whether the block is passing validation. + * + * @param array[] $tests Zero or more arrays, each containing the indices of + * attribute keys or values that passed a comparison. + * @param int[] $misses The number of failed comparisons across tests of + * attribute keys and values. + * @return bool + */ + private static function passing( array $tests, array $misses ): bool { + return ( + ( + // No comparisons were specified for key or value. + \count( $tests ) === 0 + // At least one attribute was available on the block to test. + || ( \count( array_merge( ...$tests ) ) > 0 || array_filter( $misses ) ) + ) + && ( + // Both key and value were tested, and at least one index matched in both. + ( \count( $tests ) > 1 && array_intersect( ...$tests ) ) + // Either key or value was tested, and at least one index matched. + || ( \count( $tests ) === 1 ) && \count( ...$tests ) > 0 + // No tests missed, if any ran. + || ! array_filter( $misses ) + ) + ); + } +} diff --git a/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/validator/class-block-innerblocks-count.php b/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/validator/class-block-innerblocks-count.php new file mode 100644 index 00000000..4960fc3b --- /dev/null +++ b/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/validator/class-block-innerblocks-count.php @@ -0,0 +1,248 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @package wp-match-blocks + */ + +namespace Alley\WP\Validator; + +use Alley\Validator\AlwaysValid; +use Alley\Validator\Comparison; +use Alley\Validator\Not; +use Alley\Validator\WithMessage; +use Laminas\Validator\Exception\InvalidArgumentException; +use Laminas\Validator\ValidatorInterface; +use Traversable; +use WP_Block; +use WP_Block_Parser_Block; +use WP_Error; + +/** + * Validates whether the given block has a number of inner blocks. + */ +final class Block_InnerBlocks_Count extends Block_Validator { + /** + * Array of validation failure message templates. + * + * @var string[] + */ + protected $messageTemplates = [ + 'not_equal' => '', + 'not_identical' => '', + 'is_equal' => '', + 'is_identical' => '', + 'not_less_than' => '', + 'not_greater_than' => '', + 'not_less_than_or_equal_to' => '', + 'not_greater_than_or_equal_to' => '', + 'invalid_comparison' => '', + 'default' => '', + ]; + + /** + * Array of additional variables available for validation failure messages. + * + * @var string[] + */ + protected $messageVariables = [ + 'count' => [ + 'options' => 'count', + ], + ]; + + /** + * Options for this validator. + * + * @var array + */ + protected $options = [ + 'operator' => '>=', + 'count' => 0, + ]; + + /** + * Valid inner block counts based on options. + * + * @var ValidatorInterface + */ + private ValidatorInterface $valid_comparisons; + + /** + * Set up. + * + * @param array|Traversable $options Validator options. + */ + public function __construct( $options = null ) { + $this->localize_templates(); + + $this->valid_comparisons = new Comparison( + [ + 'operator' => $this->options['operator'], + 'compared' => $this->options['count'], + ], + ); + + parent::__construct( $options ); + } + + /** + * Sets one or multiple options. Refreshes the cached validators for the comparisons. + * + * @throws InvalidArgumentException If requested comparisons are invalid. + * + * @param array|Traversable $options Options to set. + * @return self + */ + public function setOptions( $options = [] ) { + parent::setOptions( $options ); + + try { + $this->valid_comparisons = new Comparison( + [ + 'operator' => $this->options['operator'], + 'compared' => $this->options['count'], + ], + ); + } catch ( \Exception $exception ) { + $message = 'Invalid comparison options for count of inner blocks: ' . $exception->getMessage(); + + /* + * Force all blocks to fail validation while the new options are invalid in relation to one another. + * Don't try to undo the work of `parent::setOptions()`, since that might leave the validator in + * an unpredictable state. + */ + $this->valid_comparisons = new WithMessage( + 'invalidComparison', + $message, + new Not( new AlwaysValid(), $message ), + ); + + throw new InvalidArgumentException( $message ); + } + + return $this; + } + + /** + * Apply block validation logic and add any validation errors. + * + * @param WP_Block_Parser_Block $block The block to test. + */ + protected function test_block( WP_Block_Parser_Block $block ): void { + $count = \count( $block->innerBlocks ); + + if ( ! $this->valid_comparisons->isValid( $count ) ) { + $message_keys = array_keys( $this->valid_comparisons->getMessages() ); + + foreach ( $message_keys as $key ) { + $this->error( $this->message( $key ), $count ); + } + } + } + + /** + * Sets the 'count' option. + * + * @param int $count Option. + */ + protected function setCount( $count ) { + $this->options['count'] = (int) $count; + } + + /** + * This validator relies on other validators to perform the final comparison of the inner block count. + * Here, map failure message identifiers from those validators to the ones defined by this validator. + * + * @param string $origin Upstream validator failure message identifier. + * @return string This validator's identifier. + */ + private function message( string $origin ): string { + switch ( $origin ) { + case 'notEqual': + return 'not_equal'; + case 'notIdentical': + return 'not_identical'; + case 'isEqual': + return 'is_equal'; + case 'isIdentical': + return 'is_identical'; + case 'notLessThan': + return 'not_less_than'; + case 'notGreaterThan': + return 'not_greater_than'; + case 'notLessThanOrEqualTo': + return 'not_less_than_or_equal_to'; + case 'notGreaterThanOrEqualTo': + return 'not_greater_than_or_equal_to'; + case 'invalidComparison': + return 'invalid_comparison'; + default: + return 'default'; + } + } + + /** + * Localize message templates. + */ + private function localize_templates(): void { + $neq = sprintf( + /* translators: 1: expected count placeholder, 2: actual count placeholder */ + __( 'Number of inner blocks must be %1$s but is %2$s.', 'alley' ), + '%count%', + '%value%', + ); + + $ieq = sprintf( + /* translators: 1: expected count placeholder */ + __( 'Number of inner blocks must not be %1$s.', 'alley' ), + '%count%', + ); + + $nlt = sprintf( + /* translators: 1: expected count placeholder, 2: actual count placeholder */ + __( 'Number of inner blocks must be less than %1$s but is %2$s.', 'alley' ), + '%count%', + '%value%', + ); + + $ngt = sprintf( + /* translators: 1: expected count placeholder, 2: actual count placeholder */ + __( 'Number of inner blocks must be greater than %1$s but is %2$s.', 'alley' ), + '%count%', + '%value%', + ); + + $nlte = sprintf( + /* translators: 1: expected count placeholder, 2: actual count placeholder */ + __( 'Number of inner blocks must be less than or equal to %1$s but is %2$s.', 'alley' ), + '%count%', + '%value%', + ); + + $ngte = sprintf( + /* translators: 1: expected count placeholder, 2: actual count placeholder */ + __( 'Number of inner blocks must be greater than or equal to %1$s but is %2$s.', 'alley' ), + '%count%', + '%value%', + ); + + $this->messageTemplates = [ + 'not_equal' => $neq, + 'not_identical' => $neq, + 'is_equal' => $ieq, + 'is_identical' => $ieq, + 'not_less_than' => $nlt, + 'not_greater_than' => $ngt, + 'not_less_than_or_equal_to' => $nlte, + 'not_greater_than_or_equal_to' => $ngte, + 'invalid_comparison' => __( 'Invalid comparison options for count of inner blocks.', 'alley' ), + 'default' => __( 'Invalid count of inner blocks.', 'alley' ), + ]; + } +} diff --git a/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/validator/class-block-innerhtml.php b/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/validator/class-block-innerhtml.php new file mode 100644 index 00000000..429b0279 --- /dev/null +++ b/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/validator/class-block-innerhtml.php @@ -0,0 +1,112 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @package wp-match-blocks + */ + +namespace Alley\WP\Validator; + +use Alley\Validator\ValidatorByOperator; +use Laminas\Validator\Exception\InvalidArgumentException; +use Laminas\Validator\ValidatorInterface; +use Traversable; +use WP_Block; +use WP_Block_Parser_Block; +use WP_Error; + +/** + * Validates whether the given block's inner HTML contains the given content. + */ +final class Block_InnerHTML extends Block_Validator { + /** + * Error code. + * + * @var string + */ + public const NO_MATCHING_INNERHTML = 'no_matching_innerhtml'; + + /** + * Array of validation failure message templates. + * + * @var string[] + */ + protected $messageTemplates = [ + self::NO_MATCHING_INNERHTML => '', + ]; + + /** + * Options for this validator. + * + * @var array + */ + protected $options = [ + 'content' => '', + 'operator' => 'LIKE', + ]; + + /** + * Validates block inner HTML based on options. + * + * @var ValidatorInterface + */ + private ValidatorInterface $valid_html; + + /** + * Set up. + * + * @param array|Traversable $options Validator options. + */ + public function __construct( $options = null ) { + $this->messageTemplates[ self::NO_MATCHING_INNERHTML ] = __( 'Block inner HTML does not match.', 'alley' ); + + $this->valid_html = new ValidatorByOperator( $this->options['operator'], $this->options['content'] ); + + parent::__construct( $options ); + } + + /** + * Sets one or multiple options. Merges new options into existing options, validates them in relation to one + * another, and refreshes the cached validators for the comparisons. + * + * @throws InvalidArgumentException If requested comparisons are invalid. + * + * @param array|Traversable $options Options to set. + * @return self + */ + public function setOptions( $options = [] ) { + $next = $this->options; + + foreach ( $options as $key => $value ) { + if ( \array_key_exists( $key, $next ) ) { + $next[ $key ] = $value; + } + } + + try { + $this->valid_html = new ValidatorByOperator( $next['operator'], $next['content'] ); + } catch ( \Exception $exception ) { + throw new InvalidArgumentException( 'Invalid clause for inner HTML: ' . $exception->getMessage() ); + } + + $options = array_merge( $options, $next ); + + return parent::setOptions( $options ); + } + + /** + * Apply block validation logic and add any validation errors. + * + * @param WP_Block_Parser_Block $block The block to test. + */ + protected function test_block( WP_Block_Parser_Block $block ): void { + if ( ! $this->valid_html->isValid( $block->innerHTML ) ) { + $this->error( self::NO_MATCHING_INNERHTML ); + } + } +} diff --git a/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/validator/class-block-name.php b/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/validator/class-block-name.php new file mode 100644 index 00000000..8b4330a7 --- /dev/null +++ b/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/validator/class-block-name.php @@ -0,0 +1,138 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @package wp-match-blocks + */ + +namespace Alley\WP\Validator; + +use Alley\Validator\Comparison; +use Laminas\Validator\InArray; +use Laminas\Validator\ValidatorInterface; +use Traversable; +use WP_Block; +use WP_Block_Parser_Block; + +/** + * Validates whether a block has a given name or one of a set of names. + */ +final class Block_Name extends Block_Validator { + /** + * Error code. + * + * @var string + */ + public const NOT_NAMED = 'not_named'; + + /** + * Error code. + * + * @var string + */ + public const NAME_NOT_IN = 'name_not_in'; + + /** + * Array of validation failure message templates. + * + * @var string[] + */ + protected $messageTemplates = [ + self::NOT_NAMED => '', + self::NAME_NOT_IN => '', + ]; + + /** + * Array of additional variables available for validation failure messages. + * + * @var string[] + */ + protected $messageVariables = [ + 'name' => [ + 'options' => 'name', + ], + 'block_name' => 'current_block_name', + ]; + + /** + * Options for this validator. + * + * @var array + */ + protected $options = [ + 'name' => null, + ]; + + /** + * Name of the block under test for use in error messages. + * + * @var string|null + */ + protected ?string $current_block_name = ''; + + /** + * Set up. + * + * @param array|Traversable $options Validator options. + */ + public function __construct( $options = null ) { + $this->messageTemplates[ self::NOT_NAMED ] = sprintf( + /* translators: 1: allowed names placeholder, 2: block name placeholder */ + __( 'Block must be named %1$s; got %2$s.', 'alley' ), + '%name%', + '%block_name%', + ); + $this->messageTemplates[ self::NAME_NOT_IN ] = sprintf( + /* translators: 1: allowed names placeholder, 2: block name placeholder */ + __( 'Block name must be one of %1$s; got %2$s.', 'alley' ), + '%name%', + '%block_name%', + ); + + parent::__construct( $options ); + } + + /** + * Apply block validation logic and add any validation errors. + * + * @param WP_Block_Parser_Block $block The block to test. + */ + protected function test_block( WP_Block_Parser_Block $block ): void { + $allowed = $this->options['name']; + $message = self::NAME_NOT_IN; + + if ( ! \is_array( $allowed ) ) { + $allowed = [ $allowed ]; + $message = self::NOT_NAMED; + } + + if ( ! \in_array( $block->blockName, $allowed, true ) ) { + $this->error( $message ); + } + } + + /** + * Converts the input into a parser block instance to be validated. + * + * @param array|WP_Block|WP_Block_Parser_Block $value Original block. + */ + protected function setValue( $value ) { + parent::setValue( $value ); + + $this->current_block_name = $this->value->blockName; + } + + /** + * Sets the 'name' option. + * + * @param string|string[] $name Names. + */ + protected function setName( $name ) { + $this->options['name'] = $name; + } +} diff --git a/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/validator/class-block-offset.php b/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/validator/class-block-offset.php new file mode 100644 index 00000000..be72ee2c --- /dev/null +++ b/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/validator/class-block-offset.php @@ -0,0 +1,172 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @package wp-match-blocks + */ + +namespace Alley\WP\Validator; + +use Alley\Validator\Type; +use Laminas\Validator\Exception\InvalidArgumentException; +use Laminas\Validator\ValidatorInterface; +use Traversable; +use WP_Block; +use WP_Block_Parser_Block; +use WP_Error; + +/** + * Validates whether the given block appears at an offset within a set of blocks. + */ +final class Block_Offset extends Block_Validator { + /** + * Error code. + * + * @var string + */ + public const NOT_AT_OFFSET = 'not_at_offset'; + + /** + * Array of validation failure message templates. + * + * @var string[] + */ + protected $messageTemplates = [ + self::NOT_AT_OFFSET => '', + ]; + + /** + * Array of additional variables available for validation failure messages. + * + * @var string[] + */ + protected $messageVariables = [ + 'offset' => [ + 'options' => 'offset', + ], + ]; + + /** + * Options for this validator. + * + * @var array + */ + protected $options = [ + 'blocks' => [], + 'offset' => 0, + 'skip_empty_blocks' => true, + ]; + + /** + * Blocks that will be used in validation based on options. + * + * @var WP_Block_Parser_Block[] + */ + private array $final_blocks = []; + + /** + * Set up. + * + * @param array|Traversable $options Validator options. + */ + public function __construct( $options = null ) { + $this->messageTemplates[ self::NOT_AT_OFFSET ] = sprintf( + /* translators: %s: offset placeholder */ + __( 'Must be at offset %s within the blocks.', 'alley' ), + '%offset%' + ); + + parent::__construct( $options ); + } + + /** + * Sets one or multiple options. Determines the final set of blocks. + * + * @param array|Traversable $options Options to set. + * @return self + */ + public function setOptions( $options = [] ) { + parent::setOptions( $options ); + + $this->final_blocks = $this->options['blocks']; + + if ( $this->options['skip_empty_blocks'] ) { + $this->final_blocks = array_filter( $this->final_blocks, [ new Nonempty_Block(), 'isValid' ] ); + } + + return $this; + } + + /** + * Apply block validation logic and add any validation errors. + * + * @param WP_Block_Parser_Block $block The block to test. + */ + protected function test_block( WP_Block_Parser_Block $block ): void { + foreach ( (array) $this->options['offset'] as $offset ) { + $check = []; + + /* + * Manually checking negative offsets is required because + * `array_slice()` will return the first item if the negative offset + * is out of bounds. + */ + if ( 0 <= $offset || abs( $offset ) <= \count( $this->final_blocks ) ) { + $check = \array_slice( $this->final_blocks, $offset, 1 ); + } + + if ( isset( $check[0] ) && (array) $check[0] === (array) $block ) { + return; + } + } + + $this->error( self::NOT_AT_OFFSET ); + } + + /** + * Sets the 'blocks' option. + * + * @throws InvalidArgumentException If blocks aren't iterable. + * + * @param array[]|WP_Block[]|WP_Block_Parser_Block[] $blocks Blocks. + */ + protected function setBlocks( $blocks ) { + if ( ! is_iterable( $blocks ) ) { + throw new InvalidArgumentException( 'Blocks must be iterable.' ); + } + + if ( ! $blocks instanceof \Traversable ) { + $blocks = new \ArrayIterator( (array) $blocks ); + } + + $blocks = iterator_to_array( $blocks ); + $blocks = array_map( [ self::class, 'to_parser_block' ], $blocks ); + + $this->options['blocks'] = array_values( $blocks ); + } + + /** + * Sets the 'offset' option. + * + * @param int|int[] $offset Offset or offsets. + */ + protected function setOffset( $offset ) { + $offset = \is_array( $offset ) ? array_map( 'intval', $offset ) : (int) $offset; + + $this->options['offset'] = $offset; + } + + /** + * Sets the 'skip_empty_blocks' option. + * + * @param bool $skip Option. + */ + protected function setSkipEmptyBlocks( $skip ) { + $this->options['skip_empty_blocks'] = (bool) $skip; + } +} diff --git a/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/validator/class-block-validator.php b/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/validator/class-block-validator.php new file mode 100644 index 00000000..707f9129 --- /dev/null +++ b/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/validator/class-block-validator.php @@ -0,0 +1,93 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @package wp-match-blocks + */ + +namespace Alley\WP\Validator; + +use Alley\Validator\ExtendedAbstractValidator; +use Laminas\Validator\Exception\InvalidArgumentException; +use WP_Block; +use WP_Block_Parser_Block; + +/** + * Abstract class for validating WordPress blocks. + */ +abstract class Block_Validator extends ExtendedAbstractValidator { + /** + * Properties that need to be in the submitted block to convert it into a parsed block. + * + * @var string[] + */ + private const REQUIRED_BLOCK_KEYS = [ 'blockName', 'attrs', 'innerBlocks', 'innerHTML', 'innerContent' ]; + + /** + * Apply block validation logic and add any validation errors. + * + * @param WP_Block_Parser_Block $block The block to test. + */ + abstract protected function test_block( WP_Block_Parser_Block $block ): void; + + /** + * Apply validation logic and add any validation errors. + * + * @param mixed $value The value to test. + */ + final protected function testValue( $value ): void { + $this->test_block( $value ); + } + + /** + * Converts the input into a parser block instance to be validated. + * + * @throws InvalidArgumentException If the submitted value can't be parsed into a block. + * + * @param array|WP_Block|WP_Block_Parser_Block $value Original block. + */ + protected function setValue( $value ) { + $value = self::to_parser_block( $value ); + + parent::setValue( $value ); + } + + /** + * Convert a block or a representation thereof to a parser block object. + * + * @throws InvalidArgumentException If input cannot be parsed. + * + * @param array|WP_Block|WP_Block_Parser_Block $value Original block. + * @return WP_Block_Parser_Block|null Block instance. + */ + protected static function to_parser_block( $value ): WP_Block_Parser_Block { + if ( $value instanceof WP_Block ) { + $value = $value->parsed_block; + } + + if ( $value instanceof WP_Block_Parser_Block ) { + $value = (array) $value; + } + + $actual_keys = array_keys( $value ); + + if ( array_diff( self::REQUIRED_BLOCK_KEYS, $actual_keys ) ) { + throw new InvalidArgumentException( __( 'Cannot parse block from input.', 'alley' ) ); + } + + $value = new WP_Block_Parser_Block( + $value['blockName'], + $value['attrs'], + $value['innerBlocks'], + $value['innerHTML'], + $value['innerContent'], + ); + + return $value; + } +} diff --git a/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/validator/class-nonempty-block.php b/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/validator/class-nonempty-block.php new file mode 100644 index 00000000..f327e579 --- /dev/null +++ b/vendor/alleyinteractive/wp-match-blocks/src/alley/wp/validator/class-nonempty-block.php @@ -0,0 +1,62 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @package wp-match-blocks + */ + +namespace Alley\WP\Validator; + +use Alley\Validator\AnyValidator; +use Alley\Validator\Not; +use Laminas\Validator\ValidatorInterface; +use Traversable; +use WP_Block_Parser_Block; + +/** + * Validates that the given block is not "empty" -- for example, not a block representing only line breaks. + */ +final class Nonempty_Block extends Block_Validator { + /** + * Error code. + * + * @var string + */ + public const EMPTY_BLOCK = 'empty_block'; + + /** + * Array of validation failure message templates. + * + * @var string[] + */ + protected $messageTemplates = [ + self::EMPTY_BLOCK => '', + ]; + + /** + * Set up. + * + * @param array|Traversable $options Validator options. + */ + public function __construct( $options = null ) { + $this->messageTemplates[ self::EMPTY_BLOCK ] = __( 'Block is empty.', 'alley' ); + + parent::__construct( $options ); + } + + /** + * Apply block validation logic and add any validation errors. + * + * @param WP_Block_Parser_Block $block The block to test. + */ + protected function test_block( WP_Block_Parser_Block $block ): void { + if ( null === $block->blockName && preg_match( '#\S#', $block->innerHTML ) === 0 ) { + $this->error( self::EMPTY_BLOCK ); + } + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/.editorconfig b/vendor/alleyinteractive/wp-type-extensions/.editorconfig new file mode 100644 index 00000000..2708ec41 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/.editorconfig @@ -0,0 +1,19 @@ +# EditorConfig helps maintain consistent coding styles for developers working on the same project across various editors and IDEs. +# See https://editorconfig.org. + +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.php] +indent_size = 4 +indent_style = tab + +[*.xml] +indent_size = 4 diff --git a/vendor/alleyinteractive/wp-type-extensions/.gitattributes b/vendor/alleyinteractive/wp-type-extensions/.gitattributes new file mode 100644 index 00000000..8acdd2f5 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/.gitattributes @@ -0,0 +1,28 @@ +# +# Exclude these files from release archives. +# +# This will also make the files unavailable when using Composer with `--prefer-dist`. +# If you develop using Composer, use `--prefer-source`. +# +# Via WPCS. +# +/.github export-ignore +/.php-cs-fixer.dist.php export-ignore +/phpcs.xml export-ignore +/phpstan.neon export-ignore +/phpunit.xml export-ignore +/tests export-ignore + +# +# Auto detect text files and perform LF normalization. +# +# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/ +# +* text=auto + +# +# The above will handle all files not found below. +# +*.md text +*.php text +*.inc text diff --git a/vendor/alleyinteractive/wp-type-extensions/.gitignore b/vendor/alleyinteractive/wp-type-extensions/.gitignore new file mode 100644 index 00000000..f7334559 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/.gitignore @@ -0,0 +1,5 @@ +vendor +composer.lock +.php_cs.cache +.phpunit.result.cache +.php-cs-fixer.cache diff --git a/vendor/alleyinteractive/wp-type-extensions/CHANGELOG.md b/vendor/alleyinteractive/wp-type-extensions/CHANGELOG.md new file mode 100644 index 00000000..e8366294 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/CHANGELOG.md @@ -0,0 +1,29 @@ +# Changelog + +This library adheres to [Semantic Versioning](https://semver.org/) and [Keep a CHANGELOG](https://keepachangelog.com/en/1.0.0/). + +## Unreleased + +Nothing yet. + +## 2.2.0 + +### Added + +- `GTM_Script` feature. + +## 2.1.0 + +### Changed + +- Support use of `WP_CLI_Feature` in WP-CLI packages. + +## 2.0.0 + +### Changed + +- `Features` class renamed `Group`. + +## 1.0.0 + +Initial release. diff --git a/vendor/alleyinteractive/wp-type-extensions/LICENSE b/vendor/alleyinteractive/wp-type-extensions/LICENSE new file mode 100644 index 00000000..d159169d --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + 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/vendor/alleyinteractive/wp-type-extensions/README.md b/vendor/alleyinteractive/wp-type-extensions/README.md new file mode 100644 index 00000000..02793eaa --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/README.md @@ -0,0 +1,36 @@ +# Type Extensions + +Type Extensions provides a vocabulary of objects for WordPress projects in the form of interfaces representing those objects and implementations of those interfaces. + +The library is oriented toward a declarative style of development that makes use of object composition, in particular the decorator pattern. + +## Installation + +Install the latest version with: + +```bash +$ composer require alleyinteractive/wp-type-extensions +``` + +## Basic usage + +Learn more about the objects included with Type Extensions in the [documentation for each type](#documentation). + +## Documentation + +- [Feature](docs/feature.md) +- [Post IDs](docs/post-ids.md) +- [Post Queries](docs/post-queries.md) +- [Post Query](docs/post-query.md) +- [Serialized Blocks](docs/serialized-blocks.md) +- [Single Block](docs/single-block.md) + +## About + +### License + +[GPL-2.0-or-later](https://github.com/alleyinteractive/wp-type-extensions/blob/main/LICENSE) + +### Maintainers + +[Alley Interactive](https://github.com/alleyinteractive) diff --git a/vendor/alleyinteractive/wp-type-extensions/composer.json b/vendor/alleyinteractive/wp-type-extensions/composer.json new file mode 100644 index 00000000..7d244188 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/composer.json @@ -0,0 +1,53 @@ +{ + "name": "alleyinteractive/wp-type-extensions", + "description": "PHP interfaces and implementations for WordPress.", + "type": "library", + "license": "GPL-2.0-or-later", + "authors": [ + { + "name": "Alley", + "email": "info@alley.com" + } + ], + "config": { + "allow-plugins": { + "alleyinteractive/composer-wordpress-autoloader": true, + "dealerdirect/phpcodesniffer-composer-installer": true + }, + "lock": false + }, + "require": { + "php": "^8.1", + "alleyinteractive/laminas-validator-extensions": "^2.0", + "alleyinteractive/wp-match-blocks": "^3.0", + "spatie/once": "^3.1" + }, + "require-dev": { + "alleyinteractive/alley-coding-standards": "^1.0.0", + "friendsofphp/php-cs-fixer": "^3.8", + "mantle-framework/testkit": "^0.9", + "szepeviktor/phpstan-wordpress": "^1.1" + }, + "autoload-dev": { + "psr-4": { + "Alley\\": "tests/alley/" + } + }, + "extra": { + "wordpress-autoloader": { + "autoload": { + "Alley\\": "src/alley/" + }, + "autoload-dev": { + "Alley\\": "tests/alley/" + } + } + }, + "scripts": { + "fixer": "php-cs-fixer -v fix --allow-risky=yes", + "phpcbf": "phpcbf", + "phpcs": "phpcs", + "phpstan": "phpstan --memory-limit=512M", + "phpunit": "phpunit" + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/docs/feature.md b/vendor/alleyinteractive/wp-type-extensions/docs/feature.md new file mode 100644 index 00000000..6d4a38c1 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/docs/feature.md @@ -0,0 +1,53 @@ +# Feature interface + +The `Feature` interface describes a project feature. Features can be large or small, although smaller features can take advantage of decorators more easily. Use the `boot()` method to add actions and filters. Group related features with the `Features` class. + +## Definition + +```php +interface Feature { + public function boot(): void; +} +``` + +## Bundled implementations + +- [Conditional_Feature](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/features/class-conditional-feature.php): Boot a feature only when a condition is met. +- [Group](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/features/class-group.php): Group related features. +- [GTM_Script](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/features/class-gtm-script.php): Add the standard Google Tag Manager script and data layer. +- [Lazy_Feature](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/features/class-lazy-feature.php): Instantiate a feature only when called upon. +- [Quick_Feature](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/features/class-quick-feature.php): Make a callable a feature. +- [Template_Feature](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/features/class-template-feature.php): Boot a feature only when templates load. +- [WP_CLI_Feature](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/features/class-wp-cli-feature.php): Boot a feature only WP-CLI loads. + +## Basic usage + +```php +use Alley\WP\Features\Group; +use Alley\WP\Features\Quick_Feature; +use Alley\WP\Features\Template_Feature; + +$queries = new Project\Post_Queries_Implementation( + /* ... */ +); + +$project = new Group( + new Group( + new Project\Ads_Backend_Feature(), + new Template_Feature( + origin: new Project\Ads_Frontend_Feature(), + ), + ), + new Project\Other_Feature( + queries: $queries, + ), + new Quick_Feature( + function () { + remove_action( /* ... */ ); + remove_filter( /* ... */ ); + }, + ) +); + +$project->boot(); +``` diff --git a/vendor/alleyinteractive/wp-type-extensions/docs/post-ids.md b/vendor/alleyinteractive/wp-type-extensions/docs/post-ids.md new file mode 100644 index 00000000..ba8c282f --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/docs/post-ids.md @@ -0,0 +1,21 @@ +# Post IDs interface + +The `Post_IDs` interface describes an object containing post IDs, such as the IDs in a query or a curated set of featured posts. + +## Definition + +```php +interface Post_IDs { + public function post_ids(): array; +} +``` + +## Bundled implementations + +- [Empty_Post_IDs](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/post-ids/class-empty-post-ids.php): No post IDs. +- [Post_IDs_Envelope](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/post-ids/class-post-ids-envelope.php): Instance from an existing set of IDs. +- [Post_IDs_Once](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/post-ids/class-post-ids-once.php): Always returns the same set of IDs from the original instance. +- [Used_Post_IDs](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/post-ids/class-used-post-ids.php): Track post IDs that have been used, e.g. while rendering a page. +- [WP_Query_Post_IDs](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/post-ids/class-wp-query-post-ids.php): The post IDs from a `WP_Query`. + +All `Post_Query` implementations also implement `Post_IDs`. diff --git a/vendor/alleyinteractive/wp-type-extensions/docs/post-queries.md b/vendor/alleyinteractive/wp-type-extensions/docs/post-queries.md new file mode 100644 index 00000000..4737c0da --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/docs/post-queries.md @@ -0,0 +1,20 @@ +# Post Queries interface + +The `Post_Queries` interface describes an object that contains queries for posts. + +## Definition + +```php +interface Post_Queries { + public function query( array $args ): Post_Query; +} +``` + +## Bundled implementations + +- [Default_Post_Queries](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/post-queries/class-default-post-queries.php): Queries implementation for most cases. +- [Enforced_Date_Queries](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/post-queries/class-enforced-date-queries.php): Queries that enforce a date query. +- [Exclude_Queries](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/post-queries/class-exclude-queries.php): Queries that exclude some posts. +- [Memoized_Post_Queries](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/post-queries/class-memoized-post-queries.php): Reuse queries given the same arguments. +- [Optimistic_Date_Queries](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/post-queries/class-optimistic-date-queries.php): Speculate (but don't require) that queries can be limited to posts published after the given dates. +- [Variable_Post_Queries](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/post-queries/class-variable-post-queries.php): Choose queries based on the result of a validation test. diff --git a/vendor/alleyinteractive/wp-type-extensions/docs/post-query.md b/vendor/alleyinteractive/wp-type-extensions/docs/post-query.md new file mode 100644 index 00000000..9921a93f --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/docs/post-query.md @@ -0,0 +1,19 @@ +# Post Query interface + +The `Post_Query` interface describes an object that contains a single query for posts. + +## Definition + +```php +interface Post_Query extends Post_IDs { + public function query_object(): WP_Query; + + public function post_objects(): array; +} +``` + +## Bundled implementations + +- [Global_Post_Query](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/post-query/class-global-post-query.php): Post_Query for a query in `$GLOBALS`. +- [Post_IDs_Query](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/post-query/class-post-ids-query.php): Query from post IDs. +- [WP_Query_Envelope](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/post-query/class-wp-query-envelope.php): Post_Query from an existing query. diff --git a/vendor/alleyinteractive/wp-type-extensions/docs/serialized-blocks.md b/vendor/alleyinteractive/wp-type-extensions/docs/serialized-blocks.md new file mode 100644 index 00000000..315af69c --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/docs/serialized-blocks.md @@ -0,0 +1,22 @@ +# Serialized Blocks interface + +The `Serialized_Blocks` interface describes an object containing blocks that can be serialized to block markup. Any string can be serialized to block markup via the `Block_Content` class. + +## Definition + +```php +interface Serialized_Blocks { + public function serialized_blocks(): string; +} +``` + +## Bundled implementations + +- [Blocks](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/blocks/class-blocks.php): Bundle many blocks. +- [Each_Replaced_Blocks](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/blocks/class-each-replaced-blocks.php): Replace each matched block with other block content. +- [Matched_Blocks](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/blocks/class-matched-blocks.php): Blocks matched with `match_blocks()`. +- [Block_Content](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/blocks/class-block-content.php): Blocks in the given content. +- [Lazy_Blocks](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/blocks/class-lazy-blocks.php): Instantiate blocks only when called upon. + +All `Single_Block` implementations also implement `Serialized_Blocks`. + diff --git a/vendor/alleyinteractive/wp-type-extensions/docs/single-block.md b/vendor/alleyinteractive/wp-type-extensions/docs/single-block.md new file mode 100644 index 00000000..b31a823e --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/docs/single-block.md @@ -0,0 +1,20 @@ +# Single Block interface + +The `Single_Block` interface describes an object containing a single block. + +## Definition + +```php +interface Single_Block { + public function block_name(): ?string; + + public function parsed_block(): array; +} +``` + +## Bundled implementations + +- [Named_Block](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/blocks/class-named-block.php): A single block with the given block name. +- [Parsed_Block](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/blocks/class-parsed-block.php): A single parsed block. +- [Default_Classname_Block](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/blocks/class-default-classname-block.php): Block wrapped in the block default classname. +- [Inner_Blocks_Prepended](https://github.com/alleyinteractive/wp-type-extensions/blob/main/src/alley/wp/blocks/class-inner-blocks-prepended.php): Block with prepended inner blocks. diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-block-content.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-block-content.php new file mode 100644 index 00000000..a7edbd05 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-block-content.php @@ -0,0 +1,33 @@ +content; + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-blocks.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-blocks.php new file mode 100644 index 00000000..545ea9a8 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-blocks.php @@ -0,0 +1,68 @@ +blocks = $blocks; + } + + /** + * Serialized block content. + * + * @return string + */ + public function serialized_blocks(): string { + return array_reduce( + $this->blocks, + fn ( string $carry, Serialized_Blocks $block ) => $carry .= $block->serialized_blocks(), + '', + ); + } + + /** + * Constructor for creating blocks from a set of values. + * + * @phpstan-param iterable $values + * @phpstan-param callable(Serialized_Blocks[] $carry, mixed $item, mixed $index, iterable $values): Serialized_Blocks[] $reduce + * + * @param iterable $values Values. + * @param callable $reduce Reducer callback that produces block instances. + * @return Serialized_Blocks + */ + public static function from_iterable( iterable $values, callable $reduce ): Serialized_Blocks { + return new Lazy_Blocks( + function () use ( $values, $reduce ) { + $carry = []; + + foreach ( $values as $index => $item ) { + $carry = ( $reduce )( $carry, $item, $index, $values ); + } + + return new Blocks( ...$carry ); + } + ); + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-default-classname-block.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-default-classname-block.php new file mode 100644 index 00000000..e8c2f2a9 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-default-classname-block.php @@ -0,0 +1,65 @@ +origin->block_name(); + } + + /** + * Parsed block. + * + * @return mixed[] + */ + public function parsed_block(): array { + $out = $this->origin->parsed_block(); + + $before = sprintf( + '<%s class="%s">', + tag_escape( $this->element ), + wp_get_block_default_classname( (string) $this->block_name() ), + ); + $after = sprintf( '', tag_escape( $this->element ) ); + + $out['innerHTML'] = $before . $out['innerHTML'] . $after; + $out['innerContent'] = [ $before, ...$out['innerContent'], $after ]; + + return $out; + } + + /** + * Serialized block content. + * + * @return string + */ + public function serialized_blocks(): string { + return serialize_block( $this->parsed_block() ); + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-each-replaced-blocks.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-each-replaced-blocks.php new file mode 100644 index 00000000..f9b66ff9 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-each-replaced-blocks.php @@ -0,0 +1,50 @@ +origin->serialized_blocks(); + + $needles = parse_blocks( $this->find->serialized_blocks() ); + + if ( \is_array( $needles ) && count( $needles ) > 0 ) { + foreach ( $needles as $needle ) { + if ( \is_array( $needle ) ) { + $pbn = new Parsed_Block( $needle ); + $out = str_replace( $pbn->serialized_blocks(), $this->replace->serialized_blocks(), $out ); + } + } + } + + return $out; + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-inner-blocks-prepended.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-inner-blocks-prepended.php new file mode 100644 index 00000000..183a1918 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-inner-blocks-prepended.php @@ -0,0 +1,71 @@ +target->block_name(); + } + + /** + * Parsed block. + * + * @return mixed[] + */ + public function parsed_block(): array { + $out = $this->target->parsed_block(); + $add = parse_blocks( $this->block->serialized_blocks() ); + + if ( + \is_array( $add ) + && isset( $out['innerBlocks'], $out['innerContent'] ) + && \is_array( $out['innerBlocks'] ) + && \is_array( $out['innerContent'] ) + ) { + $out['innerBlocks'] = array_merge( $add, $out['innerBlocks'] ); + $out['innerContent'] = array_merge( + array_fill( 0, \count( $add ), null ), + $out['innerContent'], + ); + } + + return $out; + } + + /** + * Serialized block content. + * + * @return string + */ + public function serialized_blocks(): string { + $pb = new Parsed_Block( $this->parsed_block() ); + return $pb->serialized_blocks(); + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-lazy-blocks.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-lazy-blocks.php new file mode 100644 index 00000000..f4329b4e --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-lazy-blocks.php @@ -0,0 +1,33 @@ +final )()->serialized_blocks(); + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-matched-blocks.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-matched-blocks.php new file mode 100644 index 00000000..7a8784da --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-matched-blocks.php @@ -0,0 +1,39 @@ + $args Args for {@see match_blocks()}. + * @param Serialized_Blocks $origin Blocks to search. + */ + public function __construct( + private readonly array $args, + private readonly Serialized_Blocks $origin, + ) {} + + /** + * Serialized block content. + * + * @return string + */ + public function serialized_blocks(): string { + $matched = match_blocks( $this->origin->serialized_blocks(), $this->args ); + + return \is_array( $matched ) ? serialize_blocks( $matched ) : ''; + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-named-block.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-named-block.php new file mode 100644 index 00000000..6b1c2e2c --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-named-block.php @@ -0,0 +1,61 @@ + $attrs Block attributes. + * @param string $inner_html Block inner HTML. + */ + public function __construct( + private readonly string $block_name, + private readonly array $attrs = [], + private readonly string $inner_html = '', + ) {} + + /** + * Block name. + * + * @return string + */ + public function block_name(): string { + return $this->block_name; + } + + /** + * Parsed block. + * + * @return mixed[] + */ + public function parsed_block(): array { + return [ + 'blockName' => $this->block_name, + 'attrs' => $this->attrs, + 'innerBlocks' => [], + 'innerHTML' => $this->inner_html, + 'innerContent' => [ $this->inner_html ], + ]; + } + + /** + * Serialized block content. + * + * @return string + */ + public function serialized_blocks(): string { + return serialize_block( $this->parsed_block() ); + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-parsed-block.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-parsed-block.php new file mode 100644 index 00000000..9acb4679 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/blocks/class-parsed-block.php @@ -0,0 +1,63 @@ +origin['blockName'] ) && \is_string( $this->origin['blockName'] ) ? $this->origin['blockName'] : null; + } + + /** + * Parsed block. + * + * @return mixed[] + */ + public function parsed_block(): array { + $attrs = isset( $this->origin['attrs'] ) && \is_array( $this->origin['attrs'] ) ? $this->origin['attrs'] : []; + $inner_blocks = isset( $this->origin['innerBlocks'] ) && \is_array( $this->origin['innerBlocks'] ) ? $this->origin['innerBlocks'] : []; + $inner_html = isset( $this->origin['innerHTML'] ) && \is_string( $this->origin['innerHTML'] ) ? $this->origin['innerHTML'] : ''; + $inner_content = isset( $this->origin['innerContent'] ) && \is_array( $this->origin['innerContent'] ) ? $this->origin['innerContent'] : []; + + return (array) new WP_Block_Parser_Block( + $this->block_name(), // @phpstan-ignore-line + $attrs, + $inner_blocks, + $inner_html, + $inner_content, + ); + } + + /** + * Serialized block content. + * + * @return string + */ + public function serialized_blocks(): string { + return serialize_block( $this->parsed_block() ); + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/class-legal-object-ids.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/class-legal-object-ids.php new file mode 100644 index 00000000..9eddb28a --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/class-legal-object-ids.php @@ -0,0 +1,33 @@ +origin->post_ids(), fn ( $id ) => $id > 0 ); + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/features/class-conditional-feature.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/features/class-conditional-feature.php new file mode 100644 index 00000000..3e9d82d4 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/features/class-conditional-feature.php @@ -0,0 +1,40 @@ +value ) ? ( $this->value )() : $this->value; + + if ( $this->test->isValid( $value ) ) { + $this->if_true->boot(); + } + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/features/class-group.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/features/class-group.php new file mode 100644 index 00000000..81959f26 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/features/class-group.php @@ -0,0 +1,40 @@ +features = $features; + } + + /** + * Boot the feature. + */ + public function boot(): void { + foreach ( $this->features as $feature ) { + $feature->boot(); + } + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/features/class-gtm-script.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/features/class-gtm-script.php new file mode 100644 index 00000000..b996700d --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/features/class-gtm-script.php @@ -0,0 +1,81 @@ + $data_layer + * + * @param string $tag_id GTM tag ID. + * @param array|stdClass|JsonSerializable $data_layer Initial data layer data. + */ + public function __construct( + private readonly string $tag_id, + private readonly array|stdClass|JsonSerializable $data_layer, + ) {} + + /** + * Boot the feature. + */ + public function boot(): void { + add_action( 'wp_head', [ $this, 'render_head' ] ); + add_action( 'wp_body_open', [ $this, 'render_body' ] ); + } + + /** + * Render the GTM tag in the document body. + */ + public function render_head(): void { + $data = $this->data_layer instanceof JsonSerializable ? $this->data_layer : (object) $this->data_layer; + $flags = WP_DEBUG ? JSON_PRETTY_PRINT : 0; + + printf( + <<<'HTML' + + + + + +HTML, + wp_json_encode( $data, $flags ), + wp_json_encode( $this->tag_id, $flags ), + ); + } + + /** + * Render the GTM tag in the document body. + */ + public function render_body(): void { + printf( + <<<'HTML' + + + +HTML, + esc_url( "https://www.googletagmanager.com/ns.html?id={$this->tag_id}" ), + ); + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/features/class-lazy-feature.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/features/class-lazy-feature.php new file mode 100644 index 00000000..5d06aeec --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/features/class-lazy-feature.php @@ -0,0 +1,31 @@ +final )()->boot(); + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/features/class-quick-feature.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/features/class-quick-feature.php new file mode 100644 index 00000000..8aead9c7 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/features/class-quick-feature.php @@ -0,0 +1,31 @@ +fn )(); + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/features/class-template-feature.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/features/class-template-feature.php new file mode 100644 index 00000000..93489df7 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/features/class-template-feature.php @@ -0,0 +1,31 @@ +origin, 'boot' ] ); + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/features/class-wp-cli-feature.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/features/class-wp-cli-feature.php new file mode 100644 index 00000000..127c5013 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/features/class-wp-cli-feature.php @@ -0,0 +1,42 @@ +origin, 'boot' ] ); + } elseif ( class_exists( 'WP_CLI' ) ) { + /* + * This is being invoked in a WP-CLI package or in a similar context where + * WordPress hasn't yet been loaded. + * + * @see https://github.com/buddypress/wp-cli-buddypress/issues/18 + */ + WP_CLI::add_hook( 'before_wp_load', [ $this->origin, 'boot' ] ); + } + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-ids/class-empty-post-ids.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-ids/class-empty-post-ids.php new file mode 100644 index 00000000..62e4b162 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-ids/class-empty-post-ids.php @@ -0,0 +1,24 @@ +post_ids ); + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-ids/class-post-ids-once.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-ids/class-post-ids-once.php new file mode 100644 index 00000000..6a807e67 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-ids/class-post-ids-once.php @@ -0,0 +1,33 @@ +origin, 'post_ids' ] ); + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-ids/class-used-post-ids.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-ids/class-used-post-ids.php new file mode 100644 index 00000000..9f92187c --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-ids/class-used-post-ids.php @@ -0,0 +1,57 @@ + + */ + private array $ids = []; + + /** + * Set up. + * + * @param Post_IDs $seed Initial post IDs. + */ + public function __construct( + private readonly Post_IDs $seed = new Empty_Post_IDs() + ) {} + + /** + * Post IDs. + * + * @return int[] + */ + public function post_ids(): array { + return array_merge( array_keys( $this->ids ), $this->seed->post_ids() ); + } + + /** + * Record used post IDs. + * + * @param int|int[] $post_ids Post ID or IDs. + */ + public function record( int|array $post_ids ): void { + if ( \is_int( $post_ids ) ) { + $post_ids = [ $post_ids ]; + } + + foreach ( $post_ids as $post_id ) { + if ( \is_int( $post_id ) ) { + $this->ids[ $post_id ] = true; + } + } + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-ids/class-wp-query-post-ids.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-ids/class-wp-query-post-ids.php new file mode 100644 index 00000000..e5d2f4a0 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-ids/class-wp-query-post-ids.php @@ -0,0 +1,67 @@ +query->posts ) ) { + $ids = array_map( [ self::class, 'to_post_id' ], $this->query->posts ); + } + + return $ids; + } + + /** + * Get the ID from a post object, ID, or ID-parent object. + * + * @param WP_Post|int|object $value Post-like object or ID. + * @return int Post ID. + */ + private static function to_post_id( $value ): int { + $id = 0; + + if ( $value instanceof WP_Post ) { + $id = $value->ID; + } + + // fields => 'ids'. + if ( is_numeric( $value ) ) { + $id = $value; + } + + // fields => 'id=>parent'. + if ( ( $value instanceof \stdClass ) && isset( $value->ID ) ) { + $id = $value->ID; + } + + return (int) $id; + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-queries/class-default-post-queries.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-queries/class-default-post-queries.php new file mode 100644 index 00000000..ee99de3e --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-queries/class-default-post-queries.php @@ -0,0 +1,28 @@ + $args The arguments to be used in the query. + * @return Post_Query + */ + public function query( array $args ): Post_Query { + return new WP_Query_Envelope( new WP_Query( $args ) ); + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-queries/class-enforced-date-queries.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-queries/class-enforced-date-queries.php new file mode 100644 index 00000000..3f4096d0 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-queries/class-enforced-date-queries.php @@ -0,0 +1,64 @@ + $args The arguments to be used in the query. + * @return Post_Query + */ + public function query( array $args ): Post_Query { + $with_date_query = $this->with_date_query( $args, $this->after ); + + return $this->origin->query( $with_date_query ); + } + + /** + * Add 'after' date query with the given date. + * + * @param array $args Query arguments. + * @param DateTimeInterface $after Date instance. + * @return array + */ + private function with_date_query( array $args, DateTimeInterface $after ): array { + if ( ! isset( $args['date_query'] ) || ! \is_array( $args['date_query'] ) ) { + $args['date_query'] = []; + } + + $args['date_query']['relation'] = 'AND'; + $args['date_query'][] = [ + 'after' => [ + 'year' => $after->format( 'Y' ), + 'month' => $after->format( 'n' ), + 'day' => $after->format( 'j' ), + ], + ]; + + return $args; + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-queries/class-exclude-queries.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-queries/class-exclude-queries.php new file mode 100644 index 00000000..f37545ec --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-queries/class-exclude-queries.php @@ -0,0 +1,58 @@ + $args The arguments to be used in the query. + * @return Post_Query + */ + public function query( array $args ): Post_Query { + $excluded_post_ids = $this->exclude->post_ids(); + $expected_per_page = $this->default_per_page; + + if ( isset( $args['posts_per_page'] ) && is_numeric( $args['posts_per_page'] ) ) { + $expected_per_page = (int) $args['posts_per_page']; + } + + // Ask for the number of posts we expect to return, plus the number of posts to exclude. + $args['posts_per_page'] = $expected_per_page + \count( $excluded_post_ids ); + $overfetched_query = $this->origin->query( $args ); + + // Remove the excluded from the overfetched query. + $diff_post_ids = array_diff( $overfetched_query->post_ids(), $excluded_post_ids ); + + // Slice the number of posts we expect to return from the overfetched query. + $per_page_post_ids = \array_slice( $diff_post_ids, 0, $expected_per_page ); + + return new Post_IDs_Query( $per_page_post_ids ); + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-queries/class-memoized-post-queries.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-queries/class-memoized-post-queries.php new file mode 100644 index 00000000..f36d9301 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-queries/class-memoized-post-queries.php @@ -0,0 +1,35 @@ + $args The arguments to be used in the query. + * @return Post_Query + */ + public function query( array $args ): Post_Query { + return once( fn () => $this->origin->query( $args ) ); + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-queries/class-optimistic-date-queries.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-queries/class-optimistic-date-queries.php new file mode 100644 index 00000000..bfc9b719 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-queries/class-optimistic-date-queries.php @@ -0,0 +1,58 @@ +after, fn ( $a, $b ) => $b <=> $a ); + } + + /** + * Query for posts using literal arguments. + * + * @param array $args The arguments to be used in the query. + * @return Post_Query + */ + public function query( array $args ): Post_Query { + $expected_count = $this->posts_per_page; + + if ( isset( $args['posts_per_page'] ) && is_numeric( $args['posts_per_page'] ) ) { + $expected_count = (int) $args['posts_per_page']; + } + + foreach ( $this->after as $after ) { + $with_date_query = new Enforced_Date_Queries( $after, $this->origin ); + $result = $with_date_query->query( $args ); + + if ( \count( $result->post_ids() ) === $expected_count ) { + return $result; + } + } + + return $this->origin->query( $args ); + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-queries/class-variable-post-queries.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-queries/class-variable-post-queries.php new file mode 100644 index 00000000..827ff7f5 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-queries/class-variable-post-queries.php @@ -0,0 +1,51 @@ + $args The arguments to be used in the query. + * @return Post_Query + */ + public function query( array $args ): Post_Query { + return $this->final()->query( $args ); + } + + /** + * Post_Queries instance to use. + * + * @return Post_Queries + */ + private function final(): Post_Queries { + return $this->test->isValid( ( $this->input )() ) ? $this->is_true : $this->is_false; + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-query/class-global-post-query.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-query/class-global-post-query.php new file mode 100644 index 00000000..335139a0 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-query/class-global-post-query.php @@ -0,0 +1,61 @@ +global ] ) && $GLOBALS[ $this->global ] instanceof WP_Query + ? $GLOBALS[ $this->global ] + : $this->default; + } + + /** + * Found post objects. + * + * @return WP_Post[] + */ + public function post_objects(): array { + $query = new WP_Query_Envelope( $this->query_object() ); + + return $query->post_objects(); + } + + /** + * Found post IDs. + * + * @return int[] + */ + public function post_ids(): array { + $query = new WP_Query_Envelope( $this->query_object() ); + + return $query->post_ids(); + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-query/class-post-ids-query.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-query/class-post-ids-query.php new file mode 100644 index 00000000..9e28dbc7 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-query/class-post-ids-query.php @@ -0,0 +1,70 @@ +posts = $this->post_ids(); + + // Fill in other properties to make it look more like an executed query. + $count = \count( $query->posts ); + $query->found_posts = $count; + $query->post_count = $count; + $query->max_num_pages = 1; + $query->set( 'fields', 'ids' ); + + return $query; + } + + /** + * Found post objects. + * + * @return WP_Post[] + */ + public function post_objects(): array { + $post_ids = $this->post_ids(); + + _prime_post_caches( $post_ids, false, false ); + + $posts = array_map( 'get_post', $post_ids ); + $posts = array_filter( $posts, fn ( $p ) => $p instanceof WP_Post ); + + return $posts; + } + + /** + * Found post IDs. + * + * @return int[] + */ + public function post_ids(): array { + return array_map( 'intval', $this->post_ids ); + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-query/class-wp-query-envelope.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-query/class-wp-query-envelope.php new file mode 100644 index 00000000..8c043e61 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/post-query/class-wp-query-envelope.php @@ -0,0 +1,59 @@ +query; + } + + /** + * Found post objects. + * + * @return WP_Post[] + */ + public function post_objects(): array { + $posts = array_map( 'get_post', $this->post_ids() ); + $posts = array_filter( $posts, fn ( $p ) => $p instanceof WP_Post ); + + return $posts; + } + + /** + * Found post IDs. + * + * @return int[] + */ + public function post_ids(): array { + $ids = new WP_Query_Post_IDs( $this->query_object() ); + + return $ids->post_ids(); + } +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/types/interface-feature.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/types/interface-feature.php new file mode 100644 index 00000000..10f76cf1 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/types/interface-feature.php @@ -0,0 +1,18 @@ + $args Query arguments. + * @return Post_Query + */ + public function query( array $args ): Post_Query; +} diff --git a/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/types/interface-post-query.php b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/types/interface-post-query.php new file mode 100644 index 00000000..6e5c8138 --- /dev/null +++ b/vendor/alleyinteractive/wp-type-extensions/src/alley/wp/types/interface-post-query.php @@ -0,0 +1,30 @@ += 8.1. + * [#746](https://github.com/Automattic/VIP-Coding-Standards/pull/746): Fix checks for PHP 8.1 and above. + * [#737](https://github.com/Automattic/VIP-Coding-Standards/pull/737): AdminBarRemovalUnitTest: Ensure final reset is read. +- Coding Standards + * [#733](https://github.com/Automattic/VIP-Coding-Standards/pull/733): Fix coding standards of VIPCS sniffs. + * [#756](https://github.com/Automattic/VIP-Coding-Standards/pull/756): Remove extra line at end of classes. + * [#758](https://github.com/Automattic/VIP-Coding-Standards/pull/758): Simplifications of sniffs extending the WPCS AbstractArrayAssignmentRestrictionsSniff. + * [#761](https://github.com/Automattic/VIP-Coding-Standards/pull/761): RegexpCompare: remove redundant condition. + * [#771](https://github.com/Automattic/VIP-Coding-Standards/pull/771): QA: fix condition order. +- CI: + * [#705](https://github.com/Automattic/VIP-Coding-Standards/pull/705): Various updates. + * [#750](https://github.com/Automattic/VIP-Coding-Standards/pull/750): Test Higher PHP versions. + * [#724](https://github.com/Automattic/VIP-Coding-Standards/pull/724): Fix use of deprecated `set-output`. + * [#725](https://github.com/Automattic/VIP-Coding-Standards/pull/725): Update the xmllint-problem-matcher. + * [#726](https://github.com/Automattic/VIP-Coding-Standards/pull/726): Various tweaks. + * [#728](https://github.com/Automattic/VIP-Coding-Standards/pull/728): Bust the cache semi-regularly. + * [#711](https://github.com/Automattic/VIP-Coding-Standards/pull/711): Version update for various predefined actions. + * [#712](https://github.com/Automattic/VIP-Coding-Standards/pull/712): Fix build failure. + * [#755](https://github.com/Automattic/VIP-Coding-Standards/pull/755): Validate the PHPCS installed standards. + * [#757](https://github.com/Automattic/VIP-Coding-Standards/pull/757): Test and Quicktest tweaks. + * [#767](https://github.com/Automattic/VIP-Coding-Standards/pull/767): Minor simplifications. + * [#769](https://github.com/Automattic/VIP-Coding-Standards/pull/769): .gitattributes: readability improvement. +- Docs: + * [#722](https://github.com/Automattic/VIP-Coding-Standards/pull/722): Updated Docs link for `ORDER BY RAND()`. + * [#707](https://github.com/Automattic/VIP-Coding-Standards/pull/707): README: update requirements listing. + * [#706](https://github.com/Automattic/VIP-Coding-Standards/pull/706): README: update for Composer 2.2. + * [#766](https://github.com/Automattic/VIP-Coding-Standards/pull/766): Various minor doc fixes. + * [#759](https://github.com/Automattic/VIP-Coding-Standards/pull/759): Bug template: make version table more comprehensive. + * [#770](https://github.com/Automattic/VIP-Coding-Standards/pull/770): Docs: various tag improvements. + +### Deprecated +* [#612](https://github.com/Automattic/VIP-Coding-Standards/pull/612): The `WordPressVIPMinimum.Compatibility.Zoninator` sniff is (soft) deprecated and will be removed in the 3.0.0 release. +* [#613](https://github.com/Automattic/VIP-Coding-Standards/pull/613): The `WordPressVIPMinimum.Performance.BatcacheWhitelistedParams` sniff is (soft) deprecated and will be removed in the 3.0.0 release. + + +## [2.3.3] - 2021-09-29 + +Props: gudmdharalds, jrfnl, BrookeDot, rebeccahum + +## Changed +- [#690](https://github.com/Automattic/VIP-Coding-Standards/pull/690): Ruleset: do not flag undefined variables in file scope or unused variables before require statement. +- [#691](https://github.com/Automattic/VIP-Coding-Standards/pull/691): Composer: use VariableAnalysis 2.11.1. +- [#694](https://github.com/Automattic/VIP-Coding-Standards/pull/694): PHPCS: enable caching for quicker scanning. +- [#697](https://github.com/Automattic/VIP-Coding-Standards/pull/697): ProperEscapingFunction: upgrade htmlAttrNotByEscHTML to default severity level. + +## Removed +- [#692](https://github.com/Automattic/VIP-Coding-Standards/pull/692): RestrictedFunctions: remove dbDelta group. + +## [2.3.2] - 2021-04-28 + +Props: jrfnl + +### Fixed +- [#681](https://github.com/Automattic/VIP-Coding-Standards/pull/681): ProperEscapingFunction: improve attribute matching accuracy for notAttrEscAttr. + +## [2.3.1] - 2021-04-23 + +Props: jrfnl + +### Fixed +- [#668](https://github.com/Automattic/VIP-Coding-Standards/pull/668): ProperEscapingFunction: fix overreach of comma usage in non-echo expressions for notAttrEscAttr. +- [#670](https://github.com/Automattic/VIP-Coding-Standards/pull/670): ProperEscapingFunction: improve "action" match precision for hrefSrcEscUrl. + +### Deprecated +- [#670](https://github.com/Automattic/VIP-Coding-Standards/pull/670): ProperEscapingFunction: private properties `$url_attrs` and `$attr_endings` are deprecated along with the public methods `is_html_attr()` and `attr_expects_url()`. + +## [2.3.0] - 2021-04-19 + +Props: jrfnl, rebeccahum, kevinfodness, GaryJones. + +** There is a minor breaking change in the ProperEscapingFunction sniff from PR [#624](https://github.com/Automattic/VIP-Coding-Standards/pull/624). The `escaping_function` property can no longer be overruled via custom rulesets. Please remove any usages of the property in custom rulesets. + +** Composer now requires the [phpcodesniffer-composer-installer](https://github.com/PHPCSStandards/composer-installer) plugin per [#583](https://github.com/Automattic/VIP-Coding-Standards/pull/583). Note: If you either include it in the "require-dev" of your `composer.json`, use another Composer PHPCS plugin, or run bash commands to register PHPCS standards, please remove it from those sources to prevent interferences or version constraint conflicts. + +### Added +- [#581](https://github.com/Automattic/VIP-Coding-Standards/pull/581): AlwaysReturnInFilter: flag abstract methods for manual inspection. +- [#583](https://github.com/Automattic/VIP-Coding-Standards/pull/583): Composer: require phpcs-composer-installer plugin. +- [#586](https://github.com/Automattic/VIP-Coding-Standards/pull/586): IncludingNonPHPFile: recognition of .phar file extensions. +- [#589](https://github.com/Automattic/VIP-Coding-Standards/pull/589): WPQueryParams: flags 'exclude' array key. +- [#595](https://github.com/Automattic/VIP-Coding-Standards/pull/595): Underscorejs: checks for additional print syntaxes and now throws an additional error for each occurrence of unescaped notation. +- [#624](https://github.com/Automattic/VIP-Coding-Standards/pull/624): ProperEscapingFunction: account for additional escaping functions and check for `esc_attr()` usage in non-HTML attributes. +- [#638](https://github.com/Automattic/VIP-Coding-Standards/pull/638): IncludingFile: new public property `$allowedKeywords` for allowing custom partial keywords in constants to reduce false positives. + +### Changed +- [#586](https://github.com/Automattic/VIP-Coding-Standards/pull/586): IncludingNonPHPFile: various performance improvements. +- [#587](https://github.com/Automattic/VIP-Coding-Standards/pull/587): LowExpiryCacheTime: new warning added for manual inspection along with various improvements. +- [#592](https://github.com/Automattic/VIP-Coding-Standards/pull/592): DynamicCalls: various improvements. +- [#595](https://github.com/Automattic/VIP-Coding-Standards/pull/595): Underscorejs: various improvements. +- [#618](https://github.com/Automattic/VIP-Coding-Standards/pull/618): RestrictedFunctions: upgrade setcookie() to error at sniff level and remove Batcache references from messaging. +- [#620](https://github.com/Automattic/VIP-Coding-Standards/pull/620): Ruleset: silence UnusedVariable from VariableAnalysis to reduce noise. +- [#630](https://github.com/Automattic/VIP-Coding-Standards/pull/630): VariableAnalysis: fix incompatibility for VariableAnalysis standard with previously deprecated native VIPCS sniff. +- [#639](https://github.com/Automattic/VIP-Coding-Standards/pull/639): RestrictedFunctions: remove site_option group. +- [#644](https://github.com/Automattic/VIP-Coding-Standards/pull/644): RestrictedFunctions: remove wp_cache_get_multi group. +- [#645](https://github.com/Automattic/VIP-Coding-Standards/pull/645): Ruleset: silence WordPress.WP.AlternativeFunctions.file_system_read_readfile. +- [#646](https://github.com/Automattic/VIP-Coding-Standards/pull/646): Ruleset: silence WordPress.WP.AlternativeFunctions.file_system_read_fclose. +- [#647](https://github.com/Automattic/VIP-Coding-Standards/pull/647): RestrictedFunctions: remove get_super_admins group. +- [#649](https://github.com/Automattic/VIP-Coding-Standards/pull/649): RestrictedFunctions: downgrade switch_to_blog() to warning and change messaging. +- [#652](https://github.com/Automattic/VIP-Coding-Standards/pull/652): RestrictedFunctions/RestrictedVariables: remove usermeta related errors. + +### Fixed +- [#444](https://github.com/Automattic/VIP-Coding-Standards/pull/444): ConstantString: only error when a plain constant is passed as constant name parameter. +- [#581](https://github.com/Automattic/VIP-Coding-Standards/pull/581): AlwaysReturnInFilter: fix runtime failure on abstract methods. +- [#584](https://github.com/Automattic/VIP-Coding-Standards/pull/584): Performance: more selective sniffing for efficiency. +- [#586](https://github.com/Automattic/VIP-Coding-Standards/pull/586): IncludingNonPHPFile: various bug fixes such as recognition of interpolated strings and case insensitivity in file extensions. +- [#587](https://github.com/Automattic/VIP-Coding-Standards/pull/587): LowExpiryCacheTime: allow arithmetic operators, simple floats, numerical strings, zeroes and parentheses in calculations, and FQN time constants. +- [#592](https://github.com/Automattic/VIP-Coding-Standards/pull/592): DynamicCalls: ignore comments, allow double quotes and remove potential memory leak. +- [#595](https://github.com/Automattic/VIP-Coding-Standards/pull/595): Underscorejs: fixed false positive for when a variable is `_.escape()`-ed. +- [#624](https://github.com/Automattic/VIP-Coding-Standards/pull/624): ProperEscapingFunction: slash escaped quotes and non-quoted strings in HTML attributes are now parsed as expected. + +### Removed +- [#624](https://github.com/Automattic/VIP-Coding-Standards/pull/624): ProperEscapingFunction: remove `$escaping_functions` public property. + +### Maintenance +- [#582](https://github.com/Automattic/VIP-Coding-Standards/pull/582): CI: re-try composer install on failure. +- [#599](https://github.com/Automattic/VIP-Coding-Standards/pull/599): CI: add build against PHP 8. +- [#606](https://github.com/Automattic/VIP-Coding-Standards/pull/606): Ruleset: remove redundant rule ref. +- [#607](https://github.com/Automattic/VIP-Coding-Standards/pull/607): Ruleset: remove redundant rule ref. +- [#608](https://github.com/Automattic/VIP-Coding-Standards/pull/608): Ruleset: remove duplicate rule ref. +- [#611](https://github.com/Automattic/VIP-Coding-Standards/pull/611): Ruleset: remove redundant notice type declaration. +- [#617](https://github.com/Automattic/VIP-Coding-Standards/pull/617): Ruleset: remove redundant notice type declaration. +- [#619](https://github.com/Automattic/VIP-Coding-Standards/pull/619): Docs: Update links to wpvip.com. +- [#631](https://github.com/Automattic/VIP-Coding-Standards/pull/631): QA: remove unused use statements. +- [#632](https://github.com/Automattic/VIP-Coding-Standards/pull/632): Docs: various minor improvements (typos, alignment and code examples). +- [#633](https://github.com/Automattic/VIP-Coding-Standards/pull/633): CI: switch to GitHub Actions. +- [#635](https://github.com/Automattic/VIP-Coding-Standards/pull/635): Ruleset: remove redundant rule ref. +- [#653](https://github.com/Automattic/VIP-Coding-Standards/pull/653): CI: use parallel linting of PHP files. +- [#655](https://github.com/Automattic/VIP-Coding-Standards/pull/655): QA: remove redundant ignore annotations. +- [#656](https://github.com/Automattic/VIP-Coding-Standards/pull/656): CI: always check that sniffs are feature complete. +- [#657](https://github.com/Automattic/VIP-Coding-Standards/pull/657): CI: add "quicktest" stage for non-PR/merge builds. +- [#658](https://github.com/Automattic/VIP-Coding-Standards/pull/658): Release template: add checkbox for dependency check. + +## [2.2.0] - 2020-09-09 + +Props: GaryJones, jrfnl, rebeccahum. + +Technically, there's a breaking change due to the use of the VariableAnalysis package over the previous sniff. If you have `WordPressVIPMinimum.Variables.Variables` references in your PHPCS config file or in inline ignore comments, then these will need to be updated to `VariableAnalysis.CodeAnalysis.VariableAnalysis`. + +### Added +- [#494](https://github.com/Automattic/VIP-Coding-Standards/pull/494): `.gitattributes` file. +- [#495](https://github.com/Automattic/VIP-Coding-Standards/pull/495): `CODEOWNERS` file. +- [#450](https://github.com/Automattic/VIP-Coding-Standards/pull/450): [VariableAnalysis](https://github.com/sirbrillig/phpcs-variable-analysis/) package. +- [#560](https://github.com/Automattic/VIP-Coding-Standards/pull/560): Allow checking test code coverage. +- [#579](https://github.com/Automattic/VIP-Coding-Standards/pull/560): Docs: Add comparisons and props to change log for old versions. + +### Changed +- [#500](https://github.com/Automattic/VIP-Coding-Standards/pull/500): Travis: change from "trusty" to "xenial". +- [#501](https://github.com/Automattic/VIP-Coding-Standards/pull/501): Move and improve `CONTRIBUTING.md`. +- [#502](https://github.com/Automattic/VIP-Coding-Standards/pull/502): CS Ruleset: minor tweaks. +- [#508](https://github.com/Automattic/VIP-Coding-Standards/pull/508): RulesetTest: don't use the system default version of PHP. +- [#558](https://github.com/Automattic/VIP-Coding-Standards/pull/558): Test bootstrap: various minor tweaks. +- [#571](https://github.com/Automattic/VIP-Coding-Standards/pull/571): CS: change yoda conditions to non-yoda. +- [#573](https://github.com/Automattic/VIP-Coding-Standards/pull/573): Composer: Change minimum stability to stable. + +### Fixed +- [#503](https://github.com/Automattic/VIP-Coding-Standards/pull/503): RulesetTest, fix compatibility with Windows. +- [#504](https://github.com/Automattic/VIP-Coding-Standards/pull/504): RulesetTest: fail the build on failing ruleset tests, fix the failing ruleset test, and fix the test script to handle 0 values. +- [#505](https://github.com/Automattic/VIP-Coding-Standards/pull/505): DeclarationCompatibility: fix incorrect signature check for `Walker::walk()`. +- [#509](https://github.com/Automattic/VIP-Coding-Standards/pull/509): RulesetTest: Revert #485 and fix one of the three causes properly. +- [#559](https://github.com/Automattic/VIP-Coding-Standards/pull/559): Variables/RestrictedVariables: fix namespace of unit test file, fix the test. +- [#561](https://github.com/Automattic/VIP-Coding-Standards/pull/561): Functions/RestrictedFunctions: fix false positive on class instantiation. +- [#563](https://github.com/Automattic/VIP-Coding-Standards/pull/563): Hooks/AlwaysReturnInFilter: add support for hook-ins using short arrays. +- [#564](https://github.com/Automattic/VIP-Coding-Standards/pull/564): Hooks/PreGetPosts: add support for hook-ins using short arrays. +- [#565](https://github.com/Automattic/VIP-Coding-Standards/pull/565): PreGetPosts: improve the `isEarlyMainQueryCheck()` method. +- [#566](https://github.com/Automattic/VIP-Coding-Standards/pull/566): RestrictedFunctions: fix false negative - functions in `config_settings` would never match. +- [#569](https://github.com/Automattic/VIP-Coding-Standards/pull/569): RestrictedVariables: don't report on "use" in `isset()`. +- [#575](https://github.com/Automattic/VIP-Coding-Standards/pull/575): ProperEscaping: Fix message for action attribute. +- [#576](https://github.com/Automattic/VIP-Coding-Standards/pull/576): Docs: Update notes for releasing. + +### Deprecated +- [#450](https://github.com/Automattic/VIP-Coding-Standards/pull/450): Deprecate Variables/VariableAnalysisSniff. Will be removed in the next major release. + +## [2.1.0] - 2020-07-07 + +Bumps requirements to PHPCS 3.5.5+ and WPCS 2.3.0+. + +Props: GaryJones, jenkoian, kevinfodness, rebeccahum. + +### Added +- `get_page_by_path()` restricted function warning, to suggest `wpcom_vip_get_page_by_path()` function. +- `stats_get_csv()` restricted function error, since this is a Jetpack-only function. +- Expanded list of HTMLExecutingFunctions to include `after`, `appendTo`, `before`, `insertAfter`, `insertBefore`, `prepend`, `prependTo`, `replaceAll` and `replaceWith`. +- Support PHP 5.4+ (down from 5.6+). +- PHP 8 nightly testing. + +### Changed +- Expand message for `wp_remote_get()` usage. +- Downgrade `append()` usage violation from Error to Warning for VIP Go, to be consistent with the other HTMLExecutingFunctions. +- Downgrade AdminBarRemoval sniff from Error to Warning for VIP Go. +- Add `get_parent_theme_file_path()` to safelist of path functions for `WordPressVIPMinimum.Files.IncludingFile` sniff. +- Allow short array syntax and fix tests within the VIPCS own coding standards. +- Update issue templates. + +### Fixed +- Use new `WordPress.DateTime.RestrictedFunctions` sniff instead of deprecated `WordPress.WP.TimezoneChange`. +- Fixed warnings and information items in Travis. + +### Removed +- `get_super_admins()` restricted function rule for VIP Go. +- `WordPressVIPMinimum.VersionControl.MergeConflict` sniff in favour of `Generic.VersionControl.GitMergeConflict`. + +## [2.0.0] - 2019-07-12 + +This release switches from having WPCS `1.*` as a dependency, to WPCS `2.*`. It is not compatible with WPCS `1.*`. + +The sniffs in WPCS `2.*` are more accurate, so you may see new violations there weren't being reported before, and a reduction in violations for false positives. + +Props: GaryJones, hanifn, paulscreiber, rebeccahum, tomjn. + +### Added +- Switch to using WPCS `2.*`. + - Remove reference to WPCS's `PHPAliases.php`. + - Remove WPCS `1.*`'s `WordPress.VIP` references from rulesets. + - Bump PHPCS minimum required version to 3.3.1. + - Update the WPCS namespace. + - Update ruleset and ruleset test to account for WPCS 2's switch to `WordPress.PHP.IniSet` sniff. + - Update ruleset test for WPCS security sniffs. + - Update `DiscouragedPHPFunctions` group exclusion in `WordPressVIPMinimum` ruleset. + +### Changed +- Downgrade use of file operation functions from Error to Warning: + - `delete` + - `file_put_contents` + - `flock` + - `fputcsv` + - `fputs` + - `fwrite` + - `ftruncate` + - `is_writable` + - `is_writeable` + - `link` + - `rename` + - `symlink` + - `tempnam` + - `touch` + - `unlink` + - `fclose` + - `fopen` + - `file_get_contents` +- Simplify Travis config. +- Switch references from `vip.wordpress.com` to `wpvip.com`. +- Documentation updates. +- Switch development to a `git-flow` workflow. + +## Fixed +- Fixed CS violations in VIPCS code. + +## [1.0.0] - 2019-04-24 + +This release contains many breaking changes. + +It requires PHP `>= 5.6`, PHPCS `3.2.3+`, and WPCS `1.*`. It does not work with WPCS `2.*`. + +Props: GaryJones, rebeccahum, whyisjake, WPprodigy. + +### Reorganisation and Renaming +The sniffs in VIPCS have been reorganised into different categories, with new sniff names and new violation codes. The changes are detailed in the table below. If you reference any of the old violations in your custom ruleset (to change severity, type, or message), or with `// phpcs:ignore` or `// phpcs:disable`, you will need to updates these references to the new violation codes. + +| Original Violation | New Violation | +|--------------------|---------------| +| `WordPressVIPMinimum.Actions.PreGetPostSniff.PreGetPosts` | `WordPressVIPMinimum.Hooks.PreGetPosts.PreGetPosts` | +| `WordPressVIPMinimum.Cache.BatcacheWhitelistedParams.strippedGetParam` | `WordPressVIPMinimum.Performance.BatcacheWhitelistedParams.StrippedGetParam` | +| `WordPressVIPMinimum.Cache.CacheValueOverride.CacheValueOverride` | `WordPressVIPMinimum.Performance.CacheValueOverride.CacheValueOverride` | +| `WordPressVIPMinimum.Cache.LowExpiryCacheTime.LowCacheTime` | `WordPressVIPMinimum.Performance.LowExpiryCacheTime.LowCacheTime` | +| `WordPressVIPMinimum.Classes.DeclarationCompatibility.DeclarationCompatibility` | No change | +| `WordPressVIPMinimum.Classes.RestrictedExtendClasses.wp_cli_wp_cli_command` | `WordPressVIPMinimum.Classes.RestrictedExtendClasses.wp_cli` | +| `WordPressVIPMinimum.Constants.ConstantsRestrictions.ConstantRestrictions` | `WordPressVIPMinimum.Constants.RestrictedConstants.DefiningRestrictedConstant`
`WordPressVIPMinimum.Constants.RestrictedConstants.UsingRestrictedConstant` | +| `WordPressVIPMinimum.Constants.ConstantString.NotCheckingConstantName` | No change | +| `WordPressVIPMinimum.Files.IncludingFile.IncludingFile` | `WordPressVIPMinimum.Files.IncludingFile.UsingVariable`
`WordPressVIPMinimum.Files.IncludingFile.UsingCustomConstant`
`WordPressVIPMinimum.Files.IncludingFile.UsingCustomFunction`
`WordPressVIPMinimum.Files.IncludingFile.NotAbsolutePath`
`WordPressVIPMinimum.Files.IncludingFile.ExternalURL`
`WordPressVIPMinimum.Files.IncludingFile.RestrictedConstant` | +| `WordPressVIPMinimum.Files.IncludingNonPHPFile.IncludingSVGCSSFile` | `WordPressVIPMinimum.Files.IncludingNonPHPFile.IncludingSVGCSSFile` | +| `WordPressVIPMinimum.Files.IncludingNonPHPFile.IncludingNonPHPFile` | `WordPressVIPMinimum.Files.IncludingNonPHPFile.IncludingNonPHPFile` | +| `WordPressVIPMinimum.Filters.AlwaysReturn.voidReturn` | `WordPressVIPMinimum.Hooks.AlwaysReturnInFilter.VoidReturn` | +| `WordPressVIPMinimum.Filters.AlwaysReturn.missingReturnStatement` | `WordPressVIPMinimum.Hooks.AlwaysReturnInFilter.MissingReturnStatement` | +| `WordPressVIPMinimum.Filters.RestrictedHook.UploadMimes` | `WordPressVIPMinimum.Hooks.RestrictedHooks.upload_mimes_upload_mimes` | +| `WordPressVIPMinimum.Filters.RestrictedHook.HighTimeout` | `WordPressVIPMinimum.Hooks.RestrictedHooks.http_request_http_request_args`
`WordPressVIPMinimum.Hooks.RestrictedHooks.http_request_http_request_timeout` | +| `WordPressVIPMinimum.Functions.CheckReturnValue.CheckReturnValue` | `WordPressVIPMinimum.Functions.CheckReturnValue.DirectFunctionCall`
`WordPressVIPMinimum.Functions.CheckReturnValue.NonCheckedVariable` | +| `WordPressVIPMinimum.Functions.CreateFunction.CreateFunction` | `WordPressVIPMinimum.Functions.RestrictedFunctions.create_function_create_function` | +| `WordPressVIPMinimum.Functions.DynamicCalls.DynamicCalls` | No change | +| `WordPressVIPMinimum.Functions.StripTags.StripTagsOneParameter` | No change | +| `WordPressVIPMinimum.Functions.StripTags.StripTagsTwoParameters` | No change | +| `WordPressVIPMinimum.JS.DangerouslySetInnerHTML.dangerouslySetInnerHTML` | `WordPressVIPMinimum.JS.DangerouslySetInnerHTML.Found` | +| `WordPressVIPMinimum.JS.HTMLExecutingFunctions.html` | No change | +| `WordPressVIPMinimum.JS.HTMLExecutingFunctions.append` | No change | +| `WordPressVIPMinimum.JS.HTMLExecutingFunctions.write` | No change | +| `WordPressVIPMinimum.JS.HTMLExecutingFunctions.writeln` | No change | +| `WordPressVIPMinimum.JS.InnerHTML.innerHTML` | `WordPressVIPMinimum.JS.InnerHTML.Found` | +| `WordPressVIPMinimum.JS.StringConcat.StringConcatNext` | `WordPressVIPMinimum.JS.StringConcat.Found` | +| `WordPressVIPMinimum.JS.StrippingTags.VulnerableTagStripping` | No change | +| `WordPressVIPMinimum.JS.Window.VarAssignment` | No change | +| `WordPressVIPMinimum.JS.Window.location` | No change | +| `WordPressVIPMinimum.JS.Window.name` | No change | +| `WordPressVIPMinimum.JS.Window.status` | No change | +| `WordPressVIPMinimum.Plugins.Zoninator.Zoninator` | `WordPressVIPMinimum.Compatibility.Zoninator.RequiresRESTAPI` | +| `WordPressVIPMinimum.TemplatingEngines.UnescapedOutputMustache.{{{` | `WordPressVIPMinimum.Security.Mustache.OutputNotation` | +| `WordPressVIPMinimum.TemplatingEngines.UnescapedOutputMustache.{{&` | `WordPressVIPMinimum.Security.Mustache.VariableNotation` | +| `WordPressVIPMinimum.TemplatingEngines.UnescapedOutputMustache.delimeterChange` | `WordPressVIPMinimum.Security.Mustache.DelimiterChange` | +| `WordPressVIPMinimum.TemplatingEngines.UnescapedOutputMustache.SafeString` | `WordPressVIPMinimum.Security.Mustache.SafeString` | +| `WordPressVIPMinimum.TemplatingEngines.UnescapedOutputTwig.autoescape false` | `WordPressVIPMinimum.Security.Twig.AutoescapeFalse` | +| `WordPressVIPMinimum.TemplatingEngines.UnescapedOutputTwig.raw` | `WordPressVIPMinimum.Security.Twig.RawFound` | +| `WordPressVIPMinimum.TemplatingEngines.UnescapedOutputUnderscorejs.<%=` | `WordPressVIPMinimum.Security.Underscorejs.OutputNotation` | +| `WordPressVIPMinimum.TemplatingEngines.UnescapedOutputUnderscorejs.interpolate` | `WordPressVIPMinimum.Security.Underscorejs.InterpolateFound` | +| `WordPressVIPMinimum.TemplatingEngines.UnescapedOutputVuejs.v-html` | `WordPressVIPMinimum.Security.Vuejs.Found` | +| `WordPressVIPMinimum.Variables.ServerVariables.BasicAuthentication` | No change | +| `WordPressVIPMinimum.Variables.ServerVariables.UserControlledHeaders` | No change | +| `WordPressVIPMinimum.Variables.VariableAnalysis.VariableRedeclaration` | No change | +| `WordPressVIPMinimum.Variables.VariableAnalysis.UndefinedVariables` | `WordPressVIPMinimum.Variables.VariableAnalysis.UndefinedVariable` | +| `WordPressVIPMinimum.Variables.VariableAnalysis.$...` | `WordPressVIPMinimum.Variables.VariableAnalysis.SelfInsideClosure`
`WordPressVIPMinimum.Variables.VariableAnalysis.SelfOutsideClass`
`WordPressVIPMinimum.Variables.VariableAnalysis.StaticInsideClosure`
`WordPressVIPMinimum.Variables.VariableAnalysis.StaticOutsideClass` | +| `WordPressVIPMinimum.Variables.VariableAnalysis.UnusedVariable` | No change | +| `WordPressVIPMinimum.VIP.ErrorControl.ErrorControl` | Replaced with `Generic.PHP.NoSilencedErrors` | +| `WordPressVIPMinimum.VIP.EscapingVoidReturnFunctions.escapingVoidReturningFunction` | `WordPressVIPMinimum.Security.EscapingVoidReturnFunctions.Found` | +| `WordPressVIPMinimum.VIP.ExitAfterRedirect.NoExitInConditional` | `WordPressVIPMinimum.Security.ExitAfterRedirect.NoExitInConditional` | +| `WordPressVIPMinimum.VIP.ExitAfterRedirect.NoExit` | `WordPressVIPMinimum.Security.ExitAfterRedirect.NoExit` | +| `WordPressVIPMinimum.VIP.FetchingRemoteData.fileGetContentsUknown` | `WordPressVIPMinimum.Performance.FetchingRemoteData.FileGetContentsUnknown` | +| `WordPressVIPMinimum.VIP.FetchingRemoteData.fileGetContentsRemoteFile` | `WordPressVIPMinimum.Performance.FetchingRemoteData.FileGetContentsRemoteFile` | +| `WordPressVIPMinimum.VIP.FlushRewriteRules.FlushRewriteRules` | Replaced with `WordPressVIPMinimum.Functions.RestrictedFunctions.flush_rewrite_rules_flush_rewrite_rules` and `WordPressVIPMinimum.Functions.RestrictedFunctions.flush_rewrite_rules_flush_rewrite_rules` | +| `WordPressVIPMinimum.VIP.MergeConflict.HEAD` | `WordPressVIPMinimum.MergeConflict.MergeConflict.Start` | +| `WordPressVIPMinimum.VIP.MergeConflict.DELIMITER` | `WordPressVIPMinimum.MergeConflict.MergeConflict.End`
`WordPressVIPMinimum.MergeConflict.MergeConflict.Separator` | +| `WordPressVIPMinimum.VIP.PHPFilterFunctions.MissingThirdParameter` | `WordPressVIPMinimum.Security.PHPFilterFunctions.MissingThirdParameter` | +| `WordPressVIPMinimum.VIP.PHPFilterFunctions.RestrictedFilter` | `WordPressVIPMinimum.Security.PHPFilterFunctions.RestrictedFilter` | +| `WordPressVIPMinimum.VIP.PHPFilterFunctions.MissingSecondParameter` | `WordPressVIPMinimum.Security.PHPFilterFunctions.MissingSecondParameter` | +| `WordPressVIPMinimum.VIP.ProperEscapingFunction.hrefSrcEscUrl` | `WordPressVIPMinimum.Security.ProperEscapingFunction.hrefSrcEscUrl` | +| `WordPressVIPMinimum.VIP.ProperEscapingFunction.htmlAttrNotByEscHTML` | `WordPressVIPMinimum.Security.ProperEscapingFunction.htmlAttrNotByEscHTML` | +| `WordPressVIPMinimum.VIP.RegexpCompare.compare_compare` | `WordPressVIPMinimum.Performance.RegexCompare.compare_compare` | +| `WordPressVIPMinimum.VIP.RegexpCompare.compare_meta_compare` | `WordPressVIPMinimum.Performance.RegexCompare.compare_meta_compare` | +| `WordPressVIPMinimum.VIP.RemoteRequestTimeout.timeout_timeout` | `WordPressVIPMinimum.Performance.RemoteRequestTimeout.timeout_timeout` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.wp_cache_get_multi.wp_cache_get_multi` | `WordPressVIPMinimum.Functions.RestrictedFunctions.wp_cache_get_multi_wp_cache_get_multi` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.opcache_opcache_reset` | `WordPressVIPMinimum.Functions.RestrictedFunctions.opcache_opcache_reset` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.opcache_opcache_invalidate` | `WordPressVIPMinimum.Functions.RestrictedFunctions.opcache_opcache_invalidate` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.opcache_opcache_compile_file` | `WordPressVIPMinimum.Functions.RestrictedFunctions.opcache_opcache_compile_file` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.config_settings_opcache_is_script_cached` | `WordPressVIPMinimum.Functions.RestrictedFunctions.config_settings_opcache_is_script_cached` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.config_settings_opcache_get_status` | `WordPressVIPMinimum.Functions.RestrictedFunctions.config_settings_opcache_get_status` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.config_settings_opcache_get_configuration` | `WordPressVIPMinimum.Functions.RestrictedFunctions.config_settings_opcache_get_configuration` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.get_super_admins_get_super_admins` | `WordPressVIPMinimum.Functions.RestrictedFunctions.get_super_admins_get_super_admins` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.internal_wpcom_vip_irc` | `WordPressVIPMinimum.Functions.RestrictedFunctions.internal_wpcom_vip_irc` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.rewrite_rules_flush_rewrite_rules` | `WordPressVIPMinimum.Functions.RestrictedFunctions.flush_rewrite_rules_flush_rewrite_rules` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.attachment_url_to_postid_attachment_url_to_postid` | `WordPressVIPMinimum.Functions.RestrictedFunctions.attachment_url_to_postid_attachment_url_to_postid` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.dbDelta_dbDelta` | `WordPressVIPMinimum.Functions.RestrictedFunctions.dbDelta_dbDelta` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.switch_to_blog_switch_to_blog` | `WordPressVIPMinimum.Functions.RestrictedFunctions.switch_to_blog_switch_to_blog` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.get_page_by_title_get_page_by_title` | `WordPressVIPMinimum.Functions.RestrictedFunctions.get_page_by_title_get_page_by_title` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.url_to_postid_url_to_postid` | `WordPressVIPMinimum.Functions.RestrictedFunctions.url_to_postid_url_to_postid` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.url_to_postid_url_to_post_id` | Removed | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.custom_role_add_role` | `WordPressVIPMinimum.Functions.RestrictedFunctions.custom_role_add_role` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.user_meta_get_user_meta` | `WordPressVIPMinimum.Functions.RestrictedFunctions.user_meta_get_user_meta` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.user_meta_update_user_meta` | `WordPressVIPMinimum.Functions.RestrictedFunctions.user_meta_update_user_meta` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.user_meta_delete_user_meta` | `WordPressVIPMinimum.Functions.RestrictedFunctions.user_meta_delete_user_meta` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.user_meta_add_user_meta` | `WordPressVIPMinimum.Functions.RestrictedFunctions.user_meta_add_user_meta` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.term_exists_term_exists` | `WordPressVIPMinimum.Functions.RestrictedFunctions.term_exists_term_exists` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.count_user_posts_count_user_posts` | `WordPressVIPMinimum.Functions.RestrictedFunctions.count_user_posts_count_user_posts` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.wp_old_slug_redirect_wp_old_slug_redirect` | `WordPressVIPMinimum.Functions.RestrictedFunctions.wp_old_slug_redirect_wp_old_slug_redirect` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.get_adjacent_post_get_adjacent_post` | `WordPressVIPMinimum.Functions.RestrictedFunctions.get_adjacent_post_get_adjacent_post` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.get_adjacent_post_get_previous_post` | `WordPressVIPMinimum.Functions.RestrictedFunctions.get_adjacent_post_get_previous_post` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.get_adjacent_post_get_previous_post_link` | `WordPressVIPMinimum.Functions.RestrictedFunctions.get_adjacent_post_get_previous_post_link` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.get_adjacent_post_get_next_post` | `WordPressVIPMinimum.Functions.RestrictedFunctions.get_adjacent_post_get_next_post` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.get_adjacent_post_get_next_post_link` | `WordPressVIPMinimum.Functions.RestrictedFunctions.get_adjacent_post_get_next_post_link` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.get_intermediate_image_sizes_get_intermediate_image_sizes` | `WordPressVIPMinimum.Functions.RestrictedFunctions.get_intermediate_image_sizes_get_intermediate_image_sizes` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.wp_is_mobile_wp_is_mobile` | `WordPressVIPMinimum.Functions.RestrictedFunctions.wp_is_mobile_wp_is_mobile` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.wp_mail_wp_mail` | `WordPressVIPMinimum.Functions.RestrictedFunctions.wp_mail_wp_mail` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.wp_mail_mail` | `WordPressVIPMinimum.Functions.RestrictedFunctions.wp_mail_mail` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.is_multi_author_is_multi_author` | `WordPressVIPMinimum.Functions.RestrictedFunctions.is_multi_author_is_multi_author` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.advanced_custom_fields_the_sub_field` | `WordPressVIPMinimum.Functions.RestrictedFunctions.advanced_custom_fields_the_sub_field` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.advanced_custom_fields_the_field` | `WordPressVIPMinimum.Functions.RestrictedFunctions.advanced_custom_fields_the_field` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.wp_remote_get_wp_remote_get` | `WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.cookies_setcookie` | `WordPressVIPMinimum.Functions.RestrictedFunctions.cookies_setcookie` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.get_posts_get_posts` | `WordPressVIPMinimum.Functions.RestrictedFunctions.get_posts_get_posts` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.get_posts_wp_get_recent_posts` | `WordPressVIPMinimum.Functions.RestrictedFunctions.get_posts_wp_get_recent_posts` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.get_posts_get_children` | `WordPressVIPMinimum.Functions.RestrictedFunctions.get_posts_get_children` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.wpcom_vip_get_term_link_wpcom_vip_get_term_link` | `WordPressVIPMinimum.Functions.RestrictedFunctions.wpcom_vip_get_term_link_wpcom_vip_get_term_link` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.wpcom_vip_get_term_by_wpcom_vip_get_term_by` | `WordPressVIPMinimum.Functions.RestrictedFunctions.wpcom_vip_get_term_by_wpcom_vip_get_term_by` | +| `WordPressVIPMinimum.VIP.RestrictedFunctions.wpcom_vip_get_category_by_slug_wpcom_vip_get_category_by_slug` | `WordPressVIPMinimum.Functions.RestrictedFunctions.wpcom_vip_get_category_by_slug_wpcom_vip_get_category_by_slug` | +| `WordPressVIPMinimum.VIP.Robotstxt.RobotstxtSniff` | `WordPressVIPMinimum.Hooks.RestrictedHooks.robotstxt_do_robotstxt`
`WordPressVIPMinimum.Hooks.RestrictedHooks.robotstxt_robots_txt` | +| `WordPressVIPMinimum.VIP.StaticStrreplace.StaticStrreplace` | `WordPressVIPMinimum.Security.StaticStrreplace.StaticStrreplace` | +| `WordPressVIPMinimum.VIP.TaxonomyMetaInOptions.PossibleTermMetaInOptions` | `WordPressVIPMinimum.Performance.TaxonomyMetaInOptions.PossibleTermMetaInOptions` | +| `WordPressVIPMinimum.VIP.WPQueryParams.suppressFiltersTrue` | `WordPressVIPMinimum.Performance.WPQueryParams.SuppressFiltersTrue` | +| `WordPressVIPMinimum.VIP.WPQueryParams.post__not_in` | `WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn` | + +### Added +- New violations: + - `WordPressVIPMinimum.Functions.RestrictedFunctions.chmod_chgrp` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.chmod_chown` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.chmod_chmod` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.chmod_lchgrp` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.chmod_lchown` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.directory_mkdir` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.directory_rmdir` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_delete` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_file_put_contents` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_flock` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_fputcsv` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_fputs` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_ftruncate` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_fwrite` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_is_writable` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_is_writeable` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_link` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_rename` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_symlink` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_tempnam` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_touch` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_unlink` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_abort` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_cache_expire` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_cache_limiter` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_commit` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_create_id` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_decode` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_destroy` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_encode` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_gc` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_get_cookie_params` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_id` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_is_registered` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_module_name` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_name` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_regenerate_id` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_register_shutdown` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_register` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_reset` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_save_path` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_set_cookie_params` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_set_save_handler` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_start` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_status` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_unregister` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_unset` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.session_session_write_close` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.site_option_add_site_option` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.site_option_delete_site_option` + - `WordPressVIPMinimum.Functions.RestrictedFunctions.site_option_update_site_option` + - `WordPressVIPMinimum.Performance.NoPaging.nopaging_nopaging` + - `WordPressVIPMinimum.Performance.OrderByRand.orderby_orderby` + - `WordPressVIPMinimum.UserExperience.AdminBarRemoval.HidingDetected` + - `WordPressVIPMinimum.UserExperience.AdminBarRemoval.RemovalDetected` + - `WordPressVIPMinimum.Variables.RestrictedVariables.user_meta__wpdb__users` + - `WordPressVIPMinimum.Variables.RestrictedVariables.user_meta__wpdb__usermeta` + - `WordPressVIPMinimum.Variables.RestrictedVariables.cache_constraints___COOKIE` + - `WordPressVIPMinimum.Variables.RestrictedVariables.cache_constraints___SERVER__HTTP_USER_AGENT__` + - `WordPressVIPMinimum.Variables.RestrictedVariables.cache_constraints___SERVER__REMOTE_ADDR__` + - `WordPressVIPMinimum.Variables.RestrictedVariables.session___session` +- `WordPress-VIP-Go` ruleset test. +- docs about ruleset tests. +- XSD reference and ruleset validation. +- `phpcodesniffer-composer-installer` plugin. +- Copy `has_html_open_tag()` from WPCS. +- Copy `AbstractVariableRestrictionsSniff` from WPCS. + +### Changed +- Switch from PHPCS 2.* class names to PHPCS 3.* namespaced classes. +- Refactor all sniffs to extend `VIPCS\Sniff`, which is an extension of `WordPress\Sniff`. +- Tidied up: + - unused imports + - unused local variables + - unused parameters + - unused private field + - duplicate array keys + - redundant self-assignment + - assignment in conditions + - not returning void function calls + - undefined class fields + - strict comparisons + - missing scope keywords + - parentheses to clarify one specific conditional + - consolidate multiple `isset()` calls + - consolidate positive nested `if()`’s + - difference in case for function calls + - simplified return statements + - switched to `__DIR__` + - switched FQCN to import statements + - use static property + - use more performant `strpos()` instead of `substr()` + - split or remove `else` / `elseif` workflows for lower complexity and more comprehension + - misuse of `array_push()` + - misuse of `array_values()` + - misuse of `in_array()` + - useless `return` + - redundant `continue` + - comments that were naming parameters + - default assignments of `null` to class properties + - function parameters that match default arg values + - redundant parentheses +- Ruleset Test improvements: + - Move mostly duplicate `PHPCS_Ruleset_Test` classes into new `RulesetTest` class. + - Refactor new class: + - Accept a ruleset name in the constructor + - Change public method from `run()` to `passes()`. + - Break out logic into smaller private methods to make the logic more self-documenting. + - Refactor variable names in some methods. + - Decode JSON into objects, not arrays + - Fix incorrect reference to local `$expected` to `$this->expected`. Somehow, this was still working regardless. + - Fix bug where it doesn't catch proper number of errors/warnings on a line basis due to order of operations of incrementating after assignment. + - Add further documentation. + - Change ruleset test class usage, including adding the name to the "tests passed!" message. + - Replaced WPCS whitelisting `// XSS OK` comments in this files with `// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped` comments. + - Change naming of tests from "integration test" to "ruleset tests", to make it more intuitive exactly what these are (composer script, Travis, bin filename). +- Improve `addError()` and `addWarning()` calls +- Remove `Generic.NamingConventions.ConstructorName.OldStyle` from `WordPress-VIP-Go` ruleset +- Travis: Restrict PHPUnit versions to match PHPCS +- Travis: Use `7.4snapshot` instead of nightly, switch from Trusty to Xenial, remove `sudo: false`. +- `EscapingVoidReturnFunctions`: Fix docs and improve logic +- `AlwaysReturnSniff`: trigger errors instead of warnings, don't give violation for when callback args is passed by reference +- Change `exec()` and `shell_exec()` to be flagged as Error. +- Disallow long array syntax in VIPCS sniff code. +- Remove a `WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition` exclusion in the PHPCS config for VIPCS itself. +- Update docs. + +### Fixed +- Bumped PHPCompatibility `testVersion` to match PHP requirement. +- Silence `Generic.PHP.DisallowShortOpenTag.EchoFound` for `WordPress-VIP-Go` ruleset: ` + +
  • This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
  • +
  • You may copy and distribute verbatim copies of the Program’s source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
  • +
  • You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: +
      +
    1. You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
    2. +
    3. You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
    4. +
    5. If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
    6. +
    + These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
  • +
  • You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: +
      +
    1. Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
    2. +
    3. Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
    4. +
    5. Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
    6. +
    +
  • +
  • You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
  • +
  • You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
  • +
  • Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
  • +
  • If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
  • +
  • If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
  • +
  • The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
  • +
  • If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
  • +
  • BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
  • +
  • IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  • + + + +Included Files +========================== + +This project includes: + +- [WordPress-Coding-Standards](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards), which is Copyright © 2009 John Godley and contributors. Released under the MIT license https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/blob/develop/LICENSE +- [PHP_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer), Copyright © 2012, Squiz Pty Ltd (ABN 77 084 670 600). Released under the following license: https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt diff --git a/vendor/automattic/vipwpcs/README.md b/vendor/automattic/vipwpcs/README.md new file mode 100644 index 00000000..c0d08b3f --- /dev/null +++ b/vendor/automattic/vipwpcs/README.md @@ -0,0 +1,57 @@ +# VIP Coding Standards + +This project contains [PHP_CodeSniffer (PHPCS) sniffs and rulesets](https://github.com/PHPCSStandards/PHP_CodeSniffer) to validate code developed for [WordPress VIP](https://wpvip.com/). + +This project contains two rulesets: + + - `WordPressVIPMinimum` - for use with projects on the (older) WordPress.com VIP platform. + - `WordPress-VIP-Go` - for use with projects on the (newer) VIP Go platform. + +These rulesets contain only the rules which are considered to be [errors](https://docs.wpvip.com/php_codesniffer/errors/) and [warnings](https://docs.wpvip.com/php_codesniffer/warnings/) according to the WordPress VIP documentation. + +The rulesets use rules from the [WordPress Coding Standards](https://github.com/WordPress/WordPress-Coding-Standards) (WPCS) project, as well as the [VariableAnalysis](https://github.com/sirbrillig/phpcs-variable-analysis) standard. + +[Learn](https://docs.wpvip.com/vip-code-analysis-bot/phpcs-report/) about why violations are flagged as errors vs warnings and what the levels mean. + +## Minimal requirements + +* PHP 5.4+ +* [PHPCS 3.8.0+](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases) +* [PHPCSUtils 1.0.9+](https://github.com/PHPCSStandards/PHPCSUtils) +* [PHPCSExtra 1.2.1+](https://github.com/PHPCSStandards/PHPCSExtra) +* [WPCS 3.0.0+](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/releases) +* [VariableAnalysis 2.11.17+](https://github.com/sirbrillig/phpcs-variable-analysis/releases) + +## Installation + +[Composer](https://getcomposer.org/) will install the latest compatible versions of PHPCS, PHPCSUtils, PHPCSExtra, WPCS and VariableAnalysis and register the external standards with PHP_CodeSniffer. + +Please refer to the [installation instructions for installing PHP_CodeSniffer for WordPress VIP](https://docs.wpvip.com/how-tos/code-review/php_codesniffer/) for more details. + +As of VIPCS version 2.3.0, there is no need to `require` the [PHP_CodeSniffer Standards Composer Installer Plugin](https://github.com/PHPCSStandards/composer-installer) anymore as it is now a requirement of VIPCS itself. Permission to run the plugin will still need to be granted though when using Composer 2.2 or higher. + +### Composer Project-based Installation + +To install the VIP Coding Standards, run the following from the root of your project: + +```bash +composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true +composer require --dev automattic/vipwpcs +``` + +### Composer Global Installation + +Alternatively, it can be installed standard globally for use across multiple projects: + +```bash +composer global config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true +composer global require --dev automattic/vipwpcs +``` + +## Contribution + +Please see [CONTRIBUTION.md](.github/CONTRIBUTING.md). + +## License + +Licensed under [GPL-2.0-or-later](LICENSE.md). diff --git a/vendor/automattic/vipwpcs/WordPress-VIP-Go/ruleset-test.inc b/vendor/automattic/vipwpcs/WordPress-VIP-Go/ruleset-test.inc new file mode 100644 index 00000000..bd7e3de6 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPress-VIP-Go/ruleset-test.inc @@ -0,0 +1,579 @@ + 999, // Warning + Message. + 'posts_per_page' => 1, // OK. + 'posts_per_page' => '1', // OK. +); +_query_posts( 'posts_per_page=999' ); // Warning + Message. +$query_args['posts_per_page'] = 999; // Warning + Message. +$query_args['posts_per_page'] = 1; // OK. + +// WordPressVIPMinimum.Hooks.RestrictedHooks.upload_mimes +add_filter( 'upload_mimes', 'foo' ); // Warning. + +// WordPressVIPMinimum.Security.PHPFilterFunctions +filter_var( $url ); // Warning. +filter_var_array( $array ); // Warning. +filter_input_array( $array ); // Warning. +filter_var( $url, FILTER_SANITIZE_URL ); // Ok. +filter_input( INPUT_GET, 'foo' ); // Warning. +filter_input( INPUT_GET, 'foo', FILTER_SANITIZE_STRING ); // Ok. +filter_var( $url, FILTER_DEFAULT ); // Warning. +filter_var_array( $array, FILTER_UNSAFE_RAW ); // Warning. +filter_var_array( $array, FILTER_SANITIZE_STRING ); // Ok. +filter_input_array( $array,FILTER_SANITIZE_STRING ); // Ok. +filter_input( INPUT_GET, 'foo', FILTER_DEFAULT ); // Warning. + + + + +// WordPressVIPMinimum.Functions.RestrictedFunctions.wp_mail_wp_mail +wp_mail(); // Warning. +mail(); // Warning. + +// WordPressVIPMinimum.Functions.RestrictedFunctions.attachment_url_to_postid_attachment_url_to_postid +wpcom_vip_attachment_url_to_postid( $url ); // Ok. +attachment_url_to_postid( $url ); // Warning + Message. + +// WordPressVIPMinimum.Functions.RestrictedFunctions.get_adjacent_post_get_adjacent_post +wpcom_vip_get_adjacent_post(); // Ok. +get_adjacent_post(); // Warning. +get_previous_post(); // Warning. +get_next_post(); // Warning. +get_previous_post_link(); // Warning. +get_next_post_link(); // Warning. + + + + + +// WordPressVIPMinimum.Functions.RestrictedFunctions.get_posts_get_children +get_child(); // Ok. +get_children(); // Warning + Message. + +// WordPressVIPMinimum.Functions.RestrictedFunctions.get_posts_get_posts +get_posts(); // Warning. +get_post( 123 ); // Ok. + +// WordPressVIPMinimum.Functions.RestrictedFunctions.get_posts_wp_get_recent_posts +wp_get_recent_posts(); // Warning. + +// WordPressVIPMinimum.Functions.RestrictedFunctions.url_to_postid_url_to_postid +wpcom_vip_url_to_postid( $url ); // Ok. +url_to_postid( $url ); // Warning + Message. + +// WordPressVIPMinimum.Functions.RestrictedFunctions.wp_old_slug_redirect_wp_old_slug_redirect +wpcom_vip_old_slug_redirect(); // Ok. +wp_old_slug_redirect(); // Warning. + +// Generic.CodeAnalysis.AssignmentInCondition.Found +if ($a = 123) { // Warning. +} + +// WordPress.PHP.DiscouragedPHPFunctions.urlencode_urlencode +urlencode(); // Warning. +rawurlencode(); // Ok. + +// WordPress.PHP.DontExtract +extract( array( 'a' => 1 ) ); // Error. +$obj->extract(); // Ok. + +// Universal.Operators.StrictComparisons +true == $true; // Warning. +false === $true; // Ok. + +// WordPress.PHP.StrictInArray.MissingTrueStrict +in_array( 1, array( '1', 1, true ), true ); // Ok. +in_array( 1, array( '1', 1, true ) ); // Warning. +in_array( 1, array( '1', 1, true ), false ); // Warning. +array_search( 1, $array, false ); // Warning. +array_keys( array( '1', 1, true ), 'my_key' ); // Warning. + +// WordPress.Security.EscapeOutput.UnsafePrintingFunction +_e( $some_nasty_var ); // Error. +_ex( $some_nasty_var, 'context' ); // Error. +echo esc_html_x( 'Something', 'context' ); // Ok. +echo esc_html_x( $some_nasty_var, 'context' ); // Ok. + +// WordPress.WP.GlobalVariablesOverride.OverrideProhibited +global $wpdb; +$wpdb = 'test'; // Error. +$GLOBALS['domain']['subkey'] = 'something else'; // Error. + +// WordPress.WP.EnqueuedResources.NonEnqueuedScript +echo wp_kses( ' + + + +'; // Warning + Message. + +// WordPressVIPMinimum.Performance.LowExpiryCacheTime.LowCacheTime +wp_cache_set( 'test', $data, $group, 100 ); // Warning. +wp_cache_add( 'test', $data, $group, 2*MINUTE_IN_SECONDS ); // Warning. +wp_cache_replace( $testing, $data, '', 1.5 * MINUTE_IN_SECONDS ); // Warning. + +// WordPressVIPMinimum.Files.IncludingFile +include_once ( MY_CONSTANT . "my_file.php" ); // Warning. +require_once( custom_function( 'test_file.php' ) ); // Warning. +require_once "my_file.php"; // Warning. +require '../../my_file.php'; // Warning. +include("http://www.google.com/bad_file.php"); // Warning. + +// VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable +function foo_bar_bar() { + $b . 'test'; // Warning. +} + +// VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable +function foo_bar_foo() { + $a = 'Hello'; // OK. Unused variables warning silenced. +} + +// WordPressVIPMinimum.UserExperience.AdminBarRemoval +add_filter( 'show_admin_bar', '__return_false' ); // Warning. +add_filter( 'show_admin_bar', '__return_true' ); // Ok. +show_admin_bar( false ); // Warning. +show_admin_bar( true ); // Ok. +add_filter( 'show_admin_bar', 'my_own_return_false' ); // Warning. +echo ''; +?> '; // Error. +echo ''; // Error. +echo ''; // OK. +?>Hello +Hey + + array( 1, 2, 3 ), // Warning. +] ); + +/* Rules that are being silenced and should NOT be flagged. */ + +// WordPress.DB.SlowDBQuery.slow_db_query_meta_key +$query = new WP_Query( ['meta_key' => 'foo' ] ); // Ok. +$args = 'foo=bar&meta_key=foo'; // Ok. + + + + + + + + + + + + + + + + + + + + + +// WordPressVIPMinimum.Functions.RestrictedFunctions.site_option_delete_site_option +delete_site_option( $foo ); // Ok. + +// WordPressVIPMinimum.Functions.RestrictedFunctions.site_option_update_site_option +update_site_option( $bar, $foo, true ); // Ok. + +// WordPressVIPMinimum.Functions.RestrictedFunctions.site_option_add_site_option +add_site_option( 'foo', $bar ); // Ok. + +// Generic.PHP.DisallowShortOpenTag.EchoFound +?> My term link'; // Error. + +// WordPressVIPMinimum.Functions.DynamicCalls +$my_notokay_func = 'extract'; +$my_notokay_func(); // Error. + +// WordPressVIPMinimum.Functions.RestrictedFunctions + +opcache_reset(); // Error. +opcache_invalidate( 'test_script.php' ); // Error. +opcache_compile_file( $var ); // Error. +opcache_is_script_cached( 'test_script.php' ); // Error. +opcache_get_status(); // Error. +opcache_get_configuration(); // Error. +get_super_admins(); // OK. +wpcom_vip_irc(); // Error. +flush_rewrite_rules(); // Error. +$wp_rewrite->flush_rules(); // Error. +\add_role(); // Error. + +count_user_posts(); // Error. +get_intermediate_image_sizes(); // Error. +wp_is_mobile(); // Error. +session_abort(); // Error. +session_cache_expire(); // Error. +session_cache_limiter(); // Error. +session_commit(); // Error. +session_create_id(); // Error. +session_decode(); // Error. +session_destroy(); // Error. +session_encode(); // Error. +session_gc(); // Error. +session_get_cookie_params(); // Error. +session_id(); // Error. +session_is_registered(); // Error. +session_module_name(); // Error. +session_name(); // Error. +session_regenerate_id(); // Error. +session_register_shutdown(); // Error. +session_register(); // Error. +session_reset(); // Error. +session_save_path(); // Error. +session_set_cookie_params(); // Error. +session_set_save_handler(); // Error. +session_start(); // Error. +session_status(); // Error. +session_unregister(); // Error. +session_unset(); // Error. +session_write_close(); // Error. + +file_put_contents( $file, $text, FILE_APPEND ); // Warning. +while ( $count > $loop ) { + if ( flock( $fp, LOCK_EX ) ) { // Warning. + fwrite( $fp, $text ); // Warning. + } +} +fputcsv(); // Warning. +fputs(); // Warning. +ftruncate(); // Warning. +is_writable(); // Warning. +is_writeable(); // Warning. +link(); // Warning. +rename(); // Warning. +symlink(); // Warning. +tempnam(); // Warning. +touch(); // Warning. +unlink(); // Warning. +mkdir(); // Error. +rmdir(); // Error. +chgrp(); // Error. +chown(); // Error. +chmod(); // Error. +lchgrp(); // Error. +lchown(); // Error. +the_sub_field( 'field' ); // Warning. +the_field( 'field' ); // Warning. +wp_remote_get( $url ); // Warning. +get_posts(); // Warning. +function test_function( $a, $b ) { // OK. Unused variables warning silenced. + return create_function( '$a, $b', 'return ( $b / $a ); '); // Warning. +} +wpcom_vip_get_term_link(); // Warning. +wpcom_vip_get_term_by(); // Warning. +wpcom_vip_get_category_by_slug(); // Warning. + +// WordPressVIPMinimum.Functions.StripTagsSniff +strip_tags( 'Test', $text ); // Warning. + +// WordPressVIPMinimum.Hooks.AlwaysReturnInFilter +function bad_example_function_thing() { // Error. + if ( 1 === 0 ) { + if ( 1 === 1 ) { + return 'ahoj'; + } else { + return 'hello'; + } + } +} +add_filter( 'bad_example_function_filter', 'bad_example_function_thing' ); +add_filter( 'another_bad_example_closure', function() { // Error. + return; +} ); + +// WordPressVIPMinimum.Hooks.PreGetPosts +add_action( 'pre_get_posts', function( $wp_query ) { + if ( ! $wp_query->is_search() ) { + $wp_query->set( 'cat', '-5' ); // Warning. + } +} ); + +// WordPressVIPMinimum.Hooks.RestrictedHooks +add_action( 'http_request_timeout', 'bad_example_function' ); // Warning. +add_filter('http_request_args', 'bad_example_function' ); // Warning. +add_action( 'do_robotstxt', 'my_do_robotstxt'); // Warning. +add_filter( 'robots_txt', function() { // Warning. + return 'test'; +} ); + +// WordPressVIPMinimum.Performance.CacheValueOverride +$bad_wp_users = wp_cache_get( md5( self::CACHE_KEY . '_wp_users'), self::CACHE_GROUP ); +$bad_wp_users = false; // Error. + +// WordPressVIPMinimum.Performance.NoPaging +$args = array( + 'nopaging' => true, // Error. +); +_query_posts( 'nopaging=true' ); // Error. + +// WordPressVIPMinimum.Performance.OrderByRand +$args = array( + "orderby" => "RAND", // Error. +); +$query_args['orderby'] = 'rand'; // Error. + +// WordPressVIPMinimum.Performance.RegexpCompare +$query_args = array( + 'posts_per_page' => 1, + 'post_status' => 'draft', + 'meta_compare' => 'REGEXP', // Error. +); +$query_args = [ + 'post_status' => 'publish', + 'meta_query' => [ // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query + [ + 'compare' => 'REGEXP', // Error. + ] + ] +]; + +// WordPressVIPMinimum.Performance.RemoteRequestTimeout +wp_remote_post( $obj->endpoint, array( + 'method' => 'POST', + 'timeout' => 45, // Error. + 'httpversion' => '1.1', + 'blocking' => false, + 'body' => wp_json_encode( $obj->logs, JSON_UNESCAPED_SLASHES ), + ) +); + +// WordPressVIPMinimum.Performance.TaxonomyMetaInOptions +get_option( "taxonomy_rating_$obj->term_id" ); // Warning. +update_option( 'taxonomy_rating_' . $category_id ); // Warning. + +// WordPressVIPMinimum.Performance.WPQueryParams +$query_args = array( + 'suppress_filters' => true, // Error. +); + +// WordPressVIPMinimum.Security.EscapingVoidReturnFunctions.Found +esc_js( _deprecated_argument() ); // Error. +esc_js( _deprecated_constructor() ); // Error. +esc_js( _deprecated_file( 'filename' ) ); // Error. +esc_js( _deprecated_function() ); // Error. +esc_js( _deprecated_hook() ); // Error. +esc_js( _doing_it_wrong() ); // Error. +esc_html( printf( 'foo', [] ) ); // Error. +esc_attr( user_error( 'foo', '' ) ); // Error. +esc_attr( vprintf( 'foo', [] ) ); // Error. +esc_attr( wp_die( 'foo' ) ); // Error. +esc_attr( wp_dropdown_pages() ); // Error. + +// WordPressVIPMinimum.Security.ExitAfterRedirect +function redirect_test() { + wp_safe_redirect( 'https.//vip.wordpress.com' ); // Error. +} +wp_redirect( 'https://vip.wordpress.com' ); // Error. + +// WordPressVIPMinimum.Security.Mustache +echo '{{{data}}}
    '; // Warning. +?> + + + _.templateSettings = { + interpolate: /\{\{(.+?)\}\}/g" . // Warning. +"}; + "; + +// WordPressVIPMinimum.Security.Vuejs +?>
    +

    +
    +<<<<<<< HEAD // Error. + +>>>>>>> // Error. + + [ + 50 => 1, + 53 => 1, + 56 => 1, + 72 => 1, + 83 => 1, + 165 => 1, + 180 => 1, + 181 => 1, + 187 => 1, + 188 => 1, + 252 => 1, + 255 => 1, + 256 => 1, + 258 => 1, + 259 => 1, + 318 => 1, + 329 => 1, + 334 => 1, + 337 => 1, + 341 => 1, + 342 => 1, + 346 => 1, + 350 => 1, + 351 => 1, + 352 => 1, + 353 => 1, + 354 => 1, + 355 => 1, + 357 => 1, + 358 => 1, + 359 => 1, + 360 => 1, + 362 => 1, + 363 => 1, + 364 => 1, + 365 => 1, + 366 => 1, + 367 => 1, + 368 => 1, + 369 => 1, + 370 => 1, + 371 => 1, + 372 => 1, + 373 => 1, + 374 => 1, + 375 => 1, + 376 => 1, + 377 => 1, + 378 => 1, + 379 => 1, + 380 => 1, + 381 => 1, + 382 => 1, + 383 => 1, + 384 => 1, + 385 => 1, + 386 => 1, + 387 => 1, + 388 => 1, + 389 => 1, + 390 => 1, + 409 => 1, + 410 => 1, + 411 => 1, + 412 => 1, + 413 => 1, + 414 => 1, + 415 => 1, + 431 => 1, + 441 => 1, + 462 => 1, + 466 => 1, + 468 => 1, + 472 => 1, + 474 => 1, + 480 => 1, + 486 => 1, + 494 => 1, + 507 => 1, + 511 => 1, + 512 => 1, + 513 => 1, + 514 => 1, + 515 => 1, + 516 => 1, + 517 => 1, + 518 => 1, + 519 => 1, + 520 => 1, + 521 => 1, + 525 => 1, + 527 => 1, + 545 => 1, + 560 => 1, + 564 => 1, + 565 => 1, + 566 => 1, + 567 => 1, + 572 => 1, + 574 => 1, + ], + 'warnings' => [ + 7 => 1, + 10 => 1, + 14 => 1, + 17 => 1, + 20 => 1, + 23 => 1, + 26 => 1, + 29 => 1, + 32 => 1, + 35 => 1, + 38 => 1, + 41 => 1, + 44 => 1, + 47 => 1, + 63 => 1, + 66 => 1, + 83 => 1, + 85 => 1, + 90 => 1, + 94 => 1, + 95 => 1, + 99 => 1, + 102 => 1, + 103 => 1, + 104 => 1, + 106 => 1, + 108 => 1, + 109 => 1, + 112 => 1, + 118 => 1, + 119 => 1, + 123 => 1, + 127 => 1, + 128 => 1, + 129 => 1, + 130 => 1, + 131 => 1, + 139 => 1, + 142 => 1, + 146 => 1, + 150 => 1, + 154 => 1, + 157 => 1, + 161 => 1, + 169 => 1, + 174 => 1, + 175 => 1, + 176 => 1, + 177 => 1, + 191 => 1, + 192 => 1, + 195 => 1, + 196 => 1, + 199 => 1, + 200 => 1, + 201 => 1, + 204 => 1, + 205 => 1, + 206 => 1, + 207 => 1, + 208 => 1, + 212 => 1, + 221 => 1, + 223 => 1, + 225 => 1, + 228 => 1, + 229 => 1, + 230 => 1, + 235 => 1, + 236 => 1, + 237 => 1, + 245 => 1, + 246 => 1, + 247 => 1, + 265 => 1, + 269 => 1, + 273 => 1, + 322 => 1, + 332 => 1, + 392 => 1, + 394 => 1, + 395 => 1, + 398 => 1, + 399 => 1, + 400 => 1, + 401 => 1, + 402 => 1, + 403 => 1, + 404 => 1, + 405 => 1, + 406 => 1, + 407 => 1, + 408 => 1, + 416 => 1, + 417 => 1, + 418 => 1, + 419 => 1, + 421 => 1, + 423 => 1, + 424 => 1, + 425 => 1, + 428 => 1, + 448 => 1, + 453 => 1, + 454 => 1, + 455 => 1, + 456 => 1, + 502 => 1, + 503 => 1, + 530 => 1, + 533 => 1, + 540 => 1, + 550 => 1, + 556 => 1, + 579 => 1, + ], + 'messages' => [ + 7 => [ + 'File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as file_put_contents(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/', + ], + 10 => [ + 'File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as flock(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/', + ], + 14 => [ + 'File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as fputcsv(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/', + ], + 17 => [ + 'File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as fputs(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/', + ], + 20 => [ + 'File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as fwrite(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/', + ], + 23 => [ + 'File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as ftruncate(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/', + ], + 26 => [ + 'File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as is_writable(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/', + ], + 29 => [ + 'File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as is_writeable(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/', + ], + 32 => [ + 'File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as link(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/', + ], + 35 => [ + 'File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as rename(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/', + ], + 38 => [ + 'File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as symlink(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/', + ], + 41 => [ + 'File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as tempnam(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/', + ], + 44 => [ + 'File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as touch(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/', + ], + 47 => [ + 'File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as unlink(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/', + ], + 50 => [ + 'Due to server-side caching, server-side based client related logic might not work. We recommend implementing client side logic in JavaScript instead.', + ], + 53 => [ + 'Due to server-side caching, server-side based client related logic might not work. We recommend implementing client side logic in JavaScript instead.', + ], + 56 => [ + 'Due to server-side caching, server-side based client related logic might not work. We recommend implementing client side logic in JavaScript instead.', + ], + 63 => [ + 'File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as fopen(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/', + ], + 66 => [ + 'file_get_contents() is uncached. If the function is being used to fetch a remote file (e.g. a URL starting with https://), please use wpcom_vip_file_get_contents() to ensure the results are cached. For more details, please see: https://docs.wpvip.com/technical-references/code-quality-and-best-practices/retrieving-remote-data/', + ], + 90 => [ + 'Having more than 100 posts returned per page may lead to severe performance problems.', + ], + 94 => [ + 'Having more than 100 posts returned per page may lead to severe performance problems.', + ], + 95 => [ + 'Having more than 100 posts returned per page may lead to severe performance problems.', + ], + 123 => [ + 'attachment_url_to_postid() is uncached, please use wpcom_vip_attachment_url_to_postid() instead.', + ], + 139 => [ + 'get_children() is uncached and performs a no limit query. Please use get_posts or WP_Query instead. Please see: https://docs.wpvip.com/technical-references/caching/uncached-functions/', + ], + 150 => [ + 'url_to_postid() is uncached, please use wpcom_vip_url_to_postid() instead.', + ], + 191 => [ + 'Scripts should be registered/enqueued via `wp_enqueue_script`. This can improve the site\'s performance due to script concatenation.', + ], + 192 => [ + 'Scripts should be registered/enqueued via `wp_enqueue_script`. This can improve the site\'s performance due to script concatenation.', + ], + 195 => [ + 'Stylesheets should be registered/enqueued via `wp_enqueue_style`. This can improve the site\'s performance due to styles concatenation.', + ], + 196 => [ + 'Stylesheets should be registered/enqueued via `wp_enqueue_style`. This can improve the site\'s performance due to styles concatenation.', + ], + ], +]; + +require __DIR__ . '/../tests/RulesetTest.php'; + +// Run the tests! +$test = new RulesetTest( 'WordPress-VIP-Go', $expected ); +if ( $test->passes() ) { + printf( 'All WordPress-VIP-Go tests passed!' . PHP_EOL ); + exit( 0 ); +} + +exit( 1 ); diff --git a/vendor/automattic/vipwpcs/WordPress-VIP-Go/ruleset.xml b/vendor/automattic/vipwpcs/WordPress-VIP-Go/ruleset.xml new file mode 100644 index 00000000..8cd531c3 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPress-VIP-Go/ruleset.xml @@ -0,0 +1,255 @@ + + + WordPress VIP Go Coding Standards + + + + + + + + warning + 6 + File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as %s(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/ + + + warning + 6 + File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as %s(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/ + + + warning + 6 + File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as %s(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/ + + + warning + 6 + File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as %s(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/ + + + warning + 6 + File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as %s(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/ + + + warning + 6 + File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as %s(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/ + + + warning + 6 + File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as %s(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/ + + + warning + 6 + File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as %s(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/ + + + warning + 6 + File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as %s(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/ + + + warning + 6 + File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as %s(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/ + + + warning + 6 + File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as %s(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/ + + + warning + 6 + File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as %s(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/ + + + warning + 6 + File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as %s(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/ + + + warning + 6 + File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as %s(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/ + + + warning + 6 + Removal of admin bar is highly discouraged for user roles of "administrator" and "vip_support" -- if these roles are already excluded, this warning can be ignored. + + + warning + 6 + Hiding of admin bar is highly discouraged for user roles of "administrator" and "vip_support" -- if these roles are already excluded, this warning can be ignored. + + + 6 + + + error + 6 + + + error + 6 + + + + + + + File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as %s(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/ + + + %s() is uncached. If the function is being used to fetch a remote file (e.g. a URL starting with https://), please use wpcom_vip_file_get_contents() to ensure the results are cached. For more details, please see: https://docs.wpvip.com/technical-references/code-quality-and-best-practices/retrieving-remote-data/ + + + + + + + warning + 10 + + + Having more than 100 posts returned per page may lead to severe performance problems. + + + 10 + + + 10 + + + 7 + + + + + + warning + %s() is uncached, please use wpcom_vip_attachment_url_to_postid() instead. + + + warning + + + warning + + + warning + + + warning + + + warning + + + warning + 3 + %s() is uncached and performs a no limit query. Please use get_posts or WP_Query instead. Please see: https://docs.wpvip.com/technical-references/caching/uncached-functions/ + + + 3 + + + 3 + + + warning + %s() is uncached, please use wpcom_vip_url_to_postid() instead. + + + warning + + + + + 1 + + + 1 + + + 1 + + + 3 + + + 3 + + + 3 + + + 3 + + + + 1 + + + warning + 3 + Scripts should be registered/enqueued via `wp_enqueue_script`. This can improve the site's performance due to script concatenation. + + + warning + 3 + Stylesheets should be registered/enqueued via `wp_enqueue_style`. This can improve the site's performance due to styles concatenation. + + + 3 + + + warning + 3 + + + 3 + + + 3 + + + 1 + + + 1 + + + 3 + + + 3 + + + + + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/AbstractVariableRestrictionsSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/AbstractVariableRestrictionsSniff.php new file mode 100644 index 00000000..06b61bfb --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/AbstractVariableRestrictionsSniff.php @@ -0,0 +1,233 @@ +setup_groups() === false ) { + return []; + } + + return [ + \T_VARIABLE, + \T_OBJECT_OPERATOR, + \T_DOUBLE_COLON, + \T_OPEN_SQUARE_BRACKET, + \T_DOUBLE_QUOTED_STRING, + \T_HEREDOC, + ]; + } + + /** + * Groups of variables to restrict. + * + * This method should be overridden in extending classes. + * + * Example: groups => array( + * 'wpdb' => array( + * 'type' => 'error' | 'warning', + * 'message' => 'Dont use this one please!', + * 'variables' => array( '$val', '$var' ), + * 'object_vars' => array( '$foo->bar', .. ), + * 'array_members' => array( '$foo['bar']', .. ), + * ) + * ) + * + * @return array + */ + abstract public function getGroups(); + + /** + * Cache the groups. + * + * @return bool True if the groups were setup. False if not. + */ + protected function setup_groups() { + $this->groups_cache = $this->getGroups(); + + if ( empty( $this->groups_cache ) && empty( self::$groups ) ) { + return false; + } + + // Allow for adding extra unit tests. + if ( ! empty( self::$groups ) ) { + $this->groups_cache = array_merge( $this->groups_cache, self::$groups ); + } + + return true; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @param int $stackPtr The position of the current token in the stack. + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + * + * @throws \PHP_CodeSniffer\Exceptions\RuntimeException Exception. + */ + public function process_token( $stackPtr ) { + + $token = $this->tokens[ $stackPtr ]; + + $this->excluded_groups = RulesetPropertyHelper::merge_custom_array( $this->exclude ); + if ( array_diff_key( $this->groups_cache, $this->excluded_groups ) === [] ) { + // All groups have been excluded. + // Don't remove the listener as the exclude property can be changed inline. + return; + } + + // Check if it is a function not a variable. + if ( \in_array( $token['code'], [ \T_OBJECT_OPERATOR, \T_DOUBLE_COLON ], true ) ) { // This only works for object vars and array members. + $method = $this->phpcsFile->findNext( \T_WHITESPACE, $stackPtr + 1, null, true ); + $possible_parenthesis = $this->phpcsFile->findNext( \T_WHITESPACE, $method + 1, null, true ); + if ( $this->tokens[ $possible_parenthesis ]['code'] === \T_OPEN_PARENTHESIS ) { + return; // So .. it is a function after all ! + } + } + + if ( ContextHelper::is_in_isset_or_empty( $this->phpcsFile, $stackPtr ) === true ) { + // Checking whether a variable exists is not the same as using it. + return; + } + + foreach ( $this->groups_cache as $groupName => $group ) { + + if ( isset( $this->excluded_groups[ $groupName ] ) ) { + continue; + } + + $patterns = []; + + // Simple variable. + if ( \in_array( $token['code'], [ \T_VARIABLE, \T_DOUBLE_QUOTED_STRING, \T_HEREDOC ], true ) && ! empty( $group['variables'] ) ) { + $patterns = array_merge( $patterns, $group['variables'] ); + $var = $token['content']; + + } + + if ( \in_array( $token['code'], [ \T_OBJECT_OPERATOR, \T_DOUBLE_COLON, \T_DOUBLE_QUOTED_STRING, \T_HEREDOC ], true ) && ! empty( $group['object_vars'] ) ) { + // Object var, ex: $foo->bar / $foo::bar / Foo::bar / Foo::$bar . + $patterns = array_merge( $patterns, $group['object_vars'] ); + + $owner = $this->phpcsFile->findPrevious( [ \T_VARIABLE, \T_STRING ], $stackPtr ); + $child = $this->phpcsFile->findNext( [ \T_STRING, \T_VARIABLE ], $stackPtr ); + $var = implode( '', [ $this->tokens[ $owner ]['content'], $token['content'], $this->tokens[ $child ]['content'] ] ); + + } + + if ( \in_array( $token['code'], [ \T_OPEN_SQUARE_BRACKET, \T_DOUBLE_QUOTED_STRING, \T_HEREDOC ], true ) && ! empty( $group['array_members'] ) ) { + // Array members. + $patterns = array_merge( $patterns, $group['array_members'] ); + + if ( isset( $token['bracket_closer'] ) ) { + $owner = $this->phpcsFile->findPrevious( \T_VARIABLE, $stackPtr ); + $inside = GetTokensAsString::normal( $this->phpcsFile, $stackPtr, $token['bracket_closer'] ); + $var = implode( '', [ $this->tokens[ $owner ]['content'], $inside ] ); + } + } + + if ( empty( $patterns ) ) { + continue; + } + + $patterns = array_map( [ $this, 'test_patterns' ], $patterns ); + $pattern = implode( '|', $patterns ); + $delim = ( $token['code'] !== \T_OPEN_SQUARE_BRACKET && $token['code'] !== \T_HEREDOC ) ? '\b' : ''; + + if ( $token['code'] === \T_DOUBLE_QUOTED_STRING || $token['code'] === \T_HEREDOC ) { + $var = $token['content']; + } + + if ( empty( $var ) || preg_match( '#(' . $pattern . ')' . $delim . '#', $var, $match ) !== 1 ) { + continue; + } + + $code = MessageHelper::stringToErrorcode( $groupName . '_' . $match[1] ); + MessageHelper::addMessage( + $this->phpcsFile, + $group['message'], + $stackPtr, + $group['type'] === 'error', + $code, + [ $var ] + ); + + return; // Show one error only. + } + } + + /** + * Transform a wildcard pattern to a usable regex pattern. + * + * @param string $pattern Pattern. + * @return string + */ + private function test_patterns( $pattern ) { + $pattern = preg_quote( $pattern, '#' ); + $pattern = preg_replace( + [ '#\\\\\*#', '[\'"]' ], + [ '.*', '\'' ], + $pattern + ); + return $pattern; + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Classes/DeclarationCompatibilitySniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Classes/DeclarationCompatibilitySniff.php new file mode 100644 index 00000000..a71b4907 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Classes/DeclarationCompatibilitySniff.php @@ -0,0 +1,360 @@ +>> + */ + public $checkClasses = [ + 'WP_Widget' => [ + 'widget' => [ 'args', 'instance' ], + 'update' => [ 'new_instance', 'old_instance' ], + 'form' => [ 'instance' ], + 'WP_Widget' => [ + 'id_base', + 'name', + 'widget_options' => [ + 'default' => 'array()', + ], + 'control_options' => [ + 'default' => 'array()', + ], + ], + 'get_field_name' => [ 'field_name' ], + 'get_field_id' => [ 'field_name' ], + '_register' => [], + '_set' => [ 'number' ], + '_get_display_callback' => [], + '_get_update_callback' => [], + '_get_form_callback' => [], + 'is_preview' => [], + 'display_callback' => [ + 'args', + 'widget_args' => [ + 'default' => '1', + ], + ], + 'update_callback' => [ + 'deprecated' => [ + 'default' => '1', + ], + ], + 'form_callback' => [ + 'widget_args' => [ + 'default' => '1', + ], + ], + 'register_one' => [ + 'number' => [ + 'default' => '-1', + ], + ], + 'save_settings' => [ 'settings' ], + 'get_settings' => [], + ], + 'Walker' => [ + 'start_lvl' => [ + 'output' => [ + 'pass_by_reference' => true, + ], + 'depth' => [ + 'default' => '0', + ], + 'args' => [ + 'default' => 'array()', + ], + ], + 'end_lvl' => [ + 'output' => [ + 'pass_by_reference' => true, + ], + 'depth' => [ + 'default' => '0', + ], + 'args' => [ + 'default' => 'array()', + ], + ], + 'start_el' => [ + 'output' => [ + 'pass_by_reference' => true, + ], + 'data_object', + 'depth' => [ + 'default' => '0', + ], + 'args' => [ + 'default' => 'array()', + ], + 'current_object_id' => [ + 'default' => '0', + ], + ], + 'end_el' => [ + 'output' => [ + 'pass_by_reference' => true, + ], + 'data_object', + 'depth' => [ + 'default' => '0', + ], + 'args' => [ + 'default' => 'array()', + ], + ], + 'display_element' => [ + 'element', + 'children_elements' => [ + 'pass_by_reference' => true, + ], + 'max_depth', + 'depth', + 'args', + 'output' => [ + 'pass_by_reference' => true, + ], + ], + 'walk' => [ + 'elements', + 'max_depth', + 'args' => [ + 'variable_length' => true, + ], + ], + 'paged_walk' => [ + 'elements', + 'max_depth', + 'page_num', + 'per_page', + 'args' => [ + 'variable_length' => true, + ], + ], + 'get_number_of_root_elements' => [ + 'elements', + ], + 'unset_children' => [ + 'element', + 'children_elements' => [ + 'pass_by_reference' => true, + ], + ], + ], + ]; + + /** + * List of grouped classes with same methods (as they extend the same parent class) + * + * @var array + */ + public $checkClassesGroups = [ + 'Walker' => [ + 'Walker_Category_Checklist', + 'Walker_Category', + 'Walker_CategoryDropdown', + 'Walker_PageDropdown', + 'Walker_Nav_Menu', + 'Walker_Page', + 'Walker_Comment', + ], + ]; + + /** + * Constructs the test with the tokens it wishes to listen for. + */ + public function __construct() { + parent::__construct( [ T_CLASS ], [ T_FUNCTION ], true ); + } + + /** + * Processes this test when one of its tokens is encountered. + * + * @param File $phpcsFile The PHP_CodeSniffer file where the token was found. + * @param int $stackPtr The position of the current token in the stack passed in $tokens. + * @param int $currScope A pointer to the start of the scope. + * + * @return void + */ + protected function processTokenWithinScope( File $phpcsFile, $stackPtr, $currScope ) { + + $className = ObjectDeclarations::getName( $phpcsFile, $currScope ); + + if ( $className !== $this->currentClass ) { + $this->currentClass = $className; + } + + $methodName = FunctionDeclarations::getName( $phpcsFile, $stackPtr ); + + $parentClassName = ObjectDeclarations::findExtendedClassName( $phpcsFile, $currScope ); + if ( $parentClassName === false ) { + // This class does not extend any other class. + return; + } + + // Need to define the originalParentClassName since we might override the parentClassName due to signature notations grouping. + $originalParentClassName = $parentClassName; + + if ( array_key_exists( $parentClassName, $this->checkClasses ) === false ) { + // This class does not extend a class we are interested in. + foreach ( $this->checkClassesGroups as $parent => $children ) { + // But it might be one of the grouped classes. + foreach ( $children as $child ) { + if ( $child === $parentClassName ) { + $parentClassName = $parent; + break 2; + } + } + } + if ( array_key_exists( $parentClassName, $this->checkClasses ) === false ) { + // This class really does not extend a class we are interested in. + return; + } + } + + if ( array_key_exists( $methodName, $this->checkClasses[ $parentClassName ] ) === false && + in_array( $methodName, $this->checkClasses[ $parentClassName ], true ) === false + ) { + // This method is not a one we are interested in. + return; + } + + $signatureParams = FunctionDeclarations::getParameters( $phpcsFile, $stackPtr ); + + $parentSignature = $this->checkClasses[ $parentClassName ][ $methodName ]; + + if ( count( $signatureParams ) > count( $parentSignature ) ) { + $extra_params = array_slice( $signatureParams, count( $parentSignature ) - count( $signatureParams ) ); + $all_extra_params_have_default = true; + foreach ( $extra_params as $extra_param ) { + if ( array_key_exists( 'default', $extra_param ) === false || $extra_param['default'] !== 'true' ) { + $all_extra_params_have_default = false; + } + } + if ( $all_extra_params_have_default === true ) { + return; // We're good. + } + } + + if ( count( $signatureParams ) !== count( $parentSignature ) ) { + $this->addError( $originalParentClassName, $methodName, $signatureParams, $parentSignature, $phpcsFile, $stackPtr ); + return; + } + + $i = 0; + foreach ( $parentSignature as $key => $param ) { + if ( is_array( $param ) === true ) { + if ( + ( + array_key_exists( 'default', $param ) === true && + array_key_exists( 'default', $signatureParams[ $i ] ) === false + ) || ( + array_key_exists( 'pass_by_reference', $param ) === true && + $param['pass_by_reference'] !== $signatureParams[ $i ]['pass_by_reference'] + ) || ( + array_key_exists( 'variable_length', $param ) === true && + $param['variable_length'] !== $signatureParams[ $i ]['variable_length'] + ) + ) { + $this->addError( $originalParentClassName, $methodName, $signatureParams, $parentSignature, $phpcsFile, $stackPtr ); + return; + } + } + ++$i; + } + } + + /** + * Generates an error with nice current and parent class method notations + * + * @param string $parentClassName The name of the extended (parent) class. + * @param string $methodName The name of the method currently being examined. + * @param array $currentMethodSignature The list of params and their options of the method which is being examined. + * @param array $parentMethodSignature The list of params and their options of the parent class method. + * @param File $phpcsFile The PHP_CodeSniffer file where the token was found. + * @param int $stackPtr The position of the current token in the stack. + * + * @return void + */ + private function addError( $parentClassName, $methodName, $currentMethodSignature, $parentMethodSignature, $phpcsFile, $stackPtr ) { + + $currentSignature = sprintf( '%s::%s(%s)', $this->currentClass, $methodName, implode( ', ', $this->generateParamList( $currentMethodSignature ) ) ); + + $parentSignature = sprintf( '%s::%s(%s)', $parentClassName, $methodName, implode( ', ', $this->generateParamList( $parentMethodSignature ) ) ); + + $message = 'Declaration of `%s` should be compatible with `%s`.'; + $data = [ $currentSignature, $parentSignature ]; + $phpcsFile->addError( $message, $stackPtr, 'DeclarationCompatibility', $data ); + } + + /** + * Generates an array of params as they appear in the signature. + * + * @param array $methodSignature Signature of a method. + * + * @return array + */ + private function generateParamList( $methodSignature ) { + $paramList = []; + foreach ( $methodSignature as $param => $options ) { + $paramName = '$'; + if ( is_array( $options ) === false ) { + $paramList[] = '$' . $options; + continue; + } + + if ( array_key_exists( 'name', $options ) === true ) { + $paramName = $options['name']; + } else { + $paramName .= $param; + } + + if ( array_key_exists( 'variable_length', $options ) === true && $options['variable_length'] === true ) { + $paramName = '...' . $paramName; + } + + if ( array_key_exists( 'pass_by_reference', $options ) === true && $options['pass_by_reference'] === true ) { + $paramName = '&' . $paramName; + } + + if ( array_key_exists( 'default', $options ) === true && empty( $options['default'] ) === false ) { + $paramName .= ' = ' . trim( $options['default'] ); + } + + $paramList[] = $paramName; + } + + return $paramList; + } + + /** + * Do nothing outside the scope. Has to be implemented accordingly to parent abstract class. + * + * @param File $phpcsFile PHPCS File. + * @param int $stackPtr Stack position. + */ + public function processTokenOutsideScope( File $phpcsFile, $stackPtr ) {} +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Classes/RestrictedExtendClassesSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Classes/RestrictedExtendClassesSniff.php new file mode 100644 index 00000000..a8b076a2 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Classes/RestrictedExtendClassesSniff.php @@ -0,0 +1,58 @@ + [ + 'type' => 'warning', + 'message' => 'We recommend extending `WPCOM_VIP_CLI_Command` instead of `WP_CLI_Command` and using the helper functions available in it (such as `stop_the_insanity()`), see https://vip.wordpress.com/documentation/writing-bin-scripts/ for more information.', + 'classes' => [ + 'WP_CLI_Command', + ], + ], + ]; + } + + /** + * Process a matched token. + * + * @param int $stackPtr The position of the current token in the stack. + * @param string $group_name The name of the group which was matched. + * @param string $matched_content The token content (class name) which was matched + * in lowercase. + * + * @return void + */ + public function process_matched_token( $stackPtr, $group_name, $matched_content ) { + $tokens = $this->phpcsFile->getTokens(); + + if ( $tokens[ $stackPtr ]['code'] !== T_EXTENDS ) { + // If not extending, bail. + return; + } + + foreach ( $this->getGroups() as $group => $group_args ) { + $this->phpcsFile->{ 'add' . $group_args['type'] }( $group_args['message'], $stackPtr, $group ); + } + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Constants/ConstantStringSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Constants/ConstantStringSniff.php new file mode 100644 index 00000000..b2a8dafb --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Constants/ConstantStringSniff.php @@ -0,0 +1,78 @@ +tokens[ $stackPtr ]['content'], [ 'define', 'defined' ], true ) === false ) { + return; + } + + // Find the next non-empty token. + $nextToken = $this->phpcsFile->findNext( Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true ); + + if ( $this->tokens[ $nextToken ]['code'] !== T_OPEN_PARENTHESIS ) { + // Not a function call. + return; + } + + if ( isset( $this->tokens[ $nextToken ]['parenthesis_closer'] ) === false ) { + // Not a function call. + return; + } + + $param = PassedParameters::getParameter( $this->phpcsFile, $stackPtr, 1, 'constant_name' ); + if ( $param === false ) { + // Target parameter not found. + return; + } + + $search = Tokens::$emptyTokens; + $search[ T_STRING ] = T_STRING; + + $has_only_tstring = $this->phpcsFile->findNext( $search, $param['start'], $param['end'] + 1, true ); + if ( $has_only_tstring !== false ) { + // Came across something other than a T_STRING token. Ignore. + return; + } + + $tstring_token = $this->phpcsFile->findNext( T_STRING, $param['start'], $param['end'] + 1 ); + + $message = 'Constant name, as a string, should be used along with `%s()`.'; + $data = [ $this->tokens[ $stackPtr ]['content'] ]; + $this->phpcsFile->addError( $message, $tstring_token, 'NotCheckingConstantName', $data ); + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Constants/RestrictedConstantsSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Constants/RestrictedConstantsSniff.php new file mode 100644 index 00000000..619c2631 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Constants/RestrictedConstantsSniff.php @@ -0,0 +1,110 @@ +tokens[ $stackPtr ]['code'] === T_STRING ) { + $constantName = $this->tokens[ $stackPtr ]['content']; + } else { + $constantName = trim( $this->tokens[ $stackPtr ]['content'], "\"'" ); + } + + if ( in_array( $constantName, $this->restrictedConstantNames, true ) === false && in_array( $constantName, $this->restrictedConstantDeclaration, true ) === false ) { + // Not the constant we are looking for. + return; + } + + if ( $this->tokens[ $stackPtr ]['code'] === T_STRING && in_array( $constantName, $this->restrictedConstantNames, true ) === true ) { + $message = 'Code is touching the `%s` constant. Make sure it\'s used appropriately.'; + $data = [ $constantName ]; + $this->phpcsFile->addWarning( $message, $stackPtr, 'UsingRestrictedConstant', $data ); + return; + } + + // Find the previous non-empty token. + $openBracket = $this->phpcsFile->findPrevious( Tokens::$emptyTokens, $stackPtr - 1, null, true, null, true ); + + if ( $this->tokens[ $openBracket ]['code'] !== T_OPEN_PARENTHESIS ) { + // Not a function call. + return; + } + + if ( isset( $this->tokens[ $openBracket ]['parenthesis_closer'] ) === false ) { + // Not a function call. + return; + } + + // Find the previous non-empty token. + $search = Tokens::$emptyTokens; + $search[] = T_BITWISE_AND; + $previous = $this->phpcsFile->findPrevious( $search, $openBracket - 1, null, true ); + if ( $this->tokens[ $previous ]['code'] === T_FUNCTION ) { + // It's a function definition, not a function call. + return; + } + + if ( in_array( $this->tokens[ $previous ]['code'], Tokens::$functionNameTokens, true ) === true ) { + $data = [ $constantName ]; + if ( $this->tokens[ $previous ]['content'] === 'define' ) { + $message = 'The definition of `%s` constant is prohibited. Please use a different name.'; + $this->phpcsFile->addError( $message, $previous, 'DefiningRestrictedConstant', $data ); + } elseif ( in_array( $constantName, $this->restrictedConstantNames, true ) === true ) { + $message = 'Code is touching the `%s` constant. Make sure it\'s used appropriately.'; + $this->phpcsFile->addWarning( $message, $previous, 'UsingRestrictedConstant', $data ); + } + } + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Files/IncludingFileSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Files/IncludingFileSniff.php new file mode 100644 index 00000000..f1bfc2db --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Files/IncludingFileSniff.php @@ -0,0 +1,226 @@ + 'get_template_directory', + 'STYLESHEETPATH' => 'get_stylesheet_directory', + ]; + + /** + * List of allowed constants. + * + * @var array + */ + public $allowedConstants = [ + 'ABSPATH', + 'WP_CONTENT_DIR', + 'WP_PLUGIN_DIR', + ]; + + /** + * List of keywords allowed for use in custom constants. + * Note: Customizing this property will overwrite current default values. + * + * @var array + */ + public $allowedKeywords = [ + 'PATH', + 'DIR', + ]; + + /** + * Functions used for modify slashes. + * + * @var array + */ + public $slashingFunctions = [ + 'trailingslashit', + 'user_trailingslashit', + 'untrailingslashit', + ]; + + /** + * Groups of functions to restrict. + * + * @return array + */ + public function getGroups() { + return []; + } + + /** + * Returns an array of tokens this test wants to listen for. + * + * @return array + */ + public function register() { + return Tokens::$includeTokens; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @param int $stackPtr The position of the current token in the stack. + * + * @return void + */ + public function process_token( $stackPtr ) { + $nextToken = $this->phpcsFile->findNext( Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true ); + + if ( $this->tokens[ $nextToken ]['code'] === T_OPEN_PARENTHESIS ) { + // The construct is using parenthesis, grab the next non empty token. + $nextToken = $this->phpcsFile->findNext( Tokens::$emptyTokens, $nextToken + 1, null, true, null, true ); + } + + if ( $this->tokens[ $nextToken ]['code'] === T_DIR || $this->tokens[ $nextToken ]['content'] === '__DIR__' ) { + // The construct is using __DIR__ which is fine. + return; + } + + if ( $this->tokens[ $nextToken ]['code'] === T_VARIABLE ) { + $message = 'File inclusion using variable (`%s`). Probably needs manual inspection.'; + $data = [ $this->tokens[ $nextToken ]['content'] ]; + $this->phpcsFile->addWarning( $message, $nextToken, 'UsingVariable', $data ); + return; + } + + if ( $this->tokens[ $nextToken ]['code'] === T_STRING ) { + if ( in_array( $this->tokens[ $nextToken ]['content'], $this->getPathFunctions, true ) === true ) { + // The construct is using one of the functions for getting correct path which is fine. + return; + } + + if ( in_array( $this->tokens[ $nextToken ]['content'], $this->allowedConstants, true ) === true ) { + // The construct is using one of the allowed constants which is fine. + return; + } + + if ( $this->has_custom_path( $this->tokens[ $nextToken ]['content'] ) === true ) { + // The construct is using a constant with an allowed keyword. + return; + } + + if ( array_key_exists( $this->tokens[ $nextToken ]['content'], $this->restrictedConstants ) === true ) { + // The construct is using one of the restricted constants. + $message = '`%s` constant might not be defined or available. Use `%s()` instead.'; + $data = [ $this->tokens[ $nextToken ]['content'], $this->restrictedConstants[ $this->tokens[ $nextToken ]['content'] ] ]; + $this->phpcsFile->addError( $message, $nextToken, 'RestrictedConstant', $data ); + return; + } + + $nextNextToken = $this->phpcsFile->findNext( array_merge( Tokens::$emptyTokens, [ T_COMMENT ] ), $nextToken + 1, null, true, null, true ); + if ( preg_match( '/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $this->tokens[ $nextToken ]['content'] ) === 1 && $this->tokens[ $nextNextToken ]['code'] !== T_OPEN_PARENTHESIS ) { + // The construct is using custom constant, which needs manual inspection. + $message = 'File inclusion using custom constant (`%s`). Probably needs manual inspection.'; + $data = [ $this->tokens[ $nextToken ]['content'] ]; + $this->phpcsFile->addWarning( $message, $nextToken, 'UsingCustomConstant', $data ); + return; + } + + if ( strpos( $this->tokens[ $nextToken ]['content'], '$' ) === 0 ) { + $message = 'File inclusion using variable (`%s`). Probably needs manual inspection.'; + $data = [ $this->tokens[ $nextToken ]['content'] ]; + $this->phpcsFile->addWarning( $message, $nextToken, 'UsingVariable', $data ); + return; + } + + if ( in_array( $this->tokens[ $nextToken ]['content'], $this->slashingFunctions, true ) === true ) { + // The construct is using one of the slashing functions, it's probably correct. + return; + } + + if ( $this->is_targetted_token( $nextToken ) ) { + $message = 'File inclusion using custom function ( `%s()` ). Must return local file source, as external URLs are prohibited on WordPress VIP. Probably needs manual inspection.'; + $data = [ $this->tokens[ $nextToken ]['content'] ]; + $this->phpcsFile->addWarning( $message, $nextToken, 'UsingCustomFunction', $data ); + return; + } + + $message = 'Absolute include path must be used. Use `get_template_directory()`, `get_stylesheet_directory()` or `plugin_dir_path()`.'; + $this->phpcsFile->addError( $message, $nextToken, 'NotAbsolutePath' ); + return; + } + + if ( $this->tokens[ $nextToken ]['code'] === T_CONSTANT_ENCAPSED_STRING && filter_var( str_replace( [ '"', "'" ], '', $this->tokens[ $nextToken ]['content'] ), FILTER_VALIDATE_URL ) ) { + $message = 'Include path must be local file source, external URLs are prohibited on WordPress VIP.'; + $this->phpcsFile->addError( $message, $nextToken, 'ExternalURL' ); + return; + } + + $message = 'Absolute include path must be used. Use `get_template_directory()`, `get_stylesheet_directory()` or `plugin_dir_path()`.'; + $this->phpcsFile->addError( $message, $nextToken, 'NotAbsolutePath' ); + } + + /** + * Check if a content string contains a keyword in custom paths. + * + * @param string $content Content string. + * + * @return bool True if the string partially matches a keyword in $allowedCustomKeywords, false otherwise. + */ + private function has_custom_path( $content ) { + foreach ( $this->allowedKeywords as $keyword ) { + if ( strpos( $content, $keyword ) !== false ) { + return true; + } + } + + return false; + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Files/IncludingNonPHPFileSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Files/IncludingNonPHPFileSniff.php new file mode 100644 index 00000000..ab32dc9f --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Files/IncludingNonPHPFileSniff.php @@ -0,0 +1,103 @@ + true, + 'inc' => true, + 'phar' => true, + ]; + + /** + * File extensions used for SVG and CSS files. + * + * @var array Key is the extension, value is irrelevant. + */ + private $svg_css_extensions = [ + 'css' => true, + 'svg' => true, + ]; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @return array + */ + public function register() { + return Tokens::$includeTokens; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @param int $stackPtr The position of the current token in the stack passed in $tokens. + * + * @return void + */ + public function process_token( $stackPtr ) { + $end_of_statement = BCFile::findEndOfStatement( $this->phpcsFile, $stackPtr ); + $curStackPtr = ( $end_of_statement + 1 ); + + do { + $curStackPtr = $this->phpcsFile->findPrevious( Tokens::$stringTokens, $curStackPtr - 1, $stackPtr ); + if ( $curStackPtr === false ) { + return; + } + + $stringWithoutEnclosingQuotationMarks = trim( $this->tokens[ $curStackPtr ]['content'], "\"'" ); + + $isFileName = preg_match( '`\.([a-z]{2,})$`i', $stringWithoutEnclosingQuotationMarks, $regexMatches ); + + if ( $isFileName !== 1 ) { + continue; + } + + $extension = strtolower( $regexMatches[1] ); + if ( isset( $this->php_extensions[ $extension ] ) === true ) { + return; + } + + $message = 'Local non-PHP file should be loaded via `file_get_contents` rather than via `%s`. Found: %s'; + $data = [ + strtolower( $this->tokens[ $stackPtr ]['content'] ), + $this->tokens[ $curStackPtr ]['content'], + ]; + $code = 'IncludingNonPHPFile'; + + if ( isset( $this->svg_css_extensions[ $extension ] ) === true ) { + // Be more specific for SVG and CSS files. + $message = 'Local SVG and CSS files should be loaded via `file_get_contents` rather than via `%s`. Found: %s'; + $code = 'IncludingSVGCSSFile'; + } + + $this->phpcsFile->addError( $message, $curStackPtr, $code, $data ); + + // Don't throw more than one error for any one statement. + return; + + } while ( $curStackPtr > $stackPtr ); + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Functions/CheckReturnValueSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Functions/CheckReturnValueSniff.php new file mode 100644 index 00000000..5eb40b2f --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Functions/CheckReturnValueSniff.php @@ -0,0 +1,318 @@ + + * echo esc_url( wpcom_vip_get_term_link( $term ) ); + * + */ +class CheckReturnValueSniff extends Sniff { + + /** + * Pairs we are about to check. + * + * @var array + */ + public $catch = [ + 'esc_url' => [ + 'get_term_link', + ], + 'wp_list_pluck' => [ + 'get_the_tags', + 'get_the_terms', + ], + 'foreach' => [ + 'get_post_meta', + 'get_term_meta', + 'get_the_terms', + 'get_the_tags', + ], + 'array_key_exists' => [ + 'get_option', + ], + ]; + + /** + * Tokens we are about to examine, which are not functions. + * + * @var array + */ + public $notFunctions = [ + 'foreach' => T_FOREACH, + ]; + + /** + * Returns the token types that this sniff is interested in. + * + * @return array(int) + */ + public function register() { + return [ T_STRING ]; + } + + /** + * Processes the tokens that this sniff is interested in. + * + * @param int $stackPtr The position in the stack where + * the token was found. + * + * @return void + */ + public function process_token( $stackPtr ) { + + $this->findDirectFunctionCalls( $stackPtr ); + $this->findNonCheckedVariables( $stackPtr ); + } + + /** + * Check whether the currently examined code is a function call. + * + * @param int $stackPtr The position of the current token in the stack passed in $tokens. + * + * @return bool + */ + private function isFunctionCall( $stackPtr ) { + + if ( $this->tokens[ $stackPtr ]['code'] !== T_STRING ) { + return false; + } + + // Find the next non-empty token. + $openBracket = $this->phpcsFile->findNext( Tokens::$emptyTokens, $stackPtr + 1, null, true ); + + if ( $this->tokens[ $openBracket ]['code'] !== T_OPEN_PARENTHESIS ) { + // Not a function call. + return false; + } + + // Find the previous non-empty token. + $search = Tokens::$emptyTokens; + $search[] = T_BITWISE_AND; + $previous = $this->phpcsFile->findPrevious( $search, $stackPtr - 1, null, true ); + + // It's a function definition, not a function call, so return false. + return ! ( $this->tokens[ $previous ]['code'] === T_FUNCTION ); + } + + /** + * Check whether the examined code is a variable assignment. + * + * @param int $stackPtr The position of the current token in the stack passed in $tokens. + * + * @return int|false + */ + private function isVariableAssignment( $stackPtr ) { + + // Find the previous non-empty token. + $search = Tokens::$emptyTokens; + $search[] = T_BITWISE_AND; + $previous = $this->phpcsFile->findPrevious( $search, $stackPtr - 1, null, true ); + + if ( $this->tokens[ $previous ]['code'] !== T_EQUAL ) { + // It's not a variable assignment. + return false; + } + + $previous = $this->phpcsFile->findPrevious( $search, $previous - 1, null, true ); + + if ( $this->tokens[ $previous ]['code'] !== T_VARIABLE ) { + // It's not a variable assignment. + return false; + } + + return $previous; + } + + /** + * Find instances in which a function call is directly passed to another one w/o checking the return type + * + * @param int $stackPtr The position of the current token in the stack passed in $tokens. + * + * @return void + */ + public function findDirectFunctionCalls( $stackPtr ) { + + $functionName = $this->tokens[ $stackPtr ]['content']; + + if ( array_key_exists( $functionName, $this->catch ) === false ) { + // Not a function we are looking for. + return; + } + + if ( $this->isFunctionCall( $stackPtr ) === false ) { + // Not a function call. + return; + } + + // Find the next non-empty token. + $openBracket = $this->phpcsFile->findNext( Tokens::$emptyTokens, $stackPtr + 1, null, true ); + + // Find the closing bracket. + $closeBracket = $this->tokens[ $openBracket ]['parenthesis_closer']; + + $startNext = $openBracket + 1; + $next = $this->phpcsFile->findNext( T_STRING, $startNext, $closeBracket, false, null, true ); + while ( $next ) { + if ( in_array( $this->tokens[ $next ]['content'], $this->catch[ $functionName ], true ) === true ) { + $message = "`%s`'s return type must be checked before calling `%s` using that value."; + $data = [ $this->tokens[ $next ]['content'], $functionName ]; + $this->phpcsFile->addError( $message, $next, 'DirectFunctionCall', $data ); + } + $next = $this->phpcsFile->findNext( T_STRING, $next + 1, $closeBracket, false, null, true ); + } + } + + /** + * Deals with situations in which the variable is being used later in the code along with a function which is known for causing issues. + * + * This only catches situations in which the variable is not being used with some other function before it's interacting with function we look for. + * That's currently necessary in order to prevent false positives. + * + * @param int $stackPtr The position of the current token in the stack passed in $tokens. + * + * @return void + */ + public function findNonCheckedVariables( $stackPtr ) { + + $functionName = $this->tokens[ $stackPtr ]['content']; + + $isFunctionWeLookFor = false; + + $callees = []; + + foreach ( $this->catch as $callee => $checkReturnArray ) { + if ( in_array( $functionName, $checkReturnArray, true ) === true ) { + $isFunctionWeLookFor = true; + $callees[] = $callee; + } + } + + if ( $isFunctionWeLookFor === false ) { + // Not a function we are looking for. + return; + } + + if ( $this->isFunctionCall( $stackPtr ) === false ) { + // Not a function call. + return; + } + + $variablePos = $this->isVariableAssignment( $stackPtr ); + + if ( $variablePos === false ) { + // Not a variable assignment. + return; + } + + $variableToken = $this->tokens[ $variablePos ]; + $variableName = $variableToken['content']; + + // Find the next non-empty token. + $openBracket = $this->phpcsFile->findNext( Tokens::$emptyTokens, $stackPtr + 1, null, true ); + + // Find the closing bracket. + $closeBracket = $this->tokens[ $openBracket ]['parenthesis_closer']; + + if ( in_array( $functionName, [ 'get_post_meta', 'get_term_meta' ], true ) === true ) { + // Since the get_post_meta and get_term_meta always returns an array if $single is set to `true` we need to check for the value of it's third param before proceeding. + $params = []; + $paramNo = 1; + $prevCommaPos = $openBracket + 1; + + for ( $i = $openBracket + 1; $i <= $closeBracket; $i++ ) { + + if ( $this->tokens[ $i ]['code'] === T_OPEN_PARENTHESIS ) { + $i = $this->tokens[ $i ]['parenthesis_closer']; + } + + if ( $this->tokens[ $i ]['code'] === T_COMMA ) { + $params[ $paramNo++ ] = trim( array_reduce( array_slice( $this->tokens, $prevCommaPos, $i - $prevCommaPos ), [ $this, 'reduce_array' ] ) ); + $prevCommaPos = $i + 1; + } + + if ( $i === $closeBracket ) { + $params[ $paramNo ] = trim( array_reduce( array_slice( $this->tokens, $prevCommaPos, $i - $prevCommaPos ), [ $this, 'reduce_array' ] ) ); + break; + } + } + + if ( array_key_exists( 3, $params ) === false || $params[3] === 'false' ) { + // Third param of get_post_meta is not set (default to false) or is set to false. + // Means the function returns an array. We are good then. + return; + } + } + + $nextVariableOccurrence = $this->phpcsFile->findNext( T_VARIABLE, $closeBracket + 1, null, false, $variableName ); + + // Find previous non-empty token, which is not an open parenthesis, comma nor variable. + $search = Tokens::$emptyTokens; + $search[] = T_OPEN_PARENTHESIS; + // This allows us to check for variables which are passed as second parameter of a function e.g.: array_key_exists. + $search[] = T_COMMA; + $search[] = T_VARIABLE; + $search[] = T_CONSTANT_ENCAPSED_STRING; + + $nextFunctionCallWithVariable = $this->phpcsFile->findPrevious( $search, $nextVariableOccurrence - 1, null, true ); + + foreach ( $callees as $callee ) { + $notFunctionsCallee = array_key_exists( $callee, $this->notFunctions ) ? (array) $this->notFunctions[ $callee ] : []; + // Check whether the found token is one of the function calls (or foreach call) we are interested in. + if ( in_array( $this->tokens[ $nextFunctionCallWithVariable ]['code'], array_merge( [ T_STRING ], $notFunctionsCallee ), true ) === true + && $this->tokens[ $nextFunctionCallWithVariable ]['content'] === $callee + ) { + $this->addNonCheckedVariableError( $nextFunctionCallWithVariable, $variableName, $callee ); + return; + } + + $search = array_merge( Tokens::$emptyTokens, [ T_EQUAL ] ); + $next = $this->phpcsFile->findNext( $search, $nextVariableOccurrence + 1, null, true ); + if ( $this->tokens[ $next ]['code'] === T_STRING + && $this->tokens[ $next ]['content'] === $callee + ) { + $this->addNonCheckedVariableError( $next, $variableName, $callee ); + return; + } + } + } + + /** + * Function used as as callback for the array_reduce call. + * + * @param string|null $carry The final string. + * @param mixed $item Processed item. + * + * @return string + */ + public function reduce_array( $carry, $item ) { + return $carry . $item['content']; + } + + /** + * Consolidated violation. + * + * @param int $stackPtr The position in the stack where the token was found. + * @param string $variableName Variable name. + * @param string $callee Function name. + * + * @return void + */ + private function addNonCheckedVariableError( $stackPtr, $variableName, $callee ) { + $message = 'Type of `%s` must be checked before calling `%s()` using that variable.'; + $data = [ $variableName, $callee ]; + $this->phpcsFile->addError( $message, $stackPtr, 'NonCheckedVariable', $data ); + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Functions/DynamicCallsSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Functions/DynamicCallsSniff.php new file mode 100644 index 00000000..ca2f2acc --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Functions/DynamicCallsSniff.php @@ -0,0 +1,189 @@ + true, + 'compact' => true, + 'extract' => true, + 'func_get_args' => true, + 'func_get_arg' => true, + 'func_num_args' => true, + 'get_defined_vars' => true, + 'mb_parse_str' => true, + 'parse_str' => true, + ]; + + /** + * Array of variable assignments encountered, along with their values. + * + * Populated at run-time. + * + * @var array The key is the name of the variable, the value, its assigned value. + */ + private $variables_arr = []; + + /** + * The position in the stack where the token was found. + * + * @var int + */ + private $stackPtr; + + /** + * Returns the token types that this sniff is interested in. + * + * @return array(int) + */ + public function register() { + return [ T_VARIABLE => T_VARIABLE ]; + } + + /** + * Processes the tokens that this sniff is interested in. + * + * @param int $stackPtr The position in the stack where the token was found. + * + * @return void + */ + public function process_token( $stackPtr ) { + $this->stackPtr = $stackPtr; + + // First collect all variables encountered and their values. + $this->collect_variables(); + + // Then find all dynamic calls, and report them. + $this->find_dynamic_calls(); + } + + /** + * Finds any variable-definitions in the file being processed and stores them + * internally in a private array. + * + * @return void + */ + private function collect_variables() { + + $current_var_name = $this->tokens[ $this->stackPtr ]['content']; + + /* + * Find assignments ( $foo = "bar"; ) by finding all non-whitespaces, + * and checking if the first one is T_EQUAL. + */ + $t_item_key = $this->phpcsFile->findNext( + Tokens::$emptyTokens, + $this->stackPtr + 1, + null, + true, + null, + true + ); + + if ( $t_item_key === false || $this->tokens[ $t_item_key ]['code'] !== T_EQUAL ) { + return; + } + + /* + * Find assignments which only assign a plain text string. + */ + $end_of_statement = $this->phpcsFile->findNext( [ T_SEMICOLON, T_CLOSE_TAG ], ( $t_item_key + 1 ) ); + $value_ptr = null; + + for ( $i = $t_item_key + 1; $i < $end_of_statement; $i++ ) { + if ( isset( Tokens::$emptyTokens[ $this->tokens[ $i ]['code'] ] ) === true ) { + continue; + } + + if ( $this->tokens[ $i ]['code'] !== T_CONSTANT_ENCAPSED_STRING ) { + // Not a plain text string value. Value cannot be determined reliably. + return; + } + + $value_ptr = $i; + } + + if ( isset( $value_ptr ) === false ) { + // Parse error. Bow out. + return; + } + + /* + * If we reached the end of the loop and the $value_ptr was set, we know for sure + * this was a plain text string variable assignment. + */ + $current_var_value = TextStrings::stripQuotes( $this->tokens[ $value_ptr ]['content'] ); + + if ( isset( $this->disallowed_functions[ $current_var_value ] ) === false ) { + // Text string is not one of the ones we're looking for. + return; + } + + /* + * Register the variable name and value in the internal array for later usage. + */ + $this->variables_arr[ $current_var_name ] = $current_var_value; + } + + /** + * Find any dynamic calls being made using variables. + * + * Report on this when found, using the name of the function in the message. + * + * @return void + */ + private function find_dynamic_calls() { + // No variables detected; no basis for doing anything. + if ( empty( $this->variables_arr ) ) { + return; + } + + /* + * If variable is not found in our registry of variables, do nothing, as we cannot be + * sure that the function being called is one of the disallowed ones. + */ + if ( ! isset( $this->variables_arr[ $this->tokens[ $this->stackPtr ]['content'] ] ) ) { + return; + } + + /* + * Check if we have an '(' next. + */ + $next = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $this->stackPtr + 1 ), null, true ); + if ( $next === false || $this->tokens[ $next ]['code'] !== T_OPEN_PARENTHESIS ) { + return; + } + + $message = 'Dynamic calling is not recommended in the case of %s().'; + $data = [ $this->variables_arr[ $this->tokens[ $this->stackPtr ]['content'] ] ]; + $this->phpcsFile->addError( $message, $this->stackPtr, 'DynamicCalls', $data ); + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Functions/RestrictedFunctionsSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Functions/RestrictedFunctionsSniff.php new file mode 100644 index 00000000..4513140c --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Functions/RestrictedFunctionsSniff.php @@ -0,0 +1,347 @@ + [ + 'type' => 'error', + 'message' => '`%s` is prohibited on the WordPress VIP platform due to memory corruption.', + 'functions' => [ + 'opcache_reset', + 'opcache_invalidate', + 'opcache_compile_file', + ], + ], + 'config_settings' => [ + 'type' => 'error', + 'message' => '`%s` is not recommended for use on the WordPress VIP platform due to potential setting changes.', + 'functions' => [ + 'opcache_is_script_cached', + 'opcache_get_status', + 'opcache_get_configuration', + ], + ], + 'internal' => [ + 'type' => 'error', + 'message' => '`%1$s()` is for internal use only.', + 'functions' => [ + 'wpcom_vip_irc', + ], + ], + 'flush_rewrite_rules' => [ + 'type' => 'error', + 'message' => '`%s` should not be used in any normal circumstances in the theme code.', + 'functions' => [ + 'flush_rewrite_rules', + ], + ], + 'flush_rules' => [ + 'type' => 'error', + 'message' => '`%s` should not be used in any normal circumstances in the theme code.', + 'functions' => [ + 'flush_rules', + ], + 'object_var' => [ + '$wp_rewrite' => true, + ], + ], + 'attachment_url_to_postid' => [ + 'type' => 'error', + 'message' => '`%s()` is prohibited, please use `wpcom_vip_attachment_url_to_postid()` instead.', + 'functions' => [ + 'attachment_url_to_postid', + ], + ], + // @link https://docs.wpvip.com/technical-references/code-review/vip-notices/#h-switch_to_blog + 'switch_to_blog' => [ + 'type' => 'warning', + 'message' => '%s() may not work as expected since it only changes the database context for the blog and does not load the plugins or theme of that site. Filters or hooks on the blog you are switching to will not run.', + 'functions' => [ + 'switch_to_blog', + ], + ], + 'url_to_postid' => [ + 'type' => 'error', + 'message' => '%s() is prohibited, please use wpcom_vip_url_to_postid() instead.', + 'functions' => [ + 'url_to_postid', + ], + ], + // @link https://docs.wpvip.com/how-tos/customize-user-roles/ + 'custom_role' => [ + 'type' => 'error', + 'message' => 'Use wpcom_vip_add_role() instead of %s().', + 'functions' => [ + 'add_role', + ], + ], + 'count_user_posts' => [ + 'type' => 'error', + 'message' => '%s() is highly discouraged due to not being cached; please use wpcom_vip_count_user_posts() instead.', + 'functions' => [ + 'count_user_posts', + ], + ], + 'wp_old_slug_redirect' => [ + 'type' => 'error', + 'message' => '%s() is highly discouraged due to not being cached; please use wpcom_vip_old_slug_redirect() instead.', + 'functions' => [ + 'wp_old_slug_redirect', + ], + ], + 'get_adjacent_post' => [ + 'type' => 'error', + 'message' => '%s() is highly discouraged due to not being cached; please use wpcom_vip_get_adjacent_post() instead.', + 'functions' => [ + 'get_adjacent_post', + 'get_previous_post', + 'get_previous_post_link', + 'get_next_post', + 'get_next_post_link', + ], + ], + 'get_intermediate_image_sizes' => [ + 'type' => 'error', + 'message' => 'Intermediate images do not exist on the VIP platform, and thus get_intermediate_image_sizes() returns an empty array() on the platform. This behavior is intentional to prevent WordPress from generating multiple thumbnails when images are uploaded.', + 'functions' => [ + 'get_intermediate_image_sizes', + ], + ], + // @link https://docs.wpvip.com/technical-references/code-review/vip-warnings/#h-mobile-detection + 'wp_is_mobile' => [ + 'type' => 'error', + 'message' => '%s() found. When targeting mobile visitors, jetpack_is_mobile() should be used instead of wp_is_mobile. It is more robust and works better with full page caching.', + 'functions' => [ + 'wp_is_mobile', + ], + ], + 'session' => [ + 'type' => 'error', + 'message' => 'The use of PHP session function %s() is prohibited.', + 'functions' => [ + 'session_abort', + 'session_cache_expire', + 'session_cache_limiter', + 'session_commit', + 'session_create_id', + 'session_decode', + 'session_destroy', + 'session_encode', + 'session_gc', + 'session_get_cookie_params', + 'session_id', + 'session_is_registered', + 'session_module_name', + 'session_name', + 'session_regenerate_id', + 'session_register_shutdown', + 'session_register', + 'session_reset', + 'session_save_path', + 'session_set_cookie_params', + 'session_set_save_handler', + 'session_start', + 'session_status', + 'session_unregister', + 'session_unset', + 'session_write_close', + ], + ], + 'file_ops' => [ + 'type' => 'error', + 'message' => 'Filesystem writes are forbidden, please do not use %s().', + 'functions' => [ + 'file_put_contents', + 'flock', + 'fputcsv', + 'fputs', + 'fwrite', + 'ftruncate', + 'is_writable', + 'is_writeable', + 'link', + 'rename', + 'symlink', + 'tempnam', + 'touch', + 'unlink', + ], + ], + 'directory' => [ + 'type' => 'error', + 'message' => 'Filesystem writes are forbidden, please do not use %s().', + 'functions' => [ + 'mkdir', + 'rmdir', + ], + ], + 'chmod' => [ + 'type' => 'error', + 'message' => 'Filesystem writes are forbidden, please do not use %s().', + 'functions' => [ + 'chgrp', + 'chown', + 'chmod', + 'lchgrp', + 'lchown', + ], + ], + 'stats_get_csv' => [ + 'type' => 'error', + 'message' => 'Using `%s` outside of Jetpack context pollutes the stats_cache entry in the wp_options table. We recommend building a custom function instead.', + 'functions' => [ + 'stats_get_csv', + ], + ], + 'wp_mail' => [ + 'type' => 'warning', + 'message' => '`%s` should be used sparingly. For any bulk emailing should be handled by a 3rd party service, in order to prevent domain or IP addresses being flagged as spam.', + 'functions' => [ + 'wp_mail', + 'mail', + ], + ], + 'is_multi_author' => [ + 'type' => 'warning', + 'message' => '`%s` can be very slow on large sites and likely not needed on many VIP sites since they tend to have more than one author.', + 'functions' => [ + 'is_multi_author', + ], + ], + 'advanced_custom_fields' => [ + 'type' => 'warning', + 'message' => '`%1$s` does not escape output by default, please echo and escape with the `get_*()` variant function instead (i.e. `get_field()`).', + 'functions' => [ + 'the_sub_field', + 'the_field', + ], + ], + // @link https://docs.wpvip.com/technical-references/code-review/vip-warnings/#h-remote-calls + 'wp_remote_get' => [ + 'type' => 'warning', + 'message' => '%s() is highly discouraged. Please use vip_safe_wp_remote_get() instead which is designed to more gracefully handle failure than wp_remote_get() does.', + 'functions' => [ + 'wp_remote_get', + ], + ], + // @link https://docs.wpvip.com/technical-references/code-review/vip-errors/#h-cache-constraints + 'cookies' => [ + 'type' => 'error', + 'message' => 'Due to server-side caching, server-side based client related logic might not work. We recommend implementing client side logic in JavaScript instead.', + 'functions' => [ + 'setcookie', + ], + ], + // @todo Introduce a sniff specific to get_posts() that checks for suppress_filters=>false being supplied. + 'get_posts' => [ + 'type' => 'warning', + 'message' => '%s() is uncached unless the "suppress_filters" parameter is set to false. If the suppress_filter parameter is set to false this can be safely ignored. More Info: https://docs.wpvip.com/technical-references/caching/uncached-functions/.', + 'functions' => [ + 'get_posts', + 'wp_get_recent_posts', + 'get_children', + ], + ], + 'create_function' => [ + 'type' => 'warning', + 'message' => '%s() is highly discouraged, as it can execute arbritary code (additionally, it\'s deprecated as of PHP 7.2): https://docs.wpvip.com/technical-references/code-review/vip-warnings/#h-eval-and-create_function. )', + 'functions' => [ + 'create_function', + ], + ], + ]; + + $deprecated_vip_helpers = [ + 'get_term_link' => 'wpcom_vip_get_term_link', + 'get_term_by' => 'wpcom_vip_get_term_by', + 'get_category_by_slug' => 'wpcom_vip_get_category_by_slug', + ]; + foreach ( $deprecated_vip_helpers as $restricted => $helper ) { + $groups[ $helper ] = [ + 'type' => 'warning', + 'message' => "`%s()` is deprecated, please use `{$restricted}()` instead.", + 'functions' => [ + $helper, + ], + ]; + } + + return $groups; + } + + /** + * Verify the current token is a function call or a method call on a specific object variable. + * + * This differs to the parent class method that it overrides, by also checking to see if the + * function call is actually a method call on a specific object variable. This works best with global objects, + * such as the `flush_rules()` method on the `$wp_rewrite` object. + * + * @param int $stackPtr The position of the current token in the stack. + * + * @return bool + */ + public function is_targetted_token( $stackPtr ) { + // Exclude function definitions, class methods, and namespaced calls. + if ( $this->tokens[ $stackPtr ]['code'] === \T_STRING && isset( $this->tokens[ $stackPtr - 1 ] ) ) { + // Check if this is really a function. + $next = $this->phpcsFile->findNext( Tokens::$emptyTokens, $stackPtr + 1, null, true ); + if ( $next !== false && $this->tokens[ $next ]['code'] !== T_OPEN_PARENTHESIS ) { + return false; + } + + $prev = $this->phpcsFile->findPrevious( Tokens::$emptyTokens, $stackPtr - 1, null, true ); + if ( $prev !== false ) { + + // Start difference to parent class method. + // Check to see if function is a method on a specific object variable. + if ( ! empty( $this->groups[ $this->tokens[ $stackPtr ]['content'] ]['object_var'] ) ) { + $prevPrev = $this->phpcsFile->findPrevious( Tokens::$emptyTokens, $stackPtr - 2, null, true ); + + return $this->tokens[ $prev ]['code'] === \T_OBJECT_OPERATOR && isset( $this->groups[ $this->tokens[ $stackPtr ]['content'] ]['object_var'][ $this->tokens[ $prevPrev ]['content'] ] ); + } // End difference to parent class method. + + // Skip sniffing if calling a same-named method, or on function definitions. + $skipped = [ + \T_FUNCTION => \T_FUNCTION, + \T_CLASS => \T_CLASS, + \T_AS => \T_AS, // Use declaration alias. + \T_DOUBLE_COLON => \T_DOUBLE_COLON, + \T_OBJECT_OPERATOR => \T_OBJECT_OPERATOR, + \T_NEW => \T_NEW, + ]; + if ( isset( $skipped[ $this->tokens[ $prev ]['code'] ] ) ) { + return false; + } + // Skip namespaced functions, ie: `\foo\bar()` not `\bar()`. + if ( $this->tokens[ $prev ]['code'] === \T_NS_SEPARATOR ) { + $pprev = $this->phpcsFile->findPrevious( Tokens::$emptyTokens, $prev - 1, null, true ); + if ( $pprev !== false && $this->tokens[ $pprev ]['code'] === \T_STRING ) { + return false; + } + } + } + return true; + } + return false; + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Functions/StripTagsSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Functions/StripTagsSniff.php new file mode 100644 index 00000000..cf29e454 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Functions/StripTagsSniff.php @@ -0,0 +1,59 @@ + true, + ]; + + /** + * Process the parameters of a matched function. + * + * @param int $stackPtr The position of the current token in the stack. + * @param string $group_name The name of the group which was matched. + * @param string $matched_content The token content (function name) which was matched + * in lowercase. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function process_parameters( $stackPtr, $group_name, $matched_content, $parameters ) { + if ( count( $parameters ) === 1 ) { + $message = '`strip_tags()` does not strip CSS and JS in between the script and style tags. Use `wp_strip_all_tags()` to strip all tags.'; + $this->phpcsFile->addWarning( $message, $stackPtr, 'StripTagsOneParameter' ); + } elseif ( isset( $parameters[2] ) ) { + $message = '`strip_tags()` does not strip CSS and JS in between the script and style tags. Use `wp_kses()` instead to allow only the HTML you need.'; + $this->phpcsFile->addWarning( $message, $stackPtr, 'StripTagsTwoParameters' ); + } + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Hooks/AlwaysReturnInFilterSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Hooks/AlwaysReturnInFilterSniff.php new file mode 100644 index 00000000..7bf70d9a --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Hooks/AlwaysReturnInFilterSniff.php @@ -0,0 +1,303 @@ +tokens[ $stackPtr ]['content']; + + if ( $functionName !== 'add_filter' ) { + return; + } + + $this->filterNamePtr = $this->phpcsFile->findNext( + array_merge( Tokens::$emptyTokens, [ T_OPEN_PARENTHESIS ] ), + $stackPtr + 1, + null, + true, + null, + true + ); + + if ( ! $this->filterNamePtr ) { + // Something is wrong. + return; + } + + $callbackPtr = $this->phpcsFile->findNext( + array_merge( Tokens::$emptyTokens, [ T_COMMA ] ), + $this->filterNamePtr + 1, + null, + true, + null, + true + ); + + if ( ! $callbackPtr ) { + // Something is wrong. + return; + } + + if ( $this->tokens[ $callbackPtr ]['code'] === 'PHPCS_T_CLOSURE' ) { + $this->processFunctionBody( $callbackPtr ); + } elseif ( $this->tokens[ $callbackPtr ]['code'] === T_ARRAY + || $this->tokens[ $callbackPtr ]['code'] === T_OPEN_SHORT_ARRAY + ) { + $this->processArray( $callbackPtr ); + } elseif ( in_array( $this->tokens[ $callbackPtr ]['code'], Tokens::$stringTokens, true ) === true ) { + $this->processString( $callbackPtr ); + } + } + + /** + * Process array. + * + * @param int $stackPtr The position in the stack where the token was found. + * + * @return void + */ + private function processArray( $stackPtr ) { + + $open_close = Arrays::getOpenClose( $this->phpcsFile, $stackPtr ); + if ( $open_close === false ) { + return; + } + + $previous = $this->phpcsFile->findPrevious( + Tokens::$emptyTokens, + $open_close['closer'] - 1, + null, + true + ); + + if ( in_array( T_CLASS, $this->tokens[ $stackPtr ]['conditions'], true ) === true ) { + $classPtr = array_search( T_CLASS, $this->tokens[ $stackPtr ]['conditions'], true ); + if ( $classPtr ) { + $classToken = $this->tokens[ $classPtr ]; + $this->processString( $previous, $classToken['scope_opener'], $classToken['scope_closer'] ); + return; + } + } + + $this->processString( $previous ); + } + + /** + * Process string. + * + * @param int $stackPtr The position in the stack where the token was found. + * @param int $start The start of the token. + * @param int $end The end of the token. + * + * @return void + */ + private function processString( $stackPtr, $start = 0, $end = null ) { + + $callbackFunctionName = substr( $this->tokens[ $stackPtr ]['content'], 1, -1 ); + + $callbackFunctionPtr = $this->phpcsFile->findNext( + T_STRING, + $start, + $end, + false, + $callbackFunctionName + ); + + if ( ! $callbackFunctionPtr ) { + // We were not able to find the function callback in the file. + return; + } + + $this->processFunction( $callbackFunctionPtr, $start, $end ); + } + + /** + * Process function. + * + * @param int $stackPtr The position in the stack where the token was found. + * @param int $start The start of the token. + * @param int $end The end of the token. + * + * @return void + */ + private function processFunction( $stackPtr, $start = 0, $end = null ) { + + $functionName = $this->tokens[ $stackPtr ]['content']; + + $offset = $start; + while ( $this->phpcsFile->findNext( [ T_FUNCTION ], $offset, $end ) !== false ) { + $functionStackPtr = $this->phpcsFile->findNext( [ T_FUNCTION ], $offset, $end ); + $functionNamePtr = $this->phpcsFile->findNext( Tokens::$emptyTokens, $functionStackPtr + 1, null, true, null, true ); + if ( $this->tokens[ $functionNamePtr ]['code'] === T_STRING && $this->tokens[ $functionNamePtr ]['content'] === $functionName ) { + $this->processFunctionBody( $functionStackPtr ); + return; + } + $offset = $functionStackPtr + 1; + } + } + + /** + * Process function's body + * + * @param int $stackPtr The position in the stack where the token was found. + * + * @return void + */ + private function processFunctionBody( $stackPtr ) { + + $filterName = $this->tokens[ $this->filterNamePtr ]['content']; + + $methodProps = FunctionDeclarations::getProperties( $this->phpcsFile, $stackPtr ); + if ( $methodProps['is_abstract'] === true ) { + $message = 'The callback for the `%s` filter hook-in points to an abstract method. Please ensure that child class implementations of this method always return a value.'; + $data = [ $filterName ]; + $this->phpcsFile->addWarning( $message, $stackPtr, 'AbstractMethod', $data ); + return; + } + + if ( isset( $this->tokens[ $stackPtr ]['scope_opener'], $this->tokens[ $stackPtr ]['scope_closer'] ) === false ) { + // Live coding, parse or tokenizer error. + return; + } + + $argPtr = $this->phpcsFile->findNext( + array_merge( Tokens::$emptyTokens, [ T_STRING, T_OPEN_PARENTHESIS ] ), + $stackPtr + 1, + null, + true, + null, + true + ); + + // If arg is being passed by reference, we can skip. + if ( $this->tokens[ $argPtr ]['code'] === T_BITWISE_AND ) { + return; + } + + $functionBodyScopeStart = $this->tokens[ $stackPtr ]['scope_opener']; + $functionBodyScopeEnd = $this->tokens[ $stackPtr ]['scope_closer']; + + $returnTokenPtr = $this->phpcsFile->findNext( + [ T_RETURN ], + $functionBodyScopeStart + 1, + $functionBodyScopeEnd + ); + + $outsideConditionalReturn = 0; + + while ( $returnTokenPtr ) { + if ( $this->isInsideIfConditonal( $returnTokenPtr ) === false ) { + ++$outsideConditionalReturn; + } + if ( $this->isReturningVoid( $returnTokenPtr ) ) { + $message = 'Please, make sure that a callback to `%s` filter is returning void intentionally.'; + $data = [ $filterName ]; + $this->phpcsFile->addError( $message, $functionBodyScopeStart, 'VoidReturn', $data ); + } + $returnTokenPtr = $this->phpcsFile->findNext( + [ T_RETURN ], + $returnTokenPtr + 1, + $functionBodyScopeEnd + ); + } + + if ( $outsideConditionalReturn === 0 ) { + $message = 'Please, make sure that a callback to `%s` filter is always returning some value.'; + $data = [ $filterName ]; + $this->phpcsFile->addError( $message, $functionBodyScopeStart, 'MissingReturnStatement', $data ); + } + } + + /** + * Is the current token inside a conditional? + * + * @param int $stackPtr The position in the stack where the token was found. + * + * @return bool + */ + private function isInsideIfConditonal( $stackPtr ) { + + // This check helps us in situations a class or a function is wrapped + // inside a conditional as a whole. Eg.: inside `class_exists`. + if ( end( $this->tokens[ $stackPtr ]['conditions'] ) === T_FUNCTION ) { + return false; + } + + // Similar case may be a conditional closure. + if ( end( $this->tokens[ $stackPtr ]['conditions'] ) === 'PHPCS_T_CLOSURE' ) { + return false; + } + + // Loop over the array of conditions and look for an IF. + reset( $this->tokens[ $stackPtr ]['conditions'] ); + + if ( array_key_exists( 'conditions', $this->tokens[ $stackPtr ] ) === true + && is_array( $this->tokens[ $stackPtr ]['conditions'] ) === true + && empty( $this->tokens[ $stackPtr ]['conditions'] ) === false + ) { + foreach ( $this->tokens[ $stackPtr ]['conditions'] as $tokenPtr => $tokenCode ) { + if ( $this->tokens[ $stackPtr ]['conditions'][ $tokenPtr ] === T_IF ) { + return true; + } + } + } + return false; + } + + /** + * Is the token returning void + * + * @param int $stackPtr The position in the stack where the token was found. + * + * @return bool + **/ + private function isReturningVoid( $stackPtr ) { + + $nextToReturnTokenPtr = $this->phpcsFile->findNext( + [ Tokens::$emptyTokens ], + $stackPtr + 1, + null, + true + ); + + return $this->tokens[ $nextToReturnTokenPtr ]['code'] === T_SEMICOLON; + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Hooks/PreGetPostsSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Hooks/PreGetPostsSniff.php new file mode 100644 index 00000000..88d49e62 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Hooks/PreGetPostsSniff.php @@ -0,0 +1,461 @@ +tokens[ $stackPtr ]['content']; + + if ( $functionName !== 'add_action' ) { + // We are interested in add_action calls only. + return; + } + + $actionNamePtr = $this->phpcsFile->findNext( + array_merge( Tokens::$emptyTokens, [ T_OPEN_PARENTHESIS ] ), + $stackPtr + 1, + null, + true, + null, + true + ); + + if ( ! $actionNamePtr ) { + // Something is wrong. + return; + } + + if ( substr( $this->tokens[ $actionNamePtr ]['content'], 1, -1 ) !== 'pre_get_posts' ) { + // This is not setting a callback for pre_get_posts action. + return; + } + + $callbackPtr = $this->phpcsFile->findNext( + array_merge( Tokens::$emptyTokens, [ T_COMMA ] ), + $actionNamePtr + 1, + null, + true, + null, + true + ); + + if ( ! $callbackPtr ) { + // Something is wrong. + return; + } + + if ( $this->tokens[ $callbackPtr ]['code'] === 'PHPCS_T_CLOSURE' ) { + $this->processClosure( $callbackPtr ); + } elseif ( $this->tokens[ $callbackPtr ]['code'] === T_ARRAY + || $this->tokens[ $callbackPtr ]['code'] === T_OPEN_SHORT_ARRAY + ) { + $this->processArray( $callbackPtr ); + } elseif ( in_array( $this->tokens[ $callbackPtr ]['code'], Tokens::$stringTokens, true ) === true ) { + $this->processString( $callbackPtr ); + } + } + + /** + * Process array. + * + * @param int $stackPtr The position in the stack where the token was found. + * + * @return void + */ + private function processArray( $stackPtr ) { + + $open_close = Arrays::getOpenClose( $this->phpcsFile, $stackPtr ); + if ( $open_close === false ) { + return; + } + + $previous = $this->phpcsFile->findPrevious( + Tokens::$emptyTokens, + $open_close['closer'] - 1, + null, + true + ); + + $this->processString( $previous ); + } + + /** + * Process string. + * + * @param int $stackPtr The position in the stack where the token was found. + * + * @return void + */ + private function processString( $stackPtr ) { + + $callbackFunctionName = substr( $this->tokens[ $stackPtr ]['content'], 1, -1 ); + + $callbackFunctionPtr = $this->phpcsFile->findNext( + T_STRING, + 0, + null, + false, + $callbackFunctionName + ); + + if ( ! $callbackFunctionPtr ) { + // We were not able to find the function callback in the file. + return; + } + + $this->processFunction( $callbackFunctionPtr ); + } + + /** + * Process function. + * + * @param int $stackPtr The position in the stack where the token was found. + * + * @return void + */ + private function processFunction( $stackPtr ) { + + $wpQueryObjectNamePtr = $this->phpcsFile->findNext( + [ T_VARIABLE ], + $stackPtr + 1, + null, + false, + null, + true + ); + + if ( ! $wpQueryObjectNamePtr ) { + // Something is wrong. + return; + } + + $wpQueryObjectVariableName = $this->tokens[ $wpQueryObjectNamePtr ]['content']; + + $functionDefinitionPtr = $this->phpcsFile->findPrevious( [ T_FUNCTION ], $wpQueryObjectNamePtr - 1 ); + + if ( ! $functionDefinitionPtr ) { + // Something is wrong. + return; + } + + $this->processFunctionBody( $functionDefinitionPtr, $wpQueryObjectVariableName ); + } + + /** + * Process closure. + * + * @param int $stackPtr The position in the stack where the token was found. + * + * @return void + */ + private function processClosure( $stackPtr ) { + + $wpQueryObjectNamePtr = $this->phpcsFile->findNext( + [ T_VARIABLE ], + $stackPtr + 1, + null, + false, + null, + true + ); + + if ( ! $wpQueryObjectNamePtr ) { + // Something is wrong. + return; + } + + $this->processFunctionBody( $stackPtr, $this->tokens[ $wpQueryObjectNamePtr ]['content'] ); + } + + /** + * Process function's body + * + * @param int $stackPtr The position in the stack where the token was found. + * @param string $variableName Variable name. + * + * @return void + */ + private function processFunctionBody( $stackPtr, $variableName ) { + + $functionBodyScopeStart = $this->tokens[ $stackPtr ]['scope_opener']; + $functionBodyScopeEnd = $this->tokens[ $stackPtr ]['scope_closer']; + + $wpQueryVarUsed = $this->phpcsFile->findNext( + [ T_VARIABLE ], + $functionBodyScopeStart + 1, + $functionBodyScopeEnd, + false, + $variableName + ); + while ( $wpQueryVarUsed ) { + if ( $this->isPartOfIfConditional( $wpQueryVarUsed ) ) { + if ( $this->isEarlyMainQueryCheck( $wpQueryVarUsed ) ) { + return; + } + } elseif ( $this->isInsideIfConditonal( $wpQueryVarUsed ) ) { + if ( ! $this->isParentConditionalCheckingMainQuery( $wpQueryVarUsed ) ) { + $this->addPreGetPostsWarning( $wpQueryVarUsed ); + } + } elseif ( $this->isWPQueryMethodCall( $wpQueryVarUsed, 'set' ) ) { + $this->addPreGetPostsWarning( $wpQueryVarUsed ); + } + $wpQueryVarUsed = $this->phpcsFile->findNext( + [ T_VARIABLE ], + $wpQueryVarUsed + 1, + $functionBodyScopeEnd, + false, + $variableName + ); + } + } + + /** + * Consolidated violation. + * + * @param int $stackPtr The position in the stack where the token was found. + * + * @return void + */ + private function addPreGetPostsWarning( $stackPtr ) { + $message = 'Main WP_Query is being modified without `$query->is_main_query()` check. Needs manual inspection.'; + $this->phpcsFile->addWarning( $message, $stackPtr, 'PreGetPosts' ); + } + + /** + * Is parent conditional checking is_main_query? + * + * @param int $stackPtr The position in the stack where the token was found. + * + * @return bool + */ + private function isParentConditionalCheckingMainQuery( $stackPtr ) { + + if ( array_key_exists( 'conditions', $this->tokens[ $stackPtr ] ) === false + || is_array( $this->tokens[ $stackPtr ]['conditions'] ) === false + || empty( $this->tokens[ $stackPtr ]['conditions'] ) === true + ) { + return false; + } + + $conditionStackPtrs = array_keys( $this->tokens[ $stackPtr ]['conditions'] ); + $lastConditionStackPtr = array_pop( $conditionStackPtrs ); + + while ( $this->tokens[ $stackPtr ]['conditions'][ $lastConditionStackPtr ] === T_IF ) { + + $next = $this->phpcsFile->findNext( + [ T_VARIABLE ], + $lastConditionStackPtr + 1, + null, + false, + $this->tokens[ $stackPtr ]['content'], + true + ); + while ( $next ) { + if ( $this->isWPQueryMethodCall( $next, 'is_main_query' ) === true ) { + return true; + } + $next = $this->phpcsFile->findNext( + [ T_VARIABLE ], + $next + 1, + null, + false, + $this->tokens[ $stackPtr ]['content'], + true + ); + } + + $lastConditionStackPtr = array_pop( $conditionStackPtrs ); + } + + return false; + } + + + /** + * Is the current code an early main query check? + * + * @param int $stackPtr The position in the stack where the token was found. + * + * @return bool + */ + private function isEarlyMainQueryCheck( $stackPtr ) { + + if ( ! $this->isWPQueryMethodCall( $stackPtr, 'is_main_query' ) ) { + return false; + } + + if ( array_key_exists( 'nested_parenthesis', $this->tokens[ $stackPtr ] ) === false + || empty( $this->tokens[ $stackPtr ]['nested_parenthesis'] ) === true + ) { + return false; + } + + $parentheses = $this->tokens[ $stackPtr ]['nested_parenthesis']; + do { + $nestedParenthesisEnd = array_shift( $parentheses ); + if ( $nestedParenthesisEnd === null ) { + // Nothing left in the array. No parenthesis found with a non-closure owner. + return false; + } + + if ( isset( $this->tokens[ $nestedParenthesisEnd ]['parenthesis_owner'] ) + && $this->tokens[ $this->tokens[ $nestedParenthesisEnd ]['parenthesis_owner'] ]['code'] !== T_CLOSURE + ) { + break; + } + } while ( true ); + + $owner = $this->tokens[ $nestedParenthesisEnd ]['parenthesis_owner']; + if ( isset( $this->tokens[ $owner ]['scope_opener'], $this->tokens[ $owner ]['scope_closer'] ) === false ) { + // This may be an inline control structure (no braces). + $next = $this->phpcsFile->findNext( + Tokens::$emptyTokens, + ( $nestedParenthesisEnd + 1 ), + null, + true + ); + + if ( $next !== false && $this->tokens[ $next ]['code'] === T_RETURN ) { + return true; + } + + return false; + } + + $next = $this->phpcsFile->findNext( + [ T_RETURN ], + $this->tokens[ $this->tokens[ $nestedParenthesisEnd ]['parenthesis_owner'] ]['scope_opener'], + $this->tokens[ $this->tokens[ $nestedParenthesisEnd ]['parenthesis_owner'] ]['scope_closer'], + false, + 'return', + true + ); + + if ( $next ) { + return true; + } + + return false; + } + + /** + * Is the current code a WP_Query call? + * + * @param int $stackPtr The position in the stack where the token was found. + * @param string|null $method Method. + * + * @return bool + */ + private function isWPQueryMethodCall( $stackPtr, $method = null ) { + $next = $this->phpcsFile->findNext( + Tokens::$emptyTokens, + $stackPtr + 1, + null, + true, + null, + true + ); + + if ( ! $next || $this->tokens[ $next ]['type'] !== 'T_OBJECT_OPERATOR' ) { + return false; + } + + if ( $method === null ) { + return true; + } + + $next = $this->phpcsFile->findNext( + Tokens::$emptyTokens, + $next + 1, + null, + true, + null, + true + ); + + return $next && $this->tokens[ $next ]['code'] === T_STRING && $method === $this->tokens[ $next ]['content']; + } + + /** + * Is the current token a part of a conditional? + * + * @param int $stackPtr The position in the stack where the token was found. + * + * @return bool + */ + private function isPartOfIfConditional( $stackPtr ) { + + if ( array_key_exists( 'nested_parenthesis', $this->tokens[ $stackPtr ] ) === true + && is_array( $this->tokens[ $stackPtr ]['nested_parenthesis'] ) === true + && empty( $this->tokens[ $stackPtr ]['nested_parenthesis'] ) === false + ) { + $previousLocalIf = $this->phpcsFile->findPrevious( + [ T_IF ], + $stackPtr - 1, + null, + false, + null, + true + ); + if ( $previousLocalIf !== false + && $this->tokens[ $previousLocalIf ]['parenthesis_opener'] < $stackPtr + && $this->tokens[ $previousLocalIf ]['parenthesis_closer'] > $stackPtr + ) { + return true; + } + } + return false; + } + + /** + * Is the current token inside a conditional? + * + * @param int $stackPtr The position in the stack where the token was found. + * + * @return bool + */ + private function isInsideIfConditonal( $stackPtr ) { + + if ( array_key_exists( 'conditions', $this->tokens[ $stackPtr ] ) === true + && is_array( $this->tokens[ $stackPtr ]['conditions'] ) === true + && empty( $this->tokens[ $stackPtr ]['conditions'] ) === false + ) { + $conditionStackPtrs = array_keys( $this->tokens[ $stackPtr ]['conditions'] ); + $lastConditionStackPtr = array_pop( $conditionStackPtrs ); + return $this->tokens[ $stackPtr ]['conditions'][ $lastConditionStackPtr ] === T_IF; + } + return false; + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Hooks/RestrictedHooksSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Hooks/RestrictedHooksSniff.php new file mode 100644 index 00000000..d15dac7d --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Hooks/RestrictedHooksSniff.php @@ -0,0 +1,128 @@ + true, + 'add_action' => true, + ]; + + /** + * List of restricted filters by groups. + * + * @var array + */ + private $restricted_hook_groups = [ + 'upload_mimes' => [ + // TODO: This error message needs a link to the VIP Documentation, see https://github.com/Automattic/VIP-Coding-Standards/issues/235. + 'type' => 'Warning', + 'msg' => 'Please ensure that the mimes being filtered do not include insecure types (i.e. SVG, SWF, etc.). Manual inspection required.', + 'hooks' => [ + 'upload_mimes', + ], + ], + 'http_request' => [ + // https://docs.wpvip.com/technical-references/code-quality-and-best-practices/retrieving-remote-data/. + 'type' => 'Warning', + 'msg' => 'Please ensure that the timeout being filtered is not greater than 3s since remote requests require the user to wait for completion before the rest of the page will load. Manual inspection required.', + 'hooks' => [ + 'http_request_timeout', + 'http_request_args', + ], + ], + 'robotstxt' => [ + // https://docs.wpvip.com/how-tos/modify-the-robots-txt-file/. + 'type' => 'Warning', + 'msg' => 'Don\'t forget to flush the robots.txt cache by going to Settings > Reading and toggling the privacy settings.', + 'hooks' => [ + 'do_robotstxt', + 'robots_txt', + ], + ], + ]; + + /** + * Process the parameters of a matched function. + * + * @param int $stackPtr The position of the current token in the stack. + * @param string $group_name The name of the group which was matched. + * @param string $matched_content The token content (function name) which was matched + * in lowercase. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function process_parameters( $stackPtr, $group_name, $matched_content, $parameters ) { + foreach ( $this->restricted_hook_groups as $group => $group_args ) { + foreach ( $group_args['hooks'] as $hook ) { + if ( $this->normalize_hook_name_from_parameter( $parameters[1] ) === $hook ) { + $addMethod = 'add' . $group_args['type']; + $this->phpcsFile->{$addMethod}( $group_args['msg'], $stackPtr, $hook ); + } + } + } + } + + /** + * Normalize hook name parameter. + * + * @param array $parameter Array with information about a parameter. + * + * @return string Normalized hook name. + */ + private function normalize_hook_name_from_parameter( $parameter ) { + // If concatenation is found, build hook name. + $concat_ptr = $this->phpcsFile->findNext( + T_STRING_CONCAT, + $parameter['start'], + $parameter['end'], + false, + null, + true + ); + + if ( $concat_ptr ) { + $hook_name = ''; + for ( $i = $parameter['start'] + 1; $i < $parameter['end']; $i++ ) { + if ( $this->tokens[ $i ]['code'] === T_CONSTANT_ENCAPSED_STRING ) { + $hook_name .= str_replace( [ "'", '"' ], '', $this->tokens[ $i ]['content'] ); + } + } + } else { + $hook_name = $parameter['raw']; + } + + // Remove quotes (double and single), and use lowercase. + return strtolower( str_replace( [ "'", '"' ], '', $hook_name ) ); + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/JS/DangerouslySetInnerHTMLSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/JS/DangerouslySetInnerHTMLSniff.php new file mode 100644 index 00000000..ce68a775 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/JS/DangerouslySetInnerHTMLSniff.php @@ -0,0 +1,70 @@ +tokens[ $stackPtr ]['content'] !== 'dangerouslySetInnerHTML' ) { + // Looking for dangerouslySetInnerHTML only. + return; + } + + $nextToken = $this->phpcsFile->findNext( Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true ); + + if ( $this->tokens[ $nextToken ]['code'] !== T_EQUAL ) { + // Not an assignment. + return; + } + + $nextNextToken = $this->phpcsFile->findNext( Tokens::$emptyTokens, $nextToken + 1, null, true, null, true ); + + if ( $this->tokens[ $nextNextToken ]['code'] !== T_OBJECT ) { + // Not react syntax. + return; + } + + $message = "Any HTML passed to `%s` gets executed. Please make sure it's properly escaped."; + $data = [ $this->tokens[ $stackPtr ]['content'] ]; + $this->phpcsFile->addError( $message, $stackPtr, 'Found', $data ); + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/JS/HTMLExecutingFunctionsSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/JS/HTMLExecutingFunctionsSniff.php new file mode 100644 index 00000000..0a106f22 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/JS/HTMLExecutingFunctionsSniff.php @@ -0,0 +1,131 @@ + content or target. + * Value indicates whether the function's arg is the content to be inserted, or the target where the inserted + * content is to be inserted before/after/replaced. For the latter, the content is in the preceding method's arg. + * + * @var array + */ + public $HTMLExecutingFunctions = [ + 'after' => 'content', // jQuery. + 'append' => 'content', // jQuery. + 'appendTo' => 'target', // jQuery. + 'before' => 'content', // jQuery. + 'html' => 'content', // jQuery. + 'insertAfter' => 'target', // jQuery. + 'insertBefore' => 'target', // jQuery. + 'prepend' => 'content', // jQuery. + 'prependTo' => 'target', // jQuery. + 'replaceAll' => 'target', // jQuery. + 'replaceWith' => 'content', // jQuery. + 'write' => 'content', + 'writeln' => 'content', + ]; + + /** + * A list of tokenizers this sniff supports. + * + * @var string[] + */ + public $supportedTokenizers = [ 'JS' ]; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @return array + */ + public function register() { + return [ + T_STRING, + ]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @param int $stackPtr The position of the current token in the stack passed in $tokens. + * + * @return void + */ + public function process_token( $stackPtr ) { + + if ( ! isset( $this->HTMLExecutingFunctions[ $this->tokens[ $stackPtr ]['content'] ] ) ) { + // Looking for specific functions only. + return; + } + + if ( $this->HTMLExecutingFunctions[ $this->tokens[ $stackPtr ]['content'] ] === 'content' ) { + $nextToken = $this->phpcsFile->findNext( Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true ); + + if ( $this->tokens[ $nextToken ]['code'] !== T_OPEN_PARENTHESIS ) { + // Not a function. + return; + } + + $parenthesis_closer = $this->tokens[ $nextToken ]['parenthesis_closer']; + + while ( $nextToken < $parenthesis_closer ) { + $nextToken = $this->phpcsFile->findNext( Tokens::$emptyTokens, $nextToken + 1, null, true, null, true ); + if ( $this->tokens[ $nextToken ]['code'] === T_STRING ) { // Contains a variable, function call or something else dynamic. + $message = 'Any HTML passed to `%s` gets executed. Make sure it\'s properly escaped.'; + $data = [ $this->tokens[ $stackPtr ]['content'] ]; + $this->phpcsFile->addWarning( $message, $stackPtr, $this->tokens[ $stackPtr ]['content'], $data ); + + return; + } + } + } elseif ( $this->HTMLExecutingFunctions[ $this->tokens[ $stackPtr ]['content'] ] === 'target' ) { + $prevToken = $this->phpcsFile->findPrevious( Tokens::$emptyTokens, $stackPtr - 1, null, true, null, true ); + + if ( $this->tokens[ $prevToken ]['code'] !== T_OBJECT_OPERATOR ) { + return; + } + + $prevPrevToken = $this->phpcsFile->findPrevious( Tokens::$emptyTokens, $prevToken - 1, null, true, null, true ); + + if ( $this->tokens[ $prevPrevToken ]['code'] !== T_CLOSE_PARENTHESIS ) { + // Not a function call, but may be a variable containing an element reference, so just + // flag all remaining instances of these target HTML executing functions. + $message = 'Any HTML used with `%s` gets executed. Make sure it\'s properly escaped.'; + $data = [ $this->tokens[ $stackPtr ]['content'] ]; + $this->phpcsFile->addWarning( $message, $stackPtr, $this->tokens[ $stackPtr ]['content'], $data ); + + return; + } + + // Check if it's a function call (typically $() ) that contains a dynamic part. + $parenthesis_opener = $this->tokens[ $prevPrevToken ]['parenthesis_opener']; + + while ( $prevPrevToken > $parenthesis_opener ) { + $prevPrevToken = $this->phpcsFile->findPrevious( Tokens::$emptyTokens, $prevPrevToken - 1, null, true, null, true ); + if ( $this->tokens[ $prevPrevToken ]['code'] === T_STRING ) { // Contains a variable, function call or something else dynamic. + $message = 'Any HTML used with `%s` gets executed. Make sure it\'s properly escaped.'; + $data = [ $this->tokens[ $stackPtr ]['content'] ]; + $this->phpcsFile->addWarning( $message, $stackPtr, $this->tokens[ $stackPtr ]['content'], $data ); + + return; + } + } + } + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/JS/InnerHTMLSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/JS/InnerHTMLSniff.php new file mode 100644 index 00000000..f35f9894 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/JS/InnerHTMLSniff.php @@ -0,0 +1,84 @@ +tokens[ $stackPtr ]['content'] !== 'innerHTML' ) { + // Looking for .innerHTML only. + return; + } + + $prevToken = $this->phpcsFile->findPrevious( Tokens::$emptyTokens, $stackPtr - 1, null, true, null, true ); + + if ( $this->tokens[ $prevToken ]['code'] !== T_OBJECT_OPERATOR ) { + return; + } + + $nextToken = $this->phpcsFile->findNext( Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true ); + + if ( $this->tokens[ $nextToken ]['code'] !== T_EQUAL ) { + // Not an assignment. + return; + } + + $nextToken = $this->phpcsFile->findNext( Tokens::$emptyTokens, $nextToken + 1, null, true, null, true ); + $foundVariable = false; + + while ( $nextToken !== false && $this->tokens[ $nextToken ]['code'] !== T_SEMICOLON ) { + + if ( $this->tokens[ $nextToken ]['code'] === T_STRING ) { + $foundVariable = true; + break; + } + + $nextToken = $this->phpcsFile->findNext( Tokens::$emptyTokens, $nextToken + 1, null, true, null, true ); + } + + if ( $foundVariable === true ) { + $message = 'Any HTML passed to `%s` gets executed. Consider using `.textContent` or make sure that used variables are properly escaped.'; + $data = [ $this->tokens[ $stackPtr ]['content'] ]; + $this->phpcsFile->addWarning( $message, $stackPtr, 'Found', $data ); + } + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/JS/StringConcatSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/JS/StringConcatSniff.php new file mode 100644 index 00000000..049b35c0 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/JS/StringConcatSniff.php @@ -0,0 +1,75 @@ +phpcsFile->findNext( Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true ); + + if ( $this->tokens[ $nextToken ]['code'] === T_CONSTANT_ENCAPSED_STRING && strpos( $this->tokens[ $nextToken ]['content'], '<' ) !== false && preg_match( '/\<\/[a-zA-Z]+/', $this->tokens[ $nextToken ]['content'] ) === 1 ) { + $data = [ '+' . $this->tokens[ $nextToken ]['content'] ]; + $this->addFoundError( $stackPtr, $data ); + } + + $prevToken = $this->phpcsFile->findPrevious( Tokens::$emptyTokens, $stackPtr - 1, null, true, null, true ); + + if ( $this->tokens[ $prevToken ]['code'] === T_CONSTANT_ENCAPSED_STRING && strpos( $this->tokens[ $prevToken ]['content'], '<' ) !== false && preg_match( '/\<[a-zA-Z]+/', $this->tokens[ $prevToken ]['content'] ) === 1 ) { + $data = [ $this->tokens[ $nextToken ]['content'] . '+' ]; + $this->addFoundError( $stackPtr, $data ); + } + } + + /** + * Consolidated violation. + * + * @param int $stackPtr The position of the current token in the stack passed in $tokens. + * @param array $data Replacements for the error message. + * + * @return void + */ + private function addFoundError( $stackPtr, array $data ) { + $message = 'HTML string concatenation detected, this is a security risk, use DOM node construction or a templating language instead: %s.'; + $this->phpcsFile->addError( $message, $stackPtr, 'Found', $data ); + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/JS/StrippingTagsSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/JS/StrippingTagsSniff.php new file mode 100644 index 00000000..88fef947 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/JS/StrippingTagsSniff.php @@ -0,0 +1,73 @@ +tokens[ $stackPtr ]['content'] !== 'html' ) { + // Looking for html() only. + return; + } + + $nextToken = $this->phpcsFile->findNext( Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true ); + + if ( $this->tokens[ $nextToken ]['code'] !== T_OPEN_PARENTHESIS ) { + // Not a function. + return; + } + + $afterFunctionCall = $this->phpcsFile->findNext( Tokens::$emptyTokens, $this->tokens[ $nextToken ]['parenthesis_closer'] + 1, null, true, null, true ); + + if ( $this->tokens[ $afterFunctionCall ]['code'] !== T_OBJECT_OPERATOR ) { + return; + } + + $nextToken = $this->phpcsFile->findNext( Tokens::$emptyTokens, $afterFunctionCall + 1, null, true, null, true ); + + if ( $this->tokens[ $nextToken ]['code'] === T_STRING && $this->tokens[ $nextToken ]['content'] === 'text' ) { + $message = 'Vulnerable tag stripping approach detected.'; + $this->phpcsFile->addError( $message, $stackPtr, 'VulnerableTagStripping' ); + } + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/JS/WindowSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/JS/WindowSniff.php new file mode 100644 index 00000000..d54d5690 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/JS/WindowSniff.php @@ -0,0 +1,128 @@ + [ + 'href' => true, + 'protocol' => true, + 'host' => true, + 'hostname' => true, + 'pathname' => true, + 'search' => true, + 'hash' => true, + 'username' => true, + 'port' => true, + 'password' => true, + ], + 'name' => true, + 'status' => true, + ]; + + /** + * Processes this test, when one of its tokens is encountered. + * + * @param int $stackPtr The position of the current token in the stack passed in $tokens. + * + * @return void + */ + public function process_token( $stackPtr ) { + + if ( $this->tokens[ $stackPtr ]['content'] !== 'window' ) { + // Doesn't begin with 'window', bail. + return; + } + + $nextTokenPtr = $this->phpcsFile->findNext( Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true ); + $nextToken = $this->tokens[ $nextTokenPtr ]['code']; + if ( $nextToken !== T_OBJECT_OPERATOR && $nextToken !== T_OPEN_SQUARE_BRACKET ) { + // No . or [' next, bail. + return; + } + + $nextNextTokenPtr = $this->phpcsFile->findNext( Tokens::$emptyTokens, $nextTokenPtr + 1, null, true, null, true ); + if ( $nextNextTokenPtr === false ) { + // Something went wrong, bail. + return; + } + + $nextNextToken = str_replace( [ '"', "'" ], '', $this->tokens[ $nextNextTokenPtr ]['content'] ); + if ( ! isset( $this->windowProperties[ $nextNextToken ] ) ) { + // Not in $windowProperties, bail. + return; + } + + $nextNextNextTokenPtr = $this->phpcsFile->findNext( array_merge( [ T_CLOSE_SQUARE_BRACKET ], Tokens::$emptyTokens ), $nextNextTokenPtr + 1, null, true, null, true ); + $nextNextNextToken = $this->tokens[ $nextNextNextTokenPtr ]['code']; + + $nextNextNextNextToken = false; + if ( $nextNextNextToken === T_OBJECT_OPERATOR || $nextNextNextToken === T_OPEN_SQUARE_BRACKET ) { + $nextNextNextNextTokenPtr = $this->phpcsFile->findNext( Tokens::$emptyTokens, $nextNextNextTokenPtr + 1, null, true, null, true ); + if ( $nextNextNextNextTokenPtr === false ) { + // Something went wrong, bail. + return; + } + + $nextNextNextNextToken = str_replace( [ '"', "'" ], '', $this->tokens[ $nextNextNextNextTokenPtr ]['content'] ); + if ( ! isset( $this->windowProperties[ $nextNextToken ][ $nextNextNextNextToken ] ) ) { + // Not in $windowProperties, bail. + return; + } + } + + $windowProperty = 'window.'; + $windowProperty .= $nextNextNextNextToken ? $nextNextToken . '.' . $nextNextNextNextToken : $nextNextToken; + $data = [ $windowProperty ]; + + $prevTokenPtr = $this->phpcsFile->findPrevious( Tokens::$emptyTokens, $stackPtr - 1, null, true, null, true ); + + if ( $this->tokens[ $prevTokenPtr ]['code'] === T_EQUAL ) { + // Variable assignment. + $message = 'Data from JS global "%s" may contain user-supplied values and should be checked.'; + $this->phpcsFile->addWarning( $message, $stackPtr, 'VarAssignment', $data ); + + return; + } + + $message = 'Data from JS global "%s" may contain user-supplied values and should be sanitized before output to prevent XSS.'; + $this->phpcsFile->addError( $message, $stackPtr, $nextNextToken, $data ); + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/CacheValueOverrideSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/CacheValueOverrideSniff.php new file mode 100644 index 00000000..8d39c1a2 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/CacheValueOverrideSniff.php @@ -0,0 +1,137 @@ +tokens[ $stackPtr ]['content']; + + if ( $functionName !== 'wp_cache_get' ) { + // Not a function we are looking for. + return; + } + + if ( $this->isFunctionCall( $stackPtr ) === false ) { + // Not a function call. + return; + } + + $variablePos = $this->isVariableAssignment( $stackPtr ); + + if ( $variablePos === false ) { + // Not a variable assignment. + return; + } + + $variableToken = $this->tokens[ $variablePos ]; + $variableName = $variableToken['content']; + + // Find the next non-empty token. + $openBracket = $this->phpcsFile->findNext( Tokens::$emptyTokens, $stackPtr + 1, null, true ); + + // Find the closing bracket. + $closeBracket = $this->tokens[ $openBracket ]['parenthesis_closer']; + + $nextVariableOccurrence = $this->phpcsFile->findNext( T_VARIABLE, $closeBracket + 1, null, false, $variableName ); + + $rightAfterNextVariableOccurence = $this->phpcsFile->findNext( Tokens::$emptyTokens, $nextVariableOccurrence + 1, null, true, null, true ); + + if ( $this->tokens[ $rightAfterNextVariableOccurence ]['code'] !== T_EQUAL ) { + // Not a value override. + return; + } + + $valueAfterEqualSign = $this->phpcsFile->findNext( Tokens::$emptyTokens, $rightAfterNextVariableOccurence + 1, null, true, null, true ); + + if ( $this->tokens[ $valueAfterEqualSign ]['code'] === T_FALSE ) { + $message = 'Obtained cached value in `%s` is being overridden. Disabling caching?'; + $data = [ $variableName ]; + $this->phpcsFile->addError( $message, $nextVariableOccurrence, 'CacheValueOverride', $data ); + } + } + + /** + * Check whether the examined code is a function call. + * + * @param int $stackPtr The position of the current token in the stack. + * + * @return bool + */ + private function isFunctionCall( $stackPtr ) { + + // Find the next non-empty token. + $openBracket = $this->phpcsFile->findNext( Tokens::$emptyTokens, $stackPtr + 1, null, true ); + + if ( $this->tokens[ $openBracket ]['code'] !== T_OPEN_PARENTHESIS ) { + // Not a function call. + return false; + } + + // Find the previous non-empty token. + $search = Tokens::$emptyTokens; + $search[] = T_BITWISE_AND; + $previous = $this->phpcsFile->findPrevious( $search, $stackPtr - 1, null, true ); + + // It's a function definition, not a function call, so return false. + return ! ( $this->tokens[ $previous ]['code'] === T_FUNCTION ); + } + + /** + * Check whether the examined code is a variable assignment. + * + * @param int $stackPtr The position of the current token in the stack. + * + * @return int|false + */ + private function isVariableAssignment( $stackPtr ) { + + // Find the previous non-empty token. + $search = Tokens::$emptyTokens; + $search[] = T_BITWISE_AND; + $previous = $this->phpcsFile->findPrevious( $search, $stackPtr - 1, null, true ); + + if ( $this->tokens[ $previous ]['code'] !== T_EQUAL ) { + // It's not a variable assignment. + return false; + } + + $previous = $this->phpcsFile->findPrevious( $search, $previous - 1, null, true ); + + if ( $this->tokens[ $previous ]['code'] !== T_VARIABLE ) { + // It's not a variable assignment. + return false; + } + + return $previous; + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/FetchingRemoteDataSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/FetchingRemoteDataSniff.php new file mode 100644 index 00000000..fab5eada --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/FetchingRemoteDataSniff.php @@ -0,0 +1,58 @@ +tokens[ $stackPtr ]['content']; + if ( $functionName !== 'file_get_contents' ) { + return; + } + + $data = [ $this->tokens[ $stackPtr ]['content'] ]; + + $fileNameStackPtr = $this->phpcsFile->findNext( Tokens::$stringTokens, $stackPtr + 1, null, false, null, true ); + if ( $fileNameStackPtr === false ) { + $message = '`%s()` is highly discouraged for remote requests, please use `wpcom_vip_file_get_contents()` or `vip_safe_wp_remote_get()` instead. If it\'s for a local file please use WP_Filesystem instead.'; + $this->phpcsFile->addWarning( $message, $stackPtr, 'FileGetContentsUnknown', $data ); + } + + $fileName = $this->tokens[ $fileNameStackPtr ]['content']; + + $isRemoteFile = ( strpos( $fileName, '://' ) !== false ); + if ( $isRemoteFile === true ) { + $message = '`%s()` is highly discouraged for remote requests, please use `wpcom_vip_file_get_contents()` or `vip_safe_wp_remote_get()` instead.'; + $this->phpcsFile->addWarning( $message, $stackPtr, 'FileGetContentsRemoteFile', $data ); + } + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/LowExpiryCacheTimeSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/LowExpiryCacheTimeSniff.php new file mode 100644 index 00000000..cededb87 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/LowExpiryCacheTimeSniff.php @@ -0,0 +1,207 @@ + true, + 'wp_cache_add' => true, + 'wp_cache_replace' => true, + ]; + + /** + * List of WP time constants, see https://codex.wordpress.org/Easier_Expression_of_Time_Constants. + * + * @var array + */ + protected $wp_time_constants = [ + 'MINUTE_IN_SECONDS' => 60, + 'HOUR_IN_SECONDS' => 3600, + 'DAY_IN_SECONDS' => 86400, + 'WEEK_IN_SECONDS' => 604800, + 'MONTH_IN_SECONDS' => 2592000, + 'YEAR_IN_SECONDS' => 31536000, + ]; + + /** + * Process the parameters of a matched function. + * + * @param int $stackPtr The position of the current token in the stack. + * @param string $group_name The name of the group which was matched. + * @param string $matched_content The token content (function name) which was matched + * in lowercase. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function process_parameters( $stackPtr, $group_name, $matched_content, $parameters ) { + if ( isset( $parameters[4] ) === false ) { + // If no cache expiry time, bail (i.e. we don't want to flag for something like feeds where it is cached indefinitely until a hook runs). + return; + } + + $param = $parameters[4]; + $tokensAsString = ''; + $reportPtr = null; + $openParens = 0; + + $message = 'Cache expiry time could not be determined. Please inspect that the fourth parameter passed to %s() evaluates to 300 seconds or more. Found: "%s"'; + $error_code = 'CacheTimeUndetermined'; + $data = [ $matched_content, $parameters[4]['raw'] ]; + + for ( $i = $param['start']; $i <= $param['end']; $i++ ) { + if ( isset( Tokens::$emptyTokens[ $this->tokens[ $i ]['code'] ] ) === true ) { + $tokensAsString .= ' '; + continue; + } + + if ( $this->tokens[ $i ]['code'] === T_NS_SEPARATOR ) { + /* + * Ignore namespace separators. If it's part of a global WP time constant, it will be + * handled correctly. If it's used in any other context, another token *will* trigger the + * "undetermined" warning anyway. + */ + continue; + } + + if ( isset( $reportPtr ) === false ) { + // Set the report pointer to the first non-empty token we encounter. + $reportPtr = $i; + } + + if ( $this->tokens[ $i ]['code'] === T_LNUMBER + || $this->tokens[ $i ]['code'] === T_DNUMBER + ) { + // Integer or float. + $tokensAsString .= $this->tokens[ $i ]['content']; + continue; + } + + if ( $this->tokens[ $i ]['code'] === T_FALSE + || $this->tokens[ $i ]['code'] === T_NULL + ) { + $tokensAsString .= 0; + continue; + } + + if ( $this->tokens[ $i ]['code'] === T_TRUE ) { + $tokensAsString .= 1; + continue; + } + + if ( isset( Tokens::$arithmeticTokens[ $this->tokens[ $i ]['code'] ] ) === true ) { + $tokensAsString .= $this->tokens[ $i ]['content']; + continue; + } + + // If using time constants, we need to convert to a number. + if ( $this->tokens[ $i ]['code'] === T_STRING + && isset( $this->wp_time_constants[ $this->tokens[ $i ]['content'] ] ) === true + ) { + $tokensAsString .= $this->wp_time_constants[ $this->tokens[ $i ]['content'] ]; + continue; + } + + if ( $this->tokens[ $i ]['code'] === T_OPEN_PARENTHESIS ) { + $tokensAsString .= $this->tokens[ $i ]['content']; + ++$openParens; + continue; + } + + if ( $this->tokens[ $i ]['code'] === T_CLOSE_PARENTHESIS ) { + $tokensAsString .= $this->tokens[ $i ]['content']; + --$openParens; + continue; + } + + if ( $this->tokens[ $i ]['code'] === T_CONSTANT_ENCAPSED_STRING ) { + $content = TextStrings::stripQuotes( $this->tokens[ $i ]['content'] ); + if ( is_numeric( $content ) === true ) { + $tokensAsString .= $content; + continue; + } + } + + // Encountered an unexpected token. Manual inspection needed. + $this->phpcsFile->addWarning( $message, $reportPtr, $error_code, $data ); + + return; + } + + if ( $tokensAsString === '' ) { + // Nothing found to evaluate. + return; + } + + $tokensAsString = trim( $tokensAsString ); + + if ( $openParens !== 0 ) { + /* + * Shouldn't be possible as that would indicate a parse error in the original code, + * but let's prevent getting parse errors in the `eval`-ed code. + */ + if ( $openParens > 0 ) { + $tokensAsString .= str_repeat( ')', $openParens ); + } else { + $tokensAsString = str_repeat( '(', abs( $openParens ) ) . $tokensAsString; + } + } + + $time = @eval( "return $tokensAsString;" ); // phpcs:ignore Squiz.PHP.Eval,WordPress.PHP.NoSilencedErrors -- No harm here. + + if ( $time === false ) { + /* + * The eval resulted in a parse error. This will only happen for backfilled + * arithmetic operator tokens, like T_POW, on PHP versions in which the token + * did not exist. In that case, flag for manual inspection. + */ + $this->phpcsFile->addWarning( $message, $reportPtr, $error_code, $data ); + return; + } + + if ( $time < 300 && (int) $time !== 0 ) { + $message = 'Low cache expiry time of %s seconds detected. It is recommended to have 300 seconds or more.'; + $data = [ $time ]; + + if ( (string) $time !== $tokensAsString ) { + $message .= ' Found: "%s"'; + $data[] = $tokensAsString; + } + + $this->phpcsFile->addWarning( $message, $reportPtr, 'LowCacheTime', $data ); + } + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/NoPagingSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/NoPagingSniff.php new file mode 100644 index 00000000..c751f021 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/NoPagingSniff.php @@ -0,0 +1,55 @@ + [ + 'type' => 'error', + 'message' => 'Disabling pagination is prohibited in VIP context, do not set `%s` to `%s` ever.', + 'keys' => [ + 'nopaging', + ], + ], + ]; + } + + /** + * Callback to process each confirmed key, to check value. + * + * @param string $key Array index / key. + * @param mixed $val Assigned value. + * @param int $line Token line. + * @param array $group Group definition. + * + * @return bool FALSE if no match, TRUE if matches. + */ + public function callback( $key, $val, $line, $group ) { + $key = strtolower( $key ); + + return ( $key === 'nopaging' && ( $val === 'true' || $val === '1' ) ); + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/OrderByRandSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/OrderByRandSniff.php new file mode 100644 index 00000000..2747b242 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/OrderByRandSniff.php @@ -0,0 +1,55 @@ + rand. + * + * @link https://docs.wpvip.com/technical-references/code-review/vip-errors/#h-order-by-rand + * + * @since 0.5.0 + */ +class OrderByRandSniff extends AbstractArrayAssignmentRestrictionsSniff { + + /** + * Groups of variables to restrict. + * + * @return array + */ + public function getGroups() { + return [ + 'orderby' => [ + 'type' => 'error', + 'message' => 'Detected forbidden query_var "%s" of %s. Use vip_get_random_posts() instead.', + 'keys' => [ + 'orderby', + ], + ], + ]; + } + + /** + * Callback to process each confirmed key, to check value + * + * @param string $key Array index / key. + * @param mixed $val Assigned value. + * @param int $line Token line. + * @param array $group Group definition. + * + * @return bool FALSE if no match, TRUE if matches. + */ + public function callback( $key, $val, $line, $group ) { + $val = TextStrings::stripQuotes( $val ); + return strtolower( $val ) === 'rand'; + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/RegexpCompareSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/RegexpCompareSniff.php new file mode 100644 index 00000000..536bd1ee --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/RegexpCompareSniff.php @@ -0,0 +1,52 @@ + [ + 'type' => 'error', + 'message' => 'Detected regular expression comparison. `%s` is set to `%s`.', + 'keys' => [ + 'compare', + 'meta_compare', + ], + ], + ]; + } + + /** + * Callback to process each confirmed key, to check value. + * + * @param string $key Array index / key. + * @param mixed $val Assigned value. + * @param int $line Token line. + * @param array $group Group definition. + * + * @return bool FALSE if no match, TRUE if matches. + */ + public function callback( $key, $val, $line, $group ) { + $val = TextStrings::stripQuotes( $val ); + return ( strpos( $val, 'NOT REGEXP' ) === 0 + || strpos( $val, 'REGEXP' ) === 0 + ); + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/RemoteRequestTimeoutSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/RemoteRequestTimeoutSniff.php new file mode 100644 index 00000000..072ba5af --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/RemoteRequestTimeoutSniff.php @@ -0,0 +1,47 @@ + [ + 'type' => 'error', + 'message' => 'Detected high remote request timeout. `%s` is set to `%d`.', + 'keys' => [ + 'timeout', + ], + ], + ]; + } + + /** + * Callback to process each confirmed key, to check value. + * + * @param string $key Array index / key. + * @param mixed $val Assigned value. + * @param int $line Token line. + * @param array $group Group definition. + * + * @return bool FALSE if no match, TRUE if matches. + */ + public function callback( $key, $val, $line, $group ) { + return (int) $val > 3; + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/TaxonomyMetaInOptionsSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/TaxonomyMetaInOptionsSniff.php new file mode 100644 index 00000000..07607275 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/TaxonomyMetaInOptionsSniff.php @@ -0,0 +1,132 @@ +tokens[ $stackPtr ]['content'], $this->option_functions, true ) === false ) { + return; + } + + $openBracket = $this->phpcsFile->findNext( Tokens::$emptyTokens, $stackPtr + 1, null, true ); + + if ( $this->tokens[ $openBracket ]['code'] !== T_OPEN_PARENTHESIS ) { + return; + } + + $param_ptr = $this->phpcsFile->findNext( Tokens::$emptyTokens, $openBracket + 1, null, true ); + + if ( $this->tokens[ $param_ptr ]['code'] === T_DOUBLE_QUOTED_STRING ) { + foreach ( $this->taxonomy_term_patterns as $taxonomy_term_pattern ) { + if ( strpos( $this->tokens[ $param_ptr ]['content'], $taxonomy_term_pattern ) !== false ) { + $this->addPossibleTermMetaInOptionsWarning( $stackPtr ); + return; + } + } + } elseif ( $this->tokens[ $param_ptr ]['code'] === T_CONSTANT_ENCAPSED_STRING ) { + + $string_concat = $this->phpcsFile->findNext( Tokens::$emptyTokens, $param_ptr + 1, null, true ); + if ( $this->tokens[ $string_concat ]['code'] !== T_STRING_CONCAT ) { + return; + } + + $variable_name = $this->phpcsFile->findNext( Tokens::$emptyTokens, $string_concat + 1, null, true ); + if ( $this->tokens[ $variable_name ]['code'] !== T_VARIABLE ) { + return; + } + + foreach ( $this->taxonomy_term_patterns as $taxonomy_term_pattern ) { + if ( strpos( $this->tokens[ $variable_name ]['content'], $taxonomy_term_pattern ) !== false ) { + $this->addPossibleTermMetaInOptionsWarning( $stackPtr ); + return; + } + } + + $object_operator = $this->phpcsFile->findNext( Tokens::$emptyTokens, $variable_name + 1, null, true ); + if ( $this->tokens[ $object_operator ]['code'] !== T_OBJECT_OPERATOR ) { + return; + } + + $object_property = $this->phpcsFile->findNext( Tokens::$emptyTokens, $object_operator + 1, null, true ); + if ( $this->tokens[ $object_property ]['code'] !== T_STRING ) { + return; + } + + foreach ( $this->taxonomy_term_patterns as $taxonomy_term_pattern ) { + if ( strpos( $this->tokens[ $object_property ]['content'], $taxonomy_term_pattern ) !== false ) { + $this->addPossibleTermMetaInOptionsWarning( $stackPtr ); + return; + } + } + } + } + + /** + * Helper method for composing the Warning for all possible cases. + * + * @param int $stackPtr The position of the current token in the stack passed in $tokens. + * + * @return void + */ + public function addPossibleTermMetaInOptionsWarning( $stackPtr ) { + $message = 'Possible detection of storing taxonomy term meta in options table. Needs manual inspection. All such data should be stored in term_meta.'; + $this->phpcsFile->addWarning( $message, $stackPtr, 'PossibleTermMetaInOptions' ); + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/WPQueryParamsSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/WPQueryParamsSniff.php new file mode 100644 index 00000000..9c247f8d --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Performance/WPQueryParamsSniff.php @@ -0,0 +1,98 @@ + [ + 'name' => 'SuppressFilters', + 'type' => 'error', + 'message' => 'Setting `suppress_filters` to `true` is prohibited.', + 'keys' => [ + 'suppress_filters', + ], + ], + 'PostNotIn' => [ + 'name' => 'PostNotIn', + 'type' => 'warning', + 'message' => 'Using exclusionary parameters, like %s, in calls to get_posts() should be done with caution, see https://wpvip.com/documentation/performance-improvements-by-removing-usage-of-post__not_in/ for more information.', + 'keys' => [ + 'post__not_in', + 'exclude', + ], + ], + ]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @param int $stackPtr The position of the current token in the stack. + * + * @return void + */ + public function process_token( $stackPtr ) { + $this->in_get_users = ContextHelper::is_in_function_call( $this->phpcsFile, $stackPtr, [ 'get_users' => true ], true, true ); + + parent::process_token( $stackPtr ); + } + + + /** + * Callback to process a confirmed key which doesn't need custom logic, but should always error. + * + * @param string $key Array index / key. + * @param mixed $val Assigned value. + * @param int $line Token line. + * @param array $group Group definition. + * + * @return bool FALSE if no match, TRUE if matches. + */ + public function callback( $key, $val, $line, $group ) { + switch ( $group['name'] ) { + case 'SuppressFilters': + return ( $val === 'true' ); + + case 'PostNotIn': + if ( $key === 'exclude' && $this->in_get_users !== false ) { + // This is not an array used by get_posts(). See #672. + return false; + } + + return true; + + default: + return false; + } + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/EscapingVoidReturnFunctionsSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/EscapingVoidReturnFunctionsSniff.php new file mode 100644 index 00000000..6a6ba281 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/EscapingVoidReturnFunctionsSniff.php @@ -0,0 +1,72 @@ +tokens[ $stackPtr ]['content'], 'esc_' ) !== 0 && strpos( $this->tokens[ $stackPtr ]['content'], 'wp_kses' ) !== 0 ) { + // Not what we are looking for. + return; + } + + $next_token = $this->phpcsFile->findNext( Tokens::$emptyTokens, $stackPtr + 1, null, true ); + + if ( $this->tokens[ $next_token ]['code'] !== T_OPEN_PARENTHESIS ) { + // Not a function call. + return; + } + + $next_token = $this->phpcsFile->findNext( Tokens::$emptyTokens, $next_token + 1, null, true ); + + if ( $this->tokens[ $next_token ]['code'] !== T_STRING ) { + // Not what we are looking for. + return; + } + + if ( $this->is_printing_function( $this->tokens[ $next_token ]['content'] ) ) { + $message = 'Attempting to escape `%s()` which is printing its output.'; + $data = [ $this->tokens[ $next_token ]['content'] ]; + $this->phpcsFile->addError( $message, $stackPtr, 'Found', $data ); + return; + } + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/ExitAfterRedirectSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/ExitAfterRedirectSniff.php new file mode 100644 index 00000000..3c90c315 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/ExitAfterRedirectSniff.php @@ -0,0 +1,66 @@ +tokens[ $stackPtr ]['content'] !== 'wp_redirect' && $this->tokens[ $stackPtr ]['content'] !== 'wp_safe_redirect' ) { + return; + } + + $openBracket = $this->phpcsFile->findNext( Tokens::$emptyTokens, $stackPtr + 1, null, true ); + + if ( $this->tokens[ $openBracket ]['code'] !== T_OPEN_PARENTHESIS ) { + return; + } + + $next_token = $this->phpcsFile->findNext( array_merge( Tokens::$emptyTokens, [ T_SEMICOLON, T_CLOSE_PARENTHESIS ] ), $this->tokens[ $openBracket ]['parenthesis_closer'] + 1, null, true ); + + $message = '`%s()` should almost always be followed by a call to `exit;`.'; + $data = [ $this->tokens[ $stackPtr ]['content'] ]; + + if ( $this->tokens[ $next_token ]['code'] === T_OPEN_CURLY_BRACKET ) { + $is_exit_in_scope = false; + for ( $i = $this->tokens[ $next_token ]['scope_opener']; $i <= $this->tokens[ $next_token ]['scope_closer']; $i++ ) { + if ( $this->tokens[ $i ]['code'] === T_EXIT ) { + $is_exit_in_scope = true; + } + } + if ( $is_exit_in_scope === false ) { + $this->phpcsFile->addError( $message, $stackPtr, 'NoExitInConditional', $data ); + } + } elseif ( $this->tokens[ $next_token ]['code'] !== T_EXIT ) { + $this->phpcsFile->addError( $message, $stackPtr, 'NoExit', $data ); + } + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/MustacheSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/MustacheSniff.php new file mode 100644 index 00000000..b026b443 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/MustacheSniff.php @@ -0,0 +1,74 @@ +tokens[ $stackPtr ]['content'], '{{{' ) !== false && strpos( $this->tokens[ $stackPtr ]['content'], '}}}' ) !== false ) { + // Mustache unescaped output notation. + $message = 'Found Mustache unescaped output notation: "{{{}}}".'; + $this->phpcsFile->addWarning( $message, $stackPtr, 'OutputNotation' ); + } + + if ( strpos( $this->tokens[ $stackPtr ]['content'], '{{&' ) !== false ) { + // Mustache unescaped variable notation. + $message = 'Found Mustache unescape variable notation: "{{&".'; + $this->phpcsFile->addWarning( $message, $stackPtr, 'VariableNotation' ); + } + + if ( strpos( $this->tokens[ $stackPtr ]['content'], '{{=' ) !== false ) { + // Mustache delimiter change. + $new_delimiter = trim( str_replace( [ '{{=', '=}}' ], '', substr( $this->tokens[ $stackPtr ]['content'], 0, strpos( $this->tokens[ $stackPtr ]['content'], '=}}' ) + 3 ) ) ); + $message = 'Found Mustache delimiter change notation. New delimiter is: %s.'; + $data = [ $new_delimiter ]; + $this->phpcsFile->addWarning( $message, $stackPtr, 'DelimiterChange', $data ); + } + + if ( strpos( $this->tokens[ $stackPtr ]['content'], 'SafeString' ) !== false ) { + // Handlebars.js Handlebars.SafeString does not get escaped. + $message = 'Found Handlebars.SafeString call which does not get escaped.'; + $this->phpcsFile->addWarning( $message, $stackPtr, 'SafeString' ); + } + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/PHPFilterFunctionsSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/PHPFilterFunctionsSniff.php new file mode 100644 index 00000000..e2907d9a --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/PHPFilterFunctionsSniff.php @@ -0,0 +1,90 @@ + true, + 'filter_input' => true, + 'filter_var_array' => true, + 'filter_input_array' => true, + ]; + + /** + * List of restricted filter names. + * + * @var array + */ + private $restricted_filters = [ + 'FILTER_DEFAULT' => true, + 'FILTER_UNSAFE_RAW' => true, + ]; + + /** + * Process the parameters of a matched function. + * + * @param int $stackPtr The position of the current token in the stack. + * @param string $group_name The name of the group which was matched. + * @param string $matched_content The token content (function name) which was matched + * in lowercase. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function process_parameters( $stackPtr, $group_name, $matched_content, $parameters ) { + if ( $matched_content === 'filter_input' ) { + if ( count( $parameters ) === 2 ) { + $message = 'Missing third parameter for "%s".'; + $data = [ $matched_content ]; + $this->phpcsFile->addWarning( $message, $stackPtr, 'MissingThirdParameter', $data ); + } + + if ( isset( $parameters[3], $this->restricted_filters[ $parameters[3]['raw'] ] ) ) { + $message = 'Please use an appropriate filter to sanitize, as "%s" does no filtering, see: http://php.net/manual/en/filter.filters.sanitize.php.'; + $data = [ strtoupper( $parameters[3]['raw'] ) ]; + $this->phpcsFile->addWarning( $message, $stackPtr, 'RestrictedFilter', $data ); + } + } else { + if ( count( $parameters ) === 1 ) { + $message = 'Missing second parameter for "%s".'; + $data = [ $matched_content ]; + $this->phpcsFile->addWarning( $message, $stackPtr, 'MissingSecondParameter', $data ); + } + + if ( isset( $parameters[2], $this->restricted_filters[ $parameters[2]['raw'] ] ) ) { + $message = 'Please use an appropriate filter to sanitize, as "%s" does no filtering, see http://php.net/manual/en/filter.filters.sanitize.php.'; + $data = [ strtoupper( $parameters[2]['raw'] ) ]; + $this->phpcsFile->addWarning( $message, $stackPtr, 'RestrictedFilter', $data ); + } + } + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/ProperEscapingFunctionSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/ProperEscapingFunctionSniff.php new file mode 100644 index 00000000..12ee05c7 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/ProperEscapingFunctionSniff.php @@ -0,0 +1,290 @@ +href|src|url|(^|\s+)action)?(?<=[a-z0-9_-])=(?:\\\\)?["\']*$`i'; + + /** + * List of escaping functions which are being tested. + * + * @var array + */ + protected $escaping_functions = [ + 'esc_url' => 'url', + 'esc_attr' => 'attr', + 'esc_attr__' => 'attr', + 'esc_attr_x' => 'attr', + 'esc_attr_e' => 'attr', + 'esc_html' => 'html', + 'esc_html__' => 'html', + 'esc_html_x' => 'html', + 'esc_html_e' => 'html', + ]; + + /** + * List of tokens we can skip. + * + * @var array + */ + private $echo_or_concat_tokens = + [ + T_ECHO => T_ECHO, + T_OPEN_TAG => T_OPEN_TAG, + T_OPEN_TAG_WITH_ECHO => T_OPEN_TAG_WITH_ECHO, + T_STRING_CONCAT => T_STRING_CONCAT, + T_NS_SEPARATOR => T_NS_SEPARATOR, + ]; + + /** + * List of attributes associated with url outputs. + * + * @deprecated 2.3.1 Currently unused by the sniff, but needed for + * for public methods which extending sniffs may be + * relying on. + * + * @var array + */ + private $url_attrs = [ + 'href', + 'src', + 'url', + 'action', + ]; + + /** + * List of syntaxes for inside attribute detection. + * + * @deprecated 2.3.1 Currently unused by the sniff, but needed for + * for public methods which extending sniffs may be + * relying on. + * + * @var array + */ + private $attr_endings = [ + '=', + '="', + "='", + "=\\'", + '=\\"', + ]; + + /** + * Keep track of whether or not we're currently in the first statement of a short open echo tag. + * + * @var int|false Integer stack pointer to the end of the first statement in the current + * short open echo tag or false when not in a short open echo tag. + */ + private $in_short_echo = false; + + /** + * Keep track of the current file, so we can reset $in_short_echo for each new file. + * + * @var string Absolute file name of the file being processed. Defaults to an empty string. + */ + private $current_file = ''; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @return array + */ + public function register() { + $this->echo_or_concat_tokens += Tokens::$emptyTokens; + + return [ + T_STRING, + T_OPEN_TAG_WITH_ECHO, + ]; + } + + /** + * Process this test when one of its tokens is encountered + * + * @param int $stackPtr The position of the current token in the stack passed in $tokens. + * + * @return void + */ + public function process_token( $stackPtr ) { + // Reset short echo context tracking variable for a new file. + if ( $this->phpcsFile->getFilename() !== $this->current_file ) { + $this->in_short_echo = false; + $this->current_file = $this->phpcsFile->getFilename(); + } + + /* + * Short open echo tags will act as an echo for the first expression and + * allow for passing multiple comma-separated parameters. + * However, short open echo tags also allow for additional statements after, but + * those have to be full PHP statements, not expressions. + * + * This snippet of code will keep track of whether or not we're in the first + * expression in a short open echo tag. + * $phpcsFile->findStartOfStatement() unfortunately is useless, as it will return + * the first token in the statement, which can be anything - variable, text string - + * without any indication of whether this is the start of a normal statement or + * a short open echo expression. + * So, if we used that, we'd need to walk back from every start of statement to + * the previous non-empty to see if it is the short open echo tag. + */ + if ( $this->tokens[ $stackPtr ]['code'] === T_OPEN_TAG_WITH_ECHO ) { + $end_of_echo = $this->phpcsFile->findNext( [ T_SEMICOLON, T_CLOSE_TAG ], ( $stackPtr + 1 ) ); + if ( $end_of_echo === false ) { + $this->in_short_echo = $this->phpcsFile->numTokens; + } else { + $this->in_short_echo = $end_of_echo; + } + + return; + } + + if ( $this->in_short_echo !== false && $this->in_short_echo < $stackPtr ) { + $this->in_short_echo = false; + } + + $function_name = strtolower( $this->tokens[ $stackPtr ]['content'] ); + + if ( isset( $this->escaping_functions[ $function_name ] ) === false ) { + return; + } + + $next_non_empty = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true ); + if ( $next_non_empty === false || $this->tokens[ $next_non_empty ]['code'] !== T_OPEN_PARENTHESIS ) { + // Not a function call. + return; + } + + $ignore = $this->echo_or_concat_tokens; + if ( $this->in_short_echo !== false ) { + $ignore[ T_COMMA ] = T_COMMA; + } else { + $start_of_statement = BCFile::findStartOfStatement( $this->phpcsFile, $stackPtr, T_COMMA ); + if ( $this->tokens[ $start_of_statement ]['code'] === T_ECHO ) { + $ignore[ T_COMMA ] = T_COMMA; + } + } + + $html = $this->phpcsFile->findPrevious( $ignore, $stackPtr - 1, null, true ); + + // Use $textStringTokens b/c heredoc and nowdoc tokens will never be encountered in this context anyways.. + if ( $html === false || isset( Tokens::$textStringTokens[ $this->tokens[ $html ]['code'] ] ) === false ) { + return; + } + + $data = [ $function_name ]; + + $content = $this->tokens[ $html ]['content']; + if ( isset( Tokens::$stringTokens[ $this->tokens[ $html ]['code'] ] ) === true ) { + $content = TextStrings::stripQuotes( $content ); + } + + $escaping_type = $this->escaping_functions[ $function_name ]; + + if ( $escaping_type === 'attr' && $this->is_outside_html_attr_context( $content ) ) { + $message = 'Wrong escaping function, using `%s()` in a context outside of HTML attributes may not escape properly.'; + $this->phpcsFile->addError( $message, $html, 'notAttrEscAttr', $data ); + return; + } + + if ( preg_match( self::ATTR_END_REGEX, $content, $matches ) !== 1 ) { + return; + } + + if ( $escaping_type !== 'url' && empty( $matches['attrname'] ) === false ) { + $message = 'Wrong escaping function. href, src, and action attributes should be escaped by `esc_url()`, not by `%s()`.'; + $this->phpcsFile->addError( $message, $stackPtr, 'hrefSrcEscUrl', $data ); + return; + } + + if ( $escaping_type === 'html' ) { + $message = 'Wrong escaping function. HTML attributes should be escaped by `esc_attr()`, not by `%s()`.'; + $this->phpcsFile->addError( $message, $stackPtr, 'htmlAttrNotByEscHTML', $data ); + return; + } + } + + /** + * Tests whether provided string ends with open attribute which expects a URL value. + * + * @deprecated 2.3.1 + * + * @param string $content Haystack in which we look for an open attribute which exects a URL value. + * + * @return bool True if string ends with open attribute which expects a URL value. + */ + public function attr_expects_url( $content ) { + $attr_expects_url = false; + foreach ( $this->url_attrs as $attr ) { + foreach ( $this->attr_endings as $ending ) { + if ( $this->endswith( $content, $attr . $ending ) === true ) { + $attr_expects_url = true; + break; + } + } + } + return $attr_expects_url; + } + + /** + * Tests whether provided string ends with open HMTL attribute. + * + * @deprecated 2.3.1 + * + * @param string $content Haystack in which we look for open HTML attribute. + * + * @return bool True if string ends with open HTML attribute. + */ + public function is_html_attr( $content ) { + $is_html_attr = false; + foreach ( $this->attr_endings as $ending ) { + if ( $this->endswith( $content, $ending ) === true ) { + $is_html_attr = true; + break; + } + } + return $is_html_attr; + } + + /** + * Tests whether an attribute escaping function is being used outside of an HTML tag. + * + * @param string $content Haystack where we look for the end of a HTML tag. + * + * @return bool True if the passed string ends a HTML tag. + */ + public function is_outside_html_attr_context( $content ) { + return $this->endswith( trim( $content ), '>' ); + } + + /** + * A helper function which tests whether string ends with some other. + * + * @param string $haystack String which is being tested. + * @param string $needle The substring, which we try to locate on the end of the $haystack. + * + * @return bool True if haystack ends with needle. + */ + public function endswith( $haystack, $needle ) { + return substr( $haystack, -strlen( $needle ) ) === $needle; + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/StaticStrreplaceSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/StaticStrreplaceSniff.php new file mode 100644 index 00000000..58e90e74 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/StaticStrreplaceSniff.php @@ -0,0 +1,85 @@ +tokens[ $stackPtr ]['content'] !== 'str_replace' ) { + return; + } + + $openBracket = $this->phpcsFile->findNext( Tokens::$emptyTokens, $stackPtr + 1, null, true ); + + if ( $this->tokens[ $openBracket ]['code'] !== T_OPEN_PARENTHESIS ) { + return; + } + + $next_start_ptr = $openBracket + 1; + for ( $i = 0; $i < 3; $i++ ) { + $param_ptr = $this->phpcsFile->findNext( array_merge( Tokens::$emptyTokens, [ T_COMMA ] ), $next_start_ptr, null, true ); + + if ( $this->tokens[ $param_ptr ]['code'] === T_ARRAY ) { + $openBracket = $this->phpcsFile->findNext( Tokens::$emptyTokens, $param_ptr + 1, null, true ); + if ( $this->tokens[ $openBracket ]['code'] !== T_OPEN_PARENTHESIS ) { + return; + } + + // Find the closing bracket. + $closeBracket = $this->tokens[ $openBracket ]['parenthesis_closer']; + + $array_item_ptr = $this->phpcsFile->findNext( array_merge( Tokens::$emptyTokens, [ T_COMMA ] ), $openBracket + 1, $closeBracket, true ); + while ( $array_item_ptr !== false ) { + + if ( $this->tokens[ $array_item_ptr ]['code'] !== T_CONSTANT_ENCAPSED_STRING ) { + return; + } + $array_item_ptr = $this->phpcsFile->findNext( array_merge( Tokens::$emptyTokens, [ T_COMMA ] ), $array_item_ptr + 1, $closeBracket, true ); + } + + $next_start_ptr = $closeBracket + 1; + continue; + + } + + if ( $this->tokens[ $param_ptr ]['code'] !== T_CONSTANT_ENCAPSED_STRING ) { + return; + } + + $next_start_ptr = $param_ptr + 1; + + } + + $message = 'This code pattern is often used to run a very dangerous shell programs on your server. The code in these files needs to be reviewed, and possibly cleaned.'; + $this->phpcsFile->addError( $message, $stackPtr, 'StaticStrreplace' ); + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/TwigSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/TwigSniff.php new file mode 100644 index 00000000..fdc8f643 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/TwigSniff.php @@ -0,0 +1,59 @@ +tokens[ $stackPtr ]['content'] ) === 1 ) { + // Twig autoescape disabled. + $message = 'Found Twig autoescape disabling notation.'; + $this->phpcsFile->addWarning( $message, $stackPtr, 'AutoescapeFalse' ); + } + + if ( preg_match( '/\|\s*raw/', $this->tokens[ $stackPtr ]['content'] ) === 1 ) { + // Twig default unescape filter. + $message = 'Found Twig default unescape filter: "|raw".'; + $this->phpcsFile->addWarning( $message, $stackPtr, 'RawFound' ); + } + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/UnderscorejsSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/UnderscorejsSniff.php new file mode 100644 index 00000000..ecb40db2 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/UnderscorejsSniff.php @@ -0,0 +1,160 @@ +|$)`'; + + /** + * Regex to match execute notations containing a print command + * and retrieve a code snippet. + * + * @var string + */ + const UNESCAPED_PRINT_REGEX = '`<%\s*(?:print\s*\(.+?\)\s*;|__p\s*\+=.+?)\s*%>`'; + + /** + * Regex to match the "interpolate" keyword when used to overrule the ERB-style delimiters. + * + * @var string + */ + const INTERPOLATE_KEYWORD_REGEX = '`(?:templateSettings\.interpolate|\.interpolate\s*=\s*/|interpolate\s*:\s*/)`'; + + /** + * A list of tokenizers this sniff supports. + * + * @var string[] + */ + public $supportedTokenizers = [ 'JS', 'PHP' ]; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @return array + */ + public function register() { + $targets = Tokens::$textStringTokens; + $targets[] = T_PROPERTY; + $targets[] = T_STRING; + + return $targets; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @param int $stackPtr The position of the current token in the stack passed in $tokens. + * + * @return void + */ + public function process_token( $stackPtr ) { + /* + * Ignore Gruntfile.js files as they are configuration, not code. + */ + $file_name = TextStrings::stripQuotes( $this->phpcsFile->getFileName() ); + $file_name = strtolower( basename( $file_name ) ); + + if ( $file_name === 'gruntfile.js' ) { + return; + } + + /* + * Check for delimiter change in JS files. + */ + if ( $this->tokens[ $stackPtr ]['code'] === T_STRING + || $this->tokens[ $stackPtr ]['code'] === T_PROPERTY + ) { + if ( $this->phpcsFile->tokenizerType !== 'JS' ) { + // These tokens are only relevant for JS files. + return; + } + + if ( $this->tokens[ $stackPtr ]['content'] !== 'interpolate' ) { + return; + } + + // Check the context to prevent false positives. + if ( $this->tokens[ $stackPtr ]['code'] === T_STRING ) { + $prev = $this->phpcsFile->findPrevious( Tokens::$emptyTokens, ( $stackPtr - 1 ), null, true ); + if ( $prev === false || $this->tokens[ $prev ]['code'] !== T_OBJECT_OPERATOR ) { + return; + } + + $prevPrev = $this->phpcsFile->findPrevious( Tokens::$emptyTokens, ( $stackPtr - 1 ), null, true ); + $next = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true ); + if ( ( $prevPrev === false + || $this->tokens[ $prevPrev ]['code'] !== T_STRING + || $this->tokens[ $prevPrev ]['content'] !== 'templateSettings' ) + && ( $next === false + || $this->tokens[ $next ]['code'] !== T_EQUAL ) + ) { + return; + } + } + + // Underscore.js delimiter change. + $message = 'Found Underscore.js delimiter change notation.'; + $this->phpcsFile->addWarning( $message, $stackPtr, 'InterpolateFound' ); + + return; + } + + $content = TextStrings::stripQuotes( $this->tokens[ $stackPtr ]['content'] ); + + $match_count = preg_match_all( self::UNESCAPED_INTERPOLATE_REGEX, $content, $matches ); + if ( $match_count > 0 ) { + foreach ( $matches[0] as $match ) { + if ( strpos( $match, '_.escape(' ) !== false ) { + continue; + } + + // Underscore.js unescaped output. + $message = 'Found Underscore.js unescaped output notation: "%s".'; + $data = [ $match ]; + $this->phpcsFile->addWarning( $message, $stackPtr, 'OutputNotation', $data ); + } + } + + $match_count = preg_match_all( self::UNESCAPED_PRINT_REGEX, $content, $matches ); + if ( $match_count > 0 ) { + foreach ( $matches[0] as $match ) { + if ( strpos( $match, '_.escape(' ) !== false ) { + continue; + } + + // Underscore.js unescaped output. + $message = 'Found Underscore.js unescaped print execution: "%s".'; + $data = [ $match ]; + $this->phpcsFile->addWarning( $message, $stackPtr, 'PrintExecution', $data ); + } + } + + if ( $this->phpcsFile->tokenizerType !== 'JS' + && preg_match( self::INTERPOLATE_KEYWORD_REGEX, $content ) > 0 + ) { + // Underscore.js delimiter change. + $message = 'Found Underscore.js delimiter change notation.'; + $this->phpcsFile->addWarning( $message, $stackPtr, 'InterpolateFound' ); + } + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/VuejsSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/VuejsSniff.php new file mode 100644 index 00000000..7f9d9e73 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Security/VuejsSniff.php @@ -0,0 +1,52 @@ +tokens[ $stackPtr ]['content'], 'v-html' ) !== false ) { + // Vue autoescape disabled. + $message = 'Found Vue.js non-escaped (raw) HTML directive.'; + $this->phpcsFile->addWarning( $message, $stackPtr, 'RawHTMLDirectiveFound' ); + } + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Sniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Sniff.php new file mode 100644 index 00000000..8a53228f --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Sniff.php @@ -0,0 +1,20 @@ + true, + 'add_filter' => true, + ]; + + /** + * CSS properties this sniff is looking for. + * + * @var array + */ + protected $target_css_properties = [ + 'visibility' => [ + 'type' => '!=', + 'value' => 'hidden', + ], + 'display' => [ + 'type' => '!=', + 'value' => 'none', + ], + 'opacity' => [ + 'type' => '>', + 'value' => 0.3, + ], + ]; + + /** + * CSS selectors this sniff is looking for. + * + * @var array + */ + protected $target_css_selectors = [ + '.show-admin-bar', + '#wpadminbar', + ]; + + /** + * String tokens within PHP files we want to deal with. + * + * Set from the register() method. + * + * @var array + */ + private $string_tokens = []; + + /** + * Regex template for use with the CSS selectors in combination with PHP text strings. + * + * @var string + */ + private $target_css_selectors_regex = '`(?:%s).*?\{(.*)$`'; + + /** + * Property to keep track of whether a ' ) !== false ) { + // Make sure we check any content on this line before the closing style tag. + $this->in_style[ $file_name ] = false; + $content = trim( substr( $content, 0, strpos( $content, '' ) ) ); + } + } elseif ( $this->has_html_open_tag( 'style', $stackPtr, $content ) === true ) { + // Ok, found a ' ) === false ) { + // Make sure we check any content on this line after the opening style tag. + $this->in_style[ $file_name ] = true; + $content = trim( substr( $content, strpos( $content, '' ); + $content = trim( substr( $content, $start, $end - $start ) ); + unset( $start, $end ); + } + } else { + return; + } + + // Are we in one of the target selectors ? + if ( $this->in_target_selector[ $file_name ] === true ) { + if ( strpos( $content, '}' ) !== false ) { + // Make sure we check any content on this line before the selector closing brace. + $this->in_target_selector[ $file_name ] = false; + $content = trim( substr( $content, 0, strpos( $content, '}' ) ) ); + } + } elseif ( preg_match( $this->target_css_selectors_regex, $content, $matches ) > 0 ) { + // Ok, found a new target selector. + $content = ''; + + if ( isset( $matches[1] ) && $matches[1] !== '' ) { + if ( strpos( $matches[1], '}' ) === false ) { + // Make sure we check any content on this line before the closing brace. + $this->in_target_selector[ $file_name ] = true; + $content = trim( $matches[1] ); + } else { + // Ok, we have the selector open and close brace on the same line. + $content = trim( substr( $matches[1], 0, strpos( $matches[1], '}' ) ) ); + } + } else { + $this->in_target_selector[ $file_name ] = true; + } + } else { + return; + } + unset( $matches ); + + // Now let's do the check for the CSS properties. + if ( ! empty( $content ) ) { + foreach ( $this->target_css_properties as $property => $requirements ) { + if ( strpos( $content, $property ) !== false ) { + $error = true; + + // Check the value of the CSS property. + if ( $this->remove_only === true && preg_match( '`' . preg_quote( $property, '`' ) . '\s*:\s*(.+?)\s*(?:!important)?;`', $content, $matches ) > 0 ) { + $value = trim( $matches[1] ); + $valid = $this->validate_css_property_value( $value, $requirements['type'], $requirements['value'] ); + if ( $valid === true ) { + $error = false; + } + } + + if ( $error === true ) { + $this->addHidingDetectedError( $stackPtr ); + } + } + } + } + } + + /** + * Processes this test for T_STYLE tokens in CSS files. + * + * @param int $stackPtr The position of the current token in the stack passed in $tokens. + * + * @return void + */ + protected function process_css_style( $stackPtr ) { + if ( ! isset( $this->target_css_properties[ $this->tokens[ $stackPtr ]['content'] ] ) ) { + // Not one of the CSS properties we're interested in. + return; + } + + $css_property = $this->target_css_properties[ $this->tokens[ $stackPtr ]['content'] ]; + + // Check if the CSS selector matches. + $opener = $this->phpcsFile->findPrevious( \T_OPEN_CURLY_BRACKET, $stackPtr ); + if ( $opener !== false ) { + for ( $i = ( $opener - 1 ); $i >= 0; $i-- ) { + if ( isset( Tokens::$commentTokens[ $this->tokens[ $i ]['code'] ] ) + || $this->tokens[ $i ]['code'] === \T_CLOSE_CURLY_BRACKET + ) { + break; + } + } + $start = ( $i + 1 ); + $selector = trim( GetTokensAsString::normal( $this->phpcsFile, $start, ( $opener - 1 ) ) ); + unset( $i ); + + foreach ( $this->target_css_selectors as $target_selector ) { + if ( strpos( $selector, $target_selector ) !== false ) { + $error = true; + + if ( $this->remove_only === true ) { + // Check the value of the CSS property. + $valuePtr = $this->phpcsFile->findNext( [ \T_COLON, \T_WHITESPACE ], $stackPtr + 1, null, true ); + $value = $this->tokens[ $valuePtr ]['content']; + $valid = $this->validate_css_property_value( $value, $css_property['type'], $css_property['value'] ); + if ( $valid === true ) { + $error = false; + } + } + + if ( $error === true ) { + $this->addHidingDetectedError( $stackPtr ); + } + } + } + } + } + + /** + * Consolidated violation. + * + * @param int $stackPtr The position of the current token in the stack passed in $tokens. + * + * @return void + */ + private function addHidingDetectedError( $stackPtr ) { + $message = 'Hiding of the admin bar is not allowed.'; + $this->phpcsFile->addError( $message, $stackPtr, 'HidingDetected' ); + } + + /** + * Verify if a CSS property value complies with an expected value. + * + * {@internal This is a method stub, doing only what is needed for this sniff. + * If at some point in the future other sniff would need similar functionality, + * this method should be moved to the WordPress_Sniff class and expanded to cover + * all types of comparisons.}} + * + * @param mixed $value The value of CSS property. + * @param string $compare_type The type of comparison to use for the validation. + * @param string $compare_value The value to compare against. + * + * @return bool True if the property value complies, false otherwise. + */ + protected function validate_css_property_value( $value, $compare_type, $compare_value ) { + switch ( $compare_type ) { + case '!=': + return $value !== $compare_value; + + case '>': + return $value > $compare_value; + } + return false; + } + + /** + * Check if a content string contains a specific HTML open tag. + * + * @param string $tag_name The name of the HTML tag without brackets. So if + * searching for ' open tag, false otherwise. + */ + public function has_html_open_tag( $tag_name, $stackPtr = null, $content = null ) { + if ( $content === null && isset( $stackPtr ) ) { + $content = $this->tokens[ $stackPtr ]['content']; + } + + return $content !== null && strpos( $content, '<' . $tag_name ) !== false; + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Variables/RestrictedVariablesSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Variables/RestrictedVariablesSniff.php new file mode 100644 index 00000000..65687642 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Variables/RestrictedVariablesSniff.php @@ -0,0 +1,67 @@ + array( + * 'wpdb' => array( + * 'type' => 'error' | 'warning', + * 'message' => 'Dont use this one please!', + * 'variables' => array( '$val', '$var' ), + * 'object_vars' => array( '$foo->bar', .. ), + * 'array_members' => array( '$foo['bar']', .. ), + * ) + * ) + * + * @return array + */ + public function getGroups() { + return [ + 'user_meta' => [ + 'type' => 'error', + 'message' => 'Usage of users tables is highly discouraged in VIP context', + 'object_vars' => [ + '$wpdb->users', + ], + ], + 'session' => [ + 'type' => 'error', + 'message' => 'Usage of $_SESSION variable is prohibited.', + 'variables' => [ + '$_SESSION', + ], + ], + + // @link https://docs.wpvip.com/technical-references/code-review/vip-errors/#h-cache-constraints + 'cache_constraints' => [ + 'type' => 'warning', + 'message' => 'Due to server-side caching, server-side based client related logic might not work. We recommend implementing client side logic in JavaScript instead.', + 'variables' => [ + '$_COOKIE', + ], + 'array_members' => [ + '$_SERVER[\'HTTP_USER_AGENT\']', + '$_SERVER[\'REMOTE_ADDR\']', + ], + ], + ]; + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Variables/ServerVariablesSniff.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Variables/ServerVariablesSniff.php new file mode 100644 index 00000000..09f00bf9 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/Sniffs/Variables/ServerVariablesSniff.php @@ -0,0 +1,72 @@ + [ + 'PHP_AUTH_USER' => true, + 'PHP_AUTH_PW' => true, + ], + 'userControlledVariables' => [ + 'HTTP_X_IP_TRAIL' => true, + 'HTTP_X_FORWARDED_FOR' => true, + 'REMOTE_ADDR' => true, + ], + ]; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @return array + */ + public function register() { + return [ + T_VARIABLE, + ]; + } + + /** + * Process this test when one of its tokens is encountered + * + * @param int $stackPtr The position of the current token in the stack passed in $tokens. + * + * @return void + */ + public function process_token( $stackPtr ) { + + if ( $this->tokens[ $stackPtr ]['content'] !== '$_SERVER' ) { + // Not the variable we are looking for. + return; + } + + $variableNamePtr = $this->phpcsFile->findNext( [ T_CONSTANT_ENCAPSED_STRING ], $stackPtr + 1, null, false, null, true ); + $variableName = str_replace( [ "'", '"' ], '', $this->tokens[ $variableNamePtr ]['content'] ); + + if ( isset( $this->restrictedVariables['authVariables'][ $variableName ] ) ) { + $message = 'Basic authentication should not be handled via PHP code.'; + $this->phpcsFile->addError( $message, $stackPtr, 'BasicAuthentication' ); + } elseif ( isset( $this->restrictedVariables['userControlledVariables'][ $variableName ] ) ) { + $message = 'Header "%s" is user-controlled and should be properly validated before use.'; + $data = [ $variableName ]; + $this->phpcsFile->addError( $message, $stackPtr, 'UserControlledHeaders', $data ); + } + } +} diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/ruleset-test.inc b/vendor/automattic/vipwpcs/WordPressVIPMinimum/ruleset-test.inc new file mode 100644 index 00000000..a20a8494 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/ruleset-test.inc @@ -0,0 +1,625 @@ + + + + 999, // Warning. +); +_query_posts( 'posts_per_page=999' ); // Warning. +$query_args['posts_per_page'] = 999; // Warning. + +// WordPress.DateTime.RestrictedFunctions +date_default_timezone_set( 'FooBar' ); // Error. + +// WordPress.DB.PreparedSQL +$b = function () { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable + global $wpdb; + $listofthings = wp_cache_get( 'foo' ); + if ( ! $listofthings ) { + $foo = "column = 'test'"; + + $listofthings = $wpdb->query( 'SELECT something FROM somewhere WHERE ' . $foo ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery -- Error. + wp_cache_set( 'foo', $listofthings ); + } +}; + +// WordPress.DB.DirectDatabaseQuery +$baz = $wpdb->get_results( $wpdb->prepare( 'SELECT X FROM Y ' ) ); // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Warning x 2. + +// WordPress.DB.SlowDBQuery +$test = [ + 'tax_query' => [], // Warning. +]; +new WP_Query( array( + 'meta_query' => [], // Warning. + 'meta_key' => 'foo', // Warning. + 'meta_value' => 'bar', // Warning. +) ); + +// WordPress.WP.GlobalVariablesOverride +$GLOBALS['wpdb'] = 'test'; // Error. + +// Universal.Operators.StrictComparisons +if ( true == $true ) { // Warning. +} + +// Generic.CodeAnalysis.AssignmentInCondition +if ( $test = get_post( $post ) ) { // Warning. +} + +// WordPress.PHP.StrictInArray +if ( true === in_array( $foo, $bar ) ) { // Warning. +} + +// WordPress.Functions.DontExtract +extract( $foobar ); // Error. + +// WordPress.WP.CronInterval +function my_add_weekly( $schedules ) { + $schedules['every_6_mins'] = array( + 'interval' => 360, + 'display' => __( 'Once every 6 minutes' ) + ); + return $schedules; +} +add_filter( 'cron_schedules', 'my_add_weekly'); // Warning. + +// Generic.NamingConventions.ConstructorName +class TestClass extends MyClass +{ + function __construct() { + parent::MYCLASS(); // Error. + parent::__construct(); + } +} +class OldClass +{ + function OldClass() // Error. + { + } +} + +// Generic.NamingConventions.ConstructorName +class TestClass extends MyClass { + function TestClass() { // Error. + parent::MyClass(); // Error. + parent::__construct(); + } +} + +// Generic.PHP.DisallowShortOpenTag +?> +// if (empty($this)) {echo 'This is will not work';} + +// Squiz.PHP.Eval +eval('$var = 4;'); // Error + Message. + +// WordPress.PHP.DiscouragedPHPFunctions +base64_decode( 'VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw=='); // Ok - exclude obfuscation group. +base64_encode( 'This is an encoded string' ); // Ok - exclude obfuscation group. +convert_uudecode( "+22!L;W9E(%!(4\"$`\n`" ); // Ok - exclude obfuscation group. +convert_uuencode( "test\ntext text\r\n" ); // Ok - exclude obfuscation group. +str_rot13( 'The quick brown fox jumps over the lazy dog.' ); // Ok - exclude obfuscation group. +serialize(); // Warning. +unserialize(); // Warning. +urlencode(); // Warning. +passthru( 'cat myfile.zip', $err ); // Warning. +$process = proc_open( 'php', $descriptorspec, $pipes, $cwd, $env ); // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Warning. +$last_line = system( 'ls', $retval ); // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Warning. +$handle = popen( '/bin/ls', 'r' ); // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Warning. + +// WordPress.PHP.DiscouragedPHPFunctions.runtime_configuration_error_reporting +error_reporting(); // Error. + +// WordPress.PHP.DiscouragedPHPFunctions.runtime_configuration_ini_restore +ini_restore(); // Error. + +// WordPress.PHP.DiscouragedPHPFunctions.runtime_configuration_apache_setenv +apache_setenv(); // Error. + +// WordPress.PHP.DiscouragedPHPFunctions.runtime_configuration_putenv +putenv(); // Error. + +// WordPress.PHP.DiscouragedPHPFunctions.runtime_configuration_set_include_path +set_include_path(); // Error. + +// WordPress.PHP.DiscouragedPHPFunctions.runtime_configuration_restore_include_path +restore_include_path(); // Error. + +// WordPress.PHP.DiscouragedPHPFunctions.runtime_configuration_magic_quotes_runtime +magic_quotes_runtime(); // Error. + +// WordPress.PHP.DiscouragedPHPFunctions.runtime_configuration_set_magic_quotes_runtime +set_magic_quotes_runtime(); // Error. + +// WordPress.PHP.DiscouragedPHPFunctions.runtime_configuration_dl +dl(); // Error. + +// WordPress.PHP.DiscouragedPHPFunctions.system_calls_exec +exec( 'whoami' ); // Error. + +// WordPress.PHP.DiscouragedPHPFunctions.system_calls_shell_exec +$output = shell_exec( 'ls -lart' ); // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Error. + +// WordPress.PHP.DevelopmentFunctions +var_dump(); // Warning. +var_export(); // Warning. +print_r(); // Warning. +trigger_error( 'message' ); // Warning. +set_error_handler(); // Warning. +debug_backtrace(); // Warning. +debug_print_backtrace(); // Warning. +wp_debug_backtrace_summary(); // Warning. + +// WordPress.PHP.DevelopmentFunctions.prevent_path_disclosure_phpinfo +phpinfo(); // Error. + +// WordPress.PHP.DevelopmentFunctions.error_log_error_log +error_log(); // Error. + +// WordPress.PHP.IniSet +ini_set( 'auto_detect_line_endings', true ); // Ok. +ini_set( 'highlight.bg', '#000000' ); // Ok. +ini_set( 'highlight.comment', '#000000' ); // Ok. +ini_set( 'highlight.default', '#000000' ); // Ok. +ini_set( 'highlight.html', '#000000' ); // Ok. +ini_set( 'highlight.keyword', '#000000' ); // Ok. +ini_set( 'highlight.string', '#000000' ); // Ok. +ini_set( 'short_open_tag', 1 ); // Ok. +ini_set( 'bcmath.scale', 1 ); // Error. +ini_set( 'display_errors', 1 ); // Error. +ini_set( 'error_reporting', 1 ); // Error. +ini_set( 'filter.default', 1 ); // Error. +ini_set( 'filter.default_flags', 1 ); // Error. +ini_set( 'iconv.input_encoding', 1 ); // Error. +ini_set( 'iconv.internal_encoding', 1 ); // Error. +ini_set( 'iconv.output_encoding', 1 ); // Error. +ini_set( 'ignore_user_abort', 1 ); // Error. +ini_set( 'log_errors', 1 ); // Error. +ini_set( 'max_execution_time', 1 ); // Error. +ini_set( 'memory_limit', 1 ); // Error. +ini_set( 'short_open_tag', 'off' ); // Error. +ini_set( 'foo', true ); // Warning. +ini_alter( 'auto_detect_line_endings', true ); // Ok. +ini_alter( 'highlight.bg', '#000000' ); // Ok. +ini_alter( 'highlight.comment', '#000000' ); // Ok. +ini_alter( 'highlight.default', '#000000' ); // Ok. +ini_alter( 'highlight.html', '#000000' ); // Ok. +ini_alter( 'highlight.keyword', '#000000' ); // Ok. +ini_alter( 'highlight.string', '#000000' ); // Ok. +ini_alter( 'short_open_tag', 1 ); // Ok. +ini_alter( 'bcmath.scale', 1 ); // Error. +ini_alter( 'display_errors', 1 ); // Error. +ini_alter( 'error_reporting', 1 ); // Error. +ini_alter( 'filter.default', 1 ); // Error. +ini_alter( 'filter.default_flags', 1 ); // Error. +ini_alter( 'iconv.input_encoding', 1 ); // Error. +ini_alter( 'iconv.internal_encoding', 1 ); // Error. +ini_alter( 'iconv.output_encoding', 1 ); // Error. +ini_alter( 'ignore_user_abort', 1 ); // Error. +ini_alter( 'log_errors', 1 ); // Error. +ini_alter( 'max_execution_time', 1 ); // Error. +ini_alter( 'memory_limit', 1 ); // Error. +ini_alter( 'short_open_tag', 'off' ); // Error. +ini_alter( 'foo', true ); // Warning. + +// WordPress.WP.AlternativeFunctions +curl_init(); // Warning + Message. +curl_close( $ch ); // Warning + Message. +CURL_getinfo(); // Warning + Message. +parse_url( 'http://example.com/' ); // Warning. +$json = json_encode( $thing ); // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Warning. +readfile(); // Warning. +fclose(); // Warning. +fopen(); // Warning. +fread(); // Warning. +fsockopen(); // Warning. +pfsockopen(); // Warning. +srand(); // Warning. +mt_srand(); // Warning. +rand(); // Warning. +mt_rand(); // Warning. + +// WordPressVIPMinimum.Functions.RestrictedFunctions.get_posts_get_children +get_children(); // Error + Message. + +// VariableAnalysis.CodeAnalysis.VariableAnalysis +function foo() { + $a = 'Hello'; + $c = compact( $a, $b ); // Warning x 2. + try { + do_something_silly(); + } catch ( Exception $e ) {} // Ok. +} + +/* The below rules are implicitly included via WordPressVIPMinimum */ + +// WordPressVIPMinimum.Classes.DeclarationCompatibility +class MyWidget extends WP_Widget { + function widget() { // Error. + } +} + +// WordPressVIPMinimum.Classes.RestrictedExtendClasses +class BadTestClass extends WP_CLI_Command { } // Warning. + + + + +// WordPressVIPMinimum.Constants.ConstantString +define( WPCOM_VIP ); // Error. + +// WordPressVIPMinimum.Constants.RestrictedConstants +if ( A8C_PROXIED_REQUEST === true ) { // Warning. +} +define( 'JETPACK_DEV_DEBUG', true ); // Error. + +// WordPressVIPMinimum.Files.IncludingFile +include ( MY_CONSTANT . "my_file.php" ); // Warning. +require_once( custom_function( 'test_file.php' ) ); // Warning. +require '../my_file.php'; // Error. +include_once("http://www.google.com/bad_file.php"); // Error. + +// WordPressVIPMinimum.Files.IncludingNonPHPFile +require_once __DIR__ . "/my_file.svg"; // Error. + +// WordPressVIPMinimum.Functions.CheckReturnValue +$my_theme_options = get_option( 'my_theme', false ); +if ( array_key_exists( 'key', $my_theme_options ) ) { } // Error. +echo 'My term link'; // Error. + +// WordPressVIPMinimum.Functions.DynamicCalls +$my_notokay_func = 'extract'; +$my_notokay_func(); // Error. + +// WordPressVIPMinimum.Functions.RestrictedFunctions + +opcache_reset(); // Error. +opcache_invalidate( 'test_script.php' ); // Error. +opcache_compile_file( $var ); // Error. +opcache_is_script_cached( 'test_script.php' ); // Error. +opcache_get_status(); // Error. +opcache_get_configuration(); // Error. + +wpcom_vip_irc(); // Error. +flush_rewrite_rules(); // Error. +$wp_rewrite->flush_rules(); // Error. +attachment_url_to_postid( $url ); // Error. + +switch_to_blog( $blogid ); // Warning. + +url_to_postid( $url ); // Error. +\add_role(); // Error. + + + + + +count_user_posts(); // Error. +wp_old_slug_redirect(); // Error. +get_adjacent_post(); // Error. +get_previous_post(); // Error. +get_previous_post_link(); // Error. +get_next_post(); // Error. +get_next_post_link(); // Error. +get_intermediate_image_sizes(); // Error. +wp_is_mobile(); // Error. +session_abort(); // Error. +session_cache_expire(); // Error. +session_cache_limiter(); // Error. +session_commit(); // Error. +session_create_id(); // Error. +session_decode(); // Error. +session_destroy(); // Error. +session_encode(); // Error. +session_gc(); // Error. +session_get_cookie_params(); // Error. +session_id(); // Error. +session_is_registered(); // Error. +session_module_name(); // Error. +session_name(); // Error. +session_regenerate_id(); // Error. +session_register_shutdown(); // Error. +session_register(); // Error. +session_reset(); // Error. +session_save_path(); // Error. +session_set_cookie_params(); // Error. +session_set_save_handler(); // Error. +session_start(); // Error. +session_status(); // Error. +session_unregister(); // Error. +session_unset(); // Error. +session_write_close(); // Error. + +file_put_contents( $file, $text, FILE_APPEND ); // Error. +while ( $count > $loop ) { + if ( flock( $fp, LOCK_EX ) ) { // Error. + fwrite( $fp, $text ); // Error. + } +} +fputcsv(); // Error. +fputs(); // Error. +ftruncate(); // Error. +is_writable(); // Error. +is_writeable(); // Error. +link(); // Error. +rename(); // Error. +symlink(); // Error. +tempnam(); // Error. +touch(); // Error. +unlink(); // Error. +mkdir(); // Error. +rmdir(); // Error. +chgrp(); // Error. +chown(); // Error. +chmod(); // Error. +lchgrp(); // Error. +lchown(); // Error. + + + +wp_mail(); // Warning. +mail(); // Warning. +is_multi_author(); // Warning. +the_sub_field( 'field' ); // Warning. +the_field( 'field' ); // Warning. +wp_remote_get( $url ); // Warning. +setcookie( 'cookie[three]', 'cookiethree' ); // Error. +get_posts(); // Warning. +wp_get_recent_posts(); // Warning. +$wp_random_testing = create_function( '$a, $b', 'return ( $b / $a ); '); // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Warning. +wpcom_vip_get_term_link(); // Warning. +wpcom_vip_get_term_by(); // Warning. +wpcom_vip_get_category_by_slug(); // Warning. + +// WordPressVIPMinimum.Functions.StripTagsSniff +strip_tags( 'Testing' ); // Warning. +strip_tags( 'Test', $text ); // Warning. + +// WordPressVIPMinimum.Hooks.AlwaysReturnInFilter +function bad_example_function_thing() { // Error. + if ( 1 === 0 ) { + if ( 1 === 1 ) { + return 'ahoj'; + } else { + return 'hello'; + } + } +} +add_filter( 'bad_example_function_filter', 'bad_example_function_thing' ); +add_filter( 'another_bad_example_closure', function() { // Error. + return; +} ); + +// WordPressVIPMinimum.Hooks.PreGetPosts +add_action( 'pre_get_posts', function( $wp_query ) { + if ( ! $wp_query->is_search() ) { + $wp_query->set( 'cat', '-5' ); // Warning. + } +} ); + +// WordPressVIPMinimum.Hooks.RestrictedHooks +add_filter( 'upload_mimes', 'bad_example_function' ); // Warning. +add_action( 'http_request_timeout', 'bad_example_function' ); // Warning. +add_filter('http_request_args', 'bad_example_function' ); // Warning. +add_action( 'do_robotstxt', 'my_do_robotstxt'); // Warning. +add_filter( 'robots_txt', function() { // Warning. + return 'test'; +} ); + + + + + +// WordPressVIPMinimum.Performance.CacheValueOverride +$bad_wp_users = wp_cache_get( md5( self::CACHE_KEY . '_wp_users'), self::CACHE_GROUP ); // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable +$bad_wp_users = false; // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Error. + +// WordPressVIPMinimum.Performance.FetchingRemoteData +$external_resource = file_get_contents( 'https://example.com' ); // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Warning. + +// WordPressVIPMinimum.Performance.LowExpiryCacheTime +wp_cache_set( 'test', $data, $group, 100 ); // Warning. +wp_cache_add( 123, $data, null, 1.5 * MINUTE_IN_SECONDS ); // Warning. +wp_cache_replace( 'test', $data, $group, 2*MINUTE_IN_SECONDS ); // Warning. + +// WordPressVIPMinimum.Performance.NoPaging +$args = array( // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable + 'nopaging' => true, // Error. +); +_query_posts( 'nopaging=true' ); // Error. + +// WordPressVIPMinimum.Performance.OrderByRand +$args = array( // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable + "orderby" => "RAND", // Error. +); +$query_args['orderby'] = 'rand'; // Error. + +// WordPressVIPMinimum.Performance.RegexpCompare +$query_args = array( + 'posts_per_page' => 1, + 'post_status' => 'draft', + 'meta_compare' => 'REGEXP', // Error. +); +$query_args = [ + 'post_status' => 'publish', + 'meta_query' => [ // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query + [ + 'compare' => 'REGEXP', // Error. + ] + ] +]; + +// WordPressVIPMinimum.Performance.RemoteRequestTimeout +wp_remote_post( $stdClass->endpoint, array( + 'method' => 'POST', + 'timeout' => 45, // Error. + 'httpversion' => '1.1', + 'blocking' => false, + 'body' => wp_json_encode( $stdClass->logs, JSON_UNESCAPED_SLASHES ), + ) +); + +// WordPressVIPMinimum.Performance.TaxonomyMetaInOptions +get_option( "taxonomy_rating_$obj->term_id" ); // Warning. +update_option( 'taxonomy_rating_' . $category_id ); // Warning. + +// WordPressVIPMinimum.Performance.WPQueryParams +$query_args = array( + 'post__not_in' => $posts_not_in, // Warning. + 'suppress_filters' => true, // Error. +); + +// WordPressVIPMinimum.Security.EscapingVoidReturnFunctions.Found +esc_js( _deprecated_argument() ); // Error. +esc_js( _deprecated_constructor() ); // Error. +esc_js( _deprecated_file( 'filename' ) ); // Error. +esc_js( _deprecated_function() ); // Error. +esc_js( _deprecated_hook() ); // Error. +esc_js( _doing_it_wrong() ); // Error. +esc_html( printf( 'foo', [] ) ); // Error. +esc_attr( user_error( 'foo', '' ) ); // Error. +esc_attr( vprintf( 'foo', [] ) ); // Error. +esc_attr( wp_die( 'foo' ) ); // Error. +esc_attr( wp_dropdown_pages() ); // Error. + +// WordPressVIPMinimum.Security.ExitAfterRedirect +function redirect_test() { + wp_safe_redirect( 'https.//vip.wordpress.com' ); // Error. +} +wp_redirect( 'https://vip.wordpress.com' ); // Error. + +// WordPressVIPMinimum.Security.PHPFilterFunctions +filter_input( INPUT_GET, 'foo' ); // Warning. +filter_input( INPUT_GET, "foo", FILTER_UNSAFE_RAW ); // Warning. +filter_var( $url, FILTER_DEFAULT ); // Warning. +filter_var_array( $array ); // Warning. +filter_input_array( $array ); // Warning. + +// WordPressVIPMinimum.Security.Mustache +echo '{{{data}}}'; // Warning. +?> + + '; // Error. +echo ''; // Error. + +// WordPressVIPMinimum.Security.StaticStrreplace +str_replace( 'foo', array( 'bar', 'foo' ), 'foobar' ); // Error. + +// WordPressVIPMinimum.Security.Underscorejs +echo ""; + +// WordPressVIPMinimum.Security.Vuejs +?>
    +

    +
    +#wpadminbar { + visibility: hidden; /* Error. */ + display: none; /* Error. */ + opacity: 0; /* Error. */ +} +'; +echo ''; // Error. +?> users"; // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Error. +$x = foo( sanitize_text_field( $_SERVER['HTTP_USER_AGENT'] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated,VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Warning. +foo( $_SESSION['bar'] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput -- Error. + +// WordPressVIPMinimum.Variables.ServerVariables +// phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotValidated,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized +$test = $_SERVER['PHP_AUTH_PW']; // Error. +bar( $_SERVER['HTTP_X_IP_TRAIL'] ); // Error. +$_SERVER['HTTP_X_FORWARDED_FOR']; // Error. +$_SERVER["REMOTE_ADDR"]; // Error. +// phpcs:enable WordPress.Security.ValidatedSanitizedInput.InputNotValidated,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized + +class MyClass { + function my_function() { + return function() { + $this->my_callback(); // OK - new VariableAnalysis doesn't flag $this as undefined in closure. + }; + } + + function my_callback() {} +} + +// Generic.VersionControl.GitMergeConflict +?> +<<<<<<< HEAD // Error. + +>>>>>>> // Error. + + + + + diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/ruleset-test.php b/vendor/automattic/vipwpcs/WordPressVIPMinimum/ruleset-test.php new file mode 100644 index 00000000..e78ae6a7 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/ruleset-test.php @@ -0,0 +1,321 @@ + [ + 4 => 1, + 7 => 1, + 11 => 1, + 16 => 1, + 17 => 1, + 21 => 1, + 27 => 2, + 35 => 1, + 45 => 1, + 54 => 1, + 73 => 1, + 88 => 1, + 104 => 1, + 110 => 1, + 117 => 1, + 118 => 1, + 124 => 1, + 130 => 1, + 147 => 1, + 150 => 1, + 153 => 1, + 156 => 1, + 159 => 1, + 162 => 1, + 165 => 1, + 168 => 1, + 171 => 1, + 174 => 1, + 177 => 1, + 190 => 1, + 193 => 1, + 204 => 1, + 205 => 1, + 206 => 1, + 207 => 1, + 208 => 1, + 209 => 1, + 210 => 1, + 211 => 1, + 212 => 1, + 213 => 1, + 214 => 1, + 215 => 1, + 216 => 1, + 226 => 1, + 227 => 1, + 228 => 1, + 229 => 1, + 230 => 1, + 231 => 1, + 232 => 1, + 233 => 1, + 234 => 1, + 235 => 1, + 236 => 1, + 237 => 1, + 238 => 1, + 259 => 1, + 274 => 1, + 285 => 1, + 290 => 1, + 295 => 1, + 296 => 1, + 299 => 1, + 303 => 1, + 304 => 1, + 308 => 1, + 312 => 1, + 313 => 1, + 314 => 1, + 315 => 1, + 316 => 1, + 317 => 1, + 319 => 1, + 320 => 1, + 321 => 1, + 322 => 1, + 326 => 1, + 327 => 1, + 333 => 1, + 334 => 1, + 335 => 1, + 336 => 1, + 337 => 1, + 338 => 1, + 339 => 1, + 340 => 1, + 341 => 1, + 342 => 1, + 343 => 1, + 344 => 1, + 345 => 1, + 346 => 1, + 347 => 1, + 348 => 1, + 349 => 1, + 350 => 1, + 351 => 1, + 352 => 1, + 353 => 1, + 354 => 1, + 355 => 1, + 356 => 1, + 357 => 1, + 358 => 1, + 359 => 1, + 360 => 1, + 361 => 1, + 362 => 1, + 363 => 1, + 364 => 1, + 365 => 1, + 366 => 1, + 367 => 1, + 369 => 1, + 371 => 1, + 372 => 1, + 375 => 1, + 376 => 1, + 377 => 1, + 378 => 1, + 379 => 1, + 380 => 1, + 381 => 1, + 382 => 1, + 383 => 1, + 384 => 1, + 385 => 1, + 386 => 1, + 387 => 1, + 388 => 1, + 389 => 1, + 390 => 1, + 391 => 1, + 392 => 1, + 402 => 1, + 415 => 1, + 425 => 1, + 451 => 1, + 463 => 1, + 465 => 1, + 469 => 1, + 471 => 1, + 477 => 1, + 483 => 1, + 491 => 1, + 505 => 1, + 509 => 1, + 510 => 1, + 511 => 1, + 512 => 1, + 513 => 1, + 514 => 1, + 515 => 1, + 516 => 1, + 517 => 1, + 518 => 1, + 519 => 1, + 523 => 1, + 525 => 1, + 550 => 1, + 551 => 1, + 554 => 1, + 569 => 1, + 570 => 1, + 573 => 1, + 574 => 1, + 575 => 1, + 578 => 1, + 581 => 1, + 582 => 1, + 583 => 1, + 588 => 1, + 590 => 1, + 594 => 1, + 595 => 1, + 596 => 1, + 597 => 1, + 612 => 1, + 614 => 1, + 621 => 1, + ], + 'warnings' => [ + 32 => 1, + 39 => 1, + 41 => 1, + 42 => 1, + 60 => 2, + 64 => 1, + 67 => 1, + 68 => 1, + 69 => 1, + 76 => 1, + 80 => 1, + 84 => 1, + 98 => 1, + 126 => 1, + 138 => 1, + 139 => 1, + 140 => 1, + 141 => 1, + 142 => 1, + 143 => 1, + 144 => 1, + 180 => 1, + 181 => 1, + 182 => 1, + 183 => 1, + 184 => 1, + 185 => 1, + 186 => 1, + 187 => 1, + 217 => 1, + 239 => 1, + 242 => 1, + 243 => 1, + 244 => 1, + 245 => 1, + 246 => 1, + 247 => 1, + 248 => 1, + 249 => 1, + 250 => 1, + 251 => 1, + 252 => 1, + 253 => 1, + 254 => 1, + 255 => 1, + 256 => 1, + 264 => 2, + 279 => 1, + 288 => 1, + 293 => 1, + 294 => 1, + 324 => 1, + 396 => 1, + 397 => 1, + 398 => 1, + 399 => 1, + 400 => 1, + 401 => 1, + 403 => 1, + 404 => 1, + 405 => 1, + 406 => 1, + 407 => 1, + 408 => 1, + 411 => 1, + 412 => 1, + 432 => 1, + 437 => 1, + 438 => 1, + 439 => 1, + 440 => 1, + 441 => 1, + 454 => 1, + 457 => 1, + 458 => 1, + 459 => 1, + 499 => 1, + 500 => 1, + 504 => 1, + 528 => 1, + 529 => 1, + 530 => 1, + 531 => 1, + 532 => 1, + 535 => 1, + 538 => 1, + 545 => 1, + 559 => 1, + 565 => 1, + 589 => 1, + 618 => 1, + ], + 'messages' => [ + 130 => [ + '`eval()` is a security risk, please refrain from using it.', + ], + 242 => [ + 'Using cURL functions is highly discouraged within VIP context. Please see: https://docs.wpvip.com/technical-references/code-quality-and-best-practices/retrieving-remote-data/.', + ], + 243 => [ + 'Using cURL functions is highly discouraged within VIP context. Please see: https://docs.wpvip.com/technical-references/code-quality-and-best-practices/retrieving-remote-data/.', + ], + 244 => [ + 'Using cURL functions is highly discouraged within VIP context. Please see: https://docs.wpvip.com/technical-references/code-quality-and-best-practices/retrieving-remote-data/.', + ], + 259 => [ + '`get_children()` performs a no-LIMIT query by default, make sure to set a reasonable `posts_per_page`. `get_children()` will do a -1 query by default, a maximum of 100 should be used.', + ], + ], +]; + +require __DIR__ . '/../tests/RulesetTest.php'; + +// Run the tests! +$test = new RulesetTest( 'WordPressVIPMinimum', $expected ); +if ( $test->passes() ) { + printf( 'All WordPressVIPMinimum tests passed!' . PHP_EOL ); + exit( 0 ); +} + +exit( 1 ); diff --git a/vendor/automattic/vipwpcs/WordPressVIPMinimum/ruleset.xml b/vendor/automattic/vipwpcs/WordPressVIPMinimum/ruleset.xml new file mode 100644 index 00000000..6a3f10c1 --- /dev/null +++ b/vendor/automattic/vipwpcs/WordPressVIPMinimum/ruleset.xml @@ -0,0 +1,191 @@ + + + WordPress VIP Minimum Coding Standards + + + + + + + + + + + + + *.twig + + + + + + + + + + + + + + + + + + warning + + + + + + + + + + + + + + + + + + + + + *.php + *.inc + *.js + *.css + + + + + + error + `eval()` is a security risk, please refrain from using it. + + + + + + + + + + + + + error + + + error + + + error + + + error + + + error + + + error + + + error + + + error + + + error + + + error + + + error + + + + + + + + + + error + + + error + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Using cURL functions is highly discouraged within VIP context. Please see: https://docs.wpvip.com/technical-references/code-quality-and-best-practices/retrieving-remote-data/. + + + Using cURL functions is highly discouraged within VIP context. Please see: https://docs.wpvip.com/technical-references/code-quality-and-best-practices/retrieving-remote-data/. + + + Using cURL functions is highly discouraged within VIP context. Please see: https://docs.wpvip.com/technical-references/code-quality-and-best-practices/retrieving-remote-data/. + + + + error + `%1$s()` performs a no-LIMIT query by default, make sure to set a reasonable `posts_per_page`. `%1$s()` will do a -1 query by default, a maximum of 100 should be used. + + + + + + + + + + + + + diff --git a/vendor/automattic/vipwpcs/composer.json b/vendor/automattic/vipwpcs/composer.json new file mode 100644 index 00000000..c65c23bb --- /dev/null +++ b/vendor/automattic/vipwpcs/composer.json @@ -0,0 +1,72 @@ +{ + "name": "automattic/vipwpcs", + "type": "phpcodesniffer-standard", + "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress VIP minimum coding conventions", + "keywords": [ + "phpcs", + "static analysis", + "standards", + "WordPress" + ], + "license": "MIT", + "authors": [ + { + "name": "Contributors", + "homepage": "https://github.com/Automattic/VIP-Coding-Standards/graphs/contributors" + } + ], + "require": { + "php": ">=5.4", + "phpcsstandards/phpcsextra": "^1.2.1", + "phpcsstandards/phpcsutils": "^1.0.11", + "sirbrillig/phpcs-variable-analysis": "^2.11.18", + "squizlabs/php_codesniffer": "^3.9.2", + "wp-coding-standards/wpcs": "^3.1.0" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "phpcompatibility/php-compatibility": "^9", + "phpcsstandards/phpcsdevtools": "^1.0", + "phpunit/phpunit": "^4 || ^5 || ^6 || ^7 || ^8 || ^9" + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + }, + "scripts": { + "test-ruleset": "bin/ruleset-tests", + "lint": [ + "bin/php-lint", + "bin/xml-lint" + ], + "cs": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs", + "test": "bin/unit-tests", + "test-coverage": "bin/unit-tests-coverage", + "feature-completeness": [ + "@php ./vendor/phpcsstandards/phpcsdevtools/bin/phpcs-check-feature-completeness -q ./WordPressVIPMinimum" + ], + "check": [ + "@lint", + "@test-ruleset", + "@test", + "@cs", + "@feature-completeness" + ] + }, + "scripts-descriptions": { + "lint": "VIPCS: Lint PHP and XML files in against parse errors.", + "cs": "VIPCS: Check the code style and code quality of the codebase via PHPCS.", + "test": "VIPCS: Run the unit tests for the VIPCS sniffs.", + "test-coverage": "VIPCS: Run the unit tests for the VIPCS sniffs with coverage enabled.", + "test-ruleset": "VIPCS: Run the ruleset tests for the VIPCS sniffs.", + "feature-completeness": "VIPCS: Check if all the VIPCS sniffs have tests.", + "check": "VIPCS: Run all checks (lint, CS, feature completeness) and tests." + }, + "support": { + "issues": "https://github.com/Automattic/VIP-Coding-Standards/issues", + "wiki": "https://github.com/Automattic/VIP-Coding-Standards/wiki", + "source": "https://github.com/Automattic/VIP-Coding-Standards" + } +} diff --git a/vendor/brick/math/CHANGELOG.md b/vendor/brick/math/CHANGELOG.md new file mode 100644 index 00000000..680fa9ba --- /dev/null +++ b/vendor/brick/math/CHANGELOG.md @@ -0,0 +1,463 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +## [0.12.1](https://github.com/brick/math/releases/tag/0.12.1) - 2023-11-29 + +⚡️ **Performance improvements** + +- `BigNumber::of()` is now faster, thanks to [@SebastienDug](https://github.com/SebastienDug) in [#77](https://github.com/brick/math/pull/77). + +## [0.12.0](https://github.com/brick/math/releases/tag/0.12.0) - 2023-11-26 + +💥 **Breaking changes** + +- Minimum PHP version is now 8.1 +- `RoundingMode` is now an `enum`; if you're type-hinting rounding modes, you need to type-hint against `RoundingMode` instead of `int` now +- `BigNumber` classes do not implement the `Serializable` interface anymore (they use the [new custom object serialization mechanism](https://wiki.php.net/rfc/custom_object_serialization)) +- The following breaking changes only affect you if you're creating your own `BigNumber` subclasses: + - the return type of `BigNumber::of()` is now `static` + - `BigNumber` has a new abstract method `from()` + - all `public` and `protected` functions of `BigNumber` are now `final` + +## [0.11.0](https://github.com/brick/math/releases/tag/0.11.0) - 2023-01-16 + +💥 **Breaking changes** + +- Minimum PHP version is now 8.0 +- Methods accepting a union of types are now strongly typed* +- `MathException` now extends `Exception` instead of `RuntimeException` + +* You may now run into type errors if you were passing `Stringable` objects to `of()` or any of the methods +internally calling `of()`, with `strict_types` enabled. You can fix this by casting `Stringable` objects to `string` +first. + +## [0.10.2](https://github.com/brick/math/releases/tag/0.10.2) - 2022-08-11 + +👌 **Improvements** + +- `BigRational::toFloat()` now simplifies the fraction before performing division (#73) thanks to @olsavmic + +## [0.10.1](https://github.com/brick/math/releases/tag/0.10.1) - 2022-08-02 + +✨ **New features** + +- `BigInteger::gcdMultiple()` returns the GCD of multiple `BigInteger` numbers + +## [0.10.0](https://github.com/brick/math/releases/tag/0.10.0) - 2022-06-18 + +💥 **Breaking changes** + +- Minimum PHP version is now 7.4 + +## [0.9.3](https://github.com/brick/math/releases/tag/0.9.3) - 2021-08-15 + +🚀 **Compatibility with PHP 8.1** + +- Support for custom object serialization; this removes a warning on PHP 8.1 due to the `Serializable` interface being deprecated (#60) thanks @TRowbotham + +## [0.9.2](https://github.com/brick/math/releases/tag/0.9.2) - 2021-01-20 + +🐛 **Bug fix** + +- Incorrect results could be returned when using the BCMath calculator, with a default scale set with `bcscale()`, on PHP >= 7.2 (#55). + +## [0.9.1](https://github.com/brick/math/releases/tag/0.9.1) - 2020-08-19 + +✨ **New features** + +- `BigInteger::not()` returns the bitwise `NOT` value + +🐛 **Bug fixes** + +- `BigInteger::toBytes()` could return an incorrect binary representation for some numbers +- The bitwise operations `and()`, `or()`, `xor()` on `BigInteger` could return an incorrect result when the GMP extension is not available + +## [0.9.0](https://github.com/brick/math/releases/tag/0.9.0) - 2020-08-18 + +👌 **Improvements** + +- `BigNumber::of()` now accepts `.123` and `123.` formats, both of which return a `BigDecimal` + +💥 **Breaking changes** + +- Deprecated method `BigInteger::powerMod()` has been removed - use `modPow()` instead +- Deprecated method `BigInteger::parse()` has been removed - use `fromBase()` instead + +## [0.8.17](https://github.com/brick/math/releases/tag/0.8.17) - 2020-08-19 + +🐛 **Bug fix** + +- `BigInteger::toBytes()` could return an incorrect binary representation for some numbers +- The bitwise operations `and()`, `or()`, `xor()` on `BigInteger` could return an incorrect result when the GMP extension is not available + +## [0.8.16](https://github.com/brick/math/releases/tag/0.8.16) - 2020-08-18 + +🚑 **Critical fix** + +- This version reintroduces the deprecated `BigInteger::parse()` method, that has been removed by mistake in version `0.8.9` and should have lasted for the whole `0.8` release cycle. + +✨ **New features** + +- `BigInteger::modInverse()` calculates a modular multiplicative inverse +- `BigInteger::fromBytes()` creates a `BigInteger` from a byte string +- `BigInteger::toBytes()` converts a `BigInteger` to a byte string +- `BigInteger::randomBits()` creates a pseudo-random `BigInteger` of a given bit length +- `BigInteger::randomRange()` creates a pseudo-random `BigInteger` between two bounds + +💩 **Deprecations** + +- `BigInteger::powerMod()` is now deprecated in favour of `modPow()` + +## [0.8.15](https://github.com/brick/math/releases/tag/0.8.15) - 2020-04-15 + +🐛 **Fixes** + +- added missing `ext-json` requirement, due to `BigNumber` implementing `JsonSerializable` + +⚡️ **Optimizations** + +- additional optimization in `BigInteger::remainder()` + +## [0.8.14](https://github.com/brick/math/releases/tag/0.8.14) - 2020-02-18 + +✨ **New features** + +- `BigInteger::getLowestSetBit()` returns the index of the rightmost one bit + +## [0.8.13](https://github.com/brick/math/releases/tag/0.8.13) - 2020-02-16 + +✨ **New features** + +- `BigInteger::isEven()` tests whether the number is even +- `BigInteger::isOdd()` tests whether the number is odd +- `BigInteger::testBit()` tests if a bit is set +- `BigInteger::getBitLength()` returns the number of bits in the minimal representation of the number + +## [0.8.12](https://github.com/brick/math/releases/tag/0.8.12) - 2020-02-03 + +🛠️ **Maintenance release** + +Classes are now annotated for better static analysis with [psalm](https://psalm.dev/). + +This is a maintenance release: no bug fixes, no new features, no breaking changes. + +## [0.8.11](https://github.com/brick/math/releases/tag/0.8.11) - 2020-01-23 + +✨ **New feature** + +`BigInteger::powerMod()` performs a power-with-modulo operation. Useful for crypto. + +## [0.8.10](https://github.com/brick/math/releases/tag/0.8.10) - 2020-01-21 + +✨ **New feature** + +`BigInteger::mod()` returns the **modulo** of two numbers. The *modulo* differs from the *remainder* when the signs of the operands are different. + +## [0.8.9](https://github.com/brick/math/releases/tag/0.8.9) - 2020-01-08 + +⚡️ **Performance improvements** + +A few additional optimizations in `BigInteger` and `BigDecimal` when one of the operands can be returned as is. Thanks to @tomtomsen in #24. + +## [0.8.8](https://github.com/brick/math/releases/tag/0.8.8) - 2019-04-25 + +🐛 **Bug fixes** + +- `BigInteger::toBase()` could return an empty string for zero values (BCMath & Native calculators only, GMP calculator unaffected) + +✨ **New features** + +- `BigInteger::toArbitraryBase()` converts a number to an arbitrary base, using a custom alphabet +- `BigInteger::fromArbitraryBase()` converts a string in an arbitrary base, using a custom alphabet, back to a number + +These methods can be used as the foundation to convert strings between different bases/alphabets, using BigInteger as an intermediate representation. + +💩 **Deprecations** + +- `BigInteger::parse()` is now deprecated in favour of `fromBase()` + +`BigInteger::fromBase()` works the same way as `parse()`, with 2 minor differences: + +- the `$base` parameter is required, it does not default to `10` +- it throws a `NumberFormatException` instead of an `InvalidArgumentException` when the number is malformed + +## [0.8.7](https://github.com/brick/math/releases/tag/0.8.7) - 2019-04-20 + +**Improvements** + +- Safer conversion from `float` when using custom locales +- **Much faster** `NativeCalculator` implementation 🚀 + +You can expect **at least a 3x performance improvement** for common arithmetic operations when using the library on systems without GMP or BCMath; it gets exponentially faster on multiplications with a high number of digits. This is due to calculations now being performed on whole blocks of digits (the block size depending on the platform, 32-bit or 64-bit) instead of digit-by-digit as before. + +## [0.8.6](https://github.com/brick/math/releases/tag/0.8.6) - 2019-04-11 + +**New method** + +`BigNumber::sum()` returns the sum of one or more numbers. + +## [0.8.5](https://github.com/brick/math/releases/tag/0.8.5) - 2019-02-12 + +**Bug fix**: `of()` factory methods could fail when passing a `float` in environments using a `LC_NUMERIC` locale with a decimal separator other than `'.'` (#20). + +Thanks @manowark 👍 + +## [0.8.4](https://github.com/brick/math/releases/tag/0.8.4) - 2018-12-07 + +**New method** + +`BigDecimal::sqrt()` calculates the square root of a decimal number, to a given scale. + +## [0.8.3](https://github.com/brick/math/releases/tag/0.8.3) - 2018-12-06 + +**New method** + +`BigInteger::sqrt()` calculates the square root of a number (thanks @peter279k). + +**New exception** + +`NegativeNumberException` is thrown when calling `sqrt()` on a negative number. + +## [0.8.2](https://github.com/brick/math/releases/tag/0.8.2) - 2018-11-08 + +**Performance update** + +- Further improvement of `toInt()` performance +- `NativeCalculator` can now perform some multiplications more efficiently + +## [0.8.1](https://github.com/brick/math/releases/tag/0.8.1) - 2018-11-07 + +Performance optimization of `toInt()` methods. + +## [0.8.0](https://github.com/brick/math/releases/tag/0.8.0) - 2018-10-13 + +**Breaking changes** + +The following deprecated methods have been removed. Use the new method name instead: + +| Method removed | Replacement method | +| --- | --- | +| `BigDecimal::getIntegral()` | `BigDecimal::getIntegralPart()` | +| `BigDecimal::getFraction()` | `BigDecimal::getFractionalPart()` | + +--- + +**New features** + +`BigInteger` has been augmented with 5 new methods for bitwise operations: + +| New method | Description | +| --- | --- | +| `and()` | performs a bitwise `AND` operation on two numbers | +| `or()` | performs a bitwise `OR` operation on two numbers | +| `xor()` | performs a bitwise `XOR` operation on two numbers | +| `shiftedLeft()` | returns the number shifted left by a number of bits | +| `shiftedRight()` | returns the number shifted right by a number of bits | + +Thanks to @DASPRiD 👍 + +## [0.7.3](https://github.com/brick/math/releases/tag/0.7.3) - 2018-08-20 + +**New method:** `BigDecimal::hasNonZeroFractionalPart()` + +**Renamed/deprecated methods:** + +- `BigDecimal::getIntegral()` has been renamed to `getIntegralPart()` and is now deprecated +- `BigDecimal::getFraction()` has been renamed to `getFractionalPart()` and is now deprecated + +## [0.7.2](https://github.com/brick/math/releases/tag/0.7.2) - 2018-07-21 + +**Performance update** + +`BigInteger::parse()` and `toBase()` now use GMP's built-in base conversion features when available. + +## [0.7.1](https://github.com/brick/math/releases/tag/0.7.1) - 2018-03-01 + +This is a maintenance release, no code has been changed. + +- When installed with `--no-dev`, the autoloader does not autoload tests anymore +- Tests and other files unnecessary for production are excluded from the dist package + +This will help make installations more compact. + +## [0.7.0](https://github.com/brick/math/releases/tag/0.7.0) - 2017-10-02 + +Methods renamed: + +- `BigNumber:sign()` has been renamed to `getSign()` +- `BigDecimal::unscaledValue()` has been renamed to `getUnscaledValue()` +- `BigDecimal::scale()` has been renamed to `getScale()` +- `BigDecimal::integral()` has been renamed to `getIntegral()` +- `BigDecimal::fraction()` has been renamed to `getFraction()` +- `BigRational::numerator()` has been renamed to `getNumerator()` +- `BigRational::denominator()` has been renamed to `getDenominator()` + +Classes renamed: + +- `ArithmeticException` has been renamed to `MathException` + +## [0.6.2](https://github.com/brick/math/releases/tag/0.6.2) - 2017-10-02 + +The base class for all exceptions is now `MathException`. +`ArithmeticException` has been deprecated, and will be removed in 0.7.0. + +## [0.6.1](https://github.com/brick/math/releases/tag/0.6.1) - 2017-10-02 + +A number of methods have been renamed: + +- `BigNumber:sign()` is deprecated; use `getSign()` instead +- `BigDecimal::unscaledValue()` is deprecated; use `getUnscaledValue()` instead +- `BigDecimal::scale()` is deprecated; use `getScale()` instead +- `BigDecimal::integral()` is deprecated; use `getIntegral()` instead +- `BigDecimal::fraction()` is deprecated; use `getFraction()` instead +- `BigRational::numerator()` is deprecated; use `getNumerator()` instead +- `BigRational::denominator()` is deprecated; use `getDenominator()` instead + +The old methods will be removed in version 0.7.0. + +## [0.6.0](https://github.com/brick/math/releases/tag/0.6.0) - 2017-08-25 + +- Minimum PHP version is now [7.1](https://gophp71.org/); for PHP 5.6 and PHP 7.0 support, use version `0.5` +- Deprecated method `BigDecimal::withScale()` has been removed; use `toScale()` instead +- Method `BigNumber::toInteger()` has been renamed to `toInt()` + +## [0.5.4](https://github.com/brick/math/releases/tag/0.5.4) - 2016-10-17 + +`BigNumber` classes now implement [JsonSerializable](http://php.net/manual/en/class.jsonserializable.php). +The JSON output is always a string. + +## [0.5.3](https://github.com/brick/math/releases/tag/0.5.3) - 2016-03-31 + +This is a bugfix release. Dividing by a negative power of 1 with the same scale as the dividend could trigger an incorrect optimization which resulted in a wrong result. See #6. + +## [0.5.2](https://github.com/brick/math/releases/tag/0.5.2) - 2015-08-06 + +The `$scale` parameter of `BigDecimal::dividedBy()` is now optional again. + +## [0.5.1](https://github.com/brick/math/releases/tag/0.5.1) - 2015-07-05 + +**New method: `BigNumber::toScale()`** + +This allows to convert any `BigNumber` to a `BigDecimal` with a given scale, using rounding if necessary. + +## [0.5.0](https://github.com/brick/math/releases/tag/0.5.0) - 2015-07-04 + +**New features** +- Common `BigNumber` interface for all classes, with the following methods: + - `sign()` and derived methods (`isZero()`, `isPositive()`, ...) + - `compareTo()` and derived methods (`isEqualTo()`, `isGreaterThan()`, ...) that work across different `BigNumber` types + - `toBigInteger()`, `toBigDecimal()`, `toBigRational`() conversion methods + - `toInteger()` and `toFloat()` conversion methods to native types +- Unified `of()` behaviour: every class now accepts any type of number, provided that it can be safely converted to the current type +- New method: `BigDecimal::exactlyDividedBy()`; this method automatically computes the scale of the result, provided that the division yields a finite number of digits +- New methods: `BigRational::quotient()` and `remainder()` +- Fine-grained exceptions: `DivisionByZeroException`, `RoundingNecessaryException`, `NumberFormatException` +- Factory methods `zero()`, `one()` and `ten()` available in all classes +- Rounding mode reintroduced in `BigInteger::dividedBy()` + +This release also comes with many performance improvements. + +--- + +**Breaking changes** +- `BigInteger`: + - `getSign()` is renamed to `sign()` + - `toString()` is renamed to `toBase()` + - `BigInteger::dividedBy()` now throws an exception by default if the remainder is not zero; use `quotient()` to get the previous behaviour +- `BigDecimal`: + - `getSign()` is renamed to `sign()` + - `getUnscaledValue()` is renamed to `unscaledValue()` + - `getScale()` is renamed to `scale()` + - `getIntegral()` is renamed to `integral()` + - `getFraction()` is renamed to `fraction()` + - `divideAndRemainder()` is renamed to `quotientAndRemainder()` + - `dividedBy()` now takes a **mandatory** `$scale` parameter **before** the rounding mode + - `toBigInteger()` does not accept a `$roundingMode` parameter anymore + - `toBigRational()` does not simplify the fraction anymore; explicitly add `->simplified()` to get the previous behaviour +- `BigRational`: + - `getSign()` is renamed to `sign()` + - `getNumerator()` is renamed to `numerator()` + - `getDenominator()` is renamed to `denominator()` + - `of()` is renamed to `nd()`, while `parse()` is renamed to `of()` +- Miscellaneous: + - `ArithmeticException` is moved to an `Exception\` sub-namespace + - `of()` factory methods now throw `NumberFormatException` instead of `InvalidArgumentException` + +## [0.4.3](https://github.com/brick/math/releases/tag/0.4.3) - 2016-03-31 + +Backport of two bug fixes from the 0.5 branch: +- `BigInteger::parse()` did not always throw `InvalidArgumentException` as expected +- Dividing by a negative power of 1 with the same scale as the dividend could trigger an incorrect optimization which resulted in a wrong result. See #6. + +## [0.4.2](https://github.com/brick/math/releases/tag/0.4.2) - 2015-06-16 + +New method: `BigDecimal::stripTrailingZeros()` + +## [0.4.1](https://github.com/brick/math/releases/tag/0.4.1) - 2015-06-12 + +Introducing a `BigRational` class, to perform calculations on fractions of any size. + +## [0.4.0](https://github.com/brick/math/releases/tag/0.4.0) - 2015-06-12 + +Rounding modes have been removed from `BigInteger`, and are now a concept specific to `BigDecimal`. + +`BigInteger::dividedBy()` now always returns the quotient of the division. + +## [0.3.5](https://github.com/brick/math/releases/tag/0.3.5) - 2016-03-31 + +Backport of two bug fixes from the 0.5 branch: + +- `BigInteger::parse()` did not always throw `InvalidArgumentException` as expected +- Dividing by a negative power of 1 with the same scale as the dividend could trigger an incorrect optimization which resulted in a wrong result. See #6. + +## [0.3.4](https://github.com/brick/math/releases/tag/0.3.4) - 2015-06-11 + +New methods: +- `BigInteger::remainder()` returns the remainder of a division only +- `BigInteger::gcd()` returns the greatest common divisor of two numbers + +## [0.3.3](https://github.com/brick/math/releases/tag/0.3.3) - 2015-06-07 + +Fix `toString()` not handling negative numbers. + +## [0.3.2](https://github.com/brick/math/releases/tag/0.3.2) - 2015-06-07 + +`BigInteger` and `BigDecimal` now have a `getSign()` method that returns: +- `-1` if the number is negative +- `0` if the number is zero +- `1` if the number is positive + +## [0.3.1](https://github.com/brick/math/releases/tag/0.3.1) - 2015-06-05 + +Minor performance improvements + +## [0.3.0](https://github.com/brick/math/releases/tag/0.3.0) - 2015-06-04 + +The `$roundingMode` and `$scale` parameters have been swapped in `BigDecimal::dividedBy()`. + +## [0.2.2](https://github.com/brick/math/releases/tag/0.2.2) - 2015-06-04 + +Stronger immutability guarantee for `BigInteger` and `BigDecimal`. + +So far, it would have been possible to break immutability of these classes by calling the `unserialize()` internal function. This release fixes that. + +## [0.2.1](https://github.com/brick/math/releases/tag/0.2.1) - 2015-06-02 + +Added `BigDecimal::divideAndRemainder()` + +## [0.2.0](https://github.com/brick/math/releases/tag/0.2.0) - 2015-05-22 + +- `min()` and `max()` do not accept an `array` anymore, but a variable number of parameters +- **minimum PHP version is now 5.6** +- continuous integration with PHP 7 + +## [0.1.1](https://github.com/brick/math/releases/tag/0.1.1) - 2014-09-01 + +- Added `BigInteger::power()` +- Added HHVM support + +## [0.1.0](https://github.com/brick/math/releases/tag/0.1.0) - 2014-08-31 + +First beta release. + diff --git a/vendor/brick/math/LICENSE b/vendor/brick/math/LICENSE new file mode 100644 index 00000000..f9b724f0 --- /dev/null +++ b/vendor/brick/math/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2013-present Benjamin Morel + +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/vendor/brick/math/composer.json b/vendor/brick/math/composer.json new file mode 100644 index 00000000..bd67343a --- /dev/null +++ b/vendor/brick/math/composer.json @@ -0,0 +1,39 @@ +{ + "name": "brick/math", + "description": "Arbitrary-precision arithmetic library", + "type": "library", + "keywords": [ + "Brick", + "Math", + "Mathematics", + "Arbitrary-precision", + "Arithmetic", + "BigInteger", + "BigDecimal", + "BigRational", + "BigNumber", + "Bignum", + "Decimal", + "Rational", + "Integer" + ], + "license": "MIT", + "require": { + "php": "^8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.1", + "php-coveralls/php-coveralls": "^2.2", + "vimeo/psalm": "5.16.0" + }, + "autoload": { + "psr-4": { + "Brick\\Math\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Brick\\Math\\Tests\\": "tests/" + } + } +} diff --git a/vendor/brick/math/src/BigDecimal.php b/vendor/brick/math/src/BigDecimal.php new file mode 100644 index 00000000..31d22ab3 --- /dev/null +++ b/vendor/brick/math/src/BigDecimal.php @@ -0,0 +1,754 @@ +value = $value; + $this->scale = $scale; + } + + /** + * @psalm-pure + */ + protected static function from(BigNumber $number): static + { + return $number->toBigDecimal(); + } + + /** + * Creates a BigDecimal from an unscaled value and a scale. + * + * Example: `(12345, 3)` will result in the BigDecimal `12.345`. + * + * @param BigNumber|int|float|string $value The unscaled value. Must be convertible to a BigInteger. + * @param int $scale The scale of the number, positive or zero. + * + * @throws \InvalidArgumentException If the scale is negative. + * + * @psalm-pure + */ + public static function ofUnscaledValue(BigNumber|int|float|string $value, int $scale = 0) : BigDecimal + { + if ($scale < 0) { + throw new \InvalidArgumentException('The scale cannot be negative.'); + } + + return new BigDecimal((string) BigInteger::of($value), $scale); + } + + /** + * Returns a BigDecimal representing zero, with a scale of zero. + * + * @psalm-pure + */ + public static function zero() : BigDecimal + { + /** + * @psalm-suppress ImpureStaticVariable + * @var BigDecimal|null $zero + */ + static $zero; + + if ($zero === null) { + $zero = new BigDecimal('0'); + } + + return $zero; + } + + /** + * Returns a BigDecimal representing one, with a scale of zero. + * + * @psalm-pure + */ + public static function one() : BigDecimal + { + /** + * @psalm-suppress ImpureStaticVariable + * @var BigDecimal|null $one + */ + static $one; + + if ($one === null) { + $one = new BigDecimal('1'); + } + + return $one; + } + + /** + * Returns a BigDecimal representing ten, with a scale of zero. + * + * @psalm-pure + */ + public static function ten() : BigDecimal + { + /** + * @psalm-suppress ImpureStaticVariable + * @var BigDecimal|null $ten + */ + static $ten; + + if ($ten === null) { + $ten = new BigDecimal('10'); + } + + return $ten; + } + + /** + * Returns the sum of this number and the given one. + * + * The result has a scale of `max($this->scale, $that->scale)`. + * + * @param BigNumber|int|float|string $that The number to add. Must be convertible to a BigDecimal. + * + * @throws MathException If the number is not valid, or is not convertible to a BigDecimal. + */ + public function plus(BigNumber|int|float|string $that) : BigDecimal + { + $that = BigDecimal::of($that); + + if ($that->value === '0' && $that->scale <= $this->scale) { + return $this; + } + + if ($this->value === '0' && $this->scale <= $that->scale) { + return $that; + } + + [$a, $b] = $this->scaleValues($this, $that); + + $value = Calculator::get()->add($a, $b); + $scale = $this->scale > $that->scale ? $this->scale : $that->scale; + + return new BigDecimal($value, $scale); + } + + /** + * Returns the difference of this number and the given one. + * + * The result has a scale of `max($this->scale, $that->scale)`. + * + * @param BigNumber|int|float|string $that The number to subtract. Must be convertible to a BigDecimal. + * + * @throws MathException If the number is not valid, or is not convertible to a BigDecimal. + */ + public function minus(BigNumber|int|float|string $that) : BigDecimal + { + $that = BigDecimal::of($that); + + if ($that->value === '0' && $that->scale <= $this->scale) { + return $this; + } + + [$a, $b] = $this->scaleValues($this, $that); + + $value = Calculator::get()->sub($a, $b); + $scale = $this->scale > $that->scale ? $this->scale : $that->scale; + + return new BigDecimal($value, $scale); + } + + /** + * Returns the product of this number and the given one. + * + * The result has a scale of `$this->scale + $that->scale`. + * + * @param BigNumber|int|float|string $that The multiplier. Must be convertible to a BigDecimal. + * + * @throws MathException If the multiplier is not a valid number, or is not convertible to a BigDecimal. + */ + public function multipliedBy(BigNumber|int|float|string $that) : BigDecimal + { + $that = BigDecimal::of($that); + + if ($that->value === '1' && $that->scale === 0) { + return $this; + } + + if ($this->value === '1' && $this->scale === 0) { + return $that; + } + + $value = Calculator::get()->mul($this->value, $that->value); + $scale = $this->scale + $that->scale; + + return new BigDecimal($value, $scale); + } + + /** + * Returns the result of the division of this number by the given one, at the given scale. + * + * @param BigNumber|int|float|string $that The divisor. + * @param int|null $scale The desired scale, or null to use the scale of this number. + * @param RoundingMode $roundingMode An optional rounding mode, defaults to UNNECESSARY. + * + * @throws \InvalidArgumentException If the scale or rounding mode is invalid. + * @throws MathException If the number is invalid, is zero, or rounding was necessary. + */ + public function dividedBy(BigNumber|int|float|string $that, ?int $scale = null, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal + { + $that = BigDecimal::of($that); + + if ($that->isZero()) { + throw DivisionByZeroException::divisionByZero(); + } + + if ($scale === null) { + $scale = $this->scale; + } elseif ($scale < 0) { + throw new \InvalidArgumentException('Scale cannot be negative.'); + } + + if ($that->value === '1' && $that->scale === 0 && $scale === $this->scale) { + return $this; + } + + $p = $this->valueWithMinScale($that->scale + $scale); + $q = $that->valueWithMinScale($this->scale - $scale); + + $result = Calculator::get()->divRound($p, $q, $roundingMode); + + return new BigDecimal($result, $scale); + } + + /** + * Returns the exact result of the division of this number by the given one. + * + * The scale of the result is automatically calculated to fit all the fraction digits. + * + * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigDecimal. + * + * @throws MathException If the divisor is not a valid number, is not convertible to a BigDecimal, is zero, + * or the result yields an infinite number of digits. + */ + public function exactlyDividedBy(BigNumber|int|float|string $that) : BigDecimal + { + $that = BigDecimal::of($that); + + if ($that->value === '0') { + throw DivisionByZeroException::divisionByZero(); + } + + [, $b] = $this->scaleValues($this, $that); + + $d = \rtrim($b, '0'); + $scale = \strlen($b) - \strlen($d); + + $calculator = Calculator::get(); + + foreach ([5, 2] as $prime) { + for (;;) { + $lastDigit = (int) $d[-1]; + + if ($lastDigit % $prime !== 0) { + break; + } + + $d = $calculator->divQ($d, (string) $prime); + $scale++; + } + } + + return $this->dividedBy($that, $scale)->stripTrailingZeros(); + } + + /** + * Returns this number exponentiated to the given value. + * + * The result has a scale of `$this->scale * $exponent`. + * + * @throws \InvalidArgumentException If the exponent is not in the range 0 to 1,000,000. + */ + public function power(int $exponent) : BigDecimal + { + if ($exponent === 0) { + return BigDecimal::one(); + } + + if ($exponent === 1) { + return $this; + } + + if ($exponent < 0 || $exponent > Calculator::MAX_POWER) { + throw new \InvalidArgumentException(\sprintf( + 'The exponent %d is not in the range 0 to %d.', + $exponent, + Calculator::MAX_POWER + )); + } + + return new BigDecimal(Calculator::get()->pow($this->value, $exponent), $this->scale * $exponent); + } + + /** + * Returns the quotient of the division of this number by the given one. + * + * The quotient has a scale of `0`. + * + * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigDecimal. + * + * @throws MathException If the divisor is not a valid decimal number, or is zero. + */ + public function quotient(BigNumber|int|float|string $that) : BigDecimal + { + $that = BigDecimal::of($that); + + if ($that->isZero()) { + throw DivisionByZeroException::divisionByZero(); + } + + $p = $this->valueWithMinScale($that->scale); + $q = $that->valueWithMinScale($this->scale); + + $quotient = Calculator::get()->divQ($p, $q); + + return new BigDecimal($quotient, 0); + } + + /** + * Returns the remainder of the division of this number by the given one. + * + * The remainder has a scale of `max($this->scale, $that->scale)`. + * + * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigDecimal. + * + * @throws MathException If the divisor is not a valid decimal number, or is zero. + */ + public function remainder(BigNumber|int|float|string $that) : BigDecimal + { + $that = BigDecimal::of($that); + + if ($that->isZero()) { + throw DivisionByZeroException::divisionByZero(); + } + + $p = $this->valueWithMinScale($that->scale); + $q = $that->valueWithMinScale($this->scale); + + $remainder = Calculator::get()->divR($p, $q); + + $scale = $this->scale > $that->scale ? $this->scale : $that->scale; + + return new BigDecimal($remainder, $scale); + } + + /** + * Returns the quotient and remainder of the division of this number by the given one. + * + * The quotient has a scale of `0`, and the remainder has a scale of `max($this->scale, $that->scale)`. + * + * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigDecimal. + * + * @return BigDecimal[] An array containing the quotient and the remainder. + * + * @psalm-return array{BigDecimal, BigDecimal} + * + * @throws MathException If the divisor is not a valid decimal number, or is zero. + */ + public function quotientAndRemainder(BigNumber|int|float|string $that) : array + { + $that = BigDecimal::of($that); + + if ($that->isZero()) { + throw DivisionByZeroException::divisionByZero(); + } + + $p = $this->valueWithMinScale($that->scale); + $q = $that->valueWithMinScale($this->scale); + + [$quotient, $remainder] = Calculator::get()->divQR($p, $q); + + $scale = $this->scale > $that->scale ? $this->scale : $that->scale; + + $quotient = new BigDecimal($quotient, 0); + $remainder = new BigDecimal($remainder, $scale); + + return [$quotient, $remainder]; + } + + /** + * Returns the square root of this number, rounded down to the given number of decimals. + * + * @throws \InvalidArgumentException If the scale is negative. + * @throws NegativeNumberException If this number is negative. + */ + public function sqrt(int $scale) : BigDecimal + { + if ($scale < 0) { + throw new \InvalidArgumentException('Scale cannot be negative.'); + } + + if ($this->value === '0') { + return new BigDecimal('0', $scale); + } + + if ($this->value[0] === '-') { + throw new NegativeNumberException('Cannot calculate the square root of a negative number.'); + } + + $value = $this->value; + $addDigits = 2 * $scale - $this->scale; + + if ($addDigits > 0) { + // add zeros + $value .= \str_repeat('0', $addDigits); + } elseif ($addDigits < 0) { + // trim digits + if (-$addDigits >= \strlen($this->value)) { + // requesting a scale too low, will always yield a zero result + return new BigDecimal('0', $scale); + } + + $value = \substr($value, 0, $addDigits); + } + + $value = Calculator::get()->sqrt($value); + + return new BigDecimal($value, $scale); + } + + /** + * Returns a copy of this BigDecimal with the decimal point moved $n places to the left. + */ + public function withPointMovedLeft(int $n) : BigDecimal + { + if ($n === 0) { + return $this; + } + + if ($n < 0) { + return $this->withPointMovedRight(-$n); + } + + return new BigDecimal($this->value, $this->scale + $n); + } + + /** + * Returns a copy of this BigDecimal with the decimal point moved $n places to the right. + */ + public function withPointMovedRight(int $n) : BigDecimal + { + if ($n === 0) { + return $this; + } + + if ($n < 0) { + return $this->withPointMovedLeft(-$n); + } + + $value = $this->value; + $scale = $this->scale - $n; + + if ($scale < 0) { + if ($value !== '0') { + $value .= \str_repeat('0', -$scale); + } + $scale = 0; + } + + return new BigDecimal($value, $scale); + } + + /** + * Returns a copy of this BigDecimal with any trailing zeros removed from the fractional part. + */ + public function stripTrailingZeros() : BigDecimal + { + if ($this->scale === 0) { + return $this; + } + + $trimmedValue = \rtrim($this->value, '0'); + + if ($trimmedValue === '') { + return BigDecimal::zero(); + } + + $trimmableZeros = \strlen($this->value) - \strlen($trimmedValue); + + if ($trimmableZeros === 0) { + return $this; + } + + if ($trimmableZeros > $this->scale) { + $trimmableZeros = $this->scale; + } + + $value = \substr($this->value, 0, -$trimmableZeros); + $scale = $this->scale - $trimmableZeros; + + return new BigDecimal($value, $scale); + } + + /** + * Returns the absolute value of this number. + */ + public function abs() : BigDecimal + { + return $this->isNegative() ? $this->negated() : $this; + } + + /** + * Returns the negated value of this number. + */ + public function negated() : BigDecimal + { + return new BigDecimal(Calculator::get()->neg($this->value), $this->scale); + } + + public function compareTo(BigNumber|int|float|string $that) : int + { + $that = BigNumber::of($that); + + if ($that instanceof BigInteger) { + $that = $that->toBigDecimal(); + } + + if ($that instanceof BigDecimal) { + [$a, $b] = $this->scaleValues($this, $that); + + return Calculator::get()->cmp($a, $b); + } + + return - $that->compareTo($this); + } + + public function getSign() : int + { + return ($this->value === '0') ? 0 : (($this->value[0] === '-') ? -1 : 1); + } + + public function getUnscaledValue() : BigInteger + { + return self::newBigInteger($this->value); + } + + public function getScale() : int + { + return $this->scale; + } + + /** + * Returns a string representing the integral part of this decimal number. + * + * Example: `-123.456` => `-123`. + */ + public function getIntegralPart() : string + { + if ($this->scale === 0) { + return $this->value; + } + + $value = $this->getUnscaledValueWithLeadingZeros(); + + return \substr($value, 0, -$this->scale); + } + + /** + * Returns a string representing the fractional part of this decimal number. + * + * If the scale is zero, an empty string is returned. + * + * Examples: `-123.456` => '456', `123` => ''. + */ + public function getFractionalPart() : string + { + if ($this->scale === 0) { + return ''; + } + + $value = $this->getUnscaledValueWithLeadingZeros(); + + return \substr($value, -$this->scale); + } + + /** + * Returns whether this decimal number has a non-zero fractional part. + */ + public function hasNonZeroFractionalPart() : bool + { + return $this->getFractionalPart() !== \str_repeat('0', $this->scale); + } + + public function toBigInteger() : BigInteger + { + $zeroScaleDecimal = $this->scale === 0 ? $this : $this->dividedBy(1, 0); + + return self::newBigInteger($zeroScaleDecimal->value); + } + + public function toBigDecimal() : BigDecimal + { + return $this; + } + + public function toBigRational() : BigRational + { + $numerator = self::newBigInteger($this->value); + $denominator = self::newBigInteger('1' . \str_repeat('0', $this->scale)); + + return self::newBigRational($numerator, $denominator, false); + } + + public function toScale(int $scale, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal + { + if ($scale === $this->scale) { + return $this; + } + + return $this->dividedBy(BigDecimal::one(), $scale, $roundingMode); + } + + public function toInt() : int + { + return $this->toBigInteger()->toInt(); + } + + public function toFloat() : float + { + return (float) (string) $this; + } + + public function __toString() : string + { + if ($this->scale === 0) { + return $this->value; + } + + $value = $this->getUnscaledValueWithLeadingZeros(); + + return \substr($value, 0, -$this->scale) . '.' . \substr($value, -$this->scale); + } + + /** + * This method is required for serializing the object and SHOULD NOT be accessed directly. + * + * @internal + * + * @return array{value: string, scale: int} + */ + public function __serialize(): array + { + return ['value' => $this->value, 'scale' => $this->scale]; + } + + /** + * This method is only here to allow unserializing the object and cannot be accessed directly. + * + * @internal + * @psalm-suppress RedundantPropertyInitializationCheck + * + * @param array{value: string, scale: int} $data + * + * @throws \LogicException + */ + public function __unserialize(array $data): void + { + if (isset($this->value)) { + throw new \LogicException('__unserialize() is an internal function, it must not be called directly.'); + } + + $this->value = $data['value']; + $this->scale = $data['scale']; + } + + /** + * Puts the internal values of the given decimal numbers on the same scale. + * + * @return array{string, string} The scaled integer values of $x and $y. + */ + private function scaleValues(BigDecimal $x, BigDecimal $y) : array + { + $a = $x->value; + $b = $y->value; + + if ($b !== '0' && $x->scale > $y->scale) { + $b .= \str_repeat('0', $x->scale - $y->scale); + } elseif ($a !== '0' && $x->scale < $y->scale) { + $a .= \str_repeat('0', $y->scale - $x->scale); + } + + return [$a, $b]; + } + + private function valueWithMinScale(int $scale) : string + { + $value = $this->value; + + if ($this->value !== '0' && $scale > $this->scale) { + $value .= \str_repeat('0', $scale - $this->scale); + } + + return $value; + } + + /** + * Adds leading zeros if necessary to the unscaled value to represent the full decimal number. + */ + private function getUnscaledValueWithLeadingZeros() : string + { + $value = $this->value; + $targetLength = $this->scale + 1; + $negative = ($value[0] === '-'); + $length = \strlen($value); + + if ($negative) { + $length--; + } + + if ($length >= $targetLength) { + return $this->value; + } + + if ($negative) { + $value = \substr($value, 1); + } + + $value = \str_pad($value, $targetLength, '0', STR_PAD_LEFT); + + if ($negative) { + $value = '-' . $value; + } + + return $value; + } +} diff --git a/vendor/brick/math/src/BigInteger.php b/vendor/brick/math/src/BigInteger.php new file mode 100644 index 00000000..73dcc89a --- /dev/null +++ b/vendor/brick/math/src/BigInteger.php @@ -0,0 +1,1051 @@ +value = $value; + } + + /** + * @psalm-pure + */ + protected static function from(BigNumber $number): static + { + return $number->toBigInteger(); + } + + /** + * Creates a number from a string in a given base. + * + * The string can optionally be prefixed with the `+` or `-` sign. + * + * Bases greater than 36 are not supported by this method, as there is no clear consensus on which of the lowercase + * or uppercase characters should come first. Instead, this method accepts any base up to 36, and does not + * differentiate lowercase and uppercase characters, which are considered equal. + * + * For bases greater than 36, and/or custom alphabets, use the fromArbitraryBase() method. + * + * @param string $number The number to convert, in the given base. + * @param int $base The base of the number, between 2 and 36. + * + * @throws NumberFormatException If the number is empty, or contains invalid chars for the given base. + * @throws \InvalidArgumentException If the base is out of range. + * + * @psalm-pure + */ + public static function fromBase(string $number, int $base) : BigInteger + { + if ($number === '') { + throw new NumberFormatException('The number cannot be empty.'); + } + + if ($base < 2 || $base > 36) { + throw new \InvalidArgumentException(\sprintf('Base %d is not in range 2 to 36.', $base)); + } + + if ($number[0] === '-') { + $sign = '-'; + $number = \substr($number, 1); + } elseif ($number[0] === '+') { + $sign = ''; + $number = \substr($number, 1); + } else { + $sign = ''; + } + + if ($number === '') { + throw new NumberFormatException('The number cannot be empty.'); + } + + $number = \ltrim($number, '0'); + + if ($number === '') { + // The result will be the same in any base, avoid further calculation. + return BigInteger::zero(); + } + + if ($number === '1') { + // The result will be the same in any base, avoid further calculation. + return new BigInteger($sign . '1'); + } + + $pattern = '/[^' . \substr(Calculator::ALPHABET, 0, $base) . ']/'; + + if (\preg_match($pattern, \strtolower($number), $matches) === 1) { + throw new NumberFormatException(\sprintf('"%s" is not a valid character in base %d.', $matches[0], $base)); + } + + if ($base === 10) { + // The number is usable as is, avoid further calculation. + return new BigInteger($sign . $number); + } + + $result = Calculator::get()->fromBase($number, $base); + + return new BigInteger($sign . $result); + } + + /** + * Parses a string containing an integer in an arbitrary base, using a custom alphabet. + * + * Because this method accepts an alphabet with any character, including dash, it does not handle negative numbers. + * + * @param string $number The number to parse. + * @param string $alphabet The alphabet, for example '01' for base 2, or '01234567' for base 8. + * + * @throws NumberFormatException If the given number is empty or contains invalid chars for the given alphabet. + * @throws \InvalidArgumentException If the alphabet does not contain at least 2 chars. + * + * @psalm-pure + */ + public static function fromArbitraryBase(string $number, string $alphabet) : BigInteger + { + if ($number === '') { + throw new NumberFormatException('The number cannot be empty.'); + } + + $base = \strlen($alphabet); + + if ($base < 2) { + throw new \InvalidArgumentException('The alphabet must contain at least 2 chars.'); + } + + $pattern = '/[^' . \preg_quote($alphabet, '/') . ']/'; + + if (\preg_match($pattern, $number, $matches) === 1) { + throw NumberFormatException::charNotInAlphabet($matches[0]); + } + + $number = Calculator::get()->fromArbitraryBase($number, $alphabet, $base); + + return new BigInteger($number); + } + + /** + * Translates a string of bytes containing the binary representation of a BigInteger into a BigInteger. + * + * The input string is assumed to be in big-endian byte-order: the most significant byte is in the zeroth element. + * + * If `$signed` is true, the input is assumed to be in two's-complement representation, and the leading bit is + * interpreted as a sign bit. If `$signed` is false, the input is interpreted as an unsigned number, and the + * resulting BigInteger will always be positive or zero. + * + * This method can be used to retrieve a number exported by `toBytes()`, as long as the `$signed` flags match. + * + * @param string $value The byte string. + * @param bool $signed Whether to interpret as a signed number in two's-complement representation with a leading + * sign bit. + * + * @throws NumberFormatException If the string is empty. + */ + public static function fromBytes(string $value, bool $signed = true) : BigInteger + { + if ($value === '') { + throw new NumberFormatException('The byte string must not be empty.'); + } + + $twosComplement = false; + + if ($signed) { + $x = \ord($value[0]); + + if (($twosComplement = ($x >= 0x80))) { + $value = ~$value; + } + } + + $number = self::fromBase(\bin2hex($value), 16); + + if ($twosComplement) { + return $number->plus(1)->negated(); + } + + return $number; + } + + /** + * Generates a pseudo-random number in the range 0 to 2^numBits - 1. + * + * Using the default random bytes generator, this method is suitable for cryptographic use. + * + * @psalm-param (callable(int): string)|null $randomBytesGenerator + * + * @param int $numBits The number of bits. + * @param callable|null $randomBytesGenerator A function that accepts a number of bytes as an integer, and returns a + * string of random bytes of the given length. Defaults to the + * `random_bytes()` function. + * + * @throws \InvalidArgumentException If $numBits is negative. + */ + public static function randomBits(int $numBits, ?callable $randomBytesGenerator = null) : BigInteger + { + if ($numBits < 0) { + throw new \InvalidArgumentException('The number of bits cannot be negative.'); + } + + if ($numBits === 0) { + return BigInteger::zero(); + } + + if ($randomBytesGenerator === null) { + $randomBytesGenerator = random_bytes(...); + } + + /** @var int<1, max> $byteLength */ + $byteLength = \intdiv($numBits - 1, 8) + 1; + + $extraBits = ($byteLength * 8 - $numBits); + $bitmask = \chr(0xFF >> $extraBits); + + $randomBytes = $randomBytesGenerator($byteLength); + $randomBytes[0] = $randomBytes[0] & $bitmask; + + return self::fromBytes($randomBytes, false); + } + + /** + * Generates a pseudo-random number between `$min` and `$max`. + * + * Using the default random bytes generator, this method is suitable for cryptographic use. + * + * @psalm-param (callable(int): string)|null $randomBytesGenerator + * + * @param BigNumber|int|float|string $min The lower bound. Must be convertible to a BigInteger. + * @param BigNumber|int|float|string $max The upper bound. Must be convertible to a BigInteger. + * @param callable|null $randomBytesGenerator A function that accepts a number of bytes as an integer, + * and returns a string of random bytes of the given length. + * Defaults to the `random_bytes()` function. + * + * @throws MathException If one of the parameters cannot be converted to a BigInteger, + * or `$min` is greater than `$max`. + */ + public static function randomRange( + BigNumber|int|float|string $min, + BigNumber|int|float|string $max, + ?callable $randomBytesGenerator = null + ) : BigInteger { + $min = BigInteger::of($min); + $max = BigInteger::of($max); + + if ($min->isGreaterThan($max)) { + throw new MathException('$min cannot be greater than $max.'); + } + + if ($min->isEqualTo($max)) { + return $min; + } + + $diff = $max->minus($min); + $bitLength = $diff->getBitLength(); + + // try until the number is in range (50% to 100% chance of success) + do { + $randomNumber = self::randomBits($bitLength, $randomBytesGenerator); + } while ($randomNumber->isGreaterThan($diff)); + + return $randomNumber->plus($min); + } + + /** + * Returns a BigInteger representing zero. + * + * @psalm-pure + */ + public static function zero() : BigInteger + { + /** + * @psalm-suppress ImpureStaticVariable + * @var BigInteger|null $zero + */ + static $zero; + + if ($zero === null) { + $zero = new BigInteger('0'); + } + + return $zero; + } + + /** + * Returns a BigInteger representing one. + * + * @psalm-pure + */ + public static function one() : BigInteger + { + /** + * @psalm-suppress ImpureStaticVariable + * @var BigInteger|null $one + */ + static $one; + + if ($one === null) { + $one = new BigInteger('1'); + } + + return $one; + } + + /** + * Returns a BigInteger representing ten. + * + * @psalm-pure + */ + public static function ten() : BigInteger + { + /** + * @psalm-suppress ImpureStaticVariable + * @var BigInteger|null $ten + */ + static $ten; + + if ($ten === null) { + $ten = new BigInteger('10'); + } + + return $ten; + } + + public static function gcdMultiple(BigInteger $a, BigInteger ...$n): BigInteger + { + $result = $a; + + foreach ($n as $next) { + $result = $result->gcd($next); + + if ($result->isEqualTo(1)) { + return $result; + } + } + + return $result; + } + + /** + * Returns the sum of this number and the given one. + * + * @param BigNumber|int|float|string $that The number to add. Must be convertible to a BigInteger. + * + * @throws MathException If the number is not valid, or is not convertible to a BigInteger. + */ + public function plus(BigNumber|int|float|string $that) : BigInteger + { + $that = BigInteger::of($that); + + if ($that->value === '0') { + return $this; + } + + if ($this->value === '0') { + return $that; + } + + $value = Calculator::get()->add($this->value, $that->value); + + return new BigInteger($value); + } + + /** + * Returns the difference of this number and the given one. + * + * @param BigNumber|int|float|string $that The number to subtract. Must be convertible to a BigInteger. + * + * @throws MathException If the number is not valid, or is not convertible to a BigInteger. + */ + public function minus(BigNumber|int|float|string $that) : BigInteger + { + $that = BigInteger::of($that); + + if ($that->value === '0') { + return $this; + } + + $value = Calculator::get()->sub($this->value, $that->value); + + return new BigInteger($value); + } + + /** + * Returns the product of this number and the given one. + * + * @param BigNumber|int|float|string $that The multiplier. Must be convertible to a BigInteger. + * + * @throws MathException If the multiplier is not a valid number, or is not convertible to a BigInteger. + */ + public function multipliedBy(BigNumber|int|float|string $that) : BigInteger + { + $that = BigInteger::of($that); + + if ($that->value === '1') { + return $this; + } + + if ($this->value === '1') { + return $that; + } + + $value = Calculator::get()->mul($this->value, $that->value); + + return new BigInteger($value); + } + + /** + * Returns the result of the division of this number by the given one. + * + * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger. + * @param RoundingMode $roundingMode An optional rounding mode, defaults to UNNECESSARY. + * + * @throws MathException If the divisor is not a valid number, is not convertible to a BigInteger, is zero, + * or RoundingMode::UNNECESSARY is used and the remainder is not zero. + */ + public function dividedBy(BigNumber|int|float|string $that, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigInteger + { + $that = BigInteger::of($that); + + if ($that->value === '1') { + return $this; + } + + if ($that->value === '0') { + throw DivisionByZeroException::divisionByZero(); + } + + $result = Calculator::get()->divRound($this->value, $that->value, $roundingMode); + + return new BigInteger($result); + } + + /** + * Returns this number exponentiated to the given value. + * + * @throws \InvalidArgumentException If the exponent is not in the range 0 to 1,000,000. + */ + public function power(int $exponent) : BigInteger + { + if ($exponent === 0) { + return BigInteger::one(); + } + + if ($exponent === 1) { + return $this; + } + + if ($exponent < 0 || $exponent > Calculator::MAX_POWER) { + throw new \InvalidArgumentException(\sprintf( + 'The exponent %d is not in the range 0 to %d.', + $exponent, + Calculator::MAX_POWER + )); + } + + return new BigInteger(Calculator::get()->pow($this->value, $exponent)); + } + + /** + * Returns the quotient of the division of this number by the given one. + * + * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger. + * + * @throws DivisionByZeroException If the divisor is zero. + */ + public function quotient(BigNumber|int|float|string $that) : BigInteger + { + $that = BigInteger::of($that); + + if ($that->value === '1') { + return $this; + } + + if ($that->value === '0') { + throw DivisionByZeroException::divisionByZero(); + } + + $quotient = Calculator::get()->divQ($this->value, $that->value); + + return new BigInteger($quotient); + } + + /** + * Returns the remainder of the division of this number by the given one. + * + * The remainder, when non-zero, has the same sign as the dividend. + * + * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger. + * + * @throws DivisionByZeroException If the divisor is zero. + */ + public function remainder(BigNumber|int|float|string $that) : BigInteger + { + $that = BigInteger::of($that); + + if ($that->value === '1') { + return BigInteger::zero(); + } + + if ($that->value === '0') { + throw DivisionByZeroException::divisionByZero(); + } + + $remainder = Calculator::get()->divR($this->value, $that->value); + + return new BigInteger($remainder); + } + + /** + * Returns the quotient and remainder of the division of this number by the given one. + * + * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger. + * + * @return BigInteger[] An array containing the quotient and the remainder. + * + * @psalm-return array{BigInteger, BigInteger} + * + * @throws DivisionByZeroException If the divisor is zero. + */ + public function quotientAndRemainder(BigNumber|int|float|string $that) : array + { + $that = BigInteger::of($that); + + if ($that->value === '0') { + throw DivisionByZeroException::divisionByZero(); + } + + [$quotient, $remainder] = Calculator::get()->divQR($this->value, $that->value); + + return [ + new BigInteger($quotient), + new BigInteger($remainder) + ]; + } + + /** + * Returns the modulo of this number and the given one. + * + * The modulo operation yields the same result as the remainder operation when both operands are of the same sign, + * and may differ when signs are different. + * + * The result of the modulo operation, when non-zero, has the same sign as the divisor. + * + * @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger. + * + * @throws DivisionByZeroException If the divisor is zero. + */ + public function mod(BigNumber|int|float|string $that) : BigInteger + { + $that = BigInteger::of($that); + + if ($that->value === '0') { + throw DivisionByZeroException::modulusMustNotBeZero(); + } + + $value = Calculator::get()->mod($this->value, $that->value); + + return new BigInteger($value); + } + + /** + * Returns the modular multiplicative inverse of this BigInteger modulo $m. + * + * @throws DivisionByZeroException If $m is zero. + * @throws NegativeNumberException If $m is negative. + * @throws MathException If this BigInteger has no multiplicative inverse mod m (that is, this BigInteger + * is not relatively prime to m). + */ + public function modInverse(BigInteger $m) : BigInteger + { + if ($m->value === '0') { + throw DivisionByZeroException::modulusMustNotBeZero(); + } + + if ($m->isNegative()) { + throw new NegativeNumberException('Modulus must not be negative.'); + } + + if ($m->value === '1') { + return BigInteger::zero(); + } + + $value = Calculator::get()->modInverse($this->value, $m->value); + + if ($value === null) { + throw new MathException('Unable to compute the modInverse for the given modulus.'); + } + + return new BigInteger($value); + } + + /** + * Returns this number raised into power with modulo. + * + * This operation only works on positive numbers. + * + * @param BigNumber|int|float|string $exp The exponent. Must be positive or zero. + * @param BigNumber|int|float|string $mod The modulus. Must be strictly positive. + * + * @throws NegativeNumberException If any of the operands is negative. + * @throws DivisionByZeroException If the modulus is zero. + */ + public function modPow(BigNumber|int|float|string $exp, BigNumber|int|float|string $mod) : BigInteger + { + $exp = BigInteger::of($exp); + $mod = BigInteger::of($mod); + + if ($this->isNegative() || $exp->isNegative() || $mod->isNegative()) { + throw new NegativeNumberException('The operands cannot be negative.'); + } + + if ($mod->isZero()) { + throw DivisionByZeroException::modulusMustNotBeZero(); + } + + $result = Calculator::get()->modPow($this->value, $exp->value, $mod->value); + + return new BigInteger($result); + } + + /** + * Returns the greatest common divisor of this number and the given one. + * + * The GCD is always positive, unless both operands are zero, in which case it is zero. + * + * @param BigNumber|int|float|string $that The operand. Must be convertible to an integer number. + */ + public function gcd(BigNumber|int|float|string $that) : BigInteger + { + $that = BigInteger::of($that); + + if ($that->value === '0' && $this->value[0] !== '-') { + return $this; + } + + if ($this->value === '0' && $that->value[0] !== '-') { + return $that; + } + + $value = Calculator::get()->gcd($this->value, $that->value); + + return new BigInteger($value); + } + + /** + * Returns the integer square root number of this number, rounded down. + * + * The result is the largest x such that x² ≤ n. + * + * @throws NegativeNumberException If this number is negative. + */ + public function sqrt() : BigInteger + { + if ($this->value[0] === '-') { + throw new NegativeNumberException('Cannot calculate the square root of a negative number.'); + } + + $value = Calculator::get()->sqrt($this->value); + + return new BigInteger($value); + } + + /** + * Returns the absolute value of this number. + */ + public function abs() : BigInteger + { + return $this->isNegative() ? $this->negated() : $this; + } + + /** + * Returns the inverse of this number. + */ + public function negated() : BigInteger + { + return new BigInteger(Calculator::get()->neg($this->value)); + } + + /** + * Returns the integer bitwise-and combined with another integer. + * + * This method returns a negative BigInteger if and only if both operands are negative. + * + * @param BigNumber|int|float|string $that The operand. Must be convertible to an integer number. + */ + public function and(BigNumber|int|float|string $that) : BigInteger + { + $that = BigInteger::of($that); + + return new BigInteger(Calculator::get()->and($this->value, $that->value)); + } + + /** + * Returns the integer bitwise-or combined with another integer. + * + * This method returns a negative BigInteger if and only if either of the operands is negative. + * + * @param BigNumber|int|float|string $that The operand. Must be convertible to an integer number. + */ + public function or(BigNumber|int|float|string $that) : BigInteger + { + $that = BigInteger::of($that); + + return new BigInteger(Calculator::get()->or($this->value, $that->value)); + } + + /** + * Returns the integer bitwise-xor combined with another integer. + * + * This method returns a negative BigInteger if and only if exactly one of the operands is negative. + * + * @param BigNumber|int|float|string $that The operand. Must be convertible to an integer number. + */ + public function xor(BigNumber|int|float|string $that) : BigInteger + { + $that = BigInteger::of($that); + + return new BigInteger(Calculator::get()->xor($this->value, $that->value)); + } + + /** + * Returns the bitwise-not of this BigInteger. + */ + public function not() : BigInteger + { + return $this->negated()->minus(1); + } + + /** + * Returns the integer left shifted by a given number of bits. + */ + public function shiftedLeft(int $distance) : BigInteger + { + if ($distance === 0) { + return $this; + } + + if ($distance < 0) { + return $this->shiftedRight(- $distance); + } + + return $this->multipliedBy(BigInteger::of(2)->power($distance)); + } + + /** + * Returns the integer right shifted by a given number of bits. + */ + public function shiftedRight(int $distance) : BigInteger + { + if ($distance === 0) { + return $this; + } + + if ($distance < 0) { + return $this->shiftedLeft(- $distance); + } + + $operand = BigInteger::of(2)->power($distance); + + if ($this->isPositiveOrZero()) { + return $this->quotient($operand); + } + + return $this->dividedBy($operand, RoundingMode::UP); + } + + /** + * Returns the number of bits in the minimal two's-complement representation of this BigInteger, excluding a sign bit. + * + * For positive BigIntegers, this is equivalent to the number of bits in the ordinary binary representation. + * Computes (ceil(log2(this < 0 ? -this : this+1))). + */ + public function getBitLength() : int + { + if ($this->value === '0') { + return 0; + } + + if ($this->isNegative()) { + return $this->abs()->minus(1)->getBitLength(); + } + + return \strlen($this->toBase(2)); + } + + /** + * Returns the index of the rightmost (lowest-order) one bit in this BigInteger. + * + * Returns -1 if this BigInteger contains no one bits. + */ + public function getLowestSetBit() : int + { + $n = $this; + $bitLength = $this->getBitLength(); + + for ($i = 0; $i <= $bitLength; $i++) { + if ($n->isOdd()) { + return $i; + } + + $n = $n->shiftedRight(1); + } + + return -1; + } + + /** + * Returns whether this number is even. + */ + public function isEven() : bool + { + return \in_array($this->value[-1], ['0', '2', '4', '6', '8'], true); + } + + /** + * Returns whether this number is odd. + */ + public function isOdd() : bool + { + return \in_array($this->value[-1], ['1', '3', '5', '7', '9'], true); + } + + /** + * Returns true if and only if the designated bit is set. + * + * Computes ((this & (1<shiftedRight($n)->isOdd(); + } + + public function compareTo(BigNumber|int|float|string $that) : int + { + $that = BigNumber::of($that); + + if ($that instanceof BigInteger) { + return Calculator::get()->cmp($this->value, $that->value); + } + + return - $that->compareTo($this); + } + + public function getSign() : int + { + return ($this->value === '0') ? 0 : (($this->value[0] === '-') ? -1 : 1); + } + + public function toBigInteger() : BigInteger + { + return $this; + } + + public function toBigDecimal() : BigDecimal + { + return self::newBigDecimal($this->value); + } + + public function toBigRational() : BigRational + { + return self::newBigRational($this, BigInteger::one(), false); + } + + public function toScale(int $scale, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal + { + return $this->toBigDecimal()->toScale($scale, $roundingMode); + } + + public function toInt() : int + { + $intValue = (int) $this->value; + + if ($this->value !== (string) $intValue) { + throw IntegerOverflowException::toIntOverflow($this); + } + + return $intValue; + } + + public function toFloat() : float + { + return (float) $this->value; + } + + /** + * Returns a string representation of this number in the given base. + * + * The output will always be lowercase for bases greater than 10. + * + * @throws \InvalidArgumentException If the base is out of range. + */ + public function toBase(int $base) : string + { + if ($base === 10) { + return $this->value; + } + + if ($base < 2 || $base > 36) { + throw new \InvalidArgumentException(\sprintf('Base %d is out of range [2, 36]', $base)); + } + + return Calculator::get()->toBase($this->value, $base); + } + + /** + * Returns a string representation of this number in an arbitrary base with a custom alphabet. + * + * Because this method accepts an alphabet with any character, including dash, it does not handle negative numbers; + * a NegativeNumberException will be thrown when attempting to call this method on a negative number. + * + * @param string $alphabet The alphabet, for example '01' for base 2, or '01234567' for base 8. + * + * @throws NegativeNumberException If this number is negative. + * @throws \InvalidArgumentException If the given alphabet does not contain at least 2 chars. + */ + public function toArbitraryBase(string $alphabet) : string + { + $base = \strlen($alphabet); + + if ($base < 2) { + throw new \InvalidArgumentException('The alphabet must contain at least 2 chars.'); + } + + if ($this->value[0] === '-') { + throw new NegativeNumberException(__FUNCTION__ . '() does not support negative numbers.'); + } + + return Calculator::get()->toArbitraryBase($this->value, $alphabet, $base); + } + + /** + * Returns a string of bytes containing the binary representation of this BigInteger. + * + * The string is in big-endian byte-order: the most significant byte is in the zeroth element. + * + * If `$signed` is true, the output will be in two's-complement representation, and a sign bit will be prepended to + * the output. If `$signed` is false, no sign bit will be prepended, and this method will throw an exception if the + * number is negative. + * + * The string will contain the minimum number of bytes required to represent this BigInteger, including a sign bit + * if `$signed` is true. + * + * This representation is compatible with the `fromBytes()` factory method, as long as the `$signed` flags match. + * + * @param bool $signed Whether to output a signed number in two's-complement representation with a leading sign bit. + * + * @throws NegativeNumberException If $signed is false, and the number is negative. + */ + public function toBytes(bool $signed = true) : string + { + if (! $signed && $this->isNegative()) { + throw new NegativeNumberException('Cannot convert a negative number to a byte string when $signed is false.'); + } + + $hex = $this->abs()->toBase(16); + + if (\strlen($hex) % 2 !== 0) { + $hex = '0' . $hex; + } + + $baseHexLength = \strlen($hex); + + if ($signed) { + if ($this->isNegative()) { + $bin = \hex2bin($hex); + assert($bin !== false); + + $hex = \bin2hex(~$bin); + $hex = self::fromBase($hex, 16)->plus(1)->toBase(16); + + $hexLength = \strlen($hex); + + if ($hexLength < $baseHexLength) { + $hex = \str_repeat('0', $baseHexLength - $hexLength) . $hex; + } + + if ($hex[0] < '8') { + $hex = 'FF' . $hex; + } + } else { + if ($hex[0] >= '8') { + $hex = '00' . $hex; + } + } + } + + return \hex2bin($hex); + } + + public function __toString() : string + { + return $this->value; + } + + /** + * This method is required for serializing the object and SHOULD NOT be accessed directly. + * + * @internal + * + * @return array{value: string} + */ + public function __serialize(): array + { + return ['value' => $this->value]; + } + + /** + * This method is only here to allow unserializing the object and cannot be accessed directly. + * + * @internal + * @psalm-suppress RedundantPropertyInitializationCheck + * + * @param array{value: string} $data + * + * @throws \LogicException + */ + public function __unserialize(array $data): void + { + if (isset($this->value)) { + throw new \LogicException('__unserialize() is an internal function, it must not be called directly.'); + } + + $this->value = $data['value']; + } +} diff --git a/vendor/brick/math/src/BigNumber.php b/vendor/brick/math/src/BigNumber.php new file mode 100644 index 00000000..5a0df783 --- /dev/null +++ b/vendor/brick/math/src/BigNumber.php @@ -0,0 +1,509 @@ +[\-\+])?' . + '(?[0-9]+)?' . + '(?\.)?' . + '(?[0-9]+)?' . + '(?:[eE](?[\-\+]?[0-9]+))?' . + '$/'; + + /** + * The regular expression used to parse rational numbers. + */ + private const PARSE_REGEXP_RATIONAL = + '/^' . + '(?[\-\+])?' . + '(?[0-9]+)' . + '\/?' . + '(?[0-9]+)' . + '$/'; + + /** + * Creates a BigNumber of the given value. + * + * The concrete return type is dependent on the given value, with the following rules: + * + * - BigNumber instances are returned as is + * - integer numbers are returned as BigInteger + * - floating point numbers are converted to a string then parsed as such + * - strings containing a `/` character are returned as BigRational + * - strings containing a `.` character or using an exponential notation are returned as BigDecimal + * - strings containing only digits with an optional leading `+` or `-` sign are returned as BigInteger + * + * @throws NumberFormatException If the format of the number is not valid. + * @throws DivisionByZeroException If the value represents a rational number with a denominator of zero. + * + * @psalm-pure + */ + final public static function of(BigNumber|int|float|string $value) : static + { + $value = self::_of($value); + + if (static::class === BigNumber::class) { + // https://github.com/vimeo/psalm/issues/10309 + assert($value instanceof static); + + return $value; + } + + return static::from($value); + } + + /** + * @psalm-pure + */ + private static function _of(BigNumber|int|float|string $value) : BigNumber + { + if ($value instanceof BigNumber) { + return $value; + } + + if (\is_int($value)) { + return new BigInteger((string) $value); + } + + if (is_float($value)) { + $value = (string) $value; + } + + if (str_contains($value, '/')) { + // Rational number + if (\preg_match(self::PARSE_REGEXP_RATIONAL, $value, $matches, PREG_UNMATCHED_AS_NULL) !== 1) { + throw NumberFormatException::invalidFormat($value); + } + + $sign = $matches['sign']; + $numerator = $matches['numerator']; + $denominator = $matches['denominator']; + + assert($numerator !== null); + assert($denominator !== null); + + $numerator = self::cleanUp($sign, $numerator); + $denominator = self::cleanUp(null, $denominator); + + if ($denominator === '0') { + throw DivisionByZeroException::denominatorMustNotBeZero(); + } + + return new BigRational( + new BigInteger($numerator), + new BigInteger($denominator), + false + ); + } else { + // Integer or decimal number + if (\preg_match(self::PARSE_REGEXP_NUMERICAL, $value, $matches, PREG_UNMATCHED_AS_NULL) !== 1) { + throw NumberFormatException::invalidFormat($value); + } + + $sign = $matches['sign']; + $point = $matches['point']; + $integral = $matches['integral']; + $fractional = $matches['fractional']; + $exponent = $matches['exponent']; + + if ($integral === null && $fractional === null) { + throw NumberFormatException::invalidFormat($value); + } + + if ($integral === null) { + $integral = '0'; + } + + if ($point !== null || $exponent !== null) { + $fractional = ($fractional ?? ''); + $exponent = ($exponent !== null) ? (int)$exponent : 0; + + if ($exponent === PHP_INT_MIN || $exponent === PHP_INT_MAX) { + throw new NumberFormatException('Exponent too large.'); + } + + $unscaledValue = self::cleanUp($sign, $integral . $fractional); + + $scale = \strlen($fractional) - $exponent; + + if ($scale < 0) { + if ($unscaledValue !== '0') { + $unscaledValue .= \str_repeat('0', -$scale); + } + $scale = 0; + } + + return new BigDecimal($unscaledValue, $scale); + } + + $integral = self::cleanUp($sign, $integral); + + return new BigInteger($integral); + } + } + + /** + * Overridden by subclasses to convert a BigNumber to an instance of the subclass. + * + * @throws MathException If the value cannot be converted. + * + * @psalm-pure + */ + abstract protected static function from(BigNumber $number): static; + + /** + * Proxy method to access BigInteger's protected constructor from sibling classes. + * + * @internal + * @psalm-pure + */ + final protected function newBigInteger(string $value) : BigInteger + { + return new BigInteger($value); + } + + /** + * Proxy method to access BigDecimal's protected constructor from sibling classes. + * + * @internal + * @psalm-pure + */ + final protected function newBigDecimal(string $value, int $scale = 0) : BigDecimal + { + return new BigDecimal($value, $scale); + } + + /** + * Proxy method to access BigRational's protected constructor from sibling classes. + * + * @internal + * @psalm-pure + */ + final protected function newBigRational(BigInteger $numerator, BigInteger $denominator, bool $checkDenominator) : BigRational + { + return new BigRational($numerator, $denominator, $checkDenominator); + } + + /** + * Returns the minimum of the given values. + * + * @param BigNumber|int|float|string ...$values The numbers to compare. All the numbers need to be convertible + * to an instance of the class this method is called on. + * + * @throws \InvalidArgumentException If no values are given. + * @throws MathException If an argument is not valid. + * + * @psalm-pure + */ + final public static function min(BigNumber|int|float|string ...$values) : static + { + $min = null; + + foreach ($values as $value) { + $value = static::of($value); + + if ($min === null || $value->isLessThan($min)) { + $min = $value; + } + } + + if ($min === null) { + throw new \InvalidArgumentException(__METHOD__ . '() expects at least one value.'); + } + + return $min; + } + + /** + * Returns the maximum of the given values. + * + * @param BigNumber|int|float|string ...$values The numbers to compare. All the numbers need to be convertible + * to an instance of the class this method is called on. + * + * @throws \InvalidArgumentException If no values are given. + * @throws MathException If an argument is not valid. + * + * @psalm-pure + */ + final public static function max(BigNumber|int|float|string ...$values) : static + { + $max = null; + + foreach ($values as $value) { + $value = static::of($value); + + if ($max === null || $value->isGreaterThan($max)) { + $max = $value; + } + } + + if ($max === null) { + throw new \InvalidArgumentException(__METHOD__ . '() expects at least one value.'); + } + + return $max; + } + + /** + * Returns the sum of the given values. + * + * @param BigNumber|int|float|string ...$values The numbers to add. All the numbers need to be convertible + * to an instance of the class this method is called on. + * + * @throws \InvalidArgumentException If no values are given. + * @throws MathException If an argument is not valid. + * + * @psalm-pure + */ + final public static function sum(BigNumber|int|float|string ...$values) : static + { + /** @var static|null $sum */ + $sum = null; + + foreach ($values as $value) { + $value = static::of($value); + + $sum = $sum === null ? $value : self::add($sum, $value); + } + + if ($sum === null) { + throw new \InvalidArgumentException(__METHOD__ . '() expects at least one value.'); + } + + return $sum; + } + + /** + * Adds two BigNumber instances in the correct order to avoid a RoundingNecessaryException. + * + * @todo This could be better resolved by creating an abstract protected method in BigNumber, and leaving to + * concrete classes the responsibility to perform the addition themselves or delegate it to the given number, + * depending on their ability to perform the operation. This will also require a version bump because we're + * potentially breaking custom BigNumber implementations (if any...) + * + * @psalm-pure + */ + private static function add(BigNumber $a, BigNumber $b) : BigNumber + { + if ($a instanceof BigRational) { + return $a->plus($b); + } + + if ($b instanceof BigRational) { + return $b->plus($a); + } + + if ($a instanceof BigDecimal) { + return $a->plus($b); + } + + if ($b instanceof BigDecimal) { + return $b->plus($a); + } + + /** @var BigInteger $a */ + + return $a->plus($b); + } + + /** + * Removes optional leading zeros and applies sign. + * + * @param string|null $sign The sign, '+' or '-', optional. Null is allowed for convenience and treated as '+'. + * @param string $number The number, validated as a non-empty string of digits. + * + * @psalm-pure + */ + private static function cleanUp(string|null $sign, string $number) : string + { + $number = \ltrim($number, '0'); + + if ($number === '') { + return '0'; + } + + return $sign === '-' ? '-' . $number : $number; + } + + /** + * Checks if this number is equal to the given one. + */ + final public function isEqualTo(BigNumber|int|float|string $that) : bool + { + return $this->compareTo($that) === 0; + } + + /** + * Checks if this number is strictly lower than the given one. + */ + final public function isLessThan(BigNumber|int|float|string $that) : bool + { + return $this->compareTo($that) < 0; + } + + /** + * Checks if this number is lower than or equal to the given one. + */ + final public function isLessThanOrEqualTo(BigNumber|int|float|string $that) : bool + { + return $this->compareTo($that) <= 0; + } + + /** + * Checks if this number is strictly greater than the given one. + */ + final public function isGreaterThan(BigNumber|int|float|string $that) : bool + { + return $this->compareTo($that) > 0; + } + + /** + * Checks if this number is greater than or equal to the given one. + */ + final public function isGreaterThanOrEqualTo(BigNumber|int|float|string $that) : bool + { + return $this->compareTo($that) >= 0; + } + + /** + * Checks if this number equals zero. + */ + final public function isZero() : bool + { + return $this->getSign() === 0; + } + + /** + * Checks if this number is strictly negative. + */ + final public function isNegative() : bool + { + return $this->getSign() < 0; + } + + /** + * Checks if this number is negative or zero. + */ + final public function isNegativeOrZero() : bool + { + return $this->getSign() <= 0; + } + + /** + * Checks if this number is strictly positive. + */ + final public function isPositive() : bool + { + return $this->getSign() > 0; + } + + /** + * Checks if this number is positive or zero. + */ + final public function isPositiveOrZero() : bool + { + return $this->getSign() >= 0; + } + + /** + * Returns the sign of this number. + * + * @psalm-return -1|0|1 + * + * @return int -1 if the number is negative, 0 if zero, 1 if positive. + */ + abstract public function getSign() : int; + + /** + * Compares this number to the given one. + * + * @psalm-return -1|0|1 + * + * @return int -1 if `$this` is lower than, 0 if equal to, 1 if greater than `$that`. + * + * @throws MathException If the number is not valid. + */ + abstract public function compareTo(BigNumber|int|float|string $that) : int; + + /** + * Converts this number to a BigInteger. + * + * @throws RoundingNecessaryException If this number cannot be converted to a BigInteger without rounding. + */ + abstract public function toBigInteger() : BigInteger; + + /** + * Converts this number to a BigDecimal. + * + * @throws RoundingNecessaryException If this number cannot be converted to a BigDecimal without rounding. + */ + abstract public function toBigDecimal() : BigDecimal; + + /** + * Converts this number to a BigRational. + */ + abstract public function toBigRational() : BigRational; + + /** + * Converts this number to a BigDecimal with the given scale, using rounding if necessary. + * + * @param int $scale The scale of the resulting `BigDecimal`. + * @param RoundingMode $roundingMode An optional rounding mode, defaults to UNNECESSARY. + * + * @throws RoundingNecessaryException If this number cannot be converted to the given scale without rounding. + * This only applies when RoundingMode::UNNECESSARY is used. + */ + abstract public function toScale(int $scale, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal; + + /** + * Returns the exact value of this number as a native integer. + * + * If this number cannot be converted to a native integer without losing precision, an exception is thrown. + * Note that the acceptable range for an integer depends on the platform and differs for 32-bit and 64-bit. + * + * @throws MathException If this number cannot be exactly converted to a native integer. + */ + abstract public function toInt() : int; + + /** + * Returns an approximation of this number as a floating-point value. + * + * Note that this method can discard information as the precision of a floating-point value + * is inherently limited. + * + * If the number is greater than the largest representable floating point number, positive infinity is returned. + * If the number is less than the smallest representable floating point number, negative infinity is returned. + */ + abstract public function toFloat() : float; + + /** + * Returns a string representation of this number. + * + * The output of this method can be parsed by the `of()` factory method; + * this will yield an object equal to this one, without any information loss. + */ + abstract public function __toString() : string; + + final public function jsonSerialize() : string + { + return $this->__toString(); + } +} diff --git a/vendor/brick/math/src/BigRational.php b/vendor/brick/math/src/BigRational.php new file mode 100644 index 00000000..fc3060ed --- /dev/null +++ b/vendor/brick/math/src/BigRational.php @@ -0,0 +1,413 @@ +isZero()) { + throw DivisionByZeroException::denominatorMustNotBeZero(); + } + + if ($denominator->isNegative()) { + $numerator = $numerator->negated(); + $denominator = $denominator->negated(); + } + } + + $this->numerator = $numerator; + $this->denominator = $denominator; + } + + /** + * @psalm-pure + */ + protected static function from(BigNumber $number): static + { + return $number->toBigRational(); + } + + /** + * Creates a BigRational out of a numerator and a denominator. + * + * If the denominator is negative, the signs of both the numerator and the denominator + * will be inverted to ensure that the denominator is always positive. + * + * @param BigNumber|int|float|string $numerator The numerator. Must be convertible to a BigInteger. + * @param BigNumber|int|float|string $denominator The denominator. Must be convertible to a BigInteger. + * + * @throws NumberFormatException If an argument does not represent a valid number. + * @throws RoundingNecessaryException If an argument represents a non-integer number. + * @throws DivisionByZeroException If the denominator is zero. + * + * @psalm-pure + */ + public static function nd( + BigNumber|int|float|string $numerator, + BigNumber|int|float|string $denominator, + ) : BigRational { + $numerator = BigInteger::of($numerator); + $denominator = BigInteger::of($denominator); + + return new BigRational($numerator, $denominator, true); + } + + /** + * Returns a BigRational representing zero. + * + * @psalm-pure + */ + public static function zero() : BigRational + { + /** + * @psalm-suppress ImpureStaticVariable + * @var BigRational|null $zero + */ + static $zero; + + if ($zero === null) { + $zero = new BigRational(BigInteger::zero(), BigInteger::one(), false); + } + + return $zero; + } + + /** + * Returns a BigRational representing one. + * + * @psalm-pure + */ + public static function one() : BigRational + { + /** + * @psalm-suppress ImpureStaticVariable + * @var BigRational|null $one + */ + static $one; + + if ($one === null) { + $one = new BigRational(BigInteger::one(), BigInteger::one(), false); + } + + return $one; + } + + /** + * Returns a BigRational representing ten. + * + * @psalm-pure + */ + public static function ten() : BigRational + { + /** + * @psalm-suppress ImpureStaticVariable + * @var BigRational|null $ten + */ + static $ten; + + if ($ten === null) { + $ten = new BigRational(BigInteger::ten(), BigInteger::one(), false); + } + + return $ten; + } + + public function getNumerator() : BigInteger + { + return $this->numerator; + } + + public function getDenominator() : BigInteger + { + return $this->denominator; + } + + /** + * Returns the quotient of the division of the numerator by the denominator. + */ + public function quotient() : BigInteger + { + return $this->numerator->quotient($this->denominator); + } + + /** + * Returns the remainder of the division of the numerator by the denominator. + */ + public function remainder() : BigInteger + { + return $this->numerator->remainder($this->denominator); + } + + /** + * Returns the quotient and remainder of the division of the numerator by the denominator. + * + * @return BigInteger[] + * + * @psalm-return array{BigInteger, BigInteger} + */ + public function quotientAndRemainder() : array + { + return $this->numerator->quotientAndRemainder($this->denominator); + } + + /** + * Returns the sum of this number and the given one. + * + * @param BigNumber|int|float|string $that The number to add. + * + * @throws MathException If the number is not valid. + */ + public function plus(BigNumber|int|float|string $that) : BigRational + { + $that = BigRational::of($that); + + $numerator = $this->numerator->multipliedBy($that->denominator); + $numerator = $numerator->plus($that->numerator->multipliedBy($this->denominator)); + $denominator = $this->denominator->multipliedBy($that->denominator); + + return new BigRational($numerator, $denominator, false); + } + + /** + * Returns the difference of this number and the given one. + * + * @param BigNumber|int|float|string $that The number to subtract. + * + * @throws MathException If the number is not valid. + */ + public function minus(BigNumber|int|float|string $that) : BigRational + { + $that = BigRational::of($that); + + $numerator = $this->numerator->multipliedBy($that->denominator); + $numerator = $numerator->minus($that->numerator->multipliedBy($this->denominator)); + $denominator = $this->denominator->multipliedBy($that->denominator); + + return new BigRational($numerator, $denominator, false); + } + + /** + * Returns the product of this number and the given one. + * + * @param BigNumber|int|float|string $that The multiplier. + * + * @throws MathException If the multiplier is not a valid number. + */ + public function multipliedBy(BigNumber|int|float|string $that) : BigRational + { + $that = BigRational::of($that); + + $numerator = $this->numerator->multipliedBy($that->numerator); + $denominator = $this->denominator->multipliedBy($that->denominator); + + return new BigRational($numerator, $denominator, false); + } + + /** + * Returns the result of the division of this number by the given one. + * + * @param BigNumber|int|float|string $that The divisor. + * + * @throws MathException If the divisor is not a valid number, or is zero. + */ + public function dividedBy(BigNumber|int|float|string $that) : BigRational + { + $that = BigRational::of($that); + + $numerator = $this->numerator->multipliedBy($that->denominator); + $denominator = $this->denominator->multipliedBy($that->numerator); + + return new BigRational($numerator, $denominator, true); + } + + /** + * Returns this number exponentiated to the given value. + * + * @throws \InvalidArgumentException If the exponent is not in the range 0 to 1,000,000. + */ + public function power(int $exponent) : BigRational + { + if ($exponent === 0) { + $one = BigInteger::one(); + + return new BigRational($one, $one, false); + } + + if ($exponent === 1) { + return $this; + } + + return new BigRational( + $this->numerator->power($exponent), + $this->denominator->power($exponent), + false + ); + } + + /** + * Returns the reciprocal of this BigRational. + * + * The reciprocal has the numerator and denominator swapped. + * + * @throws DivisionByZeroException If the numerator is zero. + */ + public function reciprocal() : BigRational + { + return new BigRational($this->denominator, $this->numerator, true); + } + + /** + * Returns the absolute value of this BigRational. + */ + public function abs() : BigRational + { + return new BigRational($this->numerator->abs(), $this->denominator, false); + } + + /** + * Returns the negated value of this BigRational. + */ + public function negated() : BigRational + { + return new BigRational($this->numerator->negated(), $this->denominator, false); + } + + /** + * Returns the simplified value of this BigRational. + */ + public function simplified() : BigRational + { + $gcd = $this->numerator->gcd($this->denominator); + + $numerator = $this->numerator->quotient($gcd); + $denominator = $this->denominator->quotient($gcd); + + return new BigRational($numerator, $denominator, false); + } + + public function compareTo(BigNumber|int|float|string $that) : int + { + return $this->minus($that)->getSign(); + } + + public function getSign() : int + { + return $this->numerator->getSign(); + } + + public function toBigInteger() : BigInteger + { + $simplified = $this->simplified(); + + if (! $simplified->denominator->isEqualTo(1)) { + throw new RoundingNecessaryException('This rational number cannot be represented as an integer value without rounding.'); + } + + return $simplified->numerator; + } + + public function toBigDecimal() : BigDecimal + { + return $this->numerator->toBigDecimal()->exactlyDividedBy($this->denominator); + } + + public function toBigRational() : BigRational + { + return $this; + } + + public function toScale(int $scale, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal + { + return $this->numerator->toBigDecimal()->dividedBy($this->denominator, $scale, $roundingMode); + } + + public function toInt() : int + { + return $this->toBigInteger()->toInt(); + } + + public function toFloat() : float + { + $simplified = $this->simplified(); + return $simplified->numerator->toFloat() / $simplified->denominator->toFloat(); + } + + public function __toString() : string + { + $numerator = (string) $this->numerator; + $denominator = (string) $this->denominator; + + if ($denominator === '1') { + return $numerator; + } + + return $this->numerator . '/' . $this->denominator; + } + + /** + * This method is required for serializing the object and SHOULD NOT be accessed directly. + * + * @internal + * + * @return array{numerator: BigInteger, denominator: BigInteger} + */ + public function __serialize(): array + { + return ['numerator' => $this->numerator, 'denominator' => $this->denominator]; + } + + /** + * This method is only here to allow unserializing the object and cannot be accessed directly. + * + * @internal + * @psalm-suppress RedundantPropertyInitializationCheck + * + * @param array{numerator: BigInteger, denominator: BigInteger} $data + * + * @throws \LogicException + */ + public function __unserialize(array $data): void + { + if (isset($this->numerator)) { + throw new \LogicException('__unserialize() is an internal function, it must not be called directly.'); + } + + $this->numerator = $data['numerator']; + $this->denominator = $data['denominator']; + } +} diff --git a/vendor/brick/math/src/Exception/DivisionByZeroException.php b/vendor/brick/math/src/Exception/DivisionByZeroException.php new file mode 100644 index 00000000..ce7769ac --- /dev/null +++ b/vendor/brick/math/src/Exception/DivisionByZeroException.php @@ -0,0 +1,35 @@ + 126) { + $char = \strtoupper(\dechex($ord)); + + if ($ord < 10) { + $char = '0' . $char; + } + } else { + $char = '"' . $char . '"'; + } + + return new self(\sprintf('Char %s is not a valid character in the given alphabet.', $char)); + } +} diff --git a/vendor/brick/math/src/Exception/RoundingNecessaryException.php b/vendor/brick/math/src/Exception/RoundingNecessaryException.php new file mode 100644 index 00000000..57bfcd84 --- /dev/null +++ b/vendor/brick/math/src/Exception/RoundingNecessaryException.php @@ -0,0 +1,19 @@ +init($a, $b); + + if ($aNeg && ! $bNeg) { + return -1; + } + + if ($bNeg && ! $aNeg) { + return 1; + } + + $aLen = \strlen($aDig); + $bLen = \strlen($bDig); + + if ($aLen < $bLen) { + $result = -1; + } elseif ($aLen > $bLen) { + $result = 1; + } else { + $result = $aDig <=> $bDig; + } + + return $aNeg ? -$result : $result; + } + + /** + * Adds two numbers. + */ + abstract public function add(string $a, string $b) : string; + + /** + * Subtracts two numbers. + */ + abstract public function sub(string $a, string $b) : string; + + /** + * Multiplies two numbers. + */ + abstract public function mul(string $a, string $b) : string; + + /** + * Returns the quotient of the division of two numbers. + * + * @param string $a The dividend. + * @param string $b The divisor, must not be zero. + * + * @return string The quotient. + */ + abstract public function divQ(string $a, string $b) : string; + + /** + * Returns the remainder of the division of two numbers. + * + * @param string $a The dividend. + * @param string $b The divisor, must not be zero. + * + * @return string The remainder. + */ + abstract public function divR(string $a, string $b) : string; + + /** + * Returns the quotient and remainder of the division of two numbers. + * + * @param string $a The dividend. + * @param string $b The divisor, must not be zero. + * + * @return array{string, string} An array containing the quotient and remainder. + */ + abstract public function divQR(string $a, string $b) : array; + + /** + * Exponentiates a number. + * + * @param string $a The base number. + * @param int $e The exponent, validated as an integer between 0 and MAX_POWER. + * + * @return string The power. + */ + abstract public function pow(string $a, int $e) : string; + + /** + * @param string $b The modulus; must not be zero. + */ + public function mod(string $a, string $b) : string + { + return $this->divR($this->add($this->divR($a, $b), $b), $b); + } + + /** + * Returns the modular multiplicative inverse of $x modulo $m. + * + * If $x has no multiplicative inverse mod m, this method must return null. + * + * This method can be overridden by the concrete implementation if the underlying library has built-in support. + * + * @param string $m The modulus; must not be negative or zero. + */ + public function modInverse(string $x, string $m) : ?string + { + if ($m === '1') { + return '0'; + } + + $modVal = $x; + + if ($x[0] === '-' || ($this->cmp($this->abs($x), $m) >= 0)) { + $modVal = $this->mod($x, $m); + } + + [$g, $x] = $this->gcdExtended($modVal, $m); + + if ($g !== '1') { + return null; + } + + return $this->mod($this->add($this->mod($x, $m), $m), $m); + } + + /** + * Raises a number into power with modulo. + * + * @param string $base The base number; must be positive or zero. + * @param string $exp The exponent; must be positive or zero. + * @param string $mod The modulus; must be strictly positive. + */ + abstract public function modPow(string $base, string $exp, string $mod) : string; + + /** + * Returns the greatest common divisor of the two numbers. + * + * This method can be overridden by the concrete implementation if the underlying library + * has built-in support for GCD calculations. + * + * @return string The GCD, always positive, or zero if both arguments are zero. + */ + public function gcd(string $a, string $b) : string + { + if ($a === '0') { + return $this->abs($b); + } + + if ($b === '0') { + return $this->abs($a); + } + + return $this->gcd($b, $this->divR($a, $b)); + } + + /** + * @return array{string, string, string} GCD, X, Y + */ + private function gcdExtended(string $a, string $b) : array + { + if ($a === '0') { + return [$b, '0', '1']; + } + + [$gcd, $x1, $y1] = $this->gcdExtended($this->mod($b, $a), $a); + + $x = $this->sub($y1, $this->mul($this->divQ($b, $a), $x1)); + $y = $x1; + + return [$gcd, $x, $y]; + } + + /** + * Returns the square root of the given number, rounded down. + * + * The result is the largest x such that x² ≤ n. + * The input MUST NOT be negative. + */ + abstract public function sqrt(string $n) : string; + + /** + * Converts a number from an arbitrary base. + * + * This method can be overridden by the concrete implementation if the underlying library + * has built-in support for base conversion. + * + * @param string $number The number, positive or zero, non-empty, case-insensitively validated for the given base. + * @param int $base The base of the number, validated from 2 to 36. + * + * @return string The converted number, following the Calculator conventions. + */ + public function fromBase(string $number, int $base) : string + { + return $this->fromArbitraryBase(\strtolower($number), self::ALPHABET, $base); + } + + /** + * Converts a number to an arbitrary base. + * + * This method can be overridden by the concrete implementation if the underlying library + * has built-in support for base conversion. + * + * @param string $number The number to convert, following the Calculator conventions. + * @param int $base The base to convert to, validated from 2 to 36. + * + * @return string The converted number, lowercase. + */ + public function toBase(string $number, int $base) : string + { + $negative = ($number[0] === '-'); + + if ($negative) { + $number = \substr($number, 1); + } + + $number = $this->toArbitraryBase($number, self::ALPHABET, $base); + + if ($negative) { + return '-' . $number; + } + + return $number; + } + + /** + * Converts a non-negative number in an arbitrary base using a custom alphabet, to base 10. + * + * @param string $number The number to convert, validated as a non-empty string, + * containing only chars in the given alphabet/base. + * @param string $alphabet The alphabet that contains every digit, validated as 2 chars minimum. + * @param int $base The base of the number, validated from 2 to alphabet length. + * + * @return string The number in base 10, following the Calculator conventions. + */ + final public function fromArbitraryBase(string $number, string $alphabet, int $base) : string + { + // remove leading "zeros" + $number = \ltrim($number, $alphabet[0]); + + if ($number === '') { + return '0'; + } + + // optimize for "one" + if ($number === $alphabet[1]) { + return '1'; + } + + $result = '0'; + $power = '1'; + + $base = (string) $base; + + for ($i = \strlen($number) - 1; $i >= 0; $i--) { + $index = \strpos($alphabet, $number[$i]); + + if ($index !== 0) { + $result = $this->add($result, ($index === 1) + ? $power + : $this->mul($power, (string) $index) + ); + } + + if ($i !== 0) { + $power = $this->mul($power, $base); + } + } + + return $result; + } + + /** + * Converts a non-negative number to an arbitrary base using a custom alphabet. + * + * @param string $number The number to convert, positive or zero, following the Calculator conventions. + * @param string $alphabet The alphabet that contains every digit, validated as 2 chars minimum. + * @param int $base The base to convert to, validated from 2 to alphabet length. + * + * @return string The converted number in the given alphabet. + */ + final public function toArbitraryBase(string $number, string $alphabet, int $base) : string + { + if ($number === '0') { + return $alphabet[0]; + } + + $base = (string) $base; + $result = ''; + + while ($number !== '0') { + [$number, $remainder] = $this->divQR($number, $base); + $remainder = (int) $remainder; + + $result .= $alphabet[$remainder]; + } + + return \strrev($result); + } + + /** + * Performs a rounded division. + * + * Rounding is performed when the remainder of the division is not zero. + * + * @param string $a The dividend. + * @param string $b The divisor, must not be zero. + * @param RoundingMode $roundingMode The rounding mode. + * + * @throws \InvalidArgumentException If the rounding mode is invalid. + * @throws RoundingNecessaryException If RoundingMode::UNNECESSARY is provided but rounding is necessary. + * + * @psalm-suppress ImpureFunctionCall + */ + final public function divRound(string $a, string $b, RoundingMode $roundingMode) : string + { + [$quotient, $remainder] = $this->divQR($a, $b); + + $hasDiscardedFraction = ($remainder !== '0'); + $isPositiveOrZero = ($a[0] === '-') === ($b[0] === '-'); + + $discardedFractionSign = function() use ($remainder, $b) : int { + $r = $this->abs($this->mul($remainder, '2')); + $b = $this->abs($b); + + return $this->cmp($r, $b); + }; + + $increment = false; + + switch ($roundingMode) { + case RoundingMode::UNNECESSARY: + if ($hasDiscardedFraction) { + throw RoundingNecessaryException::roundingNecessary(); + } + break; + + case RoundingMode::UP: + $increment = $hasDiscardedFraction; + break; + + case RoundingMode::DOWN: + break; + + case RoundingMode::CEILING: + $increment = $hasDiscardedFraction && $isPositiveOrZero; + break; + + case RoundingMode::FLOOR: + $increment = $hasDiscardedFraction && ! $isPositiveOrZero; + break; + + case RoundingMode::HALF_UP: + $increment = $discardedFractionSign() >= 0; + break; + + case RoundingMode::HALF_DOWN: + $increment = $discardedFractionSign() > 0; + break; + + case RoundingMode::HALF_CEILING: + $increment = $isPositiveOrZero ? $discardedFractionSign() >= 0 : $discardedFractionSign() > 0; + break; + + case RoundingMode::HALF_FLOOR: + $increment = $isPositiveOrZero ? $discardedFractionSign() > 0 : $discardedFractionSign() >= 0; + break; + + case RoundingMode::HALF_EVEN: + $lastDigit = (int) $quotient[-1]; + $lastDigitIsEven = ($lastDigit % 2 === 0); + $increment = $lastDigitIsEven ? $discardedFractionSign() > 0 : $discardedFractionSign() >= 0; + break; + + default: + throw new \InvalidArgumentException('Invalid rounding mode.'); + } + + if ($increment) { + return $this->add($quotient, $isPositiveOrZero ? '1' : '-1'); + } + + return $quotient; + } + + /** + * Calculates bitwise AND of two numbers. + * + * This method can be overridden by the concrete implementation if the underlying library + * has built-in support for bitwise operations. + */ + public function and(string $a, string $b) : string + { + return $this->bitwise('and', $a, $b); + } + + /** + * Calculates bitwise OR of two numbers. + * + * This method can be overridden by the concrete implementation if the underlying library + * has built-in support for bitwise operations. + */ + public function or(string $a, string $b) : string + { + return $this->bitwise('or', $a, $b); + } + + /** + * Calculates bitwise XOR of two numbers. + * + * This method can be overridden by the concrete implementation if the underlying library + * has built-in support for bitwise operations. + */ + public function xor(string $a, string $b) : string + { + return $this->bitwise('xor', $a, $b); + } + + /** + * Performs a bitwise operation on a decimal number. + * + * @param 'and'|'or'|'xor' $operator The operator to use. + * @param string $a The left operand. + * @param string $b The right operand. + */ + private function bitwise(string $operator, string $a, string $b) : string + { + [$aNeg, $bNeg, $aDig, $bDig] = $this->init($a, $b); + + $aBin = $this->toBinary($aDig); + $bBin = $this->toBinary($bDig); + + $aLen = \strlen($aBin); + $bLen = \strlen($bBin); + + if ($aLen > $bLen) { + $bBin = \str_repeat("\x00", $aLen - $bLen) . $bBin; + } elseif ($bLen > $aLen) { + $aBin = \str_repeat("\x00", $bLen - $aLen) . $aBin; + } + + if ($aNeg) { + $aBin = $this->twosComplement($aBin); + } + if ($bNeg) { + $bBin = $this->twosComplement($bBin); + } + + $value = match ($operator) { + 'and' => $aBin & $bBin, + 'or' => $aBin | $bBin, + 'xor' => $aBin ^ $bBin, + }; + + $negative = match ($operator) { + 'and' => $aNeg and $bNeg, + 'or' => $aNeg or $bNeg, + 'xor' => $aNeg xor $bNeg, + }; + + if ($negative) { + $value = $this->twosComplement($value); + } + + $result = $this->toDecimal($value); + + return $negative ? $this->neg($result) : $result; + } + + /** + * @param string $number A positive, binary number. + */ + private function twosComplement(string $number) : string + { + $xor = \str_repeat("\xff", \strlen($number)); + + $number ^= $xor; + + for ($i = \strlen($number) - 1; $i >= 0; $i--) { + $byte = \ord($number[$i]); + + if (++$byte !== 256) { + $number[$i] = \chr($byte); + break; + } + + $number[$i] = "\x00"; + + if ($i === 0) { + $number = "\x01" . $number; + } + } + + return $number; + } + + /** + * Converts a decimal number to a binary string. + * + * @param string $number The number to convert, positive or zero, only digits. + */ + private function toBinary(string $number) : string + { + $result = ''; + + while ($number !== '0') { + [$number, $remainder] = $this->divQR($number, '256'); + $result .= \chr((int) $remainder); + } + + return \strrev($result); + } + + /** + * Returns the positive decimal representation of a binary number. + * + * @param string $bytes The bytes representing the number. + */ + private function toDecimal(string $bytes) : string + { + $result = '0'; + $power = '1'; + + for ($i = \strlen($bytes) - 1; $i >= 0; $i--) { + $index = \ord($bytes[$i]); + + if ($index !== 0) { + $result = $this->add($result, ($index === 1) + ? $power + : $this->mul($power, (string) $index) + ); + } + + if ($i !== 0) { + $power = $this->mul($power, '256'); + } + } + + return $result; + } +} diff --git a/vendor/brick/math/src/Internal/Calculator/BcMathCalculator.php b/vendor/brick/math/src/Internal/Calculator/BcMathCalculator.php new file mode 100644 index 00000000..067085e2 --- /dev/null +++ b/vendor/brick/math/src/Internal/Calculator/BcMathCalculator.php @@ -0,0 +1,65 @@ +maxDigits = match (PHP_INT_SIZE) { + 4 => 9, + 8 => 18, + default => throw new \RuntimeException('The platform is not 32-bit or 64-bit as expected.') + }; + } + + public function add(string $a, string $b) : string + { + /** + * @psalm-var numeric-string $a + * @psalm-var numeric-string $b + */ + $result = $a + $b; + + if (is_int($result)) { + return (string) $result; + } + + if ($a === '0') { + return $b; + } + + if ($b === '0') { + return $a; + } + + [$aNeg, $bNeg, $aDig, $bDig] = $this->init($a, $b); + + $result = $aNeg === $bNeg ? $this->doAdd($aDig, $bDig) : $this->doSub($aDig, $bDig); + + if ($aNeg) { + $result = $this->neg($result); + } + + return $result; + } + + public function sub(string $a, string $b) : string + { + return $this->add($a, $this->neg($b)); + } + + public function mul(string $a, string $b) : string + { + /** + * @psalm-var numeric-string $a + * @psalm-var numeric-string $b + */ + $result = $a * $b; + + if (is_int($result)) { + return (string) $result; + } + + if ($a === '0' || $b === '0') { + return '0'; + } + + if ($a === '1') { + return $b; + } + + if ($b === '1') { + return $a; + } + + if ($a === '-1') { + return $this->neg($b); + } + + if ($b === '-1') { + return $this->neg($a); + } + + [$aNeg, $bNeg, $aDig, $bDig] = $this->init($a, $b); + + $result = $this->doMul($aDig, $bDig); + + if ($aNeg !== $bNeg) { + $result = $this->neg($result); + } + + return $result; + } + + public function divQ(string $a, string $b) : string + { + return $this->divQR($a, $b)[0]; + } + + public function divR(string $a, string $b): string + { + return $this->divQR($a, $b)[1]; + } + + public function divQR(string $a, string $b) : array + { + if ($a === '0') { + return ['0', '0']; + } + + if ($a === $b) { + return ['1', '0']; + } + + if ($b === '1') { + return [$a, '0']; + } + + if ($b === '-1') { + return [$this->neg($a), '0']; + } + + /** @psalm-var numeric-string $a */ + $na = $a * 1; // cast to number + + if (is_int($na)) { + /** @psalm-var numeric-string $b */ + $nb = $b * 1; + + if (is_int($nb)) { + // the only division that may overflow is PHP_INT_MIN / -1, + // which cannot happen here as we've already handled a divisor of -1 above. + $q = intdiv($na, $nb); + $r = $na % $nb; + + return [ + (string) $q, + (string) $r + ]; + } + } + + [$aNeg, $bNeg, $aDig, $bDig] = $this->init($a, $b); + + [$q, $r] = $this->doDiv($aDig, $bDig); + + if ($aNeg !== $bNeg) { + $q = $this->neg($q); + } + + if ($aNeg) { + $r = $this->neg($r); + } + + return [$q, $r]; + } + + public function pow(string $a, int $e) : string + { + if ($e === 0) { + return '1'; + } + + if ($e === 1) { + return $a; + } + + $odd = $e % 2; + $e -= $odd; + + $aa = $this->mul($a, $a); + + /** @psalm-suppress PossiblyInvalidArgument We're sure that $e / 2 is an int now */ + $result = $this->pow($aa, $e / 2); + + if ($odd === 1) { + $result = $this->mul($result, $a); + } + + return $result; + } + + /** + * Algorithm from: https://www.geeksforgeeks.org/modular-exponentiation-power-in-modular-arithmetic/ + */ + public function modPow(string $base, string $exp, string $mod) : string + { + // special case: the algorithm below fails with 0 power 0 mod 1 (returns 1 instead of 0) + if ($base === '0' && $exp === '0' && $mod === '1') { + return '0'; + } + + // special case: the algorithm below fails with power 0 mod 1 (returns 1 instead of 0) + if ($exp === '0' && $mod === '1') { + return '0'; + } + + $x = $base; + + $res = '1'; + + // numbers are positive, so we can use remainder instead of modulo + $x = $this->divR($x, $mod); + + while ($exp !== '0') { + if (in_array($exp[-1], ['1', '3', '5', '7', '9'])) { // odd + $res = $this->divR($this->mul($res, $x), $mod); + } + + $exp = $this->divQ($exp, '2'); + $x = $this->divR($this->mul($x, $x), $mod); + } + + return $res; + } + + /** + * Adapted from https://cp-algorithms.com/num_methods/roots_newton.html + */ + public function sqrt(string $n) : string + { + if ($n === '0') { + return '0'; + } + + // initial approximation + $x = \str_repeat('9', \intdiv(\strlen($n), 2) ?: 1); + + $decreased = false; + + for (;;) { + $nx = $this->divQ($this->add($x, $this->divQ($n, $x)), '2'); + + if ($x === $nx || $this->cmp($nx, $x) > 0 && $decreased) { + break; + } + + $decreased = $this->cmp($nx, $x) < 0; + $x = $nx; + } + + return $x; + } + + /** + * Performs the addition of two non-signed large integers. + */ + private function doAdd(string $a, string $b) : string + { + [$a, $b, $length] = $this->pad($a, $b); + + $carry = 0; + $result = ''; + + for ($i = $length - $this->maxDigits;; $i -= $this->maxDigits) { + $blockLength = $this->maxDigits; + + if ($i < 0) { + $blockLength += $i; + /** @psalm-suppress LoopInvalidation */ + $i = 0; + } + + /** @psalm-var numeric-string $blockA */ + $blockA = \substr($a, $i, $blockLength); + + /** @psalm-var numeric-string $blockB */ + $blockB = \substr($b, $i, $blockLength); + + $sum = (string) ($blockA + $blockB + $carry); + $sumLength = \strlen($sum); + + if ($sumLength > $blockLength) { + $sum = \substr($sum, 1); + $carry = 1; + } else { + if ($sumLength < $blockLength) { + $sum = \str_repeat('0', $blockLength - $sumLength) . $sum; + } + $carry = 0; + } + + $result = $sum . $result; + + if ($i === 0) { + break; + } + } + + if ($carry === 1) { + $result = '1' . $result; + } + + return $result; + } + + /** + * Performs the subtraction of two non-signed large integers. + */ + private function doSub(string $a, string $b) : string + { + if ($a === $b) { + return '0'; + } + + // Ensure that we always subtract to a positive result: biggest minus smallest. + $cmp = $this->doCmp($a, $b); + + $invert = ($cmp === -1); + + if ($invert) { + $c = $a; + $a = $b; + $b = $c; + } + + [$a, $b, $length] = $this->pad($a, $b); + + $carry = 0; + $result = ''; + + $complement = 10 ** $this->maxDigits; + + for ($i = $length - $this->maxDigits;; $i -= $this->maxDigits) { + $blockLength = $this->maxDigits; + + if ($i < 0) { + $blockLength += $i; + /** @psalm-suppress LoopInvalidation */ + $i = 0; + } + + /** @psalm-var numeric-string $blockA */ + $blockA = \substr($a, $i, $blockLength); + + /** @psalm-var numeric-string $blockB */ + $blockB = \substr($b, $i, $blockLength); + + $sum = $blockA - $blockB - $carry; + + if ($sum < 0) { + $sum += $complement; + $carry = 1; + } else { + $carry = 0; + } + + $sum = (string) $sum; + $sumLength = \strlen($sum); + + if ($sumLength < $blockLength) { + $sum = \str_repeat('0', $blockLength - $sumLength) . $sum; + } + + $result = $sum . $result; + + if ($i === 0) { + break; + } + } + + // Carry cannot be 1 when the loop ends, as a > b + assert($carry === 0); + + $result = \ltrim($result, '0'); + + if ($invert) { + $result = $this->neg($result); + } + + return $result; + } + + /** + * Performs the multiplication of two non-signed large integers. + */ + private function doMul(string $a, string $b) : string + { + $x = \strlen($a); + $y = \strlen($b); + + $maxDigits = \intdiv($this->maxDigits, 2); + $complement = 10 ** $maxDigits; + + $result = '0'; + + for ($i = $x - $maxDigits;; $i -= $maxDigits) { + $blockALength = $maxDigits; + + if ($i < 0) { + $blockALength += $i; + /** @psalm-suppress LoopInvalidation */ + $i = 0; + } + + $blockA = (int) \substr($a, $i, $blockALength); + + $line = ''; + $carry = 0; + + for ($j = $y - $maxDigits;; $j -= $maxDigits) { + $blockBLength = $maxDigits; + + if ($j < 0) { + $blockBLength += $j; + /** @psalm-suppress LoopInvalidation */ + $j = 0; + } + + $blockB = (int) \substr($b, $j, $blockBLength); + + $mul = $blockA * $blockB + $carry; + $value = $mul % $complement; + $carry = ($mul - $value) / $complement; + + $value = (string) $value; + $value = \str_pad($value, $maxDigits, '0', STR_PAD_LEFT); + + $line = $value . $line; + + if ($j === 0) { + break; + } + } + + if ($carry !== 0) { + $line = $carry . $line; + } + + $line = \ltrim($line, '0'); + + if ($line !== '') { + $line .= \str_repeat('0', $x - $blockALength - $i); + $result = $this->add($result, $line); + } + + if ($i === 0) { + break; + } + } + + return $result; + } + + /** + * Performs the division of two non-signed large integers. + * + * @return string[] The quotient and remainder. + */ + private function doDiv(string $a, string $b) : array + { + $cmp = $this->doCmp($a, $b); + + if ($cmp === -1) { + return ['0', $a]; + } + + $x = \strlen($a); + $y = \strlen($b); + + // we now know that a >= b && x >= y + + $q = '0'; // quotient + $r = $a; // remainder + $z = $y; // focus length, always $y or $y+1 + + for (;;) { + $focus = \substr($a, 0, $z); + + $cmp = $this->doCmp($focus, $b); + + if ($cmp === -1) { + if ($z === $x) { // remainder < dividend + break; + } + + $z++; + } + + $zeros = \str_repeat('0', $x - $z); + + $q = $this->add($q, '1' . $zeros); + $a = $this->sub($a, $b . $zeros); + + $r = $a; + + if ($r === '0') { // remainder == 0 + break; + } + + $x = \strlen($a); + + if ($x < $y) { // remainder < dividend + break; + } + + $z = $y; + } + + return [$q, $r]; + } + + /** + * Compares two non-signed large numbers. + * + * @psalm-return -1|0|1 + */ + private function doCmp(string $a, string $b) : int + { + $x = \strlen($a); + $y = \strlen($b); + + $cmp = $x <=> $y; + + if ($cmp !== 0) { + return $cmp; + } + + return \strcmp($a, $b) <=> 0; // enforce -1|0|1 + } + + /** + * Pads the left of one of the given numbers with zeros if necessary to make both numbers the same length. + * + * The numbers must only consist of digits, without leading minus sign. + * + * @return array{string, string, int} + */ + private function pad(string $a, string $b) : array + { + $x = \strlen($a); + $y = \strlen($b); + + if ($x > $y) { + $b = \str_repeat('0', $x - $y) . $b; + + return [$a, $b, $x]; + } + + if ($x < $y) { + $a = \str_repeat('0', $y - $x) . $a; + + return [$a, $b, $y]; + } + + return [$a, $b, $x]; + } +} diff --git a/vendor/brick/math/src/RoundingMode.php b/vendor/brick/math/src/RoundingMode.php new file mode 100644 index 00000000..e8ee6a8b --- /dev/null +++ b/vendor/brick/math/src/RoundingMode.php @@ -0,0 +1,98 @@ += 0.5; otherwise, behaves as for DOWN. + * Note that this is the rounding mode commonly taught at school. + */ + case HALF_UP; + + /** + * Rounds towards "nearest neighbor" unless both neighbors are equidistant, in which case round down. + * + * Behaves as for UP if the discarded fraction is > 0.5; otherwise, behaves as for DOWN. + */ + case HALF_DOWN; + + /** + * Rounds towards "nearest neighbor" unless both neighbors are equidistant, in which case round towards positive infinity. + * + * If the result is positive, behaves as for HALF_UP; if negative, behaves as for HALF_DOWN. + */ + case HALF_CEILING; + + /** + * Rounds towards "nearest neighbor" unless both neighbors are equidistant, in which case round towards negative infinity. + * + * If the result is positive, behaves as for HALF_DOWN; if negative, behaves as for HALF_UP. + */ + case HALF_FLOOR; + + /** + * Rounds towards the "nearest neighbor" unless both neighbors are equidistant, in which case rounds towards the even neighbor. + * + * Behaves as for HALF_UP if the digit to the left of the discarded fraction is odd; + * behaves as for HALF_DOWN if it's even. + * + * Note that this is the rounding mode that statistically minimizes + * cumulative error when applied repeatedly over a sequence of calculations. + * It is sometimes known as "Banker's rounding", and is chiefly used in the USA. + */ + case HALF_EVEN; +} diff --git a/vendor/carbonphp/carbon-doctrine-types/LICENSE b/vendor/carbonphp/carbon-doctrine-types/LICENSE new file mode 100644 index 00000000..2ee1671d --- /dev/null +++ b/vendor/carbonphp/carbon-doctrine-types/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Carbon + +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/vendor/carbonphp/carbon-doctrine-types/README.md b/vendor/carbonphp/carbon-doctrine-types/README.md new file mode 100644 index 00000000..5a18121b --- /dev/null +++ b/vendor/carbonphp/carbon-doctrine-types/README.md @@ -0,0 +1,14 @@ +# carbonphp/carbon-doctrine-types + +Types to use Carbon in Doctrine + +## Documentation + +[Check how to use in the official Carbon documentation](https://carbon.nesbot.com/symfony/) + +This package is an externalization of [src/Carbon/Doctrine](https://github.com/briannesbitt/Carbon/tree/2.71.0/src/Carbon/Doctrine) +from `nestbot/carbon` package. + +Externalization allows to better deal with different versions of dbal. With +version 4.0 of dbal, it no longer sustainable to be compatible with all version +using a single code. diff --git a/vendor/carbonphp/carbon-doctrine-types/composer.json b/vendor/carbonphp/carbon-doctrine-types/composer.json new file mode 100644 index 00000000..abf45c5f --- /dev/null +++ b/vendor/carbonphp/carbon-doctrine-types/composer.json @@ -0,0 +1,36 @@ +{ + "name": "carbonphp/carbon-doctrine-types", + "description": "Types to use Carbon in Doctrine", + "type": "library", + "keywords": [ + "date", + "time", + "DateTime", + "Carbon", + "Doctrine" + ], + "require": { + "php": "^8.1" + }, + "require-dev": { + "doctrine/dbal": "^4.0.0", + "nesbot/carbon": "^2.71.0 || ^3.0.0", + "phpunit/phpunit": "^10.3" + }, + "conflict": { + "doctrine/dbal": "<4.0.0 || >=5.0.0" + }, + "license": "MIT", + "autoload": { + "psr-4": { + "Carbon\\Doctrine\\": "src/Carbon/Doctrine/" + } + }, + "authors": [ + { + "name": "KyleKatarn", + "email": "kylekatarnls@gmail.com" + } + ], + "minimum-stability": "dev" +} diff --git a/vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/CarbonDoctrineType.php b/vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/CarbonDoctrineType.php new file mode 100644 index 00000000..a63a9b8d --- /dev/null +++ b/vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/CarbonDoctrineType.php @@ -0,0 +1,16 @@ + + */ + protected function getCarbonClassName(): string + { + return Carbon::class; + } + + public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform): string + { + $precision = min( + $fieldDeclaration['precision'] ?? DateTimeDefaultPrecision::get(), + $this->getMaximumPrecision($platform), + ); + + $type = parent::getSQLDeclaration($fieldDeclaration, $platform); + + if (!$precision) { + return $type; + } + + if (str_contains($type, '(')) { + return preg_replace('/\(\d+\)/', "($precision)", $type); + } + + [$before, $after] = explode(' ', "$type "); + + return trim("$before($precision) $after"); + } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function convertToDatabaseValue($value, AbstractPlatform $platform): ?string + { + if ($value === null) { + return $value; + } + + if ($value instanceof DateTimeInterface) { + return $value->format('Y-m-d H:i:s.u'); + } + + throw InvalidType::new( + $value, + static::class, + ['null', 'DateTime', 'Carbon'] + ); + } + + private function doConvertToPHPValue(mixed $value) + { + $class = $this->getCarbonClassName(); + + if ($value === null || is_a($value, $class)) { + return $value; + } + + if ($value instanceof DateTimeInterface) { + return $class::instance($value); + } + + $date = null; + $error = null; + + try { + $date = $class::parse($value); + } catch (Exception $exception) { + $error = $exception; + } + + if (!$date) { + throw ValueNotConvertible::new( + $value, + static::class, + 'Y-m-d H:i:s.u or any format supported by '.$class.'::parse()', + $error + ); + } + + return $date; + } + + private function getMaximumPrecision(AbstractPlatform $platform): int + { + if ($platform instanceof DB2Platform) { + return 12; + } + + if ($platform instanceof OraclePlatform) { + return 9; + } + + if ($platform instanceof SQLServerPlatform || $platform instanceof SQLitePlatform) { + return 3; + } + + return 6; + } +} diff --git a/vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/DateTimeDefaultPrecision.php b/vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/DateTimeDefaultPrecision.php new file mode 100644 index 00000000..cd9896f9 --- /dev/null +++ b/vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/DateTimeDefaultPrecision.php @@ -0,0 +1,30 @@ + */ + use CarbonTypeConverter; + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function convertToPHPValue(mixed $value, AbstractPlatform $platform): ?CarbonImmutable + { + return $this->doConvertToPHPValue($value); + } + + /** + * @return class-string + */ + protected function getCarbonClassName(): string + { + return CarbonImmutable::class; + } +} diff --git a/vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/DateTimeType.php b/vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/DateTimeType.php new file mode 100644 index 00000000..89e4b790 --- /dev/null +++ b/vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/DateTimeType.php @@ -0,0 +1,24 @@ + */ + use CarbonTypeConverter; + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function convertToPHPValue(mixed $value, AbstractPlatform $platform): ?Carbon + { + return $this->doConvertToPHPValue($value); + } +} diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php new file mode 100644 index 00000000..7824d8f7 --- /dev/null +++ b/vendor/composer/ClassLoader.php @@ -0,0 +1,579 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + /** @var \Closure(string):void */ + private static $includeFile; + + /** @var string|null */ + private $vendorDir; + + // PSR-4 + /** + * @var array> + */ + private $prefixLengthsPsr4 = array(); + /** + * @var array> + */ + private $prefixDirsPsr4 = array(); + /** + * @var list + */ + private $fallbackDirsPsr4 = array(); + + // PSR-0 + /** + * List of PSR-0 prefixes + * + * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) + * + * @var array>> + */ + private $prefixesPsr0 = array(); + /** + * @var list + */ + private $fallbackDirsPsr0 = array(); + + /** @var bool */ + private $useIncludePath = false; + + /** + * @var array + */ + private $classMap = array(); + + /** @var bool */ + private $classMapAuthoritative = false; + + /** + * @var array + */ + private $missingClasses = array(); + + /** @var string|null */ + private $apcuPrefix; + + /** + * @var array + */ + private static $registeredLoaders = array(); + + /** + * @param string|null $vendorDir + */ + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + self::initializeIncludeClosure(); + } + + /** + * @return array> + */ + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); + } + + return array(); + } + + /** + * @return array> + */ + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + /** + * @return list + */ + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + /** + * @return list + */ + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + /** + * @return array Array of classname => path + */ + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + * + * @return void + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + * + * @return void + */ + public function add($prefix, $paths, $prepend = false) + { + $paths = (array) $paths; + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + $paths = (array) $paths; + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 base directories + * + * @return void + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + * + * @return void + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + * + * @return void + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + * + * @return void + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + * + * @return void + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + + if (null === $this->vendorDir) { + return; + } + + if ($prepend) { + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; + } else { + unset(self::$registeredLoaders[$this->vendorDir]); + self::$registeredLoaders[$this->vendorDir] = $this; + } + } + + /** + * Unregisters this instance as an autoloader. + * + * @return void + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return true|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + $includeFile = self::$includeFile; + $includeFile($file); + + return true; + } + + return null; + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + /** + * Returns the currently registered loaders keyed by their corresponding vendor directories. + * + * @return array + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + + /** + * @param string $class + * @param string $ext + * @return string|false + */ + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } + + /** + * @return void + */ + private static function initializeIncludeClosure() + { + if (self::$includeFile !== null) { + return; + } + + /** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + */ + self::$includeFile = \Closure::bind(static function($file) { + include $file; + }, null, null); + } +} diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php new file mode 100644 index 00000000..51e734a7 --- /dev/null +++ b/vendor/composer/InstalledVersions.php @@ -0,0 +1,359 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer; + +use Composer\Autoload\ClassLoader; +use Composer\Semver\VersionParser; + +/** + * This class is copied in every Composer installed project and available to all + * + * See also https://getcomposer.org/doc/07-runtime.md#installed-versions + * + * To require its presence, you can require `composer-runtime-api ^2.0` + * + * @final + */ +class InstalledVersions +{ + /** + * @var mixed[]|null + * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null + */ + private static $installed; + + /** + * @var bool|null + */ + private static $canGetVendors; + + /** + * @var array[] + * @psalm-var array}> + */ + private static $installedByVendor = array(); + + /** + * Returns a list of all package names which are present, either by being installed, replaced or provided + * + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackages() + { + $packages = array(); + foreach (self::getInstalled() as $installed) { + $packages[] = array_keys($installed['versions']); + } + + if (1 === \count($packages)) { + return $packages[0]; + } + + return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); + } + + /** + * Returns a list of all package names with a specific type e.g. 'library' + * + * @param string $type + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackagesByType($type) + { + $packagesByType = array(); + + foreach (self::getInstalled() as $installed) { + foreach ($installed['versions'] as $name => $package) { + if (isset($package['type']) && $package['type'] === $type) { + $packagesByType[] = $name; + } + } + } + + return $packagesByType; + } + + /** + * Checks whether the given package is installed + * + * This also returns true if the package name is provided or replaced by another package + * + * @param string $packageName + * @param bool $includeDevRequirements + * @return bool + */ + public static function isInstalled($packageName, $includeDevRequirements = true) + { + foreach (self::getInstalled() as $installed) { + if (isset($installed['versions'][$packageName])) { + return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; + } + } + + return false; + } + + /** + * Checks whether the given package satisfies a version constraint + * + * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: + * + * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') + * + * @param VersionParser $parser Install composer/semver to have access to this class and functionality + * @param string $packageName + * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package + * @return bool + */ + public static function satisfies(VersionParser $parser, $packageName, $constraint) + { + $constraint = $parser->parseConstraints((string) $constraint); + $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); + + return $provided->matches($constraint); + } + + /** + * Returns a version constraint representing all the range(s) which are installed for a given package + * + * It is easier to use this via isInstalled() with the $constraint argument if you need to check + * whether a given version of a package is installed, and not just whether it exists + * + * @param string $packageName + * @return string Version constraint usable with composer/semver + */ + public static function getVersionRanges($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + $ranges = array(); + if (isset($installed['versions'][$packageName]['pretty_version'])) { + $ranges[] = $installed['versions'][$packageName]['pretty_version']; + } + if (array_key_exists('aliases', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); + } + if (array_key_exists('replaced', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); + } + if (array_key_exists('provided', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); + } + + return implode(' || ', $ranges); + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['version'])) { + return null; + } + + return $installed['versions'][$packageName]['version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getPrettyVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['pretty_version'])) { + return null; + } + + return $installed['versions'][$packageName]['pretty_version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference + */ + public static function getReference($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['reference'])) { + return null; + } + + return $installed['versions'][$packageName]['reference']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. + */ + public static function getInstallPath($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @return array + * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} + */ + public static function getRootPackage() + { + $installed = self::getInstalled(); + + return $installed[0]['root']; + } + + /** + * Returns the raw installed.php data for custom implementations + * + * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. + * @return array[] + * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} + */ + public static function getRawData() + { + @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + self::$installed = include __DIR__ . '/installed.php'; + } else { + self::$installed = array(); + } + } + + return self::$installed; + } + + /** + * Returns the raw data of all installed.php which are currently loaded for custom implementations + * + * @return array[] + * @psalm-return list}> + */ + public static function getAllRawData() + { + return self::getInstalled(); + } + + /** + * Lets you reload the static array from another file + * + * This is only useful for complex integrations in which a project needs to use + * this class but then also needs to execute another project's autoloader in process, + * and wants to ensure both projects have access to their version of installed.php. + * + * A typical case would be PHPUnit, where it would need to make sure it reads all + * the data it needs from this class, then call reload() with + * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure + * the project in which it runs can then also use this class safely, without + * interference between PHPUnit's dependencies and the project's dependencies. + * + * @param array[] $data A vendor/composer/installed.php data set + * @return void + * + * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $data + */ + public static function reload($data) + { + self::$installed = $data; + self::$installedByVendor = array(); + } + + /** + * @return array[] + * @psalm-return list}> + */ + private static function getInstalled() + { + if (null === self::$canGetVendors) { + self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); + } + + $installed = array(); + + if (self::$canGetVendors) { + foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { + if (isset(self::$installedByVendor[$vendorDir])) { + $installed[] = self::$installedByVendor[$vendorDir]; + } elseif (is_file($vendorDir.'/composer/installed.php')) { + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require $vendorDir.'/composer/installed.php'; + $installed[] = self::$installedByVendor[$vendorDir] = $required; + if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { + self::$installed = $installed[count($installed) - 1]; + } + } + } + } + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require __DIR__ . '/installed.php'; + self::$installed = $required; + } else { + self::$installed = array(); + } + } + + if (self::$installed !== array()) { + $installed[] = self::$installed; + } + + return $installed; + } +} diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE new file mode 100644 index 00000000..f27399a0 --- /dev/null +++ b/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) Nils Adermann, Jordi Boggiano + +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/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php new file mode 100644 index 00000000..b2d3b2ef --- /dev/null +++ b/vendor/composer/autoload_classmap.php @@ -0,0 +1,1291 @@ + $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php', + 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', + 'DateError' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateError.php', + 'DateException' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateException.php', + 'DateInvalidOperationException' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateInvalidOperationException.php', + 'DateInvalidTimeZoneException' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateInvalidTimeZoneException.php', + 'DateMalformedIntervalStringException' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateMalformedIntervalStringException.php', + 'DateMalformedPeriodStringException' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateMalformedPeriodStringException.php', + 'DateMalformedStringException' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateMalformedStringException.php', + 'DateObjectError' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateObjectError.php', + 'DateRangeError' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/DateRangeError.php', + 'JsonException' => $vendorDir . '/symfony/polyfill-php73/Resources/stubs/JsonException.php', + 'Nette\\ArgumentOutOfRangeException' => $vendorDir . '/nette/utils/src/exceptions.php', + 'Nette\\DeprecatedException' => $vendorDir . '/nette/utils/src/exceptions.php', + 'Nette\\DirectoryNotFoundException' => $vendorDir . '/nette/utils/src/exceptions.php', + 'Nette\\FileNotFoundException' => $vendorDir . '/nette/utils/src/exceptions.php', + 'Nette\\HtmlStringable' => $vendorDir . '/nette/utils/src/HtmlStringable.php', + 'Nette\\IOException' => $vendorDir . '/nette/utils/src/exceptions.php', + 'Nette\\InvalidArgumentException' => $vendorDir . '/nette/utils/src/exceptions.php', + 'Nette\\InvalidStateException' => $vendorDir . '/nette/utils/src/exceptions.php', + 'Nette\\Iterators\\CachingIterator' => $vendorDir . '/nette/utils/src/Iterators/CachingIterator.php', + 'Nette\\Iterators\\Mapper' => $vendorDir . '/nette/utils/src/Iterators/Mapper.php', + 'Nette\\Localization\\ITranslator' => $vendorDir . '/nette/utils/src/compatibility.php', + 'Nette\\Localization\\Translator' => $vendorDir . '/nette/utils/src/Translator.php', + 'Nette\\MemberAccessException' => $vendorDir . '/nette/utils/src/exceptions.php', + 'Nette\\NotImplementedException' => $vendorDir . '/nette/utils/src/exceptions.php', + 'Nette\\NotSupportedException' => $vendorDir . '/nette/utils/src/exceptions.php', + 'Nette\\OutOfRangeException' => $vendorDir . '/nette/utils/src/exceptions.php', + 'Nette\\Schema\\Context' => $vendorDir . '/nette/schema/src/Schema/Context.php', + 'Nette\\Schema\\DynamicParameter' => $vendorDir . '/nette/schema/src/Schema/DynamicParameter.php', + 'Nette\\Schema\\Elements\\AnyOf' => $vendorDir . '/nette/schema/src/Schema/Elements/AnyOf.php', + 'Nette\\Schema\\Elements\\Base' => $vendorDir . '/nette/schema/src/Schema/Elements/Base.php', + 'Nette\\Schema\\Elements\\Structure' => $vendorDir . '/nette/schema/src/Schema/Elements/Structure.php', + 'Nette\\Schema\\Elements\\Type' => $vendorDir . '/nette/schema/src/Schema/Elements/Type.php', + 'Nette\\Schema\\Expect' => $vendorDir . '/nette/schema/src/Schema/Expect.php', + 'Nette\\Schema\\Helpers' => $vendorDir . '/nette/schema/src/Schema/Helpers.php', + 'Nette\\Schema\\Message' => $vendorDir . '/nette/schema/src/Schema/Message.php', + 'Nette\\Schema\\Processor' => $vendorDir . '/nette/schema/src/Schema/Processor.php', + 'Nette\\Schema\\Schema' => $vendorDir . '/nette/schema/src/Schema/Schema.php', + 'Nette\\Schema\\ValidationException' => $vendorDir . '/nette/schema/src/Schema/ValidationException.php', + 'Nette\\SmartObject' => $vendorDir . '/nette/utils/src/SmartObject.php', + 'Nette\\StaticClass' => $vendorDir . '/nette/utils/src/StaticClass.php', + 'Nette\\UnexpectedValueException' => $vendorDir . '/nette/utils/src/exceptions.php', + 'Nette\\Utils\\ArrayHash' => $vendorDir . '/nette/utils/src/Utils/ArrayHash.php', + 'Nette\\Utils\\ArrayList' => $vendorDir . '/nette/utils/src/Utils/ArrayList.php', + 'Nette\\Utils\\Arrays' => $vendorDir . '/nette/utils/src/Utils/Arrays.php', + 'Nette\\Utils\\AssertionException' => $vendorDir . '/nette/utils/src/Utils/exceptions.php', + 'Nette\\Utils\\Callback' => $vendorDir . '/nette/utils/src/Utils/Callback.php', + 'Nette\\Utils\\DateTime' => $vendorDir . '/nette/utils/src/Utils/DateTime.php', + 'Nette\\Utils\\FileInfo' => $vendorDir . '/nette/utils/src/Utils/FileInfo.php', + 'Nette\\Utils\\FileSystem' => $vendorDir . '/nette/utils/src/Utils/FileSystem.php', + 'Nette\\Utils\\Finder' => $vendorDir . '/nette/utils/src/Utils/Finder.php', + 'Nette\\Utils\\Floats' => $vendorDir . '/nette/utils/src/Utils/Floats.php', + 'Nette\\Utils\\Helpers' => $vendorDir . '/nette/utils/src/Utils/Helpers.php', + 'Nette\\Utils\\Html' => $vendorDir . '/nette/utils/src/Utils/Html.php', + 'Nette\\Utils\\IHtmlString' => $vendorDir . '/nette/utils/src/compatibility.php', + 'Nette\\Utils\\Image' => $vendorDir . '/nette/utils/src/Utils/Image.php', + 'Nette\\Utils\\ImageColor' => $vendorDir . '/nette/utils/src/Utils/ImageColor.php', + 'Nette\\Utils\\ImageException' => $vendorDir . '/nette/utils/src/Utils/exceptions.php', + 'Nette\\Utils\\ImageType' => $vendorDir . '/nette/utils/src/Utils/ImageType.php', + 'Nette\\Utils\\Iterables' => $vendorDir . '/nette/utils/src/Utils/Iterables.php', + 'Nette\\Utils\\Json' => $vendorDir . '/nette/utils/src/Utils/Json.php', + 'Nette\\Utils\\JsonException' => $vendorDir . '/nette/utils/src/Utils/exceptions.php', + 'Nette\\Utils\\ObjectHelpers' => $vendorDir . '/nette/utils/src/Utils/ObjectHelpers.php', + 'Nette\\Utils\\Paginator' => $vendorDir . '/nette/utils/src/Utils/Paginator.php', + 'Nette\\Utils\\Random' => $vendorDir . '/nette/utils/src/Utils/Random.php', + 'Nette\\Utils\\Reflection' => $vendorDir . '/nette/utils/src/Utils/Reflection.php', + 'Nette\\Utils\\ReflectionMethod' => $vendorDir . '/nette/utils/src/Utils/ReflectionMethod.php', + 'Nette\\Utils\\RegexpException' => $vendorDir . '/nette/utils/src/Utils/exceptions.php', + 'Nette\\Utils\\Strings' => $vendorDir . '/nette/utils/src/Utils/Strings.php', + 'Nette\\Utils\\Type' => $vendorDir . '/nette/utils/src/Utils/Type.php', + 'Nette\\Utils\\UnknownImageFileException' => $vendorDir . '/nette/utils/src/Utils/exceptions.php', + 'Nette\\Utils\\Validators' => $vendorDir . '/nette/utils/src/Utils/Validators.php', + 'Normalizer' => $vendorDir . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php', + 'Override' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/Override.php', + 'PHPCSUtils\\AbstractSniffs\\AbstractArrayDeclarationSniff' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/AbstractSniffs/AbstractArrayDeclarationSniff.php', + 'PHPCSUtils\\BackCompat\\BCFile' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCFile.php', + 'PHPCSUtils\\BackCompat\\BCTokens' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCTokens.php', + 'PHPCSUtils\\BackCompat\\Helper' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/Helper.php', + 'PHPCSUtils\\Exceptions\\InvalidTokenArray' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Exceptions/InvalidTokenArray.php', + 'PHPCSUtils\\Exceptions\\TestFileNotFound' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Exceptions/TestFileNotFound.php', + 'PHPCSUtils\\Exceptions\\TestMarkerNotFound' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Exceptions/TestMarkerNotFound.php', + 'PHPCSUtils\\Exceptions\\TestTargetNotFound' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Exceptions/TestTargetNotFound.php', + 'PHPCSUtils\\Fixers\\SpacesFixer' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Fixers/SpacesFixer.php', + 'PHPCSUtils\\Internal\\Cache' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Internal/Cache.php', + 'PHPCSUtils\\Internal\\IsShortArrayOrList' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Internal/IsShortArrayOrList.php', + 'PHPCSUtils\\Internal\\IsShortArrayOrListWithCache' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Internal/IsShortArrayOrListWithCache.php', + 'PHPCSUtils\\Internal\\NoFileCache' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Internal/NoFileCache.php', + 'PHPCSUtils\\Internal\\StableCollections' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Internal/StableCollections.php', + 'PHPCSUtils\\TestUtils\\UtilityMethodTestCase' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/TestUtils/UtilityMethodTestCase.php', + 'PHPCSUtils\\Tokens\\Collections' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Tokens/Collections.php', + 'PHPCSUtils\\Tokens\\TokenHelper' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Tokens/TokenHelper.php', + 'PHPCSUtils\\Utils\\Arrays' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Arrays.php', + 'PHPCSUtils\\Utils\\Conditions' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Conditions.php', + 'PHPCSUtils\\Utils\\Context' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Context.php', + 'PHPCSUtils\\Utils\\ControlStructures' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/ControlStructures.php', + 'PHPCSUtils\\Utils\\FunctionDeclarations' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/FunctionDeclarations.php', + 'PHPCSUtils\\Utils\\GetTokensAsString' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/GetTokensAsString.php', + 'PHPCSUtils\\Utils\\Lists' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Lists.php', + 'PHPCSUtils\\Utils\\MessageHelper' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/MessageHelper.php', + 'PHPCSUtils\\Utils\\Namespaces' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Namespaces.php', + 'PHPCSUtils\\Utils\\NamingConventions' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/NamingConventions.php', + 'PHPCSUtils\\Utils\\Numbers' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Numbers.php', + 'PHPCSUtils\\Utils\\ObjectDeclarations' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/ObjectDeclarations.php', + 'PHPCSUtils\\Utils\\Operators' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Operators.php', + 'PHPCSUtils\\Utils\\Orthography' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Orthography.php', + 'PHPCSUtils\\Utils\\Parentheses' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Parentheses.php', + 'PHPCSUtils\\Utils\\PassedParameters' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/PassedParameters.php', + 'PHPCSUtils\\Utils\\Scopes' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Scopes.php', + 'PHPCSUtils\\Utils\\TextStrings' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/TextStrings.php', + 'PHPCSUtils\\Utils\\UseStatements' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/UseStatements.php', + 'PHPCSUtils\\Utils\\Variables' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Variables.php', + 'PHPUnit\\Event\\Application\\Finished' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Application/Finished.php', + 'PHPUnit\\Event\\Application\\FinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Application/FinishedSubscriber.php', + 'PHPUnit\\Event\\Application\\Started' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Application/Started.php', + 'PHPUnit\\Event\\Application\\StartedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Application/StartedSubscriber.php', + 'PHPUnit\\Event\\Code\\ClassMethod' => $vendorDir . '/phpunit/phpunit/src/Event/Value/ClassMethod.php', + 'PHPUnit\\Event\\Code\\ComparisonFailure' => $vendorDir . '/phpunit/phpunit/src/Event/Value/ComparisonFailure.php', + 'PHPUnit\\Event\\Code\\ComparisonFailureBuilder' => $vendorDir . '/phpunit/phpunit/src/Event/Value/ComparisonFailureBuilder.php', + 'PHPUnit\\Event\\Code\\NoTestCaseObjectOnCallStackException' => $vendorDir . '/phpunit/phpunit/src/Event/Exception/NoTestCaseObjectOnCallStackException.php', + 'PHPUnit\\Event\\Code\\Phpt' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Test/Phpt.php', + 'PHPUnit\\Event\\Code\\Test' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Test/Test.php', + 'PHPUnit\\Event\\Code\\TestCollection' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Test/TestCollection.php', + 'PHPUnit\\Event\\Code\\TestCollectionIterator' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Test/TestCollectionIterator.php', + 'PHPUnit\\Event\\Code\\TestDox' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Test/TestDox.php', + 'PHPUnit\\Event\\Code\\TestDoxBuilder' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Test/TestDoxBuilder.php', + 'PHPUnit\\Event\\Code\\TestMethod' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Test/TestMethod.php', + 'PHPUnit\\Event\\Code\\TestMethodBuilder' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Test/TestMethodBuilder.php', + 'PHPUnit\\Event\\Code\\Throwable' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Throwable.php', + 'PHPUnit\\Event\\Code\\ThrowableBuilder' => $vendorDir . '/phpunit/phpunit/src/Event/Value/ThrowableBuilder.php', + 'PHPUnit\\Event\\CollectingDispatcher' => $vendorDir . '/phpunit/phpunit/src/Event/Dispatcher/CollectingDispatcher.php', + 'PHPUnit\\Event\\DeferringDispatcher' => $vendorDir . '/phpunit/phpunit/src/Event/Dispatcher/DeferringDispatcher.php', + 'PHPUnit\\Event\\DirectDispatcher' => $vendorDir . '/phpunit/phpunit/src/Event/Dispatcher/DirectDispatcher.php', + 'PHPUnit\\Event\\Dispatcher' => $vendorDir . '/phpunit/phpunit/src/Event/Dispatcher/Dispatcher.php', + 'PHPUnit\\Event\\DispatchingEmitter' => $vendorDir . '/phpunit/phpunit/src/Event/Emitter/DispatchingEmitter.php', + 'PHPUnit\\Event\\Emitter' => $vendorDir . '/phpunit/phpunit/src/Event/Emitter/Emitter.php', + 'PHPUnit\\Event\\Event' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Event.php', + 'PHPUnit\\Event\\EventAlreadyAssignedException' => $vendorDir . '/phpunit/phpunit/src/Event/Exception/EventAlreadyAssignedException.php', + 'PHPUnit\\Event\\EventCollection' => $vendorDir . '/phpunit/phpunit/src/Event/Events/EventCollection.php', + 'PHPUnit\\Event\\EventCollectionIterator' => $vendorDir . '/phpunit/phpunit/src/Event/Events/EventCollectionIterator.php', + 'PHPUnit\\Event\\EventFacadeIsSealedException' => $vendorDir . '/phpunit/phpunit/src/Event/Exception/EventFacadeIsSealedException.php', + 'PHPUnit\\Event\\Exception' => $vendorDir . '/phpunit/phpunit/src/Event/Exception/Exception.php', + 'PHPUnit\\Event\\Facade' => $vendorDir . '/phpunit/phpunit/src/Event/Facade.php', + 'PHPUnit\\Event\\InvalidArgumentException' => $vendorDir . '/phpunit/phpunit/src/Event/Exception/InvalidArgumentException.php', + 'PHPUnit\\Event\\InvalidEventException' => $vendorDir . '/phpunit/phpunit/src/Event/Exception/InvalidEventException.php', + 'PHPUnit\\Event\\InvalidSubscriberException' => $vendorDir . '/phpunit/phpunit/src/Event/Exception/InvalidSubscriberException.php', + 'PHPUnit\\Event\\MapError' => $vendorDir . '/phpunit/phpunit/src/Event/Exception/MapError.php', + 'PHPUnit\\Event\\NoPreviousThrowableException' => $vendorDir . '/phpunit/phpunit/src/Event/Exception/NoPreviousThrowableException.php', + 'PHPUnit\\Event\\RuntimeException' => $vendorDir . '/phpunit/phpunit/src/Event/Exception/RuntimeException.php', + 'PHPUnit\\Event\\Runtime\\OperatingSystem' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Runtime/OperatingSystem.php', + 'PHPUnit\\Event\\Runtime\\PHP' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Runtime/PHP.php', + 'PHPUnit\\Event\\Runtime\\PHPUnit' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Runtime/PHPUnit.php', + 'PHPUnit\\Event\\Runtime\\Runtime' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Runtime/Runtime.php', + 'PHPUnit\\Event\\SubscribableDispatcher' => $vendorDir . '/phpunit/phpunit/src/Event/Dispatcher/SubscribableDispatcher.php', + 'PHPUnit\\Event\\Subscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Subscriber.php', + 'PHPUnit\\Event\\SubscriberTypeAlreadyRegisteredException' => $vendorDir . '/phpunit/phpunit/src/Event/Exception/SubscriberTypeAlreadyRegisteredException.php', + 'PHPUnit\\Event\\Telemetry\\Duration' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Telemetry/Duration.php', + 'PHPUnit\\Event\\Telemetry\\GarbageCollectorStatus' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Telemetry/GarbageCollectorStatus.php', + 'PHPUnit\\Event\\Telemetry\\GarbageCollectorStatusProvider' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Telemetry/GarbageCollectorStatusProvider.php', + 'PHPUnit\\Event\\Telemetry\\HRTime' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Telemetry/HRTime.php', + 'PHPUnit\\Event\\Telemetry\\Info' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Telemetry/Info.php', + 'PHPUnit\\Event\\Telemetry\\MemoryMeter' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Telemetry/MemoryMeter.php', + 'PHPUnit\\Event\\Telemetry\\MemoryUsage' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Telemetry/MemoryUsage.php', + 'PHPUnit\\Event\\Telemetry\\Php81GarbageCollectorStatusProvider' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Telemetry/Php81GarbageCollectorStatusProvider.php', + 'PHPUnit\\Event\\Telemetry\\Php83GarbageCollectorStatusProvider' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Telemetry/Php83GarbageCollectorStatusProvider.php', + 'PHPUnit\\Event\\Telemetry\\Snapshot' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Telemetry/Snapshot.php', + 'PHPUnit\\Event\\Telemetry\\StopWatch' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Telemetry/StopWatch.php', + 'PHPUnit\\Event\\Telemetry\\System' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Telemetry/System.php', + 'PHPUnit\\Event\\Telemetry\\SystemMemoryMeter' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Telemetry/SystemMemoryMeter.php', + 'PHPUnit\\Event\\Telemetry\\SystemStopWatch' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Telemetry/SystemStopWatch.php', + 'PHPUnit\\Event\\Telemetry\\SystemStopWatchWithOffset' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Telemetry/SystemStopWatchWithOffset.php', + 'PHPUnit\\Event\\TestData\\DataFromDataProvider' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Test/TestData/DataFromDataProvider.php', + 'PHPUnit\\Event\\TestData\\DataFromTestDependency' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Test/TestData/DataFromTestDependency.php', + 'PHPUnit\\Event\\TestData\\MoreThanOneDataSetFromDataProviderException' => $vendorDir . '/phpunit/phpunit/src/Event/Exception/MoreThanOneDataSetFromDataProviderException.php', + 'PHPUnit\\Event\\TestData\\NoDataSetFromDataProviderException' => $vendorDir . '/phpunit/phpunit/src/Event/Exception/NoDataSetFromDataProviderException.php', + 'PHPUnit\\Event\\TestData\\TestData' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Test/TestData/TestData.php', + 'PHPUnit\\Event\\TestData\\TestDataCollection' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Test/TestData/TestDataCollection.php', + 'PHPUnit\\Event\\TestData\\TestDataCollectionIterator' => $vendorDir . '/phpunit/phpunit/src/Event/Value/Test/TestData/TestDataCollectionIterator.php', + 'PHPUnit\\Event\\TestRunner\\BootstrapFinished' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/BootstrapFinished.php', + 'PHPUnit\\Event\\TestRunner\\BootstrapFinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/BootstrapFinishedSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\Configured' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/Configured.php', + 'PHPUnit\\Event\\TestRunner\\ConfiguredSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/ConfiguredSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\DeprecationTriggered' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/DeprecationTriggered.php', + 'PHPUnit\\Event\\TestRunner\\DeprecationTriggeredSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/DeprecationTriggeredSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\EventFacadeSealed' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/EventFacadeSealed.php', + 'PHPUnit\\Event\\TestRunner\\EventFacadeSealedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/EventFacadeSealedSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\ExecutionAborted' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/ExecutionAborted.php', + 'PHPUnit\\Event\\TestRunner\\ExecutionAbortedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/ExecutionAbortedSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\ExecutionFinished' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/ExecutionFinished.php', + 'PHPUnit\\Event\\TestRunner\\ExecutionFinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/ExecutionFinishedSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\ExecutionStarted' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/ExecutionStarted.php', + 'PHPUnit\\Event\\TestRunner\\ExecutionStartedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/ExecutionStartedSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\ExtensionBootstrapped' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/ExtensionBootstrapped.php', + 'PHPUnit\\Event\\TestRunner\\ExtensionBootstrappedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/ExtensionBootstrappedSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\ExtensionLoadedFromPhar' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/ExtensionLoadedFromPhar.php', + 'PHPUnit\\Event\\TestRunner\\ExtensionLoadedFromPharSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/ExtensionLoadedFromPharSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\Finished' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/Finished.php', + 'PHPUnit\\Event\\TestRunner\\FinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/FinishedSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\GarbageCollectionDisabled' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/GarbageCollectionDisabled.php', + 'PHPUnit\\Event\\TestRunner\\GarbageCollectionDisabledSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/GarbageCollectionDisabledSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\GarbageCollectionEnabled' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/GarbageCollectionEnabled.php', + 'PHPUnit\\Event\\TestRunner\\GarbageCollectionEnabledSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/GarbageCollectionEnabledSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\GarbageCollectionTriggered' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/GarbageCollectionTriggered.php', + 'PHPUnit\\Event\\TestRunner\\GarbageCollectionTriggeredSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/GarbageCollectionTriggeredSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\Started' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/Started.php', + 'PHPUnit\\Event\\TestRunner\\StartedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/StartedSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\WarningTriggered' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/WarningTriggered.php', + 'PHPUnit\\Event\\TestRunner\\WarningTriggeredSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestRunner/WarningTriggeredSubscriber.php', + 'PHPUnit\\Event\\TestSuite\\Filtered' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestSuite/Filtered.php', + 'PHPUnit\\Event\\TestSuite\\FilteredSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestSuite/FilteredSubscriber.php', + 'PHPUnit\\Event\\TestSuite\\Finished' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestSuite/Finished.php', + 'PHPUnit\\Event\\TestSuite\\FinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestSuite/FinishedSubscriber.php', + 'PHPUnit\\Event\\TestSuite\\Loaded' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestSuite/Loaded.php', + 'PHPUnit\\Event\\TestSuite\\LoadedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestSuite/LoadedSubscriber.php', + 'PHPUnit\\Event\\TestSuite\\Skipped' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestSuite/Skipped.php', + 'PHPUnit\\Event\\TestSuite\\SkippedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestSuite/SkippedSubscriber.php', + 'PHPUnit\\Event\\TestSuite\\Sorted' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestSuite/Sorted.php', + 'PHPUnit\\Event\\TestSuite\\SortedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestSuite/SortedSubscriber.php', + 'PHPUnit\\Event\\TestSuite\\Started' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestSuite/Started.php', + 'PHPUnit\\Event\\TestSuite\\StartedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/TestSuite/StartedSubscriber.php', + 'PHPUnit\\Event\\TestSuite\\TestSuite' => $vendorDir . '/phpunit/phpunit/src/Event/Value/TestSuite/TestSuite.php', + 'PHPUnit\\Event\\TestSuite\\TestSuiteBuilder' => $vendorDir . '/phpunit/phpunit/src/Event/Value/TestSuite/TestSuiteBuilder.php', + 'PHPUnit\\Event\\TestSuite\\TestSuiteForTestClass' => $vendorDir . '/phpunit/phpunit/src/Event/Value/TestSuite/TestSuiteForTestClass.php', + 'PHPUnit\\Event\\TestSuite\\TestSuiteForTestMethodWithDataProvider' => $vendorDir . '/phpunit/phpunit/src/Event/Value/TestSuite/TestSuiteForTestMethodWithDataProvider.php', + 'PHPUnit\\Event\\TestSuite\\TestSuiteWithName' => $vendorDir . '/phpunit/phpunit/src/Event/Value/TestSuite/TestSuiteWithName.php', + 'PHPUnit\\Event\\Test\\AfterLastTestMethodCalled' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/AfterLastTestMethodCalled.php', + 'PHPUnit\\Event\\Test\\AfterLastTestMethodCalledSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/AfterLastTestMethodCalledSubscriber.php', + 'PHPUnit\\Event\\Test\\AfterLastTestMethodFinished' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/AfterLastTestMethodFinished.php', + 'PHPUnit\\Event\\Test\\AfterLastTestMethodFinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/AfterLastTestMethodFinishedSubscriber.php', + 'PHPUnit\\Event\\Test\\AfterTestMethodCalled' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/AfterTestMethodCalled.php', + 'PHPUnit\\Event\\Test\\AfterTestMethodCalledSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/AfterTestMethodCalledSubscriber.php', + 'PHPUnit\\Event\\Test\\AfterTestMethodFinished' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/AfterTestMethodFinished.php', + 'PHPUnit\\Event\\Test\\AfterTestMethodFinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/AfterTestMethodFinishedSubscriber.php', + 'PHPUnit\\Event\\Test\\AssertionFailed' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Assertion/AssertionFailed.php', + 'PHPUnit\\Event\\Test\\AssertionFailedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Assertion/AssertionFailedSubscriber.php', + 'PHPUnit\\Event\\Test\\AssertionSucceeded' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Assertion/AssertionSucceeded.php', + 'PHPUnit\\Event\\Test\\AssertionSucceededSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Assertion/AssertionSucceededSubscriber.php', + 'PHPUnit\\Event\\Test\\BeforeFirstTestMethodCalled' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodCalled.php', + 'PHPUnit\\Event\\Test\\BeforeFirstTestMethodCalledSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodCalledSubscriber.php', + 'PHPUnit\\Event\\Test\\BeforeFirstTestMethodErrored' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodErrored.php', + 'PHPUnit\\Event\\Test\\BeforeFirstTestMethodErroredSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodErroredSubscriber.php', + 'PHPUnit\\Event\\Test\\BeforeFirstTestMethodFinished' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodFinished.php', + 'PHPUnit\\Event\\Test\\BeforeFirstTestMethodFinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodFinishedSubscriber.php', + 'PHPUnit\\Event\\Test\\BeforeTestMethodCalled' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/BeforeTestMethodCalled.php', + 'PHPUnit\\Event\\Test\\BeforeTestMethodCalledSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/BeforeTestMethodCalledSubscriber.php', + 'PHPUnit\\Event\\Test\\BeforeTestMethodFinished' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/BeforeTestMethodFinished.php', + 'PHPUnit\\Event\\Test\\BeforeTestMethodFinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/BeforeTestMethodFinishedSubscriber.php', + 'PHPUnit\\Event\\Test\\ComparatorRegistered' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/ComparatorRegistered.php', + 'PHPUnit\\Event\\Test\\ComparatorRegisteredSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/ComparatorRegisteredSubscriber.php', + 'PHPUnit\\Event\\Test\\ConsideredRisky' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Issue/ConsideredRisky.php', + 'PHPUnit\\Event\\Test\\ConsideredRiskySubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Issue/ConsideredRiskySubscriber.php', + 'PHPUnit\\Event\\Test\\DataProviderMethodCalled' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Lifecycle/DataProviderMethodCalled.php', + 'PHPUnit\\Event\\Test\\DataProviderMethodCalledSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Lifecycle/DataProviderMethodCalledSubscriber.php', + 'PHPUnit\\Event\\Test\\DataProviderMethodFinished' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Lifecycle/DataProviderMethodFinished.php', + 'PHPUnit\\Event\\Test\\DataProviderMethodFinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Lifecycle/DataProviderMethodFinishedSubscriber.php', + 'PHPUnit\\Event\\Test\\DeprecationTriggered' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Issue/DeprecationTriggered.php', + 'PHPUnit\\Event\\Test\\DeprecationTriggeredSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Issue/DeprecationTriggeredSubscriber.php', + 'PHPUnit\\Event\\Test\\ErrorTriggered' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Issue/ErrorTriggered.php', + 'PHPUnit\\Event\\Test\\ErrorTriggeredSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Issue/ErrorTriggeredSubscriber.php', + 'PHPUnit\\Event\\Test\\Errored' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Outcome/Errored.php', + 'PHPUnit\\Event\\Test\\ErroredSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Outcome/ErroredSubscriber.php', + 'PHPUnit\\Event\\Test\\Failed' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Outcome/Failed.php', + 'PHPUnit\\Event\\Test\\FailedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Outcome/FailedSubscriber.php', + 'PHPUnit\\Event\\Test\\Finished' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Lifecycle/Finished.php', + 'PHPUnit\\Event\\Test\\FinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Lifecycle/FinishedSubscriber.php', + 'PHPUnit\\Event\\Test\\MarkedIncomplete' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Outcome/MarkedIncomplete.php', + 'PHPUnit\\Event\\Test\\MarkedIncompleteSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Outcome/MarkedIncompleteSubscriber.php', + 'PHPUnit\\Event\\Test\\MockObjectCreated' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/MockObjectCreated.php', + 'PHPUnit\\Event\\Test\\MockObjectCreatedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/MockObjectCreatedSubscriber.php', + 'PHPUnit\\Event\\Test\\MockObjectForAbstractClassCreated' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/MockObjectForAbstractClassCreated.php', + 'PHPUnit\\Event\\Test\\MockObjectForAbstractClassCreatedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/MockObjectForAbstractClassCreatedSubscriber.php', + 'PHPUnit\\Event\\Test\\MockObjectForIntersectionOfInterfacesCreated' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/MockObjectForIntersectionOfInterfacesCreated.php', + 'PHPUnit\\Event\\Test\\MockObjectForIntersectionOfInterfacesCreatedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/MockObjectForIntersectionOfInterfacesCreatedSubscriber.php', + 'PHPUnit\\Event\\Test\\MockObjectForTraitCreated' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/MockObjectForTraitCreated.php', + 'PHPUnit\\Event\\Test\\MockObjectForTraitCreatedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/MockObjectForTraitCreatedSubscriber.php', + 'PHPUnit\\Event\\Test\\MockObjectFromWsdlCreated' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/MockObjectFromWsdlCreated.php', + 'PHPUnit\\Event\\Test\\MockObjectFromWsdlCreatedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/MockObjectFromWsdlCreatedSubscriber.php', + 'PHPUnit\\Event\\Test\\NoComparisonFailureException' => $vendorDir . '/phpunit/phpunit/src/Event/Exception/NoComparisonFailureException.php', + 'PHPUnit\\Event\\Test\\NoticeTriggered' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Issue/NoticeTriggered.php', + 'PHPUnit\\Event\\Test\\NoticeTriggeredSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Issue/NoticeTriggeredSubscriber.php', + 'PHPUnit\\Event\\Test\\PartialMockObjectCreated' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/PartialMockObjectCreated.php', + 'PHPUnit\\Event\\Test\\PartialMockObjectCreatedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/PartialMockObjectCreatedSubscriber.php', + 'PHPUnit\\Event\\Test\\Passed' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Outcome/Passed.php', + 'PHPUnit\\Event\\Test\\PassedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Outcome/PassedSubscriber.php', + 'PHPUnit\\Event\\Test\\PhpDeprecationTriggered' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Issue/PhpDeprecationTriggered.php', + 'PHPUnit\\Event\\Test\\PhpDeprecationTriggeredSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Issue/PhpDeprecationTriggeredSubscriber.php', + 'PHPUnit\\Event\\Test\\PhpNoticeTriggered' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Issue/PhpNoticeTriggered.php', + 'PHPUnit\\Event\\Test\\PhpNoticeTriggeredSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Issue/PhpNoticeTriggeredSubscriber.php', + 'PHPUnit\\Event\\Test\\PhpWarningTriggered' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Issue/PhpWarningTriggered.php', + 'PHPUnit\\Event\\Test\\PhpWarningTriggeredSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Issue/PhpWarningTriggeredSubscriber.php', + 'PHPUnit\\Event\\Test\\PhpunitDeprecationTriggered' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Issue/PhpunitDeprecationTriggered.php', + 'PHPUnit\\Event\\Test\\PhpunitDeprecationTriggeredSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Issue/PhpunitDeprecationTriggeredSubscriber.php', + 'PHPUnit\\Event\\Test\\PhpunitErrorTriggered' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Issue/PhpunitErrorTriggered.php', + 'PHPUnit\\Event\\Test\\PhpunitErrorTriggeredSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Issue/PhpunitErrorTriggeredSubscriber.php', + 'PHPUnit\\Event\\Test\\PhpunitWarningTriggered' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Issue/PhpunitWarningTriggered.php', + 'PHPUnit\\Event\\Test\\PhpunitWarningTriggeredSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Issue/PhpunitWarningTriggeredSubscriber.php', + 'PHPUnit\\Event\\Test\\PostConditionCalled' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/PostConditionCalled.php', + 'PHPUnit\\Event\\Test\\PostConditionCalledSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/PostConditionCalledSubscriber.php', + 'PHPUnit\\Event\\Test\\PostConditionFinished' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/PostConditionFinished.php', + 'PHPUnit\\Event\\Test\\PostConditionFinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/PostConditionFinishedSubscriber.php', + 'PHPUnit\\Event\\Test\\PreConditionCalled' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/PreConditionCalled.php', + 'PHPUnit\\Event\\Test\\PreConditionCalledSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/PreConditionCalledSubscriber.php', + 'PHPUnit\\Event\\Test\\PreConditionFinished' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/PreConditionFinished.php', + 'PHPUnit\\Event\\Test\\PreConditionFinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/PreConditionFinishedSubscriber.php', + 'PHPUnit\\Event\\Test\\PreparationFailed' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Lifecycle/PreparationFailed.php', + 'PHPUnit\\Event\\Test\\PreparationFailedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Lifecycle/PreparationFailedSubscriber.php', + 'PHPUnit\\Event\\Test\\PreparationStarted' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Lifecycle/PreparationStarted.php', + 'PHPUnit\\Event\\Test\\PreparationStartedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Lifecycle/PreparationStartedSubscriber.php', + 'PHPUnit\\Event\\Test\\Prepared' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Lifecycle/Prepared.php', + 'PHPUnit\\Event\\Test\\PreparedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Lifecycle/PreparedSubscriber.php', + 'PHPUnit\\Event\\Test\\PrintedUnexpectedOutput' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/PrintedUnexpectedOutput.php', + 'PHPUnit\\Event\\Test\\PrintedUnexpectedOutputSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/PrintedUnexpectedOutputSubscriber.php', + 'PHPUnit\\Event\\Test\\Skipped' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Outcome/Skipped.php', + 'PHPUnit\\Event\\Test\\SkippedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Outcome/SkippedSubscriber.php', + 'PHPUnit\\Event\\Test\\TestProxyCreated' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/TestProxyCreated.php', + 'PHPUnit\\Event\\Test\\TestProxyCreatedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/TestProxyCreatedSubscriber.php', + 'PHPUnit\\Event\\Test\\TestStubCreated' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/TestStubCreated.php', + 'PHPUnit\\Event\\Test\\TestStubCreatedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/TestStubCreatedSubscriber.php', + 'PHPUnit\\Event\\Test\\TestStubForIntersectionOfInterfacesCreated' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/TestStubForIntersectionOfInterfacesCreated.php', + 'PHPUnit\\Event\\Test\\TestStubForIntersectionOfInterfacesCreatedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/TestStubForIntersectionOfInterfacesCreatedSubscriber.php', + 'PHPUnit\\Event\\Test\\WarningTriggered' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Issue/WarningTriggered.php', + 'PHPUnit\\Event\\Test\\WarningTriggeredSubscriber' => $vendorDir . '/phpunit/phpunit/src/Event/Events/Test/Issue/WarningTriggeredSubscriber.php', + 'PHPUnit\\Event\\Tracer\\Tracer' => $vendorDir . '/phpunit/phpunit/src/Event/Tracer.php', + 'PHPUnit\\Event\\TypeMap' => $vendorDir . '/phpunit/phpunit/src/Event/TypeMap.php', + 'PHPUnit\\Event\\UnknownEventException' => $vendorDir . '/phpunit/phpunit/src/Event/Exception/UnknownEventException.php', + 'PHPUnit\\Event\\UnknownEventTypeException' => $vendorDir . '/phpunit/phpunit/src/Event/Exception/UnknownEventTypeException.php', + 'PHPUnit\\Event\\UnknownSubscriberException' => $vendorDir . '/phpunit/phpunit/src/Event/Exception/UnknownSubscriberException.php', + 'PHPUnit\\Event\\UnknownSubscriberTypeException' => $vendorDir . '/phpunit/phpunit/src/Event/Exception/UnknownSubscriberTypeException.php', + 'PHPUnit\\Exception' => $vendorDir . '/phpunit/phpunit/src/Exception.php', + 'PHPUnit\\Framework\\ActualValueIsNotAnObjectException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/ObjectEquals/ActualValueIsNotAnObjectException.php', + 'PHPUnit\\Framework\\Assert' => $vendorDir . '/phpunit/phpunit/src/Framework/Assert.php', + 'PHPUnit\\Framework\\AssertionFailedError' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/AssertionFailedError.php', + 'PHPUnit\\Framework\\Attributes\\After' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/After.php', + 'PHPUnit\\Framework\\Attributes\\AfterClass' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/AfterClass.php', + 'PHPUnit\\Framework\\Attributes\\BackupGlobals' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/BackupGlobals.php', + 'PHPUnit\\Framework\\Attributes\\BackupStaticProperties' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/BackupStaticProperties.php', + 'PHPUnit\\Framework\\Attributes\\Before' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/Before.php', + 'PHPUnit\\Framework\\Attributes\\BeforeClass' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/BeforeClass.php', + 'PHPUnit\\Framework\\Attributes\\CodeCoverageIgnore' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/CodeCoverageIgnore.php', + 'PHPUnit\\Framework\\Attributes\\CoversClass' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/CoversClass.php', + 'PHPUnit\\Framework\\Attributes\\CoversFunction' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/CoversFunction.php', + 'PHPUnit\\Framework\\Attributes\\CoversNothing' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/CoversNothing.php', + 'PHPUnit\\Framework\\Attributes\\DataProvider' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/DataProvider.php', + 'PHPUnit\\Framework\\Attributes\\DataProviderExternal' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/DataProviderExternal.php', + 'PHPUnit\\Framework\\Attributes\\Depends' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/Depends.php', + 'PHPUnit\\Framework\\Attributes\\DependsExternal' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/DependsExternal.php', + 'PHPUnit\\Framework\\Attributes\\DependsExternalUsingDeepClone' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/DependsExternalUsingDeepClone.php', + 'PHPUnit\\Framework\\Attributes\\DependsExternalUsingShallowClone' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/DependsExternalUsingShallowClone.php', + 'PHPUnit\\Framework\\Attributes\\DependsOnClass' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/DependsOnClass.php', + 'PHPUnit\\Framework\\Attributes\\DependsOnClassUsingDeepClone' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/DependsOnClassUsingDeepClone.php', + 'PHPUnit\\Framework\\Attributes\\DependsOnClassUsingShallowClone' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/DependsOnClassUsingShallowClone.php', + 'PHPUnit\\Framework\\Attributes\\DependsUsingDeepClone' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/DependsUsingDeepClone.php', + 'PHPUnit\\Framework\\Attributes\\DependsUsingShallowClone' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/DependsUsingShallowClone.php', + 'PHPUnit\\Framework\\Attributes\\DoesNotPerformAssertions' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/DoesNotPerformAssertions.php', + 'PHPUnit\\Framework\\Attributes\\ExcludeGlobalVariableFromBackup' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/ExcludeGlobalVariableFromBackup.php', + 'PHPUnit\\Framework\\Attributes\\ExcludeStaticPropertyFromBackup' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/ExcludeStaticPropertyFromBackup.php', + 'PHPUnit\\Framework\\Attributes\\Group' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/Group.php', + 'PHPUnit\\Framework\\Attributes\\IgnoreClassForCodeCoverage' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/IgnoreClassForCodeCoverage.php', + 'PHPUnit\\Framework\\Attributes\\IgnoreDeprecations' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/IgnoreDeprecations.php', + 'PHPUnit\\Framework\\Attributes\\IgnoreFunctionForCodeCoverage' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/IgnoreFunctionForCodeCoverage.php', + 'PHPUnit\\Framework\\Attributes\\IgnoreMethodForCodeCoverage' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/IgnoreMethodForCodeCoverage.php', + 'PHPUnit\\Framework\\Attributes\\Large' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/Large.php', + 'PHPUnit\\Framework\\Attributes\\Medium' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/Medium.php', + 'PHPUnit\\Framework\\Attributes\\PostCondition' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/PostCondition.php', + 'PHPUnit\\Framework\\Attributes\\PreCondition' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/PreCondition.php', + 'PHPUnit\\Framework\\Attributes\\PreserveGlobalState' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/PreserveGlobalState.php', + 'PHPUnit\\Framework\\Attributes\\RequiresFunction' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/RequiresFunction.php', + 'PHPUnit\\Framework\\Attributes\\RequiresMethod' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/RequiresMethod.php', + 'PHPUnit\\Framework\\Attributes\\RequiresOperatingSystem' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/RequiresOperatingSystem.php', + 'PHPUnit\\Framework\\Attributes\\RequiresOperatingSystemFamily' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/RequiresOperatingSystemFamily.php', + 'PHPUnit\\Framework\\Attributes\\RequiresPhp' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/RequiresPhp.php', + 'PHPUnit\\Framework\\Attributes\\RequiresPhpExtension' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/RequiresPhpExtension.php', + 'PHPUnit\\Framework\\Attributes\\RequiresPhpunit' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/RequiresPhpunit.php', + 'PHPUnit\\Framework\\Attributes\\RequiresSetting' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/RequiresSetting.php', + 'PHPUnit\\Framework\\Attributes\\RunClassInSeparateProcess' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/RunClassInSeparateProcess.php', + 'PHPUnit\\Framework\\Attributes\\RunInSeparateProcess' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/RunInSeparateProcess.php', + 'PHPUnit\\Framework\\Attributes\\RunTestsInSeparateProcesses' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/RunTestsInSeparateProcesses.php', + 'PHPUnit\\Framework\\Attributes\\Small' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/Small.php', + 'PHPUnit\\Framework\\Attributes\\Test' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/Test.php', + 'PHPUnit\\Framework\\Attributes\\TestDox' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/TestDox.php', + 'PHPUnit\\Framework\\Attributes\\TestWith' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/TestWith.php', + 'PHPUnit\\Framework\\Attributes\\TestWithJson' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/TestWithJson.php', + 'PHPUnit\\Framework\\Attributes\\Ticket' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/Ticket.php', + 'PHPUnit\\Framework\\Attributes\\UsesClass' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/UsesClass.php', + 'PHPUnit\\Framework\\Attributes\\UsesFunction' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/UsesFunction.php', + 'PHPUnit\\Framework\\Attributes\\WithoutErrorHandler' => $vendorDir . '/phpunit/phpunit/src/Framework/Attributes/WithoutErrorHandler.php', + 'PHPUnit\\Framework\\CodeCoverageException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/CodeCoverageException.php', + 'PHPUnit\\Framework\\ComparisonMethodDoesNotAcceptParameterTypeException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/ObjectEquals/ComparisonMethodDoesNotAcceptParameterTypeException.php', + 'PHPUnit\\Framework\\ComparisonMethodDoesNotDeclareBoolReturnTypeException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/ObjectEquals/ComparisonMethodDoesNotDeclareBoolReturnTypeException.php', + 'PHPUnit\\Framework\\ComparisonMethodDoesNotDeclareExactlyOneParameterException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/ObjectEquals/ComparisonMethodDoesNotDeclareExactlyOneParameterException.php', + 'PHPUnit\\Framework\\ComparisonMethodDoesNotDeclareParameterTypeException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/ObjectEquals/ComparisonMethodDoesNotDeclareParameterTypeException.php', + 'PHPUnit\\Framework\\ComparisonMethodDoesNotExistException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/ObjectEquals/ComparisonMethodDoesNotExistException.php', + 'PHPUnit\\Framework\\Constraint\\ArrayHasKey' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Traversable/ArrayHasKey.php', + 'PHPUnit\\Framework\\Constraint\\BinaryOperator' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Operator/BinaryOperator.php', + 'PHPUnit\\Framework\\Constraint\\Callback' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Callback.php', + 'PHPUnit\\Framework\\Constraint\\Constraint' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Constraint.php', + 'PHPUnit\\Framework\\Constraint\\Count' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Cardinality/Count.php', + 'PHPUnit\\Framework\\Constraint\\DirectoryExists' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Filesystem/DirectoryExists.php', + 'PHPUnit\\Framework\\Constraint\\Exception' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Exception/Exception.php', + 'PHPUnit\\Framework\\Constraint\\ExceptionCode' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Exception/ExceptionCode.php', + 'PHPUnit\\Framework\\Constraint\\ExceptionMessageIsOrContains' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Exception/ExceptionMessageIsOrContains.php', + 'PHPUnit\\Framework\\Constraint\\ExceptionMessageMatchesRegularExpression' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Exception/ExceptionMessageMatchesRegularExpression.php', + 'PHPUnit\\Framework\\Constraint\\FileExists' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Filesystem/FileExists.php', + 'PHPUnit\\Framework\\Constraint\\GreaterThan' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Cardinality/GreaterThan.php', + 'PHPUnit\\Framework\\Constraint\\IsAnything' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsAnything.php', + 'PHPUnit\\Framework\\Constraint\\IsEmpty' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Cardinality/IsEmpty.php', + 'PHPUnit\\Framework\\Constraint\\IsEqual' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Equality/IsEqual.php', + 'PHPUnit\\Framework\\Constraint\\IsEqualCanonicalizing' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Equality/IsEqualCanonicalizing.php', + 'PHPUnit\\Framework\\Constraint\\IsEqualIgnoringCase' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Equality/IsEqualIgnoringCase.php', + 'PHPUnit\\Framework\\Constraint\\IsEqualWithDelta' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Equality/IsEqualWithDelta.php', + 'PHPUnit\\Framework\\Constraint\\IsFalse' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Boolean/IsFalse.php', + 'PHPUnit\\Framework\\Constraint\\IsFinite' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Math/IsFinite.php', + 'PHPUnit\\Framework\\Constraint\\IsIdentical' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsIdentical.php', + 'PHPUnit\\Framework\\Constraint\\IsInfinite' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Math/IsInfinite.php', + 'PHPUnit\\Framework\\Constraint\\IsInstanceOf' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Type/IsInstanceOf.php', + 'PHPUnit\\Framework\\Constraint\\IsJson' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/String/IsJson.php', + 'PHPUnit\\Framework\\Constraint\\IsList' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Traversable/IsList.php', + 'PHPUnit\\Framework\\Constraint\\IsNan' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Math/IsNan.php', + 'PHPUnit\\Framework\\Constraint\\IsNull' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Type/IsNull.php', + 'PHPUnit\\Framework\\Constraint\\IsReadable' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Filesystem/IsReadable.php', + 'PHPUnit\\Framework\\Constraint\\IsTrue' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Boolean/IsTrue.php', + 'PHPUnit\\Framework\\Constraint\\IsType' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Type/IsType.php', + 'PHPUnit\\Framework\\Constraint\\IsWritable' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Filesystem/IsWritable.php', + 'PHPUnit\\Framework\\Constraint\\JsonMatches' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/JsonMatches.php', + 'PHPUnit\\Framework\\Constraint\\LessThan' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Cardinality/LessThan.php', + 'PHPUnit\\Framework\\Constraint\\LogicalAnd' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Operator/LogicalAnd.php', + 'PHPUnit\\Framework\\Constraint\\LogicalNot' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Operator/LogicalNot.php', + 'PHPUnit\\Framework\\Constraint\\LogicalOr' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Operator/LogicalOr.php', + 'PHPUnit\\Framework\\Constraint\\LogicalXor' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Operator/LogicalXor.php', + 'PHPUnit\\Framework\\Constraint\\ObjectEquals' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Object/ObjectEquals.php', + 'PHPUnit\\Framework\\Constraint\\ObjectHasProperty' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Object/ObjectHasProperty.php', + 'PHPUnit\\Framework\\Constraint\\Operator' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Operator/Operator.php', + 'PHPUnit\\Framework\\Constraint\\RegularExpression' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/String/RegularExpression.php', + 'PHPUnit\\Framework\\Constraint\\SameSize' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Cardinality/SameSize.php', + 'PHPUnit\\Framework\\Constraint\\StringContains' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/String/StringContains.php', + 'PHPUnit\\Framework\\Constraint\\StringEndsWith' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/String/StringEndsWith.php', + 'PHPUnit\\Framework\\Constraint\\StringEqualsStringIgnoringLineEndings' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/String/StringEqualsStringIgnoringLineEndings.php', + 'PHPUnit\\Framework\\Constraint\\StringMatchesFormatDescription' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/String/StringMatchesFormatDescription.php', + 'PHPUnit\\Framework\\Constraint\\StringStartsWith' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/String/StringStartsWith.php', + 'PHPUnit\\Framework\\Constraint\\TraversableContains' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Traversable/TraversableContains.php', + 'PHPUnit\\Framework\\Constraint\\TraversableContainsEqual' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Traversable/TraversableContainsEqual.php', + 'PHPUnit\\Framework\\Constraint\\TraversableContainsIdentical' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Traversable/TraversableContainsIdentical.php', + 'PHPUnit\\Framework\\Constraint\\TraversableContainsOnly' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Traversable/TraversableContainsOnly.php', + 'PHPUnit\\Framework\\Constraint\\UnaryOperator' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Operator/UnaryOperator.php', + 'PHPUnit\\Framework\\DataProviderTestSuite' => $vendorDir . '/phpunit/phpunit/src/Framework/DataProviderTestSuite.php', + 'PHPUnit\\Framework\\EmptyStringException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/EmptyStringException.php', + 'PHPUnit\\Framework\\Exception' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/Exception.php', + 'PHPUnit\\Framework\\ExecutionOrderDependency' => $vendorDir . '/phpunit/phpunit/src/Framework/ExecutionOrderDependency.php', + 'PHPUnit\\Framework\\ExpectationFailedException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/ExpectationFailedException.php', + 'PHPUnit\\Framework\\GeneratorNotSupportedException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/GeneratorNotSupportedException.php', + 'PHPUnit\\Framework\\IncompleteTest' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/Incomplete/IncompleteTest.php', + 'PHPUnit\\Framework\\IncompleteTestError' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/Incomplete/IncompleteTestError.php', + 'PHPUnit\\Framework\\InvalidArgumentException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/InvalidArgumentException.php', + 'PHPUnit\\Framework\\InvalidCoversTargetException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/InvalidCoversTargetException.php', + 'PHPUnit\\Framework\\InvalidDataProviderException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/InvalidDataProviderException.php', + 'PHPUnit\\Framework\\InvalidDependencyException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/InvalidDependencyException.php', + 'PHPUnit\\Framework\\MockObject\\BadMethodCallException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/BadMethodCallException.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\Identity' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Builder/Identity.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\InvocationMocker' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Builder/InvocationMocker.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\InvocationStubber' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Builder/InvocationStubber.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\MethodNameMatch' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Builder/MethodNameMatch.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\ParametersMatch' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Builder/ParametersMatch.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\Stub' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Builder/Stub.php', + 'PHPUnit\\Framework\\MockObject\\CannotUseOnlyMethodsException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/CannotUseOnlyMethodsException.php', + 'PHPUnit\\Framework\\MockObject\\ConfigurableMethod' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/ConfigurableMethod.php', + 'PHPUnit\\Framework\\MockObject\\DoubledCloneMethod' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Api/DoubledCloneMethod.php', + 'PHPUnit\\Framework\\MockObject\\Exception' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/Exception.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\CannotUseAddMethodsException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/CannotUseAddMethodsException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\ClassIsEnumerationException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/ClassIsEnumerationException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\ClassIsFinalException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/ClassIsFinalException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\ClassIsReadonlyException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/ClassIsReadonlyException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\DuplicateMethodException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/DuplicateMethodException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\Exception' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/Exception.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\Generator' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Generator/Generator.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\InvalidMethodNameException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/InvalidMethodNameException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\MockClass' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Generator/MockClass.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\MockMethod' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Generator/MockMethod.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\MockMethodSet' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Generator/MockMethodSet.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\MockTrait' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Generator/MockTrait.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\MockType' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Generator/MockType.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\NameAlreadyInUseException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/NameAlreadyInUseException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\OriginalConstructorInvocationRequiredException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/OriginalConstructorInvocationRequiredException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\ReflectionException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/ReflectionException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\RuntimeException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/RuntimeException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\SoapExtensionNotAvailableException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/SoapExtensionNotAvailableException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\TemplateLoader' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Generator/TemplateLoader.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\UnknownClassException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/UnknownClassException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\UnknownTraitException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/UnknownTraitException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\UnknownTypeException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/UnknownTypeException.php', + 'PHPUnit\\Framework\\MockObject\\IncompatibleReturnValueException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/IncompatibleReturnValueException.php', + 'PHPUnit\\Framework\\MockObject\\Invocation' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Invocation.php', + 'PHPUnit\\Framework\\MockObject\\InvocationHandler' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/InvocationHandler.php', + 'PHPUnit\\Framework\\MockObject\\MatchBuilderNotFoundException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/MatchBuilderNotFoundException.php', + 'PHPUnit\\Framework\\MockObject\\Matcher' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Matcher.php', + 'PHPUnit\\Framework\\MockObject\\MatcherAlreadyRegisteredException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/MatcherAlreadyRegisteredException.php', + 'PHPUnit\\Framework\\MockObject\\Method' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Api/Method.php', + 'PHPUnit\\Framework\\MockObject\\MethodCannotBeConfiguredException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/MethodCannotBeConfiguredException.php', + 'PHPUnit\\Framework\\MockObject\\MethodNameAlreadyConfiguredException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/MethodNameAlreadyConfiguredException.php', + 'PHPUnit\\Framework\\MockObject\\MethodNameConstraint' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/MethodNameConstraint.php', + 'PHPUnit\\Framework\\MockObject\\MethodNameNotConfiguredException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/MethodNameNotConfiguredException.php', + 'PHPUnit\\Framework\\MockObject\\MethodParametersAlreadyConfiguredException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/MethodParametersAlreadyConfiguredException.php', + 'PHPUnit\\Framework\\MockObject\\MockBuilder' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/MockBuilder.php', + 'PHPUnit\\Framework\\MockObject\\MockObject' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Interface/MockObject.php', + 'PHPUnit\\Framework\\MockObject\\MockObjectApi' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Api/MockObjectApi.php', + 'PHPUnit\\Framework\\MockObject\\MockObjectInternal' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Interface/MockObjectInternal.php', + 'PHPUnit\\Framework\\MockObject\\NeverReturningMethodException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/NeverReturningMethodException.php', + 'PHPUnit\\Framework\\MockObject\\NoMoreReturnValuesConfiguredException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/NoMoreReturnValuesConfiguredException.php', + 'PHPUnit\\Framework\\MockObject\\ProxiedCloneMethod' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Api/ProxiedCloneMethod.php', + 'PHPUnit\\Framework\\MockObject\\ReflectionException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/ReflectionException.php', + 'PHPUnit\\Framework\\MockObject\\ReturnValueGenerator' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/ReturnValueGenerator.php', + 'PHPUnit\\Framework\\MockObject\\ReturnValueNotConfiguredException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/ReturnValueNotConfiguredException.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\AnyInvokedCount' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Rule/AnyInvokedCount.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\AnyParameters' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Rule/AnyParameters.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\InvocationOrder' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Rule/InvocationOrder.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\InvokedAtLeastCount' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Rule/InvokedAtLeastCount.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\InvokedAtLeastOnce' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Rule/InvokedAtLeastOnce.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\InvokedAtMostCount' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Rule/InvokedAtMostCount.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\InvokedCount' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Rule/InvokedCount.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\MethodName' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Rule/MethodName.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\Parameters' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Rule/Parameters.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\ParametersRule' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Rule/ParametersRule.php', + 'PHPUnit\\Framework\\MockObject\\RuntimeException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/RuntimeException.php', + 'PHPUnit\\Framework\\MockObject\\Stub' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Interface/Stub.php', + 'PHPUnit\\Framework\\MockObject\\StubApi' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Api/StubApi.php', + 'PHPUnit\\Framework\\MockObject\\StubInternal' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Interface/StubInternal.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ConsecutiveCalls' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/ConsecutiveCalls.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\Exception' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/Exception.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnArgument' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/ReturnArgument.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnCallback' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/ReturnCallback.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnReference' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/ReturnReference.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnSelf' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/ReturnSelf.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnStub' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/ReturnStub.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnValueMap' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/ReturnValueMap.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\Stub' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/Stub.php', + 'PHPUnit\\Framework\\NoChildTestSuiteException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/NoChildTestSuiteException.php', + 'PHPUnit\\Framework\\PhptAssertionFailedError' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/PhptAssertionFailedError.php', + 'PHPUnit\\Framework\\ProcessIsolationException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/ProcessIsolationException.php', + 'PHPUnit\\Framework\\Reorderable' => $vendorDir . '/phpunit/phpunit/src/Framework/Reorderable.php', + 'PHPUnit\\Framework\\SelfDescribing' => $vendorDir . '/phpunit/phpunit/src/Framework/SelfDescribing.php', + 'PHPUnit\\Framework\\SkippedTest' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/Skipped/SkippedTest.php', + 'PHPUnit\\Framework\\SkippedTestSuiteError' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/Skipped/SkippedTestSuiteError.php', + 'PHPUnit\\Framework\\SkippedWithMessageException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/Skipped/SkippedWithMessageException.php', + 'PHPUnit\\Framework\\Test' => $vendorDir . '/phpunit/phpunit/src/Framework/Test.php', + 'PHPUnit\\Framework\\TestBuilder' => $vendorDir . '/phpunit/phpunit/src/Framework/TestBuilder.php', + 'PHPUnit\\Framework\\TestCase' => $vendorDir . '/phpunit/phpunit/src/Framework/TestCase.php', + 'PHPUnit\\Framework\\TestRunner' => $vendorDir . '/phpunit/phpunit/src/Framework/TestRunner.php', + 'PHPUnit\\Framework\\TestSize\\Known' => $vendorDir . '/phpunit/phpunit/src/Framework/TestSize/Known.php', + 'PHPUnit\\Framework\\TestSize\\Large' => $vendorDir . '/phpunit/phpunit/src/Framework/TestSize/Large.php', + 'PHPUnit\\Framework\\TestSize\\Medium' => $vendorDir . '/phpunit/phpunit/src/Framework/TestSize/Medium.php', + 'PHPUnit\\Framework\\TestSize\\Small' => $vendorDir . '/phpunit/phpunit/src/Framework/TestSize/Small.php', + 'PHPUnit\\Framework\\TestSize\\TestSize' => $vendorDir . '/phpunit/phpunit/src/Framework/TestSize/TestSize.php', + 'PHPUnit\\Framework\\TestSize\\Unknown' => $vendorDir . '/phpunit/phpunit/src/Framework/TestSize/Unknown.php', + 'PHPUnit\\Framework\\TestStatus\\Deprecation' => $vendorDir . '/phpunit/phpunit/src/Framework/TestStatus/Deprecation.php', + 'PHPUnit\\Framework\\TestStatus\\Error' => $vendorDir . '/phpunit/phpunit/src/Framework/TestStatus/Error.php', + 'PHPUnit\\Framework\\TestStatus\\Failure' => $vendorDir . '/phpunit/phpunit/src/Framework/TestStatus/Failure.php', + 'PHPUnit\\Framework\\TestStatus\\Incomplete' => $vendorDir . '/phpunit/phpunit/src/Framework/TestStatus/Incomplete.php', + 'PHPUnit\\Framework\\TestStatus\\Known' => $vendorDir . '/phpunit/phpunit/src/Framework/TestStatus/Known.php', + 'PHPUnit\\Framework\\TestStatus\\Notice' => $vendorDir . '/phpunit/phpunit/src/Framework/TestStatus/Notice.php', + 'PHPUnit\\Framework\\TestStatus\\Risky' => $vendorDir . '/phpunit/phpunit/src/Framework/TestStatus/Risky.php', + 'PHPUnit\\Framework\\TestStatus\\Skipped' => $vendorDir . '/phpunit/phpunit/src/Framework/TestStatus/Skipped.php', + 'PHPUnit\\Framework\\TestStatus\\Success' => $vendorDir . '/phpunit/phpunit/src/Framework/TestStatus/Success.php', + 'PHPUnit\\Framework\\TestStatus\\TestStatus' => $vendorDir . '/phpunit/phpunit/src/Framework/TestStatus/TestStatus.php', + 'PHPUnit\\Framework\\TestStatus\\Unknown' => $vendorDir . '/phpunit/phpunit/src/Framework/TestStatus/Unknown.php', + 'PHPUnit\\Framework\\TestStatus\\Warning' => $vendorDir . '/phpunit/phpunit/src/Framework/TestStatus/Warning.php', + 'PHPUnit\\Framework\\TestSuite' => $vendorDir . '/phpunit/phpunit/src/Framework/TestSuite.php', + 'PHPUnit\\Framework\\TestSuiteIterator' => $vendorDir . '/phpunit/phpunit/src/Framework/TestSuiteIterator.php', + 'PHPUnit\\Framework\\UnknownClassOrInterfaceException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/UnknownClassOrInterfaceException.php', + 'PHPUnit\\Framework\\UnknownTypeException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/UnknownTypeException.php', + 'PHPUnit\\Logging\\EventLogger' => $vendorDir . '/phpunit/phpunit/src/Logging/EventLogger.php', + 'PHPUnit\\Logging\\Exception' => $vendorDir . '/phpunit/phpunit/src/Logging/Exception.php', + 'PHPUnit\\Logging\\JUnit\\JunitXmlLogger' => $vendorDir . '/phpunit/phpunit/src/Logging/JUnit/JunitXmlLogger.php', + 'PHPUnit\\Logging\\JUnit\\Subscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/JUnit/Subscriber/Subscriber.php', + 'PHPUnit\\Logging\\JUnit\\TestErroredSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/JUnit/Subscriber/TestErroredSubscriber.php', + 'PHPUnit\\Logging\\JUnit\\TestFailedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/JUnit/Subscriber/TestFailedSubscriber.php', + 'PHPUnit\\Logging\\JUnit\\TestFinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/JUnit/Subscriber/TestFinishedSubscriber.php', + 'PHPUnit\\Logging\\JUnit\\TestMarkedIncompleteSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/JUnit/Subscriber/TestMarkedIncompleteSubscriber.php', + 'PHPUnit\\Logging\\JUnit\\TestPreparationFailedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/JUnit/Subscriber/TestPreparationFailedSubscriber.php', + 'PHPUnit\\Logging\\JUnit\\TestPreparationStartedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/JUnit/Subscriber/TestPreparationStartedSubscriber.php', + 'PHPUnit\\Logging\\JUnit\\TestPreparedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/JUnit/Subscriber/TestPreparedSubscriber.php', + 'PHPUnit\\Logging\\JUnit\\TestRunnerExecutionFinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/JUnit/Subscriber/TestRunnerExecutionFinishedSubscriber.php', + 'PHPUnit\\Logging\\JUnit\\TestSkippedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/JUnit/Subscriber/TestSkippedSubscriber.php', + 'PHPUnit\\Logging\\JUnit\\TestSuiteFinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/JUnit/Subscriber/TestSuiteFinishedSubscriber.php', + 'PHPUnit\\Logging\\JUnit\\TestSuiteStartedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/JUnit/Subscriber/TestSuiteStartedSubscriber.php', + 'PHPUnit\\Logging\\TeamCity\\Subscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TeamCity/Subscriber/Subscriber.php', + 'PHPUnit\\Logging\\TeamCity\\TeamCityLogger' => $vendorDir . '/phpunit/phpunit/src/Logging/TeamCity/TeamCityLogger.php', + 'PHPUnit\\Logging\\TeamCity\\TestConsideredRiskySubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TeamCity/Subscriber/TestConsideredRiskySubscriber.php', + 'PHPUnit\\Logging\\TeamCity\\TestErroredSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TeamCity/Subscriber/TestErroredSubscriber.php', + 'PHPUnit\\Logging\\TeamCity\\TestFailedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TeamCity/Subscriber/TestFailedSubscriber.php', + 'PHPUnit\\Logging\\TeamCity\\TestFinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TeamCity/Subscriber/TestFinishedSubscriber.php', + 'PHPUnit\\Logging\\TeamCity\\TestMarkedIncompleteSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TeamCity/Subscriber/TestMarkedIncompleteSubscriber.php', + 'PHPUnit\\Logging\\TeamCity\\TestPreparedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TeamCity/Subscriber/TestPreparedSubscriber.php', + 'PHPUnit\\Logging\\TeamCity\\TestRunnerExecutionFinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TeamCity/Subscriber/TestRunnerExecutionFinishedSubscriber.php', + 'PHPUnit\\Logging\\TeamCity\\TestSkippedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TeamCity/Subscriber/TestSkippedSubscriber.php', + 'PHPUnit\\Logging\\TeamCity\\TestSuiteFinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TeamCity/Subscriber/TestSuiteFinishedSubscriber.php', + 'PHPUnit\\Logging\\TeamCity\\TestSuiteStartedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TeamCity/Subscriber/TestSuiteStartedSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\HtmlRenderer' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/HtmlRenderer.php', + 'PHPUnit\\Logging\\TestDox\\NamePrettifier' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/NamePrettifier.php', + 'PHPUnit\\Logging\\TestDox\\PlainTextRenderer' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/PlainTextRenderer.php', + 'PHPUnit\\Logging\\TestDox\\Subscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/Subscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestConsideredRiskySubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestConsideredRiskySubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestErroredSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestErroredSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestFailedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestFailedSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestFinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestFinishedSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestMarkedIncompleteSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestMarkedIncompleteSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestPassedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestPassedSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestPreparedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestPreparedSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestResult' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/TestResult/TestResult.php', + 'PHPUnit\\Logging\\TestDox\\TestResultCollection' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/TestResult/TestResultCollection.php', + 'PHPUnit\\Logging\\TestDox\\TestResultCollectionIterator' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/TestResult/TestResultCollectionIterator.php', + 'PHPUnit\\Logging\\TestDox\\TestResultCollector' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/TestResult/TestResultCollector.php', + 'PHPUnit\\Logging\\TestDox\\TestSkippedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestSkippedSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestTriggeredDeprecationSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestTriggeredDeprecationSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestTriggeredNoticeSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestTriggeredNoticeSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestTriggeredPhpDeprecationSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestTriggeredPhpDeprecationSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestTriggeredPhpNoticeSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestTriggeredPhpNoticeSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestTriggeredPhpWarningSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestTriggeredPhpWarningSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestTriggeredPhpunitDeprecationSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestTriggeredPhpunitDeprecationSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestTriggeredPhpunitErrorSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestTriggeredPhpunitErrorSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestTriggeredPhpunitWarningSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestTriggeredPhpunitWarningSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestTriggeredWarningSubscriber' => $vendorDir . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestTriggeredWarningSubscriber.php', + 'PHPUnit\\Metadata\\After' => $vendorDir . '/phpunit/phpunit/src/Metadata/After.php', + 'PHPUnit\\Metadata\\AfterClass' => $vendorDir . '/phpunit/phpunit/src/Metadata/AfterClass.php', + 'PHPUnit\\Metadata\\Annotation\\Parser\\DocBlock' => $vendorDir . '/phpunit/phpunit/src/Metadata/Parser/Annotation/DocBlock.php', + 'PHPUnit\\Metadata\\Annotation\\Parser\\Registry' => $vendorDir . '/phpunit/phpunit/src/Metadata/Parser/Annotation/Registry.php', + 'PHPUnit\\Metadata\\AnnotationsAreNotSupportedForInternalClassesException' => $vendorDir . '/phpunit/phpunit/src/Metadata/Exception/AnnotationsAreNotSupportedForInternalClassesException.php', + 'PHPUnit\\Metadata\\Api\\CodeCoverage' => $vendorDir . '/phpunit/phpunit/src/Metadata/Api/CodeCoverage.php', + 'PHPUnit\\Metadata\\Api\\DataProvider' => $vendorDir . '/phpunit/phpunit/src/Metadata/Api/DataProvider.php', + 'PHPUnit\\Metadata\\Api\\Dependencies' => $vendorDir . '/phpunit/phpunit/src/Metadata/Api/Dependencies.php', + 'PHPUnit\\Metadata\\Api\\Groups' => $vendorDir . '/phpunit/phpunit/src/Metadata/Api/Groups.php', + 'PHPUnit\\Metadata\\Api\\HookMethods' => $vendorDir . '/phpunit/phpunit/src/Metadata/Api/HookMethods.php', + 'PHPUnit\\Metadata\\Api\\Requirements' => $vendorDir . '/phpunit/phpunit/src/Metadata/Api/Requirements.php', + 'PHPUnit\\Metadata\\BackupGlobals' => $vendorDir . '/phpunit/phpunit/src/Metadata/BackupGlobals.php', + 'PHPUnit\\Metadata\\BackupStaticProperties' => $vendorDir . '/phpunit/phpunit/src/Metadata/BackupStaticProperties.php', + 'PHPUnit\\Metadata\\Before' => $vendorDir . '/phpunit/phpunit/src/Metadata/Before.php', + 'PHPUnit\\Metadata\\BeforeClass' => $vendorDir . '/phpunit/phpunit/src/Metadata/BeforeClass.php', + 'PHPUnit\\Metadata\\Covers' => $vendorDir . '/phpunit/phpunit/src/Metadata/Covers.php', + 'PHPUnit\\Metadata\\CoversClass' => $vendorDir . '/phpunit/phpunit/src/Metadata/CoversClass.php', + 'PHPUnit\\Metadata\\CoversDefaultClass' => $vendorDir . '/phpunit/phpunit/src/Metadata/CoversDefaultClass.php', + 'PHPUnit\\Metadata\\CoversFunction' => $vendorDir . '/phpunit/phpunit/src/Metadata/CoversFunction.php', + 'PHPUnit\\Metadata\\CoversNothing' => $vendorDir . '/phpunit/phpunit/src/Metadata/CoversNothing.php', + 'PHPUnit\\Metadata\\DataProvider' => $vendorDir . '/phpunit/phpunit/src/Metadata/DataProvider.php', + 'PHPUnit\\Metadata\\DependsOnClass' => $vendorDir . '/phpunit/phpunit/src/Metadata/DependsOnClass.php', + 'PHPUnit\\Metadata\\DependsOnMethod' => $vendorDir . '/phpunit/phpunit/src/Metadata/DependsOnMethod.php', + 'PHPUnit\\Metadata\\DoesNotPerformAssertions' => $vendorDir . '/phpunit/phpunit/src/Metadata/DoesNotPerformAssertions.php', + 'PHPUnit\\Metadata\\Exception' => $vendorDir . '/phpunit/phpunit/src/Metadata/Exception/Exception.php', + 'PHPUnit\\Metadata\\ExcludeGlobalVariableFromBackup' => $vendorDir . '/phpunit/phpunit/src/Metadata/ExcludeGlobalVariableFromBackup.php', + 'PHPUnit\\Metadata\\ExcludeStaticPropertyFromBackup' => $vendorDir . '/phpunit/phpunit/src/Metadata/ExcludeStaticPropertyFromBackup.php', + 'PHPUnit\\Metadata\\Group' => $vendorDir . '/phpunit/phpunit/src/Metadata/Group.php', + 'PHPUnit\\Metadata\\IgnoreClassForCodeCoverage' => $vendorDir . '/phpunit/phpunit/src/Metadata/IgnoreClassForCodeCoverage.php', + 'PHPUnit\\Metadata\\IgnoreDeprecations' => $vendorDir . '/phpunit/phpunit/src/Metadata/IgnoreDeprecations.php', + 'PHPUnit\\Metadata\\IgnoreFunctionForCodeCoverage' => $vendorDir . '/phpunit/phpunit/src/Metadata/IgnoreFunctionForCodeCoverage.php', + 'PHPUnit\\Metadata\\IgnoreMethodForCodeCoverage' => $vendorDir . '/phpunit/phpunit/src/Metadata/IgnoreMethodForCodeCoverage.php', + 'PHPUnit\\Metadata\\InvalidVersionRequirementException' => $vendorDir . '/phpunit/phpunit/src/Metadata/Exception/InvalidVersionRequirementException.php', + 'PHPUnit\\Metadata\\Metadata' => $vendorDir . '/phpunit/phpunit/src/Metadata/Metadata.php', + 'PHPUnit\\Metadata\\MetadataCollection' => $vendorDir . '/phpunit/phpunit/src/Metadata/MetadataCollection.php', + 'PHPUnit\\Metadata\\MetadataCollectionIterator' => $vendorDir . '/phpunit/phpunit/src/Metadata/MetadataCollectionIterator.php', + 'PHPUnit\\Metadata\\NoVersionRequirementException' => $vendorDir . '/phpunit/phpunit/src/Metadata/Exception/NoVersionRequirementException.php', + 'PHPUnit\\Metadata\\Parser\\AnnotationParser' => $vendorDir . '/phpunit/phpunit/src/Metadata/Parser/AnnotationParser.php', + 'PHPUnit\\Metadata\\Parser\\AttributeParser' => $vendorDir . '/phpunit/phpunit/src/Metadata/Parser/AttributeParser.php', + 'PHPUnit\\Metadata\\Parser\\CachingParser' => $vendorDir . '/phpunit/phpunit/src/Metadata/Parser/CachingParser.php', + 'PHPUnit\\Metadata\\Parser\\Parser' => $vendorDir . '/phpunit/phpunit/src/Metadata/Parser/Parser.php', + 'PHPUnit\\Metadata\\Parser\\ParserChain' => $vendorDir . '/phpunit/phpunit/src/Metadata/Parser/ParserChain.php', + 'PHPUnit\\Metadata\\Parser\\Registry' => $vendorDir . '/phpunit/phpunit/src/Metadata/Parser/Registry.php', + 'PHPUnit\\Metadata\\PostCondition' => $vendorDir . '/phpunit/phpunit/src/Metadata/PostCondition.php', + 'PHPUnit\\Metadata\\PreCondition' => $vendorDir . '/phpunit/phpunit/src/Metadata/PreCondition.php', + 'PHPUnit\\Metadata\\PreserveGlobalState' => $vendorDir . '/phpunit/phpunit/src/Metadata/PreserveGlobalState.php', + 'PHPUnit\\Metadata\\ReflectionException' => $vendorDir . '/phpunit/phpunit/src/Metadata/Exception/ReflectionException.php', + 'PHPUnit\\Metadata\\RequiresFunction' => $vendorDir . '/phpunit/phpunit/src/Metadata/RequiresFunction.php', + 'PHPUnit\\Metadata\\RequiresMethod' => $vendorDir . '/phpunit/phpunit/src/Metadata/RequiresMethod.php', + 'PHPUnit\\Metadata\\RequiresOperatingSystem' => $vendorDir . '/phpunit/phpunit/src/Metadata/RequiresOperatingSystem.php', + 'PHPUnit\\Metadata\\RequiresOperatingSystemFamily' => $vendorDir . '/phpunit/phpunit/src/Metadata/RequiresOperatingSystemFamily.php', + 'PHPUnit\\Metadata\\RequiresPhp' => $vendorDir . '/phpunit/phpunit/src/Metadata/RequiresPhp.php', + 'PHPUnit\\Metadata\\RequiresPhpExtension' => $vendorDir . '/phpunit/phpunit/src/Metadata/RequiresPhpExtension.php', + 'PHPUnit\\Metadata\\RequiresPhpunit' => $vendorDir . '/phpunit/phpunit/src/Metadata/RequiresPhpunit.php', + 'PHPUnit\\Metadata\\RequiresSetting' => $vendorDir . '/phpunit/phpunit/src/Metadata/RequiresSetting.php', + 'PHPUnit\\Metadata\\RunClassInSeparateProcess' => $vendorDir . '/phpunit/phpunit/src/Metadata/RunClassInSeparateProcess.php', + 'PHPUnit\\Metadata\\RunInSeparateProcess' => $vendorDir . '/phpunit/phpunit/src/Metadata/RunInSeparateProcess.php', + 'PHPUnit\\Metadata\\RunTestsInSeparateProcesses' => $vendorDir . '/phpunit/phpunit/src/Metadata/RunTestsInSeparateProcesses.php', + 'PHPUnit\\Metadata\\Test' => $vendorDir . '/phpunit/phpunit/src/Metadata/Test.php', + 'PHPUnit\\Metadata\\TestDox' => $vendorDir . '/phpunit/phpunit/src/Metadata/TestDox.php', + 'PHPUnit\\Metadata\\TestWith' => $vendorDir . '/phpunit/phpunit/src/Metadata/TestWith.php', + 'PHPUnit\\Metadata\\Uses' => $vendorDir . '/phpunit/phpunit/src/Metadata/Uses.php', + 'PHPUnit\\Metadata\\UsesClass' => $vendorDir . '/phpunit/phpunit/src/Metadata/UsesClass.php', + 'PHPUnit\\Metadata\\UsesDefaultClass' => $vendorDir . '/phpunit/phpunit/src/Metadata/UsesDefaultClass.php', + 'PHPUnit\\Metadata\\UsesFunction' => $vendorDir . '/phpunit/phpunit/src/Metadata/UsesFunction.php', + 'PHPUnit\\Metadata\\Version\\ComparisonRequirement' => $vendorDir . '/phpunit/phpunit/src/Metadata/Version/ComparisonRequirement.php', + 'PHPUnit\\Metadata\\Version\\ConstraintRequirement' => $vendorDir . '/phpunit/phpunit/src/Metadata/Version/ConstraintRequirement.php', + 'PHPUnit\\Metadata\\Version\\Requirement' => $vendorDir . '/phpunit/phpunit/src/Metadata/Version/Requirement.php', + 'PHPUnit\\Metadata\\WithoutErrorHandler' => $vendorDir . '/phpunit/phpunit/src/Metadata/WithoutErrorHandler.php', + 'PHPUnit\\Runner\\Baseline\\Baseline' => $vendorDir . '/phpunit/phpunit/src/Runner/Baseline/Baseline.php', + 'PHPUnit\\Runner\\Baseline\\CannotLoadBaselineException' => $vendorDir . '/phpunit/phpunit/src/Runner/Baseline/Exception/CannotLoadBaselineException.php', + 'PHPUnit\\Runner\\Baseline\\FileDoesNotHaveLineException' => $vendorDir . '/phpunit/phpunit/src/Runner/Baseline/Exception/FileDoesNotHaveLineException.php', + 'PHPUnit\\Runner\\Baseline\\Generator' => $vendorDir . '/phpunit/phpunit/src/Runner/Baseline/Generator.php', + 'PHPUnit\\Runner\\Baseline\\Issue' => $vendorDir . '/phpunit/phpunit/src/Runner/Baseline/Issue.php', + 'PHPUnit\\Runner\\Baseline\\Reader' => $vendorDir . '/phpunit/phpunit/src/Runner/Baseline/Reader.php', + 'PHPUnit\\Runner\\Baseline\\RelativePathCalculator' => $vendorDir . '/phpunit/phpunit/src/Runner/Baseline/RelativePathCalculator.php', + 'PHPUnit\\Runner\\Baseline\\Subscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/Baseline/Subscriber/Subscriber.php', + 'PHPUnit\\Runner\\Baseline\\TestTriggeredDeprecationSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/Baseline/Subscriber/TestTriggeredDeprecationSubscriber.php', + 'PHPUnit\\Runner\\Baseline\\TestTriggeredNoticeSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/Baseline/Subscriber/TestTriggeredNoticeSubscriber.php', + 'PHPUnit\\Runner\\Baseline\\TestTriggeredPhpDeprecationSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/Baseline/Subscriber/TestTriggeredPhpDeprecationSubscriber.php', + 'PHPUnit\\Runner\\Baseline\\TestTriggeredPhpNoticeSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/Baseline/Subscriber/TestTriggeredPhpNoticeSubscriber.php', + 'PHPUnit\\Runner\\Baseline\\TestTriggeredPhpWarningSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/Baseline/Subscriber/TestTriggeredPhpWarningSubscriber.php', + 'PHPUnit\\Runner\\Baseline\\TestTriggeredWarningSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/Baseline/Subscriber/TestTriggeredWarningSubscriber.php', + 'PHPUnit\\Runner\\Baseline\\Writer' => $vendorDir . '/phpunit/phpunit/src/Runner/Baseline/Writer.php', + 'PHPUnit\\Runner\\ClassCannotBeFoundException' => $vendorDir . '/phpunit/phpunit/src/Runner/Exception/ClassCannotBeFoundException.php', + 'PHPUnit\\Runner\\ClassDoesNotExtendTestCaseException' => $vendorDir . '/phpunit/phpunit/src/Runner/Exception/ClassDoesNotExtendTestCaseException.php', + 'PHPUnit\\Runner\\ClassIsAbstractException' => $vendorDir . '/phpunit/phpunit/src/Runner/Exception/ClassIsAbstractException.php', + 'PHPUnit\\Runner\\CodeCoverage' => $vendorDir . '/phpunit/phpunit/src/Runner/CodeCoverage.php', + 'PHPUnit\\Runner\\DirectoryDoesNotExistException' => $vendorDir . '/phpunit/phpunit/src/Runner/Exception/DirectoryDoesNotExistException.php', + 'PHPUnit\\Runner\\ErrorException' => $vendorDir . '/phpunit/phpunit/src/Runner/Exception/ErrorException.php', + 'PHPUnit\\Runner\\ErrorHandler' => $vendorDir . '/phpunit/phpunit/src/Runner/ErrorHandler.php', + 'PHPUnit\\Runner\\Exception' => $vendorDir . '/phpunit/phpunit/src/Runner/Exception/Exception.php', + 'PHPUnit\\Runner\\Extension\\Extension' => $vendorDir . '/phpunit/phpunit/src/Runner/Extension/Extension.php', + 'PHPUnit\\Runner\\Extension\\ExtensionBootstrapper' => $vendorDir . '/phpunit/phpunit/src/Runner/Extension/ExtensionBootstrapper.php', + 'PHPUnit\\Runner\\Extension\\Facade' => $vendorDir . '/phpunit/phpunit/src/Runner/Extension/Facade.php', + 'PHPUnit\\Runner\\Extension\\ParameterCollection' => $vendorDir . '/phpunit/phpunit/src/Runner/Extension/ParameterCollection.php', + 'PHPUnit\\Runner\\Extension\\PharLoader' => $vendorDir . '/phpunit/phpunit/src/Runner/Extension/PharLoader.php', + 'PHPUnit\\Runner\\FileDoesNotExistException' => $vendorDir . '/phpunit/phpunit/src/Runner/Exception/FileDoesNotExistException.php', + 'PHPUnit\\Runner\\Filter\\ExcludeGroupFilterIterator' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/ExcludeGroupFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\Factory' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/Factory.php', + 'PHPUnit\\Runner\\Filter\\GroupFilterIterator' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/GroupFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\IncludeGroupFilterIterator' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/IncludeGroupFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\NameFilterIterator' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/NameFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\TestIdFilterIterator' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/TestIdFilterIterator.php', + 'PHPUnit\\Runner\\GarbageCollection\\ExecutionFinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/GarbageCollection/Subscriber/ExecutionFinishedSubscriber.php', + 'PHPUnit\\Runner\\GarbageCollection\\ExecutionStartedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/GarbageCollection/Subscriber/ExecutionStartedSubscriber.php', + 'PHPUnit\\Runner\\GarbageCollection\\GarbageCollectionHandler' => $vendorDir . '/phpunit/phpunit/src/Runner/GarbageCollection/GarbageCollectionHandler.php', + 'PHPUnit\\Runner\\GarbageCollection\\Subscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/GarbageCollection/Subscriber/Subscriber.php', + 'PHPUnit\\Runner\\GarbageCollection\\TestFinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/GarbageCollection/Subscriber/TestFinishedSubscriber.php', + 'PHPUnit\\Runner\\InvalidOrderException' => $vendorDir . '/phpunit/phpunit/src/Runner/Exception/InvalidOrderException.php', + 'PHPUnit\\Runner\\InvalidPhptFileException' => $vendorDir . '/phpunit/phpunit/src/Runner/Exception/InvalidPhptFileException.php', + 'PHPUnit\\Runner\\NoIgnoredEventException' => $vendorDir . '/phpunit/phpunit/src/Runner/Exception/NoIgnoredEventException.php', + 'PHPUnit\\Runner\\ParameterDoesNotExistException' => $vendorDir . '/phpunit/phpunit/src/Runner/Exception/ParameterDoesNotExistException.php', + 'PHPUnit\\Runner\\PhptExternalFileCannotBeLoadedException' => $vendorDir . '/phpunit/phpunit/src/Runner/Exception/PhptExternalFileCannotBeLoadedException.php', + 'PHPUnit\\Runner\\PhptTestCase' => $vendorDir . '/phpunit/phpunit/src/Runner/PhptTestCase.php', + 'PHPUnit\\Runner\\ReflectionException' => $vendorDir . '/phpunit/phpunit/src/Runner/Exception/ReflectionException.php', + 'PHPUnit\\Runner\\ResultCache\\DefaultResultCache' => $vendorDir . '/phpunit/phpunit/src/Runner/ResultCache/DefaultResultCache.php', + 'PHPUnit\\Runner\\ResultCache\\NullResultCache' => $vendorDir . '/phpunit/phpunit/src/Runner/ResultCache/NullResultCache.php', + 'PHPUnit\\Runner\\ResultCache\\ResultCache' => $vendorDir . '/phpunit/phpunit/src/Runner/ResultCache/ResultCache.php', + 'PHPUnit\\Runner\\ResultCache\\ResultCacheHandler' => $vendorDir . '/phpunit/phpunit/src/Runner/ResultCache/ResultCacheHandler.php', + 'PHPUnit\\Runner\\ResultCache\\Subscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/ResultCache/Subscriber/Subscriber.php', + 'PHPUnit\\Runner\\ResultCache\\TestConsideredRiskySubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/ResultCache/Subscriber/TestConsideredRiskySubscriber.php', + 'PHPUnit\\Runner\\ResultCache\\TestErroredSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/ResultCache/Subscriber/TestErroredSubscriber.php', + 'PHPUnit\\Runner\\ResultCache\\TestFailedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/ResultCache/Subscriber/TestFailedSubscriber.php', + 'PHPUnit\\Runner\\ResultCache\\TestFinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/ResultCache/Subscriber/TestFinishedSubscriber.php', + 'PHPUnit\\Runner\\ResultCache\\TestMarkedIncompleteSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/ResultCache/Subscriber/TestMarkedIncompleteSubscriber.php', + 'PHPUnit\\Runner\\ResultCache\\TestPreparedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/ResultCache/Subscriber/TestPreparedSubscriber.php', + 'PHPUnit\\Runner\\ResultCache\\TestSkippedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/ResultCache/Subscriber/TestSkippedSubscriber.php', + 'PHPUnit\\Runner\\ResultCache\\TestSuiteFinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/ResultCache/Subscriber/TestSuiteFinishedSubscriber.php', + 'PHPUnit\\Runner\\ResultCache\\TestSuiteStartedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/ResultCache/Subscriber/TestSuiteStartedSubscriber.php', + 'PHPUnit\\Runner\\TestSuiteLoader' => $vendorDir . '/phpunit/phpunit/src/Runner/TestSuiteLoader.php', + 'PHPUnit\\Runner\\TestSuiteSorter' => $vendorDir . '/phpunit/phpunit/src/Runner/TestSuiteSorter.php', + 'PHPUnit\\Runner\\UnsupportedPhptSectionException' => $vendorDir . '/phpunit/phpunit/src/Runner/Exception/UnsupportedPhptSectionException.php', + 'PHPUnit\\Runner\\Version' => $vendorDir . '/phpunit/phpunit/src/Runner/Version.php', + 'PHPUnit\\TestRunner\\TestResult\\BeforeTestClassMethodErroredSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/BeforeTestClassMethodErroredSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\Collector' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Collector.php', + 'PHPUnit\\TestRunner\\TestResult\\ExecutionStartedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/ExecutionStartedSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\Facade' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Facade.php', + 'PHPUnit\\TestRunner\\TestResult\\Issues\\Issue' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Issue.php', + 'PHPUnit\\TestRunner\\TestResult\\PassedTests' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/PassedTests.php', + 'PHPUnit\\TestRunner\\TestResult\\Subscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/Subscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestConsideredRiskySubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestConsideredRiskySubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestErroredSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestErroredSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestFailedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestFailedSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestFinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestFinishedSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestMarkedIncompleteSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestMarkedIncompleteSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestPreparedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestPreparedSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestResult' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/TestResult.php', + 'PHPUnit\\TestRunner\\TestResult\\TestRunnerTriggeredDeprecationSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestRunnerTriggeredDeprecationSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestRunnerTriggeredWarningSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestRunnerTriggeredWarningSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestSkippedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestSkippedSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestSuiteFinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestSuiteFinishedSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestSuiteSkippedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestSuiteSkippedSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestSuiteStartedSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestSuiteStartedSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestTriggeredDeprecationSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestTriggeredDeprecationSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestTriggeredErrorSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestTriggeredErrorSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestTriggeredNoticeSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestTriggeredNoticeSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestTriggeredPhpDeprecationSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestTriggeredPhpDeprecationSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestTriggeredPhpNoticeSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestTriggeredPhpNoticeSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestTriggeredPhpWarningSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestTriggeredPhpWarningSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestTriggeredPhpunitDeprecationSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestTriggeredPhpunitDeprecationSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestTriggeredPhpunitErrorSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestTriggeredPhpunitErrorSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestTriggeredPhpunitWarningSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestTriggeredPhpunitWarningSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestTriggeredWarningSubscriber' => $vendorDir . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestTriggeredWarningSubscriber.php', + 'PHPUnit\\TextUI\\Application' => $vendorDir . '/phpunit/phpunit/src/TextUI/Application.php', + 'PHPUnit\\TextUI\\CannotOpenSocketException' => $vendorDir . '/phpunit/phpunit/src/TextUI/Exception/CannotOpenSocketException.php', + 'PHPUnit\\TextUI\\CliArguments\\Builder' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Cli/Builder.php', + 'PHPUnit\\TextUI\\CliArguments\\Configuration' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Cli/Configuration.php', + 'PHPUnit\\TextUI\\CliArguments\\Exception' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Cli/Exception.php', + 'PHPUnit\\TextUI\\CliArguments\\XmlConfigurationFileFinder' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Cli/XmlConfigurationFileFinder.php', + 'PHPUnit\\TextUI\\Command\\AtLeastVersionCommand' => $vendorDir . '/phpunit/phpunit/src/TextUI/Command/Commands/AtLeastVersionCommand.php', + 'PHPUnit\\TextUI\\Command\\Command' => $vendorDir . '/phpunit/phpunit/src/TextUI/Command/Command.php', + 'PHPUnit\\TextUI\\Command\\GenerateConfigurationCommand' => $vendorDir . '/phpunit/phpunit/src/TextUI/Command/Commands/GenerateConfigurationCommand.php', + 'PHPUnit\\TextUI\\Command\\ListGroupsCommand' => $vendorDir . '/phpunit/phpunit/src/TextUI/Command/Commands/ListGroupsCommand.php', + 'PHPUnit\\TextUI\\Command\\ListTestSuitesCommand' => $vendorDir . '/phpunit/phpunit/src/TextUI/Command/Commands/ListTestSuitesCommand.php', + 'PHPUnit\\TextUI\\Command\\ListTestsAsTextCommand' => $vendorDir . '/phpunit/phpunit/src/TextUI/Command/Commands/ListTestsAsTextCommand.php', + 'PHPUnit\\TextUI\\Command\\ListTestsAsXmlCommand' => $vendorDir . '/phpunit/phpunit/src/TextUI/Command/Commands/ListTestsAsXmlCommand.php', + 'PHPUnit\\TextUI\\Command\\MigrateConfigurationCommand' => $vendorDir . '/phpunit/phpunit/src/TextUI/Command/Commands/MigrateConfigurationCommand.php', + 'PHPUnit\\TextUI\\Command\\Result' => $vendorDir . '/phpunit/phpunit/src/TextUI/Command/Result.php', + 'PHPUnit\\TextUI\\Command\\ShowHelpCommand' => $vendorDir . '/phpunit/phpunit/src/TextUI/Command/Commands/ShowHelpCommand.php', + 'PHPUnit\\TextUI\\Command\\ShowVersionCommand' => $vendorDir . '/phpunit/phpunit/src/TextUI/Command/Commands/ShowVersionCommand.php', + 'PHPUnit\\TextUI\\Command\\VersionCheckCommand' => $vendorDir . '/phpunit/phpunit/src/TextUI/Command/Commands/VersionCheckCommand.php', + 'PHPUnit\\TextUI\\Command\\WarmCodeCoverageCacheCommand' => $vendorDir . '/phpunit/phpunit/src/TextUI/Command/Commands/WarmCodeCoverageCacheCommand.php', + 'PHPUnit\\TextUI\\Configuration\\Builder' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Builder.php', + 'PHPUnit\\TextUI\\Configuration\\CodeCoverageFilterRegistry' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/CodeCoverageFilterRegistry.php', + 'PHPUnit\\TextUI\\Configuration\\CodeCoverageReportNotConfiguredException' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Exception/CodeCoverageReportNotConfiguredException.php', + 'PHPUnit\\TextUI\\Configuration\\Configuration' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Configuration.php', + 'PHPUnit\\TextUI\\Configuration\\ConfigurationCannotBeBuiltException' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Exception/ConfigurationCannotBeBuiltException.php', + 'PHPUnit\\TextUI\\Configuration\\Constant' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/Constant.php', + 'PHPUnit\\TextUI\\Configuration\\ConstantCollection' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/ConstantCollection.php', + 'PHPUnit\\TextUI\\Configuration\\ConstantCollectionIterator' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/ConstantCollectionIterator.php', + 'PHPUnit\\TextUI\\Configuration\\Directory' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/Directory.php', + 'PHPUnit\\TextUI\\Configuration\\DirectoryCollection' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/DirectoryCollection.php', + 'PHPUnit\\TextUI\\Configuration\\DirectoryCollectionIterator' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/DirectoryCollectionIterator.php', + 'PHPUnit\\TextUI\\Configuration\\Exception' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Exception/Exception.php', + 'PHPUnit\\TextUI\\Configuration\\ExtensionBootstrap' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/ExtensionBootstrap.php', + 'PHPUnit\\TextUI\\Configuration\\ExtensionBootstrapCollection' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/ExtensionBootstrapCollection.php', + 'PHPUnit\\TextUI\\Configuration\\ExtensionBootstrapCollectionIterator' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/ExtensionBootstrapCollectionIterator.php', + 'PHPUnit\\TextUI\\Configuration\\File' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/File.php', + 'PHPUnit\\TextUI\\Configuration\\FileCollection' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/FileCollection.php', + 'PHPUnit\\TextUI\\Configuration\\FileCollectionIterator' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/FileCollectionIterator.php', + 'PHPUnit\\TextUI\\Configuration\\FilterDirectory' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/FilterDirectory.php', + 'PHPUnit\\TextUI\\Configuration\\FilterDirectoryCollection' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/FilterDirectoryCollection.php', + 'PHPUnit\\TextUI\\Configuration\\FilterDirectoryCollectionIterator' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/FilterDirectoryCollectionIterator.php', + 'PHPUnit\\TextUI\\Configuration\\FilterNotConfiguredException' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Exception/FilterNotConfiguredException.php', + 'PHPUnit\\TextUI\\Configuration\\Group' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/Group.php', + 'PHPUnit\\TextUI\\Configuration\\GroupCollection' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/GroupCollection.php', + 'PHPUnit\\TextUI\\Configuration\\GroupCollectionIterator' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/GroupCollectionIterator.php', + 'PHPUnit\\TextUI\\Configuration\\IncludePathNotConfiguredException' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Exception/IncludePathNotConfiguredException.php', + 'PHPUnit\\TextUI\\Configuration\\IniSetting' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/IniSetting.php', + 'PHPUnit\\TextUI\\Configuration\\IniSettingCollection' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/IniSettingCollection.php', + 'PHPUnit\\TextUI\\Configuration\\IniSettingCollectionIterator' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/IniSettingCollectionIterator.php', + 'PHPUnit\\TextUI\\Configuration\\LoggingNotConfiguredException' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Exception/LoggingNotConfiguredException.php', + 'PHPUnit\\TextUI\\Configuration\\Merger' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Merger.php', + 'PHPUnit\\TextUI\\Configuration\\NoBaselineException' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Exception/NoBaselineException.php', + 'PHPUnit\\TextUI\\Configuration\\NoBootstrapException' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Exception/NoBootstrapException.php', + 'PHPUnit\\TextUI\\Configuration\\NoCacheDirectoryException' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Exception/NoCacheDirectoryException.php', + 'PHPUnit\\TextUI\\Configuration\\NoCliArgumentException' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Exception/NoCliArgumentException.php', + 'PHPUnit\\TextUI\\Configuration\\NoConfigurationFileException' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Exception/NoConfigurationFileException.php', + 'PHPUnit\\TextUI\\Configuration\\NoCoverageCacheDirectoryException' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Exception/NoCoverageCacheDirectoryException.php', + 'PHPUnit\\TextUI\\Configuration\\NoCustomCssFileException' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Exception/NoCustomCssFileException.php', + 'PHPUnit\\TextUI\\Configuration\\NoDefaultTestSuiteException' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Exception/NoDefaultTestSuiteException.php', + 'PHPUnit\\TextUI\\Configuration\\NoPharExtensionDirectoryException' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Exception/NoPharExtensionDirectoryException.php', + 'PHPUnit\\TextUI\\Configuration\\Php' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/Php.php', + 'PHPUnit\\TextUI\\Configuration\\PhpHandler' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/PhpHandler.php', + 'PHPUnit\\TextUI\\Configuration\\Registry' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Registry.php', + 'PHPUnit\\TextUI\\Configuration\\Source' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/Source.php', + 'PHPUnit\\TextUI\\Configuration\\SourceFilter' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/SourceFilter.php', + 'PHPUnit\\TextUI\\Configuration\\SourceMapper' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/SourceMapper.php', + 'PHPUnit\\TextUI\\Configuration\\TestDirectory' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/TestDirectory.php', + 'PHPUnit\\TextUI\\Configuration\\TestDirectoryCollection' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/TestDirectoryCollection.php', + 'PHPUnit\\TextUI\\Configuration\\TestDirectoryCollectionIterator' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/TestDirectoryCollectionIterator.php', + 'PHPUnit\\TextUI\\Configuration\\TestFile' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/TestFile.php', + 'PHPUnit\\TextUI\\Configuration\\TestFileCollection' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/TestFileCollection.php', + 'PHPUnit\\TextUI\\Configuration\\TestFileCollectionIterator' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/TestFileCollectionIterator.php', + 'PHPUnit\\TextUI\\Configuration\\TestSuite' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/TestSuite.php', + 'PHPUnit\\TextUI\\Configuration\\TestSuiteBuilder' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/TestSuiteBuilder.php', + 'PHPUnit\\TextUI\\Configuration\\TestSuiteCollection' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/TestSuiteCollection.php', + 'PHPUnit\\TextUI\\Configuration\\TestSuiteCollectionIterator' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/TestSuiteCollectionIterator.php', + 'PHPUnit\\TextUI\\Configuration\\Variable' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/Variable.php', + 'PHPUnit\\TextUI\\Configuration\\VariableCollection' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/VariableCollection.php', + 'PHPUnit\\TextUI\\Configuration\\VariableCollectionIterator' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Value/VariableCollectionIterator.php', + 'PHPUnit\\TextUI\\Exception' => $vendorDir . '/phpunit/phpunit/src/TextUI/Exception/Exception.php', + 'PHPUnit\\TextUI\\ExtensionsNotConfiguredException' => $vendorDir . '/phpunit/phpunit/src/TextUI/Exception/ExtensionsNotConfiguredException.php', + 'PHPUnit\\TextUI\\Help' => $vendorDir . '/phpunit/phpunit/src/TextUI/Help.php', + 'PHPUnit\\TextUI\\InvalidSocketException' => $vendorDir . '/phpunit/phpunit/src/TextUI/Exception/InvalidSocketException.php', + 'PHPUnit\\TextUI\\Output\\DefaultPrinter' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Printer/DefaultPrinter.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\BeforeTestClassMethodErroredSubscriber' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/BeforeTestClassMethodErroredSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\ProgressPrinter' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/ProgressPrinter.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\Subscriber' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/Subscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestConsideredRiskySubscriber' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestConsideredRiskySubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestErroredSubscriber' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestErroredSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestFailedSubscriber' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestFailedSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestFinishedSubscriber' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestFinishedSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestMarkedIncompleteSubscriber' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestMarkedIncompleteSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestPreparedSubscriber' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestPreparedSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestRunnerExecutionStartedSubscriber' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestRunnerExecutionStartedSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestSkippedSubscriber' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestSkippedSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestTriggeredDeprecationSubscriber' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestTriggeredDeprecationSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestTriggeredErrorSubscriber' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestTriggeredErrorSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestTriggeredNoticeSubscriber' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestTriggeredNoticeSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestTriggeredPhpDeprecationSubscriber' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestTriggeredPhpDeprecationSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestTriggeredPhpNoticeSubscriber' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestTriggeredPhpNoticeSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestTriggeredPhpWarningSubscriber' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestTriggeredPhpWarningSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestTriggeredPhpunitDeprecationSubscriber' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestTriggeredPhpunitDeprecationSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestTriggeredPhpunitWarningSubscriber' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestTriggeredPhpunitWarningSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestTriggeredWarningSubscriber' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestTriggeredWarningSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ResultPrinter' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Default/ResultPrinter.php', + 'PHPUnit\\TextUI\\Output\\Default\\UnexpectedOutputPrinter' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Default/UnexpectedOutputPrinter.php', + 'PHPUnit\\TextUI\\Output\\Facade' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Facade.php', + 'PHPUnit\\TextUI\\Output\\NullPrinter' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Printer/NullPrinter.php', + 'PHPUnit\\TextUI\\Output\\Printer' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/Printer/Printer.php', + 'PHPUnit\\TextUI\\Output\\SummaryPrinter' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/SummaryPrinter.php', + 'PHPUnit\\TextUI\\Output\\TestDox\\ResultPrinter' => $vendorDir . '/phpunit/phpunit/src/TextUI/Output/TestDox/ResultPrinter.php', + 'PHPUnit\\TextUI\\ReflectionException' => $vendorDir . '/phpunit/phpunit/src/TextUI/Exception/ReflectionException.php', + 'PHPUnit\\TextUI\\RuntimeException' => $vendorDir . '/phpunit/phpunit/src/TextUI/Exception/RuntimeException.php', + 'PHPUnit\\TextUI\\ShellExitCodeCalculator' => $vendorDir . '/phpunit/phpunit/src/TextUI/ShellExitCodeCalculator.php', + 'PHPUnit\\TextUI\\TestDirectoryNotFoundException' => $vendorDir . '/phpunit/phpunit/src/TextUI/Exception/TestDirectoryNotFoundException.php', + 'PHPUnit\\TextUI\\TestFileNotFoundException' => $vendorDir . '/phpunit/phpunit/src/TextUI/Exception/TestFileNotFoundException.php', + 'PHPUnit\\TextUI\\TestRunner' => $vendorDir . '/phpunit/phpunit/src/TextUI/TestRunner.php', + 'PHPUnit\\TextUI\\TestSuiteFilterProcessor' => $vendorDir . '/phpunit/phpunit/src/TextUI/TestSuiteFilterProcessor.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CannotFindSchemaException' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Exception/CannotFindSchemaException.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CodeCoverage\\CodeCoverage' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/CodeCoverage/CodeCoverage.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CodeCoverage\\Report\\Clover' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/CodeCoverage/Report/Clover.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CodeCoverage\\Report\\Cobertura' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/CodeCoverage/Report/Cobertura.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CodeCoverage\\Report\\Crap4j' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/CodeCoverage/Report/Crap4j.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CodeCoverage\\Report\\Html' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/CodeCoverage/Report/Html.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CodeCoverage\\Report\\Php' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/CodeCoverage/Report/Php.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CodeCoverage\\Report\\Text' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/CodeCoverage/Report/Text.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CodeCoverage\\Report\\Xml' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/CodeCoverage/Report/Xml.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Configuration' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Configuration.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\ConvertLogTypes' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/ConvertLogTypes.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CoverageCloverToReport' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/CoverageCloverToReport.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CoverageCrap4jToReport' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/CoverageCrap4jToReport.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CoverageHtmlToReport' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/CoverageHtmlToReport.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CoveragePhpToReport' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/CoveragePhpToReport.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CoverageTextToReport' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/CoverageTextToReport.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CoverageXmlToReport' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/CoverageXmlToReport.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\DefaultConfiguration' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/DefaultConfiguration.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Exception' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Exception.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\FailedSchemaDetectionResult' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/SchemaDetector/FailedSchemaDetectionResult.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Generator' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Generator.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Groups' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Groups.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\IntroduceCacheDirectoryAttribute' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/IntroduceCacheDirectoryAttribute.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\IntroduceCoverageElement' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/IntroduceCoverageElement.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\LoadedFromFileConfiguration' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/LoadedFromFileConfiguration.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Loader' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Loader.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\LogToReportMigration' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/LogToReportMigration.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Logging\\Junit' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Logging/Junit.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Logging\\Logging' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Logging/Logging.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Logging\\TeamCity' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Logging/TeamCity.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Logging\\TestDox\\Html' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Logging/TestDox/Html.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Logging\\TestDox\\Text' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Logging/TestDox/Text.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Migration' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/Migration.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\MigrationBuilder' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/MigrationBuilder.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\MigrationBuilderException' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/MigrationBuilderException.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\MigrationException' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/MigrationException.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Migrator' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrator.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\MoveAttributesFromFilterWhitelistToCoverage' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/MoveAttributesFromFilterWhitelistToCoverage.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\MoveAttributesFromRootToCoverage' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/MoveAttributesFromRootToCoverage.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\MoveCoverageDirectoriesToSource' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/MoveCoverageDirectoriesToSource.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\MoveWhitelistExcludesToCoverage' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/MoveWhitelistExcludesToCoverage.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\MoveWhitelistIncludesToCoverage' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/MoveWhitelistIncludesToCoverage.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\PHPUnit' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/PHPUnit.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveBeStrictAboutResourceUsageDuringSmallTestsAttribute' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveBeStrictAboutResourceUsageDuringSmallTestsAttribute.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveBeStrictAboutTodoAnnotatedTestsAttribute' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveBeStrictAboutTodoAnnotatedTestsAttribute.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveCacheResultFileAttribute' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveCacheResultFileAttribute.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveCacheTokensAttribute' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveCacheTokensAttribute.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveConversionToExceptionsAttributes' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveConversionToExceptionsAttributes.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveCoverageElementCacheDirectoryAttribute' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveCoverageElementCacheDirectoryAttribute.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveCoverageElementProcessUncoveredFilesAttribute' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveCoverageElementProcessUncoveredFilesAttribute.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveEmptyFilter' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveEmptyFilter.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveListeners' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveListeners.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveLogTypes' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveLogTypes.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveLoggingElements' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveLoggingElements.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveNoInteractionAttribute' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveNoInteractionAttribute.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemovePrinterAttributes' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemovePrinterAttributes.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveTestDoxGroupsElement' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveTestDoxGroupsElement.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveTestSuiteLoaderAttributes' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveTestSuiteLoaderAttributes.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveVerboseAttribute' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveVerboseAttribute.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RenameBackupStaticAttributesAttribute' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RenameBackupStaticAttributesAttribute.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RenameBeStrictAboutCoversAnnotationAttribute' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RenameBeStrictAboutCoversAnnotationAttribute.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RenameForceCoversAnnotationAttribute' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RenameForceCoversAnnotationAttribute.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\SchemaDetectionResult' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/SchemaDetector/SchemaDetectionResult.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\SchemaDetector' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/SchemaDetector/SchemaDetector.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\SchemaFinder' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/SchemaFinder.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\SnapshotNodeList' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/SnapshotNodeList.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\SuccessfulSchemaDetectionResult' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/SchemaDetector/SuccessfulSchemaDetectionResult.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\TestSuiteMapper' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/TestSuiteMapper.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\UpdateSchemaLocation' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/UpdateSchemaLocation.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\ValidationResult' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Validator/ValidationResult.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Validator' => $vendorDir . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Validator/Validator.php', + 'PHPUnit\\Util\\Cloner' => $vendorDir . '/phpunit/phpunit/src/Util/Cloner.php', + 'PHPUnit\\Util\\Color' => $vendorDir . '/phpunit/phpunit/src/Util/Color.php', + 'PHPUnit\\Util\\Exception' => $vendorDir . '/phpunit/phpunit/src/Util/Exception/Exception.php', + 'PHPUnit\\Util\\ExcludeList' => $vendorDir . '/phpunit/phpunit/src/Util/ExcludeList.php', + 'PHPUnit\\Util\\Exporter' => $vendorDir . '/phpunit/phpunit/src/Util/Exporter.php', + 'PHPUnit\\Util\\Filesystem' => $vendorDir . '/phpunit/phpunit/src/Util/Filesystem.php', + 'PHPUnit\\Util\\Filter' => $vendorDir . '/phpunit/phpunit/src/Util/Filter.php', + 'PHPUnit\\Util\\GlobalState' => $vendorDir . '/phpunit/phpunit/src/Util/GlobalState.php', + 'PHPUnit\\Util\\InvalidDirectoryException' => $vendorDir . '/phpunit/phpunit/src/Util/Exception/InvalidDirectoryException.php', + 'PHPUnit\\Util\\InvalidJsonException' => $vendorDir . '/phpunit/phpunit/src/Util/Exception/InvalidJsonException.php', + 'PHPUnit\\Util\\InvalidVersionOperatorException' => $vendorDir . '/phpunit/phpunit/src/Util/Exception/InvalidVersionOperatorException.php', + 'PHPUnit\\Util\\Json' => $vendorDir . '/phpunit/phpunit/src/Util/Json.php', + 'PHPUnit\\Util\\PHP\\AbstractPhpProcess' => $vendorDir . '/phpunit/phpunit/src/Util/PHP/AbstractPhpProcess.php', + 'PHPUnit\\Util\\PHP\\DefaultPhpProcess' => $vendorDir . '/phpunit/phpunit/src/Util/PHP/DefaultPhpProcess.php', + 'PHPUnit\\Util\\PHP\\PhpProcessException' => $vendorDir . '/phpunit/phpunit/src/Util/Exception/PhpProcessException.php', + 'PHPUnit\\Util\\Reflection' => $vendorDir . '/phpunit/phpunit/src/Util/Reflection.php', + 'PHPUnit\\Util\\Test' => $vendorDir . '/phpunit/phpunit/src/Util/Test.php', + 'PHPUnit\\Util\\ThrowableToStringMapper' => $vendorDir . '/phpunit/phpunit/src/Util/ThrowableToStringMapper.php', + 'PHPUnit\\Util\\VersionComparisonOperator' => $vendorDir . '/phpunit/phpunit/src/Util/VersionComparisonOperator.php', + 'PHPUnit\\Util\\Xml' => $vendorDir . '/phpunit/phpunit/src/Util/Xml/Xml.php', + 'PHPUnit\\Util\\Xml\\Loader' => $vendorDir . '/phpunit/phpunit/src/Util/Xml/Loader.php', + 'PHPUnit\\Util\\Xml\\XmlException' => $vendorDir . '/phpunit/phpunit/src/Util/Exception/XmlException.php', + 'PharIo\\Manifest\\Application' => $vendorDir . '/phar-io/manifest/src/values/Application.php', + 'PharIo\\Manifest\\ApplicationName' => $vendorDir . '/phar-io/manifest/src/values/ApplicationName.php', + 'PharIo\\Manifest\\Author' => $vendorDir . '/phar-io/manifest/src/values/Author.php', + 'PharIo\\Manifest\\AuthorCollection' => $vendorDir . '/phar-io/manifest/src/values/AuthorCollection.php', + 'PharIo\\Manifest\\AuthorCollectionIterator' => $vendorDir . '/phar-io/manifest/src/values/AuthorCollectionIterator.php', + 'PharIo\\Manifest\\AuthorElement' => $vendorDir . '/phar-io/manifest/src/xml/AuthorElement.php', + 'PharIo\\Manifest\\AuthorElementCollection' => $vendorDir . '/phar-io/manifest/src/xml/AuthorElementCollection.php', + 'PharIo\\Manifest\\BundledComponent' => $vendorDir . '/phar-io/manifest/src/values/BundledComponent.php', + 'PharIo\\Manifest\\BundledComponentCollection' => $vendorDir . '/phar-io/manifest/src/values/BundledComponentCollection.php', + 'PharIo\\Manifest\\BundledComponentCollectionIterator' => $vendorDir . '/phar-io/manifest/src/values/BundledComponentCollectionIterator.php', + 'PharIo\\Manifest\\BundlesElement' => $vendorDir . '/phar-io/manifest/src/xml/BundlesElement.php', + 'PharIo\\Manifest\\ComponentElement' => $vendorDir . '/phar-io/manifest/src/xml/ComponentElement.php', + 'PharIo\\Manifest\\ComponentElementCollection' => $vendorDir . '/phar-io/manifest/src/xml/ComponentElementCollection.php', + 'PharIo\\Manifest\\ContainsElement' => $vendorDir . '/phar-io/manifest/src/xml/ContainsElement.php', + 'PharIo\\Manifest\\CopyrightElement' => $vendorDir . '/phar-io/manifest/src/xml/CopyrightElement.php', + 'PharIo\\Manifest\\CopyrightInformation' => $vendorDir . '/phar-io/manifest/src/values/CopyrightInformation.php', + 'PharIo\\Manifest\\ElementCollection' => $vendorDir . '/phar-io/manifest/src/xml/ElementCollection.php', + 'PharIo\\Manifest\\ElementCollectionException' => $vendorDir . '/phar-io/manifest/src/exceptions/ElementCollectionException.php', + 'PharIo\\Manifest\\Email' => $vendorDir . '/phar-io/manifest/src/values/Email.php', + 'PharIo\\Manifest\\Exception' => $vendorDir . '/phar-io/manifest/src/exceptions/Exception.php', + 'PharIo\\Manifest\\ExtElement' => $vendorDir . '/phar-io/manifest/src/xml/ExtElement.php', + 'PharIo\\Manifest\\ExtElementCollection' => $vendorDir . '/phar-io/manifest/src/xml/ExtElementCollection.php', + 'PharIo\\Manifest\\Extension' => $vendorDir . '/phar-io/manifest/src/values/Extension.php', + 'PharIo\\Manifest\\ExtensionElement' => $vendorDir . '/phar-io/manifest/src/xml/ExtensionElement.php', + 'PharIo\\Manifest\\InvalidApplicationNameException' => $vendorDir . '/phar-io/manifest/src/exceptions/InvalidApplicationNameException.php', + 'PharIo\\Manifest\\InvalidEmailException' => $vendorDir . '/phar-io/manifest/src/exceptions/InvalidEmailException.php', + 'PharIo\\Manifest\\InvalidUrlException' => $vendorDir . '/phar-io/manifest/src/exceptions/InvalidUrlException.php', + 'PharIo\\Manifest\\Library' => $vendorDir . '/phar-io/manifest/src/values/Library.php', + 'PharIo\\Manifest\\License' => $vendorDir . '/phar-io/manifest/src/values/License.php', + 'PharIo\\Manifest\\LicenseElement' => $vendorDir . '/phar-io/manifest/src/xml/LicenseElement.php', + 'PharIo\\Manifest\\Manifest' => $vendorDir . '/phar-io/manifest/src/values/Manifest.php', + 'PharIo\\Manifest\\ManifestDocument' => $vendorDir . '/phar-io/manifest/src/xml/ManifestDocument.php', + 'PharIo\\Manifest\\ManifestDocumentException' => $vendorDir . '/phar-io/manifest/src/exceptions/ManifestDocumentException.php', + 'PharIo\\Manifest\\ManifestDocumentLoadingException' => $vendorDir . '/phar-io/manifest/src/exceptions/ManifestDocumentLoadingException.php', + 'PharIo\\Manifest\\ManifestDocumentMapper' => $vendorDir . '/phar-io/manifest/src/ManifestDocumentMapper.php', + 'PharIo\\Manifest\\ManifestDocumentMapperException' => $vendorDir . '/phar-io/manifest/src/exceptions/ManifestDocumentMapperException.php', + 'PharIo\\Manifest\\ManifestElement' => $vendorDir . '/phar-io/manifest/src/xml/ManifestElement.php', + 'PharIo\\Manifest\\ManifestElementException' => $vendorDir . '/phar-io/manifest/src/exceptions/ManifestElementException.php', + 'PharIo\\Manifest\\ManifestLoader' => $vendorDir . '/phar-io/manifest/src/ManifestLoader.php', + 'PharIo\\Manifest\\ManifestLoaderException' => $vendorDir . '/phar-io/manifest/src/exceptions/ManifestLoaderException.php', + 'PharIo\\Manifest\\ManifestSerializer' => $vendorDir . '/phar-io/manifest/src/ManifestSerializer.php', + 'PharIo\\Manifest\\NoEmailAddressException' => $vendorDir . '/phar-io/manifest/src/exceptions/NoEmailAddressException.php', + 'PharIo\\Manifest\\PhpElement' => $vendorDir . '/phar-io/manifest/src/xml/PhpElement.php', + 'PharIo\\Manifest\\PhpExtensionRequirement' => $vendorDir . '/phar-io/manifest/src/values/PhpExtensionRequirement.php', + 'PharIo\\Manifest\\PhpVersionRequirement' => $vendorDir . '/phar-io/manifest/src/values/PhpVersionRequirement.php', + 'PharIo\\Manifest\\Requirement' => $vendorDir . '/phar-io/manifest/src/values/Requirement.php', + 'PharIo\\Manifest\\RequirementCollection' => $vendorDir . '/phar-io/manifest/src/values/RequirementCollection.php', + 'PharIo\\Manifest\\RequirementCollectionIterator' => $vendorDir . '/phar-io/manifest/src/values/RequirementCollectionIterator.php', + 'PharIo\\Manifest\\RequiresElement' => $vendorDir . '/phar-io/manifest/src/xml/RequiresElement.php', + 'PharIo\\Manifest\\Type' => $vendorDir . '/phar-io/manifest/src/values/Type.php', + 'PharIo\\Manifest\\Url' => $vendorDir . '/phar-io/manifest/src/values/Url.php', + 'PharIo\\Version\\AbstractVersionConstraint' => $vendorDir . '/phar-io/version/src/constraints/AbstractVersionConstraint.php', + 'PharIo\\Version\\AndVersionConstraintGroup' => $vendorDir . '/phar-io/version/src/constraints/AndVersionConstraintGroup.php', + 'PharIo\\Version\\AnyVersionConstraint' => $vendorDir . '/phar-io/version/src/constraints/AnyVersionConstraint.php', + 'PharIo\\Version\\BuildMetaData' => $vendorDir . '/phar-io/version/src/BuildMetaData.php', + 'PharIo\\Version\\ExactVersionConstraint' => $vendorDir . '/phar-io/version/src/constraints/ExactVersionConstraint.php', + 'PharIo\\Version\\Exception' => $vendorDir . '/phar-io/version/src/exceptions/Exception.php', + 'PharIo\\Version\\GreaterThanOrEqualToVersionConstraint' => $vendorDir . '/phar-io/version/src/constraints/GreaterThanOrEqualToVersionConstraint.php', + 'PharIo\\Version\\InvalidPreReleaseSuffixException' => $vendorDir . '/phar-io/version/src/exceptions/InvalidPreReleaseSuffixException.php', + 'PharIo\\Version\\InvalidVersionException' => $vendorDir . '/phar-io/version/src/exceptions/InvalidVersionException.php', + 'PharIo\\Version\\NoBuildMetaDataException' => $vendorDir . '/phar-io/version/src/exceptions/NoBuildMetaDataException.php', + 'PharIo\\Version\\NoPreReleaseSuffixException' => $vendorDir . '/phar-io/version/src/exceptions/NoPreReleaseSuffixException.php', + 'PharIo\\Version\\OrVersionConstraintGroup' => $vendorDir . '/phar-io/version/src/constraints/OrVersionConstraintGroup.php', + 'PharIo\\Version\\PreReleaseSuffix' => $vendorDir . '/phar-io/version/src/PreReleaseSuffix.php', + 'PharIo\\Version\\SpecificMajorAndMinorVersionConstraint' => $vendorDir . '/phar-io/version/src/constraints/SpecificMajorAndMinorVersionConstraint.php', + 'PharIo\\Version\\SpecificMajorVersionConstraint' => $vendorDir . '/phar-io/version/src/constraints/SpecificMajorVersionConstraint.php', + 'PharIo\\Version\\UnsupportedVersionConstraintException' => $vendorDir . '/phar-io/version/src/exceptions/UnsupportedVersionConstraintException.php', + 'PharIo\\Version\\Version' => $vendorDir . '/phar-io/version/src/Version.php', + 'PharIo\\Version\\VersionConstraint' => $vendorDir . '/phar-io/version/src/constraints/VersionConstraint.php', + 'PharIo\\Version\\VersionConstraintParser' => $vendorDir . '/phar-io/version/src/VersionConstraintParser.php', + 'PharIo\\Version\\VersionConstraintValue' => $vendorDir . '/phar-io/version/src/VersionConstraintValue.php', + 'PharIo\\Version\\VersionNumber' => $vendorDir . '/phar-io/version/src/VersionNumber.php', + 'PhpToken' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php', + 'SQLite3Exception' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/SQLite3Exception.php', + 'SebastianBergmann\\CliParser\\AmbiguousOptionException' => $vendorDir . '/sebastian/cli-parser/src/exceptions/AmbiguousOptionException.php', + 'SebastianBergmann\\CliParser\\Exception' => $vendorDir . '/sebastian/cli-parser/src/exceptions/Exception.php', + 'SebastianBergmann\\CliParser\\OptionDoesNotAllowArgumentException' => $vendorDir . '/sebastian/cli-parser/src/exceptions/OptionDoesNotAllowArgumentException.php', + 'SebastianBergmann\\CliParser\\Parser' => $vendorDir . '/sebastian/cli-parser/src/Parser.php', + 'SebastianBergmann\\CliParser\\RequiredOptionArgumentMissingException' => $vendorDir . '/sebastian/cli-parser/src/exceptions/RequiredOptionArgumentMissingException.php', + 'SebastianBergmann\\CliParser\\UnknownOptionException' => $vendorDir . '/sebastian/cli-parser/src/exceptions/UnknownOptionException.php', + 'SebastianBergmann\\CodeCoverage\\BranchAndPathCoverageNotSupportedException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/BranchAndPathCoverageNotSupportedException.php', + 'SebastianBergmann\\CodeCoverage\\CodeCoverage' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage.php', + 'SebastianBergmann\\CodeCoverage\\Data\\ProcessedCodeCoverageData' => $vendorDir . '/phpunit/php-code-coverage/src/Data/ProcessedCodeCoverageData.php', + 'SebastianBergmann\\CodeCoverage\\Data\\RawCodeCoverageData' => $vendorDir . '/phpunit/php-code-coverage/src/Data/RawCodeCoverageData.php', + 'SebastianBergmann\\CodeCoverage\\DeadCodeDetectionNotSupportedException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/DeadCodeDetectionNotSupportedException.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\Driver' => $vendorDir . '/phpunit/php-code-coverage/src/Driver/Driver.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\PathExistsButIsNotDirectoryException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/PathExistsButIsNotDirectoryException.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\PcovDriver' => $vendorDir . '/phpunit/php-code-coverage/src/Driver/PcovDriver.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\PcovNotAvailableException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/PcovNotAvailableException.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\Selector' => $vendorDir . '/phpunit/php-code-coverage/src/Driver/Selector.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\WriteOperationFailedException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/WriteOperationFailedException.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\XdebugDriver' => $vendorDir . '/phpunit/php-code-coverage/src/Driver/XdebugDriver.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\XdebugNotAvailableException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/XdebugNotAvailableException.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\XdebugNotEnabledException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/XdebugNotEnabledException.php', + 'SebastianBergmann\\CodeCoverage\\Exception' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/Exception.php', + 'SebastianBergmann\\CodeCoverage\\FileCouldNotBeWrittenException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/FileCouldNotBeWrittenException.php', + 'SebastianBergmann\\CodeCoverage\\Filter' => $vendorDir . '/phpunit/php-code-coverage/src/Filter.php', + 'SebastianBergmann\\CodeCoverage\\InvalidArgumentException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/InvalidArgumentException.php', + 'SebastianBergmann\\CodeCoverage\\NoCodeCoverageDriverAvailableException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/NoCodeCoverageDriverAvailableException.php', + 'SebastianBergmann\\CodeCoverage\\NoCodeCoverageDriverWithPathCoverageSupportAvailableException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/NoCodeCoverageDriverWithPathCoverageSupportAvailableException.php', + 'SebastianBergmann\\CodeCoverage\\Node\\AbstractNode' => $vendorDir . '/phpunit/php-code-coverage/src/Node/AbstractNode.php', + 'SebastianBergmann\\CodeCoverage\\Node\\Builder' => $vendorDir . '/phpunit/php-code-coverage/src/Node/Builder.php', + 'SebastianBergmann\\CodeCoverage\\Node\\CrapIndex' => $vendorDir . '/phpunit/php-code-coverage/src/Node/CrapIndex.php', + 'SebastianBergmann\\CodeCoverage\\Node\\Directory' => $vendorDir . '/phpunit/php-code-coverage/src/Node/Directory.php', + 'SebastianBergmann\\CodeCoverage\\Node\\File' => $vendorDir . '/phpunit/php-code-coverage/src/Node/File.php', + 'SebastianBergmann\\CodeCoverage\\Node\\Iterator' => $vendorDir . '/phpunit/php-code-coverage/src/Node/Iterator.php', + 'SebastianBergmann\\CodeCoverage\\ParserException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/ParserException.php', + 'SebastianBergmann\\CodeCoverage\\ReflectionException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/ReflectionException.php', + 'SebastianBergmann\\CodeCoverage\\ReportAlreadyFinalizedException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/ReportAlreadyFinalizedException.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Clover' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Clover.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Cobertura' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Cobertura.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Crap4j' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Crap4j.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Colors' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Colors.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\CustomCssFile' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/CustomCssFile.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Dashboard' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Renderer/Dashboard.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Directory' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Renderer/Directory.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Facade' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Facade.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\File' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Renderer' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Renderer.php', + 'SebastianBergmann\\CodeCoverage\\Report\\PHP' => $vendorDir . '/phpunit/php-code-coverage/src/Report/PHP.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Text' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Text.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Thresholds' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Thresholds.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\BuildInformation' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/BuildInformation.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Coverage' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Coverage.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Directory' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Directory.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Facade' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Facade.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\File' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/File.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Method' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Method.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Node' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Node.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Project' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Project.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Report' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Report.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Source' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Source.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Tests' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Tests.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Totals' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Totals.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Unit' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Unit.php', + 'SebastianBergmann\\CodeCoverage\\StaticAnalysisCacheNotConfiguredException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/StaticAnalysisCacheNotConfiguredException.php', + 'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\CacheWarmer' => $vendorDir . '/phpunit/php-code-coverage/src/StaticAnalysis/CacheWarmer.php', + 'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\CachingFileAnalyser' => $vendorDir . '/phpunit/php-code-coverage/src/StaticAnalysis/CachingFileAnalyser.php', + 'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\CodeUnitFindingVisitor' => $vendorDir . '/phpunit/php-code-coverage/src/StaticAnalysis/CodeUnitFindingVisitor.php', + 'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\ExecutableLinesFindingVisitor' => $vendorDir . '/phpunit/php-code-coverage/src/StaticAnalysis/ExecutableLinesFindingVisitor.php', + 'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\FileAnalyser' => $vendorDir . '/phpunit/php-code-coverage/src/StaticAnalysis/FileAnalyser.php', + 'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\IgnoredLinesFindingVisitor' => $vendorDir . '/phpunit/php-code-coverage/src/StaticAnalysis/IgnoredLinesFindingVisitor.php', + 'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\ParsingFileAnalyser' => $vendorDir . '/phpunit/php-code-coverage/src/StaticAnalysis/ParsingFileAnalyser.php', + 'SebastianBergmann\\CodeCoverage\\TestIdMissingException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/TestIdMissingException.php', + 'SebastianBergmann\\CodeCoverage\\Test\\TestSize\\Known' => $vendorDir . '/phpunit/php-code-coverage/src/TestSize/Known.php', + 'SebastianBergmann\\CodeCoverage\\Test\\TestSize\\Large' => $vendorDir . '/phpunit/php-code-coverage/src/TestSize/Large.php', + 'SebastianBergmann\\CodeCoverage\\Test\\TestSize\\Medium' => $vendorDir . '/phpunit/php-code-coverage/src/TestSize/Medium.php', + 'SebastianBergmann\\CodeCoverage\\Test\\TestSize\\Small' => $vendorDir . '/phpunit/php-code-coverage/src/TestSize/Small.php', + 'SebastianBergmann\\CodeCoverage\\Test\\TestSize\\TestSize' => $vendorDir . '/phpunit/php-code-coverage/src/TestSize/TestSize.php', + 'SebastianBergmann\\CodeCoverage\\Test\\TestSize\\Unknown' => $vendorDir . '/phpunit/php-code-coverage/src/TestSize/Unknown.php', + 'SebastianBergmann\\CodeCoverage\\Test\\TestStatus\\Failure' => $vendorDir . '/phpunit/php-code-coverage/src/TestStatus/Failure.php', + 'SebastianBergmann\\CodeCoverage\\Test\\TestStatus\\Known' => $vendorDir . '/phpunit/php-code-coverage/src/TestStatus/Known.php', + 'SebastianBergmann\\CodeCoverage\\Test\\TestStatus\\Success' => $vendorDir . '/phpunit/php-code-coverage/src/TestStatus/Success.php', + 'SebastianBergmann\\CodeCoverage\\Test\\TestStatus\\TestStatus' => $vendorDir . '/phpunit/php-code-coverage/src/TestStatus/TestStatus.php', + 'SebastianBergmann\\CodeCoverage\\Test\\TestStatus\\Unknown' => $vendorDir . '/phpunit/php-code-coverage/src/TestStatus/Unknown.php', + 'SebastianBergmann\\CodeCoverage\\UnintentionallyCoveredCodeException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/UnintentionallyCoveredCodeException.php', + 'SebastianBergmann\\CodeCoverage\\Util\\DirectoryCouldNotBeCreatedException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/DirectoryCouldNotBeCreatedException.php', + 'SebastianBergmann\\CodeCoverage\\Util\\Filesystem' => $vendorDir . '/phpunit/php-code-coverage/src/Util/Filesystem.php', + 'SebastianBergmann\\CodeCoverage\\Util\\Percentage' => $vendorDir . '/phpunit/php-code-coverage/src/Util/Percentage.php', + 'SebastianBergmann\\CodeCoverage\\Version' => $vendorDir . '/phpunit/php-code-coverage/src/Version.php', + 'SebastianBergmann\\CodeCoverage\\XmlException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/XmlException.php', + 'SebastianBergmann\\CodeUnitReverseLookup\\Wizard' => $vendorDir . '/sebastian/code-unit-reverse-lookup/src/Wizard.php', + 'SebastianBergmann\\CodeUnit\\ClassMethodUnit' => $vendorDir . '/sebastian/code-unit/src/ClassMethodUnit.php', + 'SebastianBergmann\\CodeUnit\\ClassUnit' => $vendorDir . '/sebastian/code-unit/src/ClassUnit.php', + 'SebastianBergmann\\CodeUnit\\CodeUnit' => $vendorDir . '/sebastian/code-unit/src/CodeUnit.php', + 'SebastianBergmann\\CodeUnit\\CodeUnitCollection' => $vendorDir . '/sebastian/code-unit/src/CodeUnitCollection.php', + 'SebastianBergmann\\CodeUnit\\CodeUnitCollectionIterator' => $vendorDir . '/sebastian/code-unit/src/CodeUnitCollectionIterator.php', + 'SebastianBergmann\\CodeUnit\\Exception' => $vendorDir . '/sebastian/code-unit/src/exceptions/Exception.php', + 'SebastianBergmann\\CodeUnit\\FileUnit' => $vendorDir . '/sebastian/code-unit/src/FileUnit.php', + 'SebastianBergmann\\CodeUnit\\FunctionUnit' => $vendorDir . '/sebastian/code-unit/src/FunctionUnit.php', + 'SebastianBergmann\\CodeUnit\\InterfaceMethodUnit' => $vendorDir . '/sebastian/code-unit/src/InterfaceMethodUnit.php', + 'SebastianBergmann\\CodeUnit\\InterfaceUnit' => $vendorDir . '/sebastian/code-unit/src/InterfaceUnit.php', + 'SebastianBergmann\\CodeUnit\\InvalidCodeUnitException' => $vendorDir . '/sebastian/code-unit/src/exceptions/InvalidCodeUnitException.php', + 'SebastianBergmann\\CodeUnit\\Mapper' => $vendorDir . '/sebastian/code-unit/src/Mapper.php', + 'SebastianBergmann\\CodeUnit\\NoTraitException' => $vendorDir . '/sebastian/code-unit/src/exceptions/NoTraitException.php', + 'SebastianBergmann\\CodeUnit\\ReflectionException' => $vendorDir . '/sebastian/code-unit/src/exceptions/ReflectionException.php', + 'SebastianBergmann\\CodeUnit\\TraitMethodUnit' => $vendorDir . '/sebastian/code-unit/src/TraitMethodUnit.php', + 'SebastianBergmann\\CodeUnit\\TraitUnit' => $vendorDir . '/sebastian/code-unit/src/TraitUnit.php', + 'SebastianBergmann\\Comparator\\ArrayComparator' => $vendorDir . '/sebastian/comparator/src/ArrayComparator.php', + 'SebastianBergmann\\Comparator\\Comparator' => $vendorDir . '/sebastian/comparator/src/Comparator.php', + 'SebastianBergmann\\Comparator\\ComparisonFailure' => $vendorDir . '/sebastian/comparator/src/ComparisonFailure.php', + 'SebastianBergmann\\Comparator\\DOMNodeComparator' => $vendorDir . '/sebastian/comparator/src/DOMNodeComparator.php', + 'SebastianBergmann\\Comparator\\DateTimeComparator' => $vendorDir . '/sebastian/comparator/src/DateTimeComparator.php', + 'SebastianBergmann\\Comparator\\Exception' => $vendorDir . '/sebastian/comparator/src/exceptions/Exception.php', + 'SebastianBergmann\\Comparator\\ExceptionComparator' => $vendorDir . '/sebastian/comparator/src/ExceptionComparator.php', + 'SebastianBergmann\\Comparator\\Factory' => $vendorDir . '/sebastian/comparator/src/Factory.php', + 'SebastianBergmann\\Comparator\\MockObjectComparator' => $vendorDir . '/sebastian/comparator/src/MockObjectComparator.php', + 'SebastianBergmann\\Comparator\\NumericComparator' => $vendorDir . '/sebastian/comparator/src/NumericComparator.php', + 'SebastianBergmann\\Comparator\\ObjectComparator' => $vendorDir . '/sebastian/comparator/src/ObjectComparator.php', + 'SebastianBergmann\\Comparator\\ResourceComparator' => $vendorDir . '/sebastian/comparator/src/ResourceComparator.php', + 'SebastianBergmann\\Comparator\\RuntimeException' => $vendorDir . '/sebastian/comparator/src/exceptions/RuntimeException.php', + 'SebastianBergmann\\Comparator\\ScalarComparator' => $vendorDir . '/sebastian/comparator/src/ScalarComparator.php', + 'SebastianBergmann\\Comparator\\SplObjectStorageComparator' => $vendorDir . '/sebastian/comparator/src/SplObjectStorageComparator.php', + 'SebastianBergmann\\Comparator\\TypeComparator' => $vendorDir . '/sebastian/comparator/src/TypeComparator.php', + 'SebastianBergmann\\Complexity\\Calculator' => $vendorDir . '/sebastian/complexity/src/Calculator.php', + 'SebastianBergmann\\Complexity\\Complexity' => $vendorDir . '/sebastian/complexity/src/Complexity/Complexity.php', + 'SebastianBergmann\\Complexity\\ComplexityCalculatingVisitor' => $vendorDir . '/sebastian/complexity/src/Visitor/ComplexityCalculatingVisitor.php', + 'SebastianBergmann\\Complexity\\ComplexityCollection' => $vendorDir . '/sebastian/complexity/src/Complexity/ComplexityCollection.php', + 'SebastianBergmann\\Complexity\\ComplexityCollectionIterator' => $vendorDir . '/sebastian/complexity/src/Complexity/ComplexityCollectionIterator.php', + 'SebastianBergmann\\Complexity\\CyclomaticComplexityCalculatingVisitor' => $vendorDir . '/sebastian/complexity/src/Visitor/CyclomaticComplexityCalculatingVisitor.php', + 'SebastianBergmann\\Complexity\\Exception' => $vendorDir . '/sebastian/complexity/src/Exception/Exception.php', + 'SebastianBergmann\\Complexity\\RuntimeException' => $vendorDir . '/sebastian/complexity/src/Exception/RuntimeException.php', + 'SebastianBergmann\\Diff\\Chunk' => $vendorDir . '/sebastian/diff/src/Chunk.php', + 'SebastianBergmann\\Diff\\ConfigurationException' => $vendorDir . '/sebastian/diff/src/Exception/ConfigurationException.php', + 'SebastianBergmann\\Diff\\Diff' => $vendorDir . '/sebastian/diff/src/Diff.php', + 'SebastianBergmann\\Diff\\Differ' => $vendorDir . '/sebastian/diff/src/Differ.php', + 'SebastianBergmann\\Diff\\Exception' => $vendorDir . '/sebastian/diff/src/Exception/Exception.php', + 'SebastianBergmann\\Diff\\InvalidArgumentException' => $vendorDir . '/sebastian/diff/src/Exception/InvalidArgumentException.php', + 'SebastianBergmann\\Diff\\Line' => $vendorDir . '/sebastian/diff/src/Line.php', + 'SebastianBergmann\\Diff\\LongestCommonSubsequenceCalculator' => $vendorDir . '/sebastian/diff/src/LongestCommonSubsequenceCalculator.php', + 'SebastianBergmann\\Diff\\MemoryEfficientLongestCommonSubsequenceCalculator' => $vendorDir . '/sebastian/diff/src/MemoryEfficientLongestCommonSubsequenceCalculator.php', + 'SebastianBergmann\\Diff\\Output\\AbstractChunkOutputBuilder' => $vendorDir . '/sebastian/diff/src/Output/AbstractChunkOutputBuilder.php', + 'SebastianBergmann\\Diff\\Output\\DiffOnlyOutputBuilder' => $vendorDir . '/sebastian/diff/src/Output/DiffOnlyOutputBuilder.php', + 'SebastianBergmann\\Diff\\Output\\DiffOutputBuilderInterface' => $vendorDir . '/sebastian/diff/src/Output/DiffOutputBuilderInterface.php', + 'SebastianBergmann\\Diff\\Output\\StrictUnifiedDiffOutputBuilder' => $vendorDir . '/sebastian/diff/src/Output/StrictUnifiedDiffOutputBuilder.php', + 'SebastianBergmann\\Diff\\Output\\UnifiedDiffOutputBuilder' => $vendorDir . '/sebastian/diff/src/Output/UnifiedDiffOutputBuilder.php', + 'SebastianBergmann\\Diff\\Parser' => $vendorDir . '/sebastian/diff/src/Parser.php', + 'SebastianBergmann\\Diff\\TimeEfficientLongestCommonSubsequenceCalculator' => $vendorDir . '/sebastian/diff/src/TimeEfficientLongestCommonSubsequenceCalculator.php', + 'SebastianBergmann\\Environment\\Console' => $vendorDir . '/sebastian/environment/src/Console.php', + 'SebastianBergmann\\Environment\\Runtime' => $vendorDir . '/sebastian/environment/src/Runtime.php', + 'SebastianBergmann\\Exporter\\Exporter' => $vendorDir . '/sebastian/exporter/src/Exporter.php', + 'SebastianBergmann\\FileIterator\\ExcludeIterator' => $vendorDir . '/phpunit/php-file-iterator/src/ExcludeIterator.php', + 'SebastianBergmann\\FileIterator\\Facade' => $vendorDir . '/phpunit/php-file-iterator/src/Facade.php', + 'SebastianBergmann\\FileIterator\\Factory' => $vendorDir . '/phpunit/php-file-iterator/src/Factory.php', + 'SebastianBergmann\\FileIterator\\Iterator' => $vendorDir . '/phpunit/php-file-iterator/src/Iterator.php', + 'SebastianBergmann\\GlobalState\\CodeExporter' => $vendorDir . '/sebastian/global-state/src/CodeExporter.php', + 'SebastianBergmann\\GlobalState\\Exception' => $vendorDir . '/sebastian/global-state/src/exceptions/Exception.php', + 'SebastianBergmann\\GlobalState\\ExcludeList' => $vendorDir . '/sebastian/global-state/src/ExcludeList.php', + 'SebastianBergmann\\GlobalState\\Restorer' => $vendorDir . '/sebastian/global-state/src/Restorer.php', + 'SebastianBergmann\\GlobalState\\RuntimeException' => $vendorDir . '/sebastian/global-state/src/exceptions/RuntimeException.php', + 'SebastianBergmann\\GlobalState\\Snapshot' => $vendorDir . '/sebastian/global-state/src/Snapshot.php', + 'SebastianBergmann\\Invoker\\Exception' => $vendorDir . '/phpunit/php-invoker/src/exceptions/Exception.php', + 'SebastianBergmann\\Invoker\\Invoker' => $vendorDir . '/phpunit/php-invoker/src/Invoker.php', + 'SebastianBergmann\\Invoker\\ProcessControlExtensionNotLoadedException' => $vendorDir . '/phpunit/php-invoker/src/exceptions/ProcessControlExtensionNotLoadedException.php', + 'SebastianBergmann\\Invoker\\TimeoutException' => $vendorDir . '/phpunit/php-invoker/src/exceptions/TimeoutException.php', + 'SebastianBergmann\\LinesOfCode\\Counter' => $vendorDir . '/sebastian/lines-of-code/src/Counter.php', + 'SebastianBergmann\\LinesOfCode\\Exception' => $vendorDir . '/sebastian/lines-of-code/src/Exception/Exception.php', + 'SebastianBergmann\\LinesOfCode\\IllogicalValuesException' => $vendorDir . '/sebastian/lines-of-code/src/Exception/IllogicalValuesException.php', + 'SebastianBergmann\\LinesOfCode\\LineCountingVisitor' => $vendorDir . '/sebastian/lines-of-code/src/LineCountingVisitor.php', + 'SebastianBergmann\\LinesOfCode\\LinesOfCode' => $vendorDir . '/sebastian/lines-of-code/src/LinesOfCode.php', + 'SebastianBergmann\\LinesOfCode\\NegativeValueException' => $vendorDir . '/sebastian/lines-of-code/src/Exception/NegativeValueException.php', + 'SebastianBergmann\\LinesOfCode\\RuntimeException' => $vendorDir . '/sebastian/lines-of-code/src/Exception/RuntimeException.php', + 'SebastianBergmann\\ObjectEnumerator\\Enumerator' => $vendorDir . '/sebastian/object-enumerator/src/Enumerator.php', + 'SebastianBergmann\\ObjectReflector\\ObjectReflector' => $vendorDir . '/sebastian/object-reflector/src/ObjectReflector.php', + 'SebastianBergmann\\RecursionContext\\Context' => $vendorDir . '/sebastian/recursion-context/src/Context.php', + 'SebastianBergmann\\Template\\Exception' => $vendorDir . '/phpunit/php-text-template/src/exceptions/Exception.php', + 'SebastianBergmann\\Template\\InvalidArgumentException' => $vendorDir . '/phpunit/php-text-template/src/exceptions/InvalidArgumentException.php', + 'SebastianBergmann\\Template\\RuntimeException' => $vendorDir . '/phpunit/php-text-template/src/exceptions/RuntimeException.php', + 'SebastianBergmann\\Template\\Template' => $vendorDir . '/phpunit/php-text-template/src/Template.php', + 'SebastianBergmann\\Timer\\Duration' => $vendorDir . '/phpunit/php-timer/src/Duration.php', + 'SebastianBergmann\\Timer\\Exception' => $vendorDir . '/phpunit/php-timer/src/exceptions/Exception.php', + 'SebastianBergmann\\Timer\\NoActiveTimerException' => $vendorDir . '/phpunit/php-timer/src/exceptions/NoActiveTimerException.php', + 'SebastianBergmann\\Timer\\ResourceUsageFormatter' => $vendorDir . '/phpunit/php-timer/src/ResourceUsageFormatter.php', + 'SebastianBergmann\\Timer\\TimeSinceStartOfRequestNotAvailableException' => $vendorDir . '/phpunit/php-timer/src/exceptions/TimeSinceStartOfRequestNotAvailableException.php', + 'SebastianBergmann\\Timer\\Timer' => $vendorDir . '/phpunit/php-timer/src/Timer.php', + 'SebastianBergmann\\Type\\CallableType' => $vendorDir . '/sebastian/type/src/type/CallableType.php', + 'SebastianBergmann\\Type\\Exception' => $vendorDir . '/sebastian/type/src/exception/Exception.php', + 'SebastianBergmann\\Type\\FalseType' => $vendorDir . '/sebastian/type/src/type/FalseType.php', + 'SebastianBergmann\\Type\\GenericObjectType' => $vendorDir . '/sebastian/type/src/type/GenericObjectType.php', + 'SebastianBergmann\\Type\\IntersectionType' => $vendorDir . '/sebastian/type/src/type/IntersectionType.php', + 'SebastianBergmann\\Type\\IterableType' => $vendorDir . '/sebastian/type/src/type/IterableType.php', + 'SebastianBergmann\\Type\\MixedType' => $vendorDir . '/sebastian/type/src/type/MixedType.php', + 'SebastianBergmann\\Type\\NeverType' => $vendorDir . '/sebastian/type/src/type/NeverType.php', + 'SebastianBergmann\\Type\\NullType' => $vendorDir . '/sebastian/type/src/type/NullType.php', + 'SebastianBergmann\\Type\\ObjectType' => $vendorDir . '/sebastian/type/src/type/ObjectType.php', + 'SebastianBergmann\\Type\\Parameter' => $vendorDir . '/sebastian/type/src/Parameter.php', + 'SebastianBergmann\\Type\\ReflectionMapper' => $vendorDir . '/sebastian/type/src/ReflectionMapper.php', + 'SebastianBergmann\\Type\\RuntimeException' => $vendorDir . '/sebastian/type/src/exception/RuntimeException.php', + 'SebastianBergmann\\Type\\SimpleType' => $vendorDir . '/sebastian/type/src/type/SimpleType.php', + 'SebastianBergmann\\Type\\StaticType' => $vendorDir . '/sebastian/type/src/type/StaticType.php', + 'SebastianBergmann\\Type\\TrueType' => $vendorDir . '/sebastian/type/src/type/TrueType.php', + 'SebastianBergmann\\Type\\Type' => $vendorDir . '/sebastian/type/src/type/Type.php', + 'SebastianBergmann\\Type\\TypeName' => $vendorDir . '/sebastian/type/src/TypeName.php', + 'SebastianBergmann\\Type\\UnionType' => $vendorDir . '/sebastian/type/src/type/UnionType.php', + 'SebastianBergmann\\Type\\UnknownType' => $vendorDir . '/sebastian/type/src/type/UnknownType.php', + 'SebastianBergmann\\Type\\VoidType' => $vendorDir . '/sebastian/type/src/type/VoidType.php', + 'SebastianBergmann\\Version' => $vendorDir . '/sebastian/version/src/Version.php', + 'Stringable' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Stringable.php', + 'TheSeer\\Tokenizer\\Exception' => $vendorDir . '/theseer/tokenizer/src/Exception.php', + 'TheSeer\\Tokenizer\\NamespaceUri' => $vendorDir . '/theseer/tokenizer/src/NamespaceUri.php', + 'TheSeer\\Tokenizer\\NamespaceUriException' => $vendorDir . '/theseer/tokenizer/src/NamespaceUriException.php', + 'TheSeer\\Tokenizer\\Token' => $vendorDir . '/theseer/tokenizer/src/Token.php', + 'TheSeer\\Tokenizer\\TokenCollection' => $vendorDir . '/theseer/tokenizer/src/TokenCollection.php', + 'TheSeer\\Tokenizer\\TokenCollectionException' => $vendorDir . '/theseer/tokenizer/src/TokenCollectionException.php', + 'TheSeer\\Tokenizer\\Tokenizer' => $vendorDir . '/theseer/tokenizer/src/Tokenizer.php', + 'TheSeer\\Tokenizer\\XMLSerializer' => $vendorDir . '/theseer/tokenizer/src/XMLSerializer.php', + 'UnhandledMatchError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php', + 'ValueError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/ValueError.php', +); diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php new file mode 100644 index 00000000..58bcbfc6 --- /dev/null +++ b/vendor/composer/autoload_files.php @@ -0,0 +1,42 @@ + $vendorDir . '/symfony/deprecation-contracts/function.php', + '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', + '22177d82d05723dff5b1903f4496520e' => $vendorDir . '/alleyinteractive/wordpress-autoloader/src/class-autoloader.php', + 'd0b4d9ff2237dcc1a532ae9d039c0c2c' => $vendorDir . '/alleyinteractive/composer-wordpress-autoloader/src/autoload.php', + 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php', + '667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php', + '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php', + 'a1105708a18b76903365ca1c4aa61b02' => $vendorDir . '/symfony/translation/Resources/functions.php', + 'e39a8b23c42d4e1452234d762b03835a' => $vendorDir . '/ramsey/uuid/src/functions.php', + '91dcc74bdd4f7744d05727fdc296d8ae' => $vendorDir . '/mantle-framework/support/autoload.php', + 'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php', + '8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php', + '662a729f963d39afe703c9d9b7ab4a8c' => $vendorDir . '/symfony/polyfill-php83/bootstrap.php', + 'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php', + 'c9d07b32a2e02bc0fc582d4f0c1b56cc' => $vendorDir . '/laminas/laminas-servicemanager/src/autoload.php', + '6124b4c8570aa390c21fafd04a26c69f' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php', + '25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php', + '35a6ad97d21e794e7e22a17d806652e4' => $vendorDir . '/nunomaduro/termwind/src/Functions.php', + 'ec07570ca5a812141189b1fa81503674' => $vendorDir . '/phpunit/phpunit/src/Framework/Assert/Functions.php', + 'f598d06aa772fa33d905e87be6398fb1' => $vendorDir . '/symfony/polyfill-intl-idn/bootstrap.php', + '7b8a241a27a0fc0510afa7766b8d2d63' => $vendorDir . '/alleyinteractive/wp-concurrent-remote-requests/src/helpers.php', + '64c317778960b02ca5b682004ec489be' => $vendorDir . '/alleyinteractive/wp-filter-side-effects/src/alley/wp/filter-side-effects.php', + 'ebc0e39732b9e1bd47455aa3ceb66933' => $vendorDir . '/mantle-framework/http/autoload.php', + '717bfcb3df879102cabd45b016d103ad' => $vendorDir . '/mantle-framework/http-client/autoload.php', + 'b4c1393590946316912f1825c4d559f0' => $vendorDir . '/alleyinteractive/wp-match-blocks/src/alley/wp/match-blocks.php', + '34b197430e01f74411146b5dd772055d' => $vendorDir . '/alleyinteractive/wp-match-blocks/src/alley/wp/internals/internals.php', + '84ad684efbadc5b6e84ff6b95b547e70' => $vendorDir . '/mantle-framework/config/autoload.php', + '06926389da1c83d3ff8800a89c1c4a9f' => $vendorDir . '/mantle-framework/testing/autoload.php', + 'a1cfe24d14977df6878b9bf804af2d1c' => $vendorDir . '/nunomaduro/collision/src/Adapters/Phpunit/Autoload.php', + '9b38cf48e83f5d8f60375221cd213eee' => $vendorDir . '/phpstan/phpstan/bootstrap.php', + 'ed33d19cba977f2a7e321f120d94a872' => $vendorDir . '/spatie/once/src/functions.php', + '0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php', + '2177988f784ffce59e42a453d8afcb7f' => $vendorDir . '/mantle-framework/testkit/autoload.php', +); diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php new file mode 100644 index 00000000..15a2ff3a --- /dev/null +++ b/vendor/composer/autoload_namespaces.php @@ -0,0 +1,9 @@ + array($vendorDir . '/voku/portable-ascii/src/voku'), + 'Whoops\\' => array($vendorDir . '/filp/whoops/src/Whoops'), + 'VariableAnalysis\\' => array($vendorDir . '/sirbrillig/phpcs-variable-analysis/VariableAnalysis'), + 'Termwind\\' => array($vendorDir . '/nunomaduro/termwind/src'), + 'SzepeViktor\\PHPStan\\WordPress\\' => array($vendorDir . '/szepeviktor/phpstan-wordpress/src'), + 'Symfony\\Polyfill\\Php83\\' => array($vendorDir . '/symfony/polyfill-php83'), + 'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'), + 'Symfony\\Polyfill\\Php73\\' => array($vendorDir . '/symfony/polyfill-php73'), + 'Symfony\\Polyfill\\Php72\\' => array($vendorDir . '/symfony/polyfill-php72'), + 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), + 'Symfony\\Polyfill\\Intl\\Normalizer\\' => array($vendorDir . '/symfony/polyfill-intl-normalizer'), + 'Symfony\\Polyfill\\Intl\\Idn\\' => array($vendorDir . '/symfony/polyfill-intl-idn'), + 'Symfony\\Polyfill\\Intl\\Grapheme\\' => array($vendorDir . '/symfony/polyfill-intl-grapheme'), + 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'), + 'Symfony\\Contracts\\Translation\\' => array($vendorDir . '/symfony/translation-contracts'), + 'Symfony\\Contracts\\Service\\' => array($vendorDir . '/symfony/service-contracts'), + 'Symfony\\Contracts\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher-contracts'), + 'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'), + 'Symfony\\Component\\VarDumper\\' => array($vendorDir . '/symfony/var-dumper'), + 'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'), + 'Symfony\\Component\\String\\' => array($vendorDir . '/symfony/string'), + 'Symfony\\Component\\Serializer\\' => array($vendorDir . '/symfony/serializer'), + 'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'), + 'Symfony\\Component\\PropertyInfo\\' => array($vendorDir . '/symfony/property-info'), + 'Symfony\\Component\\PropertyAccess\\' => array($vendorDir . '/symfony/property-access'), + 'Symfony\\Component\\Mime\\' => array($vendorDir . '/symfony/mime'), + 'Symfony\\Component\\HttpKernel\\' => array($vendorDir . '/symfony/http-kernel'), + 'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'), + 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'), + 'Symfony\\Component\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher'), + 'Symfony\\Component\\ErrorHandler\\' => array($vendorDir . '/symfony/error-handler'), + 'Symfony\\Component\\CssSelector\\' => array($vendorDir . '/symfony/css-selector'), + 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'), + 'Spatie\\Snapshots\\' => array($vendorDir . '/spatie/phpunit-snapshot-assertions/src'), + 'Spatie\\Once\\' => array($vendorDir . '/spatie/once/src'), + 'Ramsey\\Uuid\\' => array($vendorDir . '/ramsey/uuid/src'), + 'Ramsey\\Collection\\' => array($vendorDir . '/ramsey/collection/src'), + 'Psr\\Log\\' => array($vendorDir . '/psr/log/src'), + 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'), + 'Psr\\EventDispatcher\\' => array($vendorDir . '/psr/event-dispatcher/src'), + 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), + 'Psr\\Clock\\' => array($vendorDir . '/psr/clock/src'), + 'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'), + 'PhpParser\\' => array($vendorDir . '/nikic/php-parser/lib/PhpParser'), + 'PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\' => array($vendorDir . '/dealerdirect/phpcodesniffer-composer-installer/src'), + 'NunoMaduro\\Collision\\' => array($vendorDir . '/nunomaduro/collision/src'), + 'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'), + 'League\\MimeTypeDetection\\' => array($vendorDir . '/league/mime-type-detection/src'), + 'League\\Flysystem\\Cached\\' => array($vendorDir . '/league/flysystem-cached-adapter/src'), + 'League\\Flysystem\\' => array($vendorDir . '/league/flysystem/src'), + 'League\\Config\\' => array($vendorDir . '/league/config/src'), + 'League\\CommonMark\\' => array($vendorDir . '/league/commonmark/src'), + 'Laminas\\Validator\\' => array($vendorDir . '/laminas/laminas-validator/src'), + 'Laminas\\Stdlib\\' => array($vendorDir . '/laminas/laminas-stdlib/src'), + 'Laminas\\ServiceManager\\' => array($vendorDir . '/laminas/laminas-servicemanager/src'), + 'Faker\\' => array($vendorDir . '/fakerphp/faker/src/Faker'), + 'Doctrine\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib/Doctrine/Inflector'), + 'Dflydev\\DotAccessData\\' => array($vendorDir . '/dflydev/dot-access-data/src'), + 'DeepCopy\\' => array($vendorDir . '/myclabs/deep-copy/src/DeepCopy'), + 'ComposerWordPressAutoloader\\' => array($vendorDir . '/alleyinteractive/composer-wordpress-autoloader/src'), + 'Carbon\\Doctrine\\' => array($vendorDir . '/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine'), + 'Carbon\\' => array($vendorDir . '/nesbot/carbon/src/Carbon'), + 'Brick\\Math\\' => array($vendorDir . '/brick/math/src'), + 'Alley\\WP\\Create_WordPress_Plugin\\Tests\\' => array($baseDir . '/tests'), + 'Alley\\' => array($vendorDir . '/alleyinteractive/laminas-validator-extensions/src/Alley'), +); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php new file mode 100644 index 00000000..18c87d2a --- /dev/null +++ b/vendor/composer/autoload_real.php @@ -0,0 +1,50 @@ +register(true); + + $filesToLoad = \Composer\Autoload\ComposerStaticInit8494108b02b27c800772c410510056d3::$files; + $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + + require $file; + } + }, null, null); + foreach ($filesToLoad as $fileIdentifier => $file) { + $requireFile($fileIdentifier, $file); + } + + return $loader; + } +} diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php new file mode 100644 index 00000000..cd011564 --- /dev/null +++ b/vendor/composer/autoload_static.php @@ -0,0 +1,1715 @@ + __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', + '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', + '22177d82d05723dff5b1903f4496520e' => __DIR__ . '/..' . '/alleyinteractive/wordpress-autoloader/src/class-autoloader.php', + 'd0b4d9ff2237dcc1a532ae9d039c0c2c' => __DIR__ . '/..' . '/alleyinteractive/composer-wordpress-autoloader/src/autoload.php', + 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', + '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php', + '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', + 'a1105708a18b76903365ca1c4aa61b02' => __DIR__ . '/..' . '/symfony/translation/Resources/functions.php', + 'e39a8b23c42d4e1452234d762b03835a' => __DIR__ . '/..' . '/ramsey/uuid/src/functions.php', + '91dcc74bdd4f7744d05727fdc296d8ae' => __DIR__ . '/..' . '/mantle-framework/support/autoload.php', + 'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php', + '8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php', + '662a729f963d39afe703c9d9b7ab4a8c' => __DIR__ . '/..' . '/symfony/polyfill-php83/bootstrap.php', + 'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php', + 'c9d07b32a2e02bc0fc582d4f0c1b56cc' => __DIR__ . '/..' . '/laminas/laminas-servicemanager/src/autoload.php', + '6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php', + '25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php', + '35a6ad97d21e794e7e22a17d806652e4' => __DIR__ . '/..' . '/nunomaduro/termwind/src/Functions.php', + 'ec07570ca5a812141189b1fa81503674' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Assert/Functions.php', + 'f598d06aa772fa33d905e87be6398fb1' => __DIR__ . '/..' . '/symfony/polyfill-intl-idn/bootstrap.php', + '7b8a241a27a0fc0510afa7766b8d2d63' => __DIR__ . '/..' . '/alleyinteractive/wp-concurrent-remote-requests/src/helpers.php', + '64c317778960b02ca5b682004ec489be' => __DIR__ . '/..' . '/alleyinteractive/wp-filter-side-effects/src/alley/wp/filter-side-effects.php', + 'ebc0e39732b9e1bd47455aa3ceb66933' => __DIR__ . '/..' . '/mantle-framework/http/autoload.php', + '717bfcb3df879102cabd45b016d103ad' => __DIR__ . '/..' . '/mantle-framework/http-client/autoload.php', + 'b4c1393590946316912f1825c4d559f0' => __DIR__ . '/..' . '/alleyinteractive/wp-match-blocks/src/alley/wp/match-blocks.php', + '34b197430e01f74411146b5dd772055d' => __DIR__ . '/..' . '/alleyinteractive/wp-match-blocks/src/alley/wp/internals/internals.php', + '84ad684efbadc5b6e84ff6b95b547e70' => __DIR__ . '/..' . '/mantle-framework/config/autoload.php', + '06926389da1c83d3ff8800a89c1c4a9f' => __DIR__ . '/..' . '/mantle-framework/testing/autoload.php', + 'a1cfe24d14977df6878b9bf804af2d1c' => __DIR__ . '/..' . '/nunomaduro/collision/src/Adapters/Phpunit/Autoload.php', + '9b38cf48e83f5d8f60375221cd213eee' => __DIR__ . '/..' . '/phpstan/phpstan/bootstrap.php', + 'ed33d19cba977f2a7e321f120d94a872' => __DIR__ . '/..' . '/spatie/once/src/functions.php', + '0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php', + '2177988f784ffce59e42a453d8afcb7f' => __DIR__ . '/..' . '/mantle-framework/testkit/autoload.php', + ); + + public static $prefixLengthsPsr4 = array ( + 'v' => + array ( + 'voku\\' => 5, + ), + 'W' => + array ( + 'Whoops\\' => 7, + ), + 'V' => + array ( + 'VariableAnalysis\\' => 17, + ), + 'T' => + array ( + 'Termwind\\' => 9, + ), + 'S' => + array ( + 'SzepeViktor\\PHPStan\\WordPress\\' => 30, + 'Symfony\\Polyfill\\Php83\\' => 23, + 'Symfony\\Polyfill\\Php80\\' => 23, + 'Symfony\\Polyfill\\Php73\\' => 23, + 'Symfony\\Polyfill\\Php72\\' => 23, + 'Symfony\\Polyfill\\Mbstring\\' => 26, + 'Symfony\\Polyfill\\Intl\\Normalizer\\' => 33, + 'Symfony\\Polyfill\\Intl\\Idn\\' => 26, + 'Symfony\\Polyfill\\Intl\\Grapheme\\' => 31, + 'Symfony\\Polyfill\\Ctype\\' => 23, + 'Symfony\\Contracts\\Translation\\' => 30, + 'Symfony\\Contracts\\Service\\' => 26, + 'Symfony\\Contracts\\EventDispatcher\\' => 34, + 'Symfony\\Component\\Yaml\\' => 23, + 'Symfony\\Component\\VarDumper\\' => 28, + 'Symfony\\Component\\Translation\\' => 30, + 'Symfony\\Component\\String\\' => 25, + 'Symfony\\Component\\Serializer\\' => 29, + 'Symfony\\Component\\Routing\\' => 26, + 'Symfony\\Component\\PropertyInfo\\' => 31, + 'Symfony\\Component\\PropertyAccess\\' => 33, + 'Symfony\\Component\\Mime\\' => 23, + 'Symfony\\Component\\HttpKernel\\' => 29, + 'Symfony\\Component\\HttpFoundation\\' => 33, + 'Symfony\\Component\\Finder\\' => 25, + 'Symfony\\Component\\EventDispatcher\\' => 34, + 'Symfony\\Component\\ErrorHandler\\' => 31, + 'Symfony\\Component\\CssSelector\\' => 30, + 'Symfony\\Component\\Console\\' => 26, + 'Spatie\\Snapshots\\' => 17, + 'Spatie\\Once\\' => 12, + ), + 'R' => + array ( + 'Ramsey\\Uuid\\' => 12, + 'Ramsey\\Collection\\' => 18, + ), + 'P' => + array ( + 'Psr\\Log\\' => 8, + 'Psr\\Http\\Message\\' => 17, + 'Psr\\EventDispatcher\\' => 20, + 'Psr\\Container\\' => 14, + 'Psr\\Clock\\' => 10, + 'Psr\\Cache\\' => 10, + 'PhpParser\\' => 10, + 'PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\' => 57, + ), + 'N' => + array ( + 'NunoMaduro\\Collision\\' => 21, + ), + 'M' => + array ( + 'Monolog\\' => 8, + ), + 'L' => + array ( + 'League\\MimeTypeDetection\\' => 25, + 'League\\Flysystem\\Cached\\' => 24, + 'League\\Flysystem\\' => 17, + 'League\\Config\\' => 14, + 'League\\CommonMark\\' => 18, + 'Laminas\\Validator\\' => 18, + 'Laminas\\Stdlib\\' => 15, + 'Laminas\\ServiceManager\\' => 23, + ), + 'F' => + array ( + 'Faker\\' => 6, + ), + 'D' => + array ( + 'Doctrine\\Inflector\\' => 19, + 'Dflydev\\DotAccessData\\' => 22, + 'DeepCopy\\' => 9, + ), + 'C' => + array ( + 'ComposerWordPressAutoloader\\' => 28, + 'Carbon\\Doctrine\\' => 16, + 'Carbon\\' => 7, + ), + 'B' => + array ( + 'Brick\\Math\\' => 11, + ), + 'A' => + array ( + 'Alley\\WP\\Create_WordPress_Plugin\\Tests\\' => 39, + 'Alley\\' => 6, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'voku\\' => + array ( + 0 => __DIR__ . '/..' . '/voku/portable-ascii/src/voku', + ), + 'Whoops\\' => + array ( + 0 => __DIR__ . '/..' . '/filp/whoops/src/Whoops', + ), + 'VariableAnalysis\\' => + array ( + 0 => __DIR__ . '/..' . '/sirbrillig/phpcs-variable-analysis/VariableAnalysis', + ), + 'Termwind\\' => + array ( + 0 => __DIR__ . '/..' . '/nunomaduro/termwind/src', + ), + 'SzepeViktor\\PHPStan\\WordPress\\' => + array ( + 0 => __DIR__ . '/..' . '/szepeviktor/phpstan-wordpress/src', + ), + 'Symfony\\Polyfill\\Php83\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-php83', + ), + 'Symfony\\Polyfill\\Php80\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-php80', + ), + 'Symfony\\Polyfill\\Php73\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-php73', + ), + 'Symfony\\Polyfill\\Php72\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-php72', + ), + 'Symfony\\Polyfill\\Mbstring\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', + ), + 'Symfony\\Polyfill\\Intl\\Normalizer\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer', + ), + 'Symfony\\Polyfill\\Intl\\Idn\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-intl-idn', + ), + 'Symfony\\Polyfill\\Intl\\Grapheme\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme', + ), + 'Symfony\\Polyfill\\Ctype\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype', + ), + 'Symfony\\Contracts\\Translation\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/translation-contracts', + ), + 'Symfony\\Contracts\\Service\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/service-contracts', + ), + 'Symfony\\Contracts\\EventDispatcher\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/event-dispatcher-contracts', + ), + 'Symfony\\Component\\Yaml\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/yaml', + ), + 'Symfony\\Component\\VarDumper\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/var-dumper', + ), + 'Symfony\\Component\\Translation\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/translation', + ), + 'Symfony\\Component\\String\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/string', + ), + 'Symfony\\Component\\Serializer\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/serializer', + ), + 'Symfony\\Component\\Routing\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/routing', + ), + 'Symfony\\Component\\PropertyInfo\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/property-info', + ), + 'Symfony\\Component\\PropertyAccess\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/property-access', + ), + 'Symfony\\Component\\Mime\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/mime', + ), + 'Symfony\\Component\\HttpKernel\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/http-kernel', + ), + 'Symfony\\Component\\HttpFoundation\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/http-foundation', + ), + 'Symfony\\Component\\Finder\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/finder', + ), + 'Symfony\\Component\\EventDispatcher\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/event-dispatcher', + ), + 'Symfony\\Component\\ErrorHandler\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/error-handler', + ), + 'Symfony\\Component\\CssSelector\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/css-selector', + ), + 'Symfony\\Component\\Console\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/console', + ), + 'Spatie\\Snapshots\\' => + array ( + 0 => __DIR__ . '/..' . '/spatie/phpunit-snapshot-assertions/src', + ), + 'Spatie\\Once\\' => + array ( + 0 => __DIR__ . '/..' . '/spatie/once/src', + ), + 'Ramsey\\Uuid\\' => + array ( + 0 => __DIR__ . '/..' . '/ramsey/uuid/src', + ), + 'Ramsey\\Collection\\' => + array ( + 0 => __DIR__ . '/..' . '/ramsey/collection/src', + ), + 'Psr\\Log\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/log/src', + ), + 'Psr\\Http\\Message\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/http-message/src', + ), + 'Psr\\EventDispatcher\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/event-dispatcher/src', + ), + 'Psr\\Container\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/container/src', + ), + 'Psr\\Clock\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/clock/src', + ), + 'Psr\\Cache\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/cache/src', + ), + 'PhpParser\\' => + array ( + 0 => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser', + ), + 'PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\' => + array ( + 0 => __DIR__ . '/..' . '/dealerdirect/phpcodesniffer-composer-installer/src', + ), + 'NunoMaduro\\Collision\\' => + array ( + 0 => __DIR__ . '/..' . '/nunomaduro/collision/src', + ), + 'Monolog\\' => + array ( + 0 => __DIR__ . '/..' . '/monolog/monolog/src/Monolog', + ), + 'League\\MimeTypeDetection\\' => + array ( + 0 => __DIR__ . '/..' . '/league/mime-type-detection/src', + ), + 'League\\Flysystem\\Cached\\' => + array ( + 0 => __DIR__ . '/..' . '/league/flysystem-cached-adapter/src', + ), + 'League\\Flysystem\\' => + array ( + 0 => __DIR__ . '/..' . '/league/flysystem/src', + ), + 'League\\Config\\' => + array ( + 0 => __DIR__ . '/..' . '/league/config/src', + ), + 'League\\CommonMark\\' => + array ( + 0 => __DIR__ . '/..' . '/league/commonmark/src', + ), + 'Laminas\\Validator\\' => + array ( + 0 => __DIR__ . '/..' . '/laminas/laminas-validator/src', + ), + 'Laminas\\Stdlib\\' => + array ( + 0 => __DIR__ . '/..' . '/laminas/laminas-stdlib/src', + ), + 'Laminas\\ServiceManager\\' => + array ( + 0 => __DIR__ . '/..' . '/laminas/laminas-servicemanager/src', + ), + 'Faker\\' => + array ( + 0 => __DIR__ . '/..' . '/fakerphp/faker/src/Faker', + ), + 'Doctrine\\Inflector\\' => + array ( + 0 => __DIR__ . '/..' . '/doctrine/inflector/lib/Doctrine/Inflector', + ), + 'Dflydev\\DotAccessData\\' => + array ( + 0 => __DIR__ . '/..' . '/dflydev/dot-access-data/src', + ), + 'DeepCopy\\' => + array ( + 0 => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy', + ), + 'ComposerWordPressAutoloader\\' => + array ( + 0 => __DIR__ . '/..' . '/alleyinteractive/composer-wordpress-autoloader/src', + ), + 'Carbon\\Doctrine\\' => + array ( + 0 => __DIR__ . '/..' . '/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine', + ), + 'Carbon\\' => + array ( + 0 => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon', + ), + 'Brick\\Math\\' => + array ( + 0 => __DIR__ . '/..' . '/brick/math/src', + ), + 'Alley\\WP\\Create_WordPress_Plugin\\Tests\\' => + array ( + 0 => __DIR__ . '/../..' . '/tests', + ), + 'Alley\\' => + array ( + 0 => __DIR__ . '/..' . '/alleyinteractive/laminas-validator-extensions/src/Alley', + ), + ); + + public static $classMap = array ( + 'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php', + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + 'DateError' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateError.php', + 'DateException' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateException.php', + 'DateInvalidOperationException' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateInvalidOperationException.php', + 'DateInvalidTimeZoneException' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateInvalidTimeZoneException.php', + 'DateMalformedIntervalStringException' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateMalformedIntervalStringException.php', + 'DateMalformedPeriodStringException' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateMalformedPeriodStringException.php', + 'DateMalformedStringException' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateMalformedStringException.php', + 'DateObjectError' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateObjectError.php', + 'DateRangeError' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/DateRangeError.php', + 'JsonException' => __DIR__ . '/..' . '/symfony/polyfill-php73/Resources/stubs/JsonException.php', + 'Nette\\ArgumentOutOfRangeException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php', + 'Nette\\DeprecatedException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php', + 'Nette\\DirectoryNotFoundException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php', + 'Nette\\FileNotFoundException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php', + 'Nette\\HtmlStringable' => __DIR__ . '/..' . '/nette/utils/src/HtmlStringable.php', + 'Nette\\IOException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php', + 'Nette\\InvalidArgumentException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php', + 'Nette\\InvalidStateException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php', + 'Nette\\Iterators\\CachingIterator' => __DIR__ . '/..' . '/nette/utils/src/Iterators/CachingIterator.php', + 'Nette\\Iterators\\Mapper' => __DIR__ . '/..' . '/nette/utils/src/Iterators/Mapper.php', + 'Nette\\Localization\\ITranslator' => __DIR__ . '/..' . '/nette/utils/src/compatibility.php', + 'Nette\\Localization\\Translator' => __DIR__ . '/..' . '/nette/utils/src/Translator.php', + 'Nette\\MemberAccessException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php', + 'Nette\\NotImplementedException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php', + 'Nette\\NotSupportedException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php', + 'Nette\\OutOfRangeException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php', + 'Nette\\Schema\\Context' => __DIR__ . '/..' . '/nette/schema/src/Schema/Context.php', + 'Nette\\Schema\\DynamicParameter' => __DIR__ . '/..' . '/nette/schema/src/Schema/DynamicParameter.php', + 'Nette\\Schema\\Elements\\AnyOf' => __DIR__ . '/..' . '/nette/schema/src/Schema/Elements/AnyOf.php', + 'Nette\\Schema\\Elements\\Base' => __DIR__ . '/..' . '/nette/schema/src/Schema/Elements/Base.php', + 'Nette\\Schema\\Elements\\Structure' => __DIR__ . '/..' . '/nette/schema/src/Schema/Elements/Structure.php', + 'Nette\\Schema\\Elements\\Type' => __DIR__ . '/..' . '/nette/schema/src/Schema/Elements/Type.php', + 'Nette\\Schema\\Expect' => __DIR__ . '/..' . '/nette/schema/src/Schema/Expect.php', + 'Nette\\Schema\\Helpers' => __DIR__ . '/..' . '/nette/schema/src/Schema/Helpers.php', + 'Nette\\Schema\\Message' => __DIR__ . '/..' . '/nette/schema/src/Schema/Message.php', + 'Nette\\Schema\\Processor' => __DIR__ . '/..' . '/nette/schema/src/Schema/Processor.php', + 'Nette\\Schema\\Schema' => __DIR__ . '/..' . '/nette/schema/src/Schema/Schema.php', + 'Nette\\Schema\\ValidationException' => __DIR__ . '/..' . '/nette/schema/src/Schema/ValidationException.php', + 'Nette\\SmartObject' => __DIR__ . '/..' . '/nette/utils/src/SmartObject.php', + 'Nette\\StaticClass' => __DIR__ . '/..' . '/nette/utils/src/StaticClass.php', + 'Nette\\UnexpectedValueException' => __DIR__ . '/..' . '/nette/utils/src/exceptions.php', + 'Nette\\Utils\\ArrayHash' => __DIR__ . '/..' . '/nette/utils/src/Utils/ArrayHash.php', + 'Nette\\Utils\\ArrayList' => __DIR__ . '/..' . '/nette/utils/src/Utils/ArrayList.php', + 'Nette\\Utils\\Arrays' => __DIR__ . '/..' . '/nette/utils/src/Utils/Arrays.php', + 'Nette\\Utils\\AssertionException' => __DIR__ . '/..' . '/nette/utils/src/Utils/exceptions.php', + 'Nette\\Utils\\Callback' => __DIR__ . '/..' . '/nette/utils/src/Utils/Callback.php', + 'Nette\\Utils\\DateTime' => __DIR__ . '/..' . '/nette/utils/src/Utils/DateTime.php', + 'Nette\\Utils\\FileInfo' => __DIR__ . '/..' . '/nette/utils/src/Utils/FileInfo.php', + 'Nette\\Utils\\FileSystem' => __DIR__ . '/..' . '/nette/utils/src/Utils/FileSystem.php', + 'Nette\\Utils\\Finder' => __DIR__ . '/..' . '/nette/utils/src/Utils/Finder.php', + 'Nette\\Utils\\Floats' => __DIR__ . '/..' . '/nette/utils/src/Utils/Floats.php', + 'Nette\\Utils\\Helpers' => __DIR__ . '/..' . '/nette/utils/src/Utils/Helpers.php', + 'Nette\\Utils\\Html' => __DIR__ . '/..' . '/nette/utils/src/Utils/Html.php', + 'Nette\\Utils\\IHtmlString' => __DIR__ . '/..' . '/nette/utils/src/compatibility.php', + 'Nette\\Utils\\Image' => __DIR__ . '/..' . '/nette/utils/src/Utils/Image.php', + 'Nette\\Utils\\ImageColor' => __DIR__ . '/..' . '/nette/utils/src/Utils/ImageColor.php', + 'Nette\\Utils\\ImageException' => __DIR__ . '/..' . '/nette/utils/src/Utils/exceptions.php', + 'Nette\\Utils\\ImageType' => __DIR__ . '/..' . '/nette/utils/src/Utils/ImageType.php', + 'Nette\\Utils\\Iterables' => __DIR__ . '/..' . '/nette/utils/src/Utils/Iterables.php', + 'Nette\\Utils\\Json' => __DIR__ . '/..' . '/nette/utils/src/Utils/Json.php', + 'Nette\\Utils\\JsonException' => __DIR__ . '/..' . '/nette/utils/src/Utils/exceptions.php', + 'Nette\\Utils\\ObjectHelpers' => __DIR__ . '/..' . '/nette/utils/src/Utils/ObjectHelpers.php', + 'Nette\\Utils\\Paginator' => __DIR__ . '/..' . '/nette/utils/src/Utils/Paginator.php', + 'Nette\\Utils\\Random' => __DIR__ . '/..' . '/nette/utils/src/Utils/Random.php', + 'Nette\\Utils\\Reflection' => __DIR__ . '/..' . '/nette/utils/src/Utils/Reflection.php', + 'Nette\\Utils\\ReflectionMethod' => __DIR__ . '/..' . '/nette/utils/src/Utils/ReflectionMethod.php', + 'Nette\\Utils\\RegexpException' => __DIR__ . '/..' . '/nette/utils/src/Utils/exceptions.php', + 'Nette\\Utils\\Strings' => __DIR__ . '/..' . '/nette/utils/src/Utils/Strings.php', + 'Nette\\Utils\\Type' => __DIR__ . '/..' . '/nette/utils/src/Utils/Type.php', + 'Nette\\Utils\\UnknownImageFileException' => __DIR__ . '/..' . '/nette/utils/src/Utils/exceptions.php', + 'Nette\\Utils\\Validators' => __DIR__ . '/..' . '/nette/utils/src/Utils/Validators.php', + 'Normalizer' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php', + 'Override' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/Override.php', + 'PHPCSUtils\\AbstractSniffs\\AbstractArrayDeclarationSniff' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/AbstractSniffs/AbstractArrayDeclarationSniff.php', + 'PHPCSUtils\\BackCompat\\BCFile' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCFile.php', + 'PHPCSUtils\\BackCompat\\BCTokens' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCTokens.php', + 'PHPCSUtils\\BackCompat\\Helper' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/Helper.php', + 'PHPCSUtils\\Exceptions\\InvalidTokenArray' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Exceptions/InvalidTokenArray.php', + 'PHPCSUtils\\Exceptions\\TestFileNotFound' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Exceptions/TestFileNotFound.php', + 'PHPCSUtils\\Exceptions\\TestMarkerNotFound' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Exceptions/TestMarkerNotFound.php', + 'PHPCSUtils\\Exceptions\\TestTargetNotFound' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Exceptions/TestTargetNotFound.php', + 'PHPCSUtils\\Fixers\\SpacesFixer' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Fixers/SpacesFixer.php', + 'PHPCSUtils\\Internal\\Cache' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Internal/Cache.php', + 'PHPCSUtils\\Internal\\IsShortArrayOrList' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Internal/IsShortArrayOrList.php', + 'PHPCSUtils\\Internal\\IsShortArrayOrListWithCache' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Internal/IsShortArrayOrListWithCache.php', + 'PHPCSUtils\\Internal\\NoFileCache' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Internal/NoFileCache.php', + 'PHPCSUtils\\Internal\\StableCollections' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Internal/StableCollections.php', + 'PHPCSUtils\\TestUtils\\UtilityMethodTestCase' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/TestUtils/UtilityMethodTestCase.php', + 'PHPCSUtils\\Tokens\\Collections' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Tokens/Collections.php', + 'PHPCSUtils\\Tokens\\TokenHelper' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Tokens/TokenHelper.php', + 'PHPCSUtils\\Utils\\Arrays' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Arrays.php', + 'PHPCSUtils\\Utils\\Conditions' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Conditions.php', + 'PHPCSUtils\\Utils\\Context' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Context.php', + 'PHPCSUtils\\Utils\\ControlStructures' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/ControlStructures.php', + 'PHPCSUtils\\Utils\\FunctionDeclarations' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/FunctionDeclarations.php', + 'PHPCSUtils\\Utils\\GetTokensAsString' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/GetTokensAsString.php', + 'PHPCSUtils\\Utils\\Lists' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Lists.php', + 'PHPCSUtils\\Utils\\MessageHelper' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/MessageHelper.php', + 'PHPCSUtils\\Utils\\Namespaces' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Namespaces.php', + 'PHPCSUtils\\Utils\\NamingConventions' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/NamingConventions.php', + 'PHPCSUtils\\Utils\\Numbers' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Numbers.php', + 'PHPCSUtils\\Utils\\ObjectDeclarations' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/ObjectDeclarations.php', + 'PHPCSUtils\\Utils\\Operators' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Operators.php', + 'PHPCSUtils\\Utils\\Orthography' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Orthography.php', + 'PHPCSUtils\\Utils\\Parentheses' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Parentheses.php', + 'PHPCSUtils\\Utils\\PassedParameters' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/PassedParameters.php', + 'PHPCSUtils\\Utils\\Scopes' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Scopes.php', + 'PHPCSUtils\\Utils\\TextStrings' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/TextStrings.php', + 'PHPCSUtils\\Utils\\UseStatements' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/UseStatements.php', + 'PHPCSUtils\\Utils\\Variables' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Variables.php', + 'PHPUnit\\Event\\Application\\Finished' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Application/Finished.php', + 'PHPUnit\\Event\\Application\\FinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Application/FinishedSubscriber.php', + 'PHPUnit\\Event\\Application\\Started' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Application/Started.php', + 'PHPUnit\\Event\\Application\\StartedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Application/StartedSubscriber.php', + 'PHPUnit\\Event\\Code\\ClassMethod' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/ClassMethod.php', + 'PHPUnit\\Event\\Code\\ComparisonFailure' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/ComparisonFailure.php', + 'PHPUnit\\Event\\Code\\ComparisonFailureBuilder' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/ComparisonFailureBuilder.php', + 'PHPUnit\\Event\\Code\\NoTestCaseObjectOnCallStackException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Exception/NoTestCaseObjectOnCallStackException.php', + 'PHPUnit\\Event\\Code\\Phpt' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Test/Phpt.php', + 'PHPUnit\\Event\\Code\\Test' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Test/Test.php', + 'PHPUnit\\Event\\Code\\TestCollection' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Test/TestCollection.php', + 'PHPUnit\\Event\\Code\\TestCollectionIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Test/TestCollectionIterator.php', + 'PHPUnit\\Event\\Code\\TestDox' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Test/TestDox.php', + 'PHPUnit\\Event\\Code\\TestDoxBuilder' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Test/TestDoxBuilder.php', + 'PHPUnit\\Event\\Code\\TestMethod' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Test/TestMethod.php', + 'PHPUnit\\Event\\Code\\TestMethodBuilder' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Test/TestMethodBuilder.php', + 'PHPUnit\\Event\\Code\\Throwable' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Throwable.php', + 'PHPUnit\\Event\\Code\\ThrowableBuilder' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/ThrowableBuilder.php', + 'PHPUnit\\Event\\CollectingDispatcher' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Dispatcher/CollectingDispatcher.php', + 'PHPUnit\\Event\\DeferringDispatcher' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Dispatcher/DeferringDispatcher.php', + 'PHPUnit\\Event\\DirectDispatcher' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Dispatcher/DirectDispatcher.php', + 'PHPUnit\\Event\\Dispatcher' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Dispatcher/Dispatcher.php', + 'PHPUnit\\Event\\DispatchingEmitter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Emitter/DispatchingEmitter.php', + 'PHPUnit\\Event\\Emitter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Emitter/Emitter.php', + 'PHPUnit\\Event\\Event' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Event.php', + 'PHPUnit\\Event\\EventAlreadyAssignedException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Exception/EventAlreadyAssignedException.php', + 'PHPUnit\\Event\\EventCollection' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/EventCollection.php', + 'PHPUnit\\Event\\EventCollectionIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/EventCollectionIterator.php', + 'PHPUnit\\Event\\EventFacadeIsSealedException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Exception/EventFacadeIsSealedException.php', + 'PHPUnit\\Event\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Exception/Exception.php', + 'PHPUnit\\Event\\Facade' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Facade.php', + 'PHPUnit\\Event\\InvalidArgumentException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Exception/InvalidArgumentException.php', + 'PHPUnit\\Event\\InvalidEventException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Exception/InvalidEventException.php', + 'PHPUnit\\Event\\InvalidSubscriberException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Exception/InvalidSubscriberException.php', + 'PHPUnit\\Event\\MapError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Exception/MapError.php', + 'PHPUnit\\Event\\NoPreviousThrowableException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Exception/NoPreviousThrowableException.php', + 'PHPUnit\\Event\\RuntimeException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Exception/RuntimeException.php', + 'PHPUnit\\Event\\Runtime\\OperatingSystem' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Runtime/OperatingSystem.php', + 'PHPUnit\\Event\\Runtime\\PHP' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Runtime/PHP.php', + 'PHPUnit\\Event\\Runtime\\PHPUnit' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Runtime/PHPUnit.php', + 'PHPUnit\\Event\\Runtime\\Runtime' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Runtime/Runtime.php', + 'PHPUnit\\Event\\SubscribableDispatcher' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Dispatcher/SubscribableDispatcher.php', + 'PHPUnit\\Event\\Subscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Subscriber.php', + 'PHPUnit\\Event\\SubscriberTypeAlreadyRegisteredException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Exception/SubscriberTypeAlreadyRegisteredException.php', + 'PHPUnit\\Event\\Telemetry\\Duration' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Telemetry/Duration.php', + 'PHPUnit\\Event\\Telemetry\\GarbageCollectorStatus' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Telemetry/GarbageCollectorStatus.php', + 'PHPUnit\\Event\\Telemetry\\GarbageCollectorStatusProvider' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Telemetry/GarbageCollectorStatusProvider.php', + 'PHPUnit\\Event\\Telemetry\\HRTime' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Telemetry/HRTime.php', + 'PHPUnit\\Event\\Telemetry\\Info' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Telemetry/Info.php', + 'PHPUnit\\Event\\Telemetry\\MemoryMeter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Telemetry/MemoryMeter.php', + 'PHPUnit\\Event\\Telemetry\\MemoryUsage' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Telemetry/MemoryUsage.php', + 'PHPUnit\\Event\\Telemetry\\Php81GarbageCollectorStatusProvider' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Telemetry/Php81GarbageCollectorStatusProvider.php', + 'PHPUnit\\Event\\Telemetry\\Php83GarbageCollectorStatusProvider' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Telemetry/Php83GarbageCollectorStatusProvider.php', + 'PHPUnit\\Event\\Telemetry\\Snapshot' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Telemetry/Snapshot.php', + 'PHPUnit\\Event\\Telemetry\\StopWatch' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Telemetry/StopWatch.php', + 'PHPUnit\\Event\\Telemetry\\System' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Telemetry/System.php', + 'PHPUnit\\Event\\Telemetry\\SystemMemoryMeter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Telemetry/SystemMemoryMeter.php', + 'PHPUnit\\Event\\Telemetry\\SystemStopWatch' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Telemetry/SystemStopWatch.php', + 'PHPUnit\\Event\\Telemetry\\SystemStopWatchWithOffset' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Telemetry/SystemStopWatchWithOffset.php', + 'PHPUnit\\Event\\TestData\\DataFromDataProvider' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Test/TestData/DataFromDataProvider.php', + 'PHPUnit\\Event\\TestData\\DataFromTestDependency' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Test/TestData/DataFromTestDependency.php', + 'PHPUnit\\Event\\TestData\\MoreThanOneDataSetFromDataProviderException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Exception/MoreThanOneDataSetFromDataProviderException.php', + 'PHPUnit\\Event\\TestData\\NoDataSetFromDataProviderException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Exception/NoDataSetFromDataProviderException.php', + 'PHPUnit\\Event\\TestData\\TestData' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Test/TestData/TestData.php', + 'PHPUnit\\Event\\TestData\\TestDataCollection' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Test/TestData/TestDataCollection.php', + 'PHPUnit\\Event\\TestData\\TestDataCollectionIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/Test/TestData/TestDataCollectionIterator.php', + 'PHPUnit\\Event\\TestRunner\\BootstrapFinished' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/BootstrapFinished.php', + 'PHPUnit\\Event\\TestRunner\\BootstrapFinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/BootstrapFinishedSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\Configured' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/Configured.php', + 'PHPUnit\\Event\\TestRunner\\ConfiguredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/ConfiguredSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\DeprecationTriggered' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/DeprecationTriggered.php', + 'PHPUnit\\Event\\TestRunner\\DeprecationTriggeredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/DeprecationTriggeredSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\EventFacadeSealed' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/EventFacadeSealed.php', + 'PHPUnit\\Event\\TestRunner\\EventFacadeSealedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/EventFacadeSealedSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\ExecutionAborted' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/ExecutionAborted.php', + 'PHPUnit\\Event\\TestRunner\\ExecutionAbortedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/ExecutionAbortedSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\ExecutionFinished' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/ExecutionFinished.php', + 'PHPUnit\\Event\\TestRunner\\ExecutionFinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/ExecutionFinishedSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\ExecutionStarted' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/ExecutionStarted.php', + 'PHPUnit\\Event\\TestRunner\\ExecutionStartedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/ExecutionStartedSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\ExtensionBootstrapped' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/ExtensionBootstrapped.php', + 'PHPUnit\\Event\\TestRunner\\ExtensionBootstrappedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/ExtensionBootstrappedSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\ExtensionLoadedFromPhar' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/ExtensionLoadedFromPhar.php', + 'PHPUnit\\Event\\TestRunner\\ExtensionLoadedFromPharSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/ExtensionLoadedFromPharSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\Finished' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/Finished.php', + 'PHPUnit\\Event\\TestRunner\\FinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/FinishedSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\GarbageCollectionDisabled' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/GarbageCollectionDisabled.php', + 'PHPUnit\\Event\\TestRunner\\GarbageCollectionDisabledSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/GarbageCollectionDisabledSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\GarbageCollectionEnabled' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/GarbageCollectionEnabled.php', + 'PHPUnit\\Event\\TestRunner\\GarbageCollectionEnabledSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/GarbageCollectionEnabledSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\GarbageCollectionTriggered' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/GarbageCollectionTriggered.php', + 'PHPUnit\\Event\\TestRunner\\GarbageCollectionTriggeredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/GarbageCollectionTriggeredSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\Started' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/Started.php', + 'PHPUnit\\Event\\TestRunner\\StartedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/StartedSubscriber.php', + 'PHPUnit\\Event\\TestRunner\\WarningTriggered' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/WarningTriggered.php', + 'PHPUnit\\Event\\TestRunner\\WarningTriggeredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestRunner/WarningTriggeredSubscriber.php', + 'PHPUnit\\Event\\TestSuite\\Filtered' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestSuite/Filtered.php', + 'PHPUnit\\Event\\TestSuite\\FilteredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestSuite/FilteredSubscriber.php', + 'PHPUnit\\Event\\TestSuite\\Finished' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestSuite/Finished.php', + 'PHPUnit\\Event\\TestSuite\\FinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestSuite/FinishedSubscriber.php', + 'PHPUnit\\Event\\TestSuite\\Loaded' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestSuite/Loaded.php', + 'PHPUnit\\Event\\TestSuite\\LoadedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestSuite/LoadedSubscriber.php', + 'PHPUnit\\Event\\TestSuite\\Skipped' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestSuite/Skipped.php', + 'PHPUnit\\Event\\TestSuite\\SkippedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestSuite/SkippedSubscriber.php', + 'PHPUnit\\Event\\TestSuite\\Sorted' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestSuite/Sorted.php', + 'PHPUnit\\Event\\TestSuite\\SortedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestSuite/SortedSubscriber.php', + 'PHPUnit\\Event\\TestSuite\\Started' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestSuite/Started.php', + 'PHPUnit\\Event\\TestSuite\\StartedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/TestSuite/StartedSubscriber.php', + 'PHPUnit\\Event\\TestSuite\\TestSuite' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/TestSuite/TestSuite.php', + 'PHPUnit\\Event\\TestSuite\\TestSuiteBuilder' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/TestSuite/TestSuiteBuilder.php', + 'PHPUnit\\Event\\TestSuite\\TestSuiteForTestClass' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/TestSuite/TestSuiteForTestClass.php', + 'PHPUnit\\Event\\TestSuite\\TestSuiteForTestMethodWithDataProvider' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/TestSuite/TestSuiteForTestMethodWithDataProvider.php', + 'PHPUnit\\Event\\TestSuite\\TestSuiteWithName' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Value/TestSuite/TestSuiteWithName.php', + 'PHPUnit\\Event\\Test\\AfterLastTestMethodCalled' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/AfterLastTestMethodCalled.php', + 'PHPUnit\\Event\\Test\\AfterLastTestMethodCalledSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/AfterLastTestMethodCalledSubscriber.php', + 'PHPUnit\\Event\\Test\\AfterLastTestMethodFinished' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/AfterLastTestMethodFinished.php', + 'PHPUnit\\Event\\Test\\AfterLastTestMethodFinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/AfterLastTestMethodFinishedSubscriber.php', + 'PHPUnit\\Event\\Test\\AfterTestMethodCalled' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/AfterTestMethodCalled.php', + 'PHPUnit\\Event\\Test\\AfterTestMethodCalledSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/AfterTestMethodCalledSubscriber.php', + 'PHPUnit\\Event\\Test\\AfterTestMethodFinished' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/AfterTestMethodFinished.php', + 'PHPUnit\\Event\\Test\\AfterTestMethodFinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/AfterTestMethodFinishedSubscriber.php', + 'PHPUnit\\Event\\Test\\AssertionFailed' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Assertion/AssertionFailed.php', + 'PHPUnit\\Event\\Test\\AssertionFailedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Assertion/AssertionFailedSubscriber.php', + 'PHPUnit\\Event\\Test\\AssertionSucceeded' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Assertion/AssertionSucceeded.php', + 'PHPUnit\\Event\\Test\\AssertionSucceededSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Assertion/AssertionSucceededSubscriber.php', + 'PHPUnit\\Event\\Test\\BeforeFirstTestMethodCalled' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodCalled.php', + 'PHPUnit\\Event\\Test\\BeforeFirstTestMethodCalledSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodCalledSubscriber.php', + 'PHPUnit\\Event\\Test\\BeforeFirstTestMethodErrored' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodErrored.php', + 'PHPUnit\\Event\\Test\\BeforeFirstTestMethodErroredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodErroredSubscriber.php', + 'PHPUnit\\Event\\Test\\BeforeFirstTestMethodFinished' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodFinished.php', + 'PHPUnit\\Event\\Test\\BeforeFirstTestMethodFinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodFinishedSubscriber.php', + 'PHPUnit\\Event\\Test\\BeforeTestMethodCalled' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/BeforeTestMethodCalled.php', + 'PHPUnit\\Event\\Test\\BeforeTestMethodCalledSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/BeforeTestMethodCalledSubscriber.php', + 'PHPUnit\\Event\\Test\\BeforeTestMethodFinished' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/BeforeTestMethodFinished.php', + 'PHPUnit\\Event\\Test\\BeforeTestMethodFinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/BeforeTestMethodFinishedSubscriber.php', + 'PHPUnit\\Event\\Test\\ComparatorRegistered' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/ComparatorRegistered.php', + 'PHPUnit\\Event\\Test\\ComparatorRegisteredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/ComparatorRegisteredSubscriber.php', + 'PHPUnit\\Event\\Test\\ConsideredRisky' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Issue/ConsideredRisky.php', + 'PHPUnit\\Event\\Test\\ConsideredRiskySubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Issue/ConsideredRiskySubscriber.php', + 'PHPUnit\\Event\\Test\\DataProviderMethodCalled' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Lifecycle/DataProviderMethodCalled.php', + 'PHPUnit\\Event\\Test\\DataProviderMethodCalledSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Lifecycle/DataProviderMethodCalledSubscriber.php', + 'PHPUnit\\Event\\Test\\DataProviderMethodFinished' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Lifecycle/DataProviderMethodFinished.php', + 'PHPUnit\\Event\\Test\\DataProviderMethodFinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Lifecycle/DataProviderMethodFinishedSubscriber.php', + 'PHPUnit\\Event\\Test\\DeprecationTriggered' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Issue/DeprecationTriggered.php', + 'PHPUnit\\Event\\Test\\DeprecationTriggeredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Issue/DeprecationTriggeredSubscriber.php', + 'PHPUnit\\Event\\Test\\ErrorTriggered' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Issue/ErrorTriggered.php', + 'PHPUnit\\Event\\Test\\ErrorTriggeredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Issue/ErrorTriggeredSubscriber.php', + 'PHPUnit\\Event\\Test\\Errored' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Outcome/Errored.php', + 'PHPUnit\\Event\\Test\\ErroredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Outcome/ErroredSubscriber.php', + 'PHPUnit\\Event\\Test\\Failed' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Outcome/Failed.php', + 'PHPUnit\\Event\\Test\\FailedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Outcome/FailedSubscriber.php', + 'PHPUnit\\Event\\Test\\Finished' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Lifecycle/Finished.php', + 'PHPUnit\\Event\\Test\\FinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Lifecycle/FinishedSubscriber.php', + 'PHPUnit\\Event\\Test\\MarkedIncomplete' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Outcome/MarkedIncomplete.php', + 'PHPUnit\\Event\\Test\\MarkedIncompleteSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Outcome/MarkedIncompleteSubscriber.php', + 'PHPUnit\\Event\\Test\\MockObjectCreated' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/MockObjectCreated.php', + 'PHPUnit\\Event\\Test\\MockObjectCreatedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/MockObjectCreatedSubscriber.php', + 'PHPUnit\\Event\\Test\\MockObjectForAbstractClassCreated' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/MockObjectForAbstractClassCreated.php', + 'PHPUnit\\Event\\Test\\MockObjectForAbstractClassCreatedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/MockObjectForAbstractClassCreatedSubscriber.php', + 'PHPUnit\\Event\\Test\\MockObjectForIntersectionOfInterfacesCreated' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/MockObjectForIntersectionOfInterfacesCreated.php', + 'PHPUnit\\Event\\Test\\MockObjectForIntersectionOfInterfacesCreatedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/MockObjectForIntersectionOfInterfacesCreatedSubscriber.php', + 'PHPUnit\\Event\\Test\\MockObjectForTraitCreated' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/MockObjectForTraitCreated.php', + 'PHPUnit\\Event\\Test\\MockObjectForTraitCreatedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/MockObjectForTraitCreatedSubscriber.php', + 'PHPUnit\\Event\\Test\\MockObjectFromWsdlCreated' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/MockObjectFromWsdlCreated.php', + 'PHPUnit\\Event\\Test\\MockObjectFromWsdlCreatedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/MockObjectFromWsdlCreatedSubscriber.php', + 'PHPUnit\\Event\\Test\\NoComparisonFailureException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Exception/NoComparisonFailureException.php', + 'PHPUnit\\Event\\Test\\NoticeTriggered' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Issue/NoticeTriggered.php', + 'PHPUnit\\Event\\Test\\NoticeTriggeredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Issue/NoticeTriggeredSubscriber.php', + 'PHPUnit\\Event\\Test\\PartialMockObjectCreated' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/PartialMockObjectCreated.php', + 'PHPUnit\\Event\\Test\\PartialMockObjectCreatedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/PartialMockObjectCreatedSubscriber.php', + 'PHPUnit\\Event\\Test\\Passed' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Outcome/Passed.php', + 'PHPUnit\\Event\\Test\\PassedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Outcome/PassedSubscriber.php', + 'PHPUnit\\Event\\Test\\PhpDeprecationTriggered' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Issue/PhpDeprecationTriggered.php', + 'PHPUnit\\Event\\Test\\PhpDeprecationTriggeredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Issue/PhpDeprecationTriggeredSubscriber.php', + 'PHPUnit\\Event\\Test\\PhpNoticeTriggered' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Issue/PhpNoticeTriggered.php', + 'PHPUnit\\Event\\Test\\PhpNoticeTriggeredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Issue/PhpNoticeTriggeredSubscriber.php', + 'PHPUnit\\Event\\Test\\PhpWarningTriggered' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Issue/PhpWarningTriggered.php', + 'PHPUnit\\Event\\Test\\PhpWarningTriggeredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Issue/PhpWarningTriggeredSubscriber.php', + 'PHPUnit\\Event\\Test\\PhpunitDeprecationTriggered' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Issue/PhpunitDeprecationTriggered.php', + 'PHPUnit\\Event\\Test\\PhpunitDeprecationTriggeredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Issue/PhpunitDeprecationTriggeredSubscriber.php', + 'PHPUnit\\Event\\Test\\PhpunitErrorTriggered' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Issue/PhpunitErrorTriggered.php', + 'PHPUnit\\Event\\Test\\PhpunitErrorTriggeredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Issue/PhpunitErrorTriggeredSubscriber.php', + 'PHPUnit\\Event\\Test\\PhpunitWarningTriggered' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Issue/PhpunitWarningTriggered.php', + 'PHPUnit\\Event\\Test\\PhpunitWarningTriggeredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Issue/PhpunitWarningTriggeredSubscriber.php', + 'PHPUnit\\Event\\Test\\PostConditionCalled' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/PostConditionCalled.php', + 'PHPUnit\\Event\\Test\\PostConditionCalledSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/PostConditionCalledSubscriber.php', + 'PHPUnit\\Event\\Test\\PostConditionFinished' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/PostConditionFinished.php', + 'PHPUnit\\Event\\Test\\PostConditionFinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/PostConditionFinishedSubscriber.php', + 'PHPUnit\\Event\\Test\\PreConditionCalled' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/PreConditionCalled.php', + 'PHPUnit\\Event\\Test\\PreConditionCalledSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/PreConditionCalledSubscriber.php', + 'PHPUnit\\Event\\Test\\PreConditionFinished' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/PreConditionFinished.php', + 'PHPUnit\\Event\\Test\\PreConditionFinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/HookMethod/PreConditionFinishedSubscriber.php', + 'PHPUnit\\Event\\Test\\PreparationFailed' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Lifecycle/PreparationFailed.php', + 'PHPUnit\\Event\\Test\\PreparationFailedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Lifecycle/PreparationFailedSubscriber.php', + 'PHPUnit\\Event\\Test\\PreparationStarted' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Lifecycle/PreparationStarted.php', + 'PHPUnit\\Event\\Test\\PreparationStartedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Lifecycle/PreparationStartedSubscriber.php', + 'PHPUnit\\Event\\Test\\Prepared' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Lifecycle/Prepared.php', + 'PHPUnit\\Event\\Test\\PreparedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Lifecycle/PreparedSubscriber.php', + 'PHPUnit\\Event\\Test\\PrintedUnexpectedOutput' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/PrintedUnexpectedOutput.php', + 'PHPUnit\\Event\\Test\\PrintedUnexpectedOutputSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/PrintedUnexpectedOutputSubscriber.php', + 'PHPUnit\\Event\\Test\\Skipped' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Outcome/Skipped.php', + 'PHPUnit\\Event\\Test\\SkippedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Outcome/SkippedSubscriber.php', + 'PHPUnit\\Event\\Test\\TestProxyCreated' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/TestProxyCreated.php', + 'PHPUnit\\Event\\Test\\TestProxyCreatedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/TestProxyCreatedSubscriber.php', + 'PHPUnit\\Event\\Test\\TestStubCreated' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/TestStubCreated.php', + 'PHPUnit\\Event\\Test\\TestStubCreatedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/TestStubCreatedSubscriber.php', + 'PHPUnit\\Event\\Test\\TestStubForIntersectionOfInterfacesCreated' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/TestStubForIntersectionOfInterfacesCreated.php', + 'PHPUnit\\Event\\Test\\TestStubForIntersectionOfInterfacesCreatedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/TestDouble/TestStubForIntersectionOfInterfacesCreatedSubscriber.php', + 'PHPUnit\\Event\\Test\\WarningTriggered' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Issue/WarningTriggered.php', + 'PHPUnit\\Event\\Test\\WarningTriggeredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Events/Test/Issue/WarningTriggeredSubscriber.php', + 'PHPUnit\\Event\\Tracer\\Tracer' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Tracer.php', + 'PHPUnit\\Event\\TypeMap' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/TypeMap.php', + 'PHPUnit\\Event\\UnknownEventException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Exception/UnknownEventException.php', + 'PHPUnit\\Event\\UnknownEventTypeException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Exception/UnknownEventTypeException.php', + 'PHPUnit\\Event\\UnknownSubscriberException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Exception/UnknownSubscriberException.php', + 'PHPUnit\\Event\\UnknownSubscriberTypeException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Event/Exception/UnknownSubscriberTypeException.php', + 'PHPUnit\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Exception.php', + 'PHPUnit\\Framework\\ActualValueIsNotAnObjectException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/ObjectEquals/ActualValueIsNotAnObjectException.php', + 'PHPUnit\\Framework\\Assert' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Assert.php', + 'PHPUnit\\Framework\\AssertionFailedError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/AssertionFailedError.php', + 'PHPUnit\\Framework\\Attributes\\After' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/After.php', + 'PHPUnit\\Framework\\Attributes\\AfterClass' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/AfterClass.php', + 'PHPUnit\\Framework\\Attributes\\BackupGlobals' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/BackupGlobals.php', + 'PHPUnit\\Framework\\Attributes\\BackupStaticProperties' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/BackupStaticProperties.php', + 'PHPUnit\\Framework\\Attributes\\Before' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/Before.php', + 'PHPUnit\\Framework\\Attributes\\BeforeClass' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/BeforeClass.php', + 'PHPUnit\\Framework\\Attributes\\CodeCoverageIgnore' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/CodeCoverageIgnore.php', + 'PHPUnit\\Framework\\Attributes\\CoversClass' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/CoversClass.php', + 'PHPUnit\\Framework\\Attributes\\CoversFunction' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/CoversFunction.php', + 'PHPUnit\\Framework\\Attributes\\CoversNothing' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/CoversNothing.php', + 'PHPUnit\\Framework\\Attributes\\DataProvider' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/DataProvider.php', + 'PHPUnit\\Framework\\Attributes\\DataProviderExternal' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/DataProviderExternal.php', + 'PHPUnit\\Framework\\Attributes\\Depends' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/Depends.php', + 'PHPUnit\\Framework\\Attributes\\DependsExternal' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/DependsExternal.php', + 'PHPUnit\\Framework\\Attributes\\DependsExternalUsingDeepClone' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/DependsExternalUsingDeepClone.php', + 'PHPUnit\\Framework\\Attributes\\DependsExternalUsingShallowClone' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/DependsExternalUsingShallowClone.php', + 'PHPUnit\\Framework\\Attributes\\DependsOnClass' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/DependsOnClass.php', + 'PHPUnit\\Framework\\Attributes\\DependsOnClassUsingDeepClone' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/DependsOnClassUsingDeepClone.php', + 'PHPUnit\\Framework\\Attributes\\DependsOnClassUsingShallowClone' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/DependsOnClassUsingShallowClone.php', + 'PHPUnit\\Framework\\Attributes\\DependsUsingDeepClone' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/DependsUsingDeepClone.php', + 'PHPUnit\\Framework\\Attributes\\DependsUsingShallowClone' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/DependsUsingShallowClone.php', + 'PHPUnit\\Framework\\Attributes\\DoesNotPerformAssertions' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/DoesNotPerformAssertions.php', + 'PHPUnit\\Framework\\Attributes\\ExcludeGlobalVariableFromBackup' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/ExcludeGlobalVariableFromBackup.php', + 'PHPUnit\\Framework\\Attributes\\ExcludeStaticPropertyFromBackup' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/ExcludeStaticPropertyFromBackup.php', + 'PHPUnit\\Framework\\Attributes\\Group' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/Group.php', + 'PHPUnit\\Framework\\Attributes\\IgnoreClassForCodeCoverage' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/IgnoreClassForCodeCoverage.php', + 'PHPUnit\\Framework\\Attributes\\IgnoreDeprecations' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/IgnoreDeprecations.php', + 'PHPUnit\\Framework\\Attributes\\IgnoreFunctionForCodeCoverage' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/IgnoreFunctionForCodeCoverage.php', + 'PHPUnit\\Framework\\Attributes\\IgnoreMethodForCodeCoverage' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/IgnoreMethodForCodeCoverage.php', + 'PHPUnit\\Framework\\Attributes\\Large' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/Large.php', + 'PHPUnit\\Framework\\Attributes\\Medium' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/Medium.php', + 'PHPUnit\\Framework\\Attributes\\PostCondition' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/PostCondition.php', + 'PHPUnit\\Framework\\Attributes\\PreCondition' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/PreCondition.php', + 'PHPUnit\\Framework\\Attributes\\PreserveGlobalState' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/PreserveGlobalState.php', + 'PHPUnit\\Framework\\Attributes\\RequiresFunction' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/RequiresFunction.php', + 'PHPUnit\\Framework\\Attributes\\RequiresMethod' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/RequiresMethod.php', + 'PHPUnit\\Framework\\Attributes\\RequiresOperatingSystem' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/RequiresOperatingSystem.php', + 'PHPUnit\\Framework\\Attributes\\RequiresOperatingSystemFamily' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/RequiresOperatingSystemFamily.php', + 'PHPUnit\\Framework\\Attributes\\RequiresPhp' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/RequiresPhp.php', + 'PHPUnit\\Framework\\Attributes\\RequiresPhpExtension' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/RequiresPhpExtension.php', + 'PHPUnit\\Framework\\Attributes\\RequiresPhpunit' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/RequiresPhpunit.php', + 'PHPUnit\\Framework\\Attributes\\RequiresSetting' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/RequiresSetting.php', + 'PHPUnit\\Framework\\Attributes\\RunClassInSeparateProcess' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/RunClassInSeparateProcess.php', + 'PHPUnit\\Framework\\Attributes\\RunInSeparateProcess' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/RunInSeparateProcess.php', + 'PHPUnit\\Framework\\Attributes\\RunTestsInSeparateProcesses' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/RunTestsInSeparateProcesses.php', + 'PHPUnit\\Framework\\Attributes\\Small' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/Small.php', + 'PHPUnit\\Framework\\Attributes\\Test' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/Test.php', + 'PHPUnit\\Framework\\Attributes\\TestDox' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/TestDox.php', + 'PHPUnit\\Framework\\Attributes\\TestWith' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/TestWith.php', + 'PHPUnit\\Framework\\Attributes\\TestWithJson' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/TestWithJson.php', + 'PHPUnit\\Framework\\Attributes\\Ticket' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/Ticket.php', + 'PHPUnit\\Framework\\Attributes\\UsesClass' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/UsesClass.php', + 'PHPUnit\\Framework\\Attributes\\UsesFunction' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/UsesFunction.php', + 'PHPUnit\\Framework\\Attributes\\WithoutErrorHandler' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Attributes/WithoutErrorHandler.php', + 'PHPUnit\\Framework\\CodeCoverageException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/CodeCoverageException.php', + 'PHPUnit\\Framework\\ComparisonMethodDoesNotAcceptParameterTypeException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/ObjectEquals/ComparisonMethodDoesNotAcceptParameterTypeException.php', + 'PHPUnit\\Framework\\ComparisonMethodDoesNotDeclareBoolReturnTypeException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/ObjectEquals/ComparisonMethodDoesNotDeclareBoolReturnTypeException.php', + 'PHPUnit\\Framework\\ComparisonMethodDoesNotDeclareExactlyOneParameterException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/ObjectEquals/ComparisonMethodDoesNotDeclareExactlyOneParameterException.php', + 'PHPUnit\\Framework\\ComparisonMethodDoesNotDeclareParameterTypeException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/ObjectEquals/ComparisonMethodDoesNotDeclareParameterTypeException.php', + 'PHPUnit\\Framework\\ComparisonMethodDoesNotExistException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/ObjectEquals/ComparisonMethodDoesNotExistException.php', + 'PHPUnit\\Framework\\Constraint\\ArrayHasKey' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Traversable/ArrayHasKey.php', + 'PHPUnit\\Framework\\Constraint\\BinaryOperator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Operator/BinaryOperator.php', + 'PHPUnit\\Framework\\Constraint\\Callback' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Callback.php', + 'PHPUnit\\Framework\\Constraint\\Constraint' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Constraint.php', + 'PHPUnit\\Framework\\Constraint\\Count' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Cardinality/Count.php', + 'PHPUnit\\Framework\\Constraint\\DirectoryExists' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Filesystem/DirectoryExists.php', + 'PHPUnit\\Framework\\Constraint\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Exception/Exception.php', + 'PHPUnit\\Framework\\Constraint\\ExceptionCode' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Exception/ExceptionCode.php', + 'PHPUnit\\Framework\\Constraint\\ExceptionMessageIsOrContains' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Exception/ExceptionMessageIsOrContains.php', + 'PHPUnit\\Framework\\Constraint\\ExceptionMessageMatchesRegularExpression' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Exception/ExceptionMessageMatchesRegularExpression.php', + 'PHPUnit\\Framework\\Constraint\\FileExists' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Filesystem/FileExists.php', + 'PHPUnit\\Framework\\Constraint\\GreaterThan' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Cardinality/GreaterThan.php', + 'PHPUnit\\Framework\\Constraint\\IsAnything' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsAnything.php', + 'PHPUnit\\Framework\\Constraint\\IsEmpty' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Cardinality/IsEmpty.php', + 'PHPUnit\\Framework\\Constraint\\IsEqual' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Equality/IsEqual.php', + 'PHPUnit\\Framework\\Constraint\\IsEqualCanonicalizing' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Equality/IsEqualCanonicalizing.php', + 'PHPUnit\\Framework\\Constraint\\IsEqualIgnoringCase' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Equality/IsEqualIgnoringCase.php', + 'PHPUnit\\Framework\\Constraint\\IsEqualWithDelta' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Equality/IsEqualWithDelta.php', + 'PHPUnit\\Framework\\Constraint\\IsFalse' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Boolean/IsFalse.php', + 'PHPUnit\\Framework\\Constraint\\IsFinite' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Math/IsFinite.php', + 'PHPUnit\\Framework\\Constraint\\IsIdentical' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsIdentical.php', + 'PHPUnit\\Framework\\Constraint\\IsInfinite' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Math/IsInfinite.php', + 'PHPUnit\\Framework\\Constraint\\IsInstanceOf' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Type/IsInstanceOf.php', + 'PHPUnit\\Framework\\Constraint\\IsJson' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/String/IsJson.php', + 'PHPUnit\\Framework\\Constraint\\IsList' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Traversable/IsList.php', + 'PHPUnit\\Framework\\Constraint\\IsNan' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Math/IsNan.php', + 'PHPUnit\\Framework\\Constraint\\IsNull' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Type/IsNull.php', + 'PHPUnit\\Framework\\Constraint\\IsReadable' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Filesystem/IsReadable.php', + 'PHPUnit\\Framework\\Constraint\\IsTrue' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Boolean/IsTrue.php', + 'PHPUnit\\Framework\\Constraint\\IsType' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Type/IsType.php', + 'PHPUnit\\Framework\\Constraint\\IsWritable' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Filesystem/IsWritable.php', + 'PHPUnit\\Framework\\Constraint\\JsonMatches' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/JsonMatches.php', + 'PHPUnit\\Framework\\Constraint\\LessThan' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Cardinality/LessThan.php', + 'PHPUnit\\Framework\\Constraint\\LogicalAnd' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Operator/LogicalAnd.php', + 'PHPUnit\\Framework\\Constraint\\LogicalNot' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Operator/LogicalNot.php', + 'PHPUnit\\Framework\\Constraint\\LogicalOr' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Operator/LogicalOr.php', + 'PHPUnit\\Framework\\Constraint\\LogicalXor' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Operator/LogicalXor.php', + 'PHPUnit\\Framework\\Constraint\\ObjectEquals' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Object/ObjectEquals.php', + 'PHPUnit\\Framework\\Constraint\\ObjectHasProperty' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Object/ObjectHasProperty.php', + 'PHPUnit\\Framework\\Constraint\\Operator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Operator/Operator.php', + 'PHPUnit\\Framework\\Constraint\\RegularExpression' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/String/RegularExpression.php', + 'PHPUnit\\Framework\\Constraint\\SameSize' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Cardinality/SameSize.php', + 'PHPUnit\\Framework\\Constraint\\StringContains' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/String/StringContains.php', + 'PHPUnit\\Framework\\Constraint\\StringEndsWith' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/String/StringEndsWith.php', + 'PHPUnit\\Framework\\Constraint\\StringEqualsStringIgnoringLineEndings' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/String/StringEqualsStringIgnoringLineEndings.php', + 'PHPUnit\\Framework\\Constraint\\StringMatchesFormatDescription' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/String/StringMatchesFormatDescription.php', + 'PHPUnit\\Framework\\Constraint\\StringStartsWith' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/String/StringStartsWith.php', + 'PHPUnit\\Framework\\Constraint\\TraversableContains' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Traversable/TraversableContains.php', + 'PHPUnit\\Framework\\Constraint\\TraversableContainsEqual' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Traversable/TraversableContainsEqual.php', + 'PHPUnit\\Framework\\Constraint\\TraversableContainsIdentical' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Traversable/TraversableContainsIdentical.php', + 'PHPUnit\\Framework\\Constraint\\TraversableContainsOnly' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Traversable/TraversableContainsOnly.php', + 'PHPUnit\\Framework\\Constraint\\UnaryOperator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Operator/UnaryOperator.php', + 'PHPUnit\\Framework\\DataProviderTestSuite' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/DataProviderTestSuite.php', + 'PHPUnit\\Framework\\EmptyStringException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/EmptyStringException.php', + 'PHPUnit\\Framework\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/Exception.php', + 'PHPUnit\\Framework\\ExecutionOrderDependency' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/ExecutionOrderDependency.php', + 'PHPUnit\\Framework\\ExpectationFailedException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/ExpectationFailedException.php', + 'PHPUnit\\Framework\\GeneratorNotSupportedException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/GeneratorNotSupportedException.php', + 'PHPUnit\\Framework\\IncompleteTest' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/Incomplete/IncompleteTest.php', + 'PHPUnit\\Framework\\IncompleteTestError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/Incomplete/IncompleteTestError.php', + 'PHPUnit\\Framework\\InvalidArgumentException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/InvalidArgumentException.php', + 'PHPUnit\\Framework\\InvalidCoversTargetException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/InvalidCoversTargetException.php', + 'PHPUnit\\Framework\\InvalidDataProviderException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/InvalidDataProviderException.php', + 'PHPUnit\\Framework\\InvalidDependencyException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/InvalidDependencyException.php', + 'PHPUnit\\Framework\\MockObject\\BadMethodCallException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/BadMethodCallException.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\Identity' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Builder/Identity.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\InvocationMocker' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Builder/InvocationMocker.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\InvocationStubber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Builder/InvocationStubber.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\MethodNameMatch' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Builder/MethodNameMatch.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\ParametersMatch' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Builder/ParametersMatch.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\Stub' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Builder/Stub.php', + 'PHPUnit\\Framework\\MockObject\\CannotUseOnlyMethodsException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/CannotUseOnlyMethodsException.php', + 'PHPUnit\\Framework\\MockObject\\ConfigurableMethod' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/ConfigurableMethod.php', + 'PHPUnit\\Framework\\MockObject\\DoubledCloneMethod' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Api/DoubledCloneMethod.php', + 'PHPUnit\\Framework\\MockObject\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/Exception.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\CannotUseAddMethodsException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/CannotUseAddMethodsException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\ClassIsEnumerationException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/ClassIsEnumerationException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\ClassIsFinalException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/ClassIsFinalException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\ClassIsReadonlyException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/ClassIsReadonlyException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\DuplicateMethodException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/DuplicateMethodException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/Exception.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\Generator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Generator/Generator.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\InvalidMethodNameException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/InvalidMethodNameException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\MockClass' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Generator/MockClass.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\MockMethod' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Generator/MockMethod.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\MockMethodSet' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Generator/MockMethodSet.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\MockTrait' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Generator/MockTrait.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\MockType' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Generator/MockType.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\NameAlreadyInUseException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/NameAlreadyInUseException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\OriginalConstructorInvocationRequiredException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/OriginalConstructorInvocationRequiredException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\ReflectionException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/ReflectionException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\RuntimeException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/RuntimeException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\SoapExtensionNotAvailableException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/SoapExtensionNotAvailableException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\TemplateLoader' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Generator/TemplateLoader.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\UnknownClassException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/UnknownClassException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\UnknownTraitException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/UnknownTraitException.php', + 'PHPUnit\\Framework\\MockObject\\Generator\\UnknownTypeException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Generator/Exception/UnknownTypeException.php', + 'PHPUnit\\Framework\\MockObject\\IncompatibleReturnValueException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/IncompatibleReturnValueException.php', + 'PHPUnit\\Framework\\MockObject\\Invocation' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Invocation.php', + 'PHPUnit\\Framework\\MockObject\\InvocationHandler' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/InvocationHandler.php', + 'PHPUnit\\Framework\\MockObject\\MatchBuilderNotFoundException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/MatchBuilderNotFoundException.php', + 'PHPUnit\\Framework\\MockObject\\Matcher' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Matcher.php', + 'PHPUnit\\Framework\\MockObject\\MatcherAlreadyRegisteredException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/MatcherAlreadyRegisteredException.php', + 'PHPUnit\\Framework\\MockObject\\Method' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Api/Method.php', + 'PHPUnit\\Framework\\MockObject\\MethodCannotBeConfiguredException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/MethodCannotBeConfiguredException.php', + 'PHPUnit\\Framework\\MockObject\\MethodNameAlreadyConfiguredException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/MethodNameAlreadyConfiguredException.php', + 'PHPUnit\\Framework\\MockObject\\MethodNameConstraint' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/MethodNameConstraint.php', + 'PHPUnit\\Framework\\MockObject\\MethodNameNotConfiguredException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/MethodNameNotConfiguredException.php', + 'PHPUnit\\Framework\\MockObject\\MethodParametersAlreadyConfiguredException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/MethodParametersAlreadyConfiguredException.php', + 'PHPUnit\\Framework\\MockObject\\MockBuilder' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/MockBuilder.php', + 'PHPUnit\\Framework\\MockObject\\MockObject' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Interface/MockObject.php', + 'PHPUnit\\Framework\\MockObject\\MockObjectApi' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Api/MockObjectApi.php', + 'PHPUnit\\Framework\\MockObject\\MockObjectInternal' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Interface/MockObjectInternal.php', + 'PHPUnit\\Framework\\MockObject\\NeverReturningMethodException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/NeverReturningMethodException.php', + 'PHPUnit\\Framework\\MockObject\\NoMoreReturnValuesConfiguredException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/NoMoreReturnValuesConfiguredException.php', + 'PHPUnit\\Framework\\MockObject\\ProxiedCloneMethod' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Api/ProxiedCloneMethod.php', + 'PHPUnit\\Framework\\MockObject\\ReflectionException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/ReflectionException.php', + 'PHPUnit\\Framework\\MockObject\\ReturnValueGenerator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/ReturnValueGenerator.php', + 'PHPUnit\\Framework\\MockObject\\ReturnValueNotConfiguredException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/ReturnValueNotConfiguredException.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\AnyInvokedCount' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Rule/AnyInvokedCount.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\AnyParameters' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Rule/AnyParameters.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\InvocationOrder' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Rule/InvocationOrder.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\InvokedAtLeastCount' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Rule/InvokedAtLeastCount.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\InvokedAtLeastOnce' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Rule/InvokedAtLeastOnce.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\InvokedAtMostCount' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Rule/InvokedAtMostCount.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\InvokedCount' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Rule/InvokedCount.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\MethodName' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Rule/MethodName.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\Parameters' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Rule/Parameters.php', + 'PHPUnit\\Framework\\MockObject\\Rule\\ParametersRule' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Rule/ParametersRule.php', + 'PHPUnit\\Framework\\MockObject\\RuntimeException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/RuntimeException.php', + 'PHPUnit\\Framework\\MockObject\\Stub' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Interface/Stub.php', + 'PHPUnit\\Framework\\MockObject\\StubApi' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Api/StubApi.php', + 'PHPUnit\\Framework\\MockObject\\StubInternal' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Interface/StubInternal.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ConsecutiveCalls' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/ConsecutiveCalls.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/Exception.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnArgument' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/ReturnArgument.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnCallback' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/ReturnCallback.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnReference' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/ReturnReference.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnSelf' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/ReturnSelf.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnStub' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/ReturnStub.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnValueMap' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/ReturnValueMap.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\Stub' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/Stub.php', + 'PHPUnit\\Framework\\NoChildTestSuiteException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/NoChildTestSuiteException.php', + 'PHPUnit\\Framework\\PhptAssertionFailedError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/PhptAssertionFailedError.php', + 'PHPUnit\\Framework\\ProcessIsolationException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/ProcessIsolationException.php', + 'PHPUnit\\Framework\\Reorderable' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Reorderable.php', + 'PHPUnit\\Framework\\SelfDescribing' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/SelfDescribing.php', + 'PHPUnit\\Framework\\SkippedTest' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/Skipped/SkippedTest.php', + 'PHPUnit\\Framework\\SkippedTestSuiteError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/Skipped/SkippedTestSuiteError.php', + 'PHPUnit\\Framework\\SkippedWithMessageException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/Skipped/SkippedWithMessageException.php', + 'PHPUnit\\Framework\\Test' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Test.php', + 'PHPUnit\\Framework\\TestBuilder' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestBuilder.php', + 'PHPUnit\\Framework\\TestCase' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestCase.php', + 'PHPUnit\\Framework\\TestRunner' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestRunner.php', + 'PHPUnit\\Framework\\TestSize\\Known' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestSize/Known.php', + 'PHPUnit\\Framework\\TestSize\\Large' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestSize/Large.php', + 'PHPUnit\\Framework\\TestSize\\Medium' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestSize/Medium.php', + 'PHPUnit\\Framework\\TestSize\\Small' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestSize/Small.php', + 'PHPUnit\\Framework\\TestSize\\TestSize' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestSize/TestSize.php', + 'PHPUnit\\Framework\\TestSize\\Unknown' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestSize/Unknown.php', + 'PHPUnit\\Framework\\TestStatus\\Deprecation' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestStatus/Deprecation.php', + 'PHPUnit\\Framework\\TestStatus\\Error' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestStatus/Error.php', + 'PHPUnit\\Framework\\TestStatus\\Failure' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestStatus/Failure.php', + 'PHPUnit\\Framework\\TestStatus\\Incomplete' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestStatus/Incomplete.php', + 'PHPUnit\\Framework\\TestStatus\\Known' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestStatus/Known.php', + 'PHPUnit\\Framework\\TestStatus\\Notice' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestStatus/Notice.php', + 'PHPUnit\\Framework\\TestStatus\\Risky' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestStatus/Risky.php', + 'PHPUnit\\Framework\\TestStatus\\Skipped' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestStatus/Skipped.php', + 'PHPUnit\\Framework\\TestStatus\\Success' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestStatus/Success.php', + 'PHPUnit\\Framework\\TestStatus\\TestStatus' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestStatus/TestStatus.php', + 'PHPUnit\\Framework\\TestStatus\\Unknown' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestStatus/Unknown.php', + 'PHPUnit\\Framework\\TestStatus\\Warning' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestStatus/Warning.php', + 'PHPUnit\\Framework\\TestSuite' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestSuite.php', + 'PHPUnit\\Framework\\TestSuiteIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestSuiteIterator.php', + 'PHPUnit\\Framework\\UnknownClassOrInterfaceException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/UnknownClassOrInterfaceException.php', + 'PHPUnit\\Framework\\UnknownTypeException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/UnknownTypeException.php', + 'PHPUnit\\Logging\\EventLogger' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/EventLogger.php', + 'PHPUnit\\Logging\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/Exception.php', + 'PHPUnit\\Logging\\JUnit\\JunitXmlLogger' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/JUnit/JunitXmlLogger.php', + 'PHPUnit\\Logging\\JUnit\\Subscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/JUnit/Subscriber/Subscriber.php', + 'PHPUnit\\Logging\\JUnit\\TestErroredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/JUnit/Subscriber/TestErroredSubscriber.php', + 'PHPUnit\\Logging\\JUnit\\TestFailedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/JUnit/Subscriber/TestFailedSubscriber.php', + 'PHPUnit\\Logging\\JUnit\\TestFinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/JUnit/Subscriber/TestFinishedSubscriber.php', + 'PHPUnit\\Logging\\JUnit\\TestMarkedIncompleteSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/JUnit/Subscriber/TestMarkedIncompleteSubscriber.php', + 'PHPUnit\\Logging\\JUnit\\TestPreparationFailedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/JUnit/Subscriber/TestPreparationFailedSubscriber.php', + 'PHPUnit\\Logging\\JUnit\\TestPreparationStartedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/JUnit/Subscriber/TestPreparationStartedSubscriber.php', + 'PHPUnit\\Logging\\JUnit\\TestPreparedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/JUnit/Subscriber/TestPreparedSubscriber.php', + 'PHPUnit\\Logging\\JUnit\\TestRunnerExecutionFinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/JUnit/Subscriber/TestRunnerExecutionFinishedSubscriber.php', + 'PHPUnit\\Logging\\JUnit\\TestSkippedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/JUnit/Subscriber/TestSkippedSubscriber.php', + 'PHPUnit\\Logging\\JUnit\\TestSuiteFinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/JUnit/Subscriber/TestSuiteFinishedSubscriber.php', + 'PHPUnit\\Logging\\JUnit\\TestSuiteStartedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/JUnit/Subscriber/TestSuiteStartedSubscriber.php', + 'PHPUnit\\Logging\\TeamCity\\Subscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TeamCity/Subscriber/Subscriber.php', + 'PHPUnit\\Logging\\TeamCity\\TeamCityLogger' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TeamCity/TeamCityLogger.php', + 'PHPUnit\\Logging\\TeamCity\\TestConsideredRiskySubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TeamCity/Subscriber/TestConsideredRiskySubscriber.php', + 'PHPUnit\\Logging\\TeamCity\\TestErroredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TeamCity/Subscriber/TestErroredSubscriber.php', + 'PHPUnit\\Logging\\TeamCity\\TestFailedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TeamCity/Subscriber/TestFailedSubscriber.php', + 'PHPUnit\\Logging\\TeamCity\\TestFinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TeamCity/Subscriber/TestFinishedSubscriber.php', + 'PHPUnit\\Logging\\TeamCity\\TestMarkedIncompleteSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TeamCity/Subscriber/TestMarkedIncompleteSubscriber.php', + 'PHPUnit\\Logging\\TeamCity\\TestPreparedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TeamCity/Subscriber/TestPreparedSubscriber.php', + 'PHPUnit\\Logging\\TeamCity\\TestRunnerExecutionFinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TeamCity/Subscriber/TestRunnerExecutionFinishedSubscriber.php', + 'PHPUnit\\Logging\\TeamCity\\TestSkippedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TeamCity/Subscriber/TestSkippedSubscriber.php', + 'PHPUnit\\Logging\\TeamCity\\TestSuiteFinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TeamCity/Subscriber/TestSuiteFinishedSubscriber.php', + 'PHPUnit\\Logging\\TeamCity\\TestSuiteStartedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TeamCity/Subscriber/TestSuiteStartedSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\HtmlRenderer' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/HtmlRenderer.php', + 'PHPUnit\\Logging\\TestDox\\NamePrettifier' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/NamePrettifier.php', + 'PHPUnit\\Logging\\TestDox\\PlainTextRenderer' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/PlainTextRenderer.php', + 'PHPUnit\\Logging\\TestDox\\Subscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/Subscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestConsideredRiskySubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestConsideredRiskySubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestErroredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestErroredSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestFailedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestFailedSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestFinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestFinishedSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestMarkedIncompleteSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestMarkedIncompleteSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestPassedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestPassedSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestPreparedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestPreparedSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestResult' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/TestResult/TestResult.php', + 'PHPUnit\\Logging\\TestDox\\TestResultCollection' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/TestResult/TestResultCollection.php', + 'PHPUnit\\Logging\\TestDox\\TestResultCollectionIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/TestResult/TestResultCollectionIterator.php', + 'PHPUnit\\Logging\\TestDox\\TestResultCollector' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/TestResult/TestResultCollector.php', + 'PHPUnit\\Logging\\TestDox\\TestSkippedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestSkippedSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestTriggeredDeprecationSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestTriggeredDeprecationSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestTriggeredNoticeSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestTriggeredNoticeSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestTriggeredPhpDeprecationSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestTriggeredPhpDeprecationSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestTriggeredPhpNoticeSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestTriggeredPhpNoticeSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestTriggeredPhpWarningSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestTriggeredPhpWarningSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestTriggeredPhpunitDeprecationSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestTriggeredPhpunitDeprecationSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestTriggeredPhpunitErrorSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestTriggeredPhpunitErrorSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestTriggeredPhpunitWarningSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestTriggeredPhpunitWarningSubscriber.php', + 'PHPUnit\\Logging\\TestDox\\TestTriggeredWarningSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Logging/TestDox/TestResult/Subscriber/TestTriggeredWarningSubscriber.php', + 'PHPUnit\\Metadata\\After' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/After.php', + 'PHPUnit\\Metadata\\AfterClass' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/AfterClass.php', + 'PHPUnit\\Metadata\\Annotation\\Parser\\DocBlock' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Parser/Annotation/DocBlock.php', + 'PHPUnit\\Metadata\\Annotation\\Parser\\Registry' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Parser/Annotation/Registry.php', + 'PHPUnit\\Metadata\\AnnotationsAreNotSupportedForInternalClassesException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Exception/AnnotationsAreNotSupportedForInternalClassesException.php', + 'PHPUnit\\Metadata\\Api\\CodeCoverage' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Api/CodeCoverage.php', + 'PHPUnit\\Metadata\\Api\\DataProvider' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Api/DataProvider.php', + 'PHPUnit\\Metadata\\Api\\Dependencies' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Api/Dependencies.php', + 'PHPUnit\\Metadata\\Api\\Groups' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Api/Groups.php', + 'PHPUnit\\Metadata\\Api\\HookMethods' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Api/HookMethods.php', + 'PHPUnit\\Metadata\\Api\\Requirements' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Api/Requirements.php', + 'PHPUnit\\Metadata\\BackupGlobals' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/BackupGlobals.php', + 'PHPUnit\\Metadata\\BackupStaticProperties' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/BackupStaticProperties.php', + 'PHPUnit\\Metadata\\Before' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Before.php', + 'PHPUnit\\Metadata\\BeforeClass' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/BeforeClass.php', + 'PHPUnit\\Metadata\\Covers' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Covers.php', + 'PHPUnit\\Metadata\\CoversClass' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/CoversClass.php', + 'PHPUnit\\Metadata\\CoversDefaultClass' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/CoversDefaultClass.php', + 'PHPUnit\\Metadata\\CoversFunction' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/CoversFunction.php', + 'PHPUnit\\Metadata\\CoversNothing' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/CoversNothing.php', + 'PHPUnit\\Metadata\\DataProvider' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/DataProvider.php', + 'PHPUnit\\Metadata\\DependsOnClass' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/DependsOnClass.php', + 'PHPUnit\\Metadata\\DependsOnMethod' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/DependsOnMethod.php', + 'PHPUnit\\Metadata\\DoesNotPerformAssertions' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/DoesNotPerformAssertions.php', + 'PHPUnit\\Metadata\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Exception/Exception.php', + 'PHPUnit\\Metadata\\ExcludeGlobalVariableFromBackup' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/ExcludeGlobalVariableFromBackup.php', + 'PHPUnit\\Metadata\\ExcludeStaticPropertyFromBackup' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/ExcludeStaticPropertyFromBackup.php', + 'PHPUnit\\Metadata\\Group' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Group.php', + 'PHPUnit\\Metadata\\IgnoreClassForCodeCoverage' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/IgnoreClassForCodeCoverage.php', + 'PHPUnit\\Metadata\\IgnoreDeprecations' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/IgnoreDeprecations.php', + 'PHPUnit\\Metadata\\IgnoreFunctionForCodeCoverage' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/IgnoreFunctionForCodeCoverage.php', + 'PHPUnit\\Metadata\\IgnoreMethodForCodeCoverage' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/IgnoreMethodForCodeCoverage.php', + 'PHPUnit\\Metadata\\InvalidVersionRequirementException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Exception/InvalidVersionRequirementException.php', + 'PHPUnit\\Metadata\\Metadata' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Metadata.php', + 'PHPUnit\\Metadata\\MetadataCollection' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/MetadataCollection.php', + 'PHPUnit\\Metadata\\MetadataCollectionIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/MetadataCollectionIterator.php', + 'PHPUnit\\Metadata\\NoVersionRequirementException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Exception/NoVersionRequirementException.php', + 'PHPUnit\\Metadata\\Parser\\AnnotationParser' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Parser/AnnotationParser.php', + 'PHPUnit\\Metadata\\Parser\\AttributeParser' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Parser/AttributeParser.php', + 'PHPUnit\\Metadata\\Parser\\CachingParser' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Parser/CachingParser.php', + 'PHPUnit\\Metadata\\Parser\\Parser' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Parser/Parser.php', + 'PHPUnit\\Metadata\\Parser\\ParserChain' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Parser/ParserChain.php', + 'PHPUnit\\Metadata\\Parser\\Registry' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Parser/Registry.php', + 'PHPUnit\\Metadata\\PostCondition' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/PostCondition.php', + 'PHPUnit\\Metadata\\PreCondition' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/PreCondition.php', + 'PHPUnit\\Metadata\\PreserveGlobalState' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/PreserveGlobalState.php', + 'PHPUnit\\Metadata\\ReflectionException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Exception/ReflectionException.php', + 'PHPUnit\\Metadata\\RequiresFunction' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/RequiresFunction.php', + 'PHPUnit\\Metadata\\RequiresMethod' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/RequiresMethod.php', + 'PHPUnit\\Metadata\\RequiresOperatingSystem' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/RequiresOperatingSystem.php', + 'PHPUnit\\Metadata\\RequiresOperatingSystemFamily' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/RequiresOperatingSystemFamily.php', + 'PHPUnit\\Metadata\\RequiresPhp' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/RequiresPhp.php', + 'PHPUnit\\Metadata\\RequiresPhpExtension' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/RequiresPhpExtension.php', + 'PHPUnit\\Metadata\\RequiresPhpunit' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/RequiresPhpunit.php', + 'PHPUnit\\Metadata\\RequiresSetting' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/RequiresSetting.php', + 'PHPUnit\\Metadata\\RunClassInSeparateProcess' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/RunClassInSeparateProcess.php', + 'PHPUnit\\Metadata\\RunInSeparateProcess' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/RunInSeparateProcess.php', + 'PHPUnit\\Metadata\\RunTestsInSeparateProcesses' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/RunTestsInSeparateProcesses.php', + 'PHPUnit\\Metadata\\Test' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Test.php', + 'PHPUnit\\Metadata\\TestDox' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/TestDox.php', + 'PHPUnit\\Metadata\\TestWith' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/TestWith.php', + 'PHPUnit\\Metadata\\Uses' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Uses.php', + 'PHPUnit\\Metadata\\UsesClass' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/UsesClass.php', + 'PHPUnit\\Metadata\\UsesDefaultClass' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/UsesDefaultClass.php', + 'PHPUnit\\Metadata\\UsesFunction' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/UsesFunction.php', + 'PHPUnit\\Metadata\\Version\\ComparisonRequirement' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Version/ComparisonRequirement.php', + 'PHPUnit\\Metadata\\Version\\ConstraintRequirement' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Version/ConstraintRequirement.php', + 'PHPUnit\\Metadata\\Version\\Requirement' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/Version/Requirement.php', + 'PHPUnit\\Metadata\\WithoutErrorHandler' => __DIR__ . '/..' . '/phpunit/phpunit/src/Metadata/WithoutErrorHandler.php', + 'PHPUnit\\Runner\\Baseline\\Baseline' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Baseline/Baseline.php', + 'PHPUnit\\Runner\\Baseline\\CannotLoadBaselineException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Baseline/Exception/CannotLoadBaselineException.php', + 'PHPUnit\\Runner\\Baseline\\FileDoesNotHaveLineException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Baseline/Exception/FileDoesNotHaveLineException.php', + 'PHPUnit\\Runner\\Baseline\\Generator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Baseline/Generator.php', + 'PHPUnit\\Runner\\Baseline\\Issue' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Baseline/Issue.php', + 'PHPUnit\\Runner\\Baseline\\Reader' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Baseline/Reader.php', + 'PHPUnit\\Runner\\Baseline\\RelativePathCalculator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Baseline/RelativePathCalculator.php', + 'PHPUnit\\Runner\\Baseline\\Subscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Baseline/Subscriber/Subscriber.php', + 'PHPUnit\\Runner\\Baseline\\TestTriggeredDeprecationSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Baseline/Subscriber/TestTriggeredDeprecationSubscriber.php', + 'PHPUnit\\Runner\\Baseline\\TestTriggeredNoticeSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Baseline/Subscriber/TestTriggeredNoticeSubscriber.php', + 'PHPUnit\\Runner\\Baseline\\TestTriggeredPhpDeprecationSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Baseline/Subscriber/TestTriggeredPhpDeprecationSubscriber.php', + 'PHPUnit\\Runner\\Baseline\\TestTriggeredPhpNoticeSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Baseline/Subscriber/TestTriggeredPhpNoticeSubscriber.php', + 'PHPUnit\\Runner\\Baseline\\TestTriggeredPhpWarningSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Baseline/Subscriber/TestTriggeredPhpWarningSubscriber.php', + 'PHPUnit\\Runner\\Baseline\\TestTriggeredWarningSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Baseline/Subscriber/TestTriggeredWarningSubscriber.php', + 'PHPUnit\\Runner\\Baseline\\Writer' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Baseline/Writer.php', + 'PHPUnit\\Runner\\ClassCannotBeFoundException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Exception/ClassCannotBeFoundException.php', + 'PHPUnit\\Runner\\ClassDoesNotExtendTestCaseException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Exception/ClassDoesNotExtendTestCaseException.php', + 'PHPUnit\\Runner\\ClassIsAbstractException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Exception/ClassIsAbstractException.php', + 'PHPUnit\\Runner\\CodeCoverage' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/CodeCoverage.php', + 'PHPUnit\\Runner\\DirectoryDoesNotExistException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Exception/DirectoryDoesNotExistException.php', + 'PHPUnit\\Runner\\ErrorException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Exception/ErrorException.php', + 'PHPUnit\\Runner\\ErrorHandler' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/ErrorHandler.php', + 'PHPUnit\\Runner\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Exception/Exception.php', + 'PHPUnit\\Runner\\Extension\\Extension' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Extension/Extension.php', + 'PHPUnit\\Runner\\Extension\\ExtensionBootstrapper' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Extension/ExtensionBootstrapper.php', + 'PHPUnit\\Runner\\Extension\\Facade' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Extension/Facade.php', + 'PHPUnit\\Runner\\Extension\\ParameterCollection' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Extension/ParameterCollection.php', + 'PHPUnit\\Runner\\Extension\\PharLoader' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Extension/PharLoader.php', + 'PHPUnit\\Runner\\FileDoesNotExistException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Exception/FileDoesNotExistException.php', + 'PHPUnit\\Runner\\Filter\\ExcludeGroupFilterIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Filter/ExcludeGroupFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\Factory' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Filter/Factory.php', + 'PHPUnit\\Runner\\Filter\\GroupFilterIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Filter/GroupFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\IncludeGroupFilterIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Filter/IncludeGroupFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\NameFilterIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Filter/NameFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\TestIdFilterIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Filter/TestIdFilterIterator.php', + 'PHPUnit\\Runner\\GarbageCollection\\ExecutionFinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/GarbageCollection/Subscriber/ExecutionFinishedSubscriber.php', + 'PHPUnit\\Runner\\GarbageCollection\\ExecutionStartedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/GarbageCollection/Subscriber/ExecutionStartedSubscriber.php', + 'PHPUnit\\Runner\\GarbageCollection\\GarbageCollectionHandler' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/GarbageCollection/GarbageCollectionHandler.php', + 'PHPUnit\\Runner\\GarbageCollection\\Subscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/GarbageCollection/Subscriber/Subscriber.php', + 'PHPUnit\\Runner\\GarbageCollection\\TestFinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/GarbageCollection/Subscriber/TestFinishedSubscriber.php', + 'PHPUnit\\Runner\\InvalidOrderException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Exception/InvalidOrderException.php', + 'PHPUnit\\Runner\\InvalidPhptFileException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Exception/InvalidPhptFileException.php', + 'PHPUnit\\Runner\\NoIgnoredEventException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Exception/NoIgnoredEventException.php', + 'PHPUnit\\Runner\\ParameterDoesNotExistException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Exception/ParameterDoesNotExistException.php', + 'PHPUnit\\Runner\\PhptExternalFileCannotBeLoadedException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Exception/PhptExternalFileCannotBeLoadedException.php', + 'PHPUnit\\Runner\\PhptTestCase' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/PhptTestCase.php', + 'PHPUnit\\Runner\\ReflectionException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Exception/ReflectionException.php', + 'PHPUnit\\Runner\\ResultCache\\DefaultResultCache' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/ResultCache/DefaultResultCache.php', + 'PHPUnit\\Runner\\ResultCache\\NullResultCache' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/ResultCache/NullResultCache.php', + 'PHPUnit\\Runner\\ResultCache\\ResultCache' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/ResultCache/ResultCache.php', + 'PHPUnit\\Runner\\ResultCache\\ResultCacheHandler' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/ResultCache/ResultCacheHandler.php', + 'PHPUnit\\Runner\\ResultCache\\Subscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/ResultCache/Subscriber/Subscriber.php', + 'PHPUnit\\Runner\\ResultCache\\TestConsideredRiskySubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/ResultCache/Subscriber/TestConsideredRiskySubscriber.php', + 'PHPUnit\\Runner\\ResultCache\\TestErroredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/ResultCache/Subscriber/TestErroredSubscriber.php', + 'PHPUnit\\Runner\\ResultCache\\TestFailedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/ResultCache/Subscriber/TestFailedSubscriber.php', + 'PHPUnit\\Runner\\ResultCache\\TestFinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/ResultCache/Subscriber/TestFinishedSubscriber.php', + 'PHPUnit\\Runner\\ResultCache\\TestMarkedIncompleteSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/ResultCache/Subscriber/TestMarkedIncompleteSubscriber.php', + 'PHPUnit\\Runner\\ResultCache\\TestPreparedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/ResultCache/Subscriber/TestPreparedSubscriber.php', + 'PHPUnit\\Runner\\ResultCache\\TestSkippedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/ResultCache/Subscriber/TestSkippedSubscriber.php', + 'PHPUnit\\Runner\\ResultCache\\TestSuiteFinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/ResultCache/Subscriber/TestSuiteFinishedSubscriber.php', + 'PHPUnit\\Runner\\ResultCache\\TestSuiteStartedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/ResultCache/Subscriber/TestSuiteStartedSubscriber.php', + 'PHPUnit\\Runner\\TestSuiteLoader' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestSuiteLoader.php', + 'PHPUnit\\Runner\\TestSuiteSorter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestSuiteSorter.php', + 'PHPUnit\\Runner\\UnsupportedPhptSectionException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Exception/UnsupportedPhptSectionException.php', + 'PHPUnit\\Runner\\Version' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Version.php', + 'PHPUnit\\TestRunner\\TestResult\\BeforeTestClassMethodErroredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/BeforeTestClassMethodErroredSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\Collector' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Collector.php', + 'PHPUnit\\TestRunner\\TestResult\\ExecutionStartedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/ExecutionStartedSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\Facade' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Facade.php', + 'PHPUnit\\TestRunner\\TestResult\\Issues\\Issue' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Issue.php', + 'PHPUnit\\TestRunner\\TestResult\\PassedTests' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/PassedTests.php', + 'PHPUnit\\TestRunner\\TestResult\\Subscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/Subscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestConsideredRiskySubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestConsideredRiskySubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestErroredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestErroredSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestFailedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestFailedSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestFinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestFinishedSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestMarkedIncompleteSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestMarkedIncompleteSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestPreparedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestPreparedSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestResult' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/TestResult.php', + 'PHPUnit\\TestRunner\\TestResult\\TestRunnerTriggeredDeprecationSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestRunnerTriggeredDeprecationSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestRunnerTriggeredWarningSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestRunnerTriggeredWarningSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestSkippedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestSkippedSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestSuiteFinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestSuiteFinishedSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestSuiteSkippedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestSuiteSkippedSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestSuiteStartedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestSuiteStartedSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestTriggeredDeprecationSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestTriggeredDeprecationSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestTriggeredErrorSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestTriggeredErrorSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestTriggeredNoticeSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestTriggeredNoticeSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestTriggeredPhpDeprecationSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestTriggeredPhpDeprecationSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestTriggeredPhpNoticeSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestTriggeredPhpNoticeSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestTriggeredPhpWarningSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestTriggeredPhpWarningSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestTriggeredPhpunitDeprecationSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestTriggeredPhpunitDeprecationSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestTriggeredPhpunitErrorSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestTriggeredPhpunitErrorSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestTriggeredPhpunitWarningSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestTriggeredPhpunitWarningSubscriber.php', + 'PHPUnit\\TestRunner\\TestResult\\TestTriggeredWarningSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestResult/Subscriber/TestTriggeredWarningSubscriber.php', + 'PHPUnit\\TextUI\\Application' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Application.php', + 'PHPUnit\\TextUI\\CannotOpenSocketException' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Exception/CannotOpenSocketException.php', + 'PHPUnit\\TextUI\\CliArguments\\Builder' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Cli/Builder.php', + 'PHPUnit\\TextUI\\CliArguments\\Configuration' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Cli/Configuration.php', + 'PHPUnit\\TextUI\\CliArguments\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Cli/Exception.php', + 'PHPUnit\\TextUI\\CliArguments\\XmlConfigurationFileFinder' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Cli/XmlConfigurationFileFinder.php', + 'PHPUnit\\TextUI\\Command\\AtLeastVersionCommand' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Command/Commands/AtLeastVersionCommand.php', + 'PHPUnit\\TextUI\\Command\\Command' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Command/Command.php', + 'PHPUnit\\TextUI\\Command\\GenerateConfigurationCommand' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Command/Commands/GenerateConfigurationCommand.php', + 'PHPUnit\\TextUI\\Command\\ListGroupsCommand' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Command/Commands/ListGroupsCommand.php', + 'PHPUnit\\TextUI\\Command\\ListTestSuitesCommand' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Command/Commands/ListTestSuitesCommand.php', + 'PHPUnit\\TextUI\\Command\\ListTestsAsTextCommand' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Command/Commands/ListTestsAsTextCommand.php', + 'PHPUnit\\TextUI\\Command\\ListTestsAsXmlCommand' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Command/Commands/ListTestsAsXmlCommand.php', + 'PHPUnit\\TextUI\\Command\\MigrateConfigurationCommand' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Command/Commands/MigrateConfigurationCommand.php', + 'PHPUnit\\TextUI\\Command\\Result' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Command/Result.php', + 'PHPUnit\\TextUI\\Command\\ShowHelpCommand' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Command/Commands/ShowHelpCommand.php', + 'PHPUnit\\TextUI\\Command\\ShowVersionCommand' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Command/Commands/ShowVersionCommand.php', + 'PHPUnit\\TextUI\\Command\\VersionCheckCommand' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Command/Commands/VersionCheckCommand.php', + 'PHPUnit\\TextUI\\Command\\WarmCodeCoverageCacheCommand' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Command/Commands/WarmCodeCoverageCacheCommand.php', + 'PHPUnit\\TextUI\\Configuration\\Builder' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Builder.php', + 'PHPUnit\\TextUI\\Configuration\\CodeCoverageFilterRegistry' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/CodeCoverageFilterRegistry.php', + 'PHPUnit\\TextUI\\Configuration\\CodeCoverageReportNotConfiguredException' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Exception/CodeCoverageReportNotConfiguredException.php', + 'PHPUnit\\TextUI\\Configuration\\Configuration' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Configuration.php', + 'PHPUnit\\TextUI\\Configuration\\ConfigurationCannotBeBuiltException' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Exception/ConfigurationCannotBeBuiltException.php', + 'PHPUnit\\TextUI\\Configuration\\Constant' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/Constant.php', + 'PHPUnit\\TextUI\\Configuration\\ConstantCollection' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/ConstantCollection.php', + 'PHPUnit\\TextUI\\Configuration\\ConstantCollectionIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/ConstantCollectionIterator.php', + 'PHPUnit\\TextUI\\Configuration\\Directory' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/Directory.php', + 'PHPUnit\\TextUI\\Configuration\\DirectoryCollection' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/DirectoryCollection.php', + 'PHPUnit\\TextUI\\Configuration\\DirectoryCollectionIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/DirectoryCollectionIterator.php', + 'PHPUnit\\TextUI\\Configuration\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Exception/Exception.php', + 'PHPUnit\\TextUI\\Configuration\\ExtensionBootstrap' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/ExtensionBootstrap.php', + 'PHPUnit\\TextUI\\Configuration\\ExtensionBootstrapCollection' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/ExtensionBootstrapCollection.php', + 'PHPUnit\\TextUI\\Configuration\\ExtensionBootstrapCollectionIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/ExtensionBootstrapCollectionIterator.php', + 'PHPUnit\\TextUI\\Configuration\\File' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/File.php', + 'PHPUnit\\TextUI\\Configuration\\FileCollection' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/FileCollection.php', + 'PHPUnit\\TextUI\\Configuration\\FileCollectionIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/FileCollectionIterator.php', + 'PHPUnit\\TextUI\\Configuration\\FilterDirectory' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/FilterDirectory.php', + 'PHPUnit\\TextUI\\Configuration\\FilterDirectoryCollection' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/FilterDirectoryCollection.php', + 'PHPUnit\\TextUI\\Configuration\\FilterDirectoryCollectionIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/FilterDirectoryCollectionIterator.php', + 'PHPUnit\\TextUI\\Configuration\\FilterNotConfiguredException' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Exception/FilterNotConfiguredException.php', + 'PHPUnit\\TextUI\\Configuration\\Group' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/Group.php', + 'PHPUnit\\TextUI\\Configuration\\GroupCollection' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/GroupCollection.php', + 'PHPUnit\\TextUI\\Configuration\\GroupCollectionIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/GroupCollectionIterator.php', + 'PHPUnit\\TextUI\\Configuration\\IncludePathNotConfiguredException' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Exception/IncludePathNotConfiguredException.php', + 'PHPUnit\\TextUI\\Configuration\\IniSetting' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/IniSetting.php', + 'PHPUnit\\TextUI\\Configuration\\IniSettingCollection' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/IniSettingCollection.php', + 'PHPUnit\\TextUI\\Configuration\\IniSettingCollectionIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/IniSettingCollectionIterator.php', + 'PHPUnit\\TextUI\\Configuration\\LoggingNotConfiguredException' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Exception/LoggingNotConfiguredException.php', + 'PHPUnit\\TextUI\\Configuration\\Merger' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Merger.php', + 'PHPUnit\\TextUI\\Configuration\\NoBaselineException' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Exception/NoBaselineException.php', + 'PHPUnit\\TextUI\\Configuration\\NoBootstrapException' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Exception/NoBootstrapException.php', + 'PHPUnit\\TextUI\\Configuration\\NoCacheDirectoryException' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Exception/NoCacheDirectoryException.php', + 'PHPUnit\\TextUI\\Configuration\\NoCliArgumentException' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Exception/NoCliArgumentException.php', + 'PHPUnit\\TextUI\\Configuration\\NoConfigurationFileException' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Exception/NoConfigurationFileException.php', + 'PHPUnit\\TextUI\\Configuration\\NoCoverageCacheDirectoryException' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Exception/NoCoverageCacheDirectoryException.php', + 'PHPUnit\\TextUI\\Configuration\\NoCustomCssFileException' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Exception/NoCustomCssFileException.php', + 'PHPUnit\\TextUI\\Configuration\\NoDefaultTestSuiteException' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Exception/NoDefaultTestSuiteException.php', + 'PHPUnit\\TextUI\\Configuration\\NoPharExtensionDirectoryException' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Exception/NoPharExtensionDirectoryException.php', + 'PHPUnit\\TextUI\\Configuration\\Php' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/Php.php', + 'PHPUnit\\TextUI\\Configuration\\PhpHandler' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/PhpHandler.php', + 'PHPUnit\\TextUI\\Configuration\\Registry' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Registry.php', + 'PHPUnit\\TextUI\\Configuration\\Source' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/Source.php', + 'PHPUnit\\TextUI\\Configuration\\SourceFilter' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/SourceFilter.php', + 'PHPUnit\\TextUI\\Configuration\\SourceMapper' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/SourceMapper.php', + 'PHPUnit\\TextUI\\Configuration\\TestDirectory' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/TestDirectory.php', + 'PHPUnit\\TextUI\\Configuration\\TestDirectoryCollection' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/TestDirectoryCollection.php', + 'PHPUnit\\TextUI\\Configuration\\TestDirectoryCollectionIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/TestDirectoryCollectionIterator.php', + 'PHPUnit\\TextUI\\Configuration\\TestFile' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/TestFile.php', + 'PHPUnit\\TextUI\\Configuration\\TestFileCollection' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/TestFileCollection.php', + 'PHPUnit\\TextUI\\Configuration\\TestFileCollectionIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/TestFileCollectionIterator.php', + 'PHPUnit\\TextUI\\Configuration\\TestSuite' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/TestSuite.php', + 'PHPUnit\\TextUI\\Configuration\\TestSuiteBuilder' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/TestSuiteBuilder.php', + 'PHPUnit\\TextUI\\Configuration\\TestSuiteCollection' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/TestSuiteCollection.php', + 'PHPUnit\\TextUI\\Configuration\\TestSuiteCollectionIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/TestSuiteCollectionIterator.php', + 'PHPUnit\\TextUI\\Configuration\\Variable' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/Variable.php', + 'PHPUnit\\TextUI\\Configuration\\VariableCollection' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/VariableCollection.php', + 'PHPUnit\\TextUI\\Configuration\\VariableCollectionIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Value/VariableCollectionIterator.php', + 'PHPUnit\\TextUI\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Exception/Exception.php', + 'PHPUnit\\TextUI\\ExtensionsNotConfiguredException' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Exception/ExtensionsNotConfiguredException.php', + 'PHPUnit\\TextUI\\Help' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Help.php', + 'PHPUnit\\TextUI\\InvalidSocketException' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Exception/InvalidSocketException.php', + 'PHPUnit\\TextUI\\Output\\DefaultPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Printer/DefaultPrinter.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\BeforeTestClassMethodErroredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/BeforeTestClassMethodErroredSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\ProgressPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/ProgressPrinter.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\Subscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/Subscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestConsideredRiskySubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestConsideredRiskySubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestErroredSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestErroredSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestFailedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestFailedSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestFinishedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestFinishedSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestMarkedIncompleteSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestMarkedIncompleteSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestPreparedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestPreparedSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestRunnerExecutionStartedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestRunnerExecutionStartedSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestSkippedSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestSkippedSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestTriggeredDeprecationSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestTriggeredDeprecationSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestTriggeredErrorSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestTriggeredErrorSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestTriggeredNoticeSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestTriggeredNoticeSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestTriggeredPhpDeprecationSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestTriggeredPhpDeprecationSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestTriggeredPhpNoticeSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestTriggeredPhpNoticeSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestTriggeredPhpWarningSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestTriggeredPhpWarningSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestTriggeredPhpunitDeprecationSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestTriggeredPhpunitDeprecationSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestTriggeredPhpunitWarningSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestTriggeredPhpunitWarningSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ProgressPrinter\\TestTriggeredWarningSubscriber' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Default/ProgressPrinter/Subscriber/TestTriggeredWarningSubscriber.php', + 'PHPUnit\\TextUI\\Output\\Default\\ResultPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Default/ResultPrinter.php', + 'PHPUnit\\TextUI\\Output\\Default\\UnexpectedOutputPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Default/UnexpectedOutputPrinter.php', + 'PHPUnit\\TextUI\\Output\\Facade' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Facade.php', + 'PHPUnit\\TextUI\\Output\\NullPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Printer/NullPrinter.php', + 'PHPUnit\\TextUI\\Output\\Printer' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/Printer/Printer.php', + 'PHPUnit\\TextUI\\Output\\SummaryPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/SummaryPrinter.php', + 'PHPUnit\\TextUI\\Output\\TestDox\\ResultPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Output/TestDox/ResultPrinter.php', + 'PHPUnit\\TextUI\\ReflectionException' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Exception/ReflectionException.php', + 'PHPUnit\\TextUI\\RuntimeException' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Exception/RuntimeException.php', + 'PHPUnit\\TextUI\\ShellExitCodeCalculator' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/ShellExitCodeCalculator.php', + 'PHPUnit\\TextUI\\TestDirectoryNotFoundException' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Exception/TestDirectoryNotFoundException.php', + 'PHPUnit\\TextUI\\TestFileNotFoundException' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Exception/TestFileNotFoundException.php', + 'PHPUnit\\TextUI\\TestRunner' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/TestRunner.php', + 'PHPUnit\\TextUI\\TestSuiteFilterProcessor' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/TestSuiteFilterProcessor.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CannotFindSchemaException' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Exception/CannotFindSchemaException.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CodeCoverage\\CodeCoverage' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/CodeCoverage/CodeCoverage.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CodeCoverage\\Report\\Clover' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/CodeCoverage/Report/Clover.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CodeCoverage\\Report\\Cobertura' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/CodeCoverage/Report/Cobertura.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CodeCoverage\\Report\\Crap4j' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/CodeCoverage/Report/Crap4j.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CodeCoverage\\Report\\Html' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/CodeCoverage/Report/Html.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CodeCoverage\\Report\\Php' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/CodeCoverage/Report/Php.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CodeCoverage\\Report\\Text' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/CodeCoverage/Report/Text.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CodeCoverage\\Report\\Xml' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/CodeCoverage/Report/Xml.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Configuration' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Configuration.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\ConvertLogTypes' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/ConvertLogTypes.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CoverageCloverToReport' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/CoverageCloverToReport.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CoverageCrap4jToReport' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/CoverageCrap4jToReport.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CoverageHtmlToReport' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/CoverageHtmlToReport.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CoveragePhpToReport' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/CoveragePhpToReport.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CoverageTextToReport' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/CoverageTextToReport.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\CoverageXmlToReport' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/CoverageXmlToReport.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\DefaultConfiguration' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/DefaultConfiguration.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Exception.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\FailedSchemaDetectionResult' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/SchemaDetector/FailedSchemaDetectionResult.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Generator' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Generator.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Groups' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Groups.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\IntroduceCacheDirectoryAttribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/IntroduceCacheDirectoryAttribute.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\IntroduceCoverageElement' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/IntroduceCoverageElement.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\LoadedFromFileConfiguration' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/LoadedFromFileConfiguration.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Loader' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Loader.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\LogToReportMigration' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/LogToReportMigration.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Logging\\Junit' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Logging/Junit.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Logging\\Logging' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Logging/Logging.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Logging\\TeamCity' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Logging/TeamCity.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Logging\\TestDox\\Html' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Logging/TestDox/Html.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Logging\\TestDox\\Text' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Logging/TestDox/Text.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Migration' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/Migration.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\MigrationBuilder' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/MigrationBuilder.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\MigrationBuilderException' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/MigrationBuilderException.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\MigrationException' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/MigrationException.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Migrator' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrator.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\MoveAttributesFromFilterWhitelistToCoverage' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/MoveAttributesFromFilterWhitelistToCoverage.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\MoveAttributesFromRootToCoverage' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/MoveAttributesFromRootToCoverage.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\MoveCoverageDirectoriesToSource' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/MoveCoverageDirectoriesToSource.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\MoveWhitelistExcludesToCoverage' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/MoveWhitelistExcludesToCoverage.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\MoveWhitelistIncludesToCoverage' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/MoveWhitelistIncludesToCoverage.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\PHPUnit' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/PHPUnit.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveBeStrictAboutResourceUsageDuringSmallTestsAttribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveBeStrictAboutResourceUsageDuringSmallTestsAttribute.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveBeStrictAboutTodoAnnotatedTestsAttribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveBeStrictAboutTodoAnnotatedTestsAttribute.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveCacheResultFileAttribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveCacheResultFileAttribute.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveCacheTokensAttribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveCacheTokensAttribute.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveConversionToExceptionsAttributes' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveConversionToExceptionsAttributes.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveCoverageElementCacheDirectoryAttribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveCoverageElementCacheDirectoryAttribute.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveCoverageElementProcessUncoveredFilesAttribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveCoverageElementProcessUncoveredFilesAttribute.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveEmptyFilter' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveEmptyFilter.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveListeners' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveListeners.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveLogTypes' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveLogTypes.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveLoggingElements' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveLoggingElements.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveNoInteractionAttribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveNoInteractionAttribute.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemovePrinterAttributes' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemovePrinterAttributes.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveTestDoxGroupsElement' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveTestDoxGroupsElement.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveTestSuiteLoaderAttributes' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveTestSuiteLoaderAttributes.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RemoveVerboseAttribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RemoveVerboseAttribute.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RenameBackupStaticAttributesAttribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RenameBackupStaticAttributesAttribute.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RenameBeStrictAboutCoversAnnotationAttribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RenameBeStrictAboutCoversAnnotationAttribute.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\RenameForceCoversAnnotationAttribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/RenameForceCoversAnnotationAttribute.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\SchemaDetectionResult' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/SchemaDetector/SchemaDetectionResult.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\SchemaDetector' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/SchemaDetector/SchemaDetector.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\SchemaFinder' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/SchemaFinder.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\SnapshotNodeList' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/SnapshotNodeList.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\SuccessfulSchemaDetectionResult' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/SchemaDetector/SuccessfulSchemaDetectionResult.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\TestSuiteMapper' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/TestSuiteMapper.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\UpdateSchemaLocation' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Migration/Migrations/UpdateSchemaLocation.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\ValidationResult' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Validator/ValidationResult.php', + 'PHPUnit\\TextUI\\XmlConfiguration\\Validator' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Configuration/Xml/Validator/Validator.php', + 'PHPUnit\\Util\\Cloner' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Cloner.php', + 'PHPUnit\\Util\\Color' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Color.php', + 'PHPUnit\\Util\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Exception/Exception.php', + 'PHPUnit\\Util\\ExcludeList' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/ExcludeList.php', + 'PHPUnit\\Util\\Exporter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Exporter.php', + 'PHPUnit\\Util\\Filesystem' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Filesystem.php', + 'PHPUnit\\Util\\Filter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Filter.php', + 'PHPUnit\\Util\\GlobalState' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/GlobalState.php', + 'PHPUnit\\Util\\InvalidDirectoryException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Exception/InvalidDirectoryException.php', + 'PHPUnit\\Util\\InvalidJsonException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Exception/InvalidJsonException.php', + 'PHPUnit\\Util\\InvalidVersionOperatorException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Exception/InvalidVersionOperatorException.php', + 'PHPUnit\\Util\\Json' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Json.php', + 'PHPUnit\\Util\\PHP\\AbstractPhpProcess' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/PHP/AbstractPhpProcess.php', + 'PHPUnit\\Util\\PHP\\DefaultPhpProcess' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/PHP/DefaultPhpProcess.php', + 'PHPUnit\\Util\\PHP\\PhpProcessException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Exception/PhpProcessException.php', + 'PHPUnit\\Util\\Reflection' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Reflection.php', + 'PHPUnit\\Util\\Test' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Test.php', + 'PHPUnit\\Util\\ThrowableToStringMapper' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/ThrowableToStringMapper.php', + 'PHPUnit\\Util\\VersionComparisonOperator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/VersionComparisonOperator.php', + 'PHPUnit\\Util\\Xml' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Xml/Xml.php', + 'PHPUnit\\Util\\Xml\\Loader' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Xml/Loader.php', + 'PHPUnit\\Util\\Xml\\XmlException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Exception/XmlException.php', + 'PharIo\\Manifest\\Application' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Application.php', + 'PharIo\\Manifest\\ApplicationName' => __DIR__ . '/..' . '/phar-io/manifest/src/values/ApplicationName.php', + 'PharIo\\Manifest\\Author' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Author.php', + 'PharIo\\Manifest\\AuthorCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/values/AuthorCollection.php', + 'PharIo\\Manifest\\AuthorCollectionIterator' => __DIR__ . '/..' . '/phar-io/manifest/src/values/AuthorCollectionIterator.php', + 'PharIo\\Manifest\\AuthorElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/AuthorElement.php', + 'PharIo\\Manifest\\AuthorElementCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/AuthorElementCollection.php', + 'PharIo\\Manifest\\BundledComponent' => __DIR__ . '/..' . '/phar-io/manifest/src/values/BundledComponent.php', + 'PharIo\\Manifest\\BundledComponentCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/values/BundledComponentCollection.php', + 'PharIo\\Manifest\\BundledComponentCollectionIterator' => __DIR__ . '/..' . '/phar-io/manifest/src/values/BundledComponentCollectionIterator.php', + 'PharIo\\Manifest\\BundlesElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/BundlesElement.php', + 'PharIo\\Manifest\\ComponentElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ComponentElement.php', + 'PharIo\\Manifest\\ComponentElementCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ComponentElementCollection.php', + 'PharIo\\Manifest\\ContainsElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ContainsElement.php', + 'PharIo\\Manifest\\CopyrightElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/CopyrightElement.php', + 'PharIo\\Manifest\\CopyrightInformation' => __DIR__ . '/..' . '/phar-io/manifest/src/values/CopyrightInformation.php', + 'PharIo\\Manifest\\ElementCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ElementCollection.php', + 'PharIo\\Manifest\\ElementCollectionException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/ElementCollectionException.php', + 'PharIo\\Manifest\\Email' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Email.php', + 'PharIo\\Manifest\\Exception' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/Exception.php', + 'PharIo\\Manifest\\ExtElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ExtElement.php', + 'PharIo\\Manifest\\ExtElementCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ExtElementCollection.php', + 'PharIo\\Manifest\\Extension' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Extension.php', + 'PharIo\\Manifest\\ExtensionElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ExtensionElement.php', + 'PharIo\\Manifest\\InvalidApplicationNameException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/InvalidApplicationNameException.php', + 'PharIo\\Manifest\\InvalidEmailException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/InvalidEmailException.php', + 'PharIo\\Manifest\\InvalidUrlException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/InvalidUrlException.php', + 'PharIo\\Manifest\\Library' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Library.php', + 'PharIo\\Manifest\\License' => __DIR__ . '/..' . '/phar-io/manifest/src/values/License.php', + 'PharIo\\Manifest\\LicenseElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/LicenseElement.php', + 'PharIo\\Manifest\\Manifest' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Manifest.php', + 'PharIo\\Manifest\\ManifestDocument' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ManifestDocument.php', + 'PharIo\\Manifest\\ManifestDocumentException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/ManifestDocumentException.php', + 'PharIo\\Manifest\\ManifestDocumentLoadingException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/ManifestDocumentLoadingException.php', + 'PharIo\\Manifest\\ManifestDocumentMapper' => __DIR__ . '/..' . '/phar-io/manifest/src/ManifestDocumentMapper.php', + 'PharIo\\Manifest\\ManifestDocumentMapperException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/ManifestDocumentMapperException.php', + 'PharIo\\Manifest\\ManifestElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ManifestElement.php', + 'PharIo\\Manifest\\ManifestElementException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/ManifestElementException.php', + 'PharIo\\Manifest\\ManifestLoader' => __DIR__ . '/..' . '/phar-io/manifest/src/ManifestLoader.php', + 'PharIo\\Manifest\\ManifestLoaderException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/ManifestLoaderException.php', + 'PharIo\\Manifest\\ManifestSerializer' => __DIR__ . '/..' . '/phar-io/manifest/src/ManifestSerializer.php', + 'PharIo\\Manifest\\NoEmailAddressException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/NoEmailAddressException.php', + 'PharIo\\Manifest\\PhpElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/PhpElement.php', + 'PharIo\\Manifest\\PhpExtensionRequirement' => __DIR__ . '/..' . '/phar-io/manifest/src/values/PhpExtensionRequirement.php', + 'PharIo\\Manifest\\PhpVersionRequirement' => __DIR__ . '/..' . '/phar-io/manifest/src/values/PhpVersionRequirement.php', + 'PharIo\\Manifest\\Requirement' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Requirement.php', + 'PharIo\\Manifest\\RequirementCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/values/RequirementCollection.php', + 'PharIo\\Manifest\\RequirementCollectionIterator' => __DIR__ . '/..' . '/phar-io/manifest/src/values/RequirementCollectionIterator.php', + 'PharIo\\Manifest\\RequiresElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/RequiresElement.php', + 'PharIo\\Manifest\\Type' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Type.php', + 'PharIo\\Manifest\\Url' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Url.php', + 'PharIo\\Version\\AbstractVersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/constraints/AbstractVersionConstraint.php', + 'PharIo\\Version\\AndVersionConstraintGroup' => __DIR__ . '/..' . '/phar-io/version/src/constraints/AndVersionConstraintGroup.php', + 'PharIo\\Version\\AnyVersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/constraints/AnyVersionConstraint.php', + 'PharIo\\Version\\BuildMetaData' => __DIR__ . '/..' . '/phar-io/version/src/BuildMetaData.php', + 'PharIo\\Version\\ExactVersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/constraints/ExactVersionConstraint.php', + 'PharIo\\Version\\Exception' => __DIR__ . '/..' . '/phar-io/version/src/exceptions/Exception.php', + 'PharIo\\Version\\GreaterThanOrEqualToVersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/constraints/GreaterThanOrEqualToVersionConstraint.php', + 'PharIo\\Version\\InvalidPreReleaseSuffixException' => __DIR__ . '/..' . '/phar-io/version/src/exceptions/InvalidPreReleaseSuffixException.php', + 'PharIo\\Version\\InvalidVersionException' => __DIR__ . '/..' . '/phar-io/version/src/exceptions/InvalidVersionException.php', + 'PharIo\\Version\\NoBuildMetaDataException' => __DIR__ . '/..' . '/phar-io/version/src/exceptions/NoBuildMetaDataException.php', + 'PharIo\\Version\\NoPreReleaseSuffixException' => __DIR__ . '/..' . '/phar-io/version/src/exceptions/NoPreReleaseSuffixException.php', + 'PharIo\\Version\\OrVersionConstraintGroup' => __DIR__ . '/..' . '/phar-io/version/src/constraints/OrVersionConstraintGroup.php', + 'PharIo\\Version\\PreReleaseSuffix' => __DIR__ . '/..' . '/phar-io/version/src/PreReleaseSuffix.php', + 'PharIo\\Version\\SpecificMajorAndMinorVersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/constraints/SpecificMajorAndMinorVersionConstraint.php', + 'PharIo\\Version\\SpecificMajorVersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/constraints/SpecificMajorVersionConstraint.php', + 'PharIo\\Version\\UnsupportedVersionConstraintException' => __DIR__ . '/..' . '/phar-io/version/src/exceptions/UnsupportedVersionConstraintException.php', + 'PharIo\\Version\\Version' => __DIR__ . '/..' . '/phar-io/version/src/Version.php', + 'PharIo\\Version\\VersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/constraints/VersionConstraint.php', + 'PharIo\\Version\\VersionConstraintParser' => __DIR__ . '/..' . '/phar-io/version/src/VersionConstraintParser.php', + 'PharIo\\Version\\VersionConstraintValue' => __DIR__ . '/..' . '/phar-io/version/src/VersionConstraintValue.php', + 'PharIo\\Version\\VersionNumber' => __DIR__ . '/..' . '/phar-io/version/src/VersionNumber.php', + 'PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php', + 'SQLite3Exception' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/SQLite3Exception.php', + 'SebastianBergmann\\CliParser\\AmbiguousOptionException' => __DIR__ . '/..' . '/sebastian/cli-parser/src/exceptions/AmbiguousOptionException.php', + 'SebastianBergmann\\CliParser\\Exception' => __DIR__ . '/..' . '/sebastian/cli-parser/src/exceptions/Exception.php', + 'SebastianBergmann\\CliParser\\OptionDoesNotAllowArgumentException' => __DIR__ . '/..' . '/sebastian/cli-parser/src/exceptions/OptionDoesNotAllowArgumentException.php', + 'SebastianBergmann\\CliParser\\Parser' => __DIR__ . '/..' . '/sebastian/cli-parser/src/Parser.php', + 'SebastianBergmann\\CliParser\\RequiredOptionArgumentMissingException' => __DIR__ . '/..' . '/sebastian/cli-parser/src/exceptions/RequiredOptionArgumentMissingException.php', + 'SebastianBergmann\\CliParser\\UnknownOptionException' => __DIR__ . '/..' . '/sebastian/cli-parser/src/exceptions/UnknownOptionException.php', + 'SebastianBergmann\\CodeCoverage\\BranchAndPathCoverageNotSupportedException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/BranchAndPathCoverageNotSupportedException.php', + 'SebastianBergmann\\CodeCoverage\\CodeCoverage' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/CodeCoverage.php', + 'SebastianBergmann\\CodeCoverage\\Data\\ProcessedCodeCoverageData' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Data/ProcessedCodeCoverageData.php', + 'SebastianBergmann\\CodeCoverage\\Data\\RawCodeCoverageData' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Data/RawCodeCoverageData.php', + 'SebastianBergmann\\CodeCoverage\\DeadCodeDetectionNotSupportedException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/DeadCodeDetectionNotSupportedException.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\Driver' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Driver/Driver.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\PathExistsButIsNotDirectoryException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/PathExistsButIsNotDirectoryException.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\PcovDriver' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Driver/PcovDriver.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\PcovNotAvailableException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/PcovNotAvailableException.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\Selector' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Driver/Selector.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\WriteOperationFailedException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/WriteOperationFailedException.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\XdebugDriver' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Driver/XdebugDriver.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\XdebugNotAvailableException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/XdebugNotAvailableException.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\XdebugNotEnabledException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/XdebugNotEnabledException.php', + 'SebastianBergmann\\CodeCoverage\\Exception' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/Exception.php', + 'SebastianBergmann\\CodeCoverage\\FileCouldNotBeWrittenException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/FileCouldNotBeWrittenException.php', + 'SebastianBergmann\\CodeCoverage\\Filter' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Filter.php', + 'SebastianBergmann\\CodeCoverage\\InvalidArgumentException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/InvalidArgumentException.php', + 'SebastianBergmann\\CodeCoverage\\NoCodeCoverageDriverAvailableException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/NoCodeCoverageDriverAvailableException.php', + 'SebastianBergmann\\CodeCoverage\\NoCodeCoverageDriverWithPathCoverageSupportAvailableException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/NoCodeCoverageDriverWithPathCoverageSupportAvailableException.php', + 'SebastianBergmann\\CodeCoverage\\Node\\AbstractNode' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/AbstractNode.php', + 'SebastianBergmann\\CodeCoverage\\Node\\Builder' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/Builder.php', + 'SebastianBergmann\\CodeCoverage\\Node\\CrapIndex' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/CrapIndex.php', + 'SebastianBergmann\\CodeCoverage\\Node\\Directory' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/Directory.php', + 'SebastianBergmann\\CodeCoverage\\Node\\File' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/File.php', + 'SebastianBergmann\\CodeCoverage\\Node\\Iterator' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/Iterator.php', + 'SebastianBergmann\\CodeCoverage\\ParserException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/ParserException.php', + 'SebastianBergmann\\CodeCoverage\\ReflectionException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/ReflectionException.php', + 'SebastianBergmann\\CodeCoverage\\ReportAlreadyFinalizedException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/ReportAlreadyFinalizedException.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Clover' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Clover.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Cobertura' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Cobertura.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Crap4j' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Crap4j.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Colors' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Colors.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\CustomCssFile' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/CustomCssFile.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Dashboard' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Renderer/Dashboard.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Directory' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Renderer/Directory.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Facade' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Facade.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\File' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Renderer' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Renderer.php', + 'SebastianBergmann\\CodeCoverage\\Report\\PHP' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/PHP.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Text' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Text.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Thresholds' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Thresholds.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\BuildInformation' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/BuildInformation.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Coverage' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Coverage.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Directory' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Directory.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Facade' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Facade.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\File' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/File.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Method' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Method.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Node' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Node.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Project' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Project.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Report' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Report.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Source' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Source.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Tests' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Tests.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Totals' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Totals.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Unit' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Unit.php', + 'SebastianBergmann\\CodeCoverage\\StaticAnalysisCacheNotConfiguredException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/StaticAnalysisCacheNotConfiguredException.php', + 'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\CacheWarmer' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/StaticAnalysis/CacheWarmer.php', + 'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\CachingFileAnalyser' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/StaticAnalysis/CachingFileAnalyser.php', + 'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\CodeUnitFindingVisitor' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/StaticAnalysis/CodeUnitFindingVisitor.php', + 'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\ExecutableLinesFindingVisitor' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/StaticAnalysis/ExecutableLinesFindingVisitor.php', + 'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\FileAnalyser' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/StaticAnalysis/FileAnalyser.php', + 'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\IgnoredLinesFindingVisitor' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/StaticAnalysis/IgnoredLinesFindingVisitor.php', + 'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\ParsingFileAnalyser' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/StaticAnalysis/ParsingFileAnalyser.php', + 'SebastianBergmann\\CodeCoverage\\TestIdMissingException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/TestIdMissingException.php', + 'SebastianBergmann\\CodeCoverage\\Test\\TestSize\\Known' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/TestSize/Known.php', + 'SebastianBergmann\\CodeCoverage\\Test\\TestSize\\Large' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/TestSize/Large.php', + 'SebastianBergmann\\CodeCoverage\\Test\\TestSize\\Medium' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/TestSize/Medium.php', + 'SebastianBergmann\\CodeCoverage\\Test\\TestSize\\Small' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/TestSize/Small.php', + 'SebastianBergmann\\CodeCoverage\\Test\\TestSize\\TestSize' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/TestSize/TestSize.php', + 'SebastianBergmann\\CodeCoverage\\Test\\TestSize\\Unknown' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/TestSize/Unknown.php', + 'SebastianBergmann\\CodeCoverage\\Test\\TestStatus\\Failure' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/TestStatus/Failure.php', + 'SebastianBergmann\\CodeCoverage\\Test\\TestStatus\\Known' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/TestStatus/Known.php', + 'SebastianBergmann\\CodeCoverage\\Test\\TestStatus\\Success' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/TestStatus/Success.php', + 'SebastianBergmann\\CodeCoverage\\Test\\TestStatus\\TestStatus' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/TestStatus/TestStatus.php', + 'SebastianBergmann\\CodeCoverage\\Test\\TestStatus\\Unknown' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/TestStatus/Unknown.php', + 'SebastianBergmann\\CodeCoverage\\UnintentionallyCoveredCodeException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/UnintentionallyCoveredCodeException.php', + 'SebastianBergmann\\CodeCoverage\\Util\\DirectoryCouldNotBeCreatedException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/DirectoryCouldNotBeCreatedException.php', + 'SebastianBergmann\\CodeCoverage\\Util\\Filesystem' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Util/Filesystem.php', + 'SebastianBergmann\\CodeCoverage\\Util\\Percentage' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Util/Percentage.php', + 'SebastianBergmann\\CodeCoverage\\Version' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Version.php', + 'SebastianBergmann\\CodeCoverage\\XmlException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/XmlException.php', + 'SebastianBergmann\\CodeUnitReverseLookup\\Wizard' => __DIR__ . '/..' . '/sebastian/code-unit-reverse-lookup/src/Wizard.php', + 'SebastianBergmann\\CodeUnit\\ClassMethodUnit' => __DIR__ . '/..' . '/sebastian/code-unit/src/ClassMethodUnit.php', + 'SebastianBergmann\\CodeUnit\\ClassUnit' => __DIR__ . '/..' . '/sebastian/code-unit/src/ClassUnit.php', + 'SebastianBergmann\\CodeUnit\\CodeUnit' => __DIR__ . '/..' . '/sebastian/code-unit/src/CodeUnit.php', + 'SebastianBergmann\\CodeUnit\\CodeUnitCollection' => __DIR__ . '/..' . '/sebastian/code-unit/src/CodeUnitCollection.php', + 'SebastianBergmann\\CodeUnit\\CodeUnitCollectionIterator' => __DIR__ . '/..' . '/sebastian/code-unit/src/CodeUnitCollectionIterator.php', + 'SebastianBergmann\\CodeUnit\\Exception' => __DIR__ . '/..' . '/sebastian/code-unit/src/exceptions/Exception.php', + 'SebastianBergmann\\CodeUnit\\FileUnit' => __DIR__ . '/..' . '/sebastian/code-unit/src/FileUnit.php', + 'SebastianBergmann\\CodeUnit\\FunctionUnit' => __DIR__ . '/..' . '/sebastian/code-unit/src/FunctionUnit.php', + 'SebastianBergmann\\CodeUnit\\InterfaceMethodUnit' => __DIR__ . '/..' . '/sebastian/code-unit/src/InterfaceMethodUnit.php', + 'SebastianBergmann\\CodeUnit\\InterfaceUnit' => __DIR__ . '/..' . '/sebastian/code-unit/src/InterfaceUnit.php', + 'SebastianBergmann\\CodeUnit\\InvalidCodeUnitException' => __DIR__ . '/..' . '/sebastian/code-unit/src/exceptions/InvalidCodeUnitException.php', + 'SebastianBergmann\\CodeUnit\\Mapper' => __DIR__ . '/..' . '/sebastian/code-unit/src/Mapper.php', + 'SebastianBergmann\\CodeUnit\\NoTraitException' => __DIR__ . '/..' . '/sebastian/code-unit/src/exceptions/NoTraitException.php', + 'SebastianBergmann\\CodeUnit\\ReflectionException' => __DIR__ . '/..' . '/sebastian/code-unit/src/exceptions/ReflectionException.php', + 'SebastianBergmann\\CodeUnit\\TraitMethodUnit' => __DIR__ . '/..' . '/sebastian/code-unit/src/TraitMethodUnit.php', + 'SebastianBergmann\\CodeUnit\\TraitUnit' => __DIR__ . '/..' . '/sebastian/code-unit/src/TraitUnit.php', + 'SebastianBergmann\\Comparator\\ArrayComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/ArrayComparator.php', + 'SebastianBergmann\\Comparator\\Comparator' => __DIR__ . '/..' . '/sebastian/comparator/src/Comparator.php', + 'SebastianBergmann\\Comparator\\ComparisonFailure' => __DIR__ . '/..' . '/sebastian/comparator/src/ComparisonFailure.php', + 'SebastianBergmann\\Comparator\\DOMNodeComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/DOMNodeComparator.php', + 'SebastianBergmann\\Comparator\\DateTimeComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/DateTimeComparator.php', + 'SebastianBergmann\\Comparator\\Exception' => __DIR__ . '/..' . '/sebastian/comparator/src/exceptions/Exception.php', + 'SebastianBergmann\\Comparator\\ExceptionComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/ExceptionComparator.php', + 'SebastianBergmann\\Comparator\\Factory' => __DIR__ . '/..' . '/sebastian/comparator/src/Factory.php', + 'SebastianBergmann\\Comparator\\MockObjectComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/MockObjectComparator.php', + 'SebastianBergmann\\Comparator\\NumericComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/NumericComparator.php', + 'SebastianBergmann\\Comparator\\ObjectComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/ObjectComparator.php', + 'SebastianBergmann\\Comparator\\ResourceComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/ResourceComparator.php', + 'SebastianBergmann\\Comparator\\RuntimeException' => __DIR__ . '/..' . '/sebastian/comparator/src/exceptions/RuntimeException.php', + 'SebastianBergmann\\Comparator\\ScalarComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/ScalarComparator.php', + 'SebastianBergmann\\Comparator\\SplObjectStorageComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/SplObjectStorageComparator.php', + 'SebastianBergmann\\Comparator\\TypeComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/TypeComparator.php', + 'SebastianBergmann\\Complexity\\Calculator' => __DIR__ . '/..' . '/sebastian/complexity/src/Calculator.php', + 'SebastianBergmann\\Complexity\\Complexity' => __DIR__ . '/..' . '/sebastian/complexity/src/Complexity/Complexity.php', + 'SebastianBergmann\\Complexity\\ComplexityCalculatingVisitor' => __DIR__ . '/..' . '/sebastian/complexity/src/Visitor/ComplexityCalculatingVisitor.php', + 'SebastianBergmann\\Complexity\\ComplexityCollection' => __DIR__ . '/..' . '/sebastian/complexity/src/Complexity/ComplexityCollection.php', + 'SebastianBergmann\\Complexity\\ComplexityCollectionIterator' => __DIR__ . '/..' . '/sebastian/complexity/src/Complexity/ComplexityCollectionIterator.php', + 'SebastianBergmann\\Complexity\\CyclomaticComplexityCalculatingVisitor' => __DIR__ . '/..' . '/sebastian/complexity/src/Visitor/CyclomaticComplexityCalculatingVisitor.php', + 'SebastianBergmann\\Complexity\\Exception' => __DIR__ . '/..' . '/sebastian/complexity/src/Exception/Exception.php', + 'SebastianBergmann\\Complexity\\RuntimeException' => __DIR__ . '/..' . '/sebastian/complexity/src/Exception/RuntimeException.php', + 'SebastianBergmann\\Diff\\Chunk' => __DIR__ . '/..' . '/sebastian/diff/src/Chunk.php', + 'SebastianBergmann\\Diff\\ConfigurationException' => __DIR__ . '/..' . '/sebastian/diff/src/Exception/ConfigurationException.php', + 'SebastianBergmann\\Diff\\Diff' => __DIR__ . '/..' . '/sebastian/diff/src/Diff.php', + 'SebastianBergmann\\Diff\\Differ' => __DIR__ . '/..' . '/sebastian/diff/src/Differ.php', + 'SebastianBergmann\\Diff\\Exception' => __DIR__ . '/..' . '/sebastian/diff/src/Exception/Exception.php', + 'SebastianBergmann\\Diff\\InvalidArgumentException' => __DIR__ . '/..' . '/sebastian/diff/src/Exception/InvalidArgumentException.php', + 'SebastianBergmann\\Diff\\Line' => __DIR__ . '/..' . '/sebastian/diff/src/Line.php', + 'SebastianBergmann\\Diff\\LongestCommonSubsequenceCalculator' => __DIR__ . '/..' . '/sebastian/diff/src/LongestCommonSubsequenceCalculator.php', + 'SebastianBergmann\\Diff\\MemoryEfficientLongestCommonSubsequenceCalculator' => __DIR__ . '/..' . '/sebastian/diff/src/MemoryEfficientLongestCommonSubsequenceCalculator.php', + 'SebastianBergmann\\Diff\\Output\\AbstractChunkOutputBuilder' => __DIR__ . '/..' . '/sebastian/diff/src/Output/AbstractChunkOutputBuilder.php', + 'SebastianBergmann\\Diff\\Output\\DiffOnlyOutputBuilder' => __DIR__ . '/..' . '/sebastian/diff/src/Output/DiffOnlyOutputBuilder.php', + 'SebastianBergmann\\Diff\\Output\\DiffOutputBuilderInterface' => __DIR__ . '/..' . '/sebastian/diff/src/Output/DiffOutputBuilderInterface.php', + 'SebastianBergmann\\Diff\\Output\\StrictUnifiedDiffOutputBuilder' => __DIR__ . '/..' . '/sebastian/diff/src/Output/StrictUnifiedDiffOutputBuilder.php', + 'SebastianBergmann\\Diff\\Output\\UnifiedDiffOutputBuilder' => __DIR__ . '/..' . '/sebastian/diff/src/Output/UnifiedDiffOutputBuilder.php', + 'SebastianBergmann\\Diff\\Parser' => __DIR__ . '/..' . '/sebastian/diff/src/Parser.php', + 'SebastianBergmann\\Diff\\TimeEfficientLongestCommonSubsequenceCalculator' => __DIR__ . '/..' . '/sebastian/diff/src/TimeEfficientLongestCommonSubsequenceCalculator.php', + 'SebastianBergmann\\Environment\\Console' => __DIR__ . '/..' . '/sebastian/environment/src/Console.php', + 'SebastianBergmann\\Environment\\Runtime' => __DIR__ . '/..' . '/sebastian/environment/src/Runtime.php', + 'SebastianBergmann\\Exporter\\Exporter' => __DIR__ . '/..' . '/sebastian/exporter/src/Exporter.php', + 'SebastianBergmann\\FileIterator\\ExcludeIterator' => __DIR__ . '/..' . '/phpunit/php-file-iterator/src/ExcludeIterator.php', + 'SebastianBergmann\\FileIterator\\Facade' => __DIR__ . '/..' . '/phpunit/php-file-iterator/src/Facade.php', + 'SebastianBergmann\\FileIterator\\Factory' => __DIR__ . '/..' . '/phpunit/php-file-iterator/src/Factory.php', + 'SebastianBergmann\\FileIterator\\Iterator' => __DIR__ . '/..' . '/phpunit/php-file-iterator/src/Iterator.php', + 'SebastianBergmann\\GlobalState\\CodeExporter' => __DIR__ . '/..' . '/sebastian/global-state/src/CodeExporter.php', + 'SebastianBergmann\\GlobalState\\Exception' => __DIR__ . '/..' . '/sebastian/global-state/src/exceptions/Exception.php', + 'SebastianBergmann\\GlobalState\\ExcludeList' => __DIR__ . '/..' . '/sebastian/global-state/src/ExcludeList.php', + 'SebastianBergmann\\GlobalState\\Restorer' => __DIR__ . '/..' . '/sebastian/global-state/src/Restorer.php', + 'SebastianBergmann\\GlobalState\\RuntimeException' => __DIR__ . '/..' . '/sebastian/global-state/src/exceptions/RuntimeException.php', + 'SebastianBergmann\\GlobalState\\Snapshot' => __DIR__ . '/..' . '/sebastian/global-state/src/Snapshot.php', + 'SebastianBergmann\\Invoker\\Exception' => __DIR__ . '/..' . '/phpunit/php-invoker/src/exceptions/Exception.php', + 'SebastianBergmann\\Invoker\\Invoker' => __DIR__ . '/..' . '/phpunit/php-invoker/src/Invoker.php', + 'SebastianBergmann\\Invoker\\ProcessControlExtensionNotLoadedException' => __DIR__ . '/..' . '/phpunit/php-invoker/src/exceptions/ProcessControlExtensionNotLoadedException.php', + 'SebastianBergmann\\Invoker\\TimeoutException' => __DIR__ . '/..' . '/phpunit/php-invoker/src/exceptions/TimeoutException.php', + 'SebastianBergmann\\LinesOfCode\\Counter' => __DIR__ . '/..' . '/sebastian/lines-of-code/src/Counter.php', + 'SebastianBergmann\\LinesOfCode\\Exception' => __DIR__ . '/..' . '/sebastian/lines-of-code/src/Exception/Exception.php', + 'SebastianBergmann\\LinesOfCode\\IllogicalValuesException' => __DIR__ . '/..' . '/sebastian/lines-of-code/src/Exception/IllogicalValuesException.php', + 'SebastianBergmann\\LinesOfCode\\LineCountingVisitor' => __DIR__ . '/..' . '/sebastian/lines-of-code/src/LineCountingVisitor.php', + 'SebastianBergmann\\LinesOfCode\\LinesOfCode' => __DIR__ . '/..' . '/sebastian/lines-of-code/src/LinesOfCode.php', + 'SebastianBergmann\\LinesOfCode\\NegativeValueException' => __DIR__ . '/..' . '/sebastian/lines-of-code/src/Exception/NegativeValueException.php', + 'SebastianBergmann\\LinesOfCode\\RuntimeException' => __DIR__ . '/..' . '/sebastian/lines-of-code/src/Exception/RuntimeException.php', + 'SebastianBergmann\\ObjectEnumerator\\Enumerator' => __DIR__ . '/..' . '/sebastian/object-enumerator/src/Enumerator.php', + 'SebastianBergmann\\ObjectReflector\\ObjectReflector' => __DIR__ . '/..' . '/sebastian/object-reflector/src/ObjectReflector.php', + 'SebastianBergmann\\RecursionContext\\Context' => __DIR__ . '/..' . '/sebastian/recursion-context/src/Context.php', + 'SebastianBergmann\\Template\\Exception' => __DIR__ . '/..' . '/phpunit/php-text-template/src/exceptions/Exception.php', + 'SebastianBergmann\\Template\\InvalidArgumentException' => __DIR__ . '/..' . '/phpunit/php-text-template/src/exceptions/InvalidArgumentException.php', + 'SebastianBergmann\\Template\\RuntimeException' => __DIR__ . '/..' . '/phpunit/php-text-template/src/exceptions/RuntimeException.php', + 'SebastianBergmann\\Template\\Template' => __DIR__ . '/..' . '/phpunit/php-text-template/src/Template.php', + 'SebastianBergmann\\Timer\\Duration' => __DIR__ . '/..' . '/phpunit/php-timer/src/Duration.php', + 'SebastianBergmann\\Timer\\Exception' => __DIR__ . '/..' . '/phpunit/php-timer/src/exceptions/Exception.php', + 'SebastianBergmann\\Timer\\NoActiveTimerException' => __DIR__ . '/..' . '/phpunit/php-timer/src/exceptions/NoActiveTimerException.php', + 'SebastianBergmann\\Timer\\ResourceUsageFormatter' => __DIR__ . '/..' . '/phpunit/php-timer/src/ResourceUsageFormatter.php', + 'SebastianBergmann\\Timer\\TimeSinceStartOfRequestNotAvailableException' => __DIR__ . '/..' . '/phpunit/php-timer/src/exceptions/TimeSinceStartOfRequestNotAvailableException.php', + 'SebastianBergmann\\Timer\\Timer' => __DIR__ . '/..' . '/phpunit/php-timer/src/Timer.php', + 'SebastianBergmann\\Type\\CallableType' => __DIR__ . '/..' . '/sebastian/type/src/type/CallableType.php', + 'SebastianBergmann\\Type\\Exception' => __DIR__ . '/..' . '/sebastian/type/src/exception/Exception.php', + 'SebastianBergmann\\Type\\FalseType' => __DIR__ . '/..' . '/sebastian/type/src/type/FalseType.php', + 'SebastianBergmann\\Type\\GenericObjectType' => __DIR__ . '/..' . '/sebastian/type/src/type/GenericObjectType.php', + 'SebastianBergmann\\Type\\IntersectionType' => __DIR__ . '/..' . '/sebastian/type/src/type/IntersectionType.php', + 'SebastianBergmann\\Type\\IterableType' => __DIR__ . '/..' . '/sebastian/type/src/type/IterableType.php', + 'SebastianBergmann\\Type\\MixedType' => __DIR__ . '/..' . '/sebastian/type/src/type/MixedType.php', + 'SebastianBergmann\\Type\\NeverType' => __DIR__ . '/..' . '/sebastian/type/src/type/NeverType.php', + 'SebastianBergmann\\Type\\NullType' => __DIR__ . '/..' . '/sebastian/type/src/type/NullType.php', + 'SebastianBergmann\\Type\\ObjectType' => __DIR__ . '/..' . '/sebastian/type/src/type/ObjectType.php', + 'SebastianBergmann\\Type\\Parameter' => __DIR__ . '/..' . '/sebastian/type/src/Parameter.php', + 'SebastianBergmann\\Type\\ReflectionMapper' => __DIR__ . '/..' . '/sebastian/type/src/ReflectionMapper.php', + 'SebastianBergmann\\Type\\RuntimeException' => __DIR__ . '/..' . '/sebastian/type/src/exception/RuntimeException.php', + 'SebastianBergmann\\Type\\SimpleType' => __DIR__ . '/..' . '/sebastian/type/src/type/SimpleType.php', + 'SebastianBergmann\\Type\\StaticType' => __DIR__ . '/..' . '/sebastian/type/src/type/StaticType.php', + 'SebastianBergmann\\Type\\TrueType' => __DIR__ . '/..' . '/sebastian/type/src/type/TrueType.php', + 'SebastianBergmann\\Type\\Type' => __DIR__ . '/..' . '/sebastian/type/src/type/Type.php', + 'SebastianBergmann\\Type\\TypeName' => __DIR__ . '/..' . '/sebastian/type/src/TypeName.php', + 'SebastianBergmann\\Type\\UnionType' => __DIR__ . '/..' . '/sebastian/type/src/type/UnionType.php', + 'SebastianBergmann\\Type\\UnknownType' => __DIR__ . '/..' . '/sebastian/type/src/type/UnknownType.php', + 'SebastianBergmann\\Type\\VoidType' => __DIR__ . '/..' . '/sebastian/type/src/type/VoidType.php', + 'SebastianBergmann\\Version' => __DIR__ . '/..' . '/sebastian/version/src/Version.php', + 'Stringable' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Stringable.php', + 'TheSeer\\Tokenizer\\Exception' => __DIR__ . '/..' . '/theseer/tokenizer/src/Exception.php', + 'TheSeer\\Tokenizer\\NamespaceUri' => __DIR__ . '/..' . '/theseer/tokenizer/src/NamespaceUri.php', + 'TheSeer\\Tokenizer\\NamespaceUriException' => __DIR__ . '/..' . '/theseer/tokenizer/src/NamespaceUriException.php', + 'TheSeer\\Tokenizer\\Token' => __DIR__ . '/..' . '/theseer/tokenizer/src/Token.php', + 'TheSeer\\Tokenizer\\TokenCollection' => __DIR__ . '/..' . '/theseer/tokenizer/src/TokenCollection.php', + 'TheSeer\\Tokenizer\\TokenCollectionException' => __DIR__ . '/..' . '/theseer/tokenizer/src/TokenCollectionException.php', + 'TheSeer\\Tokenizer\\Tokenizer' => __DIR__ . '/..' . '/theseer/tokenizer/src/Tokenizer.php', + 'TheSeer\\Tokenizer\\XMLSerializer' => __DIR__ . '/..' . '/theseer/tokenizer/src/XMLSerializer.php', + 'UnhandledMatchError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php', + 'ValueError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/ValueError.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInit8494108b02b27c800772c410510056d3::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit8494108b02b27c800772c410510056d3::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit8494108b02b27c800772c410510056d3::$classMap; + + }, null, ClassLoader::class); + } +} diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json new file mode 100644 index 00000000..4f4ba0e8 --- /dev/null +++ b/vendor/composer/installed.json @@ -0,0 +1,8636 @@ +{ + "packages": [ + { + "name": "alleyinteractive/alley-coding-standards", + "version": "v2.1.0", + "version_normalized": "2.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/alleyinteractive/alley-coding-standards.git", + "reference": "242b93f2608486789dd9b156db5960fd34cef50d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/alleyinteractive/alley-coding-standards/zipball/242b93f2608486789dd9b156db5960fd34cef50d", + "reference": "242b93f2608486789dd9b156db5960fd34cef50d", + "shasum": "" + }, + "require": { + "automattic/vipwpcs": "^3.0", + "phpcompatibility/phpcompatibility-wp": "^2.1.4" + }, + "require-dev": { + "phpunit/phpunit": "^11.2" + }, + "time": "2024-07-19T19:38:39+00:00", + "type": "phpcodesniffer-standard", + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "description": "PHPCS sniffs for Alley Interactive", + "keywords": [ + "phpcs", + "static analysis" + ], + "support": { + "issues": "https://github.com/alleyinteractive/alley-coding-standards/issues", + "source": "https://github.com/alleyinteractive/alley-coding-standards/tree/v2.1.0" + }, + "install-path": "../alleyinteractive/alley-coding-standards" + }, + { + "name": "alleyinteractive/composer-wordpress-autoloader", + "version": "v1.1.0", + "version_normalized": "1.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/alleyinteractive/composer-wordpress-autoloader.git", + "reference": "30acf9e3498a84af478e316ae3869fa362835695" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/alleyinteractive/composer-wordpress-autoloader/zipball/30acf9e3498a84af478e316ae3869fa362835695", + "reference": "30acf9e3498a84af478e316ae3869fa362835695", + "shasum": "" + }, + "require": { + "alleyinteractive/wordpress-autoloader": "^1.1.1", + "composer-plugin-api": "^2.0", + "php": "^8.0" + }, + "require-dev": { + "composer/composer": "*", + "phpunit/phpunit": "^9.5.8", + "squizlabs/php_codesniffer": "^4.0" + }, + "time": "2023-12-06T20:21:22+00:00", + "type": "composer-plugin", + "extra": { + "class": "ComposerWordPressAutoloader\\Plugin" + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/autoload.php" + ], + "psr-4": { + "ComposerWordPressAutoloader\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Alley Interactive", + "email": "info@alley.co" + }, + { + "name": "Sean Fisher", + "email": "sean@alley.co" + } + ], + "description": "Autoload files using WordPress File Conventions using Composer", + "support": { + "issues": "https://github.com/alleyinteractive/composer-wordpress-autoloader/issues", + "source": "https://github.com/alleyinteractive/composer-wordpress-autoloader/tree/v1.1.0" + }, + "install-path": "../alleyinteractive/composer-wordpress-autoloader" + }, + { + "name": "alleyinteractive/laminas-validator-extensions", + "version": "v2.1.1", + "version_normalized": "2.1.1.0", + "source": { + "type": "git", + "url": "https://github.com/alleyinteractive/laminas-validator-extensions.git", + "reference": "09fd68d1fda5179d5e972cf7053edf4eab903313" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/alleyinteractive/laminas-validator-extensions/zipball/09fd68d1fda5179d5e972cf7053edf4eab903313", + "reference": "09fd68d1fda5179d5e972cf7053edf4eab903313", + "shasum": "" + }, + "require": { + "laminas/laminas-validator": "^2.20", + "php": "^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.8", + "phpunit/phpunit": "^9.5", + "squizlabs/php_codesniffer": "^3.6" + }, + "time": "2024-02-14T17:54:59+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Alley\\": "src/Alley/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Alley", + "email": "info@alley.com" + } + ], + "description": "Additional validation classes for the laminas-validator framework.", + "support": { + "issues": "https://github.com/alleyinteractive/laminas-validator-extensions/issues", + "source": "https://github.com/alleyinteractive/laminas-validator-extensions/tree/v2.1.1" + }, + "install-path": "../alleyinteractive/laminas-validator-extensions" + }, + { + "name": "alleyinteractive/wordpress-autoloader", + "version": "v1.1.1", + "version_normalized": "1.1.1.0", + "source": { + "type": "git", + "url": "https://github.com/alleyinteractive/wordpress-autoloader.git", + "reference": "c7599d95f49f1cdc38fad19944a50b19ec0dd6ca" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/alleyinteractive/wordpress-autoloader/zipball/c7599d95f49f1cdc38fad19944a50b19ec0dd6ca", + "reference": "c7599d95f49f1cdc38fad19944a50b19ec0dd6ca", + "shasum": "" + }, + "require": { + "php": "^7.4.0|^8.0|^8.1" + }, + "require-dev": { + "alleyinteractive/alley-coding-standards": "^0.3", + "phpunit/phpunit": "^9.5.8" + }, + "time": "2022-08-31T20:51:21+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "src/class-autoloader.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Alley Interactive", + "email": "info@alley.co" + } + ], + "description": "Autoload files using WordPress File Conventions", + "support": { + "issues": "https://github.com/alleyinteractive/wordpress-autoloader/issues", + "source": "https://github.com/alleyinteractive/wordpress-autoloader/tree/v1.1.1" + }, + "install-path": "../alleyinteractive/wordpress-autoloader" + }, + { + "name": "alleyinteractive/wp-concurrent-remote-requests", + "version": "v1.0.2", + "version_normalized": "1.0.2.0", + "source": { + "type": "git", + "url": "https://github.com/alleyinteractive/wp-concurrent-remote-requests.git", + "reference": "404301c975989958e8086542d56df847ae3aacc2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/alleyinteractive/wp-concurrent-remote-requests/zipball/404301c975989958e8086542d56df847ae3aacc2", + "reference": "404301c975989958e8086542d56df847ae3aacc2", + "shasum": "" + }, + "require": { + "alleyinteractive/composer-wordpress-autoloader": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "alleyinteractive/alley-coding-standards": "^0.3", + "nunomaduro/collision": "^5.0", + "phpunit/phpunit": "^9.3.3" + }, + "time": "2023-04-11T19:52:47+00:00", + "type": "library", + "extra": { + "wordpress-autoloader": { + "autoload": { + "Alley\\WP\\Concurrent_Remote_Requests\\": "src" + }, + "autoload-dev": { + "Alley\\WP\\Concurrent_Remote_Requests\\Tests\\": "tests" + } + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Sean Fisher", + "email": "srtfisher@gmail.com" + } + ], + "description": "Feature plugin for concurrent HTTP remote requests", + "homepage": "https://github.com/alleyinteractive/wp-concurrent-remote-requests", + "keywords": [ + "alleyinteractive", + "wp-concurrent-remote-requests" + ], + "support": { + "issues": "https://github.com/alleyinteractive/wp-concurrent-remote-requests/issues", + "source": "https://github.com/alleyinteractive/wp-concurrent-remote-requests/tree/v1.0.2" + }, + "install-path": "../alleyinteractive/wp-concurrent-remote-requests" + }, + { + "name": "alleyinteractive/wp-filter-side-effects", + "version": "v2.0.0", + "version_normalized": "2.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/alleyinteractive/wp-filter-side-effects.git", + "reference": "3107f336e7079782e4d16a9361b512c7d569a780" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/alleyinteractive/wp-filter-side-effects/zipball/3107f336e7079782e4d16a9361b512c7d569a780", + "reference": "3107f336e7079782e4d16a9361b512c7d569a780", + "shasum": "" + }, + "require": { + "php": "^8.0" + }, + "require-dev": { + "alleyinteractive/alley-coding-standards": "^1.0.0", + "friendsofphp/php-cs-fixer": "^3.8", + "mantle-framework/testkit": "^0.5" + }, + "time": "2022-12-29T19:26:23+00:00", + "type": "library", + "extra": { + "wordpress-autoloader": { + "autoload": { + "Alley\\": "src/alley/" + }, + "autoload-dev": { + "Alley\\": "tests/alley/" + } + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/alley/wp/filter-side-effects.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Alley", + "email": "info@alley.com" + } + ], + "description": "Use a WordPress filter like an action.", + "support": { + "issues": "https://github.com/alleyinteractive/wp-filter-side-effects/issues", + "source": "https://github.com/alleyinteractive/wp-filter-side-effects/tree/v2.0.0" + }, + "install-path": "../alleyinteractive/wp-filter-side-effects" + }, + { + "name": "alleyinteractive/wp-match-blocks", + "version": "v3.1.0", + "version_normalized": "3.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/alleyinteractive/wp-match-blocks.git", + "reference": "1fa48dc7059653df7ac46ec1fad05e36da236578" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/alleyinteractive/wp-match-blocks/zipball/1fa48dc7059653df7ac46ec1fad05e36da236578", + "reference": "1fa48dc7059653df7ac46ec1fad05e36da236578", + "shasum": "" + }, + "require": { + "alleyinteractive/composer-wordpress-autoloader": "^1.0.0", + "alleyinteractive/laminas-validator-extensions": "^2.0.0", + "php": "^8.0" + }, + "require-dev": { + "alleyinteractive/alley-coding-standards": "^1.0.0", + "friendsofphp/php-cs-fixer": "^3.8", + "mantle-framework/testkit": "^0.9" + }, + "time": "2023-11-02T03:13:33+00:00", + "type": "library", + "extra": { + "wordpress-autoloader": { + "autoload": { + "Alley\\": "src/alley/" + }, + "autoload-dev": { + "Alley\\": "tests/alley/" + } + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/alley/wp/match-blocks.php", + "src/alley/wp/internals/internals.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Alley", + "email": "info@alley.com" + } + ], + "description": "Match WordPress blocks in the given content.", + "support": { + "issues": "https://github.com/alleyinteractive/wp-match-blocks/issues", + "source": "https://github.com/alleyinteractive/wp-match-blocks/tree/v3.1.0" + }, + "install-path": "../alleyinteractive/wp-match-blocks" + }, + { + "name": "alleyinteractive/wp-type-extensions", + "version": "v2.2.0", + "version_normalized": "2.2.0.0", + "source": { + "type": "git", + "url": "https://github.com/alleyinteractive/wp-type-extensions.git", + "reference": "5a225b53fc8336193a6b2ed71e610d8c5b57d200" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/alleyinteractive/wp-type-extensions/zipball/5a225b53fc8336193a6b2ed71e610d8c5b57d200", + "reference": "5a225b53fc8336193a6b2ed71e610d8c5b57d200", + "shasum": "" + }, + "require": { + "alleyinteractive/laminas-validator-extensions": "^2.0", + "alleyinteractive/wp-match-blocks": "^3.0", + "php": "^8.1", + "spatie/once": "^3.1" + }, + "require-dev": { + "alleyinteractive/alley-coding-standards": "^1.0.0", + "friendsofphp/php-cs-fixer": "^3.8", + "mantle-framework/testkit": "^0.9", + "szepeviktor/phpstan-wordpress": "^1.1" + }, + "time": "2024-05-29T02:13:50+00:00", + "type": "library", + "extra": { + "wordpress-autoloader": { + "autoload": { + "Alley\\": "src/alley/" + }, + "autoload-dev": { + "Alley\\": "tests/alley/" + } + } + }, + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Alley", + "email": "info@alley.com" + } + ], + "description": "PHP interfaces and implementations for WordPress.", + "support": { + "issues": "https://github.com/alleyinteractive/wp-type-extensions/issues", + "source": "https://github.com/alleyinteractive/wp-type-extensions/tree/v2.2.0" + }, + "install-path": "../alleyinteractive/wp-type-extensions" + }, + { + "name": "automattic/vipwpcs", + "version": "3.0.1", + "version_normalized": "3.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/Automattic/VIP-Coding-Standards.git", + "reference": "2b1d206d81b74ed999023cffd924f862ff2753c8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Automattic/VIP-Coding-Standards/zipball/2b1d206d81b74ed999023cffd924f862ff2753c8", + "reference": "2b1d206d81b74ed999023cffd924f862ff2753c8", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "phpcsstandards/phpcsextra": "^1.2.1", + "phpcsstandards/phpcsutils": "^1.0.11", + "sirbrillig/phpcs-variable-analysis": "^2.11.18", + "squizlabs/php_codesniffer": "^3.9.2", + "wp-coding-standards/wpcs": "^3.1.0" + }, + "require-dev": { + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcompatibility/php-compatibility": "^9", + "phpcsstandards/phpcsdevtools": "^1.0", + "phpunit/phpunit": "^4 || ^5 || ^6 || ^7 || ^8 || ^9" + }, + "time": "2024-05-10T20:31:09+00:00", + "type": "phpcodesniffer-standard", + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Contributors", + "homepage": "https://github.com/Automattic/VIP-Coding-Standards/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress VIP minimum coding conventions", + "keywords": [ + "phpcs", + "standards", + "static analysis", + "wordpress" + ], + "support": { + "issues": "https://github.com/Automattic/VIP-Coding-Standards/issues", + "source": "https://github.com/Automattic/VIP-Coding-Standards", + "wiki": "https://github.com/Automattic/VIP-Coding-Standards/wiki" + }, + "install-path": "../automattic/vipwpcs" + }, + { + "name": "brick/math", + "version": "0.12.1", + "version_normalized": "0.12.1.0", + "source": { + "type": "git", + "url": "https://github.com/brick/math.git", + "reference": "f510c0a40911935b77b86859eb5223d58d660df1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/brick/math/zipball/f510c0a40911935b77b86859eb5223d58d660df1", + "reference": "f510c0a40911935b77b86859eb5223d58d660df1", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.2", + "phpunit/phpunit": "^10.1", + "vimeo/psalm": "5.16.0" + }, + "time": "2023-11-29T23:19:16+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Brick\\Math\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Arbitrary-precision arithmetic library", + "keywords": [ + "Arbitrary-precision", + "BigInteger", + "BigRational", + "arithmetic", + "bigdecimal", + "bignum", + "bignumber", + "brick", + "decimal", + "integer", + "math", + "mathematics", + "rational" + ], + "support": { + "issues": "https://github.com/brick/math/issues", + "source": "https://github.com/brick/math/tree/0.12.1" + }, + "funding": [ + { + "url": "https://github.com/BenMorel", + "type": "github" + } + ], + "install-path": "../brick/math" + }, + { + "name": "carbonphp/carbon-doctrine-types", + "version": "3.2.0", + "version_normalized": "3.2.0.0", + "source": { + "type": "git", + "url": "https://github.com/CarbonPHP/carbon-doctrine-types.git", + "reference": "18ba5ddfec8976260ead6e866180bd5d2f71aa1d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/CarbonPHP/carbon-doctrine-types/zipball/18ba5ddfec8976260ead6e866180bd5d2f71aa1d", + "reference": "18ba5ddfec8976260ead6e866180bd5d2f71aa1d", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "conflict": { + "doctrine/dbal": "<4.0.0 || >=5.0.0" + }, + "require-dev": { + "doctrine/dbal": "^4.0.0", + "nesbot/carbon": "^2.71.0 || ^3.0.0", + "phpunit/phpunit": "^10.3" + }, + "time": "2024-02-09T16:56:22+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Carbon\\Doctrine\\": "src/Carbon/Doctrine/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "KyleKatarn", + "email": "kylekatarnls@gmail.com" + } + ], + "description": "Types to use Carbon in Doctrine", + "keywords": [ + "carbon", + "date", + "datetime", + "doctrine", + "time" + ], + "support": { + "issues": "https://github.com/CarbonPHP/carbon-doctrine-types/issues", + "source": "https://github.com/CarbonPHP/carbon-doctrine-types/tree/3.2.0" + }, + "funding": [ + { + "url": "https://github.com/kylekatarnls", + "type": "github" + }, + { + "url": "https://opencollective.com/Carbon", + "type": "open_collective" + }, + { + "url": "https://tidelift.com/funding/github/packagist/nesbot/carbon", + "type": "tidelift" + } + ], + "install-path": "../carbonphp/carbon-doctrine-types" + }, + { + "name": "dealerdirect/phpcodesniffer-composer-installer", + "version": "v1.0.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/composer-installer.git", + "reference": "4be43904336affa5c2f70744a348312336afd0da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/4be43904336affa5c2f70744a348312336afd0da", + "reference": "4be43904336affa5c2f70744a348312336afd0da", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0 || ^2.0", + "php": ">=5.4", + "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" + }, + "require-dev": { + "composer/composer": "*", + "ext-json": "*", + "ext-zip": "*", + "php-parallel-lint/php-parallel-lint": "^1.3.1", + "phpcompatibility/php-compatibility": "^9.0", + "yoast/phpunit-polyfills": "^1.0" + }, + "time": "2023-01-05T11:28:13+00:00", + "type": "composer-plugin", + "extra": { + "class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Franck Nijhof", + "email": "franck.nijhof@dealerdirect.com", + "homepage": "http://www.frenck.nl", + "role": "Developer / IT Manager" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer Standards Composer Installer Plugin", + "homepage": "http://www.dealerdirect.com", + "keywords": [ + "PHPCodeSniffer", + "PHP_CodeSniffer", + "code quality", + "codesniffer", + "composer", + "installer", + "phpcbf", + "phpcs", + "plugin", + "qa", + "quality", + "standard", + "standards", + "style guide", + "stylecheck", + "tests" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/composer-installer/issues", + "source": "https://github.com/PHPCSStandards/composer-installer" + }, + "install-path": "../dealerdirect/phpcodesniffer-composer-installer" + }, + { + "name": "dflydev/dot-access-data", + "version": "v3.0.3", + "version_normalized": "3.0.3.0", + "source": { + "type": "git", + "url": "https://github.com/dflydev/dflydev-dot-access-data.git", + "reference": "a23a2bf4f31d3518f3ecb38660c95715dfead60f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-data/zipball/a23a2bf4f31d3518f3ecb38660c95715dfead60f", + "reference": "a23a2bf4f31d3518f3ecb38660c95715dfead60f", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^0.12.42", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.3", + "scrutinizer/ocular": "1.6.0", + "squizlabs/php_codesniffer": "^3.5", + "vimeo/psalm": "^4.0.0" + }, + "time": "2024-07-08T12:26:09+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Dflydev\\DotAccessData\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dragonfly Development Inc.", + "email": "info@dflydev.com", + "homepage": "http://dflydev.com" + }, + { + "name": "Beau Simensen", + "email": "beau@dflydev.com", + "homepage": "http://beausimensen.com" + }, + { + "name": "Carlos Frutos", + "email": "carlos@kiwing.it", + "homepage": "https://github.com/cfrutos" + }, + { + "name": "Colin O'Dell", + "email": "colinodell@gmail.com", + "homepage": "https://www.colinodell.com" + } + ], + "description": "Given a deep data structure, access data by dot notation.", + "homepage": "https://github.com/dflydev/dflydev-dot-access-data", + "keywords": [ + "access", + "data", + "dot", + "notation" + ], + "support": { + "issues": "https://github.com/dflydev/dflydev-dot-access-data/issues", + "source": "https://github.com/dflydev/dflydev-dot-access-data/tree/v3.0.3" + }, + "install-path": "../dflydev/dot-access-data" + }, + { + "name": "doctrine/inflector", + "version": "2.0.10", + "version_normalized": "2.0.10.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "5817d0659c5b50c9b950feb9af7b9668e2c436bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/5817d0659c5b50c9b950feb9af7b9668e2c436bc", + "reference": "5817d0659c5b50c9b950feb9af7b9668e2c436bc", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^11.0", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.3", + "phpunit/phpunit": "^8.5 || ^9.5", + "vimeo/psalm": "^4.25 || ^5.4" + }, + "time": "2024-02-18T20:23:39+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Doctrine\\Inflector\\": "lib/Doctrine/Inflector" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.", + "homepage": "https://www.doctrine-project.org/projects/inflector.html", + "keywords": [ + "inflection", + "inflector", + "lowercase", + "manipulation", + "php", + "plural", + "singular", + "strings", + "uppercase", + "words" + ], + "support": { + "issues": "https://github.com/doctrine/inflector/issues", + "source": "https://github.com/doctrine/inflector/tree/2.0.10" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finflector", + "type": "tidelift" + } + ], + "install-path": "../doctrine/inflector" + }, + { + "name": "fakerphp/faker", + "version": "v1.23.1", + "version_normalized": "1.23.1.0", + "source": { + "type": "git", + "url": "https://github.com/FakerPHP/Faker.git", + "reference": "bfb4fe148adbf78eff521199619b93a52ae3554b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/bfb4fe148adbf78eff521199619b93a52ae3554b", + "reference": "bfb4fe148adbf78eff521199619b93a52ae3554b", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0", + "psr/container": "^1.0 || ^2.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "conflict": { + "fzaninotto/faker": "*" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "doctrine/persistence": "^1.3 || ^2.0", + "ext-intl": "*", + "phpunit/phpunit": "^9.5.26", + "symfony/phpunit-bridge": "^5.4.16" + }, + "suggest": { + "doctrine/orm": "Required to use Faker\\ORM\\Doctrine", + "ext-curl": "Required by Faker\\Provider\\Image to download images.", + "ext-dom": "Required by Faker\\Provider\\HtmlLorem for generating random HTML.", + "ext-iconv": "Required by Faker\\Provider\\ru_RU\\Text::realText() for generating real Russian text.", + "ext-mbstring": "Required for multibyte Unicode string functionality." + }, + "time": "2024-01-02T13:46:09+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ], + "support": { + "issues": "https://github.com/FakerPHP/Faker/issues", + "source": "https://github.com/FakerPHP/Faker/tree/v1.23.1" + }, + "install-path": "../fakerphp/faker" + }, + { + "name": "filp/whoops", + "version": "2.15.4", + "version_normalized": "2.15.4.0", + "source": { + "type": "git", + "url": "https://github.com/filp/whoops.git", + "reference": "a139776fa3f5985a50b509f2a02ff0f709d2a546" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/filp/whoops/zipball/a139776fa3f5985a50b509f2a02ff0f709d2a546", + "reference": "a139776fa3f5985a50b509f2a02ff0f709d2a546", + "shasum": "" + }, + "require": { + "php": "^5.5.9 || ^7.0 || ^8.0", + "psr/log": "^1.0.1 || ^2.0 || ^3.0" + }, + "require-dev": { + "mockery/mockery": "^0.9 || ^1.0", + "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.3", + "symfony/var-dumper": "^2.6 || ^3.0 || ^4.0 || ^5.0" + }, + "suggest": { + "symfony/var-dumper": "Pretty print complex values better with var-dumper available", + "whoops/soap": "Formats errors as SOAP responses" + }, + "time": "2023-11-03T12:00:00+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Whoops\\": "src/Whoops/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Filipe Dobreira", + "homepage": "https://github.com/filp", + "role": "Developer" + } + ], + "description": "php error handling for cool kids", + "homepage": "https://filp.github.io/whoops/", + "keywords": [ + "error", + "exception", + "handling", + "library", + "throwable", + "whoops" + ], + "support": { + "issues": "https://github.com/filp/whoops/issues", + "source": "https://github.com/filp/whoops/tree/2.15.4" + }, + "funding": [ + { + "url": "https://github.com/denis-sokolov", + "type": "github" + } + ], + "install-path": "../filp/whoops" + }, + { + "name": "laminas/laminas-servicemanager", + "version": "3.22.1", + "version_normalized": "3.22.1.0", + "source": { + "type": "git", + "url": "https://github.com/laminas/laminas-servicemanager.git", + "reference": "de98d297d4743956a0558a6d71616979ff779328" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/de98d297d4743956a0558a6d71616979ff779328", + "reference": "de98d297d4743956a0558a6d71616979ff779328", + "shasum": "" + }, + "require": { + "laminas/laminas-stdlib": "^3.17", + "php": "~8.1.0 || ~8.2.0 || ~8.3.0", + "psr/container": "^1.0" + }, + "conflict": { + "ext-psr": "*", + "laminas/laminas-code": "<4.10.0", + "zendframework/zend-code": "<3.3.1", + "zendframework/zend-servicemanager": "*" + }, + "provide": { + "psr/container-implementation": "^1.0" + }, + "replace": { + "container-interop/container-interop": "^1.2.0" + }, + "require-dev": { + "composer/package-versions-deprecated": "^1.11.99.5", + "friendsofphp/proxy-manager-lts": "^1.0.14", + "laminas/laminas-code": "^4.10.0", + "laminas/laminas-coding-standard": "~2.5.0", + "laminas/laminas-container-config-test": "^0.8", + "mikey179/vfsstream": "^1.6.11", + "phpbench/phpbench": "^1.2.9", + "phpunit/phpunit": "^10.4", + "psalm/plugin-phpunit": "^0.18.4", + "vimeo/psalm": "^5.8.0" + }, + "suggest": { + "friendsofphp/proxy-manager-lts": "ProxyManager ^2.1.1 to handle lazy initialization of services" + }, + "time": "2023-10-24T11:19:47+00:00", + "bin": [ + "bin/generate-deps-for-config-factory", + "bin/generate-factory-for-class" + ], + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "src/autoload.php" + ], + "psr-4": { + "Laminas\\ServiceManager\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Factory-Driven Dependency Injection Container", + "homepage": "https://laminas.dev", + "keywords": [ + "PSR-11", + "dependency-injection", + "di", + "dic", + "laminas", + "service-manager", + "servicemanager" + ], + "support": { + "chat": "https://laminas.dev/chat", + "docs": "https://docs.laminas.dev/laminas-servicemanager/", + "forum": "https://discourse.laminas.dev", + "issues": "https://github.com/laminas/laminas-servicemanager/issues", + "rss": "https://github.com/laminas/laminas-servicemanager/releases.atom", + "source": "https://github.com/laminas/laminas-servicemanager" + }, + "funding": [ + { + "url": "https://funding.communitybridge.org/projects/laminas-project", + "type": "community_bridge" + } + ], + "install-path": "../laminas/laminas-servicemanager" + }, + { + "name": "laminas/laminas-stdlib", + "version": "3.19.0", + "version_normalized": "3.19.0.0", + "source": { + "type": "git", + "url": "https://github.com/laminas/laminas-stdlib.git", + "reference": "6a192dd0882b514e45506f533b833b623b78fff3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laminas/laminas-stdlib/zipball/6a192dd0882b514e45506f533b833b623b78fff3", + "reference": "6a192dd0882b514e45506f533b833b623b78fff3", + "shasum": "" + }, + "require": { + "php": "~8.1.0 || ~8.2.0 || ~8.3.0" + }, + "conflict": { + "zendframework/zend-stdlib": "*" + }, + "require-dev": { + "laminas/laminas-coding-standard": "^2.5", + "phpbench/phpbench": "^1.2.15", + "phpunit/phpunit": "^10.5.8", + "psalm/plugin-phpunit": "^0.18.4", + "vimeo/psalm": "^5.20.0" + }, + "time": "2024-01-19T12:39:49+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Laminas\\Stdlib\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "SPL extensions, array utilities, error handlers, and more", + "homepage": "https://laminas.dev", + "keywords": [ + "laminas", + "stdlib" + ], + "support": { + "chat": "https://laminas.dev/chat", + "docs": "https://docs.laminas.dev/laminas-stdlib/", + "forum": "https://discourse.laminas.dev", + "issues": "https://github.com/laminas/laminas-stdlib/issues", + "rss": "https://github.com/laminas/laminas-stdlib/releases.atom", + "source": "https://github.com/laminas/laminas-stdlib" + }, + "funding": [ + { + "url": "https://funding.communitybridge.org/projects/laminas-project", + "type": "community_bridge" + } + ], + "install-path": "../laminas/laminas-stdlib" + }, + { + "name": "laminas/laminas-validator", + "version": "2.64.1", + "version_normalized": "2.64.1.0", + "source": { + "type": "git", + "url": "https://github.com/laminas/laminas-validator.git", + "reference": "9db115056b666b7540c951b6d4477b8e0b52b9ad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laminas/laminas-validator/zipball/9db115056b666b7540c951b6d4477b8e0b52b9ad", + "reference": "9db115056b666b7540c951b6d4477b8e0b52b9ad", + "shasum": "" + }, + "require": { + "laminas/laminas-servicemanager": "^3.21.0", + "laminas/laminas-stdlib": "^3.19", + "php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0", + "psr/http-message": "^1.0.1 || ^2.0.0" + }, + "conflict": { + "zendframework/zend-validator": "*" + }, + "require-dev": { + "laminas/laminas-coding-standard": "^2.5", + "laminas/laminas-db": "^2.20", + "laminas/laminas-filter": "^2.35.2", + "laminas/laminas-i18n": "^2.26.0", + "laminas/laminas-session": "^2.20", + "laminas/laminas-uri": "^2.11.0", + "phpunit/phpunit": "^10.5.20", + "psalm/plugin-phpunit": "^0.19.0", + "psr/http-client": "^1.0.3", + "psr/http-factory": "^1.1.0", + "vimeo/psalm": "^5.24.0" + }, + "suggest": { + "laminas/laminas-db": "Laminas\\Db component, required by the (No)RecordExists validator", + "laminas/laminas-filter": "Laminas\\Filter component, required by the Digits validator", + "laminas/laminas-i18n": "Laminas\\I18n component to allow translation of validation error messages", + "laminas/laminas-i18n-resources": "Translations of validator messages", + "laminas/laminas-servicemanager": "Laminas\\ServiceManager component to allow using the ValidatorPluginManager and validator chains", + "laminas/laminas-session": "Laminas\\Session component, ^2.8; required by the Csrf validator", + "laminas/laminas-uri": "Laminas\\Uri component, required by the Uri and Sitemap\\Loc validators", + "psr/http-message": "psr/http-message, required when validating PSR-7 UploadedFileInterface instances via the Upload and UploadFile validators" + }, + "time": "2024-08-01T09:32:54+00:00", + "type": "library", + "extra": { + "laminas": { + "component": "Laminas\\Validator", + "config-provider": "Laminas\\Validator\\ConfigProvider" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Laminas\\Validator\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Validation classes for a wide range of domains, and the ability to chain validators to create complex validation criteria", + "homepage": "https://laminas.dev", + "keywords": [ + "laminas", + "validator" + ], + "support": { + "chat": "https://laminas.dev/chat", + "docs": "https://docs.laminas.dev/laminas-validator/", + "forum": "https://discourse.laminas.dev", + "issues": "https://github.com/laminas/laminas-validator/issues", + "rss": "https://github.com/laminas/laminas-validator/releases.atom", + "source": "https://github.com/laminas/laminas-validator" + }, + "funding": [ + { + "url": "https://funding.communitybridge.org/projects/laminas-project", + "type": "community_bridge" + } + ], + "install-path": "../laminas/laminas-validator" + }, + { + "name": "league/commonmark", + "version": "2.5.3", + "version_normalized": "2.5.3.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/commonmark.git", + "reference": "b650144166dfa7703e62a22e493b853b58d874b0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/b650144166dfa7703e62a22e493b853b58d874b0", + "reference": "b650144166dfa7703e62a22e493b853b58d874b0", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "league/config": "^1.1.1", + "php": "^7.4 || ^8.0", + "psr/event-dispatcher": "^1.0", + "symfony/deprecation-contracts": "^2.1 || ^3.0", + "symfony/polyfill-php80": "^1.16" + }, + "require-dev": { + "cebe/markdown": "^1.0", + "commonmark/cmark": "0.31.1", + "commonmark/commonmark.js": "0.31.1", + "composer/package-versions-deprecated": "^1.8", + "embed/embed": "^4.4", + "erusev/parsedown": "^1.0", + "ext-json": "*", + "github/gfm": "0.29.0", + "michelf/php-markdown": "^1.4 || ^2.0", + "nyholm/psr7": "^1.5", + "phpstan/phpstan": "^1.8.2", + "phpunit/phpunit": "^9.5.21 || ^10.5.9 || ^11.0.0", + "scrutinizer/ocular": "^1.8.1", + "symfony/finder": "^5.3 | ^6.0 || ^7.0", + "symfony/yaml": "^2.3 | ^3.0 | ^4.0 | ^5.0 | ^6.0 || ^7.0", + "unleashedtech/php-coding-standard": "^3.1.1", + "vimeo/psalm": "^4.24.0 || ^5.0.0" + }, + "suggest": { + "symfony/yaml": "v2.3+ required if using the Front Matter extension" + }, + "time": "2024-08-16T11:46:16+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.6-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "League\\CommonMark\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Colin O'Dell", + "email": "colinodell@gmail.com", + "homepage": "https://www.colinodell.com", + "role": "Lead Developer" + } + ], + "description": "Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)", + "homepage": "https://commonmark.thephpleague.com", + "keywords": [ + "commonmark", + "flavored", + "gfm", + "github", + "github-flavored", + "markdown", + "md", + "parser" + ], + "support": { + "docs": "https://commonmark.thephpleague.com/", + "forum": "https://github.com/thephpleague/commonmark/discussions", + "issues": "https://github.com/thephpleague/commonmark/issues", + "rss": "https://github.com/thephpleague/commonmark/releases.atom", + "source": "https://github.com/thephpleague/commonmark" + }, + "funding": [ + { + "url": "https://www.colinodell.com/sponsor", + "type": "custom" + }, + { + "url": "https://www.paypal.me/colinpodell/10.00", + "type": "custom" + }, + { + "url": "https://github.com/colinodell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/league/commonmark", + "type": "tidelift" + } + ], + "install-path": "../league/commonmark" + }, + { + "name": "league/config", + "version": "v1.2.0", + "version_normalized": "1.2.0.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/config.git", + "reference": "754b3604fb2984c71f4af4a9cbe7b57f346ec1f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/config/zipball/754b3604fb2984c71f4af4a9cbe7b57f346ec1f3", + "reference": "754b3604fb2984c71f4af4a9cbe7b57f346ec1f3", + "shasum": "" + }, + "require": { + "dflydev/dot-access-data": "^3.0.1", + "nette/schema": "^1.2", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.8.2", + "phpunit/phpunit": "^9.5.5", + "scrutinizer/ocular": "^1.8.1", + "unleashedtech/php-coding-standard": "^3.1", + "vimeo/psalm": "^4.7.3" + }, + "time": "2022-12-11T20:36:23+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.2-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "League\\Config\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Colin O'Dell", + "email": "colinodell@gmail.com", + "homepage": "https://www.colinodell.com", + "role": "Lead Developer" + } + ], + "description": "Define configuration arrays with strict schemas and access values with dot notation", + "homepage": "https://config.thephpleague.com", + "keywords": [ + "array", + "config", + "configuration", + "dot", + "dot-access", + "nested", + "schema" + ], + "support": { + "docs": "https://config.thephpleague.com/", + "issues": "https://github.com/thephpleague/config/issues", + "rss": "https://github.com/thephpleague/config/releases.atom", + "source": "https://github.com/thephpleague/config" + }, + "funding": [ + { + "url": "https://www.colinodell.com/sponsor", + "type": "custom" + }, + { + "url": "https://www.paypal.me/colinpodell/10.00", + "type": "custom" + }, + { + "url": "https://github.com/colinodell", + "type": "github" + } + ], + "install-path": "../league/config" + }, + { + "name": "league/flysystem", + "version": "1.1.10", + "version_normalized": "1.1.10.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem.git", + "reference": "3239285c825c152bcc315fe0e87d6b55f5972ed1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/3239285c825c152bcc315fe0e87d6b55f5972ed1", + "reference": "3239285c825c152bcc315fe0e87d6b55f5972ed1", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "league/mime-type-detection": "^1.3", + "php": "^7.2.5 || ^8.0" + }, + "conflict": { + "league/flysystem-sftp": "<1.0.6" + }, + "require-dev": { + "phpspec/prophecy": "^1.11.1", + "phpunit/phpunit": "^8.5.8" + }, + "suggest": { + "ext-ftp": "Allows you to use FTP server storage", + "ext-openssl": "Allows you to use FTPS server storage", + "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", + "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", + "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", + "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", + "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", + "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", + "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", + "league/flysystem-webdav": "Allows you to use WebDAV storage", + "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", + "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", + "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" + }, + "time": "2022-10-04T09:16:37+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "League\\Flysystem\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frenky.net" + } + ], + "description": "Filesystem abstraction: Many filesystems, one API.", + "keywords": [ + "Cloud Files", + "WebDAV", + "abstraction", + "aws", + "cloud", + "copy.com", + "dropbox", + "file systems", + "files", + "filesystem", + "filesystems", + "ftp", + "rackspace", + "remote", + "s3", + "sftp", + "storage" + ], + "support": { + "issues": "https://github.com/thephpleague/flysystem/issues", + "source": "https://github.com/thephpleague/flysystem/tree/1.1.10" + }, + "funding": [ + { + "url": "https://offset.earth/frankdejonge", + "type": "other" + } + ], + "install-path": "../league/flysystem" + }, + { + "name": "league/flysystem-cached-adapter", + "version": "1.1.0", + "version_normalized": "1.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem-cached-adapter.git", + "reference": "d1925efb2207ac4be3ad0c40b8277175f99ffaff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem-cached-adapter/zipball/d1925efb2207ac4be3ad0c40b8277175f99ffaff", + "reference": "d1925efb2207ac4be3ad0c40b8277175f99ffaff", + "shasum": "" + }, + "require": { + "league/flysystem": "~1.0", + "psr/cache": "^1.0.0" + }, + "require-dev": { + "mockery/mockery": "~0.9", + "phpspec/phpspec": "^3.4", + "phpunit/phpunit": "^5.7", + "predis/predis": "~1.0", + "tedivm/stash": "~0.12" + }, + "suggest": { + "ext-phpredis": "Pure C implemented extension for PHP" + }, + "time": "2020-07-25T15:56:04+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "League\\Flysystem\\Cached\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "frankdejonge", + "email": "info@frenky.net" + } + ], + "description": "An adapter decorator to enable meta-data caching.", + "support": { + "issues": "https://github.com/thephpleague/flysystem-cached-adapter/issues", + "source": "https://github.com/thephpleague/flysystem-cached-adapter/tree/master" + }, + "install-path": "../league/flysystem-cached-adapter" + }, + { + "name": "league/mime-type-detection", + "version": "1.15.0", + "version_normalized": "1.15.0.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/mime-type-detection.git", + "reference": "ce0f4d1e8a6f4eb0ddff33f57c69c50fd09f4301" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/ce0f4d1e8a6f4eb0ddff33f57c69c50fd09f4301", + "reference": "ce0f4d1e8a6f4eb0ddff33f57c69c50fd09f4301", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.2", + "phpstan/phpstan": "^0.12.68", + "phpunit/phpunit": "^8.5.8 || ^9.3 || ^10.0" + }, + "time": "2024-01-28T23:22:08+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "League\\MimeTypeDetection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frankdejonge.nl" + } + ], + "description": "Mime-type detection for Flysystem", + "support": { + "issues": "https://github.com/thephpleague/mime-type-detection/issues", + "source": "https://github.com/thephpleague/mime-type-detection/tree/1.15.0" + }, + "funding": [ + { + "url": "https://github.com/frankdejonge", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/league/flysystem", + "type": "tidelift" + } + ], + "install-path": "../league/mime-type-detection" + }, + { + "name": "mantle-framework/config", + "version": "v1.1.3", + "version_normalized": "1.1.3.0", + "source": { + "type": "git", + "url": "https://github.com/mantle-framework/config.git", + "reference": "42475dc5a00e35b8edf6c470b4fb0521d5abe58c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mantle-framework/config/zipball/42475dc5a00e35b8edf6c470b4fb0521d5abe58c", + "reference": "42475dc5a00e35b8edf6c470b4fb0521d5abe58c", + "shasum": "" + }, + "require": { + "alleyinteractive/composer-wordpress-autoloader": "^1.0", + "mantle-framework/contracts": "^1.0", + "mantle-framework/support": "^1.0", + "php": "^8.1" + }, + "time": "2024-05-08T19:42:52+00:00", + "type": "library", + "extra": { + "wordpress-autoloader": { + "autoload": { + "Mantle\\Config": "./" + } + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "autoload.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Alley", + "email": "mantle@alley.com" + } + ], + "description": "The Mantle Framework Config Package", + "support": { + "source": "https://github.com/mantle-framework/config/tree/v1.1.3" + }, + "install-path": "../mantle-framework/config" + }, + { + "name": "mantle-framework/container", + "version": "v1.1.3", + "version_normalized": "1.1.3.0", + "source": { + "type": "git", + "url": "https://github.com/mantle-framework/container.git", + "reference": "41eb9047739b50c2663fd6dea0812facbdcf6aea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mantle-framework/container/zipball/41eb9047739b50c2663fd6dea0812facbdcf6aea", + "reference": "41eb9047739b50c2663fd6dea0812facbdcf6aea", + "shasum": "" + }, + "require": { + "alleyinteractive/composer-wordpress-autoloader": "^1.0", + "mantle-framework/contracts": "^1.0", + "php": "^8.1", + "psr/container": "^1.1.1 || ^2.0.2" + }, + "provide": { + "psr/container-implementation": "1.1|2.0" + }, + "time": "2024-05-08T19:42:48+00:00", + "type": "library", + "extra": { + "wordpress-autoloader": { + "autoload": { + "Mantle\\Container": "./" + } + } + }, + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Alley", + "email": "mantle@alley.com" + } + ], + "description": "The Mantle Framework Container Package", + "support": { + "source": "https://github.com/mantle-framework/container/tree/v1.1.3" + }, + "install-path": "../mantle-framework/container" + }, + { + "name": "mantle-framework/contracts", + "version": "v1.1.3", + "version_normalized": "1.1.3.0", + "source": { + "type": "git", + "url": "https://github.com/mantle-framework/contracts.git", + "reference": "4a1b2fe05d5efedb1b7c2b04d24be74c1df5d85b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mantle-framework/contracts/zipball/4a1b2fe05d5efedb1b7c2b04d24be74c1df5d85b", + "reference": "4a1b2fe05d5efedb1b7c2b04d24be74c1df5d85b", + "shasum": "" + }, + "require": { + "alleyinteractive/composer-wordpress-autoloader": "^1.0", + "php": "^8.1", + "psr/container": "^1.1.1 || ^2.0.2" + }, + "provide": { + "psr/container-implementation": "1.1|2.0" + }, + "time": "2024-06-12T21:38:02+00:00", + "type": "library", + "extra": { + "wordpress-autoloader": { + "autoload": { + "Mantle\\Contracts": "./" + } + } + }, + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Alley", + "email": "mantle@alley.com" + } + ], + "description": "The Mantle Framework Contracts Package", + "support": { + "source": "https://github.com/mantle-framework/contracts/tree/v1.1.3" + }, + "install-path": "../mantle-framework/contracts" + }, + { + "name": "mantle-framework/database", + "version": "v1.1.3", + "version_normalized": "1.1.3.0", + "source": { + "type": "git", + "url": "https://github.com/mantle-framework/database.git", + "reference": "b6358df1a8a05568fe0c92494411b198c569addc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mantle-framework/database/zipball/b6358df1a8a05568fe0c92494411b198c569addc", + "reference": "b6358df1a8a05568fe0c92494411b198c569addc", + "shasum": "" + }, + "require": { + "alleyinteractive/composer-wordpress-autoloader": "^1.0", + "alleyinteractive/wp-filter-side-effects": "^2.0", + "mantle-framework/contracts": "^1.0", + "mantle-framework/support": "^1.0", + "php": "^8.1", + "psr/container": "^1.1.1 || ^2.0.2", + "symfony/finder": "^6.2" + }, + "time": "2024-08-06T18:23:29+00:00", + "type": "library", + "extra": { + "wordpress-autoloader": { + "autoload": { + "Mantle\\Database": "./" + } + } + }, + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Alley", + "email": "mantle@alley.com" + } + ], + "description": "The Mantle Framework Database Package", + "support": { + "source": "https://github.com/mantle-framework/database/tree/v1.1.3" + }, + "install-path": "../mantle-framework/database" + }, + { + "name": "mantle-framework/events", + "version": "v1.1.3", + "version_normalized": "1.1.3.0", + "source": { + "type": "git", + "url": "https://github.com/mantle-framework/events.git", + "reference": "f70e94c45b5d4f74eed803a98d4c3d1001f608c1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mantle-framework/events/zipball/f70e94c45b5d4f74eed803a98d4c3d1001f608c1", + "reference": "f70e94c45b5d4f74eed803a98d4c3d1001f608c1", + "shasum": "" + }, + "require": { + "alleyinteractive/composer-wordpress-autoloader": "^1.0", + "mantle-framework/container": "^1.0", + "mantle-framework/contracts": "^1.0", + "mantle-framework/support": "^1.0", + "php": "^8.1", + "psr/container": "^1.1.1 || ^2.0.2", + "symfony/finder": "^6.2" + }, + "time": "2024-05-08T19:42:48+00:00", + "type": "library", + "extra": { + "wordpress-autoloader": { + "autoload": { + "Mantle\\Events": "./" + } + } + }, + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Alley", + "email": "mantle@alley.com" + } + ], + "description": "The Mantle Framework Events Package", + "support": { + "source": "https://github.com/mantle-framework/events/tree/v1.1.3" + }, + "install-path": "../mantle-framework/events" + }, + { + "name": "mantle-framework/faker", + "version": "v1.1.3", + "version_normalized": "1.1.3.0", + "source": { + "type": "git", + "url": "https://github.com/mantle-framework/faker.git", + "reference": "20e925cf13ce03cfd216654c82d3a58cd6f04504" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mantle-framework/faker/zipball/20e925cf13ce03cfd216654c82d3a58cd6f04504", + "reference": "20e925cf13ce03cfd216654c82d3a58cd6f04504", + "shasum": "" + }, + "require": { + "alleyinteractive/composer-wordpress-autoloader": "^1.0", + "fakerphp/faker": "^1.23", + "php": "^8.1" + }, + "time": "2024-05-08T19:42:50+00:00", + "type": "library", + "extra": { + "wordpress-autoloader": { + "autoload": { + "Mantle\\Faker": "./" + } + } + }, + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Alley", + "email": "mantle@alley.com" + } + ], + "description": "The Mantle Framework Faker Package", + "support": { + "source": "https://github.com/mantle-framework/faker/tree/v1.1.3" + }, + "install-path": "../mantle-framework/faker" + }, + { + "name": "mantle-framework/filesystem", + "version": "v1.1.3", + "version_normalized": "1.1.3.0", + "source": { + "type": "git", + "url": "https://github.com/mantle-framework/filesystem.git", + "reference": "a08ed372eb22326c9a4eab969ac72b11458bf3b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mantle-framework/filesystem/zipball/a08ed372eb22326c9a4eab969ac72b11458bf3b6", + "reference": "a08ed372eb22326c9a4eab969ac72b11458bf3b6", + "shasum": "" + }, + "require": { + "alleyinteractive/composer-wordpress-autoloader": "^1.0", + "league/flysystem": "^1.1.10", + "league/flysystem-cached-adapter": "^1.1", + "mantle-framework/contracts": "^1.0", + "mantle-framework/support": "^1.0", + "php": "^8.1", + "psr/container": "^1.1.1 || ^2.0.2", + "symfony/finder": "^6.2", + "symfony/http-foundation": "^6.0.20" + }, + "time": "2024-05-08T19:42:49+00:00", + "type": "library", + "extra": { + "wordpress-autoloader": { + "autoload": { + "Mantle\\Filesystem": "./" + } + } + }, + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Alley", + "email": "mantle@alley.com" + } + ], + "description": "The Mantle Framework Filesystem Package", + "support": { + "source": "https://github.com/mantle-framework/filesystem/tree/v1.1.3" + }, + "install-path": "../mantle-framework/filesystem" + }, + { + "name": "mantle-framework/http", + "version": "v1.1.3", + "version_normalized": "1.1.3.0", + "source": { + "type": "git", + "url": "https://github.com/mantle-framework/http.git", + "reference": "6a31136fc694d24e273fd677bb9eaed4f27611ee" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mantle-framework/http/zipball/6a31136fc694d24e273fd677bb9eaed4f27611ee", + "reference": "6a31136fc694d24e273fd677bb9eaed4f27611ee", + "shasum": "" + }, + "require": { + "mantle-framework/contracts": "^1.0", + "mantle-framework/filesystem": "^1.0", + "mantle-framework/support": "^1.0", + "php": "^8.1", + "symfony/http-foundation": "^6.0.20", + "symfony/http-kernel": "^6.0.20", + "symfony/mime": "^6.2", + "symfony/routing": "^6.2", + "symfony/var-dumper": "^6.2" + }, + "suggest": { + "illuminate/view": "For assertions in tests that use Blade templating" + }, + "time": "2024-07-30T18:32:54+00:00", + "type": "library", + "extra": { + "wordpress-autoloader": { + "autoload": { + "Mantle\\Http": "./" + } + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "autoload.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Alley", + "email": "mantle@alley.com" + } + ], + "description": "The Mantle Framework Http Package", + "support": { + "source": "https://github.com/mantle-framework/http/tree/v1.1.3" + }, + "install-path": "../mantle-framework/http" + }, + { + "name": "mantle-framework/http-client", + "version": "v1.1.3", + "version_normalized": "1.1.3.0", + "source": { + "type": "git", + "url": "https://github.com/mantle-framework/http-client.git", + "reference": "ddc599adf2936e67f342964a8d6fb74e197fba84" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mantle-framework/http-client/zipball/ddc599adf2936e67f342964a8d6fb74e197fba84", + "reference": "ddc599adf2936e67f342964a8d6fb74e197fba84", + "shasum": "" + }, + "require": { + "alleyinteractive/wp-concurrent-remote-requests": "^1.0.2", + "mantle-framework/support": "^1.0", + "php": "^8.1" + }, + "time": "2024-08-12T21:15:16+00:00", + "type": "library", + "extra": { + "wordpress-autoloader": { + "autoload": { + "Mantle\\Http_Client": "./" + } + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "autoload.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Alley", + "email": "mantle@alley.com" + } + ], + "description": "The Mantle Framework Http Client Package", + "support": { + "source": "https://github.com/mantle-framework/http-client/tree/v1.1.3" + }, + "install-path": "../mantle-framework/http-client" + }, + { + "name": "mantle-framework/support", + "version": "v1.1.3", + "version_normalized": "1.1.3.0", + "source": { + "type": "git", + "url": "https://github.com/mantle-framework/support.git", + "reference": "dc27f85ee97ed6e8fd3255a5155514700cd68220" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mantle-framework/support/zipball/dc27f85ee97ed6e8fd3255a5155514700cd68220", + "reference": "dc27f85ee97ed6e8fd3255a5155514700cd68220", + "shasum": "" + }, + "require": { + "alleyinteractive/composer-wordpress-autoloader": "^1.0", + "doctrine/inflector": "^2.0.8", + "league/commonmark": "^2.4.0", + "mantle-framework/contracts": "^1.0", + "monolog/monolog": "^2.9.1", + "nesbot/carbon": "^2.68.1", + "php": "^8.1", + "ramsey/uuid": "^4.7.4", + "symfony/finder": "^6.2", + "symfony/var-dumper": "^6.2", + "voku/portable-ascii": "^2.0.1" + }, + "suggest": { + "mantle-framework/console": "Required to load Mantle Console Commands", + "mantle-framework/container": "Required to use wrapped add_action/add_filter functions", + "vlucas/phpdotenv": "Required to use Environment class (^5.3)" + }, + "time": "2024-05-10T16:38:52+00:00", + "type": "library", + "extra": { + "wordpress-autoloader": { + "autoload": { + "Mantle\\Support": "./" + } + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "autoload.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Alley", + "email": "mantle@alley.com" + } + ], + "description": "The Mantle Framework Support Package", + "support": { + "source": "https://github.com/mantle-framework/support/tree/v1.1.3" + }, + "install-path": "../mantle-framework/support" + }, + { + "name": "mantle-framework/testing", + "version": "v1.1.3", + "version_normalized": "1.1.3.0", + "source": { + "type": "git", + "url": "https://github.com/mantle-framework/testing.git", + "reference": "a608d3ddbfe74aa4279ce2db9f3bacc30ac7486a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mantle-framework/testing/zipball/a608d3ddbfe74aa4279ce2db9f3bacc30ac7486a", + "reference": "a608d3ddbfe74aa4279ce2db9f3bacc30ac7486a", + "shasum": "" + }, + "require": { + "alleyinteractive/composer-wordpress-autoloader": "^1.0", + "mantle-framework/contracts": "^1.0", + "mantle-framework/database": "^1.0", + "mantle-framework/faker": "^1.0", + "mantle-framework/http": "^1.0", + "mantle-framework/http-client": "^1.0", + "mantle-framework/support": "^1.0", + "nunomaduro/termwind": "^1.15.1", + "php": "^8.1", + "spatie/phpunit-snapshot-assertions": "^4.2 || ^5.1", + "symfony/css-selector": "^6.2" + }, + "suggest": { + "mantle-framework/console": "Required to assert console commands.", + "mantle-framework/testkit": "For running tests against a WordPress install without Mantle", + "nunomaduro/collision": "For better PHPUnit printing.", + "phpunit/phpunit": "Required to use assertions and run tests." + }, + "time": "2024-08-12T21:15:17+00:00", + "type": "library", + "extra": { + "wordpress-autoloader": { + "autoload": { + "Mantle\\Testing": "./" + } + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "autoload.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Alley", + "email": "mantle@alley.com" + } + ], + "description": "The Mantle Framework Testing Package", + "keywords": [ + "mantle", + "testing" + ], + "support": { + "source": "https://github.com/mantle-framework/testing/tree/v1.1.3" + }, + "install-path": "../mantle-framework/testing" + }, + { + "name": "mantle-framework/testkit", + "version": "v1.1.3", + "version_normalized": "1.1.3.0", + "source": { + "type": "git", + "url": "https://github.com/mantle-framework/testkit.git", + "reference": "912e0287f7935f616818f78243a12b8e3bb9582b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mantle-framework/testkit/zipball/912e0287f7935f616818f78243a12b8e3bb9582b", + "reference": "912e0287f7935f616818f78243a12b8e3bb9582b", + "shasum": "" + }, + "require": { + "alleyinteractive/composer-wordpress-autoloader": "^1.0", + "mantle-framework/config": "^1.0", + "mantle-framework/container": "^1.0", + "mantle-framework/contracts": "^1.0", + "mantle-framework/events": "^1.0", + "mantle-framework/faker": "^1.0", + "mantle-framework/support": "^1.0", + "mantle-framework/testing": "^1.0", + "nunomaduro/collision": "^6.0 || ^7.0", + "php": "^8.1", + "phpunit/phpunit": "^9.3.3 || ^10.0.7 || ^11.0", + "symfony/http-foundation": "^6.0" + }, + "conflict": { + "alleyinteractive/mantle-framework": "*" + }, + "suggest": { + "alleyinteractive/mantle-framework": "For the full Mantle Framework, require the base package instead." + }, + "time": "2024-06-20T15:23:45+00:00", + "type": "library", + "extra": { + "wordpress-autoloader": { + "autoload": { + "Mantle\\Testkit": "./" + } + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "autoload.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Alley", + "email": "mantle@alley.com" + } + ], + "description": "The Mantle Framework Teskit Package", + "keywords": [ + "mantle", + "testing" + ], + "support": { + "source": "https://github.com/mantle-framework/testkit/tree/v1.1.3" + }, + "install-path": "../mantle-framework/testkit" + }, + { + "name": "monolog/monolog", + "version": "2.9.3", + "version_normalized": "2.9.3.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "a30bfe2e142720dfa990d0a7e573997f5d884215" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/a30bfe2e142720dfa990d0a7e573997f5d884215", + "reference": "a30bfe2e142720dfa990d0a7e573997f5d884215", + "shasum": "" + }, + "require": { + "php": ">=7.2", + "psr/log": "^1.0.1 || ^2.0 || ^3.0" + }, + "provide": { + "psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "doctrine/couchdb": "~1.0@dev", + "elasticsearch/elasticsearch": "^7 || ^8", + "ext-json": "*", + "graylog2/gelf-php": "^1.4.2 || ^2@dev", + "guzzlehttp/guzzle": "^7.4", + "guzzlehttp/psr7": "^2.2", + "mongodb/mongodb": "^1.8", + "php-amqplib/php-amqplib": "~2.4 || ^3", + "phpspec/prophecy": "^1.15", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^8.5.38 || ^9.6.19", + "predis/predis": "^1.1 || ^2.0", + "rollbar/rollbar": "^1.3 || ^2 || ^3", + "ruflin/elastica": "^7", + "swiftmailer/swiftmailer": "^5.3|^6.0", + "symfony/mailer": "^5.4 || ^6", + "symfony/mime": "^5.4 || ^6" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler", + "ext-mbstring": "Allow to work properly with unicode symbols", + "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", + "ext-openssl": "Required to send log messages using SSL", + "ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server" + }, + "time": "2024-04-12T20:52:51+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "https://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "https://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "support": { + "issues": "https://github.com/Seldaek/monolog/issues", + "source": "https://github.com/Seldaek/monolog/tree/2.9.3" + }, + "funding": [ + { + "url": "https://github.com/Seldaek", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/monolog/monolog", + "type": "tidelift" + } + ], + "install-path": "../monolog/monolog" + }, + { + "name": "myclabs/deep-copy", + "version": "1.12.0", + "version_normalized": "1.12.0.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3 <3.2.2" + }, + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "time": "2024-06-12T14:39:25+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "install-path": "../myclabs/deep-copy" + }, + { + "name": "nesbot/carbon", + "version": "2.72.5", + "version_normalized": "2.72.5.0", + "source": { + "type": "git", + "url": "https://github.com/briannesbitt/Carbon.git", + "reference": "afd46589c216118ecd48ff2b95d77596af1e57ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/afd46589c216118ecd48ff2b95d77596af1e57ed", + "reference": "afd46589c216118ecd48ff2b95d77596af1e57ed", + "shasum": "" + }, + "require": { + "carbonphp/carbon-doctrine-types": "*", + "ext-json": "*", + "php": "^7.1.8 || ^8.0", + "psr/clock": "^1.0", + "symfony/polyfill-mbstring": "^1.0", + "symfony/polyfill-php80": "^1.16", + "symfony/translation": "^3.4 || ^4.0 || ^5.0 || ^6.0" + }, + "provide": { + "psr/clock-implementation": "1.0" + }, + "require-dev": { + "doctrine/dbal": "^2.0 || ^3.1.4 || ^4.0", + "doctrine/orm": "^2.7 || ^3.0", + "friendsofphp/php-cs-fixer": "^3.0", + "kylekatarnls/multi-tester": "^2.0", + "ondrejmirtes/better-reflection": "*", + "phpmd/phpmd": "^2.9", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^0.12.99 || ^1.7.14", + "phpunit/php-file-iterator": "^2.0.5 || ^3.0.6", + "phpunit/phpunit": "^7.5.20 || ^8.5.26 || ^9.5.20", + "squizlabs/php_codesniffer": "^3.4" + }, + "time": "2024-06-03T19:18:41+00:00", + "bin": [ + "bin/carbon" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev", + "dev-2.x": "2.x-dev" + }, + "laravel": { + "providers": [ + "Carbon\\Laravel\\ServiceProvider" + ] + }, + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Carbon\\": "src/Carbon/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brian Nesbitt", + "email": "brian@nesbot.com", + "homepage": "https://markido.com" + }, + { + "name": "kylekatarnls", + "homepage": "https://github.com/kylekatarnls" + } + ], + "description": "An API extension for DateTime that supports 281 different languages.", + "homepage": "https://carbon.nesbot.com", + "keywords": [ + "date", + "datetime", + "time" + ], + "support": { + "docs": "https://carbon.nesbot.com/docs", + "issues": "https://github.com/briannesbitt/Carbon/issues", + "source": "https://github.com/briannesbitt/Carbon" + }, + "funding": [ + { + "url": "https://github.com/sponsors/kylekatarnls", + "type": "github" + }, + { + "url": "https://opencollective.com/Carbon#sponsor", + "type": "opencollective" + }, + { + "url": "https://tidelift.com/subscription/pkg/packagist-nesbot-carbon?utm_source=packagist-nesbot-carbon&utm_medium=referral&utm_campaign=readme", + "type": "tidelift" + } + ], + "install-path": "../nesbot/carbon" + }, + { + "name": "nette/schema", + "version": "v1.3.0", + "version_normalized": "1.3.0.0", + "source": { + "type": "git", + "url": "https://github.com/nette/schema.git", + "reference": "a6d3a6d1f545f01ef38e60f375d1cf1f4de98188" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/schema/zipball/a6d3a6d1f545f01ef38e60f375d1cf1f4de98188", + "reference": "a6d3a6d1f545f01ef38e60f375d1cf1f4de98188", + "shasum": "" + }, + "require": { + "nette/utils": "^4.0", + "php": "8.1 - 8.3" + }, + "require-dev": { + "nette/tester": "^2.4", + "phpstan/phpstan-nette": "^1.0", + "tracy/tracy": "^2.8" + }, + "time": "2023-12-11T11:54:22+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0-only", + "GPL-3.0-only" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "📐 Nette Schema: validating data structures against a given Schema.", + "homepage": "https://nette.org", + "keywords": [ + "config", + "nette" + ], + "support": { + "issues": "https://github.com/nette/schema/issues", + "source": "https://github.com/nette/schema/tree/v1.3.0" + }, + "install-path": "../nette/schema" + }, + { + "name": "nette/utils", + "version": "v4.0.5", + "version_normalized": "4.0.5.0", + "source": { + "type": "git", + "url": "https://github.com/nette/utils.git", + "reference": "736c567e257dbe0fcf6ce81b4d6dbe05c6899f96" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/utils/zipball/736c567e257dbe0fcf6ce81b4d6dbe05c6899f96", + "reference": "736c567e257dbe0fcf6ce81b4d6dbe05c6899f96", + "shasum": "" + }, + "require": { + "php": "8.0 - 8.4" + }, + "conflict": { + "nette/finder": "<3", + "nette/schema": "<1.2.2" + }, + "require-dev": { + "jetbrains/phpstorm-attributes": "dev-master", + "nette/tester": "^2.5", + "phpstan/phpstan": "^1.0", + "tracy/tracy": "^2.9" + }, + "suggest": { + "ext-gd": "to use Image", + "ext-iconv": "to use Strings::webalize(), toAscii(), chr() and reverse()", + "ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()", + "ext-json": "to use Nette\\Utils\\Json", + "ext-mbstring": "to use Strings::lower() etc...", + "ext-tokenizer": "to use Nette\\Utils\\Reflection::getUseStatements()" + }, + "time": "2024-08-07T15:39:19+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0-only", + "GPL-3.0-only" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", + "homepage": "https://nette.org", + "keywords": [ + "array", + "core", + "datetime", + "images", + "json", + "nette", + "paginator", + "password", + "slugify", + "string", + "unicode", + "utf-8", + "utility", + "validation" + ], + "support": { + "issues": "https://github.com/nette/utils/issues", + "source": "https://github.com/nette/utils/tree/v4.0.5" + }, + "install-path": "../nette/utils" + }, + { + "name": "nikic/php-parser", + "version": "v5.1.0", + "version_normalized": "5.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1", + "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-json": "*", + "ext-tokenizer": "*", + "php": ">=7.4" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^9.0" + }, + "time": "2024-07-01T20:03:41+00:00", + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0" + }, + "install-path": "../nikic/php-parser" + }, + { + "name": "nunomaduro/collision", + "version": "v7.10.0", + "version_normalized": "7.10.0.0", + "source": { + "type": "git", + "url": "https://github.com/nunomaduro/collision.git", + "reference": "49ec67fa7b002712da8526678abd651c09f375b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nunomaduro/collision/zipball/49ec67fa7b002712da8526678abd651c09f375b2", + "reference": "49ec67fa7b002712da8526678abd651c09f375b2", + "shasum": "" + }, + "require": { + "filp/whoops": "^2.15.3", + "nunomaduro/termwind": "^1.15.1", + "php": "^8.1.0", + "symfony/console": "^6.3.4" + }, + "conflict": { + "laravel/framework": ">=11.0.0" + }, + "require-dev": { + "brianium/paratest": "^7.3.0", + "laravel/framework": "^10.28.0", + "laravel/pint": "^1.13.3", + "laravel/sail": "^1.25.0", + "laravel/sanctum": "^3.3.1", + "laravel/tinker": "^2.8.2", + "nunomaduro/larastan": "^2.6.4", + "orchestra/testbench-core": "^8.13.0", + "pestphp/pest": "^2.23.2", + "phpunit/phpunit": "^10.4.1", + "sebastian/environment": "^6.0.1", + "spatie/laravel-ignition": "^2.3.1" + }, + "time": "2023-10-11T15:45:01+00:00", + "type": "library", + "extra": { + "laravel": { + "providers": [ + "NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider" + ] + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "./src/Adapters/Phpunit/Autoload.php" + ], + "psr-4": { + "NunoMaduro\\Collision\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "description": "Cli error handling for console/command-line PHP applications.", + "keywords": [ + "artisan", + "cli", + "command-line", + "console", + "error", + "handling", + "laravel", + "laravel-zero", + "php", + "symfony" + ], + "support": { + "issues": "https://github.com/nunomaduro/collision/issues", + "source": "https://github.com/nunomaduro/collision" + }, + "funding": [ + { + "url": "https://www.paypal.com/paypalme/enunomaduro", + "type": "custom" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + }, + { + "url": "https://www.patreon.com/nunomaduro", + "type": "patreon" + } + ], + "install-path": "../nunomaduro/collision" + }, + { + "name": "nunomaduro/termwind", + "version": "v1.15.1", + "version_normalized": "1.15.1.0", + "source": { + "type": "git", + "url": "https://github.com/nunomaduro/termwind.git", + "reference": "8ab0b32c8caa4a2e09700ea32925441385e4a5dc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nunomaduro/termwind/zipball/8ab0b32c8caa4a2e09700ea32925441385e4a5dc", + "reference": "8ab0b32c8caa4a2e09700ea32925441385e4a5dc", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": "^8.0", + "symfony/console": "^5.3.0|^6.0.0" + }, + "require-dev": { + "ergebnis/phpstan-rules": "^1.0.", + "illuminate/console": "^8.0|^9.0", + "illuminate/support": "^8.0|^9.0", + "laravel/pint": "^1.0.0", + "pestphp/pest": "^1.21.0", + "pestphp/pest-plugin-mock": "^1.0", + "phpstan/phpstan": "^1.4.6", + "phpstan/phpstan-strict-rules": "^1.1.0", + "symfony/var-dumper": "^5.2.7|^6.0.0", + "thecodingmachine/phpstan-strict-rules": "^1.0.0" + }, + "time": "2023-02-08T01:06:31+00:00", + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Termwind\\Laravel\\TermwindServiceProvider" + ] + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/Functions.php" + ], + "psr-4": { + "Termwind\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "description": "Its like Tailwind CSS, but for the console.", + "keywords": [ + "cli", + "console", + "css", + "package", + "php", + "style" + ], + "support": { + "issues": "https://github.com/nunomaduro/termwind/issues", + "source": "https://github.com/nunomaduro/termwind/tree/v1.15.1" + }, + "funding": [ + { + "url": "https://www.paypal.com/paypalme/enunomaduro", + "type": "custom" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + }, + { + "url": "https://github.com/xiCO2k", + "type": "github" + } + ], + "install-path": "../nunomaduro/termwind" + }, + { + "name": "phar-io/manifest", + "version": "2.0.4", + "version_normalized": "2.0.4.0", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "54750ef60c58e43759730615a392c31c80e23176" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" + }, + "time": "2024-03-03T12:33:53+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "install-path": "../phar-io/manifest" + }, + { + "name": "phar-io/version", + "version": "3.2.1", + "version_normalized": "3.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "time": "2022-02-21T01:04:05+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "install-path": "../phar-io/version" + }, + { + "name": "php-stubs/wordpress-stubs", + "version": "v6.6.0", + "version_normalized": "6.6.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-stubs/wordpress-stubs.git", + "reference": "86e8753e89d59849276dcdd91b9a7dd78bb4abe2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/86e8753e89d59849276dcdd91b9a7dd78bb4abe2", + "reference": "86e8753e89d59849276dcdd91b9a7dd78bb4abe2", + "shasum": "" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "nikic/php-parser": "^4.13", + "php": "^7.4 || ^8.0", + "php-stubs/generator": "^0.8.3", + "phpdocumentor/reflection-docblock": "^5.4.1", + "phpstan/phpstan": "^1.10.49", + "phpunit/phpunit": "^9.5", + "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^1.0", + "wp-coding-standards/wpcs": "3.1.0 as 2.3.0" + }, + "suggest": { + "paragonie/sodium_compat": "Pure PHP implementation of libsodium", + "symfony/polyfill-php80": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "szepeviktor/phpstan-wordpress": "WordPress extensions for PHPStan" + }, + "time": "2024-07-17T08:50:38+00:00", + "type": "library", + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "WordPress function and class declaration stubs for static analysis.", + "homepage": "https://github.com/php-stubs/wordpress-stubs", + "keywords": [ + "PHPStan", + "static analysis", + "wordpress" + ], + "support": { + "issues": "https://github.com/php-stubs/wordpress-stubs/issues", + "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.6.0" + }, + "install-path": "../php-stubs/wordpress-stubs" + }, + { + "name": "phpcompatibility/php-compatibility", + "version": "9.3.5", + "version_normalized": "9.3.5.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243", + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "squizlabs/php_codesniffer": "^2.3 || ^3.0.2" + }, + "conflict": { + "squizlabs/php_codesniffer": "2.6.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "time": "2019-12-27T09:44:58+00:00", + "type": "phpcodesniffer-standard", + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "homepage": "https://github.com/wimg", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors" + } + ], + "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.", + "homepage": "http://techblog.wimgodden.be/tag/codesniffer/", + "keywords": [ + "compatibility", + "phpcs", + "standards" + ], + "support": { + "issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues", + "source": "https://github.com/PHPCompatibility/PHPCompatibility" + }, + "install-path": "../phpcompatibility/php-compatibility" + }, + { + "name": "phpcompatibility/phpcompatibility-paragonie", + "version": "1.3.3", + "version_normalized": "1.3.3.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git", + "reference": "293975b465e0e709b571cbf0c957c6c0a7b9a2ac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/293975b465e0e709b571cbf0c957c6c0a7b9a2ac", + "reference": "293975b465e0e709b571cbf0c957c6c0a7b9a2ac", + "shasum": "" + }, + "require": { + "phpcompatibility/php-compatibility": "^9.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "paragonie/random_compat": "dev-master", + "paragonie/sodium_compat": "dev-master" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "time": "2024-04-24T21:30:46+00:00", + "type": "phpcodesniffer-standard", + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "lead" + } + ], + "description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.", + "homepage": "http://phpcompatibility.com/", + "keywords": [ + "compatibility", + "paragonie", + "phpcs", + "polyfill", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues", + "security": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/security/policy", + "source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie" + }, + "funding": [ + { + "url": "https://github.com/PHPCompatibility", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "install-path": "../phpcompatibility/phpcompatibility-paragonie" + }, + { + "name": "phpcompatibility/phpcompatibility-wp", + "version": "2.1.5", + "version_normalized": "2.1.5.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", + "reference": "01c1ff2704a58e46f0cb1ca9d06aee07b3589082" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/01c1ff2704a58e46f0cb1ca9d06aee07b3589082", + "reference": "01c1ff2704a58e46f0cb1ca9d06aee07b3589082", + "shasum": "" + }, + "require": { + "phpcompatibility/php-compatibility": "^9.0", + "phpcompatibility/phpcompatibility-paragonie": "^1.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "time": "2024-04-24T21:37:59+00:00", + "type": "phpcodesniffer-standard", + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "lead" + } + ], + "description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.", + "homepage": "http://phpcompatibility.com/", + "keywords": [ + "compatibility", + "phpcs", + "standards", + "static analysis", + "wordpress" + ], + "support": { + "issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues", + "security": "https://github.com/PHPCompatibility/PHPCompatibilityWP/security/policy", + "source": "https://github.com/PHPCompatibility/PHPCompatibilityWP" + }, + "funding": [ + { + "url": "https://github.com/PHPCompatibility", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "install-path": "../phpcompatibility/phpcompatibility-wp" + }, + { + "name": "phpcsstandards/phpcsextra", + "version": "1.2.1", + "version_normalized": "1.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSExtra.git", + "reference": "11d387c6642b6e4acaf0bd9bf5203b8cca1ec489" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/11d387c6642b6e4acaf0bd9bf5203b8cca1ec489", + "reference": "11d387c6642b6e4acaf0bd9bf5203b8cca1ec489", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "phpcsstandards/phpcsutils": "^1.0.9", + "squizlabs/php_codesniffer": "^3.8.0" + }, + "require-dev": { + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcsstandards/phpcsdevcs": "^1.1.6", + "phpcsstandards/phpcsdevtools": "^1.2.1", + "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "time": "2023-12-08T16:49:07+00:00", + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSExtra/graphs/contributors" + } + ], + "description": "A collection of sniffs and standards for use with PHP_CodeSniffer.", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHPCSExtra/issues", + "security": "https://github.com/PHPCSStandards/PHPCSExtra/security/policy", + "source": "https://github.com/PHPCSStandards/PHPCSExtra" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "install-path": "../phpcsstandards/phpcsextra" + }, + { + "name": "phpcsstandards/phpcsutils", + "version": "1.0.12", + "version_normalized": "1.0.12.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSUtils.git", + "reference": "87b233b00daf83fb70f40c9a28692be017ea7c6c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/87b233b00daf83fb70f40c9a28692be017ea7c6c", + "reference": "87b233b00daf83fb70f40c9a28692be017ea7c6c", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", + "php": ">=5.4", + "squizlabs/php_codesniffer": "^3.10.0 || 4.0.x-dev@dev" + }, + "require-dev": { + "ext-filter": "*", + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcsstandards/phpcsdevcs": "^1.1.6", + "yoast/phpunit-polyfills": "^1.1.0 || ^2.0.0" + }, + "time": "2024-05-20T13:34:27+00:00", + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "PHPCSUtils/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSUtils/graphs/contributors" + } + ], + "description": "A suite of utility functions for use with PHP_CodeSniffer", + "homepage": "https://phpcsutils.com/", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "phpcs3", + "standards", + "static analysis", + "tokens", + "utility" + ], + "support": { + "docs": "https://phpcsutils.com/", + "issues": "https://github.com/PHPCSStandards/PHPCSUtils/issues", + "security": "https://github.com/PHPCSStandards/PHPCSUtils/security/policy", + "source": "https://github.com/PHPCSStandards/PHPCSUtils" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "install-path": "../phpcsstandards/phpcsutils" + }, + { + "name": "phpstan/phpstan", + "version": "1.12.1", + "version_normalized": "1.12.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2", + "reference": "d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "time": "2024-09-03T19:55:22+00:00", + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + } + ], + "install-path": "../phpstan/phpstan" + }, + { + "name": "phpunit/php-code-coverage", + "version": "10.1.16", + "version_normalized": "10.1.16.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "7e308268858ed6baedc8704a304727d20bc07c77" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/7e308268858ed6baedc8704a304727d20bc07c77", + "reference": "7e308268858ed6baedc8704a304727d20bc07c77", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^4.19.1 || ^5.1.0", + "php": ">=8.1", + "phpunit/php-file-iterator": "^4.1.0", + "phpunit/php-text-template": "^3.0.1", + "sebastian/code-unit-reverse-lookup": "^3.0.0", + "sebastian/complexity": "^3.2.0", + "sebastian/environment": "^6.1.0", + "sebastian/lines-of-code": "^2.0.2", + "sebastian/version": "^4.0.1", + "theseer/tokenizer": "^1.2.3" + }, + "require-dev": { + "phpunit/phpunit": "^10.1" + }, + "suggest": { + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + }, + "time": "2024-08-22T04:31:57+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "10.1.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.16" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../phpunit/php-code-coverage" + }, + { + "name": "phpunit/php-file-iterator", + "version": "4.1.0", + "version_normalized": "4.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a95037b6d9e608ba092da1b23931e537cadc3c3c", + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "time": "2023-08-31T06:24:48+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.1.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../phpunit/php-file-iterator" + }, + { + "name": "phpunit/php-invoker", + "version": "4.0.0", + "version_normalized": "4.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^10.0" + }, + "suggest": { + "ext-pcntl": "*" + }, + "time": "2023-02-03T06:56:09+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/4.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../phpunit/php-invoker" + }, + { + "name": "phpunit/php-text-template", + "version": "3.0.1", + "version_normalized": "3.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/0c7b06ff49e3d5072f057eb1fa59258bf287a748", + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "time": "2023-08-31T14:07:24+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../phpunit/php-text-template" + }, + { + "name": "phpunit/php-timer", + "version": "6.0.0", + "version_normalized": "6.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/e2a2d67966e740530f4a3343fe2e030ffdc1161d", + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "time": "2023-02-03T06:57:52+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/6.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../phpunit/php-timer" + }, + { + "name": "phpunit/phpunit", + "version": "10.5.32", + "version_normalized": "10.5.32.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "f069f46840445d37a4e6f0de8c5879598f9c4327" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f069f46840445d37a4e6f0de8c5879598f9c4327", + "reference": "f069f46840445d37a4e6f0de8c5879598f9c4327", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.12.0", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", + "php": ">=8.1", + "phpunit/php-code-coverage": "^10.1.16", + "phpunit/php-file-iterator": "^4.1.0", + "phpunit/php-invoker": "^4.0.0", + "phpunit/php-text-template": "^3.0.1", + "phpunit/php-timer": "^6.0.0", + "sebastian/cli-parser": "^2.0.1", + "sebastian/code-unit": "^2.0.0", + "sebastian/comparator": "^5.0.2", + "sebastian/diff": "^5.1.1", + "sebastian/environment": "^6.1.0", + "sebastian/exporter": "^5.1.2", + "sebastian/global-state": "^6.0.2", + "sebastian/object-enumerator": "^5.0.0", + "sebastian/recursion-context": "^5.0.0", + "sebastian/type": "^4.0.0", + "sebastian/version": "^4.0.1" + }, + "suggest": { + "ext-soap": "To be able to generate mocks based on WSDL files" + }, + "time": "2024-09-04T13:33:39+00:00", + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "10.5-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.32" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" + } + ], + "install-path": "../phpunit/phpunit" + }, + { + "name": "psr/cache", + "version": "1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2016-08-06T20:24:11+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "support": { + "source": "https://github.com/php-fig/cache/tree/master" + }, + "install-path": "../psr/cache" + }, + { + "name": "psr/clock", + "version": "1.0.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "time": "2022-11-25T14:36:26+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "install-path": "../psr/clock" + }, + { + "name": "psr/container", + "version": "1.1.2", + "version_normalized": "1.1.2.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "time": "2021-11-05T16:50:12+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/1.1.2" + }, + "install-path": "../psr/container" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "time": "2019-01-08T18:20:26+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "install-path": "../psr/event-dispatcher" + }, + { + "name": "psr/http-message", + "version": "2.0", + "version_normalized": "2.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "time": "2023-04-04T09:54:51+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/2.0" + }, + "install-path": "../psr/http-message" + }, + { + "name": "psr/log", + "version": "3.0.1", + "version_normalized": "3.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "79dff0b268932c640297f5208d6298f71855c03e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/79dff0b268932c640297f5208d6298f71855c03e", + "reference": "79dff0b268932c640297f5208d6298f71855c03e", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "time": "2024-08-21T13:31:24+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.1" + }, + "install-path": "../psr/log" + }, + { + "name": "ramsey/collection", + "version": "2.0.0", + "version_normalized": "2.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/ramsey/collection.git", + "reference": "a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ramsey/collection/zipball/a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5", + "reference": "a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "captainhook/plugin-composer": "^5.3", + "ergebnis/composer-normalize": "^2.28.3", + "fakerphp/faker": "^1.21", + "hamcrest/hamcrest-php": "^2.0", + "jangregor/phpstan-prophecy": "^1.0", + "mockery/mockery": "^1.5", + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.3", + "phpcsstandards/phpcsutils": "^1.0.0-rc1", + "phpspec/prophecy-phpunit": "^2.0", + "phpstan/extension-installer": "^1.2", + "phpstan/phpstan": "^1.9", + "phpstan/phpstan-mockery": "^1.1", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5", + "psalm/plugin-mockery": "^1.1", + "psalm/plugin-phpunit": "^0.18.4", + "ramsey/coding-standard": "^2.0.3", + "ramsey/conventional-commits": "^1.3", + "vimeo/psalm": "^5.4" + }, + "time": "2022-12-31T21:50:55+00:00", + "type": "library", + "extra": { + "captainhook": { + "force-install": true + }, + "ramsey/conventional-commits": { + "configFile": "conventional-commits.json" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Ramsey\\Collection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ben Ramsey", + "email": "ben@benramsey.com", + "homepage": "https://benramsey.com" + } + ], + "description": "A PHP library for representing and manipulating collections.", + "keywords": [ + "array", + "collection", + "hash", + "map", + "queue", + "set" + ], + "support": { + "issues": "https://github.com/ramsey/collection/issues", + "source": "https://github.com/ramsey/collection/tree/2.0.0" + }, + "funding": [ + { + "url": "https://github.com/ramsey", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/ramsey/collection", + "type": "tidelift" + } + ], + "install-path": "../ramsey/collection" + }, + { + "name": "ramsey/uuid", + "version": "4.7.6", + "version_normalized": "4.7.6.0", + "source": { + "type": "git", + "url": "https://github.com/ramsey/uuid.git", + "reference": "91039bc1faa45ba123c4328958e620d382ec7088" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/91039bc1faa45ba123c4328958e620d382ec7088", + "reference": "91039bc1faa45ba123c4328958e620d382ec7088", + "shasum": "" + }, + "require": { + "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12", + "ext-json": "*", + "php": "^8.0", + "ramsey/collection": "^1.2 || ^2.0" + }, + "replace": { + "rhumsaa/uuid": "self.version" + }, + "require-dev": { + "captainhook/captainhook": "^5.10", + "captainhook/plugin-composer": "^5.3", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", + "doctrine/annotations": "^1.8", + "ergebnis/composer-normalize": "^2.15", + "mockery/mockery": "^1.3", + "paragonie/random-lib": "^2", + "php-mock/php-mock": "^2.2", + "php-mock/php-mock-mockery": "^1.3", + "php-parallel-lint/php-parallel-lint": "^1.1", + "phpbench/phpbench": "^1.0", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-mockery": "^1.1", + "phpstan/phpstan-phpunit": "^1.1", + "phpunit/phpunit": "^8.5 || ^9", + "ramsey/composer-repl": "^1.4", + "slevomat/coding-standard": "^8.4", + "squizlabs/php_codesniffer": "^3.5", + "vimeo/psalm": "^4.9" + }, + "suggest": { + "ext-bcmath": "Enables faster math with arbitrary-precision integers using BCMath.", + "ext-gmp": "Enables faster math with arbitrary-precision integers using GMP.", + "ext-uuid": "Enables the use of PeclUuidTimeGenerator and PeclUuidRandomGenerator.", + "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", + "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." + }, + "time": "2024-04-27T21:32:50+00:00", + "type": "library", + "extra": { + "captainhook": { + "force-install": true + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Ramsey\\Uuid\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A PHP library for generating and working with universally unique identifiers (UUIDs).", + "keywords": [ + "guid", + "identifier", + "uuid" + ], + "support": { + "issues": "https://github.com/ramsey/uuid/issues", + "source": "https://github.com/ramsey/uuid/tree/4.7.6" + }, + "funding": [ + { + "url": "https://github.com/ramsey", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/ramsey/uuid", + "type": "tidelift" + } + ], + "install-path": "../ramsey/uuid" + }, + { + "name": "sebastian/cli-parser", + "version": "2.0.1", + "version_normalized": "2.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/c34583b87e7b7a8055bf6c450c2c77ce32a24084", + "reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "time": "2024-03-02T07:12:49+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/cli-parser" + }, + { + "name": "sebastian/code-unit", + "version": "2.0.0", + "version_normalized": "2.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/a81fee9eef0b7a76af11d121767abc44c104e503", + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "time": "2023-02-03T06:58:43+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/2.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/code-unit" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "3.0.0", + "version_normalized": "3.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "time": "2023-02-03T06:59:15+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/3.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/code-unit-reverse-lookup" + }, + { + "name": "sebastian/comparator", + "version": "5.0.2", + "version_normalized": "5.0.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "2d3e04c3b4c1e84a5e7382221ad8883c8fbc4f53" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2d3e04c3b4c1e84a5e7382221ad8883c8fbc4f53", + "reference": "2d3e04c3b4c1e84a5e7382221ad8883c8fbc4f53", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/diff": "^5.0", + "sebastian/exporter": "^5.0" + }, + "require-dev": { + "phpunit/phpunit": "^10.4" + }, + "time": "2024-08-12T06:03:08+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/comparator" + }, + { + "name": "sebastian/complexity", + "version": "3.2.0", + "version_normalized": "3.2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "68ff824baeae169ec9f2137158ee529584553799" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68ff824baeae169ec9f2137158ee529584553799", + "reference": "68ff824baeae169ec9f2137158ee529584553799", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "time": "2023-12-21T08:37:17+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.2-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/3.2.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/complexity" + }, + { + "name": "sebastian/diff", + "version": "5.1.1", + "version_normalized": "5.1.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/c41e007b4b62af48218231d6c2275e4c9b975b2e", + "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0", + "symfony/process": "^6.4" + }, + "time": "2024-03-02T07:15:17+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/5.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/diff" + }, + { + "name": "sebastian/environment", + "version": "6.1.0", + "version_normalized": "6.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "8074dbcd93529b357029f5cc5058fd3e43666984" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/8074dbcd93529b357029f5cc5058fd3e43666984", + "reference": "8074dbcd93529b357029f5cc5058fd3e43666984", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "suggest": { + "ext-posix": "*" + }, + "time": "2024-03-23T08:47:14+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "https://github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/6.1.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/environment" + }, + { + "name": "sebastian/exporter", + "version": "5.1.2", + "version_normalized": "5.1.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "955288482d97c19a372d3f31006ab3f37da47adf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/955288482d97c19a372d3f31006ab3f37da47adf", + "reference": "955288482d97c19a372d3f31006ab3f37da47adf", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/recursion-context": "^5.0" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "time": "2024-03-02T07:17:12+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "https://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/exporter" + }, + { + "name": "sebastian/global-state", + "version": "6.0.2", + "version_normalized": "6.0.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/987bafff24ecc4c9ac418cab1145b96dd6e9cbd9", + "reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^10.0" + }, + "time": "2024-03-02T07:19:19+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "https://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/global-state" + }, + { + "name": "sebastian/lines-of-code", + "version": "2.0.2", + "version_normalized": "2.0.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/856e7f6a75a84e339195d48c556f23be2ebf75d0", + "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.18 || ^5.0", + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "time": "2023-12-21T08:38:20+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/lines-of-code" + }, + { + "name": "sebastian/object-enumerator", + "version": "5.0.0", + "version_normalized": "5.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/202d0e344a580d7f7d04b3fafce6933e59dae906", + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "time": "2023-02-03T07:08:32+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/5.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/object-enumerator" + }, + { + "name": "sebastian/object-reflector", + "version": "3.0.0", + "version_normalized": "3.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/24ed13d98130f0e7122df55d06c5c4942a577957", + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "time": "2023-02-03T07:06:18+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/3.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/object-reflector" + }, + { + "name": "sebastian/recursion-context", + "version": "5.0.0", + "version_normalized": "5.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "05909fb5bc7df4c52992396d0116aed689f93712" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/05909fb5bc7df4c52992396d0116aed689f93712", + "reference": "05909fb5bc7df4c52992396d0116aed689f93712", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "time": "2023-02-03T07:05:40+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "https://github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/5.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/recursion-context" + }, + { + "name": "sebastian/type", + "version": "4.0.0", + "version_normalized": "4.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/462699a16464c3944eefc02ebdd77882bd3925bf", + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "time": "2023-02-03T07:10:45+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/4.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/type" + }, + { + "name": "sebastian/version", + "version": "4.0.1", + "version_normalized": "4.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c51fa83a5d8f43f1402e3f32a005e6262244ef17", + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "time": "2023-02-07T11:34:05+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/4.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "install-path": "../sebastian/version" + }, + { + "name": "sirbrillig/phpcs-variable-analysis", + "version": "v2.11.19", + "version_normalized": "2.11.19.0", + "source": { + "type": "git", + "url": "https://github.com/sirbrillig/phpcs-variable-analysis.git", + "reference": "bc8d7e30e2005bce5c59018b7cdb08e9fb45c0d1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/bc8d7e30e2005bce5c59018b7cdb08e9fb45c0d1", + "reference": "bc8d7e30e2005bce5c59018b7cdb08e9fb45c0d1", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "squizlabs/php_codesniffer": "^3.5.6" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || ^1.0", + "phpcsstandards/phpcsdevcs": "^1.1", + "phpstan/phpstan": "^1.7", + "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.5 || ^7.0 || ^8.0 || ^9.0", + "sirbrillig/phpcs-import-detection": "^1.1", + "vimeo/psalm": "^0.2 || ^0.3 || ^1.1 || ^4.24 || ^5.0@beta" + }, + "time": "2024-06-26T20:08:34+00:00", + "type": "phpcodesniffer-standard", + "installation-source": "dist", + "autoload": { + "psr-4": { + "VariableAnalysis\\": "VariableAnalysis/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Sam Graham", + "email": "php-codesniffer-variableanalysis@illusori.co.uk" + }, + { + "name": "Payton Swick", + "email": "payton@foolord.com" + } + ], + "description": "A PHPCS sniff to detect problems with variables.", + "keywords": [ + "phpcs", + "static analysis" + ], + "support": { + "issues": "https://github.com/sirbrillig/phpcs-variable-analysis/issues", + "source": "https://github.com/sirbrillig/phpcs-variable-analysis", + "wiki": "https://github.com/sirbrillig/phpcs-variable-analysis/wiki" + }, + "install-path": "../sirbrillig/phpcs-variable-analysis" + }, + { + "name": "spatie/once", + "version": "3.1.1", + "version_normalized": "3.1.1.0", + "source": { + "type": "git", + "url": "https://github.com/spatie/once.git", + "reference": "25252b821765d72566be17c52ea05b35329f0f8f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/once/zipball/25252b821765d72566be17c52ea05b35329f0f8f", + "reference": "25252b821765d72566be17c52ea05b35329f0f8f", + "shasum": "" + }, + "require": { + "php": "^8.0" + }, + "require-dev": { + "pestphp/pest": "^1.21", + "symfony/var-dumper": "^5.1" + }, + "time": "2024-05-27T09:17:58+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Spatie\\Once\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "A magic memoization function", + "homepage": "https://github.com/spatie/once", + "keywords": [ + "cache", + "callable", + "memoization", + "once", + "spatie" + ], + "support": { + "source": "https://github.com/spatie/once/tree/3.1.1" + }, + "funding": [ + { + "url": "https://spatie.be/open-source/support-us", + "type": "custom" + } + ], + "install-path": "../spatie/once" + }, + { + "name": "spatie/phpunit-snapshot-assertions", + "version": "5.1.6", + "version_normalized": "5.1.6.0", + "source": { + "type": "git", + "url": "https://github.com/spatie/phpunit-snapshot-assertions.git", + "reference": "61e2eb567713c89987895b8f514a7a4d3bff89c9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/phpunit-snapshot-assertions/zipball/61e2eb567713c89987895b8f514a7a4d3bff89c9", + "reference": "61e2eb567713c89987895b8f514a7a4d3bff89c9", + "shasum": "" + }, + "require": { + "composer-runtime-api": "^2.0", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "php": "^8.1", + "phpunit/phpunit": "^10.0|^11.0", + "symfony/property-access": "^5.2|^6.2|^7.0", + "symfony/serializer": "^5.2|^6.2|^7.0", + "symfony/yaml": "^5.2|^6.2|^7.0" + }, + "require-dev": { + "spatie/pixelmatch-php": "dev-main", + "spatie/ray": "^1.37" + }, + "suggest": { + "spatie/pixelmatch-php": "Required to use the image snapshot assertions" + }, + "time": "2024-05-03T07:53:03+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-v5": "5.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Spatie\\Snapshots\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Sebastian De Deyne", + "email": "sebastian@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "Snapshot testing with PHPUnit", + "homepage": "https://github.com/spatie/phpunit-snapshot-assertions", + "keywords": [ + "assert", + "phpunit", + "phpunit-snapshot-assertions", + "snapshot", + "spatie", + "testing" + ], + "support": { + "issues": "https://github.com/spatie/phpunit-snapshot-assertions/issues", + "source": "https://github.com/spatie/phpunit-snapshot-assertions/tree/5.1.6" + }, + "funding": [ + { + "url": "https://spatie.be/open-source/support-us", + "type": "custom" + } + ], + "install-path": "../spatie/phpunit-snapshot-assertions" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.10.2", + "version_normalized": "3.10.2.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/86e5f5dd9a840c46810ebe5ff1885581c42a3017", + "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" + }, + "time": "2024-07-21T23:26:44+00:00", + "bin": [ + "bin/phpcbf", + "bin/phpcs" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "install-path": "../squizlabs/php_codesniffer" + }, + { + "name": "symfony/console", + "version": "v6.4.11", + "version_normalized": "6.4.11.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "42686880adaacdad1835ee8fc2a9ec5b7bd63998" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/42686880adaacdad1835ee8fc2a9ec5b7bd63998", + "reference": "42686880adaacdad1835ee8fc2a9ec5b7bd63998", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/string": "^5.4|^6.0|^7.0" + }, + "conflict": { + "symfony/dependency-injection": "<5.4", + "symfony/dotenv": "<5.4", + "symfony/event-dispatcher": "<5.4", + "symfony/lock": "<5.4", + "symfony/process": "<5.4" + }, + "provide": { + "psr/log-implementation": "1.0|2.0|3.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/event-dispatcher": "^5.4|^6.0|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/lock": "^5.4|^6.0|^7.0", + "symfony/messenger": "^5.4|^6.0|^7.0", + "symfony/process": "^5.4|^6.0|^7.0", + "symfony/stopwatch": "^5.4|^6.0|^7.0", + "symfony/var-dumper": "^5.4|^6.0|^7.0" + }, + "time": "2024-08-15T22:48:29+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command-line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v6.4.11" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/console" + }, + { + "name": "symfony/css-selector", + "version": "v6.4.8", + "version_normalized": "6.4.8.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/css-selector.git", + "reference": "4b61b02fe15db48e3687ce1c45ea385d1780fe08" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/4b61b02fe15db48e3687ce1c45ea385d1780fe08", + "reference": "4b61b02fe15db48e3687ce1c45ea385d1780fe08", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "time": "2024-05-31T14:49:08+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\CssSelector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Converts CSS selectors to XPath expressions", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/css-selector/tree/v6.4.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/css-selector" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.5.0", + "version_normalized": "3.5.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "time": "2024-04-18T09:32:20+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/deprecation-contracts" + }, + { + "name": "symfony/error-handler", + "version": "v6.4.10", + "version_normalized": "6.4.10.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/error-handler.git", + "reference": "231f1b2ee80f72daa1972f7340297d67439224f0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/231f1b2ee80f72daa1972f7340297d67439224f0", + "reference": "231f1b2ee80f72daa1972f7340297d67439224f0", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/log": "^1|^2|^3", + "symfony/var-dumper": "^5.4|^6.0|^7.0" + }, + "conflict": { + "symfony/deprecation-contracts": "<2.5", + "symfony/http-kernel": "<6.4" + }, + "require-dev": { + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/serializer": "^5.4|^6.0|^7.0" + }, + "time": "2024-07-26T12:30:32+00:00", + "bin": [ + "Resources/bin/patch-type-declarations" + ], + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\ErrorHandler\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides tools to manage errors and ease debugging PHP code", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/error-handler/tree/v6.4.10" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/error-handler" + }, + { + "name": "symfony/event-dispatcher", + "version": "v6.4.8", + "version_normalized": "6.4.8.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "8d7507f02b06e06815e56bb39aa0128e3806208b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/8d7507f02b06e06815e56bb39aa0128e3806208b", + "reference": "8d7507f02b06e06815e56bb39aa0128e3806208b", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/event-dispatcher-contracts": "^2.5|^3" + }, + "conflict": { + "symfony/dependency-injection": "<5.4", + "symfony/service-contracts": "<2.5" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "2.0|3.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/error-handler": "^5.4|^6.0|^7.0", + "symfony/expression-language": "^5.4|^6.0|^7.0", + "symfony/http-foundation": "^5.4|^6.0|^7.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/stopwatch": "^5.4|^6.0|^7.0" + }, + "time": "2024-05-31T14:49:08+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/event-dispatcher/tree/v6.4.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/event-dispatcher" + }, + { + "name": "symfony/event-dispatcher-contracts", + "version": "v3.5.0", + "version_normalized": "3.5.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "8f93aec25d41b72493c6ddff14e916177c9efc50" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/8f93aec25d41b72493c6ddff14e916177c9efc50", + "reference": "8f93aec25d41b72493c6ddff14e916177c9efc50", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/event-dispatcher": "^1" + }, + "time": "2024-04-18T09:32:20+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Contracts\\EventDispatcher\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to dispatching event", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.5.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/event-dispatcher-contracts" + }, + { + "name": "symfony/finder", + "version": "v6.4.11", + "version_normalized": "6.4.11.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "d7eb6daf8cd7e9ac4976e9576b32042ef7253453" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/d7eb6daf8cd7e9ac4976e9576b32042ef7253453", + "reference": "d7eb6daf8cd7e9ac4976e9576b32042ef7253453", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "symfony/filesystem": "^6.0|^7.0" + }, + "time": "2024-08-13T14:27:37+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Finds files and directories via an intuitive fluent interface", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/finder/tree/v6.4.11" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/finder" + }, + { + "name": "symfony/http-foundation", + "version": "v6.4.10", + "version_normalized": "6.4.10.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "117f1f20a7ade7bcea28b861fb79160a21a1e37b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/117f1f20a7ade7bcea28b861fb79160a21a1e37b", + "reference": "117f1f20a7ade7bcea28b861fb79160a21a1e37b", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php83": "^1.27" + }, + "conflict": { + "symfony/cache": "<6.3" + }, + "require-dev": { + "doctrine/dbal": "^2.13.1|^3|^4", + "predis/predis": "^1.1|^2.0", + "symfony/cache": "^6.3|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/expression-language": "^5.4|^6.0|^7.0", + "symfony/http-kernel": "^5.4.12|^6.0.12|^6.1.4|^7.0", + "symfony/mime": "^5.4|^6.0|^7.0", + "symfony/rate-limiter": "^5.4|^6.0|^7.0" + }, + "time": "2024-07-26T12:36:27+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpFoundation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Defines an object-oriented layer for the HTTP specification", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/http-foundation/tree/v6.4.10" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/http-foundation" + }, + { + "name": "symfony/http-kernel", + "version": "v6.4.11", + "version_normalized": "6.4.11.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-kernel.git", + "reference": "1ba6b89d781cb47448155cc70dd2e0f1b0584c79" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/1ba6b89d781cb47448155cc70dd2e0f1b0584c79", + "reference": "1ba6b89d781cb47448155cc70dd2e0f1b0584c79", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/log": "^1|^2|^3", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/error-handler": "^6.4|^7.0", + "symfony/event-dispatcher": "^5.4|^6.0|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "symfony/browser-kit": "<5.4", + "symfony/cache": "<5.4", + "symfony/config": "<6.1", + "symfony/console": "<5.4", + "symfony/dependency-injection": "<6.4", + "symfony/doctrine-bridge": "<5.4", + "symfony/form": "<5.4", + "symfony/http-client": "<5.4", + "symfony/http-client-contracts": "<2.5", + "symfony/mailer": "<5.4", + "symfony/messenger": "<5.4", + "symfony/translation": "<5.4", + "symfony/translation-contracts": "<2.5", + "symfony/twig-bridge": "<5.4", + "symfony/validator": "<6.4", + "symfony/var-dumper": "<6.3", + "twig/twig": "<2.13" + }, + "provide": { + "psr/log-implementation": "1.0|2.0|3.0" + }, + "require-dev": { + "psr/cache": "^1.0|^2.0|^3.0", + "symfony/browser-kit": "^5.4|^6.0|^7.0", + "symfony/clock": "^6.2|^7.0", + "symfony/config": "^6.1|^7.0", + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/css-selector": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/dom-crawler": "^5.4|^6.0|^7.0", + "symfony/expression-language": "^5.4|^6.0|^7.0", + "symfony/finder": "^5.4|^6.0|^7.0", + "symfony/http-client-contracts": "^2.5|^3", + "symfony/process": "^5.4|^6.0|^7.0", + "symfony/property-access": "^5.4.5|^6.0.5|^7.0", + "symfony/routing": "^5.4|^6.0|^7.0", + "symfony/serializer": "^6.4.4|^7.0.4", + "symfony/stopwatch": "^5.4|^6.0|^7.0", + "symfony/translation": "^5.4|^6.0|^7.0", + "symfony/translation-contracts": "^2.5|^3", + "symfony/uid": "^5.4|^6.0|^7.0", + "symfony/validator": "^6.4|^7.0", + "symfony/var-dumper": "^5.4|^6.4|^7.0", + "symfony/var-exporter": "^6.2|^7.0", + "twig/twig": "^2.13|^3.0.4" + }, + "time": "2024-08-30T16:57:20+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpKernel\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides a structured process for converting a Request into a Response", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/http-kernel/tree/v6.4.11" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/http-kernel" + }, + { + "name": "symfony/mime", + "version": "v6.4.11", + "version_normalized": "6.4.11.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/mime.git", + "reference": "dba5d5f6073baf7a3576b580cc4a208b4ca00553" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/mime/zipball/dba5d5f6073baf7a3576b580cc4a208b4ca00553", + "reference": "dba5d5f6073baf7a3576b580cc4a208b4ca00553", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-intl-idn": "^1.10", + "symfony/polyfill-mbstring": "^1.0" + }, + "conflict": { + "egulias/email-validator": "~3.0.0", + "phpdocumentor/reflection-docblock": "<3.2.2", + "phpdocumentor/type-resolver": "<1.4.0", + "symfony/mailer": "<5.4", + "symfony/serializer": "<6.4.3|>7.0,<7.0.3" + }, + "require-dev": { + "egulias/email-validator": "^2.1.10|^3.1|^4", + "league/html-to-markdown": "^5.0", + "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/process": "^5.4|^6.4|^7.0", + "symfony/property-access": "^5.4|^6.0|^7.0", + "symfony/property-info": "^5.4|^6.0|^7.0", + "symfony/serializer": "^6.4.3|^7.0.3" + }, + "time": "2024-08-13T12:15:02+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Mime\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Allows manipulating MIME messages", + "homepage": "https://symfony.com", + "keywords": [ + "mime", + "mime-type" + ], + "support": { + "source": "https://github.com/symfony/mime/tree/v6.4.11" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/mime" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.30.0", + "version_normalized": "1.30.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "0424dff1c58f028c451efff2045f5d92410bd540" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/0424dff1c58f028c451efff2045f5d92410bd540", + "reference": "0424dff1c58f028c451efff2045f5d92410bd540", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "time": "2024-05-31T15:07:36+00:00", + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.30.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/polyfill-ctype" + }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.30.0", + "version_normalized": "1.30.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/64647a7c30b2283f5d49b874d84a18fc22054b7a", + "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "time": "2024-05-31T15:07:36+00:00", + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.30.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/polyfill-intl-grapheme" + }, + { + "name": "symfony/polyfill-intl-idn", + "version": "v1.30.0", + "version_normalized": "1.30.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-idn.git", + "reference": "a6e83bdeb3c84391d1dfe16f42e40727ce524a5c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/a6e83bdeb3c84391d1dfe16f42e40727ce524a5c", + "reference": "a6e83bdeb3c84391d1dfe16f42e40727ce524a5c", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "symfony/polyfill-intl-normalizer": "^1.10", + "symfony/polyfill-php72": "^1.10" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "time": "2024-05-31T15:07:36+00:00", + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Idn\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Laurent Bassin", + "email": "laurent@bassin.info" + }, + { + "name": "Trevor Rowbotham", + "email": "trevor.rowbotham@pm.me" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "idn", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.30.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/polyfill-intl-idn" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.30.0", + "version_normalized": "1.30.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/a95281b0be0d9ab48050ebd988b967875cdb9fdb", + "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "time": "2024-05-31T15:07:36+00:00", + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.30.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/polyfill-intl-normalizer" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.30.0", + "version_normalized": "1.30.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c", + "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "time": "2024-06-19T12:30:46+00:00", + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/polyfill-mbstring" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.30.0", + "version_normalized": "1.30.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "10112722600777e02d2745716b70c5db4ca70442" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/10112722600777e02d2745716b70c5db4ca70442", + "reference": "10112722600777e02d2745716b70c5db4ca70442", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "time": "2024-06-19T12:30:46+00:00", + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php72/tree/v1.30.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/polyfill-php72" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.30.0", + "version_normalized": "1.30.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "ec444d3f3f6505bb28d11afa41e75faadebc10a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/ec444d3f3f6505bb28d11afa41e75faadebc10a1", + "reference": "ec444d3f3f6505bb28d11afa41e75faadebc10a1", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "time": "2024-05-31T15:07:36+00:00", + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.30.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/polyfill-php73" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.30.0", + "version_normalized": "1.30.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "77fa7995ac1b21ab60769b7323d600a991a90433" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/77fa7995ac1b21ab60769b7323d600a991a90433", + "reference": "77fa7995ac1b21ab60769b7323d600a991a90433", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "time": "2024-05-31T15:07:36+00:00", + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/polyfill-php80" + }, + { + "name": "symfony/polyfill-php83", + "version": "v1.30.0", + "version_normalized": "1.30.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php83.git", + "reference": "dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9", + "reference": "dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "time": "2024-06-19T12:35:24+00:00", + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php83\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php83/tree/v1.30.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/polyfill-php83" + }, + { + "name": "symfony/property-access", + "version": "v6.4.11", + "version_normalized": "6.4.11.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/property-access.git", + "reference": "866f6cd84f2094cbc6f66ce9752faf749916e2a9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/property-access/zipball/866f6cd84f2094cbc6f66ce9752faf749916e2a9", + "reference": "866f6cd84f2094cbc6f66ce9752faf749916e2a9", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/property-info": "^5.4|^6.0|^7.0" + }, + "require-dev": { + "symfony/cache": "^5.4|^6.0|^7.0" + }, + "time": "2024-08-30T16:10:11+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\PropertyAccess\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides functions to read and write from/to an object or array using a simple string notation", + "homepage": "https://symfony.com", + "keywords": [ + "access", + "array", + "extraction", + "index", + "injection", + "object", + "property", + "property-path", + "reflection" + ], + "support": { + "source": "https://github.com/symfony/property-access/tree/v6.4.11" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/property-access" + }, + { + "name": "symfony/property-info", + "version": "v6.4.10", + "version_normalized": "6.4.10.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/property-info.git", + "reference": "edaea9dcc723cb4a0ab6a00f7d6f8c07c0d8ff77" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/property-info/zipball/edaea9dcc723cb4a0ab6a00f7d6f8c07c0d8ff77", + "reference": "edaea9dcc723cb4a0ab6a00f7d6f8c07c0d8ff77", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/string": "^5.4|^6.0|^7.0" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "<5.2", + "phpdocumentor/type-resolver": "<1.5.1", + "symfony/dependency-injection": "<5.4", + "symfony/serializer": "<6.4" + }, + "require-dev": { + "phpdocumentor/reflection-docblock": "^5.2", + "phpstan/phpdoc-parser": "^1.0", + "symfony/cache": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/serializer": "^6.4|^7.0" + }, + "time": "2024-07-26T07:32:07+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\PropertyInfo\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kévin Dunglas", + "email": "dunglas@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Extracts information about PHP class' properties using metadata of popular sources", + "homepage": "https://symfony.com", + "keywords": [ + "doctrine", + "phpdoc", + "property", + "symfony", + "type", + "validator" + ], + "support": { + "source": "https://github.com/symfony/property-info/tree/v6.4.10" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/property-info" + }, + { + "name": "symfony/routing", + "version": "v6.4.11", + "version_normalized": "6.4.11.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/routing.git", + "reference": "8ee0c24c1bf61c263a26f1b9b6d19e83b1121f2a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/routing/zipball/8ee0c24c1bf61c263a26f1b9b6d19e83b1121f2a", + "reference": "8ee0c24c1bf61c263a26f1b9b6d19e83b1121f2a", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3" + }, + "conflict": { + "doctrine/annotations": "<1.12", + "symfony/config": "<6.2", + "symfony/dependency-injection": "<5.4", + "symfony/yaml": "<5.4" + }, + "require-dev": { + "doctrine/annotations": "^1.12|^2", + "psr/log": "^1|^2|^3", + "symfony/config": "^6.2|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/expression-language": "^5.4|^6.0|^7.0", + "symfony/http-foundation": "^5.4|^6.0|^7.0", + "symfony/yaml": "^5.4|^6.0|^7.0" + }, + "time": "2024-08-29T08:15:38+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Routing\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Maps an HTTP request to a set of configuration variables", + "homepage": "https://symfony.com", + "keywords": [ + "router", + "routing", + "uri", + "url" + ], + "support": { + "source": "https://github.com/symfony/routing/tree/v6.4.11" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/routing" + }, + { + "name": "symfony/serializer", + "version": "v6.4.11", + "version_normalized": "6.4.11.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/serializer.git", + "reference": "a75d03d7720417f8a654e73e8f02acdea8779cd0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/serializer/zipball/a75d03d7720417f8a654e73e8f02acdea8779cd0", + "reference": "a75d03d7720417f8a654e73e8f02acdea8779cd0", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "doctrine/annotations": "<1.12", + "phpdocumentor/reflection-docblock": "<3.2.2", + "phpdocumentor/type-resolver": "<1.4.0", + "symfony/dependency-injection": "<5.4", + "symfony/property-access": "<5.4", + "symfony/property-info": "<5.4.24|>=6,<6.2.11", + "symfony/uid": "<5.4", + "symfony/validator": "<6.4", + "symfony/yaml": "<5.4" + }, + "require-dev": { + "doctrine/annotations": "^1.12|^2", + "phpdocumentor/reflection-docblock": "^3.2|^4.0|^5.0", + "seld/jsonlint": "^1.10", + "symfony/cache": "^5.4|^6.0|^7.0", + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/error-handler": "^5.4|^6.0|^7.0", + "symfony/filesystem": "^5.4|^6.0|^7.0", + "symfony/form": "^5.4|^6.0|^7.0", + "symfony/http-foundation": "^5.4|^6.0|^7.0", + "symfony/http-kernel": "^5.4|^6.0|^7.0", + "symfony/messenger": "^5.4|^6.0|^7.0", + "symfony/mime": "^5.4|^6.0|^7.0", + "symfony/property-access": "^5.4.26|^6.3|^7.0", + "symfony/property-info": "^5.4.24|^6.2.11|^7.0", + "symfony/translation-contracts": "^2.5|^3", + "symfony/uid": "^5.4|^6.0|^7.0", + "symfony/validator": "^6.4|^7.0", + "symfony/var-dumper": "^5.4|^6.0|^7.0", + "symfony/var-exporter": "^5.4|^6.0|^7.0", + "symfony/yaml": "^5.4|^6.0|^7.0" + }, + "time": "2024-08-17T07:51:47+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Serializer\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/serializer/tree/v6.4.11" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/serializer" + }, + { + "name": "symfony/service-contracts", + "version": "v3.5.0", + "version_normalized": "3.5.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", + "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.5|^3" + }, + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "time": "2024-04-18T09:32:20+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + }, + "exclude-from-classmap": [ + "/Test/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v3.5.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/service-contracts" + }, + { + "name": "symfony/string", + "version": "v6.4.11", + "version_normalized": "6.4.11.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "5bc3eb632cf9c8dbfd6529d89be9950d1518883b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/5bc3eb632cf9c8dbfd6529d89be9950d1518883b", + "reference": "5bc3eb632cf9c8dbfd6529d89be9950d1518883b", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/translation-contracts": "<2.5" + }, + "require-dev": { + "symfony/error-handler": "^5.4|^6.0|^7.0", + "symfony/http-client": "^5.4|^6.0|^7.0", + "symfony/intl": "^6.2|^7.0", + "symfony/translation-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^5.4|^6.0|^7.0" + }, + "time": "2024-08-12T09:55:28+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v6.4.11" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/string" + }, + { + "name": "symfony/translation", + "version": "v6.4.10", + "version_normalized": "6.4.10.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation.git", + "reference": "94041203f8ac200ae9e7c6a18fa6137814ccecc9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation/zipball/94041203f8ac200ae9e7c6a18fa6137814ccecc9", + "reference": "94041203f8ac200ae9e7c6a18fa6137814ccecc9", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/translation-contracts": "^2.5|^3.0" + }, + "conflict": { + "symfony/config": "<5.4", + "symfony/console": "<5.4", + "symfony/dependency-injection": "<5.4", + "symfony/http-client-contracts": "<2.5", + "symfony/http-kernel": "<5.4", + "symfony/service-contracts": "<2.5", + "symfony/twig-bundle": "<5.4", + "symfony/yaml": "<5.4" + }, + "provide": { + "symfony/translation-implementation": "2.3|3.0" + }, + "require-dev": { + "nikic/php-parser": "^4.18|^5.0", + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/finder": "^5.4|^6.0|^7.0", + "symfony/http-client-contracts": "^2.5|^3.0", + "symfony/http-kernel": "^5.4|^6.0|^7.0", + "symfony/intl": "^5.4|^6.0|^7.0", + "symfony/polyfill-intl-icu": "^1.21", + "symfony/routing": "^5.4|^6.0|^7.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/yaml": "^5.4|^6.0|^7.0" + }, + "time": "2024-07-26T12:30:32+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\Translation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides tools to internationalize your application", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/translation/tree/v6.4.10" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/translation" + }, + { + "name": "symfony/translation-contracts", + "version": "v3.5.0", + "version_normalized": "3.5.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation-contracts.git", + "reference": "b9d2189887bb6b2e0367a9fc7136c5239ab9b05a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/b9d2189887bb6b2e0367a9fc7136c5239ab9b05a", + "reference": "b9d2189887bb6b2e0367a9fc7136c5239ab9b05a", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "time": "2024-04-18T09:32:20+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Translation\\": "" + }, + "exclude-from-classmap": [ + "/Test/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to translation", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/translation-contracts/tree/v3.5.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/translation-contracts" + }, + { + "name": "symfony/var-dumper", + "version": "v6.4.11", + "version_normalized": "6.4.11.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "ee14c8254a480913268b1e3b1cba8045ed122694" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/ee14c8254a480913268b1e3b1cba8045ed122694", + "reference": "ee14c8254a480913268b1e3b1cba8045ed122694", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/console": "<5.4" + }, + "require-dev": { + "ext-iconv": "*", + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/error-handler": "^6.3|^7.0", + "symfony/http-kernel": "^5.4|^6.0|^7.0", + "symfony/process": "^5.4|^6.0|^7.0", + "symfony/uid": "^5.4|^6.0|^7.0", + "twig/twig": "^2.13|^3.0.4" + }, + "time": "2024-08-30T16:03:21+00:00", + "bin": [ + "Resources/bin/var-dump-server" + ], + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "Resources/functions/dump.php" + ], + "psr-4": { + "Symfony\\Component\\VarDumper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides mechanisms for walking through any arbitrary PHP variable", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ], + "support": { + "source": "https://github.com/symfony/var-dumper/tree/v6.4.11" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/var-dumper" + }, + { + "name": "symfony/yaml", + "version": "v6.4.11", + "version_normalized": "6.4.11.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "be37e7f13195e05ab84ca5269365591edd240335" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/be37e7f13195e05ab84ca5269365591edd240335", + "reference": "be37e7f13195e05ab84ca5269365591edd240335", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "symfony/console": "<5.4" + }, + "require-dev": { + "symfony/console": "^5.4|^6.0|^7.0" + }, + "time": "2024-08-12T09:55:28+00:00", + "bin": [ + "Resources/bin/yaml-lint" + ], + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Loads and dumps YAML files", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/yaml/tree/v6.4.11" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/yaml" + }, + { + "name": "szepeviktor/phpstan-wordpress", + "version": "v1.3.5", + "version_normalized": "1.3.5.0", + "source": { + "type": "git", + "url": "https://github.com/szepeviktor/phpstan-wordpress.git", + "reference": "7f8cfe992faa96b6a33bbd75c7bace98864161e7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/7f8cfe992faa96b6a33bbd75c7bace98864161e7", + "reference": "7f8cfe992faa96b6a33bbd75c7bace98864161e7", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "php-stubs/wordpress-stubs": "^4.7 || ^5.0 || ^6.0", + "phpstan/phpstan": "^1.10.31", + "symfony/polyfill-php73": "^1.12.0" + }, + "require-dev": { + "composer/composer": "^2.1.14", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.1", + "phpstan/phpstan-strict-rules": "^1.2", + "phpunit/phpunit": "^8.0 || ^9.0", + "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^1.0", + "wp-coding-standards/wpcs": "3.1.0 as 2.3.0" + }, + "suggest": { + "swissspidy/phpstan-no-private": "Detect usage of internal core functions, classes and methods" + }, + "time": "2024-06-28T22:27:19+00:00", + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "SzepeViktor\\PHPStan\\WordPress\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "WordPress extensions for PHPStan", + "keywords": [ + "PHPStan", + "code analyse", + "code analysis", + "static analysis", + "wordpress" + ], + "support": { + "issues": "https://github.com/szepeviktor/phpstan-wordpress/issues", + "source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v1.3.5" + }, + "install-path": "../szepeviktor/phpstan-wordpress" + }, + { + "name": "theseer/tokenizer", + "version": "1.2.3", + "version_normalized": "1.2.3.0", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "time": "2024-03-03T12:36:25+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.2.3" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "install-path": "../theseer/tokenizer" + }, + { + "name": "voku/portable-ascii", + "version": "2.0.1", + "version_normalized": "2.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/voku/portable-ascii.git", + "reference": "b56450eed252f6801410d810c8e1727224ae0743" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/voku/portable-ascii/zipball/b56450eed252f6801410d810c8e1727224ae0743", + "reference": "b56450eed252f6801410d810c8e1727224ae0743", + "shasum": "" + }, + "require": { + "php": ">=7.0.0" + }, + "require-dev": { + "phpunit/phpunit": "~6.0 || ~7.0 || ~9.0" + }, + "suggest": { + "ext-intl": "Use Intl for transliterator_transliterate() support" + }, + "time": "2022-03-08T17:03:00+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "voku\\": "src/voku/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Lars Moelleken", + "homepage": "http://www.moelleken.org/" + } + ], + "description": "Portable ASCII library - performance optimized (ascii) string functions for php.", + "homepage": "https://github.com/voku/portable-ascii", + "keywords": [ + "ascii", + "clean", + "php" + ], + "support": { + "issues": "https://github.com/voku/portable-ascii/issues", + "source": "https://github.com/voku/portable-ascii/tree/2.0.1" + }, + "funding": [ + { + "url": "https://www.paypal.me/moelleken", + "type": "custom" + }, + { + "url": "https://github.com/voku", + "type": "github" + }, + { + "url": "https://opencollective.com/portable-ascii", + "type": "open_collective" + }, + { + "url": "https://www.patreon.com/voku", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/voku/portable-ascii", + "type": "tidelift" + } + ], + "install-path": "../voku/portable-ascii" + }, + { + "name": "wp-coding-standards/wpcs", + "version": "3.1.0", + "version_normalized": "3.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", + "reference": "9333efcbff231f10dfd9c56bb7b65818b4733ca7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/9333efcbff231f10dfd9c56bb7b65818b4733ca7", + "reference": "9333efcbff231f10dfd9c56bb7b65818b4733ca7", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "ext-libxml": "*", + "ext-tokenizer": "*", + "ext-xmlreader": "*", + "php": ">=5.4", + "phpcsstandards/phpcsextra": "^1.2.1", + "phpcsstandards/phpcsutils": "^1.0.10", + "squizlabs/php_codesniffer": "^3.9.0" + }, + "require-dev": { + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcompatibility/php-compatibility": "^9.0", + "phpcsstandards/phpcsdevtools": "^1.2.0", + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "suggest": { + "ext-iconv": "For improved results", + "ext-mbstring": "For improved results" + }, + "time": "2024-03-25T16:39:00+00:00", + "type": "phpcodesniffer-standard", + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Contributors", + "homepage": "https://github.com/WordPress/WordPress-Coding-Standards/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions", + "keywords": [ + "phpcs", + "standards", + "static analysis", + "wordpress" + ], + "support": { + "issues": "https://github.com/WordPress/WordPress-Coding-Standards/issues", + "source": "https://github.com/WordPress/WordPress-Coding-Standards", + "wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki" + }, + "funding": [ + { + "url": "https://opencollective.com/php_codesniffer", + "type": "custom" + } + ], + "install-path": "../wp-coding-standards/wpcs" + } + ], + "dev": true, + "dev-package-names": [ + "alleyinteractive/alley-coding-standards", + "alleyinteractive/wp-concurrent-remote-requests", + "alleyinteractive/wp-filter-side-effects", + "automattic/vipwpcs", + "brick/math", + "carbonphp/carbon-doctrine-types", + "dealerdirect/phpcodesniffer-composer-installer", + "dflydev/dot-access-data", + "doctrine/inflector", + "fakerphp/faker", + "filp/whoops", + "league/commonmark", + "league/config", + "league/flysystem", + "league/flysystem-cached-adapter", + "league/mime-type-detection", + "mantle-framework/config", + "mantle-framework/container", + "mantle-framework/contracts", + "mantle-framework/database", + "mantle-framework/events", + "mantle-framework/faker", + "mantle-framework/filesystem", + "mantle-framework/http", + "mantle-framework/http-client", + "mantle-framework/support", + "mantle-framework/testing", + "mantle-framework/testkit", + "monolog/monolog", + "myclabs/deep-copy", + "nesbot/carbon", + "nette/schema", + "nette/utils", + "nikic/php-parser", + "nunomaduro/collision", + "nunomaduro/termwind", + "phar-io/manifest", + "phar-io/version", + "php-stubs/wordpress-stubs", + "phpcompatibility/php-compatibility", + "phpcompatibility/phpcompatibility-paragonie", + "phpcompatibility/phpcompatibility-wp", + "phpcsstandards/phpcsextra", + "phpcsstandards/phpcsutils", + "phpstan/phpstan", + "phpunit/php-code-coverage", + "phpunit/php-file-iterator", + "phpunit/php-invoker", + "phpunit/php-text-template", + "phpunit/php-timer", + "phpunit/phpunit", + "psr/cache", + "psr/clock", + "psr/event-dispatcher", + "psr/log", + "ramsey/collection", + "ramsey/uuid", + "sebastian/cli-parser", + "sebastian/code-unit", + "sebastian/code-unit-reverse-lookup", + "sebastian/comparator", + "sebastian/complexity", + "sebastian/diff", + "sebastian/environment", + "sebastian/exporter", + "sebastian/global-state", + "sebastian/lines-of-code", + "sebastian/object-enumerator", + "sebastian/object-reflector", + "sebastian/recursion-context", + "sebastian/type", + "sebastian/version", + "sirbrillig/phpcs-variable-analysis", + "spatie/phpunit-snapshot-assertions", + "squizlabs/php_codesniffer", + "symfony/console", + "symfony/css-selector", + "symfony/deprecation-contracts", + "symfony/error-handler", + "symfony/event-dispatcher", + "symfony/event-dispatcher-contracts", + "symfony/finder", + "symfony/http-foundation", + "symfony/http-kernel", + "symfony/mime", + "symfony/polyfill-ctype", + "symfony/polyfill-intl-grapheme", + "symfony/polyfill-intl-idn", + "symfony/polyfill-intl-normalizer", + "symfony/polyfill-mbstring", + "symfony/polyfill-php72", + "symfony/polyfill-php73", + "symfony/polyfill-php80", + "symfony/polyfill-php83", + "symfony/property-access", + "symfony/property-info", + "symfony/routing", + "symfony/serializer", + "symfony/service-contracts", + "symfony/string", + "symfony/translation", + "symfony/translation-contracts", + "symfony/var-dumper", + "symfony/yaml", + "szepeviktor/phpstan-wordpress", + "theseer/tokenizer", + "voku/portable-ascii", + "wp-coding-standards/wpcs" + ] +} diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php new file mode 100644 index 00000000..04fa5777 --- /dev/null +++ b/vendor/composer/installed.php @@ -0,0 +1,1144 @@ + array( + 'name' => 'alleyinteractive/create-wordpress-plugin', + 'pretty_version' => 'dev-main', + 'version' => 'dev-main', + 'reference' => '8ea646a34efac65e9a3cdb2b8cf89f99218a25fb', + 'type' => 'wordpress-plugin', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'dev' => true, + ), + 'versions' => array( + 'alleyinteractive/alley-coding-standards' => array( + 'pretty_version' => 'v2.1.0', + 'version' => '2.1.0.0', + 'reference' => '242b93f2608486789dd9b156db5960fd34cef50d', + 'type' => 'phpcodesniffer-standard', + 'install_path' => __DIR__ . '/../alleyinteractive/alley-coding-standards', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'alleyinteractive/composer-wordpress-autoloader' => array( + 'pretty_version' => 'v1.1.0', + 'version' => '1.1.0.0', + 'reference' => '30acf9e3498a84af478e316ae3869fa362835695', + 'type' => 'composer-plugin', + 'install_path' => __DIR__ . '/../alleyinteractive/composer-wordpress-autoloader', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'alleyinteractive/create-wordpress-plugin' => array( + 'pretty_version' => 'dev-main', + 'version' => 'dev-main', + 'reference' => '8ea646a34efac65e9a3cdb2b8cf89f99218a25fb', + 'type' => 'wordpress-plugin', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'alleyinteractive/laminas-validator-extensions' => array( + 'pretty_version' => 'v2.1.1', + 'version' => '2.1.1.0', + 'reference' => '09fd68d1fda5179d5e972cf7053edf4eab903313', + 'type' => 'library', + 'install_path' => __DIR__ . '/../alleyinteractive/laminas-validator-extensions', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'alleyinteractive/wordpress-autoloader' => array( + 'pretty_version' => 'v1.1.1', + 'version' => '1.1.1.0', + 'reference' => 'c7599d95f49f1cdc38fad19944a50b19ec0dd6ca', + 'type' => 'library', + 'install_path' => __DIR__ . '/../alleyinteractive/wordpress-autoloader', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'alleyinteractive/wp-concurrent-remote-requests' => array( + 'pretty_version' => 'v1.0.2', + 'version' => '1.0.2.0', + 'reference' => '404301c975989958e8086542d56df847ae3aacc2', + 'type' => 'library', + 'install_path' => __DIR__ . '/../alleyinteractive/wp-concurrent-remote-requests', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'alleyinteractive/wp-filter-side-effects' => array( + 'pretty_version' => 'v2.0.0', + 'version' => '2.0.0.0', + 'reference' => '3107f336e7079782e4d16a9361b512c7d569a780', + 'type' => 'library', + 'install_path' => __DIR__ . '/../alleyinteractive/wp-filter-side-effects', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'alleyinteractive/wp-match-blocks' => array( + 'pretty_version' => 'v3.1.0', + 'version' => '3.1.0.0', + 'reference' => '1fa48dc7059653df7ac46ec1fad05e36da236578', + 'type' => 'library', + 'install_path' => __DIR__ . '/../alleyinteractive/wp-match-blocks', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'alleyinteractive/wp-type-extensions' => array( + 'pretty_version' => 'v2.2.0', + 'version' => '2.2.0.0', + 'reference' => '5a225b53fc8336193a6b2ed71e610d8c5b57d200', + 'type' => 'library', + 'install_path' => __DIR__ . '/../alleyinteractive/wp-type-extensions', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'automattic/vipwpcs' => array( + 'pretty_version' => '3.0.1', + 'version' => '3.0.1.0', + 'reference' => '2b1d206d81b74ed999023cffd924f862ff2753c8', + 'type' => 'phpcodesniffer-standard', + 'install_path' => __DIR__ . '/../automattic/vipwpcs', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'brick/math' => array( + 'pretty_version' => '0.12.1', + 'version' => '0.12.1.0', + 'reference' => 'f510c0a40911935b77b86859eb5223d58d660df1', + 'type' => 'library', + 'install_path' => __DIR__ . '/../brick/math', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'carbonphp/carbon-doctrine-types' => array( + 'pretty_version' => '3.2.0', + 'version' => '3.2.0.0', + 'reference' => '18ba5ddfec8976260ead6e866180bd5d2f71aa1d', + 'type' => 'library', + 'install_path' => __DIR__ . '/../carbonphp/carbon-doctrine-types', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'container-interop/container-interop' => array( + 'dev_requirement' => false, + 'replaced' => array( + 0 => '^1.2.0', + ), + ), + 'dealerdirect/phpcodesniffer-composer-installer' => array( + 'pretty_version' => 'v1.0.0', + 'version' => '1.0.0.0', + 'reference' => '4be43904336affa5c2f70744a348312336afd0da', + 'type' => 'composer-plugin', + 'install_path' => __DIR__ . '/../dealerdirect/phpcodesniffer-composer-installer', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'dflydev/dot-access-data' => array( + 'pretty_version' => 'v3.0.3', + 'version' => '3.0.3.0', + 'reference' => 'a23a2bf4f31d3518f3ecb38660c95715dfead60f', + 'type' => 'library', + 'install_path' => __DIR__ . '/../dflydev/dot-access-data', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'doctrine/inflector' => array( + 'pretty_version' => '2.0.10', + 'version' => '2.0.10.0', + 'reference' => '5817d0659c5b50c9b950feb9af7b9668e2c436bc', + 'type' => 'library', + 'install_path' => __DIR__ . '/../doctrine/inflector', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'fakerphp/faker' => array( + 'pretty_version' => 'v1.23.1', + 'version' => '1.23.1.0', + 'reference' => 'bfb4fe148adbf78eff521199619b93a52ae3554b', + 'type' => 'library', + 'install_path' => __DIR__ . '/../fakerphp/faker', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'filp/whoops' => array( + 'pretty_version' => '2.15.4', + 'version' => '2.15.4.0', + 'reference' => 'a139776fa3f5985a50b509f2a02ff0f709d2a546', + 'type' => 'library', + 'install_path' => __DIR__ . '/../filp/whoops', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'laminas/laminas-servicemanager' => array( + 'pretty_version' => '3.22.1', + 'version' => '3.22.1.0', + 'reference' => 'de98d297d4743956a0558a6d71616979ff779328', + 'type' => 'library', + 'install_path' => __DIR__ . '/../laminas/laminas-servicemanager', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'laminas/laminas-stdlib' => array( + 'pretty_version' => '3.19.0', + 'version' => '3.19.0.0', + 'reference' => '6a192dd0882b514e45506f533b833b623b78fff3', + 'type' => 'library', + 'install_path' => __DIR__ . '/../laminas/laminas-stdlib', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'laminas/laminas-validator' => array( + 'pretty_version' => '2.64.1', + 'version' => '2.64.1.0', + 'reference' => '9db115056b666b7540c951b6d4477b8e0b52b9ad', + 'type' => 'library', + 'install_path' => __DIR__ . '/../laminas/laminas-validator', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'league/commonmark' => array( + 'pretty_version' => '2.5.3', + 'version' => '2.5.3.0', + 'reference' => 'b650144166dfa7703e62a22e493b853b58d874b0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../league/commonmark', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'league/config' => array( + 'pretty_version' => 'v1.2.0', + 'version' => '1.2.0.0', + 'reference' => '754b3604fb2984c71f4af4a9cbe7b57f346ec1f3', + 'type' => 'library', + 'install_path' => __DIR__ . '/../league/config', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'league/flysystem' => array( + 'pretty_version' => '1.1.10', + 'version' => '1.1.10.0', + 'reference' => '3239285c825c152bcc315fe0e87d6b55f5972ed1', + 'type' => 'library', + 'install_path' => __DIR__ . '/../league/flysystem', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'league/flysystem-cached-adapter' => array( + 'pretty_version' => '1.1.0', + 'version' => '1.1.0.0', + 'reference' => 'd1925efb2207ac4be3ad0c40b8277175f99ffaff', + 'type' => 'library', + 'install_path' => __DIR__ . '/../league/flysystem-cached-adapter', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'league/mime-type-detection' => array( + 'pretty_version' => '1.15.0', + 'version' => '1.15.0.0', + 'reference' => 'ce0f4d1e8a6f4eb0ddff33f57c69c50fd09f4301', + 'type' => 'library', + 'install_path' => __DIR__ . '/../league/mime-type-detection', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'mantle-framework/config' => array( + 'pretty_version' => 'v1.1.3', + 'version' => '1.1.3.0', + 'reference' => '42475dc5a00e35b8edf6c470b4fb0521d5abe58c', + 'type' => 'library', + 'install_path' => __DIR__ . '/../mantle-framework/config', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'mantle-framework/container' => array( + 'pretty_version' => 'v1.1.3', + 'version' => '1.1.3.0', + 'reference' => '41eb9047739b50c2663fd6dea0812facbdcf6aea', + 'type' => 'library', + 'install_path' => __DIR__ . '/../mantle-framework/container', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'mantle-framework/contracts' => array( + 'pretty_version' => 'v1.1.3', + 'version' => '1.1.3.0', + 'reference' => '4a1b2fe05d5efedb1b7c2b04d24be74c1df5d85b', + 'type' => 'library', + 'install_path' => __DIR__ . '/../mantle-framework/contracts', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'mantle-framework/database' => array( + 'pretty_version' => 'v1.1.3', + 'version' => '1.1.3.0', + 'reference' => 'b6358df1a8a05568fe0c92494411b198c569addc', + 'type' => 'library', + 'install_path' => __DIR__ . '/../mantle-framework/database', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'mantle-framework/events' => array( + 'pretty_version' => 'v1.1.3', + 'version' => '1.1.3.0', + 'reference' => 'f70e94c45b5d4f74eed803a98d4c3d1001f608c1', + 'type' => 'library', + 'install_path' => __DIR__ . '/../mantle-framework/events', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'mantle-framework/faker' => array( + 'pretty_version' => 'v1.1.3', + 'version' => '1.1.3.0', + 'reference' => '20e925cf13ce03cfd216654c82d3a58cd6f04504', + 'type' => 'library', + 'install_path' => __DIR__ . '/../mantle-framework/faker', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'mantle-framework/filesystem' => array( + 'pretty_version' => 'v1.1.3', + 'version' => '1.1.3.0', + 'reference' => 'a08ed372eb22326c9a4eab969ac72b11458bf3b6', + 'type' => 'library', + 'install_path' => __DIR__ . '/../mantle-framework/filesystem', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'mantle-framework/http' => array( + 'pretty_version' => 'v1.1.3', + 'version' => '1.1.3.0', + 'reference' => '6a31136fc694d24e273fd677bb9eaed4f27611ee', + 'type' => 'library', + 'install_path' => __DIR__ . '/../mantle-framework/http', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'mantle-framework/http-client' => array( + 'pretty_version' => 'v1.1.3', + 'version' => '1.1.3.0', + 'reference' => 'ddc599adf2936e67f342964a8d6fb74e197fba84', + 'type' => 'library', + 'install_path' => __DIR__ . '/../mantle-framework/http-client', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'mantle-framework/support' => array( + 'pretty_version' => 'v1.1.3', + 'version' => '1.1.3.0', + 'reference' => 'dc27f85ee97ed6e8fd3255a5155514700cd68220', + 'type' => 'library', + 'install_path' => __DIR__ . '/../mantle-framework/support', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'mantle-framework/testing' => array( + 'pretty_version' => 'v1.1.3', + 'version' => '1.1.3.0', + 'reference' => 'a608d3ddbfe74aa4279ce2db9f3bacc30ac7486a', + 'type' => 'library', + 'install_path' => __DIR__ . '/../mantle-framework/testing', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'mantle-framework/testkit' => array( + 'pretty_version' => 'v1.1.3', + 'version' => '1.1.3.0', + 'reference' => '912e0287f7935f616818f78243a12b8e3bb9582b', + 'type' => 'library', + 'install_path' => __DIR__ . '/../mantle-framework/testkit', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'monolog/monolog' => array( + 'pretty_version' => '2.9.3', + 'version' => '2.9.3.0', + 'reference' => 'a30bfe2e142720dfa990d0a7e573997f5d884215', + 'type' => 'library', + 'install_path' => __DIR__ . '/../monolog/monolog', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'myclabs/deep-copy' => array( + 'pretty_version' => '1.12.0', + 'version' => '1.12.0.0', + 'reference' => '3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c', + 'type' => 'library', + 'install_path' => __DIR__ . '/../myclabs/deep-copy', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'nesbot/carbon' => array( + 'pretty_version' => '2.72.5', + 'version' => '2.72.5.0', + 'reference' => 'afd46589c216118ecd48ff2b95d77596af1e57ed', + 'type' => 'library', + 'install_path' => __DIR__ . '/../nesbot/carbon', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'nette/schema' => array( + 'pretty_version' => 'v1.3.0', + 'version' => '1.3.0.0', + 'reference' => 'a6d3a6d1f545f01ef38e60f375d1cf1f4de98188', + 'type' => 'library', + 'install_path' => __DIR__ . '/../nette/schema', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'nette/utils' => array( + 'pretty_version' => 'v4.0.5', + 'version' => '4.0.5.0', + 'reference' => '736c567e257dbe0fcf6ce81b4d6dbe05c6899f96', + 'type' => 'library', + 'install_path' => __DIR__ . '/../nette/utils', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'nikic/php-parser' => array( + 'pretty_version' => 'v5.1.0', + 'version' => '5.1.0.0', + 'reference' => '683130c2ff8c2739f4822ff7ac5c873ec529abd1', + 'type' => 'library', + 'install_path' => __DIR__ . '/../nikic/php-parser', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'nunomaduro/collision' => array( + 'pretty_version' => 'v7.10.0', + 'version' => '7.10.0.0', + 'reference' => '49ec67fa7b002712da8526678abd651c09f375b2', + 'type' => 'library', + 'install_path' => __DIR__ . '/../nunomaduro/collision', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'nunomaduro/termwind' => array( + 'pretty_version' => 'v1.15.1', + 'version' => '1.15.1.0', + 'reference' => '8ab0b32c8caa4a2e09700ea32925441385e4a5dc', + 'type' => 'library', + 'install_path' => __DIR__ . '/../nunomaduro/termwind', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'phar-io/manifest' => array( + 'pretty_version' => '2.0.4', + 'version' => '2.0.4.0', + 'reference' => '54750ef60c58e43759730615a392c31c80e23176', + 'type' => 'library', + 'install_path' => __DIR__ . '/../phar-io/manifest', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'phar-io/version' => array( + 'pretty_version' => '3.2.1', + 'version' => '3.2.1.0', + 'reference' => '4f7fd7836c6f332bb2933569e566a0d6c4cbed74', + 'type' => 'library', + 'install_path' => __DIR__ . '/../phar-io/version', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'php-stubs/wordpress-stubs' => array( + 'pretty_version' => 'v6.6.0', + 'version' => '6.6.0.0', + 'reference' => '86e8753e89d59849276dcdd91b9a7dd78bb4abe2', + 'type' => 'library', + 'install_path' => __DIR__ . '/../php-stubs/wordpress-stubs', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'phpcompatibility/php-compatibility' => array( + 'pretty_version' => '9.3.5', + 'version' => '9.3.5.0', + 'reference' => '9fb324479acf6f39452e0655d2429cc0d3914243', + 'type' => 'phpcodesniffer-standard', + 'install_path' => __DIR__ . '/../phpcompatibility/php-compatibility', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'phpcompatibility/phpcompatibility-paragonie' => array( + 'pretty_version' => '1.3.3', + 'version' => '1.3.3.0', + 'reference' => '293975b465e0e709b571cbf0c957c6c0a7b9a2ac', + 'type' => 'phpcodesniffer-standard', + 'install_path' => __DIR__ . '/../phpcompatibility/phpcompatibility-paragonie', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'phpcompatibility/phpcompatibility-wp' => array( + 'pretty_version' => '2.1.5', + 'version' => '2.1.5.0', + 'reference' => '01c1ff2704a58e46f0cb1ca9d06aee07b3589082', + 'type' => 'phpcodesniffer-standard', + 'install_path' => __DIR__ . '/../phpcompatibility/phpcompatibility-wp', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'phpcsstandards/phpcsextra' => array( + 'pretty_version' => '1.2.1', + 'version' => '1.2.1.0', + 'reference' => '11d387c6642b6e4acaf0bd9bf5203b8cca1ec489', + 'type' => 'phpcodesniffer-standard', + 'install_path' => __DIR__ . '/../phpcsstandards/phpcsextra', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'phpcsstandards/phpcsutils' => array( + 'pretty_version' => '1.0.12', + 'version' => '1.0.12.0', + 'reference' => '87b233b00daf83fb70f40c9a28692be017ea7c6c', + 'type' => 'phpcodesniffer-standard', + 'install_path' => __DIR__ . '/../phpcsstandards/phpcsutils', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'phpstan/phpstan' => array( + 'pretty_version' => '1.12.1', + 'version' => '1.12.1.0', + 'reference' => 'd8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2', + 'type' => 'library', + 'install_path' => __DIR__ . '/../phpstan/phpstan', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'phpunit/php-code-coverage' => array( + 'pretty_version' => '10.1.16', + 'version' => '10.1.16.0', + 'reference' => '7e308268858ed6baedc8704a304727d20bc07c77', + 'type' => 'library', + 'install_path' => __DIR__ . '/../phpunit/php-code-coverage', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'phpunit/php-file-iterator' => array( + 'pretty_version' => '4.1.0', + 'version' => '4.1.0.0', + 'reference' => 'a95037b6d9e608ba092da1b23931e537cadc3c3c', + 'type' => 'library', + 'install_path' => __DIR__ . '/../phpunit/php-file-iterator', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'phpunit/php-invoker' => array( + 'pretty_version' => '4.0.0', + 'version' => '4.0.0.0', + 'reference' => 'f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7', + 'type' => 'library', + 'install_path' => __DIR__ . '/../phpunit/php-invoker', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'phpunit/php-text-template' => array( + 'pretty_version' => '3.0.1', + 'version' => '3.0.1.0', + 'reference' => '0c7b06ff49e3d5072f057eb1fa59258bf287a748', + 'type' => 'library', + 'install_path' => __DIR__ . '/../phpunit/php-text-template', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'phpunit/php-timer' => array( + 'pretty_version' => '6.0.0', + 'version' => '6.0.0.0', + 'reference' => 'e2a2d67966e740530f4a3343fe2e030ffdc1161d', + 'type' => 'library', + 'install_path' => __DIR__ . '/../phpunit/php-timer', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'phpunit/phpunit' => array( + 'pretty_version' => '10.5.32', + 'version' => '10.5.32.0', + 'reference' => 'f069f46840445d37a4e6f0de8c5879598f9c4327', + 'type' => 'library', + 'install_path' => __DIR__ . '/../phpunit/phpunit', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'psr/cache' => array( + 'pretty_version' => '1.0.1', + 'version' => '1.0.1.0', + 'reference' => 'd11b50ad223250cf17b86e38383413f5a6764bf8', + 'type' => 'library', + 'install_path' => __DIR__ . '/../psr/cache', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'psr/clock' => array( + 'pretty_version' => '1.0.0', + 'version' => '1.0.0.0', + 'reference' => 'e41a24703d4560fd0acb709162f73b8adfc3aa0d', + 'type' => 'library', + 'install_path' => __DIR__ . '/../psr/clock', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'psr/clock-implementation' => array( + 'dev_requirement' => true, + 'provided' => array( + 0 => '1.0', + ), + ), + 'psr/container' => array( + 'pretty_version' => '1.1.2', + 'version' => '1.1.2.0', + 'reference' => '513e0666f7216c7459170d56df27dfcefe1689ea', + 'type' => 'library', + 'install_path' => __DIR__ . '/../psr/container', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'psr/container-implementation' => array( + 'dev_requirement' => false, + 'provided' => array( + 0 => '^1.0', + 1 => '1.1|2.0', + ), + ), + 'psr/event-dispatcher' => array( + 'pretty_version' => '1.0.0', + 'version' => '1.0.0.0', + 'reference' => 'dbefd12671e8a14ec7f180cab83036ed26714bb0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../psr/event-dispatcher', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'psr/event-dispatcher-implementation' => array( + 'dev_requirement' => true, + 'provided' => array( + 0 => '1.0', + ), + ), + 'psr/http-message' => array( + 'pretty_version' => '2.0', + 'version' => '2.0.0.0', + 'reference' => '402d35bcb92c70c026d1a6a9883f06b2ead23d71', + 'type' => 'library', + 'install_path' => __DIR__ . '/../psr/http-message', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'psr/log' => array( + 'pretty_version' => '3.0.1', + 'version' => '3.0.1.0', + 'reference' => '79dff0b268932c640297f5208d6298f71855c03e', + 'type' => 'library', + 'install_path' => __DIR__ . '/../psr/log', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'psr/log-implementation' => array( + 'dev_requirement' => true, + 'provided' => array( + 0 => '1.0.0 || 2.0.0 || 3.0.0', + 1 => '1.0|2.0|3.0', + ), + ), + 'ramsey/collection' => array( + 'pretty_version' => '2.0.0', + 'version' => '2.0.0.0', + 'reference' => 'a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5', + 'type' => 'library', + 'install_path' => __DIR__ . '/../ramsey/collection', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'ramsey/uuid' => array( + 'pretty_version' => '4.7.6', + 'version' => '4.7.6.0', + 'reference' => '91039bc1faa45ba123c4328958e620d382ec7088', + 'type' => 'library', + 'install_path' => __DIR__ . '/../ramsey/uuid', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'rhumsaa/uuid' => array( + 'dev_requirement' => true, + 'replaced' => array( + 0 => '4.7.6', + ), + ), + 'sebastian/cli-parser' => array( + 'pretty_version' => '2.0.1', + 'version' => '2.0.1.0', + 'reference' => 'c34583b87e7b7a8055bf6c450c2c77ce32a24084', + 'type' => 'library', + 'install_path' => __DIR__ . '/../sebastian/cli-parser', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'sebastian/code-unit' => array( + 'pretty_version' => '2.0.0', + 'version' => '2.0.0.0', + 'reference' => 'a81fee9eef0b7a76af11d121767abc44c104e503', + 'type' => 'library', + 'install_path' => __DIR__ . '/../sebastian/code-unit', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'sebastian/code-unit-reverse-lookup' => array( + 'pretty_version' => '3.0.0', + 'version' => '3.0.0.0', + 'reference' => '5e3a687f7d8ae33fb362c5c0743794bbb2420a1d', + 'type' => 'library', + 'install_path' => __DIR__ . '/../sebastian/code-unit-reverse-lookup', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'sebastian/comparator' => array( + 'pretty_version' => '5.0.2', + 'version' => '5.0.2.0', + 'reference' => '2d3e04c3b4c1e84a5e7382221ad8883c8fbc4f53', + 'type' => 'library', + 'install_path' => __DIR__ . '/../sebastian/comparator', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'sebastian/complexity' => array( + 'pretty_version' => '3.2.0', + 'version' => '3.2.0.0', + 'reference' => '68ff824baeae169ec9f2137158ee529584553799', + 'type' => 'library', + 'install_path' => __DIR__ . '/../sebastian/complexity', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'sebastian/diff' => array( + 'pretty_version' => '5.1.1', + 'version' => '5.1.1.0', + 'reference' => 'c41e007b4b62af48218231d6c2275e4c9b975b2e', + 'type' => 'library', + 'install_path' => __DIR__ . '/../sebastian/diff', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'sebastian/environment' => array( + 'pretty_version' => '6.1.0', + 'version' => '6.1.0.0', + 'reference' => '8074dbcd93529b357029f5cc5058fd3e43666984', + 'type' => 'library', + 'install_path' => __DIR__ . '/../sebastian/environment', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'sebastian/exporter' => array( + 'pretty_version' => '5.1.2', + 'version' => '5.1.2.0', + 'reference' => '955288482d97c19a372d3f31006ab3f37da47adf', + 'type' => 'library', + 'install_path' => __DIR__ . '/../sebastian/exporter', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'sebastian/global-state' => array( + 'pretty_version' => '6.0.2', + 'version' => '6.0.2.0', + 'reference' => '987bafff24ecc4c9ac418cab1145b96dd6e9cbd9', + 'type' => 'library', + 'install_path' => __DIR__ . '/../sebastian/global-state', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'sebastian/lines-of-code' => array( + 'pretty_version' => '2.0.2', + 'version' => '2.0.2.0', + 'reference' => '856e7f6a75a84e339195d48c556f23be2ebf75d0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../sebastian/lines-of-code', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'sebastian/object-enumerator' => array( + 'pretty_version' => '5.0.0', + 'version' => '5.0.0.0', + 'reference' => '202d0e344a580d7f7d04b3fafce6933e59dae906', + 'type' => 'library', + 'install_path' => __DIR__ . '/../sebastian/object-enumerator', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'sebastian/object-reflector' => array( + 'pretty_version' => '3.0.0', + 'version' => '3.0.0.0', + 'reference' => '24ed13d98130f0e7122df55d06c5c4942a577957', + 'type' => 'library', + 'install_path' => __DIR__ . '/../sebastian/object-reflector', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'sebastian/recursion-context' => array( + 'pretty_version' => '5.0.0', + 'version' => '5.0.0.0', + 'reference' => '05909fb5bc7df4c52992396d0116aed689f93712', + 'type' => 'library', + 'install_path' => __DIR__ . '/../sebastian/recursion-context', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'sebastian/type' => array( + 'pretty_version' => '4.0.0', + 'version' => '4.0.0.0', + 'reference' => '462699a16464c3944eefc02ebdd77882bd3925bf', + 'type' => 'library', + 'install_path' => __DIR__ . '/../sebastian/type', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'sebastian/version' => array( + 'pretty_version' => '4.0.1', + 'version' => '4.0.1.0', + 'reference' => 'c51fa83a5d8f43f1402e3f32a005e6262244ef17', + 'type' => 'library', + 'install_path' => __DIR__ . '/../sebastian/version', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'sirbrillig/phpcs-variable-analysis' => array( + 'pretty_version' => 'v2.11.19', + 'version' => '2.11.19.0', + 'reference' => 'bc8d7e30e2005bce5c59018b7cdb08e9fb45c0d1', + 'type' => 'phpcodesniffer-standard', + 'install_path' => __DIR__ . '/../sirbrillig/phpcs-variable-analysis', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'spatie/once' => array( + 'pretty_version' => '3.1.1', + 'version' => '3.1.1.0', + 'reference' => '25252b821765d72566be17c52ea05b35329f0f8f', + 'type' => 'library', + 'install_path' => __DIR__ . '/../spatie/once', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'spatie/phpunit-snapshot-assertions' => array( + 'pretty_version' => '5.1.6', + 'version' => '5.1.6.0', + 'reference' => '61e2eb567713c89987895b8f514a7a4d3bff89c9', + 'type' => 'library', + 'install_path' => __DIR__ . '/../spatie/phpunit-snapshot-assertions', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'squizlabs/php_codesniffer' => array( + 'pretty_version' => '3.10.2', + 'version' => '3.10.2.0', + 'reference' => '86e5f5dd9a840c46810ebe5ff1885581c42a3017', + 'type' => 'library', + 'install_path' => __DIR__ . '/../squizlabs/php_codesniffer', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/console' => array( + 'pretty_version' => 'v6.4.11', + 'version' => '6.4.11.0', + 'reference' => '42686880adaacdad1835ee8fc2a9ec5b7bd63998', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/console', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/css-selector' => array( + 'pretty_version' => 'v6.4.8', + 'version' => '6.4.8.0', + 'reference' => '4b61b02fe15db48e3687ce1c45ea385d1780fe08', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/css-selector', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/deprecation-contracts' => array( + 'pretty_version' => 'v3.5.0', + 'version' => '3.5.0.0', + 'reference' => '0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/error-handler' => array( + 'pretty_version' => 'v6.4.10', + 'version' => '6.4.10.0', + 'reference' => '231f1b2ee80f72daa1972f7340297d67439224f0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/error-handler', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/event-dispatcher' => array( + 'pretty_version' => 'v6.4.8', + 'version' => '6.4.8.0', + 'reference' => '8d7507f02b06e06815e56bb39aa0128e3806208b', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/event-dispatcher', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/event-dispatcher-contracts' => array( + 'pretty_version' => 'v3.5.0', + 'version' => '3.5.0.0', + 'reference' => '8f93aec25d41b72493c6ddff14e916177c9efc50', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/event-dispatcher-contracts', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/event-dispatcher-implementation' => array( + 'dev_requirement' => true, + 'provided' => array( + 0 => '2.0|3.0', + ), + ), + 'symfony/finder' => array( + 'pretty_version' => 'v6.4.11', + 'version' => '6.4.11.0', + 'reference' => 'd7eb6daf8cd7e9ac4976e9576b32042ef7253453', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/finder', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/http-foundation' => array( + 'pretty_version' => 'v6.4.10', + 'version' => '6.4.10.0', + 'reference' => '117f1f20a7ade7bcea28b861fb79160a21a1e37b', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/http-foundation', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/http-kernel' => array( + 'pretty_version' => 'v6.4.11', + 'version' => '6.4.11.0', + 'reference' => '1ba6b89d781cb47448155cc70dd2e0f1b0584c79', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/http-kernel', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/mime' => array( + 'pretty_version' => 'v6.4.11', + 'version' => '6.4.11.0', + 'reference' => 'dba5d5f6073baf7a3576b580cc4a208b4ca00553', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/mime', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/polyfill-ctype' => array( + 'pretty_version' => 'v1.30.0', + 'version' => '1.30.0.0', + 'reference' => '0424dff1c58f028c451efff2045f5d92410bd540', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/polyfill-ctype', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/polyfill-intl-grapheme' => array( + 'pretty_version' => 'v1.30.0', + 'version' => '1.30.0.0', + 'reference' => '64647a7c30b2283f5d49b874d84a18fc22054b7a', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/polyfill-intl-grapheme', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/polyfill-intl-idn' => array( + 'pretty_version' => 'v1.30.0', + 'version' => '1.30.0.0', + 'reference' => 'a6e83bdeb3c84391d1dfe16f42e40727ce524a5c', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/polyfill-intl-idn', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/polyfill-intl-normalizer' => array( + 'pretty_version' => 'v1.30.0', + 'version' => '1.30.0.0', + 'reference' => 'a95281b0be0d9ab48050ebd988b967875cdb9fdb', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/polyfill-intl-normalizer', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/polyfill-mbstring' => array( + 'pretty_version' => 'v1.30.0', + 'version' => '1.30.0.0', + 'reference' => 'fd22ab50000ef01661e2a31d850ebaa297f8e03c', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/polyfill-php72' => array( + 'pretty_version' => 'v1.30.0', + 'version' => '1.30.0.0', + 'reference' => '10112722600777e02d2745716b70c5db4ca70442', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/polyfill-php72', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/polyfill-php73' => array( + 'pretty_version' => 'v1.30.0', + 'version' => '1.30.0.0', + 'reference' => 'ec444d3f3f6505bb28d11afa41e75faadebc10a1', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/polyfill-php73', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/polyfill-php80' => array( + 'pretty_version' => 'v1.30.0', + 'version' => '1.30.0.0', + 'reference' => '77fa7995ac1b21ab60769b7323d600a991a90433', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/polyfill-php80', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/polyfill-php83' => array( + 'pretty_version' => 'v1.30.0', + 'version' => '1.30.0.0', + 'reference' => 'dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/polyfill-php83', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/property-access' => array( + 'pretty_version' => 'v6.4.11', + 'version' => '6.4.11.0', + 'reference' => '866f6cd84f2094cbc6f66ce9752faf749916e2a9', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/property-access', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/property-info' => array( + 'pretty_version' => 'v6.4.10', + 'version' => '6.4.10.0', + 'reference' => 'edaea9dcc723cb4a0ab6a00f7d6f8c07c0d8ff77', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/property-info', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/routing' => array( + 'pretty_version' => 'v6.4.11', + 'version' => '6.4.11.0', + 'reference' => '8ee0c24c1bf61c263a26f1b9b6d19e83b1121f2a', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/routing', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/serializer' => array( + 'pretty_version' => 'v6.4.11', + 'version' => '6.4.11.0', + 'reference' => 'a75d03d7720417f8a654e73e8f02acdea8779cd0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/serializer', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/service-contracts' => array( + 'pretty_version' => 'v3.5.0', + 'version' => '3.5.0.0', + 'reference' => 'bd1d9e59a81d8fa4acdcea3f617c581f7475a80f', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/service-contracts', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/string' => array( + 'pretty_version' => 'v6.4.11', + 'version' => '6.4.11.0', + 'reference' => '5bc3eb632cf9c8dbfd6529d89be9950d1518883b', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/string', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/translation' => array( + 'pretty_version' => 'v6.4.10', + 'version' => '6.4.10.0', + 'reference' => '94041203f8ac200ae9e7c6a18fa6137814ccecc9', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/translation', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/translation-contracts' => array( + 'pretty_version' => 'v3.5.0', + 'version' => '3.5.0.0', + 'reference' => 'b9d2189887bb6b2e0367a9fc7136c5239ab9b05a', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/translation-contracts', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/translation-implementation' => array( + 'dev_requirement' => true, + 'provided' => array( + 0 => '2.3|3.0', + ), + ), + 'symfony/var-dumper' => array( + 'pretty_version' => 'v6.4.11', + 'version' => '6.4.11.0', + 'reference' => 'ee14c8254a480913268b1e3b1cba8045ed122694', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/var-dumper', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'symfony/yaml' => array( + 'pretty_version' => 'v6.4.11', + 'version' => '6.4.11.0', + 'reference' => 'be37e7f13195e05ab84ca5269365591edd240335', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/yaml', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'szepeviktor/phpstan-wordpress' => array( + 'pretty_version' => 'v1.3.5', + 'version' => '1.3.5.0', + 'reference' => '7f8cfe992faa96b6a33bbd75c7bace98864161e7', + 'type' => 'phpstan-extension', + 'install_path' => __DIR__ . '/../szepeviktor/phpstan-wordpress', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'theseer/tokenizer' => array( + 'pretty_version' => '1.2.3', + 'version' => '1.2.3.0', + 'reference' => '737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2', + 'type' => 'library', + 'install_path' => __DIR__ . '/../theseer/tokenizer', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'voku/portable-ascii' => array( + 'pretty_version' => '2.0.1', + 'version' => '2.0.1.0', + 'reference' => 'b56450eed252f6801410d810c8e1727224ae0743', + 'type' => 'library', + 'install_path' => __DIR__ . '/../voku/portable-ascii', + 'aliases' => array(), + 'dev_requirement' => true, + ), + 'wp-coding-standards/wpcs' => array( + 'pretty_version' => '3.1.0', + 'version' => '3.1.0.0', + 'reference' => '9333efcbff231f10dfd9c56bb7b65818b4733ca7', + 'type' => 'phpcodesniffer-standard', + 'install_path' => __DIR__ . '/../wp-coding-standards/wpcs', + 'aliases' => array(), + 'dev_requirement' => true, + ), + ), +); diff --git a/vendor/composer/platform_check.php b/vendor/composer/platform_check.php new file mode 100644 index 00000000..4c3a5d68 --- /dev/null +++ b/vendor/composer/platform_check.php @@ -0,0 +1,26 @@ += 80100)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 8.1.0". You are running ' . PHP_VERSION . '.'; +} + +if ($issues) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); + } elseif (!headers_sent()) { + echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; + } + } + trigger_error( + 'Composer detected issues in your platform: ' . implode(' ', $issues), + E_USER_ERROR + ); +} diff --git a/vendor/dealerdirect/phpcodesniffer-composer-installer/LICENSE.md b/vendor/dealerdirect/phpcodesniffer-composer-installer/LICENSE.md new file mode 100644 index 00000000..9bc88065 --- /dev/null +++ b/vendor/dealerdirect/phpcodesniffer-composer-installer/LICENSE.md @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2016-2022 Dealerdirect B.V. and contributors +Copyright (c) 2022 PHPCSStandards and contributors + +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/vendor/dealerdirect/phpcodesniffer-composer-installer/README.md b/vendor/dealerdirect/phpcodesniffer-composer-installer/README.md new file mode 100644 index 00000000..e8c263ab --- /dev/null +++ b/vendor/dealerdirect/phpcodesniffer-composer-installer/README.md @@ -0,0 +1,285 @@ +# PHP_CodeSniffer Standards Composer Installer Plugin + +![Project Stage][project-stage-shield] +![Last Commit][last-updated-shield] +![Awesome][awesome-shield] +[![License][license-shield]](LICENSE.md) + +[![Tests][ghactionstest-shield]][ghactions] +[![Latest Version on Packagist][packagist-version-shield]][packagist-version] +[![Packagist][packagist-shield]][packagist] + +[![Contributor Covenant][code-of-conduct-shield]][code-of-conduct] + +This composer installer plugin allows for easy installation of [PHP_CodeSniffer][codesniffer] coding standards (rulesets). + +No more symbolic linking of directories, checking out repositories on specific locations or changing +the `phpcs` configuration. + +## Usage + +Installation can be done with [Composer][composer], by requiring this package as a development dependency: + +```bash +composer require --dev dealerdirect/phpcodesniffer-composer-installer +``` + +When using Composer 2.2 or higher, Composer will [ask for your permission](https://blog.packagist.com/composer-2-2/#more-secure-plugin-execution) to allow this plugin to execute code. For this plugin to be functional, permission needs to be granted. + +When permission has been granted, the following snippet will automatically be added to your `composer.json` file by Composer: +```json +{ + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + } +} +``` + +When using Composer < 2.2, you can add the permission flag ahead of the upgrade to Composer 2.2, by running: +```bash +composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true +``` + +That's it. + +### Compatibility + +This plugin is compatible with: + +- PHP **5.4+**, **7.x**, and **8.x** (Support for PHP v8 is available since [`v0.7.0`][v0.7]) +- [Composer][composer] **1.x** and **2.x** (Support for Composer v2 is available since [`v0.7.0`][v0.7]) +- [PHP_CodeSniffer][codesniffer] **2.x** and **3.x** (Support for PHP_CodeSniffer v3 is available since [`v0.4.0`][v0.4]) + + +> **ℹ️ Please Note:** [Composer treats _minor_ releases below 1.0.0 as _major_ releases][composer-manual-caret]. So version `0.7.x` (or higher) of this plugin must be _explicitly_ set as version constraint when using Composer 2.x or PHP 8.0. In other words: using `^0.6` will **not** work with Composer 2.x or PHP 8.0. + +### How it works + +Basically, this plugin executes the following steps: + +- This plugin searches for [`phpcodesniffer-standard` packages][] in all of your currently installed Composer packages. +- Matching packages and the project itself are scanned for PHP_CodeSniffer rulesets. +- The plugin will call PHP_CodeSniffer and configure the `installed_paths` option. + +### Example project + +The following is an example Composer project and has included +multiple `phpcodesniffer-standard` packages. + +```json +{ + "name": "example/project", + "description": "Just an example project", + "type": "project", + "require": {}, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "*", + "object-calisthenics/phpcs-calisthenics-rules": "*", + "phpcompatibility/php-compatibility": "*", + "wp-coding-standards/wpcs": "*" + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + } +} +``` + +After running `composer install` PHP_CodeSniffer just works: + +```bash +$ ./vendor/bin/phpcs -i +The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR12, Squiz, Zend, ObjectCalisthenics, +PHPCompatibility, WordPress, WordPress-Core, WordPress-Docs and WordPress-Extra +``` + +### Calling the plugin directly + +In some circumstances, it is desirable to call this plugin's functionality +directly. For instance, during development or in [CI][definition-ci] environments. + +As the plugin requires Composer to work, direct calls need to be wired through a +project's `composer.json`. + +This is done by adding a call to the `Plugin::run` function in the `script` +section of the `composer.json`: + +```json +{ + "scripts": { + "install-codestandards": [ + "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run" + ] + } +} +``` + +The command can then be called using `composer run-script install-codestandards` or +referenced from other script configurations, as follows: + +```json +{ + "scripts": { + "install-codestandards": [ + "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run" + ], + "post-install-cmd": [ + "@install-codestandards" + ] + } +} +``` + +For more details about Composer scripts, please refer to [the section on scripts +in the Composer manual][composer-manual-scripts]. + +### Changing the Coding Standards search depth + +By default, this plugin searches up for Coding Standards up to three directories +deep. In most cases, this should be sufficient. However, this plugin allows +you to customize the search depth setting if needed. + +```json +{ + "extra": { + "phpcodesniffer-search-depth": 5 + } +} +``` + +### Caveats + +When this plugin is installed globally, composer will load the _global_ plugin rather +than the one from the local repository. Despite [this behavior being documented +in the composer manual][using-composer-plugins], it could potentially confuse +as another version of the plugin could be run and not the one specified by the project. + +## Developing Coding Standards + +Coding standard can be developed normally, as documented by [PHP_CodeSniffer][codesniffer], in the [Coding Standard Tutorial][tutorial]. + +Create a composer package of your coding standard by adding a `composer.json` file. + +```json +{ + "name" : "acme/phpcodesniffer-our-standards", + "description" : "Package contains all coding standards of the Acme company", + "require" : { + "php" : ">=5.4.0", + "squizlabs/php_codesniffer" : "^3.6" + }, + "type" : "phpcodesniffer-standard" +} +``` + +Requirements: +* The repository may contain one or more standards. +* Each standard can have a separate directory no deeper than 3 levels from the repository root. +* The package `type` must be `phpcodesniffer-standard`. Without this, the plugin will not trigger. + +### Requiring the plugin from within your coding standard + +If your coding standard itself depends on additional external PHPCS standards, this plugin can +make life easier on your end-users by taking care of the installation of all standards - yours +and your dependencies - for them. + +This can help reduce the number of support questions about setting the `installed_paths`, as well +as simplify your standard's installation instructions. + +For this to work, make sure your external standard adds this plugin to the `composer.json` config +via `require`, **not** `require-dev`. + +> :warning: Your end-user may already `require-dev` this plugin and/or other external standards used +> by your end-users may require this plugin as well. +> +> To prevent your end-users getting into "_dependency hell_", make sure to make the version requirement +> for this plugin flexible. +> +> As, for now, this plugin is still regarded as "unstable" (version < 1.0), remember that Composer +> treats unstable minors as majors and will not be able to resolve one config requiring this plugin +> at version `^0.5`, while another requires it at version `^0.6`. +> Either allow multiple minors or use `*` as the version requirement. +> +> Some examples of flexible requirements which can be used: +> ```bash +> composer require dealerdirect/phpcodesniffer-composer-installer:"*" +> composer require dealerdirect/phpcodesniffer-composer-installer:"0.*" +> composer require dealerdirect/phpcodesniffer-composer-installer:"^0.4.1 || ^0.5 || ^0.6 || ^0.7" +> ``` + +## Changelog + +This repository does not contain a `CHANGELOG.md` file, however, we do publish a changelog on each release +using the [GitHub releases][changelog] functionality. + +## Contributing + +This is an active open-source project. We are always open to people who want to +use the code or contribute to it. + +We've set up a separate document for our [contribution guidelines][contributing-guidelines]. + +Thank you for being involved! :heart_eyes: + +## Authors & contributors + +The original idea and setup of this repository is by [Franck Nijhof][frenck], employee @ Dealerdirect. + +For a full list of all author and/or contributors, check [the contributors page][contributors]. + +## License + +The MIT License (MIT) + +Copyright (c) 2016-2022 Dealerdirect B.V. and contributors +Copyright (c) 2022 PHPCSStandards and contributors + +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. + +[awesome-shield]: https://img.shields.io/badge/awesome%3F-yes-brightgreen.svg +[changelog]: https://github.com/PHPCSStandards/composer-installer/releases +[code-of-conduct-shield]: https://img.shields.io/badge/Contributor%20Covenant-v2.0-ff69b4.svg +[code-of-conduct]: CODE_OF_CONDUCT.md +[codesniffer]: https://github.com/squizlabs/PHP_CodeSniffer +[composer-manual-scripts]: https://getcomposer.org/doc/articles/scripts.md +[composer-manual-caret]: https://getcomposer.org/doc/articles/versions.md#caret-version-range- +[composer]: https://getcomposer.org/ +[contributing-guidelines]: CONTRIBUTING.md +[contributors]: https://github.com/PHPCSStandards/composer-installer/graphs/contributors +[definition-ci]: https://en.wikipedia.org/wiki/Continuous_integration +[frenck]: https://github.com/frenck +[last-updated-shield]: https://img.shields.io/github/last-commit/PHPCSStandards/composer-installer.svg +[license-shield]: https://img.shields.io/github/license/PHPCSStandards/composer-installer.svg +[packagist-shield]: https://img.shields.io/packagist/dt/dealerdirect/phpcodesniffer-composer-installer.svg +[packagist-version-shield]: https://img.shields.io/packagist/v/dealerdirect/phpcodesniffer-composer-installer.svg +[packagist-version]: https://packagist.org/packages/dealerdirect/phpcodesniffer-composer-installer +[packagist]: https://packagist.org/packages/dealerdirect/phpcodesniffer-composer-installer +[`phpcodesniffer-standard` packages]: https://packagist.org/explore/?type=phpcodesniffer-standard +[project-stage-shield]: https://img.shields.io/badge/Project%20Stage-Development-yellowgreen.svg +[scrutinizer-shield]: https://img.shields.io/scrutinizer/g/dealerdirect/phpcodesniffer-composer-installer.svg +[scrutinizer]: https://scrutinizer-ci.com/g/dealerdirect/phpcodesniffer-composer-installer/ +[ghactionstest-shield]: https://github.com/PHPCSStandards/composer-installer/actions/workflows/integrationtest.yml/badge.svg +[ghactions]: https://github.com/PHPCSStandards/composer-installer/actions/workflows/integrationtest.yml +[tutorial]: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Coding-Standard-Tutorial +[using-composer-plugins]: https://getcomposer.org/doc/articles/plugins.md#using-plugins +[v0.4]: https://github.com/PHPCSStandards/composer-installer/releases/tag/v0.4.0 +[v0.7]: https://github.com/PHPCSStandards/composer-installer/releases/tag/v0.7.0 diff --git a/vendor/dealerdirect/phpcodesniffer-composer-installer/composer.json b/vendor/dealerdirect/phpcodesniffer-composer-installer/composer.json new file mode 100644 index 00000000..bf3355ac --- /dev/null +++ b/vendor/dealerdirect/phpcodesniffer-composer-installer/composer.json @@ -0,0 +1,71 @@ +{ + "name": "dealerdirect/phpcodesniffer-composer-installer", + "description": "PHP_CodeSniffer Standards Composer Installer Plugin", + "type": "composer-plugin", + "keywords": [ + "composer", "installer", "plugin", + "phpcs", "phpcbf", "codesniffer", "phpcodesniffer", "php_codesniffer", + "standard", "standards", "style guide", "stylecheck", + "qa", "quality", "code quality", "tests" + ], + "homepage": "http://www.dealerdirect.com", + "license": "MIT", + "authors": [ + { + "name": "Franck Nijhof", + "email": "franck.nijhof@dealerdirect.com", + "homepage": "http://www.frenck.nl", + "role": "Developer / IT Manager" + }, + { + "name" : "Contributors", + "homepage" : "https://github.com/PHPCSStandards/composer-installer/graphs/contributors" + } + ], + "support": { + "issues": "https://github.com/PHPCSStandards/composer-installer/issues", + "source": "https://github.com/PHPCSStandards/composer-installer" + }, + "require": { + "php": ">=5.4", + "composer-plugin-api": "^1.0 || ^2.0", + "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" + }, + "require-dev": { + "ext-json": "*", + "ext-zip": "*", + "composer/composer": "*", + "phpcompatibility/php-compatibility": "^9.0", + "php-parallel-lint/php-parallel-lint": "^1.3.1", + "yoast/phpunit-polyfills": "^1.0" + }, + "minimum-stability": "dev", + "prefer-stable": true, + "autoload": { + "psr-4": { + "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Tests\\": "tests/" + } + }, + "extra": { + "class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + }, + "scripts": { + "install-codestandards": [ + "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run" + ], + "lint": [ + "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --exclude vendor --exclude .git" + ], + "test": [ + "@php ./vendor/phpunit/phpunit/phpunit --no-coverage" + ], + "coverage": [ + "@php ./vendor/phpunit/phpunit/phpunit" + ] + } +} diff --git a/vendor/dealerdirect/phpcodesniffer-composer-installer/src/Plugin.php b/vendor/dealerdirect/phpcodesniffer-composer-installer/src/Plugin.php new file mode 100644 index 00000000..a2863d6c --- /dev/null +++ b/vendor/dealerdirect/phpcodesniffer-composer-installer/src/Plugin.php @@ -0,0 +1,637 @@ + + */ +class Plugin implements PluginInterface, EventSubscriberInterface +{ + const KEY_MAX_DEPTH = 'phpcodesniffer-search-depth'; + + const MESSAGE_ERROR_WRONG_MAX_DEPTH = + 'The value of "%s" (in the composer.json "extra".section) must be an integer larger than %d, %s given.'; + + const MESSAGE_NOT_INSTALLED = 'PHPCodeSniffer is not installed'; + const MESSAGE_NOTHING_TO_INSTALL = 'No PHPCS standards to install or update'; + const MESSAGE_PLUGIN_UNINSTALLED = 'PHPCodeSniffer Composer Installer is uninstalled'; + const MESSAGE_RUNNING_INSTALLER = 'Running PHPCodeSniffer Composer Installer'; + + const PACKAGE_NAME = 'squizlabs/php_codesniffer'; + const PACKAGE_TYPE = 'phpcodesniffer-standard'; + + const PHPCS_CONFIG_REGEX = '`%s:[^\r\n]+`'; + const PHPCS_CONFIG_KEY = 'installed_paths'; + + const PLUGIN_NAME = 'dealerdirect/phpcodesniffer-composer-installer'; + + /** + * @var Composer + */ + private $composer; + + /** + * @var string + */ + private $cwd; + + /** + * @var Filesystem + */ + private $filesystem; + + /** + * @var array + */ + private $installedPaths; + + /** + * @var IOInterface + */ + private $io; + + /** + * @var ProcessExecutor + */ + private $processExecutor; + + /** + * Triggers the plugin's main functionality. + * + * Makes it possible to run the plugin as a custom command. + * + * @param Event $event + * + * @throws \InvalidArgumentException + * @throws \RuntimeException + * @throws LogicException + * @throws ProcessFailedException + * @throws RuntimeException + */ + public static function run(Event $event) + { + $io = $event->getIO(); + $composer = $event->getComposer(); + + $instance = new static(); + + $instance->io = $io; + $instance->composer = $composer; + $instance->init(); + $instance->onDependenciesChangedEvent(); + } + + /** + * {@inheritDoc} + * + * @throws \RuntimeException + * @throws LogicException + * @throws ProcessFailedException + * @throws RuntimeException + */ + public function activate(Composer $composer, IOInterface $io) + { + $this->composer = $composer; + $this->io = $io; + + $this->init(); + } + + /** + * {@inheritDoc} + */ + public function deactivate(Composer $composer, IOInterface $io) + { + } + + /** + * {@inheritDoc} + */ + public function uninstall(Composer $composer, IOInterface $io) + { + } + + /** + * Prepares the plugin so it's main functionality can be run. + * + * @throws \RuntimeException + * @throws LogicException + * @throws ProcessFailedException + * @throws RuntimeException + */ + private function init() + { + $this->cwd = getcwd(); + $this->installedPaths = array(); + + $this->processExecutor = new ProcessExecutor($this->io); + $this->filesystem = new Filesystem($this->processExecutor); + } + + /** + * {@inheritDoc} + */ + public static function getSubscribedEvents() + { + return array( + ScriptEvents::POST_INSTALL_CMD => array( + array('onDependenciesChangedEvent', 0), + ), + ScriptEvents::POST_UPDATE_CMD => array( + array('onDependenciesChangedEvent', 0), + ), + ); + } + + /** + * Entry point for post install and post update events. + * + * @throws \InvalidArgumentException + * @throws LogicException + * @throws ProcessFailedException + * @throws RuntimeException + */ + public function onDependenciesChangedEvent() + { + $io = $this->io; + $isVerbose = $io->isVerbose(); + $exitCode = 0; + + if ($isVerbose) { + $io->write(sprintf('%s', self::MESSAGE_RUNNING_INSTALLER)); + } + + if ($this->isPHPCodeSnifferInstalled() === true) { + $this->loadInstalledPaths(); + $installPathCleaned = $this->cleanInstalledPaths(); + $installPathUpdated = $this->updateInstalledPaths(); + + if ($installPathCleaned === true || $installPathUpdated === true) { + $exitCode = $this->saveInstalledPaths(); + } elseif ($isVerbose) { + $io->write(sprintf('%s', self::MESSAGE_NOTHING_TO_INSTALL)); + } + } else { + $pluginPackage = $this + ->composer + ->getRepositoryManager() + ->getLocalRepository() + ->findPackages(self::PLUGIN_NAME) + ; + + $isPluginUninstalled = count($pluginPackage) === 0; + + if ($isPluginUninstalled) { + if ($isVerbose) { + $io->write(sprintf('%s', self::MESSAGE_PLUGIN_UNINSTALLED)); + } + } else { + $exitCode = 1; + if ($isVerbose) { + $io->write(sprintf('%s', self::MESSAGE_NOT_INSTALLED)); + } + } + } + + return $exitCode; + } + + /** + * Load all paths from PHP_CodeSniffer into an array. + * + * @throws LogicException + * @throws ProcessFailedException + * @throws RuntimeException + */ + private function loadInstalledPaths() + { + if ($this->isPHPCodeSnifferInstalled() === true) { + $this->processExecutor->execute( + $this->getPhpcsCommand() . ' --config-show', + $output, + $this->getPHPCodeSnifferInstallPath() + ); + + $regex = sprintf(self::PHPCS_CONFIG_REGEX, self::PHPCS_CONFIG_KEY); + if (preg_match($regex, $output, $match) === 1) { + $phpcsInstalledPaths = str_replace(self::PHPCS_CONFIG_KEY . ': ', '', $match[0]); + $phpcsInstalledPaths = trim($phpcsInstalledPaths); + + if ($phpcsInstalledPaths !== '') { + $this->installedPaths = explode(',', $phpcsInstalledPaths); + } + } + } + } + + /** + * Save all coding standard paths back into PHP_CodeSniffer + * + * @throws LogicException + * @throws ProcessFailedException + * @throws RuntimeException + * + * @return int Exit code. 0 for success, 1 or higher for failure. + */ + private function saveInstalledPaths() + { + // Check if we found installed paths to set. + if (count($this->installedPaths) !== 0) { + sort($this->installedPaths); + $paths = implode(',', $this->installedPaths); + $arguments = array('--config-set', self::PHPCS_CONFIG_KEY, $paths); + $configMessage = sprintf( + 'PHP CodeSniffer Config %s set to %s', + self::PHPCS_CONFIG_KEY, + $paths + ); + } else { + // Delete the installed paths if none were found. + $arguments = array('--config-delete', self::PHPCS_CONFIG_KEY); + $configMessage = sprintf( + 'PHP CodeSniffer Config %s delete', + self::PHPCS_CONFIG_KEY + ); + } + + // Prepare message in case of failure + $failMessage = sprintf( + 'Failed to set PHP CodeSniffer %s Config', + self::PHPCS_CONFIG_KEY + ); + + // Okay, lets rock! + $command = vsprintf( + '%s %s', + array( + 'phpcs command' => $this->getPhpcsCommand(), + 'arguments' => implode(' ', $arguments), + ) + ); + + $exitCode = $this->processExecutor->execute($command, $configResult, $this->getPHPCodeSnifferInstallPath()); + if ($exitCode === 0) { + $exitCode = $this->verifySaveSuccess(); + } + + if ($exitCode === 0) { + $this->io->write($configMessage); + } else { + $this->io->write($failMessage); + } + + if ($this->io->isVerbose() && !empty($configResult)) { + $this->io->write(sprintf('%s', $configResult)); + } + + return $exitCode; + } + + /** + * Verify that the paths which were expected to be saved, have been. + * + * @return int Exit code. 0 for success, 1 for failure. + */ + private function verifySaveSuccess() + { + $exitCode = 1; + $expectedPaths = $this->installedPaths; + + // Request the currently set installed paths after the save. + $this->loadInstalledPaths(); + + $registeredPaths = array_intersect($this->installedPaths, $expectedPaths); + $registeredCount = count($registeredPaths); + $expectedCount = count($expectedPaths); + + if ($expectedCount === $registeredCount) { + $exitCode = 0; + } + + if ($exitCode === 1 && $this->io->isVerbose()) { + $verificationMessage = sprintf( + "Paths to external standards found by the plugin: %s\n" + . 'Actual paths registered with PHPCS: %s', + implode(', ', $expectedPaths), + implode(', ', $this->installedPaths) + ); + $this->io->write($verificationMessage); + } + + return $exitCode; + } + + /** + * Get the command to call PHPCS. + */ + protected function getPhpcsCommand() + { + // Determine the path to the main PHPCS file. + $phpcsPath = $this->getPHPCodeSnifferInstallPath(); + if (file_exists($phpcsPath . '/bin/phpcs') === true) { + // PHPCS 3.x. + $phpcsExecutable = './bin/phpcs'; + } else { + // PHPCS 2.x. + $phpcsExecutable = './scripts/phpcs'; + } + + return vsprintf( + '%s %s', + array( + 'php executable' => $this->getPhpExecCommand(), + 'phpcs executable' => $phpcsExecutable, + ) + ); + } + + /** + * Get the path to the current PHP version being used. + * + * Duplicate of the same in the EventDispatcher class in Composer itself. + */ + protected function getPhpExecCommand() + { + $finder = new PhpExecutableFinder(); + + $phpPath = $finder->find(false); + + if ($phpPath === false) { + throw new \RuntimeException('Failed to locate PHP binary to execute ' . $phpPath); + } + + $phpArgs = $finder->findArguments(); + $phpArgs = $phpArgs + ? ' ' . implode(' ', $phpArgs) + : '' + ; + + $command = ProcessExecutor::escape($phpPath) . + $phpArgs . + ' -d allow_url_fopen=' . ProcessExecutor::escape(ini_get('allow_url_fopen')) . + ' -d disable_functions=' . ProcessExecutor::escape(ini_get('disable_functions')) . + ' -d memory_limit=' . ProcessExecutor::escape(ini_get('memory_limit')) + ; + + return $command; + } + + /** + * Iterate trough all known paths and check if they are still valid. + * + * If path does not exists, is not an directory or isn't readable, the path + * is removed from the list. + * + * @return bool True if changes where made, false otherwise + */ + private function cleanInstalledPaths() + { + $changes = false; + foreach ($this->installedPaths as $key => $path) { + // This might be a relative path as well + $alternativePath = realpath($this->getPHPCodeSnifferInstallPath() . \DIRECTORY_SEPARATOR . $path); + + if ( + (is_dir($path) === false || is_readable($path) === false) && + ( + $alternativePath === false || + is_dir($alternativePath) === false || + is_readable($alternativePath) === false + ) + ) { + unset($this->installedPaths[$key]); + $changes = true; + } + } + return $changes; + } + + /** + * Check all installed packages (including the root package) against + * the installed paths from PHP_CodeSniffer and add the missing ones. + * + * @return bool True if changes where made, false otherwise + * + * @throws \InvalidArgumentException + * @throws \RuntimeException + */ + private function updateInstalledPaths() + { + $changes = false; + $searchPaths = array(); + + // Add root package only if it has the expected package type. + if ( + $this->composer->getPackage() instanceof RootPackageInterface + && $this->composer->getPackage()->getType() === self::PACKAGE_TYPE + ) { + $searchPaths[] = $this->cwd; + } + + $codingStandardPackages = $this->getPHPCodingStandardPackages(); + foreach ($codingStandardPackages as $package) { + $installPath = $this->composer->getInstallationManager()->getInstallPath($package); + if ($this->filesystem->isAbsolutePath($installPath) === false) { + $installPath = $this->filesystem->normalizePath( + $this->cwd . \DIRECTORY_SEPARATOR . $installPath + ); + } + $searchPaths[] = $installPath; + } + + // Nothing to do. + if ($searchPaths === array()) { + return false; + } + + $finder = new Finder(); + $finder->files() + ->depth('<= ' . $this->getMaxDepth()) + ->depth('>= ' . $this->getMinDepth()) + ->ignoreUnreadableDirs() + ->ignoreVCS(true) + ->in($searchPaths) + ->name('ruleset.xml'); + + // Process each found possible ruleset. + foreach ($finder as $ruleset) { + $standardsPath = $ruleset->getPath(); + + // Pick the directory above the directory containing the standard, unless this is the project root. + if ($standardsPath !== $this->cwd) { + $standardsPath = dirname($standardsPath); + } + + // Use relative paths for local project repositories. + if ($this->isRunningGlobally() === false) { + $standardsPath = $this->filesystem->findShortestPath( + $this->getPHPCodeSnifferInstallPath(), + $standardsPath, + true + ); + } + + // De-duplicate and add when directory is not configured. + if (in_array($standardsPath, $this->installedPaths, true) === false) { + $this->installedPaths[] = $standardsPath; + $changes = true; + } + } + + return $changes; + } + + /** + * Iterates through Composers' local repository looking for valid Coding + * Standard packages. + * + * @return array Composer packages containing coding standard(s) + */ + private function getPHPCodingStandardPackages() + { + $codingStandardPackages = array_filter( + $this->composer->getRepositoryManager()->getLocalRepository()->getPackages(), + function (PackageInterface $package) { + if ($package instanceof AliasPackage) { + return false; + } + return $package->getType() === Plugin::PACKAGE_TYPE; + } + ); + + return $codingStandardPackages; + } + + /** + * Searches for the installed PHP_CodeSniffer Composer package + * + * @param null|string|\Composer\Semver\Constraint\ConstraintInterface $versionConstraint to match against + * + * @return PackageInterface|null + */ + private function getPHPCodeSnifferPackage($versionConstraint = null) + { + $packages = $this + ->composer + ->getRepositoryManager() + ->getLocalRepository() + ->findPackages(self::PACKAGE_NAME, $versionConstraint); + + return array_shift($packages); + } + + /** + * Returns the path to the PHP_CodeSniffer package installation location + * + * @return string + */ + private function getPHPCodeSnifferInstallPath() + { + return $this->composer->getInstallationManager()->getInstallPath($this->getPHPCodeSnifferPackage()); + } + + /** + * Simple check if PHP_CodeSniffer is installed. + * + * @param null|string|\Composer\Semver\Constraint\ConstraintInterface $versionConstraint to match against + * + * @return bool Whether PHP_CodeSniffer is installed + */ + private function isPHPCodeSnifferInstalled($versionConstraint = null) + { + return ($this->getPHPCodeSnifferPackage($versionConstraint) !== null); + } + + /** + * Test if composer is running "global" + * This check kinda dirty, but it is the "Composer Way" + * + * @return bool Whether Composer is running "globally" + * + * @throws \RuntimeException + */ + private function isRunningGlobally() + { + return ($this->composer->getConfig()->get('home') === $this->cwd); + } + + /** + * Determines the maximum search depth when searching for Coding Standards. + * + * @return int + * + * @throws \InvalidArgumentException + */ + private function getMaxDepth() + { + $maxDepth = 3; + + $extra = $this->composer->getPackage()->getExtra(); + + if (array_key_exists(self::KEY_MAX_DEPTH, $extra)) { + $maxDepth = $extra[self::KEY_MAX_DEPTH]; + $minDepth = $this->getMinDepth(); + + if ( + (string) (int) $maxDepth !== (string) $maxDepth /* Must be an integer or cleanly castable to one */ + || $maxDepth <= $minDepth /* Larger than the minimum */ + || is_float($maxDepth) === true /* Within the boundaries of integer */ + ) { + $message = vsprintf( + self::MESSAGE_ERROR_WRONG_MAX_DEPTH, + array( + 'key' => self::KEY_MAX_DEPTH, + 'min' => $minDepth, + 'given' => var_export($maxDepth, true), + ) + ); + + throw new \InvalidArgumentException($message); + } + } + + return (int) $maxDepth; + } + + /** + * Returns the minimal search depth for Coding Standard packages. + * + * Usually this is 0, unless PHP_CodeSniffer >= 3 is used. + * + * @return int + */ + private function getMinDepth() + { + if ($this->isPHPCodeSnifferInstalled('>= 3.0.0') !== true) { + return 1; + } + return 0; + } +} diff --git a/vendor/dflydev/dot-access-data/CHANGELOG.md b/vendor/dflydev/dot-access-data/CHANGELOG.md new file mode 100644 index 00000000..b8b468d7 --- /dev/null +++ b/vendor/dflydev/dot-access-data/CHANGELOG.md @@ -0,0 +1,74 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [3.0.3] - 2024-07-08 + +### Fixed + + - Fixed PHP 8.4 deprecation notices (#47) + +## [3.0.2] - 2022-10-27 + +### Fixed + + - Added missing return types to docblocks (#44, #45) + +## [3.0.1] - 2021-08-13 + +### Added + + - Adds ReturnTypeWillChange to suppress PHP 8.1 warnings (#40) + +## [3.0.0] - 2021-01-01 + +### Added + - Added support for both `.` and `/`-delimited key paths (#24) + - Added parameter and return types to everything; enabled strict type checks (#18) + - Added new exception classes to better identify certain types of errors (#20) + - `Data` now implements `ArrayAccess` (#17) + - Added ability to merge non-associative array values (#31, #32) + +### Changed + - All thrown exceptions are now instances or subclasses of `DataException` (#20) + - Calling `get()` on a missing key path without providing a default will throw a `MissingPathException` instead of returning `null` (#29) + - Bumped supported PHP versions to 7.1 - 8.x (#18) + +### Fixed + - Fixed incorrect merging of array values into string values (#32) + - Fixed `get()` method behaving as if keys with `null` values didn't exist + +## [2.0.0] - 2017-12-21 + +### Changed + - Bumped supported PHP versions to 7.0 - 7.4 (#12) + - Switched to PSR-4 autoloading + +## [1.1.0] - 2017-01-20 + +### Added + - Added new `has()` method to check for the existence of the given key (#4, #7) + +## [1.0.1] - 2015-08-12 + +### Added + - Added new optional `$default` parameter to the `get()` method (#2) + +## [1.0.0] - 2012-07-17 + +**Initial release!** + +[Unreleased]: https://github.com/dflydev/dflydev-dot-access-data/compare/v3.0.3...main +[3.0.3]: https://github.com/dflydev/dflydev-dot-access-data/compare/v3.0.2...v3.0.3 +[3.0.2]: https://github.com/dflydev/dflydev-dot-access-data/compare/v3.0.1...v3.0.2 +[3.0.1]: https://github.com/dflydev/dflydev-dot-access-data/compare/v3.0.0...v3.0.1 +[3.0.0]: https://github.com/dflydev/dflydev-dot-access-data/compare/v2.0.0...v3.0.0 +[2.0.0]: https://github.com/dflydev/dflydev-dot-access-data/compare/v1.1.0...v2.0.0 +[1.1.0]: https://github.com/dflydev/dflydev-dot-access-data/compare/v1.0.1...v1.1.0 +[1.0.1]: https://github.com/dflydev/dflydev-dot-access-data/compare/v1.0.0...v1.0.1 +[1.0.0]: https://github.com/dflydev/dflydev-dot-access-data/releases/tag/v1.0.0 diff --git a/vendor/dflydev/dot-access-data/LICENSE b/vendor/dflydev/dot-access-data/LICENSE new file mode 100644 index 00000000..b6880d43 --- /dev/null +++ b/vendor/dflydev/dot-access-data/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2012 Dragonfly Development Inc. + +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/vendor/dflydev/dot-access-data/README.md b/vendor/dflydev/dot-access-data/README.md new file mode 100644 index 00000000..775fbdf7 --- /dev/null +++ b/vendor/dflydev/dot-access-data/README.md @@ -0,0 +1,158 @@ +Dot Access Data +=============== + +[![Latest Version](https://img.shields.io/packagist/v/dflydev/dot-access-data.svg?style=flat-square)](https://packagist.org/packages/dflydev/dot-access-data) +[![Total Downloads](https://img.shields.io/packagist/dt/dflydev/dot-access-data.svg?style=flat-square)](https://packagist.org/packages/dflydev/dot-access-data) +[![Software License](https://img.shields.io/badge/License-MIT-brightgreen.svg?style=flat-square)](LICENSE) +[![Build Status](https://img.shields.io/github/workflow/status/dflydev/dflydev-dot-access-data/Tests/main.svg?style=flat-square)](https://github.com/dflydev/dflydev-dot-access-data/actions?query=workflow%3ATests+branch%3Amain) +[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/dflydev/dflydev-dot-access-data.svg?style=flat-square)](https://scrutinizer-ci.com/g/dflydev/dflydev-dot-access-data/code-structure/) +[![Quality Score](https://img.shields.io/scrutinizer/g/dflydev/dflydev-dot-access-data.svg?style=flat-square)](https://scrutinizer-ci.com/g/dflydev/dflydev-dot-access-data) + +Given a deep data structure, access data by dot notation. + + +Requirements +------------ + + * PHP (7.1+) + +> For PHP (5.3+) please refer to version `1.0`. + + +Usage +----- + +Abstract example: + +```php +use Dflydev\DotAccessData\Data; + +$data = new Data; + +$data->set('a.b.c', 'C'); +$data->set('a.b.d', 'D1'); +$data->append('a.b.d', 'D2'); +$data->set('a.b.e', ['E0', 'E1', 'E2']); + +// C +$data->get('a.b.c'); + +// ['D1', 'D2'] +$data->get('a.b.d'); + +// ['E0', 'E1', 'E2'] +$data->get('a.b.e'); + +// true +$data->has('a.b.c'); + +// false +$data->has('a.b.d.j'); + + +// 'some-default-value' +$data->get('some.path.that.does.not.exist', 'some-default-value'); + +// throws a MissingPathException because no default was given +$data->get('some.path.that.does.not.exist'); +``` + +A more concrete example: + +```php +use Dflydev\DotAccessData\Data; + +$data = new Data([ + 'hosts' => [ + 'hewey' => [ + 'username' => 'hman', + 'password' => 'HPASS', + 'roles' => ['web'], + ], + 'dewey' => [ + 'username' => 'dman', + 'password' => 'D---S', + 'roles' => ['web', 'db'], + 'nick' => 'dewey dman', + ], + 'lewey' => [ + 'username' => 'lman', + 'password' => 'LP@$$', + 'roles' => ['db'], + ], + ], +]); + +// hman +$username = $data->get('hosts.hewey.username'); +// HPASS +$password = $data->get('hosts.hewey.password'); +// ['web'] +$roles = $data->get('hosts.hewey.roles'); +// dewey dman +$nick = $data->get('hosts.dewey.nick'); +// Unknown +$nick = $data->get('hosts.lewey.nick', 'Unknown'); + +// DataInterface instance +$dewey = $data->getData('hosts.dewey'); +// dman +$username = $dewey->get('username'); +// D---S +$password = $dewey->get('password'); +// ['web', 'db'] +$roles = $dewey->get('roles'); + +// No more lewey +$data->remove('hosts.lewey'); + +// Add DB to hewey's roles +$data->append('hosts.hewey.roles', 'db'); + +$data->set('hosts.april', [ + 'username' => 'aman', + 'password' => '@---S', + 'roles' => ['web'], +]); + +// Check if a key exists (true to this case) +$hasKey = $data->has('hosts.dewey.username'); +``` + +`Data` may be used as an array, since it implements `ArrayAccess` interface: + +```php +// Get +$data->get('name') === $data['name']; // true + +$data['name'] = 'Dewey'; +// is equivalent to +$data->set($name, 'Dewey'); + +isset($data['name']) === $data->has('name'); + +// Remove key +unset($data['name']); +``` + +`/` can also be used as a path delimiter: + +```php +$data->set('a/b/c', 'd'); +echo $data->get('a/b/c'); // "d" + +$data->get('a/b/c') === $data->get('a.b.c'); // true +``` + +License +------- + +This library is licensed under the MIT License - see the LICENSE file +for details. + + +Community +--------- + +If you have questions or want to help out, join us in the +[#dflydev](irc://irc.freenode.net/#dflydev) channel on irc.freenode.net. diff --git a/vendor/dflydev/dot-access-data/composer.json b/vendor/dflydev/dot-access-data/composer.json new file mode 100644 index 00000000..44dc5ede --- /dev/null +++ b/vendor/dflydev/dot-access-data/composer.json @@ -0,0 +1,67 @@ +{ + "name": "dflydev/dot-access-data", + "type": "library", + "description": "Given a deep data structure, access data by dot notation.", + "homepage": "https://github.com/dflydev/dflydev-dot-access-data", + "keywords": ["dot", "access", "data", "notation"], + "license": "MIT", + "authors": [ + { + "name": "Dragonfly Development Inc.", + "email": "info@dflydev.com", + "homepage": "http://dflydev.com" + }, + { + "name": "Beau Simensen", + "email": "beau@dflydev.com", + "homepage": "http://beausimensen.com" + }, + { + "name": "Carlos Frutos", + "email": "carlos@kiwing.it", + "homepage": "https://github.com/cfrutos" + }, + { + "name": "Colin O'Dell", + "email": "colinodell@gmail.com", + "homepage": "https://www.colinodell.com" + } + ], + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^0.12.42", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.3", + "scrutinizer/ocular": "1.6.0", + "squizlabs/php_codesniffer": "^3.5", + "vimeo/psalm": "^4.0.0" + }, + "autoload": { + "psr-4": { + "Dflydev\\DotAccessData\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Dflydev\\DotAccessData\\": "tests/" + } + }, + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "scripts": { + "phpcs": "phpcs", + "phpstan": "phpstan analyse", + "phpunit": "phpunit --no-coverage", + "psalm": "psalm", + "test": [ + "@phpcs", + "@phpstan", + "@psalm", + "@phpunit" + ] + } +} diff --git a/vendor/dflydev/dot-access-data/src/Data.php b/vendor/dflydev/dot-access-data/src/Data.php new file mode 100644 index 00000000..3409b8e5 --- /dev/null +++ b/vendor/dflydev/dot-access-data/src/Data.php @@ -0,0 +1,286 @@ + + */ +class Data implements DataInterface, ArrayAccess +{ + private const DELIMITERS = ['.', '/']; + + /** + * Internal representation of data data + * + * @var array + */ + protected $data; + + /** + * Constructor + * + * @param array $data + */ + public function __construct(array $data = []) + { + $this->data = $data; + } + + /** + * {@inheritdoc} + */ + public function append(string $key, $value = null): void + { + $currentValue =& $this->data; + $keyPath = self::keyToPathArray($key); + + $endKey = array_pop($keyPath); + foreach ($keyPath as $currentKey) { + if (! isset($currentValue[$currentKey])) { + $currentValue[$currentKey] = []; + } + $currentValue =& $currentValue[$currentKey]; + } + + if (!isset($currentValue[$endKey])) { + $currentValue[$endKey] = []; + } + + if (!is_array($currentValue[$endKey])) { + // Promote this key to an array. + // TODO: Is this really what we want to do? + $currentValue[$endKey] = [$currentValue[$endKey]]; + } + + $currentValue[$endKey][] = $value; + } + + /** + * {@inheritdoc} + */ + public function set(string $key, $value = null): void + { + $currentValue =& $this->data; + $keyPath = self::keyToPathArray($key); + + $endKey = array_pop($keyPath); + foreach ($keyPath as $currentKey) { + if (!isset($currentValue[$currentKey])) { + $currentValue[$currentKey] = []; + } + if (!is_array($currentValue[$currentKey])) { + throw new DataException(sprintf('Key path "%s" within "%s" cannot be indexed into (is not an array)', $currentKey, self::formatPath($key))); + } + $currentValue =& $currentValue[$currentKey]; + } + $currentValue[$endKey] = $value; + } + + /** + * {@inheritdoc} + */ + public function remove(string $key): void + { + $currentValue =& $this->data; + $keyPath = self::keyToPathArray($key); + + $endKey = array_pop($keyPath); + foreach ($keyPath as $currentKey) { + if (!isset($currentValue[$currentKey])) { + return; + } + $currentValue =& $currentValue[$currentKey]; + } + unset($currentValue[$endKey]); + } + + /** + * {@inheritdoc} + * + * @psalm-mutation-free + */ + public function get(string $key, $default = null) + { + /** @psalm-suppress ImpureFunctionCall */ + $hasDefault = \func_num_args() > 1; + + $currentValue = $this->data; + $keyPath = self::keyToPathArray($key); + + foreach ($keyPath as $currentKey) { + if (!is_array($currentValue) || !array_key_exists($currentKey, $currentValue)) { + if ($hasDefault) { + return $default; + } + + throw new MissingPathException($key, sprintf('No data exists at the given path: "%s"', self::formatPath($keyPath))); + } + + $currentValue = $currentValue[$currentKey]; + } + + return $currentValue === null ? $default : $currentValue; + } + + /** + * {@inheritdoc} + * + * @psalm-mutation-free + */ + public function has(string $key): bool + { + $currentValue = $this->data; + + foreach (self::keyToPathArray($key) as $currentKey) { + if ( + !is_array($currentValue) || + !array_key_exists($currentKey, $currentValue) + ) { + return false; + } + $currentValue = $currentValue[$currentKey]; + } + + return true; + } + + /** + * {@inheritdoc} + * + * @psalm-mutation-free + */ + public function getData(string $key): DataInterface + { + $value = $this->get($key); + if (is_array($value) && Util::isAssoc($value)) { + return new Data($value); + } + + throw new DataException(sprintf('Value at "%s" could not be represented as a DataInterface', self::formatPath($key))); + } + + /** + * {@inheritdoc} + */ + public function import(array $data, int $mode = self::REPLACE): void + { + $this->data = Util::mergeAssocArray($this->data, $data, $mode); + } + + /** + * {@inheritdoc} + */ + public function importData(DataInterface $data, int $mode = self::REPLACE): void + { + $this->import($data->export(), $mode); + } + + /** + * {@inheritdoc} + * + * @psalm-mutation-free + */ + public function export(): array + { + return $this->data; + } + + /** + * {@inheritdoc} + * + * @return bool + */ + #[\ReturnTypeWillChange] + public function offsetExists($key) + { + return $this->has($key); + } + + /** + * {@inheritdoc} + * + * @return mixed + */ + #[\ReturnTypeWillChange] + public function offsetGet($key) + { + return $this->get($key, null); + } + + /** + * {@inheritdoc} + * + * @param string $key + * @param mixed $value + * + * @return void + */ + #[\ReturnTypeWillChange] + public function offsetSet($key, $value) + { + $this->set($key, $value); + } + + /** + * {@inheritdoc} + * + * @return void + */ + #[\ReturnTypeWillChange] + public function offsetUnset($key) + { + $this->remove($key); + } + + /** + * @param string $path + * + * @return string[] + * + * @psalm-return non-empty-list + * + * @psalm-pure + */ + protected static function keyToPathArray(string $path): array + { + if (\strlen($path) === 0) { + throw new InvalidPathException('Path cannot be an empty string'); + } + + $path = \str_replace(self::DELIMITERS, '.', $path); + + return \explode('.', $path); + } + + /** + * @param string|string[] $path + * + * @return string + * + * @psalm-pure + */ + protected static function formatPath($path): string + { + if (is_string($path)) { + $path = self::keyToPathArray($path); + } + + return implode(' » ', $path); + } +} diff --git a/vendor/dflydev/dot-access-data/src/DataInterface.php b/vendor/dflydev/dot-access-data/src/DataInterface.php new file mode 100644 index 00000000..5909a8c6 --- /dev/null +++ b/vendor/dflydev/dot-access-data/src/DataInterface.php @@ -0,0 +1,131 @@ + $data + * @param self::PRESERVE|self::REPLACE|self::MERGE $mode + */ + public function import(array $data, int $mode = self::REPLACE): void; + + /** + * Import data from an external data into existing data + * + * @param DataInterface $data + * @param self::PRESERVE|self::REPLACE|self::MERGE $mode + */ + public function importData(DataInterface $data, int $mode = self::REPLACE): void; + + /** + * Export data as raw data + * + * @return array + * + * @psalm-mutation-free + */ + public function export(): array; +} diff --git a/vendor/dflydev/dot-access-data/src/Exception/DataException.php b/vendor/dflydev/dot-access-data/src/Exception/DataException.php new file mode 100644 index 00000000..2faf9f54 --- /dev/null +++ b/vendor/dflydev/dot-access-data/src/Exception/DataException.php @@ -0,0 +1,21 @@ +path = $path; + + parent::__construct($message, $code, $previous); + } + + public function getPath(): string + { + return $this->path; + } +} diff --git a/vendor/dflydev/dot-access-data/src/Util.php b/vendor/dflydev/dot-access-data/src/Util.php new file mode 100644 index 00000000..5634c511 --- /dev/null +++ b/vendor/dflydev/dot-access-data/src/Util.php @@ -0,0 +1,78 @@ + $arr + * + * @return bool + * + * @psalm-pure + */ + public static function isAssoc(array $arr): bool + { + return !count($arr) || count(array_filter(array_keys($arr), 'is_string')) == count($arr); + } + + /** + * Merge contents from one associtative array to another + * + * @param mixed $to + * @param mixed $from + * @param DataInterface::PRESERVE|DataInterface::REPLACE|DataInterface::MERGE $mode + * + * @return mixed + * + * @psalm-pure + */ + public static function mergeAssocArray($to, $from, int $mode = DataInterface::REPLACE) + { + if ($mode === DataInterface::MERGE && self::isList($to) && self::isList($from)) { + return array_merge($to, $from); + } + + if (is_array($from) && is_array($to)) { + foreach ($from as $k => $v) { + if (!isset($to[$k])) { + $to[$k] = $v; + } else { + $to[$k] = self::mergeAssocArray($to[$k], $v, $mode); + } + } + + return $to; + } + + return $mode === DataInterface::PRESERVE ? $to : $from; + } + + /** + * @param mixed $value + * + * @return bool + * + * @psalm-pure + */ + private static function isList($value): bool + { + return is_array($value) && array_values($value) === $value; + } +} diff --git a/vendor/doctrine/inflector/LICENSE b/vendor/doctrine/inflector/LICENSE new file mode 100644 index 00000000..8c38cc1b --- /dev/null +++ b/vendor/doctrine/inflector/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2006-2015 Doctrine Project + +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/vendor/doctrine/inflector/README.md b/vendor/doctrine/inflector/README.md new file mode 100644 index 00000000..6e3a97f7 --- /dev/null +++ b/vendor/doctrine/inflector/README.md @@ -0,0 +1,7 @@ +# Doctrine Inflector + +Doctrine Inflector is a small library that can perform string manipulations +with regard to uppercase/lowercase and singular/plural forms of words. + +[![Build Status](https://github.com/doctrine/inflector/workflows/Continuous%20Integration/badge.svg)](https://github.com/doctrine/inflector/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A4.0.x) +[![Code Coverage](https://codecov.io/gh/doctrine/inflector/branch/2.0.x/graph/badge.svg)](https://codecov.io/gh/doctrine/inflector/branch/2.0.x) diff --git a/vendor/doctrine/inflector/composer.json b/vendor/doctrine/inflector/composer.json new file mode 100644 index 00000000..91d77071 --- /dev/null +++ b/vendor/doctrine/inflector/composer.json @@ -0,0 +1,41 @@ +{ + "name": "doctrine/inflector", + "type": "library", + "description": "PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.", + "keywords": ["php", "strings", "words", "manipulation", "inflector", "inflection", "uppercase", "lowercase", "singular", "plural"], + "homepage": "https://www.doctrine-project.org/projects/inflector.html", + "license": "MIT", + "authors": [ + {"name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com"}, + {"name": "Roman Borschel", "email": "roman@code-factory.org"}, + {"name": "Benjamin Eberlei", "email": "kontakt@beberlei.de"}, + {"name": "Jonathan Wage", "email": "jonwage@gmail.com"}, + {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"} + ], + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^11.0", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.3", + "phpunit/phpunit": "^8.5 || ^9.5", + "vimeo/psalm": "^4.25 || ^5.4" + }, + "autoload": { + "psr-4": { + "Doctrine\\Inflector\\": "lib/Doctrine/Inflector" + } + }, + "autoload-dev": { + "psr-4": { + "Doctrine\\Tests\\Inflector\\": "tests/Doctrine/Tests/Inflector" + } + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + } +} diff --git a/vendor/doctrine/inflector/docs/en/index.rst b/vendor/doctrine/inflector/docs/en/index.rst new file mode 100644 index 00000000..29866f4d --- /dev/null +++ b/vendor/doctrine/inflector/docs/en/index.rst @@ -0,0 +1,226 @@ +Introduction +============ + +The Doctrine Inflector has methods for inflecting text. The features include pluralization, +singularization, converting between camelCase and under_score and capitalizing +words. + +Installation +============ + +You can install the Inflector with composer: + +.. code-block:: console + + $ composer require doctrine/inflector + +Usage +===== + +Using the inflector is easy, you can create a new ``Doctrine\Inflector\Inflector`` instance by using +the ``Doctrine\Inflector\InflectorFactory`` class: + +.. code-block:: php + + use Doctrine\Inflector\InflectorFactory; + + $inflector = InflectorFactory::create()->build(); + +By default it will create an English inflector. If you want to use another language, just pass the language +you want to create an inflector for to the ``createForLanguage()`` method: + +.. code-block:: php + + use Doctrine\Inflector\InflectorFactory; + use Doctrine\Inflector\Language; + + $inflector = InflectorFactory::createForLanguage(Language::SPANISH)->build(); + +The supported languages are as follows: + +- ``Language::ENGLISH`` +- ``Language::FRENCH`` +- ``Language::NORWEGIAN_BOKMAL`` +- ``Language::PORTUGUESE`` +- ``Language::SPANISH`` +- ``Language::TURKISH`` + +If you want to manually construct the inflector instead of using a factory, you can do so like this: + +.. code-block:: php + + use Doctrine\Inflector\CachedWordInflector; + use Doctrine\Inflector\RulesetInflector; + use Doctrine\Inflector\Rules\English; + + $inflector = new Inflector( + new CachedWordInflector(new RulesetInflector( + English\Rules::getSingularRuleset() + )), + new CachedWordInflector(new RulesetInflector( + English\Rules::getPluralRuleset() + )) + ); + +Adding Languages +---------------- + +If you are interested in adding support for your language, take a look at the other languages defined in the +``Doctrine\Inflector\Rules`` namespace and the tests located in ``Doctrine\Tests\Inflector\Rules``. You can copy +one of the languages and update the rules for your language. + +Once you have done this, send a pull request to the ``doctrine/inflector`` repository with the additions. + +Custom Setup +============ + +If you want to setup custom singular and plural rules, you can configure these in the factory: + +.. code-block:: php + + use Doctrine\Inflector\InflectorFactory; + use Doctrine\Inflector\Rules\Pattern; + use Doctrine\Inflector\Rules\Patterns; + use Doctrine\Inflector\Rules\Ruleset; + use Doctrine\Inflector\Rules\Substitution; + use Doctrine\Inflector\Rules\Substitutions; + use Doctrine\Inflector\Rules\Transformation; + use Doctrine\Inflector\Rules\Transformations; + use Doctrine\Inflector\Rules\Word; + + $inflector = InflectorFactory::create() + ->withSingularRules( + new Ruleset( + new Transformations( + new Transformation(new Pattern('/^(bil)er$/i'), '\1'), + new Transformation(new Pattern('/^(inflec|contribu)tors$/i'), '\1ta') + ), + new Patterns(new Pattern('singulars')), + new Substitutions(new Substitution(new Word('spins'), new Word('spinor'))) + ) + ) + ->withPluralRules( + new Ruleset( + new Transformations( + new Transformation(new Pattern('^(bil)er$'), '\1'), + new Transformation(new Pattern('^(inflec|contribu)tors$'), '\1ta') + ), + new Patterns(new Pattern('noflect'), new Pattern('abtuse')), + new Substitutions( + new Substitution(new Word('amaze'), new Word('amazable')), + new Substitution(new Word('phone'), new Word('phonezes')) + ) + ) + ) + ->build(); + +No operation inflector +---------------------- + +The ``Doctrine\Inflector\NoopWordInflector`` may be used to configure an inflector that doesn't perform any operation for +pluralization and/or singularization. If will simply return the input as output. + +This is an implementation of the `Null Object design pattern `_. + +.. code-block:: php + + use Doctrine\Inflector\Inflector; + use Doctrine\Inflector\NoopWordInflector; + + $inflector = new Inflector(new NoopWordInflector(), new NoopWordInflector()); + +Tableize +======== + +Converts ``ModelName`` to ``model_name``: + +.. code-block:: php + + echo $inflector->tableize('ModelName'); // model_name + +Classify +======== + +Converts ``model_name`` to ``ModelName``: + +.. code-block:: php + + echo $inflector->classify('model_name'); // ModelName + +Camelize +======== + +This method uses `Classify`_ and then converts the first character to lowercase: + +.. code-block:: php + + echo $inflector->camelize('model_name'); // modelName + +Capitalize +========== + +Takes a string and capitalizes all of the words, like PHP's built-in +``ucwords`` function. This extends that behavior, however, by allowing the +word delimiters to be configured, rather than only separating on +whitespace. + +Here is an example: + +.. code-block:: php + + $string = 'top-o-the-morning to all_of_you!'; + + echo $inflector->capitalize($string); // Top-O-The-Morning To All_of_you! + + echo $inflector->capitalize($string, '-_ '); // Top-O-The-Morning To All_Of_You! + +Pluralize +========= + +Returns a word in plural form. + +.. code-block:: php + + echo $inflector->pluralize('browser'); // browsers + +Singularize +=========== + +Returns a word in singular form. + +.. code-block:: php + + echo $inflector->singularize('browsers'); // browser + +Urlize +====== + +Generate a URL friendly string from a string of text: + +.. code-block:: php + + echo $inflector->urlize('My first blog post'); // my-first-blog-post + +Unaccent +======== + +You can unaccent a string of text using the ``unaccent()`` method: + +.. code-block:: php + + echo $inflector->unaccent('año'); // ano + +Legacy API +========== + +The API present in Inflector 1.x is still available, but will be deprecated in a future release and dropped for 3.0. +Support for languages other than English is available in the 2.0 API only. + +Acknowledgements +================ + +The language rules in this library have been adapted from several different sources, including but not limited to: + +- `Ruby On Rails Inflector `_ +- `ICanBoogie Inflector `_ +- `CakePHP Inflector `_ diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/CachedWordInflector.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/CachedWordInflector.php new file mode 100644 index 00000000..2d529087 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/CachedWordInflector.php @@ -0,0 +1,24 @@ +wordInflector = $wordInflector; + } + + public function inflect(string $word): string + { + return $this->cache[$word] ?? $this->cache[$word] = $this->wordInflector->inflect($word); + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/GenericLanguageInflectorFactory.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/GenericLanguageInflectorFactory.php new file mode 100644 index 00000000..166061d2 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/GenericLanguageInflectorFactory.php @@ -0,0 +1,66 @@ +singularRulesets[] = $this->getSingularRuleset(); + $this->pluralRulesets[] = $this->getPluralRuleset(); + } + + final public function build(): Inflector + { + return new Inflector( + new CachedWordInflector(new RulesetInflector( + ...$this->singularRulesets + )), + new CachedWordInflector(new RulesetInflector( + ...$this->pluralRulesets + )) + ); + } + + final public function withSingularRules(?Ruleset $singularRules, bool $reset = false): LanguageInflectorFactory + { + if ($reset) { + $this->singularRulesets = []; + } + + if ($singularRules instanceof Ruleset) { + array_unshift($this->singularRulesets, $singularRules); + } + + return $this; + } + + final public function withPluralRules(?Ruleset $pluralRules, bool $reset = false): LanguageInflectorFactory + { + if ($reset) { + $this->pluralRulesets = []; + } + + if ($pluralRules instanceof Ruleset) { + array_unshift($this->pluralRulesets, $pluralRules); + } + + return $this; + } + + abstract protected function getSingularRuleset(): Ruleset; + + abstract protected function getPluralRuleset(): Ruleset; +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Inflector.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Inflector.php new file mode 100644 index 00000000..610a4cf4 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Inflector.php @@ -0,0 +1,507 @@ + 'A', + 'Á' => 'A', + 'Â' => 'A', + 'Ã' => 'A', + 'Ä' => 'Ae', + 'Æ' => 'Ae', + 'Å' => 'Aa', + 'æ' => 'a', + 'Ç' => 'C', + 'È' => 'E', + 'É' => 'E', + 'Ê' => 'E', + 'Ë' => 'E', + 'Ì' => 'I', + 'Í' => 'I', + 'Î' => 'I', + 'Ï' => 'I', + 'Ñ' => 'N', + 'Ò' => 'O', + 'Ó' => 'O', + 'Ô' => 'O', + 'Õ' => 'O', + 'Ö' => 'Oe', + 'Ù' => 'U', + 'Ú' => 'U', + 'Û' => 'U', + 'Ü' => 'Ue', + 'Ý' => 'Y', + 'ß' => 'ss', + 'à' => 'a', + 'á' => 'a', + 'â' => 'a', + 'ã' => 'a', + 'ä' => 'ae', + 'å' => 'aa', + 'ç' => 'c', + 'è' => 'e', + 'é' => 'e', + 'ê' => 'e', + 'ë' => 'e', + 'ì' => 'i', + 'í' => 'i', + 'î' => 'i', + 'ï' => 'i', + 'ñ' => 'n', + 'ò' => 'o', + 'ó' => 'o', + 'ô' => 'o', + 'õ' => 'o', + 'ö' => 'oe', + 'ù' => 'u', + 'ú' => 'u', + 'û' => 'u', + 'ü' => 'ue', + 'ý' => 'y', + 'ÿ' => 'y', + 'Ā' => 'A', + 'ā' => 'a', + 'Ă' => 'A', + 'ă' => 'a', + 'Ą' => 'A', + 'ą' => 'a', + 'Ć' => 'C', + 'ć' => 'c', + 'Ĉ' => 'C', + 'ĉ' => 'c', + 'Ċ' => 'C', + 'ċ' => 'c', + 'Č' => 'C', + 'č' => 'c', + 'Ď' => 'D', + 'ď' => 'd', + 'Đ' => 'D', + 'đ' => 'd', + 'Ē' => 'E', + 'ē' => 'e', + 'Ĕ' => 'E', + 'ĕ' => 'e', + 'Ė' => 'E', + 'ė' => 'e', + 'Ę' => 'E', + 'ę' => 'e', + 'Ě' => 'E', + 'ě' => 'e', + 'Ĝ' => 'G', + 'ĝ' => 'g', + 'Ğ' => 'G', + 'ğ' => 'g', + 'Ġ' => 'G', + 'ġ' => 'g', + 'Ģ' => 'G', + 'ģ' => 'g', + 'Ĥ' => 'H', + 'ĥ' => 'h', + 'Ħ' => 'H', + 'ħ' => 'h', + 'Ĩ' => 'I', + 'ĩ' => 'i', + 'Ī' => 'I', + 'ī' => 'i', + 'Ĭ' => 'I', + 'ĭ' => 'i', + 'Į' => 'I', + 'į' => 'i', + 'İ' => 'I', + 'ı' => 'i', + 'IJ' => 'IJ', + 'ij' => 'ij', + 'Ĵ' => 'J', + 'ĵ' => 'j', + 'Ķ' => 'K', + 'ķ' => 'k', + 'ĸ' => 'k', + 'Ĺ' => 'L', + 'ĺ' => 'l', + 'Ļ' => 'L', + 'ļ' => 'l', + 'Ľ' => 'L', + 'ľ' => 'l', + 'Ŀ' => 'L', + 'ŀ' => 'l', + 'Ł' => 'L', + 'ł' => 'l', + 'Ń' => 'N', + 'ń' => 'n', + 'Ņ' => 'N', + 'ņ' => 'n', + 'Ň' => 'N', + 'ň' => 'n', + 'ʼn' => 'N', + 'Ŋ' => 'n', + 'ŋ' => 'N', + 'Ō' => 'O', + 'ō' => 'o', + 'Ŏ' => 'O', + 'ŏ' => 'o', + 'Ő' => 'O', + 'ő' => 'o', + 'Œ' => 'OE', + 'œ' => 'oe', + 'Ø' => 'O', + 'ø' => 'o', + 'Ŕ' => 'R', + 'ŕ' => 'r', + 'Ŗ' => 'R', + 'ŗ' => 'r', + 'Ř' => 'R', + 'ř' => 'r', + 'Ś' => 'S', + 'ś' => 's', + 'Ŝ' => 'S', + 'ŝ' => 's', + 'Ş' => 'S', + 'ş' => 's', + 'Š' => 'S', + 'š' => 's', + 'Ţ' => 'T', + 'ţ' => 't', + 'Ť' => 'T', + 'ť' => 't', + 'Ŧ' => 'T', + 'ŧ' => 't', + 'Ũ' => 'U', + 'ũ' => 'u', + 'Ū' => 'U', + 'ū' => 'u', + 'Ŭ' => 'U', + 'ŭ' => 'u', + 'Ů' => 'U', + 'ů' => 'u', + 'Ű' => 'U', + 'ű' => 'u', + 'Ų' => 'U', + 'ų' => 'u', + 'Ŵ' => 'W', + 'ŵ' => 'w', + 'Ŷ' => 'Y', + 'ŷ' => 'y', + 'Ÿ' => 'Y', + 'Ź' => 'Z', + 'ź' => 'z', + 'Ż' => 'Z', + 'ż' => 'z', + 'Ž' => 'Z', + 'ž' => 'z', + 'ſ' => 's', + '€' => 'E', + '£' => '', + ]; + + /** @var WordInflector */ + private $singularizer; + + /** @var WordInflector */ + private $pluralizer; + + public function __construct(WordInflector $singularizer, WordInflector $pluralizer) + { + $this->singularizer = $singularizer; + $this->pluralizer = $pluralizer; + } + + /** + * Converts a word into the format for a Doctrine table name. Converts 'ModelName' to 'model_name'. + */ + public function tableize(string $word): string + { + $tableized = preg_replace('~(?<=\\w)([A-Z])~u', '_$1', $word); + + if ($tableized === null) { + throw new RuntimeException(sprintf( + 'preg_replace returned null for value "%s"', + $word + )); + } + + return mb_strtolower($tableized); + } + + /** + * Converts a word into the format for a Doctrine class name. Converts 'table_name' to 'TableName'. + */ + public function classify(string $word): string + { + return str_replace([' ', '_', '-'], '', ucwords($word, ' _-')); + } + + /** + * Camelizes a word. This uses the classify() method and turns the first character to lowercase. + */ + public function camelize(string $word): string + { + return lcfirst($this->classify($word)); + } + + /** + * Uppercases words with configurable delimiters between words. + * + * Takes a string and capitalizes all of the words, like PHP's built-in + * ucwords function. This extends that behavior, however, by allowing the + * word delimiters to be configured, rather than only separating on + * whitespace. + * + * Here is an example: + * + * capitalize($string); + * // Top-O-The-Morning To All_of_you! + * + * echo $inflector->capitalize($string, '-_ '); + * // Top-O-The-Morning To All_Of_You! + * ?> + * + * + * @param string $string The string to operate on. + * @param string $delimiters A list of word separators. + * + * @return string The string with all delimiter-separated words capitalized. + */ + public function capitalize(string $string, string $delimiters = " \n\t\r\0\x0B-"): string + { + return ucwords($string, $delimiters); + } + + /** + * Checks if the given string seems like it has utf8 characters in it. + * + * @param string $string The string to check for utf8 characters in. + */ + public function seemsUtf8(string $string): bool + { + for ($i = 0; $i < strlen($string); $i++) { + if (ord($string[$i]) < 0x80) { + continue; // 0bbbbbbb + } + + if ((ord($string[$i]) & 0xE0) === 0xC0) { + $n = 1; // 110bbbbb + } elseif ((ord($string[$i]) & 0xF0) === 0xE0) { + $n = 2; // 1110bbbb + } elseif ((ord($string[$i]) & 0xF8) === 0xF0) { + $n = 3; // 11110bbb + } elseif ((ord($string[$i]) & 0xFC) === 0xF8) { + $n = 4; // 111110bb + } elseif ((ord($string[$i]) & 0xFE) === 0xFC) { + $n = 5; // 1111110b + } else { + return false; // Does not match any model + } + + for ($j = 0; $j < $n; $j++) { // n bytes matching 10bbbbbb follow ? + if (++$i === strlen($string) || ((ord($string[$i]) & 0xC0) !== 0x80)) { + return false; + } + } + } + + return true; + } + + /** + * Remove any illegal characters, accents, etc. + * + * @param string $string String to unaccent + * + * @return string Unaccented string + */ + public function unaccent(string $string): string + { + if (preg_match('/[\x80-\xff]/', $string) === false) { + return $string; + } + + if ($this->seemsUtf8($string)) { + $string = strtr($string, self::ACCENTED_CHARACTERS); + } else { + $characters = []; + + // Assume ISO-8859-1 if not UTF-8 + $characters['in'] = + chr(128) + . chr(131) + . chr(138) + . chr(142) + . chr(154) + . chr(158) + . chr(159) + . chr(162) + . chr(165) + . chr(181) + . chr(192) + . chr(193) + . chr(194) + . chr(195) + . chr(196) + . chr(197) + . chr(199) + . chr(200) + . chr(201) + . chr(202) + . chr(203) + . chr(204) + . chr(205) + . chr(206) + . chr(207) + . chr(209) + . chr(210) + . chr(211) + . chr(212) + . chr(213) + . chr(214) + . chr(216) + . chr(217) + . chr(218) + . chr(219) + . chr(220) + . chr(221) + . chr(224) + . chr(225) + . chr(226) + . chr(227) + . chr(228) + . chr(229) + . chr(231) + . chr(232) + . chr(233) + . chr(234) + . chr(235) + . chr(236) + . chr(237) + . chr(238) + . chr(239) + . chr(241) + . chr(242) + . chr(243) + . chr(244) + . chr(245) + . chr(246) + . chr(248) + . chr(249) + . chr(250) + . chr(251) + . chr(252) + . chr(253) + . chr(255); + + $characters['out'] = 'EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy'; + + $string = strtr($string, $characters['in'], $characters['out']); + + $doubleChars = []; + + $doubleChars['in'] = [ + chr(140), + chr(156), + chr(198), + chr(208), + chr(222), + chr(223), + chr(230), + chr(240), + chr(254), + ]; + + $doubleChars['out'] = ['OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th']; + + $string = str_replace($doubleChars['in'], $doubleChars['out'], $string); + } + + return $string; + } + + /** + * Convert any passed string to a url friendly string. + * Converts 'My first blog post' to 'my-first-blog-post' + * + * @param string $string String to urlize. + * + * @return string Urlized string. + */ + public function urlize(string $string): string + { + // Remove all non url friendly characters with the unaccent function + $unaccented = $this->unaccent($string); + + if (function_exists('mb_strtolower')) { + $lowered = mb_strtolower($unaccented); + } else { + $lowered = strtolower($unaccented); + } + + $replacements = [ + '/\W/' => ' ', + '/([A-Z]+)([A-Z][a-z])/' => '\1_\2', + '/([a-z\d])([A-Z])/' => '\1_\2', + '/[^A-Z^a-z^0-9^\/]+/' => '-', + ]; + + $urlized = $lowered; + + foreach ($replacements as $pattern => $replacement) { + $replaced = preg_replace($pattern, $replacement, $urlized); + + if ($replaced === null) { + throw new RuntimeException(sprintf( + 'preg_replace returned null for value "%s"', + $urlized + )); + } + + $urlized = $replaced; + } + + return trim($urlized, '-'); + } + + /** + * Returns a word in singular form. + * + * @param string $word The word in plural form. + * + * @return string The word in singular form. + */ + public function singularize(string $word): string + { + return $this->singularizer->inflect($word); + } + + /** + * Returns a word in plural form. + * + * @param string $word The word in singular form. + * + * @return string The word in plural form. + */ + public function pluralize(string $word): string + { + return $this->pluralizer->inflect($word); + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/InflectorFactory.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/InflectorFactory.php new file mode 100644 index 00000000..a0740a74 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/InflectorFactory.php @@ -0,0 +1,52 @@ +getFlippedSubstitutions() + ); + } + + public static function getPluralRuleset(): Ruleset + { + return new Ruleset( + new Transformations(...Inflectible::getPlural()), + new Patterns(...Uninflected::getPlural()), + new Substitutions(...Inflectible::getIrregular()) + ); + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/English/Uninflected.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/English/Uninflected.php new file mode 100644 index 00000000..02257de1 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/English/Uninflected.php @@ -0,0 +1,189 @@ +getFlippedSubstitutions() + ); + } + + public static function getPluralRuleset(): Ruleset + { + return new Ruleset( + new Transformations(...Inflectible::getPlural()), + new Patterns(...Uninflected::getPlural()), + new Substitutions(...Inflectible::getIrregular()) + ); + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/French/Uninflected.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/French/Uninflected.php new file mode 100644 index 00000000..9747f919 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/French/Uninflected.php @@ -0,0 +1,28 @@ +getFlippedSubstitutions() + ); + } + + public static function getPluralRuleset(): Ruleset + { + return new Ruleset( + new Transformations(...Inflectible::getPlural()), + new Patterns(...Uninflected::getPlural()), + new Substitutions(...Inflectible::getIrregular()) + ); + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/NorwegianBokmal/Uninflected.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/NorwegianBokmal/Uninflected.php new file mode 100644 index 00000000..5d8d3b3a --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/NorwegianBokmal/Uninflected.php @@ -0,0 +1,30 @@ +pattern = $pattern; + + if (isset($this->pattern[0]) && $this->pattern[0] === '/') { + $this->regex = $this->pattern; + } else { + $this->regex = '/' . $this->pattern . '/i'; + } + } + + public function getPattern(): string + { + return $this->pattern; + } + + public function getRegex(): string + { + return $this->regex; + } + + public function matches(string $word): bool + { + return preg_match($this->getRegex(), $word) === 1; + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Patterns.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Patterns.php new file mode 100644 index 00000000..e8d45cb7 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Patterns.php @@ -0,0 +1,34 @@ +patterns = $patterns; + + $patterns = array_map(static function (Pattern $pattern): string { + return $pattern->getPattern(); + }, $this->patterns); + + $this->regex = '/^(?:' . implode('|', $patterns) . ')$/i'; + } + + public function matches(string $word): bool + { + return preg_match($this->regex, $word, $regs) === 1; + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Portuguese/Inflectible.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Portuguese/Inflectible.php new file mode 100644 index 00000000..0d41fe7e --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Portuguese/Inflectible.php @@ -0,0 +1,98 @@ +getFlippedSubstitutions() + ); + } + + public static function getPluralRuleset(): Ruleset + { + return new Ruleset( + new Transformations(...Inflectible::getPlural()), + new Patterns(...Uninflected::getPlural()), + new Substitutions(...Inflectible::getIrregular()) + ); + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Portuguese/Uninflected.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Portuguese/Uninflected.php new file mode 100644 index 00000000..b8e988f8 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Portuguese/Uninflected.php @@ -0,0 +1,32 @@ +regular = $regular; + $this->uninflected = $uninflected; + $this->irregular = $irregular; + } + + public function getRegular(): Transformations + { + return $this->regular; + } + + public function getUninflected(): Patterns + { + return $this->uninflected; + } + + public function getIrregular(): Substitutions + { + return $this->irregular; + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Spanish/Inflectible.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Spanish/Inflectible.php new file mode 100644 index 00000000..91294609 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Spanish/Inflectible.php @@ -0,0 +1,47 @@ +getFlippedSubstitutions() + ); + } + + public static function getPluralRuleset(): Ruleset + { + return new Ruleset( + new Transformations(...Inflectible::getPlural()), + new Patterns(...Uninflected::getPlural()), + new Substitutions(...Inflectible::getIrregular()) + ); + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Spanish/Uninflected.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Spanish/Uninflected.php new file mode 100644 index 00000000..c26ebe9c --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Spanish/Uninflected.php @@ -0,0 +1,30 @@ +from = $from; + $this->to = $to; + } + + public function getFrom(): Word + { + return $this->from; + } + + public function getTo(): Word + { + return $this->to; + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Substitutions.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Substitutions.php new file mode 100644 index 00000000..17ee2961 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Substitutions.php @@ -0,0 +1,57 @@ +substitutions[$substitution->getFrom()->getWord()] = $substitution; + } + } + + public function getFlippedSubstitutions(): Substitutions + { + $substitutions = []; + + foreach ($this->substitutions as $substitution) { + $substitutions[] = new Substitution( + $substitution->getTo(), + $substitution->getFrom() + ); + } + + return new Substitutions(...$substitutions); + } + + public function inflect(string $word): string + { + $lowerWord = strtolower($word); + + if (isset($this->substitutions[$lowerWord])) { + $firstLetterUppercase = $lowerWord[0] !== $word[0]; + + $toWord = $this->substitutions[$lowerWord]->getTo()->getWord(); + + if ($firstLetterUppercase) { + return strtoupper($toWord[0]) . substr($toWord, 1); + } + + return $toWord; + } + + return $word; + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Transformation.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Transformation.php new file mode 100644 index 00000000..30dcd594 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Transformation.php @@ -0,0 +1,39 @@ +pattern = $pattern; + $this->replacement = $replacement; + } + + public function getPattern(): Pattern + { + return $this->pattern; + } + + public function getReplacement(): string + { + return $this->replacement; + } + + public function inflect(string $word): string + { + return (string) preg_replace($this->pattern->getRegex(), $this->replacement, $word); + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Transformations.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Transformations.php new file mode 100644 index 00000000..b6a48fa8 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Transformations.php @@ -0,0 +1,29 @@ +transformations = $transformations; + } + + public function inflect(string $word): string + { + foreach ($this->transformations as $transformation) { + if ($transformation->getPattern()->matches($word)) { + return $transformation->inflect($word); + } + } + + return $word; + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Turkish/Inflectible.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Turkish/Inflectible.php new file mode 100644 index 00000000..a2bda0d9 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Turkish/Inflectible.php @@ -0,0 +1,34 @@ +getFlippedSubstitutions() + ); + } + + public static function getPluralRuleset(): Ruleset + { + return new Ruleset( + new Transformations(...Inflectible::getPlural()), + new Patterns(...Uninflected::getPlural()), + new Substitutions(...Inflectible::getIrregular()) + ); + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Turkish/Uninflected.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Turkish/Uninflected.php new file mode 100644 index 00000000..ec1c37dd --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/Rules/Turkish/Uninflected.php @@ -0,0 +1,30 @@ +word = $word; + } + + public function getWord(): string + { + return $this->word; + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/RulesetInflector.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/RulesetInflector.php new file mode 100644 index 00000000..12b2ed5b --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/RulesetInflector.php @@ -0,0 +1,56 @@ +rulesets = array_merge([$ruleset], $rulesets); + } + + public function inflect(string $word): string + { + if ($word === '') { + return ''; + } + + foreach ($this->rulesets as $ruleset) { + if ($ruleset->getUninflected()->matches($word)) { + return $word; + } + + $inflected = $ruleset->getIrregular()->inflect($word); + + if ($inflected !== $word) { + return $inflected; + } + + $inflected = $ruleset->getRegular()->inflect($word); + + if ($inflected !== $word) { + return $inflected; + } + } + + return $word; + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Inflector/WordInflector.php b/vendor/doctrine/inflector/lib/Doctrine/Inflector/WordInflector.php new file mode 100644 index 00000000..b88b1d69 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Inflector/WordInflector.php @@ -0,0 +1,10 @@ + syntax to be used in parsing (#423) +- Person->name was missing string return type (#424) +- Generate a valid BE TAX number (#415) +- Added the UUID extension to Core (#427) + +## [2021-12-05, v1.17.0](https://github.com/FakerPHP/Faker/compare/v1.16.0..v1.17.0) + +- Partial PHP 8.1 compatibility (#373) +- Add payment provider for `ne_NP` locale (#375) +- Add Egyptian Arabic `ar_EG` locale (#377) +- Updated list of South African TLDs (#383) +- Fixed formatting of E.164 numbers (#380) +- Allow `symfony/deprecation-contracts` `^3.0` (#397) + +## [2021-09-06, v1.16.0](https://github.com/FakerPHP/Faker/compare/v1.15.0..v1.16.0) + +- Add Company extension +- Add Address extension +- Add Person extension +- Add PhoneNumber extension +- Add VersionExtension (#350) +- Stricter types in Extension\Container and Extension\GeneratorAwareExtension (#345) +- Fix deprecated property access in `nl_NL` (#348) +- Add support for `psr/container` >= 2.0 (#354) +- Add missing union types in Faker\Generator (#352) + +## [2021-07-06, v1.15.0](https://github.com/FakerPHP/Faker/compare/v1.14.1..v1.15.0) + +- Updated the generator phpdoc to help identify magic methods (#307) +- Prevent direct access and triggered deprecation warning for "word" (#302) +- Updated length on all global e164 numbers (#301) +- Updated last names from different source (#312) +- Don't generate birth number of '000' for Swedish personal identity (#306) +- Add job list for localization id_ID (#339) + +## [2021-03-30, v1.14.1](https://github.com/FakerPHP/Faker/compare/v1.14.0..v1.14.1) + +- Fix where randomNumber and randomFloat would return a 0 value (#291 / #292) + +## [2021-03-29, v1.14.0](https://github.com/FakerPHP/Faker/compare/v1.13.0..v1.14.0) + +- Fix for realText to ensure the text keeps closer to its boundaries (#152) +- Fix where regexify produces a random character instead of a literal dot (#135 +- Deprecate zh_TW methods that only call base methods (#122) +- Add used extensions to composer.json as suggestion (#120) +- Moved TCNo and INN from calculator to localized providers (#108) +- Fix regex dot/backslash issue where a dot is replaced with a backslash as escape character (#206) +- Deprecate direct property access (#164) +- Added test to assert unique() behaviour (#233) +- Added RUC for the es_PE locale (#244) +- Test IBAN formats for Latin America (AR/PE/VE) (#260) +- Added VAT number for en_GB (#255) +- Added new districts for the ne_NP locale (#258) +- Fix for U.S. Area Code Generation (#261) +- Fix in numerify where a better random numeric value is guaranteed (#256) +- Fix e164PhoneNumber to only generate valid phone numbers with valid country codes (#264) +- Extract fixtures into separate classes (#234) +- Remove french domains that no longer exists (#277) +- Fix error that occurs when getting a polish title (#279) +- Use valid area codes for North America E164 phone numbers (#280) + +- Adding support for extensions and PSR-11 (#154) +- Adding trait for GeneratorAwareExtension (#165) +- Added helper class for extension (#162) +- Added blood extension to core (#232) +- Added barcode extension to core (#252) +- Added number extension (#257) + +- Various code style updates +- Added a note about our breaking change promise (#273) + +## [2020-12-18, v1.13.0](https://github.com/FakerPHP/Faker/compare/v1.12.1..v1.13.0) + +Several fixes and new additions in this release. A lot of cleanup has been done +on the codebase on both tests and consistency. + +- Feature/pl pl license plate (#62) +- Fix greek phone numbers (#16) +- Move AT payment provider logic to de_AT (#72) +- Fix wiktionary links (#73) +- Fix AT person links (#74) +- Fix AT cities (#75) +- Deprecate at_AT providers (#78) +- Add Austrian `ssn()` to `Person` provider (#79) +- Fix typos in id_ID Address (#83) +- Austrian post codes (#86) +- Updated Polish data (#70) +- Improve Austrian social security number generation (#88) +- Move US phone numbers with extension to own method (#91) +- Add UK National Insurance number generator (#89) +- Fix en_SG phone number generator (#100) +- Remove usage of mt_rand (#87) +- Remove whitespace from beginning of el_GR phone numbers (#105) +- Building numbers can not be 0, 00, 000 (#107) +- Add 172.16/12 local IPv4 block (#121) +- Add JCB credit card type (#124) +- Remove json_decode from emoji generation (#123) +- Remove ro street address (#146) + +## [2020-12-11, v1.12.1](https://github.com/FakerPHP/Faker/compare/v1.12.0..v1.12.1) + +This is a security release that prevents a hacker to execute code on the server. + +## [2020-11-23, v1.12.0](https://github.com/FakerPHP/Faker/compare/v1.11.0..v1.12.0) + +- Fix ro_RO first and last day of year calculation offset (#65) +- Fix en_NG locale test namespaces that did not match PSR-4 (#57) +- Added Singapore NRIC/FIN provider (#56) +- Added provider for Lithuanian municipalities (#58) +- Added blood types provider (#61) + +## [2020-11-15, v1.11.0](https://github.com/FakerPHP/Faker/compare/v1.10.1..v1.11.0) + +- Added Provider for Swedish Municipalities +- Updates to person names in pt_BR +- Many code style changes + +## [2020-10-28, v1.10.1](https://github.com/FakerPHP/Faker/compare/v1.10.0..v1.10.1) + +- Updates the Danish addresses in dk_DK +- Removed offense company names in nl_NL +- Clarify changelog with original fork +- Standin replacement for LoremPixel to Placeholder.com (#11) + +## [2020-10-27, v1.10.0](https://github.com/FakerPHP/Faker/compare/v1.9.1..v1.10.0) + +- Support PHP 7.1-8.0 +- Fix typo in de_DE Company Provider +- Fix dateTimeThisYear method +- Fix typo in de_DE jobTitleFormat +- Fix IBAN generation for CR +- Fix typos in greek first names +- Fix US job title typo +- Do not clear entity manager for doctrine orm populator +- Remove persian rude words +- Corrections to RU names + +## 2020-10-27, v1.9.1 + +- Initial version. Same as `fzaninotto/Faker:v1.9.1`. diff --git a/vendor/fakerphp/faker/LICENSE b/vendor/fakerphp/faker/LICENSE new file mode 100644 index 00000000..99ed0075 --- /dev/null +++ b/vendor/fakerphp/faker/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2011 François Zaninotto +Portions Copyright (c) 2008 Caius Durling +Portions Copyright (c) 2008 Adam Royle +Portions Copyright (c) 2008 Fiona Burrows + +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/vendor/fakerphp/faker/README.md b/vendor/fakerphp/faker/README.md new file mode 100644 index 00000000..2c6a2684 --- /dev/null +++ b/vendor/fakerphp/faker/README.md @@ -0,0 +1,114 @@ +

    Social card of FakerPHP

    + +# Faker + +[![Packagist Downloads](https://img.shields.io/packagist/dm/FakerPHP/Faker)](https://packagist.org/packages/fakerphp/faker) +[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/FakerPHP/Faker/Tests/main)](https://github.com/FakerPHP/Faker/actions) +[![Type Coverage](https://shepherd.dev/github/FakerPHP/Faker/coverage.svg)](https://shepherd.dev/github/FakerPHP/Faker) +[![Code Coverage](https://codecov.io/gh/FakerPHP/Faker/branch/main/graph/badge.svg)](https://codecov.io/gh/FakerPHP/Faker) + +Faker is a PHP library that generates fake data for you. Whether you need to bootstrap your database, create good-looking XML documents, fill-in your persistence to stress test it, or anonymize data taken from a production service, Faker is for you. + +It's heavily inspired by Perl's [Data::Faker](https://metacpan.org/pod/Data::Faker), and by Ruby's [Faker](https://rubygems.org/gems/faker). + +## Getting Started + +### Installation + +Faker requires PHP >= 7.4. + +```shell +composer require fakerphp/faker +``` + +### Documentation + +Full documentation can be found over on [fakerphp.github.io](https://fakerphp.github.io). + +### Basic Usage + +Use `Faker\Factory::create()` to create and initialize a Faker generator, which can generate data by accessing methods named after the type of data you want. + +```php +name(); +// 'Vince Sporer' +echo $faker->email(); +// 'walter.sophia@hotmail.com' +echo $faker->text(); +// 'Numquam ut mollitia at consequuntur inventore dolorem.' +``` + +Each call to `$faker->name()` yields a different (random) result. This is because Faker uses `__call()` magic, and forwards `Faker\Generator->$method()` calls to `Faker\Generator->format($method, $attributes)`. + +```php +name() . "\n"; +} + +// 'Cyrus Boyle' +// 'Alena Cummerata' +// 'Orlo Bergstrom' +``` + +## Automated refactoring + +If you already used this library with its properties, they are now deprecated and needs to be replaced by their equivalent methods. + +You can use the provided [Rector](https://github.com/rectorphp/rector) config file to automate the work. + +Run + +```bash +composer require --dev rector/rector +``` + +to install `rector/rector`. + +Run + +```bash +vendor/bin/rector process src/ --config vendor/fakerphp/faker/rector-migrate.php +``` + +to run `rector/rector`. + +*Note:* do not forget to replace `src/` with the path to your source directory. + +Alternatively, import the configuration in your `rector.php` file: + +```php +import('vendor/fakerphp/faker/rector-migrate.php'); +}; +``` + +## License + +Faker is released under the MIT License. See [`LICENSE`](LICENSE) for details. + +## Backward compatibility promise + +Faker is using [Semver](https://semver.org/). This means that versions are tagged +with MAJOR.MINOR.PATCH. Only a new major version will be allowed to break backward +compatibility (BC). + +Classes marked as `@experimental` or `@internal` are not included in our backward compatibility promise. +You are also not guaranteed that the value returned from a method is always the +same. You are guaranteed that the data type will not change. + +PHP 8 introduced [named arguments](https://wiki.php.net/rfc/named_params), which +increased the cost and reduces flexibility for package maintainers. The names of the +arguments for methods in Faker is not included in our BC promise. diff --git a/vendor/fakerphp/faker/composer.json b/vendor/fakerphp/faker/composer.json new file mode 100644 index 00000000..88724f2a --- /dev/null +++ b/vendor/fakerphp/faker/composer.json @@ -0,0 +1,56 @@ +{ + "name": "fakerphp/faker", + "type": "library", + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "faker", + "fixtures", + "data" + ], + "license": "MIT", + "authors": [ + { + "name": "François Zaninotto" + } + ], + "require": { + "php": "^7.4 || ^8.0", + "psr/container": "^1.0 || ^2.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "require-dev": { + "ext-intl": "*", + "bamarni/composer-bin-plugin": "^1.4.1", + "doctrine/persistence": "^1.3 || ^2.0", + "phpunit/phpunit": "^9.5.26", + "symfony/phpunit-bridge": "^5.4.16" + }, + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "autoload-dev": { + "psr-4": { + "Faker\\Test\\": "test/Faker/", + "Faker\\Test\\Fixture\\": "test/Fixture/" + } + }, + "conflict": { + "fzaninotto/faker": "*" + }, + "suggest": { + "ext-curl": "Required by Faker\\Provider\\Image to download images.", + "ext-dom": "Required by Faker\\Provider\\HtmlLorem for generating random HTML.", + "ext-iconv": "Required by Faker\\Provider\\ru_RU\\Text::realText() for generating real Russian text.", + "ext-mbstring": "Required for multibyte Unicode string functionality.", + "doctrine/orm": "Required to use Faker\\ORM\\Doctrine" + }, + "config": { + "allow-plugins": { + "bamarni/composer-bin-plugin": true, + "composer/package-versions-deprecated": true + }, + "sort-packages": true + } +} diff --git a/vendor/fakerphp/faker/rector-migrate.php b/vendor/fakerphp/faker/rector-migrate.php new file mode 100644 index 00000000..7d99b570 --- /dev/null +++ b/vendor/fakerphp/faker/rector-migrate.php @@ -0,0 +1,161 @@ +ruleWithConfiguration( + Transform\Rector\Assign\PropertyFetchToMethodCallRector::class, + array_map(static function (string $property): Transform\ValueObject\PropertyFetchToMethodCall { + return new Transform\ValueObject\PropertyFetchToMethodCall( + Generator::class, + $property, + $property, + ); + }, $properties), + ); +}; diff --git a/vendor/fakerphp/faker/src/Faker/Calculator/Ean.php b/vendor/fakerphp/faker/src/Faker/Calculator/Ean.php new file mode 100644 index 00000000..fbf11fcd --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Calculator/Ean.php @@ -0,0 +1,50 @@ + $digit) { + $sums += ((int) $digit) * $sequence[$n % 2]; + } + + return (10 - $sums % 10) % 10; + } + + /** + * Checks whether the provided number is an EAN compliant number and that + * the checksum is correct. + * + * @param string $ean An EAN number + * + * @return bool + */ + public static function isValid(string $ean) + { + if (!preg_match(self::PATTERN, $ean)) { + return false; + } + + return self::checksum(substr($ean, 0, -1)) === (int) substr($ean, -1); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Calculator/Iban.php b/vendor/fakerphp/faker/src/Faker/Calculator/Iban.php new file mode 100644 index 00000000..19068fd7 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Calculator/Iban.php @@ -0,0 +1,69 @@ += 0; $i -= 2) { + $sum += $number[$i]; + } + + for ($i = $length - 2; $i >= 0; $i -= 2) { + $sum += array_sum(str_split($number[$i] * 2)); + } + + return $sum % 10; + } + + /** + * @return string + */ + public static function computeCheckDigit(string $partialNumber) + { + $checkDigit = self::checksum($partialNumber . '0'); + + if ($checkDigit === 0) { + return '0'; + } + + return (string) (10 - $checkDigit); + } + + /** + * Checks whether a number (partial number + check digit) is Luhn compliant + * + * @return bool + */ + public static function isValid(string $number) + { + return self::checksum($number) === 0; + } + + /** + * Generate a Luhn compliant number. + * + * @return string + */ + public static function generateLuhnNumber(string $partialValue) + { + if (!preg_match('/^\d+$/', $partialValue)) { + throw new \InvalidArgumentException('Argument should be an integer.'); + } + + return $partialValue . Luhn::computeCheckDigit($partialValue); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Calculator/TCNo.php b/vendor/fakerphp/faker/src/Faker/Calculator/TCNo.php new file mode 100644 index 00000000..a75c93e1 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Calculator/TCNo.php @@ -0,0 +1,43 @@ +default = $default; + $this->generator = $generator; + $this->weight = $weight; + } + + public function ext(string $id) + { + return new self($this->generator->ext($id), $this->weight, $this->default); + } + + /** + * Catch and proxy all generator calls but return only valid values + * + * @param string $attribute + * + * @deprecated Use a method instead. + */ + public function __get($attribute) + { + trigger_deprecation('fakerphp/faker', '1.14', 'Accessing property "%s" is deprecated, use "%s()" instead.', $attribute, $attribute); + + return $this->__call($attribute, []); + } + + /** + * @param string $name + * @param array $arguments + */ + public function __call($name, $arguments) + { + if (mt_rand(1, 100) <= (100 * $this->weight)) { + return call_user_func_array([$this->generator, $name], $arguments); + } + + return $this->default; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Container/Container.php b/vendor/fakerphp/faker/src/Faker/Container/Container.php new file mode 100644 index 00000000..9b361845 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Container/Container.php @@ -0,0 +1,139 @@ + + */ + private array $definitions; + + private array $services = []; + + /** + * Create a container object with a set of definitions. The array value MUST + * produce an object that implements Extension. + * + * @param array $definitions + */ + public function __construct(array $definitions) + { + $this->definitions = $definitions; + } + + /** + * Retrieve a definition from the container. + * + * @param string $id + * + * @throws \InvalidArgumentException + * @throws \RuntimeException + * @throws ContainerException + * @throws NotInContainerException + */ + public function get($id): Extension + { + if (!is_string($id)) { + throw new \InvalidArgumentException(sprintf( + 'First argument of %s::get() must be string', + self::class, + )); + } + + if (array_key_exists($id, $this->services)) { + return $this->services[$id]; + } + + if (!$this->has($id)) { + throw new NotInContainerException(sprintf( + 'There is not service with id "%s" in the container.', + $id, + )); + } + + $definition = $this->definitions[$id]; + + $service = $this->getService($id, $definition); + + if (!$service instanceof Extension) { + throw new \RuntimeException(sprintf( + 'Service resolved for identifier "%s" does not implement the %s" interface.', + $id, + Extension::class, + )); + } + + $this->services[$id] = $service; + + return $service; + } + + /** + * Get the service from a definition. + * + * @param callable|object|string $definition + */ + private function getService(string $id, $definition) + { + if (is_callable($definition)) { + try { + return $definition(); + } catch (\Throwable $e) { + throw new ContainerException( + sprintf('Error while invoking callable for "%s"', $id), + 0, + $e, + ); + } + } elseif (is_object($definition)) { + return $definition; + } elseif (is_string($definition)) { + if (class_exists($definition)) { + try { + return new $definition(); + } catch (\Throwable $e) { + throw new ContainerException(sprintf('Could not instantiate class "%s"', $id), 0, $e); + } + } + + throw new ContainerException(sprintf( + 'Could not instantiate class "%s". Class was not found.', + $id, + )); + } else { + throw new ContainerException(sprintf( + 'Invalid type for definition with id "%s"', + $id, + )); + } + } + + /** + * Check if the container contains a given identifier. + * + * @param string $id + * + * @throws \InvalidArgumentException + */ + public function has($id): bool + { + if (!is_string($id)) { + throw new \InvalidArgumentException(sprintf( + 'First argument of %s::get() must be string', + self::class, + )); + } + + return array_key_exists($id, $this->definitions); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Container/ContainerBuilder.php b/vendor/fakerphp/faker/src/Faker/Container/ContainerBuilder.php new file mode 100644 index 00000000..f2545e94 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Container/ContainerBuilder.php @@ -0,0 +1,68 @@ + + */ + private array $definitions = []; + + /** + * @param callable|object|string $definition + * + * @throws \InvalidArgumentException + */ + public function add(string $id, $definition): self + { + if (!is_string($definition) && !is_callable($definition) && !is_object($definition)) { + throw new \InvalidArgumentException(sprintf( + 'First argument to "%s::add()" must be a string, callable or object.', + self::class, + )); + } + + $this->definitions[$id] = $definition; + + return $this; + } + + public function build(): ContainerInterface + { + return new Container($this->definitions); + } + + private static function defaultExtensions(): array + { + return [ + Extension\BarcodeExtension::class => Core\Barcode::class, + Extension\BloodExtension::class => Core\Blood::class, + Extension\ColorExtension::class => Core\Color::class, + Extension\DateTimeExtension::class => Core\DateTime::class, + Extension\FileExtension::class => Core\File::class, + Extension\NumberExtension::class => Core\Number::class, + Extension\UuidExtension::class => Core\Uuid::class, + Extension\VersionExtension::class => Core\Version::class, + ]; + } + + public static function withDefaultExtensions(): self + { + $instance = new self(); + + foreach (self::defaultExtensions() as $id => $definition) { + $instance->add($id, $definition); + } + + return $instance; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Container/ContainerException.php b/vendor/fakerphp/faker/src/Faker/Container/ContainerException.php new file mode 100644 index 00000000..12b3caa0 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Container/ContainerException.php @@ -0,0 +1,14 @@ +numberExtension = $numberExtension ?: new Number(); + } + + private function ean(int $length = 13): string + { + $code = Extension\Helper::numerify(str_repeat('#', $length - 1)); + + return sprintf('%s%s', $code, Calculator\Ean::checksum($code)); + } + + public function ean13(): string + { + return $this->ean(); + } + + public function ean8(): string + { + return $this->ean(8); + } + + public function isbn10(): string + { + $code = Extension\Helper::numerify(str_repeat('#', 9)); + + return sprintf('%s%s', $code, Calculator\Isbn::checksum($code)); + } + + public function isbn13(): string + { + $code = '97' . $this->numberExtension->numberBetween(8, 9) . Extension\Helper::numerify(str_repeat('#', 9)); + + return sprintf('%s%s', $code, Calculator\Ean::checksum($code)); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Core/Blood.php b/vendor/fakerphp/faker/src/Faker/Core/Blood.php new file mode 100644 index 00000000..03e563fc --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Core/Blood.php @@ -0,0 +1,42 @@ +bloodTypes); + } + + public function bloodRh(): string + { + return Extension\Helper::randomElement($this->bloodRhFactors); + } + + public function bloodGroup(): string + { + return sprintf( + '%s%s', + $this->bloodType(), + $this->bloodRh(), + ); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Core/Color.php b/vendor/fakerphp/faker/src/Faker/Core/Color.php new file mode 100644 index 00000000..bd948190 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Core/Color.php @@ -0,0 +1,177 @@ +numberExtension = $numberExtension ?: new Number(); + } + + /** + * @example '#fa3cc2' + */ + public function hexColor(): string + { + return '#' . str_pad(dechex($this->numberExtension->numberBetween(1, 16777215)), 6, '0', STR_PAD_LEFT); + } + + /** + * @example '#ff0044' + */ + public function safeHexColor(): string + { + $color = str_pad(dechex($this->numberExtension->numberBetween(0, 255)), 3, '0', STR_PAD_LEFT); + + return sprintf( + '#%s%s%s%s%s%s', + $color[0], + $color[0], + $color[1], + $color[1], + $color[2], + $color[2], + ); + } + + /** + * @example 'array(0,255,122)' + * + * @return int[] + */ + public function rgbColorAsArray(): array + { + $color = $this->hexColor(); + + return [ + hexdec(substr($color, 1, 2)), + hexdec(substr($color, 3, 2)), + hexdec(substr($color, 5, 2)), + ]; + } + + /** + * @example '0,255,122' + */ + public function rgbColor(): string + { + return implode(',', $this->rgbColorAsArray()); + } + + /** + * @example 'rgb(0,255,122)' + */ + public function rgbCssColor(): string + { + return sprintf( + 'rgb(%s)', + $this->rgbColor(), + ); + } + + /** + * @example 'rgba(0,255,122,0.8)' + */ + public function rgbaCssColor(): string + { + return sprintf( + 'rgba(%s,%s)', + $this->rgbColor(), + $this->numberExtension->randomFloat(1, 0, 1), + ); + } + + /** + * @example 'blue' + */ + public function safeColorName(): string + { + return Helper::randomElement($this->safeColorNames); + } + + /** + * @example 'NavajoWhite' + */ + public function colorName(): string + { + return Helper::randomElement($this->allColorNames); + } + + /** + * @example '340,50,20' + */ + public function hslColor(): string + { + return sprintf( + '%s,%s,%s', + $this->numberExtension->numberBetween(0, 360), + $this->numberExtension->numberBetween(0, 100), + $this->numberExtension->numberBetween(0, 100), + ); + } + + /** + * @example array(340, 50, 20) + * + * @return int[] + */ + public function hslColorAsArray(): array + { + return [ + $this->numberExtension->numberBetween(0, 360), + $this->numberExtension->numberBetween(0, 100), + $this->numberExtension->numberBetween(0, 100), + ]; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Core/Coordinates.php b/vendor/fakerphp/faker/src/Faker/Core/Coordinates.php new file mode 100644 index 00000000..15b5492e --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Core/Coordinates.php @@ -0,0 +1,78 @@ +numberExtension = $numberExtension ?: new Number(); + } + + /** + * @example '77.147489' + * + * @return float Uses signed degrees format (returns a float number between -90 and 90) + */ + public function latitude(float $min = -90.0, float $max = 90.0): float + { + if ($min < -90 || $max < -90) { + throw new \LogicException('Latitude cannot be less that -90.0'); + } + + if ($min > 90 || $max > 90) { + throw new \LogicException('Latitude cannot be greater that 90.0'); + } + + return $this->randomFloat(6, $min, $max); + } + + /** + * @example '86.211205' + * + * @return float Uses signed degrees format (returns a float number between -180 and 180) + */ + public function longitude(float $min = -180.0, float $max = 180.0): float + { + if ($min < -180 || $max < -180) { + throw new \LogicException('Longitude cannot be less that -180.0'); + } + + if ($min > 180 || $max > 180) { + throw new \LogicException('Longitude cannot be greater that 180.0'); + } + + return $this->randomFloat(6, $min, $max); + } + + /** + * @example array('77.147489', '86.211205') + * + * @return array{latitude: float, longitude: float} + */ + public function localCoordinates(): array + { + return [ + 'latitude' => $this->latitude(), + 'longitude' => $this->longitude(), + ]; + } + + private function randomFloat(int $nbMaxDecimals, float $min, float $max): float + { + if ($min > $max) { + throw new \LogicException('Invalid coordinates boundaries'); + } + + return $this->numberExtension->randomFloat($nbMaxDecimals, $min, $max); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Core/DateTime.php b/vendor/fakerphp/faker/src/Faker/Core/DateTime.php new file mode 100644 index 00000000..6ef40a96 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Core/DateTime.php @@ -0,0 +1,217 @@ +getTimestamp(); + } + + return strtotime(empty($until) ? 'now' : $until); + } + + /** + * Get a DateTime created based on a POSIX-timestamp. + * + * @param int $timestamp the UNIX / POSIX-compatible timestamp + */ + private function getTimestampDateTime(int $timestamp): \DateTime + { + return new \DateTime('@' . $timestamp); + } + + private function resolveTimezone(?string $timezone): string + { + if ($timezone !== null) { + return $timezone; + } + + return null === $this->defaultTimezone ? date_default_timezone_get() : $this->defaultTimezone; + } + + /** + * Internal method to set the timezone on a DateTime object. + */ + private function setTimezone(\DateTime $dateTime, ?string $timezone): \DateTime + { + $timezone = $this->resolveTimezone($timezone); + + return $dateTime->setTimezone(new \DateTimeZone($timezone)); + } + + public function dateTime($until = 'now', string $timezone = null): \DateTime + { + return $this->setTimezone( + $this->getTimestampDateTime($this->unixTime($until)), + $timezone, + ); + } + + public function dateTimeAD($until = 'now', string $timezone = null): \DateTime + { + $min = (PHP_INT_SIZE > 4) ? -62135597361 : -PHP_INT_MAX; + + return $this->setTimezone( + $this->getTimestampDateTime($this->generator->numberBetween($min, $this->getTimestamp($until))), + $timezone, + ); + } + + public function dateTimeBetween($from = '-30 years', $until = 'now', string $timezone = null): \DateTime + { + $start = $this->getTimestamp($from); + $end = $this->getTimestamp($until); + + if ($start > $end) { + throw new \InvalidArgumentException('"$from" must be anterior to "$until".'); + } + + $timestamp = $this->generator->numberBetween($start, $end); + + return $this->setTimezone( + $this->getTimestampDateTime($timestamp), + $timezone, + ); + } + + public function dateTimeInInterval($from = '-30 years', string $interval = '+5 days', string $timezone = null): \DateTime + { + $intervalObject = \DateInterval::createFromDateString($interval); + $datetime = $from instanceof \DateTime ? $from : new \DateTime($from); + + $other = (clone $datetime)->add($intervalObject); + + $begin = min($datetime, $other); + $end = $datetime === $begin ? $other : $datetime; + + return $this->dateTimeBetween($begin, $end, $timezone); + } + + public function dateTimeThisWeek($until = 'sunday this week', string $timezone = null): \DateTime + { + return $this->dateTimeBetween('monday this week', $until, $timezone); + } + + public function dateTimeThisMonth($until = 'last day of this month', string $timezone = null): \DateTime + { + return $this->dateTimeBetween('first day of this month', $until, $timezone); + } + + public function dateTimeThisYear($until = 'last day of december', string $timezone = null): \DateTime + { + return $this->dateTimeBetween('first day of january', $until, $timezone); + } + + public function dateTimeThisDecade($until = 'now', string $timezone = null): \DateTime + { + $year = floor(date('Y') / 10) * 10; + + return $this->dateTimeBetween("first day of january $year", $until, $timezone); + } + + public function dateTimeThisCentury($until = 'now', string $timezone = null): \DateTime + { + $year = floor(date('Y') / 100) * 100; + + return $this->dateTimeBetween("first day of january $year", $until, $timezone); + } + + public function date(string $format = 'Y-m-d', $until = 'now'): string + { + return $this->dateTime($until)->format($format); + } + + public function time(string $format = 'H:i:s', $until = 'now'): string + { + return $this->date($format, $until); + } + + public function unixTime($until = 'now'): int + { + return $this->generator->numberBetween(0, $this->getTimestamp($until)); + } + + public function iso8601($until = 'now'): string + { + return $this->date(\DateTime::ISO8601, $until); + } + + public function amPm($until = 'now'): string + { + return $this->date('a', $until); + } + + public function dayOfMonth($until = 'now'): string + { + return $this->date('d', $until); + } + + public function dayOfWeek($until = 'now'): string + { + return $this->date('l', $until); + } + + public function month($until = 'now'): string + { + return $this->date('m', $until); + } + + public function monthName($until = 'now'): string + { + return $this->date('F', $until); + } + + public function year($until = 'now'): string + { + return $this->date('Y', $until); + } + + public function century(): string + { + return Helper::randomElement($this->centuries); + } + + public function timezone(string $countryCode = null): string + { + if ($countryCode) { + $timezones = \DateTimeZone::listIdentifiers(\DateTimeZone::PER_COUNTRY, $countryCode); + } else { + $timezones = \DateTimeZone::listIdentifiers(); + } + + return Helper::randomElement($timezones); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Core/File.php b/vendor/fakerphp/faker/src/Faker/Core/File.php new file mode 100644 index 00000000..5151e900 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Core/File.php @@ -0,0 +1,564 @@ + file extension(s) + * + * @see http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types + */ + private array $mimeTypes = [ + 'application/atom+xml' => 'atom', + 'application/ecmascript' => 'ecma', + 'application/emma+xml' => 'emma', + 'application/epub+zip' => 'epub', + 'application/java-archive' => 'jar', + 'application/java-vm' => 'class', + 'application/javascript' => 'js', + 'application/json' => 'json', + 'application/jsonml+json' => 'jsonml', + 'application/lost+xml' => 'lostxml', + 'application/mathml+xml' => 'mathml', + 'application/mets+xml' => 'mets', + 'application/mods+xml' => 'mods', + 'application/mp4' => 'mp4s', + 'application/msword' => ['doc', 'dot'], + 'application/octet-stream' => [ + 'bin', + 'dms', + 'lrf', + 'mar', + 'so', + 'dist', + 'distz', + 'pkg', + 'bpk', + 'dump', + 'elc', + 'deploy', + ], + 'application/ogg' => 'ogx', + 'application/omdoc+xml' => 'omdoc', + 'application/pdf' => 'pdf', + 'application/pgp-encrypted' => 'pgp', + 'application/pgp-signature' => ['asc', 'sig'], + 'application/pkix-pkipath' => 'pkipath', + 'application/pkixcmp' => 'pki', + 'application/pls+xml' => 'pls', + 'application/postscript' => ['ai', 'eps', 'ps'], + 'application/pskc+xml' => 'pskcxml', + 'application/rdf+xml' => 'rdf', + 'application/reginfo+xml' => 'rif', + 'application/rss+xml' => 'rss', + 'application/rtf' => 'rtf', + 'application/sbml+xml' => 'sbml', + 'application/vnd.adobe.air-application-installer-package+zip' => 'air', + 'application/vnd.adobe.xdp+xml' => 'xdp', + 'application/vnd.adobe.xfdf' => 'xfdf', + 'application/vnd.ahead.space' => 'ahead', + 'application/vnd.dart' => 'dart', + 'application/vnd.data-vision.rdz' => 'rdz', + 'application/vnd.dece.data' => ['uvf', 'uvvf', 'uvd', 'uvvd'], + 'application/vnd.dece.ttml+xml' => ['uvt', 'uvvt'], + 'application/vnd.dece.unspecified' => ['uvx', 'uvvx'], + 'application/vnd.dece.zip' => ['uvz', 'uvvz'], + 'application/vnd.denovo.fcselayout-link' => 'fe_launch', + 'application/vnd.dna' => 'dna', + 'application/vnd.dolby.mlp' => 'mlp', + 'application/vnd.dpgraph' => 'dpg', + 'application/vnd.dreamfactory' => 'dfac', + 'application/vnd.ds-keypoint' => 'kpxx', + 'application/vnd.dvb.ait' => 'ait', + 'application/vnd.dvb.service' => 'svc', + 'application/vnd.dynageo' => 'geo', + 'application/vnd.ecowin.chart' => 'mag', + 'application/vnd.enliven' => 'nml', + 'application/vnd.epson.esf' => 'esf', + 'application/vnd.epson.msf' => 'msf', + 'application/vnd.epson.quickanime' => 'qam', + 'application/vnd.epson.salt' => 'slt', + 'application/vnd.epson.ssf' => 'ssf', + 'application/vnd.ezpix-album' => 'ez2', + 'application/vnd.ezpix-package' => 'ez3', + 'application/vnd.fdf' => 'fdf', + 'application/vnd.fdsn.mseed' => 'mseed', + 'application/vnd.fdsn.seed' => ['seed', 'dataless'], + 'application/vnd.flographit' => 'gph', + 'application/vnd.fluxtime.clip' => 'ftc', + 'application/vnd.hal+xml' => 'hal', + 'application/vnd.hydrostatix.sof-data' => 'sfd-hdstx', + 'application/vnd.ibm.minipay' => 'mpy', + 'application/vnd.ibm.secure-container' => 'sc', + 'application/vnd.iccprofile' => ['icc', 'icm'], + 'application/vnd.igloader' => 'igl', + 'application/vnd.immervision-ivp' => 'ivp', + 'application/vnd.kde.karbon' => 'karbon', + 'application/vnd.kde.kchart' => 'chrt', + 'application/vnd.kde.kformula' => 'kfo', + 'application/vnd.kde.kivio' => 'flw', + 'application/vnd.kde.kontour' => 'kon', + 'application/vnd.kde.kpresenter' => ['kpr', 'kpt'], + 'application/vnd.kde.kspread' => 'ksp', + 'application/vnd.kde.kword' => ['kwd', 'kwt'], + 'application/vnd.kenameaapp' => 'htke', + 'application/vnd.kidspiration' => 'kia', + 'application/vnd.kinar' => ['kne', 'knp'], + 'application/vnd.koan' => ['skp', 'skd', 'skt', 'skm'], + 'application/vnd.kodak-descriptor' => 'sse', + 'application/vnd.las.las+xml' => 'lasxml', + 'application/vnd.llamagraphics.life-balance.desktop' => 'lbd', + 'application/vnd.llamagraphics.life-balance.exchange+xml' => 'lbe', + 'application/vnd.lotus-1-2-3' => '123', + 'application/vnd.lotus-approach' => 'apr', + 'application/vnd.lotus-freelance' => 'pre', + 'application/vnd.lotus-notes' => 'nsf', + 'application/vnd.lotus-organizer' => 'org', + 'application/vnd.lotus-screencam' => 'scm', + 'application/vnd.mozilla.xul+xml' => 'xul', + 'application/vnd.ms-artgalry' => 'cil', + 'application/vnd.ms-cab-compressed' => 'cab', + 'application/vnd.ms-excel' => [ + 'xls', + 'xlm', + 'xla', + 'xlc', + 'xlt', + 'xlw', + ], + 'application/vnd.ms-excel.addin.macroenabled.12' => 'xlam', + 'application/vnd.ms-excel.sheet.binary.macroenabled.12' => 'xlsb', + 'application/vnd.ms-excel.sheet.macroenabled.12' => 'xlsm', + 'application/vnd.ms-excel.template.macroenabled.12' => 'xltm', + 'application/vnd.ms-fontobject' => 'eot', + 'application/vnd.ms-htmlhelp' => 'chm', + 'application/vnd.ms-ims' => 'ims', + 'application/vnd.ms-lrm' => 'lrm', + 'application/vnd.ms-officetheme' => 'thmx', + 'application/vnd.ms-pki.seccat' => 'cat', + 'application/vnd.ms-pki.stl' => 'stl', + 'application/vnd.ms-powerpoint' => ['ppt', 'pps', 'pot'], + 'application/vnd.ms-powerpoint.addin.macroenabled.12' => 'ppam', + 'application/vnd.ms-powerpoint.presentation.macroenabled.12' => 'pptm', + 'application/vnd.ms-powerpoint.slide.macroenabled.12' => 'sldm', + 'application/vnd.ms-powerpoint.slideshow.macroenabled.12' => 'ppsm', + 'application/vnd.ms-powerpoint.template.macroenabled.12' => 'potm', + 'application/vnd.ms-project' => ['mpp', 'mpt'], + 'application/vnd.ms-word.document.macroenabled.12' => 'docm', + 'application/vnd.ms-word.template.macroenabled.12' => 'dotm', + 'application/vnd.ms-works' => ['wps', 'wks', 'wcm', 'wdb'], + 'application/vnd.ms-wpl' => 'wpl', + 'application/vnd.ms-xpsdocument' => 'xps', + 'application/vnd.mseq' => 'mseq', + 'application/vnd.musician' => 'mus', + 'application/vnd.oasis.opendocument.chart' => 'odc', + 'application/vnd.oasis.opendocument.chart-template' => 'otc', + 'application/vnd.oasis.opendocument.database' => 'odb', + 'application/vnd.oasis.opendocument.formula' => 'odf', + 'application/vnd.oasis.opendocument.formula-template' => 'odft', + 'application/vnd.oasis.opendocument.graphics' => 'odg', + 'application/vnd.oasis.opendocument.graphics-template' => 'otg', + 'application/vnd.oasis.opendocument.image' => 'odi', + 'application/vnd.oasis.opendocument.image-template' => 'oti', + 'application/vnd.oasis.opendocument.presentation' => 'odp', + 'application/vnd.oasis.opendocument.presentation-template' => 'otp', + 'application/vnd.oasis.opendocument.spreadsheet' => 'ods', + 'application/vnd.oasis.opendocument.spreadsheet-template' => 'ots', + 'application/vnd.oasis.opendocument.text' => 'odt', + 'application/vnd.oasis.opendocument.text-master' => 'odm', + 'application/vnd.oasis.opendocument.text-template' => 'ott', + 'application/vnd.oasis.opendocument.text-web' => 'oth', + 'application/vnd.olpc-sugar' => 'xo', + 'application/vnd.oma.dd2+xml' => 'dd2', + 'application/vnd.openofficeorg.extension' => 'oxt', + 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'pptx', + 'application/vnd.openxmlformats-officedocument.presentationml.slide' => 'sldx', + 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => 'ppsx', + 'application/vnd.openxmlformats-officedocument.presentationml.template' => 'potx', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'xlsx', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' => 'xltx', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'docx', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => 'dotx', + 'application/vnd.pvi.ptid1' => 'ptid', + 'application/vnd.quark.quarkxpress' => [ + 'qxd', + 'qxt', + 'qwd', + 'qwt', + 'qxl', + 'qxb', + ], + 'application/vnd.realvnc.bed' => 'bed', + 'application/vnd.recordare.musicxml' => 'mxl', + 'application/vnd.recordare.musicxml+xml' => 'musicxml', + 'application/vnd.rig.cryptonote' => 'cryptonote', + 'application/vnd.rim.cod' => 'cod', + 'application/vnd.rn-realmedia' => 'rm', + 'application/vnd.rn-realmedia-vbr' => 'rmvb', + 'application/vnd.route66.link66+xml' => 'link66', + 'application/vnd.sailingtracker.track' => 'st', + 'application/vnd.seemail' => 'see', + 'application/vnd.sema' => 'sema', + 'application/vnd.semd' => 'semd', + 'application/vnd.semf' => 'semf', + 'application/vnd.shana.informed.formdata' => 'ifm', + 'application/vnd.shana.informed.formtemplate' => 'itp', + 'application/vnd.shana.informed.interchange' => 'iif', + 'application/vnd.shana.informed.package' => 'ipk', + 'application/vnd.simtech-mindmapper' => ['twd', 'twds'], + 'application/vnd.smaf' => 'mmf', + 'application/vnd.stepmania.stepchart' => 'sm', + 'application/vnd.sun.xml.calc' => 'sxc', + 'application/vnd.sun.xml.calc.template' => 'stc', + 'application/vnd.sun.xml.draw' => 'sxd', + 'application/vnd.sun.xml.draw.template' => 'std', + 'application/vnd.sun.xml.impress' => 'sxi', + 'application/vnd.sun.xml.impress.template' => 'sti', + 'application/vnd.sun.xml.math' => 'sxm', + 'application/vnd.sun.xml.writer' => 'sxw', + 'application/vnd.sun.xml.writer.global' => 'sxg', + 'application/vnd.sun.xml.writer.template' => 'stw', + 'application/vnd.sus-calendar' => ['sus', 'susp'], + 'application/vnd.svd' => 'svd', + 'application/vnd.symbian.install' => ['sis', 'sisx'], + 'application/vnd.syncml+xml' => 'xsm', + 'application/vnd.syncml.dm+wbxml' => 'bdm', + 'application/vnd.syncml.dm+xml' => 'xdm', + 'application/vnd.tao.intent-module-archive' => 'tao', + 'application/vnd.tcpdump.pcap' => ['pcap', 'cap', 'dmp'], + 'application/vnd.tmobile-livetv' => 'tmo', + 'application/vnd.trid.tpt' => 'tpt', + 'application/vnd.triscape.mxs' => 'mxs', + 'application/vnd.trueapp' => 'tra', + 'application/vnd.ufdl' => ['ufd', 'ufdl'], + 'application/vnd.uiq.theme' => 'utz', + 'application/vnd.umajin' => 'umj', + 'application/vnd.unity' => 'unityweb', + 'application/vnd.uoml+xml' => 'uoml', + 'application/vnd.vcx' => 'vcx', + 'application/vnd.visio' => ['vsd', 'vst', 'vss', 'vsw'], + 'application/vnd.visionary' => 'vis', + 'application/vnd.vsf' => 'vsf', + 'application/vnd.wap.wbxml' => 'wbxml', + 'application/vnd.wap.wmlc' => 'wmlc', + 'application/vnd.wap.wmlscriptc' => 'wmlsc', + 'application/vnd.webturbo' => 'wtb', + 'application/vnd.wolfram.player' => 'nbp', + 'application/vnd.wordperfect' => 'wpd', + 'application/vnd.wqd' => 'wqd', + 'application/vnd.wt.stf' => 'stf', + 'application/vnd.xara' => 'xar', + 'application/vnd.xfdl' => 'xfdl', + 'application/voicexml+xml' => 'vxml', + 'application/widget' => 'wgt', + 'application/winhlp' => 'hlp', + 'application/wsdl+xml' => 'wsdl', + 'application/wspolicy+xml' => 'wspolicy', + 'application/x-7z-compressed' => '7z', + 'application/x-bittorrent' => 'torrent', + 'application/x-blorb' => ['blb', 'blorb'], + 'application/x-bzip' => 'bz', + 'application/x-cdlink' => 'vcd', + 'application/x-cfs-compressed' => 'cfs', + 'application/x-chat' => 'chat', + 'application/x-chess-pgn' => 'pgn', + 'application/x-conference' => 'nsc', + 'application/x-cpio' => 'cpio', + 'application/x-csh' => 'csh', + 'application/x-debian-package' => ['deb', 'udeb'], + 'application/x-dgc-compressed' => 'dgc', + 'application/x-director' => [ + 'dir', + 'dcr', + 'dxr', + 'cst', + 'cct', + 'cxt', + 'w3d', + 'fgd', + 'swa', + ], + 'application/x-font-ttf' => ['ttf', 'ttc'], + 'application/x-font-type1' => ['pfa', 'pfb', 'pfm', 'afm'], + 'application/x-font-woff' => 'woff', + 'application/x-freearc' => 'arc', + 'application/x-futuresplash' => 'spl', + 'application/x-gca-compressed' => 'gca', + 'application/x-glulx' => 'ulx', + 'application/x-gnumeric' => 'gnumeric', + 'application/x-gramps-xml' => 'gramps', + 'application/x-gtar' => 'gtar', + 'application/x-hdf' => 'hdf', + 'application/x-install-instructions' => 'install', + 'application/x-iso9660-image' => 'iso', + 'application/x-java-jnlp-file' => 'jnlp', + 'application/x-latex' => 'latex', + 'application/x-lzh-compressed' => ['lzh', 'lha'], + 'application/x-mie' => 'mie', + 'application/x-mobipocket-ebook' => ['prc', 'mobi'], + 'application/x-ms-application' => 'application', + 'application/x-ms-shortcut' => 'lnk', + 'application/x-ms-wmd' => 'wmd', + 'application/x-ms-wmz' => 'wmz', + 'application/x-ms-xbap' => 'xbap', + 'application/x-msaccess' => 'mdb', + 'application/x-msbinder' => 'obd', + 'application/x-mscardfile' => 'crd', + 'application/x-msclip' => 'clp', + 'application/x-msdownload' => ['exe', 'dll', 'com', 'bat', 'msi'], + 'application/x-msmediaview' => [ + 'mvb', + 'm13', + 'm14', + ], + 'application/x-msmetafile' => ['wmf', 'wmz', 'emf', 'emz'], + 'application/x-rar-compressed' => 'rar', + 'application/x-research-info-systems' => 'ris', + 'application/x-sh' => 'sh', + 'application/x-shar' => 'shar', + 'application/x-shockwave-flash' => 'swf', + 'application/x-silverlight-app' => 'xap', + 'application/x-sql' => 'sql', + 'application/x-stuffit' => 'sit', + 'application/x-stuffitx' => 'sitx', + 'application/x-subrip' => 'srt', + 'application/x-sv4cpio' => 'sv4cpio', + 'application/x-sv4crc' => 'sv4crc', + 'application/x-t3vm-image' => 't3', + 'application/x-tads' => 'gam', + 'application/x-tar' => 'tar', + 'application/x-tcl' => 'tcl', + 'application/x-tex' => 'tex', + 'application/x-tex-tfm' => 'tfm', + 'application/x-texinfo' => ['texinfo', 'texi'], + 'application/x-tgif' => 'obj', + 'application/x-ustar' => 'ustar', + 'application/x-wais-source' => 'src', + 'application/x-x509-ca-cert' => ['der', 'crt'], + 'application/x-xfig' => 'fig', + 'application/x-xliff+xml' => 'xlf', + 'application/x-xpinstall' => 'xpi', + 'application/x-xz' => 'xz', + 'application/x-zmachine' => 'z1', + 'application/xaml+xml' => 'xaml', + 'application/xcap-diff+xml' => 'xdf', + 'application/xenc+xml' => 'xenc', + 'application/xhtml+xml' => ['xhtml', 'xht'], + 'application/xml' => ['xml', 'xsl'], + 'application/xml-dtd' => 'dtd', + 'application/xop+xml' => 'xop', + 'application/xproc+xml' => 'xpl', + 'application/xslt+xml' => 'xslt', + 'application/xspf+xml' => 'xspf', + 'application/xv+xml' => ['mxml', 'xhvml', 'xvml', 'xvm'], + 'application/yang' => 'yang', + 'application/yin+xml' => 'yin', + 'application/zip' => 'zip', + 'audio/adpcm' => 'adp', + 'audio/basic' => ['au', 'snd'], + 'audio/midi' => ['mid', 'midi', 'kar', 'rmi'], + 'audio/mp4' => 'mp4a', + 'audio/mpeg' => [ + 'mpga', + 'mp2', + 'mp2a', + 'mp3', + 'm2a', + 'm3a', + ], + 'audio/ogg' => ['oga', 'ogg', 'spx'], + 'audio/vnd.dece.audio' => ['uva', 'uvva'], + 'audio/vnd.rip' => 'rip', + 'audio/webm' => 'weba', + 'audio/x-aac' => 'aac', + 'audio/x-aiff' => ['aif', 'aiff', 'aifc'], + 'audio/x-caf' => 'caf', + 'audio/x-flac' => 'flac', + 'audio/x-matroska' => 'mka', + 'audio/x-mpegurl' => 'm3u', + 'audio/x-ms-wax' => 'wax', + 'audio/x-ms-wma' => 'wma', + 'audio/x-pn-realaudio' => ['ram', 'ra'], + 'audio/x-pn-realaudio-plugin' => 'rmp', + 'audio/x-wav' => 'wav', + 'audio/xm' => 'xm', + 'image/bmp' => 'bmp', + 'image/cgm' => 'cgm', + 'image/g3fax' => 'g3', + 'image/gif' => 'gif', + 'image/ief' => 'ief', + 'image/jpeg' => ['jpeg', 'jpg', 'jpe'], + 'image/ktx' => 'ktx', + 'image/png' => 'png', + 'image/prs.btif' => 'btif', + 'image/sgi' => 'sgi', + 'image/svg+xml' => ['svg', 'svgz'], + 'image/tiff' => ['tiff', 'tif'], + 'image/vnd.adobe.photoshop' => 'psd', + 'image/vnd.dece.graphic' => ['uvi', 'uvvi', 'uvg', 'uvvg'], + 'image/vnd.dvb.subtitle' => 'sub', + 'image/vnd.djvu' => ['djvu', 'djv'], + 'image/vnd.dwg' => 'dwg', + 'image/vnd.dxf' => 'dxf', + 'image/vnd.fastbidsheet' => 'fbs', + 'image/vnd.fpx' => 'fpx', + 'image/vnd.fst' => 'fst', + 'image/vnd.fujixerox.edmics-mmr' => 'mmr', + 'image/vnd.fujixerox.edmics-rlc' => 'rlc', + 'image/vnd.ms-modi' => 'mdi', + 'image/vnd.ms-photo' => 'wdp', + 'image/vnd.net-fpx' => 'npx', + 'image/vnd.wap.wbmp' => 'wbmp', + 'image/vnd.xiff' => 'xif', + 'image/webp' => 'webp', + 'image/x-3ds' => '3ds', + 'image/x-cmu-raster' => 'ras', + 'image/x-cmx' => 'cmx', + 'image/x-freehand' => ['fh', 'fhc', 'fh4', 'fh5', 'fh7'], + 'image/x-icon' => 'ico', + 'image/x-mrsid-image' => 'sid', + 'image/x-pcx' => 'pcx', + 'image/x-pict' => ['pic', 'pct'], + 'image/x-portable-anymap' => 'pnm', + 'image/x-portable-bitmap' => 'pbm', + 'image/x-portable-graymap' => 'pgm', + 'image/x-portable-pixmap' => 'ppm', + 'image/x-rgb' => 'rgb', + 'image/x-tga' => 'tga', + 'image/x-xbitmap' => 'xbm', + 'image/x-xpixmap' => 'xpm', + 'image/x-xwindowdump' => 'xwd', + 'message/rfc822' => ['eml', 'mime'], + 'model/iges' => ['igs', 'iges'], + 'model/mesh' => ['msh', 'mesh', 'silo'], + 'model/vnd.collada+xml' => 'dae', + 'model/vnd.dwf' => 'dwf', + 'model/vnd.gdl' => 'gdl', + 'model/vnd.gtw' => 'gtw', + 'model/vnd.mts' => 'mts', + 'model/vnd.vtu' => 'vtu', + 'model/vrml' => ['wrl', 'vrml'], + 'model/x3d+binary' => 'x3db', + 'model/x3d+vrml' => 'x3dv', + 'model/x3d+xml' => 'x3d', + 'text/cache-manifest' => 'appcache', + 'text/calendar' => ['ics', 'ifb'], + 'text/css' => 'css', + 'text/csv' => 'csv', + 'text/html' => ['html', 'htm'], + 'text/n3' => 'n3', + 'text/plain' => [ + 'txt', + 'text', + 'conf', + 'def', + 'list', + 'log', + 'in', + ], + 'text/prs.lines.tag' => 'dsc', + 'text/richtext' => 'rtx', + 'text/sgml' => ['sgml', 'sgm'], + 'text/tab-separated-values' => 'tsv', + 'text/troff' => [ + 't', + 'tr', + 'roff', + 'man', + 'me', + 'ms', + ], + 'text/turtle' => 'ttl', + 'text/uri-list' => ['uri', 'uris', 'urls'], + 'text/vcard' => 'vcard', + 'text/vnd.curl' => 'curl', + 'text/vnd.curl.dcurl' => 'dcurl', + 'text/vnd.curl.scurl' => 'scurl', + 'text/vnd.curl.mcurl' => 'mcurl', + 'text/vnd.dvb.subtitle' => 'sub', + 'text/vnd.fly' => 'fly', + 'text/vnd.fmi.flexstor' => 'flx', + 'text/vnd.graphviz' => 'gv', + 'text/vnd.in3d.3dml' => '3dml', + 'text/vnd.in3d.spot' => 'spot', + 'text/vnd.sun.j2me.app-descriptor' => 'jad', + 'text/vnd.wap.wml' => 'wml', + 'text/vnd.wap.wmlscript' => 'wmls', + 'text/x-asm' => ['s', 'asm'], + 'text/x-fortran' => ['f', 'for', 'f77', 'f90'], + 'text/x-java-source' => 'java', + 'text/x-opml' => 'opml', + 'text/x-pascal' => ['p', 'pas'], + 'text/x-nfo' => 'nfo', + 'text/x-setext' => 'etx', + 'text/x-sfv' => 'sfv', + 'text/x-uuencode' => 'uu', + 'text/x-vcalendar' => 'vcs', + 'text/x-vcard' => 'vcf', + 'video/3gpp' => '3gp', + 'video/3gpp2' => '3g2', + 'video/h261' => 'h261', + 'video/h263' => 'h263', + 'video/h264' => 'h264', + 'video/jpeg' => 'jpgv', + 'video/jpm' => ['jpm', 'jpgm'], + 'video/mj2' => 'mj2', + 'video/mp4' => 'mp4', + 'video/mpeg' => ['mpeg', 'mpg', 'mpe', 'm1v', 'm2v'], + 'video/ogg' => 'ogv', + 'video/quicktime' => ['qt', 'mov'], + 'video/vnd.dece.hd' => ['uvh', 'uvvh'], + 'video/vnd.dece.mobile' => ['uvm', 'uvvm'], + 'video/vnd.dece.pd' => ['uvp', 'uvvp'], + 'video/vnd.dece.sd' => ['uvs', 'uvvs'], + 'video/vnd.dece.video' => ['uvv', 'uvvv'], + 'video/vnd.dvb.file' => 'dvb', + 'video/vnd.fvt' => 'fvt', + 'video/vnd.mpegurl' => ['mxu', 'm4u'], + 'video/vnd.ms-playready.media.pyv' => 'pyv', + 'video/vnd.uvvu.mp4' => ['uvu', 'uvvu'], + 'video/vnd.vivo' => 'viv', + 'video/webm' => 'webm', + 'video/x-f4v' => 'f4v', + 'video/x-fli' => 'fli', + 'video/x-flv' => 'flv', + 'video/x-m4v' => 'm4v', + 'video/x-matroska' => ['mkv', 'mk3d', 'mks'], + 'video/x-mng' => 'mng', + 'video/x-ms-asf' => ['asf', 'asx'], + 'video/x-ms-vob' => 'vob', + 'video/x-ms-wm' => 'wm', + 'video/x-ms-wmv' => 'wmv', + 'video/x-ms-wmx' => 'wmx', + 'video/x-ms-wvx' => 'wvx', + 'video/x-msvideo' => 'avi', + 'video/x-sgi-movie' => 'movie', + ]; + + public function mimeType(): string + { + return array_rand($this->mimeTypes, 1); + } + + public function extension(): string + { + $extension = $this->mimeTypes[array_rand($this->mimeTypes, 1)]; + + return is_array($extension) ? $extension[array_rand($extension, 1)] : $extension; + } + + public function filePath(): string + { + return tempnam(sys_get_temp_dir(), 'faker'); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Core/Number.php b/vendor/fakerphp/faker/src/Faker/Core/Number.php new file mode 100644 index 00000000..a16920c9 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Core/Number.php @@ -0,0 +1,83 @@ +numberBetween(0, 9); + } + + public function randomDigitNot(int $except): int + { + $result = $this->numberBetween(0, 8); + + if ($result >= $except) { + ++$result; + } + + return $result; + } + + public function randomDigitNotZero(): int + { + return $this->numberBetween(1, 9); + } + + public function randomFloat(?int $nbMaxDecimals = null, float $min = 0, ?float $max = null): float + { + if (null === $nbMaxDecimals) { + $nbMaxDecimals = $this->randomDigit(); + } + + if (null === $max) { + $max = $this->randomNumber(); + + if ($min > $max) { + $max = $min; + } + } + + if ($min > $max) { + $tmp = $min; + $min = $max; + $max = $tmp; + } + + return round($min + $this->numberBetween() / mt_getrandmax() * ($max - $min), $nbMaxDecimals); + } + + public function randomNumber(int $nbDigits = null, bool $strict = false): int + { + if (null === $nbDigits) { + $nbDigits = $this->randomDigitNotZero(); + } + $max = 10 ** $nbDigits - 1; + + if ($max > mt_getrandmax()) { + throw new \InvalidArgumentException('randomNumber() can only generate numbers up to mt_getrandmax()'); + } + + if ($strict) { + return $this->numberBetween(10 ** ($nbDigits - 1), $max); + } + + return $this->numberBetween(0, $max); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Core/Uuid.php b/vendor/fakerphp/faker/src/Faker/Core/Uuid.php new file mode 100644 index 00000000..d1db1b22 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Core/Uuid.php @@ -0,0 +1,65 @@ +numberExtension = $numberExtension ?: new Number(); + } + + public function uuid3(): string + { + // fix for compatibility with 32bit architecture; each mt_rand call is restricted to 32bit + // two such calls will cause 64bits of randomness regardless of architecture + $seed = $this->numberExtension->numberBetween(0, 2147483647) . '#' . $this->numberExtension->numberBetween(0, 2147483647); + + // Hash the seed and convert to a byte array + $val = md5($seed, true); + $byte = array_values(unpack('C16', $val)); + + // extract fields from byte array + $tLo = ($byte[0] << 24) | ($byte[1] << 16) | ($byte[2] << 8) | $byte[3]; + $tMi = ($byte[4] << 8) | $byte[5]; + $tHi = ($byte[6] << 8) | $byte[7]; + $csLo = $byte[9]; + $csHi = $byte[8] & 0x3f | (1 << 7); + + // correct byte order for big edian architecture + if (pack('L', 0x6162797A) == pack('N', 0x6162797A)) { + $tLo = (($tLo & 0x000000ff) << 24) | (($tLo & 0x0000ff00) << 8) + | (($tLo & 0x00ff0000) >> 8) | (($tLo & 0xff000000) >> 24); + $tMi = (($tMi & 0x00ff) << 8) | (($tMi & 0xff00) >> 8); + $tHi = (($tHi & 0x00ff) << 8) | (($tHi & 0xff00) >> 8); + } + + // apply version number + $tHi &= 0x0fff; + $tHi |= (3 << 12); + + // cast to string + return sprintf( + '%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x', + $tLo, + $tMi, + $tHi, + $csHi, + $csLo, + $byte[10], + $byte[11], + $byte[12], + $byte[13], + $byte[14], + $byte[15], + ); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Core/Version.php b/vendor/fakerphp/faker/src/Faker/Core/Version.php new file mode 100644 index 00000000..8863c480 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Core/Version.php @@ -0,0 +1,69 @@ +numberExtension = $numberExtension ?: new Number(); + } + + /** + * Represents v2.0.0 of the semantic versioning: https://semver.org/spec/v2.0.0.html + */ + public function semver(bool $preRelease = false, bool $build = false): string + { + return sprintf( + '%d.%d.%d%s%s', + $this->numberExtension->numberBetween(0, 9), + $this->numberExtension->numberBetween(0, 99), + $this->numberExtension->numberBetween(0, 99), + $preRelease && $this->numberExtension->numberBetween(0, 1) === 1 ? '-' . $this->semverPreReleaseIdentifier() : '', + $build && $this->numberExtension->numberBetween(0, 1) === 1 ? '+' . $this->semverBuildIdentifier() : '', + ); + } + + /** + * Common pre-release identifier + */ + private function semverPreReleaseIdentifier(): string + { + $ident = Extension\Helper::randomElement($this->semverCommonPreReleaseIdentifiers); + + if ($this->numberExtension->numberBetween(0, 1) !== 1) { + return $ident; + } + + return $ident . '.' . $this->numberExtension->numberBetween(1, 99); + } + + /** + * Common random build identifier + */ + private function semverBuildIdentifier(): string + { + if ($this->numberExtension->numberBetween(0, 1) === 1) { + // short git revision syntax: https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection + return substr(sha1(Extension\Helper::lexify('??????')), 0, 7); + } + + // date syntax + return DateTime::date('YmdHis'); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/DefaultGenerator.php b/vendor/fakerphp/faker/src/Faker/DefaultGenerator.php new file mode 100644 index 00000000..688f4766 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/DefaultGenerator.php @@ -0,0 +1,49 @@ +default = $default; + } + + public function ext() + { + return $this; + } + + /** + * @param string $attribute + * + * @deprecated Use a method instead. + */ + public function __get($attribute) + { + trigger_deprecation('fakerphp/faker', '1.14', 'Accessing property "%s" is deprecated, use "%s()" instead.', $attribute, $attribute); + + return $this->default; + } + + /** + * @param string $method + * @param array $attributes + */ + public function __call($method, $attributes) + { + return $this->default; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Documentor.php b/vendor/fakerphp/faker/src/Faker/Documentor.php new file mode 100644 index 00000000..280b8320 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Documentor.php @@ -0,0 +1,70 @@ +generator = $generator; + } + + /** + * @return array + */ + public function getFormatters() + { + $formatters = []; + $providers = array_reverse($this->generator->getProviders()); + $providers[] = new Provider\Base($this->generator); + + foreach ($providers as $provider) { + $providerClass = get_class($provider); + $formatters[$providerClass] = []; + $refl = new \ReflectionObject($provider); + + foreach ($refl->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflmethod) { + if ($reflmethod->getDeclaringClass()->getName() == 'Faker\Provider\Base' && $providerClass != 'Faker\Provider\Base') { + continue; + } + $methodName = $reflmethod->name; + + if ($reflmethod->isConstructor()) { + continue; + } + $parameters = []; + + foreach ($reflmethod->getParameters() as $reflparameter) { + $parameter = '$' . $reflparameter->getName(); + + if ($reflparameter->isDefaultValueAvailable()) { + $parameter .= ' = ' . var_export($reflparameter->getDefaultValue(), true); + } + $parameters[] = $parameter; + } + $parameters = $parameters ? '(' . implode(', ', $parameters) . ')' : ''; + + try { + $example = $this->generator->format($methodName); + } catch (\InvalidArgumentException $e) { + $example = ''; + } + + if (is_array($example)) { + $example = "array('" . implode("', '", $example) . "')"; + } elseif ($example instanceof \DateTime) { + $example = "DateTime('" . $example->format('Y-m-d H:i:s') . "')"; + } elseif ($example instanceof Generator || $example instanceof UniqueGenerator) { // modifier + $example = ''; + } else { + $example = var_export($example, true); + } + $formatters[$providerClass][$methodName . $parameters] = $example; + } + } + + return $formatters; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Extension/AddressExtension.php b/vendor/fakerphp/faker/src/Faker/Extension/AddressExtension.php new file mode 100644 index 00000000..568ca377 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Extension/AddressExtension.php @@ -0,0 +1,39 @@ +generator = $generator; + + return $instance; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Extension/Helper.php b/vendor/fakerphp/faker/src/Faker/Extension/Helper.php new file mode 100644 index 00000000..47200e90 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Extension/Helper.php @@ -0,0 +1,106 @@ +addProvider(new $providerClassName($generator)); + } + + return $generator; + } + + /** + * @param string $provider + * @param string $locale + * + * @return string + */ + protected static function getProviderClassname($provider, $locale = '') + { + if ($providerClass = self::findProviderClassname($provider, $locale)) { + return $providerClass; + } + + // fallback to default locale + if ($providerClass = self::findProviderClassname($provider, static::DEFAULT_LOCALE)) { + return $providerClass; + } + + // fallback to no locale + if ($providerClass = self::findProviderClassname($provider)) { + return $providerClass; + } + + throw new \InvalidArgumentException(sprintf('Unable to find provider "%s" with locale "%s"', $provider, $locale)); + } + + /** + * @param string $provider + * @param string $locale + * + * @return string|null + */ + protected static function findProviderClassname($provider, $locale = '') + { + $providerClass = 'Faker\\' . ($locale ? sprintf('Provider\%s\%s', $locale, $provider) : sprintf('Provider\%s', $provider)); + + if (class_exists($providerClass, true)) { + return $providerClass; + } + + return null; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Generator.php b/vendor/fakerphp/faker/src/Faker/Generator.php new file mode 100644 index 00000000..0b994e4c --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Generator.php @@ -0,0 +1,985 @@ +container = $container ?: Container\ContainerBuilder::withDefaultExtensions()->build(); + } + + /** + * @template T of Extension\Extension + * + * @param class-string $id + * + * @throws Extension\ExtensionNotFound + * + * @return T + */ + public function ext(string $id): Extension\Extension + { + if (!$this->container->has($id)) { + throw new Extension\ExtensionNotFound(sprintf( + 'No Faker extension with id "%s" was loaded.', + $id, + )); + } + + $extension = $this->container->get($id); + + if ($extension instanceof Extension\GeneratorAwareExtension) { + $extension = $extension->withGenerator($this); + } + + return $extension; + } + + public function addProvider($provider) + { + array_unshift($this->providers, $provider); + + $this->formatters = []; + } + + public function getProviders() + { + return $this->providers; + } + + /** + * With the unique generator you are guaranteed to never get the same two + * values. + * + * + * // will never return twice the same value + * $faker->unique()->randomElement(array(1, 2, 3)); + * + * + * @param bool $reset If set to true, resets the list of existing values + * @param int $maxRetries Maximum number of retries to find a unique value, + * After which an OverflowException is thrown. + * + * @throws \OverflowException When no unique value can be found by iterating $maxRetries times + * + * @return self A proxy class returning only non-existing values + */ + public function unique($reset = false, $maxRetries = 10000) + { + if ($reset || $this->uniqueGenerator === null) { + $this->uniqueGenerator = new UniqueGenerator($this, $maxRetries); + } + + return $this->uniqueGenerator; + } + + /** + * Get a value only some percentage of the time. + * + * @param float $weight A probability between 0 and 1, 0 means that we always get the default value. + * + * @return self + */ + public function optional(float $weight = 0.5, $default = null) + { + if ($weight > 1) { + trigger_deprecation('fakerphp/faker', '1.16', 'First argument ($weight) to method "optional()" must be between 0 and 1. You passed %f, we assume you meant %f.', $weight, $weight / 100); + $weight = $weight / 100; + } + + return new ChanceGenerator($this, $weight, $default); + } + + /** + * To make sure the value meet some criteria, pass a callable that verifies the + * output. If the validator fails, the generator will try again. + * + * The value validity is determined by a function passed as first argument. + * + * + * $values = array(); + * $evenValidator = function ($digit) { + * return $digit % 2 === 0; + * }; + * for ($i=0; $i < 10; $i++) { + * $values []= $faker->valid($evenValidator)->randomDigit; + * } + * print_r($values); // [0, 4, 8, 4, 2, 6, 0, 8, 8, 6] + * + * + * @param ?\Closure $validator A function returning true for valid values + * @param int $maxRetries Maximum number of retries to find a valid value, + * After which an OverflowException is thrown. + * + * @throws \OverflowException When no valid value can be found by iterating $maxRetries times + * + * @return self A proxy class returning only valid values + */ + public function valid(?\Closure $validator = null, int $maxRetries = 10000) + { + return new ValidGenerator($this, $validator, $maxRetries); + } + + public function seed($seed = null) + { + if ($seed === null) { + mt_srand(); + } else { + mt_srand((int) $seed, self::mode()); + } + } + + /** + * @see https://www.php.net/manual/en/migration83.deprecated.php#migration83.deprecated.random + */ + private static function mode(): int + { + if (PHP_VERSION_ID < 80300) { + return MT_RAND_PHP; + } + + return MT_RAND_MT19937; + } + + public function format($format, $arguments = []) + { + return call_user_func_array($this->getFormatter($format), $arguments); + } + + /** + * @param string $format + * + * @return callable + */ + public function getFormatter($format) + { + if (isset($this->formatters[$format])) { + return $this->formatters[$format]; + } + + if (method_exists($this, $format)) { + $this->formatters[$format] = [$this, $format]; + + return $this->formatters[$format]; + } + + // "Faker\Core\Barcode->ean13" + if (preg_match('|^([a-zA-Z0-9\\\]+)->([a-zA-Z0-9]+)$|', $format, $matches)) { + $this->formatters[$format] = [$this->ext($matches[1]), $matches[2]]; + + return $this->formatters[$format]; + } + + foreach ($this->providers as $provider) { + if (method_exists($provider, $format)) { + $this->formatters[$format] = [$provider, $format]; + + return $this->formatters[$format]; + } + } + + throw new \InvalidArgumentException(sprintf('Unknown format "%s"', $format)); + } + + /** + * Replaces tokens ('{{ tokenName }}') with the result from the token method call + * + * @param string $string String that needs to bet parsed + * + * @return string + */ + public function parse($string) + { + $callback = function ($matches) { + return $this->format($matches[1]); + }; + + return preg_replace_callback('/{{\s?(\w+|[\w\\\]+->\w+?)\s?}}/u', $callback, $string); + } + + /** + * Get a random MIME type + * + * @example 'video/avi' + */ + public function mimeType() + { + return $this->ext(Extension\FileExtension::class)->mimeType(); + } + + /** + * Get a random file extension (without a dot) + * + * @example avi + */ + public function fileExtension() + { + return $this->ext(Extension\FileExtension::class)->extension(); + } + + /** + * Get a full path to a new real file on the system. + */ + public function filePath() + { + return $this->ext(Extension\FileExtension::class)->filePath(); + } + + /** + * Get an actual blood type + * + * @example 'AB' + */ + public function bloodType(): string + { + return $this->ext(Extension\BloodExtension::class)->bloodType(); + } + + /** + * Get a random resis value + * + * @example '+' + */ + public function bloodRh(): string + { + return $this->ext(Extension\BloodExtension::class)->bloodRh(); + } + + /** + * Get a full blood group + * + * @example 'AB+' + */ + public function bloodGroup(): string + { + return $this->ext(Extension\BloodExtension::class)->bloodGroup(); + } + + /** + * Get a random EAN13 barcode. + * + * @example '4006381333931' + */ + public function ean13(): string + { + return $this->ext(Extension\BarcodeExtension::class)->ean13(); + } + + /** + * Get a random EAN8 barcode. + * + * @example '73513537' + */ + public function ean8(): string + { + return $this->ext(Extension\BarcodeExtension::class)->ean8(); + } + + /** + * Get a random ISBN-10 code + * + * @see http://en.wikipedia.org/wiki/International_Standard_Book_Number + * + * @example '4881416324' + */ + public function isbn10(): string + { + return $this->ext(Extension\BarcodeExtension::class)->isbn10(); + } + + /** + * Get a random ISBN-13 code + * + * @see http://en.wikipedia.org/wiki/International_Standard_Book_Number + * + * @example '9790404436093' + */ + public function isbn13(): string + { + return $this->ext(Extension\BarcodeExtension::class)->isbn13(); + } + + /** + * Returns a random number between $int1 and $int2 (any order) + * + * @example 79907610 + */ + public function numberBetween($int1 = 0, $int2 = 2147483647): int + { + return $this->ext(Extension\NumberExtension::class)->numberBetween((int) $int1, (int) $int2); + } + + /** + * Returns a random number between 0 and 9 + */ + public function randomDigit(): int + { + return $this->ext(Extension\NumberExtension::class)->randomDigit(); + } + + /** + * Generates a random digit, which cannot be $except + */ + public function randomDigitNot($except): int + { + return $this->ext(Extension\NumberExtension::class)->randomDigitNot((int) $except); + } + + /** + * Returns a random number between 1 and 9 + */ + public function randomDigitNotZero(): int + { + return $this->ext(Extension\NumberExtension::class)->randomDigitNotZero(); + } + + /** + * Return a random float number + * + * @example 48.8932 + */ + public function randomFloat($nbMaxDecimals = null, $min = 0, $max = null): float + { + return $this->ext(Extension\NumberExtension::class)->randomFloat( + $nbMaxDecimals !== null ? (int) $nbMaxDecimals : null, + (float) $min, + $max !== null ? (float) $max : null, + ); + } + + /** + * Returns a random integer with 0 to $nbDigits digits. + * + * The maximum value returned is mt_getrandmax() + * + * @param int|null $nbDigits Defaults to a random number between 1 and 9 + * @param bool $strict Whether the returned number should have exactly $nbDigits + * + * @example 79907610 + */ + public function randomNumber($nbDigits = null, $strict = false): int + { + return $this->ext(Extension\NumberExtension::class)->randomNumber( + $nbDigits !== null ? (int) $nbDigits : null, + (bool) $strict, + ); + } + + /** + * Get a version number in semantic versioning syntax 2.0.0. (https://semver.org/spec/v2.0.0.html) + * + * @param bool $preRelease Pre release parts may be randomly included + * @param bool $build Build parts may be randomly included + * + * @example 1.0.0 + * @example 1.0.0-alpha.1 + * @example 1.0.0-alpha.1+b71f04d + */ + public function semver(bool $preRelease = false, bool $build = false): string + { + return $this->ext(Extension\VersionExtension::class)->semver($preRelease, $build); + } + + /** + * @deprecated + */ + protected function callFormatWithMatches($matches) + { + trigger_deprecation('fakerphp/faker', '1.14', 'Protected method "callFormatWithMatches()" is deprecated and will be removed.'); + + return $this->format($matches[1]); + } + + /** + * @param string $attribute + * + * @deprecated Use a method instead. + */ + public function __get($attribute) + { + trigger_deprecation('fakerphp/faker', '1.14', 'Accessing property "%s" is deprecated, use "%s()" instead.', $attribute, $attribute); + + return $this->format($attribute); + } + + /** + * @param string $method + * @param array $attributes + */ + public function __call($method, $attributes) + { + return $this->format($method, $attributes); + } + + public function __destruct() + { + $this->seed(); + } + + public function __wakeup() + { + $this->formatters = []; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Guesser/Name.php b/vendor/fakerphp/faker/src/Faker/Guesser/Name.php new file mode 100644 index 00000000..ddb048bc --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Guesser/Name.php @@ -0,0 +1,180 @@ +generator = $generator; + } + + /** + * @param string $name + * @param int|null $size Length of field, if known + * + * @return callable|null + */ + public function guessFormat($name, $size = null) + { + $name = Base::toLower($name); + $generator = $this->generator; + + if (preg_match('/^is[_A-Z]/', $name)) { + return static function () use ($generator) { + return $generator->boolean; + }; + } + + if (preg_match('/(_a|A)t$/', $name)) { + return static function () use ($generator) { + return $generator->dateTime; + }; + } + + switch (str_replace('_', '', $name)) { + case 'firstname': + return static function () use ($generator) { + return $generator->firstName; + }; + + case 'lastname': + return static function () use ($generator) { + return $generator->lastName; + }; + + case 'username': + case 'login': + return static function () use ($generator) { + return $generator->userName; + }; + + case 'email': + case 'emailaddress': + return static function () use ($generator) { + return $generator->email; + }; + + case 'phonenumber': + case 'phone': + case 'telephone': + case 'telnumber': + return static function () use ($generator) { + return $generator->phoneNumber; + }; + + case 'address': + return static function () use ($generator) { + return $generator->address; + }; + + case 'city': + case 'town': + return static function () use ($generator) { + return $generator->city; + }; + + case 'streetaddress': + return static function () use ($generator) { + return $generator->streetAddress; + }; + + case 'postcode': + case 'zipcode': + return static function () use ($generator) { + return $generator->postcode; + }; + + case 'state': + return static function () use ($generator) { + return $generator->state; + }; + + case 'county': + if ($this->generator->locale == 'en_US') { + return static function () use ($generator) { + return sprintf('%s County', $generator->city); + }; + } + + return static function () use ($generator) { + return $generator->state; + }; + + case 'country': + switch ($size) { + case 2: + return static function () use ($generator) { + return $generator->countryCode; + }; + + case 3: + return static function () use ($generator) { + return $generator->countryISOAlpha3; + }; + + case 5: + case 6: + return static function () use ($generator) { + return $generator->locale; + }; + + default: + return static function () use ($generator) { + return $generator->country; + }; + } + + break; + + case 'locale': + return static function () use ($generator) { + return $generator->locale; + }; + + case 'currency': + case 'currencycode': + return static function () use ($generator) { + return $generator->currencyCode; + }; + + case 'url': + case 'website': + return static function () use ($generator) { + return $generator->url; + }; + + case 'company': + case 'companyname': + case 'employer': + return static function () use ($generator) { + return $generator->company; + }; + + case 'title': + if ($size !== null && $size <= 10) { + return static function () use ($generator) { + return $generator->title; + }; + } + + return static function () use ($generator) { + return $generator->sentence; + }; + + case 'body': + case 'summary': + case 'article': + case 'description': + return static function () use ($generator) { + return $generator->text; + }; + } + + return null; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/CakePHP/ColumnTypeGuesser.php b/vendor/fakerphp/faker/src/Faker/ORM/CakePHP/ColumnTypeGuesser.php new file mode 100644 index 00000000..c2a30e67 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/CakePHP/ColumnTypeGuesser.php @@ -0,0 +1,79 @@ +generator = $generator; + } + + /** + * @return \Closure|null + */ + public function guessFormat($column, $table) + { + $generator = $this->generator; + $schema = $table->schema(); + + switch ($schema->columnType($column)) { + case 'boolean': + return static function () use ($generator) { + return $generator->boolean; + }; + + case 'integer': + return static function () use ($generator) { + return $generator->numberBetween(0, 2147483647); + }; + + case 'biginteger': + return static function () use ($generator) { + return $generator->numberBetween(0, PHP_INT_MAX); + }; + + case 'decimal': + case 'float': + return static function () use ($generator) { + return $generator->randomFloat(); + }; + + case 'uuid': + return static function () use ($generator) { + return $generator->uuid(); + }; + + case 'string': + if (method_exists($schema, 'getColumn')) { + $columnData = $schema->getColumn($column); + } else { + $columnData = $schema->column($column); + } + $length = $columnData['length']; + + return static function () use ($generator, $length) { + return $generator->text($length); + }; + + case 'text': + return static function () use ($generator) { + return $generator->text(); + }; + + case 'date': + case 'datetime': + case 'timestamp': + case 'time': + return static function () use ($generator) { + return $generator->datetime(); + }; + + case 'binary': + default: + return null; + } + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/CakePHP/EntityPopulator.php b/vendor/fakerphp/faker/src/Faker/ORM/CakePHP/EntityPopulator.php new file mode 100644 index 00000000..cd9890bd --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/CakePHP/EntityPopulator.php @@ -0,0 +1,173 @@ +class = $class; + } + + /** + * @param string $name + */ + public function __get($name) + { + return $this->{$name}; + } + + /** + * @param string $name + */ + public function __set($name, $value) + { + $this->{$name} = $value; + } + + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + public function mergeModifiersWith($modifiers) + { + $this->modifiers = array_merge($this->modifiers, $modifiers); + } + + /** + * @return array + */ + public function guessColumnFormatters($populator) + { + $formatters = []; + $class = $this->class; + $table = $this->getTable($class); + $schema = $table->schema(); + $pk = $schema->primaryKey(); + $guessers = $populator->getGuessers() + ['ColumnTypeGuesser' => new ColumnTypeGuesser($populator->getGenerator())]; + $isForeignKey = static function ($column) use ($table) { + foreach ($table->associations()->type('BelongsTo') as $assoc) { + if ($column == $assoc->foreignKey()) { + return true; + } + } + + return false; + }; + + foreach ($schema->columns() as $column) { + if ($column == $pk[0] || $isForeignKey($column)) { + continue; + } + + foreach ($guessers as $guesser) { + if ($formatter = $guesser->guessFormat($column, $table)) { + $formatters[$column] = $formatter; + + break; + } + } + } + + return $formatters; + } + + /** + * @return array + */ + public function guessModifiers() + { + $modifiers = []; + $table = $this->getTable($this->class); + + $belongsTo = $table->associations()->type('BelongsTo'); + + foreach ($belongsTo as $assoc) { + $modifiers['belongsTo' . $assoc->name()] = function ($data, $insertedEntities) use ($assoc) { + $table = $assoc->target(); + $foreignModel = $table->alias(); + + $foreignKeys = []; + + if (!empty($insertedEntities[$foreignModel])) { + $foreignKeys = $insertedEntities[$foreignModel]; + } else { + $foreignKeys = $table->find('all') + ->select(['id']) + ->map(static function ($row) { + return $row->id; + }) + ->toArray(); + } + + if (empty($foreignKeys)) { + throw new \Exception(sprintf('%s belongsTo %s, which seems empty at this point.', $this->getTable($this->class)->table(), $assoc->table())); + } + + $foreignKey = $foreignKeys[array_rand($foreignKeys)]; + $data[$assoc->foreignKey()] = $foreignKey; + + return $data; + }; + } + + // TODO check if TreeBehavior attached to modify lft/rgt cols + + return $modifiers; + } + + /** + * @param array $options + */ + public function execute($class, $insertedEntities, $options = []) + { + $table = $this->getTable($class); + $entity = $table->newEntity(); + + foreach ($this->columnFormatters as $column => $format) { + if (null !== $format) { + $entity->{$column} = is_callable($format) ? $format($insertedEntities, $table) : $format; + } + } + + foreach ($this->modifiers as $modifier) { + $entity = $modifier($entity, $insertedEntities); + } + + if (!$entity = $table->save($entity, $options)) { + throw new \RuntimeException("Failed saving $class record"); + } + + $pk = $table->primaryKey(); + + if (is_string($pk)) { + return $entity->{$pk}; + } + + return $entity->{$pk[0]}; + } + + public function setConnection($name) + { + $this->connectionName = $name; + } + + protected function getTable($class) + { + $options = []; + + if (!empty($this->connectionName)) { + $options['connection'] = $this->connectionName; + } + + return TableRegistry::get($class, $options); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/CakePHP/Populator.php b/vendor/fakerphp/faker/src/Faker/ORM/CakePHP/Populator.php new file mode 100644 index 00000000..ac195fbd --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/CakePHP/Populator.php @@ -0,0 +1,113 @@ +generator = $generator; + } + + /** + * @return \Faker\Generator + */ + public function getGenerator() + { + return $this->generator; + } + + /** + * @return array + */ + public function getGuessers() + { + return $this->guessers; + } + + /** + * @return $this + */ + public function removeGuesser($name) + { + if ($this->guessers[$name]) { + unset($this->guessers[$name]); + } + + return $this; + } + + /** + * @throws \Exception + * + * @return $this + */ + public function addGuesser($class) + { + if (!is_object($class)) { + $class = new $class($this->generator); + } + + if (!method_exists($class, 'guessFormat')) { + throw new \Exception('Missing required custom guesser method: ' . get_class($class) . '::guessFormat()'); + } + + $this->guessers[get_class($class)] = $class; + + return $this; + } + + /** + * @param array $customColumnFormatters + * @param array $customModifiers + * + * @return $this + */ + public function addEntity($entity, $number, $customColumnFormatters = [], $customModifiers = []) + { + if (!$entity instanceof EntityPopulator) { + $entity = new EntityPopulator($entity); + } + + $entity->columnFormatters = $entity->guessColumnFormatters($this); + + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + + $entity->modifiers = $entity->guessModifiers($this); + + if ($customModifiers) { + $entity->mergeModifiersWith($customModifiers); + } + + $class = $entity->class; + $this->entities[$class] = $entity; + $this->quantities[$class] = $number; + + return $this; + } + + /** + * @param array $options + * + * @return array + */ + public function execute($options = []) + { + $insertedEntities = []; + + foreach ($this->quantities as $class => $number) { + for ($i = 0; $i < $number; ++$i) { + $insertedEntities[$class][] = $this->entities[$class]->execute($class, $insertedEntities, $options); + } + } + + return $insertedEntities; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Doctrine/ColumnTypeGuesser.php b/vendor/fakerphp/faker/src/Faker/ORM/Doctrine/ColumnTypeGuesser.php new file mode 100644 index 00000000..3267fe46 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Doctrine/ColumnTypeGuesser.php @@ -0,0 +1,91 @@ +generator = $generator; + } + + /** + * @return \Closure|null + */ + public function guessFormat($fieldName, ClassMetadata $class) + { + $generator = $this->generator; + $type = $class->getTypeOfField($fieldName); + + switch ($type) { + case 'boolean': + return static function () use ($generator) { + return $generator->boolean; + }; + + case 'decimal': + $size = $class->fieldMappings[$fieldName]['precision'] ?? 2; + + return static function () use ($generator, $size) { + return $generator->randomNumber($size + 2) / 100; + }; + + case 'smallint': + return static function () use ($generator) { + return $generator->numberBetween(0, 65535); + }; + + case 'integer': + return static function () use ($generator) { + return $generator->numberBetween(0, 2147483647); + }; + + case 'bigint': + return static function () use ($generator) { + return $generator->numberBetween(0, PHP_INT_MAX); + }; + + case 'float': + return static function () use ($generator) { + return $generator->randomFloat(); + }; + + case 'string': + $size = $class->fieldMappings[$fieldName]['length'] ?? 255; + + return static function () use ($generator, $size) { + return $generator->text($size); + }; + + case 'text': + return static function () use ($generator) { + return $generator->text; + }; + + case 'datetime': + case 'date': + case 'time': + return static function () use ($generator) { + return $generator->datetime; + }; + + case 'datetime_immutable': + case 'date_immutable': + case 'time_immutable': + return static function () use ($generator) { + return \DateTimeImmutable::createFromMutable($generator->datetime); + }; + + default: + // no smart way to guess what the user expects here + return null; + } + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Doctrine/EntityPopulator.php b/vendor/fakerphp/faker/src/Faker/ORM/Doctrine/EntityPopulator.php new file mode 100644 index 00000000..47923999 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Doctrine/EntityPopulator.php @@ -0,0 +1,248 @@ +class = $class; + } + + /** + * @return string + */ + public function getClass() + { + return $this->class->getName(); + } + + public function setColumnFormatters($columnFormatters) + { + $this->columnFormatters = $columnFormatters; + } + + /** + * @return array + */ + public function getColumnFormatters() + { + return $this->columnFormatters; + } + + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + public function setModifiers(array $modifiers) + { + $this->modifiers = $modifiers; + } + + /** + * @return array + */ + public function getModifiers() + { + return $this->modifiers; + } + + public function mergeModifiersWith(array $modifiers) + { + $this->modifiers = array_merge($this->modifiers, $modifiers); + } + + /** + * @return array + */ + public function guessColumnFormatters(\Faker\Generator $generator) + { + $formatters = []; + $nameGuesser = new \Faker\Guesser\Name($generator); + $columnTypeGuesser = new ColumnTypeGuesser($generator); + + foreach ($this->class->getFieldNames() as $fieldName) { + if ($this->class->isIdentifier($fieldName) || !$this->class->hasField($fieldName)) { + continue; + } + + $size = $this->class->fieldMappings[$fieldName]['length'] ?? null; + + if ($formatter = $nameGuesser->guessFormat($fieldName, $size)) { + $formatters[$fieldName] = $formatter; + + continue; + } + + if ($formatter = $columnTypeGuesser->guessFormat($fieldName, $this->class)) { + $formatters[$fieldName] = $formatter; + + continue; + } + } + + foreach ($this->class->getAssociationNames() as $assocName) { + if ($this->class->isCollectionValuedAssociation($assocName)) { + continue; + } + + $relatedClass = $this->class->getAssociationTargetClass($assocName); + + $unique = $optional = false; + + if ($this->class instanceof \Doctrine\ORM\Mapping\ClassMetadata) { + $mappings = $this->class->getAssociationMappings(); + + foreach ($mappings as $mapping) { + if ($mapping['targetEntity'] == $relatedClass) { + if ($mapping['type'] == \Doctrine\ORM\Mapping\ClassMetadata::ONE_TO_ONE) { + $unique = true; + $optional = $mapping['joinColumns'][0]['nullable'] ?? false; + + break; + } + } + } + } elseif ($this->class instanceof \Doctrine\ODM\MongoDB\Mapping\ClassMetadata) { + $mappings = $this->class->associationMappings; + + foreach ($mappings as $mapping) { + if ($mapping['targetDocument'] == $relatedClass) { + if ($mapping['type'] == \Doctrine\ODM\MongoDB\Mapping\ClassMetadata::ONE && $mapping['association'] == \Doctrine\ODM\MongoDB\Mapping\ClassMetadata::REFERENCE_ONE) { + $unique = true; + $optional = $mapping['nullable'] ?? false; + + break; + } + } + } + } + + $index = 0; + $formatters[$assocName] = static function ($inserted) use ($relatedClass, &$index, $unique, $optional, $generator) { + if (isset($inserted[$relatedClass])) { + if ($unique) { + $related = null; + + if (isset($inserted[$relatedClass][$index]) || !$optional) { + $related = $inserted[$relatedClass][$index]; + } + + ++$index; + + return $related; + } + + return $generator->randomElement($inserted[$relatedClass]); + } + + return null; + }; + } + + return $formatters; + } + + /** + * Insert one new record using the Entity class. + * + * @param bool $generateId + * + * @return EntityPopulator + */ + public function execute(ObjectManager $manager, $insertedEntities, $generateId = false) + { + $obj = $this->class->newInstance(); + + $this->fillColumns($obj, $insertedEntities); + $this->callMethods($obj, $insertedEntities); + + if ($generateId) { + $idsName = $this->class->getIdentifier(); + + foreach ($idsName as $idName) { + $id = $this->generateId($obj, $idName, $manager); + $this->class->reflFields[$idName]->setValue($obj, $id); + } + } + + $manager->persist($obj); + + return $obj; + } + + private function fillColumns($obj, $insertedEntities): void + { + foreach ($this->columnFormatters as $field => $format) { + if (null !== $format) { + // Add some extended debugging information to any errors thrown by the formatter + try { + $value = is_callable($format) ? $format($insertedEntities, $obj) : $format; + } catch (\InvalidArgumentException $ex) { + throw new \InvalidArgumentException(sprintf( + 'Failed to generate a value for %s::%s: %s', + get_class($obj), + $field, + $ex->getMessage(), + )); + } + // Try a standard setter if it's available, otherwise fall back on reflection + $setter = sprintf('set%s', ucfirst($field)); + + if (is_callable([$obj, $setter])) { + $obj->$setter($value); + } else { + $this->class->reflFields[$field]->setValue($obj, $value); + } + } + } + } + + private function callMethods($obj, $insertedEntities): void + { + foreach ($this->getModifiers() as $modifier) { + $modifier($obj, $insertedEntities); + } + } + + /** + * @return int + */ + private function generateId($obj, $column, ObjectManager $manager) + { + $repository = $manager->getRepository(get_class($obj)); + $result = $repository->createQueryBuilder('e') + ->select(sprintf('e.%s', $column)) + ->getQuery() + ->execute(); + $ids = array_map('current', $result->toArray()); + + do { + $id = mt_rand(); + } while (in_array($id, $ids, false)); + + return $id; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Doctrine/Populator.php b/vendor/fakerphp/faker/src/Faker/ORM/Doctrine/Populator.php new file mode 100644 index 00000000..1bce6ab4 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Doctrine/Populator.php @@ -0,0 +1,126 @@ +generator = $generator; + $this->manager = $manager; + $this->batchSize = $batchSize; + } + + /** + * Add an order for the generation of $number records for $entity. + * + * @param mixed $entity A Doctrine classname, or a \Faker\ORM\Doctrine\EntityPopulator instance + * @param int $number The number of entities to populate + */ + public function addEntity($entity, $number, $customColumnFormatters = [], $customModifiers = [], $generateId = false) + { + if (!$entity instanceof \Faker\ORM\Doctrine\EntityPopulator) { + if (null === $this->manager) { + throw new \InvalidArgumentException('No entity manager passed to Doctrine Populator.'); + } + $entity = new \Faker\ORM\Doctrine\EntityPopulator($this->manager->getClassMetadata($entity)); + } + $entity->setColumnFormatters($entity->guessColumnFormatters($this->generator)); + + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + $entity->mergeModifiersWith($customModifiers); + $this->generateId[$entity->getClass()] = $generateId; + + $class = $entity->getClass(); + $this->entities[$class] = $entity; + $this->quantities[$class] = $number; + } + + /** + * Populate the database using all the Entity classes previously added. + * + * Please note that large amounts of data will result in more memory usage since the the Populator will return + * all newly created primary keys after executing. + * + * @param ObjectManager|null $entityManager A Doctrine connection object + * + * @return array A list of the inserted PKs + */ + public function execute($entityManager = null) + { + if (null === $entityManager) { + $entityManager = $this->manager; + } + + if (null === $entityManager) { + throw new \InvalidArgumentException('No entity manager passed to Doctrine Populator.'); + } + + $insertedEntities = []; + + foreach ($this->quantities as $class => $number) { + $generateId = $this->generateId[$class]; + + for ($i = 0; $i < $number; ++$i) { + $insertedEntities[$class][] = $this->entities[$class]->execute( + $entityManager, + $insertedEntities, + $generateId, + ); + + if (count($insertedEntities) % $this->batchSize === 0) { + $entityManager->flush(); + } + } + $entityManager->flush(); + } + + return $insertedEntities; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Doctrine/backward-compatibility.php b/vendor/fakerphp/faker/src/Faker/ORM/Doctrine/backward-compatibility.php new file mode 100644 index 00000000..6f545f87 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Doctrine/backward-compatibility.php @@ -0,0 +1,11 @@ +generator = $generator; + } + + /** + * @return \Closure|null + */ + public function guessFormat($field) + { + $generator = $this->generator; + + switch ($field['type']) { + case 'boolean': + return static function () use ($generator) { + return $generator->boolean; + }; + + case 'integer': + return static function () use ($generator) { + return $generator->numberBetween(0, 4294967295); + }; + + case 'float': + return static function () use ($generator) { + return $generator->randomFloat(); + }; + + case 'string': + return static function () use ($generator) { + return $generator->text(255); + }; + + case 'date': + return static function () use ($generator) { + return $generator->dateTime; + }; + + default: + // no smart way to guess what the user expects here + return null; + } + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Mandango/EntityPopulator.php b/vendor/fakerphp/faker/src/Faker/ORM/Mandango/EntityPopulator.php new file mode 100644 index 00000000..515ab7b6 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Mandango/EntityPopulator.php @@ -0,0 +1,123 @@ +class = $class; + } + + /** + * @return string + */ + public function getClass() + { + return $this->class; + } + + public function setColumnFormatters($columnFormatters) + { + $this->columnFormatters = $columnFormatters; + } + + /** + * @return array + */ + public function getColumnFormatters() + { + return $this->columnFormatters; + } + + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + /** + * @return array + */ + public function guessColumnFormatters(\Faker\Generator $generator, Mandango $mandango) + { + $formatters = []; + $nameGuesser = new \Faker\Guesser\Name($generator); + $columnTypeGuesser = new \Faker\ORM\Mandango\ColumnTypeGuesser($generator); + + $metadata = $mandango->getMetadata($this->class); + + // fields + foreach ($metadata['fields'] as $fieldName => $field) { + if ($formatter = $nameGuesser->guessFormat($fieldName)) { + $formatters[$fieldName] = $formatter; + + continue; + } + + if ($formatter = $columnTypeGuesser->guessFormat($field)) { + $formatters[$fieldName] = $formatter; + + continue; + } + } + + // references + foreach (array_merge($metadata['referencesOne'], $metadata['referencesMany']) as $referenceName => $reference) { + if (!isset($reference['class'])) { + continue; + } + $referenceClass = $reference['class']; + + $formatters[$referenceName] = static function ($insertedEntities) use ($referenceClass) { + if (isset($insertedEntities[$referenceClass])) { + return Base::randomElement($insertedEntities[$referenceClass]); + } + + return null; + }; + } + + return $formatters; + } + + /** + * Insert one new record using the Entity class. + */ + public function execute(Mandango $mandango, $insertedEntities) + { + $metadata = $mandango->getMetadata($this->class); + + $obj = $mandango->create($this->class); + + foreach ($this->columnFormatters as $column => $format) { + if (null !== $format) { + $value = is_callable($format) ? $format($insertedEntities, $obj) : $format; + + if (isset($metadata['fields'][$column]) + || isset($metadata['referencesOne'][$column])) { + $obj->set($column, $value); + } + + if (isset($metadata['referencesMany'][$column])) { + $adder = 'add' . ucfirst($column); + $obj->$adder($value); + } + } + } + $mandango->persist($obj); + + return $obj; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Mandango/Populator.php b/vendor/fakerphp/faker/src/Faker/ORM/Mandango/Populator.php new file mode 100644 index 00000000..de6c3b81 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Mandango/Populator.php @@ -0,0 +1,63 @@ +generator = $generator; + $this->mandango = $mandango; + } + + /** + * Add an order for the generation of $number records for $entity. + * + * @param mixed $entity A Propel ActiveRecord classname, or a \Faker\ORM\Propel\EntityPopulator instance + * @param int $number The number of entities to populate + */ + public function addEntity($entity, $number, $customColumnFormatters = []) + { + if (!$entity instanceof \Faker\ORM\Mandango\EntityPopulator) { + $entity = new \Faker\ORM\Mandango\EntityPopulator($entity); + } + $entity->setColumnFormatters($entity->guessColumnFormatters($this->generator, $this->mandango)); + + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + $class = $entity->getClass(); + $this->entities[$class] = $entity; + $this->quantities[$class] = $number; + } + + /** + * Populate the database using all the Entity classes previously added. + * + * @return array A list of the inserted entities. + */ + public function execute() + { + $insertedEntities = []; + + foreach ($this->quantities as $class => $number) { + for ($i = 0; $i < $number; ++$i) { + $insertedEntities[$class][] = $this->entities[$class]->execute($this->mandango, $insertedEntities); + } + } + $this->mandango->flush(); + + return $insertedEntities; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Propel/ColumnTypeGuesser.php b/vendor/fakerphp/faker/src/Faker/ORM/Propel/ColumnTypeGuesser.php new file mode 100644 index 00000000..3d8a9a11 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Propel/ColumnTypeGuesser.php @@ -0,0 +1,109 @@ +generator = $generator; + } + + /** + * @return \Closure|null + */ + public function guessFormat(\ColumnMap $column) + { + $generator = $this->generator; + + if ($column->isTemporal()) { + if ($column->isEpochTemporal()) { + return static function () use ($generator) { + return $generator->dateTime; + }; + } + + return static function () use ($generator) { + return $generator->dateTimeAD; + }; + } + $type = $column->getType(); + + switch ($type) { + case \PropelColumnTypes::BOOLEAN: + case \PropelColumnTypes::BOOLEAN_EMU: + return static function () use ($generator) { + return $generator->boolean; + }; + + case \PropelColumnTypes::NUMERIC: + case \PropelColumnTypes::DECIMAL: + $size = $column->getSize(); + + return static function () use ($generator, $size) { + return $generator->randomNumber($size + 2) / 100; + }; + + case \PropelColumnTypes::TINYINT: + return static function () use ($generator) { + return $generator->numberBetween(0, 127); + }; + + case \PropelColumnTypes::SMALLINT: + return static function () use ($generator) { + return $generator->numberBetween(0, 32767); + }; + + case \PropelColumnTypes::INTEGER: + return static function () use ($generator) { + return $generator->numberBetween(0, 2147483647); + }; + + case \PropelColumnTypes::BIGINT: + return static function () use ($generator) { + return $generator->numberBetween(0, PHP_INT_MAX); + }; + + case \PropelColumnTypes::FLOAT: + case \PropelColumnTypes::DOUBLE: + case \PropelColumnTypes::REAL: + return static function () use ($generator) { + return $generator->randomFloat(); + }; + + case \PropelColumnTypes::CHAR: + case \PropelColumnTypes::VARCHAR: + case \PropelColumnTypes::BINARY: + case \PropelColumnTypes::VARBINARY: + $size = $column->getSize(); + + return static function () use ($generator, $size) { + return $generator->text($size); + }; + + case \PropelColumnTypes::LONGVARCHAR: + case \PropelColumnTypes::LONGVARBINARY: + case \PropelColumnTypes::CLOB: + case \PropelColumnTypes::CLOB_EMU: + case \PropelColumnTypes::BLOB: + return static function () use ($generator) { + return $generator->text; + }; + + case \PropelColumnTypes::ENUM: + $valueSet = $column->getValueSet(); + + return static function () use ($generator, $valueSet) { + return $generator->randomElement($valueSet); + }; + + case \PropelColumnTypes::OBJECT: + case \PropelColumnTypes::PHP_ARRAY: + default: + // no smart way to guess what the user expects here + return null; + } + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Propel/EntityPopulator.php b/vendor/fakerphp/faker/src/Faker/ORM/Propel/EntityPopulator.php new file mode 100644 index 00000000..f5af75c9 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Propel/EntityPopulator.php @@ -0,0 +1,204 @@ +class = $class; + } + + /** + * @return string + */ + public function getClass() + { + return $this->class; + } + + public function setColumnFormatters($columnFormatters) + { + $this->columnFormatters = $columnFormatters; + } + + /** + * @return array + */ + public function getColumnFormatters() + { + return $this->columnFormatters; + } + + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + /** + * @return array + */ + public function guessColumnFormatters(\Faker\Generator $generator) + { + $formatters = []; + $class = $this->class; + $peerClass = $class::PEER; + $tableMap = $peerClass::getTableMap(); + $nameGuesser = new \Faker\Guesser\Name($generator); + $columnTypeGuesser = new \Faker\ORM\Propel\ColumnTypeGuesser($generator); + + foreach ($tableMap->getColumns() as $columnMap) { + // skip behavior columns, handled by modifiers + if ($this->isColumnBehavior($columnMap)) { + continue; + } + + if ($columnMap->isForeignKey()) { + $relatedClass = $columnMap->getRelation()->getForeignTable()->getClassname(); + $formatters[$columnMap->getPhpName()] = static function ($inserted) use ($relatedClass, $generator) { + return isset($inserted[$relatedClass]) ? $generator->randomElement($inserted[$relatedClass]) : null; + }; + + continue; + } + + if ($columnMap->isPrimaryKey()) { + continue; + } + + if ($formatter = $nameGuesser->guessFormat($columnMap->getPhpName(), $columnMap->getSize())) { + $formatters[$columnMap->getPhpName()] = $formatter; + + continue; + } + + if ($formatter = $columnTypeGuesser->guessFormat($columnMap)) { + $formatters[$columnMap->getPhpName()] = $formatter; + + continue; + } + } + + return $formatters; + } + + /** + * @return bool + */ + protected function isColumnBehavior(\ColumnMap $columnMap) + { + foreach ($columnMap->getTable()->getBehaviors() as $name => $params) { + $columnName = Base::toLower($columnMap->getName()); + + switch ($name) { + case 'nested_set': + $columnNames = [$params['left_column'], $params['right_column'], $params['level_column']]; + + if (in_array($columnName, $columnNames, false)) { + return true; + } + + break; + + case 'timestampable': + $columnNames = [$params['create_column'], $params['update_column']]; + + if (in_array($columnName, $columnNames, false)) { + return true; + } + + break; + } + } + + return false; + } + + public function setModifiers($modifiers) + { + $this->modifiers = $modifiers; + } + + /** + * @return array + */ + public function getModifiers() + { + return $this->modifiers; + } + + public function mergeModifiersWith($modifiers) + { + $this->modifiers = array_merge($this->modifiers, $modifiers); + } + + /** + * @return array + */ + public function guessModifiers(\Faker\Generator $generator) + { + $modifiers = []; + $class = $this->class; + $peerClass = $class::PEER; + $tableMap = $peerClass::getTableMap(); + + foreach ($tableMap->getBehaviors() as $name => $params) { + switch ($name) { + case 'nested_set': + $modifiers['nested_set'] = static function ($obj, $inserted) use ($class, $generator): void { + if (isset($inserted[$class])) { + $queryClass = $class . 'Query'; + $parent = $queryClass::create()->findPk($generator->randomElement($inserted[$class])); + $obj->insertAsLastChildOf($parent); + } else { + $obj->makeRoot(); + } + }; + + break; + + case 'sortable': + $modifiers['sortable'] = static function ($obj, $inserted) use ($class, $generator): void { + $obj->insertAtRank($generator->numberBetween(1, count($inserted[$class] ?? []) + 1)); + }; + + break; + } + } + + return $modifiers; + } + + /** + * Insert one new record using the Entity class. + */ + public function execute($con, $insertedEntities) + { + $obj = new $this->class(); + + foreach ($this->getColumnFormatters() as $column => $format) { + if (null !== $format) { + $obj->setByName($column, is_callable($format) ? $format($insertedEntities, $obj) : $format); + } + } + + foreach ($this->getModifiers() as $modifier) { + $modifier($obj, $insertedEntities); + } + $obj->save($con); + + return $obj->getPrimaryKey(); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Propel/Populator.php b/vendor/fakerphp/faker/src/Faker/ORM/Propel/Populator.php new file mode 100644 index 00000000..e3d42981 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Propel/Populator.php @@ -0,0 +1,90 @@ +generator = $generator; + } + + /** + * Add an order for the generation of $number records for $entity. + * + * @param mixed $entity A Propel ActiveRecord classname, or a \Faker\ORM\Propel\EntityPopulator instance + * @param int $number The number of entities to populate + */ + public function addEntity($entity, $number, $customColumnFormatters = [], $customModifiers = []) + { + if (!$entity instanceof \Faker\ORM\Propel\EntityPopulator) { + $entity = new \Faker\ORM\Propel\EntityPopulator($entity); + } + $entity->setColumnFormatters($entity->guessColumnFormatters($this->generator)); + + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + $entity->setModifiers($entity->guessModifiers($this->generator)); + + if ($customModifiers) { + $entity->mergeModifiersWith($customModifiers); + } + $class = $entity->getClass(); + $this->entities[$class] = $entity; + $this->quantities[$class] = $number; + } + + /** + * Populate the database using all the Entity classes previously added. + * + * @param PropelPDO $con A Propel connection object + * + * @return array A list of the inserted PKs + */ + public function execute($con = null) + { + if (null === $con) { + $con = $this->getConnection(); + } + $isInstancePoolingEnabled = \Propel::isInstancePoolingEnabled(); + \Propel::disableInstancePooling(); + $insertedEntities = []; + $con->beginTransaction(); + + foreach ($this->quantities as $class => $number) { + for ($i = 0; $i < $number; ++$i) { + $insertedEntities[$class][] = $this->entities[$class]->execute($con, $insertedEntities); + } + } + $con->commit(); + + if ($isInstancePoolingEnabled) { + \Propel::enableInstancePooling(); + } + + return $insertedEntities; + } + + protected function getConnection() + { + // use the first connection available + $class = key($this->entities); + + if (!$class) { + throw new \RuntimeException('No class found from entities. Did you add entities to the Populator ?'); + } + + $peer = $class::PEER; + + return \Propel::getConnection($peer::DATABASE_NAME, \Propel::CONNECTION_WRITE); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Propel2/ColumnTypeGuesser.php b/vendor/fakerphp/faker/src/Faker/ORM/Propel2/ColumnTypeGuesser.php new file mode 100644 index 00000000..4c08e0ad --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Propel2/ColumnTypeGuesser.php @@ -0,0 +1,112 @@ +generator = $generator; + } + + /** + * @return \Closure|null + */ + public function guessFormat(ColumnMap $column) + { + $generator = $this->generator; + + if ($column->isTemporal()) { + if ($column->getType() == PropelTypes::BU_DATE || $column->getType() == PropelTypes::BU_TIMESTAMP) { + return static function () use ($generator) { + return $generator->dateTime; + }; + } + + return static function () use ($generator) { + return $generator->dateTimeAD; + }; + } + $type = $column->getType(); + + switch ($type) { + case PropelTypes::BOOLEAN: + case PropelTypes::BOOLEAN_EMU: + return static function () use ($generator) { + return $generator->boolean; + }; + + case PropelTypes::NUMERIC: + case PropelTypes::DECIMAL: + $size = $column->getSize(); + + return static function () use ($generator, $size) { + return $generator->randomNumber($size + 2) / 100; + }; + + case PropelTypes::TINYINT: + return static function () use ($generator) { + return $generator->numberBetween(0, 127); + }; + + case PropelTypes::SMALLINT: + return static function () use ($generator) { + return $generator->numberBetween(0, 32767); + }; + + case PropelTypes::INTEGER: + return static function () use ($generator) { + return $generator->numberBetween(0, 2147483647); + }; + + case PropelTypes::BIGINT: + return static function () use ($generator) { + return $generator->numberBetween(0, PHP_INT_MAX); + }; + + case PropelTypes::FLOAT: + case PropelTypes::DOUBLE: + case PropelTypes::REAL: + return static function () use ($generator) { + return $generator->randomFloat(); + }; + + case PropelTypes::CHAR: + case PropelTypes::VARCHAR: + case PropelTypes::BINARY: + case PropelTypes::VARBINARY: + $size = $column->getSize(); + + return static function () use ($generator, $size) { + return $generator->text($size); + }; + + case PropelTypes::LONGVARCHAR: + case PropelTypes::LONGVARBINARY: + case PropelTypes::CLOB: + case PropelTypes::CLOB_EMU: + case PropelTypes::BLOB: + return static function () use ($generator) { + return $generator->text; + }; + + case PropelTypes::ENUM: + $valueSet = $column->getValueSet(); + + return static function () use ($generator, $valueSet) { + return $generator->randomElement($valueSet); + }; + + case PropelTypes::OBJECT: + case PropelTypes::PHP_ARRAY: + default: + // no smart way to guess what the user expects here + return null; + } + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Propel2/EntityPopulator.php b/vendor/fakerphp/faker/src/Faker/ORM/Propel2/EntityPopulator.php new file mode 100644 index 00000000..44804e37 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Propel2/EntityPopulator.php @@ -0,0 +1,207 @@ +class = $class; + } + + /** + * @return string + */ + public function getClass() + { + return $this->class; + } + + public function setColumnFormatters($columnFormatters) + { + $this->columnFormatters = $columnFormatters; + } + + /** + * @return array + */ + public function getColumnFormatters() + { + return $this->columnFormatters; + } + + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + /** + * @return array + */ + public function guessColumnFormatters(\Faker\Generator $generator) + { + $formatters = []; + $class = $this->class; + $peerClass = $class::TABLE_MAP; + $tableMap = $peerClass::getTableMap(); + $nameGuesser = new \Faker\Guesser\Name($generator); + $columnTypeGuesser = new \Faker\ORM\Propel2\ColumnTypeGuesser($generator); + + foreach ($tableMap->getColumns() as $columnMap) { + // skip behavior columns, handled by modifiers + if ($this->isColumnBehavior($columnMap)) { + continue; + } + + if ($columnMap->isForeignKey()) { + $relatedClass = $columnMap->getRelation()->getForeignTable()->getClassname(); + $formatters[$columnMap->getPhpName()] = static function ($inserted) use ($relatedClass, $generator) { + $relatedClass = trim($relatedClass, '\\'); + + return isset($inserted[$relatedClass]) ? $generator->randomElement($inserted[$relatedClass]) : null; + }; + + continue; + } + + if ($columnMap->isPrimaryKey()) { + continue; + } + + if ($formatter = $nameGuesser->guessFormat($columnMap->getPhpName(), $columnMap->getSize())) { + $formatters[$columnMap->getPhpName()] = $formatter; + + continue; + } + + if ($formatter = $columnTypeGuesser->guessFormat($columnMap)) { + $formatters[$columnMap->getPhpName()] = $formatter; + + continue; + } + } + + return $formatters; + } + + /** + * @return bool + */ + protected function isColumnBehavior(ColumnMap $columnMap) + { + foreach ($columnMap->getTable()->getBehaviors() as $name => $params) { + $columnName = Base::toLower($columnMap->getName()); + + switch ($name) { + case 'nested_set': + $columnNames = [$params['left_column'], $params['right_column'], $params['level_column']]; + + if (in_array($columnName, $columnNames, false)) { + return true; + } + + break; + + case 'timestampable': + $columnNames = [$params['create_column'], $params['update_column']]; + + if (in_array($columnName, $columnNames, false)) { + return true; + } + + break; + } + } + + return false; + } + + public function setModifiers($modifiers) + { + $this->modifiers = $modifiers; + } + + /** + * @return array + */ + public function getModifiers() + { + return $this->modifiers; + } + + public function mergeModifiersWith($modifiers) + { + $this->modifiers = array_merge($this->modifiers, $modifiers); + } + + /** + * @return array + */ + public function guessModifiers(\Faker\Generator $generator) + { + $modifiers = []; + $class = $this->class; + $peerClass = $class::TABLE_MAP; + $tableMap = $peerClass::getTableMap(); + + foreach ($tableMap->getBehaviors() as $name => $params) { + switch ($name) { + case 'nested_set': + $modifiers['nested_set'] = static function ($obj, $inserted) use ($class, $generator): void { + if (isset($inserted[$class])) { + $queryClass = $class . 'Query'; + $parent = $queryClass::create()->findPk($generator->randomElement($inserted[$class])); + $obj->insertAsLastChildOf($parent); + } else { + $obj->makeRoot(); + } + }; + + break; + + case 'sortable': + $modifiers['sortable'] = static function ($obj, $inserted) use ($class, $generator): void { + $obj->insertAtRank($generator->numberBetween(1, count($inserted[$class] ?? []) + 1)); + }; + + break; + } + } + + return $modifiers; + } + + /** + * Insert one new record using the Entity class. + */ + public function execute($con, $insertedEntities) + { + $obj = new $this->class(); + + foreach ($this->getColumnFormatters() as $column => $format) { + if (null !== $format) { + $obj->setByName($column, is_callable($format) ? $format($insertedEntities, $obj) : $format); + } + } + + foreach ($this->getModifiers() as $modifier) { + $modifier($obj, $insertedEntities); + } + $obj->save($con); + + return $obj->getPrimaryKey(); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Propel2/Populator.php b/vendor/fakerphp/faker/src/Faker/ORM/Propel2/Populator.php new file mode 100644 index 00000000..7698f80e --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Propel2/Populator.php @@ -0,0 +1,93 @@ +generator = $generator; + } + + /** + * Add an order for the generation of $number records for $entity. + * + * @param mixed $entity A Propel ActiveRecord classname, or a \Faker\ORM\Propel2\EntityPopulator instance + * @param int $number The number of entities to populate + */ + public function addEntity($entity, $number, $customColumnFormatters = [], $customModifiers = []) + { + if (!$entity instanceof \Faker\ORM\Propel2\EntityPopulator) { + $entity = new \Faker\ORM\Propel2\EntityPopulator($entity); + } + $entity->setColumnFormatters($entity->guessColumnFormatters($this->generator)); + + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + $entity->setModifiers($entity->guessModifiers($this->generator)); + + if ($customModifiers) { + $entity->mergeModifiersWith($customModifiers); + } + $class = $entity->getClass(); + $this->entities[$class] = $entity; + $this->quantities[$class] = $number; + } + + /** + * Populate the database using all the Entity classes previously added. + * + * @param PropelPDO $con A Propel connection object + * + * @return array A list of the inserted PKs + */ + public function execute($con = null) + { + if (null === $con) { + $con = $this->getConnection(); + } + $isInstancePoolingEnabled = Propel::isInstancePoolingEnabled(); + Propel::disableInstancePooling(); + $insertedEntities = []; + $con->beginTransaction(); + + foreach ($this->quantities as $class => $number) { + for ($i = 0; $i < $number; ++$i) { + $insertedEntities[$class][] = $this->entities[$class]->execute($con, $insertedEntities); + } + } + $con->commit(); + + if ($isInstancePoolingEnabled) { + Propel::enableInstancePooling(); + } + + return $insertedEntities; + } + + protected function getConnection() + { + // use the first connection available + $class = key($this->entities); + + if (!$class) { + throw new \RuntimeException('No class found from entities. Did you add entities to the Populator ?'); + } + + $peer = $class::TABLE_MAP; + + return Propel::getConnection($peer::DATABASE_NAME, ServiceContainerInterface::CONNECTION_WRITE); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Spot/ColumnTypeGuesser.php b/vendor/fakerphp/faker/src/Faker/ORM/Spot/ColumnTypeGuesser.php new file mode 100644 index 00000000..f06ba048 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Spot/ColumnTypeGuesser.php @@ -0,0 +1,84 @@ +generator = $generator; + } + + /** + * @return \Closure|null + */ + public function guessFormat(array $field) + { + $generator = $this->generator; + $type = $field['type']; + + switch ($type) { + case 'boolean': + return static function () use ($generator) { + return $generator->boolean; + }; + + case 'decimal': + $size = $field['precision'] ?? 2; + + return static function () use ($generator, $size) { + return $generator->randomNumber($size + 2) / 100; + }; + + case 'smallint': + return static function () use ($generator) { + return $generator->numberBetween(0, 65535); + }; + + case 'integer': + return static function () use ($generator) { + return $generator->numberBetween(0, 2147483647); + }; + + case 'bigint': + return static function () use ($generator) { + return $generator->numberBetween(0, PHP_INT_MAX); + }; + + case 'float': + return static function () use ($generator) { + return $generator->randomFloat(null, 0, 4294967295); + }; + + case 'string': + $size = $field['length'] ?? 255; + + return static function () use ($generator, $size) { + return $generator->text($size); + }; + + case 'text': + return static function () use ($generator) { + return $generator->text; + }; + + case 'datetime': + case 'date': + case 'time': + return static function () use ($generator) { + return $generator->datetime; + }; + + default: + // no smart way to guess what the user expects here + return null; + } + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Spot/EntityPopulator.php b/vendor/fakerphp/faker/src/Faker/ORM/Spot/EntityPopulator.php new file mode 100644 index 00000000..b67ae253 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Spot/EntityPopulator.php @@ -0,0 +1,199 @@ +mapper = $mapper; + $this->locator = $locator; + $this->useExistingData = $useExistingData; + } + + /** + * @return string + */ + public function getMapper() + { + return $this->mapper; + } + + public function setColumnFormatters($columnFormatters) + { + $this->columnFormatters = $columnFormatters; + } + + /** + * @return array + */ + public function getColumnFormatters() + { + return $this->columnFormatters; + } + + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + public function setModifiers(array $modifiers) + { + $this->modifiers = $modifiers; + } + + /** + * @return array + */ + public function getModifiers() + { + return $this->modifiers; + } + + public function mergeModifiersWith(array $modifiers) + { + $this->modifiers = array_merge($this->modifiers, $modifiers); + } + + /** + * @return array + */ + public function guessColumnFormatters(Generator $generator) + { + $formatters = []; + $nameGuesser = new Name($generator); + $columnTypeGuesser = new ColumnTypeGuesser($generator); + $fields = $this->mapper->fields(); + + foreach ($fields as $fieldName => $field) { + if ($field['primary'] === true) { + continue; + } + + if ($formatter = $nameGuesser->guessFormat($fieldName)) { + $formatters[$fieldName] = $formatter; + + continue; + } + + if ($formatter = $columnTypeGuesser->guessFormat($field)) { + $formatters[$fieldName] = $formatter; + + continue; + } + } + $entityName = $this->mapper->entity(); + $entity = $this->mapper->build([]); + $relations = $entityName::relations($this->mapper, $entity); + + foreach ($relations as $relation) { + // We don't need any other relation here. + if ($relation instanceof BelongsTo) { + $fieldName = $relation->localKey(); + $entityName = $relation->entityName(); + $field = $fields[$fieldName]; + $required = $field['required']; + + $locator = $this->locator; + + $formatters[$fieldName] = function ($inserted) use ($required, $entityName, $locator, $generator) { + if (!empty($inserted[$entityName])) { + return $generator->randomElement($inserted[$entityName])->get('id'); + } + + if ($required && $this->useExistingData) { + // We did not add anything like this, but it's required, + // So let's find something existing in DB. + $mapper = $locator->mapper($entityName); + $records = $mapper->all()->limit(self::RELATED_FETCH_COUNT)->toArray(); + + if (empty($records)) { + return null; + } + + return $generator->randomElement($records)['id']; + } + + return null; + }; + } + } + + return $formatters; + } + + /** + * Insert one new record using the Entity class. + * + * @return string + */ + public function execute($insertedEntities) + { + $obj = $this->mapper->build([]); + + $this->fillColumns($obj, $insertedEntities); + $this->callMethods($obj, $insertedEntities); + + $this->mapper->insert($obj); + + return $obj; + } + + private function fillColumns($obj, $insertedEntities): void + { + foreach ($this->columnFormatters as $field => $format) { + if (null !== $format) { + $value = is_callable($format) ? $format($insertedEntities, $obj) : $format; + $obj->set($field, $value); + } + } + } + + private function callMethods($obj, $insertedEntities): void + { + foreach ($this->getModifiers() as $modifier) { + $modifier($obj, $insertedEntities); + } + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ORM/Spot/Populator.php b/vendor/fakerphp/faker/src/Faker/ORM/Spot/Populator.php new file mode 100644 index 00000000..b321f5c5 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ORM/Spot/Populator.php @@ -0,0 +1,89 @@ +generator = $generator; + $this->locator = $locator; + } + + /** + * Add an order for the generation of $number records for $entity. + * + * @param string $entityName Name of Entity object to generate + * @param int $number The number of entities to populate + * @param array $customColumnFormatters + * @param array $customModifiers + * @param bool $useExistingData Should we use existing rows (e.g. roles) to populate relations? + */ + public function addEntity( + $entityName, + $number, + $customColumnFormatters = [], + $customModifiers = [], + $useExistingData = false + ) { + $mapper = $this->locator->mapper($entityName); + + if (null === $mapper) { + throw new \InvalidArgumentException('No mapper can be found for entity ' . $entityName); + } + $entity = new EntityPopulator($mapper, $this->locator, $useExistingData); + + $entity->setColumnFormatters($entity->guessColumnFormatters($this->generator)); + + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + $entity->mergeModifiersWith($customModifiers); + + $this->entities[$entityName] = $entity; + $this->quantities[$entityName] = $number; + } + + /** + * Populate the database using all the Entity classes previously added. + * + * @param Locator $locator A Spot locator + * + * @return array A list of the inserted PKs + */ + public function execute($locator = null) + { + if (null === $locator) { + $locator = $this->locator; + } + + if (null === $locator) { + throw new \InvalidArgumentException('No entity manager passed to Spot Populator.'); + } + + $insertedEntities = []; + + foreach ($this->quantities as $entityName => $number) { + for ($i = 0; $i < $number; ++$i) { + $insertedEntities[$entityName][] = $this->entities[$entityName]->execute( + $insertedEntities, + ); + } + } + + return $insertedEntities; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/Address.php new file mode 100644 index 00000000..9727497b --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/Address.php @@ -0,0 +1,166 @@ +generator->parse($format); + } + + /** + * @example 'Crist Parks' + * + * @return string + */ + public function streetName() + { + $format = static::randomElement(static::$streetNameFormats); + + return $this->generator->parse($format); + } + + /** + * @example '791 Crist Parks' + * + * @return string + */ + public function streetAddress() + { + $format = static::randomElement(static::$streetAddressFormats); + + return $this->generator->parse($format); + } + + /** + * @example 86039-9874 + * + * @return string + */ + public static function postcode() + { + return static::toUpper(static::bothify(static::randomElement(static::$postcode))); + } + + /** + * @example '791 Crist Parks, Sashabury, IL 86039-9874' + * + * @return string + */ + public function address() + { + $format = static::randomElement(static::$addressFormats); + + return $this->generator->parse($format); + } + + /** + * @example 'Japan' + * + * @return string + */ + public static function country() + { + return static::randomElement(static::$country); + } + + /** + * Uses signed degrees format (returns a float number between -90 and 90) + * + * @example '77.147489' + * + * @param float|int $min + * @param float|int $max + * + * @return float + */ + public static function latitude($min = -90, $max = 90) + { + return static::randomFloat(6, $min, $max); + } + + /** + * Uses signed degrees format (returns a float number between -180 and 180) + * + * @example '86.211205' + * + * @param float|int $min + * @param float|int $max + * + * @return float + */ + public static function longitude($min = -180, $max = 180) + { + return static::randomFloat(6, $min, $max); + } + + /** + * @example array('77.147489', '86.211205') + * + * @return float[] + */ + public static function localCoordinates() + { + return [ + 'latitude' => static::latitude(), + 'longitude' => static::longitude(), + ]; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/Barcode.php b/vendor/fakerphp/faker/src/Faker/Provider/Barcode.php new file mode 100644 index 00000000..0d39a61e --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/Barcode.php @@ -0,0 +1,107 @@ +ean(13); + } + + /** + * Get a random EAN8 barcode. + * + * @return string + * + * @example '73513537' + */ + public function ean8() + { + return $this->ean(8); + } + + /** + * Get a random ISBN-10 code + * + * @see http://en.wikipedia.org/wiki/International_Standard_Book_Number + * + * @return string + * + * @example '4881416324' + */ + public function isbn10() + { + $code = static::numerify(str_repeat('#', 9)); + + return $code . Isbn::checksum($code); + } + + /** + * Get a random ISBN-13 code + * + * @see http://en.wikipedia.org/wiki/International_Standard_Book_Number + * + * @return string + * + * @example '9790404436093' + */ + public function isbn13() + { + $code = '97' . self::numberBetween(8, 9) . static::numerify(str_repeat('#', 9)); + + return $code . Ean::checksum($code); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/Base.php b/vendor/fakerphp/faker/src/Faker/Provider/Base.php new file mode 100644 index 00000000..6b9876bc --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/Base.php @@ -0,0 +1,710 @@ +generator = $generator; + } + + /** + * Returns a random number between 0 and 9 + * + * @return int + */ + public static function randomDigit() + { + return mt_rand(0, 9); + } + + /** + * Returns a random number between 1 and 9 + * + * @return int + */ + public static function randomDigitNotNull() + { + return mt_rand(1, 9); + } + + /** + * Generates a random digit, which cannot be $except + * + * @param int $except + * + * @return int + */ + public static function randomDigitNot($except) + { + $result = self::numberBetween(0, 8); + + if ($result >= $except) { + ++$result; + } + + return $result; + } + + /** + * Returns a random integer with 0 to $nbDigits digits. + * + * The maximum value returned is mt_getrandmax() + * + * @param int $nbDigits Defaults to a random number between 1 and 9 + * @param bool $strict Whether the returned number should have exactly $nbDigits + * + * @example 79907610 + * + * @return int + */ + public static function randomNumber($nbDigits = null, $strict = false) + { + if (!is_bool($strict)) { + throw new \InvalidArgumentException('randomNumber() generates numbers of fixed width. To generate numbers between two boundaries, use numberBetween() instead.'); + } + + if (null === $nbDigits) { + $nbDigits = static::randomDigitNotNull(); + } + $max = 10 ** $nbDigits - 1; + + if ($max > mt_getrandmax()) { + throw new \InvalidArgumentException('randomNumber() can only generate numbers up to mt_getrandmax()'); + } + + if ($strict) { + return mt_rand(10 ** ($nbDigits - 1), $max); + } + + return mt_rand(0, $max); + } + + /** + * Return a random float number + * + * @param int $nbMaxDecimals + * @param float|int $min + * @param float|int $max + * + * @example 48.8932 + * + * @return float + */ + public static function randomFloat($nbMaxDecimals = null, $min = 0, $max = null) + { + if (null === $nbMaxDecimals) { + $nbMaxDecimals = static::randomDigit(); + } + + if (null === $max) { + $max = static::randomNumber(); + + if ($min > $max) { + $max = $min; + } + } + + if ($min > $max) { + $tmp = $min; + $min = $max; + $max = $tmp; + } + + return round($min + mt_rand() / mt_getrandmax() * ($max - $min), $nbMaxDecimals); + } + + /** + * Returns a random number between $int1 and $int2 (any order) + * + * @param int $int1 default to 0 + * @param int $int2 defaults to 32 bit max integer, ie 2147483647 + * + * @example 79907610 + * + * @return int + */ + public static function numberBetween($int1 = 0, $int2 = 2147483647) + { + $min = $int1 < $int2 ? $int1 : $int2; + $max = $int1 < $int2 ? $int2 : $int1; + + return mt_rand($min, $max); + } + + /** + * Returns the passed value + */ + public static function passthrough($value) + { + return $value; + } + + /** + * Returns a random letter from a to z + * + * @return string + */ + public static function randomLetter() + { + return chr(mt_rand(97, 122)); + } + + /** + * Returns a random ASCII character (excluding accents and special chars) + * + * @return string + */ + public static function randomAscii() + { + return chr(mt_rand(33, 126)); + } + + /** + * Returns randomly ordered subsequence of $count elements from a provided array + * + * @todo update default $count to `null` (BC) for next major version + * + * @param array|class-string|\Traversable $array Array to take elements from. Defaults to a-c + * @param int|null $count Number of elements to take. If `null` then returns random number of elements + * @param bool $allowDuplicates Allow elements to be picked several times. Defaults to false + * + * @throws \InvalidArgumentException + * @throws \LengthException When requesting more elements than provided + * + * @return array New array with $count elements from $array + */ + public static function randomElements($array = ['a', 'b', 'c'], $count = 1, $allowDuplicates = false) + { + $elements = $array; + + if (is_string($array) && function_exists('enum_exists') && enum_exists($array)) { + $elements = $array::cases(); + } + + if ($array instanceof \Traversable) { + $elements = \iterator_to_array($array, false); + } + + if (!is_array($elements)) { + throw new \InvalidArgumentException(sprintf( + 'Argument for parameter $array needs to be array, an instance of %s, or an instance of %s, got %s instead.', + \UnitEnum::class, + \Traversable::class, + is_object($array) ? get_class($array) : gettype($array), + )); + } + + $numberOfElements = count($elements); + + if (!$allowDuplicates && null !== $count && $numberOfElements < $count) { + throw new \LengthException(sprintf( + 'Cannot get %d elements, only %d in array', + $count, + $numberOfElements, + )); + } + + if (null === $count) { + $count = mt_rand(1, $numberOfElements); + } + + $randomElements = []; + + $keys = array_keys($elements); + $maxIndex = $numberOfElements - 1; + $elementHasBeenSelectedAlready = []; + $numberOfRandomElements = 0; + + while ($numberOfRandomElements < $count) { + $index = mt_rand(0, $maxIndex); + + if (!$allowDuplicates) { + if (isset($elementHasBeenSelectedAlready[$index])) { + continue; + } + + $elementHasBeenSelectedAlready[$index] = true; + } + + $key = $keys[$index]; + + $randomElements[] = $elements[$key]; + + ++$numberOfRandomElements; + } + + return $randomElements; + } + + /** + * Returns a random element from a passed array + * + * @param array|class-string|\Traversable $array + * + * @throws \InvalidArgumentException + */ + public static function randomElement($array = ['a', 'b', 'c']) + { + $elements = $array; + + if (is_string($array) && function_exists('enum_exists') && enum_exists($array)) { + $elements = $array::cases(); + } + + if ($array instanceof \Traversable) { + $elements = iterator_to_array($array, false); + } + + if ($elements === []) { + return null; + } + + if (!is_array($elements)) { + throw new \InvalidArgumentException(sprintf( + 'Argument for parameter $array needs to be array, an instance of %s, or an instance of %s, got %s instead.', + \UnitEnum::class, + \Traversable::class, + is_object($array) ? get_class($array) : gettype($array), + )); + } + + $randomElements = static::randomElements($elements, 1); + + return $randomElements[0]; + } + + /** + * Returns a random key from a passed associative array + * + * @param array $array + * + * @return int|string|null + */ + public static function randomKey($array = []) + { + if (!$array) { + return null; + } + $keys = array_keys($array); + + return $keys[mt_rand(0, count($keys) - 1)]; + } + + /** + * Returns a shuffled version of the argument. + * + * This function accepts either an array, or a string. + * + * @example $faker->shuffle([1, 2, 3]); // [2, 1, 3] + * @example $faker->shuffle('hello, world'); // 'rlo,h eold!lw' + * + * @see shuffleArray() + * @see shuffleString() + * + * @param array|string $arg The set to shuffle + * + * @return array|string The shuffled set + */ + public static function shuffle($arg = '') + { + if (is_array($arg)) { + return static::shuffleArray($arg); + } + + if (is_string($arg)) { + return static::shuffleString($arg); + } + + throw new \InvalidArgumentException('shuffle() only supports strings or arrays'); + } + + /** + * Returns a shuffled version of the array. + * + * This function does not mutate the original array. It uses the + * Fisher–Yates algorithm, which is unbiased, together with a Mersenne + * twister random generator. This function is therefore more random than + * PHP's shuffle() function, and it is seedable. + * + * @see http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle + * + * @example $faker->shuffleArray([1, 2, 3]); // [2, 1, 3] + * + * @param array $array The set to shuffle + * + * @return array The shuffled set + */ + public static function shuffleArray($array = []) + { + $shuffledArray = []; + $i = 0; + reset($array); + + foreach ($array as $key => $value) { + if ($i == 0) { + $j = 0; + } else { + $j = mt_rand(0, $i); + } + + if ($j == $i) { + $shuffledArray[] = $value; + } else { + $shuffledArray[] = $shuffledArray[$j]; + $shuffledArray[$j] = $value; + } + ++$i; + } + + return $shuffledArray; + } + + /** + * Returns a shuffled version of the string. + * + * This function does not mutate the original string. It uses the + * Fisher–Yates algorithm, which is unbiased, together with a Mersenne + * twister random generator. This function is therefore more random than + * PHP's shuffle() function, and it is seedable. Additionally, it is + * UTF8 safe if the mb extension is available. + * + * @see http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle + * + * @example $faker->shuffleString('hello, world'); // 'rlo,h eold!lw' + * + * @param string $string The set to shuffle + * @param string $encoding The string encoding (defaults to UTF-8) + * + * @return string The shuffled set + */ + public static function shuffleString($string = '', $encoding = 'UTF-8') + { + if (function_exists('mb_strlen')) { + // UTF8-safe str_split() + $array = []; + $strlen = mb_strlen($string, $encoding); + + for ($i = 0; $i < $strlen; ++$i) { + $array[] = mb_substr($string, $i, 1, $encoding); + } + } else { + $array = str_split($string, 1); + } + + return implode('', static::shuffleArray($array)); + } + + private static function replaceWildcard($string, $wildcard, $callback) + { + if (($pos = strpos($string, $wildcard)) === false) { + return $string; + } + + for ($i = $pos, $last = strrpos($string, $wildcard, $pos) + 1; $i < $last; ++$i) { + if ($string[$i] === $wildcard) { + $string[$i] = call_user_func($callback); + } + } + + return $string; + } + + /** + * Replaces all hash sign ('#') occurrences with a random number + * Replaces all percentage sign ('%') occurrences with a not null number + * + * @param string $string String that needs to bet parsed + * + * @return string + */ + public static function numerify($string = '###') + { + // instead of using randomDigit() several times, which is slow, + // count the number of hashes and generate once a large number + $toReplace = []; + + if (($pos = strpos($string, '#')) !== false) { + for ($i = $pos, $last = strrpos($string, '#', $pos) + 1; $i < $last; ++$i) { + if ($string[$i] === '#') { + $toReplace[] = $i; + } + } + } + + if ($nbReplacements = count($toReplace)) { + $maxAtOnce = strlen((string) mt_getrandmax()) - 1; + $numbers = ''; + $i = 0; + + while ($i < $nbReplacements) { + $size = min($nbReplacements - $i, $maxAtOnce); + $numbers .= str_pad(static::randomNumber($size), $size, '0', STR_PAD_LEFT); + $i += $size; + } + + for ($i = 0; $i < $nbReplacements; ++$i) { + $string[$toReplace[$i]] = $numbers[$i]; + } + } + $string = self::replaceWildcard($string, '%', [static::class, 'randomDigitNotNull']); + + return $string; + } + + /** + * Replaces all question mark ('?') occurrences with a random letter + * + * @param string $string String that needs to bet parsed + * + * @return string + */ + public static function lexify($string = '????') + { + return self::replaceWildcard($string, '?', [static::class, 'randomLetter']); + } + + /** + * Replaces hash signs ('#') and question marks ('?') with random numbers and letters + * An asterisk ('*') is replaced with either a random number or a random letter + * + * @param string $string String that needs to be parsed + * + * @return string + */ + public static function bothify($string = '## ??') + { + $string = self::replaceWildcard($string, '*', static function () { + return mt_rand(0, 1) === 1 ? '#' : '?'; + }); + + return static::lexify(static::numerify($string)); + } + + /** + * Replaces * signs with random numbers and letters and special characters + * + * @example $faker->asciify(''********'); // "s5'G!uC3" + * + * @param string $string String that needs to bet parsed + * + * @return string + */ + public static function asciify($string = '****') + { + return preg_replace_callback('/\*/u', [static::class, 'randomAscii'], $string); + } + + /** + * Transforms a basic regular expression into a random string satisfying the expression. + * + * @example $faker->regexify('[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}'); // sm0@y8k96a.ej + * + * Regex delimiters '/.../' and begin/end markers '^...$' are ignored. + * + * Only supports a small subset of the regex syntax. For instance, + * unicode, negated classes, unbounded ranges, subpatterns, back references, + * assertions, recursive patterns, and comments are not supported. Escaping + * support is extremely fragile. + * + * This method is also VERY slow. Use it only when no other formatter + * can generate the fake data you want. For instance, prefer calling + * `$faker->email` rather than `regexify` with the previous regular + * expression. + * + * Also note than `bothify` can probably do most of what this method does, + * but much faster. For instance, for a dummy email generation, try + * `$faker->bothify('?????????@???.???')`. + * + * @see https://github.com/icomefromthenet/ReverseRegex for a more robust implementation + * + * @param string $regex A regular expression (delimiters are optional) + * + * @return string + */ + public static function regexify($regex = '') + { + // ditch the anchors + $regex = preg_replace('/^\/?\^?/', '', $regex); + $regex = preg_replace('/\$?\/?$/', '', $regex); + // All {2} become {2,2} + $regex = preg_replace('/\{(\d+)\}/', '{\1,\1}', $regex); + // Single-letter quantifiers (?, *, +) become bracket quantifiers ({0,1}, {0,rand}, {1, rand}) + $regex = preg_replace('/(? 0 && $weight < 1 && mt_rand() / mt_getrandmax() <= $weight) { + return $this->generator; + } + + // new system with percentage + if (is_int($weight) && mt_rand(1, 100) <= $weight) { + return $this->generator; + } + + return new DefaultGenerator($default); + } + + /** + * Chainable method for making any formatter unique. + * + * + * // will never return twice the same value + * $faker->unique()->randomElement(array(1, 2, 3)); + * + * + * @param bool $reset If set to true, resets the list of existing values + * @param int $maxRetries Maximum number of retries to find a unique value, + * After which an OverflowException is thrown. + * + * @throws \OverflowException When no unique value can be found by iterating $maxRetries times + * + * @return UniqueGenerator A proxy class returning only non-existing values + */ + public function unique($reset = false, $maxRetries = 10000) + { + if ($reset || !$this->unique) { + $this->unique = new UniqueGenerator($this->generator, $maxRetries); + } + + return $this->unique; + } + + /** + * Chainable method for forcing any formatter to return only valid values. + * + * The value validity is determined by a function passed as first argument. + * + * + * $values = array(); + * $evenValidator = function ($digit) { + * return $digit % 2 === 0; + * }; + * for ($i=0; $i < 10; $i++) { + * $values []= $faker->valid($evenValidator)->randomDigit; + * } + * print_r($values); // [0, 4, 8, 4, 2, 6, 0, 8, 8, 6] + * + * + * @param Closure $validator A function returning true for valid values + * @param int $maxRetries Maximum number of retries to find a unique value, + * After which an OverflowException is thrown. + * + * @throws \OverflowException When no valid value can be found by iterating $maxRetries times + * + * @return ValidGenerator A proxy class returning only valid values + */ + public function valid($validator = null, $maxRetries = 10000) + { + return new ValidGenerator($this->generator, $validator, $maxRetries); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/Biased.php b/vendor/fakerphp/faker/src/Faker/Provider/Biased.php new file mode 100644 index 00000000..42c70bcc --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/Biased.php @@ -0,0 +1,65 @@ +generator->parse($format); + } + + /** + * @example 'Ltd' + * + * @return string + */ + public static function companySuffix() + { + return static::randomElement(static::$companySuffix); + } + + /** + * @example 'Job' + * + * @return string + */ + public function jobTitle() + { + $format = static::randomElement(static::$jobTitleFormat); + + return $this->generator->parse($format); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/DateTime.php b/vendor/fakerphp/faker/src/Faker/Provider/DateTime.php new file mode 100644 index 00000000..25df1c99 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/DateTime.php @@ -0,0 +1,389 @@ +getTimestamp(); + } + + return strtotime(empty($max) ? 'now' : $max); + } + + /** + * Get a timestamp between January 1, 1970, and now + * + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * + * @return int + * + * @example 1061306726 + */ + public static function unixTime($max = 'now') + { + return self::numberBetween(0, static::getMaxTimestamp($max)); + } + + /** + * Get a datetime object for a date between January 1, 1970 and now + * + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @param string $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * + * @return \DateTime + * + * @see http://php.net/manual/en/timezones.php + * @see http://php.net/manual/en/function.date-default-timezone-get.php + * + * @example DateTime('2005-08-16 20:39:21') + */ + public static function dateTime($max = 'now', $timezone = null) + { + return static::setTimezone( + new \DateTime('@' . static::unixTime($max)), + $timezone, + ); + } + + /** + * Get a datetime object for a date between January 1, 001 and now + * + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * + * @return \DateTime + * + * @see http://php.net/manual/en/timezones.php + * @see http://php.net/manual/en/function.date-default-timezone-get.php + * + * @example DateTime('1265-03-22 21:15:52') + */ + public static function dateTimeAD($max = 'now', $timezone = null) + { + $min = (PHP_INT_SIZE > 4 ? -62135597361 : -PHP_INT_MAX); + + return static::setTimezone( + new \DateTime('@' . self::numberBetween($min, static::getMaxTimestamp($max))), + $timezone, + ); + } + + /** + * get a date string formatted with ISO8601 + * + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * + * @return string + * + * @example '2003-10-21T16:05:52+0000' + */ + public static function iso8601($max = 'now') + { + return static::date(\DateTime::ISO8601, $max); + } + + /** + * Get a date string between January 1, 1970 and now + * + * @param string $format + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * + * @return string + * + * @example '2008-11-27' + */ + public static function date($format = 'Y-m-d', $max = 'now') + { + return static::dateTime($max)->format($format); + } + + /** + * Get a time string (24h format by default) + * + * @param string $format + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * + * @return string + * + * @example '15:02:34' + */ + public static function time($format = 'H:i:s', $max = 'now') + { + return static::dateTime($max)->format($format); + } + + /** + * Get a DateTime object based on a random date between two given dates. + * Accepts date strings that can be recognized by strtotime(). + * + * @param \DateTime|string $startDate Defaults to 30 years ago + * @param \DateTime|string $endDate Defaults to "now" + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * + * @return \DateTime + * + * @see http://php.net/manual/en/timezones.php + * @see http://php.net/manual/en/function.date-default-timezone-get.php + * + * @example DateTime('1999-02-02 11:42:52') + */ + public static function dateTimeBetween($startDate = '-30 years', $endDate = 'now', $timezone = null) + { + $startTimestamp = $startDate instanceof \DateTime ? $startDate->getTimestamp() : strtotime($startDate); + $endTimestamp = static::getMaxTimestamp($endDate); + + if ($startTimestamp > $endTimestamp) { + throw new \InvalidArgumentException('Start date must be anterior to end date.'); + } + + $timestamp = self::numberBetween($startTimestamp, $endTimestamp); + + return static::setTimezone( + new \DateTime('@' . $timestamp), + $timezone, + ); + } + + /** + * Get a DateTime object based on a random date between one given date and + * an interval + * Accepts date string that can be recognized by strtotime(). + * + * @param \DateTime|string $date Defaults to 30 years ago + * @param string $interval Defaults to 5 days after + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * + * @return \DateTime + * + * @example dateTimeInInterval('1999-02-02 11:42:52', '+ 5 days') + * + * @see http://php.net/manual/en/timezones.php + * @see http://php.net/manual/en/function.date-default-timezone-get.php + */ + public static function dateTimeInInterval($date = '-30 years', $interval = '+5 days', $timezone = null) + { + $intervalObject = \DateInterval::createFromDateString($interval); + $datetime = $date instanceof \DateTime ? $date : new \DateTime($date); + $otherDatetime = clone $datetime; + $otherDatetime->add($intervalObject); + + $begin = min($datetime, $otherDatetime); + $end = $datetime === $begin ? $otherDatetime : $datetime; + + return static::dateTimeBetween( + $begin, + $end, + $timezone, + ); + } + + /** + * Get a date time object somewhere within a century. + * + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * + * @return \DateTime + */ + public static function dateTimeThisCentury($max = 'now', $timezone = null) + { + return static::dateTimeBetween('-100 year', $max, $timezone); + } + + /** + * Get a date time object somewhere within a decade. + * + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * + * @return \DateTime + */ + public static function dateTimeThisDecade($max = 'now', $timezone = null) + { + return static::dateTimeBetween('-10 year', $max, $timezone); + } + + /** + * Get a date time object somewhere inside the current year. + * + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * + * @return \DateTime + */ + public static function dateTimeThisYear($max = 'now', $timezone = null) + { + return static::dateTimeBetween('first day of january this year', $max, $timezone); + } + + /** + * Get a date time object somewhere within a month. + * + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * + * @return \DateTime + */ + public static function dateTimeThisMonth($max = 'now', $timezone = null) + { + return static::dateTimeBetween('-1 month', $max, $timezone); + } + + /** + * Get a string containing either "am" or "pm". + * + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * + * @return string + * + * @example 'am' + */ + public static function amPm($max = 'now') + { + return static::dateTime($max)->format('a'); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * + * @return string + * + * @example '22' + */ + public static function dayOfMonth($max = 'now') + { + return static::dateTime($max)->format('d'); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * + * @return string + * + * @example 'Tuesday' + */ + public static function dayOfWeek($max = 'now') + { + return static::dateTime($max)->format('l'); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * + * @return string + * + * @example '7' + */ + public static function month($max = 'now') + { + return static::dateTime($max)->format('m'); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * + * @return string + * + * @example 'September' + */ + public static function monthName($max = 'now') + { + return static::dateTime($max)->format('F'); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * + * @return string + * + * @example '1987' + */ + public static function year($max = 'now') + { + return static::dateTime($max)->format('Y'); + } + + /** + * @return string + * + * @example 'XVII' + */ + public static function century() + { + return static::randomElement(static::$century); + } + + /** + * @return string + * + * @example 'Europe/Paris' + */ + public static function timezone(string $countryCode = null) + { + if ($countryCode) { + $timezones = \DateTimeZone::listIdentifiers(\DateTimeZone::PER_COUNTRY, $countryCode); + } else { + $timezones = \DateTimeZone::listIdentifiers(); + } + + return static::randomElement($timezones); + } + + /** + * Internal method to set the time zone on a DateTime. + * + * @param string|null $timezone + * + * @return \DateTime + */ + private static function setTimezone(\DateTime $dt, $timezone) + { + return $dt->setTimezone(new \DateTimeZone(static::resolveTimezone($timezone))); + } + + /** + * Sets default time zone. + * + * @param string $timezone + */ + public static function setDefaultTimezone($timezone = null) + { + static::$defaultTimezone = $timezone; + } + + /** + * Gets default time zone. + * + * @return string|null + */ + public static function getDefaultTimezone() + { + return static::$defaultTimezone; + } + + /** + * @param string|null $timezone + * + * @return string|null + */ + private static function resolveTimezone($timezone) + { + return (null === $timezone) ? ((null === static::$defaultTimezone) ? date_default_timezone_get() : static::$defaultTimezone) : $timezone; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/File.php b/vendor/fakerphp/faker/src/Faker/Provider/File.php new file mode 100644 index 00000000..3cf3db9f --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/File.php @@ -0,0 +1,610 @@ + file extension(s) + * + * @see http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types + */ + protected static $mimeTypes = [ + 'application/atom+xml' => 'atom', + 'application/ecmascript' => 'ecma', + 'application/emma+xml' => 'emma', + 'application/epub+zip' => 'epub', + 'application/java-archive' => 'jar', + 'application/java-vm' => 'class', + 'application/javascript' => 'js', + 'application/json' => 'json', + 'application/jsonml+json' => 'jsonml', + 'application/lost+xml' => 'lostxml', + 'application/mathml+xml' => 'mathml', + 'application/mets+xml' => 'mets', + 'application/mods+xml' => 'mods', + 'application/mp4' => 'mp4s', + 'application/msword' => ['doc', 'dot'], + 'application/octet-stream' => [ + 'bin', + 'dms', + 'lrf', + 'mar', + 'so', + 'dist', + 'distz', + 'pkg', + 'bpk', + 'dump', + 'elc', + 'deploy', + ], + 'application/ogg' => 'ogx', + 'application/omdoc+xml' => 'omdoc', + 'application/pdf' => 'pdf', + 'application/pgp-encrypted' => 'pgp', + 'application/pgp-signature' => ['asc', 'sig'], + 'application/pkix-pkipath' => 'pkipath', + 'application/pkixcmp' => 'pki', + 'application/pls+xml' => 'pls', + 'application/postscript' => ['ai', 'eps', 'ps'], + 'application/pskc+xml' => 'pskcxml', + 'application/rdf+xml' => 'rdf', + 'application/reginfo+xml' => 'rif', + 'application/rss+xml' => 'rss', + 'application/rtf' => 'rtf', + 'application/sbml+xml' => 'sbml', + 'application/vnd.adobe.air-application-installer-package+zip' => 'air', + 'application/vnd.adobe.xdp+xml' => 'xdp', + 'application/vnd.adobe.xfdf' => 'xfdf', + 'application/vnd.ahead.space' => 'ahead', + 'application/vnd.dart' => 'dart', + 'application/vnd.data-vision.rdz' => 'rdz', + 'application/vnd.dece.data' => ['uvf', 'uvvf', 'uvd', 'uvvd'], + 'application/vnd.dece.ttml+xml' => ['uvt', 'uvvt'], + 'application/vnd.dece.unspecified' => ['uvx', 'uvvx'], + 'application/vnd.dece.zip' => ['uvz', 'uvvz'], + 'application/vnd.denovo.fcselayout-link' => 'fe_launch', + 'application/vnd.dna' => 'dna', + 'application/vnd.dolby.mlp' => 'mlp', + 'application/vnd.dpgraph' => 'dpg', + 'application/vnd.dreamfactory' => 'dfac', + 'application/vnd.ds-keypoint' => 'kpxx', + 'application/vnd.dvb.ait' => 'ait', + 'application/vnd.dvb.service' => 'svc', + 'application/vnd.dynageo' => 'geo', + 'application/vnd.ecowin.chart' => 'mag', + 'application/vnd.enliven' => 'nml', + 'application/vnd.epson.esf' => 'esf', + 'application/vnd.epson.msf' => 'msf', + 'application/vnd.epson.quickanime' => 'qam', + 'application/vnd.epson.salt' => 'slt', + 'application/vnd.epson.ssf' => 'ssf', + 'application/vnd.ezpix-album' => 'ez2', + 'application/vnd.ezpix-package' => 'ez3', + 'application/vnd.fdf' => 'fdf', + 'application/vnd.fdsn.mseed' => 'mseed', + 'application/vnd.fdsn.seed' => ['seed', 'dataless'], + 'application/vnd.flographit' => 'gph', + 'application/vnd.fluxtime.clip' => 'ftc', + 'application/vnd.hal+xml' => 'hal', + 'application/vnd.hydrostatix.sof-data' => 'sfd-hdstx', + 'application/vnd.ibm.minipay' => 'mpy', + 'application/vnd.ibm.secure-container' => 'sc', + 'application/vnd.iccprofile' => ['icc', 'icm'], + 'application/vnd.igloader' => 'igl', + 'application/vnd.immervision-ivp' => 'ivp', + 'application/vnd.kde.karbon' => 'karbon', + 'application/vnd.kde.kchart' => 'chrt', + 'application/vnd.kde.kformula' => 'kfo', + 'application/vnd.kde.kivio' => 'flw', + 'application/vnd.kde.kontour' => 'kon', + 'application/vnd.kde.kpresenter' => ['kpr', 'kpt'], + 'application/vnd.kde.kspread' => 'ksp', + 'application/vnd.kde.kword' => ['kwd', 'kwt'], + 'application/vnd.kenameaapp' => 'htke', + 'application/vnd.kidspiration' => 'kia', + 'application/vnd.kinar' => ['kne', 'knp'], + 'application/vnd.koan' => ['skp', 'skd', 'skt', 'skm'], + 'application/vnd.kodak-descriptor' => 'sse', + 'application/vnd.las.las+xml' => 'lasxml', + 'application/vnd.llamagraphics.life-balance.desktop' => 'lbd', + 'application/vnd.llamagraphics.life-balance.exchange+xml' => 'lbe', + 'application/vnd.lotus-1-2-3' => '123', + 'application/vnd.lotus-approach' => 'apr', + 'application/vnd.lotus-freelance' => 'pre', + 'application/vnd.lotus-notes' => 'nsf', + 'application/vnd.lotus-organizer' => 'org', + 'application/vnd.lotus-screencam' => 'scm', + 'application/vnd.mozilla.xul+xml' => 'xul', + 'application/vnd.ms-artgalry' => 'cil', + 'application/vnd.ms-cab-compressed' => 'cab', + 'application/vnd.ms-excel' => [ + 'xls', + 'xlm', + 'xla', + 'xlc', + 'xlt', + 'xlw', + ], + 'application/vnd.ms-excel.addin.macroenabled.12' => 'xlam', + 'application/vnd.ms-excel.sheet.binary.macroenabled.12' => 'xlsb', + 'application/vnd.ms-excel.sheet.macroenabled.12' => 'xlsm', + 'application/vnd.ms-excel.template.macroenabled.12' => 'xltm', + 'application/vnd.ms-fontobject' => 'eot', + 'application/vnd.ms-htmlhelp' => 'chm', + 'application/vnd.ms-ims' => 'ims', + 'application/vnd.ms-lrm' => 'lrm', + 'application/vnd.ms-officetheme' => 'thmx', + 'application/vnd.ms-pki.seccat' => 'cat', + 'application/vnd.ms-pki.stl' => 'stl', + 'application/vnd.ms-powerpoint' => ['ppt', 'pps', 'pot'], + 'application/vnd.ms-powerpoint.addin.macroenabled.12' => 'ppam', + 'application/vnd.ms-powerpoint.presentation.macroenabled.12' => 'pptm', + 'application/vnd.ms-powerpoint.slide.macroenabled.12' => 'sldm', + 'application/vnd.ms-powerpoint.slideshow.macroenabled.12' => 'ppsm', + 'application/vnd.ms-powerpoint.template.macroenabled.12' => 'potm', + 'application/vnd.ms-project' => ['mpp', 'mpt'], + 'application/vnd.ms-word.document.macroenabled.12' => 'docm', + 'application/vnd.ms-word.template.macroenabled.12' => 'dotm', + 'application/vnd.ms-works' => ['wps', 'wks', 'wcm', 'wdb'], + 'application/vnd.ms-wpl' => 'wpl', + 'application/vnd.ms-xpsdocument' => 'xps', + 'application/vnd.mseq' => 'mseq', + 'application/vnd.musician' => 'mus', + 'application/vnd.oasis.opendocument.chart' => 'odc', + 'application/vnd.oasis.opendocument.chart-template' => 'otc', + 'application/vnd.oasis.opendocument.database' => 'odb', + 'application/vnd.oasis.opendocument.formula' => 'odf', + 'application/vnd.oasis.opendocument.formula-template' => 'odft', + 'application/vnd.oasis.opendocument.graphics' => 'odg', + 'application/vnd.oasis.opendocument.graphics-template' => 'otg', + 'application/vnd.oasis.opendocument.image' => 'odi', + 'application/vnd.oasis.opendocument.image-template' => 'oti', + 'application/vnd.oasis.opendocument.presentation' => 'odp', + 'application/vnd.oasis.opendocument.presentation-template' => 'otp', + 'application/vnd.oasis.opendocument.spreadsheet' => 'ods', + 'application/vnd.oasis.opendocument.spreadsheet-template' => 'ots', + 'application/vnd.oasis.opendocument.text' => 'odt', + 'application/vnd.oasis.opendocument.text-master' => 'odm', + 'application/vnd.oasis.opendocument.text-template' => 'ott', + 'application/vnd.oasis.opendocument.text-web' => 'oth', + 'application/vnd.olpc-sugar' => 'xo', + 'application/vnd.oma.dd2+xml' => 'dd2', + 'application/vnd.openofficeorg.extension' => 'oxt', + 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'pptx', + 'application/vnd.openxmlformats-officedocument.presentationml.slide' => 'sldx', + 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => 'ppsx', + 'application/vnd.openxmlformats-officedocument.presentationml.template' => 'potx', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'xlsx', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' => 'xltx', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'docx', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => 'dotx', + 'application/vnd.pvi.ptid1' => 'ptid', + 'application/vnd.quark.quarkxpress' => [ + 'qxd', + 'qxt', + 'qwd', + 'qwt', + 'qxl', + 'qxb', + ], + 'application/vnd.realvnc.bed' => 'bed', + 'application/vnd.recordare.musicxml' => 'mxl', + 'application/vnd.recordare.musicxml+xml' => 'musicxml', + 'application/vnd.rig.cryptonote' => 'cryptonote', + 'application/vnd.rim.cod' => 'cod', + 'application/vnd.rn-realmedia' => 'rm', + 'application/vnd.rn-realmedia-vbr' => 'rmvb', + 'application/vnd.route66.link66+xml' => 'link66', + 'application/vnd.sailingtracker.track' => 'st', + 'application/vnd.seemail' => 'see', + 'application/vnd.sema' => 'sema', + 'application/vnd.semd' => 'semd', + 'application/vnd.semf' => 'semf', + 'application/vnd.shana.informed.formdata' => 'ifm', + 'application/vnd.shana.informed.formtemplate' => 'itp', + 'application/vnd.shana.informed.interchange' => 'iif', + 'application/vnd.shana.informed.package' => 'ipk', + 'application/vnd.simtech-mindmapper' => ['twd', 'twds'], + 'application/vnd.smaf' => 'mmf', + 'application/vnd.stepmania.stepchart' => 'sm', + 'application/vnd.sun.xml.calc' => 'sxc', + 'application/vnd.sun.xml.calc.template' => 'stc', + 'application/vnd.sun.xml.draw' => 'sxd', + 'application/vnd.sun.xml.draw.template' => 'std', + 'application/vnd.sun.xml.impress' => 'sxi', + 'application/vnd.sun.xml.impress.template' => 'sti', + 'application/vnd.sun.xml.math' => 'sxm', + 'application/vnd.sun.xml.writer' => 'sxw', + 'application/vnd.sun.xml.writer.global' => 'sxg', + 'application/vnd.sun.xml.writer.template' => 'stw', + 'application/vnd.sus-calendar' => ['sus', 'susp'], + 'application/vnd.svd' => 'svd', + 'application/vnd.symbian.install' => ['sis', 'sisx'], + 'application/vnd.syncml+xml' => 'xsm', + 'application/vnd.syncml.dm+wbxml' => 'bdm', + 'application/vnd.syncml.dm+xml' => 'xdm', + 'application/vnd.tao.intent-module-archive' => 'tao', + 'application/vnd.tcpdump.pcap' => ['pcap', 'cap', 'dmp'], + 'application/vnd.tmobile-livetv' => 'tmo', + 'application/vnd.trid.tpt' => 'tpt', + 'application/vnd.triscape.mxs' => 'mxs', + 'application/vnd.trueapp' => 'tra', + 'application/vnd.ufdl' => ['ufd', 'ufdl'], + 'application/vnd.uiq.theme' => 'utz', + 'application/vnd.umajin' => 'umj', + 'application/vnd.unity' => 'unityweb', + 'application/vnd.uoml+xml' => 'uoml', + 'application/vnd.vcx' => 'vcx', + 'application/vnd.visio' => ['vsd', 'vst', 'vss', 'vsw'], + 'application/vnd.visionary' => 'vis', + 'application/vnd.vsf' => 'vsf', + 'application/vnd.wap.wbxml' => 'wbxml', + 'application/vnd.wap.wmlc' => 'wmlc', + 'application/vnd.wap.wmlscriptc' => 'wmlsc', + 'application/vnd.webturbo' => 'wtb', + 'application/vnd.wolfram.player' => 'nbp', + 'application/vnd.wordperfect' => 'wpd', + 'application/vnd.wqd' => 'wqd', + 'application/vnd.wt.stf' => 'stf', + 'application/vnd.xara' => 'xar', + 'application/vnd.xfdl' => 'xfdl', + 'application/voicexml+xml' => 'vxml', + 'application/widget' => 'wgt', + 'application/winhlp' => 'hlp', + 'application/wsdl+xml' => 'wsdl', + 'application/wspolicy+xml' => 'wspolicy', + 'application/x-7z-compressed' => '7z', + 'application/x-bittorrent' => 'torrent', + 'application/x-blorb' => ['blb', 'blorb'], + 'application/x-bzip' => 'bz', + 'application/x-cdlink' => 'vcd', + 'application/x-cfs-compressed' => 'cfs', + 'application/x-chat' => 'chat', + 'application/x-chess-pgn' => 'pgn', + 'application/x-conference' => 'nsc', + 'application/x-cpio' => 'cpio', + 'application/x-csh' => 'csh', + 'application/x-debian-package' => ['deb', 'udeb'], + 'application/x-dgc-compressed' => 'dgc', + 'application/x-director' => [ + 'dir', + 'dcr', + 'dxr', + 'cst', + 'cct', + 'cxt', + 'w3d', + 'fgd', + 'swa', + ], + 'application/x-font-ttf' => ['ttf', 'ttc'], + 'application/x-font-type1' => ['pfa', 'pfb', 'pfm', 'afm'], + 'application/x-font-woff' => 'woff', + 'application/x-freearc' => 'arc', + 'application/x-futuresplash' => 'spl', + 'application/x-gca-compressed' => 'gca', + 'application/x-glulx' => 'ulx', + 'application/x-gnumeric' => 'gnumeric', + 'application/x-gramps-xml' => 'gramps', + 'application/x-gtar' => 'gtar', + 'application/x-hdf' => 'hdf', + 'application/x-install-instructions' => 'install', + 'application/x-iso9660-image' => 'iso', + 'application/x-java-jnlp-file' => 'jnlp', + 'application/x-latex' => 'latex', + 'application/x-lzh-compressed' => ['lzh', 'lha'], + 'application/x-mie' => 'mie', + 'application/x-mobipocket-ebook' => ['prc', 'mobi'], + 'application/x-ms-application' => 'application', + 'application/x-ms-shortcut' => 'lnk', + 'application/x-ms-wmd' => 'wmd', + 'application/x-ms-wmz' => 'wmz', + 'application/x-ms-xbap' => 'xbap', + 'application/x-msaccess' => 'mdb', + 'application/x-msbinder' => 'obd', + 'application/x-mscardfile' => 'crd', + 'application/x-msclip' => 'clp', + 'application/x-msdownload' => ['exe', 'dll', 'com', 'bat', 'msi'], + 'application/x-msmediaview' => [ + 'mvb', + 'm13', + 'm14', + ], + 'application/x-msmetafile' => ['wmf', 'wmz', 'emf', 'emz'], + 'application/x-rar-compressed' => 'rar', + 'application/x-research-info-systems' => 'ris', + 'application/x-sh' => 'sh', + 'application/x-shar' => 'shar', + 'application/x-shockwave-flash' => 'swf', + 'application/x-silverlight-app' => 'xap', + 'application/x-sql' => 'sql', + 'application/x-stuffit' => 'sit', + 'application/x-stuffitx' => 'sitx', + 'application/x-subrip' => 'srt', + 'application/x-sv4cpio' => 'sv4cpio', + 'application/x-sv4crc' => 'sv4crc', + 'application/x-t3vm-image' => 't3', + 'application/x-tads' => 'gam', + 'application/x-tar' => 'tar', + 'application/x-tcl' => 'tcl', + 'application/x-tex' => 'tex', + 'application/x-tex-tfm' => 'tfm', + 'application/x-texinfo' => ['texinfo', 'texi'], + 'application/x-tgif' => 'obj', + 'application/x-ustar' => 'ustar', + 'application/x-wais-source' => 'src', + 'application/x-x509-ca-cert' => ['der', 'crt'], + 'application/x-xfig' => 'fig', + 'application/x-xliff+xml' => 'xlf', + 'application/x-xpinstall' => 'xpi', + 'application/x-xz' => 'xz', + 'application/x-zmachine' => 'z1', + 'application/xaml+xml' => 'xaml', + 'application/xcap-diff+xml' => 'xdf', + 'application/xenc+xml' => 'xenc', + 'application/xhtml+xml' => ['xhtml', 'xht'], + 'application/xml' => ['xml', 'xsl'], + 'application/xml-dtd' => 'dtd', + 'application/xop+xml' => 'xop', + 'application/xproc+xml' => 'xpl', + 'application/xslt+xml' => 'xslt', + 'application/xspf+xml' => 'xspf', + 'application/xv+xml' => ['mxml', 'xhvml', 'xvml', 'xvm'], + 'application/yang' => 'yang', + 'application/yin+xml' => 'yin', + 'application/zip' => 'zip', + 'audio/adpcm' => 'adp', + 'audio/basic' => ['au', 'snd'], + 'audio/midi' => ['mid', 'midi', 'kar', 'rmi'], + 'audio/mp4' => 'mp4a', + 'audio/mpeg' => [ + 'mpga', + 'mp2', + 'mp2a', + 'mp3', + 'm2a', + 'm3a', + ], + 'audio/ogg' => ['oga', 'ogg', 'spx'], + 'audio/vnd.dece.audio' => ['uva', 'uvva'], + 'audio/vnd.rip' => 'rip', + 'audio/webm' => 'weba', + 'audio/x-aac' => 'aac', + 'audio/x-aiff' => ['aif', 'aiff', 'aifc'], + 'audio/x-caf' => 'caf', + 'audio/x-flac' => 'flac', + 'audio/x-matroska' => 'mka', + 'audio/x-mpegurl' => 'm3u', + 'audio/x-ms-wax' => 'wax', + 'audio/x-ms-wma' => 'wma', + 'audio/x-pn-realaudio' => ['ram', 'ra'], + 'audio/x-pn-realaudio-plugin' => 'rmp', + 'audio/x-wav' => 'wav', + 'audio/xm' => 'xm', + 'image/bmp' => 'bmp', + 'image/cgm' => 'cgm', + 'image/g3fax' => 'g3', + 'image/gif' => 'gif', + 'image/ief' => 'ief', + 'image/jpeg' => ['jpeg', 'jpg', 'jpe'], + 'image/ktx' => 'ktx', + 'image/png' => 'png', + 'image/prs.btif' => 'btif', + 'image/sgi' => 'sgi', + 'image/svg+xml' => ['svg', 'svgz'], + 'image/tiff' => ['tiff', 'tif'], + 'image/vnd.adobe.photoshop' => 'psd', + 'image/vnd.dece.graphic' => ['uvi', 'uvvi', 'uvg', 'uvvg'], + 'image/vnd.dvb.subtitle' => 'sub', + 'image/vnd.djvu' => ['djvu', 'djv'], + 'image/vnd.dwg' => 'dwg', + 'image/vnd.dxf' => 'dxf', + 'image/vnd.fastbidsheet' => 'fbs', + 'image/vnd.fpx' => 'fpx', + 'image/vnd.fst' => 'fst', + 'image/vnd.fujixerox.edmics-mmr' => 'mmr', + 'image/vnd.fujixerox.edmics-rlc' => 'rlc', + 'image/vnd.ms-modi' => 'mdi', + 'image/vnd.ms-photo' => 'wdp', + 'image/vnd.net-fpx' => 'npx', + 'image/vnd.wap.wbmp' => 'wbmp', + 'image/vnd.xiff' => 'xif', + 'image/webp' => 'webp', + 'image/x-3ds' => '3ds', + 'image/x-cmu-raster' => 'ras', + 'image/x-cmx' => 'cmx', + 'image/x-freehand' => ['fh', 'fhc', 'fh4', 'fh5', 'fh7'], + 'image/x-icon' => 'ico', + 'image/x-mrsid-image' => 'sid', + 'image/x-pcx' => 'pcx', + 'image/x-pict' => ['pic', 'pct'], + 'image/x-portable-anymap' => 'pnm', + 'image/x-portable-bitmap' => 'pbm', + 'image/x-portable-graymap' => 'pgm', + 'image/x-portable-pixmap' => 'ppm', + 'image/x-rgb' => 'rgb', + 'image/x-tga' => 'tga', + 'image/x-xbitmap' => 'xbm', + 'image/x-xpixmap' => 'xpm', + 'image/x-xwindowdump' => 'xwd', + 'message/rfc822' => ['eml', 'mime'], + 'model/iges' => ['igs', 'iges'], + 'model/mesh' => ['msh', 'mesh', 'silo'], + 'model/vnd.collada+xml' => 'dae', + 'model/vnd.dwf' => 'dwf', + 'model/vnd.gdl' => 'gdl', + 'model/vnd.gtw' => 'gtw', + 'model/vnd.mts' => 'mts', + 'model/vnd.vtu' => 'vtu', + 'model/vrml' => ['wrl', 'vrml'], + 'model/x3d+binary' => 'x3db', + 'model/x3d+vrml' => 'x3dv', + 'model/x3d+xml' => 'x3d', + 'text/cache-manifest' => 'appcache', + 'text/calendar' => ['ics', 'ifb'], + 'text/css' => 'css', + 'text/csv' => 'csv', + 'text/html' => ['html', 'htm'], + 'text/n3' => 'n3', + 'text/plain' => [ + 'txt', + 'text', + 'conf', + 'def', + 'list', + 'log', + 'in', + ], + 'text/prs.lines.tag' => 'dsc', + 'text/richtext' => 'rtx', + 'text/sgml' => ['sgml', 'sgm'], + 'text/tab-separated-values' => 'tsv', + 'text/troff' => [ + 't', + 'tr', + 'roff', + 'man', + 'me', + 'ms', + ], + 'text/turtle' => 'ttl', + 'text/uri-list' => ['uri', 'uris', 'urls'], + 'text/vcard' => 'vcard', + 'text/vnd.curl' => 'curl', + 'text/vnd.curl.dcurl' => 'dcurl', + 'text/vnd.curl.scurl' => 'scurl', + 'text/vnd.curl.mcurl' => 'mcurl', + 'text/vnd.dvb.subtitle' => 'sub', + 'text/vnd.fly' => 'fly', + 'text/vnd.fmi.flexstor' => 'flx', + 'text/vnd.graphviz' => 'gv', + 'text/vnd.in3d.3dml' => '3dml', + 'text/vnd.in3d.spot' => 'spot', + 'text/vnd.sun.j2me.app-descriptor' => 'jad', + 'text/vnd.wap.wml' => 'wml', + 'text/vnd.wap.wmlscript' => 'wmls', + 'text/x-asm' => ['s', 'asm'], + 'text/x-fortran' => ['f', 'for', 'f77', 'f90'], + 'text/x-java-source' => 'java', + 'text/x-opml' => 'opml', + 'text/x-pascal' => ['p', 'pas'], + 'text/x-nfo' => 'nfo', + 'text/x-setext' => 'etx', + 'text/x-sfv' => 'sfv', + 'text/x-uuencode' => 'uu', + 'text/x-vcalendar' => 'vcs', + 'text/x-vcard' => 'vcf', + 'video/3gpp' => '3gp', + 'video/3gpp2' => '3g2', + 'video/h261' => 'h261', + 'video/h263' => 'h263', + 'video/h264' => 'h264', + 'video/jpeg' => 'jpgv', + 'video/jpm' => ['jpm', 'jpgm'], + 'video/mj2' => 'mj2', + 'video/mp4' => 'mp4', + 'video/mpeg' => ['mpeg', 'mpg', 'mpe', 'm1v', 'm2v'], + 'video/ogg' => 'ogv', + 'video/quicktime' => ['qt', 'mov'], + 'video/vnd.dece.hd' => ['uvh', 'uvvh'], + 'video/vnd.dece.mobile' => ['uvm', 'uvvm'], + 'video/vnd.dece.pd' => ['uvp', 'uvvp'], + 'video/vnd.dece.sd' => ['uvs', 'uvvs'], + 'video/vnd.dece.video' => ['uvv', 'uvvv'], + 'video/vnd.dvb.file' => 'dvb', + 'video/vnd.fvt' => 'fvt', + 'video/vnd.mpegurl' => ['mxu', 'm4u'], + 'video/vnd.ms-playready.media.pyv' => 'pyv', + 'video/vnd.uvvu.mp4' => ['uvu', 'uvvu'], + 'video/vnd.vivo' => 'viv', + 'video/webm' => 'webm', + 'video/x-f4v' => 'f4v', + 'video/x-fli' => 'fli', + 'video/x-flv' => 'flv', + 'video/x-m4v' => 'm4v', + 'video/x-matroska' => ['mkv', 'mk3d', 'mks'], + 'video/x-mng' => 'mng', + 'video/x-ms-asf' => ['asf', 'asx'], + 'video/x-ms-vob' => 'vob', + 'video/x-ms-wm' => 'wm', + 'video/x-ms-wmv' => 'wmv', + 'video/x-ms-wmx' => 'wmx', + 'video/x-ms-wvx' => 'wvx', + 'video/x-msvideo' => 'avi', + 'video/x-sgi-movie' => 'movie', + ]; + + /** + * Get a random MIME type + * + * @return string + * + * @example 'video/avi' + */ + public static function mimeType() + { + return static::randomElement(array_keys(static::$mimeTypes)); + } + + /** + * Get a random file extension (without a dot) + * + * @example avi + * + * @return string + */ + public static function fileExtension() + { + $random_extension = static::randomElement(array_values(static::$mimeTypes)); + + return is_array($random_extension) ? static::randomElement($random_extension) : $random_extension; + } + + /** + * Copy a random file from the source directory to the target directory and returns the filename/fullpath + * + * @param string $sourceDirectory The directory to look for random file taking + * @param string $targetDirectory + * @param bool $fullPath Whether to have the full path or just the filename + * + * @return string + */ + public static function file($sourceDirectory = '/tmp', $targetDirectory = '/tmp', $fullPath = true) + { + if (!is_dir($sourceDirectory)) { + throw new \InvalidArgumentException(sprintf('Source directory %s does not exist or is not a directory.', $sourceDirectory)); + } + + if (!is_dir($targetDirectory)) { + throw new \InvalidArgumentException(sprintf('Target directory %s does not exist or is not a directory.', $targetDirectory)); + } + + if ($sourceDirectory == $targetDirectory) { + throw new \InvalidArgumentException('Source and target directories must differ.'); + } + + // Drop . and .. and reset array keys + $files = array_filter(array_values(array_diff(scandir($sourceDirectory), ['.', '..'])), static function ($file) use ($sourceDirectory) { + return is_file($sourceDirectory . DIRECTORY_SEPARATOR . $file) && is_readable($sourceDirectory . DIRECTORY_SEPARATOR . $file); + }); + + if (empty($files)) { + throw new \InvalidArgumentException(sprintf('Source directory %s is empty.', $sourceDirectory)); + } + + $sourceFullPath = $sourceDirectory . DIRECTORY_SEPARATOR . static::randomElement($files); + + $destinationFile = Uuid::uuid() . '.' . pathinfo($sourceFullPath, PATHINFO_EXTENSION); + $destinationFullPath = $targetDirectory . DIRECTORY_SEPARATOR . $destinationFile; + + if (false === copy($sourceFullPath, $destinationFullPath)) { + return false; + } + + return $fullPath ? $destinationFullPath : $destinationFile; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/HtmlLorem.php b/vendor/fakerphp/faker/src/Faker/Provider/HtmlLorem.php new file mode 100644 index 00000000..a8434108 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/HtmlLorem.php @@ -0,0 +1,307 @@ +addProvider(new Lorem($generator)); + $generator->addProvider(new Internet($generator)); + } + + /** + * @param int $maxDepth + * @param int $maxWidth + * + * @return string + */ + public function randomHtml($maxDepth = 4, $maxWidth = 4) + { + if (!class_exists(\DOMDocument::class, false)) { + throw new \RuntimeException('ext-dom is required to use randomHtml.'); + } + + $document = new \DOMDocument(); + $this->idGenerator = new UniqueGenerator($this->generator); + + $head = $document->createElement('head'); + $this->addRandomTitle($head); + + $body = $document->createElement('body'); + $this->addLoginForm($body); + $this->addRandomSubTree($body, $maxDepth, $maxWidth); + + $html = $document->createElement('html'); + $html->appendChild($head); + $html->appendChild($body); + + $document->appendChild($html); + + return $document->saveHTML(); + } + + private function addRandomSubTree(\DOMElement $root, $maxDepth, $maxWidth) + { + --$maxDepth; + + if ($maxDepth <= 0) { + return $root; + } + + $siblings = self::numberBetween(1, $maxWidth); + + for ($i = 0; $i < $siblings; ++$i) { + if ($maxDepth == 1) { + $this->addRandomLeaf($root); + } else { + $sibling = $root->ownerDocument->createElement('div'); + $root->appendChild($sibling); + $this->addRandomAttribute($sibling); + $this->addRandomSubTree($sibling, self::numberBetween(0, $maxDepth), $maxWidth); + } + } + + return $root; + } + + private function addRandomLeaf(\DOMElement $node): void + { + $rand = self::numberBetween(1, 10); + + switch ($rand) { + case 1: + $this->addRandomP($node); + + break; + + case 2: + $this->addRandomA($node); + + break; + + case 3: + $this->addRandomSpan($node); + + break; + + case 4: + $this->addRandomUL($node); + + break; + + case 5: + $this->addRandomH($node); + + break; + + case 6: + $this->addRandomB($node); + + break; + + case 7: + $this->addRandomI($node); + + break; + + case 8: + $this->addRandomTable($node); + + break; + + default: + $this->addRandomText($node); + + break; + } + } + + private function addRandomAttribute(\DOMElement $node): void + { + $rand = self::numberBetween(1, 2); + + switch ($rand) { + case 1: + $node->setAttribute('class', $this->generator->word()); + + break; + + case 2: + $node->setAttribute('id', (string) $this->idGenerator->randomNumber(5)); + + break; + } + } + + private function addRandomP(\DOMElement $element, $maxLength = 10): void + { + $node = $element->ownerDocument->createElement(static::P_TAG); + $node->textContent = $this->generator->sentence(self::numberBetween(1, $maxLength)); + $element->appendChild($node); + } + + private function addRandomText(\DOMElement $element, $maxLength = 10): void + { + $text = $element->ownerDocument->createTextNode($this->generator->sentence(self::numberBetween(1, $maxLength))); + $element->appendChild($text); + } + + private function addRandomA(\DOMElement $element, $maxLength = 10): void + { + $text = $element->ownerDocument->createTextNode($this->generator->sentence(self::numberBetween(1, $maxLength))); + $node = $element->ownerDocument->createElement(static::A_TAG); + $node->setAttribute('href', $this->generator->safeEmailDomain()); + $node->appendChild($text); + $element->appendChild($node); + } + + private function addRandomTitle(\DOMElement $element, $maxLength = 10): void + { + $text = $element->ownerDocument->createTextNode($this->generator->sentence(self::numberBetween(1, $maxLength))); + $node = $element->ownerDocument->createElement(static::TITLE_TAG); + $node->appendChild($text); + $element->appendChild($node); + } + + private function addRandomH(\DOMElement $element, $maxLength = 10): void + { + $h = static::H_TAG . (string) self::numberBetween(1, 3); + $text = $element->ownerDocument->createTextNode($this->generator->sentence(self::numberBetween(1, $maxLength))); + $node = $element->ownerDocument->createElement($h); + $node->appendChild($text); + $element->appendChild($node); + } + + private function addRandomB(\DOMElement $element, $maxLength = 10): void + { + $text = $element->ownerDocument->createTextNode($this->generator->sentence(self::numberBetween(1, $maxLength))); + $node = $element->ownerDocument->createElement(static::B_TAG); + $node->appendChild($text); + $element->appendChild($node); + } + + private function addRandomI(\DOMElement $element, $maxLength = 10): void + { + $text = $element->ownerDocument->createTextNode($this->generator->sentence(self::numberBetween(1, $maxLength))); + $node = $element->ownerDocument->createElement(static::I_TAG); + $node->appendChild($text); + $element->appendChild($node); + } + + private function addRandomSpan(\DOMElement $element, $maxLength = 10): void + { + $text = $element->ownerDocument->createTextNode($this->generator->sentence(self::numberBetween(1, $maxLength))); + $node = $element->ownerDocument->createElement(static::SPAN_TAG); + $node->appendChild($text); + $element->appendChild($node); + } + + private function addLoginForm(\DOMElement $element): void + { + $textInput = $element->ownerDocument->createElement(static::INPUT_TAG); + $textInput->setAttribute('type', 'text'); + $textInput->setAttribute('id', 'username'); + + $textLabel = $element->ownerDocument->createElement(static::LABEL_TAG); + $textLabel->setAttribute('for', 'username'); + $textLabel->textContent = $this->generator->word(); + + $passwordInput = $element->ownerDocument->createElement(static::INPUT_TAG); + $passwordInput->setAttribute('type', 'password'); + $passwordInput->setAttribute('id', 'password'); + + $passwordLabel = $element->ownerDocument->createElement(static::LABEL_TAG); + $passwordLabel->setAttribute('for', 'password'); + $passwordLabel->textContent = $this->generator->word(); + + $submit = $element->ownerDocument->createElement(static::INPUT_TAG); + $submit->setAttribute('type', 'submit'); + $submit->setAttribute('value', $this->generator->word()); + + $submit = $element->ownerDocument->createElement(static::FORM_TAG); + $submit->setAttribute('action', $this->generator->safeEmailDomain()); + $submit->setAttribute('method', 'POST'); + $submit->appendChild($textLabel); + $submit->appendChild($textInput); + $submit->appendChild($passwordLabel); + $submit->appendChild($passwordInput); + $element->appendChild($submit); + } + + private function addRandomTable(\DOMElement $element, $maxRows = 10, $maxCols = 6, $maxTitle = 4, $maxLength = 10): void + { + $rows = self::numberBetween(1, $maxRows); + $cols = self::numberBetween(1, $maxCols); + + $table = $element->ownerDocument->createElement(static::TABLE_TAG); + $thead = $element->ownerDocument->createElement(static::THEAD_TAG); + $tbody = $element->ownerDocument->createElement(static::TBODY_TAG); + + $table->appendChild($thead); + $table->appendChild($tbody); + + $tr = $element->ownerDocument->createElement(static::TR_TAG); + $thead->appendChild($tr); + + for ($i = 0; $i < $cols; ++$i) { + $th = $element->ownerDocument->createElement(static::TH_TAG); + $th->textContent = $this->generator->sentence(self::numberBetween(1, $maxTitle)); + $tr->appendChild($th); + } + + for ($i = 0; $i < $rows; ++$i) { + $tr = $element->ownerDocument->createElement(static::TR_TAG); + $tbody->appendChild($tr); + + for ($j = 0; $j < $cols; ++$j) { + $th = $element->ownerDocument->createElement(static::TD_TAG); + $th->textContent = $this->generator->sentence(self::numberBetween(1, $maxLength)); + $tr->appendChild($th); + } + } + $element->appendChild($table); + } + + private function addRandomUL(\DOMElement $element, $maxItems = 11, $maxLength = 4): void + { + $num = self::numberBetween(1, $maxItems); + $ul = $element->ownerDocument->createElement(static::UL_TAG); + + for ($i = 0; $i < $num; ++$i) { + $li = $element->ownerDocument->createElement(static::LI_TAG); + $li->textContent = $this->generator->sentence(self::numberBetween(1, $maxLength)); + $ul->appendChild($li); + } + $element->appendChild($ul); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/Image.php b/vendor/fakerphp/faker/src/Faker/Provider/Image.php new file mode 100644 index 00000000..e7871421 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/Image.php @@ -0,0 +1,196 @@ + 0 ? '?text=' . urlencode(implode(' ', $imageParts)) : '', + ); + } + + /** + * Download a remote random image to disk and return its location + * + * Requires curl, or allow_url_fopen to be on in php.ini. + * + * @example '/path/to/dir/13b73edae8443990be1aa8f1a483bc27.png' + * + * @return bool|string + */ + public static function image( + $dir = null, + $width = 640, + $height = 480, + $category = null, + $fullPath = true, + $randomize = true, + $word = null, + $gray = false, + $format = 'png' + ) { + trigger_deprecation( + 'fakerphp/faker', + '1.20', + 'Provider is deprecated and will no longer be available in Faker 2. Please use a custom provider instead', + ); + + $dir = null === $dir ? sys_get_temp_dir() : $dir; // GNU/Linux / OS X / Windows compatible + + // Validate directory path + if (!is_dir($dir) || !is_writable($dir)) { + throw new \InvalidArgumentException(sprintf('Cannot write to directory "%s"', $dir)); + } + + // Generate a random filename. Use the server address so that a file + // generated at the same time on a different server won't have a collision. + $name = md5(uniqid(empty($_SERVER['SERVER_ADDR']) ? '' : $_SERVER['SERVER_ADDR'], true)); + $filename = sprintf('%s.%s', $name, $format); + $filepath = $dir . DIRECTORY_SEPARATOR . $filename; + + $url = static::imageUrl($width, $height, $category, $randomize, $word, $gray, $format); + + // save file + if (function_exists('curl_exec')) { + // use cURL + $fp = fopen($filepath, 'w'); + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_FILE, $fp); + $success = curl_exec($ch) && curl_getinfo($ch, CURLINFO_HTTP_CODE) === 200; + fclose($fp); + curl_close($ch); + + if (!$success) { + unlink($filepath); + + // could not contact the distant URL or HTTP error - fail silently. + return false; + } + } elseif (ini_get('allow_url_fopen')) { + // use remote fopen() via copy() + $success = copy($url, $filepath); + + if (!$success) { + // could not contact the distant URL or HTTP error - fail silently. + return false; + } + } else { + return new \RuntimeException('The image formatter downloads an image from a remote HTTP server. Therefore, it requires that PHP can request remote hosts, either via cURL or fopen()'); + } + + return $fullPath ? $filepath : $filename; + } + + public static function getFormats(): array + { + trigger_deprecation( + 'fakerphp/faker', + '1.20', + 'Provider is deprecated and will no longer be available in Faker 2. Please use a custom provider instead', + ); + + return array_keys(static::getFormatConstants()); + } + + public static function getFormatConstants(): array + { + trigger_deprecation( + 'fakerphp/faker', + '1.20', + 'Provider is deprecated and will no longer be available in Faker 2. Please use a custom provider instead', + ); + + return [ + static::FORMAT_JPG => constant('IMAGETYPE_JPEG'), + static::FORMAT_JPEG => constant('IMAGETYPE_JPEG'), + static::FORMAT_PNG => constant('IMAGETYPE_PNG'), + ]; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/Internet.php new file mode 100644 index 00000000..122d9c0c --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/Internet.php @@ -0,0 +1,407 @@ +generator->parse($format); + } + + /** + * @example 'jdoe@example.com' + * + * @return string + */ + final public function safeEmail() + { + return preg_replace('/\s/u', '', $this->userName() . '@' . static::safeEmailDomain()); + } + + /** + * @example 'jdoe@gmail.com' + * + * @return string + */ + public function freeEmail() + { + return preg_replace('/\s/u', '', $this->userName() . '@' . static::freeEmailDomain()); + } + + /** + * @example 'jdoe@dawson.com' + * + * @return string + */ + public function companyEmail() + { + return preg_replace('/\s/u', '', $this->userName() . '@' . $this->domainName()); + } + + /** + * @example 'gmail.com' + * + * @return string + */ + public static function freeEmailDomain() + { + return static::randomElement(static::$freeEmailDomain); + } + + /** + * @example 'example.org' + * + * @return string + */ + final public static function safeEmailDomain() + { + $domains = [ + 'example.com', + 'example.org', + 'example.net', + ]; + + return static::randomElement($domains); + } + + /** + * @example 'jdoe' + * + * @return string + */ + public function userName() + { + $format = static::randomElement(static::$userNameFormats); + $username = static::bothify($this->generator->parse($format)); + + $username = strtolower(static::transliterate($username)); + + // check if transliterate() didn't support the language and removed all letters + if (trim($username, '._') === '') { + throw new \Exception('userName failed with the selected locale. Try a different locale or activate the "intl" PHP extension.'); + } + + // clean possible trailing dots from first/last names + $username = str_replace('..', '.', $username); + $username = rtrim($username, '.'); + + return $username; + } + + /** + * @example 'fY4èHdZv68' + * + * @return string + */ + public function password($minLength = 6, $maxLength = 20) + { + $pattern = str_repeat('*', $this->numberBetween($minLength, $maxLength)); + + return $this->asciify($pattern); + } + + /** + * @example 'tiramisu.com' + * + * @return string + */ + public function domainName() + { + return $this->domainWord() . '.' . $this->tld(); + } + + /** + * @example 'faber' + * + * @return string + */ + public function domainWord() + { + $lastName = $this->generator->format('lastName'); + + $lastName = strtolower(static::transliterate($lastName)); + + // check if transliterate() didn't support the language and removed all letters + if (trim($lastName, '._') === '') { + throw new \Exception('domainWord failed with the selected locale. Try a different locale or activate the "intl" PHP extension.'); + } + + // clean possible trailing dot from last name + $lastName = rtrim($lastName, '.'); + + return $lastName; + } + + /** + * @example 'com' + * + * @return string + */ + public function tld() + { + return static::randomElement(static::$tld); + } + + /** + * @example 'http://www.runolfsdottir.com/' + * + * @return string + */ + public function url() + { + $format = static::randomElement(static::$urlFormats); + + return $this->generator->parse($format); + } + + /** + * @example 'aut-repellat-commodi-vel-itaque-nihil-id-saepe-nostrum' + * + * @return string + */ + public function slug($nbWords = 6, $variableNbWords = true) + { + if ($nbWords <= 0) { + return ''; + } + + if ($variableNbWords) { + $nbWords = (int) ($nbWords * self::numberBetween(60, 140) / 100) + 1; + } + $words = $this->generator->words($nbWords); + + return implode('-', $words); + } + + /** + * @example '237.149.115.38' + * + * @return string + */ + public function ipv4() + { + return long2ip(Miscellaneous::boolean() ? self::numberBetween(-2147483648, -2) : self::numberBetween(16777216, 2147483647)); + } + + /** + * @example '35cd:186d:3e23:2986:ef9f:5b41:42a4:e6f1' + * + * @return string + */ + public function ipv6() + { + $res = []; + + for ($i = 0; $i < 8; ++$i) { + $res[] = dechex(self::numberBetween(0, 65535)); + } + + return implode(':', $res); + } + + /** + * @example '10.1.1.17' + * + * @return string + */ + public static function localIpv4() + { + $ipBlock = self::randomElement(static::$localIpBlocks); + + return long2ip(static::numberBetween(ip2long($ipBlock[0]), ip2long($ipBlock[1]))); + } + + /** + * @example '32:F1:39:2F:D6:18' + * + * @return string + */ + public static function macAddress() + { + $mac = []; + + for ($i = 0; $i < 6; ++$i) { + $mac[] = sprintf('%02X', self::numberBetween(0, 0xff)); + } + + return implode(':', $mac); + } + + protected static function transliterate($string) + { + if (0 === preg_match('/[^A-Za-z0-9_.]/', $string)) { + return $string; + } + + $transId = 'Any-Latin; Latin-ASCII; NFD; [:Nonspacing Mark:] Remove; NFC;'; + + if (class_exists(\Transliterator::class, false) && $transliterator = \Transliterator::create($transId)) { + $transString = $transliterator->transliterate($string); + } else { + $transString = static::toAscii($string); + } + + return preg_replace('/[^A-Za-z0-9_.]/u', '', $transString); + } + + protected static function toAscii($string) + { + static $arrayFrom, $arrayTo; + + if (empty($arrayFrom)) { + $transliterationTable = [ + 'IJ' => 'I', 'Ö' => 'O', 'Œ' => 'O', 'Ü' => 'U', 'ä' => 'a', 'æ' => 'a', + 'ij' => 'i', 'ö' => 'o', 'œ' => 'o', 'ü' => 'u', 'ß' => 's', 'ſ' => 's', + 'À' => 'A', 'Á' => 'A', 'Â' => 'A', 'Ã' => 'A', 'Ä' => 'A', 'Å' => 'A', + 'Æ' => 'A', 'Ā' => 'A', 'Ą' => 'A', 'Ă' => 'A', 'Ç' => 'C', 'Ć' => 'C', + 'Č' => 'C', 'Ĉ' => 'C', 'Ċ' => 'C', 'Ď' => 'D', 'Đ' => 'D', 'È' => 'E', + 'É' => 'E', 'Ê' => 'E', 'Ë' => 'E', 'Ē' => 'E', 'Ę' => 'E', 'Ě' => 'E', + 'Ĕ' => 'E', 'Ė' => 'E', 'Ĝ' => 'G', 'Ğ' => 'G', 'Ġ' => 'G', 'Ģ' => 'G', + 'Ĥ' => 'H', 'Ħ' => 'H', 'Ì' => 'I', 'Í' => 'I', 'Î' => 'I', 'Ï' => 'I', + 'Ī' => 'I', 'Ĩ' => 'I', 'Ĭ' => 'I', 'Į' => 'I', 'İ' => 'I', 'Ĵ' => 'J', + 'Ķ' => 'K', 'Ľ' => 'K', 'Ĺ' => 'K', 'Ļ' => 'K', 'Ŀ' => 'K', 'Ł' => 'L', + 'Ñ' => 'N', 'Ń' => 'N', 'Ň' => 'N', 'Ņ' => 'N', 'Ŋ' => 'N', 'Ò' => 'O', + 'Ó' => 'O', 'Ô' => 'O', 'Õ' => 'O', 'Ø' => 'O', 'Ō' => 'O', 'Ő' => 'O', + 'Ŏ' => 'O', 'Ŕ' => 'R', 'Ř' => 'R', 'Ŗ' => 'R', 'Ś' => 'S', 'Ş' => 'S', + 'Ŝ' => 'S', 'Ș' => 'S', 'Š' => 'S', 'Ť' => 'T', 'Ţ' => 'T', 'Ŧ' => 'T', + 'Ț' => 'T', 'Ù' => 'U', 'Ú' => 'U', 'Û' => 'U', 'Ū' => 'U', 'Ů' => 'U', + 'Ű' => 'U', 'Ŭ' => 'U', 'Ũ' => 'U', 'Ų' => 'U', 'Ŵ' => 'W', 'Ŷ' => 'Y', + 'Ÿ' => 'Y', 'Ý' => 'Y', 'Ź' => 'Z', 'Ż' => 'Z', 'Ž' => 'Z', 'à' => 'a', + 'á' => 'a', 'â' => 'a', 'ã' => 'a', 'ā' => 'a', 'ą' => 'a', 'ă' => 'a', + 'å' => 'a', 'ç' => 'c', 'ć' => 'c', 'č' => 'c', 'ĉ' => 'c', 'ċ' => 'c', + 'ď' => 'd', 'đ' => 'd', 'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e', + 'ē' => 'e', 'ę' => 'e', 'ě' => 'e', 'ĕ' => 'e', 'ė' => 'e', 'ƒ' => 'f', + 'ĝ' => 'g', 'ğ' => 'g', 'ġ' => 'g', 'ģ' => 'g', 'ĥ' => 'h', 'ħ' => 'h', + 'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i', 'ī' => 'i', 'ĩ' => 'i', + 'ĭ' => 'i', 'į' => 'i', 'ı' => 'i', 'ĵ' => 'j', 'ķ' => 'k', 'ĸ' => 'k', + 'ł' => 'l', 'ľ' => 'l', 'ĺ' => 'l', 'ļ' => 'l', 'ŀ' => 'l', 'ñ' => 'n', + 'ń' => 'n', 'ň' => 'n', 'ņ' => 'n', 'ʼn' => 'n', 'ŋ' => 'n', 'ò' => 'o', + 'ó' => 'o', 'ô' => 'o', 'õ' => 'o', 'ø' => 'o', 'ō' => 'o', 'ő' => 'o', + 'ŏ' => 'o', 'ŕ' => 'r', 'ř' => 'r', 'ŗ' => 'r', 'ś' => 's', 'š' => 's', + 'ť' => 't', 'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ū' => 'u', 'ů' => 'u', + 'ű' => 'u', 'ŭ' => 'u', 'ũ' => 'u', 'ų' => 'u', 'ŵ' => 'w', 'ÿ' => 'y', + 'ý' => 'y', 'ŷ' => 'y', 'ż' => 'z', 'ź' => 'z', 'ž' => 'z', 'Α' => 'A', + 'Ά' => 'A', 'Ἀ' => 'A', 'Ἁ' => 'A', 'Ἂ' => 'A', 'Ἃ' => 'A', 'Ἄ' => 'A', + 'Ἅ' => 'A', 'Ἆ' => 'A', 'Ἇ' => 'A', 'ᾈ' => 'A', 'ᾉ' => 'A', 'ᾊ' => 'A', + 'ᾋ' => 'A', 'ᾌ' => 'A', 'ᾍ' => 'A', 'ᾎ' => 'A', 'ᾏ' => 'A', 'Ᾰ' => 'A', + 'Ᾱ' => 'A', 'Ὰ' => 'A', 'ᾼ' => 'A', 'Β' => 'B', 'Γ' => 'G', 'Δ' => 'D', + 'Ε' => 'E', 'Έ' => 'E', 'Ἐ' => 'E', 'Ἑ' => 'E', 'Ἒ' => 'E', 'Ἓ' => 'E', + 'Ἔ' => 'E', 'Ἕ' => 'E', 'Ὲ' => 'E', 'Ζ' => 'Z', 'Η' => 'I', 'Ή' => 'I', + 'Ἠ' => 'I', 'Ἡ' => 'I', 'Ἢ' => 'I', 'Ἣ' => 'I', 'Ἤ' => 'I', 'Ἥ' => 'I', + 'Ἦ' => 'I', 'Ἧ' => 'I', 'ᾘ' => 'I', 'ᾙ' => 'I', 'ᾚ' => 'I', 'ᾛ' => 'I', + 'ᾜ' => 'I', 'ᾝ' => 'I', 'ᾞ' => 'I', 'ᾟ' => 'I', 'Ὴ' => 'I', 'ῌ' => 'I', + 'Θ' => 'T', 'Ι' => 'I', 'Ί' => 'I', 'Ϊ' => 'I', 'Ἰ' => 'I', 'Ἱ' => 'I', + 'Ἲ' => 'I', 'Ἳ' => 'I', 'Ἴ' => 'I', 'Ἵ' => 'I', 'Ἶ' => 'I', 'Ἷ' => 'I', + 'Ῐ' => 'I', 'Ῑ' => 'I', 'Ὶ' => 'I', 'Κ' => 'K', 'Λ' => 'L', 'Μ' => 'M', + 'Ν' => 'N', 'Ξ' => 'K', 'Ο' => 'O', 'Ό' => 'O', 'Ὀ' => 'O', 'Ὁ' => 'O', + 'Ὂ' => 'O', 'Ὃ' => 'O', 'Ὄ' => 'O', 'Ὅ' => 'O', 'Ὸ' => 'O', 'Π' => 'P', + 'Ρ' => 'R', 'Ῥ' => 'R', 'Σ' => 'S', 'Τ' => 'T', 'Υ' => 'Y', 'Ύ' => 'Y', + 'Ϋ' => 'Y', 'Ὑ' => 'Y', 'Ὓ' => 'Y', 'Ὕ' => 'Y', 'Ὗ' => 'Y', 'Ῠ' => 'Y', + 'Ῡ' => 'Y', 'Ὺ' => 'Y', 'Φ' => 'F', 'Χ' => 'X', 'Ψ' => 'P', 'Ω' => 'O', + 'Ώ' => 'O', 'Ὠ' => 'O', 'Ὡ' => 'O', 'Ὢ' => 'O', 'Ὣ' => 'O', 'Ὤ' => 'O', + 'Ὥ' => 'O', 'Ὦ' => 'O', 'Ὧ' => 'O', 'ᾨ' => 'O', 'ᾩ' => 'O', 'ᾪ' => 'O', + 'ᾫ' => 'O', 'ᾬ' => 'O', 'ᾭ' => 'O', 'ᾮ' => 'O', 'ᾯ' => 'O', 'Ὼ' => 'O', + 'ῼ' => 'O', 'α' => 'a', 'ά' => 'a', 'ἀ' => 'a', 'ἁ' => 'a', 'ἂ' => 'a', + 'ἃ' => 'a', 'ἄ' => 'a', 'ἅ' => 'a', 'ἆ' => 'a', 'ἇ' => 'a', 'ᾀ' => 'a', + 'ᾁ' => 'a', 'ᾂ' => 'a', 'ᾃ' => 'a', 'ᾄ' => 'a', 'ᾅ' => 'a', 'ᾆ' => 'a', + 'ᾇ' => 'a', 'ὰ' => 'a', 'ᾰ' => 'a', 'ᾱ' => 'a', 'ᾲ' => 'a', 'ᾳ' => 'a', + 'ᾴ' => 'a', 'ᾶ' => 'a', 'ᾷ' => 'a', 'β' => 'b', 'γ' => 'g', 'δ' => 'd', + 'ε' => 'e', 'έ' => 'e', 'ἐ' => 'e', 'ἑ' => 'e', 'ἒ' => 'e', 'ἓ' => 'e', + 'ἔ' => 'e', 'ἕ' => 'e', 'ὲ' => 'e', 'ζ' => 'z', 'η' => 'i', 'ή' => 'i', + 'ἠ' => 'i', 'ἡ' => 'i', 'ἢ' => 'i', 'ἣ' => 'i', 'ἤ' => 'i', 'ἥ' => 'i', + 'ἦ' => 'i', 'ἧ' => 'i', 'ᾐ' => 'i', 'ᾑ' => 'i', 'ᾒ' => 'i', 'ᾓ' => 'i', + 'ᾔ' => 'i', 'ᾕ' => 'i', 'ᾖ' => 'i', 'ᾗ' => 'i', 'ὴ' => 'i', 'ῂ' => 'i', + 'ῃ' => 'i', 'ῄ' => 'i', 'ῆ' => 'i', 'ῇ' => 'i', 'θ' => 't', 'ι' => 'i', + 'ί' => 'i', 'ϊ' => 'i', 'ΐ' => 'i', 'ἰ' => 'i', 'ἱ' => 'i', 'ἲ' => 'i', + 'ἳ' => 'i', 'ἴ' => 'i', 'ἵ' => 'i', 'ἶ' => 'i', 'ἷ' => 'i', 'ὶ' => 'i', + 'ῐ' => 'i', 'ῑ' => 'i', 'ῒ' => 'i', 'ῖ' => 'i', 'ῗ' => 'i', 'κ' => 'k', + 'λ' => 'l', 'μ' => 'm', 'ν' => 'n', 'ξ' => 'k', 'ο' => 'o', 'ό' => 'o', + 'ὀ' => 'o', 'ὁ' => 'o', 'ὂ' => 'o', 'ὃ' => 'o', 'ὄ' => 'o', 'ὅ' => 'o', + 'ὸ' => 'o', 'π' => 'p', 'ρ' => 'r', 'ῤ' => 'r', 'ῥ' => 'r', 'σ' => 's', + 'ς' => 's', 'τ' => 't', 'υ' => 'y', 'ύ' => 'y', 'ϋ' => 'y', 'ΰ' => 'y', + 'ὐ' => 'y', 'ὑ' => 'y', 'ὒ' => 'y', 'ὓ' => 'y', 'ὔ' => 'y', 'ὕ' => 'y', + 'ὖ' => 'y', 'ὗ' => 'y', 'ὺ' => 'y', 'ῠ' => 'y', 'ῡ' => 'y', 'ῢ' => 'y', + 'ῦ' => 'y', 'ῧ' => 'y', 'φ' => 'f', 'χ' => 'x', 'ψ' => 'p', 'ω' => 'o', + 'ώ' => 'o', 'ὠ' => 'o', 'ὡ' => 'o', 'ὢ' => 'o', 'ὣ' => 'o', 'ὤ' => 'o', + 'ὥ' => 'o', 'ὦ' => 'o', 'ὧ' => 'o', 'ᾠ' => 'o', 'ᾡ' => 'o', 'ᾢ' => 'o', + 'ᾣ' => 'o', 'ᾤ' => 'o', 'ᾥ' => 'o', 'ᾦ' => 'o', 'ᾧ' => 'o', 'ὼ' => 'o', + 'ῲ' => 'o', 'ῳ' => 'o', 'ῴ' => 'o', 'ῶ' => 'o', 'ῷ' => 'o', 'А' => 'A', + 'Б' => 'B', 'В' => 'V', 'Г' => 'G', 'Д' => 'D', 'Е' => 'E', 'Ё' => 'E', + 'Ж' => 'Z', 'З' => 'Z', 'И' => 'I', 'Й' => 'I', 'К' => 'K', 'Л' => 'L', + 'М' => 'M', 'Н' => 'N', 'О' => 'O', 'П' => 'P', 'Р' => 'R', 'С' => 'S', + 'Т' => 'T', 'У' => 'U', 'Ф' => 'F', 'Х' => 'K', 'Ц' => 'T', 'Ч' => 'C', + 'Ш' => 'S', 'Щ' => 'S', 'Ы' => 'Y', 'Э' => 'E', 'Ю' => 'Y', 'Я' => 'Y', + 'а' => 'A', 'б' => 'B', 'в' => 'V', 'г' => 'G', 'д' => 'D', 'е' => 'E', + 'ё' => 'E', 'ж' => 'Z', 'з' => 'Z', 'и' => 'I', 'й' => 'I', 'к' => 'K', + 'л' => 'L', 'м' => 'M', 'н' => 'N', 'о' => 'O', 'п' => 'P', 'р' => 'R', + 'с' => 'S', 'т' => 'T', 'у' => 'U', 'ф' => 'F', 'х' => 'K', 'ц' => 'T', + 'ч' => 'C', 'ш' => 'S', 'щ' => 'S', 'ы' => 'Y', 'э' => 'E', 'ю' => 'Y', + 'я' => 'Y', 'ð' => 'd', 'Ð' => 'D', 'þ' => 't', 'Þ' => 'T', 'ა' => 'a', + 'ბ' => 'b', 'გ' => 'g', 'დ' => 'd', 'ე' => 'e', 'ვ' => 'v', 'ზ' => 'z', + 'თ' => 't', 'ი' => 'i', 'კ' => 'k', 'ლ' => 'l', 'მ' => 'm', 'ნ' => 'n', + 'ო' => 'o', 'პ' => 'p', 'ჟ' => 'z', 'რ' => 'r', 'ს' => 's', 'ტ' => 't', + 'უ' => 'u', 'ფ' => 'p', 'ქ' => 'k', 'ღ' => 'g', 'ყ' => 'q', 'შ' => 's', + 'ჩ' => 'c', 'ც' => 't', 'ძ' => 'd', 'წ' => 't', 'ჭ' => 'c', 'ხ' => 'k', + 'ჯ' => 'j', 'ჰ' => 'h', 'ţ' => 't', 'ʼ' => "'", '̧' => '', 'ḩ' => 'h', + '‘' => "'", '’' => "'", 'ừ' => 'u', '/' => '', 'ế' => 'e', 'ả' => 'a', + 'ị' => 'i', 'ậ' => 'a', 'ệ' => 'e', 'ỉ' => 'i', 'ồ' => 'o', 'ề' => 'e', + 'ơ' => 'o', 'ạ' => 'a', 'ẵ' => 'a', 'ư' => 'u', 'ằ' => 'a', 'ầ' => 'a', + 'ḑ' => 'd', 'Ḩ' => 'H', 'Ḑ' => 'D', 'ș' => 's', 'ț' => 't', 'ộ' => 'o', + 'ắ' => 'a', 'ş' => 's', "'" => '', 'ու' => 'u', 'ա' => 'a', 'բ' => 'b', + 'գ' => 'g', 'դ' => 'd', 'ե' => 'e', 'զ' => 'z', 'է' => 'e', 'ը' => 'y', + 'թ' => 't', 'ժ' => 'zh', 'ի' => 'i', 'լ' => 'l', 'խ' => 'kh', 'ծ' => 'ts', + 'կ' => 'k', 'հ' => 'h', 'ձ' => 'dz', 'ղ' => 'gh', 'ճ' => 'ch', 'մ' => 'm', + 'յ' => 'y', 'ն' => 'n', 'շ' => 'sh', 'ո' => 'o', 'չ' => 'ch', 'պ' => 'p', + 'ջ' => 'j', 'ռ' => 'r', 'ս' => 's', 'վ' => 'v', 'տ' => 't', 'ր' => 'r', + 'ց' => 'ts', 'փ' => 'p', 'ք' => 'q', 'և' => 'ev', 'օ' => 'o', 'ֆ' => 'f', + ]; + $arrayFrom = array_keys($transliterationTable); + $arrayTo = array_values($transliterationTable); + } + + return str_replace($arrayFrom, $arrayTo, $string); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/Lorem.php b/vendor/fakerphp/faker/src/Faker/Provider/Lorem.php new file mode 100644 index 00000000..2cfb70ea --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/Lorem.php @@ -0,0 +1,228 @@ +generator->parse('{{bloodType}}{{bloodRh}}'); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/Miscellaneous.php b/vendor/fakerphp/faker/src/Faker/Provider/Miscellaneous.php new file mode 100644 index 00000000..354f67bb --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/Miscellaneous.php @@ -0,0 +1,342 @@ + [ + '4539###########', + '4556###########', + '4916###########', + '4532###########', + '4929###########', + '40240071#######', + '4485###########', + '4716###########', + '4##############', + ], + 'Visa Retired' => [ + '4539########', + '4556########', + '4916########', + '4532########', + '4929########', + '40240071####', + '4485########', + '4716########', + '4###########', + ], + 'MasterCard' => [ + '2221###########', + '23#############', + '24#############', + '25#############', + '26#############', + '2720###########', + '51#############', + '52#############', + '53#############', + '54#############', + '55#############', + ], + 'American Express' => [ + '34############', + '37############', + ], + 'Discover Card' => [ + '6011###########', + ], + 'JCB' => [ + '3528###########', + '3589###########', + ], + ]; + + /** + * @var array list of IBAN formats, source: @see https://www.swift.com/standards/data-standards/iban + */ + protected static $ibanFormats = [ + 'AD' => [['n', 4], ['n', 4], ['c', 12]], + 'AE' => [['n', 3], ['n', 16]], + 'AL' => [['n', 8], ['c', 16]], + 'AT' => [['n', 5], ['n', 11]], + 'AZ' => [['a', 4], ['c', 20]], + 'BA' => [['n', 3], ['n', 3], ['n', 8], ['n', 2]], + 'BE' => [['n', 3], ['n', 7], ['n', 2]], + 'BG' => [['a', 4], ['n', 4], ['n', 2], ['c', 8]], + 'BH' => [['a', 4], ['c', 14]], + 'BR' => [['n', 8], ['n', 5], ['n', 10], ['a', 1], ['c', 1]], + 'CH' => [['n', 5], ['c', 12]], + 'CR' => [['n', 4], ['n', 14]], + 'CY' => [['n', 3], ['n', 5], ['c', 16]], + 'CZ' => [['n', 4], ['n', 6], ['n', 10]], + 'DE' => [['n', 8], ['n', 10]], + 'DK' => [['n', 4], ['n', 9], ['n', 1]], + 'DO' => [['c', 4], ['n', 20]], + 'EE' => [['n', 2], ['n', 2], ['n', 11], ['n', 1]], + 'EG' => [['n', 4], ['n', 4], ['n', 17]], + 'ES' => [['n', 4], ['n', 4], ['n', 1], ['n', 1], ['n', 10]], + 'FI' => [['n', 6], ['n', 7], ['n', 1]], + 'FR' => [['n', 5], ['n', 5], ['c', 11], ['n', 2]], + 'GB' => [['a', 4], ['n', 6], ['n', 8]], + 'GE' => [['a', 2], ['n', 16]], + 'GI' => [['a', 4], ['c', 15]], + 'GR' => [['n', 3], ['n', 4], ['c', 16]], + 'GT' => [['c', 4], ['c', 20]], + 'HR' => [['n', 7], ['n', 10]], + 'HU' => [['n', 3], ['n', 4], ['n', 1], ['n', 15], ['n', 1]], + 'IE' => [['a', 4], ['n', 6], ['n', 8]], + 'IL' => [['n', 3], ['n', 3], ['n', 13]], + 'IS' => [['n', 4], ['n', 2], ['n', 6], ['n', 10]], + 'IT' => [['a', 1], ['n', 5], ['n', 5], ['c', 12]], + 'KW' => [['a', 4], ['n', 22]], + 'KZ' => [['n', 3], ['c', 13]], + 'LB' => [['n', 4], ['c', 20]], + 'LI' => [['n', 5], ['c', 12]], + 'LT' => [['n', 5], ['n', 11]], + 'LU' => [['n', 3], ['c', 13]], + 'LV' => [['a', 4], ['c', 13]], + 'MC' => [['n', 5], ['n', 5], ['c', 11], ['n', 2]], + 'MD' => [['c', 2], ['c', 18]], + 'ME' => [['n', 3], ['n', 13], ['n', 2]], + 'MK' => [['n', 3], ['c', 10], ['n', 2]], + 'MR' => [['n', 5], ['n', 5], ['n', 11], ['n', 2]], + 'MT' => [['a', 4], ['n', 5], ['c', 18]], + 'MU' => [['a', 4], ['n', 2], ['n', 2], ['n', 12], ['n', 3], ['a', 3]], + 'NL' => [['a', 4], ['n', 10]], + 'NO' => [['n', 4], ['n', 6], ['n', 1]], + 'PK' => [['a', 4], ['c', 16]], + 'PL' => [['n', 8], ['n', 16]], + 'PS' => [['a', 4], ['c', 21]], + 'PT' => [['n', 4], ['n', 4], ['n', 11], ['n', 2]], + 'RO' => [['a', 4], ['c', 16]], + 'RS' => [['n', 3], ['n', 13], ['n', 2]], + 'SA' => [['n', 2], ['c', 18]], + 'SE' => [['n', 3], ['n', 16], ['n', 1]], + 'SI' => [['n', 5], ['n', 8], ['n', 2]], + 'SK' => [['n', 4], ['n', 6], ['n', 10]], + 'SM' => [['a', 1], ['n', 5], ['n', 5], ['c', 12]], + 'TN' => [['n', 2], ['n', 3], ['n', 13], ['n', 2]], + 'TR' => [['n', 5], ['n', 1], ['c', 16]], + 'VG' => [['a', 4], ['n', 16]], + ]; + + /** + * @return string Returns a credit card vendor name + * + * @example 'MasterCard' + */ + public static function creditCardType() + { + return static::randomElement(static::$cardVendors); + } + + /** + * Returns the String of a credit card number. + * + * @param string $type Supporting any of 'Visa', 'MasterCard', 'American Express', 'Discover' and 'JCB' + * @param bool $formatted Set to true if the output string should contain one separator every 4 digits + * @param string $separator Separator string for formatting card number. Defaults to dash (-). + * + * @return string + * + * @example '4485480221084675' + */ + public static function creditCardNumber($type = null, $formatted = false, $separator = '-') + { + if (null === $type) { + $type = static::creditCardType(); + } + $mask = static::randomElement(static::$cardParams[$type]); + + $number = static::numerify($mask); + $number .= Luhn::computeCheckDigit($number); + + if ($formatted) { + $p1 = substr($number, 0, 4); + $p2 = substr($number, 4, 4); + $p3 = substr($number, 8, 4); + $p4 = substr($number, 12); + $number = $p1 . $separator . $p2 . $separator . $p3 . $separator . $p4; + } + + return $number; + } + + /** + * @param bool $valid True (by default) to get a valid expiration date, false to get a maybe valid date + * + * @return \DateTime + * + * @example 04/13 + */ + public function creditCardExpirationDate($valid = true) + { + if ($valid) { + return $this->generator->dateTimeBetween('now', '36 months'); + } + + return $this->generator->dateTimeBetween('-36 months', '36 months'); + } + + /** + * @param bool $valid True (by default) to get a valid expiration date, false to get a maybe valid date + * @param string $expirationDateFormat + * + * @return string + * + * @example '04/13' + */ + public function creditCardExpirationDateString($valid = true, $expirationDateFormat = null) + { + return $this->creditCardExpirationDate($valid)->format(null === $expirationDateFormat ? static::$expirationDateFormat : $expirationDateFormat); + } + + /** + * @param bool $valid True (by default) to get a valid expiration date, false to get a maybe valid date + * + * @return array + */ + public function creditCardDetails($valid = true) + { + $type = static::creditCardType(); + + return [ + 'type' => $type, + 'number' => static::creditCardNumber($type), + 'name' => $this->generator->name(), + 'expirationDate' => $this->creditCardExpirationDateString($valid), + ]; + } + + /** + * International Bank Account Number (IBAN) + * + * @see http://en.wikipedia.org/wiki/International_Bank_Account_Number + * + * @param string $countryCode ISO 3166-1 alpha-2 country code + * @param string $prefix for generating bank account number of a specific bank + * @param int $length total length without country code and 2 check digits + * + * @return string + */ + public static function iban($countryCode = null, $prefix = '', $length = null) + { + $countryCode = null === $countryCode ? self::randomKey(self::$ibanFormats) : strtoupper($countryCode); + + $format = !isset(static::$ibanFormats[$countryCode]) ? null : static::$ibanFormats[$countryCode]; + + if ($length === null) { + if ($format === null) { + $length = 24; + } else { + $length = 0; + + foreach ($format as $part) { + [$class, $groupCount] = $part; + $length += $groupCount; + } + } + } + + if ($format === null) { + $format = [['n', $length]]; + } + + $expandedFormat = ''; + + foreach ($format as $item) { + [$class, $length] = $item; + $expandedFormat .= str_repeat($class, $length); + } + + $result = $prefix; + $expandedFormat = substr($expandedFormat, strlen($result)); + + foreach (str_split($expandedFormat) as $class) { + switch ($class) { + default: + case 'c': + $result .= Miscellaneous::boolean() ? static::randomDigit() : strtoupper(static::randomLetter()); + + break; + + case 'a': + $result .= strtoupper(static::randomLetter()); + + break; + + case 'n': + $result .= static::randomDigit(); + + break; + } + } + + $checksum = Iban::checksum($countryCode . '00' . $result); + + return $countryCode . $checksum . $result; + } + + /** + * Return the String of a SWIFT/BIC number + * + * @example 'RZTIAT22263' + * + * @see http://en.wikipedia.org/wiki/ISO_9362 + * + * @return string Swift/Bic number + */ + public static function swiftBicNumber() + { + return self::regexify('^([A-Z]){4}([A-Z]){2}([0-9A-Z]){2}([0-9A-Z]{3})?$'); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/Person.php b/vendor/fakerphp/faker/src/Faker/Provider/Person.php new file mode 100644 index 00000000..c11a72bd --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/Person.php @@ -0,0 +1,147 @@ +generator->parse($format); + } + + /** + * @param string|null $gender 'male', 'female' or null for any + * + * @return string + * + * @example 'John' + */ + public function firstName($gender = null) + { + if ($gender === static::GENDER_MALE) { + return static::firstNameMale(); + } + + if ($gender === static::GENDER_FEMALE) { + return static::firstNameFemale(); + } + + return $this->generator->parse(static::randomElement(static::$firstNameFormat)); + } + + /** + * @return string + */ + public static function firstNameMale() + { + return static::randomElement(static::$firstNameMale); + } + + /** + * @return string + */ + public static function firstNameFemale() + { + return static::randomElement(static::$firstNameFemale); + } + + /** + * @example 'Doe' + * + * @return string + */ + public function lastName() + { + return static::randomElement(static::$lastName); + } + + /** + * @example 'Mrs.' + * + * @param string|null $gender 'male', 'female' or null for any + * + * @return string + */ + public function title($gender = null) + { + if ($gender === static::GENDER_MALE) { + return static::titleMale(); + } + + if ($gender === static::GENDER_FEMALE) { + return static::titleFemale(); + } + + return $this->generator->parse(static::randomElement(static::$titleFormat)); + } + + /** + * @example 'Mr.' + * + * @return string + */ + public static function titleMale() + { + return static::randomElement(static::$titleMale); + } + + /** + * @example 'Mrs.' + * + * @return string + */ + public static function titleFemale() + { + return static::randomElement(static::$titleFemale); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/PhoneNumber.php new file mode 100644 index 00000000..515ef57e --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/PhoneNumber.php @@ -0,0 +1,270 @@ +generator->parse(static::randomElement(static::$formats))); + } + + /** + * @example +11134567890 + * + * @return string + */ + public function e164PhoneNumber() + { + return static::numerify($this->generator->parse(static::randomElement(static::$e164Formats))); + } + + /** + * International Mobile Equipment Identity (IMEI) + * + * @see http://en.wikipedia.org/wiki/International_Mobile_Station_Equipment_Identity + * @see http://imei-number.com/imei-validation-check/ + * + * @example '720084494799532' + * + * @return int $imei + */ + public function imei() + { + $imei = (string) static::numerify('##############'); + $imei .= Luhn::computeCheckDigit($imei); + + return $imei; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/Text.php b/vendor/fakerphp/faker/src/Faker/Provider/Text.php new file mode 100644 index 00000000..585d5b5a --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/Text.php @@ -0,0 +1,202 @@ +realTextBetween((int) round($maxNbChars * 0.8), $maxNbChars, $indexSize); + } + + /** + * Generate a text string by the Markov chain algorithm. + * + * Depending on the $maxNbChars, returns a random valid looking text. The algorithm + * generates a weighted table with the specified number of words as the index and the + * possible following words as the value. + * + * @example 'Alice, swallowing down her flamingo, and began by taking the little golden key' + * + * @param int $minNbChars Minimum number of characters the text should contain (maximum: 8) + * @param int $maxNbChars Maximum number of characters the text should contain (minimum: 10) + * @param int $indexSize Determines how many words are considered for the generation of the next word. + * The minimum is 1, and it produces a higher level of randomness, although the + * generated text usually doesn't make sense. Higher index sizes (up to 5) + * produce more correct text, at the price of less randomness. + * + * @return string + */ + public function realTextBetween($minNbChars = 160, $maxNbChars = 200, $indexSize = 2) + { + if ($minNbChars < 1) { + throw new \InvalidArgumentException('minNbChars must be at least 1'); + } + + if ($maxNbChars < 10) { + throw new \InvalidArgumentException('maxNbChars must be at least 10'); + } + + if ($indexSize < 1) { + throw new \InvalidArgumentException('indexSize must be at least 1'); + } + + if ($indexSize > 5) { + throw new \InvalidArgumentException('indexSize must be at most 5'); + } + + if ($minNbChars >= $maxNbChars) { + throw new \InvalidArgumentException('minNbChars must be smaller than maxNbChars'); + } + + $words = $this->getConsecutiveWords($indexSize); + $iterations = 0; + + do { + ++$iterations; + + if ($iterations >= 100) { + throw new \OverflowException(sprintf('Maximum retries of %d reached without finding a valid real text', $iterations)); + } + + $result = $this->generateText($maxNbChars, $words); + } while (static::strlen($result) <= $minNbChars); + + return $result; + } + + /** + * @param int $maxNbChars + * @param array $words + * + * @return string + */ + protected function generateText($maxNbChars, $words) + { + $result = []; + $resultLength = 0; + // take a random starting point + $next = static::randomKey($words); + + while ($resultLength < $maxNbChars && isset($words[$next])) { + // fetch a random word to append + $word = static::randomElement($words[$next]); + + // calculate next index + $currentWords = static::explode($next); + $currentWords[] = $word; + array_shift($currentWords); + $next = static::implode($currentWords); + + // ensure text starts with an uppercase letter + if ($resultLength == 0 && !static::validStart($word)) { + continue; + } + + // append the element + $result[] = $word; + $resultLength += static::strlen($word) + static::$separatorLen; + } + + // remove the element that caused the text to overflow + array_pop($result); + + // build result + $result = static::implode($result); + + return static::appendEnd($result); + } + + protected function getConsecutiveWords($indexSize) + { + if (!isset($this->consecutiveWords[$indexSize])) { + $parts = $this->getExplodedText(); + $words = []; + $index = []; + + for ($i = 0; $i < $indexSize; ++$i) { + $index[] = array_shift($parts); + } + + for ($i = 0, $count = count($parts); $i < $count; ++$i) { + $stringIndex = static::implode($index); + + if (!isset($words[$stringIndex])) { + $words[$stringIndex] = []; + } + $word = $parts[$i]; + $words[$stringIndex][] = $word; + array_shift($index); + $index[] = $word; + } + // cache look up words for performance + $this->consecutiveWords[$indexSize] = $words; + } + + return $this->consecutiveWords[$indexSize]; + } + + protected function getExplodedText() + { + if ($this->explodedText === null) { + $this->explodedText = static::explode(preg_replace('/\s+/u', ' ', static::$baseText)); + } + + return $this->explodedText; + } + + protected static function explode($text) + { + return explode(static::$separator, $text); + } + + protected static function implode($words) + { + return implode(static::$separator, $words); + } + + protected static function strlen($text) + { + return function_exists('mb_strlen') ? mb_strlen($text, 'UTF-8') : strlen($text); + } + + protected static function validStart($word) + { + $isValid = true; + + if (static::$textStartsWithUppercase) { + $isValid = preg_match('/^\p{Lu}/u', $word); + } + + return $isValid; + } + + protected static function appendEnd($text) + { + return preg_replace("/([ ,-:;\x{2013}\x{2014}]+$)/us", '', $text) . '.'; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/UserAgent.php b/vendor/fakerphp/faker/src/Faker/Provider/UserAgent.php new file mode 100644 index 00000000..752df4d3 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/UserAgent.php @@ -0,0 +1,219 @@ +> 8) | (($tLo & 0xff000000) >> 24); + $tMi = (($tMi & 0x00ff) << 8) | (($tMi & 0xff00) >> 8); + $tHi = (($tHi & 0x00ff) << 8) | (($tHi & 0xff00) >> 8); + } + + // apply version number + $tHi &= 0x0fff; + $tHi |= (3 << 12); + + // cast to string + return sprintf( + '%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x', + $tLo, + $tMi, + $tHi, + $csHi, + $csLo, + $byte[10], + $byte[11], + $byte[12], + $byte[13], + $byte[14], + $byte[15], + ); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ar_EG/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/ar_EG/Address.php new file mode 100644 index 00000000..87facaaf --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ar_EG/Address.php @@ -0,0 +1,217 @@ + '02', + 'الإسماعيلية' => '19', + 'أسوان' => '28', + 'أسيوط' => '25', + 'الأقصر' => '29', + 'البحر الأحمر' => '31', + 'البحيرة' => '18', + 'بني سويف' => '22', + 'بورسعيد' => '03', + 'جنوب سيناء' => '35', + 'القاهرة' => '01', + 'الدقهلية' => '12', + 'دمياط' => '11', + 'سوهاج' => '26', + 'السويس' => '04', + 'الشرقية' => '13', + 'شمال سيناء' => '34', + 'الغربية' => '16', + 'الفيوم' => '23', + 'القليوبية' => '14', + 'قنا' => '27', + 'كفر الشيخ' => '15', + 'مطروح' => '33', + 'المنوفية' => '17', + 'المنيا' => '24', + 'الوادي الجديد' => '32', + ]; + + protected static $buildingNumber = ['%####', '%###', '%#']; + + protected static $postcode = ['#####', '#####-####']; + + /** + * @see http://www.nationsonline.org/oneworld/countrynames_arabic.htm + */ + protected static $country = [ + 'الكاريبي', 'أمريكا الوسطى', 'أنتيجوا وبربودا', 'أنجولا', 'أنجويلا', 'أندورا', 'اندونيسيا', 'أورجواي', 'أوروبا', 'أوزبكستان', 'أوغندا', 'أوقيانوسيا', 'أوقيانوسيا النائية', 'أوكرانيا', 'ايران', 'أيرلندا', 'أيسلندا', 'ايطاليا', + 'بابوا غينيا الجديدة', 'باراجواي', 'باكستان', 'بالاو', 'بتسوانا', 'بتكايرن', 'بربادوس', 'برمودا', 'بروناي', 'بلجيكا', 'بلغاريا', 'بليز', 'بنجلاديش', 'بنما', 'بنين', 'بوتان', 'بورتوريكو', 'بوركينا فاسو', 'بوروندي', 'بولندا', 'بوليفيا', 'بولينيزيا', 'بولينيزيا الفرنسية', 'بيرو', + 'تانزانيا', 'تايلند', 'تايوان', 'تركمانستان', 'تركيا', 'ترينيداد وتوباغو', 'تشاد', 'توجو', 'توفالو', 'توكيلو', 'تونجا', 'تونس', 'تيمور الشرقية', + 'جامايكا', 'جبل طارق', 'جرينادا', 'جرينلاند', 'جزر الأنتيل الهولندية', 'جزر الترك وجايكوس', 'جزر القمر', 'جزر الكايمن', 'جزر المارشال', 'جزر الملديف', 'جزر الولايات المتحدة البعيدة الصغيرة', 'جزر أولان', 'جزر سليمان', 'جزر فارو', 'جزر فرجين الأمريكية', 'جزر فرجين البريطانية', 'جزر فوكلاند', 'جزر كوك', 'جزر كوكوس', 'جزر ماريانا الشمالية', 'جزر والس وفوتونا', 'جزيرة الكريسماس', 'جزيرة بوفيه', 'جزيرة مان', 'جزيرة نورفوك', 'جزيرة هيرد وماكدونالد', 'جمهورية افريقيا الوسطى', 'جمهورية التشيك', 'جمهورية الدومينيك', 'جمهورية الكونغو الديمقراطية', 'جمهورية جنوب افريقيا', 'جنوب آسيا', 'جنوب أوروبا', 'جنوب شرق آسيا', 'جنوب وسط آسيا', 'جواتيمالا', 'جوادلوب', 'جوام', 'جورجيا', 'جورجيا الجنوبية وجزر ساندويتش الجنوبية', 'جيبوتي', 'جيرسي', + 'دومينيكا', + 'رواندا', 'روسيا', 'روسيا البيضاء', 'رومانيا', 'روينيون', + 'زامبيا', 'زيمبابوي', + 'ساحل العاج', 'ساموا', 'ساموا الأمريكية', 'سانت بيير وميكولون', 'سانت فنسنت وغرنادين', 'سانت كيتس ونيفيس', 'سانت لوسيا', 'سانت مارتين', 'سانت هيلنا', 'سان مارينو', 'ساو تومي وبرينسيبي', 'سريلانكا', 'سفالبارد وجان مايان', 'سلوفاكيا', 'سلوفينيا', 'سنغافورة', 'سوازيلاند', 'سوريا', 'سورينام', 'سويسرا', 'سيراليون', 'سيشل', + 'شرق آسيا', 'شرق افريقيا', 'شرق أوروبا', 'شمال افريقيا', 'شمال أمريكا', 'شمال أوروبا', 'شيلي', + 'صربيا', 'صربيا والجبل الأسود', + 'طاجكستان', + 'عمان', + 'غامبيا', 'غانا', 'غرب آسيا', 'غرب افريقيا', 'غرب أوروبا', 'غويانا', 'غيانا', 'غينيا', 'غينيا الاستوائية', 'غينيا بيساو', + 'فانواتو', 'فرنسا', 'فلسطين', 'فنزويلا', 'فنلندا', 'فيتنام', 'فيجي', + 'قبرص', 'قرغيزستان', 'قطر', + 'كازاخستان', 'كاليدونيا الجديدة', 'كرواتيا', 'كمبوديا', 'كندا', 'كوبا', 'كوريا الجنوبية', 'كوريا الشمالية', 'كوستاريكا', 'كولومبيا', 'كومنولث الدول المستقلة', 'كيريباتي', 'كينيا', + 'لاتفيا', 'لاوس', 'لبنان', 'لوكسمبورج', 'ليبيا', 'ليبيريا', 'ليتوانيا', 'ليختنشتاين', 'ليسوتو', + 'مارتينيك', 'ماكاو الصينية', 'مالطا', 'مالي', 'ماليزيا', 'مايوت', 'مدغشقر', 'مصر', 'مقدونيا', 'ملاوي', 'منغوليا', 'موريتانيا', 'موريشيوس', 'موزمبيق', 'مولدافيا', 'موناكو', 'مونتسرات', 'ميانمار', 'ميكرونيزيا', 'ميلانيزيا', + 'ناميبيا', 'نورو', 'نيبال', 'نيجيريا', 'نيكاراجوا', 'نيوزيلاندا', 'نيوي', + 'هايتي', 'هندوراس', 'هولندا', 'هونج كونج الصينية', + 'وسط آسيا', 'وسط افريقيا', + ]; + + protected static $cityFormats = [ + '{{cityName}}', + ]; + + protected static $streetNameFormats = [ + '{{streetPrefix}} {{firstName}} {{lastName}}', + ]; + + protected static $streetAddressFormats = [ + '{{buildingNumber}} {{streetName}}', + '{{buildingNumber}} {{streetName}} {{secondaryAddress}}', + ]; + + protected static $addressFormats = [ + "{{streetAddress}}\n{{city}}", + ]; + + protected static $secondaryAddressFormats = ['شقة رقم. ##', 'عمارة رقم ##']; + + /** + * @example 'شرق' + */ + public static function cityPrefix() + { + return static::randomElement(static::$cityPrefix); + } + + /** + * @example 'المعادي' + */ + public static function cityName() + { + return static::randomElement(static::$cityName); + } + + /** + * @example 'شارع' + */ + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + /** + * @example 'شقة رقم. 350' + */ + public static function secondaryAddress() + { + return static::numerify(static::randomElement(static::$secondaryAddressFormats)); + } + + /** + * @example 'الإسكندرية' + */ + public static function governorate() + { + return static::randomKey(static::$governorates); + } + + /** + * @example '01' + * + * @return string + */ + public static function governorateId() + { + return static::randomElement(static::$governorates); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ar_EG/Color.php b/vendor/fakerphp/faker/src/Faker/Provider/ar_EG/Color.php new file mode 100644 index 00000000..c25426a4 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ar_EG/Color.php @@ -0,0 +1,65 @@ +generator->parse($format)); + } + + /** + * @example 'wewebit.jo' + */ + public function domainName() + { + return static::randomElement(static::$lastNameAscii) . '.' . $this->tld(); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ar_EG/Payment.php b/vendor/fakerphp/faker/src/Faker/Provider/ar_EG/Payment.php new file mode 100644 index 00000000..1e2eaaf0 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ar_EG/Payment.php @@ -0,0 +1,16 @@ += 2000 ? 3 : 2; + $fullBirthDate = date('ymd', $randomBirthDateTimestamp); + $governorateId = Address::governorateId(); + $birthRegistrationSequence = mt_rand(1, 500); + + if ($gender === static::GENDER_MALE) { + $birthRegistrationSequence = $birthRegistrationSequence | 1; // Convert to the nearest odd number + } elseif ($gender === static::GENDER_FEMALE) { + $birthRegistrationSequence = $birthRegistrationSequence & ~1; // Convert to the nearest even number + } + + $birthRegistrationSequence = str_pad((string) $birthRegistrationSequence, 4, '0', STR_PAD_LEFT); + $randomCheckDigit = mt_rand(1, 9); + + return $centuryId . $fullBirthDate . $governorateId . $birthRegistrationSequence . $randomCheckDigit; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ar_EG/Text.php b/vendor/fakerphp/faker/src/Faker/Provider/ar_EG/Text.php new file mode 100644 index 00000000..099c408a --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ar_EG/Text.php @@ -0,0 +1,31 @@ +generator->parse($format)); + } + + /** + * @example 'wewebit.jo' + */ + public function domainName() + { + return static::randomElement(static::$lastNameAscii) . '.' . $this->tld(); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ar_JO/Person.php b/vendor/fakerphp/faker/src/Faker/Provider/ar_JO/Person.php new file mode 100644 index 00000000..27db4e54 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ar_JO/Person.php @@ -0,0 +1,108 @@ +generator->parse($format)); + } + + /** + * @example 'wewebit.jo' + */ + public function domainName() + { + return static::randomElement(static::$lastNameAscii) . '.' . $this->tld(); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ar_SA/Payment.php b/vendor/fakerphp/faker/src/Faker/Provider/ar_SA/Payment.php new file mode 100644 index 00000000..a09a281d --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ar_SA/Payment.php @@ -0,0 +1,22 @@ +generator->parse(static::randomElement(static::$lastNameFormat)); + } + + public static function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + public static function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/bg_BG/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/bg_BG/PhoneNumber.php new file mode 100644 index 00000000..22051df4 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/bg_BG/PhoneNumber.php @@ -0,0 +1,20 @@ +generator->parse($format)); + } + + /** + * Generates valid czech IČO + * + * @see http://phpfashion.com/jak-overit-platne-ic-a-rodne-cislo + * + * @return string + */ + public function ico() + { + $ico = static::numerify('#######'); + $split = str_split($ico); + $prod = 0; + + foreach ([8, 7, 6, 5, 4, 3, 2] as $i => $p) { + $prod += $p * $split[$i]; + } + $mod = $prod % 11; + + if ($mod === 0 || $mod === 10) { + return "{$ico}1"; + } + + if ($mod === 1) { + return "{$ico}0"; + } + + return $ico . (11 - $mod); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/cs_CZ/DateTime.php b/vendor/fakerphp/faker/src/Faker/Provider/cs_CZ/DateTime.php new file mode 100644 index 00000000..e136e651 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/cs_CZ/DateTime.php @@ -0,0 +1,65 @@ +format('w')]; + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * + * @return string + * + * @example '2' + */ + public static function dayOfMonth($max = 'now') + { + return static::dateTime($max)->format('j'); + } + + /** + * Full date with inflected month + * + * @return string + * + * @example '16. listopadu 2003' + */ + public function formattedDate() + { + $format = static::randomElement(static::$formattedDateFormat); + + return $this->generator->parse($format); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/cs_CZ/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/cs_CZ/Internet.php new file mode 100644 index 00000000..ce5b2661 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/cs_CZ/Internet.php @@ -0,0 +1,9 @@ +generator->boolean() ? static::GENDER_MALE : static::GENDER_FEMALE; + } + + $startTimestamp = strtotime(sprintf('-%d year', $maxAge)); + $endTimestamp = strtotime(sprintf('-%d year', $minAge)); + $randTimestamp = self::numberBetween($startTimestamp, $endTimestamp); + + $year = (int) (date('Y', $randTimestamp)); + $month = (int) (date('n', $randTimestamp)); + $day = (int) (date('j', $randTimestamp)); + $suffix = self::numberBetween(0, 999); + + // women has +50 to month + if ($gender == static::GENDER_FEMALE) { + $month += 50; + } + + // from year 2004 everyone has +20 to month when birth numbers in one day are exhausted + if ($year >= 2004 && $this->generator->boolean(10)) { + $month += 20; + } + + $birthNumber = sprintf('%02d%02d%02d%03d', $year % 100, $month, $day, $suffix); + + // from year 1954 birth number includes CRC + if ($year >= 1954) { + $crc = intval($birthNumber, 10) % 11; + + if ($crc == 10) { + $crc = 0; + } + $birthNumber .= sprintf('%d', $crc); + } + + // add slash + if ($this->generator->boolean($slashProbability)) { + $birthNumber = substr($birthNumber, 0, 6) . '/' . substr($birthNumber, 6); + } + + return $birthNumber; + } + + public static function birthNumberMale() + { + return static::birthNumber(static::GENDER_MALE); + } + + public static function birthNumberFemale() + { + return static::birthNumber(static::GENDER_FEMALE); + } + + public function title($gender = null) + { + return static::titleMale(); + } + + /** + * replaced by specific unisex Czech title + */ + public static function titleMale() + { + return static::randomElement(static::$title); + } + + /** + * replaced by specific unisex Czech title + */ + public static function titleFemale() + { + return static::titleMale(); + } + + /** + * @param string|null $gender 'male', 'female' or null for any + * + * @example 'Albrecht' + */ + public function lastName($gender = null) + { + if ($gender === static::GENDER_MALE) { + return static::lastNameMale(); + } + + if ($gender === static::GENDER_FEMALE) { + return static::lastNameFemale(); + } + + return $this->generator->parse(static::randomElement(static::$lastNameFormat)); + } + + public static function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + public static function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/cs_CZ/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/cs_CZ/PhoneNumber.php new file mode 100644 index 00000000..a527a254 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/cs_CZ/PhoneNumber.php @@ -0,0 +1,14 @@ +format('dmy'), static::numerify('%###')); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/da_DK/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/da_DK/PhoneNumber.php new file mode 100644 index 00000000..6e8c28da --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/da_DK/PhoneNumber.php @@ -0,0 +1,18 @@ +format('dmy'); + + do { + $consecutiveNumber = (string) self::numberBetween(100, 999); + + $verificationNumber = ( + (int) $consecutiveNumber[0] * 3 + + (int) $consecutiveNumber[1] * 7 + + (int) $consecutiveNumber[2] * 9 + + (int) $birthDateString[0] * 5 + + (int) $birthDateString[1] * 8 + + (int) $birthDateString[2] * 4 + + (int) $birthDateString[3] * 2 + + (int) $birthDateString[4] * 1 + + (int) $birthDateString[5] * 6 + ) % 11; + } while ($verificationNumber == 10); + + return sprintf('%s%s%s', $consecutiveNumber, $verificationNumber, $birthDateString); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/de_AT/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/de_AT/PhoneNumber.php new file mode 100644 index 00000000..00fbe676 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/de_AT/PhoneNumber.php @@ -0,0 +1,23 @@ + 'Aargau'], + ['AI' => 'Appenzell Innerrhoden'], + ['AR' => 'Appenzell Ausserrhoden'], + ['BE' => 'Bern'], + ['BL' => 'Basel-Landschaft'], + ['BS' => 'Basel-Stadt'], + ['FR' => 'Freiburg'], + ['GE' => 'Genf'], + ['GL' => 'Glarus'], + ['GR' => 'Graubünden'], + ['JU' => 'Jura'], + ['LU' => 'Luzern'], + ['NE' => 'Neuenburg'], + ['NW' => 'Nidwalden'], + ['OW' => 'Obwalden'], + ['SG' => 'St. Gallen'], + ['SH' => 'Schaffhausen'], + ['SO' => 'Solothurn'], + ['SZ' => 'Schwyz'], + ['TG' => 'Thurgau'], + ['TI' => 'Tessin'], + ['UR' => 'Uri'], + ['VD' => 'Waadt'], + ['VS' => 'Wallis'], + ['ZG' => 'Zug'], + ['ZH' => 'Zürich'], + ]; + + protected static $country = [ + 'Afghanistan', 'Alandinseln', 'Albanien', 'Algerien', 'Amerikanisch-Ozeanien', 'Amerikanisch-Samoa', 'Amerikanische Jungferninseln', 'Andorra', 'Angola', 'Anguilla', 'Antarktis', 'Antigua und Barbuda', 'Argentinien', 'Armenien', 'Aruba', 'Aserbaidschan', 'Australien', 'Ägypten', 'Äquatorialguinea', 'Äthiopien', 'Äusseres Ozeanien', + 'Bahamas', 'Bahrain', 'Bangladesch', 'Barbados', 'Belarus', 'Belgien', 'Belize', 'Benin', 'Bermuda', 'Bhutan', 'Bolivien', 'Bosnien und Herzegowina', 'Botsuana', 'Bouvetinsel', 'Brasilien', 'Britische Jungferninseln', 'Britisches Territorium im Indischen Ozean', 'Brunei Darussalam', 'Bulgarien', 'Burkina Faso', 'Burundi', + 'Chile', 'China', 'Cookinseln', 'Costa Rica', 'Côte d’Ivoire', + 'Demokratische Republik Kongo', 'Demokratische Volksrepublik Korea', 'Deutschland', 'Dominica', 'Dominikanische Republik', 'Dschibuti', 'Dänemark', + 'Ecuador', 'El Salvador', 'Eritrea', 'Estland', 'Europäische Union', + 'Falklandinseln', 'Fidschi', 'Finnland', 'Frankreich', 'Französisch-Guayana', 'Französisch-Polynesien', 'Französische Süd- und Antarktisgebiete', 'Färöer', + 'Gabun', 'Gambia', 'Georgien', 'Ghana', 'Gibraltar', 'Grenada', 'Griechenland', 'Grönland', 'Guadeloupe', 'Guam', 'Guatemala', 'Guernsey', 'Guinea', 'Guinea-Bissau', 'Guyana', + 'Haiti', 'Heard- und McDonald-Inseln', 'Honduras', + 'Indien', 'Indonesien', 'Irak', 'Iran', 'Irland', 'Island', 'Isle of Man', 'Israel', 'Italien', + 'Jamaika', 'Japan', 'Jemen', 'Jersey', 'Jordanien', + 'Kaimaninseln', 'Kambodscha', 'Kamerun', 'Kanada', 'Kap Verde', 'Kasachstan', 'Katar', 'Kenia', 'Kirgisistan', 'Kiribati', 'Kokosinseln', 'Kolumbien', 'Komoren', 'Kongo', 'Kroatien', 'Kuba', 'Kuwait', + 'Laos', 'Lesotho', 'Lettland', 'Libanon', 'Liberia', 'Libyen', 'Liechtenstein', 'Litauen', 'Luxemburg', + 'Madagaskar', 'Malawi', 'Malaysia', 'Malediven', 'Mali', 'Malta', 'Marokko', 'Marshallinseln', 'Martinique', 'Mauretanien', 'Mauritius', 'Mayotte', 'Mazedonien', 'Mexiko', 'Mikronesien', 'Monaco', 'Mongolei', 'Montenegro', 'Montserrat', 'Mosambik', 'Myanmar', + 'Namibia', 'Nauru', 'Nepal', 'Neukaledonien', 'Neuseeland', 'Nicaragua', 'Niederlande', 'Niederländische Antillen', 'Niger', 'Nigeria', 'Niue', 'Norfolkinsel', 'Norwegen', 'Nördliche Marianen', + 'Oman', 'Osttimor', 'Österreich', + 'Pakistan', 'Palau', 'Palästinensische Gebiete', 'Panama', 'Papua-Neuguinea', 'Paraguay', 'Peru', 'Philippinen', 'Pitcairn', 'Polen', 'Portugal', 'Puerto Rico', + 'Republik Korea', 'Republik Moldau', 'Ruanda', 'Rumänien', 'Russische Föderation', 'Réunion', + 'Salomonen', 'Sambia', 'Samoa', 'San Marino', 'Saudi-Arabien', 'Schweden', 'Schweiz', 'Senegal', 'Serbien', 'Serbien und Montenegro', 'Seychellen', 'Sierra Leone', 'Simbabwe', 'Singapur', 'Slowakei', 'Slowenien', 'Somalia', 'Sonderverwaltungszone Hongkong', 'Sonderverwaltungszone Macao', 'Spanien', 'Sri Lanka', 'St. Barthélemy', 'St. Helena', 'St. Kitts und Nevis', 'St. Lucia', 'St. Martin', 'St. Pierre und Miquelon', 'St. Vincent und die Grenadinen', 'Sudan', 'Suriname', 'Svalbard und Jan Mayen', 'Swasiland', 'Syrien', 'São Tomé und Príncipe', 'Südafrika', 'Südgeorgien und die Südlichen Sandwichinseln', + 'Tadschikistan', 'Taiwan', 'Tansania', 'Thailand', 'Togo', 'Tokelau', 'Tonga', 'Trinidad und Tobago', 'Tschad', 'Tschechische Republik', 'Tunesien', 'Turkmenistan', 'Turks- und Caicosinseln', 'Tuvalu', 'Türkei', + 'Uganda', 'Ukraine', 'Unbekannte oder ungültige Region', 'Ungarn', 'Uruguay', 'Usbekistan', + 'Vanuatu', 'Vatikanstadt', 'Venezuela', 'Vereinigte Arabische Emirate', 'Vereinigte Staaten', 'Vereinigtes Königreich', 'Vietnam', + 'Wallis und Futuna', 'Weihnachtsinsel', 'Westsahara', + 'Zentralafrikanische Republik', 'Zypern', + ]; + + protected static $cityFormats = [ + '{{cityName}}', + ]; + + protected static $streetNameFormats = [ + '{{lastName}}{{streetSuffixShort}}', + '{{cityName}}{{streetSuffixShort}}', + '{{firstName}}-{{lastName}}-{{streetSuffixLong}}', + ]; + + protected static $streetAddressFormats = [ + '{{streetName}} {{buildingNumber}}', + ]; + protected static $addressFormats = [ + "{{streetAddress}}\n{{postcode}} {{city}}", + ]; + + /** + * Returns a random city name. + * + * @example Luzern + * + * @return string + */ + public function cityName() + { + return static::randomElement(static::$cityNames); + } + + /** + * Returns a random street suffix. + * + * @example str. + * + * @return string + */ + public function streetSuffixShort() + { + return static::randomElement(static::$streetSuffixShort); + } + + /** + * Returns a random street suffix. + * + * @example Strasse + * + * @return string + */ + public function streetSuffixLong() + { + return static::randomElement(static::$streetSuffixLong); + } + + /** + * Returns a canton + * + * @example array('BE' => 'Bern') + * + * @return array + */ + public static function canton() + { + return static::randomElement(static::$canton); + } + + /** + * Returns the abbreviation of a canton. + * + * @return string + */ + public static function cantonShort() + { + $canton = static::canton(); + + return key($canton); + } + + /** + * Returns the name of canton. + * + * @return string + */ + public static function cantonName() + { + $canton = static::canton(); + + return current($canton); + } + + public static function buildingNumber() + { + return static::regexify(self::numerify(static::randomElement(static::$buildingNumber))); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/de_CH/Company.php b/vendor/fakerphp/faker/src/Faker/Provider/de_CH/Company.php new file mode 100644 index 00000000..ead2781e --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/de_CH/Company.php @@ -0,0 +1,15 @@ + + */ + protected static $areaCodeRegexes = [ + 2 => '(0[0-389]|0[4-6][1-68]|1[124]|1[0-9][0-9]|2[18]|2[0-9][1-9]|3[14]|3[0-35-9][0-9]|4[1]|4[02-8][0-9]|5[1]|5[02-9][0-9]|6[1]|6[02-9][0-9]|7[1]|7[2-7][0-9]|8[1]|8[02-7][0-9]|9[1]|9[02-9][0-9])', + 3 => '(0|3[15]|3[02-46-9][1-9]|3[02-46-9][02-9][0-9]|4[015]|4[2-4679][1-8]|4[2-4679][02-9][0-9]|5[15]|5[02-46-9][1-9]|5[02-46-9][02-9][0-9]|6[15]|6[02-46-9][1-9]|6[02-46-9][02-9][0-9]|7[15]|7[2-467][1-7]|7[2-467][02-689][0-9]|8[15]|8[2-46-8][013-9]|8[2-46-8][02-9][0-9]|9[15]|9[02-46-9][1-9]|9[02-46-9][02-9][0-9])', + 4 => '(0|1[02-9][0-9]|2[1]|2[02-9][0-9]|3[1]|3[02-9][0-9]|4[1]|4[0-9][0-9]|5[1]|5[02-6][0-9]|6[1]|6[02-8][0-9]|7[1]|7[02-79][0-9]|8[1]|8[02-9][0-9]|9[1]|9[02-7][0-9])', + 5 => '(0[2-8][0-9]|1[1]|1[02-9][0-9]|2[1]|2[02-9][1-9]|3[1]|3[02-8][0-9]|4[1]|4[02-9][1-9]|5[1]|5[02-9][0-9]|6[1]|6[02-9][0-9]|7[1]|7[02-7][1-9]|8[1]|8[02-8][0-9]|9[1]|9[0-7][1-9])', + 6 => '(0[02-9][0-9]|1[1]|1[02-9][0-9]|2[1]|2[02-9][0-9]|3[1]|3[02-9][0-9]|4[1]|4[0-8][0-9]|5[1]|5[02-9][0-9]|6[1]|6[2-9][0-9]|7[1]|7[02-8][1-9]|8[1]|8[02-9][1-9]|9)', + 7 => '(0[2-8][1-6]|1[1]|1[2-9][0-9]|2[1]|2[0-7][0-9]|3[1]|3[02-9][0-9]|4[1]|4[0-8][0-9]|5[1]|5[02-8][0-9]|6[1]|6[02-8][0-9]|7[1]|7[02-7][0-9]|8[1]|8[02-5][1-9]|9[1]|9[03-7][0-9])', + 8 => '(0[2-9][0-9]|1[1]|1[02-79][0-9]|2[1]|2[02-9][0-9]|3[1]|3[02-9][0-9]|4[1]|4[02-6][0-9]|5[1]|5[02-9][0-9]|6[1]|6[2-8][0-9]|7[1]|7[02-8][1-9]|8[1]|8[02-6][0-9]|9)', + 9 => '(0[6]|0[07-9][0-9]|1[1]|1[02-9][0-9]|2[1]|2[02-9][0-9]|3[1]|3[02-9][0-9]|4[1]|4[02-9][0-9]|5[1]|5[02-7][0-9]|6[1]|6[02-8][1-9]|7[1]|7[02-467][0-9]|8[1]|8[02-7][0-9]|9[1]|9[02-7][0-9])', + ]; + + /** + * @see https://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers#Germany + * @see https://www.itu.int/oth/T0202000051/en + * @see https://en.wikipedia.org/wiki/Telephone_numbers_in_Germany + */ + protected static $formats = [ + // International format + '+49 {{areaCode}} #######', + '+49 {{areaCode}} ### ####', + '+49 (0{{areaCode}}) #######', + '+49 (0{{areaCode}}) ### ####', + '+49{{areaCode}}#######', + '+49{{areaCode}}### ####', + + // Standard formats + '0{{areaCode}} ### ####', + '0{{areaCode}} #######', + '(0{{areaCode}}) ### ####', + '(0{{areaCode}}) #######', + ]; + + protected static $e164Formats = [ + '+49{{areaCode}}#######', + ]; + + /** + * @see https://en.wikipedia.org/wiki/Toll-free_telephone_number + */ + protected static $tollFreeAreaCodes = [ + 800, + ]; + + protected static $tollFreeFormats = [ + // Standard formats + '0{{tollFreeAreaCode}} ### ####', + '(0{{tollFreeAreaCode}}) ### ####', + '+49{{tollFreeAreaCode}} ### ####', + ]; + + public function tollFreeAreaCode() + { + return self::randomElement(static::$tollFreeAreaCodes); + } + + public function tollFreePhoneNumber() + { + $format = self::randomElement(static::$tollFreeFormats); + + return self::numerify($this->generator->parse($format)); + } + + protected static $mobileCodes = [ + 1511, 1512, 1514, 1515, 1516, 1517, + 1520, 1521, 1522, 1523, 1525, 1526, 1529, + 1570, 1573, 1575, 1577, 1578, 1579, + 1590, + ]; + + protected static $mobileFormats = [ + '+49{{mobileCode}}#######', + '+49 {{mobileCode}} ### ####', + '0{{mobileCode}}#######', + '0{{mobileCode}} ### ####', + '0 {{mobileCode}} ### ####', + ]; + + /** + * @see https://en.wikipedia.org/wiki/List_of_dialling_codes_in_Germany + * + * @return string + */ + public static function areaCode() + { + $firstDigit = self::numberBetween(2, 9); + + return $firstDigit . self::regexify(self::$areaCodeRegexes[$firstDigit]); + } + + /** + * Generate a code for a mobile number. + * + * @internal Used to generate mobile numbers. + * + * @return string + */ + public static function mobileCode() + { + return static::randomElement(static::$mobileCodes); + } + + /** + * Generate a mobile number. + * + * @example A mobile number: '015111234567' + * @example A mobile number with spaces: '01511 123 4567' + * @example A mobile number with international code prefix: '+4915111234567' + * @example A mobile number with international code prefix and spaces: '+49 1511 123 4567' + * + * @return string + */ + public function mobileNumber() + { + return ltrim(static::numerify($this->generator->parse( + static::randomElement(static::$mobileFormats), + ))); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/de_DE/Text.php b/vendor/fakerphp/faker/src/Faker/Provider/de_DE/Text.php new file mode 100644 index 00000000..55ed5a55 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/de_DE/Text.php @@ -0,0 +1,2038 @@ +generator->parse(static::randomElement(static::$lastNameFormat)); + } + + /** + * @example 'Θεοδωρόπουλος' + */ + public static function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + /** + * @example 'Κοκκίνου' + */ + public static function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/el_GR/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/el_GR/PhoneNumber.php new file mode 100644 index 00000000..53032487 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/el_GR/PhoneNumber.php @@ -0,0 +1,324 @@ +generator->parse( + static::randomElement(static::$fixedLineFormats), + ))); + } + + /** + * Generate a code for a mobile number. + * + * @internal Used to generate mobile numbers. + * + * @return string + */ + public static function mobileCode() + { + return static::randomElement(static::$mobileCodes); + } + + /** + * Generate a mobile number. + * + * @example A mobile number: '6901234567' + * @example A mobile number with spaces: '690 123 4567' + * @example A mobile number with international code prefix: '+306901234567' + * @example A mobile number with international code prefix and spaces: '+30 690 123 4567' + * + * @return string + */ + public function mobileNumber() + { + return ltrim(static::numerify($this->generator->parse( + static::randomElement(static::$mobileFormats), + ))); + } + + /** + * @deprecated Use PhoneNumber::mobileNumber() instead. + */ + public static function mobilePhoneNumber() + { + return static::numerify( + strtr(static::randomElement(static::$mobileFormats), [ + '{{internationalCodePrefix}}' => static::internationalCodePrefix(), + '{{mobileCode}}' => static::mobileCode(), + ]), + ); + } + + /** + * Generate a personal number. + * + * @example A personal number: '7012345678' + * @example A personal number with spaces: '70 1234 5678' + * @example A personal number with international code prefix: '+307012345678' + * @example A personal number with international code prefix and spaces: '+30 70 1234 5678' + * + * @return string + */ + public function personalNumber() + { + return ltrim(static::numerify($this->generator->parse( + static::randomElement(static::$personalFormats), + ))); + } + + /** + * Generate a toll-free number. + * + * @example A toll-free number: '8001234567' + * @example A toll-free number with spaces: '800 123 4567' + * @example A toll-free number with international code prefix: '+308001234567' + * @example A toll-free number with international code prefix and spaces: '+30 800 123 4567' + * + * @return string + */ + public static function tollFreeNumber() + { + return ltrim(static::numerify( + strtr(static::randomElement(static::$tollFreeFormats), [ + '{{internationalCodePrefix}}' => static::internationalCodePrefix(), + ]), + )); + } + + /** + * Generate a code for a shared-cost number. + * + * @internal Used to generate shared-cost numbers. + * + * @return string + */ + public static function sharedCostCode() + { + return static::randomElement(static::$sharedCostCodes); + } + + /** + * Generate a shared-cost number. + * + * @example A shared-cost number: '8011234567' + * @example A shared-cost number with spaces: '801 123 4567' + * @example A shared-cost number with international code prefix: '+308011234567' + * @example A shared-cost number with international code prefix and spaces: '+30 801 123 4567' + * + * @return string + */ + public function sharedCostNumber() + { + return ltrim(static::numerify($this->generator->parse( + static::randomElement(static::$sharedCostFormats), + ))); + } + + /** + * Generate a code for a premium-rate number. + * + * @internal Used to generate premium-rate numbers. + * + * @return string + */ + public static function premiumRateCode() + { + return static::randomElement(static::$premiumRateCodes); + } + + /** + * Generate a premium-rate number. + * + * @example A premium-rate number: '9011234567' + * @example A premium-rate number with spaces: '901 123 4567' + * @example A premium-rate number with international code prefix: '+309011234567' + * @example A premium-rate number with international code prefix and spaces: '+30 901 123 4567' + * + * @return string + */ + public function premiumRateNumber() + { + return ltrim(static::numerify($this->generator->parse( + static::randomElement(static::$premiumRateFormats), + ))); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/el_GR/Text.php b/vendor/fakerphp/faker/src/Faker/Provider/el_GR/Text.php new file mode 100644 index 00000000..f4be7606 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/el_GR/Text.php @@ -0,0 +1,2582 @@ + 0) { + $sum -= 97; + } + $sum = $sum * -1; + + return str_pad((string) $sum, 2, '0', STR_PAD_LEFT); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/en_GB/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/en_GB/Internet.php new file mode 100644 index 00000000..ef5934ab --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/en_GB/Internet.php @@ -0,0 +1,9 @@ +generator->parse(static::randomElement(static::$towns)); + } + + public function syllable() + { + return static::randomElement(static::$syllables); + } + + public function direction() + { + return static::randomElement(static::$directions); + } + + public function englishStreetName() + { + return static::randomElement(static::$englishStreetNames); + } + + public function villageSuffix() + { + return static::randomElement(static::$villageSuffixes); + } + + public function estateSuffix() + { + return static::randomElement(static::$estateSuffixes); + } + + public function village() + { + return $this->generator->parse(static::randomElement(static::$villageNameFormats)); + } + + public function estate() + { + return $this->generator->parse(static::randomElement(static::$estateNameFormats)); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/en_HK/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/en_HK/Internet.php new file mode 100644 index 00000000..2de48a53 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/en_HK/Internet.php @@ -0,0 +1,14 @@ +generator->parse(static::randomElement(static::$societyNameFormat)); + } + + /** + * @example Mumbai + */ + public function city() + { + return static::randomElement(static::$city); + } + + /** + * @example Vaishali Nagar + */ + public function locality() + { + return $this->generator->parse(static::randomElement(static::$localityFormats)); + } + + /** + * @example Kharadi + */ + public function localityName() + { + return $this->generator->parse(static::randomElement(static::$localityName)); + } + + /** + * @example Nagar + */ + public function areaSuffix() + { + return static::randomElement(static::$areaSuffix); + } + + /** + * @example 'Delhi' + */ + public static function state() + { + return static::randomElement(static::$state); + } + + /** + * @example 'DL' + */ + public static function stateAbbr() + { + return static::randomElement(static::$stateAbbr); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/en_IN/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/en_IN/Internet.php new file mode 100644 index 00000000..a5435352 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/en_IN/Internet.php @@ -0,0 +1,9 @@ +format('y'); + $checksumArr = ['J', 'Z', 'I', 'H', 'G', 'F', 'E', 'D', 'C', 'B', 'A']; + } + + $length = count($weights); + + for ($i = strlen($result); $i < $length; ++$i) { + $result .= static::randomDigit(); + } + + $checksum = in_array($prefix, ['G', 'T'], true) ? 4 : 0; + + for ($i = 0; $i < $length; ++$i) { + $checksum += (int) $result[$i] * $weights[$i]; + } + + return $prefix . $result . $checksumArr[$checksum % 11]; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/en_SG/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/en_SG/PhoneNumber.php new file mode 100644 index 00000000..f5e3ca6b --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/en_SG/PhoneNumber.php @@ -0,0 +1,105 @@ +generator->parse($format)); + } + + public function fixedLineNumber() + { + $format = static::randomElement(static::$fixedLineNumberFormats); + + return static::numerify($this->generator->parse($format)); + } + + public function voipNumber() + { + $format = static::randomElement(static::$voipNumber); + + return static::numerify($this->generator->parse($format)); + } + + public function internationalCodePrefix() + { + return static::randomElement(static::$internationalCodePrefix); + } + + public function zeroToEight() + { + return static::randomElement(static::$zeroToEight); + } + + public function oneToEight() + { + return static::randomElement(static::$oneToEight); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/en_UG/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/en_UG/Address.php new file mode 100644 index 00000000..9024b8b7 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/en_UG/Address.php @@ -0,0 +1,101 @@ + + */ + protected static $areaCodeRegexes = [ + 2 => '(0[1-35-9]|1[02-9]|2[03-589]|3[149]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])', + 3 => '(0[1-57-9]|1[02-9]|2[0135]|3[0-24679]|4[167]|5[12]|6[014]|8[056])', + 4 => '(0[124-9]|1[02-579]|2[3-5]|3[0245]|4[0235]|58|6[39]|7[0589]|8[04])', + 5 => '(0[1-57-9]|1[0235-8]|20|3[0149]|4[01]|5[19]|6[1-47]|7[013-5]|8[056])', + 6 => '(0[1-35-9]|1[024-9]|2[03689]|[34][016]|5[017]|6[0-279]|78|8[0-29])', + 7 => '(0[1-46-8]|1[2-9]|2[04-7]|3[1247]|4[037]|5[47]|6[02359]|7[02-59]|8[156])', + 8 => '(0[1-68]|1[02-8]|2[08]|3[0-28]|4[3578]|5[046-9]|6[02-5]|7[028])', + 9 => '(0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[0179]|5[12469]|7[0-389]|8[04-69])', + ]; + + /** + * @see https://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers#United_States.2C_Canada.2C_and_other_NANP_countries + */ + protected static $formats = [ + // International format + '+1-{{areaCode}}-{{exchangeCode}}-####', + '+1 ({{areaCode}}) {{exchangeCode}}-####', + '+1-{{areaCode}}-{{exchangeCode}}-####', + '+1.{{areaCode}}.{{exchangeCode}}.####', + '+1{{areaCode}}{{exchangeCode}}####', + + // Standard formats + '{{areaCode}}-{{exchangeCode}}-####', + '({{areaCode}}) {{exchangeCode}}-####', + '1-{{areaCode}}-{{exchangeCode}}-####', + '{{areaCode}}.{{exchangeCode}}.####', + + '{{areaCode}}-{{exchangeCode}}-####', + '({{areaCode}}) {{exchangeCode}}-####', + '1-{{areaCode}}-{{exchangeCode}}-####', + '{{areaCode}}.{{exchangeCode}}.####', + ]; + + protected static $formatsWithExtension = [ + '{{areaCode}}-{{exchangeCode}}-#### x###', + '({{areaCode}}) {{exchangeCode}}-#### x###', + '1-{{areaCode}}-{{exchangeCode}}-#### x###', + '{{areaCode}}.{{exchangeCode}}.#### x###', + + '{{areaCode}}-{{exchangeCode}}-#### x####', + '({{areaCode}}) {{exchangeCode}}-#### x####', + '1-{{areaCode}}-{{exchangeCode}}-#### x####', + '{{areaCode}}.{{exchangeCode}}.#### x####', + + '{{areaCode}}-{{exchangeCode}}-#### x#####', + '({{areaCode}}) {{exchangeCode}}-#### x#####', + '1-{{areaCode}}-{{exchangeCode}}-#### x#####', + '{{areaCode}}.{{exchangeCode}}.#### x#####', + ]; + + protected static $e164Formats = [ + '+1{{areaCode}}{{exchangeCode}}####', + ]; + + /** + * @see https://en.wikipedia.org/wiki/Toll-free_telephone_number#United_States + */ + protected static $tollFreeAreaCodes = [ + 800, 844, 855, 866, 877, 888, + ]; + protected static $tollFreeFormats = [ + // Standard formats + '{{tollFreeAreaCode}}-{{exchangeCode}}-####', + '({{tollFreeAreaCode}}) {{exchangeCode}}-####', + '1-{{tollFreeAreaCode}}-{{exchangeCode}}-####', + '{{tollFreeAreaCode}}.{{exchangeCode}}.####', + ]; + + public function tollFreeAreaCode() + { + return self::randomElement(static::$tollFreeAreaCodes); + } + + public function tollFreePhoneNumber() + { + $format = self::randomElement(static::$tollFreeFormats); + + return self::numerify($this->generator->parse($format)); + } + + /** + * @return string + * + * @example '555-123-546 x123' + */ + public function phoneNumberWithExtension() + { + return static::numerify($this->generator->parse(static::randomElement(static::$formatsWithExtension))); + } + + /** + * NPA-format area code + * + * @see https://en.wikipedia.org/wiki/North_American_Numbering_Plan#Numbering_system + * + * @return string + */ + public static function areaCode() + { + $firstDigit = self::numberBetween(2, 9); + + return $firstDigit . self::regexify(self::$areaCodeRegexes[$firstDigit]); + } + + /** + * NXX-format central office exchange code + * + * @see https://en.wikipedia.org/wiki/North_American_Numbering_Plan#Numbering_system + * + * @return string + */ + public static function exchangeCode() + { + $digits[] = self::numberBetween(2, 9); + $digits[] = self::randomDigit(); + + if ($digits[1] === 1) { + $digits[] = self::randomDigitNot(1); + } else { + $digits[] = self::randomDigit(); + } + + return implode('', $digits); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/en_US/Text.php b/vendor/fakerphp/faker/src/Faker/Provider/en_US/Text.php new file mode 100644 index 00000000..c15d89d9 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/en_US/Text.php @@ -0,0 +1,3721 @@ +format('Y'), + static::randomNumber(6, true), + static::randomElement(static::$legalEntities), + ); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/en_ZA/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/en_ZA/Internet.php new file mode 100644 index 00000000..c2222276 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/en_ZA/Internet.php @@ -0,0 +1,23 @@ +generator->dateTimeThisCentury(); + } + $birthDateString = $birthdate->format('ymd'); + + switch (strtolower($gender ?: '')) { + case static::GENDER_FEMALE: + $genderDigit = self::numberBetween(0, 4); + + break; + + case static::GENDER_MALE: + $genderDigit = self::numberBetween(5, 9); + + break; + + default: + $genderDigit = self::numberBetween(0, 9); + } + $sequenceDigits = str_pad(self::randomNumber(3), 3, 0, STR_PAD_BOTH); + $citizenDigit = ($citizen === true) ? '0' : '1'; + $raceDigit = self::numberBetween(8, 9); + + $partialIdNumber = $birthDateString . $genderDigit . $sequenceDigits . $citizenDigit . $raceDigit; + + return $partialIdNumber . Luhn::computeCheckDigit($partialIdNumber); + } + + /** + * @see https://en.wikipedia.org/wiki/Driving_licence_in_South_Africa + * + * @return string + */ + public function licenceCode() + { + return static::randomElement(static::$licenceCodes); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/en_ZA/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/en_ZA/PhoneNumber.php new file mode 100644 index 00000000..567631a0 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/en_ZA/PhoneNumber.php @@ -0,0 +1,116 @@ +generator->parse($format)); + } + + public function tollFreeNumber() + { + $format = static::randomElement(static::$specialFormats); + + return self::numerify($this->generator->parse($format)); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/es_AR/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/es_AR/Address.php new file mode 100644 index 00000000..457f8caf --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/es_AR/Address.php @@ -0,0 +1,68 @@ +numberBetween(10000, 100000000); + } + + return $id . $separator . $this->numberBetween(80000000, 100000000); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/es_VE/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/es_VE/PhoneNumber.php new file mode 100644 index 00000000..cfe6438f --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/es_VE/PhoneNumber.php @@ -0,0 +1,29 @@ +generator->parse($format); + } + + /** + * @example 'کد پستی' + */ + public static function postcodePrefix() + { + return static::randomElement(static::$postcodePrefix); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/fa_IR/Company.php b/vendor/fakerphp/faker/src/Faker/Provider/fa_IR/Company.php new file mode 100644 index 00000000..15da3c5a --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/fa_IR/Company.php @@ -0,0 +1,60 @@ +generator->parse($format)); + } + + /** + * @example 'ahmad.ir' + */ + public function domainName() + { + return static::randomElement(static::$lastNameAscii) . '.' . $this->tld(); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/fa_IR/Person.php b/vendor/fakerphp/faker/src/Faker/Provider/fa_IR/Person.php new file mode 100644 index 00000000..546e2a3f --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/fa_IR/Person.php @@ -0,0 +1,210 @@ + 1; --$i) { + $sum += $subNationalCodeString[$count] * ($i); + ++$count; + } + + if (($sum % 11) < 2) { + return $sum % 11; + } + + return 11 - ($sum % 11); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/fa_IR/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/fa_IR/PhoneNumber.php new file mode 100644 index 00000000..a9606d02 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/fa_IR/PhoneNumber.php @@ -0,0 +1,76 @@ + 5) { + throw new \InvalidArgumentException('indexSize must be at most 5'); + } + + $words = $this->getConsecutiveWords($indexSize); + $result = []; + $resultLength = 0; + // take a random starting point + $next = static::randomKey($words); + + while ($resultLength < $maxNbChars && isset($words[$next])) { + // fetch a random word to append + $word = static::randomElement($words[$next]); + + // calculate next index + $currentWords = explode(' ', $next); + + $currentWords[] = $word; + array_shift($currentWords); + $next = implode(' ', $currentWords); + + if ($resultLength == 0 && !preg_match('/^[\x{0600}-\x{06FF}]/u', $word)) { + continue; + } + // append the element + $result[] = $word; + $resultLength += strlen($word) + 1; + } + + // remove the element that caused the text to overflow + array_pop($result); + + // build result + $result = implode(' ', $result); + + return $result . '.'; + } + + /** + * License: Creative Commons Attribution-ShareAlike License + * + * Title: مدیر مدرسه + * Author: جلال آل‌احمد + * Language: Persian + * + * @see http://fa.wikisource.org/wiki/%D9%85%D8%AF%DB%8C%D8%B1_%D9%85%D8%AF%D8%B1%D8%B3%D9%87 + * + * @var string + */ + protected static $baseText = <<<'EOT' +از در که وارد شدم سیگارم دستم بود. زورم آمد سلام کنم. همین طوری دنگم گرفته بود قد باشم. رئیس فرهنگ که اجازه‌ی نشستن داد، نگاهش لحظه‌ای روی دستم مکث کرد و بعد چیزی را که می‌نوشت، تمام کرد و می‌خواست متوجه من بشود که رونویس حکم را روی میزش گذاشته بودم. حرفی نزدیم. رونویس را با کاغذهای ضمیمه‌اش زیر و رو کرد و بعد غبغب انداخت و آرام و مثلاً خالی از عصبانیت گفت: + +- جا نداریم آقا. این که نمی‌شه! هر روز یه حکم می‌دند دست یکی می‌فرستنش سراغ من... دیروز به آقای مدیر کل... + +حوصله‌ی این اباطیل را نداشتم. حرفش را بریدم که: + +- ممکنه خواهش کنم زیر همین ورقه مرقوم بفرمایید؟ + +و سیگارم را توی زیرسیگاری براق روی میزش تکاندم. روی میز، پاک و مرتب بود. درست مثل اتاق همان مهمان‌خانه‌ی تازه‌عروس‌ها. هر چیز به جای خود و نه یک ذره گرد. فقط خاکستر سیگار من زیادی بود. مثل تفی در صورت تازه تراشیده‌ای.... قلم را برداشت و زیر حکم چیزی نوشت و امضا کرد و من از در آمده بودم بیرون. خلاص. تحمل این یکی را نداشتم. با اداهایش. پیدا بود که تازه رئیس شده. زورکی غبغب می‌انداخت و حرفش را آهسته توی چشم آدم می‌زد. انگار برای شنیدنش گوش لازم نیست. صد و پنجاه تومان در کارگزینی کل مایه گذاشته بودم تا این حکم را به امضا رسانده بودم. توصیه هم برده بودم و تازه دو ماه هم دویده بودم. مو، لای درزش نمی‌رفت. می‌دانستم که چه او بپذیرد، چه نپذیرد، کار تمام است. خودش هم می‌دانست. حتماً هم دستگیرش شد که با این نک و نالی که می‌کرد، خودش را کنف کرده. ولی کاری بود و شده بود. در کارگزینی کل، سفارش کرده بودند که برای خالی نبودن عریضه رونویس را به رؤیت رئیس فرهنگ هم برسانم تازه این طور شد. و گر نه بالی حکم کارگزینی کل چه کسی می‌توانست حرفی بزند؟ یک وزارت خانه بود و یک کارگزینی! شوخی که نبود. ته دلم قرص‌تر از این‌ها بود که محتاج به این استدلال‌ها باشم. اما به نظرم همه‌ی این تقصیرها از این سیگار لعنتی بود که به خیال خودم خواسته بودم خرجش را از محل اضافه حقوق شغل جدیدم در بیاورم. البته از معلمی، هم اُقم نشسته بود. ده سال «الف.ب.» درس دادن و قیافه‌های بهت‌زده‌ی بچه‌های مردم برای مزخرف‌ترین چرندی که می‌گویی... و استغناء با غین و استقراء با قاف و خراسانی و هندی و قدیمی‌ترین شعر دری و صنعت ارسال مثل و ردالعجز... و از این مزخرفات! دیدم دارم خر می‌شوم. گفتم مدیر بشوم. مدیر دبستان! دیگر نه درس خواهم داد و نه مجبور خواهم بود برای فرار از اتلاف وقت، در امتحان تجدیدی به هر احمق بی‌شعوری هفت بدهم تا ایام آخر تابستانم را که لذیذترین تکه‌ی تعطیلات است، نجات داده باشم. این بود که راه افتادم. رفتم و از اهلش پرسیدم. از یک کار چاق کن. دستم را توی دست کارگزینی گذاشت و قول و قرار و طرفین خوش و خرم و یک روز هم نشانی مدرسه را دستم دادند که بروم وارسی، که باب میلم هست یا نه. + +و رفتم. مدرسه دو طبقه بود و نوساز بود و در دامنه‌ی کوه تنها افتاده بود و آفتاب‌رو بود. یک فرهنگ‌دوست خرپول، عمارتش را وسط زمین خودش ساخته بود و بیست و پنج سال هم در اختیار فرهنگ گذاشته بود که مدرسه‌اش کنند و رفت و آمد بشود و جاده‌ها کوبیده بشود و این قدر ازین بشودها بشود، تا دل ننه باباها بسوزد و برای این‌که راه بچه‌هاشان را کوتاه بکنند، بیایند همان اطراف مدرسه را بخرند و خانه بسازند و زمین یارو از متری یک عباسی بشود صد تومان. یارو اسمش را هم روی دیوار مدرسه کاشی‌کاری کرده بود. هنوز در و همسایه پیدا نکرده بودند که حرف‌شان بشود و لنگ و پاچه‌ی سعدی و باباطاهر را بکشند میان و یک ورق دیگر از تاریخ‌الشعرا را بکوبند روی نبش دیوار کوچه‌شان. تابلوی مدرسه هم حسابی و بزرگ و خوانا. از صد متری داد می‌زد که توانا بود هر.... هر چه دلتان بخواهد! با شیر و خورشیدش که آن بالا سر، سه پا ایستاده بود و زورکی تعادل خودش را حفظ می‌کرد و خورشید خانم روی کولش با ابروهای پیوسته و قمچیلی که به دست داشت و تا سه تیر پرتاب، اطراف مدرسه بیابان بود. درندشت و بی آب و آبادانی و آن ته رو به شمال، ردیف کاج‌های درهم فرو رفته‌ای که از سر دیوار گلی یک باغ پیدا بود روی آسمان لکه‌ی دراز و تیره‌ای زده بود. حتماً تا بیست و پنج سال دیگر همه‌ی این اطراف پر می‌شد و بوق ماشین و ونگ ونگ بچه‌ها و فریاد لبویی و زنگ روزنامه‌فروشی و عربده‌ی گل به سر دارم خیار! نان یارو توی روغن بود. + +- راستی شاید متری ده دوازده شاهی بیشتر نخریده باشد؟ شاید هم زمین‌ها را همین جوری به ثبت داده باشد؟ هان؟ + +- احمق به توچه؟!... + +بله این فکرها را همان روزی کردم که ناشناس به مدرسه سر زدم و آخر سر هم به این نتیجه رسیدم که مردم حق دارند جایی بخوابند که آب زیرشان نرود. + +- تو اگر مردی، عرضه داشته باش مدیر همین مدرسه هم بشو. + +و رفته بودم و دنبال کار را گرفته بودم تا رسیده بودم به این‌جا. همان روز وارسی فهمیده بودم که مدیر قبلی مدرسه زندانی است. لابد کله‌اش بوی قرمه‌سبزی می‌داده و باز لابد حالا دارد کفاره‌ی گناهانی را می‌دهد که یا خودش نکرده یا آهنگری در بلخ کرده. جزو پر قیچی‌های رئیس فرهنگ هم کسی نبود که با مدیرشان، اضافه حقوقی نصیبش بشود و ناچار سر و دستی برای این کار بشکند. خارج از مرکز هم نداشت. این معلومات را توی کارگزینی به دست آورده بودم. هنوز «گه خوردم نامه‌نویسی» هم مد نشده بود که بگویم یارو به این زودی‌ها از سولدونی در خواهد آمد. فکر نمی‌کردم که دیگری هم برای این وسط بیابان دلش لک زده باشد با زمستان سختش و با رفت و آمد دشوارش. + +این بود که خیالم راحت بود. از همه‌ی این‌ها گذشته کارگزینی کل موافقت کرده بود! دست است که پیش از بلند شدن بوی اسکناس، آن جا هم دو سه تا عیب شرعی و عرفی گرفته بودند و مثلاً گفته بودن لابد کاسه‌ای زیر نیم کاسه است که فلانی یعنی من، با ده سال سابقه‌ی تدریس، می‌خواهد مدیر دبستان بشود! غرض‌شان این بود که لابد خل شدم که از شغل مهم و محترم دبیری دست می‌شویم. ماهی صد و پنجاه تومان حق مقام در آن روزها پولی نبود که بتوانم نادیده بگیرم. و تازه اگر ندیده می‌گرفتم چه؟ باز باید بر می‌گشتم به این کلاس‌ها و این جور حماقت‌ها. این بود که پیش رئیس فرهنگ، صاف برگشتم به کارگزینی کل، سراغ آن که بفهمی نفهمی، دلال کارم بود. و رونویس حکم را گذاشتم و گفتم که چه طور شد و آمدم بیرون. + +دو روز بعد رفتم سراغش. معلوم شد که حدسم درست بوده است و رئیس فرهنگ گفته بوده: «من از این لیسانسه‌های پر افاده نمی‌خواهم که سیگار به دست توی هر اتاقی سر می‌کنند.» + +و یارو برایش گفته بود که اصلاً وابدا..! فلانی همچین و همچون است و مثقالی هفت صنار با دیگران فرق دارد و این هندوانه‌ها و خیال من راحت باشد و پنج‌شنبه یک هفته‌ی دیگر خودم بروم پهلوی او... و این کار را کردم. این بار رئیس فرهنگ جلوی پایم بلند شد که: «ای آقا... چرا اول نفرمودید؟!...» و از کارمندهایش گله کرد و به قول خودش، مرا «در جریان موقعیت محل» گذاشت و بعد با ماشین خودش مرا به مدرسه رساند و گفت زنگ را زودتر از موعد زدند و در حضور معلم‌ها و ناظم، نطق غرایی در خصائل مدیر جدید – که من باشم – کرد و بعد هم مرا گذاشت و رفت با یک مدرسه‌ی شش کلاسه‌ی «نوبنیاد» و یک ناظم و هفت تا معلم و دویست و سی و پنج تا شاگرد. دیگر حسابی مدیر مدرسه شده بودم! + +ناظم، جوان رشیدی بود که بلند حرف می‌زد و به راحتی امر و نهی می‌کرد و بیا و برویی داشت و با شاگردهای درشت، روی هم ریخته بود که خودشان ترتیب کارها را می‌دادند و پیدا بود که به سر خر احتیاجی ندارد و بی‌مدیر هم می‌تواند گلیم مدرسه را از آب بکشد. معلم کلاس چهار خیلی گنده بود. دو تای یک آدم حسابی. توی دفتر، اولین چیزی که به چشم می‌آمد. از آن‌هایی که اگر توی کوچه ببینی، خیال می‌کنی مدیر کل است. لفظ قلم حرف می‌زد و شاید به همین دلیل بود که وقتی رئیس فرهنگ رفت و تشریفات را با خودش برد، از طرف همکارانش تبریک ورود گفت و اشاره کرد به اینکه «ان‌شاءالله زیر سایه‌ی سرکار، سال دیگر کلاس‌های دبیرستان را هم خواهیم داشت.» پیدا بود که این هیکل کم‌کم دارد از سر دبستان زیادی می‌کند! وقتی حرف می‌زد همه‌اش درین فکر بودم که با نان آقا معلمی چه طور می‌شد چنین هیکلی به هم زد و چنین سر و تیپی داشت؟ و راستش تصمیم گرفتم که از فردا صبح به صبح ریشم را بتراشم و یخه‌ام تمیز باشد و اتوی شلوارم تیز. + +معلم کلاس اول باریکه‌ای بود، سیاه سوخته. با ته ریشی و سر ماشین کرده‌ای و یخه‌ی بسته. بی‌کراوات. شبیه میرزابنویس‌های دم پست‌خانه. حتی نوکر باب می‌نمود. و من آن روز نتوانستم بفهمم وقتی حرف می‌زند کجا را نگاه می‌کند. با هر جیغ کوتاهی که می‌زد هرهر می‌خندید. با این قضیه نمی‌شد کاری کرد. معلم کلاس سه، یک جوان ترکه‌ای بود؛ بلند و با صورت استخوانی و ریش از ته تراشیده و یخه‌ی بلند آهاردار. مثل فرفره می‌جنبید. چشم‌هایش برق عجیبی می‌زد که فقط از هوش نبود، چیزی از ناسلامتی در برق چشم‌هایش بود که مرا واداشت از ناظم بپرسم مبادا مسلول باشد. البته مسلول نبود، تنها بود و در دانشگاه درس می‌خواند. کلاس‌های پنجم و ششم را دو نفر با هم اداره می‌کردند. یکی فارسی و شرعیات و تاریخ، جغرافی و کاردستی و این جور سرگرمی‌ها را می‌گفت، که جوانکی بود بریانتین زده، با شلوار پاچه تنگ و پوشت و کراوات زرد و پهنی که نعش یک لنگر بزرگ آن را روی سینه‌اش نگه داشته بود و دائماً دستش حمایل موهای سرش بود و دم به دم توی شیشه‌ها نگاه می‌کرد. و آن دیگری که حساب و مرابحه و چیزهای دیگر می‌گفت، جوانی بود موقر و سنگین مازندرانی به نظر می‌آمد و به خودش اطمینان داشت. غیر از این‌ها، یک معلم ورزش هم داشتیم که دو هفته بعد دیدمش و اصفهانی بود و از آن قاچاق‌ها. + +رئیس فرهنگ که رفت، گرم و نرم از همه‌شان حال و احوال پرسیدم. بعد به همه سیگار تعارف کردم. سراپا همکاری و همدردی بود. از کار و بار هر کدامشان پرسیدم. فقط همان معلم کلاس سه، دانشگاه می‌رفت. آن که لنگر به سینه انداخته بود، شب‌ها انگلیسی می‌خواند که برود آمریکا. چای و بساطی در کار نبود و ربع ساعت‌های تفریح، فقط توی دفتر جمع می‌شدند و دوباره از نو. و این نمی‌شد. باید همه‌ی سنن را رعایت کرد. دست کردم و یک پنج تومانی روی میز گذاشتم و قرار شد قبل و منقلی تهیه کنند و خودشان چای را راه بیندازند. + +بعد از زنگ قرار شد من سر صف نطقی بکنم. ناظم قضیه را در دو سه کلمه برای بچه‌ها گفت که من رسیدم و همه دست زدند. چیزی نداشتم برایشان بگویم. فقط یادم است اشاره‌ای به این کردم که مدیر خیلی دلش می‌خواست یکی از شما را به جای فرزند داشته باشد و حالا نمی‌داند با این همه فرزند چه بکند؟! که بی‌صدا خندیدند و در میان صف‌های عقب یکی پکی زد به خنده. واهمه برم داشت که «نه بابا. کار ساده‌ای هم نیست!» قبلاً فکر کرده بودم که می‌روم و فارغ از دردسر اداره‌ی کلاس، در اتاق را روی خودم می‌بندم و کار خودم را می‌کنم. اما حالا می‌دیدم به این سادگی‌ها هم نیست. اگر فردا یکی‌شان زد سر اون یکی را شکست، اگر یکی زیر ماشین رفت؛ اگر یکی از ایوان افتاد؛ چه خاکی به سرم خواهم ریخت؟ + +حالا من مانده بودم و ناظم که چیزی از لای در آهسته خزید تو. کسی بود؛ فراش مدرسه با قیافه‌ای دهاتی و ریش نتراشیده و قدی کوتاه و گشاد گشاد راه می‌رفت و دست‌هایش را دور از بدن نگه می‌داشت. آمد و همان کنار در ایستاد. صاف توی چشمم نگاه می‌کرد. حال او را هم پرسیدم. هر چه بود او هم می‌توانست یک گوشه‌ی این بار را بگیرد. در یک دقیقه همه‌ی درد دل‌هایش را کرد و التماس دعاهایش که تمام شد، فرستادمش برایم چای درست کند و بیاورد. بعد از آن من به ناظم پرداختم. سال پیش، از دانشسرای مقدماتی در آمده بود. یک سال گرمسار و کرج کار کرده بود و امسال آمده بود این‌جا. پدرش دو تا زن داشته. از اولی دو تا پسر که هر دو تا چاقوکش از آب در آمده‌اند و از دومی فقط او مانده بود که درس‌خوان شده و سرشناس و نان مادرش را می‌دهد که مریض است و از پدر سال‌هاست که خبری نیست و... یک اتاق گرفته‌اند به پنجاه تومان و صد و پنجاه تومان حقوق به جایی نمی‌رسد و تازه زور که بزند سه سال دیگر می‌تواند از حق فنی نظامت مدرسه استفاده کند + +... بعد بلند شدیم که به کلاس‌ها سرکشی کنیم. بعد با ناظم به تک تک کلاس‌ها سر زدیم در این میان من به یاد دوران دبستان خودم افتادم. در کلاس ششم را باز کردیم «... ت بی پدرو مادر» جوانک بریانتین زده خورد توی صورت‌مان. یکی از بچه‌ها صورتش مثل چغندر قرمز بود. لابد بزک فحش هنوز باقی بود. قرائت فارسی داشتند. معلم دستهایش توی جیبش بود و سینه‌اش را پیش داده بود و زبان به شکایت باز کرد: + +- آقای مدیر! اصلاً دوستی سرشون نمی‌شه. تو سَری می‌خوان. ملاحظه کنید بنده با چه صمیمیتی... + +حرفش را در تشدید «ایت» بریدم که: + +- صحیح می‌فرمایید. این بار به من ببخشید. + +و از در آمدیم بیرون. بعد از آن به اطاقی که در آینده مال من بود سر زدیم. بهتر از این نمی‌شد. بی سر و صدا، آفتاب‌رو، دور افتاده. + +وسط حیاط، یک حوض بزرگ بود و کم‌عمق. تنها قسمت ساختمان بود که رعایت حال بچه‌های قد و نیم قد در آن شده بود. دور حیاط دیوار بلندی بود درست مثل دیوار چین. سد مرتفعی در مقابل فرار احتمالی فرهنگ و ته حیاط مستراح و اتاق فراش بغلش و انبار زغال و بعد هم یک کلاس. به مستراح هم سر کشیدیم. همه بی در و سقف و تیغه‌ای میان آن‌ها. نگاهی به ناظم کردم که پا به پایم می‌آمد. گفت: + +- دردسر عجیبی شده آقا. تا حالا صد تا کاغذ به ادارفردا صبح رفتم مدرسه. بچه‌ها با صف‌هاشان به طرف کلاس‌ها می‌رفتند و ناظم چوب به دست توی ایوان ایستاده بود و توی دفتر دو تا از معلم‌ها بودند. معلوم شد کار هر روزه‌شان است. ناظم را هم فرستادم سر یک کلاس دیگر و خودم آمدم دم در مدرسه به قدم زدن؛ فکر کردم از هر طرف که بیایند مرا این ته، دم در مدرسه خواهند دید و تمام طول راه در این خجالت خواهند ماند و دیگر دیر نخواهند آمد. یک سیاهی از ته جاده‌ی جنوبی پیداشد. جوانک بریانتین زده بود. مسلماً او هم مرا می‌دید، ولی آهسته‌تر از آن می‌آمد که یک معلم تأخیر کرده جلوی مدیرش می‌آمد. جلوتر که آمد حتی شنیدم که سوت می‌زد. اما بی‌انصاف چنان سلانه سلانه می‌آمد که دیدم هیچ جای گذشت نیست. اصلاً محل سگ به من نمی‌گذاشت. داشتم از کوره در می‌رفتم که یک مرتبه احساس کردم تغییری در رفتار خود داد و تند کرد. + +به خیر گذشت و گرنه خدا عالم است چه اتفاقی می‌افتاد. سلام که کرد مثل این که می‌خواست چیزی بگوید که پیش دستی کردم: + +- بفرمایید آقا. بفرمایید، بچه‌ها منتظرند. + +واقعاً به خیر گذشت. شاید اتوبوسش دیر کرده. شاید راه‌بندان بوده؛ جاده قرق بوده و باز یک گردن‌کلفتی از اقصای عالم می‌آمده که ازین سفره‌ی مرتضی علی بی‌نصیب نماند. به هر صورت در دل بخشیدمش. چه خوب شد که بد و بی‌راهی نگفتی! که از دور علم افراشته‌ی هیکل معلم کلاس چهارم نمایان شد. از همان ته مرا دیده بود. تقریباً می‌دوید. تحمل این یکی را نداشتم. «بدکاری می‌کنی. اول بسم‌الله و مته به خشخاش!» رفتم و توی دفتر نشستم و خودم را به کاری مشغول کردم که هن هن کنان رسید. چنان عرق از پیشانی‌اش می‌ریخت که راستی خجالت کشیدم. یک لیوان آب از کوه به دستش دادم و مسخ‌شده‌ی خنده‌اش را با آب به خوردش دادم و بلند که شد برود، گفتم: + +- عوضش دو کیلو لاغر شدید. + +برگشت نگاهی کرد و خنده‌ای و رفت. ناگهان ناظم از در وارد شد و از را ه نرسیده گفت: + +- دیدید آقا! این جوری می‌آند مدرسه. اون قرتی که عین خیالش هم نبود آقا! اما این یکی... + +از او پرسیدم: + +- انگار هنوز دو تا از کلاس‌ها ولند؟ + +- بله آقا. کلاس سه ورزش دارند. گفتم بنشینند دیکته بنویسند آقا. معلم حساب پنج و شش هم که نیومده آقا. + +در همین حین یکی از عکس‌های بزرگ دخمه‌های هخامنشی را که به دیوار کوبیده بود پس زد و: + +- نگاه کنید آقا... + +روی گچ دیوار با مداد قرمز و نه چندان درشت، به عجله و ناشیانه علامت داس کشیده بودند. همچنین دنبال کرد: + +- از آثار دوره‌ی اوناست آقا. کارشون همین چیزها بود. روزنومه بفروشند. تبلیغات کنند و داس چکش بکشند آقا. رئیس‌شون رو که گرفتند چه جونی کندم آقا تا حالی‌شون کنم که دست ور دارند آقا. و از روی میز پرید پایین. + +- گفتم مگه باز هم هستند؟ + +- آره آقا، پس چی! یکی همین آقازاده که هنوز نیومده آقا. هر روز نیم ساعت تأخیر داره آقا. یکی هم مثل کلاس سه. + +- خوب چرا تا حالا پاکش نکردی؟ + +- به! آخه آدم درد دلشو واسه‌ی کی بگه؟ آخه آقا در میان تو روی آدم می‌گند جاسوس، مأمور! باهاش حرفم شده آقا. کتک و کتک‌کاری! + +و بعد یک سخنرانی که چه طور مدرسه را خراب کرده‌اند و اعتماد اهل محله را چه طور از بین برده‌اند که نه انجمنی، نه کمکی به بی‌بضاعت‌ها؛ و از این حرف ها. + +بعد از سخنرانی آقای ناظم دستمالم را دادم که آن عکس‌ها را پاک کند و بعد هم راه افتادم که بروم سراغ اتاق خودم. در اتاقم را که باز کردم، داشتم دماغم با بوی خاک نم کشیده‌اش اخت می‌کرد که آخرین معلم هم آمد. آمدم توی ایوان و با صدای بلند، جوری که در تمام مدرسه بشنوند، ناظم را صدا زدم و گفتم با قلم قرمز برای آقا یک ساعت تأخیر بگذارند.ه‌ی ساختمان نوشتیم آقا. می‌گند نمی‌شه پول دولت رو تو ملک دیگرون خرج کرد. + +- گفتم راست می‌گند. + +دیگه کافی بود. آمدیم بیرون. همان توی حیاط تا نفسی تازه کنیم وضع مالی و بودجه و ازین حرف‌های مدرسه را پرسیدم. هر اتاق ماهی پانزده ریال حق نظافت داشت. لوازم‌التحریر و دفترها را هم اداره‌ی فرهنگ می‌داد. ماهی بیست و پنج تومان هم برای آب خوردن داشتند که هنوز وصول نشده بود. برای نصب هر بخاری سالی سه تومان. ماهی سی تومان هم تنخواه‌گردان مدرسه بود که مثل پول آب سوخت شده بود و حالا هم ماه دوم سال بود. اواخر آبان. حالیش کردم که حوصله‌ی این کارها را ندارم و غرضم را از مدیر شدن برایش خلاصه کردم و گفتم حاضرم همه‌ی اختیارات را به او بدهم. «اصلاً انگار که هنوز مدیر نیامده.» مهر مدرسه هم پهلوی خودش باشد. البته او را هنوز نمی‌شناختم. شنیده بودم که مدیرها قبلاً ناظم خودشان را انتخاب می‌کنند، اما من نه کسی را سراغ داشتم و نه حوصله‌اش را. حکم خودم را هم به زور گرفته بودم. سنگ‌هامان را وا کندیم و به دفتر رفتیم و چایی را که فراش از بساط خانه‌اش درست کرده بود، خوردیم تا زنگ را زدند و باز هم زدند و من نگاهی به پرونده‌های شاگردها کردم که هر کدام عبارت بود از دو برگ کاغذ. از همین دو سه برگ کاغذ دانستم که اولیای بچه‌ها اغلب زارع و باغبان و اویارند و قبل از این‌که زنگ آخر را بزنند و مدرسه تعطیل بشود بیرون آمدم. برای روز اول خیلی زیاد بود. + +فردا صبح رفتم مدرسه. بچه‌ها با صف‌هاشان به طرف کلاس‌ها می‌رفتند و ناظم چوب به دست توی ایوان ایستاده بود و توی دفتر دو تا از معلم‌ها بودند. معلوم شد کار هر روزه‌شان است. ناظم را هم فرستادم سر یک کلاس دیگر و خودم آمدم دم در مدرسه به قدم زدن؛ فکر کردم از هر طرف که بیایند مرا این ته، دم در مدرسه خواهند دید و تمام طول راه در این خجالت خواهند ماند و دیگر دیر نخواهند آمد. یک سیاهی از ته جاده‌ی جنوبی پیداشد. جوانک بریانتین زده بود. مسلماً او هم مرا می‌دید، ولی آهسته‌تر از آن می‌آمد که یک معلم تأخیر کرده جلوی مدیرش می‌آمد. جلوتر که آمد حتی شنیدم که سوت می‌زد. اما بی‌انصاف چنان سلانه سلانه می‌آمد که دیدم هیچ جای گذشت نیست. اصلاً محل سگ به من نمی‌گذاشت. داشتم از کوره در می‌رفتم که یک مرتبه احساس کردم تغییری در رفتار خود داد و تند کرد. + +به خیر گذشت و گرنه خدا عالم است چه اتفاقی می‌افتاد. سلام که کرد مثل این که می‌خواست چیزی بگوید که پیش دستی کردم: + +- بفرمایید آقا. بفرمایید، بچه‌ها منتظرند. + +واقعاً به خیر گذشت. شاید اتوبوسش دیر کرده. شاید راه‌بندان بوده؛ جاده قرق بوده و باز یک گردن‌کلفتی از اقصای عالم می‌آمده که ازین سفره‌ی مرتضی علی بی‌نصیب نماند. به هر صورت در دل بخشیدمش. چه خوب شد که بد و بی‌راهی نگفتی! که از دور علم افراشته‌ی هیکل معلم کلاس چهارم نمایان شد. از همان ته مرا دیده بود. تقریباً می‌دوید. تحمل این یکی را نداشتم. «بدکاری می‌کنی. اول بسم‌الله و مته به خشخاش!» رفتم و توی دفتر نشستم و خودم را به کاری مشغول کردم که هن هن کنان رسید. چنان عرق از پیشانی‌اش می‌ریخت که راستی خجالت کشیدم. یک لیوان آب از کوه به دستش دادم و مسخ‌شده‌ی خنده‌اش را با آب به خوردش دادم و بلند که شد برود، گفتم: + +- عوضش دو کیلو لاغر شدید. + +برگشت نگاهی کرد و خنده‌ای و رفت. ناگهان ناظم از در وارد شد و از را ه نرسیده گفت: + +- دیدید آقا! این جوری می‌آند مدرسه. اون قرتی که عین خیالش هم نبود آقا! اما این یکی... + +از او پرسیدم: + +- انگار هنوز دو تا از کلاس‌ها ولند؟ + +- بله آقا. کلاس سه ورزش دارند. گفتم بنشینند دیکته بنویسند آقا. معلم حساب پنج و شش هم که نیومده آقا. + +در همین حین یکی از عکس‌های بزرگ دخمه‌های هخامنشی را که به دیوار کوبیده بود پس زد و: + +- نگاه کنید آقا... + +روی گچ دیوار با مداد قرمز و نه چندان درشت، به عجله و ناشیانه علامت داس کشیده بودند. همچنین دنبال کرد: + +- از آثار دوره‌ی اوناست آقا. کارشون همین چیزها بود. روزنومه بفروشند. تبلیغات کنند و داس چکش بکشند آقا. رئیس‌شون رو که گرفتند چه جونی کندم آقا تا حالی‌شون کنم که دست ور دارند آقا. و از روی میز پرید پایین. + +- گفتم مگه باز هم هستند؟ + +- آره آقا، پس چی! یکی همین آقازاده که هنوز نیومده آقا. هر روز نیم ساعت تأخیر داره آقا. یکی هم مثل کلاس سه. + +- خوب چرا تا حالا پاکش نکردی؟ + +- به! آخه آدم درد دلشو واسه‌ی کی بگه؟ آخه آقا در میان تو روی آدم می‌گند جاسوس، مأمور! باهاش حرفم شده آقا. کتک و کتک‌کاری! + +و بعد یک سخنرانی که چه طور مدرسه را خراب کرده‌اند و اعتماد اهل محله را چه طور از بین برده‌اند که نه انجمنی، نه کمکی به بی‌بضاعت‌ها؛ و از این حرف ها. + +بعد از سخنرانی آقای ناظم دستمالم را دادم که آن عکس‌ها را پاک کند و بعد هم راه افتادم که بروم سراغ اتاق خودم. در اتاقم را که باز کردم، داشتم دماغم با بوی خاک نم کشیده‌اش اخت می‌کرد که آخرین معلم هم آمد. آمدم توی ایوان و با صدای بلند، جوری که در تمام مدرسه بشنوند، ناظم را صدا زدم و گفتم با قلم قرمز برای آقا یک ساعت تأخیر بگذارند. + +روز سوم باز اول وقت مدرسه بودم. هنوز از پشت دیوار نپیچیده بودم که صدای سوز و بریز بچه‌ها به پیشبازم آمد. تند کردم. پنج تا از بچه‌ها توی ایوان به خودشان می‌پیچیدند و ناظم ترکه‌ای به دست داشت و به نوبت به کف دست‌شان می‌زد. بچه‌ها التماس می‌کردند؛ گریه می‌کردند؛ اما دستشان را هم دراز می‌کردند. نزدیک بود داد بزنم یا با لگد بزنم و ناظم را پرت کنم آن طرف. پشتش به من بود و من را نمی‌دید. ناگهان زمزمه‌ای توی صف‌ها افتاد که یک مرتبه مرا به صرافت انداخت که در مقام مدیریت مدرسه، به سختی می‌شود ناظم را کتک زد. این بود که خشمم را فرو خوردم و آرام از پله‌ها رفتم بالا. ناظم، تازه متوجه من شده بود در همین حین دخالتم را کردم و خواهش کردم این بار همه‌شان را به من ببخشند. + +نمی‌دانم چه کار خطایی از آنها سر زده بود که ناظم را تا این حد عصبانی کرده بود. بچه‌ها سکسکه‌کنان رفتند توی صف‌ها و بعد زنگ را زدند و صف‌ها رفتند به کلاس‌ها و دنبالشان هم معلم‌ها که همه سر وقت حاضر بودند. نگاهی به ناظم انداختم که تازه حالش سر جا آمده بود و گفتم در آن حالی که داشت، ممکن بود گردن یک کدامشان را بشکند. که مرتبه براق شد: + +- اگه یک روز جلوشونو نگیرید سوارتون می‌شند آقا. نمی‌دونید چه قاطرهای چموشی شده‌اند آقا. + +مثل بچه مدرسه‌ای‌ها آقا آقا می‌کرد. موضوع را برگرداندم و احوال مادرش را پرسیدم. خنده، صورتش را از هم باز کرد و صدا زد فراش برایش آب بیاورد. یادم هست آن روز نیم ساعتی برای آقای ناظم صحبت کردم. پیرانه. و او جوان بود و زود می‌شد رامش کرد. بعد ازش خواستم که ترکه‌ها را بشکند و آن وقت من رفتم سراغ اتاق خودم. + +در همان هفته‌ی اول به کارها وارد شدم. فردای زمستان و نه تا بخاری زغال سنگی و روزی چهار بار آب آوردن و آب و جاروی اتاق‌ها با یک فراش جور در نمی‌آید. یک فراش دیگر از اداره ی فرهنگ خواستم که هر روز منتظر ورودش بودیم. بعد از ظهرها را نمی‌رفتم. روزهای اول با دست و دل لرزان، ولی سه چهار روزه جرأت پیدا کردم. احساس می‌کردم که مدرسه زیاد هم محض خاطر من نمی‌گردد. کلاس اول هم یکسره بود و به خاطر بچه‌های جغله دلهره‌ای نداشتم. در بیابان‌های اطراف مدرسه هم ماشینی آمد و رفت نداشت و گرچه پست و بلند بود اما به هر صورت از حیاط مدرسه که بزرگ‌تر بود. معلم ها هم، هر بعد از ظهری دو تاشان به نوبت می‌رفتند یک جوری باهم کنار آمده بودند. و ترسی هم از این نبود که بچه‌ها از علم و فرهنگ ثقل سرد بکنند. یک روز هم بازرس آمد و نیم ساعتی پیزر لای پالان هم گذاشتیم و چای و احترامات متقابل! و در دفتر بازرسی تصدیق کرد که مدرسه «با وجود عدم وسایل» بسیار خوب اداره می‌شود. + +بچه‌ها مدام در مدرسه زمین می‌خوردند، بازی می‌کردند، زمین می‌خوردند. مثل اینکه تاتوله خورده بودند. ساده‌ترین شکل بازی‌هایشان در ربع ساعت‌های تفریح، دعوا بود. فکر می‌کردم علت این همه زمین خوردن شاید این باشد که بیش‌ترشان کفش حسابی ندارند. آن‌ها هم که داشتند، بچه‌ننه بودند و بلد نبودند بدوند و حتی راه بروند. این بود که روزی دو سه بار، دست و پایی خراش بر می‌داشت. پرونده‌ی برق و تلفن مدرسه را از بایگانی بسیار محقر مدرسه بیرون کشیده بودم و خوانده بودم. اگر یک خرده می‌دویدی تا دو سه سال دیگر هم برق مدرسه درست می‌شد و هم تلفنش. دوباره سری به اداره ساختمان زدم و موضوع را تازه کردم و به رفقایی که دورادور در اداره‌ی برق و تلفن داشتم، یکی دو بار رو انداختم که اول خیال می‌کردند کار خودم را می‌خواهم به اسم مدرسه راه بیندازم و ناچار رها کردم. این قدر بود که ادای وظیفه‌ای می‌کرد. مدرسه آب نداشت. نه آب خوراکی و نه آب جاری. با هرزاب بهاره، آب انبار زیر حوض را می‌انباشتند که تلمبه‌ای سرش بود و حوض را با همان پر می‌کردند و خود بچه‌ها. اما برای آب خوردن دو تا منبع صد لیتری داشتیم از آهن سفید که مثل امامزاده‌ای یا سقاخانه‌ای دو قلو، روی چهار پایه کنار حیاط بود و روزی دو بار پر و خالی می‌شد. این آب را از همان باغی می‌آوردیم که ردیف کاج‌هایش روی آسمان، لکه‌ی دراز سیاه انداخته بود. البته فراش می‌آورد. با یک سطل بزرگ و یک آب‌پاش که سوراخ بود و تا به مدرسه می‌رسید، نصف شده بود. هر دو را از جیب خودم دادم تعمیر کردند. + +یک روز هم مالک مدرسه آمد. پیرمردی موقر و سنگین که خیال می‌کرد برای سرکشی به خانه‌ی مستأجرنشینش آمده. از در وارد نشده فریادش بلند شد و فحش را کشید به فراش و به فرهنگ که چرا بچه‌ها دیوار مدرسه را با زغال سیاه کرده‌اند واز همین توپ و تشرش شناختمش. کلی با او صحبت کردیم البته او دو برابر سن من را داشت. برایش چای هم آوردیم و با معلم‌ها آشنا شد و قول‌ها داد و رفت. کنه‌ای بود. درست یک پیرمرد. یک ساعت و نیم درست نشست. ماهی یک بار هم این برنامه را داشتند که بایست پیه‌اش را به تن می‌مالیدم. + +اما معلم‌ها. هر کدام یک ابلاغ بیست و چهار ساعته در دست داشتند، ولی در برنامه به هر کدام‌شان بیست ساعت درس بیشتر نرسیده بود. کم کم قرار شد که یک معلم از فرهنگ بخواهیم و به هر کدام‌شان هجده ساعت درس بدهیم، به شرط آن‌که هیچ بعد از ظهری مدرسه تعطیل نباشد. حتی آن که دانشگاه می‌رفت می‌توانست با هفته‌ای هجده ساعت درس بسازد. و دشوارترین کار همین بود که با کدخدامنشی حل شد و من یک معلم دیگر از فرهنگ خواستم. + +اواخر هفته‌ی دوم، فراش جدید آمد. مرد پنجاه ساله‌ای باریک و زبر و زرنگ که شب‌کلاه می‌گذاشت و لباس آبی می‌پوشید و تسبیح می‌گرداند و از هر کاری سر رشته داشت. آب خوردن را نوبتی می‌آوردند. مدرسه تر و تمیز شد و رونقی گرفت. فراش جدید سرش توی حساب بود. هر دو مستخدم با هم تمام بخاری‌ها را راه انداختند و یک کارگر هم برای کمک به آن‌ها آمد. فراش قدیمی را چهار روز پشت سر هم، سر ظهر می‌فرستادیم اداره‌ی فرهنگ و هر آن منتظر زغال بودیم. هنوز یک هفته از آمدن فراش جدید نگذشته بود که صدای همه‌ی معلم‌ها در آمده بود. نه به هیچ کدامشان سلام می‌کرد و نه به دنبال خرده فرمایش‌هایشان می‌رفت. درست است که به من سلام می‌کرد، اما معلم‌ها هم، لابد هر کدام در حدود من صاحب فضایل و عنوان و معلومات بودند که از یک فراش مدرسه توقع سلام داشته باشند. اما انگار نه انگار. + +بدتر از همه این که سر خر معلم‌ها بود. من که از همان اول، خرجم را سوا کرده بودم و آن‌ها را آزاد گذاشته بودم که در مواقع بیکاری در دفتر را روی خودشان ببندند و هر چه می‌خواهند بگویند و هر کاری می‌خواهند بکنند. اما او در فاصله‌ی ساعات درس، همچه که معلم‌ها می‌آمدند، می‌آمد توی دفتر و همین طوری گوشه‌ی اتاق می‌ایستاد و معلم‌ها کلافه می‌شدند. نه می‌توانستند شلکلک‌های معلمی‌شان را در حضور او کنار بگذارند و نه جرأت می‌کردند به او چیزی بگویند. بدزبان بود و از عهده‌ی همه‌شان بر می‌آمد. یکی دوبار دنبال نخود سیاه فرستاده بودندش. اما زرنگ بود و فوری کار را انجام می‌داد و بر می‌گشت. حسابی موی دماغ شده بود. ده سال تجربه این حداقل را به من آموخته بود که اگر معلم‌ها در ربع ساعت‌های تفریح نتوانند بخندند، سر کلاس، بچه‌های مردم را کتک خواهند زد. این بود که دخالت کردم. یک روز فراش جدید را صدا زدم. اول حال و احوالپرسی و بعد چند سال سابقه دارد و چند تا بچه و چه قدر می‌گیرد... که قضیه حل شد. سی صد و خرده‌ای حقوق می‌گرفت. با بیست و پنج سال سابقه. کار از همین جا خراب بود. پیدا بود که معلم‌ها حق دارند او را غریبه بدانند. نه دیپلمی، نه کاغذپاره‌ای، هر چه باشد یک فراش که بیشتر نبود! و تازه قلدر هم بود و حق هم داشت. اول به اشاره و کنایه و بعد با صراحت بهش فهماندم که گر چه معلم جماعت اجر دنیایی ندارد، اما از او که آدم متدین و فهمیده‌ای است بعید است و از این حرف‌ها... که یک مرتبه پرید توی حرفم که: + +- ای آقا! چه می‌فرمایید؟ شما نه خودتون این کاره‌اید و نه اینارو می‌شناسید. امروز می‌خواند سیگار براشون بخرم، فردا می‌فرستنم سراغ عرق. من این‌ها رو می‌شناسم. + +راست می‌گفت. زودتر از همه، او دندان‌های مرا شمرده بود. فهمیده بود که در مدرسه هیچ‌کاره‌ام. می‌خواستم کوتاه بیایم، ولی مدیر مدرسه بودن و در مقابل یک فراش پررو ساکت ماندن!... که خر خر کامیون زغال به دادم رسید. ترمز که کرد و صدا خوابید گفتم: + +- این حرف‌ها قباحت داره. معلم جماعت کجا پولش به عرق می‌رسه؟ حالا بدو زغال آورده‌اند. + +و همین طور که داشت بیرون می‌رفت، افزودم: + +- دو روز دیگه که محتاجت شدند و ازت قرض خواستند با هم رفیق می‌شید. + +و آمدم توی ایوان. در بزرگ آهنی مدرسه را باز کرده بودند و کامیون آمده بود تو و داشتند بارش را جلوی انبار ته حیاط خالی می‌کردند و راننده، کاغذی به دست ناظم داد که نگاهی به آن انداخت و مرا نشان داد که در ایوان بالا ایستاده بودم و فرستادش بالا. کاغذش را با سلام به دستم داد. بیجک زغال بود. رسید رسمی اداره‌ی فرهنگ بود در سه نسخه و روی آن ورقه‌ی ماشین شده‌ی «باسکول» که می‌گفت کامیون و محتویاتش جمعاً دوازده خروار است. اما رسیدهای رسمی اداری فرهنگ ساکت بودند. جای مقدار زغالی که تحویل مدرسه داده شده بود، در هر سه نسخه خالی بود. پیدا بود که تحویل گیرنده باید پرشان کند. همین کار را کردم. اوراق را بردم توی اتاق و با خودنویسم عدد را روی هر سه ورق نوشتم و امضا کردم و به دست راننده دادم که راه افتاد و از همان بالا به ناظم گفتم: + +- اگر مهر هم بایست زد، خودت بزن بابا. + +و رفتم سراغ کارم که ناگهان در باز شد و ناظم آمد تو؛ بیجک زغال دستش بود و: + +- مگه نفهمیدین آقا؟ مخصوصاً جاش رو خالی گذاشته بودند آقا... + +نفهمیده بودم. اما اگر هم فهمیده بودم، فرقی نمی‌کرد و به هر صورت از چنین کودنی نا به هنگام از جا در رفتم و به شدت گفتم: + +- خوب؟ + +- هیچ چی آقا.... رسم‌شون همینه آقا. اگه باهاشون کنار نیایید کارمونو لنگ می‌گذارند آقا... + +که از جا در رفتم. به چنین صراحتی مرا که مدیر مدرسه بودم در معامله شرکت می‌داد. و فریاد زدم: + +- عجب! حالا سرکار برای من تکلیف هم معین می‌کنید؟... خاک بر سر این فرهنگ با مدیرش که من باشم! برو ورقه رو بده دست‌شون، گورشون رو گم کنند. پدر سوخته‌ها... + +چنان فریاد زده بودم که هیچ کس در مدرسه انتظار نداشت. مدیر سر به زیر و پا به راهی بودم که از همه خواهش می‌کردم و حالا ناظم مدرسه، داشت به من یاد می‌داد که به جای نه خروار زغال مثلا هجده خروار تحویل بگیرم و بعد با اداره‌ی فرهنگ کنار بیایم. هی هی!.... تا ظهر هیچ کاری نتوانستم بکنم، جز این‌که چند بار متن استعفانامه‌ام را بنویسم و پاره کنم... قدم اول را این جور جلوی پای آدم می‌گذارند. + +بارندگی که شروع شد دستور دادم بخاری‌ها را از هفت صبح بسوزانند. بچه‌ها همیشه زود می‌آمدند. حتی روزهای بارانی. مثل این‌که اول آفتاب از خانه بیرون‌شان می‌کنند. یا ناهارنخورده. خیلی سعی کردم یک روز زودتر از بچه‌ها مدرسه باشم. اما عاقبت نشد که مدرسه را خالی از نفسِ به علم‌آلوده‌ی بچه‌ها استنشاق کنم. از راه که می‌رسیدند دور بخاری جمع می‌شدند و گیوه‌هاشان را خشک می‌کردند. و خیلی زود فهمیدم که ظهر در مدرسه ماندن هم مسأله کفش بود. هر که داشت نمی‌ماند.این قاعده در مورد معلم‌ها هم صدق می‌کرد اقلاً یک پول واکس جلو بودند. وقتی که باران می‌بارید تمام کوهپایه و بدتر از آن تمام حیاط مدرسه گل می‌شد. بازی و دویدن متوقف شده بود. مدرسه سوت و کور بود. این جا هم مسأله کفش بود. چشم اغلبشان هم قرمز بود. پیدا بود باز آن روز صبح یک فصل گریه کرده‌اند و در خانه‌شان علم صراطی بوده است. + +مدرسه داشت تخته می‌شد. عده‌ی غایب‌های صبح ده برابر شده بود و ساعت اول هیچ معلمی نمی‌توانست درس بدهد. دست‌های ورم‌کرده و سرمازده کار نمی‌کرد. حتی معلم کلاس اولمان هم می‌دانست که فرهنگ و معلومات مدارس ما صرفاً تابع تمرین است. مشق و تمرین. ده بار بیست بار. دست یخ‌کرده بیل و رنده را هم نمی‌تواند به کار بگیرد که خیلی هم زمخت‌اند و دست پر کن. این بود که به فکر افتادیم. فراش جدید واردتر از همه‌ی ما بود. یک روز در اتاق دفتر، شورامانندی داشتیم که البته او هم بود. خودش را کم‌کم تحمیل کرده بود. گفت حاضر است یکی از دُم‌کلفت‌های همسایه‌ی مدرسه را وادارد که شن برایمان بفرستد به شرط آن که ما هم برویم و از انجمن محلی برای بچه‌ها کفش و لباس بخواهیم. قرار شد خودش قضیه را دنبال کند که هفته‌ی آینده جلسه‌شان کجاست و حتی بخواهد که دعوت‌مانندی از ما بکنند. دو روز بعد سه تا کامیون شن آمد. دوتایش را توی حیاط مدرسه، خالی کردیم و سومی را دم در مدرسه، و خود بچه‌ها نیم ساعته پهنش کردند. با پا و بیل و هر چه که به دست می‌رسید. + +عصر همان روز ما را به انجمن دعوت کردند. خود من و ناظم باید می‌رفتیم. معلم کلاس چهارم را هم با خودمان بردیم. خانه‌ای که محل جلسه‌ی آن شب انجمن بود، درست مثل مدرسه، دور افتاده و تنها بود. قالی‌ها و کناره‌ها را به فرهنگ می‌آلودیم و می‌رفتیم. مثل این‌که سه تا سه تا روی هم انداخته بودند. اولی که کثیف شد دومی. به بالا که رسیدیم یک حاجی آقا در حال نماز خواندن بود. و صاحب‌خانه با لهجه‌ی غلیظ یزدی به استقبال‌مان آمد. همراهانم را معرفی کردم و لابد خودش فهمید مدیر کیست. برای ما چای آوردند. سیگارم را چاق کردم و با صاحب‌خانه از قالی‌هایش حرف زدیم. ناظم به بچه‌هایی می‌ماند که در مجلس بزرگترها خوابشان می‌گیرد و دل‌شان هم نمی‌خواست دست به سر شوند. سر اعضای انجمن باز شده بود. حاجی آقا صندوقدار بود. من و ناظم عین دو طفلان مسلم بودیم و معلم کلاس چهارم عین خولی وسطمان نشسته. اغلب اعضای انجمن به زبان محلی صحبت می‌کردند و رفتار ناشی داشتند. حتی یک کدامشان نمی‌دانستند که دست و پاهای خود را چه جور ضبط و ربط کنند. بلند بلند حرف می‌زدند. درست مثل این‌که وزارتخانه‌ی دواب سه تا حیوان تازه برای باغ وحش محله‌شان وارد کرده. جلسه که رسمی شد، صاحبخانه معرفی‌مان کرد و شروع کردند. مدام از خودشان صحبت می‌کردند از این‌که دزد دیشب فلان جا را گرفته و باید درخواست پاسبان شبانه کنیم و... + +همین طور یک ساعت حرف زدند و به مهام امور رسیدگی کردند و من و معلم کلاس چهارم سیگار کشیدیم. انگار نه انگار که ما هم بودیم. نوکرشان که آمد استکان‌ها را جمع کند، چیزی روی جلد اشنو نوشتم و برای صاحبخانه فرستادم که یک مرتبه به صرافت ما افتاد و اجازه خواست و: + +- آقایان عرضی دارند. بهتر است کارهای خودمان را بگذاریم برای بعد. + +مثلاً می‌خواست بفهماند که نباید همه‌ی حرف‌ها را در حضور ما زده باشند. و اجازه دادند معلم کلاس چهار شروع کرد به نطق و او هم شروع کرد که هر چه باشد ما زیر سایه‌ی آقایانیم و خوش‌آیند نیست که بچه‌هایی باشند که نه لباس داشته باشند و نه کفش درست و حسابی و از این حرف‌ها و مدام حرف می‌زد. ناظم هم از چُرت در آمد چیزهایی را که از حفظ کرده بود گفت و التماس دعا و کار را خراب کرد.تشری به ناظم زدم که گدابازی را بگذارد کنار و حالی‌شان کردم که صحبت از تقاضا نیست و گدایی. بلکه مدرسه دور افتاده است و مستراح بی در و پیکر و از این اباطیل... چه خوب شد که عصبانی نشدم. و قرار شد که پنج نفرشان فردا عصر بیایند که مدرسه را وارسی کنند و تشکر و اظهار خوشحالی و در آمدیم. + +در تاریکی بیابان هفت تا سواری پشت در خانه ردیف بودند و راننده‌ها توی یکی از آن‌ها جمع شده بودند و اسرار ارباب‌هاشان را به هم می‌گفتند. در این حین من مدام به خودم می‌گفتم من چرا رفتم؟ به من چه؟ مگر من در بی کفش و کلاهی‌شان مقصر بودم؟ می‌بینی احمق؟ مدیر مدرسه هم که باشی باید شخصیت و غرورت را لای زرورق بپیچی و طاق کلاهت بگذاری که اقلاً نپوسد. حتی اگر بخواهی یک معلم کوفتی باشی، نه چرا دور می‌زنی؟ حتی اگر یک فراش ماهی نود تومانی باشی، باید تا خرخره توی لجن فرو بروی.در همین حین که من در فکر بودم ناظم گفت: + +- دیدید آقا چه طور باهامون رفتار کردند؟ با یکی از قالی‌هاشون آقا تمام مدرسه رو می‌خرید. + +گفتم: + +- تا سر و کارت با الف.ب است به‌پا قیاس نکنی. خودخوری می‌آره. + +و معلم کلاس چهار گفت: + +- اگه فحشمون هم می‌دادند من باز هم راضی بودم، باید واقع‌بین بود. خدا کنه پشیمون نشند. + +بعد هم مدتی درد دل کردیم و تا اتوبوس برسد و سوار بشیم، معلوم شد که معلم کلاس چهار با زنش متارکه کرده و مادر ناظم را سرطانی تشخیص دادند. و بعد هم شب بخیر... + +دو روز تمام مدرسه نرفتم. خجالت می‌کشیدم توی صورت یک کدام‌شان نگاه کنم. و در همین دو روز حاجی آقا با دو نفر آمده بودند، مدرسه را وارسی و صورت‌برداری و ناظم می‌گفت که حتی بچه‌هایی هم که کفش و کلاهی داشتند پاره و پوره آمده بودند. و برای بچه‌ها کفش و لباس خریدند. روزهای بعد احساس کردم زن‌هایی که سر راهم لب جوی آب ظرف می‌شستند، سلام می‌کنند و یک بار هم دعای خیر یکی‌شان را از عقب سر شنیدم.اما چنان از خودم بدم آمده بود که رغبتم نمی‌شد به کفش و لباس‌هاشان نگاه کنم. قربان همان گیوه‌های پاره! بله، نان گدایی فرهنگ را نو نوار کرده بود. + +تازه از دردسرهای اول کار مدرسه فارغ شده بودم که شنیدم که یک روز صبح، یکی از اولیای اطفال آمد. بعد از سلام و احوالپرسی دست کرد توی جیبش و شش تا عکس در آورد، گذاشت روی میزم. شش تا عکس زن . و هر کدام به یک حالت. یعنی چه؟ نگاه تندی به او کردم. آدم مرتبی بود. اداری مانند. کسر شأن خودم می‌دانستم که این گوشه‌ی از زندگی را طبق دستور عکاس‌باشی فلان خانه‌ی بندری ببینم. اما حالا یک مرد اتو کشیده‌ی مرتب آمده بود و شش تا از همین عکس‌ها را روی میزم پهن کرده بود و به انتظار آن که وقاحت عکس‌ها چشم‌هایم را پر کند داشت سیگار چاق می‌کرد. + +حسابی غافلگیر شده بودم... حتماً تا هر شش تای عکس‌ها را ببینم، بیش از یک دقیقه طول کشید. همه از یک نفر بود. به این فکر گریختم که الان هزار ها یا میلیون ها نسخه‌ی آن، توی جیب چه جور آدم‌هایی است و در کجاها و چه قدر خوب بود که همه‌ی این آدم‌ها را می‌شناختم یا می‌دیدم. بیش ازین نمی‌شد گریخت. یارو به تمام وزنه وقاحتش، جلوی رویم نشسته بود. سیگاری آتش زدم و چشم به او دوختم. کلافه بود و پیدا بود برای کتک‌کاری هم آماده باشد. سرخ شده بود و داشت در دود سیگارش تکیه‌گاهی برای جسارتی که می‌خواست به خرج بدهد می‌جست. عکس‌ها را با یک ورقه از اباطیلی که همان روز سیاه کرده بودم، پوشاندم و بعد با لحنی که دعوا را با آن شروع می‌کنند؛ پرسیدم: + +- خوب، غرض؟ + +و صدایم توی اتاق پیچید. حرکتی از روی بیچارگی به خودش داد و همه‌ی جسارت‌ها را با دستش توی جیبش کرد و آرام‌تر از آن چیزی که با خودش تو آورده بود، گفت: + +- چه عرض کنم؟... از معلم کلاس پنج تون بپرسید. + +که راحت شدم و او شروع کرد به این که «این چه فرهنگی است؟ خراب بشود. پس بچه‌های مردم با چه اطمینانی به مدرسه بیایند؟ + +و از این حرف‌ها... + +خلاصه این آقا معلم کاردستی کلاس پنجم، این عکس‌ها را داده به پسر آقا تا آن‌ها را روی تخته سه لایی بچسباند و دورش را سمباده بکشد و بیاورد. به هر صورت معلم کلاس پنج بی‌گدار به آب زده. و حالا من چه بکنم؟ به او چه جوابی بدهم؟ بگویم معلم را اخراج می‌کنم؟ که نه می‌توانم و نه لزومی دارد. او چه بکند؟ حتماً در این شهر کسی را ندارد که به این عکس‌ها دلخوش کرده. ولی آخر چرا این جور؟ یعنی این قدر احمق است که حتی شاگردهایش را نمی‌شناسد؟... پاشدم ناظم را صدا بزنم که خودش آمده بود بالا، توی ایوان منتظر ایستاده بود. من آخرین کسی بودم که از هر اتفاقی در مدرسه خبردار می‌شدم. حضور این ولی طفل گیجم کرده بود که چنین عکس‌هایی را از توی جیب پسرش، و لابد به همین وقاحتی که آن‌ها را روی میز من ریخت، در آورده بوده. وقتی فهمید هر دو در مانده‌ایم سوار بر اسب شد که اله می‌کنم و بله می‌کنم، در مدرسه را می‌بندم، و از این جفنگیات.... + +حتماً نمی‌دانست که اگر در هر مدرسه بسته بشود، در یک اداره بسته شده است. اما من تا او بود نمی‌توانستم فکرم را جمع کنم. می‌خواست پسرش را بخواهیم تا شهادت بدهد و چه جانی کندیم تا حالیش کنیم که پسرش هر چه خفت کشیده، بس است و وعده‌ها دادیم که معلمش را دم خورشید کباب کنیم و از نان خوردن بیندازیم. یعنی اول ناظم شروع کرد که از دست او دل پری داشت و من هم دنبالش را گرفتم. برای دک کردن او چاره‌ای جز این نبود. و بعد رفت، ما دو نفری ماندیم با شش تا عکس زن . حواسم که جمع شد به ناظم سپردم صدایش را در نیاورد و یک هفته‌ی تمام مطلب را با عکس‌ها، توی کشوی میزم قفل کردم و بعد پسرک را صدا زدم. نه عزیزدُردانه می‌نمود و نه هیچ جور دیگر. داد می‌زد که از خانواده‌ی عیال‌واری است. کم‌خونی و فقر. دیدم معلمش زیاد هم بد تشخیص نداده. یعنی زیاد بی‌گدار به آب نزده. گفتم: + +- خواهر برادر هم داری؟ + +- آ... آ...آقا داریم آقا. + +- چند تا؟ + +- آ... آقا چهار تا آقا. + +- عکس‌ها رو خودت به بابات نشون دادی؟ + +- نه به خدا آقا... به خدا قسم... + +- پس چه طور شد؟ + +و دیدم از ترس دارد قالب تهی می‌کند. گرچه چوب‌های ناظم شکسته بود، اما ترس او از من که مدیر باشم و از ناظم و از مدرسه و از تنبیه سالم مانده بود. + +- نترس بابا. کاریت نداریم. تقصیر آقا معلمه که عکس‌ها رو داده... تو کار بدی نکردی بابا جان. فهمیدی؟ اما می‌خواهم ببینم چه طور شد که عکس‌ها دست بابات افتاد. + +- آ.. آ... آخه آقا... آخه... + +می‌دانستم که باید کمکش کنم تا به حرف بیاید. + +گفتم: + +- می‌دونی بابا؟ عکس‌هام چیز بدی نبود. تو خودت فهمیدی چی بود؟ + +- آخه آقا...نه آقا.... خواهرم آقا... خواهرم می‌گفت... + +- خواهرت؟ از تو کوچک‌تره؟ + +- نه آقا. بزرگ‌تره. می‌گفتش که آقا... می‌گفتش که آقا... هیچ چی سر عکس‌ها دعوامون شد. + +دیگر تمام بود. عکس‌ها را به خواهرش نشان داده بود که لای دفترچه پر بوده از عکس آرتیست‌ها. به او پز داده بوده. اما حاضر نبوده، حتی یکی از آن‌ها را به خواهرش بدهد. آدم مورد اعتماد معلم باشد و چنین خبطی بکند؟ و تازه جواب معلم را چه بدهد؟ ناچار خواهر او را لو داده بوده. بعد از او معلم را احضار کردم. علت احضار را می‌دانست. و داد می‌زد که چیزی ندارد بگوید. پس از یک هفته مهلت، هنوز از وقاحتی که من پیدا کرده بودم، تا از آدم خلع سلاح‌شده‌ای مثل او، دست بر ندارم، در تعجب بود. به او سیگار تعارف کردم و این قصه را برایش تعریف کردم که در اوایل تأسیس وزارت معارف، یک روز به وزیر خبر می‌دهند که فلان معلم با فلان بچه روابطی دارد. وزیر فوراً او را می‌خواهد و حال و احوال او را می‌پرسد و این‌که چرا تا به حال زن نگرفته و ناچار تقصیر گردن بی‌پولی می‌افتد و دستور که فلان قدر به او کمک کنند تا عروسی راه بیندازد و خود او هم دعوت بشود و قضیه به همین سادگی تمام می‌شود. و بعد گفتم که خیلی جوان‌ها هستند که نمی‌توانند زن بگیرند و وزرای فرهنگ هم این روزها گرفتار مصاحبه‌های روزنامه‌ای و رادیویی هستند. اما در نجیب‌خانه‌ها که باز است و ازین مزخرفات... و هم‌دردی و نگذاشتم یک کلمه حرف بزند. بعد هم عکس را که توی پاکت گذاشته بودم، به دستش دادم و وقاحت را با این جمله به حد اعلا رساندم که: + +- اگر به تخته نچسبونید، ضررشون کم‌تره. + +تا حقوقم به لیست اداره‌ی فرهنگ برسه، سه ماه طول کشید. فرهنگی‌های گداگشنه و خزانه‌ی خالی و دست‌های از پا درازتر! اما خوبیش این بود که در مدرسه‌ی ما فراش جدیدمان پولدار بود و به همه‌شان قرض داد. کم کم بانک مدرسه شده بود. از سیصد و خرده‌ای تومان که می‌گرفت، پنجاه تومان را هم خرج نمی‌کرد. نه سیگار می‌کشید و نه اهل سینما بود و نه برج دیگری داشت. از این گذشته، باغبان یکی از دم‌کلفت‌های همان اطراف بود و باغی و دستگاهی و سور و ساتی و لابد آشپزخانه‌ی مرتبی. خیلی زود معلم‌ها فهمیدند که یک فراش پولدار خیلی بیش‌تر به درد می‌خورد تا یک مدیر بی‌بو و خاصیت. + +این از معلم‌ها. حقوق مرا هم هنوز از مرکز می‌دادند. با حقوق ماه بعد هم اسم مرا هم به لیست اداره منتقل کردند. درین مدت خودم برای خودم ورقه انجام کار می‌نوشتم و امضا می‌کردم و می‌رفتم از مدرسه‌ای که قبلاً در آن درس می‌دادم، حقوقم را می‌گرفتم. سر و صدای حقوق که بلند می‌شد معلم‌ها مرتب می‌شدند و کلاس ماهی سه چهار روز کاملاً دایر بود. تا ورقه‌ی انجام کار به دستشان بدهم. غیر از همان یک بار - در اوایل کار- که برای معلم حساب پنج و شش قرمز توی دفتر گذاشتیم، دیگر با مداد قرمز کاری نداشتیم و خیال همه‌شان راحت بود. وقتی برای گرفتن حقوقم به اداره رفتم، چنان شلوغی بود که به خودم گفتم کاش اصلاً حقوقم را منتقل نکرده بودم. نه می‌توانستم سر صف بایستم و نه می‌توانستم از حقوقم بگذرم. تازه مگر مواجب‌بگیر دولت چیزی جز یک انبان گشاده‌ی پای صندوق است؟..... و اگر هم می‌ماندی با آن شلوغی باید تا دو بعداز ظهر سر پا بایستی. همه‌ی جیره‌خوارهای اداره بو برده بودند که مدیرم. و لابد آن‌قدر ساده لوح بودند که فکر کنند روزی گذارشان به مدرسه‌ی ما بیفتد. دنبال سفته‌ها می‌گشتند، به حسابدار قبلی فحش می‌دادند، التماس می‌کردند که این ماه را ندیده بگیرید و همه‌ی حق و حساب‌دان شده بودند و یکی که زودتر از نوبت پولش را می‌گرفت صدای همه در می‌آمد. در لیست مدرسه، بزرگ‌ترین رقم مال من بود. درست مثل بزرگ‌ترین گناه در نامه‌ی عمل. دو برابر فراش جدیدمان حقوق می‌گرفتم. از دیدن رقم‌های مردنی حقوق دیگران چنان خجالت کشیدم که انگار مال آن‌ها را دزدیده‌ام. و تازه خلوت که شد و ده پانزده تا امضا که کردم، صندوق‌دار چشمش به من افتاد و با یک معذرت، شش صد تومان پول دزدی را گذاشت کف دستم... مرده شور! + +هنوز برف اول نباریده بود که یک روز عصر، معلم کلاس چهار رفت زیر ماشین. زیر یک سواری. مثل همه‌ی عصرها من مدرسه نبودم. دم غروب بود که فراش قدیمی مدرسه دم در خونه‌مون، خبرش را آورد. که دویدم به طرف لباسم و تا حاضر بشوم، می‌شنیدم که دارد قضیه را برای زنم تعریف می‌کند. ماشین برای یکی از آمریکایی‌ها بوده. باقیش را از خانه که در آمدیم برایم تعریف کرد. گویا یارو خودش پشت فرمون بوده و بعد هم هول شده و در رفته. بچه‌ها خبر را به مدرسه برگردانده‌اند و تا فراش و زنش برسند، جمعیت و پاسبان‌ها سوارش کرده بودند و فرستاده بوده‌اند مریض‌خانه. به اتوبوس که رسیدم، دیدم لاک پشت است. فراش را مرخص کردم و پریدم توی تاکسی. اول رفتم سراغ پاسگاه جدید کلانتری. تعاریف تکه و پاره‌ای از پرونده مطلع بود. اما پرونده تصریحی نداشت که راننده که بوده. اما هیچ کس نمی‌دانست عاقبت چه بلایی بر سر معلم کلاس چهار ما آمده است. کشیک پاسگاه همین قدر مطلع بود که درین جور موارد «طبق جریان اداری» اول می‌روند سرکلانتری، بعد دایره‌ی تصادفات و بعد بیمارستان. اگر آشنا در نمی‌آمدیم، کشیک پاسگاه مسلماً نمی‌گذاشت به پرونده نگاه چپ بکنم. احساس کردم میان اهل محل کم‌کم دارم سرشناس می‌شوم. و از این احساس خنده‌ام گرفت. + +ساعت ۸ دم در بیمارستان بودم، اگر سالم هم بود حتماً یه چیزیش شده بود. همان طور که من یه چیزیم می‌شد. روی در بیمارستان نوشته شده بود: «از ساعت ۷ به بعد ورود ممنوع». در زدم. از پشت در کسی همین آیه را صادر کرد. دیدم فایده ندارد و باید از یک چیزی کمک بگیرم. از قدرتی، از مقامی، از هیکلی، از یک چیزی. صدایم را کلفت کردم و گفتم:« من...» می‌خواستم بگویم من مدیر مدرسه‌ام. ولی فوراً پشیمان شدم. یارو لابد می‌گفت مدیر مدرسه کدام سگی است؟ این بود با کمی مکث و طمطراق فراوان جمله‌ام را این طور تمام کردم: + +- ...بازرس وزارت فرهنگم. + +که کلون صدایی کرد و لای در باز شد. یارو با چشم‌هایش سلام کرد. رفتم تو و با همان صدا پرسیدم: + +- این معلمه مدرسه که تصادف کرده... + +تا آخرش را خواند. یکی را صدا زد و دنبالم فرستاد که طبقه‌ی فلان، اتاق فلان. از حیاط به راهرو و باز به حیاط دیگر که نصفش را برف پوشانده بود و من چنان می‌دویدم که یارو از عقب سرم هن هن می‌کرد. طبقه‌ی اول و دوم و چهارم. چهار تا پله یکی. راهرو تاریک بود و پر از بوهای مخصوص بود. هن هن کنان دری را نشان داد که هل دادم و رفتم تو. بو تندتر بود و تاریکی بیشتر. تالاری بود پر از تخت و جیرجیر کفش و خرخر یک نفر. دور یک تخت چهار نفر ایستاده بودند. حتماً خودش بود. پای تخت که رسیدم، احساس کردم همه‌ی آنچه از خشونت و تظاهر و ابهت به کمک خواسته بودم آب شد و بر سر و صورتم راه افتاد. و این معلم کلاس چهارم مدرسه‌ام بود. سنگین و با شکم بر آمده دراز کشیده بود. خیلی کوتاه‌تر از زمانی که سر پا بود به نظرم آمد. صورت و سینه‌اش از روپوش چرک‌مُرد بیرون بود. صورتش را که شسته بودند کبود کبود بود، درست به رنگ جای سیلی روی صورت بچه‌ها. مرا که دید، لبخند و چه لبخندی! شاید می‌خواست بگوید مدرسه‌ای که مدیرش عصرها سر کار نباشد، باید همین جورها هم باشد. خنده توی صورت او همین طور لرزید و لرزید تا یخ زد. + +«آخر چرا تصادف کردی؟...» + +مثل این که سوال را ازو کردم. اما وقتی که دیدم نمی‌تواند حرف بزند و به جای هر جوابی همان خنده‌ی یخ‌بسته را روی صورت دارد، خودم را به عنوان او دم چک گرفتم. «آخه چرا؟ چرا این هیکل مدیر کلی را با خودت این قد این ور و آن ور می‌بری تا بزنندت؟ تا زیرت کنند؟ مگر نمی‌دانستی که معلم حق ندارد این قدر خوش‌هیکل باشد؟ آخر چرا تصادف کردی؟» به چنان عتاب و خطابی این‌ها را می‌گفتم که هیچ مطمئن نیستم بلند بلند به خودش نگفته باشم. و یک مرتبه به کله‌ام زد که «مبادا خودت چشمش زده باشی؟» و بعد: «احمق خاک بر سر! بعد از سی و چند سال عمر، تازه خرافاتی شدی!» و چنان از خودم بیزاریم گرفت که می‌خواستم به یکی فحش بدهم، کسی را بزنم. که چشمم به دکتر کشیک افتاد. + +- مرده شور این مملکتو ببره. ساعت چهار تا حالا از تن این مرد خون می‌ره. حیفتون نیومد؟... + +دستی روی شانه‌ام نشست و فریادم را خواباند. برگشتم پدرش بود. او هم می‌خندید. دو نفر دیگر هم با او بودند. همه دهاتی‌وار؛ همه خوش قد و قواره. حظ کردم! آن دو تا پسرهایش بودند یا برادرزاده‌هایش یا کسان دیگرش. تازه داشت گل از گلم می‌شکفت که شنیدم: + +- آقا کی باشند؟ + +این راهم دکتر کشیک گفت که من باز سوار شدم: + +- مرا می‌گید آقا؟ من هیشکی. یک آقا مدیر کوفتی. این هم معلمم. + +که یک مرتبه عقل هی زد و «پسر خفه شو» و خفه شدم. بغض توی گلویم بود. دلم می‌خواست یک کلمه دیگر بگوید. یک کنایه بزند... نسبت به مهارت هیچ دکتری تا کنون نتوانسته‌ام قسم بخورم. دستش را دراز کرد که به اکراه فشار دادم و بعد شیشه‌ی بزرگی را نشانم داد که وارونه بالای تخت آویزان بود و خرفهمم کرد که این جوری غذا به او می‌رسانند و عکس هم گرفته‌اند و تا فردا صبح اگر زخم‌ها چرک نکند، جا خواهند انداخت و گچ خواهند کرد. که یکی دیگر از راه رسید. گوشی به دست و سفید پوش و معطر. با حرکاتی مثل آرتیست سینما. سلامم کرد. صدایش در ته ذهنم چیزی را مختصر تکانی داد. اما احتیاجی به کنجکاوی نبود. یکی از شاگردهای نمی‌دانم چند سال پیشم بود. خودش خودش را معرفی کرد. آقای دکتر...! عجب روزگاری! هر تکه از وجودت را با مزخرفی از انبان مزخرفاتت، مثل ذره‌ای روزی در خاکی ریخته‌ای که حالا سبز کرده. چشم داری احمق. این تویی که روی تخت دراز کشیده‌ای. ده سال آزگار از پلکان ساعات و دقایق عمرت هر لحظه یکی بالا رفته و تو فقط خستگی این بار را هنوز در تن داری. این جوجه‌فکلی و جوجه‌های دیگر که نمی‌شناسی‌شان، همه از تخمی سر در آورده‌اند که روزی حصار جوانی تو بوده و حالا شکسته و خالی مانده. دستش را گرفتم و کشیدمش کناری و در گوشش هر چه بد و بی‌راه می‌دانستم، به او و همکارش و شغلش دادم. مثلاً می‌خواستم سفارش معلم کلاس چهار مدرسه‌ام را کرده باشم. بعد هم سری برای پدر تکان دادم و گریختم. از در که بیرون آمدم، حیاط بود و هوای بارانی. از در بزرگ که بیرون آمدم به این فکر می‌کردم که «اصلا به تو چه؟ اصلاً چرا آمدی؟ می‌خواستی کنجکاوی‌ات را سیرکنی؟» و دست آخر به این نتیجه رسیدم که «طعمه‌ای برای میزنشین‌های شهربانی و دادگستری به دست آمده و تو نه می‌توانی این طعمه را از دستشان بیرون بیاوری و نه هیچ کار دیگری می‌توانی بکنی...» + +و داشتم سوار تاکسی می‌شدم تا برگردم خانه که یک دفعه به صرافت افتادم که اقلاً چرا نپرسیدی چه بلایی به سرش آمده؟» خواستم عقب‌گرد کنم، اما هیکل کبود معلم کلاس چهارم روی تخت بود و دیدم نمی‌توانم. خجالت می‌کشیدم و یا می‌ترسیدم. آن شب تا ساعت دو بیدار بودم و فردا یک گزارش مفصل به امضای مدیر مدرسه و شهادت همه‌ی معلم‌ها برای اداره‌ی فرهنگ و کلانتری محل و بعد هم دوندگی در اداره‌ی بیمه و قرار بر این که روزی نه تومان بودجه برای خرج بیمارستان او بدهند و عصر پس از مدتی رفتم مدرسه و کلاس‌ها را تعطیل کردم و معلم‌ها و بچه‌های ششم را فرستادم عیادتش و دسته گل و ازین بازی‌ها... و یک ساعتی در مدرسه تنها ماندم و فارغ از همه چیز برای خودم خیال بافتم.... و فردا صبح پدرش آمد سلام و احوالپرسی و گفت یک دست و یک پایش شکسته و کمی خونریزی داخل مغز و از طرف یارو آمریکاییه آمده‌اند عیادتش و وعده و وعید که وقتی خوب شد، در اصل چهار استخدامش کنند و با زبان بی‌زبانی حالیم کرد که گزارش را بیخود داده‌ام و حالا هم داده‌ام، دنبالش نکنم و رضایت طرفین و کاسه‌ی از آش داغ‌تر و از این حرف‌ها... خاک بر سر مملکت. + +اوایل امر توجهی به بچه‌ها نداشتم. خیال می‌کردم اختلاف سِنی میان‌مان آن قدر هست که کاری به کار همدیگر نداشته باشیم. همیشه سرم به کار خودم بود. در دفتر را می‌بستم و در گرمای بخاری دولت قلم صد تا یک غاز می‌زدم. اما این کار مرتب سه چهار هفته بیش‌تر دوام نکرد. خسته شدم. ناچار به مدرسه بیشتر می‌رسیدم. یاد روزهای قدیمی با دوستان قدیمی به خیر چه آدم‌های پاک و بی‌آلایشی بودند، چه شخصیت‌های بی‌نام و نشانی و هر کدام با چه زبانی و با چه ادا و اطوارهای مخصوص به خودشان و این جوان‌های چلفته‌ای. چه مقلدهای بی‌دردسری برای فرهنگی‌مابی! نه خبری از دیروزشان داشتند و نه از املاک تازه‌ای که با هفتاد واسطه به دست‌شان داده بودند، چیزی سرشان می‌شد. بدتر از همه بی‌دست و پایی‌شان بود. آرام و مرتب درست مثل واگن شاه عبدالعظیم می‌آمدند و می‌رفتند. فقط بلد بودند روزی ده دقیقه دیرتر بیایند و همین. و از این هم بدتر تنگ‌نظری‌شان بود. + +سه بار شاهد دعواهایی بودم که سر یک گلدان میخک یا شمعدانی بود. بچه‌باغبان‌ها زیاد بودند و هر کدام‌شان حداقل ماهی یک گلدان میخک یا شمعدانی می‌آوردند که در آن برف و سرما نعمتی بود. اول تصمیم گرفتم، مدرسه را با آن‌ها زینت دهم. ولی چه فایده؟ نه کسی آب‌شان می‌داد و نه مواظبتی. و باز بدتر از همه‌ی این‌ها، بی‌شخصیتی معلم‌ها بود که درمانده‌ام کرده بود. دو کلمه نمی‌توانستند حرف بزنند. عجب هیچ‌کاره‌هایی بودند! احساس کردم که روز به روز در کلاس‌ها معلم‌ها به جای دانش‌آموزان جاافتاده‌تر می‌شوند. در نتیجه گفتم بیش‌تر متوجه بچه‌ها باشم. + +آن‌ها که تنها با ناظم سر و کار داشتند و مثل این بود که به من فقط یک سلام نیمه‌جویده بدهکارند. با این همه نومیدکننده نبودند. توی کوچه مواظب‌شان بودم. می‌خواستم حرف و سخن‌ها و درد دل‌ها و افکارشان را از یک فحش نیمه‌کاره یا از یک ادای نیمه‌تمام حدس بزنم، که سلام‌نکرده در می‌رفتند. خیلی کم تنها به مدرسه می‌آمدند. پیدا بود که سر راه همدیگر می‌ایستند یا در خانه‌ی یکدیگر می‌روند. سه چهار نفرشان هم با اسکورت می‌آمدند. از بیست سی نفری که ناهار می‌ماندند، فقط دو نفرشان چلو خورش می‌آوردند؛ فراش اولی مدرسه برایم خبر می‌آورد. بقیه گوشت‌کوبیده، پنیر گردوئی، دم پختکی و از این جور چیزها. دو نفرشان هم بودند که نان سنگک خالی می‌آوردند. برادر بودند. پنجم و سوم. صبح که می‌آمدند، جیب‌هاشان باد کرده بود. سنگک را نصف می‌کردند و توی جیب‌هاشان می‌تپاندند و ظهر می‌شد، مثل آن‌هایی که ناهارشان را در خانه می‌خورند، می‌رفتند بیرون. من فقط بیرون رفتن‌شان را می‌دیدم. اما حتی همین‌ها هر کدام روزی، یکی دو قران از فراش مدرسه خرت و خورت می‌خریدند. از همان فراش قدیمی مدرسه که ماهی پنج تومان سرایداریش را وصول کرده بودم. هر روز که وارد اتاقم می‌شدم پشت سر من می‌آمد بارانی‌ام را بر می‌داشت و شروع می‌کرد به گزارش دادن، که دیروز باز دو نفر از معلم‌ها سر یک گلدان دعوا کرده‌اند یا مأمور فرماندار نظامی آمده یا دفتردار عوض شده و از این اباطیل... پیدا بود که فراش جدید هم در مطالبی که او می‌گفت، سهمی دارد. + +یک روز در حین گزارش دادن، اشاره‌ای کرد به این مطلب که دیروز عصر یکی از بچه‌های کلاس چهار دو تا کله قند به او فروخته است. درست مثل اینکه سر کلاف را به دستم داده باشد پرسیدم: + +- چند؟ + +- دو تومنش دادم آقا. + +- زحمت کشیدی. نگفتی از کجا آورده؟ + +- من که ضامن بهشت و جهنمش نبودم آقا. + +بعد پرسیدم: + +- چرا به آقای ناظم خبر ندادی؟ + +می‌دانستم که هم او و هم فراش جدید، ناظم را هووی خودشان می‌دانند و خیلی چیزهاشان از او مخفی بود. این بود که میان من و ناظم خاصه‌خرجی می‌کردند. در جوابم همین طور مردد مانده بود که در باز شد و فراش جدید آمد تو. که: + +- اگه خبرش می‌کرد آقا بایست سهمش رو می‌داد... + +اخمم را درهم کشیدم و گفتم: + +- تو باز رفتی تو کوک مردم! اونم این جوری سر نزده که نمی‌آیند تو اتاق کسی، پیرمرد! + +و بعد اسم پسرک را ازشان پرسیدم و حالی‌شان کردم که چندان مهم نیست و فرستادمشان برایم چای بیاورند. بعد کارم را زودتر تمام کردم و رفتم به اتاق دفتر احوالی از مادر ناظم پرسیدم و به هوای ورق زدن پرونده‌ها فهمیدم که پسرک شاگرد دوساله است و پدرش تاجر بازار. بعد برگشتم به اتاقم. یادداشتی برای پدر نوشتم که پس فردا صبح، بیاید مدرسه و دادم دست فراش جدید که خودش برساند و رسیدش را بیاورد. + +و پس فردا صبح یارو آمد. باید مدیر مدرسه بود تا دانست که اولیای اطفال چه راحت تن به کوچک‌ترین خرده‌فرمایش‌های مدرسه می‌دهند. حتم دارم که اگر از اجرای ثبت هم دنبال‌شان بفرستی به این زودی‌ها آفتابی نشوند. چهل و پنج ساله مردی بود با یخه‌ی بسته بی‌کراوات و پالتویی که بیش‌تر به قبا می‌ماند. و خجالتی می‌نمود. هنوز ننشسته، پرسیدم: + +- شما دو تا زن دارید آقا؟ + +درباره‌ی پسرش برای خودم پیش‌گویی‌هایی کرده بودم و گفتم این طوری به او رودست می‌زنم. پیدا بود که از سؤالم زیاد یکه نخورده است. گفتم برایش چای آوردند و سیگاری تعارفش کردم که ناشیانه دود کرد از ترس این که مبادا جلویم در بیاید که - به شما چه مربوط است و از این اعتراض‌ها - امانش ندادم و سؤالم را این جور دنبال کردم: + +- البته می‌بخشید. چون لابد به همین علت بچه شما دو سال در یک کلاس مانده. + +شروع کرده بودم برایش یک میتینگ بدهم که پرید وسط حرفم: + +- به سر شما قسم، روزی چهار زار پول تو جیبی داره آقا. پدرسوخته‌ی نمک به حروم...! + +حالیش کردم که علت، پول تو جیبی نیست و خواستم که عصبانی نشود و قول گرفتم که اصلاً به روی پسرش هم نیاورد و آن وقت میتینگم را برایش دادم که لابد پسر در خانه مهر و محبتی نمی‌بیند و غیب‌گویی‌های دیگر... تا عاقبت یارو خجالتش ریخت و سرِ درد دلش باز شد که عفریته زن اولش همچه بوده و همچون بوده و پسرش هم به خودش برده و کی طلاقش داده و از زن دومش چند تا بچه دارد و این نره‌خر حالا باید برای خودش نان‌آور شده باشد و زنش حق دارد که با دو تا بچه‌ی خرده‌پا به او نرسد... من هم کلی برایش صحبت کردم. چایی دومش را هم سر کشید و قول‌هایش را که داد و رفت، من به این فکر افتادم که «نکند علمای تعلیم و تربیت هم، همین جورها تخم دوزرده می‌کنند!» + +یک روز صبح که رسیدم، ناظم هنوز نیامده بود. از این اتفاق‌ها کم می‌افتاد. ده دقیقه‌ای از زنگ می‌گذشت و معلم‌ها در دفتر سرگرم اختلاط بودند. خودم هم وقتی معلم بودم به این مرض دچار بودم. اما وقتی مدیر شدم تازه فهمیدم که معلم‌ها چه لذتی می‌برند. حق هم داشتند. آدم وقتی مجبور باشد شکلکی را به صورت بگذارد که نه دیگران از آن می‌خندند و نه خود آدم لذتی می‌برد، پیداست که رفع تکلیف می‌کند. زنگ را گفتم زدند و بچه‌ها سر کلاس رفتند. دو تا از کلاس‌ها بی‌معلم بود. یکی از ششمی‌ها را فرستادم سر کلاس سوم که برای‌شان دیکته بگوید و خودم رفتم سر کلاس چهار. مدیر هم که باشی، باز باید تمرین کنی که مبادا فوت و فن معلمی از یادت برود. در حال صحبت با بچه‌ها بودم که فراش خبر آورد که خانمی توی دفتر منتظرم است. خیال کردم لابد همان زنکه‌ی بیکاره‌ای است که هفته‌ای یک بار به هوای سرکشی، به وضع درس و مشق بچه‌اش سری می‌زند. زن سفیدرویی بود با چشم‌های درشت محزون و موی بور. بیست و پنج ساله هم نمی‌نمود. اما بچه‌اش کلاس سوم بود. روز اول که دیدمش لباس نارنجی به تن داشت و تن بزک کرده بود. از زیارت من خیلی خوشحال شد و از مراتب فضل و ادبم خبر داشت. + +خیلی ساده آمده بود تا با دو تا مرد حرفی زده باشد. آن طور که ناظم خبر می‌داد، یک سالی طلاق گرفته بود و روی هم رفته آمد و رفتنش به مدرسه باعث دردسر بود. وسط بیابان و مدرسه‌ای پر از معلم‌های عزب و بی‌دست و پا و یک زن زیبا... ناچار جور در نمی‌آمد. این بود که دفعات بعد دست به سرش می‌کردم، اما از رو نمی‌رفت. سراغ ناظم و اتاق دفتر را می‌گرفت و صبر می‌کرد تا زنگ را بزنند و معلم‌ها جمع بشوند و لابد حرف و سخنی و خنده‌ای و بعد از معلم کلاس سوم سراغ کار و بار و بچه‌اش را می‌گرفت و زنگ بعد را که می‌زدند، خداحافظی می‌کرد و می‌رفت. آزاری نداشت. با چشم‌هایش نفس معلم‌ها را می‌برید. و حالا باز هم همان زن بود و آمده بود و من تا از پلکان پایین بروم در ذهنم جملات زننده‌ای ردیف می‌کردم، تا پایش را از مدرسه ببرد که در را باز کردم و سلام... + +عجب! او نبود. دخترک یکی دو ساله‌ای بود با دهان گشاد و موهای زبرش را به زحمت عقب سرش گلوله کرده بود و بفهمی نفهمی دستی توی صورتش برده بود. روی هم رفته زشت نبود. اما داد می‌زد که معلم است. گفتم که مدیر مدرسه‌ام و حکمش را داد دستم که دانشسرا دیده بود و تازه استخدام شده بود. برایمان معلم فرستاده بودند. خواستم بگویم «مگر رئیس فرهنگ نمی‌داند که این جا بیش از حد مرد است» ولی دیدم لزومی ندارد و فکر کردم این هم خودش تنوعی است. + +به هر صورت زنی بود و می‌توانست محیط خشن مدرسه را که به طرز ناشیانه‌ای پسرانه بود، لطافتی بدهد و خوش‌آمد گفتم و چای آوردند که نخورد و بردمش کلاس‌های سوم و چهارم را نشانش دادم که هر کدام را مایل است، قبول کند و صحبت از هجده ساعت درس که در انتظار او بود و برگشتیم به دفتر .پرسید غیر از او هم، معلم زن داریم. گفتم: + +- متأسفانه راه مدرسه‌ی ما را برای پاشنه‌ی کفش خانم‌ها نساخته‌اند. + +که خندید و احساس کردم زورکی می‌خندد. بعد کمی این دست و آن دست کرد و عاقبت: + +- آخه من شنیده بودم شما با معلماتون خیلی خوب تا می‌کنید. + +صدای جذابی داشت. فکر کردم حیف که این صدا را پای تخته سیاه خراب خواهد کرد. و گفتم: + +- اما نه این قدر که مدرسه تعطیل بشود خانم! و لابد به عرض‌تون رسیده که همکارهای شما، خودشون نشسته‌اند و تصمیم گرفته‌اند که هجده ساعت درس بدهند. بنده هیچ‌کاره‌ام. + +- اختیار دارید. + +و نفهمیدم با این «اختیار دارید» چه می‌خواست بگوید. اما پیدا بود که بحث سر ساعات درس نیست. آناً تصمیم گرفتم، امتحانی بکنم: + +- این را هم اطلاع داشته باشید که فقط دو تا از معلم‌های ما متأهل‌اند. + +که قرمز شد و برای این که کار دیگری نکرده باشد، برخاست و حکمش را از روی میز برداشت. پا به پا می‌شد که دیدم باید به دادش برسم. ساعت را از او پرسیدم. وقت زنگ بود. فراش را صدا کردم که زنگ را بزند و بعد به او گفتم، بهتر است مشورت دیگری هم با رئیس فرهنگ بکند و ما به هر صورت خوشحال خواهیم شد که افتخار همکاری با خانمی مثل ایشان را داشته باشیم و خداحافظ شما. از در دفتر که بیرون رفت، صدای زنگ برخاست و معلم‌ها انگار موشان را آتش زده‌اند، به عجله رسیدند و هر کدام از پشت سر، آن قدر او را پاییدند تا از در بزرگ آهنی مدرسه بیرون رفت. + +فردا صبح معلوم شد که ناظم، دنبال کار مادرش بوده است که قرار بود بستری شود، تا جای سرطان گرفته را یک دوره برق بگذارند. کل کار بیمارستان را من به کمک دوستانم انجام دادم و موقع آن رسیده بود که مادرش برود بیمارستان اما وحشتش گرفته بود و حاضر نبود به بیمارستان برود. و ناظم می‌خواست رسماً دخالت کنم و با هم برویم خانه‌شان و با زبان چرب و نرمی که به قول ناظم داشتم مادرش را راضی کنم. چاره‌ای نبود. مدرسه را به معلم‌ها سپردیم و راه افتادیم. بالاخره به خانه‌ی آن‌ها رسیدیم. خانه‌ای بسیار کوچک و اجاره‌ای. مادر با چشم‌های گود نشسته و انگار زغال به صورت مالیده! سیاه نبود اما رنگش چنان تیره بود که وحشتم گرفت. اصلاً صورت نبود. زخم سیاه شده‌ای بود که انگار از جای چشم‌ها و دهان سر باز کرده است. کلی با مادرش صحبت کردم. از پسرش و کلی دروغ و دونگ، و چادرش را روی چارقدش انداختیم و علی... و خلاصه در بیمارستان بستری شدند. + +فردا که به مدرسه آمدم، ناظم سرحال بود و پیدا بود که از شر چیزی خلاص شده است و خبر داد که معلم کلاس سه را گرفته‌اند. یک ماه و خرده‌ای می‌شد که مخفی بود و ما ورقه‌ی انجام کارش را به جانشین غیر رسمی‌اش داده بودیم و حقوقش لنگ نشده بود و تا خبر رسمی بشنود و در روزنامه‌ای بیابد و قضیه به اداره‌ی فرهنگ و لیست حقوق بکشد، باز هم می‌دادیم. اما خبر که رسمی شد، جانشین واجد شرایط هم نمی‌توانست بفرستد و باید طبق مقررات رفتار می‌کردیم و بدیش همین بود. کم کم احساس کردم که مدرسه خلوت شده است و کلاس‌ها اغلب اوقات بی‌کارند. جانشین معلم کلاس چهار هنوز سر و صورتی به کارش نداده بود و حالا یک کلاس دیگر هم بی‌معلم شد. این بود که باز هم به سراغ رئیس فرهنگ رفتم. معلوم شد آن دخترک ترسیده و «نرسیده متلک پیچش کرده‌اید» رئیس فرهنگ این طور می‌گفت. و ترجیح داده بود همان زیر نظر خودش دفترداری کند. و بعد قول و قرار و فردا و پس فردا و عاقبت چهار روز دوندگی تا دو تا معلم گرفتم. یکی جوانکی رشتی که گذاشتیمش کلاس چهار و دیگری باز یکی ازین آقاپسرهای بریانتین‌زده که هر روز کراوات عوض می‌کرد، با نقش‌ها و طرح‌های عجیب. عجب فرهنگ را با قرتی‌ها در آمیخته بودند! باداباد. او را هم گذاشتیم سر کلاس سه. اواخر بهمن، یک روز ناظم آمد اتاقم که بودجه‌ی مدرسه را زنده کرده است. گفتم: + +- مبارکه، چه قدر گرفتی؟ + +- هنوز هیچ چی آقا. قراره فردا سر ظهر بیاند این جا آقا و همین جا قالش رو بکنند. + +و فردا اصلاً مدرسه نرفتم. حتماً می‌خواست من هم باشم و در بده بستان ماهی پانزده قران، حق نظافت هر اتاق نظارت کنم و از مدیریتم مایه بگذارم تا تنخواه‌گردان مدرسه و حق آب و دیگر پول‌های عقب‌افتاده وصول بشود... فردا سه نفری آمده بودند مدرسه. ناهار هم به خرج ناظم خورده بودند. و قرار دیگری برای یک سور حسابی گذاشته بودند و رفته بودند و ناظم با زبان بی‌زبانی حالیم کرد که این بار حتماً باید باشم و آن طور که می‌گفت، جای شکرش باقی بود که مراعات کرده بودند و حق بوقی نخواسته بودند. اولین باری بود که چنین اهمیتی پیدا می‌کردم. این هم یک مزیت دیگر مدیری مدرسه بود! سی صد تومان از بودجه‌ی دولت بسته به این بود که به فلان مجلس بروی یا نروی. تا سه روز دیگر موعد سور بود، اصلاً یادم نیست چه کردم. اما همه‌اش در این فکر بودم که بروم یا نروم؟ یک بار دیگر استعفانامه‌ام را توی جیبم گذاشتم و بی این که صدایش را در بیاورم، روز سور هم نرفتم. + +بعد دیدم این طور که نمی‌شود. گفتم بروم قضایا را برای رئیس فرهنگ بگویم. و رفتم. سلام و احوالپرسی نشستم. اما چه بگویم؟ بگویم چون نمی‌خواستم در خوردن سور شرکت کنم، استعفا می‌دهم؟... دیدم چیزی ندارم که بگویم. و از این گذشته خفت‌آور نبود که به خاطر سیصد تومان جا بزنم و استعفا بدهم؟ و «خداحافظ؛ فقط آمده بودم سلام عرض کنم.» و از این دروغ‌ها و استعفانامه‌ام را توی جوی آب انداختم. اما ناظم؛ یک هفته‌ای مثل سگ بود. عصبانی، پر سر و صدا و شارت و شورت! حتی نرفتم احوال مادرش را بپرسم. یک هفته‌ی تمام می‌رفتم و در اتاقم را می‌بستم و سوراخ‌های گوشم را می‌گرفتم و تا اِز و چِزّ بچه‌ها بخوابد، از این سر تا آن سر اتاق را می‌کوبیدم. ده روز تمام، قلب من و بچه‌ها با هم و به یک اندازه از ترس و وحشت تپید. تا عاقبت پول‌ها وصول شد. منتها به جای سیصد و خرده‌ای، فقط صد و پنجاه تومان. علت هم این بود که در تنظیم صورت حساب‌ها اشتباهاتی رخ داده بود که ناچار اصلاحش کرده بودند! + +غیر از آن زنی که هفته‌ای یک بار به مدرسه سری می‌زد، از اولیای اطفال دو سه نفر دیگر هم بودند که مرتب بودند. یکی همان پاسبانی که با کمربند، پاهای پسرش را بست و فلک کرد. یکی هم کارمند پست و تلگرافی بود که ده روزی یک بار می‌آمد و پدر همان بچه‌ی شیطان. و یک استاد نجار که پسرش کلاس اول بود و خودش سواد داشت و به آن می‌بالید و کارآمد می‌نمود. یک مقنی هم بود درشت استخوان و بلندقد که بچه‌اش کلاس سوم بود و هفته‌ای یک بار می‌آمد و همان توی حیاط، ده پانزده دقیقه‌ای با فراش‌ها اختلاط می‌کرد و بی سر و صدا می‌رفت. نه کاری داشت، نه چیزی از آدم می‌خواست و همان طور که آمده بود چند دقیقه‌ای را با فراش صحبت می‌کرد و بعد می رفت. فقط یک روز نمی‌دانم چرا رفته بود بالای دیوار مدرسه. البته اول فکر کردم مأمور اداره برق است ولی بعد متوجه شدم که همان مرد مقنی است. بچه‌ها جیغ و فریاد می‌کردند و من همه‌اش درین فکر بودم که چه طور به سر دیوار رفته است؟ ماحصل داد و فریادش این بود که چرا اسم پسر او را برای گرفتن کفش و لباس به انجمن ندادیم. وقتی به او رسیدم نگاهی به او انداختم و بعد تشری به ناظم و معلم ها زدم که ولش کردند و بچه‌ها رفتند سر کلاس و بعد بی این که نگاهی به او بکنم، گفتم: + +- خسته نباشی اوستا. + +و همان طور که به طرف دفتر می‌رفتم رو به ناظم و معلم‌ها افزودم: + +- لابد جواب درست و حسابی نشنیده که رفته سر دیوار. + +که پشت سرم گرپ صدایی آمد و از در دفتر که رفتم تو، او و ناظم با هم وارد شدند. گفتم نشست. و به جای این‌که حرفی بزند به گریه افتاد. هرگز گمان نمی‌کردم از چنان قد و قامتی صدای گریه در بیاید. این بود که از اتاق بیرون آمدم و فراش را صدا زدم که آب برایش بیاورد و حالش که جا آمد، بیاوردش پهلوی من. اما دیگر از او خبری نشد که نشد. نه آن روز و نه هیچ روز دیگر. آن روز چند دقیقه‌ای بعد از شیشه‌ی اتاق خودم دیدمش که دمش را لای پایش گذاشته بود از در مدرسه بیرون می‌رفت و فراش جدید آمد که بله می‌گفتند از پسرش پنج تومان خواسته بودند تا اسمش را برای کفش و لباس به انجمن بدهند. پیدا بود باز توی کوک ناظم رفته است. مرخصش کردم و ناظم را خواستم. معلوم شد می‌خواسته ناظم را بزند. همین جوری و بی‌مقدمه. + +اواخر بهمن بود که یکی از روزهای برفی با یکی دیگر از اولیای اطفال آشنا شدم. یارو مرد بسیار کوتاهی بود؛ فرنگ مآب و بزک کرده و اتو کشیده که ننشسته از تحصیلاتش و از سفرهای فرنگش حرف زد. می‌خواست پسرش را آن وقت سال از مدرسه‌ی دیگر به آن جا بیاورد. پسرش از آن بچه‌هایی بود که شیر و مربای صبحانه‌اش را با قربان صدقه توی حلقشان می‌تپانند. کلاس دوم بود و ثلث اول دو تا تجدید آورده بود. می‌گفت در باغ ییلاقی‌اش که نزدیک مدرسه است، باغبانی دارند که پسرش شاگرد ماست و درس‌خوان است و پیدا است که بچه‌ها زیر سایه شما خوب پیشرفت می‌کنند. و از این پیزرها. و حال به خاطر همین بچه، توی این برف و سرما، آمده‌اند ساکن باغ ییلاقی شده‌اند. بلند شدم ناظم را صدا کردم و دست او و بچه‌اش را توی دست ناظم گذاشتم و خداحافظ شما... و نیم ساعت بعد ناظم برگشت که یارو خانه‌ی شهرش را به یک دبیرستان اجاره داده، به ماهی سه هزار و دویست تومان، و التماس دعا داشته، یعنی معلم سرخانه می‌خواسته و حتی بدش نمی‌آمده است که خود مدیر زحمت بکشند و ازین گنده‌گوزی‌ها... احساس کردم که ناظم دهانش آب افتاده است. و من به ناظم حالی کردم خودش برود بهتر است و فقط کاری بکند که نه صدای معلم‌ها در بیاید و نه آخر سال، برای یک معدل ده احتیاجی به من بمیرم و تو بمیری پیدا کند. همان روز عصر ناظم رفته بود و قرار و مدار برای هر روز عصر یک ساعت به ماهی صد و پنجاه تومان. + +دیگر دنیا به کام ناظم بود. حال مادرش هم بهتر بود و از بیمارستان مرخصش کرده بودند و به فکر زن گرفتن افتاده بود. و هر روز هم برای یک نفر نقشه می‌کشید حتی برای من هم. یک روز در آمد که چرا ما خودمان «انجمن خانه و مدرسه» نداشته باشیم؟ نشسته بود و حسابش را کرده بود دیده بود که پنجاه شصت نفری از اولیای مدرسه دستشان به دهان‌شان می‌رسد و از آن هم که به پسرش درس خصوصی می‌داد قول مساعد گرفته بود. حالیش کردم که مواظب حرف و سخن اداره‌ای باشد و هر کار دلش می‌خواهد بکند. کاغذ دعوت را هم برایش نوشتم با آب و تاب و خودش برای اداره‌ی فرهنگ، داد ماشین کردند و به وسیله‌ی خود بچه‌ها فرستاد. و جلسه با حضور بیست و چند نفری از اولیای بچه‌ها رسمی شد. خوبیش این بود که پاسبان کشیک پاسگاه هم آمده بود و دم در برای همه، پاشنه‌هایش را به هم می‌کوبید و معلم‌ها گوش تا گوش نشسته بودند و مجلس ابهتی داشت و ناظم، چای و شیرینی تهیه کرده بود و چراغ زنبوری کرایه کرده بود و باران هم گذاشت پشتش و سالون برای اولین بار در عمرش به نوایی رسید. + +یک سرهنگ بود که رئیسش کردیم و آن زن را که هفته‌ای یک بار می‌آمد نایب رئیس. آن که ناظم به پسرش درس خصوصی می‌داد نیامده بود. اما پاکت سربسته‌ای به اسم مدیر فرستاده بود که فی‌المجلس بازش کردیم. عذرخواهی از این‌که نتوانسته بود بیاید و وجه ناقابلی جوف پاکت. صد و پنجاه تومان. و پول را روی میز صندوق‌دار گذاشتیم که ضبط و ربط کند. نائب رئیس بزک کرده و معطر شیرینی تعارف می‌کرد و معلم‌ها با هر بار که شیرینی بر می‌داشتند، یک بار تا بناگوش سرخ می‌شدند و فراش‌ها دست به دست چای می‌آوردند. + +در فکر بودم که یک مرتبه احساس کردم، سیصد چهارصد تومان پول نقد، روی میز است و هشت صد تومان هم تعهد کرده بودند. پیرزن صندوقدار که کیف پولش را همراهش نیاورده بود ناچار حضار تصویب کردند که پول‌ها فعلاً پیش ناظم باشد. و صورت مجلس مرتب شد و امضاها ردیف پای آن و فردا فهمیدم که ناظم همان شب روی خشت نشسته بوده و به معلم‌ها سور داده بوده است. اولین کاری که کردم رونوشت مجلس آن شب را برای اداره‌ی فرهنگ فرستادم. و بعد همان استاد نجار را صدا کردم و دستور دادم برای مستراح‌ها دو روزه در بسازد که ناظم خیلی به سختی پولش را داد. و بعد در کوچه‌ی مدرسه درخت کاشتیم. تور والیبال را تعویض و تعدادی توپ در اختیار بچه‌ها گذاشتیم برای تمرین در بعد از ظهرها و آمادگی برای مسابقه با دیگر مدارس و در همین حین سر و کله‌ی بازرس تربیت بدنی هم پیدا شد و هر روز سرکشی و بیا و برو. تا یک روز که به مدرسه رسیدم شنیدم که از سالون سر و صدا می‌آید. صدای هالتر بود. ناظم سر خود رفته بود و سرخود دویست سیصد تومان داده بود و هالتر خریده بود و بچه‌های لاغر زیر بار آن گردن خود را خرد می‌کردند. من در این میان حرفی نزدم. می‌توانستم حرفی بزنم؟ من چیکاره بودم؟ اصلاً به من چه ربطی داشت؟ هر کار که دلشان می‌خواهد بکنند. مهم این بود که سالون مدرسه رونقی گرفته بود. ناظم هم راضی بود و معلم‌ها هم. چون نه خبر از حسادتی بود و نه حرف و سخنی پیش آمد. فقط می‌بایست به ناظم سفارش می کردم که فکر فراش‌ها هم باشد. + +کم کم خودمان را برای امتحان‌های ثلث دوم آماده می‌کردیم. این بود که اوایل اسفند، یک روز معلم‌ها را صدا زدم و در شورا مانندی که کردیم بی‌مقدمه برایشان داستان یکی از همکاران سابقم را گفتم که هر وقت بیست می‌داد تا دو روز تب داشت. البته معلم‌ها خندیدند. ناچار تشویق شدم و داستان آخوندی را گفتم که در بچگی معلم شرعیاتمان بود و زیر عبایش نمره می‌داد و دستش چنان می‌لرزید که عبا تکان می‌خورد و درست ده دقیقه طول می‌کشید. و تازه چند؟ بهترین شاگردها دوازده. و البته باز هم خندیدند. که این بار کلافه‌ام کرد. و بعد حالیشان کردم که بد نیست در طرح سؤال‌ها مشورت کنیم و از این حرف‌ها... + +و از شنبه‌ی بعد، امتحانات شروع شد. درست از نیمه‌ی دوم اسفند. سؤال‌ها را سه نفری می‌دیدیم. خودم با معلم هر کلاس و ناظم. در سالون میزها را چیده بودیم البته از وقتی هالتردار شده بود خیلی زیباتر شده بود. در سالون کاردستی‌های بچه‌ها در همه جا به چشم می‌خورد. هر کسی هر چیزی را به عنوان کاردستی درست کرده بودند و آورده بودند. که برای این کاردستی‌ها چه پول‌ها که خرج نشده بود و چه دست‌ها که نبریده بود و چه دعواها که نشده بود و چه عرق‌ها که ریخته نشده بود. پیش از هر امتحان که می‌شد، خودم یک میتینگ برای بچه‌ها می‌دادم که ترس از معلم و امتحان بی‌جا است و باید اعتماد به نفس داشت و ازین مزخرفات....ولی مگر حرف به گوش کسی می‌رفت؟ از در که وارد می‌شدند، چنان هجومی می‌بردند که نگو! به جاهای دور از نظر. یک بار چنان بود که احساس کردم مثل این‌که از ترس، لذت می‌برند. اگر معلم نبودی یا مدیر، به راحتی می‌توانستی حدس بزنی که کی‌ها با هم قرار و مداری دارند و کدام یک پهلو دست کدام یک خواهد نشست. یکی دو بار کوشیدم بالای دست یکی‌شان بایستم و ببینم چه می‌نویسد. ولی چنان مضطرب می‌شدند و دستشان به لرزه می‌افتاد که از نوشتن باز می‌ماندند. می‌دیدم که این مردان آینده، درین کلاس‌ها و امتحان‌ها آن قدر خواهند ترسید که وقتی دیپلمه بشوند یا لیسانسه، اصلاً آدم نوع جدیدی خواهند شد. آدمی انباشته از وحشت، انبانی از ترس و دلهره. به این ترتیب یک روز بیشتر دوام نیاوردم. چون دیدم نمی‌توانم قلب بچگانه‌ای داشته باشم تا با آن ترس و وحشت بچه‌ها را درک کنم و هم‌دردی نشان بدهم.این جور بود که می‌دیدم که معلم مدرسه هم نمی‌توانم باشم. + +دو روز قبل از عید کارنامه‌ها آماده بود و منتظر امضای مدیر. دویست و سی و شش تا امضا اقلاً تا ظهر طول می‌کشید. پیش از آن هم تا می‌توانستم از امضای دفترهای حضور و غیاب می‌گریختم. خیلی از جیره‌خورهای دولت در ادارات دیگر یا در میان همکارانم دیده بودم که در مواقع بیکاری تمرین امضا می‌کنند. پیش از آن نمی‌توانستم بفهمم چه طور از مدیری یک مدرسه یا کارمندی ساده یک اداره می‌شود به وزارت رسید. یا اصلاً آرزویش را داشت. نیم‌قراضه امضای آماده و هر کدام معرف یک شخصیت، بعد نیم‌ذرع زبان چرب و نرم که با آن، مار را از سوراخ بیرون بکشی، یا همه جا را بلیسی و یک دست هم قیافه. نه یک جور. دوازده جور. + +در این فکرها بودم که ناگهان در میان کارنامه‌ها چشمم به یک اسم آشنا افتاد. به اسم پسران جناب سرهنگ که رئیس انجمن بود. رفتم توی نخ نمراتش. همه متوسط بود و جای ایرادی نبود. و یک مرتبه به صرافت افتادم که از اول سال تا به حال بچه‌های مدرسه را فقط به اعتبار وضع مالی پدرشان قضاوت کرده‌ام. درست مثل این پسر سرهنگ که به اعتبار کیابیای پدرش درس نمی‌خواند. دیدم هر کدام که پدرشان فقیرتر است به نظر من باهوش‌تر می‌آمده‌اند. البته ناظم با این حرف‌ها کاری نداشت. مر قانونی را عمل می‌کرد. از یکی چشم می‌پوشید به دیگری سخت می‌گرفت. + +اما من مثل این که قضاوتم را درباره‌ی بچه‌ها از پیش کرده باشم و چه خوب بود که نمره‌ها در اختیار من نبود و آن یکی هم «انظباط» مال آخر سال بود. مسخره‌ترین کارها آن است که کسی به اصلاح وضعی دست بزند، اما در قلمروی که تا سر دماغش بیشتر نیست. و تازه مدرسه‌ی من، این قلمروی فعالیت من، تا سر دماغم هم نبود. به همان توی ذهنم ختم می‌شد. وضعی را که دیگران ترتیب داده بودند. به این ترتیب بعد از پنج شش ماه، می‌فهمیدم که حسابم یک حساب عقلایی نبوده است. احساساتی بوده است. ضعف‌های احساساتی مرا خشونت‌های عملی ناظم جبران می‌کرد و این بود که جمعاً نمی‌توانستم ازو بگذرم. مرد عمل بود. کار را می‌برید و پیش می‌رفت. در زندگی و در هر کاری، هر قدمی بر می‌داشت، برایش هدف بود. و چشم از وجوه دیگر قضیه می‌پوشید. این بود که برش داشت. و من نمی‌توانستم. چرا که اصلاً مدیر نبودم. خلاص... + +و کارنامه‌ی پسر سرهنگ را که زیر دستم عرق کرده بود، به دقت و احتیاج خشک کردم و امضایی زیر آن گذاشتم به قدری بد خط و مسخره بود که به یاد امضای فراش جدیدمان افتادم. حتماً جناب سرهنگ کلافه می‌شد که چرا چنین آدم بی‌سوادی را با این خط و ربط امضا مدیر مدرسه کرده‌اند. آخر یک جناب سرهنگ هم می‌داند که امضای آدم معرف شخصیت آدم است. + +اواخر تعطیلات نوروز رفتم به ملاقات معلم ترکه‌ای کلاس سوم. ناظم که با او میانه‌ی خوشی نداشت. ناچار با معلم حساب کلاس پنج و شش قرار و مداری گذاشته بودم که مختصری علاقه‌ای هم به آن حرف و سخن‌ها داشت. هم به وسیله‌ی او بود که می‌دانستم نشانی‌اش کجا است و توی کدام زندان است. در راه قبل از هر چیز خبر داد که رئیس فرهنگ عوض شده و این طور که شایع است یکی از هم دوره‌ای‌های من، جایش آمده. گفتم: + +- عجب! چرا؟ مگه رئیس قبلی چپش کم بود؟ + +- چه عرض کنم. می‌گند پا تو کفش یکی از نماینده‌ها کرده. شما خبر ندارید؟ + +- چه طور؟ از کجا خبر داشته باشم؟ + +- هیچ چی... می گند دو تا از کارچاق‌کن‌های انتخاباتی یارو از صندوق فرهنگ حقوق می‌گرفته‌اند؛ شب عیدی رئیس فرهنگ حقوق‌شون رو زده. + +- عجب! پس اونم می‌خواسته اصلاحات کنه! بیچاره. + +و بعد از این حرف زدیم که الحمدالله مدرسه مرتب است و آرام و معلم‌ها همکاری می‌کنند و ناظم بیش از اندازه همه‌کاره شده است. و من فهمیدم که باز لابد مشتری خصوصی تازه‌ای پیدا شده است که سر و صدای همه همکارها بلند شده. دم در زندان شلوغ بود. کلاه مخملی‌ها، عم‌قزی گل‌بته‌ها، خاله خانباجی‌ها و... اسم نوشتیم و نوبت گرفتیم و به جای پاها، دست‌هامان زیر بار کوچکی که داشتیم، خسته شد و خواب رفت تا نوبتمان شد. از این اتاق به آن اتاق و عاقبت نرده‌های آهنی و پشت آن معلم کلاس سه و... عجب چاق شده بود!درست مثل یک آدم حسابی شده بود. خوشحال شدیم و احوالپرسی و تشکر؛ و دیگر چه بگویم؟ بگویم چرا خودت را به دردسر انداختی؟ پیدا بود از مدرسه و کلاس به او خوش‌تر می‌گذرد. ایمانی بود و او آن را داشت و خوشبخت بود و دردسری نمی‌دید و زندان حداقل برایش کلاس درس بود. عاقبت پرسیدم: + +- پرونده‌ای هم برات درست کردند یا هنوز بلاتکلیفی؟ + +- امتحانمو دادم آقا مدیر، بد از آب در نیومد. + +- یعنی چه؟ + +- یعنی بی‌تکلیف نیستم. چون اسمم تو لیست جیره‌ی زندون رفته. خیالم راحته. چون سختی‌هاش گذشته. + +دیگر چه بگویم. دیدم چیزی ندارم خداحافظی کردم و او را با معلم حساب تنها گذاشتم و آمدم بیرون و تا مدت ملاقات تمام بشود، دم در زندان قدم زدم و به زندانی فکر کردم که برای خودم ساخته بودم. یعنی آن خرپول فرهنگ‌دوست ساخته بود. و من به میل و رغبت خودم را در آن زندانی کرده بودم. این یکی را به ضرب دگنک این جا آورده بودند. ناچار حق داشت که خیالش راحت باشد. اما من به میل و رغبت رفته بودم و چه بکنم؟ ناظم چه طور؟ راستی اگر رئیس فرهنگ از هم دوره‌ای‌های خودم باشد؛ چه طور است بروم و ازو بخواهم که ناظم را جای من بگذارد، یا همین معلم حساب را؟... که معلم حساب در آمد و راه افتادیم. با او هم دیگر حرفی نداشتم. سر پیچ خداحافظ شما و تاکسی گرفتم و یک سر به اداره‌ی فرهنگ زدم. گرچه دهم عید بود، اما هنوز رفت و آمد سال نو تمام نشده بود. برو و بیا و شیرینی و چای دو جانبه. رفتم تو. سلام و تبریک و همین تعارفات را پراندم. + +بله خودش بود. یکی از پخمه‌های کلاس. که آخر سال سوم کشتیارش شدم دو بیت شعر را حفظ کند، نتوانست که نتوانست. و حالا او رئیس بود و من آقا مدیر. راستی حیف از من، که حتی وزیر چنین رئیس فرهنگ‌هایی باشم! میز همان طور پاک بود و رفته. اما زیرسیگاری انباشته از خاکستر و ته سیگار. بلند شد و چلپ و چولوپ روبوسی کردیم و پهلوی خودش جا باز کرد و گوش تا گوش جیره‌خورهای فرهنگ تبریکات صمیمانه و بدگویی از ماسبق و هندوانه و پیزرها! و دو نفر که قد و قواره‌شان به درد گود زورخانه می‌خورد یا پای صندوق انتخابات شیرینی به مردم می‌دادند. نزدیک بود شیرینی را توی ظرفش بیندازم که دیدم بسیار احمقانه است. سیگارم که تمام شد قضیه‌ی رئیس فرهنگ قبلی و آن دو نفر را در گوشی ازش پرسیدم، حرفی نزد. فقط نگاهی می‌کرد که شبیه التماس بود و من فرصت جستم تا وضع معلم کلاس سوم را برایش روشن کنم و از او بخواهم تا آن جا که می‌تواند جلوی حقوقش را نگیرد. و از در که آمدم بیرون، تازه یادم آمد که برای کار دیگری پیش رئیس فرهنگ بودم. + +باز دیروز افتضاحی به پا شد. معقول یک ماهه‌ی فروردین راحت بودیم. اول اردیبهشت ماه جلالی و کوس رسوایی سر دیوار مدرسه. نزدیک آخر وقت یک جفت پدر و مادر، بچه‌شان در میان، وارد اتاق شدند. یکی بر افروخته و دیگری رنگ و رو باخته و بچه‌شان عیناً مثل این عروسک‌های کوکی. سلام و علیک و نشستند. خدایا دیگر چه اتفاقی افتاده است؟ + +- چه خبر شده که با خانوم سرافرازمون کردید؟ + +مرد اشاره‌ای به زنش کرد که بلند شد و دست بچه را گرفت و رفت بیرون و من ماندم و پدر. اما حرف نمی‌زد. به خودش فرصت می‌داد تا عصبانیتش بپزد. سیگارم را در آوردم و تعارفش کردم. مثل این که مگس مزاحمی را از روی دماغش بپراند، سیگار را رد کرد و من که سیگارم را آتش می‌زدم، فکر کردم لابد دردی دارد که چنین دست و پا بسته و چنین متکی به خانواده به مدرسه آمده. باز پرسیدم: + +- خوب، حالا چه فرمایش داشتید؟ + +که یک مرتبه ترکید: + +- اگه من مدیر مدرسه بودم و هم‌چه اتفاقی می‌افتاد، شیکم خودمو پاره می‌کردم. خجالت بکش مرد! برو استعفا بده. تا اهل محل نریختن تیکه تیکه‌ات کنند، دو تا گوشتو وردار و دررو. بچه‌های مردم می‌آن این جا درس بخونن و حسن اخلاق. نمی‌آن که... + +- این مزخرفات کدومه آقا! حرف حساب سرکار چیه؟ + +و حرکتی کردم که او را از در بیندازم بیرون. اما آخر باید می‌فهمیدم چه مرگش است. «ولی آخر با من چه کار دارد؟» + +- آبروی من رفته. آبروی صد ساله‌ی خونواده‌ام رفته. اگه در مدرسه‌ی تو رو تخته نکنم، تخم بابام نیستم. آخه من دیگه با این بچه چی کار کنم؟ تو این مدرسه ناموس مردم در خطره. کلانتری فهمیده؛ پزشک قانونی فهمیده؛ یک پرونده درست شده پنجاه ورق؛ تازه می‌گی حرف حسابم چیه؟ حرف حسابم اینه که صندلی و این مقام از سر تو زیاده. حرف حسابم اینه که می‌دم محاکمه‌ات کنند و از نون خوردن بندازنت... + +او می‌گفت و من گوش می‌کردم و مثل دو تا سگ هار به جان هم افتاده بودیم که در باز شد و ناظم آمد تو. به دادم رسید. در همان حال که من و پدر بچه در حال دعوا بودیم زن و بچه همان آقا رفته بودند و قضایا را برای ناظم تعریف کرده بودند و او فرستاده بوده فاعل را از کلاس کشیده بودند بیرون... و گفت چه طور است زنگ بزنیم و جلوی بچه‌ها ادبش کنیم و کردیم. یعنی این بار خود من رفتم میدان. پسرک نره‌خری بود از پنجمی‌ها با لباس مرتب و صورت سرخ و سفید و سالکی به گونه. جلوی روی بچه‌ها کشیدمش زیر مشت و لگد و بعد سه تا از ترکه‌ها را که فراش جدید فوری از باغ همسایه آورده بود، به سر و صورتش خرد کردم. چنان وحشی شده بودم که اگر ترکه‌ها نمی‌رسید، پسرک را کشته بودم. این هم بود که ناظم به دادش رسید و وساطت کرد و لاشه‌اش را توی دفتر بردند و بچه‌ها را مرخص کردند و من به اتاقم برگشتم و با حالی زار روی صندلی افتادم، نه از پدر خبری بود و نه از مادر و نه از عروسک‌های کوکی‌شان که ناموسش دست کاری شده بود. و تازه احساس کردم که این کتک‌کاری را باید به او می‌زدم. خیس عرق بودم و دهانم تلخ بود. تمام فحش‌هایی که می‌بایست به آن مردکه‌ی دبنگ می‌دادم و نداده بودم، در دهانم رسوب کرده بود و مثل دم مار تلخ شده بود. اصلاً چرا زدمش؟ چرا نگذاشتم مثل همیشه ناظم میدان‌داری کند که هم کارکشته‌تر بود و هم خونسردتر. لابد پسرک با دخترعمه‌اش هم نمی‌تواند بازی کند. لابد توی خانواده‌شان، دخترها سر ده دوازده سالگی باید از پسرهای هم سن رو بگیرند. نکند عیبی کرده باشد؟ و یک مرتبه به صرافت افتادم که بروم ببینم چه بلایی به سرش آورده‌ام. بلند شدم و یکی از فراش‌ها را صدا کردم که فهمیدم روانه‌اش کرده‌اند. آبی آورد که روی دستم می‌ریخت و صورتم را می‌شستم و می‌کوشیدم که لرزش دست‌هایم را نبیند. و در گوشم آهسته گفت که پسر مدیر شرکت اتوبوسرانی است و بدجوری کتک خورده و آن‌ها خیلی سعی کرده‌اند که تر و تمیزش کنند... + +احمق مثلا داشت توی دل مرا خالی می‌کرد. نمی‌دانست که من اول تصمیم را گرفتم، بعد مثل سگ هار شدم. و تازه می‌فهمیدم کسی را زده‌ام که لیاقتش را داشته. حتماً از این اتفاق‌ها جای دیگر هم می‌افتد. آدم بردارد پایین تنه بچه‌ی خودش را، یا به قول خودش ناموسش را بگذارد سر گذر که کلانتر محل و پزشک معاینه کنند! تا پرونده درست کنند؟ با این پدرو مادرها بچه‌ها حق دارند که قرتی و دزد و دروغگو از آب در بیایند. این مدرسه‌ها را اول برای پدر و مادرها باز کنند... + +با این افکار به خانه رسیدم. زنم در را که باز کرد؛ چشم‌هایش گرد شد. همیشه وقتی می‌ترسد این طور می‌شود. برای اینکه خیال نکند آدم کشته‌ام، زود قضایا را برایش گفتم. و دیدم که در ماند. یعنی ساکت ماند. آب سرد، عرق بیدمشک، سیگار پشت سیگار فایده نداشت، لقمه از گلویم پایین نمی‌رفت و دست‌ها هنوز می‌لرزید. هر کدام به اندازه‌ی یک ماه فعالیت کرده بودند. با سیگار چهارم شروع کردم: + +- می‌دانی زن؟ بابای یارو پول‌داره. مسلماً کار به دادگستری و این جور خنس‌ها می‌کشه. مدیریت که الفاتحه. اما خیلی دلم می‌خواد قضیه به دادگاه برسه. یک سال آزگار رو دل کشیده‌ام و دیگه خسته شده‌ام. دلم می‌خواد یکی بپرسه چرا بچه‌ی مردم رو این طوری زدی، چرا تنبیه بدنی کردی! آخه یک مدیر مدرسه هم حرف‌هایی داره که باید یک جایی بزنه... + +که بلند شد و رفت سراغ تلفن. دو سه تا از دوستانم را که در دادگستری کاره‌ای بودند، گرفت و خودم قضیه را برایشان گفتم که مواظب باشند. فردا پسرک فاعل به مدرسه نیامده بود. و ناظم برایم گفت که قضیه ازین قرار بوده است که دوتایی به هوای دیدن مجموعه تمبرهای فاعل با هم به خانه‌ای می‌روند و قضایا همان جا اتفاق می‌افتد و داد و هوار و دخالت پدر و مادرهای طرفین و خط و نشان و شبانه کلانتری؛ و تمام اهل محل خبر دارند. او هم نظرش این بود که کار به دادگستری خواهد کشید. + +و من یک هفته‌ی تمام به انتظار اخطاریه‌ی دادگستری صبح و عصر به مدرسه رفتم و مثل بخت‌النصر پشت پنجره ایستادم. اما در تمام این مدت نه از فاعل خبری شد، نه از مفعول و نه از پدر و مادر ناموس‌پرست و نه از مدیر شرکت اتوبوسرانی. انگار نه انگار که اتفاقی افتاده. بچه‌ها می‌آمدند و می‌رفتند؛ برای آب خوردن عجله می‌کردند؛ به جای بازی کتک‌کاری می‌کردند و همه چیز مثل قبل بود. فقط من ماندم و یک دنیا حرف و انتظار. تا عاقبت رسید.... احضاریه‌ای با تعیین وقت قبلی برای دو روز بعد، در فلان شعبه و پیش فلان بازپرس دادگستری. آخر کسی پیدا شده بود که به حرفم گوش کند. + +تا دو روز بعد که موعد احضار بود، اصلاً از خانه در نیامدم. نشستم و ماحصل حرف‌هایم را روی کاغذ آوردم. حرف‌هایی که با همه‌ی چرندی هر وزیر فرهنگی می‌توانست با آن یک برنامه‌ی هفت ساله برای کارش بریزد. و سر ساعت معین رفتم دادگستری. اتاق معین و بازپرس معین. در را باز کردم و سلام، و تا آمدم خودم را معرفی کنم و احضاریه را در بیاورم، یارو پیش‌دستی کرد و صندلی آورد و چای سفارش داد و «احتیاجی به این حرف‌ها نیست و قضیه‌ی کوچک بود و حل شد و راضی به زحمت شما نبودیم...» + +که عرق سرد بر بدن من نشست. چایی‌ام را که خوردم، روی همان کاغذ نشان‌دار دادگستری استعفانامه‌ام را نوشتم و به نام هم‌کلاسی پخمه‌ام که تازه رئیس شده بود، دم در پست کردم. +EOT; +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/fi_FI/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/fi_FI/Address.php new file mode 100644 index 00000000..d72951be --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/fi_FI/Address.php @@ -0,0 +1,85 @@ +format('dmy'); + + switch ((int) ($birthdate->format('Y') / 100)) { + case 18: + $centurySign = '+'; + + break; + + case 19: + $centurySign = '-'; + + break; + + case 20: + $centurySign = 'A'; + + break; + + default: + throw new \InvalidArgumentException('Year must be between 1800 and 2099 inclusive.'); + } + + $randomDigits = self::numberBetween(0, 89); + + if ($gender && $gender == static::GENDER_MALE) { + if ($randomDigits === 0) { + $randomDigits .= static::randomElement([3, 5, 7, 9]); + } else { + $randomDigits .= static::randomElement([1, 3, 5, 7, 9]); + } + } elseif ($gender && $gender == static::GENDER_FEMALE) { + if ($randomDigits === 0) { + $randomDigits .= static::randomElement([2, 4, 6, 8]); + } else { + $randomDigits .= static::randomElement([0, 2, 4, 6, 8]); + } + } else { + if ($randomDigits === 0) { + $randomDigits .= self::numberBetween(2, 9); + } else { + $randomDigits .= (string) static::numerify('#'); + } + } + $randomDigits = str_pad($randomDigits, 3, '0', STR_PAD_LEFT); + + $checksum = $checksumCharacters[(int) ($datePart . $randomDigits) % strlen($checksumCharacters)]; + + return $datePart . $centurySign . $randomDigits . $checksum; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/fi_FI/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/fi_FI/PhoneNumber.php new file mode 100644 index 00000000..db06ce26 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/fi_FI/PhoneNumber.php @@ -0,0 +1,101 @@ + 'Argovie'], + ['AI' => 'Appenzell Rhodes-Intérieures'], + ['AR' => 'Appenzell Rhodes-Extérieures'], + ['BE' => 'Berne'], + ['BL' => 'Bâle-Campagne'], + ['BS' => 'Bâle-Ville'], + ['FR' => 'Fribourg'], + ['GE' => 'Genève'], + ['GL' => 'Glaris'], + ['GR' => 'Grisons'], + ['JU' => 'Jura'], + ['LU' => 'Lucerne'], + ['NE' => 'Neuchâtel'], + ['NW' => 'Nidwald'], + ['OW' => 'Obwald'], + ['SG' => 'Saint-Gall'], + ['SH' => 'Schaffhouse'], + ['SO' => 'Soleure'], + ['SZ' => 'Schwytz'], + ['TG' => 'Thurgovie'], + ['TI' => 'Tessin'], + ['UR' => 'Uri'], + ['VD' => 'Vaud'], + ['VS' => 'Valais'], + ['ZG' => 'Zoug'], + ['ZH' => 'Zurich'], + ]; + + protected static $cityFormats = [ + '{{cityName}}', + ]; + + protected static $streetNameFormats = [ + '{{streetPrefix}} {{lastName}}', + '{{streetPrefix}} de {{cityName}}', + '{{streetPrefix}} de {{lastName}}', + ]; + + protected static $streetAddressFormats = [ + '{{streetName}} {{buildingNumber}}', + ]; + protected static $addressFormats = [ + "{{streetAddress}}\n{{postcode}} {{city}}", + ]; + + /** + * Returns a random street prefix + * + * @example Rue + * + * @return string + */ + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + /** + * Returns a random city name. + * + * @example Luzern + * + * @return string + */ + public function cityName() + { + return static::randomElement(static::$cityNames); + } + + /** + * Returns a canton + * + * @example array('BE' => 'Bern') + * + * @return array + */ + public static function canton() + { + return static::randomElement(static::$canton); + } + + /** + * Returns the abbreviation of a canton. + * + * @return string + */ + public static function cantonShort() + { + $canton = static::canton(); + + return key($canton); + } + + /** + * Returns the name of canton. + * + * @return string + */ + public static function cantonName() + { + $canton = static::canton(); + + return current($canton); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/fr_CH/Color.php b/vendor/fakerphp/faker/src/Faker/Provider/fr_CH/Color.php new file mode 100644 index 00000000..6deb9f83 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/fr_CH/Color.php @@ -0,0 +1,7 @@ + 'Ain'], ['02' => 'Aisne'], ['03' => 'Allier'], ['04' => 'Alpes-de-Haute-Provence'], ['05' => 'Hautes-Alpes'], + ['06' => 'Alpes-Maritimes'], ['07' => 'Ardèche'], ['08' => 'Ardennes'], ['09' => 'Ariège'], ['10' => 'Aube'], + ['11' => 'Aude'], ['12' => 'Aveyron'], ['13' => 'Bouches-du-Rhône'], ['14' => 'Calvados'], ['15' => 'Cantal'], + ['16' => 'Charente'], ['17' => 'Charente-Maritime'], ['18' => 'Cher'], ['19' => 'Corrèze'], ['2A' => 'Corse-du-Sud'], + ['2B' => 'Haute-Corse'], ['21' => "Côte-d'Or"], ['22' => "Côtes-d'Armor"], ['23' => 'Creuse'], ['24' => 'Dordogne'], + ['25' => 'Doubs'], ['26' => 'Drôme'], ['27' => 'Eure'], ['28' => 'Eure-et-Loir'], ['29' => 'Finistère'], ['30' => 'Gard'], + ['31' => 'Haute-Garonne'], ['32' => 'Gers'], ['33' => 'Gironde'], ['34' => 'Hérault'], ['35' => 'Ille-et-Vilaine'], + ['36' => 'Indre'], ['37' => 'Indre-et-Loire'], ['38' => 'Isère'], ['39' => 'Jura'], ['40' => 'Landes'], ['41' => 'Loir-et-Cher'], + ['42' => 'Loire'], ['43' => 'Haute-Loire'], ['44' => 'Loire-Atlantique'], ['45' => 'Loiret'], ['46' => 'Lot'], + ['47' => 'Lot-et-Garonne'], ['48' => 'Lozère'], ['49' => 'Maine-et-Loire'], ['50' => 'Manche'], ['51' => 'Marne'], + ['52' => 'Haute-Marne'], ['53' => 'Mayenne'], ['54' => 'Meurthe-et-Moselle'], ['55' => 'Meuse'], ['56' => 'Morbihan'], + ['57' => 'Moselle'], ['58' => 'Nièvre'], ['59' => 'Nord'], ['60' => 'Oise'], ['61' => 'Orne'], ['62' => 'Pas-de-Calais'], + ['63' => 'Puy-de-Dôme'], ['64' => 'Pyrénées-Atlantiques'], ['65' => 'Hautes-Pyrénées'], ['66' => 'Pyrénées-Orientales'], + ['67' => 'Bas-Rhin'], ['68' => 'Haut-Rhin'], ['69' => 'Rhône'], ['70' => 'Haute-Saône'], ['71' => 'Saône-et-Loire'], + ['72' => 'Sarthe'], ['73' => 'Savoie'], ['74' => 'Haute-Savoie'], ['75' => 'Paris'], ['76' => 'Seine-Maritime'], + ['77' => 'Seine-et-Marne'], ['78' => 'Yvelines'], ['79' => 'Deux-Sèvres'], ['80' => 'Somme'], ['81' => 'Tarn'], + ['82' => 'Tarn-et-Garonne'], ['83' => 'Var'], ['84' => 'Vaucluse'], ['85' => 'Vendée'], ['86' => 'Vienne'], + ['87' => 'Haute-Vienne'], ['88' => 'Vosges'], ['89' => 'Yonne'], ['90' => 'Territoire de Belfort'], ['91' => 'Essonne'], + ['92' => 'Hauts-de-Seine'], ['93' => 'Seine-Saint-Denis'], ['94' => 'Val-de-Marne'], ['95' => "Val-d'Oise"], + ['971' => 'Guadeloupe'], ['972' => 'Martinique'], ['973' => 'Guyane'], ['974' => 'La Réunion'], ['976' => 'Mayotte'], + ]; + + protected static $secondaryAddressFormats = ['Apt. ###', 'Suite ###', 'Étage ###', 'Bât. ###', 'Chambre ###']; + + /** + * @example 'Appt. 350' + */ + public static function secondaryAddress() + { + return static::numerify(static::randomElement(static::$secondaryAddressFormats)); + } + + /** + * @example 'rue' + */ + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + /** + * Randomly returns a french region. + * + * @example 'Guadeloupe' + * + * @return string + */ + public static function region() + { + return static::randomElement(static::$regions); + } + + /** + * Randomly returns a french department ('departmentNumber' => 'departmentName'). + * + * @example array('2B' => 'Haute-Corse') + * + * @return array + */ + public static function department() + { + return static::randomElement(static::$departments); + } + + /** + * Randomly returns a french department name. + * + * @example 'Ardèche' + * + * @return string + */ + public static function departmentName() + { + $randomDepartmentName = array_values(static::department()); + + return $randomDepartmentName[0]; + } + + /** + * Randomly returns a french department number. + * + * @example '59' + * + * @return string + */ + public static function departmentNumber() + { + $randomDepartmentNumber = array_keys(static::department()); + + return $randomDepartmentNumber[0]; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/fr_FR/Color.php b/vendor/fakerphp/faker/src/Faker/Provider/fr_FR/Color.php new file mode 100644 index 00000000..a0048ac4 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/fr_FR/Color.php @@ -0,0 +1,40 @@ +generator->parse($format)); + + if ($this->isCatchPhraseValid($catchPhrase)) { + break; + } + } while (true); + + return $catchPhrase; + } + + /** + * Generates a siret number (14 digits) that passes the Luhn check. + * + * @see http://fr.wikipedia.org/wiki/Syst%C3%A8me_d'identification_du_r%C3%A9pertoire_des_%C3%A9tablissements + * + * @return string + */ + public function siret($formatted = true) + { + $siret = self::siren(false); + $nicFormat = static::randomElement(static::$siretNicFormats); + $siret .= $this->numerify($nicFormat); + $siret .= Luhn::computeCheckDigit($siret); + + if ($formatted) { + $siret = substr($siret, 0, 3) . ' ' . substr($siret, 3, 3) . ' ' . substr($siret, 6, 3) . ' ' . substr($siret, 9, 5); + } + + return $siret; + } + + /** + * Generates a siren number (9 digits) that passes the Luhn check. + * + * @see http://fr.wikipedia.org/wiki/Syst%C3%A8me_d%27identification_du_r%C3%A9pertoire_des_entreprises + * + * @return string + */ + public static function siren($formatted = true) + { + $siren = self::numerify('%#######'); + $siren .= Luhn::computeCheckDigit($siren); + + if ($formatted) { + $siren = substr($siren, 0, 3) . ' ' . substr($siren, 3, 3) . ' ' . substr($siren, 6, 3); + } + + return $siren; + } + + /** + * @var array An array containing string which should not appear twice in a catch phrase. + */ + protected static $wordsWhichShouldNotAppearTwice = ['sécurité', 'simpl']; + + /** + * Validates a french catch phrase. + * + * @param string $catchPhrase The catch phrase to validate. + * + * @return bool (true if valid, false otherwise) + */ + protected static function isCatchPhraseValid($catchPhrase) + { + foreach (static::$wordsWhichShouldNotAppearTwice as $word) { + // Fastest way to check if a piece of word does not appear twice. + $beginPos = strpos($catchPhrase, $word); + $endPos = strrpos($catchPhrase, $word); + + if ($beginPos !== false && $beginPos != $endPos) { + return false; + } + } + + return true; + } + + /** + * @see http://www.pole-emploi.fr/candidat/le-code-rome-et-les-fiches-metiers-@/article.jspz?id=60702 + * + * @note Randomly took 300 from this list + */ + protected static $jobTitleFormat = [ + 'Agent d\'accueil', + 'Agent d\'enquêtes', + 'Agent d\'entreposage', + 'Agent de curage', + 'Agro-économiste', + 'Aide couvreur', + 'Aide à domicile', + 'Aide-déménageur', + 'Ambassadeur', + 'Analyste télématique', + 'Animateur d\'écomusée', + 'Animateur web', + 'Appareilleur-gazier', + 'Archéologue', + 'Armurier d\'art', + 'Armurier spectacle', + 'Artificier spectacle', + 'Artiste dramatique', + 'Aspigiculteur', + 'Assistant de justice', + 'Assistant des ventes', + 'Assistant logistique', + 'Assistant styliste', + 'Assurance', + 'Auteur-adaptateur', + 'Billettiste voyages', + 'Brigadier', + 'Bruiteur', + 'Bâtonnier d\'art', + 'Bûcheron', + 'Cameraman', + 'Capitaine de pêche', + 'Carrier', + 'Caviste', + 'Chansonnier', + 'Chanteur', + 'Chargé de recherche', + 'Chasseur-bagagiste', + 'Chef de fabrication', + 'Chef de scierie', + 'Chef des ventes', + 'Chef du personnel', + 'Chef géographe', + 'Chef monteur son', + 'Chef porion', + 'Chiropraticien', + 'Choréologue', + 'Chromiste', + 'Cintrier-machiniste', + 'Clerc hors rang', + 'Coach sportif', + 'Coffreur béton armé', + 'Coffreur-ferrailleur', + 'Commandant de police', + 'Commandant marine', + 'Commis de coupe', + 'Comptable unique', + 'Conception et études', + 'Conducteur de jumbo', + 'Conseiller culinaire', + 'Conseiller funéraire', + 'Conseiller relooking', + 'Consultant ergonome', + 'Contrebassiste', + 'Convoyeur garde', + 'Copiste offset', + 'Corniste', + 'Costumier-habilleur', + 'Coutelier d\'art', + 'Cueilleur de cerises', + 'Céramiste concepteur', + 'Danse', + 'Danseur', + 'Data manager', + 'Dee-jay', + 'Designer produit', + 'Diététicien conseil', + 'Diététique', + 'Doreur sur métaux', + 'Décorateur-costumier', + 'Défloqueur d\'amiante', + 'Dégustateur', + 'Délégué vétérinaire', + 'Délégué à la tutelle', + 'Désamianteur', + 'Détective', + 'Développeur web', + 'Ecotoxicologue', + 'Elagueur-botteur', + 'Elagueur-grimpeur', + 'Elastiqueur', + 'Eleveur d\'insectes', + 'Eleveur de chats', + 'Eleveur de volailles', + 'Embouteilleur', + 'Employé d\'accueil', + 'Employé d\'étage', + 'Employé de snack-bar', + 'Endivier', + 'Endocrinologue', + 'Epithésiste', + 'Essayeur-retoucheur', + 'Etainier', + 'Etancheur', + 'Etancheur-bardeur', + 'Etiqueteur', + 'Expert back-office', + 'Exploitant de tennis', + 'Extraction', + 'Facteur', + 'Facteur de clavecins', + 'Facteur de secteur', + 'Fantaisiste', + 'Façadier-bardeur', + 'Façadier-ravaleur', + 'Feutier', + 'Finance', + 'Flaconneur', + 'Foreur pétrole', + 'Formateur d\'italien', + 'Fossoyeur', + 'Fraiseur', + 'Fraiseur mouliste', + 'Frigoriste maritime', + 'Fromager', + 'Galeriste', + 'Gardien de résidence', + 'Garçon de chenil', + 'Garçon de hall', + 'Gendarme mobile', + 'Guitariste', + 'Gynécologue', + 'Géodésien', + 'Géologue prospecteur', + 'Géomètre', + 'Géomètre du cadastre', + 'Gérant d\'hôtel', + 'Gérant de tutelle', + 'Gériatre', + 'Hydrothérapie', + 'Hématologue', + 'Hôte de caisse', + 'Ingénieur bâtiment', + 'Ingénieur du son', + 'Ingénieur géologue', + 'Ingénieur géomètre', + 'Ingénieur halieute', + 'Ingénieur logistique', + 'Instituteur', + 'Jointeur de placage', + 'Juge des enfants', + 'Juriste financier', + 'Kiwiculteur', + 'Lexicographe', + 'Liftier', + 'Litigeur transport', + 'Logistique', + 'Logopède', + 'Magicien', + 'Manager d\'artiste', + 'Mannequin détail', + 'Maquilleur spectacle', + 'Marbrier-poseur', + 'Marin grande pêche', + 'Matelassier', + 'Maçon', + 'Maçon-fumiste', + 'Maçonnerie', + 'Maître de ballet', + 'Maïeuticien', + 'Menuisier', + 'Miroitier', + 'Modéliste industriel', + 'Moellonneur', + 'Moniteur de sport', + 'Monteur audiovisuel', + 'Monteur de fermettes', + 'Monteur de palettes', + 'Monteur en siège', + 'Monteur prototypiste', + 'Monteur-frigoriste', + 'Monteur-truquiste', + 'Mouleur sable', + 'Mouliste drapeur', + 'Mécanicien-armurier', + 'Médecin du sport', + 'Médecin scolaire', + 'Médiateur judiciaire', + 'Médiathécaire', + 'Net surfeur surfeuse', + 'Oenologue', + 'Opérateur de plateau', + 'Opérateur du son', + 'Opérateur géomètre', + 'Opérateur piquage', + 'Opérateur vidéo', + 'Ouvrier d\'abattoir', + 'Ouvrier serriste', + 'Ouvrier sidérurgiste', + 'Palefrenier', + 'Paléontologue', + 'Pareur en abattoir', + 'Parfumeur', + 'Parqueteur', + 'Percepteur', + 'Photographe d\'art', + 'Pilote automobile', + 'Pilote de soutireuse', + 'Pilote fluvial', + 'Piqueur en ganterie', + 'Pisteur secouriste', + 'Pizzaïolo', + 'Plaquiste enduiseur', + 'Plasticien', + 'Plisseur', + 'Poissonnier-traiteur', + 'Pontonnier', + 'Porion', + 'Porteur de hottes', + 'Porteur de journaux', + 'Portier', + 'Poseur de granit', + 'Posticheur spectacle', + 'Potier', + 'Praticien dentaire', + 'Praticiens médicaux', + 'Premier clerc', + 'Preneur de son', + 'Primeuriste', + 'Professeur d\'italien', + 'Projeteur béton armé', + 'Promotion des ventes', + 'Présentateur radio', + 'Pyrotechnicien', + 'Pédicure pour bovin', + 'Pédologue', + 'Pédopsychiatre', + 'Quincaillier', + 'Radio chargeur', + 'Ramasseur d\'asperges', + 'Ramasseur d\'endives', + 'Ravaleur-ragréeur', + 'Recherche', + 'Recuiseur', + 'Relieur-doreur', + 'Responsable de salle', + 'Responsable télécoms', + 'Revenue Manager', + 'Rippeur spectacle', + 'Rogneur', + 'Récupérateur', + 'Rédacteur des débats', + 'Régleur funéraire', + 'Régleur sur tour', + 'Sapeur-pompier', + 'Scannériste', + 'Scripte télévision', + 'Sculpteur sur verre', + 'Scénariste', + 'Second de cuisine', + 'Secrétaire juridique', + 'Semencier', + 'Sertisseur', + 'Services funéraires', + 'Solier-moquettiste', + 'Sommelier', + 'Sophrologue', + 'Staffeur', + 'Story boarder', + 'Stratifieur', + 'Stucateur', + 'Styliste graphiste', + 'Surjeteur-raseur', + 'Séismologue', + 'Technicien agricole', + 'Technicien bovin', + 'Technicien géomètre', + 'Technicien plateau', + 'Technicien énergie', + 'Terminologue', + 'Testeur informatique', + 'Toiliste', + 'Topographe', + 'Toréro', + 'Traducteur d\'édition', + 'Traffic manager', + 'Trieur de métaux', + 'Turbinier', + 'Téléconseiller', + 'Tôlier-traceur', + 'Vendeur carreau', + 'Vendeur en lingerie', + 'Vendeur en meubles', + 'Vendeur en épicerie', + 'Verrier d\'art', + 'Verrier à la calotte', + 'Verrier à la main', + 'Verrier à main levée', + 'Vidéo-jockey', + 'Vitrier', + ]; +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/fr_FR/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/fr_FR/Internet.php new file mode 100644 index 00000000..679919da --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/fr_FR/Internet.php @@ -0,0 +1,9 @@ +numberBetween(1, 2); + } + + $nir .= + // Year of birth (aa) + $this->numerify('##') . + // Mont of birth (mm) + sprintf('%02d', $this->numberBetween(1, 12)); + + // Department + $department = key(Address::department()); + $nir .= $department; + + // Town number, depends on department length + if (strlen($department) === 2) { + $nir .= $this->numerify('###'); + } elseif (strlen($department) === 3) { + $nir .= $this->numerify('##'); + } + + // Born number (depending of town and month of birth) + $nir .= $this->numerify('###'); + + /** + * The key for a given NIR is `97 - 97 % NIR` + * NIR has to be an integer, so we have to do a little replacment + * for departments 2A and 2B + */ + if ($department === '2A') { + $nirInteger = str_replace('2A', '19', $nir); + } elseif ($department === '2B') { + $nirInteger = str_replace('2B', '18', $nir); + } else { + $nirInteger = $nir; + } + $nir .= sprintf('%02d', 97 - $nirInteger % 97); + + // Format is x xx xx xx xxx xxx xx + if ($formatted) { + $nir = substr($nir, 0, 1) . ' ' . substr($nir, 1, 2) . ' ' . substr($nir, 3, 2) . ' ' . substr($nir, 5, 2) . ' ' . substr($nir, 7, 3) . ' ' . substr($nir, 10, 3) . ' ' . substr($nir, 13, 2); + } + + return $nir; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/fr_FR/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/fr_FR/PhoneNumber.php new file mode 100644 index 00000000..69c681d9 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/fr_FR/PhoneNumber.php @@ -0,0 +1,148 @@ +phoneNumber07WithSeparator(); + + return str_replace(' ', '', $phoneNumber); + } + + /** + * Only 073 to 079 are acceptable prefixes with 07 + * + * @see http://www.arcep.fr/index.php?id=8146 + */ + public function phoneNumber07WithSeparator() + { + $phoneNumber = $this->generator->numberBetween(3, 9); + $phoneNumber .= $this->numerify('# ## ## ##'); + + return $phoneNumber; + } + + public function phoneNumber08() + { + $phoneNumber = $this->phoneNumber08WithSeparator(); + + return str_replace(' ', '', $phoneNumber); + } + + /** + * Valid formats for 08: + * + * 0# ## ## ## + * 1# ## ## ## + * 2# ## ## ## + * 91 ## ## ## + * 92 ## ## ## + * 93 ## ## ## + * 97 ## ## ## + * 98 ## ## ## + * 99 ## ## ## + * + * Formats 089(4|6)## ## ## are valid, but will be + * attributed when other 089 resource ranges are exhausted. + * + * @see https://www.arcep.fr/index.php?id=8146#c9625 + * @see https://issuetracker.google.com/u/1/issues/73269839 + */ + public function phoneNumber08WithSeparator() + { + $regex = '([012]{1}\d{1}|(9[1-357-9])( \d{2}){3}'; + + return $this->regexify($regex); + } + + /** + * @example '0601020304' + */ + public function mobileNumber() + { + $format = static::randomElement(static::$mobileFormats); + + return static::numerify($this->generator->parse($format)); + } + + /** + * @example '0891951357' + */ + public function serviceNumber() + { + $format = static::randomElement(static::$serviceFormats); + + return static::numerify($this->generator->parse($format)); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/fr_FR/Text.php b/vendor/fakerphp/faker/src/Faker/Provider/fr_FR/Text.php new file mode 100644 index 00000000..bcd3167a --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/fr_FR/Text.php @@ -0,0 +1,15532 @@ + static::latitude(46.262740, 47.564721), + 'longitude' => static::longitude(17.077949, 20.604560), + ]; + } + + protected static $streetSuffix = [ + 'árok', 'átjáró', 'dűlősor', 'dűlőút', 'erdősor', 'fasor', 'forduló', 'gát', 'határsor', 'határút', 'híd', 'játszótér', 'kert', 'körönd', 'körtér', 'körút', 'köz', 'lakótelep', 'lejáró', 'lejtő', 'lépcső', 'liget', 'mélyút', 'orom', 'országút', 'ösvény', 'park', 'part', 'pincesor', 'rakpart', 'sétány', 'sétaút', 'sor', 'sugárút', 'tér', 'tere', 'turistaút', 'udvar', 'út', 'útja', 'utca', 'üdülőpart', + ]; + protected static $postcode = ['####']; + protected static $state = [ + 'Budapest', 'Bács-Kiskun', 'Baranya', 'Békés', 'Borsod-Abaúj-Zemplén', 'Csongrád', 'Fejér', 'Győr-Moson-Sopron', 'Hajdú-Bihar', 'Heves', 'Jász-Nagykun-Szolnok', 'Komárom-Esztergom', 'Nógrád', 'Pest', 'Somogy', 'Szabolcs-Szatmár-Bereg', 'Tolna', 'Vas', 'Veszprém', 'Zala', + ]; + protected static $country = [ + 'Afganisztán', 'Albánia', 'Algéria', 'Amerikai Egyesült Államok', 'Andorra', 'Angola', 'Antigua és Barbuda', 'Argentína', 'Ausztria', 'Ausztrália', 'Azerbajdzsán', + 'Bahama-szigetek', 'Bahrein', 'Banglades', 'Barbados', 'Belgium', 'Belize', 'Benin', 'Bhután', 'Bolívia', 'Bosznia-Hercegovina', 'Botswana', 'Brazília', 'Brunei', 'Bulgária', 'Burkina Faso', 'Burma', 'Burundi', + 'Chile', 'Ciprus', 'Costa Rica', 'Csehország', 'Csád', + 'Dominikai Köztársaság', 'Dominikai Közösség', 'Dzsibuti', 'Dánia', 'Dél-Afrika', 'Dél-Korea', 'Dél-Szudán', + 'Ecuador', 'Egyenlítői-Guinea', 'Egyesült Arab Emírségek', 'Egyesült Királyság', 'Egyiptom', 'Elefántcsontpart', 'Eritrea', 'Etiópia', + 'Fehéroroszország', 'Fidzsi-szigetek', 'Finnország', 'Franciaország', 'Fülöp-szigetek', + 'Gabon', 'Gambia', 'Ghána', 'Grenada', 'Grúzia', 'Guatemala', 'Guinea', 'Guyana', 'Görögország', + 'Haiti', 'Hollandia', 'Horvátország', + 'India', 'Indonézia', 'Irak', 'Irán', 'Izland', 'Izrael', + 'Japán', 'Jemen', 'Jordánia', + 'Kambodzsa', 'Kamerun', 'Kanada', 'Katar', 'Kazahsztán', 'Kelet-Timor', 'Kenya', 'Kirgizisztán', 'Kiribati', 'Kolumbia', 'Kongói Demokratikus Köztársaság', 'Kongói Köztársaság', 'Kuba', 'Kuvait', 'Kína', 'Közép-Afrika', + 'Laosz', 'Lengyelország', 'Lesotho', 'Lettország', 'Libanon', 'Libéria', 'Liechtenstein', 'Litvánia', 'Luxemburg', 'Líbia', + 'Macedónia', 'Madagaszkár', 'Magyarország', 'Malawi', 'Maldív-szigetek', 'Mali', 'Malájzia', 'Marokkó', 'Marshall-szigetek', 'Mauritánia', 'Mexikó', 'Mikronézia', 'Moldova', 'Monaco', 'Mongólia', 'Montenegró', 'Mozambik', 'Málta', + 'Namíbia', 'Nauru', 'Nepál', 'Nicaragua', 'Niger', 'Nigéria', 'Norvégia', 'Németország', + 'Olaszország', 'Omán', 'Oroszország', + 'Pakisztán', 'Palau', 'Panama', 'Paraguay', 'Peru', 'Portugália', 'Pápua Új-Guinea', + 'Románia', 'Ruanda', + 'Saint Kitts és Nevis', 'Saint Vincent', 'Salamon-szigetek', 'Salvador', 'San Marino', 'Seychelle-szigetek', 'Spanyolország', 'Srí Lanka', 'Suriname', 'Svájc', 'Svédország', 'Szamoa', 'Szaúd-Arábia', 'Szenegál', 'Szerbia', 'Szingapúr', 'Szlovákia', 'Szlovénia', 'Szomália', 'Szudán', 'Szváziföld', 'Szíria', 'São Tomé és Príncipe', + 'Tadzsikisztán', 'Tanzánia', 'Thaiföld', 'Togo', 'Tonga', 'Trinidad és Tobago', 'Tunézia', 'Tuvalu', 'Törökország', 'Türkmenisztán', + 'Uganda', 'Ukrajna', 'Uruguay', + 'Vanuatu', 'Venezuela', 'Vietnám', + 'Zambia', 'Zimbabwe', 'Zöld-foki-szigetek', + 'Észak-Korea', 'Észtország', 'Írország', 'Örményország', 'Új-Zéland', 'Üzbegisztán', + ]; + + /** + * Source: https://hu.wikipedia.org/wiki/Magyarorsz%C3%A1g_v%C3%A1rosainak_list%C3%A1ja + */ + protected static $capitals = ['Budapest']; + protected static $bigCities = [ + 'Békéscsaba', 'Debrecen', 'Dunaújváros', 'Eger', 'Érd', 'Győr', 'Hódmezővásárhely', 'Kaposvár', 'Kecskemét', 'Miskolc', 'Nagykanizsa', 'Nyíregyháza', 'Pécs', 'Salgótarján', 'Sopron', 'Szeged', 'Székesfehérvár', 'Szekszárd', 'Szolnok', 'Szombathely', 'Tatabánya', 'Veszprém', 'Zalaegerszeg', + ]; + protected static $smallerCities = [ + 'Ajka', 'Aszód', 'Bácsalmás', + 'Baja', 'Baktalórántháza', 'Balassagyarmat', 'Balatonalmádi', 'Balatonfüred', 'Balmazújváros', 'Barcs', 'Bátonyterenye', 'Békés', 'Bélapátfalva', 'Berettyóújfalu', 'Bicske', 'Bóly', 'Bonyhád', 'Budakeszi', + 'Cegléd', 'Celldömölk', 'Cigánd', 'Csenger', 'Csongrád', 'Csorna', 'Csurgó', + 'Dabas', 'Derecske', 'Devecser', 'Dombóvár', 'Dunakeszi', + 'Edelény', 'Encs', 'Enying', 'Esztergom', + 'Fehérgyarmat', 'Fonyód', 'Füzesabony', + 'Gárdony', 'Gödöllő', 'Gönc', 'Gyál', 'Gyomaendrőd', 'Gyöngyös', 'Gyula', + 'Hajdúböszörmény', 'Hajdúhadház', 'Hajdúnánás', 'Hajdúszoboszló', 'Hatvan', 'Heves', + 'Ibrány', + 'Jánoshalma', 'Jászapáti', 'Jászberény', + 'Kalocsa', 'Kapuvár', 'Karcag', 'Kazincbarcika', 'Kemecse', 'Keszthely', 'Kisbér', 'Kiskőrös', 'Kiskunfélegyháza', 'Kiskunhalas', 'Kiskunmajsa', 'Kistelek', 'Kisvárda', 'Komárom', 'Komló', 'Körmend', 'Kőszeg', 'Kunhegyes', 'Kunszentmárton', 'Kunszentmiklós', + 'Lenti', 'Letenye', + 'Makó', 'Marcali', 'Martonvásár', 'Mátészalka', 'Mezőcsát', 'Mezőkovácsháza', 'Mezőkövesd', 'Mezőtúr', 'Mohács', 'Monor', 'Mór', 'Mórahalom', 'Mosonmagyaróvár', + 'Nagyatád', 'Nagykálló', 'Nagykáta', 'Nagykőrös', 'Nyíradony', 'Nyírbátor', + 'Orosháza', 'Oroszlány', 'Ózd', + 'Paks', 'Pannonhalma', 'Pápa', 'Pásztó', 'Pécsvárad', 'Pétervására', 'Pilisvörösvár', 'Polgárdi', 'Püspökladány', 'Putnok', + 'Ráckeve', 'Rétság', + 'Sárbogárd', 'Sarkad', 'Sárospatak', 'Sárvár', 'Sásd', 'Sátoraljaújhely', 'Sellye', 'Siklós', 'Siófok', 'Sümeg', 'Szarvas', 'Szécsény', 'Szeghalom', 'Szentendre', 'Szentes', 'Szentgotthárd', 'Szentlőrinc', 'Szerencs', 'Szigetszentmiklós', 'Szigetvár', 'Szikszó', 'Szob', + 'Tab', 'Tamási', 'Tapolca', 'Tata', 'Tét', 'Tiszafüred', 'Tiszakécske', 'Tiszaújváros', 'Tiszavasvári', 'Tokaj', 'Tolna', 'Törökszentmiklós', + 'Vác', 'Várpalota', 'Vásárosnamény', 'Vasvár', 'Vecsés', + 'Záhony', 'Zalaszentgrót', 'Zirc', + ]; +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/hu_HU/Company.php b/vendor/fakerphp/faker/src/Faker/Provider/hu_HU/Company.php new file mode 100644 index 00000000..75931991 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/hu_HU/Company.php @@ -0,0 +1,13 @@ +generator->parse($format); + } + + public static function country() + { + return static::randomElement(static::$country); + } + + public static function postcode() + { + return static::toUpper(static::bothify(static::randomElement(static::$postcode))); + } + + public static function regionSuffix() + { + return static::randomElement(static::$regionSuffix); + } + + public static function region() + { + return static::randomElement(static::$region); + } + + public static function cityPrefix() + { + return static::randomElement(static::$cityPrefix); + } + + public function city() + { + return static::randomElement(static::$city); + } + + public function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + public static function street() + { + return static::randomElement(static::$street); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/hy_AM/Color.php b/vendor/fakerphp/faker/src/Faker/Provider/hy_AM/Color.php new file mode 100644 index 00000000..ebdda0da --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/hy_AM/Color.php @@ -0,0 +1,12 @@ +generator->parse(static::randomElement(static::$formats))); + } + + public function code() + { + return static::randomElement(static::$codes); + } + + public function numberFormat() + { + return static::randomElement(static::$numberFormats); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/id_ID/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/id_ID/Address.php new file mode 100644 index 00000000..28dd845c --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/id_ID/Address.php @@ -0,0 +1,319 @@ +generator->parse($format); + } + + public static function street() + { + return static::randomElement(static::$street); + } + + public static function buildingNumber() + { + return (string) self::numberBetween(1, 999); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/id_ID/Color.php b/vendor/fakerphp/faker/src/Faker/Provider/id_ID/Color.php new file mode 100644 index 00000000..14995b62 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/id_ID/Color.php @@ -0,0 +1,40 @@ +generator->parse($lastNameRandomElement); + } + + /** + * Return last name for male + * + * @return string last name + */ + public static function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + /** + * Return last name for female + * + * @return string last name + */ + public static function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } + + /** + * For academic title + * + * @return string suffix + */ + public static function suffix() + { + return static::randomElement(static::$suffix); + } + + /** + * Generates Nomor Induk Kependudukan (NIK) + * + * @see https://en.wikipedia.org/wiki/National_identification_number#Indonesia + * + * @param string|null $gender + * @param \DateTime|null $birthDate + * + * @return string + */ + public function nik($gender = null, $birthDate = null) + { + // generate first numbers (region data) + $nik = $this->birthPlaceCode(); + $nik .= $this->generator->numerify('##'); + + if (!$birthDate) { + $birthDate = $this->generator->dateTimeBetween(); + } + + if (!$gender) { + $gender = $this->generator->randomElement([self::GENDER_MALE, self::GENDER_FEMALE]); + } + + // if gender is female, add 40 to days + if ($gender == self::GENDER_FEMALE) { + $nik .= $birthDate->format('d') + 40; + } else { + $nik .= $birthDate->format('d'); + } + + $nik .= $birthDate->format('my'); + + // add last random digits + $nik .= $this->generator->numerify('####'); + + return $nik; + } + + /** + * Generates birth place code for NIK + * + * @see https://id.wikipedia.org/wiki/Nomor_Induk_Kependudukan + * @see http://informasipedia.com/wilayah-indonesia/daftar-kabupaten-kota-di-indonesia/ + */ + protected function birthPlaceCode() + { + return static::randomElement(static::$birthPlaceCode); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/id_ID/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/id_ID/PhoneNumber.php new file mode 100644 index 00000000..c0bfaf5b --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/id_ID/PhoneNumber.php @@ -0,0 +1,55 @@ + Icelandic names for women. + */ + protected static $firstNameFemale = ['Aagot', 'Abela', 'Abigael', 'Ada', 'Adda', 'Addý', 'Adela', 'Adelía', 'Adríana', 'Aðalbjörg', 'Aðalbjört', 'Aðalborg', 'Aðaldís', 'Aðalfríður', 'Aðalheiður', 'Aðalrós', 'Aðalsteina', 'Aðalsteinunn', 'Aðalveig', 'Agata', 'Agatha', 'Agða', 'Agla', 'Agnea', 'Agnes', 'Agneta', 'Alanta', 'Alba', 'Alberta', 'Albína', 'Alda', 'Aldís', 'Aldný', 'Aleta', 'Aletta', 'Alexa', 'Alexandra', 'Alexandría', 'Alexis', 'Alexía', 'Alfa', 'Alfífa', 'Alice', 'Alida', 'Alída', 'Alína', 'Alís', 'Alísa', 'Alla', 'Allý', 'Alma', 'Alrún', 'Alva', 'Alvilda', 'Amadea', 'Amal', 'Amalía', 'Amanda', 'Amelía', 'Amilía', 'Amíra', 'Amy', 'Amý', 'Analía', 'Anastasía', 'Andra', 'Andrá', 'Andrea', 'Anetta', 'Angela', 'Angelíka', 'Anika', 'Anita', 'Aníka', 'Anína', 'Aníta', 'Anja', 'Ann', 'Anna', 'Annabella', 'Annalísa', 'Anne', 'Annelí', 'Annetta', 'Anney', 'Annika', 'Annía', 'Anný', 'Antonía', 'Apríl', 'Ardís', 'Arey', 'Arinbjörg', 'Aris', 'Arisa', 'Aría', 'Aríanna', 'Aríella', 'Arín', 'Arína', 'Arís', 'Armenía', 'Arna', 'Arnbjörg', 'Arnborg', 'Arndís', 'Arney', 'Arnfinna', 'Arnfríður', 'Arngerður', 'Arngunnur', 'Arnheiður', 'Arnhildur', 'Arnika', 'Arnkatla', 'Arnlaug', 'Arnleif', 'Arnlín', 'Arnljót', 'Arnóra', 'Arnrós', 'Arnrún', 'Arnþóra', 'Arnþrúður', 'Asírí', 'Askja', 'Assa', 'Astrid', 'Atalía', 'Atena', 'Athena', 'Atla', 'Atlanta', 'Auðbjörg', 'Auðbjört', 'Auðdís', 'Auðlín', 'Auðna', 'Auðný', 'Auðrún', 'Auður', 'Aurora', 'Axelía', 'Axelma', 'Aþena', 'Ágústa', 'Ágústína', 'Álfdís', 'Álfey', 'Álfgerður', 'Álfheiður', 'Álfhildur', 'Álfrós', 'Álfrún', 'Álfsól', 'Árbjörg', 'Árbjört', 'Árdís', 'Árelía', 'Árlaug', 'Ármey', 'Árna', 'Árndís', 'Árney', 'Árnheiður', 'Árnína', 'Árný', 'Áróra', 'Ársól', 'Ársæl', 'Árún', 'Árveig', 'Árvök', 'Árþóra', 'Ása', 'Ásbjörg', 'Ásborg', 'Ásdís', 'Ásfríður', 'Ásgerður', 'Áshildur', 'Áskatla', 'Ásla', 'Áslaug', 'Ásleif', 'Ásný', 'Ásrós', 'Ásrún', 'Ást', 'Ásta', 'Ástbjörg', 'Ástbjört', 'Ástdís', 'Ástfríður', 'Ástgerður', 'Ástheiður', 'Ásthildur', 'Ástríður', 'Ástrós', 'Ástrún', 'Ástveig', 'Ástþóra', 'Ástþrúður', 'Ásvör', 'Baldey', 'Baldrún', 'Baldvina', 'Barbara', 'Barbára', 'Bassí', 'Bára', 'Bebba', 'Begga', 'Belinda', 'Bella', 'Benedikta', 'Bengta', 'Benidikta', 'Benía', 'Beníta', 'Benna', 'Benney', 'Benný', 'Benta', 'Bentey', 'Bentína', 'Bera', 'Bergdís', 'Bergey', 'Bergfríður', 'Bergheiður', 'Berghildur', 'Berglaug', 'Berglind', 'Berglín', 'Bergljót', 'Bergmannía', 'Bergný', 'Bergrán', 'Bergrín', 'Bergrós', 'Bergrún', 'Bergþóra', 'Berit', 'Bernódía', 'Berta', 'Bertha', 'Bessí', 'Bestla', 'Beta', 'Betanía', 'Betsý', 'Bettý', 'Bil', 'Birgit', 'Birgitta', 'Birna', 'Birta', 'Birtna', 'Bíbí', 'Bína', 'Bjargdís', 'Bjargey', 'Bjargheiður', 'Bjarghildur', 'Bjarglind', 'Bjarkey', 'Bjarklind', 'Bjarma', 'Bjarndís', 'Bjarney', 'Bjarnfríður', 'Bjarngerður', 'Bjarnheiður', 'Bjarnhildur', 'Bjarnlaug', 'Bjarnrún', 'Bjarnveig', 'Bjarný', 'Bjarnþóra', 'Bjarnþrúður', 'Bjartey', 'Bjartmey', 'Björg', 'Björgey', 'Björgheiður', 'Björghildur', 'Björk', 'Björney', 'Björnfríður', 'Björt', 'Bláey', 'Blíða', 'Blín', 'Blómey', 'Blædís', 'Blær', 'Bobba', 'Boga', 'Bogdís', 'Bogey', 'Bogga', 'Boghildur', 'Borg', 'Borgdís', 'Borghildur', 'Borgný', 'Borgrún', 'Borgþóra', 'Botnía', 'Bóel', 'Bót', 'Bóthildur', 'Braga', 'Braghildur', 'Branddís', 'Brá', 'Brák', 'Brigitta', 'Brimdís', 'Brimhildur', 'Brimrún', 'Brit', 'Britt', 'Britta', 'Bríana', 'Bríanna', 'Bríet', 'Bryndís', 'Brynfríður', 'Bryngerður', 'Brynheiður', 'Brynhildur', 'Brynja', 'Brynný', 'Burkney', 'Bylgja', 'Camilla', 'Carla', 'Carmen', 'Cecilia', 'Cecilía', 'Charlotta', 'Charlotte', 'Christina', 'Christine', 'Clara', 'Daðey', 'Daðína', 'Dagbjörg', 'Dagbjört', 'Dagfríður', 'Daggrós', 'Dagheiður', 'Dagmar', 'Dagmey', 'Dagný', 'Dagrún', 'Daldís', 'Daley', 'Dalía', 'Dalla', 'Dallilja', 'Dalrós', 'Dana', 'Daney', 'Danfríður', 'Danheiður', 'Danhildur', 'Danía', 'Daníela', 'Daníella', 'Dara', 'Debora', 'Debóra', 'Dendý', 'Didda', 'Dilja', 'Diljá', 'Dimmblá', 'Dimmey', 'Día', 'Díana', 'Díanna', 'Díma', 'Dís', 'Dísa', 'Dísella', 'Donna', 'Doris', 'Dorothea', 'Dóa', 'Dómhildur', 'Dóra', 'Dórey', 'Dóris', 'Dórothea', 'Dórótea', 'Dóróthea', 'Drauma', 'Draumey', 'Drífa', 'Droplaug', 'Drótt', 'Dröfn', 'Dúa', 'Dúfa', 'Dúna', 'Dýrborg', 'Dýrfinna', 'Dýrleif', 'Dýrley', 'Dýrunn', 'Dæja', 'Dögg', 'Dögun', 'Ebba', 'Ebonney', 'Edda', 'Edel', 'Edil', 'Edit', 'Edith', 'Eðna', 'Efemía', 'Egedía', 'Eggrún', 'Egla', 'Eiðný', 'Eiðunn', 'Eik', 'Einbjörg', 'Eindís', 'Einey', 'Einfríður', 'Einhildur', 'Einína', 'Einrún', 'Eir', 'Eirdís', 'Eirfinna', 'Eiríka', 'Eirný', 'Eirún', 'Elba', 'Eldbjörg', 'Eldey', 'Eldlilja', 'Eldrún', 'Eleina', 'Elektra', 'Elena', 'Elenborg', 'Elfa', 'Elfur', 'Elina', 'Elinborg', 'Elisabeth', 'Elía', 'Elíana', 'Elín', 'Elína', 'Elíná', 'Elínbet', 'Elínbjörg', 'Elínbjört', 'Elínborg', 'Elíndís', 'Elíngunnur', 'Elínheiður', 'Elínrós', 'Elírós', 'Elísa', 'Elísabet', 'Elísabeth', 'Elka', 'Ella', 'Ellen', 'Elley', 'Ellisif', 'Ellín', 'Elly', 'Ellý', 'Elma', 'Elna', 'Elsa', 'Elsabet', 'Elsie', 'Elsí', 'Elsý', 'Elva', 'Elvi', 'Elvíra', 'Elvý', 'Embla', 'Emelía', 'Emelíana', 'Emelína', 'Emeralda', 'Emilía', 'Emilíana', 'Emilíanna', 'Emilý', 'Emma', 'Emmý', 'Emý', 'Enea', 'Eneka', 'Engilbjört', 'Engilráð', 'Engilrós', 'Engla', 'Enika', 'Enja', 'Enóla', 'Eres', 'Erika', 'Erin', 'Erla', 'Erlen', 'Erlín', 'Erna', 'Esja', 'Esmeralda', 'Ester', 'Esther', 'Estiva', 'Ethel', 'Etna', 'Eufemía', 'Eva', 'Evelyn', 'Evey', 'Evfemía', 'Evgenía', 'Evíta', 'Evlalía', 'Ey', 'Eybjörg', 'Eybjört', 'Eydís', 'Eyfríður', 'Eygerður', 'Eygló', 'Eyhildur', 'Eyja', 'Eyjalín', 'Eyleif', 'Eylín', 'Eyrós', 'Eyrún', 'Eyveig', 'Eyvör', 'Eyþóra', 'Eyþrúður', 'Fanndís', 'Fanney', 'Fannlaug', 'Fanny', 'Fanný', 'Febrún', 'Fema', 'Filipía', 'Filippa', 'Filippía', 'Finna', 'Finnbjörg', 'Finnbjörk', 'Finnboga', 'Finnborg', 'Finndís', 'Finney', 'Finnfríður', 'Finnlaug', 'Finnrós', 'Fía', 'Fídes', 'Fífa', 'Fjalldís', 'Fjóla', 'Flóra', 'Folda', 'Fransiska', 'Franziska', 'Frán', 'Fregn', 'Freydís', 'Freygerður', 'Freyja', 'Freylaug', 'Freyleif', 'Friðbjörg', 'Friðbjört', 'Friðborg', 'Friðdís', 'Friðdóra', 'Friðey', 'Friðfinna', 'Friðgerður', 'Friðjóna', 'Friðlaug', 'Friðleif', 'Friðlín', 'Friðmey', 'Friðný', 'Friðrika', 'Friðrikka', 'Friðrós', 'Friðrún', 'Friðsemd', 'Friðveig', 'Friðþóra', 'Frigg', 'Fríða', 'Fríður', 'Frostrós', 'Fróðný', 'Fura', 'Fönn', 'Gabríela', 'Gabríella', 'Gauja', 'Gauthildur', 'Gefjun', 'Gefn', 'Geira', 'Geirbjörg', 'Geirdís', 'Geirfinna', 'Geirfríður', 'Geirhildur', 'Geirlaug', 'Geirlöð', 'Geirný', 'Geirríður', 'Geirrún', 'Geirþrúður', 'Georgía', 'Gerða', 'Gerður', 'Gestheiður', 'Gestný', 'Gestrún', 'Gillý', 'Gilslaug', 'Gissunn', 'Gía', 'Gígja', 'Gísela', 'Gísla', 'Gísley', 'Gíslína', 'Gíslný', 'Gíslrún', 'Gíslunn', 'Gíta', 'Gjaflaug', 'Gloría', 'Gló', 'Glóa', 'Glóbjört', 'Glódís', 'Glóð', 'Glóey', 'Gná', 'Góa', 'Gógó', 'Grein', 'Gret', 'Greta', 'Grélöð', 'Grét', 'Gréta', 'Gríma', 'Grímey', 'Grímheiður', 'Grímhildur', 'Gróa', 'Guðbjörg', 'Guðbjört', 'Guðborg', 'Guðdís', 'Guðfinna', 'Guðfríður', 'Guðjóna', 'Guðlaug', 'Guðleif', 'Guðlín', 'Guðmey', 'Guðmunda', 'Guðmundína', 'Guðný', 'Guðríður', 'Guðrún', 'Guðsteina', 'Guðveig', 'Gullbrá', 'Gullveig', 'Gullý', 'Gumma', 'Gunnbjörg', 'Gunnbjört', 'Gunnborg', 'Gunndís', 'Gunndóra', 'Gunnella', 'Gunnfinna', 'Gunnfríður', 'Gunnharða', 'Gunnheiður', 'Gunnhildur', 'Gunnjóna', 'Gunnlaug', 'Gunnleif', 'Gunnlöð', 'Gunnrún', 'Gunnur', 'Gunnveig', 'Gunnvör', 'Gunný', 'Gunnþóra', 'Gunnþórunn', 'Gurrý', 'Gúa', 'Gyða', 'Gyðja', 'Gyðríður', 'Gytta', 'Gæfa', 'Gæflaug', 'Hadda', 'Haddý', 'Hafbjörg', 'Hafborg', 'Hafdís', 'Hafey', 'Hafliða', 'Haflína', 'Hafný', 'Hafrós', 'Hafrún', 'Hafsteina', 'Hafþóra', 'Halla', 'Hallbera', 'Hallbjörg', 'Hallborg', 'Halldís', 'Halldóra', 'Halley', 'Hallfríður', 'Hallgerður', 'Hallgunnur', 'Hallkatla', 'Hallný', 'Hallrún', 'Hallveig', 'Hallvör', 'Hanna', 'Hanney', 'Hansa', 'Hansína', 'Harpa', 'Hauður', 'Hákonía', 'Heba', 'Hedda', 'Hedí', 'Heiða', 'Heiðbjörg', 'Heiðbjörk', 'Heiðbjört', 'Heiðbrá', 'Heiðdís', 'Heiðlaug', 'Heiðlóa', 'Heiðný', 'Heiðrós', 'Heiðrún', 'Heiður', 'Heiðveig', 'Hekla', 'Helen', 'Helena', 'Helga', 'Hella', 'Helma', 'Hendrikka', 'Henný', 'Henrietta', 'Henrika', 'Henríetta', 'Hera', 'Herbjörg', 'Herbjört', 'Herborg', 'Herdís', 'Herfríður', 'Hergerður', 'Herlaug', 'Hermína', 'Hersilía', 'Herta', 'Hertha', 'Hervör', 'Herþrúður', 'Hilda', 'Hildegard', 'Hildibjörg', 'Hildigerður', 'Hildigunnur', 'Hildiríður', 'Hildisif', 'Hildur', 'Hilma', 'Himinbjörg', 'Hind', 'Hinrika', 'Hinrikka', 'Hjalta', 'Hjaltey', 'Hjálmdís', 'Hjálmey', 'Hjálmfríður', 'Hjálmgerður', 'Hjálmrós', 'Hjálmrún', 'Hjálmveig', 'Hjördís', 'Hjörfríður', 'Hjörleif', 'Hjörný', 'Hjörtfríður', 'Hlaðgerður', 'Hlédís', 'Hlíf', 'Hlín', 'Hlökk', 'Hólmbjörg', 'Hólmdís', 'Hólmfríður', 'Hrafna', 'Hrafnborg', 'Hrafndís', 'Hrafney', 'Hrafngerður', 'Hrafnheiður', 'Hrafnhildur', 'Hrafnkatla', 'Hrafnlaug', 'Hrafntinna', 'Hraundís', 'Hrefna', 'Hreindís', 'Hróðný', 'Hrólfdís', 'Hrund', 'Hrönn', 'Hugbjörg', 'Hugbjört', 'Hugborg', 'Hugdís', 'Hugljúf', 'Hugrún', 'Huld', 'Hulda', 'Huldís', 'Huldrún', 'Húnbjörg', 'Húndís', 'Húngerður', 'Hvönn', 'Hödd', 'Högna', 'Hörn', 'Ida', 'Idda', 'Iða', 'Iðunn', 'Ilmur', 'Immý', 'Ina', 'Inda', 'India', 'Indiana', 'Indía', 'Indíana', 'Indíra', 'Indra', 'Inga', 'Ingdís', 'Ingeborg', 'Inger', 'Ingey', 'Ingheiður', 'Inghildur', 'Ingibjörg', 'Ingibjört', 'Ingiborg', 'Ingifinna', 'Ingifríður', 'Ingigerður', 'Ingilaug', 'Ingileif', 'Ingilín', 'Ingimaría', 'Ingimunda', 'Ingiríður', 'Ingirós', 'Ingisól', 'Ingiveig', 'Ingrid', 'Ingrún', 'Ingunn', 'Ingveldur', 'Inna', 'Irena', 'Irene', 'Irja', 'Irma', 'Irmý', 'Irpa', 'Isabel', 'Isabella', 'Ída', 'Íma', 'Ína', 'Ír', 'Íren', 'Írena', 'Íris', 'Írunn', 'Ísabel', 'Ísabella', 'Ísadóra', 'Ísafold', 'Ísalind', 'Ísbjörg', 'Ísdís', 'Ísey', 'Ísfold', 'Ísgerður', 'Íshildur', 'Ísis', 'Íslaug', 'Ísleif', 'Ísmey', 'Ísold', 'Ísól', 'Ísrún', 'Íssól', 'Ísveig', 'Íunn', 'Íva', 'Jakobína', 'Jana', 'Jane', 'Janetta', 'Jannika', 'Jara', 'Jarún', 'Jarþrúður', 'Jasmín', 'Járnbrá', 'Járngerður', 'Jenetta', 'Jenna', 'Jenný', 'Jensína', 'Jessý', 'Jovina', 'Jóa', 'Jóanna', 'Jódís', 'Jófríður', 'Jóhanna', 'Jólín', 'Jóna', 'Jónanna', 'Jónasína', 'Jónbjörg', 'Jónbjört', 'Jóndís', 'Jóndóra', 'Jóney', 'Jónfríður', 'Jóngerð', 'Jónheiður', 'Jónhildur', 'Jóninna', 'Jónída', 'Jónína', 'Jónný', 'Jóný', 'Jóra', 'Jóríður', 'Jórlaug', 'Jórunn', 'Jósebína', 'Jósefín', 'Jósefína', 'Judith', 'Júdea', 'Júdit', 'Júlía', 'Júlíana', 'Júlíanna', 'Júlíetta', 'Júlírós', 'Júnía', 'Júníana', 'Jökla', 'Jökulrós', 'Jörgína', 'Kaðlín', 'Kaja', 'Kalla', 'Kamilla', 'Kamí', 'Kamma', 'Kapitola', 'Kapítóla', 'Kara', 'Karen', 'Karin', 'Karitas', 'Karí', 'Karín', 'Karína', 'Karítas', 'Karla', 'Karlinna', 'Karlína', 'Karlotta', 'Karolína', 'Karó', 'Karólín', 'Karólína', 'Kassandra', 'Kata', 'Katarína', 'Katerína', 'Katharina', 'Kathinka', 'Katinka', 'Katla', 'Katrín', 'Katrína', 'Katý', 'Kára', 'Kellý', 'Kendra', 'Ketilbjörg', 'Ketilfríður', 'Ketilríður', 'Kiddý', 'Kira', 'Kirsten', 'Kirstín', 'Kittý', 'Kjalvör', 'Klara', 'Kládía', 'Klementína', 'Kleópatra', 'Kolbjörg', 'Kolbrá', 'Kolbrún', 'Koldís', 'Kolfinna', 'Kolfreyja', 'Kolgríma', 'Kolka', 'Konkordía', 'Konný', 'Korka', 'Kormlöð', 'Kornelía', 'Kókó', 'Krista', 'Kristbjörg', 'Kristborg', 'Kristel', 'Kristensa', 'Kristey', 'Kristfríður', 'Kristgerður', 'Kristin', 'Kristine', 'Kristíana', 'Kristíanna', 'Kristín', 'Kristína', 'Kristjana', 'Kristjóna', 'Kristlaug', 'Kristlind', 'Kristlín', 'Kristný', 'Kristólína', 'Kristrós', 'Kristrún', 'Kristveig', 'Kristvina', 'Kristþóra', 'Kría', 'Kæja', 'Laila', 'Laíla', 'Lana', 'Lara', 'Laufey', 'Laufheiður', 'Laufhildur', 'Lauga', 'Laugey', 'Laugheiður', 'Lára', 'Lárensína', 'Láretta', 'Lárey', 'Lea', 'Leikný', 'Leila', 'Lena', 'Leonóra', 'Leóna', 'Leónóra', 'Lilja', 'Liljá', 'Liljurós', 'Lill', 'Lilla', 'Lillian', 'Lillý', 'Lily', 'Lilý', 'Lind', 'Linda', 'Linddís', 'Lingný', 'Lisbeth', 'Listalín', 'Liv', 'Líba', 'Líf', 'Lífdís', 'Lín', 'Lína', 'Línbjörg', 'Líndís', 'Líneik', 'Líney', 'Línhildur', 'Lísa', 'Lísabet', 'Lísandra', 'Lísbet', 'Lísebet', 'Lív', 'Ljósbjörg', 'Ljósbrá', 'Ljótunn', 'Lofn', 'Loftveig', 'Logey', 'Lokbrá', 'Lotta', 'Louisa', 'Lousie', 'Lovísa', 'Lóa', 'Lóreley', 'Lukka', 'Lúcía', 'Lúðvíka', 'Lúísa', 'Lúna', 'Lúsinda', 'Lúsía', 'Lúvísa', 'Lydia', 'Lydía', 'Lyngheiður', 'Lýdía', 'Læla', 'Maddý', 'Magda', 'Magdalena', 'Magðalena', 'Magga', 'Maggey', 'Maggý', 'Magna', 'Magndís', 'Magnea', 'Magnes', 'Magney', 'Magnfríður', 'Magnheiður', 'Magnhildur', 'Magnúsína', 'Magný', 'Magnþóra', 'Maía', 'Maídís', 'Maísól', 'Maj', 'Maja', 'Malen', 'Malena', 'Malía', 'Malín', 'Malla', 'Manda', 'Manúela', 'Mara', 'Mardís', 'Marela', 'Marella', 'Maren', 'Marey', 'Marfríður', 'Margit', 'Margot', 'Margret', 'Margrét', 'Margrjet', 'Margunnur', 'Marheiður', 'Maria', 'Marie', 'Marikó', 'Marinella', 'Marit', 'Marí', 'María', 'Maríam', 'Marían', 'Maríana', 'Maríanna', 'Marín', 'Marína', 'Marínella', 'Maríon', 'Marísa', 'Marísól', 'Marít', 'Maríuerla', 'Marja', 'Markrún', 'Marlaug', 'Marlena', 'Marlín', 'Marlís', 'Marólína', 'Marsa', 'Marselía', 'Marselína', 'Marsibil', 'Marsilía', 'Marsý', 'Marta', 'Martha', 'Martína', 'Mary', 'Marý', 'Matta', 'Mattea', 'Matthea', 'Matthilda', 'Matthildur', 'Matthía', 'Mattíana', 'Mattína', 'Mattý', 'Maxima', 'Mábil', 'Málfríður', 'Málhildur', 'Málmfríður', 'Mánadís', 'Máney', 'Mára', 'Meda', 'Mekkin', 'Mekkín', 'Melinda', 'Melissa', 'Melkorka', 'Melrós', 'Messíana', 'Metta', 'Mey', 'Mikaela', 'Mikaelína', 'Mikkalína', 'Milda', 'Mildríður', 'Milla', 'Millý', 'Minerva', 'Minna', 'Minney', 'Minný', 'Miriam', 'Mirja', 'Mirjam', 'Mirra', 'Mist', 'Mía', 'Mínerva', 'Míra', 'Míranda', 'Mítra', 'Mjaðveig', 'Mjalldís', 'Mjallhvít', 'Mjöll', 'Mona', 'Monika', 'Módís', 'Móeiður', 'Móey', 'Móheiður', 'Móna', 'Mónika', 'Móníka', 'Munda', 'Mundheiður', 'Mundhildur', 'Mundína', 'Myrra', 'Mýr', 'Mýra', 'Mýrún', 'Mörk', 'Nadia', 'Nadía', 'Nadja', 'Nana', 'Nanna', 'Nanný', 'Nansý', 'Naomí', 'Naómí', 'Natalie', 'Natalía', 'Náttsól', 'Nella', 'Nellý', 'Nenna', 'Nicole', 'Niðbjörg', 'Nikíta', 'Nikoletta', 'Nikólína', 'Ninja', 'Ninna', 'Nína', 'Níní', 'Njála', 'Njóla', 'Norma', 'Nóa', 'Nóra', 'Nótt', 'Nýbjörg', 'Odda', 'Oddbjörg', 'Oddfreyja', 'Oddfríður', 'Oddgerður', 'Oddhildur', 'Oddlaug', 'Oddleif', 'Oddný', 'Oddrún', 'Oddveig', 'Oddvör', 'Oktavía', 'Októvía', 'Olga', 'Ollý', 'Ora', 'Orka', 'Ormheiður', 'Ormhildur', 'Otkatla', 'Otta', 'Óda', 'Ófelía', 'Óla', 'Ólafía', 'Ólafína', 'Ólavía', 'Ólivía', 'Ólína', 'Ólöf', 'Ósa', 'Ósk', 'Ótta', 'Pamela', 'París', 'Patricia', 'Patrisía', 'Pála', 'Páldís', 'Páley', 'Pálfríður', 'Pálhanna', 'Pálheiður', 'Pálhildur', 'Pálín', 'Pálína', 'Pálmey', 'Pálmfríður', 'Pálrún', 'Perla', 'Peta', 'Petra', 'Petrea', 'Petrína', 'Petronella', 'Petrónella', 'Petrós', 'Petrún', 'Petrúnella', 'Pétrína', 'Pétrún', 'Pía', 'Polly', 'Pollý', 'Pría', 'Rafney', 'Rafnhildur', 'Ragna', 'Ragnbjörg', 'Ragney', 'Ragnfríður', 'Ragnheiður', 'Ragnhildur', 'Rakel', 'Ramóna', 'Randalín', 'Randíður', 'Randý', 'Ranka', 'Rannva', 'Rannveig', 'Ráðhildur', 'Rán', 'Rebekka', 'Reginbjörg', 'Regína', 'Rein', 'Renata', 'Reyn', 'Reyndís', 'Reynheiður', 'Reynhildur', 'Rikka', 'Ripley', 'Rita', 'Ríkey', 'Rín', 'Ríta', 'Ronja', 'Rorí', 'Roxanna', 'Róberta', 'Róbjörg', 'Rós', 'Rósa', 'Rósalind', 'Rósanna', 'Rósbjörg', 'Rósborg', 'Róselía', 'Rósey', 'Rósfríður', 'Róshildur', 'Rósinkara', 'Rósinkransa', 'Róska', 'Róslaug', 'Róslind', 'Róslinda', 'Róslín', 'Rósmary', 'Rósmarý', 'Rósmunda', 'Rósný', 'Runný', 'Rut', 'Ruth', 'Rúbý', 'Rún', 'Rúna', 'Rúndís', 'Rúnhildur', 'Rúrí', 'Röfn', 'Rögn', 'Röskva', 'Sabína', 'Sabrína', 'Saga', 'Salbjörg', 'Saldís', 'Salgerður', 'Salín', 'Salína', 'Salka', 'Salma', 'Salný', 'Salome', 'Salóme', 'Salvör', 'Sandra', 'Sanna', 'Santía', 'Sara', 'Sarína', 'Sefanía', 'Selja', 'Selka', 'Selma', 'Senía', 'Septíma', 'Sera', 'Serena', 'Seselía', 'Sesilía', 'Sesselía', 'Sesselja', 'Sessilía', 'Sif', 'Sigdís', 'Sigdóra', 'Sigfríð', 'Sigfríður', 'Sigga', 'Siggerður', 'Sigmunda', 'Signa', 'Signhildur', 'Signý', 'Sigríður', 'Sigrún', 'Sigurást', 'Sigurásta', 'Sigurbára', 'Sigurbirna', 'Sigurbjörg', 'Sigurbjört', 'Sigurborg', 'Sigurdís', 'Sigurdóra', 'Sigurdríf', 'Sigurdrífa', 'Sigurða', 'Sigurey', 'Sigurfinna', 'Sigurfljóð', 'Sigurgeira', 'Sigurhanna', 'Sigurhelga', 'Sigurhildur', 'Sigurjóna', 'Sigurlaug', 'Sigurleif', 'Sigurlilja', 'Sigurlinn', 'Sigurlín', 'Sigurlína', 'Sigurmunda', 'Sigurnanna', 'Sigurósk', 'Sigurrós', 'Sigursteina', 'Sigurunn', 'Sigurveig', 'Sigurvina', 'Sigurþóra', 'Sigyn', 'Sigþóra', 'Sigþrúður', 'Silfa', 'Silfá', 'Silfrún', 'Silja', 'Silka', 'Silla', 'Silva', 'Silvana', 'Silvía', 'Sirra', 'Sirrý', 'Siv', 'Sía', 'Símonía', 'Sísí', 'Síta', 'Sjöfn', 'Skarpheiður', 'Skugga', 'Skuld', 'Skúla', 'Skúlína', 'Snjáfríður', 'Snjáka', 'Snjófríður', 'Snjólaug', 'Snorra', 'Snót', 'Snæbjörg', 'Snæbjört', 'Snæborg', 'Snæbrá', 'Snædís', 'Snæfríður', 'Snælaug', 'Snærós', 'Snærún', 'Soffía', 'Sofie', 'Sofía', 'Solveig', 'Sonja', 'Sonný', 'Sophia', 'Sophie', 'Sól', 'Sóla', 'Sólbjörg', 'Sólbjört', 'Sólborg', 'Sólbrá', 'Sólbrún', 'Sóldís', 'Sóldögg', 'Sóley', 'Sólfríður', 'Sólgerður', 'Sólhildur', 'Sólín', 'Sólkatla', 'Sóllilja', 'Sólný', 'Sólrós', 'Sólrún', 'Sólveig', 'Sólvör', 'Sónata', 'Stefana', 'Stefanía', 'Stefánný', 'Steina', 'Steinbjörg', 'Steinborg', 'Steindís', 'Steindóra', 'Steiney', 'Steinfríður', 'Steingerður', 'Steinhildur', 'Steinlaug', 'Steinrós', 'Steinrún', 'Steinunn', 'Steinvör', 'Steinþóra', 'Stella', 'Stígheiður', 'Stígrún', 'Stína', 'Stjarna', 'Styrgerður', 'Sumarlína', 'Sumarrós', 'Sunna', 'Sunnefa', 'Sunneva', 'Sunniva', 'Sunníva', 'Susan', 'Súla', 'Súsan', 'Súsanna', 'Svafa', 'Svala', 'Svalrún', 'Svana', 'Svanbjörg', 'Svanbjört', 'Svanborg', 'Svandís', 'Svaney', 'Svanfríður', 'Svanheiður', 'Svanhildur', 'Svanhvít', 'Svanlaug', 'Svanrós', 'Svanþrúður', 'Svava', 'Svea', 'Sveina', 'Sveinbjörg', 'Sveinborg', 'Sveindís', 'Sveiney', 'Sveinfríður', 'Sveingerður', 'Sveinhildur', 'Sveinlaug', 'Sveinrós', 'Sveinrún', 'Sveinsína', 'Sveinveig', 'Sylgja', 'Sylva', 'Sylvía', 'Sæbjörg', 'Sæbjört', 'Sæborg', 'Sædís', 'Sæfinna', 'Sæfríður', 'Sæhildur', 'Sælaug', 'Sæmunda', 'Sæný', 'Særós', 'Særún', 'Sæsól', 'Sæunn', 'Sævör', 'Sölva', 'Sölvey', 'Sölvína', 'Tala', 'Talía', 'Tamar', 'Tamara', 'Tanía', 'Tanja', 'Tanya', 'Tanya', 'Tara', 'Tea', 'Teitný', 'Tekla', 'Telma', 'Tera', 'Teresa', 'Teresía', 'Thea', 'Thelma', 'Theodóra', 'Theódóra', 'Theresa', 'Tindra', 'Tinna', 'Tirsa', 'Tía', 'Tíbrá', 'Tína', 'Todda', 'Torbjörg', 'Torfey', 'Torfheiður', 'Torfhildur', 'Tóbý', 'Tóka', 'Tóta', 'Tristana', 'Trú', 'Tryggva', 'Tryggvína', 'Týra', 'Ugla', 'Una', 'Undína', 'Unna', 'Unnbjörg', 'Unndís', 'Unnur', 'Urður', 'Úa', 'Úlfa', 'Úlfdís', 'Úlfey', 'Úlfheiður', 'Úlfhildur', 'Úlfrún', 'Úlla', 'Úna', 'Úndína', 'Úranía', 'Úrsúla', 'Vagna', 'Vagnbjörg', 'Vagnfríður', 'Vaka', 'Vala', 'Valbjörg', 'Valbjörk', 'Valbjört', 'Valborg', 'Valdheiður', 'Valdís', 'Valentína', 'Valería', 'Valey', 'Valfríður', 'Valgerða', 'Valgerður', 'Valhildur', 'Valka', 'Vallý', 'Valný', 'Valrós', 'Valrún', 'Valva', 'Valý', 'Valþrúður', 'Vanda', 'Vár', 'Veig', 'Veiga', 'Venus', 'Vera', 'Veronika', 'Verónika', 'Veróníka', 'Vetrarrós', 'Vébjörg', 'Védís', 'Végerður', 'Vélaug', 'Véný', 'Vibeka', 'Victoría', 'Viðja', 'Vigdís', 'Vigný', 'Viktoria', 'Viktoría', 'Vilborg', 'Vildís', 'Vilfríður', 'Vilgerður', 'Vilhelmína', 'Villa', 'Villimey', 'Vilma', 'Vilný', 'Vinbjörg', 'Vinný', 'Vinsý', 'Virginía', 'Víbekka', 'Víf', 'Vígdögg', 'Víggunnur', 'Víóla', 'Víóletta', 'Vísa', 'Von', 'Von', 'Voney', 'Vordís', 'Ylfa', 'Ylfur', 'Ylja', 'Ylva', 'Ynja', 'Yrja', 'Yrsa', 'Ýja', 'Ýma', 'Ýr', 'Ýrr', 'Þalía', 'Þeba', 'Þeódís', 'Þeódóra', 'Þjóðbjörg', 'Þjóðhildur', 'Þoka', 'Þorbjörg', 'Þorfinna', 'Þorgerður', 'Þorgríma', 'Þorkatla', 'Þorlaug', 'Þorleif', 'Þorsteina', 'Þorstína', 'Þóra', 'Þóranna', 'Þórarna', 'Þórbjörg', 'Þórdís', 'Þórða', 'Þórelfa', 'Þórelfur', 'Þórey', 'Þórfríður', 'Þórgunna', 'Þórgunnur', 'Þórhalla', 'Þórhanna', 'Þórheiður', 'Þórhildur', 'Þórkatla', 'Þórlaug', 'Þórleif', 'Þórný', 'Þórodda', 'Þórsteina', 'Þórsteinunn', 'Þórstína', 'Þórunn', 'Þórveig', 'Þórvör', 'Þrá', 'Þrúða', 'Þrúður', 'Þula', 'Þura', 'Þurí', 'Þuríður', 'Þurý', 'Þúfa', 'Þyri', 'Þyrí', 'Þöll', 'Ægileif', 'Æsa', 'Æsgerður', 'Ögmunda', 'Ögn', 'Ölrún', 'Ölveig', 'Örbrún', 'Örk', 'Ösp']; + + /** + * @var array Icelandic names for men. + */ + protected static $firstNameMale = ['Aage', 'Abel', 'Abraham', 'Adam', 'Addi', 'Adel', 'Adíel', 'Adólf', 'Adrían', 'Adríel', 'Aðalberg', 'Aðalbergur', 'Aðalbert', 'Aðalbjörn', 'Aðalborgar', 'Aðalgeir', 'Aðalmundur', 'Aðalráður', 'Aðalsteinn', 'Aðólf', 'Agnar', 'Agni', 'Albert', 'Aldar', 'Alex', 'Alexander', 'Alexíus', 'Alfons', 'Alfred', 'Alfreð', 'Ali', 'Allan', 'Alli', 'Almar', 'Alrekur', 'Alvar', 'Alvin', 'Amír', 'Amos', 'Anders', 'Andreas', 'André', 'Andrés', 'Andri', 'Anes', 'Anfinn', 'Angantýr', 'Angi', 'Annar', 'Annarr', 'Annas', 'Annel', 'Annes', 'Anthony', 'Anton', 'Antoníus', 'Aran', 'Arent', 'Ares', 'Ari', 'Arilíus', 'Arinbjörn', 'Aríel', 'Aríus', 'Arnald', 'Arnaldur', 'Arnar', 'Arnberg', 'Arnbergur', 'Arnbjörn', 'Arndór', 'Arnes', 'Arnfinnur', 'Arnfreyr', 'Arngeir', 'Arngils', 'Arngrímur', 'Arnkell', 'Arnlaugur', 'Arnleifur', 'Arnljótur', 'Arnmóður', 'Arnmundur', 'Arnoddur', 'Arnold', 'Arnór', 'Arnsteinn', 'Arnúlfur', 'Arnviður', 'Arnþór', 'Aron', 'Arthur', 'Arthúr', 'Artúr', 'Asael', 'Askur', 'Aspar', 'Atlas', 'Atli', 'Auðbergur', 'Auðbert', 'Auðbjörn', 'Auðgeir', 'Auðkell', 'Auðmundur', 'Auðólfur', 'Auðun', 'Auðunn', 'Austar', 'Austmann', 'Austmar', 'Austri', 'Axel', 'Ágúst', 'Áki', 'Álfar', 'Álfgeir', 'Álfgrímur', 'Álfur', 'Álfþór', 'Ámundi', 'Árbjartur', 'Árbjörn', 'Árelíus', 'Árgeir', 'Árgils', 'Ármann', 'Árni', 'Ársæll', 'Ás', 'Ásberg', 'Ásbergur', 'Ásbjörn', 'Ásgautur', 'Ásgeir', 'Ásgils', 'Ásgrímur', 'Ási', 'Áskell', 'Áslaugur', 'Áslákur', 'Ásmar', 'Ásmundur', 'Ásólfur', 'Ásröður', 'Ástbjörn', 'Ástgeir', 'Ástmar', 'Ástmundur', 'Ástráður', 'Ástríkur', 'Ástvald', 'Ástvaldur', 'Ástvar', 'Ástvin', 'Ástþór', 'Ásvaldur', 'Ásvarður', 'Ásþór', 'Baldur', 'Baldvin', 'Baldwin', 'Baltasar', 'Bambi', 'Barði', 'Barri', 'Bassi', 'Bastían', 'Baugur', 'Bárður', 'Beinir', 'Beinteinn', 'Beitir', 'Bekan', 'Benedikt', 'Benidikt', 'Benjamín', 'Benoný', 'Benóní', 'Benóný', 'Bent', 'Berent', 'Berg', 'Bergfinnur', 'Berghreinn', 'Bergjón', 'Bergmann', 'Bergmar', 'Bergmundur', 'Bergsteinn', 'Bergsveinn', 'Bergur', 'Bergvin', 'Bergþór', 'Bernhard', 'Bernharð', 'Bernharður', 'Berni', 'Bernódus', 'Bersi', 'Bertel', 'Bertram', 'Bessi', 'Betúel', 'Bill', 'Birgir', 'Birkir', 'Birnir', 'Birtingur', 'Birtir', 'Bjargar', 'Bjargmundur', 'Bjargþór', 'Bjarkan', 'Bjarkar', 'Bjarki', 'Bjarmar', 'Bjarmi', 'Bjarnar', 'Bjarnfinnur', 'Bjarnfreður', 'Bjarnharður', 'Bjarnhéðinn', 'Bjarni', 'Bjarnlaugur', 'Bjarnleifur', 'Bjarnólfur', 'Bjarnsteinn', 'Bjarnþór', 'Bjartmann', 'Bjartmar', 'Bjartur', 'Bjartþór', 'Bjólan', 'Bjólfur', 'Björgmundur', 'Björgólfur', 'Björgúlfur', 'Björgvin', 'Björn', 'Björnólfur', 'Blængur', 'Blær', 'Blævar', 'Boði', 'Bogi', 'Bolli', 'Borgar', 'Borgúlfur', 'Borgþór', 'Bóas', 'Bói', 'Bótólfur', 'Bragi', 'Brandur', 'Breki', 'Bresi', 'Brestir', 'Brimar', 'Brimi', 'Brimir', 'Brími', 'Brjánn', 'Broddi', 'Bruno', 'Bryngeir', 'Brynjar', 'Brynjólfur', 'Brynjúlfur', 'Brynleifur', 'Brynsteinn', 'Bryntýr', 'Brynþór', 'Burkni', 'Búi', 'Búri', 'Bæring', 'Bæringur', 'Bæron', 'Böðvar', 'Börkur', 'Carl', 'Cecil', 'Christian', 'Christopher', 'Cýrus', 'Daði', 'Dagbjartur', 'Dagfari', 'Dagfinnur', 'Daggeir', 'Dagmann', 'Dagnýr', 'Dagur', 'Dagþór', 'Dalbert', 'Dalli', 'Dalmann', 'Dalmar', 'Dalvin', 'Damjan', 'Dan', 'Danelíus', 'Daniel', 'Danival', 'Daníel', 'Daníval', 'Dante', 'Daríus', 'Darri', 'Davíð', 'Demus', 'Deníel', 'Dennis', 'Diðrik', 'Díómedes', 'Dofri', 'Dolli', 'Dominik', 'Dómald', 'Dómaldi', 'Dómaldur', 'Dónald', 'Dónaldur', 'Dór', 'Dóri', 'Dósóþeus', 'Draupnir', 'Dreki', 'Drengur', 'Dufgus', 'Dufþakur', 'Dugfús', 'Dúi', 'Dúnn', 'Dvalinn', 'Dýri', 'Dýrmundur', 'Ebbi', 'Ebeneser', 'Ebenezer', 'Eberg', 'Edgar', 'Edilon', 'Edílon', 'Edvard', 'Edvin', 'Edward', 'Eðvald', 'Eðvar', 'Eðvarð', 'Efraím', 'Eggert', 'Eggþór', 'Egill', 'Eiðar', 'Eiður', 'Eikar', 'Eilífur', 'Einar', 'Einir', 'Einvarður', 'Einþór', 'Eiríkur', 'Eivin', 'Elberg', 'Elbert', 'Eldar', 'Eldgrímur', 'Eldjárn', 'Eldmar', 'Eldon', 'Eldór', 'Eldur', 'Elentínus', 'Elfar', 'Elfráður', 'Elimar', 'Elinór', 'Elis', 'Elí', 'Elías', 'Elíeser', 'Elímar', 'Elínbergur', 'Elínmundur', 'Elínór', 'Elís', 'Ellert', 'Elli', 'Elliði', 'Ellís', 'Elmar', 'Elvar', 'Elvin', 'Elvis', 'Emanúel', 'Embrek', 'Emerald', 'Emil', 'Emmanúel', 'Engilbert', 'Engilbjartur', 'Engiljón', 'Engill', 'Enok', 'Eric', 'Erik', 'Erlar', 'Erlendur', 'Erling', 'Erlingur', 'Ernestó', 'Ernir', 'Ernst', 'Eron', 'Erpur', 'Esekíel', 'Esjar', 'Esra', 'Estefan', 'Evald', 'Evan', 'Evert', 'Eyberg', 'Eyjólfur', 'Eylaugur', 'Eyleifur', 'Eymar', 'Eymundur', 'Eyríkur', 'Eysteinn', 'Eyvar', 'Eyvindur', 'Eyþór', 'Fabrisíus', 'Falgeir', 'Falur', 'Fannar', 'Fannberg', 'Fanngeir', 'Fáfnir', 'Fálki', 'Felix', 'Fengur', 'Fenrir', 'Ferdinand', 'Ferdínand', 'Fertram', 'Feykir', 'Filip', 'Filippus', 'Finn', 'Finnbjörn', 'Finnbogi', 'Finngeir', 'Finnjón', 'Finnlaugur', 'Finnur', 'Finnvarður', 'Fífill', 'Fjalar', 'Fjarki', 'Fjólar', 'Fjólmundur', 'Fjölnir', 'Fjölvar', 'Fjörnir', 'Flemming', 'Flosi', 'Flóki', 'Flórent', 'Flóvent', 'Forni', 'Fossmar', 'Fólki', 'Francis', 'Frank', 'Franklín', 'Frans', 'Franz', 'Fránn', 'Frár', 'Freybjörn', 'Freygarður', 'Freymar', 'Freymóður', 'Freymundur', 'Freyr', 'Freysteinn', 'Freyviður', 'Freyþór', 'Friðberg', 'Friðbergur', 'Friðbert', 'Friðbjörn', 'Friðfinnur', 'Friðgeir', 'Friðjón', 'Friðlaugur', 'Friðleifur', 'Friðmann', 'Friðmar', 'Friðmundur', 'Friðrik', 'Friðsteinn', 'Friður', 'Friðvin', 'Friðþjófur', 'Friðþór', 'Friedrich', 'Fritz', 'Frímann', 'Frosti', 'Fróði', 'Fróðmar', 'Funi', 'Fúsi', 'Fylkir', 'Gabriel', 'Gabríel', 'Gael', 'Galdur', 'Gamalíel', 'Garðar', 'Garibaldi', 'Garpur', 'Garri', 'Gaui', 'Gaukur', 'Gauti', 'Gautrekur', 'Gautur', 'Gautviður', 'Geir', 'Geirarður', 'Geirfinnur', 'Geirharður', 'Geirhjörtur', 'Geirhvatur', 'Geiri', 'Geirlaugur', 'Geirleifur', 'Geirmundur', 'Geirólfur', 'Geirröður', 'Geirtryggur', 'Geirvaldur', 'Geirþjófur', 'Geisli', 'Gellir', 'Georg', 'Gerald', 'Gerðar', 'Geri', 'Gestur', 'Gilbert', 'Gilmar', 'Gils', 'Gissur', 'Gizur', 'Gídeon', 'Gígjar', 'Gísli', 'Gjúki', 'Glói', 'Glúmur', 'Gneisti', 'Gnúpur', 'Gnýr', 'Goði', 'Goðmundur', 'Gottskálk', 'Gottsveinn', 'Gói', 'Grani', 'Grankell', 'Gregor', 'Greipur', 'Greppur', 'Gretar', 'Grettir', 'Grétar', 'Grímar', 'Grímkell', 'Grímlaugur', 'Grímnir', 'Grímólfur', 'Grímur', 'Grímúlfur', 'Guðberg', 'Guðbergur', 'Guðbjarni', 'Guðbjartur', 'Guðbjörn', 'Guðbrandur', 'Guðfinnur', 'Guðfreður', 'Guðgeir', 'Guðjón', 'Guðlaugur', 'Guðleifur', 'Guðleikur', 'Guðmann', 'Guðmar', 'Guðmon', 'Guðmundur', 'Guðni', 'Guðráður', 'Guðröður', 'Guðsteinn', 'Guðvarður', 'Guðveigur', 'Guðvin', 'Guðþór', 'Gumi', 'Gunnar', 'Gunnberg', 'Gunnbjörn', 'Gunndór', 'Gunngeir', 'Gunnhallur', 'Gunnlaugur', 'Gunnleifur', 'Gunnólfur', 'Gunnóli', 'Gunnröður', 'Gunnsteinn', 'Gunnvaldur', 'Gunnþór', 'Gustav', 'Gutti', 'Guttormur', 'Gústaf', 'Gústav', 'Gylfi', 'Gyrðir', 'Gýgjar', 'Gýmir', 'Haddi', 'Haddur', 'Hafberg', 'Hafgrímur', 'Hafliði', 'Hafnar', 'Hafni', 'Hafsteinn', 'Hafþór', 'Hagalín', 'Hagbarður', 'Hagbert', 'Haki', 'Hallberg', 'Hallbjörn', 'Halldór', 'Hallfreður', 'Hallgarður', 'Hallgeir', 'Hallgils', 'Hallgrímur', 'Hallkell', 'Hallmann', 'Hallmar', 'Hallmundur', 'Hallsteinn', 'Hallur', 'Hallvarður', 'Hallþór', 'Hamar', 'Hannes', 'Hannibal', 'Hans', 'Harald', 'Haraldur', 'Harri', 'Harry', 'Harrý', 'Hartmann', 'Hartvig', 'Hauksteinn', 'Haukur', 'Haukvaldur', 'Hákon', 'Háleygur', 'Hálfdan', 'Hálfdán', 'Hámundur', 'Hárekur', 'Hárlaugur', 'Hásteinn', 'Hávar', 'Hávarður', 'Hávarr', 'Hávarr', 'Heiðar', 'Heiðarr', 'Heiðberg', 'Heiðbert', 'Heiðlindur', 'Heiðmann', 'Heiðmar', 'Heiðmundur', 'Heiðrekur', 'Heikir', 'Heilmóður', 'Heimir', 'Heinrekur', 'Heisi', 'Hektor', 'Helgi', 'Helmút', 'Hemmert', 'Hendrik', 'Henning', 'Henrik', 'Henry', 'Henrý', 'Herbert', 'Herbjörn', 'Herfinnur', 'Hergeir', 'Hergill', 'Hergils', 'Herjólfur', 'Herlaugur', 'Herleifur', 'Herluf', 'Hermann', 'Hermóður', 'Hermundur', 'Hersir', 'Hersteinn', 'Hersveinn', 'Hervar', 'Hervarður', 'Hervin', 'Héðinn', 'Hilaríus', 'Hilbert', 'Hildar', 'Hildibergur', 'Hildibrandur', 'Hildigeir', 'Hildiglúmur', 'Hildimar', 'Hildimundur', 'Hildingur', 'Hildir', 'Hildiþór', 'Hilmar', 'Hilmir', 'Himri', 'Hinrik', 'Híram', 'Hjallkár', 'Hjalti', 'Hjarnar', 'Hjálmar', 'Hjálmgeir', 'Hjálmtýr', 'Hjálmur', 'Hjálmþór', 'Hjörleifur', 'Hjörtur', 'Hjörtþór', 'Hjörvar', 'Hleiðar', 'Hlégestur', 'Hlér', 'Hlini', 'Hlíðar', 'Hlíðberg', 'Hlífar', 'Hljómur', 'Hlynur', 'Hlöðmundur', 'Hlöður', 'Hlöðvarður', 'Hlöðver', 'Hnefill', 'Hnikar', 'Hnikarr', 'Holgeir', 'Holger', 'Holti', 'Hólm', 'Hólmar', 'Hólmbert', 'Hólmfastur', 'Hólmgeir', 'Hólmgrímur', 'Hólmkell', 'Hólmsteinn', 'Hólmþór', 'Hóseas', 'Hrafn', 'Hrafnar', 'Hrafnbergur', 'Hrafnkell', 'Hrafntýr', 'Hrannar', 'Hrappur', 'Hraunar', 'Hreggviður', 'Hreiðar', 'Hreiðmar', 'Hreimur', 'Hreinn', 'Hringur', 'Hrímnir', 'Hrollaugur', 'Hrolleifur', 'Hróaldur', 'Hróar', 'Hróbjartur', 'Hróðgeir', 'Hróðmar', 'Hróðólfur', 'Hróðvar', 'Hrói', 'Hrólfur', 'Hrómundur', 'Hrútur', 'Hrærekur', 'Hugberg', 'Hugi', 'Huginn', 'Hugleikur', 'Hugo', 'Hugó', 'Huldar', 'Huxley', 'Húbert', 'Húgó', 'Húmi', 'Húnbogi', 'Húni', 'Húnn', 'Húnröður', 'Hvannar', 'Hyltir', 'Hylur', 'Hængur', 'Hænir', 'Höður', 'Högni', 'Hörður', 'Höskuldur', 'Illugi', 'Immanúel', 'Indriði', 'Ingberg', 'Ingi', 'Ingiberg', 'Ingibergur', 'Ingibert', 'Ingibjartur', 'Ingibjörn', 'Ingileifur', 'Ingimagn', 'Ingimar', 'Ingimundur', 'Ingivaldur', 'Ingiþór', 'Ingjaldur', 'Ingmar', 'Ingólfur', 'Ingvaldur', 'Ingvar', 'Ingvi', 'Ingþór', 'Ismael', 'Issi', 'Ían', 'Ígor', 'Ími', 'Ísak', 'Ísar', 'Ísarr', 'Ísbjörn', 'Íseldur', 'Ísgeir', 'Ísidór', 'Ísleifur', 'Ísmael', 'Ísmar', 'Ísólfur', 'Ísrael', 'Ívan', 'Ívar', 'Jack', 'Jafet', 'Jaki', 'Jakob', 'Jakop', 'Jamil', 'Jan', 'Janus', 'Jarl', 'Jason', 'Járngrímur', 'Játgeir', 'Játmundur', 'Játvarður', 'Jenni', 'Jens', 'Jeremías', 'Jes', 'Jesper', 'Jochum', 'Johan', 'John', 'Joshua', 'Jóakim', 'Jóann', 'Jóel', 'Jóhann', 'Jóhannes', 'Jói', 'Jómar', 'Jómundur', 'Jón', 'Jónar', 'Jónas', 'Jónatan', 'Jónbjörn', 'Jóndór', 'Jóngeir', 'Jónmundur', 'Jónsteinn', 'Jónþór', 'Jósafat', 'Jósavin', 'Jósef', 'Jósep', 'Jósteinn', 'Jósúa', 'Jóvin', 'Julian', 'Júlí', 'Júlían', 'Júlíus', 'Júní', 'Júníus', 'Júrek', 'Jökull', 'Jörfi', 'Jörgen', 'Jörmundur', 'Jörri', 'Jörundur', 'Jörvar', 'Jörvi', 'Kaj', 'Kakali', 'Kaktus', 'Kaldi', 'Kaleb', 'Kali', 'Kalman', 'Kalmann', 'Kalmar', 'Kaprasíus', 'Karel', 'Karim', 'Karkur', 'Karl', 'Karles', 'Karli', 'Karvel', 'Kaspar', 'Kasper', 'Kastíel', 'Katarínus', 'Kató', 'Kár', 'Kári', 'Keran', 'Ketilbjörn', 'Ketill', 'Kilían', 'Kiljan', 'Kjalar', 'Kjallakur', 'Kjaran', 'Kjartan', 'Kjarval', 'Kjárr', 'Kjói', 'Klemens', 'Klemenz', 'Klængur', 'Knútur', 'Knörr', 'Koðrán', 'Koggi', 'Kolbeinn', 'Kolbjörn', 'Kolfinnur', 'Kolgrímur', 'Kolmar', 'Kolskeggur', 'Kolur', 'Kolviður', 'Konráð', 'Konstantínus', 'Kormákur', 'Kornelíus', 'Kort', 'Kópur', 'Kraki', 'Kris', 'Kristall', 'Kristberg', 'Kristbergur', 'Kristbjörn', 'Kristdór', 'Kristens', 'Krister', 'Kristfinnur', 'Kristgeir', 'Kristian', 'Kristinn', 'Kristján', 'Kristjón', 'Kristlaugur', 'Kristleifur', 'Kristmann', 'Kristmar', 'Kristmundur', 'Kristofer', 'Kristófer', 'Kristvaldur', 'Kristvarður', 'Kristvin', 'Kristþór', 'Krummi', 'Kveldúlfur', 'Lambert', 'Lars', 'Laufar', 'Laugi', 'Lauritz', 'Lár', 'Lárent', 'Lárentíus', 'Lárus', 'Leiðólfur', 'Leif', 'Leifur', 'Leiknir', 'Leo', 'Leon', 'Leonard', 'Leonhard', 'Leó', 'Leópold', 'Leví', 'Lér', 'Liljar', 'Lindar', 'Lindberg', 'Línberg', 'Líni', 'Ljósálfur', 'Ljótur', 'Ljúfur', 'Loðmundur', 'Loftur', 'Logi', 'Loki', 'Lórens', 'Lórenz', 'Ludvig', 'Lundi', 'Lúðvíg', 'Lúðvík', 'Lúkas', 'Lúter', 'Lúther', 'Lyngar', 'Lýður', 'Lýtingur', 'Maggi', 'Magngeir', 'Magni', 'Magnús', 'Magnþór', 'Makan', 'Manfred', 'Manfreð', 'Manúel', 'Mar', 'Marbjörn', 'Marel', 'Margeir', 'Margrímur', 'Mari', 'Marijón', 'Marinó', 'Marías', 'Marínó', 'Marís', 'Maríus', 'Marjón', 'Markó', 'Markús', 'Markþór', 'Maron', 'Marri', 'Mars', 'Marsellíus', 'Marteinn', 'Marten', 'Marthen', 'Martin', 'Marvin', 'Mathías', 'Matthías', 'Matti', 'Mattías', 'Max', 'Maximus', 'Máni', 'Már', 'Márus', 'Mekkinó', 'Melkíor', 'Melkólmur', 'Melrakki', 'Mensalder', 'Merkúr', 'Methúsalem', 'Metúsalem', 'Meyvant', 'Michael', 'Mikael', 'Mikjáll', 'Mikkael', 'Mikkel', 'Mildinberg', 'Mías', 'Mímir', 'Míó', 'Mír', 'Mjöllnir', 'Mjölnir', 'Moli', 'Morgan', 'Moritz', 'Mosi', 'Móði', 'Móri', 'Mórits', 'Móses', 'Muggur', 'Muni', 'Muninn', 'Múli', 'Myrkvi', 'Mýrkjartan', 'Mörður', 'Narfi', 'Natan', 'Natanael', 'Nataníel', 'Náttmörður', 'Náttúlfur', 'Neisti', 'Nenni', 'Neptúnus', 'Nicolas', 'Nikanor', 'Nikolai', 'Nikolas', 'Nikulás', 'Nils', 'Níels', 'Níls', 'Njáll', 'Njörður', 'Nonni', 'Norbert', 'Norðmann', 'Normann', 'Nóam', 'Nóel', 'Nói', 'Nóni', 'Nóri', 'Nóvember', 'Númi', 'Nývarð', 'Nökkvi', 'Oddbergur', 'Oddbjörn', 'Oddfreyr', 'Oddgeir', 'Oddi', 'Oddkell', 'Oddleifur', 'Oddmar', 'Oddsteinn', 'Oddur', 'Oddvar', 'Oddþór', 'Oktavíus', 'Októ', 'Októvíus', 'Olaf', 'Olav', 'Olgeir', 'Oliver', 'Olivert', 'Orfeus', 'Ormar', 'Ormur', 'Orri', 'Orvar', 'Otkell', 'Otri', 'Otti', 'Ottó', 'Otur', 'Óðinn', 'Ófeigur', 'Ólafur', 'Óli', 'Óliver', 'Ólíver', 'Ómar', 'Ómi', 'Óskar', 'Ósvald', 'Ósvaldur', 'Ósvífur', 'Óttar', 'Óttarr', 'Parmes', 'Patrek', 'Patrekur', 'Patrick', 'Patrik', 'Páll', 'Pálmar', 'Pálmi', 'Pedró', 'Per', 'Peter', 'Pétur', 'Pjetur', 'Príor', 'Rafael', 'Rafn', 'Rafnar', 'Rafnkell', 'Ragnar', 'Ragúel', 'Randver', 'Rannver', 'Rasmus', 'Ráðgeir', 'Ráðvarður', 'Refur', 'Reginbaldur', 'Reginn', 'Reidar', 'Reifnir', 'Reimar', 'Reinar', 'Reinhart', 'Reinhold', 'Reynald', 'Reynar', 'Reynir', 'Reyr', 'Richard', 'Rikharð', 'Rikharður', 'Ríkarður', 'Ríkharð', 'Ríkharður', 'Ríó', 'Robert', 'Rolf', 'Ronald', 'Róbert', 'Rólant', 'Róman', 'Rómeó', 'Rósant', 'Rósar', 'Rósberg', 'Rósenberg', 'Rósi', 'Rósinberg', 'Rósinkar', 'Rósinkrans', 'Rósmann', 'Rósmundur', 'Rudolf', 'Runi', 'Runólfur', 'Rúbar', 'Rúben', 'Rúdólf', 'Rúnar', 'Rúrik', 'Rútur', 'Röðull', 'Rögnvald', 'Rögnvaldur', 'Rögnvar', 'Rökkvi', 'Safír', 'Sakarías', 'Salmann', 'Salmar', 'Salómon', 'Salvar', 'Samson', 'Samúel', 'Sandel', 'Sandri', 'Sandur', 'Saxi', 'Sebastian', 'Sebastían', 'Seifur', 'Seimur', 'Sesar', 'Sesil', 'Sigbergur', 'Sigbert', 'Sigbjartur', 'Sigbjörn', 'Sigdór', 'Sigfastur', 'Sigfinnur', 'Sigfreður', 'Sigfús', 'Siggeir', 'Sighvatur', 'Sigjón', 'Siglaugur', 'Sigmann', 'Sigmar', 'Sigmundur', 'Signar', 'Sigri', 'Sigríkur', 'Sigsteinn', 'Sigtryggur', 'Sigtýr', 'Sigur', 'Sigurbaldur', 'Sigurberg', 'Sigurbergur', 'Sigurbjarni', 'Sigurbjartur', 'Sigurbjörn', 'Sigurbrandur', 'Sigurdór', 'Sigurður', 'Sigurfinnur', 'Sigurgeir', 'Sigurgestur', 'Sigurgísli', 'Sigurgrímur', 'Sigurhans', 'Sigurhjörtur', 'Sigurjón', 'Sigurkarl', 'Sigurlaugur', 'Sigurlás', 'Sigurleifur', 'Sigurliði', 'Sigurlinni', 'Sigurmann', 'Sigurmar', 'Sigurmon', 'Sigurmundur', 'Sigurnýas', 'Sigurnýjas', 'Siguroddur', 'Siguróli', 'Sigurpáll', 'Sigursteinn', 'Sigursveinn', 'Sigurvaldi', 'Sigurvin', 'Sigurþór', 'Sigvaldi', 'Sigvarður', 'Sigþór', 'Silli', 'Sindri', 'Símon', 'Sírnir', 'Sírus', 'Sívar', 'Sjafnar', 'Skafti', 'Skapti', 'Skarphéðinn', 'Skefill', 'Skeggi', 'Skíði', 'Skírnir', 'Skjöldur', 'Skorri', 'Skuggi', 'Skúli', 'Skúta', 'Skær', 'Skæringur', 'Smári', 'Smiður', 'Smyrill', 'Snjóki', 'Snjólaugur', 'Snjólfur', 'Snorri', 'Snæbjartur', 'Snæbjörn', 'Snæhólm', 'Snælaugur', 'Snær', 'Snæringur', 'Snævar', 'Snævarr', 'Snæþór', 'Soffanías', 'Sophanías', 'Sophus', 'Sófónías', 'Sófus', 'Sókrates', 'Sólberg', 'Sólbergur', 'Sólbjartur', 'Sólbjörn', 'Sólimann', 'Sólmar', 'Sólmundur', 'Sólon', 'Sólver', 'Sólvin', 'Spartakus', 'Sporði', 'Spói', 'Stanley', 'Stapi', 'Starkaður', 'Starri', 'Stefan', 'Stefán', 'Stefnir', 'Steinar', 'Steinarr', 'Steinberg', 'Steinbergur', 'Steinbjörn', 'Steindór', 'Steinfinnur', 'Steingrímur', 'Steini', 'Steinkell', 'Steinmann', 'Steinmar', 'Steinmóður', 'Steinn', 'Steinólfur', 'Steinröður', 'Steinvarður', 'Steinþór', 'Stirnir', 'Stígur', 'Stormur', 'Stórólfur', 'Sturla', 'Sturlaugur', 'Sturri', 'Styr', 'Styrbjörn', 'Styrkár', 'Styrmir', 'Styrr', 'Sumarliði', 'Svafar', 'Svali', 'Svan', 'Svanberg', 'Svanbergur', 'Svanbjörn', 'Svangeir', 'Svanhólm', 'Svani', 'Svanlaugur', 'Svanmundur', 'Svanur', 'Svanþór', 'Svavar', 'Sváfnir', 'Sveinar', 'Sveinberg', 'Sveinbjartur', 'Sveinbjörn', 'Sveinjón', 'Sveinlaugur', 'Sveinmar', 'Sveinn', 'Sveinungi', 'Sveinþór', 'Svend', 'Sverre', 'Sverrir', 'Svölnir', 'Svörfuður', 'Sýrus', 'Sæberg', 'Sæbergur', 'Sæbjörn', 'Sæi', 'Sælaugur', 'Sæmann', 'Sæmundur', 'Sær', 'Sævald', 'Sævaldur', 'Sævar', 'Sævarr', 'Sævin', 'Sæþór', 'Sölmundur', 'Sölvar', 'Sölvi', 'Sören', 'Sörli', 'Tandri', 'Tarfur', 'Teitur', 'Theodór', 'Theódór', 'Thomas', 'Thor', 'Thorberg', 'Thór', 'Tindar', 'Tindri', 'Tindur', 'Tinni', 'Tími', 'Tímon', 'Tímoteus', 'Tímóteus', 'Tístran', 'Tjaldur', 'Tjörfi', 'Tjörvi', 'Tobías', 'Tolli', 'Tonni', 'Torfi', 'Tóbías', 'Tói', 'Tóki', 'Tómas', 'Tór', 'Trausti', 'Tristan', 'Trostan', 'Trúmann', 'Tryggvi', 'Tumas', 'Tumi', 'Tyrfingur', 'Týr', 'Ubbi', 'Uggi', 'Ulrich', 'Uni', 'Unnar', 'Unnbjörn', 'Unndór', 'Unnsteinn', 'Unnþór', 'Urðar', 'Uxi', 'Úddi', 'Úlfar', 'Úlfgeir', 'Úlfhéðinn', 'Úlfkell', 'Úlfljótur', 'Úlftýr', 'Úlfur', 'Úlrik', 'Úranus', 'Vagn', 'Vakur', 'Valberg', 'Valbergur', 'Valbjörn', 'Valbrandur', 'Valdemar', 'Valdi', 'Valdimar', 'Valdór', 'Valentín', 'Valentínus', 'Valgarð', 'Valgarður', 'Valgeir', 'Valíant', 'Vallaður', 'Valmar', 'Valmundur', 'Valsteinn', 'Valter', 'Valtýr', 'Valur', 'Valves', 'Valþór', 'Varmar', 'Vatnar', 'Váli', 'Vápni', 'Veigar', 'Veigur', 'Ver', 'Vermundur', 'Vernharð', 'Vernharður', 'Vestar', 'Vestmar', 'Veturliði', 'Vébjörn', 'Végeir', 'Vékell', 'Vélaugur', 'Vémundur', 'Vésteinn', 'Victor', 'Viðar', 'Vigfús', 'Viggó', 'Vignir', 'Vigri', 'Vigtýr', 'Vigur', 'Vikar', 'Viktor', 'Vilberg', 'Vilbergur', 'Vilbert', 'Vilbjörn', 'Vilbogi', 'Vilbrandur', 'Vilgeir', 'Vilhelm', 'Vilhjálmur', 'Vili', 'Viljar', 'Vilji', 'Villi', 'Vilmar', 'Vilmundur', 'Vincent', 'Vinjar', 'Virgill', 'Víðar', 'Víðir', 'Vífill', 'Víglundur', 'Vígmar', 'Vígmundur', 'Vígsteinn', 'Vígþór', 'Víkingur', 'Vopni', 'Vorm', 'Vöggur', 'Völundur', 'Vörður', 'Vöttur', 'Walter', 'Werner', 'Wilhelm', 'Willard', 'William', 'Willum', 'Ylur', 'Ymir', 'Yngvar', 'Yngvi', 'Yrkill', 'Ýmir', 'Ýrar', 'Zakaría', 'Zakarías', 'Zophanías', 'Zophonías', 'Zóphanías', 'Zóphonías', 'Þangbrandur', 'Þengill', 'Þeyr', 'Þiðrandi', 'Þiðrik', 'Þinur', 'Þjálfi', 'Þjóðann', 'Þjóðbjörn', 'Þjóðgeir', 'Þjóðleifur', 'Þjóðmar', 'Þjóðólfur', 'Þjóðrekur', 'Þjóðvarður', 'Þjóstar', 'Þjóstólfur', 'Þorberg', 'Þorbergur', 'Þorbjörn', 'Þorbrandur', 'Þorfinnur', 'Þorgarður', 'Þorgautur', 'Þorgeir', 'Þorgestur', 'Þorgils', 'Þorgísl', 'Þorgnýr', 'Þorgrímur', 'Þorkell', 'Þorlaugur', 'Þorlákur', 'Þorleifur', 'Þorleikur', 'Þormar', 'Þormóður', 'Þormundur', 'Þorri', 'Þorsteinn', 'Þorvaldur', 'Þorvar', 'Þorvarður', 'Þór', 'Þórar', 'Þórarinn', 'Þórbergur', 'Þórbjörn', 'Þórður', 'Þórgnýr', 'Þórgrímur', 'Þórhaddur', 'Þórhalli', 'Þórhallur', 'Þórir', 'Þórlaugur', 'Þórleifur', 'Þórlindur', 'Þórmar', 'Þórmundur', 'Þóroddur', 'Þórormur', 'Þórólfur', 'Þórsteinn', 'Þórörn', 'Þrastar', 'Þráinn', 'Þrándur', 'Þróttur', 'Þrúðmar', 'Þrymur', 'Þröstur', 'Þyrnir', 'Ægir', 'Æsir', 'Ævar', 'Ævarr', 'Ögmundur', 'Ögri', 'Ölnir', 'Ölver', 'Ölvir', 'Öndólfur', 'Önundur', 'Örlaugur', 'Örlygur', 'Örn', 'Örnólfur', 'Örvar', 'Össur', 'Öxar']; + + /** + * @var array Icelandic middle names. + */ + protected static $middleName = [ + 'Aðaldal', 'Aldan', 'Arnberg', 'Arnfjörð', 'Austan', 'Austdal', 'Austfjörð', 'Áss', 'Bakkdal', 'Bakkmann', 'Bald', 'Ben', 'Bergholt', 'Bergland', 'Bíldsfells', 'Bjarg', 'Bjarndal', 'Bjarnfjörð', 'Bláfeld', 'Blómkvist', 'Borgdal', 'Brekkmann', 'Brim', 'Brúnsteð', 'Dalhoff', 'Dan', 'Diljan', 'Ektavon', 'Eldberg', 'Elísberg', 'Elvan', 'Espólín', 'Eyhlíð', 'Eyvík', 'Falk', 'Finndal', 'Fossberg', 'Freydal', 'Friðhólm', 'Giljan', 'Gilsfjörð', 'Gnarr', 'Gnurr', 'Grendal', 'Grindvík', 'Gull', 'Haffjörð', 'Hafnes', 'Hafnfjörð', 'Har', 'Heimdal', 'Heimsberg', 'Helgfell', 'Herberg', 'Hildiberg', 'Hjaltdal', 'Hlíðkvist', 'Hnappdal', 'Hnífsdal', 'Hofland', 'Hofteig', 'Hornfjörð', 'Hólmberg', 'Hrafnan', 'Hrafndal', 'Hraunberg', 'Hreinberg', 'Hreindal', 'Hrútfjörð', 'Hvammdal', 'Hvítfeld', 'Höfðdal', 'Hörðdal', 'Íshólm', 'Júl', 'Kjarrval', 'Knaran', 'Knarran', 'Krossdal', 'Laufkvist', 'Laufland', 'Laugdal', 'Laxfoss', 'Liljan', 'Linddal', 'Línberg', 'Ljós', 'Loðmfjörð', 'Lyngberg', 'Magdal', 'Magg', 'Matt', 'Miðdal', 'Miðvík', 'Mjófjörð', 'Móberg', 'Mýrmann', 'Nesmann', 'Norðland', 'Núpdal', 'Ólfjörð', 'Ósland', 'Ósmann', 'Reginbald', 'Reykfell', 'Reykfjörð', 'Reynholt', 'Salberg', 'Sandhólm', 'Seljan', 'Sigurhólm', 'Skagalín', 'Skíðdal', 'Snæberg', 'Snædahl', 'Sólan', 'Stardal', 'Stein', 'Steinbekk', 'Steinberg', 'Storm', 'Straumberg', 'Svanhild', 'Svarfdal', 'Sædal', 'Val', 'Valagils', 'Vald', 'Varmdal', 'Vatnsfjörð', 'Vattar', 'Vattnes', 'Viðfjörð', 'Vídalín', 'Víking', 'Vopnfjörð', 'Yngling', 'Þor', 'Önfjörð', 'Örbekk', 'Öxdal', 'Öxndal', + ]; + + /** + * Randomly return an Icelandic middle name. + * + * @return string + */ + public static function middleName() + { + return static::randomElement(static::$middleName); + } + + /** + * Generate prepared last name for further processing. + * + * @return string + */ + public function lastName() + { + $name = static::firstNameMale(); + + if (substr($name, -2) === 'ur') { + $name = substr($name, 0, strlen($name) - 2); + } + + if (substr($name, -1) !== 's') { + $name .= 's'; + } + + return $name; + } + + /** + * Randomly return an Icelandic last name for a woman. + * + * @return string + */ + public function lastNameMale() + { + return $this->lastName() . 'son'; + } + + /** + * Randomly return an Icelandic last name for a man. + * + * @return string + */ + public function lastNameFemale() + { + return $this->lastName() . 'dóttir'; + } + + /** + * Return a random Icelandic Kennitala (Social Security number). + * + * @see http://en.wikipedia.org/wiki/Kennitala + * + * @return string + */ + public static function ssn() + { + // random birth date + $birthdate = DateTime::dateTimeThisCentury(); + + // last four buffer + $lastFour = null; + + // security variable reference + $ref = '32765432'; + + // valid flag + $valid = false; + + while (!$valid) { + // make two random numbers + $rand = static::randomDigit() . static::randomDigit(); + + // 8 char string with birth date and two random numbers + $tmp = $birthdate->format('dmy') . $rand; + + // loop through temp string + for ($i = 7, $sum = 0; $i >= 0; --$i) { + // calculate security variable + $sum += ($tmp[$i] * $ref[$i]); + } + + // subtract 11 if not 11 + $chk = ($sum % 11 === 0) ? 0 : (11 - ($sum % 11)); + + if ($chk < 10) { + $lastFour = $rand . $chk . substr($birthdate->format('Y'), 1, 1); + + $valid = true; + } + } + + return sprintf('%s-%s', $birthdate->format('dmy'), $lastFour); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/is_IS/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/is_IS/PhoneNumber.php new file mode 100644 index 00000000..7118666e --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/is_IS/PhoneNumber.php @@ -0,0 +1,17 @@ + 'Argovia'], + ['AI' => 'Appenzello Interno'], + ['AR' => 'Appenzello Esterno'], + ['BE' => 'Berna'], + ['BL' => 'Basilea Campagna'], + ['BS' => 'Basilea Città'], + ['FR' => 'Friburgo'], + ['GE' => 'Ginevra'], + ['GL' => 'Glarona'], + ['GR' => 'Grigioni'], + ['JU' => 'Giura'], + ['LU' => 'Lucerna'], + ['NE' => 'Neuchâtel'], + ['NW' => 'Nidvaldo'], + ['OW' => 'Obvaldo'], + ['SG' => 'San Gallo'], + ['SH' => 'Sciaffusa'], + ['SO' => 'Soletta'], + ['SZ' => 'Svitto'], + ['TG' => 'Turgovia'], + ['TI' => 'Ticino'], + ['UR' => 'Uri'], + ['VD' => 'Vaud'], + ['VS' => 'Vallese'], + ['ZG' => 'Zugo'], + ['ZH' => 'Zurigo'], + ]; + + protected static $cityFormats = [ + '{{cityName}}', + ]; + + protected static $streetNameFormats = [ + '{{streetSuffix}} {{firstName}}', + '{{streetSuffix}} {{lastName}}', + ]; + + protected static $streetAddressFormats = [ + '{{streetName}} {{buildingNumber}}', + ]; + protected static $addressFormats = [ + "{{streetAddress}}\n{{postcode}} {{city}}", + ]; + + /** + * Returns a random street prefix + * + * @example Via + * + * @return string + */ + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + /** + * Returns a random city name. + * + * @example Luzern + * + * @return string + */ + public function cityName() + { + return static::randomElement(static::$cityNames); + } + + /** + * Returns a canton + * + * @example array('BE' => 'Bern') + * + * @return array + */ + public static function canton() + { + return static::randomElement(static::$canton); + } + + /** + * Returns the abbreviation of a canton. + * + * @return string + */ + public static function cantonShort() + { + $canton = static::canton(); + + return key($canton); + } + + /** + * Returns the name of canton. + * + * @return string + */ + public static function cantonName() + { + $canton = static::canton(); + + return current($canton); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/it_CH/Company.php b/vendor/fakerphp/faker/src/Faker/Provider/it_CH/Company.php new file mode 100644 index 00000000..bb5f9460 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/it_CH/Company.php @@ -0,0 +1,15 @@ +generator->parse($format); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ja_JP/Company.php b/vendor/fakerphp/faker/src/Faker/Provider/ja_JP/Company.php new file mode 100644 index 00000000..0e4b88df --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ja_JP/Company.php @@ -0,0 +1,17 @@ +generator->parse($format)); + } + + /** + * @example 'yamada.jp' + */ + public function domainName() + { + return static::randomElement(static::$lastNameAscii) . '.' . $this->tld(); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ja_JP/Person.php b/vendor/fakerphp/faker/src/Faker/Provider/ja_JP/Person.php new file mode 100644 index 00000000..399e5595 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ja_JP/Person.php @@ -0,0 +1,147 @@ +generator->parse($format); + } + + /** + * @param string|null $gender 'male', 'female' or null for any + * + * @return string + * + * @example 'アキラ' + */ + public function firstKanaName($gender = null) + { + if ($gender === static::GENDER_MALE) { + return static::firstKanaNameMale(); + } + + if ($gender === static::GENDER_FEMALE) { + return static::firstKanaNameFemale(); + } + + return $this->generator->parse(static::randomElement(static::$firstKanaNameFormat)); + } + + /** + * @example 'アキラ' + */ + public static function firstKanaNameMale() + { + return static::randomElement(static::$firstKanaNameMale); + } + + /** + * @example 'アケミ' + */ + public static function firstKanaNameFemale() + { + return static::randomElement(static::$firstKanaNameFemale); + } + + /** + * @example 'アオタ' + */ + public static function lastKanaName() + { + return static::randomElement(static::$lastKanaName); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ja_JP/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/ja_JP/PhoneNumber.php new file mode 100644 index 00000000..1e0595e0 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ja_JP/PhoneNumber.php @@ -0,0 +1,19 @@ +generator->parse($format); + } + + public static function companyPrefix() + { + return static::randomElement(static::$companyPrefixes); + } + + public static function companyNameElement() + { + return static::randomElement(static::$companyElements); + } + + public static function companyNameSuffix() + { + return static::randomElement(static::$companyNameSuffixes); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ka_GE/DateTime.php b/vendor/fakerphp/faker/src/Faker/Provider/ka_GE/DateTime.php new file mode 100644 index 00000000..375c32a7 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ka_GE/DateTime.php @@ -0,0 +1,43 @@ + 'კვირა', + 'Monday' => 'ორშაბათი', + 'Tuesday' => 'სამშაბათი', + 'Wednesday' => 'ოთხშაბათი', + 'Thursday' => 'ხუთშაბათი', + 'Friday' => 'პარასკევი', + 'Saturday' => 'შაბათი', + ]; + $week = static::dateTime($max)->format('l'); + + return $map[$week] ?? $week; + } + + public static function monthName($max = 'now') + { + $map = [ + 'January' => 'იანვარი', + 'February' => 'თებერვალი', + 'March' => 'მარტი', + 'April' => 'აპრილი', + 'May' => 'მაისი', + 'June' => 'ივნისი', + 'July' => 'ივლისი', + 'August' => 'აგვისტო', + 'September' => 'სექტემბერი', + 'October' => 'ოქტომბერი', + 'November' => 'ნოემბერი', + 'December' => 'დეკემბერი', + ]; + $month = static::dateTime($max)->format('F'); + + return $map[$month] ?? $month; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ka_GE/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/ka_GE/Internet.php new file mode 100644 index 00000000..d07e41cc --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ka_GE/Internet.php @@ -0,0 +1,15 @@ +generator->parse($format); + } + + public static function companyPrefix() + { + return static::randomElement(static::$companyPrefixes); + } + + public static function companyNameElement() + { + return static::randomElement(static::$companyElements); + } + + public static function companyNameSuffix() + { + return static::randomElement(static::$companyNameSuffixes); + } + + /** + * National Business Identification Numbers + * + * @see http://egov.kz/wps/portal/Content?contentPath=%2Fegovcontent%2Fbus_business%2Ffor_businessmen%2Farticle%2Fbusiness_identification_number&lang=en + * + * @return string 12 digits, like 150140000019 + */ + public static function businessIdentificationNumber(\DateTime $registrationDate = null) + { + if (!$registrationDate) { + $registrationDate = \Faker\Provider\DateTime::dateTimeThisYear(); + } + + $dateAsString = $registrationDate->format('ym'); + $legalEntityType = (string) self::numberBetween(4, 6); + $legalEntityAdditionalType = (string) self::numberBetween(0, 3); + $randomDigits = (string) static::numerify('######'); + + return $dateAsString . $legalEntityType . $legalEntityAdditionalType . $randomDigits; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/kk_KZ/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/kk_KZ/Internet.php new file mode 100644 index 00000000..0328da09 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/kk_KZ/Internet.php @@ -0,0 +1,9 @@ + [ + self::CENTURY_19TH => self::MALE_CENTURY_19TH, + self::CENTURY_20TH => self::MALE_CENTURY_20TH, + self::CENTURY_21ST => self::MALE_CENTURY_21ST, + ], + self::GENDER_FEMALE => [ + self::CENTURY_19TH => self::FEMALE_CENTURY_19TH, + self::CENTURY_20TH => self::FEMALE_CENTURY_20TH, + self::CENTURY_21ST => self::FEMALE_CENTURY_21ST, + ], + ]; + + /** + * @see https://ru.wikipedia.org/wiki/%D0%9A%D0%B0%D0%B7%D0%B0%D1%85%D1%81%D0%BA%D0%B0%D1%8F_%D1%84%D0%B0%D0%BC%D0%B8%D0%BB%D0%B8%D1%8F + * + * @var array + */ + protected static $maleNameFormats = [ + '{{lastName}}ұлы {{firstNameMale}}', + ]; + + /** + * @see https://ru.wikipedia.org/wiki/%D0%9A%D0%B0%D0%B7%D0%B0%D1%85%D1%81%D0%BA%D0%B0%D1%8F_%D1%84%D0%B0%D0%BC%D0%B8%D0%BB%D0%B8%D1%8F + * + * @var array + */ + protected static $femaleNameFormats = [ + '{{lastName}}қызы {{firstNameFemale}}', + ]; + + /** + * @see http://koshpendi.kz/index.php/nomad/imena/ + * + * @var array + */ + protected static $firstNameMale = [ + 'Аылғазы', + 'Әбдіқадыр', + 'Бабағожа', + 'Ғайса', + 'Дәмен', + 'Егізбек', + 'Жазылбек', + 'Зұлпықар', + 'Игісін', + 'Кәдіржан', + 'Қадырқан', + 'Латиф', + 'Мағаз', + 'Нармағамбет', + 'Оңалбай', + 'Өндіріс', + 'Пердебек', + 'Рақат', + 'Сағындық', + 'Танабай', + 'Уайыс', + 'Ұйықбай', + 'Үрімбай', + 'Файзрахман', + 'Хангелді', + 'Шаттық', + 'Ыстамбақы', + 'Ібни', + ]; + + /** + * @see http://koshpendi.kz/index.php/nomad/imena/ + * + * @var array + */ + protected static $firstNameFemale = [ + 'Асылтас', + 'Әужа', + 'Бүлдіршін', + 'Гүлшаш', + 'Ғафура', + 'Ділдә', + 'Еркежан', + 'Жібек', + 'Зылиқа', + 'Ирада', + 'Күнсұлу', + 'Қырмызы', + 'Ләтипа', + 'Мүштәри', + 'Нұршара', + 'Орынша', + 'Өрзия', + 'Перизат', + 'Рухия', + 'Сындыбала', + 'Тұрсынай', + 'Уәсима', + 'Ұрқия', + 'Үрия', + 'Фируза', + 'Хафиза', + 'Шырынгүл', + 'Ырысты', + 'Іңкәр', + ]; + + /** + * @see http://koshpendi.kz/index.php/nomad/imena/ + * @see https://ru.wikipedia.org/wiki/%D0%9A%D0%B0%D0%B7%D0%B0%D1%85%D1%81%D0%BA%D0%B0%D1%8F_%D1%84%D0%B0%D0%BC%D0%B8%D0%BB%D0%B8%D1%8F + * + * @var array + */ + protected static $lastName = [ + 'Адырбай', + 'Әжібай', + 'Байбөрі', + 'Ғизат', + 'Ділдабек', + 'Ешмұхамбет', + 'Жігер', + 'Зікірия', + 'Иса', + 'Кунту', + 'Қыдыр', + 'Лұқпан', + 'Мышырбай', + 'Нысынбай', + 'Ошақбай', + 'Өтетілеу', + 'Пірәлі', + 'Рүстем', + 'Сырмұхамбет', + 'Тілеміс', + 'Уәлі', + 'Ұлықбек', + 'Үстем', + 'Фахир', + 'Хұсайын', + 'Шілдебай', + 'Ыстамбақы', + 'Ісмет', + ]; + + /** + * Note! When calculating individual identification number + * 2000-01-01 - 2000-12-31 counts as 21th century + * 1900-01-01 - 1900-12-31 counts as 20th century + * + * @param int $year + * + * @return int + */ + private static function getCenturyByYear($year) + { + if (($year >= 2100) || ($year < 1800)) { + throw new \InvalidArgumentException('Unexpected century'); + } + + if ($year >= 2000) { + return self::CENTURY_21ST; + } + + if ($year >= 1900) { + return self::CENTURY_20TH; + } + + return self::CENTURY_19TH; + } + + /** + * National Individual Identification Numbers + * + * @see http://egov.kz/wps/portal/Content?contentPath=%2Fegovcontent%2Fcitizen_migration%2Fpassport_id_card%2Farticle%2Fiin_info&lang=en + * @see https://ru.wikipedia.org/wiki/%D0%98%D0%BD%D0%B4%D0%B8%D0%B2%D0%B8%D0%B4%D1%83%D0%B0%D0%BB%D1%8C%D0%BD%D1%8B%D0%B9_%D0%B8%D0%B4%D0%B5%D0%BD%D1%82%D0%B8%D1%84%D0%B8%D0%BA%D0%B0%D1%86%D0%B8%D0%BE%D0%BD%D0%BD%D1%8B%D0%B9_%D0%BD%D0%BE%D0%BC%D0%B5%D1%80 + * + * @param int $gender + * + * @return string 12 digits, like 780322300455 + */ + public static function individualIdentificationNumber(\DateTime $birthDate = null, $gender = self::GENDER_MALE) + { + if (!$birthDate) { + $birthDate = DateTime::dateTimeBetween(); + } + + do { + $population = self::numberBetween(1000, 2000); + $century = self::getCenturyByYear((int) $birthDate->format('Y')); + + $iin = $birthDate->format('ymd'); + $iin .= (string) self::$genderCenturyMap[$gender][$century]; + $iin .= (string) $population; + $checksum = self::checkSum($iin); + } while ($checksum === 10); + + return $iin . (string) $checksum; + } + + /** + * @param string $iinValue + * + * @return int + */ + public static function checkSum($iinValue) + { + $controlDigit = self::getControlDigit($iinValue, self::$firstSequenceBitWeights); + + if ($controlDigit === 10) { + return self::getControlDigit($iinValue, self::$secondSequenceBitWeights); + } + + return $controlDigit; + } + + /** + * @param string $iinValue + * @param array $sequence + * + * @return int + */ + protected static function getControlDigit($iinValue, $sequence) + { + $sum = 0; + + for ($i = 0; $i <= 10; ++$i) { + $sum += (int) $iinValue[$i] * $sequence[$i]; + } + + return $sum % 11; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/kk_KZ/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/kk_KZ/PhoneNumber.php new file mode 100644 index 00000000..c5d6440d --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/kk_KZ/PhoneNumber.php @@ -0,0 +1,16 @@ +generator->parse($format)); + } + + /** + * @example 'kim.kr' + */ + public function domainName() + { + return static::randomElement(static::$lastNameAscii) . '.' . $this->tld(); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ko_KR/Person.php b/vendor/fakerphp/faker/src/Faker/Provider/ko_KR/Person.php new file mode 100644 index 00000000..71f6175b --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ko_KR/Person.php @@ -0,0 +1,54 @@ +generator->parse($format)); + } + + public function cellPhoneNumber() + { + $format = self::randomElement(array_slice(static::$formats, 6, 1)); + + return self::numerify($this->generator->parse($format)); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ko_KR/Text.php b/vendor/fakerphp/faker/src/Faker/Provider/ko_KR/Text.php new file mode 100644 index 00000000..8182f899 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ko_KR/Text.php @@ -0,0 +1,1725 @@ +에 나오는 요귀의 불빛 모양으로 푸르무레 하게 허공을 비추오. 동경의 불바다는 내 마음을 더욱 음침하게 하였소. +이 때에 뒤에서, +"모시모시(여보세요)." +하는 소리가 들렸소. 그것은 흰 저고리를 입은 호텔 보이였소. +"왜?" +하고 나는 고개만 돌렸소. +"손님이 오셨습니다." +"손님?" +하고 나는 보이에게로 한 걸음 가까이 갔소. 나를 찾을 손님이 어디 있나 하고 나는 놀란 것이오. +"따님께서 오셨습니다. 방으로 모셨습니다." +하고 보이는 들어가 버리고 말았소. +"따님?" +하고 나는 더욱 놀랐소. 순임이가 서울서 나를 따라왔나? 그것은 안 될 말이오. 순임이가 내 뒤를 따라 떠났더라도 아무리 빨리 와도 내일이 아니면 못 왔을 것이오. 그러면 누군가. 정임인가. 정임이가 병원에서 뛰어온 것인가. +나는 두근거리는 가슴을 억지로 진정하면서 내 방문을 열었소. +그것은 정임이었소. 정임은 내가 쓰다가 둔 편지를 보고 있다가 벌떡 일어나 내게 달려들어 안겨 버렸소. 나는 얼빠진 듯이 정임이가 하라는 대로 내버려두었소. 그 편지는 부치려고 쓴 것도 아닌데 그 편지를 정임이가 본 것이 안되었다고 생각하였소. +형! 나를 책망하시오. 심히 부끄러운 말이지마는 나는 정임을 힘껏 껴안아 주고 싶었소. 나는 몇 번이나 정임의 등을 굽어 보면서 내 팔에 힘을 넣으려고 하였소. 정임은 심히 귀여웠소. 정임이가 그처럼 나를 사모하는 것이 심히 기뻤소. 나는 감정이 재우쳐서 눈이 안 보이고 정신이 몽롱하여짐을 깨달았소. 나는 아프고 쓰린 듯한 기쁨을 깨달았소. 영어로 엑스터시라든지, 한문으로 무아의 경지란 이런 것이 아닌가 하였소. 나는 사십 평생에 이러한 경험을 처음 한 것이오. +형! 형이 아시다시피 나는 내 아내 이외에 젊은 여성에게 이렇게 안겨 본 일이 없소. 물론 안아 본 일도 없소. +그러나 형! 나는 나를 눌렀소. 내 타오르는 애욕을 차디찬 이지의 입김으로 불어서 끄려고 애를 썼소. +"글쎄 웬일이냐. 앓는 것이 이 밤중에 비를 맞고 왜 나온단 말이냐. 철없는 것 같으니." +하고 나는 아버지의 위엄으로 정임의 두 어깨를 붙들어 암체어에 앉혔소. 그리고 나도 테이블을 하나 세워 두고 맞은편에 앉았소. +정임은 부끄러운 듯이 두 손으로 낯을 가리우고 제 무릎에 엎드려 울기를 시작하오. +정임은 누런 갈색의 외투를 입었소. 무엇을 타고 왔는지 모르지마는 구두에는 꽤 많이 물이 묻고 모자에는 빗방울 얼룩이 보이오. +"네가 이러다가 다시 병이 더치면 어찌한단 말이냐. 아이가 왜 그렇게 철이 없니?" +하고 나는 더욱 냉정한 어조로 책망하고 데스크 위에 놓인 내 편지 초를 집어 박박 찢어 버렸소. 종이 찢는 소리에 정임은 잠깐 고개를 들어서 처음에는 내 손을 보고 다음에는 내 얼굴을 보았소. 그러나 나는 모르는 체하고 도로 교의에 돌아와 앉아서 가만히 눈을 감았소. 그리고 도무지 흥분되지 아니한 모양을 꾸몄소. +형! 어떻게나 힘드는 일이오? 참으면 참을수록 내 이빨이 마주 부딪고, 얼굴의 근육은 씰룩거리고 손은 불끈불끈 쥐어지오. +"정말 내일 가세요?" +하고 아마 오 분 동안이나 침묵을 지키다가 정임이가 고개를 들고 물었소. +"그럼, 가야지." +하고 나는 빙그레 웃어 보였소. +"저도 데리고 가세요!" +하는 정임의 말은 마치 서릿발이 날리는 칼날과 같았소. 나는 깜짝 놀라서 정임을 바라보았소. 그의 눈은 빛나고 입은 꼭 다물고 얼굴의 근육은 팽팽하게 켕겼소. 정임의 얼굴에는 찬바람이 도는 무서운 기운이 있었소. +나는 즉각적으로 죽기를 결심한 여자의 모양이라고 생각하였소. 열정으로 불덩어리가 되었던 정임은 내가 보이는 냉랭한 태도로 말미암아 갑자기 얼어 버린 것 같았소. +"어디를?" +하고 나는 정임의 `저도 데리고 가세요.' 하는 담대한 말에 놀라면서 물었소. +"어디든지, 아버지 가시는 데면 어디든지 저를 데리고 가세요. 저는 아버지를 떠나서는 혼자서는 못 살 것을 지나간 반 달 동안에 잘 알았습니다. 아까 아버지 오셨다 가신 뒤에 생각해 보니깐 암만해도 아버지는 다시 저에게 와 보시지 아니하고 가실 것만 같애요. 그리고 저로 해서 아버지께서는 무슨 큰 타격을 당하신 것만 같으셔요. 처음 뵈올 적에 벌써 가슴이 뜨끔했습니다. 그리고 여행을 떠나신다는 말씀을 듣고는 반드시 무슨 큰일이 나셨느니라고만 생각했습니다. 그리고 저어, 저로 해서 그러신 것만 같고, 저를 버리시고 혼자 가시려는 것만 같고, 그래서 달려왔더니 여기 써 놓으신 편지를 보고 그 편지에 다른 말씀은 어찌 됐든지, 네 일기를 보았다 하신 말씀을 보고는 다 알았습니다. 저와 한 방에 있는 애가 암만해도 어머니 스파인가봐요. 제가 입원하기 전에도 제 눈치를 슬슬 보고 또 책상 서랍도 뒤지는 눈치가 보이길래 일기책은 늘 쇠 잠그는 서랍에 넣어 두었는데 아마 제가 정신 없이 앓고 누웠는 동안에 제 핸드백에서 쇳대를 훔쳐 갔던가봐요. 그래서는 그 일기책을 꺼내서 서울로 보냈나봐요. 그걸루 해서 아버지께서는 불명예스러운 누명을 쓰시고 학교일도 내놓으시게 되고 집도 떠나시게 되셨나봐요. 다시는 집에 안 돌아오실 양으로 결심을 하셨나봐요. 아까 병원에서도 하시는 말씀이 모두 유언하시는 것만 같아서 퍽 의심을 가졌었는데 지금 그 쓰시던 편지를 보고는 다 알았습니다. 그렇지만 그렇지만." +하고 웅변으로 내려 말하던 정임은 갑자기 복받치는 열정을 이기지 못하는 듯이, 한 번 한숨을 지우고, +"그렇지만 저는 아버지를 따라가요. 절루 해서 아버지께서는 집도 잃으시고 명예도 잃으시고 사업도 잃으시고 인생의 모든 것을 다 잃으셨으니 저는 아버지를 따라가요. 어디를 가시든지 저는 어린 딸로 아버지를 따라다니다가 아버지께서 먼저 돌아가시면 저도 따라 죽어서 아버지 발 밑에 묻힐 테야요. 제가 먼저 죽거든 제가 병이 있으니깐 물론 제가 먼저 죽지요. 죽어도 좋습니다. 병원에서 앓다가 혼자 죽는 건 싫어요. 아버지 곁에서 죽으면 아버지께서, 오 내 딸 정임아 하시고 귀해 주시고 불쌍히 여겨 주시겠지요. 그리고 제 몸을 어디든지 땅에 묻으시고 `사랑하는 내 딸 정임의 무덤'이라고 패라도 손수 쓰셔서 세워 주시지 않겠습니까." +하고 정임은 비쭉비쭉하다가 그만 무릎 위에 엎더져 울고 마오. +나는 다만 죽은 사람 모양으로 반쯤 눈을 감고 앉아 있었소. 가슴 속에는 정임의 곁에서 지지 않는 열정을 품으면서도 정임의 말대로 정임을 데리고 아무도 모르는 곳으로 가 버리고 싶으면서도 나는 이 열정의 불길을 내 입김으로 꺼 버리지 아니하면 아니 되는 것이었소. +"아아, 제가 왜 났어요? 왜 하나님께서 저를 세상에 보내셨어요? 아버지의 일생을 파멸시키려 난 것이지요? 제가 지금 죽어 버려서 아버지의 명예를 회복할 수 있다면 저는 죽어 버릴 터이야요. 기쁘게 죽어 버리겠습니다. 제가 여덟 살부터 오늘날까지 받은 은혜를 제 목숨 하나로 갚을 수가 있다면 저는 지금으로 죽어 버리겠습니다. 그렇지만 그렇지만……. +그렇지만 그렇지만 저는 다만 얼마라도 다만 하루라도 아버지 곁에서 살고 싶어요 다만 하루만이라도, 아버지! 제가 왜 이렇습니까, 네? 제가 어려서 이렇습니까. 미친 년이 되어서 이렇습니까. 아버지께서는 아실 테니 말씀해 주세요. 하루만이라도 아버지를 모시고 아버지 곁에서 살았으면 죽어도 한이 없겠습니다. 제 생각이 잘못이야요? 제 생각이 죄야요? 왜 죄입니까? 아버지, 저를 버리시고 혼자 가시지 마세요, 네? `정임아, 너를 데리고 가마.' 하고 약속해 주세요, 네." +정임은 아주 담대하게 제가 하고자 하는 말을 다 하오. 그 얌전한, 수삽한정임의 속에 어디 그러한 용기가 있었던가, 참 이상한 일이오. 나는 귀여운 어린 계집애 정임의 속에 엉큼한 여자가 들어앉은 것을 발견하였소. 그가 몇 가지 재료(내가 여행을 떠난다는 것과 제 일기를 보았다는 것)를 종합하여 나와 저와의 새에, 또 그 때문에 어떠한 일이 일어난 것을 추측하는 그 상상력도 놀랍거니와 그렇게 내 앞에서는 별로 입도 벌리지 아니하던 그가 이처럼 담대하게 제 속에 있는 말을 거리낌없이 다 해 버리는 용기를 아니 놀랄 수 없었소. 내가, 사내요 어른인 내가 도리어 정임에게 리드를 받고 놀림을 받음을 깨달았소. +그러나 정임을 위해서든지, 중년 남자의 위신을 위해서든지 나는 의지력으로, 도덕력으로, 정임을 누르고 훈계하지 아니하면 아니 되겠다고 생각하였소. +"정임아." +하고 나는 비로소 입을 열어서 불렀소. 내 어성은 장중하였소. 나는 할 수 있는 위엄을 다하여 `정임아.' 하고 부른 것이오. +"정임아, 네 속은 다 알았다. 네 마음 네 뜻은 그만하면 다 알았다. 네가 나를 그처럼 생각해 주는 것을 고맙게 생각한다. 기쁘게도 생각한다. 그러나 정임아." +하고 나는 일층 태도와 소리를 엄숙하게 하여, +"네가 청하는 말은 절대로 들을 수 없는 말이다. 내가 너를 친딸같이 사랑하기 때문에 나는 너를 데리고 가지 못하는 것이다. 나는 세상에서 죽고 조선에서 죽더라도 너는 죽어서 아니 된다. 차마 너까지는 죽이고 싶지 아니하단 말이다. 내가 어디 가서 없어져 버리면 세상은 네게 씌운 누명이 애매한 줄을 알게 될 것이 아니냐. 그리되면 너는 조선의 좋은 일꾼이 되어서 일도 많이 하고 또 사랑하는 남편을 맞아서 행복된 생활도 할 수 있을 것이 아니냐. 그것이 내가 네게 바라는 것이다. 내가 어디 가 있든지, 내가 살아 있는 동안 나는 네가 잘되는 것만, 행복되게 사는 것만 바라보고 혼자 기뻐할 것이 아니냐. +네가 다 옳게 알았다. 나는 네 말대로 조선을 영원히 떠나기로 하였다. 그렇지마는 나는 이렇게 된 것을 조금도 슬퍼하지 아니한다. 너를 위해서 내가 무슨 희생을 한다고 하면 내게는 그것이 큰 기쁨이다. 그뿐 아니라, 나는 인제는 세상이 싫어졌다. 더 살기가 싫어졌다. 내가 십여 년 동안 전생명을 바쳐서 교육한 학생들에게까지 배척을 받을 때에는 나는 지금까지 살아온 것을 생각만 하여도 진저리가 난다. 그렇지마는 나는 이것이 다 내가 부족한 때문인 줄을 잘 안다. 나는 조선을 원망한다든가, 내 동포를 원망한다든가, 그럴 생각은 없다. 원망을 한다면 나 자신의 부족을 원망할 뿐이다. 내가 원체 교육을 한다든지 남의 지도자가 된다든지 할 자격이 없음을 원망한다면 원망할까, 내가 어떻게 조선이나 조선 사람을 원망하느냐. 그러니까 인제 내게 남은 일은 나를 조선에서 없애 버리는 것이다. 감히 십여 년 간 교육가라고 자처해 오던 거짓되고 외람된 생활을 끊어 버리는 것이다. 남편 노릇도 못 하고 아버지 노릇도 못 하는 사람이 남의 스승은 어떻게 되고 지도자는 어떻게 되느냐. 하니까 나는 이제 세상을 떠나 버리는 것이 조금도 슬프지 아니하고 도리어 몸이 가뜬하고 유쾌해지는 것 같다. +오직 하나 마음에 걸리는 것은 내 선배요 사랑하는 동지이던 남 선생의 유일한 혈육이던 네게다가 누명을 씌우고 가는 것이다." +"그게 어디 아버지 잘못입니까?" +하고 정임은 입술을 깨물었소. +"모두 제가 철이 없어서 저 때문에……." +하고 정임은 몸을 떨고 울었소. +"아니! 그렇게 생각하지 마라. 내가 지금 세상을 버릴 때에 무슨 기쁨이 한 가지 남는 것이 있다고 하면 너 하나가, 이 세상에서 오직 너 하나가 나를 따라 주는 것이다. 아마 너도 나를 잘못 알고 따라 주는 것이겠지마는 세상이 다 나를 버리고, 처자까지도 다 나를 버릴 때에 오직 너 하나가 나를 소중히 알아 주니 어찌 고맙지 않겠느냐. 그러니까 정임아 너는 몸을 조심하여서 건강을 회복하여서 오래 잘 살고, 그리고 나를 생각해 다오." +하고 나도 울었소. +형! 내가 정임에게 이런 말을 한 것이 잘못이지요. 그러나 나는 그 때에 이런 말을 아니 할 수 없었소. 왜 그런고 하니, 그것이 내 진정이니까. 나도 학교 선생으로, 교장으로, 또 주제넘게 지사로의 일생을 보내노라고 마치 오직 얼음 같은 의지력만 가진 사람 모양으로 사십 평생을 살아 왔지마는 내 속에도 열정은 있었던 것이오. 다만 그 열정을 누르고 죽이고 있었을 뿐이오. 물론 나는 아마 일생에 이 열정의 고삐를 놓아 줄 날이 없겠지요. 만일 내가 이 열정의 고삐를 놓아서 자유로 달리게 한다고 하면 나는 이 경우에 정임을 안고, 내 열정으로 정임을 태워 버렸을는지도 모르오. 그러나 나는 정임이가 열정으로 탈수록 나는 내 열정의 고삐를 두 손으로 꽉 붙들고 이를 악물고 매달릴 결심을 한 것이오. +열한 시! +"정임아. 인제 병원으로 가거라." +하고 나는 엄연하게 명령하였소. +"내일 저를 보시고 떠나시지요?" +하고 정임은 눈물을 씻고 물었소. +"그럼, J조교수도 만나고 너도 보고 떠나지." +하고 나는 거짓말을 하였소. 이 경우에 내가 거짓말쟁이라는 큰 죄인이 되는 것이 정임에게 대하여 정임을 위하여 가장 옳은 일이라고 생각한 까닭이오. +정임은, 무서운 직각력과 상상력을 가진 정임은 내 말의 진실성을 의심하는 듯이 나를 뚫어지게 바라보았소. 나는 차마 정임의 시선을 마주 보지 못하여 외면하여 버렸소. +정임은 수건으로 눈물을 씻고 체경 앞에 가서 화장을 고치고 그리고, +"저는 가요." +하고 내 앞에 허리를 굽혀서 작별 인사를 하였소. +"오, 가 자거라." +하고 나는 극히 범연하게 대답하였소. 나는 자리옷을 입었기 때문에 현관까지 작별할 수도 없어서 보이를 불러 자동차를 하나 준비하라고 명하고 내 방에서 작별할 생각을 하였소. +"내일 병원에 오세요?" +하고 정임은 고개를 숙이고 낙루하였소. +"오, 가마." +하고 나는 또 거짓말을 하였소. 세상을 버리기로 결심한 사람의 거짓말은 하나님께서도 용서하시겠지요. 설사 내가 거짓말을 한 죄로 지옥에 간다 하더라도 이 경우에 정임을 위하여 거짓말을 아니 할 수가 없지 않소? 내가 거짓말을 아니 하면 정임은 아니 갈 것이 분명하였소. +"전 가요." +하고 정임은 또 한 번 절을 하였으나 소리를 내어서 울었소. +"울지 마라! 몸 상한다." +하고 나는 정임에게 대한 최후의 친절을 정임의 곁에 한 걸음 가까이 가서 어깨를 또닥또닥하여 주고, 외투를 입혀 주었소. +"안녕히 주무세요." +하고 정임은 문을 열고 나가 버렸소. +정임의 걸어가는 소리가 차차 멀어졌소. +나는 얼빠진 사람 모양으로 그 자리에 우두커니 서 있었소. +창에 부딪히는 빗발 소리가 들리고 자동차 소리가 먼 나라에서 오는 것같이 들리오. 이것이 정임이가 타고 가는 자동차 소리인가. 나는 정임을 따라가서 붙들어 오고 싶었소. 내 몸과 마음은 정임을 따라서 허공에 떠가는 것 같았소. +아아 이렇게 나는 정임을 곁에 두고 싶을까. 이렇게 내가 정임의 곁에 있고 싶을까. 그러하건마는 나는 정임을 떼어 버리고 가지 아니하면 아니 된다! 그것은 애끓는 일이다. 기막히는 일이다! 그러나 내 도덕적 책임은 엄정하게 그렇게 명령하지 않느냐. 나는 이 도덕적 책임의 명령 그것은 더위가 없는 명령이다 을 털끝만치라도 휘어서는 아니 된다. +그러나 정임이가 호텔 현관까지 자동차를 타기 전에 한 번만 더 바라보는 것도 못 할 일일까. 한 번만, 잠깐만 더 바라보는 것도 못 할 일일까. 잠깐만 일 분만 아니 일 초만 한 시그마라는 극히 짧은 동안만 바라보는 것도 못 할 일일까. 아니, 정임을 한 시그마 동안만 더 보고 싶다 나는 이렇게 생각하고 벌떡 일어나서 도어의 핸들에 손을 대었소. +`안 된다! 옳잖다!' +하고 나는 내 소파에 돌아와서 털썩 몸을 던졌소. +`최후의 순간이 아니냐. 최후의 순간에 용감히 이겨야 할 것이 아니냐. 아서라! 아서라!' +하고 나는 혼자 주먹을 불끈불끈 쥐었소. +이 때에 짜박짜박 하고 걸어오는 소리가 들리오. 내 가슴은 쌍방망이로 두들기는 것같이 뛰었소. +`설마 정임일까.' +하면서도 나는 숨을 죽이고 귀를 기울였소. +그 발자국 소리는 분명 내 문 밖에 와서 그쳤소. 그리고는 소리가 없었소. +`내 귀의 환각인가.' +하고 나는 한숨을 내쉬었소. +그러나 다음 순간 또 두어 번 문을 두드리는 소리가 들렸소. +"이에스." +하고 나는 대답하고 문을 바라보았소. +문이 열렸소. +들어오는 이는 정임이었소. +"웬일이냐." +하고 나는 엄숙한 태도를 지었소. 그것으로 일 초의 일천분지 일이라도 다시 한 번 보고 싶던 정임을 보고 기쁨을 카무플라주한 것이오. +정임은 서슴지 않고 내 뒤에 와서 내 교의에 몸을 기대며, +"암만해도 오늘이 마지막인 것만 같아서, 다시 뵈올 기약은 없는 것만 같아서 가다가 도로 왔습니다. 한 번만 더 뵙고 갈 양으로요. 그래 도로 와서도 들어올까 말까 하고 주저주저하다가 이것이 마지막인데 하고 용기를 내어서 들어왔습니다. 내일 저를 보시고 가신다는 것이 부러 하신 말씀만 같고, 마지막 뵈옵고, 뵈온대도 그래도 한 번 더 뵈옵기만 해도……." +하고 정임의 말은 끝을 아물지 못하였소. 그는 내 등 뒤에 서 있기 때문에 그가 어떠한 표정을 하고 있는지는 볼 수가 없었소. 나는 다만 아버지의 위엄으로 정면을 바라보고 있었을 뿐이오. +`정임아, 나도 네가 보고 싶었다. 네 뒤를 따라가고 싶었다. 내 몸과 마음은 네 뒤를 따라서 허공으로 날았다. 나는 너를 한 초라도 한 초의 천분지 일 동안이라도 한 번 더 보고 싶었다. 정임아, 내 진정은 너를 언제든지 내 곁에 두고 싶다. 정임아, 지금 내 생명이 가진 것은 오직 너뿐이다.' +이런 말이라도 하고 싶었소. 그러나 이런 말을 하여서는 아니 되오! 만일 내가 이런 말을 하여 준다면 정임이가 기뻐하겠지요. 그러나 나는 정임이에게 이런 기쁨을 주어서는 아니 되오! +나는 어디까지든지 아버지의 위엄, 아버지의 냉정함을 아니 지켜서는 아니 되오. +그렇지마는 내 가슴에 타오르는 이름지을 수 없는 열정의 불길은 내 이성과 의지력을 태워 버리려 하오. 나는 눈이 아뜩아뜩함을 깨닫소. 나는 내 생명의 불길이 깜박깜박함을 깨닫소. +그렇지마는! 아아 그렇지마는 나는 이 도덕적 책임의 무상 명령의 발령자인 쓴 잔을 마시지 아니하여서는 아니 되는 것이오. +`산! 바위!' +나는 정신을 가다듬어서 이것을 염하였소. +그러나 열정의 파도가 치는 곳에 산은 움직이지 아니하오? 바위는 흔들리지 아니하오? 태산과 반석이 그 흰 불길에 타서 재가 되지는 아니하오? 인생의 모든 힘 가운데 열정보다 더 폭력적인 것이 어디 있소? 아마도 우주의 모든 힘 가운데 사람의 열정과 같이 폭력적, 불가항력적인 것은 없으리라. 뇌성, 벽력, 글쎄 그것에나 비길까. 차라리 천체와 천체가 수학적으로 계산할 수 없는 비상한 속력을 가지고 마주 달려들어서 우리의 귀로 들을 수 없는 큰 소리와 우리가 굳다고 일컫는 금강석이라도 증기를 만들고야 말 만한 열을 발하는 충돌의 순간에나 비길까. 형. 사람이라는 존재가 우주의 모든 존재 중에 가장 비상한 존재인 것 모양으로 사람의 열정의 힘은 우주의 모든 신비한 힘 가운데 가장 신비한 힘이 아니겠소? 대체 우주의 모든 힘은 그것이 아무리 큰 힘이라고 하더라도 저 자신을 깨뜨리는 것은 없소. 그렇지마는 사람이라는 존재의 열정은 능히 제 생명을 깨뜨려 가루를 만들고 제 생명을 살라서 소지를 올리지 아니하오? 여보, 대체 이에서 더 폭력이요, 신비적인 것이 어디 있단 말이오. +이 때 내 상태, 어깨 뒤에서 열정으로 타고 섰는 정임을 느끼는 내 상태는 바야흐로 대폭발, 대충돌을 기다리는 아슬아슬한 때가 아니었소. 만일 조금만이라도 내가 내 열정의 고삐에 늦춤을 준다고 하면 무서운 대폭발이 일어났을 것이오. +"정임아!" +하고 나는 충분히 마음을 진정해 가지고 고개를 옆으로 돌려 정임의 얼굴을 찾았소. +"네에." +하고 정임은 입을 약간 내 귀 가까이로 가져와서 그 씨근거리는 소리가 분명히 내 귀에 들리고 그 후끈후끈하는 뜨거운 입김이 내 목과 뺨에 감각되었소. +억지로 진정하였던 내 가슴은 다시 설레기를 시작하였소. 그 불규칙한 숨소리와 뜨거운 입김 때문이었을까. +"시간 늦는다. 어서 가거라. 이 아버지는 언제까지든지 너를 사랑하는 딸 로 소중히 소중히 가슴에 품고 있으마. 또 후일에 다시 만날 때도 있을지 아느냐. 설사 다시 만날 때가 없다기로니 그것이 무엇이 그리 대수냐. 나이 많은 사람은 먼저 죽고 젊은 사람은 오래 살아서 인생의 일을 많이 하는 것이 순서가 아니냐. 너는 몸이 아직 약하니 마음을 잘 안정해서 어서 건강을 회복하여라. 그리고 굳세게 굳세게, 힘있게 힘있게 살아 다오. 조선은 사람을 구한다. 나 같은 사람은 인제 조선서 더 일할 자격을 잃어버린 사람이지마는 네야 어떠냐. 설사 누가 무슨 말을 해서 학교에서 학비를 아니 준다거든 내가 네게 준 재산을 가지고 네 마음대로 공부를 하려무나. 네가 그렇게 해 주어야 나를 위하는 것이다. 자 인제 가거라. 네 앞길이 양양하지 아니하냐. 자 인제 가거라. 나는 내일 아침 동경을 떠날란다. 자 어서." +하고 나는 화평하게 웃는 낯으로 일어섰소. +정임은 울먹울먹하고 고개를 숙이오. +밖에서는 바람이 점점 강해져서 소리를 하고 유리창을 흔드오. +"그럼, 전 가요." +하고 정임은 고개를 들었소. +"그래. 어서 가거라. 벌써 열한시 반이다. 병원 문은 아니 닫니!" +정임은 대답이 없소. +"어서!" +하고 나는 보이를 불러 자동차를 하나 준비하라고 일렀소. +"갈랍니다." +하고 정임은 고개를 숙여서 내게 인사를 하고 문을 향하여 한 걸음 걷다가 잠깐 주저하더니, 다시 돌아서서, +"저를 한 번만 안아 주셔요. 아버지가 어린 딸을 안듯이 한 번만 안아 주셔요." +하고 내 앞으로 가까이 와 서오. +나는 팔을 벌려 주었소. 정임은 내 가슴을 향하고 몸을 던졌소. 그리고 제 이뺨 저뺨을 내 가슴에 대고 비볐소. 나는 두 팔을 정임의 어깨 위에 가벼이 놓았소. +이러한 지 몇 분이 지났소. 아마 일 분도 다 못 되었는지 모르오. +정임은 내 가슴에서 고개를 들어 나를 뚫어지게 우러러보더니, 다시 내 가슴에 낯을 대더니 아마 내 심장이 무섭게 뛰는 소리를 정임은 들었을 것이오 정임은 다시 고개를 들고, +"어디를 가시든지 편지나 주셔요." +하고 굵은 눈물을 떨구고는 내게서 물러서서 또 한 번 절하고, +"안녕히 가셔요. 만주든지 아령이든지 조선 사람 많이 사는 곳에 가셔서 일하고 사셔요. 돌아가실 생각은 마셔요. 제가, 아버지 말씀대로 혼자 떨어져 있으니 아버지도 제 말씀대로 돌아가실 생각은 마셔요, 네, 그렇다고 대답하셔요!" +하고는 또 한 번 내 가슴에 몸을 기대오. +죽기를 결심한 나는 `오냐, 그러마.' 하는 대답을 할 수는 없었소. 그래서, +"오, 내 살도록 힘쓰마." +하는 약속을 주어서 정임을 돌려보냈소. +정임의 발자국 소리가 안 들리게 된 때에 나는 빠른 걸음으로 옥상 정원으로 나갔소. 비가 막 뿌리오. +나는 정임이가 타고 나가는 자동차라도 볼 양으로 호텔 현관 앞이 보이는 꼭대기로 올라갔소. 현관을 떠난 자동차 하나가 전찻길로 나서서는 북을 향하고 달아나서 순식간에 그 꽁무니에 달린 붉은 불조차 스러져 버리고 말았소. +나는 미친 사람 모양으로, +"정임아, 정임아!" +하고 수없이 불렀소. 나는 사 층이나 되는 이 꼭대기에서 뛰어내려서 정임이가 타고 간 자동차의 뒤를 따르고 싶었소. +"아아 영원한 인생의 이별!" +나는 그 옥상에 얼마나 오래 섰던지를 모르오. 내 머리와 낯과 배스로브에서는 물이 흐르오. 방에 들어오니 정임이가 끼치고 간 향기와 추억만 남았소. +나는 방 안 구석구석에 정임의 모양이 보이는 것을 깨달았소. 특별히 정임이가 고개를 숙이고 서 있던 내 교의 뒤에는 분명히 갈색 외투를 입은 정임의 모양이 완연하오. +"정임아!" +하고 나는 그 곳으로 따라가오. 그러나 가면 거기는 정임은 없소. +나는 교의에 앉소. 그러면 정임의 씨근씨근하는 숨소리와 더운 입김이 분명 내 오른편에 감각이 되오. 아아 무서운 환각이여! +나는 자리에 눕소. 그리고 정임의 환각을 피하려고 불을 끄오. 그러면 정임이가 내게 안기던 자리쯤에 환하게 정임의 모양이 나타나오. +나는 불을 켜오. 또 불을 끄오. +날이 밝자 나는 비가 갠 것을 다행으로 비행장에 달려가서 비행기를 얻어 탔소. +나는 다시 조선의 하늘을 통과하기가 싫어서 북강에서 비행기에서 내려서 문사에 와서 대련으로 가는 배를 탔소. +나는 대련에서 내려서 하룻밤을 여관에서 자고는 곧 장춘 가는 급행을 탔소. 물론 아무에게도 엽서 한 장 한 일 없었소. 그것은 인연을 끊은 세상에 대하여 연연한 마음을 가지는 것을 부끄럽게 생각한 까닭이오. +차가 옛날에는 우리 조상네가 살고 문화를 짓던 옛 터전인 만주의 벌판을 달릴 때에는 감회도 없지 아니하였소. 그러나 나는 지금 그런 한가한 감상을 쓸 겨를이 없소. +내가 믿고 가는 곳은 하얼빈에 있는 어떤 친구요. 그는 R라는 사람으로서 경술년에 A씨 등의 망명객을 따라 나갔다가 아라사에서 무관 학교를 졸업하고 아라사 사관으로서 구주 대전에도 출정을 하였다가, 혁명 후에도 이내 적위군에 머물러서 지금까지 소비에트 장교로 있는 사람이오. 지금은 육군 소장이라던가. +나는 하얼빈에 그 사람을 찾아가는 것이오. 그 사람을 찾아야 아라사에 들어갈 여행권을 얻을 것이요, 여행권을 얻어야 내가 평소에 이상하게도 그리워하던 바이칼 호를 볼 것이오. +하얼빈에 내린 것은 해가 뉘엿뉘엿 넘어가는 석양이었소. +나는 안중근이 이등박문(伊藤博文:이토 히로부미)을 쏜 곳이 어딘가 하고 벌판과 같이 넓은 플랫폼에 내렸소. 과연 국제 도시라 서양 사람, 중국 사람, 일본 사람이 각기 제 말로 지껄이오. 아아 조선 사람도 있을 것이오마는 다들 양복을 입거나 청복을 입거나 하고 또 사람이 많은 곳에서는 말도 잘 하지 아니하여 아무쪼록 조선 사람인 것을 표시하지 아니하는 판이라 그 골격과 표정을 살피기 전에는 어느 것이 조선 사람인지 알 길이 없소. 아마 허름하게 차리고 기운 없이, 비창한 빛을 띠고 사람의 눈을 슬슬 피하는 저 순하게 생긴 사람들이 조선 사람이겠지요. 언제나 한 번 가는 곳마다 동양이든지, 서양이든지, +`나는 조선 사람이오!' +하고 뽐내고 다닐 날이 있을까 하면 눈물이 나오. 더구나, 하얼빈과 같은 각색 인종이 모여서 생존 경쟁을 하는 마당에 서서 이런 비감이 간절하오. 아아 이 불쌍한 유랑의 무리 중에 나도 하나를 더 보태는가 하면 눈물을 씻지 아니할 수 없었소. +나는 역에서 나와서 어떤 아라사 병정 하나를 붙들고 R의 아라사 이름을 불렀소. 그리고 아느냐고 영어로 물었소. +그 병정은 내 말을 잘못 알아들었는지, 또는 R를 모르는지 무엇이라고 아라사말로 지껄이는 모양이나 나는 물론 그것을 알아들을 수가 없었소. 그러나 나는 그 병정의 표정에서 내게 호의를 가진 것을 짐작하고 한 번 더 분명히, +"요십 알렉산드로비치 리가이." +라고 불러 보았소. +그 병정은 빙그레 웃고 고개를 흔드오. 이 두 외국 사람의 이상한 교섭에 흥미를 가지고 여러 아라사 병정과 동양 사람들이 십여 인이나 우리 주위에 모여드오. +그 병정이 나를 바라보고 또 한 번 그 이름을 불러 보라는 모양 같기로 나는 이번에는 R의 아라사 이름에 `제너럴'이라는 말을 붙여 불러 보았소. +그랬더니 어떤 다른 병정이 뛰어들며, +"게네라우 리가이!" +하고 안다는 표정을 하오. `게네라우'라는 것이 아마 아라사말로 장군이란 말인가 하였소. +"예스. 예스." +하고 나는 기쁘게 대답하였소. 그리고는 아라사 병정들끼리 무에라고 지껄이더니, 그 중에 한 병정이 나서면서 고개를 끄덕끄덕하고, 제가 마차 하나를 불러서 나를 태우고 저도 타고 어디로 달려가오. +그 아라사 병정은 친절히 알지도 못하는 말로 이것저것을 가리키면서 설명을 하더니 내가 못 알아듣는 줄을 생각하고 내 어깨를 툭 치고 웃소. 어린애와 같이 순한 사람들이구나 하고 나는 고맙다는 표로 고개만 끄덕끄덕하였소. +어디로 어떻게 가는지 서양 시가로 달려가다가 어떤 큰 저택 앞에 이르러서 마차를 그 현관 앞으로 들이몰았소. +현관에서는 종졸이 나왔소. 내가 명함을 들여보냈더니 부관인 듯한 아라사 장교가 나와서 나를 으리으리한 응접실로 인도하였소. 얼마 있노라니 중년이 넘은 어떤 대장이 나오는데 군복에 칼끈만 늘였소. +"이게 누구요." +하고 그 대장은 달려들어서 나를 껴안았소. 이십오 년 만에 만나는 우리는 서로 알아본 것이오. +이윽고 나는 그의 부인과 자녀들도 만났소. 그들은 다 아라사 사람이오. +저녁이 끝난 뒤에 나는 R의 부인과 딸의 음악과 그림 구경과 기타의 관대를 받고 단둘이 이야기할 기회를 얻었소. 경술년 당시 이야기도 나오고, A씨의 이야기도 나오고, R의 신세 타령도 나오고, 내 이십오 년 간의 생활 이야기도 나오고, 소비에트 혁명 이야기도 나오고, 하얼빈 이야기도 나오고, 우리네가 어려서 서로 사귀던 회구담도 나오고 이야기가 그칠 바를 몰랐소. "조선은 그립지 않은가." +하는 내 말에 쾌활하던 R는 고개를 숙이고 추연한 빛을 보였소. +나는 R의 추연한 태도를 아마 고국을 그리워하는 것으로만 여겼소. 그래서 나는 그리 침음하는 것을 보고, +"얼마나 고국이 그립겠나. 나는 고국을 떠난 지가 일 주일도 안 되건마는 못 견디게 그리운데." +하고 동정하는 말을 하였소. +했더니, 이 말 보시오. 그는 침음을 깨뜨리고 고개를 번쩍 들며, +"아니! 나는 고국이 조금도 그립지 아니하이. 내가 지금 생각한 것은 자네 말을 듣고 고국이 그리운가 그리워할 것이 있는가를 생각해 본 것일세. 그랬더니 아무리 생각하여도 나는 고국이 그립다는 생각을 가질 수가 없어. 그야 어려서 자라날 때에 보던 강산이라든지 내 기억에 남은 아는 사람들이라든지, 보고 싶다 하는 생각도 없지 아니하지마는 그것이 고국이 그리운 것이라고 할 수가 있을까. 그 밖에는 나는 아무리 생각하여도 고국이 그리운 것을 찾을 길이 없네. 나도 지금 자네를 보고 또 자네 말을 듣고 오래 잊어버렸던 고국을 좀 그립게, 그립다 하게 생각하려고 해 보았지마는 도무지 나는 고국이 그립다는 생각이 나지 않네." +이 말에 나는 깜짝 놀랐소. 몸서리치게 무서웠소. 나는 해외에 오래 표랑하는 사람은 으레 고국을 그리워할 것으로 믿고 있었소. 그런데 이 사람이, 일찍은 고국을 사랑하여 목숨까지도 바치려던 이 사람이 도무지 이처럼 고국을 잊어버린다는 것은 놀라운 정도를 지나서 괘씸하기 그지없었소. 나도 비록 조선을 떠난다고, 영원히 버린다고 나서기는 했지마는 나로는 죽기 전에는 아니 비록 죽더라도 잊어버리지 못할 고국을 잊어버린 R의 심사가 난측하고 원망스러웠소. +"고국이 그립지가 않아?" +하고 R에게 묻는 내 어성에는 격분한 빛이 있었소. +"이상하게 생각하시겠지. 하지만 고국에 무슨 그리울 것이 있단 말인가. 그 빈대 끓는 오막살이가 그립단 말인가. 나무 한 개 없는 산이 그립단 말인가. 물보다도 모래가 많은 다 늙어빠진 개천이 그립단 말인가. 그 무기력하고 가난한, 시기 많고 싸우고 하는 그 백성을 그리워한단 말인가. 그렇지 아니하면 무슨 그리워할 음악이 있단 말인가, 미술이 있단 말인가, 문학이 있단 말인가, 사상이 있단 말인가, 사모할 만한 인물이 있단 말인가! 날더러 고국의 무엇을 그리워하란 말인가. 나는 조국이 없는 사람일세. 내가 소비에트 군인으로 있으니 소비에트가 내 조국이겠지. 그러나 진심으로 내 조국이라는 생각은 나지 아니하네." +하고 저녁 먹을 때에 약간 붉었던 R의 얼굴은 이상한 흥분으로 더욱 붉어지오.유 정유 정 +R는 먹던 담배를 화나는 듯이 재떨이에 집어던지며, +"내가 하얼빈에 온 지가 인제 겨우 삼사 년밖에 안 되지마는 조선 사람 때문에 나는 견딜 수가 없어. 와서 달라는 것도 달라는 것이지마는 조선 사람이 또 어찌하였느니 또 어찌하였느니 하는 불명예한 말을 들을 때에는 나는 금시에 죽어 버리고 싶단 말일세. 내게 가장 불쾌한 것이 있다고 하면 그것은 고국이라는 기억과 조선 사람의 존잴세. 내가 만일 어느 나라의 독재자가 된다고 하면 나는 첫째로 조선인 입국 금지를 단행하려네. 만일 조선이라는 것을 잊어버릴 약이 있다고 하면 나는 생명과 바꾸어서라도 사 먹고 싶어." +하고 R는 약간 흥분된 어조를 늦추어서, +"나도 모스크바에 있다가 처음 원동에 나왔을 적에는 길을 다녀도 혹시 동포가 눈에 뜨이지나 아니하나 하고 찾았네. 그래서 어디서든지 동포를 만나면 반가이 손을 잡았지. 했지만 점점 그들은 오직 귀찮은 존재에 지나지 못하다는 것을 알았단 말일세. 인제는 조선 사람이라고만 하면 만나기가 무섭고 끔찍끔찍하고 진저리가 나는 걸 어떡허나. 자네 명함이 들어온 때에도 조선 사람인가 하고 가슴이 뜨끔했네." +하고 R는 웃지도 아니하오. 그의 얼굴에는, 군인다운 기운찬 얼굴에는 증오와 분노의 빛이 넘쳤소. +"나도 자네 집에 환영받는 나그네는 아닐세그려." +하고 나는 이 견디기 어려운 불쾌하고 무서운 공기를 완화하기 위하여 농담삼아 한 마디를 던지고 웃었소. +나는 R의 말이 과격함에 놀랐지마는, 또 생각하면 R가 한 말 가운데는 들을 만한 이유도 없지 아니하오. 그것을 생각할 때에 나는 R를 괘씸하게 생각하기 전에 내가 버린다는 조선을 위하여서 가슴이 아팠소. 그렇지만 이제 나 따위가 가슴을 아파한대야 무슨 소용이 있소. 조선에 남아 계신 형이나 R의 말을 참고삼아 쓰시기 바라오. 어쨌으나 나는 R에게서 목적한 여행권을 얻었소. R에게는 다만, +`나는 피곤한 몸을 좀 정양하고 싶다. 나는 내가 평소에 즐겨하는 바이칼 호반에서 눈과 얼음의 한겨울을 지내고 싶다.' +는 것을 여행의 이유로 삼았소. +R는 나의 초췌한 모양을 짐작하고 내 핑계를 그럴듯하게 아는 모양이었소. 그리고 나더러, `이왕 정양하려거든 카프카 지방으로 가거라. 거기는 기후 풍경도 좋고 또 요양원의 설비도 있다.'는 것을 말하였소. 나도 톨스토이의 소설에서, 기타의 여행기 등속에서 이 지방에 관한 말을 못 들은 것이 아니나 지금 내 처지에는 그런 따뜻하고 경치 좋은 지방을 가릴 여유도 없고 또 그러한 지방보다도 눈과 얼음과 바람의 시베리아의 겨울이 합당한 듯하였소. +그러나 나는 R의 호의를 굳이 사양할 필요도 없어서 그가 써 주는 대로 소개장을 다 받아 넣었소. 그는 나를 처남 매부 간이라고 소개해 주었소. +나는 모스크바 가는 다음 급행을 기다리는 사흘 동안 R의 집의 손이 되어서 R부처의 친절한 대우를 받았소. +그 후에는 나는 R와 조선에 관한 토론을 한 일은 없지마는 R가 이름지어 말을 할 때에는 조선을 잊었노라, 그리워할 것이 없노라, 하지마는 무의식적으로 말을 할 때에는 조선을 못 잊고 또 조선을 여러 점으로 그리워하는 양을 보았소. 나는 그것으로써 만족하게 여겼소. +나는 금요일 오후 세시 모스크바 가는 급행으로 하얼빈을 떠났소. 역두에는 R와 R의 가족이 나와서 꽃과 과일과 여러 가지 선물로 나를 전송하였소. R와 R의 가족은 나를 정말 형제의 예로 대우하여 차가 떠나려 할 때에 포옹과 키스로 작별하여 주었소. +이 날은 퍽 따뜻하고 일기가 좋은 날이었소. 하늘에 구름 한 점, 땅에 바람 한 점 없이 마치 늦은 봄날과 같이 따뜻한 날이었소. +차는 떠났소. 판다는 둥 안 판다는 둥 말썽 많은 동중로(지금은 북만 철로라고 하오.)의 국제 열차에 몸을 의탁한 것이오. +송화강(松花江:쑹화 강)의 철교를 건너오. 아아 그리도 낯익은 송화강! 송화강이 왜 낯이 익소. 이 송화강은 불함산(장백산)에 근원을 발하여 광막한 북만주의 사람도 없는 벌판을 혼자 소리도 없이 흘러가는 것이 내 신세와 같소. 이 북만주의 벌판을 만든 자가 송화강이지마는 나는 그만한 힘이 없는 것이 부끄러울 뿐이오. 이 광막한 북만의 벌판을 내 손으로 개척하여서 조선 사람의 낙원을 만들자 하고 뽐내어 볼까. 그것은 형이 하시오. 내 어린것이 자라거든 그놈에게나 그러한 생각을 넣어 주시오. +동양의 국제적 괴물인 하얼빈 시가도 까맣게 안개에서 스러져 버리고 말았소. 그러나 그 시가를 싼 까만 기운이 국제적 풍운을 포장한 것이라고 할까요. +가도가도 벌판. 서리맞은 마른 풀바다. 실개천 하나도 없는 메마른 사막. 어디를 보아도 산 하나 없으니 하늘과 땅이 착 달라붙은 듯한 천지. 구름 한 점 없건만도 그 큰 태양 가지고도 미처 다 비추지 못하여 지평선 호를 그린 지평선 위에는 항상 황혼이 떠도는 듯한 세계. 이 속으로 내가 몸을 담은 열차는 서쪽으로 서쪽으로 해가 가는 걸음을 따라서 달리고 있소. 열차가 달리는 바퀴 소리도 반향할 곳이 없어 힘없는 한숨같이 스러지고 마오. +기쁨 가진 사람이 지루해서 못 견딜 이 풍경은 나같이 수심 가진 사람에게는 가장 공상의 말을 달리기에 합당한 곳이오. +이 곳에도 산도 있고 냇물도 있고 삼림도 있고 꽃도 피고 날짐승, 길짐승이 날고 기던 때도 있었겠지요. 그러던 것이 몇만 년 지나는 동안에 산은 낮아지고 골은 높아져서 마침내 이 꼴이 된 것인가 하오. 만일 큰 힘이 있어 이 광야를 파낸다 하면 물 흐르고 고기 놀던 강과, 울고 웃던 생물이 살던 자취가 있을 것이오. 아아 이 모든 기억을 꽉 품고 죽은 듯이 잠잠한 광야에! +내가 탄 차가 F역에 도착하였을 때에는 북만주 광야의 석양의 아름다움은 그 극도에 달한 것 같았소. 둥긋한 지평선 위에 거의 걸린 커다란 해! 아마 그 신비하고 장엄함이 내 경험으로는 이 곳에서밖에는 볼 수 없는 것이라고생각하오. 이글이글 이글이글 그러면서도 둥글다는 체모를 변치 아니하는 그 지는 해! +게다가 먼 지평선으로부터 기어드는 황혼은 인제는 대지를 거의 다 덮어 버려서 마른 풀로 된 지면은 가뭇가뭇한 빛을 띠고 사막의 가는 모래를 머금은 지는 해의 광선을 반사하여서 대기는 짙은 자줏빛을 바탕으로 한 가지각색의 명암을 가진, 오색이 영롱한, 도무지 내가 일찍 경험해 보지 못한 색채의 세계를 이루었소. 아 좋다! +그 속에 수은같이 빛나는, 수없는 작고 큰 호수들의 빛! 그 속으로 날아오는 수없고 이름 모를 새들의 떼도 이 세상의 것이라고는 생각하지 아니하오. +나는 거의 무의식적으로 차에서 뛰어내렸소. 거의 떠날 시간이 다 되어서 짐의 일부분은 미처 가지지도 못하고 뛰어내렸소. 반쯤 미친 것이오. +정거장 앞 조그마한 아라사 사람의 여관에다가 짐을 맡겨 버리고 나는 단장을 끌고 철도 선로를 뛰어 건너서 호수의 수은빛 나는 곳을 찾아서 지향 없이 걸었소. +한 호수를 가서 보면 또 저 편 호수가 더 아름다워 보이오. 원컨대 저 지는 해가 다 지기 전에 이 광야에 있는 호수를 다 돌아보고 싶소. +내가 호숫 가에 섰을 때에 그 거울같이 잔잔한 호수면에 비치는 내 그림자의 외로움이여, 그러나 아름다움이여! 그 호수는 영원한 우주의 신비를 품고 하늘이 오면 하늘을, 새가 오면 새를, 구름이 오면 구름을, 그리고 내가 오면 나를 비추지 아니하오. 나는 호수가 되고 싶소. 그러나 형! 나는 이 호수면에서 얼마나 정임의 얼굴을 찾았겠소. 그것은 물리학적으로 불가능한 일이겠지요. 동경의 병실에 누워 있는 정임의 모양이 몽고 사막의 호수면에 비칠 리야 있겠소. 없겠지마는 나는 호수마다 정임의 그림자를 찾았소. 그러나 보이는 것은 외로운 내 그림자뿐이오. +`가자. 끝없는 사막으로 한없이 가자. 가다가 내 기운이 진하는 자리에 나는 내 손으로 모래를 파고 그 속에 내 몸을 묻고 죽어 버리자. 살아서 다시 볼 수 없는 정임의 「이데아」를 안고 이 깨끗한 광야에서 죽어 버리 자.' +하고 나는 지는 해를 향하고 한정 없이 걸었소. 사막이 받았던 따뜻한 기운은 아직도 다 식지는 아니하였소. 사막에는 바람 한 점도 없소. 소리 하나도 없소. 발자국 밑에서 우는 마른 풀과 모래의 바스락거리는 소리가 들릴 뿐이오. +나는 허리를 지평선에 걸었소. 그 신비한 광선은 내 가슴으로부터 위에만을 비추고 있소. +문득 나는 해를 따라가는 별 두 개를 보았소. 하나는 앞을 서고 하나는 뒤를 섰소. 앞의 별은 좀 크고 뒤의 별은 좀 작소. 이런 별들은 산 많은 나라 다시 말하면 서쪽 지평선을 보기 어려운 나라에서만 생장한 나로서는 보지 못하던 별이오. 나는 그 별의 이름을 모르오. `두 별'이오. +해가 지평선에서 뚝 떨어지자 대기의 자줏빛은 남빛으로 변하였소. 오직 해가 금시 들어간 자리에만 주홍빛의 여광이 있을 뿐이오. 내 눈앞에서는 남빛 안개가 피어오르는 듯하였소. 앞에 보이는 호수만이 유난히 빛나오. 또 한 떼의 이름 모를 새들이 수면을 스치며 날 저문 것을 놀라는 듯이 어지러이 날아 지나가오. 그들은 소리도 아니 하오. 날개치는 소리도 아니 들리오. 그것들은 사막의 황혼의 허깨비인 것 같소. +나는 자꾸 걷소. 해를 따르던 나는 두 별을 따라서 자꾸 걷소. +별들은 진 해를 따라서 바삐 걷는 것도 같고, 헤매는 나를 어떤 나라로 끄는 것도 같소. +아니 두 별 중에 앞선 별이 한 번 반짝하고는 최후로 한 번 반짝하고는 지평선 밑에 숨어 버리고 마오. 뒤에 남은 외별의 외로움이여! 나는 울고 싶었소. 그러나 나는 하나만 남은 작은 별 외로운 작은 별을 따라서 더 빨리 걸음을 걸었소. 그 한 별마저 넘어가 버리면 나는 어찌하오. +내가 웬일이오. 나는 시인도 아니요, 예술가도 아니오. 나는 정으로 행동한 일은 없다고 믿는 사람이오. 그러나 형! 이 때에 미친 것이 아니요, 내 가슴에는 무엇인지 모를 것을 따를 요샛말로 이른바 동경으로 찼소. +`아아 저 작은 별!' +그것도 지평선에 닿았소. +`아아 저 작은 별. 저것마저 넘어가면 나는 어찌하나.' +인제는 어둡소. 광야의 황혼은 명색뿐이요, 순식간이요, 해지자 신비하다고 할 만한 극히 짧은 동안에 아름다운 황혼을 조금 보이고는 곧 칠과 같은 암흑이오. 호수의 물만이 어디서 은빛을 받았는지 뿌옇게 나만이 유일한 존재다, 나만이 유일한 빛이다 하는 듯이 인제는 수은빛이 아니라 남빛을 발하고 있을 뿐이오. +나는 그 중 빛을 많이 받은, 그 중 환해 보이는 호수면을 찾아 두리번거리며, 그러나 빠른 걸음으로 헤매었소. 그러나 내가 좀더 맑은 호수면을 찾는 동안에 이 광야의 어둠은 더욱더욱 짙어지오. +나는 어떤 조그마한 호숫 가에 펄썩 앉았소. 내 앞에는 짙은 남빛의 수면에 조그마한 거울만한 밝은 데가 있소. 마치 내 눈에서 무슨 빛이 나와서, 아마 정임을 그리워하는 빛이 나와서 그 수면에 반사하는 듯이. 나는 허겁지겁 그 빤한 수면을 들여다보았소. 혹시나 정임의 모양이 거기 나타나지나 아니할까 하고. 세상에는 그러한 기적도 있지 아니한가 하고. +물에는 정임의 얼굴이 어른거리는 것 같았소. 이따금 정임의 눈도 어른거리고 코도 번뜻거리고 입도 번뜻거리는 것 같소. 그러나 수면은 점점 어두워 가서 그 환영조차 더욱 희미해지오. +나는 호수면에 빤하던 한 조각조차 캄캄해지는 것을 보고 숨이 막힐 듯함을 깨달으면서 고개를 들었소. +고개를 들려고 할 때에, 형이여, 이상한 일도 다 있소. 그 수면에 정임의 모양이, 얼굴만 아니라, 그 몸 온통이 그 어깨, 가슴, 팔, 다리까지도, 그 눈과 입까지도, 그 얼굴의 흰 것과 입술이 불그레한 것까지도, 마치 환한 대낮에 실물을 대한 모양으로 소상하게 나타났소. +"정임이!" +하고 나는 소리를 지르며 물로 뛰어들려 하였소. 그러나 형, 그 순간에 정임의 모양은 사라져 버리고 말았소. +나는 이 어둠 속에 어디 정임이가 나를 따라온 것같이 생각했소. 혹시나 정임이가 죽어서 그 몸은 동경의 대학 병원에 벗어 내어던지고 혼이 빠져 나와서 물에 비치었던 것이 아닐까, 나는 가슴이 울렁거림을 진정치 못하면서 호숫 가에서 벌떡 일어나서 어둠 속에 정임을 만져보려는 듯이, 어두워서 눈에 보지는 못하더라도 자꾸 헤매노라면 몸에 부딪히기라도 할 것 같아서 함부로 헤매었소. 그리고는 눈앞에 번뜻거리는 정임의 환영을 팔을 벌려서 안고 소리를 내어서 불렀소. +"정임이, 정임이." +하고 나는 수없이 정임을 부르면서 헤매었소. +그러나 형, 이것도 죄지요. 이것도 하나님께서 금하시는 일이지요. 그러길래 광야에 아주 어둠이 덮이고 새까만 하늘에 별이 총총하게 나고는 영 정임의 헛그림자조차 아니 보이지요. 나는 죄를 피해서 정임을 떠나서 멀리 온 것이니 정임의 헛그림자를 따라다니는 것도 옳지 않지요. +그렇지만 내가 이렇게 혼자서 정임을 생각만 하는 것이야 무슨 죄 될 것이 있을까요. 내가 정임을 만 리나 떠나서 이렇게 헛그림자나 그리며 그리워하는 것이야 무슨 죄가 될까요. 설사 죄가 되기로서니 낸들 이것까지야 어찌하오. 내가 내 혼을 죽여 버리기 전에야 내 힘으로 어찌하오. 설사 죄가 되어서 내가 지옥의 꺼지지 않는 유황불 속에서 영원한 형벌을 받게 되기로서니 그것을 어찌하오. 형, 이것, 이것도 말아야 옳은가요. 정임의 헛그림자까지도 끊어 버려야 옳은가요. +이 때요. 바로 이 때요. 내 앞 수십 보나 될까(캄캄한 밤이라 먼지 가까운지 분명히 알 수 없지마는) 하는 곳에 난데없는 등불 하나가 나서오. 나는 깜짝 놀라서 우뚝 섰소. 이 무인지경, 이 밤중에 갑자기 보이는 등불 그것은 마치 이 세상 같지 아니하였소. +저 등불이 어떤 등불일까, 그 등불이 몇 걸음 가까이 오니, 그 등불 뒤에 사람의 다리가 보이오. +"누구요?" +하는 것은 귀에 익은 조선말이오. 어떻게 이 몽고의 광야에서 조선말을 들을까 하고 나는 등불을 처음 볼 때보다 더욱 놀랐소. +"나는 지나가던 사람이오." +하고 나도 등불을 향하여 마주 걸어갔소. +그 사람은 등불을 들어서 내 얼굴을 비추어 보더니, +"당신 조선 사람이오?" +하고 묻소. +"네, 나는 조선 사람이오. 당신도 음성을 들으니 조선 사람인데, 어떻게 이런 광야에, 아닌 밤중에, 여기 계시단 말이오." +하고 나는 놀라는 표정 그대로 대답하였소. +"나는 이 근방에 사는 사람이니까 여기 오는 것도 있을 일이지마는 당신이야말로 이 아닌 밤중에." +하고 육혈포를 집어넣고, 손을 내밀어서 내게 악수를 구하오. +나는 반갑게 그의 손을 잡았소. 그러나 나는 `죽을 지경에 어떻게 오셨단 말이오.' 하고, 그가 내가 무슨 악의를 가진 흉한이 아닌 줄을 알고 손에 빼어들었던 육혈포로 시기를 잠깐이라도 노린 것을 불쾌하게 생각하였던 것이오. +그도 내 이름도 묻지 아니하고 또 나도 그의 이름을 묻지 아니하고 나는 그에게 끌려서 그가 인도하는 곳으로 갔소. 그 곳이란 것은 아까 등불이 처음 나타나던 곳인 듯한데, 거기서 또 한 번 놀란 것은 어떤 부인이 있는 것이오. 남자는 아라사식 양복을 입었으나 부인은 중국 옷 비슷한 옷을 입었소. 남자는 나를 끌어서 그 부인에게 인사하게 하고, +"이는 내 아내요." +하고 또 그 아내라는 부인에게는, +"이 이는 조선 양반이오. 성함이 뉘시죠?" +하고 그는 나를 바라보오. 나는, +"최석입니다." +하고 바로 대답하였소. +"최석 씨?" +하고 그 남자는 소개하던 것도 잊어버리고 내 얼굴을 들여다보오. +"네, 최석입니다." +"아 ●●학교 교장으로 계신 최석 씨." +하고 그 남자는 더욱 놀라오. +"네, 어떻게 내 이름을 아세요?" +하고 나도 그가 혹시 아는 사람이나 아닌가 하고 등불 빛에 얼굴을 들여다 보았으나 도무지 그 얼굴이 본 기억이 없소. +"최 선생을 내가 압니다. 남 선생한테 말씀을 많이 들었지요. 그런데 남 선생도 돌아가신 지가 벌써 몇 핸가." +하고 감개무량한 듯이 그 아내를 돌아보오. +"십오 년이지요." +하고 곁에 섰던 부인이 말하오. +"벌써 십오 년인가." +하고 그 남자는 나를 보고, +"정임이 잘 자랍니까? 벌써 이십이 넘었지." +하고 또 부인을 돌아보오. +"스물세 살이지." +하고 부인이 확실치 아니한 듯이 대답하오. +"네, 스물세 살입니다. 지금 동경에 있습니다. 병이 나서 입원한 것을 보고 왔는데." +하고 나는 번개같이 정임의 병실과 정임의 호텔 장면 등을 생각하고 가슴이 설렘을 깨달았소. 의외인 곳에서 의외인 사람들을 만나서 정임의 말을 하게 된 것을 기뻐하였소. +"무슨 병입니까. 정임이가 본래 몸이 약해서." +하고 부인이 직접 내게 묻소. +"네. 몸이 좀 약합니다. 병이 좀 나은 것을 보고 떠났습니다마는 염려가 됩니다." +하고 나는 무의식중에 고개를 동경이 있는 방향으로 돌렸소. 마치 고개를 동으로 돌리면 정임이가 보이기나 할 것같이. +"자, 우리 집으로 갑시다." +하고 나는 아직 그의 성명도 모르는 남자는, 그의 아내를 재촉하더니, +"우리가 조선 동포를 만난 것이 십여 년 만이오. 그런데 최 선생, 이것을 좀 보시고 가시지요." +하고 그는 빙그레 웃으면서 나를 서너 걸음 끌고 가오. 거기는 조그마한 무덤이 있고 그 앞에는 석 자 높이나 되는 목패를 세웠는데 그 목패에는 `두 별 무덤'이라는 넉 자를 썼소. +내가 이상한 눈으로 그 무덤과 목패를 보고 있는 것을 보고 그는, +"이게 무슨 무덤인지 아십니까?" +하고 유쾌하게 묻소. +"두 별 무덤이라니 무슨 뜻인가요?" +하고 나도 그의 유쾌한 표정에 전염이 되어서 웃고 물었소. +"이것은 우리 둘의 무덤이외다." +하고 그는 아내의 어깨를 치며 유쾌하게 웃었소. 부인은 부끄러운 듯이 웃고 고개를 숙이오. +도무지 모두 꿈 같고 환영 같소. +"자 갑시다. 자세한 말은 우리 집에 가서 합시다." +하고 서너 걸음 어떤 방향으로 걸어가니 거기는 말을 세 필이나 맨 마차가 있소. 몽고 사람들이 가족을 싣고 수초를 따라 돌아다니는 그러한 마차요. 삿자리로 홍예형의 지붕을 만들고 그 속에 들어가 앉게 되었소. 그의 부인과 나와는 이 지붕 속에 들어앉고 그는 손수 어자대에 앉아서 입으로 쮸쮸쮸쮸 하고 말을 모오. 등불도 꺼 버리고 캄캄한 속으로 달리오. +"불이 있으면 군대에서 의심을 하지요. 도적놈이 엿보지요. 게다가 불이 있으면 도리어 앞이 안 보인단 말요. 쯧쯧쯧쯧!" +하는 소리가 들리오. +대체 이 사람은 무슨 사람인가. 또 이 부인은 무슨 사람인가 하고 나는 어두운 속에서 혼자 생각하였소. 다만 잠시 본 인상으로 보아서 그들은 행복된 부부인 것 같았소. 그들이 무엇 하러 이 아닌 밤중에 광야에 나왔던가. 또 그 이상야릇한 두 별 무덤이란 무엇인가. +나는 불현듯 집을 생각하였소. 내 아내와 어린것들을 생각하였소. 가정과 사회에서 쫓겨난 내가 아니오. 쫓겨난 자의 생각은 언제나 슬픔뿐이었소. +나는 내 아내를 원망치 아니하오. 그는 결코 악한 여자가 아니오. 다만 보통 여자요. 그는 질투 때문에 이성의 힘을 잃은 것이오. 여자가 질투 때문에 이성을 잃는 것이 천직이 아닐까요. 그가 나를 사랑하길래 나를 위해서 질투를 가지는 것이 아니오. +설사 질투가 그로 하여금 칼을 들어 내 가슴을 찌르게 하였다 하더라도 나는 감사한 생각을 가지고 눈을 감을 것이오. 사랑하는 자는 질투한다고 하오. 질투를 누르는 것도 아름다운 일이지마는 질투에 타는 것도 아름다운 일이 아닐까요. +덜크럭덜크럭 하고 차바퀴가 철로길을 넘어가는 소리가 나더니 이윽고 마차는 섰소. +앞에 빨갛게 불이 비치오. +"자 이게 우리 집이오." +하고 그가 마차에서 뛰어내리는 양이 보이오. 내려 보니까 달이 올라오오. 굉장히 큰 달이, 붉은 달이 지평선으로서 넘석하고 올라오오. +달빛에 비추인 바를 보면 네모나게 담 담이라기보다는 성을 둘러쌓은 달 뜨는 곳으로 열린 대문을 들어서서 넓은 마당에 내린 것을 발견하였소. +"아버지!" +"엄마!" +하고 아이들이 뛰어나오오. 말만큼이나 큰 개가 네 놈이나 꼬리를 치고 나오오. 그놈들이 주인집 마차 소리를 알아듣고 짖지 아니한 모양이오. +큰 아이는 계집애로 여남은 살, 작은 아이는 사내로 육칠 세, 모두 중국 옷을 입었소. +우리는 방으로 들어갔소. 방은 아라사식 절반, 중국식 절반으로 세간이 놓여 있고 벽에는 조선 지도와 단군의 초상이 걸려 있소. +그들 부처는 지도와 단군 초상 앞에 허리를 굽혀 배례하오. 나도 무의식적으로 그대로 하였소. +그는 차를 마시며 이렇게 말하오. +"우리는 자식들을 이 흥안령 가까운 무변 광야에서 기르는 것으로 낙을 삼고 있지요. 조선 사람들은 하도 마음이 작아서 걱정이니 이런 호호탕탕한 넓은 벌판에서 길러나면 마음이 좀 커질까 하지요. 또 흥안령 밑에서 지나 중원을 통일한 제왕이 많이 났으니 혹시나 그 정기가 남아 있을까 하지요. 우리 부처의 자손이 몇 대를 두고 퍼지는 동안에는 행여나 마음 큰 인물이 하나 둘 날는지 알겠어요, 하하하하." +하고 그는 제 말을 제가 비웃는 듯이 한바탕 웃고 나서, +"그러나 이건 내 진정이외다. 우리도 이렇게 고국을 떠나 있지마는 그래도 고국 소식이 궁금해서 신문 하나는 늘 보지요. 하지만 어디 시원한 소식이 있어요. 그저 조리복소니가 되어가는 것이 아니면 조그마한 생각을 가지고, 눈곱만한 야심을 가지고, 서 푼어치 안 되는 이상을 가지고 찧고 까불고 싸우고 하는 것밖에 안 보이니 이거 어디 살 수가 있나. 그래서 나는 마음 큰 자손을 낳아서 길러 볼까 하고 이를테면 새 민족을 하나 만들어 볼까 하고, 둘째 단군, 둘째 아브라함이나 하나 낳아 볼까 하고 하하하하앗하." +하고 유쾌하게, 그러나 비통하게 웃소. +나는 저녁을 굶어서 배가 고프고, 밤길을 걸어서 몸이 곤한 것도 잊고 그의 말을 들었소. +부인이 김이 무럭무럭 나는 호떡을 큰 뚝배기에 담고 김치를 작은 뚝배기에 담고, 또 돼지고기 삶은 것을 한 접시 담아다가 탁자 위에 놓소. +건넌방이라고 할 만한 방에서 젖먹이 우는 소리가 들리오. 부인은 삼십이나 되었을까, 남편은 서른댓 되었을 듯한 키가 훨쩍 크고 눈과 코가 크고 손도 큰 건장한 대장부요, 음성이 부드러운 것이 체격에 어울리지 아니하나 그것이 아마 그의 정신 생활이 높은 표겠지요. +"신문에서 최 선생이 학교를 고만두시게 되었다는 말도 보았지요. 그러나 나는 그것이 다 최 선생에게 대한 중상인 줄을 짐작하였고, 또 오늘 이렇게 만나 보니까 더구나 그것이 다 중상인 줄을 알지요." +하고 그는 확신 있는 어조로 말하오. +"고맙습니다." +나는 이렇게밖에 대답할 말이 없었소. +"아, 머, 고맙다고 하실 것도 없지요." +하고 그는 머리를 뒤로 젖히고 한참이나 생각을 하더니 우선 껄껄 한바탕 웃고 나서, +"내가 최 선생이 당하신 경우와 꼭 같은 경우를 당하였거든요. 이를테면 과부 설움은 동무 과부가 안다는 것이지요." +하고 그는 자기의 내력을 말하기 시작하오. +"내 집은 본래 서울입니다. 내가 어렸을 적에 내 선친께서 시국에 대해서 불평을 품고 당신 삼 형제의 가족을 끌고 재산을 모두 팔아 가지고 간도에를 건너오셨지요. 간도에 맨 먼저 ●●학교를 세운 이가 내 선친이지요." +여기까지 하는 말을 듣고 나는 그가 누구인지를 알았소. 그는 R씨라고 간도 개척자요, 간도에 조선인 문화를 세운 이로 유명한 이의 아들인 것이 분명하오. 나는 그의 이름이 누구인지도 물어 볼 것 없이 알았소. +"아 그러십니까. 네, 그러세요." +하고 나는 감탄하였소. +"네, 내 선친을 혹 아실는지요. 선친의 말씀이 노 그러신단 말씀야요. 조선 사람은 속이 좁아서 못쓴다고 <정감록>에도 그런 말이 있다고 조선은 산이 많고 들이 좁아서 사람의 마음이 작아서 큰일하기가 어렵고, 큰사람이 나기가 어렵다고. 웬만치 큰사람이 나면 서로 시기해서 큰일할 새가 없이 한다고 그렇게 <정감록>에도 있다더군요. 그래서 선친께서 자손에게나 희망을 붙이고 간도로 오신 모양이지요. 거기서 자라났다는 것이 내 꼴입니다마는, 아하하. +내가 자라서 아버지께서 세우신 K여학교의 교사로 있을 때 일입니다. 지금 내 아내는 그 때 학생으로 있었구. 그러자 내 아버지께서 재산이 다 없어져서 학교를 독담하실 수가 없고, 또 얼마 아니해서 아버지께서 돌아가시고 보니 학교에는 세력 다툼이 생겨서 아버지의 후계자로 추정되는 나를 배척하게 되었단 말씀이오. 거기서 나를 배척하는 자료를 삼은 것이 나와 지금 내 아내가 된 학생의 관계란 것인데 이것은 전연 무근지설인 것은 말할 것도 없소. 나도 총각이요, 그는 처녀니까 혼인을 하자면 못 할 것도 없지마는 그것이 사제 관계라면 중대 문제거든. 그래서 나는 단연히 사직을 하고 내가 사직한 것은 제 죄를 승인한 것이라 하여서 그 학생 지금 내 아내도 출교 처분을 당한 것이오. 그러고 보니, 그 여자의 아버지 내 장인이지요 그 여자의 아버지는 나를 죽일 놈같이 원망을 하고 그 딸을 죽일 년이라고 감금을 하고 어쨌으나 조그마한 간도 사회에서 큰 파문을 일으켰단 말이오. +이 문제를 더 크게 만든 것은 지금 내 아내인, 그 딸의 자백이오. 무어라고 했는고 하니, 나는 그 사람을 사랑하오, 그 사람한테가 아니면 시집을 안 가오, 하고 뻗댔단 말요. +나는 이 여자가 이렇게 나를 생각하는가 할 때 의분심이 나서 나는 어떻게 해서든지 이 여자와 혼인하리라고 결심을 하였소. 나는 마침내 정식으로 K장로라는 내 장인에게 청혼을 하였으나 단박에 거절을 당하고 말았지요. K장로는 그 딸을 간도에 두는 것이 옳지 않다고 해서 서울로 보내기로 하였단 말을 들었소. 그래서 나는 최후의 결심으로 그 여자 지금 내 아내 된 사람을 데리고 간도에서 도망하였소. 하하하하. 밤중에 단둘이서. +지금 같으면야 사제간에 결혼을 하기로 그리 큰 문제가 될 것이 없지마는 그 때에 어디 그랬나요. 사제간에 혼인이란 것은 부녀간에 혼인한다는 것과 같이 생각하였지요. 더구나 그 때 간도 사회에는 청교도적 사상과 열렬한 애국심이 있어서 도덕 표준이 여간 높지 아니하였지요. 그런 시대니까 내가 내 제자인 여학생을 데리고 달아난다는 것은 살인 강도를 하는 이상으로 무서운 일이었지요. 지금도 나는 그렇게 생각합니다마는. +그래서 우리 두 사람은 우리 두 사람이라는 것보다도 내 생각에는 어찌하였으나 나를 위해서 제 목숨을 버리려는 그에게 사실 나도 마음 속으로는 그를 사랑하였지요. 다만 사제간이니까 영원히 달할 수는 없는 사랑이라고 단념하였을 뿐이지요. 그러니까 비록 부처 생활은 못 하더라도 내가 그의 사랑을 안다는 것과 나도 그를 이만큼 사랑한다는 것만을 보여 주자는 것이지요. +때는 마침 가을이지마는, 몸에 지닌 돈도 얼마 없고 천신만고로 길림까지를 나와 가지고는 배를 타고 송화강을 내려서 하얼빈에 가 가지고 거 기서 간신히 치타까지의 여비와 여행권을 얻어 가지고 차를 타고 떠나지 않았어요. 그것이 바로 십여 년 전 오늘이란 말이오." +이 때에 부인이 옥수수로 만든 국수와 감자 삶은 것을 가지고 들어오오. +나는 R의 말을 듣던 끝이라 유심히 부인을 바라보았소. 그는 중키나 되는 둥근 얼굴이 혈색이 좋고 통통하여 미인이라기보다는 씩씩한 여자요. 그런 중에 조선 여자만이 가지는 아담하고 점잖은 맛이 있소. +"앉으시지요. 지금 두 분께서 처음 사랑하시던 말씀을 듣고 있습니다." +하고 나는 부인에게 교의를 권하였소. +"아이, 그런 말씀은 왜 하시오." +하고 부인은 갑자기 십 년이나 어려지는 모양으로 수삽한 빛을 보이고 고개를 숙이고 달아나오. +"그래서요. 그래 오늘이 기념일이외다그려." +하고 나도 웃었소. +"그렇지요. 우리는 해마다 오늘이 오면 우리 무덤에 성묘를 가서 하룻밤을 새우지요. 오늘은 손님이 오셔서 중간에 돌아왔지만, 하하하하." +하고 그는 유쾌하게 웃소. +"성묘라니?" +하고 나는 물었소. +"아까 보신 두 별 무덤 말이오. 그것이 우리 내외의 무덤이지요. 하하하하." +"…………." +나는 영문을 모르고 가만히 앉았소. +"내 이야기를 들으시지요. 그래 둘이서 차를 타고 오지 않았겠어요. 물론 여전히 선생님과 제자지요. 그렇지만 워낙 여러 날 단둘이서 같이 고생을 하고 여행을 했으니 사랑의 불길이 탈 것이야 물론 아니겠어요. 다만 사제라는 굳은 의리가 그것을 겉에 나오지 못하도록 누른 것이지요. ……그런데 꼭 오늘같이 좋은 날인데 여기는 대개 일기가 일정합니다. 좀체로 비가 오는 일도 없고 흐리는 날도 없지요. 헌데 F역에를 오니까 참 석양 경치가 좋단 말이오. 그 때에 불현듯, 에라 여기서 내려서 이 석양 속에 저 호숫 가에 둘이서 헤매다가 깨끗이 사제의 몸으로 이 깨끗한 광야에 묻혀 버리자 하는 생각이 나겠지요. 그래 그 때 말을 내 아내 그 때에는 아직 아내가 아니지요 내 아내에게 그런 말을 하였더니 참 좋다고 박장을 하고 내 어깨에 매달리는구려. 그래서 우리 둘은 차가 거의 떠날 임박해서 차에서 뛰어내렸지요." +하고 그는 그때 광경을 눈앞에 그리는 모양으로 말을 끊고 우두커니 허공을 바라보오. 그러나 그의 입 언저리에는 유쾌한 회고에서 나오는 웃음이었소. +"이야기 다 끝났어요?" +하고 부인이 크바스라는 청량 음료를 들고 들어오오. +"아니오. 이제부터가 정통이니 당신도 거기 앉으시오. 지금 차에서 내린 데까지 왔는데 당신도 앉아서 한 파트를 맡으시오." +하고 R는 부인의 손을 잡아서 자리에 앉히오. 부인도 웃으면서 앉소. +"최 선생 처지가 꼭 나와 같단 말요. 정임의 처지가 당신과 같고." +하고 그는 말을 계속하오. +"그래 차에서 내려서 나는 이 양반하고 물을 찾아 헤매었지요. 아따, 석양이 어떻게 좋은지 이 양반은 박장을 하고 노래를 부르고 우리 둘은 마치 유쾌하게 산보하는 사람 같았지요." +"참 좋았어요. 그 때에는 참 좋았어요. 그 석양에 비친 광야와 호수라는 건 어떻게 좋은지 그 수은 같은 물 속에 텀벙 뛰어들고 싶었어요. 그 후엔 해마다 보아도 그만 못해." +하고 부인이 참견을 하오. +아이들은 다 자는 모양이오. +"그래 지향없이 헤매는데 해는 뉘엿뉘엿 넘어가구, 어스름은 기어들고 그 때 마침 하늘에는 별 둘이 나타났단 말이야. 그것을 이 여학생이 먼저 보고서 갑자기 추연해지면서 선생님 저 별 보셔요, 앞선 큰 별은 선생님이 구 따라가는 작은 별은 저야요, 하겠지요. 그 말이, 또 그 태도가 어떻게 가련한지. 그래서 나는 하늘을 바라보니깐 과연 별 두 개가 지는 해를 따르는 듯이 따라간다 말요. 말을 듣고 보니 과연 우리 신세와도 같지 않아요? +그리고는 이 사람이 또 이럽니다그려 `선생님, 앞선 큰 별은 아무리 따라도 저 작은 별은 영원히 따라잡지 못하겠지요. 영원히 영원히 따라가다가 따라가다가 못 해서 마침내는 저 작은 별은 죽어서 검은 재가 되고 말겠지요? 저 작은 별이 제 신세와 어쩌면 그리 같을까.' 하고 한탄을 하겠지요. 그 때에 한탄을 하고 눈물을 흘리고 섰는 어린 처녀의 석양빛에 비췬 모양을 상상해 보세요, 하하하하. 그 때에는 당신도 미인이었소. 하하하하." +하고 내외가 유쾌하게 웃는 것을 보니 나는 더욱 적막하여짐을 깨달았소. 어쩌면 그 석양, 그 두 별이 이들에게와 내게 꼭 같은 인상을 주었을까 하니 참으로 이상하다 하였소. +"그래 인제." +하고 R는 다시 이야기를 계속하오. +"그래 인제 둘이서 그야말로 감개무량하게 두 별을 바라보며 걸었지요. 그러다가 해가 넘어가고 앞선 큰 별이 넘어가고 그리고는 혼자서 깜빡깜빡하고 가던 작은 별이 넘어가니 우리는 그만 땅에 주저앉았소. 거기가 어딘고 하니 그 두 별 무덤이 있는 곳이지요. `선생님 저를 여기다가 파묻어 주시고 가셔요. 선생님 손수 저를 여기다가 묻어 놓고 가 주셔요.' 하고 이 사람이 조르지요." +하는 것을 부인은, +"내가 언제." +하고 남편을 흘겨보오. +"그럼 무에라고 했소? 어디 본인이 한 번 옮겨 보오." +하고 R가 말을 끊소. +"간도를 떠난 지가 한 달이 되도록 단둘이 다녀도 요만큼도 귀해 주는 점이 안 뵈니 그럼 파묻어 달라고 안 해요?" +하고 부인은 웃소. +"흥흥." +하고 R는 부인의 말에 웃고 나서, +"그 자리에 묻어 달란 말을 들으니까, 어떻게 측은한지, 그럼 나도 함께 묻히자고 그랬지요. 나는 그 때에 참말 그 자리에 함께 묻히고 싶었어요. 그래서 나는 손으로 곧 구덩이를 팠지요. 떡가루 같은 모래판이니까 파기는 힘이 아니 들겠지요. 이이도 물끄러미 내가 땅을 파는 것을 보고 섰더니만 자기도 파기를 시작하겠지요." +하고 내외가 다 웃소. +"그래 순식간에……." +하고 R는 이야기를 계속하오. +"순식간에 둘이 드러누울 만한 구덩이를 아마 두 자 깊이나 되게, 네모나게 파 놓고는 내가 들어가 누워 보고 그러고는 또 파고 하여 아주 편안한 구덩이를 파고 나서는 나는 아주 세상을 하직할 셈으로 사방을 둘러보 고 사방이래야 컴컴한 어둠밖에 없지만 사방을 둘러보고, 이를테면 세상과 작별을 하고 드러누웠지요. 지금 이렇게 회고담을 할 때에는 우습기도 하지마는 그 때에는 참으로 종교적이라 할 만한 엄숙이었소. 그때 우리 둘의 처지는 앞도 절벽, 뒤도 절벽이어서 죽는 길밖에 없었지요. 또 그뿐 아니라 인생의 가장 깨끗하고 가장 사랑의 맑은 정이 타고 가장 기쁘고도 슬프고도 이를테면 모든 감정이 절정에 달하고, 그러한 순간에 목숨을 끊어 버리는 것이 가장 좋은 일이요, 가장 마땅한 일같이 생각하였지요. 광야에 아름다운 황혼이 순간에 스러지는 모양으로 우리 두 생명의 아름다움도 순간에 스러지자는 우리는 철학자도 시인도 아니지마는 우리들의 환경이 우리 둘에게 그러한 생각을 넣어 준 것이지요. +그래서 내가 가만히 드러누워 있는 것을 저이가 물끄러미 보고 있더니 자기도 내 곁에 들어와 눕겠지요. 그런 뒤에는 황혼에 남은 빛도 다 스러지고 아주 캄캄한 암흑 세계가 되어 버렸지요. 하늘에 어떻게 그렇게 별이 많은지. 가만히 하늘을 바라보노라면 참 별이 많아요. 우주란 참 커요. 그런데 이 끝없이 큰 우주에 한없이 많은 별들이 다 제자리를 지키고 제 길을 지켜서 서로 부딪지도 아니하고 끝없이 긴 시간에 질서를 유지하고 있는 것을 보면 우주에는 어떤 주재하는 뜻, 섭리하는 뜻이 있다 하는 생각이 나겠지요. 나도 예수교인의 가정에서 자라났지마는 이 때처럼 하나님이라 할까 이름은 무엇이라고 하든지 간에 우주의 섭리자의 존재를 강렬하게 의식한 일은 없었지요. +그렇지만 `사람의 마음에 비기면 저까짓 별들이 다 무엇이오?' 하고 그때 겨우 열여덟 살밖에 안 된 이이가 내 귀에 입을 대고 말할 때에는 나도 참으로 놀랐습니다. 나이는 나보다 오륙 년 상관밖에 안 되지마는 이십 세 내외에 오륙 년 상관이 적은 것인가요? 게다가 나는 선생이요 자기는 학생이니까 어린애로만 알았던 것이 그런 말을 하니 놀랍지 않아요? 어째서 사람의 마음이 하늘보다도 더 이상할까 하고 내가 물으니까, 그 대답이 `나는 무엇이라고 설명할 수가 없지마는 내 마음 속에 일어나는 것이 하늘이나 땅에 일어나는 모든 것보다도 더 아름답고 더 알 수 없고 더 뜨겁고 그런 것 같아요.' 그러겠지요. 생명이란 모든 아름다운 것 중에 가장 아름다운 것이라는 것을 나는 깨달았어요. 그 말에, `그렇다 하면 이 아름답고 신비한 생명을 내는 우주는 더 아름다운 것이 아니오?' 하고 내가 반문하니까, 당신(부인을 향하여) 말이, `전 모르겠어요, 어쨌으나 전 행복합니다. 저는 이 행복을 깨뜨리고 싶지 않습니다. 놓쳐 버리고 싶지 않습니다. 이 행복 선생님 곁에 있는 이 행복을 꽉 안고 죽고 싶어요.' 그러지 않았소?" +"누가 그랬어요? 아이 난 다 잊어버렸어요." +하고 부인은 차를 따르오. R는 인제는 하하하 하는 웃음조차 잊어버리고, 부인에게 농담을 붙이는 것조차 잊어버리고, 그야말로 종교적 엄숙 그대로말을 이어, +"`자 저는 약을 먹어요.' 하고 손을 입으로 가져가는 동작이 감행되겠지요. 약이란 것은 하얼빈에서 준비한 아편이지요. 하얼빈서 치타까지 가는 동안에 흥안령이나 어느 삼림지대나 어디서나 죽을 자리를 찾자고 준비한 것이니까. 나는 입 근처로 가는 그의 손을 붙들었어요. 붙들면서 나는 `잠깐만 기다리오. 오늘 밤 안으로 그 약을 먹으면 고만이 아니오? 이 행복된 순간을 잠깐이라도 늘립시다. 달 올라올 때까지만.' 나는 이렇게 말했지요. `선생님도 행복되셔요? 선생님은 불행이시지. 저 때문에 불행이시지. 저만 이곳에 묻어 주시구는 선생님은 세상에 돌아가 사셔요, 오래오래 사셔요, 일 많이 하고 사셔요.' 하고 울지 않겠어요. 나는 그 때에 내 아내가 하던 말을 한 마디도 잊지 아니합니다. 그 말을 듣던 때의 내 인상은 아마 일생 두고 잊히지 아니하겠지요. +나는 자백합니다. 그 순간에 나는 처음으로 내 아내를 안고 키스를 하였지요. 내 속에 눌리고 눌리고 쌓이고 하였던 열정이 그만 일시에 폭발되었던 것이오. 아아 이것이 최초의 것이요, 동시에 최후의 것이로구나 할 때에 내 눈에서는 끓는 듯한 눈물이 흘렀소이다. 두 사람의 심장이 뛰는 소리, 두 사람의 풀무 불길 같은 숨소리. +이윽고 달이 떠올라 왔습니다. 가이없는 벌판이니까 달이 뜨니까 갑자기 천지가 환해지고 우리 둘이 손으로 파서 쌓아 놓은 흙무더기가 이 산 없는 세상에 산이나 되는 것같이 조그마한 검은 그림자를 지고 있겠지요. `자 우리 달빛을 띠고 좀 돌아다닐까.' 하고 나는 아내를 안아 일으켰지요. 내 팔에 안겨서 고개를 뒤로 젖힌 내 아내의 얼굴이 달빛에 비친 양을 나는 잘 기억합니다. 실신한 듯한, 만족한 듯한, 그리고도 절망한 듯한 그 표정을 무엇으로 그릴지 모릅니다. 그림도 그릴 줄 모르고 조각도 할 줄 모르고 글도 쓸 줄 모르는 내가 그것을 어떻게 그립니까. 그저 가슴 속에 품고 이렇게 오늘의 내 아내를 바라볼 뿐이지요. +나는 내 아내를 팔에 걸고 네, 걸었다고 하는 것이 가장 합당하지 요 이렇게 팔에다 걸고 달빛을 받은 황량한 벌판, 아무리 하여도 환하게 밝아지지는 아니하는 벌판을 헤매었습니다. 이따금 내 아내가, `어서 죽고 싶어요, 전 죽고만 싶어요.' 하는 말에는 대답도 아니 하고. 죽고 싶다는 그 말은 물론 진정일 것이지요. 아무리 맑은 일기라 하더라도 오후가 되면 흐려지는 법이니까 오래 살아가는 동안에 늘 한 모양으로 이 순간같이 깨끗하고 뜨거운 기분으로 갈 수는 없지 않아요? 불쾌한 일도 생기고, 보기 흉한 일도 생길는지 모르거든. 그러니까 이 완전한 깨끗과 완전한 사랑과 완전한 행복 속에 죽어 버리자는 뜻을 나는 잘 알지요. 더구나 우리들이 살아 남는대야 앞길이 기구하지 평탄할 리는 없지 아니해요? 그래서 나는 `죽지, 우리 이 달밤에 실컷 돌아다니다가, 더 돌아다니기가 싫거든 그 구덩에 돌아가서 약을 먹읍시다.' 이렇게 말하고 우리 둘은 헤맸지요. 낮에 보면 어디까지나 평평한 벌판인 것만 같지마는 달밤에 보면 이 사막에도 아직 채 스러지지 아니한 산의 형적이 남아 있어서 군데군데 거뭇거뭇한 그림자가 있겠지요. 그 그림자 속에는 걸어 들어가면 어떤 데는 우리 허리만큼 그림자에 가리우고 어떤 데는 우리 둘을 다 가리워 버리는 데도 있단 말야요. 죽음의 그림자라는 생각이 나면 그래도 몸에 소름이 끼쳐요. +차차 달이 높아지고 추위가 심해져서 바람결이 지나갈 때에는 눈에서 눈물이 날 지경이지요. 원체 대기 중에 수분이 적으니까 서리도 많지 않지마는, 그래도 대기 중에 있는 수분은 다 얼어 버려서 얼음가루가 되었는 게지요. 공중에는 반짝반짝하는 수정가루 같은 것이 보입니다. 낮에는 땀이 흐르리만큼 덥던 사막도 밤이 되면 이렇게 기온이 내려가지요. 춥다고 생각은 하면서도 춥다는 말은 아니 하고 우리는 어떤 때에는 달을 따라서, 어떤 때에는 달을 등지고, 어떤 때에는 호수에 비친 달을 굽어보고, 이 모양으로 한없이 말도 없이 돌아다녔지요. 이 세상 생명의 마지막 순간을 힘껏 의식하려는 듯이. +마침내 `나는 더 못 걸어요.' 하고 이이가 내 어깨에 매달려 버리고 말았지요." +하고 R가 부인을 돌아보니 부인은 편물하던 손을 쉬고, +"다리가 아픈 줄은 모르겠는데 다리가 이리 뉘구 저리 뉘구 해서 걸음을 걸을 수가 없었어요. 춥기는 하구." +하고 소리를 내어서 웃소. +"그럴 만도 하지." +하고 R는 긴장한 표정을 약간 풀고 앉은 자세를 잠깐 고치며, +"그 후에 그 날 밤 돌아다닌 곳을 더듬어 보니까, 자세히는 알 수 없지마는 삼십 리는 더 되는 것 같거든. 다리가 아프지 아니할 리가 있나." +하고 차를 한 모금 마시고 나서 말을 계속하오. +"그래서 나는 내 외투를 벗어서, 이이(부인)를 싸서 어린애 안듯이 안고 걸었지요. 외투로 쌌으니 자기도 춥지 않구, 나는 또 무거운 짐을 안았으니 땀이 날 지경이구, 그뿐 아니라 내가 제게 주는 최후의 서비스라 하니 기쁘고, 말하자면 일거 삼득이지요. 하하하하. 지난 일이니 웃지마는 그 때 사정을 생각해 보세요, 어떠했겠나." +하고 R는 약간 처참한 빛을 띠면서, +"그러니 그 구덩이를 어디 찾을 수가 있나. 얼마를 찾아 돌아다니다가 아무 데서나 죽을 생각도 해 보았지마는 몸뚱이를 그냥 벌판에 내놓고 죽고 싶지는 아니하고 또 그 구덩이가 우리 두 사람에게 특별한 의미가 있는 것 같아서 기어코 그것을 찾아 내고야 말았지요. 그 때는 벌써 새벽이 가까웠던 모양이오. 열 시나 넘어서 뜬 하현달이 낮이 기울었으니 그렇지 않겠어요. 그 구덩이에 와서 우리는 한 번 더 하늘과 달과 별과, 그리고 마음 속에 떠오른 사람들과 하직하고 약 먹을 준비를 했지요. +약을 검은 고약과 같은 아편을 맛이 쓰다는 아편을 물도 없이 먹으려 들었지요. +우리 둘은 아까 모양으로 가지런히 누워서 하늘을 바라보았는데 달이 밝으니까 보이던 별들 중에 숨은 별이 많고 또 별들의 위치 우리에게 낯익은 북두칠성 자리도 변했을 것 아니야요. 이상한 생각이 나요. 우리가 벌판으로 헤매는 동안에 천지가 모두 변한 것 같아요. 사실 변하였지요. 그 변한 것이 우스워서 나는 껄껄 웃었지요. 워낙 내가 웃음이 좀 헤프지만 이 때처럼 헤프게 실컷 웃어 본 일은 없습니다. +왜 웃느냐고 아내가 좀 성을 낸 듯이 묻기로, `천지와 인생이 변하는 것이 우스워서 웃었소.' 그랬지요. 그랬더니, `천지와 인생은 변할는지 몰라도 내 마음은 안 변해요!' 하고 소리를 지르겠지요. 퍽 분개했던 모양이야." +하고 R는 그 아내를 보오. +"그럼 분개 안 해요? 남은 죽을 결심을 하고 발발 떨구 있는데 곁에서 껄껄거리고 웃으니, 어째 분하지가 않아요. 나는 분해서 달아나려고 했어요." +하고 부인은 아직도 분함이 남은 것같이 말하오. +"그래 달아나지 않았소?" +하고 R는 부인이 벌떡 일어나서 비틀거리고 달아나는 흉내를 팔과 다리로 내고 나서, +"이래서 죽는 시간이 지체가 되었지요. 그래서 내가 빌고 달래고 해서 가까스로 안정을 시키고 나니 손에 쥐었던 아편이 땀에 푹 젖었겠지요. 내가 웃은 것은 죽기 전 한 번 천지와 인생을 웃어 버린 것인데 그렇게 야단이니…… 하하하하." +R는 식은 차를 한 모금 더 마시며, +"참 목도 마르기도 하더니. 입에는 침 한 방울 없고. 그러나 못물을 먹을 생각도 없고. 나중에는 말을 하려고 해도 혀가 안 돌아가겠지요. +이러는 동안에 달빛이 희미해지길래 웬일인가 하고 고개를 번쩍 들었더니 해가 떠오릅니다그려. 어떻게 붉고 둥글고 씩씩한지. `저 해 보오.' 하고 나는 기계적으로 벌떡 일어나서 구덩이에서 뛰어나왔지요." +하고 빙그레 웃소. R의 빙그레 웃는 양이 참 좋았소. +"내가 뛰어나오는 것을 보고 이이도 뿌시시 일어났지요. 그 해! 그 해의 새 빛을 받는 하늘과 땅의 빛! 나는 그것을 형용할 말을 가지지 못합니다. 다만 힘껏 소리치고 싶고 기운껏 달음박질치고 싶은 생각이 날 뿐이어요. +`우리 삽시다, 죽지 말고 삽시다, 살아서 새 세상을 하나 만들어 봅시다.' 이렇게 말하였지요. 하니까 이이가 처음에는 깜짝 놀라는 것 같아요. 그러나 마침내 아내도 죽을 뜻을 변하였지요. 그래서 남 선생을 청하여다가 그 말씀을 여쭈었더니 남 선생께서 고개를 끄덕끄덕하시고 우리 둘의 혼인 주례를 하셨지요. 그 후 십여 년에 우리는 밭 갈고 아이 기르고 이런 생활을 하고 있는데 언제나 여기 새 민족이 생기고 누가 새 단군이 될는지요. 하하하하, 아하하하. 피곤하시겠습니다. 이야기가 너무 길어서." +하고 R는 말을 끊소. +나는 R부처가 만류하는 것도 다 뿌리치고 여관으로 돌아왔소. R와 함께 달빛 속, 개 짖는 소리 속을 지나서 아라사 사람의 조그마한 여관으로 돌아왔소. 여관 주인도 R를 아는 모양이어서 반갑게 인사하고 또 내게 대한 부탁도 하는 모양인가 보오. +R는 내 방에 올라와서 내일 하루 지날 일도 이야기하고 또 남 선생과 정임에게 관한 이야기도 하였으나, 나는 그가 무슨 이야기를 하는지 잘 들을 만한 마음의 여유도 없어서 마음 없는 대답을 할 뿐이었소. +R가 돌아간 뒤에 나는 옷도 벗지 아니하고 침대에 드러누웠소. 페치카를 때기는 한 모양이나 방이 써늘하기 그지없소. +`그 두 별 무덤이 정말 R와 그 여학생과 두 사람이 영원히 달치 못할 꿈을 안은 채로 깨끗하게 죽어서 묻힌 무덤이었으면 얼마나 좋을까. 만일 그렇다 하면 내일 한 번 더 가서 보토라도 하고 오련마는.' +하고 나는 R부처의 생활에 대하여 일종의 불만과 환멸을 느꼈소. +그리고 내가 정임을 여기나 시베리아나 어떤 곳으로 불러다가 만일 R와 같은 흉내를 낸다 하면, 하고 생각해 보고는 나는 진저리를 쳤소. 나는 내머리 속에 다시 그러한 생각이 한 조각이라도 들어올 것을 두려워하였소. +급행을 기다리자면 또 사흘을 기다리지 아니하면 아니 되기로 나는 이튿날 새벽에 떠나는 구간차를 타고 F역을 떠나 버렸소. R에게는 고맙다는 편지 한 장만을 써 놓고. 나는 R를 더 보기를 원치 아니하였소. 그것은 반드시 R를 죄인으로 보아서 그런 것은 아니오마는 그저 나는 다시 R를 대면하기를 원치 아니한 것이오. +나는 차가 R의 집 앞을 지날 때에도 R의 집에 대하여서는 외면하였소. +이 모양으로 나는 흥안령을 넘고, 하일라르의 솔밭을 지나서 마침내 이 곳에 온 것이오. +형! 나는 인제는 이 편지를 끝내오. 더 쓸 말도 없거니와 인제는 이것을 쓰기도 싫증이 났소. +이 편지를 쓰기 시작할 때에는 바이칼에 물결이 흉용하더니 이 편지를 끝내는 지금에는 가의 가까운 물에는 얼음이 얼었소. 그리고 저 멀리 푸른 물이 늠실늠실 하얗게 눈 덮인 산 빛과 어울리게 되었소. +사흘이나 이어서 오던 눈이 밤새에 개고 오늘 아침에는 칼날 같은 바람이 눈을 날리고 있소. +나는 이 얼음 위로 걸어서 저 푸른 물 있는 곳까지 가고 싶은 유혹을 금할 수 없소. 더구나 이 편지도 다 쓰고 나니, 인제는 내가 이 세상에서 할 마지막 일까지 다 한 것 같소. +내가 이 앞에 어디로 가서 어찌 될는지는 나도 모르지마는 희미한 소원을 말하면 눈 덮인 시베리아의 인적 없는 삼림 지대로 한정 없이 헤매다가 기운 진하는 곳에서 이 목숨을 마치고 싶소. +최석 군은 `끝'이라는 글자를 썼다가 지워 버리고 딴 종이에다가 이런 말을 썼다 +다 쓰고 나니 이런 편지도 다 부질없는 일이오. 내가 이런 말을 한대야 세상이 믿어 줄 리도 없지 않소. 말이란 소용 없는 것이오. 내가 아무리 내 아내에게 말을 했어도 아니 믿었거든 내 아내도 내 말을 아니 믿었거든 하물며 세상이 내 말을 믿을 리가 있소. 믿지 아니할 뿐 아니라 내 말 중에서 자기네 목적에 필요한 부분만은 믿고, 또 자기네 목적에 필요한 부분은 마음대로 고치고 뒤집고 보태고 할 것이니까, 나는 이 편지를 쓴 것이 한 무익하고 어리석은 일인 줄을 깨달았소. +형이야 이 편지를 아니 보기로니 나를 안 믿겠소? 그 중에는 혹 형이 지금까지 모르던 자료도 없지 아니하니, 형만 혼자 보시고 형만 혼자 내 사정을 알아 주시면 다행이겠소. 세상에 한 믿는 친구를 가지는 것이 저마다 하는 일이겠소? +나는 이 쓸데없는 편지를 몇 번이나 불살라 버리려고 하였으나 그래도 거기도 일종의 애착심이 생기고 미련이 생기는구려. 형 한 분이라도 보여 드리고 싶은 마음이 생기는구려. 내가 S형무소에 입감해 있을 적에 형무소 벽에 죄수가 손톱으로 성명을 새긴 것을 보았소. 뒤에 물었더니 그것은 흔히 사형수가 하는 짓이라고. 사형수가 교수대에 끌려 나가기 바로 전에 흔히 손톱으로 담벼락이나 마룻바닥에 제 이름을 새기는 일이 있다고 하는 말을 들었소. 내가 형에게 쓰는 이 편지도 그 심리와 비슷한 것일까요? +형! 나는 보통 사람보다는, 정보다는 지로, 상식보다는 이론으로, 이해보다는 의리로 살아 왔다고 자신하오. 이를테면 논리학적으로 윤리학적으로 살아온 것이라고 할까. 나는 엄격한 교사요, 교장이었소. 내게는 의지력과 이지력밖에 없는 것 같았소. 그러한 생활을 수십 년 해 오지 아니하였소? 나는 이 앞에 몇십 년을 더 살더라도 내 이 성격이나 생활 태도에는 변함이 없으리라고 자신하였소. 불혹지년이 지났으니 그렇게 생각하였을 것이 아니오? +그런데 형! 참 이상한 일이 있소. 그것은 내가 지금까지 처해 있던 환경을벗어나서 호호 탕탕하게 넓은 세계에 알몸을 내어던짐을 당하니 내 마음 속에는 무서운 여러 가지 변화가 일어나는구려. 나는 이 말도 형에게 아니 하려고 생각하였소. 노여워하지 마시오, 내게까지도 숨기느냐고. 그런 것이 아니오, 형은커녕 나 자신에게까지도 숨기려고 하였던 것이오. 혹시 그런 기다리지 아니 하였던 원, 그런 생각이 내 마음의 하늘에 일어나리라고 상상도 아니하였던, 그런 생각이 일어날 때에는 나는 스스로 놀라고 스스로 슬퍼하였소. 그래서 스스로 숨기기로 하였소. +그 숨긴다는 것이 무엇이냐 하면 그것은 열정이요, 정의 불길이요, 정의 광풍이요, 정의 물결이오. 만일 내 의식이 세계를 평화로운 풀 있고, 꽃 있고, 나무 있는 벌판이라고 하면 거기 난데없는 미친 짐승들이 불을 뿜고 소리를 지르고 싸우고, 영각을 하고 날쳐서, 이 동산의 평화의 화초를 다 짓밟아 버리고 마는 그러한 모양과 같소. +형! 그 이상야릇한 짐승들이 여태껏, 사십 년 간을 어느 구석에 숨어 있었소? 그러다가 인제 뛰어나와 각각 제 권리를 주장하오? +지금 내 가슴 속은 끓소. 내 몸은 바짝 여위었소. 그것은 생리학적으로나 심리학적으로나 타는 것이요, 연소하는 것이오. 그래서 다만 내 몸의 지방만이 타는 것이 아니라, 골수까지 타고, 몸이 탈 뿐이 아니라 생명 그 물건이 타고 있는 것이오. 그러면 어찌할까. +지위, 명성, 습관, 시대 사조 등등으로 일생에 눌리고 눌렸던 내 자아의 일부분이 혁명을 일으킨 것이오? 한 번도 자유로 권세를 부려 보지 못한 본능과 감정들이 내 생명이 끝나기 전에 한 번 날뛰어 보려는 것이오. 이것이 선이오? 악이오? +그들은 내가 지금까지 옳다고 여기고 신성하다고 여기던 모든 권위를 모조리 둘러엎으려고 드오. 그러나 형! 나는 도저히 이 혁명을 용인할 수가 없소. 나는 죽기까지 버티기로 결정을 하였소. 내 속에서 두 세력이 싸우다가 싸우다가 승부가 결정이 못 된다면 나는 승부의 결정을 기다리지 아니하고 살기를 그만두려오. +나는 눈 덮인 삼림 속으로 들어가려오. 나는 V라는 대삼림 지대가 어디인 줄도 알고 거기를 가려면 어느 정거장에서 내릴 것도 다 알아 놓았소. +만일 단순히 죽는다 하면 구태여 멀리 찾아갈 필요도 없지마는 그래도 나 혼자로는 내 사상과 감정의 청산을 하고 싶소. 살 수 있는 날까지 세상을 떠난 곳에서 살다가 완전한 해결을 얻는 날 나는 혹은 승리의, 혹은 패배의 종막을 닫칠 것이오. 만일 해결이 안 되면 안 되는 대로 그치면 그만이지요. +나는 이 붓을 놓기 전에 어젯밤에 꾼 꿈 이야기 하나는 하려오. 꿈이 하도 수상해서 마치 내 전도에 대한 신의 계시와도 같기로 하는 말이오. 그 꿈은 이러하였소. +내가 꽁이깨(꼬이까라는 아라사말로 침대라는 말이 조선 동포의 입으로 변한 말이오.) 짐을 지고 삽을 메고 눈이 덮인 삼림 속을 혼자 걸었소. 이 꽁이깨 짐이란 것은 금점꾼들이 그 여행 중에 소용품, 마른 빵, 소금, 내복 등속을 침대 매트리스에 넣어서 지고 다니는 것이오. 이 짐하고 삽 한 개, 도끼 한 개, 그것이 시베리아로 금을 찾아 헤매는 조선 동포들의 행색이오. 내가 이르쿠츠크에서 이러한 동포를 만났던 것이 꿈으로 되어 나온 모양이오. +나는 꿈에는 세상을 다 잊어버린, 아주 깨끗하고 침착한 사람으로 이 꽁이깨 짐을 지고 삽을 메고 밤인지 낮인지 알 수 없으나 땅은 눈빛으로 희고, 하늘은 구름빛으로 회색인 삼림 지대를 허덕허덕 걸었소. 길도 없는 데를, 인적도 없는 데를. +꿈에도 내 몸은 퍽 피곤해서 쉴 자리를 찾는 마음이었소. +나는 마침내 어떤 언덕 밑 한 군데를 골랐소. 그리고 상시에 이야기에서 들은 대로 삽으로 내가 누울 자리만한 눈을 치고, 그리고는 도끼로 곁에 선 나무 몇 개를 찍어 누이고 거기다가 불을 놓고 그 불김에 녹은 땅을 두어 자나 파내고 그 속에 드러누웠소. 훈훈한 것이 아주 편안하였소. +하늘에는 별이 반짝거렸소. F역에서 보던 바와 같이 큰 별 작은 별도 보이고 평시에 보지 못하던 붉은 별, 푸른 별 들도 보였소. 나는 이 이상한 하늘, 이상한 별들이 있는 하늘을 보고 드러누워 있노라니까 문득 어디서 발자국 소리가 들렸소. 퉁퉁퉁퉁 우루루루…… 나는 벌떡 일어나려 하였으나 몸이 천 근이나 되어서 움직일 수가 없었소. 가까스로 고개를 조금 들고 보니 뿔이 길다랗고 눈이 불같이 붉은 사슴의 떼가 무엇에 놀랐는지 껑충껑충 뛰어 지나가오. 이것은 아마 크로포트킨의 <상호 부조론> 속에 말한 시베리아의 사슴의 떼가 꿈이 되어 나온 모양이오. +그러더니 그 사슴의 떼가 다 지나간 뒤에, 그 사슴의 떼가 오던 방향으로서 정임이가 걸어오는 것이 아니라 스르륵 하고 미끄러져 오오. 마치 인형을 밀어 주는 것같이. +"정임아!" +하고 나는 소리를 치고 몸을 일으키려 하였소. +정임의 모양은 나를 잠깐 보고는 미끄러지는 듯이 흘러가 버리오. +나는 정임아, 정임아를 부르고 팔다리를 부둥거렸소. 그러다가 마침내 내 몸이 번쩍 일으켜짐을 깨달았소. 나는 정임의 뒤를 따랐소. +나는 눈 위로 삼림 속으로 정임의 그림자를 따랐소. 보일 듯 안 보일 듯, 잡힐 듯 안 잡힐 듯, 나는 무거운 다리를 끌고 정임을 따랐소. +정임은 이 추운 날이언만 눈과 같이 흰 옷을 입었소. 그 옷은 옛날 로마 여인의 옷과 같이 바람결에 펄렁거렸소. +"오지 마세요. 저를 따라오지 못하십니다." +하고 정임은 눈보라 속에 가리워 버리고 말았소. 암만 불러도 대답이 없고 눈보라가 다 지나간 뒤에도 붉은 별, 푸른 별과 뿔 긴 사슴의 떼뿐이오. 정임은 보이지 아니하였소. 나는 미칠 듯이 정임을 찾고 부르다가 잠을 깨었소. +꿈은 이것뿐이오. 꿈을 깨어서 창 밖을 바라보니 얼음과 눈에 덮인 바이칼호 위에는 새벽의 겨울 달이 비치어 있었소. 저 멀리 검푸르게 보이는 것이 채 얼어붙지 아니한 물이겠지요. 오늘 밤에 바람이 없고 기온이 내리면 그것마저 얼어붙을는지 모르지요. 벌써 살얼음이 잡혔는지도 모르지요. 아아, 그 속은 얼마나 깊을까. 나는 바이칼의 물 속이 관심이 되어서 못 견디겠소. +형! 나는 자백하지 아니할 수 없소. 이 꿈은 내 마음의 어떤 부분을 설명한 것이라고. 그러나 형! 나는 이것을 부정하려오. 굳세게 부정하려오. 나는 이 꿈을 부정하려오. 억지로라도 부정하려오. 나는 결코 내 속에 일어난 혁명을 용인하지 아니하려오. 나는 그것을 혁명으로 인정하지 아니하려오. 아니오! 아니오! 그것은 반란이오! 내 인격의 통일에 대한 반란이오. 단연코 무단적으로 진정하지 아니하면 아니 될 반란이오. 보시오! 나는 굳게 서서 한 걸음도 뒤로 물러서지 아니할 것이오. 만일에 형이 광야에 구르는 내 시체나 해골을 본다든지, 또는 무슨 인연으로 내 무덤을 발견하는 날이 있다고 하면 그 때에 형은 내가 이 모든 반란을 진정한 개선의 군주로 죽은 것을 알아 주시오. +인제 바이칼에 겨울의 석양이 비치었소. 눈을 인 나지막한 산들이 지는 햇빛에 자줏빛을 발하고 있소. 극히 깨끗하고 싸늘한 광경이오. 아디유! +이 편지를 우편에 부치고는 나는 최후의 방랑의 길을 떠나오. 찾을 수도 없고, 편지 받을 수도 없는 곳으로. +부디 평안히 계시오. 일 많이 하시오. 부인께 문안 드리오. 내 가족과 정임의 일 맡기오. 아디유! +이것으로 최석 군의 편지는 끝났다. +나는 이 편지를 받고 울었다. 이것이 일 편의 소설이라 하더라도 슬픈 일이어든, 하물며 내가 가장 믿고 사랑하는 친구의 일임에야. +이 편지를 받고 나는 곧 최석 군의 집을 찾았다. 주인을 잃은 이 집에서는아이들이 마당에서 떠들고 있었다. +"삼청동 아자씨 오셨수. 어머니, 삼청동 아자씨." +하고 최석 군의 작은딸이 나를 보고 뛰어들어갔다. +최석의 부인이 나와 나를 맞았다. +부인은 머리도 빗지 아니하고, 얼굴에는 조금도 화장을 아니하고, 매무시도 흘러내릴 지경으로 정돈되지 못하였다. 일 주일이나 못 만난 동안에 부인의 모양은 더욱 초췌하였다. +"노석헌테서 무슨 기별이나 있습니까." +하고 나는 무슨 말로 말을 시작할지 몰라서 이런 말을 하였다. +"아니오. 왜 그이가 집에 편지하나요?" +하고 부인은 성난 빛을 보이며, +"집을 떠난 지가 근 사십 일이 되건만 엽서 한 장 있나요. 집안 식구가 다 죽기로 눈이나 깜짝할 인가요. 그저 정임이헌테만 미쳐서 죽을지 살지를 모르지요." +하고 울먹울먹한다. +"잘못 아십니다. 부인께서 노석의 마음을 잘못 아십니다. 그런 것이 아닙니다." +하고 나는 확신 있는 듯이 말을 시작하였다. +"노석의 생각을 부인께서 오해하신 줄은 벌써부터 알았지마는 오늘 노석의 편지를 받아보고 더욱 분명히 알았습니다." +하고 나는 부인의 표정의 변화를 엿보았다. +"편지가 왔어요?" +하고 부인은 놀라면서, +"지금 어디 있어요? 일본 있지요?" +하고 질투의 불길을 눈으로 토하였다. +"일본이 아닙니다. 노석은 지금 아라사에 있습니다." +"아라사요?" +하고 부인은 놀라는 빛을 보이더니, +"그럼 정임이를 데리고 아주 아라사로 가케오치를 하였군요." +하고 히스테리컬한 웃음을 보이고는 몸을 한 번 떨었다. +부인은 남편과 정임의 관계를 말할 때마다 이렇게 경련적인 웃음을 웃고 몸을 떠는 것이 버릇이었다. +"아닙니다. 노석은 혼자 가 있습니다. 그렇게 오해를 마세요." +하고 나는 보에 싼 최석의 편지를 내어서 부인의 앞으로 밀어 놓으며, +"이것을 보시면 다 아실 줄 압니다. 어쨌으나 노석은 결코 정임이를 데리고 간 것이 아니요, 도리어 정임이를 멀리 떠나서 간 것입니다. 그러나 그보다도 중대 문제가 있습니다. 노석은 이 편지를 보면 죽을 결심을 한 모양입니다." +하고 부인의 주의를 질투로부터 그 남편에게 대한 동정에 끌어 보려 하였다. +"흥. 왜요? 시체 정사를 하나요? 좋겠습니다. 머리가 허연 것이 딸자식 같은 계집애허구 정사를 한다면 그 꼴 좋겠습니다. 죽으라지요. 죽으래요. 죽는 것이 낫지요. 그리구 살아서 무엇 해요?" +내 뜻은 틀려 버렸다. 부인의 표정과 말에서는 더욱더욱 독한 질투의 안개와 싸늘한 얼음가루가 날았다. +나는 부인의 이 태도에 반감을 느꼈다. 아무리 질투의 감정이 강하다 하기로, 사람의 생명이 제 남편의 생명이 위태함에도 불구하고 오직 제 질투의 감정에만 충실하려 하는 그 태도가 불쾌하였다. 그래서 나는, +"나는 그만큼 말씀해 드렸으니 더 할 말씀은 없습니다. 아무려나 좀더 냉정하게 생각해 보세요. 그리고 이것을 읽어 보세요." +하고 일어나서 집으로 돌아와 버리고 말았다. +도무지 불쾌하기 그지없는 날이다. 최석의 태도까지도 불쾌하다. 달아나긴 왜 달아나? 죽기는 왜 죽어? 못난 것! 기운 없는 것! 하고 나는 최석이가 곁에 섰기나 한 것처럼 눈을 흘기고 중얼거렸다. +최석의 말대로 최석의 부인은 악한 사람이 아니요, 그저 보통인 여성일는지 모른다. 그렇다 하면 여자의 마음이란 너무도 질투의 종이 아닐까. 설사 남편 되는 최석의 사랑이 아내로부터 정임에게로 옮아 갔다고 하더라도 그것을 질투로 회복하려는 것은 어리석은 일이다. 이미 사랑이 떠난 남편을 네 마음대로 가거라 하고 자발적으로 내어버릴 것이지마는 그것을 못 할 사정이 있다고 하면 모르는 체하고 내버려 둘 것이 아닌가. 그래도 이것은 우리네 남자의 이론이요, 여자로는 이런 경우에 질투라는 반응밖에 없도록 생긴 것일까 나는 이런 생각을 하고 있었다. +시계가 아홉시를 친다. +남대문 밖 정거장을 떠나는 열차의 기적 소리가 들린다. +나는 만주를 생각하고, 시베리아를 생각하고 최석을 생각하였다. 마음으로는 정임을 사랑하면서 그 사랑을 발표할 수 없어서 시베리아의 눈 덮인 삼림 속으로 방황하는 최석의 모양이 최석의 꿈 이야기에 있는 대로 눈앞에 선하게 떠나온다. +`사랑은 목숨을 빼앗는다.' +하고 나는 사랑일래 일어나는 인생의 비극을 생각하였다. 그러나 최석의 경우는 보통 있는 공식과는 달라서 사랑을 죽이기 위해서 제 목숨을 죽이는 것이었다. 그렇다 하더라도, +`사랑은 목숨을 빼앗는다.' +는 데에는 다름이 없다. +나는 불쾌도 하고 몸도 으스스하여 얼른 자리에 누웠다. 며느리가 들어온 뒤부터 사랑 생활을 하는 지가 벌써 오 년이나 되었다. 우리 부처란 인제는 한 역사적 존재요, 윤리적 관계에 불과하였다. 오래 사귄 친구와 같은 익숙함이 있고, 집에 없지 못할 사람이라는 필요감도 있지마는 젊은 부처가 가지는 듯한 그런 정은 벌써 없는 지 오래였다. 아내도 나를 대하면 본체만체, 나도 아내를 대하면 본체만체, 무슨 필요가 있어서 말을 붙이더라도 아무쪼록 듣기 싫기를 원하는 듯이 톡톡 내던졌다. 아내도 근래에 와서는 옷도 아무렇게나, 머리도 아무렇게나, 어디 출입할 때밖에는 도무지 화장을 아니 하였다. +그러나 그렇다고 우리 부처의 새가 좋지 못한 것도 아니었다. 서로 소중히 여기는 마음도 있었다. 아내가 안에 있다고 생각하면 마음이 든든하고 또 아내의 말에 의하건대 내가 사랑에 있거니 하면 마음이 든든하다고 한다. +우리 부처의 관계는 이러한 관계다. +나는 한 방에서 혼자 잠을 자는 것이 습관이 되어서 누가 곁에 있으면 잠이 잘 들지 아니하였다. 혹시 어린것들이 매를 얻어맞고 사랑으로 피난을 와서 울다가 내 자리에서 잠이 들면 귀엽기는 귀여워도 잠자리는 편안치 아니하였다. 나는 책을 보고 글을 쓰고 공상을 하고 있으면 족하였다. 내게는 아무 애욕적 요구도 없었다. 이것은 내 정력이 쇠모한 까닭인지 모른다. +그러나 최석의 편지를 본 그 날 밤에는 도무지 잠이 잘 들지 아니하였다. 최석의 편지가 최석의 고민이 내 졸던 의식에 무슨 자극을 준 듯하였다. 적막한 듯하였다. 허전한 듯하였다. 무엇인지 모르나 그리운 것이 있는 것 같았다. +"어, 이거 안되었군." +하고 나는 벌떡 일어나 담배를 피워 물었다. +"나으리 주무셔 곕시오?" +하고 아범이 전보를 가지고 왔다. +"명조 경성 착 남정임" +이라는 것이었다. +"정임이가 와?" +하고 나는 전보를 다시 읽었다. +최석의 그 편지를 보면 최석 부인에게는 어떤 반응이 일어나고 정임에게는 어떤 반응이 일어날까, 하고 생각하면 자못 마음이 편하지 못하였다. +이튿날 아침에 나는 부산서 오는 차를 맞으려고 정거장에를 나갔다. +차는 제 시간에 들어왔다. 남정임은 슈트케이스 하나를 들고 차에서 내렸다. 검은 외투에 검은 모자를 쓴 그의 얼굴은 더욱 해쓱해 보였다. +"선생님!" +하고 정임은 나를 보고 손에 들었던 짐을 땅바닥에 내려놓고, 내 앞으로 왔다. +"풍랑이나 없었나?" +하고 나는 내 손에 잡힌 정임의 손이 싸늘한 것을 근심하였다. +"네. 아주 잔잔했습니다. 저같이 약한 사람도 밖에 나와서 바다 경치를 구경하였습니다." +하고 정임은 사교적인 웃음을 웃었다. 그러나 그의 눈에는 눈물이 있는 것 같았다. +"최 선생님 어디 계신지 아세요?" +하고 정임은 나를 따라 서면서 물었다. +"나도 지금까지 몰랐는데 어제 편지를 하나 받았지." +하는 것이 내 대답이었다. +"네? 편지 받으셨어요? 어디 계십니까?" +하고 정임은 걸음을 멈추었다. +"나도 몰라." +하고 나도 정임과 같이 걸음을 멈추고, +"그 편지를 쓴 곳도 알고 부친 곳도 알지마는 지금 어디로 갔는지 그것은 모르지. 찾을 생각도 말고 편지할 생각도 말라고 했으니까." +하고 사실대로 대답하였다. +"어디야요? 그 편지 부치신 곳이 어디야요? 저 이 차로 따라갈 테야요." +하고 정임은 조급하였다. +"갈 때에는 가더라도 이 차에야 갈 수가 있나." +하고 나는 겨우 정임을 끌고 들어왔다. +정임을 집으로 데리고 와서 대강 말을 하고, 이튿날 새벽 차로 떠난다는 것을, +"가만 있어. 어떻게 계획을 세워 가지고 해야지." +하여 가까스로 붙들어 놓았다. +아침을 먹고 나서 최석 집에를 가 보려고 할 즈음에 순임이가 와서 마루 끝에 선 채로, +"선생님, 어머니가 잠깐만 오십시사구요." +하였다. +"정임이가 왔다." +하고 내가 그러니까, +"정임이가요?" +하고 순임은 깜짝 놀라면서, +"정임이는 아버지 계신 데를 알아요?" +하고 물었다. +"정임이도 모른단다. 너 아버지는 시베리아에 계시고 정임이는 동경 있다가 왔는데 알 리가 있니?" +하고 나는 순임의 생각을 깨뜨리려 하였다. 순임은, +"정임이가 어디 있어요?" +하고 방들 있는 곳을 둘러보며, +"언제 왔어요?" +하고는 그제야 정임에게 대한 반가운 정이 발하는 듯이, +"정임아!" +하고 불러 본다. +"언니요? 여기 있수." +하고 정임이가 머릿방 문을 열고 옷을 갈아입던 채로 고개를 내어민다. +순임은 구두를 차내버리듯이 벗어 놓고 정임의 방으로 뛰어들어간다. +나는 최석의 집에를 가느라고 외투를 입고 모자를 쓰고 정임의 방문을 열어 보았다. 두 처녀는 울고 있었다. +"정임이도 가지. 아주머니 뵈러 안 가?" +하고 나는 정임을 재촉하였다. +"선생님 먼저 가 계셔요." +하고 순임이가 눈물을 씻고 일어나면서, +"이따가 제가 정임이허구 갑니다." +하고 내게 눈을 끔쩍거려 보였다. 갑자기 정임이가 가면 어머니와 정임이와 사이에 어떠한 파란이 일어나지나 아니할까 하고 순임이가 염려하는 것이었다. 순임도 인제는 노성하여졌다고 나는 생각하였다. +"선생님 이 편지가 다 참말일까요?" +하고 나를 보는 길로 최석 부인이 물었다. 최석 부인은 히스테리를 일으킨 사람 모양으로 머리와 손을 떨었다. +나는 참말이냐 하는 것이 무엇을 가리키는 말인지 분명하지 아니하여서, +"노석이 거짓말할 사람입니까?" +하고 대체론으로 대답하였다. +"앉으십쇼. 앉으시란 말씀도 안 하고." +하고 부인은 침착한 모양을 보이려고 빙그레 웃었으나, 그것은 실패였다. +"그게 참말일까요? 정임이가 아기를 뗀 것이 아니라, 폐가 나빠서 피를 토하고 입원하였다는 것이?" +하고 부인은 중대하다는 표정을 가지고 묻는다. +"그럼 그것이 참말이 아니구요. 아직도 그런 의심을 가지고 계십니까. 정임이와 한 방에 있는 학생이 모함한 것이라고 안 그랬어요? 그게 말이 됩니까." +하고 언성을 높여서 대답하였다. +"그럼 왜 정임이가 호텔에서 왜 아버지한테 한 번 안아 달라고 그래요? 그 편지에 쓴 대로 한 번 안아만 보았을까요?" +이것은 부인의 둘째 물음이었다. +"나는 그뿐이라고 믿습니다. 그것이 도리어 깨끗하다는 표라고 믿습니다. 안 그렇습니까?" +하고 나는 딱하다는 표정을 하였다. +"글쎄요." +하고 부인은 한참이나 생각하고 있다가, +"정말 애 아버지가 혼자 달아났을까요? 정임이를 데리고 가케오치한 것이 아닐까요? 꼭 그랬을 것만 같은데." +하고 부인은 괴로운 표정을 감추려는 듯이 고개를 숙인다. +나는 남편에게 대한 아내의 의심이 어떻게 깊은가에 아니 놀랄 수가 없어서, +"허." +하고 한 마디 웃고, +"그렇게 수십 년 동안 부부 생활을 하시고도 그렇게 노석의 인격을 몰라 주십니까. 나는 부인께서 하시는 말씀이 부러 하시는 농담으로밖에 아니 들립니다. 정임이가 지금 서울 있습니다." +하고 또 한 번 웃었다. 정말 기막힌 웃음이었다. +"정임이가 서울 있어요?" +하고 부인은 펄쩍 뛰면서, +"어디 있다가 언제 왔습니까? 그게 정말입니까?" +하고 의아한 빛을 보인다. 꼭 최석이하고 함께 달아났을 정임이가 서울에 있을 리가 없는 것이었다. +"동경서 오늘 아침에 왔습니다. 지금 우리 집에서 순임이허구 이야기를 하고 있으니까 조금 있으면 뵈오러 올 것입니다." +하고 나는 정임이가 분명히 서울 있는 것을 일일이 증거를 들어서 증명하였다. 그리고 우스운 것을 속으로 참았다. 그러나 다음 순간에는 이 병들고 늙은 아내의 질투와 의심으로 괴로워서 덜덜덜덜 떨고 앉았는 것을 가엾게 생각하였다. +정임이가 지금 서울에 있는 것이 더 의심할 여지가 없는 사실임이 판명되매, 부인은 도리어 낙망하는 듯하였다. 그가 제 마음대로 그려 놓고 믿고 하던 모든 철학의 계통이 무너진 것이었다. +한참이나 흩어진 정신을 못 수습하는 듯이 앉아 있더니 아주 기운 없는 어조로, +"선생님 애 아버지가 정말 죽을까요? 정말 영영 집에를 안 돌아올까요?" +하고 묻는다. 그 눈에는 벌써 눈물이 어리었다. +"글쎄요. 내 생각 같아서는 다시는 집에 돌아오지 아니할 것 같습니다. 또 그만치 망신을 했으니, 이제 무슨 낯으로 돌아옵니까. 내라도 다시 집에 돌아올 생각은 아니 내겠습니다." +하고 나는 의식적으로 악의를 가지고 부인의 가슴에 칼을 하나 박았다. +그 칼은 분명히 부인의 가슴에 아프게 박힌 모양이었다. +"선생님. 어떡하면 좋습니까. 애 아버지가 죽지 않게 해 주세요. 그렇지 않아도 순임이년이 제가 걔 아버지를 달아나게나 한 것처럼 원망을 하는데요. 그러다가 정녕 죽으면 어떻게 합니까. 제일 딴 자식들의 원망을 들을까봐 겁이 납니다. 선생님, 어떻게 애 아버지를 붙들어다 주세요." +하고 마침내 참을 수 없이 울었다. 말은 비록 자식들의 원망이 두렵다고 하지마는 질투의 감정이 스러질 때에 그에게는 남편에게 대한 아내의 애정이 막혔던 물과 같이 터져 나온 것이라고 나는 해석하였다. +"글쎄, 어디 있는 줄 알고 찾습니까. 노석의 성미에 한번 아니 한다고 했으면 다시 편지할 리는 만무하다고 믿습니다." +하여 나는 부인의 가슴에 둘째 칼날을 박았다. +나는 비록 최석의 부인이 청하지 아니하더라도 최석을 찾으러 떠나지 아니하면 아니 될 의무를 진다. 산 최석을 못 찾더라도 최석의 시체라도, 무덤이라도, 죽은 자리라도, 마지막 있던 곳이라도 찾아보지 아니하면 아니 될 의무를 깨닫는다. +그러나 시국이 변하여 그 때에는 아라사에 가는 것은 여간 곤란한 일이 아니었다. 그 때에는 북만의 풍운이 급박하여 만주리를 통과하기는 사실상 불가능에 가까웠다. 마점산(馬占山) 일파의 군대가 흥안령, 하일라르 등지에 웅거하여 언제 대충돌이 폭발될는지 모르던 때였다. 이 때문에 시베리아에 들어가기는 거의 절망 상태라고 하겠고, 또 관헌도 아라사에 들어가는 여행권을 잘 교부할 것 같지 아니하였다. +부인은 울고, 나는 이런 생각 저런 생각 하고 있는 동안에 문 밖에는 순임이, 정임이가 들어오는 소리가 들렸다. +"아이, 정임이냐." +하고 부인은 반갑게 허리 굽혀 인사하는 정임의 어깨에 손을 대고, +"자 앉아라. 그래 인제 병이 좀 나으냐…… 수척했구나. 더 노성해지구 반 년도 못 되었는데." +하고 정임에게 대하여 애정을 표하는 것을 보고 나는 의외지마는 다행으로 생각하였다. 나는 정임이가 오면 보기 싫은 한 신을 연출하지 않나 하고 근심하였던 것이다. +"희 잘 자라요?" +하고 정임은 한참이나 있다가 비로소 입을 열었다. +"응, 잘 있단다. 컸나 가 보아라." +하고 부인은 더욱 반가운 표정을 보인다. +"어느 방이야?" +하고 정임은 선물 보퉁이를 들고 순임과 함께 나가 버린다. 여자인 정임은 희와 순임과 부인과 또 순임의 다른 동생에게 선물 사 오는 것을 잊어버리지 아니하였다. +정임과 순임은 한 이삼 분 있다가 돌아왔다. 밖에서 희가 무엇이라고 지절대는 소리가 들린다. 아마 정임이가 사다 준 선물을 받고 좋아하는 모양이다. +정임은 들고 온 보퉁이에서 여자용 배스로브 하나를 내어서 부인에게주며, +"맞으실까?" +하였다. +"아이 그건 무어라고 사 왔니?" +하고 부인은 좋아라고 입어 보고, 이리 보고 저리 보고 하면서, +"난 이런 거 처음 입어 본다." +하고 자꾸 끈을 동여맨다. +"정임이가 난 파자마를 사다 주었어." +하고 순임은 따로 쌌던 굵은 줄 있는 융 파자마를 내어서 경매장 사람 모양으로 흔들어 보이며, +"어머니 그 배스로브 나 주우. 어머닌 늙은이가 그건 입어서 무엇 하우?" +하고 부인이 입은 배스로브를 벗겨서 제가 입고 두 호주머니에 손을 넣고 어기죽어기죽하고 서양 부인네 흉내를 낸다. +"저런 말괄량이가 너도 정임이처럼 좀 얌전해 보아라." +하고 부인은 순임을 향하여 눈을 흘긴다. +이 모양으로 부인과 정임과의 대면은 가장 원만하게 되었다. +그러나 부인은 정임에게 최석의 편지를 보이기를 원치 아니하였다. 편지가 왔다는 말조차 입 밖에 내지 아니하였다. 그러나 순임이가 정임에게 대하여 표하는 애정은 여간 깊지 아니하였다. 그 둘은 하루 종일 같이 있었다. 정임은 그 날 저녁에 나를 보고, +"순임이헌테 최 선생님 편지 사연은 다 들었어요. 순임이가 그 편지를 훔쳐다가 얼른얼른 몇 군데 읽어도 보았습니다. 순임이가 저를 퍽 동정하면서 절더러 최 선생을 따라가 보라고 그래요. 혼자 가기가 어려우면 자기허구 같이 가자고. 가서 최 선생을 데리고 오자고. 어머니가 못 가게 하거든 몰래 둘이 도망해 가자고. 그래서 그러자고 그랬습니다. 안됐지요. 선생님?" +하고 저희끼리 작정은 다 해 놓고는 슬쩍 내 의향을 물었다. +"젊은 여자 단둘이서 먼 여행을 어떻게 한단 말이냐? 게다가 지금 북만주 형세가 대단히 위급한 모양인데. 또 정임이는 그 건강 가지고 어디를 가, 이 추운 겨울에?" +하고 나는 이런 말이 다 쓸데없는 말인 줄 알면서도 어른으로서 한 마디 안 할 수 없어서 하였다. 정임은 더 제 뜻을 주장하지도 아니하였다. +그 날 저녁에 정임은 순임의 집에서 잤는지 집에 오지를 아니하였다. +나는 이 일을 어찌하면 좋은가, 이 두 여자의 행동을 어찌하면 좋은가 하고 혼자 끙끙 생각하고 있었다. +이튿날 나는 궁금해서 최석의 집에를 갔더니 부인이, +"우리 순임이 댁에 갔어요?" +하고 의외의 질문을 하였다. +"아니오." +하고 나는 놀랐다. +"그럼, 이것들이 어딜 갔어요? 난 정임이허구 댁에서 잔 줄만 알았는데." +하고 부인은 무슨 불길한 것이나 본 듯이 몸을 떤다. 히스테리가 일어난 것이었다. +나는 입맛을 다시었다. 분명히 이 두 여자가 시베리아를 향하고 떠났구나 하였다. +그 날은 소식이 없이 지났다. 그 이튿날도 소식이 없이 지났다. +최석 부인은 딸까지 잃어버리고 미친 듯이 울고 애통하다가 머리를 싸매고 누워 버리고 말았다. +정임이와 순임이가 없어진 지 사흘 만에 아침 우편에 편지 한 장을 받았다. 그 봉투는 봉천 야마도 호텔 것이었다. 그 속에는 편지 두 장이 들어 있었다. 한 장은 , +선생님! 저는 아버지를 위하여, 정임을 위하여 정임과 같이 집을 떠났습니다. +어머님께서 슬퍼하실 줄은 알지마는 저희들이 다행히 아버지를 찾아서 모시고 오면 어머니께서도 기뻐하실 것을 믿습니다. 저희들이 가지 아니하고는 아버지는 살아서 돌아오실 것 같지 아니합니다. 아버지를 이처럼 불행하시게 한 죄는 절반은 어머니께 있고, 절반은 제게 있습니다. 저는 아버지 일을 생각하면 가슴이 미어지고 이가 갈립니다. 저는 아무리 해서라도 아버지를 찾아내어야겠습니다. +저는 정임을 무한히 동정합니다. 저는 어려서 정임을 미워하고 아버지를 미워하였지마는 지금은 아버지의 마음과 정임의 마음을 알아볼 만치 자랐습니다. +선생님! 저희들은 둘이 손을 잡고 어디를 가서든지 아버지를 찾아내겠습니다. 하나님의 사자가 낮에는 구름이 되고 밤에는 별이 되어서 반드시 저희들의 앞길을 인도할 줄 믿습니다. +선생님, 저희 어린것들의 뜻을 불쌍히 여기셔서 돈 천 원만 전보로 보내 주시기를 바랍니다. +만일 만주리로 가는 길이 끊어지면 몽고로 자동차로라도 가려고 합니다. 아버지 편지에 적힌 F역의 R씨를 찾고, 그리고 바이칼 호반의 바이칼리스코에를 찾아, 이 모양으로 찾으면 반드시 아버지를 찾아 내고야 말 것을 믿습니다. +선생님, 돈 천 원만 봉천 야마도 호텔 최순임 이름으로 부쳐 주세요. 그리고 어머니헌테는 아직 말씀 말아 주세요. +선생님. 이렇게 걱정하시게 해서 미안합니다. 용서하세요. +순임 상서 +이렇게 써 있다. 또 한 장에는, +선생님! 저는 마침내 돌아오지 못할 길을 떠나나이다. 어디든지 최 선생님을 뵈옵는 곳에서 이 몸을 묻어 버리려 하나이다. 지금 또 몸에 열이 나는 모양이요, 혈담도 보이오나 최 선생을 뵈올 때까지는 아무리 하여서라도 이 목숨을 부지하려 하오며, 최 선생을 뵈옵고 제가 진 은혜를 감사하는 한 말씀만 사뢰면 고대 죽사와도 여한이 없을까 하나이다. +순임 언니가 제게 주시는 사랑과 동정은 오직 눈물과 감격밖에 더 표할 말씀이 없나이다. 순임 언니가 저를 보호하여 주니 마음이 든든하여이다……. +이라고 하였다. +편지를 보아야 별로 놀랄 것은 없었다. 다만 말괄량이로만 알았던 순임의 속에 어느새에 그러한 감정이 발달하였나 하는 것을 놀랄 뿐이었다. +그러나 걱정은 이것이다. 순임이나 정임이나 다 내가 감독해야 할 처지에 있거늘 그들이 만리 긴 여행을 떠난다고 하니 감독자인 내 태도를 어떻게 할까 하는 것이다. +나는 편지를 받는 길로 우선 돈 천 원을 은행에 가서 찾아다 놓았다. +암만해도 내가 서울에 가만히 앉아서 두 아이에게 돈만 부쳐 주는 것이 인정에 어그러지는 것 같아서 나는 여러 가지로 주선을 하여서 여행의 양해를 얻어 가지고 봉천을 향하여 떠났다. +내가 봉천에 도착한 것은 밤 열시가 지나서였다. 순임과 정임은 자리옷 바람으로 내 방으로 달려와서 반가워하였다. 그들이 반가워하는 양은 실로 눈물이 흐를 만하였다. +"아이구 선생님!" +"아이구 어쩌면!" +하는 것이 그들의 내게 대한 인사의 전부였다. +"정임이 어떠오?" +하고 나는 순임의 편지에 정임이가 열이 있단 말을 생각하였다. +"무어요. 괜찮습니다." +하고 정임은 웃었다. +전등빛에 보이는 정임의 얼굴은 그야말로 대리석으로 깎은 듯하였다. 여위고 핏기가 없는 것이 더욱 정임의 용모에 엄숙한 맛을 주었다. +"돈 가져오셨어요?" +하고 순임이가 어리광 절반으로 묻다가 내가 웃고 대답이 없음을 보고, +"우리를 붙들러 오셨어요?" +하고 성내는 양을 보인다. +"그래 둘이서들 간다니 어떻게 간단 말인가. 시베리아가 어떤 곳에 붙었는지 알지도 못하면서." +하고 나는 두 사람이 그리 슬퍼하지 아니하는 순간을 보는 것이 다행하여서 농담삼아 물었다. +"왜 몰라요? 시베리아가 저기 아니야요?" +하고 순임이가 산해관 쪽을 가리키며, +"우리도 지리에서 배워서 다 알아요. 어저께 하루 종일 지도를 사다 놓고 연구를 하였답니다. 봉천서 신경, 신경서 하얼빈, 하얼빈에서 만주리, 만주리에서 이르쿠츠크, 보세요, 잘 알지 않습니까. 또 만일 중동 철도가 불통이면 어떻게 가는고 하니 여기서 산해관을 가고, 산해관서 북경을 가지요. 그리고는 북경서 장가구를 가지 않습니까. 장가구서 자동차를 타고 몽고를 통과해서 가거든요. 잘 알지 않습니까." +하고 정임의 허리를 안으며, +"그렇지이?" +하고 자신 있는 듯이 웃는다. +"또 몽고로도 못 가게 되어서 구라파를 돌게 되면?" +하고 나는 교사가 생도에게 묻는 모양으로 물었다. +"네, 저 인도양으로 해서 지중해로 해서 프랑스로 해서 그렇게 가지요." +"허, 잘 아는구나." +하고 나는 웃었다. +"그렇게만 알아요? 또 해삼위로 해서 가는 길도 알아요. 저희를 어린애로 아시네." +"잘못했소." +"하하." +"후후." +사실 그들은 벌써 어린애들은 아니었다. 순임도 벌써 그 아버지의 말할 수 없는 사정에 동정할 나이가 되었다. 순임이가 기어다닌 것은 본 나로는 이것도 이상하게 보였다. 나는 벌써 나이 많았구나 하는 생각이 나지 아니할 수 없었다. +나는 잠 안 드는 하룻밤을 지내면서 옆방에서 정임이가 기침을 짓는 소리를 들었다. 그 소리는 내 가슴을 아프게 하였다. +이튿날 나는 두 사람에게 돈 천 원을 주어서 신경 가는 급행차를 태워 주었다. 대륙의 이 건조하고 추운 기후에 정임의 병든 폐가 견디어 날까 하고 마음이 놓이지 아니하였다. 그러나 나는 그들을 가라고 권할 수는 있어도 가지 말라고 붙들 수는 없었다. 다만 제 아버지, 제 애인을 죽기 전에 만날 수 있기만 빌 뿐이었다. +나는 두 아이를 북쪽으로 떠나 보내고 혼자 여관에 들어와서 도무지 정신을 진정하지 못하여 술을 먹고 잊으려 하였다. 그러다가 그 날 밤차로 서울로 돌아왔다. +이튿날 아침에 나는 최석 부인을 찾아서 순임과 정임이가 시베리아로 갔단 말을 전하였다. +그 때에 최 부인은 거의 아무 정신이 없는 듯하였다. 아무 말도 하지 아니하고 울고만 있었다. +얼마 있다가 부인은, +"그것들이 저희들끼리 가서 괜찮을까요?" +하는 한 마디를 할 뿐이었다. +며칠 후에 순임에게서 편지가 왔다. 그것은 하얼빈에서 부친 것이었다. +하얼빈을 오늘 떠납니다. 하얼빈에 와서 아버지 친구 되시는 R소장을 만나뵈옵고 아버지 일을 물어 보았습니다. 그리고 저희 둘이서 찾아 떠났다는 말씀을 하였더니 R소장이 대단히 동정하여서 여행권도 준비해 주시기로 저희는 아버지를 찾아서 오늘 오후 모스크바 가는 급행으로 떠납니다. 가다가 F역에 내리기는 어려울 듯합니다. 정임의 건강이 대단히 좋지 못합니다. 일기가 갑자기 추워지는 관계인지 정임의 신열이 오후면 삼십팔 도를 넘고 기침도 대단합니다. 저는 염려가 되어서 정임더러 하얼빈에서 입원하여 조리를 하라고 권하였지마는 도무지 듣지를 아니합니다. 어디까지든지 가는 대로 가다가 더 못 가게 되면 그 곳에서 죽는다고 합니다. +저는 그 동안 며칠 정임과 같이 있는 중에 정임이가 어떻게 아름답고 높고 굳세게 깨끗한 여자인 것을 발견하였습니다. 저는 지금까지 정임을 몰라본 것을 부끄럽게 생각합니다. 그리고 또 제 아버지께서 어떻게 갸륵한 어른이신 것을 인제야 깨달았습니다. 자식 된 저까지도 아버지와 정임과의 관계를 의심하였습니다. 의심하는 것보다는 세상에서 말하는 대로 믿고 있었습니다. 그러나 정임을 만나 보고 정임의 말을 듣고 아버지께서 선생님께 드린 편지가 모두 참인 것을 깨달았습니다. 아버지께서는 친구의 의지 없는 딸인 정임을 당신의 친혈육인 저와 꼭 같이 사랑하려고 하신 것이었습니다. 그것이 얼마나 갸륵한 일입니까. 그런데 제 어머니와 저는 그 갸륵하신 정신을 몰라보고 오해하였습니다. 어머니는 질투하시고 저는 시기하였습니다. 이것이 얼마나 아버지를 그렇게 갸륵하신 아버지를 몰라뵈온 것입니다. 이것이 얼마나 부끄럽고 원통한 일입니까. +선생님께서도 여러 번 아버지의 인격이 높다는 것을 저희 모녀에게 설명해 주셨습니다마는 마음이 막힌 저는 선생님의 말씀도 믿지 아니하였습니다. +선생님, 정임은 참으로 아버지를 사랑합니다. 정임에게는 이 세상에 아버지밖에는 사랑하는 아무것도 없이, 그렇게 외●으로, 그렇게 열렬하게 아버지를 사모하고 사랑합니다. 저는 잘 압니다. 정임이가 처음에는 아버지로 사랑하였던 것을, 그러나 어느 새에 정임의 아버지에게 대한 사랑이 무엇인지 모를 사랑으로 변한 것을, 그것이 연애냐 하고 물으면 정임은 아니라고 할 것입니다. 정임의 그 대답은 결코 거짓이 아닙니다. 정임은 숙성하지마는 아직도 극히 순결합니다. 정임은 부모를 잃은 후에 아버지밖에 사랑한 사람이 없습니다. 또 아버지에게밖에 사랑받던 일도 없습니다. 그러니깐 정임은 아버지를 그저 사랑합니다 전적으로 사랑합니다. 선생님, 정임의 사랑에는 아버지에 대한 자식의 사랑, 오라비에 대한 누이의 사랑, 사내 친구에 대한 여자 친구의 사랑, 애인에 대한 애인의 사랑, 이 밖에 존경하고 숭배하는 선생에 대한 제자의 사랑까지, 사랑의 모든 종류가 포함되어 있는 것을 저는 발견하였습니다. +선생님, 정임의 정상은 차마 볼 수가 없습니다. 아버지의 안부를 근심하는 양은 제 몇십 배나 되는지 모르게 간절합니다. 정임은 저 때문에 아버지가 불행하게 되셨다고 해서 차마 볼 수 없게 애통하고 있습니다. 진정을 말씀하오면 저는 지금 아버지보다도 어머니보다도 정임에게 가장 동정이 끌립니다. 선생님, 저는 아버지를 찾아가는 것이 아니라 정임을 돕기 위하여 간호하기 위하여 가는 것 같습니다. +선생님, 저는 아직 사랑이란 것이 무엇인지를 모릅니다. 그러나 정임을 보고 사랑이란 것이 어떻게 신비하고 열렬하고 놀라운 것인가를 안 것 같습니다. +순임의 편지는 계속된다. +선생님, 하얼빈에 오는 길에 송화강 굽이를 볼 때에는 정임이가 어떻게나 울었는지, 그것은 차마 볼 수가 없었습니다. 아버지께서 송화강을 보시고 감상이 깊으셨더란 것을 생각한 것입니다. 무인지경으로, 허옇게 눈이 덮인 벌판으로 흘러가는 송화강 굽이, 그것은 슬픈 풍경입니다. 아버지께서 여기를 지나실 때에는 마른 풀만 있는 광야였을 것이니 그 때에는 더욱 황량하였을 것이라고 정임은 말하고 웁니다. +정임은 제가 아버지를 아는 것보다 아버지를 잘 아는 것 같습니다. 평소에 아버지와는 그리 접촉이 없건마는 정임은 아버지의 의지력, 아버지의 숨은 열정, 아버지의 성미까지 잘 압니다. 저는 정임의 말을 듣고야 비로소 참 그래, 하는 감탄을 발한 일이 여러 번 있습니다. +정임의 말을 듣고야 비로소 아버지가 남보다 뛰어나신 인물인 것을 깨달았습니다. 아버지는 정의감이 굳세고 겉으로는 싸늘하도록 이지적이지마는 속에는 불 같은 열정이 있으시고, 아버지는 쇠 같은 의지력과 칼날 같은 판단력이 있어서 언제나 주저하심이 없고 또 흔들리심이 없다는 것, 아버지께서는 모든 것을 용서하고 모든 것을 호의로 해석하여서 누구를 미워하거나 원망하심이 없는 등, 정임은 아버지의 마음의 목록과 설명서를 따로 외우는 것처럼 아버지의 성격을 설명합니다. 듣고 보아서 비로소 아버지의 딸인 저는 내 아버지가 어떤 아버지인가를 알았습니다. +선생님, 이해가 사랑을 낳는단 말씀이 있지마는 저는 정임을 보아서 사랑이 이해를 낳는 것이 아닌가 합니다. +어쩌면 어머니와 저는 평생을 아버지를 모시고 있으면서도 아버지를 몰랐습니까. 이성이 무디고 양심이 흐려서 그랬습니까. 정임은 진실로 존경할 여자입니다. 제가 남자라 하더라도 정임을 아니 사랑하고는 못 견디겠습니다. +아버지는 분명 정임을 사랑하신 것입니다. 처음에는 친구의 딸로, 다음에는 친딸과 같이, 또 다음에는 무엇인지 모르게 뜨거운 사랑이 생겼으리라고 믿습니다. 그것을 아버지는 죽인 것입니다. 그것을 죽이려고 이 달할 수 없는 사랑을 죽이려고 시베리아로 달아나신 것입니다. 인제야 아버지께서 선생님께 하신 편지의 뜻이 알아진 것 같습니다. 백설이 덮인 시베리아의 삼림 속으로 혼자 헤매며 정임에게로 향하는 사랑을 죽이려고 무진 애를 쓰시는 그 심정이 알아지는 것 같습니다. +선생님 이것이 얼마나 비참한 일입니까. 저는 정임의 짐에 지니고 온 일기를 보다가 이러한 구절을 발견하였습니다. +선생님. 저는 세인트 오거스틴의 <참회록>을 절반이나 다 보고 나도 잠이 들지 아니합니다. 잠이 들기 전에 제가 항상 즐겨하는 아베마리아의 노래를 유성기로 듣고 나서 오늘 일기를 쓰려고 하니 슬픈 소리만 나옵니다. +사랑하는 어른이여. 저는 멀리서 당신을 존경하고 신뢰하는 마음에서만 살아야 할 것을 잘 압니다. 여기에서 영원한 정지를 하지 아니하면 아니 됩니다. 비록 제 생명이 괴로움으로 끊어지고 제 혼이 피어 보지 못하고 스러져 버리더라도 저는 이 멀리서 바라보는 존경과 신뢰의 심경에서 한 발자국이라도 옮기지 않아야 할 것을 잘 압니다. 나를 위하여 놓여진 생의 궤도는 나의 생명을 부인하는 억지의 길입니다. 제가 몇 년 전 기숙사 베드에서 이런 밤에 내다보면 즐겁고 아름답던 내 생의 꿈은 다 깨어졌습니다. +제 영혼의 한 조각이 먼 세상 알지 못할 세계로 떠다니고 있습니다. 잃어버린 마음 조각 어찌하다가 제가 이렇게 되었는지 모릅니다. +피어 오르는 생명의 광채를 스스로 사형에 처하지 아니하면 아니 될 때 어찌 슬픔이 없겠습니까. 이것은 현실로 사람의 생명을 죽이는 것보다 더 무서운 죄가 아니오리까. 나의 세계에서 처음이요 마지막으로 발견한 빛을 어둠 속에 소멸해 버리라는 이 일이 얼마나 떨리는 직무오리까. 이 허깨비의 형의 사람이 살기 위하여 내 손으로 칼을 들어 내 영혼의 환희를 쳐야 옳습니까. 저는 하나님을 원망합니다. +이렇게 씌어 있습니다. 선생님 이것이 얼마나 피 흐르는 고백입니까. +선생님, 저는 정임의 이 고백을 보고 무조건으로 정임의 사랑을 시인합니다. 선생님, 제 목숨을 바쳐서 하는 일에 누가 시비를 하겠습니까. 더구나 그 동기에 티끌만큼도 불순한 것이 없음에야 무조건으로 시인하지 아니하고 어찌합니까. +바라기는 정임의 병이 크게 되지 아니하고 아버지께서 무사히 계셔서 속히 만나뵙게 되는 것입니다마는 앞길이 망망하여 가슴이 두근거림을 금치 못합니다. 게다가 오늘은 함박눈이 퍼부어서 천지가 온통 회색으로 한 빛이 되었으니 더욱 전도가 막막합니다. 그러나 선생님 저는 앓는 정임을 데리고 용감하게 시베리아 길을 떠납니다. +한 일 주일 후에 또 편지 한 장이 왔다. 그것도 순임의 편지여서 이러한 말이 있었다. +……오늘 새벽에 흥안령을 지났습니다. 플랫폼의 한란계는 영하 이십삼 도를 가리켰습니다. 사람들의 얼굴은 솜털에 성에가 슬어서 남녀 노소 할 것 없이 하얗게 분을 바른 것 같습니다. 유리에 비친 내 얼굴도 그와 같이 흰 것을 보고 놀랐습니다. 숨을 들이쉴 때에는 코털이 얼어서 숨이 끊기고 바람결이 지나가면 눈물이 얼어서 눈썹이 마주 붙습니다. 사람들은 털과 가죽에 싸여서 곰같이 보입니다. +또 이런 말도 있었다. +아라사 계집애들이 우유병들을 품에 품고 서서 손님이 사기를 기다리고 있습니다. 저도 두 병을 사서 정임이와 나누어 먹었습니다. 우유는 따뜻합니다. 그것을 식히지 아니할 양으로 품에 품고 섰던 것입니다. +또 이러한 구절도 있었다. +정거장에 닿을 때마다 저희들은 밖을 내다봅니다. 행여나 아버지가 거기 계시지나 아니할까 하고요. 차가 어길 때에는 더구나 마음이 조입니다. 아버지가 그 차를 타고 지나가시지나 아니하는가 하고요. 그리고는 정임은 웁니다. 꼭 뵈올 어른을 놓쳐나 버린 듯이. +그리고는 이 주일 동안이나 소식이 없다가 편지 한 장이 왔다. 그것은 정임의 글씨였다. +선생님, 저는 지금 최 선생께서 계시던 바이칼 호반의 그 집에 와서 홀로 누웠습니다. 순임은 주인 노파와 함께 F역으로 최 선생을 찾아서 오늘 아침에 떠나고 병든 저만 혼자 누워서 얼음에 싸인 바이칼 호의 눈보라치는 바람 소리를 듣고 있습니다. 열은 삼십팔 도로부터 구 도 사이를 오르내리고 기침은 나고 몸의 괴로움을 견딜 수 없습니다. 그러하오나 선생님, 저는 하나님을 불러서 축원합니다. 이 실낱 같은 생명이 다 타 버리기 전에 최 선생의 낯을 다만 일 초 동안이라도 보여지이라고. 그러하오나 선생님, 이 축원이 이루어지겠습니까. +저는 한사코 F역까지 가려 하였사오나 순임 형이 울고 막사오며 또 주인 노파가 본래 미국 사람과 살던 사람으로 영어를 알아서 순임 형의 도움이 되겠기로 저는 이 곳에 누워 있습니다. 순임 형은 기어코 아버지를 찾아 모시고 오마고 약속하였사오나 이 넓은 시베리아에서 어디 가서 찾겠습니까. +선생님, 저는 죽음을 봅니다. 죽음이 바로 제 앞에 와서 선 것을 봅니다. 그의 손은 제 여윈 손을 잡으려고 들먹거림을 봅니다. +선생님, 죽은 뒤에도 의식이 남습니까. 만일 의식이 남는다 하면 죽은 뒤에도 이 아픔과 괴로움을 계속하지 아니하면 아니 됩니까. 죽은 뒤에는 오직 영원한 어둠과 잊어버림이 있습니까. 죽은 뒤에는 혹시나 생전에 먹었던 마음을 자유로 펼 도리가 있습니까. 이 세상에서 그립고 사모하던 이를 죽은 뒤에는 자유로 만나 보고 언제나 마음껏 같이할 수가 있습니까. 그런 일도 있습니까. 이런 일을 바라는 것도 죄가 됩니까. +정임의 편지는 더욱 절망적인 어조로 찬다. +저는 처음 병이 났을 때에는 죽는 것이 싫고 무서웠습니다. 그러나 지금은 죽는 것이 조금도 무섭지 아니합니다. 다만 차마 죽지 못하는 것이 한. +하고는 `다만 차마' 이하를 박박 지워 버렸다. 그리고는 새로 시작하여 나와내 가족에게 대한 문안을 하고는 끝을 막았다. +나는 이 편지를 받고 울었다. 무슨 큰 비극이 가까운 것을 예상하게 하였다. +그 후 한 십여 일이나 지나서 전보가 왔다. 그것은 영문으로 씌었는데, +"아버지 병이 급하다. 나로는 어쩔 수 없다. 돈 가지고 곧 오기를 바란다." +하고 그 끝에 B호텔이라고 주소를 적었다. 전보 발신국이 이르쿠츠크인 것을 보니 B호텔이라 함은 이르쿠츠크인 것이 분명하였다. +나는 최석 부인에게 최석이가 아직 살아 있다는 것을 전하고 곧 여행권 수속을 하였다. 절망으로 알았던 여행권은 사정이 사정인만큼 곧 발부되었다. +나는 비행기로 여의도를 떠났다. 백설에 개개한 땅을, 남빛으로 푸른 바다를 굽어보는 동안에 대련을 들러 거기서 다른 비행기를 갈아타고 봉천, 신경, 하얼빈을 거쳐, 치치하얼에 들렀다가 만주리로 급행하였다. +웅대한 대륙의 설경도 나에게 아무러한 인상도 주지 못하였다. 다만 푸른 하늘과 희고 평평한 땅과의 사이로 한량 없이 허공을 날아간다는 생각밖에 없었다. 그것은 사랑하는 두 친구가 목숨이 경각에 달린 것을 생각할 때에 마음에 아무 여유도 없는 까닭이었다. +만주리에서도 비행기를 타려 하였으나 소비에트 관헌이 허락을 아니 하여 열차로 갈 수밖에 없었다. +초조한 몇 밤을 지나고 이르쿠츠크에 내린 것이 오전 두시. 나는 B호텔로 이스보스치카라는 마차를 몰았다. 죽음과 같이 고요하게 눈 속에 자는 시간에는 여기저기 전등이 반짝거릴 뿐, 이따금 밤의 시가를 경계하는 병정들의 눈이 무섭게 빛나는 것이 보였다. +B호텔에서 미스 초이(최 양)를 찾았으나 순임은 없고 어떤 서양 노파가 나와서, +"유 미스터 Y?" +하고 의심스러운 눈으로 나를 보았다. +그렇다는 내 대답을 듣고는 노파는 반갑게 손을 내밀어서 내 손을 잡았다. +나는 넉넉하지 못한 영어로 그 노파에게서 최석이가 아직 살았다는 말과 정임의 소식은 들은 지 오래라는 말과 최석과 순임은 여기서 삼십 마일이나 떨어진 F역에서도 썰매로 더 가는 삼림 속에 있다는 말을 들었다. +나는 그 밤을 여기서 지내고 이튿날 아침에 떠나는 완행차로 그 노파와 함께 이르쿠츠크를 떠났다. +이 날도 천지는 오직 눈뿐이었다. 차는 가끔 삼림 중으로 가는 모양이나 모두 회색빛에 가리워서 분명히 보이지를 아니하였다. +F역이라는 것은 삼림 속에 있는 조그마한 정거장으로 집이라고는 정거장 집밖에 없었다. 역부 두엇이 털옷에 하얗게 눈을 뒤쓰고 졸리는 듯이 오락가락할 뿐이었다. +우리는 썰매 하나를 얻어 타고 어디가 길인지 분명치도 아니한 눈 속으로 말을 몰았다. +바람은 없는 듯하지마는 그래도 눈발을 한편으로 비끼는 모양이어서 아름드리 나무들의 한쪽은 하얗게 눈으로 쌓이고 한쪽은 검은 빛이 더욱 돋보였다. 백 척은 넘을 듯한 꼿꼿한 침엽수(전나무 따윈가)들이 어디까지든지, 하늘에서 곧 내려박은 못 모양으로, 수없이 서 있는 사이로 우리 썰매는 간다. 땅에 덮인 눈은 새로 피워 놓은 솜같이 희지마는 하늘에서 내리는 눈은 구름빛과 공기빛과 어울려서 밥 잦힐 때에 굴뚝에서 나오는 연기와 같이 연회색이다. +바람도 불지 아니하고 새도 날지 아니하건마는 나무 높은 가지에 쌓인 눈이 이따금 덩치로 떨어져서는 고요한 수풀 속에 작은 동요를 일으킨다. +우리 썰매가 가는 길이 자연스러운 복잡한 커브를 도는 것을 보면 필시 얼음 언 개천 위로 달리는 모양이었다. +한 시간이나 달린 뒤에 우리 썰매는 늦은 경사지를 올랐다. 말을 어거하는 아라사 사람은 쭈쭈쭈쭈, 후르르 하고 주문을 외우듯이 입으로 말을 재촉하고 고삐를 이리 들고 저리 들어 말에게 방향을 가리킬 뿐이요, 채찍은 보이기만하고 한 번도 쓰지 아니하였다. 그와 말과는 완전히 뜻과 정이 맞는 동지인 듯하였다. +처음에는 몰랐으나 차차 추워짐을 깨달았다. 발과 무르팍이 시렸다. +"얼마나 머오?" +하고 나는 오래간만에 입을 열어서 노파에게 물었다. 노파는 털수건으로 머리를 싸매고 깊숙한 눈만 남겨 가지고 실신한 사람 모양으로 허공만 바라보고 있다가, 내가 묻는 말에 비로소 잠이나 깬 듯이, +"멀지 않소. 인젠 한 십오 마일." +하고는 나를 바라보았다. 그 눈은 아마 웃는 모양이었다. +그 얼굴, 그 눈, 그 음성이 모두 이 노파가 인생 풍파의 슬픈 일 괴로운 일에 부대끼고 지친 것을 표하였다. 그리고 죽는 날까지 살아간다 하는 듯하였다. +경사지를 올라서서 보니 그것은 한 산등성이였다. 방향은 알 수 없으나 우리가 가는 방향에는 더 높은 등성이가 있는 모양이나 다른 곳은 다 이보다 낮은 것 같아서 하얀 눈바다가 끝없이 보이는 듯하였다. 그 눈보라는 들쑹날쑹이 있는 것을 보면 삼림의 꼭대기인 것이 분명하였다. 더구나 여기저기 뾰족뾰족 눈송이 붙을 수 없는 마른 나뭇가지가 거뭇거뭇 보이는 것을 보아서 그러하였다. 만일 눈이 걷혀 주었으면 얼마나 안계가 넓으랴, 최석 군이 고민하는 가슴을 안고 이리로 헤매었구나 하면서 나는 목을 둘러서 사방을 바라보았다. +우리는 그 등성이를 내려갔다. 말이 미처 발을 땅에 놓을 수가 없는 정도로 빨리 내려갔다. 여기는 산불이 났던 자리인 듯하여 거뭇거뭇 불탄 자국 있는 마른 나무들이 드문드문 서 있었다. 그 나무들은 찍어 가는 사람도 없으매 저절로 썩어서 없어지기를 기다릴 수밖에 없었다. 그들은 나서 아주 썩어 버리기까지 천 년 이상은 걸린다고 하니 또한 장한 일이다. +이 대삼림에 불이 붙는다 하면 그것은 장관일 것이다. 달밤에 높은 곳에서 이 경치를 내려다본다 하면 그도 장관일 것이요, 여름에 한창 기운을 펼 때도 장관일 것이다. 나는 오뉴월경에 시베리아를 여행하는 이들이 끝없는 꽃바다를 보았다는 기록을 생각하였다. +"저기요!" +하는 노파의 말에 나는 생각의 줄을 끊었다. 저기라고 가리키는 곳을 보니 거기는 집이라고 생각되는 물건이 나무 사이로 보였다. 창이 있으니 분명 집이었다. +우리 이스보스치카가 가까이 오는 것을 보았는지, 그 집 같은 물건의 문 같은 것이 열리며 검은 외투 입은 여자 하나가 팔을 허우적거리며 뛰어나온다. 아마 소리도 치는 모양이겠지마는 그 소리는 아니 들렸다. 나는 그것이 순임인 줄을 얼른 알았다. 또 순임이밖에 될 사람도 없었다. +순임은 한참 달음박질로 오다가 눈이 깊어서 걸음을 걷기가 힘이 드는지 멈칫 섰다. 그의 검은 외투는 어느덧 흰 점으로 얼려져 가지고 어깨는 희게 되는 것이 보였다. +순임의 갸름한 얼굴이 보였다. +"선생님!" +하고 순임도 나를 알아보고는 또 팔을 허우적거리며 소리를 질렀다. +나도 반가워서 모자를 벗어 둘렀다. +"아이 선생님!" +하고 순임은 내가 썰매에서 일어서기도 전에 내게 와서 매달리며 울었다. +"아버지 어떠시냐?" +하고 나는 순임의 등을 두드렸다. 나는 다리가 마비가 되어서 곧 일어설 수가 없었다. +"아버지 어떠시냐?" +하고 나는 한 번 더 물었다. +순임은 벌떡 일어나 두 주먹으로 흐르는 눈물을 쳐내 버리며, +"대단하셔요." +하고도 울음을 금치 못하였다. +노파는 벌써 썰매에서 내려서 기운 없는 걸음으로 비틀비틀 걷기를 시작하였다. +나는 순임을 따라서 언덕을 오르며, +"그래 무슨 병환이시냐?" +하고 물었다. +"몰라요. 신열이 대단하셔요." +"정신은 차리시든?" +"처음 제가 여기 왔을 적에는 그렇지 않더니 요새에는 가끔 혼수 상태에 빠지시는 모양이야요." +이만한 지식을 가지고 나는 최석이가 누워 있는 집 앞에 다다랐다. +이 집은 통나무를 댓 개 우물 정자로 가로놓고 지붕은 무엇으로 했는지 모르나 눈이 덮이고, 문 하나 창 하나를 내었는데 문은 나무껍질인 모양이나 창은 젖빛 나는 유리창인 줄 알았더니 뒤에 알아본즉 그것은 유리가 아니요, 양목을 바르고 물을 뿜어서 얼려 놓은 것이었다. 그리고 통나무와 통나무 틈바구니에는 쇠털과 같은 마른 풀을 꼭꼭 박아서 바람을 막았다. +문을 열고 들어서니 부엌에 들어서는 모양으로 쑥 빠졌는데 화끈화끈하는 것이 한증과 같다. 그렇지 않아도 침침한 날에 언 눈으로 광선 부족한 방에 들어오니, 캄캄 절벽이어서 아무것도 보이지 아니하였다. +순임이가 앞서서 양초에 불을 켠다. 촛불 빛은 방 한편 쪽 침대라고 할 만한 높은 곳에 담요를 덮고 누운 최석의 시체와 같은 흰 얼굴을 비춘다. +"아버지, 아버지 샌전 아저씨 오셨어요." +하고 순임은 최석의 귀에 입을 대고 가만히 불렀다. +그러나 대답이 없었다. +나는 최석의 이마를 만져 보았다. 축축하게 땀이 흘렀다. 그러나 그리 더운 줄은 몰랐다. +방 안의 공기는 숨이 막힐 듯하였다. 그 난방 장치는 삼굿의 원리를 이용한 것이었다. 돌멩이로 아궁이를 쌓고 그 위에 큰 돌멩이들을 많이 쌓고 거기다가 불을 때어서 달게 한 뒤에 거기 눈을 부어 뜨거운 증기를 발하는 것이었다. +이 건축법은 조선 동포들이 시베리아로 금광을 찾아다니면서 하는 법이란 말을 들었으나 최석이가 누구에게서 배워 가지고 어떤 모양으로 지었는지는 최석의 말을 듣기 전에는 알 수 없는 일이다. +나는 내 힘이 미치는 데까지 최석의 병 치료에 대한 손을 쓰고 어떻게 해서든지 이르쿠츠크의 병원으로 최석을 데려다가 입원시킬 도리를 궁리하였다. 그러나 냉정하게 생각하면 최석은 살아날 가망이 없는 것만 같았다. +내가 간 지 사흘 만에 최석은 처음으로 정신을 차려서 눈을 뜨고 나를 알아보았다. +그는 반가운 표정을 하고 빙그레 웃기까지 하였다. +"다 일없나?" +이런 말도 알아들을 수가 있었다. +그러나 심히 기운이 없는 모양이기로 나는 많이 말을 하지 아니하였다. +최석은 한참이나 눈을 감고 있더니, +"정임이 소식 들었나?" +하였다. +"괜찮대요." +하고 곁에서 순임이가 말하였다. +그리고는 또 혼몽하는 듯하였다. +그 날 또 한 번 최석은 정신을 차리고 순임더러는 저리로 가라는 뜻을 표하고 나더러 귀를 가까이 대라는 뜻을 보이기로 그대로 하였더니, +"내 가방 속에 일기가 있으니 그걸 자네만 보고는 불살라 버려. 내가 죽은 뒤에라도 그것이 세상 사람의 눈에 들면 안 되지. 순임이가 볼까 걱정이 되지마는 내가 몸을 꼼짝할 수가 있나." +하는 뜻을 말하였다. +"그러지." +하고 나는 고개를 끄덕여 보였다. +그러고 난 뒤에 나는 최석이가 시킨 대로 가방을 열고 책들을 뒤져서 그 일기책이라는 공책을 꺼내었다. +"순임이 너 이거 보았니?" +하고 나는 곁에서 내가 책 찾는 것을 보고 섰던 순임에게 물었다. +"아니오. 그게 무어여요?" +하고 순임은 내 손에 든 책을 빼앗으려는 듯이 손을 내밀었다. +나는 순임의 손이 닿지 않도록 책을 한편으로 비키며, +"이것이 네 아버지 일기인 모양인데 너는 보이지 말고 나만 보라고 하셨다. 네 아버지가 네가 이것을 보았을까 해서 염려를 하시는데 안 보았으면 다행이다." +하고 나는 그 책을 들고 밖으로 나왔다. +날이 밝다. 해는 중천에 있다. 중천이래야 저 남쪽 지평선 가까운 데다. 밤이 열여덟 시간, 낮이 대여섯 시간밖에 안 되는 북쪽 나라다. 멀건 햇빛이다. +나는 볕이 잘 드는 곳을 골라서 나무에 몸을 기대고 최석의 일기를 읽기 시작하였다. 읽은 중에서 몇 구절을 골라 볼까. +"집이 다 되었다. 이 집은 내가 생전 살고 그 속에서 이 세상을 마칠 집이다. 마음이 기쁘다. 시끄러운 세상은 여기서 멀지 아니하냐. 내가 여기 홀로 있기로 누가 찾을 사람도 없을 것이다. 내가 여기서 죽기로 누가 슬퍼해 줄 사람도 없을 것이다. 때로 곰이나 찾아올까. 지나가던 사슴이나 들여다볼까. +이것이 내 소원이 아니냐. 세상의 시끄러움을 떠나는 것이 내 소원이 아니냐. 이 속에서 나는 나를 이기기를 공부하자." +첫날은 이런 평범한 소리를 썼다. +그 이튿날에는. +"어떻게나 나는 약한 사람인고. 제 마음을 제가 지배하지 못하는 사람인고. 밤새도록 나는 정임을 생각하였다. 어두운 허공을 향하여 정임을 불렀다. 정임이가 나를 찾아서 동경을 떠나서 이리로 오지나 아니하나 하고 생각하였다. 어떻게나 부끄러운 일인고? 어떻게나 가증한 일인고? +나는 아내를 생각하려 하였다. 아이들을 생각하려 하였다. 아내와 아이들을 생각함으로 정임의 생각을 이기려 하였다. +최석아, 너는 남편이 아니냐. 아버지가 아니냐. 정임은 네 딸이 아니냐. 이런 생각을 하였다. +그래도 정임의 일류전은 아내와 아이들의 생각을 밀치고 달려오는 절대 위력을 가진 듯하였다. +아, 나는 어떻게나 파렴치한 사람인고. 나이 사십이 넘어 오십을 바라보는 놈이 아니냐. 사십에 불혹이라고 아니 하느냐. 교육가로 깨끗한 교인으로 일생을 살아 왔다고 자처하는 내가 아니냐 하고 나는 내 입으로 내 손가락을 물어서 두 군데나 피를 내었다." +최석의 둘째 날 일기는 계속된다. +"내 손가락에서 피가 날 때에 나는 유쾌하였다. 나는 승첩의 기쁨을 깨달았다. +그러나 아아 그러나 그 빨간, 참회의 핏방울 속에서도 애욕의 불길이 일지 아니하는가. 나는 마침내 제도할 수 없는 인생인가." +이 집에 든 지 둘째날에 벌써 이러한 비관적 말을 하였다. +또 며칠을 지난 뒤 일기에, +"나는 동경으로 돌아가고 싶다. 정임의 곁으로 가고 싶다. 시베리아의광야의 유혹도 아무 힘이 없다. 어젯밤은 삼림의 좋은 달을 보았으나 그 달을 아름답게 보려 하였으나 아무리 하여도 아름답게 보이지를 아니하였다. +하늘이나 달이나 삼림이나 모두 무의미한 존재다. 이처럼 무의미한 존재를 나는 경험한 일이 없다. 그것은 다만 기쁨을 자아내지 아니할 뿐더러 슬픔도 자아내지 못하였다. 그것은 잿더미였다. 아무도 듣는 이 없는 데서 내 진정을 말하라면 그것은 이 천지에 내게 의미 있는 것은 정임이밖에 없다는 것이다. +나는 정임의 곁에 있고 싶다. 정임을 내 곁에 두고 싶다. 왜? 그것은 나도 모른다. +만일 이 움 속에라도 정임이가 있다 하면 얼마나 이것이 즐거운 곳이 될까. +그러나 이것은 불가능한 일이다. 이 일이 있어서는 아니 된다. 나는 이 생각을 죽여야 한다. 다시 거두를 못 하도록 목숨을 끊어 버려야 한다. +이것을 나는 원한다. 원하지마는 내게는 그 힘이 없는 모양이다. +나는 종교를 생각하여 본다. 철학을 생각하여 본다. 인류를 생각하여 본다. 나라를 생각하여 본다. 이것을 가지고 내 애욕과 바꾸려고 애써 본다. 그렇지마는 내게 그러한 힘이 없다. 나는 완전히 헬플리스함을 깨닫는다. +아아 나는 어찌할꼬? +나는 못생긴 사람이다. 그까짓 것을 못 이겨? 그까짓 것을 못 이겨? +나는 예수의 광야에서의 유혹을 생각한다. 천하를 주마 하는 유혹을 생각한다. 나는 싯다르타 태자가 왕궁을 버리고 나온 것을 생각하고, 또 스토아 철학자의 의지력을 생각하였다. +그러나 나는 그러한 생각으로도 이 생각을 이길 수가 없는 것 같다. +나는 혁명가를 생각하였다. 모든 것 사랑도 목숨도 다 헌신짝같이 집어던지고 피 흐르는 마당으로 뛰어나가는 용사를 생각하였다. 나는 이끝없는 삼림 속으로 혁명의 용사 모양으로 달음박질치다가 기운이 진한 곳에서 죽어 버리는 것이 소원이었다. 그러나 거기까지도 이 생각은 따르지 아니할까. +나는 지금 곧 죽어 버릴까. 나는 육혈포를 손에 들어 보았다. 이 방아쇠를 한 번만 튕기면 내 생명은 없어지는 것이 아닌가. 그리 되면 모든 이 마음의 움직임은 소멸되는 것이 아닌가. 이것으로 만사가 해결되는 것이 아닌가. +아 하나님이시여, 힘을 주시옵소서. 천하를 이기는 힘보다도 나 자신을 이기는 힘을 주시옵소서. 이 죄인으로 하여금 하나님의 눈에 의롭고 깨끗한 사람으로 이 일생을 마치게 하여 주시옵소서, 이렇게 나는 기도를 한다. +그러나 하나님께서는 나를 버리셨다. 하나님께서는 내게 힘을 주시지 아니하시었다. 나를 이 비참한 자리에서 썩어져 죽게 하시었다." +최석은 어떤 날 일기에 또 이런 것도 썼다. 그것은 예전 내게 보낸 편지에 있던 꿈 이야기를 연상시키는 것이었다. 그것은 이러하다. +"오늘 밤은 달이 좋다. 시베리아의 겨울 해는 참 못생긴 사람과도 같이 기운이 없지마는 하얀 땅, 검푸른 하늘에 저쪽 지평선을 향하고 흘러가는 반달은 참으로 맑음 그것이었다. +나는 평생 처음 시 비슷한 것을 지었다. +임과 이별하던 날 밤에는 남쪽 나라에 바람비가 쳤네 +임 타신 자동차의 뒷불이 빨간 뒷불이 빗발에 찢겼네 +임 떠나 혼자 헤매는 시베리아의 오늘 밤에는 +지려는 쪽달이 눈 덮인 삼림에 걸렸구나 +아아 저 쪽달이여 +억지로 반을 갈겨진 것도 같아라 +아아 저 쪽달이여 +잃어진 짝을 찾아 +차디찬 허공 속을 영원히 헤매는 것도 같구나 +나도 저 달과 같이 잃어버린 반쪽을 찾아 무궁한 시간과 공간에서 헤매는 것만 같다. +에익. 내가 왜 이리 약한가. 어찌하여 크나큰 많은 일을 돌아보지 못하고 요만한 애욕의 포로가 되는가. +그러나 나는 차마 그 달을 버리고 들어올 수가 없었다. 내가 왜 이렇게 센티멘털하게 되었는고. 내 쇠 같은 의지력이 어디로 갔는고. 내 누를 수 없는 자존심이 어디로 갔는고. 나는 마치 유모의 손에 달린 젖먹이와도 같다. 내 일신은 도시 애욕 덩어리로 화해 버린 것 같다. +이른바 사랑 사랑이란 말은 종교적 의미인 것 이외에도 입에 담기도 싫어하던 말이다 이런 것은 내 의지력과 자존심을 녹여 버렸는가. 또 이 부자연한 고독의 생활이 나를 이렇게 내 인격을 이렇게 파괴하였는가. +그렇지 아니하면 내 자존심이라는 것이나, 의지력이라는 것이나, 인격이라는 것이 모두 세상의 습관과 사조에 휩쓸리던 것인가. 남들이 그러니까 남들이 옳다니까 남들이 무서우니까 이 애욕의 무덤에 회를 발랐던 것인가. 그러다가 고독과 반성의 기회를 얻으매 모든 회칠과 가면을 떼어 버리고 빨가벗은 애욕의 뭉텅이가 나온 것인가. +그렇다 하면, 이것이 참된 나인가. 이것이 하나님께서 지어 주신 대로의 나인가. 가슴에 타오르는 애욕의 불길 이 불길이 곧 내 영혼의 불길인가. +어쩌면 그 모든 높은 이상들 인류에 대한, 민족에 대한, 도덕에 대한, 신앙에 대한 그 높은 이상들이 이렇게도 만만하게 마치 바람에 불리는 재 모양으로 자취도 없이 흩어져 버리고 말까. 그리고 그 뒤에는 평소에그렇게도 미워하고 천히 여기던 애욕의 검은 흙만 남고 말까. +아아 저 눈 덮인 땅이여, 차고 맑은 달이여, 허공이여! 나는 너희들을 부러워하노라. +불교도들의 해탈이라는 것이 이러한 애욕이 불붙는 지옥에서 눈과 같이 싸늘하고 허공과 같이 빈 곳으로 들어감을 이름인가. +석가의 팔 년 간 설산 고행이 이 애욕의 뿌리를 끊으려 함이라 하고 예수의 사십 일 광야의 고행과 겟세마네의 고민도 이 애욕의 뿌리 때문이었던가. +그러나 그것을 이기어 낸 사람이 천지 개벽 이래에 몇몇이나 되었는고? 나 같은 것이 그 중에 한 사람 되기를 바랄 수가 있을까. +나 같아서는 마침내 이 애욕의 불길에 다 타서 재가 되어 버릴 것만 같다. 아아 어떻게나 힘있고 무서운 불길인고." +이러한 고민의 자백도 있었다. +또 어떤 날 일기에는 최석은 이런 말을 썼다. +"나는 단연히 동경으로 돌아가기를 결심하였다." +그리고는 그 이튿날은, +"나는 단연히 동경으로 돌아가리란 결심을 한 것을 굳세게 취소한다. 나는 이러한 결심을 하는 나 자신을 굳세게 부인한다." +또 이런 말도 있다. +"나는 정임을 시베리아로 부르련다." +또 그 다음에는, +"아아 나는 하루바삐 죽어야 한다. 이 목숨을 연장하였다가는 무슨 일을 저지를는지 모른다. 나는 깨끗하게 나를 이기는 도덕적 인격으로 이 일생을 마쳐야 한다. 이 밖에 내 사업이 무엇이냐." +또 어떤 곳에는, +"아아 무서운 하룻밤이었다. 나는 지난 하룻밤을 누를 수 없는 애욕의 불길에 탔다. 나는 내 주먹으로 내 가슴을 두드리고 머리를 벽에 부딪쳤다. 나는 주먹으로 담벽을 두드려 손등이 터져서 피가 흘렀다. 나는 내 머리카락을 쥐어뜯었다. 나는 수없이 발을 굴렀다. 나는 이 무서운 유혹을 이기려고 내 몸을 아프게 하였다. 나는 견디다 못하여 문을 박차고 뛰어나갔다. 밖에는 달이 있고 눈이 있었다. 그러나 눈은 핏빛이요, 달은 찌그러진 것 같았다. 나는 눈 속으로 달음박질쳤다. 달을 따라서 엎드러지며 자빠지며 달음질쳤다. 나는 소리를 질렀다. 나는 미친 사람 같았다." +그러고는 어디까지 갔다가 어느 때에 어떠한 심경의 변화를 얻어 가지고 돌아왔다는 말은 쓰이지 아니하였으나 최석의 병의 원인을 설명하는 것 같았다. +"열이 나고 기침이 난다. 가슴이 아프다. 이것이 폐렴이 되어서 혼자 깨끗하게 이 생명을 마치게 하여 주소서 하고 빈다. 나는 오늘부터 먹고 마시기를 그치련다." +이러한 말을 썼다. 그러고는, +"정임, 정임, 정임, 정임." +하고 정임의 이름을 수없이 쓴 것도 있고, 어떤 데는, +"Overcome, Overcome." +하고 영어로 쓴 것도 있었다. +그리고 마지막에, +"나는 죽음과 대면하였다. 사흘째 굶고 앓은 오늘에 나는 극히 맑고 침착한 정신으로 죽음과 대면하였다. 죽음은 검은 옷을 입었으나 그 얼굴에는 자비의 표정이 있었다. 죽음은 곧 검은 옷을 입은 구원의 손이었다. 죽음은 아름다운 그림자였다. 죽음은 반가운 애인이요, 결코 무서운 원수가 아니었다. 나는 죽음의 손을 잡노라. 감사하는 마음으로 죽음의 품에 안기노라. 아멘." +이것을 쓴 뒤에는 다시는 일기가 없었다. 이것으로 최석이가 그 동안 지난 일을 적어도 심리적 변화만은 대강 추측할 수가 있었다. +다행히 최석의 병은 점점 돌리는 듯하였다. 열도 내리고 식은땀도 덜 흘렸다. 안 먹는다고 고집하던 음식도 먹기를 시작하였다. +정임에게로 갔던 노파에게서는 정임도 열이 내리고 일어나 앉을 만하다는 편지가 왔다. +나는 노파의 편지를 최석에게 읽어 주었다. 최석은 그 편지를 듣고 매우 흥분하는 모양이었으나 곧 안심하는 빛을 보였다. +나는 최석의 병이 돌리는 것을 보고 정임을 찾아볼 양으로 떠나려 하였으나 순임이가 듣지 아니하였다. 혼자서 앓는 아버지를 맡아 가지고 있을 수는 없다는 것이었다. 그래서 노파가 오기를 기다리기로 하였다. +나는 최석이가 먹을 음식도 살 겸 우편국에도 들를 겸 시가까지 가기로 하고 이 곳 온 지 일 주일이나 지나서 처음으로 산에서 나왔다. +나는 이르쿠츠크에 가서 최석을 위하여 약품과 먹을 것을 사고 또 순임을 위해서도 먹을 것과 의복과 또 하모니카와 손풍금도 사 가지고 정거장에 나와서 돌아올 차를 기다리고 있었다. +나는 순후해 보이는 아라사 사람들이 정거장에서 오락가락하는 것을 보고 속으로는 최석이가 병이 좀 나은 것을 다행으로 생각하고, 또 최석과 정임의 장래가 어찌 될까 하는 것도 생각하면서 뷔페(식당)에서 뜨거운 차이(차)를 마시고 있었다. +이 때에 밖을 바라보고 있던 내 눈은 문득 이상한 것을 보았다. 그것은 그 노파가 이리로 향하고 걸어오는 것인데 그 노파와 팔을 걸은 젊은 여자가 있는 것이다. 머리를 검은 수건으로 싸매고 입과 코를 가리웠으니 분명히 알 수 없으나 혹은 정임이나 아닌가 할 수밖에 없었다. 정임이가 몸만 기동하게 되면 최석을 보러 올 것은 정임의 열정적인 성격으로 보아서 당연한 일이기 때문이었다. +나는 반쯤 먹던 차를 놓고 뷔페 밖으로 뛰어나갔다. +"오 미시즈 체스터필드?" +하고 나는 노파 앞에 손을 내어밀었다. 노파는 체스터필드라는 미국 남편의 성을 따라서 부르는 것을 기억하였다. +"선생님!" +하는 것은 정임이었다. 그 소리만은 변치 아니하였다. 나는 검은 장갑을 낀 정임의 손을 잡았다. 나는 여러 말 아니하고 노파와 정임을 뷔페로 끌고 들어왔다. +늙은 뷔페 보이는 번쩍번쩍하는 사모바르에서 차 두 잔을 따라다가 노파와 정임의 앞에 놓았다. +노파는 어린애에게 하는 모양으로 정임의 수건을 벗겨 주었다. 그 속에서는 해쓱하게 여윈 정임의 얼굴이 나왔다. 두 볼에 불그레하게 홍훈이 도는 것도 병 때문인가. +"어때? 신열은 없나?" +하고 나는 정임에게 물었다. +"괜찮아요." +하고 정임은 웃으며, +"최 선생님께서는 어떠세요?" +하고 묻는다. +"좀 나으신 모양이야. 그래서 나는 오늘 정임을 좀 보러 가려고 했는데 이 체스터필드 부인께서 아니 오시면 순임이가 혼자 있을 수가 없다고 해서, 그래 이렇게 최 선생 자실 것을 사 가지고 가는 길이야." +하고 말을 하면서도 나는 정임의 눈과 입과 목에서 그의 병과 마음을 알아보려고 애를 썼다. +중병을 앓은 깐 해서는 한 달 전 남대문서 볼 때보다 얼마 더 초췌한 것 같지는 아니하였다. +"네에." +하고 정임은 고개를 숙였다. 그의 안경알에는 이슬이 맺혔다. +"선생님 댁은 다 안녕하셔요?" +"응, 내가 떠날 때에는 괜찮았어." +"최 선생님 댁도?" +"응." +"선생님 퍽은 애를 쓰셨어요." +하고 정임은 울음인지 웃음인지 모를 웃음을 웃는다. +말을 모르는 노파는 우리가 하는 말을 눈치나 채려는 듯이 멀거니 보고 있다가 서투른 영어로, +"아직 미스 남은 신열이 있답니다. 그래도 가 본다고, 죽어도 가 본다고 내 말을 안 듣고 따라왔지요." +하고 정임에게 애정 있는 눈흘김을 주며, +"유 노티 차일드(말썽꾼이)." +하고 입을 씰룩하며 정임을 안경 위로 본다. +"니체워, 마뚜슈까(괜찮아요, 어머니)." +하고 정임은 노파를 보고 웃었다. 정임의 서양 사람에게 대한 행동은 서양식으로 째었다고 생각하였다. +정임은 도리어 유쾌한 빛을 보였다. 다만 그의 붉은빛 띤 눈과 마른 입술이 그의 몸에 열이 있음을 보였다. 나는 그의 손끝과 발끝이 싸늘하게 얼었을 것을 상상하였다. +마침 이 날은 날이 온화하였다. 엷은 햇빛도 오늘은 두꺼워진 듯하였다. +우리 세 사람은 F역에서 내려서 썰매 하나를 얻어 타고 산으로 향하였다. 산도 아니지마는 산 있는 나라에서 살던 우리는 최석이가 사는 곳을 산이라고 부르는 습관을 지었다. 삼림이 있으니 산같이 생각된 까닭이었다. +노파가 오른편 끝에 앉고, 가운데다가 정임을 앉히고 왼편 끝에 내가 앉았다. +쩟쩟쩟 하는 소리에 말은 달리기 시작하였다. 한 필은 키 큰 말이요, 한 필은 키가 작은 말인데 키 큰 말은 아마 늙은 군마 퇴물인가 싶게 허우대는 좋으나 몸이 여위고 털에는 윤이 없었다. 조금만 올라가는 길이 되어도 고개를 숙이고 애를 썼다. 작은 말은 까불어서 가끔 채찍으로 얻어맞았다. +"아이 삼림이 좋아요." +하고 정임은 정말 기쁜 듯이 나를 돌아보았다. +"좋아?" +하고 나는 멋없이 대꾸하고 나서, 후회되는 듯이, +"밤낮 삼림 속에서만 사니까 지루한데." +하는 말을 붙였다. +"저는 저 눈 있는 삼림 속으로 한정 없이 가고 싶어요. 그러나 저는 인제 기운이 없으니깐 웬걸 그래 보겠어요?" +하고 한숨을 쉬었다. +"왜 그런 소릴 해. 인제 나을걸." +하고 나는 정임의 눈을 들여다보았다. 마치 슬픈 눈물 방울이나 찾으려는 듯이. +"제가 지금도 열이 삼십팔 도가 넘습니다. 정신이 흐릿해지는 것을 보니까 아마 더 올라가나 봐요. 그래도 괜찮아요. 오늘 하루야 못 살라고요. 오늘 하루만 살면 괜찮아요. 최 선생님만 한 번 뵙고 죽으면 괜찮아요." +"왜 그런 소릴 해?" +하고 나는 책망하는 듯이 언성을 높였다. +정임은 기침을 시작하였다. 한바탕 기침을 하고는 기운이 진한 듯이 노파에게 기대며 조선말로, +"추워요." +하였다. 이 여행이 어떻게 정임의 병에 좋지 못할 것은 의사가 아닌 나로도 짐작할 수가 있었다. 그러나 나로는 더 어찌할 수가 없었다. +나는 외투를 벗어서 정임에게 입혀 주고 노파는 정임을 안아서 몸이 덜 흔들리도록 또 춥지 않도록 하였다. +나는 정임의 모양을 애처로워서 차마 볼 수가 없었다. 그러나 이것은 하나님밖에는 어찌할 도리가 없는 일이었다. +얼마를 지나서 정임은 갑자기 고개를 들고 일어나며, +"인제 몸이 좀 녹았습니다. 선생님 추우시겠어요. 이 외투 입으셔요." +하고 그의 입만 웃는 웃음을 웃었다. +"난 춥지 않아. 어서 입고 있어." +하고 나는 정임이가 외투를 벗는 것을 막았다. 정임은 더 고집하려고도 아니하고, +"선생님 시베리아의 삼림은 참 좋아요. 눈 덮인 것이 더 좋은 것 같아요. 저는 이 인적 없고 자유로운 삼림 속으로 헤매어 보고 싶어요." +하고 아까 하던 것과 같은 말을 또 하였다. +"며칠 잘 정양하여서, 날이나 따뜻하거든 한 번 산보나 해 보지." +하고 나는 정임의 말 뜻이 다른 데 있는 줄을 알면서도 부러 평범하게 대답하였다. +정임은 대답이 없었다. +"여기서도 아직 멀어요?" +하고 정임은 몸이 흔들리는 것을 심히 괴로워하는 모양으로 두 손을 자리에 짚어 몸을 버티면서 말하였다. +"고대야, 최 선생이 반가워할 터이지. 오죽이나 반갑겠나." +하고 나는 정임을 위로하는 뜻으로 말하였다. +"아이 참 미안해요. 제가 죄인이야요. 저 때문에 애매한 누명을 쓰시고 저렇게 사업도 버리시고 병환까지 나시니 저는 어떡허면 이 죄를 씻습니까?" +하고 눈물 고인 눈으로 정임은 나를 쳐다보았다. +나는 정임과 최석을 이 자유로운 시베리아의 삼림 속에 단둘이 살게 하고 싶었다. 그러나 최석은 살아나가겠지마는 정임이가 살아날 수가 있을까, 하고 나는 정임의 어깨를 바라보았다. 그의 목숨은 실낱 같은 것 같았다. 바람받이에 놓인 등잔불과만 같은 것 같았다. 이 목숨이 끊어지기 전에 사랑하는 이의 얼굴을 한 번 대하겠다는 것밖에 아무 소원이 없는 정임은 참으로 가엾어서 가슴이 미어지는 것 같았다. +"염려 말어. 무슨 걱정이야? 최 선생도 병이 돌리고 정임도 인제 얼마 정양하면 나을 것 아닌가. 아무 염려 말아요." +하고 나는 더욱 최석과 정임과 두 사람의 사랑을 달하게 할 결심을 하였다. 하나님께서 계시다면 이 가엾은 간절한 두 사람의 마음을 가슴 미어지게 아니 생각할 리가 없다고 생각하였다. 우주의 모든 일 중에 정임의 정경보다 더 슬프고 불쌍한 정경이 또 있을까 하였다. 차디찬 눈으로 덮인 시베리아의 광야에 병든 정임의 사랑으로 타는 불똥과 같이 날아가는 이 정경은 인생이 가질 수 있는 최대한 비극인 것 같았다. +정임은 지쳐서 고개를 숙이고 있다가도 가끔 고개를 들어서는 기운 나는 양을 보이려고, 유쾌한 양을 보이려고 애를 썼다. +"저 나무 보셔요. 오백 년은 살았겠지요?" +이런 말도 하였다. 그러나 그것은 다 억지로 지어서 하는 것이었다. 그러다가는 또 기운이 지쳐서는 고개를 숙이고, 혹은 노파의 어깨에 혹은 내 어깨에 쓰러졌다. +마침내 우리가 향하고 가는 움집이 보였다. +"정임이, 저기야." +하고 나는 움집을 가리켰다. +"네에?" +하고 정임은 내 손가락 가는 곳을 보고 다음에는 내 얼굴을 보았다. 잘 보이지 않는 모양이다. +"저기 저것 말야. 저기 저 고작 큰 전나무 두 개가 있지 않아? 그 사이로 보이는 저, 저거 말야. 옳지 옳지, 순임이 지금 나오지 않아?" +하였다. +순임이가 무엇을 가지러 나오는지 문을 열고 나와서는 밥 짓느라고 지어 놓은 이를테면 부엌에를 들어갔다가 나오는 길에 이 쪽을 바라보다가 우리를 발견하였는지 몇 걸음 빨리 오다가는 서서 보고 오다가는 서서 보더니 내가 모자를 내두르는 것을 보고야 우리 일행인 것을 확실히 알고 달음박질을 쳐서 나온다. +우리 썰매를 만나자, +"정임이야? 어쩌면 이 추운데." +하고 순임은 정임을 안고 그 안경으로 정임의 눈을 들여다본다. +"어쩌면 앓으면서 이렇게 와?" +하고 순임은 노파와 나를 책망하는 듯이 돌아보았다. +"아버지 어떠시냐?" +하고 나는 짐을 들고 앞서서 오면서 뒤따르는 순임에게 물었다. +"아버지요?" +하고 순임은 어른에게 대한 경의를 표하노라고 내 곁에 와서 걸으며, +"아버지께서 오늘은 말씀을 많이 하셨어요. 순임이가 고생하는구나 고맙다, 이런 말씀도 하시고, 지금 같아서는 일어날 것도 같은데 기운이 없어서, 이런 말씀도 하시고, 또 선생님이 이르쿠츠크에를 들어가셨으니 무엇을 사 오실 듯싶으냐, 알아맞혀 보아라, 이런 농담도 하시고, 정임이가 어떤가 한 번 보았으면, 이런 말씀도 하시겠지요. 또 순임아, 내가 죽더라도 정임을 네 친동생으로 알아서 부디 잘 사랑해 주어라, 정임은 불쌍한 애다, 참 정임은 불쌍해! 이런 말씀도 하시겠지요. 그렇게 여러 가지 말씀을 많이 하시더니, 순임아 내가 죽거든 선생님을 아버지로 알고 그 지도를 받아라, 그러시길래 제가 아버지 안 돌아가셔요! 그랬더니 아버지께서 웃으시면서, 죽지 말까, 하시고는 어째 가슴이 좀 거북한가, 하시더니 잠이 드셨어요. 한 시간이나 되었을까, 온." +집 앞에 거의 다 가서는 순임은 정임의 팔을 꼈던 것을 놓고 빨리 집으로 뛰어들어갔다. +치마폭을 펄럭거리고 뛰는 양에는 어렸을 적 말괄량이 순임의 모습이 남아 있어서 나는 혼자 웃었다. 순임은 정임이가 왔다는 기쁜 소식을 한 시각이라도 빨리 아버지께 전하고 싶었던 것이다. +"아버지, 주무시우? 정임이가 왔어요. 정임이가 왔습니다." +하고 부르는 소리가 밖에서도 들렸다. +나도 방에 들어서고, 정임도 뒤따라 들어서고, 노파는 부엌으로 물건을 두러 들어갔다. +방은 절벽같이 어두웠다. +"순임아, 불을 좀 켜려무나." +하고 최석의 얼굴을 찾느라고 눈을 크게 뜨고 고개를 숙이며, +"자나? 정임이가 왔네." +하고 불렀다. +정임도 곁에 와서 선다. +최석은 대답이 없었다. +순임이가 촛불을 켜자 최석의 얼굴이 환하게 보였다. +"여보게, 여봐. 자나?" +하고 나는 무서운 예감을 가지면서 최석의 어깨를 흔들었다. +그것이 무엇인지 모르지마는 최석은 시체라 하는 것을 나는 내 손을 통해서 깨달았다. +나는 깜짝 놀라서 이불을 벗기고 최석의 팔을 잡아 맥을 짚어 보았다. 거기는 맥이 없었다. +나는 최석의 자리옷 가슴을 헤치고 귀를 가슴에 대었다. 그 살은 얼음과 같이 차고 그 가슴은 고요하였다. 심장은 뛰기를 그친 것이었다. +나는 최석의 가슴에서 귀를 떼고 일어서면서, +"네 아버지는 돌아가셨다. 네 손으로 눈이나 감겨 드려라." +하였다. 내 눈에서는 눈물이 흘렀다. +"선생님!" +하고 정임은 전연히 절제할 힘을 잃어버린 듯이 최석의 가슴에 엎어졌다. 그러고는 소리를 내어 울었다. 순임은, +"아버지, 아버지!" +하고 최석의 베개 곁에 이마를 대고 울었다. +아라사 노파도 울었다. +방 안에는 오직 울음 소리뿐이요, 말이 없었다. 최석은 벌써 이 슬픈 광경도 몰라보는 사람이었다. +최석이가 자기의 싸움을 이기고 죽었는지, 또는 끝까지 지다가 죽었는지 그것은 영원한 비밀이어서 알 도리가 없었다. 그러나 이것만은 확실하다 그의 의식이 마지막으로 끝나는 순간에 그의 의식기에 떠오르던 오직 하나가 정임이었으리라는 것만은. +지금 정임이가 그의 가슴에 엎어져 울지마는, 정임의 뜨거운 눈물이 그의 가슴을 적시건마는 최석의 가슴은 뛸 줄을 모른다. 이것이 죽음이란 것이다. +뒤에 경찰의가 와서 검사한 결과에 의하면, 최석은 폐렴으로 앓던 결과로 심장마비를 일으킨 것이라고 하였다. +나는 최석의 장례를 끝내고 순임과 정임을 데리고 오려 하였으나 정임은 듣지 아니하고 노파와 같이 바이칼 촌으로 가 버렸다. +그런 뒤로는 정임에게서는 일체 음신이 없다. 때때로 노파에게서 편지가 오는데 정임은 최석이가 있던 방에 가만히 있다고만 하였다. +서투른 영어가 뜻을 충분히 발표하지 못하는 것이었다. +나는 정임에게 안심하고 병을 치료하라는 편지도 하고 돈이 필요하거든 청구하라는 편지도 하나 영 답장이 없다. +만일 정임이가 죽었다는 기별이 오면 나는 한 번 더 시베리아에 가서 둘을 가지런히 묻고 `두 별 무덤'이라는 비를 세워 줄 생각이다. 그러나 나는 정임이가 조선으로 오기를 바란다. +여러분은 최석과 정임에게 대한 이 기록을 믿고 그 두 사람에게 대한 오해를 풀라. +EOT; +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/lt_LT/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/lt_LT/Address.php new file mode 100644 index 00000000..f8967ffe --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/lt_LT/Address.php @@ -0,0 +1,209 @@ +generator->parse($format); + } + + public static function country() + { + return static::randomElement(static::$country); + } + + public static function postcode() + { + return static::toUpper(static::bothify(static::randomElement(static::$postcode))); + } + + public static function regionSuffix() + { + return static::randomElement(static::$regionSuffix); + } + + public static function region() + { + return static::randomElement(static::$region); + } + + public static function citySuffix() + { + return static::randomElement(static::$citySuffix); + } + + public function city() + { + return static::randomElement(static::$city); + } + + public static function streetSuffix() + { + return static::randomElement(static::$streetSuffix); + } + + public static function street() + { + return static::randomElement(static::$street); + } + + /** + * Lithuania municipality + * + * @see https://en.wikipedia.org/wiki/Municipality + * + * @return string + */ + public function municipality() + { + return static::randomElement(static::$municipality); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/lt_LT/Company.php b/vendor/fakerphp/faker/src/Faker/Provider/lt_LT/Company.php new file mode 100644 index 00000000..89370b3d --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/lt_LT/Company.php @@ -0,0 +1,15 @@ +generator->parse(static::randomElement(static::$lastNameFormat)); + } + + /** + * Return male last name + * + * @return string + * + * @example 'Vasiliauskas' + */ + public function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + /** + * Return female last name + * + * @return string + * + * @example 'Žukauskaitė' + */ + public function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } + + /** + * Return driver license number + * + * @return string + * + * @example 12345678 + */ + public function driverLicence() + { + return $this->bothify('########'); + } + + /** + * Return passport number + * + * @return string + * + * @example 12345678 + */ + public function passportNumber() + { + return $this->bothify('########'); + } + + /** + * National Personal Identity number (asmens kodas) + * + * @see https://en.wikipedia.org/wiki/National_identification_number#Lithuania + * @see https://lt.wikipedia.org/wiki/Asmens_kodas + * + * @param string $gender [male|female] + * @param string $randomNumber three integers + * + * @return string on format XXXXXXXXXXX + */ + public function personalIdentityNumber($gender = 'male', \DateTime $birthdate = null, $randomNumber = '') + { + if (!$birthdate) { + $birthdate = \Faker\Provider\DateTime::dateTimeThisCentury(); + } + + $genderNumber = ($gender == 'male') ? 1 : 0; + $firstNumber = (int) floor($birthdate->format('Y') / 100) * 2 - 34 - $genderNumber; + + $datePart = $birthdate->format('ymd'); + $randomDigits = (string) (!$randomNumber || strlen($randomNumber) < 3) ? static::numerify('###') : substr($randomNumber, 0, 3); + $partOfPerosnalCode = $firstNumber . $datePart . $randomDigits; + + $sum = self::calculateSum($partOfPerosnalCode, 1); + $liekana = $sum % 11; + + if ($liekana !== 10) { + $lastNumber = $liekana; + + return $firstNumber . $datePart . $randomDigits . $lastNumber; + } + + $sum = self::calculateSum($partOfPerosnalCode, 2); + $liekana = $sum % 11; + + $lastNumber = ($liekana !== 10) ? $liekana : 0; + + return $firstNumber . $datePart . $randomDigits . $lastNumber; + } + + /** + * Calculate the sum of personal code + * + * @see https://en.wikipedia.org/wiki/National_identification_number#Lithuania + * @see https://lt.wikipedia.org/wiki/Asmens_kodas + * + * @param string $numbers + * @param int $time [1|2] + * + * @return int + */ + private static function calculateSum($numbers, $time = 1) + { + if ($time == 1) { + $multipliers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 1]; + } else { + $multipliers = [3, 4, 5, 6, 7, 8, 9, 1, 2, 3]; + } + + $sum = 0; + + for ($i = 1; $i <= 10; ++$i) { + $sum += ((int) $numbers[$i - 1]) * $multipliers[$i - 1]; + } + + return (int) $sum; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/lt_LT/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/lt_LT/PhoneNumber.php new file mode 100644 index 00000000..05e32d31 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/lt_LT/PhoneNumber.php @@ -0,0 +1,17 @@ +generator->parse($format); + } + + public static function country() + { + return static::randomElement(static::$country); + } + + public static function postcode() + { + return static::toUpper(static::bothify(static::randomElement(static::$postcode))); + } + + public static function regionSuffix() + { + return static::randomElement(static::$regionSuffix); + } + + public static function region() + { + return static::randomElement(static::$region); + } + + public static function cityPrefix() + { + return static::randomElement(static::$cityPrefix); + } + + public function city() + { + return static::randomElement(static::$city); + } + + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + public static function street() + { + return static::randomElement(static::$street); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/lv_LV/Color.php b/vendor/fakerphp/faker/src/Faker/Provider/lv_LV/Color.php new file mode 100644 index 00000000..04c895fb --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/lv_LV/Color.php @@ -0,0 +1,19 @@ +format('Y'); + + if ($year >= 2000 && $year <= 2099) { + $century = 2; + } elseif ($year >= 1900 && $year <= 1999) { + $century = 1; + } else { + $century = 0; + } + + $datePart = $birthdate->format('dmy'); + $serialNumber = static::numerify('###'); + + $partialNumberSplit = str_split($datePart . $century . $serialNumber); + + $idDigitValidator = [1, 6, 3, 7, 9, 10, 5, 8, 4, 2]; + $total = 0; + + foreach ($partialNumberSplit as $key => $digit) { + if (isset($idDigitValidator[$key])) { + $total += $idDigitValidator[$key] * (int) $digit; + } + } + + $checksumDigit = (1101 - $total) % 11 % 10; + + return $datePart . '-' . $century . $serialNumber . $checksumDigit; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/lv_LV/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/lv_LV/PhoneNumber.php new file mode 100644 index 00000000..2cfdcb5a --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/lv_LV/PhoneNumber.php @@ -0,0 +1,15 @@ + static::latitude(42.43, 42.45), + 'longitude' => static::longitude(19.16, 19.27), + ]; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/me_ME/Company.php b/vendor/fakerphp/faker/src/Faker/Provider/me_ME/Company.php new file mode 100644 index 00000000..2483c20f --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/me_ME/Company.php @@ -0,0 +1,49 @@ +generator->parse(static::$idNumberFormat)); + } + + /** + * @return string + * + * @example 'Ф' + */ + public function alphabet() + { + return static::randomElement(static::$alphabet); + } + + /** + * @return string + * + * @example 'Э' + */ + public function namePrefix() + { + return static::randomElement(static::$namePrefix); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/mn_MN/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/mn_MN/PhoneNumber.php new file mode 100644 index 00000000..b6706f3f --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/mn_MN/PhoneNumber.php @@ -0,0 +1,13 @@ + Townships + * @see https://en.wikipedia.org/wiki/Template:Johor > Townships + * @see https://en.wikipedia.org/wiki/Template:Kedah > Townships + * @see https://en.wikipedia.org/wiki/Template:Kelantan > Townships + * @see https://en.wikipedia.org/wiki/Template:Melaka > Townships + * @see https://en.wikipedia.org/wiki/Template:Negeri_Sembilan > Townships + * @see https://en.wikipedia.org/wiki/Template:Perak > Townships + * @see https://en.wikipedia.org/wiki/Template:Penang > Townships + * @see https://en.wikipedia.org/wiki/Template:Selangor > Townships + * @see https://en.wikipedia.org/wiki/Template:Terengganu > Townships + */ + protected static $townshipPrefix = [ + 'Alam', 'Apartment', 'Ara', + 'Bandar', 'Bandar', 'Bandar', 'Bandar', 'Bandar', 'Bandar', + 'Bandar Bukit', 'Bandar Seri', 'Bandar Sri', 'Bandar Baru', 'Batu', 'Bukit', + 'Desa', 'Damansara', + 'Kampung', 'Kampung Baru', 'Kampung Baru', 'Kondominium', 'Kota', + 'Laman', 'Lembah', + 'Medan', + 'Pandan', 'Pangsapuri', 'Petaling', 'Puncak', + 'Seri', 'Sri', + 'Taman', 'Taman', 'Taman', 'Taman', 'Taman', 'Taman', + 'Taman Desa', + ]; + protected static $townshipSuffix = [ + 'Aman', 'Amanjaya', 'Anggerik', 'Angkasa', 'Antarabangsa', 'Awan', + 'Bahagia', 'Bangsar', 'Baru', 'Belakong', 'Bendahara', 'Bestari', 'Bintang', 'Brickfields', + 'Casa', 'Changkat', 'Country Heights', + 'Damansara', 'Damai', 'Dato Harun', 'Delima', 'Duta', + 'Flora', + 'Gembira', 'Genting', + 'Harmoni', 'Hartamas', + 'Impian', 'Indah', 'Intan', + 'Jasa', 'Jaya', + 'Keramat', 'Kerinchi', 'Kiara', 'Kinrara', 'Kuchai', + 'Laksamana', + 'Mahkota', 'Maluri', 'Manggis', 'Maxwell', 'Medan', 'Melawati', 'Menjalara', 'Meru', 'Mulia', 'Mutiara', + 'Pahlawan', 'Perdana', 'Pertama', 'Permai', 'Pelangi', 'Petaling', 'Pinang', 'Puchong', 'Puteri', 'Putra', + 'Rahman', 'Rahmat', 'Raya', 'Razak', 'Ria', + 'Saujana', 'Segambut', 'Selamat', 'Selatan', 'Semarak', 'Sentosa', 'Seputeh', 'Setapak', 'Setia Jaya', 'Sinar', 'Sungai Besi', 'Sungai Buaya', 'Sungai Long', 'Suria', + 'Tasik Puteri', 'Tengah', 'Timur', 'Tinggi', 'Tropika', 'Tun Hussein Onn', 'Tun Perak', 'Tunku', + 'Ulu', 'Utama', 'Utara', + 'Wangi', + ]; + + /** + * @see https://en.wikipedia.org/wiki/Template:Greater_Kuala_Lumpur + * @see https://en.wikipedia.org/wiki/Template:Johor + * @see https://en.wikipedia.org/wiki/Template:Kedah + * @see https://en.wikipedia.org/wiki/Template:Kelantan + * @see https://en.wikipedia.org/wiki/Template:Labuan + * @see https://en.wikipedia.org/wiki/Template:Melaka + * @see https://en.wikipedia.org/wiki/Template:Negeri_Sembilan + * @see https://en.wikipedia.org/wiki/Template:Pahang + * @see https://en.wikipedia.org/wiki/Template:Perak + * @see https://en.wikipedia.org/wiki/Template:Perlis + * @see https://en.wikipedia.org/wiki/Template:Penang + * @see https://en.wikipedia.org/wiki/Template:Sabah + * @see https://en.wikipedia.org/wiki/Template:Sarawak + * @see https://en.wikipedia.org/wiki/Template:Selangor + * @see https://en.wikipedia.org/wiki/Template:Terengganu + */ + protected static $towns = [ + 'johor' => [ + 'Ayer Hitam', + 'Batu Pahat', 'Bukit Gambir', 'Bukit Kepong', 'Bukit Naning', + 'Desaru', + 'Endau', + 'Gelang Patah', 'Gemas Baharu', + 'Iskandar Puteri', + 'Jementah', 'Johor Lama', 'Johor Bahru', + 'Kempas', 'Kluang', 'Kota Iskandar', 'Kota Tinggi', 'Kukup', 'Kulai', + 'Labis ', 'Larkin', 'Layang-Layang', + 'Mersing', 'Muar', + 'Pagoh', 'Paloh', 'Parit Jawa', 'Pasir Gudang', 'Pekan Nanas', 'Permas Jaya', 'Pontian Kechil', + 'Renggam', + 'Segamat', 'Senai', 'Simpang Renggam', 'Skudai', 'Sri Gading', + 'Tangkak', 'Tebrau', + 'Ulu Tiram', + 'Yong Peng', + ], + 'kedah' => [ + 'Alor Setar', + 'Baling', 'Bukit Kayu Hitam', + 'Changlun', + 'Durian Burung', + 'Gurun', + 'Jitra', + 'Kepala Batas', 'Kuah', 'Kuala Kedah', 'Kuala Ketil', 'Kulim', + 'Langgar', 'Lunas', + 'Merbok', + 'Padang Serai', 'Pendang', + 'Serdang', 'Sintok', 'Sungai Petani', + 'Tawar, Baling', + 'Yan', + ], + 'kelantan' => [ + 'Bachok', 'Bunut Payong', + 'Dabong', + 'Gua Musang', + 'Jeli', + 'Ketereh', 'Kota Bharu', 'Kuala Krai', + 'Lojing', + 'Machang', + 'Pasir Mas', 'Pasir Puteh', + 'Rantau Panjang', + 'Salor', + 'Tok Bali', + 'Wakaf Bharu', 'Wakaf Che Yeh', + ], + 'kl' => [ + 'Ampang', + 'Bandar Tasik Selatan', 'Bandar Tun Razak', 'Bangsar', 'Batu', 'Brickfields', 'Bukit Bintang', 'Bukit Jalil', 'Bukit Tunku', + 'Cheras', 'Chow Kit', + 'Damansara Town Centre', 'Dang Wangi', 'Desa Petaling', 'Desa Tun Hussein Onn', + 'Jinjang', + 'Kampung Baru', 'Kampung Kasipillay', 'Kampung Pandan', 'Kampung Sungai Penchala', 'Kepong', 'KLCC', 'Kuchai Lama', + 'Lake Gardens', 'Lembah Pantai', + 'Medan Tuanku', 'Mid Valley City', 'Mont Kiara', + 'Pantai Dalam', 'Pudu', + 'Salak South', 'Segambut', 'Semarak', 'Sentul', 'Setapak', 'Setiawangsa', 'Seputeh', 'Sri Hartamas', 'Sri Petaling', 'Sungai Besi', + 'Taman Desa', 'Taman Melawati', 'Taman OUG', 'Taman Tun Dr Ismail', 'Taman U-Thant', 'Taman Wahyu', 'Titiwangsa', 'Tun Razak Exchange', + 'Wangsa Maju', + ], + 'labuan' => [ + 'Batu Manikar', + 'Kiamsam', + 'Layang-Layang', + 'Rancha-Rancha', + ], + 'melaka' => [ + 'Alor Gajah', + 'Bandaraya Melaka', 'Batu Berendam', 'Bukit Beruang', 'Bukit Katil', + 'Cheng', + 'Durian Tunggal', + 'Hang Tuah Jaya', + 'Jasin', + 'Klebang', + 'Lubuk China', + 'Masjid Tanah', + 'Naning', + 'Pekan Asahan', + 'Ramuan China', + 'Simpang Ampat', + 'Tanjung Bidara', 'Telok Mas', + 'Umbai', + ], + 'nsembilan' => [ + 'Ayer Kuning', 'Ampangan', + 'Bahau', 'Batang Benar', + 'Chembong', + 'Dangi', + 'Gemas', + 'Juasseh', + 'Kuala Pilah', + 'Labu', 'Lenggeng', 'Linggi', + 'Mantin', + 'Nilai', + 'Pajam', 'Pedas', 'Pengkalan Kempas', 'Port Dickson', + 'Rantau', 'Rompin', + 'Senawang', 'Seremban', 'Sungai Gadut', + 'Tampin', 'Tiroi', + ], + 'pahang' => [ + 'Bandar Tun Razak', 'Bentong', 'Brinchang', 'Bukit Fraser', 'Bukit Tinggi', + 'Chendor', + 'Gambang', 'Genting Highlands', 'Genting Sempah', + 'Jerantut', + 'Karak', 'Kemayan', 'Kota Shahbandar', 'Kuala Lipis', 'Kuala Pahang', 'Kuala Rompin', 'Kuantan', + 'Lanchang', 'Lubuk Paku', + 'Maran', 'Mengkuang', 'Mentakab', + 'Nenasi', + 'Panching', + 'Pekan', 'Penor', + 'Raub', + 'Sebertak', 'Sungai Lembing', + 'Tanah Rata', 'Tanjung Sepat', 'Tasik Chini', 'Temerloh', 'Teriang', 'Tringkap', + ], + 'penang' => [ + 'Air Itam', + 'Balik Pulau', 'Batu Ferringhi', 'Batu Kawan', 'Bayan Lepas', 'Bukit Mertajam', 'Butterworth', + 'Gelugor', 'George Town', + 'Jelutong', + 'Kepala Batas', + 'Nibong Tebal', + 'Permatang Pauh', 'Pulau Tikus', + 'Simpang Ampat', + 'Tanjung Bungah', 'Tanjung Tokong', + ], + 'perak' => [ + 'Ayer Tawar', + 'Bagan Serai', 'Batu Gajah', 'Behrang', 'Bidor', 'Bukit Gantang', 'Bukit Merah', + 'Changkat Jering', 'Chemor', 'Chenderiang', + 'Damar Laut', + 'Gerik', 'Gopeng', 'Gua Tempurung', + 'Hutan Melintang', + 'Ipoh', + 'Jelapang', + 'Kamunting', 'Kampar', 'Kuala Kangsar', + 'Lekir', 'Lenggong', 'Lumut', + 'Malim Nawar', 'Manong', 'Menglembu', + 'Pantai Remis', 'Parit', 'Parit Buntar', 'Pasir Salak', 'Proton City', + 'Simpang Pulai', 'Sitiawan', 'Slim River', 'Sungai Siput', 'Sungkai', + 'Taiping', 'Tambun', 'Tanjung Malim', 'Tanjung Rambutan', 'Tapah', 'Teluk Intan', + 'Ulu Bernam', + ], + 'perlis' => [ + 'Arau', + 'Beseri', + 'Chuping', + 'Kaki Bukit', 'Kangar', 'Kuala Perlis', + 'Mata Ayer', + 'Padang Besar', + 'Sanglang', 'Simpang Empat', + 'Wang Kelian', + ], + 'putrajaya' => [ + 'Precinct 1', 'Precinct 4', 'Precinct 5', + 'Precinct 6', 'Precinct 8', 'Precinct 10', + 'Precinct 11', 'Precinct 12', 'Precinct 13', + 'Precinct 16', 'Precinct 18', 'Precinct 19', + ], + 'sabah' => [ + 'Beaufort', 'Bingkor', + 'Donggongon', + 'Inanam', + 'Kinabatangan', 'Kota Belud', 'Kota Kinabalu', 'Kuala Penyu', 'Kimanis', 'Kundasang', + 'Lahad Datu', 'Likas', 'Lok Kawi', + 'Manggatal', + 'Nabawan', + 'Papar', 'Pitas', + 'Ranau', + 'Sandakan', 'Sapulut', 'Semporna', 'Sepanggar', + 'Tambunan', 'Tanjung Aru', 'Tawau', 'Tenom', 'Tuaran', + 'Weston', + ], + 'sarawak' => [ + 'Asajaya', + 'Ba\'kelalan', 'Bario', 'Batu Kawa', 'Batu Niah', 'Betong', 'Bintulu', + 'Dalat', 'Daro', + 'Engkilili', + 'Julau', + 'Kapit', 'Kota Samarahan', 'Kuching', + 'Lawas', 'Limbang', 'Lubok Antu', + 'Marudi', 'Matu', 'Miri', + 'Oya', + 'Pakan', + 'Sadong Jaya', 'Sematan', 'Sibu', 'Siburan', 'Song', 'Sri Aman', 'Sungai Tujoh', + 'Tanjung Kidurong', 'Tanjung Manis', 'Tatau', + ], + 'selangor' => [ + 'Ampang', 'Assam Jawa', + 'Balakong', 'Bandar Baru Bangi', 'Bandar Baru Selayang', 'Bandar Sunway', 'Bangi', 'Banting', 'Batang Kali', 'Batu Caves', 'Bestari Jaya', 'Bukit Lanjan', + 'Cheras', 'Cyberjaya', + 'Damansara', 'Dengkil', + 'Ijok', + 'Jenjarom', + 'Kajang', 'Kelana Jaya', 'Klang', 'Kuala Kubu Bharu', 'Kuala Selangor', 'Kuang', + 'Lagong', + 'Morib', + 'Pandamaran', 'Paya Jaras', 'Petaling Jaya', 'Port Klang', 'Puchong', + 'Rasa', 'Rawang', + 'Salak Tinggi', 'Sekinchan', 'Selayang', 'Semenyih', 'Sepang', 'Serendah', 'Seri Kembangan', 'Shah Alam', 'Subang', 'Subang Jaya', 'Sungai Buloh', + 'Tanjung Karang', 'Tanjung Sepat', + 'Ulu Klang', 'Ulu Yam', + ], + 'terengganu' => [ + 'Ajil', + 'Bandar Ketengah Jaya', 'Bandar Permaisuri', 'Bukit Besi', 'Bukit Payong', + 'Chukai', + 'Jerteh', + 'Kampung Raja', 'Kerteh', 'Kijal', 'Kuala Besut', 'Kuala Berang', 'Kuala Dungun', 'Kuala Terengganu', + 'Marang', 'Merchang', + 'Pasir Raja', + 'Rantau Abang', + 'Teluk Kalung', + 'Wakaf Tapai', + ], + ]; + + /** + * @see https://en.wikipedia.org/wiki/States_and_federal_territories_of_Malaysia + */ + protected static $states = [ + 'johor' => [ + 'Johor Darul Ta\'zim', + 'Johor', + ], + 'kedah' => [ + 'Kedah Darul Aman', + 'Kedah', + ], + 'kelantan' => [ + 'Kelantan Darul Naim', + 'Kelantan', + ], + 'kl' => [ + 'KL', + 'Kuala Lumpur', + 'WP Kuala Lumpur', + ], + 'labuan' => [ + 'Labuan', + ], + 'melaka' => [ + 'Malacca', + 'Melaka', + ], + 'nsembilan' => [ + 'Negeri Sembilan Darul Khusus', + 'Negeri Sembilan', + ], + 'pahang' => [ + 'Pahang Darul Makmur', + 'Pahang', + ], + 'penang' => [ + 'Penang', + 'Pulau Pinang', + ], + 'perak' => [ + 'Perak Darul Ridzuan', + 'Perak', + ], + 'perlis' => [ + 'Perlis Indera Kayangan', + 'Perlis', + ], + 'putrajaya' => [ + 'Putrajaya', + ], + 'sabah' => [ + 'Sabah', + ], + 'sarawak' => [ + 'Sarawak', + ], + 'selangor' => [ + 'Selangor Darul Ehsan', + 'Selangor', + ], + 'terengganu' => [ + 'Terengganu Darul Iman', + 'Terengganu', + ], + ]; + + /** + * @see https://ms.wikipedia.org/wiki/Senarai_negara_berdaulat + */ + protected static $country = [ + 'Abkhazia', 'Afghanistan', 'Afrika Selatan', 'Republik Afrika Tengah', 'Akrotiri dan Dhekelia', 'Albania', 'Algeria', 'Amerika Syarikat', 'Andorra', 'Angola', 'Antigua dan Barbuda', 'Arab Saudi', 'Argentina', 'Armenia', 'Australia', 'Austria', 'Azerbaijan', + 'Bahamas', 'Bahrain', 'Bangladesh', 'Barbados', 'Belanda', 'Belarus', 'Belgium', 'Belize', 'Benin', 'Bhutan', 'Bolivia', 'Bonaire', 'Bosnia dan Herzegovina', 'Botswana', 'Brazil', 'Brunei Darussalam', 'Bulgaria', 'Burkina Faso', 'Burundi', + 'Cameroon', 'Chad', 'Chile', 'Republik Rakyat China', 'Republik China di Taiwan', 'Colombia', 'Comoros', 'Republik Demokratik Congo', 'Republik Congo', 'Kepulauan Cook', 'Costa Rica', 'Côte d\'Ivoire (Ivory Coast)', 'Croatia', 'Cuba', 'Curaçao', 'Cyprus', 'Republik Turki Cyprus Utara', 'Republik Czech', + 'Denmark', 'Djibouti', 'Dominika', 'Republik Dominika', + 'Ecuador', 'El Salvador', 'Emiriah Arab Bersatu', 'Eritrea', 'Estonia', + 'Kepulauan Faroe', 'Fiji', 'Filipina', 'Finland', + 'Gabon', 'Gambia', 'Georgia', 'Ghana', 'Grenada', 'Greece (Yunani)', 'Guatemala', 'Guinea', 'Guinea-Bissau', 'Guinea Khatulistiwa', 'Guiana Perancis', 'Guyana', + 'Habsyah (Etiopia)', 'Haiti', 'Honduras', 'Hungary', + 'Iceland', 'India', 'Indonesia', 'Iran', 'Iraq', 'Ireland', 'Israel', 'Itali', + 'Jamaika', 'Jepun', 'Jerman', 'Jordan', + 'Kanada', 'Kazakhstan', 'Kemboja', 'Kenya', 'Kiribati', 'Korea Selatan', 'Korea Utara', 'Kosovo', 'Kuwait', 'Kyrgyzstan', + 'Laos', 'Latvia', 'Lesotho', 'Liberia', 'Libya', 'Liechtenstein', 'Lithuania', 'Lubnan', 'Luxembourg', + 'Macedonia', 'Madagaskar', 'Maghribi', 'Malawi', 'Malaysia', 'Maldives', 'Mali', 'Malta', 'Kepulauan Marshall', 'Mauritania', 'Mauritius', 'Mesir', 'Mexico', 'Persekutuan Micronesia', 'Moldova', 'Monaco', 'Montenegro', 'Mongolia', 'Mozambique', 'Myanmar', + 'Namibia', 'Nauru', 'Nepal', 'New Zealand', 'Nicaragua', 'Niger', 'Nigeria', 'Niue', 'Norway', + 'Oman', 'Ossetia Selatan', + 'Pakistan', 'Palau', 'Palestin', 'Panama', 'Papua New Guinea', 'Paraguay', 'Perancis', 'Peru', 'Poland', 'Portugal', + 'Qatar', + 'Romania', 'Russia', 'Rwanda', + 'Sahara Barat', 'Saint Kitts dan Nevis', 'Saint Lucia', 'Saint Vincent dan Grenadines', 'Samoa', 'San Marino', 'São Tomé dan Príncipe', 'Scotland', 'Senegal', 'Sepanyol', 'Serbia', 'Seychelles', 'Sierra Leone', 'Singapura', 'Slovakia', 'Slovenia', 'Kepulauan Solomon', 'Somalia', 'Somaliland', 'Sri Lanka', 'Sudan', 'Sudan Selatan', 'Suriname', 'Swaziland', 'Sweden', 'Switzerland', 'Syria', + 'Tajikistan', 'Tanjung Verde', 'Tanzania', 'Thailand', 'Timor Leste', 'Togo', 'Tonga', 'Transnistria', 'Trinidad dan Tobago', 'Tunisia', 'Turki', 'Turkmenistan', 'Tuvalu', + 'Uganda', 'Ukraine', 'United Kingdom', 'Uruguay', 'Uzbekistan', + 'Vanuatu', 'Kota Vatican', 'Venezuela', 'Vietnam', + 'Yaman', + 'Zambia', 'Zimbabwe', + ]; + + /** + * Return a building prefix + * + * @example 'No.' + * + * @return string + */ + public static function buildingPrefix() + { + return static::randomElement(static::$buildingPrefix); + } + + /** + * Return a building number + * + * @example '123' + * + * @return string + */ + public static function buildingNumber() + { + return static::toUpper(static::lexify(static::numerify(static::randomElement(static::$buildingNumber)))); + } + + /** + * Return a street prefix + * + * @example 'Jalan' + */ + public function streetPrefix() + { + $format = static::randomElement(static::$streetPrefix); + + return $this->generator->parse($format); + } + + /** + * Return a complete streename + * + * @example 'Jalan Utama 7' + * + * @return string + */ + public function streetName() + { + $format = static::toUpper(static::lexify(static::numerify(static::randomElement(static::$streetNameFormats)))); + + return $this->generator->parse($format); + } + + /** + * Return a randown township + * + * @example Taman Bahagia + * + * @return string + */ + public function township() + { + $format = static::toUpper(static::lexify(static::numerify(static::randomElement(static::$townshipFormats)))); + + return $this->generator->parse($format); + } + + /** + * Return a township prefix abbreviation + * + * @example 'USJ' + * + * @return string + */ + public function townshipPrefixAbbr() + { + return static::randomElement(static::$townshipPrefixAbbr); + } + + /** + * Return a township prefix + * + * @example 'Taman' + * + * @return string + */ + public function townshipPrefix() + { + return static::randomElement(static::$townshipPrefix); + } + + /** + * Return a township suffix + * + * @example 'Bahagia' + */ + public function townshipSuffix() + { + return static::randomElement(static::$townshipSuffix); + } + + /** + * Return a postcode based on state + * + * @example '55100' + * + * @see https://en.wikipedia.org/wiki/Postal_codes_in_Malaysia#States + * + * @param string|null $state 'state' or null + * + * @return string + */ + public static function postcode($state = null) + { + $format = [ + 'perlis' => [ // (01000 - 02800) + '0' . self::numberBetween(1000, 2800), + ], + 'kedah' => [ // (05000 - 09810) + '0' . self::numberBetween(5000, 9810), + ], + 'penang' => [ // (10000 - 14400) + self::numberBetween(10000, 14400), + ], + 'kelantan' => [ // (15000 - 18500) + self::numberBetween(15000, 18500), + ], + 'terengganu' => [ // (20000 - 24300) + self::numberBetween(20000, 24300), + ], + 'pahang' => [ // (25000 - 28800 | 39000 - 39200 | 49000, 69000) + self::numberBetween(25000, 28800), + self::numberBetween(39000, 39200), + self::numberBetween(49000, 69000), + ], + 'perak' => [ // (30000 - 36810) + self::numberBetween(30000, 36810), + ], + 'selangor' => [ // (40000 - 48300 | 63000 - 68100) + self::numberBetween(40000, 48300), + self::numberBetween(63000, 68100), + ], + 'kl' => [ // (50000 - 60000) + self::numberBetween(50000, 60000), + ], + 'putrajaya' => [ // (62000 - 62988) + self::numberBetween(62000, 62988), + ], + 'nsembilan' => [ // (70000 - 73509) + self::numberBetween(70000, 73509), + ], + 'melaka' => [ // (75000 - 78309) + self::numberBetween(75000, 78309), + ], + 'johor' => [ // (79000 - 86900) + self::numberBetween(79000, 86900), + ], + 'labuan' => [ // (87000 - 87033) + self::numberBetween(87000, 87033), + ], + 'sabah' => [ // (88000 - 91309) + self::numberBetween(88000, 91309), + ], + 'sarawak' => [ // (93000 - 98859) + self::numberBetween(93000, 98859), + ], + ]; + + $postcode = null === $state ? static::randomElement($format) : $format[$state]; + + return (string) static::randomElement($postcode); + } + + /** + * Return the complete town address with matching postcode and state + * + * @example 55100 Bukit Bintang, Kuala Lumpur + * + * @return string + */ + public function townState() + { + $state = static::randomElement(array_keys(static::$states)); + $postcode = static::postcode($state); + $town = static::randomElement(static::$towns[$state]); + $state = static::randomElement(static::$states[$state]); + + return $postcode . ' ' . $town . ', ' . $state; + } + + /** + * Return a random city (town) + * + * @example 'Ampang' + * + * @return string + */ + public function city() + { + $state = static::randomElement(array_keys(static::$towns)); + + return static::randomElement(static::$towns[$state]); + } + + /** + * Return a random state + * + * @example 'Johor' + * + * @return string + */ + public function state() + { + $state = static::randomElement(array_keys(static::$states)); + + return static::randomElement(static::$states[$state]); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/Company.php b/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/Company.php new file mode 100644 index 00000000..4dc8b2cb --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/Company.php @@ -0,0 +1,105 @@ +generator->parse($formats); + } + + /** + * Return Peninsular prefix alphabet + * + * @example 'W' + * + * @return string + */ + public static function peninsularPrefix() + { + return static::randomElement(static::$peninsularPrefix); + } + + /** + * Return Sarawak state prefix alphabet + * + * @example 'QA' + * + * @return string + */ + public static function sarawakPrefix() + { + return static::randomElement(static::$sarawakPrefix); + } + + /** + * Return Sabah state prefix alphabet + * + * @example 'SA' + * + * @return string + */ + public static function sabahPrefix() + { + return static::randomElement(static::$sabahPrefix); + } + + /** + * Return specialty licence plate prefix + * + * @example 'G1M' + * + * @return string + */ + public static function specialPrefix() + { + return static::randomElement(static::$specialPrefix); + } + + /** + * Return a valid license plate alphabet + * + * @example 'A' + * + * @return string + */ + public static function validAlphabet() + { + return static::randomElement(static::$validAlphabets); + } + + /** + * Return a valid number sequence between 1 and 9999 + * + * @example '1234' + * + * @return int + */ + public static function numberSequence() + { + return self::numberBetween(1, 9999); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/Payment.php b/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/Payment.php new file mode 100644 index 00000000..b64c2bbd --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/Payment.php @@ -0,0 +1,244 @@ +generator->parse($formats); + } + + /** + * Return a Malaysian Bank account number + * + * @example '1234567890123456' + * + * @return string + */ + public function bankAccountNumber() + { + $formats = static::randomElement(static::$bankAccountNumberFormats); + + return static::numerify($formats); + } + + /** + * Return a Malaysian Local Bank + * + * @example 'Public Bank' + * + * @return string + */ + public static function localBank() + { + return static::randomElement(static::$localBanks); + } + + /** + * Return a Malaysian Foreign Bank + * + * @example 'Citibank Berhad' + * + * @return string + */ + public static function foreignBank() + { + return static::randomElement(static::$foreignBanks); + } + + /** + * Return a Malaysian Government Bank + * + * @example 'Bank Simpanan Nasional' + * + * @return string + */ + public static function governmentBank() + { + return static::randomElement(static::$governmentBanks); + } + + /** + * Return a Malaysian insurance company + * + * @example 'AIA Malaysia' + * + * @return string + */ + public static function insurance() + { + return static::randomElement(static::$insuranceCompanies); + } + + /** + * Return a Malaysian Bank SWIFT Code + * + * @example 'MBBEMYKLXXX' + * + * @return string + */ + public static function swiftCode() + { + return static::toUpper(static::lexify(static::randomElement(static::$swiftCodes))); + } + + /** + * Return the Malaysian currency symbol + * + * @example 'RM' + * + * @return string + */ + public static function currencySymbol() + { + return static::randomElement(static::$currencySymbol); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/Person.php b/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/Person.php new file mode 100644 index 00000000..d685715d --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/Person.php @@ -0,0 +1,812 @@ +generator->parse(static::randomElement($formats)); + } + + /** + * Return a Malaysian I.C. No. + * + * @example '890123-45-6789' + * + * @see https://en.wikipedia.org/wiki/Malaysian_identity_card#Structure_of_the_National_Registration_Identity_Card_Number_(NRIC) + * + * @param string|null $gender 'male', 'female' or null for any + * @param bool|string|null $hyphen true, false, or any separator characters + * + * @return string + */ + public static function myKadNumber($gender = null, $hyphen = false) + { + // year of birth + $yy = self::numberBetween(0, 99); + + // month of birth + $mm = DateTime::month(); + + // day of birth + $dd = DateTime::dayOfMonth(); + + // place of birth (1-59 except 17-20) + while (in_array($pb = self::numberBetween(1, 59), [17, 18, 19, 20], false)) { + } + + // random number + $nnn = self::numberBetween(0, 999); + + // gender digit. Odd = MALE, Even = FEMALE + $g = self::numberBetween(0, 9); + + //Credit: https://gist.github.com/mauris/3629548 + if ($gender === static::GENDER_MALE) { + $g = $g | 1; + } elseif ($gender === static::GENDER_FEMALE) { + $g = $g & ~1; + } + + // formatting with hyphen + if ($hyphen === true) { + $hyphen = '-'; + } elseif ($hyphen === false) { + $hyphen = ''; + } + + return sprintf('%02d%02d%02d%s%02d%s%03d%01d', $yy, $mm, $dd, $hyphen, $pb, $hyphen, $nnn, $g); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/PhoneNumber.php new file mode 100644 index 00000000..7cce02fa --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ms_MY/PhoneNumber.php @@ -0,0 +1,217 @@ +generator->parse($format)); + } + + return static::numerify($this->generator->parse($format)); + } + + /** + * Return prefix digits for 011 numbers + * + * @example '10' + * + * @return string + */ + public static function zeroOneOnePrefix() + { + return static::numerify(static::randomElement(static::$zeroOneOnePrefix)); + } + + /** + * Return prefix digits for 014 numbers + * + * @example '2' + * + * @return string + */ + public static function zeroOneFourPrefix() + { + return static::numerify(static::randomElement(static::$zeroOneFourPrefix)); + } + + /** + * Return prefix digits for 015 numbers + * + * @example '1' + * + * @return string + */ + public static function zeroOneFivePrefix() + { + return static::numerify(static::randomElement(static::$zeroOneFivePrefix)); + } + + /** + * Return a Malaysian Fixed Line Phone Number. + * + * @example '+603-4567-8912' + * + * @param bool $countryCodePrefix true, false + * @param bool $formatting true, false + * + * @return string + */ + public function fixedLineNumber($countryCodePrefix = true, $formatting = true) + { + if ($formatting) { + $format = static::randomElement(static::$fixedLineNumberFormatsWithFormatting); + } else { + $format = static::randomElement(static::$fixedLineNumberFormats); + } + + if ($countryCodePrefix) { + return static::countryCodePrefix($formatting) . static::numerify($this->generator->parse($format)); + } + + return static::numerify($this->generator->parse($format)); + } + + /** + * Return a Malaysian VoIP Phone Number. + * + * @example '+6015-678-9234' + * + * @param bool $countryCodePrefix true, false + * @param bool $formatting true, false + * + * @return string + */ + public function voipNumber($countryCodePrefix = true, $formatting = true) + { + if ($formatting) { + $format = static::randomElement(static::$voipNumberWithFormatting); + } else { + $format = static::randomElement(static::$voipNumber); + } + + if ($countryCodePrefix) { + return static::countryCodePrefix($formatting) . static::numerify($this->generator->parse($format)); + } + + return static::numerify($this->generator->parse($format)); + } + + /** + * Return a Malaysian Country Code Prefix. + * + * @example '+6' + * + * @param bool $formatting true, false + * + * @return string + */ + public static function countryCodePrefix($formatting = true) + { + if ($formatting) { + return static::randomElement(static::$plusSymbol) . static::randomElement(static::$countryCodePrefix); + } + + return static::randomElement(static::$countryCodePrefix); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/nb_NO/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/nb_NO/Address.php new file mode 100644 index 00000000..cbc39d7b --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/nb_NO/Address.php @@ -0,0 +1,197 @@ +format('dmy'); + + /** + * @todo These number should be random based on birth year + * + * @see http://no.wikipedia.org/wiki/F%C3%B8dselsnummer + */ + $randomDigits = (string) static::numerify('##'); + + switch ($gender) { + case static::GENDER_MALE: + $genderDigit = static::randomElement([1, 3, 5, 7, 9]); + + break; + + case static::GENDER_FEMALE: + $genderDigit = static::randomElement([0, 2, 4, 6, 8]); + + break; + + default: + $genderDigit = (string) static::numerify('#'); + } + + $digits = $datePart . $randomDigits . $genderDigit; + + /** + * @todo Calculate modulo 11 of $digits + * + * @see http://no.wikipedia.org/wiki/F%C3%B8dselsnummer + */ + $checksum = (string) static::numerify('##'); + + return $digits . $checksum; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/nb_NO/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/nb_NO/PhoneNumber.php new file mode 100644 index 00000000..4767db48 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/nb_NO/PhoneNumber.php @@ -0,0 +1,41 @@ +generator->parse($format)); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ne_NP/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/ne_NP/Address.php new file mode 100644 index 00000000..59b31de4 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ne_NP/Address.php @@ -0,0 +1,131 @@ +format('ymd')); + $help = $date->format('Y') >= 2000 ? 2 : null; + + $check = (int) ($help . $dob . $middle); + $rest = sprintf('%02d', 97 - ($check % 97)); + + return $dob . $middle . $rest; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/nl_BE/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/nl_BE/PhoneNumber.php new file mode 100644 index 00000000..9e4a3917 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/nl_BE/PhoneNumber.php @@ -0,0 +1,20 @@ +generator->lastName(); + + break; + } + + if (Miscellaneous::boolean()) { + return $companyName . ' ' . static::randomElement(static::$companySuffix); + } + + return $companyName; + } + + /** + * Belasting Toegevoegde Waarde (BTW) = VAT + * + * @example 'NL123456789B01' + * + * @see https://www.belastingdienst.nl/wps/wcm/connect/bldcontentnl/belastingdienst/zakelijk/btw/administratie_bijhouden/btw_nummers_controleren/uw_btw_nummer + * + * @return string VAT Number + */ + public static function vat() + { + return sprintf('%s%d%s%d', 'NL', self::randomNumber(9, true), 'B', self::randomNumber(2, true)); + } + + /** + * Alias dutch vat number format + * + * @return string + */ + public static function btw() + { + return self::vat(); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/nl_NL/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/nl_NL/Internet.php new file mode 100644 index 00000000..bf30e795 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/nl_NL/Internet.php @@ -0,0 +1,9 @@ + 9) { + if ($nr[1] > 0) { + $nr[0] = 8; + --$nr[1]; + } else { + $nr[0] = 1; + ++$nr[1]; + } + } + + return implode('', array_reverse($nr)); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/nl_NL/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/nl_NL/PhoneNumber.php new file mode 100644 index 00000000..5d4163a0 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/nl_NL/PhoneNumber.php @@ -0,0 +1,39 @@ + ['D', 'V'], + 'kujawsko-pomorskie' => ['C'], + 'lubelskie' => ['L'], + 'lubuskie' => ['F'], + 'łódzkie' => ['E'], + 'małopolskie' => ['K', 'J'], + 'mazowieckie' => ['W', 'A'], + 'opolskie' => ['O'], + 'podkarpackie' => ['R', 'Y'], + 'podlaskie' => ['B'], + 'pomorskie' => ['G', 'X'], + 'śląskie' => ['S', 'I'], + 'świętokrzyskie' => ['T'], + 'warmińsko-mazurskie' => ['N'], + 'wielkopolskie' => ['P', 'M'], + 'zachodniopomorskie' => ['Z'], + ]; + + /** + * @var array list of special vehicle registration number prefixes. + */ + protected static $specials = [ + 'army' => ['U'], + 'services' => ['H'], + ]; + + /** + * @var array list of Polish counties and respective vehicle registration number prefixes. + */ + protected static $counties = [ + 'dolnośląskie' => [ + 'Jelenia Góra' => ['J'], + 'Legnica' => ['L'], + 'Wałbrzych' => ['B'], + 'Wrocław' => ['W', 'X'], + 'bolesławiecki' => ['BL'], + 'dzierżoniowski' => ['DZ'], + 'głogowski' => ['GL'], + 'górowski' => ['GR'], + 'jaworski' => ['JA'], + 'jeleniogórski' => ['JE'], + 'kamiennogórski' => ['KA'], + 'kłodzki' => ['KL'], + 'legnicki' => ['LE'], + 'lubański' => ['LB'], + 'lubiński' => ['LU'], + 'lwówecki' => ['LW'], + 'milicki' => ['MI'], + 'oleśnicki' => ['OL'], + 'oławski' => ['OA'], + 'polkowicki' => ['PL'], + 'strzeliński' => ['ST'], + 'średzki' => ['SR'], + 'świdnicki' => ['SW'], + 'trzebnicki' => ['TR'], + 'wałbrzyski' => ['BA'], + 'wołowski' => ['WL'], + 'wrocławski' => ['WR'], + 'ząbkowicki' => ['ZA'], + 'zgorzelecki' => ['ZG'], + 'złotoryjski' => ['ZL'], + ], + 'kujawsko-pomorskie' => [ + 'Bydgoszcz' => ['B'], + 'Grudziądz' => ['G'], + 'Toruń' => ['T'], + 'Włocławek' => ['W'], + 'aleksandrowski' => ['AL'], + 'brodnicki' => ['BR'], + 'bydgoski' => ['BY'], + 'chełmiński' => ['CH'], + 'golubsko-dobrzyński' => ['GD'], + 'grudziądzki' => ['GR'], + 'inowrocławski' => ['IN'], + 'lipnowski' => ['LI'], + 'mogileński' => ['MG'], + 'nakielski' => ['NA'], + 'radziejowski' => ['RA'], + 'rypiński' => ['RY'], + 'sępoleński' => ['SE'], + 'świecki' => ['SW'], + 'toruński' => ['TR'], + 'tucholski' => ['TU'], + 'wąbrzeski' => ['WA'], + 'włocławski' => ['WL'], + 'żniński' => ['ZN'], + ], + 'lubelskie' => [ + 'Biała Podlaska' => ['B'], + 'Chełm' => ['C'], + 'Lublin' => ['U'], + 'Zamość' => ['Z'], + 'bialski' => ['BI'], + 'biłgorajski' => ['BL'], + 'chełmski' => ['CH'], + 'hrubieszowski' => ['HR'], + 'janowski' => ['JA'], + 'krasnostawski' => ['KS'], + 'kraśnicki' => ['KR'], + 'lubartowski' => ['LB'], + 'lubelski' => ['UB'], + 'łęczyński' => ['LE'], + 'łukowski' => ['LU'], + 'opolski' => ['OP'], + 'parczewski' => ['PA'], + 'puławski' => ['PU'], + 'radzyński' => ['RA'], + 'rycki' => ['RY'], + 'świdnicki' => ['SW'], + 'tomaszowski' => ['TM'], + 'włodawski' => ['WL'], + 'zamojski' => ['ZA'], + ], + 'lubuskie' => [ + 'Gorzów Wielkopolski' => ['G'], + 'Zielona Góra' => ['Z'], + 'gorzowski' => ['GW'], + 'krośnieński' => ['KR'], + 'międzyrzecki' => ['MI'], + 'nowosolski' => ['NW'], + 'słubicki' => ['SL'], + 'strzelecko-drezdenecki' => ['SD'], + 'sulęciński' => ['SU'], + 'świebodziński' => ['SW'], + 'wschowski' => ['WS'], + 'zielonogórski' => ['ZI'], + 'żagański' => ['ZG'], + 'żarski' => ['ZA'], + ], + 'łódzkie' => [ + 'Łódź' => ['L', 'D'], + 'Piotrków Trybunalski' => ['P'], + 'Skierniewice' => ['S'], + 'brzeziński' => ['BR'], + 'bełchatowski' => ['BE'], + 'kutnowski' => ['KU'], + 'łaski' => ['LA'], + 'łęczycki' => ['LE'], + 'łowicki' => ['LC'], + 'łódzki wschodni' => ['LW'], + 'opoczyński' => ['OP'], + 'pabianicki' => ['PA'], + 'pajęczański' => ['PJ'], + 'piotrkowski' => ['PI'], + 'poddębicki' => ['PD'], + 'radomszczański' => ['RA'], + 'rawski' => ['RW'], + 'sieradzki' => ['SI'], + 'skierniewicki' => ['SK'], + 'tomaszowski' => ['TM'], + 'wieluński' => ['WI'], + 'wieruszowski' => ['WE'], + 'zduńskowolski' => ['ZD'], + 'zgierski' => ['ZG'], + ], + 'małopolskie' => [ + 'Kraków' => ['R', 'K'], + 'Nowy Sącz' => ['N'], + 'Tarnów' => ['T'], + 'bocheński' => ['BA', 'BC'], + 'brzeski' => ['BR'], + 'chrzanowski' => ['CH'], + 'dąbrowski' => ['DA'], + 'gorlicki' => ['GR'], + 'krakowski' => ['RA', 'RK'], + 'limanowski' => ['LI'], + 'miechowski' => ['MI'], + 'myślenicki' => ['MY'], + 'nowosądecki' => ['NS'], + 'nowotarski' => ['NT'], + 'olkuski' => ['OL'], + 'oświęcimski' => ['OS'], + 'proszowicki' => ['PR'], + 'suski' => ['SU'], + 'tarnowski' => ['TA'], + 'tatrzański' => ['TT'], + 'wadowicki' => ['WA'], + 'wielicki' => ['WI'], + ], + 'mazowieckie' => [ + 'Ostrołęka' => ['O'], + 'Płock' => ['P'], + 'Radom' => ['R'], + 'Siedlce' => ['S'], + 'białobrzeski' => ['BR'], + 'ciechanowski' => ['CI'], + 'garwoliński' => ['G'], + 'gostyniński' => ['GS'], + 'grodziski' => ['GM'], + 'grójecki' => ['GR'], + 'kozienicki' => ['KZ'], + 'legionowski' => ['L'], + 'lipski' => ['LI'], + 'łosicki' => ['LS'], + 'makowski' => ['MA'], + 'miński' => ['M'], + 'mławski' => ['ML'], + 'nowodworski' => ['ND'], + 'ostrołęcki' => ['OS'], + 'ostrowski' => ['OR'], + 'otwocki' => ['OT'], + 'piaseczyński' => ['PA', 'PI', 'PW', 'PX'], + 'płocki' => ['PL'], + 'płoński' => ['PN'], + 'pruszkowski' => ['PP', 'PR', 'PS'], + 'przasnyski' => ['PZ'], + 'przysuski' => ['PY'], + 'pułtuski' => ['PU'], + 'radomski' => ['RA'], + 'siedlecki' => ['SI'], + 'sierpecki' => ['SE'], + 'sochaczewski' => ['SC'], + 'sokołowski' => ['SK'], + 'szydłowiecki' => ['SZ'], + 'warszawski' => ['A', 'B', 'D', 'E', 'F', 'H', 'I', 'J', 'K', 'N', 'T', 'U', 'W', 'X', 'Y'], + 'warszawski zachodni' => ['Z'], + 'węgrowski' => ['WE'], + 'wołomiński' => ['WL', 'V'], + 'wyszkowski' => ['WY'], + 'zwoleński' => ['ZW'], + 'żuromiński' => ['ZU'], + 'żyrardowski' => ['ZY'], + ], + 'opolskie' => [ + 'Opole' => ['P'], + 'brzeski' => ['B'], + 'głubczycki' => ['GL'], + 'kędzierzyńsko-kozielski' => ['K'], + 'kluczborski' => ['KL'], + 'krapkowicki' => ['KR'], + 'namysłowski' => ['NA'], + 'nyski' => ['NY'], + 'oleski' => ['OL'], + 'opolski' => ['PO'], + 'prudnicki' => ['PR'], + 'strzelecki' => ['ST'], + ], + 'podkarpackie' => [ + 'Krosno' => ['K'], + 'Przemyśl' => ['P'], + 'Rzeszów' => ['Z'], + 'Tarnobrzeg' => ['T'], + 'bieszczadzki' => ['BI'], + 'brzozowski' => ['BR'], + 'dębicki' => ['DE'], + 'jarosławski' => ['JA'], + 'jasielski' => ['JS'], + 'kolbuszowski' => ['KL'], + 'krośnieński' => ['KR'], + 'leski' => ['LS'], + 'leżajski' => ['LE'], + 'lubaczowski' => ['LU'], + 'łańcucki' => ['LA'], + 'mielecki' => ['MI'], + 'niżański' => ['NI'], + 'przemyski' => ['PR'], + 'przeworski' => ['PZ'], + 'ropczycko-sędziszowski' => ['RS'], + 'rzeszowski' => ['ZE', 'ZR', 'ZZ'], + 'sanocki' => ['SA'], + 'stalowowolski' => ['ST'], + 'strzyżowski' => ['SR'], + 'tarnobrzeski' => ['TA'], + ], + 'podlaskie' => [ + 'Białystok' => ['I'], + 'Łomża' => ['L'], + 'Suwałki' => ['S'], + 'augustowski' => ['AU'], + 'białostocki' => ['IA', 'IB'], + 'bielski' => ['BI'], + 'grajewski' => ['GR'], + 'hajnowski' => ['HA'], + 'kolneński' => ['KL'], + 'łomżyński' => ['LM'], + 'moniecki' => ['MN'], + 'sejneński' => ['SE'], + 'siemiatycki' => ['SI'], + 'sokólski' => ['SK'], + 'suwalski' => ['SU'], + 'wysokomazowiecki' => ['WM'], + 'zambrowski' => ['ZA'], + ], + 'pomorskie' => [ + 'Gdańsk' => ['D'], + 'Gdynia' => ['A'], + 'Słupsk' => ['S'], + 'Sopot' => ['SP'], + 'bytowski' => ['BY'], + 'chojnicki' => ['CH'], + 'człuchowski' => ['CZ'], + 'gdański' => ['DA'], + 'kartuski' => ['KA', 'KY', 'KZ'], + 'kościerski' => ['KS'], + 'kwidzyński' => ['KW'], + 'lęborski' => ['LE'], + 'malborski' => ['MB'], + 'nowodworski' => ['ND'], + 'pucki' => ['PU'], + 'słupski' => ['SL'], + 'starogardzki' => ['ST'], + 'sztumski' => ['SZ'], + 'tczewski' => ['TC'], + 'wejherowski' => ['WE', 'WO'], + ], + 'śląskie' => [ + 'Bielsko-Biała' => ['B'], + 'Bytom' => ['Y'], + 'Chorzów' => ['H'], + 'Częstochowa' => ['C'], + 'Dąbrowa Górnicza' => ['D'], + 'Gliwice' => ['G'], + 'Jastrzębie-Zdrój' => ['JZ'], + 'Jaworzno' => ['J'], + 'Katowice' => ['K'], + 'Mysłowice' => ['M'], + 'Piekary Śląskie' => ['PI'], + 'Ruda Śląska,' => ['L', 'RS'], + 'Rybnik' => ['R'], + 'Siemianowice Śląskie' => ['I'], + 'Sosnowiec' => ['O'], + 'Świętochłowice' => ['W'], + 'Tychy' => ['T'], + 'Zabrze' => ['Z'], + 'Żory' => ['ZO'], + 'będziński' => ['BE', 'BN', 'E'], + 'bielski' => ['BI'], + 'cieszyński' => ['CI', 'CN'], + 'częstochowski' => ['CZ'], + 'gliwicki' => ['GL'], + 'kłobucki' => ['KL'], + 'lubliniecki' => ['LU'], + 'mikołowski' => ['MI'], + 'myszkowski' => ['MY'], + 'pszczyński' => ['PS'], + 'raciborski' => ['RC'], + 'rybnicki' => ['RB'], + 'tarnogórski' => ['TA'], + 'bieruńsko - lędziński' => ['BL'], + 'wodzisławski' => ['WD', 'WZ'], + 'zawierciański' => ['ZA'], + 'żywiecki' => ['ZY'], + ], + 'świętokrzyskie' => [ + 'Kielce' => ['K'], + 'buski' => ['BU'], + 'jędrzejowski' => ['JE'], + 'kazimierski' => ['KA'], + 'kielecki' => ['KI'], + 'konecki' => ['KN'], + 'opatowski' => ['OP'], + 'ostrowiecki' => ['OS'], + 'pińczowski' => ['PI'], + 'sandomierski' => ['SA'], + 'skarżyski' => ['SK'], + 'starachowicki' => ['ST'], + 'staszowski' => ['SZ'], + 'włoszczowski' => ['LW'], + ], + 'warmińsko-mazurskie' => [ + 'Elbląg' => ['E'], + 'Olsztyn' => ['O'], + 'bartoszycki' => ['BA'], + 'braniewski' => ['BR'], + 'działdowski' => ['DZ'], + 'elbląski' => ['EB'], + 'ełcki' => ['EL'], + 'giżycki' => ['GI'], + 'iławski' => ['IL'], + 'kętrzyński' => ['KE'], + 'lidzbarski' => ['LI'], + 'mrągowski' => ['MR'], + 'nidzicki' => ['NI'], + 'nowomiejski' => ['NM'], + 'olecki' => ['OE'], + 'gołdapski' => ['GO'], + 'olsztyński' => ['OL'], + 'ostródzki' => ['OS'], + 'piski' => ['PI'], + 'szczycieński' => ['SZ'], + 'węgorzewski' => ['WE'], + ], + 'wielkopolskie' => [ + 'Kalisz' => ['A', 'K'], + 'Konin' => ['KO', 'N'], + 'Leszno' => ['L'], + 'Poznań' => ['O', 'Y'], + 'chodzieski' => ['CH'], + 'czarnkowsko-trzcianecki' => ['CT'], + 'gnieźnieński' => ['GN'], + 'gostyński' => ['GS'], + 'grodziski' => ['GO'], + 'jarociński' => ['JA'], + 'kaliski' => ['KA'], + 'kępiński' => ['KE'], + 'kolski' => ['KL'], + 'koniński' => ['KN'], + 'kościański' => ['KS'], + 'krotoszyński' => ['KR'], + 'leszczyński' => ['LE'], + 'międzychodzki' => ['MI'], + 'nowotomyski' => ['NT'], + 'obornicki' => ['OB'], + 'ostrowski' => ['OS'], + 'ostrzeszowski' => ['OT'], + 'pilski' => ['P'], + 'pleszewski' => ['PL'], + 'poznański' => ['OZ', 'Z'], + 'rawicki' => ['RA'], + 'słupecki' => ['SL'], + 'szamotulski' => ['SZ'], + 'średzki' => ['SR'], + 'śremski' => ['SE'], + 'turecki' => ['TU'], + 'wągrowiecki' => ['WA'], + 'wolsztyński' => ['WL'], + 'wrzesiński' => ['WR'], + 'złotowski' => ['ZL'], + ], + 'zachodniopomorskie' => [ + 'Koszalin' => ['K'], + 'Szczecin' => ['S', 'Z'], + 'Świnoujście' => ['SW'], + 'białogardzki' => ['BI'], + 'choszczeński' => ['CH'], + 'drawski' => ['DR'], + 'goleniowski' => ['GL'], + 'gryficki' => ['GY'], + 'gryfiński' => ['GR'], + 'kamieński' => ['KA'], + 'kołobrzeski' => ['KL'], + 'koszaliński' => ['KO'], + 'łobeski' => ['LO'], + 'myśliborski' => ['MY'], + 'policki' => ['PL'], + 'pyrzycki' => ['PY'], + 'sławieński' => ['SL'], + 'stargardzki' => ['ST'], + 'szczecinecki' => ['SZ'], + 'świdwiński' => ['SD'], + 'wałecki' => ['WA'], + ], + 'army' => [ + 'Siły Zbrojne Rzeczypospolitej Polskiej' => ['A', 'B', 'C', 'D', 'E', 'G', 'I', 'J', 'K', 'L'], + ], + 'services' => [ + 'Centralne Biuro Antykorupcyjne' => ['A'], + 'Służba Ochrony Państwa' => ['BA', 'BB', 'BE', 'BF', 'BG'], + 'Służba Celno-Skarbowa' => ['CA', 'CB', 'CC', 'CD', 'CE', 'CF', 'CG', 'CH', 'CJ', 'CK', 'CL', 'CM', 'CN', 'CO', 'CP', 'CR'], + 'Agencja Bezpieczeństwa Wewnętrznego' => ['K'], + 'Agencja Wywiadu' => ['K'], + 'Służba Kontrwywiadu Wojskowego' => ['M'], + 'Służba Wywiadu Wojskowego' => ['M'], + 'Policja' => ['PA', 'PB', 'PC', 'PD', 'PE', 'PF', 'PG', 'PH', 'PJ', 'PK', 'PL', 'PL', 'PL', 'PL', 'PL', 'PM', 'PN', 'PP', 'PS', 'PT', 'PU', 'PW', 'PZ'], + 'Straż Graniczna' => ['WA', 'WK'], + ], + ]; + + /** + * @var array list of regex expressions matching Polish license plate suffixess when county code is 1 character long. + */ + protected static $plateSuffixesGroup1 = [ + '\d{5}', + '\d{4}[A-PR-Z]', + '\d{3}[A-PR-Z]{2}', + '[1-9][A-PR-Z]\d{3}', + '[1-9][A-PR-Z]{2}\d{2}', + ]; + + /** + * @var array list of regex expressions matching Polish license plate suffixess when county code is 2 characters long. + */ + protected static $plateSuffixesGroup2 = [ + '[A-PR-Z]\d{3}', + '\d{2}[A-PR-Z]{2}', + '[1-9][A-PR-Z]\d{2}', + '\d{2}[A-PR-Z][1-9]', + '[1-9][A-PR-Z]{2}[1-9]', + '[A-PR-Z]{2}\d{2}', + '\d{5}', + '\d{4}[A-PR-Z]', + '\d{3}[A-PR-Z]{2}', + '[A-PR-Z]\d{2}[A-PR-Z]', + '[A-PR-Z][1-9][A-PR-Z]{2}', + ]; + + /** + * Generates random license plate. + * + * @param bool $special whether special license plates should be included + * @param array|null $voivodeships list of voivodeships license plate should be generated from + * @param array|null $counties list of counties license plate should be generated from + */ + public static function licensePlate( + bool $special = false, + ?array $voivodeships = null, + ?array $counties = null + ): string { + $voivodeshipsAvailable = static::$voivodeships + ($special ? static::$specials : []); + $voivodeshipSelected = static::selectRandomArea($voivodeshipsAvailable, $voivodeships); + $voivodeshipCode = static::randomElement($voivodeshipsAvailable[$voivodeshipSelected]); + + $countiesAvailable = static::$counties[$voivodeshipSelected]; + $countySelected = self::selectRandomArea($countiesAvailable, $counties); + + $countyCode = static::randomElement(static::$counties[$voivodeshipSelected][$countySelected]); + + $suffix = static::regexify(static::randomElement(strlen($countyCode) === 1 ? static::$plateSuffixesGroup1 : static::$plateSuffixesGroup2)); + + return "{$voivodeshipCode}{$countyCode} {$suffix}"; + } + + /** + * Selects random area from the list of available and requested. + * + * @return string + */ + protected static function selectRandomArea(array $available, ?array $requested) + { + $requested = array_intersect(array_keys($available), $requested ?? []); + + if (empty($requested)) { + $requested = array_keys($available); + } + + return static::randomElement($requested); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/pl_PL/Payment.php b/vendor/fakerphp/faker/src/Faker/Provider/pl_PL/Payment.php new file mode 100644 index 00000000..f2a60307 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/pl_PL/Payment.php @@ -0,0 +1,120 @@ + 'Narodowy Bank Polski', + '102' => 'Powszechna Kasa Oszczędności Bank Polski Spółka Akcyjna', + '103' => 'Bank Handlowy w Warszawie Spółka Akcyjna', + '105' => 'ING Bank Śląski Spółka Akcyjna', + '106' => 'Bank BPH Spółka Akcyjna', + '109' => 'Santander Bank Polska Spółka Akcyjna', + '113' => 'Bank Gospodarstwa Krajowego', + '114' => 'mBank Spółka Akcyjna', + '116' => 'Bank Millennium Spółka Akcyjna', + '122' => 'Bank Handlowo-Kredytowy Spółka Akcyjna w Katowicach w likwidacji', + '124' => 'Bank Polska Kasa Opieki Spółka Akcyjna', + '132' => 'Bank Pocztowy Spółka Akcyjna', + '154' => 'Bank Ochrony Środowiska Spółka Akcyjna', + '158' => 'Mercedes-Benz Bank Polska Spółka Akcyjna', + '161' => 'SGB-Bank Spółka Akcyjna', + '168' => 'PLUS BANK Spółka Akcyjna', + '184' => 'Société Générale Spółka Akcyjna Oddział w Polsce', + '187' => 'Nest Bank Spółka Akcyjna', + '189' => 'Pekao Bank Hipoteczny Spółka Akcyjna', + '191' => 'Deutsche Bank Polska Spółka Akcyjna', + '193' => 'BANK POLSKIEJ SPÓŁDZIELCZOŚCI SPÓŁKA AKCYJNA', + '194' => 'Credit Agricole Bank Polska Spółka Akcyjna', + '195' => 'Idea Bank Spółka Akcyjna', + '203' => 'BNP Paribas Bank Polska Spółka Akcyjna', + '212' => 'Santander Consumer Bank Spółka Akcyjna', + '215' => 'mBank Hipoteczny Spółka Akcyjna', + '216' => 'Toyota Bank Polska Spółka Akcyjna', + '219' => 'DNB Bank Polska Spółka Akcyjna', + '224' => 'Banque PSA Finance Spółka Akcyjna Oddział w Polsce', + '225' => 'Svenska Handelsbanken AB Spółka Akcyjna Oddział w Polsce', + '235' => 'BNP Paribas S.A. Oddział w Polsce ', + '236' => 'Danske Bank A/S Spółka Akcyjna Oddział w Polsce', + '237' => 'Skandinaviska Enskilda Banken AB (Spółka Akcyjna) - Oddział w Polsce', + '239' => 'CAIXABANK, S.A. (SPÓŁKA AKCYJNA) ODDZIAŁ W POLSCE', + '241' => 'Elavon Financial Services Designated Activity Company (Spółka z O.O. o Wyznaczonym Przedmiocie Działalności) Oddział w Polsce', + '243' => 'BNP Paribas Securities Services Spółka Komandytowo - Akcyjna Oddział w Polsce', + '247' => 'HAITONG BANK, S.A. Spółka Akcyjna Oddział w Polsce', + '248' => 'Getin Noble Bank Spółka Akcyjna', + '249' => 'Alior Bank Spółka Akcyjna', + '251' => 'Aareal Bank Aktiengesellschaft (Spółka Akcyjna) - Oddział w Polsce', + '254' => 'Citibank Europe plc (Publiczna Spółka Akcyjna) Oddział w Polsce', + '255' => 'Ikano Bank AB (publ) Spółka Akcyjna Oddział w Polsce', + '256' => 'Nordea Bank Abp Spółka Akcyjna Oddział w Polsce', + '258' => 'J.P. Morgan Europe Limited Spółka z ograniczoną odpowiedzialnością Oddział w Polsce', + '260' => 'Bank of China (Luxembourg) S.A. Spółka Akcyjna Oddział w Polsce', + '262' => 'Industrial and Commercial Bank of China (Europe) S.A. (Spółka Akcyjna) Oddział w Polsce', + '264' => 'RCI Banque Spółka Akcyjna Oddział w Polsce', + '265' => 'EUROCLEAR Bank SA/NV (Spółka Akcyjna) - Oddział w Polsce', + '266' => 'Intesa Sanpaolo S.p.A. Spółka Akcyjna Oddział w Polsce', + '267' => 'Western Union International Bank GmbH, Sp. z o.o. Oddział w Polsce', + '269' => 'PKO Bank Hipoteczny Spółka Akcyjna', + '270' => 'TF BANK AB (Spółka z ograniczoną odpowiedzialnością) Oddział w Polsce', + '271' => 'FCE Bank Spółka Akcyjna Oddział w Polsce', + '272' => 'AS Inbank Spółka Akcyjna - Oddział w Polsce', + '273' => 'China Construction Bank (Europe) S.A. (Spółka Akcyjna) Oddział w Polsce', + '274' => 'MUFG Bank (Europe) N.V. S.A. Oddział w Polsce', + '275' => 'John Deere Bank S.A. Spółka Akcyjna Oddział w Polsce ', + '277' => 'Volkswagen Bank GmbH Spółka z ograniczoną odpowiedzialnością Oddział w Polsce', + '278' => 'ING Bank Hipoteczny Spółka Akcyjna', + '279' => 'Raiffeisen Bank International AG (Spółka Akcyjna) Oddział w Polsce', + '280' => 'HSBC France (Spółka Akcyjna) Oddział w Polsce', + '281' => 'Goldman Sachs Bank Europe SE Spółka Europejska Oddział w Polsce', + '283' => 'J.P. Morgan AG (Spółka Akcyjna) Oddział w Polsce', + '284' => 'UBS Europe SE (Spółka Europejska) Oddział w Polsce', + '285' => 'Banca Farmafactoring S.p.A. Spółka Akcyjna Oddział w Polsce', + '286' => 'FCA Bank S.p.A. Spółka Akcyjna Oddział w Polsce', + '287' => 'Bank Nowy BFG Spółka Akcyjna', + '288' => 'ALLFUNDS BANK S.A.U. (SPÓŁKA AKCYJNA) ODDZIAŁ W POLSCE', + ]; + + /** + * @example 'Euro Bank SA' + */ + public static function bank() + { + return static::randomElement(static::$banks); + } + + /** + * International Bank Account Number (IBAN) + * + * @see http://en.wikipedia.org/wiki/International_Bank_Account_Number + * + * @param string $prefix for generating bank account number of a specific bank + * @param string $countryCode ISO 3166-1 alpha-2 country code + * @param int $length total length without country code and 2 check digits + * + * @return string + */ + public static function bankAccountNumber($prefix = '', $countryCode = 'PL', $length = null) + { + return static::iban($countryCode, $prefix, $length); + } + + protected static function addBankCodeChecksum($iban, $countryCode = 'PL') + { + if ($countryCode != 'PL' || strlen($iban) <= 8) { + return $iban; + } + $checksum = 0; + $weights = [7, 1, 3, 9, 7, 1, 3]; + + for ($i = 0; $i < 7; ++$i) { + $checksum += $weights[$i] * (int) $iban[$i]; + } + $checksum = $checksum % 10; + + return substr($iban, 0, 7) . $checksum . substr($iban, 8); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/pl_PL/Person.php b/vendor/fakerphp/faker/src/Faker/Provider/pl_PL/Person.php new file mode 100644 index 00000000..6d7312db --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/pl_PL/Person.php @@ -0,0 +1,243 @@ +generator->parse(static::randomElement(static::$lastNameFormat)); + } + + public static function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + public static function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } + + public function title($gender = null) + { + return static::randomElement(static::$title); + } + + /** + * replaced by specific unisex Polish title + */ + public static function titleMale() + { + return static::randomElement(static::$title); + } + + /** + * replaced by specific unisex Polish title + */ + public static function titleFemale() + { + return static::randomElement(static::$title); + } + + /** + * PESEL - Universal Electronic System for Registration of the Population + * + * @see http://en.wikipedia.org/wiki/PESEL + * + * @param DateTime $birthdate + * @param string $sex M for male or F for female + * + * @return string 11 digit number, like 44051401358 + */ + public static function pesel($birthdate = null, $sex = null) + { + if ($birthdate === null) { + $birthdate = \Faker\Provider\DateTime::dateTimeThisCentury(); + } + + $weights = [1, 3, 7, 9, 1, 3, 7, 9, 1, 3]; + $length = count($weights); + + $fullYear = (int) $birthdate->format('Y'); + $year = (int) $birthdate->format('y'); + $month = $birthdate->format('m') + (((int) ($fullYear / 100) - 14) % 5) * 20; + $day = $birthdate->format('d'); + + $result = [(int) ($year / 10), $year % 10, (int) ($month / 10), $month % 10, (int) ($day / 10), $day % 10]; + + for ($i = 6; $i < $length; ++$i) { + $result[$i] = static::randomDigit(); + } + + $result[$length - 1] |= 1; + + if ($sex == 'F') { + $result[$length - 1] -= 1; + } + + $checksum = 0; + + for ($i = 0; $i < $length; ++$i) { + $checksum += $weights[$i] * $result[$i]; + } + $checksum = (10 - ($checksum % 10)) % 10; + $result[] = $checksum; + + return implode('', $result); + } + + /** + * National Identity Card number + * + * @see http://en.wikipedia.org/wiki/Polish_National_Identity_Card + * + * @return string 3 letters and 6 digits, like ABA300000 + */ + public static function personalIdentityNumber() + { + $range = str_split('ABCDEFGHIJKLMNPRSTUVWXYZ'); + $low = ['A', static::randomElement($range), static::randomElement($range)]; + $high = [static::randomDigit(), static::randomDigit(), static::randomDigit(), static::randomDigit(), static::randomDigit()]; + $weights = [7, 3, 1, 7, 3, 1, 7, 3]; + $checksum = 0; + + for ($i = 0, $size = count($low); $i < $size; ++$i) { + $checksum += $weights[$i] * (ord($low[$i]) - 55); + } + + for ($i = 0, $size = count($high); $i < $size; ++$i) { + $checksum += $weights[$i + 3] * $high[$i]; + } + $checksum %= 10; + + return implode('', $low) . $checksum . implode('', $high); + } + + /** + * Taxpayer Identification Number (NIP in Polish) + * + * @see http://en.wikipedia.org/wiki/PESEL#Other_identifiers + * @see http://pl.wikipedia.org/wiki/NIP + * + * @return string 10 digit number + */ + public static function taxpayerIdentificationNumber() + { + $weights = [6, 5, 7, 2, 3, 4, 5, 6, 7]; + $result = []; + + do { + $result = [ + static::randomDigitNotNull(), static::randomDigitNotNull(), static::randomDigitNotNull(), + static::randomDigit(), static::randomDigit(), static::randomDigit(), + static::randomDigit(), static::randomDigit(), static::randomDigit(), + ]; + $checksum = 0; + + for ($i = 0, $size = count($result); $i < $size; ++$i) { + $checksum += $weights[$i] * $result[$i]; + } + $checksum %= 11; + } while ($checksum == 10); + $result[] = $checksum; + + return implode('', $result); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/pl_PL/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/pl_PL/PhoneNumber.php new file mode 100644 index 00000000..d421539b --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/pl_PL/PhoneNumber.php @@ -0,0 +1,18 @@ + + + Prof. Hart will answer or forward your message. + + We would prefer to send you information by email. + + + **The Legal Small Print** + + + (Three Pages) + + ***START**THE SMALL PRINT!**FOR PUBLIC DOMAIN EBOOKS**START*** + Why is this "Small Print!" statement here? You know: lawyers. + They tell us you might sue us if there is something wrong with + your copy of this eBook, even if you got it for free from + someone other than us, and even if what's wrong is not our + fault. So, among other things, this "Small Print!" statement + disclaims most of our liability to you. It also tells you how + you may distribute copies of this eBook if you want to. + + *BEFORE!* YOU USE OR READ THIS EBOOK + By using or reading any part of this PROJECT GUTENBERG-tm + eBook, you indicate that you understand, agree to and accept + this "Small Print!" statement. If you do not, you can receive + a refund of the money (if any) you paid for this eBook by + sending a request within 30 days of receiving it to the person + you got it from. If you received this eBook on a physical + medium (such as a disk), you must return it with your request. + + ABOUT PROJECT GUTENBERG-TM EBOOKS + This PROJECT GUTENBERG-tm eBook, like most PROJECT GUTENBERG-tm eBooks, + is a "public domain" work distributed by Professor Michael S. Hart + through the Project Gutenberg Association (the "Project"). + Among other things, this means that no one owns a United States copyright + on or for this work, so the Project (and you!) can copy and + distribute it in the United States without permission and + without paying copyright royalties. Special rules, set forth + below, apply if you wish to copy and distribute this eBook + under the "PROJECT GUTENBERG" trademark. + + Please do not use the "PROJECT GUTENBERG" trademark to market + any commercial products without permission. + + To create these eBooks, the Project expends considerable + efforts to identify, transcribe and proofread public domain + works. Despite these efforts, the Project's eBooks and any + medium they may be on may contain "Defects". Among other + things, Defects may take the form of incomplete, inaccurate or + corrupt data, transcription errors, a copyright or other + intellectual property infringement, a defective or damaged + disk or other eBook medium, a computer virus, or computer + codes that damage or cannot be read by your equipment. + + LIMITED WARRANTY; DISCLAIMER OF DAMAGES + But for the "Right of Replacement or Refund" described below, + [1] Michael Hart and the Foundation (and any other party you may + receive this eBook from as a PROJECT GUTENBERG-tm eBook) disclaims + all liability to you for damages, costs and expenses, including + legal fees, and [2] YOU HAVE NO REMEDIES FOR NEGLIGENCE OR + UNDER STRICT LIABILITY, OR FOR BREACH OF WARRANTY OR CONTRACT, + INCLUDING BUT NOT LIMITED TO INDIRECT, CONSEQUENTIAL, PUNITIVE + OR INCIDENTAL DAMAGES, EVEN IF YOU GIVE NOTICE OF THE + POSSIBILITY OF SUCH DAMAGES. + + If you discover a Defect in this eBook within 90 days of + receiving it, you can receive a refund of the money (if any) + you paid for it by sending an explanatory note within that + time to the person you received it from. If you received it + on a physical medium, you must return it with your note, and + such person may choose to alternatively give you a replacement + copy. If you received it electronically, such person may + choose to alternatively give you a second opportunity to + receive it electronically. + + THIS EBOOK IS OTHERWISE PROVIDED TO YOU "AS-IS". NO OTHER + WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, ARE MADE TO YOU AS + TO THE EBOOK OR ANY MEDIUM IT MAY BE ON, INCLUDING BUT NOT + LIMITED TO WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A + PARTICULAR PURPOSE. + + Some states do not allow disclaimers of implied warranties or + the exclusion or limitation of consequential damages, so the + above disclaimers and exclusions may not apply to you, and you + may have other legal rights. + + INDEMNITY + You will indemnify and hold Michael Hart, the Foundation, + and its trustees and agents, and any volunteers associated + with the production and distribution of Project Gutenberg-tm + texts harmless, from all liability, cost and expense, including + legal fees, that arise directly or indirectly from any of the + following that you do or cause: [1] distribution of this eBook, + [2] alteration, modification, or addition to the eBook, + or [3] any Defect. + + DISTRIBUTION UNDER "PROJECT GUTENBERG-tm" + You may distribute copies of this eBook electronically, or by + disk, book or any other medium if you either delete this + "Small Print!" and all other references to Project Gutenberg, + or: + + [1] Only give exact copies of it. Among other things, this + requires that you do not remove, alter or modify the + eBook or this "small print!" statement. You may however, + if you wish, distribute this eBook in machine readable + binary, compressed, mark-up, or proprietary form, + including any form resulting from conversion by word + processing or hypertext software, but only so long as + *EITHER*: + + [*] The eBook, when displayed, is clearly readable, and + does *not* contain characters other than those + intended by the author of the work, although tilde + (~), asterisk (*) and underline (_) characters may + be used to convey punctuation intended by the + author, and additional characters may be used to + indicate hypertext links; OR + + [*] The eBook may be readily converted by the reader at + no expense into plain ASCII, EBCDIC or equivalent + form by the program that displays the eBook (as is + the case, for instance, with most word processors); + OR + + [*] You provide, or agree to also provide on request at + no additional cost, fee or expense, a copy of the + eBook in its original plain ASCII form (or in EBCDIC + or other equivalent proprietary form). + + [2] Honor the eBook refund and replacement provisions of this + "Small Print!" statement. + + [3] Pay a trademark license fee to the Foundation of 20% of the + gross profits you derive calculated using the method you + already use to calculate your applicable taxes. If you + don't derive profits, no royalty is due. Royalties are + payable to "Project Gutenberg Literary Archive Foundation" + the 60 days following each date you prepare (or were + legally required to prepare) your annual (or equivalent + periodic) tax return. Please contact us beforehand to + let us know your plans and to work out the details. + + WHAT IF YOU *WANT* TO SEND MONEY EVEN IF YOU DON'T HAVE TO? + Project Gutenberg is dedicated to increasing the number of + public domain and licensed works that can be freely distributed + in machine readable form. + + The Project gratefully accepts contributions of money, time, + public domain materials, or royalty free copyright licenses. + Money should be paid to the: + "Project Gutenberg Literary Archive Foundation." + + If you are interested in contributing scanning equipment or + software or other items, please contact Michael Hart at: + hart@pobox.com + + [Portions of this eBook's header and trailer may be reprinted only + when distributed free of all fees. Copyright (C) 2001, 2002 by + Michael S. Hart. Project Gutenberg is a TradeMark and may not be + used in any sales of Project Gutenberg eBooks or other materials be + they hardware or software or any other related product without + express permission.] + + *END THE SMALL PRINT! FOR PUBLIC DOMAIN EBOOKS*Ver.02/11/02*END* + + */ +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/Address.php new file mode 100644 index 00000000..10bdd571 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/Address.php @@ -0,0 +1,154 @@ +generator->numerify('########0001'); + $n .= check_digit($n); + $n .= check_digit($n); + + return $formatted ? vsprintf('%d%d.%d%d%d.%d%d%d/%d%d%d%d-%d%d', str_split($n)) : $n; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/Internet.php new file mode 100644 index 00000000..fc68ae66 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/Internet.php @@ -0,0 +1,9 @@ + [ + '4##############', + ], + 'MasterCard' => [ + '5##############', + ], + 'American Express' => [ + '34############', + '37############', + ], + 'Discover Card' => [ + '6011###########', + '622############', + '64#############', + '65#############', + ], + 'Diners' => [ + '301############', + '301##########', + '305############', + '305##########', + '36#############', + '36###########', + '38#############', + '38###########', + ], + 'Elo' => [ + '636368#########', + '438935#########', + '504175#########', + '451416#########', + '636297#########', + '5067###########', + '4576###########', + '4011###########', + ], + 'Hipercard' => [ + '38#############', + '60#############', + ], + 'Aura' => [ + '50#############', + ], + ]; + + /** + * International Bank Account Number (IBAN) + * + * @see http://en.wikipedia.org/wiki/International_Bank_Account_Number + * + * @param string $prefix for generating bank account number of a specific bank + * @param string $countryCode ISO 3166-1 alpha-2 country code + * @param int $length total length without country code and 2 check digits + * + * @return string + */ + public static function bankAccountNumber($prefix = '', $countryCode = 'BR', $length = null) + { + return static::iban($countryCode, $prefix, $length); + } + + /** + * @see list of Brazilians banks (2018-02-15), source: https://pt.wikipedia.org/wiki/Lista_de_bancos_do_Brasil + */ + protected static $banks = [ + 'BADESUL Desenvolvimento S.A. – Agência de Fomento/RS', + 'Banco Central do Brasil', + 'Banco da Amazônia', + 'Banco de Brasília', + 'Banco de Desenvolvimento de Minas Gerais', + 'Banco de Desenvolvimento do Espírito Santo', + 'Banco de Desenvolvimento do Paraná', + 'Banco do Brasil', + 'Banco do Estado de Sergipe Banese Estadual', + 'Banco do Estado do Espírito Santo Banestes', + 'Banco do Estado do Pará', + 'Banco do Estado do Rio Grande do Sul', + 'Banco do Nordeste do Brasil', + 'Banco Nacional de Desenvolvimento Econômico e Social', + 'Banco Regional de Desenvolvimento do Extremo Sul', + 'Caixa Econômica Federal', + 'Banco ABN Amro S.A.', + 'Banco Alfa', + 'Banco Banif', + 'Banco BBM', + 'Banco BMG', + 'Banco Bonsucesso', + 'Banco BTG Pactual', + 'Banco Cacique', + 'Banco Caixa Geral - Brasil', + 'Banco Citibank', + 'Banco Credibel', + 'Banco Credit Suisse', + 'Góis Monteiro & Co', + 'Banco Fator', + 'Banco Fibra', + 'Agibank', + 'Banco Guanabara', + 'Banco Industrial do Brasil', + 'Banco Industrial e Comercial', + 'Banco Indusval', + 'Banco Inter', + 'Banco Itaú BBA', + 'Banco ItaúBank', + 'Banco Itaucred Financiamentos', + 'Banco Mercantil do Brasil', + 'Banco Modal Modal', + 'Banco Morada', + 'Banco Pan', + 'Banco Paulista', + 'Banco Pine', + 'Banco Renner', + 'Banco Ribeirão Preto', + 'Banco Safra', + 'Banco Santander', + 'Banco Sofisa', + 'Banco Topázio', + 'Banco Votorantim', + 'Bradesco Bradesco', + 'Itaú Unibanco', + 'Banco Original', + 'Banco Neon', + 'Nu Pagamentos S.A', + 'XP Investimentos Corretora de Câmbio Títulos e Valores Mobiliários S.A', + ]; + + /** + * @example 'Banco Neon' + */ + public static function bank() + { + return static::randomElement(static::$banks); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/Person.php b/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/Person.php new file mode 100644 index 00000000..6331e7ba --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/Person.php @@ -0,0 +1,159 @@ +generator->numerify('#########'); + $n .= check_digit($n); + $n .= check_digit($n); + + return $formatted ? vsprintf('%d%d%d.%d%d%d.%d%d%d-%d%d', str_split($n)) : $n; + } + + /** + * A random RG number, following Sao Paulo state's rules. + * + * @see http://pt.wikipedia.org/wiki/C%C3%A9dula_de_identidade + * + * @param bool $formatted If the number should have dots/dashes or not. + * + * @return string + */ + public function rg($formatted = true) + { + $n = $this->generator->numerify('########'); + $n .= check_digit($n); + + return $formatted ? vsprintf('%d%d.%d%d%d.%d%d%d-%s', str_split($n)) : $n; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/PhoneNumber.php new file mode 100644 index 00000000..66016583 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/PhoneNumber.php @@ -0,0 +1,150 @@ + '']); + } + + return $number; + } + + /** + * Generates an 9-digit landline number without formatting characters. + * + * @param bool $formatted [def: true] If it should return a formatted number or not. + * + * @return string + */ + public static function landline($formatted = true) + { + $number = static::numerify(static::randomElement(static::$landlineFormats)); + + if (!$formatted) { + $number = strtr($number, ['-' => '']); + } + + return $number; + } + + /** + * Randomizes between cellphone and landline numbers. + * + * @param bool $formatted [def: true] If it should return a formatted number or not. + */ + public static function phone($formatted = true) + { + $options = static::randomElement([ + ['cellphone', false], + ['cellphone', true], + ['landline', null], + ]); + + return call_user_func([static::class, $options[0]], $formatted, $options[1]); + } + + /** + * Generates a complete phone number. + * + * @param string $type [def: landline] One of "landline" or "cellphone". Defaults to "landline" on invalid values. + * @param bool $formatted [def: true] If the number should be formatted or not. + * + * @return string + */ + protected static function anyPhoneNumber($type, $formatted = true) + { + $area = static::areaCode(); + $number = ($type == 'cellphone') ? + static::cellphone($formatted) : + static::landline($formatted); + + return $formatted ? "($area) $number" : $area . $number; + } + + /** + * Concatenates {@link areaCode} and {@link cellphone} into a national cellphone number. + * + * @param bool $formatted [def: true] If it should return a formatted number or not. + * + * @return string + */ + public static function cellphoneNumber($formatted = true) + { + return static::anyPhoneNumber('cellphone', $formatted); + } + + /** + * Concatenates {@link areaCode} and {@link landline} into a national landline number. + * + * @param bool $formatted [def: true] If it should return a formatted number or not. + * + * @return string + */ + public static function landlineNumber($formatted = true) + { + return static::anyPhoneNumber('landline', $formatted); + } + + /** + * Randomizes between complete cellphone and landline numbers. + */ + public function phoneNumber() + { + $method = static::randomElement(['cellphoneNumber', 'landlineNumber']); + + return call_user_func([static::class, $method], true); + } + + /** + * Randomizes between complete cellphone and landline numbers, cleared from formatting symbols. + */ + public static function phoneNumberCleared() + { + $method = static::randomElement(['cellphoneNumber', 'landlineNumber']); + + return call_user_func([static::class, $method], false); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/Text.php b/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/Text.php new file mode 100644 index 00000000..ce607285 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/pt_BR/Text.php @@ -0,0 +1,3427 @@ += 12; + $verifier = 0; + + for ($i = 1; $i <= $length; ++$i) { + if (!$second_algorithm) { + $multiplier = $i + 1; + } else { + $multiplier = ($i >= 9) ? $i - 7 : $i + 1; + } + $verifier += $numbers[$length - $i] * $multiplier; + } + + $verifier = 11 - ($verifier % 11); + + if ($verifier >= 10) { + $verifier = 0; + } + + return $verifier; +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/pt_PT/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/pt_PT/Address.php new file mode 100644 index 00000000..0d3f8508 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/pt_PT/Address.php @@ -0,0 +1,130 @@ + 0; --$i) { + $numbers[$i] = substr($number, $i - 1, 1); + $partial[$i] = $numbers[$i] * $factor; + $sum += $partial[$i]; + + if ($factor == $base) { + $factor = 1; + } + ++$factor; + } + $res = $sum % 11; + + if ($res == 0 || $res == 1) { + $digit = 0; + } else { + $digit = 11 - $res; + } + + return $digit; + } + + /** + * @see http://nomesportugueses.blogspot.pt/2012/01/lista-dos-cem-nomes-mais-usados-em.html + */ + protected static $firstNameMale = [ + 'Rodrigo', 'João', 'Martim', 'Afonso', 'Tomás', 'Gonçalo', 'Francisco', 'Tiago', + 'Diogo', 'Guilherme', 'Pedro', 'Miguel', 'Rafael', 'Gabriel', 'Santiago', 'Dinis', + 'David', 'Duarte', 'José', 'Simão', 'Daniel', 'Lucas', 'Gustavo', 'André', 'Denis', + 'Salvador', 'António', 'Vasco', 'Henrique', 'Lourenço', 'Manuel', 'Eduardo', 'Bernardo', + 'Leandro', 'Luís', 'Diego', 'Leonardo', 'Alexandre', 'Rúben', 'Mateus', 'Ricardo', + 'Vicente', 'Filipe', 'Bruno', 'Nuno', 'Carlos', 'Rui', 'Hugo', 'Samuel', 'Álvaro', + 'Matias', 'Fábio', 'Ivo', 'Paulo', 'Jorge', 'Xavier', 'Marco', 'Isaac', 'Raúl', 'Benjamim', + 'Renato', 'Artur', 'Mário', 'Frederico', 'Cristiano', 'Ivan', 'Sérgio', 'Micael', + 'Vítor', 'Edgar', 'Kevin', 'Joaquim', 'Igor', 'Ângelo', 'Enzo', 'Valentim', 'Flávio', + 'Joel', 'Fernando', 'Sebastião', 'Tomé', 'César', 'Cláudio', 'Nelson', 'Lisandro', 'Jaime', + 'Gil', 'Mauro', 'Sandro', 'Hélder', 'Matheus', 'William', 'Gaspar', 'Márcio', + 'Martinho', 'Emanuel', 'Marcos', 'Telmo', 'Davi', 'Wilson', + ]; + + protected static $firstNameFemale = [ + 'Maria', 'Leonor', 'Matilde', 'Mariana', 'Ana', 'Beatriz', 'Inês', 'Lara', 'Carolina', 'Margarida', + 'Joana', 'Sofia', 'Diana', 'Francisca', 'Laura', 'Sara', 'Madalena', 'Rita', 'Mafalda', 'Catarina', + 'Luana', 'Marta', 'Íris', 'Alice', 'Bianca', 'Constança', 'Gabriela', 'Eva', 'Clara', 'Bruna', 'Daniela', + 'Iara', 'Filipa', 'Vitória', 'Ariana', 'Letícia', 'Bárbara', 'Camila', 'Rafaela', 'Carlota', 'Yara', + 'Núria', 'Raquel', 'Ema', 'Helena', 'Benedita', 'Érica', 'Isabel', 'Nicole', 'Lia', 'Alícia', 'Mara', + 'Jéssica', 'Soraia', 'Júlia', 'Luna', 'Victória', 'Luísa', 'Teresa', 'Miriam', 'Adriana', 'Melissa', + 'Andreia', 'Juliana', 'Alexandra', 'Yasmin', 'Tatiana', 'Leticia', 'Luciana', 'Eduarda', 'Cláudia', + 'Débora', 'Fabiana', 'Renata', 'Kyara', 'Kelly', 'Irina', 'Mélanie', 'Nádia', 'Cristiana', 'Liliana', + 'Patrícia', 'Vera', 'Doriana', 'Ângela', 'Mia', 'Erica', 'Mónica', 'Isabela', 'Salomé', 'Cátia', + 'Verónica', 'Violeta', 'Lorena', 'Érika', 'Vanessa', 'Iris', 'Anna', 'Viviane', 'Rebeca', 'Neuza', + ]; + + protected static $lastName = [ + 'Abreu', 'Almeida', 'Alves', 'Amaral', 'Amorim', 'Andrade', 'Anjos', 'Antunes', 'Araújo', 'Assunção', + 'Azevedo', 'Baptista', 'Barbosa', 'Barros', 'Batista', 'Borges', 'Branco', 'Brito', 'Campos', 'Cardoso', + 'Carneiro', 'Carvalho', 'Castro', 'Coelho', 'Correia', 'Costa', 'Cruz', 'Cunha', 'Domingues', 'Esteves', + 'Faria', 'Fernandes', 'Ferreira', 'Figueiredo', 'Fonseca', 'Freitas', 'Garcia', 'Gaspar', 'Gomes', + 'Gonçalves', 'Guerreiro', 'Henriques', 'Jesus', 'Leal', 'Leite', 'Lima', 'Lopes', 'Loureiro', 'Lourenço', + 'Macedo', 'Machado', 'Magalhães', 'Maia', 'Marques', 'Martins', 'Matias', 'Matos', 'Melo', 'Mendes', + 'Miranda', 'Monteiro', 'Morais', 'Moreira', 'Mota', 'Moura', 'Nascimento', 'Neto', 'Neves', 'Nogueira', + 'Nunes', 'Oliveira', 'Pacheco', 'Paiva', 'Pereira', 'Pinheiro', 'Pinho', 'Pinto', 'Pires', 'Ramos', + 'Reis', 'Ribeiro', 'Rocha', 'Rodrigues', 'Santos', 'Silva', 'Simões', 'Soares', 'Sousa', + 'Sá', 'Tavares', 'Teixeira', 'Torres', 'Valente', 'Vaz', 'Vicente', 'Vieira', + ]; +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/pt_PT/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/pt_PT/PhoneNumber.php new file mode 100644 index 00000000..948ba94d --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/pt_PT/PhoneNumber.php @@ -0,0 +1,50 @@ + '01', 'AR' => '02', 'AG' => '03', 'B' => '40', 'BC' => '04', 'BH' => '05', + 'BN' => '06', 'BT' => '07', 'BV' => '08', 'BR' => '09', 'BZ' => '10', 'CS' => '11', + 'CL' => '51', 'CJ' => '12', 'CT' => '13', 'CV' => '14', 'DB' => '15', 'DJ' => '16', + 'GL' => '17', 'GR' => '52', 'GJ' => '18', 'HR' => '19', 'HD' => '20', 'IL' => '21', + 'IS' => '22', 'IF' => '23', 'MM' => '24', 'MH' => '25', 'MS' => '26', 'NT' => '27', + 'OT' => '28', 'PH' => '29', 'SM' => '30', 'SJ' => '31', 'SB' => '32', 'SV' => '33', + 'TR' => '34', 'TM' => '35', 'TL' => '36', 'VS' => '37', 'VL' => '38', 'VN' => '39', + + 'B1' => '41', 'B2' => '42', 'B3' => '43', 'B4' => '44', 'B5' => '45', 'B6' => '46', + ]; + + /** + * Personal Numerical Code (CNP) + * + * @see http://ro.wikipedia.org/wiki/Cod_numeric_personal + * + * @example 1111111111118 + * + * @param string|null $gender Person::GENDER_MALE or Person::GENDER_FEMALE + * @param string|null $dateOfBirth (1800-2099) 'Y-m-d', 'Y-m', 'Y' I.E. '1981-06-16', '2085-03', '1900' + * @param string|null $county county code where the CNP was issued + * @param bool|null $isResident flag if the person resides in Romania + * + * @return string 13 digits CNP code + */ + public function cnp($gender = null, $dateOfBirth = null, $county = null, $isResident = true) + { + $genders = [Person::GENDER_MALE, Person::GENDER_FEMALE]; + + if (empty($gender)) { + $gender = static::randomElement($genders); + } elseif (!in_array($gender, $genders, false)) { + throw new \InvalidArgumentException("Gender must be '{Person::GENDER_MALE}' or '{Person::GENDER_FEMALE}'"); + } + + $date = $this->getDateOfBirth($dateOfBirth); + + if (null === $county) { + $countyCode = static::randomElement(array_values(static::$cnpCountyCodes)); + } elseif (!array_key_exists($county, static::$cnpCountyCodes)) { + throw new \InvalidArgumentException("Invalid county code '{$county}' received"); + } else { + $countyCode = static::$cnpCountyCodes[$county]; + } + + $cnp = (string) $this->getGenderDigit($date, $gender, $isResident) + . $date->format('ymd') + . $countyCode + . static::numerify('##%') + ; + + $checksum = $this->getChecksumDigit($cnp); + + return $cnp . $checksum; + } + + /** + * @param string|null $dateOfBirth + * + * @return \DateTime + */ + protected function getDateOfBirth($dateOfBirth) + { + if (empty($dateOfBirth)) { + $dateOfBirthParts = [self::numberBetween(1800, 2099)]; + } else { + $dateOfBirthParts = explode('-', $dateOfBirth); + } + $baseDate = \Faker\Provider\DateTime::dateTimeBetween("first day of January {$dateOfBirthParts[0]}", "last day of December {$dateOfBirthParts[0]}"); + + switch (count($dateOfBirthParts)) { + case 1: + $dateOfBirthParts[] = $baseDate->format('m'); + //don't break, we need the day also + // no break + case 2: + $dateOfBirthParts[] = $baseDate->format('d'); + //don't break, next line will + // no break + case 3: + break; + + default: + throw new \InvalidArgumentException("Invalid date of birth - must be null or in the 'Y-m-d', 'Y-m', 'Y' format"); + } + + if ($dateOfBirthParts[0] < 1800 || $dateOfBirthParts[0] > 2099) { + throw new \InvalidArgumentException("Invalid date of birth - year must be between 1800 and 2099, '{$dateOfBirthParts[0]}' received"); + } + + $dateOfBirthFinal = implode('-', $dateOfBirthParts); + $date = \DateTime::createFromFormat('Y-m-d', $dateOfBirthFinal); + + //a full (invalid) date might have been supplied, check if it converts + if ($date->format('Y-m-d') !== $dateOfBirthFinal) { + throw new \InvalidArgumentException("Invalid date of birth - '{$date->format('Y-m-d')}' generated based on '{$dateOfBirth}' received"); + } + + return $date; + } + + /** + * https://ro.wikipedia.org/wiki/Cod_numeric_personal#S + * + * @param bool $isResident + * @param string $gender + * + * @return int + */ + protected static function getGenderDigit(\DateTime $dateOfBirth, $gender, $isResident) + { + if (!$isResident) { + return 9; + } + + if ($dateOfBirth->format('Y') < 1900) { + if ($gender == Person::GENDER_MALE) { + return 3; + } + + return 4; + } + + if ($dateOfBirth->format('Y') < 2000) { + if ($gender == Person::GENDER_MALE) { + return 1; + } + + return 2; + } + + if ($gender == Person::GENDER_MALE) { + return 5; + } + + return 6; + } + + /** + * Calculates a checksum for the Personal Numerical Code (CNP). + * + * @param string $value 12 digit CNP + * + * @return int checksum digit + */ + protected function getChecksumDigit($value) + { + $checkNumber = 279146358279; + + $checksum = 0; + + foreach (range(0, 11) as $digit) { + $checksum += (int) substr($value, $digit, 1) * (int) substr($checkNumber, $digit, 1); + } + $checksum = $checksum % 11; + + return $checksum == 10 ? 1 : $checksum; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ro_RO/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/ro_RO/PhoneNumber.php new file mode 100644 index 00000000..01c58591 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ro_RO/PhoneNumber.php @@ -0,0 +1,62 @@ + [ + '021#######', // Bucharest + '023#######', + '024#######', + '025#######', + '026#######', + '027#######', // non-geographic + '031#######', // Bucharest + '033#######', + '034#######', + '035#######', + '036#######', + '037#######', // non-geographic + ], + 'mobile' => [ + '07########', + ], + ]; + + protected static $specialFormats = [ + 'toll-free' => [ + '0800######', + '0801######', // shared-cost numbers + '0802######', // personal numbering + '0806######', // virtual cards + '0807######', // pre-paid cards + '0870######', // internet dial-up + ], + 'premium-rate' => [ + '0900######', + '0903######', // financial information + '0906######', // adult entertainment + ], + ]; + + /** + * @see http://en.wikipedia.org/wiki/Telephone_numbers_in_Romania#Last_years + */ + public function phoneNumber() + { + $type = static::randomElement(array_keys(static::$normalFormats)); + + return static::numerify(static::randomElement(static::$normalFormats[$type])); + } + + public static function tollFreePhoneNumber() + { + return static::numerify(static::randomElement(static::$specialFormats['toll-free'])); + } + + public static function premiumRatePhoneNumber() + { + return static::numerify(static::randomElement(static::$specialFormats['premium-rate'])); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ro_RO/Text.php b/vendor/fakerphp/faker/src/Faker/Provider/ro_RO/Text.php new file mode 100644 index 00000000..1e40597c --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ro_RO/Text.php @@ -0,0 +1,155 @@ +generator->parse($format); + } + + public static function country() + { + return static::randomElement(static::$country); + } + + public static function postcode() + { + return static::toUpper(static::bothify(static::randomElement(static::$postcode))); + } + + public static function regionSuffix() + { + return static::randomElement(static::$regionSuffix); + } + + public static function region() + { + return static::randomElement(static::$region); + } + + public static function cityPrefix() + { + return static::randomElement(static::$cityPrefix); + } + + public function city() + { + return static::randomElement(static::$city); + } + + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + public static function street() + { + return static::randomElement(static::$street); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ru_RU/Color.php b/vendor/fakerphp/faker/src/Faker/Provider/ru_RU/Color.php new file mode 100644 index 00000000..d31d1208 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ru_RU/Color.php @@ -0,0 +1,23 @@ +generator->parse($format); + } + + public static function companyPrefix() + { + return static::randomElement(static::$companyPrefixes); + } + + public static function companyNameElement() + { + return static::randomElement(static::$companyElements); + } + + public static function companyNameSuffix() + { + return static::randomElement(static::$companyNameSuffixes); + } + + /** + * Generates a Russian Taxpayer Personal Identification Number + * + * @param string $area_code + * + * @return string + * + * @deprecated use {@link \Faker\Provider\ru_RU\Company::inn10()} instead + * @see \Faker\Provider\ru_RU\Company::inn10() + */ + public static function inn($area_code = '') + { + return self::inn10($area_code); + } + + /** + * Generates a Russian Taxpayer Personal Identification Number + * + * @param string $area_code + * + * @return string + */ + public static function inn10($area_code = '') + { + if ($area_code === '' || (int) $area_code === 0) { + //Simple generation code for areas in Russian without check for valid + $area_code = self::numberBetween(1, 91); + } else { + $area_code = (int) $area_code; + } + $area_code = str_pad($area_code, 2, '0', STR_PAD_LEFT); + $inn_base = $area_code . static::numerify('#######'); + + return $inn_base . self::inn10Checksum($inn_base); + } + + public static function kpp($inn = '') + { + if ($inn === '' || strlen($inn) < 4) { + $inn = self::inn10(); + } + + return substr($inn, 0, 4) . '01001'; + } + + /** + * Generates INN Checksum + * + * @see https://ru.wikipedia.org/wiki/%D0%98%D0%B4%D0%B5%D0%BD%D1%82%D0%B8%D1%84%D0%B8%D0%BA%D0%B0%D1%86%D0%B8%D0%BE%D0%BD%D0%BD%D1%8B%D0%B9_%D0%BD%D0%BE%D0%BC%D0%B5%D1%80_%D0%BD%D0%B0%D0%BB%D0%BE%D0%B3%D0%BE%D0%BF%D0%BB%D0%B0%D1%82%D0%B5%D0%BB%D1%8C%D1%89%D0%B8%D0%BA%D0%B0 + * + * @param string $inn + * + * @return string Checksum (one digit) + */ + public static function inn10Checksum($inn) + { + $multipliers = [2, 4, 10, 3, 5, 9, 4, 6, 8]; + $sum = 0; + + for ($i = 0; $i < 9; ++$i) { + $sum += (int) $inn[$i] * $multipliers[$i]; + } + + return (string) (($sum % 11) % 10); + } + + /** + * Checks whether an INN has a valid checksum + * + * @param string $inn + * + * @return bool + */ + public static function inn10IsValid($inn) + { + return strlen($inn) === 10 && self::inn10Checksum($inn) === $inn[9]; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ru_RU/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/ru_RU/Internet.php new file mode 100644 index 00000000..195ef5f4 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ru_RU/Internet.php @@ -0,0 +1,9 @@ +.*<' | \ + * sed -r 's/—//' | sed -r 's/[\<\>]//g' | sed -r "s/(^|$)/'/g" | sed -r 's/$/,/' | sed -r 's/\&(laquo|raquo);/"/g' | \ + * sed -r 's/\s+/ /g'" + */ + protected static $banks = [ + 'Новый Промышленный Банк', + 'Новый Символ', + 'Нокссбанк', + 'Ноосфера', + 'Нордеа Банк', + 'Нота-Банк', + 'НС Банк', + 'НСТ-Банк', + 'Нэклис-Банк', + 'Образование', + 'Объединенный Банк Промышленных Инвестиций', + 'Объединенный Банк Республики', + 'Объединенный Капитал', + 'Объединенный Кредитный Банк', + 'Объединенный Кредитный Банк Московский филиал', + 'Объединенный Национальный Банк', + 'Объединенный Резервный Банк', + 'Океан Банк', + 'ОЛМА-Банк', + 'Онего', + 'Оней Банк', + 'ОПМ-Банк', + 'Оргбанк', + 'Оренбург', + 'ОТП Банк', + 'ОФК Банк', + 'Охабанк', + 'Первобанк', + 'Первомайский', + 'Первоуральскбанк', + 'Первый Дортрансбанк', + 'Первый Инвестиционный банк', + 'Первый Клиентский Банк', + 'Первый Чешско-Российский Банк', + 'Пересвет', + 'Пермь', + 'Петербургский Социальный Коммерческий Банк', + 'Петрокоммерц', + 'ПИР Банк', + 'Платина', + 'Плато-Банк', + 'Плюс Банк', + 'Пойдем!', + 'Почтобанк', + 'Прайм Финанс', + 'Преодоление', + 'Приморье', + 'Примсоцбанк', + 'Примтеркомбанк', + 'Прио-Внешторгбанк', + 'Приобье', + 'Приполярный', + 'Приско Капитал Банк', + 'Пробизнесбанк', + 'Проинвестбанк', + 'Прокоммерцбанк', + 'Проминвестбанк', + 'Промрегионбанк', + 'Промсвязьбанк', + 'Промсвязьинвестбанк', + 'Промсельхозбанк', + 'Промтрансбанк', + 'Промышленно-Финансовое Сотрудничество', + 'Промэнергобанк', + 'Профессионал Банк', + 'Профит Банк', + 'Прохладный', + 'Пульс Столицы', + 'Радиотехбанк', + 'Развитие', + 'Развитие-Столица', + 'Райффайзенбанк', + 'Расчетно-Кредитный Банк', + 'Расчетный Дом', + 'РБА', + 'Региональный Банк Развития', + 'Региональный Банк Сбережений', + 'Региональный Коммерческий Банк', + 'Региональный Кредит', + 'Регионфинансбанк', + 'Регнум', + 'Резерв', + 'Ренессанс', + 'Ренессанс Кредит', + 'Рента-Банк', + 'РЕСО Кредит', + 'Республиканский Кредитный Альянс', + 'Ресурс-Траст', + 'Риабанк', + 'Риал-Кредит', + 'Ринвестбанк', + 'Ринвестбанк Московский офис', + 'РИТ-Банк', + 'РН Банк', + 'Росавтобанк', + 'Росбанк', + 'Росбизнесбанк', + 'Росгосстрах Банк', + 'Росдорбанк', + 'РосЕвроБанк', + 'РосинтерБанк', + 'Роспромбанк', + 'Россельхозбанк', + 'Российская Финансовая Корпорация', + 'Российский Капитал', + 'Российский Кредит', + 'Российский Национальный Коммерческий Банк', + 'Россита-Банк', + 'Россия', + 'Рост Банк', + 'Ростфинанс', + 'Росэксимбанк', + 'Росэнергобанк', + 'Роял Кредит Банк', + 'РСКБ', + 'РТС-Банк', + 'РУБанк', + 'Рублев', + 'Руна-Банк', + 'Рунэтбанк', + 'Рускобанк', + 'Руснарбанк', + 'Русский Банк Сбережений', + 'Русский Ипотечный Банк', + 'Русский Международный Банк', + 'Русский Национальный Банк', + 'Русский Стандарт', + 'Русский Торговый Банк', + 'Русский Трастовый Банк', + 'Русский Финансовый Альянс', + 'Русский Элитарный Банк', + 'Русславбанк', + 'Руссобанк', + 'Русстройбанк', + 'Русфинанс Банк', + 'Русь', + 'РусьРегионБанк', + 'Русьуниверсалбанк', + 'РусЮгбанк', + 'РФИ Банк', + 'Саммит Банк', + 'Санкт-Петербургский Банк Инвестиций', + 'Саратов', + 'Саровбизнесбанк', + 'Сбербанк России', + 'Связной Банк', + 'Связь-Банк', + 'СДМ-Банк', + 'Севастопольский Морской банк', + 'Северный Кредит', + 'Северный Народный Банк', + 'Северо-Восточный Альянс', + 'Северо-Западный 1 Альянс Банк', + 'Северстройбанк', + 'Севзапинвестпромбанк', + 'Сельмашбанк', + 'Сервис-Резерв', + 'Сетелем Банк', + 'СИАБ', + 'Сибирский Банк Реконструкции и Развития', + 'Сибнефтебанк', + 'Сибсоцбанк', + 'Сибэс', + 'Сибэс Московский офис', + 'Синергия', + 'Синко-Банк', + 'Система', + 'Сити Инвест Банк', + 'Ситибанк', + 'СКА-Банк', + 'СКБ-Банк', + 'Славия', + 'Славянбанк', + 'Славянский Кредит', + 'Смартбанк', + 'СМБ-Банк', + 'Смолевич', + 'СМП Банк', + 'Снежинский', + 'Собинбанк', + 'Соверен Банк', + 'Советский', + 'Совкомбанк', + 'Современные Стандарты Бизнеса', + 'Содружество', + 'Соколовский', + 'Солид Банк', + 'Солидарность (Москва)', + 'Солидарность (Самара)', + 'Социнвестбанк', + 'Социнвестбанк Московский филиал', + 'Социум-Банк', + 'Союз', + 'Союзный', + 'Спецстройбанк', + 'Спиритбанк', + 'Спурт Банк', + 'Спутник', + 'Ставропольпромстройбанк', + 'Сталь Банк', + 'Стандарт-Кредит', + 'Стар Альянс', + 'СтарБанк', + 'Старооскольский Агропромбанк', + 'Старый Кремль', + 'Стелла-Банк', + 'Столичный Кредит', + 'Стратегия', + 'Строительно-Коммерческий Банк', + 'Стройлесбанк', + 'Сумитомо Мицуи', + 'Сургутнефтегазбанк', + 'СЭБ Банк', + 'Таатта', + 'Таврический', + 'Таганрогбанк', + 'Тагилбанк', + 'Тайдон', + 'Тайм Банк', + 'Тальменка-Банк', + 'Тальменка-Банк Московский филиал', + 'Тамбовкредитпромбанк', + 'Татагропромбанк', + 'Татсоцбанк', + 'Татфондбанк', + 'Таурус Банк', + 'ТверьУниверсалБанк', + 'Тексбанк', + 'Темпбанк', + 'Тендер-Банк', + 'Терра', + 'Тетраполис', + 'Тимер Банк', + 'Тинькофф Банк', + 'Тихоокеанский Внешторгбанк', + 'Тойота Банк', + 'Тольяттихимбанк', + 'Томскпромстройбанк', + 'Торгово-Промышленный Банк Китая', + 'Торговый Городской Банк', + 'Торжокуниверсалбанк', + 'Транскапиталбанк', + 'Транснациональный Банк', + 'Транспортный', + 'Трансстройбанк', + 'Траст Капитал Банк', + 'Тройка-Д Банк', + 'Тульский Промышленник', + 'Тульский Промышленник Московский офис', + 'Тульский Расчетный Центр', + 'Турбобанк', + 'Тусар', + 'ТЭМБР-Банк', + 'ТЭСТ', + 'Углеметбанк', + 'Уздан', + 'Унифин', + 'Унифондбанк', + 'Уралкапиталбанк', + 'Уралприватбанк', + 'Уралпромбанк', + 'Уралсиб', + 'Уралтрансбанк', + 'Уралфинанс', + 'Уральский Банк Реконструкции и Развития', + 'Уральский Межрегиональный Банк', + 'Уральский Финансовый Дом', + 'Ури Банк', + 'Уссури', + 'ФДБ', + 'ФИА-Банк', + 'Финам Банк', + 'Финанс Бизнес Банк', + 'Финансово-Промышленный Капитал', + 'Финансовый Капитал', + 'Финансовый Стандарт', + 'Финарс Банк', + 'Финпромбанк (ФПБ Банк)', + 'Финтрастбанк', + 'ФК Открытие (бывш. НОМОС-Банк)', + 'Флора-Москва', + 'Фольксваген Банк Рус', + 'Фондсервисбанк', + 'Фора-Банк', + 'Форбанк', + 'Форус Банк', + 'Форштадт', + 'Фьючер', + 'Хакасский Муниципальный Банк', + 'Ханты-Мансийский банк Открытие', + 'Химик', + 'Хлынов', + 'Хованский', + 'Холдинвестбанк', + 'Холмск', + 'Хоум Кредит Банк', + 'Центр-инвест', + 'Центрально-Азиатский', + 'Центрально-Европейский Банк', + 'Центркомбанк', + 'ЦентроКредит', + 'Церих', + 'Чайна Констракшн', + 'Чайнасельхозбанк', + 'Челиндбанк', + 'Челябинвестбанк', + 'Черноморский банк развития и реконструкции', + 'Чувашкредитпромбанк', + 'Эйч-Эс-Би-Си Банк (HSBC)', + 'Эко-Инвест', + 'Экономбанк', + 'Экономикс-Банк', + 'Экси-Банк', + 'Эксперт Банк', + 'Экспобанк', + 'Экспресс-Волга', + 'Экспресс-Кредит', + 'Эл Банк', + 'Элита', + 'Эльбин', + 'Энергобанк', + 'Энергомашбанк', + 'Энерготрансбанк', + 'Эно', + 'Энтузиастбанк', + 'Эргобанк', + 'Ю Би Эс Банк', + 'ЮГ-Инвестбанк', + 'Югра', + 'Южный Региональный Банк', + 'ЮМК', + 'Юниаструм Банк', + 'ЮниКредит Банк', + 'Юнистрим', + 'Япы Креди Банк Москва', + 'ЯР-Банк', + 'Яринтербанк', + 'Ярославич', + 'K2 Банк', + 'АББ', + 'Абсолют Банк', + 'Авангард', + 'Аверс', + 'Автоградбанк', + 'АвтоКредитБанк', + 'Автоторгбанк', + 'Агроинкомбанк', + 'Агропромкредит', + 'Агророс', + 'Агросоюз', + 'Адамон Банк', + 'Адамон Банк Московский филиал', + 'Аделантбанк', + 'Адмиралтейский', + 'Азиатско-Тихоокеанский Банк', + 'Азимут', + 'Азия Банк', + 'Азия-Инвест Банк', + 'Ай-Си-Ай-Си-Ай Банк (ICICI)', + 'Айви Банк', + 'АйМаниБанк', + 'Ак Барс', + 'Акибанк', + 'Аккобанк', + 'Акрополь', + 'Аксонбанк', + 'Актив Банк', + 'АктивКапитал Банк', + 'АктивКапитал Банк Московский филиал', + 'АктивКапитал Банк Санкт-Петербургский филиал', + 'Акцент', + 'Акцепт', + 'Акция', + 'Алданзолотобанк', + 'Александровский', + 'Алеф-Банк', + 'Алжан', + 'Алмазэргиэнбанк', + 'АлтайБизнес-Банк', + 'Алтайкапиталбанк', + 'Алтынбанк', + 'Альба Альянс', + 'Альта-Банк', + 'Альтернатива', + 'Альфа-Банк', + 'АМБ Банк', + 'Америкэн Экспресс Банк', + 'Анелик РУ', + 'Анкор Банк', + 'Анталбанк', + 'Апабанк', + 'Аресбанк', + 'Арзамас', + 'Арксбанк', + 'Арсенал', + 'Аспект', + 'Ассоциация', + 'БайкалБанк', + 'БайкалИнвестБанк', + 'Байкалкредобанк', + 'Балаково-Банк', + 'Балтийский Банк', + 'Балтика', + 'Балтинвестбанк', + 'Банк "Акцент" Московский филиал', + 'Банк "МБА-Москва"', + 'Банк "Санкт-Петербург"', + 'Банк АВБ', + 'Банк БКФ', + 'Банк БФА', + 'Банк БЦК-Москва', + 'Банк Город', + 'Банк Жилищного Финансирования', + 'Банк Инноваций и Развития', + 'Банк Интеза', + 'Банк ИТБ', + 'Банк Казани', + 'Банк Китая (Элос)', + 'Банк Кредит Свисс', + 'Банк МБФИ', + 'Банк Москвы', + 'Банк на Красных Воротах', + 'Банк Оранжевый (бывш. Промсервисбанк)', + 'Банк оф Токио-Мицубиси', + 'Банк Премьер Кредит', + 'Банк ПСА Финанс Рус', + 'Банк Развития Технологий', + 'Банк Расчетов и Сбережений', + 'Банк Раунд', + 'Банк РСИ', + 'Банк Сберегательно-кредитного сервиса', + 'Банк СГБ', + 'Банк Торгового Финансирования', + 'Банк Финсервис', + 'Банк Экономический Союз', + 'Банкирский Дом', + 'Банкхаус Эрбе', + 'Башкомснаббанк', + 'Башпромбанк', + 'ББР Банк', + 'Белгородсоцбанк', + 'Бенифит-Банк', + 'Берейт', + 'Бест Эффортс Банк', + 'Бизнес для Бизнеса', + 'Бинбанк', + 'БИНБАНК кредитные карты', + 'Бинбанк Мурманск', + 'БКС Инвестиционный Банк', + 'БМВ Банк', + 'БНП Париба Банк', + 'Богородский', + 'Богородский Муниципальный Банк', + 'Братский АНКБ', + 'БСТ-Банк', + 'Булгар Банк', + 'Бум-Банк', + 'Бумеранг', + 'БФГ-Кредит', + 'БыстроБанк', + 'Вакобанк', + 'Вега-Банк', + 'Век', + 'Великие Луки Банк', + 'Венец', + 'Верхневолжский', + 'Верхневолжский Крымский филиал', + 'Верхневолжский Московский филиал', + 'Верхневолжский Невский филиал', + 'Верхневолжский Таврический филиал', + 'Верхневолжский Ярославский филиал', + 'Веста', + 'Вестинтербанк', + 'Взаимодействие', + 'Викинг', + 'Витабанк', + 'Витязь', + 'Вкабанк', + 'Владбизнесбанк', + 'Владпромбанк', + 'Внешпромбанк', + 'Внешфинбанк', + 'Внешэкономбанк', + 'Военно-Промышленный Банк', + 'Возрождение', + 'Вокбанк', + 'Вологдабанк', + 'Вологжанин', + 'Воронеж', + 'Восточно-Европейский Трастовый Банк', + 'Восточный Экспресс Банк', + 'ВостСибтранскомбанк', + 'ВРБ Москва', + 'Всероссийский Банк Развития Регионов', + 'ВТБ', + 'ВТБ 24', + 'ВУЗ-Банк', + 'Выборг-Банк', + 'Выборг-Банк Московский филиал', + 'Вэлтон Банк', + 'Вятич', + 'Вятка-Банк', + 'Гагаринский', + 'Газбанк', + 'Газнефтьбанк', + 'Газпромбанк', + 'Газстройбанк', + 'Газтрансбанк', + 'Газэнергобанк', + 'Ганзакомбанк', + 'Гарант-Инвест', + 'Гаранти Банк Москва', + 'Геленджик-Банк', + 'Генбанк', + 'Геобанк', + 'Гефест', + 'Глобус', + 'Глобэкс', + 'Голдман Сакс Банк', + 'Горбанк', + 'ГПБ-Ипотека', + 'Гранд Инвест Банк', + 'Гринкомбанк', + 'Гринфилдбанк', + 'Грис-Банк', + 'Гута-Банк', + 'Далена', + 'Далетбанк', + 'Далта-Банк', + 'Дальневосточный Банк', + 'Данске Банк', + 'Девон-Кредит', + 'ДельтаКредит', + 'Денизбанк Москва', + 'Держава', + 'Дж. П. Морган Банк', + 'Джаст Банк', + 'Джей энд Ти Банк', + 'Дил-Банк', + 'Динамичные Системы', + 'Дойче Банк', + 'Долинск', + 'Дом-Банк', + 'Дон-Тексбанк', + 'Донкомбанк', + 'Донхлеббанк', + 'Дорис Банк', + 'Дружба', + 'ЕАТП Банк', + 'Евразийский Банк', + 'Евроазиатский Инвестиционный Банк', + 'ЕвроАксис Банк', + 'Евроальянс', + 'Еврокапитал-Альянс', + 'Еврокоммерц', + 'Еврокредит', + 'Евромет', + 'Европейский Стандарт', + 'Европлан Банк', + 'ЕвроситиБанк', + 'Еврофинанс Моснарбанк', + 'Единственный', + 'Единый Строительный Банк', + 'Екатеринбург', + 'Екатерининский', + 'Енисей', + 'Енисейский Объединенный Банк', + 'Ермак', + 'Живаго-Банк', + 'Жилкредит', + 'Жилстройбанк', + 'Запсибкомбанк', + 'Заречье', + 'Заубер Банк', + 'Земкомбанк', + 'Земский Банк', + 'Зенит', + 'Зенит Сочи', + 'Зернобанк', + 'Зираат Банк', + 'Златкомбанк', + 'И.Д.Е.А. Банк', + 'Иваново', + 'Идеалбанк', + 'Ижкомбанк', + 'ИК Банк', + 'Икано Банк', + 'Инбанк', + 'Инвест-Экобанк', + 'Инвестиционный Банк Кубани', + 'Инвестиционный Республиканский Банк', + 'Инвестиционный Союз', + 'Инвесткапиталбанк', + 'Инвестсоцбанк', + 'Инвестторгбанк', + 'ИНГ Банк', + 'Индустриальный Сберегательный Банк', + 'Инкаробанк', + 'Интерактивный Банк', + 'Интеркоммерц Банк', + 'Интеркоопбанк', + 'Интеркредит', + 'Интернациональный Торговый Банк', + 'Интерпрогрессбанк', + 'Интерпромбанк', + 'Интехбанк', + 'Информпрогресс', + 'Ипозембанк', + 'ИпоТек Банк', + 'Иронбанк', + 'ИРС', + 'Итуруп', + 'Ишбанк', + 'Йошкар-Ола', + 'Калуга', + 'Камский Горизонт', + 'Камский Коммерческий Банк', + 'Камчаткомагропромбанк', + 'Канский', + 'Капитал', + 'Капиталбанк', + 'Кедр', + 'Кемсоцинбанк', + 'Кетовский Коммерческий Банк', + 'Киви Банк', + 'Классик Эконом Банк', + 'Клиентский', + 'Кольцо Урала', + 'Коммерцбанк (Евразия)', + 'Коммерческий Банк Развития', + 'Коммерческий Индо Банк', + 'Консервативный Коммерческий Банк', + 'Констанс-Банк', + 'Континенталь', + 'Конфидэнс Банк', + 'Кор', + 'Кореа Эксчендж Банк Рус', + 'Королевский Банк Шотландии', + 'Космос', + 'Костромаселькомбанк', + 'Кошелев-Банк', + 'Крайинвестбанк', + 'Кранбанк', + 'Креди Агриколь КИБ', + 'Кредит Европа Банк', + 'Кредит Урал Банк', + 'Кредит Экспресс', + 'Кредит-Москва', + 'Кредитинвест', + 'Кредо Финанс', + 'Кредпромбанк', + 'Кремлевский', + 'Крокус-Банк', + 'Крона-Банк', + 'Кросна-Банк', + 'Кроссинвестбанк', + 'Крыловский', + 'КС Банк', + 'Кубанский Универсальный Банк', + 'Кубань Кредит', + 'Кубаньторгбанк', + 'Кузбассхимбанк', + 'Кузнецкбизнесбанк', + 'Кузнецкий', + 'Кузнецкий Мост', + 'Курган', + 'Курскпромбанк', + 'Лада-Кредит', + 'Лайтбанк', + 'Ланта-Банк', + 'Левобережный', + 'Легион', + 'Леноблбанк', + 'Лесбанк', + 'Лето Банк', + 'Липецккомбанк', + 'Логос', + 'Локо-Банк', + 'Лэнд-Банк', + 'М2М Прайвет Банк', + 'Майкопбанк', + 'Майский', + 'МАК-Банк', + 'Максима', + 'Максимум', + 'МАСТ-Банк', + 'Мастер-Капитал', + 'МВС Банк', + 'МДМ Банк', + 'Мегаполис', + 'Международный Акционерный Банк', + 'Международный Банк Развития', + 'Международный Банк Санкт-Петербурга (МБСП)', + 'Международный Коммерческий Банк', + 'Международный Расчетный Банк', + 'Международный Строительный Банк', + 'Международный Финансовый Клуб', + 'Межотраслевая Банковская Корпорация', + 'Межрегиональный Банк Реконструкции', + 'Межрегиональный Клиринговый Банк', + 'Межрегиональный Почтовый Банк', + 'Межрегиональный промышленно-строительный банк', + 'Межрегионбанк', + 'Межтопэнергобанк', + 'Межтрастбанк', + 'Мерседес-Бенц Банк Рус', + 'Металлинвестбанк', + 'Металлург', + 'Меткомбанк (Каменск-Уральский)', + 'Меткомбанк (Череповец)', + 'Метробанк', + 'Метрополь', + 'Мидзухо Банк', + 'Мико-Банк', + 'Милбанк', + 'Миллениум Банк', + 'Мир Бизнес Банк', + 'Мираф-Банк', + 'Мираф-Банк Московский филиал', + 'Миръ', + 'Михайловский ПЖСБ', + 'Морган Стэнли Банк', + 'Морской Банк', + 'Мосводоканалбанк', + 'Москва', + 'Москва-Сити', + 'Московский Вексельный Банк', + 'Московский Индустриальный Банк', + 'Московский Коммерческий Банк', + 'Московский Кредитный Банк', + 'Московский Национальный Инвестиционный Банк', + 'Московский Нефтехимический Банк', + 'Московский Областной Банк', + 'Московско-Парижский Банк', + 'Московское Ипотечное Агентство', + 'Москоммерцбанк', + 'Мосстройэкономбанк (М Банк)', + 'Мострансбанк', + 'Мосуралбанк', + 'МС Банк Рус', + 'МСП Банк', + 'МТИ-Банк', + 'МТС Банк', + 'Муниципальный Камчатпрофитбанк', + 'Мурманский Социальный Коммерческий Банк', + 'МФБанк', + 'Н-Банк', + 'Нальчик', + 'Наратбанк', + 'Народный Банк', + 'Народный Банк Республики Тыва', + 'Народный Доверительный Банк', + 'Народный Земельно-Промышленный Банк', + 'Народный Инвестиционный Банк', + 'Натиксис Банк', + 'Нацинвестпромбанк', + 'Национальная Факторинговая Компания', + 'Национальный Банк "Траст"', + 'Национальный Банк Взаимного Кредита', + 'Национальный Банк Сбережений', + 'Национальный Залоговый Банк', + 'Национальный Клиринговый Банк', + 'Национальный Клиринговый Центр', + 'Национальный Корпоративный Банк', + 'Национальный Резервный Банк', + 'Национальный Стандарт', + 'Наш Дом', + 'НБД-Банк', + 'НБК-Банк', + 'Невастройинвест', + 'Невский Банк', + 'Нейва', + 'Нерюнгрибанк', + 'Нефтепромбанк', + 'Нефтяной Альянс', + 'Нижневолжский Коммерческий Банк', + 'Нико-Банк', + 'НК Банк', + 'НоваховКапиталБанк', + 'Новация', + 'Новикомбанк', + 'Новобанк', + 'Новое Время', + 'Новокиб', + 'Новопокровский', + 'Новый Век', + 'Новый Кредитный Союз', + 'Новый Московский Банк', + ]; + + /** + * @example 'Новый Московский Банк' + */ + public static function bank() + { + return static::randomElement(static::$banks); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ru_RU/Person.php b/vendor/fakerphp/faker/src/Faker/Provider/ru_RU/Person.php new file mode 100644 index 00000000..b0e17d4e --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ru_RU/Person.php @@ -0,0 +1,188 @@ +middleNameMale(); + } + + if ($gender === static::GENDER_FEMALE) { + return $this->middleNameFemale(); + } + + return $this->middleName(static::randomElement([ + static::GENDER_MALE, + static::GENDER_FEMALE, + ])); + } + + /** + * Return last name for the specified gender. + * + * @param string|null $gender A gender of the last name should be generated + * for. If the argument is skipped a random gender will be used. + * + * @return string Last name + */ + public function lastName($gender = null) + { + if (static::GENDER_FEMALE === $gender) { + return $this->lastNameFemale(); + } + + if (static::GENDER_MALE === $gender) { + return $this->lastNameMale(); + } + + return static::randomElement(static::$lastName) . static::randomElement(static::$lastNameSuffix); + } + + public function lastNameMale(): string + { + return static::randomElement(static::$lastName); + } + + public function lastNameFemale(): string + { + return static::randomElement(static::$lastName) . 'а'; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/ru_RU/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/ru_RU/PhoneNumber.php new file mode 100644 index 00000000..06f63373 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/ru_RU/PhoneNumber.php @@ -0,0 +1,14 @@ +generator->parse(static::randomElement(static::$lastNameFormat)); + } + + public static function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + public static function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } + + /** + * @example 'PhD' + */ + public static function suffix() + { + return static::randomElement(static::$suffix); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/sk_SK/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/sk_SK/PhoneNumber.php new file mode 100644 index 00000000..bd195e4f --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/sk_SK/PhoneNumber.php @@ -0,0 +1,15 @@ +format('ymd'); + $randomDigits = $this->getBirthNumber($gender); + + $checksum = Luhn::computeCheckDigit($datePart . $randomDigits); + + return $datePart . '-' . $randomDigits . $checksum; + } + + /** + * @param string $gender Person::GENDER_MALE || Person::GENDER_FEMALE + * + * @return string of three digits + */ + protected function getBirthNumber($gender = null) + { + if ($gender && $gender === static::GENDER_MALE) { + return (string) static::numerify('##') . static::randomElement([1, 3, 5, 7, 9]); + } + + $zeroCheck = static function ($callback) { + do { + $randomDigits = $callback(); + } while ($randomDigits === '000'); + + return $randomDigits; + }; + + if ($gender && $gender === static::GENDER_FEMALE) { + return $zeroCheck(static function () { + return (string) static::numerify('##') . static::randomElement([0, 2, 4, 6, 8]); + }); + } + + return $zeroCheck(static function () { + return (string) static::numerify('###'); + }); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/sv_SE/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/sv_SE/PhoneNumber.php new file mode 100644 index 00000000..2d5c5882 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/sv_SE/PhoneNumber.php @@ -0,0 +1,64 @@ + Swedish mobile number formats + */ + protected static array $mobileFormats = [ + '+467########', + '+46(0)7########', + '+46 (0)7## ## ## ##', + '+46 (0)7## ### ###', + '07## ## ## ##', + '07## ### ###', + '07##-## ## ##', + '07##-### ###', + '07# ### ## ##', + '07#-### ## ##', + '07#-#######', + ]; + + public function mobileNumber(): string + { + $format = static::randomElement(static::$mobileFormats); + + return self::numerify($this->generator->parse($format)); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/th_TH/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/th_TH/Address.php new file mode 100644 index 00000000..49182816 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/th_TH/Address.php @@ -0,0 +1,141 @@ +format('a') === 'am' ? 'öö' : 'ös'; + } + + public static function dayOfWeek($max = 'now') + { + $map = [ + 'Sunday' => 'Pazar', + 'Monday' => 'Pazartesi', + 'Tuesday' => 'Salı', + 'Wednesday' => 'Çarşamba', + 'Thursday' => 'Perşembe', + 'Friday' => 'Cuma', + 'Saturday' => 'Cumartesi', + ]; + $week = static::dateTime($max)->format('l'); + + return $map[$week] ?? $week; + } + + public static function monthName($max = 'now') + { + $map = [ + 'January' => 'Ocak', + 'February' => 'Şubat', + 'March' => 'Mart', + 'April' => 'Nisan', + 'May' => 'Mayıs', + 'June' => 'Haziran', + 'July' => 'Temmuz', + 'August' => 'Ağustos', + 'September' => 'Eylül', + 'October' => 'Ekim', + 'November' => 'Kasım', + 'December' => 'Aralık', + ]; + $month = static::dateTime($max)->format('F'); + + return $map[$month] ?? $month; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/tr_TR/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/tr_TR/Internet.php new file mode 100644 index 00000000..9d821119 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/tr_TR/Internet.php @@ -0,0 +1,9 @@ + $digit) { + if ($index % 2 === 0) { + $evenSum += $digit; + } else { + $oddSum += $digit; + } + } + + $tenthDigit = (7 * $evenSum - $oddSum) % 10; + $eleventhDigit = ($evenSum + $oddSum + $tenthDigit) % 10; + + return $tenthDigit . $eleventhDigit; + } + + /** + * Checks whether a TCNo has a valid checksum + * + * @param string $tcNo + * + * @return bool + */ + public static function tcNoIsValid($tcNo) + { + return self::tcNoChecksum(substr($tcNo, 0, -2)) === substr($tcNo, -2, 2); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/tr_TR/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/tr_TR/PhoneNumber.php new file mode 100644 index 00000000..3103c77e --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/tr_TR/PhoneNumber.php @@ -0,0 +1,186 @@ +generator->parse($format); + } + + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/uk_UA/Color.php b/vendor/fakerphp/faker/src/Faker/Provider/uk_UA/Color.php new file mode 100644 index 00000000..502161ce --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/uk_UA/Color.php @@ -0,0 +1,23 @@ +generator->parse($format); + } + + public static function companyPrefix() + { + return static::randomElement(static::$companyPrefix); + } + + public static function companyName() + { + return static::randomElement(static::$companyName); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/uk_UA/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/uk_UA/Internet.php new file mode 100644 index 00000000..61193547 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/uk_UA/Internet.php @@ -0,0 +1,9 @@ +middleNameMale(); + } + + if ($gender === static::GENDER_FEMALE) { + return $this->middleNameFemale(); + } + + return $this->middleName(static::randomElement([ + static::GENDER_MALE, + static::GENDER_FEMALE, + ])); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/uk_UA/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/uk_UA/PhoneNumber.php new file mode 100644 index 00000000..15b443f3 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/uk_UA/PhoneNumber.php @@ -0,0 +1,72 @@ +generator->parse($format)); + } + + public function hamletPrefix() + { + return static::randomElement(static::$hamletPrefix); + } + + public function wardName() + { + $format = static::randomElement(static::$wardNameFormats); + + return static::bothify($this->generator->parse($format)); + } + + public function wardPrefix() + { + return static::randomElement(static::$wardPrefix); + } + + public function districtName() + { + $format = static::randomElement(static::$districtNameFormats); + + return static::bothify($this->generator->parse($format)); + } + + public function districtPrefix() + { + return static::randomElement(static::$districtPrefix); + } + + /** + * @example 'Hà Nội' + */ + public function city() + { + return static::randomElement(static::$city); + } + + /** + * @example 'Bắc Giang' + */ + public static function province() + { + return static::randomElement(static::$province); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/vi_VN/Color.php b/vendor/fakerphp/faker/src/Faker/Provider/vi_VN/Color.php new file mode 100644 index 00000000..df788550 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/vi_VN/Color.php @@ -0,0 +1,36 @@ +generator->parse(static::randomElement(static::$middleNameFormat)); + } + + public static function middleNameMale() + { + return static::randomElement(static::$middleNameMale); + } + + public static function middleNameFemale() + { + return static::randomElement(static::$middleNameFemale); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/vi_VN/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/vi_VN/PhoneNumber.php new file mode 100644 index 00000000..a6f47f15 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/vi_VN/PhoneNumber.php @@ -0,0 +1,61 @@ + [ + '0[a] ### ####', + '(0[a]) ### ####', + '0[a]-###-####', + '(0[a])###-####', + '84-[a]-###-####', + '(84)([a])###-####', + '+84-[a]-###-####', + ], + '8' => [ + '0[a] #### ####', + '(0[a]) #### ####', + '0[a]-####-####', + '(0[a])####-####', + '84-[a]-####-####', + '(84)([a])####-####', + '+84-[a]-####-####', + ], + ]; + + public function phoneNumber() + { + $areaCode = static::randomElement(static::$areaCodes); + $areaCodeLength = strlen($areaCode); + $digits = 7; + + if ($areaCodeLength < 2) { + $digits = 8; + } + + return static::numerify(str_replace('[a]', $areaCode, static::randomElement(static::$formats[$digits]))); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/zh_CN/Address.php b/vendor/fakerphp/faker/src/Faker/Provider/zh_CN/Address.php new file mode 100644 index 00000000..00b9eb77 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/zh_CN/Address.php @@ -0,0 +1,148 @@ +city() . static::area(); + } + + public static function postcode() + { + $prefix = str_pad(self::numberBetween(1, 85), 2, 0, STR_PAD_LEFT); + $suffix = '00'; + + return $prefix . self::numberBetween(10, 88) . $suffix; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/zh_CN/Color.php b/vendor/fakerphp/faker/src/Faker/Provider/zh_CN/Color.php new file mode 100644 index 00000000..254fd071 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/zh_CN/Color.php @@ -0,0 +1,66 @@ +format('a') === 'am' ? '上午' : '下午'; + } + + public static function dayOfWeek($max = 'now') + { + $map = [ + 'Sunday' => '星期日', + 'Monday' => '星期一', + 'Tuesday' => '星期二', + 'Wednesday' => '星期三', + 'Thursday' => '星期四', + 'Friday' => '星期五', + 'Saturday' => '星期六', + ]; + $week = static::dateTime($max)->format('l'); + + return $map[$week] ?? $week; + } + + public static function monthName($max = 'now') + { + $map = [ + 'January' => '一月', + 'February' => '二月', + 'March' => '三月', + 'April' => '四月', + 'May' => '五月', + 'June' => '六月', + 'July' => '七月', + 'August' => '八月', + 'September' => '九月', + 'October' => '十月', + 'November' => '十一月', + 'December' => '十二月', + ]; + $month = static::dateTime($max)->format('F'); + + return $map[$month] ?? $month; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/zh_CN/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/zh_CN/Internet.php new file mode 100644 index 00000000..e1a87964 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/zh_CN/Internet.php @@ -0,0 +1,24 @@ + [ + '板橋區', '三重區', '中和區', '永和區', + '新莊區', '新店區', '樹林區', '鶯歌區', + '三峽區', '淡水區', '汐止區', '瑞芳區', + '土城區', '蘆洲區', '五股區', '泰山區', + '林口區', '深坑區', '石碇區', '坪林區', + '三芝區', '石門區', '八里區', '平溪區', + '雙溪區', '貢寮區', '金山區', '萬里區', + '烏來區', + ], + '宜蘭縣' => [ + '宜蘭市', '羅東鎮', '蘇澳鎮', '頭城鎮', '礁溪鄉', + '壯圍鄉', '員山鄉', '冬山鄉', '五結鄉', '三星鄉', + '大同鄉', '南澳鄉', + ], + '桃園市' => [ + '桃園區', '中壢區', '大溪區', '楊梅區', '蘆竹區', + '大園區', '龜山區', '八德區', '龍潭區', '平鎮區', + '新屋區', '觀音區', '復興區', + ], + '新竹縣' => [ + '竹北市', '竹東鎮', '新埔鎮', '關西鎮', '湖口鄉', + '新豐鄉', '芎林鄉', '橫山鄉', '北埔鄉', '寶山鄉', + '峨眉鄉', '尖石鄉', '五峰鄉', + ], + '苗栗縣' => [ + '苗栗市', '苑裡鎮', '通霄鎮', '竹南鎮', '頭份鎮', + '後龍鎮', '卓蘭鎮', '大湖鄉', '公館鄉', '銅鑼鄉', + '南庄鄉', '頭屋鄉', '三義鄉', '西湖鄉', '造橋鄉', + '三灣鄉', '獅潭鄉', '泰安鄉', + ], + '臺中市' => [ + '豐原區', '東勢區', '大甲區', '清水區', '沙鹿區', + '梧棲區', '后里區', '神岡區', '潭子區', '大雅區', + '新社區', '石岡區', '外埔區', '大安區', '烏日區', + '大肚區', '龍井區', '霧峰區', '太平區', '大里區', + '和平區', '中區', '東區', '南區', '西區', '北區', + '西屯區', '南屯區', '北屯區', + ], + '彰化縣' => [ + '彰化市', '鹿港鎮', '和美鎮', '線西鄉', '伸港鄉', + '福興鄉', '秀水鄉', '花壇鄉', '芬園鄉', '員林鎮', + '溪湖鎮', '田中鎮', '大村鄉', '埔鹽鄉', '埔心鄉', + '永靖鄉', '社頭鄉', '二水鄉', '北斗鎮', '二林鎮', + '田尾鄉', '埤頭鄉', '芳苑鄉', '大城鄉', '竹塘鄉', + '溪州鄉', + ], + '南投縣' => [ + '南投市', '埔里鎮', '草屯鎮', '竹山鎮', '集集鎮', + '名間鄉', '鹿谷鄉', '中寮鄉', '魚池鄉', '國姓鄉', + '水里鄉', '信義鄉', '仁愛鄉', + ], + '雲林縣' => [ + '斗六市', '斗南鎮', '虎尾鎮', '西螺鎮', '土庫鎮', + '北港鎮', '古坑鄉', '大埤鄉', '莿桐鄉', '林內鄉', + '二崙鄉', '崙背鄉', '麥寮鄉', '東勢鄉', '褒忠鄉', + '臺西鄉', '元長鄉', '四湖鄉', '口湖鄉', '水林鄉', + ], + '嘉義縣' => [ + '太保市', '朴子市', '布袋鎮', '大林鎮', '民雄鄉', + '溪口鄉', '新港鄉', '六腳鄉', '東石鄉', '義竹鄉', + '鹿草鄉', '水上鄉', '中埔鄉', '竹崎鄉', '梅山鄉', + '番路鄉', '大埔鄉', '阿里山鄉', + ], + '臺南市' => [ + '新營區', '鹽水區', '白河區', '柳營區', '後壁區', + '東山區', '麻豆區', '下營區', '六甲區', '官田區', + '大內區', '佳里區', '學甲區', '西港區', '七股區', + '將軍區', '北門區', '新化區', '善化區', '新市區', + '安定區', '山上區', '玉井區', '楠西區', '南化區', + '左鎮區', '仁德區', '歸仁區', '關廟區', '龍崎區', + '永康區', '東區', '南區', '西區', '北區', '中區', + '安南區', '安平區', + ], + '高雄市' => [ + '鳳山區', '林園區', '大寮區', '大樹區', '大社區', + '仁武區', '鳥松區', '岡山區', '橋頭區', '燕巢區', + '田寮區', '阿蓮區', '路竹區', '湖內區', '茄萣區', + '永安區', '彌陀區', '梓官區', '旗山區', '美濃區', + '六龜區', '甲仙區', '杉林區', '內門區', '茂林區', + '桃源區', '三民區', '鹽埕區', '鼓山區', '左營區', + '楠梓區', '三民區', '新興區', '前金區', '苓雅區', + '前鎮區', '旗津區', '小港區', + ], + '屏東縣' => [ + '屏東市', '潮州鎮', '東港鎮', '恆春鎮', '萬丹鄉', + '長治鄉', '麟洛鄉', '九如鄉', '里港鄉', '鹽埔鄉', + '高樹鄉', '萬巒鄉', '內埔鄉', '竹田鄉', '新埤鄉', + '枋寮鄉', '新園鄉', '崁頂鄉', '林邊鄉', '南州鄉', + '佳冬鄉', '琉球鄉', '車城鄉', '滿州鄉', '枋山鄉', + '三地門鄉', '霧臺鄉', '瑪家鄉', '泰武鄉', '來義鄉', + '春日鄉', '獅子鄉', '牡丹鄉', + ], + '臺東縣' => [ + '臺東市', '成功鎮', '關山鎮', '卑南鄉', '鹿野鄉', + '池上鄉', '東河鄉', '長濱鄉', '太麻里鄉', '大武鄉', + '綠島鄉', '海端鄉', '延平鄉', '金峰鄉', '達仁鄉', + '蘭嶼鄉', + ], + '花蓮縣' => [ + '花蓮市', '鳳林鎮', '玉里鎮', '新城鄉', '吉安鄉', + '壽豐鄉', '光復鄉', '豐濱鄉', '瑞穗鄉', '富里鄉', + '秀林鄉', '萬榮鄉', '卓溪鄉', + ], + '澎湖縣' => [ + '馬公市', '湖西鄉', '白沙鄉', '西嶼鄉', '望安鄉', + '七美鄉', + ], + '基隆市' => [ + '中正區', '七堵區', '暖暖區', '仁愛區', '中山區', + '安樂區', '信義區', + ], + '新竹市' => [ + '東區', '北區', '香山區', + ], + '嘉義市' => [ + '東區', '西區', + ], + '臺北市' => [ + '松山區', '信義區', '大安區', '中山區', '中正區', + '大同區', '萬華區', '文山區', '南港區', '內湖區', + '士林區', '北投區', + ], + '連江縣' => [ + '南竿鄉', '北竿鄉', '莒光鄉', '東引鄉', + ], + '金門縣' => [ + '金城鎮', '金沙鎮', '金湖鎮', '金寧鄉', '烈嶼鄉', '烏坵鄉', + ], + ]; + + /** + * @see http://terms.naer.edu.tw/download/287/ + */ + protected static $country = [ + '不丹', '中非', '丹麥', '伊朗', '冰島', '剛果', + '加彭', '北韓', '南非', '卡達', '印尼', '印度', + '古巴', '哥德', '埃及', '多哥', '寮國', '尼日', + '巴曼', '巴林', '巴紐', '巴西', '希臘', '帛琉', + '德國', '挪威', '捷克', '教廷', '斐濟', '日本', + '智利', '東加', '查德', '汶萊', '法國', '波蘭', + '波赫', '泰國', '海地', '瑞典', '瑞士', '祕魯', + '秘魯', '約旦', '紐埃', '緬甸', '美國', '聖尼', + '聖普', '肯亞', '芬蘭', '英國', '荷蘭', '葉門', + '蘇丹', '諾魯', '貝南', '越南', '迦彭', + '迦納', '阿曼', '阿聯', '韓國', '馬利', + '以色列', '以色利', '伊拉克', '俄羅斯', + '利比亞', '加拿大', '匈牙利', '南極洲', + '南蘇丹', '厄瓜多', '吉布地', '吐瓦魯', + '哈撒克', '哈薩克', '喀麥隆', '喬治亞', + '土庫曼', '土耳其', '塔吉克', '塞席爾', + '墨西哥', '大西洋', '奧地利', '孟加拉', + '安哥拉', '安地卡', '安道爾', '尚比亞', + '尼伯爾', '尼泊爾', '巴哈馬', '巴拉圭', + '巴拿馬', '巴貝多', '幾內亞', '愛爾蘭', + '所在國', '摩洛哥', '摩納哥', '敍利亞', + '敘利亞', '新加坡', '東帝汶', '柬埔寨', + '比利時', '波扎那', '波札那', '烏克蘭', + '烏干達', '烏拉圭', '牙買加', '獅子山', + '甘比亞', '盧安達', '盧森堡', '科威特', + '科索夫', '科索沃', '立陶宛', '紐西蘭', + '維德角', '義大利', '聖文森', '艾塞亞', + '菲律賓', '萬那杜', '葡萄牙', '蒲隆地', + '蓋亞納', '薩摩亞', '蘇利南', '西班牙', + '貝里斯', '賴索托', '辛巴威', '阿富汗', + '阿根廷', '馬其頓', '馬拉威', '馬爾他', + '黎巴嫩', '亞塞拜然', '亞美尼亞', '保加利亞', + '南斯拉夫', '厄利垂亞', '史瓦濟蘭', '吉爾吉斯', + '吉里巴斯', '哥倫比亞', '坦尚尼亞', '塞內加爾', + '塞内加爾', '塞爾維亞', '多明尼加', '多米尼克', + '奈及利亞', '委內瑞拉', '宏都拉斯', '尼加拉瓜', + '巴基斯坦', '庫克群島', '愛沙尼亞', '拉脫維亞', + '摩爾多瓦', '摩里西斯', '斯洛伐克', '斯里蘭卡', + '格瑞那達', '模里西斯', '波多黎各', '澳大利亞', + '烏茲別克', '玻利維亞', '瓜地馬拉', '白俄羅斯', + '突尼西亞', '納米比亞', '索馬利亞', '索馬尼亞', + '羅馬尼亞', '聖露西亞', '聖馬利諾', '莫三比克', + '莫三鼻克', '葛摩聯盟', '薩爾瓦多', '衣索比亞', + '西薩摩亞', '象牙海岸', '賴比瑞亞', '賽普勒斯', + '馬來西亞', '馬爾地夫', '克羅埃西亞', + '列支敦斯登', '哥斯大黎加', '布吉納法索', + '布吉那法索', '幾內亞比索', '幾內亞比紹', + '斯洛維尼亞', '索羅門群島', '茅利塔尼亞', + '蒙特內哥羅', '赤道幾內亞', '阿爾及利亞', + '阿爾及尼亞', '阿爾巴尼亞', '馬紹爾群島', + '馬達加斯加', '密克羅尼西亞', '沙烏地阿拉伯', + '千里達及托巴哥', + ]; + + protected static $postcode = ['###-##', '###']; + + public function street() + { + return static::randomElement(static::$street); + } + + public static function randomChineseNumber() + { + $digits = [ + '', '一', '二', '三', '四', '五', '六', '七', '八', '九', + ]; + + return $digits[static::randomDigitNotNull()]; + } + + public static function randomNumber2() + { + return static::randomNumber(2) + 1; + } + + public static function randomNumber3() + { + return static::randomNumber(3) + 1; + } + + public static function localLatitude() + { + return static::randomFloat(6, 22, 25); + } + + public static function localLongitude() + { + return static::randomFloat(6, 120, 122); + } + + public function city() + { + $county = static::randomElement(array_keys(static::$city)); + $city = static::randomElement(static::$city[$county]); + + return $county . $city; + } + + public function state() + { + return '臺灣省'; + } + + public static function stateAbbr() + { + return '臺'; + } + + public static function cityPrefix() + { + return ''; + } + + public static function citySuffix() + { + return ''; + } + + public static function secondaryAddress() + { + return (static::randomNumber(2) + 1) . static::randomElement(static::$secondaryAddressSuffix); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/zh_TW/Color.php b/vendor/fakerphp/faker/src/Faker/Provider/zh_TW/Color.php new file mode 100644 index 00000000..19fa6d87 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/zh_TW/Color.php @@ -0,0 +1,66 @@ +generator->parse($format); + } + + public static function companyModifier() + { + return static::randomElement(static::$companyModifier); + } + + public static function companyPrefix() + { + return static::randomElement(static::$companyPrefix); + } + + public function catchPhrase() + { + return static::randomElement(static::$catchPhrase); + } + + public function bs() + { + $result = ''; + + foreach (static::$bsWords as &$word) { + $result .= static::randomElement($word); + } + + return $result; + } + + /** + * return standard VAT / Tax ID / Uniform Serial Number + * + * @example 28263822 + * + * @return int + */ + public function VAT() + { + return static::randomNumber(8, true); + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/zh_TW/DateTime.php b/vendor/fakerphp/faker/src/Faker/Provider/zh_TW/DateTime.php new file mode 100644 index 00000000..102a716c --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/zh_TW/DateTime.php @@ -0,0 +1,48 @@ +format('a') === 'am' ? '上午' : '下午'; + } + + public static function dayOfWeek($max = 'now') + { + $map = [ + 'Sunday' => '星期日', + 'Monday' => '星期一', + 'Tuesday' => '星期二', + 'Wednesday' => '星期三', + 'Thursday' => '星期四', + 'Friday' => '星期五', + 'Saturday' => '星期六', + ]; + $week = static::dateTime($max)->format('l'); + + return $map[$week] ?? $week; + } + + public static function monthName($max = 'now') + { + $map = [ + 'January' => '一月', + 'February' => '二月', + 'March' => '三月', + 'April' => '四月', + 'May' => '五月', + 'June' => '六月', + 'July' => '七月', + 'August' => '八月', + 'September' => '九月', + 'October' => '十月', + 'November' => '十一月', + 'December' => '十二月', + ]; + $month = static::dateTime($max)->format('F'); + + return $map[$month] ?? $month; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/zh_TW/Internet.php b/vendor/fakerphp/faker/src/Faker/Provider/zh_TW/Internet.php new file mode 100644 index 00000000..c3fb5fff --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/zh_TW/Internet.php @@ -0,0 +1,28 @@ + 10, + 'B' => 11, + 'C' => 12, + 'D' => 13, + 'E' => 14, + 'F' => 15, + 'G' => 16, + 'H' => 17, + 'I' => 34, + 'J' => 18, + 'K' => 19, + 'M' => 21, + 'N' => 22, + 'O' => 35, + 'P' => 23, + 'Q' => 24, + 'T' => 27, + 'U' => 28, + 'V' => 29, + 'W' => 32, + 'X' => 30, + 'Z' => 33, + ]; + + /** + * @see https://zh.wikipedia.org/wiki/%E4%B8%AD%E8%8F%AF%E6%B0%91%E5%9C%8B%E5%9C%8B%E6%B0%91%E8%BA%AB%E5%88%86%E8%AD%89 + */ + public static $idDigitValidator = [1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1]; + + protected static $maleNameFormats = [ + '{{lastName}}{{firstNameMale}}', + ]; + + protected static $femaleNameFormats = [ + '{{lastName}}{{firstNameFemale}}', + ]; + + protected static $titleMale = ['先生', '博士', '教授']; + protected static $titleFemale = ['小姐', '太太', '博士', '教授']; + + /** + * @see http://zh.wikipedia.org/wiki/%E7%99%BE%E5%AE%B6%E5%A7%93 + */ + protected static $lastName = [ + '趙', '錢', '孫', '李', '周', '吳', '鄭', '王', '馮', + '陳', '褚', '衛', '蔣', '沈', '韓', '楊', '朱', '秦', + '尤', '許', '何', '呂', '施', '張', '孔', '曹', '嚴', + '華', '金', '魏', '陶', '姜', '戚', '謝', '鄒', '喻', + '柏', '水', '竇', '章', '雲', '蘇', '潘', '葛', + '奚', '范', '彭', '郎', '魯', '韋', '昌', '馬', + '苗', '鳳', '花', '方', '俞', '任', '袁', '柳', + '酆', '鮑', '史', '唐', '費', '廉', '岑', '薛', + '雷', '賀', '倪', '湯', '滕', '殷', '羅', '畢', + '郝', '鄔', '安', '常', '樂', '于', '時', '傅', + '皮', '卞', '齊', '康', '伍', '余', '元', '卜', + '顧', '孟', '平', '黃', '和', '穆', '蕭', '尹', + '姚', '邵', '湛', '汪', '祁', '毛', '禹', '狄', + '米', '貝', '明', '臧', '計', '伏', '成', '戴', + '談', '宋', '茅', '龐', '熊', '紀', '舒', '屈', + '項', '祝', '董', '梁', '杜', '阮', '藍', '閔', + '席', '季', '麻', '強', '賈', '路', '婁', '危', + '江', '童', '顏', '郭', '梅', '盛', '林', '刁', + '鍾', '徐', '丘', '駱', '高', '夏', '蔡', '田', + '樊', '胡', '凌', '霍', '虞', '萬', '支', '柯', + '昝', '管', '盧', '莫', '經', '房', '裘', '繆', + '干', '解', '應', '宗', '丁', '宣', '賁', '鄧', + '郁', '單', '杭', '洪', '包', '諸', '左', '石', + '崔', '吉', '鈕', '龔', '程', '嵇', '邢', '滑', + '裴', '陸', '榮', '翁', '荀', '羊', '於', '惠', + '甄', '麴', '家', '封', '芮', '羿', '儲', '靳', + '汲', '邴', '糜', '松', '井', '段', '富', '巫', + '烏', '焦', '巴', '弓', '牧', '隗', '山', '谷', + '車', '侯', '宓', '蓬', '全', '郗', '班', '仰', + '秋', '仲', '伊', '宮', '甯', '仇', '欒', '暴', + '甘', '鈄', '厲', '戎', '祖', '武', '符', '劉', + '景', '詹', '束', '龍', '葉', '幸', '司', '韶', + '郜', '黎', '薊', '薄', '印', '宿', '白', '懷', + '蒲', '邰', '從', '鄂', '索', '咸', '籍', '賴', + '卓', '藺', '屠', '蒙', '池', '喬', '陰', '鬱', + '胥', '能', '蒼', '雙', '聞', '莘', '黨', '翟', + '譚', '貢', '勞', '逄', '姬', '申', '扶', '堵', + '冉', '宰', '酈', '雍', '郤', '璩', '桑', '桂', + '濮', '牛', '壽', '通', '邊', '扈', '燕', '冀', + '郟', '浦', '尚', '農', '溫', '別', '莊', '晏', + '柴', '瞿', '閻', '充', '慕', '連', '茹', '習', + '宦', '艾', '魚', '容', '向', '古', '易', '慎', + '戈', '廖', '庾', '終', '暨', '居', '衡', '步', + '都', '耿', '滿', '弘', '匡', '國', '文', '寇', + '廣', '祿', '闕', '東', '歐', '殳', '沃', '利', + '蔚', '越', '夔', '隆', '師', '鞏', '厙', '聶', + '晁', '勾', '敖', '融', '冷', '訾', '辛', '闞', + '那', '簡', '饒', '空', '曾', '毋', '沙', '乜', + '養', '鞠', '須', '豐', '巢', '關', '蒯', '相', + '查', '后', '荊', '紅', '游', '竺', '權', '逯', + '蓋', '益', '桓', '公', '万俟', '司馬', '上官', + '歐陽', '夏侯', '諸葛', '聞人', '東方', '赫連', + '皇甫', '尉遲', '公羊', '澹臺', '公冶', '宗政', + '濮陽', '淳于', '單于', '太叔', '申屠', '公孫', + '仲孫', '軒轅', '令狐', '鍾離', '宇文', '長孫', + '慕容', '鮮于', '閭丘', '司徒', '司空', '亓官', + '司寇', '仉', '督', '子車', '顓孫', '端木', '巫馬', + '公西', '漆雕', '樂正', '壤駟', '公良', '拓跋', + '夾谷', '宰父', '穀梁', '晉', '楚', '閆', '法', + '汝', '鄢', '涂', '欽', '段干', '百里', '東郭', + '南門', '呼延', '歸', '海', '羊舌', '微生', '岳', + '帥', '緱', '亢', '況', '後', '有', '琴', '梁丘', + '左丘', '東門', '西門', '商', '牟', '佘', '佴', + '伯', '賞', '南宮', '墨', '哈', '譙', '笪', '年', + '愛', '陽', '佟', '第五', '言', '福', + ]; + + /** + * @see http://technology.chtsai.org/namefreq/ + */ + protected static $characterMale = [ + '佳', '俊', '信', '偉', '傑', '冠', '君', '哲', + '嘉', '威', '宇', '安', '宏', '宗', '宜', '家', + '庭', '廷', '建', '彥', '心', '志', '思', '承', + '文', '柏', '樺', '瑋', '穎', '美', '翰', '華', + '詩', '豪', '賢', '軒', '銘', '霖', + ]; + + protected static $characterFemale = [ + '伶', '佩', '佳', '依', '儀', '冠', '君', '嘉', + '如', '娟', '婉', '婷', '安', '宜', '家', '庭', + '心', '思', '怡', '惠', '慧', '文', '欣', '涵', + '淑', '玲', '珊', '琪', '琬', '瑜', '穎', '筑', + '筱', '美', '芬', '芳', '華', '萍', '萱', '蓉', + '詩', '貞', '郁', '鈺', '雅', '雯', '靜', '馨', + ]; + + public static function randomName($pool, $n) + { + $name = ''; + + for ($i = 0; $i < $n; ++$i) { + $name .= static::randomElement($pool); + } + + return $name; + } + + public static function firstNameMale() + { + return static::randomName(static::$characterMale, self::numberBetween(1, 2)); + } + + public static function firstNameFemale() + { + return static::randomName(static::$characterFemale, self::numberBetween(1, 2)); + } + + public static function suffix() + { + return ''; + } + + /** + * @param string $gender Person::GENDER_MALE || Person::GENDER_FEMALE + * + * @see https://en.wikipedia.org/wiki/National_Identification_Card_(Republic_of_China) + * + * @return string Length 10 alphanumeric characters, begins with 1 latin character (birthplace), + * 1 number (gender) and then 8 numbers (the last one is check digit). + */ + public function personalIdentityNumber($gender = null) + { + $birthPlace = self::randomKey(self::$idBirthplaceCode); + $birthPlaceCode = self::$idBirthplaceCode[$birthPlace]; + + $gender = ($gender != null) ? $gender : self::randomElement([self::GENDER_FEMALE, self::GENDER_MALE]); + $genderCode = ($gender === self::GENDER_MALE) ? 1 : 2; + + $randomNumberCode = self::randomNumber(7, true); + + $codes = str_split($birthPlaceCode . $genderCode . $randomNumberCode); + $total = 0; + + foreach ($codes as $key => $code) { + $total += $code * self::$idDigitValidator[$key]; + } + + $checkSumDigit = 10 - ($total % 10); + + if ($checkSumDigit == 10) { + $checkSumDigit = 0; + } + + return $birthPlace . $genderCode . $randomNumberCode . $checkSumDigit; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/Provider/zh_TW/PhoneNumber.php b/vendor/fakerphp/faker/src/Faker/Provider/zh_TW/PhoneNumber.php new file mode 100644 index 00000000..db9ac327 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/Provider/zh_TW/PhoneNumber.php @@ -0,0 +1,19 @@ + 251: + $temp .= $chars[++$i]; + // no break + case $ord > 247: + $temp .= $chars[++$i]; + // no break + case $ord > 239: + $temp .= $chars[++$i]; + // no break + case $ord > 223: + $temp .= $chars[++$i]; + // no break + case $ord > 191: + $temp .= $chars[++$i]; + } + + $encoding[] = $temp; + } + + return $encoding; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/UniqueGenerator.php b/vendor/fakerphp/faker/src/Faker/UniqueGenerator.php new file mode 100644 index 00000000..fef167b6 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/UniqueGenerator.php @@ -0,0 +1,87 @@ + ['0123' => null], + * 'city' => ['London' => null, 'Tokyo' => null], + * ] + * + * @var array> + */ + protected $uniques = []; + + /** + * @param Extension|Generator $generator + * @param int $maxRetries + * @param array> $uniques + */ + public function __construct($generator, $maxRetries = 10000, &$uniques = []) + { + $this->generator = $generator; + $this->maxRetries = $maxRetries; + $this->uniques = &$uniques; + } + + public function ext(string $id) + { + return new self($this->generator->ext($id), $this->maxRetries, $this->uniques); + } + + /** + * Catch and proxy all generator calls but return only unique values + * + * @param string $attribute + * + * @deprecated Use a method instead. + */ + public function __get($attribute) + { + trigger_deprecation('fakerphp/faker', '1.14', 'Accessing property "%s" is deprecated, use "%s()" instead.', $attribute, $attribute); + + return $this->__call($attribute, []); + } + + /** + * Catch and proxy all generator calls with arguments but return only unique values + * + * @param string $name + * @param array $arguments + */ + public function __call($name, $arguments) + { + if (!isset($this->uniques[$name])) { + $this->uniques[$name] = []; + } + $i = 0; + + do { + $res = call_user_func_array([$this->generator, $name], $arguments); + ++$i; + + if ($i > $this->maxRetries) { + throw new \OverflowException(sprintf('Maximum retries of %d reached without finding a unique value', $this->maxRetries)); + } + } while (array_key_exists(serialize($res), $this->uniques[$name])); + $this->uniques[$name][serialize($res)] = null; + + return $res; + } +} diff --git a/vendor/fakerphp/faker/src/Faker/ValidGenerator.php b/vendor/fakerphp/faker/src/Faker/ValidGenerator.php new file mode 100644 index 00000000..bf409456 --- /dev/null +++ b/vendor/fakerphp/faker/src/Faker/ValidGenerator.php @@ -0,0 +1,78 @@ +valid() + * + * @mixin Generator + */ +class ValidGenerator +{ + protected $generator; + protected $validator; + protected $maxRetries; + + /** + * @param Extension|Generator $generator + * @param callable|null $validator + * @param int $maxRetries + */ + public function __construct($generator, $validator = null, $maxRetries = 10000) + { + if (null === $validator) { + $validator = static function () { + return true; + }; + } elseif (!is_callable($validator)) { + throw new \InvalidArgumentException('valid() only accepts callables as first argument'); + } + $this->generator = $generator; + $this->validator = $validator; + $this->maxRetries = $maxRetries; + } + + public function ext(string $id) + { + return new self($this->generator->ext($id), $this->validator, $this->maxRetries); + } + + /** + * Catch and proxy all generator calls but return only valid values + * + * @param string $attribute + * + * @deprecated Use a method instead. + */ + public function __get($attribute) + { + trigger_deprecation('fakerphp/faker', '1.14', 'Accessing property "%s" is deprecated, use "%s()" instead.', $attribute, $attribute); + + return $this->__call($attribute, []); + } + + /** + * Catch and proxy all generator calls with arguments but return only valid values + * + * @param string $name + * @param array $arguments + */ + public function __call($name, $arguments) + { + $i = 0; + + do { + $res = call_user_func_array([$this->generator, $name], $arguments); + ++$i; + + if ($i > $this->maxRetries) { + throw new \OverflowException(sprintf('Maximum retries of %d reached without finding a valid value', $this->maxRetries)); + } + } while (!call_user_func($this->validator, $res)); + + return $res; + } +} diff --git a/vendor/fakerphp/faker/src/autoload.php b/vendor/fakerphp/faker/src/autoload.php new file mode 100644 index 00000000..a4dfa9ec --- /dev/null +++ b/vendor/fakerphp/faker/src/autoload.php @@ -0,0 +1,29 @@ + +Filipe Dobreira diff --git a/vendor/filp/whoops/CHANGELOG.md b/vendor/filp/whoops/CHANGELOG.md new file mode 100644 index 00000000..0542cc42 --- /dev/null +++ b/vendor/filp/whoops/CHANGELOG.md @@ -0,0 +1,155 @@ +# CHANGELOG + +## v2.15.4 + +* Improve link color in comments. + +## v2.15.3 + +* Improve performance of the syntax highlighting (#758). + +## v2.15.2 + +* Fixed missing code highlight, which additionally led to issue with switching tabs, between application and all frames ([#747](https://github.com/filp/whoops/issues/747)). + +## v2.15.1 + +* Fixed bug with PrettyPageHandler "*Calling `getFrameFilters` method on null*" ([#751](https://github.com/filp/whoops/pull/751)). + +## v2.15.0 + +* Add addFrameFilter ([#749](https://github.com/filp/whoops/pull/749)) + +## v2.14.6 + +* Upgraded prismJS to version `1.29.0` due to security issue ([#741][i741]). + +[i741]: https://github.com/filp/whoops/pull/741 + +## v2.14.5 + +* Allow `ArrayAccess` on super globals. + +## v2.14.4 + +* Fix PHP `5.5` support. +* Allow to use psr/log `2` or `3`. + +## v2.14.3 + +* Support PHP `8.1`. + +## v2.14.1 + +* Fix syntax highlighting scrolling too far. +* Improve the way we detect xdebug linkformat. + +## v2.14.0 + +* Switched syntax highlighting to Prism.js. + +Avoids licensing issues with prettify, and uses a maintained, modern project. + +## v2.13.0 + +* Add Netbeans editor. + +## v2.12.1 + +* Avoid redirecting away from an error. + +## v2.12.0 + +* Hide non-string values in super globals when requested. + +## v2.11.0 + +* Customize exit code. + +## v2.10.0 + +* Better chaining on handler classes. + +## v2.9.2 + +* Fix copy button styles. + +## v2.9.1 + +* Fix xdebug function crash on PHP `8`. + +## v2.9.0 + +* `JsonResponseHandler` includes the exception code. + +## v2.8.0 + +* Support PHP 8. + +## v2.7.3 + +* `PrettyPageHandler` functionality to hide superglobal keys has a clearer name +(`hideSuperglobalKey`). + +## v2.7.2 + +* `PrettyPageHandler` now accepts custom js files. +* `PrettyPageHandler` and `templateHelper` is now accessible through inheritance. + +## v2.7.1 + +* Fix a PHP warning in some cases with anonymous classes. + +## v2.7.0 + +* Added `removeFirstHandler` and `removeLastHandler`. + +## v2.6.0 + +* Fix 2.4.0 `pushHandler` changing the order of handlers. + +## v2.5.1 + +* Fix error messaging in a rare case. + +## v2.5.0 + +* Automatically configure xdebug if available. + +## v2.4.1 + +* Try harder to close all output buffers. + +## v2.4.0 + +* Allow to prepend and append handlers. + +## v2.3.2 + +* Various fixes from the community. + +## v2.3.1 + +* Prevent exception in Whoops when caught exception frame is not related to real file. + +## v2.3.0 + +* Show previous exception messages. + +## v2.2.0 + +* Support PHP `7.2`. + +## v2.1.0 + +* Add a `SystemFacade` to allow clients to override Whoops behavior. +* Show frame arguments in `PrettyPageHandler`. +* Highlight the line with the error. +* Add icons to search on Google and Stack Overflow. + +## v2.0.0 + +Backwards compatibility breaking changes: + +* `Run` class is now `final`. If you inherited from `Run`, please now instead use a custom `SystemFacade` injected into the `Run` constructor, or contribute your changes to our core. +* PHP < 5.5 support dropped. diff --git a/vendor/filp/whoops/LICENSE.md b/vendor/filp/whoops/LICENSE.md new file mode 100644 index 00000000..80407e71 --- /dev/null +++ b/vendor/filp/whoops/LICENSE.md @@ -0,0 +1,19 @@ +# The MIT License + +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/vendor/filp/whoops/SECURITY.md b/vendor/filp/whoops/SECURITY.md new file mode 100644 index 00000000..edfd946d --- /dev/null +++ b/vendor/filp/whoops/SECURITY.md @@ -0,0 +1,12 @@ +# Security Policy + +## Supported Versions + +Only the latest released version of Whoops is supported. +To facilitate upgrades we almost never make backwards-incompatible changes. + +## Reporting a Vulnerability + +Please report vulnerabilities over email, by sending an email to `denis` at `sokolov` dot `cc`. + + diff --git a/vendor/filp/whoops/composer.json b/vendor/filp/whoops/composer.json new file mode 100644 index 00000000..06b5c756 --- /dev/null +++ b/vendor/filp/whoops/composer.json @@ -0,0 +1,45 @@ +{ + "name": "filp/whoops", + "license": "MIT", + "description": "php error handling for cool kids", + "keywords": ["library", "error", "handling", "exception", "whoops", "throwable"], + "homepage": "https://filp.github.io/whoops/", + "authors": [ + { + "name": "Filipe Dobreira", + "homepage": "https://github.com/filp", + "role": "Developer" + } + ], + "scripts": { + "test": "phpunit --testdox tests" + }, + "require": { + "php": "^5.5.9 || ^7.0 || ^8.0", + "psr/log": "^1.0.1 || ^2.0 || ^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.3", + "mockery/mockery": "^0.9 || ^1.0", + "symfony/var-dumper": "^2.6 || ^3.0 || ^4.0 || ^5.0" + }, + "suggest": { + "symfony/var-dumper": "Pretty print complex values better with var-dumper available", + "whoops/soap": "Formats errors as SOAP responses" + }, + "autoload": { + "psr-4": { + "Whoops\\": "src/Whoops/" + } + }, + "autoload-dev": { + "psr-4": { + "Whoops\\": "tests/Whoops/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + } +} diff --git a/vendor/filp/whoops/src/Whoops/Exception/ErrorException.php b/vendor/filp/whoops/src/Whoops/Exception/ErrorException.php new file mode 100644 index 00000000..d74e8231 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Exception/ErrorException.php @@ -0,0 +1,17 @@ + + */ + +namespace Whoops\Exception; + +use ErrorException as BaseErrorException; + +/** + * Wraps ErrorException; mostly used for typing (at least now) + * to easily cleanup the stack trace of redundant info. + */ +class ErrorException extends BaseErrorException +{ +} diff --git a/vendor/filp/whoops/src/Whoops/Exception/Formatter.php b/vendor/filp/whoops/src/Whoops/Exception/Formatter.php new file mode 100644 index 00000000..a041530f --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Exception/Formatter.php @@ -0,0 +1,77 @@ + + */ + +namespace Whoops\Exception; + +use Whoops\Inspector\InspectorInterface; + +class Formatter +{ + /** + * Returns all basic information about the exception in a simple array + * for further convertion to other languages + * @param InspectorInterface $inspector + * @param bool $shouldAddTrace + * @param array $frameFilters + * @return array + */ + public static function formatExceptionAsDataArray(InspectorInterface $inspector, $shouldAddTrace, array $frameFilters = []) + { + $exception = $inspector->getException(); + $response = [ + 'type' => get_class($exception), + 'message' => $exception->getMessage(), + 'code' => $exception->getCode(), + 'file' => $exception->getFile(), + 'line' => $exception->getLine(), + ]; + + if ($shouldAddTrace) { + $frames = $inspector->getFrames($frameFilters); + $frameData = []; + + foreach ($frames as $frame) { + /** @var Frame $frame */ + $frameData[] = [ + 'file' => $frame->getFile(), + 'line' => $frame->getLine(), + 'function' => $frame->getFunction(), + 'class' => $frame->getClass(), + 'args' => $frame->getArgs(), + ]; + } + + $response['trace'] = $frameData; + } + + return $response; + } + + public static function formatExceptionPlain(InspectorInterface $inspector) + { + $message = $inspector->getException()->getMessage(); + $frames = $inspector->getFrames(); + + $plain = $inspector->getExceptionName(); + $plain .= ' thrown with message "'; + $plain .= $message; + $plain .= '"'."\n\n"; + + $plain .= "Stacktrace:\n"; + foreach ($frames as $i => $frame) { + $plain .= "#". (count($frames) - $i - 1). " "; + $plain .= $frame->getClass() ?: ''; + $plain .= $frame->getClass() && $frame->getFunction() ? ":" : ""; + $plain .= $frame->getFunction() ?: ''; + $plain .= ' in '; + $plain .= ($frame->getFile() ?: '<#unknown>'); + $plain .= ':'; + $plain .= (int) $frame->getLine(). "\n"; + } + + return $plain; + } +} diff --git a/vendor/filp/whoops/src/Whoops/Exception/Frame.php b/vendor/filp/whoops/src/Whoops/Exception/Frame.php new file mode 100644 index 00000000..469070e2 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Exception/Frame.php @@ -0,0 +1,311 @@ + + */ + +namespace Whoops\Exception; + +use InvalidArgumentException; +use Serializable; + +class Frame implements Serializable +{ + /** + * @var array + */ + protected $frame; + + /** + * @var string + */ + protected $fileContentsCache; + + /** + * @var array[] + */ + protected $comments = []; + + /** + * @var bool + */ + protected $application; + + public function __construct(array $frame) + { + $this->frame = $frame; + } + + /** + * @param bool $shortened + * @return string|null + */ + public function getFile($shortened = false) + { + if (empty($this->frame['file'])) { + return null; + } + + $file = $this->frame['file']; + + // Check if this frame occurred within an eval(). + // @todo: This can be made more reliable by checking if we've entered + // eval() in a previous trace, but will need some more work on the upper + // trace collector(s). + if (preg_match('/^(.*)\((\d+)\) : (?:eval\(\)\'d|assert) code$/', $file, $matches)) { + $file = $this->frame['file'] = $matches[1]; + $this->frame['line'] = (int) $matches[2]; + } + + if ($shortened && is_string($file)) { + // Replace the part of the path that all frames have in common, and add 'soft hyphens' for smoother line-breaks. + $dirname = dirname(dirname(dirname(dirname(dirname(dirname(__DIR__)))))); + if ($dirname !== '/') { + $file = str_replace($dirname, "…", $file); + } + $file = str_replace("/", "/­", $file); + } + + return $file; + } + + /** + * @return int|null + */ + public function getLine() + { + return isset($this->frame['line']) ? $this->frame['line'] : null; + } + + /** + * @return string|null + */ + public function getClass() + { + return isset($this->frame['class']) ? $this->frame['class'] : null; + } + + /** + * @return string|null + */ + public function getFunction() + { + return isset($this->frame['function']) ? $this->frame['function'] : null; + } + + /** + * @return array + */ + public function getArgs() + { + return isset($this->frame['args']) ? (array) $this->frame['args'] : []; + } + + /** + * Returns the full contents of the file for this frame, + * if it's known. + * @return string|null + */ + public function getFileContents() + { + if ($this->fileContentsCache === null && $filePath = $this->getFile()) { + // Leave the stage early when 'Unknown' or '[internal]' is passed + // this would otherwise raise an exception when + // open_basedir is enabled. + if ($filePath === "Unknown" || $filePath === '[internal]') { + return null; + } + + try { + $this->fileContentsCache = file_get_contents($filePath); + } catch (ErrorException $exception) { + // Internal file paths of PHP extensions cannot be opened + } + } + + return $this->fileContentsCache; + } + + /** + * Adds a comment to this frame, that can be received and + * used by other handlers. For example, the PrettyPage handler + * can attach these comments under the code for each frame. + * + * An interesting use for this would be, for example, code analysis + * & annotations. + * + * @param string $comment + * @param string $context Optional string identifying the origin of the comment + */ + public function addComment($comment, $context = 'global') + { + $this->comments[] = [ + 'comment' => $comment, + 'context' => $context, + ]; + } + + /** + * Returns all comments for this frame. Optionally allows + * a filter to only retrieve comments from a specific + * context. + * + * @param string $filter + * @return array[] + */ + public function getComments($filter = null) + { + $comments = $this->comments; + + if ($filter !== null) { + $comments = array_filter($comments, function ($c) use ($filter) { + return $c['context'] == $filter; + }); + } + + return $comments; + } + + /** + * Returns the array containing the raw frame data from which + * this Frame object was built + * + * @return array + */ + public function getRawFrame() + { + return $this->frame; + } + + /** + * Returns the contents of the file for this frame as an + * array of lines, and optionally as a clamped range of lines. + * + * NOTE: lines are 0-indexed + * + * @example + * Get all lines for this file + * $frame->getFileLines(); // => array( 0 => ' '...', ...) + * @example + * Get one line for this file, starting at line 10 (zero-indexed, remember!) + * $frame->getFileLines(9, 1); // array( 9 => '...' ) + * + * @throws InvalidArgumentException if $length is less than or equal to 0 + * @param int $start + * @param int $length + * @return string[]|null + */ + public function getFileLines($start = 0, $length = null) + { + if (null !== ($contents = $this->getFileContents())) { + $lines = explode("\n", $contents); + + // Get a subset of lines from $start to $end + if ($length !== null) { + $start = (int) $start; + $length = (int) $length; + if ($start < 0) { + $start = 0; + } + + if ($length <= 0) { + throw new InvalidArgumentException( + "\$length($length) cannot be lower or equal to 0" + ); + } + + $lines = array_slice($lines, $start, $length, true); + } + + return $lines; + } + } + + /** + * Implements the Serializable interface, with special + * steps to also save the existing comments. + * + * @see Serializable::serialize + * @return string + */ + public function serialize() + { + $frame = $this->frame; + if (!empty($this->comments)) { + $frame['_comments'] = $this->comments; + } + + return serialize($frame); + } + + public function __serialize() + { + $frame = $this->frame; + if (!empty($this->comments)) { + $frame['_comments'] = $this->comments; + } + return $frame; + } + + /** + * Unserializes the frame data, while also preserving + * any existing comment data. + * + * @see Serializable::unserialize + * @param string $serializedFrame + */ + public function unserialize($serializedFrame) + { + $frame = unserialize($serializedFrame); + + if (!empty($frame['_comments'])) { + $this->comments = $frame['_comments']; + unset($frame['_comments']); + } + + $this->frame = $frame; + } + + public function __unserialize($frame) + { + if (!empty($frame['_comments'])) { + $this->comments = $frame['_comments']; + unset($frame['_comments']); + } + + $this->frame = $frame; + } + + /** + * Compares Frame against one another + * @param Frame $frame + * @return bool + */ + public function equals(Frame $frame) + { + if (!$this->getFile() || $this->getFile() === 'Unknown' || !$this->getLine()) { + return false; + } + return $frame->getFile() === $this->getFile() && $frame->getLine() === $this->getLine(); + } + + /** + * Returns whether this frame belongs to the application or not. + * + * @return boolean + */ + public function isApplication() + { + return $this->application; + } + + /** + * Mark as an frame belonging to the application. + * + * @param boolean $application + */ + public function setApplication($application) + { + $this->application = $application; + } +} diff --git a/vendor/filp/whoops/src/Whoops/Exception/FrameCollection.php b/vendor/filp/whoops/src/Whoops/Exception/FrameCollection.php new file mode 100644 index 00000000..922c035f --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Exception/FrameCollection.php @@ -0,0 +1,219 @@ + + */ + +namespace Whoops\Exception; + +use ArrayAccess; +use ArrayIterator; +use Countable; +use IteratorAggregate; +use ReturnTypeWillChange; +use Serializable; +use UnexpectedValueException; + +/** + * Exposes a fluent interface for dealing with an ordered list + * of stack-trace frames. + */ +class FrameCollection implements ArrayAccess, IteratorAggregate, Serializable, Countable +{ + /** + * @var array[] + */ + private $frames; + + public function __construct(array $frames) + { + $this->frames = array_map(function ($frame) { + return new Frame($frame); + }, $frames); + } + + /** + * Filters frames using a callable, returns the same FrameCollection + * + * @param callable $callable + * @return FrameCollection + */ + public function filter($callable) + { + $this->frames = array_values(array_filter($this->frames, $callable)); + return $this; + } + + /** + * Map the collection of frames + * + * @param callable $callable + * @return FrameCollection + */ + public function map($callable) + { + // Contain the map within a higher-order callable + // that enforces type-correctness for the $callable + $this->frames = array_map(function ($frame) use ($callable) { + $frame = call_user_func($callable, $frame); + + if (!$frame instanceof Frame) { + throw new UnexpectedValueException( + "Callable to " . __CLASS__ . "::map must return a Frame object" + ); + } + + return $frame; + }, $this->frames); + + return $this; + } + + /** + * Returns an array with all frames, does not affect + * the internal array. + * + * @todo If this gets any more complex than this, + * have getIterator use this method. + * @see FrameCollection::getIterator + * @return array + */ + public function getArray() + { + return $this->frames; + } + + /** + * @see IteratorAggregate::getIterator + * @return ArrayIterator + */ + #[ReturnTypeWillChange] + public function getIterator() + { + return new ArrayIterator($this->frames); + } + + /** + * @see ArrayAccess::offsetExists + * @param int $offset + */ + #[ReturnTypeWillChange] + public function offsetExists($offset) + { + return isset($this->frames[$offset]); + } + + /** + * @see ArrayAccess::offsetGet + * @param int $offset + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->frames[$offset]; + } + + /** + * @see ArrayAccess::offsetSet + * @param int $offset + */ + #[ReturnTypeWillChange] + public function offsetSet($offset, $value) + { + throw new \Exception(__CLASS__ . ' is read only'); + } + + /** + * @see ArrayAccess::offsetUnset + * @param int $offset + */ + #[ReturnTypeWillChange] + public function offsetUnset($offset) + { + throw new \Exception(__CLASS__ . ' is read only'); + } + + /** + * @see Countable::count + * @return int + */ + #[ReturnTypeWillChange] + public function count() + { + return count($this->frames); + } + + /** + * Count the frames that belongs to the application. + * + * @return int + */ + public function countIsApplication() + { + return count(array_filter($this->frames, function (Frame $f) { + return $f->isApplication(); + })); + } + + /** + * @see Serializable::serialize + * @return string + */ + #[ReturnTypeWillChange] + public function serialize() + { + return serialize($this->frames); + } + + /** + * @see Serializable::unserialize + * @param string $serializedFrames + */ + #[ReturnTypeWillChange] + public function unserialize($serializedFrames) + { + $this->frames = unserialize($serializedFrames); + } + + public function __serialize() + { + return $this->frames; + } + + public function __unserialize(array $serializedFrames) + { + $this->frames = $serializedFrames; + } + + /** + * @param Frame[] $frames Array of Frame instances, usually from $e->getPrevious() + */ + public function prependFrames(array $frames) + { + $this->frames = array_merge($frames, $this->frames); + } + + /** + * Gets the innermost part of stack trace that is not the same as that of outer exception + * + * @param FrameCollection $parentFrames Outer exception frames to compare tail against + * @return Frame[] + */ + public function topDiff(FrameCollection $parentFrames) + { + $diff = $this->frames; + + $parentFrames = $parentFrames->getArray(); + $p = count($parentFrames)-1; + + for ($i = count($diff)-1; $i >= 0 && $p >= 0; $i--) { + /** @var Frame $tailFrame */ + $tailFrame = $diff[$i]; + if ($tailFrame->equals($parentFrames[$p])) { + unset($diff[$i]); + } + $p--; + } + return $diff; + } +} diff --git a/vendor/filp/whoops/src/Whoops/Exception/Inspector.php b/vendor/filp/whoops/src/Whoops/Exception/Inspector.php new file mode 100644 index 00000000..a183563c --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Exception/Inspector.php @@ -0,0 +1,341 @@ + + */ + +namespace Whoops\Exception; + +use Whoops\Inspector\InspectorFactory; +use Whoops\Inspector\InspectorInterface; +use Whoops\Util\Misc; + +class Inspector implements InspectorInterface +{ + /** + * @var \Throwable + */ + private $exception; + + /** + * @var \Whoops\Exception\FrameCollection + */ + private $frames; + + /** + * @var \Whoops\Exception\Inspector + */ + private $previousExceptionInspector; + + /** + * @var \Throwable[] + */ + private $previousExceptions; + + /** + * @var \Whoops\Inspector\InspectorFactoryInterface|null + */ + protected $inspectorFactory; + + /** + * @param \Throwable $exception The exception to inspect + * @param \Whoops\Inspector\InspectorFactoryInterface $factory + */ + public function __construct($exception, $factory = null) + { + $this->exception = $exception; + $this->inspectorFactory = $factory ?: new InspectorFactory(); + } + + /** + * @return \Throwable + */ + public function getException() + { + return $this->exception; + } + + /** + * @return string + */ + public function getExceptionName() + { + return get_class($this->exception); + } + + /** + * @return string + */ + public function getExceptionMessage() + { + return $this->extractDocrefUrl($this->exception->getMessage())['message']; + } + + /** + * @return string[] + */ + public function getPreviousExceptionMessages() + { + return array_map(function ($prev) { + /** @var \Throwable $prev */ + return $this->extractDocrefUrl($prev->getMessage())['message']; + }, $this->getPreviousExceptions()); + } + + /** + * @return int[] + */ + public function getPreviousExceptionCodes() + { + return array_map(function ($prev) { + /** @var \Throwable $prev */ + return $prev->getCode(); + }, $this->getPreviousExceptions()); + } + + /** + * Returns a url to the php-manual related to the underlying error - when available. + * + * @return string|null + */ + public function getExceptionDocrefUrl() + { + return $this->extractDocrefUrl($this->exception->getMessage())['url']; + } + + private function extractDocrefUrl($message) + { + $docref = [ + 'message' => $message, + 'url' => null, + ]; + + // php embbeds urls to the manual into the Exception message with the following ini-settings defined + // http://php.net/manual/en/errorfunc.configuration.php#ini.docref-root + if (!ini_get('html_errors') || !ini_get('docref_root')) { + return $docref; + } + + $pattern = "/\[(?:[^<]+)<\/a>\]/"; + if (preg_match($pattern, $message, $matches)) { + // -> strip those automatically generated links from the exception message + $docref['message'] = preg_replace($pattern, '', $message, 1); + $docref['url'] = $matches[1]; + } + + return $docref; + } + + /** + * Does the wrapped Exception has a previous Exception? + * @return bool + */ + public function hasPreviousException() + { + return $this->previousExceptionInspector || $this->exception->getPrevious(); + } + + /** + * Returns an Inspector for a previous Exception, if any. + * @todo Clean this up a bit, cache stuff a bit better. + * @return Inspector + */ + public function getPreviousExceptionInspector() + { + if ($this->previousExceptionInspector === null) { + $previousException = $this->exception->getPrevious(); + + if ($previousException) { + $this->previousExceptionInspector = $this->inspectorFactory->create($previousException); + } + } + + return $this->previousExceptionInspector; + } + + + /** + * Returns an array of all previous exceptions for this inspector's exception + * @return \Throwable[] + */ + public function getPreviousExceptions() + { + if ($this->previousExceptions === null) { + $this->previousExceptions = []; + + $prev = $this->exception->getPrevious(); + while ($prev !== null) { + $this->previousExceptions[] = $prev; + $prev = $prev->getPrevious(); + } + } + + return $this->previousExceptions; + } + + /** + * Returns an iterator for the inspected exception's + * frames. + * + * @param array $frameFilters + * + * @return \Whoops\Exception\FrameCollection + */ + public function getFrames(array $frameFilters = []) + { + if ($this->frames === null) { + $frames = $this->getTrace($this->exception); + + // Fill empty line/file info for call_user_func_array usages (PHP Bug #44428) + foreach ($frames as $k => $frame) { + if (empty($frame['file'])) { + // Default values when file and line are missing + $file = '[internal]'; + $line = 0; + + $next_frame = !empty($frames[$k + 1]) ? $frames[$k + 1] : []; + + if ($this->isValidNextFrame($next_frame)) { + $file = $next_frame['file']; + $line = $next_frame['line']; + } + + $frames[$k]['file'] = $file; + $frames[$k]['line'] = $line; + } + } + + // Find latest non-error handling frame index ($i) used to remove error handling frames + $i = 0; + foreach ($frames as $k => $frame) { + if ($frame['file'] == $this->exception->getFile() && $frame['line'] == $this->exception->getLine()) { + $i = $k; + } + } + + // Remove error handling frames + if ($i > 0) { + array_splice($frames, 0, $i); + } + + $firstFrame = $this->getFrameFromException($this->exception); + array_unshift($frames, $firstFrame); + + $this->frames = new FrameCollection($frames); + + if ($previousInspector = $this->getPreviousExceptionInspector()) { + // Keep outer frame on top of the inner one + $outerFrames = $this->frames; + $newFrames = clone $previousInspector->getFrames(); + // I assume it will always be set, but let's be safe + if (isset($newFrames[0])) { + $newFrames[0]->addComment( + $previousInspector->getExceptionMessage(), + 'Exception message:' + ); + } + $newFrames->prependFrames($outerFrames->topDiff($newFrames)); + $this->frames = $newFrames; + } + + // Apply frame filters callbacks on the frames stack + if (!empty($frameFilters)) { + foreach ($frameFilters as $filterCallback) { + $this->frames->filter($filterCallback); + } + } + } + + return $this->frames; + } + + /** + * Gets the backtrace from an exception. + * + * If xdebug is installed + * + * @param \Throwable $e + * @return array + */ + protected function getTrace($e) + { + $traces = $e->getTrace(); + + // Get trace from xdebug if enabled, failure exceptions only trace to the shutdown handler by default + if (!$e instanceof \ErrorException) { + return $traces; + } + + if (!Misc::isLevelFatal($e->getSeverity())) { + return $traces; + } + + if (!extension_loaded('xdebug') || !function_exists('xdebug_is_enabled') || !xdebug_is_enabled()) { + return $traces; + } + + // Use xdebug to get the full stack trace and remove the shutdown handler stack trace + $stack = array_reverse(xdebug_get_function_stack()); + $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); + $traces = array_diff_key($stack, $trace); + + return $traces; + } + + /** + * Given an exception, generates an array in the format + * generated by Exception::getTrace() + * @param \Throwable $exception + * @return array + */ + protected function getFrameFromException($exception) + { + return [ + 'file' => $exception->getFile(), + 'line' => $exception->getLine(), + 'class' => get_class($exception), + 'args' => [ + $exception->getMessage(), + ], + ]; + } + + /** + * Given an error, generates an array in the format + * generated by ErrorException + * @param ErrorException $exception + * @return array + */ + protected function getFrameFromError(ErrorException $exception) + { + return [ + 'file' => $exception->getFile(), + 'line' => $exception->getLine(), + 'class' => null, + 'args' => [], + ]; + } + + /** + * Determine if the frame can be used to fill in previous frame's missing info + * happens for call_user_func and call_user_func_array usages (PHP Bug #44428) + * + * @return bool + */ + protected function isValidNextFrame(array $frame) + { + if (empty($frame['file'])) { + return false; + } + + if (empty($frame['line'])) { + return false; + } + + if (empty($frame['function']) || !stristr($frame['function'], 'call_user_func')) { + return false; + } + + return true; + } +} diff --git a/vendor/filp/whoops/src/Whoops/Handler/CallbackHandler.php b/vendor/filp/whoops/src/Whoops/Handler/CallbackHandler.php new file mode 100644 index 00000000..cc46e700 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Handler/CallbackHandler.php @@ -0,0 +1,52 @@ + + */ + +namespace Whoops\Handler; + +use InvalidArgumentException; + +/** + * Wrapper for Closures passed as handlers. Can be used + * directly, or will be instantiated automagically by Whoops\Run + * if passed to Run::pushHandler + */ +class CallbackHandler extends Handler +{ + /** + * @var callable + */ + protected $callable; + + /** + * @throws InvalidArgumentException If argument is not callable + * @param callable $callable + */ + public function __construct($callable) + { + if (!is_callable($callable)) { + throw new InvalidArgumentException( + 'Argument to ' . __METHOD__ . ' must be valid callable' + ); + } + + $this->callable = $callable; + } + + /** + * @return int|null + */ + public function handle() + { + $exception = $this->getException(); + $inspector = $this->getInspector(); + $run = $this->getRun(); + $callable = $this->callable; + + // invoke the callable directly, to get simpler stacktraces (in comparison to call_user_func). + // this assumes that $callable is a properly typed php-callable, which we check in __construct(). + return $callable($exception, $inspector, $run); + } +} diff --git a/vendor/filp/whoops/src/Whoops/Handler/Handler.php b/vendor/filp/whoops/src/Whoops/Handler/Handler.php new file mode 100644 index 00000000..21435fcb --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Handler/Handler.php @@ -0,0 +1,95 @@ + + */ + +namespace Whoops\Handler; + +use Whoops\Inspector\InspectorInterface; +use Whoops\RunInterface; + +/** + * Abstract implementation of a Handler. + */ +abstract class Handler implements HandlerInterface +{ + /* + Return constants that can be returned from Handler::handle + to message the handler walker. + */ + const DONE = 0x10; // returning this is optional, only exists for + // semantic purposes + /** + * The Handler has handled the Throwable in some way, and wishes to skip any other Handler. + * Execution will continue. + */ + const LAST_HANDLER = 0x20; + /** + * The Handler has handled the Throwable in some way, and wishes to quit/stop execution + */ + const QUIT = 0x30; + + /** + * @var RunInterface + */ + private $run; + + /** + * @var InspectorInterface $inspector + */ + private $inspector; + + /** + * @var \Throwable $exception + */ + private $exception; + + /** + * @param RunInterface $run + */ + public function setRun(RunInterface $run) + { + $this->run = $run; + } + + /** + * @return RunInterface + */ + protected function getRun() + { + return $this->run; + } + + /** + * @param InspectorInterface $inspector + */ + public function setInspector(InspectorInterface $inspector) + { + $this->inspector = $inspector; + } + + /** + * @return InspectorInterface + */ + protected function getInspector() + { + return $this->inspector; + } + + /** + * @param \Throwable $exception + */ + public function setException($exception) + { + $this->exception = $exception; + } + + /** + * @return \Throwable + */ + protected function getException() + { + return $this->exception; + } +} diff --git a/vendor/filp/whoops/src/Whoops/Handler/HandlerInterface.php b/vendor/filp/whoops/src/Whoops/Handler/HandlerInterface.php new file mode 100644 index 00000000..2deae989 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Handler/HandlerInterface.php @@ -0,0 +1,36 @@ + + */ + +namespace Whoops\Handler; + +use Whoops\Inspector\InspectorInterface; +use Whoops\RunInterface; + +interface HandlerInterface +{ + /** + * @return int|null A handler may return nothing, or a Handler::HANDLE_* constant + */ + public function handle(); + + /** + * @param RunInterface $run + * @return void + */ + public function setRun(RunInterface $run); + + /** + * @param \Throwable $exception + * @return void + */ + public function setException($exception); + + /** + * @param InspectorInterface $inspector + * @return void + */ + public function setInspector(InspectorInterface $inspector); +} diff --git a/vendor/filp/whoops/src/Whoops/Handler/JsonResponseHandler.php b/vendor/filp/whoops/src/Whoops/Handler/JsonResponseHandler.php new file mode 100644 index 00000000..9051b36b --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Handler/JsonResponseHandler.php @@ -0,0 +1,90 @@ + + */ + +namespace Whoops\Handler; + +use Whoops\Exception\Formatter; + +/** + * Catches an exception and converts it to a JSON + * response. Additionally can also return exception + * frames for consumption by an API. + */ +class JsonResponseHandler extends Handler +{ + /** + * @var bool + */ + private $returnFrames = false; + + /** + * @var bool + */ + private $jsonApi = false; + + /** + * Returns errors[[]] instead of error[] to be in compliance with the json:api spec + * @param bool $jsonApi Default is false + * @return static + */ + public function setJsonApi($jsonApi = false) + { + $this->jsonApi = (bool) $jsonApi; + return $this; + } + + /** + * @param bool|null $returnFrames + * @return bool|static + */ + public function addTraceToOutput($returnFrames = null) + { + if (func_num_args() == 0) { + return $this->returnFrames; + } + + $this->returnFrames = (bool) $returnFrames; + return $this; + } + + /** + * @return int + */ + public function handle() + { + if ($this->jsonApi === true) { + $response = [ + 'errors' => [ + Formatter::formatExceptionAsDataArray( + $this->getInspector(), + $this->addTraceToOutput(), + $this->getRun()->getFrameFilters() + ), + ] + ]; + } else { + $response = [ + 'error' => Formatter::formatExceptionAsDataArray( + $this->getInspector(), + $this->addTraceToOutput(), + $this->getRun()->getFrameFilters() + ), + ]; + } + + echo json_encode($response, defined('JSON_PARTIAL_OUTPUT_ON_ERROR') ? JSON_PARTIAL_OUTPUT_ON_ERROR : 0); + + return Handler::QUIT; + } + + /** + * @return string + */ + public function contentType() + { + return 'application/json'; + } +} diff --git a/vendor/filp/whoops/src/Whoops/Handler/PlainTextHandler.php b/vendor/filp/whoops/src/Whoops/Handler/PlainTextHandler.php new file mode 100644 index 00000000..ea38b765 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Handler/PlainTextHandler.php @@ -0,0 +1,359 @@ + +* Plaintext handler for command line and logs. +* @author Pierre-Yves Landuré +*/ + +namespace Whoops\Handler; + +use InvalidArgumentException; +use Psr\Log\LoggerInterface; +use Whoops\Exception\Frame; + +/** +* Handler outputing plaintext error messages. Can be used +* directly, or will be instantiated automagically by Whoops\Run +* if passed to Run::pushHandler +*/ +class PlainTextHandler extends Handler +{ + const VAR_DUMP_PREFIX = ' | '; + + /** + * @var \Psr\Log\LoggerInterface + */ + protected $logger; + + /** + * @var callable + */ + protected $dumper; + + /** + * @var bool + */ + private $addTraceToOutput = true; + + /** + * @var bool|integer + */ + private $addTraceFunctionArgsToOutput = false; + + /** + * @var integer + */ + private $traceFunctionArgsOutputLimit = 1024; + + /** + * @var bool + */ + private $addPreviousToOutput = true; + + /** + * @var bool + */ + private $loggerOnly = false; + + /** + * Constructor. + * @throws InvalidArgumentException If argument is not null or a LoggerInterface + * @param \Psr\Log\LoggerInterface|null $logger + */ + public function __construct($logger = null) + { + $this->setLogger($logger); + } + + /** + * Set the output logger interface. + * @throws InvalidArgumentException If argument is not null or a LoggerInterface + * @param \Psr\Log\LoggerInterface|null $logger + */ + public function setLogger($logger = null) + { + if (! (is_null($logger) + || $logger instanceof LoggerInterface)) { + throw new InvalidArgumentException( + 'Argument to ' . __METHOD__ . + " must be a valid Logger Interface (aka. Monolog), " . + get_class($logger) . ' given.' + ); + } + + $this->logger = $logger; + } + + /** + * @return \Psr\Log\LoggerInterface|null + */ + public function getLogger() + { + return $this->logger; + } + + /** + * Set var dumper callback function. + * + * @param callable $dumper + * @return static + */ + public function setDumper(callable $dumper) + { + $this->dumper = $dumper; + return $this; + } + + /** + * Add error trace to output. + * @param bool|null $addTraceToOutput + * @return bool|static + */ + public function addTraceToOutput($addTraceToOutput = null) + { + if (func_num_args() == 0) { + return $this->addTraceToOutput; + } + + $this->addTraceToOutput = (bool) $addTraceToOutput; + return $this; + } + + /** + * Add previous exceptions to output. + * @param bool|null $addPreviousToOutput + * @return bool|static + */ + public function addPreviousToOutput($addPreviousToOutput = null) + { + if (func_num_args() == 0) { + return $this->addPreviousToOutput; + } + + $this->addPreviousToOutput = (bool) $addPreviousToOutput; + return $this; + } + + /** + * Add error trace function arguments to output. + * Set to True for all frame args, or integer for the n first frame args. + * @param bool|integer|null $addTraceFunctionArgsToOutput + * @return static|bool|integer + */ + public function addTraceFunctionArgsToOutput($addTraceFunctionArgsToOutput = null) + { + if (func_num_args() == 0) { + return $this->addTraceFunctionArgsToOutput; + } + + if (! is_integer($addTraceFunctionArgsToOutput)) { + $this->addTraceFunctionArgsToOutput = (bool) $addTraceFunctionArgsToOutput; + } else { + $this->addTraceFunctionArgsToOutput = $addTraceFunctionArgsToOutput; + } + return $this; + } + + /** + * Set the size limit in bytes of frame arguments var_dump output. + * If the limit is reached, the var_dump output is discarded. + * Prevent memory limit errors. + * @var integer + * @return static + */ + public function setTraceFunctionArgsOutputLimit($traceFunctionArgsOutputLimit) + { + $this->traceFunctionArgsOutputLimit = (integer) $traceFunctionArgsOutputLimit; + return $this; + } + + /** + * Create plain text response and return it as a string + * @return string + */ + public function generateResponse() + { + $exception = $this->getException(); + $message = $this->getExceptionOutput($exception); + + if ($this->addPreviousToOutput) { + $previous = $exception->getPrevious(); + while ($previous) { + $message .= "\n\nCaused by\n" . $this->getExceptionOutput($previous); + $previous = $previous->getPrevious(); + } + } + + + return $message . $this->getTraceOutput() . "\n"; + } + + /** + * Get the size limit in bytes of frame arguments var_dump output. + * If the limit is reached, the var_dump output is discarded. + * Prevent memory limit errors. + * @return integer + */ + public function getTraceFunctionArgsOutputLimit() + { + return $this->traceFunctionArgsOutputLimit; + } + + /** + * Only output to logger. + * @param bool|null $loggerOnly + * @return static|bool + */ + public function loggerOnly($loggerOnly = null) + { + if (func_num_args() == 0) { + return $this->loggerOnly; + } + + $this->loggerOnly = (bool) $loggerOnly; + return $this; + } + + /** + * Test if handler can output to stdout. + * @return bool + */ + private function canOutput() + { + return !$this->loggerOnly(); + } + + /** + * Get the frame args var_dump. + * @param \Whoops\Exception\Frame $frame [description] + * @param integer $line [description] + * @return string + */ + private function getFrameArgsOutput(Frame $frame, $line) + { + if ($this->addTraceFunctionArgsToOutput() === false + || $this->addTraceFunctionArgsToOutput() < $line) { + return ''; + } + + // Dump the arguments: + ob_start(); + $this->dump($frame->getArgs()); + if (ob_get_length() > $this->getTraceFunctionArgsOutputLimit()) { + // The argument var_dump is to big. + // Discarded to limit memory usage. + ob_clean(); + return sprintf( + "\n%sArguments dump length greater than %d Bytes. Discarded.", + self::VAR_DUMP_PREFIX, + $this->getTraceFunctionArgsOutputLimit() + ); + } + + return sprintf( + "\n%s", + preg_replace('/^/m', self::VAR_DUMP_PREFIX, ob_get_clean()) + ); + } + + /** + * Dump variable. + * + * @param mixed $var + * @return void + */ + protected function dump($var) + { + if ($this->dumper) { + call_user_func($this->dumper, $var); + } else { + var_dump($var); + } + } + + /** + * Get the exception trace as plain text. + * @return string + */ + private function getTraceOutput() + { + if (! $this->addTraceToOutput()) { + return ''; + } + $inspector = $this->getInspector(); + $frames = $inspector->getFrames($this->getRun()->getFrameFilters()); + + $response = "\nStack trace:"; + + $line = 1; + foreach ($frames as $frame) { + /** @var Frame $frame */ + $class = $frame->getClass(); + + $template = "\n%3d. %s->%s() %s:%d%s"; + if (! $class) { + // Remove method arrow (->) from output. + $template = "\n%3d. %s%s() %s:%d%s"; + } + + $response .= sprintf( + $template, + $line, + $class, + $frame->getFunction(), + $frame->getFile(), + $frame->getLine(), + $this->getFrameArgsOutput($frame, $line) + ); + + $line++; + } + + return $response; + } + + /** + * Get the exception as plain text. + * @param \Throwable $exception + * @return string + */ + private function getExceptionOutput($exception) + { + return sprintf( + "%s: %s in file %s on line %d", + get_class($exception), + $exception->getMessage(), + $exception->getFile(), + $exception->getLine() + ); + } + + /** + * @return int + */ + public function handle() + { + $response = $this->generateResponse(); + + if ($this->getLogger()) { + $this->getLogger()->error($response); + } + + if (! $this->canOutput()) { + return Handler::DONE; + } + + echo $response; + + return Handler::QUIT; + } + + /** + * @return string + */ + public function contentType() + { + return 'text/plain'; + } +} diff --git a/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php b/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php new file mode 100644 index 00000000..167407e8 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php @@ -0,0 +1,832 @@ + + */ + +namespace Whoops\Handler; + +use InvalidArgumentException; +use RuntimeException; +use Symfony\Component\VarDumper\Cloner\AbstractCloner; +use Symfony\Component\VarDumper\Cloner\VarCloner; +use UnexpectedValueException; +use Whoops\Exception\Formatter; +use Whoops\Util\Misc; +use Whoops\Util\TemplateHelper; + +class PrettyPageHandler extends Handler +{ + const EDITOR_SUBLIME = "sublime"; + const EDITOR_TEXTMATE = "textmate"; + const EDITOR_EMACS = "emacs"; + const EDITOR_MACVIM = "macvim"; + const EDITOR_PHPSTORM = "phpstorm"; + const EDITOR_IDEA = "idea"; + const EDITOR_VSCODE = "vscode"; + const EDITOR_ATOM = "atom"; + const EDITOR_ESPRESSO = "espresso"; + const EDITOR_XDEBUG = "xdebug"; + const EDITOR_NETBEANS = "netbeans"; + + /** + * Search paths to be scanned for resources. + * + * Stored in the reverse order they're declared. + * + * @var array + */ + private $searchPaths = []; + + /** + * Fast lookup cache for known resource locations. + * + * @var array + */ + private $resourceCache = []; + + /** + * The name of the custom css file. + * + * @var string|null + */ + private $customCss = null; + + /** + * The name of the custom js file. + * + * @var string|null + */ + private $customJs = null; + + /** + * @var array[] + */ + private $extraTables = []; + + /** + * @var bool + */ + private $handleUnconditionally = false; + + /** + * @var string + */ + private $pageTitle = "Whoops! There was an error."; + + /** + * @var array[] + */ + private $applicationPaths; + + /** + * @var array[] + */ + private $blacklist = [ + '_GET' => [], + '_POST' => [], + '_FILES' => [], + '_COOKIE' => [], + '_SESSION' => [], + '_SERVER' => [], + '_ENV' => [], + ]; + + /** + * An identifier for a known IDE/text editor. + * + * Either a string, or a calalble that resolves a string, that can be used + * to open a given file in an editor. If the string contains the special + * substrings %file or %line, they will be replaced with the correct data. + * + * @example + * "txmt://open?url=%file&line=%line" + * + * @var callable|string $editor + */ + protected $editor; + + /** + * A list of known editor strings. + * + * @var array + */ + protected $editors = [ + "sublime" => "subl://open?url=file://%file&line=%line", + "textmate" => "txmt://open?url=file://%file&line=%line", + "emacs" => "emacs://open?url=file://%file&line=%line", + "macvim" => "mvim://open/?url=file://%file&line=%line", + "phpstorm" => "phpstorm://open?file=%file&line=%line", + "idea" => "idea://open?file=%file&line=%line", + "vscode" => "vscode://file/%file:%line", + "atom" => "atom://core/open/file?filename=%file&line=%line", + "espresso" => "x-espresso://open?filepath=%file&lines=%line", + "netbeans" => "netbeans://open/?f=%file:%line", + ]; + + /** + * @var TemplateHelper + */ + protected $templateHelper; + + /** + * Constructor. + * + * @return void + */ + public function __construct() + { + if (ini_get('xdebug.file_link_format') || get_cfg_var('xdebug.file_link_format')) { + // Register editor using xdebug's file_link_format option. + $this->editors['xdebug'] = function ($file, $line) { + return str_replace(['%f', '%l'], [$file, $line], ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format')); + }; + + // If xdebug is available, use it as default editor. + $this->setEditor('xdebug'); + } + + // Add the default, local resource search path: + $this->searchPaths[] = __DIR__ . "/../Resources"; + + // blacklist php provided auth based values + $this->blacklist('_SERVER', 'PHP_AUTH_PW'); + + $this->templateHelper = new TemplateHelper(); + + if (class_exists('Symfony\Component\VarDumper\Cloner\VarCloner')) { + $cloner = new VarCloner(); + // Only dump object internals if a custom caster exists for performance reasons + // https://github.com/filp/whoops/pull/404 + $cloner->addCasters(['*' => function ($obj, $a, $stub, $isNested, $filter = 0) { + $class = $stub->class; + $classes = [$class => $class] + class_parents($obj) + class_implements($obj); + + foreach ($classes as $class) { + if (isset(AbstractCloner::$defaultCasters[$class])) { + return $a; + } + } + + // Remove all internals + return []; + }]); + $this->templateHelper->setCloner($cloner); + } + } + + /** + * @return int|null + * + * @throws \Exception + */ + public function handle() + { + if (!$this->handleUnconditionally()) { + // Check conditions for outputting HTML: + // @todo: Make this more robust + if (PHP_SAPI === 'cli') { + // Help users who have been relying on an internal test value + // fix their code to the proper method + if (isset($_ENV['whoops-test'])) { + throw new \Exception( + 'Use handleUnconditionally instead of whoops-test' + .' environment variable' + ); + } + + return Handler::DONE; + } + } + + $templateFile = $this->getResource("views/layout.html.php"); + $cssFile = $this->getResource("css/whoops.base.css"); + $zeptoFile = $this->getResource("js/zepto.min.js"); + $prismJs = $this->getResource("js/prism.js"); + $prismCss = $this->getResource("css/prism.css"); + $clipboard = $this->getResource("js/clipboard.min.js"); + $jsFile = $this->getResource("js/whoops.base.js"); + + if ($this->customCss) { + $customCssFile = $this->getResource($this->customCss); + } + + if ($this->customJs) { + $customJsFile = $this->getResource($this->customJs); + } + + $inspector = $this->getInspector(); + $frames = $this->getExceptionFrames(); + $code = $this->getExceptionCode(); + + // List of variables that will be passed to the layout template. + $vars = [ + "page_title" => $this->getPageTitle(), + + // @todo: Asset compiler + "stylesheet" => file_get_contents($cssFile), + "zepto" => file_get_contents($zeptoFile), + "prismJs" => file_get_contents($prismJs), + "prismCss" => file_get_contents($prismCss), + "clipboard" => file_get_contents($clipboard), + "javascript" => file_get_contents($jsFile), + + // Template paths: + "header" => $this->getResource("views/header.html.php"), + "header_outer" => $this->getResource("views/header_outer.html.php"), + "frame_list" => $this->getResource("views/frame_list.html.php"), + "frames_description" => $this->getResource("views/frames_description.html.php"), + "frames_container" => $this->getResource("views/frames_container.html.php"), + "panel_details" => $this->getResource("views/panel_details.html.php"), + "panel_details_outer" => $this->getResource("views/panel_details_outer.html.php"), + "panel_left" => $this->getResource("views/panel_left.html.php"), + "panel_left_outer" => $this->getResource("views/panel_left_outer.html.php"), + "frame_code" => $this->getResource("views/frame_code.html.php"), + "env_details" => $this->getResource("views/env_details.html.php"), + + "title" => $this->getPageTitle(), + "name" => explode("\\", $inspector->getExceptionName()), + "message" => $inspector->getExceptionMessage(), + "previousMessages" => $inspector->getPreviousExceptionMessages(), + "docref_url" => $inspector->getExceptionDocrefUrl(), + "code" => $code, + "previousCodes" => $inspector->getPreviousExceptionCodes(), + "plain_exception" => Formatter::formatExceptionPlain($inspector), + "frames" => $frames, + "has_frames" => !!count($frames), + "handler" => $this, + "handlers" => $this->getRun()->getHandlers(), + + "active_frames_tab" => count($frames) && $frames->offsetGet(0)->isApplication() ? 'application' : 'all', + "has_frames_tabs" => $this->getApplicationPaths(), + + "tables" => [ + "GET Data" => $this->masked($_GET, '_GET'), + "POST Data" => $this->masked($_POST, '_POST'), + "Files" => isset($_FILES) ? $this->masked($_FILES, '_FILES') : [], + "Cookies" => $this->masked($_COOKIE, '_COOKIE'), + "Session" => isset($_SESSION) ? $this->masked($_SESSION, '_SESSION') : [], + "Server/Request Data" => $this->masked($_SERVER, '_SERVER'), + "Environment Variables" => $this->masked($_ENV, '_ENV'), + ], + ]; + + if (isset($customCssFile)) { + $vars["stylesheet"] .= file_get_contents($customCssFile); + } + + if (isset($customJsFile)) { + $vars["javascript"] .= file_get_contents($customJsFile); + } + + // Add extra entries list of data tables: + // @todo: Consolidate addDataTable and addDataTableCallback + $extraTables = array_map(function ($table) use ($inspector) { + return $table instanceof \Closure ? $table($inspector) : $table; + }, $this->getDataTables()); + $vars["tables"] = array_merge($extraTables, $vars["tables"]); + + $plainTextHandler = new PlainTextHandler(); + $plainTextHandler->setRun($this->getRun()); + $plainTextHandler->setException($this->getException()); + $plainTextHandler->setInspector($this->getInspector()); + $vars["preface"] = ""; + + $this->templateHelper->setVariables($vars); + $this->templateHelper->render($templateFile); + + return Handler::QUIT; + } + + /** + * Get the stack trace frames of the exception currently being handled. + * + * @return \Whoops\Exception\FrameCollection + */ + protected function getExceptionFrames() + { + $frames = $this->getInspector()->getFrames($this->getRun()->getFrameFilters()); + + if ($this->getApplicationPaths()) { + foreach ($frames as $frame) { + foreach ($this->getApplicationPaths() as $path) { + if (strpos($frame->getFile(), $path) === 0) { + $frame->setApplication(true); + break; + } + } + } + } + + return $frames; + } + + /** + * Get the code of the exception currently being handled. + * + * @return string + */ + protected function getExceptionCode() + { + $exception = $this->getException(); + + $code = $exception->getCode(); + if ($exception instanceof \ErrorException) { + // ErrorExceptions wrap the php-error types within the 'severity' property + $code = Misc::translateErrorCode($exception->getSeverity()); + } + + return (string) $code; + } + + /** + * @return string + */ + public function contentType() + { + return 'text/html'; + } + + /** + * Adds an entry to the list of tables displayed in the template. + * + * The expected data is a simple associative array. Any nested arrays + * will be flattened with `print_r`. + * + * @param string $label + * + * @return static + */ + public function addDataTable($label, array $data) + { + $this->extraTables[$label] = $data; + return $this; + } + + /** + * Lazily adds an entry to the list of tables displayed in the table. + * + * The supplied callback argument will be called when the error is + * rendered, it should produce a simple associative array. Any nested + * arrays will be flattened with `print_r`. + * + * @param string $label + * @param callable $callback Callable returning an associative array + * + * @throws InvalidArgumentException If $callback is not callable + * + * @return static + */ + public function addDataTableCallback($label, /* callable */ $callback) + { + if (!is_callable($callback)) { + throw new InvalidArgumentException('Expecting callback argument to be callable'); + } + + $this->extraTables[$label] = function (\Whoops\Inspector\InspectorInterface $inspector = null) use ($callback) { + try { + $result = call_user_func($callback, $inspector); + + // Only return the result if it can be iterated over by foreach(). + return is_array($result) || $result instanceof \Traversable ? $result : []; + } catch (\Exception $e) { + // Don't allow failure to break the rendering of the original exception. + return []; + } + }; + + return $this; + } + + /** + * Returns all the extra data tables registered with this handler. + * + * Optionally accepts a 'label' parameter, to only return the data table + * under that label. + * + * @param string|null $label + * + * @return array[]|callable + */ + public function getDataTables($label = null) + { + if ($label !== null) { + return isset($this->extraTables[$label]) ? + $this->extraTables[$label] : []; + } + + return $this->extraTables; + } + + /** + * Set whether to handle unconditionally. + * + * Allows to disable all attempts to dynamically decide whether to handle + * or return prematurely. Set this to ensure that the handler will perform, + * no matter what. + * + * @param bool|null $value + * + * @return bool|static + */ + public function handleUnconditionally($value = null) + { + if (func_num_args() == 0) { + return $this->handleUnconditionally; + } + + $this->handleUnconditionally = (bool) $value; + return $this; + } + + /** + * Adds an editor resolver. + * + * Either a string, or a closure that resolves a string, that can be used + * to open a given file in an editor. If the string contains the special + * substrings %file or %line, they will be replaced with the correct data. + * + * @example + * $run->addEditor('macvim', "mvim://open?url=file://%file&line=%line") + * @example + * $run->addEditor('remove-it', function($file, $line) { + * unlink($file); + * return "http://stackoverflow.com"; + * }); + * + * @param string $identifier + * @param string|callable $resolver + * + * @return static + */ + public function addEditor($identifier, $resolver) + { + $this->editors[$identifier] = $resolver; + return $this; + } + + /** + * Set the editor to use to open referenced files. + * + * Pass either the name of a configured editor, or a closure that directly + * resolves an editor string. + * + * @example + * $run->setEditor(function($file, $line) { return "file:///{$file}"; }); + * @example + * $run->setEditor('sublime'); + * + * @param string|callable $editor + * + * @throws InvalidArgumentException If invalid argument identifier provided + * + * @return static + */ + public function setEditor($editor) + { + if (!is_callable($editor) && !isset($this->editors[$editor])) { + throw new InvalidArgumentException( + "Unknown editor identifier: $editor. Known editors:" . + implode(",", array_keys($this->editors)) + ); + } + + $this->editor = $editor; + return $this; + } + + /** + * Get the editor href for a given file and line, if available. + * + * @param string $filePath + * @param int $line + * + * @throws InvalidArgumentException If editor resolver does not return a string + * + * @return string|bool + */ + public function getEditorHref($filePath, $line) + { + $editor = $this->getEditor($filePath, $line); + + if (empty($editor)) { + return false; + } + + // Check that the editor is a string, and replace the + // %line and %file placeholders: + if (!isset($editor['url']) || !is_string($editor['url'])) { + throw new UnexpectedValueException( + __METHOD__ . " should always resolve to a string or a valid editor array; got something else instead." + ); + } + + $editor['url'] = str_replace("%line", rawurlencode($line), $editor['url']); + $editor['url'] = str_replace("%file", rawurlencode($filePath), $editor['url']); + + return $editor['url']; + } + + /** + * Determine if the editor link should act as an Ajax request. + * + * @param string $filePath + * @param int $line + * + * @throws UnexpectedValueException If editor resolver does not return a boolean + * + * @return bool + */ + public function getEditorAjax($filePath, $line) + { + $editor = $this->getEditor($filePath, $line); + + // Check that the ajax is a bool + if (!isset($editor['ajax']) || !is_bool($editor['ajax'])) { + throw new UnexpectedValueException( + __METHOD__ . " should always resolve to a bool; got something else instead." + ); + } + return $editor['ajax']; + } + + /** + * Determines both the editor and if ajax should be used. + * + * @param string $filePath + * @param int $line + * + * @return array + */ + protected function getEditor($filePath, $line) + { + if (!$this->editor || (!is_string($this->editor) && !is_callable($this->editor))) { + return []; + } + + if (is_string($this->editor) && isset($this->editors[$this->editor]) && !is_callable($this->editors[$this->editor])) { + return [ + 'ajax' => false, + 'url' => $this->editors[$this->editor], + ]; + } + + if (is_callable($this->editor) || (isset($this->editors[$this->editor]) && is_callable($this->editors[$this->editor]))) { + if (is_callable($this->editor)) { + $callback = call_user_func($this->editor, $filePath, $line); + } else { + $callback = call_user_func($this->editors[$this->editor], $filePath, $line); + } + + if (empty($callback)) { + return []; + } + + if (is_string($callback)) { + return [ + 'ajax' => false, + 'url' => $callback, + ]; + } + + return [ + 'ajax' => isset($callback['ajax']) ? $callback['ajax'] : false, + 'url' => isset($callback['url']) ? $callback['url'] : $callback, + ]; + } + + return []; + } + + /** + * Set the page title. + * + * @param string $title + * + * @return static + */ + public function setPageTitle($title) + { + $this->pageTitle = (string) $title; + return $this; + } + + /** + * Get the page title. + * + * @return string + */ + public function getPageTitle() + { + return $this->pageTitle; + } + + /** + * Adds a path to the list of paths to be searched for resources. + * + * @param string $path + * + * @throws InvalidArgumentException If $path is not a valid directory + * + * @return static + */ + public function addResourcePath($path) + { + if (!is_dir($path)) { + throw new InvalidArgumentException( + "'$path' is not a valid directory" + ); + } + + array_unshift($this->searchPaths, $path); + return $this; + } + + /** + * Adds a custom css file to be loaded. + * + * @param string|null $name + * + * @return static + */ + public function addCustomCss($name) + { + $this->customCss = $name; + return $this; + } + + /** + * Adds a custom js file to be loaded. + * + * @param string|null $name + * + * @return static + */ + public function addCustomJs($name) + { + $this->customJs = $name; + return $this; + } + + /** + * @return array + */ + public function getResourcePaths() + { + return $this->searchPaths; + } + + /** + * Finds a resource, by its relative path, in all available search paths. + * + * The search is performed starting at the last search path, and all the + * way back to the first, enabling a cascading-type system of overrides for + * all resources. + * + * @param string $resource + * + * @throws RuntimeException If resource cannot be found in any of the available paths + * + * @return string + */ + protected function getResource($resource) + { + // If the resource was found before, we can speed things up + // by caching its absolute, resolved path: + if (isset($this->resourceCache[$resource])) { + return $this->resourceCache[$resource]; + } + + // Search through available search paths, until we find the + // resource we're after: + foreach ($this->searchPaths as $path) { + $fullPath = $path . "/$resource"; + + if (is_file($fullPath)) { + // Cache the result: + $this->resourceCache[$resource] = $fullPath; + return $fullPath; + } + } + + // If we got this far, nothing was found. + throw new RuntimeException( + "Could not find resource '$resource' in any resource paths." + . "(searched: " . join(", ", $this->searchPaths). ")" + ); + } + + /** + * @deprecated + * + * @return string + */ + public function getResourcesPath() + { + $allPaths = $this->getResourcePaths(); + + // Compat: return only the first path added + return end($allPaths) ?: null; + } + + /** + * @deprecated + * + * @param string $resourcesPath + * + * @return static + */ + public function setResourcesPath($resourcesPath) + { + $this->addResourcePath($resourcesPath); + return $this; + } + + /** + * Return the application paths. + * + * @return array + */ + public function getApplicationPaths() + { + return $this->applicationPaths; + } + + /** + * Set the application paths. + * + * @return void + */ + public function setApplicationPaths(array $applicationPaths) + { + $this->applicationPaths = $applicationPaths; + } + + /** + * Set the application root path. + * + * @param string $applicationRootPath + * + * @return void + */ + public function setApplicationRootPath($applicationRootPath) + { + $this->templateHelper->setApplicationRootPath($applicationRootPath); + } + + /** + * blacklist a sensitive value within one of the superglobal arrays. + * Alias for the hideSuperglobalKey method. + * + * @param string $superGlobalName The name of the superglobal array, e.g. '_GET' + * @param string $key The key within the superglobal + * @see hideSuperglobalKey + * + * @return static + */ + public function blacklist($superGlobalName, $key) + { + $this->blacklist[$superGlobalName][] = $key; + return $this; + } + + /** + * Hide a sensitive value within one of the superglobal arrays. + * + * @param string $superGlobalName The name of the superglobal array, e.g. '_GET' + * @param string $key The key within the superglobal + * @return static + */ + public function hideSuperglobalKey($superGlobalName, $key) + { + return $this->blacklist($superGlobalName, $key); + } + + /** + * Checks all values within the given superGlobal array. + * + * Blacklisted values will be replaced by a equal length string containing + * only '*' characters for string values. + * Non-string values will be replaced with a fixed asterisk count. + * We intentionally dont rely on $GLOBALS as it depends on the 'auto_globals_jit' php.ini setting. + * + * @param array|\ArrayAccess $superGlobal One of the superglobal arrays + * @param string $superGlobalName The name of the superglobal array, e.g. '_GET' + * + * @return array $values without sensitive data + */ + private function masked($superGlobal, $superGlobalName) + { + $blacklisted = $this->blacklist[$superGlobalName]; + + $values = $superGlobal; + + foreach ($blacklisted as $key) { + if (isset($superGlobal[$key])) { + $values[$key] = str_repeat('*', is_string($superGlobal[$key]) ? strlen($superGlobal[$key]) : 3); + } + } + + return $values; + } +} diff --git a/vendor/filp/whoops/src/Whoops/Handler/XmlResponseHandler.php b/vendor/filp/whoops/src/Whoops/Handler/XmlResponseHandler.php new file mode 100644 index 00000000..dcfd551e --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Handler/XmlResponseHandler.php @@ -0,0 +1,108 @@ + + */ + +namespace Whoops\Handler; + +use SimpleXMLElement; +use Whoops\Exception\Formatter; + +/** + * Catches an exception and converts it to an XML + * response. Additionally can also return exception + * frames for consumption by an API. + */ +class XmlResponseHandler extends Handler +{ + /** + * @var bool + */ + private $returnFrames = false; + + /** + * @param bool|null $returnFrames + * @return bool|static + */ + public function addTraceToOutput($returnFrames = null) + { + if (func_num_args() == 0) { + return $this->returnFrames; + } + + $this->returnFrames = (bool) $returnFrames; + return $this; + } + + /** + * @return int + */ + public function handle() + { + $response = [ + 'error' => Formatter::formatExceptionAsDataArray( + $this->getInspector(), + $this->addTraceToOutput(), + $this->getRun()->getFrameFilters() + ), + ]; + + echo self::toXml($response); + + return Handler::QUIT; + } + + /** + * @return string + */ + public function contentType() + { + return 'application/xml'; + } + + /** + * @param SimpleXMLElement $node Node to append data to, will be modified in place + * @param array|\Traversable $data + * @return SimpleXMLElement The modified node, for chaining + */ + private static function addDataToNode(\SimpleXMLElement $node, $data) + { + assert(is_array($data) || $data instanceof Traversable); + + foreach ($data as $key => $value) { + if (is_numeric($key)) { + // Convert the key to a valid string + $key = "unknownNode_". (string) $key; + } + + // Delete any char not allowed in XML element names + $key = preg_replace('/[^a-z0-9\-\_\.\:]/i', '', $key); + + if (is_array($value)) { + $child = $node->addChild($key); + self::addDataToNode($child, $value); + } else { + $value = str_replace('&', '&', print_r($value, true)); + $node->addChild($key, $value); + } + } + + return $node; + } + + /** + * The main function for converting to an XML document. + * + * @param array|\Traversable $data + * @return string XML + */ + private static function toXml($data) + { + assert(is_array($data) || $data instanceof Traversable); + + $node = simplexml_load_string(""); + + return self::addDataToNode($node, $data)->asXML(); + } +} diff --git a/vendor/filp/whoops/src/Whoops/Inspector/InspectorFactory.php b/vendor/filp/whoops/src/Whoops/Inspector/InspectorFactory.php new file mode 100644 index 00000000..ee19898a --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Inspector/InspectorFactory.php @@ -0,0 +1,21 @@ + + */ + +namespace Whoops\Inspector; + +use Whoops\Exception\Inspector; + +class InspectorFactory implements InspectorFactoryInterface +{ + /** + * @param \Throwable $exception + * @return InspectorInterface + */ + public function create($exception) + { + return new Inspector($exception, $this); + } +} diff --git a/vendor/filp/whoops/src/Whoops/Inspector/InspectorFactoryInterface.php b/vendor/filp/whoops/src/Whoops/Inspector/InspectorFactoryInterface.php new file mode 100644 index 00000000..e3907cfc --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Inspector/InspectorFactoryInterface.php @@ -0,0 +1,16 @@ + + */ + +namespace Whoops\Inspector; + +interface InspectorFactoryInterface +{ + /** + * @param \Throwable $exception + * @return InspectorInterface + */ + public function create($exception); +} diff --git a/vendor/filp/whoops/src/Whoops/Inspector/InspectorInterface.php b/vendor/filp/whoops/src/Whoops/Inspector/InspectorInterface.php new file mode 100644 index 00000000..6893517f --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Inspector/InspectorInterface.php @@ -0,0 +1,71 @@ + + */ + +namespace Whoops\Inspector; + +interface InspectorInterface +{ + /** + * @return \Throwable + */ + public function getException(); + + /** + * @return string + */ + public function getExceptionName(); + + /** + * @return string + */ + public function getExceptionMessage(); + + /** + * @return string[] + */ + public function getPreviousExceptionMessages(); + + /** + * @return int[] + */ + public function getPreviousExceptionCodes(); + + /** + * Returns a url to the php-manual related to the underlying error - when available. + * + * @return string|null + */ + public function getExceptionDocrefUrl(); + + /** + * Does the wrapped Exception has a previous Exception? + * @return bool + */ + public function hasPreviousException(); + + /** + * Returns an Inspector for a previous Exception, if any. + * @todo Clean this up a bit, cache stuff a bit better. + * @return InspectorInterface + */ + public function getPreviousExceptionInspector(); + + /** + * Returns an array of all previous exceptions for this inspector's exception + * @return \Throwable[] + */ + public function getPreviousExceptions(); + + /** + * Returns an iterator for the inspected exception's + * frames. + * + * @param array $frameFilters + * + * @return \Whoops\Exception\FrameCollection + */ + public function getFrames(array $frameFilters = []); +} diff --git a/vendor/filp/whoops/src/Whoops/Resources/css/prism.css b/vendor/filp/whoops/src/Whoops/Resources/css/prism.css new file mode 100644 index 00000000..a03db53d --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/css/prism.css @@ -0,0 +1,5 @@ +/* PrismJS 1.29.0 +https://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+markup-templating+php&plugins=line-highlight+line-numbers */ +code[class*=language-],pre[class*=language-]{color:#ccc;background:0 0;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#2d2d2d}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.block-comment,.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#999}.token.punctuation{color:#ccc}.token.attr-name,.token.deleted,.token.namespace,.token.tag{color:#e2777a}.token.function-name{color:#6196cc}.token.boolean,.token.function,.token.number{color:#f08d49}.token.class-name,.token.constant,.token.property,.token.symbol{color:#f8c555}.token.atrule,.token.builtin,.token.important,.token.keyword,.token.selector{color:#cc99cd}.token.attr-value,.token.char,.token.regex,.token.string,.token.variable{color:#7ec699}.token.entity,.token.operator,.token.url{color:#67cdcc}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}.token.inserted{color:green} +pre[data-line]{position:relative;padding:1em 0 1em 3em}.line-highlight{position:absolute;left:0;right:0;padding:inherit 0;margin-top:1em;background:hsla(24,20%,50%,.08);background:linear-gradient(to right,hsla(24,20%,50%,.1) 70%,hsla(24,20%,50%,0));pointer-events:none;line-height:inherit;white-space:pre}@media print{.line-highlight{-webkit-print-color-adjust:exact;color-adjust:exact}}.line-highlight:before,.line-highlight[data-end]:after{content:attr(data-start);position:absolute;top:.4em;left:.6em;min-width:1em;padding:0 .5em;background-color:hsla(24,20%,50%,.4);color:#f4f1ef;font:bold 65%/1.5 sans-serif;text-align:center;vertical-align:.3em;border-radius:999px;text-shadow:none;box-shadow:0 1px #fff}.line-highlight[data-end]:after{content:attr(data-end);top:auto;bottom:.4em}.line-numbers .line-highlight:after,.line-numbers .line-highlight:before{content:none}pre[id].linkable-line-numbers span.line-numbers-rows{pointer-events:all}pre[id].linkable-line-numbers span.line-numbers-rows>span:before{cursor:pointer}pre[id].linkable-line-numbers span.line-numbers-rows>span:hover:before{background-color:rgba(128,128,128,.2)} +pre[class*=language-].line-numbers{position:relative;padding-left:3.8em;counter-reset:linenumber}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{display:block;counter-increment:linenumber}.line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.8em;text-align:right} diff --git a/vendor/filp/whoops/src/Whoops/Resources/css/whoops.base.css b/vendor/filp/whoops/src/Whoops/Resources/css/whoops.base.css new file mode 100644 index 00000000..edd5cd8e --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/css/whoops.base.css @@ -0,0 +1,560 @@ +body { + font: 12px "Helvetica Neue", helvetica, arial, sans-serif; + color: #131313; + background: #eeeeee; + padding:0; + margin: 0; + max-height: 100%; + + text-rendering: optimizeLegibility; +} + a { + text-decoration: none; + } + +.Whoops.container { + position: relative; + z-index: 9999999999; +} + +.panel { + overflow-y: scroll; + height: 100%; + position: fixed; + margin: 0; + left: 0; + top: 0; +} + +.branding { + position: absolute; + top: 10px; + right: 20px; + color: #777777; + font-size: 10px; + z-index: 100; +} + .branding a { + color: #e95353; + } + +header { + color: white; + box-sizing: border-box; + background-color: #2a2a2a; + padding: 35px 40px; + max-height: 180px; + overflow: hidden; + transition: 0.5s; +} + + header.header-expand { + max-height: 1000px; + } + + .exc-title { + margin: 0; + color: #bebebe; + font-size: 14px; + } + .exc-title-primary, .exc-title-secondary { + color: #e95353; + } + + .exc-message { + font-size: 20px; + word-wrap: break-word; + margin: 4px 0 0 0; + color: white; + } + .exc-message span { + display: block; + } + .exc-message-empty-notice { + color: #a29d9d; + font-weight: 300; + } + +.prev-exc-title { + margin: 10px 0; +} + +.prev-exc-title + ul { + margin: 0; + padding: 0 0 0 20px; + line-height: 12px; +} + +.prev-exc-title + ul li { + font: 12px "Helvetica Neue", helvetica, arial, sans-serif; +} + +.prev-exc-title + ul li .prev-exc-code { + display: inline-block; + color: #bebebe; +} + +.details-container { + left: 30%; + width: 70%; + background: #fafafa; +} + .details { + padding: 5px; + } + + .details-heading { + color: #4288CE; + font-weight: 300; + padding-bottom: 10px; + margin-bottom: 10px; + border-bottom: 1px solid rgba(0, 0, 0, .1); + } + + .details pre.sf-dump { + white-space: pre; + word-wrap: inherit; + } + + .details pre.sf-dump, + .details pre.sf-dump .sf-dump-num, + .details pre.sf-dump .sf-dump-const, + .details pre.sf-dump .sf-dump-str, + .details pre.sf-dump .sf-dump-note, + .details pre.sf-dump .sf-dump-ref, + .details pre.sf-dump .sf-dump-public, + .details pre.sf-dump .sf-dump-protected, + .details pre.sf-dump .sf-dump-private, + .details pre.sf-dump .sf-dump-meta, + .details pre.sf-dump .sf-dump-key, + .details pre.sf-dump .sf-dump-index { + color: #463C54; + } + +.left-panel { + width: 30%; + background: #ded8d8; +} + + .frames-description { + background: rgba(0, 0, 0, .05); + padding: 8px 15px; + color: #a29d9d; + font-size: 11px; + } + + .frames-description.frames-description-application { + text-align: center; + font-size: 12px; + } + .frames-container.frames-container-application .frame:not(.frame-application) { + display: none; + } + + .frames-tab { + color: #a29d9d; + display: inline-block; + padding: 4px 8px; + margin: 0 2px; + border-radius: 3px; + } + + .frames-tab.frames-tab-active { + background-color: #2a2a2a; + color: #bebebe; + } + + .frame { + padding: 14px; + cursor: pointer; + transition: all 0.1s ease; + background: #eeeeee; + } + .frame:not(:last-child) { + border-bottom: 1px solid rgba(0, 0, 0, .05); + } + + .frame.active { + box-shadow: inset -5px 0 0 0 #4288CE; + color: #4288CE; + } + + .frame:not(.active):hover { + background: #BEE9EA; + } + + .frame-method-info { + margin-bottom: 10px; + } + + .frame-class, .frame-function, .frame-index { + font-size: 14px; + } + + .frame-index { + float: left; + } + + .frame-method-info { + margin-left: 24px; + } + + .frame-index { + font-size: 11px; + color: #a29d9d; + background-color: rgba(0, 0, 0, .05); + height: 18px; + width: 18px; + line-height: 18px; + border-radius: 5px; + padding: 0 1px 0 1px; + text-align: center; + display: inline-block; + } + + .frame-application .frame-index { + background-color: #2a2a2a; + color: #bebebe; + } + + .frame-file { + font-family: "Inconsolata", "Fira Mono", "Source Code Pro", Monaco, Consolas, "Lucida Console", monospace; + color: #a29d9d; + } + + .frame-file .editor-link { + color: #a29d9d; + } + + .frame-line { + font-weight: bold; + } + + .frame-line:before { + content: ":"; + } + + .frame-code { + padding: 5px; + background: #303030; + display: none; + } + + .frame-code.active { + display: block; + } + + .frame-code .frame-file { + color: #a29d9d; + padding: 12px 6px; + + border-bottom: none; + } + + .code-block { + padding: 10px; + margin: 0; + border-radius: 6px; + box-shadow: 0 3px 0 rgba(0, 0, 0, .05), + 0 10px 30px rgba(0, 0, 0, .05), + inset 0 0 1px 0 rgba(255, 255, 255, .07); + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + } + + .linenums { + margin: 0; + margin-left: 10px; + } + + .frame-comments { + border-top: none; + margin-top: 15px; + + font-size: 12px; + } + + .frame-comments.empty { + } + + .frame-comments.empty:before { + content: "No comments for this stack frame."; + font-weight: 300; + color: #a29d9d; + } + + .frame-comment { + padding: 10px; + color: #e3e3e3; + border-radius: 6px; + background-color: rgba(255, 255, 255, .05); + } + + .frame-comment a { + font-weight: bold; + text-decoration: underline; + color: #c6c6c6; + } + + .frame-comment:not(:last-child) { + border-bottom: 1px dotted rgba(0, 0, 0, .3); + } + + .frame-comment-context { + font-size: 10px; + color: white; + } + +.delimiter { + display: inline-block; +} + +.data-table-container label { + font-size: 16px; + color: #303030; + font-weight: bold; + margin: 10px 0; + + display: block; + + margin-bottom: 5px; + padding-bottom: 5px; +} + .data-table { + width: 100%; + margin-bottom: 10px; + } + + .data-table tbody { + font: 13px "Inconsolata", "Fira Mono", "Source Code Pro", Monaco, Consolas, "Lucida Console", monospace; + } + + .data-table thead { + display: none; + } + + .data-table tr { + padding: 5px 0; + } + + .data-table td:first-child { + width: 20%; + min-width: 130px; + overflow: hidden; + font-weight: bold; + color: #463C54; + padding-right: 5px; + + } + + .data-table td:last-child { + width: 80%; + -ms-word-break: break-all; + word-break: break-all; + word-break: break-word; + -webkit-hyphens: auto; + -moz-hyphens: auto; + hyphens: auto; + } + + .data-table span.empty { + color: rgba(0, 0, 0, .3); + font-weight: 300; + } + .data-table label.empty { + display: inline; + } + +.handler { + padding: 4px 0; + font: 14px "Inconsolata", "Fira Mono", "Source Code Pro", Monaco, Consolas, "Lucida Console", monospace; +} + +#plain-exception { + display: none; +} + +.rightButton { + cursor: pointer; + border: 0; + opacity: .8; + background: none; + + color: rgba(255, 255, 255, 0.1); + box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1); + + border-radius: 3px; + + outline: none !important; +} + + .rightButton:hover { + box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.3); + color: rgba(255, 255, 255, 0.3); + } + +/* inspired by githubs kbd styles */ +kbd { + -moz-border-bottom-colors: none; + -moz-border-left-colors: none; + -moz-border-right-colors: none; + -moz-border-top-colors: none; + background-color: #fcfcfc; + border-color: #ccc #ccc #bbb; + border-image: none; + border-style: solid; + border-width: 1px; + color: #555; + display: inline-block; + font-size: 11px; + line-height: 10px; + padding: 3px 5px; + vertical-align: middle; +} + + +/* == Media queries */ + +/* Expand the spacing in the details section */ +@media (min-width: 1000px) { + .details, .frame-code { + padding: 20px 40px; + } + + .details-container { + left: 32%; + width: 68%; + } + + .frames-container { + margin: 5px; + } + + .left-panel { + width: 32%; + } +} + +/* Stack panels */ +@media (max-width: 600px) { + .panel { + position: static; + width: 100%; + } +} + +/* Stack details tables */ +@media (max-width: 400px) { + .data-table, + .data-table tbody, + .data-table tbody tr, + .data-table tbody td { + display: block; + width: 100%; + } + + .data-table tbody tr:first-child { + padding-top: 0; + } + + .data-table tbody td:first-child, + .data-table tbody td:last-child { + padding-left: 0; + padding-right: 0; + } + + .data-table tbody td:last-child { + padding-top: 3px; + } +} + +.tooltipped { + position: relative +} +.tooltipped:after { + position: absolute; + z-index: 1000000; + display: none; + padding: 5px 8px; + color: #fff; + text-align: center; + text-decoration: none; + text-shadow: none; + text-transform: none; + letter-spacing: normal; + word-wrap: break-word; + white-space: pre; + pointer-events: none; + content: attr(aria-label); + background: rgba(0, 0, 0, 0.8); + border-radius: 3px; + -webkit-font-smoothing: subpixel-antialiased +} +.tooltipped:before { + position: absolute; + z-index: 1000001; + display: none; + width: 0; + height: 0; + color: rgba(0, 0, 0, 0.8); + pointer-events: none; + content: ""; + border: 5px solid transparent +} +.tooltipped:hover:before, +.tooltipped:hover:after, +.tooltipped:active:before, +.tooltipped:active:after, +.tooltipped:focus:before, +.tooltipped:focus:after { + display: inline-block; + text-decoration: none +} +.tooltipped-s:after { + top: 100%; + right: 50%; + margin-top: 5px +} +.tooltipped-s:before { + top: auto; + right: 50%; + bottom: -5px; + margin-right: -5px; + border-bottom-color: rgba(0, 0, 0, 0.8) +} + +pre.sf-dump { + padding: 0px !important; + margin: 0px !important; +} + +.search-for-help { + width: 85%; + padding: 0; + margin: 10px 0; + list-style-type: none; + display: inline-block; +} + .search-for-help li { + display: inline-block; + margin-right: 5px; + } + .search-for-help li:last-child { + margin-right: 0; + } + .search-for-help li a { + + } + .search-for-help li a i { + width: 16px; + height: 16px; + overflow: hidden; + display: block; + } + .search-for-help li a svg { + fill: #fff; + } + .search-for-help li a svg path { + background-size: contain; + } diff --git a/vendor/filp/whoops/src/Whoops/Resources/js/clipboard.min.js b/vendor/filp/whoops/src/Whoops/Resources/js/clipboard.min.js new file mode 100644 index 00000000..36a75a46 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/js/clipboard.min.js @@ -0,0 +1,7 @@ +/*! + * clipboard.js v1.5.3 + * https://zenorocha.github.io/clipboard.js + * + * Licensed MIT © Zeno Rocha + */ +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Clipboard=t()}}(function(){var t,e,n;return function t(e,n,r){function o(a,c){if(!n[a]){if(!e[a]){var s="function"==typeof require&&require;if(!c&&s)return s(a,!0);if(i)return i(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;ar;r++)n[r].fn.apply(n[r].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),r=n[t],o=[];if(r&&e)for(var i=0,a=r.length;a>i;i++)r[i].fn!==e&&r[i].fn._!==e&&o.push(r[i]);return o.length?n[t]=o:delete n[t],this}},e.exports=r},{}],8:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}n.__esModule=!0;var i=function(){function t(t,e){for(var n=0;n=g.reach);A+=w.value.length,w=w.next){var E=w.value;if(n.length>e.length)return;if(!(E instanceof i)){var P,L=1;if(y){if(!(P=l(b,A,e,m))||P.index>=e.length)break;var S=P.index,O=P.index+P[0].length,j=A;for(j+=w.value.length;S>=j;)j+=(w=w.next).value.length;if(A=j-=w.value.length,w.value instanceof i)continue;for(var C=w;C!==n.tail&&(jg.reach&&(g.reach=W);var z=w.prev;if(_&&(z=u(n,z,_),A+=_.length),c(n,z,L),w=u(n,z,new i(f,p?a.tokenize(N,p):N,k,N)),M&&u(n,w,M),L>1){var I={cause:f+","+d,reach:W};o(e,n,t,w.prev,A,I),g&&I.reach>g.reach&&(g.reach=I.reach)}}}}}}function s(){var e={value:null,prev:null,next:null},n={value:null,prev:e,next:null};e.next=n,this.head=e,this.tail=n,this.length=0}function u(e,n,t){var r=n.next,a={value:t,prev:n,next:r};return n.next=a,r.prev=a,e.length++,a}function c(e,n,t){for(var r=n.next,a=0;a"+i.content+""},!e.document)return e.addEventListener?(a.disableWorkerMessageHandler||e.addEventListener("message",(function(n){var t=JSON.parse(n.data),r=t.language,i=t.code,l=t.immediateClose;e.postMessage(a.highlight(i,a.languages[r],r)),l&&e.close()}),!1),a):a;var g=a.util.currentScript();function f(){a.manual||a.highlightAll()}if(g&&(a.filename=g.src,g.hasAttribute("data-manual")&&(a.manual=!0)),!a.manual){var h=document.readyState;"loading"===h||"interactive"===h&&g&&g.defer?document.addEventListener("DOMContentLoaded",f):window.requestAnimationFrame?window.requestAnimationFrame(f):window.setTimeout(f,16)}return a}(_self);"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism); +Prism.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",(function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))})),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(a,e){var s={};s["language-"+e]={pattern:/(^$)/i,lookbehind:!0,inside:Prism.languages[e]},s.cdata=/^$/i;var t={"included-cdata":{pattern://i,inside:s}};t["language-"+e]={pattern:/[\s\S]+/,inside:Prism.languages[e]};var n={};n[a]={pattern:RegExp("(<__[^>]*>)(?:))*\\]\\]>|(?!)".replace(/__/g,(function(){return a})),"i"),lookbehind:!0,greedy:!0,inside:t},Prism.languages.insertBefore("markup","cdata",n)}}),Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(a,e){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp("(^|[\"'\\s])(?:"+a+")\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s'\">=]+(?=[\\s>]))","i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[e,"language-"+e],inside:Prism.languages[e]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml; +!function(e){function n(e,n){return"___"+e.toUpperCase()+n+"___"}Object.defineProperties(e.languages["markup-templating"]={},{buildPlaceholders:{value:function(t,a,r,o){if(t.language===a){var c=t.tokenStack=[];t.code=t.code.replace(r,(function(e){if("function"==typeof o&&!o(e))return e;for(var r,i=c.length;-1!==t.code.indexOf(r=n(a,i));)++i;return c[i]=e,r})),t.grammar=e.languages.markup}}},tokenizePlaceholders:{value:function(t,a){if(t.language===a&&t.tokenStack){t.grammar=e.languages[a];var r=0,o=Object.keys(t.tokenStack);!function c(i){for(var u=0;u=o.length);u++){var g=i[u];if("string"==typeof g||g.content&&"string"==typeof g.content){var l=o[r],s=t.tokenStack[l],f="string"==typeof g?g:g.content,p=n(a,l),k=f.indexOf(p);if(k>-1){++r;var m=f.substring(0,k),d=new e.Token(a,e.tokenize(s,t.grammar),"language-"+a,s),h=f.substring(k+p.length),v=[];m&&v.push.apply(v,c([m])),v.push(d),h&&v.push.apply(v,c([h])),"string"==typeof g?i.splice.apply(i,[u,1].concat(v)):g.content=v}}else g.content&&c(g.content)}return i}(t.tokens)}}}})}(Prism); +!function(e){var a=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,t=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],i=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,n=/|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,s=/[{}\[\](),:;]/;e.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:a,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:t,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:i,operator:n,punctuation:s};var l={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:e.languages.php},r=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:l}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:l}}];e.languages.insertBefore("php","variable",{string:r,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:a,string:r,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:t,number:i,operator:n,punctuation:s}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),e.hooks.add("before-tokenize",(function(a){/<\?/.test(a.code)&&e.languages["markup-templating"].buildPlaceholders(a,"php",/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g)})),e.hooks.add("after-tokenize",(function(a){e.languages["markup-templating"].tokenizePlaceholders(a,"php")}))}(Prism); +!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document&&document.querySelector){var e,t="line-numbers",i="linkable-line-numbers",n=/\n(?!$)/g,r=!0;Prism.plugins.lineHighlight={highlightLines:function(o,u,c){var h=(u="string"==typeof u?u:o.getAttribute("data-line")||"").replace(/\s+/g,"").split(",").filter(Boolean),d=+o.getAttribute("data-line-offset")||0,f=(function(){if(void 0===e){var t=document.createElement("div");t.style.fontSize="13px",t.style.lineHeight="1.5",t.style.padding="0",t.style.border="0",t.innerHTML=" 
     ",document.body.appendChild(t),e=38===t.offsetHeight,document.body.removeChild(t)}return e}()?parseInt:parseFloat)(getComputedStyle(o).lineHeight),p=Prism.util.isActive(o,t),g=o.querySelector("code"),m=p?o:g||o,v=[],y=g.textContent.match(n),b=y?y.length+1:1,A=g&&m!=g?function(e,t){var i=getComputedStyle(e),n=getComputedStyle(t);function r(e){return+e.substr(0,e.length-2)}return t.offsetTop+r(n.borderTopWidth)+r(n.paddingTop)-r(i.paddingTop)}(o,g):0;h.forEach((function(e){var t=e.split("-"),i=+t[0],n=+t[1]||i;if(!((n=Math.min(b+d,n))i&&r.setAttribute("data-end",String(n)),r.style.top=(i-d-1)*f+A+"px",r.textContent=new Array(n-i+2).join(" \n")}));v.push((function(){r.style.width=o.scrollWidth+"px"})),v.push((function(){m.appendChild(r)}))}}));var P=o.id;if(p&&Prism.util.isActive(o,i)&&P){l(o,i)||v.push((function(){o.classList.add(i)}));var E=parseInt(o.getAttribute("data-start")||"1");s(".line-numbers-rows > span",o).forEach((function(e,t){var i=t+E;e.onclick=function(){var e=P+"."+i;r=!1,location.hash=e,setTimeout((function(){r=!0}),1)}}))}return function(){v.forEach(a)}}};var o=0;Prism.hooks.add("before-sanity-check",(function(e){var t=e.element.parentElement;if(u(t)){var i=0;s(".line-highlight",t).forEach((function(e){i+=e.textContent.length,e.parentNode.removeChild(e)})),i&&/^(?: \n)+$/.test(e.code.slice(-i))&&(e.code=e.code.slice(0,-i))}})),Prism.hooks.add("complete",(function e(i){var n=i.element.parentElement;if(u(n)){clearTimeout(o);var r=Prism.plugins.lineNumbers,s=i.plugins&&i.plugins.lineNumbers;l(n,t)&&r&&!s?Prism.hooks.add("line-numbers",e):(Prism.plugins.lineHighlight.highlightLines(n)(),o=setTimeout(c,1))}})),window.addEventListener("hashchange",c),window.addEventListener("resize",(function(){s("pre").filter(u).map((function(e){return Prism.plugins.lineHighlight.highlightLines(e)})).forEach(a)}))}function s(e,t){return Array.prototype.slice.call((t||document).querySelectorAll(e))}function l(e,t){return e.classList.contains(t)}function a(e){e()}function u(e){return!!(e&&/pre/i.test(e.nodeName)&&(e.hasAttribute("data-line")||e.id&&Prism.util.isActive(e,i)))}function c(){var e=location.hash.slice(1);s(".temporary.line-highlight").forEach((function(e){e.parentNode.removeChild(e)}));var t=(e.match(/\.([\d,-]+)$/)||[,""])[1];if(t&&!document.getElementById(e)){var i=e.slice(0,e.lastIndexOf(".")),n=document.getElementById(i);n&&(n.hasAttribute("data-line")||n.setAttribute("data-line",""),Prism.plugins.lineHighlight.highlightLines(n,t,"temporary ")(),r&&document.querySelector(".temporary.line-highlight").scrollIntoView())}}}(); +!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document){var e="line-numbers",n=/\n(?!$)/g,t=Prism.plugins.lineNumbers={getLine:function(n,t){if("PRE"===n.tagName&&n.classList.contains(e)){var i=n.querySelector(".line-numbers-rows");if(i){var r=parseInt(n.getAttribute("data-start"),10)||1,s=r+(i.children.length-1);ts&&(t=s);var l=t-r;return i.children[l]}}},resize:function(e){r([e])},assumeViewportIndependence:!0},i=void 0;window.addEventListener("resize",(function(){t.assumeViewportIndependence&&i===window.innerWidth||(i=window.innerWidth,r(Array.prototype.slice.call(document.querySelectorAll("pre.line-numbers"))))})),Prism.hooks.add("complete",(function(t){if(t.code){var i=t.element,s=i.parentNode;if(s&&/pre/i.test(s.nodeName)&&!i.querySelector(".line-numbers-rows")&&Prism.util.isActive(i,e)){i.classList.remove(e),s.classList.add(e);var l,o=t.code.match(n),a=o?o.length+1:1,u=new Array(a+1).join("");(l=document.createElement("span")).setAttribute("aria-hidden","true"),l.className="line-numbers-rows",l.innerHTML=u,s.hasAttribute("data-start")&&(s.style.counterReset="linenumber "+(parseInt(s.getAttribute("data-start"),10)-1)),t.element.appendChild(l),r([s]),Prism.hooks.run("line-numbers",t)}}})),Prism.hooks.add("line-numbers",(function(e){e.plugins=e.plugins||{},e.plugins.lineNumbers=!0}))}function r(e){if(0!=(e=e.filter((function(e){var n,t=(n=e,n?window.getComputedStyle?getComputedStyle(n):n.currentStyle||null:null)["white-space"];return"pre-wrap"===t||"pre-line"===t}))).length){var t=e.map((function(e){var t=e.querySelector("code"),i=e.querySelector(".line-numbers-rows");if(t&&i){var r=e.querySelector(".line-numbers-sizer"),s=t.textContent.split(n);r||((r=document.createElement("span")).className="line-numbers-sizer",t.appendChild(r)),r.innerHTML="0",r.style.display="block";var l=r.getBoundingClientRect().height;return r.innerHTML="",{element:e,lines:s,lineHeights:[],oneLinerHeight:l,sizer:r}}})).filter(Boolean);t.forEach((function(e){var n=e.sizer,t=e.lines,i=e.lineHeights,r=e.oneLinerHeight;i[t.length-1]=void 0,t.forEach((function(e,t){if(e&&e.length>1){var s=n.appendChild(document.createElement("span"));s.style.display="block",s.textContent=e}else i[t]=r}))})),t.forEach((function(e){for(var n=e.sizer,t=e.lineHeights,i=0,r=0;r= 145) { + $header.addClass('header-expand'); + } + }); + $header.on('mouseleave', function () { + $header.removeClass('header-expand'); + }); + + /* + * add prettyprint classes to our current active codeblock + * run prettyPrint() to highlight the active code + * scroll to the line when prettyprint is done + * highlight the current line + */ + var renderCurrentCodeblock = function(id) { + Prism.highlightAllUnder(document.querySelector('.frame-code-container .frame-code.active')); + highlightCurrentLine(); + } + + /* + * Highlight the active and neighboring lines for the current frame + * Adjust the offset to make sure that line is veritcally centered + */ + + var highlightCurrentLine = function() { + // We show more code than needed, purely for proper syntax highlighting + // Let’s hide a big chunk of that code and then scroll the remaining block + $activeFrame.find('.code-block').first().css({ + maxHeight: 345, + overflow: 'hidden', + }); + + var line = $activeFrame.find('.code-block .line-highlight').first()[0]; + line.scrollIntoView(); + line.parentElement.scrollTop -= 180; + + $container.scrollTop(0); + } + + /* + * click handler for loading codeblocks + */ + + $frameContainer.on('click', '.frame', function() { + + var $this = $(this); + var id = /frame\-line\-([\d]*)/.exec($this.attr('id'))[1]; + var $codeFrame = $('#frame-code-' + id); + + if ($codeFrame) { + + $activeLine.removeClass('active'); + $activeFrame.removeClass('active'); + + $this.addClass('active'); + $codeFrame.addClass('active'); + + $activeLine = $this; + $activeFrame = $codeFrame; + + renderCurrentCodeblock(id); + + } + + }); + + var clipboard = new Clipboard('.clipboard'); + var showTooltip = function(elem, msg) { + elem.classList.add('tooltipped', 'tooltipped-s'); + elem.setAttribute('aria-label', msg); + }; + + clipboard.on('success', function(e) { + e.clearSelection(); + + showTooltip(e.trigger, 'Copied!'); + }); + + clipboard.on('error', function(e) { + showTooltip(e.trigger, fallbackMessage(e.action)); + }); + + var btn = document.querySelector('.clipboard'); + + btn.addEventListener('mouseleave', function(e) { + e.currentTarget.classList.remove('tooltipped', 'tooltipped-s'); + e.currentTarget.removeAttribute('aria-label'); + }); + + function fallbackMessage(action) { + var actionMsg = ''; + var actionKey = (action === 'cut' ? 'X' : 'C'); + + if (/Mac/i.test(navigator.userAgent)) { + actionMsg = 'Press ⌘-' + actionKey + ' to ' + action; + } else { + actionMsg = 'Press Ctrl-' + actionKey + ' to ' + action; + } + + return actionMsg; + } + + function scrollIntoView($node, $parent) { + var nodeOffset = $node.offset(); + var nodeTop = nodeOffset.top; + var nodeBottom = nodeTop + nodeOffset.height; + var parentScrollTop = $parent.scrollTop(); + var parentHeight = $parent.height(); + + if (nodeTop < 0) { + $parent.scrollTop(parentScrollTop + nodeTop); + } else if (nodeBottom > parentHeight) { + $parent.scrollTop(parentScrollTop + nodeBottom - parentHeight); + } + } + + $(document).on('keydown', function(e) { + var applicationFrames = $frameContainer.hasClass('frames-container-application'), + frameClass = applicationFrames ? '.frame.frame-application' : '.frame'; + + if(e.ctrlKey || e.which === 74 || e.which === 75) { + // CTRL+Arrow-UP/k and Arrow-Down/j support: + // 1) select the next/prev element + // 2) make sure the newly selected element is within the view-scope + // 3) focus the (right) container, so arrow-up/down (without ctrl) scroll the details + if (e.which === 38 /* arrow up */ || e.which === 75 /* k */) { + $activeLine.prev(frameClass).click(); + scrollIntoView($activeLine, $leftPanel); + $container.focus(); + e.preventDefault(); + } else if (e.which === 40 /* arrow down */ || e.which === 74 /* j */) { + $activeLine.next(frameClass).click(); + scrollIntoView($activeLine, $leftPanel); + $container.focus(); + e.preventDefault(); + } + } else if (e.which == 78 /* n */) { + if ($appFramesTab.length) { + setActiveFramesTab($('.frames-tab:not(.frames-tab-active)')); + } + } + }); + + // Avoid to quit the page with some protocol (e.g. IntelliJ Platform REST API) + $ajaxEditors.on('click', function(e){ + e.preventDefault(); + $.get(this.href); + }); + + // Symfony VarDumper: Close the by default expanded objects + $('.sf-dump-expanded') + .removeClass('sf-dump-expanded') + .addClass('sf-dump-compact'); + $('.sf-dump-toggle span').html('▶'); + + // Make the given frames-tab active + function setActiveFramesTab($tab) { + $tab.addClass('frames-tab-active'); + + if ($tab.attr('id') == 'application-frames-tab') { + $frameContainer.addClass('frames-container-application'); + $allFramesTab.removeClass('frames-tab-active'); + } else { + $frameContainer.removeClass('frames-container-application'); + $appFramesTab.removeClass('frames-tab-active'); + } + } + + $('a.frames-tab').on('click', function(e) { + e.preventDefault(); + setActiveFramesTab($(this)); + }); + + // Render late enough for highlightCurrentLine to be ready + renderCurrentCodeblock(); +}); diff --git a/vendor/filp/whoops/src/Whoops/Resources/js/zepto.min.js b/vendor/filp/whoops/src/Whoops/Resources/js/zepto.min.js new file mode 100644 index 00000000..0b2f97ad --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/js/zepto.min.js @@ -0,0 +1,2 @@ +/* Zepto v1.1.3 - zepto event ajax form ie - zeptojs.com/license */ +var Zepto=function(){function L(t){return null==t?String(t):j[T.call(t)]||"object"}function Z(t){return"function"==L(t)}function $(t){return null!=t&&t==t.window}function _(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function D(t){return"object"==L(t)}function R(t){return D(t)&&!$(t)&&Object.getPrototypeOf(t)==Object.prototype}function M(t){return"number"==typeof t.length}function k(t){return s.call(t,function(t){return null!=t})}function z(t){return t.length>0?n.fn.concat.apply([],t):t}function F(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function q(t){return t in f?f[t]:f[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function H(t,e){return"number"!=typeof e||c[F(t)]?e:e+"px"}function I(t){var e,n;return u[t]||(e=a.createElement(t),a.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),u[t]=n),u[t]}function V(t){return"children"in t?o.call(t.children):n.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function U(n,i,r){for(e in i)r&&(R(i[e])||A(i[e]))?(R(i[e])&&!R(n[e])&&(n[e]={}),A(i[e])&&!A(n[e])&&(n[e]=[]),U(n[e],i[e],r)):i[e]!==t&&(n[e]=i[e])}function B(t,e){return null==e?n(t):n(t).filter(e)}function J(t,e,n,i){return Z(e)?e.call(t,n,i):e}function X(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function W(e,n){var i=e.className,r=i&&i.baseVal!==t;return n===t?r?i.baseVal:i:void(r?i.baseVal=n:e.className=n)}function Y(t){var e;try{return t?"true"==t||("false"==t?!1:"null"==t?null:/^0/.test(t)||isNaN(e=Number(t))?/^[\[\{]/.test(t)?n.parseJSON(t):t:e):t}catch(i){return t}}function G(t,e){e(t);for(var n in t.childNodes)G(t.childNodes[n],e)}var t,e,n,i,C,N,r=[],o=r.slice,s=r.filter,a=window.document,u={},f={},c={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},l=/^\s*<(\w+|!)[^>]*>/,h=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,p=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,d=/^(?:body|html)$/i,m=/([A-Z])/g,g=["val","css","html","text","data","width","height","offset"],v=["after","prepend","before","append"],y=a.createElement("table"),x=a.createElement("tr"),b={tr:a.createElement("tbody"),tbody:y,thead:y,tfoot:y,td:x,th:x,"*":a.createElement("div")},w=/complete|loaded|interactive/,E=/^[\w-]*$/,j={},T=j.toString,S={},O=a.createElement("div"),P={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},A=Array.isArray||function(t){return t instanceof Array};return S.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var i,r=t.parentNode,o=!r;return o&&(r=O).appendChild(t),i=~S.qsa(r,e).indexOf(t),o&&O.removeChild(t),i},C=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},N=function(t){return s.call(t,function(e,n){return t.indexOf(e)==n})},S.fragment=function(e,i,r){var s,u,f;return h.test(e)&&(s=n(a.createElement(RegExp.$1))),s||(e.replace&&(e=e.replace(p,"<$1>")),i===t&&(i=l.test(e)&&RegExp.$1),i in b||(i="*"),f=b[i],f.innerHTML=""+e,s=n.each(o.call(f.childNodes),function(){f.removeChild(this)})),R(r)&&(u=n(s),n.each(r,function(t,e){g.indexOf(t)>-1?u[t](e):u.attr(t,e)})),s},S.Z=function(t,e){return t=t||[],t.__proto__=n.fn,t.selector=e||"",t},S.isZ=function(t){return t instanceof S.Z},S.init=function(e,i){var r;if(!e)return S.Z();if("string"==typeof e)if(e=e.trim(),"<"==e[0]&&l.test(e))r=S.fragment(e,RegExp.$1,i),e=null;else{if(i!==t)return n(i).find(e);r=S.qsa(a,e)}else{if(Z(e))return n(a).ready(e);if(S.isZ(e))return e;if(A(e))r=k(e);else if(D(e))r=[e],e=null;else if(l.test(e))r=S.fragment(e.trim(),RegExp.$1,i),e=null;else{if(i!==t)return n(i).find(e);r=S.qsa(a,e)}}return S.Z(r,e)},n=function(t,e){return S.init(t,e)},n.extend=function(t){var e,n=o.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){U(t,n,e)}),t},S.qsa=function(t,e){var n,i="#"==e[0],r=!i&&"."==e[0],s=i||r?e.slice(1):e,a=E.test(s);return _(t)&&a&&i?(n=t.getElementById(s))?[n]:[]:1!==t.nodeType&&9!==t.nodeType?[]:o.call(a&&!i?r?t.getElementsByClassName(s):t.getElementsByTagName(e):t.querySelectorAll(e))},n.contains=function(t,e){return t!==e&&t.contains(e)},n.type=L,n.isFunction=Z,n.isWindow=$,n.isArray=A,n.isPlainObject=R,n.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},n.inArray=function(t,e,n){return r.indexOf.call(e,t,n)},n.camelCase=C,n.trim=function(t){return null==t?"":String.prototype.trim.call(t)},n.uuid=0,n.support={},n.expr={},n.map=function(t,e){var n,r,o,i=[];if(M(t))for(r=0;r=0?e:e+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return r.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return Z(t)?this.not(this.not(t)):n(s.call(this,function(e){return S.matches(e,t)}))},add:function(t,e){return n(N(this.concat(n(t,e))))},is:function(t){return this.length>0&&S.matches(this[0],t)},not:function(e){var i=[];if(Z(e)&&e.call!==t)this.each(function(t){e.call(this,t)||i.push(this)});else{var r="string"==typeof e?this.filter(e):M(e)&&Z(e.item)?o.call(e):n(e);this.forEach(function(t){r.indexOf(t)<0&&i.push(t)})}return n(i)},has:function(t){return this.filter(function(){return D(t)?n.contains(this,t):n(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!D(t)?t:n(t)},last:function(){var t=this[this.length-1];return t&&!D(t)?t:n(t)},find:function(t){var e,i=this;return e="object"==typeof t?n(t).filter(function(){var t=this;return r.some.call(i,function(e){return n.contains(e,t)})}):1==this.length?n(S.qsa(this[0],t)):this.map(function(){return S.qsa(this,t)})},closest:function(t,e){var i=this[0],r=!1;for("object"==typeof t&&(r=n(t));i&&!(r?r.indexOf(i)>=0:S.matches(i,t));)i=i!==e&&!_(i)&&i.parentNode;return n(i)},parents:function(t){for(var e=[],i=this;i.length>0;)i=n.map(i,function(t){return(t=t.parentNode)&&!_(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return B(e,t)},parent:function(t){return B(N(this.pluck("parentNode")),t)},children:function(t){return B(this.map(function(){return V(this)}),t)},contents:function(){return this.map(function(){return o.call(this.childNodes)})},siblings:function(t){return B(this.map(function(t,e){return s.call(V(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return n.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=I(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var e=Z(t);if(this[0]&&!e)var i=n(t).get(0),r=i.parentNode||this.length>1;return this.each(function(o){n(this).wrapAll(e?t.call(this,o):r?i.cloneNode(!0):i)})},wrapAll:function(t){if(this[0]){n(this[0]).before(t=n(t));for(var e;(e=t.children()).length;)t=e.first();n(t).append(this)}return this},wrapInner:function(t){var e=Z(t);return this.each(function(i){var r=n(this),o=r.contents(),s=e?t.call(this,i):t;o.length?o.wrapAll(s):r.append(s)})},unwrap:function(){return this.parent().each(function(){n(this).replaceWith(n(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(e){return this.each(function(){var i=n(this);(e===t?"none"==i.css("display"):e)?i.show():i.hide()})},prev:function(t){return n(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return n(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0===arguments.length?this.length>0?this[0].innerHTML:null:this.each(function(e){var i=this.innerHTML;n(this).empty().append(J(this,t,e,i))})},text:function(e){return 0===arguments.length?this.length>0?this[0].textContent:null:this.each(function(){this.textContent=e===t?"":""+e})},attr:function(n,i){var r;return"string"==typeof n&&i===t?0==this.length||1!==this[0].nodeType?t:"value"==n&&"INPUT"==this[0].nodeName?this.val():!(r=this[0].getAttribute(n))&&n in this[0]?this[0][n]:r:this.each(function(t){if(1===this.nodeType)if(D(n))for(e in n)X(this,e,n[e]);else X(this,n,J(this,i,t,this.getAttribute(n)))})},removeAttr:function(t){return this.each(function(){1===this.nodeType&&X(this,t)})},prop:function(e,n){return e=P[e]||e,n===t?this[0]&&this[0][e]:this.each(function(t){this[e]=J(this,n,t,this[e])})},data:function(e,n){var i=this.attr("data-"+e.replace(m,"-$1").toLowerCase(),n);return null!==i?Y(i):t},val:function(t){return 0===arguments.length?this[0]&&(this[0].multiple?n(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value):this.each(function(e){this.value=J(this,t,e,this.value)})},offset:function(t){if(t)return this.each(function(e){var i=n(this),r=J(this,t,e,i.offset()),o=i.offsetParent().offset(),s={top:r.top-o.top,left:r.left-o.left};"static"==i.css("position")&&(s.position="relative"),i.css(s)});if(0==this.length)return null;var e=this[0].getBoundingClientRect();return{left:e.left+window.pageXOffset,top:e.top+window.pageYOffset,width:Math.round(e.width),height:Math.round(e.height)}},css:function(t,i){if(arguments.length<2){var r=this[0],o=getComputedStyle(r,"");if(!r)return;if("string"==typeof t)return r.style[C(t)]||o.getPropertyValue(t);if(A(t)){var s={};return n.each(A(t)?t:[t],function(t,e){s[e]=r.style[C(e)]||o.getPropertyValue(e)}),s}}var a="";if("string"==L(t))i||0===i?a=F(t)+":"+H(t,i):this.each(function(){this.style.removeProperty(F(t))});else for(e in t)t[e]||0===t[e]?a+=F(e)+":"+H(e,t[e])+";":this.each(function(){this.style.removeProperty(F(e))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf(n(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return t?r.some.call(this,function(t){return this.test(W(t))},q(t)):!1},addClass:function(t){return t?this.each(function(e){i=[];var r=W(this),o=J(this,t,e,r);o.split(/\s+/g).forEach(function(t){n(this).hasClass(t)||i.push(t)},this),i.length&&W(this,r+(r?" ":"")+i.join(" "))}):this},removeClass:function(e){return this.each(function(n){return e===t?W(this,""):(i=W(this),J(this,e,n,i).split(/\s+/g).forEach(function(t){i=i.replace(q(t)," ")}),void W(this,i.trim()))})},toggleClass:function(e,i){return e?this.each(function(r){var o=n(this),s=J(this,e,r,W(this));s.split(/\s+/g).forEach(function(e){(i===t?!o.hasClass(e):i)?o.addClass(e):o.removeClass(e)})}):this},scrollTop:function(e){if(this.length){var n="scrollTop"in this[0];return e===t?n?this[0].scrollTop:this[0].pageYOffset:this.each(n?function(){this.scrollTop=e}:function(){this.scrollTo(this.scrollX,e)})}},scrollLeft:function(e){if(this.length){var n="scrollLeft"in this[0];return e===t?n?this[0].scrollLeft:this[0].pageXOffset:this.each(n?function(){this.scrollLeft=e}:function(){this.scrollTo(e,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),i=this.offset(),r=d.test(e[0].nodeName)?{top:0,left:0}:e.offset();return i.top-=parseFloat(n(t).css("margin-top"))||0,i.left-=parseFloat(n(t).css("margin-left"))||0,r.top+=parseFloat(n(e[0]).css("border-top-width"))||0,r.left+=parseFloat(n(e[0]).css("border-left-width"))||0,{top:i.top-r.top,left:i.left-r.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||a.body;t&&!d.test(t.nodeName)&&"static"==n(t).css("position");)t=t.offsetParent;return t})}},n.fn.detach=n.fn.remove,["width","height"].forEach(function(e){var i=e.replace(/./,function(t){return t[0].toUpperCase()});n.fn[e]=function(r){var o,s=this[0];return r===t?$(s)?s["inner"+i]:_(s)?s.documentElement["scroll"+i]:(o=this.offset())&&o[e]:this.each(function(t){s=n(this),s.css(e,J(this,r,t,s[e]()))})}}),v.forEach(function(t,e){var i=e%2;n.fn[t]=function(){var t,o,r=n.map(arguments,function(e){return t=L(e),"object"==t||"array"==t||null==e?e:S.fragment(e)}),s=this.length>1;return r.length<1?this:this.each(function(t,a){o=i?a:a.parentNode,a=0==e?a.nextSibling:1==e?a.firstChild:2==e?a:null,r.forEach(function(t){if(s)t=t.cloneNode(!0);else if(!o)return n(t).remove();G(o.insertBefore(t,a),function(t){null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src||window.eval.call(window,t.innerHTML)})})})},n.fn[i?t+"To":"insert"+(e?"Before":"After")]=function(e){return n(e)[t](this),this}}),S.Z.prototype=n.fn,S.uniq=N,S.deserializeValue=Y,n.zepto=S,n}();window.Zepto=Zepto,void 0===window.$&&(window.$=Zepto),function(t){function l(t){return t._zid||(t._zid=e++)}function h(t,e,n,i){if(e=p(e),e.ns)var r=d(e.ns);return(s[l(t)]||[]).filter(function(t){return!(!t||e.e&&t.e!=e.e||e.ns&&!r.test(t.ns)||n&&l(t.fn)!==l(n)||i&&t.sel!=i)})}function p(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function d(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function m(t,e){return t.del&&!u&&t.e in f||!!e}function g(t){return c[t]||u&&f[t]||t}function v(e,i,r,o,a,u,f){var h=l(e),d=s[h]||(s[h]=[]);i.split(/\s/).forEach(function(i){if("ready"==i)return t(document).ready(r);var s=p(i);s.fn=r,s.sel=a,s.e in c&&(r=function(e){var n=e.relatedTarget;return!n||n!==this&&!t.contains(this,n)?s.fn.apply(this,arguments):void 0}),s.del=u;var l=u||r;s.proxy=function(t){if(t=j(t),!t.isImmediatePropagationStopped()){t.data=o;var i=l.apply(e,t._args==n?[t]:[t].concat(t._args));return i===!1&&(t.preventDefault(),t.stopPropagation()),i}},s.i=d.length,d.push(s),"addEventListener"in e&&e.addEventListener(g(s.e),s.proxy,m(s,f))})}function y(t,e,n,i,r){var o=l(t);(e||"").split(/\s/).forEach(function(e){h(t,e,n,i).forEach(function(e){delete s[o][e.i],"removeEventListener"in t&&t.removeEventListener(g(e.e),e.proxy,m(e,r))})})}function j(e,i){return(i||!e.isDefaultPrevented)&&(i||(i=e),t.each(E,function(t,n){var r=i[t];e[t]=function(){return this[n]=x,r&&r.apply(i,arguments)},e[n]=b}),(i.defaultPrevented!==n?i.defaultPrevented:"returnValue"in i?i.returnValue===!1:i.getPreventDefault&&i.getPreventDefault())&&(e.isDefaultPrevented=x)),e}function T(t){var e,i={originalEvent:t};for(e in t)w.test(e)||t[e]===n||(i[e]=t[e]);return j(i,t)}var n,e=1,i=Array.prototype.slice,r=t.isFunction,o=function(t){return"string"==typeof t},s={},a={},u="onfocusin"in window,f={focus:"focusin",blur:"focusout"},c={mouseenter:"mouseover",mouseleave:"mouseout"};a.click=a.mousedown=a.mouseup=a.mousemove="MouseEvents",t.event={add:v,remove:y},t.proxy=function(e,n){if(r(e)){var i=function(){return e.apply(n,arguments)};return i._zid=l(e),i}if(o(n))return t.proxy(e[n],e);throw new TypeError("expected function")},t.fn.bind=function(t,e,n){return this.on(t,e,n)},t.fn.unbind=function(t,e){return this.off(t,e)},t.fn.one=function(t,e,n,i){return this.on(t,e,n,i,1)};var x=function(){return!0},b=function(){return!1},w=/^([A-Z]|returnValue$|layer[XY]$)/,E={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};t.fn.delegate=function(t,e,n){return this.on(e,t,n)},t.fn.undelegate=function(t,e,n){return this.off(e,t,n)},t.fn.live=function(e,n){return t(document.body).delegate(this.selector,e,n),this},t.fn.die=function(e,n){return t(document.body).undelegate(this.selector,e,n),this},t.fn.on=function(e,s,a,u,f){var c,l,h=this;return e&&!o(e)?(t.each(e,function(t,e){h.on(t,s,a,e,f)}),h):(o(s)||r(u)||u===!1||(u=a,a=s,s=n),(r(a)||a===!1)&&(u=a,a=n),u===!1&&(u=b),h.each(function(n,r){f&&(c=function(t){return y(r,t.type,u),u.apply(this,arguments)}),s&&(l=function(e){var n,o=t(e.target).closest(s,r).get(0);return o&&o!==r?(n=t.extend(T(e),{currentTarget:o,liveFired:r}),(c||u).apply(o,[n].concat(i.call(arguments,1)))):void 0}),v(r,e,u,a,s,l||c)}))},t.fn.off=function(e,i,s){var a=this;return e&&!o(e)?(t.each(e,function(t,e){a.off(t,i,e)}),a):(o(i)||r(s)||s===!1||(s=i,i=n),s===!1&&(s=b),a.each(function(){y(this,e,s,i)}))},t.fn.trigger=function(e,n){return e=o(e)||t.isPlainObject(e)?t.Event(e):j(e),e._args=n,this.each(function(){"dispatchEvent"in this?this.dispatchEvent(e):t(this).triggerHandler(e,n)})},t.fn.triggerHandler=function(e,n){var i,r;return this.each(function(s,a){i=T(o(e)?t.Event(e):e),i._args=n,i.target=a,t.each(h(a,e.type||e),function(t,e){return r=e.proxy(i),i.isImmediatePropagationStopped()?!1:void 0})}),r},"focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(e){t.fn[e]=function(t){return t?this.bind(e,t):this.trigger(e)}}),["focus","blur"].forEach(function(e){t.fn[e]=function(t){return t?this.bind(e,t):this.each(function(){try{this[e]()}catch(t){}}),this}}),t.Event=function(t,e){o(t)||(e=t,t=e.type);var n=document.createEvent(a[t]||"Events"),i=!0;if(e)for(var r in e)"bubbles"==r?i=!!e[r]:n[r]=e[r];return n.initEvent(t,i,!0),j(n)}}(Zepto),function(t){function l(e,n,i){var r=t.Event(n);return t(e).trigger(r,i),!r.isDefaultPrevented()}function h(t,e,i,r){return t.global?l(e||n,i,r):void 0}function p(e){e.global&&0===t.active++&&h(e,null,"ajaxStart")}function d(e){e.global&&!--t.active&&h(e,null,"ajaxStop")}function m(t,e){var n=e.context;return e.beforeSend.call(n,t,e)===!1||h(e,n,"ajaxBeforeSend",[t,e])===!1?!1:void h(e,n,"ajaxSend",[t,e])}function g(t,e,n,i){var r=n.context,o="success";n.success.call(r,t,o,e),i&&i.resolveWith(r,[t,o,e]),h(n,r,"ajaxSuccess",[e,n,t]),y(o,e,n)}function v(t,e,n,i,r){var o=i.context;i.error.call(o,n,e,t),r&&r.rejectWith(o,[n,e,t]),h(i,o,"ajaxError",[n,i,t||e]),y(e,n,i)}function y(t,e,n){var i=n.context;n.complete.call(i,e,t),h(n,i,"ajaxComplete",[e,n]),d(n)}function x(){}function b(t){return t&&(t=t.split(";",2)[0]),t&&(t==f?"html":t==u?"json":s.test(t)?"script":a.test(t)&&"xml")||"text"}function w(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function E(e){e.processData&&e.data&&"string"!=t.type(e.data)&&(e.data=t.param(e.data,e.traditional)),!e.data||e.type&&"GET"!=e.type.toUpperCase()||(e.url=w(e.url,e.data),e.data=void 0)}function j(e,n,i,r){return t.isFunction(n)&&(r=i,i=n,n=void 0),t.isFunction(i)||(r=i,i=void 0),{url:e,data:n,success:i,dataType:r}}function S(e,n,i,r){var o,s=t.isArray(n),a=t.isPlainObject(n);t.each(n,function(n,u){o=t.type(u),r&&(n=i?r:r+"["+(a||"object"==o||"array"==o?n:"")+"]"),!r&&s?e.add(u.name,u.value):"array"==o||!i&&"object"==o?S(e,u,i,n):e.add(n,u)})}var i,r,e=0,n=window.document,o=/)<[^<]*)*<\/script>/gi,s=/^(?:text|application)\/javascript/i,a=/^(?:text|application)\/xml/i,u="application/json",f="text/html",c=/^\s*$/;t.active=0,t.ajaxJSONP=function(i,r){if(!("type"in i))return t.ajax(i);var f,h,o=i.jsonpCallback,s=(t.isFunction(o)?o():o)||"jsonp"+ ++e,a=n.createElement("script"),u=window[s],c=function(e){t(a).triggerHandler("error",e||"abort")},l={abort:c};return r&&r.promise(l),t(a).on("load error",function(e,n){clearTimeout(h),t(a).off().remove(),"error"!=e.type&&f?g(f[0],l,i,r):v(null,n||"error",l,i,r),window[s]=u,f&&t.isFunction(u)&&u(f[0]),u=f=void 0}),m(l,i)===!1?(c("abort"),l):(window[s]=function(){f=arguments},a.src=i.url.replace(/\?(.+)=\?/,"?$1="+s),n.head.appendChild(a),i.timeout>0&&(h=setTimeout(function(){c("timeout")},i.timeout)),l)},t.ajaxSettings={type:"GET",beforeSend:x,success:x,error:x,complete:x,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:u,xml:"application/xml, text/xml",html:f,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},t.ajax=function(e){var n=t.extend({},e||{}),o=t.Deferred&&t.Deferred();for(i in t.ajaxSettings)void 0===n[i]&&(n[i]=t.ajaxSettings[i]);p(n),n.crossDomain||(n.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(n.url)&&RegExp.$2!=window.location.host),n.url||(n.url=window.location.toString()),E(n),n.cache===!1&&(n.url=w(n.url,"_="+Date.now()));var s=n.dataType,a=/\?.+=\?/.test(n.url);if("jsonp"==s||a)return a||(n.url=w(n.url,n.jsonp?n.jsonp+"=?":n.jsonp===!1?"":"callback=?")),t.ajaxJSONP(n,o);var j,u=n.accepts[s],f={},l=function(t,e){f[t.toLowerCase()]=[t,e]},h=/^([\w-]+:)\/\//.test(n.url)?RegExp.$1:window.location.protocol,d=n.xhr(),y=d.setRequestHeader;if(o&&o.promise(d),n.crossDomain||l("X-Requested-With","XMLHttpRequest"),l("Accept",u||"*/*"),(u=n.mimeType||u)&&(u.indexOf(",")>-1&&(u=u.split(",",2)[0]),d.overrideMimeType&&d.overrideMimeType(u)),(n.contentType||n.contentType!==!1&&n.data&&"GET"!=n.type.toUpperCase())&&l("Content-Type",n.contentType||"application/x-www-form-urlencoded"),n.headers)for(r in n.headers)l(r,n.headers[r]);if(d.setRequestHeader=l,d.onreadystatechange=function(){if(4==d.readyState){d.onreadystatechange=x,clearTimeout(j);var e,i=!1;if(d.status>=200&&d.status<300||304==d.status||0==d.status&&"file:"==h){s=s||b(n.mimeType||d.getResponseHeader("content-type")),e=d.responseText;try{"script"==s?(1,eval)(e):"xml"==s?e=d.responseXML:"json"==s&&(e=c.test(e)?null:t.parseJSON(e))}catch(r){i=r}i?v(i,"parsererror",d,n,o):g(e,d,n,o)}else v(d.statusText||null,d.status?"error":"abort",d,n,o)}},m(d,n)===!1)return d.abort(),v(null,"abort",d,n,o),d;if(n.xhrFields)for(r in n.xhrFields)d[r]=n.xhrFields[r];var T="async"in n?n.async:!0;d.open(n.type,n.url,T,n.username,n.password);for(r in f)y.apply(d,f[r]);return n.timeout>0&&(j=setTimeout(function(){d.onreadystatechange=x,d.abort(),v(null,"timeout",d,n,o)},n.timeout)),d.send(n.data?n.data:null),d},t.get=function(){return t.ajax(j.apply(null,arguments))},t.post=function(){var e=j.apply(null,arguments);return e.type="POST",t.ajax(e)},t.getJSON=function(){var e=j.apply(null,arguments);return e.dataType="json",t.ajax(e)},t.fn.load=function(e,n,i){if(!this.length)return this;var a,r=this,s=e.split(/\s/),u=j(e,n,i),f=u.success;return s.length>1&&(u.url=s[0],a=s[1]),u.success=function(e){r.html(a?t("
    ").html(e.replace(o,"")).find(a):e),f&&f.apply(r,arguments)},t.ajax(u),this};var T=encodeURIComponent;t.param=function(t,e){var n=[];return n.add=function(t,e){this.push(T(t)+"="+T(e))},S(n,t,e),n.join("&").replace(/%20/g,"+")}}(Zepto),function(t){t.fn.serializeArray=function(){var n,e=[];return t([].slice.call(this.get(0).elements)).each(function(){n=t(this);var i=n.attr("type");"fieldset"!=this.nodeName.toLowerCase()&&!this.disabled&&"submit"!=i&&"reset"!=i&&"button"!=i&&("radio"!=i&&"checkbox"!=i||this.checked)&&e.push({name:n.attr("name"),value:n.val()})}),e},t.fn.serialize=function(){var t=[];return this.serializeArray().forEach(function(e){t.push(encodeURIComponent(e.name)+"="+encodeURIComponent(e.value))}),t.join("&")},t.fn.submit=function(e){if(e)this.bind("submit",e);else if(this.length){var n=t.Event("submit");this.eq(0).trigger(n),n.isDefaultPrevented()||this.get(0).submit()}return this}}(Zepto),function(t){"__proto__"in{}||t.extend(t.zepto,{Z:function(e,n){return e=e||[],t.extend(e,t.fn),e.selector=n||"",e.__Z=!0,e},isZ:function(e){return"array"===t.type(e)&&"__Z"in e}});try{getComputedStyle(void 0)}catch(e){var n=getComputedStyle;window.getComputedStyle=function(t){try{return n(t)}catch(e){return null}}}}(Zepto); diff --git a/vendor/filp/whoops/src/Whoops/Resources/views/env_details.html.php b/vendor/filp/whoops/src/Whoops/Resources/views/env_details.html.php new file mode 100644 index 00000000..30fcb9cb --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/views/env_details.html.php @@ -0,0 +1,42 @@ + +
    +

    Environment & details:

    + +
    + $data): ?> +
    + + + + + + + + + + $value): ?> + + + + + +
    KeyValue
    escape($k) ?>dump($value) ?>
    + + + empty + +
    + +
    + + +
    + + $h): ?> +
    + . escape(get_class($h)) ?> +
    + +
    + +
    diff --git a/vendor/filp/whoops/src/Whoops/Resources/views/frame_code.html.php b/vendor/filp/whoops/src/Whoops/Resources/views/frame_code.html.php new file mode 100644 index 00000000..fd3d930e --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/views/frame_code.html.php @@ -0,0 +1,67 @@ + +
    + $frame): ?> + getLine(); ?> +
    + + getFileLines($line - 20, 40); + + // getFileLines can return null if there is no source code + if ($range): + $range = array_map(function ($line) { return empty($line) ? ' ' : $line;}, $range); + $start = key($range) + 1; + $code = join("\n", $range); + ?> +
    escape($code) ?>
    + + + + + dumpArgs($frame); ?> + +
    + Arguments +
    +
    + +
    + + + getComments(); + ?> +
    + $comment): ?> + +
    + escape($context) ?> + escapeButPreserveUris($comment) ?> +
    + +
    + +
    + +
    diff --git a/vendor/filp/whoops/src/Whoops/Resources/views/frame_list.html.php b/vendor/filp/whoops/src/Whoops/Resources/views/frame_list.html.php new file mode 100644 index 00000000..a4bc338c --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/views/frame_list.html.php @@ -0,0 +1,17 @@ + + $frame): ?> +
    + +
    + breakOnDelimiter('\\', $tpl->escape($frame->getClass() ?: '')) ?> + breakOnDelimiter('\\', $tpl->escape($frame->getFunction() ?: '')) ?> +
    + +
    + getFile() ? $tpl->breakOnDelimiter('/', $tpl->shorten($tpl->escape($frame->getFile()))) : '<#unknown>' ?>getLine() ?> +
    +
    +"> + render($frame_list) ?> +
    \ No newline at end of file diff --git a/vendor/filp/whoops/src/Whoops/Resources/views/frames_description.html.php b/vendor/filp/whoops/src/Whoops/Resources/views/frames_description.html.php new file mode 100644 index 00000000..5d32f714 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/views/frames_description.html.php @@ -0,0 +1,14 @@ + diff --git a/vendor/filp/whoops/src/Whoops/Resources/views/header.html.php b/vendor/filp/whoops/src/Whoops/Resources/views/header.html.php new file mode 100644 index 00000000..2f2d90f6 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/views/header.html.php @@ -0,0 +1,96 @@ +
    +
    + $nameSection): ?> + + escape($nameSection) ?> + + escape($nameSection) . ' \\' ?> + + + + (escape($code) ?>) + +
    + +
    + + escape($message) ?> + + + +
    + Previous exceptions +
    + +
      + $previousMessage): ?> +
    • + escape($previousMessage) ?> + () +
    • + +
    + + + + + + No message + + + + + escape($plain_exception) ?> + + +
    +
    diff --git a/vendor/filp/whoops/src/Whoops/Resources/views/header_outer.html.php b/vendor/filp/whoops/src/Whoops/Resources/views/header_outer.html.php new file mode 100644 index 00000000..f682cbba --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/views/header_outer.html.php @@ -0,0 +1,3 @@ +
    + render($header) ?> +
    diff --git a/vendor/filp/whoops/src/Whoops/Resources/views/layout.html.php b/vendor/filp/whoops/src/Whoops/Resources/views/layout.html.php new file mode 100644 index 00000000..7ad15eae --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/views/layout.html.php @@ -0,0 +1,34 @@ + + + + + + + + <?php echo $tpl->escape($page_title) ?> + + + + + + +
    +
    + + render($panel_left_outer) ?> + + render($panel_details_outer) ?> + +
    +
    + + + + + + + diff --git a/vendor/filp/whoops/src/Whoops/Resources/views/panel_details.html.php b/vendor/filp/whoops/src/Whoops/Resources/views/panel_details.html.php new file mode 100644 index 00000000..a85e4511 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/views/panel_details.html.php @@ -0,0 +1,2 @@ +render($frame_code) ?> +render($env_details) ?> \ No newline at end of file diff --git a/vendor/filp/whoops/src/Whoops/Resources/views/panel_details_outer.html.php b/vendor/filp/whoops/src/Whoops/Resources/views/panel_details_outer.html.php new file mode 100644 index 00000000..8162d8c5 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/views/panel_details_outer.html.php @@ -0,0 +1,3 @@ +
    + render($panel_details) ?> +
    \ No newline at end of file diff --git a/vendor/filp/whoops/src/Whoops/Resources/views/panel_left.html.php b/vendor/filp/whoops/src/Whoops/Resources/views/panel_left.html.php new file mode 100644 index 00000000..7e652e46 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/views/panel_left.html.php @@ -0,0 +1,4 @@ +render($header_outer); +$tpl->render($frames_description); +$tpl->render($frames_container); diff --git a/vendor/filp/whoops/src/Whoops/Resources/views/panel_left_outer.html.php b/vendor/filp/whoops/src/Whoops/Resources/views/panel_left_outer.html.php new file mode 100644 index 00000000..77b575c1 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Resources/views/panel_left_outer.html.php @@ -0,0 +1,3 @@ +
    + render($panel_left) ?> +
    \ No newline at end of file diff --git a/vendor/filp/whoops/src/Whoops/Run.php b/vendor/filp/whoops/src/Whoops/Run.php new file mode 100644 index 00000000..08627680 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Run.php @@ -0,0 +1,597 @@ + + */ + +namespace Whoops; + +use InvalidArgumentException; +use Throwable; +use Whoops\Exception\ErrorException; +use Whoops\Handler\CallbackHandler; +use Whoops\Handler\Handler; +use Whoops\Handler\HandlerInterface; +use Whoops\Inspector\CallableInspectorFactory; +use Whoops\Inspector\InspectorFactory; +use Whoops\Inspector\InspectorFactoryInterface; +use Whoops\Inspector\InspectorInterface; +use Whoops\Util\Misc; +use Whoops\Util\SystemFacade; + +final class Run implements RunInterface +{ + /** + * @var bool + */ + private $isRegistered; + + /** + * @var bool + */ + private $allowQuit = true; + + /** + * @var bool + */ + private $sendOutput = true; + + /** + * @var integer|false + */ + private $sendHttpCode = 500; + + /** + * @var integer|false + */ + private $sendExitCode = 1; + + /** + * @var HandlerInterface[] + */ + private $handlerStack = []; + + /** + * @var array + * @psalm-var list + */ + private $silencedPatterns = []; + + /** + * @var SystemFacade + */ + private $system; + + /** + * In certain scenarios, like in shutdown handler, we can not throw exceptions. + * + * @var bool + */ + private $canThrowExceptions = true; + + /** + * The inspector factory to create inspectors. + * + * @var InspectorFactoryInterface + */ + private $inspectorFactory; + + /** + * @var array + */ + private $frameFilters = []; + + public function __construct(SystemFacade $system = null) + { + $this->system = $system ?: new SystemFacade; + $this->inspectorFactory = new InspectorFactory(); + } + + /** + * Explicitly request your handler runs as the last of all currently registered handlers. + * + * @param callable|HandlerInterface $handler + * + * @return Run + */ + public function appendHandler($handler) + { + array_unshift($this->handlerStack, $this->resolveHandler($handler)); + return $this; + } + + /** + * Explicitly request your handler runs as the first of all currently registered handlers. + * + * @param callable|HandlerInterface $handler + * + * @return Run + */ + public function prependHandler($handler) + { + return $this->pushHandler($handler); + } + + /** + * Register your handler as the last of all currently registered handlers (to be executed first). + * Prefer using appendHandler and prependHandler for clarity. + * + * @param callable|HandlerInterface $handler + * + * @return Run + * + * @throws InvalidArgumentException If argument is not callable or instance of HandlerInterface. + */ + public function pushHandler($handler) + { + $this->handlerStack[] = $this->resolveHandler($handler); + return $this; + } + + /** + * Removes and returns the last handler pushed to the handler stack. + * + * @see Run::removeFirstHandler(), Run::removeLastHandler() + * + * @return HandlerInterface|null + */ + public function popHandler() + { + return array_pop($this->handlerStack); + } + + /** + * Removes the first handler. + * + * @return void + */ + public function removeFirstHandler() + { + array_pop($this->handlerStack); + } + + /** + * Removes the last handler. + * + * @return void + */ + public function removeLastHandler() + { + array_shift($this->handlerStack); + } + + /** + * Returns an array with all handlers, in the order they were added to the stack. + * + * @return array + */ + public function getHandlers() + { + return $this->handlerStack; + } + + /** + * Clears all handlers in the handlerStack, including the default PrettyPage handler. + * + * @return Run + */ + public function clearHandlers() + { + $this->handlerStack = []; + return $this; + } + + public function getFrameFilters() + { + return $this->frameFilters; + } + + public function clearFrameFilters() + { + $this->frameFilters = []; + return $this; + } + + /** + * Registers this instance as an error handler. + * + * @return Run + */ + public function register() + { + if (!$this->isRegistered) { + // Workaround PHP bug 42098 + // https://bugs.php.net/bug.php?id=42098 + class_exists("\\Whoops\\Exception\\ErrorException"); + class_exists("\\Whoops\\Exception\\FrameCollection"); + class_exists("\\Whoops\\Exception\\Frame"); + class_exists("\\Whoops\\Exception\\Inspector"); + class_exists("\\Whoops\\Inspector\\InspectorFactory"); + + $this->system->setErrorHandler([$this, self::ERROR_HANDLER]); + $this->system->setExceptionHandler([$this, self::EXCEPTION_HANDLER]); + $this->system->registerShutdownFunction([$this, self::SHUTDOWN_HANDLER]); + + $this->isRegistered = true; + } + + return $this; + } + + /** + * Unregisters all handlers registered by this Whoops\Run instance. + * + * @return Run + */ + public function unregister() + { + if ($this->isRegistered) { + $this->system->restoreExceptionHandler(); + $this->system->restoreErrorHandler(); + + $this->isRegistered = false; + } + + return $this; + } + + /** + * Should Whoops allow Handlers to force the script to quit? + * + * @param bool|int $exit + * + * @return bool + */ + public function allowQuit($exit = null) + { + if (func_num_args() == 0) { + return $this->allowQuit; + } + + return $this->allowQuit = (bool) $exit; + } + + /** + * Silence particular errors in particular files. + * + * @param array|string $patterns List or a single regex pattern to match. + * @param int $levels Defaults to E_STRICT | E_DEPRECATED. + * + * @return Run + */ + public function silenceErrorsInPaths($patterns, $levels = 10240) + { + $this->silencedPatterns = array_merge( + $this->silencedPatterns, + array_map( + function ($pattern) use ($levels) { + return [ + "pattern" => $pattern, + "levels" => $levels, + ]; + }, + (array) $patterns + ) + ); + + return $this; + } + + /** + * Returns an array with silent errors in path configuration. + * + * @return array + */ + public function getSilenceErrorsInPaths() + { + return $this->silencedPatterns; + } + + /** + * Should Whoops send HTTP error code to the browser if possible? + * Whoops will by default send HTTP code 500, but you may wish to + * use 502, 503, or another 5xx family code. + * + * @param bool|int $code + * + * @return int|false + * + * @throws InvalidArgumentException + */ + public function sendHttpCode($code = null) + { + if (func_num_args() == 0) { + return $this->sendHttpCode; + } + + if (!$code) { + return $this->sendHttpCode = false; + } + + if ($code === true) { + $code = 500; + } + + if ($code < 400 || 600 <= $code) { + throw new InvalidArgumentException( + "Invalid status code '$code', must be 4xx or 5xx" + ); + } + + return $this->sendHttpCode = $code; + } + + /** + * Should Whoops exit with a specific code on the CLI if possible? + * Whoops will exit with 1 by default, but you can specify something else. + * + * @param int $code + * + * @return int + * + * @throws InvalidArgumentException + */ + public function sendExitCode($code = null) + { + if (func_num_args() == 0) { + return $this->sendExitCode; + } + + if ($code < 0 || 255 <= $code) { + throw new InvalidArgumentException( + "Invalid status code '$code', must be between 0 and 254" + ); + } + + return $this->sendExitCode = (int) $code; + } + + /** + * Should Whoops push output directly to the client? + * If this is false, output will be returned by handleException. + * + * @param bool|int $send + * + * @return bool + */ + public function writeToOutput($send = null) + { + if (func_num_args() == 0) { + return $this->sendOutput; + } + + return $this->sendOutput = (bool) $send; + } + + /** + * Handles an exception, ultimately generating a Whoops error page. + * + * @param Throwable $exception + * + * @return string Output generated by handlers. + */ + public function handleException($exception) + { + // Walk the registered handlers in the reverse order + // they were registered, and pass off the exception + $inspector = $this->getInspector($exception); + + // Capture output produced while handling the exception, + // we might want to send it straight away to the client, + // or return it silently. + $this->system->startOutputBuffering(); + + // Just in case there are no handlers: + $handlerResponse = null; + $handlerContentType = null; + + try { + foreach (array_reverse($this->handlerStack) as $handler) { + $handler->setRun($this); + $handler->setInspector($inspector); + $handler->setException($exception); + + // The HandlerInterface does not require an Exception passed to handle() + // and neither of our bundled handlers use it. + // However, 3rd party handlers may have already relied on this parameter, + // and removing it would be possibly breaking for users. + $handlerResponse = $handler->handle($exception); + + // Collect the content type for possible sending in the headers. + $handlerContentType = method_exists($handler, 'contentType') ? $handler->contentType() : null; + + if (in_array($handlerResponse, [Handler::LAST_HANDLER, Handler::QUIT])) { + // The Handler has handled the exception in some way, and + // wishes to quit execution (Handler::QUIT), or skip any + // other handlers (Handler::LAST_HANDLER). If $this->allowQuit + // is false, Handler::QUIT behaves like Handler::LAST_HANDLER + break; + } + } + + $willQuit = $handlerResponse == Handler::QUIT && $this->allowQuit(); + } finally { + $output = $this->system->cleanOutputBuffer(); + } + + // If we're allowed to, send output generated by handlers directly + // to the output, otherwise, and if the script doesn't quit, return + // it so that it may be used by the caller + if ($this->writeToOutput()) { + // @todo Might be able to clean this up a bit better + if ($willQuit) { + // Cleanup all other output buffers before sending our output: + while ($this->system->getOutputBufferLevel() > 0) { + $this->system->endOutputBuffering(); + } + + // Send any headers if needed: + if (Misc::canSendHeaders() && $handlerContentType) { + header("Content-Type: {$handlerContentType}"); + } + } + + $this->writeToOutputNow($output); + } + + if ($willQuit) { + // HHVM fix for https://github.com/facebook/hhvm/issues/4055 + $this->system->flushOutputBuffer(); + + $this->system->stopExecution( + $this->sendExitCode() + ); + } + + return $output; + } + + /** + * Converts generic PHP errors to \ErrorException instances, before passing them off to be handled. + * + * This method MUST be compatible with set_error_handler. + * + * @param int $level + * @param string $message + * @param string|null $file + * @param int|null $line + * + * @return bool + * + * @throws ErrorException + */ + public function handleError($level, $message, $file = null, $line = null) + { + if ($level & $this->system->getErrorReportingLevel()) { + foreach ($this->silencedPatterns as $entry) { + $pathMatches = (bool) preg_match($entry["pattern"], $file); + $levelMatches = $level & $entry["levels"]; + if ($pathMatches && $levelMatches) { + // Ignore the error, abort handling + // See https://github.com/filp/whoops/issues/418 + return true; + } + } + + // XXX we pass $level for the "code" param only for BC reasons. + // see https://github.com/filp/whoops/issues/267 + $exception = new ErrorException($message, /*code*/ $level, /*severity*/ $level, $file, $line); + if ($this->canThrowExceptions) { + throw $exception; + } else { + $this->handleException($exception); + } + // Do not propagate errors which were already handled by Whoops. + return true; + } + + // Propagate error to the next handler, allows error_get_last() to + // work on silenced errors. + return false; + } + + /** + * Special case to deal with Fatal errors and the like. + * + * @return void + */ + public function handleShutdown() + { + // If we reached this step, we are in shutdown handler. + // An exception thrown in a shutdown handler will not be propagated + // to the exception handler. Pass that information along. + $this->canThrowExceptions = false; + + $error = $this->system->getLastError(); + if ($error && Misc::isLevelFatal($error['type'])) { + // If there was a fatal error, + // it was not handled in handleError yet. + $this->allowQuit = false; + $this->handleError( + $error['type'], + $error['message'], + $error['file'], + $error['line'] + ); + } + } + + + /** + * @param InspectorFactoryInterface $factory + * + * @return void + */ + public function setInspectorFactory(InspectorFactoryInterface $factory) + { + $this->inspectorFactory = $factory; + } + + public function addFrameFilter($filterCallback) + { + if (!is_callable($filterCallback)) { + throw new \InvalidArgumentException(sprintf( + "A frame filter must be of type callable, %s type given.", + gettype($filterCallback) + )); + } + + $this->frameFilters[] = $filterCallback; + return $this; + } + + /** + * @param Throwable $exception + * + * @return InspectorInterface + */ + private function getInspector($exception) + { + return $this->inspectorFactory->create($exception); + } + + /** + * Resolves the giving handler. + * + * @param callable|HandlerInterface $handler + * + * @return HandlerInterface + * + * @throws InvalidArgumentException + */ + private function resolveHandler($handler) + { + if (is_callable($handler)) { + $handler = new CallbackHandler($handler); + } + + if (!$handler instanceof HandlerInterface) { + throw new InvalidArgumentException( + "Handler must be a callable, or instance of " + . "Whoops\\Handler\\HandlerInterface" + ); + } + + return $handler; + } + + /** + * Echo something to the browser. + * + * @param string $output + * + * @return Run + */ + private function writeToOutputNow($output) + { + if ($this->sendHttpCode() && Misc::canSendHeaders()) { + $this->system->setHttpResponseCode( + $this->sendHttpCode() + ); + } + + echo $output; + + return $this; + } +} diff --git a/vendor/filp/whoops/src/Whoops/RunInterface.php b/vendor/filp/whoops/src/Whoops/RunInterface.php new file mode 100644 index 00000000..0ef3e3ff --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/RunInterface.php @@ -0,0 +1,158 @@ + + */ + +namespace Whoops; + +use InvalidArgumentException; +use Whoops\Exception\ErrorException; +use Whoops\Handler\HandlerInterface; + +interface RunInterface +{ + const EXCEPTION_HANDLER = "handleException"; + const ERROR_HANDLER = "handleError"; + const SHUTDOWN_HANDLER = "handleShutdown"; + + /** + * Pushes a handler to the end of the stack + * + * @throws InvalidArgumentException If argument is not callable or instance of HandlerInterface + * @param Callable|HandlerInterface $handler + * @return Run + */ + public function pushHandler($handler); + + /** + * Removes the last handler in the stack and returns it. + * Returns null if there"s nothing else to pop. + * + * @return null|HandlerInterface + */ + public function popHandler(); + + /** + * Returns an array with all handlers, in the + * order they were added to the stack. + * + * @return array + */ + public function getHandlers(); + + /** + * Clears all handlers in the handlerStack, including + * the default PrettyPage handler. + * + * @return Run + */ + public function clearHandlers(); + + /** + * @return array + */ + public function getFrameFilters(); + + /** + * @return Run + */ + public function clearFrameFilters(); + + /** + * Registers this instance as an error handler. + * + * @return Run + */ + public function register(); + + /** + * Unregisters all handlers registered by this Whoops\Run instance + * + * @return Run + */ + public function unregister(); + + /** + * Should Whoops allow Handlers to force the script to quit? + * + * @param bool|int $exit + * @return bool + */ + public function allowQuit($exit = null); + + /** + * Silence particular errors in particular files + * + * @param array|string $patterns List or a single regex pattern to match + * @param int $levels Defaults to E_STRICT | E_DEPRECATED + * @return \Whoops\Run + */ + public function silenceErrorsInPaths($patterns, $levels = 10240); + + /** + * Should Whoops send HTTP error code to the browser if possible? + * Whoops will by default send HTTP code 500, but you may wish to + * use 502, 503, or another 5xx family code. + * + * @param bool|int $code + * @return int|false + */ + public function sendHttpCode($code = null); + + /** + * Should Whoops exit with a specific code on the CLI if possible? + * Whoops will exit with 1 by default, but you can specify something else. + * + * @param int $code + * @return int + */ + public function sendExitCode($code = null); + + /** + * Should Whoops push output directly to the client? + * If this is false, output will be returned by handleException + * + * @param bool|int $send + * @return bool + */ + public function writeToOutput($send = null); + + /** + * Handles an exception, ultimately generating a Whoops error + * page. + * + * @param \Throwable $exception + * @return string Output generated by handlers + */ + public function handleException($exception); + + /** + * Converts generic PHP errors to \ErrorException + * instances, before passing them off to be handled. + * + * This method MUST be compatible with set_error_handler. + * + * @param int $level + * @param string $message + * @param string $file + * @param int $line + * + * @return bool + * @throws ErrorException + */ + public function handleError($level, $message, $file = null, $line = null); + + /** + * Special case to deal with Fatal errors and the like. + */ + public function handleShutdown(); + + /** + * Registers a filter callback in the frame filters stack. + * + * @param callable $filterCallback + * @return \Whoops\Run + */ + public function addFrameFilter($filterCallback); +} diff --git a/vendor/filp/whoops/src/Whoops/Util/HtmlDumperOutput.php b/vendor/filp/whoops/src/Whoops/Util/HtmlDumperOutput.php new file mode 100644 index 00000000..8c828fd9 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Util/HtmlDumperOutput.php @@ -0,0 +1,36 @@ + + */ + +namespace Whoops\Util; + +/** + * Used as output callable for Symfony\Component\VarDumper\Dumper\HtmlDumper::dump() + * + * @see TemplateHelper::dump() + */ +class HtmlDumperOutput +{ + private $output; + + public function __invoke($line, $depth) + { + // A negative depth means "end of dump" + if ($depth >= 0) { + // Adds a two spaces indentation to the line + $this->output .= str_repeat(' ', $depth) . $line . "\n"; + } + } + + public function getOutput() + { + return $this->output; + } + + public function clear() + { + $this->output = null; + } +} diff --git a/vendor/filp/whoops/src/Whoops/Util/Misc.php b/vendor/filp/whoops/src/Whoops/Util/Misc.php new file mode 100644 index 00000000..001a6879 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Util/Misc.php @@ -0,0 +1,77 @@ + + */ + +namespace Whoops\Util; + +class Misc +{ + /** + * Can we at this point in time send HTTP headers? + * + * Currently this checks if we are even serving an HTTP request, + * as opposed to running from a command line. + * + * If we are serving an HTTP request, we check if it's not too late. + * + * @return bool + */ + public static function canSendHeaders() + { + return isset($_SERVER["REQUEST_URI"]) && !headers_sent(); + } + + public static function isAjaxRequest() + { + return ( + !empty($_SERVER['HTTP_X_REQUESTED_WITH']) + && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'); + } + + /** + * Check, if possible, that this execution was triggered by a command line. + * @return bool + */ + public static function isCommandLine() + { + return PHP_SAPI == 'cli'; + } + + /** + * Translate ErrorException code into the represented constant. + * + * @param int $error_code + * @return string + */ + public static function translateErrorCode($error_code) + { + $constants = get_defined_constants(true); + if (array_key_exists('Core', $constants)) { + foreach ($constants['Core'] as $constant => $value) { + if (substr($constant, 0, 2) == 'E_' && $value == $error_code) { + return $constant; + } + } + } + return "E_UNKNOWN"; + } + + /** + * Determine if an error level is fatal (halts execution) + * + * @param int $level + * @return bool + */ + public static function isLevelFatal($level) + { + $errors = E_ERROR; + $errors |= E_PARSE; + $errors |= E_CORE_ERROR; + $errors |= E_CORE_WARNING; + $errors |= E_COMPILE_ERROR; + $errors |= E_COMPILE_WARNING; + return ($level & $errors) > 0; + } +} diff --git a/vendor/filp/whoops/src/Whoops/Util/SystemFacade.php b/vendor/filp/whoops/src/Whoops/Util/SystemFacade.php new file mode 100644 index 00000000..9eb0acfa --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Util/SystemFacade.php @@ -0,0 +1,144 @@ + + */ + +namespace Whoops\Util; + +class SystemFacade +{ + /** + * Turns on output buffering. + * + * @return bool + */ + public function startOutputBuffering() + { + return ob_start(); + } + + /** + * @param callable $handler + * @param int $types + * + * @return callable|null + */ + public function setErrorHandler(callable $handler, $types = 'use-php-defaults') + { + // Since PHP 5.4 the constant E_ALL contains all errors (even E_STRICT) + if ($types === 'use-php-defaults') { + $types = E_ALL; + } + return set_error_handler($handler, $types); + } + + /** + * @param callable $handler + * + * @return callable|null + */ + public function setExceptionHandler(callable $handler) + { + return set_exception_handler($handler); + } + + /** + * @return void + */ + public function restoreExceptionHandler() + { + restore_exception_handler(); + } + + /** + * @return void + */ + public function restoreErrorHandler() + { + restore_error_handler(); + } + + /** + * @param callable $function + * + * @return void + */ + public function registerShutdownFunction(callable $function) + { + register_shutdown_function($function); + } + + /** + * @return string|false + */ + public function cleanOutputBuffer() + { + return ob_get_clean(); + } + + /** + * @return int + */ + public function getOutputBufferLevel() + { + return ob_get_level(); + } + + /** + * @return bool + */ + public function endOutputBuffering() + { + return ob_end_clean(); + } + + /** + * @return void + */ + public function flushOutputBuffer() + { + flush(); + } + + /** + * @return int + */ + public function getErrorReportingLevel() + { + return error_reporting(); + } + + /** + * @return array|null + */ + public function getLastError() + { + return error_get_last(); + } + + /** + * @param int $httpCode + * + * @return int + */ + public function setHttpResponseCode($httpCode) + { + if (!headers_sent()) { + // Ensure that no 'location' header is present as otherwise this + // will override the HTTP code being set here, and mask the + // expected error page. + header_remove('location'); + } + + return http_response_code($httpCode); + } + + /** + * @param int $exitStatus + */ + public function stopExecution($exitStatus) + { + exit($exitStatus); + } +} diff --git a/vendor/filp/whoops/src/Whoops/Util/TemplateHelper.php b/vendor/filp/whoops/src/Whoops/Util/TemplateHelper.php new file mode 100644 index 00000000..8e4df328 --- /dev/null +++ b/vendor/filp/whoops/src/Whoops/Util/TemplateHelper.php @@ -0,0 +1,349 @@ + + */ + +namespace Whoops\Util; + +use Symfony\Component\VarDumper\Caster\Caster; +use Symfony\Component\VarDumper\Cloner\AbstractCloner; +use Symfony\Component\VarDumper\Cloner\VarCloner; +use Symfony\Component\VarDumper\Dumper\HtmlDumper; +use Whoops\Exception\Frame; + +/** + * Exposes useful tools for working with/in templates + */ +class TemplateHelper +{ + /** + * An array of variables to be passed to all templates + * @var array + */ + private $variables = []; + + /** + * @var HtmlDumper + */ + private $htmlDumper; + + /** + * @var HtmlDumperOutput + */ + private $htmlDumperOutput; + + /** + * @var AbstractCloner + */ + private $cloner; + + /** + * @var string + */ + private $applicationRootPath; + + public function __construct() + { + // root path for ordinary composer projects + $this->applicationRootPath = dirname(dirname(dirname(dirname(dirname(dirname(__DIR__)))))); + } + + /** + * Escapes a string for output in an HTML document + * + * @param string $raw + * @return string + */ + public function escape($raw) + { + $flags = ENT_QUOTES; + + // HHVM has all constants defined, but only ENT_IGNORE + // works at the moment + if (defined("ENT_SUBSTITUTE") && !defined("HHVM_VERSION")) { + $flags |= ENT_SUBSTITUTE; + } else { + // This is for 5.3. + // The documentation warns of a potential security issue, + // but it seems it does not apply in our case, because + // we do not blacklist anything anywhere. + $flags |= ENT_IGNORE; + } + + $raw = str_replace(chr(9), ' ', $raw); + + return htmlspecialchars($raw, $flags, "UTF-8"); + } + + /** + * Escapes a string for output in an HTML document, but preserves + * URIs within it, and converts them to clickable anchor elements. + * + * @param string $raw + * @return string + */ + public function escapeButPreserveUris($raw) + { + $escaped = $this->escape($raw); + return preg_replace( + "@([A-z]+?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@", + "$1", + $escaped + ); + } + + /** + * Makes sure that the given string breaks on the delimiter. + * + * @param string $delimiter + * @param string $s + * @return string + */ + public function breakOnDelimiter($delimiter, $s) + { + $parts = explode($delimiter, $s); + foreach ($parts as &$part) { + $part = '' . $part . ''; + } + + return implode($delimiter, $parts); + } + + /** + * Replace the part of the path that all files have in common. + * + * @param string $path + * @return string + */ + public function shorten($path) + { + if ($this->applicationRootPath != "/") { + $path = str_replace($this->applicationRootPath, '…', $path); + } + + return $path; + } + + private function getDumper() + { + if (!$this->htmlDumper && class_exists('Symfony\Component\VarDumper\Cloner\VarCloner')) { + $this->htmlDumperOutput = new HtmlDumperOutput(); + // re-use the same var-dumper instance, so it won't re-render the global styles/scripts on each dump. + $this->htmlDumper = new HtmlDumper($this->htmlDumperOutput); + + $styles = [ + 'default' => 'color:#FFFFFF; line-height:normal; font:12px "Inconsolata", "Fira Mono", "Source Code Pro", Monaco, Consolas, "Lucida Console", monospace !important; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:99999; word-break: normal', + 'num' => 'color:#BCD42A', + 'const' => 'color: #4bb1b1;', + 'str' => 'color:#BCD42A', + 'note' => 'color:#ef7c61', + 'ref' => 'color:#A0A0A0', + 'public' => 'color:#FFFFFF', + 'protected' => 'color:#FFFFFF', + 'private' => 'color:#FFFFFF', + 'meta' => 'color:#FFFFFF', + 'key' => 'color:#BCD42A', + 'index' => 'color:#ef7c61', + ]; + $this->htmlDumper->setStyles($styles); + } + + return $this->htmlDumper; + } + + /** + * Format the given value into a human readable string. + * + * @param mixed $value + * @return string + */ + public function dump($value) + { + $dumper = $this->getDumper(); + + if ($dumper) { + // re-use the same DumpOutput instance, so it won't re-render the global styles/scripts on each dump. + // exclude verbose information (e.g. exception stack traces) + if (class_exists('Symfony\Component\VarDumper\Caster\Caster')) { + $cloneVar = $this->getCloner()->cloneVar($value, Caster::EXCLUDE_VERBOSE); + // Symfony VarDumper 2.6 Caster class dont exist. + } else { + $cloneVar = $this->getCloner()->cloneVar($value); + } + + $dumper->dump( + $cloneVar, + $this->htmlDumperOutput + ); + + $output = $this->htmlDumperOutput->getOutput(); + $this->htmlDumperOutput->clear(); + + return $output; + } + + return htmlspecialchars(print_r($value, true)); + } + + /** + * Format the args of the given Frame as a human readable html string + * + * @param Frame $frame + * @return string the rendered html + */ + public function dumpArgs(Frame $frame) + { + // we support frame args only when the optional dumper is available + if (!$this->getDumper()) { + return ''; + } + + $html = ''; + $numFrames = count($frame->getArgs()); + + if ($numFrames > 0) { + $html = '
      '; + foreach ($frame->getArgs() as $j => $frameArg) { + $html .= '
    1. '. $this->dump($frameArg) .'
    2. '; + } + $html .= '
    '; + } + + return $html; + } + + /** + * Convert a string to a slug version of itself + * + * @param string $original + * @return string + */ + public function slug($original) + { + $slug = str_replace(" ", "-", $original); + $slug = preg_replace('/[^\w\d\-\_]/i', '', $slug); + return strtolower($slug); + } + + /** + * Given a template path, render it within its own scope. This + * method also accepts an array of additional variables to be + * passed to the template. + * + * @param string $template + */ + public function render($template, array $additionalVariables = null) + { + $variables = $this->getVariables(); + + // Pass the helper to the template: + $variables["tpl"] = $this; + + if ($additionalVariables !== null) { + $variables = array_replace($variables, $additionalVariables); + } + + call_user_func(function () { + extract(func_get_arg(1)); + require func_get_arg(0); + }, $template, $variables); + } + + /** + * Sets the variables to be passed to all templates rendered + * by this template helper. + */ + public function setVariables(array $variables) + { + $this->variables = $variables; + } + + /** + * Sets a single template variable, by its name: + * + * @param string $variableName + * @param mixed $variableValue + */ + public function setVariable($variableName, $variableValue) + { + $this->variables[$variableName] = $variableValue; + } + + /** + * Gets a single template variable, by its name, or + * $defaultValue if the variable does not exist + * + * @param string $variableName + * @param mixed $defaultValue + * @return mixed + */ + public function getVariable($variableName, $defaultValue = null) + { + return isset($this->variables[$variableName]) ? + $this->variables[$variableName] : $defaultValue; + } + + /** + * Unsets a single template variable, by its name + * + * @param string $variableName + */ + public function delVariable($variableName) + { + unset($this->variables[$variableName]); + } + + /** + * Returns all variables for this helper + * + * @return array + */ + public function getVariables() + { + return $this->variables; + } + + /** + * Set the cloner used for dumping variables. + * + * @param AbstractCloner $cloner + */ + public function setCloner($cloner) + { + $this->cloner = $cloner; + } + + /** + * Get the cloner used for dumping variables. + * + * @return AbstractCloner + */ + public function getCloner() + { + if (!$this->cloner) { + $this->cloner = new VarCloner(); + } + return $this->cloner; + } + + /** + * Set the application root path. + * + * @param string $applicationRootPath + */ + public function setApplicationRootPath($applicationRootPath) + { + $this->applicationRootPath = $applicationRootPath; + } + + /** + * Return the application root path. + * + * @return string + */ + public function getApplicationRootPath() + { + return $this->applicationRootPath; + } +} diff --git a/vendor/laminas/laminas-servicemanager/COPYRIGHT.md b/vendor/laminas/laminas-servicemanager/COPYRIGHT.md new file mode 100644 index 00000000..0a8cccc0 --- /dev/null +++ b/vendor/laminas/laminas-servicemanager/COPYRIGHT.md @@ -0,0 +1 @@ +Copyright (c) 2020 Laminas Project a Series of LF Projects, LLC. (https://getlaminas.org/) diff --git a/vendor/laminas/laminas-servicemanager/LICENSE.md b/vendor/laminas/laminas-servicemanager/LICENSE.md new file mode 100644 index 00000000..10b40f14 --- /dev/null +++ b/vendor/laminas/laminas-servicemanager/LICENSE.md @@ -0,0 +1,26 @@ +Copyright (c) 2020 Laminas Project a Series of LF Projects, LLC. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +- Neither the name of Laminas Foundation nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/laminas/laminas-servicemanager/README.md b/vendor/laminas/laminas-servicemanager/README.md new file mode 100644 index 00000000..862c83f0 --- /dev/null +++ b/vendor/laminas/laminas-servicemanager/README.md @@ -0,0 +1,40 @@ +# laminas-servicemanager + +[![Build Status](https://github.com/laminas/laminas-servicemanager/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/laminas/laminas-servicemanager/actions/workflows/continuous-integration.yml) +[![Psalm coverage](https://shepherd.dev/github/laminas/laminas-servicemanager/coverage.svg?)](https://shepherd.dev/github/laminas/laminas-servicemanager) + +> ## 🇷🇺 Русским гражданам +> +> Мы, участники Laminas, родились и живем в разных странах. У многих из нас есть друзья, родственники и коллеги как в России, так и в Украине. Некоторые из нас родились в России. Некоторые из нас живут в России. У некоторых бабушки и дедушки сражались с фашистами во Второй мировой войне. Здесь никто не поддерживает фашизм. +> +> У одного из нас есть украинская родственница, которая спаслась из дома вместе с сыном. Поезд задержался из-за бомбежки на дороге впереди. У нас есть друзья, которые прячутся в бомбоубежищах. Мы с тревогой ждем весточки от них после воздушных налетов, которые беспорядочно наносят удары и попадают по больницам, школам, детским садам и домам. Мы не берем это из каких-либо СМИ. Мы наблюдаем это напрямую. +> +> Вы доверяете нам достаточно, чтоб использовать наши программы, и мы просим вас довериться нам вновь. Мы нуждаемся в помощи. Выходите и протестуйте против этой бесполезной войны. Остановите кровопролитие. Скажите "Нет войне!" +> +> ## 🇺🇸 To Citizens of Russia +> +> We at Laminas come from all over the world. Many of us have friends, family and colleagues in both Russia and Ukraine. Some of us were born in Russia. Some of us currently live in Russia. Some have grandparents who fought Nazis in World War II. Nobody here supports fascism. +> +> One team member has a Ukrainian relative who fled her home with her son. The train was delayed due to bombing on the road ahead. We have friends who are hiding in bomb shelters. We anxiously follow up on them after the air raids, which indiscriminately fire at hospitals, schools, kindergartens and houses. We're not taking this from any media. These are our actual experiences. +> +> You trust us enough to use our software. We ask that you trust us to say the truth on this. We need your help. Go out and protest this unnecessary war. Stop the bloodshed. Say "stop the war!" + +The Service Locator design pattern is implemented by the `Laminas\ServiceManager` +component. The Service Locator is a service/object locator, tasked with +retrieving other objects. + +- File issues at https://github.com/laminas/laminas-servicemanager/issues +- [Online documentation](https://docs.laminas.dev/laminas-servicemanager) +- [Documentation source files](docs/book/) + +## Benchmarks + +We provide scripts for benchmarking laminas-servicemanager using the +[PHPBench](https://github.com/phpbench/phpbench) framework; these can be +found in the `benchmarks/` directory. + +To execute the benchmarks you can run the following command: + +```bash +$ vendor/bin/phpbench run --report=aggregate +``` diff --git a/vendor/laminas/laminas-servicemanager/composer.json b/vendor/laminas/laminas-servicemanager/composer.json new file mode 100644 index 00000000..996a777d --- /dev/null +++ b/vendor/laminas/laminas-servicemanager/composer.json @@ -0,0 +1,98 @@ +{ + "name": "laminas/laminas-servicemanager", + "description": "Factory-Driven Dependency Injection Container", + "license": "BSD-3-Clause", + "keywords": [ + "laminas", + "di", + "dic", + "dependency-injection", + "psr-11", + "servicemanager", + "service-manager" + ], + "homepage": "https://laminas.dev", + "support": { + "issues": "https://github.com/laminas/laminas-servicemanager/issues", + "forum": "https://discourse.laminas.dev", + "chat": "https://laminas.dev/chat", + "source": "https://github.com/laminas/laminas-servicemanager", + "docs": "https://docs.laminas.dev/laminas-servicemanager/", + "rss": "https://github.com/laminas/laminas-servicemanager/releases.atom" + }, + "require": { + "php": "~8.1.0 || ~8.2.0 || ~8.3.0", + "laminas/laminas-stdlib": "^3.17", + "psr/container": "^1.0" + }, + "require-dev": { + "composer/package-versions-deprecated": "^1.11.99.5", + "friendsofphp/proxy-manager-lts": "^1.0.14", + "laminas/laminas-code": "^4.10.0", + "laminas/laminas-coding-standard": "~2.5.0", + "laminas/laminas-container-config-test": "^0.8", + "mikey179/vfsstream": "^1.6.11", + "phpbench/phpbench": "^1.2.9", + "phpunit/phpunit": "^10.4", + "psalm/plugin-phpunit": "^0.18.4", + "vimeo/psalm": "^5.8.0" + }, + "replace": { + "container-interop/container-interop": "^1.2.0" + }, + "conflict": { + "ext-psr": "*", + "laminas/laminas-code": "<4.10.0", + "zendframework/zend-code": "<3.3.1", + "zendframework/zend-servicemanager": "*" + }, + "provide": { + "psr/container-implementation": "^1.0" + }, + "suggest": { + "friendsofphp/proxy-manager-lts": "ProxyManager ^2.1.1 to handle lazy initialization of services" + }, + "autoload": { + "psr-4": { + "Laminas\\ServiceManager\\": "src/" + }, + "files": [ + "src/autoload.php" + ] + }, + "autoload-dev": { + "psr-4": { + "LaminasTest\\ServiceManager\\": "test/", + "LaminasBench\\ServiceManager\\": "benchmarks/" + }, + "files": [ + "test/autoload.php" + ] + }, + "bin": [ + "bin/generate-deps-for-config-factory", + "bin/generate-factory-for-class" + ], + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true, + "composer/package-versions-deprecated": true + }, + "platform": { + "php": "8.1.99" + }, + "sort-packages": true + }, + "scripts": { + "benchmark": "phpbench run --revs=2 --iterations=2 --report=aggregate", + "check": [ + "@cs-check", + "@test" + ], + "cs-check": "phpcs", + "cs-fix": "phpcbf", + "static-analysis": "psalm --shepherd --stats", + "test": "phpunit --colors=always", + "test-coverage": "phpunit --colors=always --coverage-clover clover.xml" + } +} diff --git a/vendor/laminas/laminas-servicemanager/src/AbstractFactory/ConfigAbstractFactory.php b/vendor/laminas/laminas-servicemanager/src/AbstractFactory/ConfigAbstractFactory.php new file mode 100644 index 00000000..3b58ad8f --- /dev/null +++ b/vendor/laminas/laminas-servicemanager/src/AbstractFactory/ConfigAbstractFactory.php @@ -0,0 +1,78 @@ +has('config')) { + return false; + } + $config = $container->get('config'); + if (! isset($config[self::class])) { + return false; + } + $dependencies = $config[self::class]; + + return is_array($dependencies) && array_key_exists($requestedName, $dependencies); + } + + /** {@inheritDoc} */ + public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null) + { + if (! $container->has('config')) { + throw new ServiceNotCreatedException('Cannot find a config array in the container'); + } + + $config = $container->get('config'); + + if (! (is_array($config) || $config instanceof ArrayObject)) { + throw new ServiceNotCreatedException('Config must be an array or an instance of ArrayObject'); + } + if (! isset($config[self::class])) { + throw new ServiceNotCreatedException('Cannot find a `' . self::class . '` key in the config array'); + } + + $dependencies = $config[self::class]; + + if ( + ! is_array($dependencies) + || ! array_key_exists($requestedName, $dependencies) + || ! is_array($dependencies[$requestedName]) + ) { + throw new ServiceNotCreatedException('Service dependencies config must exist and be an array'); + } + + $serviceDependencies = $dependencies[$requestedName]; + + if ($serviceDependencies !== array_values(array_map('strval', $serviceDependencies))) { + $problem = json_encode(array_map('gettype', $serviceDependencies)); + throw new ServiceNotCreatedException( + 'Service dependencies config must be an array of strings, ' . $problem . ' given' + ); + } + + $arguments = array_map([$container, 'get'], $serviceDependencies); + + return new $requestedName(...$arguments); + } +} diff --git a/vendor/laminas/laminas-servicemanager/src/AbstractFactory/ReflectionBasedAbstractFactory.php b/vendor/laminas/laminas-servicemanager/src/AbstractFactory/ReflectionBasedAbstractFactory.php new file mode 100644 index 00000000..4f4654bd --- /dev/null +++ b/vendor/laminas/laminas-servicemanager/src/AbstractFactory/ReflectionBasedAbstractFactory.php @@ -0,0 +1,245 @@ + + * 'service_manager' => [ + * 'abstract_factories' => [ + * ReflectionBasedAbstractFactory::class, + * ], + * ], + * + * + * Or as a factory, mapping a class name to it: + * + * + * 'service_manager' => [ + * 'factories' => [ + * MyClassWithDependencies::class => ReflectionBasedAbstractFactory::class, + * ], + * ], + * + * + * The latter approach is more explicit, and also more performant. + * + * The factory has the following constraints/features: + * + * - A parameter named `$config` typehinted as an array will receive the + * application "config" service (i.e., the merged configuration). + * - Parameters type-hinted against array, but not named `$config` will + * be injected with an empty array. + * - Scalar parameters will result in an exception being thrown, unless + * a default value is present; if the default is present, that will be used. + * - If a service cannot be found for a given typehint, the factory will + * raise an exception detailing this. + * - Some services provided by Laminas components do not have + * entries based on their class name (for historical reasons); the + * factory allows defining a map of these class/interface names to the + * corresponding service name to allow them to resolve. + * + * `$options` passed to the factory are ignored in all cases, as we cannot + * make assumptions about which argument(s) they might replace. + * + * Based on the LazyControllerAbstractFactory from laminas-mvc. + */ +class ReflectionBasedAbstractFactory implements AbstractFactoryInterface +{ + /** + * Maps known classes/interfaces to the service that provides them; only + * required for those services with no entry based on the class/interface + * name. + * + * Extend the class if you wish to add to the list. + * + * Example: + * + * + * [ + * \Laminas\Filter\FilterPluginManager::class => 'FilterManager', + * \Laminas\Validator\ValidatorPluginManager::class => 'ValidatorManager', + * ] + * + * + * @var string[] + */ + protected $aliases = []; + + /** + * Allows overriding the internal list of aliases. These should be of the + * form `class name => well-known service name`; see the documentation for + * the `$aliases` property for details on what is accepted. + * + * @param string[] $aliases + */ + public function __construct(array $aliases = []) + { + if (! empty($aliases)) { + $this->aliases = $aliases; + } + } + + /** + * {@inheritDoc} + * + * @return DispatchableInterface + */ + public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null) + { + $reflectionClass = new ReflectionClass($requestedName); + + if (null === ($constructor = $reflectionClass->getConstructor())) { + return new $requestedName(); + } + + $reflectionParameters = $constructor->getParameters(); + + if (empty($reflectionParameters)) { + return new $requestedName(); + } + + $resolver = $container->has('config') + ? $this->resolveParameterWithConfigService($container, $requestedName) + : $this->resolveParameterWithoutConfigService($container, $requestedName); + + $parameters = array_map($resolver, $reflectionParameters); + + return new $requestedName(...$parameters); + } + + /** {@inheritDoc} */ + public function canCreate(ContainerInterface $container, $requestedName) + { + return class_exists($requestedName) && $this->canCallConstructor($requestedName); + } + + private function canCallConstructor(string $requestedName): bool + { + $constructor = (new ReflectionClass($requestedName))->getConstructor(); + + return $constructor === null || $constructor->isPublic(); + } + + /** + * Resolve a parameter to a value. + * + * Returns a callback for resolving a parameter to a value, but without + * allowing mapping array `$config` arguments to the `config` service. + * + * @param string $requestedName + * @return callable + */ + private function resolveParameterWithoutConfigService(ContainerInterface $container, $requestedName) + { + /** + * @param ReflectionParameter $parameter + * @return mixed + * @throws ServiceNotFoundException If type-hinted parameter cannot be + * resolved to a service in the container. + * @psalm-suppress MissingClosureReturnType + */ + return fn(ReflectionParameter $parameter) => $this->resolveParameter($parameter, $container, $requestedName); + } + + /** + * Returns a callback for resolving a parameter to a value, including mapping 'config' arguments. + * + * Unlike resolveParameter(), this version will detect `$config` array + * arguments and have them return the 'config' service. + * + * @param string $requestedName + * @return callable + */ + private function resolveParameterWithConfigService(ContainerInterface $container, $requestedName) + { + /** + * @param ReflectionParameter $parameter + * @return mixed + * @throws ServiceNotFoundException If type-hinted parameter cannot be + * resolved to a service in the container. + */ + return function (ReflectionParameter $parameter) use ($container, $requestedName) { + if ($parameter->getName() === 'config') { + $type = $parameter->getType(); + if ($type instanceof ReflectionNamedType && $type->getName() === 'array') { + return $container->get('config'); + } + } + return $this->resolveParameter($parameter, $container, $requestedName); + }; + } + + /** + * Logic common to all parameter resolution. + * + * @param string $requestedName + * @return mixed + * @throws ServiceNotFoundException If type-hinted parameter cannot be + * resolved to a service in the container. + */ + private function resolveParameter(ReflectionParameter $parameter, ContainerInterface $container, $requestedName) + { + $type = $parameter->getType(); + $type = $type instanceof ReflectionNamedType ? $type->getName() : null; + + if ($type === 'array') { + return []; + } + + if ($type === null || (is_string($type) && ! class_exists($type) && ! interface_exists($type))) { + if (! $parameter->isDefaultValueAvailable()) { + throw new ServiceNotFoundException(sprintf( + 'Unable to create service "%s"; unable to resolve parameter "%s" ' + . 'to a class, interface, or array type', + $requestedName, + $parameter->getName() + )); + } + + return $parameter->getDefaultValue(); + } + + $type = $this->aliases[$type] ?? $type; + + if ($container->has($type)) { + return $container->get($type); + } + + if (! $parameter->isOptional()) { + throw new ServiceNotFoundException(sprintf( + 'Unable to create service "%s"; unable to resolve parameter "%s" using type hint "%s"', + $requestedName, + $parameter->getName(), + $type + )); + } + + // Type not available in container, but the value is optional and has a + // default defined. + return $parameter->getDefaultValue(); + } +} diff --git a/vendor/laminas/laminas-servicemanager/src/AbstractFactoryInterface.php b/vendor/laminas/laminas-servicemanager/src/AbstractFactoryInterface.php new file mode 100644 index 00000000..2a8ff71b --- /dev/null +++ b/vendor/laminas/laminas-servicemanager/src/AbstractFactoryInterface.php @@ -0,0 +1,53 @@ + + * @psalm-import-type ServiceManagerConfiguration from ServiceManager + * @psalm-suppress PropertyNotSetInConstructor + */ +abstract class AbstractPluginManager extends ServiceManager implements PluginManagerInterface +{ + /** + * Whether or not to auto-add a FQCN as an invokable if it exists. + * + * @var bool + */ + protected $autoAddInvokableClass = true; + + /** + * An object type that the created instance must be instanced of + * + * @var null|string + * @psalm-var null|class-string + */ + protected $instanceOf; + + /** + * Sets the provided $parentLocator as the creation context for all + * factories; for $config, {@see \Laminas\ServiceManager\ServiceManager::configure()} + * for details on its accepted structure. + * + * @param null|ConfigInterface|ContainerInterface $configInstanceOrParentLocator + * @param array $config + * @psalm-param ServiceManagerConfiguration $config + */ + public function __construct($configInstanceOrParentLocator = null, array $config = []) + { + /** @psalm-suppress DocblockTypeContradiction */ + if ( + null !== $configInstanceOrParentLocator + && ! $configInstanceOrParentLocator instanceof ConfigInterface + && ! $configInstanceOrParentLocator instanceof ContainerInterface + ) { + throw new Exception\InvalidArgumentException(sprintf( + '%s expects a ConfigInterface or ContainerInterface instance as the first argument; received %s', + self::class, + is_object($configInstanceOrParentLocator) + ? $configInstanceOrParentLocator::class + : gettype($configInstanceOrParentLocator) + )); + } + + if ($configInstanceOrParentLocator instanceof ConfigInterface) { + trigger_error(sprintf( + 'Usage of %s as a constructor argument for %s is now deprecated', + ConfigInterface::class, + static::class + ), E_USER_DEPRECATED); + $config = $configInstanceOrParentLocator->toArray(); + } + + parent::__construct($config); + + if (! $configInstanceOrParentLocator instanceof ContainerInterface) { + trigger_error(sprintf( + '%s now expects a %s instance representing the parent container; please update your code', + __METHOD__, + ContainerInterface::class + ), E_USER_DEPRECATED); + } + + $this->creationContext = $configInstanceOrParentLocator instanceof ContainerInterface + ? $configInstanceOrParentLocator + : $this; + } + + /** + * Override configure() to validate service instances. + * + * @param array $config + * @psalm-param ServiceManagerConfiguration $config + * @return self + * @throws InvalidServiceException If an instance passed in the `services` configuration is invalid for the + * plugin manager. + * @throws ContainerModificationsNotAllowedException If the allow override flag has been toggled off, and a + * service instanceexists for a given service. + */ + public function configure(array $config) + { + if (isset($config['services'])) { + foreach ($config['services'] as $service) { + $this->validate($service); + } + } + + parent::configure($config); + + return $this; + } + + /** + * Override setService for additional plugin validation. + * + * {@inheritDoc} + * + * @param string|class-string $name + * @param InstanceType $service + */ + public function setService($name, $service) + { + $this->validate($service); + parent::setService($name, $service); + } + + /** + * @param class-string|string $name Service name of plugin to retrieve. + * @param null|array $options Options to use when creating the instance. + * @return mixed + * @psalm-return ($name is class-string ? InstanceType : mixed) + * @throws Exception\ServiceNotFoundException If the manager does not have + * a service definition for the instance, and the service is not + * auto-invokable. + * @throws InvalidServiceException If the plugin created is invalid for the + * plugin context. + */ + public function get($name, ?array $options = null) + { + if (! $this->has($name)) { + if (! $this->autoAddInvokableClass || ! class_exists($name)) { + throw new Exception\ServiceNotFoundException(sprintf( + 'A plugin by the name "%s" was not found in the plugin manager %s', + $name, + static::class + )); + } + + $this->setFactory($name, Factory\InvokableFactory::class); + } + + $instance = ! $options ? parent::get($name) : $this->build($name, $options); + $this->validate($instance); + return $instance; + } + + /** + * {@inheritDoc} + * + * @psalm-assert InstanceType $instance + */ + public function validate(mixed $instance) + { + if (method_exists($this, 'validatePlugin')) { + trigger_error(sprintf( + '%s::validatePlugin() has been deprecated as of 3.0; please define validate() instead', + static::class + ), E_USER_DEPRECATED); + $this->validatePlugin($instance); + return; + } + + if (empty($this->instanceOf) || $instance instanceof $this->instanceOf) { + return; + } + + throw new InvalidServiceException(sprintf( + 'Plugin manager "%s" expected an instance of type "%s", but "%s" was received', + self::class, + $this->instanceOf, + is_object($instance) ? $instance::class : gettype($instance) + )); + } + + /** + * Implemented for backwards compatibility only. + * + * Returns the creation context. + * + * @deprecated since 3.0.0. The creation context should be passed during + * instantiation instead. + * + * @return void + */ + public function setServiceLocator(ContainerInterface $container) + { + trigger_error(sprintf( + 'Usage of %s is deprecated since v3.0.0; please pass the container to the constructor instead', + __METHOD__ + ), E_USER_DEPRECATED); + $this->creationContext = $container; + } +} diff --git a/vendor/laminas/laminas-servicemanager/src/Config.php b/vendor/laminas/laminas-servicemanager/src/Config.php new file mode 100644 index 00000000..b7b6042c --- /dev/null +++ b/vendor/laminas/laminas-servicemanager/src/Config.php @@ -0,0 +1,102 @@ + */ + private array $allowedKeys = [ + 'abstract_factories' => true, + 'aliases' => true, + 'delegators' => true, + 'factories' => true, + 'initializers' => true, + 'invokables' => true, + 'lazy_services' => true, + 'services' => true, + 'shared' => true, + ]; + + /** + * @var array + * @psalm-var ServiceManagerConfigurationType + */ + protected $config = [ + 'abstract_factories' => [], + 'aliases' => [], + 'delegators' => [], + 'factories' => [], + 'initializers' => [], + 'invokables' => [], + 'lazy_services' => [], + 'services' => [], + 'shared' => [], + ]; + + /** + * @psalm-param ServiceManagerConfigurationType $config + */ + public function __construct(array $config = []) + { + // Only merge keys we're interested in + foreach (array_keys($config) as $key) { + if (! isset($this->allowedKeys[$key])) { + unset($config[$key]); + } + } + + /** @psalm-suppress ArgumentTypeCoercion */ + $this->config = $this->merge($this->config, $config); + } + + /** + * @inheritDoc + */ + public function configureServiceManager(ServiceManager $serviceManager) + { + return $serviceManager->configure($this->config); + } + + /** + * @inheritDoc + */ + public function toArray() + { + return $this->config; + } + + /** + * @psalm-param ServiceManagerConfigurationType $a + * @psalm-param ServiceManagerConfigurationType $b + * @psalm-return ServiceManagerConfigurationType + */ + private function merge(array $a, array $b) + { + return ArrayUtils::merge($a, $b); + } +} diff --git a/vendor/laminas/laminas-servicemanager/src/ConfigInterface.php b/vendor/laminas/laminas-servicemanager/src/ConfigInterface.php new file mode 100644 index 00000000..15fb7e3e --- /dev/null +++ b/vendor/laminas/laminas-servicemanager/src/ConfigInterface.php @@ -0,0 +1,93 @@ +|Factory\AbstractFactoryInterface) + * > + * @psalm-type DelegatorsConfigurationType = array< + * string, + * array< + * array-key, + * (class-string|Factory\DelegatorFactoryInterface) + * |callable(ContainerInterface,string,callable():object,array|null):object + * > + * > + * @psalm-type FactoriesConfigurationType = array< + * string, + * (class-string|Factory\FactoryInterface) + * |callable(ContainerInterface,?string,?array|null):object + * > + * @psalm-type InitializersConfigurationType = array< + * array-key, + * (class-string|Initializer\InitializerInterface) + * |callable(ContainerInterface,object):void + * > + * @psalm-type LazyServicesConfigurationType = array{ + * class_map?:array, + * proxies_namespace?:non-empty-string, + * proxies_target_dir?:non-empty-string, + * write_proxy_files?:bool + * } + * @psalm-type ServiceManagerConfigurationType = array{ + * abstract_factories?: AbstractFactoriesConfigurationType, + * aliases?: array, + * delegators?: DelegatorsConfigurationType, + * factories?: FactoriesConfigurationType, + * initializers?: InitializersConfigurationType, + * invokables?: array, + * lazy_services?: LazyServicesConfigurationType, + * services?: array, + * shared?:array, + * ... + * } + */ +interface ConfigInterface +{ + /** + * Configure a service manager. + * + * Implementations should pull configuration from somewhere (typically + * local properties) and pass it to a ServiceManager's withConfig() method, + * returning a new instance. + * + * @return ServiceManager + */ + public function configureServiceManager(ServiceManager $serviceManager); + + /** + * Return configuration for a service manager instance as an array. + * + * Implementations MUST return an array compatible with ServiceManager::configure, + * containing one or more of the following keys: + * + * - abstract_factories + * - aliases + * - delegators + * - factories + * - initializers + * - invokables + * - lazy_services + * - services + * - shared + * + * In other words, this should return configuration that can be used to instantiate + * a service manager or plugin manager, or pass to its `withConfig()` method. + * + * @return array + * @psalm-return ServiceManagerConfigurationType + */ + public function toArray(); +} diff --git a/vendor/laminas/laminas-servicemanager/src/DelegatorFactoryInterface.php b/vendor/laminas/laminas-servicemanager/src/DelegatorFactoryInterface.php new file mode 100644 index 00000000..1b30ecf6 --- /dev/null +++ b/vendor/laminas/laminas-servicemanager/src/DelegatorFactoryInterface.php @@ -0,0 +1,41 @@ + ' . $cursor; + } + $cycle .= ' -> ' . $alias . "\n"; + + return new self(sprintf( + "A cycle was detected within the aliases definitions:\n%s", + $cycle + )); + } + + /** + * @param string[] $aliases map of referenced services, indexed by alias name (string) + * @return self + */ + public static function fromAliasesMap(array $aliases) + { + $detectedCycles = array_filter(array_map( + static fn($alias): ?array => self::getCycleFor($aliases, $alias), + array_keys($aliases) + )); + + if (! $detectedCycles) { + return new self(sprintf( + "A cycle was detected within the following aliases map:\n\n%s", + self::printReferencesMap($aliases) + )); + } + + return new self(sprintf( + "Cycles were detected within the provided aliases:\n\n%s\n\n" + . "The cycle was detected in the following alias map:\n\n%s", + self::printCycles(self::deDuplicateDetectedCycles($detectedCycles)), + self::printReferencesMap($aliases) + )); + } + + /** + * Retrieves the cycle detected for the given $alias, or `null` if no cycle was detected + * + * @param string[] $aliases + * @param string $alias + * @return array|null + */ + private static function getCycleFor(array $aliases, $alias) + { + $cycleCandidate = []; + $targetName = $alias; + + while (isset($aliases[$targetName])) { + if (isset($cycleCandidate[$targetName])) { + return $cycleCandidate; + } + + $cycleCandidate[$targetName] = true; + $targetName = $aliases[$targetName]; + } + + return null; + } + + /** + * @param string[] $aliases + * @return string + */ + private static function printReferencesMap(array $aliases) + { + $map = []; + + foreach ($aliases as $alias => $reference) { + $map[] = '"' . $alias . '" => "' . $reference . '"'; + } + + return "[\n" . implode("\n", $map) . "\n]"; + } + + /** + * @param string[][] $detectedCycles + * @return string + */ + private static function printCycles(array $detectedCycles) + { + return "[\n" . implode("\n", array_map([self::class, 'printCycle'], $detectedCycles)) . "\n]"; + } + + /** + * @param string[] $detectedCycle + * @return string + * @phpcsSuppress SlevomatCodingStandard.Classes.UnusedPrivateElements.UnusedMethod + */ + private static function printCycle(array $detectedCycle) + { + $fullCycle = array_keys($detectedCycle); + $fullCycle[] = reset($fullCycle); + + return implode( + ' => ', + array_map( + static fn($cycle): string => '"' . $cycle . '"', + $fullCycle + ) + ); + } + + /** + * @param bool[][] $detectedCycles + * @return bool[][] de-duplicated + */ + private static function deDuplicateDetectedCycles(array $detectedCycles) + { + $detectedCyclesByHash = []; + + foreach ($detectedCycles as $detectedCycle) { + $cycleAliases = array_keys($detectedCycle); + + sort($cycleAliases); + + $hash = serialize($cycleAliases); + + $detectedCyclesByHash[$hash] ??= $detectedCycle; + } + + return array_values($detectedCyclesByHash); + } +} diff --git a/vendor/laminas/laminas-servicemanager/src/Exception/ExceptionInterface.php b/vendor/laminas/laminas-servicemanager/src/Exception/ExceptionInterface.php new file mode 100644 index 00000000..cccc42df --- /dev/null +++ b/vendor/laminas/laminas-servicemanager/src/Exception/ExceptionInterface.php @@ -0,0 +1,14 @@ + $options + * @return object + * @throws ServiceNotFoundException If unable to resolve the service. + * @throws ServiceNotCreatedException If an exception is raised when creating a service. + * @throws ContainerExceptionInterface If any other error occurs. + */ + public function __invoke(ContainerInterface $container, $name, callable $callback, ?array $options = null); +} diff --git a/vendor/laminas/laminas-servicemanager/src/Factory/FactoryInterface.php b/vendor/laminas/laminas-servicemanager/src/Factory/FactoryInterface.php new file mode 100644 index 00000000..68e61671 --- /dev/null +++ b/vendor/laminas/laminas-servicemanager/src/Factory/FactoryInterface.php @@ -0,0 +1,33 @@ + $options + * @return object + * @throws ServiceNotFoundException If unable to resolve the service. + * @throws ServiceNotCreatedException If an exception is raised when creating a service. + * @throws ContainerExceptionInterface If any other error occurs. + */ + public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null); +} diff --git a/vendor/laminas/laminas-servicemanager/src/Factory/InvokableFactory.php b/vendor/laminas/laminas-servicemanager/src/Factory/InvokableFactory.php new file mode 100644 index 00000000..6f80c894 --- /dev/null +++ b/vendor/laminas/laminas-servicemanager/src/Factory/InvokableFactory.php @@ -0,0 +1,27 @@ + $servicesMap A map of service names to + * class names of their respective classes + */ + public function __construct(private LazyLoadingValueHolderFactory $proxyFactory, private array $servicesMap) + { + } + + /** + * {@inheritDoc} + * + * @param string $name + * @return VirtualProxyInterface + */ + public function __invoke(ContainerInterface $container, $name, callable $callback, ?array $options = null) + { + if (isset($this->servicesMap[$name])) { + $initializer = static function (&$wrappedInstance, LazyLoadingInterface $proxy) use ($callback): bool { + $proxy->setProxyInitializer(null); + $wrappedInstance = $callback(); + + return true; + }; + + return $this->proxyFactory->createProxy($this->servicesMap[$name], $initializer); + } + + throw new Exception\ServiceNotFoundException( + sprintf('The requested service "%s" was not found in the provided services map', $name) + ); + } +} diff --git a/vendor/laminas/laminas-servicemanager/src/ServiceLocatorInterface.php b/vendor/laminas/laminas-servicemanager/src/ServiceLocatorInterface.php new file mode 100644 index 00000000..3d4bd447 --- /dev/null +++ b/vendor/laminas/laminas-servicemanager/src/ServiceLocatorInterface.php @@ -0,0 +1,30 @@ + $name + * @param null|array $options + * @return mixed + * @psalm-return ($name is class-string ? T : mixed) + * @throws Exception\ServiceNotFoundException If no factory/abstract + * factory could be found to create the instance. + * @throws Exception\ServiceNotCreatedException If factory/delegator fails + * to create the instance. + * @throws ContainerExceptionInterface If any other error occurs. + */ + public function build($name, ?array $options = null); +} diff --git a/vendor/laminas/laminas-servicemanager/src/ServiceManager.php b/vendor/laminas/laminas-servicemanager/src/ServiceManager.php new file mode 100644 index 00000000..d63e2631 --- /dev/null +++ b/vendor/laminas/laminas-servicemanager/src/ServiceManager.php @@ -0,0 +1,1010 @@ +|Factory\AbstractFactoryInterface) + * > + * @psalm-type DelegatorsConfiguration = array< + * string, + * array< + * array-key, + * (class-string|Factory\DelegatorFactoryInterface) + * |callable(ContainerInterface,string,callable():object,array|null):object + * > + * > + * @psalm-type FactoriesConfiguration = array< + * string, + * (class-string|Factory\FactoryInterface) + * |callable(ContainerInterface,?string,?array|null):object + * > + * @psalm-type InitializersConfiguration = array< + * array-key, + * (class-string|Initializer\InitializerInterface) + * |callable(ContainerInterface,object):void + * > + * @psalm-type LazyServicesConfiguration = array{ + * class_map?:array, + * proxies_namespace?:non-empty-string, + * proxies_target_dir?:non-empty-string, + * write_proxy_files?:bool + * } + * @psalm-type ServiceManagerConfiguration = array{ + * abstract_factories?: AbstractFactoriesConfiguration, + * aliases?: array, + * delegators?: DelegatorsConfiguration, + * factories?: FactoriesConfiguration, + * initializers?: InitializersConfiguration, + * invokables?: array, + * lazy_services?: LazyServicesConfiguration, + * services?: array>, + * shared?:array, + * shared_by_default?:bool, + * ... + * } + */ +class ServiceManager implements ServiceLocatorInterface +{ + /** @var Factory\AbstractFactoryInterface[] */ + protected $abstractFactories = []; + + /** + * A list of aliases + * + * Should map one alias to a service name, or another alias (aliases are recursively resolved) + * + * @var string[] + */ + protected $aliases = []; + + /** + * Whether or not changes may be made to this instance. + * + * @var bool + */ + protected $allowOverride = false; + + /** @var ContainerInterface */ + protected $creationContext; + + /** + * @var string[][]|Factory\DelegatorFactoryInterface[][] + * @psalm-var DelegatorsConfiguration + */ + protected $delegators = []; + + /** + * A list of factories (either as string name or callable) + * + * @var string[]|callable[] + * @psalm-var FactoriesConfiguration + */ + protected $factories = []; + + /** + * @var Initializer\InitializerInterface[]|callable[] + * @psalm-var InitializersConfiguration + */ + protected $initializers = []; + + /** + * @var array + * @psalm-var LazyServicesConfiguration + */ + protected $lazyServices = []; + + private ?LazyServiceFactory $lazyServicesDelegator = null; + + /** + * A list of already loaded services (this act as a local cache) + * + * @var array + */ + protected $services = []; + + /** + * Enable/disable shared instances by service name. + * + * Example configuration: + * + * 'shared' => [ + * MyService::class => true, // will be shared, even if "sharedByDefault" is false + * MyOtherService::class => false // won't be shared, even if "sharedByDefault" is true + * ] + * + * @var array + */ + protected $shared = []; + + /** + * Should the services be shared by default? + * + * @var bool + */ + protected $sharedByDefault = true; + + /** + * Service manager was already configured? + * + * @var bool + */ + protected $configured = false; + + /** + * Cached abstract factories from string. + */ + private array $cachedAbstractFactories = []; + + /** + * See {@see \Laminas\ServiceManager\ServiceManager::configure()} for details + * on what $config accepts. + * + * @psalm-param ServiceManagerConfiguration $config + */ + public function __construct(array $config = []) + { + $this->creationContext = $this; + $this->configure($config); + } + + /** + * Implemented for backwards compatibility with previous plugin managers only. + * + * Returns the creation context. + * + * @deprecated since 3.0.0. Factories using 3.0 should use the container + * instance passed to the factory instead. + * + * @return ContainerInterface + */ + public function getServiceLocator() + { + trigger_error(sprintf( + 'Usage of %s is deprecated since v3.0.0; please use the container passed to the factory instead', + __METHOD__ + ), E_USER_DEPRECATED); + return $this->creationContext; + } + + /** {@inheritDoc} */ + public function get($name) + { + // We start by checking if we have cached the requested service; + // this is the fastest method. + if (isset($this->services[$name])) { + return $this->services[$name]; + } + + // Determine if the service should be shared. + $sharedService = $this->shared[$name] ?? $this->sharedByDefault; + + // We achieve better performance if we can let all alias + // considerations out. + if (! $this->aliases) { + $object = $this->doCreate($name); + + // Cache the object for later, if it is supposed to be shared. + if ($sharedService) { + $this->services[$name] = $object; + } + return $object; + } + + // We now deal with requests which may be aliases. + $resolvedName = $this->aliases[$name] ?? $name; + + // Update shared service information as we checked if the alias was shared before. + if ($resolvedName !== $name) { + $sharedService = $this->shared[$resolvedName] ?? $sharedService; + } + + // The following is only true if the requested service is a shared alias. + $sharedAlias = $sharedService && isset($this->services[$resolvedName]); + + // If the alias is configured as a shared service, we are done. + if ($sharedAlias) { + $this->services[$name] = $this->services[$resolvedName]; + return $this->services[$resolvedName]; + } + + // At this point, we have to create the object. + // We use the resolved name for that. + $object = $this->doCreate($resolvedName); + + // Cache the object for later, if it is supposed to be shared. + if ($sharedService) { + $this->services[$resolvedName] = $object; + } + + // Also cache under the alias name; this allows sharing based on the + // service name used. + if ($sharedAlias) { + $this->services[$name] = $object; + } + + return $object; + } + + /** {@inheritDoc} */ + public function build($name, ?array $options = null) + { + // We never cache when using "build". + $name = $this->aliases[$name] ?? $name; + return $this->doCreate($name, $options); + } + + /** + * {@inheritDoc} + * + * @param string|class-string $name + * @return bool + */ + public function has($name) + { + // Check static services and factories first to speedup the most common requests. + return $this->staticServiceOrFactoryCanCreate($name) || $this->abstractFactoryCanCreate($name); + } + + /** + * Indicate whether or not the instance is immutable. + * + * @param bool $flag + */ + public function setAllowOverride($flag) + { + $this->allowOverride = (bool) $flag; + } + + /** + * Retrieve the flag indicating immutability status. + * + * @return bool + */ + public function getAllowOverride() + { + return $this->allowOverride; + } + + /** + * @psalm-param ServiceManagerConfiguration $config + * @return self + * @throws ContainerModificationsNotAllowedException If the allow + * override flag has been toggled off, and a service instance + * exists for a given service. + */ + public function configure(array $config) + { + // This is a bulk update/initial configuration, + // so we check all definitions up front. + $this->validateServiceNames($config); + + if (isset($config['services'])) { + $this->services = $config['services'] + $this->services; + } + + if (isset($config['invokables']) && ! empty($config['invokables'])) { + $newAliases = $this->createAliasesAndFactoriesForInvokables($config['invokables']); + // override existing aliases with those created by invokables to ensure + // that they are still present after merging aliases later on + $config['aliases'] = $newAliases + ($config['aliases'] ?? []); + } + + if (isset($config['factories'])) { + $this->factories = $config['factories'] + $this->factories; + } + + if (isset($config['delegators'])) { + $this->mergeDelegators($config['delegators']); + } + + if (isset($config['shared'])) { + $this->shared = $config['shared'] + $this->shared; + } + + if (! empty($config['aliases'])) { + $this->aliases = $config['aliases'] + $this->aliases; + $this->mapAliasesToTargets(); + } elseif (! $this->configured && ! empty($this->aliases)) { + $this->mapAliasesToTargets(); + } + + if (isset($config['shared_by_default'])) { + $this->sharedByDefault = $config['shared_by_default']; + } + + // If lazy service configuration was provided, reset the lazy services + // delegator factory. + if (isset($config['lazy_services']) && ! empty($config['lazy_services'])) { + /** @psalm-suppress MixedPropertyTypeCoercion */ + $this->lazyServices = ArrayUtils::merge($this->lazyServices, $config['lazy_services']); + $this->lazyServicesDelegator = null; + } + + // For abstract factories and initializers, we always directly + // instantiate them to avoid checks during service construction. + if (isset($config['abstract_factories'])) { + $abstractFactories = $config['abstract_factories']; + // $key not needed, but foreach is faster than foreach + array_values. + foreach ($abstractFactories as $key => $abstractFactory) { + $this->resolveAbstractFactoryInstance($abstractFactory); + } + } + + if (isset($config['initializers'])) { + $this->resolveInitializers($config['initializers']); + } + + $this->configured = true; + + return $this; + } + + /** + * Add an alias. + * + * @param string $alias + * @param string $target + * @throws ContainerModificationsNotAllowedException If $alias already + * exists as a service and overrides are disallowed. + */ + public function setAlias($alias, $target) + { + if (isset($this->services[$alias]) && ! $this->allowOverride) { + throw ContainerModificationsNotAllowedException::fromExistingService($alias); + } + + $this->mapAliasToTarget($alias, $target); + } + + /** + * Add an invokable class mapping. + * + * @param string $name Service name + * @param null|string $class Class to which to map; if omitted, $name is + * assumed. + * @throws ContainerModificationsNotAllowedException If $name already + * exists as a service and overrides are disallowed. + */ + public function setInvokableClass($name, $class = null) + { + if (isset($this->services[$name]) && ! $this->allowOverride) { + throw ContainerModificationsNotAllowedException::fromExistingService($name); + } + + $this->createAliasesAndFactoriesForInvokables([$name => $class ?? $name]); + } + + /** + * Specify a factory for a given service name. + * + * @param string $name Service name + * @param string|callable|Factory\FactoryInterface $factory Factory to which to map. + * phpcs:disable Generic.Files.LineLength.TooLong + * @psalm-param class-string|callable(ContainerInterface,string,array|null):object|Factory\FactoryInterface $factory + * phpcs:enable Generic.Files.LineLength.TooLong + * @return void + * @throws ContainerModificationsNotAllowedException If $name already + * exists as a service and overrides are disallowed. + */ + public function setFactory($name, $factory) + { + if (isset($this->services[$name]) && ! $this->allowOverride) { + throw ContainerModificationsNotAllowedException::fromExistingService($name); + } + + $this->factories[$name] = $factory; + } + + /** + * Create a lazy service mapping to a class. + * + * @param string $name Service name to map + * @param null|string $class Class to which to map; if not provided, $name + * will be used for the mapping. + */ + public function mapLazyService($name, $class = null) + { + $this->configure(['lazy_services' => ['class_map' => [$name => $class ?: $name]]]); + } + + /** + * Add an abstract factory for resolving services. + * + * @param string|Factory\AbstractFactoryInterface $factory Abstract factory + * instance or class name. + * @psalm-param class-string|Factory\AbstractFactoryInterface $factory + */ + public function addAbstractFactory($factory) + { + $this->resolveAbstractFactoryInstance($factory); + } + + /** + * Add a delegator for a given service. + * + * @param string $name Service name + * @param string|callable|Factory\DelegatorFactoryInterface $factory Delegator + * factory to assign. + * @psalm-param class-string + * |callable(ContainerInterface,string,callable,array|null) $factory + */ + public function addDelegator($name, $factory) + { + $this->configure(['delegators' => [$name => [$factory]]]); + } + + /** + * Add an initializer. + * + * @param string|callable|Initializer\InitializerInterface $initializer + * @psalm-param class-string + * |callable(ContainerInterface,mixed):void + * |Initializer\InitializerInterface $initializer + */ + public function addInitializer($initializer) + { + $this->configure(['initializers' => [$initializer]]); + } + + /** + * Map a service. + * + * @param string $name Service name + * @param array|object $service + * @throws ContainerModificationsNotAllowedException If $name already + * exists as a service and overrides are disallowed. + */ + public function setService($name, $service) + { + if (isset($this->services[$name]) && ! $this->allowOverride) { + throw ContainerModificationsNotAllowedException::fromExistingService($name); + } + $this->services[$name] = $service; + } + + /** + * Add a service sharing rule. + * + * @param string $name Service name + * @param bool $flag Whether or not the service should be shared. + * @throws ContainerModificationsNotAllowedException If $name already + * exists as a service and overrides are disallowed. + */ + public function setShared($name, $flag) + { + if (isset($this->services[$name]) && ! $this->allowOverride) { + throw ContainerModificationsNotAllowedException::fromExistingService($name); + } + + $this->shared[$name] = (bool) $flag; + } + + /** + * Instantiate initializers for to avoid checks during service construction. + * + * @psalm-param InitializersConfiguration $initializers + */ + private function resolveInitializers(array $initializers): void + { + foreach ($initializers as $initializer) { + if (is_string($initializer) && class_exists($initializer)) { + $initializer = new $initializer(); + } + + if (is_callable($initializer)) { + $this->initializers[] = $initializer; + continue; + } + + throw InvalidArgumentException::fromInvalidInitializer($initializer); + } + } + + /** + * Get a factory for the given service name + * + * @psalm-return (callable(ContainerInterface,string,array|null):object)|Factory\FactoryInterface + * @throws ServiceNotFoundException + */ + private function getFactory(string $name): callable + { + $factory = $this->factories[$name] ?? null; + + $lazyLoaded = false; + if (is_string($factory) && class_exists($factory)) { + $factory = new $factory(); + $lazyLoaded = true; + } + + if (is_callable($factory)) { + if ($lazyLoaded) { + $this->factories[$name] = $factory; + } + + return $factory; + } + + // Check abstract factories + foreach ($this->abstractFactories as $abstractFactory) { + if ($abstractFactory->canCreate($this->creationContext, $name)) { + return $abstractFactory; + } + } + + throw new ServiceNotFoundException(sprintf( + 'Unable to resolve service "%s" to a factory; are you certain you provided it during configuration?', + $name + )); + } + + /** + * @return object + */ + private function createDelegatorFromName(string $name, ?array $options = null) + { + $creationCallback = function () use ($name, $options) { + // Code is inlined for performance reason, instead of abstracting the creation + $factory = $this->getFactory($name); + return $factory($this->creationContext, $name, $options); + }; + + $initialCreationContext = $this->creationContext; + + foreach ($this->delegators[$name] as $index => $delegatorFactory) { + $delegatorFactory = $this->delegators[$name][$index]; + + if ($delegatorFactory === LazyServiceFactory::class) { + $delegatorFactory = $this->createLazyServiceDelegatorFactory(); + } elseif (is_string($delegatorFactory) && class_exists($delegatorFactory)) { + $delegatorFactory = new $delegatorFactory(); + } + + $this->assertCallableDelegatorFactory($delegatorFactory); + + $this->delegators[$name][$index] = $delegatorFactory; + + $creationCallback = + /** @return object */ + static fn() => $delegatorFactory($initialCreationContext, $name, $creationCallback, $options); + } + + return $creationCallback(); + } + + /** + * Create a new instance with an already resolved name + * + * This is a highly performance sensitive method, do not modify if you have not benchmarked it carefully + * + * @return object + * @throws ServiceNotFoundException If unable to resolve the service. + * @throws ServiceNotCreatedException If an exception is raised when creating a service. + * @throws ContainerExceptionInterface If any other error occurs. + */ + private function doCreate(string $resolvedName, ?array $options = null) + { + try { + if (! isset($this->delegators[$resolvedName])) { + // Let's create the service by fetching the factory + $factory = $this->getFactory($resolvedName); + $object = $factory($this->creationContext, $resolvedName, $options); + } else { + $object = $this->createDelegatorFromName($resolvedName, $options); + } + } catch (ContainerExceptionInterface $exception) { + throw $exception; + } catch (Exception $exception) { + throw new ServiceNotCreatedException(sprintf( + 'Service with name "%s" could not be created. Reason: %s', + $resolvedName, + $exception->getMessage() + ), (int) $exception->getCode(), $exception); + } + + foreach ($this->initializers as $initializer) { + $initializer($this->creationContext, $object); + } + + return $object; + } + + /** + * Create the lazy services delegator factory. + * + * Creates the lazy services delegator factory based on the lazy_services + * configuration present. + * + * @throws ServiceNotCreatedException When the lazy service class_map configuration is missing. + */ + private function createLazyServiceDelegatorFactory(): LazyServiceFactory + { + if ($this->lazyServicesDelegator) { + return $this->lazyServicesDelegator; + } + + if (! isset($this->lazyServices['class_map'])) { + throw new ServiceNotCreatedException('Missing "class_map" config key in "lazy_services"'); + } + + $factoryConfig = new ProxyConfiguration(); + + if (isset($this->lazyServices['proxies_namespace'])) { + $factoryConfig->setProxiesNamespace($this->lazyServices['proxies_namespace']); + } + + if (isset($this->lazyServices['proxies_target_dir'])) { + $factoryConfig->setProxiesTargetDir($this->lazyServices['proxies_target_dir']); + } + + if (! isset($this->lazyServices['write_proxy_files']) || ! $this->lazyServices['write_proxy_files']) { + $factoryConfig->setGeneratorStrategy(new EvaluatingGeneratorStrategy()); + } else { + $factoryConfig->setGeneratorStrategy(new FileWriterGeneratorStrategy( + new FileLocator($factoryConfig->getProxiesTargetDir()) + )); + } + + spl_autoload_register($factoryConfig->getProxyAutoloader()); + + $this->lazyServicesDelegator = new LazyServiceFactory( + new LazyLoadingValueHolderFactory($factoryConfig), + $this->lazyServices['class_map'] + ); + + return $this->lazyServicesDelegator; + } + + /** + * Merge delegators avoiding multiple same delegators for the same service. + * It works with strings and class instances. + * It's not possible to de-duple anonymous functions + * + * @psalm-param DelegatorsConfiguration $config + * @psalm-return DelegatorsConfiguration + */ + private function mergeDelegators(array $config): array + { + foreach ($config as $key => $delegators) { + if (! array_key_exists($key, $this->delegators)) { + $this->delegators[$key] = $delegators; + continue; + } + + foreach ($delegators as $delegator) { + if (! in_array($delegator, $this->delegators[$key], true)) { + $this->delegators[$key][] = $delegator; + } + } + } + + return $this->delegators; + } + + /** + * Create aliases and factories for invokable classes. + * + * If an invokable service name does not match the class it maps to, this + * creates an alias to the class (which will later be mapped as an + * invokable factory). The newly created aliases will be returned as an array. + * + * @param array $invokables + * @return array + */ + private function createAliasesAndFactoriesForInvokables(array $invokables): array + { + $newAliases = []; + + foreach ($invokables as $name => $class) { + $this->factories[$class] = Factory\InvokableFactory::class; + if ($name !== $class) { + $this->aliases[$name] = $class; + $newAliases[$name] = $class; + } + } + + return $newAliases; + } + + /** + * Determine if a service for any name provided by a service + * manager configuration(services, aliases, factories, ...) + * already exists, and if it exists, determine if is it allowed + * to get overriden. + * + * Validation in the context of this class means, that for + * a given service name we do not have a service instance + * in the cache OR override is explicitly allowed. + * + * @psalm-param ServiceManagerConfiguration $config + * @throws ContainerModificationsNotAllowedException If any + * service key is invalid. + */ + private function validateServiceNames(array $config): void + { + if ($this->allowOverride || ! $this->configured) { + return; + } + + if (isset($config['services'])) { + foreach (array_keys($config['services']) as $service) { + if (isset($this->services[$service])) { + throw ContainerModificationsNotAllowedException::fromExistingService($service); + } + } + } + + if (isset($config['aliases'])) { + foreach (array_keys($config['aliases']) as $service) { + if (isset($this->services[$service])) { + throw ContainerModificationsNotAllowedException::fromExistingService($service); + } + } + } + + if (isset($config['invokables'])) { + foreach (array_keys($config['invokables']) as $service) { + if (isset($this->services[$service])) { + throw ContainerModificationsNotAllowedException::fromExistingService($service); + } + } + } + + if (isset($config['factories'])) { + foreach (array_keys($config['factories']) as $service) { + if (isset($this->services[$service])) { + throw ContainerModificationsNotAllowedException::fromExistingService($service); + } + } + } + + if (isset($config['delegators'])) { + foreach (array_keys($config['delegators']) as $service) { + if (isset($this->services[$service])) { + throw ContainerModificationsNotAllowedException::fromExistingService($service); + } + } + } + + if (isset($config['shared'])) { + foreach (array_keys($config['shared']) as $service) { + if (isset($this->services[$service])) { + throw ContainerModificationsNotAllowedException::fromExistingService($service); + } + } + } + + if (isset($config['lazy_services']['class_map'])) { + foreach (array_keys($config['lazy_services']['class_map']) as $service) { + if (isset($this->services[$service])) { + throw ContainerModificationsNotAllowedException::fromExistingService($service); + } + } + } + } + + /** + * Assuming that the alias name is valid (see above) resolve/add it. + * + * This is done differently from bulk mapping aliases for performance reasons, as the + * algorithms for mapping a single item efficiently are different from those of mapping + * many. + */ + private function mapAliasToTarget(string $alias, string $target): void + { + // $target is either an alias or something else + // if it is an alias, resolve it + $this->aliases[$alias] = $this->aliases[$target] ?? $target; + + // a self-referencing alias indicates a cycle + if ($alias === $this->aliases[$alias]) { + throw CyclicAliasException::fromCyclicAlias($alias, $this->aliases); + } + + // finally we have to check if existing incomplete alias definitions + // exist which can get resolved by the new alias + if (in_array($alias, $this->aliases)) { + $r = array_intersect($this->aliases, [$alias]); + // found some, resolve them + foreach ($r as $name => $service) { + $this->aliases[$name] = $target; + } + } + } + + /** + * Assuming that all provided alias keys are valid resolve them. + * + * This function maps $this->aliases in place. + * + * This algorithm is an adaptated version of Tarjans Strongly + * Connected Components. Instead of returning the strongly + * connected components (i.e. cycles in our case), we throw. + * If nodes are not strongly connected (i.e. resolvable in + * our case), they get resolved. + * + * This algorithm is fast for mass updates through configure(). + * It is not appropriate if just a single alias is added. + * + * @see mapAliasToTarget above + */ + private function mapAliasesToTargets(): void + { + $tagged = []; + foreach ($this->aliases as $alias => $target) { + if (isset($tagged[$alias])) { + continue; + } + + $tCursor = $this->aliases[$alias]; + $aCursor = $alias; + if ($aCursor === $tCursor) { + throw CyclicAliasException::fromCyclicAlias($alias, $this->aliases); + } + if (! isset($this->aliases[$tCursor])) { + continue; + } + + $stack = []; + + while (isset($this->aliases[$tCursor])) { + $stack[] = $aCursor; + if ($aCursor === $this->aliases[$tCursor]) { + throw CyclicAliasException::fromCyclicAlias($alias, $this->aliases); + } + $aCursor = $tCursor; + $tCursor = $this->aliases[$tCursor]; + } + + $tagged[$aCursor] = true; + + foreach ($stack as $alias) { + if ($alias === $tCursor) { + throw CyclicAliasException::fromCyclicAlias($alias, $this->aliases); + } + $this->aliases[$alias] = $tCursor; + $tagged[$alias] = true; + } + } + } + + /** + * Instantiate abstract factories in order to avoid checks during service construction. + * + * @param string|Factory\AbstractFactoryInterface $abstractFactory + * @psalm-param class-string|Factory\AbstractFactoryInterface $abstractFactory + */ + private function resolveAbstractFactoryInstance($abstractFactory): void + { + if (is_string($abstractFactory) && class_exists($abstractFactory)) { + // Cached string factory name + if (! isset($this->cachedAbstractFactories[$abstractFactory])) { + $this->cachedAbstractFactories[$abstractFactory] = new $abstractFactory(); + } + + $abstractFactory = $this->cachedAbstractFactories[$abstractFactory]; + } + + if (! $abstractFactory instanceof Factory\AbstractFactoryInterface) { + throw InvalidArgumentException::fromInvalidAbstractFactory($abstractFactory); + } + + $abstractFactoryObjHash = spl_object_hash($abstractFactory); + $this->abstractFactories[$abstractFactoryObjHash] = $abstractFactory; + } + + /** + * Check if a static service or factory exists for the given name. + */ + private function staticServiceOrFactoryCanCreate(string $name): bool + { + if (isset($this->services[$name]) || isset($this->factories[$name])) { + return true; + } + + $resolvedName = $this->aliases[$name] ?? $name; + if ($resolvedName !== $name) { + return $this->staticServiceOrFactoryCanCreate($resolvedName); + } + + return false; + } + + /** + * Check if an abstract factory exists that can create a service for the given name. + */ + private function abstractFactoryCanCreate(string $name): bool + { + foreach ($this->abstractFactories as $abstractFactory) { + if ($abstractFactory->canCreate($this->creationContext, $name)) { + return true; + } + } + + $resolvedName = $this->aliases[$name] ?? $name; + if ($resolvedName !== $name) { + return $this->abstractFactoryCanCreate($resolvedName); + } + + return false; + } + + /** + * @psalm-param mixed $delegatorFactory + * @psalm-assert callable(ContainerInterface,string,callable():object,array|null):object $delegatorFactory + */ + private function assertCallableDelegatorFactory($delegatorFactory): void + { + if ( + $delegatorFactory instanceof Factory\DelegatorFactoryInterface + || is_callable($delegatorFactory) + ) { + return; + } + if (is_string($delegatorFactory)) { + throw new ServiceNotCreatedException(sprintf( + 'An invalid delegator factory was registered; resolved to class or function "%s"' + . ' which does not exist; please provide a valid function name or class name resolving' + . ' to an implementation of %s', + $delegatorFactory, + DelegatorFactoryInterface::class + )); + } + throw new ServiceNotCreatedException(sprintf( + 'A non-callable delegator, "%s", was provided; expected a callable or instance of "%s"', + is_object($delegatorFactory) ? $delegatorFactory::class : gettype($delegatorFactory), + DelegatorFactoryInterface::class + )); + } +} diff --git a/vendor/laminas/laminas-servicemanager/src/Test/CommonPluginManagerTrait.php b/vendor/laminas/laminas-servicemanager/src/Test/CommonPluginManagerTrait.php new file mode 100644 index 00000000..7534de4a --- /dev/null +++ b/vendor/laminas/laminas-servicemanager/src/Test/CommonPluginManagerTrait.php @@ -0,0 +1,120 @@ +getPluginManager(); + $reflection = new ReflectionProperty($manager, 'instanceOf'); + $this->assertEquals($this->getInstanceOf(), $reflection->getValue($manager), 'instanceOf does not match'); + } + + public function testShareByDefaultAndSharedByDefault() + { + $manager = $this->getPluginManager(); + $reflection = new ReflectionClass($manager); + $shareByDefault = $sharedByDefault = true; + + foreach ($reflection->getProperties() as $prop) { + if ($prop->getName() === 'shareByDefault') { + $shareByDefault = $prop->getValue($manager); + } + if ($prop->getName() === 'sharedByDefault') { + $sharedByDefault = $prop->getValue($manager); + } + } + + $this->assertSame( + $shareByDefault, + $sharedByDefault, + 'Values of shareByDefault and sharedByDefault do not match' + ); + } + + public function testRegisteringInvalidElementRaisesException() + { + $this->expectException($this->getServiceNotFoundException()); + $this->getPluginManager()->setService('test', $this); + } + + public function testLoadingInvalidElementRaisesException() + { + $manager = $this->getPluginManager(); + $manager->setInvokableClass('test', stdClass::class); + $this->expectException($this->getServiceNotFoundException()); + $manager->get('test'); + } + + /** + * @dataProvider aliasProvider + * @param string $alias + * @param string $expected + */ + public function testPluginAliasesResolve($alias, $expected) + { + $this->assertInstanceOf($expected, $this->getPluginManager()->get($alias), "Alias '$alias' does not resolve'"); + } + + /** + * @return array + */ + public static function aliasProvider(): array + { + $manager = self::getPluginManager(); + $reflection = new ReflectionProperty($manager, 'aliases'); + $data = []; + foreach ($reflection->getValue($manager) as $alias => $expected) { + $data[] = [$alias, $expected]; + } + return $data; + } + + protected function getServiceNotFoundException(): string + { + $manager = $this->getPluginManager(); + if (method_exists($manager, 'configure')) { + return InvalidServiceException::class; + } + return $this->getV2InvalidPluginException(); + } + + /** + * Returns the plugin manager to test + * + * @return AbstractPluginManager + */ + abstract protected static function getPluginManager(); + + /** + * Returns the FQCN of the exception thrown under v2 by `validatePlugin()` + * + * @return mixed + */ + abstract protected function getV2InvalidPluginException(); + + /** + * Returns the value the instanceOf property has been set to + * + * @return string + */ + abstract protected function getInstanceOf(); +} diff --git a/vendor/laminas/laminas-servicemanager/src/Tool/ConfigDumper.php b/vendor/laminas/laminas-servicemanager/src/Tool/ConfigDumper.php new file mode 100644 index 00000000..6dd6b7f6 --- /dev/null +++ b/vendor/laminas/laminas-servicemanager/src/Tool/ConfigDumper.php @@ -0,0 +1,255 @@ +validateClassName($className); + + $reflectionClass = new ReflectionClass($className); + + // class is an interface; do nothing + if ($reflectionClass->isInterface()) { + return $config; + } + + // class has no constructor, treat it as an invokable + if (! $reflectionClass->getConstructor()) { + return $this->createInvokable($config, $className); + } + + $constructorArguments = $reflectionClass->getConstructor()->getParameters(); + $constructorArguments = array_filter( + $constructorArguments, + static fn(ReflectionParameter $argument): bool => ! $argument->isOptional() + ); + + // has no required parameters, treat it as an invokable + if (empty($constructorArguments)) { + return $this->createInvokable($config, $className); + } + + $classConfig = []; + + foreach ($constructorArguments as $constructorArgument) { + $type = $constructorArgument->getType(); + $argumentType = $type instanceof ReflectionNamedType && ! $type->isBuiltin() ? $type->getName() : null; + + if ($argumentType === null) { + if ($ignoreUnresolved) { + // don't throw an exception, just return the previous config + return $config; + } + // don't throw an exception if the class is an already defined service + if ($this->container && $this->container->has($className)) { + return $config; + } + throw new InvalidArgumentException(sprintf( + 'Cannot create config for constructor argument "%s", ' + . 'it has no type hint, or non-class/interface type hint', + $constructorArgument->getName() + )); + } + $config = $this->createDependencyConfig($config, $argumentType, $ignoreUnresolved); + $classConfig[] = $argumentType; + } + + $config[ConfigAbstractFactory::class][$className] = $classConfig; + + return $config; + } + + /** + * @param string $className + * @throws InvalidArgumentException If class name is not a string or does + * not exist. + */ + private function validateClassName($className) + { + if (! is_string($className)) { + throw new InvalidArgumentException('Class name must be a string, ' . gettype($className) . ' given'); + } + + if (! class_exists($className) && ! interface_exists($className)) { + throw new InvalidArgumentException('Cannot find class or interface with name ' . $className); + } + } + + /** + * @param string $className + * @return array + */ + private function createInvokable(array $config, $className) + { + $config[ConfigAbstractFactory::class][$className] = []; + return $config; + } + + /** + * @return array + * @throws InvalidArgumentException If ConfigAbstractFactory configuration + * value is not an array. + */ + public function createFactoryMappingsFromConfig(array $config) + { + if (! array_key_exists(ConfigAbstractFactory::class, $config)) { + return $config; + } + + if (! is_array($config[ConfigAbstractFactory::class])) { + throw new InvalidArgumentException( + 'Config key for ' . ConfigAbstractFactory::class . ' should be an array, ' . gettype( + $config[ConfigAbstractFactory::class] + ) . ' given' + ); + } + + foreach ($config[ConfigAbstractFactory::class] as $className => $dependency) { + $config = $this->createFactoryMappings($config, $className); + } + return $config; + } + + /** + * @param string $className + * @return array + */ + public function createFactoryMappings(array $config, $className) + { + $this->validateClassName($className); + + if ( + array_key_exists('service_manager', $config) + && array_key_exists('factories', $config['service_manager']) + && array_key_exists($className, $config['service_manager']['factories']) + ) { + return $config; + } + + $config['service_manager']['factories'][$className] = ConfigAbstractFactory::class; + return $config; + } + + /** + * @return string + */ + public function dumpConfigFile(array $config) + { + $prepared = $this->prepareConfig($config); + return sprintf( + self::CONFIG_TEMPLATE, + static::class, + date('Y-m-d H:i:s'), + $prepared + ); + } + + /** + * @param array|Traversable $config + * @param int $indentLevel + * @return string + */ + private function prepareConfig($config, $indentLevel = 1) + { + $indent = str_repeat(' ', $indentLevel * 4); + $entries = []; + foreach ($config as $key => $value) { + $key = $this->createConfigKey($key); + $entries[] = sprintf( + '%s%s%s,', + $indent, + $key ? sprintf('%s => ', $key) : '', + $this->createConfigValue($value, $indentLevel) + ); + } + + $outerIndent = str_repeat(' ', ($indentLevel - 1) * 4); + + return sprintf( + "[\n%s\n%s]", + implode("\n", $entries), + $outerIndent + ); + } + + /** + * @param string|int|null $key + * @return null|string + */ + private function createConfigKey($key) + { + if (is_string($key) && class_exists($key)) { + return sprintf('\\%s::class', $key); + } + + if (is_int($key)) { + return null; + } + + return sprintf("'%s'", $key); + } + + /** + * @param int $indentLevel + * @return string + */ + private function createConfigValue(mixed $value, $indentLevel) + { + if (is_array($value) || $value instanceof Traversable) { + return $this->prepareConfig($value, $indentLevel + 1); + } + + if (is_string($value) && class_exists($value)) { + return sprintf('\\%s::class', $value); + } + + return var_export($value, true); + } +} diff --git a/vendor/laminas/laminas-servicemanager/src/Tool/ConfigDumperCommand.php b/vendor/laminas/laminas-servicemanager/src/Tool/ConfigDumperCommand.php new file mode 100644 index 00000000..f9747868 --- /dev/null +++ b/vendor/laminas/laminas-servicemanager/src/Tool/ConfigDumperCommand.php @@ -0,0 +1,244 @@ +, + * class: string, + * ignoreUnresolved: bool + * } + */ +class ConfigDumperCommand +{ + public const COMMAND_DUMP = 'dump'; + public const COMMAND_ERROR = 'error'; + public const COMMAND_HELP = 'help'; + + public const DEFAULT_SCRIPT_NAME = self::class; + + public const HELP_TEMPLATE = <<Usage:
    + + %s [-h|--help|help] [-i|--ignore-unresolved] + +Arguments: + + -h|--help|help This usage message + -i|--ignore-unresolved Ignore classes with unresolved direct dependencies. + Path to a config file for which to generate + configuration. If the file does not exist, it will + be created. If it does exist, it must return an + array, and the file will be updated with new + configuration. + Name of the class to reflect and for which to + generate dependency configuration. + +Reads the provided configuration file (creating it if it does not exist), +and injects it with ConfigAbstractFactory dependency configuration for +the provided class name, writing the changes back to the file. +EOH; + + private ConsoleHelper $helper; + + /** + * @param string $scriptName + */ + public function __construct(private $scriptName = self::DEFAULT_SCRIPT_NAME, ?ConsoleHelper $helper = null) + { + $this->helper = $helper ?: new ConsoleHelper(); + } + + /** + * @param array $args Argument list, minus script name + * @return int Exit status + */ + public function __invoke(array $args) + { + $arguments = $this->parseArgs($args); + + switch ($arguments->command) { + case self::COMMAND_HELP: + $this->help(); + return 0; + case self::COMMAND_ERROR: + $this->helper->writeErrorMessage($arguments->message); + $this->help(STDERR); + return 1; + case self::COMMAND_DUMP: + // fall-through + default: + break; + } + + $dumper = new ConfigDumper(); + try { + $config = $dumper->createDependencyConfig( + $arguments->config, + $arguments->class, + $arguments->ignoreUnresolved + ); + } catch (Exception\InvalidArgumentException $e) { + $this->helper->writeErrorMessage(sprintf( + 'Unable to create config for "%s": %s', + $arguments->class, + $e->getMessage() + )); + $this->help(STDERR); + return 1; + } + + file_put_contents($arguments->configFile, $dumper->dumpConfigFile($config)); + + $this->helper->writeLine(sprintf( + '[DONE] Changes written to %s', + $arguments->configFile + )); + return 0; + } + + /** + * @return object + */ + private function parseArgs(array $args) + { + if (! $args) { + return $this->createHelpArgument(); + } + + $arg1 = array_shift($args); + + if (in_array($arg1, ['-h', '--help', 'help'], true)) { + return $this->createHelpArgument(); + } + + $ignoreUnresolved = false; + if (in_array($arg1, ['-i', '--ignore-unresolved'], true)) { + $ignoreUnresolved = true; + $arg1 = array_shift($args); + } + + if (! $args) { + return $this->createErrorArgument('Missing class name'); + } + + $configFile = $arg1; + switch (file_exists($configFile)) { + case true: + $config = require $configFile; + + if (! is_array($config)) { + return $this->createErrorArgument(sprintf( + 'Configuration at path "%s" does not return an array.', + $configFile + )); + } + + break; + case false: + // fall-through + default: + if (! is_writable(dirname($configFile))) { + return $this->createErrorArgument(sprintf( + 'Cannot create configuration at path "%s"; not writable.', + $configFile + )); + } + + $config = []; + break; + } + + $class = array_shift($args); + + if (! class_exists($class)) { + return $this->createErrorArgument(sprintf( + 'Class "%s" does not exist or could not be autoloaded.', + $class + )); + } + + return $this->createArguments(self::COMMAND_DUMP, $configFile, $config, $class, $ignoreUnresolved); + } + + /** + * @param resource $resource Defaults to STDOUT + * @return void + */ + private function help($resource = STDOUT) + { + $this->helper->writeLine(sprintf( + self::HELP_TEMPLATE, + $this->scriptName + ), true, $resource); + } + + /** + * @param string $command + * @param string $configFile File from which config originates, and to + * which it will be written. + * @param array $config Parsed configuration. + * @param string $class Name of class to reflect. + * @param bool $ignoreUnresolved If to ignore classes with unresolved direct dependencies. + * @return ArgumentObject + */ + private function createArguments($command, $configFile, $config, $class, $ignoreUnresolved) + { + return (object) [ + 'command' => $command, + 'configFile' => $configFile, + 'config' => $config, + 'class' => $class, + 'ignoreUnresolved' => $ignoreUnresolved, + ]; + } + + /** + * @param string $message + * @return ErrorObject + */ + private function createErrorArgument($message) + { + return (object) [ + 'command' => self::COMMAND_ERROR, + 'message' => $message, + ]; + } + + /** + * @return HelpObject + */ + private function createHelpArgument() + { + return (object) [ + 'command' => self::COMMAND_HELP, + ]; + } +} diff --git a/vendor/laminas/laminas-servicemanager/src/Tool/FactoryCreator.php b/vendor/laminas/laminas-servicemanager/src/Tool/FactoryCreator.php new file mode 100644 index 00000000..6abcbf69 --- /dev/null +++ b/vendor/laminas/laminas-servicemanager/src/Tool/FactoryCreator.php @@ -0,0 +1,165 @@ +getClassName($className); + + return sprintf( + self::FACTORY_TEMPLATE, + preg_replace('/\\\\' . $class . '$/', '', $className), + $this->createImportStatements($className), + $class, + $class, + $class, + $this->createArgumentString($className) + ); + } + + private function getClassName(string $className): string + { + return substr($className, strrpos($className, '\\') + 1); + } + + /** + * @param string $className + * @return array + */ + private function getConstructorParameters($className) + { + $reflectionClass = new ReflectionClass($className); + + if (! $reflectionClass->getConstructor()) { + return []; + } + + $constructorParameters = $reflectionClass->getConstructor()->getParameters(); + + if (empty($constructorParameters)) { + return []; + } + + $constructorParameters = array_filter( + $constructorParameters, + static function (ReflectionParameter $argument): bool { + if ($argument->isOptional()) { + return false; + } + + $type = $argument->getType(); + $class = $type instanceof ReflectionNamedType && ! $type->isBuiltin() ? $type->getName() : null; + + if (null === $class) { + throw new InvalidArgumentException(sprintf( + 'Cannot identify type for constructor argument "%s"; ' + . 'no type hint, or non-class/interface type hint', + $argument->getName() + )); + } + + return true; + } + ); + + if (empty($constructorParameters)) { + return []; + } + + return array_map(static function (ReflectionParameter $parameter): ?string { + $type = $parameter->getType(); + return $type instanceof ReflectionNamedType && ! $type->isBuiltin() ? $type->getName() : null; + }, $constructorParameters); + } + + /** + * @param string $className + * @return string + */ + private function createArgumentString($className) + { + $arguments = array_map(static fn(string $dependency): string + => sprintf('$container->get(\\%s::class)', $dependency), $this->getConstructorParameters($className)); + + switch (count($arguments)) { + case 0: + return ''; + case 1: + return array_shift($arguments); + default: + $argumentPad = str_repeat(' ', 12); + $closePad = str_repeat(' ', 8); + return sprintf( + "\n%s%s\n%s", + $argumentPad, + implode(",\n" . $argumentPad, $arguments), + $closePad + ); + } + } + + private function createImportStatements(string $className): string + { + $imports = array_merge(self::IMPORT_ALWAYS, [$className]); + sort($imports); + return implode("\n", array_map(static fn(string $import): string => sprintf('use %s;', $import), $imports)); + } +} diff --git a/vendor/laminas/laminas-servicemanager/src/Tool/FactoryCreatorCommand.php b/vendor/laminas/laminas-servicemanager/src/Tool/FactoryCreatorCommand.php new file mode 100644 index 00000000..a89df165 --- /dev/null +++ b/vendor/laminas/laminas-servicemanager/src/Tool/FactoryCreatorCommand.php @@ -0,0 +1,150 @@ +Usage: + + %s [-h|--help|help] + +Arguments: + + -h|--help|help This usage message + Name of the class to reflect and for which to generate + a factory. + +Generates to STDOUT a factory for creating the specified class; this may then +be added to your application, and configured as a factory for the class. +EOH; + + private ConsoleHelper $helper; + + /** + * @param string $scriptName + */ + public function __construct(private $scriptName = self::DEFAULT_SCRIPT_NAME, ?ConsoleHelper $helper = null) + { + $this->helper = $helper ?: new ConsoleHelper(); + } + + /** + * @param array $args Argument list, minus script name + * @return int Exit status + */ + public function __invoke(array $args) + { + $arguments = $this->parseArgs($args); + + switch ($arguments->command) { + case self::COMMAND_HELP: + $this->help(); + return 0; + case self::COMMAND_ERROR: + assert(is_string($arguments->message)); + $this->helper->writeErrorMessage($arguments->message); + $this->help(STDERR); + return 1; + case self::COMMAND_DUMP: + // fall-through + default: + break; + } + + $generator = new FactoryCreator(); + assert(is_string($arguments->class)); + try { + $factory = $generator->createFactory($arguments->class); + } catch (Exception\InvalidArgumentException $e) { + $this->helper->writeErrorMessage(sprintf( + 'Unable to create factory for "%s": %s', + $arguments->class, + $e->getMessage() + )); + $this->help(STDERR); + return 1; + } + + $this->helper->write($factory, false); + return 0; + } + + /** + * @return ArgumentObject + */ + private function parseArgs(array $args) + { + if (! $args) { + return $this->createArguments(self::COMMAND_HELP); + } + + $arg1 = array_shift($args); + + if (in_array($arg1, ['-h', '--help', 'help'], true)) { + return $this->createArguments(self::COMMAND_HELP); + } + + $class = $arg1; + + if (! class_exists($class)) { + return $this->createArguments(self::COMMAND_ERROR, null, sprintf( + 'Class "%s" does not exist or could not be autoloaded.', + $class + )); + } + + return $this->createArguments(self::COMMAND_DUMP, $class); + } + + /** + * @param resource $resource Defaults to STDOUT + * @return void + */ + private function help($resource = STDOUT) + { + $this->helper->writeLine(sprintf( + self::HELP_TEMPLATE, + $this->scriptName + ), true, $resource); + } + + /** + * @param string $command + * @param string|null $class Name of class to reflect. + * @param string|null $error Error message, if any. + * @return ArgumentObject + */ + private function createArguments($command, $class = null, $error = null) + { + return (object) [ + 'command' => $command, + 'class' => $class, + 'message' => $error, + ]; + } +} diff --git a/vendor/laminas/laminas-servicemanager/src/autoload.php b/vendor/laminas/laminas-servicemanager/src/autoload.php new file mode 100644 index 00000000..76bd64e0 --- /dev/null +++ b/vendor/laminas/laminas-servicemanager/src/autoload.php @@ -0,0 +1,21 @@ + ## 🇷🇺 Русским гражданам +> +> Мы, участники Laminas, родились и живем в разных странах. У многих из нас есть друзья, родственники и коллеги как в России, так и в Украине. Некоторые из нас родились в России. Некоторые из нас живут в России. У некоторых бабушки и дедушки сражались с фашистами во Второй мировой войне. Здесь никто не поддерживает фашизм. +> +> У одного из нас есть украинская родственница, которая спаслась из дома вместе с сыном. Поезд задержался из-за бомбежки на дороге впереди. У нас есть друзья, которые прячутся в бомбоубежищах. Мы с тревогой ждем весточки от них после воздушных налетов, которые беспорядочно наносят удары и попадают по больницам, школам, детским садам и домам. Мы не берем это из каких-либо СМИ. Мы наблюдаем это напрямую. +> +> Вы доверяете нам достаточно, чтоб использовать наши программы, и мы просим вас довериться нам вновь. Мы нуждаемся в помощи. Выходите и протестуйте против этой бесполезной войны. Остановите кровопролитие. Скажите "Нет войне!" +> +> ## 🇺🇸 To Citizens of Russia +> +> We at Laminas come from all over the world. Many of us have friends, family and colleagues in both Russia and Ukraine. Some of us were born in Russia. Some of us currently live in Russia. Some have grandparents who fought Nazis in World War II. Nobody here supports fascism. +> +> One team member has a Ukrainian relative who fled her home with her son. The train was delayed due to bombing on the road ahead. We have friends who are hiding in bomb shelters. We anxiously follow up on them after the air raids, which indiscriminately fire at hospitals, schools, kindergartens and houses. We're not taking this from any media. These are our actual experiences. +> +> You trust us enough to use our software. We ask that you trust us to say the truth on this. We need your help. Go out and protest this unnecessary war. Stop the bloodshed. Say "stop the war!" + +`Laminas\Stdlib` is a set of components that implements general purpose utility +class for different scopes like: + +- array utilities functions; +- general messaging systems; +- string wrappers; +- etc. + +--- + +- File issues at https://github.com/laminas/laminas-stdlib/issues +- Documentation is at https://docs.laminas.dev/laminas-stdlib/ + +## Benchmarks + +We provide scripts for benchmarking laminas-stdlib using the +[PHPBench](https://github.com/phpbench/phpbench) framework; these can be +found in the `benchmark/` directory. + +To execute the benchmarks you can run the following command: + +```bash +$ vendor/bin/phpbench run --report=aggregate +``` diff --git a/vendor/laminas/laminas-stdlib/composer.json b/vendor/laminas/laminas-stdlib/composer.json new file mode 100644 index 00000000..bb713ea8 --- /dev/null +++ b/vendor/laminas/laminas-stdlib/composer.json @@ -0,0 +1,64 @@ +{ + "name": "laminas/laminas-stdlib", + "description": "SPL extensions, array utilities, error handlers, and more", + "license": "BSD-3-Clause", + "keywords": [ + "laminas", + "stdlib" + ], + "homepage": "https://laminas.dev", + "support": { + "docs": "https://docs.laminas.dev/laminas-stdlib/", + "issues": "https://github.com/laminas/laminas-stdlib/issues", + "source": "https://github.com/laminas/laminas-stdlib", + "rss": "https://github.com/laminas/laminas-stdlib/releases.atom", + "chat": "https://laminas.dev/chat", + "forum": "https://discourse.laminas.dev" + }, + "config": { + "sort-packages": true, + "platform": { + "php": "8.1.99" + }, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + }, + "extra": { + }, + "require": { + "php": "~8.1.0 || ~8.2.0 || ~8.3.0" + }, + "require-dev": { + "laminas/laminas-coding-standard": "^2.5", + "phpbench/phpbench": "^1.2.15", + "phpunit/phpunit": "^10.5.8", + "psalm/plugin-phpunit": "^0.18.4", + "vimeo/psalm": "^5.20.0" + }, + "autoload": { + "psr-4": { + "Laminas\\Stdlib\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "LaminasTest\\Stdlib\\": "test/", + "LaminasBench\\Stdlib\\": "benchmark/" + } + }, + "scripts": { + "check": [ + "@cs-check", + "@test" + ], + "cs-check": "phpcs", + "cs-fix": "phpcbf", + "static-analysis": "psalm --shepherd --stats", + "test": "phpunit --colors=always", + "test-coverage": "phpunit --colors=always --coverage-clover clover.xml" + }, + "conflict": { + "zendframework/zend-stdlib": "*" + } +} diff --git a/vendor/laminas/laminas-stdlib/src/AbstractOptions.php b/vendor/laminas/laminas-stdlib/src/AbstractOptions.php new file mode 100644 index 00000000..5db2ea95 --- /dev/null +++ b/vendor/laminas/laminas-stdlib/src/AbstractOptions.php @@ -0,0 +1,200 @@ + + */ +abstract class AbstractOptions implements ParameterObjectInterface +{ + // phpcs:disable PSR2.Classes.PropertyDeclaration.Underscore,WebimpressCodingStandard.NamingConventions.ValidVariableName.NotCamelCapsProperty + + /** + * We use the __ prefix to avoid collisions with properties in + * user-implementations. + * + * @var bool + */ + protected $__strictMode__ = true; + + // phpcs:enable + + /** + * Constructor + * + * @param iterable|AbstractOptions|null $options + */ + public function __construct($options = null) + { + if (null !== $options) { + $this->setFromArray($options); + } + } + + /** + * Set one or more configuration properties + * + * @param iterable|AbstractOptions $options + * @throws Exception\InvalidArgumentException + * @return AbstractOptions Provides fluent interface + */ + public function setFromArray($options) + { + if ($options instanceof self) { + $options = $options->toArray(); + } + + if (! is_array($options) && ! $options instanceof Traversable) { + throw new Exception\InvalidArgumentException( + sprintf( + 'Parameter provided to %s must be an %s, %s or %s', + __METHOD__, + 'array', + 'Traversable', + self::class + ) + ); + } + + foreach ($options as $key => $value) { + $this->__set($key, $value); + } + + return $this; + } + + /** + * Cast to array + * + * @return array + */ + public function toArray() + { + $array = []; + + $transform = static function (array $letters): string { + /** @var list $letters */ + $letter = array_shift($letters); + return '_' . strtolower($letter); + }; + + /** @psalm-var TValue $value */ + foreach (get_object_vars($this) as $key => $value) { + if ($key === '__strictMode__') { + continue; + } + $normalizedKey = preg_replace_callback('/([A-Z])/', $transform, $key); + $array[$normalizedKey] = $value; + } + + return $array; + } + + /** + * Set a configuration property + * + * @see ParameterObject::__set() + * + * @param string $key + * @param TValue|null $value + * @throws Exception\BadMethodCallException + * @return void + */ + public function __set($key, $value) + { + $setter = 'set' . str_replace('_', '', $key); + + if (is_callable([$this, $setter])) { + $this->{$setter}($value); + + return; + } + + if ($this->__strictMode__) { + throw new Exception\BadMethodCallException(sprintf( + 'The option "%s" does not have a callable "%s" ("%s") setter method which must be defined', + $key, + 'set' . str_replace(' ', '', ucwords(str_replace('_', ' ', $key))), + $setter + )); + } + } + + /** + * Get a configuration property + * + * @see ParameterObject::__get() + * + * @param string $key + * @throws Exception\BadMethodCallException + * @return TValue + */ + public function __get($key) + { + $getter = 'get' . str_replace('_', '', $key); + + if (is_callable([$this, $getter])) { + return $this->{$getter}(); + } + + throw new Exception\BadMethodCallException(sprintf( + 'The option "%s" does not have a callable "%s" getter method which must be defined', + $key, + 'get' . str_replace(' ', '', ucwords(str_replace('_', ' ', $key))) + )); + } + + /** + * Test if a configuration property is null + * + * @see ParameterObject::__isset() + * + * @param string $key + * @return bool + */ + public function __isset($key) + { + $getter = 'get' . str_replace('_', '', $key); + + return method_exists($this, $getter) && null !== $this->__get($key); + } + + /** + * Set a configuration property to NULL + * + * @see ParameterObject::__unset() + * + * @param string $key + * @throws Exception\InvalidArgumentException + * @return void + */ + public function __unset($key) + { + try { + $this->__set($key, null); + } catch (Exception\BadMethodCallException $e) { + throw new Exception\InvalidArgumentException( + 'The class property $' . $key . ' cannot be unset as' + . ' NULL is an invalid value for it', + 0, + $e + ); + } + } +} diff --git a/vendor/laminas/laminas-stdlib/src/ArrayObject.php b/vendor/laminas/laminas-stdlib/src/ArrayObject.php new file mode 100644 index 00000000..e0cdc710 --- /dev/null +++ b/vendor/laminas/laminas-stdlib/src/ArrayObject.php @@ -0,0 +1,509 @@ + + * @template-implements ArrayAccess + */ +#[AllowDynamicProperties] +class ArrayObject implements IteratorAggregate, ArrayAccess, Serializable, Countable +{ + /** + * Properties of the object have their normal functionality + * when accessed as list (var_dump, foreach, etc.). + */ + public const STD_PROP_LIST = 1; + + /** + * Entries can be accessed as properties (read and write). + */ + public const ARRAY_AS_PROPS = 2; + + /** @var array */ + protected $storage; + + /** @var self::STD_PROP_LIST|self::ARRAY_AS_PROPS */ + protected $flag; + + /** @var class-string */ + protected $iteratorClass; + + /** @var list */ + protected $protectedProperties; + + /** + * @param array|object $input Object values must act like ArrayAccess + * @param self::STD_PROP_LIST|self::ARRAY_AS_PROPS $flags + * @param class-string $iteratorClass + */ + public function __construct($input = [], $flags = self::STD_PROP_LIST, $iteratorClass = ArrayIterator::class) + { + $this->setFlags($flags); + $this->storage = $input; + $this->setIteratorClass($iteratorClass); + $this->protectedProperties = array_keys(get_object_vars($this)); + } + + /** + * Returns whether the requested key exists + * + * @param TKey $key + * @return bool + */ + public function __isset(mixed $key) + { + if ($this->flag === self::ARRAY_AS_PROPS) { + return $this->offsetExists($key); + } + + if (in_array($key, $this->protectedProperties)) { + throw new Exception\InvalidArgumentException("$key is a protected property, use a different key"); + } + + return isset($this->$key); + } + + /** + * Sets the value at the specified key to value + * + * @param TKey $key + * @param TValue $value + * @return void + */ + public function __set(mixed $key, mixed $value) + { + if ($this->flag === self::ARRAY_AS_PROPS) { + $this->offsetSet($key, $value); + return; + } + + if (in_array($key, $this->protectedProperties)) { + throw new Exception\InvalidArgumentException("$key is a protected property, use a different key"); + } + + $this->$key = $value; + } + + /** + * Unsets the value at the specified key + * + * @param TKey $key + * @return void + */ + public function __unset(mixed $key) + { + if ($this->flag === self::ARRAY_AS_PROPS) { + $this->offsetUnset($key); + return; + } + + if (in_array($key, $this->protectedProperties)) { + throw new Exception\InvalidArgumentException("$key is a protected property, use a different key"); + } + + unset($this->$key); + } + + /** + * Returns the value at the specified key by reference + * + * @param TKey $key + * @return TValue|null + */ + public function &__get(mixed $key) + { + if ($this->flag === self::ARRAY_AS_PROPS) { + $ret = &$this->offsetGet($key); + + return $ret; + } + + if (in_array($key, $this->protectedProperties, true)) { + throw new Exception\InvalidArgumentException("$key is a protected property, use a different key"); + } + + return $this->$key; + } + + /** + * Appends the value + * + * @param TValue $value + * @return void + */ + public function append(mixed $value) + { + $this->storage[] = $value; + } + + /** + * Sort the entries by value + * + * @return void + */ + public function asort() + { + asort($this->storage); + } + + /** + * Get the number of public properties in the ArrayObject + * + * @return positive-int|0 + */ + #[ReturnTypeWillChange] + public function count() + { + return count($this->storage); + } + + /** + * Exchange the array for another one. + * + * @param array|ArrayObject|ArrayIterator|object $data + * @return array + */ + public function exchangeArray($data) + { + if (! is_array($data) && ! is_object($data)) { + throw new Exception\InvalidArgumentException( + 'Passed variable is not an array or object, using empty array instead' + ); + } + + if (is_object($data) && ($data instanceof self || $data instanceof \ArrayObject)) { + $data = $data->getArrayCopy(); + } + if (! is_array($data)) { + $data = (array) $data; + } + + $storage = $this->storage; + + $this->storage = $data; + + return $storage; + } + + /** + * Creates a copy of the ArrayObject. + * + * @return array + */ + public function getArrayCopy() + { + return $this->storage; + } + + /** + * Gets the behavior flags. + * + * @return self::STD_PROP_LIST|self::ARRAY_AS_PROPS + */ + public function getFlags() + { + return $this->flag; + } + + /** + * Create a new iterator from an ArrayObject instance + * + * @return Iterator + */ + #[ReturnTypeWillChange] + public function getIterator() + { + $class = $this->iteratorClass; + + return new $class($this->storage); + } + + /** + * Gets the iterator classname for the ArrayObject. + * + * @return class-string + */ + public function getIteratorClass() + { + return $this->iteratorClass; + } + + /** + * Sort the entries by key + * + * @return void + */ + public function ksort() + { + ksort($this->storage); + } + + /** + * Sort an array using a case insensitive "natural order" algorithm + * + * @return void + */ + public function natcasesort() + { + natcasesort($this->storage); + } + + /** + * Sort entries using a "natural order" algorithm + * + * @return void + */ + public function natsort() + { + natsort($this->storage); + } + + /** + * Returns whether the requested key exists + * + * @param TKey $key + * @return bool + */ + #[ReturnTypeWillChange] + public function offsetExists(mixed $key) + { + return isset($this->storage[$key]); + } + + /** + * {@inheritDoc} + * + * @param TKey $key + * @return TValue|null + */ + #[ReturnTypeWillChange] + public function &offsetGet(mixed $key) + { + $ret = null; + if (! $this->offsetExists($key)) { + return $ret; + } + $ret = &$this->storage[$key]; + + return $ret; + } + + /** + * Sets the value at the specified key to value + * + * @param TKey $offset + * @param TValue $value + * @return void + */ + #[ReturnTypeWillChange] + public function offsetSet(mixed $offset, mixed $value) + { + $this->storage[$offset] = $value; + } + + /** + * Unsets the value at the specified key + * + * @param TKey $offset + * @return void + */ + #[ReturnTypeWillChange] + public function offsetUnset(mixed $offset) + { + if ($this->offsetExists($offset)) { + unset($this->storage[$offset]); + } + } + + /** + * Serialize an ArrayObject + * + * @return string + */ + public function serialize() + { + return serialize($this->__serialize()); + } + + /** + * Magic method used for serializing of an instance. + * + * @return array + */ + public function __serialize() + { + return get_object_vars($this); + } + + /** + * Sets the behavior flags + * + * @param self::STD_PROP_LIST|self::ARRAY_AS_PROPS $flags + * @return void + */ + public function setFlags($flags) + { + $this->flag = $flags; + } + + /** + * Sets the iterator classname for the ArrayObject + * + * @param class-string $class + * @return void + */ + public function setIteratorClass($class) + { + if (class_exists($class)) { + $this->iteratorClass = $class; + + return; + } + + if (str_starts_with($class, '\\')) { + $class = '\\' . $class; + if (class_exists($class)) { + $this->iteratorClass = $class; + + return; + } + } + + throw new Exception\InvalidArgumentException('The iterator class does not exist'); + } + + /** + * Sort the entries with a user-defined comparison function and maintain key association + * + * @param callable(TValue, TValue): int $function + * @return void + */ + public function uasort($function) + { + if (is_callable($function)) { + uasort($this->storage, $function); + } + } + + /** + * Sort the entries by keys using a user-defined comparison function + * + * @param callable(TKey, TKey): int $function + * @return void + */ + public function uksort($function) + { + if (is_callable($function)) { + uksort($this->storage, $function); + } + } + + /** + * Unserialize an ArrayObject + * + * @param string $data + * @return void + */ + public function unserialize($data) + { + $toUnserialize = unserialize($data); + if (! is_array($toUnserialize)) { + throw new UnexpectedValueException(sprintf( + 'Cannot deserialize %s instance; corrupt serialization data', + self::class + )); + } + + $this->__unserialize($toUnserialize); + } + + /** + * Magic method used to rebuild an instance. + * + * @param array $data Data array. + * @return void + */ + public function __unserialize($data) + { + $this->protectedProperties = array_keys(get_object_vars($this)); + + // Unserialize protected internal properties first + if (array_key_exists('flag', $data)) { + $this->setFlags((int) $data['flag']); + unset($data['flag']); + } + + if (array_key_exists('storage', $data)) { + if (! is_array($data['storage']) && ! is_object($data['storage'])) { + throw new UnexpectedValueException(sprintf( + 'Cannot deserialize %s instance: corrupt storage data; expected array or object, received %s', + self::class, + gettype($data['storage']) + )); + } + $this->exchangeArray($data['storage']); + unset($data['storage']); + } + + if (array_key_exists('iteratorClass', $data)) { + if (! is_string($data['iteratorClass'])) { + throw new UnexpectedValueException(sprintf( + 'Cannot deserialize %s instance: invalid iteratorClass; expected string, received %s', + self::class, + get_debug_type($data['iteratorClass']) + )); + } + $this->setIteratorClass($data['iteratorClass']); + unset($data['iteratorClass']); + } + + unset($data['protectedProperties']); + + // Unserialize array keys after resolving protected properties to ensure configuration is used. + foreach ($data as $k => $v) { + $this->__set($k, $v); + } + } +} diff --git a/vendor/laminas/laminas-stdlib/src/ArraySerializableInterface.php b/vendor/laminas/laminas-stdlib/src/ArraySerializableInterface.php new file mode 100644 index 00000000..adb5231f --- /dev/null +++ b/vendor/laminas/laminas-stdlib/src/ArraySerializableInterface.php @@ -0,0 +1,22 @@ + + */ +class ArrayStack extends PhpArrayObject +{ + /** + * Retrieve iterator + * + * Retrieve an array copy of the object, reverse its order, and return an + * ArrayIterator with that reversed array. + * + * @return ArrayIterator + */ + #[ReturnTypeWillChange] + public function getIterator() + { + $array = $this->getArrayCopy(); + return new ArrayIterator(array_reverse($array)); + } +} diff --git a/vendor/laminas/laminas-stdlib/src/ArrayUtils.php b/vendor/laminas/laminas-stdlib/src/ArrayUtils.php new file mode 100644 index 00000000..7bfa20dc --- /dev/null +++ b/vendor/laminas/laminas-stdlib/src/ArrayUtils.php @@ -0,0 +1,337 @@ + + * $list = array('a', 'b', 'c', 'd'); + * $list = array( + * 0 => 'foo', + * 1 => 'bar', + * 2 => array('foo' => 'baz'), + * ); + * + * + * @param bool $allowEmpty Is an empty list a valid list? + * @return bool + */ + public static function isList(mixed $value, $allowEmpty = false) + { + if (! is_array($value)) { + return false; + } + + if (! $value) { + return $allowEmpty; + } + + return array_values($value) === $value; + } + + /** + * Test whether an array is a hash table. + * + * An array is a hash table if: + * + * 1. Contains one or more non-integer keys, or + * 2. Integer keys are non-continuous or misaligned (not starting with 0) + * + * For example: + * + * $hash = array( + * 'foo' => 15, + * 'bar' => false, + * ); + * $hash = array( + * 1995 => 'Birth of PHP', + * 2009 => 'PHP 5.3.0', + * 2012 => 'PHP 5.4.0', + * ); + * $hash = array( + * 'formElement, + * 'options' => array( 'debug' => true ), + * ); + * + * + * @param bool $allowEmpty Is an empty array() a valid hash table? + * @return bool + */ + public static function isHashTable(mixed $value, $allowEmpty = false) + { + if (! is_array($value)) { + return false; + } + + if (! $value) { + return $allowEmpty; + } + + return array_values($value) !== $value; + } + + /** + * Checks if a value exists in an array. + * + * Due to "foo" == 0 === TRUE with in_array when strict = false, an option + * has been added to prevent this. When $strict = 0/false, the most secure + * non-strict check is implemented. if $strict = -1, the default in_array + * non-strict behaviour is used. + * + * @deprecated This method will be removed in version 4.0 of this component + * + * @param array $haystack + * @param int|bool $strict + * @return bool + */ + public static function inArray(mixed $needle, array $haystack, $strict = false) + { + if ((bool) $strict === false) { + if (is_int($needle) || is_float($needle)) { + $needle = (string) $needle; + } + if (is_string($needle)) { + foreach ($haystack as &$h) { + if (is_int($h) || is_float($h)) { + $h = (string) $h; + } + } + } + } + + return in_array($needle, $haystack, (bool) $strict); + } + + /** + * Converts an iterator to an array. The $recursive flag, on by default, + * hints whether or not you want to do so recursively. + * + * @template TKey + * @template TValue + * @param iterable $iterator The array or Traversable object to convert + * @param bool $recursive Recursively check all nested structures + * @throws Exception\InvalidArgumentException If $iterator is not an array or a Traversable object. + * @return array + */ + public static function iteratorToArray($iterator, $recursive = true) + { + /** @psalm-suppress DocblockTypeContradiction */ + if (! is_array($iterator) && ! $iterator instanceof Traversable) { + throw new Exception\InvalidArgumentException(__METHOD__ . ' expects an array or Traversable object'); + } + + if (! $recursive) { + if (is_array($iterator)) { + return $iterator; + } + + return iterator_to_array($iterator); + } + + if ( + is_object($iterator) + && ! $iterator instanceof Iterator + && method_exists($iterator, 'toArray') + ) { + /** @psalm-var array $array */ + $array = $iterator->toArray(); + + return $array; + } + + $array = []; + foreach ($iterator as $key => $value) { + if (is_scalar($value)) { + $array[$key] = $value; + continue; + } + + if ($value instanceof Traversable) { + $array[$key] = static::iteratorToArray($value, $recursive); + continue; + } + + if (is_array($value)) { + $array[$key] = static::iteratorToArray($value, $recursive); + continue; + } + + $array[$key] = $value; + } + + /** @psalm-var array $array */ + + return $array; + } + + /** + * Merge two arrays together. + * + * If an integer key exists in both arrays and preserveNumericKeys is false, the value + * from the second array will be appended to the first array. If both values are arrays, they + * are merged together, else the value of the second array overwrites the one of the first array. + * + * @param array $a + * @param array $b + * @param bool $preserveNumericKeys + * @return array + */ + public static function merge(array $a, array $b, $preserveNumericKeys = false) + { + foreach ($b as $key => $value) { + if ($value instanceof MergeReplaceKeyInterface) { + $a[$key] = $value->getData(); + } elseif (isset($a[$key]) || array_key_exists($key, $a)) { + if ($value instanceof MergeRemoveKey) { + unset($a[$key]); + } elseif (! $preserveNumericKeys && is_int($key)) { + $a[] = $value; + } elseif (is_array($value) && is_array($a[$key])) { + $a[$key] = static::merge($a[$key], $value, $preserveNumericKeys); + } else { + $a[$key] = $value; + } + } else { + if (! $value instanceof MergeRemoveKey) { + $a[$key] = $value; + } + } + } + + return $a; + } + + /** + * @deprecated Since 3.2.0; use the native array_filter methods + * + * @param callable $callback + * @param null|int $flag + * @return array + * @throws Exception\InvalidArgumentException + */ + public static function filter(array $data, $callback, $flag = null) + { + if (! is_callable($callback)) { + throw new Exception\InvalidArgumentException(sprintf( + 'Second parameter of %s must be callable', + __METHOD__ + )); + } + + return array_filter($data, $callback, $flag ?? 0); + } +} diff --git a/vendor/laminas/laminas-stdlib/src/ArrayUtils/MergeRemoveKey.php b/vendor/laminas/laminas-stdlib/src/ArrayUtils/MergeRemoveKey.php new file mode 100644 index 00000000..bde0b25a --- /dev/null +++ b/vendor/laminas/laminas-stdlib/src/ArrayUtils/MergeRemoveKey.php @@ -0,0 +1,9 @@ +data; + } +} diff --git a/vendor/laminas/laminas-stdlib/src/ArrayUtils/MergeReplaceKeyInterface.php b/vendor/laminas/laminas-stdlib/src/ArrayUtils/MergeReplaceKeyInterface.php new file mode 100644 index 00000000..47243fc2 --- /dev/null +++ b/vendor/laminas/laminas-stdlib/src/ArrayUtils/MergeReplaceKeyInterface.php @@ -0,0 +1,16 @@ +message`, + * `message`) + * - Write output to a specified stream, optionally with colorization. + * - Write a line of output to a specified stream, optionally with + * colorization, using the system EOL sequence.. + * - Write an error message to STDERR. + * + * Colorization will only occur when expected sequences are discovered, and + * then, only if the console terminal allows it. + * + * Essentially, provides the bare minimum to allow you to provide messages to + * the current console. + */ +class ConsoleHelper +{ + public const COLOR_GREEN = "\033[32m"; + public const COLOR_RED = "\033[31m"; + public const COLOR_RESET = "\033[0m"; + + public const HIGHLIGHT_INFO = 'info'; + public const HIGHLIGHT_ERROR = 'error'; + + /** @psalm-var array */ + private array $highlightMap = [ + self::HIGHLIGHT_INFO => self::COLOR_GREEN, + self::HIGHLIGHT_ERROR => self::COLOR_RED, + ]; + + /** @var string Exists only for testing. */ + private string $eol = PHP_EOL; + + /** @var resource Exists only for testing. */ + private $stderr = STDERR; + + private bool $supportsColor; + + /** + * @param resource $resource + */ + public function __construct($resource = STDOUT) + { + $this->supportsColor = $this->detectColorCapabilities($resource); + } + + /** + * Colorize a string for use with the terminal. + * + * Takes strings formatted as `string` and formats them per the + * $highlightMap; if color support is disabled, simply removes the formatting + * tags. + * + * @param string $string + * @return string + */ + public function colorize($string) + { + $reset = $this->supportsColor ? self::COLOR_RESET : ''; + foreach ($this->highlightMap as $key => $color) { + $pattern = sprintf('#<%s>(.*?)#s', $key, $key); + $color = $this->supportsColor ? $color : ''; + $string = preg_replace($pattern, $color . '$1' . $reset, $string); + } + return $string; + } + + /** + * @param string $string + * @param bool $colorize Whether or not to colorize the string + * @param resource $resource Defaults to STDOUT + * @return void + */ + public function write($string, $colorize = true, $resource = STDOUT) + { + if ($colorize) { + $string = $this->colorize($string); + } + + $string = $this->formatNewlines($string); + + fwrite($resource, $string); + } + + /** + * @param string $string + * @param bool $colorize Whether or not to colorize the line + * @param resource $resource Defaults to STDOUT + * @return void + */ + public function writeLine($string, $colorize = true, $resource = STDOUT) + { + $this->write($string . $this->eol, $colorize, $resource); + } + + /** + * Emit an error message. + * + * Wraps the message in ``, and passes it to `writeLine()`, + * using STDERR as the resource; emits an additional empty line when done, + * also to STDERR. + * + * @param string $message + * @return void + */ + public function writeErrorMessage($message) + { + $this->writeLine(sprintf('%s', $message), true, $this->stderr); + $this->writeLine('', false, $this->stderr); + } + + /** + * @param resource $resource + * @return bool + */ + private function detectColorCapabilities($resource = STDOUT) + { + if ('\\' === DIRECTORY_SEPARATOR) { + // Windows + return false !== getenv('ANSICON') + || 'ON' === getenv('ConEmuANSI') + || 'xterm' === getenv('TERM'); + } + + return function_exists('posix_isatty') && posix_isatty($resource); + } + + /** + * Ensure newlines are appropriate for the current terminal. + * + * @param string $string + * @return string + */ + private function formatNewlines($string) + { + $string = str_replace($this->eol, "\0PHP_EOL\0", $string); + $string = preg_replace("/(\r\n|\n|\r)/", $this->eol, $string); + return str_replace("\0PHP_EOL\0", $this->eol, $string); + } +} diff --git a/vendor/laminas/laminas-stdlib/src/DispatchableInterface.php b/vendor/laminas/laminas-stdlib/src/DispatchableInterface.php new file mode 100644 index 00000000..a9b325a6 --- /dev/null +++ b/vendor/laminas/laminas-stdlib/src/DispatchableInterface.php @@ -0,0 +1,15 @@ + + */ + protected static $stack = []; + + /** + * Check if this error handler is active + * + * @return bool + */ + public static function started() + { + return (bool) static::getNestedLevel(); + } + + /** + * Get the current nested level + * + * @return int + */ + public static function getNestedLevel() + { + return count(static::$stack); + } + + /** + * Starting the error handler + * + * @param int $errorLevel + * @return void + */ + public static function start($errorLevel = E_WARNING) + { + if (! static::$stack) { + set_error_handler([static::class, 'addError'], $errorLevel); + } + + static::$stack[] = null; + } + + /** + * Stopping the error handler + * + * @param bool $throw Throw the ErrorException if any + * @return null|ErrorException + * @throws ErrorException If an error has been caught and $throw is true. + */ + public static function stop($throw = false) + { + $errorException = null; + + if (static::$stack) { + $errorException = array_pop(static::$stack); + + if (! static::$stack) { + restore_error_handler(); + } + + if ($errorException && $throw) { + throw $errorException; + } + } + + return $errorException; + } + + /** + * Stop all active handler + * + * @return void + */ + public static function clean() + { + if (static::$stack) { + restore_error_handler(); + } + + static::$stack = []; + } + + /** + * Add an error to the stack + * + * @param int $errno + * @param string $errstr + * @param string $errfile + * @param int $errline + * @return void + */ + public static function addError($errno, $errstr = '', $errfile = '', $errline = 0) + { + $stack = &static::$stack[count(static::$stack) - 1]; + $stack = new ErrorException($errstr, 0, $errno, $errfile, $errline, $stack); + } +} diff --git a/vendor/laminas/laminas-stdlib/src/Exception/BadMethodCallException.php b/vendor/laminas/laminas-stdlib/src/Exception/BadMethodCallException.php new file mode 100644 index 00000000..a62b9171 --- /dev/null +++ b/vendor/laminas/laminas-stdlib/src/Exception/BadMethodCallException.php @@ -0,0 +1,12 @@ + + */ +class FastPriorityQueue implements Iterator, Countable, Serializable +{ + public const EXTR_DATA = PhpSplPriorityQueue::EXTR_DATA; + public const EXTR_PRIORITY = PhpSplPriorityQueue::EXTR_PRIORITY; + public const EXTR_BOTH = PhpSplPriorityQueue::EXTR_BOTH; + + /** @var self::EXTR_* */ + protected $extractFlag = self::EXTR_DATA; + + /** + * Elements of the queue, divided by priorities + * + * @var array> + */ + protected $values = []; + + /** + * Array of priorities + * + * @var array + */ + protected $priorities = []; + + /** + * Array of priorities used for the iteration + * + * @var array + */ + protected $subPriorities = []; + + /** + * Max priority + * + * @var int|null + */ + protected $maxPriority; + + /** + * Total number of elements in the queue + * + * @var int + */ + protected $count = 0; + + /** + * Index of the current element in the queue + * + * @var int + */ + protected $index = 0; + + /** + * Sub index of the current element in the same priority level + * + * @var int + */ + protected $subIndex = 0; + + public function __serialize(): array + { + $clone = clone $this; + $clone->setExtractFlags(self::EXTR_BOTH); + + $data = []; + foreach ($clone as $item) { + $data[] = $item; + } + + return $data; + } + + public function __unserialize(array $data): void + { + foreach ($data as $item) { + $this->insert($item['data'], $item['priority']); + } + } + + /** + * Insert an element in the queue with a specified priority + * + * @param TValue $value + * @param int $priority + * @return void + */ + public function insert(mixed $value, $priority) + { + if (! is_int($priority)) { + throw new Exception\InvalidArgumentException('The priority must be an integer'); + } + $this->values[$priority][] = $value; + if (! isset($this->priorities[$priority])) { + $this->priorities[$priority] = $priority; + $this->maxPriority = $this->maxPriority === null ? $priority : max($priority, $this->maxPriority); + } + ++$this->count; + } + + /** + * Extract an element in the queue according to the priority and the + * order of insertion + * + * @return TValue|int|array{data: TValue, priority: int}|false + */ + public function extract() + { + if (! $this->valid()) { + return false; + } + $value = $this->current(); + $this->nextAndRemove(); + return $value; + } + + /** + * Remove an item from the queue + * + * This is different than {@link extract()}; its purpose is to dequeue an + * item. + * + * Note: this removes the first item matching the provided item found. If + * the same item has been added multiple times, it will not remove other + * instances. + * + * @return bool False if the item was not found, true otherwise. + */ + public function remove(mixed $datum) + { + $currentIndex = $this->index; + $currentSubIndex = $this->subIndex; + $currentPriority = $this->maxPriority; + + $this->rewind(); + while ($this->valid()) { + if (current($this->values[$this->maxPriority]) === $datum) { + $index = key($this->values[$this->maxPriority]); + unset($this->values[$this->maxPriority][$index]); + + // The `next()` method advances the internal array pointer, so we need to use the `reset()` function, + // otherwise we would lose all elements before the place the pointer points. + reset($this->values[$this->maxPriority]); + + $this->index = $currentIndex; + $this->subIndex = $currentSubIndex; + + // If the array is empty we need to destroy the unnecessary priority, + // otherwise we would end up with an incorrect value of `$this->count` + // {@see \Laminas\Stdlib\FastPriorityQueue::nextAndRemove()}. + if (empty($this->values[$this->maxPriority])) { + unset($this->values[$this->maxPriority]); + unset($this->priorities[$this->maxPriority]); + if ($this->maxPriority === $currentPriority) { + $this->subIndex = 0; + } + } + + $this->maxPriority = empty($this->priorities) ? null : max($this->priorities); + --$this->count; + return true; + } + $this->next(); + } + return false; + } + + /** + * Get the total number of elements in the queue + * + * @return int + */ + #[ReturnTypeWillChange] + public function count() + { + return $this->count; + } + + /** + * Get the current element in the queue + * + * @return TValue|int|array{data: TValue|false, priority: int|null}|false + */ + #[ReturnTypeWillChange] + public function current() + { + switch ($this->extractFlag) { + case self::EXTR_DATA: + return current($this->values[$this->maxPriority]); + case self::EXTR_PRIORITY: + return $this->maxPriority; + case self::EXTR_BOTH: + return [ + 'data' => current($this->values[$this->maxPriority]), + 'priority' => $this->maxPriority, + ]; + } + } + + /** + * Get the index of the current element in the queue + * + * @return int + */ + #[ReturnTypeWillChange] + public function key() + { + return $this->index; + } + + /** + * Set the iterator pointer to the next element in the queue + * removing the previous element + * + * @return void + */ + protected function nextAndRemove() + { + $key = key($this->values[$this->maxPriority]); + + if (false === next($this->values[$this->maxPriority])) { + unset($this->priorities[$this->maxPriority]); + unset($this->values[$this->maxPriority]); + $this->maxPriority = empty($this->priorities) ? null : max($this->priorities); + $this->subIndex = -1; + } else { + unset($this->values[$this->maxPriority][$key]); + } + ++$this->index; + ++$this->subIndex; + --$this->count; + } + + /** + * Set the iterator pointer to the next element in the queue + * without removing the previous element + */ + #[ReturnTypeWillChange] + public function next() + { + if (false === next($this->values[$this->maxPriority])) { + unset($this->subPriorities[$this->maxPriority]); + reset($this->values[$this->maxPriority]); + $this->maxPriority = empty($this->subPriorities) ? null : max($this->subPriorities); + $this->subIndex = -1; + } + ++$this->index; + ++$this->subIndex; + } + + /** + * Check if the current iterator is valid + * + * @return bool + */ + #[ReturnTypeWillChange] + public function valid() + { + return isset($this->values[$this->maxPriority]); + } + + /** + * Rewind the current iterator + */ + #[ReturnTypeWillChange] + public function rewind() + { + $this->subPriorities = $this->priorities; + $this->maxPriority = empty($this->priorities) ? 0 : max($this->priorities); + $this->index = 0; + $this->subIndex = 0; + } + + /** + * Serialize to an array + * + * Array will be priority => data pairs + * + * @return list + */ + public function toArray() + { + $array = []; + foreach (clone $this as $item) { + $array[] = $item; + } + return $array; + } + + /** + * Serialize + * + * @return string + */ + public function serialize() + { + return serialize($this->__serialize()); + } + + /** + * Deserialize + * + * @param string $data + * @return void + */ + public function unserialize($data) + { + $toUnserialize = unserialize($data); + if (! is_array($toUnserialize)) { + throw new UnexpectedValueException(sprintf( + 'Cannot deserialize %s instance; corrupt serialization data', + self::class + )); + } + + $this->__unserialize($toUnserialize); + } + + /** + * Set the extract flag + * + * @param self::EXTR_* $flag + * @return void + */ + public function setExtractFlags($flag) + { + $this->extractFlag = match ($flag) { + self::EXTR_DATA, self::EXTR_PRIORITY, self::EXTR_BOTH => $flag, + default => throw new Exception\InvalidArgumentException("The extract flag specified is not valid"), + }; + } + + /** + * Check if the queue is empty + * + * @return bool + */ + public function isEmpty() + { + return empty($this->values); + } + + /** + * Does the queue contain the given datum? + * + * @return bool + */ + public function contains(mixed $datum) + { + foreach ($this->values as $values) { + if (in_array($datum, $values)) { + return true; + } + } + return false; + } + + /** + * Does the queue have an item with the given priority? + * + * @param int $priority + * @return bool + */ + public function hasPriority($priority) + { + return isset($this->values[$priority]); + } +} diff --git a/vendor/laminas/laminas-stdlib/src/Glob.php b/vendor/laminas/laminas-stdlib/src/Glob.php new file mode 100644 index 00000000..5b5be710 --- /dev/null +++ b/vendor/laminas/laminas-stdlib/src/Glob.php @@ -0,0 +1,226 @@ + GLOB_MARK, + self::GLOB_NOSORT => GLOB_NOSORT, + self::GLOB_NOCHECK => GLOB_NOCHECK, + self::GLOB_NOESCAPE => GLOB_NOESCAPE, + self::GLOB_BRACE => defined('GLOB_BRACE') ? GLOB_BRACE : 0, + self::GLOB_ONLYDIR => GLOB_ONLYDIR, + self::GLOB_ERR => GLOB_ERR, + ]; + + $globFlags = 0; + + foreach ($flagMap as $internalFlag => $globFlag) { + if ($flags & $internalFlag) { + $globFlags |= $globFlag; + } + } + } else { + $globFlags = 0; + } + + ErrorHandler::start(); + $res = glob($pattern, $globFlags); + $err = ErrorHandler::stop(); + if ($res === false) { + throw new Exception\RuntimeException("glob('{$pattern}', {$globFlags}) failed", 0, $err); + } + return $res; + } + + /** + * Expand braces manually, then use the system glob. + * + * @param string $pattern + * @param int $flags + * @return array + * @throws Exception\RuntimeException + */ + protected static function fallbackGlob($pattern, $flags) + { + if (! self::flagsIsEqualTo($flags, self::GLOB_BRACE)) { + return static::systemGlob($pattern, $flags); + } + + $flags &= ~self::GLOB_BRACE; + $length = strlen($pattern); + $paths = []; + + if ($flags & self::GLOB_NOESCAPE) { + $begin = strpos($pattern, '{'); + } else { + $begin = 0; + + while (true) { + if ($begin === $length) { + $begin = false; + break; + } elseif ($pattern[$begin] === '\\' && ($begin + 1) < $length) { + $begin++; + } elseif ($pattern[$begin] === '{') { + break; + } + + $begin++; + } + } + + if ($begin === false) { + return static::systemGlob($pattern, $flags); + } + + $next = static::nextBraceSub($pattern, $begin + 1, $flags); + + if ($next === null) { + return static::systemGlob($pattern, $flags); + } + + $rest = $next; + + while ($pattern[$rest] !== '}') { + $rest = static::nextBraceSub($pattern, $rest + 1, $flags); + + if ($rest === null) { + return static::systemGlob($pattern, $flags); + } + } + + $p = $begin + 1; + + while (true) { + $subPattern = substr($pattern, 0, $begin) + . substr($pattern, $p, $next - $p) + . substr($pattern, $rest + 1); + + $result = static::fallbackGlob($subPattern, $flags | self::GLOB_BRACE); + + if ($result) { + $paths = array_merge($paths, $result); + } + + if ($pattern[$next] === '}') { + break; + } + + $p = $next + 1; + $next = static::nextBraceSub($pattern, $p, $flags); + } + + return array_unique($paths); + } + + /** + * Find the end of the sub-pattern in a brace expression. + * + * @param string $pattern + * @param int $begin + * @param int $flags + * @return int|null + */ + protected static function nextBraceSub($pattern, $begin, $flags) + { + $length = strlen($pattern); + $depth = 0; + $current = $begin; + + while ($current < $length) { + $flagsEqualsNoEscape = self::flagsIsEqualTo($flags, self::GLOB_NOESCAPE); + + if ($flagsEqualsNoEscape && $pattern[$current] === '\\') { + if (++$current === $length) { + break; + } + + $current++; + } else { + if ( + ($pattern[$current] === '}' && $depth-- === 0) + || ($pattern[$current] === ',' && $depth === 0) + ) { + break; + } elseif ($pattern[$current++] === '{') { + $depth++; + } + } + } + + return $current < $length ? $current : null; + } + + /** @internal */ + public static function flagsIsEqualTo(int $flags, int $otherFlags): bool + { + return (bool) ($flags & $otherFlags); + } +} diff --git a/vendor/laminas/laminas-stdlib/src/Guard/AllGuardsTrait.php b/vendor/laminas/laminas-stdlib/src/Guard/AllGuardsTrait.php new file mode 100644 index 00000000..b5abe5a6 --- /dev/null +++ b/vendor/laminas/laminas-stdlib/src/Guard/AllGuardsTrait.php @@ -0,0 +1,15 @@ +metadata[$spec] = $value; + return $this; + } + if (! is_array($spec) && ! $spec instanceof Traversable) { + throw new Exception\InvalidArgumentException(sprintf( + 'Expected a string, array, or Traversable argument in first position; received "%s"', + get_debug_type($spec) + )); + } + foreach ($spec as $key => $value) { + $this->metadata[$key] = $value; + } + return $this; + } + + /** + * Retrieve all metadata or a single metadatum as specified by key + * + * @param null|string|int $key + * @param null|mixed $default + * @throws Exception\InvalidArgumentException + * @return mixed + */ + public function getMetadata($key = null, $default = null) + { + if (null === $key) { + return $this->metadata; + } + + if (! is_scalar($key)) { + throw new Exception\InvalidArgumentException('Non-scalar argument provided for key'); + } + + if (array_key_exists($key, $this->metadata)) { + return $this->metadata[$key]; + } + + return $default; + } + + /** + * Set message content + * + * @param mixed $value + * @return Message + */ + public function setContent($value) + { + $this->content = $value; + return $this; + } + + /** + * Get message content + * + * @return mixed + */ + public function getContent() + { + return $this->content; + } + + /** + * @return string + */ + public function toString() + { + $request = ''; + foreach ($this->getMetadata() as $key => $value) { + $request .= sprintf( + "%s: %s\r\n", + (string) $key, + (string) $value + ); + } + $request .= "\r\n" . $this->getContent(); + return $request; + } +} diff --git a/vendor/laminas/laminas-stdlib/src/MessageInterface.php b/vendor/laminas/laminas-stdlib/src/MessageInterface.php new file mode 100644 index 00000000..71a48208 --- /dev/null +++ b/vendor/laminas/laminas-stdlib/src/MessageInterface.php @@ -0,0 +1,41 @@ + + * @template-implements ParametersInterface + */ +class Parameters extends PhpArrayObject implements ParametersInterface +{ + /** + * Constructor + * + * Enforces that we have an array, and enforces parameter access to array + * elements. + * + * @param array|null $values + */ + public function __construct(?array $values = null) + { + if (null === $values) { + $values = []; + } + parent::__construct($values, ArrayObject::ARRAY_AS_PROPS); + } + + /** + * Populate from native PHP array + * + * @param array $values + * @return void + */ + public function fromArray(array $values) + { + $this->exchangeArray($values); + } + + /** + * Populate from query string + * + * @param string $string + * @return void + */ + public function fromString($string) + { + $array = []; + parse_str($string, $array); + $this->fromArray($array); + } + + /** + * Serialize to native PHP array + * + * @return array + */ + public function toArray() + { + return $this->getArrayCopy(); + } + + /** + * Serialize to query string + * + * @return string + */ + public function toString() + { + return http_build_query($this->toArray()); + } + + /** + * Retrieve by key + * + * Returns null if the key does not exist. + * + * @param TKey $name + * @return TValue|null + */ + #[ReturnTypeWillChange] + public function offsetGet($name) + { + if ($this->offsetExists($name)) { + return parent::offsetGet($name); + } + + return null; + } + + /** + * @template TDefault + * @param TKey $name + * @param TDefault $default optional default value + * @return TValue|TDefault|null + */ + public function get($name, $default = null) + { + if ($this->offsetExists($name)) { + return parent::offsetGet($name); + } + return $default; + } + + /** + * @param TKey $name + * @param TValue $value + * @return $this + */ + public function set($name, $value) + { + $this[$name] = $value; + return $this; + } +} diff --git a/vendor/laminas/laminas-stdlib/src/ParametersInterface.php b/vendor/laminas/laminas-stdlib/src/ParametersInterface.php new file mode 100644 index 00000000..9b9a0c4c --- /dev/null +++ b/vendor/laminas/laminas-stdlib/src/ParametersInterface.php @@ -0,0 +1,82 @@ + + * @template-extends Traversable + */ +interface ParametersInterface extends ArrayAccess, Countable, Serializable, Traversable +{ + /** + * Constructor + * + * @param array|null $values + */ + public function __construct(?array $values = null); + + /** + * From array + * + * Allow deserialization from standard array + * + * @param array $values + * @return mixed + */ + public function fromArray(array $values); + + /** + * From string + * + * Allow deserialization from raw body; e.g., for PUT requests + * + * @param string $string + * @return mixed + */ + public function fromString($string); + + /** + * To array + * + * Allow serialization back to standard array + * + * @return array + */ + public function toArray(); + + /** + * To string + * + * Allow serialization to query format; e.g., for PUT or POST requests + * + * @return string + */ + public function toString(); + + /** + * @param TKey $name + * @param TValue|null $default + * @return mixed + */ + public function get($name, $default = null); + + /** + * @param TKey $name + * @param TValue $value + * @return ParametersInterface + */ + public function set($name, $value); +} diff --git a/vendor/laminas/laminas-stdlib/src/PriorityList.php b/vendor/laminas/laminas-stdlib/src/PriorityList.php new file mode 100644 index 00000000..8e2c6e53 --- /dev/null +++ b/vendor/laminas/laminas-stdlib/src/PriorityList.php @@ -0,0 +1,287 @@ + + */ +class PriorityList implements Iterator, Countable +{ + public const EXTR_DATA = 0x00000001; + public const EXTR_PRIORITY = 0x00000002; + public const EXTR_BOTH = 0x00000003; + + /** + * Internal list of all items. + * + * @var array + */ + protected $items = []; + + /** + * Serial assigned to items to preserve LIFO. + * + * @var positive-int|0 + */ + protected $serial = 0; + + // phpcs:disable WebimpressCodingStandard.NamingConventions.ValidVariableName.NotCamelCapsProperty + + /** + * Serial order mode + * + * @var integer + */ + protected $isLIFO = 1; + + // phpcs:enable + + /** + * Internal counter to avoid usage of count(). + * + * @var int + */ + protected $count = 0; + + /** + * Whether the list was already sorted. + * + * @var bool + */ + protected $sorted = false; + + /** + * Insert a new item. + * + * @param TKey $name + * @param TValue $value + * @param int $priority + * @return void + */ + public function insert($name, mixed $value, $priority = 0) + { + if (! isset($this->items[$name])) { + $this->count++; + } + + $this->sorted = false; + + $this->items[$name] = [ + 'data' => $value, + 'priority' => (int) $priority, + 'serial' => $this->serial++, + ]; + } + + /** + * @param TKey $name + * @param int $priority + * @return $this + * @throws Exception + */ + public function setPriority($name, $priority) + { + if (! isset($this->items[$name])) { + throw new Exception("item $name not found"); + } + + $this->items[$name]['priority'] = (int) $priority; + $this->sorted = false; + + return $this; + } + + /** + * Remove a item. + * + * @param TKey $name + * @return void + */ + public function remove($name) + { + if (isset($this->items[$name])) { + $this->count--; + } + + unset($this->items[$name]); + } + + /** + * Remove all items. + * + * @return void + */ + public function clear() + { + $this->items = []; + $this->serial = 0; + $this->count = 0; + $this->sorted = false; + } + + /** + * Get a item. + * + * @param TKey $name + * @return TValue|null + */ + public function get($name) + { + if (! isset($this->items[$name])) { + return; + } + + return $this->items[$name]['data']; + } + + /** + * Sort all items. + * + * @return void + */ + protected function sort() + { + if (! $this->sorted) { + uasort($this->items, [$this, 'compare']); + $this->sorted = true; + } + } + + /** + * Compare the priority of two items. + * + * @param array $item1, + * @return int + */ + protected function compare(array $item1, array $item2) + { + return $item1['priority'] === $item2['priority'] + ? ($item1['serial'] > $item2['serial'] ? -1 : 1) * $this->isLIFO + : ($item1['priority'] > $item2['priority'] ? -1 : 1); + } + + /** + * Get/Set serial order mode + * + * @param bool|null $flag + * @return bool + */ + public function isLIFO($flag = null) + { + if ($flag !== null) { + $isLifo = $flag === true ? 1 : -1; + + if ($isLifo !== $this->isLIFO) { + $this->isLIFO = $isLifo; + $this->sorted = false; + } + } + + return 1 === $this->isLIFO; + } + + /** + * {@inheritDoc} + */ + #[ReturnTypeWillChange] + public function rewind() + { + $this->sort(); + reset($this->items); + } + + /** + * {@inheritDoc} + */ + #[ReturnTypeWillChange] + public function current() + { + $this->sorted || $this->sort(); + $node = current($this->items); + + return $node ? $node['data'] : false; + } + + /** + * {@inheritDoc} + */ + #[ReturnTypeWillChange] + public function key() + { + $this->sorted || $this->sort(); + return key($this->items); + } + + /** + * {@inheritDoc} + */ + #[ReturnTypeWillChange] + public function next() + { + $node = next($this->items); + + return $node ? $node['data'] : false; + } + + /** + * {@inheritDoc} + */ + #[ReturnTypeWillChange] + public function valid() + { + return current($this->items) !== false; + } + + /** + * @return self + */ + public function getIterator() + { + return clone $this; + } + + /** + * {@inheritDoc} + */ + #[ReturnTypeWillChange] + public function count() + { + return $this->count; + } + + /** + * Return list as array + * + * @param int $flag + * @return array + */ + public function toArray($flag = self::EXTR_DATA) + { + $this->sort(); + + if ($flag === self::EXTR_BOTH) { + return $this->items; + } + + return array_map( + static fn($item) => $flag === self::EXTR_PRIORITY ? $item['priority'] : $item['data'], + $this->items + ); + } +} diff --git a/vendor/laminas/laminas-stdlib/src/PriorityQueue.php b/vendor/laminas/laminas-stdlib/src/PriorityQueue.php new file mode 100644 index 00000000..b4258023 --- /dev/null +++ b/vendor/laminas/laminas-stdlib/src/PriorityQueue.php @@ -0,0 +1,379 @@ + + */ +class PriorityQueue implements Countable, IteratorAggregate, Serializable +{ + public const EXTR_DATA = 0x00000001; + public const EXTR_PRIORITY = 0x00000002; + public const EXTR_BOTH = 0x00000003; + + /** + * Inner queue class to use for iteration + * + * @var class-string<\SplPriorityQueue> + */ + protected $queueClass = SplPriorityQueue::class; + + /** + * Actual items aggregated in the priority queue. Each item is an array + * with keys "data" and "priority". + * + * @var list + */ + protected $items = []; + + /** + * Inner queue object + * + * @var \SplPriorityQueue|null + */ + protected $queue; + + /** + * Insert an item into the queue + * + * Priority defaults to 1 (low priority) if none provided. + * + * @param TValue $data + * @param TPriority $priority + * @return $this + */ + public function insert($data, $priority = 1) + { + /** @psalm-var TPriority $priority */ + $priority = (int) $priority; + $this->items[] = [ + 'data' => $data, + 'priority' => $priority, + ]; + $this->getQueue()->insert($data, $priority); + return $this; + } + + /** + * Remove an item from the queue + * + * This is different than {@link extract()}; its purpose is to dequeue an + * item. + * + * This operation is potentially expensive, as it requires + * re-initialization and re-population of the inner queue. + * + * Note: this removes the first item matching the provided item found. If + * the same item has been added multiple times, it will not remove other + * instances. + * + * @return bool False if the item was not found, true otherwise. + */ + public function remove(mixed $datum) + { + $found = false; + $key = null; + foreach ($this->items as $key => $item) { + if ($item['data'] === $datum) { + $found = true; + break; + } + } + if ($found && $key !== null) { + unset($this->items[$key]); + $this->queue = null; + + if (! $this->isEmpty()) { + $queue = $this->getQueue(); + foreach ($this->items as $item) { + $queue->insert($item['data'], $item['priority']); + } + } + return true; + } + return false; + } + + /** + * Is the queue empty? + * + * @return bool + */ + public function isEmpty() + { + return 0 === $this->count(); + } + + /** + * How many items are in the queue? + * + * @return int + */ + #[ReturnTypeWillChange] + public function count() + { + return count($this->items); + } + + /** + * Peek at the top node in the queue, based on priority. + * + * @return TValue + */ + public function top() + { + $queue = clone $this->getQueue(); + + return $queue->top(); + } + + /** + * Extract a node from the inner queue and sift up + * + * @return TValue + */ + public function extract() + { + $value = $this->getQueue()->extract(); + + $keyToRemove = null; + $highestPriority = null; + foreach ($this->items as $key => $item) { + if ($item['data'] !== $value) { + continue; + } + + if (null === $highestPriority) { + $highestPriority = $item['priority']; + $keyToRemove = $key; + continue; + } + + if ($highestPriority >= $item['priority']) { + continue; + } + + $highestPriority = $item['priority']; + $keyToRemove = $key; + } + + if ($keyToRemove !== null) { + unset($this->items[$keyToRemove]); + } + + return $value; + } + + /** + * Retrieve the inner iterator + * + * SplPriorityQueue acts as a heap, which typically implies that as items + * are iterated, they are also removed. This does not work for situations + * where the queue may be iterated multiple times. As such, this class + * aggregates the values, and also injects an SplPriorityQueue. This method + * retrieves the inner queue object, and clones it for purposes of + * iteration. + * + * @return \SplPriorityQueue + */ + #[ReturnTypeWillChange] + public function getIterator() + { + $queue = $this->getQueue(); + return clone $queue; + } + + /** + * Serialize the data structure + * + * @return string + */ + public function serialize() + { + return serialize($this->__serialize()); + } + + /** + * Magic method used for serializing of an instance. + * + * @return list + */ + public function __serialize() + { + return $this->items; + } + + /** + * Unserialize a string into a PriorityQueue object + * + * Serialization format is compatible with {@link SplPriorityQueue} + * + * @param string $data + * @return void + */ + public function unserialize($data) + { + $toUnserialize = unserialize($data); + if (! is_array($toUnserialize)) { + throw new UnexpectedValueException(sprintf( + 'Cannot deserialize %s instance; corrupt serialization data', + self::class + )); + } + + /** @psalm-var list $toUnserialize */ + + $this->__unserialize($toUnserialize); + } + + /** + * Magic method used to rebuild an instance. + * + * @param list $data Data array. + * @return void + */ + public function __unserialize($data) + { + foreach ($data as $item) { + $this->insert($item['data'], $item['priority']); + } + } + + /** + * Serialize to an array + * By default, returns only the item data, and in the order registered (not + * sorted). You may provide one of the EXTR_* flags as an argument, allowing + * the ability to return priorities or both data and priority. + * + * @param int $flag + * @return array + * @psalm-return ($flag is self::EXTR_BOTH + * ? list + * : $flag is self::EXTR_PRIORITY + * ? list + * : list + * ) + */ + public function toArray($flag = self::EXTR_DATA) + { + return match ($flag) { + self::EXTR_BOTH => $this->items, + self::EXTR_PRIORITY => array_map(static fn($item): int => $item['priority'], $this->items), + default => array_map(static fn($item): mixed => $item['data'], $this->items), + }; + } + + /** + * Specify the internal queue class + * + * Please see {@link getIterator()} for details on the necessity of an + * internal queue class. The class provided should extend SplPriorityQueue. + * + * @param class-string<\SplPriorityQueue> $class + * @return $this + */ + public function setInternalQueueClass($class) + { + /** @psalm-suppress RedundantCastGivenDocblockType */ + $this->queueClass = (string) $class; + return $this; + } + + /** + * Does the queue contain the given datum? + * + * @param TValue $datum + * @return bool + */ + public function contains($datum) + { + foreach ($this->items as $item) { + if ($item['data'] === $datum) { + return true; + } + } + return false; + } + + /** + * Does the queue have an item with the given priority? + * + * @param TPriority $priority + * @return bool + */ + public function hasPriority($priority) + { + foreach ($this->items as $item) { + if ($item['priority'] === $priority) { + return true; + } + } + return false; + } + + /** + * Get the inner priority queue instance + * + * @throws Exception\DomainException + * @return \SplPriorityQueue + * @psalm-assert !null $this->queue + */ + protected function getQueue() + { + if (null === $this->queue) { + /** @psalm-suppress UnsafeInstantiation */ + $queue = new $this->queueClass(); + /** @psalm-var \SplPriorityQueue $queue */ + $this->queue = $queue; + /** @psalm-suppress DocblockTypeContradiction */ + if (! $this->queue instanceof \SplPriorityQueue) { + throw new Exception\DomainException(sprintf( + 'PriorityQueue expects an internal queue of type SplPriorityQueue; received "%s"', + $queue::class + )); + } + } + + return $this->queue; + } + + /** + * Add support for deep cloning + * + * @return void + */ + public function __clone() + { + if (null !== $this->queue) { + $this->queue = clone $this->queue; + } + } +} diff --git a/vendor/laminas/laminas-stdlib/src/Request.php b/vendor/laminas/laminas-stdlib/src/Request.php new file mode 100644 index 00000000..65026f60 --- /dev/null +++ b/vendor/laminas/laminas-stdlib/src/Request.php @@ -0,0 +1,10 @@ + + */ +class SplPriorityQueue extends \SplPriorityQueue implements Serializable +{ + /** @var int Seed used to ensure queue order for items of the same priority */ + protected $serial = PHP_INT_MAX; + + /** + * Insert a value with a given priority + * + * Utilizes {@var $serial} to ensure that values of equal priority are + * emitted in the same order in which they are inserted. + * + * @param TValue $value + * @param TPriority $priority + * @return void + */ + #[ReturnTypeWillChange] // Inherited return type should be bool + public function insert($value, $priority) + { + if (! is_array($priority)) { + $priority = [$priority, $this->serial--]; + } + + parent::insert($value, $priority); + } + + /** + * Serialize to an array + * + * Array will be priority => data pairs + * + * @return list + */ + public function toArray() + { + $array = []; + foreach (clone $this as $item) { + $array[] = $item; + } + return $array; + } + + /** + * Serialize + * + * @return string + */ + public function serialize() + { + return serialize($this->__serialize()); + } + + /** + * Magic method used for serializing of an instance. + * + * @return array + */ + public function __serialize() + { + $clone = clone $this; + $clone->setExtractFlags(self::EXTR_BOTH); + + $data = []; + foreach ($clone as $item) { + $data[] = $item; + } + return $data; + } + + /** + * Deserialize + * + * @param string $data + * @return void + */ + public function unserialize($data) + { + $toUnserialize = unserialize($data); + if (! is_array($toUnserialize)) { + throw new UnexpectedValueException(sprintf( + 'Cannot deserialize %s instance; corrupt serialization data', + self::class + )); + } + + $this->__unserialize($toUnserialize); + } + + /** + * Magic method used to rebuild an instance. + * + * @param array $data Data array. + * @return void + */ + public function __unserialize($data) + { + $this->serial = PHP_INT_MAX; + + foreach ($data as $item) { + if (! is_array($item)) { + throw new UnexpectedValueException(sprintf( + 'Cannot deserialize %s instance: corrupt item; expected array, received %s', + self::class, + get_debug_type($item) + )); + } + + if (! array_key_exists('data', $item)) { + throw new UnexpectedValueException(sprintf( + 'Cannot deserialize %s instance: corrupt item; missing "data" element', + self::class + )); + } + + $priority = 1; + if (array_key_exists('priority', $item)) { + $priority = (int) $item['priority']; + } + + $this->insert($item['data'], $priority); + } + } +} diff --git a/vendor/laminas/laminas-stdlib/src/SplQueue.php b/vendor/laminas/laminas-stdlib/src/SplQueue.php new file mode 100644 index 00000000..2656a856 --- /dev/null +++ b/vendor/laminas/laminas-stdlib/src/SplQueue.php @@ -0,0 +1,94 @@ + + */ +class SplQueue extends \SplQueue implements Serializable +{ + /** + * Return an array representing the queue + * + * @return list + */ + public function toArray() + { + $array = []; + foreach ($this as $item) { + $array[] = $item; + } + return $array; + } + + /** + * Serialize + * + * @return string + */ + #[ReturnTypeWillChange] + public function serialize() + { + return serialize($this->__serialize()); + } + + /** + * Magic method used for serializing of an instance. + * + * @return list + */ + #[ReturnTypeWillChange] + public function __serialize() + { + return $this->toArray(); + } + + /** + * Unserialize + * + * @param string $data + * @return void + */ + #[ReturnTypeWillChange] + public function unserialize($data) + { + $toUnserialize = unserialize($data); + if (! is_array($toUnserialize)) { + throw new UnexpectedValueException(sprintf( + 'Cannot deserialize %s instance; corrupt serialization data', + self::class + )); + } + + $this->__unserialize($toUnserialize); + } + + /** + * Magic method used to rebuild an instance. + * + * @param array $data Data array. + * @return void + */ + #[ReturnTypeWillChange] + public function __unserialize($data) + { + foreach ($data as $item) { + $this->push($item); + } + } +} diff --git a/vendor/laminas/laminas-stdlib/src/SplStack.php b/vendor/laminas/laminas-stdlib/src/SplStack.php new file mode 100644 index 00000000..52564fde --- /dev/null +++ b/vendor/laminas/laminas-stdlib/src/SplStack.php @@ -0,0 +1,93 @@ + + */ +class SplStack extends \SplStack implements Serializable +{ + /** + * Serialize to an array representing the stack + * + * @return list + */ + public function toArray() + { + $array = []; + foreach ($this as $item) { + $array[] = $item; + } + return $array; + } + + /** + * Serialize + * + * @return string + */ + #[ReturnTypeWillChange] + public function serialize() + { + return serialize($this->__serialize()); + } + + /** + * Magic method used for serializing of an instance. + * + * @return list + */ + #[ReturnTypeWillChange] + public function __serialize() + { + return $this->toArray(); + } + + /** + * Unserialize + * + * @param string $data + * @return void + */ + #[ReturnTypeWillChange] + public function unserialize($data) + { + $toUnserialize = unserialize($data); + if (! is_array($toUnserialize)) { + throw new UnexpectedValueException(sprintf( + 'Cannot deserialize %s instance; corrupt serialization data', + self::class + )); + } + + $this->__unserialize($toUnserialize); + } + + /** + * Magic method used to rebuild an instance. + * + * @param array $data Data array. + * @return void + */ + #[ReturnTypeWillChange] + public function __unserialize($data) + { + foreach ($data as $item) { + $this->unshift($item); + } + } +} diff --git a/vendor/laminas/laminas-stdlib/src/StringUtils.php b/vendor/laminas/laminas-stdlib/src/StringUtils.php new file mode 100644 index 00000000..ffc3ad55 --- /dev/null +++ b/vendor/laminas/laminas-stdlib/src/StringUtils.php @@ -0,0 +1,213 @@ +>|null + */ + protected static $wrapperRegistry; + + /** + * A list of known single-byte character encodings (upper-case) + * + * @var string[] + */ + protected static $singleByteEncodings = [ + 'ASCII', + '7BIT', + '8BIT', + 'ISO-8859-1', + 'ISO-8859-2', + 'ISO-8859-3', + 'ISO-8859-4', + 'ISO-8859-5', + 'ISO-8859-6', + 'ISO-8859-7', + 'ISO-8859-8', + 'ISO-8859-9', + 'ISO-8859-10', + 'ISO-8859-11', + 'ISO-8859-13', + 'ISO-8859-14', + 'ISO-8859-15', + 'ISO-8859-16', + 'CP-1251', + 'CP-1252', + // TODO + ]; + + /** + * Is PCRE compiled with Unicode support? + * + * @var bool + **/ + protected static $hasPcreUnicodeSupport; + + /** + * Get registered wrapper classes + * + * @return string[] + * @psalm-return list> + */ + public static function getRegisteredWrappers() + { + if (static::$wrapperRegistry === null) { + static::$wrapperRegistry = []; + + if (extension_loaded('intl')) { + static::$wrapperRegistry[] = Intl::class; + } + + if (extension_loaded('mbstring')) { + static::$wrapperRegistry[] = MbString::class; + } + + if (extension_loaded('iconv')) { + static::$wrapperRegistry[] = Iconv::class; + } + + static::$wrapperRegistry[] = Native::class; + } + + return static::$wrapperRegistry; + } + + /** + * Register a string wrapper class + * + * @param class-string $wrapper + * @return void + */ + public static function registerWrapper($wrapper) + { + $wrapper = (string) $wrapper; + // using getRegisteredWrappers() here to ensure that the list is initialized + if (! in_array($wrapper, static::getRegisteredWrappers(), true)) { + static::$wrapperRegistry[] = $wrapper; + } + } + + /** + * Unregister a string wrapper class + * + * @param class-string $wrapper + * @return void + */ + public static function unregisterWrapper($wrapper) + { + // using getRegisteredWrappers() here to ensure that the list is initialized + $index = array_search((string) $wrapper, static::getRegisteredWrappers(), true); + if ($index !== false) { + unset(static::$wrapperRegistry[$index]); + } + } + + /** + * Reset all registered wrappers so the default wrappers will be used + * + * @return void + */ + public static function resetRegisteredWrappers() + { + static::$wrapperRegistry = null; + } + + /** + * Get the first string wrapper supporting the given character encoding + * and supports to convert into the given convert encoding. + * + * @param string $encoding Character encoding to support + * @param string|null $convertEncoding OPTIONAL character encoding to convert in + * @return StringWrapperInterface + * @throws Exception\RuntimeException If no wrapper supports given character encodings. + */ + public static function getWrapper($encoding = 'UTF-8', $convertEncoding = null) + { + foreach (static::getRegisteredWrappers() as $wrapperClass) { + if ($wrapperClass::isSupported($encoding, $convertEncoding)) { + $wrapper = new $wrapperClass($encoding, $convertEncoding); + $wrapper->setEncoding($encoding, $convertEncoding); + return $wrapper; + } + } + + throw new Exception\RuntimeException( + 'No wrapper found supporting "' . $encoding . '"' + . ($convertEncoding !== null ? ' and "' . $convertEncoding . '"' : '') + ); + } + + /** + * Get a list of all known single-byte character encodings + * + * @return string[] + */ + public static function getSingleByteEncodings() + { + return static::$singleByteEncodings; + } + + /** + * Check if a given encoding is a known single-byte character encoding + * + * @param string $encoding + * @return bool + */ + public static function isSingleByteEncoding($encoding) + { + return in_array(strtoupper($encoding), static::$singleByteEncodings); + } + + /** + * Check if a given string is valid UTF-8 encoded + * + * @param string $str + * @return bool + */ + public static function isValidUtf8($str) + { + return is_string($str) && ($str === '' || preg_match('/^./su', $str) === 1); + } + + /** + * Is PCRE compiled with Unicode support? + * + * @return bool + */ + public static function hasPcreUnicodeSupport() + { + if (static::$hasPcreUnicodeSupport === null) { + ErrorHandler::start(); + static::$hasPcreUnicodeSupport = defined('PREG_BAD_UTF8_OFFSET_ERROR') && preg_match('/\pL/u', 'a') === 1; + ErrorHandler::stop(); + } + return static::$hasPcreUnicodeSupport; + } +} diff --git a/vendor/laminas/laminas-stdlib/src/StringWrapper/AbstractStringWrapper.php b/vendor/laminas/laminas-stdlib/src/StringWrapper/AbstractStringWrapper.php new file mode 100644 index 00000000..a96c7a46 --- /dev/null +++ b/vendor/laminas/laminas-stdlib/src/StringWrapper/AbstractStringWrapper.php @@ -0,0 +1,278 @@ +convertEncoding = $convertEncodingUpper; + } else { + $this->convertEncoding = null; + } + $this->encoding = $encodingUpper; + + return $this; + } + + /** + * Get the defined character encoding to work with + * + * @return null|string + * @throws Exception\LogicException If no encoding was defined. + */ + public function getEncoding() + { + return $this->encoding; + } + + /** + * Get the defined character encoding to convert to + * + * @return string|null + */ + public function getConvertEncoding() + { + return $this->convertEncoding; + } + + /** + * Convert a string from defined character encoding to the defined convert encoding + * + * @param string $str + * @param bool $reverse + * @return string|false + */ + public function convert($str, $reverse = false) + { + $encoding = $this->getEncoding(); + $convertEncoding = $this->getConvertEncoding(); + if ($convertEncoding === null) { + throw new Exception\LogicException( + 'No convert encoding defined' + ); + } + + if ($encoding === $convertEncoding) { + return $str; + } + + $from = $reverse ? $convertEncoding : $encoding; + $to = $reverse ? $encoding : $convertEncoding; + throw new Exception\RuntimeException(sprintf( + 'Converting from "%s" to "%s" isn\'t supported by this string wrapper', + $from ?? '', + $to ?? '' + )); + } + + /** + * Wraps a string to a given number of characters + * + * @param string $string + * @param int $width + * @param string $break + * @param bool $cut + * @return string|false + */ + public function wordWrap($string, $width = 75, $break = "\n", $cut = false) + { + $string = (string) $string; + if ($string === '') { + return ''; + } + + $break = (string) $break; + if ($break === '') { + throw new Exception\InvalidArgumentException('Break string cannot be empty'); + } + + $width = (int) $width; + if ($width === 0 && $cut) { + throw new Exception\InvalidArgumentException('Cannot force cut when width is zero'); + } + + if (null === $this->getEncoding() || StringUtils::isSingleByteEncoding($this->getEncoding())) { + return wordwrap($string, $width, $break, $cut); + } + + $stringWidth = $this->strlen($string); + $breakWidth = $this->strlen($break); + + $result = ''; + $lastStart = $lastSpace = 0; + + for ($current = 0; $current < $stringWidth; $current++) { + $char = $this->substr($string, $current, 1); + + $possibleBreak = $char; + if ($breakWidth !== 1) { + $possibleBreak = $this->substr($string, $current, $breakWidth); + } + + if ($possibleBreak === $break) { + $result .= $this->substr($string, $lastStart, $current - $lastStart + $breakWidth); + $current += $breakWidth - 1; + $lastStart = $lastSpace = $current + 1; + continue; + } + + if ($char === ' ') { + if ($current - $lastStart >= $width) { + $result .= $this->substr($string, $lastStart, $current - $lastStart) . $break; + $lastStart = $current + 1; + } + + $lastSpace = $current; + continue; + } + + if ($current - $lastStart >= $width && $cut && $lastStart >= $lastSpace) { + $result .= $this->substr($string, $lastStart, $current - $lastStart) . $break; + $lastStart = $lastSpace = $current; + continue; + } + + if ($current - $lastStart >= $width && $lastStart < $lastSpace) { + $result .= $this->substr($string, $lastStart, $lastSpace - $lastStart) . $break; + $lastStart = $lastSpace += 1; + continue; + } + } + + if ($lastStart !== $current) { + $result .= $this->substr($string, $lastStart, $current - $lastStart); + } + + return $result; + } + + /** + * Pad a string to a certain length with another string + * + * @param string $input + * @param int $padLength + * @param string $padString + * @param int $padType + * @return string + */ + public function strPad($input, $padLength, $padString = ' ', $padType = STR_PAD_RIGHT) + { + if (null === $this->getEncoding() || StringUtils::isSingleByteEncoding($this->getEncoding())) { + return str_pad($input, $padLength, $padString, $padType); + } + + $lengthOfPadding = $padLength - $this->strlen($input); + if ($lengthOfPadding <= 0) { + return $input; + } + + $padStringLength = $this->strlen($padString); + if ($padStringLength === 0) { + return $input; + } + + $repeatCount = (int) floor($lengthOfPadding / $padStringLength); + + if ($padType === STR_PAD_BOTH) { + $repeatCountLeft = $repeatCountRight = ($repeatCount - $repeatCount % 2) / 2; + + $lastStringLength = $lengthOfPadding - 2 * $repeatCountLeft * $padStringLength; + $lastStringLeftLength = $lastStringRightLength = (int) floor($lastStringLength / 2); + $lastStringRightLength += $lastStringLength % 2; + + $lastStringLeft = $this->substr($padString, 0, $lastStringLeftLength); + $lastStringRight = $this->substr($padString, 0, $lastStringRightLength); + + return str_repeat($padString, $repeatCountLeft) . $lastStringLeft + . $input + . str_repeat($padString, $repeatCountRight) . $lastStringRight; + } + + $lastString = $this->substr($padString, 0, $lengthOfPadding % $padStringLength); + + if ($padType === STR_PAD_LEFT) { + return str_repeat($padString, $repeatCount) . $lastString . $input; + } + + return $input . str_repeat($padString, $repeatCount) . $lastString; + } +} diff --git a/vendor/laminas/laminas-stdlib/src/StringWrapper/Iconv.php b/vendor/laminas/laminas-stdlib/src/StringWrapper/Iconv.php new file mode 100644 index 00000000..2f52b74e --- /dev/null +++ b/vendor/laminas/laminas-stdlib/src/StringWrapper/Iconv.php @@ -0,0 +1,302 @@ +getEncoding()); + } + + /** + * Returns the portion of string specified by the start and length parameters + * + * @param string $str + * @param int $offset + * @param int|null $length + * @return string|false + */ + public function substr($str, $offset = 0, $length = null) + { + $length ??= $this->strlen($str); + assert($length !== false); + + return iconv_substr($str, $offset, $length, $this->getEncoding()); + } + + /** + * Find the position of the first occurrence of a substring in a string + * + * @param string $haystack + * @param string $needle + * @param int $offset + * @return int|false + */ + public function strpos($haystack, $needle, $offset = 0) + { + $encoding = $this->getEncoding(); + assert($encoding !== null); + + return iconv_strpos($haystack, $needle, $offset, $encoding); + } + + /** + * Convert a string from defined encoding to the defined convert encoding + * + * @param string $str + * @param bool $reverse + * @return string|false + */ + public function convert($str, $reverse = false) + { + $encoding = $this->getEncoding(); + $convertEncoding = $this->getConvertEncoding(); + if ($convertEncoding === null) { + throw new Exception\LogicException( + 'No convert encoding defined' + ); + } + + if ($encoding === $convertEncoding) { + return $str; + } + + $fromEncoding = $reverse ? $convertEncoding : $encoding; + $toEncoding = $reverse ? $encoding : $convertEncoding; + + if (null === $toEncoding || null === $fromEncoding) { + return $str; + } + + // automatically add "//IGNORE" to not stop converting on invalid characters + // invalid characters triggers a notice anyway + return iconv($fromEncoding, $toEncoding . '//IGNORE', $str); + } +} diff --git a/vendor/laminas/laminas-stdlib/src/StringWrapper/Intl.php b/vendor/laminas/laminas-stdlib/src/StringWrapper/Intl.php new file mode 100644 index 00000000..81a6b9a8 --- /dev/null +++ b/vendor/laminas/laminas-stdlib/src/StringWrapper/Intl.php @@ -0,0 +1,89 @@ +getEncoding()); + } + + /** + * Returns the portion of string specified by the start and length parameters + * + * @param string $str + * @param int $offset + * @param int|null $length + * @return string|false + */ + public function substr($str, $offset = 0, $length = null) + { + return mb_substr($str, $offset, $length, $this->getEncoding()); + } + + /** + * Find the position of the first occurrence of a substring in a string + * + * @param string $haystack + * @param string $needle + * @param int $offset + * @return int|false + */ + public function strpos($haystack, $needle, $offset = 0) + { + return mb_strpos($haystack, $needle, $offset, $this->getEncoding()); + } + + /** + * Convert a string from defined encoding to the defined convert encoding + * + * @param string $str + * @param bool $reverse + * @return string|false + */ + public function convert($str, $reverse = false) + { + $encoding = $this->getEncoding(); + $convertEncoding = $this->getConvertEncoding(); + + if ($convertEncoding === null) { + throw new Exception\LogicException( + 'No convert encoding defined' + ); + } + + if ($encoding === $convertEncoding) { + return $str; + } + + $fromEncoding = $reverse ? $convertEncoding : $encoding; + $toEncoding = $reverse ? $encoding : $convertEncoding; + + return mb_convert_encoding($str, $toEncoding ?? '', $fromEncoding ?? ''); + } +} diff --git a/vendor/laminas/laminas-stdlib/src/StringWrapper/Native.php b/vendor/laminas/laminas-stdlib/src/StringWrapper/Native.php new file mode 100644 index 00000000..a137d4ae --- /dev/null +++ b/vendor/laminas/laminas-stdlib/src/StringWrapper/Native.php @@ -0,0 +1,135 @@ +convertEncoding = $encodingUpper; + } + + if ($convertEncoding !== null) { + if ($encodingUpper !== strtoupper($convertEncoding)) { + throw new Exception\InvalidArgumentException( + 'Wrapper doesn\'t support to convert between character encodings' + ); + } + + $this->convertEncoding = $encodingUpper; + } else { + $this->convertEncoding = null; + } + $this->encoding = $encodingUpper; + + return $this; + } + + /** + * Returns the length of the given string + * + * @param string $str + * @return int|false + */ + public function strlen($str) + { + return strlen($str); + } + + /** + * Returns the portion of string specified by the start and length parameters + * + * @param string $str + * @param int $offset + * @param int|null $length + * @return string|false + */ + public function substr($str, $offset = 0, $length = null) + { + return substr($str, $offset, $length); + } + + /** + * Find the position of the first occurrence of a substring in a string + * + * @param string $haystack + * @param string $needle + * @param int $offset + * @return int|false + */ + public function strpos($haystack, $needle, $offset = 0) + { + return strpos($haystack, $needle, $offset); + } +} diff --git a/vendor/laminas/laminas-stdlib/src/StringWrapper/StringWrapperInterface.php b/vendor/laminas/laminas-stdlib/src/StringWrapper/StringWrapperInterface.php new file mode 100644 index 00000000..700799f9 --- /dev/null +++ b/vendor/laminas/laminas-stdlib/src/StringWrapper/StringWrapperInterface.php @@ -0,0 +1,108 @@ + ## 🇷🇺 Русским гражданам +> +> Мы, участники Laminas, родились и живем в разных странах. У многих из нас есть друзья, родственники и коллеги как в России, так и в Украине. Некоторые из нас родились в России. Некоторые из нас живут в России. У некоторых бабушки и дедушки сражались с фашистами во Второй мировой войне. Здесь никто не поддерживает фашизм. +> +> У одного из нас есть украинская родственница, которая спаслась из дома вместе с сыном. Поезд задержался из-за бомбежки на дороге впереди. У нас есть друзья, которые прячутся в бомбоубежищах. Мы с тревогой ждем весточки от них после воздушных налетов, которые беспорядочно наносят удары и попадают по больницам, школам, детским садам и домам. Мы не берем это из каких-либо СМИ. Мы наблюдаем это напрямую. +> +> Вы доверяете нам достаточно, чтоб использовать наши программы, и мы просим вас довериться нам вновь. Мы нуждаемся в помощи. Выходите и протестуйте против этой бесполезной войны. Остановите кровопролитие. Скажите "Нет войне!" +> +> ## 🇺🇸 To Citizens of Russia +> +> We at Laminas come from all over the world. Many of us have friends, family and colleagues in both Russia and Ukraine. Some of us were born in Russia. Some of us currently live in Russia. Some have grandparents who fought Nazis in World War II. Nobody here supports fascism. +> +> One team member has a Ukrainian relative who fled her home with her son. The train was delayed due to bombing on the road ahead. We have friends who are hiding in bomb shelters. We anxiously follow up on them after the air raids, which indiscriminately fire at hospitals, schools, kindergartens and houses. We're not taking this from any media. These are our actual experiences. +> +> You trust us enough to use our software. We ask that you trust us to say the truth on this. We need your help. Go out and protest this unnecessary war. Stop the bloodshed. Say "stop the war!" + +laminas-validator provides a set of commonly needed validators. It also provides a +simple validator chaining mechanism by which multiple validators may be applied +to a single datum in a user-defined order. + +## Installation + +Run the following to install this library: + +```bash +$ composer require laminas/laminas-validator +``` + +## Documentation + +Browse the documentation online at https://docs.laminas.dev/laminas-validator/ + +## Support + +* [Issues](https://github.com/laminas/laminas-validator/issues/) +* [Chat](https://laminas.dev/chat/) +* [Forum](https://discourse.laminas.dev/) diff --git a/vendor/laminas/laminas-validator/composer.json b/vendor/laminas/laminas-validator/composer.json new file mode 100644 index 00000000..d309db5e --- /dev/null +++ b/vendor/laminas/laminas-validator/composer.json @@ -0,0 +1,86 @@ +{ + "name": "laminas/laminas-validator", + "description": "Validation classes for a wide range of domains, and the ability to chain validators to create complex validation criteria", + "license": "BSD-3-Clause", + "keywords": [ + "laminas", + "validator" + ], + "homepage": "https://laminas.dev", + "support": { + "docs": "https://docs.laminas.dev/laminas-validator/", + "issues": "https://github.com/laminas/laminas-validator/issues", + "source": "https://github.com/laminas/laminas-validator", + "rss": "https://github.com/laminas/laminas-validator/releases.atom", + "chat": "https://laminas.dev/chat", + "forum": "https://discourse.laminas.dev" + }, + "config": { + "sort-packages": true, + "platform": { + "php": "8.1.99" + }, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + }, + "extra": { + "laminas": { + "component": "Laminas\\Validator", + "config-provider": "Laminas\\Validator\\ConfigProvider" + } + }, + "require": { + "php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0", + "laminas/laminas-servicemanager": "^3.21.0", + "laminas/laminas-stdlib": "^3.19", + "psr/http-message": "^1.0.1 || ^2.0.0" + }, + "require-dev": { + "laminas/laminas-coding-standard": "^2.5", + "laminas/laminas-db": "^2.20", + "laminas/laminas-filter": "^2.35.2", + "laminas/laminas-i18n": "^2.26.0", + "laminas/laminas-session": "^2.20", + "laminas/laminas-uri": "^2.11.0", + "phpunit/phpunit": "^10.5.20", + "psalm/plugin-phpunit": "^0.19.0", + "psr/http-client": "^1.0.3", + "psr/http-factory": "^1.1.0", + "vimeo/psalm": "^5.24.0" + }, + "suggest": { + "laminas/laminas-db": "Laminas\\Db component, required by the (No)RecordExists validator", + "laminas/laminas-filter": "Laminas\\Filter component, required by the Digits validator", + "laminas/laminas-i18n": "Laminas\\I18n component to allow translation of validation error messages", + "laminas/laminas-i18n-resources": "Translations of validator messages", + "laminas/laminas-servicemanager": "Laminas\\ServiceManager component to allow using the ValidatorPluginManager and validator chains", + "laminas/laminas-session": "Laminas\\Session component, ^2.8; required by the Csrf validator", + "laminas/laminas-uri": "Laminas\\Uri component, required by the Uri and Sitemap\\Loc validators", + "psr/http-message": "psr/http-message, required when validating PSR-7 UploadedFileInterface instances via the Upload and UploadFile validators" + }, + "autoload": { + "psr-4": { + "Laminas\\Validator\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "LaminasTest\\Validator\\": "test/" + } + }, + "scripts": { + "check": [ + "@cs-check", + "@test" + ], + "cs-check": "phpcs", + "cs-fix": "phpcbf", + "test": "phpunit --colors=always", + "test-coverage": "phpunit --colors=always --coverage-clover clover.xml", + "static-analysis": "psalm --shepherd --stats" + }, + "conflict": { + "zendframework/zend-validator": "*" + } +} diff --git a/vendor/laminas/laminas-validator/renovate.json b/vendor/laminas/laminas-validator/renovate.json new file mode 100644 index 00000000..060b1d1a --- /dev/null +++ b/vendor/laminas/laminas-validator/renovate.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "local>laminas/.github:renovate-config" + ] +} diff --git a/vendor/laminas/laminas-validator/src/AbstractValidator.php b/vendor/laminas/laminas-validator/src/AbstractValidator.php new file mode 100644 index 00000000..6dd45d17 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/AbstractValidator.php @@ -0,0 +1,662 @@ +, + * messageTemplates: array, + * messageVariables: array, + * translator: Translator\TranslatorInterface|null, + * translatorTextDomain: string|null, + * translatorEnabled: bool, + * valueObscured: bool, + * } + * @property array $options + * @property array $messageTemplates + * @property array $messageVariables + */ +abstract class AbstractValidator implements + Translator\TranslatorAwareInterface, + ValidatorInterface +{ + /** + * The value to be validated + * + * @var mixed + */ + protected $value; + + /** + * Default translation object for all validate objects + * + * @var Translator\TranslatorInterface + */ + protected static $defaultTranslator; + + /** + * Default text domain to be used with translator + * + * @var string + */ + protected static $defaultTranslatorTextDomain = 'default'; + + /** + * Limits the maximum returned length of an error message + * + * @var int + */ + protected static $messageLength = -1; + /** + * @deprecated Since 2.61.0 This property will be removed in 3.0 + * + * @var AbstractOptions&array + */ + protected $abstractOptions = [ + 'messages' => [], // Array of validation failure messages + 'messageTemplates' => [], // Array of validation failure message templates + 'messageVariables' => [], // Array of additional variables available for validation failure messages + 'translator' => null, // Translation object to used -> Translator\TranslatorInterface + 'translatorTextDomain' => null, // Translation text domain + 'translatorEnabled' => true, // Is translation enabled? + 'valueObscured' => false, // Flag indicating whether value should be obfuscated in error messages + ]; + + /** + * Abstract constructor for all validators + * A validator should accept following parameters: + * - nothing f.e. Validator() + * - one or multiple scalar values f.e. Validator($first, $second, $third) + * - an array f.e. Validator(array($first => 'first', $second => 'second', $third => 'third')) + * - an instance of Traversable f.e. Validator($config_instance) + * + * @param array|Traversable $options + */ + public function __construct($options = null) + { + // The abstract constructor allows no scalar values + if ($options instanceof Traversable) { + $options = ArrayUtils::iteratorToArray($options); + } + + /** @psalm-suppress RedundantConditionGivenDocblockType */ + if (isset($this->messageTemplates) && is_array($this->messageTemplates)) { + $this->abstractOptions['messageTemplates'] = $this->messageTemplates; + } + + /** @psalm-suppress RedundantConditionGivenDocblockType */ + if (isset($this->messageVariables) && is_array($this->messageVariables)) { + $this->abstractOptions['messageVariables'] = $this->messageVariables; + } + + if (is_array($options)) { + $this->setOptions($options); + } + } + + /** + * Returns an option + * + * @deprecated Since 2.61.0 This method will be removed in 3.0 + * + * @param string $option Option to be returned + * @return mixed Returned option + * @throws Exception\InvalidArgumentException + */ + public function getOption($option) + { + if (array_key_exists($option, $this->abstractOptions)) { + return $this->abstractOptions[$option]; + } + + /** @psalm-suppress RedundantConditionGivenDocblockType */ + if (isset($this->options) && array_key_exists($option, $this->options)) { + return $this->options[$option]; + } + + throw new Exception\InvalidArgumentException("Invalid option '$option'"); + } + + /** + * Returns all available options + * + * @deprecated Since 2.61.0 This method will be removed in 3.0 + * + * @return array Array with all available options + */ + public function getOptions() + { + $result = $this->abstractOptions; + /** @psalm-suppress RedundantConditionGivenDocblockType */ + if (isset($this->options) && is_array($this->options)) { + $result += $this->options; + } + return $result; + } + + /** + * Sets one or multiple options + * + * @deprecated Since 2.61.0 This method will be removed in 3.0 - Options should be passed to the constructor + * + * @param array|Traversable $options Options to set + * @return self Provides fluid interface + * @throws Exception\InvalidArgumentException If $options is not an array or Traversable. + */ + public function setOptions($options = []) + { + /** @psalm-suppress DocblockTypeContradiction */ + if (! is_array($options) && ! $options instanceof Traversable) { + throw new Exception\InvalidArgumentException(__METHOD__ . ' expects an array or Traversable'); + } + + /** + * @psalm-suppress RedundantConditionGivenDocblockType + * @psalm-var mixed $option + */ + foreach ($options as $name => $option) { + $fname = 'set' . ucfirst($name); + $fname2 = 'is' . ucfirst($name); + if (($name !== 'setOptions') && method_exists($this, $name)) { + $this->{$name}($option); + } elseif (($fname !== 'setOptions') && method_exists($this, $fname)) { + $this->{$fname}($option); + } elseif (method_exists($this, $fname2)) { + $this->{$fname2}($option); + } elseif (isset($this->options) && is_array($this->options)) { + $this->options[$name] = $option; + } else { + $this->abstractOptions[$name] = $option; + } + } + + return $this; + } + + /** + * Returns array of validation failure messages + * + * @return array + */ + public function getMessages() + { + return array_unique($this->abstractOptions['messages'], SORT_REGULAR); + } + + /** + * Invoke as command + * + * @return bool + */ + public function __invoke(mixed $value) + { + return $this->isValid($value); + } + + /** + * Returns an array of the names of variables that are used in constructing validation failure messages + * + * @deprecated Since 2.61.0 This method will be removed in 3.0 + * + * @return list + */ + public function getMessageVariables() + { + return array_keys($this->abstractOptions['messageVariables']); + } + + /** + * Returns the message templates from the validator + * + * @deprecated Since 2.61.0 This method will be removed in 3.0 + * + * @return array + */ + public function getMessageTemplates() + { + return $this->abstractOptions['messageTemplates']; + } + + /** + * Sets the validation failure message template for a particular key + * + * @param string $messageString + * @param string|null $messageKey OPTIONAL + * @return $this Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function setMessage($messageString, $messageKey = null) + { + if ($messageKey === null) { + $keys = array_keys($this->abstractOptions['messageTemplates']); + foreach ($keys as $key) { + $this->setMessage($messageString, $key); + } + return $this; + } + + if (! isset($this->abstractOptions['messageTemplates'][$messageKey])) { + throw new Exception\InvalidArgumentException("No message template exists for key '$messageKey'"); + } + + $this->abstractOptions['messageTemplates'][$messageKey] = $messageString; + return $this; + } + + /** + * Sets validation failure message templates given as an array, where the array keys are the message keys, + * and the array values are the message template strings. + * + * @deprecated Since 2.61.0 This method will be removed in 3.0 + * Provide customised messages via the `messages` constructor option + * + * @param array $messages + * @return $this + */ + public function setMessages(array $messages) + { + foreach ($messages as $key => $message) { + $this->setMessage($message, $key); + } + return $this; + } + + /** + * Magic function returns the value of the requested property, if and only if it is the value or a + * message variable. + * + * @deprecated Since 2.61.0 This method will be removed in 3.0 - It will no longer be possible to fetch any internal + * properties + * + * @param string $property + * @return mixed + * @throws Exception\InvalidArgumentException + */ + public function __get($property) + { + if ($property === 'value') { + return $this->value; + } + + if (array_key_exists($property, $this->abstractOptions['messageVariables'])) { + /** @psalm-var mixed $result */ + $result = $this->abstractOptions['messageVariables'][$property]; + if (is_array($result)) { + return $this->{key($result)}[current($result)]; + } + return $this->{$result}; + } + + /** @psalm-suppress RedundantConditionGivenDocblockType */ + if (isset($this->messageVariables) && array_key_exists($property, $this->messageVariables)) { + /** @psalm-var mixed $result */ + $result = $this->{$this->messageVariables[$property]}; + if (is_array($result)) { + return $this->{key($result)}[current($result)]; + } + return $this->{$result}; + } + + throw new Exception\InvalidArgumentException("No property exists by the name '$property'"); + } + + /** + * Constructs and returns a validation failure message with the given message key and value. + * + * Returns null if and only if $messageKey does not correspond to an existing template. + * + * If a translator is available and a translation exists for $messageKey, + * the translation will be used. + * + * @param string $messageKey + * @param string|array|object $value + * @return null|string + */ + protected function createMessage($messageKey, $value) + { + if (! isset($this->abstractOptions['messageTemplates'][$messageKey])) { + return null; + } + + $message = $this->abstractOptions['messageTemplates'][$messageKey]; + + $message = $this->translateMessage($messageKey, $message); + + if (is_object($value)) { + $value = method_exists($value, '__toString') + ? (string) $value + : $value::class . ' object'; + } elseif (is_array($value)) { + $value = var_export($value, true); + } else { + /** @psalm-suppress RedundantCastGivenDocblockType $value */ + $value = (string) $value; + } + + if ($this->isValueObscured()) { + $value = str_repeat('*', strlen($value)); + } + + $message = str_replace('%value%', $value, $message); + foreach ($this->abstractOptions['messageVariables'] as $ident => $property) { + if (is_array($property)) { + $value = $this->{key($property)}[current($property)]; + if (is_array($value)) { + $value = '[' . implode(', ', $value) . ']'; + } + } else { + $value = $this->$property; + } + $message = str_replace("%$ident%", (string) $value, $message); + } + + $length = self::getMessageLength(); + if (($length > -1) && (strlen($message) > $length)) { + $message = substr($message, 0, $length - 3) . '...'; + } + + return $message; + } + + /** + * @param string|null $messageKey + * @param null|string|array|object $value OPTIONAL + * @return void + */ + protected function error($messageKey, $value = null) + { + if ($messageKey === null) { + $keys = array_keys($this->abstractOptions['messageTemplates']); + $messageKey = current($keys); + } + + if ($value === null) { + /** @psalm-var string|array|object $value */ + $value = $this->value; + } + + $message = $this->createMessage($messageKey, $value); + if (! is_string($message)) { + return; + } + + $this->abstractOptions['messages'][$messageKey] = $message; + } + + /** + * Returns the validation value + * + * @return mixed Value to be validated + */ + protected function getValue() + { + return $this->value; + } + + /** + * Sets the value to be validated and clears the messages and errors arrays + * + * @return void + */ + protected function setValue(mixed $value) + { + $this->value = $value; + $this->abstractOptions['messages'] = []; + } + + /** + * Set flag indicating whether or not value should be obfuscated in messages + * + * @deprecated Since 2.61.0 This method will be removed in 3.0 - Use the `valueObscured` option via the constructor + * + * @param bool $flag + * @return $this + */ + public function setValueObscured($flag) + { + /** @psalm-suppress RedundantCastGivenDocblockType */ + $this->abstractOptions['valueObscured'] = (bool) $flag; + return $this; + } + + /** + * Retrieve flag indicating whether or not value should be obfuscated in + * messages + * + * @deprecated Since 2.61.0 This method will be removed in 3.0 + * + * @return bool + */ + public function isValueObscured() + { + return $this->abstractOptions['valueObscured']; + } + + /** + * Set translation object + * + * @param string $textDomain (optional) + * @return $this + * @throws Exception\InvalidArgumentException + */ + public function setTranslator(?Translator\TranslatorInterface $translator = null, $textDomain = null) + { + $this->abstractOptions['translator'] = $translator; + if (null !== $textDomain) { + $this->setTranslatorTextDomain($textDomain); + } + return $this; + } + + /** + * Return translation object + * + * @return Translator\TranslatorInterface|null + */ + public function getTranslator() + { + if (! $this->isTranslatorEnabled()) { + return null; + } + + if (null === $this->abstractOptions['translator']) { + $this->abstractOptions['translator'] = self::getDefaultTranslator(); + } + + return $this->abstractOptions['translator']; + } + + /** + * Does this validator have its own specific translator? + * + * @deprecated Since 2.61.0 This method will be removed in 3.0 + * + * @return bool + */ + public function hasTranslator() + { + return (bool) $this->abstractOptions['translator']; + } + + /** + * Set translation text domain + * + * @deprecated since 2.61.0 This method will be removed in 3.0 Use the `translatorTextDomain` option, or set + * the text domain at the same time as the translator via `setTranslator()` + * + * @param string $textDomain + * @return $this + */ + public function setTranslatorTextDomain($textDomain = 'default') + { + $this->abstractOptions['translatorTextDomain'] = $textDomain; + return $this; + } + + /** + * Return the translation text domain + * + * @deprecated Since 2.61.0 This method will be removed in 3.0 + * + * @return string + */ + public function getTranslatorTextDomain() + { + if (null === $this->abstractOptions['translatorTextDomain']) { + $this->abstractOptions['translatorTextDomain'] = + self::getDefaultTranslatorTextDomain(); + } + return $this->abstractOptions['translatorTextDomain']; + } + + /** + * Set default translation object for all validate objects + * + * @param string $textDomain (optional) + * @return void + * @throws Exception\InvalidArgumentException + */ + public static function setDefaultTranslator(?Translator\TranslatorInterface $translator = null, $textDomain = null) + { + static::$defaultTranslator = $translator; + if (null !== $textDomain) { + self::setDefaultTranslatorTextDomain($textDomain); + } + } + + /** + * Get default translation object for all validate objects + * + * @deprecated Since 2.61.0 This method will be removed in 3.0 + * + * @return Translator\TranslatorInterface|null + */ + public static function getDefaultTranslator() + { + return static::$defaultTranslator; + } + + /** + * Is there a default translation object set? + * + * @deprecated Since 2.61.0 This method will be removed in 3.0 + * + * @return bool + */ + public static function hasDefaultTranslator() + { + return (bool) static::$defaultTranslator; + } + + /** + * Set default translation text domain for all validate objects + * + * @param string $textDomain + * @return void + */ + public static function setDefaultTranslatorTextDomain($textDomain = 'default') + { + static::$defaultTranslatorTextDomain = $textDomain; + } + + /** + * Get default translation text domain for all validate objects + * + * @deprecated Since 2.61.0 This method will be removed in 3.0 + * + * @return string + */ + public static function getDefaultTranslatorTextDomain() + { + return static::$defaultTranslatorTextDomain; + } + + /** + * Indicate whether or not translation should be enabled + * + * @deprecated Since 2.61.0 This method will be removed in 3.0 + * + * @param bool $enabled + * @return $this + */ + public function setTranslatorEnabled($enabled = true) + { + /** @psalm-suppress RedundantCastGivenDocblockType */ + $this->abstractOptions['translatorEnabled'] = (bool) $enabled; + return $this; + } + + /** + * Is translation enabled? + * + * @deprecated Since 2.61.0 This method will be removed in 3.0 + * + * @return bool + */ + public function isTranslatorEnabled() + { + return $this->abstractOptions['translatorEnabled']; + } + + /** + * Returns the maximum allowed message length + * + * @deprecated Since 2.61.0 This method will be removed in 3.0 + * + * @return int + */ + public static function getMessageLength() + { + return static::$messageLength; + } + + /** + * Sets the maximum allowed message length + * + * @param int $length + * @return void + */ + public static function setMessageLength($length = -1) + { + static::$messageLength = $length; + } + + /** + * Translate a validation message + * + * @param string $messageKey + * @param string $message + * @return string + */ + protected function translateMessage($messageKey, $message) + { + $translator = $this->getTranslator(); + if (! $translator) { + return $message; + } + + return $translator->translate($message, $this->getTranslatorTextDomain()); + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode.php b/vendor/laminas/laminas-validator/src/Barcode.php new file mode 100644 index 00000000..20516a14 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode.php @@ -0,0 +1,220 @@ + */ + protected $messageTemplates = [ + self::FAILED => 'The input failed checksum validation', + self::INVALID_CHARS => 'The input contains invalid characters', + self::INVALID_LENGTH => 'The input should have a length of %length% characters', + self::INVALID => 'Invalid type given. String expected', + ]; + + /** + * Additional variables available for validation failure messages + * + * @var array> + */ + protected $messageVariables = [ + 'length' => ['options' => 'length'], + ]; + /** + * @var array{ + * adapter: null|AdapterInterface, + * options: null|array, + * length: null|int|array, + * useChecksum: null|bool, + * } + */ + protected $options = [ + 'adapter' => null, // Barcode adapter Laminas\Validator\Barcode\AbstractAdapter + 'options' => null, // Options for this adapter + 'length' => null, + 'useChecksum' => null, + ]; + + /** + * Constructor for barcodes + * + * @param iterable|null|string|AdapterInterface $options Options to use + */ + public function __construct($options = null) + { + if ($options instanceof Traversable) { + $options = ArrayUtils::iteratorToArray($options); + } + + if ($options === null) { + $options = []; + } + + if (is_string($options) || $options instanceof AdapterInterface) { + $options = ['adapter' => $options]; + } + + if (! is_array($options)) { + throw new InvalidArgumentException(sprintf( + 'Options should be an array, a string representing the name of an adapter, or an adapter instance. ' + . 'Received "%s"', + get_debug_type($options), + )); + } + + parent::__construct($options); + } + + /** + * Returns the set adapter + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @return AdapterInterface + */ + public function getAdapter() + { + if (! $this->options['adapter'] instanceof Barcode\AdapterInterface) { + $this->setAdapter('Ean13'); + } + + assert($this->options['adapter'] instanceof Barcode\AdapterInterface); + + return $this->options['adapter']; + } + + /** + * Sets a new barcode adapter + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @param string|AdapterInterface $adapter Barcode adapter to use + * @param array $options Options for this adapter + * @return $this + * @throws InvalidArgumentException + */ + public function setAdapter($adapter, $options = null) + { + if (is_string($adapter)) { + $adapter = ucfirst(strtolower($adapter)); + $adapter = 'Laminas\\Validator\\Barcode\\' . $adapter; + + if (! class_exists($adapter)) { + throw new InvalidArgumentException('Barcode adapter matching "' . $adapter . '" not found'); + } + + $adapter = new $adapter($options); + } + + if (! $adapter instanceof Barcode\AdapterInterface) { + throw new InvalidArgumentException( + sprintf( + 'Adapter %s does not implement Laminas\\Validator\\Barcode\\AdapterInterface', + get_debug_type($adapter) + ) + ); + } + + $this->options['adapter'] = $adapter; + + return $this; + } + + /** + * Returns the checksum option + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @return string|null + */ + public function getChecksum() + { + return $this->getAdapter()->getChecksum(); + } + + /** + * Sets if checksum should be validated, if no value is given the actual setting is returned + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @param null|bool $checksum + * @return AdapterInterface|bool + */ + public function useChecksum($checksum = null) + { + return $this->getAdapter()->useChecksum($checksum); + } + + /** + * Defined by Laminas\Validator\ValidatorInterface + * + * Returns true if and only if $value contains a valid barcode + * + * @param string $value + * @return bool + */ + public function isValid($value) + { + if (! is_string($value)) { + $this->error(self::INVALID); + return false; + } + + $this->setValue($value); + $adapter = $this->getAdapter(); + $this->options['length'] = $adapter->getLength(); + $result = $adapter->hasValidLength($value); + if (! $result) { + if (is_array($this->options['length'])) { + $temp = $this->options['length']; + $this->options['length'] = ''; + foreach ($temp as $length) { + $this->options['length'] .= '/'; + $this->options['length'] .= $length; + } + + $this->options['length'] = substr($this->options['length'], 1); + } + + $this->error(self::INVALID_LENGTH); + return false; + } + + $result = $adapter->hasValidCharacters($value); + if (! $result) { + $this->error(self::INVALID_CHARS); + return false; + } + + if ($this->useChecksum(null)) { + $result = $adapter->hasValidChecksum($value); + if (! $result) { + $this->error(self::FAILED); + return false; + } + } + + return true; + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/AbstractAdapter.php b/vendor/laminas/laminas-validator/src/Barcode/AbstractAdapter.php new file mode 100644 index 00000000..b2397adf --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/AbstractAdapter.php @@ -0,0 +1,317 @@ + null, // Allowed barcode lengths, integer, array, string + 'characters' => null, // Allowed barcode characters + 'checksum' => null, // Callback to checksum function + 'useChecksum' => true, // Is a checksum value included?, boolean + ]; + + /** + * Checks the length of a barcode + * + * @param string $value The barcode to check for proper length + * @return bool + */ + public function hasValidLength($value) + { + if (! is_string($value)) { + return false; + } + + $fixum = strlen($value); + $length = $this->getLength(); + + if (is_array($length)) { + foreach ($length as $value) { + if ($fixum === $value) { + return true; + } + + if ($value === -1) { + return true; + } + } + + return false; + } + + if ($fixum === $length) { + return true; + } + + if ($length === -1) { + return true; + } + + if ($length === 'even') { + $count = $fixum % 2; + return 0 === $count; + } + + if ($length === 'odd') { + $count = $fixum % 2; + return 1 === $count; + } + + return false; + } + + /** + * Checks for allowed characters within the barcode + * + * @param string $value The barcode to check for allowed characters + * @return bool + */ + public function hasValidCharacters($value) + { + if (! is_string($value)) { + return false; + } + + $characters = $this->getCharacters(); + if ($characters === 128) { + for ($x = 0; $x < 128; ++$x) { + $value = str_replace(chr($x), '', $value); + } + } else { + $chars = str_split($characters); + foreach ($chars as $char) { + $value = str_replace($char, '', $value); + } + } + + if (strlen($value) > 0) { + return false; + } + + return true; + } + + /** + * Validates the checksum + * + * @param string $value The barcode to check the checksum for + * @return bool + */ + public function hasValidChecksum($value) + { + $checksum = $this->getChecksum(); + if ($checksum !== null) { + if (method_exists($this, $checksum)) { + return $this->$checksum($value); + } + } + + return false; + } + + /** + * Returns the allowed barcode length + * + * @return int|array|string|null + */ + public function getLength() + { + return $this->options['length']; + } + + /** + * Returns the allowed characters + * + * @return int|string|array|null + */ + public function getCharacters() + { + return $this->options['characters']; + } + + /** + * Returns the checksum function name + * + * @return string|null + */ + public function getChecksum() + { + return $this->options['checksum']; + } + + /** + * Sets the checksum validation method + * + * @param string $checksum Checksum method to call + * @return $this + */ + protected function setChecksum($checksum) + { + $this->options['checksum'] = $checksum; + return $this; + } + + /** + * Sets the checksum validation, if no value is given, the actual setting is returned + * + * @inheritDoc + */ + public function useChecksum($check = null) + { + if ($check === null) { + return $this->options['useChecksum']; + } + + $this->options['useChecksum'] = (bool) $check; + return $this; + } + + /** + * Sets the length of this barcode + * + * @param int|array $length + * @return $this + */ + protected function setLength($length) + { + $this->options['length'] = $length; + return $this; + } + + /** + * Sets the allowed characters of this barcode + * + * @param int|string|array $characters + * @return $this + */ + protected function setCharacters($characters) + { + $this->options['characters'] = $characters; + return $this; + } + + /** + * Validates the checksum (Modulo 10) + * GTIN implementation factor 3 + * + * @param string $value The barcode to validate + * @return bool + */ + protected function gtin($value) + { + $barcode = substr($value, 0, -1); + $sum = 0; + $length = strlen($barcode) - 1; + + for ($i = 0; $i <= $length; $i++) { + if (($i % 2) === 0) { + $sum += $barcode[$length - $i] * 3; + } else { + $sum += $barcode[$length - $i]; + } + } + + $calc = $sum % 10; + $checksum = $calc === 0 ? 0 : 10 - $calc; + + return $value[$length + 1] === (string) $checksum; + } + + /** + * Validates the checksum (Modulo 10) + * IDENTCODE implementation factors 9 and 4 + * + * @param string $value The barcode to validate + * @return bool + */ + protected function identcode($value) + { + $barcode = substr($value, 0, -1); + $sum = 0; + $length = strlen($value) - 2; + + for ($i = 0; $i <= $length; $i++) { + if (($i % 2) === 0) { + $sum += $barcode[$length - $i] * 4; + } else { + $sum += $barcode[$length - $i] * 9; + } + } + + $calc = $sum % 10; + $checksum = $calc === 0 ? 0 : 10 - $calc; + + return $value[$length + 1] === (string) $checksum; + } + + /** + * Validates the checksum (Modulo 10) + * CODE25 implementation factor 3 + * + * @param string $value The barcode to validate + * @return bool + */ + protected function code25($value) + { + $barcode = substr($value, 0, -1); + $sum = 0; + $length = strlen($barcode) - 1; + + for ($i = 0; $i <= $length; $i++) { + if (($i % 2) === 0) { + $sum += $barcode[$i] * 3; + } else { + $sum += $barcode[$i]; + } + } + + $calc = $sum % 10; + $checksum = $calc === 0 ? 0 : 10 - $calc; + + return $value[$length + 1] === (string) $checksum; + } + + /** + * Validates the checksum () + * POSTNET implementation + * + * @param string $value The barcode to validate + * @return bool + */ + protected function postnet($value) + { + $checksum = substr($value, -1, 1); + $values = str_split(substr($value, 0, -1)); + + $check = 0; + foreach ($values as $row) { + $check += $row; + } + + $check %= 10; + $check = 10 - $check; + + return (string) $check === $checksum; + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/AdapterInterface.php b/vendor/laminas/laminas-validator/src/Barcode/AdapterInterface.php new file mode 100644 index 00000000..8bb9efa9 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/AdapterInterface.php @@ -0,0 +1,66 @@ +setLength(-1); + $this->setCharacters('0123456789-$:/.+ABCDTN*E'); + $this->useChecksum(false); + } + + /** + * Checks for allowed characters + * + * @see Laminas\Validator\Barcode.AbstractAdapter::checkChars() + * + * @param string $value + * @return bool + */ + public function hasValidCharacters($value) + { + if (strpbrk($value, 'ABCD') !== false) { + $first = $value[0]; + if (strpbrk($first, 'ABCD') === false) { + // Missing start char + return false; + } + + $last = substr($value, -1, 1); + if (strpbrk($last, 'ABCD') === false) { + // Missing stop char + return false; + } + + $value = substr($value, 1, -1); + } elseif (strpbrk($value, 'TN*E') !== false) { + $first = $value[0]; + if (strpbrk($first, 'TN*E') === false) { + // Missing start char + return false; + } + + $last = substr($value, -1, 1); + if (strpbrk($last, 'TN*E') === false) { + // Missing stop char + return false; + } + + $value = substr($value, 1, -1); + } + + $chars = $this->getCharacters(); + $this->setCharacters('0123456789-$:/.+'); + $result = parent::hasValidCharacters($value); + $this->setCharacters($chars); + return $result; + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Code128.php b/vendor/laminas/laminas-validator/src/Barcode/Code128.php new file mode 100644 index 00000000..0bd3bffe --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Code128.php @@ -0,0 +1,738 @@ +setLength(-1); + $this->setCharacters([ + 'A' => [ + 0 => ' ', + 1 => '!', + 2 => '"', + 3 => '#', + 4 => '$', + 5 => '%', + 6 => '&', + 7 => "'", + 8 => '(', + 9 => ')', + 10 => '*', + 11 => '+', + 12 => ',', + 13 => '-', + 14 => '.', + 15 => '/', + 16 => '0', + 17 => '1', + 18 => '2', + 19 => '3', + 20 => '4', + 21 => '5', + 22 => '6', + 23 => '7', + 24 => '8', + 25 => '9', + 26 => ':', + 27 => ';', + 28 => '<', + 29 => '=', + 30 => '>', + 31 => '?', + 32 => '@', + 33 => 'A', + 34 => 'B', + 35 => 'C', + 36 => 'D', + 37 => 'E', + 38 => 'F', + 39 => 'G', + 40 => 'H', + 41 => 'I', + 42 => 'J', + 43 => 'K', + 44 => 'L', + 45 => 'M', + 46 => 'N', + 47 => 'O', + 48 => 'P', + 49 => 'Q', + 50 => 'R', + 51 => 'S', + 52 => 'T', + 53 => 'U', + 54 => 'V', + 55 => 'W', + 56 => 'X', + 57 => 'Y', + 58 => 'Z', + 59 => '[', + 60 => '\\', + 61 => ']', + 62 => '^', + 63 => '_', + 64 => 0x00, + 65 => 0x01, + 66 => 0x02, + 67 => 0x03, + 68 => 0x04, + 69 => 0x05, + 70 => 0x06, + 71 => 0x07, + 72 => 0x08, + 73 => 0x09, + 74 => 0x0A, + 75 => 0x0B, + 76 => 0x0C, + 77 => 0x0D, + 78 => 0x0E, + 79 => 0x0F, + 80 => 0x10, + 81 => 0x11, + 82 => 0x12, + 83 => 0x13, + 84 => 0x14, + 85 => 0x15, + 86 => 0x16, + 87 => 0x17, + 88 => 0x18, + 89 => 0x19, + 90 => 0x1A, + 91 => 0x1B, + 92 => 0x1C, + 93 => 0x1D, + 94 => 0x1E, + 95 => 0x1F, + 96 => 'Ç', + 97 => 'ü', + 98 => 'é', + 99 => 'â', + 100 => 'ä', + 101 => 'à', + 102 => 'å', + 103 => '‡', + 104 => 'ˆ', + 105 => '‰', + 106 => 'Š', + ], + 'B' => [ + 0 => ' ', + 1 => '!', + 2 => '"', + 3 => '#', + 4 => '$', + 5 => '%', + 6 => '&', + 7 => "'", + 8 => '(', + 9 => ')', + 10 => '*', + 11 => '+', + 12 => ',', + 13 => '-', + 14 => '.', + 15 => '/', + 16 => '0', + 17 => '1', + 18 => '2', + 19 => '3', + 20 => '4', + 21 => '5', + 22 => '6', + 23 => '7', + 24 => '8', + 25 => '9', + 26 => ':', + 27 => ';', + 28 => '<', + 29 => '=', + 30 => '>', + 31 => '?', + 32 => '@', + 33 => 'A', + 34 => 'B', + 35 => 'C', + 36 => 'D', + 37 => 'E', + 38 => 'F', + 39 => 'G', + 40 => 'H', + 41 => 'I', + 42 => 'J', + 43 => 'K', + 44 => 'L', + 45 => 'M', + 46 => 'N', + 47 => 'O', + 48 => 'P', + 49 => 'Q', + 50 => 'R', + 51 => 'S', + 52 => 'T', + 53 => 'U', + 54 => 'V', + 55 => 'W', + 56 => 'X', + 57 => 'Y', + 58 => 'Z', + 59 => '[', + 60 => '\\', + 61 => ']', + 62 => '^', + 63 => '_', + 64 => '`', + 65 => 'a', + 66 => 'b', + 67 => 'c', + 68 => 'd', + 69 => 'e', + 70 => 'f', + 71 => 'g', + 72 => 'h', + 73 => 'i', + 74 => 'j', + 75 => 'k', + 76 => 'l', + 77 => 'm', + 78 => 'n', + 79 => 'o', + 80 => 'p', + 81 => 'q', + 82 => 'r', + 83 => 's', + 84 => 't', + 85 => 'u', + 86 => 'v', + 87 => 'w', + 88 => 'x', + 89 => 'y', + 90 => 'z', + 91 => '{', + 92 => '|', + 93 => '}', + 94 => '~', + 95 => 0x7F, + 96 => 'Ç', + 97 => 'ü', + 98 => 'é', + 99 => 'â', + 100 => 'ä', + 101 => 'à', + 102 => 'å', + 103 => '‡', + 104 => 'ˆ', + 105 => '‰', + 106 => 'Š', + ], + 'C' => [ + 0 => '00', + 1 => '01', + 2 => '02', + 3 => '03', + 4 => '04', + 5 => '05', + 6 => '06', + 7 => '07', + 8 => '08', + 9 => '09', + 10 => '10', + 11 => '11', + 12 => '12', + 13 => '13', + 14 => '14', + 15 => '15', + 16 => '16', + 17 => '17', + 18 => '18', + 19 => '19', + 20 => '20', + 21 => '21', + 22 => '22', + 23 => '23', + 24 => '24', + 25 => '25', + 26 => '26', + 27 => '27', + 28 => '28', + 29 => '29', + 30 => '30', + 31 => '31', + 32 => '32', + 33 => '33', + 34 => '34', + 35 => '35', + 36 => '36', + 37 => '37', + 38 => '38', + 39 => '39', + 40 => '40', + 41 => '41', + 42 => '42', + 43 => '43', + 44 => '44', + 45 => '45', + 46 => '46', + 47 => '47', + 48 => '48', + 49 => '49', + 50 => '50', + 51 => '51', + 52 => '52', + 53 => '53', + 54 => '54', + 55 => '55', + 56 => '56', + 57 => '57', + 58 => '58', + 59 => '59', + 60 => '60', + 61 => '61', + 62 => '62', + 63 => '63', + 64 => '64', + 65 => '65', + 66 => '66', + 67 => '67', + 68 => '68', + 69 => '69', + 70 => '70', + 71 => '71', + 72 => '72', + 73 => '73', + 74 => '74', + 75 => '75', + 76 => '76', + 77 => '77', + 78 => '78', + 79 => '79', + 80 => '80', + 81 => '81', + 82 => '82', + 83 => '83', + 84 => '84', + 85 => '85', + 86 => '86', + 87 => '87', + 88 => '88', + 89 => '89', + 90 => '90', + 91 => '91', + 92 => '92', + 93 => '93', + 94 => '94', + 95 => '95', + 96 => '96', + 97 => '97', + 98 => '98', + 99 => '99', + 100 => 'ä', + 101 => 'à', + 102 => 'å', + 103 => '‡', + 104 => 'ˆ', + 105 => '‰', + 106 => 'Š', + ], + ]); + $this->setChecksum('code128'); + } + + /** + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @return void + */ + public function setUtf8StringWrapper(StringWrapperInterface $utf8StringWrapper) + { + if (! $utf8StringWrapper->isSupported('UTF-8')) { + throw new Exception\InvalidArgumentException( + 'The string wrapper needs to support UTF-8 character encoding' + ); + } + $this->utf8StringWrapper = $utf8StringWrapper; + } + + /** + * Get the string wrapper supporting UTF-8 character encoding + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @return StringWrapperInterface + */ + public function getUtf8StringWrapper() + { + if (! $this->utf8StringWrapper) { + $this->utf8StringWrapper = StringUtils::getWrapper('UTF-8'); + } + return $this->utf8StringWrapper; + } + + /** + * Checks for allowed characters within the barcode + * + * @param string $value The barcode to check for allowed characters + * @return bool + */ + public function hasValidCharacters($value) + { + if (! is_string($value)) { + return false; + } + + // get used string wrapper for UTF-8 character encoding + $strWrapper = $this->getUtf8StringWrapper(); + + // detect starting charset + $set = $this->getCodingSet($value); + $read = $set; + if ($set !== '') { + $value = $strWrapper->substr($value, 1, null); + } + + // process barcode + while ($value !== '' && $value !== false) { + $char = $strWrapper->substr($value, 0, 1); + + switch ($char) { + // Function definition + case 'Ç': + case 'ü': + case 'å': + break; + + // Switch 1 char between A and B + case 'é': + if ($set === 'A') { + $read = 'B'; + break; + } + + if ($set === 'B') { + $read = 'A'; + break; + } + + break; + + // Switch to C + case 'â': + $set = 'C'; + $read = 'C'; + break; + + // Switch to B + case 'ä': + $set = 'B'; + $read = 'B'; + break; + + // Switch to A + case 'à': + $set = 'A'; + $read = 'A'; + break; + + // Doubled start character + case '‡': + case 'ˆ': + case '‰': + return false; + + // Chars after the stop character + case 'Š': + break 2; + + default: + // Does the char exist within the charset to read? + if ($this->ord128($char, $read) === -1) { + return false; + } + + break; + } + + $value = $strWrapper->substr($value, 1, null); + $read = $set; + } + + if ($value !== '' && is_string($value) && $strWrapper->strlen($value) !== 1) { + return false; + } + + return true; + } + + /** + * Validates the checksum () + * + * @param string $value The barcode to validate + * @return bool + */ + protected function code128($value) + { + $sum = 0; + $pos = 1; + $set = $this->getCodingSet($value); + $read = $set; + $usecheck = $this->useChecksum(null); + $strWrapper = $this->getUtf8StringWrapper(); + $char = $strWrapper->substr($value, 0, 1); + if ($char === '‡') { + $sum = 103; + } elseif ($char === 'ˆ') { + $sum = 104; + } elseif ($char === '‰') { + $sum = 105; + } elseif ($usecheck === true) { + // no start value, unable to detect a proper checksum + return false; + } + + $value = $strWrapper->substr($value, 1, null); + while ($strWrapper->strpos((string) $value, 'Š') !== false || ((string) $value !== '')) { + $char = $strWrapper->substr($value, 0, 1); + if ($read === 'C') { + $char = $strWrapper->substr($value, 0, 2); + } + + switch ($char) { + // Function definition + case 'Ç': + case 'ü': + case 'å': + $sum += $pos * $this->ord128($char, $set); + break; + + case 'é': + $sum += $pos * $this->ord128($char, $set); + + if ($set === 'A') { + $read = 'B'; + break; + } + + if ($set === 'B') { + $read = 'A'; + break; + } + + break; + + // Switch to C + case 'â': + $sum += $pos * $this->ord128($char, $set); + $set = 'C'; + $read = 'C'; + break; + + // Switch to B + case 'ä': + $sum += $pos * $this->ord128($char, $set); + $set = 'B'; + $read = 'B'; + break; + + // Switch to A + case 'à': + $sum += $pos * $this->ord128($char, $set); + $set = 'A'; + $read = 'A'; + break; + + case '‡': + case 'ˆ': + case '‰': + return false; + + default: + // Does the char exist within the charset to read? + if ($this->ord128($char, $read) === -1) { + return false; + } + + $sum += $pos * $this->ord128($char, $set); + break; + } + + $value = $strWrapper->substr($value, 1); + ++$pos; + if (($strWrapper->strpos($value, 'Š') === 1) && ($strWrapper->strlen($value) === 2)) { + // break by stop and checksum char + break; + } + $read = $set; + } + + if (($strWrapper->strpos($value, 'Š') !== 1) || ($strWrapper->strlen($value) !== 2)) { + // return false if checksum is not readable and true if no startvalue is detected + return ! $usecheck; + } + + $mod = $sum % 103; + if ($strWrapper->substr($value, 0, 1) === $this->chr128($mod, $set)) { + return true; + } + + return false; + } + + /** + * Returns the coding set for a barcode + * + * @param string $value Barcode + * @return string + */ + protected function getCodingSet($value) + { + $value = $this->getUtf8StringWrapper()->substr($value, 0, 1); + return match ($value) { + '‡' => 'A', + 'ˆ' => 'B', + '‰' => 'C', + default => '', + }; + } + + /** + * Internal method to return the code128 integer from an ascii value + * + * Table A + * ASCII CODE128 + * 32 to 95 == 0 to 63 + * 0 to 31 == 64 to 95 + * 128 to 138 == 96 to 106 + * + * Table B + * ASCII CODE128 + * 32 to 138 == 0 to 106 + * + * Table C + * ASCII CODE128 + * "00" to "99" == 0 to 99 + * 132 to 138 == 100 to 106 + * + * @param string $value + * @param string $set + * @return int + */ + protected function ord128($value, $set) + { + $ord = ord($value); + if ($set === 'A') { + if ($ord < 32) { + return $ord + 64; + } elseif ($ord < 96) { + return $ord - 32; + } elseif ($ord > 138) { + return -1; + } else { + return $ord - 32; + } + } elseif ($set === 'B') { + if ($ord < 32) { + return -1; + } elseif ($ord <= 138) { + return $ord - 32; + } else { + return -1; + } + } elseif ($set === 'C') { + $val = (int) $value; + if (($val >= 0) && ($val <= 99)) { + return $val; + } elseif (($ord >= 132) && ($ord <= 138)) { + return $ord - 32; + } else { + return -1; + } + } else { + if ($ord < 32) { + return $ord + 64; + } elseif ($ord <= 138) { + return $ord - 32; + } else { + return -1; + } + } + } + + /** + * Internal Method to return the ascii value from a code128 integer + * + * Table A + * ASCII CODE128 + * 32 to 95 == 0 to 63 + * 0 to 31 == 64 to 95 + * 128 to 138 == 96 to 106 + * + * Table B + * ASCII CODE128 + * 32 to 138 == 0 to 106 + * + * Table C + * ASCII CODE128 + * "00" to "99" == 0 to 99 + * 132 to 138 == 100 to 106 + * + * @param int $value + * @param string $set + * @return int|string + */ + protected function chr128($value, $set) + { + if ($set === 'A') { + if ($value < 64) { + return chr($value + 32); + } elseif ($value < 96) { + return chr($value - 64); + } elseif ($value > 106) { + return -1; + } else { + return chr($value + 32); + } + } elseif ($set === 'B') { + if ($value > 106) { + return -1; + } else { + return chr($value + 32); + } + } elseif ($set === 'C') { + if (($value >= 0) && ($value <= 9)) { + return '0' . (string) $value; + } elseif ($value <= 99) { + return (string) $value; + } elseif ($value <= 106) { + return chr($value + 32); + } else { + return -1; + } + } else { + if ($value <= 106) { + return $value + 32; + } else { + return -1; + } + } + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Code25.php b/vendor/laminas/laminas-validator/src/Barcode/Code25.php new file mode 100644 index 00000000..c31c78b9 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Code25.php @@ -0,0 +1,18 @@ +setLength(-1); + $this->setCharacters('0123456789'); + $this->setChecksum('code25'); + $this->useChecksum(false); + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Code25interleaved.php b/vendor/laminas/laminas-validator/src/Barcode/Code25interleaved.php new file mode 100644 index 00000000..263ad92c --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Code25interleaved.php @@ -0,0 +1,20 @@ +setLength('even'); + $this->setCharacters('0123456789'); + $this->setChecksum('code25'); + $this->useChecksum(false); + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Code39.php b/vendor/laminas/laminas-validator/src/Barcode/Code39.php new file mode 100644 index 00000000..2fe46da9 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Code39.php @@ -0,0 +1,91 @@ + 0, + '1' => 1, + '2' => 2, + '3' => 3, + '4' => 4, + '5' => 5, + '6' => 6, + '7' => 7, + '8' => 8, + '9' => 9, + 'A' => 10, + 'B' => 11, + 'C' => 12, + 'D' => 13, + 'E' => 14, + 'F' => 15, + 'G' => 16, + 'H' => 17, + 'I' => 18, + 'J' => 19, + 'K' => 20, + 'L' => 21, + 'M' => 22, + 'N' => 23, + 'O' => 24, + 'P' => 25, + 'Q' => 26, + 'R' => 27, + 'S' => 28, + 'T' => 29, + 'U' => 30, + 'V' => 31, + 'W' => 32, + 'X' => 33, + 'Y' => 34, + 'Z' => 35, + '-' => 36, + '.' => 37, + ' ' => 38, + '$' => 39, + '/' => 40, + '+' => 41, + '%' => 42, + ]; + + /** + * Constructor for this barcode adapter + */ + public function __construct() + { + $this->setLength(-1); + $this->setCharacters('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ -.$/+%'); + $this->setChecksum('code39'); + $this->useChecksum(false); + } + + /** + * Validates the checksum (Modulo 43) + * + * @param string $value The barcode to validate + * @return bool + */ + protected function code39($value) + { + $checksum = substr($value, -1, 1); + $value = str_split(substr($value, 0, -1)); + $count = 0; + foreach ($value as $char) { + $count += $this->check[$char]; + } + + $mod = $count % 43; + if ($mod === $this->check[$checksum]) { + return true; + } + + return false; + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Code39ext.php b/vendor/laminas/laminas-validator/src/Barcode/Code39ext.php new file mode 100644 index 00000000..eff8ffca --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Code39ext.php @@ -0,0 +1,17 @@ +setLength(-1); + $this->setCharacters(128); + $this->useChecksum(false); + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Code93.php b/vendor/laminas/laminas-validator/src/Barcode/Code93.php new file mode 100644 index 00000000..5411ece5 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Code93.php @@ -0,0 +1,120 @@ + 0, + '1' => 1, + '2' => 2, + '3' => 3, + '4' => 4, + '5' => 5, + '6' => 6, + '7' => 7, + '8' => 8, + '9' => 9, + 'A' => 10, + 'B' => 11, + 'C' => 12, + 'D' => 13, + 'E' => 14, + 'F' => 15, + 'G' => 16, + 'H' => 17, + 'I' => 18, + 'J' => 19, + 'K' => 20, + 'L' => 21, + 'M' => 22, + 'N' => 23, + 'O' => 24, + 'P' => 25, + 'Q' => 26, + 'R' => 27, + 'S' => 28, + 'T' => 29, + 'U' => 30, + 'V' => 31, + 'W' => 32, + 'X' => 33, + 'Y' => 34, + 'Z' => 35, + '-' => 36, + '.' => 37, + ' ' => 38, + '$' => 39, + '/' => 40, + '+' => 41, + '%' => 42, + '!' => 43, + '"' => 44, + '§' => 45, + '&' => 46, + ]; + + /** + * Constructor for this barcode adapter + */ + public function __construct() + { + $this->setLength(-1); + $this->setCharacters('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ -.$/+%'); + $this->setChecksum('code93'); + $this->useChecksum(false); + } + + /** + * Validates the checksum (Modulo CK) + * + * @param string $value The barcode to validate + * @return bool + */ + protected function code93($value) + { + $checksum = substr($value, -2, 2); + $value = str_split(substr($value, 0, -2)); + $count = 0; + $length = count($value) % 20; + foreach ($value as $char) { + if ($length === 0) { + $length = 20; + } + + $count += $this->check[$char] * $length; + --$length; + } + + $check = array_search($count % 47, $this->check); + $value[] = $check; + $count = 0; + $length = count($value) % 15; + foreach ($value as $char) { + if ($length === 0) { + $length = 15; + } + + $count += $this->check[$char] * $length; + --$length; + } + $check .= array_search($count % 47, $this->check); + + if ($check === $checksum) { + return true; + } + + return false; + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Code93ext.php b/vendor/laminas/laminas-validator/src/Barcode/Code93ext.php new file mode 100644 index 00000000..e5ee6820 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Code93ext.php @@ -0,0 +1,17 @@ +setLength(-1); + $this->setCharacters(128); + $this->useChecksum(false); + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Ean12.php b/vendor/laminas/laminas-validator/src/Barcode/Ean12.php new file mode 100644 index 00000000..14073bc7 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Ean12.php @@ -0,0 +1,17 @@ +setLength(12); + $this->setCharacters('0123456789'); + $this->setChecksum('gtin'); + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Ean13.php b/vendor/laminas/laminas-validator/src/Barcode/Ean13.php new file mode 100644 index 00000000..2b27a966 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Ean13.php @@ -0,0 +1,17 @@ +setLength(13); + $this->setCharacters('0123456789'); + $this->setChecksum('gtin'); + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Ean14.php b/vendor/laminas/laminas-validator/src/Barcode/Ean14.php new file mode 100644 index 00000000..6e515062 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Ean14.php @@ -0,0 +1,17 @@ +setLength(14); + $this->setCharacters('0123456789'); + $this->setChecksum('gtin'); + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Ean18.php b/vendor/laminas/laminas-validator/src/Barcode/Ean18.php new file mode 100644 index 00000000..643addae --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Ean18.php @@ -0,0 +1,17 @@ +setLength(18); + $this->setCharacters('0123456789'); + $this->setChecksum('gtin'); + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Ean2.php b/vendor/laminas/laminas-validator/src/Barcode/Ean2.php new file mode 100644 index 00000000..3769a56a --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Ean2.php @@ -0,0 +1,17 @@ +setLength(2); + $this->setCharacters('0123456789'); + $this->useChecksum(false); + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Ean5.php b/vendor/laminas/laminas-validator/src/Barcode/Ean5.php new file mode 100644 index 00000000..31bd1f02 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Ean5.php @@ -0,0 +1,19 @@ +setLength(5); + $this->setCharacters('0123456789'); + $this->useChecksum(false); + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Ean8.php b/vendor/laminas/laminas-validator/src/Barcode/Ean8.php new file mode 100644 index 00000000..008bfa9a --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Ean8.php @@ -0,0 +1,36 @@ +setLength([7, 8]); + $this->setCharacters('0123456789'); + $this->setChecksum('gtin'); + } + + /** + * Overrides parent checkLength + * + * @param string $value Value + * @return bool + */ + public function hasValidLength($value) + { + if (strlen($value) === 7) { + $this->useChecksum(false); + } else { + $this->useChecksum(true); + } + + return parent::hasValidLength($value); + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Gtin12.php b/vendor/laminas/laminas-validator/src/Barcode/Gtin12.php new file mode 100644 index 00000000..0920396e --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Gtin12.php @@ -0,0 +1,17 @@ +setLength(12); + $this->setCharacters('0123456789'); + $this->setChecksum('gtin'); + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Gtin13.php b/vendor/laminas/laminas-validator/src/Barcode/Gtin13.php new file mode 100644 index 00000000..05d3cb75 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Gtin13.php @@ -0,0 +1,17 @@ +setLength(13); + $this->setCharacters('0123456789'); + $this->setChecksum('gtin'); + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Gtin14.php b/vendor/laminas/laminas-validator/src/Barcode/Gtin14.php new file mode 100644 index 00000000..9d2a061e --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Gtin14.php @@ -0,0 +1,17 @@ +setLength(14); + $this->setCharacters('0123456789'); + $this->setChecksum('gtin'); + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Identcode.php b/vendor/laminas/laminas-validator/src/Barcode/Identcode.php new file mode 100644 index 00000000..32d05db8 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Identcode.php @@ -0,0 +1,38 @@ +setLength(12); + $this->setCharacters('0123456789'); + $this->setChecksum('identcode'); + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Intelligentmail.php b/vendor/laminas/laminas-validator/src/Barcode/Intelligentmail.php new file mode 100644 index 00000000..de06684a --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Intelligentmail.php @@ -0,0 +1,19 @@ +setLength([20, 25, 29, 31]); + $this->setCharacters('0123456789'); + $this->useChecksum(false); + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Issn.php b/vendor/laminas/laminas-validator/src/Barcode/Issn.php new file mode 100644 index 00000000..ed8e3952 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Issn.php @@ -0,0 +1,92 @@ +setLength([8, 13]); + $this->setCharacters('0123456789X'); + $this->setChecksum('gtin'); + } + + /** + * Allows X on length of 8 chars + * + * @param string $value The barcode to check for allowed characters + * @return bool + */ + public function hasValidCharacters($value) + { + if (strlen($value) !== 8) { + if (str_contains($value, 'X')) { + return false; + } + } + + return parent::hasValidCharacters($value); + } + + /** + * Validates the checksum + * + * @param string $value The barcode to check the checksum for + * @return bool + */ + public function hasValidChecksum($value) + { + if (strlen($value) === 8) { + $this->setChecksum('issn'); + } else { + $this->setChecksum('gtin'); + } + + return parent::hasValidChecksum($value); + } + + /** + * Validates the checksum () + * ISSN implementation (reversed mod11) + * + * @param string $value The barcode to validate + * @return bool + */ + protected function issn($value) + { + $checksum = substr($value, -1, 1); + $values = str_split(substr($value, 0, -1)); + $check = 0; + $multi = 8; + foreach ($values as $token) { + if ($token === 'X') { + $token = 10; + } + + $check += $token * $multi; + --$multi; + } + + $check %= 11; + $check = $check === 0 ? 0 : 11 - $check; + + if ((string) $check === $checksum) { + return true; + } + + if (($check === 10) && ($checksum === 'X')) { + return true; + } + + return false; + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Itf14.php b/vendor/laminas/laminas-validator/src/Barcode/Itf14.php new file mode 100644 index 00000000..59dbb8b5 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Itf14.php @@ -0,0 +1,17 @@ +setLength(14); + $this->setCharacters('0123456789'); + $this->setChecksum('gtin'); + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Leitcode.php b/vendor/laminas/laminas-validator/src/Barcode/Leitcode.php new file mode 100644 index 00000000..759a2da8 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Leitcode.php @@ -0,0 +1,17 @@ +setLength(14); + $this->setCharacters('0123456789'); + $this->setChecksum('identcode'); + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Planet.php b/vendor/laminas/laminas-validator/src/Barcode/Planet.php new file mode 100644 index 00000000..4323d994 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Planet.php @@ -0,0 +1,17 @@ +setLength([12, 14]); + $this->setCharacters('0123456789'); + $this->setChecksum('postnet'); + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Postnet.php b/vendor/laminas/laminas-validator/src/Barcode/Postnet.php new file mode 100644 index 00000000..8a78c863 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Postnet.php @@ -0,0 +1,17 @@ +setLength([6, 7, 10, 12]); + $this->setCharacters('0123456789'); + $this->setChecksum('postnet'); + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Royalmail.php b/vendor/laminas/laminas-validator/src/Barcode/Royalmail.php new file mode 100644 index 00000000..57b71d82 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Royalmail.php @@ -0,0 +1,157 @@ + */ + protected $rows = [ + '0' => 1, + '1' => 1, + '2' => 1, + '3' => 1, + '4' => 1, + '5' => 1, + '6' => 2, + '7' => 2, + '8' => 2, + '9' => 2, + 'A' => 2, + 'B' => 2, + 'C' => 3, + 'D' => 3, + 'E' => 3, + 'F' => 3, + 'G' => 3, + 'H' => 3, + 'I' => 4, + 'J' => 4, + 'K' => 4, + 'L' => 4, + 'M' => 4, + 'N' => 4, + 'O' => 5, + 'P' => 5, + 'Q' => 5, + 'R' => 5, + 'S' => 5, + 'T' => 5, + 'U' => 0, + 'V' => 0, + 'W' => 0, + 'X' => 0, + 'Y' => 0, + 'Z' => 0, + ]; + + /** @var array */ + protected $columns = [ + '0' => 1, + '1' => 2, + '2' => 3, + '3' => 4, + '4' => 5, + '5' => 0, + '6' => 1, + '7' => 2, + '8' => 3, + '9' => 4, + 'A' => 5, + 'B' => 0, + 'C' => 1, + 'D' => 2, + 'E' => 3, + 'F' => 4, + 'G' => 5, + 'H' => 0, + 'I' => 1, + 'J' => 2, + 'K' => 3, + 'L' => 4, + 'M' => 5, + 'N' => 0, + 'O' => 1, + 'P' => 2, + 'Q' => 3, + 'R' => 4, + 'S' => 5, + 'T' => 0, + 'U' => 1, + 'V' => 2, + 'W' => 3, + 'X' => 4, + 'Y' => 5, + 'Z' => 0, + ]; + + /** + * Constructor for this barcode adapter + */ + public function __construct() + { + $this->setLength(-1); + $this->setCharacters('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'); + $this->setChecksum('royalmail'); + } + + /** + * Validates the checksum () + * + * @param string $value The barcode to validate + * @return bool + */ + protected function royalmail($value) + { + $checksum = substr($value, -1, 1); + $values = str_split(substr($value, 0, -1)); + $rowvalue = 0; + $colvalue = 0; + foreach ($values as $row) { + $rowvalue += $this->rows[$row]; + $colvalue += $this->columns[$row]; + } + + $rowvalue %= 6; + $colvalue %= 6; + + $rowchkvalue = array_keys($this->rows, $rowvalue); + $colchkvalue = array_keys($this->columns, $colvalue); + $intersect = array_intersect($rowchkvalue, $colchkvalue); + $chkvalue = (string) current($intersect); + + if ($chkvalue === $checksum) { + return true; + } + + return false; + } + + /** + * Allows start and stop tag within checked chars + * + * @param string $value The barcode to check for allowed characters + * @return bool + */ + public function hasValidCharacters($value) + { + if ($value[0] === '(') { + $value = substr($value, 1); + + if ($value[strlen($value) - 1] === ')') { + $value = substr($value, 0, -1); + } else { + return false; + } + } + + return parent::hasValidCharacters($value); + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Sscc.php b/vendor/laminas/laminas-validator/src/Barcode/Sscc.php new file mode 100644 index 00000000..6d9d204d --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Sscc.php @@ -0,0 +1,17 @@ +setLength(18); + $this->setCharacters('0123456789'); + $this->setChecksum('gtin'); + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Upca.php b/vendor/laminas/laminas-validator/src/Barcode/Upca.php new file mode 100644 index 00000000..c9d6b131 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Upca.php @@ -0,0 +1,17 @@ +setLength(12); + $this->setCharacters('0123456789'); + $this->setChecksum('gtin'); + } +} diff --git a/vendor/laminas/laminas-validator/src/Barcode/Upce.php b/vendor/laminas/laminas-validator/src/Barcode/Upce.php new file mode 100644 index 00000000..07f223e8 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Barcode/Upce.php @@ -0,0 +1,36 @@ +setLength([6, 7, 8]); + $this->setCharacters('0123456789'); + $this->setChecksum('gtin'); + } + + /** + * Overrides parent checkLength + * + * @param string $value Value + * @return bool + */ + public function hasValidLength($value) + { + if (strlen($value) !== 8) { + $this->useChecksum(false); + } else { + $this->useChecksum(true); + } + + return parent::hasValidLength($value); + } +} diff --git a/vendor/laminas/laminas-validator/src/Between.php b/vendor/laminas/laminas-validator/src/Between.php new file mode 100644 index 00000000..1026e52c --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Between.php @@ -0,0 +1,220 @@ + + */ + protected $messageTemplates = [ + self::NOT_BETWEEN => "The input is not between '%min%' and '%max%', inclusively", + self::NOT_BETWEEN_STRICT => "The input is not strictly between '%min%' and '%max%'", + self::VALUE_NOT_NUMERIC => "The min ('%min%') and max ('%max%') values are numeric, but the input is not", + self::VALUE_NOT_STRING => "The min ('%min%') and max ('%max%') values are non-numeric strings, " + . 'but the input is not a string', + ]; + + /** + * Additional variables available for validation failure messages + * + * @var array + */ + protected $messageVariables = [ + 'min' => ['options' => 'min'], + 'max' => ['options' => 'max'], + ]; + + /** + * Options for the between validator + * + * @var array + */ + protected $options = [ + 'inclusive' => true, // Whether to do inclusive comparisons, allowing equivalence to min and/or max + 'min' => 0, + 'max' => PHP_INT_MAX, + ]; + + /** + * Sets validator options + * Accepts the following option keys: + * 'min' => scalar, minimum border + * 'max' => scalar, maximum border + * 'inclusive' => boolean, inclusive border values + * + * @param array|Traversable $options + * @throws Exception\InvalidArgumentException + */ + public function __construct($options = null) + { + if ($options instanceof Traversable) { + $options = ArrayUtils::iteratorToArray($options); + } + if (! is_array($options)) { + $temp = []; + /** @psalm-var array $options */ + $options = func_get_args(); + $temp['min'] = array_shift($options); + if (! empty($options)) { + $temp['max'] = array_shift($options); + } + + if (! empty($options)) { + $temp['inclusive'] = array_shift($options); + } + + $options = $temp; + } + + if (! array_key_exists('min', $options) || ! array_key_exists('max', $options)) { + throw new Exception\InvalidArgumentException("Missing option: 'min' and 'max' have to be given"); + } + + if ( + (isset($options['min']) && is_numeric($options['min'])) + && (isset($options['max']) && is_numeric($options['max'])) + ) { + $this->numeric = true; + } elseif ( + (isset($options['min']) && is_string($options['min'])) + && (isset($options['max']) && is_string($options['max'])) + ) { + $this->numeric = false; + } else { + throw new Exception\InvalidArgumentException( + "Invalid options: 'min' and 'max' should be of the same scalar type" + ); + } + + parent::__construct($options); + } + + /** + * Returns the min option + * + * @return mixed + */ + public function getMin() + { + return $this->options['min']; + } + + /** + * Sets the min option + * + * @return $this Provides a fluent interface + */ + public function setMin(mixed $min) + { + $this->options['min'] = $min; + return $this; + } + + /** + * Returns the max option + * + * @return mixed + */ + public function getMax() + { + return $this->options['max']; + } + + /** + * Sets the max option + * + * @return $this Provides a fluent interface + */ + public function setMax(mixed $max) + { + $this->options['max'] = $max; + return $this; + } + + /** + * Returns the inclusive option + * + * @return bool + */ + public function getInclusive() + { + return $this->options['inclusive']; + } + + /** + * Sets the inclusive option + * + * @param bool $inclusive + * @return $this Provides a fluent interface + */ + public function setInclusive($inclusive) + { + $this->options['inclusive'] = $inclusive; + return $this; + } + + /** + * Returns true if and only if $value is between min and max options, inclusively + * if inclusive option is true. + * + * @param mixed $value + * @return bool + */ + public function isValid($value) + { + $this->setValue($value); + + if ($this->numeric && ! is_numeric($value)) { + $this->error(self::VALUE_NOT_NUMERIC); + return false; + } + if (! $this->numeric && ! is_string($value)) { + $this->error(self::VALUE_NOT_STRING); + return false; + } + + if ($this->getInclusive()) { + if ($this->getMin() > $value || $value > $this->getMax()) { + $this->error(self::NOT_BETWEEN); + return false; + } + } else { + if ($this->getMin() >= $value || $value >= $this->getMax()) { + $this->error(self::NOT_BETWEEN_STRICT); + return false; + } + } + + return true; + } +} diff --git a/vendor/laminas/laminas-validator/src/Bitwise.php b/vendor/laminas/laminas-validator/src/Bitwise.php new file mode 100644 index 00000000..da999504 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Bitwise.php @@ -0,0 +1,216 @@ + + */ + protected $messageTemplates = [ + self::NOT_AND => "The input has no common bit set with '%control%'", + self::NOT_AND_STRICT => "The input doesn't have the same bits set as '%control%'", + self::NOT_XOR => "The input has common bit set with '%control%'", + self::NO_OP => "No operator was present to compare '%control%' against", + ]; + + /** + * Additional variables available for validation failure messages + * + * @var array + */ + protected $messageVariables = [ + 'control' => 'control', + ]; + + /** @var null|string */ + protected $operator; + + /** @var bool */ + protected $strict = false; + + /** + * Sets validator options + * Accepts the following option keys: + * 'control' => int + * 'operator' => + * 'strict' => bool + * + * @param array|Traversable $options + */ + public function __construct($options = null) + { + if ($options instanceof Traversable) { + $options = iterator_to_array($options); + } + + if (! is_array($options)) { + $options = func_get_args(); + + $temp['control'] = array_shift($options); + + if (! empty($options)) { + $temp['operator'] = array_shift($options); + } + + if (! empty($options)) { + $temp['strict'] = array_shift($options); + } + + $options = $temp; + } + + parent::__construct($options); + } + + /** + * Returns the control parameter. + * + * @deprecated Since 2.60 All option getters and setters will be removed in 3.0 + * + * @return integer + */ + public function getControl() + { + return $this->control; + } + + /** + * Returns the operator parameter. + * + * @deprecated Since 2.60 All option getters and setters will be removed in 3.0 + * + * @return null|string + */ + public function getOperator() + { + return $this->operator; + } + + /** + * Returns the strict parameter. + * + * @deprecated Since 2.60 All option getters and setters will be removed in 3.0 + * + * @return boolean + */ + public function getStrict() + { + return $this->strict; + } + + /** + * Returns true if and only if $value is between min and max options, inclusively + * if inclusive option is true. + * + * @param mixed $value + * @return bool + */ + public function isValid($value) + { + $this->setValue($value); + + if (self::OP_AND === $this->operator) { + if ($this->strict) { + // All the bits set in value must be set in control + $result = ($this->control & $value) === $value; + + if (! $result) { + $this->error(self::NOT_AND_STRICT); + } + + return $result; + } + + // At least one of the bits must be common between value and control + $result = (bool) ($this->control & $value); + + if (! $result) { + $this->error(self::NOT_AND); + } + + return $result; + } + + if (self::OP_XOR === $this->operator) { + // Parentheses are required due to order of operations with bitwise operations + // phpcs:ignore WebimpressCodingStandard.Formatting.RedundantParentheses.SingleEquality + $result = ($this->control ^ $value) === ($this->control | $value); + + if (! $result) { + $this->error(self::NOT_XOR); + } + + return $result; + } + + $this->error(self::NO_OP); + return false; + } + + /** + * Sets the control parameter. + * + * @deprecated Since 2.60 All option getters and setters will be removed in 3.0 + * + * @param integer $control + * @return $this + */ + public function setControl($control) + { + $this->control = (int) $control; + + return $this; + } + + /** + * Sets the operator parameter. + * + * @deprecated Since 2.60 All option getters and setters will be removed in 3.0 + * + * @param string $operator + * @return $this + */ + public function setOperator($operator) + { + $this->operator = $operator; + + return $this; + } + + /** + * Sets the strict parameter. + * + * @deprecated Since 2.60 All option getters and setters will be removed in 3.0 + * + * @param boolean $strict + * @return $this + */ + public function setStrict($strict) + { + $this->strict = (bool) $strict; + + return $this; + } +} diff --git a/vendor/laminas/laminas-validator/src/BusinessIdentifierCode.php b/vendor/laminas/laminas-validator/src/BusinessIdentifierCode.php new file mode 100644 index 00000000..b3d42fda --- /dev/null +++ b/vendor/laminas/laminas-validator/src/BusinessIdentifierCode.php @@ -0,0 +1,328 @@ + 'Invalid type given; string expected', + self::INVALID => 'Invalid BIC format', + self::NOT_VALID_COUNTRY => 'Invalid country code', + ]; + + /** + * @see https://www.bundesbank.de/resource/blob/749660/d2c6e00664251b4d83483c229e084e44/mL/technische-spezifikationen-scc-anhang-112018-data.pdf (page 39) + */ + private const REGEX_BIC = '/^[a-z]{4}(?[a-z]{2})[a-z2-9][a-np-z0-9]([0-9a-z]{3})?$/i'; + + /** + * List of all country codes defined by ISO 3166-1 alpha-2 + * + * @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Current_codes + * + * @var string[] + */ + private const ISO_COUNTRIES = [ + 'AD', + 'AE', + 'AF', + 'AG', + 'AI', + 'AL', + 'AM', + 'AO', + 'AQ', + 'AR', + 'AS', + 'AT', + 'AU', + 'AW', + 'AX', + 'AZ', + 'BA', + 'BB', + 'BD', + 'BE', + 'BF', + 'BG', + 'BH', + 'BI', + 'BJ', + 'BL', + 'BM', + 'BN', + 'BO', + 'BQ', + 'BQ', + 'BR', + 'BS', + 'BT', + 'BV', + 'BW', + 'BY', + 'BZ', + 'CA', + 'CC', + 'CD', + 'CF', + 'CG', + 'CH', + 'CI', + 'CK', + 'CL', + 'CM', + 'CN', + 'CO', + 'CR', + 'CU', + 'CV', + 'CW', + 'CX', + 'CY', + 'CZ', + 'DE', + 'DJ', + 'DK', + 'DM', + 'DO', + 'DZ', + 'EC', + 'EE', + 'EG', + 'EH', + 'ER', + 'ES', + 'ET', + 'FI', + 'FJ', + 'FK', + 'FM', + 'FO', + 'FR', + 'GA', + 'GB', + 'GD', + 'GE', + 'GF', + 'GG', + 'GH', + 'GI', + 'GL', + 'GM', + 'GN', + 'GP', + 'GQ', + 'GR', + 'GS', + 'GT', + 'GU', + 'GW', + 'GY', + 'HK', + 'HM', + 'HN', + 'HR', + 'HT', + 'HU', + 'ID', + 'IE', + 'IL', + 'IM', + 'IN', + 'IO', + 'IQ', + 'IR', + 'IS', + 'IT', + 'JE', + 'JM', + 'JO', + 'JP', + 'KE', + 'KG', + 'KH', + 'KI', + 'KM', + 'KN', + 'KP', + 'KR', + 'KW', + 'KY', + 'KZ', + 'LA', + 'LB', + 'LC', + 'LI', + 'LK', + 'LR', + 'LS', + 'LT', + 'LU', + 'LV', + 'LY', + 'MA', + 'MC', + 'MD', + 'ME', + 'MF', + 'MG', + 'MH', + 'MK', + 'ML', + 'MM', + 'MN', + 'MO', + 'MP', + 'MQ', + 'MR', + 'MS', + 'MT', + 'MU', + 'MV', + 'MW', + 'MX', + 'MY', + 'MZ', + 'NA', + 'NC', + 'NE', + 'NF', + 'NG', + 'NI', + 'NL', + 'NO', + 'NP', + 'NR', + 'NU', + 'NZ', + 'OM', + 'PA', + 'PE', + 'PF', + 'PG', + 'PH', + 'PK', + 'PL', + 'PM', + 'PN', + 'PR', + 'PS', + 'PT', + 'PW', + 'PY', + 'QA', + 'RE', + 'RO', + 'RS', + 'RU', + 'RW', + 'SA', + 'SB', + 'SC', + 'SD', + 'SE', + 'SG', + 'SH', + 'SI', + 'SJ', + 'SK', + 'SL', + 'SM', + 'SN', + 'SO', + 'SR', + 'SS', + 'ST', + 'SV', + 'SX', + 'SY', + 'SZ', + 'TC', + 'TD', + 'TF', + 'TG', + 'TH', + 'TJ', + 'TK', + 'TL', + 'TM', + 'TN', + 'TO', + 'TR', + 'TT', + 'TV', + 'TW', + 'TZ', + 'UA', + 'UG', + 'UM', + 'US', + 'UY', + 'UZ', + 'VA', + 'VC', + 'VE', + 'VG', + 'VI', + 'VN', + 'VU', + 'WF', + 'WS', + 'YE', + 'YT', + 'ZA', + 'ZM', + 'ZW', + ]; + + /** + * This code is the only one used by SWIFT that is not defined by ISO 3166-1 alpha-2 + * + * @see https://en.wikipedia.org/wiki/ISO_9362 + * + * @var string + */ + private const KOSOVO_EXCEPTION = 'XK'; + + /** {@inheritDoc} */ + public function isValid($value): bool + { + if (! is_string($value)) { + $this->error(self::NOT_STRING); + return false; + } + + if ( + empty($value) + || ! preg_match(self::REGEX_BIC, $value, $matches) + ) { + $this->error(self::INVALID); + return false; + } + + if (! $this->isSwiftValidCountry($matches['country'])) { + $this->error(self::NOT_VALID_COUNTRY); + return false; + } + + return true; + } + + private function isSwiftValidCountry(string $countryCode): bool + { + $countryCode = strtoupper($countryCode); + return in_array($countryCode, self::ISO_COUNTRIES, true) + || $countryCode === self::KOSOVO_EXCEPTION; + } +} diff --git a/vendor/laminas/laminas-validator/src/Callback.php b/vendor/laminas/laminas-validator/src/Callback.php new file mode 100644 index 00000000..2c54c0d8 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Callback.php @@ -0,0 +1,189 @@ +, + * throwExceptions: bool, + * bind: bool, + * } + * @psalm-type OptionsArgument = array{ + * callback: callable, + * callbackOptions?: array, + * throwExceptions?: bool, + * bind?: bool, + * ... + * } + * @final + */ +class Callback extends AbstractValidator +{ + /** + * Invalid callback + */ + public const INVALID_CALLBACK = 'callbackInvalid'; + + /** + * Invalid value + */ + public const INVALID_VALUE = 'callbackValue'; + + /** + * Validation failure message template definitions + * + * @var array + */ + protected $messageTemplates = [ + self::INVALID_VALUE => 'The input is not valid', + self::INVALID_CALLBACK => 'An exception has been raised within the callback', + ]; + + /** + * Default options to set for the validator + * + * @var OptionsProperty + */ + protected $options = [ + 'callback' => null, // Callback in a call_user_func format, string || array + 'callbackOptions' => [], // Options for the callback + 'throwExceptions' => false, // Whether to throw exceptions raised within the callback or not + 'bind' => false, // Bind the callback to the validator instance + ]; + + /** @param OptionsArgument|callable $options */ + public function __construct($options = null) + { + if (is_callable($options)) { + $options = ['callback' => $options]; + } + + $bind = $options['bind'] ?? false; + assert(is_bool($bind)); + $closure = $options['callback'] ?? null; + if (is_callable($closure) && $bind === true) { + $options['callback'] = $closure(...)->bindTo($this); + } + + parent::__construct($options); + } + + /** + * Returns the set callback + * + * @deprecated Since 2.60.0 All option setters and getters will be removed in v3.0 + * + * @return callable|null + */ + public function getCallback() + { + return $this->options['callback']; + } + + /** + * Sets the callback + * + * @deprecated Since 2.60.0 All option setters and getters will be removed in v3.0 + * + * @param callable $callback + * @return $this Provides a fluent interface + * @throws InvalidArgumentException + */ + public function setCallback($callback) + { + if (! is_callable($callback)) { + throw new InvalidArgumentException('Invalid callback given'); + } + + $this->options['callback'] = $callback; + return $this; + } + + /** + * Returns the set options for the callback + * + * @deprecated Since 2.60.0 All option setters and getters will be removed in v3.0 + * + * @return array + */ + public function getCallbackOptions() + { + return $this->options['callbackOptions']; + } + + /** + * Sets options for the callback + * + * @deprecated Since 2.60.0 All option setters and getters will be removed in v3.0 + * + * @param array $options + * @return $this Provides a fluent interface + */ + public function setCallbackOptions(mixed $options) + { + $this->options['callbackOptions'] = (array) $options; + return $this; + } + + /** + * Returns true if and only if the set callback returns + * for the provided $value + * + * @param mixed $value + * @param mixed $context Additional context to provide to the callback + * @return bool + * @throws InvalidArgumentException + */ + public function isValid($value, $context = null) + { + $this->setValue($value); + + $options = $this->getCallbackOptions(); + $callback = $this->getCallback(); + if (! is_callable($callback)) { + throw new InvalidArgumentException('No callback given'); + } + + $args = [$value]; + if (empty($options) && ! empty($context)) { + $args[] = $context; + } + if (! empty($options) && empty($context)) { + $args = array_merge($args, $options); + } + if (! empty($options) && ! empty($context)) { + $args[] = $context; + $args = array_merge($args, $options); + } + + try { + if (! call_user_func_array($callback, $args)) { + $this->error(self::INVALID_VALUE); + return false; + } + } catch (Exception $exception) { + /** + * Intentionally excluding catchable \Error as they are indicative of a bug and should not be suppressed + */ + $this->error(self::INVALID_CALLBACK); + + if ($this->options['throwExceptions'] === true) { + throw $exception; + } + + return false; + } + + return true; + } +} diff --git a/vendor/laminas/laminas-validator/src/ConfigProvider.php b/vendor/laminas/laminas-validator/src/ConfigProvider.php new file mode 100644 index 00000000..852e133c --- /dev/null +++ b/vendor/laminas/laminas-validator/src/ConfigProvider.php @@ -0,0 +1,41 @@ + $this->getDependencyConfig(), + ]; + } + + /** + * Return dependency mappings for this component. + * + * @return array + */ + public function getDependencyConfig() + { + return [ + 'aliases' => [ + Translator\TranslatorInterface::class => Translator\Translator::class, + 'ValidatorManager' => ValidatorPluginManager::class, + + // Legacy Zend Framework aliases + 'Zend\Validator\ValidatorPluginManager' => ValidatorPluginManager::class, + ], + 'factories' => [ + Translator\Translator::class => Translator\TranslatorFactory::class, + ValidatorPluginManager::class => ValidatorPluginManagerFactory::class, + ], + ]; + } +} diff --git a/vendor/laminas/laminas-validator/src/CreditCard.php b/vendor/laminas/laminas-validator/src/CreditCard.php new file mode 100644 index 00000000..fcfcf9eb --- /dev/null +++ b/vendor/laminas/laminas-validator/src/CreditCard.php @@ -0,0 +1,455 @@ + 'The input seems to contain an invalid checksum', + self::CONTENT => 'The input must contain only digits', + self::INVALID => 'Invalid type given. String expected', + self::LENGTH => 'The input contains an invalid amount of digits', + self::PREFIX => 'The input is not from an allowed institute', + self::SERVICE => 'The input seems to be an invalid credit card number', + self::SERVICEFAILURE => 'An exception has been raised while validating the input', + ]; + + /** + * List of CCV names + * + * @var array + */ + protected $cardName = [ + 0 => self::AMERICAN_EXPRESS, + 1 => self::DINERS_CLUB, + 2 => self::DINERS_CLUB_US, + 3 => self::DISCOVER, + 4 => self::JCB, + 5 => self::LASER, + 6 => self::MAESTRO, + 7 => self::MASTERCARD, + 8 => self::SOLO, + 9 => self::UNIONPAY, + 10 => self::VISA, + 11 => self::MIR, + ]; + + /** + * List of allowed CCV lengths + * + * @var array + */ + protected $cardLength = [ + self::AMERICAN_EXPRESS => [15], + self::DINERS_CLUB => [14], + self::DINERS_CLUB_US => [16], + self::DISCOVER => [16, 19], + self::JCB => [15, 16], + self::LASER => [16, 17, 18, 19], + self::MAESTRO => [12, 13, 14, 15, 16, 17, 18, 19], + self::MASTERCARD => [16], + self::SOLO => [16, 18, 19], + self::UNIONPAY => [16, 17, 18, 19], + self::VISA => [13, 16, 19], + self::MIR => [13, 16], + ]; + + /** + * List of accepted CCV provider tags + * + * @var array + */ + protected $cardType = [ + self::AMERICAN_EXPRESS => ['34', '37'], + self::DINERS_CLUB => ['300', '301', '302', '303', '304', '305', '36'], + self::DINERS_CLUB_US => ['54', '55'], + self::DISCOVER => [ + '6011', + '622126', + '622127', + '622128', + '622129', + '62213', + '62214', + '62215', + '62216', + '62217', + '62218', + '62219', + '6222', + '6223', + '6224', + '6225', + '6226', + '6227', + '6228', + '62290', + '62291', + '622920', + '622921', + '622922', + '622923', + '622924', + '622925', + '644', + '645', + '646', + '647', + '648', + '649', + '65', + ], + self::JCB => ['1800', '2131', '3528', '3529', '353', '354', '355', '356', '357', '358'], + self::LASER => ['6304', '6706', '6771', '6709'], + self::MAESTRO => [ + '5018', + '5020', + '5038', + '6304', + '6759', + '6761', + '6762', + '6763', + '6764', + '6765', + '6766', + '6772', + ], + self::MASTERCARD => [ + '2221', + '2222', + '2223', + '2224', + '2225', + '2226', + '2227', + '2228', + '2229', + '223', + '224', + '225', + '226', + '227', + '228', + '229', + '23', + '24', + '25', + '26', + '271', + '2720', + '51', + '52', + '53', + '54', + '55', + ], + self::SOLO => ['6334', '6767'], + self::UNIONPAY => [ + '622126', + '622127', + '622128', + '622129', + '62213', + '62214', + '62215', + '62216', + '62217', + '62218', + '62219', + '6222', + '6223', + '6224', + '6225', + '6226', + '6227', + '6228', + '62290', + '62291', + '622920', + '622921', + '622922', + '622923', + '622924', + '622925', + ], + self::VISA => ['4'], + self::MIR => ['2200', '2201', '2202', '2203', '2204'], + ]; + + /** + * Options for this validator + * + * @var array + */ + protected $options = [ + 'service' => null, // Service callback for additional validation + 'type' => [], // CCIs which are accepted by validation + ]; + + /** + * Constructor + * + * @param string|array|Traversable $options OPTIONAL Type of CCI to allow + */ + public function __construct($options = []) + { + if ($options instanceof Traversable) { + $options = ArrayUtils::iteratorToArray($options); + } elseif (! is_array($options)) { + $options = func_get_args(); + $temp['type'] = array_shift($options); + if (! empty($options)) { + $temp['service'] = array_shift($options); + } + + $options = $temp; + } + + if (! array_key_exists('type', $options)) { + $options['type'] = self::ALL; + } + + $this->setType($options['type']); + unset($options['type']); + + if (array_key_exists('service', $options)) { + $this->setService($options['service']); + unset($options['service']); + } + + parent::__construct($options); + } + + /** + * Returns a list of accepted CCIs + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @return array + */ + public function getType() + { + return $this->options['type']; + } + + /** + * Sets CCIs which are accepted by validation + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param string|array $type Type to allow for validation + * @return CreditCard Provides a fluid interface + */ + public function setType($type) + { + $this->options['type'] = []; + return $this->addType($type); + } + + /** + * Adds a CCI to be accepted by validation + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param string|array $type Type to allow for validation + * @return $this Provides a fluid interface + */ + public function addType($type) + { + if (is_string($type)) { + $type = [$type]; + } + + foreach ($type as $typ) { + if ($typ === self::ALL) { + $this->options['type'] = array_keys($this->cardLength); + continue; + } + + if (in_array($typ, $this->options['type'])) { + continue; + } + + $constant = 'static::' . strtoupper($typ); + if (! defined($constant) || in_array(constant($constant), $this->options['type'])) { + continue; + } + $this->options['type'][] = constant($constant); + } + + return $this; + } + + /** + * Returns the actual set service + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @return callable + */ + public function getService() + { + return $this->options['service']; + } + + /** + * Sets a new callback for service validation + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param callable $service + * @return $this + * @throws InvalidArgumentException On invalid service callback. + */ + public function setService($service) + { + if (! is_callable($service)) { + throw new InvalidArgumentException('Invalid callback given'); + } + + $this->options['service'] = $service; + return $this; + } + + // The following rule is buggy for parameters attributes + // phpcs:disable SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing.NoSpaceBetweenTypeHintAndParameter + + /** + * Returns true if and only if $value follows the Luhn algorithm (mod-10 checksum) + * + * @param mixed $value + * @return bool + */ + public function isValid( + #[SensitiveParameter] + $value + ) { + $this->setValue($value); + + if (! is_string($value)) { + $this->error(self::INVALID, $value); + return false; + } + + if (! ctype_digit($value)) { + $this->error(self::CONTENT, $value); + return false; + } + + $length = strlen($value); + $types = $this->getType(); + $foundp = false; + $foundl = false; + foreach ($types as $type) { + foreach ($this->cardType[$type] as $prefix) { + if (str_starts_with($value, (string) $prefix)) { + $foundp = true; + if (in_array($length, $this->cardLength[$type])) { + $foundl = true; + break 2; + } + } + } + } + + if ($foundp === false) { + $this->error(self::PREFIX, $value); + return false; + } + + if ($foundl === false) { + $this->error(self::LENGTH, $value); + return false; + } + + $sum = 0; + $weight = 2; + + for ($i = $length - 2; $i >= 0; $i--) { + $digit = $weight * $value[$i]; + $sum += floor($digit / 10) + $digit % 10; + $weight = $weight % 2 + 1; + } + + $checksum = (10 - $sum % 10) % 10; + if ((string) $checksum !== $value[$length - 1]) { + $this->error(self::CHECKSUM, $value); + return false; + } + + $service = $this->getService(); + if (! empty($service)) { + try { + $callback = new Callback($service); + $callback->setOptions($this->getType()); + if (! $callback->isValid($value)) { + $this->error(self::SERVICE, $value); + return false; + } + } catch (Exception) { + $this->error(self::SERVICEFAILURE, $value); + return false; + } + } + + return true; + } + + // phpcs:enable SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing.NoSpaceBetweenTypeHintAndParameter +} diff --git a/vendor/laminas/laminas-validator/src/Csrf.php b/vendor/laminas/laminas-validator/src/Csrf.php new file mode 100644 index 00000000..e49bb681 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Csrf.php @@ -0,0 +1,382 @@ + 'The form submitted did not originate from the expected site', + ]; + + /** + * Actual hash used. + * + * @var mixed + */ + protected $hash; + + /** + * Static cache of the session names to generated hashes + * + * @todo unused, left here to avoid BC breaks + * @var array + */ + protected static $hashCache; + + /** + * Name of CSRF element (used to create non-colliding hashes) + * + * @var string + */ + protected $name = 'csrf'; + + /** + * Salt for CSRF token + * + * @var string + */ + protected $salt = 'salt'; + + /** @var SessionContainer */ + protected $session; + + /** + * TTL for CSRF token + * + * @var int|null + */ + protected $timeout = 300; + + /** + * Constructor + * + * @param array|Traversable $options + */ + public function __construct($options = []) + { + parent::__construct($options); + + if ($options instanceof Traversable) { + $options = ArrayUtils::iteratorToArray($options); + } + + if (! is_array($options)) { + $options = (array) $options; + } + + foreach ($options as $key => $value) { + switch (strtolower($key)) { + case 'name': + $this->setName($value); + break; + case 'salt': + $this->setSalt($value); + break; + case 'session': + $this->setSession($value); + break; + case 'timeout': + $this->setTimeout($value); + break; + default: + // ignore unknown options + break; + } + } + } + + /** + * Does the provided token match the one generated? + * + * @param mixed $value + * @param mixed $context + * @return bool + */ + public function isValid($value, $context = null) + { + if (! is_string($value)) { + return false; + } + + $this->setValue($value); + + $tokenId = $this->getTokenIdFromHash($value); + $hash = $this->getValidationToken($tokenId); + + $tokenFromValue = $this->getTokenFromHash($value); + $tokenFromHash = $this->getTokenFromHash($hash); + + if ($tokenFromValue === null || $tokenFromHash === null || ($tokenFromValue !== $tokenFromHash)) { + $this->error(self::NOT_SAME); + return false; + } + + return true; + } + + /** + * Set CSRF name + * + * @param string $name + * @return $this + */ + public function setName($name) + { + $this->name = (string) $name; + return $this; + } + + /** + * Get CSRF name + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set session container + * + * @return $this + */ + public function setSession(SessionContainer $session) + { + $this->session = $session; + if ($this->hash) { + $this->initCsrfToken(); + } + return $this; + } + + /** + * Get session container + * + * Instantiate session container if none currently exists + * + * @return SessionContainer + */ + public function getSession() + { + if (null === $this->session) { + // Using fully qualified name, to ensure polyfill class alias is used + $this->session = new SessionContainer($this->getSessionName()); + } + return $this->session; + } + + /** + * Salt for CSRF token + * + * @param string $salt + * @return $this + */ + public function setSalt($salt) + { + $this->salt = (string) $salt; + return $this; + } + + /** + * Retrieve salt for CSRF token + * + * @return string + */ + public function getSalt() + { + return $this->salt; + } + + /** + * Retrieve CSRF token + * + * If no CSRF token currently exists, or should be regenerated, + * generates one. + * + * @param bool $regenerate default false + * @return string + */ + public function getHash($regenerate = false) + { + if ((null === $this->hash) || $regenerate) { + $this->generateHash(); + } + return $this->hash; + } + + /** + * Get session namespace for CSRF token + * + * Generates a session namespace based on salt, element name, and class. + * + * @return string + */ + public function getSessionName() + { + return str_replace('\\', '_', self::class) . '_' + . $this->getSalt() . '_' + . strtr($this->getName(), ['[' => '_', ']' => '']); + } + + /** + * Set timeout for CSRF session token + * + * @param int|null $ttl + * @return $this + */ + public function setTimeout($ttl) + { + $this->timeout = $ttl !== null ? (int) $ttl : null; + return $this; + } + + /** + * Get CSRF session token timeout + * + * @return int|null + */ + public function getTimeout() + { + return $this->timeout; + } + + /** + * Initialize CSRF token in session + * + * @return void + */ + protected function initCsrfToken() + { + $session = $this->getSession(); + $timeout = $this->getTimeout(); + if (null !== $timeout) { + $session->setExpirationSeconds($timeout); + } + + $hash = $this->getHash(); + $token = $this->getTokenFromHash($hash); + $tokenId = $this->getTokenIdFromHash($hash); + + if (! $session->tokenList) { + $session->tokenList = []; + } + $session->tokenList[$tokenId] = $token; + $session->hash = $hash; // @todo remove this, left for BC + } + + /** + * Generate CSRF token + * + * Generates CSRF token and stores both in {@link $hash} and element + * value. + * + * @return void + */ + protected function generateHash() + { + $token = md5($this->getSalt() . random_bytes(32) . $this->getName()); + + $this->hash = $this->formatHash($token, $this->generateTokenId()); + + $this->setValue($this->hash); + $this->initCsrfToken(); + } + + /** + * @return string + */ + protected function generateTokenId() + { + return md5(random_bytes(32)); + } + + /** + * Get validation token + * + * Retrieve token from session, if it exists. + * + * @param string $tokenId + * @return null|string + */ + protected function getValidationToken($tokenId = null) + { + $session = $this->getSession(); + + /** + * if no tokenId is passed we revert to the old behaviour + * + * @todo remove, here for BC + */ + if ($tokenId === null && isset($session->hash)) { + return $session->hash; + } + + if ($tokenId !== null && isset($session->tokenList[$tokenId])) { + return $this->formatHash($session->tokenList[$tokenId], $tokenId); + } + + return null; + } + + /** + * @return string + */ + protected function formatHash(string $token, string $tokenId) + { + return sprintf('%s-%s', $token, $tokenId); + } + + protected function getTokenFromHash(?string $hash): ?string + { + if (null === $hash) { + return null; + } + + $data = explode('-', $hash); + return $data[0] ?: null; + } + + protected function getTokenIdFromHash(string $hash): ?string + { + $data = explode('-', $hash); + + if (! isset($data[1])) { + return null; + } + + return $data[1]; + } +} diff --git a/vendor/laminas/laminas-validator/src/Date.php b/vendor/laminas/laminas-validator/src/Date.php new file mode 100644 index 00000000..c3622a28 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Date.php @@ -0,0 +1,245 @@ + 'Invalid type given. String, integer, array or DateTime expected', + self::INVALID_DATE => 'The input does not appear to be a valid date', + self::FALSEFORMAT => "The input does not fit the date format '%format%'", + ]; + + /** @var string[] */ + protected $messageVariables = [ + 'format' => 'format', + ]; + + /** @var string */ + protected $format = self::FORMAT_DEFAULT; + + /** @var bool */ + protected $strict = false; + + /** + * Sets validator options + * + * @param string|array|Traversable $options OPTIONAL + */ + public function __construct($options = []) + { + if ($options instanceof Traversable) { + $options = iterator_to_array($options); + } elseif (! is_array($options)) { + $options = func_get_args(); + $temp['format'] = array_shift($options); + $options = $temp; + } + + parent::__construct($options); + } + + /** + * Returns the format option + * + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @return string + */ + public function getFormat() + { + return $this->format; + } + + /** + * Sets the format option + * + * Format cannot be null. It will always default to 'Y-m-d', even + * if null is provided. + * + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @param string|null $format + * @return $this provides a fluent interface + * @todo validate the format + */ + public function setFormat($format = self::FORMAT_DEFAULT) + { + $this->format = $format === null || $format === '' ? self::FORMAT_DEFAULT : $format; + return $this; + } + + /** + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + */ + public function setStrict(bool $strict): self + { + $this->strict = $strict; + return $this; + } + + /** + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + */ + public function isStrict(): bool + { + return $this->strict; + } + + /** + * Returns true if $value is a DateTimeInterface instance or can be converted into one. + * + * @param string|numeric|array|DateTimeInterface $value + * @return bool + */ + public function isValid($value) + { + $this->setValue($value); + + $date = $this->convertToDateTime($value); + if (! $date) { + $this->error(self::INVALID_DATE); + return false; + } + + if ($this->isStrict() && $date->format($this->getFormat()) !== $value) { + $this->error(self::FALSEFORMAT); + return false; + } + + return true; + } + + /** + * Attempts to convert an int, string, or array to a DateTime object + * + * @param string|numeric|array|DateTimeInterface $param + * @param bool $addErrors + * @return false|DateTime + */ + protected function convertToDateTime($param, $addErrors = true) + { + if ($param instanceof DateTime) { + return $param; + } + + if ($param instanceof DateTimeImmutable) { + return DateTime::createFromImmutable($param); + } + + $type = gettype($param); + switch ($type) { + case 'string': + return $this->convertString($param, $addErrors); + case 'integer': + return $this->convertInteger($param); + case 'double': + return $this->convertDouble($param); + case 'array': + return $this->convertArray($param, $addErrors); + } + + if ($addErrors) { + $this->error(self::INVALID); + } + + return false; + } + + /** + * Attempts to convert an integer into a DateTime object + * + * @param integer $value + * @return false|DateTime + */ + protected function convertInteger($value) + { + return DateTime::createFromFormat('U', (string) $value); + } + + /** + * Attempts to convert an double into a DateTime object + * + * @param double $value + * @return false|DateTime + */ + protected function convertDouble($value) + { + return DateTime::createFromFormat('U', (string) $value); + } + + /** + * Attempts to convert a string into a DateTime object + * + * @param string $value + * @param bool $addErrors + * @return false|DateTime + */ + protected function convertString($value, $addErrors = true) + { + $date = DateTime::createFromFormat($this->format, $value); + + // Invalid dates can show up as warnings (ie. "2007-02-99") + // and still return a DateTime object. + $errors = DateTime::getLastErrors(); + if ($errors === false) { + return $date; + } + + if ($errors['warning_count'] > 0) { + if ($addErrors) { + $this->error(self::FALSEFORMAT); + } + return false; + } + + return $date; + } + + /** + * Implodes the array into a string and proxies to {@link convertString()}. + * + * @param bool $addErrors + * @return false|DateTime + * @todo enhance the implosion + */ + protected function convertArray(array $value, $addErrors = true) + { + return $this->convertString(implode('-', $value), $addErrors); + } +} diff --git a/vendor/laminas/laminas-validator/src/DateComparison.php b/vendor/laminas/laminas-validator/src/DateComparison.php new file mode 100644 index 00000000..e3ab1c19 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/DateComparison.php @@ -0,0 +1,212 @@ + */ + protected array $messageTemplates = [ + self::ERROR_INVALID_TYPE => 'Expected a string or a date time instance but received "%type"', + self::ERROR_INVALID_DATE => 'Invalid date provided', + self::ERROR_NOT_GREATER_INCLUSIVE => 'A date equal to or after %min% is required', + self::ERROR_NOT_GREATER => 'A date after %min% is required', + self::ERROR_NOT_LESS_INCLUSIVE => 'A date equal to or before %max% is required', + self::ERROR_NOT_LESS => 'A date before %max% is required', + ]; + + /** @var array */ + protected array $messageVariables = [ + 'type' => 'type', + 'min' => 'minString', + 'max' => 'maxString', + ]; + + private readonly ?DateTimeInterface $min; + private readonly ?DateTimeInterface $max; + private readonly bool $inclusiveMin; + private readonly bool $inclusiveMax; + private readonly ?string $inputFormat; + + /** Input type used in message variables */ + protected ?string $type = null; + protected ?string $minString = null; + protected ?string $maxString = null; + + /** @param OptionsArgument $options */ + public function __construct(array $options = []) + { + parent::__construct($options); + + $this->min = $this->dateInstanceBound($options['min'] ?? null); + $this->max = $this->dateInstanceBound($options['max'] ?? null); + $this->inclusiveMin = $options['inclusiveMin'] ?? true; + $this->inclusiveMax = $options['inclusiveMax'] ?? true; + $this->inputFormat = $options['inputFormat'] ?? null; + + if ($this->min === null && $this->max === null) { + throw new InvalidArgumentException( + 'At least one date boundary must be supplied', + ); + } + + $outputFormat = $this->inputFormat ?? 'jS F Y H:i:s'; + + if ($this->min !== null) { + $this->minString = $this->min->format($outputFormat); + } + + if ($this->max !== null) { + $this->maxString = $this->max->format($outputFormat); + } + } + + public function isValid(mixed $value): bool + { + $this->type = get_debug_type($value); + $this->value = $value; + + if (! is_string($value) && ! $value instanceof DateTimeInterface) { + $this->error(self::ERROR_INVALID_TYPE); + + return false; + } + + $date = $this->valueToDate($value); + if ($date === null) { + $this->error(self::ERROR_INVALID_DATE); + + return false; + } + + if ($this->min !== null && $this->inclusiveMin && $date < $this->min) { + $this->error(self::ERROR_NOT_GREATER_INCLUSIVE); + + return false; + } + + if ($this->min !== null && ! $this->inclusiveMin && $date <= $this->min) { + $this->error(self::ERROR_NOT_GREATER); + + return false; + } + + if ($this->max !== null && $this->inclusiveMax && $date > $this->max) { + $this->error(self::ERROR_NOT_LESS_INCLUSIVE); + + return false; + } + + if ($this->max !== null && ! $this->inclusiveMax && $date >= $this->max) { + $this->error(self::ERROR_NOT_LESS); + + return false; + } + + return true; + } + + private function valueToDate(string|DateTimeInterface $input): DateTimeInterface|null + { + if ($input instanceof DateTimeInterface) { + return $this->w3cDateFromString($input->format('Y-m-d\TH:i:s')); + } + + if ($this->inputFormat !== null) { + $date = DateTimeImmutable::createFromFormat($this->inputFormat, $input, new DateTimeZone('UTC')); + + if ($date instanceof DateTimeImmutable) { + return $date; + } + } + + $date = $this->isoDateFromString($input); + if ($date !== null) { + return $date; + } + + $date = $this->w3cDateFromString($input); + if ($date !== null) { + return $date; + } + + return null; + } + + private function dateInstanceBound(string|DateTimeInterface|null $dateTime): DateTimeInterface|null + { + if ($dateTime instanceof DateTimeInterface) { + return $this->w3cDateFromString($dateTime->format('Y-m-d\TH:i:s')); + } + + if ($dateTime === null) { + return null; + } + + $date = $this->isoDateFromString($dateTime); + if ($date !== null) { + return $date; + } + + $date = $this->w3cDateFromString($dateTime); + if ($date !== null) { + return $date; + } + + throw new InvalidArgumentException( + 'Min/max date bounds must be either DateTime instances, or a string in one of the formats: ' + . '"Y-m-d" for a date or "Y-m-d\TH:i:s" for date time', + ); + } + + private function isoDateFromString(string $input): DateTimeImmutable|null + { + if (! preg_match('/^\d{4}-[0-1]\d-[0-3]\d$/', $input)) { + return null; + } + + $date = DateTimeImmutable::createFromFormat('!Y-m-d', $input, new DateTimeZone('UTC')); + assert($date !== false); + + return $date; + } + + private function w3cDateFromString(string $input): DateTimeImmutable|null + { + if (! preg_match('/^\d{4}-[0-1]\d-[0-3]\dT\d{1,2}:[0-5]\d:[0-5]\d$/', $input)) { + return null; + } + + $date = DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s', $input, new DateTimeZone('UTC')); + assert($date !== false); + + return $date; + } +} diff --git a/vendor/laminas/laminas-validator/src/DateStep.php b/vendor/laminas/laminas-validator/src/DateStep.php new file mode 100644 index 00000000..bcf41a28 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/DateStep.php @@ -0,0 +1,540 @@ + 'Invalid type given. String, integer, array or DateTime expected', + self::INVALID_DATE => 'The input does not appear to be a valid date', + self::FALSEFORMAT => "The input does not fit the date format '%format%'", + self::NOT_STEP => 'The input is not a valid step', + ]; + + /** + * Optional base date value + * + * @var string|int|DateTimeInterface + */ + protected $baseValue = '1970-01-01T00:00:00Z'; + + /** + * Date step interval (defaults to 1 day). + * Uses the DateInterval specification. + * + * @var DateInterval + */ + protected $step; + + /** + * Optional timezone to be used when the baseValue + * and validation values do not contain timezone info + * + * @deprecated Since 2.61.0 - The timezone option is unused + * + * @var DateTimeZone + */ + protected $timezone; + + /** + * Set default options for this instance + * + * @param string|array|Traversable $options + */ + public function __construct($options = []) + { + if ($options instanceof Traversable) { + $options = ArrayUtils::iteratorToArray($options); + } elseif (! is_array($options)) { + $options = func_get_args(); + $temp = []; + $temp['baseValue'] = array_shift($options); + if (! empty($options)) { + $temp['step'] = array_shift($options); + } + if (! empty($options)) { + $temp['format'] = array_shift($options); + } + if (! empty($options)) { + $temp['timezone'] = array_shift($options); + } + + $options = $temp; + } + + if (! isset($options['step'])) { + $options['step'] = new DateInterval('P1D'); + } + if (! isset($options['timezone'])) { + $options['timezone'] = new DateTimeZone(date_default_timezone_get()); + } + + parent::__construct($options); + } + + /** + * Sets the base value from which the step should be computed + * + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @param string|int|DateTimeInterface $baseValue + * @return $this + */ + public function setBaseValue($baseValue) + { + $this->baseValue = $baseValue; + return $this; + } + + /** + * Returns the base value from which the step should be computed + * + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @return string|int|DateTimeInterface + */ + public function getBaseValue() + { + return $this->baseValue; + } + + /** + * Sets the step date interval + * + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @return $this + */ + public function setStep(DateInterval $step) + { + $this->step = $step; + return $this; + } + + /** + * Returns the step date interval + * + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @return DateInterval + */ + public function getStep() + { + return $this->step; + } + + /** + * Returns the timezone option + * + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @return DateTimeZone + */ + public function getTimezone() + { + return $this->timezone; + } + + /** + * Sets the timezone option + * + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @return $this + */ + public function setTimezone(DateTimeZone $timezone) + { + $this->timezone = $timezone; + return $this; + } + + /** + * Supports formats with ISO week (W) definitions + * + * @see Date::convertString() + * + * @param string $value + * @param bool $addErrors + * @return DateTime|false + */ + protected function convertString($value, $addErrors = true) + { + // Custom week format support + if ( + str_starts_with($this->format, 'Y-\WW') + && preg_match('/^([0-9]{4})\-W([0-9]{2})/', $value, $matches) + ) { + $date = new DateTime(); + $date->setISODate((int) $matches[1], (int) $matches[2]); + } else { + $date = DateTime::createFromFormat($this->format, $value, new DateTimeZone('UTC')); + } + + // Invalid dates can show up as warnings (ie. "2007-02-99") + // and still return a DateTime object. + $errors = DateTime::getLastErrors(); + if (is_array($errors) && $errors['warning_count'] > 0) { + if ($addErrors) { + $this->error(self::FALSEFORMAT); + } + return false; + } + + return $date; + } + + /** + * Returns true if a date is within a valid step + * + * @param string|int|DateTimeInterface $value + * @return bool + * @throws Exception\InvalidArgumentException + */ + public function isValid($value) + { + if (! parent::isValid($value)) { + return false; + } + + $valueDate = $this->convertToDateTime($value, false); // avoid duplicate errors + $baseDate = $this->convertToDateTime($this->baseValue, false); + + if (false === $valueDate || false === $baseDate) { + return false; + } + + $step = $this->getStep(); + + // Same date? + // phpcs:ignore SlevomatCodingStandard.Operators.DisallowEqualOperators.DisallowedEqualOperator + if ($valueDate == $baseDate) { + return true; + } + + // Optimization for simple intervals. + // Handle intervals of just one date or time unit. + $intervalParts = explode('|', $step->format('%y|%m|%d|%h|%i|%s')); + $intervalParts = array_map('intval', $intervalParts); + $partCounts = array_count_values($intervalParts); + + $unitKeys = ['years', 'months', 'days', 'hours', 'minutes', 'seconds']; + $intervalParts = array_combine($unitKeys, $intervalParts); + + // Get absolute time difference to avoid special cases of missing/added time + $absoluteValueDate = new DateTime($valueDate->format('Y-m-d H:i:s'), new DateTimeZone('UTC')); + $absoluteBaseDate = new DateTime($baseDate->format('Y-m-d H:i:s'), new DateTimeZone('UTC')); + + $timeDiff = $absoluteValueDate->diff($absoluteBaseDate, true); + $diffParts = array_map('intval', explode('|', $timeDiff->format('%y|%m|%d|%h|%i|%s'))); + $diffParts = array_combine($unitKeys, $diffParts); + + if (5 === $partCounts[0]) { + // Find the unit with the non-zero interval + $intervalUnit = 'days'; + $stepValue = 1; + foreach ($intervalParts as $key => $value) { + if (0 !== $value) { + $intervalUnit = $key; + $stepValue = $value; + break; + } + } + + // Check date units + if (in_array($intervalUnit, ['years', 'months', 'days'])) { + switch ($intervalUnit) { + case 'years': + if ( + 0 === $diffParts['months'] && 0 === $diffParts['days'] + && 0 === $diffParts['hours'] && 0 === $diffParts['minutes'] + && 0 === $diffParts['seconds'] + ) { + if (($diffParts['years'] % $stepValue) === 0) { + return true; + } + } + break; + case 'months': + if ( + 0 === $diffParts['days'] && 0 === $diffParts['hours'] + && 0 === $diffParts['minutes'] && 0 === $diffParts['seconds'] + ) { + $months = ($diffParts['years'] * 12) + $diffParts['months']; + if (($months % $stepValue) === 0) { + return true; + } + } + break; + case 'days': + if ( + 0 === $diffParts['hours'] && 0 === $diffParts['minutes'] + && 0 === $diffParts['seconds'] + ) { + $days = (int) $timeDiff->format('%a'); // Total days + if (($days % $stepValue) === 0) { + return true; + } + } + break; + } + $this->error(self::NOT_STEP); + return false; + } + + // Check time units + if (in_array($intervalUnit, ['hours', 'minutes', 'seconds'])) { + // Simple test if $stepValue is 1. + if (1 === $stepValue) { + if ( + 'hours' === $intervalUnit + && 0 === $diffParts['minutes'] && 0 === $diffParts['seconds'] + ) { + return true; + } elseif ('minutes' === $intervalUnit && 0 === $diffParts['seconds']) { + return true; + } elseif ('seconds' === $intervalUnit) { + return true; + } + + $this->error(self::NOT_STEP); + + return false; + } + + // Simple test for same day, when using default baseDate + if ( + $baseDate->format('Y-m-d') === $valueDate->format('Y-m-d') + && $baseDate->format('Y-m-d') === '1970-01-01' + ) { + switch ($intervalUnit) { + case 'hours': + if (0 === $diffParts['minutes'] && 0 === $diffParts['seconds']) { + if (($diffParts['hours'] % $stepValue) === 0) { + return true; + } + } + break; + case 'minutes': + if (0 === $diffParts['seconds']) { + $minutes = ($diffParts['hours'] * 60) + $diffParts['minutes']; + if (($minutes % $stepValue) === 0) { + return true; + } + } + break; + case 'seconds': + $seconds = ($diffParts['hours'] * 60 * 60) + + ($diffParts['minutes'] * 60) + + $diffParts['seconds']; + if (($seconds % $stepValue) === 0) { + return true; + } + break; + } + $this->error(self::NOT_STEP); + return false; + } + } + } + + return $this->fallbackIncrementalIterationLogic($baseDate, $valueDate, $intervalParts, $diffParts, $step); + } + + /** + * Fall back to slower (but accurate) method for complex intervals. + * Keep adding steps to the base date until a match is found + * or until the value is exceeded. + * + * This is really slow if the interval is small, especially if the + * default base date of 1/1/1970 is used. We can skip a chunk of + * iterations by starting at the lower bound of steps needed to reach + * the target + * + * @param int[] $intervalParts + * @param int[] $diffParts + * @throws Exception\InvalidArgumentException + */ + private function fallbackIncrementalIterationLogic( + DateTimeInterface $baseDate, + DateTimeInterface $valueDate, + array $intervalParts, + array $diffParts, + DateInterval $step + ): bool { + [$minSteps, $requiredIterations] = $this->computeMinStepAndRequiredIterations($intervalParts, $diffParts); + $minimumInterval = $this->computeMinimumInterval($intervalParts, $minSteps); + $isIncrementalStepping = $baseDate < $valueDate; + + if (! ($baseDate instanceof DateTime || $baseDate instanceof DateTimeImmutable)) { + throw new Exception\InvalidArgumentException(sprintf( + 'Function %s requires the baseDate to be a DateTime or DateTimeImmutable instance.', + __FUNCTION__ + )); + } + + for ($offsetIterations = 0; $offsetIterations < $requiredIterations; $offsetIterations += 1) { + if ($isIncrementalStepping) { + $baseDate = $baseDate->add($minimumInterval); + } else { + $baseDate = $baseDate->sub($minimumInterval); + } + } + + while ( + ($isIncrementalStepping && $baseDate < $valueDate) + || (! $isIncrementalStepping && $baseDate > $valueDate) + ) { + if ($isIncrementalStepping) { + $baseDate = $baseDate->add($step); + } else { + $baseDate = $baseDate->sub($step); + } + + // phpcs:ignore SlevomatCodingStandard.Operators.DisallowEqualOperators.DisallowedEqualOperator + if ($baseDate == $valueDate) { + return true; + } + } + + $this->error(self::NOT_STEP); + + return false; + } + + /** + * Computes minimum interval to use for iterations while checking steps + * + * @param int[] $intervalParts + * @param int|float $minSteps + */ + private function computeMinimumInterval(array $intervalParts, $minSteps): DateInterval + { + return new DateInterval(sprintf( + 'P%dY%dM%dDT%dH%dM%dS', + $intervalParts['years'] * $minSteps, + $intervalParts['months'] * $minSteps, + $intervalParts['days'] * $minSteps, + $intervalParts['hours'] * $minSteps, + $intervalParts['minutes'] * $minSteps, + $intervalParts['seconds'] * $minSteps + )); + } + + /** + * @param int[] $intervalParts + * @param int[] $diffParts + * @return int[] (ordered tuple containing minimum steps and required step iterations + * @psalm-return array{0: int, 1: int} + */ + private function computeMinStepAndRequiredIterations(array $intervalParts, array $diffParts): array + { + $minSteps = $this->computeMinSteps($intervalParts, $diffParts); + + // If we use PHP_INT_MAX DateInterval::__construct falls over with a bad format error + // before we reach the max on 64 bit machines + $maxInteger = min(2 ** 31, PHP_INT_MAX); + // check for integer overflow and split $minimum interval if needed + $maximumInterval = max($intervalParts); + $requiredStepIterations = 1; + + if (($minSteps * $maximumInterval) > $maxInteger) { + $requiredStepIterations = ceil(($minSteps * $maximumInterval) / $maxInteger); + $minSteps = floor($minSteps / $requiredStepIterations); + } + + return [(int) $minSteps, $minSteps !== 0 ? (int) $requiredStepIterations : 0]; + } + + /** + * Multiply the step interval by the lower bound of steps to reach the target + * + * @param int[] $intervalParts + * @param int[] $diffParts + * @return float|int + */ + private function computeMinSteps(array $intervalParts, array $diffParts) + { + $intervalMaxSeconds = $this->computeIntervalMaxSeconds($intervalParts); + + return 0 === $intervalMaxSeconds + ? 0 + : max(floor($this->computeDiffMinSeconds($diffParts) / $intervalMaxSeconds) - 1, 0); + } + + /** + * Get upper bound of the given interval in seconds + * Converts a given `$intervalParts` array into seconds + * + * @param int[] $intervalParts + */ + private function computeIntervalMaxSeconds(array $intervalParts): int + { + return ($intervalParts['years'] * 60 * 60 * 24 * 366) + + ($intervalParts['months'] * 60 * 60 * 24 * 31) + + ($intervalParts['days'] * 60 * 60 * 24) + + ($intervalParts['hours'] * 60 * 60) + + ($intervalParts['minutes'] * 60) + + $intervalParts['seconds']; + } + + /** + * Get lower bound of difference in secondss + * Converts a given `$diffParts` array into seconds + * + * @param int[] $diffParts + */ + private function computeDiffMinSeconds(array $diffParts): int + { + return ($diffParts['years'] * 60 * 60 * 24 * 365) + + ($diffParts['months'] * 60 * 60 * 24 * 28) + + ($diffParts['days'] * 60 * 60 * 24) + + ($diffParts['hours'] * 60 * 60) + + ($diffParts['minutes'] * 60) + + $diffParts['seconds']; + } +} diff --git a/vendor/laminas/laminas-validator/src/Db/AbstractDb.php b/vendor/laminas/laminas-validator/src/Db/AbstractDb.php new file mode 100755 index 00000000..54ac7f15 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Db/AbstractDb.php @@ -0,0 +1,317 @@ + Message templates */ + protected $messageTemplates = [ + self::ERROR_NO_RECORD_FOUND => 'No record matching the input was found', + self::ERROR_RECORD_FOUND => 'A record matching the input was found', + ]; + + /** + * Select object to use. can be set, or will be auto-generated + * + * @var Select + */ + protected $select; + + /** @var string */ + protected $schema; + + /** @var string */ + protected $table = ''; + + /** @var string */ + protected $field = ''; + + /** @var mixed */ + protected $exclude; + + /** + * Provides basic configuration for use with Laminas\Validator\Db Validators + * Setting $exclude allows a single record to be excluded from matching. + * Exclude can either be a String containing a where clause, or an array with `field` and `value` keys + * to define the where clause added to the sql. + * A database adapter may optionally be supplied to avoid using the registered default adapter. + * + * The following option keys are supported: + * 'table' => The database table to validate against + * 'schema' => The schema keys + * 'field' => The field to check for a match + * 'exclude' => An optional where clause or field/value pair to exclude from the query + * 'adapter' => An optional database adapter to use + * + * @param array|Traversable|Select $options Options to use for this validator + * @throws InvalidArgumentException + */ + public function __construct($options = null) + { + parent::__construct($options); + + if ($options instanceof Select) { + $this->setSelect($options); + return; + } + + if ($options instanceof Traversable) { + $options = ArrayUtils::iteratorToArray($options); + } elseif (func_num_args() > 1) { + $options = func_get_args(); + $firstArgument = array_shift($options); + if (is_array($firstArgument)) { + $temp = ArrayUtils::iteratorToArray($firstArgument); + } else { + $temp['table'] = $firstArgument; + } + + $temp['field'] = array_shift($options); + + if (! empty($options)) { + $temp['exclude'] = array_shift($options); + } + + if (! empty($options)) { + $temp['adapter'] = array_shift($options); + } + + $options = $temp; + } + + if (! array_key_exists('table', $options) && ! array_key_exists('schema', $options)) { + throw new Exception\InvalidArgumentException('Table or Schema option missing!'); + } + + if (! array_key_exists('field', $options)) { + throw new Exception\InvalidArgumentException('Field option missing!'); + } + + if (array_key_exists('adapter', $options)) { + $this->setAdapter($options['adapter']); + } + + if (array_key_exists('exclude', $options)) { + $this->setExclude($options['exclude']); + } + + $this->setField($options['field']); + if (array_key_exists('table', $options)) { + $this->setTable($options['table']); + } + + if (array_key_exists('schema', $options)) { + $this->setSchema($options['schema']); + } + } + + /** + * Returns the set adapter + * + * @throws RuntimeException When no database adapter is defined. + * @return DbAdapter + */ + public function getAdapter() + { + return $this->adapter; + } + + /** + * Sets a new database adapter + * + * @return self Provides a fluent interface + */ + public function setAdapter(DbAdapter $adapter) + { + return $this->setDbAdapter($adapter); + } + + /** + * Returns the set exclude clause + * + * @return string|array + */ + public function getExclude() + { + return $this->exclude; + } + + /** + * Sets a new exclude clause + * + * @param string|array $exclude + * @return $this Provides a fluent interface + */ + public function setExclude($exclude) + { + $this->exclude = $exclude; + $this->select = null; + return $this; + } + + /** + * Returns the set field + * + * @return string|array + */ + public function getField() + { + return $this->field; + } + + /** + * Sets a new field + * + * @param string $field + * @return $this + */ + public function setField($field) + { + $this->field = (string) $field; + $this->select = null; + return $this; + } + + /** + * Returns the set table + * + * @return string + */ + public function getTable() + { + return $this->table; + } + + /** + * Sets a new table + * + * @param string $table + * @return $this Provides a fluent interface + */ + public function setTable($table) + { + $this->table = (string) $table; + $this->select = null; + return $this; + } + + /** + * Returns the set schema + * + * @return string + */ + public function getSchema() + { + return $this->schema; + } + + /** + * Sets a new schema + * + * @param string $schema + * @return $this Provides a fluent interface + */ + public function setSchema($schema) + { + $this->schema = $schema; + $this->select = null; + return $this; + } + + /** + * Sets the select object to be used by the validator + * + * @return $this Provides a fluent interface + */ + public function setSelect(Select $select) + { + $this->select = $select; + return $this; + } + + /** + * Gets the select object to be used by the validator. + * If no select object was supplied to the constructor, + * then it will auto-generate one from the given table, + * schema, field, and adapter options. + * + * @return Select The Select object which will be used + */ + public function getSelect() + { + if ($this->select instanceof Select) { + return $this->select; + } + + // Build select object + $select = new Select(); + $tableIdentifier = new TableIdentifier($this->table, $this->schema); + $select->from($tableIdentifier)->columns([$this->field]); + $select->where->equalTo($this->field, null); + + if ($this->exclude !== null) { + if (is_array($this->exclude)) { + $select->where->notEqualTo( + $this->exclude['field'], + $this->exclude['value'] + ); + } else { + $select->where($this->exclude); + } + } + + $this->select = $select; + + return $this->select; + } + + /** + * Run query and returns matches, or null if no matches are found. + * + * @param string $value + * @return array when matches are found. + */ + protected function query($value) + { + $sql = new Sql($this->getAdapter()); + $select = $this->getSelect(); + $statement = $sql->prepareStatementForSqlObject($select); + $parameters = $statement->getParameterContainer(); + $parameters['where1'] = $value; + $result = $statement->execute(); + + return $result->current(); + } +} diff --git a/vendor/laminas/laminas-validator/src/Db/NoRecordExists.php b/vendor/laminas/laminas-validator/src/Db/NoRecordExists.php new file mode 100644 index 00000000..23a75ae9 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Db/NoRecordExists.php @@ -0,0 +1,38 @@ +adapter) { + throw new Exception\RuntimeException('No database adapter present'); + } + + $valid = true; + $this->setValue($value); + + $result = $this->query($value); + if ($result) { + $valid = false; + $this->error(self::ERROR_RECORD_FOUND); + } + + return $valid; + } +} diff --git a/vendor/laminas/laminas-validator/src/Db/RecordExists.php b/vendor/laminas/laminas-validator/src/Db/RecordExists.php new file mode 100644 index 00000000..e8aac19b --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Db/RecordExists.php @@ -0,0 +1,38 @@ +adapter) { + throw new Exception\RuntimeException('No database adapter present'); + } + + $valid = true; + $this->setValue($value); + + $result = $this->query($value); + if (! $result) { + $valid = false; + $this->error(self::ERROR_NO_RECORD_FOUND); + } + + return $valid; + } +} diff --git a/vendor/laminas/laminas-validator/src/Digits.php b/vendor/laminas/laminas-validator/src/Digits.php new file mode 100644 index 00000000..97a9caa7 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Digits.php @@ -0,0 +1,67 @@ + 'The input must contain only digits', + self::STRING_EMPTY => 'The input is an empty string', + self::INVALID => 'Invalid type given. String, integer or float expected', + ]; + + /** + * Returns true if and only if $value only contains digit characters + * + * @param mixed $value + * @return bool + */ + public function isValid($value) + { + if (! is_string($value) && ! is_int($value) && ! is_float($value)) { + $this->error(self::INVALID); + return false; + } + + $this->setValue((string) $value); + + if ('' === $this->getValue()) { + $this->error(self::STRING_EMPTY); + return false; + } + + if (null === static::$filter) { + static::$filter = new DigitsFilter(); + } + + if ($this->getValue() !== static::$filter->filter($this->getValue())) { + $this->error(self::NOT_DIGITS); + return false; + } + + return true; + } +} diff --git a/vendor/laminas/laminas-validator/src/EmailAddress.php b/vendor/laminas/laminas-validator/src/EmailAddress.php new file mode 100644 index 00000000..03ebe12c --- /dev/null +++ b/vendor/laminas/laminas-validator/src/EmailAddress.php @@ -0,0 +1,598 @@ + */ + protected $messageTemplates = [ + self::INVALID => "Invalid type given. String expected", + self::INVALID_FORMAT => "The input is not a valid email address. Use the basic format local-part@hostname", + self::INVALID_HOSTNAME => "'%hostname%' is not a valid hostname for the email address", + self::INVALID_MX_RECORD => "'%hostname%' does not appear to have any valid MX or A records for the email address", + self::INVALID_SEGMENT => "'%hostname%' is not in a routable network segment. The email address should not be resolved from public network", + self::DOT_ATOM => "'%localPart%' can not be matched against dot-atom format", + self::QUOTED_STRING => "'%localPart%' can not be matched against quoted-string format", + self::INVALID_LOCAL_PART => "'%localPart%' is not a valid local part for the email address", + self::LENGTH_EXCEEDED => "The input exceeds the allowed length", + ]; + + // phpcs:enable + + /** @var array */ + protected $messageVariables = [ + 'hostname' => 'hostname', + 'localPart' => 'localPart', + ]; + + /** @var string */ + protected $hostname; + + /** @var string */ + protected $localPart; + + /** + * Returns the found mx record information + * + * @var array + */ + protected $mxRecord = []; + + /** + * Internal options array + * + * @var array + */ + protected $options = [ + 'useMxCheck' => false, + 'useDeepMxCheck' => false, + 'useDomainCheck' => true, + 'allow' => Hostname::ALLOW_DNS, + 'strict' => true, + 'hostnameValidator' => null, + ]; + + /** + * Instantiates hostname validator for local use + * + * The following additional option keys are supported: + * 'hostnameValidator' => A hostname validator, see Laminas\Validator\Hostname + * 'allow' => Options for the hostname validator, see Laminas\Validator\Hostname::ALLOW_* + * 'strict' => Whether to adhere to strictest requirements in the spec + * 'useMxCheck' => If MX check should be enabled, boolean + * 'useDeepMxCheck' => If a deep MX check should be done, boolean + * + * @param array|Traversable $options OPTIONAL + */ + public function __construct($options = []) + { + if (! is_array($options)) { + $options = func_get_args(); + $temp['allow'] = array_shift($options); + if (! empty($options)) { + $temp['useMxCheck'] = array_shift($options); + } + + if (! empty($options)) { + $temp['hostnameValidator'] = array_shift($options); + } + + $options = $temp; + } + + parent::__construct($options); + } + + /** + * Sets the validation failure message template for a particular key + * Adds the ability to set messages to the attached hostname validator + * + * @param string $messageString + * @param string $messageKey OPTIONAL + * @return AbstractValidator Provides a fluent interface + */ + public function setMessage($messageString, $messageKey = null) + { + if ($messageKey === null) { + $this->getHostnameValidator()->setMessage($messageString); + parent::setMessage($messageString); + return $this; + } + + if (! isset($this->messageTemplates[$messageKey])) { + $this->getHostnameValidator()->setMessage($messageString, $messageKey); + } else { + parent::setMessage($messageString, $messageKey); + } + + return $this; + } + + /** + * Returns the set hostname validator + * + * If was not previously set then lazy load a new one + * + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @return Hostname + */ + public function getHostnameValidator() + { + if (! isset($this->options['hostnameValidator'])) { + $this->options['hostnameValidator'] = new Hostname($this->getAllow()); + } + + return $this->options['hostnameValidator']; + } + + /** + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @param Hostname $hostnameValidator OPTIONAL + * @return $this Provides a fluent interface + */ + public function setHostnameValidator(?Hostname $hostnameValidator = null) + { + $this->options['hostnameValidator'] = $hostnameValidator; + + return $this; + } + + /** + * Returns the allow option of the attached hostname validator + * + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @return int + */ + public function getAllow() + { + return $this->options['allow']; + } + + /** + * Sets the allow option of the hostname validator to use + * + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @param int $allow + * @return $this Provides a fluent interface + */ + public function setAllow($allow) + { + $this->options['allow'] = $allow; + if (isset($this->options['hostnameValidator'])) { + $this->options['hostnameValidator']->setAllow($allow); + } + + return $this; + } + + /** + * Whether MX checking via getmxrr is supported or not + * + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @return bool + */ + public function isMxSupported() + { + return function_exists('getmxrr'); + } + + /** + * Returns the set validateMx option + * + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @return bool + */ + public function getMxCheck() + { + return $this->options['useMxCheck']; + } + + /** + * Set whether we check for a valid MX record via DNS + * + * This only applies when DNS hostnames are validated + * + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @param bool $mx Set allowed to true to validate for MX records, and false to not validate them + * @return $this Fluid Interface + */ + public function useMxCheck($mx) + { + $this->options['useMxCheck'] = (bool) $mx; + return $this; + } + + /** + * Returns the set deepMxCheck option + * + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @return bool + */ + public function getDeepMxCheck() + { + return $this->options['useDeepMxCheck']; + } + + /** + * Use deep validation for MX records + * + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @param bool $deep Set deep to true to perform a deep validation process for MX records + * @return $this Fluid Interface + */ + public function useDeepMxCheck($deep) + { + $this->options['useDeepMxCheck'] = (bool) $deep; + return $this; + } + + /** + * Returns the set domainCheck option + * + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @return bool + */ + public function getDomainCheck() + { + return $this->options['useDomainCheck']; + } + + /** + * Sets if the domain should also be checked + * or only the local part of the email address + * + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @param bool $domain + * @return $this Fluid Interface + */ + public function useDomainCheck($domain = true) + { + $this->options['useDomainCheck'] = (bool) $domain; + return $this; + } + + /** + * Returns whether the given host is a reserved IP, or a hostname that resolves to a reserved IP + * + * @param string $host + * @return bool Returns false when minimal one of the given addresses is not reserved + */ + protected function isReserved($host) + { + $validator = new HostWithPublicIPv4Address(); + return ! $validator->isValid($host); + } + + /** + * Internal method to validate the local part of the email address + * + * @return bool + */ + protected function validateLocalPart() + { + // First try to match the local part on the common dot-atom format + + // Dot-atom characters are: 1*atext *("." 1*atext) + // atext: ALPHA / DIGIT / and "!", "#", "$", "%", "&", "'", "*", + // "+", "-", "/", "=", "?", "^", "_", "`", "{", "|", "}", "~" + $atext = 'a-zA-Z0-9\x21\x23\x24\x25\x26\x27\x2a\x2b\x2d\x2f\x3d\x3f\x5e\x5f\x60\x7b\x7c\x7d\x7e'; + if (preg_match('/^[' . $atext . ']+(\x2e+[' . $atext . ']+)*$/', $this->localPart)) { + return true; + } + + if ($this->validateInternationalizedLocalPart($this->localPart)) { + return true; + } + + // Try quoted string format (RFC 5321 Chapter 4.1.2) + + // Quoted-string characters are: DQUOTE *(qtext/quoted-pair) DQUOTE + $qtext = '\x20-\x21\x23-\x5b\x5d-\x7e'; // %d32-33 / %d35-91 / %d93-126 + $quotedPair = '\x20-\x7e'; // %d92 %d32-126 + if (preg_match('/^"([' . $qtext . ']|\x5c[' . $quotedPair . '])*"$/', $this->localPart)) { + return true; + } + + $this->error(self::DOT_ATOM); + $this->error(self::QUOTED_STRING); + $this->error(self::INVALID_LOCAL_PART); + + return false; + } + + /** + * @param string $localPart Address local part to validate. + * @return bool + */ + protected function validateInternationalizedLocalPart($localPart) + { + if ( + extension_loaded('intl') + && false === UConverter::transcode($localPart, 'UTF-8', 'UTF-8') + ) { + // invalid utf? + return false; + } + + $atext = 'a-zA-Z0-9\x21\x23\x24\x25\x26\x27\x2a\x2b\x2d\x2f\x3d\x3f\x5e\x5f\x60\x7b\x7c\x7d\x7e'; + // RFC 6532 extends atext to include non-ascii utf + // @see https://tools.ietf.org/html/rfc6532#section-3.1 + $uatext = $atext . '\x{80}-\x{FFFF}'; + return (bool) preg_match('/^[' . $uatext . ']+(\x2e+[' . $uatext . ']+)*$/u', $localPart); + } + + /** + * Returns the found MX Record information after validation including weight for further processing + * + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @return array + */ + public function getMXRecord() + { + return $this->mxRecord; + } + + /** + * Internal method to validate the servers MX records + * + * @return bool|string[] + * @psalm-return bool|list + */ + protected function validateMXRecords() + { + $mxHosts = []; + $weight = []; + $result = getmxrr($this->hostname, $mxHosts, $weight); + if (! empty($mxHosts) && ! empty($weight)) { + $this->mxRecord = array_combine($mxHosts, $weight) ?: []; + } else { + $this->mxRecord = []; + } + + arsort($this->mxRecord); + + // Fallback to IPv4 hosts if no MX record found (RFC 2821 SS 5). + if (! $result) { + $result = gethostbynamel($this->hostname); + if (is_array($result)) { + $this->mxRecord = array_flip($result); + } + } + + if ($result === false) { + $this->error(self::INVALID_MX_RECORD); + return false; + } + + if (! $this->options['useDeepMxCheck']) { + return $result; + } + + $validAddress = false; + $reserved = true; + foreach (array_keys($this->mxRecord) as $hostname) { + $res = $this->isReserved($hostname); + if (! $res) { + $reserved = false; + } + + if (trim($hostname) === '') { + continue; + } + + if ( + ! $res + && (checkdnsrr($hostname, 'A') + || checkdnsrr($hostname, 'AAAA') + || checkdnsrr($hostname, 'A6')) + ) { + $validAddress = true; + break; + } + } + + if (! $validAddress) { + $result = false; + $error = $reserved ? self::INVALID_SEGMENT : self::INVALID_MX_RECORD; + $this->error($error); + } + + return $result; + } + + /** + * Internal method to validate the hostname part of the email address + * + * @return bool|string[] + * @psalm-return bool|list + */ + protected function validateHostnamePart() + { + $hostname = $this->getHostnameValidator()->setTranslator($this->getTranslator()) + ->isValid($this->hostname); + if (! $hostname) { + $this->error(self::INVALID_HOSTNAME); + // Get messages and errors from hostnameValidator + foreach ($this->getHostnameValidator()->getMessages() as $code => $message) { + $this->abstractOptions['messages'][$code] = $message; + } + } elseif ($this->options['useMxCheck']) { + // MX check on hostname + $hostname = $this->validateMXRecords(); + } + + return $hostname; + } + + /** + * Splits the given value in hostname and local part of the email address + * + * @param string $value Email address to be split + * @return bool Returns false when the email can not be split + */ + protected function splitEmailParts($value) + { + $value = is_string($value) ? $value : ''; + + // Split email address up and disallow '..' + if ( + str_contains($value, '..') + || ! preg_match('/^(.+)@([^@]+)$/', $value, $matches) + ) { + return false; + } + + $this->localPart = $matches[1]; + $this->hostname = $this->idnToAscii($matches[2]); + + return true; + } + + /** + * Defined by Laminas\Validator\ValidatorInterface + * + * Returns true if and only if $value is a valid email address + * according to RFC2822 + * + * @link http://www.ietf.org/rfc/rfc2822.txt RFC2822 + * @link http://www.columbia.edu/kermit/ascii.html US-ASCII characters + * + * @param string $value + * @return bool + */ + public function isValid($value) + { + if (! is_string($value)) { + $this->error(self::INVALID); + return false; + } + + $length = true; + $this->setValue($value); + + // Split email address up and disallow '..' + if (! $this->splitEmailParts($this->getValue())) { + $this->error(self::INVALID_FORMAT); + return false; + } + + if ($this->getOption('strict') && (strlen($this->localPart) > 64) || (strlen($this->hostname) > 255)) { + $length = false; + $this->error(self::LENGTH_EXCEEDED); + } + + // Match hostname part + $hostname = false; + if ($this->options['useDomainCheck']) { + $hostname = $this->validateHostnamePart(); + } + + $local = $this->validateLocalPart(); + + // If both parts valid, return true + return ($local && $length) && (! $this->options['useDomainCheck'] || $hostname !== false); + } + + /** + * Safely convert UTF-8 encoded domain name to ASCII + * + * @param string $email the UTF-8 encoded email + * @return string + */ + protected function idnToAscii($email) + { + if (extension_loaded('intl')) { + if (defined('INTL_IDNA_VARIANT_UTS46')) { + $value = idn_to_ascii($email, 0, INTL_IDNA_VARIANT_UTS46); + + return $value !== false ? $value : $email; + } + $value = idn_to_ascii($email); + + return $value !== false ? $value : $email; + } + return $email; + } + + /** + * Safely convert ASCII encoded domain name to UTF-8 + * + * @param string $email the ASCII encoded email + * @return string + */ + protected function idnToUtf8($email) + { + if (strlen($email) === 0) { + return $email; + } + + if (extension_loaded('intl')) { + // The documentation does not clarify what kind of failure + // can happen in idn_to_utf8. One can assume if the source + // is not IDN encoded, it would fail, but it usually returns + // the source string in those cases. + // But not when the source string is long enough. + // Thus we default to source string ourselves. + if (defined('INTL_IDNA_VARIANT_UTS46')) { + $value = idn_to_utf8($email, 0, INTL_IDNA_VARIANT_UTS46); + + return $value !== false ? $value : $email; + } + $value = idn_to_utf8($email); + + return $value !== false ? $value : $email; + } + return $email; + } +} diff --git a/vendor/laminas/laminas-validator/src/Exception/BadMethodCallException.php b/vendor/laminas/laminas-validator/src/Exception/BadMethodCallException.php new file mode 100644 index 00000000..2896b12f --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Exception/BadMethodCallException.php @@ -0,0 +1,12 @@ + 'Invalid type given', + ]; + + /** @var array */ + protected $messageVariables = []; + + /** @var non-empty-string */ + protected $valueDelimiter = ','; + + /** @var ValidatorInterface|null */ + protected $validator; + + /** @var bool */ + protected $breakOnFirstFailure = false; + + /** + * Sets the delimiter string that the values will be split upon + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @param non-empty-string $delimiter + * @return $this + */ + public function setValueDelimiter($delimiter) + { + $this->valueDelimiter = $delimiter; + return $this; + } + + /** + * Returns the delimiter string that the values will be split upon + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @return non-empty-string + */ + public function getValueDelimiter() + { + return $this->valueDelimiter; + } + + /** + * Set validator plugin manager + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @return void + */ + public function setValidatorPluginManager(ValidatorPluginManager $pluginManager) + { + $this->pluginManager = $pluginManager; + } + + /** + * Get validator plugin manager + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @return ValidatorPluginManager + */ + public function getValidatorPluginManager() + { + if (! $this->pluginManager) { + $this->pluginManager = new ValidatorPluginManager(new ServiceManager()); + } + + return $this->pluginManager; + } + + /** + * Sets the Validator for validating each value + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @param ValidatorInterface|ValidatorSpecification $validator + * @return $this + * @throws Exception\RuntimeException + */ + public function setValidator($validator) + { + if (is_array($validator)) { + if (! isset($validator['name'])) { + throw new Exception\RuntimeException( + 'Invalid validator specification provided; does not include "name" key' + ); + } + $name = $validator['name']; + $options = $validator['options'] ?? []; + /** @psalm-suppress MixedAssignment $validator */ + $validator = $this->getValidatorPluginManager()->get($name, $options); + } + + if (! $validator instanceof ValidatorInterface) { + throw new Exception\RuntimeException( + 'Invalid validator given' + ); + } + + $this->validator = $validator; + return $this; + } + + /** + * Gets the Validator for validating each value + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @return ValidatorInterface|null + */ + public function getValidator() + { + return $this->validator; + } + + /** + * Set break on first failure setting + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @param bool $break + * @return $this + */ + public function setBreakOnFirstFailure($break) + { + $this->breakOnFirstFailure = (bool) $break; + return $this; + } + + /** + * Get break on first failure setting + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @return bool + */ + public function isBreakOnFirstFailure() + { + return $this->breakOnFirstFailure; + } + + /** + * Defined by Laminas\Validator\ValidatorInterface + * + * Returns true if all values validate true + * + * @param mixed $value + * @param mixed $context Extra "context" to provide the composed validator + * @return bool + * @throws Exception\RuntimeException + */ + public function isValid($value, $context = null) + { + $this->setValue($value); + + if ($value instanceof Traversable) { + $value = ArrayUtils::iteratorToArray($value); + } + + if (is_array($value)) { + $values = $value; + } elseif (is_string($value)) { + $delimiter = $this->getValueDelimiter(); + // Skip explode if delimiter is null, + // used when value is expected to be either an + // array when multiple values and a string for + // single values (ie. MultiCheckbox form behavior) + $values = null !== $delimiter + ? explode($this->valueDelimiter, $value) + : [$value]; + } else { + $values = [$value]; + } + + $validator = $this->getValidator(); + + if (! $validator) { + throw new Exception\RuntimeException(sprintf( + '%s expects a validator to be set; none given', + __METHOD__ + )); + } + + foreach ($values as $value) { + if (! $validator->isValid($value, $context)) { + $this->abstractOptions['messages'][] = $validator->getMessages(); + + if ($this->isBreakOnFirstFailure()) { + return false; + } + } + } + + return $this->abstractOptions['messages'] === []; + } +} diff --git a/vendor/laminas/laminas-validator/src/File/Count.php b/vendor/laminas/laminas-validator/src/File/Count.php new file mode 100644 index 00000000..99311efb --- /dev/null +++ b/vendor/laminas/laminas-validator/src/File/Count.php @@ -0,0 +1,294 @@ + "Too many files, maximum '%max%' are allowed but '%count%' are given", + self::TOO_FEW => "Too few files, minimum '%min%' are expected but '%count%' are given", + ]; + + /** @var array Error message template variables */ + protected $messageVariables = [ + 'min' => ['options' => 'min'], + 'max' => ['options' => 'max'], + 'count' => 'count', + ]; + + /** + * Actual filecount + * + * @var int + */ + protected $count; + + /** + * Internal file array + * + * @var array + */ + protected $files; + + /** + * Options for this validator + * + * @var array + */ + protected $options = [ + 'min' => null, // Minimum file count, if null there is no minimum file count + 'max' => null, // Maximum file count, if null there is no maximum file count + ]; + + /** + * Sets validator options + * + * Min limits the file count, when used with max=null it is the maximum file count + * It also accepts an array with the keys 'min' and 'max' + * + * If $options is an integer, it will be used as maximum file count + * As Array is accepts the following keys: + * 'min': Minimum filecount + * 'max': Maximum filecount + * + * @param int|array|Traversable $options Options for the adapter + */ + public function __construct($options = null) + { + if (1 < func_num_args()) { + $args = func_get_args(); + $options = [ + 'min' => array_shift($args), + 'max' => array_shift($args), + ]; + } + + if (is_string($options) || is_numeric($options)) { + $options = ['max' => $options]; + } + + parent::__construct($options); + } + + /** + * Returns the minimum file count + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @return int + */ + public function getMin() + { + return $this->options['min']; + } + + /** + * Sets the minimum file count + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param int|array $min The minimum file count + * @return $this Provides a fluent interface + * @throws Exception\InvalidArgumentException When min is greater than max. + */ + public function setMin($min) + { + if (is_array($min) && isset($min['min'])) { + $min = $min['min']; + } + + if (! is_numeric($min)) { + throw new Exception\InvalidArgumentException('Invalid options to validator provided'); + } + + $min = (int) $min; + if (($this->getMax() !== null) && ($min > $this->getMax())) { + throw new Exception\InvalidArgumentException( + "The minimum must be less than or equal to the maximum file count, but {$min} > {$this->getMax()}" + ); + } + + $this->options['min'] = $min; + return $this; + } + + /** + * Returns the maximum file count + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @return int + */ + public function getMax() + { + return $this->options['max']; + } + + /** + * Sets the maximum file count + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param int|array $max The maximum file count + * @return $this Provides a fluent interface + * @throws Exception\InvalidArgumentException When max is smaller than min. + */ + public function setMax($max) + { + if (is_array($max) && isset($max['max'])) { + $max = $max['max']; + } + + if (! is_numeric($max)) { + throw new Exception\InvalidArgumentException('Invalid options to validator provided'); + } + + $max = (int) $max; + if (($this->getMin() !== null) && ($max < $this->getMin())) { + throw new Exception\InvalidArgumentException( + "The maximum must be greater than or equal to the minimum file count, but {$max} < {$this->getMin()}" + ); + } + + $this->options['max'] = $max; + return $this; + } + + /** + * Adds a file for validation + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param string|array|UploadedFileInterface $file + * @return $this + */ + public function addFile($file) + { + if (is_string($file)) { + $file = [$file]; + } + + if (is_array($file)) { + foreach ($file as $name) { + if (! isset($this->files[$name]) && ! empty($name)) { + $this->files[$name] = $name; + } + } + } + + if ($file instanceof UploadedFileInterface && is_string($file->getClientFilename())) { + $this->files[(string) $file->getClientFilename()] = $file->getClientFilename(); + } + + return $this; + } + + /** + * Returns true if and only if the file count of all checked files is at least min and + * not bigger than max (when max is not null). Attention: When checking with set min you + * must give all files with the first call, otherwise you will get a false. + * + * @param string|array|UploadedFileInterface $value Filenames to check for count + * @param array $file File data from \Laminas\File\Transfer\Transfer + * @return bool + */ + public function isValid($value, $file = null) + { + if ($this->isUploadedFilterInterface($value)) { + $this->addFile($value); + } elseif ($file !== null) { + if (! array_key_exists('destination', $file)) { + $file['destination'] = dirname($value); + } + + if (array_key_exists('tmp_name', $file)) { + $value = $file['destination'] . DIRECTORY_SEPARATOR . $file['name']; + } + } + + if (($file === null) || ! empty($file['tmp_name'])) { + $this->addFile($value); + } + + $this->count = count($this->files); + + if (($this->getMax() !== null) && ($this->count > $this->getMax())) { + return $this->throwError($file, self::TOO_MANY); + } + + if (($this->getMin() !== null) && ($this->count < $this->getMin())) { + return $this->throwError($file, self::TOO_FEW); + } + + return true; + } + + /** + * Throws an error of the given type + * + * @param string|null|array $file + * @param string $errorType + * @return false + */ + protected function throwError($file, $errorType) + { + if ($file !== null) { + if (is_array($file)) { + if (array_key_exists('name', $file)) { + $this->value = $file['name']; + } + } elseif (is_string($file)) { + $this->value = $file; + } + } + + $this->error($errorType); + return false; + } + + /** + * Checks if the type of uploaded file is UploadedFileInterface. + * + * @param string|array|UploadedFileInterface $value Filenames to check for count + * @return bool + */ + private function isUploadedFilterInterface($value) + { + if ($value instanceof UploadedFileInterface) { + return true; + } + + return false; + } +} diff --git a/vendor/laminas/laminas-validator/src/File/Crc32.php b/vendor/laminas/laminas-validator/src/File/Crc32.php new file mode 100644 index 00000000..303e4386 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/File/Crc32.php @@ -0,0 +1,120 @@ + 'File does not match the given crc32 hashes', + self::NOT_DETECTED => 'A crc32 hash could not be evaluated for the given file', + self::NOT_FOUND => 'File is not readable or does not exist', + ]; + + /** + * Options for this validator + * + * @var string + */ + protected $options = [ + 'algorithm' => 'crc32', + 'hash' => null, + ]; + + /** + * Returns all set crc32 hashes + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @return array + */ + public function getCrc32() + { + return $this->getHash(); + } + + /** + * Sets the crc32 hash for one or multiple files + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param string|array $options + * @return $this Provides a fluent interface + */ + public function setCrc32($options) + { + $this->setHash($options); + return $this; + } + + /** + * Adds the crc32 hash for one or multiple files + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param string|array $options + * @return $this Provides a fluent interface + */ + public function addCrc32($options) + { + $this->addHash($options); + return $this; + } + + /** + * Returns true if and only if the given file confirms the set hash + * + * @param string|array $value Filename to check for hash + * @param array $file File data from \Laminas\File\Transfer\Transfer (optional) + * @return bool + */ + public function isValid($value, $file = null) + { + $fileInfo = $this->getFileInfo($value, $file); + + $this->setValue($fileInfo['filename']); + + // Is file readable ? + if (empty($fileInfo['file']) || false === is_readable($fileInfo['file'])) { + $this->error(self::NOT_FOUND); + return false; + } + + $hashes = array_unique(array_keys($this->getHash())); + $filehash = hash_file('crc32', $fileInfo['file']); + if ($filehash === false) { + $this->error(self::NOT_DETECTED); + return false; + } + + foreach ($hashes as $hash) { + if ($filehash === $hash) { + return true; + } + } + + $this->error(self::DOES_NOT_MATCH); + return false; + } +} diff --git a/vendor/laminas/laminas-validator/src/File/ExcludeExtension.php b/vendor/laminas/laminas-validator/src/File/ExcludeExtension.php new file mode 100644 index 00000000..684af768 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/File/ExcludeExtension.php @@ -0,0 +1,74 @@ + 'File has an incorrect extension', + self::NOT_FOUND => 'File is not readable or does not exist', + ]; + + /** + * Returns true if and only if the file extension of $value is not included in the + * set extension list + * + * @param string|array $value Real file to check for extension + * @param array $file File data from \Laminas\File\Transfer\Transfer (optional) + * @return bool + */ + public function isValid($value, $file = null) + { + $fileInfo = $this->getFileInfo($value, $file); + + // Is file readable ? + if ( + ! $this->getAllowNonExistentFile() + && (empty($fileInfo['file']) || false === is_readable($fileInfo['file'])) + ) { + $this->error(self::NOT_FOUND); + return false; + } + + $this->setValue($fileInfo['filename']); + + $extension = substr($fileInfo['filename'], strrpos($fileInfo['filename'], '.') + 1); + $extensions = $this->getExtension(); + + if ($this->getCase() && (! in_array($extension, $extensions))) { + return true; + } elseif (! $this->getCase()) { + foreach ($extensions as $ext) { + if (strtolower($ext) === strtolower($extension)) { + $this->error(self::FALSE_EXTENSION); + return false; + } + } + + return true; + } + + $this->error(self::FALSE_EXTENSION); + return false; + } +} diff --git a/vendor/laminas/laminas-validator/src/File/ExcludeMimeType.php b/vendor/laminas/laminas-validator/src/File/ExcludeMimeType.php new file mode 100644 index 00000000..682b559d --- /dev/null +++ b/vendor/laminas/laminas-validator/src/File/ExcludeMimeType.php @@ -0,0 +1,102 @@ + "File has an incorrect mimetype of '%type%'", + self::NOT_DETECTED => 'The mimetype could not be detected from the file', + self::NOT_READABLE => 'File is not readable or does not exist', + ]; + + /** + * Returns true if the mimetype of the file does not matche the given ones. Also parts + * of mimetypes can be checked. If you give for example "image" all image + * mime types will not be accepted like "image/gif", "image/jpeg" and so on. + * + * @param string|array|UploadedFileInterface $value Real file to check for mimetype + * @param array $file File data from \Laminas\File\Transfer\Transfer (optional) + * @return bool + */ + public function isValid($value, $file = null) + { + $fileInfo = $this->getFileInfo($value, $file, true); + + $this->setValue($fileInfo['filename']); + + // Is file readable ? + if (empty($fileInfo['file']) || false === is_readable($fileInfo['file'])) { + $this->error(self::NOT_READABLE); + return false; + } + + $mimefile = $this->getMagicFile(); + if (class_exists('finfo', false)) { + if (! $this->isMagicFileDisabled() && (is_string($mimefile) && empty($this->finfo))) { + $this->finfo = finfo_open(FILEINFO_MIME_TYPE, $mimefile); + } + + if (empty($this->finfo)) { + $this->finfo = finfo_open(FILEINFO_MIME_TYPE); + } + + $this->type = null; + if (! empty($this->finfo)) { + $this->type = finfo_file($this->finfo, $fileInfo['file']); + } + } + + if (! is_string($this->type) && $this->getHeaderCheck()) { + $this->type = $fileInfo['filetype']; + } + + if (! is_string($this->type)) { + $this->error(self::NOT_DETECTED); + return false; + } + + $mimetype = $this->getMimeType(true); + if (in_array($this->type, $mimetype)) { + $this->error(self::FALSE_TYPE); + return false; + } + + $types = explode('/', $this->type); + $types = array_merge($types, explode('-', $this->type)); + $types = array_merge($types, explode(';', $this->type)); + foreach ($mimetype as $mime) { + if (in_array($mime, $types)) { + $this->error(self::FALSE_TYPE); + return false; + } + } + + return true; + } +} diff --git a/vendor/laminas/laminas-validator/src/File/Exists.php b/vendor/laminas/laminas-validator/src/File/Exists.php new file mode 100644 index 00000000..fc9bf858 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/File/Exists.php @@ -0,0 +1,189 @@ + 'File does not exist', + ]; + + /** + * Options for this validator + * + * @var array + */ + protected $options = [ + 'directory' => null, // internal list of directories + ]; + + /** @var array Error message template variables */ + protected $messageVariables = [ + 'directory' => ['options' => 'directory'], + ]; + + /** + * Sets validator options + * + * @param string|array|Traversable $options + */ + public function __construct($options = null) + { + if (is_string($options)) { + $options = explode(',', $options); + } + + if (is_array($options) && ! array_key_exists('directory', $options)) { + $options = ['directory' => $options]; + } + + parent::__construct($options); + } + + /** + * Returns the set file directories which are checked + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param bool $asArray Returns the values as array; when false, a concatenated string is returned + * @return string|null + */ + public function getDirectory($asArray = false) + { + $asArray = (bool) $asArray; + $directory = $this->options['directory']; + if ($asArray && isset($directory)) { + $directory = explode(',', (string) $directory); + } + + return $directory; + } + + /** + * Sets the file directory which will be checked + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param string|array $directory The directories to validate + * @return self Provides a fluent interface + */ + public function setDirectory($directory) + { + $this->options['directory'] = null; + $this->addDirectory($directory); + return $this; + } + + /** + * Adds the file directory which will be checked + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param string|array $directory The directory to add for validation + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function addDirectory($directory) + { + $directories = $this->getDirectory(true); + if (! isset($directories)) { + $directories = []; + } + + if (is_string($directory)) { + $directory = explode(',', $directory); + } elseif (! is_array($directory)) { + throw new Exception\InvalidArgumentException('Invalid options to validator provided'); + } + + foreach ($directory as $content) { + if (empty($content) || ! is_string($content)) { + continue; + } + + $directories[] = trim($content); + } + $directories = array_unique($directories); + + // Sanity check to ensure no empty values + foreach ($directories as $key => $dir) { + if (empty($dir)) { + unset($directories[$key]); + } + } + + $this->options['directory'] = ! empty($directory) + ? implode(',', $directories) : null; + + return $this; + } + + /** + * Returns true if and only if the file already exists in the set directories + * + * @param string|array $value Real file to check for existence + * @param array $file File data from \Laminas\File\Transfer\Transfer (optional) + * @return bool + */ + public function isValid($value, $file = null) + { + $fileInfo = $this->getFileInfo($value, $file, false, true); + + $this->setValue($fileInfo['filename']); + + $check = false; + $directories = $this->getDirectory(true); + if (! isset($directories)) { + $check = true; + if (! file_exists($fileInfo['file'])) { + $this->error(self::DOES_NOT_EXIST); + return false; + } + } else { + foreach ($directories as $directory) { + if (! isset($directory) || '' === $directory) { + continue; + } + + $check = true; + if (! file_exists($directory . DIRECTORY_SEPARATOR . $fileInfo['basename'])) { + $this->error(self::DOES_NOT_EXIST); + return false; + } + } + } + + if (! $check) { + $this->error(self::DOES_NOT_EXIST); + return false; + } + + return true; + } +} diff --git a/vendor/laminas/laminas-validator/src/File/Extension.php b/vendor/laminas/laminas-validator/src/File/Extension.php new file mode 100644 index 00000000..3118eecb --- /dev/null +++ b/vendor/laminas/laminas-validator/src/File/Extension.php @@ -0,0 +1,256 @@ + Error message templates */ + protected $messageTemplates = [ + self::FALSE_EXTENSION => 'File has an incorrect extension', + self::NOT_FOUND => 'File is not readable or does not exist', + ]; + + /** + * Options for this validator + * + * @var array + */ + protected $options = [ + 'case' => false, // Validate case sensitive + 'extension' => '', // List of extensions + 'allowNonExistentFile' => false, // Allow validation even if file does not exist + ]; + + /** @var array Error message template variables */ + protected $messageVariables = [ + 'extension' => ['options' => 'extension'], + ]; + + /** + * Sets validator options + * + * @param string|array|Traversable $options + */ + public function __construct($options = null) + { + if ($options instanceof Traversable) { + $options = ArrayUtils::iteratorToArray($options); + } + + $case = null; + if (1 < func_num_args()) { + $case = func_get_arg(1); + } + + if (is_array($options)) { + if (isset($options['case'])) { + $case = $options['case']; + unset($options['case']); + } + + if (! array_key_exists('extension', $options)) { + $options = ['extension' => $options]; + } + } else { + $options = ['extension' => $options]; + } + + if ($case !== null) { + $options['case'] = $case; + } + + parent::__construct($options); + } + + /** + * Returns the case option + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @return bool + */ + public function getCase() + { + return $this->options['case']; + } + + /** + * Sets the case to use + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param bool $case + * @return $this Provides a fluent interface + */ + public function setCase($case) + { + $this->options['case'] = (bool) $case; + return $this; + } + + /** + * Returns the set file extension + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @return array + */ + public function getExtension() + { + if ( + ! array_key_exists('extension', $this->options) + || ! is_string($this->options['extension']) + ) { + return []; + } + + return explode(',', $this->options['extension']); + } + + /** + * Sets the file extensions + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param string|array $extension The extensions to validate + * @return $this Provides a fluent interface + */ + public function setExtension($extension) + { + $this->options['extension'] = null; + $this->addExtension($extension); + return $this; + } + + /** + * Adds the file extensions + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param string|array $extension The extensions to add for validation + * @return $this Provides a fluent interface + */ + public function addExtension($extension) + { + $extensions = $this->getExtension(); + if (is_string($extension)) { + $extension = explode(',', $extension); + } + + foreach ($extension as $content) { + if (empty($content) || ! is_string($content)) { + continue; + } + + $extensions[] = trim($content); + } + + $extensions = array_unique($extensions); + + // Sanity check to ensure no empty values + foreach ($extensions as $key => $ext) { + if (empty($ext)) { + unset($extensions[$key]); + } + } + + $this->options['extension'] = implode(',', $extensions); + return $this; + } + + /** + * Returns whether or not to allow validation of non-existent files. + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @return bool + */ + public function getAllowNonExistentFile() + { + return $this->options['allowNonExistentFile']; + } + + /** + * Sets the flag indicating whether or not to allow validation of non-existent files. + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param bool $flag Whether or not to allow validation of non-existent files. + * @return $this Provides a fluent interface + */ + public function setAllowNonExistentFile($flag) + { + $this->options['allowNonExistentFile'] = (bool) $flag; + return $this; + } + + /** + * Returns true if and only if the file extension of $value is included in the + * set extension list + * + * @param string|array $value Real file to check for extension + * @param array $file File data from \Laminas\File\Transfer\Transfer (optional) + * @return bool + */ + public function isValid($value, $file = null) + { + $fileInfo = $this->getFileInfo($value, $file); + + // Is file readable ? + if ( + ! $this->getAllowNonExistentFile() + && (empty($fileInfo['file']) || false === is_readable($fileInfo['file'])) + ) { + $this->error(self::NOT_FOUND); + return false; + } + + $this->setValue($fileInfo['filename']); + + $extension = substr($fileInfo['filename'], strrpos($fileInfo['filename'], '.') + 1); + $extensions = $this->getExtension(); + + if ($this->getCase() && (in_array($extension, $extensions))) { + return true; + } elseif (! $this->getCase()) { + foreach ($extensions as $ext) { + if (strtolower($ext) === strtolower($extension)) { + return true; + } + } + } + + $this->error(self::FALSE_EXTENSION); + return false; + } +} diff --git a/vendor/laminas/laminas-validator/src/File/FileInformationTrait.php b/vendor/laminas/laminas-validator/src/File/FileInformationTrait.php new file mode 100644 index 00000000..8c3092ab --- /dev/null +++ b/vendor/laminas/laminas-validator/src/File/FileInformationTrait.php @@ -0,0 +1,167 @@ +getLegacyFileInfo($file, $hasType, $hasBasename); + } + + if (is_array($value)) { + return $this->getSapiFileInfo($value, $hasType, $hasBasename); + } + + if ($value instanceof UploadedFileInterface) { + return $this->getPsr7FileInfo($value, $hasType, $hasBasename); + } + + return $this->getFileBasedFileInfo($value, $hasType, $hasBasename); + } + + /** + * Generate file information array with legacy Laminas_File_Transfer API + * + * @param array $file File data + * @param bool $hasType Return with filetype + * @param bool $hasBasename Basename is calculated from location path + * @return array + */ + private function getLegacyFileInfo( + array $file, + $hasType = false, + $hasBasename = false + ) { + $fileInfo = []; + + $fileInfo['filename'] = $file['name']; + $fileInfo['file'] = $file['tmp_name']; + + if ($hasBasename) { + $fileInfo['basename'] = basename($fileInfo['file']); + } + + if ($hasType) { + $fileInfo['filetype'] = $file['type']; + } + + return $fileInfo; + } + + /** + * Generate file information array with SAPI + * + * @param array $file File data from SAPI + * @param bool $hasType Return with filetype + * @param bool $hasBasename Filename is calculated from location path + * @return array + */ + private function getSapiFileInfo( + array $file, + $hasType = false, + $hasBasename = false + ) { + if (! isset($file['tmp_name']) || ! isset($file['name'])) { + throw new Exception\InvalidArgumentException( + 'Value array must be in $_FILES format' + ); + } + + $fileInfo = []; + + $fileInfo['file'] = $file['tmp_name']; + $fileInfo['filename'] = $file['name']; + + if ($hasBasename) { + $fileInfo['basename'] = basename($fileInfo['file']); + } + + if ($hasType) { + $fileInfo['filetype'] = $file['type']; + } + + return $fileInfo; + } + + /** + * Generate file information array with PSR-7 UploadedFileInterface + * + * @param bool $hasType Return with filetype + * @param bool $hasBasename Filename is calculated from location path + * @return array + */ + private function getPsr7FileInfo( + UploadedFileInterface $file, + $hasType = false, + $hasBasename = false + ) { + $fileInfo = []; + + $fileInfo['file'] = $file->getStream()->getMetadata('uri'); + $fileInfo['filename'] = $file->getClientFilename(); + + if ($hasBasename) { + $fileInfo['basename'] = basename($fileInfo['file']); + } + + if ($hasType) { + $fileInfo['filetype'] = $file->getClientMediaType(); + } + + return $fileInfo; + } + + /** + * Generate file information array with base method + * + * @param string $file File path + * @param bool $hasType Return with filetype + * @param bool $hasBasename Filename is calculated from location path + * @return array + */ + private function getFileBasedFileInfo( + $file, + $hasType = false, + $hasBasename = false + ) { + $fileInfo = []; + + $fileInfo['file'] = $file; + $fileInfo['filename'] = basename($fileInfo['file']); + + if ($hasBasename) { + $fileInfo['basename'] = basename($fileInfo['file']); + } + + if ($hasType) { + $fileInfo['filetype'] = null; + } + + return $fileInfo; + } +} diff --git a/vendor/laminas/laminas-validator/src/File/FilesSize.php b/vendor/laminas/laminas-validator/src/File/FilesSize.php new file mode 100644 index 00000000..029aa40a --- /dev/null +++ b/vendor/laminas/laminas-validator/src/File/FilesSize.php @@ -0,0 +1,186 @@ + "All files in sum should have a maximum size of '%max%' but '%size%' were detected", + self::TOO_SMALL => "All files in sum should have a minimum size of '%min%' but '%size%' were detected", + self::NOT_READABLE => 'One or more files can not be read', + ]; + + /** + * Internal file array + * + * @var array + */ + protected $files; + + /** + * Sets validator options + * + * Min limits the used disk space for all files, when used with max=null it is the maximum file size + * It also accepts an array with the keys 'min' and 'max' + * + * @param int|array|Traversable $options Options for this validator + * @throws InvalidArgumentException + */ + public function __construct($options = null) + { + $this->files = []; + $this->setSize(0); + + if ($options instanceof Traversable) { + $options = ArrayUtils::iteratorToArray($options); + } elseif (is_scalar($options)) { + $options = ['max' => $options]; + } elseif (! is_array($options)) { + throw new Exception\InvalidArgumentException('Invalid options to validator provided'); + } + + if (1 < func_num_args()) { + $argv = func_get_args(); + array_shift($argv); + $options['max'] = array_shift($argv); + if (! empty($argv)) { + $options['useByteString'] = array_shift($argv); + } + } + + parent::__construct($options); + } + + /** + * Returns true if and only if the disk usage of all files is at least min and + * not bigger than max (when max is not null). + * + * @param string|array $value Real file to check for size + * @param array $file File data from \Laminas\File\Transfer\Transfer + * @return bool + */ + public function isValid($value, $file = null) + { + if (is_string($value)) { + $value = [$value]; + } elseif (is_array($value) && isset($value['tmp_name'])) { + $value = [$value]; + } + + $min = $this->getMin(true); + $max = $this->getMax(true); + $size = $this->getSize(); + foreach ($value as $files) { + if (is_array($files)) { + if (! isset($files['tmp_name']) || ! isset($files['name'])) { + throw new Exception\InvalidArgumentException( + 'Value array must be in $_FILES format' + ); + } + $file = $files; + $files = $files['tmp_name']; + } + + // Is file readable ? + if (empty($files) || false === is_readable($files)) { + $this->throwError($file, self::NOT_READABLE); + continue; + } + + if (! isset($this->files[$files])) { + $this->files[$files] = $files; + } else { + // file already counted... do not count twice + continue; + } + + // limited to 2GB files + ErrorHandler::start(); + $size += filesize($files); + ErrorHandler::stop(); + $this->size = $size; + if (($max !== null) && ($max < $size)) { + if ($this->getByteString()) { + $this->options['max'] = $this->toByteString($max); + $this->size = $this->toByteString($size); + $this->throwError($file, self::TOO_BIG); + $this->options['max'] = $max; + $this->size = $size; + } else { + $this->throwError($file, self::TOO_BIG); + } + } + } + + // Check that aggregate files are >= minimum size + if (($min !== null) && ($size < $min)) { + if ($this->getByteString()) { + $this->options['min'] = $this->toByteString($min); + $this->size = $this->toByteString($size); + $this->throwError($file, self::TOO_SMALL); + $this->options['min'] = $min; + $this->size = $size; + } else { + $this->throwError($file, self::TOO_SMALL); + } + } + + if ($this->getMessages()) { + return false; + } + + return true; + } + + /** + * Throws an error of the given type + * + * @param string|null|array $file + * @param string $errorType + * @return false + */ + protected function throwError($file, $errorType) + { + if ($file !== null) { + if (is_array($file)) { + if (array_key_exists('name', $file)) { + $this->value = $file['name']; + } + } elseif (is_string($file)) { + $this->value = $file; + } + } + + $this->error($errorType); + return false; + } +} diff --git a/vendor/laminas/laminas-validator/src/File/Hash.php b/vendor/laminas/laminas-validator/src/File/Hash.php new file mode 100644 index 00000000..e9d1d0a2 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/File/Hash.php @@ -0,0 +1,181 @@ + 'File does not match the given hashes', + self::NOT_DETECTED => 'A hash could not be evaluated for the given file', + self::NOT_FOUND => 'File is not readable or does not exist', + ]; + + /** + * Options for this validator + * + * @var string + */ + protected $options = [ + 'algorithm' => 'crc32', + 'hash' => null, + ]; + + /** + * Sets validator options + * + * @param string|array $options + */ + public function __construct($options = null) + { + if ( + is_scalar($options) || + (is_array($options) && ! array_key_exists('hash', $options)) + ) { + $options = ['hash' => $options]; + } + + if (1 < func_num_args()) { + $options['algorithm'] = func_get_arg(1); + } + + parent::__construct($options); + } + + /** + * Returns the set hash values as array, the hash as key and the algorithm the value + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @return array + */ + public function getHash() + { + return $this->options['hash']; + } + + /** + * Sets the hash for one or multiple files + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param string|array $options + * @return $this Provides a fluent interface + */ + public function setHash($options) + { + $this->options['hash'] = null; + $this->addHash($options); + + return $this; + } + + /** + * Adds the hash for one or multiple files + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param string|array $options + * @return $this Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function addHash($options) + { + if (is_string($options)) { + $options = [$options]; + } elseif (! is_array($options)) { + throw new Exception\InvalidArgumentException('False parameter given'); + } + + $known = hash_algos(); + if (! isset($options['algorithm'])) { + $algorithm = $this->options['algorithm']; + } else { + $algorithm = $options['algorithm']; + unset($options['algorithm']); + } + + if (! in_array($algorithm, $known)) { + throw new Exception\InvalidArgumentException("Unknown algorithm '{$algorithm}'"); + } + + foreach ($options as $value) { + if (! is_string($value)) { + throw new Exception\InvalidArgumentException(sprintf( + 'Hash must be a string, %s received', + get_debug_type($value) + )); + } + $this->options['hash'][$value] = $algorithm; + } + + return $this; + } + + /** + * Returns true if and only if the given file confirms the set hash + * + * @param string|array $value File to check for hash + * @param array $file File data from \Laminas\File\Transfer\Transfer (optional) + * @return bool + */ + public function isValid($value, $file = null) + { + $fileInfo = $this->getFileInfo($value, $file); + + $this->setValue($fileInfo['filename']); + + // Is file readable ? + if (empty($fileInfo['file']) || false === is_readable($fileInfo['file'])) { + $this->error(self::NOT_FOUND); + return false; + } + + $algos = array_unique(array_values($this->getHash())); + foreach ($algos as $algorithm) { + $filehash = hash_file($algorithm, $fileInfo['file']); + + if ($filehash === false) { + $this->error(self::NOT_DETECTED); + return false; + } + + if (isset($this->getHash()[$filehash]) && $this->getHash()[$filehash] === $algorithm) { + return true; + } + } + + $this->error(self::DOES_NOT_MATCH); + return false; + } +} diff --git a/vendor/laminas/laminas-validator/src/File/ImageSize.php b/vendor/laminas/laminas-validator/src/File/ImageSize.php new file mode 100644 index 00000000..216814b3 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/File/ImageSize.php @@ -0,0 +1,407 @@ + "Maximum allowed width for image should be '%maxwidth%' but '%width%' detected", + self::WIDTH_TOO_SMALL => "Minimum expected width for image should be '%minwidth%' but '%width%' detected", + self::HEIGHT_TOO_BIG => "Maximum allowed height for image should be '%maxheight%' but '%height%' detected", + self::HEIGHT_TOO_SMALL => "Minimum expected height for image should be '%minheight%' but '%height%' detected", + self::NOT_DETECTED => 'The size of image could not be detected', + self::NOT_READABLE => 'File is not readable or does not exist', + ]; + + /** @var array Error message template variables */ + protected $messageVariables = [ + 'minwidth' => ['options' => 'minWidth'], + 'maxwidth' => ['options' => 'maxWidth'], + 'minheight' => ['options' => 'minHeight'], + 'maxheight' => ['options' => 'maxHeight'], + 'width' => 'width', + 'height' => 'height', + ]; + + /** + * Detected width + * + * @var int + */ + protected $width; + + /** + * Detected height + * + * @var int + */ + protected $height; + + /** + * Options for this validator + * + * @var array + */ + protected $options = [ + 'minWidth' => null, // Minimum image width + 'maxWidth' => null, // Maximum image width + 'minHeight' => null, // Minimum image height + 'maxHeight' => null, // Maximum image height + ]; + + /** + * Sets validator options + * + * Accepts the following option keys: + * - minheight + * - minwidth + * - maxheight + * - maxwidth + * + * @param null|array|Traversable $options + */ + public function __construct($options = null) + { + if (1 < func_num_args()) { + if (! is_array($options)) { + $options = ['minWidth' => $options]; + } + + $argv = func_get_args(); + array_shift($argv); + $options['minHeight'] = array_shift($argv); + if (! empty($argv)) { + $options['maxWidth'] = array_shift($argv); + if (! empty($argv)) { + $options['maxHeight'] = array_shift($argv); + } + } + } + + parent::__construct($options); + } + + /** + * Returns the minimum allowed width + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @return int + */ + public function getMinWidth() + { + return $this->options['minWidth']; + } + + /** + * Sets the minimum allowed width + * + * @param int $minWidth + * @return $this Provides a fluid interface + * @throws Exception\InvalidArgumentException When minwidth is greater than maxwidth. + */ + public function setMinWidth($minWidth) + { + if (($this->getMaxWidth() !== null) && ($minWidth > $this->getMaxWidth())) { + throw new Exception\InvalidArgumentException( + 'The minimum image width must be less than or equal to the ' + . " maximum image width, but {$minWidth} > {$this->getMaxWidth()}" + ); + } + + $this->options['minWidth'] = (int) $minWidth; + return $this; + } + + /** + * Returns the maximum allowed width + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @return int + */ + public function getMaxWidth() + { + return $this->options['maxWidth']; + } + + /** + * Sets the maximum allowed width + * + * @param int $maxWidth + * @return $this Provides a fluid interface + * @throws Exception\InvalidArgumentException When maxwidth is less than minwidth. + */ + public function setMaxWidth($maxWidth) + { + if (($this->getMinWidth() !== null) && ($maxWidth < $this->getMinWidth())) { + throw new Exception\InvalidArgumentException( + 'The maximum image width must be greater than or equal to the ' + . "minimum image width, but {$maxWidth} < {$this->getMinWidth()}" + ); + } + + $this->options['maxWidth'] = (int) $maxWidth; + return $this; + } + + /** + * Returns the minimum allowed height + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @return int + */ + public function getMinHeight() + { + return $this->options['minHeight']; + } + + /** + * Sets the minimum allowed height + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param int $minHeight + * @return $this Provides a fluid interface + * @throws Exception\InvalidArgumentException When minheight is greater than maxheight. + */ + public function setMinHeight($minHeight) + { + if (($this->getMaxHeight() !== null) && ($minHeight > $this->getMaxHeight())) { + throw new Exception\InvalidArgumentException( + 'The minimum image height must be less than or equal to the ' + . " maximum image height, but {$minHeight} > {$this->getMaxHeight()}" + ); + } + + $this->options['minHeight'] = (int) $minHeight; + return $this; + } + + /** + * Returns the maximum allowed height + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @return int + */ + public function getMaxHeight() + { + return $this->options['maxHeight']; + } + + /** + * Sets the maximum allowed height + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param int $maxHeight + * @return $this Provides a fluid interface + * @throws Exception\InvalidArgumentException When maxheight is less than minheight. + */ + public function setMaxHeight($maxHeight) + { + if (($this->getMinHeight() !== null) && ($maxHeight < $this->getMinHeight())) { + throw new Exception\InvalidArgumentException( + 'The maximum image height must be greater than or equal to the ' + . "minimum image height, but {$maxHeight} < {$this->getMinHeight()}" + ); + } + + $this->options['maxHeight'] = (int) $maxHeight; + return $this; + } + + /** + * Returns the set minimum image sizes + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @return array + */ + public function getImageMin() + { + return ['minWidth' => $this->getMinWidth(), 'minHeight' => $this->getMinHeight()]; + } + + /** + * Returns the set maximum image sizes + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @return array + */ + public function getImageMax() + { + return ['maxWidth' => $this->getMaxWidth(), 'maxHeight' => $this->getMaxHeight()]; + } + + /** + * Returns the set image width sizes + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @return array + */ + public function getImageWidth() + { + return ['minWidth' => $this->getMinWidth(), 'maxWidth' => $this->getMaxWidth()]; + } + + /** + * Returns the set image height sizes + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @return array + */ + public function getImageHeight() + { + return ['minHeight' => $this->getMinHeight(), 'maxHeight' => $this->getMaxHeight()]; + } + + /** + * Sets the minimum image size + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param array $options The minimum image dimensions + * @return $this Provides a fluent interface + */ + public function setImageMin($options) + { + $this->setOptions($options); + return $this; + } + + /** + * Sets the maximum image size + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param array|Traversable $options The maximum image dimensions + * @return $this Provides a fluent interface + */ + public function setImageMax($options) + { + $this->setOptions($options); + return $this; + } + + /** + * Sets the minimum and maximum image width + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param array $options The image width dimensions + * @return $this Provides a fluent interface + */ + public function setImageWidth($options) + { + $this->setImageMin($options); + $this->setImageMax($options); + + return $this; + } + + /** + * Sets the minimum and maximum image height + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param array $options The image height dimensions + * @return $this Provides a fluent interface + */ + public function setImageHeight($options) + { + $this->setImageMin($options); + $this->setImageMax($options); + + return $this; + } + + /** + * Returns true if and only if the image size of $value is at least min and + * not bigger than max + * + * @param string|array $value Real file to check for image size + * @param array $file File data from \Laminas\File\Transfer\Transfer (optional) + * @return bool + */ + public function isValid($value, $file = null) + { + $fileInfo = $this->getFileInfo($value, $file); + + $this->setValue($fileInfo['filename']); + + // Is file readable ? + if (empty($fileInfo['file']) || false === is_readable($fileInfo['file'])) { + $this->error(self::NOT_READABLE); + return false; + } + + ErrorHandler::start(); + $size = getimagesize($fileInfo['file']); + ErrorHandler::stop(); + + if (empty($size) || ($size[0] === 0) || ($size[1] === 0)) { + $this->error(self::NOT_DETECTED); + return false; + } + + $this->width = $size[0]; + $this->height = $size[1]; + if ($this->width < $this->getMinWidth()) { + $this->error(self::WIDTH_TOO_SMALL); + } + + if (($this->getMaxWidth() !== null) && ($this->getMaxWidth() < $this->width)) { + $this->error(self::WIDTH_TOO_BIG); + } + + if ($this->height < $this->getMinHeight()) { + $this->error(self::HEIGHT_TOO_SMALL); + } + + if (($this->getMaxHeight() !== null) && ($this->getMaxHeight() < $this->height)) { + $this->error(self::HEIGHT_TOO_BIG); + } + + if ($this->getMessages()) { + return false; + } + + return true; + } +} diff --git a/vendor/laminas/laminas-validator/src/File/IsCompressed.php b/vendor/laminas/laminas-validator/src/File/IsCompressed.php new file mode 100644 index 00000000..1a807a6e --- /dev/null +++ b/vendor/laminas/laminas-validator/src/File/IsCompressed.php @@ -0,0 +1,86 @@ + "File is not compressed, '%type%' detected", + self::NOT_DETECTED => 'The mimetype could not be detected from the file', + self::NOT_READABLE => 'File is not readable or does not exist', + ]; + + /** + * Sets validator options + * + * @param string|array|Traversable $options + */ + public function __construct($options = []) + { + // http://hul.harvard.edu/ois/systems/wax/wax-public-help/mimetypes.htm + $default = [ + 'application/arj', + 'application/gnutar', + 'application/lha', + 'application/lzx', + 'application/vnd.ms-cab-compressed', + 'application/x-ace-compressed', + 'application/x-arc', + 'application/x-archive', + 'application/x-arj', + 'application/x-bzip', + 'application/x-bzip2', + 'application/x-cab-compressed', + 'application/x-compress', + 'application/x-compressed', + 'application/x-cpio', + 'application/x-debian-package', + 'application/x-eet', + 'application/x-gzip', + 'application/x-java-pack200', + 'application/x-lha', + 'application/x-lharc', + 'application/x-lzh', + 'application/x-lzma', + 'application/x-lzx', + 'application/x-rar', + 'application/x-sit', + 'application/x-stuffit', + 'application/x-tar', + 'application/zip', + 'application/x-zip', + 'application/zoo', + 'multipart/x-gzip', + ]; + + if ($options instanceof Traversable) { + $options = ArrayUtils::iteratorToArray($options); + } + + if ($options === null) { + $options = []; + } + + parent::__construct($options); + + if (! $this->getMimeType()) { + $this->setMimeType($default); + } + } +} diff --git a/vendor/laminas/laminas-validator/src/File/IsImage.php b/vendor/laminas/laminas-validator/src/File/IsImage.php new file mode 100644 index 00000000..e8b2079d --- /dev/null +++ b/vendor/laminas/laminas-validator/src/File/IsImage.php @@ -0,0 +1,112 @@ + "File is no image, '%type%' detected", + self::NOT_DETECTED => 'The mimetype could not be detected from the file', + self::NOT_READABLE => 'File is not readable or does not exist', + ]; + + /** + * Sets validator options + * + * @param array|Traversable|string $options + */ + public function __construct($options = []) + { + // http://www.iana.org/assignments/media-types/media-types.xhtml#image + $default = [ + 'application/cdf', + 'application/dicom', + 'application/fractals', + 'application/postscript', + 'application/vnd.hp-hpgl', + 'application/vnd.oasis.opendocument.graphics', + 'application/x-cdf', + 'application/x-cmu-raster', + 'application/x-ima', + 'application/x-inventor', + 'application/x-koan', + 'application/x-portable-anymap', + 'application/x-world-x-3dmf', + 'image/bmp', + 'image/c', + 'image/cgm', + 'image/fif', + 'image/gif', + 'image/heic', + 'image/heif', + 'image/jpeg', + 'image/jpm', + 'image/jpx', + 'image/jp2', + 'image/naplps', + 'image/pjpeg', + 'image/png', + 'image/svg', + 'image/svg+xml', + 'image/tiff', + 'image/vnd.adobe.photoshop', + 'image/vnd.djvu', + 'image/vnd.fpx', + 'image/vnd.net-fpx', + 'image/webp', + 'image/x-cmu-raster', + 'image/x-cmx', + 'image/x-coreldraw', + 'image/x-cpi', + 'image/x-emf', + 'image/x-ico', + 'image/x-icon', + 'image/x-jg', + 'image/x-ms-bmp', + 'image/x-niff', + 'image/x-pict', + 'image/x-pcx', + 'image/x-png', + 'image/x-portable-anymap', + 'image/x-portable-bitmap', + 'image/x-portable-greymap', + 'image/x-portable-pixmap', + 'image/x-quicktime', + 'image/x-rgb', + 'image/x-tiff', + 'image/x-unknown', + 'image/x-windows-bmp', + 'image/x-xpmi', + ]; + + if ($options instanceof Traversable) { + $options = ArrayUtils::iteratorToArray($options); + } + + if ($options === null) { + $options = []; + } + + parent::__construct($options); + + if (! $this->getMimeType()) { + $this->setMimeType($default); + } + } +} diff --git a/vendor/laminas/laminas-validator/src/File/Md5.php b/vendor/laminas/laminas-validator/src/File/Md5.php new file mode 100644 index 00000000..6adc250f --- /dev/null +++ b/vendor/laminas/laminas-validator/src/File/Md5.php @@ -0,0 +1,120 @@ + 'File does not match the given md5 hashes', + self::NOT_DETECTED => 'An md5 hash could not be evaluated for the given file', + self::NOT_FOUND => 'File is not readable or does not exist', + ]; + + /** + * Options for this validator + * + * @var string + */ + protected $options = [ + 'algorithm' => 'md5', + 'hash' => null, + ]; + + /** + * Returns all set md5 hashes + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @return array + */ + public function getMd5() + { + return $this->getHash(); + } + + /** + * Sets the md5 hash for one or multiple files + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param string|array $options + * @return Hash Provides a fluent interface + */ + public function setMd5($options) + { + $this->setHash($options); + return $this; + } + + /** + * Adds the md5 hash for one or multiple files + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param string|array $options + * @return Hash Provides a fluent interface + */ + public function addMd5($options) + { + $this->addHash($options); + return $this; + } + + /** + * Returns true if and only if the given file confirms the set hash + * + * @param string|array $value Filename to check for hash + * @param array $file File data from \Laminas\File\Transfer\Transfer (optional) + * @return bool + */ + public function isValid($value, $file = null) + { + $fileInfo = $this->getFileInfo($value, $file); + + $this->setValue($fileInfo['filename']); + + // Is file readable ? + if (empty($fileInfo['file']) || false === is_readable($fileInfo['file'])) { + $this->error(self::NOT_FOUND); + return false; + } + + $hashes = array_unique(array_keys($this->getHash())); + $filehash = hash_file('md5', $fileInfo['file']); + if ($filehash === false) { + $this->error(self::NOT_DETECTED); + return false; + } + + foreach ($hashes as $hash) { + if ($filehash === $hash) { + return true; + } + } + + $this->error(self::DOES_NOT_MATCH); + return false; + } +} diff --git a/vendor/laminas/laminas-validator/src/File/MimeType.php b/vendor/laminas/laminas-validator/src/File/MimeType.php new file mode 100644 index 00000000..b106ffc2 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/File/MimeType.php @@ -0,0 +1,431 @@ + */ + protected $messageTemplates = [ + self::FALSE_TYPE => "File has an incorrect mimetype of '%type%'", + self::NOT_DETECTED => 'The mimetype could not be detected from the file', + self::NOT_READABLE => 'File is not readable or does not exist', + ]; + + /** @var array */ + protected $messageVariables = [ + 'type' => 'type', + ]; + + /** @var string */ + protected $type; + + /** + * Finfo object to use + * + * @var finfo|null + */ + protected $finfo; + + /** + * If no environment variable 'MAGIC' is set, try and autodiscover it based on common locations + * + * @var list + */ + protected $magicFiles = [ + '/usr/share/misc/magic', + '/usr/share/misc/magic.mime', + '/usr/share/misc/magic.mgc', + '/usr/share/mime/magic', + '/usr/share/mime/magic.mime', + '/usr/share/mime/magic.mgc', + '/usr/share/file/magic', + '/usr/share/file/magic.mime', + '/usr/share/file/magic.mgc', + ]; + + /** + * Options for this validator + * + * @var array + */ + protected $options = [ + 'enableHeaderCheck' => false, // Allow header check + 'disableMagicFile' => false, // Disable usage of magicfile + 'magicFile' => null, // Magicfile to use + 'mimeType' => null, // Mimetype to allow + ]; + + /** + * Sets validator options + * + * Mimetype to accept + * - NULL means default PHP usage by using the environment variable 'magic' + * - FALSE means disabling searching for mimetype, should be used for PHP 5.3 + * - A string is the mimetype file to use + * + * @param string|array|Traversable $options + */ + public function __construct($options = null) + { + if ($options instanceof Traversable) { + $options = ArrayUtils::iteratorToArray($options); + } elseif (is_string($options)) { + $this->setMimeType($options); + $options = []; + } elseif (is_array($options)) { + if (isset($options['magicFile'])) { + $this->setMagicFile($options['magicFile']); + unset($options['magicFile']); + } + + if (isset($options['enableHeaderCheck'])) { + $this->enableHeaderCheck((bool) $options['enableHeaderCheck']); + unset($options['enableHeaderCheck']); + } + + if (array_key_exists('mimeType', $options)) { + $this->setMimeType($options['mimeType']); + unset($options['mimeType']); + } + + // Handle cases where mimetypes are interspersed with options, or + // options are simply an array of mime types + foreach (array_keys($options) as $key) { + if (! is_int($key)) { + continue; + } + $this->addMimeType($options[$key]); + unset($options[$key]); + } + } + + parent::__construct($options); + } + + /** + * Returns the actual set magicfile + * + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @return string|false + */ + public function getMagicFile() + { + if (null === $this->options['magicFile']) { + $magic = getenv('magic'); + if (is_string($magic) && $magic !== '') { + $this->setMagicFile($magic); + if ($this->options['magicFile'] === null) { + $this->options['magicFile'] = false; + } + return $this->options['magicFile']; + } + + foreach ($this->magicFiles as $file) { + try { + $this->setMagicFile($file); + } catch (Exception\ExceptionInterface) { + // suppressing errors which are thrown due to open_basedir restrictions + continue; + } + + if (is_string($this->options['magicFile'])) { + return $this->options['magicFile']; + } + } + + if ($this->options['magicFile'] === null) { + $this->options['magicFile'] = false; + } + } + + return $this->options['magicFile']; + } + + /** + * Sets the magicfile to use + * if null, the MAGIC constant from php is used + * if the MAGIC file is erroneous, no file will be set + * if false, the default MAGIC file from PHP will be used + * + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @param string $file + * @return self Provides fluid interface + * @throws Exception\InvalidArgumentException + * @throws Exception\InvalidMagicMimeFileException + * @throws Exception\RuntimeException When finfo can not read the magicfile. + */ + public function setMagicFile($file) + { + if ($file === false) { + $this->options['magicFile'] = false; + } elseif (empty($file)) { + $this->options['magicFile'] = null; + } elseif (! class_exists('finfo', false)) { + $this->options['magicFile'] = null; + throw new Exception\RuntimeException('Magicfile can not be set; there is no finfo extension installed'); + } elseif (! is_file($file) || ! is_readable($file)) { + throw new Exception\InvalidArgumentException(sprintf( + 'The given magicfile ("%s") could not be read', + $file + )); + } else { + ErrorHandler::start(E_NOTICE | E_WARNING); + $this->finfo = finfo_open(FILEINFO_MIME_TYPE, $file); + $error = ErrorHandler::stop(); + if (empty($this->finfo)) { + $this->finfo = null; + throw new Exception\InvalidMagicMimeFileException(sprintf( + 'The given magicfile ("%s") could not be used by ext/finfo', + $file + ), 0, $error); + } + $this->options['magicFile'] = $file; + } + + return $this; + } + + /** + * Disables usage of MagicFile + * + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @param bool $disable False disables usage of magic file; true enables it. + * @return self Provides fluid interface + */ + public function disableMagicFile($disable) + { + $this->options['disableMagicFile'] = (bool) $disable; + return $this; + } + + /** + * Is usage of MagicFile disabled? + * + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @return bool + */ + public function isMagicFileDisabled() + { + return $this->options['disableMagicFile']; + } + + /** + * Returns the Header Check option + * + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @return bool + */ + public function getHeaderCheck() + { + return $this->options['enableHeaderCheck']; + } + + /** + * Defines if the http header should be used + * Note that this is unsafe and therefor the default value is false + * + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @param bool $headerCheck + * @return self Provides fluid interface + */ + public function enableHeaderCheck($headerCheck = true) + { + $this->options['enableHeaderCheck'] = (bool) $headerCheck; + return $this; + } + + /** + * Returns the set mimetypes + * + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @param bool $asArray Returns the values as array, when false a concatenated string is returned + * @return string|list + * @psalm-return ($asArray is true ? list : string) + */ + public function getMimeType($asArray = false) + { + $asArray = (bool) $asArray; + $mimetype = (string) $this->options['mimeType']; + if ($asArray) { + $mimetype = explode(',', $mimetype); + } + + return $mimetype; + } + + /** + * Sets the mimetypes + * + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @param string|list $mimetype The mimetypes to validate + * @return self Provides a fluent interface + */ + public function setMimeType($mimetype) + { + $this->options['mimeType'] = null; + $this->addMimeType($mimetype); + return $this; + } + + /** + * Adds the mimetypes + * + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @param string|list $mimetype The mimetypes to add for validation + * @throws Exception\InvalidArgumentException + * @return self Provides a fluent interface + */ + public function addMimeType($mimetype) + { + $mimetypes = $this->getMimeType(true); + + if (is_string($mimetype)) { + $mimetype = explode(',', $mimetype); + } elseif (! is_array($mimetype)) { + throw new Exception\InvalidArgumentException('Invalid options to validator provided'); + } + + if (isset($mimetype['magicFile'])) { + unset($mimetype['magicFile']); + } + + foreach ($mimetype as $content) { + if (! is_string($content) || $content === '') { + continue; + } + + $mimetypes[] = trim($content); + } + $mimetypes = array_unique(array_filter($mimetypes)); + + $this->options['mimeType'] = implode(',', $mimetypes); + + return $this; + } + + /** + * Defined by Laminas\Validator\ValidatorInterface + * + * Returns true if the mimetype of the file matches the given ones. Also parts + * of mimetypes can be checked. If you give for example "image" all image + * mime types will be accepted like "image/gif", "image/jpeg" and so on. + * + * @param string|array|UploadedFileInterface $value Real file to check for mimetype + * @param array $file File data from \Laminas\File\Transfer\Transfer (optional) + * @return bool + */ + public function isValid($value, $file = null) + { + $fileInfo = $this->getFileInfo($value, $file, true); + + $this->setValue($fileInfo['filename']); + + // Is file readable ? + if (empty($fileInfo['file']) || false === is_readable($fileInfo['file'])) { + $this->error(static::NOT_READABLE); + return false; + } + + $mimefile = $this->getMagicFile(); + if (class_exists('finfo', false)) { + if (! $this->isMagicFileDisabled() && (is_string($mimefile) && empty($this->finfo))) { + ErrorHandler::start(E_NOTICE | E_WARNING); + $this->finfo = finfo_open(FILEINFO_MIME_TYPE, $mimefile); + ErrorHandler::stop(); + } + + if (empty($this->finfo)) { + ErrorHandler::start(E_NOTICE | E_WARNING); + $this->finfo = finfo_open(FILEINFO_MIME_TYPE); + ErrorHandler::stop(); + } + + $this->type = null; + if (! empty($this->finfo)) { + $this->type = finfo_file($this->finfo, $fileInfo['file']); + unset($this->finfo); + } + } + + if ($this->type === null && $this->getHeaderCheck()) { + $this->type = $fileInfo['filetype']; + } + + if ($this->type === null) { + $this->error(static::NOT_DETECTED); + return false; + } + + $mimetype = $this->getMimeType(true); + if (in_array($this->type, $mimetype)) { + return true; + } + + $types = explode('/', $this->type); + $types = array_merge($types, explode('-', $this->type)); + $types = array_merge($types, explode(';', $this->type)); + foreach ($mimetype as $mime) { + if (in_array($mime, $types)) { + return true; + } + } + + $this->error(static::FALSE_TYPE); + return false; + } +} diff --git a/vendor/laminas/laminas-validator/src/File/NotExists.php b/vendor/laminas/laminas-validator/src/File/NotExists.php new file mode 100644 index 00000000..6e19d964 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/File/NotExists.php @@ -0,0 +1,70 @@ + 'File exists', + ]; + + /** + * Returns true if and only if the file does not exist in the set destinations + * + * @param string|array $value Real file to check for existence + * @param array $file File data from \Laminas\File\Transfer\Transfer (optional) + * @return bool + */ + public function isValid($value, $file = null) + { + $fileInfo = $this->getFileInfo($value, $file, false, true); + + $this->setValue($fileInfo['filename']); + + $check = false; + $directories = $this->getDirectory(true); + if (! isset($directories)) { + $check = true; + if (file_exists($fileInfo['file'])) { + $this->error(self::DOES_EXIST); + return false; + } + } else { + foreach ($directories as $directory) { + if (! isset($directory) || '' === $directory) { + continue; + } + + $check = true; + if (file_exists($directory . DIRECTORY_SEPARATOR . $fileInfo['basename'])) { + $this->error(self::DOES_EXIST); + return false; + } + } + } + + if (! $check) { + $this->error(self::DOES_EXIST); + return false; + } + + return true; + } +} diff --git a/vendor/laminas/laminas-validator/src/File/Sha1.php b/vendor/laminas/laminas-validator/src/File/Sha1.php new file mode 100644 index 00000000..23a68c20 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/File/Sha1.php @@ -0,0 +1,120 @@ + 'File does not match the given sha1 hashes', + self::NOT_DETECTED => 'A sha1 hash could not be evaluated for the given file', + self::NOT_FOUND => 'File is not readable or does not exist', + ]; + + /** + * Options for this validator + * + * @var string + */ + protected $options = [ + 'algorithm' => 'sha1', + 'hash' => null, + ]; + + /** + * Returns all set sha1 hashes + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @return array + */ + public function getSha1() + { + return $this->getHash(); + } + + /** + * Sets the sha1 hash for one or multiple files + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param string|array $options + * @return Hash Provides a fluent interface + */ + public function setSha1($options) + { + $this->setHash($options); + return $this; + } + + /** + * Adds the sha1 hash for one or multiple files + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param string|array $options + * @return Hash Provides a fluent interface + */ + public function addSha1($options) + { + $this->addHash($options); + return $this; + } + + /** + * Returns true if and only if the given file confirms the set hash + * + * @param (int|string)[]|string $value Filename to check for hash + * @param array $file File data from \Laminas\File\Transfer\Transfer (optional) + * @return bool + */ + public function isValid($value, $file = null) + { + $fileInfo = $this->getFileInfo($value, $file); + + $this->setValue($fileInfo['filename']); + + // Is file readable ? + if (empty($fileInfo['file']) || false === is_readable($fileInfo['file'])) { + $this->error(self::NOT_FOUND); + return false; + } + + $hashes = array_unique(array_keys($this->getHash())); + $filehash = hash_file('sha1', $fileInfo['file']); + if ($filehash === false) { + $this->error(self::NOT_DETECTED); + return false; + } + + foreach ($hashes as $hash) { + if ($filehash === $hash) { + return true; + } + } + + $this->error(self::DOES_NOT_MATCH); + return false; + } +} diff --git a/vendor/laminas/laminas-validator/src/File/Size.php b/vendor/laminas/laminas-validator/src/File/Size.php new file mode 100644 index 00000000..1972f446 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/File/Size.php @@ -0,0 +1,375 @@ + "Maximum allowed size for file is '%max%' but '%size%' detected", + self::TOO_SMALL => "Minimum expected size for file is '%min%' but '%size%' detected", + self::NOT_FOUND => 'File is not readable or does not exist', + ]; + + /** @var array Error message template variables */ + protected $messageVariables = [ + 'min' => ['options' => 'min'], + 'max' => ['options' => 'max'], + 'size' => 'size', + ]; + + /** + * Detected size + * + * @var int + */ + protected $size; + + /** + * Options for this validator + * + * @var array + */ + protected $options = [ + 'min' => null, // Minimum file size, if null there is no minimum + 'max' => null, // Maximum file size, if null there is no maximum + 'useByteString' => true, // Use byte string? + ]; + + /** + * Sets validator options + * + * If $options is an integer, it will be used as maximum file size + * As Array is accepts the following keys: + * 'min': Minimum file size + * 'max': Maximum file size + * 'useByteString': Use bytestring or real size for messages + * + * @param int|array|Traversable $options Options for the adapter + */ + public function __construct($options = null) + { + if (is_string($options) || is_numeric($options)) { + $options = ['max' => $options]; + } + + if (1 < func_num_args()) { + $argv = func_get_args(); + array_shift($argv); + $options['max'] = array_shift($argv); + if (! empty($argv)) { + $options['useByteString'] = array_shift($argv); + } + } + + parent::__construct($options); + } + + /** + * Should messages return bytes as integer or as string in SI notation + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param bool $byteString Use bytestring ? + * @return self + */ + public function useByteString($byteString = true) + { + $this->options['useByteString'] = (bool) $byteString; + return $this; + } + + /** + * Will bytestring be used? + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @return bool + */ + public function getByteString() + { + return $this->options['useByteString']; + } + + /** + * Returns the minimum file size + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param bool $raw Whether or not to force return of the raw value (defaults off) + * @return int|string + */ + public function getMin($raw = false) + { + $min = $this->options['min']; + if (! $raw && $this->getByteString()) { + $min = $this->toByteString($min); + } + + return $min; + } + + /** + * Sets the minimum file size + * + * File size can be an integer or a byte string + * This includes 'B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB' + * For example: 2000, 2MB, 0.2GB + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param int|string $min The minimum file size + * @return $this Provides a fluent interface + * @throws Exception\InvalidArgumentException When min is greater than max. + */ + public function setMin($min) + { + if (! is_string($min) && ! is_numeric($min)) { + throw new Exception\InvalidArgumentException('Invalid options to validator provided'); + } + + $min = (int) $this->fromByteString($min); + $max = $this->getMax(true); + if (($max !== null) && ($min > $max)) { + throw new Exception\InvalidArgumentException( + "The minimum must be less than or equal to the maximum file size, but $min > $max" + ); + } + + $this->options['min'] = $min; + return $this; + } + + /** + * Returns the maximum file size + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param bool $raw Whether or not to force return of the raw value (defaults off) + * @return int|string + */ + public function getMax($raw = false) + { + $max = $this->options['max']; + if (! $raw && $this->getByteString()) { + $max = $this->toByteString($max); + } + + return $max; + } + + /** + * Sets the maximum file size + * + * File size can be an integer or a byte string + * This includes 'B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB' + * For example: 2000, 2MB, 0.2GB + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param int|string $max The maximum file size + * @return $this Provides a fluent interface + * @throws Exception\InvalidArgumentException When max is smaller than min. + */ + public function setMax($max) + { + if (! is_string($max) && ! is_numeric($max)) { + throw new Exception\InvalidArgumentException('Invalid options to validator provided'); + } + + $max = (int) $this->fromByteString($max); + $min = $this->getMin(true); + if (($min !== null) && ($max < $min)) { + throw new Exception\InvalidArgumentException( + "The maximum must be greater than or equal to the minimum file size, but $max < $min" + ); + } + + $this->options['max'] = $max; + return $this; + } + + /** + * Retrieve current detected file size + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @return int + */ + protected function getSize() + { + return $this->size; + } + + /** + * Set current size + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param int $size + * @return $this + */ + protected function setSize($size) + { + $this->size = $size; + return $this; + } + + /** + * Returns true if and only if the file size of $value is at least min and + * not bigger than max (when max is not null). + * + * @param string|array $value File to check for size + * @param array $file File data from \Laminas\File\Transfer\Transfer (optional) + * @return bool + */ + public function isValid($value, $file = null) + { + $fileInfo = $this->getFileInfo($value, $file); + + $this->setValue($fileInfo['filename']); + + // Is file readable ? + if (empty($fileInfo['file']) || false === is_readable($fileInfo['file'])) { + $this->error(self::NOT_FOUND); + return false; + } + + // limited to 4GB files + ErrorHandler::start(); + $size = sprintf('%u', filesize($fileInfo['file'])); + ErrorHandler::stop(); + $this->size = $size; + + // Check to see if it's smaller than min size + $min = $this->getMin(true); + $max = $this->getMax(true); + if (($min !== null) && ($size < $min)) { + if ($this->getByteString()) { + $this->options['min'] = $this->toByteString($min); + $this->size = $this->toByteString($size); + $this->error(self::TOO_SMALL); + $this->options['min'] = $min; + $this->size = $size; + } else { + $this->error(self::TOO_SMALL); + } + } + + // Check to see if it's larger than max size + if (($max !== null) && ($max < $size)) { + if ($this->getByteString()) { + $this->options['max'] = $this->toByteString($max); + $this->size = $this->toByteString($size); + $this->error(self::TOO_BIG); + $this->options['max'] = $max; + $this->size = $size; + } else { + $this->error(self::TOO_BIG); + } + } + + if ($this->getMessages()) { + return false; + } + + return true; + } + + /** + * Returns the formatted size + * + * @param int $size + * @return string + */ + protected function toByteString($size) + { + $sizes = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; + for ($i = 0; $size >= 1024 && $i < 9; $i++) { + $size /= 1024; + } + + return round($size, 2) . $sizes[$i]; + } + + /** + * Returns the unformatted size + * + * @param string $size + * @return float|int|string + */ + protected function fromByteString($size) + { + if (is_numeric($size)) { + return (int) $size; + } + + $type = trim(substr($size, -2, 1)); + + $value = substr($size, 0, -1); + if (! is_numeric($value)) { + $value = trim(substr($value, 0, -1)); + } + + switch (strtoupper($type)) { + case 'Y': + $value *= 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024; + break; + case 'Z': + $value *= 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024; + break; + case 'E': + $value *= 1024 * 1024 * 1024 * 1024 * 1024 * 1024; + break; + case 'P': + $value *= 1024 * 1024 * 1024 * 1024 * 1024; + break; + case 'T': + $value *= 1024 * 1024 * 1024 * 1024; + break; + case 'G': + $value *= 1024 * 1024 * 1024; + break; + case 'M': + $value *= 1024 * 1024; + break; + case 'K': + $value *= 1024; + break; + default: + break; + } + + return $value; + } +} diff --git a/vendor/laminas/laminas-validator/src/File/Upload.php b/vendor/laminas/laminas-validator/src/File/Upload.php new file mode 100644 index 00000000..0bd2e340 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/File/Upload.php @@ -0,0 +1,278 @@ + Error message templates */ + protected $messageTemplates = [ + self::INI_SIZE => "File '%value%' exceeds upload_max_filesize directive in php.ini", + self::FORM_SIZE => "File '%value%' exceeds the MAX_FILE_SIZE directive that was " + . 'specified in the HTML form', + self::PARTIAL => "File '%value%' was only partially uploaded", + self::NO_FILE => "File '%value%' was not uploaded", + self::NO_TMP_DIR => "Missing a temporary folder to store '%value%'", + self::CANT_WRITE => "Failed to write file '%value%' to disk", + self::EXTENSION => "A PHP extension stopped uploading the file '%value%'", + self::ATTACK => "File '%value%' was illegally uploaded. This could be a possible attack", + self::FILE_NOT_FOUND => "File '%value%' was not found", + self::UNKNOWN => "Unknown error while uploading file '%value%'", + ]; + + /** @var array */ + protected $options = [ + 'files' => [], + ]; + + /** + * Sets validator options + * + * The array $files must be given in syntax of Laminas\File\Transfer\Transfer to be checked + * If no files are given the $_FILES array will be used automatically. + * NOTE: This validator will only work with HTTP POST uploads! + * + * @param array|Traversable $options Array of files in syntax of \Laminas\File\Transfer\Transfer + */ + public function __construct($options = []) + { + if (is_array($options) && ! array_key_exists('files', $options)) { + $options = ['files' => $options]; + } + + parent::__construct($options); + } + + /** + * Returns the array of set files + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param string $file (Optional) The file to return in detail + * @return array + * @throws Exception\InvalidArgumentException If file is not found. + */ + public function getFiles($file = null) + { + if ($file !== null) { + $return = []; + foreach ($this->options['files'] as $name => $content) { + if ($name === $file) { + $return[$file] = $this->options['files'][$name]; + } + + if ($content instanceof UploadedFileInterface) { + if ($content->getClientFilename() === $file) { + $return[$name] = $this->options['files'][$name]; + } + } elseif ($content['name'] === $file) { + $return[$name] = $this->options['files'][$name]; + } + } + + if (! $return) { + throw new Exception\InvalidArgumentException("The file '$file' was not found"); + } + + return $return; + } + + return $this->options['files']; + } + + /** + * Sets the files to be checked + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param array $files The files to check in syntax of \Laminas\File\Transfer\Transfer + * @return $this Provides a fluent interface + */ + public function setFiles($files = []) + { + if ( + null === $files + || ((is_countable($files)) + && count($files) === 0) + ) { + $this->options['files'] = $_FILES; + } else { + $this->options['files'] = $files; + } + + if ($this->options['files'] === null) { + $this->options['files'] = []; + } + + foreach ($this->options['files'] as $file => $content) { + if ( + ! $content instanceof UploadedFileInterface + && ! isset($content['error']) + ) { + unset($this->options['files'][$file]); + } + } + + return $this; + } + + /** + * Returns true if and only if the file was uploaded without errors + * + * @param string $value Single file to check for upload errors, when giving null the $_FILES array + * from initialization will be used + * @param mixed $file + * @return bool + */ + public function isValid($value, $file = null) + { + $files = []; + $this->setValue($value); + if (array_key_exists($value, $this->getFiles())) { + $files = array_merge($files, $this->getFiles($value)); + } else { + foreach ($this->getFiles() as $file => $content) { + if ($content instanceof UploadedFileInterface) { + if ($content->getClientFilename() === $value) { + $files = array_merge($files, $this->getFiles($file)); + } + + // PSR cannot search by tmp_name because it does not have + // a public interface to get it, only user defined name + // from form field. + continue; + } + + if (isset($content['name']) && ($content['name'] === $value)) { + $files = array_merge($files, $this->getFiles($file)); + } + + if (isset($content['tmp_name']) && ($content['tmp_name'] === $value)) { + $files = array_merge($files, $this->getFiles($file)); + } + } + } + + if (empty($files)) { + return $this->throwError($file, self::FILE_NOT_FOUND); + } + + foreach ($files as $file => $content) { + $this->value = $file; + $error = $content instanceof UploadedFileInterface + ? $content->getError() + : $content['error']; + + switch ($error) { + case 0: + if ($content instanceof UploadedFileInterface) { + // done! + break; + } + + // For standard SAPI environments, check that the upload + // was valid + if (! is_uploaded_file($content['tmp_name'])) { + $this->throwError($content, self::ATTACK); + } + break; + + case 1: + $this->throwError($content, self::INI_SIZE); + break; + + case 2: + $this->throwError($content, self::FORM_SIZE); + break; + + case 3: + $this->throwError($content, self::PARTIAL); + break; + + case 4: + $this->throwError($content, self::NO_FILE); + break; + + case 6: + $this->throwError($content, self::NO_TMP_DIR); + break; + + case 7: + $this->throwError($content, self::CANT_WRITE); + break; + + case 8: + $this->throwError($content, self::EXTENSION); + break; + + default: + $this->throwError($content, self::UNKNOWN); + break; + } + } + + if ($this->getMessages()) { + return false; + } + + return true; + } + + /** + * Throws an error of the given type + * + * @param array|string|UploadedFileInterface $file + * @param string $errorType + * @return false + */ + protected function throwError($file, $errorType) + { + if ($file !== null) { + if (is_array($file)) { + if (array_key_exists('name', $file)) { + $this->value = $file['name']; + } + } elseif (is_string($file)) { + $this->value = $file; + } elseif ($file instanceof UploadedFileInterface) { + $this->value = $file->getClientFilename(); + } + } + + $this->error($errorType); + return false; + } +} diff --git a/vendor/laminas/laminas-validator/src/File/UploadFile.php b/vendor/laminas/laminas-validator/src/File/UploadFile.php new file mode 100644 index 00000000..bc8adac0 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/File/UploadFile.php @@ -0,0 +1,177 @@ + 'The uploaded file exceeds the upload_max_filesize directive in php.ini', + self::FORM_SIZE => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was ' + . 'specified in the HTML form', + self::PARTIAL => 'The uploaded file was only partially uploaded', + self::NO_FILE => 'No file was uploaded', + self::NO_TMP_DIR => 'Missing a temporary folder', + self::CANT_WRITE => 'Failed to write file to disk', + self::EXTENSION => 'A PHP extension stopped the file upload', + self::ATTACK => 'File was illegally uploaded. This could be a possible attack', + self::FILE_NOT_FOUND => 'File was not found', + self::UNKNOWN => 'Unknown error while uploading file', + ]; + + /** + * Returns true if and only if the file was uploaded without errors + * + * @param string|array|UploadedFileInterface $value File to check for upload errors + * @return bool + * @throws Exception\InvalidArgumentException + */ + public function isValid($value) + { + if (is_array($value)) { + if (! isset($value['tmp_name']) || ! isset($value['name']) || ! isset($value['error'])) { + throw new Exception\InvalidArgumentException( + 'Value array must be in $_FILES format' + ); + } + + return $this->validateUploadedFile( + $value['error'], + $value['name'], + $value['tmp_name'] + ); + } + + if ($value instanceof UploadedFileInterface) { + return $this->validatePsr7UploadedFile($value); + } + + if (is_string($value)) { + return $this->validateUploadedFile(0, basename($value), $value); + } + + $this->error(self::UNKNOWN); + return false; + } + + /** + * @param int $error UPLOAD_ERR_* constant value + * @return bool + */ + private function validateFileFromErrorCode($error) + { + switch ($error) { + case UPLOAD_ERR_OK: + return true; + + case UPLOAD_ERR_INI_SIZE: + $this->error(self::INI_SIZE); + return false; + + case UPLOAD_ERR_FORM_SIZE: + $this->error(self::FORM_SIZE); + return false; + + case UPLOAD_ERR_PARTIAL: + $this->error(self::PARTIAL); + return false; + + case UPLOAD_ERR_NO_FILE: + $this->error(self::NO_FILE); + return false; + + case UPLOAD_ERR_NO_TMP_DIR: + $this->error(self::NO_TMP_DIR); + return false; + + case UPLOAD_ERR_CANT_WRITE: + $this->error(self::CANT_WRITE); + return false; + + case UPLOAD_ERR_EXTENSION: + $this->error(self::EXTENSION); + return false; + + default: + $this->error(self::UNKNOWN); + return false; + } + } + + /** + * @param int $error UPLOAD_ERR_* constant + * @param string $filename + * @param string $uploadedFile Name of uploaded file (gen tmp_name) + * @return bool + */ + private function validateUploadedFile($error, $filename, $uploadedFile) + { + $this->setValue($filename); + + // Normal errors can be validated normally + if ($error !== UPLOAD_ERR_OK) { + return $this->validateFileFromErrorCode($error); + } + + // Did we get no name? Is the file missing? + if (empty($uploadedFile) || false === is_file($uploadedFile)) { + $this->error(self::FILE_NOT_FOUND); + return false; + } + + // Do we have an invalid upload? + if (! is_uploaded_file($uploadedFile)) { + $this->error(self::ATTACK); + return false; + } + + return true; + } + + /** + * @return bool + */ + private function validatePsr7UploadedFile(UploadedFileInterface $uploadedFile) + { + $this->setValue($uploadedFile); + return $this->validateFileFromErrorCode($uploadedFile->getError()); + } +} diff --git a/vendor/laminas/laminas-validator/src/File/WordCount.php b/vendor/laminas/laminas-validator/src/File/WordCount.php new file mode 100644 index 00000000..73d22f9d --- /dev/null +++ b/vendor/laminas/laminas-validator/src/File/WordCount.php @@ -0,0 +1,214 @@ + "Too many words, maximum '%max%' are allowed but '%count%' were counted", + self::TOO_LESS => "Too few words, minimum '%min%' are expected but '%count%' were counted", + self::NOT_FOUND => 'File is not readable or does not exist', + ]; + + /** @var array Error message template variables */ + protected $messageVariables = [ + 'min' => ['options' => 'min'], + 'max' => ['options' => 'max'], + 'count' => 'count', + ]; + + /** + * Word count + * + * @var int + */ + protected $count; + + /** + * Options for this validator + * + * @var array + */ + protected $options = [ + 'min' => null, // Minimum word count, if null there is no minimum word count + 'max' => null, // Maximum word count, if null there is no maximum word count + ]; + + /** + * Sets validator options + * + * Min limits the word count, when used with max=null it is the maximum word count + * It also accepts an array with the keys 'min' and 'max' + * + * If $options is an integer, it will be used as maximum word count + * As Array is accepts the following keys: + * 'min': Minimum word count + * 'max': Maximum word count + * + * @param int|array|Traversable $options Options for the adapter + */ + public function __construct($options = null) + { + if (1 < func_num_args()) { + $args = func_get_args(); + $options = [ + 'min' => array_shift($args), + 'max' => array_shift($args), + ]; + } + + if (is_string($options) || is_numeric($options)) { + $options = ['max' => $options]; + } + + parent::__construct($options); + } + + /** + * Returns the minimum word count + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @return int + */ + public function getMin() + { + return $this->options['min']; + } + + /** + * Sets the minimum word count + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param int|array $min The minimum word count + * @return $this Provides a fluent interface + * @throws Exception\InvalidArgumentException When min is greater than max. + */ + public function setMin($min) + { + if (is_array($min) && isset($min['min'])) { + $min = $min['min']; + } + + if (! is_numeric($min)) { + throw new Exception\InvalidArgumentException('Invalid options to validator provided'); + } + + $min = (int) $min; + if (($this->getMax() !== null) && ($min > $this->getMax())) { + throw new Exception\InvalidArgumentException( + "The minimum must be less than or equal to the maximum word count, but $min > {$this->getMax()}" + ); + } + + $this->options['min'] = $min; + return $this; + } + + /** + * Returns the maximum word count + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @return int + */ + public function getMax() + { + return $this->options['max']; + } + + /** + * Sets the maximum file count + * + * @deprecated Since 2.61.0 - All getters and setters will be removed in 3.0 + * + * @param int|array $max The maximum word count + * @return $this Provides a fluent interface + * @throws Exception\InvalidArgumentException When max is smaller than min. + */ + public function setMax($max) + { + if (is_array($max) && isset($max['max'])) { + $max = $max['max']; + } + + if (! is_numeric($max)) { + throw new Exception\InvalidArgumentException('Invalid options to validator provided'); + } + + $max = (int) $max; + if (($this->getMin() !== null) && ($max < $this->getMin())) { + throw new Exception\InvalidArgumentException( + "The maximum must be greater than or equal to the minimum word count, but $max < {$this->getMin()}" + ); + } + + $this->options['max'] = $max; + return $this; + } + + /** + * Returns true if and only if the counted words are at least min and + * not bigger than max (when max is not null). + * + * @param string|array $value Filename to check for word count + * @param array $file File data from \Laminas\File\Transfer\Transfer (optional) + * @return bool + */ + public function isValid($value, $file = null) + { + $fileInfo = $this->getFileInfo($value, $file); + + $this->setValue($fileInfo['filename']); + + // Is file readable ? + if (empty($fileInfo['file']) || false === is_readable($fileInfo['file'])) { + $this->error(self::NOT_FOUND); + return false; + } + + $content = file_get_contents($fileInfo['file']); + $this->count = str_word_count($content); + if (($this->getMax() !== null) && ($this->count > $this->getMax())) { + $this->error(self::TOO_MUCH); + return false; + } + + if (($this->getMin() !== null) && ($this->count < $this->getMin())) { + $this->error(self::TOO_LESS); + return false; + } + + return true; + } +} diff --git a/vendor/laminas/laminas-validator/src/GpsPoint.php b/vendor/laminas/laminas-validator/src/GpsPoint.php new file mode 100644 index 00000000..93918495 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/GpsPoint.php @@ -0,0 +1,112 @@ + '%value% is out of Bounds.', + self::CONVERT_ERROR => '%value% can not converted into a Decimal Degree Value.', + self::INCOMPLETE_COORDINATE => '%value% did not provided a complete Coordinate', + ]; + + /** + * Returns true if and only if $value meets the validation requirements + * + * If $value fails validation, then this method returns false, and + * getMessages() will return an array of messages that explain why the + * validation failed. + * + * @throws Exception\RuntimeException If validation of $value is impossible. + */ + public function isValid(mixed $value): bool + { + if (! str_contains($value, ',')) { + $this->error(self::INCOMPLETE_COORDINATE, $value); + return false; + } + + [$lat, $long] = explode(',', $value); + + return $this->isValidCoordinate($lat, 90.0000) && $this->isValidCoordinate($long, 180.000); + } + + private function isValidCoordinate(string $value, float $maxBoundary): bool + { + $this->value = $value; + + $value = $this->removeWhiteSpace($value); + if ($this->isDMSValue($value)) { + $value = $this->convertValue($value); + } else { + $value = $this->removeDegreeSign($value); + } + + if ($value === false) { + $this->error(self::CONVERT_ERROR); + return false; + } + + $castedValue = (float) $value; + if (! is_numeric($value) && $castedValue === 0.0) { + $this->error(self::CONVERT_ERROR); + return false; + } + + if (! $this->isValueInbound($castedValue, $maxBoundary)) { + $this->error(self::OUT_OF_BOUNDS); + return false; + } + + return true; + } + + /** + * Determines if the give value is a Degrees Minutes Second Definition + */ + private function isDMSValue(string $value): bool + { + return preg_match('/([°\'"]+[NESW])/', $value) > 0; + } + + private function convertValue(string $value): false|float + { + $matches = []; + $result = preg_match_all('/(\d{1,3})°(\d{1,2})\'(\d{1,2}[\.\d]{0,6})"[NESW]/i', $value, $matches); + + if ($result === false || $result === 0) { + return false; + } + + return $matches[1][0] + $matches[2][0] / 60 + ((float) $matches[3][0]) / 3600; + } + + private function removeWhiteSpace(string $value): string + { + return preg_replace('/\s/', '', $value); + } + + private function removeDegreeSign(string $value): string + { + return str_replace('°', '', $value); + } + + private function isValueInbound(float $value, float $boundary): bool + { + $max = $boundary; + $min = -1 * $boundary; + return $min <= $value && $value <= $max; + } +} diff --git a/vendor/laminas/laminas-validator/src/GreaterThan.php b/vendor/laminas/laminas-validator/src/GreaterThan.php new file mode 100644 index 00000000..eb5cf997 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/GreaterThan.php @@ -0,0 +1,158 @@ + "The input is not greater than '%min%'", + self::NOT_GREATER_INCLUSIVE => "The input is not greater than or equal to '%min%'", + ]; + + /** @var array */ + protected $messageVariables = [ + 'min' => 'min', + ]; + + /** + * Minimum value + * + * @var mixed + */ + protected $min; + + /** + * Whether to do inclusive comparisons, allowing equivalence to max + * + * If false, then strict comparisons are done, and the value may equal + * the min option + * + * @var bool + */ + protected $inclusive; + + /** + * Sets validator options + * + * @param array|Traversable $options + * @throws Exception\InvalidArgumentException + */ + public function __construct($options = null) + { + if ($options instanceof Traversable) { + $options = ArrayUtils::iteratorToArray($options); + } + if (! is_array($options)) { + $options = func_get_args(); + $temp['min'] = array_shift($options); + + if (! empty($options)) { + $temp['inclusive'] = array_shift($options); + } + + $options = $temp; + } + + if (! array_key_exists('min', $options)) { + throw new Exception\InvalidArgumentException("Missing option 'min'"); + } + + if (! array_key_exists('inclusive', $options)) { + $options['inclusive'] = false; + } + + $this->setMin($options['min']) + ->setInclusive($options['inclusive']); + + parent::__construct($options); + } + + /** + * Returns the min option + * + * @return mixed + */ + public function getMin() + { + return $this->min; + } + + /** + * Sets the min option + * + * @return $this Provides a fluent interface + */ + public function setMin(mixed $min) + { + $this->min = $min; + return $this; + } + + /** + * Returns the inclusive option + * + * @return bool + */ + public function getInclusive() + { + return $this->inclusive; + } + + /** + * Sets the inclusive option + * + * @param bool $inclusive + * @return $this Provides a fluent interface + */ + public function setInclusive($inclusive) + { + $this->inclusive = $inclusive; + return $this; + } + + /** + * Returns true if and only if $value is greater than min option + * + * @param mixed $value + * @return bool + */ + public function isValid($value) + { + $this->setValue($value); + + if ($this->inclusive) { + if ($this->min > $value) { + $this->error(self::NOT_GREATER_INCLUSIVE); + return false; + } + } else { + if ($this->min >= $value) { + $this->error(self::NOT_GREATER); + return false; + } + } + + return true; + } +} diff --git a/vendor/laminas/laminas-validator/src/Hex.php b/vendor/laminas/laminas-validator/src/Hex.php new file mode 100644 index 00000000..4f6a18c3 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Hex.php @@ -0,0 +1,46 @@ + 'Invalid type given. String expected', + self::NOT_HEX => 'The input contains non-hexadecimal characters', + ]; + + /** + * Returns true if and only if $value contains only hexadecimal digit characters + * + * @param mixed $value + * @return bool + */ + public function isValid($value) + { + if (! is_string($value) && ! is_int($value)) { + $this->error(self::INVALID); + return false; + } + + $this->setValue($value); + if (! ctype_xdigit((string) $value)) { + $this->error(self::NOT_HEX); + return false; + } + + return true; + } +} diff --git a/vendor/laminas/laminas-validator/src/HostWithPublicIPv4Address.php b/vendor/laminas/laminas-validator/src/HostWithPublicIPv4Address.php new file mode 100644 index 00000000..3ac88a7a --- /dev/null +++ b/vendor/laminas/laminas-validator/src/HostWithPublicIPv4Address.php @@ -0,0 +1,158 @@ + */ + protected array $messageTemplates = [ + self::ERROR_NOT_STRING => 'Expected a string hostname but received %type%', + self::ERROR_HOSTNAME_NOT_RESOLVED => 'The hostname "%value%" cannot be resolved', + self::ERROR_PRIVATE_IP_FOUND => 'The hostname "%value%" resolves to at least one reserved IPv4 address', + ]; + + protected string $type = 'null'; + + /** @var array */ + protected array $messageVariables = [ + 'type' => 'type', + 'value' => 'value', + ]; + + public function isValid(mixed $value): bool + { + $this->type = get_debug_type($value); + + if (! is_string($value)) { + $this->error(self::ERROR_NOT_STRING); + + return false; + } + + $this->value = $value; + + if (filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === false) { + $addressList = gethostbynamel($value); + } else { + $addressList = [$value]; + } + + if (! is_array($addressList)) { + $this->error(self::ERROR_HOSTNAME_NOT_RESOLVED); + + return false; + } + + $privateAddressWasFound = false; + + $filterFlags = FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; + if (PHP_VERSION_ID >= 80200) { + /** + * @psalm-var int $filterFlags + * @psalm-suppress UndefinedConstant + */ + $filterFlags |= FILTER_FLAG_GLOBAL_RANGE; + } + + foreach ($addressList as $server) { + /** + * Initially test with PHP's built-in filter_var features as this will be quicker than checking + * presence with a CIDR + */ + if (filter_var($server, FILTER_VALIDATE_IP, $filterFlags) === false) { + $privateAddressWasFound = true; + + break; + } + + if ($this->inReservedCidr($server)) { + $privateAddressWasFound = true; + + break; + } + } + + if ($privateAddressWasFound) { + $this->error(self::ERROR_PRIVATE_IP_FOUND); + + return false; + } + + return true; + } + + private function inReservedCidr(string $ip): bool + { + foreach (self::RESERVED_CIDR as $cidr) { + $cidr = explode('/', $cidr); + $startIp = ip2long($cidr[0]); + $endIp = ip2long($cidr[0]) + pow(2, 32 - (int) $cidr[1]) - 1; + + $int = ip2long($ip); + + if ($int >= $startIp && $int <= $endIp) { + return true; + } + } + + return false; + } +} diff --git a/vendor/laminas/laminas-validator/src/Hostname.php b/vendor/laminas/laminas-validator/src/Hostname.php new file mode 100644 index 00000000..f37c3ed9 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Hostname.php @@ -0,0 +1,2286 @@ +, + * useIdnCheck?: bool, + * useTldCheck?: bool, + * ipValidator?: null|ValidatorInterface, + * } + * @final + */ +class Hostname extends AbstractValidator +{ + public const CANNOT_DECODE_PUNYCODE = 'hostnameCannotDecodePunycode'; + public const INVALID = 'hostnameInvalid'; + public const INVALID_DASH = 'hostnameDashCharacter'; + public const INVALID_HOSTNAME = 'hostnameInvalidHostname'; + public const INVALID_HOSTNAME_SCHEMA = 'hostnameInvalidHostnameSchema'; + public const INVALID_LOCAL_NAME = 'hostnameInvalidLocalName'; + public const INVALID_URI = 'hostnameInvalidUri'; + public const IP_ADDRESS_NOT_ALLOWED = 'hostnameIpAddressNotAllowed'; + public const LOCAL_NAME_NOT_ALLOWED = 'hostnameLocalNameNotAllowed'; + public const UNDECIPHERABLE_TLD = 'hostnameUndecipherableTld'; + public const UNKNOWN_TLD = 'hostnameUnknownTld'; + + /** @var array */ + protected $messageTemplates = [ + self::CANNOT_DECODE_PUNYCODE => "The input appears to be a DNS hostname but the given punycode notation cannot be decoded", + self::INVALID => "Invalid type given. String expected", + self::INVALID_DASH => "The input appears to be a DNS hostname but contains a dash in an invalid position", + self::INVALID_HOSTNAME => "The input does not match the expected structure for a DNS hostname", + self::INVALID_HOSTNAME_SCHEMA => "The input appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'", + self::INVALID_LOCAL_NAME => "The input does not appear to be a valid local network name", + self::INVALID_URI => "The input does not appear to be a valid URI hostname", + self::IP_ADDRESS_NOT_ALLOWED => "The input appears to be an IP address, but IP addresses are not allowed", + self::LOCAL_NAME_NOT_ALLOWED => "The input appears to be a local network name but local network names are not allowed", + self::UNDECIPHERABLE_TLD => "The input appears to be a DNS hostname but cannot extract TLD part", + self::UNKNOWN_TLD => "The input appears to be a DNS hostname but cannot match TLD against known list", + ]; + + /** @var array */ + protected $messageVariables = [ + 'tld' => 'tld', + ]; + + public const ALLOW_DNS = 1; // Allows Internet domain names (e.g., example.com) + public const ALLOW_IP = 2; // Allows IP addresses + public const ALLOW_LOCAL = 4; // Allows local network names (e.g., localhost, www.localdomain) + public const ALLOW_URI = 8; // Allows URI hostnames + public const ALLOW_ALL = 15; // Allows all types of hostnames + + /** + * Array of valid top-level-domains + * + * @see ftp://data.iana.org/TLD/tlds-alpha-by-domain.txt List of all TLDs by domain + * @see http://www.iana.org/domains/root/db/ Official list of supported TLDs + * + * @var string[] + */ + protected $validTlds = [ + 'aaa', + 'aarp', + 'abb', + 'abbott', + 'abbvie', + 'abc', + 'able', + 'abogado', + 'abudhabi', + 'ac', + 'academy', + 'accenture', + 'accountant', + 'accountants', + 'aco', + 'actor', + 'ad', + 'ads', + 'adult', + 'ae', + 'aeg', + 'aero', + 'aetna', + 'af', + 'afl', + 'africa', + 'ag', + 'agakhan', + 'agency', + 'ai', + 'aig', + 'airbus', + 'airforce', + 'airtel', + 'akdn', + 'al', + 'alibaba', + 'alipay', + 'allfinanz', + 'allstate', + 'ally', + 'alsace', + 'alstom', + 'am', + 'amazon', + 'americanexpress', + 'americanfamily', + 'amex', + 'amfam', + 'amica', + 'amsterdam', + 'analytics', + 'android', + 'anquan', + 'anz', + 'ao', + 'aol', + 'apartments', + 'app', + 'apple', + 'aq', + 'aquarelle', + 'ar', + 'arab', + 'aramco', + 'archi', + 'army', + 'arpa', + 'art', + 'arte', + 'as', + 'asda', + 'asia', + 'associates', + 'at', + 'athleta', + 'attorney', + 'au', + 'auction', + 'audi', + 'audible', + 'audio', + 'auspost', + 'author', + 'auto', + 'autos', + 'aw', + 'aws', + 'ax', + 'axa', + 'az', + 'azure', + 'ba', + 'baby', + 'baidu', + 'banamex', + 'band', + 'bank', + 'bar', + 'barcelona', + 'barclaycard', + 'barclays', + 'barefoot', + 'bargains', + 'baseball', + 'basketball', + 'bauhaus', + 'bayern', + 'bb', + 'bbc', + 'bbt', + 'bbva', + 'bcg', + 'bcn', + 'bd', + 'be', + 'beats', + 'beauty', + 'beer', + 'bentley', + 'berlin', + 'best', + 'bestbuy', + 'bet', + 'bf', + 'bg', + 'bh', + 'bharti', + 'bi', + 'bible', + 'bid', + 'bike', + 'bing', + 'bingo', + 'bio', + 'biz', + 'bj', + 'black', + 'blackfriday', + 'blockbuster', + 'blog', + 'bloomberg', + 'blue', + 'bm', + 'bms', + 'bmw', + 'bn', + 'bnpparibas', + 'bo', + 'boats', + 'boehringer', + 'bofa', + 'bom', + 'bond', + 'boo', + 'book', + 'booking', + 'bosch', + 'bostik', + 'boston', + 'bot', + 'boutique', + 'box', + 'br', + 'bradesco', + 'bridgestone', + 'broadway', + 'broker', + 'brother', + 'brussels', + 'bs', + 'bt', + 'build', + 'builders', + 'business', + 'buy', + 'buzz', + 'bv', + 'bw', + 'by', + 'bz', + 'bzh', + 'ca', + 'cab', + 'cafe', + 'cal', + 'call', + 'calvinklein', + 'cam', + 'camera', + 'camp', + 'canon', + 'capetown', + 'capital', + 'capitalone', + 'car', + 'caravan', + 'cards', + 'care', + 'career', + 'careers', + 'cars', + 'casa', + 'case', + 'cash', + 'casino', + 'cat', + 'catering', + 'catholic', + 'cba', + 'cbn', + 'cbre', + 'cc', + 'cd', + 'center', + 'ceo', + 'cern', + 'cf', + 'cfa', + 'cfd', + 'cg', + 'ch', + 'chanel', + 'channel', + 'charity', + 'chase', + 'chat', + 'cheap', + 'chintai', + 'christmas', + 'chrome', + 'church', + 'ci', + 'cipriani', + 'circle', + 'cisco', + 'citadel', + 'citi', + 'citic', + 'city', + 'ck', + 'cl', + 'claims', + 'cleaning', + 'click', + 'clinic', + 'clinique', + 'clothing', + 'cloud', + 'club', + 'clubmed', + 'cm', + 'cn', + 'co', + 'coach', + 'codes', + 'coffee', + 'college', + 'cologne', + 'com', + 'commbank', + 'community', + 'company', + 'compare', + 'computer', + 'comsec', + 'condos', + 'construction', + 'consulting', + 'contact', + 'contractors', + 'cooking', + 'cool', + 'coop', + 'corsica', + 'country', + 'coupon', + 'coupons', + 'courses', + 'cpa', + 'cr', + 'credit', + 'creditcard', + 'creditunion', + 'cricket', + 'crown', + 'crs', + 'cruise', + 'cruises', + 'cu', + 'cuisinella', + 'cv', + 'cw', + 'cx', + 'cy', + 'cymru', + 'cyou', + 'cz', + 'dabur', + 'dad', + 'dance', + 'data', + 'date', + 'dating', + 'datsun', + 'day', + 'dclk', + 'dds', + 'de', + 'deal', + 'dealer', + 'deals', + 'degree', + 'delivery', + 'dell', + 'deloitte', + 'delta', + 'democrat', + 'dental', + 'dentist', + 'desi', + 'design', + 'dev', + 'dhl', + 'diamonds', + 'diet', + 'digital', + 'direct', + 'directory', + 'discount', + 'discover', + 'dish', + 'diy', + 'dj', + 'dk', + 'dm', + 'dnp', + 'do', + 'docs', + 'doctor', + 'dog', + 'domains', + 'dot', + 'download', + 'drive', + 'dtv', + 'dubai', + 'dunlop', + 'dupont', + 'durban', + 'dvag', + 'dvr', + 'dz', + 'earth', + 'eat', + 'ec', + 'eco', + 'edeka', + 'edu', + 'education', + 'ee', + 'eg', + 'email', + 'emerck', + 'energy', + 'engineer', + 'engineering', + 'enterprises', + 'epson', + 'equipment', + 'er', + 'ericsson', + 'erni', + 'es', + 'esq', + 'estate', + 'et', + 'eu', + 'eurovision', + 'eus', + 'events', + 'exchange', + 'expert', + 'exposed', + 'express', + 'extraspace', + 'fage', + 'fail', + 'fairwinds', + 'faith', + 'family', + 'fan', + 'fans', + 'farm', + 'farmers', + 'fashion', + 'fast', + 'fedex', + 'feedback', + 'ferrari', + 'ferrero', + 'fi', + 'fidelity', + 'fido', + 'film', + 'final', + 'finance', + 'financial', + 'fire', + 'firestone', + 'firmdale', + 'fish', + 'fishing', + 'fit', + 'fitness', + 'fj', + 'fk', + 'flickr', + 'flights', + 'flir', + 'florist', + 'flowers', + 'fly', + 'fm', + 'fo', + 'foo', + 'food', + 'football', + 'ford', + 'forex', + 'forsale', + 'forum', + 'foundation', + 'fox', + 'fr', + 'free', + 'fresenius', + 'frl', + 'frogans', + 'frontier', + 'ftr', + 'fujitsu', + 'fun', + 'fund', + 'furniture', + 'futbol', + 'fyi', + 'ga', + 'gal', + 'gallery', + 'gallo', + 'gallup', + 'game', + 'games', + 'gap', + 'garden', + 'gay', + 'gb', + 'gbiz', + 'gd', + 'gdn', + 'ge', + 'gea', + 'gent', + 'genting', + 'george', + 'gf', + 'gg', + 'ggee', + 'gh', + 'gi', + 'gift', + 'gifts', + 'gives', + 'giving', + 'gl', + 'glass', + 'gle', + 'global', + 'globo', + 'gm', + 'gmail', + 'gmbh', + 'gmo', + 'gmx', + 'gn', + 'godaddy', + 'gold', + 'goldpoint', + 'golf', + 'goo', + 'goodyear', + 'goog', + 'google', + 'gop', + 'got', + 'gov', + 'gp', + 'gq', + 'gr', + 'grainger', + 'graphics', + 'gratis', + 'green', + 'gripe', + 'grocery', + 'group', + 'gs', + 'gt', + 'gu', + 'gucci', + 'guge', + 'guide', + 'guitars', + 'guru', + 'gw', + 'gy', + 'hair', + 'hamburg', + 'hangout', + 'haus', + 'hbo', + 'hdfc', + 'hdfcbank', + 'health', + 'healthcare', + 'help', + 'helsinki', + 'here', + 'hermes', + 'hiphop', + 'hisamitsu', + 'hitachi', + 'hiv', + 'hk', + 'hkt', + 'hm', + 'hn', + 'hockey', + 'holdings', + 'holiday', + 'homedepot', + 'homegoods', + 'homes', + 'homesense', + 'honda', + 'horse', + 'hospital', + 'host', + 'hosting', + 'hot', + 'hotels', + 'hotmail', + 'house', + 'how', + 'hr', + 'hsbc', + 'ht', + 'hu', + 'hughes', + 'hyatt', + 'hyundai', + 'ibm', + 'icbc', + 'ice', + 'icu', + 'id', + 'ie', + 'ieee', + 'ifm', + 'ikano', + 'il', + 'im', + 'imamat', + 'imdb', + 'immo', + 'immobilien', + 'in', + 'inc', + 'industries', + 'infiniti', + 'info', + 'ing', + 'ink', + 'institute', + 'insurance', + 'insure', + 'int', + 'international', + 'intuit', + 'investments', + 'io', + 'ipiranga', + 'iq', + 'ir', + 'irish', + 'is', + 'ismaili', + 'ist', + 'istanbul', + 'it', + 'itau', + 'itv', + 'jaguar', + 'java', + 'jcb', + 'je', + 'jeep', + 'jetzt', + 'jewelry', + 'jio', + 'jll', + 'jm', + 'jmp', + 'jnj', + 'jo', + 'jobs', + 'joburg', + 'jot', + 'joy', + 'jp', + 'jpmorgan', + 'jprs', + 'juegos', + 'juniper', + 'kaufen', + 'kddi', + 'ke', + 'kerryhotels', + 'kerrylogistics', + 'kerryproperties', + 'kfh', + 'kg', + 'kh', + 'ki', + 'kia', + 'kids', + 'kim', + 'kindle', + 'kitchen', + 'kiwi', + 'km', + 'kn', + 'koeln', + 'komatsu', + 'kosher', + 'kp', + 'kpmg', + 'kpn', + 'kr', + 'krd', + 'kred', + 'kuokgroup', + 'kw', + 'ky', + 'kyoto', + 'kz', + 'la', + 'lacaixa', + 'lamborghini', + 'lamer', + 'lancaster', + 'land', + 'landrover', + 'lanxess', + 'lasalle', + 'lat', + 'latino', + 'latrobe', + 'law', + 'lawyer', + 'lb', + 'lc', + 'lds', + 'lease', + 'leclerc', + 'lefrak', + 'legal', + 'lego', + 'lexus', + 'lgbt', + 'li', + 'lidl', + 'life', + 'lifeinsurance', + 'lifestyle', + 'lighting', + 'like', + 'lilly', + 'limited', + 'limo', + 'lincoln', + 'link', + 'lipsy', + 'live', + 'living', + 'lk', + 'llc', + 'llp', + 'loan', + 'loans', + 'locker', + 'locus', + 'lol', + 'london', + 'lotte', + 'lotto', + 'love', + 'lpl', + 'lplfinancial', + 'lr', + 'ls', + 'lt', + 'ltd', + 'ltda', + 'lu', + 'lundbeck', + 'luxe', + 'luxury', + 'lv', + 'ly', + 'ma', + 'madrid', + 'maif', + 'maison', + 'makeup', + 'man', + 'management', + 'mango', + 'map', + 'market', + 'marketing', + 'markets', + 'marriott', + 'marshalls', + 'mattel', + 'mba', + 'mc', + 'mckinsey', + 'md', + 'me', + 'med', + 'media', + 'meet', + 'melbourne', + 'meme', + 'memorial', + 'men', + 'menu', + 'merckmsd', + 'mg', + 'mh', + 'miami', + 'microsoft', + 'mil', + 'mini', + 'mint', + 'mit', + 'mitsubishi', + 'mk', + 'ml', + 'mlb', + 'mls', + 'mm', + 'mma', + 'mn', + 'mo', + 'mobi', + 'mobile', + 'moda', + 'moe', + 'moi', + 'mom', + 'monash', + 'money', + 'monster', + 'mormon', + 'mortgage', + 'moscow', + 'moto', + 'motorcycles', + 'mov', + 'movie', + 'mp', + 'mq', + 'mr', + 'ms', + 'msd', + 'mt', + 'mtn', + 'mtr', + 'mu', + 'museum', + 'music', + 'mv', + 'mw', + 'mx', + 'my', + 'mz', + 'na', + 'nab', + 'nagoya', + 'name', + 'navy', + 'nba', + 'nc', + 'ne', + 'nec', + 'net', + 'netbank', + 'netflix', + 'network', + 'neustar', + 'new', + 'news', + 'next', + 'nextdirect', + 'nexus', + 'nf', + 'nfl', + 'ng', + 'ngo', + 'nhk', + 'ni', + 'nico', + 'nike', + 'nikon', + 'ninja', + 'nissan', + 'nissay', + 'nl', + 'no', + 'nokia', + 'norton', + 'now', + 'nowruz', + 'nowtv', + 'np', + 'nr', + 'nra', + 'nrw', + 'ntt', + 'nu', + 'nyc', + 'nz', + 'obi', + 'observer', + 'office', + 'okinawa', + 'olayan', + 'olayangroup', + 'ollo', + 'om', + 'omega', + 'one', + 'ong', + 'onl', + 'online', + 'ooo', + 'open', + 'oracle', + 'orange', + 'org', + 'organic', + 'origins', + 'osaka', + 'otsuka', + 'ott', + 'ovh', + 'pa', + 'page', + 'panasonic', + 'paris', + 'pars', + 'partners', + 'parts', + 'party', + 'pay', + 'pccw', + 'pe', + 'pet', + 'pf', + 'pfizer', + 'pg', + 'ph', + 'pharmacy', + 'phd', + 'philips', + 'phone', + 'photo', + 'photography', + 'photos', + 'physio', + 'pics', + 'pictet', + 'pictures', + 'pid', + 'pin', + 'ping', + 'pink', + 'pioneer', + 'pizza', + 'pk', + 'pl', + 'place', + 'play', + 'playstation', + 'plumbing', + 'plus', + 'pm', + 'pn', + 'pnc', + 'pohl', + 'poker', + 'politie', + 'porn', + 'post', + 'pr', + 'pramerica', + 'praxi', + 'press', + 'prime', + 'pro', + 'prod', + 'productions', + 'prof', + 'progressive', + 'promo', + 'properties', + 'property', + 'protection', + 'pru', + 'prudential', + 'ps', + 'pt', + 'pub', + 'pw', + 'pwc', + 'py', + 'qa', + 'qpon', + 'quebec', + 'quest', + 'racing', + 'radio', + 're', + 'read', + 'realestate', + 'realtor', + 'realty', + 'recipes', + 'red', + 'redstone', + 'redumbrella', + 'rehab', + 'reise', + 'reisen', + 'reit', + 'reliance', + 'ren', + 'rent', + 'rentals', + 'repair', + 'report', + 'republican', + 'rest', + 'restaurant', + 'review', + 'reviews', + 'rexroth', + 'rich', + 'richardli', + 'ricoh', + 'ril', + 'rio', + 'rip', + 'ro', + 'rocks', + 'rodeo', + 'rogers', + 'room', + 'rs', + 'rsvp', + 'ru', + 'rugby', + 'ruhr', + 'run', + 'rw', + 'rwe', + 'ryukyu', + 'sa', + 'saarland', + 'safe', + 'safety', + 'sakura', + 'sale', + 'salon', + 'samsclub', + 'samsung', + 'sandvik', + 'sandvikcoromant', + 'sanofi', + 'sap', + 'sarl', + 'sas', + 'save', + 'saxo', + 'sb', + 'sbi', + 'sbs', + 'sc', + 'scb', + 'schaeffler', + 'schmidt', + 'scholarships', + 'school', + 'schule', + 'schwarz', + 'science', + 'scot', + 'sd', + 'se', + 'search', + 'seat', + 'secure', + 'security', + 'seek', + 'select', + 'sener', + 'services', + 'seven', + 'sew', + 'sex', + 'sexy', + 'sfr', + 'sg', + 'sh', + 'shangrila', + 'sharp', + 'shell', + 'shia', + 'shiksha', + 'shoes', + 'shop', + 'shopping', + 'shouji', + 'show', + 'si', + 'silk', + 'sina', + 'singles', + 'site', + 'sj', + 'sk', + 'ski', + 'skin', + 'sky', + 'skype', + 'sl', + 'sling', + 'sm', + 'smart', + 'smile', + 'sn', + 'sncf', + 'so', + 'soccer', + 'social', + 'softbank', + 'software', + 'sohu', + 'solar', + 'solutions', + 'song', + 'sony', + 'soy', + 'spa', + 'space', + 'sport', + 'spot', + 'sr', + 'srl', + 'ss', + 'st', + 'stada', + 'staples', + 'star', + 'statebank', + 'statefarm', + 'stc', + 'stcgroup', + 'stockholm', + 'storage', + 'store', + 'stream', + 'studio', + 'study', + 'style', + 'su', + 'sucks', + 'supplies', + 'supply', + 'support', + 'surf', + 'surgery', + 'suzuki', + 'sv', + 'swatch', + 'swiss', + 'sx', + 'sy', + 'sydney', + 'systems', + 'sz', + 'tab', + 'taipei', + 'talk', + 'taobao', + 'target', + 'tatamotors', + 'tatar', + 'tattoo', + 'tax', + 'taxi', + 'tc', + 'tci', + 'td', + 'tdk', + 'team', + 'tech', + 'technology', + 'tel', + 'temasek', + 'tennis', + 'teva', + 'tf', + 'tg', + 'th', + 'thd', + 'theater', + 'theatre', + 'tiaa', + 'tickets', + 'tienda', + 'tips', + 'tires', + 'tirol', + 'tj', + 'tjmaxx', + 'tjx', + 'tk', + 'tkmaxx', + 'tl', + 'tm', + 'tmall', + 'tn', + 'to', + 'today', + 'tokyo', + 'tools', + 'top', + 'toray', + 'toshiba', + 'total', + 'tours', + 'town', + 'toyota', + 'toys', + 'tr', + 'trade', + 'trading', + 'training', + 'travel', + 'travelers', + 'travelersinsurance', + 'trust', + 'trv', + 'tt', + 'tube', + 'tui', + 'tunes', + 'tushu', + 'tv', + 'tvs', + 'tw', + 'tz', + 'ua', + 'ubank', + 'ubs', + 'ug', + 'uk', + 'unicom', + 'university', + 'uno', + 'uol', + 'ups', + 'us', + 'uy', + 'uz', + 'va', + 'vacations', + 'vana', + 'vanguard', + 'vc', + 've', + 'vegas', + 'ventures', + 'verisign', + 'versicherung', + 'vet', + 'vg', + 'vi', + 'viajes', + 'video', + 'vig', + 'viking', + 'villas', + 'vin', + 'vip', + 'virgin', + 'visa', + 'vision', + 'viva', + 'vivo', + 'vlaanderen', + 'vn', + 'vodka', + 'volvo', + 'vote', + 'voting', + 'voto', + 'voyage', + 'vu', + 'wales', + 'walmart', + 'walter', + 'wang', + 'wanggou', + 'watch', + 'watches', + 'weather', + 'weatherchannel', + 'webcam', + 'weber', + 'website', + 'wed', + 'wedding', + 'weibo', + 'weir', + 'wf', + 'whoswho', + 'wien', + 'wiki', + 'williamhill', + 'win', + 'windows', + 'wine', + 'winners', + 'wme', + 'wolterskluwer', + 'woodside', + 'work', + 'works', + 'world', + 'wow', + 'ws', + 'wtc', + 'wtf', + 'xbox', + 'xerox', + 'xihuan', + 'xin', + 'कॉम', + 'セール', + '佛山', + 'ಭಾರತ', + '慈善', + '集团', + '在线', + '한국', + 'ଭାରତ', + '点看', + 'คอม', + 'ভাৰত', + 'ভারত', + '八卦', + 'ישראל', + 'موقع', + 'বাংলা', + '公益', + '公司', + '香格里拉', + '网站', + '移动', + '我爱你', + 'москва', + 'қаз', + 'католик', + 'онлайн', + 'сайт', + '联通', + 'срб', + 'бг', + 'бел', + 'קום', + '时尚', + '微博', + '淡马锡', + 'ファッション', + 'орг', + 'नेट', + 'ストア', + 'アマゾン', + '삼성', + 'சிங்கப்பூர்', + '商标', + '商店', + '商城', + 'дети', + 'мкд', + 'ею', + 'ポイント', + '新闻', + '家電', + 'كوم', + '中文网', + '中信', + '中国', + '中國', + '娱乐', + '谷歌', + 'భారత్', + 'ලංකා', + '電訊盈科', + '购物', + 'クラウド', + 'ભારત', + '通販', + 'भारतम्', + 'भारत', + 'भारोत', + '网店', + 'संगठन', + '餐厅', + '网络', + 'ком', + 'укр', + '香港', + '亚马逊', + '食品', + '飞利浦', + '台湾', + '台灣', + '手机', + 'мон', + 'الجزائر', + 'عمان', + 'ارامكو', + 'ایران', + 'العليان', + 'امارات', + 'بازار', + 'موريتانيا', + 'پاکستان', + 'الاردن', + 'بارت', + 'بھارت', + 'المغرب', + 'ابوظبي', + 'البحرين', + 'السعودية', + 'ڀارت', + 'كاثوليك', + 'سودان', + 'همراه', + 'عراق', + 'مليسيا', + '澳門', + '닷컴', + '政府', + 'شبكة', + 'بيتك', + 'عرب', + 'გე', + '机构', + '组织机构', + '健康', + 'ไทย', + 'سورية', + '招聘', + 'рус', + 'рф', + 'تونس', + '大拿', + 'ລາວ', + 'みんな', + 'グーグル', + 'ευ', + 'ελ', + '世界', + '書籍', + 'ഭാരതം', + 'ਭਾਰਤ', + '网址', + '닷넷', + 'コム', + '天主教', + '游戏', + 'vermögensberater', + 'vermögensberatung', + '企业', + '信息', + '嘉里大酒店', + '嘉里', + 'مصر', + 'قطر', + '广东', + 'இலங்கை', + 'இந்தியா', + 'հայ', + '新加坡', + 'فلسطين', + '政务', + 'xxx', + 'xyz', + 'yachts', + 'yahoo', + 'yamaxun', + 'yandex', + 'ye', + 'yodobashi', + 'yoga', + 'yokohama', + 'you', + 'youtube', + 'yt', + 'yun', + 'za', + 'zappos', + 'zara', + 'zero', + 'zip', + 'zm', + 'zone', + 'zuerich', + 'zw', + ]; + + /** + * Array for valid Idns + * + * @see http://www.iana.org/domains/idn-tables/ Official list of supported IDN Chars + * (.AC) Ascension Island http://www.nic.ac/pdf/AC-IDN-Policy.pdf + * (.AR) Argentina http://www.nic.ar/faqidn.html + * (.AS) American Samoa http://www.nic.as/idn/chars.cfm + * (.AT) Austria http://www.nic.at/en/service/technical_information/idn/charset_converter/ + * (.BIZ) International http://www.iana.org/domains/idn-tables/ + * (.BR) Brazil http://registro.br/faq/faq6.html + * (.BV) Bouvett Island http://www.norid.no/domeneregistrering/idn/idn_nyetegn.en.html + * (.CAT) Catalan http://www.iana.org/domains/idn-tables/tables/cat_ca_1.0.html + * (.CH) Switzerland https://nic.switch.ch/reg/ocView.action?res=EF6GW2JBPVTG67DLNIQXU234MN6SC33JNQQGI7L6#anhang1 + * (.CL) Chile http://www.iana.org/domains/idn-tables/tables/cl_latn_1.0.html + * (.COM) International http://www.verisign.com/information-services/naming-services/internationalized-domain-names/index.html + * (.DE) Germany https://www.denic.de/en/know-how/idn-domains/idn-character-list/ + * (.DK) Danmark http://www.dk-hostmaster.dk/index.php?id=151 + * (.EE) Estonia https://www.iana.org/domains/idn-tables/tables/pl_et-pl_1.0.html + * (.ES) Spain https://www.nic.es/media/2008-05/1210147705287.pdf + * (.FI) Finland http://www.ficora.fi/en/index/palvelut/fiverkkotunnukset/aakkostenkaytto.html + * (.GR) Greece https://grweb.ics.forth.gr/CharacterTable1_en.jsp + * (.HR) Croatia https://www.dns.hr/en/portal/files/Odluka-1,2alfanum-dijak.pdf + * (.HU) Hungary http://www.domain.hu/domain/English/szabalyzat/szabalyzat.html + * (.IL) Israel http://www.isoc.org.il/domains/il-domain-rules.html + * (.INFO) International http://www.nic.info/info/idn + * (.IO) British Indian Ocean Territory http://www.nic.io/IO-IDN-Policy.pdf + * (.IR) Iran http://www.nic.ir/Allowable_Characters_dot-iran + * (.IS) Iceland https://www.isnic.is/en/domain/rules#2 + * (.KR) Korea http://www.iana.org/domains/idn-tables/tables/kr_ko-kr_1.0.html + * (.LI) Liechtenstein https://nic.switch.ch/reg/ocView.action?res=EF6GW2JBPVTG67DLNIQXU234MN6SC33JNQQGI7L6#anhang1 + * (.LT) Lithuania http://www.domreg.lt/static/doc/public/idn_symbols-en.pdf + * (.MD) Moldova http://www.register.md/ + * (.MUSEUM) International http://www.iana.org/domains/idn-tables/tables/museum_latn_1.0.html + * (.NET) International http://www.verisign.com/information-services/naming-services/internationalized-domain-names/index.html + * (.NO) Norway http://www.norid.no/domeneregistrering/idn/idn_nyetegn.en.html + * (.NU) Niue http://www.worldnames.net/ + * (.ORG) International http://www.pir.org/index.php?db=content/FAQs&tbl=FAQs_Registrant&id=2 + * (.PE) Peru https://www.nic.pe/nuevas_politicas_faq_2.php + * (.PL) Poland http://www.dns.pl/IDN/allowed_character_sets.pdf + * (.PR) Puerto Rico http://www.nic.pr/idn_rules.asp + * (.PT) Portugal https://online.dns.pt/dns_2008/do?com=DS;8216320233;111;+PAGE(4000058)+K-CAT-CODIGO(C.125)+RCNT(100); + * (.RU) Russia http://www.iana.org/domains/idn-tables/tables/ru_ru-ru_1.0.html + * (.SA) Saudi Arabia http://www.iana.org/domains/idn-tables/tables/sa_ar_1.0.html + * (.SE) Sweden http://www.iis.se/english/IDN_campaignsite.shtml?lang=en + * (.SH) Saint Helena http://www.nic.sh/SH-IDN-Policy.pdf + * (.SJ) Svalbard and Jan Mayen http://www.norid.no/domeneregistrering/idn/idn_nyetegn.en.html + * (.TH) Thailand http://www.iana.org/domains/idn-tables/tables/th_th-th_1.0.html + * (.TM) Turkmenistan http://www.nic.tm/TM-IDN-Policy.pdf + * (.TR) Turkey https://www.nic.tr/index.php + * (.UA) Ukraine http://www.iana.org/domains/idn-tables/tables/ua_cyrl_1.2.html + * (.VE) Venice http://www.iana.org/domains/idn-tables/tables/ve_es_1.0.html + * (.VN) Vietnam http://www.vnnic.vn/english/5-6-300-2-2-04-20071115.htm#1.%20Introduction + * + * @var array> + */ + protected $validIdns = [ + 'AC' => [1 => '/^[\x{002d}0-9a-zà-öø-ÿāăąćĉċčďđēėęěĝġģĥħīįĵķĺļľŀłńņňŋőœŕŗřśŝşšţťŧūŭůűųŵŷźżž]{1,63}$/iu'], + 'AR' => [1 => '/^[\x{002d}0-9a-zà-ãç-êìíñ-õü]{1,63}$/iu'], + 'AS' => [1 => '/^[\x{002d}0-9a-zà-öø-ÿāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıĵķĸĺļľłńņňŋōŏőœŕŗřśŝşšţťŧũūŭůűųŵŷźż]{1,63}$/iu'], + 'AT' => [1 => '/^[\x{002d}0-9a-zà-öø-ÿœšž]{1,63}$/iu'], + 'BIZ' => 'Hostname/Biz.php', + 'BR' => [1 => '/^[\x{002d}0-9a-zà-ãçéíó-õúü]{1,63}$/iu'], + 'BV' => [1 => '/^[\x{002d}0-9a-zàáä-éêñ-ôöøüčđńŋšŧž]{1,63}$/iu'], + 'CAT' => [1 => '/^[\x{002d}0-9a-z·àç-éíïòóúü]{1,63}$/iu'], + 'CH' => [1 => '/^[\x{002d}0-9a-zà-öø-ÿœ]{1,63}$/iu'], + 'CL' => [1 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu'], + 'CN' => 'Hostname/Cn.php', + 'COM' => 'Hostname/Com.php', + 'DE' => [1 => '/^[\x{002d}0-9a-záàăâåäãąāæćĉčċçďđéèĕêěëėęēğĝġģĥħíìĭîïĩįīıĵķĺľļłńňñņŋóòŏôöőõøōœĸŕřŗśŝšşßťţŧúùŭûůüűũųūŵýŷÿźžżðþ]{1,63}$/iu'], + 'DK' => [1 => '/^[\x{002d}0-9a-zäåæéöøü]{1,63}$/iu'], + 'EE' => [1 => '/^[\x{002d}0-9a-zäõöüšž]{1,63}$/iu'], + 'ES' => [1 => '/^[\x{002d}0-9a-zàáçèéíïñòóúü·]{1,63}$/iu'], + 'EU' => [ + 1 => '/^[\x{002d}0-9a-zà-öø-ÿ]{1,63}$/iu', + 2 => '/^[\x{002d}0-9a-zāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıĵķĺļľŀłńņňʼnŋōŏőœŕŗřśŝšťŧũūŭůűųŵŷźżž]{1,63}$/iu', + 3 => '/^[\x{002d}0-9a-zșț]{1,63}$/iu', + 4 => '/^[\x{002d}0-9a-zΐάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ]{1,63}$/iu', + 5 => '/^[\x{002d}0-9a-zабвгдежзийклмнопрстуфхцчшщъыьэюя]{1,63}$/iu', + 6 => '/^[\x{002d}0-9a-zἀ-ἇἐ-ἕἠ-ἧἰ-ἷὀ-ὅὐ-ὗὠ-ὧὰ-ὼώᾀ-ᾇᾐ-ᾗᾠ-ᾧᾰ-ᾴᾶᾷῂῃῄῆῇῐ-ῒΐῖῗῠ-ῧῲῳῴῶῷ]{1,63}$/iu', + ], + 'FI' => [1 => '/^[\x{002d}0-9a-zäåö]{1,63}$/iu'], + 'GR' => [1 => '/^[\x{002d}0-9a-zΆΈΉΊΌΎ-ΡΣ-ώἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼῂῃῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲῳῴῶ-ῼ]{1,63}$/iu'], + 'HK' => 'Hostname/Cn.php', + 'HR' => [1 => '/^[\x{002d}0-9a-zžćčđš]{1,63}$/iu'], + 'HU' => [1 => '/^[\x{002d}0-9a-záéíóöúüőű]{1,63}$/iu'], + 'IL' => [ + 1 => '/^[\x{002d}0-9\x{05D0}-\x{05EA}]{1,63}$/iu', + 2 => '/^[\x{002d}0-9a-z]{1,63}$/i', + ], + 'INFO' => [ + 1 => '/^[\x{002d}0-9a-zäåæéöøü]{1,63}$/iu', + 2 => '/^[\x{002d}0-9a-záéíóöúüőű]{1,63}$/iu', + 3 => '/^[\x{002d}0-9a-záæéíðóöúýþ]{1,63}$/iu', + 4 => '/^[\x{AC00}-\x{D7A3}]{1,17}$/iu', + 5 => '/^[\x{002d}0-9a-zāčēģīķļņōŗšūž]{1,63}$/iu', + 6 => '/^[\x{002d}0-9a-ząčėęįšūųž]{1,63}$/iu', + 7 => '/^[\x{002d}0-9a-zóąćęłńśźż]{1,63}$/iu', + 8 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu', + ], + 'IO' => [1 => '/^[\x{002d}0-9a-zà-öø-ÿăąāćĉčċďđĕěėęēğĝġģĥħĭĩįīıĵķĺľļłńňņŋŏőōœĸŕřŗśŝšşťţŧŭůűũųūŵŷźžż]{1,63}$/iu'], + 'IS' => [1 => '/^[\x{002d}0-9a-záéýúíóþæöð]{1,63}$/iu'], + 'IT' => [1 => '/^[\x{002d}0-9a-zàâäèéêëìîïòôöùûüæœçÿß-]{1,63}$/iu'], + 'JP' => 'Hostname/Jp.php', + 'KR' => [1 => '/^[\x{AC00}-\x{D7A3}]{1,17}$/iu'], + 'LI' => [1 => '/^[\x{002d}0-9a-zà-öø-ÿœ]{1,63}$/iu'], + 'LT' => [1 => '/^[\x{002d}0-9ąčęėįšųūž]{1,63}$/iu'], + 'MD' => [1 => '/^[\x{002d}0-9ăâîşţ]{1,63}$/iu'], + 'MUSEUM' => [1 => '/^[\x{002d}0-9a-zà-öø-ÿāăąćċčďđēėęěğġģħīįıķĺļľłńņňŋōőœŕŗřśşšţťŧūůűųŵŷźżžǎǐǒǔ\x{01E5}\x{01E7}\x{01E9}\x{01EF}ə\x{0292}ẁẃẅỳ]{1,63}$/iu'], + 'NET' => 'Hostname/Com.php', + 'NO' => [1 => '/^[\x{002d}0-9a-zàáä-éêñ-ôöøüčđńŋšŧž]{1,63}$/iu'], + 'NU' => 'Hostname/Com.php', + 'ORG' => [ + 1 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu', + 2 => '/^[\x{002d}0-9a-zóąćęłńśźż]{1,63}$/iu', + 3 => '/^[\x{002d}0-9a-záäåæéëíðóöøúüýþ]{1,63}$/iu', + 4 => '/^[\x{002d}0-9a-záéíóöúüőű]{1,63}$/iu', + 5 => '/^[\x{002d}0-9a-ząčėęįšūųž]{1,63}$/iu', + 6 => '/^[\x{AC00}-\x{D7A3}]{1,17}$/iu', + 7 => '/^[\x{002d}0-9a-zāčēģīķļņōŗšūž]{1,63}$/iu', + ], + 'PE' => [1 => '/^[\x{002d}0-9a-zñáéíóúü]{1,63}$/iu'], + 'PL' => [ + 1 => '/^[\x{002d}0-9a-zāčēģīķļņōŗšūž]{1,63}$/iu', + 2 => '/^[\x{002d}а-ик-ш\x{0450}ѓѕјљњќџ]{1,63}$/iu', + 3 => '/^[\x{002d}0-9a-zâîăşţ]{1,63}$/iu', + 4 => '/^[\x{002d}0-9а-яё\x{04C2}]{1,63}$/iu', + 5 => '/^[\x{002d}0-9a-zàáâèéêìíîòóôùúûċġħż]{1,63}$/iu', + 6 => '/^[\x{002d}0-9a-zàäåæéêòóôöøü]{1,63}$/iu', + 7 => '/^[\x{002d}0-9a-zóąćęłńśźż]{1,63}$/iu', + 8 => '/^[\x{002d}0-9a-zàáâãçéêíòóôõúü]{1,63}$/iu', + 9 => '/^[\x{002d}0-9a-zâîăşţ]{1,63}$/iu', + 10 => '/^[\x{002d}0-9a-záäéíóôúýčďĺľňŕšťž]{1,63}$/iu', + 11 => '/^[\x{002d}0-9a-zçë]{1,63}$/iu', + 12 => '/^[\x{002d}0-9а-ик-шђјљњћџ]{1,63}$/iu', + 13 => '/^[\x{002d}0-9a-zćčđšž]{1,63}$/iu', + 14 => '/^[\x{002d}0-9a-zâçöûüğış]{1,63}$/iu', + 15 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu', + 16 => '/^[\x{002d}0-9a-zäõöüšž]{1,63}$/iu', + 17 => '/^[\x{002d}0-9a-zĉĝĥĵŝŭ]{1,63}$/iu', + 18 => '/^[\x{002d}0-9a-zâäéëîô]{1,63}$/iu', + 19 => '/^[\x{002d}0-9a-zàáâäåæçèéêëìíîïðñòôöøùúûüýćčłńřśš]{1,63}$/iu', + 20 => '/^[\x{002d}0-9a-zäåæõöøüšž]{1,63}$/iu', + 21 => '/^[\x{002d}0-9a-zàáçèéìíòóùú]{1,63}$/iu', + 22 => '/^[\x{002d}0-9a-zàáéíóöúüőű]{1,63}$/iu', + 23 => '/^[\x{002d}0-9ΐά-ώ]{1,63}$/iu', + 24 => '/^[\x{002d}0-9a-zàáâåæçèéêëðóôöøüþœ]{1,63}$/iu', + 25 => '/^[\x{002d}0-9a-záäéíóöúüýčďěňřšťůž]{1,63}$/iu', + 26 => '/^[\x{002d}0-9a-z·àçèéíïòóúü]{1,63}$/iu', + 27 => '/^[\x{002d}0-9а-ъьюя\x{0450}\x{045D}]{1,63}$/iu', + 28 => '/^[\x{002d}0-9а-яёіў]{1,63}$/iu', + 29 => '/^[\x{002d}0-9a-ząčėęįšūųž]{1,63}$/iu', + 30 => '/^[\x{002d}0-9a-záäåæéëíðóöøúüýþ]{1,63}$/iu', + 31 => '/^[\x{002d}0-9a-zàâæçèéêëîïñôùûüÿœ]{1,63}$/iu', + 32 => '/^[\x{002d}0-9а-щъыьэюяёєіїґ]{1,63}$/iu', + 33 => '/^[\x{002d}0-9א-ת]{1,63}$/iu', + ], + 'PR' => [1 => '/^[\x{002d}0-9a-záéíóúñäëïüöâêîôûàèùæçœãõ]{1,63}$/iu'], + 'PT' => [1 => '/^[\x{002d}0-9a-záàâãçéêíóôõú]{1,63}$/iu'], + 'RS' => [1 => '/^[\x{002d}0-9a-zßáâäçéëíîóôöúüýăąćčďđęěĺľłńňőŕřśşšţťůűźżž]{1,63}$/iu'], + 'RU' => [1 => '/^[\x{002d}0-9а-яё]{1,63}$/iu'], + 'SA' => [1 => '/^[\x{002d}.0-9\x{0621}-\x{063A}\x{0641}-\x{064A}\x{0660}-\x{0669}]{1,63}$/iu'], + 'SE' => [1 => '/^[\x{002d}0-9a-zäåéöü]{1,63}$/iu'], + 'SH' => [1 => '/^[\x{002d}0-9a-zà-öø-ÿăąāćĉčċďđĕěėęēğĝġģĥħĭĩįīıĵķĺľļłńňņŋŏőōœĸŕřŗśŝšşťţŧŭůűũųūŵŷźžż]{1,63}$/iu'], + 'SI' => [ + 1 => '/^[\x{002d}0-9a-zà-öø-ÿ]{1,63}$/iu', + 2 => '/^[\x{002d}0-9a-zāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıĵķĺļľŀłńņňʼnŋōŏőœŕŗřśŝšťŧũūŭůűųŵŷźżž]{1,63}$/iu', + 3 => '/^[\x{002d}0-9a-zșț]{1,63}$/iu', + ], + 'SJ' => [1 => '/^[\x{002d}0-9a-zàáä-éêñ-ôöøüčđńŋšŧž]{1,63}$/iu'], + 'TH' => [1 => '/^[\x{002d}0-9a-z\x{0E01}-\x{0E3A}\x{0E40}-\x{0E4D}\x{0E50}-\x{0E59}]{1,63}$/iu'], + 'TM' => [1 => '/^[\x{002d}0-9a-zà-öø-ÿāăąćĉċčďđēėęěĝġģĥħīįĵķĺļľŀłńņňŋőœŕŗřśŝşšţťŧūŭůűųŵŷźżž]{1,63}$/iu'], + 'TW' => 'Hostname/Cn.php', + 'TR' => [1 => '/^[\x{002d}0-9a-zğıüşöç]{1,63}$/iu'], + 'UA' => [1 => '/^[\x{002d}0-9a-zабвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓєѕіїјљњћќѝўџґӂʼ]{1,63}$/iu'], + 'VE' => [1 => '/^[\x{002d}0-9a-záéíóúüñ]{1,63}$/iu'], + 'VN' => [1 => '/^[ÀÁÂÃÈÉÊÌÍÒÓÔÕÙÚÝàáâãèéêìíòóôõùúýĂăĐđĨĩŨũƠơƯư\x{1EA0}-\x{1EF9}]{1,63}$/iu'], + 'мон' => [1 => '/^[\x{002d}0-9\x{0430}-\x{044F}]{1,63}$/iu'], + 'срб' => [1 => '/^[\x{002d}0-9а-ик-шђјљњћџ]{1,63}$/iu'], + 'сайт' => [1 => '/^[\x{002d}0-9а-яёіїѝйўґг]{1,63}$/iu'], + 'онлайн' => [1 => '/^[\x{002d}0-9а-яёіїѝйўґг]{1,63}$/iu'], + '中国' => 'Hostname/Cn.php', + '中國' => 'Hostname/Cn.php', + 'ලංකා' => [1 => '/^[\x{0d80}-\x{0dff}]{1,63}$/iu'], + '香港' => 'Hostname/Cn.php', + '台湾' => 'Hostname/Cn.php', + '台灣' => 'Hostname/Cn.php', + 'امارات' => [1 => '/^[\x{0621}-\x{0624}\x{0626}-\x{063A}\x{0641}\x{0642}\x{0644}-\x{0648}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06CC}\x{06F0}-\x{06F9}]{1,30}$/iu'], + 'الاردن' => [1 => '/^[\x{0621}-\x{0624}\x{0626}-\x{063A}\x{0641}\x{0642}\x{0644}-\x{0648}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06CC}\x{06F0}-\x{06F9}]{1,30}$/iu'], + 'السعودية' => [1 => '/^[\x{0621}-\x{0624}\x{0626}-\x{063A}\x{0641}\x{0642}\x{0644}-\x{0648}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06CC}\x{06F0}-\x{06F9}]{1,30}$/iu'], + 'ไทย' => [1 => '/^[\x{002d}0-9a-z\x{0E01}-\x{0E3A}\x{0E40}-\x{0E4D}\x{0E50}-\x{0E59}]{1,63}$/iu'], + 'рф' => [1 => '/^[\x{002d}0-9а-яё]{1,63}$/iu'], + 'تونس' => [1 => '/^[\x{0621}-\x{0624}\x{0626}-\x{063A}\x{0641}\x{0642}\x{0644}-\x{0648}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06CC}\x{06F0}-\x{06F9}]{1,30}$/iu'], + 'مصر' => [1 => '/^[\x{0621}-\x{0624}\x{0626}-\x{063A}\x{0641}\x{0642}\x{0644}-\x{0648}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06CC}\x{06F0}-\x{06F9}]{1,30}$/iu'], + 'இலங்கை' => [1 => '/^[\x{0b80}-\x{0bff}]{1,63}$/iu'], + 'فلسطين' => [1 => '/^[\x{0621}-\x{0624}\x{0626}-\x{063A}\x{0641}\x{0642}\x{0644}-\x{0648}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06CC}\x{06F0}-\x{06F9}]{1,30}$/iu'], + 'شبكة' => [1 => '/^[\x{0621}-\x{0624}\x{0626}-\x{063A}\x{0641}\x{0642}\x{0644}-\x{0648}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06CC}\x{06F0}-\x{06F9}]{1,30}$/iu'], + ]; + + /** @var array> */ + protected $idnLength = [ + 'BIZ' => [5 => 17, 11 => 15, 12 => 20], + 'CN' => [1 => 20], + 'COM' => [3 => 17, 5 => 20], + 'HK' => [1 => 15], + 'INFO' => [4 => 17], + 'KR' => [1 => 17], + 'NET' => [3 => 17, 5 => 20], + 'ORG' => [6 => 17], + 'TW' => [1 => 20], + 'امارات' => [1 => 30], + 'الاردن' => [1 => 30], + 'السعودية' => [1 => 30], + 'تونس' => [1 => 30], + 'مصر' => [1 => 30], + 'فلسطين' => [1 => 30], + 'شبكة' => [1 => 30], + '中国' => [1 => 20], + '中國' => [1 => 20], + '香港' => [1 => 20], + '台湾' => [1 => 20], + '台灣' => [1 => 20], + ]; + + /** @var null|false|string */ + protected $tld; + + /** + * Options for the hostname validator + * + * @var Options + */ + protected $options = [ + 'allow' => self::ALLOW_DNS, // Allow these hostnames + 'useIdnCheck' => true, // Check IDN domains + 'useTldCheck' => true, // Check TLD elements + 'ipValidator' => null, // IP validator to use + ]; + + // phpcs:disable Squiz.Commenting.FunctionComment.ExtraParamComment + + /** + * Sets validator options. + * + * @see http://www.iana.org/cctld/specifications-policies-cctlds-01apr02.htm Technical Specifications for ccTLDs + * + * Options Parameters should be passed as an array in the following format: + * $options = [ + * 'allow' => ALLOW_DNS, // OPTIONAL Set what types of hostname to allow (default ALLOW_DNS) + * 'useIdnCheck' => true, // OPTIONAL Set whether IDN domains are validated (default true) + * 'useTldCheck' => true, // Set whether the TLD element of a hostname is validated (default true) + * 'ipValidator' => null, // An IP validator instance or null @link Ip + * ]; + * + * For backwards compatibility, options can also be passed as variables in the order stated above. + * + * @param Options $options OPTIONAL Array of validator options; see Hostname::$options + */ + public function __construct($options = []) + { + if (! is_array($options)) { + $options = func_get_args(); + $temp['allow'] = array_shift($options); + if (! empty($options)) { + $temp['useIdnCheck'] = array_shift($options); + } + + if (! empty($options)) { + $temp['useTldCheck'] = array_shift($options); + } + + if (! empty($options)) { + $temp['ipValidator'] = array_shift($options); + } + + $options = $temp; + } + + if (! array_key_exists('ipValidator', $options)) { + $options['ipValidator'] = null; + } + + parent::__construct($options); + } + + /** + * Returns the set ip validator + * + * @deprecated Since 2.61.0 all options getters and setters will be removed in 3.0 + * + * @return Ip + */ + public function getIpValidator() + { + return $this->options['ipValidator']; + } + + /** + * @deprecated Since 2.61.0 all options getters and setters will be removed in 3.0 + * + * @param Ip $ipValidator OPTIONAL + * @return self + */ + public function setIpValidator(?Ip $ipValidator = null) + { + if ($ipValidator === null) { + $ipValidator = new Ip(); + } + + $this->options['ipValidator'] = $ipValidator; + return $this; + } + + /** + * Returns the allow option + * + * @deprecated Since 2.61.0 all options getters and setters will be removed in 3.0 + * + * @return int + */ + public function getAllow() + { + return $this->options['allow']; + } + + /** + * Sets the allow option + * + * @deprecated Since 2.61.0 all options getters and setters will be removed in 3.0 + * + * @param int $allow + * @return $this Provides a fluent interface + */ + public function setAllow($allow) + { + $this->options['allow'] = $allow; + return $this; + } + + /** + * Returns the set idn option + * + * @deprecated Since 2.61.0 all options getters and setters will be removed in 3.0 + * + * @return bool + */ + public function getIdnCheck() + { + return $this->options['useIdnCheck']; + } + + /** + * Set whether IDN domains are validated + * + * This only applies when DNS hostnames are validated + * + * @deprecated Since 2.61.0 all options getters and setters will be removed in 3.0 + * + * @param bool $useIdnCheck Set to true to validate IDN domains + * @return $this + */ + public function useIdnCheck($useIdnCheck) + { + $this->options['useIdnCheck'] = (bool) $useIdnCheck; + return $this; + } + + /** + * Returns the set tld option + * + * @deprecated Since 2.61.0 all options getters and setters will be removed in 3.0 + * + * @return bool + */ + public function getTldCheck() + { + return $this->options['useTldCheck']; + } + + /** + * Set whether the TLD element of a hostname is validated + * + * This only applies when DNS hostnames are validated + * + * @deprecated Since 2.61.0 all options getters and setters will be removed in 3.0 + * + * @param bool $useTldCheck Set to true to validate TLD elements + * @return $this + */ + public function useTldCheck($useTldCheck) + { + $this->options['useTldCheck'] = (bool) $useTldCheck; + return $this; + } + + /** + * Defined by Interface + * + * Returns true if and only if the $value is a valid hostname with respect to the current allow option + * + * @param string $value + * @return bool + */ + public function isValid($value) + { + if (! is_string($value)) { + $this->error(self::INVALID); + return false; + } + + $this->setValue($value); + // Check input against IP address schema + if ( + ((preg_match('/^[0-9.]*$/', $value) && str_contains($value, '.')) + || (preg_match('/^[0-9a-f:.]*$/i', $value) && str_contains($value, ':'))) + && $this->getIpValidator()->setTranslator($this->getTranslator())->isValid($value) + ) { + if (! ($this->getAllow() & self::ALLOW_IP)) { + $this->error(self::IP_ADDRESS_NOT_ALLOWED); + return false; + } + + return true; + } + + // Handle Regex compilation failure that may happen on .biz domain with has @ character, eg: tapi4457@hsoqvf.biz + // Technically, hostname with '@' character is invalid, so mark as invalid immediately + // @see https://github.com/laminas/laminas-validator/issues/8 + if (str_contains($value, '@')) { + $this->error(self::INVALID_HOSTNAME); + return false; + } + + // Local hostnames are allowed to be partial (ending '.') + if ($this->getAllow() & self::ALLOW_LOCAL) { + if (str_ends_with($value, '.')) { + $value = substr($value, 0, -1); + if (str_ends_with($value, '.')) { + // Empty hostnames (ending '..') are not allowed + $this->error(self::INVALID_LOCAL_NAME); + return false; + } + } + } + + $domainParts = explode('.', $value); + + // Prevent partial IP V4 addresses (ending '.') + if ( + count($domainParts) === 4 && preg_match('/^[0-9.a-e:.]*$/i', $value) + && $this->getIpValidator()->setTranslator($this->getTranslator())->isValid($value) + ) { + $this->error(self::INVALID_LOCAL_NAME); + } + + $utf8StrWrapper = StringUtils::getWrapper('UTF-8'); + + // Check input against DNS hostname schema + if ( + count($domainParts) > 1 + && $utf8StrWrapper->strlen($value) >= 4 + && $utf8StrWrapper->strlen($value) <= 254 + ) { + $status = false; + + do { + // First check TLD + $matches = []; + if ( + preg_match('/([^.]{2,63})$/u', end($domainParts), $matches) + || (array_key_exists(end($domainParts), $this->validIdns)) + ) { + reset($domainParts); + + // Hostname characters are: *(label dot)(label dot label); max 254 chars + // label: id-prefix [*ldh{61} id-prefix]; max 63 chars + // id-prefix: alpha / digit + // ldh: alpha / digit / dash + + $this->tld = $matches[1]; + // Decode Punycode TLD to IDN + if (str_starts_with($this->tld, 'xn--')) { + $this->tld = $this->decodePunycode(substr($this->tld, 4)); + if ($this->tld === false) { + return false; + } + } else { + $this->tld = strtoupper($this->tld); + } + + // Match TLD against known list + $removedTld = false; + if ($this->getTldCheck()) { + if ( + ! in_array(strtolower($this->tld), $this->validTlds) + && ! in_array($this->tld, $this->validTlds) + ) { + $this->error(self::UNKNOWN_TLD); + $status = false; + break; + } + // We have already validated that the TLD is fine. We don't want it to go through the below + // checks as new UTF-8 TLDs will incorrectly fail if there is no IDN regex for it. + array_pop($domainParts); + $removedTld = true; + } + + /** + * Match against IDN hostnames + * Note: Keep label regex short to avoid issues with long patterns when matching IDN hostnames + * + * @see Hostname\Interface + */ + $regexChars = [0 => '/^[a-z0-9\x2d]{1,63}$/i']; + if ($this->getIdnCheck() && isset($this->validIdns[$this->tld])) { + if (is_string($this->validIdns[$this->tld])) { + $regexChars += include __DIR__ . '/' . $this->validIdns[$this->tld]; + } else { + $regexChars += $this->validIdns[$this->tld]; + } + } + + // Check each hostname part + $check = 0; + $lastDomainPart = end($domainParts); + if (! $removedTld) { + $lastDomainPart = prev($domainParts); + } + foreach ($domainParts as $domainPart) { + // Decode Punycode domain names to IDN + if (str_starts_with($domainPart, 'xn--')) { + $domainPart = $this->decodePunycode(substr($domainPart, 4)); + if ($domainPart === false) { + return false; + } + } + + // Skip following checks if domain part is empty, as it definitely is not a valid hostname then + if ($domainPart === '') { + $this->error(self::INVALID_HOSTNAME); + $status = false; + break 2; + } + + // Check dash (-) does not start, end or appear in 3rd and 4th positions + if ( + $utf8StrWrapper->strpos($domainPart, '-') === 0 + || ($utf8StrWrapper->strlen($domainPart) > 2 + && $utf8StrWrapper->strpos($domainPart, '-', 2) === 2 + && $utf8StrWrapper->strpos($domainPart, '-', 3) === 3 + ) + || $utf8StrWrapper->substr($domainPart, -1) === '-' + ) { + $this->error(self::INVALID_DASH); + $status = false; + break 2; + } + + // Check each domain part + $checked = false; + $isSubDomain = $domainPart !== $lastDomainPart; + $partRegexChars = $isSubDomain ? ['/^[a-z0-9_\x2d]{1,63}$/i'] + $regexChars : $regexChars; + foreach ($partRegexChars as $regexKey => $regexChar) { + $status = preg_match($regexChar, $domainPart); + if ($status > 0) { + $length = 63; + if ( + array_key_exists($this->tld, $this->idnLength) + && array_key_exists($regexKey, $this->idnLength[$this->tld]) + ) { + $length = $this->idnLength[$this->tld]; + } + + if ($utf8StrWrapper->strlen($domainPart) > $length) { + $this->error(self::INVALID_HOSTNAME); + $status = false; + } else { + $checked = true; + break; + } + } + } + + if ($checked) { + ++$check; + } + } + + // If one of the labels doesn't match, the hostname is invalid + if ($check !== count($domainParts)) { + $this->error(self::INVALID_HOSTNAME_SCHEMA); + $status = false; + } + } else { + // Hostname not long enough + $this->error(self::UNDECIPHERABLE_TLD); + $status = false; + } + } while (false); + + // If the input passes as an Internet domain name, and domain names are allowed, then the hostname + // passes validation + if ($status && ($this->getAllow() & self::ALLOW_DNS)) { + return true; + } + } elseif ($this->getAllow() & self::ALLOW_DNS) { + $this->error(self::INVALID_HOSTNAME); + } + + // Check for URI Syntax (RFC3986) + if ($this->getAllow() & self::ALLOW_URI) { + if (preg_match("/^([a-zA-Z0-9-._~!$&\'()*+,;=]|%[[:xdigit:]]{2}){1,254}$/i", $value)) { + return true; + } + + $this->error(self::INVALID_URI); + } + + // Check input against local network name schema; last chance to pass validation + $regexLocal = '/^(([a-zA-Z0-9\x2d]{1,63}\x2e)*[a-zA-Z0-9\x2d]{1,63}[\x2e]{0,1}){1,254}$/'; + $status = preg_match($regexLocal, $value); + + // If the input passes as a local network name, and local network names are allowed, then the + // hostname passes validation + $allowLocal = $this->getAllow() & self::ALLOW_LOCAL; + if ($status && $allowLocal) { + return true; + } + + // If the input does not pass as a local network name, add a message + if (! $status) { + $this->error(self::INVALID_LOCAL_NAME); + } + + // If local network names are not allowed, add a message + if ($status && ! $allowLocal) { + $this->error(self::LOCAL_NAME_NOT_ALLOWED); + } + + return false; + } + + /** + * Decodes a punycode encoded string to it's original utf8 string + * Returns false in case of a decoding failure. + * + * @param string $encoded Punycode encoded string to decode + * @return string|false + */ + protected function decodePunycode($encoded) + { + if (! preg_match('/^[a-z0-9-]+$/i', $encoded)) { + // no punycode encoded string + $this->error(self::CANNOT_DECODE_PUNYCODE); + return false; + } + + $decoded = []; + $separator = strrpos($encoded, '-'); + if ($separator > 0) { + for ($x = 0; $x < $separator; ++$x) { + // prepare decoding matrix + $decoded[] = ord($encoded[$x]); + } + } + + $lengthd = count($decoded); + $lengthe = strlen($encoded); + + // decoding + $init = true; + $base = 72; + $index = 0; + $char = 0x80; + + for ($indexe = $separator !== false ? $separator + 1 : 0; $indexe < $lengthe; ++$lengthd) { + for ($oldIndex = $index, $pos = 1, $key = 36; 1; $key += 36) { + if (! isset($encoded[$indexe])) { + break 2; + } + + $hex = ord($encoded[$indexe++]); + $digit = $hex - 48 < 10 ? $hex - 22 + : ($hex - 65 < 26 ? $hex - 65 + : ($hex - 97 < 26 ? $hex - 97 + : 36)); + + $index += $digit * $pos; + $tag = $key <= $base ? 1 : ($key >= $base + 26 ? 26 : $key - $base); + if ($digit < $tag) { + break; + } + + $pos = (int) ($pos * (36 - $tag)); + } + + $delta = intval($init ? ($index - $oldIndex) / 700 : ($index - $oldIndex) / 2); + $delta += intval($delta / ($lengthd + 1)); + for ($key = 0; $delta > 910 / 2; $key += 36) { + $delta = intval($delta / 35); + } + + $base = intval($key + 36 * $delta / ($delta + 38)); + $init = false; + $char += (int) ($index / ($lengthd + 1)); + $index %= $lengthd + 1; + if ($lengthd > 0) { + for ($i = $lengthd; $i > $index; $i--) { + $decoded[$i] = $decoded[$i - 1]; + } + } + + $decoded[$index++] = $char; + } + + // convert decoded ucs4 to utf8 string + foreach ($decoded as $key => $value) { + if ($value < 128) { + $decoded[$key] = chr($value); + } elseif ($value < 1 << 11) { + $decoded[$key] = chr(192 + ($value >> 6)); + $decoded[$key] .= chr(128 + ($value & 63)); + } elseif ($value < 1 << 16) { + $decoded[$key] = chr(224 + ($value >> 12)); + $decoded[$key] .= chr(128 + (($value >> 6) & 63)); + $decoded[$key] .= chr(128 + ($value & 63)); + } elseif ($value < 1 << 21) { + $decoded[$key] = chr(240 + ($value >> 18)); + $decoded[$key] .= chr(128 + (($value >> 12) & 63)); + $decoded[$key] .= chr(128 + (($value >> 6) & 63)); + $decoded[$key] .= chr(128 + ($value & 63)); + } else { + $this->error(self::CANNOT_DECODE_PUNYCODE); + return false; + } + } + + return implode($decoded); + } +} diff --git a/vendor/laminas/laminas-validator/src/Hostname/Biz.php b/vendor/laminas/laminas-validator/src/Hostname/Biz.php new file mode 100644 index 00000000..f852cf1c --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Hostname/Biz.php @@ -0,0 +1,2897 @@ + '/^[\x{002d}0-9a-zäåæéöøü]{1,63}$/iu', + 2 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu', + 3 => '/^[\x{002d}0-9a-záéíóöúüőű]{1,63}$/iu', + 4 => '/^[\x{002d}0-9a-záæéíðóöúýþ]{1,63}$/iu', + 5 => '/^[\x{AC00}-\x{D7A3}]{1,17}$/iu', + 6 => '/^[\x{002d}0-9a-ząčėęįšūųž]{1,63}$/iu', + 7 => '/^[\x{002d}0-9a-zāčēģīķļņōŗšūž]{1,63}$/iu', + 8 => '/^[\x{002d}0-9a-zàáä-éêñ-ôöøüčđńŋšŧž]{1,63}$/iu', + 9 => '/^[\x{002d}0-9a-zóąćęłńśźż]{1,63}$/iu', + 10 => '/^[\x{002d}0-9a-záàâãçéêíóôõú]{1,63}$/iu', + 11 => '/^[\x{002d}0-9a-z\x{3005}-\x{3007}\x{3041}-\x{3093}\x{309D}\x{309E}\x{30A1}-\x{30F6}\x{30FC}' + . '\x{30FD}\x{30FE}\x{4E00}\x{4E01}\x{4E03}\x{4E07}\x{4E08}\x{4E09}\x{4E0A}' + . '\x{4E0B}\x{4E0D}\x{4E0E}\x{4E10}\x{4E11}\x{4E14}\x{4E15}\x{4E16}\x{4E17}' + . '\x{4E18}\x{4E19}\x{4E1E}\x{4E21}\x{4E26}\x{4E2A}\x{4E2D}\x{4E31}\x{4E32}' + . '\x{4E36}\x{4E38}\x{4E39}\x{4E3B}\x{4E3C}\x{4E3F}\x{4E42}\x{4E43}\x{4E45}' + . '\x{4E4B}\x{4E4D}\x{4E4E}\x{4E4F}\x{4E55}\x{4E56}\x{4E57}\x{4E58}\x{4E59}' + . '\x{4E5D}\x{4E5E}\x{4E5F}\x{4E62}\x{4E71}\x{4E73}\x{4E7E}\x{4E80}\x{4E82}' + . '\x{4E85}\x{4E86}\x{4E88}\x{4E89}\x{4E8A}\x{4E8B}\x{4E8C}\x{4E8E}\x{4E91}' + . '\x{4E92}\x{4E94}\x{4E95}\x{4E98}\x{4E99}\x{4E9B}\x{4E9C}\x{4E9E}\x{4E9F}' + . '\x{4EA0}\x{4EA1}\x{4EA2}\x{4EA4}\x{4EA5}\x{4EA6}\x{4EA8}\x{4EAB}\x{4EAC}' + . '\x{4EAD}\x{4EAE}\x{4EB0}\x{4EB3}\x{4EB6}\x{4EBA}\x{4EC0}\x{4EC1}\x{4EC2}' + . '\x{4EC4}\x{4EC6}\x{4EC7}\x{4ECA}\x{4ECB}\x{4ECD}\x{4ECE}\x{4ECF}\x{4ED4}' + . '\x{4ED5}\x{4ED6}\x{4ED7}\x{4ED8}\x{4ED9}\x{4EDD}\x{4EDE}\x{4EDF}\x{4EE3}' + . '\x{4EE4}\x{4EE5}\x{4EED}\x{4EEE}\x{4EF0}\x{4EF2}\x{4EF6}\x{4EF7}\x{4EFB}' + . '\x{4F01}\x{4F09}\x{4F0A}\x{4F0D}\x{4F0E}\x{4F0F}\x{4F10}\x{4F11}\x{4F1A}' + . '\x{4F1C}\x{4F1D}\x{4F2F}\x{4F30}\x{4F34}\x{4F36}\x{4F38}\x{4F3A}\x{4F3C}' + . '\x{4F3D}\x{4F43}\x{4F46}\x{4F47}\x{4F4D}\x{4F4E}\x{4F4F}\x{4F50}\x{4F51}' + . '\x{4F53}\x{4F55}\x{4F57}\x{4F59}\x{4F5A}\x{4F5B}\x{4F5C}\x{4F5D}\x{4F5E}' + . '\x{4F69}\x{4F6F}\x{4F70}\x{4F73}\x{4F75}\x{4F76}\x{4F7B}\x{4F7C}\x{4F7F}' + . '\x{4F83}\x{4F86}\x{4F88}\x{4F8B}\x{4F8D}\x{4F8F}\x{4F91}\x{4F96}\x{4F98}' + . '\x{4F9B}\x{4F9D}\x{4FA0}\x{4FA1}\x{4FAB}\x{4FAD}\x{4FAE}\x{4FAF}\x{4FB5}' + . '\x{4FB6}\x{4FBF}\x{4FC2}\x{4FC3}\x{4FC4}\x{4FCA}\x{4FCE}\x{4FD0}\x{4FD1}' + . '\x{4FD4}\x{4FD7}\x{4FD8}\x{4FDA}\x{4FDB}\x{4FDD}\x{4FDF}\x{4FE1}\x{4FE3}' + . '\x{4FE4}\x{4FE5}\x{4FEE}\x{4FEF}\x{4FF3}\x{4FF5}\x{4FF6}\x{4FF8}\x{4FFA}' + . '\x{4FFE}\x{5005}\x{5006}\x{5009}\x{500B}\x{500D}\x{500F}\x{5011}\x{5012}' + . '\x{5014}\x{5016}\x{5019}\x{501A}\x{501F}\x{5021}\x{5023}\x{5024}\x{5025}' + . '\x{5026}\x{5028}\x{5029}\x{502A}\x{502B}\x{502C}\x{502D}\x{5036}\x{5039}' + . '\x{5043}\x{5047}\x{5048}\x{5049}\x{504F}\x{5050}\x{5055}\x{5056}\x{505A}' + . '\x{505C}\x{5065}\x{506C}\x{5072}\x{5074}\x{5075}\x{5076}\x{5078}\x{507D}' + . '\x{5080}\x{5085}\x{508D}\x{5091}\x{5098}\x{5099}\x{509A}\x{50AC}\x{50AD}' + . '\x{50B2}\x{50B3}\x{50B4}\x{50B5}\x{50B7}\x{50BE}\x{50C2}\x{50C5}\x{50C9}' + . '\x{50CA}\x{50CD}\x{50CF}\x{50D1}\x{50D5}\x{50D6}\x{50DA}\x{50DE}\x{50E3}' + . '\x{50E5}\x{50E7}\x{50ED}\x{50EE}\x{50F5}\x{50F9}\x{50FB}\x{5100}\x{5101}' + . '\x{5102}\x{5104}\x{5109}\x{5112}\x{5114}\x{5115}\x{5116}\x{5118}\x{511A}' + . '\x{511F}\x{5121}\x{512A}\x{5132}\x{5137}\x{513A}\x{513B}\x{513C}\x{513F}' + . '\x{5140}\x{5141}\x{5143}\x{5144}\x{5145}\x{5146}\x{5147}\x{5148}\x{5149}' + . '\x{514B}\x{514C}\x{514D}\x{514E}\x{5150}\x{5152}\x{5154}\x{515A}\x{515C}' + . '\x{5162}\x{5165}\x{5168}\x{5169}\x{516A}\x{516B}\x{516C}\x{516D}\x{516E}' + . '\x{5171}\x{5175}\x{5176}\x{5177}\x{5178}\x{517C}\x{5180}\x{5182}\x{5185}' + . '\x{5186}\x{5189}\x{518A}\x{518C}\x{518D}\x{518F}\x{5190}\x{5191}\x{5192}' + . '\x{5193}\x{5195}\x{5196}\x{5197}\x{5199}\x{51A0}\x{51A2}\x{51A4}\x{51A5}' + . '\x{51A6}\x{51A8}\x{51A9}\x{51AA}\x{51AB}\x{51AC}\x{51B0}\x{51B1}\x{51B2}' + . '\x{51B3}\x{51B4}\x{51B5}\x{51B6}\x{51B7}\x{51BD}\x{51C4}\x{51C5}\x{51C6}' + . '\x{51C9}\x{51CB}\x{51CC}\x{51CD}\x{51D6}\x{51DB}\x{51DC}\x{51DD}\x{51E0}' + . '\x{51E1}\x{51E6}\x{51E7}\x{51E9}\x{51EA}\x{51ED}\x{51F0}\x{51F1}\x{51F5}' + . '\x{51F6}\x{51F8}\x{51F9}\x{51FA}\x{51FD}\x{51FE}\x{5200}\x{5203}\x{5204}' + . '\x{5206}\x{5207}\x{5208}\x{520A}\x{520B}\x{520E}\x{5211}\x{5214}\x{5217}' + . '\x{521D}\x{5224}\x{5225}\x{5227}\x{5229}\x{522A}\x{522E}\x{5230}\x{5233}' + . '\x{5236}\x{5237}\x{5238}\x{5239}\x{523A}\x{523B}\x{5243}\x{5244}\x{5247}' + . '\x{524A}\x{524B}\x{524C}\x{524D}\x{524F}\x{5254}\x{5256}\x{525B}\x{525E}' + . '\x{5263}\x{5264}\x{5265}\x{5269}\x{526A}\x{526F}\x{5270}\x{5271}\x{5272}' + . '\x{5273}\x{5274}\x{5275}\x{527D}\x{527F}\x{5283}\x{5287}\x{5288}\x{5289}' + . '\x{528D}\x{5291}\x{5292}\x{5294}\x{529B}\x{529F}\x{52A0}\x{52A3}\x{52A9}' + . '\x{52AA}\x{52AB}\x{52AC}\x{52AD}\x{52B1}\x{52B4}\x{52B5}\x{52B9}\x{52BC}' + . '\x{52BE}\x{52C1}\x{52C3}\x{52C5}\x{52C7}\x{52C9}\x{52CD}\x{52D2}\x{52D5}' + . '\x{52D7}\x{52D8}\x{52D9}\x{52DD}\x{52DE}\x{52DF}\x{52E0}\x{52E2}\x{52E3}' + . '\x{52E4}\x{52E6}\x{52E7}\x{52F2}\x{52F3}\x{52F5}\x{52F8}\x{52F9}\x{52FA}' + . '\x{52FE}\x{52FF}\x{5301}\x{5302}\x{5305}\x{5306}\x{5308}\x{530D}\x{530F}' + . '\x{5310}\x{5315}\x{5316}\x{5317}\x{5319}\x{531A}\x{531D}\x{5320}\x{5321}' + . '\x{5323}\x{532A}\x{532F}\x{5331}\x{5333}\x{5338}\x{5339}\x{533A}\x{533B}' + . '\x{533F}\x{5340}\x{5341}\x{5343}\x{5345}\x{5346}\x{5347}\x{5348}\x{5349}' + . '\x{534A}\x{534D}\x{5351}\x{5352}\x{5353}\x{5354}\x{5357}\x{5358}\x{535A}' + . '\x{535C}\x{535E}\x{5360}\x{5366}\x{5369}\x{536E}\x{536F}\x{5370}\x{5371}' + . '\x{5373}\x{5374}\x{5375}\x{5377}\x{5378}\x{537B}\x{537F}\x{5382}\x{5384}' + . '\x{5396}\x{5398}\x{539A}\x{539F}\x{53A0}\x{53A5}\x{53A6}\x{53A8}\x{53A9}' + . '\x{53AD}\x{53AE}\x{53B0}\x{53B3}\x{53B6}\x{53BB}\x{53C2}\x{53C3}\x{53C8}' + . '\x{53C9}\x{53CA}\x{53CB}\x{53CC}\x{53CD}\x{53CE}\x{53D4}\x{53D6}\x{53D7}' + . '\x{53D9}\x{53DB}\x{53DF}\x{53E1}\x{53E2}\x{53E3}\x{53E4}\x{53E5}\x{53E8}' + . '\x{53E9}\x{53EA}\x{53EB}\x{53EC}\x{53ED}\x{53EE}\x{53EF}\x{53F0}\x{53F1}' + . '\x{53F2}\x{53F3}\x{53F6}\x{53F7}\x{53F8}\x{53FA}\x{5401}\x{5403}\x{5404}' + . '\x{5408}\x{5409}\x{540A}\x{540B}\x{540C}\x{540D}\x{540E}\x{540F}\x{5410}' + . '\x{5411}\x{541B}\x{541D}\x{541F}\x{5420}\x{5426}\x{5429}\x{542B}\x{542C}' + . '\x{542D}\x{542E}\x{5436}\x{5438}\x{5439}\x{543B}\x{543C}\x{543D}\x{543E}' + . '\x{5440}\x{5442}\x{5446}\x{5448}\x{5449}\x{544A}\x{544E}\x{5451}\x{545F}' + . '\x{5468}\x{546A}\x{5470}\x{5471}\x{5473}\x{5475}\x{5476}\x{5477}\x{547B}' + . '\x{547C}\x{547D}\x{5480}\x{5484}\x{5486}\x{548B}\x{548C}\x{548E}\x{548F}' + . '\x{5490}\x{5492}\x{54A2}\x{54A4}\x{54A5}\x{54A8}\x{54AB}\x{54AC}\x{54AF}' + . '\x{54B2}\x{54B3}\x{54B8}\x{54BC}\x{54BD}\x{54BE}\x{54C0}\x{54C1}\x{54C2}' + . '\x{54C4}\x{54C7}\x{54C8}\x{54C9}\x{54D8}\x{54E1}\x{54E2}\x{54E5}\x{54E6}' + . '\x{54E8}\x{54E9}\x{54ED}\x{54EE}\x{54F2}\x{54FA}\x{54FD}\x{5504}\x{5506}' + . '\x{5507}\x{550F}\x{5510}\x{5514}\x{5516}\x{552E}\x{552F}\x{5531}\x{5533}' + . '\x{5538}\x{5539}\x{553E}\x{5540}\x{5544}\x{5545}\x{5546}\x{554C}\x{554F}' + . '\x{5553}\x{5556}\x{5557}\x{555C}\x{555D}\x{5563}\x{557B}\x{557C}\x{557E}' + . '\x{5580}\x{5583}\x{5584}\x{5587}\x{5589}\x{558A}\x{558B}\x{5598}\x{5599}' + . '\x{559A}\x{559C}\x{559D}\x{559E}\x{559F}\x{55A7}\x{55A8}\x{55A9}\x{55AA}' + . '\x{55AB}\x{55AC}\x{55AE}\x{55B0}\x{55B6}\x{55C4}\x{55C5}\x{55C7}\x{55D4}' + . '\x{55DA}\x{55DC}\x{55DF}\x{55E3}\x{55E4}\x{55F7}\x{55F9}\x{55FD}\x{55FE}' + . '\x{5606}\x{5609}\x{5614}\x{5616}\x{5617}\x{5618}\x{561B}\x{5629}\x{562F}' + . '\x{5631}\x{5632}\x{5634}\x{5636}\x{5638}\x{5642}\x{564C}\x{564E}\x{5650}' + . '\x{565B}\x{5664}\x{5668}\x{566A}\x{566B}\x{566C}\x{5674}\x{5678}\x{567A}' + . '\x{5680}\x{5686}\x{5687}\x{568A}\x{568F}\x{5694}\x{56A0}\x{56A2}\x{56A5}' + . '\x{56AE}\x{56B4}\x{56B6}\x{56BC}\x{56C0}\x{56C1}\x{56C2}\x{56C3}\x{56C8}' + . '\x{56CE}\x{56D1}\x{56D3}\x{56D7}\x{56D8}\x{56DA}\x{56DB}\x{56DE}\x{56E0}' + . '\x{56E3}\x{56EE}\x{56F0}\x{56F2}\x{56F3}\x{56F9}\x{56FA}\x{56FD}\x{56FF}' + . '\x{5700}\x{5703}\x{5704}\x{5708}\x{5709}\x{570B}\x{570D}\x{570F}\x{5712}' + . '\x{5713}\x{5716}\x{5718}\x{571C}\x{571F}\x{5726}\x{5727}\x{5728}\x{572D}' + . '\x{5730}\x{5737}\x{5738}\x{573B}\x{5740}\x{5742}\x{5747}\x{574A}\x{574E}' + . '\x{574F}\x{5750}\x{5751}\x{5761}\x{5764}\x{5766}\x{5769}\x{576A}\x{577F}' + . '\x{5782}\x{5788}\x{5789}\x{578B}\x{5793}\x{57A0}\x{57A2}\x{57A3}\x{57A4}' + . '\x{57AA}\x{57B0}\x{57B3}\x{57C0}\x{57C3}\x{57C6}\x{57CB}\x{57CE}\x{57D2}' + . '\x{57D3}\x{57D4}\x{57D6}\x{57DC}\x{57DF}\x{57E0}\x{57E3}\x{57F4}\x{57F7}' + . '\x{57F9}\x{57FA}\x{57FC}\x{5800}\x{5802}\x{5805}\x{5806}\x{580A}\x{580B}' + . '\x{5815}\x{5819}\x{581D}\x{5821}\x{5824}\x{582A}\x{582F}\x{5830}\x{5831}' + . '\x{5834}\x{5835}\x{583A}\x{583D}\x{5840}\x{5841}\x{584A}\x{584B}\x{5851}' + . '\x{5852}\x{5854}\x{5857}\x{5858}\x{5859}\x{585A}\x{585E}\x{5862}\x{5869}' + . '\x{586B}\x{5870}\x{5872}\x{5875}\x{5879}\x{587E}\x{5883}\x{5885}\x{5893}' + . '\x{5897}\x{589C}\x{589F}\x{58A8}\x{58AB}\x{58AE}\x{58B3}\x{58B8}\x{58B9}' + . '\x{58BA}\x{58BB}\x{58BE}\x{58C1}\x{58C5}\x{58C7}\x{58CA}\x{58CC}\x{58D1}' + . '\x{58D3}\x{58D5}\x{58D7}\x{58D8}\x{58D9}\x{58DC}\x{58DE}\x{58DF}\x{58E4}' + . '\x{58E5}\x{58EB}\x{58EC}\x{58EE}\x{58EF}\x{58F0}\x{58F1}\x{58F2}\x{58F7}' + . '\x{58F9}\x{58FA}\x{58FB}\x{58FC}\x{58FD}\x{5902}\x{5909}\x{590A}\x{590F}' + . '\x{5910}\x{5915}\x{5916}\x{5918}\x{5919}\x{591A}\x{591B}\x{591C}\x{5922}' + . '\x{5925}\x{5927}\x{5929}\x{592A}\x{592B}\x{592C}\x{592D}\x{592E}\x{5931}' + . '\x{5932}\x{5937}\x{5938}\x{593E}\x{5944}\x{5947}\x{5948}\x{5949}\x{594E}' + . '\x{594F}\x{5950}\x{5951}\x{5954}\x{5955}\x{5957}\x{5958}\x{595A}\x{5960}' + . '\x{5962}\x{5965}\x{5967}\x{5968}\x{5969}\x{596A}\x{596C}\x{596E}\x{5973}' + . '\x{5974}\x{5978}\x{597D}\x{5981}\x{5982}\x{5983}\x{5984}\x{598A}\x{598D}' + . '\x{5993}\x{5996}\x{5999}\x{599B}\x{599D}\x{59A3}\x{59A5}\x{59A8}\x{59AC}' + . '\x{59B2}\x{59B9}\x{59BB}\x{59BE}\x{59C6}\x{59C9}\x{59CB}\x{59D0}\x{59D1}' + . '\x{59D3}\x{59D4}\x{59D9}\x{59DA}\x{59DC}\x{59E5}\x{59E6}\x{59E8}\x{59EA}' + . '\x{59EB}\x{59F6}\x{59FB}\x{59FF}\x{5A01}\x{5A03}\x{5A09}\x{5A11}\x{5A18}' + . '\x{5A1A}\x{5A1C}\x{5A1F}\x{5A20}\x{5A25}\x{5A29}\x{5A2F}\x{5A35}\x{5A36}' + . '\x{5A3C}\x{5A40}\x{5A41}\x{5A46}\x{5A49}\x{5A5A}\x{5A62}\x{5A66}\x{5A6A}' + . '\x{5A6C}\x{5A7F}\x{5A92}\x{5A9A}\x{5A9B}\x{5ABC}\x{5ABD}\x{5ABE}\x{5AC1}' + . '\x{5AC2}\x{5AC9}\x{5ACB}\x{5ACC}\x{5AD0}\x{5AD6}\x{5AD7}\x{5AE1}\x{5AE3}' + . '\x{5AE6}\x{5AE9}\x{5AFA}\x{5AFB}\x{5B09}\x{5B0B}\x{5B0C}\x{5B16}\x{5B22}' + . '\x{5B2A}\x{5B2C}\x{5B30}\x{5B32}\x{5B36}\x{5B3E}\x{5B40}\x{5B43}\x{5B45}' + . '\x{5B50}\x{5B51}\x{5B54}\x{5B55}\x{5B57}\x{5B58}\x{5B5A}\x{5B5B}\x{5B5C}' + . '\x{5B5D}\x{5B5F}\x{5B63}\x{5B64}\x{5B65}\x{5B66}\x{5B69}\x{5B6B}\x{5B70}' + . '\x{5B71}\x{5B73}\x{5B75}\x{5B78}\x{5B7A}\x{5B80}\x{5B83}\x{5B85}\x{5B87}' + . '\x{5B88}\x{5B89}\x{5B8B}\x{5B8C}\x{5B8D}\x{5B8F}\x{5B95}\x{5B97}\x{5B98}' + . '\x{5B99}\x{5B9A}\x{5B9B}\x{5B9C}\x{5B9D}\x{5B9F}\x{5BA2}\x{5BA3}\x{5BA4}' + . '\x{5BA5}\x{5BA6}\x{5BAE}\x{5BB0}\x{5BB3}\x{5BB4}\x{5BB5}\x{5BB6}\x{5BB8}' + . '\x{5BB9}\x{5BBF}\x{5BC2}\x{5BC3}\x{5BC4}\x{5BC5}\x{5BC6}\x{5BC7}\x{5BC9}' + . '\x{5BCC}\x{5BD0}\x{5BD2}\x{5BD3}\x{5BD4}\x{5BDB}\x{5BDD}\x{5BDE}\x{5BDF}' + . '\x{5BE1}\x{5BE2}\x{5BE4}\x{5BE5}\x{5BE6}\x{5BE7}\x{5BE8}\x{5BE9}\x{5BEB}' + . '\x{5BEE}\x{5BF0}\x{5BF3}\x{5BF5}\x{5BF6}\x{5BF8}\x{5BFA}\x{5BFE}\x{5BFF}' + . '\x{5C01}\x{5C02}\x{5C04}\x{5C05}\x{5C06}\x{5C07}\x{5C08}\x{5C09}\x{5C0A}' + . '\x{5C0B}\x{5C0D}\x{5C0E}\x{5C0F}\x{5C11}\x{5C13}\x{5C16}\x{5C1A}\x{5C20}' + . '\x{5C22}\x{5C24}\x{5C28}\x{5C2D}\x{5C31}\x{5C38}\x{5C39}\x{5C3A}\x{5C3B}' + . '\x{5C3C}\x{5C3D}\x{5C3E}\x{5C3F}\x{5C40}\x{5C41}\x{5C45}\x{5C46}\x{5C48}' + . '\x{5C4A}\x{5C4B}\x{5C4D}\x{5C4E}\x{5C4F}\x{5C50}\x{5C51}\x{5C53}\x{5C55}' + . '\x{5C5E}\x{5C60}\x{5C61}\x{5C64}\x{5C65}\x{5C6C}\x{5C6E}\x{5C6F}\x{5C71}' + . '\x{5C76}\x{5C79}\x{5C8C}\x{5C90}\x{5C91}\x{5C94}\x{5CA1}\x{5CA8}\x{5CA9}' + . '\x{5CAB}\x{5CAC}\x{5CB1}\x{5CB3}\x{5CB6}\x{5CB7}\x{5CB8}\x{5CBB}\x{5CBC}' + . '\x{5CBE}\x{5CC5}\x{5CC7}\x{5CD9}\x{5CE0}\x{5CE1}\x{5CE8}\x{5CE9}\x{5CEA}' + . '\x{5CED}\x{5CEF}\x{5CF0}\x{5CF6}\x{5CFA}\x{5CFB}\x{5CFD}\x{5D07}\x{5D0B}' + . '\x{5D0E}\x{5D11}\x{5D14}\x{5D15}\x{5D16}\x{5D17}\x{5D18}\x{5D19}\x{5D1A}' + . '\x{5D1B}\x{5D1F}\x{5D22}\x{5D29}\x{5D4B}\x{5D4C}\x{5D4E}\x{5D50}\x{5D52}' + . '\x{5D5C}\x{5D69}\x{5D6C}\x{5D6F}\x{5D73}\x{5D76}\x{5D82}\x{5D84}\x{5D87}' + . '\x{5D8B}\x{5D8C}\x{5D90}\x{5D9D}\x{5DA2}\x{5DAC}\x{5DAE}\x{5DB7}\x{5DBA}' + . '\x{5DBC}\x{5DBD}\x{5DC9}\x{5DCC}\x{5DCD}\x{5DD2}\x{5DD3}\x{5DD6}\x{5DDB}' + . '\x{5DDD}\x{5DDE}\x{5DE1}\x{5DE3}\x{5DE5}\x{5DE6}\x{5DE7}\x{5DE8}\x{5DEB}' + . '\x{5DEE}\x{5DF1}\x{5DF2}\x{5DF3}\x{5DF4}\x{5DF5}\x{5DF7}\x{5DFB}\x{5DFD}' + . '\x{5DFE}\x{5E02}\x{5E03}\x{5E06}\x{5E0B}\x{5E0C}\x{5E11}\x{5E16}\x{5E19}' + . '\x{5E1A}\x{5E1B}\x{5E1D}\x{5E25}\x{5E2B}\x{5E2D}\x{5E2F}\x{5E30}\x{5E33}' + . '\x{5E36}\x{5E37}\x{5E38}\x{5E3D}\x{5E40}\x{5E43}\x{5E44}\x{5E45}\x{5E47}' + . '\x{5E4C}\x{5E4E}\x{5E54}\x{5E55}\x{5E57}\x{5E5F}\x{5E61}\x{5E62}\x{5E63}' + . '\x{5E64}\x{5E72}\x{5E73}\x{5E74}\x{5E75}\x{5E76}\x{5E78}\x{5E79}\x{5E7A}' + . '\x{5E7B}\x{5E7C}\x{5E7D}\x{5E7E}\x{5E7F}\x{5E81}\x{5E83}\x{5E84}\x{5E87}' + . '\x{5E8A}\x{5E8F}\x{5E95}\x{5E96}\x{5E97}\x{5E9A}\x{5E9C}\x{5EA0}\x{5EA6}' + . '\x{5EA7}\x{5EAB}\x{5EAD}\x{5EB5}\x{5EB6}\x{5EB7}\x{5EB8}\x{5EC1}\x{5EC2}' + . '\x{5EC3}\x{5EC8}\x{5EC9}\x{5ECA}\x{5ECF}\x{5ED0}\x{5ED3}\x{5ED6}\x{5EDA}' + . '\x{5EDB}\x{5EDD}\x{5EDF}\x{5EE0}\x{5EE1}\x{5EE2}\x{5EE3}\x{5EE8}\x{5EE9}' + . '\x{5EEC}\x{5EF0}\x{5EF1}\x{5EF3}\x{5EF4}\x{5EF6}\x{5EF7}\x{5EF8}\x{5EFA}' + . '\x{5EFB}\x{5EFC}\x{5EFE}\x{5EFF}\x{5F01}\x{5F03}\x{5F04}\x{5F09}\x{5F0A}' + . '\x{5F0B}\x{5F0C}\x{5F0D}\x{5F0F}\x{5F10}\x{5F11}\x{5F13}\x{5F14}\x{5F15}' + . '\x{5F16}\x{5F17}\x{5F18}\x{5F1B}\x{5F1F}\x{5F25}\x{5F26}\x{5F27}\x{5F29}' + . '\x{5F2D}\x{5F2F}\x{5F31}\x{5F35}\x{5F37}\x{5F38}\x{5F3C}\x{5F3E}\x{5F41}' + . '\x{5F48}\x{5F4A}\x{5F4C}\x{5F4E}\x{5F51}\x{5F53}\x{5F56}\x{5F57}\x{5F59}' + . '\x{5F5C}\x{5F5D}\x{5F61}\x{5F62}\x{5F66}\x{5F69}\x{5F6A}\x{5F6B}\x{5F6C}' + . '\x{5F6D}\x{5F70}\x{5F71}\x{5F73}\x{5F77}\x{5F79}\x{5F7C}\x{5F7F}\x{5F80}' + . '\x{5F81}\x{5F82}\x{5F83}\x{5F84}\x{5F85}\x{5F87}\x{5F88}\x{5F8A}\x{5F8B}' + . '\x{5F8C}\x{5F90}\x{5F91}\x{5F92}\x{5F93}\x{5F97}\x{5F98}\x{5F99}\x{5F9E}' + . '\x{5FA0}\x{5FA1}\x{5FA8}\x{5FA9}\x{5FAA}\x{5FAD}\x{5FAE}\x{5FB3}\x{5FB4}' + . '\x{5FB9}\x{5FBC}\x{5FBD}\x{5FC3}\x{5FC5}\x{5FCC}\x{5FCD}\x{5FD6}\x{5FD7}' + . '\x{5FD8}\x{5FD9}\x{5FDC}\x{5FDD}\x{5FE0}\x{5FE4}\x{5FEB}\x{5FF0}\x{5FF1}' + . '\x{5FF5}\x{5FF8}\x{5FFB}\x{5FFD}\x{5FFF}\x{600E}\x{600F}\x{6010}\x{6012}' + . '\x{6015}\x{6016}\x{6019}\x{601B}\x{601C}\x{601D}\x{6020}\x{6021}\x{6025}' + . '\x{6026}\x{6027}\x{6028}\x{6029}\x{602A}\x{602B}\x{602F}\x{6031}\x{603A}' + . '\x{6041}\x{6042}\x{6043}\x{6046}\x{604A}\x{604B}\x{604D}\x{6050}\x{6052}' + . '\x{6055}\x{6059}\x{605A}\x{605F}\x{6060}\x{6062}\x{6063}\x{6064}\x{6065}' + . '\x{6068}\x{6069}\x{606A}\x{606B}\x{606C}\x{606D}\x{606F}\x{6070}\x{6075}' + . '\x{6077}\x{6081}\x{6083}\x{6084}\x{6089}\x{608B}\x{608C}\x{608D}\x{6092}' + . '\x{6094}\x{6096}\x{6097}\x{609A}\x{609B}\x{609F}\x{60A0}\x{60A3}\x{60A6}' + . '\x{60A7}\x{60A9}\x{60AA}\x{60B2}\x{60B3}\x{60B4}\x{60B5}\x{60B6}\x{60B8}' + . '\x{60BC}\x{60BD}\x{60C5}\x{60C6}\x{60C7}\x{60D1}\x{60D3}\x{60D8}\x{60DA}' + . '\x{60DC}\x{60DF}\x{60E0}\x{60E1}\x{60E3}\x{60E7}\x{60E8}\x{60F0}\x{60F1}' + . '\x{60F3}\x{60F4}\x{60F6}\x{60F7}\x{60F9}\x{60FA}\x{60FB}\x{6100}\x{6101}' + . '\x{6103}\x{6106}\x{6108}\x{6109}\x{610D}\x{610E}\x{610F}\x{6115}\x{611A}' + . '\x{611B}\x{611F}\x{6121}\x{6127}\x{6128}\x{612C}\x{6134}\x{613C}\x{613D}' + . '\x{613E}\x{613F}\x{6142}\x{6144}\x{6147}\x{6148}\x{614A}\x{614B}\x{614C}' + . '\x{614D}\x{614E}\x{6153}\x{6155}\x{6158}\x{6159}\x{615A}\x{615D}\x{615F}' + . '\x{6162}\x{6163}\x{6165}\x{6167}\x{6168}\x{616B}\x{616E}\x{616F}\x{6170}' + . '\x{6171}\x{6173}\x{6174}\x{6175}\x{6176}\x{6177}\x{617E}\x{6182}\x{6187}' + . '\x{618A}\x{618E}\x{6190}\x{6191}\x{6194}\x{6196}\x{6199}\x{619A}\x{61A4}' + . '\x{61A7}\x{61A9}\x{61AB}\x{61AC}\x{61AE}\x{61B2}\x{61B6}\x{61BA}\x{61BE}' + . '\x{61C3}\x{61C6}\x{61C7}\x{61C8}\x{61C9}\x{61CA}\x{61CB}\x{61CC}\x{61CD}' + . '\x{61D0}\x{61E3}\x{61E6}\x{61F2}\x{61F4}\x{61F6}\x{61F7}\x{61F8}\x{61FA}' + . '\x{61FC}\x{61FD}\x{61FE}\x{61FF}\x{6200}\x{6208}\x{6209}\x{620A}\x{620C}' + . '\x{620D}\x{620E}\x{6210}\x{6211}\x{6212}\x{6214}\x{6216}\x{621A}\x{621B}' + . '\x{621D}\x{621E}\x{621F}\x{6221}\x{6226}\x{622A}\x{622E}\x{622F}\x{6230}' + . '\x{6232}\x{6233}\x{6234}\x{6238}\x{623B}\x{623F}\x{6240}\x{6241}\x{6247}' + . '\x{6248}\x{6249}\x{624B}\x{624D}\x{624E}\x{6253}\x{6255}\x{6258}\x{625B}' + . '\x{625E}\x{6260}\x{6263}\x{6268}\x{626E}\x{6271}\x{6276}\x{6279}\x{627C}' + . '\x{627E}\x{627F}\x{6280}\x{6282}\x{6283}\x{6284}\x{6289}\x{628A}\x{6291}' + . '\x{6292}\x{6293}\x{6294}\x{6295}\x{6296}\x{6297}\x{6298}\x{629B}\x{629C}' + . '\x{629E}\x{62AB}\x{62AC}\x{62B1}\x{62B5}\x{62B9}\x{62BB}\x{62BC}\x{62BD}' + . '\x{62C2}\x{62C5}\x{62C6}\x{62C7}\x{62C8}\x{62C9}\x{62CA}\x{62CC}\x{62CD}' + . '\x{62CF}\x{62D0}\x{62D1}\x{62D2}\x{62D3}\x{62D4}\x{62D7}\x{62D8}\x{62D9}' + . '\x{62DB}\x{62DC}\x{62DD}\x{62E0}\x{62E1}\x{62EC}\x{62ED}\x{62EE}\x{62EF}' + . '\x{62F1}\x{62F3}\x{62F5}\x{62F6}\x{62F7}\x{62FE}\x{62FF}\x{6301}\x{6302}' + . '\x{6307}\x{6308}\x{6309}\x{630C}\x{6311}\x{6319}\x{631F}\x{6327}\x{6328}' + . '\x{632B}\x{632F}\x{633A}\x{633D}\x{633E}\x{633F}\x{6349}\x{634C}\x{634D}' + . '\x{634F}\x{6350}\x{6355}\x{6357}\x{635C}\x{6367}\x{6368}\x{6369}\x{636B}' + . '\x{636E}\x{6372}\x{6376}\x{6377}\x{637A}\x{637B}\x{6380}\x{6383}\x{6388}' + . '\x{6389}\x{638C}\x{638E}\x{638F}\x{6392}\x{6396}\x{6398}\x{639B}\x{639F}' + . '\x{63A0}\x{63A1}\x{63A2}\x{63A3}\x{63A5}\x{63A7}\x{63A8}\x{63A9}\x{63AA}' + . '\x{63AB}\x{63AC}\x{63B2}\x{63B4}\x{63B5}\x{63BB}\x{63BE}\x{63C0}\x{63C3}' + . '\x{63C4}\x{63C6}\x{63C9}\x{63CF}\x{63D0}\x{63D2}\x{63D6}\x{63DA}\x{63DB}' + . '\x{63E1}\x{63E3}\x{63E9}\x{63EE}\x{63F4}\x{63F6}\x{63FA}\x{6406}\x{640D}' + . '\x{640F}\x{6413}\x{6416}\x{6417}\x{641C}\x{6426}\x{6428}\x{642C}\x{642D}' + . '\x{6434}\x{6436}\x{643A}\x{643E}\x{6442}\x{644E}\x{6458}\x{6467}\x{6469}' + . '\x{646F}\x{6476}\x{6478}\x{647A}\x{6483}\x{6488}\x{6492}\x{6493}\x{6495}' + . '\x{649A}\x{649E}\x{64A4}\x{64A5}\x{64A9}\x{64AB}\x{64AD}\x{64AE}\x{64B0}' + . '\x{64B2}\x{64B9}\x{64BB}\x{64BC}\x{64C1}\x{64C2}\x{64C5}\x{64C7}\x{64CD}' + . '\x{64D2}\x{64D4}\x{64D8}\x{64DA}\x{64E0}\x{64E1}\x{64E2}\x{64E3}\x{64E6}' + . '\x{64E7}\x{64EC}\x{64EF}\x{64F1}\x{64F2}\x{64F4}\x{64F6}\x{64FA}\x{64FD}' + . '\x{64FE}\x{6500}\x{6505}\x{6518}\x{651C}\x{651D}\x{6523}\x{6524}\x{652A}' + . '\x{652B}\x{652C}\x{652F}\x{6534}\x{6535}\x{6536}\x{6537}\x{6538}\x{6539}' + . '\x{653B}\x{653E}\x{653F}\x{6545}\x{6548}\x{654D}\x{654F}\x{6551}\x{6555}' + . '\x{6556}\x{6557}\x{6558}\x{6559}\x{655D}\x{655E}\x{6562}\x{6563}\x{6566}' + . '\x{656C}\x{6570}\x{6572}\x{6574}\x{6575}\x{6577}\x{6578}\x{6582}\x{6583}' + . '\x{6587}\x{6588}\x{6589}\x{658C}\x{658E}\x{6590}\x{6591}\x{6597}\x{6599}' + . '\x{659B}\x{659C}\x{659F}\x{65A1}\x{65A4}\x{65A5}\x{65A7}\x{65AB}\x{65AC}' + . '\x{65AD}\x{65AF}\x{65B0}\x{65B7}\x{65B9}\x{65BC}\x{65BD}\x{65C1}\x{65C3}' + . '\x{65C4}\x{65C5}\x{65C6}\x{65CB}\x{65CC}\x{65CF}\x{65D2}\x{65D7}\x{65D9}' + . '\x{65DB}\x{65E0}\x{65E1}\x{65E2}\x{65E5}\x{65E6}\x{65E7}\x{65E8}\x{65E9}' + . '\x{65EC}\x{65ED}\x{65F1}\x{65FA}\x{65FB}\x{6602}\x{6603}\x{6606}\x{6607}' + . '\x{660A}\x{660C}\x{660E}\x{660F}\x{6613}\x{6614}\x{661C}\x{661F}\x{6620}' + . '\x{6625}\x{6627}\x{6628}\x{662D}\x{662F}\x{6634}\x{6635}\x{6636}\x{663C}' + . '\x{663F}\x{6641}\x{6642}\x{6643}\x{6644}\x{6649}\x{664B}\x{664F}\x{6652}' + . '\x{665D}\x{665E}\x{665F}\x{6662}\x{6664}\x{6666}\x{6667}\x{6668}\x{6669}' + . '\x{666E}\x{666F}\x{6670}\x{6674}\x{6676}\x{667A}\x{6681}\x{6683}\x{6684}' + . '\x{6687}\x{6688}\x{6689}\x{668E}\x{6691}\x{6696}\x{6697}\x{6698}\x{669D}' + . '\x{66A2}\x{66A6}\x{66AB}\x{66AE}\x{66B4}\x{66B8}\x{66B9}\x{66BC}\x{66BE}' + . '\x{66C1}\x{66C4}\x{66C7}\x{66C9}\x{66D6}\x{66D9}\x{66DA}\x{66DC}\x{66DD}' + . '\x{66E0}\x{66E6}\x{66E9}\x{66F0}\x{66F2}\x{66F3}\x{66F4}\x{66F5}\x{66F7}' + . '\x{66F8}\x{66F9}\x{66FC}\x{66FD}\x{66FE}\x{66FF}\x{6700}\x{6703}\x{6708}' + . '\x{6709}\x{670B}\x{670D}\x{670F}\x{6714}\x{6715}\x{6716}\x{6717}\x{671B}' + . '\x{671D}\x{671E}\x{671F}\x{6726}\x{6727}\x{6728}\x{672A}\x{672B}\x{672C}' + . '\x{672D}\x{672E}\x{6731}\x{6734}\x{6736}\x{6737}\x{6738}\x{673A}\x{673D}' + . '\x{673F}\x{6741}\x{6746}\x{6749}\x{674E}\x{674F}\x{6750}\x{6751}\x{6753}' + . '\x{6756}\x{6759}\x{675C}\x{675E}\x{675F}\x{6760}\x{6761}\x{6762}\x{6763}' + . '\x{6764}\x{6765}\x{676A}\x{676D}\x{676F}\x{6770}\x{6771}\x{6772}\x{6773}' + . '\x{6775}\x{6777}\x{677C}\x{677E}\x{677F}\x{6785}\x{6787}\x{6789}\x{678B}' + . '\x{678C}\x{6790}\x{6795}\x{6797}\x{679A}\x{679C}\x{679D}\x{67A0}\x{67A1}' + . '\x{67A2}\x{67A6}\x{67A9}\x{67AF}\x{67B3}\x{67B4}\x{67B6}\x{67B7}\x{67B8}' + . '\x{67B9}\x{67C1}\x{67C4}\x{67C6}\x{67CA}\x{67CE}\x{67CF}\x{67D0}\x{67D1}' + . '\x{67D3}\x{67D4}\x{67D8}\x{67DA}\x{67DD}\x{67DE}\x{67E2}\x{67E4}\x{67E7}' + . '\x{67E9}\x{67EC}\x{67EE}\x{67EF}\x{67F1}\x{67F3}\x{67F4}\x{67F5}\x{67FB}' + . '\x{67FE}\x{67FF}\x{6802}\x{6803}\x{6804}\x{6813}\x{6816}\x{6817}\x{681E}' + . '\x{6821}\x{6822}\x{6829}\x{682A}\x{682B}\x{6832}\x{6834}\x{6838}\x{6839}' + . '\x{683C}\x{683D}\x{6840}\x{6841}\x{6842}\x{6843}\x{6846}\x{6848}\x{684D}' + . '\x{684E}\x{6850}\x{6851}\x{6853}\x{6854}\x{6859}\x{685C}\x{685D}\x{685F}' + . '\x{6863}\x{6867}\x{6874}\x{6876}\x{6877}\x{687E}\x{687F}\x{6881}\x{6883}' + . '\x{6885}\x{688D}\x{688F}\x{6893}\x{6894}\x{6897}\x{689B}\x{689D}\x{689F}' + . '\x{68A0}\x{68A2}\x{68A6}\x{68A7}\x{68A8}\x{68AD}\x{68AF}\x{68B0}\x{68B1}' + . '\x{68B3}\x{68B5}\x{68B6}\x{68B9}\x{68BA}\x{68BC}\x{68C4}\x{68C6}\x{68C9}' + . '\x{68CA}\x{68CB}\x{68CD}\x{68D2}\x{68D4}\x{68D5}\x{68D7}\x{68D8}\x{68DA}' + . '\x{68DF}\x{68E0}\x{68E1}\x{68E3}\x{68E7}\x{68EE}\x{68EF}\x{68F2}\x{68F9}' + . '\x{68FA}\x{6900}\x{6901}\x{6904}\x{6905}\x{6908}\x{690B}\x{690C}\x{690D}' + . '\x{690E}\x{690F}\x{6912}\x{6919}\x{691A}\x{691B}\x{691C}\x{6921}\x{6922}' + . '\x{6923}\x{6925}\x{6926}\x{6928}\x{692A}\x{6930}\x{6934}\x{6936}\x{6939}' + . '\x{693D}\x{693F}\x{694A}\x{6953}\x{6954}\x{6955}\x{6959}\x{695A}\x{695C}' + . '\x{695D}\x{695E}\x{6960}\x{6961}\x{6962}\x{696A}\x{696B}\x{696D}\x{696E}' + . '\x{696F}\x{6973}\x{6974}\x{6975}\x{6977}\x{6978}\x{6979}\x{697C}\x{697D}' + . '\x{697E}\x{6981}\x{6982}\x{698A}\x{698E}\x{6991}\x{6994}\x{6995}\x{699B}' + . '\x{699C}\x{69A0}\x{69A7}\x{69AE}\x{69B1}\x{69B2}\x{69B4}\x{69BB}\x{69BE}' + . '\x{69BF}\x{69C1}\x{69C3}\x{69C7}\x{69CA}\x{69CB}\x{69CC}\x{69CD}\x{69CE}' + . '\x{69D0}\x{69D3}\x{69D8}\x{69D9}\x{69DD}\x{69DE}\x{69E7}\x{69E8}\x{69EB}' + . '\x{69ED}\x{69F2}\x{69F9}\x{69FB}\x{69FD}\x{69FF}\x{6A02}\x{6A05}\x{6A0A}' + . '\x{6A0B}\x{6A0C}\x{6A12}\x{6A13}\x{6A14}\x{6A17}\x{6A19}\x{6A1B}\x{6A1E}' + . '\x{6A1F}\x{6A21}\x{6A22}\x{6A23}\x{6A29}\x{6A2A}\x{6A2B}\x{6A2E}\x{6A35}' + . '\x{6A36}\x{6A38}\x{6A39}\x{6A3A}\x{6A3D}\x{6A44}\x{6A47}\x{6A48}\x{6A4B}' + . '\x{6A58}\x{6A59}\x{6A5F}\x{6A61}\x{6A62}\x{6A66}\x{6A72}\x{6A78}\x{6A7F}' + . '\x{6A80}\x{6A84}\x{6A8D}\x{6A8E}\x{6A90}\x{6A97}\x{6A9C}\x{6AA0}\x{6AA2}' + . '\x{6AA3}\x{6AAA}\x{6AAC}\x{6AAE}\x{6AB3}\x{6AB8}\x{6ABB}\x{6AC1}\x{6AC2}' + . '\x{6AC3}\x{6AD1}\x{6AD3}\x{6ADA}\x{6ADB}\x{6ADE}\x{6ADF}\x{6AE8}\x{6AEA}' + . '\x{6AFA}\x{6AFB}\x{6B04}\x{6B05}\x{6B0A}\x{6B12}\x{6B16}\x{6B1D}\x{6B1F}' + . '\x{6B20}\x{6B21}\x{6B23}\x{6B27}\x{6B32}\x{6B37}\x{6B38}\x{6B39}\x{6B3A}' + . '\x{6B3D}\x{6B3E}\x{6B43}\x{6B47}\x{6B49}\x{6B4C}\x{6B4E}\x{6B50}\x{6B53}' + . '\x{6B54}\x{6B59}\x{6B5B}\x{6B5F}\x{6B61}\x{6B62}\x{6B63}\x{6B64}\x{6B66}' + . '\x{6B69}\x{6B6A}\x{6B6F}\x{6B73}\x{6B74}\x{6B78}\x{6B79}\x{6B7B}\x{6B7F}' + . '\x{6B80}\x{6B83}\x{6B84}\x{6B86}\x{6B89}\x{6B8A}\x{6B8B}\x{6B8D}\x{6B95}' + . '\x{6B96}\x{6B98}\x{6B9E}\x{6BA4}\x{6BAA}\x{6BAB}\x{6BAF}\x{6BB1}\x{6BB2}' + . '\x{6BB3}\x{6BB4}\x{6BB5}\x{6BB7}\x{6BBA}\x{6BBB}\x{6BBC}\x{6BBF}\x{6BC0}' + . '\x{6BC5}\x{6BC6}\x{6BCB}\x{6BCD}\x{6BCE}\x{6BD2}\x{6BD3}\x{6BD4}\x{6BD8}' + . '\x{6BDB}\x{6BDF}\x{6BEB}\x{6BEC}\x{6BEF}\x{6BF3}\x{6C08}\x{6C0F}\x{6C11}' + . '\x{6C13}\x{6C14}\x{6C17}\x{6C1B}\x{6C23}\x{6C24}\x{6C34}\x{6C37}\x{6C38}' + . '\x{6C3E}\x{6C40}\x{6C41}\x{6C42}\x{6C4E}\x{6C50}\x{6C55}\x{6C57}\x{6C5A}' + . '\x{6C5D}\x{6C5E}\x{6C5F}\x{6C60}\x{6C62}\x{6C68}\x{6C6A}\x{6C70}\x{6C72}' + . '\x{6C73}\x{6C7A}\x{6C7D}\x{6C7E}\x{6C81}\x{6C82}\x{6C83}\x{6C88}\x{6C8C}' + . '\x{6C8D}\x{6C90}\x{6C92}\x{6C93}\x{6C96}\x{6C99}\x{6C9A}\x{6C9B}\x{6CA1}' + . '\x{6CA2}\x{6CAB}\x{6CAE}\x{6CB1}\x{6CB3}\x{6CB8}\x{6CB9}\x{6CBA}\x{6CBB}' + . '\x{6CBC}\x{6CBD}\x{6CBE}\x{6CBF}\x{6CC1}\x{6CC4}\x{6CC5}\x{6CC9}\x{6CCA}' + . '\x{6CCC}\x{6CD3}\x{6CD5}\x{6CD7}\x{6CD9}\x{6CDB}\x{6CDD}\x{6CE1}\x{6CE2}' + . '\x{6CE3}\x{6CE5}\x{6CE8}\x{6CEA}\x{6CEF}\x{6CF0}\x{6CF1}\x{6CF3}\x{6D0B}' + . '\x{6D0C}\x{6D12}\x{6D17}\x{6D19}\x{6D1B}\x{6D1E}\x{6D1F}\x{6D25}\x{6D29}' + . '\x{6D2A}\x{6D2B}\x{6D32}\x{6D33}\x{6D35}\x{6D36}\x{6D38}\x{6D3B}\x{6D3D}' + . '\x{6D3E}\x{6D41}\x{6D44}\x{6D45}\x{6D59}\x{6D5A}\x{6D5C}\x{6D63}\x{6D64}' + . '\x{6D66}\x{6D69}\x{6D6A}\x{6D6C}\x{6D6E}\x{6D74}\x{6D77}\x{6D78}\x{6D79}' + . '\x{6D85}\x{6D88}\x{6D8C}\x{6D8E}\x{6D93}\x{6D95}\x{6D99}\x{6D9B}\x{6D9C}' + . '\x{6DAF}\x{6DB2}\x{6DB5}\x{6DB8}\x{6DBC}\x{6DC0}\x{6DC5}\x{6DC6}\x{6DC7}' + . '\x{6DCB}\x{6DCC}\x{6DD1}\x{6DD2}\x{6DD5}\x{6DD8}\x{6DD9}\x{6DDE}\x{6DE1}' + . '\x{6DE4}\x{6DE6}\x{6DE8}\x{6DEA}\x{6DEB}\x{6DEC}\x{6DEE}\x{6DF1}\x{6DF3}' + . '\x{6DF5}\x{6DF7}\x{6DF9}\x{6DFA}\x{6DFB}\x{6E05}\x{6E07}\x{6E08}\x{6E09}' + . '\x{6E0A}\x{6E0B}\x{6E13}\x{6E15}\x{6E19}\x{6E1A}\x{6E1B}\x{6E1D}\x{6E1F}' + . '\x{6E20}\x{6E21}\x{6E23}\x{6E24}\x{6E25}\x{6E26}\x{6E29}\x{6E2B}\x{6E2C}' + . '\x{6E2D}\x{6E2E}\x{6E2F}\x{6E38}\x{6E3A}\x{6E3E}\x{6E43}\x{6E4A}\x{6E4D}' + . '\x{6E4E}\x{6E56}\x{6E58}\x{6E5B}\x{6E5F}\x{6E67}\x{6E6B}\x{6E6E}\x{6E6F}' + . '\x{6E72}\x{6E76}\x{6E7E}\x{6E7F}\x{6E80}\x{6E82}\x{6E8C}\x{6E8F}\x{6E90}' + . '\x{6E96}\x{6E98}\x{6E9C}\x{6E9D}\x{6E9F}\x{6EA2}\x{6EA5}\x{6EAA}\x{6EAF}' + . '\x{6EB2}\x{6EB6}\x{6EB7}\x{6EBA}\x{6EBD}\x{6EC2}\x{6EC4}\x{6EC5}\x{6EC9}' + . '\x{6ECB}\x{6ECC}\x{6ED1}\x{6ED3}\x{6ED4}\x{6ED5}\x{6EDD}\x{6EDE}\x{6EEC}' + . '\x{6EEF}\x{6EF2}\x{6EF4}\x{6EF7}\x{6EF8}\x{6EFE}\x{6EFF}\x{6F01}\x{6F02}' + . '\x{6F06}\x{6F09}\x{6F0F}\x{6F11}\x{6F13}\x{6F14}\x{6F15}\x{6F20}\x{6F22}' + . '\x{6F23}\x{6F2B}\x{6F2C}\x{6F31}\x{6F32}\x{6F38}\x{6F3E}\x{6F3F}\x{6F41}' + . '\x{6F45}\x{6F54}\x{6F58}\x{6F5B}\x{6F5C}\x{6F5F}\x{6F64}\x{6F66}\x{6F6D}' + . '\x{6F6E}\x{6F6F}\x{6F70}\x{6F74}\x{6F78}\x{6F7A}\x{6F7C}\x{6F80}\x{6F81}' + . '\x{6F82}\x{6F84}\x{6F86}\x{6F8E}\x{6F91}\x{6F97}\x{6FA1}\x{6FA3}\x{6FA4}' + . '\x{6FAA}\x{6FB1}\x{6FB3}\x{6FB9}\x{6FC0}\x{6FC1}\x{6FC2}\x{6FC3}\x{6FC6}' + . '\x{6FD4}\x{6FD5}\x{6FD8}\x{6FDB}\x{6FDF}\x{6FE0}\x{6FE1}\x{6FE4}\x{6FEB}' + . '\x{6FEC}\x{6FEE}\x{6FEF}\x{6FF1}\x{6FF3}\x{6FF6}\x{6FFA}\x{6FFE}\x{7001}' + . '\x{7009}\x{700B}\x{700F}\x{7011}\x{7015}\x{7018}\x{701A}\x{701B}\x{701D}' + . '\x{701E}\x{701F}\x{7026}\x{7027}\x{702C}\x{7030}\x{7032}\x{703E}\x{704C}' + . '\x{7051}\x{7058}\x{7063}\x{706B}\x{706F}\x{7070}\x{7078}\x{707C}\x{707D}' + . '\x{7089}\x{708A}\x{708E}\x{7092}\x{7099}\x{70AC}\x{70AD}\x{70AE}\x{70AF}' + . '\x{70B3}\x{70B8}\x{70B9}\x{70BA}\x{70C8}\x{70CB}\x{70CF}\x{70D9}\x{70DD}' + . '\x{70DF}\x{70F1}\x{70F9}\x{70FD}\x{7109}\x{7114}\x{7119}\x{711A}\x{711C}' + . '\x{7121}\x{7126}\x{7136}\x{713C}\x{7149}\x{714C}\x{714E}\x{7155}\x{7156}' + . '\x{7159}\x{7162}\x{7164}\x{7165}\x{7166}\x{7167}\x{7169}\x{716C}\x{716E}' + . '\x{717D}\x{7184}\x{7188}\x{718A}\x{718F}\x{7194}\x{7195}\x{7199}\x{719F}' + . '\x{71A8}\x{71AC}\x{71B1}\x{71B9}\x{71BE}\x{71C3}\x{71C8}\x{71C9}\x{71CE}' + . '\x{71D0}\x{71D2}\x{71D4}\x{71D5}\x{71D7}\x{71DF}\x{71E0}\x{71E5}\x{71E6}' + . '\x{71E7}\x{71EC}\x{71ED}\x{71EE}\x{71F5}\x{71F9}\x{71FB}\x{71FC}\x{71FF}' + . '\x{7206}\x{720D}\x{7210}\x{721B}\x{7228}\x{722A}\x{722C}\x{722D}\x{7230}' + . '\x{7232}\x{7235}\x{7236}\x{723A}\x{723B}\x{723C}\x{723D}\x{723E}\x{723F}' + . '\x{7240}\x{7246}\x{7247}\x{7248}\x{724B}\x{724C}\x{7252}\x{7258}\x{7259}' + . '\x{725B}\x{725D}\x{725F}\x{7261}\x{7262}\x{7267}\x{7269}\x{7272}\x{7274}' + . '\x{7279}\x{727D}\x{727E}\x{7280}\x{7281}\x{7282}\x{7287}\x{7292}\x{7296}' + . '\x{72A0}\x{72A2}\x{72A7}\x{72AC}\x{72AF}\x{72B2}\x{72B6}\x{72B9}\x{72C2}' + . '\x{72C3}\x{72C4}\x{72C6}\x{72CE}\x{72D0}\x{72D2}\x{72D7}\x{72D9}\x{72DB}' + . '\x{72E0}\x{72E1}\x{72E2}\x{72E9}\x{72EC}\x{72ED}\x{72F7}\x{72F8}\x{72F9}' + . '\x{72FC}\x{72FD}\x{730A}\x{7316}\x{7317}\x{731B}\x{731C}\x{731D}\x{731F}' + . '\x{7325}\x{7329}\x{732A}\x{732B}\x{732E}\x{732F}\x{7334}\x{7336}\x{7337}' + . '\x{733E}\x{733F}\x{7344}\x{7345}\x{734E}\x{734F}\x{7357}\x{7363}\x{7368}' + . '\x{736A}\x{7370}\x{7372}\x{7375}\x{7378}\x{737A}\x{737B}\x{7384}\x{7387}' + . '\x{7389}\x{738B}\x{7396}\x{73A9}\x{73B2}\x{73B3}\x{73BB}\x{73C0}\x{73C2}' + . '\x{73C8}\x{73CA}\x{73CD}\x{73CE}\x{73DE}\x{73E0}\x{73E5}\x{73EA}\x{73ED}' + . '\x{73EE}\x{73F1}\x{73F8}\x{73FE}\x{7403}\x{7405}\x{7406}\x{7409}\x{7422}' + . '\x{7425}\x{7432}\x{7433}\x{7434}\x{7435}\x{7436}\x{743A}\x{743F}\x{7441}' + . '\x{7455}\x{7459}\x{745A}\x{745B}\x{745C}\x{745E}\x{745F}\x{7460}\x{7463}' + . '\x{7464}\x{7469}\x{746A}\x{746F}\x{7470}\x{7473}\x{7476}\x{747E}\x{7483}' + . '\x{748B}\x{749E}\x{74A2}\x{74A7}\x{74B0}\x{74BD}\x{74CA}\x{74CF}\x{74D4}' + . '\x{74DC}\x{74E0}\x{74E2}\x{74E3}\x{74E6}\x{74E7}\x{74E9}\x{74EE}\x{74F0}' + . '\x{74F1}\x{74F2}\x{74F6}\x{74F7}\x{74F8}\x{7503}\x{7504}\x{7505}\x{750C}' + . '\x{750D}\x{750E}\x{7511}\x{7513}\x{7515}\x{7518}\x{751A}\x{751C}\x{751E}' + . '\x{751F}\x{7523}\x{7525}\x{7526}\x{7528}\x{752B}\x{752C}\x{7530}\x{7531}' + . '\x{7532}\x{7533}\x{7537}\x{7538}\x{753A}\x{753B}\x{753C}\x{7544}\x{7546}' + . '\x{7549}\x{754A}\x{754B}\x{754C}\x{754D}\x{754F}\x{7551}\x{7554}\x{7559}' + . '\x{755A}\x{755B}\x{755C}\x{755D}\x{7560}\x{7562}\x{7564}\x{7565}\x{7566}' + . '\x{7567}\x{7569}\x{756A}\x{756B}\x{756D}\x{7570}\x{7573}\x{7574}\x{7576}' + . '\x{7577}\x{7578}\x{757F}\x{7582}\x{7586}\x{7587}\x{7589}\x{758A}\x{758B}' + . '\x{758E}\x{758F}\x{7591}\x{7594}\x{759A}\x{759D}\x{75A3}\x{75A5}\x{75AB}' + . '\x{75B1}\x{75B2}\x{75B3}\x{75B5}\x{75B8}\x{75B9}\x{75BC}\x{75BD}\x{75BE}' + . '\x{75C2}\x{75C3}\x{75C5}\x{75C7}\x{75CA}\x{75CD}\x{75D2}\x{75D4}\x{75D5}' + . '\x{75D8}\x{75D9}\x{75DB}\x{75DE}\x{75E2}\x{75E3}\x{75E9}\x{75F0}\x{75F2}' + . '\x{75F3}\x{75F4}\x{75FA}\x{75FC}\x{75FE}\x{75FF}\x{7601}\x{7609}\x{760B}' + . '\x{760D}\x{761F}\x{7620}\x{7621}\x{7622}\x{7624}\x{7627}\x{7630}\x{7634}' + . '\x{763B}\x{7642}\x{7646}\x{7647}\x{7648}\x{764C}\x{7652}\x{7656}\x{7658}' + . '\x{765C}\x{7661}\x{7662}\x{7667}\x{7668}\x{7669}\x{766A}\x{766C}\x{7670}' + . '\x{7672}\x{7676}\x{7678}\x{767A}\x{767B}\x{767C}\x{767D}\x{767E}\x{7680}' + . '\x{7683}\x{7684}\x{7686}\x{7687}\x{7688}\x{768B}\x{768E}\x{7690}\x{7693}' + . '\x{7696}\x{7699}\x{769A}\x{76AE}\x{76B0}\x{76B4}\x{76B7}\x{76B8}\x{76B9}' + . '\x{76BA}\x{76BF}\x{76C2}\x{76C3}\x{76C6}\x{76C8}\x{76CA}\x{76CD}\x{76D2}' + . '\x{76D6}\x{76D7}\x{76DB}\x{76DC}\x{76DE}\x{76DF}\x{76E1}\x{76E3}\x{76E4}' + . '\x{76E5}\x{76E7}\x{76EA}\x{76EE}\x{76F2}\x{76F4}\x{76F8}\x{76FB}\x{76FE}' + . '\x{7701}\x{7704}\x{7707}\x{7708}\x{7709}\x{770B}\x{770C}\x{771B}\x{771E}' + . '\x{771F}\x{7720}\x{7724}\x{7725}\x{7726}\x{7729}\x{7737}\x{7738}\x{773A}' + . '\x{773C}\x{7740}\x{7747}\x{775A}\x{775B}\x{7761}\x{7763}\x{7765}\x{7766}' + . '\x{7768}\x{776B}\x{7779}\x{777E}\x{777F}\x{778B}\x{778E}\x{7791}\x{779E}' + . '\x{77A0}\x{77A5}\x{77AC}\x{77AD}\x{77B0}\x{77B3}\x{77B6}\x{77B9}\x{77BB}' + . '\x{77BC}\x{77BD}\x{77BF}\x{77C7}\x{77CD}\x{77D7}\x{77DA}\x{77DB}\x{77DC}' + . '\x{77E2}\x{77E3}\x{77E5}\x{77E7}\x{77E9}\x{77ED}\x{77EE}\x{77EF}\x{77F3}' + . '\x{77FC}\x{7802}\x{780C}\x{7812}\x{7814}\x{7815}\x{7820}\x{7825}\x{7826}' + . '\x{7827}\x{7832}\x{7834}\x{783A}\x{783F}\x{7845}\x{785D}\x{786B}\x{786C}' + . '\x{786F}\x{7872}\x{7874}\x{787C}\x{7881}\x{7886}\x{7887}\x{788C}\x{788D}' + . '\x{788E}\x{7891}\x{7893}\x{7895}\x{7897}\x{789A}\x{78A3}\x{78A7}\x{78A9}' + . '\x{78AA}\x{78AF}\x{78B5}\x{78BA}\x{78BC}\x{78BE}\x{78C1}\x{78C5}\x{78C6}' + . '\x{78CA}\x{78CB}\x{78D0}\x{78D1}\x{78D4}\x{78DA}\x{78E7}\x{78E8}\x{78EC}' + . '\x{78EF}\x{78F4}\x{78FD}\x{7901}\x{7907}\x{790E}\x{7911}\x{7912}\x{7919}' + . '\x{7926}\x{792A}\x{792B}\x{792C}\x{793A}\x{793C}\x{793E}\x{7940}\x{7941}' + . '\x{7947}\x{7948}\x{7949}\x{7950}\x{7953}\x{7955}\x{7956}\x{7957}\x{795A}' + . '\x{795D}\x{795E}\x{795F}\x{7960}\x{7962}\x{7965}\x{7968}\x{796D}\x{7977}' + . '\x{797A}\x{797F}\x{7980}\x{7981}\x{7984}\x{7985}\x{798A}\x{798D}\x{798E}' + . '\x{798F}\x{799D}\x{79A6}\x{79A7}\x{79AA}\x{79AE}\x{79B0}\x{79B3}\x{79B9}' + . '\x{79BA}\x{79BD}\x{79BE}\x{79BF}\x{79C0}\x{79C1}\x{79C9}\x{79CB}\x{79D1}' + . '\x{79D2}\x{79D5}\x{79D8}\x{79DF}\x{79E1}\x{79E3}\x{79E4}\x{79E6}\x{79E7}' + . '\x{79E9}\x{79EC}\x{79F0}\x{79FB}\x{7A00}\x{7A08}\x{7A0B}\x{7A0D}\x{7A0E}' + . '\x{7A14}\x{7A17}\x{7A18}\x{7A19}\x{7A1A}\x{7A1C}\x{7A1F}\x{7A20}\x{7A2E}' + . '\x{7A31}\x{7A32}\x{7A37}\x{7A3B}\x{7A3C}\x{7A3D}\x{7A3E}\x{7A3F}\x{7A40}' + . '\x{7A42}\x{7A43}\x{7A46}\x{7A49}\x{7A4D}\x{7A4E}\x{7A4F}\x{7A50}\x{7A57}' + . '\x{7A61}\x{7A62}\x{7A63}\x{7A69}\x{7A6B}\x{7A70}\x{7A74}\x{7A76}\x{7A79}' + . '\x{7A7A}\x{7A7D}\x{7A7F}\x{7A81}\x{7A83}\x{7A84}\x{7A88}\x{7A92}\x{7A93}' + . '\x{7A95}\x{7A96}\x{7A97}\x{7A98}\x{7A9F}\x{7AA9}\x{7AAA}\x{7AAE}\x{7AAF}' + . '\x{7AB0}\x{7AB6}\x{7ABA}\x{7ABF}\x{7AC3}\x{7AC4}\x{7AC5}\x{7AC7}\x{7AC8}' + . '\x{7ACA}\x{7ACB}\x{7ACD}\x{7ACF}\x{7AD2}\x{7AD3}\x{7AD5}\x{7AD9}\x{7ADA}' + . '\x{7ADC}\x{7ADD}\x{7ADF}\x{7AE0}\x{7AE1}\x{7AE2}\x{7AE3}\x{7AE5}\x{7AE6}' + . '\x{7AEA}\x{7AED}\x{7AEF}\x{7AF0}\x{7AF6}\x{7AF8}\x{7AF9}\x{7AFA}\x{7AFF}' + . '\x{7B02}\x{7B04}\x{7B06}\x{7B08}\x{7B0A}\x{7B0B}\x{7B0F}\x{7B11}\x{7B18}' + . '\x{7B19}\x{7B1B}\x{7B1E}\x{7B20}\x{7B25}\x{7B26}\x{7B28}\x{7B2C}\x{7B33}' + . '\x{7B35}\x{7B36}\x{7B39}\x{7B45}\x{7B46}\x{7B48}\x{7B49}\x{7B4B}\x{7B4C}' + . '\x{7B4D}\x{7B4F}\x{7B50}\x{7B51}\x{7B52}\x{7B54}\x{7B56}\x{7B5D}\x{7B65}' + . '\x{7B67}\x{7B6C}\x{7B6E}\x{7B70}\x{7B71}\x{7B74}\x{7B75}\x{7B7A}\x{7B86}' + . '\x{7B87}\x{7B8B}\x{7B8D}\x{7B8F}\x{7B92}\x{7B94}\x{7B95}\x{7B97}\x{7B98}' + . '\x{7B99}\x{7B9A}\x{7B9C}\x{7B9D}\x{7B9F}\x{7BA1}\x{7BAA}\x{7BAD}\x{7BB1}' + . '\x{7BB4}\x{7BB8}\x{7BC0}\x{7BC1}\x{7BC4}\x{7BC6}\x{7BC7}\x{7BC9}\x{7BCB}' + . '\x{7BCC}\x{7BCF}\x{7BDD}\x{7BE0}\x{7BE4}\x{7BE5}\x{7BE6}\x{7BE9}\x{7BED}' + . '\x{7BF3}\x{7BF6}\x{7BF7}\x{7C00}\x{7C07}\x{7C0D}\x{7C11}\x{7C12}\x{7C13}' + . '\x{7C14}\x{7C17}\x{7C1F}\x{7C21}\x{7C23}\x{7C27}\x{7C2A}\x{7C2B}\x{7C37}' + . '\x{7C38}\x{7C3D}\x{7C3E}\x{7C3F}\x{7C40}\x{7C43}\x{7C4C}\x{7C4D}\x{7C4F}' + . '\x{7C50}\x{7C54}\x{7C56}\x{7C58}\x{7C5F}\x{7C60}\x{7C64}\x{7C65}\x{7C6C}' + . '\x{7C73}\x{7C75}\x{7C7E}\x{7C81}\x{7C82}\x{7C83}\x{7C89}\x{7C8B}\x{7C8D}' + . '\x{7C90}\x{7C92}\x{7C95}\x{7C97}\x{7C98}\x{7C9B}\x{7C9F}\x{7CA1}\x{7CA2}' + . '\x{7CA4}\x{7CA5}\x{7CA7}\x{7CA8}\x{7CAB}\x{7CAD}\x{7CAE}\x{7CB1}\x{7CB2}' + . '\x{7CB3}\x{7CB9}\x{7CBD}\x{7CBE}\x{7CC0}\x{7CC2}\x{7CC5}\x{7CCA}\x{7CCE}' + . '\x{7CD2}\x{7CD6}\x{7CD8}\x{7CDC}\x{7CDE}\x{7CDF}\x{7CE0}\x{7CE2}\x{7CE7}' + . '\x{7CEF}\x{7CF2}\x{7CF4}\x{7CF6}\x{7CF8}\x{7CFA}\x{7CFB}\x{7CFE}\x{7D00}' + . '\x{7D02}\x{7D04}\x{7D05}\x{7D06}\x{7D0A}\x{7D0B}\x{7D0D}\x{7D10}\x{7D14}' + . '\x{7D15}\x{7D17}\x{7D18}\x{7D19}\x{7D1A}\x{7D1B}\x{7D1C}\x{7D20}\x{7D21}' + . '\x{7D22}\x{7D2B}\x{7D2C}\x{7D2E}\x{7D2F}\x{7D30}\x{7D32}\x{7D33}\x{7D35}' + . '\x{7D39}\x{7D3A}\x{7D3F}\x{7D42}\x{7D43}\x{7D44}\x{7D45}\x{7D46}\x{7D4B}' + . '\x{7D4C}\x{7D4E}\x{7D4F}\x{7D50}\x{7D56}\x{7D5B}\x{7D5E}\x{7D61}\x{7D62}' + . '\x{7D63}\x{7D66}\x{7D68}\x{7D6E}\x{7D71}\x{7D72}\x{7D73}\x{7D75}\x{7D76}' + . '\x{7D79}\x{7D7D}\x{7D89}\x{7D8F}\x{7D93}\x{7D99}\x{7D9A}\x{7D9B}\x{7D9C}' + . '\x{7D9F}\x{7DA2}\x{7DA3}\x{7DAB}\x{7DAC}\x{7DAD}\x{7DAE}\x{7DAF}\x{7DB0}' + . '\x{7DB1}\x{7DB2}\x{7DB4}\x{7DB5}\x{7DB8}\x{7DBA}\x{7DBB}\x{7DBD}\x{7DBE}' + . '\x{7DBF}\x{7DC7}\x{7DCA}\x{7DCB}\x{7DCF}\x{7DD1}\x{7DD2}\x{7DD5}\x{7DD8}' + . '\x{7DDA}\x{7DDC}\x{7DDD}\x{7DDE}\x{7DE0}\x{7DE1}\x{7DE4}\x{7DE8}\x{7DE9}' + . '\x{7DEC}\x{7DEF}\x{7DF2}\x{7DF4}\x{7DFB}\x{7E01}\x{7E04}\x{7E05}\x{7E09}' + . '\x{7E0A}\x{7E0B}\x{7E12}\x{7E1B}\x{7E1E}\x{7E1F}\x{7E21}\x{7E22}\x{7E23}' + . '\x{7E26}\x{7E2B}\x{7E2E}\x{7E31}\x{7E32}\x{7E35}\x{7E37}\x{7E39}\x{7E3A}' + . '\x{7E3B}\x{7E3D}\x{7E3E}\x{7E41}\x{7E43}\x{7E46}\x{7E4A}\x{7E4B}\x{7E4D}' + . '\x{7E54}\x{7E55}\x{7E56}\x{7E59}\x{7E5A}\x{7E5D}\x{7E5E}\x{7E66}\x{7E67}' + . '\x{7E69}\x{7E6A}\x{7E6D}\x{7E70}\x{7E79}\x{7E7B}\x{7E7C}\x{7E7D}\x{7E7F}' + . '\x{7E82}\x{7E83}\x{7E88}\x{7E89}\x{7E8C}\x{7E8E}\x{7E8F}\x{7E90}\x{7E92}' + . '\x{7E93}\x{7E94}\x{7E96}\x{7E9B}\x{7E9C}\x{7F36}\x{7F38}\x{7F3A}\x{7F45}' + . '\x{7F4C}\x{7F4D}\x{7F4E}\x{7F50}\x{7F51}\x{7F54}\x{7F55}\x{7F58}\x{7F5F}' + . '\x{7F60}\x{7F67}\x{7F68}\x{7F69}\x{7F6A}\x{7F6B}\x{7F6E}\x{7F70}\x{7F72}' + . '\x{7F75}\x{7F77}\x{7F78}\x{7F79}\x{7F82}\x{7F83}\x{7F85}\x{7F86}\x{7F87}' + . '\x{7F88}\x{7F8A}\x{7F8C}\x{7F8E}\x{7F94}\x{7F9A}\x{7F9D}\x{7F9E}\x{7FA3}' + . '\x{7FA4}\x{7FA8}\x{7FA9}\x{7FAE}\x{7FAF}\x{7FB2}\x{7FB6}\x{7FB8}\x{7FB9}' + . '\x{7FBD}\x{7FC1}\x{7FC5}\x{7FC6}\x{7FCA}\x{7FCC}\x{7FD2}\x{7FD4}\x{7FD5}' + . '\x{7FE0}\x{7FE1}\x{7FE6}\x{7FE9}\x{7FEB}\x{7FF0}\x{7FF3}\x{7FF9}\x{7FFB}' + . '\x{7FFC}\x{8000}\x{8001}\x{8003}\x{8004}\x{8005}\x{8006}\x{800B}\x{800C}' + . '\x{8010}\x{8012}\x{8015}\x{8017}\x{8018}\x{8019}\x{801C}\x{8021}\x{8028}' + . '\x{8033}\x{8036}\x{803B}\x{803D}\x{803F}\x{8046}\x{804A}\x{8052}\x{8056}' + . '\x{8058}\x{805A}\x{805E}\x{805F}\x{8061}\x{8062}\x{8068}\x{806F}\x{8070}' + . '\x{8072}\x{8073}\x{8074}\x{8076}\x{8077}\x{8079}\x{807D}\x{807E}\x{807F}' + . '\x{8084}\x{8085}\x{8086}\x{8087}\x{8089}\x{808B}\x{808C}\x{8093}\x{8096}' + . '\x{8098}\x{809A}\x{809B}\x{809D}\x{80A1}\x{80A2}\x{80A5}\x{80A9}\x{80AA}' + . '\x{80AC}\x{80AD}\x{80AF}\x{80B1}\x{80B2}\x{80B4}\x{80BA}\x{80C3}\x{80C4}' + . '\x{80C6}\x{80CC}\x{80CE}\x{80D6}\x{80D9}\x{80DA}\x{80DB}\x{80DD}\x{80DE}' + . '\x{80E1}\x{80E4}\x{80E5}\x{80EF}\x{80F1}\x{80F4}\x{80F8}\x{80FC}\x{80FD}' + . '\x{8102}\x{8105}\x{8106}\x{8107}\x{8108}\x{8109}\x{810A}\x{811A}\x{811B}' + . '\x{8123}\x{8129}\x{812F}\x{8131}\x{8133}\x{8139}\x{813E}\x{8146}\x{814B}' + . '\x{814E}\x{8150}\x{8151}\x{8153}\x{8154}\x{8155}\x{815F}\x{8165}\x{8166}' + . '\x{816B}\x{816E}\x{8170}\x{8171}\x{8174}\x{8178}\x{8179}\x{817A}\x{817F}' + . '\x{8180}\x{8182}\x{8183}\x{8188}\x{818A}\x{818F}\x{8193}\x{8195}\x{819A}' + . '\x{819C}\x{819D}\x{81A0}\x{81A3}\x{81A4}\x{81A8}\x{81A9}\x{81B0}\x{81B3}' + . '\x{81B5}\x{81B8}\x{81BA}\x{81BD}\x{81BE}\x{81BF}\x{81C0}\x{81C2}\x{81C6}' + . '\x{81C8}\x{81C9}\x{81CD}\x{81D1}\x{81D3}\x{81D8}\x{81D9}\x{81DA}\x{81DF}' + . '\x{81E0}\x{81E3}\x{81E5}\x{81E7}\x{81E8}\x{81EA}\x{81ED}\x{81F3}\x{81F4}' + . '\x{81FA}\x{81FB}\x{81FC}\x{81FE}\x{8201}\x{8202}\x{8205}\x{8207}\x{8208}' + . '\x{8209}\x{820A}\x{820C}\x{820D}\x{820E}\x{8210}\x{8212}\x{8216}\x{8217}' + . '\x{8218}\x{821B}\x{821C}\x{821E}\x{821F}\x{8229}\x{822A}\x{822B}\x{822C}' + . '\x{822E}\x{8233}\x{8235}\x{8236}\x{8237}\x{8238}\x{8239}\x{8240}\x{8247}' + . '\x{8258}\x{8259}\x{825A}\x{825D}\x{825F}\x{8262}\x{8264}\x{8266}\x{8268}' + . '\x{826A}\x{826B}\x{826E}\x{826F}\x{8271}\x{8272}\x{8276}\x{8277}\x{8278}' + . '\x{827E}\x{828B}\x{828D}\x{8292}\x{8299}\x{829D}\x{829F}\x{82A5}\x{82A6}' + . '\x{82AB}\x{82AC}\x{82AD}\x{82AF}\x{82B1}\x{82B3}\x{82B8}\x{82B9}\x{82BB}' + . '\x{82BD}\x{82C5}\x{82D1}\x{82D2}\x{82D3}\x{82D4}\x{82D7}\x{82D9}\x{82DB}' + . '\x{82DC}\x{82DE}\x{82DF}\x{82E1}\x{82E3}\x{82E5}\x{82E6}\x{82E7}\x{82EB}' + . '\x{82F1}\x{82F3}\x{82F4}\x{82F9}\x{82FA}\x{82FB}\x{8302}\x{8303}\x{8304}' + . '\x{8305}\x{8306}\x{8309}\x{830E}\x{8316}\x{8317}\x{8318}\x{831C}\x{8323}' + . '\x{8328}\x{832B}\x{832F}\x{8331}\x{8332}\x{8334}\x{8335}\x{8336}\x{8338}' + . '\x{8339}\x{8340}\x{8345}\x{8349}\x{834A}\x{834F}\x{8350}\x{8352}\x{8358}' + . '\x{8373}\x{8375}\x{8377}\x{837B}\x{837C}\x{8385}\x{8387}\x{8389}\x{838A}' + . '\x{838E}\x{8393}\x{8396}\x{839A}\x{839E}\x{839F}\x{83A0}\x{83A2}\x{83A8}' + . '\x{83AA}\x{83AB}\x{83B1}\x{83B5}\x{83BD}\x{83C1}\x{83C5}\x{83CA}\x{83CC}' + . '\x{83CE}\x{83D3}\x{83D6}\x{83D8}\x{83DC}\x{83DF}\x{83E0}\x{83E9}\x{83EB}' + . '\x{83EF}\x{83F0}\x{83F1}\x{83F2}\x{83F4}\x{83F7}\x{83FB}\x{83FD}\x{8403}' + . '\x{8404}\x{8407}\x{840B}\x{840C}\x{840D}\x{840E}\x{8413}\x{8420}\x{8422}' + . '\x{8429}\x{842A}\x{842C}\x{8431}\x{8435}\x{8438}\x{843C}\x{843D}\x{8446}' + . '\x{8449}\x{844E}\x{8457}\x{845B}\x{8461}\x{8462}\x{8463}\x{8466}\x{8469}' + . '\x{846B}\x{846C}\x{846D}\x{846E}\x{846F}\x{8471}\x{8475}\x{8477}\x{8479}' + . '\x{847A}\x{8482}\x{8484}\x{848B}\x{8490}\x{8494}\x{8499}\x{849C}\x{849F}' + . '\x{84A1}\x{84AD}\x{84B2}\x{84B8}\x{84B9}\x{84BB}\x{84BC}\x{84BF}\x{84C1}' + . '\x{84C4}\x{84C6}\x{84C9}\x{84CA}\x{84CB}\x{84CD}\x{84D0}\x{84D1}\x{84D6}' + . '\x{84D9}\x{84DA}\x{84EC}\x{84EE}\x{84F4}\x{84FC}\x{84FF}\x{8500}\x{8506}' + . '\x{8511}\x{8513}\x{8514}\x{8515}\x{8517}\x{8518}\x{851A}\x{851F}\x{8521}' + . '\x{8526}\x{852C}\x{852D}\x{8535}\x{853D}\x{8540}\x{8541}\x{8543}\x{8548}' + . '\x{8549}\x{854A}\x{854B}\x{854E}\x{8555}\x{8557}\x{8558}\x{855A}\x{8563}' + . '\x{8568}\x{8569}\x{856A}\x{856D}\x{8577}\x{857E}\x{8580}\x{8584}\x{8587}' + . '\x{8588}\x{858A}\x{8590}\x{8591}\x{8594}\x{8597}\x{8599}\x{859B}\x{859C}' + . '\x{85A4}\x{85A6}\x{85A8}\x{85A9}\x{85AA}\x{85AB}\x{85AC}\x{85AE}\x{85AF}' + . '\x{85B9}\x{85BA}\x{85C1}\x{85C9}\x{85CD}\x{85CF}\x{85D0}\x{85D5}\x{85DC}' + . '\x{85DD}\x{85E4}\x{85E5}\x{85E9}\x{85EA}\x{85F7}\x{85F9}\x{85FA}\x{85FB}' + . '\x{85FE}\x{8602}\x{8606}\x{8607}\x{860A}\x{860B}\x{8613}\x{8616}\x{8617}' + . '\x{861A}\x{8622}\x{862D}\x{862F}\x{8630}\x{863F}\x{864D}\x{864E}\x{8650}' + . '\x{8654}\x{8655}\x{865A}\x{865C}\x{865E}\x{865F}\x{8667}\x{866B}\x{8671}' + . '\x{8679}\x{867B}\x{868A}\x{868B}\x{868C}\x{8693}\x{8695}\x{86A3}\x{86A4}' + . '\x{86A9}\x{86AA}\x{86AB}\x{86AF}\x{86B0}\x{86B6}\x{86C4}\x{86C6}\x{86C7}' + . '\x{86C9}\x{86CB}\x{86CD}\x{86CE}\x{86D4}\x{86D9}\x{86DB}\x{86DE}\x{86DF}' + . '\x{86E4}\x{86E9}\x{86EC}\x{86ED}\x{86EE}\x{86EF}\x{86F8}\x{86F9}\x{86FB}' + . '\x{86FE}\x{8700}\x{8702}\x{8703}\x{8706}\x{8708}\x{8709}\x{870A}\x{870D}' + . '\x{8711}\x{8712}\x{8718}\x{871A}\x{871C}\x{8725}\x{8729}\x{8734}\x{8737}' + . '\x{873B}\x{873F}\x{8749}\x{874B}\x{874C}\x{874E}\x{8753}\x{8755}\x{8757}' + . '\x{8759}\x{875F}\x{8760}\x{8763}\x{8766}\x{8768}\x{876A}\x{876E}\x{8774}' + . '\x{8776}\x{8778}\x{877F}\x{8782}\x{878D}\x{879F}\x{87A2}\x{87AB}\x{87AF}' + . '\x{87B3}\x{87BA}\x{87BB}\x{87BD}\x{87C0}\x{87C4}\x{87C6}\x{87C7}\x{87CB}' + . '\x{87D0}\x{87D2}\x{87E0}\x{87EF}\x{87F2}\x{87F6}\x{87F7}\x{87F9}\x{87FB}' + . '\x{87FE}\x{8805}\x{880D}\x{880E}\x{880F}\x{8811}\x{8815}\x{8816}\x{8821}' + . '\x{8822}\x{8823}\x{8827}\x{8831}\x{8836}\x{8839}\x{883B}\x{8840}\x{8842}' + . '\x{8844}\x{8846}\x{884C}\x{884D}\x{8852}\x{8853}\x{8857}\x{8859}\x{885B}' + . '\x{885D}\x{885E}\x{8861}\x{8862}\x{8863}\x{8868}\x{886B}\x{8870}\x{8872}' + . '\x{8875}\x{8877}\x{887D}\x{887E}\x{887F}\x{8881}\x{8882}\x{8888}\x{888B}' + . '\x{888D}\x{8892}\x{8896}\x{8897}\x{8899}\x{889E}\x{88A2}\x{88A4}\x{88AB}' + . '\x{88AE}\x{88B0}\x{88B1}\x{88B4}\x{88B5}\x{88B7}\x{88BF}\x{88C1}\x{88C2}' + . '\x{88C3}\x{88C4}\x{88C5}\x{88CF}\x{88D4}\x{88D5}\x{88D8}\x{88D9}\x{88DC}' + . '\x{88DD}\x{88DF}\x{88E1}\x{88E8}\x{88F2}\x{88F3}\x{88F4}\x{88F8}\x{88F9}' + . '\x{88FC}\x{88FD}\x{88FE}\x{8902}\x{8904}\x{8907}\x{890A}\x{890C}\x{8910}' + . '\x{8912}\x{8913}\x{891D}\x{891E}\x{8925}\x{892A}\x{892B}\x{8936}\x{8938}' + . '\x{893B}\x{8941}\x{8943}\x{8944}\x{894C}\x{894D}\x{8956}\x{895E}\x{895F}' + . '\x{8960}\x{8964}\x{8966}\x{896A}\x{896D}\x{896F}\x{8972}\x{8974}\x{8977}' + . '\x{897E}\x{897F}\x{8981}\x{8983}\x{8986}\x{8987}\x{8988}\x{898A}\x{898B}' + . '\x{898F}\x{8993}\x{8996}\x{8997}\x{8998}\x{899A}\x{89A1}\x{89A6}\x{89A7}' + . '\x{89A9}\x{89AA}\x{89AC}\x{89AF}\x{89B2}\x{89B3}\x{89BA}\x{89BD}\x{89BF}' + . '\x{89C0}\x{89D2}\x{89DA}\x{89DC}\x{89DD}\x{89E3}\x{89E6}\x{89E7}\x{89F4}' + . '\x{89F8}\x{8A00}\x{8A02}\x{8A03}\x{8A08}\x{8A0A}\x{8A0C}\x{8A0E}\x{8A10}' + . '\x{8A13}\x{8A16}\x{8A17}\x{8A18}\x{8A1B}\x{8A1D}\x{8A1F}\x{8A23}\x{8A25}' + . '\x{8A2A}\x{8A2D}\x{8A31}\x{8A33}\x{8A34}\x{8A36}\x{8A3A}\x{8A3B}\x{8A3C}' + . '\x{8A41}\x{8A46}\x{8A48}\x{8A50}\x{8A51}\x{8A52}\x{8A54}\x{8A55}\x{8A5B}' + . '\x{8A5E}\x{8A60}\x{8A62}\x{8A63}\x{8A66}\x{8A69}\x{8A6B}\x{8A6C}\x{8A6D}' + . '\x{8A6E}\x{8A70}\x{8A71}\x{8A72}\x{8A73}\x{8A7C}\x{8A82}\x{8A84}\x{8A85}' + . '\x{8A87}\x{8A89}\x{8A8C}\x{8A8D}\x{8A91}\x{8A93}\x{8A95}\x{8A98}\x{8A9A}' + . '\x{8A9E}\x{8AA0}\x{8AA1}\x{8AA3}\x{8AA4}\x{8AA5}\x{8AA6}\x{8AA8}\x{8AAC}' + . '\x{8AAD}\x{8AB0}\x{8AB2}\x{8AB9}\x{8ABC}\x{8ABF}\x{8AC2}\x{8AC4}\x{8AC7}' + . '\x{8ACB}\x{8ACC}\x{8ACD}\x{8ACF}\x{8AD2}\x{8AD6}\x{8ADA}\x{8ADB}\x{8ADC}' + . '\x{8ADE}\x{8AE0}\x{8AE1}\x{8AE2}\x{8AE4}\x{8AE6}\x{8AE7}\x{8AEB}\x{8AED}' + . '\x{8AEE}\x{8AF1}\x{8AF3}\x{8AF7}\x{8AF8}\x{8AFA}\x{8AFE}\x{8B00}\x{8B01}' + . '\x{8B02}\x{8B04}\x{8B07}\x{8B0C}\x{8B0E}\x{8B10}\x{8B14}\x{8B16}\x{8B17}' + . '\x{8B19}\x{8B1A}\x{8B1B}\x{8B1D}\x{8B20}\x{8B21}\x{8B26}\x{8B28}\x{8B2B}' + . '\x{8B2C}\x{8B33}\x{8B39}\x{8B3E}\x{8B41}\x{8B49}\x{8B4C}\x{8B4E}\x{8B4F}' + . '\x{8B56}\x{8B58}\x{8B5A}\x{8B5B}\x{8B5C}\x{8B5F}\x{8B66}\x{8B6B}\x{8B6C}' + . '\x{8B6F}\x{8B70}\x{8B71}\x{8B72}\x{8B74}\x{8B77}\x{8B7D}\x{8B80}\x{8B83}' + . '\x{8B8A}\x{8B8C}\x{8B8E}\x{8B90}\x{8B92}\x{8B93}\x{8B96}\x{8B99}\x{8B9A}' + . '\x{8C37}\x{8C3A}\x{8C3F}\x{8C41}\x{8C46}\x{8C48}\x{8C4A}\x{8C4C}\x{8C4E}' + . '\x{8C50}\x{8C55}\x{8C5A}\x{8C61}\x{8C62}\x{8C6A}\x{8C6B}\x{8C6C}\x{8C78}' + . '\x{8C79}\x{8C7A}\x{8C7C}\x{8C82}\x{8C85}\x{8C89}\x{8C8A}\x{8C8C}\x{8C8D}' + . '\x{8C8E}\x{8C94}\x{8C98}\x{8C9D}\x{8C9E}\x{8CA0}\x{8CA1}\x{8CA2}\x{8CA7}' + . '\x{8CA8}\x{8CA9}\x{8CAA}\x{8CAB}\x{8CAC}\x{8CAD}\x{8CAE}\x{8CAF}\x{8CB0}' + . '\x{8CB2}\x{8CB3}\x{8CB4}\x{8CB6}\x{8CB7}\x{8CB8}\x{8CBB}\x{8CBC}\x{8CBD}' + . '\x{8CBF}\x{8CC0}\x{8CC1}\x{8CC2}\x{8CC3}\x{8CC4}\x{8CC7}\x{8CC8}\x{8CCA}' + . '\x{8CCD}\x{8CCE}\x{8CD1}\x{8CD3}\x{8CDA}\x{8CDB}\x{8CDC}\x{8CDE}\x{8CE0}' + . '\x{8CE2}\x{8CE3}\x{8CE4}\x{8CE6}\x{8CEA}\x{8CED}\x{8CFA}\x{8CFB}\x{8CFC}' + . '\x{8CFD}\x{8D04}\x{8D05}\x{8D07}\x{8D08}\x{8D0A}\x{8D0B}\x{8D0D}\x{8D0F}' + . '\x{8D10}\x{8D13}\x{8D14}\x{8D16}\x{8D64}\x{8D66}\x{8D67}\x{8D6B}\x{8D6D}' + . '\x{8D70}\x{8D71}\x{8D73}\x{8D74}\x{8D77}\x{8D81}\x{8D85}\x{8D8A}\x{8D99}' + . '\x{8DA3}\x{8DA8}\x{8DB3}\x{8DBA}\x{8DBE}\x{8DC2}\x{8DCB}\x{8DCC}\x{8DCF}' + . '\x{8DD6}\x{8DDA}\x{8DDB}\x{8DDD}\x{8DDF}\x{8DE1}\x{8DE3}\x{8DE8}\x{8DEA}' + . '\x{8DEB}\x{8DEF}\x{8DF3}\x{8DF5}\x{8DFC}\x{8DFF}\x{8E08}\x{8E09}\x{8E0A}' + . '\x{8E0F}\x{8E10}\x{8E1D}\x{8E1E}\x{8E1F}\x{8E2A}\x{8E30}\x{8E34}\x{8E35}' + . '\x{8E42}\x{8E44}\x{8E47}\x{8E48}\x{8E49}\x{8E4A}\x{8E4C}\x{8E50}\x{8E55}' + . '\x{8E59}\x{8E5F}\x{8E60}\x{8E63}\x{8E64}\x{8E72}\x{8E74}\x{8E76}\x{8E7C}' + . '\x{8E81}\x{8E84}\x{8E85}\x{8E87}\x{8E8A}\x{8E8B}\x{8E8D}\x{8E91}\x{8E93}' + . '\x{8E94}\x{8E99}\x{8EA1}\x{8EAA}\x{8EAB}\x{8EAC}\x{8EAF}\x{8EB0}\x{8EB1}' + . '\x{8EBE}\x{8EC5}\x{8EC6}\x{8EC8}\x{8ECA}\x{8ECB}\x{8ECC}\x{8ECD}\x{8ED2}' + . '\x{8EDB}\x{8EDF}\x{8EE2}\x{8EE3}\x{8EEB}\x{8EF8}\x{8EFB}\x{8EFC}\x{8EFD}' + . '\x{8EFE}\x{8F03}\x{8F05}\x{8F09}\x{8F0A}\x{8F0C}\x{8F12}\x{8F13}\x{8F14}' + . '\x{8F15}\x{8F19}\x{8F1B}\x{8F1C}\x{8F1D}\x{8F1F}\x{8F26}\x{8F29}\x{8F2A}' + . '\x{8F2F}\x{8F33}\x{8F38}\x{8F39}\x{8F3B}\x{8F3E}\x{8F3F}\x{8F42}\x{8F44}' + . '\x{8F45}\x{8F46}\x{8F49}\x{8F4C}\x{8F4D}\x{8F4E}\x{8F57}\x{8F5C}\x{8F5F}' + . '\x{8F61}\x{8F62}\x{8F63}\x{8F64}\x{8F9B}\x{8F9C}\x{8F9E}\x{8F9F}\x{8FA3}' + . '\x{8FA7}\x{8FA8}\x{8FAD}\x{8FAE}\x{8FAF}\x{8FB0}\x{8FB1}\x{8FB2}\x{8FB7}' + . '\x{8FBA}\x{8FBB}\x{8FBC}\x{8FBF}\x{8FC2}\x{8FC4}\x{8FC5}\x{8FCE}\x{8FD1}' + . '\x{8FD4}\x{8FDA}\x{8FE2}\x{8FE5}\x{8FE6}\x{8FE9}\x{8FEA}\x{8FEB}\x{8FED}' + . '\x{8FEF}\x{8FF0}\x{8FF4}\x{8FF7}\x{8FF8}\x{8FF9}\x{8FFA}\x{8FFD}\x{9000}' + . '\x{9001}\x{9003}\x{9005}\x{9006}\x{900B}\x{900D}\x{900E}\x{900F}\x{9010}' + . '\x{9011}\x{9013}\x{9014}\x{9015}\x{9016}\x{9017}\x{9019}\x{901A}\x{901D}' + . '\x{901E}\x{901F}\x{9020}\x{9021}\x{9022}\x{9023}\x{9027}\x{902E}\x{9031}' + . '\x{9032}\x{9035}\x{9036}\x{9038}\x{9039}\x{903C}\x{903E}\x{9041}\x{9042}' + . '\x{9045}\x{9047}\x{9049}\x{904A}\x{904B}\x{904D}\x{904E}\x{904F}\x{9050}' + . '\x{9051}\x{9052}\x{9053}\x{9054}\x{9055}\x{9056}\x{9058}\x{9059}\x{905C}' + . '\x{905E}\x{9060}\x{9061}\x{9063}\x{9065}\x{9068}\x{9069}\x{906D}\x{906E}' + . '\x{906F}\x{9072}\x{9075}\x{9076}\x{9077}\x{9078}\x{907A}\x{907C}\x{907D}' + . '\x{907F}\x{9080}\x{9081}\x{9082}\x{9083}\x{9084}\x{9087}\x{9089}\x{908A}' + . '\x{908F}\x{9091}\x{90A3}\x{90A6}\x{90A8}\x{90AA}\x{90AF}\x{90B1}\x{90B5}' + . '\x{90B8}\x{90C1}\x{90CA}\x{90CE}\x{90DB}\x{90E1}\x{90E2}\x{90E4}\x{90E8}' + . '\x{90ED}\x{90F5}\x{90F7}\x{90FD}\x{9102}\x{9112}\x{9119}\x{912D}\x{9130}' + . '\x{9132}\x{9149}\x{914A}\x{914B}\x{914C}\x{914D}\x{914E}\x{9152}\x{9154}' + . '\x{9156}\x{9158}\x{9162}\x{9163}\x{9165}\x{9169}\x{916A}\x{916C}\x{9172}' + . '\x{9173}\x{9175}\x{9177}\x{9178}\x{9182}\x{9187}\x{9189}\x{918B}\x{918D}' + . '\x{9190}\x{9192}\x{9197}\x{919C}\x{91A2}\x{91A4}\x{91AA}\x{91AB}\x{91AF}' + . '\x{91B4}\x{91B5}\x{91B8}\x{91BA}\x{91C0}\x{91C1}\x{91C6}\x{91C7}\x{91C8}' + . '\x{91C9}\x{91CB}\x{91CC}\x{91CD}\x{91CE}\x{91CF}\x{91D0}\x{91D1}\x{91D6}' + . '\x{91D8}\x{91DB}\x{91DC}\x{91DD}\x{91DF}\x{91E1}\x{91E3}\x{91E6}\x{91E7}' + . '\x{91F5}\x{91F6}\x{91FC}\x{91FF}\x{920D}\x{920E}\x{9211}\x{9214}\x{9215}' + . '\x{921E}\x{9229}\x{922C}\x{9234}\x{9237}\x{923F}\x{9244}\x{9245}\x{9248}' + . '\x{9249}\x{924B}\x{9250}\x{9257}\x{925A}\x{925B}\x{925E}\x{9262}\x{9264}' + . '\x{9266}\x{9271}\x{927E}\x{9280}\x{9283}\x{9285}\x{9291}\x{9293}\x{9295}' + . '\x{9296}\x{9298}\x{929A}\x{929B}\x{929C}\x{92AD}\x{92B7}\x{92B9}\x{92CF}' + . '\x{92D2}\x{92E4}\x{92E9}\x{92EA}\x{92ED}\x{92F2}\x{92F3}\x{92F8}\x{92FA}' + . '\x{92FC}\x{9306}\x{930F}\x{9310}\x{9318}\x{9319}\x{931A}\x{9320}\x{9322}' + . '\x{9323}\x{9326}\x{9328}\x{932B}\x{932C}\x{932E}\x{932F}\x{9332}\x{9335}' + . '\x{933A}\x{933B}\x{9344}\x{934B}\x{934D}\x{9354}\x{9356}\x{935B}\x{935C}' + . '\x{9360}\x{936C}\x{936E}\x{9375}\x{937C}\x{937E}\x{938C}\x{9394}\x{9396}' + . '\x{9397}\x{939A}\x{93A7}\x{93AC}\x{93AD}\x{93AE}\x{93B0}\x{93B9}\x{93C3}' + . '\x{93C8}\x{93D0}\x{93D1}\x{93D6}\x{93D7}\x{93D8}\x{93DD}\x{93E1}\x{93E4}' + . '\x{93E5}\x{93E8}\x{9403}\x{9407}\x{9410}\x{9413}\x{9414}\x{9418}\x{9419}' + . '\x{941A}\x{9421}\x{942B}\x{9435}\x{9436}\x{9438}\x{943A}\x{9441}\x{9444}' + . '\x{9451}\x{9452}\x{9453}\x{945A}\x{945B}\x{945E}\x{9460}\x{9462}\x{946A}' + . '\x{9470}\x{9475}\x{9477}\x{947C}\x{947D}\x{947E}\x{947F}\x{9481}\x{9577}' + . '\x{9580}\x{9582}\x{9583}\x{9587}\x{9589}\x{958A}\x{958B}\x{958F}\x{9591}' + . '\x{9593}\x{9594}\x{9596}\x{9598}\x{9599}\x{95A0}\x{95A2}\x{95A3}\x{95A4}' + . '\x{95A5}\x{95A7}\x{95A8}\x{95AD}\x{95B2}\x{95B9}\x{95BB}\x{95BC}\x{95BE}' + . '\x{95C3}\x{95C7}\x{95CA}\x{95CC}\x{95CD}\x{95D4}\x{95D5}\x{95D6}\x{95D8}' + . '\x{95DC}\x{95E1}\x{95E2}\x{95E5}\x{961C}\x{9621}\x{9628}\x{962A}\x{962E}' + . '\x{962F}\x{9632}\x{963B}\x{963F}\x{9640}\x{9642}\x{9644}\x{964B}\x{964C}' + . '\x{964D}\x{964F}\x{9650}\x{965B}\x{965C}\x{965D}\x{965E}\x{965F}\x{9662}' + . '\x{9663}\x{9664}\x{9665}\x{9666}\x{966A}\x{966C}\x{9670}\x{9672}\x{9673}' + . '\x{9675}\x{9676}\x{9677}\x{9678}\x{967A}\x{967D}\x{9685}\x{9686}\x{9688}' + . '\x{968A}\x{968B}\x{968D}\x{968E}\x{968F}\x{9694}\x{9695}\x{9697}\x{9698}' + . '\x{9699}\x{969B}\x{969C}\x{96A0}\x{96A3}\x{96A7}\x{96A8}\x{96AA}\x{96B0}' + . '\x{96B1}\x{96B2}\x{96B4}\x{96B6}\x{96B7}\x{96B8}\x{96B9}\x{96BB}\x{96BC}' + . '\x{96C0}\x{96C1}\x{96C4}\x{96C5}\x{96C6}\x{96C7}\x{96C9}\x{96CB}\x{96CC}' + . '\x{96CD}\x{96CE}\x{96D1}\x{96D5}\x{96D6}\x{96D9}\x{96DB}\x{96DC}\x{96E2}' + . '\x{96E3}\x{96E8}\x{96EA}\x{96EB}\x{96F0}\x{96F2}\x{96F6}\x{96F7}\x{96F9}' + . '\x{96FB}\x{9700}\x{9704}\x{9706}\x{9707}\x{9708}\x{970A}\x{970D}\x{970E}' + . '\x{970F}\x{9711}\x{9713}\x{9716}\x{9719}\x{971C}\x{971E}\x{9724}\x{9727}' + . '\x{972A}\x{9730}\x{9732}\x{9738}\x{9739}\x{973D}\x{973E}\x{9742}\x{9744}' + . '\x{9746}\x{9748}\x{9749}\x{9752}\x{9756}\x{9759}\x{975C}\x{975E}\x{9760}' + . '\x{9761}\x{9762}\x{9764}\x{9766}\x{9768}\x{9769}\x{976B}\x{976D}\x{9771}' + . '\x{9774}\x{9779}\x{977A}\x{977C}\x{9781}\x{9784}\x{9785}\x{9786}\x{978B}' + . '\x{978D}\x{978F}\x{9790}\x{9798}\x{979C}\x{97A0}\x{97A3}\x{97A6}\x{97A8}' + . '\x{97AB}\x{97AD}\x{97B3}\x{97B4}\x{97C3}\x{97C6}\x{97C8}\x{97CB}\x{97D3}' + . '\x{97DC}\x{97ED}\x{97EE}\x{97F2}\x{97F3}\x{97F5}\x{97F6}\x{97FB}\x{97FF}' + . '\x{9801}\x{9802}\x{9803}\x{9805}\x{9806}\x{9808}\x{980C}\x{980F}\x{9810}' + . '\x{9811}\x{9812}\x{9813}\x{9817}\x{9818}\x{981A}\x{9821}\x{9824}\x{982C}' + . '\x{982D}\x{9834}\x{9837}\x{9838}\x{983B}\x{983C}\x{983D}\x{9846}\x{984B}' + . '\x{984C}\x{984D}\x{984E}\x{984F}\x{9854}\x{9855}\x{9858}\x{985B}\x{985E}' + . '\x{9867}\x{986B}\x{986F}\x{9870}\x{9871}\x{9873}\x{9874}\x{98A8}\x{98AA}' + . '\x{98AF}\x{98B1}\x{98B6}\x{98C3}\x{98C4}\x{98C6}\x{98DB}\x{98DC}\x{98DF}' + . '\x{98E2}\x{98E9}\x{98EB}\x{98ED}\x{98EE}\x{98EF}\x{98F2}\x{98F4}\x{98FC}' + . '\x{98FD}\x{98FE}\x{9903}\x{9905}\x{9909}\x{990A}\x{990C}\x{9910}\x{9912}' + . '\x{9913}\x{9914}\x{9918}\x{991D}\x{991E}\x{9920}\x{9921}\x{9924}\x{9928}' + . '\x{992C}\x{992E}\x{993D}\x{993E}\x{9942}\x{9945}\x{9949}\x{994B}\x{994C}' + . '\x{9950}\x{9951}\x{9952}\x{9955}\x{9957}\x{9996}\x{9997}\x{9998}\x{9999}' + . '\x{99A5}\x{99A8}\x{99AC}\x{99AD}\x{99AE}\x{99B3}\x{99B4}\x{99BC}\x{99C1}' + . '\x{99C4}\x{99C5}\x{99C6}\x{99C8}\x{99D0}\x{99D1}\x{99D2}\x{99D5}\x{99D8}' + . '\x{99DB}\x{99DD}\x{99DF}\x{99E2}\x{99ED}\x{99EE}\x{99F1}\x{99F2}\x{99F8}' + . '\x{99FB}\x{99FF}\x{9A01}\x{9A05}\x{9A0E}\x{9A0F}\x{9A12}\x{9A13}\x{9A19}' + . '\x{9A28}\x{9A2B}\x{9A30}\x{9A37}\x{9A3E}\x{9A40}\x{9A42}\x{9A43}\x{9A45}' + . '\x{9A4D}\x{9A55}\x{9A57}\x{9A5A}\x{9A5B}\x{9A5F}\x{9A62}\x{9A64}\x{9A65}' + . '\x{9A69}\x{9A6A}\x{9A6B}\x{9AA8}\x{9AAD}\x{9AB0}\x{9AB8}\x{9ABC}\x{9AC0}' + . '\x{9AC4}\x{9ACF}\x{9AD1}\x{9AD3}\x{9AD4}\x{9AD8}\x{9ADE}\x{9ADF}\x{9AE2}' + . '\x{9AE3}\x{9AE6}\x{9AEA}\x{9AEB}\x{9AED}\x{9AEE}\x{9AEF}\x{9AF1}\x{9AF4}' + . '\x{9AF7}\x{9AFB}\x{9B06}\x{9B18}\x{9B1A}\x{9B1F}\x{9B22}\x{9B23}\x{9B25}' + . '\x{9B27}\x{9B28}\x{9B29}\x{9B2A}\x{9B2E}\x{9B2F}\x{9B31}\x{9B32}\x{9B3B}' + . '\x{9B3C}\x{9B41}\x{9B42}\x{9B43}\x{9B44}\x{9B45}\x{9B4D}\x{9B4E}\x{9B4F}' + . '\x{9B51}\x{9B54}\x{9B58}\x{9B5A}\x{9B6F}\x{9B74}\x{9B83}\x{9B8E}\x{9B91}' + . '\x{9B92}\x{9B93}\x{9B96}\x{9B97}\x{9B9F}\x{9BA0}\x{9BA8}\x{9BAA}\x{9BAB}' + . '\x{9BAD}\x{9BAE}\x{9BB4}\x{9BB9}\x{9BC0}\x{9BC6}\x{9BC9}\x{9BCA}\x{9BCF}' + . '\x{9BD1}\x{9BD2}\x{9BD4}\x{9BD6}\x{9BDB}\x{9BE1}\x{9BE2}\x{9BE3}\x{9BE4}' + . '\x{9BE8}\x{9BF0}\x{9BF1}\x{9BF2}\x{9BF5}\x{9C04}\x{9C06}\x{9C08}\x{9C09}' + . '\x{9C0A}\x{9C0C}\x{9C0D}\x{9C10}\x{9C12}\x{9C13}\x{9C14}\x{9C15}\x{9C1B}' + . '\x{9C21}\x{9C24}\x{9C25}\x{9C2D}\x{9C2E}\x{9C2F}\x{9C30}\x{9C32}\x{9C39}' + . '\x{9C3A}\x{9C3B}\x{9C3E}\x{9C46}\x{9C47}\x{9C48}\x{9C52}\x{9C57}\x{9C5A}' + . '\x{9C60}\x{9C67}\x{9C76}\x{9C78}\x{9CE5}\x{9CE7}\x{9CE9}\x{9CEB}\x{9CEC}' + . '\x{9CF0}\x{9CF3}\x{9CF4}\x{9CF6}\x{9D03}\x{9D06}\x{9D07}\x{9D08}\x{9D09}' + . '\x{9D0E}\x{9D12}\x{9D15}\x{9D1B}\x{9D1F}\x{9D23}\x{9D26}\x{9D28}\x{9D2A}' + . '\x{9D2B}\x{9D2C}\x{9D3B}\x{9D3E}\x{9D3F}\x{9D41}\x{9D44}\x{9D46}\x{9D48}' + . '\x{9D50}\x{9D51}\x{9D59}\x{9D5C}\x{9D5D}\x{9D5E}\x{9D60}\x{9D61}\x{9D64}' + . '\x{9D6C}\x{9D6F}\x{9D72}\x{9D7A}\x{9D87}\x{9D89}\x{9D8F}\x{9D9A}\x{9DA4}' + . '\x{9DA9}\x{9DAB}\x{9DAF}\x{9DB2}\x{9DB4}\x{9DB8}\x{9DBA}\x{9DBB}\x{9DC1}' + . '\x{9DC2}\x{9DC4}\x{9DC6}\x{9DCF}\x{9DD3}\x{9DD9}\x{9DE6}\x{9DED}\x{9DEF}' + . '\x{9DF2}\x{9DF8}\x{9DF9}\x{9DFA}\x{9DFD}\x{9E1A}\x{9E1B}\x{9E1E}\x{9E75}' + . '\x{9E78}\x{9E79}\x{9E7D}\x{9E7F}\x{9E81}\x{9E88}\x{9E8B}\x{9E8C}\x{9E91}' + . '\x{9E92}\x{9E93}\x{9E95}\x{9E97}\x{9E9D}\x{9E9F}\x{9EA5}\x{9EA6}\x{9EA9}' + . '\x{9EAA}\x{9EAD}\x{9EB8}\x{9EB9}\x{9EBA}\x{9EBB}\x{9EBC}\x{9EBE}\x{9EBF}' + . '\x{9EC4}\x{9ECC}\x{9ECD}\x{9ECE}\x{9ECF}\x{9ED0}\x{9ED2}\x{9ED4}\x{9ED8}' + . '\x{9ED9}\x{9EDB}\x{9EDC}\x{9EDD}\x{9EDE}\x{9EE0}\x{9EE5}\x{9EE8}\x{9EEF}' + . '\x{9EF4}\x{9EF6}\x{9EF7}\x{9EF9}\x{9EFB}\x{9EFC}\x{9EFD}\x{9F07}\x{9F08}' + . '\x{9F0E}\x{9F13}\x{9F15}\x{9F20}\x{9F21}\x{9F2C}\x{9F3B}\x{9F3E}\x{9F4A}' + . '\x{9F4B}\x{9F4E}\x{9F4F}\x{9F52}\x{9F54}\x{9F5F}\x{9F60}\x{9F61}\x{9F62}' + . '\x{9F63}\x{9F66}\x{9F67}\x{9F6A}\x{9F6C}\x{9F72}\x{9F76}\x{9F77}\x{9F8D}' + . '\x{9F95}\x{9F9C}\x{9F9D}\x{9FA0}]{1,15}$/iu', + 12 => '/^[\x{002d}0-9a-z\x{3447}\x{3473}\x{359E}\x{360E}\x{361A}\x{3918}\x{396E}\x{39CF}\x{39D0}' + . '\x{39DF}\x{3A73}\x{3B4E}\x{3C6E}\x{3CE0}\x{4056}\x{415F}\x{4337}\x{43AC}' + . '\x{43B1}\x{43DD}\x{44D6}\x{464C}\x{4661}\x{4723}\x{4729}\x{477C}\x{478D}' + . '\x{4947}\x{497A}\x{497D}\x{4982}\x{4983}\x{4985}\x{4986}\x{499B}\x{499F}' + . '\x{49B6}\x{49B7}\x{4C77}\x{4C9F}\x{4CA0}\x{4CA1}\x{4CA2}\x{4CA3}\x{4D13}' + . '\x{4D14}\x{4D15}\x{4D16}\x{4D17}\x{4D18}\x{4D19}\x{4DAE}\x{4E00}\x{4E01}' + . '\x{4E02}\x{4E03}\x{4E04}\x{4E05}\x{4E06}\x{4E07}\x{4E08}\x{4E09}\x{4E0A}' + . '\x{4E0B}\x{4E0C}\x{4E0D}\x{4E0E}\x{4E0F}\x{4E10}\x{4E11}\x{4E13}\x{4E14}' + . '\x{4E15}\x{4E16}\x{4E17}\x{4E18}\x{4E19}\x{4E1A}\x{4E1B}\x{4E1C}\x{4E1D}' + . '\x{4E1E}\x{4E1F}\x{4E20}\x{4E21}\x{4E22}\x{4E23}\x{4E24}\x{4E25}\x{4E26}' + . '\x{4E27}\x{4E28}\x{4E2A}\x{4E2B}\x{4E2C}\x{4E2D}\x{4E2E}\x{4E2F}\x{4E30}' + . '\x{4E31}\x{4E32}\x{4E33}\x{4E34}\x{4E35}\x{4E36}\x{4E37}\x{4E38}\x{4E39}' + . '\x{4E3A}\x{4E3B}\x{4E3C}\x{4E3D}\x{4E3E}\x{4E3F}\x{4E40}\x{4E41}\x{4E42}' + . '\x{4E43}\x{4E44}\x{4E45}\x{4E46}\x{4E47}\x{4E48}\x{4E49}\x{4E4A}\x{4E4B}' + . '\x{4E4C}\x{4E4D}\x{4E4E}\x{4E4F}\x{4E50}\x{4E51}\x{4E52}\x{4E53}\x{4E54}' + . '\x{4E56}\x{4E57}\x{4E58}\x{4E59}\x{4E5A}\x{4E5B}\x{4E5C}\x{4E5D}\x{4E5E}' + . '\x{4E5F}\x{4E60}\x{4E61}\x{4E62}\x{4E63}\x{4E64}\x{4E65}\x{4E66}\x{4E67}' + . '\x{4E69}\x{4E6A}\x{4E6B}\x{4E6C}\x{4E6D}\x{4E6E}\x{4E6F}\x{4E70}\x{4E71}' + . '\x{4E72}\x{4E73}\x{4E74}\x{4E75}\x{4E76}\x{4E77}\x{4E78}\x{4E7A}\x{4E7B}' + . '\x{4E7C}\x{4E7D}\x{4E7E}\x{4E7F}\x{4E80}\x{4E81}\x{4E82}\x{4E83}\x{4E84}' + . '\x{4E85}\x{4E86}\x{4E87}\x{4E88}\x{4E89}\x{4E8B}\x{4E8C}\x{4E8D}\x{4E8E}' + . '\x{4E8F}\x{4E90}\x{4E91}\x{4E92}\x{4E93}\x{4E94}\x{4E95}\x{4E97}\x{4E98}' + . '\x{4E99}\x{4E9A}\x{4E9B}\x{4E9C}\x{4E9D}\x{4E9E}\x{4E9F}\x{4EA0}\x{4EA1}' + . '\x{4EA2}\x{4EA4}\x{4EA5}\x{4EA6}\x{4EA7}\x{4EA8}\x{4EA9}\x{4EAA}\x{4EAB}' + . '\x{4EAC}\x{4EAD}\x{4EAE}\x{4EAF}\x{4EB0}\x{4EB1}\x{4EB2}\x{4EB3}\x{4EB4}' + . '\x{4EB5}\x{4EB6}\x{4EB7}\x{4EB8}\x{4EB9}\x{4EBA}\x{4EBB}\x{4EBD}\x{4EBE}' + . '\x{4EBF}\x{4EC0}\x{4EC1}\x{4EC2}\x{4EC3}\x{4EC4}\x{4EC5}\x{4EC6}\x{4EC7}' + . '\x{4EC8}\x{4EC9}\x{4ECA}\x{4ECB}\x{4ECD}\x{4ECE}\x{4ECF}\x{4ED0}\x{4ED1}' + . '\x{4ED2}\x{4ED3}\x{4ED4}\x{4ED5}\x{4ED6}\x{4ED7}\x{4ED8}\x{4ED9}\x{4EDA}' + . '\x{4EDB}\x{4EDC}\x{4EDD}\x{4EDE}\x{4EDF}\x{4EE0}\x{4EE1}\x{4EE2}\x{4EE3}' + . '\x{4EE4}\x{4EE5}\x{4EE6}\x{4EE8}\x{4EE9}\x{4EEA}\x{4EEB}\x{4EEC}\x{4EEF}' + . '\x{4EF0}\x{4EF1}\x{4EF2}\x{4EF3}\x{4EF4}\x{4EF5}\x{4EF6}\x{4EF7}\x{4EFB}' + . '\x{4EFD}\x{4EFF}\x{4F00}\x{4F01}\x{4F02}\x{4F03}\x{4F04}\x{4F05}\x{4F06}' + . '\x{4F08}\x{4F09}\x{4F0A}\x{4F0B}\x{4F0C}\x{4F0D}\x{4F0E}\x{4F0F}\x{4F10}' + . '\x{4F11}\x{4F12}\x{4F13}\x{4F14}\x{4F15}\x{4F17}\x{4F18}\x{4F19}\x{4F1A}' + . '\x{4F1B}\x{4F1C}\x{4F1D}\x{4F1E}\x{4F1F}\x{4F20}\x{4F21}\x{4F22}\x{4F23}' + . '\x{4F24}\x{4F25}\x{4F26}\x{4F27}\x{4F29}\x{4F2A}\x{4F2B}\x{4F2C}\x{4F2D}' + . '\x{4F2E}\x{4F2F}\x{4F30}\x{4F32}\x{4F33}\x{4F34}\x{4F36}\x{4F38}\x{4F39}' + . '\x{4F3A}\x{4F3B}\x{4F3C}\x{4F3D}\x{4F3E}\x{4F3F}\x{4F41}\x{4F42}\x{4F43}' + . '\x{4F45}\x{4F46}\x{4F47}\x{4F48}\x{4F49}\x{4F4A}\x{4F4B}\x{4F4C}\x{4F4D}' + . '\x{4F4E}\x{4F4F}\x{4F50}\x{4F51}\x{4F52}\x{4F53}\x{4F54}\x{4F55}\x{4F56}' + . '\x{4F57}\x{4F58}\x{4F59}\x{4F5A}\x{4F5B}\x{4F5C}\x{4F5D}\x{4F5E}\x{4F5F}' + . '\x{4F60}\x{4F61}\x{4F62}\x{4F63}\x{4F64}\x{4F65}\x{4F66}\x{4F67}\x{4F68}' + . '\x{4F69}\x{4F6A}\x{4F6B}\x{4F6C}\x{4F6D}\x{4F6E}\x{4F6F}\x{4F70}\x{4F72}' + . '\x{4F73}\x{4F74}\x{4F75}\x{4F76}\x{4F77}\x{4F78}\x{4F79}\x{4F7A}\x{4F7B}' + . '\x{4F7C}\x{4F7D}\x{4F7E}\x{4F7F}\x{4F80}\x{4F81}\x{4F82}\x{4F83}\x{4F84}' + . '\x{4F85}\x{4F86}\x{4F87}\x{4F88}\x{4F89}\x{4F8A}\x{4F8B}\x{4F8D}\x{4F8F}' + . '\x{4F90}\x{4F91}\x{4F92}\x{4F93}\x{4F94}\x{4F95}\x{4F96}\x{4F97}\x{4F98}' + . '\x{4F99}\x{4F9A}\x{4F9B}\x{4F9C}\x{4F9D}\x{4F9E}\x{4F9F}\x{4FA0}\x{4FA1}' + . '\x{4FA3}\x{4FA4}\x{4FA5}\x{4FA6}\x{4FA7}\x{4FA8}\x{4FA9}\x{4FAA}\x{4FAB}' + . '\x{4FAC}\x{4FAE}\x{4FAF}\x{4FB0}\x{4FB1}\x{4FB2}\x{4FB3}\x{4FB4}\x{4FB5}' + . '\x{4FB6}\x{4FB7}\x{4FB8}\x{4FB9}\x{4FBA}\x{4FBB}\x{4FBC}\x{4FBE}\x{4FBF}' + . '\x{4FC0}\x{4FC1}\x{4FC2}\x{4FC3}\x{4FC4}\x{4FC5}\x{4FC7}\x{4FC9}\x{4FCA}' + . '\x{4FCB}\x{4FCD}\x{4FCE}\x{4FCF}\x{4FD0}\x{4FD1}\x{4FD2}\x{4FD3}\x{4FD4}' + . '\x{4FD5}\x{4FD6}\x{4FD7}\x{4FD8}\x{4FD9}\x{4FDA}\x{4FDB}\x{4FDC}\x{4FDD}' + . '\x{4FDE}\x{4FDF}\x{4FE0}\x{4FE1}\x{4FE3}\x{4FE4}\x{4FE5}\x{4FE6}\x{4FE7}' + . '\x{4FE8}\x{4FE9}\x{4FEA}\x{4FEB}\x{4FEC}\x{4FED}\x{4FEE}\x{4FEF}\x{4FF0}' + . '\x{4FF1}\x{4FF2}\x{4FF3}\x{4FF4}\x{4FF5}\x{4FF6}\x{4FF7}\x{4FF8}\x{4FF9}' + . '\x{4FFA}\x{4FFB}\x{4FFE}\x{4FFF}\x{5000}\x{5001}\x{5002}\x{5003}\x{5004}' + . '\x{5005}\x{5006}\x{5007}\x{5008}\x{5009}\x{500A}\x{500B}\x{500C}\x{500D}' + . '\x{500E}\x{500F}\x{5011}\x{5012}\x{5013}\x{5014}\x{5015}\x{5016}\x{5017}' + . '\x{5018}\x{5019}\x{501A}\x{501B}\x{501C}\x{501D}\x{501E}\x{501F}\x{5020}' + . '\x{5021}\x{5022}\x{5023}\x{5024}\x{5025}\x{5026}\x{5027}\x{5028}\x{5029}' + . '\x{502A}\x{502B}\x{502C}\x{502D}\x{502E}\x{502F}\x{5030}\x{5031}\x{5032}' + . '\x{5033}\x{5035}\x{5036}\x{5037}\x{5039}\x{503A}\x{503B}\x{503C}\x{503E}' + . '\x{503F}\x{5040}\x{5041}\x{5043}\x{5044}\x{5045}\x{5046}\x{5047}\x{5048}' + . '\x{5049}\x{504A}\x{504B}\x{504C}\x{504D}\x{504E}\x{504F}\x{5051}\x{5053}' + . '\x{5054}\x{5055}\x{5056}\x{5057}\x{5059}\x{505A}\x{505B}\x{505C}\x{505D}' + . '\x{505E}\x{505F}\x{5060}\x{5061}\x{5062}\x{5063}\x{5064}\x{5065}\x{5066}' + . '\x{5067}\x{5068}\x{5069}\x{506A}\x{506B}\x{506C}\x{506D}\x{506E}\x{506F}' + . '\x{5070}\x{5071}\x{5072}\x{5073}\x{5074}\x{5075}\x{5076}\x{5077}\x{5078}' + . '\x{5079}\x{507A}\x{507B}\x{507D}\x{507E}\x{507F}\x{5080}\x{5082}\x{5083}' + . '\x{5084}\x{5085}\x{5086}\x{5087}\x{5088}\x{5089}\x{508A}\x{508B}\x{508C}' + . '\x{508D}\x{508E}\x{508F}\x{5090}\x{5091}\x{5092}\x{5094}\x{5095}\x{5096}' + . '\x{5098}\x{5099}\x{509A}\x{509B}\x{509C}\x{509D}\x{509E}\x{50A2}\x{50A3}' + . '\x{50A4}\x{50A5}\x{50A6}\x{50A7}\x{50A8}\x{50A9}\x{50AA}\x{50AB}\x{50AC}' + . '\x{50AD}\x{50AE}\x{50AF}\x{50B0}\x{50B1}\x{50B2}\x{50B3}\x{50B4}\x{50B5}' + . '\x{50B6}\x{50B7}\x{50B8}\x{50BA}\x{50BB}\x{50BC}\x{50BD}\x{50BE}\x{50BF}' + . '\x{50C0}\x{50C1}\x{50C2}\x{50C4}\x{50C5}\x{50C6}\x{50C7}\x{50C8}\x{50C9}' + . '\x{50CA}\x{50CB}\x{50CC}\x{50CD}\x{50CE}\x{50CF}\x{50D0}\x{50D1}\x{50D2}' + . '\x{50D3}\x{50D4}\x{50D5}\x{50D6}\x{50D7}\x{50D9}\x{50DA}\x{50DB}\x{50DC}' + . '\x{50DD}\x{50DE}\x{50E0}\x{50E3}\x{50E4}\x{50E5}\x{50E6}\x{50E7}\x{50E8}' + . '\x{50E9}\x{50EA}\x{50EC}\x{50ED}\x{50EE}\x{50EF}\x{50F0}\x{50F1}\x{50F2}' + . '\x{50F3}\x{50F5}\x{50F6}\x{50F8}\x{50F9}\x{50FA}\x{50FB}\x{50FC}\x{50FD}' + . '\x{50FE}\x{50FF}\x{5100}\x{5101}\x{5102}\x{5103}\x{5104}\x{5105}\x{5106}' + . '\x{5107}\x{5108}\x{5109}\x{510A}\x{510B}\x{510C}\x{510D}\x{510E}\x{510F}' + . '\x{5110}\x{5111}\x{5112}\x{5113}\x{5114}\x{5115}\x{5116}\x{5117}\x{5118}' + . '\x{5119}\x{511A}\x{511C}\x{511D}\x{511E}\x{511F}\x{5120}\x{5121}\x{5122}' + . '\x{5123}\x{5124}\x{5125}\x{5126}\x{5127}\x{5129}\x{512A}\x{512C}\x{512D}' + . '\x{512E}\x{512F}\x{5130}\x{5131}\x{5132}\x{5133}\x{5134}\x{5135}\x{5136}' + . '\x{5137}\x{5138}\x{5139}\x{513A}\x{513B}\x{513C}\x{513D}\x{513E}\x{513F}' + . '\x{5140}\x{5141}\x{5143}\x{5144}\x{5145}\x{5146}\x{5147}\x{5148}\x{5149}' + . '\x{514B}\x{514C}\x{514D}\x{514E}\x{5150}\x{5151}\x{5152}\x{5154}\x{5155}' + . '\x{5156}\x{5157}\x{5159}\x{515A}\x{515B}\x{515C}\x{515D}\x{515E}\x{515F}' + . '\x{5161}\x{5162}\x{5163}\x{5165}\x{5166}\x{5167}\x{5168}\x{5169}\x{516A}' + . '\x{516B}\x{516C}\x{516D}\x{516E}\x{516F}\x{5170}\x{5171}\x{5173}\x{5174}' + . '\x{5175}\x{5176}\x{5177}\x{5178}\x{5179}\x{517A}\x{517B}\x{517C}\x{517D}' + . '\x{517F}\x{5180}\x{5181}\x{5182}\x{5185}\x{5186}\x{5187}\x{5188}\x{5189}' + . '\x{518A}\x{518B}\x{518C}\x{518D}\x{518F}\x{5190}\x{5191}\x{5192}\x{5193}' + . '\x{5194}\x{5195}\x{5196}\x{5197}\x{5198}\x{5199}\x{519A}\x{519B}\x{519C}' + . '\x{519D}\x{519E}\x{519F}\x{51A0}\x{51A2}\x{51A4}\x{51A5}\x{51A6}\x{51A7}' + . '\x{51A8}\x{51AA}\x{51AB}\x{51AC}\x{51AE}\x{51AF}\x{51B0}\x{51B1}\x{51B2}' + . '\x{51B3}\x{51B5}\x{51B6}\x{51B7}\x{51B9}\x{51BB}\x{51BC}\x{51BD}\x{51BE}' + . '\x{51BF}\x{51C0}\x{51C1}\x{51C3}\x{51C4}\x{51C5}\x{51C6}\x{51C7}\x{51C8}' + . '\x{51C9}\x{51CA}\x{51CB}\x{51CC}\x{51CD}\x{51CE}\x{51CF}\x{51D0}\x{51D1}' + . '\x{51D4}\x{51D5}\x{51D6}\x{51D7}\x{51D8}\x{51D9}\x{51DA}\x{51DB}\x{51DC}' + . '\x{51DD}\x{51DE}\x{51E0}\x{51E1}\x{51E2}\x{51E3}\x{51E4}\x{51E5}\x{51E7}' + . '\x{51E8}\x{51E9}\x{51EA}\x{51EB}\x{51ED}\x{51EF}\x{51F0}\x{51F1}\x{51F3}' + . '\x{51F4}\x{51F5}\x{51F6}\x{51F7}\x{51F8}\x{51F9}\x{51FA}\x{51FB}\x{51FC}' + . '\x{51FD}\x{51FE}\x{51FF}\x{5200}\x{5201}\x{5202}\x{5203}\x{5204}\x{5205}' + . '\x{5206}\x{5207}\x{5208}\x{5209}\x{520A}\x{520B}\x{520C}\x{520D}\x{520E}' + . '\x{520F}\x{5210}\x{5211}\x{5212}\x{5213}\x{5214}\x{5215}\x{5216}\x{5217}' + . '\x{5218}\x{5219}\x{521A}\x{521B}\x{521C}\x{521D}\x{521E}\x{521F}\x{5220}' + . '\x{5221}\x{5222}\x{5223}\x{5224}\x{5225}\x{5226}\x{5228}\x{5229}\x{522A}' + . '\x{522B}\x{522C}\x{522D}\x{522E}\x{522F}\x{5230}\x{5231}\x{5232}\x{5233}' + . '\x{5234}\x{5235}\x{5236}\x{5237}\x{5238}\x{5239}\x{523A}\x{523B}\x{523C}' + . '\x{523D}\x{523E}\x{523F}\x{5240}\x{5241}\x{5242}\x{5243}\x{5244}\x{5245}' + . '\x{5246}\x{5247}\x{5248}\x{5249}\x{524A}\x{524B}\x{524C}\x{524D}\x{524E}' + . '\x{5250}\x{5251}\x{5252}\x{5254}\x{5255}\x{5256}\x{5257}\x{5258}\x{5259}' + . '\x{525A}\x{525B}\x{525C}\x{525D}\x{525E}\x{525F}\x{5260}\x{5261}\x{5262}' + . '\x{5263}\x{5264}\x{5265}\x{5267}\x{5268}\x{5269}\x{526A}\x{526B}\x{526C}' + . '\x{526D}\x{526E}\x{526F}\x{5270}\x{5272}\x{5273}\x{5274}\x{5275}\x{5276}' + . '\x{5277}\x{5278}\x{527A}\x{527B}\x{527C}\x{527D}\x{527E}\x{527F}\x{5280}' + . '\x{5281}\x{5282}\x{5283}\x{5284}\x{5286}\x{5287}\x{5288}\x{5289}\x{528A}' + . '\x{528B}\x{528C}\x{528D}\x{528F}\x{5290}\x{5291}\x{5292}\x{5293}\x{5294}' + . '\x{5295}\x{5296}\x{5297}\x{5298}\x{5299}\x{529A}\x{529B}\x{529C}\x{529D}' + . '\x{529E}\x{529F}\x{52A0}\x{52A1}\x{52A2}\x{52A3}\x{52A5}\x{52A6}\x{52A7}' + . '\x{52A8}\x{52A9}\x{52AA}\x{52AB}\x{52AC}\x{52AD}\x{52AE}\x{52AF}\x{52B0}' + . '\x{52B1}\x{52B2}\x{52B3}\x{52B4}\x{52B5}\x{52B6}\x{52B7}\x{52B8}\x{52B9}' + . '\x{52BA}\x{52BB}\x{52BC}\x{52BD}\x{52BE}\x{52BF}\x{52C0}\x{52C1}\x{52C2}' + . '\x{52C3}\x{52C6}\x{52C7}\x{52C9}\x{52CA}\x{52CB}\x{52CD}\x{52CF}\x{52D0}' + . '\x{52D2}\x{52D3}\x{52D5}\x{52D6}\x{52D7}\x{52D8}\x{52D9}\x{52DA}\x{52DB}' + . '\x{52DC}\x{52DD}\x{52DE}\x{52DF}\x{52E0}\x{52E2}\x{52E3}\x{52E4}\x{52E6}' + . '\x{52E7}\x{52E8}\x{52E9}\x{52EA}\x{52EB}\x{52EC}\x{52ED}\x{52EF}\x{52F0}' + . '\x{52F1}\x{52F2}\x{52F3}\x{52F4}\x{52F5}\x{52F6}\x{52F7}\x{52F8}\x{52F9}' + . '\x{52FA}\x{52FB}\x{52FC}\x{52FD}\x{52FE}\x{52FF}\x{5300}\x{5301}\x{5302}' + . '\x{5305}\x{5306}\x{5307}\x{5308}\x{5309}\x{530A}\x{530B}\x{530C}\x{530D}' + . '\x{530E}\x{530F}\x{5310}\x{5311}\x{5312}\x{5313}\x{5314}\x{5315}\x{5316}' + . '\x{5317}\x{5319}\x{531A}\x{531C}\x{531D}\x{531F}\x{5320}\x{5321}\x{5322}' + . '\x{5323}\x{5324}\x{5325}\x{5326}\x{5328}\x{532A}\x{532B}\x{532C}\x{532D}' + . '\x{532E}\x{532F}\x{5330}\x{5331}\x{5333}\x{5334}\x{5337}\x{5339}\x{533A}' + . '\x{533B}\x{533C}\x{533D}\x{533E}\x{533F}\x{5340}\x{5341}\x{5343}\x{5344}' + . '\x{5345}\x{5346}\x{5347}\x{5348}\x{5349}\x{534A}\x{534B}\x{534C}\x{534D}' + . '\x{534E}\x{534F}\x{5350}\x{5351}\x{5352}\x{5353}\x{5354}\x{5355}\x{5356}' + . '\x{5357}\x{5358}\x{5359}\x{535A}\x{535C}\x{535E}\x{535F}\x{5360}\x{5361}' + . '\x{5362}\x{5363}\x{5364}\x{5365}\x{5366}\x{5367}\x{5369}\x{536B}\x{536C}' + . '\x{536E}\x{536F}\x{5370}\x{5371}\x{5372}\x{5373}\x{5374}\x{5375}\x{5376}' + . '\x{5377}\x{5378}\x{5379}\x{537A}\x{537B}\x{537C}\x{537D}\x{537E}\x{537F}' + . '\x{5381}\x{5382}\x{5383}\x{5384}\x{5385}\x{5386}\x{5387}\x{5388}\x{5389}' + . '\x{538A}\x{538B}\x{538C}\x{538D}\x{538E}\x{538F}\x{5390}\x{5391}\x{5392}' + . '\x{5393}\x{5394}\x{5395}\x{5396}\x{5397}\x{5398}\x{5399}\x{539A}\x{539B}' + . '\x{539C}\x{539D}\x{539E}\x{539F}\x{53A0}\x{53A2}\x{53A3}\x{53A4}\x{53A5}' + . '\x{53A6}\x{53A7}\x{53A8}\x{53A9}\x{53AC}\x{53AD}\x{53AE}\x{53B0}\x{53B1}' + . '\x{53B2}\x{53B3}\x{53B4}\x{53B5}\x{53B6}\x{53B7}\x{53B8}\x{53B9}\x{53BB}' + . '\x{53BC}\x{53BD}\x{53BE}\x{53BF}\x{53C0}\x{53C1}\x{53C2}\x{53C3}\x{53C4}' + . '\x{53C6}\x{53C7}\x{53C8}\x{53C9}\x{53CA}\x{53CB}\x{53CC}\x{53CD}\x{53CE}' + . '\x{53D0}\x{53D1}\x{53D2}\x{53D3}\x{53D4}\x{53D5}\x{53D6}\x{53D7}\x{53D8}' + . '\x{53D9}\x{53DB}\x{53DC}\x{53DF}\x{53E0}\x{53E1}\x{53E2}\x{53E3}\x{53E4}' + . '\x{53E5}\x{53E6}\x{53E8}\x{53E9}\x{53EA}\x{53EB}\x{53EC}\x{53ED}\x{53EE}' + . '\x{53EF}\x{53F0}\x{53F1}\x{53F2}\x{53F3}\x{53F4}\x{53F5}\x{53F6}\x{53F7}' + . '\x{53F8}\x{53F9}\x{53FA}\x{53FB}\x{53FC}\x{53FD}\x{53FE}\x{5401}\x{5402}' + . '\x{5403}\x{5404}\x{5405}\x{5406}\x{5407}\x{5408}\x{5409}\x{540A}\x{540B}' + . '\x{540C}\x{540D}\x{540E}\x{540F}\x{5410}\x{5411}\x{5412}\x{5413}\x{5414}' + . '\x{5415}\x{5416}\x{5417}\x{5418}\x{5419}\x{541B}\x{541C}\x{541D}\x{541E}' + . '\x{541F}\x{5420}\x{5421}\x{5423}\x{5424}\x{5425}\x{5426}\x{5427}\x{5428}' + . '\x{5429}\x{542A}\x{542B}\x{542C}\x{542D}\x{542E}\x{542F}\x{5430}\x{5431}' + . '\x{5432}\x{5433}\x{5434}\x{5435}\x{5436}\x{5437}\x{5438}\x{5439}\x{543A}' + . '\x{543B}\x{543C}\x{543D}\x{543E}\x{543F}\x{5440}\x{5441}\x{5442}\x{5443}' + . '\x{5444}\x{5445}\x{5446}\x{5447}\x{5448}\x{5449}\x{544A}\x{544B}\x{544D}' + . '\x{544E}\x{544F}\x{5450}\x{5451}\x{5452}\x{5453}\x{5454}\x{5455}\x{5456}' + . '\x{5457}\x{5458}\x{5459}\x{545A}\x{545B}\x{545C}\x{545E}\x{545F}\x{5460}' + . '\x{5461}\x{5462}\x{5463}\x{5464}\x{5465}\x{5466}\x{5467}\x{5468}\x{546A}' + . '\x{546B}\x{546C}\x{546D}\x{546E}\x{546F}\x{5470}\x{5471}\x{5472}\x{5473}' + . '\x{5474}\x{5475}\x{5476}\x{5477}\x{5478}\x{5479}\x{547A}\x{547B}\x{547C}' + . '\x{547D}\x{547E}\x{547F}\x{5480}\x{5481}\x{5482}\x{5483}\x{5484}\x{5485}' + . '\x{5486}\x{5487}\x{5488}\x{5489}\x{548B}\x{548C}\x{548D}\x{548E}\x{548F}' + . '\x{5490}\x{5491}\x{5492}\x{5493}\x{5494}\x{5495}\x{5496}\x{5497}\x{5498}' + . '\x{5499}\x{549A}\x{549B}\x{549C}\x{549D}\x{549E}\x{549F}\x{54A0}\x{54A1}' + . '\x{54A2}\x{54A3}\x{54A4}\x{54A5}\x{54A6}\x{54A7}\x{54A8}\x{54A9}\x{54AA}' + . '\x{54AB}\x{54AC}\x{54AD}\x{54AE}\x{54AF}\x{54B0}\x{54B1}\x{54B2}\x{54B3}' + . '\x{54B4}\x{54B6}\x{54B7}\x{54B8}\x{54B9}\x{54BA}\x{54BB}\x{54BC}\x{54BD}' + . '\x{54BE}\x{54BF}\x{54C0}\x{54C1}\x{54C2}\x{54C3}\x{54C4}\x{54C5}\x{54C6}' + . '\x{54C7}\x{54C8}\x{54C9}\x{54CA}\x{54CB}\x{54CC}\x{54CD}\x{54CE}\x{54CF}' + . '\x{54D0}\x{54D1}\x{54D2}\x{54D3}\x{54D4}\x{54D5}\x{54D6}\x{54D7}\x{54D8}' + . '\x{54D9}\x{54DA}\x{54DB}\x{54DC}\x{54DD}\x{54DE}\x{54DF}\x{54E0}\x{54E1}' + . '\x{54E2}\x{54E3}\x{54E4}\x{54E5}\x{54E6}\x{54E7}\x{54E8}\x{54E9}\x{54EA}' + . '\x{54EB}\x{54EC}\x{54ED}\x{54EE}\x{54EF}\x{54F0}\x{54F1}\x{54F2}\x{54F3}' + . '\x{54F4}\x{54F5}\x{54F7}\x{54F8}\x{54F9}\x{54FA}\x{54FB}\x{54FC}\x{54FD}' + . '\x{54FE}\x{54FF}\x{5500}\x{5501}\x{5502}\x{5503}\x{5504}\x{5505}\x{5506}' + . '\x{5507}\x{5508}\x{5509}\x{550A}\x{550B}\x{550C}\x{550D}\x{550E}\x{550F}' + . '\x{5510}\x{5511}\x{5512}\x{5513}\x{5514}\x{5516}\x{5517}\x{551A}\x{551B}' + . '\x{551C}\x{551D}\x{551E}\x{551F}\x{5520}\x{5521}\x{5522}\x{5523}\x{5524}' + . '\x{5525}\x{5526}\x{5527}\x{5528}\x{5529}\x{552A}\x{552B}\x{552C}\x{552D}' + . '\x{552E}\x{552F}\x{5530}\x{5531}\x{5532}\x{5533}\x{5534}\x{5535}\x{5536}' + . '\x{5537}\x{5538}\x{5539}\x{553A}\x{553B}\x{553C}\x{553D}\x{553E}\x{553F}' + . '\x{5540}\x{5541}\x{5542}\x{5543}\x{5544}\x{5545}\x{5546}\x{5548}\x{5549}' + . '\x{554A}\x{554B}\x{554C}\x{554D}\x{554E}\x{554F}\x{5550}\x{5551}\x{5552}' + . '\x{5553}\x{5554}\x{5555}\x{5556}\x{5557}\x{5558}\x{5559}\x{555A}\x{555B}' + . '\x{555C}\x{555D}\x{555E}\x{555F}\x{5561}\x{5562}\x{5563}\x{5564}\x{5565}' + . '\x{5566}\x{5567}\x{5568}\x{5569}\x{556A}\x{556B}\x{556C}\x{556D}\x{556E}' + . '\x{556F}\x{5570}\x{5571}\x{5572}\x{5573}\x{5574}\x{5575}\x{5576}\x{5577}' + . '\x{5578}\x{5579}\x{557B}\x{557C}\x{557D}\x{557E}\x{557F}\x{5580}\x{5581}' + . '\x{5582}\x{5583}\x{5584}\x{5585}\x{5586}\x{5587}\x{5588}\x{5589}\x{558A}' + . '\x{558B}\x{558C}\x{558D}\x{558E}\x{558F}\x{5590}\x{5591}\x{5592}\x{5593}' + . '\x{5594}\x{5595}\x{5596}\x{5597}\x{5598}\x{5599}\x{559A}\x{559B}\x{559C}' + . '\x{559D}\x{559E}\x{559F}\x{55A0}\x{55A1}\x{55A2}\x{55A3}\x{55A4}\x{55A5}' + . '\x{55A6}\x{55A7}\x{55A8}\x{55A9}\x{55AA}\x{55AB}\x{55AC}\x{55AD}\x{55AE}' + . '\x{55AF}\x{55B0}\x{55B1}\x{55B2}\x{55B3}\x{55B4}\x{55B5}\x{55B6}\x{55B7}' + . '\x{55B8}\x{55B9}\x{55BA}\x{55BB}\x{55BC}\x{55BD}\x{55BE}\x{55BF}\x{55C0}' + . '\x{55C1}\x{55C2}\x{55C3}\x{55C4}\x{55C5}\x{55C6}\x{55C7}\x{55C8}\x{55C9}' + . '\x{55CA}\x{55CB}\x{55CC}\x{55CD}\x{55CE}\x{55CF}\x{55D0}\x{55D1}\x{55D2}' + . '\x{55D3}\x{55D4}\x{55D5}\x{55D6}\x{55D7}\x{55D8}\x{55D9}\x{55DA}\x{55DB}' + . '\x{55DC}\x{55DD}\x{55DE}\x{55DF}\x{55E1}\x{55E2}\x{55E3}\x{55E4}\x{55E5}' + . '\x{55E6}\x{55E7}\x{55E8}\x{55E9}\x{55EA}\x{55EB}\x{55EC}\x{55ED}\x{55EE}' + . '\x{55EF}\x{55F0}\x{55F1}\x{55F2}\x{55F3}\x{55F4}\x{55F5}\x{55F6}\x{55F7}' + . '\x{55F9}\x{55FA}\x{55FB}\x{55FC}\x{55FD}\x{55FE}\x{55FF}\x{5600}\x{5601}' + . '\x{5602}\x{5603}\x{5604}\x{5606}\x{5607}\x{5608}\x{5609}\x{560C}\x{560D}' + . '\x{560E}\x{560F}\x{5610}\x{5611}\x{5612}\x{5613}\x{5614}\x{5615}\x{5616}' + . '\x{5617}\x{5618}\x{5619}\x{561A}\x{561B}\x{561C}\x{561D}\x{561E}\x{561F}' + . '\x{5621}\x{5622}\x{5623}\x{5624}\x{5625}\x{5626}\x{5627}\x{5628}\x{5629}' + . '\x{562A}\x{562C}\x{562D}\x{562E}\x{562F}\x{5630}\x{5631}\x{5632}\x{5633}' + . '\x{5634}\x{5635}\x{5636}\x{5638}\x{5639}\x{563A}\x{563B}\x{563D}\x{563E}' + . '\x{563F}\x{5640}\x{5641}\x{5642}\x{5643}\x{5645}\x{5646}\x{5647}\x{5648}' + . '\x{5649}\x{564A}\x{564C}\x{564D}\x{564E}\x{564F}\x{5650}\x{5652}\x{5653}' + . '\x{5654}\x{5655}\x{5657}\x{5658}\x{5659}\x{565A}\x{565B}\x{565C}\x{565D}' + . '\x{565E}\x{5660}\x{5662}\x{5663}\x{5664}\x{5665}\x{5666}\x{5667}\x{5668}' + . '\x{5669}\x{566A}\x{566B}\x{566C}\x{566D}\x{566E}\x{566F}\x{5670}\x{5671}' + . '\x{5672}\x{5673}\x{5674}\x{5676}\x{5677}\x{5678}\x{5679}\x{567A}\x{567B}' + . '\x{567C}\x{567E}\x{567F}\x{5680}\x{5681}\x{5682}\x{5683}\x{5684}\x{5685}' + . '\x{5686}\x{5687}\x{568A}\x{568C}\x{568D}\x{568E}\x{568F}\x{5690}\x{5691}' + . '\x{5692}\x{5693}\x{5694}\x{5695}\x{5697}\x{5698}\x{5699}\x{569A}\x{569B}' + . '\x{569C}\x{569D}\x{569F}\x{56A0}\x{56A1}\x{56A3}\x{56A4}\x{56A5}\x{56A6}' + . '\x{56A7}\x{56A8}\x{56A9}\x{56AA}\x{56AB}\x{56AC}\x{56AD}\x{56AE}\x{56AF}' + . '\x{56B0}\x{56B1}\x{56B2}\x{56B3}\x{56B4}\x{56B5}\x{56B6}\x{56B7}\x{56B8}' + . '\x{56B9}\x{56BB}\x{56BC}\x{56BD}\x{56BE}\x{56BF}\x{56C0}\x{56C1}\x{56C2}' + . '\x{56C3}\x{56C4}\x{56C5}\x{56C6}\x{56C7}\x{56C8}\x{56C9}\x{56CA}\x{56CB}' + . '\x{56CC}\x{56CD}\x{56CE}\x{56D0}\x{56D1}\x{56D2}\x{56D3}\x{56D4}\x{56D5}' + . '\x{56D6}\x{56D7}\x{56D8}\x{56DA}\x{56DB}\x{56DC}\x{56DD}\x{56DE}\x{56DF}' + . '\x{56E0}\x{56E1}\x{56E2}\x{56E3}\x{56E4}\x{56E5}\x{56E7}\x{56E8}\x{56E9}' + . '\x{56EA}\x{56EB}\x{56EC}\x{56ED}\x{56EE}\x{56EF}\x{56F0}\x{56F1}\x{56F2}' + . '\x{56F3}\x{56F4}\x{56F5}\x{56F7}\x{56F9}\x{56FA}\x{56FD}\x{56FE}\x{56FF}' + . '\x{5700}\x{5701}\x{5702}\x{5703}\x{5704}\x{5706}\x{5707}\x{5708}\x{5709}' + . '\x{570A}\x{570B}\x{570C}\x{570D}\x{570E}\x{570F}\x{5710}\x{5712}\x{5713}' + . '\x{5714}\x{5715}\x{5716}\x{5718}\x{5719}\x{571A}\x{571B}\x{571C}\x{571D}' + . '\x{571E}\x{571F}\x{5720}\x{5722}\x{5723}\x{5725}\x{5726}\x{5727}\x{5728}' + . '\x{5729}\x{572A}\x{572B}\x{572C}\x{572D}\x{572E}\x{572F}\x{5730}\x{5731}' + . '\x{5732}\x{5733}\x{5734}\x{5735}\x{5736}\x{5737}\x{5738}\x{5739}\x{573A}' + . '\x{573B}\x{573C}\x{573E}\x{573F}\x{5740}\x{5741}\x{5742}\x{5744}\x{5745}' + . '\x{5746}\x{5747}\x{5749}\x{574A}\x{574B}\x{574C}\x{574D}\x{574E}\x{574F}' + . '\x{5750}\x{5751}\x{5752}\x{5753}\x{5754}\x{5757}\x{5759}\x{575A}\x{575B}' + . '\x{575C}\x{575D}\x{575E}\x{575F}\x{5760}\x{5761}\x{5762}\x{5764}\x{5765}' + . '\x{5766}\x{5767}\x{5768}\x{5769}\x{576A}\x{576B}\x{576C}\x{576D}\x{576F}' + . '\x{5770}\x{5771}\x{5772}\x{5773}\x{5774}\x{5775}\x{5776}\x{5777}\x{5779}' + . '\x{577A}\x{577B}\x{577C}\x{577D}\x{577E}\x{577F}\x{5780}\x{5782}\x{5783}' + . '\x{5784}\x{5785}\x{5786}\x{5788}\x{5789}\x{578A}\x{578B}\x{578C}\x{578D}' + . '\x{578E}\x{578F}\x{5790}\x{5791}\x{5792}\x{5793}\x{5794}\x{5795}\x{5797}' + . '\x{5798}\x{5799}\x{579A}\x{579B}\x{579C}\x{579D}\x{579E}\x{579F}\x{57A0}' + . '\x{57A1}\x{57A2}\x{57A3}\x{57A4}\x{57A5}\x{57A6}\x{57A7}\x{57A9}\x{57AA}' + . '\x{57AB}\x{57AC}\x{57AD}\x{57AE}\x{57AF}\x{57B0}\x{57B1}\x{57B2}\x{57B3}' + . '\x{57B4}\x{57B5}\x{57B6}\x{57B7}\x{57B8}\x{57B9}\x{57BA}\x{57BB}\x{57BC}' + . '\x{57BD}\x{57BE}\x{57BF}\x{57C0}\x{57C1}\x{57C2}\x{57C3}\x{57C4}\x{57C5}' + . '\x{57C6}\x{57C7}\x{57C8}\x{57C9}\x{57CB}\x{57CC}\x{57CD}\x{57CE}\x{57CF}' + . '\x{57D0}\x{57D2}\x{57D3}\x{57D4}\x{57D5}\x{57D6}\x{57D8}\x{57D9}\x{57DA}' + . '\x{57DC}\x{57DD}\x{57DF}\x{57E0}\x{57E1}\x{57E2}\x{57E3}\x{57E4}\x{57E5}' + . '\x{57E6}\x{57E7}\x{57E8}\x{57E9}\x{57EA}\x{57EB}\x{57EC}\x{57ED}\x{57EE}' + . '\x{57EF}\x{57F0}\x{57F1}\x{57F2}\x{57F3}\x{57F4}\x{57F5}\x{57F6}\x{57F7}' + . '\x{57F8}\x{57F9}\x{57FA}\x{57FB}\x{57FC}\x{57FD}\x{57FE}\x{57FF}\x{5800}' + . '\x{5801}\x{5802}\x{5803}\x{5804}\x{5805}\x{5806}\x{5807}\x{5808}\x{5809}' + . '\x{580A}\x{580B}\x{580C}\x{580D}\x{580E}\x{580F}\x{5810}\x{5811}\x{5812}' + . '\x{5813}\x{5814}\x{5815}\x{5816}\x{5819}\x{581A}\x{581B}\x{581C}\x{581D}' + . '\x{581E}\x{581F}\x{5820}\x{5821}\x{5822}\x{5823}\x{5824}\x{5825}\x{5826}' + . '\x{5827}\x{5828}\x{5829}\x{582A}\x{582B}\x{582C}\x{582D}\x{582E}\x{582F}' + . '\x{5830}\x{5831}\x{5832}\x{5833}\x{5834}\x{5835}\x{5836}\x{5837}\x{5838}' + . '\x{5839}\x{583A}\x{583B}\x{583C}\x{583D}\x{583E}\x{583F}\x{5840}\x{5842}' + . '\x{5843}\x{5844}\x{5845}\x{5846}\x{5847}\x{5848}\x{5849}\x{584A}\x{584B}' + . '\x{584C}\x{584D}\x{584E}\x{584F}\x{5851}\x{5852}\x{5853}\x{5854}\x{5855}' + . '\x{5857}\x{5858}\x{5859}\x{585A}\x{585B}\x{585C}\x{585D}\x{585E}\x{585F}' + . '\x{5861}\x{5862}\x{5863}\x{5864}\x{5865}\x{5868}\x{5869}\x{586A}\x{586B}' + . '\x{586C}\x{586D}\x{586E}\x{586F}\x{5870}\x{5871}\x{5872}\x{5873}\x{5874}' + . '\x{5875}\x{5876}\x{5878}\x{5879}\x{587A}\x{587B}\x{587C}\x{587D}\x{587E}' + . '\x{587F}\x{5880}\x{5881}\x{5882}\x{5883}\x{5884}\x{5885}\x{5886}\x{5887}' + . '\x{5888}\x{5889}\x{588A}\x{588B}\x{588C}\x{588D}\x{588E}\x{588F}\x{5890}' + . '\x{5891}\x{5892}\x{5893}\x{5894}\x{5896}\x{5897}\x{5898}\x{5899}\x{589A}' + . '\x{589B}\x{589C}\x{589D}\x{589E}\x{589F}\x{58A0}\x{58A1}\x{58A2}\x{58A3}' + . '\x{58A4}\x{58A5}\x{58A6}\x{58A7}\x{58A8}\x{58A9}\x{58AB}\x{58AC}\x{58AD}' + . '\x{58AE}\x{58AF}\x{58B0}\x{58B1}\x{58B2}\x{58B3}\x{58B4}\x{58B7}\x{58B8}' + . '\x{58B9}\x{58BA}\x{58BB}\x{58BC}\x{58BD}\x{58BE}\x{58BF}\x{58C1}\x{58C2}' + . '\x{58C5}\x{58C6}\x{58C7}\x{58C8}\x{58C9}\x{58CA}\x{58CB}\x{58CE}\x{58CF}' + . '\x{58D1}\x{58D2}\x{58D3}\x{58D4}\x{58D5}\x{58D6}\x{58D7}\x{58D8}\x{58D9}' + . '\x{58DA}\x{58DB}\x{58DD}\x{58DE}\x{58DF}\x{58E0}\x{58E2}\x{58E3}\x{58E4}' + . '\x{58E5}\x{58E7}\x{58E8}\x{58E9}\x{58EA}\x{58EB}\x{58EC}\x{58ED}\x{58EE}' + . '\x{58EF}\x{58F0}\x{58F1}\x{58F2}\x{58F3}\x{58F4}\x{58F6}\x{58F7}\x{58F8}' + . '\x{58F9}\x{58FA}\x{58FB}\x{58FC}\x{58FD}\x{58FE}\x{58FF}\x{5900}\x{5902}' + . '\x{5903}\x{5904}\x{5906}\x{5907}\x{5909}\x{590A}\x{590B}\x{590C}\x{590D}' + . '\x{590E}\x{590F}\x{5910}\x{5912}\x{5914}\x{5915}\x{5916}\x{5917}\x{5918}' + . '\x{5919}\x{591A}\x{591B}\x{591C}\x{591D}\x{591E}\x{591F}\x{5920}\x{5921}' + . '\x{5922}\x{5924}\x{5925}\x{5926}\x{5927}\x{5928}\x{5929}\x{592A}\x{592B}' + . '\x{592C}\x{592D}\x{592E}\x{592F}\x{5930}\x{5931}\x{5932}\x{5934}\x{5935}' + . '\x{5937}\x{5938}\x{5939}\x{593A}\x{593B}\x{593C}\x{593D}\x{593E}\x{593F}' + . '\x{5940}\x{5941}\x{5942}\x{5943}\x{5944}\x{5945}\x{5946}\x{5947}\x{5948}' + . '\x{5949}\x{594A}\x{594B}\x{594C}\x{594D}\x{594E}\x{594F}\x{5950}\x{5951}' + . '\x{5952}\x{5953}\x{5954}\x{5955}\x{5956}\x{5957}\x{5958}\x{595A}\x{595C}' + . '\x{595D}\x{595E}\x{595F}\x{5960}\x{5961}\x{5962}\x{5963}\x{5964}\x{5965}' + . '\x{5966}\x{5967}\x{5968}\x{5969}\x{596A}\x{596B}\x{596C}\x{596D}\x{596E}' + . '\x{596F}\x{5970}\x{5971}\x{5972}\x{5973}\x{5974}\x{5975}\x{5976}\x{5977}' + . '\x{5978}\x{5979}\x{597A}\x{597B}\x{597C}\x{597D}\x{597E}\x{597F}\x{5980}' + . '\x{5981}\x{5982}\x{5983}\x{5984}\x{5985}\x{5986}\x{5987}\x{5988}\x{5989}' + . '\x{598A}\x{598B}\x{598C}\x{598D}\x{598E}\x{598F}\x{5990}\x{5991}\x{5992}' + . '\x{5993}\x{5994}\x{5995}\x{5996}\x{5997}\x{5998}\x{5999}\x{599A}\x{599C}' + . '\x{599D}\x{599E}\x{599F}\x{59A0}\x{59A1}\x{59A2}\x{59A3}\x{59A4}\x{59A5}' + . '\x{59A6}\x{59A7}\x{59A8}\x{59A9}\x{59AA}\x{59AB}\x{59AC}\x{59AD}\x{59AE}' + . '\x{59AF}\x{59B0}\x{59B1}\x{59B2}\x{59B3}\x{59B4}\x{59B5}\x{59B6}\x{59B8}' + . '\x{59B9}\x{59BA}\x{59BB}\x{59BC}\x{59BD}\x{59BE}\x{59BF}\x{59C0}\x{59C1}' + . '\x{59C2}\x{59C3}\x{59C4}\x{59C5}\x{59C6}\x{59C7}\x{59C8}\x{59C9}\x{59CA}' + . '\x{59CB}\x{59CC}\x{59CD}\x{59CE}\x{59CF}\x{59D0}\x{59D1}\x{59D2}\x{59D3}' + . '\x{59D4}\x{59D5}\x{59D6}\x{59D7}\x{59D8}\x{59D9}\x{59DA}\x{59DB}\x{59DC}' + . '\x{59DD}\x{59DE}\x{59DF}\x{59E0}\x{59E1}\x{59E2}\x{59E3}\x{59E4}\x{59E5}' + . '\x{59E6}\x{59E8}\x{59E9}\x{59EA}\x{59EB}\x{59EC}\x{59ED}\x{59EE}\x{59EF}' + . '\x{59F0}\x{59F1}\x{59F2}\x{59F3}\x{59F4}\x{59F5}\x{59F6}\x{59F7}\x{59F8}' + . '\x{59F9}\x{59FA}\x{59FB}\x{59FC}\x{59FD}\x{59FE}\x{59FF}\x{5A00}\x{5A01}' + . '\x{5A02}\x{5A03}\x{5A04}\x{5A05}\x{5A06}\x{5A07}\x{5A08}\x{5A09}\x{5A0A}' + . '\x{5A0B}\x{5A0C}\x{5A0D}\x{5A0E}\x{5A0F}\x{5A10}\x{5A11}\x{5A12}\x{5A13}' + . '\x{5A14}\x{5A15}\x{5A16}\x{5A17}\x{5A18}\x{5A19}\x{5A1A}\x{5A1B}\x{5A1C}' + . '\x{5A1D}\x{5A1E}\x{5A1F}\x{5A20}\x{5A21}\x{5A22}\x{5A23}\x{5A25}\x{5A27}' + . '\x{5A28}\x{5A29}\x{5A2A}\x{5A2B}\x{5A2D}\x{5A2E}\x{5A2F}\x{5A31}\x{5A32}' + . '\x{5A33}\x{5A34}\x{5A35}\x{5A36}\x{5A37}\x{5A38}\x{5A39}\x{5A3A}\x{5A3B}' + . '\x{5A3C}\x{5A3D}\x{5A3E}\x{5A3F}\x{5A40}\x{5A41}\x{5A42}\x{5A43}\x{5A44}' + . '\x{5A45}\x{5A46}\x{5A47}\x{5A48}\x{5A49}\x{5A4A}\x{5A4B}\x{5A4C}\x{5A4D}' + . '\x{5A4E}\x{5A4F}\x{5A50}\x{5A51}\x{5A52}\x{5A53}\x{5A55}\x{5A56}\x{5A57}' + . '\x{5A58}\x{5A5A}\x{5A5B}\x{5A5C}\x{5A5D}\x{5A5E}\x{5A5F}\x{5A60}\x{5A61}' + . '\x{5A62}\x{5A63}\x{5A64}\x{5A65}\x{5A66}\x{5A67}\x{5A68}\x{5A69}\x{5A6A}' + . '\x{5A6B}\x{5A6C}\x{5A6D}\x{5A6E}\x{5A70}\x{5A72}\x{5A73}\x{5A74}\x{5A75}' + . '\x{5A76}\x{5A77}\x{5A78}\x{5A79}\x{5A7A}\x{5A7B}\x{5A7C}\x{5A7D}\x{5A7E}' + . '\x{5A7F}\x{5A80}\x{5A81}\x{5A82}\x{5A83}\x{5A84}\x{5A85}\x{5A86}\x{5A88}' + . '\x{5A89}\x{5A8A}\x{5A8B}\x{5A8C}\x{5A8E}\x{5A8F}\x{5A90}\x{5A91}\x{5A92}' + . '\x{5A93}\x{5A94}\x{5A95}\x{5A96}\x{5A97}\x{5A98}\x{5A99}\x{5A9A}\x{5A9B}' + . '\x{5A9C}\x{5A9D}\x{5A9E}\x{5A9F}\x{5AA0}\x{5AA1}\x{5AA2}\x{5AA3}\x{5AA4}' + . '\x{5AA5}\x{5AA6}\x{5AA7}\x{5AA8}\x{5AA9}\x{5AAA}\x{5AAC}\x{5AAD}\x{5AAE}' + . '\x{5AAF}\x{5AB0}\x{5AB1}\x{5AB2}\x{5AB3}\x{5AB4}\x{5AB5}\x{5AB6}\x{5AB7}' + . '\x{5AB8}\x{5AB9}\x{5ABA}\x{5ABB}\x{5ABC}\x{5ABD}\x{5ABE}\x{5ABF}\x{5AC0}' + . '\x{5AC1}\x{5AC2}\x{5AC3}\x{5AC4}\x{5AC5}\x{5AC6}\x{5AC7}\x{5AC8}\x{5AC9}' + . '\x{5ACA}\x{5ACB}\x{5ACC}\x{5ACD}\x{5ACE}\x{5ACF}\x{5AD1}\x{5AD2}\x{5AD4}' + . '\x{5AD5}\x{5AD6}\x{5AD7}\x{5AD8}\x{5AD9}\x{5ADA}\x{5ADB}\x{5ADC}\x{5ADD}' + . '\x{5ADE}\x{5ADF}\x{5AE0}\x{5AE1}\x{5AE2}\x{5AE3}\x{5AE4}\x{5AE5}\x{5AE6}' + . '\x{5AE7}\x{5AE8}\x{5AE9}\x{5AEA}\x{5AEB}\x{5AEC}\x{5AED}\x{5AEE}\x{5AF1}' + . '\x{5AF2}\x{5AF3}\x{5AF4}\x{5AF5}\x{5AF6}\x{5AF7}\x{5AF8}\x{5AF9}\x{5AFA}' + . '\x{5AFB}\x{5AFC}\x{5AFD}\x{5AFE}\x{5AFF}\x{5B00}\x{5B01}\x{5B02}\x{5B03}' + . '\x{5B04}\x{5B05}\x{5B06}\x{5B07}\x{5B08}\x{5B09}\x{5B0B}\x{5B0C}\x{5B0E}' + . '\x{5B0F}\x{5B10}\x{5B11}\x{5B12}\x{5B13}\x{5B14}\x{5B15}\x{5B16}\x{5B17}' + . '\x{5B18}\x{5B19}\x{5B1A}\x{5B1B}\x{5B1C}\x{5B1D}\x{5B1E}\x{5B1F}\x{5B20}' + . '\x{5B21}\x{5B22}\x{5B23}\x{5B24}\x{5B25}\x{5B26}\x{5B27}\x{5B28}\x{5B29}' + . '\x{5B2A}\x{5B2B}\x{5B2C}\x{5B2D}\x{5B2E}\x{5B2F}\x{5B30}\x{5B31}\x{5B32}' + . '\x{5B33}\x{5B34}\x{5B35}\x{5B36}\x{5B37}\x{5B38}\x{5B3A}\x{5B3B}\x{5B3C}' + . '\x{5B3D}\x{5B3E}\x{5B3F}\x{5B40}\x{5B41}\x{5B42}\x{5B43}\x{5B44}\x{5B45}' + . '\x{5B47}\x{5B48}\x{5B49}\x{5B4A}\x{5B4B}\x{5B4C}\x{5B4D}\x{5B4E}\x{5B50}' + . '\x{5B51}\x{5B53}\x{5B54}\x{5B55}\x{5B56}\x{5B57}\x{5B58}\x{5B59}\x{5B5A}' + . '\x{5B5B}\x{5B5C}\x{5B5D}\x{5B5E}\x{5B5F}\x{5B62}\x{5B63}\x{5B64}\x{5B65}' + . '\x{5B66}\x{5B67}\x{5B68}\x{5B69}\x{5B6A}\x{5B6B}\x{5B6C}\x{5B6D}\x{5B6E}' + . '\x{5B70}\x{5B71}\x{5B72}\x{5B73}\x{5B74}\x{5B75}\x{5B76}\x{5B77}\x{5B78}' + . '\x{5B7A}\x{5B7B}\x{5B7C}\x{5B7D}\x{5B7F}\x{5B80}\x{5B81}\x{5B82}\x{5B83}' + . '\x{5B84}\x{5B85}\x{5B87}\x{5B88}\x{5B89}\x{5B8A}\x{5B8B}\x{5B8C}\x{5B8D}' + . '\x{5B8E}\x{5B8F}\x{5B91}\x{5B92}\x{5B93}\x{5B94}\x{5B95}\x{5B96}\x{5B97}' + . '\x{5B98}\x{5B99}\x{5B9A}\x{5B9B}\x{5B9C}\x{5B9D}\x{5B9E}\x{5B9F}\x{5BA0}' + . '\x{5BA1}\x{5BA2}\x{5BA3}\x{5BA4}\x{5BA5}\x{5BA6}\x{5BA7}\x{5BA8}\x{5BAA}' + . '\x{5BAB}\x{5BAC}\x{5BAD}\x{5BAE}\x{5BAF}\x{5BB0}\x{5BB1}\x{5BB3}\x{5BB4}' + . '\x{5BB5}\x{5BB6}\x{5BB8}\x{5BB9}\x{5BBA}\x{5BBB}\x{5BBD}\x{5BBE}\x{5BBF}' + . '\x{5BC0}\x{5BC1}\x{5BC2}\x{5BC3}\x{5BC4}\x{5BC5}\x{5BC6}\x{5BC7}\x{5BCA}' + . '\x{5BCB}\x{5BCC}\x{5BCD}\x{5BCE}\x{5BCF}\x{5BD0}\x{5BD1}\x{5BD2}\x{5BD3}' + . '\x{5BD4}\x{5BD5}\x{5BD6}\x{5BD8}\x{5BD9}\x{5BDB}\x{5BDC}\x{5BDD}\x{5BDE}' + . '\x{5BDF}\x{5BE0}\x{5BE1}\x{5BE2}\x{5BE3}\x{5BE4}\x{5BE5}\x{5BE6}\x{5BE7}' + . '\x{5BE8}\x{5BE9}\x{5BEA}\x{5BEB}\x{5BEC}\x{5BED}\x{5BEE}\x{5BEF}\x{5BF0}' + . '\x{5BF1}\x{5BF2}\x{5BF3}\x{5BF4}\x{5BF5}\x{5BF6}\x{5BF7}\x{5BF8}\x{5BF9}' + . '\x{5BFA}\x{5BFB}\x{5BFC}\x{5BFD}\x{5BFF}\x{5C01}\x{5C03}\x{5C04}\x{5C05}' + . '\x{5C06}\x{5C07}\x{5C08}\x{5C09}\x{5C0A}\x{5C0B}\x{5C0C}\x{5C0D}\x{5C0E}' + . '\x{5C0F}\x{5C10}\x{5C11}\x{5C12}\x{5C13}\x{5C14}\x{5C15}\x{5C16}\x{5C17}' + . '\x{5C18}\x{5C19}\x{5C1A}\x{5C1C}\x{5C1D}\x{5C1E}\x{5C1F}\x{5C20}\x{5C21}' + . '\x{5C22}\x{5C24}\x{5C25}\x{5C27}\x{5C28}\x{5C2A}\x{5C2B}\x{5C2C}\x{5C2D}' + . '\x{5C2E}\x{5C2F}\x{5C30}\x{5C31}\x{5C32}\x{5C33}\x{5C34}\x{5C35}\x{5C37}' + . '\x{5C38}\x{5C39}\x{5C3A}\x{5C3B}\x{5C3C}\x{5C3D}\x{5C3E}\x{5C3F}\x{5C40}' + . '\x{5C41}\x{5C42}\x{5C43}\x{5C44}\x{5C45}\x{5C46}\x{5C47}\x{5C48}\x{5C49}' + . '\x{5C4A}\x{5C4B}\x{5C4C}\x{5C4D}\x{5C4E}\x{5C4F}\x{5C50}\x{5C51}\x{5C52}' + . '\x{5C53}\x{5C54}\x{5C55}\x{5C56}\x{5C57}\x{5C58}\x{5C59}\x{5C5B}\x{5C5C}' + . '\x{5C5D}\x{5C5E}\x{5C5F}\x{5C60}\x{5C61}\x{5C62}\x{5C63}\x{5C64}\x{5C65}' + . '\x{5C66}\x{5C67}\x{5C68}\x{5C69}\x{5C6A}\x{5C6B}\x{5C6C}\x{5C6D}\x{5C6E}' + . '\x{5C6F}\x{5C70}\x{5C71}\x{5C72}\x{5C73}\x{5C74}\x{5C75}\x{5C76}\x{5C77}' + . '\x{5C78}\x{5C79}\x{5C7A}\x{5C7B}\x{5C7C}\x{5C7D}\x{5C7E}\x{5C7F}\x{5C80}' + . '\x{5C81}\x{5C82}\x{5C83}\x{5C84}\x{5C86}\x{5C87}\x{5C88}\x{5C89}\x{5C8A}' + . '\x{5C8B}\x{5C8C}\x{5C8D}\x{5C8E}\x{5C8F}\x{5C90}\x{5C91}\x{5C92}\x{5C93}' + . '\x{5C94}\x{5C95}\x{5C96}\x{5C97}\x{5C98}\x{5C99}\x{5C9A}\x{5C9B}\x{5C9C}' + . '\x{5C9D}\x{5C9E}\x{5C9F}\x{5CA0}\x{5CA1}\x{5CA2}\x{5CA3}\x{5CA4}\x{5CA5}' + . '\x{5CA6}\x{5CA7}\x{5CA8}\x{5CA9}\x{5CAA}\x{5CAB}\x{5CAC}\x{5CAD}\x{5CAE}' + . '\x{5CAF}\x{5CB0}\x{5CB1}\x{5CB2}\x{5CB3}\x{5CB5}\x{5CB6}\x{5CB7}\x{5CB8}' + . '\x{5CBA}\x{5CBB}\x{5CBC}\x{5CBD}\x{5CBE}\x{5CBF}\x{5CC1}\x{5CC2}\x{5CC3}' + . '\x{5CC4}\x{5CC5}\x{5CC6}\x{5CC7}\x{5CC8}\x{5CC9}\x{5CCA}\x{5CCB}\x{5CCC}' + . '\x{5CCD}\x{5CCE}\x{5CCF}\x{5CD0}\x{5CD1}\x{5CD2}\x{5CD3}\x{5CD4}\x{5CD6}' + . '\x{5CD7}\x{5CD8}\x{5CD9}\x{5CDA}\x{5CDB}\x{5CDC}\x{5CDE}\x{5CDF}\x{5CE0}' + . '\x{5CE1}\x{5CE2}\x{5CE3}\x{5CE4}\x{5CE5}\x{5CE6}\x{5CE7}\x{5CE8}\x{5CE9}' + . '\x{5CEA}\x{5CEB}\x{5CEC}\x{5CED}\x{5CEE}\x{5CEF}\x{5CF0}\x{5CF1}\x{5CF2}' + . '\x{5CF3}\x{5CF4}\x{5CF6}\x{5CF7}\x{5CF8}\x{5CF9}\x{5CFA}\x{5CFB}\x{5CFC}' + . '\x{5CFD}\x{5CFE}\x{5CFF}\x{5D00}\x{5D01}\x{5D02}\x{5D03}\x{5D04}\x{5D05}' + . '\x{5D06}\x{5D07}\x{5D08}\x{5D09}\x{5D0A}\x{5D0B}\x{5D0C}\x{5D0D}\x{5D0E}' + . '\x{5D0F}\x{5D10}\x{5D11}\x{5D12}\x{5D13}\x{5D14}\x{5D15}\x{5D16}\x{5D17}' + . '\x{5D18}\x{5D19}\x{5D1A}\x{5D1B}\x{5D1C}\x{5D1D}\x{5D1E}\x{5D1F}\x{5D20}' + . '\x{5D21}\x{5D22}\x{5D23}\x{5D24}\x{5D25}\x{5D26}\x{5D27}\x{5D28}\x{5D29}' + . '\x{5D2A}\x{5D2C}\x{5D2D}\x{5D2E}\x{5D30}\x{5D31}\x{5D32}\x{5D33}\x{5D34}' + . '\x{5D35}\x{5D36}\x{5D37}\x{5D38}\x{5D39}\x{5D3A}\x{5D3C}\x{5D3D}\x{5D3E}' + . '\x{5D3F}\x{5D40}\x{5D41}\x{5D42}\x{5D43}\x{5D44}\x{5D45}\x{5D46}\x{5D47}' + . '\x{5D48}\x{5D49}\x{5D4A}\x{5D4B}\x{5D4C}\x{5D4D}\x{5D4E}\x{5D4F}\x{5D50}' + . '\x{5D51}\x{5D52}\x{5D54}\x{5D55}\x{5D56}\x{5D58}\x{5D59}\x{5D5A}\x{5D5B}' + . '\x{5D5D}\x{5D5E}\x{5D5F}\x{5D61}\x{5D62}\x{5D63}\x{5D64}\x{5D65}\x{5D66}' + . '\x{5D67}\x{5D68}\x{5D69}\x{5D6A}\x{5D6B}\x{5D6C}\x{5D6D}\x{5D6E}\x{5D6F}' + . '\x{5D70}\x{5D71}\x{5D72}\x{5D73}\x{5D74}\x{5D75}\x{5D76}\x{5D77}\x{5D78}' + . '\x{5D79}\x{5D7A}\x{5D7B}\x{5D7C}\x{5D7D}\x{5D7E}\x{5D7F}\x{5D80}\x{5D81}' + . '\x{5D82}\x{5D84}\x{5D85}\x{5D86}\x{5D87}\x{5D88}\x{5D89}\x{5D8A}\x{5D8B}' + . '\x{5D8C}\x{5D8D}\x{5D8E}\x{5D8F}\x{5D90}\x{5D91}\x{5D92}\x{5D93}\x{5D94}' + . '\x{5D95}\x{5D97}\x{5D98}\x{5D99}\x{5D9A}\x{5D9B}\x{5D9C}\x{5D9D}\x{5D9E}' + . '\x{5D9F}\x{5DA0}\x{5DA1}\x{5DA2}\x{5DA5}\x{5DA6}\x{5DA7}\x{5DA8}\x{5DA9}' + . '\x{5DAA}\x{5DAC}\x{5DAD}\x{5DAE}\x{5DAF}\x{5DB0}\x{5DB1}\x{5DB2}\x{5DB4}' + . '\x{5DB5}\x{5DB6}\x{5DB7}\x{5DB8}\x{5DBA}\x{5DBB}\x{5DBC}\x{5DBD}\x{5DBE}' + . '\x{5DBF}\x{5DC0}\x{5DC1}\x{5DC2}\x{5DC3}\x{5DC5}\x{5DC6}\x{5DC7}\x{5DC8}' + . '\x{5DC9}\x{5DCA}\x{5DCB}\x{5DCC}\x{5DCD}\x{5DCE}\x{5DCF}\x{5DD0}\x{5DD1}' + . '\x{5DD2}\x{5DD3}\x{5DD4}\x{5DD5}\x{5DD6}\x{5DD8}\x{5DD9}\x{5DDB}\x{5DDD}' + . '\x{5DDE}\x{5DDF}\x{5DE0}\x{5DE1}\x{5DE2}\x{5DE3}\x{5DE4}\x{5DE5}\x{5DE6}' + . '\x{5DE7}\x{5DE8}\x{5DE9}\x{5DEA}\x{5DEB}\x{5DEC}\x{5DED}\x{5DEE}\x{5DEF}' + . '\x{5DF0}\x{5DF1}\x{5DF2}\x{5DF3}\x{5DF4}\x{5DF5}\x{5DF7}\x{5DF8}\x{5DF9}' + . '\x{5DFA}\x{5DFB}\x{5DFC}\x{5DFD}\x{5DFE}\x{5DFF}\x{5E00}\x{5E01}\x{5E02}' + . '\x{5E03}\x{5E04}\x{5E05}\x{5E06}\x{5E07}\x{5E08}\x{5E09}\x{5E0A}\x{5E0B}' + . '\x{5E0C}\x{5E0D}\x{5E0E}\x{5E0F}\x{5E10}\x{5E11}\x{5E13}\x{5E14}\x{5E15}' + . '\x{5E16}\x{5E17}\x{5E18}\x{5E19}\x{5E1A}\x{5E1B}\x{5E1C}\x{5E1D}\x{5E1E}' + . '\x{5E1F}\x{5E20}\x{5E21}\x{5E22}\x{5E23}\x{5E24}\x{5E25}\x{5E26}\x{5E27}' + . '\x{5E28}\x{5E29}\x{5E2A}\x{5E2B}\x{5E2C}\x{5E2D}\x{5E2E}\x{5E2F}\x{5E30}' + . '\x{5E31}\x{5E32}\x{5E33}\x{5E34}\x{5E35}\x{5E36}\x{5E37}\x{5E38}\x{5E39}' + . '\x{5E3A}\x{5E3B}\x{5E3C}\x{5E3D}\x{5E3E}\x{5E40}\x{5E41}\x{5E42}\x{5E43}' + . '\x{5E44}\x{5E45}\x{5E46}\x{5E47}\x{5E49}\x{5E4A}\x{5E4B}\x{5E4C}\x{5E4D}' + . '\x{5E4E}\x{5E4F}\x{5E50}\x{5E52}\x{5E53}\x{5E54}\x{5E55}\x{5E56}\x{5E57}' + . '\x{5E58}\x{5E59}\x{5E5A}\x{5E5B}\x{5E5C}\x{5E5D}\x{5E5E}\x{5E5F}\x{5E60}' + . '\x{5E61}\x{5E62}\x{5E63}\x{5E64}\x{5E65}\x{5E66}\x{5E67}\x{5E68}\x{5E69}' + . '\x{5E6A}\x{5E6B}\x{5E6C}\x{5E6D}\x{5E6E}\x{5E6F}\x{5E70}\x{5E71}\x{5E72}' + . '\x{5E73}\x{5E74}\x{5E75}\x{5E76}\x{5E77}\x{5E78}\x{5E79}\x{5E7A}\x{5E7B}' + . '\x{5E7C}\x{5E7D}\x{5E7E}\x{5E7F}\x{5E80}\x{5E81}\x{5E82}\x{5E83}\x{5E84}' + . '\x{5E85}\x{5E86}\x{5E87}\x{5E88}\x{5E89}\x{5E8A}\x{5E8B}\x{5E8C}\x{5E8D}' + . '\x{5E8E}\x{5E8F}\x{5E90}\x{5E91}\x{5E93}\x{5E94}\x{5E95}\x{5E96}\x{5E97}' + . '\x{5E98}\x{5E99}\x{5E9A}\x{5E9B}\x{5E9C}\x{5E9D}\x{5E9E}\x{5E9F}\x{5EA0}' + . '\x{5EA1}\x{5EA2}\x{5EA3}\x{5EA4}\x{5EA5}\x{5EA6}\x{5EA7}\x{5EA8}\x{5EA9}' + . '\x{5EAA}\x{5EAB}\x{5EAC}\x{5EAD}\x{5EAE}\x{5EAF}\x{5EB0}\x{5EB1}\x{5EB2}' + . '\x{5EB3}\x{5EB4}\x{5EB5}\x{5EB6}\x{5EB7}\x{5EB8}\x{5EB9}\x{5EBB}\x{5EBC}' + . '\x{5EBD}\x{5EBE}\x{5EBF}\x{5EC1}\x{5EC2}\x{5EC3}\x{5EC4}\x{5EC5}\x{5EC6}' + . '\x{5EC7}\x{5EC8}\x{5EC9}\x{5ECA}\x{5ECB}\x{5ECC}\x{5ECD}\x{5ECE}\x{5ECF}' + . '\x{5ED0}\x{5ED1}\x{5ED2}\x{5ED3}\x{5ED4}\x{5ED5}\x{5ED6}\x{5ED7}\x{5ED8}' + . '\x{5ED9}\x{5EDA}\x{5EDB}\x{5EDC}\x{5EDD}\x{5EDE}\x{5EDF}\x{5EE0}\x{5EE1}' + . '\x{5EE2}\x{5EE3}\x{5EE4}\x{5EE5}\x{5EE6}\x{5EE7}\x{5EE8}\x{5EE9}\x{5EEA}' + . '\x{5EEC}\x{5EED}\x{5EEE}\x{5EEF}\x{5EF0}\x{5EF1}\x{5EF2}\x{5EF3}\x{5EF4}' + . '\x{5EF5}\x{5EF6}\x{5EF7}\x{5EF8}\x{5EFA}\x{5EFB}\x{5EFC}\x{5EFD}\x{5EFE}' + . '\x{5EFF}\x{5F00}\x{5F01}\x{5F02}\x{5F03}\x{5F04}\x{5F05}\x{5F06}\x{5F07}' + . '\x{5F08}\x{5F0A}\x{5F0B}\x{5F0C}\x{5F0D}\x{5F0F}\x{5F11}\x{5F12}\x{5F13}' + . '\x{5F14}\x{5F15}\x{5F16}\x{5F17}\x{5F18}\x{5F19}\x{5F1A}\x{5F1B}\x{5F1C}' + . '\x{5F1D}\x{5F1E}\x{5F1F}\x{5F20}\x{5F21}\x{5F22}\x{5F23}\x{5F24}\x{5F25}' + . '\x{5F26}\x{5F27}\x{5F28}\x{5F29}\x{5F2A}\x{5F2B}\x{5F2C}\x{5F2D}\x{5F2E}' + . '\x{5F2F}\x{5F30}\x{5F31}\x{5F32}\x{5F33}\x{5F34}\x{5F35}\x{5F36}\x{5F37}' + . '\x{5F38}\x{5F39}\x{5F3A}\x{5F3C}\x{5F3E}\x{5F3F}\x{5F40}\x{5F41}\x{5F42}' + . '\x{5F43}\x{5F44}\x{5F45}\x{5F46}\x{5F47}\x{5F48}\x{5F49}\x{5F4A}\x{5F4B}' + . '\x{5F4C}\x{5F4D}\x{5F4E}\x{5F4F}\x{5F50}\x{5F51}\x{5F52}\x{5F53}\x{5F54}' + . '\x{5F55}\x{5F56}\x{5F57}\x{5F58}\x{5F59}\x{5F5A}\x{5F5B}\x{5F5C}\x{5F5D}' + . '\x{5F5E}\x{5F5F}\x{5F60}\x{5F61}\x{5F62}\x{5F63}\x{5F64}\x{5F65}\x{5F66}' + . '\x{5F67}\x{5F68}\x{5F69}\x{5F6A}\x{5F6B}\x{5F6C}\x{5F6D}\x{5F6E}\x{5F6F}' + . '\x{5F70}\x{5F71}\x{5F72}\x{5F73}\x{5F74}\x{5F75}\x{5F76}\x{5F77}\x{5F78}' + . '\x{5F79}\x{5F7A}\x{5F7B}\x{5F7C}\x{5F7D}\x{5F7E}\x{5F7F}\x{5F80}\x{5F81}' + . '\x{5F82}\x{5F83}\x{5F84}\x{5F85}\x{5F86}\x{5F87}\x{5F88}\x{5F89}\x{5F8A}' + . '\x{5F8B}\x{5F8C}\x{5F8D}\x{5F8E}\x{5F90}\x{5F91}\x{5F92}\x{5F93}\x{5F94}' + . '\x{5F95}\x{5F96}\x{5F97}\x{5F98}\x{5F99}\x{5F9B}\x{5F9C}\x{5F9D}\x{5F9E}' + . '\x{5F9F}\x{5FA0}\x{5FA1}\x{5FA2}\x{5FA5}\x{5FA6}\x{5FA7}\x{5FA8}\x{5FA9}' + . '\x{5FAA}\x{5FAB}\x{5FAC}\x{5FAD}\x{5FAE}\x{5FAF}\x{5FB1}\x{5FB2}\x{5FB3}' + . '\x{5FB4}\x{5FB5}\x{5FB6}\x{5FB7}\x{5FB8}\x{5FB9}\x{5FBA}\x{5FBB}\x{5FBC}' + . '\x{5FBD}\x{5FBE}\x{5FBF}\x{5FC0}\x{5FC1}\x{5FC3}\x{5FC4}\x{5FC5}\x{5FC6}' + . '\x{5FC7}\x{5FC8}\x{5FC9}\x{5FCA}\x{5FCB}\x{5FCC}\x{5FCD}\x{5FCF}\x{5FD0}' + . '\x{5FD1}\x{5FD2}\x{5FD3}\x{5FD4}\x{5FD5}\x{5FD6}\x{5FD7}\x{5FD8}\x{5FD9}' + . '\x{5FDA}\x{5FDC}\x{5FDD}\x{5FDE}\x{5FE0}\x{5FE1}\x{5FE3}\x{5FE4}\x{5FE5}' + . '\x{5FE6}\x{5FE7}\x{5FE8}\x{5FE9}\x{5FEA}\x{5FEB}\x{5FED}\x{5FEE}\x{5FEF}' + . '\x{5FF0}\x{5FF1}\x{5FF2}\x{5FF3}\x{5FF4}\x{5FF5}\x{5FF6}\x{5FF7}\x{5FF8}' + . '\x{5FF9}\x{5FFA}\x{5FFB}\x{5FFD}\x{5FFE}\x{5FFF}\x{6000}\x{6001}\x{6002}' + . '\x{6003}\x{6004}\x{6005}\x{6006}\x{6007}\x{6008}\x{6009}\x{600A}\x{600B}' + . '\x{600C}\x{600D}\x{600E}\x{600F}\x{6010}\x{6011}\x{6012}\x{6013}\x{6014}' + . '\x{6015}\x{6016}\x{6017}\x{6018}\x{6019}\x{601A}\x{601B}\x{601C}\x{601D}' + . '\x{601E}\x{601F}\x{6020}\x{6021}\x{6022}\x{6024}\x{6025}\x{6026}\x{6027}' + . '\x{6028}\x{6029}\x{602A}\x{602B}\x{602C}\x{602D}\x{602E}\x{602F}\x{6030}' + . '\x{6031}\x{6032}\x{6033}\x{6034}\x{6035}\x{6036}\x{6037}\x{6038}\x{6039}' + . '\x{603A}\x{603B}\x{603C}\x{603D}\x{603E}\x{603F}\x{6040}\x{6041}\x{6042}' + . '\x{6043}\x{6044}\x{6045}\x{6046}\x{6047}\x{6048}\x{6049}\x{604A}\x{604B}' + . '\x{604C}\x{604D}\x{604E}\x{604F}\x{6050}\x{6051}\x{6052}\x{6053}\x{6054}' + . '\x{6055}\x{6057}\x{6058}\x{6059}\x{605A}\x{605B}\x{605C}\x{605D}\x{605E}' + . '\x{605F}\x{6062}\x{6063}\x{6064}\x{6065}\x{6066}\x{6067}\x{6068}\x{6069}' + . '\x{606A}\x{606B}\x{606C}\x{606D}\x{606E}\x{606F}\x{6070}\x{6072}\x{6073}' + . '\x{6075}\x{6076}\x{6077}\x{6078}\x{6079}\x{607A}\x{607B}\x{607C}\x{607D}' + . '\x{607E}\x{607F}\x{6080}\x{6081}\x{6082}\x{6083}\x{6084}\x{6085}\x{6086}' + . '\x{6087}\x{6088}\x{6089}\x{608A}\x{608B}\x{608C}\x{608D}\x{608E}\x{608F}' + . '\x{6090}\x{6092}\x{6094}\x{6095}\x{6096}\x{6097}\x{6098}\x{6099}\x{609A}' + . '\x{609B}\x{609C}\x{609D}\x{609E}\x{609F}\x{60A0}\x{60A1}\x{60A2}\x{60A3}' + . '\x{60A4}\x{60A6}\x{60A7}\x{60A8}\x{60AA}\x{60AB}\x{60AC}\x{60AD}\x{60AE}' + . '\x{60AF}\x{60B0}\x{60B1}\x{60B2}\x{60B3}\x{60B4}\x{60B5}\x{60B6}\x{60B7}' + . '\x{60B8}\x{60B9}\x{60BA}\x{60BB}\x{60BC}\x{60BD}\x{60BE}\x{60BF}\x{60C0}' + . '\x{60C1}\x{60C2}\x{60C3}\x{60C4}\x{60C5}\x{60C6}\x{60C7}\x{60C8}\x{60C9}' + . '\x{60CA}\x{60CB}\x{60CC}\x{60CD}\x{60CE}\x{60CF}\x{60D0}\x{60D1}\x{60D3}' + . '\x{60D4}\x{60D5}\x{60D7}\x{60D8}\x{60D9}\x{60DA}\x{60DB}\x{60DC}\x{60DD}' + . '\x{60DF}\x{60E0}\x{60E1}\x{60E2}\x{60E4}\x{60E6}\x{60E7}\x{60E8}\x{60E9}' + . '\x{60EA}\x{60EB}\x{60EC}\x{60ED}\x{60EE}\x{60EF}\x{60F0}\x{60F1}\x{60F2}' + . '\x{60F3}\x{60F4}\x{60F5}\x{60F6}\x{60F7}\x{60F8}\x{60F9}\x{60FA}\x{60FB}' + . '\x{60FC}\x{60FE}\x{60FF}\x{6100}\x{6101}\x{6103}\x{6104}\x{6105}\x{6106}' + . '\x{6108}\x{6109}\x{610A}\x{610B}\x{610C}\x{610D}\x{610E}\x{610F}\x{6110}' + . '\x{6112}\x{6113}\x{6114}\x{6115}\x{6116}\x{6117}\x{6118}\x{6119}\x{611A}' + . '\x{611B}\x{611C}\x{611D}\x{611F}\x{6120}\x{6122}\x{6123}\x{6124}\x{6125}' + . '\x{6126}\x{6127}\x{6128}\x{6129}\x{612A}\x{612B}\x{612C}\x{612D}\x{612E}' + . '\x{612F}\x{6130}\x{6132}\x{6134}\x{6136}\x{6137}\x{613A}\x{613B}\x{613C}' + . '\x{613D}\x{613E}\x{613F}\x{6140}\x{6141}\x{6142}\x{6143}\x{6144}\x{6145}' + . '\x{6146}\x{6147}\x{6148}\x{6149}\x{614A}\x{614B}\x{614C}\x{614D}\x{614E}' + . '\x{614F}\x{6150}\x{6151}\x{6152}\x{6153}\x{6154}\x{6155}\x{6156}\x{6157}' + . '\x{6158}\x{6159}\x{615A}\x{615B}\x{615C}\x{615D}\x{615E}\x{615F}\x{6161}' + . '\x{6162}\x{6163}\x{6164}\x{6165}\x{6166}\x{6167}\x{6168}\x{6169}\x{616A}' + . '\x{616B}\x{616C}\x{616D}\x{616E}\x{6170}\x{6171}\x{6172}\x{6173}\x{6174}' + . '\x{6175}\x{6176}\x{6177}\x{6178}\x{6179}\x{617A}\x{617C}\x{617E}\x{6180}' + . '\x{6181}\x{6182}\x{6183}\x{6184}\x{6185}\x{6187}\x{6188}\x{6189}\x{618A}' + . '\x{618B}\x{618C}\x{618D}\x{618E}\x{618F}\x{6190}\x{6191}\x{6192}\x{6193}' + . '\x{6194}\x{6195}\x{6196}\x{6198}\x{6199}\x{619A}\x{619B}\x{619D}\x{619E}' + . '\x{619F}\x{61A0}\x{61A1}\x{61A2}\x{61A3}\x{61A4}\x{61A5}\x{61A6}\x{61A7}' + . '\x{61A8}\x{61A9}\x{61AA}\x{61AB}\x{61AC}\x{61AD}\x{61AE}\x{61AF}\x{61B0}' + . '\x{61B1}\x{61B2}\x{61B3}\x{61B4}\x{61B5}\x{61B6}\x{61B7}\x{61B8}\x{61BA}' + . '\x{61BC}\x{61BD}\x{61BE}\x{61BF}\x{61C0}\x{61C1}\x{61C2}\x{61C3}\x{61C4}' + . '\x{61C5}\x{61C6}\x{61C7}\x{61C8}\x{61C9}\x{61CA}\x{61CB}\x{61CC}\x{61CD}' + . '\x{61CE}\x{61CF}\x{61D0}\x{61D1}\x{61D2}\x{61D4}\x{61D6}\x{61D7}\x{61D8}' + . '\x{61D9}\x{61DA}\x{61DB}\x{61DC}\x{61DD}\x{61DE}\x{61DF}\x{61E0}\x{61E1}' + . '\x{61E2}\x{61E3}\x{61E4}\x{61E5}\x{61E6}\x{61E7}\x{61E8}\x{61E9}\x{61EA}' + . '\x{61EB}\x{61ED}\x{61EE}\x{61F0}\x{61F1}\x{61F2}\x{61F3}\x{61F5}\x{61F6}' + . '\x{61F7}\x{61F8}\x{61F9}\x{61FA}\x{61FB}\x{61FC}\x{61FD}\x{61FE}\x{61FF}' + . '\x{6200}\x{6201}\x{6202}\x{6203}\x{6204}\x{6206}\x{6207}\x{6208}\x{6209}' + . '\x{620A}\x{620B}\x{620C}\x{620D}\x{620E}\x{620F}\x{6210}\x{6211}\x{6212}' + . '\x{6213}\x{6214}\x{6215}\x{6216}\x{6217}\x{6218}\x{6219}\x{621A}\x{621B}' + . '\x{621C}\x{621D}\x{621E}\x{621F}\x{6220}\x{6221}\x{6222}\x{6223}\x{6224}' + . '\x{6225}\x{6226}\x{6227}\x{6228}\x{6229}\x{622A}\x{622B}\x{622C}\x{622D}' + . '\x{622E}\x{622F}\x{6230}\x{6231}\x{6232}\x{6233}\x{6234}\x{6236}\x{6237}' + . '\x{6238}\x{623A}\x{623B}\x{623C}\x{623D}\x{623E}\x{623F}\x{6240}\x{6241}' + . '\x{6242}\x{6243}\x{6244}\x{6245}\x{6246}\x{6247}\x{6248}\x{6249}\x{624A}' + . '\x{624B}\x{624C}\x{624D}\x{624E}\x{624F}\x{6250}\x{6251}\x{6252}\x{6253}' + . '\x{6254}\x{6255}\x{6256}\x{6258}\x{6259}\x{625A}\x{625B}\x{625C}\x{625D}' + . '\x{625E}\x{625F}\x{6260}\x{6261}\x{6262}\x{6263}\x{6264}\x{6265}\x{6266}' + . '\x{6267}\x{6268}\x{6269}\x{626A}\x{626B}\x{626C}\x{626D}\x{626E}\x{626F}' + . '\x{6270}\x{6271}\x{6272}\x{6273}\x{6274}\x{6275}\x{6276}\x{6277}\x{6278}' + . '\x{6279}\x{627A}\x{627B}\x{627C}\x{627D}\x{627E}\x{627F}\x{6280}\x{6281}' + . '\x{6283}\x{6284}\x{6285}\x{6286}\x{6287}\x{6288}\x{6289}\x{628A}\x{628B}' + . '\x{628C}\x{628E}\x{628F}\x{6290}\x{6291}\x{6292}\x{6293}\x{6294}\x{6295}' + . '\x{6296}\x{6297}\x{6298}\x{6299}\x{629A}\x{629B}\x{629C}\x{629E}\x{629F}' + . '\x{62A0}\x{62A1}\x{62A2}\x{62A3}\x{62A4}\x{62A5}\x{62A7}\x{62A8}\x{62A9}' + . '\x{62AA}\x{62AB}\x{62AC}\x{62AD}\x{62AE}\x{62AF}\x{62B0}\x{62B1}\x{62B2}' + . '\x{62B3}\x{62B4}\x{62B5}\x{62B6}\x{62B7}\x{62B8}\x{62B9}\x{62BA}\x{62BB}' + . '\x{62BC}\x{62BD}\x{62BE}\x{62BF}\x{62C0}\x{62C1}\x{62C2}\x{62C3}\x{62C4}' + . '\x{62C5}\x{62C6}\x{62C7}\x{62C8}\x{62C9}\x{62CA}\x{62CB}\x{62CC}\x{62CD}' + . '\x{62CE}\x{62CF}\x{62D0}\x{62D1}\x{62D2}\x{62D3}\x{62D4}\x{62D5}\x{62D6}' + . '\x{62D7}\x{62D8}\x{62D9}\x{62DA}\x{62DB}\x{62DC}\x{62DD}\x{62DF}\x{62E0}' + . '\x{62E1}\x{62E2}\x{62E3}\x{62E4}\x{62E5}\x{62E6}\x{62E7}\x{62E8}\x{62E9}' + . '\x{62EB}\x{62EC}\x{62ED}\x{62EE}\x{62EF}\x{62F0}\x{62F1}\x{62F2}\x{62F3}' + . '\x{62F4}\x{62F5}\x{62F6}\x{62F7}\x{62F8}\x{62F9}\x{62FA}\x{62FB}\x{62FC}' + . '\x{62FD}\x{62FE}\x{62FF}\x{6300}\x{6301}\x{6302}\x{6303}\x{6304}\x{6305}' + . '\x{6306}\x{6307}\x{6308}\x{6309}\x{630B}\x{630C}\x{630D}\x{630E}\x{630F}' + . '\x{6310}\x{6311}\x{6312}\x{6313}\x{6314}\x{6315}\x{6316}\x{6318}\x{6319}' + . '\x{631A}\x{631B}\x{631C}\x{631D}\x{631E}\x{631F}\x{6320}\x{6321}\x{6322}' + . '\x{6323}\x{6324}\x{6325}\x{6326}\x{6327}\x{6328}\x{6329}\x{632A}\x{632B}' + . '\x{632C}\x{632D}\x{632E}\x{632F}\x{6330}\x{6332}\x{6333}\x{6334}\x{6336}' + . '\x{6338}\x{6339}\x{633A}\x{633B}\x{633C}\x{633D}\x{633E}\x{6340}\x{6341}' + . '\x{6342}\x{6343}\x{6344}\x{6345}\x{6346}\x{6347}\x{6348}\x{6349}\x{634A}' + . '\x{634B}\x{634C}\x{634D}\x{634E}\x{634F}\x{6350}\x{6351}\x{6352}\x{6353}' + . '\x{6354}\x{6355}\x{6356}\x{6357}\x{6358}\x{6359}\x{635A}\x{635C}\x{635D}' + . '\x{635E}\x{635F}\x{6360}\x{6361}\x{6362}\x{6363}\x{6364}\x{6365}\x{6366}' + . '\x{6367}\x{6368}\x{6369}\x{636A}\x{636B}\x{636C}\x{636D}\x{636E}\x{636F}' + . '\x{6370}\x{6371}\x{6372}\x{6373}\x{6374}\x{6375}\x{6376}\x{6377}\x{6378}' + . '\x{6379}\x{637A}\x{637B}\x{637C}\x{637D}\x{637E}\x{6380}\x{6381}\x{6382}' + . '\x{6383}\x{6384}\x{6385}\x{6386}\x{6387}\x{6388}\x{6389}\x{638A}\x{638C}' + . '\x{638D}\x{638E}\x{638F}\x{6390}\x{6391}\x{6392}\x{6394}\x{6395}\x{6396}' + . '\x{6397}\x{6398}\x{6399}\x{639A}\x{639B}\x{639C}\x{639D}\x{639E}\x{639F}' + . '\x{63A0}\x{63A1}\x{63A2}\x{63A3}\x{63A4}\x{63A5}\x{63A6}\x{63A7}\x{63A8}' + . '\x{63A9}\x{63AA}\x{63AB}\x{63AC}\x{63AD}\x{63AE}\x{63AF}\x{63B0}\x{63B1}' + . '\x{63B2}\x{63B3}\x{63B4}\x{63B5}\x{63B6}\x{63B7}\x{63B8}\x{63B9}\x{63BA}' + . '\x{63BC}\x{63BD}\x{63BE}\x{63BF}\x{63C0}\x{63C1}\x{63C2}\x{63C3}\x{63C4}' + . '\x{63C5}\x{63C6}\x{63C7}\x{63C8}\x{63C9}\x{63CA}\x{63CB}\x{63CC}\x{63CD}' + . '\x{63CE}\x{63CF}\x{63D0}\x{63D2}\x{63D3}\x{63D4}\x{63D5}\x{63D6}\x{63D7}' + . '\x{63D8}\x{63D9}\x{63DA}\x{63DB}\x{63DC}\x{63DD}\x{63DE}\x{63DF}\x{63E0}' + . '\x{63E1}\x{63E2}\x{63E3}\x{63E4}\x{63E5}\x{63E6}\x{63E7}\x{63E8}\x{63E9}' + . '\x{63EA}\x{63EB}\x{63EC}\x{63ED}\x{63EE}\x{63EF}\x{63F0}\x{63F1}\x{63F2}' + . '\x{63F3}\x{63F4}\x{63F5}\x{63F6}\x{63F7}\x{63F8}\x{63F9}\x{63FA}\x{63FB}' + . '\x{63FC}\x{63FD}\x{63FE}\x{63FF}\x{6400}\x{6401}\x{6402}\x{6403}\x{6404}' + . '\x{6405}\x{6406}\x{6408}\x{6409}\x{640A}\x{640B}\x{640C}\x{640D}\x{640E}' + . '\x{640F}\x{6410}\x{6411}\x{6412}\x{6413}\x{6414}\x{6415}\x{6416}\x{6417}' + . '\x{6418}\x{6419}\x{641A}\x{641B}\x{641C}\x{641D}\x{641E}\x{641F}\x{6420}' + . '\x{6421}\x{6422}\x{6423}\x{6424}\x{6425}\x{6426}\x{6427}\x{6428}\x{6429}' + . '\x{642A}\x{642B}\x{642C}\x{642D}\x{642E}\x{642F}\x{6430}\x{6431}\x{6432}' + . '\x{6433}\x{6434}\x{6435}\x{6436}\x{6437}\x{6438}\x{6439}\x{643A}\x{643D}' + . '\x{643E}\x{643F}\x{6440}\x{6441}\x{6443}\x{6444}\x{6445}\x{6446}\x{6447}' + . '\x{6448}\x{644A}\x{644B}\x{644C}\x{644D}\x{644E}\x{644F}\x{6450}\x{6451}' + . '\x{6452}\x{6453}\x{6454}\x{6455}\x{6456}\x{6457}\x{6458}\x{6459}\x{645B}' + . '\x{645C}\x{645D}\x{645E}\x{645F}\x{6460}\x{6461}\x{6462}\x{6463}\x{6464}' + . '\x{6465}\x{6466}\x{6467}\x{6468}\x{6469}\x{646A}\x{646B}\x{646C}\x{646D}' + . '\x{646E}\x{646F}\x{6470}\x{6471}\x{6472}\x{6473}\x{6474}\x{6475}\x{6476}' + . '\x{6477}\x{6478}\x{6479}\x{647A}\x{647B}\x{647C}\x{647D}\x{647F}\x{6480}' + . '\x{6481}\x{6482}\x{6483}\x{6484}\x{6485}\x{6487}\x{6488}\x{6489}\x{648A}' + . '\x{648B}\x{648C}\x{648D}\x{648E}\x{648F}\x{6490}\x{6491}\x{6492}\x{6493}' + . '\x{6494}\x{6495}\x{6496}\x{6497}\x{6498}\x{6499}\x{649A}\x{649B}\x{649C}' + . '\x{649D}\x{649E}\x{649F}\x{64A0}\x{64A2}\x{64A3}\x{64A4}\x{64A5}\x{64A6}' + . '\x{64A7}\x{64A8}\x{64A9}\x{64AA}\x{64AB}\x{64AC}\x{64AD}\x{64AE}\x{64B0}' + . '\x{64B1}\x{64B2}\x{64B3}\x{64B4}\x{64B5}\x{64B7}\x{64B8}\x{64B9}\x{64BA}' + . '\x{64BB}\x{64BC}\x{64BD}\x{64BE}\x{64BF}\x{64C0}\x{64C1}\x{64C2}\x{64C3}' + . '\x{64C4}\x{64C5}\x{64C6}\x{64C7}\x{64C9}\x{64CA}\x{64CB}\x{64CC}\x{64CD}' + . '\x{64CE}\x{64CF}\x{64D0}\x{64D1}\x{64D2}\x{64D3}\x{64D4}\x{64D6}\x{64D7}' + . '\x{64D8}\x{64D9}\x{64DA}\x{64DB}\x{64DC}\x{64DD}\x{64DE}\x{64DF}\x{64E0}' + . '\x{64E2}\x{64E3}\x{64E4}\x{64E6}\x{64E7}\x{64E8}\x{64E9}\x{64EA}\x{64EB}' + . '\x{64EC}\x{64ED}\x{64EF}\x{64F0}\x{64F1}\x{64F2}\x{64F3}\x{64F4}\x{64F6}' + . '\x{64F7}\x{64F8}\x{64FA}\x{64FB}\x{64FC}\x{64FD}\x{64FE}\x{64FF}\x{6500}' + . '\x{6501}\x{6503}\x{6504}\x{6505}\x{6506}\x{6507}\x{6508}\x{6509}\x{650B}' + . '\x{650C}\x{650D}\x{650E}\x{650F}\x{6510}\x{6511}\x{6512}\x{6513}\x{6514}' + . '\x{6515}\x{6516}\x{6517}\x{6518}\x{6519}\x{651A}\x{651B}\x{651C}\x{651D}' + . '\x{651E}\x{6520}\x{6521}\x{6522}\x{6523}\x{6524}\x{6525}\x{6526}\x{6527}' + . '\x{6529}\x{652A}\x{652B}\x{652C}\x{652D}\x{652E}\x{652F}\x{6530}\x{6531}' + . '\x{6532}\x{6533}\x{6534}\x{6535}\x{6536}\x{6537}\x{6538}\x{6539}\x{653A}' + . '\x{653B}\x{653C}\x{653D}\x{653E}\x{653F}\x{6541}\x{6543}\x{6544}\x{6545}' + . '\x{6546}\x{6547}\x{6548}\x{6549}\x{654A}\x{654B}\x{654C}\x{654D}\x{654E}' + . '\x{654F}\x{6550}\x{6551}\x{6552}\x{6553}\x{6554}\x{6555}\x{6556}\x{6557}' + . '\x{6558}\x{6559}\x{655B}\x{655C}\x{655D}\x{655E}\x{6560}\x{6561}\x{6562}' + . '\x{6563}\x{6564}\x{6565}\x{6566}\x{6567}\x{6568}\x{6569}\x{656A}\x{656B}' + . '\x{656C}\x{656E}\x{656F}\x{6570}\x{6571}\x{6572}\x{6573}\x{6574}\x{6575}' + . '\x{6576}\x{6577}\x{6578}\x{6579}\x{657A}\x{657B}\x{657C}\x{657E}\x{657F}' + . '\x{6580}\x{6581}\x{6582}\x{6583}\x{6584}\x{6585}\x{6586}\x{6587}\x{6588}' + . '\x{6589}\x{658B}\x{658C}\x{658D}\x{658E}\x{658F}\x{6590}\x{6591}\x{6592}' + . '\x{6593}\x{6594}\x{6595}\x{6596}\x{6597}\x{6598}\x{6599}\x{659B}\x{659C}' + . '\x{659D}\x{659E}\x{659F}\x{65A0}\x{65A1}\x{65A2}\x{65A3}\x{65A4}\x{65A5}' + . '\x{65A6}\x{65A7}\x{65A8}\x{65A9}\x{65AA}\x{65AB}\x{65AC}\x{65AD}\x{65AE}' + . '\x{65AF}\x{65B0}\x{65B1}\x{65B2}\x{65B3}\x{65B4}\x{65B6}\x{65B7}\x{65B8}' + . '\x{65B9}\x{65BA}\x{65BB}\x{65BC}\x{65BD}\x{65BF}\x{65C0}\x{65C1}\x{65C2}' + . '\x{65C3}\x{65C4}\x{65C5}\x{65C6}\x{65C7}\x{65CA}\x{65CB}\x{65CC}\x{65CD}' + . '\x{65CE}\x{65CF}\x{65D0}\x{65D2}\x{65D3}\x{65D4}\x{65D5}\x{65D6}\x{65D7}' + . '\x{65DA}\x{65DB}\x{65DD}\x{65DE}\x{65DF}\x{65E0}\x{65E1}\x{65E2}\x{65E3}' + . '\x{65E5}\x{65E6}\x{65E7}\x{65E8}\x{65E9}\x{65EB}\x{65EC}\x{65ED}\x{65EE}' + . '\x{65EF}\x{65F0}\x{65F1}\x{65F2}\x{65F3}\x{65F4}\x{65F5}\x{65F6}\x{65F7}' + . '\x{65F8}\x{65FA}\x{65FB}\x{65FC}\x{65FD}\x{6600}\x{6601}\x{6602}\x{6603}' + . '\x{6604}\x{6605}\x{6606}\x{6607}\x{6608}\x{6609}\x{660A}\x{660B}\x{660C}' + . '\x{660D}\x{660E}\x{660F}\x{6610}\x{6611}\x{6612}\x{6613}\x{6614}\x{6615}' + . '\x{6616}\x{6618}\x{6619}\x{661A}\x{661B}\x{661C}\x{661D}\x{661F}\x{6620}' + . '\x{6621}\x{6622}\x{6623}\x{6624}\x{6625}\x{6626}\x{6627}\x{6628}\x{6629}' + . '\x{662A}\x{662B}\x{662D}\x{662E}\x{662F}\x{6630}\x{6631}\x{6632}\x{6633}' + . '\x{6634}\x{6635}\x{6636}\x{6639}\x{663A}\x{663C}\x{663D}\x{663E}\x{6640}' + . '\x{6641}\x{6642}\x{6643}\x{6644}\x{6645}\x{6646}\x{6647}\x{6649}\x{664A}' + . '\x{664B}\x{664C}\x{664E}\x{664F}\x{6650}\x{6651}\x{6652}\x{6653}\x{6654}' + . '\x{6655}\x{6656}\x{6657}\x{6658}\x{6659}\x{665A}\x{665B}\x{665C}\x{665D}' + . '\x{665E}\x{665F}\x{6661}\x{6662}\x{6664}\x{6665}\x{6666}\x{6668}\x{6669}' + . '\x{666A}\x{666B}\x{666C}\x{666D}\x{666E}\x{666F}\x{6670}\x{6671}\x{6672}' + . '\x{6673}\x{6674}\x{6675}\x{6676}\x{6677}\x{6678}\x{6679}\x{667A}\x{667B}' + . '\x{667C}\x{667D}\x{667E}\x{667F}\x{6680}\x{6681}\x{6682}\x{6683}\x{6684}' + . '\x{6685}\x{6686}\x{6687}\x{6688}\x{6689}\x{668A}\x{668B}\x{668C}\x{668D}' + . '\x{668E}\x{668F}\x{6690}\x{6691}\x{6693}\x{6694}\x{6695}\x{6696}\x{6697}' + . '\x{6698}\x{6699}\x{669A}\x{669B}\x{669D}\x{669F}\x{66A0}\x{66A1}\x{66A2}' + . '\x{66A3}\x{66A4}\x{66A5}\x{66A6}\x{66A7}\x{66A8}\x{66A9}\x{66AA}\x{66AB}' + . '\x{66AE}\x{66AF}\x{66B0}\x{66B1}\x{66B2}\x{66B3}\x{66B4}\x{66B5}\x{66B6}' + . '\x{66B7}\x{66B8}\x{66B9}\x{66BA}\x{66BB}\x{66BC}\x{66BD}\x{66BE}\x{66BF}' + . '\x{66C0}\x{66C1}\x{66C2}\x{66C3}\x{66C4}\x{66C5}\x{66C6}\x{66C7}\x{66C8}' + . '\x{66C9}\x{66CA}\x{66CB}\x{66CC}\x{66CD}\x{66CE}\x{66CF}\x{66D1}\x{66D2}' + . '\x{66D4}\x{66D5}\x{66D6}\x{66D8}\x{66D9}\x{66DA}\x{66DB}\x{66DC}\x{66DD}' + . '\x{66DE}\x{66E0}\x{66E1}\x{66E2}\x{66E3}\x{66E4}\x{66E5}\x{66E6}\x{66E7}' + . '\x{66E8}\x{66E9}\x{66EA}\x{66EB}\x{66EC}\x{66ED}\x{66EE}\x{66F0}\x{66F1}' + . '\x{66F2}\x{66F3}\x{66F4}\x{66F5}\x{66F6}\x{66F7}\x{66F8}\x{66F9}\x{66FA}' + . '\x{66FB}\x{66FC}\x{66FE}\x{66FF}\x{6700}\x{6701}\x{6703}\x{6704}\x{6705}' + . '\x{6706}\x{6708}\x{6709}\x{670A}\x{670B}\x{670C}\x{670D}\x{670E}\x{670F}' + . '\x{6710}\x{6711}\x{6712}\x{6713}\x{6714}\x{6715}\x{6716}\x{6717}\x{6718}' + . '\x{671A}\x{671B}\x{671C}\x{671D}\x{671E}\x{671F}\x{6720}\x{6721}\x{6722}' + . '\x{6723}\x{6725}\x{6726}\x{6727}\x{6728}\x{672A}\x{672B}\x{672C}\x{672D}' + . '\x{672E}\x{672F}\x{6730}\x{6731}\x{6732}\x{6733}\x{6734}\x{6735}\x{6736}' + . '\x{6737}\x{6738}\x{6739}\x{673A}\x{673B}\x{673C}\x{673D}\x{673E}\x{673F}' + . '\x{6740}\x{6741}\x{6742}\x{6743}\x{6744}\x{6745}\x{6746}\x{6747}\x{6748}' + . '\x{6749}\x{674A}\x{674B}\x{674C}\x{674D}\x{674E}\x{674F}\x{6750}\x{6751}' + . '\x{6752}\x{6753}\x{6754}\x{6755}\x{6756}\x{6757}\x{6758}\x{6759}\x{675A}' + . '\x{675B}\x{675C}\x{675D}\x{675E}\x{675F}\x{6760}\x{6761}\x{6762}\x{6763}' + . '\x{6764}\x{6765}\x{6766}\x{6768}\x{6769}\x{676A}\x{676B}\x{676C}\x{676D}' + . '\x{676E}\x{676F}\x{6770}\x{6771}\x{6772}\x{6773}\x{6774}\x{6775}\x{6776}' + . '\x{6777}\x{6778}\x{6779}\x{677A}\x{677B}\x{677C}\x{677D}\x{677E}\x{677F}' + . '\x{6780}\x{6781}\x{6782}\x{6783}\x{6784}\x{6785}\x{6786}\x{6787}\x{6789}' + . '\x{678A}\x{678B}\x{678C}\x{678D}\x{678E}\x{678F}\x{6790}\x{6791}\x{6792}' + . '\x{6793}\x{6794}\x{6795}\x{6797}\x{6798}\x{6799}\x{679A}\x{679B}\x{679C}' + . '\x{679D}\x{679E}\x{679F}\x{67A0}\x{67A1}\x{67A2}\x{67A3}\x{67A4}\x{67A5}' + . '\x{67A6}\x{67A7}\x{67A8}\x{67AA}\x{67AB}\x{67AC}\x{67AD}\x{67AE}\x{67AF}' + . '\x{67B0}\x{67B1}\x{67B2}\x{67B3}\x{67B4}\x{67B5}\x{67B6}\x{67B7}\x{67B8}' + . '\x{67B9}\x{67BA}\x{67BB}\x{67BC}\x{67BE}\x{67C0}\x{67C1}\x{67C2}\x{67C3}' + . '\x{67C4}\x{67C5}\x{67C6}\x{67C7}\x{67C8}\x{67C9}\x{67CA}\x{67CB}\x{67CC}' + . '\x{67CD}\x{67CE}\x{67CF}\x{67D0}\x{67D1}\x{67D2}\x{67D3}\x{67D4}\x{67D6}' + . '\x{67D8}\x{67D9}\x{67DA}\x{67DB}\x{67DC}\x{67DD}\x{67DE}\x{67DF}\x{67E0}' + . '\x{67E1}\x{67E2}\x{67E3}\x{67E4}\x{67E5}\x{67E6}\x{67E7}\x{67E8}\x{67E9}' + . '\x{67EA}\x{67EB}\x{67EC}\x{67ED}\x{67EE}\x{67EF}\x{67F0}\x{67F1}\x{67F2}' + . '\x{67F3}\x{67F4}\x{67F5}\x{67F6}\x{67F7}\x{67F8}\x{67FA}\x{67FB}\x{67FC}' + . '\x{67FD}\x{67FE}\x{67FF}\x{6800}\x{6802}\x{6803}\x{6804}\x{6805}\x{6806}' + . '\x{6807}\x{6808}\x{6809}\x{680A}\x{680B}\x{680C}\x{680D}\x{680E}\x{680F}' + . '\x{6810}\x{6811}\x{6812}\x{6813}\x{6814}\x{6816}\x{6817}\x{6818}\x{6819}' + . '\x{681A}\x{681B}\x{681C}\x{681D}\x{681F}\x{6820}\x{6821}\x{6822}\x{6823}' + . '\x{6824}\x{6825}\x{6826}\x{6828}\x{6829}\x{682A}\x{682B}\x{682C}\x{682D}' + . '\x{682E}\x{682F}\x{6831}\x{6832}\x{6833}\x{6834}\x{6835}\x{6836}\x{6837}' + . '\x{6838}\x{6839}\x{683A}\x{683B}\x{683C}\x{683D}\x{683E}\x{683F}\x{6840}' + . '\x{6841}\x{6842}\x{6843}\x{6844}\x{6845}\x{6846}\x{6847}\x{6848}\x{6849}' + . '\x{684A}\x{684B}\x{684C}\x{684D}\x{684E}\x{684F}\x{6850}\x{6851}\x{6852}' + . '\x{6853}\x{6854}\x{6855}\x{6856}\x{6857}\x{685B}\x{685D}\x{6860}\x{6861}' + . '\x{6862}\x{6863}\x{6864}\x{6865}\x{6866}\x{6867}\x{6868}\x{6869}\x{686A}' + . '\x{686B}\x{686C}\x{686D}\x{686E}\x{686F}\x{6870}\x{6871}\x{6872}\x{6873}' + . '\x{6874}\x{6875}\x{6876}\x{6877}\x{6878}\x{6879}\x{687B}\x{687C}\x{687D}' + . '\x{687E}\x{687F}\x{6880}\x{6881}\x{6882}\x{6883}\x{6884}\x{6885}\x{6886}' + . '\x{6887}\x{6888}\x{6889}\x{688A}\x{688B}\x{688C}\x{688D}\x{688E}\x{688F}' + . '\x{6890}\x{6891}\x{6892}\x{6893}\x{6894}\x{6896}\x{6897}\x{6898}\x{689A}' + . '\x{689B}\x{689C}\x{689D}\x{689E}\x{689F}\x{68A0}\x{68A1}\x{68A2}\x{68A3}' + . '\x{68A4}\x{68A6}\x{68A7}\x{68A8}\x{68A9}\x{68AA}\x{68AB}\x{68AC}\x{68AD}' + . '\x{68AE}\x{68AF}\x{68B0}\x{68B1}\x{68B2}\x{68B3}\x{68B4}\x{68B5}\x{68B6}' + . '\x{68B7}\x{68B9}\x{68BB}\x{68BC}\x{68BD}\x{68BE}\x{68BF}\x{68C0}\x{68C1}' + . '\x{68C2}\x{68C4}\x{68C6}\x{68C7}\x{68C8}\x{68C9}\x{68CA}\x{68CB}\x{68CC}' + . '\x{68CD}\x{68CE}\x{68CF}\x{68D0}\x{68D1}\x{68D2}\x{68D3}\x{68D4}\x{68D5}' + . '\x{68D6}\x{68D7}\x{68D8}\x{68DA}\x{68DB}\x{68DC}\x{68DD}\x{68DE}\x{68DF}' + . '\x{68E0}\x{68E1}\x{68E3}\x{68E4}\x{68E6}\x{68E7}\x{68E8}\x{68E9}\x{68EA}' + . '\x{68EB}\x{68EC}\x{68ED}\x{68EE}\x{68EF}\x{68F0}\x{68F1}\x{68F2}\x{68F3}' + . '\x{68F4}\x{68F5}\x{68F6}\x{68F7}\x{68F8}\x{68F9}\x{68FA}\x{68FB}\x{68FC}' + . '\x{68FD}\x{68FE}\x{68FF}\x{6901}\x{6902}\x{6903}\x{6904}\x{6905}\x{6906}' + . '\x{6907}\x{6908}\x{690A}\x{690B}\x{690C}\x{690D}\x{690E}\x{690F}\x{6910}' + . '\x{6911}\x{6912}\x{6913}\x{6914}\x{6915}\x{6916}\x{6917}\x{6918}\x{6919}' + . '\x{691A}\x{691B}\x{691C}\x{691D}\x{691E}\x{691F}\x{6920}\x{6921}\x{6922}' + . '\x{6923}\x{6924}\x{6925}\x{6926}\x{6927}\x{6928}\x{6929}\x{692A}\x{692B}' + . '\x{692C}\x{692D}\x{692E}\x{692F}\x{6930}\x{6931}\x{6932}\x{6933}\x{6934}' + . '\x{6935}\x{6936}\x{6937}\x{6938}\x{6939}\x{693A}\x{693B}\x{693C}\x{693D}' + . '\x{693F}\x{6940}\x{6941}\x{6942}\x{6943}\x{6944}\x{6945}\x{6946}\x{6947}' + . '\x{6948}\x{6949}\x{694A}\x{694B}\x{694C}\x{694E}\x{694F}\x{6950}\x{6951}' + . '\x{6952}\x{6953}\x{6954}\x{6955}\x{6956}\x{6957}\x{6958}\x{6959}\x{695A}' + . '\x{695B}\x{695C}\x{695D}\x{695E}\x{695F}\x{6960}\x{6961}\x{6962}\x{6963}' + . '\x{6964}\x{6965}\x{6966}\x{6967}\x{6968}\x{6969}\x{696A}\x{696B}\x{696C}' + . '\x{696D}\x{696E}\x{696F}\x{6970}\x{6971}\x{6972}\x{6973}\x{6974}\x{6975}' + . '\x{6976}\x{6977}\x{6978}\x{6979}\x{697A}\x{697B}\x{697C}\x{697D}\x{697E}' + . '\x{697F}\x{6980}\x{6981}\x{6982}\x{6983}\x{6984}\x{6985}\x{6986}\x{6987}' + . '\x{6988}\x{6989}\x{698A}\x{698B}\x{698C}\x{698D}\x{698E}\x{698F}\x{6990}' + . '\x{6991}\x{6992}\x{6993}\x{6994}\x{6995}\x{6996}\x{6997}\x{6998}\x{6999}' + . '\x{699A}\x{699B}\x{699C}\x{699D}\x{699E}\x{69A0}\x{69A1}\x{69A3}\x{69A4}' + . '\x{69A5}\x{69A6}\x{69A7}\x{69A8}\x{69A9}\x{69AA}\x{69AB}\x{69AC}\x{69AD}' + . '\x{69AE}\x{69AF}\x{69B0}\x{69B1}\x{69B2}\x{69B3}\x{69B4}\x{69B5}\x{69B6}' + . '\x{69B7}\x{69B8}\x{69B9}\x{69BA}\x{69BB}\x{69BC}\x{69BD}\x{69BE}\x{69BF}' + . '\x{69C1}\x{69C2}\x{69C3}\x{69C4}\x{69C5}\x{69C6}\x{69C7}\x{69C8}\x{69C9}' + . '\x{69CA}\x{69CB}\x{69CC}\x{69CD}\x{69CE}\x{69CF}\x{69D0}\x{69D3}\x{69D4}' + . '\x{69D8}\x{69D9}\x{69DA}\x{69DB}\x{69DC}\x{69DD}\x{69DE}\x{69DF}\x{69E0}' + . '\x{69E1}\x{69E2}\x{69E3}\x{69E4}\x{69E5}\x{69E6}\x{69E7}\x{69E8}\x{69E9}' + . '\x{69EA}\x{69EB}\x{69EC}\x{69ED}\x{69EE}\x{69EF}\x{69F0}\x{69F1}\x{69F2}' + . '\x{69F3}\x{69F4}\x{69F5}\x{69F6}\x{69F7}\x{69F8}\x{69FA}\x{69FB}\x{69FC}' + . '\x{69FD}\x{69FE}\x{69FF}\x{6A00}\x{6A01}\x{6A02}\x{6A04}\x{6A05}\x{6A06}' + . '\x{6A07}\x{6A08}\x{6A09}\x{6A0A}\x{6A0B}\x{6A0D}\x{6A0E}\x{6A0F}\x{6A10}' + . '\x{6A11}\x{6A12}\x{6A13}\x{6A14}\x{6A15}\x{6A16}\x{6A17}\x{6A18}\x{6A19}' + . '\x{6A1A}\x{6A1B}\x{6A1D}\x{6A1E}\x{6A1F}\x{6A20}\x{6A21}\x{6A22}\x{6A23}' + . '\x{6A25}\x{6A26}\x{6A27}\x{6A28}\x{6A29}\x{6A2A}\x{6A2B}\x{6A2C}\x{6A2D}' + . '\x{6A2E}\x{6A2F}\x{6A30}\x{6A31}\x{6A32}\x{6A33}\x{6A34}\x{6A35}\x{6A36}' + . '\x{6A38}\x{6A39}\x{6A3A}\x{6A3B}\x{6A3C}\x{6A3D}\x{6A3E}\x{6A3F}\x{6A40}' + . '\x{6A41}\x{6A42}\x{6A43}\x{6A44}\x{6A45}\x{6A46}\x{6A47}\x{6A48}\x{6A49}' + . '\x{6A4B}\x{6A4C}\x{6A4D}\x{6A4E}\x{6A4F}\x{6A50}\x{6A51}\x{6A52}\x{6A54}' + . '\x{6A55}\x{6A56}\x{6A57}\x{6A58}\x{6A59}\x{6A5A}\x{6A5B}\x{6A5D}\x{6A5E}' + . '\x{6A5F}\x{6A60}\x{6A61}\x{6A62}\x{6A63}\x{6A64}\x{6A65}\x{6A66}\x{6A67}' + . '\x{6A68}\x{6A69}\x{6A6A}\x{6A6B}\x{6A6C}\x{6A6D}\x{6A6F}\x{6A71}\x{6A72}' + . '\x{6A73}\x{6A74}\x{6A75}\x{6A76}\x{6A77}\x{6A78}\x{6A79}\x{6A7A}\x{6A7B}' + . '\x{6A7C}\x{6A7D}\x{6A7E}\x{6A7F}\x{6A80}\x{6A81}\x{6A82}\x{6A83}\x{6A84}' + . '\x{6A85}\x{6A87}\x{6A88}\x{6A89}\x{6A8B}\x{6A8C}\x{6A8D}\x{6A8E}\x{6A90}' + . '\x{6A91}\x{6A92}\x{6A93}\x{6A94}\x{6A95}\x{6A96}\x{6A97}\x{6A98}\x{6A9A}' + . '\x{6A9B}\x{6A9C}\x{6A9E}\x{6A9F}\x{6AA0}\x{6AA1}\x{6AA2}\x{6AA3}\x{6AA4}' + . '\x{6AA5}\x{6AA6}\x{6AA7}\x{6AA8}\x{6AA9}\x{6AAB}\x{6AAC}\x{6AAD}\x{6AAE}' + . '\x{6AAF}\x{6AB0}\x{6AB2}\x{6AB3}\x{6AB4}\x{6AB5}\x{6AB6}\x{6AB7}\x{6AB8}' + . '\x{6AB9}\x{6ABA}\x{6ABB}\x{6ABC}\x{6ABD}\x{6ABF}\x{6AC1}\x{6AC2}\x{6AC3}' + . '\x{6AC5}\x{6AC6}\x{6AC7}\x{6ACA}\x{6ACB}\x{6ACC}\x{6ACD}\x{6ACE}\x{6ACF}' + . '\x{6AD0}\x{6AD1}\x{6AD2}\x{6AD3}\x{6AD4}\x{6AD5}\x{6AD6}\x{6AD7}\x{6AD9}' + . '\x{6ADA}\x{6ADB}\x{6ADC}\x{6ADD}\x{6ADE}\x{6ADF}\x{6AE0}\x{6AE1}\x{6AE2}' + . '\x{6AE3}\x{6AE4}\x{6AE5}\x{6AE6}\x{6AE7}\x{6AE8}\x{6AEA}\x{6AEB}\x{6AEC}' + . '\x{6AED}\x{6AEE}\x{6AEF}\x{6AF0}\x{6AF1}\x{6AF2}\x{6AF3}\x{6AF4}\x{6AF5}' + . '\x{6AF6}\x{6AF7}\x{6AF8}\x{6AF9}\x{6AFA}\x{6AFB}\x{6AFC}\x{6AFD}\x{6AFE}' + . '\x{6AFF}\x{6B00}\x{6B01}\x{6B02}\x{6B03}\x{6B04}\x{6B05}\x{6B06}\x{6B07}' + . '\x{6B08}\x{6B09}\x{6B0A}\x{6B0B}\x{6B0C}\x{6B0D}\x{6B0F}\x{6B10}\x{6B11}' + . '\x{6B12}\x{6B13}\x{6B14}\x{6B15}\x{6B16}\x{6B17}\x{6B18}\x{6B19}\x{6B1A}' + . '\x{6B1C}\x{6B1D}\x{6B1E}\x{6B1F}\x{6B20}\x{6B21}\x{6B22}\x{6B23}\x{6B24}' + . '\x{6B25}\x{6B26}\x{6B27}\x{6B28}\x{6B29}\x{6B2A}\x{6B2B}\x{6B2C}\x{6B2D}' + . '\x{6B2F}\x{6B30}\x{6B31}\x{6B32}\x{6B33}\x{6B34}\x{6B36}\x{6B37}\x{6B38}' + . '\x{6B39}\x{6B3A}\x{6B3B}\x{6B3C}\x{6B3D}\x{6B3E}\x{6B3F}\x{6B41}\x{6B42}' + . '\x{6B43}\x{6B44}\x{6B45}\x{6B46}\x{6B47}\x{6B48}\x{6B49}\x{6B4A}\x{6B4B}' + . '\x{6B4C}\x{6B4D}\x{6B4E}\x{6B4F}\x{6B50}\x{6B51}\x{6B52}\x{6B53}\x{6B54}' + . '\x{6B55}\x{6B56}\x{6B59}\x{6B5A}\x{6B5B}\x{6B5C}\x{6B5E}\x{6B5F}\x{6B60}' + . '\x{6B61}\x{6B62}\x{6B63}\x{6B64}\x{6B65}\x{6B66}\x{6B67}\x{6B69}\x{6B6A}' + . '\x{6B6B}\x{6B6D}\x{6B6F}\x{6B70}\x{6B72}\x{6B73}\x{6B74}\x{6B76}\x{6B77}' + . '\x{6B78}\x{6B79}\x{6B7A}\x{6B7B}\x{6B7C}\x{6B7E}\x{6B7F}\x{6B80}\x{6B81}' + . '\x{6B82}\x{6B83}\x{6B84}\x{6B85}\x{6B86}\x{6B87}\x{6B88}\x{6B89}\x{6B8A}' + . '\x{6B8B}\x{6B8C}\x{6B8D}\x{6B8E}\x{6B8F}\x{6B90}\x{6B91}\x{6B92}\x{6B93}' + . '\x{6B94}\x{6B95}\x{6B96}\x{6B97}\x{6B98}\x{6B99}\x{6B9A}\x{6B9B}\x{6B9C}' + . '\x{6B9D}\x{6B9E}\x{6B9F}\x{6BA0}\x{6BA1}\x{6BA2}\x{6BA3}\x{6BA4}\x{6BA5}' + . '\x{6BA6}\x{6BA7}\x{6BA8}\x{6BA9}\x{6BAA}\x{6BAB}\x{6BAC}\x{6BAD}\x{6BAE}' + . '\x{6BAF}\x{6BB0}\x{6BB2}\x{6BB3}\x{6BB4}\x{6BB5}\x{6BB6}\x{6BB7}\x{6BB9}' + . '\x{6BBA}\x{6BBB}\x{6BBC}\x{6BBD}\x{6BBE}\x{6BBF}\x{6BC0}\x{6BC1}\x{6BC2}' + . '\x{6BC3}\x{6BC4}\x{6BC5}\x{6BC6}\x{6BC7}\x{6BC8}\x{6BC9}\x{6BCA}\x{6BCB}' + . '\x{6BCC}\x{6BCD}\x{6BCE}\x{6BCF}\x{6BD0}\x{6BD1}\x{6BD2}\x{6BD3}\x{6BD4}' + . '\x{6BD5}\x{6BD6}\x{6BD7}\x{6BD8}\x{6BD9}\x{6BDA}\x{6BDB}\x{6BDC}\x{6BDD}' + . '\x{6BDE}\x{6BDF}\x{6BE0}\x{6BE1}\x{6BE2}\x{6BE3}\x{6BE4}\x{6BE5}\x{6BE6}' + . '\x{6BE7}\x{6BE8}\x{6BEA}\x{6BEB}\x{6BEC}\x{6BED}\x{6BEE}\x{6BEF}\x{6BF0}' + . '\x{6BF2}\x{6BF3}\x{6BF5}\x{6BF6}\x{6BF7}\x{6BF8}\x{6BF9}\x{6BFB}\x{6BFC}' + . '\x{6BFD}\x{6BFE}\x{6BFF}\x{6C00}\x{6C01}\x{6C02}\x{6C03}\x{6C04}\x{6C05}' + . '\x{6C06}\x{6C07}\x{6C08}\x{6C09}\x{6C0B}\x{6C0C}\x{6C0D}\x{6C0E}\x{6C0F}' + . '\x{6C10}\x{6C11}\x{6C12}\x{6C13}\x{6C14}\x{6C15}\x{6C16}\x{6C18}\x{6C19}' + . '\x{6C1A}\x{6C1B}\x{6C1D}\x{6C1E}\x{6C1F}\x{6C20}\x{6C21}\x{6C22}\x{6C23}' + . '\x{6C24}\x{6C25}\x{6C26}\x{6C27}\x{6C28}\x{6C29}\x{6C2A}\x{6C2B}\x{6C2C}' + . '\x{6C2E}\x{6C2F}\x{6C30}\x{6C31}\x{6C32}\x{6C33}\x{6C34}\x{6C35}\x{6C36}' + . '\x{6C37}\x{6C38}\x{6C3A}\x{6C3B}\x{6C3D}\x{6C3E}\x{6C3F}\x{6C40}\x{6C41}' + . '\x{6C42}\x{6C43}\x{6C44}\x{6C46}\x{6C47}\x{6C48}\x{6C49}\x{6C4A}\x{6C4B}' + . '\x{6C4C}\x{6C4D}\x{6C4E}\x{6C4F}\x{6C50}\x{6C51}\x{6C52}\x{6C53}\x{6C54}' + . '\x{6C55}\x{6C56}\x{6C57}\x{6C58}\x{6C59}\x{6C5A}\x{6C5B}\x{6C5C}\x{6C5D}' + . '\x{6C5E}\x{6C5F}\x{6C60}\x{6C61}\x{6C62}\x{6C63}\x{6C64}\x{6C65}\x{6C66}' + . '\x{6C67}\x{6C68}\x{6C69}\x{6C6A}\x{6C6B}\x{6C6D}\x{6C6F}\x{6C70}\x{6C71}' + . '\x{6C72}\x{6C73}\x{6C74}\x{6C75}\x{6C76}\x{6C77}\x{6C78}\x{6C79}\x{6C7A}' + . '\x{6C7B}\x{6C7C}\x{6C7D}\x{6C7E}\x{6C7F}\x{6C80}\x{6C81}\x{6C82}\x{6C83}' + . '\x{6C84}\x{6C85}\x{6C86}\x{6C87}\x{6C88}\x{6C89}\x{6C8A}\x{6C8B}\x{6C8C}' + . '\x{6C8D}\x{6C8E}\x{6C8F}\x{6C90}\x{6C91}\x{6C92}\x{6C93}\x{6C94}\x{6C95}' + . '\x{6C96}\x{6C97}\x{6C98}\x{6C99}\x{6C9A}\x{6C9B}\x{6C9C}\x{6C9D}\x{6C9E}' + . '\x{6C9F}\x{6CA1}\x{6CA2}\x{6CA3}\x{6CA4}\x{6CA5}\x{6CA6}\x{6CA7}\x{6CA8}' + . '\x{6CA9}\x{6CAA}\x{6CAB}\x{6CAC}\x{6CAD}\x{6CAE}\x{6CAF}\x{6CB0}\x{6CB1}' + . '\x{6CB2}\x{6CB3}\x{6CB4}\x{6CB5}\x{6CB6}\x{6CB7}\x{6CB8}\x{6CB9}\x{6CBA}' + . '\x{6CBB}\x{6CBC}\x{6CBD}\x{6CBE}\x{6CBF}\x{6CC0}\x{6CC1}\x{6CC2}\x{6CC3}' + . '\x{6CC4}\x{6CC5}\x{6CC6}\x{6CC7}\x{6CC8}\x{6CC9}\x{6CCA}\x{6CCB}\x{6CCC}' + . '\x{6CCD}\x{6CCE}\x{6CCF}\x{6CD0}\x{6CD1}\x{6CD2}\x{6CD3}\x{6CD4}\x{6CD5}' + . '\x{6CD6}\x{6CD7}\x{6CD9}\x{6CDA}\x{6CDB}\x{6CDC}\x{6CDD}\x{6CDE}\x{6CDF}' + . '\x{6CE0}\x{6CE1}\x{6CE2}\x{6CE3}\x{6CE4}\x{6CE5}\x{6CE6}\x{6CE7}\x{6CE8}' + . '\x{6CE9}\x{6CEA}\x{6CEB}\x{6CEC}\x{6CED}\x{6CEE}\x{6CEF}\x{6CF0}\x{6CF1}' + . '\x{6CF2}\x{6CF3}\x{6CF5}\x{6CF6}\x{6CF7}\x{6CF8}\x{6CF9}\x{6CFA}\x{6CFB}' + . '\x{6CFC}\x{6CFD}\x{6CFE}\x{6CFF}\x{6D00}\x{6D01}\x{6D03}\x{6D04}\x{6D05}' + . '\x{6D06}\x{6D07}\x{6D08}\x{6D09}\x{6D0A}\x{6D0B}\x{6D0C}\x{6D0D}\x{6D0E}' + . '\x{6D0F}\x{6D10}\x{6D11}\x{6D12}\x{6D13}\x{6D14}\x{6D15}\x{6D16}\x{6D17}' + . '\x{6D18}\x{6D19}\x{6D1A}\x{6D1B}\x{6D1D}\x{6D1E}\x{6D1F}\x{6D20}\x{6D21}' + . '\x{6D22}\x{6D23}\x{6D25}\x{6D26}\x{6D27}\x{6D28}\x{6D29}\x{6D2A}\x{6D2B}' + . '\x{6D2C}\x{6D2D}\x{6D2E}\x{6D2F}\x{6D30}\x{6D31}\x{6D32}\x{6D33}\x{6D34}' + . '\x{6D35}\x{6D36}\x{6D37}\x{6D38}\x{6D39}\x{6D3A}\x{6D3B}\x{6D3C}\x{6D3D}' + . '\x{6D3E}\x{6D3F}\x{6D40}\x{6D41}\x{6D42}\x{6D43}\x{6D44}\x{6D45}\x{6D46}' + . '\x{6D47}\x{6D48}\x{6D49}\x{6D4A}\x{6D4B}\x{6D4C}\x{6D4D}\x{6D4E}\x{6D4F}' + . '\x{6D50}\x{6D51}\x{6D52}\x{6D53}\x{6D54}\x{6D55}\x{6D56}\x{6D57}\x{6D58}' + . '\x{6D59}\x{6D5A}\x{6D5B}\x{6D5C}\x{6D5D}\x{6D5E}\x{6D5F}\x{6D60}\x{6D61}' + . '\x{6D62}\x{6D63}\x{6D64}\x{6D65}\x{6D66}\x{6D67}\x{6D68}\x{6D69}\x{6D6A}' + . '\x{6D6B}\x{6D6C}\x{6D6D}\x{6D6E}\x{6D6F}\x{6D70}\x{6D72}\x{6D73}\x{6D74}' + . '\x{6D75}\x{6D76}\x{6D77}\x{6D78}\x{6D79}\x{6D7A}\x{6D7B}\x{6D7C}\x{6D7D}' + . '\x{6D7E}\x{6D7F}\x{6D80}\x{6D82}\x{6D83}\x{6D84}\x{6D85}\x{6D86}\x{6D87}' + . '\x{6D88}\x{6D89}\x{6D8A}\x{6D8B}\x{6D8C}\x{6D8D}\x{6D8E}\x{6D8F}\x{6D90}' + . '\x{6D91}\x{6D92}\x{6D93}\x{6D94}\x{6D95}\x{6D97}\x{6D98}\x{6D99}\x{6D9A}' + . '\x{6D9B}\x{6D9D}\x{6D9E}\x{6D9F}\x{6DA0}\x{6DA1}\x{6DA2}\x{6DA3}\x{6DA4}' + . '\x{6DA5}\x{6DA6}\x{6DA7}\x{6DA8}\x{6DA9}\x{6DAA}\x{6DAB}\x{6DAC}\x{6DAD}' + . '\x{6DAE}\x{6DAF}\x{6DB2}\x{6DB3}\x{6DB4}\x{6DB5}\x{6DB7}\x{6DB8}\x{6DB9}' + . '\x{6DBA}\x{6DBB}\x{6DBC}\x{6DBD}\x{6DBE}\x{6DBF}\x{6DC0}\x{6DC1}\x{6DC2}' + . '\x{6DC3}\x{6DC4}\x{6DC5}\x{6DC6}\x{6DC7}\x{6DC8}\x{6DC9}\x{6DCA}\x{6DCB}' + . '\x{6DCC}\x{6DCD}\x{6DCE}\x{6DCF}\x{6DD0}\x{6DD1}\x{6DD2}\x{6DD3}\x{6DD4}' + . '\x{6DD5}\x{6DD6}\x{6DD7}\x{6DD8}\x{6DD9}\x{6DDA}\x{6DDB}\x{6DDC}\x{6DDD}' + . '\x{6DDE}\x{6DDF}\x{6DE0}\x{6DE1}\x{6DE2}\x{6DE3}\x{6DE4}\x{6DE5}\x{6DE6}' + . '\x{6DE7}\x{6DE8}\x{6DE9}\x{6DEA}\x{6DEB}\x{6DEC}\x{6DED}\x{6DEE}\x{6DEF}' + . '\x{6DF0}\x{6DF1}\x{6DF2}\x{6DF3}\x{6DF4}\x{6DF5}\x{6DF6}\x{6DF7}\x{6DF8}' + . '\x{6DF9}\x{6DFA}\x{6DFB}\x{6DFC}\x{6DFD}\x{6E00}\x{6E03}\x{6E04}\x{6E05}' + . '\x{6E07}\x{6E08}\x{6E09}\x{6E0A}\x{6E0B}\x{6E0C}\x{6E0D}\x{6E0E}\x{6E0F}' + . '\x{6E10}\x{6E11}\x{6E14}\x{6E15}\x{6E16}\x{6E17}\x{6E19}\x{6E1A}\x{6E1B}' + . '\x{6E1C}\x{6E1D}\x{6E1E}\x{6E1F}\x{6E20}\x{6E21}\x{6E22}\x{6E23}\x{6E24}' + . '\x{6E25}\x{6E26}\x{6E27}\x{6E28}\x{6E29}\x{6E2B}\x{6E2C}\x{6E2D}\x{6E2E}' + . '\x{6E2F}\x{6E30}\x{6E31}\x{6E32}\x{6E33}\x{6E34}\x{6E35}\x{6E36}\x{6E37}' + . '\x{6E38}\x{6E39}\x{6E3A}\x{6E3B}\x{6E3C}\x{6E3D}\x{6E3E}\x{6E3F}\x{6E40}' + . '\x{6E41}\x{6E42}\x{6E43}\x{6E44}\x{6E45}\x{6E46}\x{6E47}\x{6E48}\x{6E49}' + . '\x{6E4A}\x{6E4B}\x{6E4D}\x{6E4E}\x{6E4F}\x{6E50}\x{6E51}\x{6E52}\x{6E53}' + . '\x{6E54}\x{6E55}\x{6E56}\x{6E57}\x{6E58}\x{6E59}\x{6E5A}\x{6E5B}\x{6E5C}' + . '\x{6E5D}\x{6E5E}\x{6E5F}\x{6E60}\x{6E61}\x{6E62}\x{6E63}\x{6E64}\x{6E65}' + . '\x{6E66}\x{6E67}\x{6E68}\x{6E69}\x{6E6A}\x{6E6B}\x{6E6D}\x{6E6E}\x{6E6F}' + . '\x{6E70}\x{6E71}\x{6E72}\x{6E73}\x{6E74}\x{6E75}\x{6E77}\x{6E78}\x{6E79}' + . '\x{6E7E}\x{6E7F}\x{6E80}\x{6E81}\x{6E82}\x{6E83}\x{6E84}\x{6E85}\x{6E86}' + . '\x{6E87}\x{6E88}\x{6E89}\x{6E8A}\x{6E8D}\x{6E8E}\x{6E8F}\x{6E90}\x{6E91}' + . '\x{6E92}\x{6E93}\x{6E94}\x{6E96}\x{6E97}\x{6E98}\x{6E99}\x{6E9A}\x{6E9B}' + . '\x{6E9C}\x{6E9D}\x{6E9E}\x{6E9F}\x{6EA0}\x{6EA1}\x{6EA2}\x{6EA3}\x{6EA4}' + . '\x{6EA5}\x{6EA6}\x{6EA7}\x{6EA8}\x{6EA9}\x{6EAA}\x{6EAB}\x{6EAC}\x{6EAD}' + . '\x{6EAE}\x{6EAF}\x{6EB0}\x{6EB1}\x{6EB2}\x{6EB3}\x{6EB4}\x{6EB5}\x{6EB6}' + . '\x{6EB7}\x{6EB8}\x{6EB9}\x{6EBA}\x{6EBB}\x{6EBC}\x{6EBD}\x{6EBE}\x{6EBF}' + . '\x{6EC0}\x{6EC1}\x{6EC2}\x{6EC3}\x{6EC4}\x{6EC5}\x{6EC6}\x{6EC7}\x{6EC8}' + . '\x{6EC9}\x{6ECA}\x{6ECB}\x{6ECC}\x{6ECD}\x{6ECE}\x{6ECF}\x{6ED0}\x{6ED1}' + . '\x{6ED2}\x{6ED3}\x{6ED4}\x{6ED5}\x{6ED6}\x{6ED7}\x{6ED8}\x{6ED9}\x{6EDA}' + . '\x{6EDC}\x{6EDE}\x{6EDF}\x{6EE0}\x{6EE1}\x{6EE2}\x{6EE4}\x{6EE5}\x{6EE6}' + . '\x{6EE7}\x{6EE8}\x{6EE9}\x{6EEA}\x{6EEB}\x{6EEC}\x{6EED}\x{6EEE}\x{6EEF}' + . '\x{6EF0}\x{6EF1}\x{6EF2}\x{6EF3}\x{6EF4}\x{6EF5}\x{6EF6}\x{6EF7}\x{6EF8}' + . '\x{6EF9}\x{6EFA}\x{6EFB}\x{6EFC}\x{6EFD}\x{6EFE}\x{6EFF}\x{6F00}\x{6F01}' + . '\x{6F02}\x{6F03}\x{6F05}\x{6F06}\x{6F07}\x{6F08}\x{6F09}\x{6F0A}\x{6F0C}' + . '\x{6F0D}\x{6F0E}\x{6F0F}\x{6F10}\x{6F11}\x{6F12}\x{6F13}\x{6F14}\x{6F15}' + . '\x{6F16}\x{6F17}\x{6F18}\x{6F19}\x{6F1A}\x{6F1B}\x{6F1C}\x{6F1D}\x{6F1E}' + . '\x{6F1F}\x{6F20}\x{6F21}\x{6F22}\x{6F23}\x{6F24}\x{6F25}\x{6F26}\x{6F27}' + . '\x{6F28}\x{6F29}\x{6F2A}\x{6F2B}\x{6F2C}\x{6F2D}\x{6F2E}\x{6F2F}\x{6F30}' + . '\x{6F31}\x{6F32}\x{6F33}\x{6F34}\x{6F35}\x{6F36}\x{6F37}\x{6F38}\x{6F39}' + . '\x{6F3A}\x{6F3B}\x{6F3C}\x{6F3D}\x{6F3E}\x{6F3F}\x{6F40}\x{6F41}\x{6F43}' + . '\x{6F44}\x{6F45}\x{6F46}\x{6F47}\x{6F49}\x{6F4B}\x{6F4C}\x{6F4D}\x{6F4E}' + . '\x{6F4F}\x{6F50}\x{6F51}\x{6F52}\x{6F53}\x{6F54}\x{6F55}\x{6F56}\x{6F57}' + . '\x{6F58}\x{6F59}\x{6F5A}\x{6F5B}\x{6F5C}\x{6F5D}\x{6F5E}\x{6F5F}\x{6F60}' + . '\x{6F61}\x{6F62}\x{6F63}\x{6F64}\x{6F65}\x{6F66}\x{6F67}\x{6F68}\x{6F69}' + . '\x{6F6A}\x{6F6B}\x{6F6C}\x{6F6D}\x{6F6E}\x{6F6F}\x{6F70}\x{6F71}\x{6F72}' + . '\x{6F73}\x{6F74}\x{6F75}\x{6F76}\x{6F77}\x{6F78}\x{6F7A}\x{6F7B}\x{6F7C}' + . '\x{6F7D}\x{6F7E}\x{6F7F}\x{6F80}\x{6F81}\x{6F82}\x{6F83}\x{6F84}\x{6F85}' + . '\x{6F86}\x{6F87}\x{6F88}\x{6F89}\x{6F8A}\x{6F8B}\x{6F8C}\x{6F8D}\x{6F8E}' + . '\x{6F8F}\x{6F90}\x{6F91}\x{6F92}\x{6F93}\x{6F94}\x{6F95}\x{6F96}\x{6F97}' + . '\x{6F99}\x{6F9B}\x{6F9C}\x{6F9D}\x{6F9E}\x{6FA0}\x{6FA1}\x{6FA2}\x{6FA3}' + . '\x{6FA4}\x{6FA5}\x{6FA6}\x{6FA7}\x{6FA8}\x{6FA9}\x{6FAA}\x{6FAB}\x{6FAC}' + . '\x{6FAD}\x{6FAE}\x{6FAF}\x{6FB0}\x{6FB1}\x{6FB2}\x{6FB3}\x{6FB4}\x{6FB5}' + . '\x{6FB6}\x{6FB8}\x{6FB9}\x{6FBA}\x{6FBB}\x{6FBC}\x{6FBD}\x{6FBE}\x{6FBF}' + . '\x{6FC0}\x{6FC1}\x{6FC2}\x{6FC3}\x{6FC4}\x{6FC6}\x{6FC7}\x{6FC8}\x{6FC9}' + . '\x{6FCA}\x{6FCB}\x{6FCC}\x{6FCD}\x{6FCE}\x{6FCF}\x{6FD1}\x{6FD2}\x{6FD4}' + . '\x{6FD5}\x{6FD6}\x{6FD7}\x{6FD8}\x{6FD9}\x{6FDA}\x{6FDB}\x{6FDC}\x{6FDD}' + . '\x{6FDE}\x{6FDF}\x{6FE0}\x{6FE1}\x{6FE2}\x{6FE3}\x{6FE4}\x{6FE5}\x{6FE6}' + . '\x{6FE7}\x{6FE8}\x{6FE9}\x{6FEA}\x{6FEB}\x{6FEC}\x{6FED}\x{6FEE}\x{6FEF}' + . '\x{6FF0}\x{6FF1}\x{6FF2}\x{6FF3}\x{6FF4}\x{6FF6}\x{6FF7}\x{6FF8}\x{6FF9}' + . '\x{6FFA}\x{6FFB}\x{6FFC}\x{6FFE}\x{6FFF}\x{7000}\x{7001}\x{7002}\x{7003}' + . '\x{7004}\x{7005}\x{7006}\x{7007}\x{7008}\x{7009}\x{700A}\x{700B}\x{700C}' + . '\x{700D}\x{700E}\x{700F}\x{7011}\x{7012}\x{7014}\x{7015}\x{7016}\x{7017}' + . '\x{7018}\x{7019}\x{701A}\x{701B}\x{701C}\x{701D}\x{701F}\x{7020}\x{7021}' + . '\x{7022}\x{7023}\x{7024}\x{7025}\x{7026}\x{7027}\x{7028}\x{7029}\x{702A}' + . '\x{702B}\x{702C}\x{702D}\x{702E}\x{702F}\x{7030}\x{7031}\x{7032}\x{7033}' + . '\x{7034}\x{7035}\x{7036}\x{7037}\x{7038}\x{7039}\x{703A}\x{703B}\x{703C}' + . '\x{703D}\x{703E}\x{703F}\x{7040}\x{7041}\x{7042}\x{7043}\x{7044}\x{7045}' + . '\x{7046}\x{7048}\x{7049}\x{704A}\x{704C}\x{704D}\x{704F}\x{7050}\x{7051}' + . '\x{7052}\x{7053}\x{7054}\x{7055}\x{7056}\x{7057}\x{7058}\x{7059}\x{705A}' + . '\x{705B}\x{705C}\x{705D}\x{705E}\x{705F}\x{7060}\x{7061}\x{7062}\x{7063}' + . '\x{7064}\x{7065}\x{7066}\x{7067}\x{7068}\x{7069}\x{706A}\x{706B}\x{706C}' + . '\x{706D}\x{706E}\x{706F}\x{7070}\x{7071}\x{7074}\x{7075}\x{7076}\x{7077}' + . '\x{7078}\x{7079}\x{707A}\x{707C}\x{707D}\x{707E}\x{707F}\x{7080}\x{7082}' + . '\x{7083}\x{7084}\x{7085}\x{7086}\x{7087}\x{7088}\x{7089}\x{708A}\x{708B}' + . '\x{708C}\x{708E}\x{708F}\x{7090}\x{7091}\x{7092}\x{7093}\x{7094}\x{7095}' + . '\x{7096}\x{7098}\x{7099}\x{709A}\x{709C}\x{709D}\x{709E}\x{709F}\x{70A0}' + . '\x{70A1}\x{70A2}\x{70A3}\x{70A4}\x{70A5}\x{70A6}\x{70A7}\x{70A8}\x{70A9}' + . '\x{70AB}\x{70AC}\x{70AD}\x{70AE}\x{70AF}\x{70B0}\x{70B1}\x{70B3}\x{70B4}' + . '\x{70B5}\x{70B7}\x{70B8}\x{70B9}\x{70BA}\x{70BB}\x{70BC}\x{70BD}\x{70BE}' + . '\x{70BF}\x{70C0}\x{70C1}\x{70C2}\x{70C3}\x{70C4}\x{70C5}\x{70C6}\x{70C7}' + . '\x{70C8}\x{70C9}\x{70CA}\x{70CB}\x{70CC}\x{70CD}\x{70CE}\x{70CF}\x{70D0}' + . '\x{70D1}\x{70D2}\x{70D3}\x{70D4}\x{70D6}\x{70D7}\x{70D8}\x{70D9}\x{70DA}' + . '\x{70DB}\x{70DC}\x{70DD}\x{70DE}\x{70DF}\x{70E0}\x{70E1}\x{70E2}\x{70E3}' + . '\x{70E4}\x{70E5}\x{70E6}\x{70E7}\x{70E8}\x{70E9}\x{70EA}\x{70EB}\x{70EC}' + . '\x{70ED}\x{70EE}\x{70EF}\x{70F0}\x{70F1}\x{70F2}\x{70F3}\x{70F4}\x{70F5}' + . '\x{70F6}\x{70F7}\x{70F8}\x{70F9}\x{70FA}\x{70FB}\x{70FC}\x{70FD}\x{70FF}' + . '\x{7100}\x{7101}\x{7102}\x{7103}\x{7104}\x{7105}\x{7106}\x{7107}\x{7109}' + . '\x{710A}\x{710B}\x{710C}\x{710D}\x{710E}\x{710F}\x{7110}\x{7111}\x{7112}' + . '\x{7113}\x{7115}\x{7116}\x{7117}\x{7118}\x{7119}\x{711A}\x{711B}\x{711C}' + . '\x{711D}\x{711E}\x{711F}\x{7120}\x{7121}\x{7122}\x{7123}\x{7125}\x{7126}' + . '\x{7127}\x{7128}\x{7129}\x{712A}\x{712B}\x{712C}\x{712D}\x{712E}\x{712F}' + . '\x{7130}\x{7131}\x{7132}\x{7135}\x{7136}\x{7137}\x{7138}\x{7139}\x{713A}' + . '\x{713B}\x{713D}\x{713E}\x{713F}\x{7140}\x{7141}\x{7142}\x{7143}\x{7144}' + . '\x{7145}\x{7146}\x{7147}\x{7148}\x{7149}\x{714A}\x{714B}\x{714C}\x{714D}' + . '\x{714E}\x{714F}\x{7150}\x{7151}\x{7152}\x{7153}\x{7154}\x{7156}\x{7158}' + . '\x{7159}\x{715A}\x{715B}\x{715C}\x{715D}\x{715E}\x{715F}\x{7160}\x{7161}' + . '\x{7162}\x{7163}\x{7164}\x{7165}\x{7166}\x{7167}\x{7168}\x{7169}\x{716A}' + . '\x{716C}\x{716E}\x{716F}\x{7170}\x{7171}\x{7172}\x{7173}\x{7174}\x{7175}' + . '\x{7176}\x{7177}\x{7178}\x{7179}\x{717A}\x{717B}\x{717C}\x{717D}\x{717E}' + . '\x{717F}\x{7180}\x{7181}\x{7182}\x{7183}\x{7184}\x{7185}\x{7186}\x{7187}' + . '\x{7188}\x{7189}\x{718A}\x{718B}\x{718C}\x{718E}\x{718F}\x{7190}\x{7191}' + . '\x{7192}\x{7193}\x{7194}\x{7195}\x{7197}\x{7198}\x{7199}\x{719A}\x{719B}' + . '\x{719C}\x{719D}\x{719E}\x{719F}\x{71A0}\x{71A1}\x{71A2}\x{71A3}\x{71A4}' + . '\x{71A5}\x{71A7}\x{71A8}\x{71A9}\x{71AA}\x{71AC}\x{71AD}\x{71AE}\x{71AF}' + . '\x{71B0}\x{71B1}\x{71B2}\x{71B3}\x{71B4}\x{71B5}\x{71B7}\x{71B8}\x{71B9}' + . '\x{71BA}\x{71BB}\x{71BC}\x{71BD}\x{71BE}\x{71BF}\x{71C0}\x{71C1}\x{71C2}' + . '\x{71C3}\x{71C4}\x{71C5}\x{71C6}\x{71C7}\x{71C8}\x{71C9}\x{71CA}\x{71CB}' + . '\x{71CD}\x{71CE}\x{71CF}\x{71D0}\x{71D1}\x{71D2}\x{71D4}\x{71D5}\x{71D6}' + . '\x{71D7}\x{71D8}\x{71D9}\x{71DA}\x{71DB}\x{71DC}\x{71DD}\x{71DE}\x{71DF}' + . '\x{71E0}\x{71E1}\x{71E2}\x{71E3}\x{71E4}\x{71E5}\x{71E6}\x{71E7}\x{71E8}' + . '\x{71E9}\x{71EA}\x{71EB}\x{71EC}\x{71ED}\x{71EE}\x{71EF}\x{71F0}\x{71F1}' + . '\x{71F2}\x{71F4}\x{71F5}\x{71F6}\x{71F7}\x{71F8}\x{71F9}\x{71FB}\x{71FC}' + . '\x{71FD}\x{71FE}\x{71FF}\x{7201}\x{7202}\x{7203}\x{7204}\x{7205}\x{7206}' + . '\x{7207}\x{7208}\x{7209}\x{720A}\x{720C}\x{720D}\x{720E}\x{720F}\x{7210}' + . '\x{7212}\x{7213}\x{7214}\x{7216}\x{7218}\x{7219}\x{721A}\x{721B}\x{721C}' + . '\x{721D}\x{721E}\x{721F}\x{7221}\x{7222}\x{7223}\x{7226}\x{7227}\x{7228}' + . '\x{7229}\x{722A}\x{722B}\x{722C}\x{722D}\x{722E}\x{7230}\x{7231}\x{7232}' + . '\x{7233}\x{7235}\x{7236}\x{7237}\x{7238}\x{7239}\x{723A}\x{723B}\x{723C}' + . '\x{723D}\x{723E}\x{723F}\x{7240}\x{7241}\x{7242}\x{7243}\x{7244}\x{7246}' + . '\x{7247}\x{7248}\x{7249}\x{724A}\x{724B}\x{724C}\x{724D}\x{724F}\x{7251}' + . '\x{7252}\x{7253}\x{7254}\x{7256}\x{7257}\x{7258}\x{7259}\x{725A}\x{725B}' + . '\x{725C}\x{725D}\x{725E}\x{725F}\x{7260}\x{7261}\x{7262}\x{7263}\x{7264}' + . '\x{7265}\x{7266}\x{7267}\x{7268}\x{7269}\x{726A}\x{726B}\x{726C}\x{726D}' + . '\x{726E}\x{726F}\x{7270}\x{7271}\x{7272}\x{7273}\x{7274}\x{7275}\x{7276}' + . '\x{7277}\x{7278}\x{7279}\x{727A}\x{727B}\x{727C}\x{727D}\x{727E}\x{727F}' + . '\x{7280}\x{7281}\x{7282}\x{7283}\x{7284}\x{7285}\x{7286}\x{7287}\x{7288}' + . '\x{7289}\x{728A}\x{728B}\x{728C}\x{728D}\x{728E}\x{728F}\x{7290}\x{7291}' + . '\x{7292}\x{7293}\x{7294}\x{7295}\x{7296}\x{7297}\x{7298}\x{7299}\x{729A}' + . '\x{729B}\x{729C}\x{729D}\x{729E}\x{729F}\x{72A1}\x{72A2}\x{72A3}\x{72A4}' + . '\x{72A5}\x{72A6}\x{72A7}\x{72A8}\x{72A9}\x{72AA}\x{72AC}\x{72AD}\x{72AE}' + . '\x{72AF}\x{72B0}\x{72B1}\x{72B2}\x{72B3}\x{72B4}\x{72B5}\x{72B6}\x{72B7}' + . '\x{72B8}\x{72B9}\x{72BA}\x{72BB}\x{72BC}\x{72BD}\x{72BF}\x{72C0}\x{72C1}' + . '\x{72C2}\x{72C3}\x{72C4}\x{72C5}\x{72C6}\x{72C7}\x{72C8}\x{72C9}\x{72CA}' + . '\x{72CB}\x{72CC}\x{72CD}\x{72CE}\x{72CF}\x{72D0}\x{72D1}\x{72D2}\x{72D3}' + . '\x{72D4}\x{72D5}\x{72D6}\x{72D7}\x{72D8}\x{72D9}\x{72DA}\x{72DB}\x{72DC}' + . '\x{72DD}\x{72DE}\x{72DF}\x{72E0}\x{72E1}\x{72E2}\x{72E3}\x{72E4}\x{72E5}' + . '\x{72E6}\x{72E7}\x{72E8}\x{72E9}\x{72EA}\x{72EB}\x{72EC}\x{72ED}\x{72EE}' + . '\x{72EF}\x{72F0}\x{72F1}\x{72F2}\x{72F3}\x{72F4}\x{72F5}\x{72F6}\x{72F7}' + . '\x{72F8}\x{72F9}\x{72FA}\x{72FB}\x{72FC}\x{72FD}\x{72FE}\x{72FF}\x{7300}' + . '\x{7301}\x{7303}\x{7304}\x{7305}\x{7306}\x{7307}\x{7308}\x{7309}\x{730A}' + . '\x{730B}\x{730C}\x{730D}\x{730E}\x{730F}\x{7311}\x{7312}\x{7313}\x{7314}' + . '\x{7315}\x{7316}\x{7317}\x{7318}\x{7319}\x{731A}\x{731B}\x{731C}\x{731D}' + . '\x{731E}\x{7320}\x{7321}\x{7322}\x{7323}\x{7324}\x{7325}\x{7326}\x{7327}' + . '\x{7329}\x{732A}\x{732B}\x{732C}\x{732D}\x{732E}\x{7330}\x{7331}\x{7332}' + . '\x{7333}\x{7334}\x{7335}\x{7336}\x{7337}\x{7338}\x{7339}\x{733A}\x{733B}' + . '\x{733C}\x{733D}\x{733E}\x{733F}\x{7340}\x{7341}\x{7342}\x{7343}\x{7344}' + . '\x{7345}\x{7346}\x{7347}\x{7348}\x{7349}\x{734A}\x{734B}\x{734C}\x{734D}' + . '\x{734E}\x{7350}\x{7351}\x{7352}\x{7354}\x{7355}\x{7356}\x{7357}\x{7358}' + . '\x{7359}\x{735A}\x{735B}\x{735C}\x{735D}\x{735E}\x{735F}\x{7360}\x{7361}' + . '\x{7362}\x{7364}\x{7365}\x{7366}\x{7367}\x{7368}\x{7369}\x{736A}\x{736B}' + . '\x{736C}\x{736D}\x{736E}\x{736F}\x{7370}\x{7371}\x{7372}\x{7373}\x{7374}' + . '\x{7375}\x{7376}\x{7377}\x{7378}\x{7379}\x{737A}\x{737B}\x{737C}\x{737D}' + . '\x{737E}\x{737F}\x{7380}\x{7381}\x{7382}\x{7383}\x{7384}\x{7385}\x{7386}' + . '\x{7387}\x{7388}\x{7389}\x{738A}\x{738B}\x{738C}\x{738D}\x{738E}\x{738F}' + . '\x{7390}\x{7391}\x{7392}\x{7393}\x{7394}\x{7395}\x{7396}\x{7397}\x{7398}' + . '\x{7399}\x{739A}\x{739B}\x{739D}\x{739E}\x{739F}\x{73A0}\x{73A1}\x{73A2}' + . '\x{73A3}\x{73A4}\x{73A5}\x{73A6}\x{73A7}\x{73A8}\x{73A9}\x{73AA}\x{73AB}' + . '\x{73AC}\x{73AD}\x{73AE}\x{73AF}\x{73B0}\x{73B1}\x{73B2}\x{73B3}\x{73B4}' + . '\x{73B5}\x{73B6}\x{73B7}\x{73B8}\x{73B9}\x{73BA}\x{73BB}\x{73BC}\x{73BD}' + . '\x{73BE}\x{73BF}\x{73C0}\x{73C2}\x{73C3}\x{73C4}\x{73C5}\x{73C6}\x{73C7}' + . '\x{73C8}\x{73C9}\x{73CA}\x{73CB}\x{73CC}\x{73CD}\x{73CE}\x{73CF}\x{73D0}' + . '\x{73D1}\x{73D2}\x{73D3}\x{73D4}\x{73D5}\x{73D6}\x{73D7}\x{73D8}\x{73D9}' + . '\x{73DA}\x{73DB}\x{73DC}\x{73DD}\x{73DE}\x{73DF}\x{73E0}\x{73E2}\x{73E3}' + . '\x{73E5}\x{73E6}\x{73E7}\x{73E8}\x{73E9}\x{73EA}\x{73EB}\x{73EC}\x{73ED}' + . '\x{73EE}\x{73EF}\x{73F0}\x{73F1}\x{73F2}\x{73F4}\x{73F5}\x{73F6}\x{73F7}' + . '\x{73F8}\x{73F9}\x{73FA}\x{73FC}\x{73FD}\x{73FE}\x{73FF}\x{7400}\x{7401}' + . '\x{7402}\x{7403}\x{7404}\x{7405}\x{7406}\x{7407}\x{7408}\x{7409}\x{740A}' + . '\x{740B}\x{740C}\x{740D}\x{740E}\x{740F}\x{7410}\x{7411}\x{7412}\x{7413}' + . '\x{7414}\x{7415}\x{7416}\x{7417}\x{7419}\x{741A}\x{741B}\x{741C}\x{741D}' + . '\x{741E}\x{741F}\x{7420}\x{7421}\x{7422}\x{7423}\x{7424}\x{7425}\x{7426}' + . '\x{7427}\x{7428}\x{7429}\x{742A}\x{742B}\x{742C}\x{742D}\x{742E}\x{742F}' + . '\x{7430}\x{7431}\x{7432}\x{7433}\x{7434}\x{7435}\x{7436}\x{7437}\x{7438}' + . '\x{743A}\x{743B}\x{743C}\x{743D}\x{743F}\x{7440}\x{7441}\x{7442}\x{7443}' + . '\x{7444}\x{7445}\x{7446}\x{7448}\x{744A}\x{744B}\x{744C}\x{744D}\x{744E}' + . '\x{744F}\x{7450}\x{7451}\x{7452}\x{7453}\x{7454}\x{7455}\x{7456}\x{7457}' + . '\x{7459}\x{745A}\x{745B}\x{745C}\x{745D}\x{745E}\x{745F}\x{7461}\x{7462}' + . '\x{7463}\x{7464}\x{7465}\x{7466}\x{7467}\x{7468}\x{7469}\x{746A}\x{746B}' + . '\x{746C}\x{746D}\x{746E}\x{746F}\x{7470}\x{7471}\x{7472}\x{7473}\x{7474}' + . '\x{7475}\x{7476}\x{7477}\x{7478}\x{7479}\x{747A}\x{747C}\x{747D}\x{747E}' + . '\x{747F}\x{7480}\x{7481}\x{7482}\x{7483}\x{7485}\x{7486}\x{7487}\x{7488}' + . '\x{7489}\x{748A}\x{748B}\x{748C}\x{748D}\x{748E}\x{748F}\x{7490}\x{7491}' + . '\x{7492}\x{7493}\x{7494}\x{7495}\x{7497}\x{7498}\x{7499}\x{749A}\x{749B}' + . '\x{749C}\x{749E}\x{749F}\x{74A0}\x{74A1}\x{74A3}\x{74A4}\x{74A5}\x{74A6}' + . '\x{74A7}\x{74A8}\x{74A9}\x{74AA}\x{74AB}\x{74AC}\x{74AD}\x{74AE}\x{74AF}' + . '\x{74B0}\x{74B1}\x{74B2}\x{74B3}\x{74B4}\x{74B5}\x{74B6}\x{74B7}\x{74B8}' + . '\x{74B9}\x{74BA}\x{74BB}\x{74BC}\x{74BD}\x{74BE}\x{74BF}\x{74C0}\x{74C1}' + . '\x{74C2}\x{74C3}\x{74C4}\x{74C5}\x{74C6}\x{74CA}\x{74CB}\x{74CD}\x{74CE}' + . '\x{74CF}\x{74D0}\x{74D1}\x{74D2}\x{74D3}\x{74D4}\x{74D5}\x{74D6}\x{74D7}' + . '\x{74D8}\x{74D9}\x{74DA}\x{74DB}\x{74DC}\x{74DD}\x{74DE}\x{74DF}\x{74E0}' + . '\x{74E1}\x{74E2}\x{74E3}\x{74E4}\x{74E5}\x{74E6}\x{74E7}\x{74E8}\x{74E9}' + . '\x{74EA}\x{74EC}\x{74ED}\x{74EE}\x{74EF}\x{74F0}\x{74F1}\x{74F2}\x{74F3}' + . '\x{74F4}\x{74F5}\x{74F6}\x{74F7}\x{74F8}\x{74F9}\x{74FA}\x{74FB}\x{74FC}' + . '\x{74FD}\x{74FE}\x{74FF}\x{7500}\x{7501}\x{7502}\x{7503}\x{7504}\x{7505}' + . '\x{7506}\x{7507}\x{7508}\x{7509}\x{750A}\x{750B}\x{750C}\x{750D}\x{750F}' + . '\x{7510}\x{7511}\x{7512}\x{7513}\x{7514}\x{7515}\x{7516}\x{7517}\x{7518}' + . '\x{7519}\x{751A}\x{751B}\x{751C}\x{751D}\x{751E}\x{751F}\x{7521}\x{7522}' + . '\x{7523}\x{7524}\x{7525}\x{7526}\x{7527}\x{7528}\x{7529}\x{752A}\x{752B}' + . '\x{752C}\x{752D}\x{752E}\x{752F}\x{7530}\x{7531}\x{7532}\x{7533}\x{7535}' + . '\x{7536}\x{7537}\x{7538}\x{7539}\x{753A}\x{753B}\x{753C}\x{753D}\x{753E}' + . '\x{753F}\x{7540}\x{7542}\x{7543}\x{7544}\x{7545}\x{7546}\x{7547}\x{7548}' + . '\x{7549}\x{754B}\x{754C}\x{754D}\x{754E}\x{754F}\x{7550}\x{7551}\x{7553}' + . '\x{7554}\x{7556}\x{7557}\x{7558}\x{7559}\x{755A}\x{755B}\x{755C}\x{755D}' + . '\x{755F}\x{7560}\x{7562}\x{7563}\x{7564}\x{7565}\x{7566}\x{7567}\x{7568}' + . '\x{7569}\x{756A}\x{756B}\x{756C}\x{756D}\x{756E}\x{756F}\x{7570}\x{7572}' + . '\x{7574}\x{7575}\x{7576}\x{7577}\x{7578}\x{7579}\x{757C}\x{757D}\x{757E}' + . '\x{757F}\x{7580}\x{7581}\x{7582}\x{7583}\x{7584}\x{7586}\x{7587}\x{7588}' + . '\x{7589}\x{758A}\x{758B}\x{758C}\x{758D}\x{758F}\x{7590}\x{7591}\x{7592}' + . '\x{7593}\x{7594}\x{7595}\x{7596}\x{7597}\x{7598}\x{7599}\x{759A}\x{759B}' + . '\x{759C}\x{759D}\x{759E}\x{759F}\x{75A0}\x{75A1}\x{75A2}\x{75A3}\x{75A4}' + . '\x{75A5}\x{75A6}\x{75A7}\x{75A8}\x{75AA}\x{75AB}\x{75AC}\x{75AD}\x{75AE}' + . '\x{75AF}\x{75B0}\x{75B1}\x{75B2}\x{75B3}\x{75B4}\x{75B5}\x{75B6}\x{75B8}' + . '\x{75B9}\x{75BA}\x{75BB}\x{75BC}\x{75BD}\x{75BE}\x{75BF}\x{75C0}\x{75C1}' + . '\x{75C2}\x{75C3}\x{75C4}\x{75C5}\x{75C6}\x{75C7}\x{75C8}\x{75C9}\x{75CA}' + . '\x{75CB}\x{75CC}\x{75CD}\x{75CE}\x{75CF}\x{75D0}\x{75D1}\x{75D2}\x{75D3}' + . '\x{75D4}\x{75D5}\x{75D6}\x{75D7}\x{75D8}\x{75D9}\x{75DA}\x{75DB}\x{75DD}' + . '\x{75DE}\x{75DF}\x{75E0}\x{75E1}\x{75E2}\x{75E3}\x{75E4}\x{75E5}\x{75E6}' + . '\x{75E7}\x{75E8}\x{75EA}\x{75EB}\x{75EC}\x{75ED}\x{75EF}\x{75F0}\x{75F1}' + . '\x{75F2}\x{75F3}\x{75F4}\x{75F5}\x{75F6}\x{75F7}\x{75F8}\x{75F9}\x{75FA}' + . '\x{75FB}\x{75FC}\x{75FD}\x{75FE}\x{75FF}\x{7600}\x{7601}\x{7602}\x{7603}' + . '\x{7604}\x{7605}\x{7606}\x{7607}\x{7608}\x{7609}\x{760A}\x{760B}\x{760C}' + . '\x{760D}\x{760E}\x{760F}\x{7610}\x{7611}\x{7612}\x{7613}\x{7614}\x{7615}' + . '\x{7616}\x{7617}\x{7618}\x{7619}\x{761A}\x{761B}\x{761C}\x{761D}\x{761E}' + . '\x{761F}\x{7620}\x{7621}\x{7622}\x{7623}\x{7624}\x{7625}\x{7626}\x{7627}' + . '\x{7628}\x{7629}\x{762A}\x{762B}\x{762D}\x{762E}\x{762F}\x{7630}\x{7631}' + . '\x{7632}\x{7633}\x{7634}\x{7635}\x{7636}\x{7637}\x{7638}\x{7639}\x{763A}' + . '\x{763B}\x{763C}\x{763D}\x{763E}\x{763F}\x{7640}\x{7641}\x{7642}\x{7643}' + . '\x{7646}\x{7647}\x{7648}\x{7649}\x{764A}\x{764B}\x{764C}\x{764D}\x{764F}' + . '\x{7650}\x{7652}\x{7653}\x{7654}\x{7656}\x{7657}\x{7658}\x{7659}\x{765A}' + . '\x{765B}\x{765C}\x{765D}\x{765E}\x{765F}\x{7660}\x{7661}\x{7662}\x{7663}' + . '\x{7664}\x{7665}\x{7666}\x{7667}\x{7668}\x{7669}\x{766A}\x{766B}\x{766C}' + . '\x{766D}\x{766E}\x{766F}\x{7670}\x{7671}\x{7672}\x{7674}\x{7675}\x{7676}' + . '\x{7677}\x{7678}\x{7679}\x{767B}\x{767C}\x{767D}\x{767E}\x{767F}\x{7680}' + . '\x{7681}\x{7682}\x{7683}\x{7684}\x{7685}\x{7686}\x{7687}\x{7688}\x{7689}' + . '\x{768A}\x{768B}\x{768C}\x{768E}\x{768F}\x{7690}\x{7691}\x{7692}\x{7693}' + . '\x{7694}\x{7695}\x{7696}\x{7697}\x{7698}\x{7699}\x{769A}\x{769B}\x{769C}' + . '\x{769D}\x{769E}\x{769F}\x{76A0}\x{76A3}\x{76A4}\x{76A6}\x{76A7}\x{76A9}' + . '\x{76AA}\x{76AB}\x{76AC}\x{76AD}\x{76AE}\x{76AF}\x{76B0}\x{76B1}\x{76B2}' + . '\x{76B4}\x{76B5}\x{76B7}\x{76B8}\x{76BA}\x{76BB}\x{76BC}\x{76BD}\x{76BE}' + . '\x{76BF}\x{76C0}\x{76C2}\x{76C3}\x{76C4}\x{76C5}\x{76C6}\x{76C7}\x{76C8}' + . '\x{76C9}\x{76CA}\x{76CD}\x{76CE}\x{76CF}\x{76D0}\x{76D1}\x{76D2}\x{76D3}' + . '\x{76D4}\x{76D5}\x{76D6}\x{76D7}\x{76D8}\x{76DA}\x{76DB}\x{76DC}\x{76DD}' + . '\x{76DE}\x{76DF}\x{76E0}\x{76E1}\x{76E2}\x{76E3}\x{76E4}\x{76E5}\x{76E6}' + . '\x{76E7}\x{76E8}\x{76E9}\x{76EA}\x{76EC}\x{76ED}\x{76EE}\x{76EF}\x{76F0}' + . '\x{76F1}\x{76F2}\x{76F3}\x{76F4}\x{76F5}\x{76F6}\x{76F7}\x{76F8}\x{76F9}' + . '\x{76FA}\x{76FB}\x{76FC}\x{76FD}\x{76FE}\x{76FF}\x{7701}\x{7703}\x{7704}' + . '\x{7705}\x{7706}\x{7707}\x{7708}\x{7709}\x{770A}\x{770B}\x{770C}\x{770D}' + . '\x{770F}\x{7710}\x{7711}\x{7712}\x{7713}\x{7714}\x{7715}\x{7716}\x{7717}' + . '\x{7718}\x{7719}\x{771A}\x{771B}\x{771C}\x{771D}\x{771E}\x{771F}\x{7720}' + . '\x{7722}\x{7723}\x{7725}\x{7726}\x{7727}\x{7728}\x{7729}\x{772A}\x{772C}' + . '\x{772D}\x{772E}\x{772F}\x{7730}\x{7731}\x{7732}\x{7733}\x{7734}\x{7735}' + . '\x{7736}\x{7737}\x{7738}\x{7739}\x{773A}\x{773B}\x{773C}\x{773D}\x{773E}' + . '\x{7740}\x{7741}\x{7743}\x{7744}\x{7745}\x{7746}\x{7747}\x{7748}\x{7749}' + . '\x{774A}\x{774B}\x{774C}\x{774D}\x{774E}\x{774F}\x{7750}\x{7751}\x{7752}' + . '\x{7753}\x{7754}\x{7755}\x{7756}\x{7757}\x{7758}\x{7759}\x{775A}\x{775B}' + . '\x{775C}\x{775D}\x{775E}\x{775F}\x{7760}\x{7761}\x{7762}\x{7763}\x{7765}' + . '\x{7766}\x{7767}\x{7768}\x{7769}\x{776A}\x{776B}\x{776C}\x{776D}\x{776E}' + . '\x{776F}\x{7770}\x{7771}\x{7772}\x{7773}\x{7774}\x{7775}\x{7776}\x{7777}' + . '\x{7778}\x{7779}\x{777A}\x{777B}\x{777C}\x{777D}\x{777E}\x{777F}\x{7780}' + . '\x{7781}\x{7782}\x{7783}\x{7784}\x{7785}\x{7786}\x{7787}\x{7788}\x{7789}' + . '\x{778A}\x{778B}\x{778C}\x{778D}\x{778E}\x{778F}\x{7790}\x{7791}\x{7792}' + . '\x{7793}\x{7794}\x{7795}\x{7797}\x{7798}\x{7799}\x{779A}\x{779B}\x{779C}' + . '\x{779D}\x{779E}\x{779F}\x{77A0}\x{77A1}\x{77A2}\x{77A3}\x{77A5}\x{77A6}' + . '\x{77A7}\x{77A8}\x{77A9}\x{77AA}\x{77AB}\x{77AC}\x{77AD}\x{77AE}\x{77AF}' + . '\x{77B0}\x{77B1}\x{77B2}\x{77B3}\x{77B4}\x{77B5}\x{77B6}\x{77B7}\x{77B8}' + . '\x{77B9}\x{77BA}\x{77BB}\x{77BC}\x{77BD}\x{77BF}\x{77C0}\x{77C2}\x{77C3}' + . '\x{77C4}\x{77C5}\x{77C6}\x{77C7}\x{77C8}\x{77C9}\x{77CA}\x{77CB}\x{77CC}' + . '\x{77CD}\x{77CE}\x{77CF}\x{77D0}\x{77D1}\x{77D3}\x{77D4}\x{77D5}\x{77D6}' + . '\x{77D7}\x{77D8}\x{77D9}\x{77DA}\x{77DB}\x{77DC}\x{77DE}\x{77DF}\x{77E0}' + . '\x{77E1}\x{77E2}\x{77E3}\x{77E5}\x{77E7}\x{77E8}\x{77E9}\x{77EA}\x{77EB}' + . '\x{77EC}\x{77ED}\x{77EE}\x{77EF}\x{77F0}\x{77F1}\x{77F2}\x{77F3}\x{77F6}' + . '\x{77F7}\x{77F8}\x{77F9}\x{77FA}\x{77FB}\x{77FC}\x{77FD}\x{77FE}\x{77FF}' + . '\x{7800}\x{7801}\x{7802}\x{7803}\x{7804}\x{7805}\x{7806}\x{7808}\x{7809}' + . '\x{780A}\x{780B}\x{780C}\x{780D}\x{780E}\x{780F}\x{7810}\x{7811}\x{7812}' + . '\x{7813}\x{7814}\x{7815}\x{7816}\x{7817}\x{7818}\x{7819}\x{781A}\x{781B}' + . '\x{781C}\x{781D}\x{781E}\x{781F}\x{7820}\x{7821}\x{7822}\x{7823}\x{7825}' + . '\x{7826}\x{7827}\x{7828}\x{7829}\x{782A}\x{782B}\x{782C}\x{782D}\x{782E}' + . '\x{782F}\x{7830}\x{7831}\x{7832}\x{7833}\x{7834}\x{7835}\x{7837}\x{7838}' + . '\x{7839}\x{783A}\x{783B}\x{783C}\x{783D}\x{783E}\x{7840}\x{7841}\x{7843}' + . '\x{7844}\x{7845}\x{7847}\x{7848}\x{7849}\x{784A}\x{784C}\x{784D}\x{784E}' + . '\x{7850}\x{7851}\x{7852}\x{7853}\x{7854}\x{7855}\x{7856}\x{7857}\x{7858}' + . '\x{7859}\x{785A}\x{785B}\x{785C}\x{785D}\x{785E}\x{785F}\x{7860}\x{7861}' + . '\x{7862}\x{7863}\x{7864}\x{7865}\x{7866}\x{7867}\x{7868}\x{7869}\x{786A}' + . '\x{786B}\x{786C}\x{786D}\x{786E}\x{786F}\x{7870}\x{7871}\x{7872}\x{7873}' + . '\x{7874}\x{7875}\x{7877}\x{7878}\x{7879}\x{787A}\x{787B}\x{787C}\x{787D}' + . '\x{787E}\x{787F}\x{7880}\x{7881}\x{7882}\x{7883}\x{7884}\x{7885}\x{7886}' + . '\x{7887}\x{7889}\x{788A}\x{788B}\x{788C}\x{788D}\x{788E}\x{788F}\x{7890}' + . '\x{7891}\x{7892}\x{7893}\x{7894}\x{7895}\x{7896}\x{7897}\x{7898}\x{7899}' + . '\x{789A}\x{789B}\x{789C}\x{789D}\x{789E}\x{789F}\x{78A0}\x{78A1}\x{78A2}' + . '\x{78A3}\x{78A4}\x{78A5}\x{78A6}\x{78A7}\x{78A8}\x{78A9}\x{78AA}\x{78AB}' + . '\x{78AC}\x{78AD}\x{78AE}\x{78AF}\x{78B0}\x{78B1}\x{78B2}\x{78B3}\x{78B4}' + . '\x{78B5}\x{78B6}\x{78B7}\x{78B8}\x{78B9}\x{78BA}\x{78BB}\x{78BC}\x{78BD}' + . '\x{78BE}\x{78BF}\x{78C0}\x{78C1}\x{78C3}\x{78C4}\x{78C5}\x{78C6}\x{78C8}' + . '\x{78C9}\x{78CA}\x{78CB}\x{78CC}\x{78CD}\x{78CE}\x{78CF}\x{78D0}\x{78D1}' + . '\x{78D3}\x{78D4}\x{78D5}\x{78D6}\x{78D7}\x{78D8}\x{78D9}\x{78DA}\x{78DB}' + . '\x{78DC}\x{78DD}\x{78DE}\x{78DF}\x{78E0}\x{78E1}\x{78E2}\x{78E3}\x{78E4}' + . '\x{78E5}\x{78E6}\x{78E7}\x{78E8}\x{78E9}\x{78EA}\x{78EB}\x{78EC}\x{78ED}' + . '\x{78EE}\x{78EF}\x{78F1}\x{78F2}\x{78F3}\x{78F4}\x{78F5}\x{78F6}\x{78F7}' + . '\x{78F9}\x{78FA}\x{78FB}\x{78FC}\x{78FD}\x{78FE}\x{78FF}\x{7901}\x{7902}' + . '\x{7903}\x{7904}\x{7905}\x{7906}\x{7907}\x{7909}\x{790A}\x{790B}\x{790C}' + . '\x{790E}\x{790F}\x{7910}\x{7911}\x{7912}\x{7913}\x{7914}\x{7916}\x{7917}' + . '\x{7918}\x{7919}\x{791A}\x{791B}\x{791C}\x{791D}\x{791E}\x{7921}\x{7922}' + . '\x{7923}\x{7924}\x{7925}\x{7926}\x{7927}\x{7928}\x{7929}\x{792A}\x{792B}' + . '\x{792C}\x{792D}\x{792E}\x{792F}\x{7930}\x{7931}\x{7933}\x{7934}\x{7935}' + . '\x{7937}\x{7938}\x{7939}\x{793A}\x{793B}\x{793C}\x{793D}\x{793E}\x{793F}' + . '\x{7940}\x{7941}\x{7942}\x{7943}\x{7944}\x{7945}\x{7946}\x{7947}\x{7948}' + . '\x{7949}\x{794A}\x{794B}\x{794C}\x{794D}\x{794E}\x{794F}\x{7950}\x{7951}' + . '\x{7952}\x{7953}\x{7954}\x{7955}\x{7956}\x{7957}\x{7958}\x{795A}\x{795B}' + . '\x{795C}\x{795D}\x{795E}\x{795F}\x{7960}\x{7961}\x{7962}\x{7963}\x{7964}' + . '\x{7965}\x{7966}\x{7967}\x{7968}\x{7969}\x{796A}\x{796B}\x{796D}\x{796F}' + . '\x{7970}\x{7971}\x{7972}\x{7973}\x{7974}\x{7977}\x{7978}\x{7979}\x{797A}' + . '\x{797B}\x{797C}\x{797D}\x{797E}\x{797F}\x{7980}\x{7981}\x{7982}\x{7983}' + . '\x{7984}\x{7985}\x{7988}\x{7989}\x{798A}\x{798B}\x{798C}\x{798D}\x{798E}' + . '\x{798F}\x{7990}\x{7991}\x{7992}\x{7993}\x{7994}\x{7995}\x{7996}\x{7997}' + . '\x{7998}\x{7999}\x{799A}\x{799B}\x{799C}\x{799F}\x{79A0}\x{79A1}\x{79A2}' + . '\x{79A3}\x{79A4}\x{79A5}\x{79A6}\x{79A7}\x{79A8}\x{79AA}\x{79AB}\x{79AC}' + . '\x{79AD}\x{79AE}\x{79AF}\x{79B0}\x{79B1}\x{79B2}\x{79B3}\x{79B4}\x{79B5}' + . '\x{79B6}\x{79B7}\x{79B8}\x{79B9}\x{79BA}\x{79BB}\x{79BD}\x{79BE}\x{79BF}' + . '\x{79C0}\x{79C1}\x{79C2}\x{79C3}\x{79C5}\x{79C6}\x{79C8}\x{79C9}\x{79CA}' + . '\x{79CB}\x{79CD}\x{79CE}\x{79CF}\x{79D0}\x{79D1}\x{79D2}\x{79D3}\x{79D5}' + . '\x{79D6}\x{79D8}\x{79D9}\x{79DA}\x{79DB}\x{79DC}\x{79DD}\x{79DE}\x{79DF}' + . '\x{79E0}\x{79E1}\x{79E2}\x{79E3}\x{79E4}\x{79E5}\x{79E6}\x{79E7}\x{79E8}' + . '\x{79E9}\x{79EA}\x{79EB}\x{79EC}\x{79ED}\x{79EE}\x{79EF}\x{79F0}\x{79F1}' + . '\x{79F2}\x{79F3}\x{79F4}\x{79F5}\x{79F6}\x{79F7}\x{79F8}\x{79F9}\x{79FA}' + . '\x{79FB}\x{79FC}\x{79FD}\x{79FE}\x{79FF}\x{7A00}\x{7A02}\x{7A03}\x{7A04}' + . '\x{7A05}\x{7A06}\x{7A08}\x{7A0A}\x{7A0B}\x{7A0C}\x{7A0D}\x{7A0E}\x{7A0F}' + . '\x{7A10}\x{7A11}\x{7A12}\x{7A13}\x{7A14}\x{7A15}\x{7A16}\x{7A17}\x{7A18}' + . '\x{7A19}\x{7A1A}\x{7A1B}\x{7A1C}\x{7A1D}\x{7A1E}\x{7A1F}\x{7A20}\x{7A21}' + . '\x{7A22}\x{7A23}\x{7A24}\x{7A25}\x{7A26}\x{7A27}\x{7A28}\x{7A29}\x{7A2A}' + . '\x{7A2B}\x{7A2D}\x{7A2E}\x{7A2F}\x{7A30}\x{7A31}\x{7A32}\x{7A33}\x{7A34}' + . '\x{7A35}\x{7A37}\x{7A39}\x{7A3B}\x{7A3C}\x{7A3D}\x{7A3E}\x{7A3F}\x{7A40}' + . '\x{7A41}\x{7A42}\x{7A43}\x{7A44}\x{7A45}\x{7A46}\x{7A47}\x{7A48}\x{7A49}' + . '\x{7A4A}\x{7A4B}\x{7A4C}\x{7A4D}\x{7A4E}\x{7A50}\x{7A51}\x{7A52}\x{7A53}' + . '\x{7A54}\x{7A55}\x{7A56}\x{7A57}\x{7A58}\x{7A59}\x{7A5A}\x{7A5B}\x{7A5C}' + . '\x{7A5D}\x{7A5E}\x{7A5F}\x{7A60}\x{7A61}\x{7A62}\x{7A65}\x{7A66}\x{7A67}' + . '\x{7A68}\x{7A69}\x{7A6B}\x{7A6C}\x{7A6D}\x{7A6E}\x{7A70}\x{7A71}\x{7A72}' + . '\x{7A73}\x{7A74}\x{7A75}\x{7A76}\x{7A77}\x{7A78}\x{7A79}\x{7A7A}\x{7A7B}' + . '\x{7A7C}\x{7A7D}\x{7A7E}\x{7A7F}\x{7A80}\x{7A81}\x{7A83}\x{7A84}\x{7A85}' + . '\x{7A86}\x{7A87}\x{7A88}\x{7A89}\x{7A8A}\x{7A8B}\x{7A8C}\x{7A8D}\x{7A8E}' + . '\x{7A8F}\x{7A90}\x{7A91}\x{7A92}\x{7A93}\x{7A94}\x{7A95}\x{7A96}\x{7A97}' + . '\x{7A98}\x{7A99}\x{7A9C}\x{7A9D}\x{7A9E}\x{7A9F}\x{7AA0}\x{7AA1}\x{7AA2}' + . '\x{7AA3}\x{7AA4}\x{7AA5}\x{7AA6}\x{7AA7}\x{7AA8}\x{7AA9}\x{7AAA}\x{7AAB}' + . '\x{7AAC}\x{7AAD}\x{7AAE}\x{7AAF}\x{7AB0}\x{7AB1}\x{7AB2}\x{7AB3}\x{7AB4}' + . '\x{7AB5}\x{7AB6}\x{7AB7}\x{7AB8}\x{7ABA}\x{7ABE}\x{7ABF}\x{7AC0}\x{7AC1}' + . '\x{7AC4}\x{7AC5}\x{7AC7}\x{7AC8}\x{7AC9}\x{7ACA}\x{7ACB}\x{7ACC}\x{7ACD}' + . '\x{7ACE}\x{7ACF}\x{7AD0}\x{7AD1}\x{7AD2}\x{7AD3}\x{7AD4}\x{7AD5}\x{7AD6}' + . '\x{7AD8}\x{7AD9}\x{7ADB}\x{7ADC}\x{7ADD}\x{7ADE}\x{7ADF}\x{7AE0}\x{7AE1}' + . '\x{7AE2}\x{7AE3}\x{7AE4}\x{7AE5}\x{7AE6}\x{7AE7}\x{7AE8}\x{7AEA}\x{7AEB}' + . '\x{7AEC}\x{7AED}\x{7AEE}\x{7AEF}\x{7AF0}\x{7AF1}\x{7AF2}\x{7AF3}\x{7AF4}' + . '\x{7AF6}\x{7AF7}\x{7AF8}\x{7AF9}\x{7AFA}\x{7AFB}\x{7AFD}\x{7AFE}\x{7AFF}' + . '\x{7B00}\x{7B01}\x{7B02}\x{7B03}\x{7B04}\x{7B05}\x{7B06}\x{7B08}\x{7B09}' + . '\x{7B0A}\x{7B0B}\x{7B0C}\x{7B0D}\x{7B0E}\x{7B0F}\x{7B10}\x{7B11}\x{7B12}' + . '\x{7B13}\x{7B14}\x{7B15}\x{7B16}\x{7B17}\x{7B18}\x{7B19}\x{7B1A}\x{7B1B}' + . '\x{7B1C}\x{7B1D}\x{7B1E}\x{7B20}\x{7B21}\x{7B22}\x{7B23}\x{7B24}\x{7B25}' + . '\x{7B26}\x{7B28}\x{7B2A}\x{7B2B}\x{7B2C}\x{7B2D}\x{7B2E}\x{7B2F}\x{7B30}' + . '\x{7B31}\x{7B32}\x{7B33}\x{7B34}\x{7B35}\x{7B36}\x{7B37}\x{7B38}\x{7B39}' + . '\x{7B3A}\x{7B3B}\x{7B3C}\x{7B3D}\x{7B3E}\x{7B3F}\x{7B40}\x{7B41}\x{7B43}' + . '\x{7B44}\x{7B45}\x{7B46}\x{7B47}\x{7B48}\x{7B49}\x{7B4A}\x{7B4B}\x{7B4C}' + . '\x{7B4D}\x{7B4E}\x{7B4F}\x{7B50}\x{7B51}\x{7B52}\x{7B54}\x{7B55}\x{7B56}' + . '\x{7B57}\x{7B58}\x{7B59}\x{7B5A}\x{7B5B}\x{7B5C}\x{7B5D}\x{7B5E}\x{7B5F}' + . '\x{7B60}\x{7B61}\x{7B62}\x{7B63}\x{7B64}\x{7B65}\x{7B66}\x{7B67}\x{7B68}' + . '\x{7B69}\x{7B6A}\x{7B6B}\x{7B6C}\x{7B6D}\x{7B6E}\x{7B70}\x{7B71}\x{7B72}' + . '\x{7B73}\x{7B74}\x{7B75}\x{7B76}\x{7B77}\x{7B78}\x{7B79}\x{7B7B}\x{7B7C}' + . '\x{7B7D}\x{7B7E}\x{7B7F}\x{7B80}\x{7B81}\x{7B82}\x{7B83}\x{7B84}\x{7B85}' + . '\x{7B87}\x{7B88}\x{7B89}\x{7B8A}\x{7B8B}\x{7B8C}\x{7B8D}\x{7B8E}\x{7B8F}' + . '\x{7B90}\x{7B91}\x{7B93}\x{7B94}\x{7B95}\x{7B96}\x{7B97}\x{7B98}\x{7B99}' + . '\x{7B9A}\x{7B9B}\x{7B9C}\x{7B9D}\x{7B9E}\x{7B9F}\x{7BA0}\x{7BA1}\x{7BA2}' + . '\x{7BA4}\x{7BA6}\x{7BA7}\x{7BA8}\x{7BA9}\x{7BAA}\x{7BAB}\x{7BAC}\x{7BAD}' + . '\x{7BAE}\x{7BAF}\x{7BB1}\x{7BB3}\x{7BB4}\x{7BB5}\x{7BB6}\x{7BB7}\x{7BB8}' + . '\x{7BB9}\x{7BBA}\x{7BBB}\x{7BBC}\x{7BBD}\x{7BBE}\x{7BBF}\x{7BC0}\x{7BC1}' + . '\x{7BC2}\x{7BC3}\x{7BC4}\x{7BC5}\x{7BC6}\x{7BC7}\x{7BC8}\x{7BC9}\x{7BCA}' + . '\x{7BCB}\x{7BCC}\x{7BCD}\x{7BCE}\x{7BD0}\x{7BD1}\x{7BD2}\x{7BD3}\x{7BD4}' + . '\x{7BD5}\x{7BD6}\x{7BD7}\x{7BD8}\x{7BD9}\x{7BDA}\x{7BDB}\x{7BDC}\x{7BDD}' + . '\x{7BDE}\x{7BDF}\x{7BE0}\x{7BE1}\x{7BE2}\x{7BE3}\x{7BE4}\x{7BE5}\x{7BE6}' + . '\x{7BE7}\x{7BE8}\x{7BE9}\x{7BEA}\x{7BEB}\x{7BEC}\x{7BED}\x{7BEE}\x{7BEF}' + . '\x{7BF0}\x{7BF1}\x{7BF2}\x{7BF3}\x{7BF4}\x{7BF5}\x{7BF6}\x{7BF7}\x{7BF8}' + . '\x{7BF9}\x{7BFB}\x{7BFC}\x{7BFD}\x{7BFE}\x{7BFF}\x{7C00}\x{7C01}\x{7C02}' + . '\x{7C03}\x{7C04}\x{7C05}\x{7C06}\x{7C07}\x{7C08}\x{7C09}\x{7C0A}\x{7C0B}' + . '\x{7C0C}\x{7C0D}\x{7C0E}\x{7C0F}\x{7C10}\x{7C11}\x{7C12}\x{7C13}\x{7C15}' + . '\x{7C16}\x{7C17}\x{7C18}\x{7C19}\x{7C1A}\x{7C1C}\x{7C1D}\x{7C1E}\x{7C1F}' + . '\x{7C20}\x{7C21}\x{7C22}\x{7C23}\x{7C24}\x{7C25}\x{7C26}\x{7C27}\x{7C28}' + . '\x{7C29}\x{7C2A}\x{7C2B}\x{7C2C}\x{7C2D}\x{7C30}\x{7C31}\x{7C32}\x{7C33}' + . '\x{7C34}\x{7C35}\x{7C36}\x{7C37}\x{7C38}\x{7C39}\x{7C3A}\x{7C3B}\x{7C3C}' + . '\x{7C3D}\x{7C3E}\x{7C3F}\x{7C40}\x{7C41}\x{7C42}\x{7C43}\x{7C44}\x{7C45}' + . '\x{7C46}\x{7C47}\x{7C48}\x{7C49}\x{7C4A}\x{7C4B}\x{7C4C}\x{7C4D}\x{7C4E}' + . '\x{7C50}\x{7C51}\x{7C53}\x{7C54}\x{7C56}\x{7C57}\x{7C58}\x{7C59}\x{7C5A}' + . '\x{7C5B}\x{7C5C}\x{7C5E}\x{7C5F}\x{7C60}\x{7C61}\x{7C62}\x{7C63}\x{7C64}' + . '\x{7C65}\x{7C66}\x{7C67}\x{7C68}\x{7C69}\x{7C6A}\x{7C6B}\x{7C6C}\x{7C6D}' + . '\x{7C6E}\x{7C6F}\x{7C70}\x{7C71}\x{7C72}\x{7C73}\x{7C74}\x{7C75}\x{7C77}' + . '\x{7C78}\x{7C79}\x{7C7A}\x{7C7B}\x{7C7C}\x{7C7D}\x{7C7E}\x{7C7F}\x{7C80}' + . '\x{7C81}\x{7C82}\x{7C84}\x{7C85}\x{7C86}\x{7C88}\x{7C89}\x{7C8A}\x{7C8B}' + . '\x{7C8C}\x{7C8D}\x{7C8E}\x{7C8F}\x{7C90}\x{7C91}\x{7C92}\x{7C94}\x{7C95}' + . '\x{7C96}\x{7C97}\x{7C98}\x{7C99}\x{7C9B}\x{7C9C}\x{7C9D}\x{7C9E}\x{7C9F}' + . '\x{7CA0}\x{7CA1}\x{7CA2}\x{7CA3}\x{7CA4}\x{7CA5}\x{7CA6}\x{7CA7}\x{7CA8}' + . '\x{7CA9}\x{7CAA}\x{7CAD}\x{7CAE}\x{7CAF}\x{7CB0}\x{7CB1}\x{7CB2}\x{7CB3}' + . '\x{7CB4}\x{7CB5}\x{7CB6}\x{7CB7}\x{7CB8}\x{7CB9}\x{7CBA}\x{7CBB}\x{7CBC}' + . '\x{7CBD}\x{7CBE}\x{7CBF}\x{7CC0}\x{7CC1}\x{7CC2}\x{7CC3}\x{7CC4}\x{7CC5}' + . '\x{7CC6}\x{7CC7}\x{7CC8}\x{7CC9}\x{7CCA}\x{7CCB}\x{7CCC}\x{7CCD}\x{7CCE}' + . '\x{7CCF}\x{7CD0}\x{7CD1}\x{7CD2}\x{7CD4}\x{7CD5}\x{7CD6}\x{7CD7}\x{7CD8}' + . '\x{7CD9}\x{7CDC}\x{7CDD}\x{7CDE}\x{7CDF}\x{7CE0}\x{7CE2}\x{7CE4}\x{7CE7}' + . '\x{7CE8}\x{7CE9}\x{7CEA}\x{7CEB}\x{7CEC}\x{7CED}\x{7CEE}\x{7CEF}\x{7CF0}' + . '\x{7CF1}\x{7CF2}\x{7CF3}\x{7CF4}\x{7CF5}\x{7CF6}\x{7CF7}\x{7CF8}\x{7CF9}' + . '\x{7CFA}\x{7CFB}\x{7CFD}\x{7CFE}\x{7D00}\x{7D01}\x{7D02}\x{7D03}\x{7D04}' + . '\x{7D05}\x{7D06}\x{7D07}\x{7D08}\x{7D09}\x{7D0A}\x{7D0B}\x{7D0C}\x{7D0D}' + . '\x{7D0E}\x{7D0F}\x{7D10}\x{7D11}\x{7D12}\x{7D13}\x{7D14}\x{7D15}\x{7D16}' + . '\x{7D17}\x{7D18}\x{7D19}\x{7D1A}\x{7D1B}\x{7D1C}\x{7D1D}\x{7D1E}\x{7D1F}' + . '\x{7D20}\x{7D21}\x{7D22}\x{7D24}\x{7D25}\x{7D26}\x{7D27}\x{7D28}\x{7D29}' + . '\x{7D2B}\x{7D2C}\x{7D2E}\x{7D2F}\x{7D30}\x{7D31}\x{7D32}\x{7D33}\x{7D34}' + . '\x{7D35}\x{7D36}\x{7D37}\x{7D38}\x{7D39}\x{7D3A}\x{7D3B}\x{7D3C}\x{7D3D}' + . '\x{7D3E}\x{7D3F}\x{7D40}\x{7D41}\x{7D42}\x{7D43}\x{7D44}\x{7D45}\x{7D46}' + . '\x{7D47}\x{7D49}\x{7D4A}\x{7D4B}\x{7D4C}\x{7D4E}\x{7D4F}\x{7D50}\x{7D51}' + . '\x{7D52}\x{7D53}\x{7D54}\x{7D55}\x{7D56}\x{7D57}\x{7D58}\x{7D59}\x{7D5B}' + . '\x{7D5C}\x{7D5D}\x{7D5E}\x{7D5F}\x{7D60}\x{7D61}\x{7D62}\x{7D63}\x{7D65}' + . '\x{7D66}\x{7D67}\x{7D68}\x{7D69}\x{7D6A}\x{7D6B}\x{7D6C}\x{7D6D}\x{7D6E}' + . '\x{7D6F}\x{7D70}\x{7D71}\x{7D72}\x{7D73}\x{7D74}\x{7D75}\x{7D76}\x{7D77}' + . '\x{7D79}\x{7D7A}\x{7D7B}\x{7D7C}\x{7D7D}\x{7D7E}\x{7D7F}\x{7D80}\x{7D81}' + . '\x{7D83}\x{7D84}\x{7D85}\x{7D86}\x{7D87}\x{7D88}\x{7D89}\x{7D8A}\x{7D8B}' + . '\x{7D8C}\x{7D8D}\x{7D8E}\x{7D8F}\x{7D90}\x{7D91}\x{7D92}\x{7D93}\x{7D94}' + . '\x{7D96}\x{7D97}\x{7D99}\x{7D9B}\x{7D9C}\x{7D9D}\x{7D9E}\x{7D9F}\x{7DA0}' + . '\x{7DA1}\x{7DA2}\x{7DA3}\x{7DA5}\x{7DA6}\x{7DA7}\x{7DA9}\x{7DAA}\x{7DAB}' + . '\x{7DAC}\x{7DAD}\x{7DAE}\x{7DAF}\x{7DB0}\x{7DB1}\x{7DB2}\x{7DB3}\x{7DB4}' + . '\x{7DB5}\x{7DB6}\x{7DB7}\x{7DB8}\x{7DB9}\x{7DBA}\x{7DBB}\x{7DBC}\x{7DBD}' + . '\x{7DBE}\x{7DBF}\x{7DC0}\x{7DC1}\x{7DC2}\x{7DC3}\x{7DC4}\x{7DC5}\x{7DC6}' + . '\x{7DC7}\x{7DC8}\x{7DC9}\x{7DCA}\x{7DCB}\x{7DCC}\x{7DCE}\x{7DCF}\x{7DD0}' + . '\x{7DD1}\x{7DD2}\x{7DD4}\x{7DD5}\x{7DD6}\x{7DD7}\x{7DD8}\x{7DD9}\x{7DDA}' + . '\x{7DDB}\x{7DDD}\x{7DDE}\x{7DDF}\x{7DE0}\x{7DE1}\x{7DE2}\x{7DE3}\x{7DE6}' + . '\x{7DE7}\x{7DE8}\x{7DE9}\x{7DEA}\x{7DEC}\x{7DED}\x{7DEE}\x{7DEF}\x{7DF0}' + . '\x{7DF1}\x{7DF2}\x{7DF3}\x{7DF4}\x{7DF5}\x{7DF6}\x{7DF7}\x{7DF8}\x{7DF9}' + . '\x{7DFA}\x{7DFB}\x{7DFC}\x{7E00}\x{7E01}\x{7E02}\x{7E03}\x{7E04}\x{7E05}' + . '\x{7E06}\x{7E07}\x{7E08}\x{7E09}\x{7E0A}\x{7E0B}\x{7E0C}\x{7E0D}\x{7E0E}' + . '\x{7E0F}\x{7E10}\x{7E11}\x{7E12}\x{7E13}\x{7E14}\x{7E15}\x{7E16}\x{7E17}' + . '\x{7E19}\x{7E1A}\x{7E1B}\x{7E1C}\x{7E1D}\x{7E1E}\x{7E1F}\x{7E20}\x{7E21}' + . '\x{7E22}\x{7E23}\x{7E24}\x{7E25}\x{7E26}\x{7E27}\x{7E28}\x{7E29}\x{7E2A}' + . '\x{7E2B}\x{7E2C}\x{7E2D}\x{7E2E}\x{7E2F}\x{7E30}\x{7E31}\x{7E32}\x{7E33}' + . '\x{7E34}\x{7E35}\x{7E36}\x{7E37}\x{7E38}\x{7E39}\x{7E3A}\x{7E3B}\x{7E3C}' + . '\x{7E3D}\x{7E3E}\x{7E3F}\x{7E40}\x{7E41}\x{7E42}\x{7E43}\x{7E44}\x{7E45}' + . '\x{7E46}\x{7E47}\x{7E48}\x{7E49}\x{7E4C}\x{7E4D}\x{7E4E}\x{7E4F}\x{7E50}' + . '\x{7E51}\x{7E52}\x{7E53}\x{7E54}\x{7E55}\x{7E56}\x{7E57}\x{7E58}\x{7E59}' + . '\x{7E5A}\x{7E5C}\x{7E5D}\x{7E5E}\x{7E5F}\x{7E60}\x{7E61}\x{7E62}\x{7E63}' + . '\x{7E65}\x{7E66}\x{7E67}\x{7E68}\x{7E69}\x{7E6A}\x{7E6B}\x{7E6C}\x{7E6D}' + . '\x{7E6E}\x{7E6F}\x{7E70}\x{7E71}\x{7E72}\x{7E73}\x{7E74}\x{7E75}\x{7E76}' + . '\x{7E77}\x{7E78}\x{7E79}\x{7E7A}\x{7E7B}\x{7E7C}\x{7E7D}\x{7E7E}\x{7E7F}' + . '\x{7E80}\x{7E81}\x{7E82}\x{7E83}\x{7E84}\x{7E85}\x{7E86}\x{7E87}\x{7E88}' + . '\x{7E89}\x{7E8A}\x{7E8B}\x{7E8C}\x{7E8D}\x{7E8E}\x{7E8F}\x{7E90}\x{7E91}' + . '\x{7E92}\x{7E93}\x{7E94}\x{7E95}\x{7E96}\x{7E97}\x{7E98}\x{7E99}\x{7E9A}' + . '\x{7E9B}\x{7E9C}\x{7E9E}\x{7E9F}\x{7EA0}\x{7EA1}\x{7EA2}\x{7EA3}\x{7EA4}' + . '\x{7EA5}\x{7EA6}\x{7EA7}\x{7EA8}\x{7EA9}\x{7EAA}\x{7EAB}\x{7EAC}\x{7EAD}' + . '\x{7EAE}\x{7EAF}\x{7EB0}\x{7EB1}\x{7EB2}\x{7EB3}\x{7EB4}\x{7EB5}\x{7EB6}' + . '\x{7EB7}\x{7EB8}\x{7EB9}\x{7EBA}\x{7EBB}\x{7EBC}\x{7EBD}\x{7EBE}\x{7EBF}' + . '\x{7EC0}\x{7EC1}\x{7EC2}\x{7EC3}\x{7EC4}\x{7EC5}\x{7EC6}\x{7EC7}\x{7EC8}' + . '\x{7EC9}\x{7ECA}\x{7ECB}\x{7ECC}\x{7ECD}\x{7ECE}\x{7ECF}\x{7ED0}\x{7ED1}' + . '\x{7ED2}\x{7ED3}\x{7ED4}\x{7ED5}\x{7ED6}\x{7ED7}\x{7ED8}\x{7ED9}\x{7EDA}' + . '\x{7EDB}\x{7EDC}\x{7EDD}\x{7EDE}\x{7EDF}\x{7EE0}\x{7EE1}\x{7EE2}\x{7EE3}' + . '\x{7EE4}\x{7EE5}\x{7EE6}\x{7EE7}\x{7EE8}\x{7EE9}\x{7EEA}\x{7EEB}\x{7EEC}' + . '\x{7EED}\x{7EEE}\x{7EEF}\x{7EF0}\x{7EF1}\x{7EF2}\x{7EF3}\x{7EF4}\x{7EF5}' + . '\x{7EF6}\x{7EF7}\x{7EF8}\x{7EF9}\x{7EFA}\x{7EFB}\x{7EFC}\x{7EFD}\x{7EFE}' + . '\x{7EFF}\x{7F00}\x{7F01}\x{7F02}\x{7F03}\x{7F04}\x{7F05}\x{7F06}\x{7F07}' + . '\x{7F08}\x{7F09}\x{7F0A}\x{7F0B}\x{7F0C}\x{7F0D}\x{7F0E}\x{7F0F}\x{7F10}' + . '\x{7F11}\x{7F12}\x{7F13}\x{7F14}\x{7F15}\x{7F16}\x{7F17}\x{7F18}\x{7F19}' + . '\x{7F1A}\x{7F1B}\x{7F1C}\x{7F1D}\x{7F1E}\x{7F1F}\x{7F20}\x{7F21}\x{7F22}' + . '\x{7F23}\x{7F24}\x{7F25}\x{7F26}\x{7F27}\x{7F28}\x{7F29}\x{7F2A}\x{7F2B}' + . '\x{7F2C}\x{7F2D}\x{7F2E}\x{7F2F}\x{7F30}\x{7F31}\x{7F32}\x{7F33}\x{7F34}' + . '\x{7F35}\x{7F36}\x{7F37}\x{7F38}\x{7F39}\x{7F3A}\x{7F3D}\x{7F3E}\x{7F3F}' + . '\x{7F40}\x{7F42}\x{7F43}\x{7F44}\x{7F45}\x{7F47}\x{7F48}\x{7F49}\x{7F4A}' + . '\x{7F4B}\x{7F4C}\x{7F4D}\x{7F4E}\x{7F4F}\x{7F50}\x{7F51}\x{7F52}\x{7F53}' + . '\x{7F54}\x{7F55}\x{7F56}\x{7F57}\x{7F58}\x{7F5A}\x{7F5B}\x{7F5C}\x{7F5D}' + . '\x{7F5E}\x{7F5F}\x{7F60}\x{7F61}\x{7F62}\x{7F63}\x{7F64}\x{7F65}\x{7F66}' + . '\x{7F67}\x{7F68}\x{7F69}\x{7F6A}\x{7F6B}\x{7F6C}\x{7F6D}\x{7F6E}\x{7F6F}' + . '\x{7F70}\x{7F71}\x{7F72}\x{7F73}\x{7F74}\x{7F75}\x{7F76}\x{7F77}\x{7F78}' + . '\x{7F79}\x{7F7A}\x{7F7B}\x{7F7C}\x{7F7D}\x{7F7E}\x{7F7F}\x{7F80}\x{7F81}' + . '\x{7F82}\x{7F83}\x{7F85}\x{7F86}\x{7F87}\x{7F88}\x{7F89}\x{7F8A}\x{7F8B}' + . '\x{7F8C}\x{7F8D}\x{7F8E}\x{7F8F}\x{7F91}\x{7F92}\x{7F93}\x{7F94}\x{7F95}' + . '\x{7F96}\x{7F98}\x{7F9A}\x{7F9B}\x{7F9C}\x{7F9D}\x{7F9E}\x{7F9F}\x{7FA0}' + . '\x{7FA1}\x{7FA2}\x{7FA3}\x{7FA4}\x{7FA5}\x{7FA6}\x{7FA7}\x{7FA8}\x{7FA9}' + . '\x{7FAA}\x{7FAB}\x{7FAC}\x{7FAD}\x{7FAE}\x{7FAF}\x{7FB0}\x{7FB1}\x{7FB2}' + . '\x{7FB3}\x{7FB5}\x{7FB6}\x{7FB7}\x{7FB8}\x{7FB9}\x{7FBA}\x{7FBB}\x{7FBC}' + . '\x{7FBD}\x{7FBE}\x{7FBF}\x{7FC0}\x{7FC1}\x{7FC2}\x{7FC3}\x{7FC4}\x{7FC5}' + . '\x{7FC6}\x{7FC7}\x{7FC8}\x{7FC9}\x{7FCA}\x{7FCB}\x{7FCC}\x{7FCD}\x{7FCE}' + . '\x{7FCF}\x{7FD0}\x{7FD1}\x{7FD2}\x{7FD3}\x{7FD4}\x{7FD5}\x{7FD7}\x{7FD8}' + . '\x{7FD9}\x{7FDA}\x{7FDB}\x{7FDC}\x{7FDE}\x{7FDF}\x{7FE0}\x{7FE1}\x{7FE2}' + . '\x{7FE3}\x{7FE5}\x{7FE6}\x{7FE7}\x{7FE8}\x{7FE9}\x{7FEA}\x{7FEB}\x{7FEC}' + . '\x{7FED}\x{7FEE}\x{7FEF}\x{7FF0}\x{7FF1}\x{7FF2}\x{7FF3}\x{7FF4}\x{7FF5}' + . '\x{7FF6}\x{7FF7}\x{7FF8}\x{7FF9}\x{7FFA}\x{7FFB}\x{7FFC}\x{7FFD}\x{7FFE}' + . '\x{7FFF}\x{8000}\x{8001}\x{8002}\x{8003}\x{8004}\x{8005}\x{8006}\x{8007}' + . '\x{8008}\x{8009}\x{800B}\x{800C}\x{800D}\x{800E}\x{800F}\x{8010}\x{8011}' + . '\x{8012}\x{8013}\x{8014}\x{8015}\x{8016}\x{8017}\x{8018}\x{8019}\x{801A}' + . '\x{801B}\x{801C}\x{801D}\x{801E}\x{801F}\x{8020}\x{8021}\x{8022}\x{8023}' + . '\x{8024}\x{8025}\x{8026}\x{8027}\x{8028}\x{8029}\x{802A}\x{802B}\x{802C}' + . '\x{802D}\x{802E}\x{8030}\x{8031}\x{8032}\x{8033}\x{8034}\x{8035}\x{8036}' + . '\x{8037}\x{8038}\x{8039}\x{803A}\x{803B}\x{803D}\x{803E}\x{803F}\x{8041}' + . '\x{8042}\x{8043}\x{8044}\x{8045}\x{8046}\x{8047}\x{8048}\x{8049}\x{804A}' + . '\x{804B}\x{804C}\x{804D}\x{804E}\x{804F}\x{8050}\x{8051}\x{8052}\x{8053}' + . '\x{8054}\x{8055}\x{8056}\x{8057}\x{8058}\x{8059}\x{805A}\x{805B}\x{805C}' + . '\x{805D}\x{805E}\x{805F}\x{8060}\x{8061}\x{8062}\x{8063}\x{8064}\x{8065}' + . '\x{8067}\x{8068}\x{8069}\x{806A}\x{806B}\x{806C}\x{806D}\x{806E}\x{806F}' + . '\x{8070}\x{8071}\x{8072}\x{8073}\x{8074}\x{8075}\x{8076}\x{8077}\x{8078}' + . '\x{8079}\x{807A}\x{807B}\x{807C}\x{807D}\x{807E}\x{807F}\x{8080}\x{8081}' + . '\x{8082}\x{8083}\x{8084}\x{8085}\x{8086}\x{8087}\x{8089}\x{808A}\x{808B}' + . '\x{808C}\x{808D}\x{808F}\x{8090}\x{8091}\x{8092}\x{8093}\x{8095}\x{8096}' + . '\x{8097}\x{8098}\x{8099}\x{809A}\x{809B}\x{809C}\x{809D}\x{809E}\x{809F}' + . '\x{80A0}\x{80A1}\x{80A2}\x{80A3}\x{80A4}\x{80A5}\x{80A9}\x{80AA}\x{80AB}' + . '\x{80AD}\x{80AE}\x{80AF}\x{80B0}\x{80B1}\x{80B2}\x{80B4}\x{80B5}\x{80B6}' + . '\x{80B7}\x{80B8}\x{80BA}\x{80BB}\x{80BC}\x{80BD}\x{80BE}\x{80BF}\x{80C0}' + . '\x{80C1}\x{80C2}\x{80C3}\x{80C4}\x{80C5}\x{80C6}\x{80C7}\x{80C8}\x{80C9}' + . '\x{80CA}\x{80CB}\x{80CC}\x{80CD}\x{80CE}\x{80CF}\x{80D0}\x{80D1}\x{80D2}' + . '\x{80D3}\x{80D4}\x{80D5}\x{80D6}\x{80D7}\x{80D8}\x{80D9}\x{80DA}\x{80DB}' + . '\x{80DC}\x{80DD}\x{80DE}\x{80E0}\x{80E1}\x{80E2}\x{80E3}\x{80E4}\x{80E5}' + . '\x{80E6}\x{80E7}\x{80E8}\x{80E9}\x{80EA}\x{80EB}\x{80EC}\x{80ED}\x{80EE}' + . '\x{80EF}\x{80F0}\x{80F1}\x{80F2}\x{80F3}\x{80F4}\x{80F5}\x{80F6}\x{80F7}' + . '\x{80F8}\x{80F9}\x{80FA}\x{80FB}\x{80FC}\x{80FD}\x{80FE}\x{80FF}\x{8100}' + . '\x{8101}\x{8102}\x{8105}\x{8106}\x{8107}\x{8108}\x{8109}\x{810A}\x{810B}' + . '\x{810C}\x{810D}\x{810E}\x{810F}\x{8110}\x{8111}\x{8112}\x{8113}\x{8114}' + . '\x{8115}\x{8116}\x{8118}\x{8119}\x{811A}\x{811B}\x{811C}\x{811D}\x{811E}' + . '\x{811F}\x{8120}\x{8121}\x{8122}\x{8123}\x{8124}\x{8125}\x{8126}\x{8127}' + . '\x{8128}\x{8129}\x{812A}\x{812B}\x{812C}\x{812D}\x{812E}\x{812F}\x{8130}' + . '\x{8131}\x{8132}\x{8136}\x{8137}\x{8138}\x{8139}\x{813A}\x{813B}\x{813C}' + . '\x{813D}\x{813E}\x{813F}\x{8140}\x{8141}\x{8142}\x{8143}\x{8144}\x{8145}' + . '\x{8146}\x{8147}\x{8148}\x{8149}\x{814A}\x{814B}\x{814C}\x{814D}\x{814E}' + . '\x{814F}\x{8150}\x{8151}\x{8152}\x{8153}\x{8154}\x{8155}\x{8156}\x{8157}' + . '\x{8158}\x{8159}\x{815A}\x{815B}\x{815C}\x{815D}\x{815E}\x{8160}\x{8161}' + . '\x{8162}\x{8163}\x{8164}\x{8165}\x{8166}\x{8167}\x{8168}\x{8169}\x{816A}' + . '\x{816B}\x{816C}\x{816D}\x{816E}\x{816F}\x{8170}\x{8171}\x{8172}\x{8173}' + . '\x{8174}\x{8175}\x{8176}\x{8177}\x{8178}\x{8179}\x{817A}\x{817B}\x{817C}' + . '\x{817D}\x{817E}\x{817F}\x{8180}\x{8181}\x{8182}\x{8183}\x{8185}\x{8186}' + . '\x{8187}\x{8188}\x{8189}\x{818A}\x{818B}\x{818C}\x{818D}\x{818E}\x{818F}' + . '\x{8191}\x{8192}\x{8193}\x{8194}\x{8195}\x{8197}\x{8198}\x{8199}\x{819A}' + . '\x{819B}\x{819C}\x{819D}\x{819E}\x{819F}\x{81A0}\x{81A1}\x{81A2}\x{81A3}' + . '\x{81A4}\x{81A5}\x{81A6}\x{81A7}\x{81A8}\x{81A9}\x{81AA}\x{81AB}\x{81AC}' + . '\x{81AD}\x{81AE}\x{81AF}\x{81B0}\x{81B1}\x{81B2}\x{81B3}\x{81B4}\x{81B5}' + . '\x{81B6}\x{81B7}\x{81B8}\x{81B9}\x{81BA}\x{81BB}\x{81BC}\x{81BD}\x{81BE}' + . '\x{81BF}\x{81C0}\x{81C1}\x{81C2}\x{81C3}\x{81C4}\x{81C5}\x{81C6}\x{81C7}' + . '\x{81C8}\x{81C9}\x{81CA}\x{81CC}\x{81CD}\x{81CE}\x{81CF}\x{81D0}\x{81D1}' + . '\x{81D2}\x{81D4}\x{81D5}\x{81D6}\x{81D7}\x{81D8}\x{81D9}\x{81DA}\x{81DB}' + . '\x{81DC}\x{81DD}\x{81DE}\x{81DF}\x{81E0}\x{81E1}\x{81E2}\x{81E3}\x{81E5}' + . '\x{81E6}\x{81E7}\x{81E8}\x{81E9}\x{81EA}\x{81EB}\x{81EC}\x{81ED}\x{81EE}' + . '\x{81F1}\x{81F2}\x{81F3}\x{81F4}\x{81F5}\x{81F6}\x{81F7}\x{81F8}\x{81F9}' + . '\x{81FA}\x{81FB}\x{81FC}\x{81FD}\x{81FE}\x{81FF}\x{8200}\x{8201}\x{8202}' + . '\x{8203}\x{8204}\x{8205}\x{8206}\x{8207}\x{8208}\x{8209}\x{820A}\x{820B}' + . '\x{820C}\x{820D}\x{820E}\x{820F}\x{8210}\x{8211}\x{8212}\x{8214}\x{8215}' + . '\x{8216}\x{8218}\x{8219}\x{821A}\x{821B}\x{821C}\x{821D}\x{821E}\x{821F}' + . '\x{8220}\x{8221}\x{8222}\x{8223}\x{8225}\x{8226}\x{8227}\x{8228}\x{8229}' + . '\x{822A}\x{822B}\x{822C}\x{822D}\x{822F}\x{8230}\x{8231}\x{8232}\x{8233}' + . '\x{8234}\x{8235}\x{8236}\x{8237}\x{8238}\x{8239}\x{823A}\x{823B}\x{823C}' + . '\x{823D}\x{823E}\x{823F}\x{8240}\x{8242}\x{8243}\x{8244}\x{8245}\x{8246}' + . '\x{8247}\x{8248}\x{8249}\x{824A}\x{824B}\x{824C}\x{824D}\x{824E}\x{824F}' + . '\x{8250}\x{8251}\x{8252}\x{8253}\x{8254}\x{8255}\x{8256}\x{8257}\x{8258}' + . '\x{8259}\x{825A}\x{825B}\x{825C}\x{825D}\x{825E}\x{825F}\x{8260}\x{8261}' + . '\x{8263}\x{8264}\x{8266}\x{8267}\x{8268}\x{8269}\x{826A}\x{826B}\x{826C}' + . '\x{826D}\x{826E}\x{826F}\x{8270}\x{8271}\x{8272}\x{8273}\x{8274}\x{8275}' + . '\x{8276}\x{8277}\x{8278}\x{8279}\x{827A}\x{827B}\x{827C}\x{827D}\x{827E}' + . '\x{827F}\x{8280}\x{8281}\x{8282}\x{8283}\x{8284}\x{8285}\x{8286}\x{8287}' + . '\x{8288}\x{8289}\x{828A}\x{828B}\x{828D}\x{828E}\x{828F}\x{8290}\x{8291}' + . '\x{8292}\x{8293}\x{8294}\x{8295}\x{8296}\x{8297}\x{8298}\x{8299}\x{829A}' + . '\x{829B}\x{829C}\x{829D}\x{829E}\x{829F}\x{82A0}\x{82A1}\x{82A2}\x{82A3}' + . '\x{82A4}\x{82A5}\x{82A6}\x{82A7}\x{82A8}\x{82A9}\x{82AA}\x{82AB}\x{82AC}' + . '\x{82AD}\x{82AE}\x{82AF}\x{82B0}\x{82B1}\x{82B3}\x{82B4}\x{82B5}\x{82B6}' + . '\x{82B7}\x{82B8}\x{82B9}\x{82BA}\x{82BB}\x{82BC}\x{82BD}\x{82BE}\x{82BF}' + . '\x{82C0}\x{82C1}\x{82C2}\x{82C3}\x{82C4}\x{82C5}\x{82C6}\x{82C7}\x{82C8}' + . '\x{82C9}\x{82CA}\x{82CB}\x{82CC}\x{82CD}\x{82CE}\x{82CF}\x{82D0}\x{82D1}' + . '\x{82D2}\x{82D3}\x{82D4}\x{82D5}\x{82D6}\x{82D7}\x{82D8}\x{82D9}\x{82DA}' + . '\x{82DB}\x{82DC}\x{82DD}\x{82DE}\x{82DF}\x{82E0}\x{82E1}\x{82E3}\x{82E4}' + . '\x{82E5}\x{82E6}\x{82E7}\x{82E8}\x{82E9}\x{82EA}\x{82EB}\x{82EC}\x{82ED}' + . '\x{82EE}\x{82EF}\x{82F0}\x{82F1}\x{82F2}\x{82F3}\x{82F4}\x{82F5}\x{82F6}' + . '\x{82F7}\x{82F8}\x{82F9}\x{82FA}\x{82FB}\x{82FD}\x{82FE}\x{82FF}\x{8300}' + . '\x{8301}\x{8302}\x{8303}\x{8304}\x{8305}\x{8306}\x{8307}\x{8308}\x{8309}' + . '\x{830B}\x{830C}\x{830D}\x{830E}\x{830F}\x{8311}\x{8312}\x{8313}\x{8314}' + . '\x{8315}\x{8316}\x{8317}\x{8318}\x{8319}\x{831A}\x{831B}\x{831C}\x{831D}' + . '\x{831E}\x{831F}\x{8320}\x{8321}\x{8322}\x{8323}\x{8324}\x{8325}\x{8326}' + . '\x{8327}\x{8328}\x{8329}\x{832A}\x{832B}\x{832C}\x{832D}\x{832E}\x{832F}' + . '\x{8331}\x{8332}\x{8333}\x{8334}\x{8335}\x{8336}\x{8337}\x{8338}\x{8339}' + . '\x{833A}\x{833B}\x{833C}\x{833D}\x{833E}\x{833F}\x{8340}\x{8341}\x{8342}' + . '\x{8343}\x{8344}\x{8345}\x{8346}\x{8347}\x{8348}\x{8349}\x{834A}\x{834B}' + . '\x{834C}\x{834D}\x{834E}\x{834F}\x{8350}\x{8351}\x{8352}\x{8353}\x{8354}' + . '\x{8356}\x{8357}\x{8358}\x{8359}\x{835A}\x{835B}\x{835C}\x{835D}\x{835E}' + . '\x{835F}\x{8360}\x{8361}\x{8362}\x{8363}\x{8364}\x{8365}\x{8366}\x{8367}' + . '\x{8368}\x{8369}\x{836A}\x{836B}\x{836C}\x{836D}\x{836E}\x{836F}\x{8370}' + . '\x{8371}\x{8372}\x{8373}\x{8374}\x{8375}\x{8376}\x{8377}\x{8378}\x{8379}' + . '\x{837A}\x{837B}\x{837C}\x{837D}\x{837E}\x{837F}\x{8380}\x{8381}\x{8382}' + . '\x{8383}\x{8384}\x{8385}\x{8386}\x{8387}\x{8388}\x{8389}\x{838A}\x{838B}' + . '\x{838C}\x{838D}\x{838E}\x{838F}\x{8390}\x{8391}\x{8392}\x{8393}\x{8394}' + . '\x{8395}\x{8396}\x{8397}\x{8398}\x{8399}\x{839A}\x{839B}\x{839C}\x{839D}' + . '\x{839E}\x{83A0}\x{83A1}\x{83A2}\x{83A3}\x{83A4}\x{83A5}\x{83A6}\x{83A7}' + . '\x{83A8}\x{83A9}\x{83AA}\x{83AB}\x{83AC}\x{83AD}\x{83AE}\x{83AF}\x{83B0}' + . '\x{83B1}\x{83B2}\x{83B3}\x{83B4}\x{83B6}\x{83B7}\x{83B8}\x{83B9}\x{83BA}' + . '\x{83BB}\x{83BC}\x{83BD}\x{83BF}\x{83C0}\x{83C1}\x{83C2}\x{83C3}\x{83C4}' + . '\x{83C5}\x{83C6}\x{83C7}\x{83C8}\x{83C9}\x{83CA}\x{83CB}\x{83CC}\x{83CD}' + . '\x{83CE}\x{83CF}\x{83D0}\x{83D1}\x{83D2}\x{83D3}\x{83D4}\x{83D5}\x{83D6}' + . '\x{83D7}\x{83D8}\x{83D9}\x{83DA}\x{83DB}\x{83DC}\x{83DD}\x{83DE}\x{83DF}' + . '\x{83E0}\x{83E1}\x{83E2}\x{83E3}\x{83E4}\x{83E5}\x{83E7}\x{83E8}\x{83E9}' + . '\x{83EA}\x{83EB}\x{83EC}\x{83EE}\x{83EF}\x{83F0}\x{83F1}\x{83F2}\x{83F3}' + . '\x{83F4}\x{83F5}\x{83F6}\x{83F7}\x{83F8}\x{83F9}\x{83FA}\x{83FB}\x{83FC}' + . '\x{83FD}\x{83FE}\x{83FF}\x{8400}\x{8401}\x{8402}\x{8403}\x{8404}\x{8405}' + . '\x{8406}\x{8407}\x{8408}\x{8409}\x{840A}\x{840B}\x{840C}\x{840D}\x{840E}' + . '\x{840F}\x{8410}\x{8411}\x{8412}\x{8413}\x{8415}\x{8418}\x{8419}\x{841A}' + . '\x{841B}\x{841C}\x{841D}\x{841E}\x{8421}\x{8422}\x{8423}\x{8424}\x{8425}' + . '\x{8426}\x{8427}\x{8428}\x{8429}\x{842A}\x{842B}\x{842C}\x{842D}\x{842E}' + . '\x{842F}\x{8430}\x{8431}\x{8432}\x{8433}\x{8434}\x{8435}\x{8436}\x{8437}' + . '\x{8438}\x{8439}\x{843A}\x{843B}\x{843C}\x{843D}\x{843E}\x{843F}\x{8440}' + . '\x{8441}\x{8442}\x{8443}\x{8444}\x{8445}\x{8446}\x{8447}\x{8448}\x{8449}' + . '\x{844A}\x{844B}\x{844C}\x{844D}\x{844E}\x{844F}\x{8450}\x{8451}\x{8452}' + . '\x{8453}\x{8454}\x{8455}\x{8456}\x{8457}\x{8459}\x{845A}\x{845B}\x{845C}' + . '\x{845D}\x{845E}\x{845F}\x{8460}\x{8461}\x{8462}\x{8463}\x{8464}\x{8465}' + . '\x{8466}\x{8467}\x{8468}\x{8469}\x{846A}\x{846B}\x{846C}\x{846D}\x{846E}' + . '\x{846F}\x{8470}\x{8471}\x{8472}\x{8473}\x{8474}\x{8475}\x{8476}\x{8477}' + . '\x{8478}\x{8479}\x{847A}\x{847B}\x{847C}\x{847D}\x{847E}\x{847F}\x{8480}' + . '\x{8481}\x{8482}\x{8484}\x{8485}\x{8486}\x{8487}\x{8488}\x{8489}\x{848A}' + . '\x{848B}\x{848C}\x{848D}\x{848E}\x{848F}\x{8490}\x{8491}\x{8492}\x{8493}' + . '\x{8494}\x{8496}\x{8497}\x{8498}\x{8499}\x{849A}\x{849B}\x{849C}\x{849D}' + . '\x{849E}\x{849F}\x{84A0}\x{84A1}\x{84A2}\x{84A3}\x{84A4}\x{84A5}\x{84A6}' + . '\x{84A7}\x{84A8}\x{84A9}\x{84AA}\x{84AB}\x{84AC}\x{84AE}\x{84AF}\x{84B0}' + . '\x{84B1}\x{84B2}\x{84B3}\x{84B4}\x{84B5}\x{84B6}\x{84B8}\x{84B9}\x{84BA}' + . '\x{84BB}\x{84BC}\x{84BD}\x{84BE}\x{84BF}\x{84C0}\x{84C1}\x{84C2}\x{84C4}' + . '\x{84C5}\x{84C6}\x{84C7}\x{84C8}\x{84C9}\x{84CA}\x{84CB}\x{84CC}\x{84CD}' + . '\x{84CE}\x{84CF}\x{84D0}\x{84D1}\x{84D2}\x{84D3}\x{84D4}\x{84D5}\x{84D6}' + . '\x{84D7}\x{84D8}\x{84D9}\x{84DB}\x{84DC}\x{84DD}\x{84DE}\x{84DF}\x{84E0}' + . '\x{84E1}\x{84E2}\x{84E3}\x{84E4}\x{84E5}\x{84E6}\x{84E7}\x{84E8}\x{84E9}' + . '\x{84EA}\x{84EB}\x{84EC}\x{84EE}\x{84EF}\x{84F0}\x{84F1}\x{84F2}\x{84F3}' + . '\x{84F4}\x{84F5}\x{84F6}\x{84F7}\x{84F8}\x{84F9}\x{84FA}\x{84FB}\x{84FC}' + . '\x{84FD}\x{84FE}\x{84FF}\x{8500}\x{8501}\x{8502}\x{8503}\x{8504}\x{8506}' + . '\x{8507}\x{8508}\x{8509}\x{850A}\x{850B}\x{850C}\x{850D}\x{850E}\x{850F}' + . '\x{8511}\x{8512}\x{8513}\x{8514}\x{8515}\x{8516}\x{8517}\x{8518}\x{8519}' + . '\x{851A}\x{851B}\x{851C}\x{851D}\x{851E}\x{851F}\x{8520}\x{8521}\x{8522}' + . '\x{8523}\x{8524}\x{8525}\x{8526}\x{8527}\x{8528}\x{8529}\x{852A}\x{852B}' + . '\x{852C}\x{852D}\x{852E}\x{852F}\x{8530}\x{8531}\x{8534}\x{8535}\x{8536}' + . '\x{8537}\x{8538}\x{8539}\x{853A}\x{853B}\x{853C}\x{853D}\x{853E}\x{853F}' + . '\x{8540}\x{8541}\x{8542}\x{8543}\x{8544}\x{8545}\x{8546}\x{8547}\x{8548}' + . '\x{8549}\x{854A}\x{854B}\x{854D}\x{854E}\x{854F}\x{8551}\x{8552}\x{8553}' + . '\x{8554}\x{8555}\x{8556}\x{8557}\x{8558}\x{8559}\x{855A}\x{855B}\x{855C}' + . '\x{855D}\x{855E}\x{855F}\x{8560}\x{8561}\x{8562}\x{8563}\x{8564}\x{8565}' + . '\x{8566}\x{8567}\x{8568}\x{8569}\x{856A}\x{856B}\x{856C}\x{856D}\x{856E}' + . '\x{856F}\x{8570}\x{8571}\x{8572}\x{8573}\x{8574}\x{8575}\x{8576}\x{8577}' + . '\x{8578}\x{8579}\x{857A}\x{857B}\x{857C}\x{857D}\x{857E}\x{8580}\x{8581}' + . '\x{8582}\x{8583}\x{8584}\x{8585}\x{8586}\x{8587}\x{8588}\x{8589}\x{858A}' + . '\x{858B}\x{858C}\x{858D}\x{858E}\x{858F}\x{8590}\x{8591}\x{8592}\x{8594}' + . '\x{8595}\x{8596}\x{8598}\x{8599}\x{859A}\x{859B}\x{859C}\x{859D}\x{859E}' + . '\x{859F}\x{85A0}\x{85A1}\x{85A2}\x{85A3}\x{85A4}\x{85A5}\x{85A6}\x{85A7}' + . '\x{85A8}\x{85A9}\x{85AA}\x{85AB}\x{85AC}\x{85AD}\x{85AE}\x{85AF}\x{85B0}' + . '\x{85B1}\x{85B3}\x{85B4}\x{85B5}\x{85B6}\x{85B7}\x{85B8}\x{85B9}\x{85BA}' + . '\x{85BC}\x{85BD}\x{85BE}\x{85BF}\x{85C0}\x{85C1}\x{85C2}\x{85C3}\x{85C4}' + . '\x{85C5}\x{85C6}\x{85C7}\x{85C8}\x{85C9}\x{85CA}\x{85CB}\x{85CD}\x{85CE}' + . '\x{85CF}\x{85D0}\x{85D1}\x{85D2}\x{85D3}\x{85D4}\x{85D5}\x{85D6}\x{85D7}' + . '\x{85D8}\x{85D9}\x{85DA}\x{85DB}\x{85DC}\x{85DD}\x{85DE}\x{85DF}\x{85E0}' + . '\x{85E1}\x{85E2}\x{85E3}\x{85E4}\x{85E5}\x{85E6}\x{85E7}\x{85E8}\x{85E9}' + . '\x{85EA}\x{85EB}\x{85EC}\x{85ED}\x{85EF}\x{85F0}\x{85F1}\x{85F2}\x{85F4}' + . '\x{85F5}\x{85F6}\x{85F7}\x{85F8}\x{85F9}\x{85FA}\x{85FB}\x{85FD}\x{85FE}' + . '\x{85FF}\x{8600}\x{8601}\x{8602}\x{8604}\x{8605}\x{8606}\x{8607}\x{8608}' + . '\x{8609}\x{860A}\x{860B}\x{860C}\x{860F}\x{8611}\x{8612}\x{8613}\x{8614}' + . '\x{8616}\x{8617}\x{8618}\x{8619}\x{861A}\x{861B}\x{861C}\x{861E}\x{861F}' + . '\x{8620}\x{8621}\x{8622}\x{8623}\x{8624}\x{8625}\x{8626}\x{8627}\x{8628}' + . '\x{8629}\x{862A}\x{862B}\x{862C}\x{862D}\x{862E}\x{862F}\x{8630}\x{8631}' + . '\x{8632}\x{8633}\x{8634}\x{8635}\x{8636}\x{8638}\x{8639}\x{863A}\x{863B}' + . '\x{863C}\x{863D}\x{863E}\x{863F}\x{8640}\x{8641}\x{8642}\x{8643}\x{8644}' + . '\x{8645}\x{8646}\x{8647}\x{8648}\x{8649}\x{864A}\x{864B}\x{864C}\x{864D}' + . '\x{864E}\x{864F}\x{8650}\x{8651}\x{8652}\x{8653}\x{8654}\x{8655}\x{8656}' + . '\x{8658}\x{8659}\x{865A}\x{865B}\x{865C}\x{865D}\x{865E}\x{865F}\x{8660}' + . '\x{8661}\x{8662}\x{8663}\x{8664}\x{8665}\x{8666}\x{8667}\x{8668}\x{8669}' + . '\x{866A}\x{866B}\x{866C}\x{866D}\x{866E}\x{866F}\x{8670}\x{8671}\x{8672}' + . '\x{8673}\x{8674}\x{8676}\x{8677}\x{8678}\x{8679}\x{867A}\x{867B}\x{867C}' + . '\x{867D}\x{867E}\x{867F}\x{8680}\x{8681}\x{8682}\x{8683}\x{8684}\x{8685}' + . '\x{8686}\x{8687}\x{8688}\x{868A}\x{868B}\x{868C}\x{868D}\x{868E}\x{868F}' + . '\x{8690}\x{8691}\x{8693}\x{8694}\x{8695}\x{8696}\x{8697}\x{8698}\x{8699}' + . '\x{869A}\x{869B}\x{869C}\x{869D}\x{869E}\x{869F}\x{86A1}\x{86A2}\x{86A3}' + . '\x{86A4}\x{86A5}\x{86A7}\x{86A8}\x{86A9}\x{86AA}\x{86AB}\x{86AC}\x{86AD}' + . '\x{86AE}\x{86AF}\x{86B0}\x{86B1}\x{86B2}\x{86B3}\x{86B4}\x{86B5}\x{86B6}' + . '\x{86B7}\x{86B8}\x{86B9}\x{86BA}\x{86BB}\x{86BC}\x{86BD}\x{86BE}\x{86BF}' + . '\x{86C0}\x{86C1}\x{86C2}\x{86C3}\x{86C4}\x{86C5}\x{86C6}\x{86C7}\x{86C8}' + . '\x{86C9}\x{86CA}\x{86CB}\x{86CC}\x{86CE}\x{86CF}\x{86D0}\x{86D1}\x{86D2}' + . '\x{86D3}\x{86D4}\x{86D6}\x{86D7}\x{86D8}\x{86D9}\x{86DA}\x{86DB}\x{86DC}' + . '\x{86DD}\x{86DE}\x{86DF}\x{86E1}\x{86E2}\x{86E3}\x{86E4}\x{86E5}\x{86E6}' + . '\x{86E8}\x{86E9}\x{86EA}\x{86EB}\x{86EC}\x{86ED}\x{86EE}\x{86EF}\x{86F0}' + . '\x{86F1}\x{86F2}\x{86F3}\x{86F4}\x{86F5}\x{86F6}\x{86F7}\x{86F8}\x{86F9}' + . '\x{86FA}\x{86FB}\x{86FC}\x{86FE}\x{86FF}\x{8700}\x{8701}\x{8702}\x{8703}' + . '\x{8704}\x{8705}\x{8706}\x{8707}\x{8708}\x{8709}\x{870A}\x{870B}\x{870C}' + . '\x{870D}\x{870E}\x{870F}\x{8710}\x{8711}\x{8712}\x{8713}\x{8714}\x{8715}' + . '\x{8716}\x{8717}\x{8718}\x{8719}\x{871A}\x{871B}\x{871C}\x{871E}\x{871F}' + . '\x{8720}\x{8721}\x{8722}\x{8723}\x{8724}\x{8725}\x{8726}\x{8727}\x{8728}' + . '\x{8729}\x{872A}\x{872B}\x{872C}\x{872D}\x{872E}\x{8730}\x{8731}\x{8732}' + . '\x{8733}\x{8734}\x{8735}\x{8736}\x{8737}\x{8738}\x{8739}\x{873A}\x{873B}' + . '\x{873C}\x{873E}\x{873F}\x{8740}\x{8741}\x{8742}\x{8743}\x{8744}\x{8746}' + . '\x{8747}\x{8748}\x{8749}\x{874A}\x{874C}\x{874D}\x{874E}\x{874F}\x{8750}' + . '\x{8751}\x{8752}\x{8753}\x{8754}\x{8755}\x{8756}\x{8757}\x{8758}\x{8759}' + . '\x{875A}\x{875B}\x{875C}\x{875D}\x{875E}\x{875F}\x{8760}\x{8761}\x{8762}' + . '\x{8763}\x{8764}\x{8765}\x{8766}\x{8767}\x{8768}\x{8769}\x{876A}\x{876B}' + . '\x{876C}\x{876D}\x{876E}\x{876F}\x{8770}\x{8772}\x{8773}\x{8774}\x{8775}' + . '\x{8776}\x{8777}\x{8778}\x{8779}\x{877A}\x{877B}\x{877C}\x{877D}\x{877E}' + . '\x{8780}\x{8781}\x{8782}\x{8783}\x{8784}\x{8785}\x{8786}\x{8787}\x{8788}' + . '\x{8789}\x{878A}\x{878B}\x{878C}\x{878D}\x{878F}\x{8790}\x{8791}\x{8792}' + . '\x{8793}\x{8794}\x{8795}\x{8796}\x{8797}\x{8798}\x{879A}\x{879B}\x{879C}' + . '\x{879D}\x{879E}\x{879F}\x{87A0}\x{87A1}\x{87A2}\x{87A3}\x{87A4}\x{87A5}' + . '\x{87A6}\x{87A7}\x{87A8}\x{87A9}\x{87AA}\x{87AB}\x{87AC}\x{87AD}\x{87AE}' + . '\x{87AF}\x{87B0}\x{87B1}\x{87B2}\x{87B3}\x{87B4}\x{87B5}\x{87B6}\x{87B7}' + . '\x{87B8}\x{87B9}\x{87BA}\x{87BB}\x{87BC}\x{87BD}\x{87BE}\x{87BF}\x{87C0}' + . '\x{87C1}\x{87C2}\x{87C3}\x{87C4}\x{87C5}\x{87C6}\x{87C7}\x{87C8}\x{87C9}' + . '\x{87CA}\x{87CB}\x{87CC}\x{87CD}\x{87CE}\x{87CF}\x{87D0}\x{87D1}\x{87D2}' + . '\x{87D3}\x{87D4}\x{87D5}\x{87D6}\x{87D7}\x{87D8}\x{87D9}\x{87DB}\x{87DC}' + . '\x{87DD}\x{87DE}\x{87DF}\x{87E0}\x{87E1}\x{87E2}\x{87E3}\x{87E4}\x{87E5}' + . '\x{87E6}\x{87E7}\x{87E8}\x{87E9}\x{87EA}\x{87EB}\x{87EC}\x{87ED}\x{87EE}' + . '\x{87EF}\x{87F1}\x{87F2}\x{87F3}\x{87F4}\x{87F5}\x{87F6}\x{87F7}\x{87F8}' + . '\x{87F9}\x{87FA}\x{87FB}\x{87FC}\x{87FD}\x{87FE}\x{87FF}\x{8800}\x{8801}' + . '\x{8802}\x{8803}\x{8804}\x{8805}\x{8806}\x{8808}\x{8809}\x{880A}\x{880B}' + . '\x{880C}\x{880D}\x{880E}\x{880F}\x{8810}\x{8811}\x{8813}\x{8814}\x{8815}' + . '\x{8816}\x{8817}\x{8818}\x{8819}\x{881A}\x{881B}\x{881C}\x{881D}\x{881E}' + . '\x{881F}\x{8820}\x{8821}\x{8822}\x{8823}\x{8824}\x{8825}\x{8826}\x{8827}' + . '\x{8828}\x{8829}\x{882A}\x{882B}\x{882C}\x{882E}\x{882F}\x{8830}\x{8831}' + . '\x{8832}\x{8833}\x{8834}\x{8835}\x{8836}\x{8837}\x{8838}\x{8839}\x{883B}' + . '\x{883C}\x{883D}\x{883E}\x{883F}\x{8840}\x{8841}\x{8842}\x{8843}\x{8844}' + . '\x{8845}\x{8846}\x{8848}\x{8849}\x{884A}\x{884B}\x{884C}\x{884D}\x{884E}' + . '\x{884F}\x{8850}\x{8851}\x{8852}\x{8853}\x{8854}\x{8855}\x{8856}\x{8857}' + . '\x{8859}\x{885A}\x{885B}\x{885D}\x{885E}\x{8860}\x{8861}\x{8862}\x{8863}' + . '\x{8864}\x{8865}\x{8866}\x{8867}\x{8868}\x{8869}\x{886A}\x{886B}\x{886C}' + . '\x{886D}\x{886E}\x{886F}\x{8870}\x{8871}\x{8872}\x{8873}\x{8874}\x{8875}' + . '\x{8876}\x{8877}\x{8878}\x{8879}\x{887B}\x{887C}\x{887D}\x{887E}\x{887F}' + . '\x{8880}\x{8881}\x{8882}\x{8883}\x{8884}\x{8885}\x{8886}\x{8887}\x{8888}' + . '\x{8889}\x{888A}\x{888B}\x{888C}\x{888D}\x{888E}\x{888F}\x{8890}\x{8891}' + . '\x{8892}\x{8893}\x{8894}\x{8895}\x{8896}\x{8897}\x{8898}\x{8899}\x{889A}' + . '\x{889B}\x{889C}\x{889D}\x{889E}\x{889F}\x{88A0}\x{88A1}\x{88A2}\x{88A3}' + . '\x{88A4}\x{88A5}\x{88A6}\x{88A7}\x{88A8}\x{88A9}\x{88AA}\x{88AB}\x{88AC}' + . '\x{88AD}\x{88AE}\x{88AF}\x{88B0}\x{88B1}\x{88B2}\x{88B3}\x{88B4}\x{88B6}' + . '\x{88B7}\x{88B8}\x{88B9}\x{88BA}\x{88BB}\x{88BC}\x{88BD}\x{88BE}\x{88BF}' + . '\x{88C0}\x{88C1}\x{88C2}\x{88C3}\x{88C4}\x{88C5}\x{88C6}\x{88C7}\x{88C8}' + . '\x{88C9}\x{88CA}\x{88CB}\x{88CC}\x{88CD}\x{88CE}\x{88CF}\x{88D0}\x{88D1}' + . '\x{88D2}\x{88D3}\x{88D4}\x{88D5}\x{88D6}\x{88D7}\x{88D8}\x{88D9}\x{88DA}' + . '\x{88DB}\x{88DC}\x{88DD}\x{88DE}\x{88DF}\x{88E0}\x{88E1}\x{88E2}\x{88E3}' + . '\x{88E4}\x{88E5}\x{88E7}\x{88E8}\x{88EA}\x{88EB}\x{88EC}\x{88EE}\x{88EF}' + . '\x{88F0}\x{88F1}\x{88F2}\x{88F3}\x{88F4}\x{88F5}\x{88F6}\x{88F7}\x{88F8}' + . '\x{88F9}\x{88FA}\x{88FB}\x{88FC}\x{88FD}\x{88FE}\x{88FF}\x{8900}\x{8901}' + . '\x{8902}\x{8904}\x{8905}\x{8906}\x{8907}\x{8908}\x{8909}\x{890A}\x{890B}' + . '\x{890C}\x{890D}\x{890E}\x{8910}\x{8911}\x{8912}\x{8913}\x{8914}\x{8915}' + . '\x{8916}\x{8917}\x{8918}\x{8919}\x{891A}\x{891B}\x{891C}\x{891D}\x{891E}' + . '\x{891F}\x{8920}\x{8921}\x{8922}\x{8923}\x{8925}\x{8926}\x{8927}\x{8928}' + . '\x{8929}\x{892A}\x{892B}\x{892C}\x{892D}\x{892E}\x{892F}\x{8930}\x{8931}' + . '\x{8932}\x{8933}\x{8934}\x{8935}\x{8936}\x{8937}\x{8938}\x{8939}\x{893A}' + . '\x{893B}\x{893C}\x{893D}\x{893E}\x{893F}\x{8940}\x{8941}\x{8942}\x{8943}' + . '\x{8944}\x{8945}\x{8946}\x{8947}\x{8948}\x{8949}\x{894A}\x{894B}\x{894C}' + . '\x{894E}\x{894F}\x{8950}\x{8951}\x{8952}\x{8953}\x{8954}\x{8955}\x{8956}' + . '\x{8957}\x{8958}\x{8959}\x{895A}\x{895B}\x{895C}\x{895D}\x{895E}\x{895F}' + . '\x{8960}\x{8961}\x{8962}\x{8963}\x{8964}\x{8966}\x{8967}\x{8968}\x{8969}' + . '\x{896A}\x{896B}\x{896C}\x{896D}\x{896E}\x{896F}\x{8970}\x{8971}\x{8972}' + . '\x{8973}\x{8974}\x{8976}\x{8977}\x{8978}\x{8979}\x{897A}\x{897B}\x{897C}' + . '\x{897E}\x{897F}\x{8980}\x{8981}\x{8982}\x{8983}\x{8984}\x{8985}\x{8986}' + . '\x{8987}\x{8988}\x{8989}\x{898A}\x{898B}\x{898C}\x{898E}\x{898F}\x{8991}' + . '\x{8992}\x{8993}\x{8995}\x{8996}\x{8997}\x{8998}\x{899A}\x{899B}\x{899C}' + . '\x{899D}\x{899E}\x{899F}\x{89A0}\x{89A1}\x{89A2}\x{89A3}\x{89A4}\x{89A5}' + . '\x{89A6}\x{89A7}\x{89A8}\x{89AA}\x{89AB}\x{89AC}\x{89AD}\x{89AE}\x{89AF}' + . '\x{89B1}\x{89B2}\x{89B3}\x{89B5}\x{89B6}\x{89B7}\x{89B8}\x{89B9}\x{89BA}' + . '\x{89BD}\x{89BE}\x{89BF}\x{89C0}\x{89C1}\x{89C2}\x{89C3}\x{89C4}\x{89C5}' + . '\x{89C6}\x{89C7}\x{89C8}\x{89C9}\x{89CA}\x{89CB}\x{89CC}\x{89CD}\x{89CE}' + . '\x{89CF}\x{89D0}\x{89D1}\x{89D2}\x{89D3}\x{89D4}\x{89D5}\x{89D6}\x{89D7}' + . '\x{89D8}\x{89D9}\x{89DA}\x{89DB}\x{89DC}\x{89DD}\x{89DE}\x{89DF}\x{89E0}' + . '\x{89E1}\x{89E2}\x{89E3}\x{89E4}\x{89E5}\x{89E6}\x{89E7}\x{89E8}\x{89E9}' + . '\x{89EA}\x{89EB}\x{89EC}\x{89ED}\x{89EF}\x{89F0}\x{89F1}\x{89F2}\x{89F3}' + . '\x{89F4}\x{89F6}\x{89F7}\x{89F8}\x{89FA}\x{89FB}\x{89FC}\x{89FE}\x{89FF}' + . '\x{8A00}\x{8A01}\x{8A02}\x{8A03}\x{8A04}\x{8A07}\x{8A08}\x{8A09}\x{8A0A}' + . '\x{8A0B}\x{8A0C}\x{8A0D}\x{8A0E}\x{8A0F}\x{8A10}\x{8A11}\x{8A12}\x{8A13}' + . '\x{8A15}\x{8A16}\x{8A17}\x{8A18}\x{8A1A}\x{8A1B}\x{8A1C}\x{8A1D}\x{8A1E}' + . '\x{8A1F}\x{8A22}\x{8A23}\x{8A24}\x{8A25}\x{8A26}\x{8A27}\x{8A28}\x{8A29}' + . '\x{8A2A}\x{8A2C}\x{8A2D}\x{8A2E}\x{8A2F}\x{8A30}\x{8A31}\x{8A32}\x{8A34}' + . '\x{8A35}\x{8A36}\x{8A37}\x{8A38}\x{8A39}\x{8A3A}\x{8A3B}\x{8A3C}\x{8A3E}' + . '\x{8A3F}\x{8A40}\x{8A41}\x{8A42}\x{8A43}\x{8A44}\x{8A45}\x{8A46}\x{8A47}' + . '\x{8A48}\x{8A49}\x{8A4A}\x{8A4C}\x{8A4D}\x{8A4E}\x{8A4F}\x{8A50}\x{8A51}' + . '\x{8A52}\x{8A53}\x{8A54}\x{8A55}\x{8A56}\x{8A57}\x{8A58}\x{8A59}\x{8A5A}' + . '\x{8A5B}\x{8A5C}\x{8A5D}\x{8A5E}\x{8A5F}\x{8A60}\x{8A61}\x{8A62}\x{8A63}' + . '\x{8A65}\x{8A66}\x{8A67}\x{8A68}\x{8A69}\x{8A6A}\x{8A6B}\x{8A6C}\x{8A6D}' + . '\x{8A6E}\x{8A6F}\x{8A70}\x{8A71}\x{8A72}\x{8A73}\x{8A74}\x{8A75}\x{8A76}' + . '\x{8A77}\x{8A79}\x{8A7A}\x{8A7B}\x{8A7C}\x{8A7E}\x{8A7F}\x{8A80}\x{8A81}' + . '\x{8A82}\x{8A83}\x{8A84}\x{8A85}\x{8A86}\x{8A87}\x{8A89}\x{8A8A}\x{8A8B}' + . '\x{8A8C}\x{8A8D}\x{8A8E}\x{8A8F}\x{8A90}\x{8A91}\x{8A92}\x{8A93}\x{8A94}' + . '\x{8A95}\x{8A96}\x{8A97}\x{8A98}\x{8A99}\x{8A9A}\x{8A9B}\x{8A9C}\x{8A9D}' + . '\x{8A9E}\x{8AA0}\x{8AA1}\x{8AA2}\x{8AA3}\x{8AA4}\x{8AA5}\x{8AA6}\x{8AA7}' + . '\x{8AA8}\x{8AA9}\x{8AAA}\x{8AAB}\x{8AAC}\x{8AAE}\x{8AB0}\x{8AB1}\x{8AB2}' + . '\x{8AB3}\x{8AB4}\x{8AB5}\x{8AB6}\x{8AB8}\x{8AB9}\x{8ABA}\x{8ABB}\x{8ABC}' + . '\x{8ABD}\x{8ABE}\x{8ABF}\x{8AC0}\x{8AC1}\x{8AC2}\x{8AC3}\x{8AC4}\x{8AC5}' + . '\x{8AC6}\x{8AC7}\x{8AC8}\x{8AC9}\x{8ACA}\x{8ACB}\x{8ACC}\x{8ACD}\x{8ACE}' + . '\x{8ACF}\x{8AD1}\x{8AD2}\x{8AD3}\x{8AD4}\x{8AD5}\x{8AD6}\x{8AD7}\x{8AD8}' + . '\x{8AD9}\x{8ADA}\x{8ADB}\x{8ADC}\x{8ADD}\x{8ADE}\x{8ADF}\x{8AE0}\x{8AE1}' + . '\x{8AE2}\x{8AE3}\x{8AE4}\x{8AE5}\x{8AE6}\x{8AE7}\x{8AE8}\x{8AE9}\x{8AEA}' + . '\x{8AEB}\x{8AED}\x{8AEE}\x{8AEF}\x{8AF0}\x{8AF1}\x{8AF2}\x{8AF3}\x{8AF4}' + . '\x{8AF5}\x{8AF6}\x{8AF7}\x{8AF8}\x{8AF9}\x{8AFA}\x{8AFB}\x{8AFC}\x{8AFD}' + . '\x{8AFE}\x{8AFF}\x{8B00}\x{8B01}\x{8B02}\x{8B03}\x{8B04}\x{8B05}\x{8B06}' + . '\x{8B07}\x{8B08}\x{8B09}\x{8B0A}\x{8B0B}\x{8B0D}\x{8B0E}\x{8B0F}\x{8B10}' + . '\x{8B11}\x{8B12}\x{8B13}\x{8B14}\x{8B15}\x{8B16}\x{8B17}\x{8B18}\x{8B19}' + . '\x{8B1A}\x{8B1B}\x{8B1C}\x{8B1D}\x{8B1E}\x{8B1F}\x{8B20}\x{8B21}\x{8B22}' + . '\x{8B23}\x{8B24}\x{8B25}\x{8B26}\x{8B27}\x{8B28}\x{8B2A}\x{8B2B}\x{8B2C}' + . '\x{8B2D}\x{8B2E}\x{8B2F}\x{8B30}\x{8B31}\x{8B33}\x{8B34}\x{8B35}\x{8B36}' + . '\x{8B37}\x{8B39}\x{8B3A}\x{8B3B}\x{8B3C}\x{8B3D}\x{8B3E}\x{8B40}\x{8B41}' + . '\x{8B42}\x{8B43}\x{8B44}\x{8B45}\x{8B46}\x{8B47}\x{8B48}\x{8B49}\x{8B4A}' + . '\x{8B4B}\x{8B4C}\x{8B4D}\x{8B4E}\x{8B4F}\x{8B50}\x{8B51}\x{8B52}\x{8B53}' + . '\x{8B54}\x{8B55}\x{8B56}\x{8B57}\x{8B58}\x{8B59}\x{8B5A}\x{8B5B}\x{8B5C}' + . '\x{8B5D}\x{8B5E}\x{8B5F}\x{8B60}\x{8B63}\x{8B64}\x{8B65}\x{8B66}\x{8B67}' + . '\x{8B68}\x{8B6A}\x{8B6B}\x{8B6C}\x{8B6D}\x{8B6E}\x{8B6F}\x{8B70}\x{8B71}' + . '\x{8B73}\x{8B74}\x{8B76}\x{8B77}\x{8B78}\x{8B79}\x{8B7A}\x{8B7B}\x{8B7D}' + . '\x{8B7E}\x{8B7F}\x{8B80}\x{8B82}\x{8B83}\x{8B84}\x{8B85}\x{8B86}\x{8B88}' + . '\x{8B89}\x{8B8A}\x{8B8B}\x{8B8C}\x{8B8E}\x{8B90}\x{8B91}\x{8B92}\x{8B93}' + . '\x{8B94}\x{8B95}\x{8B96}\x{8B97}\x{8B98}\x{8B99}\x{8B9A}\x{8B9C}\x{8B9D}' + . '\x{8B9E}\x{8B9F}\x{8BA0}\x{8BA1}\x{8BA2}\x{8BA3}\x{8BA4}\x{8BA5}\x{8BA6}' + . '\x{8BA7}\x{8BA8}\x{8BA9}\x{8BAA}\x{8BAB}\x{8BAC}\x{8BAD}\x{8BAE}\x{8BAF}' + . '\x{8BB0}\x{8BB1}\x{8BB2}\x{8BB3}\x{8BB4}\x{8BB5}\x{8BB6}\x{8BB7}\x{8BB8}' + . '\x{8BB9}\x{8BBA}\x{8BBB}\x{8BBC}\x{8BBD}\x{8BBE}\x{8BBF}\x{8BC0}\x{8BC1}' + . '\x{8BC2}\x{8BC3}\x{8BC4}\x{8BC5}\x{8BC6}\x{8BC7}\x{8BC8}\x{8BC9}\x{8BCA}' + . '\x{8BCB}\x{8BCC}\x{8BCD}\x{8BCE}\x{8BCF}\x{8BD0}\x{8BD1}\x{8BD2}\x{8BD3}' + . '\x{8BD4}\x{8BD5}\x{8BD6}\x{8BD7}\x{8BD8}\x{8BD9}\x{8BDA}\x{8BDB}\x{8BDC}' + . '\x{8BDD}\x{8BDE}\x{8BDF}\x{8BE0}\x{8BE1}\x{8BE2}\x{8BE3}\x{8BE4}\x{8BE5}' + . '\x{8BE6}\x{8BE7}\x{8BE8}\x{8BE9}\x{8BEA}\x{8BEB}\x{8BEC}\x{8BED}\x{8BEE}' + . '\x{8BEF}\x{8BF0}\x{8BF1}\x{8BF2}\x{8BF3}\x{8BF4}\x{8BF5}\x{8BF6}\x{8BF7}' + . '\x{8BF8}\x{8BF9}\x{8BFA}\x{8BFB}\x{8BFC}\x{8BFD}\x{8BFE}\x{8BFF}\x{8C00}' + . '\x{8C01}\x{8C02}\x{8C03}\x{8C04}\x{8C05}\x{8C06}\x{8C07}\x{8C08}\x{8C09}' + . '\x{8C0A}\x{8C0B}\x{8C0C}\x{8C0D}\x{8C0E}\x{8C0F}\x{8C10}\x{8C11}\x{8C12}' + . '\x{8C13}\x{8C14}\x{8C15}\x{8C16}\x{8C17}\x{8C18}\x{8C19}\x{8C1A}\x{8C1B}' + . '\x{8C1C}\x{8C1D}\x{8C1E}\x{8C1F}\x{8C20}\x{8C21}\x{8C22}\x{8C23}\x{8C24}' + . '\x{8C25}\x{8C26}\x{8C27}\x{8C28}\x{8C29}\x{8C2A}\x{8C2B}\x{8C2C}\x{8C2D}' + . '\x{8C2E}\x{8C2F}\x{8C30}\x{8C31}\x{8C32}\x{8C33}\x{8C34}\x{8C35}\x{8C36}' + . '\x{8C37}\x{8C39}\x{8C3A}\x{8C3B}\x{8C3C}\x{8C3D}\x{8C3E}\x{8C3F}\x{8C41}' + . '\x{8C42}\x{8C43}\x{8C45}\x{8C46}\x{8C47}\x{8C48}\x{8C49}\x{8C4A}\x{8C4B}' + . '\x{8C4C}\x{8C4D}\x{8C4E}\x{8C4F}\x{8C50}\x{8C54}\x{8C55}\x{8C56}\x{8C57}' + . '\x{8C59}\x{8C5A}\x{8C5B}\x{8C5C}\x{8C5D}\x{8C5E}\x{8C5F}\x{8C60}\x{8C61}' + . '\x{8C62}\x{8C63}\x{8C64}\x{8C65}\x{8C66}\x{8C67}\x{8C68}\x{8C69}\x{8C6A}' + . '\x{8C6B}\x{8C6C}\x{8C6D}\x{8C6E}\x{8C6F}\x{8C70}\x{8C71}\x{8C72}\x{8C73}' + . '\x{8C75}\x{8C76}\x{8C77}\x{8C78}\x{8C79}\x{8C7A}\x{8C7B}\x{8C7D}\x{8C7E}' + . '\x{8C80}\x{8C81}\x{8C82}\x{8C84}\x{8C85}\x{8C86}\x{8C88}\x{8C89}\x{8C8A}' + . '\x{8C8C}\x{8C8D}\x{8C8F}\x{8C90}\x{8C91}\x{8C92}\x{8C93}\x{8C94}\x{8C95}' + . '\x{8C96}\x{8C97}\x{8C98}\x{8C99}\x{8C9A}\x{8C9C}\x{8C9D}\x{8C9E}\x{8C9F}' + . '\x{8CA0}\x{8CA1}\x{8CA2}\x{8CA3}\x{8CA4}\x{8CA5}\x{8CA7}\x{8CA8}\x{8CA9}' + . '\x{8CAA}\x{8CAB}\x{8CAC}\x{8CAD}\x{8CAE}\x{8CAF}\x{8CB0}\x{8CB1}\x{8CB2}' + . '\x{8CB3}\x{8CB4}\x{8CB5}\x{8CB6}\x{8CB7}\x{8CB8}\x{8CB9}\x{8CBA}\x{8CBB}' + . '\x{8CBC}\x{8CBD}\x{8CBE}\x{8CBF}\x{8CC0}\x{8CC1}\x{8CC2}\x{8CC3}\x{8CC4}' + . '\x{8CC5}\x{8CC6}\x{8CC7}\x{8CC8}\x{8CC9}\x{8CCA}\x{8CCC}\x{8CCE}\x{8CCF}' + . '\x{8CD0}\x{8CD1}\x{8CD2}\x{8CD3}\x{8CD4}\x{8CD5}\x{8CD7}\x{8CD9}\x{8CDA}' + . '\x{8CDB}\x{8CDC}\x{8CDD}\x{8CDE}\x{8CDF}\x{8CE0}\x{8CE1}\x{8CE2}\x{8CE3}' + . '\x{8CE4}\x{8CE5}\x{8CE6}\x{8CE7}\x{8CE8}\x{8CEA}\x{8CEB}\x{8CEC}\x{8CED}' + . '\x{8CEE}\x{8CEF}\x{8CF0}\x{8CF1}\x{8CF2}\x{8CF3}\x{8CF4}\x{8CF5}\x{8CF6}' + . '\x{8CF8}\x{8CF9}\x{8CFA}\x{8CFB}\x{8CFC}\x{8CFD}\x{8CFE}\x{8CFF}\x{8D00}' + . '\x{8D02}\x{8D03}\x{8D04}\x{8D05}\x{8D06}\x{8D07}\x{8D08}\x{8D09}\x{8D0A}' + . '\x{8D0B}\x{8D0C}\x{8D0D}\x{8D0E}\x{8D0F}\x{8D10}\x{8D13}\x{8D14}\x{8D15}' + . '\x{8D16}\x{8D17}\x{8D18}\x{8D19}\x{8D1A}\x{8D1B}\x{8D1C}\x{8D1D}\x{8D1E}' + . '\x{8D1F}\x{8D20}\x{8D21}\x{8D22}\x{8D23}\x{8D24}\x{8D25}\x{8D26}\x{8D27}' + . '\x{8D28}\x{8D29}\x{8D2A}\x{8D2B}\x{8D2C}\x{8D2D}\x{8D2E}\x{8D2F}\x{8D30}' + . '\x{8D31}\x{8D32}\x{8D33}\x{8D34}\x{8D35}\x{8D36}\x{8D37}\x{8D38}\x{8D39}' + . '\x{8D3A}\x{8D3B}\x{8D3C}\x{8D3D}\x{8D3E}\x{8D3F}\x{8D40}\x{8D41}\x{8D42}' + . '\x{8D43}\x{8D44}\x{8D45}\x{8D46}\x{8D47}\x{8D48}\x{8D49}\x{8D4A}\x{8D4B}' + . '\x{8D4C}\x{8D4D}\x{8D4E}\x{8D4F}\x{8D50}\x{8D51}\x{8D52}\x{8D53}\x{8D54}' + . '\x{8D55}\x{8D56}\x{8D57}\x{8D58}\x{8D59}\x{8D5A}\x{8D5B}\x{8D5C}\x{8D5D}' + . '\x{8D5E}\x{8D5F}\x{8D60}\x{8D61}\x{8D62}\x{8D63}\x{8D64}\x{8D65}\x{8D66}' + . '\x{8D67}\x{8D68}\x{8D69}\x{8D6A}\x{8D6B}\x{8D6C}\x{8D6D}\x{8D6E}\x{8D6F}' + . '\x{8D70}\x{8D71}\x{8D72}\x{8D73}\x{8D74}\x{8D75}\x{8D76}\x{8D77}\x{8D78}' + . '\x{8D79}\x{8D7A}\x{8D7B}\x{8D7D}\x{8D7E}\x{8D7F}\x{8D80}\x{8D81}\x{8D82}' + . '\x{8D83}\x{8D84}\x{8D85}\x{8D86}\x{8D87}\x{8D88}\x{8D89}\x{8D8A}\x{8D8B}' + . '\x{8D8C}\x{8D8D}\x{8D8E}\x{8D8F}\x{8D90}\x{8D91}\x{8D92}\x{8D93}\x{8D94}' + . '\x{8D95}\x{8D96}\x{8D97}\x{8D98}\x{8D99}\x{8D9A}\x{8D9B}\x{8D9C}\x{8D9D}' + . '\x{8D9E}\x{8D9F}\x{8DA0}\x{8DA1}\x{8DA2}\x{8DA3}\x{8DA4}\x{8DA5}\x{8DA7}' + . '\x{8DA8}\x{8DA9}\x{8DAA}\x{8DAB}\x{8DAC}\x{8DAD}\x{8DAE}\x{8DAF}\x{8DB0}' + . '\x{8DB1}\x{8DB2}\x{8DB3}\x{8DB4}\x{8DB5}\x{8DB6}\x{8DB7}\x{8DB8}\x{8DB9}' + . '\x{8DBA}\x{8DBB}\x{8DBC}\x{8DBD}\x{8DBE}\x{8DBF}\x{8DC1}\x{8DC2}\x{8DC3}' + . '\x{8DC4}\x{8DC5}\x{8DC6}\x{8DC7}\x{8DC8}\x{8DC9}\x{8DCA}\x{8DCB}\x{8DCC}' + . '\x{8DCD}\x{8DCE}\x{8DCF}\x{8DD0}\x{8DD1}\x{8DD2}\x{8DD3}\x{8DD4}\x{8DD5}' + . '\x{8DD6}\x{8DD7}\x{8DD8}\x{8DD9}\x{8DDA}\x{8DDB}\x{8DDC}\x{8DDD}\x{8DDE}' + . '\x{8DDF}\x{8DE0}\x{8DE1}\x{8DE2}\x{8DE3}\x{8DE4}\x{8DE6}\x{8DE7}\x{8DE8}' + . '\x{8DE9}\x{8DEA}\x{8DEB}\x{8DEC}\x{8DED}\x{8DEE}\x{8DEF}\x{8DF0}\x{8DF1}' + . '\x{8DF2}\x{8DF3}\x{8DF4}\x{8DF5}\x{8DF6}\x{8DF7}\x{8DF8}\x{8DF9}\x{8DFA}' + . '\x{8DFB}\x{8DFC}\x{8DFD}\x{8DFE}\x{8DFF}\x{8E00}\x{8E02}\x{8E03}\x{8E04}' + . '\x{8E05}\x{8E06}\x{8E07}\x{8E08}\x{8E09}\x{8E0A}\x{8E0C}\x{8E0D}\x{8E0E}' + . '\x{8E0F}\x{8E10}\x{8E11}\x{8E12}\x{8E13}\x{8E14}\x{8E15}\x{8E16}\x{8E17}' + . '\x{8E18}\x{8E19}\x{8E1A}\x{8E1B}\x{8E1C}\x{8E1D}\x{8E1E}\x{8E1F}\x{8E20}' + . '\x{8E21}\x{8E22}\x{8E23}\x{8E24}\x{8E25}\x{8E26}\x{8E27}\x{8E28}\x{8E29}' + . '\x{8E2A}\x{8E2B}\x{8E2C}\x{8E2D}\x{8E2E}\x{8E2F}\x{8E30}\x{8E31}\x{8E33}' + . '\x{8E34}\x{8E35}\x{8E36}\x{8E37}\x{8E38}\x{8E39}\x{8E3A}\x{8E3B}\x{8E3C}' + . '\x{8E3D}\x{8E3E}\x{8E3F}\x{8E40}\x{8E41}\x{8E42}\x{8E43}\x{8E44}\x{8E45}' + . '\x{8E47}\x{8E48}\x{8E49}\x{8E4A}\x{8E4B}\x{8E4C}\x{8E4D}\x{8E4E}\x{8E50}' + . '\x{8E51}\x{8E52}\x{8E53}\x{8E54}\x{8E55}\x{8E56}\x{8E57}\x{8E58}\x{8E59}' + . '\x{8E5A}\x{8E5B}\x{8E5C}\x{8E5D}\x{8E5E}\x{8E5F}\x{8E60}\x{8E61}\x{8E62}' + . '\x{8E63}\x{8E64}\x{8E65}\x{8E66}\x{8E67}\x{8E68}\x{8E69}\x{8E6A}\x{8E6B}' + . '\x{8E6C}\x{8E6D}\x{8E6F}\x{8E70}\x{8E71}\x{8E72}\x{8E73}\x{8E74}\x{8E76}' + . '\x{8E78}\x{8E7A}\x{8E7B}\x{8E7C}\x{8E7D}\x{8E7E}\x{8E7F}\x{8E80}\x{8E81}' + . '\x{8E82}\x{8E83}\x{8E84}\x{8E85}\x{8E86}\x{8E87}\x{8E88}\x{8E89}\x{8E8A}' + . '\x{8E8B}\x{8E8C}\x{8E8D}\x{8E8E}\x{8E8F}\x{8E90}\x{8E91}\x{8E92}\x{8E93}' + . '\x{8E94}\x{8E95}\x{8E96}\x{8E97}\x{8E98}\x{8E9A}\x{8E9C}\x{8E9D}\x{8E9E}' + . '\x{8E9F}\x{8EA0}\x{8EA1}\x{8EA3}\x{8EA4}\x{8EA5}\x{8EA6}\x{8EA7}\x{8EA8}' + . '\x{8EA9}\x{8EAA}\x{8EAB}\x{8EAC}\x{8EAD}\x{8EAE}\x{8EAF}\x{8EB0}\x{8EB1}' + . '\x{8EB2}\x{8EB4}\x{8EB5}\x{8EB8}\x{8EB9}\x{8EBA}\x{8EBB}\x{8EBC}\x{8EBD}' + . '\x{8EBE}\x{8EBF}\x{8EC0}\x{8EC2}\x{8EC3}\x{8EC5}\x{8EC6}\x{8EC7}\x{8EC8}' + . '\x{8EC9}\x{8ECA}\x{8ECB}\x{8ECC}\x{8ECD}\x{8ECE}\x{8ECF}\x{8ED0}\x{8ED1}' + . '\x{8ED2}\x{8ED3}\x{8ED4}\x{8ED5}\x{8ED6}\x{8ED7}\x{8ED8}\x{8EDA}\x{8EDB}' + . '\x{8EDC}\x{8EDD}\x{8EDE}\x{8EDF}\x{8EE0}\x{8EE1}\x{8EE4}\x{8EE5}\x{8EE6}' + . '\x{8EE7}\x{8EE8}\x{8EE9}\x{8EEA}\x{8EEB}\x{8EEC}\x{8EED}\x{8EEE}\x{8EEF}' + . '\x{8EF1}\x{8EF2}\x{8EF3}\x{8EF4}\x{8EF5}\x{8EF6}\x{8EF7}\x{8EF8}\x{8EF9}' + . '\x{8EFA}\x{8EFB}\x{8EFC}\x{8EFD}\x{8EFE}\x{8EFF}\x{8F00}\x{8F01}\x{8F02}' + . '\x{8F03}\x{8F04}\x{8F05}\x{8F06}\x{8F07}\x{8F08}\x{8F09}\x{8F0A}\x{8F0B}' + . '\x{8F0D}\x{8F0E}\x{8F10}\x{8F11}\x{8F12}\x{8F13}\x{8F14}\x{8F15}\x{8F16}' + . '\x{8F17}\x{8F18}\x{8F1A}\x{8F1B}\x{8F1C}\x{8F1D}\x{8F1E}\x{8F1F}\x{8F20}' + . '\x{8F21}\x{8F22}\x{8F23}\x{8F24}\x{8F25}\x{8F26}\x{8F27}\x{8F28}\x{8F29}' + . '\x{8F2A}\x{8F2B}\x{8F2C}\x{8F2E}\x{8F2F}\x{8F30}\x{8F31}\x{8F32}\x{8F33}' + . '\x{8F34}\x{8F35}\x{8F36}\x{8F37}\x{8F38}\x{8F39}\x{8F3B}\x{8F3C}\x{8F3D}' + . '\x{8F3E}\x{8F3F}\x{8F40}\x{8F42}\x{8F43}\x{8F44}\x{8F45}\x{8F46}\x{8F47}' + . '\x{8F48}\x{8F49}\x{8F4A}\x{8F4B}\x{8F4C}\x{8F4D}\x{8F4E}\x{8F4F}\x{8F50}' + . '\x{8F51}\x{8F52}\x{8F53}\x{8F54}\x{8F55}\x{8F56}\x{8F57}\x{8F58}\x{8F59}' + . '\x{8F5A}\x{8F5B}\x{8F5D}\x{8F5E}\x{8F5F}\x{8F60}\x{8F61}\x{8F62}\x{8F63}' + . '\x{8F64}\x{8F65}\x{8F66}\x{8F67}\x{8F68}\x{8F69}\x{8F6A}\x{8F6B}\x{8F6C}' + . '\x{8F6D}\x{8F6E}\x{8F6F}\x{8F70}\x{8F71}\x{8F72}\x{8F73}\x{8F74}\x{8F75}' + . '\x{8F76}\x{8F77}\x{8F78}\x{8F79}\x{8F7A}\x{8F7B}\x{8F7C}\x{8F7D}\x{8F7E}' + . '\x{8F7F}\x{8F80}\x{8F81}\x{8F82}\x{8F83}\x{8F84}\x{8F85}\x{8F86}\x{8F87}' + . '\x{8F88}\x{8F89}\x{8F8A}\x{8F8B}\x{8F8C}\x{8F8D}\x{8F8E}\x{8F8F}\x{8F90}' + . '\x{8F91}\x{8F92}\x{8F93}\x{8F94}\x{8F95}\x{8F96}\x{8F97}\x{8F98}\x{8F99}' + . '\x{8F9A}\x{8F9B}\x{8F9C}\x{8F9E}\x{8F9F}\x{8FA0}\x{8FA1}\x{8FA2}\x{8FA3}' + . '\x{8FA5}\x{8FA6}\x{8FA7}\x{8FA8}\x{8FA9}\x{8FAA}\x{8FAB}\x{8FAC}\x{8FAD}' + . '\x{8FAE}\x{8FAF}\x{8FB0}\x{8FB1}\x{8FB2}\x{8FB4}\x{8FB5}\x{8FB6}\x{8FB7}' + . '\x{8FB8}\x{8FB9}\x{8FBB}\x{8FBC}\x{8FBD}\x{8FBE}\x{8FBF}\x{8FC0}\x{8FC1}' + . '\x{8FC2}\x{8FC4}\x{8FC5}\x{8FC6}\x{8FC7}\x{8FC8}\x{8FC9}\x{8FCB}\x{8FCC}' + . '\x{8FCD}\x{8FCE}\x{8FCF}\x{8FD0}\x{8FD1}\x{8FD2}\x{8FD3}\x{8FD4}\x{8FD5}' + . '\x{8FD6}\x{8FD7}\x{8FD8}\x{8FD9}\x{8FDA}\x{8FDB}\x{8FDC}\x{8FDD}\x{8FDE}' + . '\x{8FDF}\x{8FE0}\x{8FE1}\x{8FE2}\x{8FE3}\x{8FE4}\x{8FE5}\x{8FE6}\x{8FE8}' + . '\x{8FE9}\x{8FEA}\x{8FEB}\x{8FEC}\x{8FED}\x{8FEE}\x{8FEF}\x{8FF0}\x{8FF1}' + . '\x{8FF2}\x{8FF3}\x{8FF4}\x{8FF5}\x{8FF6}\x{8FF7}\x{8FF8}\x{8FF9}\x{8FFA}' + . '\x{8FFB}\x{8FFC}\x{8FFD}\x{8FFE}\x{8FFF}\x{9000}\x{9001}\x{9002}\x{9003}' + . '\x{9004}\x{9005}\x{9006}\x{9007}\x{9008}\x{9009}\x{900A}\x{900B}\x{900C}' + . '\x{900D}\x{900F}\x{9010}\x{9011}\x{9012}\x{9013}\x{9014}\x{9015}\x{9016}' + . '\x{9017}\x{9018}\x{9019}\x{901A}\x{901B}\x{901C}\x{901D}\x{901E}\x{901F}' + . '\x{9020}\x{9021}\x{9022}\x{9023}\x{9024}\x{9025}\x{9026}\x{9027}\x{9028}' + . '\x{9029}\x{902B}\x{902D}\x{902E}\x{902F}\x{9030}\x{9031}\x{9032}\x{9033}' + . '\x{9034}\x{9035}\x{9036}\x{9038}\x{903A}\x{903B}\x{903C}\x{903D}\x{903E}' + . '\x{903F}\x{9041}\x{9042}\x{9043}\x{9044}\x{9045}\x{9047}\x{9048}\x{9049}' + . '\x{904A}\x{904B}\x{904C}\x{904D}\x{904E}\x{904F}\x{9050}\x{9051}\x{9052}' + . '\x{9053}\x{9054}\x{9055}\x{9056}\x{9057}\x{9058}\x{9059}\x{905A}\x{905B}' + . '\x{905C}\x{905D}\x{905E}\x{905F}\x{9060}\x{9061}\x{9062}\x{9063}\x{9064}' + . '\x{9065}\x{9066}\x{9067}\x{9068}\x{9069}\x{906A}\x{906B}\x{906C}\x{906D}' + . '\x{906E}\x{906F}\x{9070}\x{9071}\x{9072}\x{9073}\x{9074}\x{9075}\x{9076}' + . '\x{9077}\x{9078}\x{9079}\x{907A}\x{907B}\x{907C}\x{907D}\x{907E}\x{907F}' + . '\x{9080}\x{9081}\x{9082}\x{9083}\x{9084}\x{9085}\x{9086}\x{9087}\x{9088}' + . '\x{9089}\x{908A}\x{908B}\x{908C}\x{908D}\x{908E}\x{908F}\x{9090}\x{9091}' + . '\x{9092}\x{9093}\x{9094}\x{9095}\x{9096}\x{9097}\x{9098}\x{9099}\x{909A}' + . '\x{909B}\x{909C}\x{909D}\x{909E}\x{909F}\x{90A0}\x{90A1}\x{90A2}\x{90A3}' + . '\x{90A4}\x{90A5}\x{90A6}\x{90A7}\x{90A8}\x{90A9}\x{90AA}\x{90AC}\x{90AD}' + . '\x{90AE}\x{90AF}\x{90B0}\x{90B1}\x{90B2}\x{90B3}\x{90B4}\x{90B5}\x{90B6}' + . '\x{90B7}\x{90B8}\x{90B9}\x{90BA}\x{90BB}\x{90BC}\x{90BD}\x{90BE}\x{90BF}' + . '\x{90C0}\x{90C1}\x{90C2}\x{90C3}\x{90C4}\x{90C5}\x{90C6}\x{90C7}\x{90C8}' + . '\x{90C9}\x{90CA}\x{90CB}\x{90CE}\x{90CF}\x{90D0}\x{90D1}\x{90D3}\x{90D4}' + . '\x{90D5}\x{90D6}\x{90D7}\x{90D8}\x{90D9}\x{90DA}\x{90DB}\x{90DC}\x{90DD}' + . '\x{90DE}\x{90DF}\x{90E0}\x{90E1}\x{90E2}\x{90E3}\x{90E4}\x{90E5}\x{90E6}' + . '\x{90E7}\x{90E8}\x{90E9}\x{90EA}\x{90EB}\x{90EC}\x{90ED}\x{90EE}\x{90EF}' + . '\x{90F0}\x{90F1}\x{90F2}\x{90F3}\x{90F4}\x{90F5}\x{90F7}\x{90F8}\x{90F9}' + . '\x{90FA}\x{90FB}\x{90FC}\x{90FD}\x{90FE}\x{90FF}\x{9100}\x{9101}\x{9102}' + . '\x{9103}\x{9104}\x{9105}\x{9106}\x{9107}\x{9108}\x{9109}\x{910B}\x{910C}' + . '\x{910D}\x{910E}\x{910F}\x{9110}\x{9111}\x{9112}\x{9113}\x{9114}\x{9115}' + . '\x{9116}\x{9117}\x{9118}\x{9119}\x{911A}\x{911B}\x{911C}\x{911D}\x{911E}' + . '\x{911F}\x{9120}\x{9121}\x{9122}\x{9123}\x{9124}\x{9125}\x{9126}\x{9127}' + . '\x{9128}\x{9129}\x{912A}\x{912B}\x{912C}\x{912D}\x{912E}\x{912F}\x{9130}' + . '\x{9131}\x{9132}\x{9133}\x{9134}\x{9135}\x{9136}\x{9137}\x{9138}\x{9139}' + . '\x{913A}\x{913B}\x{913E}\x{913F}\x{9140}\x{9141}\x{9142}\x{9143}\x{9144}' + . '\x{9145}\x{9146}\x{9147}\x{9148}\x{9149}\x{914A}\x{914B}\x{914C}\x{914D}' + . '\x{914E}\x{914F}\x{9150}\x{9151}\x{9152}\x{9153}\x{9154}\x{9155}\x{9156}' + . '\x{9157}\x{9158}\x{915A}\x{915B}\x{915C}\x{915D}\x{915E}\x{915F}\x{9160}' + . '\x{9161}\x{9162}\x{9163}\x{9164}\x{9165}\x{9166}\x{9167}\x{9168}\x{9169}' + . '\x{916A}\x{916B}\x{916C}\x{916D}\x{916E}\x{916F}\x{9170}\x{9171}\x{9172}' + . '\x{9173}\x{9174}\x{9175}\x{9176}\x{9177}\x{9178}\x{9179}\x{917A}\x{917C}' + . '\x{917D}\x{917E}\x{917F}\x{9180}\x{9181}\x{9182}\x{9183}\x{9184}\x{9185}' + . '\x{9186}\x{9187}\x{9188}\x{9189}\x{918A}\x{918B}\x{918C}\x{918D}\x{918E}' + . '\x{918F}\x{9190}\x{9191}\x{9192}\x{9193}\x{9194}\x{9196}\x{9199}\x{919A}' + . '\x{919B}\x{919C}\x{919D}\x{919E}\x{919F}\x{91A0}\x{91A1}\x{91A2}\x{91A3}' + . '\x{91A5}\x{91A6}\x{91A7}\x{91A8}\x{91AA}\x{91AB}\x{91AC}\x{91AD}\x{91AE}' + . '\x{91AF}\x{91B0}\x{91B1}\x{91B2}\x{91B3}\x{91B4}\x{91B5}\x{91B6}\x{91B7}' + . '\x{91B9}\x{91BA}\x{91BB}\x{91BC}\x{91BD}\x{91BE}\x{91C0}\x{91C1}\x{91C2}' + . '\x{91C3}\x{91C5}\x{91C6}\x{91C7}\x{91C9}\x{91CA}\x{91CB}\x{91CC}\x{91CD}' + . '\x{91CE}\x{91CF}\x{91D0}\x{91D1}\x{91D2}\x{91D3}\x{91D4}\x{91D5}\x{91D7}' + . '\x{91D8}\x{91D9}\x{91DA}\x{91DB}\x{91DC}\x{91DD}\x{91DE}\x{91DF}\x{91E2}' + . '\x{91E3}\x{91E4}\x{91E5}\x{91E6}\x{91E7}\x{91E8}\x{91E9}\x{91EA}\x{91EB}' + . '\x{91EC}\x{91ED}\x{91EE}\x{91F0}\x{91F1}\x{91F2}\x{91F3}\x{91F4}\x{91F5}' + . '\x{91F7}\x{91F8}\x{91F9}\x{91FA}\x{91FB}\x{91FD}\x{91FE}\x{91FF}\x{9200}' + . '\x{9201}\x{9202}\x{9203}\x{9204}\x{9205}\x{9206}\x{9207}\x{9208}\x{9209}' + . '\x{920A}\x{920B}\x{920C}\x{920D}\x{920E}\x{920F}\x{9210}\x{9211}\x{9212}' + . '\x{9214}\x{9215}\x{9216}\x{9217}\x{9218}\x{9219}\x{921A}\x{921B}\x{921C}' + . '\x{921D}\x{921E}\x{9220}\x{9221}\x{9223}\x{9224}\x{9225}\x{9226}\x{9227}' + . '\x{9228}\x{9229}\x{922A}\x{922B}\x{922D}\x{922E}\x{922F}\x{9230}\x{9231}' + . '\x{9232}\x{9233}\x{9234}\x{9235}\x{9236}\x{9237}\x{9238}\x{9239}\x{923A}' + . '\x{923B}\x{923C}\x{923D}\x{923E}\x{923F}\x{9240}\x{9241}\x{9242}\x{9245}' + . '\x{9246}\x{9247}\x{9248}\x{9249}\x{924A}\x{924B}\x{924C}\x{924D}\x{924E}' + . '\x{924F}\x{9250}\x{9251}\x{9252}\x{9253}\x{9254}\x{9255}\x{9256}\x{9257}' + . '\x{9258}\x{9259}\x{925A}\x{925B}\x{925C}\x{925D}\x{925E}\x{925F}\x{9260}' + . '\x{9261}\x{9262}\x{9263}\x{9264}\x{9265}\x{9266}\x{9267}\x{9268}\x{926B}' + . '\x{926C}\x{926D}\x{926E}\x{926F}\x{9270}\x{9272}\x{9273}\x{9274}\x{9275}' + . '\x{9276}\x{9277}\x{9278}\x{9279}\x{927A}\x{927B}\x{927C}\x{927D}\x{927E}' + . '\x{927F}\x{9280}\x{9282}\x{9283}\x{9285}\x{9286}\x{9287}\x{9288}\x{9289}' + . '\x{928A}\x{928B}\x{928C}\x{928D}\x{928E}\x{928F}\x{9290}\x{9291}\x{9292}' + . '\x{9293}\x{9294}\x{9295}\x{9296}\x{9297}\x{9298}\x{9299}\x{929A}\x{929B}' + . '\x{929C}\x{929D}\x{929F}\x{92A0}\x{92A1}\x{92A2}\x{92A3}\x{92A4}\x{92A5}' + . '\x{92A6}\x{92A7}\x{92A8}\x{92A9}\x{92AA}\x{92AB}\x{92AC}\x{92AD}\x{92AE}' + . '\x{92AF}\x{92B0}\x{92B1}\x{92B2}\x{92B3}\x{92B4}\x{92B5}\x{92B6}\x{92B7}' + . '\x{92B8}\x{92B9}\x{92BA}\x{92BB}\x{92BC}\x{92BE}\x{92BF}\x{92C0}\x{92C1}' + . '\x{92C2}\x{92C3}\x{92C4}\x{92C5}\x{92C6}\x{92C7}\x{92C8}\x{92C9}\x{92CA}' + . '\x{92CB}\x{92CC}\x{92CD}\x{92CE}\x{92CF}\x{92D0}\x{92D1}\x{92D2}\x{92D3}' + . '\x{92D5}\x{92D6}\x{92D7}\x{92D8}\x{92D9}\x{92DA}\x{92DC}\x{92DD}\x{92DE}' + . '\x{92DF}\x{92E0}\x{92E1}\x{92E3}\x{92E4}\x{92E5}\x{92E6}\x{92E7}\x{92E8}' + . '\x{92E9}\x{92EA}\x{92EB}\x{92EC}\x{92ED}\x{92EE}\x{92EF}\x{92F0}\x{92F1}' + . '\x{92F2}\x{92F3}\x{92F4}\x{92F5}\x{92F6}\x{92F7}\x{92F8}\x{92F9}\x{92FA}' + . '\x{92FB}\x{92FC}\x{92FD}\x{92FE}\x{92FF}\x{9300}\x{9301}\x{9302}\x{9303}' + . '\x{9304}\x{9305}\x{9306}\x{9307}\x{9308}\x{9309}\x{930A}\x{930B}\x{930C}' + . '\x{930D}\x{930E}\x{930F}\x{9310}\x{9311}\x{9312}\x{9313}\x{9314}\x{9315}' + . '\x{9316}\x{9317}\x{9318}\x{9319}\x{931A}\x{931B}\x{931D}\x{931E}\x{931F}' + . '\x{9320}\x{9321}\x{9322}\x{9323}\x{9324}\x{9325}\x{9326}\x{9327}\x{9328}' + . '\x{9329}\x{932A}\x{932B}\x{932D}\x{932E}\x{932F}\x{9332}\x{9333}\x{9334}' + . '\x{9335}\x{9336}\x{9337}\x{9338}\x{9339}\x{933A}\x{933B}\x{933C}\x{933D}' + . '\x{933E}\x{933F}\x{9340}\x{9341}\x{9342}\x{9343}\x{9344}\x{9345}\x{9346}' + . '\x{9347}\x{9348}\x{9349}\x{934A}\x{934B}\x{934C}\x{934D}\x{934E}\x{934F}' + . '\x{9350}\x{9351}\x{9352}\x{9353}\x{9354}\x{9355}\x{9356}\x{9357}\x{9358}' + . '\x{9359}\x{935A}\x{935B}\x{935C}\x{935D}\x{935E}\x{935F}\x{9360}\x{9361}' + . '\x{9363}\x{9364}\x{9365}\x{9366}\x{9367}\x{9369}\x{936A}\x{936C}\x{936D}' + . '\x{936E}\x{9370}\x{9371}\x{9372}\x{9374}\x{9375}\x{9376}\x{9377}\x{9379}' + . '\x{937A}\x{937B}\x{937C}\x{937D}\x{937E}\x{9380}\x{9382}\x{9383}\x{9384}' + . '\x{9385}\x{9386}\x{9387}\x{9388}\x{9389}\x{938A}\x{938C}\x{938D}\x{938E}' + . '\x{938F}\x{9390}\x{9391}\x{9392}\x{9393}\x{9394}\x{9395}\x{9396}\x{9397}' + . '\x{9398}\x{9399}\x{939A}\x{939B}\x{939D}\x{939E}\x{939F}\x{93A1}\x{93A2}' + . '\x{93A3}\x{93A4}\x{93A5}\x{93A6}\x{93A7}\x{93A8}\x{93A9}\x{93AA}\x{93AC}' + . '\x{93AD}\x{93AE}\x{93AF}\x{93B0}\x{93B1}\x{93B2}\x{93B3}\x{93B4}\x{93B5}' + . '\x{93B6}\x{93B7}\x{93B8}\x{93B9}\x{93BA}\x{93BC}\x{93BD}\x{93BE}\x{93BF}' + . '\x{93C0}\x{93C1}\x{93C2}\x{93C3}\x{93C4}\x{93C5}\x{93C6}\x{93C7}\x{93C8}' + . '\x{93C9}\x{93CA}\x{93CB}\x{93CC}\x{93CD}\x{93CE}\x{93CF}\x{93D0}\x{93D1}' + . '\x{93D2}\x{93D3}\x{93D4}\x{93D5}\x{93D6}\x{93D7}\x{93D8}\x{93D9}\x{93DA}' + . '\x{93DB}\x{93DC}\x{93DD}\x{93DE}\x{93DF}\x{93E1}\x{93E2}\x{93E3}\x{93E4}' + . '\x{93E6}\x{93E7}\x{93E8}\x{93E9}\x{93EA}\x{93EB}\x{93EC}\x{93ED}\x{93EE}' + . '\x{93EF}\x{93F0}\x{93F1}\x{93F2}\x{93F4}\x{93F5}\x{93F6}\x{93F7}\x{93F8}' + . '\x{93F9}\x{93FA}\x{93FB}\x{93FC}\x{93FD}\x{93FE}\x{93FF}\x{9400}\x{9401}' + . '\x{9403}\x{9404}\x{9405}\x{9406}\x{9407}\x{9408}\x{9409}\x{940A}\x{940B}' + . '\x{940C}\x{940D}\x{940E}\x{940F}\x{9410}\x{9411}\x{9412}\x{9413}\x{9414}' + . '\x{9415}\x{9416}\x{9418}\x{9419}\x{941B}\x{941D}\x{9420}\x{9422}\x{9423}' + . '\x{9425}\x{9426}\x{9427}\x{9428}\x{9429}\x{942A}\x{942B}\x{942C}\x{942D}' + . '\x{942E}\x{942F}\x{9430}\x{9431}\x{9432}\x{9433}\x{9434}\x{9435}\x{9436}' + . '\x{9437}\x{9438}\x{9439}\x{943A}\x{943B}\x{943C}\x{943D}\x{943E}\x{943F}' + . '\x{9440}\x{9441}\x{9442}\x{9444}\x{9445}\x{9446}\x{9447}\x{9448}\x{9449}' + . '\x{944A}\x{944B}\x{944C}\x{944D}\x{944F}\x{9450}\x{9451}\x{9452}\x{9453}' + . '\x{9454}\x{9455}\x{9456}\x{9457}\x{9458}\x{9459}\x{945B}\x{945C}\x{945D}' + . '\x{945E}\x{945F}\x{9460}\x{9461}\x{9462}\x{9463}\x{9464}\x{9465}\x{9466}' + . '\x{9467}\x{9468}\x{9469}\x{946A}\x{946B}\x{946D}\x{946E}\x{946F}\x{9470}' + . '\x{9471}\x{9472}\x{9473}\x{9474}\x{9475}\x{9476}\x{9477}\x{9478}\x{9479}' + . '\x{947A}\x{947C}\x{947D}\x{947E}\x{947F}\x{9480}\x{9481}\x{9482}\x{9483}' + . '\x{9484}\x{9485}\x{9486}\x{9487}\x{9488}\x{9489}\x{948A}\x{948B}\x{948C}' + . '\x{948D}\x{948E}\x{948F}\x{9490}\x{9491}\x{9492}\x{9493}\x{9494}\x{9495}' + . '\x{9496}\x{9497}\x{9498}\x{9499}\x{949A}\x{949B}\x{949C}\x{949D}\x{949E}' + . '\x{949F}\x{94A0}\x{94A1}\x{94A2}\x{94A3}\x{94A4}\x{94A5}\x{94A6}\x{94A7}' + . '\x{94A8}\x{94A9}\x{94AA}\x{94AB}\x{94AC}\x{94AD}\x{94AE}\x{94AF}\x{94B0}' + . '\x{94B1}\x{94B2}\x{94B3}\x{94B4}\x{94B5}\x{94B6}\x{94B7}\x{94B8}\x{94B9}' + . '\x{94BA}\x{94BB}\x{94BC}\x{94BD}\x{94BE}\x{94BF}\x{94C0}\x{94C1}\x{94C2}' + . '\x{94C3}\x{94C4}\x{94C5}\x{94C6}\x{94C7}\x{94C8}\x{94C9}\x{94CA}\x{94CB}' + . '\x{94CC}\x{94CD}\x{94CE}\x{94CF}\x{94D0}\x{94D1}\x{94D2}\x{94D3}\x{94D4}' + . '\x{94D5}\x{94D6}\x{94D7}\x{94D8}\x{94D9}\x{94DA}\x{94DB}\x{94DC}\x{94DD}' + . '\x{94DE}\x{94DF}\x{94E0}\x{94E1}\x{94E2}\x{94E3}\x{94E4}\x{94E5}\x{94E6}' + . '\x{94E7}\x{94E8}\x{94E9}\x{94EA}\x{94EB}\x{94EC}\x{94ED}\x{94EE}\x{94EF}' + . '\x{94F0}\x{94F1}\x{94F2}\x{94F3}\x{94F4}\x{94F5}\x{94F6}\x{94F7}\x{94F8}' + . '\x{94F9}\x{94FA}\x{94FB}\x{94FC}\x{94FD}\x{94FE}\x{94FF}\x{9500}\x{9501}' + . '\x{9502}\x{9503}\x{9504}\x{9505}\x{9506}\x{9507}\x{9508}\x{9509}\x{950A}' + . '\x{950B}\x{950C}\x{950D}\x{950E}\x{950F}\x{9510}\x{9511}\x{9512}\x{9513}' + . '\x{9514}\x{9515}\x{9516}\x{9517}\x{9518}\x{9519}\x{951A}\x{951B}\x{951C}' + . '\x{951D}\x{951E}\x{951F}\x{9520}\x{9521}\x{9522}\x{9523}\x{9524}\x{9525}' + . '\x{9526}\x{9527}\x{9528}\x{9529}\x{952A}\x{952B}\x{952C}\x{952D}\x{952E}' + . '\x{952F}\x{9530}\x{9531}\x{9532}\x{9533}\x{9534}\x{9535}\x{9536}\x{9537}' + . '\x{9538}\x{9539}\x{953A}\x{953B}\x{953C}\x{953D}\x{953E}\x{953F}\x{9540}' + . '\x{9541}\x{9542}\x{9543}\x{9544}\x{9545}\x{9546}\x{9547}\x{9548}\x{9549}' + . '\x{954A}\x{954B}\x{954C}\x{954D}\x{954E}\x{954F}\x{9550}\x{9551}\x{9552}' + . '\x{9553}\x{9554}\x{9555}\x{9556}\x{9557}\x{9558}\x{9559}\x{955A}\x{955B}' + . '\x{955C}\x{955D}\x{955E}\x{955F}\x{9560}\x{9561}\x{9562}\x{9563}\x{9564}' + . '\x{9565}\x{9566}\x{9567}\x{9568}\x{9569}\x{956A}\x{956B}\x{956C}\x{956D}' + . '\x{956E}\x{956F}\x{9570}\x{9571}\x{9572}\x{9573}\x{9574}\x{9575}\x{9576}' + . '\x{9577}\x{957A}\x{957B}\x{957C}\x{957D}\x{957F}\x{9580}\x{9581}\x{9582}' + . '\x{9583}\x{9584}\x{9586}\x{9587}\x{9588}\x{9589}\x{958A}\x{958B}\x{958C}' + . '\x{958D}\x{958E}\x{958F}\x{9590}\x{9591}\x{9592}\x{9593}\x{9594}\x{9595}' + . '\x{9596}\x{9598}\x{9599}\x{959A}\x{959B}\x{959C}\x{959D}\x{959E}\x{959F}' + . '\x{95A1}\x{95A2}\x{95A3}\x{95A4}\x{95A5}\x{95A6}\x{95A7}\x{95A8}\x{95A9}' + . '\x{95AA}\x{95AB}\x{95AC}\x{95AD}\x{95AE}\x{95AF}\x{95B0}\x{95B1}\x{95B2}' + . '\x{95B5}\x{95B6}\x{95B7}\x{95B9}\x{95BA}\x{95BB}\x{95BC}\x{95BD}\x{95BE}' + . '\x{95BF}\x{95C0}\x{95C2}\x{95C3}\x{95C4}\x{95C5}\x{95C6}\x{95C7}\x{95C8}' + . '\x{95C9}\x{95CA}\x{95CB}\x{95CC}\x{95CD}\x{95CE}\x{95CF}\x{95D0}\x{95D1}' + . '\x{95D2}\x{95D3}\x{95D4}\x{95D5}\x{95D6}\x{95D7}\x{95D8}\x{95DA}\x{95DB}' + . '\x{95DC}\x{95DE}\x{95DF}\x{95E0}\x{95E1}\x{95E2}\x{95E3}\x{95E4}\x{95E5}' + . '\x{95E6}\x{95E7}\x{95E8}\x{95E9}\x{95EA}\x{95EB}\x{95EC}\x{95ED}\x{95EE}' + . '\x{95EF}\x{95F0}\x{95F1}\x{95F2}\x{95F3}\x{95F4}\x{95F5}\x{95F6}\x{95F7}' + . '\x{95F8}\x{95F9}\x{95FA}\x{95FB}\x{95FC}\x{95FD}\x{95FE}\x{95FF}\x{9600}' + . '\x{9601}\x{9602}\x{9603}\x{9604}\x{9605}\x{9606}\x{9607}\x{9608}\x{9609}' + . '\x{960A}\x{960B}\x{960C}\x{960D}\x{960E}\x{960F}\x{9610}\x{9611}\x{9612}' + . '\x{9613}\x{9614}\x{9615}\x{9616}\x{9617}\x{9618}\x{9619}\x{961A}\x{961B}' + . '\x{961C}\x{961D}\x{961E}\x{961F}\x{9620}\x{9621}\x{9622}\x{9623}\x{9624}' + . '\x{9627}\x{9628}\x{962A}\x{962B}\x{962C}\x{962D}\x{962E}\x{962F}\x{9630}' + . '\x{9631}\x{9632}\x{9633}\x{9634}\x{9635}\x{9636}\x{9637}\x{9638}\x{9639}' + . '\x{963A}\x{963B}\x{963C}\x{963D}\x{963F}\x{9640}\x{9641}\x{9642}\x{9643}' + . '\x{9644}\x{9645}\x{9646}\x{9647}\x{9648}\x{9649}\x{964A}\x{964B}\x{964C}' + . '\x{964D}\x{964E}\x{964F}\x{9650}\x{9651}\x{9652}\x{9653}\x{9654}\x{9655}' + . '\x{9658}\x{9659}\x{965A}\x{965B}\x{965C}\x{965D}\x{965E}\x{965F}\x{9660}' + . '\x{9661}\x{9662}\x{9663}\x{9664}\x{9666}\x{9667}\x{9668}\x{9669}\x{966A}' + . '\x{966B}\x{966C}\x{966D}\x{966E}\x{966F}\x{9670}\x{9671}\x{9672}\x{9673}' + . '\x{9674}\x{9675}\x{9676}\x{9677}\x{9678}\x{967C}\x{967D}\x{967E}\x{9680}' + . '\x{9683}\x{9684}\x{9685}\x{9686}\x{9687}\x{9688}\x{9689}\x{968A}\x{968B}' + . '\x{968D}\x{968E}\x{968F}\x{9690}\x{9691}\x{9692}\x{9693}\x{9694}\x{9695}' + . '\x{9697}\x{9698}\x{9699}\x{969B}\x{969C}\x{969E}\x{96A0}\x{96A1}\x{96A2}' + . '\x{96A3}\x{96A4}\x{96A5}\x{96A6}\x{96A7}\x{96A8}\x{96A9}\x{96AA}\x{96AC}' + . '\x{96AD}\x{96AE}\x{96B0}\x{96B1}\x{96B3}\x{96B4}\x{96B6}\x{96B7}\x{96B8}' + . '\x{96B9}\x{96BA}\x{96BB}\x{96BC}\x{96BD}\x{96BE}\x{96BF}\x{96C0}\x{96C1}' + . '\x{96C2}\x{96C3}\x{96C4}\x{96C5}\x{96C6}\x{96C7}\x{96C8}\x{96C9}\x{96CA}' + . '\x{96CB}\x{96CC}\x{96CD}\x{96CE}\x{96CF}\x{96D0}\x{96D1}\x{96D2}\x{96D3}' + . '\x{96D4}\x{96D5}\x{96D6}\x{96D7}\x{96D8}\x{96D9}\x{96DA}\x{96DB}\x{96DC}' + . '\x{96DD}\x{96DE}\x{96DF}\x{96E0}\x{96E1}\x{96E2}\x{96E3}\x{96E5}\x{96E8}' + . '\x{96E9}\x{96EA}\x{96EB}\x{96EC}\x{96ED}\x{96EE}\x{96EF}\x{96F0}\x{96F1}' + . '\x{96F2}\x{96F3}\x{96F4}\x{96F5}\x{96F6}\x{96F7}\x{96F8}\x{96F9}\x{96FA}' + . '\x{96FB}\x{96FD}\x{96FE}\x{96FF}\x{9700}\x{9701}\x{9702}\x{9703}\x{9704}' + . '\x{9705}\x{9706}\x{9707}\x{9708}\x{9709}\x{970A}\x{970B}\x{970C}\x{970D}' + . '\x{970E}\x{970F}\x{9710}\x{9711}\x{9712}\x{9713}\x{9715}\x{9716}\x{9718}' + . '\x{9719}\x{971C}\x{971D}\x{971E}\x{971F}\x{9720}\x{9721}\x{9722}\x{9723}' + . '\x{9724}\x{9725}\x{9726}\x{9727}\x{9728}\x{9729}\x{972A}\x{972B}\x{972C}' + . '\x{972D}\x{972E}\x{972F}\x{9730}\x{9731}\x{9732}\x{9735}\x{9736}\x{9738}' + . '\x{9739}\x{973A}\x{973B}\x{973C}\x{973D}\x{973E}\x{973F}\x{9742}\x{9743}' + . '\x{9744}\x{9745}\x{9746}\x{9747}\x{9748}\x{9749}\x{974A}\x{974B}\x{974C}' + . '\x{974E}\x{974F}\x{9750}\x{9751}\x{9752}\x{9753}\x{9754}\x{9755}\x{9756}' + . '\x{9758}\x{9759}\x{975A}\x{975B}\x{975C}\x{975D}\x{975E}\x{975F}\x{9760}' + . '\x{9761}\x{9762}\x{9765}\x{9766}\x{9767}\x{9768}\x{9769}\x{976A}\x{976B}' + . '\x{976C}\x{976D}\x{976E}\x{976F}\x{9770}\x{9772}\x{9773}\x{9774}\x{9776}' + . '\x{9777}\x{9778}\x{9779}\x{977A}\x{977B}\x{977C}\x{977D}\x{977E}\x{977F}' + . '\x{9780}\x{9781}\x{9782}\x{9783}\x{9784}\x{9785}\x{9786}\x{9788}\x{978A}' + . '\x{978B}\x{978C}\x{978D}\x{978E}\x{978F}\x{9790}\x{9791}\x{9792}\x{9793}' + . '\x{9794}\x{9795}\x{9796}\x{9797}\x{9798}\x{9799}\x{979A}\x{979C}\x{979D}' + . '\x{979E}\x{979F}\x{97A0}\x{97A1}\x{97A2}\x{97A3}\x{97A4}\x{97A5}\x{97A6}' + . '\x{97A7}\x{97A8}\x{97AA}\x{97AB}\x{97AC}\x{97AD}\x{97AE}\x{97AF}\x{97B2}' + . '\x{97B3}\x{97B4}\x{97B6}\x{97B7}\x{97B8}\x{97B9}\x{97BA}\x{97BB}\x{97BC}' + . '\x{97BD}\x{97BF}\x{97C1}\x{97C2}\x{97C3}\x{97C4}\x{97C5}\x{97C6}\x{97C7}' + . '\x{97C8}\x{97C9}\x{97CA}\x{97CB}\x{97CC}\x{97CD}\x{97CE}\x{97CF}\x{97D0}' + . '\x{97D1}\x{97D3}\x{97D4}\x{97D5}\x{97D6}\x{97D7}\x{97D8}\x{97D9}\x{97DA}' + . '\x{97DB}\x{97DC}\x{97DD}\x{97DE}\x{97DF}\x{97E0}\x{97E1}\x{97E2}\x{97E3}' + . '\x{97E4}\x{97E5}\x{97E6}\x{97E7}\x{97E8}\x{97E9}\x{97EA}\x{97EB}\x{97EC}' + . '\x{97ED}\x{97EE}\x{97EF}\x{97F0}\x{97F1}\x{97F2}\x{97F3}\x{97F4}\x{97F5}' + . '\x{97F6}\x{97F7}\x{97F8}\x{97F9}\x{97FA}\x{97FB}\x{97FD}\x{97FE}\x{97FF}' + . '\x{9800}\x{9801}\x{9802}\x{9803}\x{9804}\x{9805}\x{9806}\x{9807}\x{9808}' + . '\x{9809}\x{980A}\x{980B}\x{980C}\x{980D}\x{980E}\x{980F}\x{9810}\x{9811}' + . '\x{9812}\x{9813}\x{9814}\x{9815}\x{9816}\x{9817}\x{9818}\x{9819}\x{981A}' + . '\x{981B}\x{981C}\x{981D}\x{981E}\x{9820}\x{9821}\x{9822}\x{9823}\x{9824}' + . '\x{9826}\x{9827}\x{9828}\x{9829}\x{982B}\x{982D}\x{982E}\x{982F}\x{9830}' + . '\x{9831}\x{9832}\x{9834}\x{9835}\x{9836}\x{9837}\x{9838}\x{9839}\x{983B}' + . '\x{983C}\x{983D}\x{983F}\x{9840}\x{9841}\x{9843}\x{9844}\x{9845}\x{9846}' + . '\x{9848}\x{9849}\x{984A}\x{984C}\x{984D}\x{984E}\x{984F}\x{9850}\x{9851}' + . '\x{9852}\x{9853}\x{9854}\x{9855}\x{9857}\x{9858}\x{9859}\x{985A}\x{985B}' + . '\x{985C}\x{985D}\x{985E}\x{985F}\x{9860}\x{9861}\x{9862}\x{9863}\x{9864}' + . '\x{9865}\x{9867}\x{9869}\x{986A}\x{986B}\x{986C}\x{986D}\x{986E}\x{986F}' + . '\x{9870}\x{9871}\x{9872}\x{9873}\x{9874}\x{9875}\x{9876}\x{9877}\x{9878}' + . '\x{9879}\x{987A}\x{987B}\x{987C}\x{987D}\x{987E}\x{987F}\x{9880}\x{9881}' + . '\x{9882}\x{9883}\x{9884}\x{9885}\x{9886}\x{9887}\x{9888}\x{9889}\x{988A}' + . '\x{988B}\x{988C}\x{988D}\x{988E}\x{988F}\x{9890}\x{9891}\x{9892}\x{9893}' + . '\x{9894}\x{9895}\x{9896}\x{9897}\x{9898}\x{9899}\x{989A}\x{989B}\x{989C}' + . '\x{989D}\x{989E}\x{989F}\x{98A0}\x{98A1}\x{98A2}\x{98A3}\x{98A4}\x{98A5}' + . '\x{98A6}\x{98A7}\x{98A8}\x{98A9}\x{98AA}\x{98AB}\x{98AC}\x{98AD}\x{98AE}' + . '\x{98AF}\x{98B0}\x{98B1}\x{98B2}\x{98B3}\x{98B4}\x{98B5}\x{98B6}\x{98B8}' + . '\x{98B9}\x{98BA}\x{98BB}\x{98BC}\x{98BD}\x{98BE}\x{98BF}\x{98C0}\x{98C1}' + . '\x{98C2}\x{98C3}\x{98C4}\x{98C5}\x{98C6}\x{98C8}\x{98C9}\x{98CB}\x{98CC}' + . '\x{98CD}\x{98CE}\x{98CF}\x{98D0}\x{98D1}\x{98D2}\x{98D3}\x{98D4}\x{98D5}' + . '\x{98D6}\x{98D7}\x{98D8}\x{98D9}\x{98DA}\x{98DB}\x{98DC}\x{98DD}\x{98DE}' + . '\x{98DF}\x{98E0}\x{98E2}\x{98E3}\x{98E5}\x{98E6}\x{98E7}\x{98E8}\x{98E9}' + . '\x{98EA}\x{98EB}\x{98ED}\x{98EF}\x{98F0}\x{98F2}\x{98F3}\x{98F4}\x{98F5}' + . '\x{98F6}\x{98F7}\x{98F9}\x{98FA}\x{98FC}\x{98FD}\x{98FE}\x{98FF}\x{9900}' + . '\x{9901}\x{9902}\x{9903}\x{9904}\x{9905}\x{9906}\x{9907}\x{9908}\x{9909}' + . '\x{990A}\x{990B}\x{990C}\x{990D}\x{990E}\x{990F}\x{9910}\x{9911}\x{9912}' + . '\x{9913}\x{9914}\x{9915}\x{9916}\x{9917}\x{9918}\x{991A}\x{991B}\x{991C}' + . '\x{991D}\x{991E}\x{991F}\x{9920}\x{9921}\x{9922}\x{9923}\x{9924}\x{9925}' + . '\x{9926}\x{9927}\x{9928}\x{9929}\x{992A}\x{992B}\x{992C}\x{992D}\x{992E}' + . '\x{992F}\x{9930}\x{9931}\x{9932}\x{9933}\x{9934}\x{9935}\x{9936}\x{9937}' + . '\x{9938}\x{9939}\x{993A}\x{993C}\x{993D}\x{993E}\x{993F}\x{9940}\x{9941}' + . '\x{9942}\x{9943}\x{9945}\x{9946}\x{9947}\x{9948}\x{9949}\x{994A}\x{994B}' + . '\x{994C}\x{994E}\x{994F}\x{9950}\x{9951}\x{9952}\x{9953}\x{9954}\x{9955}' + . '\x{9956}\x{9957}\x{9958}\x{9959}\x{995B}\x{995C}\x{995E}\x{995F}\x{9960}' + . '\x{9961}\x{9962}\x{9963}\x{9964}\x{9965}\x{9966}\x{9967}\x{9968}\x{9969}' + . '\x{996A}\x{996B}\x{996C}\x{996D}\x{996E}\x{996F}\x{9970}\x{9971}\x{9972}' + . '\x{9973}\x{9974}\x{9975}\x{9976}\x{9977}\x{9978}\x{9979}\x{997A}\x{997B}' + . '\x{997C}\x{997D}\x{997E}\x{997F}\x{9980}\x{9981}\x{9982}\x{9983}\x{9984}' + . '\x{9985}\x{9986}\x{9987}\x{9988}\x{9989}\x{998A}\x{998B}\x{998C}\x{998D}' + . '\x{998E}\x{998F}\x{9990}\x{9991}\x{9992}\x{9993}\x{9994}\x{9995}\x{9996}' + . '\x{9997}\x{9998}\x{9999}\x{999A}\x{999B}\x{999C}\x{999D}\x{999E}\x{999F}' + . '\x{99A0}\x{99A1}\x{99A2}\x{99A3}\x{99A4}\x{99A5}\x{99A6}\x{99A7}\x{99A8}' + . '\x{99A9}\x{99AA}\x{99AB}\x{99AC}\x{99AD}\x{99AE}\x{99AF}\x{99B0}\x{99B1}' + . '\x{99B2}\x{99B3}\x{99B4}\x{99B5}\x{99B6}\x{99B7}\x{99B8}\x{99B9}\x{99BA}' + . '\x{99BB}\x{99BC}\x{99BD}\x{99BE}\x{99C0}\x{99C1}\x{99C2}\x{99C3}\x{99C4}' + . '\x{99C6}\x{99C7}\x{99C8}\x{99C9}\x{99CA}\x{99CB}\x{99CC}\x{99CD}\x{99CE}' + . '\x{99CF}\x{99D0}\x{99D1}\x{99D2}\x{99D3}\x{99D4}\x{99D5}\x{99D6}\x{99D7}' + . '\x{99D8}\x{99D9}\x{99DA}\x{99DB}\x{99DC}\x{99DD}\x{99DE}\x{99DF}\x{99E1}' + . '\x{99E2}\x{99E3}\x{99E4}\x{99E5}\x{99E7}\x{99E8}\x{99E9}\x{99EA}\x{99EC}' + . '\x{99ED}\x{99EE}\x{99EF}\x{99F0}\x{99F1}\x{99F2}\x{99F3}\x{99F4}\x{99F6}' + . '\x{99F7}\x{99F8}\x{99F9}\x{99FA}\x{99FB}\x{99FC}\x{99FD}\x{99FE}\x{99FF}' + . '\x{9A00}\x{9A01}\x{9A02}\x{9A03}\x{9A04}\x{9A05}\x{9A06}\x{9A07}\x{9A08}' + . '\x{9A09}\x{9A0A}\x{9A0B}\x{9A0C}\x{9A0D}\x{9A0E}\x{9A0F}\x{9A11}\x{9A14}' + . '\x{9A15}\x{9A16}\x{9A19}\x{9A1A}\x{9A1B}\x{9A1C}\x{9A1D}\x{9A1E}\x{9A1F}' + . '\x{9A20}\x{9A21}\x{9A22}\x{9A23}\x{9A24}\x{9A25}\x{9A26}\x{9A27}\x{9A29}' + . '\x{9A2A}\x{9A2B}\x{9A2C}\x{9A2D}\x{9A2E}\x{9A2F}\x{9A30}\x{9A31}\x{9A32}' + . '\x{9A33}\x{9A34}\x{9A35}\x{9A36}\x{9A37}\x{9A38}\x{9A39}\x{9A3A}\x{9A3C}' + . '\x{9A3D}\x{9A3E}\x{9A3F}\x{9A40}\x{9A41}\x{9A42}\x{9A43}\x{9A44}\x{9A45}' + . '\x{9A46}\x{9A47}\x{9A48}\x{9A49}\x{9A4A}\x{9A4B}\x{9A4C}\x{9A4D}\x{9A4E}' + . '\x{9A4F}\x{9A50}\x{9A52}\x{9A53}\x{9A54}\x{9A55}\x{9A56}\x{9A57}\x{9A59}' + . '\x{9A5A}\x{9A5B}\x{9A5C}\x{9A5E}\x{9A5F}\x{9A60}\x{9A61}\x{9A62}\x{9A64}' + . '\x{9A65}\x{9A66}\x{9A67}\x{9A68}\x{9A69}\x{9A6A}\x{9A6B}\x{9A6C}\x{9A6D}' + . '\x{9A6E}\x{9A6F}\x{9A70}\x{9A71}\x{9A72}\x{9A73}\x{9A74}\x{9A75}\x{9A76}' + . '\x{9A77}\x{9A78}\x{9A79}\x{9A7A}\x{9A7B}\x{9A7C}\x{9A7D}\x{9A7E}\x{9A7F}' + . '\x{9A80}\x{9A81}\x{9A82}\x{9A83}\x{9A84}\x{9A85}\x{9A86}\x{9A87}\x{9A88}' + . '\x{9A89}\x{9A8A}\x{9A8B}\x{9A8C}\x{9A8D}\x{9A8E}\x{9A8F}\x{9A90}\x{9A91}' + . '\x{9A92}\x{9A93}\x{9A94}\x{9A95}\x{9A96}\x{9A97}\x{9A98}\x{9A99}\x{9A9A}' + . '\x{9A9B}\x{9A9C}\x{9A9D}\x{9A9E}\x{9A9F}\x{9AA0}\x{9AA1}\x{9AA2}\x{9AA3}' + . '\x{9AA4}\x{9AA5}\x{9AA6}\x{9AA7}\x{9AA8}\x{9AAA}\x{9AAB}\x{9AAC}\x{9AAD}' + . '\x{9AAE}\x{9AAF}\x{9AB0}\x{9AB1}\x{9AB2}\x{9AB3}\x{9AB4}\x{9AB5}\x{9AB6}' + . '\x{9AB7}\x{9AB8}\x{9AB9}\x{9ABA}\x{9ABB}\x{9ABC}\x{9ABE}\x{9ABF}\x{9AC0}' + . '\x{9AC1}\x{9AC2}\x{9AC3}\x{9AC4}\x{9AC5}\x{9AC6}\x{9AC7}\x{9AC9}\x{9ACA}' + . '\x{9ACB}\x{9ACC}\x{9ACD}\x{9ACE}\x{9ACF}\x{9AD0}\x{9AD1}\x{9AD2}\x{9AD3}' + . '\x{9AD4}\x{9AD5}\x{9AD6}\x{9AD8}\x{9AD9}\x{9ADA}\x{9ADB}\x{9ADC}\x{9ADD}' + . '\x{9ADE}\x{9ADF}\x{9AE1}\x{9AE2}\x{9AE3}\x{9AE5}\x{9AE6}\x{9AE7}\x{9AEA}' + . '\x{9AEB}\x{9AEC}\x{9AED}\x{9AEE}\x{9AEF}\x{9AF1}\x{9AF2}\x{9AF3}\x{9AF4}' + . '\x{9AF5}\x{9AF6}\x{9AF7}\x{9AF8}\x{9AF9}\x{9AFA}\x{9AFB}\x{9AFC}\x{9AFD}' + . '\x{9AFE}\x{9AFF}\x{9B01}\x{9B03}\x{9B04}\x{9B05}\x{9B06}\x{9B07}\x{9B08}' + . '\x{9B0A}\x{9B0B}\x{9B0C}\x{9B0D}\x{9B0E}\x{9B0F}\x{9B10}\x{9B11}\x{9B12}' + . '\x{9B13}\x{9B15}\x{9B16}\x{9B17}\x{9B18}\x{9B19}\x{9B1A}\x{9B1C}\x{9B1D}' + . '\x{9B1E}\x{9B1F}\x{9B20}\x{9B21}\x{9B22}\x{9B23}\x{9B24}\x{9B25}\x{9B26}' + . '\x{9B27}\x{9B28}\x{9B29}\x{9B2A}\x{9B2B}\x{9B2C}\x{9B2D}\x{9B2E}\x{9B2F}' + . '\x{9B30}\x{9B31}\x{9B32}\x{9B33}\x{9B35}\x{9B36}\x{9B37}\x{9B38}\x{9B39}' + . '\x{9B3A}\x{9B3B}\x{9B3C}\x{9B3E}\x{9B3F}\x{9B41}\x{9B42}\x{9B43}\x{9B44}' + . '\x{9B45}\x{9B46}\x{9B47}\x{9B48}\x{9B49}\x{9B4A}\x{9B4B}\x{9B4C}\x{9B4D}' + . '\x{9B4E}\x{9B4F}\x{9B51}\x{9B52}\x{9B53}\x{9B54}\x{9B55}\x{9B56}\x{9B58}' + . '\x{9B59}\x{9B5A}\x{9B5B}\x{9B5C}\x{9B5D}\x{9B5E}\x{9B5F}\x{9B60}\x{9B61}' + . '\x{9B63}\x{9B64}\x{9B65}\x{9B66}\x{9B67}\x{9B68}\x{9B69}\x{9B6A}\x{9B6B}' + . '\x{9B6C}\x{9B6D}\x{9B6E}\x{9B6F}\x{9B70}\x{9B71}\x{9B73}\x{9B74}\x{9B75}' + . '\x{9B76}\x{9B77}\x{9B78}\x{9B79}\x{9B7A}\x{9B7B}\x{9B7C}\x{9B7D}\x{9B7E}' + . '\x{9B7F}\x{9B80}\x{9B81}\x{9B82}\x{9B83}\x{9B84}\x{9B85}\x{9B86}\x{9B87}' + . '\x{9B88}\x{9B8A}\x{9B8B}\x{9B8D}\x{9B8E}\x{9B8F}\x{9B90}\x{9B91}\x{9B92}' + . '\x{9B93}\x{9B94}\x{9B95}\x{9B96}\x{9B97}\x{9B98}\x{9B9A}\x{9B9B}\x{9B9C}' + . '\x{9B9D}\x{9B9E}\x{9B9F}\x{9BA0}\x{9BA1}\x{9BA2}\x{9BA3}\x{9BA4}\x{9BA5}' + . '\x{9BA6}\x{9BA7}\x{9BA8}\x{9BA9}\x{9BAA}\x{9BAB}\x{9BAC}\x{9BAD}\x{9BAE}' + . '\x{9BAF}\x{9BB0}\x{9BB1}\x{9BB2}\x{9BB3}\x{9BB4}\x{9BB5}\x{9BB6}\x{9BB7}' + . '\x{9BB8}\x{9BB9}\x{9BBA}\x{9BBB}\x{9BBC}\x{9BBD}\x{9BBE}\x{9BBF}\x{9BC0}' + . '\x{9BC1}\x{9BC3}\x{9BC4}\x{9BC5}\x{9BC6}\x{9BC7}\x{9BC8}\x{9BC9}\x{9BCA}' + . '\x{9BCB}\x{9BCC}\x{9BCD}\x{9BCE}\x{9BCF}\x{9BD0}\x{9BD1}\x{9BD2}\x{9BD3}' + . '\x{9BD4}\x{9BD5}\x{9BD6}\x{9BD7}\x{9BD8}\x{9BD9}\x{9BDA}\x{9BDB}\x{9BDC}' + . '\x{9BDD}\x{9BDE}\x{9BDF}\x{9BE0}\x{9BE1}\x{9BE2}\x{9BE3}\x{9BE4}\x{9BE5}' + . '\x{9BE6}\x{9BE7}\x{9BE8}\x{9BE9}\x{9BEA}\x{9BEB}\x{9BEC}\x{9BED}\x{9BEE}' + . '\x{9BEF}\x{9BF0}\x{9BF1}\x{9BF2}\x{9BF3}\x{9BF4}\x{9BF5}\x{9BF7}\x{9BF8}' + . '\x{9BF9}\x{9BFA}\x{9BFB}\x{9BFC}\x{9BFD}\x{9BFE}\x{9BFF}\x{9C02}\x{9C05}' + . '\x{9C06}\x{9C07}\x{9C08}\x{9C09}\x{9C0A}\x{9C0B}\x{9C0C}\x{9C0D}\x{9C0E}' + . '\x{9C0F}\x{9C10}\x{9C11}\x{9C12}\x{9C13}\x{9C14}\x{9C15}\x{9C16}\x{9C17}' + . '\x{9C18}\x{9C19}\x{9C1A}\x{9C1B}\x{9C1C}\x{9C1D}\x{9C1E}\x{9C1F}\x{9C20}' + . '\x{9C21}\x{9C22}\x{9C23}\x{9C24}\x{9C25}\x{9C26}\x{9C27}\x{9C28}\x{9C29}' + . '\x{9C2A}\x{9C2B}\x{9C2C}\x{9C2D}\x{9C2F}\x{9C30}\x{9C31}\x{9C32}\x{9C33}' + . '\x{9C34}\x{9C35}\x{9C36}\x{9C37}\x{9C38}\x{9C39}\x{9C3A}\x{9C3B}\x{9C3C}' + . '\x{9C3D}\x{9C3E}\x{9C3F}\x{9C40}\x{9C41}\x{9C43}\x{9C44}\x{9C45}\x{9C46}' + . '\x{9C47}\x{9C48}\x{9C49}\x{9C4A}\x{9C4B}\x{9C4C}\x{9C4D}\x{9C4E}\x{9C50}' + . '\x{9C52}\x{9C53}\x{9C54}\x{9C55}\x{9C56}\x{9C57}\x{9C58}\x{9C59}\x{9C5A}' + . '\x{9C5B}\x{9C5C}\x{9C5D}\x{9C5E}\x{9C5F}\x{9C60}\x{9C62}\x{9C63}\x{9C65}' + . '\x{9C66}\x{9C67}\x{9C68}\x{9C69}\x{9C6A}\x{9C6B}\x{9C6C}\x{9C6D}\x{9C6E}' + . '\x{9C6F}\x{9C70}\x{9C71}\x{9C72}\x{9C73}\x{9C74}\x{9C75}\x{9C77}\x{9C78}' + . '\x{9C79}\x{9C7A}\x{9C7C}\x{9C7D}\x{9C7E}\x{9C7F}\x{9C80}\x{9C81}\x{9C82}' + . '\x{9C83}\x{9C84}\x{9C85}\x{9C86}\x{9C87}\x{9C88}\x{9C89}\x{9C8A}\x{9C8B}' + . '\x{9C8C}\x{9C8D}\x{9C8E}\x{9C8F}\x{9C90}\x{9C91}\x{9C92}\x{9C93}\x{9C94}' + . '\x{9C95}\x{9C96}\x{9C97}\x{9C98}\x{9C99}\x{9C9A}\x{9C9B}\x{9C9C}\x{9C9D}' + . '\x{9C9E}\x{9C9F}\x{9CA0}\x{9CA1}\x{9CA2}\x{9CA3}\x{9CA4}\x{9CA5}\x{9CA6}' + . '\x{9CA7}\x{9CA8}\x{9CA9}\x{9CAA}\x{9CAB}\x{9CAC}\x{9CAD}\x{9CAE}\x{9CAF}' + . '\x{9CB0}\x{9CB1}\x{9CB2}\x{9CB3}\x{9CB4}\x{9CB5}\x{9CB6}\x{9CB7}\x{9CB8}' + . '\x{9CB9}\x{9CBA}\x{9CBB}\x{9CBC}\x{9CBD}\x{9CBE}\x{9CBF}\x{9CC0}\x{9CC1}' + . '\x{9CC2}\x{9CC3}\x{9CC4}\x{9CC5}\x{9CC6}\x{9CC7}\x{9CC8}\x{9CC9}\x{9CCA}' + . '\x{9CCB}\x{9CCC}\x{9CCD}\x{9CCE}\x{9CCF}\x{9CD0}\x{9CD1}\x{9CD2}\x{9CD3}' + . '\x{9CD4}\x{9CD5}\x{9CD6}\x{9CD7}\x{9CD8}\x{9CD9}\x{9CDA}\x{9CDB}\x{9CDC}' + . '\x{9CDD}\x{9CDE}\x{9CDF}\x{9CE0}\x{9CE1}\x{9CE2}\x{9CE3}\x{9CE4}\x{9CE5}' + . '\x{9CE6}\x{9CE7}\x{9CE8}\x{9CE9}\x{9CEA}\x{9CEB}\x{9CEC}\x{9CED}\x{9CEE}' + . '\x{9CEF}\x{9CF0}\x{9CF1}\x{9CF2}\x{9CF3}\x{9CF4}\x{9CF5}\x{9CF6}\x{9CF7}' + . '\x{9CF8}\x{9CF9}\x{9CFA}\x{9CFB}\x{9CFC}\x{9CFD}\x{9CFE}\x{9CFF}\x{9D00}' + . '\x{9D01}\x{9D02}\x{9D03}\x{9D04}\x{9D05}\x{9D06}\x{9D07}\x{9D08}\x{9D09}' + . '\x{9D0A}\x{9D0B}\x{9D0F}\x{9D10}\x{9D12}\x{9D13}\x{9D14}\x{9D15}\x{9D16}' + . '\x{9D17}\x{9D18}\x{9D19}\x{9D1A}\x{9D1B}\x{9D1C}\x{9D1D}\x{9D1E}\x{9D1F}' + . '\x{9D20}\x{9D21}\x{9D22}\x{9D23}\x{9D24}\x{9D25}\x{9D26}\x{9D28}\x{9D29}' + . '\x{9D2B}\x{9D2D}\x{9D2E}\x{9D2F}\x{9D30}\x{9D31}\x{9D32}\x{9D33}\x{9D34}' + . '\x{9D36}\x{9D37}\x{9D38}\x{9D39}\x{9D3A}\x{9D3B}\x{9D3D}\x{9D3E}\x{9D3F}' + . '\x{9D40}\x{9D41}\x{9D42}\x{9D43}\x{9D45}\x{9D46}\x{9D47}\x{9D48}\x{9D49}' + . '\x{9D4A}\x{9D4B}\x{9D4C}\x{9D4D}\x{9D4E}\x{9D4F}\x{9D50}\x{9D51}\x{9D52}' + . '\x{9D53}\x{9D54}\x{9D55}\x{9D56}\x{9D57}\x{9D58}\x{9D59}\x{9D5A}\x{9D5B}' + . '\x{9D5C}\x{9D5D}\x{9D5E}\x{9D5F}\x{9D60}\x{9D61}\x{9D62}\x{9D63}\x{9D64}' + . '\x{9D65}\x{9D66}\x{9D67}\x{9D68}\x{9D69}\x{9D6A}\x{9D6B}\x{9D6C}\x{9D6E}' + . '\x{9D6F}\x{9D70}\x{9D71}\x{9D72}\x{9D73}\x{9D74}\x{9D75}\x{9D76}\x{9D77}' + . '\x{9D78}\x{9D79}\x{9D7A}\x{9D7B}\x{9D7C}\x{9D7D}\x{9D7E}\x{9D7F}\x{9D80}' + . '\x{9D81}\x{9D82}\x{9D83}\x{9D84}\x{9D85}\x{9D86}\x{9D87}\x{9D88}\x{9D89}' + . '\x{9D8A}\x{9D8B}\x{9D8C}\x{9D8D}\x{9D8E}\x{9D90}\x{9D91}\x{9D92}\x{9D93}' + . '\x{9D94}\x{9D96}\x{9D97}\x{9D98}\x{9D99}\x{9D9A}\x{9D9B}\x{9D9C}\x{9D9D}' + . '\x{9D9E}\x{9D9F}\x{9DA0}\x{9DA1}\x{9DA2}\x{9DA3}\x{9DA4}\x{9DA5}\x{9DA6}' + . '\x{9DA7}\x{9DA8}\x{9DA9}\x{9DAA}\x{9DAB}\x{9DAC}\x{9DAD}\x{9DAF}\x{9DB0}' + . '\x{9DB1}\x{9DB2}\x{9DB3}\x{9DB4}\x{9DB5}\x{9DB6}\x{9DB7}\x{9DB8}\x{9DB9}' + . '\x{9DBA}\x{9DBB}\x{9DBC}\x{9DBE}\x{9DBF}\x{9DC1}\x{9DC2}\x{9DC3}\x{9DC4}' + . '\x{9DC5}\x{9DC7}\x{9DC8}\x{9DC9}\x{9DCA}\x{9DCB}\x{9DCC}\x{9DCD}\x{9DCE}' + . '\x{9DCF}\x{9DD0}\x{9DD1}\x{9DD2}\x{9DD3}\x{9DD4}\x{9DD5}\x{9DD6}\x{9DD7}' + . '\x{9DD8}\x{9DD9}\x{9DDA}\x{9DDB}\x{9DDC}\x{9DDD}\x{9DDE}\x{9DDF}\x{9DE0}' + . '\x{9DE1}\x{9DE2}\x{9DE3}\x{9DE4}\x{9DE5}\x{9DE6}\x{9DE7}\x{9DE8}\x{9DE9}' + . '\x{9DEB}\x{9DEC}\x{9DED}\x{9DEE}\x{9DEF}\x{9DF0}\x{9DF1}\x{9DF2}\x{9DF3}' + . '\x{9DF4}\x{9DF5}\x{9DF6}\x{9DF7}\x{9DF8}\x{9DF9}\x{9DFA}\x{9DFB}\x{9DFD}' + . '\x{9DFE}\x{9DFF}\x{9E00}\x{9E01}\x{9E02}\x{9E03}\x{9E04}\x{9E05}\x{9E06}' + . '\x{9E07}\x{9E08}\x{9E09}\x{9E0A}\x{9E0B}\x{9E0C}\x{9E0D}\x{9E0F}\x{9E10}' + . '\x{9E11}\x{9E12}\x{9E13}\x{9E14}\x{9E15}\x{9E17}\x{9E18}\x{9E19}\x{9E1A}' + . '\x{9E1B}\x{9E1D}\x{9E1E}\x{9E1F}\x{9E20}\x{9E21}\x{9E22}\x{9E23}\x{9E24}' + . '\x{9E25}\x{9E26}\x{9E27}\x{9E28}\x{9E29}\x{9E2A}\x{9E2B}\x{9E2C}\x{9E2D}' + . '\x{9E2E}\x{9E2F}\x{9E30}\x{9E31}\x{9E32}\x{9E33}\x{9E34}\x{9E35}\x{9E36}' + . '\x{9E37}\x{9E38}\x{9E39}\x{9E3A}\x{9E3B}\x{9E3C}\x{9E3D}\x{9E3E}\x{9E3F}' + . '\x{9E40}\x{9E41}\x{9E42}\x{9E43}\x{9E44}\x{9E45}\x{9E46}\x{9E47}\x{9E48}' + . '\x{9E49}\x{9E4A}\x{9E4B}\x{9E4C}\x{9E4D}\x{9E4E}\x{9E4F}\x{9E50}\x{9E51}' + . '\x{9E52}\x{9E53}\x{9E54}\x{9E55}\x{9E56}\x{9E57}\x{9E58}\x{9E59}\x{9E5A}' + . '\x{9E5B}\x{9E5C}\x{9E5D}\x{9E5E}\x{9E5F}\x{9E60}\x{9E61}\x{9E62}\x{9E63}' + . '\x{9E64}\x{9E65}\x{9E66}\x{9E67}\x{9E68}\x{9E69}\x{9E6A}\x{9E6B}\x{9E6C}' + . '\x{9E6D}\x{9E6E}\x{9E6F}\x{9E70}\x{9E71}\x{9E72}\x{9E73}\x{9E74}\x{9E75}' + . '\x{9E76}\x{9E77}\x{9E79}\x{9E7A}\x{9E7C}\x{9E7D}\x{9E7E}\x{9E7F}\x{9E80}' + . '\x{9E81}\x{9E82}\x{9E83}\x{9E84}\x{9E85}\x{9E86}\x{9E87}\x{9E88}\x{9E89}' + . '\x{9E8A}\x{9E8B}\x{9E8C}\x{9E8D}\x{9E8E}\x{9E91}\x{9E92}\x{9E93}\x{9E94}' + . '\x{9E96}\x{9E97}\x{9E99}\x{9E9A}\x{9E9B}\x{9E9C}\x{9E9D}\x{9E9F}\x{9EA0}' + . '\x{9EA1}\x{9EA3}\x{9EA4}\x{9EA5}\x{9EA6}\x{9EA7}\x{9EA8}\x{9EA9}\x{9EAA}' + . '\x{9EAD}\x{9EAE}\x{9EAF}\x{9EB0}\x{9EB2}\x{9EB3}\x{9EB4}\x{9EB5}\x{9EB6}' + . '\x{9EB7}\x{9EB8}\x{9EBB}\x{9EBC}\x{9EBD}\x{9EBE}\x{9EBF}\x{9EC0}\x{9EC1}' + . '\x{9EC2}\x{9EC3}\x{9EC4}\x{9EC5}\x{9EC6}\x{9EC7}\x{9EC8}\x{9EC9}\x{9ECA}' + . '\x{9ECB}\x{9ECC}\x{9ECD}\x{9ECE}\x{9ECF}\x{9ED0}\x{9ED1}\x{9ED2}\x{9ED3}' + . '\x{9ED4}\x{9ED5}\x{9ED6}\x{9ED7}\x{9ED8}\x{9ED9}\x{9EDA}\x{9EDB}\x{9EDC}' + . '\x{9EDD}\x{9EDE}\x{9EDF}\x{9EE0}\x{9EE1}\x{9EE2}\x{9EE3}\x{9EE4}\x{9EE5}' + . '\x{9EE6}\x{9EE7}\x{9EE8}\x{9EE9}\x{9EEA}\x{9EEB}\x{9EED}\x{9EEE}\x{9EEF}' + . '\x{9EF0}\x{9EF2}\x{9EF3}\x{9EF4}\x{9EF5}\x{9EF6}\x{9EF7}\x{9EF8}\x{9EF9}' + . '\x{9EFA}\x{9EFB}\x{9EFC}\x{9EFD}\x{9EFE}\x{9EFF}\x{9F00}\x{9F01}\x{9F02}' + . '\x{9F04}\x{9F05}\x{9F06}\x{9F07}\x{9F08}\x{9F09}\x{9F0A}\x{9F0B}\x{9F0C}' + . '\x{9F0D}\x{9F0E}\x{9F0F}\x{9F10}\x{9F12}\x{9F13}\x{9F15}\x{9F16}\x{9F17}' + . '\x{9F18}\x{9F19}\x{9F1A}\x{9F1B}\x{9F1C}\x{9F1D}\x{9F1E}\x{9F1F}\x{9F20}' + . '\x{9F22}\x{9F23}\x{9F24}\x{9F25}\x{9F27}\x{9F28}\x{9F29}\x{9F2A}\x{9F2B}' + . '\x{9F2C}\x{9F2D}\x{9F2E}\x{9F2F}\x{9F30}\x{9F31}\x{9F32}\x{9F33}\x{9F34}' + . '\x{9F35}\x{9F36}\x{9F37}\x{9F38}\x{9F39}\x{9F3A}\x{9F3B}\x{9F3C}\x{9F3D}' + . '\x{9F3E}\x{9F3F}\x{9F40}\x{9F41}\x{9F42}\x{9F43}\x{9F44}\x{9F46}\x{9F47}' + . '\x{9F48}\x{9F49}\x{9F4A}\x{9F4B}\x{9F4C}\x{9F4D}\x{9F4E}\x{9F4F}\x{9F50}' + . '\x{9F51}\x{9F52}\x{9F54}\x{9F55}\x{9F56}\x{9F57}\x{9F58}\x{9F59}\x{9F5A}' + . '\x{9F5B}\x{9F5C}\x{9F5D}\x{9F5E}\x{9F5F}\x{9F60}\x{9F61}\x{9F63}\x{9F64}' + . '\x{9F65}\x{9F66}\x{9F67}\x{9F68}\x{9F69}\x{9F6A}\x{9F6B}\x{9F6C}\x{9F6E}' + . '\x{9F6F}\x{9F70}\x{9F71}\x{9F72}\x{9F73}\x{9F74}\x{9F75}\x{9F76}\x{9F77}' + . '\x{9F78}\x{9F79}\x{9F7A}\x{9F7B}\x{9F7C}\x{9F7D}\x{9F7E}\x{9F7F}\x{9F80}' + . '\x{9F81}\x{9F82}\x{9F83}\x{9F84}\x{9F85}\x{9F86}\x{9F87}\x{9F88}\x{9F89}' + . '\x{9F8A}\x{9F8B}\x{9F8C}\x{9F8D}\x{9F8E}\x{9F8F}\x{9F90}\x{9F91}\x{9F92}' + . '\x{9F93}\x{9F94}\x{9F95}\x{9F96}\x{9F97}\x{9F98}\x{9F99}\x{9F9A}\x{9F9B}' + . '\x{9F9C}\x{9F9D}\x{9F9E}\x{9F9F}\x{9FA0}\x{9FA2}\x{9FA4}\x{9FA5}]{1,20}$/iu', +]; diff --git a/vendor/laminas/laminas-validator/src/Hostname/Cn.php b/vendor/laminas/laminas-validator/src/Hostname/Cn.php new file mode 100644 index 00000000..d280764b --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Hostname/Cn.php @@ -0,0 +1,2179 @@ + '/^[\x{002d}0-9a-z\x{3447}\x{3473}\x{359E}\x{360E}\x{361A}\x{3918}\x{396E}\x{39CF}\x{39D0}' + . '\x{39DF}\x{3A73}\x{3B4E}\x{3C6E}\x{3CE0}\x{4056}\x{415F}\x{4337}\x{43AC}' + . '\x{43B1}\x{43DD}\x{44D6}\x{464C}\x{4661}\x{4723}\x{4729}\x{477C}\x{478D}' + . '\x{4947}\x{497A}\x{497D}\x{4982}\x{4983}\x{4985}\x{4986}\x{499B}\x{499F}' + . '\x{49B6}\x{49B7}\x{4C77}\x{4C9F}\x{4CA0}\x{4CA1}\x{4CA2}\x{4CA3}\x{4D13}' + . '\x{4D14}\x{4D15}\x{4D16}\x{4D17}\x{4D18}\x{4D19}\x{4DAE}\x{4E00}\x{4E01}' + . '\x{4E02}\x{4E03}\x{4E04}\x{4E05}\x{4E06}\x{4E07}\x{4E08}\x{4E09}\x{4E0A}' + . '\x{4E0B}\x{4E0C}\x{4E0D}\x{4E0E}\x{4E0F}\x{4E10}\x{4E11}\x{4E13}\x{4E14}' + . '\x{4E15}\x{4E16}\x{4E17}\x{4E18}\x{4E19}\x{4E1A}\x{4E1B}\x{4E1C}\x{4E1D}' + . '\x{4E1E}\x{4E1F}\x{4E20}\x{4E21}\x{4E22}\x{4E23}\x{4E24}\x{4E25}\x{4E26}' + . '\x{4E27}\x{4E28}\x{4E2A}\x{4E2B}\x{4E2C}\x{4E2D}\x{4E2E}\x{4E2F}\x{4E30}' + . '\x{4E31}\x{4E32}\x{4E33}\x{4E34}\x{4E35}\x{4E36}\x{4E37}\x{4E38}\x{4E39}' + . '\x{4E3A}\x{4E3B}\x{4E3C}\x{4E3D}\x{4E3E}\x{4E3F}\x{4E40}\x{4E41}\x{4E42}' + . '\x{4E43}\x{4E44}\x{4E45}\x{4E46}\x{4E47}\x{4E48}\x{4E49}\x{4E4A}\x{4E4B}' + . '\x{4E4C}\x{4E4D}\x{4E4E}\x{4E4F}\x{4E50}\x{4E51}\x{4E52}\x{4E53}\x{4E54}' + . '\x{4E56}\x{4E57}\x{4E58}\x{4E59}\x{4E5A}\x{4E5B}\x{4E5C}\x{4E5D}\x{4E5E}' + . '\x{4E5F}\x{4E60}\x{4E61}\x{4E62}\x{4E63}\x{4E64}\x{4E65}\x{4E66}\x{4E67}' + . '\x{4E69}\x{4E6A}\x{4E6B}\x{4E6C}\x{4E6D}\x{4E6E}\x{4E6F}\x{4E70}\x{4E71}' + . '\x{4E72}\x{4E73}\x{4E74}\x{4E75}\x{4E76}\x{4E77}\x{4E78}\x{4E7A}\x{4E7B}' + . '\x{4E7C}\x{4E7D}\x{4E7E}\x{4E7F}\x{4E80}\x{4E81}\x{4E82}\x{4E83}\x{4E84}' + . '\x{4E85}\x{4E86}\x{4E87}\x{4E88}\x{4E89}\x{4E8B}\x{4E8C}\x{4E8D}\x{4E8E}' + . '\x{4E8F}\x{4E90}\x{4E91}\x{4E92}\x{4E93}\x{4E94}\x{4E95}\x{4E97}\x{4E98}' + . '\x{4E99}\x{4E9A}\x{4E9B}\x{4E9C}\x{4E9D}\x{4E9E}\x{4E9F}\x{4EA0}\x{4EA1}' + . '\x{4EA2}\x{4EA4}\x{4EA5}\x{4EA6}\x{4EA7}\x{4EA8}\x{4EA9}\x{4EAA}\x{4EAB}' + . '\x{4EAC}\x{4EAD}\x{4EAE}\x{4EAF}\x{4EB0}\x{4EB1}\x{4EB2}\x{4EB3}\x{4EB4}' + . '\x{4EB5}\x{4EB6}\x{4EB7}\x{4EB8}\x{4EB9}\x{4EBA}\x{4EBB}\x{4EBD}\x{4EBE}' + . '\x{4EBF}\x{4EC0}\x{4EC1}\x{4EC2}\x{4EC3}\x{4EC4}\x{4EC5}\x{4EC6}\x{4EC7}' + . '\x{4EC8}\x{4EC9}\x{4ECA}\x{4ECB}\x{4ECD}\x{4ECE}\x{4ECF}\x{4ED0}\x{4ED1}' + . '\x{4ED2}\x{4ED3}\x{4ED4}\x{4ED5}\x{4ED6}\x{4ED7}\x{4ED8}\x{4ED9}\x{4EDA}' + . '\x{4EDB}\x{4EDC}\x{4EDD}\x{4EDE}\x{4EDF}\x{4EE0}\x{4EE1}\x{4EE2}\x{4EE3}' + . '\x{4EE4}\x{4EE5}\x{4EE6}\x{4EE8}\x{4EE9}\x{4EEA}\x{4EEB}\x{4EEC}\x{4EEF}' + . '\x{4EF0}\x{4EF1}\x{4EF2}\x{4EF3}\x{4EF4}\x{4EF5}\x{4EF6}\x{4EF7}\x{4EFB}' + . '\x{4EFD}\x{4EFF}\x{4F00}\x{4F01}\x{4F02}\x{4F03}\x{4F04}\x{4F05}\x{4F06}' + . '\x{4F08}\x{4F09}\x{4F0A}\x{4F0B}\x{4F0C}\x{4F0D}\x{4F0E}\x{4F0F}\x{4F10}' + . '\x{4F11}\x{4F12}\x{4F13}\x{4F14}\x{4F15}\x{4F17}\x{4F18}\x{4F19}\x{4F1A}' + . '\x{4F1B}\x{4F1C}\x{4F1D}\x{4F1E}\x{4F1F}\x{4F20}\x{4F21}\x{4F22}\x{4F23}' + . '\x{4F24}\x{4F25}\x{4F26}\x{4F27}\x{4F29}\x{4F2A}\x{4F2B}\x{4F2C}\x{4F2D}' + . '\x{4F2E}\x{4F2F}\x{4F30}\x{4F32}\x{4F33}\x{4F34}\x{4F36}\x{4F38}\x{4F39}' + . '\x{4F3A}\x{4F3B}\x{4F3C}\x{4F3D}\x{4F3E}\x{4F3F}\x{4F41}\x{4F42}\x{4F43}' + . '\x{4F45}\x{4F46}\x{4F47}\x{4F48}\x{4F49}\x{4F4A}\x{4F4B}\x{4F4C}\x{4F4D}' + . '\x{4F4E}\x{4F4F}\x{4F50}\x{4F51}\x{4F52}\x{4F53}\x{4F54}\x{4F55}\x{4F56}' + . '\x{4F57}\x{4F58}\x{4F59}\x{4F5A}\x{4F5B}\x{4F5C}\x{4F5D}\x{4F5E}\x{4F5F}' + . '\x{4F60}\x{4F61}\x{4F62}\x{4F63}\x{4F64}\x{4F65}\x{4F66}\x{4F67}\x{4F68}' + . '\x{4F69}\x{4F6A}\x{4F6B}\x{4F6C}\x{4F6D}\x{4F6E}\x{4F6F}\x{4F70}\x{4F72}' + . '\x{4F73}\x{4F74}\x{4F75}\x{4F76}\x{4F77}\x{4F78}\x{4F79}\x{4F7A}\x{4F7B}' + . '\x{4F7C}\x{4F7D}\x{4F7E}\x{4F7F}\x{4F80}\x{4F81}\x{4F82}\x{4F83}\x{4F84}' + . '\x{4F85}\x{4F86}\x{4F87}\x{4F88}\x{4F89}\x{4F8A}\x{4F8B}\x{4F8D}\x{4F8F}' + . '\x{4F90}\x{4F91}\x{4F92}\x{4F93}\x{4F94}\x{4F95}\x{4F96}\x{4F97}\x{4F98}' + . '\x{4F99}\x{4F9A}\x{4F9B}\x{4F9C}\x{4F9D}\x{4F9E}\x{4F9F}\x{4FA0}\x{4FA1}' + . '\x{4FA3}\x{4FA4}\x{4FA5}\x{4FA6}\x{4FA7}\x{4FA8}\x{4FA9}\x{4FAA}\x{4FAB}' + . '\x{4FAC}\x{4FAE}\x{4FAF}\x{4FB0}\x{4FB1}\x{4FB2}\x{4FB3}\x{4FB4}\x{4FB5}' + . '\x{4FB6}\x{4FB7}\x{4FB8}\x{4FB9}\x{4FBA}\x{4FBB}\x{4FBC}\x{4FBE}\x{4FBF}' + . '\x{4FC0}\x{4FC1}\x{4FC2}\x{4FC3}\x{4FC4}\x{4FC5}\x{4FC7}\x{4FC9}\x{4FCA}' + . '\x{4FCB}\x{4FCD}\x{4FCE}\x{4FCF}\x{4FD0}\x{4FD1}\x{4FD2}\x{4FD3}\x{4FD4}' + . '\x{4FD5}\x{4FD6}\x{4FD7}\x{4FD8}\x{4FD9}\x{4FDA}\x{4FDB}\x{4FDC}\x{4FDD}' + . '\x{4FDE}\x{4FDF}\x{4FE0}\x{4FE1}\x{4FE3}\x{4FE4}\x{4FE5}\x{4FE6}\x{4FE7}' + . '\x{4FE8}\x{4FE9}\x{4FEA}\x{4FEB}\x{4FEC}\x{4FED}\x{4FEE}\x{4FEF}\x{4FF0}' + . '\x{4FF1}\x{4FF2}\x{4FF3}\x{4FF4}\x{4FF5}\x{4FF6}\x{4FF7}\x{4FF8}\x{4FF9}' + . '\x{4FFA}\x{4FFB}\x{4FFE}\x{4FFF}\x{5000}\x{5001}\x{5002}\x{5003}\x{5004}' + . '\x{5005}\x{5006}\x{5007}\x{5008}\x{5009}\x{500A}\x{500B}\x{500C}\x{500D}' + . '\x{500E}\x{500F}\x{5011}\x{5012}\x{5013}\x{5014}\x{5015}\x{5016}\x{5017}' + . '\x{5018}\x{5019}\x{501A}\x{501B}\x{501C}\x{501D}\x{501E}\x{501F}\x{5020}' + . '\x{5021}\x{5022}\x{5023}\x{5024}\x{5025}\x{5026}\x{5027}\x{5028}\x{5029}' + . '\x{502A}\x{502B}\x{502C}\x{502D}\x{502E}\x{502F}\x{5030}\x{5031}\x{5032}' + . '\x{5033}\x{5035}\x{5036}\x{5037}\x{5039}\x{503A}\x{503B}\x{503C}\x{503E}' + . '\x{503F}\x{5040}\x{5041}\x{5043}\x{5044}\x{5045}\x{5046}\x{5047}\x{5048}' + . '\x{5049}\x{504A}\x{504B}\x{504C}\x{504D}\x{504E}\x{504F}\x{5051}\x{5053}' + . '\x{5054}\x{5055}\x{5056}\x{5057}\x{5059}\x{505A}\x{505B}\x{505C}\x{505D}' + . '\x{505E}\x{505F}\x{5060}\x{5061}\x{5062}\x{5063}\x{5064}\x{5065}\x{5066}' + . '\x{5067}\x{5068}\x{5069}\x{506A}\x{506B}\x{506C}\x{506D}\x{506E}\x{506F}' + . '\x{5070}\x{5071}\x{5072}\x{5073}\x{5074}\x{5075}\x{5076}\x{5077}\x{5078}' + . '\x{5079}\x{507A}\x{507B}\x{507D}\x{507E}\x{507F}\x{5080}\x{5082}\x{5083}' + . '\x{5084}\x{5085}\x{5086}\x{5087}\x{5088}\x{5089}\x{508A}\x{508B}\x{508C}' + . '\x{508D}\x{508E}\x{508F}\x{5090}\x{5091}\x{5092}\x{5094}\x{5095}\x{5096}' + . '\x{5098}\x{5099}\x{509A}\x{509B}\x{509C}\x{509D}\x{509E}\x{50A2}\x{50A3}' + . '\x{50A4}\x{50A5}\x{50A6}\x{50A7}\x{50A8}\x{50A9}\x{50AA}\x{50AB}\x{50AC}' + . '\x{50AD}\x{50AE}\x{50AF}\x{50B0}\x{50B1}\x{50B2}\x{50B3}\x{50B4}\x{50B5}' + . '\x{50B6}\x{50B7}\x{50B8}\x{50BA}\x{50BB}\x{50BC}\x{50BD}\x{50BE}\x{50BF}' + . '\x{50C0}\x{50C1}\x{50C2}\x{50C4}\x{50C5}\x{50C6}\x{50C7}\x{50C8}\x{50C9}' + . '\x{50CA}\x{50CB}\x{50CC}\x{50CD}\x{50CE}\x{50CF}\x{50D0}\x{50D1}\x{50D2}' + . '\x{50D3}\x{50D4}\x{50D5}\x{50D6}\x{50D7}\x{50D9}\x{50DA}\x{50DB}\x{50DC}' + . '\x{50DD}\x{50DE}\x{50E0}\x{50E3}\x{50E4}\x{50E5}\x{50E6}\x{50E7}\x{50E8}' + . '\x{50E9}\x{50EA}\x{50EC}\x{50ED}\x{50EE}\x{50EF}\x{50F0}\x{50F1}\x{50F2}' + . '\x{50F3}\x{50F5}\x{50F6}\x{50F8}\x{50F9}\x{50FA}\x{50FB}\x{50FC}\x{50FD}' + . '\x{50FE}\x{50FF}\x{5100}\x{5101}\x{5102}\x{5103}\x{5104}\x{5105}\x{5106}' + . '\x{5107}\x{5108}\x{5109}\x{510A}\x{510B}\x{510C}\x{510D}\x{510E}\x{510F}' + . '\x{5110}\x{5111}\x{5112}\x{5113}\x{5114}\x{5115}\x{5116}\x{5117}\x{5118}' + . '\x{5119}\x{511A}\x{511C}\x{511D}\x{511E}\x{511F}\x{5120}\x{5121}\x{5122}' + . '\x{5123}\x{5124}\x{5125}\x{5126}\x{5127}\x{5129}\x{512A}\x{512C}\x{512D}' + . '\x{512E}\x{512F}\x{5130}\x{5131}\x{5132}\x{5133}\x{5134}\x{5135}\x{5136}' + . '\x{5137}\x{5138}\x{5139}\x{513A}\x{513B}\x{513C}\x{513D}\x{513E}\x{513F}' + . '\x{5140}\x{5141}\x{5143}\x{5144}\x{5145}\x{5146}\x{5147}\x{5148}\x{5149}' + . '\x{514B}\x{514C}\x{514D}\x{514E}\x{5150}\x{5151}\x{5152}\x{5154}\x{5155}' + . '\x{5156}\x{5157}\x{5159}\x{515A}\x{515B}\x{515C}\x{515D}\x{515E}\x{515F}' + . '\x{5161}\x{5162}\x{5163}\x{5165}\x{5166}\x{5167}\x{5168}\x{5169}\x{516A}' + . '\x{516B}\x{516C}\x{516D}\x{516E}\x{516F}\x{5170}\x{5171}\x{5173}\x{5174}' + . '\x{5175}\x{5176}\x{5177}\x{5178}\x{5179}\x{517A}\x{517B}\x{517C}\x{517D}' + . '\x{517F}\x{5180}\x{5181}\x{5182}\x{5185}\x{5186}\x{5187}\x{5188}\x{5189}' + . '\x{518A}\x{518B}\x{518C}\x{518D}\x{518F}\x{5190}\x{5191}\x{5192}\x{5193}' + . '\x{5194}\x{5195}\x{5196}\x{5197}\x{5198}\x{5199}\x{519A}\x{519B}\x{519C}' + . '\x{519D}\x{519E}\x{519F}\x{51A0}\x{51A2}\x{51A4}\x{51A5}\x{51A6}\x{51A7}' + . '\x{51A8}\x{51AA}\x{51AB}\x{51AC}\x{51AE}\x{51AF}\x{51B0}\x{51B1}\x{51B2}' + . '\x{51B3}\x{51B5}\x{51B6}\x{51B7}\x{51B9}\x{51BB}\x{51BC}\x{51BD}\x{51BE}' + . '\x{51BF}\x{51C0}\x{51C1}\x{51C3}\x{51C4}\x{51C5}\x{51C6}\x{51C7}\x{51C8}' + . '\x{51C9}\x{51CA}\x{51CB}\x{51CC}\x{51CD}\x{51CE}\x{51CF}\x{51D0}\x{51D1}' + . '\x{51D4}\x{51D5}\x{51D6}\x{51D7}\x{51D8}\x{51D9}\x{51DA}\x{51DB}\x{51DC}' + . '\x{51DD}\x{51DE}\x{51E0}\x{51E1}\x{51E2}\x{51E3}\x{51E4}\x{51E5}\x{51E7}' + . '\x{51E8}\x{51E9}\x{51EA}\x{51EB}\x{51ED}\x{51EF}\x{51F0}\x{51F1}\x{51F3}' + . '\x{51F4}\x{51F5}\x{51F6}\x{51F7}\x{51F8}\x{51F9}\x{51FA}\x{51FB}\x{51FC}' + . '\x{51FD}\x{51FE}\x{51FF}\x{5200}\x{5201}\x{5202}\x{5203}\x{5204}\x{5205}' + . '\x{5206}\x{5207}\x{5208}\x{5209}\x{520A}\x{520B}\x{520C}\x{520D}\x{520E}' + . '\x{520F}\x{5210}\x{5211}\x{5212}\x{5213}\x{5214}\x{5215}\x{5216}\x{5217}' + . '\x{5218}\x{5219}\x{521A}\x{521B}\x{521C}\x{521D}\x{521E}\x{521F}\x{5220}' + . '\x{5221}\x{5222}\x{5223}\x{5224}\x{5225}\x{5226}\x{5228}\x{5229}\x{522A}' + . '\x{522B}\x{522C}\x{522D}\x{522E}\x{522F}\x{5230}\x{5231}\x{5232}\x{5233}' + . '\x{5234}\x{5235}\x{5236}\x{5237}\x{5238}\x{5239}\x{523A}\x{523B}\x{523C}' + . '\x{523D}\x{523E}\x{523F}\x{5240}\x{5241}\x{5242}\x{5243}\x{5244}\x{5245}' + . '\x{5246}\x{5247}\x{5248}\x{5249}\x{524A}\x{524B}\x{524C}\x{524D}\x{524E}' + . '\x{5250}\x{5251}\x{5252}\x{5254}\x{5255}\x{5256}\x{5257}\x{5258}\x{5259}' + . '\x{525A}\x{525B}\x{525C}\x{525D}\x{525E}\x{525F}\x{5260}\x{5261}\x{5262}' + . '\x{5263}\x{5264}\x{5265}\x{5267}\x{5268}\x{5269}\x{526A}\x{526B}\x{526C}' + . '\x{526D}\x{526E}\x{526F}\x{5270}\x{5272}\x{5273}\x{5274}\x{5275}\x{5276}' + . '\x{5277}\x{5278}\x{527A}\x{527B}\x{527C}\x{527D}\x{527E}\x{527F}\x{5280}' + . '\x{5281}\x{5282}\x{5283}\x{5284}\x{5286}\x{5287}\x{5288}\x{5289}\x{528A}' + . '\x{528B}\x{528C}\x{528D}\x{528F}\x{5290}\x{5291}\x{5292}\x{5293}\x{5294}' + . '\x{5295}\x{5296}\x{5297}\x{5298}\x{5299}\x{529A}\x{529B}\x{529C}\x{529D}' + . '\x{529E}\x{529F}\x{52A0}\x{52A1}\x{52A2}\x{52A3}\x{52A5}\x{52A6}\x{52A7}' + . '\x{52A8}\x{52A9}\x{52AA}\x{52AB}\x{52AC}\x{52AD}\x{52AE}\x{52AF}\x{52B0}' + . '\x{52B1}\x{52B2}\x{52B3}\x{52B4}\x{52B5}\x{52B6}\x{52B7}\x{52B8}\x{52B9}' + . '\x{52BA}\x{52BB}\x{52BC}\x{52BD}\x{52BE}\x{52BF}\x{52C0}\x{52C1}\x{52C2}' + . '\x{52C3}\x{52C6}\x{52C7}\x{52C9}\x{52CA}\x{52CB}\x{52CD}\x{52CF}\x{52D0}' + . '\x{52D2}\x{52D3}\x{52D5}\x{52D6}\x{52D7}\x{52D8}\x{52D9}\x{52DA}\x{52DB}' + . '\x{52DC}\x{52DD}\x{52DE}\x{52DF}\x{52E0}\x{52E2}\x{52E3}\x{52E4}\x{52E6}' + . '\x{52E7}\x{52E8}\x{52E9}\x{52EA}\x{52EB}\x{52EC}\x{52ED}\x{52EF}\x{52F0}' + . '\x{52F1}\x{52F2}\x{52F3}\x{52F4}\x{52F5}\x{52F6}\x{52F7}\x{52F8}\x{52F9}' + . '\x{52FA}\x{52FB}\x{52FC}\x{52FD}\x{52FE}\x{52FF}\x{5300}\x{5301}\x{5302}' + . '\x{5305}\x{5306}\x{5307}\x{5308}\x{5309}\x{530A}\x{530B}\x{530C}\x{530D}' + . '\x{530E}\x{530F}\x{5310}\x{5311}\x{5312}\x{5313}\x{5314}\x{5315}\x{5316}' + . '\x{5317}\x{5319}\x{531A}\x{531C}\x{531D}\x{531F}\x{5320}\x{5321}\x{5322}' + . '\x{5323}\x{5324}\x{5325}\x{5326}\x{5328}\x{532A}\x{532B}\x{532C}\x{532D}' + . '\x{532E}\x{532F}\x{5330}\x{5331}\x{5333}\x{5334}\x{5337}\x{5339}\x{533A}' + . '\x{533B}\x{533C}\x{533D}\x{533E}\x{533F}\x{5340}\x{5341}\x{5343}\x{5344}' + . '\x{5345}\x{5346}\x{5347}\x{5348}\x{5349}\x{534A}\x{534B}\x{534C}\x{534D}' + . '\x{534E}\x{534F}\x{5350}\x{5351}\x{5352}\x{5353}\x{5354}\x{5355}\x{5356}' + . '\x{5357}\x{5358}\x{5359}\x{535A}\x{535C}\x{535E}\x{535F}\x{5360}\x{5361}' + . '\x{5362}\x{5363}\x{5364}\x{5365}\x{5366}\x{5367}\x{5369}\x{536B}\x{536C}' + . '\x{536E}\x{536F}\x{5370}\x{5371}\x{5372}\x{5373}\x{5374}\x{5375}\x{5376}' + . '\x{5377}\x{5378}\x{5379}\x{537A}\x{537B}\x{537C}\x{537D}\x{537E}\x{537F}' + . '\x{5381}\x{5382}\x{5383}\x{5384}\x{5385}\x{5386}\x{5387}\x{5388}\x{5389}' + . '\x{538A}\x{538B}\x{538C}\x{538D}\x{538E}\x{538F}\x{5390}\x{5391}\x{5392}' + . '\x{5393}\x{5394}\x{5395}\x{5396}\x{5397}\x{5398}\x{5399}\x{539A}\x{539B}' + . '\x{539C}\x{539D}\x{539E}\x{539F}\x{53A0}\x{53A2}\x{53A3}\x{53A4}\x{53A5}' + . '\x{53A6}\x{53A7}\x{53A8}\x{53A9}\x{53AC}\x{53AD}\x{53AE}\x{53B0}\x{53B1}' + . '\x{53B2}\x{53B3}\x{53B4}\x{53B5}\x{53B6}\x{53B7}\x{53B8}\x{53B9}\x{53BB}' + . '\x{53BC}\x{53BD}\x{53BE}\x{53BF}\x{53C0}\x{53C1}\x{53C2}\x{53C3}\x{53C4}' + . '\x{53C6}\x{53C7}\x{53C8}\x{53C9}\x{53CA}\x{53CB}\x{53CC}\x{53CD}\x{53CE}' + . '\x{53D0}\x{53D1}\x{53D2}\x{53D3}\x{53D4}\x{53D5}\x{53D6}\x{53D7}\x{53D8}' + . '\x{53D9}\x{53DB}\x{53DC}\x{53DF}\x{53E0}\x{53E1}\x{53E2}\x{53E3}\x{53E4}' + . '\x{53E5}\x{53E6}\x{53E8}\x{53E9}\x{53EA}\x{53EB}\x{53EC}\x{53ED}\x{53EE}' + . '\x{53EF}\x{53F0}\x{53F1}\x{53F2}\x{53F3}\x{53F4}\x{53F5}\x{53F6}\x{53F7}' + . '\x{53F8}\x{53F9}\x{53FA}\x{53FB}\x{53FC}\x{53FD}\x{53FE}\x{5401}\x{5402}' + . '\x{5403}\x{5404}\x{5405}\x{5406}\x{5407}\x{5408}\x{5409}\x{540A}\x{540B}' + . '\x{540C}\x{540D}\x{540E}\x{540F}\x{5410}\x{5411}\x{5412}\x{5413}\x{5414}' + . '\x{5415}\x{5416}\x{5417}\x{5418}\x{5419}\x{541B}\x{541C}\x{541D}\x{541E}' + . '\x{541F}\x{5420}\x{5421}\x{5423}\x{5424}\x{5425}\x{5426}\x{5427}\x{5428}' + . '\x{5429}\x{542A}\x{542B}\x{542C}\x{542D}\x{542E}\x{542F}\x{5430}\x{5431}' + . '\x{5432}\x{5433}\x{5434}\x{5435}\x{5436}\x{5437}\x{5438}\x{5439}\x{543A}' + . '\x{543B}\x{543C}\x{543D}\x{543E}\x{543F}\x{5440}\x{5441}\x{5442}\x{5443}' + . '\x{5444}\x{5445}\x{5446}\x{5447}\x{5448}\x{5449}\x{544A}\x{544B}\x{544D}' + . '\x{544E}\x{544F}\x{5450}\x{5451}\x{5452}\x{5453}\x{5454}\x{5455}\x{5456}' + . '\x{5457}\x{5458}\x{5459}\x{545A}\x{545B}\x{545C}\x{545E}\x{545F}\x{5460}' + . '\x{5461}\x{5462}\x{5463}\x{5464}\x{5465}\x{5466}\x{5467}\x{5468}\x{546A}' + . '\x{546B}\x{546C}\x{546D}\x{546E}\x{546F}\x{5470}\x{5471}\x{5472}\x{5473}' + . '\x{5474}\x{5475}\x{5476}\x{5477}\x{5478}\x{5479}\x{547A}\x{547B}\x{547C}' + . '\x{547D}\x{547E}\x{547F}\x{5480}\x{5481}\x{5482}\x{5483}\x{5484}\x{5485}' + . '\x{5486}\x{5487}\x{5488}\x{5489}\x{548B}\x{548C}\x{548D}\x{548E}\x{548F}' + . '\x{5490}\x{5491}\x{5492}\x{5493}\x{5494}\x{5495}\x{5496}\x{5497}\x{5498}' + . '\x{5499}\x{549A}\x{549B}\x{549C}\x{549D}\x{549E}\x{549F}\x{54A0}\x{54A1}' + . '\x{54A2}\x{54A3}\x{54A4}\x{54A5}\x{54A6}\x{54A7}\x{54A8}\x{54A9}\x{54AA}' + . '\x{54AB}\x{54AC}\x{54AD}\x{54AE}\x{54AF}\x{54B0}\x{54B1}\x{54B2}\x{54B3}' + . '\x{54B4}\x{54B6}\x{54B7}\x{54B8}\x{54B9}\x{54BA}\x{54BB}\x{54BC}\x{54BD}' + . '\x{54BE}\x{54BF}\x{54C0}\x{54C1}\x{54C2}\x{54C3}\x{54C4}\x{54C5}\x{54C6}' + . '\x{54C7}\x{54C8}\x{54C9}\x{54CA}\x{54CB}\x{54CC}\x{54CD}\x{54CE}\x{54CF}' + . '\x{54D0}\x{54D1}\x{54D2}\x{54D3}\x{54D4}\x{54D5}\x{54D6}\x{54D7}\x{54D8}' + . '\x{54D9}\x{54DA}\x{54DB}\x{54DC}\x{54DD}\x{54DE}\x{54DF}\x{54E0}\x{54E1}' + . '\x{54E2}\x{54E3}\x{54E4}\x{54E5}\x{54E6}\x{54E7}\x{54E8}\x{54E9}\x{54EA}' + . '\x{54EB}\x{54EC}\x{54ED}\x{54EE}\x{54EF}\x{54F0}\x{54F1}\x{54F2}\x{54F3}' + . '\x{54F4}\x{54F5}\x{54F7}\x{54F8}\x{54F9}\x{54FA}\x{54FB}\x{54FC}\x{54FD}' + . '\x{54FE}\x{54FF}\x{5500}\x{5501}\x{5502}\x{5503}\x{5504}\x{5505}\x{5506}' + . '\x{5507}\x{5508}\x{5509}\x{550A}\x{550B}\x{550C}\x{550D}\x{550E}\x{550F}' + . '\x{5510}\x{5511}\x{5512}\x{5513}\x{5514}\x{5516}\x{5517}\x{551A}\x{551B}' + . '\x{551C}\x{551D}\x{551E}\x{551F}\x{5520}\x{5521}\x{5522}\x{5523}\x{5524}' + . '\x{5525}\x{5526}\x{5527}\x{5528}\x{5529}\x{552A}\x{552B}\x{552C}\x{552D}' + . '\x{552E}\x{552F}\x{5530}\x{5531}\x{5532}\x{5533}\x{5534}\x{5535}\x{5536}' + . '\x{5537}\x{5538}\x{5539}\x{553A}\x{553B}\x{553C}\x{553D}\x{553E}\x{553F}' + . '\x{5540}\x{5541}\x{5542}\x{5543}\x{5544}\x{5545}\x{5546}\x{5548}\x{5549}' + . '\x{554A}\x{554B}\x{554C}\x{554D}\x{554E}\x{554F}\x{5550}\x{5551}\x{5552}' + . '\x{5553}\x{5554}\x{5555}\x{5556}\x{5557}\x{5558}\x{5559}\x{555A}\x{555B}' + . '\x{555C}\x{555D}\x{555E}\x{555F}\x{5561}\x{5562}\x{5563}\x{5564}\x{5565}' + . '\x{5566}\x{5567}\x{5568}\x{5569}\x{556A}\x{556B}\x{556C}\x{556D}\x{556E}' + . '\x{556F}\x{5570}\x{5571}\x{5572}\x{5573}\x{5574}\x{5575}\x{5576}\x{5577}' + . '\x{5578}\x{5579}\x{557B}\x{557C}\x{557D}\x{557E}\x{557F}\x{5580}\x{5581}' + . '\x{5582}\x{5583}\x{5584}\x{5585}\x{5586}\x{5587}\x{5588}\x{5589}\x{558A}' + . '\x{558B}\x{558C}\x{558D}\x{558E}\x{558F}\x{5590}\x{5591}\x{5592}\x{5593}' + . '\x{5594}\x{5595}\x{5596}\x{5597}\x{5598}\x{5599}\x{559A}\x{559B}\x{559C}' + . '\x{559D}\x{559E}\x{559F}\x{55A0}\x{55A1}\x{55A2}\x{55A3}\x{55A4}\x{55A5}' + . '\x{55A6}\x{55A7}\x{55A8}\x{55A9}\x{55AA}\x{55AB}\x{55AC}\x{55AD}\x{55AE}' + . '\x{55AF}\x{55B0}\x{55B1}\x{55B2}\x{55B3}\x{55B4}\x{55B5}\x{55B6}\x{55B7}' + . '\x{55B8}\x{55B9}\x{55BA}\x{55BB}\x{55BC}\x{55BD}\x{55BE}\x{55BF}\x{55C0}' + . '\x{55C1}\x{55C2}\x{55C3}\x{55C4}\x{55C5}\x{55C6}\x{55C7}\x{55C8}\x{55C9}' + . '\x{55CA}\x{55CB}\x{55CC}\x{55CD}\x{55CE}\x{55CF}\x{55D0}\x{55D1}\x{55D2}' + . '\x{55D3}\x{55D4}\x{55D5}\x{55D6}\x{55D7}\x{55D8}\x{55D9}\x{55DA}\x{55DB}' + . '\x{55DC}\x{55DD}\x{55DE}\x{55DF}\x{55E1}\x{55E2}\x{55E3}\x{55E4}\x{55E5}' + . '\x{55E6}\x{55E7}\x{55E8}\x{55E9}\x{55EA}\x{55EB}\x{55EC}\x{55ED}\x{55EE}' + . '\x{55EF}\x{55F0}\x{55F1}\x{55F2}\x{55F3}\x{55F4}\x{55F5}\x{55F6}\x{55F7}' + . '\x{55F9}\x{55FA}\x{55FB}\x{55FC}\x{55FD}\x{55FE}\x{55FF}\x{5600}\x{5601}' + . '\x{5602}\x{5603}\x{5604}\x{5606}\x{5607}\x{5608}\x{5609}\x{560C}\x{560D}' + . '\x{560E}\x{560F}\x{5610}\x{5611}\x{5612}\x{5613}\x{5614}\x{5615}\x{5616}' + . '\x{5617}\x{5618}\x{5619}\x{561A}\x{561B}\x{561C}\x{561D}\x{561E}\x{561F}' + . '\x{5621}\x{5622}\x{5623}\x{5624}\x{5625}\x{5626}\x{5627}\x{5628}\x{5629}' + . '\x{562A}\x{562C}\x{562D}\x{562E}\x{562F}\x{5630}\x{5631}\x{5632}\x{5633}' + . '\x{5634}\x{5635}\x{5636}\x{5638}\x{5639}\x{563A}\x{563B}\x{563D}\x{563E}' + . '\x{563F}\x{5640}\x{5641}\x{5642}\x{5643}\x{5645}\x{5646}\x{5647}\x{5648}' + . '\x{5649}\x{564A}\x{564C}\x{564D}\x{564E}\x{564F}\x{5650}\x{5652}\x{5653}' + . '\x{5654}\x{5655}\x{5657}\x{5658}\x{5659}\x{565A}\x{565B}\x{565C}\x{565D}' + . '\x{565E}\x{5660}\x{5662}\x{5663}\x{5664}\x{5665}\x{5666}\x{5667}\x{5668}' + . '\x{5669}\x{566A}\x{566B}\x{566C}\x{566D}\x{566E}\x{566F}\x{5670}\x{5671}' + . '\x{5672}\x{5673}\x{5674}\x{5676}\x{5677}\x{5678}\x{5679}\x{567A}\x{567B}' + . '\x{567C}\x{567E}\x{567F}\x{5680}\x{5681}\x{5682}\x{5683}\x{5684}\x{5685}' + . '\x{5686}\x{5687}\x{568A}\x{568C}\x{568D}\x{568E}\x{568F}\x{5690}\x{5691}' + . '\x{5692}\x{5693}\x{5694}\x{5695}\x{5697}\x{5698}\x{5699}\x{569A}\x{569B}' + . '\x{569C}\x{569D}\x{569F}\x{56A0}\x{56A1}\x{56A3}\x{56A4}\x{56A5}\x{56A6}' + . '\x{56A7}\x{56A8}\x{56A9}\x{56AA}\x{56AB}\x{56AC}\x{56AD}\x{56AE}\x{56AF}' + . '\x{56B0}\x{56B1}\x{56B2}\x{56B3}\x{56B4}\x{56B5}\x{56B6}\x{56B7}\x{56B8}' + . '\x{56B9}\x{56BB}\x{56BC}\x{56BD}\x{56BE}\x{56BF}\x{56C0}\x{56C1}\x{56C2}' + . '\x{56C3}\x{56C4}\x{56C5}\x{56C6}\x{56C7}\x{56C8}\x{56C9}\x{56CA}\x{56CB}' + . '\x{56CC}\x{56CD}\x{56CE}\x{56D0}\x{56D1}\x{56D2}\x{56D3}\x{56D4}\x{56D5}' + . '\x{56D6}\x{56D7}\x{56D8}\x{56DA}\x{56DB}\x{56DC}\x{56DD}\x{56DE}\x{56DF}' + . '\x{56E0}\x{56E1}\x{56E2}\x{56E3}\x{56E4}\x{56E5}\x{56E7}\x{56E8}\x{56E9}' + . '\x{56EA}\x{56EB}\x{56EC}\x{56ED}\x{56EE}\x{56EF}\x{56F0}\x{56F1}\x{56F2}' + . '\x{56F3}\x{56F4}\x{56F5}\x{56F7}\x{56F9}\x{56FA}\x{56FD}\x{56FE}\x{56FF}' + . '\x{5700}\x{5701}\x{5702}\x{5703}\x{5704}\x{5706}\x{5707}\x{5708}\x{5709}' + . '\x{570A}\x{570B}\x{570C}\x{570D}\x{570E}\x{570F}\x{5710}\x{5712}\x{5713}' + . '\x{5714}\x{5715}\x{5716}\x{5718}\x{5719}\x{571A}\x{571B}\x{571C}\x{571D}' + . '\x{571E}\x{571F}\x{5720}\x{5722}\x{5723}\x{5725}\x{5726}\x{5727}\x{5728}' + . '\x{5729}\x{572A}\x{572B}\x{572C}\x{572D}\x{572E}\x{572F}\x{5730}\x{5731}' + . '\x{5732}\x{5733}\x{5734}\x{5735}\x{5736}\x{5737}\x{5738}\x{5739}\x{573A}' + . '\x{573B}\x{573C}\x{573E}\x{573F}\x{5740}\x{5741}\x{5742}\x{5744}\x{5745}' + . '\x{5746}\x{5747}\x{5749}\x{574A}\x{574B}\x{574C}\x{574D}\x{574E}\x{574F}' + . '\x{5750}\x{5751}\x{5752}\x{5753}\x{5754}\x{5757}\x{5759}\x{575A}\x{575B}' + . '\x{575C}\x{575D}\x{575E}\x{575F}\x{5760}\x{5761}\x{5762}\x{5764}\x{5765}' + . '\x{5766}\x{5767}\x{5768}\x{5769}\x{576A}\x{576B}\x{576C}\x{576D}\x{576F}' + . '\x{5770}\x{5771}\x{5772}\x{5773}\x{5774}\x{5775}\x{5776}\x{5777}\x{5779}' + . '\x{577A}\x{577B}\x{577C}\x{577D}\x{577E}\x{577F}\x{5780}\x{5782}\x{5783}' + . '\x{5784}\x{5785}\x{5786}\x{5788}\x{5789}\x{578A}\x{578B}\x{578C}\x{578D}' + . '\x{578E}\x{578F}\x{5790}\x{5791}\x{5792}\x{5793}\x{5794}\x{5795}\x{5797}' + . '\x{5798}\x{5799}\x{579A}\x{579B}\x{579C}\x{579D}\x{579E}\x{579F}\x{57A0}' + . '\x{57A1}\x{57A2}\x{57A3}\x{57A4}\x{57A5}\x{57A6}\x{57A7}\x{57A9}\x{57AA}' + . '\x{57AB}\x{57AC}\x{57AD}\x{57AE}\x{57AF}\x{57B0}\x{57B1}\x{57B2}\x{57B3}' + . '\x{57B4}\x{57B5}\x{57B6}\x{57B7}\x{57B8}\x{57B9}\x{57BA}\x{57BB}\x{57BC}' + . '\x{57BD}\x{57BE}\x{57BF}\x{57C0}\x{57C1}\x{57C2}\x{57C3}\x{57C4}\x{57C5}' + . '\x{57C6}\x{57C7}\x{57C8}\x{57C9}\x{57CB}\x{57CC}\x{57CD}\x{57CE}\x{57CF}' + . '\x{57D0}\x{57D2}\x{57D3}\x{57D4}\x{57D5}\x{57D6}\x{57D8}\x{57D9}\x{57DA}' + . '\x{57DC}\x{57DD}\x{57DF}\x{57E0}\x{57E1}\x{57E2}\x{57E3}\x{57E4}\x{57E5}' + . '\x{57E6}\x{57E7}\x{57E8}\x{57E9}\x{57EA}\x{57EB}\x{57EC}\x{57ED}\x{57EE}' + . '\x{57EF}\x{57F0}\x{57F1}\x{57F2}\x{57F3}\x{57F4}\x{57F5}\x{57F6}\x{57F7}' + . '\x{57F8}\x{57F9}\x{57FA}\x{57FB}\x{57FC}\x{57FD}\x{57FE}\x{57FF}\x{5800}' + . '\x{5801}\x{5802}\x{5803}\x{5804}\x{5805}\x{5806}\x{5807}\x{5808}\x{5809}' + . '\x{580A}\x{580B}\x{580C}\x{580D}\x{580E}\x{580F}\x{5810}\x{5811}\x{5812}' + . '\x{5813}\x{5814}\x{5815}\x{5816}\x{5819}\x{581A}\x{581B}\x{581C}\x{581D}' + . '\x{581E}\x{581F}\x{5820}\x{5821}\x{5822}\x{5823}\x{5824}\x{5825}\x{5826}' + . '\x{5827}\x{5828}\x{5829}\x{582A}\x{582B}\x{582C}\x{582D}\x{582E}\x{582F}' + . '\x{5830}\x{5831}\x{5832}\x{5833}\x{5834}\x{5835}\x{5836}\x{5837}\x{5838}' + . '\x{5839}\x{583A}\x{583B}\x{583C}\x{583D}\x{583E}\x{583F}\x{5840}\x{5842}' + . '\x{5843}\x{5844}\x{5845}\x{5846}\x{5847}\x{5848}\x{5849}\x{584A}\x{584B}' + . '\x{584C}\x{584D}\x{584E}\x{584F}\x{5851}\x{5852}\x{5853}\x{5854}\x{5855}' + . '\x{5857}\x{5858}\x{5859}\x{585A}\x{585B}\x{585C}\x{585D}\x{585E}\x{585F}' + . '\x{5861}\x{5862}\x{5863}\x{5864}\x{5865}\x{5868}\x{5869}\x{586A}\x{586B}' + . '\x{586C}\x{586D}\x{586E}\x{586F}\x{5870}\x{5871}\x{5872}\x{5873}\x{5874}' + . '\x{5875}\x{5876}\x{5878}\x{5879}\x{587A}\x{587B}\x{587C}\x{587D}\x{587E}' + . '\x{587F}\x{5880}\x{5881}\x{5882}\x{5883}\x{5884}\x{5885}\x{5886}\x{5887}' + . '\x{5888}\x{5889}\x{588A}\x{588B}\x{588C}\x{588D}\x{588E}\x{588F}\x{5890}' + . '\x{5891}\x{5892}\x{5893}\x{5894}\x{5896}\x{5897}\x{5898}\x{5899}\x{589A}' + . '\x{589B}\x{589C}\x{589D}\x{589E}\x{589F}\x{58A0}\x{58A1}\x{58A2}\x{58A3}' + . '\x{58A4}\x{58A5}\x{58A6}\x{58A7}\x{58A8}\x{58A9}\x{58AB}\x{58AC}\x{58AD}' + . '\x{58AE}\x{58AF}\x{58B0}\x{58B1}\x{58B2}\x{58B3}\x{58B4}\x{58B7}\x{58B8}' + . '\x{58B9}\x{58BA}\x{58BB}\x{58BC}\x{58BD}\x{58BE}\x{58BF}\x{58C1}\x{58C2}' + . '\x{58C5}\x{58C6}\x{58C7}\x{58C8}\x{58C9}\x{58CA}\x{58CB}\x{58CE}\x{58CF}' + . '\x{58D1}\x{58D2}\x{58D3}\x{58D4}\x{58D5}\x{58D6}\x{58D7}\x{58D8}\x{58D9}' + . '\x{58DA}\x{58DB}\x{58DD}\x{58DE}\x{58DF}\x{58E0}\x{58E2}\x{58E3}\x{58E4}' + . '\x{58E5}\x{58E7}\x{58E8}\x{58E9}\x{58EA}\x{58EB}\x{58EC}\x{58ED}\x{58EE}' + . '\x{58EF}\x{58F0}\x{58F1}\x{58F2}\x{58F3}\x{58F4}\x{58F6}\x{58F7}\x{58F8}' + . '\x{58F9}\x{58FA}\x{58FB}\x{58FC}\x{58FD}\x{58FE}\x{58FF}\x{5900}\x{5902}' + . '\x{5903}\x{5904}\x{5906}\x{5907}\x{5909}\x{590A}\x{590B}\x{590C}\x{590D}' + . '\x{590E}\x{590F}\x{5910}\x{5912}\x{5914}\x{5915}\x{5916}\x{5917}\x{5918}' + . '\x{5919}\x{591A}\x{591B}\x{591C}\x{591D}\x{591E}\x{591F}\x{5920}\x{5921}' + . '\x{5922}\x{5924}\x{5925}\x{5926}\x{5927}\x{5928}\x{5929}\x{592A}\x{592B}' + . '\x{592C}\x{592D}\x{592E}\x{592F}\x{5930}\x{5931}\x{5932}\x{5934}\x{5935}' + . '\x{5937}\x{5938}\x{5939}\x{593A}\x{593B}\x{593C}\x{593D}\x{593E}\x{593F}' + . '\x{5940}\x{5941}\x{5942}\x{5943}\x{5944}\x{5945}\x{5946}\x{5947}\x{5948}' + . '\x{5949}\x{594A}\x{594B}\x{594C}\x{594D}\x{594E}\x{594F}\x{5950}\x{5951}' + . '\x{5952}\x{5953}\x{5954}\x{5955}\x{5956}\x{5957}\x{5958}\x{595A}\x{595C}' + . '\x{595D}\x{595E}\x{595F}\x{5960}\x{5961}\x{5962}\x{5963}\x{5964}\x{5965}' + . '\x{5966}\x{5967}\x{5968}\x{5969}\x{596A}\x{596B}\x{596C}\x{596D}\x{596E}' + . '\x{596F}\x{5970}\x{5971}\x{5972}\x{5973}\x{5974}\x{5975}\x{5976}\x{5977}' + . '\x{5978}\x{5979}\x{597A}\x{597B}\x{597C}\x{597D}\x{597E}\x{597F}\x{5980}' + . '\x{5981}\x{5982}\x{5983}\x{5984}\x{5985}\x{5986}\x{5987}\x{5988}\x{5989}' + . '\x{598A}\x{598B}\x{598C}\x{598D}\x{598E}\x{598F}\x{5990}\x{5991}\x{5992}' + . '\x{5993}\x{5994}\x{5995}\x{5996}\x{5997}\x{5998}\x{5999}\x{599A}\x{599C}' + . '\x{599D}\x{599E}\x{599F}\x{59A0}\x{59A1}\x{59A2}\x{59A3}\x{59A4}\x{59A5}' + . '\x{59A6}\x{59A7}\x{59A8}\x{59A9}\x{59AA}\x{59AB}\x{59AC}\x{59AD}\x{59AE}' + . '\x{59AF}\x{59B0}\x{59B1}\x{59B2}\x{59B3}\x{59B4}\x{59B5}\x{59B6}\x{59B8}' + . '\x{59B9}\x{59BA}\x{59BB}\x{59BC}\x{59BD}\x{59BE}\x{59BF}\x{59C0}\x{59C1}' + . '\x{59C2}\x{59C3}\x{59C4}\x{59C5}\x{59C6}\x{59C7}\x{59C8}\x{59C9}\x{59CA}' + . '\x{59CB}\x{59CC}\x{59CD}\x{59CE}\x{59CF}\x{59D0}\x{59D1}\x{59D2}\x{59D3}' + . '\x{59D4}\x{59D5}\x{59D6}\x{59D7}\x{59D8}\x{59D9}\x{59DA}\x{59DB}\x{59DC}' + . '\x{59DD}\x{59DE}\x{59DF}\x{59E0}\x{59E1}\x{59E2}\x{59E3}\x{59E4}\x{59E5}' + . '\x{59E6}\x{59E8}\x{59E9}\x{59EA}\x{59EB}\x{59EC}\x{59ED}\x{59EE}\x{59EF}' + . '\x{59F0}\x{59F1}\x{59F2}\x{59F3}\x{59F4}\x{59F5}\x{59F6}\x{59F7}\x{59F8}' + . '\x{59F9}\x{59FA}\x{59FB}\x{59FC}\x{59FD}\x{59FE}\x{59FF}\x{5A00}\x{5A01}' + . '\x{5A02}\x{5A03}\x{5A04}\x{5A05}\x{5A06}\x{5A07}\x{5A08}\x{5A09}\x{5A0A}' + . '\x{5A0B}\x{5A0C}\x{5A0D}\x{5A0E}\x{5A0F}\x{5A10}\x{5A11}\x{5A12}\x{5A13}' + . '\x{5A14}\x{5A15}\x{5A16}\x{5A17}\x{5A18}\x{5A19}\x{5A1A}\x{5A1B}\x{5A1C}' + . '\x{5A1D}\x{5A1E}\x{5A1F}\x{5A20}\x{5A21}\x{5A22}\x{5A23}\x{5A25}\x{5A27}' + . '\x{5A28}\x{5A29}\x{5A2A}\x{5A2B}\x{5A2D}\x{5A2E}\x{5A2F}\x{5A31}\x{5A32}' + . '\x{5A33}\x{5A34}\x{5A35}\x{5A36}\x{5A37}\x{5A38}\x{5A39}\x{5A3A}\x{5A3B}' + . '\x{5A3C}\x{5A3D}\x{5A3E}\x{5A3F}\x{5A40}\x{5A41}\x{5A42}\x{5A43}\x{5A44}' + . '\x{5A45}\x{5A46}\x{5A47}\x{5A48}\x{5A49}\x{5A4A}\x{5A4B}\x{5A4C}\x{5A4D}' + . '\x{5A4E}\x{5A4F}\x{5A50}\x{5A51}\x{5A52}\x{5A53}\x{5A55}\x{5A56}\x{5A57}' + . '\x{5A58}\x{5A5A}\x{5A5B}\x{5A5C}\x{5A5D}\x{5A5E}\x{5A5F}\x{5A60}\x{5A61}' + . '\x{5A62}\x{5A63}\x{5A64}\x{5A65}\x{5A66}\x{5A67}\x{5A68}\x{5A69}\x{5A6A}' + . '\x{5A6B}\x{5A6C}\x{5A6D}\x{5A6E}\x{5A70}\x{5A72}\x{5A73}\x{5A74}\x{5A75}' + . '\x{5A76}\x{5A77}\x{5A78}\x{5A79}\x{5A7A}\x{5A7B}\x{5A7C}\x{5A7D}\x{5A7E}' + . '\x{5A7F}\x{5A80}\x{5A81}\x{5A82}\x{5A83}\x{5A84}\x{5A85}\x{5A86}\x{5A88}' + . '\x{5A89}\x{5A8A}\x{5A8B}\x{5A8C}\x{5A8E}\x{5A8F}\x{5A90}\x{5A91}\x{5A92}' + . '\x{5A93}\x{5A94}\x{5A95}\x{5A96}\x{5A97}\x{5A98}\x{5A99}\x{5A9A}\x{5A9B}' + . '\x{5A9C}\x{5A9D}\x{5A9E}\x{5A9F}\x{5AA0}\x{5AA1}\x{5AA2}\x{5AA3}\x{5AA4}' + . '\x{5AA5}\x{5AA6}\x{5AA7}\x{5AA8}\x{5AA9}\x{5AAA}\x{5AAC}\x{5AAD}\x{5AAE}' + . '\x{5AAF}\x{5AB0}\x{5AB1}\x{5AB2}\x{5AB3}\x{5AB4}\x{5AB5}\x{5AB6}\x{5AB7}' + . '\x{5AB8}\x{5AB9}\x{5ABA}\x{5ABB}\x{5ABC}\x{5ABD}\x{5ABE}\x{5ABF}\x{5AC0}' + . '\x{5AC1}\x{5AC2}\x{5AC3}\x{5AC4}\x{5AC5}\x{5AC6}\x{5AC7}\x{5AC8}\x{5AC9}' + . '\x{5ACA}\x{5ACB}\x{5ACC}\x{5ACD}\x{5ACE}\x{5ACF}\x{5AD1}\x{5AD2}\x{5AD4}' + . '\x{5AD5}\x{5AD6}\x{5AD7}\x{5AD8}\x{5AD9}\x{5ADA}\x{5ADB}\x{5ADC}\x{5ADD}' + . '\x{5ADE}\x{5ADF}\x{5AE0}\x{5AE1}\x{5AE2}\x{5AE3}\x{5AE4}\x{5AE5}\x{5AE6}' + . '\x{5AE7}\x{5AE8}\x{5AE9}\x{5AEA}\x{5AEB}\x{5AEC}\x{5AED}\x{5AEE}\x{5AF1}' + . '\x{5AF2}\x{5AF3}\x{5AF4}\x{5AF5}\x{5AF6}\x{5AF7}\x{5AF8}\x{5AF9}\x{5AFA}' + . '\x{5AFB}\x{5AFC}\x{5AFD}\x{5AFE}\x{5AFF}\x{5B00}\x{5B01}\x{5B02}\x{5B03}' + . '\x{5B04}\x{5B05}\x{5B06}\x{5B07}\x{5B08}\x{5B09}\x{5B0B}\x{5B0C}\x{5B0E}' + . '\x{5B0F}\x{5B10}\x{5B11}\x{5B12}\x{5B13}\x{5B14}\x{5B15}\x{5B16}\x{5B17}' + . '\x{5B18}\x{5B19}\x{5B1A}\x{5B1B}\x{5B1C}\x{5B1D}\x{5B1E}\x{5B1F}\x{5B20}' + . '\x{5B21}\x{5B22}\x{5B23}\x{5B24}\x{5B25}\x{5B26}\x{5B27}\x{5B28}\x{5B29}' + . '\x{5B2A}\x{5B2B}\x{5B2C}\x{5B2D}\x{5B2E}\x{5B2F}\x{5B30}\x{5B31}\x{5B32}' + . '\x{5B33}\x{5B34}\x{5B35}\x{5B36}\x{5B37}\x{5B38}\x{5B3A}\x{5B3B}\x{5B3C}' + . '\x{5B3D}\x{5B3E}\x{5B3F}\x{5B40}\x{5B41}\x{5B42}\x{5B43}\x{5B44}\x{5B45}' + . '\x{5B47}\x{5B48}\x{5B49}\x{5B4A}\x{5B4B}\x{5B4C}\x{5B4D}\x{5B4E}\x{5B50}' + . '\x{5B51}\x{5B53}\x{5B54}\x{5B55}\x{5B56}\x{5B57}\x{5B58}\x{5B59}\x{5B5A}' + . '\x{5B5B}\x{5B5C}\x{5B5D}\x{5B5E}\x{5B5F}\x{5B62}\x{5B63}\x{5B64}\x{5B65}' + . '\x{5B66}\x{5B67}\x{5B68}\x{5B69}\x{5B6A}\x{5B6B}\x{5B6C}\x{5B6D}\x{5B6E}' + . '\x{5B70}\x{5B71}\x{5B72}\x{5B73}\x{5B74}\x{5B75}\x{5B76}\x{5B77}\x{5B78}' + . '\x{5B7A}\x{5B7B}\x{5B7C}\x{5B7D}\x{5B7F}\x{5B80}\x{5B81}\x{5B82}\x{5B83}' + . '\x{5B84}\x{5B85}\x{5B87}\x{5B88}\x{5B89}\x{5B8A}\x{5B8B}\x{5B8C}\x{5B8D}' + . '\x{5B8E}\x{5B8F}\x{5B91}\x{5B92}\x{5B93}\x{5B94}\x{5B95}\x{5B96}\x{5B97}' + . '\x{5B98}\x{5B99}\x{5B9A}\x{5B9B}\x{5B9C}\x{5B9D}\x{5B9E}\x{5B9F}\x{5BA0}' + . '\x{5BA1}\x{5BA2}\x{5BA3}\x{5BA4}\x{5BA5}\x{5BA6}\x{5BA7}\x{5BA8}\x{5BAA}' + . '\x{5BAB}\x{5BAC}\x{5BAD}\x{5BAE}\x{5BAF}\x{5BB0}\x{5BB1}\x{5BB3}\x{5BB4}' + . '\x{5BB5}\x{5BB6}\x{5BB8}\x{5BB9}\x{5BBA}\x{5BBB}\x{5BBD}\x{5BBE}\x{5BBF}' + . '\x{5BC0}\x{5BC1}\x{5BC2}\x{5BC3}\x{5BC4}\x{5BC5}\x{5BC6}\x{5BC7}\x{5BCA}' + . '\x{5BCB}\x{5BCC}\x{5BCD}\x{5BCE}\x{5BCF}\x{5BD0}\x{5BD1}\x{5BD2}\x{5BD3}' + . '\x{5BD4}\x{5BD5}\x{5BD6}\x{5BD8}\x{5BD9}\x{5BDB}\x{5BDC}\x{5BDD}\x{5BDE}' + . '\x{5BDF}\x{5BE0}\x{5BE1}\x{5BE2}\x{5BE3}\x{5BE4}\x{5BE5}\x{5BE6}\x{5BE7}' + . '\x{5BE8}\x{5BE9}\x{5BEA}\x{5BEB}\x{5BEC}\x{5BED}\x{5BEE}\x{5BEF}\x{5BF0}' + . '\x{5BF1}\x{5BF2}\x{5BF3}\x{5BF4}\x{5BF5}\x{5BF6}\x{5BF7}\x{5BF8}\x{5BF9}' + . '\x{5BFA}\x{5BFB}\x{5BFC}\x{5BFD}\x{5BFF}\x{5C01}\x{5C03}\x{5C04}\x{5C05}' + . '\x{5C06}\x{5C07}\x{5C08}\x{5C09}\x{5C0A}\x{5C0B}\x{5C0C}\x{5C0D}\x{5C0E}' + . '\x{5C0F}\x{5C10}\x{5C11}\x{5C12}\x{5C13}\x{5C14}\x{5C15}\x{5C16}\x{5C17}' + . '\x{5C18}\x{5C19}\x{5C1A}\x{5C1C}\x{5C1D}\x{5C1E}\x{5C1F}\x{5C20}\x{5C21}' + . '\x{5C22}\x{5C24}\x{5C25}\x{5C27}\x{5C28}\x{5C2A}\x{5C2B}\x{5C2C}\x{5C2D}' + . '\x{5C2E}\x{5C2F}\x{5C30}\x{5C31}\x{5C32}\x{5C33}\x{5C34}\x{5C35}\x{5C37}' + . '\x{5C38}\x{5C39}\x{5C3A}\x{5C3B}\x{5C3C}\x{5C3D}\x{5C3E}\x{5C3F}\x{5C40}' + . '\x{5C41}\x{5C42}\x{5C43}\x{5C44}\x{5C45}\x{5C46}\x{5C47}\x{5C48}\x{5C49}' + . '\x{5C4A}\x{5C4B}\x{5C4C}\x{5C4D}\x{5C4E}\x{5C4F}\x{5C50}\x{5C51}\x{5C52}' + . '\x{5C53}\x{5C54}\x{5C55}\x{5C56}\x{5C57}\x{5C58}\x{5C59}\x{5C5B}\x{5C5C}' + . '\x{5C5D}\x{5C5E}\x{5C5F}\x{5C60}\x{5C61}\x{5C62}\x{5C63}\x{5C64}\x{5C65}' + . '\x{5C66}\x{5C67}\x{5C68}\x{5C69}\x{5C6A}\x{5C6B}\x{5C6C}\x{5C6D}\x{5C6E}' + . '\x{5C6F}\x{5C70}\x{5C71}\x{5C72}\x{5C73}\x{5C74}\x{5C75}\x{5C76}\x{5C77}' + . '\x{5C78}\x{5C79}\x{5C7A}\x{5C7B}\x{5C7C}\x{5C7D}\x{5C7E}\x{5C7F}\x{5C80}' + . '\x{5C81}\x{5C82}\x{5C83}\x{5C84}\x{5C86}\x{5C87}\x{5C88}\x{5C89}\x{5C8A}' + . '\x{5C8B}\x{5C8C}\x{5C8D}\x{5C8E}\x{5C8F}\x{5C90}\x{5C91}\x{5C92}\x{5C93}' + . '\x{5C94}\x{5C95}\x{5C96}\x{5C97}\x{5C98}\x{5C99}\x{5C9A}\x{5C9B}\x{5C9C}' + . '\x{5C9D}\x{5C9E}\x{5C9F}\x{5CA0}\x{5CA1}\x{5CA2}\x{5CA3}\x{5CA4}\x{5CA5}' + . '\x{5CA6}\x{5CA7}\x{5CA8}\x{5CA9}\x{5CAA}\x{5CAB}\x{5CAC}\x{5CAD}\x{5CAE}' + . '\x{5CAF}\x{5CB0}\x{5CB1}\x{5CB2}\x{5CB3}\x{5CB5}\x{5CB6}\x{5CB7}\x{5CB8}' + . '\x{5CBA}\x{5CBB}\x{5CBC}\x{5CBD}\x{5CBE}\x{5CBF}\x{5CC1}\x{5CC2}\x{5CC3}' + . '\x{5CC4}\x{5CC5}\x{5CC6}\x{5CC7}\x{5CC8}\x{5CC9}\x{5CCA}\x{5CCB}\x{5CCC}' + . '\x{5CCD}\x{5CCE}\x{5CCF}\x{5CD0}\x{5CD1}\x{5CD2}\x{5CD3}\x{5CD4}\x{5CD6}' + . '\x{5CD7}\x{5CD8}\x{5CD9}\x{5CDA}\x{5CDB}\x{5CDC}\x{5CDE}\x{5CDF}\x{5CE0}' + . '\x{5CE1}\x{5CE2}\x{5CE3}\x{5CE4}\x{5CE5}\x{5CE6}\x{5CE7}\x{5CE8}\x{5CE9}' + . '\x{5CEA}\x{5CEB}\x{5CEC}\x{5CED}\x{5CEE}\x{5CEF}\x{5CF0}\x{5CF1}\x{5CF2}' + . '\x{5CF3}\x{5CF4}\x{5CF6}\x{5CF7}\x{5CF8}\x{5CF9}\x{5CFA}\x{5CFB}\x{5CFC}' + . '\x{5CFD}\x{5CFE}\x{5CFF}\x{5D00}\x{5D01}\x{5D02}\x{5D03}\x{5D04}\x{5D05}' + . '\x{5D06}\x{5D07}\x{5D08}\x{5D09}\x{5D0A}\x{5D0B}\x{5D0C}\x{5D0D}\x{5D0E}' + . '\x{5D0F}\x{5D10}\x{5D11}\x{5D12}\x{5D13}\x{5D14}\x{5D15}\x{5D16}\x{5D17}' + . '\x{5D18}\x{5D19}\x{5D1A}\x{5D1B}\x{5D1C}\x{5D1D}\x{5D1E}\x{5D1F}\x{5D20}' + . '\x{5D21}\x{5D22}\x{5D23}\x{5D24}\x{5D25}\x{5D26}\x{5D27}\x{5D28}\x{5D29}' + . '\x{5D2A}\x{5D2C}\x{5D2D}\x{5D2E}\x{5D30}\x{5D31}\x{5D32}\x{5D33}\x{5D34}' + . '\x{5D35}\x{5D36}\x{5D37}\x{5D38}\x{5D39}\x{5D3A}\x{5D3C}\x{5D3D}\x{5D3E}' + . '\x{5D3F}\x{5D40}\x{5D41}\x{5D42}\x{5D43}\x{5D44}\x{5D45}\x{5D46}\x{5D47}' + . '\x{5D48}\x{5D49}\x{5D4A}\x{5D4B}\x{5D4C}\x{5D4D}\x{5D4E}\x{5D4F}\x{5D50}' + . '\x{5D51}\x{5D52}\x{5D54}\x{5D55}\x{5D56}\x{5D58}\x{5D59}\x{5D5A}\x{5D5B}' + . '\x{5D5D}\x{5D5E}\x{5D5F}\x{5D61}\x{5D62}\x{5D63}\x{5D64}\x{5D65}\x{5D66}' + . '\x{5D67}\x{5D68}\x{5D69}\x{5D6A}\x{5D6B}\x{5D6C}\x{5D6D}\x{5D6E}\x{5D6F}' + . '\x{5D70}\x{5D71}\x{5D72}\x{5D73}\x{5D74}\x{5D75}\x{5D76}\x{5D77}\x{5D78}' + . '\x{5D79}\x{5D7A}\x{5D7B}\x{5D7C}\x{5D7D}\x{5D7E}\x{5D7F}\x{5D80}\x{5D81}' + . '\x{5D82}\x{5D84}\x{5D85}\x{5D86}\x{5D87}\x{5D88}\x{5D89}\x{5D8A}\x{5D8B}' + . '\x{5D8C}\x{5D8D}\x{5D8E}\x{5D8F}\x{5D90}\x{5D91}\x{5D92}\x{5D93}\x{5D94}' + . '\x{5D95}\x{5D97}\x{5D98}\x{5D99}\x{5D9A}\x{5D9B}\x{5D9C}\x{5D9D}\x{5D9E}' + . '\x{5D9F}\x{5DA0}\x{5DA1}\x{5DA2}\x{5DA5}\x{5DA6}\x{5DA7}\x{5DA8}\x{5DA9}' + . '\x{5DAA}\x{5DAC}\x{5DAD}\x{5DAE}\x{5DAF}\x{5DB0}\x{5DB1}\x{5DB2}\x{5DB4}' + . '\x{5DB5}\x{5DB6}\x{5DB7}\x{5DB8}\x{5DBA}\x{5DBB}\x{5DBC}\x{5DBD}\x{5DBE}' + . '\x{5DBF}\x{5DC0}\x{5DC1}\x{5DC2}\x{5DC3}\x{5DC5}\x{5DC6}\x{5DC7}\x{5DC8}' + . '\x{5DC9}\x{5DCA}\x{5DCB}\x{5DCC}\x{5DCD}\x{5DCE}\x{5DCF}\x{5DD0}\x{5DD1}' + . '\x{5DD2}\x{5DD3}\x{5DD4}\x{5DD5}\x{5DD6}\x{5DD8}\x{5DD9}\x{5DDB}\x{5DDD}' + . '\x{5DDE}\x{5DDF}\x{5DE0}\x{5DE1}\x{5DE2}\x{5DE3}\x{5DE4}\x{5DE5}\x{5DE6}' + . '\x{5DE7}\x{5DE8}\x{5DE9}\x{5DEA}\x{5DEB}\x{5DEC}\x{5DED}\x{5DEE}\x{5DEF}' + . '\x{5DF0}\x{5DF1}\x{5DF2}\x{5DF3}\x{5DF4}\x{5DF5}\x{5DF7}\x{5DF8}\x{5DF9}' + . '\x{5DFA}\x{5DFB}\x{5DFC}\x{5DFD}\x{5DFE}\x{5DFF}\x{5E00}\x{5E01}\x{5E02}' + . '\x{5E03}\x{5E04}\x{5E05}\x{5E06}\x{5E07}\x{5E08}\x{5E09}\x{5E0A}\x{5E0B}' + . '\x{5E0C}\x{5E0D}\x{5E0E}\x{5E0F}\x{5E10}\x{5E11}\x{5E13}\x{5E14}\x{5E15}' + . '\x{5E16}\x{5E17}\x{5E18}\x{5E19}\x{5E1A}\x{5E1B}\x{5E1C}\x{5E1D}\x{5E1E}' + . '\x{5E1F}\x{5E20}\x{5E21}\x{5E22}\x{5E23}\x{5E24}\x{5E25}\x{5E26}\x{5E27}' + . '\x{5E28}\x{5E29}\x{5E2A}\x{5E2B}\x{5E2C}\x{5E2D}\x{5E2E}\x{5E2F}\x{5E30}' + . '\x{5E31}\x{5E32}\x{5E33}\x{5E34}\x{5E35}\x{5E36}\x{5E37}\x{5E38}\x{5E39}' + . '\x{5E3A}\x{5E3B}\x{5E3C}\x{5E3D}\x{5E3E}\x{5E40}\x{5E41}\x{5E42}\x{5E43}' + . '\x{5E44}\x{5E45}\x{5E46}\x{5E47}\x{5E49}\x{5E4A}\x{5E4B}\x{5E4C}\x{5E4D}' + . '\x{5E4E}\x{5E4F}\x{5E50}\x{5E52}\x{5E53}\x{5E54}\x{5E55}\x{5E56}\x{5E57}' + . '\x{5E58}\x{5E59}\x{5E5A}\x{5E5B}\x{5E5C}\x{5E5D}\x{5E5E}\x{5E5F}\x{5E60}' + . '\x{5E61}\x{5E62}\x{5E63}\x{5E64}\x{5E65}\x{5E66}\x{5E67}\x{5E68}\x{5E69}' + . '\x{5E6A}\x{5E6B}\x{5E6C}\x{5E6D}\x{5E6E}\x{5E6F}\x{5E70}\x{5E71}\x{5E72}' + . '\x{5E73}\x{5E74}\x{5E75}\x{5E76}\x{5E77}\x{5E78}\x{5E79}\x{5E7A}\x{5E7B}' + . '\x{5E7C}\x{5E7D}\x{5E7E}\x{5E7F}\x{5E80}\x{5E81}\x{5E82}\x{5E83}\x{5E84}' + . '\x{5E85}\x{5E86}\x{5E87}\x{5E88}\x{5E89}\x{5E8A}\x{5E8B}\x{5E8C}\x{5E8D}' + . '\x{5E8E}\x{5E8F}\x{5E90}\x{5E91}\x{5E93}\x{5E94}\x{5E95}\x{5E96}\x{5E97}' + . '\x{5E98}\x{5E99}\x{5E9A}\x{5E9B}\x{5E9C}\x{5E9D}\x{5E9E}\x{5E9F}\x{5EA0}' + . '\x{5EA1}\x{5EA2}\x{5EA3}\x{5EA4}\x{5EA5}\x{5EA6}\x{5EA7}\x{5EA8}\x{5EA9}' + . '\x{5EAA}\x{5EAB}\x{5EAC}\x{5EAD}\x{5EAE}\x{5EAF}\x{5EB0}\x{5EB1}\x{5EB2}' + . '\x{5EB3}\x{5EB4}\x{5EB5}\x{5EB6}\x{5EB7}\x{5EB8}\x{5EB9}\x{5EBB}\x{5EBC}' + . '\x{5EBD}\x{5EBE}\x{5EBF}\x{5EC1}\x{5EC2}\x{5EC3}\x{5EC4}\x{5EC5}\x{5EC6}' + . '\x{5EC7}\x{5EC8}\x{5EC9}\x{5ECA}\x{5ECB}\x{5ECC}\x{5ECD}\x{5ECE}\x{5ECF}' + . '\x{5ED0}\x{5ED1}\x{5ED2}\x{5ED3}\x{5ED4}\x{5ED5}\x{5ED6}\x{5ED7}\x{5ED8}' + . '\x{5ED9}\x{5EDA}\x{5EDB}\x{5EDC}\x{5EDD}\x{5EDE}\x{5EDF}\x{5EE0}\x{5EE1}' + . '\x{5EE2}\x{5EE3}\x{5EE4}\x{5EE5}\x{5EE6}\x{5EE7}\x{5EE8}\x{5EE9}\x{5EEA}' + . '\x{5EEC}\x{5EED}\x{5EEE}\x{5EEF}\x{5EF0}\x{5EF1}\x{5EF2}\x{5EF3}\x{5EF4}' + . '\x{5EF5}\x{5EF6}\x{5EF7}\x{5EF8}\x{5EFA}\x{5EFB}\x{5EFC}\x{5EFD}\x{5EFE}' + . '\x{5EFF}\x{5F00}\x{5F01}\x{5F02}\x{5F03}\x{5F04}\x{5F05}\x{5F06}\x{5F07}' + . '\x{5F08}\x{5F0A}\x{5F0B}\x{5F0C}\x{5F0D}\x{5F0F}\x{5F11}\x{5F12}\x{5F13}' + . '\x{5F14}\x{5F15}\x{5F16}\x{5F17}\x{5F18}\x{5F19}\x{5F1A}\x{5F1B}\x{5F1C}' + . '\x{5F1D}\x{5F1E}\x{5F1F}\x{5F20}\x{5F21}\x{5F22}\x{5F23}\x{5F24}\x{5F25}' + . '\x{5F26}\x{5F27}\x{5F28}\x{5F29}\x{5F2A}\x{5F2B}\x{5F2C}\x{5F2D}\x{5F2E}' + . '\x{5F2F}\x{5F30}\x{5F31}\x{5F32}\x{5F33}\x{5F34}\x{5F35}\x{5F36}\x{5F37}' + . '\x{5F38}\x{5F39}\x{5F3A}\x{5F3C}\x{5F3E}\x{5F3F}\x{5F40}\x{5F41}\x{5F42}' + . '\x{5F43}\x{5F44}\x{5F45}\x{5F46}\x{5F47}\x{5F48}\x{5F49}\x{5F4A}\x{5F4B}' + . '\x{5F4C}\x{5F4D}\x{5F4E}\x{5F4F}\x{5F50}\x{5F51}\x{5F52}\x{5F53}\x{5F54}' + . '\x{5F55}\x{5F56}\x{5F57}\x{5F58}\x{5F59}\x{5F5A}\x{5F5B}\x{5F5C}\x{5F5D}' + . '\x{5F5E}\x{5F5F}\x{5F60}\x{5F61}\x{5F62}\x{5F63}\x{5F64}\x{5F65}\x{5F66}' + . '\x{5F67}\x{5F68}\x{5F69}\x{5F6A}\x{5F6B}\x{5F6C}\x{5F6D}\x{5F6E}\x{5F6F}' + . '\x{5F70}\x{5F71}\x{5F72}\x{5F73}\x{5F74}\x{5F75}\x{5F76}\x{5F77}\x{5F78}' + . '\x{5F79}\x{5F7A}\x{5F7B}\x{5F7C}\x{5F7D}\x{5F7E}\x{5F7F}\x{5F80}\x{5F81}' + . '\x{5F82}\x{5F83}\x{5F84}\x{5F85}\x{5F86}\x{5F87}\x{5F88}\x{5F89}\x{5F8A}' + . '\x{5F8B}\x{5F8C}\x{5F8D}\x{5F8E}\x{5F90}\x{5F91}\x{5F92}\x{5F93}\x{5F94}' + . '\x{5F95}\x{5F96}\x{5F97}\x{5F98}\x{5F99}\x{5F9B}\x{5F9C}\x{5F9D}\x{5F9E}' + . '\x{5F9F}\x{5FA0}\x{5FA1}\x{5FA2}\x{5FA5}\x{5FA6}\x{5FA7}\x{5FA8}\x{5FA9}' + . '\x{5FAA}\x{5FAB}\x{5FAC}\x{5FAD}\x{5FAE}\x{5FAF}\x{5FB1}\x{5FB2}\x{5FB3}' + . '\x{5FB4}\x{5FB5}\x{5FB6}\x{5FB7}\x{5FB8}\x{5FB9}\x{5FBA}\x{5FBB}\x{5FBC}' + . '\x{5FBD}\x{5FBE}\x{5FBF}\x{5FC0}\x{5FC1}\x{5FC3}\x{5FC4}\x{5FC5}\x{5FC6}' + . '\x{5FC7}\x{5FC8}\x{5FC9}\x{5FCA}\x{5FCB}\x{5FCC}\x{5FCD}\x{5FCF}\x{5FD0}' + . '\x{5FD1}\x{5FD2}\x{5FD3}\x{5FD4}\x{5FD5}\x{5FD6}\x{5FD7}\x{5FD8}\x{5FD9}' + . '\x{5FDA}\x{5FDC}\x{5FDD}\x{5FDE}\x{5FE0}\x{5FE1}\x{5FE3}\x{5FE4}\x{5FE5}' + . '\x{5FE6}\x{5FE7}\x{5FE8}\x{5FE9}\x{5FEA}\x{5FEB}\x{5FED}\x{5FEE}\x{5FEF}' + . '\x{5FF0}\x{5FF1}\x{5FF2}\x{5FF3}\x{5FF4}\x{5FF5}\x{5FF6}\x{5FF7}\x{5FF8}' + . '\x{5FF9}\x{5FFA}\x{5FFB}\x{5FFD}\x{5FFE}\x{5FFF}\x{6000}\x{6001}\x{6002}' + . '\x{6003}\x{6004}\x{6005}\x{6006}\x{6007}\x{6008}\x{6009}\x{600A}\x{600B}' + . '\x{600C}\x{600D}\x{600E}\x{600F}\x{6010}\x{6011}\x{6012}\x{6013}\x{6014}' + . '\x{6015}\x{6016}\x{6017}\x{6018}\x{6019}\x{601A}\x{601B}\x{601C}\x{601D}' + . '\x{601E}\x{601F}\x{6020}\x{6021}\x{6022}\x{6024}\x{6025}\x{6026}\x{6027}' + . '\x{6028}\x{6029}\x{602A}\x{602B}\x{602C}\x{602D}\x{602E}\x{602F}\x{6030}' + . '\x{6031}\x{6032}\x{6033}\x{6034}\x{6035}\x{6036}\x{6037}\x{6038}\x{6039}' + . '\x{603A}\x{603B}\x{603C}\x{603D}\x{603E}\x{603F}\x{6040}\x{6041}\x{6042}' + . '\x{6043}\x{6044}\x{6045}\x{6046}\x{6047}\x{6048}\x{6049}\x{604A}\x{604B}' + . '\x{604C}\x{604D}\x{604E}\x{604F}\x{6050}\x{6051}\x{6052}\x{6053}\x{6054}' + . '\x{6055}\x{6057}\x{6058}\x{6059}\x{605A}\x{605B}\x{605C}\x{605D}\x{605E}' + . '\x{605F}\x{6062}\x{6063}\x{6064}\x{6065}\x{6066}\x{6067}\x{6068}\x{6069}' + . '\x{606A}\x{606B}\x{606C}\x{606D}\x{606E}\x{606F}\x{6070}\x{6072}\x{6073}' + . '\x{6075}\x{6076}\x{6077}\x{6078}\x{6079}\x{607A}\x{607B}\x{607C}\x{607D}' + . '\x{607E}\x{607F}\x{6080}\x{6081}\x{6082}\x{6083}\x{6084}\x{6085}\x{6086}' + . '\x{6087}\x{6088}\x{6089}\x{608A}\x{608B}\x{608C}\x{608D}\x{608E}\x{608F}' + . '\x{6090}\x{6092}\x{6094}\x{6095}\x{6096}\x{6097}\x{6098}\x{6099}\x{609A}' + . '\x{609B}\x{609C}\x{609D}\x{609E}\x{609F}\x{60A0}\x{60A1}\x{60A2}\x{60A3}' + . '\x{60A4}\x{60A6}\x{60A7}\x{60A8}\x{60AA}\x{60AB}\x{60AC}\x{60AD}\x{60AE}' + . '\x{60AF}\x{60B0}\x{60B1}\x{60B2}\x{60B3}\x{60B4}\x{60B5}\x{60B6}\x{60B7}' + . '\x{60B8}\x{60B9}\x{60BA}\x{60BB}\x{60BC}\x{60BD}\x{60BE}\x{60BF}\x{60C0}' + . '\x{60C1}\x{60C2}\x{60C3}\x{60C4}\x{60C5}\x{60C6}\x{60C7}\x{60C8}\x{60C9}' + . '\x{60CA}\x{60CB}\x{60CC}\x{60CD}\x{60CE}\x{60CF}\x{60D0}\x{60D1}\x{60D3}' + . '\x{60D4}\x{60D5}\x{60D7}\x{60D8}\x{60D9}\x{60DA}\x{60DB}\x{60DC}\x{60DD}' + . '\x{60DF}\x{60E0}\x{60E1}\x{60E2}\x{60E4}\x{60E6}\x{60E7}\x{60E8}\x{60E9}' + . '\x{60EA}\x{60EB}\x{60EC}\x{60ED}\x{60EE}\x{60EF}\x{60F0}\x{60F1}\x{60F2}' + . '\x{60F3}\x{60F4}\x{60F5}\x{60F6}\x{60F7}\x{60F8}\x{60F9}\x{60FA}\x{60FB}' + . '\x{60FC}\x{60FE}\x{60FF}\x{6100}\x{6101}\x{6103}\x{6104}\x{6105}\x{6106}' + . '\x{6108}\x{6109}\x{610A}\x{610B}\x{610C}\x{610D}\x{610E}\x{610F}\x{6110}' + . '\x{6112}\x{6113}\x{6114}\x{6115}\x{6116}\x{6117}\x{6118}\x{6119}\x{611A}' + . '\x{611B}\x{611C}\x{611D}\x{611F}\x{6120}\x{6122}\x{6123}\x{6124}\x{6125}' + . '\x{6126}\x{6127}\x{6128}\x{6129}\x{612A}\x{612B}\x{612C}\x{612D}\x{612E}' + . '\x{612F}\x{6130}\x{6132}\x{6134}\x{6136}\x{6137}\x{613A}\x{613B}\x{613C}' + . '\x{613D}\x{613E}\x{613F}\x{6140}\x{6141}\x{6142}\x{6143}\x{6144}\x{6145}' + . '\x{6146}\x{6147}\x{6148}\x{6149}\x{614A}\x{614B}\x{614C}\x{614D}\x{614E}' + . '\x{614F}\x{6150}\x{6151}\x{6152}\x{6153}\x{6154}\x{6155}\x{6156}\x{6157}' + . '\x{6158}\x{6159}\x{615A}\x{615B}\x{615C}\x{615D}\x{615E}\x{615F}\x{6161}' + . '\x{6162}\x{6163}\x{6164}\x{6165}\x{6166}\x{6167}\x{6168}\x{6169}\x{616A}' + . '\x{616B}\x{616C}\x{616D}\x{616E}\x{6170}\x{6171}\x{6172}\x{6173}\x{6174}' + . '\x{6175}\x{6176}\x{6177}\x{6178}\x{6179}\x{617A}\x{617C}\x{617E}\x{6180}' + . '\x{6181}\x{6182}\x{6183}\x{6184}\x{6185}\x{6187}\x{6188}\x{6189}\x{618A}' + . '\x{618B}\x{618C}\x{618D}\x{618E}\x{618F}\x{6190}\x{6191}\x{6192}\x{6193}' + . '\x{6194}\x{6195}\x{6196}\x{6198}\x{6199}\x{619A}\x{619B}\x{619D}\x{619E}' + . '\x{619F}\x{61A0}\x{61A1}\x{61A2}\x{61A3}\x{61A4}\x{61A5}\x{61A6}\x{61A7}' + . '\x{61A8}\x{61A9}\x{61AA}\x{61AB}\x{61AC}\x{61AD}\x{61AE}\x{61AF}\x{61B0}' + . '\x{61B1}\x{61B2}\x{61B3}\x{61B4}\x{61B5}\x{61B6}\x{61B7}\x{61B8}\x{61BA}' + . '\x{61BC}\x{61BD}\x{61BE}\x{61BF}\x{61C0}\x{61C1}\x{61C2}\x{61C3}\x{61C4}' + . '\x{61C5}\x{61C6}\x{61C7}\x{61C8}\x{61C9}\x{61CA}\x{61CB}\x{61CC}\x{61CD}' + . '\x{61CE}\x{61CF}\x{61D0}\x{61D1}\x{61D2}\x{61D4}\x{61D6}\x{61D7}\x{61D8}' + . '\x{61D9}\x{61DA}\x{61DB}\x{61DC}\x{61DD}\x{61DE}\x{61DF}\x{61E0}\x{61E1}' + . '\x{61E2}\x{61E3}\x{61E4}\x{61E5}\x{61E6}\x{61E7}\x{61E8}\x{61E9}\x{61EA}' + . '\x{61EB}\x{61ED}\x{61EE}\x{61F0}\x{61F1}\x{61F2}\x{61F3}\x{61F5}\x{61F6}' + . '\x{61F7}\x{61F8}\x{61F9}\x{61FA}\x{61FB}\x{61FC}\x{61FD}\x{61FE}\x{61FF}' + . '\x{6200}\x{6201}\x{6202}\x{6203}\x{6204}\x{6206}\x{6207}\x{6208}\x{6209}' + . '\x{620A}\x{620B}\x{620C}\x{620D}\x{620E}\x{620F}\x{6210}\x{6211}\x{6212}' + . '\x{6213}\x{6214}\x{6215}\x{6216}\x{6217}\x{6218}\x{6219}\x{621A}\x{621B}' + . '\x{621C}\x{621D}\x{621E}\x{621F}\x{6220}\x{6221}\x{6222}\x{6223}\x{6224}' + . '\x{6225}\x{6226}\x{6227}\x{6228}\x{6229}\x{622A}\x{622B}\x{622C}\x{622D}' + . '\x{622E}\x{622F}\x{6230}\x{6231}\x{6232}\x{6233}\x{6234}\x{6236}\x{6237}' + . '\x{6238}\x{623A}\x{623B}\x{623C}\x{623D}\x{623E}\x{623F}\x{6240}\x{6241}' + . '\x{6242}\x{6243}\x{6244}\x{6245}\x{6246}\x{6247}\x{6248}\x{6249}\x{624A}' + . '\x{624B}\x{624C}\x{624D}\x{624E}\x{624F}\x{6250}\x{6251}\x{6252}\x{6253}' + . '\x{6254}\x{6255}\x{6256}\x{6258}\x{6259}\x{625A}\x{625B}\x{625C}\x{625D}' + . '\x{625E}\x{625F}\x{6260}\x{6261}\x{6262}\x{6263}\x{6264}\x{6265}\x{6266}' + . '\x{6267}\x{6268}\x{6269}\x{626A}\x{626B}\x{626C}\x{626D}\x{626E}\x{626F}' + . '\x{6270}\x{6271}\x{6272}\x{6273}\x{6274}\x{6275}\x{6276}\x{6277}\x{6278}' + . '\x{6279}\x{627A}\x{627B}\x{627C}\x{627D}\x{627E}\x{627F}\x{6280}\x{6281}' + . '\x{6283}\x{6284}\x{6285}\x{6286}\x{6287}\x{6288}\x{6289}\x{628A}\x{628B}' + . '\x{628C}\x{628E}\x{628F}\x{6290}\x{6291}\x{6292}\x{6293}\x{6294}\x{6295}' + . '\x{6296}\x{6297}\x{6298}\x{6299}\x{629A}\x{629B}\x{629C}\x{629E}\x{629F}' + . '\x{62A0}\x{62A1}\x{62A2}\x{62A3}\x{62A4}\x{62A5}\x{62A7}\x{62A8}\x{62A9}' + . '\x{62AA}\x{62AB}\x{62AC}\x{62AD}\x{62AE}\x{62AF}\x{62B0}\x{62B1}\x{62B2}' + . '\x{62B3}\x{62B4}\x{62B5}\x{62B6}\x{62B7}\x{62B8}\x{62B9}\x{62BA}\x{62BB}' + . '\x{62BC}\x{62BD}\x{62BE}\x{62BF}\x{62C0}\x{62C1}\x{62C2}\x{62C3}\x{62C4}' + . '\x{62C5}\x{62C6}\x{62C7}\x{62C8}\x{62C9}\x{62CA}\x{62CB}\x{62CC}\x{62CD}' + . '\x{62CE}\x{62CF}\x{62D0}\x{62D1}\x{62D2}\x{62D3}\x{62D4}\x{62D5}\x{62D6}' + . '\x{62D7}\x{62D8}\x{62D9}\x{62DA}\x{62DB}\x{62DC}\x{62DD}\x{62DF}\x{62E0}' + . '\x{62E1}\x{62E2}\x{62E3}\x{62E4}\x{62E5}\x{62E6}\x{62E7}\x{62E8}\x{62E9}' + . '\x{62EB}\x{62EC}\x{62ED}\x{62EE}\x{62EF}\x{62F0}\x{62F1}\x{62F2}\x{62F3}' + . '\x{62F4}\x{62F5}\x{62F6}\x{62F7}\x{62F8}\x{62F9}\x{62FA}\x{62FB}\x{62FC}' + . '\x{62FD}\x{62FE}\x{62FF}\x{6300}\x{6301}\x{6302}\x{6303}\x{6304}\x{6305}' + . '\x{6306}\x{6307}\x{6308}\x{6309}\x{630B}\x{630C}\x{630D}\x{630E}\x{630F}' + . '\x{6310}\x{6311}\x{6312}\x{6313}\x{6314}\x{6315}\x{6316}\x{6318}\x{6319}' + . '\x{631A}\x{631B}\x{631C}\x{631D}\x{631E}\x{631F}\x{6320}\x{6321}\x{6322}' + . '\x{6323}\x{6324}\x{6325}\x{6326}\x{6327}\x{6328}\x{6329}\x{632A}\x{632B}' + . '\x{632C}\x{632D}\x{632E}\x{632F}\x{6330}\x{6332}\x{6333}\x{6334}\x{6336}' + . '\x{6338}\x{6339}\x{633A}\x{633B}\x{633C}\x{633D}\x{633E}\x{6340}\x{6341}' + . '\x{6342}\x{6343}\x{6344}\x{6345}\x{6346}\x{6347}\x{6348}\x{6349}\x{634A}' + . '\x{634B}\x{634C}\x{634D}\x{634E}\x{634F}\x{6350}\x{6351}\x{6352}\x{6353}' + . '\x{6354}\x{6355}\x{6356}\x{6357}\x{6358}\x{6359}\x{635A}\x{635C}\x{635D}' + . '\x{635E}\x{635F}\x{6360}\x{6361}\x{6362}\x{6363}\x{6364}\x{6365}\x{6366}' + . '\x{6367}\x{6368}\x{6369}\x{636A}\x{636B}\x{636C}\x{636D}\x{636E}\x{636F}' + . '\x{6370}\x{6371}\x{6372}\x{6373}\x{6374}\x{6375}\x{6376}\x{6377}\x{6378}' + . '\x{6379}\x{637A}\x{637B}\x{637C}\x{637D}\x{637E}\x{6380}\x{6381}\x{6382}' + . '\x{6383}\x{6384}\x{6385}\x{6386}\x{6387}\x{6388}\x{6389}\x{638A}\x{638C}' + . '\x{638D}\x{638E}\x{638F}\x{6390}\x{6391}\x{6392}\x{6394}\x{6395}\x{6396}' + . '\x{6397}\x{6398}\x{6399}\x{639A}\x{639B}\x{639C}\x{639D}\x{639E}\x{639F}' + . '\x{63A0}\x{63A1}\x{63A2}\x{63A3}\x{63A4}\x{63A5}\x{63A6}\x{63A7}\x{63A8}' + . '\x{63A9}\x{63AA}\x{63AB}\x{63AC}\x{63AD}\x{63AE}\x{63AF}\x{63B0}\x{63B1}' + . '\x{63B2}\x{63B3}\x{63B4}\x{63B5}\x{63B6}\x{63B7}\x{63B8}\x{63B9}\x{63BA}' + . '\x{63BC}\x{63BD}\x{63BE}\x{63BF}\x{63C0}\x{63C1}\x{63C2}\x{63C3}\x{63C4}' + . '\x{63C5}\x{63C6}\x{63C7}\x{63C8}\x{63C9}\x{63CA}\x{63CB}\x{63CC}\x{63CD}' + . '\x{63CE}\x{63CF}\x{63D0}\x{63D2}\x{63D3}\x{63D4}\x{63D5}\x{63D6}\x{63D7}' + . '\x{63D8}\x{63D9}\x{63DA}\x{63DB}\x{63DC}\x{63DD}\x{63DE}\x{63DF}\x{63E0}' + . '\x{63E1}\x{63E2}\x{63E3}\x{63E4}\x{63E5}\x{63E6}\x{63E7}\x{63E8}\x{63E9}' + . '\x{63EA}\x{63EB}\x{63EC}\x{63ED}\x{63EE}\x{63EF}\x{63F0}\x{63F1}\x{63F2}' + . '\x{63F3}\x{63F4}\x{63F5}\x{63F6}\x{63F7}\x{63F8}\x{63F9}\x{63FA}\x{63FB}' + . '\x{63FC}\x{63FD}\x{63FE}\x{63FF}\x{6400}\x{6401}\x{6402}\x{6403}\x{6404}' + . '\x{6405}\x{6406}\x{6408}\x{6409}\x{640A}\x{640B}\x{640C}\x{640D}\x{640E}' + . '\x{640F}\x{6410}\x{6411}\x{6412}\x{6413}\x{6414}\x{6415}\x{6416}\x{6417}' + . '\x{6418}\x{6419}\x{641A}\x{641B}\x{641C}\x{641D}\x{641E}\x{641F}\x{6420}' + . '\x{6421}\x{6422}\x{6423}\x{6424}\x{6425}\x{6426}\x{6427}\x{6428}\x{6429}' + . '\x{642A}\x{642B}\x{642C}\x{642D}\x{642E}\x{642F}\x{6430}\x{6431}\x{6432}' + . '\x{6433}\x{6434}\x{6435}\x{6436}\x{6437}\x{6438}\x{6439}\x{643A}\x{643D}' + . '\x{643E}\x{643F}\x{6440}\x{6441}\x{6443}\x{6444}\x{6445}\x{6446}\x{6447}' + . '\x{6448}\x{644A}\x{644B}\x{644C}\x{644D}\x{644E}\x{644F}\x{6450}\x{6451}' + . '\x{6452}\x{6453}\x{6454}\x{6455}\x{6456}\x{6457}\x{6458}\x{6459}\x{645B}' + . '\x{645C}\x{645D}\x{645E}\x{645F}\x{6460}\x{6461}\x{6462}\x{6463}\x{6464}' + . '\x{6465}\x{6466}\x{6467}\x{6468}\x{6469}\x{646A}\x{646B}\x{646C}\x{646D}' + . '\x{646E}\x{646F}\x{6470}\x{6471}\x{6472}\x{6473}\x{6474}\x{6475}\x{6476}' + . '\x{6477}\x{6478}\x{6479}\x{647A}\x{647B}\x{647C}\x{647D}\x{647F}\x{6480}' + . '\x{6481}\x{6482}\x{6483}\x{6484}\x{6485}\x{6487}\x{6488}\x{6489}\x{648A}' + . '\x{648B}\x{648C}\x{648D}\x{648E}\x{648F}\x{6490}\x{6491}\x{6492}\x{6493}' + . '\x{6494}\x{6495}\x{6496}\x{6497}\x{6498}\x{6499}\x{649A}\x{649B}\x{649C}' + . '\x{649D}\x{649E}\x{649F}\x{64A0}\x{64A2}\x{64A3}\x{64A4}\x{64A5}\x{64A6}' + . '\x{64A7}\x{64A8}\x{64A9}\x{64AA}\x{64AB}\x{64AC}\x{64AD}\x{64AE}\x{64B0}' + . '\x{64B1}\x{64B2}\x{64B3}\x{64B4}\x{64B5}\x{64B7}\x{64B8}\x{64B9}\x{64BA}' + . '\x{64BB}\x{64BC}\x{64BD}\x{64BE}\x{64BF}\x{64C0}\x{64C1}\x{64C2}\x{64C3}' + . '\x{64C4}\x{64C5}\x{64C6}\x{64C7}\x{64C9}\x{64CA}\x{64CB}\x{64CC}\x{64CD}' + . '\x{64CE}\x{64CF}\x{64D0}\x{64D1}\x{64D2}\x{64D3}\x{64D4}\x{64D6}\x{64D7}' + . '\x{64D8}\x{64D9}\x{64DA}\x{64DB}\x{64DC}\x{64DD}\x{64DE}\x{64DF}\x{64E0}' + . '\x{64E2}\x{64E3}\x{64E4}\x{64E6}\x{64E7}\x{64E8}\x{64E9}\x{64EA}\x{64EB}' + . '\x{64EC}\x{64ED}\x{64EF}\x{64F0}\x{64F1}\x{64F2}\x{64F3}\x{64F4}\x{64F6}' + . '\x{64F7}\x{64F8}\x{64FA}\x{64FB}\x{64FC}\x{64FD}\x{64FE}\x{64FF}\x{6500}' + . '\x{6501}\x{6503}\x{6504}\x{6505}\x{6506}\x{6507}\x{6508}\x{6509}\x{650B}' + . '\x{650C}\x{650D}\x{650E}\x{650F}\x{6510}\x{6511}\x{6512}\x{6513}\x{6514}' + . '\x{6515}\x{6516}\x{6517}\x{6518}\x{6519}\x{651A}\x{651B}\x{651C}\x{651D}' + . '\x{651E}\x{6520}\x{6521}\x{6522}\x{6523}\x{6524}\x{6525}\x{6526}\x{6527}' + . '\x{6529}\x{652A}\x{652B}\x{652C}\x{652D}\x{652E}\x{652F}\x{6530}\x{6531}' + . '\x{6532}\x{6533}\x{6534}\x{6535}\x{6536}\x{6537}\x{6538}\x{6539}\x{653A}' + . '\x{653B}\x{653C}\x{653D}\x{653E}\x{653F}\x{6541}\x{6543}\x{6544}\x{6545}' + . '\x{6546}\x{6547}\x{6548}\x{6549}\x{654A}\x{654B}\x{654C}\x{654D}\x{654E}' + . '\x{654F}\x{6550}\x{6551}\x{6552}\x{6553}\x{6554}\x{6555}\x{6556}\x{6557}' + . '\x{6558}\x{6559}\x{655B}\x{655C}\x{655D}\x{655E}\x{6560}\x{6561}\x{6562}' + . '\x{6563}\x{6564}\x{6565}\x{6566}\x{6567}\x{6568}\x{6569}\x{656A}\x{656B}' + . '\x{656C}\x{656E}\x{656F}\x{6570}\x{6571}\x{6572}\x{6573}\x{6574}\x{6575}' + . '\x{6576}\x{6577}\x{6578}\x{6579}\x{657A}\x{657B}\x{657C}\x{657E}\x{657F}' + . '\x{6580}\x{6581}\x{6582}\x{6583}\x{6584}\x{6585}\x{6586}\x{6587}\x{6588}' + . '\x{6589}\x{658B}\x{658C}\x{658D}\x{658E}\x{658F}\x{6590}\x{6591}\x{6592}' + . '\x{6593}\x{6594}\x{6595}\x{6596}\x{6597}\x{6598}\x{6599}\x{659B}\x{659C}' + . '\x{659D}\x{659E}\x{659F}\x{65A0}\x{65A1}\x{65A2}\x{65A3}\x{65A4}\x{65A5}' + . '\x{65A6}\x{65A7}\x{65A8}\x{65A9}\x{65AA}\x{65AB}\x{65AC}\x{65AD}\x{65AE}' + . '\x{65AF}\x{65B0}\x{65B1}\x{65B2}\x{65B3}\x{65B4}\x{65B6}\x{65B7}\x{65B8}' + . '\x{65B9}\x{65BA}\x{65BB}\x{65BC}\x{65BD}\x{65BF}\x{65C0}\x{65C1}\x{65C2}' + . '\x{65C3}\x{65C4}\x{65C5}\x{65C6}\x{65C7}\x{65CA}\x{65CB}\x{65CC}\x{65CD}' + . '\x{65CE}\x{65CF}\x{65D0}\x{65D2}\x{65D3}\x{65D4}\x{65D5}\x{65D6}\x{65D7}' + . '\x{65DA}\x{65DB}\x{65DD}\x{65DE}\x{65DF}\x{65E0}\x{65E1}\x{65E2}\x{65E3}' + . '\x{65E5}\x{65E6}\x{65E7}\x{65E8}\x{65E9}\x{65EB}\x{65EC}\x{65ED}\x{65EE}' + . '\x{65EF}\x{65F0}\x{65F1}\x{65F2}\x{65F3}\x{65F4}\x{65F5}\x{65F6}\x{65F7}' + . '\x{65F8}\x{65FA}\x{65FB}\x{65FC}\x{65FD}\x{6600}\x{6601}\x{6602}\x{6603}' + . '\x{6604}\x{6605}\x{6606}\x{6607}\x{6608}\x{6609}\x{660A}\x{660B}\x{660C}' + . '\x{660D}\x{660E}\x{660F}\x{6610}\x{6611}\x{6612}\x{6613}\x{6614}\x{6615}' + . '\x{6616}\x{6618}\x{6619}\x{661A}\x{661B}\x{661C}\x{661D}\x{661F}\x{6620}' + . '\x{6621}\x{6622}\x{6623}\x{6624}\x{6625}\x{6626}\x{6627}\x{6628}\x{6629}' + . '\x{662A}\x{662B}\x{662D}\x{662E}\x{662F}\x{6630}\x{6631}\x{6632}\x{6633}' + . '\x{6634}\x{6635}\x{6636}\x{6639}\x{663A}\x{663C}\x{663D}\x{663E}\x{6640}' + . '\x{6641}\x{6642}\x{6643}\x{6644}\x{6645}\x{6646}\x{6647}\x{6649}\x{664A}' + . '\x{664B}\x{664C}\x{664E}\x{664F}\x{6650}\x{6651}\x{6652}\x{6653}\x{6654}' + . '\x{6655}\x{6656}\x{6657}\x{6658}\x{6659}\x{665A}\x{665B}\x{665C}\x{665D}' + . '\x{665E}\x{665F}\x{6661}\x{6662}\x{6664}\x{6665}\x{6666}\x{6668}\x{6669}' + . '\x{666A}\x{666B}\x{666C}\x{666D}\x{666E}\x{666F}\x{6670}\x{6671}\x{6672}' + . '\x{6673}\x{6674}\x{6675}\x{6676}\x{6677}\x{6678}\x{6679}\x{667A}\x{667B}' + . '\x{667C}\x{667D}\x{667E}\x{667F}\x{6680}\x{6681}\x{6682}\x{6683}\x{6684}' + . '\x{6685}\x{6686}\x{6687}\x{6688}\x{6689}\x{668A}\x{668B}\x{668C}\x{668D}' + . '\x{668E}\x{668F}\x{6690}\x{6691}\x{6693}\x{6694}\x{6695}\x{6696}\x{6697}' + . '\x{6698}\x{6699}\x{669A}\x{669B}\x{669D}\x{669F}\x{66A0}\x{66A1}\x{66A2}' + . '\x{66A3}\x{66A4}\x{66A5}\x{66A6}\x{66A7}\x{66A8}\x{66A9}\x{66AA}\x{66AB}' + . '\x{66AE}\x{66AF}\x{66B0}\x{66B1}\x{66B2}\x{66B3}\x{66B4}\x{66B5}\x{66B6}' + . '\x{66B7}\x{66B8}\x{66B9}\x{66BA}\x{66BB}\x{66BC}\x{66BD}\x{66BE}\x{66BF}' + . '\x{66C0}\x{66C1}\x{66C2}\x{66C3}\x{66C4}\x{66C5}\x{66C6}\x{66C7}\x{66C8}' + . '\x{66C9}\x{66CA}\x{66CB}\x{66CC}\x{66CD}\x{66CE}\x{66CF}\x{66D1}\x{66D2}' + . '\x{66D4}\x{66D5}\x{66D6}\x{66D8}\x{66D9}\x{66DA}\x{66DB}\x{66DC}\x{66DD}' + . '\x{66DE}\x{66E0}\x{66E1}\x{66E2}\x{66E3}\x{66E4}\x{66E5}\x{66E6}\x{66E7}' + . '\x{66E8}\x{66E9}\x{66EA}\x{66EB}\x{66EC}\x{66ED}\x{66EE}\x{66F0}\x{66F1}' + . '\x{66F2}\x{66F3}\x{66F4}\x{66F5}\x{66F6}\x{66F7}\x{66F8}\x{66F9}\x{66FA}' + . '\x{66FB}\x{66FC}\x{66FE}\x{66FF}\x{6700}\x{6701}\x{6703}\x{6704}\x{6705}' + . '\x{6706}\x{6708}\x{6709}\x{670A}\x{670B}\x{670C}\x{670D}\x{670E}\x{670F}' + . '\x{6710}\x{6711}\x{6712}\x{6713}\x{6714}\x{6715}\x{6716}\x{6717}\x{6718}' + . '\x{671A}\x{671B}\x{671C}\x{671D}\x{671E}\x{671F}\x{6720}\x{6721}\x{6722}' + . '\x{6723}\x{6725}\x{6726}\x{6727}\x{6728}\x{672A}\x{672B}\x{672C}\x{672D}' + . '\x{672E}\x{672F}\x{6730}\x{6731}\x{6732}\x{6733}\x{6734}\x{6735}\x{6736}' + . '\x{6737}\x{6738}\x{6739}\x{673A}\x{673B}\x{673C}\x{673D}\x{673E}\x{673F}' + . '\x{6740}\x{6741}\x{6742}\x{6743}\x{6744}\x{6745}\x{6746}\x{6747}\x{6748}' + . '\x{6749}\x{674A}\x{674B}\x{674C}\x{674D}\x{674E}\x{674F}\x{6750}\x{6751}' + . '\x{6752}\x{6753}\x{6754}\x{6755}\x{6756}\x{6757}\x{6758}\x{6759}\x{675A}' + . '\x{675B}\x{675C}\x{675D}\x{675E}\x{675F}\x{6760}\x{6761}\x{6762}\x{6763}' + . '\x{6764}\x{6765}\x{6766}\x{6768}\x{6769}\x{676A}\x{676B}\x{676C}\x{676D}' + . '\x{676E}\x{676F}\x{6770}\x{6771}\x{6772}\x{6773}\x{6774}\x{6775}\x{6776}' + . '\x{6777}\x{6778}\x{6779}\x{677A}\x{677B}\x{677C}\x{677D}\x{677E}\x{677F}' + . '\x{6780}\x{6781}\x{6782}\x{6783}\x{6784}\x{6785}\x{6786}\x{6787}\x{6789}' + . '\x{678A}\x{678B}\x{678C}\x{678D}\x{678E}\x{678F}\x{6790}\x{6791}\x{6792}' + . '\x{6793}\x{6794}\x{6795}\x{6797}\x{6798}\x{6799}\x{679A}\x{679B}\x{679C}' + . '\x{679D}\x{679E}\x{679F}\x{67A0}\x{67A1}\x{67A2}\x{67A3}\x{67A4}\x{67A5}' + . '\x{67A6}\x{67A7}\x{67A8}\x{67AA}\x{67AB}\x{67AC}\x{67AD}\x{67AE}\x{67AF}' + . '\x{67B0}\x{67B1}\x{67B2}\x{67B3}\x{67B4}\x{67B5}\x{67B6}\x{67B7}\x{67B8}' + . '\x{67B9}\x{67BA}\x{67BB}\x{67BC}\x{67BE}\x{67C0}\x{67C1}\x{67C2}\x{67C3}' + . '\x{67C4}\x{67C5}\x{67C6}\x{67C7}\x{67C8}\x{67C9}\x{67CA}\x{67CB}\x{67CC}' + . '\x{67CD}\x{67CE}\x{67CF}\x{67D0}\x{67D1}\x{67D2}\x{67D3}\x{67D4}\x{67D6}' + . '\x{67D8}\x{67D9}\x{67DA}\x{67DB}\x{67DC}\x{67DD}\x{67DE}\x{67DF}\x{67E0}' + . '\x{67E1}\x{67E2}\x{67E3}\x{67E4}\x{67E5}\x{67E6}\x{67E7}\x{67E8}\x{67E9}' + . '\x{67EA}\x{67EB}\x{67EC}\x{67ED}\x{67EE}\x{67EF}\x{67F0}\x{67F1}\x{67F2}' + . '\x{67F3}\x{67F4}\x{67F5}\x{67F6}\x{67F7}\x{67F8}\x{67FA}\x{67FB}\x{67FC}' + . '\x{67FD}\x{67FE}\x{67FF}\x{6800}\x{6802}\x{6803}\x{6804}\x{6805}\x{6806}' + . '\x{6807}\x{6808}\x{6809}\x{680A}\x{680B}\x{680C}\x{680D}\x{680E}\x{680F}' + . '\x{6810}\x{6811}\x{6812}\x{6813}\x{6814}\x{6816}\x{6817}\x{6818}\x{6819}' + . '\x{681A}\x{681B}\x{681C}\x{681D}\x{681F}\x{6820}\x{6821}\x{6822}\x{6823}' + . '\x{6824}\x{6825}\x{6826}\x{6828}\x{6829}\x{682A}\x{682B}\x{682C}\x{682D}' + . '\x{682E}\x{682F}\x{6831}\x{6832}\x{6833}\x{6834}\x{6835}\x{6836}\x{6837}' + . '\x{6838}\x{6839}\x{683A}\x{683B}\x{683C}\x{683D}\x{683E}\x{683F}\x{6840}' + . '\x{6841}\x{6842}\x{6843}\x{6844}\x{6845}\x{6846}\x{6847}\x{6848}\x{6849}' + . '\x{684A}\x{684B}\x{684C}\x{684D}\x{684E}\x{684F}\x{6850}\x{6851}\x{6852}' + . '\x{6853}\x{6854}\x{6855}\x{6856}\x{6857}\x{685B}\x{685D}\x{6860}\x{6861}' + . '\x{6862}\x{6863}\x{6864}\x{6865}\x{6866}\x{6867}\x{6868}\x{6869}\x{686A}' + . '\x{686B}\x{686C}\x{686D}\x{686E}\x{686F}\x{6870}\x{6871}\x{6872}\x{6873}' + . '\x{6874}\x{6875}\x{6876}\x{6877}\x{6878}\x{6879}\x{687B}\x{687C}\x{687D}' + . '\x{687E}\x{687F}\x{6880}\x{6881}\x{6882}\x{6883}\x{6884}\x{6885}\x{6886}' + . '\x{6887}\x{6888}\x{6889}\x{688A}\x{688B}\x{688C}\x{688D}\x{688E}\x{688F}' + . '\x{6890}\x{6891}\x{6892}\x{6893}\x{6894}\x{6896}\x{6897}\x{6898}\x{689A}' + . '\x{689B}\x{689C}\x{689D}\x{689E}\x{689F}\x{68A0}\x{68A1}\x{68A2}\x{68A3}' + . '\x{68A4}\x{68A6}\x{68A7}\x{68A8}\x{68A9}\x{68AA}\x{68AB}\x{68AC}\x{68AD}' + . '\x{68AE}\x{68AF}\x{68B0}\x{68B1}\x{68B2}\x{68B3}\x{68B4}\x{68B5}\x{68B6}' + . '\x{68B7}\x{68B9}\x{68BB}\x{68BC}\x{68BD}\x{68BE}\x{68BF}\x{68C0}\x{68C1}' + . '\x{68C2}\x{68C4}\x{68C6}\x{68C7}\x{68C8}\x{68C9}\x{68CA}\x{68CB}\x{68CC}' + . '\x{68CD}\x{68CE}\x{68CF}\x{68D0}\x{68D1}\x{68D2}\x{68D3}\x{68D4}\x{68D5}' + . '\x{68D6}\x{68D7}\x{68D8}\x{68DA}\x{68DB}\x{68DC}\x{68DD}\x{68DE}\x{68DF}' + . '\x{68E0}\x{68E1}\x{68E3}\x{68E4}\x{68E6}\x{68E7}\x{68E8}\x{68E9}\x{68EA}' + . '\x{68EB}\x{68EC}\x{68ED}\x{68EE}\x{68EF}\x{68F0}\x{68F1}\x{68F2}\x{68F3}' + . '\x{68F4}\x{68F5}\x{68F6}\x{68F7}\x{68F8}\x{68F9}\x{68FA}\x{68FB}\x{68FC}' + . '\x{68FD}\x{68FE}\x{68FF}\x{6901}\x{6902}\x{6903}\x{6904}\x{6905}\x{6906}' + . '\x{6907}\x{6908}\x{690A}\x{690B}\x{690C}\x{690D}\x{690E}\x{690F}\x{6910}' + . '\x{6911}\x{6912}\x{6913}\x{6914}\x{6915}\x{6916}\x{6917}\x{6918}\x{6919}' + . '\x{691A}\x{691B}\x{691C}\x{691D}\x{691E}\x{691F}\x{6920}\x{6921}\x{6922}' + . '\x{6923}\x{6924}\x{6925}\x{6926}\x{6927}\x{6928}\x{6929}\x{692A}\x{692B}' + . '\x{692C}\x{692D}\x{692E}\x{692F}\x{6930}\x{6931}\x{6932}\x{6933}\x{6934}' + . '\x{6935}\x{6936}\x{6937}\x{6938}\x{6939}\x{693A}\x{693B}\x{693C}\x{693D}' + . '\x{693F}\x{6940}\x{6941}\x{6942}\x{6943}\x{6944}\x{6945}\x{6946}\x{6947}' + . '\x{6948}\x{6949}\x{694A}\x{694B}\x{694C}\x{694E}\x{694F}\x{6950}\x{6951}' + . '\x{6952}\x{6953}\x{6954}\x{6955}\x{6956}\x{6957}\x{6958}\x{6959}\x{695A}' + . '\x{695B}\x{695C}\x{695D}\x{695E}\x{695F}\x{6960}\x{6961}\x{6962}\x{6963}' + . '\x{6964}\x{6965}\x{6966}\x{6967}\x{6968}\x{6969}\x{696A}\x{696B}\x{696C}' + . '\x{696D}\x{696E}\x{696F}\x{6970}\x{6971}\x{6972}\x{6973}\x{6974}\x{6975}' + . '\x{6976}\x{6977}\x{6978}\x{6979}\x{697A}\x{697B}\x{697C}\x{697D}\x{697E}' + . '\x{697F}\x{6980}\x{6981}\x{6982}\x{6983}\x{6984}\x{6985}\x{6986}\x{6987}' + . '\x{6988}\x{6989}\x{698A}\x{698B}\x{698C}\x{698D}\x{698E}\x{698F}\x{6990}' + . '\x{6991}\x{6992}\x{6993}\x{6994}\x{6995}\x{6996}\x{6997}\x{6998}\x{6999}' + . '\x{699A}\x{699B}\x{699C}\x{699D}\x{699E}\x{69A0}\x{69A1}\x{69A3}\x{69A4}' + . '\x{69A5}\x{69A6}\x{69A7}\x{69A8}\x{69A9}\x{69AA}\x{69AB}\x{69AC}\x{69AD}' + . '\x{69AE}\x{69AF}\x{69B0}\x{69B1}\x{69B2}\x{69B3}\x{69B4}\x{69B5}\x{69B6}' + . '\x{69B7}\x{69B8}\x{69B9}\x{69BA}\x{69BB}\x{69BC}\x{69BD}\x{69BE}\x{69BF}' + . '\x{69C1}\x{69C2}\x{69C3}\x{69C4}\x{69C5}\x{69C6}\x{69C7}\x{69C8}\x{69C9}' + . '\x{69CA}\x{69CB}\x{69CC}\x{69CD}\x{69CE}\x{69CF}\x{69D0}\x{69D3}\x{69D4}' + . '\x{69D8}\x{69D9}\x{69DA}\x{69DB}\x{69DC}\x{69DD}\x{69DE}\x{69DF}\x{69E0}' + . '\x{69E1}\x{69E2}\x{69E3}\x{69E4}\x{69E5}\x{69E6}\x{69E7}\x{69E8}\x{69E9}' + . '\x{69EA}\x{69EB}\x{69EC}\x{69ED}\x{69EE}\x{69EF}\x{69F0}\x{69F1}\x{69F2}' + . '\x{69F3}\x{69F4}\x{69F5}\x{69F6}\x{69F7}\x{69F8}\x{69FA}\x{69FB}\x{69FC}' + . '\x{69FD}\x{69FE}\x{69FF}\x{6A00}\x{6A01}\x{6A02}\x{6A04}\x{6A05}\x{6A06}' + . '\x{6A07}\x{6A08}\x{6A09}\x{6A0A}\x{6A0B}\x{6A0D}\x{6A0E}\x{6A0F}\x{6A10}' + . '\x{6A11}\x{6A12}\x{6A13}\x{6A14}\x{6A15}\x{6A16}\x{6A17}\x{6A18}\x{6A19}' + . '\x{6A1A}\x{6A1B}\x{6A1D}\x{6A1E}\x{6A1F}\x{6A20}\x{6A21}\x{6A22}\x{6A23}' + . '\x{6A25}\x{6A26}\x{6A27}\x{6A28}\x{6A29}\x{6A2A}\x{6A2B}\x{6A2C}\x{6A2D}' + . '\x{6A2E}\x{6A2F}\x{6A30}\x{6A31}\x{6A32}\x{6A33}\x{6A34}\x{6A35}\x{6A36}' + . '\x{6A38}\x{6A39}\x{6A3A}\x{6A3B}\x{6A3C}\x{6A3D}\x{6A3E}\x{6A3F}\x{6A40}' + . '\x{6A41}\x{6A42}\x{6A43}\x{6A44}\x{6A45}\x{6A46}\x{6A47}\x{6A48}\x{6A49}' + . '\x{6A4B}\x{6A4C}\x{6A4D}\x{6A4E}\x{6A4F}\x{6A50}\x{6A51}\x{6A52}\x{6A54}' + . '\x{6A55}\x{6A56}\x{6A57}\x{6A58}\x{6A59}\x{6A5A}\x{6A5B}\x{6A5D}\x{6A5E}' + . '\x{6A5F}\x{6A60}\x{6A61}\x{6A62}\x{6A63}\x{6A64}\x{6A65}\x{6A66}\x{6A67}' + . '\x{6A68}\x{6A69}\x{6A6A}\x{6A6B}\x{6A6C}\x{6A6D}\x{6A6F}\x{6A71}\x{6A72}' + . '\x{6A73}\x{6A74}\x{6A75}\x{6A76}\x{6A77}\x{6A78}\x{6A79}\x{6A7A}\x{6A7B}' + . '\x{6A7C}\x{6A7D}\x{6A7E}\x{6A7F}\x{6A80}\x{6A81}\x{6A82}\x{6A83}\x{6A84}' + . '\x{6A85}\x{6A87}\x{6A88}\x{6A89}\x{6A8B}\x{6A8C}\x{6A8D}\x{6A8E}\x{6A90}' + . '\x{6A91}\x{6A92}\x{6A93}\x{6A94}\x{6A95}\x{6A96}\x{6A97}\x{6A98}\x{6A9A}' + . '\x{6A9B}\x{6A9C}\x{6A9E}\x{6A9F}\x{6AA0}\x{6AA1}\x{6AA2}\x{6AA3}\x{6AA4}' + . '\x{6AA5}\x{6AA6}\x{6AA7}\x{6AA8}\x{6AA9}\x{6AAB}\x{6AAC}\x{6AAD}\x{6AAE}' + . '\x{6AAF}\x{6AB0}\x{6AB2}\x{6AB3}\x{6AB4}\x{6AB5}\x{6AB6}\x{6AB7}\x{6AB8}' + . '\x{6AB9}\x{6ABA}\x{6ABB}\x{6ABC}\x{6ABD}\x{6ABF}\x{6AC1}\x{6AC2}\x{6AC3}' + . '\x{6AC5}\x{6AC6}\x{6AC7}\x{6ACA}\x{6ACB}\x{6ACC}\x{6ACD}\x{6ACE}\x{6ACF}' + . '\x{6AD0}\x{6AD1}\x{6AD2}\x{6AD3}\x{6AD4}\x{6AD5}\x{6AD6}\x{6AD7}\x{6AD9}' + . '\x{6ADA}\x{6ADB}\x{6ADC}\x{6ADD}\x{6ADE}\x{6ADF}\x{6AE0}\x{6AE1}\x{6AE2}' + . '\x{6AE3}\x{6AE4}\x{6AE5}\x{6AE6}\x{6AE7}\x{6AE8}\x{6AEA}\x{6AEB}\x{6AEC}' + . '\x{6AED}\x{6AEE}\x{6AEF}\x{6AF0}\x{6AF1}\x{6AF2}\x{6AF3}\x{6AF4}\x{6AF5}' + . '\x{6AF6}\x{6AF7}\x{6AF8}\x{6AF9}\x{6AFA}\x{6AFB}\x{6AFC}\x{6AFD}\x{6AFE}' + . '\x{6AFF}\x{6B00}\x{6B01}\x{6B02}\x{6B03}\x{6B04}\x{6B05}\x{6B06}\x{6B07}' + . '\x{6B08}\x{6B09}\x{6B0A}\x{6B0B}\x{6B0C}\x{6B0D}\x{6B0F}\x{6B10}\x{6B11}' + . '\x{6B12}\x{6B13}\x{6B14}\x{6B15}\x{6B16}\x{6B17}\x{6B18}\x{6B19}\x{6B1A}' + . '\x{6B1C}\x{6B1D}\x{6B1E}\x{6B1F}\x{6B20}\x{6B21}\x{6B22}\x{6B23}\x{6B24}' + . '\x{6B25}\x{6B26}\x{6B27}\x{6B28}\x{6B29}\x{6B2A}\x{6B2B}\x{6B2C}\x{6B2D}' + . '\x{6B2F}\x{6B30}\x{6B31}\x{6B32}\x{6B33}\x{6B34}\x{6B36}\x{6B37}\x{6B38}' + . '\x{6B39}\x{6B3A}\x{6B3B}\x{6B3C}\x{6B3D}\x{6B3E}\x{6B3F}\x{6B41}\x{6B42}' + . '\x{6B43}\x{6B44}\x{6B45}\x{6B46}\x{6B47}\x{6B48}\x{6B49}\x{6B4A}\x{6B4B}' + . '\x{6B4C}\x{6B4D}\x{6B4E}\x{6B4F}\x{6B50}\x{6B51}\x{6B52}\x{6B53}\x{6B54}' + . '\x{6B55}\x{6B56}\x{6B59}\x{6B5A}\x{6B5B}\x{6B5C}\x{6B5E}\x{6B5F}\x{6B60}' + . '\x{6B61}\x{6B62}\x{6B63}\x{6B64}\x{6B65}\x{6B66}\x{6B67}\x{6B69}\x{6B6A}' + . '\x{6B6B}\x{6B6D}\x{6B6F}\x{6B70}\x{6B72}\x{6B73}\x{6B74}\x{6B76}\x{6B77}' + . '\x{6B78}\x{6B79}\x{6B7A}\x{6B7B}\x{6B7C}\x{6B7E}\x{6B7F}\x{6B80}\x{6B81}' + . '\x{6B82}\x{6B83}\x{6B84}\x{6B85}\x{6B86}\x{6B87}\x{6B88}\x{6B89}\x{6B8A}' + . '\x{6B8B}\x{6B8C}\x{6B8D}\x{6B8E}\x{6B8F}\x{6B90}\x{6B91}\x{6B92}\x{6B93}' + . '\x{6B94}\x{6B95}\x{6B96}\x{6B97}\x{6B98}\x{6B99}\x{6B9A}\x{6B9B}\x{6B9C}' + . '\x{6B9D}\x{6B9E}\x{6B9F}\x{6BA0}\x{6BA1}\x{6BA2}\x{6BA3}\x{6BA4}\x{6BA5}' + . '\x{6BA6}\x{6BA7}\x{6BA8}\x{6BA9}\x{6BAA}\x{6BAB}\x{6BAC}\x{6BAD}\x{6BAE}' + . '\x{6BAF}\x{6BB0}\x{6BB2}\x{6BB3}\x{6BB4}\x{6BB5}\x{6BB6}\x{6BB7}\x{6BB9}' + . '\x{6BBA}\x{6BBB}\x{6BBC}\x{6BBD}\x{6BBE}\x{6BBF}\x{6BC0}\x{6BC1}\x{6BC2}' + . '\x{6BC3}\x{6BC4}\x{6BC5}\x{6BC6}\x{6BC7}\x{6BC8}\x{6BC9}\x{6BCA}\x{6BCB}' + . '\x{6BCC}\x{6BCD}\x{6BCE}\x{6BCF}\x{6BD0}\x{6BD1}\x{6BD2}\x{6BD3}\x{6BD4}' + . '\x{6BD5}\x{6BD6}\x{6BD7}\x{6BD8}\x{6BD9}\x{6BDA}\x{6BDB}\x{6BDC}\x{6BDD}' + . '\x{6BDE}\x{6BDF}\x{6BE0}\x{6BE1}\x{6BE2}\x{6BE3}\x{6BE4}\x{6BE5}\x{6BE6}' + . '\x{6BE7}\x{6BE8}\x{6BEA}\x{6BEB}\x{6BEC}\x{6BED}\x{6BEE}\x{6BEF}\x{6BF0}' + . '\x{6BF2}\x{6BF3}\x{6BF5}\x{6BF6}\x{6BF7}\x{6BF8}\x{6BF9}\x{6BFB}\x{6BFC}' + . '\x{6BFD}\x{6BFE}\x{6BFF}\x{6C00}\x{6C01}\x{6C02}\x{6C03}\x{6C04}\x{6C05}' + . '\x{6C06}\x{6C07}\x{6C08}\x{6C09}\x{6C0B}\x{6C0C}\x{6C0D}\x{6C0E}\x{6C0F}' + . '\x{6C10}\x{6C11}\x{6C12}\x{6C13}\x{6C14}\x{6C15}\x{6C16}\x{6C18}\x{6C19}' + . '\x{6C1A}\x{6C1B}\x{6C1D}\x{6C1E}\x{6C1F}\x{6C20}\x{6C21}\x{6C22}\x{6C23}' + . '\x{6C24}\x{6C25}\x{6C26}\x{6C27}\x{6C28}\x{6C29}\x{6C2A}\x{6C2B}\x{6C2C}' + . '\x{6C2E}\x{6C2F}\x{6C30}\x{6C31}\x{6C32}\x{6C33}\x{6C34}\x{6C35}\x{6C36}' + . '\x{6C37}\x{6C38}\x{6C3A}\x{6C3B}\x{6C3D}\x{6C3E}\x{6C3F}\x{6C40}\x{6C41}' + . '\x{6C42}\x{6C43}\x{6C44}\x{6C46}\x{6C47}\x{6C48}\x{6C49}\x{6C4A}\x{6C4B}' + . '\x{6C4C}\x{6C4D}\x{6C4E}\x{6C4F}\x{6C50}\x{6C51}\x{6C52}\x{6C53}\x{6C54}' + . '\x{6C55}\x{6C56}\x{6C57}\x{6C58}\x{6C59}\x{6C5A}\x{6C5B}\x{6C5C}\x{6C5D}' + . '\x{6C5E}\x{6C5F}\x{6C60}\x{6C61}\x{6C62}\x{6C63}\x{6C64}\x{6C65}\x{6C66}' + . '\x{6C67}\x{6C68}\x{6C69}\x{6C6A}\x{6C6B}\x{6C6D}\x{6C6F}\x{6C70}\x{6C71}' + . '\x{6C72}\x{6C73}\x{6C74}\x{6C75}\x{6C76}\x{6C77}\x{6C78}\x{6C79}\x{6C7A}' + . '\x{6C7B}\x{6C7C}\x{6C7D}\x{6C7E}\x{6C7F}\x{6C80}\x{6C81}\x{6C82}\x{6C83}' + . '\x{6C84}\x{6C85}\x{6C86}\x{6C87}\x{6C88}\x{6C89}\x{6C8A}\x{6C8B}\x{6C8C}' + . '\x{6C8D}\x{6C8E}\x{6C8F}\x{6C90}\x{6C91}\x{6C92}\x{6C93}\x{6C94}\x{6C95}' + . '\x{6C96}\x{6C97}\x{6C98}\x{6C99}\x{6C9A}\x{6C9B}\x{6C9C}\x{6C9D}\x{6C9E}' + . '\x{6C9F}\x{6CA1}\x{6CA2}\x{6CA3}\x{6CA4}\x{6CA5}\x{6CA6}\x{6CA7}\x{6CA8}' + . '\x{6CA9}\x{6CAA}\x{6CAB}\x{6CAC}\x{6CAD}\x{6CAE}\x{6CAF}\x{6CB0}\x{6CB1}' + . '\x{6CB2}\x{6CB3}\x{6CB4}\x{6CB5}\x{6CB6}\x{6CB7}\x{6CB8}\x{6CB9}\x{6CBA}' + . '\x{6CBB}\x{6CBC}\x{6CBD}\x{6CBE}\x{6CBF}\x{6CC0}\x{6CC1}\x{6CC2}\x{6CC3}' + . '\x{6CC4}\x{6CC5}\x{6CC6}\x{6CC7}\x{6CC8}\x{6CC9}\x{6CCA}\x{6CCB}\x{6CCC}' + . '\x{6CCD}\x{6CCE}\x{6CCF}\x{6CD0}\x{6CD1}\x{6CD2}\x{6CD3}\x{6CD4}\x{6CD5}' + . '\x{6CD6}\x{6CD7}\x{6CD9}\x{6CDA}\x{6CDB}\x{6CDC}\x{6CDD}\x{6CDE}\x{6CDF}' + . '\x{6CE0}\x{6CE1}\x{6CE2}\x{6CE3}\x{6CE4}\x{6CE5}\x{6CE6}\x{6CE7}\x{6CE8}' + . '\x{6CE9}\x{6CEA}\x{6CEB}\x{6CEC}\x{6CED}\x{6CEE}\x{6CEF}\x{6CF0}\x{6CF1}' + . '\x{6CF2}\x{6CF3}\x{6CF5}\x{6CF6}\x{6CF7}\x{6CF8}\x{6CF9}\x{6CFA}\x{6CFB}' + . '\x{6CFC}\x{6CFD}\x{6CFE}\x{6CFF}\x{6D00}\x{6D01}\x{6D03}\x{6D04}\x{6D05}' + . '\x{6D06}\x{6D07}\x{6D08}\x{6D09}\x{6D0A}\x{6D0B}\x{6D0C}\x{6D0D}\x{6D0E}' + . '\x{6D0F}\x{6D10}\x{6D11}\x{6D12}\x{6D13}\x{6D14}\x{6D15}\x{6D16}\x{6D17}' + . '\x{6D18}\x{6D19}\x{6D1A}\x{6D1B}\x{6D1D}\x{6D1E}\x{6D1F}\x{6D20}\x{6D21}' + . '\x{6D22}\x{6D23}\x{6D25}\x{6D26}\x{6D27}\x{6D28}\x{6D29}\x{6D2A}\x{6D2B}' + . '\x{6D2C}\x{6D2D}\x{6D2E}\x{6D2F}\x{6D30}\x{6D31}\x{6D32}\x{6D33}\x{6D34}' + . '\x{6D35}\x{6D36}\x{6D37}\x{6D38}\x{6D39}\x{6D3A}\x{6D3B}\x{6D3C}\x{6D3D}' + . '\x{6D3E}\x{6D3F}\x{6D40}\x{6D41}\x{6D42}\x{6D43}\x{6D44}\x{6D45}\x{6D46}' + . '\x{6D47}\x{6D48}\x{6D49}\x{6D4A}\x{6D4B}\x{6D4C}\x{6D4D}\x{6D4E}\x{6D4F}' + . '\x{6D50}\x{6D51}\x{6D52}\x{6D53}\x{6D54}\x{6D55}\x{6D56}\x{6D57}\x{6D58}' + . '\x{6D59}\x{6D5A}\x{6D5B}\x{6D5C}\x{6D5D}\x{6D5E}\x{6D5F}\x{6D60}\x{6D61}' + . '\x{6D62}\x{6D63}\x{6D64}\x{6D65}\x{6D66}\x{6D67}\x{6D68}\x{6D69}\x{6D6A}' + . '\x{6D6B}\x{6D6C}\x{6D6D}\x{6D6E}\x{6D6F}\x{6D70}\x{6D72}\x{6D73}\x{6D74}' + . '\x{6D75}\x{6D76}\x{6D77}\x{6D78}\x{6D79}\x{6D7A}\x{6D7B}\x{6D7C}\x{6D7D}' + . '\x{6D7E}\x{6D7F}\x{6D80}\x{6D82}\x{6D83}\x{6D84}\x{6D85}\x{6D86}\x{6D87}' + . '\x{6D88}\x{6D89}\x{6D8A}\x{6D8B}\x{6D8C}\x{6D8D}\x{6D8E}\x{6D8F}\x{6D90}' + . '\x{6D91}\x{6D92}\x{6D93}\x{6D94}\x{6D95}\x{6D97}\x{6D98}\x{6D99}\x{6D9A}' + . '\x{6D9B}\x{6D9D}\x{6D9E}\x{6D9F}\x{6DA0}\x{6DA1}\x{6DA2}\x{6DA3}\x{6DA4}' + . '\x{6DA5}\x{6DA6}\x{6DA7}\x{6DA8}\x{6DA9}\x{6DAA}\x{6DAB}\x{6DAC}\x{6DAD}' + . '\x{6DAE}\x{6DAF}\x{6DB2}\x{6DB3}\x{6DB4}\x{6DB5}\x{6DB7}\x{6DB8}\x{6DB9}' + . '\x{6DBA}\x{6DBB}\x{6DBC}\x{6DBD}\x{6DBE}\x{6DBF}\x{6DC0}\x{6DC1}\x{6DC2}' + . '\x{6DC3}\x{6DC4}\x{6DC5}\x{6DC6}\x{6DC7}\x{6DC8}\x{6DC9}\x{6DCA}\x{6DCB}' + . '\x{6DCC}\x{6DCD}\x{6DCE}\x{6DCF}\x{6DD0}\x{6DD1}\x{6DD2}\x{6DD3}\x{6DD4}' + . '\x{6DD5}\x{6DD6}\x{6DD7}\x{6DD8}\x{6DD9}\x{6DDA}\x{6DDB}\x{6DDC}\x{6DDD}' + . '\x{6DDE}\x{6DDF}\x{6DE0}\x{6DE1}\x{6DE2}\x{6DE3}\x{6DE4}\x{6DE5}\x{6DE6}' + . '\x{6DE7}\x{6DE8}\x{6DE9}\x{6DEA}\x{6DEB}\x{6DEC}\x{6DED}\x{6DEE}\x{6DEF}' + . '\x{6DF0}\x{6DF1}\x{6DF2}\x{6DF3}\x{6DF4}\x{6DF5}\x{6DF6}\x{6DF7}\x{6DF8}' + . '\x{6DF9}\x{6DFA}\x{6DFB}\x{6DFC}\x{6DFD}\x{6E00}\x{6E03}\x{6E04}\x{6E05}' + . '\x{6E07}\x{6E08}\x{6E09}\x{6E0A}\x{6E0B}\x{6E0C}\x{6E0D}\x{6E0E}\x{6E0F}' + . '\x{6E10}\x{6E11}\x{6E14}\x{6E15}\x{6E16}\x{6E17}\x{6E19}\x{6E1A}\x{6E1B}' + . '\x{6E1C}\x{6E1D}\x{6E1E}\x{6E1F}\x{6E20}\x{6E21}\x{6E22}\x{6E23}\x{6E24}' + . '\x{6E25}\x{6E26}\x{6E27}\x{6E28}\x{6E29}\x{6E2B}\x{6E2C}\x{6E2D}\x{6E2E}' + . '\x{6E2F}\x{6E30}\x{6E31}\x{6E32}\x{6E33}\x{6E34}\x{6E35}\x{6E36}\x{6E37}' + . '\x{6E38}\x{6E39}\x{6E3A}\x{6E3B}\x{6E3C}\x{6E3D}\x{6E3E}\x{6E3F}\x{6E40}' + . '\x{6E41}\x{6E42}\x{6E43}\x{6E44}\x{6E45}\x{6E46}\x{6E47}\x{6E48}\x{6E49}' + . '\x{6E4A}\x{6E4B}\x{6E4D}\x{6E4E}\x{6E4F}\x{6E50}\x{6E51}\x{6E52}\x{6E53}' + . '\x{6E54}\x{6E55}\x{6E56}\x{6E57}\x{6E58}\x{6E59}\x{6E5A}\x{6E5B}\x{6E5C}' + . '\x{6E5D}\x{6E5E}\x{6E5F}\x{6E60}\x{6E61}\x{6E62}\x{6E63}\x{6E64}\x{6E65}' + . '\x{6E66}\x{6E67}\x{6E68}\x{6E69}\x{6E6A}\x{6E6B}\x{6E6D}\x{6E6E}\x{6E6F}' + . '\x{6E70}\x{6E71}\x{6E72}\x{6E73}\x{6E74}\x{6E75}\x{6E77}\x{6E78}\x{6E79}' + . '\x{6E7E}\x{6E7F}\x{6E80}\x{6E81}\x{6E82}\x{6E83}\x{6E84}\x{6E85}\x{6E86}' + . '\x{6E87}\x{6E88}\x{6E89}\x{6E8A}\x{6E8D}\x{6E8E}\x{6E8F}\x{6E90}\x{6E91}' + . '\x{6E92}\x{6E93}\x{6E94}\x{6E96}\x{6E97}\x{6E98}\x{6E99}\x{6E9A}\x{6E9B}' + . '\x{6E9C}\x{6E9D}\x{6E9E}\x{6E9F}\x{6EA0}\x{6EA1}\x{6EA2}\x{6EA3}\x{6EA4}' + . '\x{6EA5}\x{6EA6}\x{6EA7}\x{6EA8}\x{6EA9}\x{6EAA}\x{6EAB}\x{6EAC}\x{6EAD}' + . '\x{6EAE}\x{6EAF}\x{6EB0}\x{6EB1}\x{6EB2}\x{6EB3}\x{6EB4}\x{6EB5}\x{6EB6}' + . '\x{6EB7}\x{6EB8}\x{6EB9}\x{6EBA}\x{6EBB}\x{6EBC}\x{6EBD}\x{6EBE}\x{6EBF}' + . '\x{6EC0}\x{6EC1}\x{6EC2}\x{6EC3}\x{6EC4}\x{6EC5}\x{6EC6}\x{6EC7}\x{6EC8}' + . '\x{6EC9}\x{6ECA}\x{6ECB}\x{6ECC}\x{6ECD}\x{6ECE}\x{6ECF}\x{6ED0}\x{6ED1}' + . '\x{6ED2}\x{6ED3}\x{6ED4}\x{6ED5}\x{6ED6}\x{6ED7}\x{6ED8}\x{6ED9}\x{6EDA}' + . '\x{6EDC}\x{6EDE}\x{6EDF}\x{6EE0}\x{6EE1}\x{6EE2}\x{6EE4}\x{6EE5}\x{6EE6}' + . '\x{6EE7}\x{6EE8}\x{6EE9}\x{6EEA}\x{6EEB}\x{6EEC}\x{6EED}\x{6EEE}\x{6EEF}' + . '\x{6EF0}\x{6EF1}\x{6EF2}\x{6EF3}\x{6EF4}\x{6EF5}\x{6EF6}\x{6EF7}\x{6EF8}' + . '\x{6EF9}\x{6EFA}\x{6EFB}\x{6EFC}\x{6EFD}\x{6EFE}\x{6EFF}\x{6F00}\x{6F01}' + . '\x{6F02}\x{6F03}\x{6F05}\x{6F06}\x{6F07}\x{6F08}\x{6F09}\x{6F0A}\x{6F0C}' + . '\x{6F0D}\x{6F0E}\x{6F0F}\x{6F10}\x{6F11}\x{6F12}\x{6F13}\x{6F14}\x{6F15}' + . '\x{6F16}\x{6F17}\x{6F18}\x{6F19}\x{6F1A}\x{6F1B}\x{6F1C}\x{6F1D}\x{6F1E}' + . '\x{6F1F}\x{6F20}\x{6F21}\x{6F22}\x{6F23}\x{6F24}\x{6F25}\x{6F26}\x{6F27}' + . '\x{6F28}\x{6F29}\x{6F2A}\x{6F2B}\x{6F2C}\x{6F2D}\x{6F2E}\x{6F2F}\x{6F30}' + . '\x{6F31}\x{6F32}\x{6F33}\x{6F34}\x{6F35}\x{6F36}\x{6F37}\x{6F38}\x{6F39}' + . '\x{6F3A}\x{6F3B}\x{6F3C}\x{6F3D}\x{6F3E}\x{6F3F}\x{6F40}\x{6F41}\x{6F43}' + . '\x{6F44}\x{6F45}\x{6F46}\x{6F47}\x{6F49}\x{6F4B}\x{6F4C}\x{6F4D}\x{6F4E}' + . '\x{6F4F}\x{6F50}\x{6F51}\x{6F52}\x{6F53}\x{6F54}\x{6F55}\x{6F56}\x{6F57}' + . '\x{6F58}\x{6F59}\x{6F5A}\x{6F5B}\x{6F5C}\x{6F5D}\x{6F5E}\x{6F5F}\x{6F60}' + . '\x{6F61}\x{6F62}\x{6F63}\x{6F64}\x{6F65}\x{6F66}\x{6F67}\x{6F68}\x{6F69}' + . '\x{6F6A}\x{6F6B}\x{6F6C}\x{6F6D}\x{6F6E}\x{6F6F}\x{6F70}\x{6F71}\x{6F72}' + . '\x{6F73}\x{6F74}\x{6F75}\x{6F76}\x{6F77}\x{6F78}\x{6F7A}\x{6F7B}\x{6F7C}' + . '\x{6F7D}\x{6F7E}\x{6F7F}\x{6F80}\x{6F81}\x{6F82}\x{6F83}\x{6F84}\x{6F85}' + . '\x{6F86}\x{6F87}\x{6F88}\x{6F89}\x{6F8A}\x{6F8B}\x{6F8C}\x{6F8D}\x{6F8E}' + . '\x{6F8F}\x{6F90}\x{6F91}\x{6F92}\x{6F93}\x{6F94}\x{6F95}\x{6F96}\x{6F97}' + . '\x{6F99}\x{6F9B}\x{6F9C}\x{6F9D}\x{6F9E}\x{6FA0}\x{6FA1}\x{6FA2}\x{6FA3}' + . '\x{6FA4}\x{6FA5}\x{6FA6}\x{6FA7}\x{6FA8}\x{6FA9}\x{6FAA}\x{6FAB}\x{6FAC}' + . '\x{6FAD}\x{6FAE}\x{6FAF}\x{6FB0}\x{6FB1}\x{6FB2}\x{6FB3}\x{6FB4}\x{6FB5}' + . '\x{6FB6}\x{6FB8}\x{6FB9}\x{6FBA}\x{6FBB}\x{6FBC}\x{6FBD}\x{6FBE}\x{6FBF}' + . '\x{6FC0}\x{6FC1}\x{6FC2}\x{6FC3}\x{6FC4}\x{6FC6}\x{6FC7}\x{6FC8}\x{6FC9}' + . '\x{6FCA}\x{6FCB}\x{6FCC}\x{6FCD}\x{6FCE}\x{6FCF}\x{6FD1}\x{6FD2}\x{6FD4}' + . '\x{6FD5}\x{6FD6}\x{6FD7}\x{6FD8}\x{6FD9}\x{6FDA}\x{6FDB}\x{6FDC}\x{6FDD}' + . '\x{6FDE}\x{6FDF}\x{6FE0}\x{6FE1}\x{6FE2}\x{6FE3}\x{6FE4}\x{6FE5}\x{6FE6}' + . '\x{6FE7}\x{6FE8}\x{6FE9}\x{6FEA}\x{6FEB}\x{6FEC}\x{6FED}\x{6FEE}\x{6FEF}' + . '\x{6FF0}\x{6FF1}\x{6FF2}\x{6FF3}\x{6FF4}\x{6FF6}\x{6FF7}\x{6FF8}\x{6FF9}' + . '\x{6FFA}\x{6FFB}\x{6FFC}\x{6FFE}\x{6FFF}\x{7000}\x{7001}\x{7002}\x{7003}' + . '\x{7004}\x{7005}\x{7006}\x{7007}\x{7008}\x{7009}\x{700A}\x{700B}\x{700C}' + . '\x{700D}\x{700E}\x{700F}\x{7011}\x{7012}\x{7014}\x{7015}\x{7016}\x{7017}' + . '\x{7018}\x{7019}\x{701A}\x{701B}\x{701C}\x{701D}\x{701F}\x{7020}\x{7021}' + . '\x{7022}\x{7023}\x{7024}\x{7025}\x{7026}\x{7027}\x{7028}\x{7029}\x{702A}' + . '\x{702B}\x{702C}\x{702D}\x{702E}\x{702F}\x{7030}\x{7031}\x{7032}\x{7033}' + . '\x{7034}\x{7035}\x{7036}\x{7037}\x{7038}\x{7039}\x{703A}\x{703B}\x{703C}' + . '\x{703D}\x{703E}\x{703F}\x{7040}\x{7041}\x{7042}\x{7043}\x{7044}\x{7045}' + . '\x{7046}\x{7048}\x{7049}\x{704A}\x{704C}\x{704D}\x{704F}\x{7050}\x{7051}' + . '\x{7052}\x{7053}\x{7054}\x{7055}\x{7056}\x{7057}\x{7058}\x{7059}\x{705A}' + . '\x{705B}\x{705C}\x{705D}\x{705E}\x{705F}\x{7060}\x{7061}\x{7062}\x{7063}' + . '\x{7064}\x{7065}\x{7066}\x{7067}\x{7068}\x{7069}\x{706A}\x{706B}\x{706C}' + . '\x{706D}\x{706E}\x{706F}\x{7070}\x{7071}\x{7074}\x{7075}\x{7076}\x{7077}' + . '\x{7078}\x{7079}\x{707A}\x{707C}\x{707D}\x{707E}\x{707F}\x{7080}\x{7082}' + . '\x{7083}\x{7084}\x{7085}\x{7086}\x{7087}\x{7088}\x{7089}\x{708A}\x{708B}' + . '\x{708C}\x{708E}\x{708F}\x{7090}\x{7091}\x{7092}\x{7093}\x{7094}\x{7095}' + . '\x{7096}\x{7098}\x{7099}\x{709A}\x{709C}\x{709D}\x{709E}\x{709F}\x{70A0}' + . '\x{70A1}\x{70A2}\x{70A3}\x{70A4}\x{70A5}\x{70A6}\x{70A7}\x{70A8}\x{70A9}' + . '\x{70AB}\x{70AC}\x{70AD}\x{70AE}\x{70AF}\x{70B0}\x{70B1}\x{70B3}\x{70B4}' + . '\x{70B5}\x{70B7}\x{70B8}\x{70B9}\x{70BA}\x{70BB}\x{70BC}\x{70BD}\x{70BE}' + . '\x{70BF}\x{70C0}\x{70C1}\x{70C2}\x{70C3}\x{70C4}\x{70C5}\x{70C6}\x{70C7}' + . '\x{70C8}\x{70C9}\x{70CA}\x{70CB}\x{70CC}\x{70CD}\x{70CE}\x{70CF}\x{70D0}' + . '\x{70D1}\x{70D2}\x{70D3}\x{70D4}\x{70D6}\x{70D7}\x{70D8}\x{70D9}\x{70DA}' + . '\x{70DB}\x{70DC}\x{70DD}\x{70DE}\x{70DF}\x{70E0}\x{70E1}\x{70E2}\x{70E3}' + . '\x{70E4}\x{70E5}\x{70E6}\x{70E7}\x{70E8}\x{70E9}\x{70EA}\x{70EB}\x{70EC}' + . '\x{70ED}\x{70EE}\x{70EF}\x{70F0}\x{70F1}\x{70F2}\x{70F3}\x{70F4}\x{70F5}' + . '\x{70F6}\x{70F7}\x{70F8}\x{70F9}\x{70FA}\x{70FB}\x{70FC}\x{70FD}\x{70FF}' + . '\x{7100}\x{7101}\x{7102}\x{7103}\x{7104}\x{7105}\x{7106}\x{7107}\x{7109}' + . '\x{710A}\x{710B}\x{710C}\x{710D}\x{710E}\x{710F}\x{7110}\x{7111}\x{7112}' + . '\x{7113}\x{7115}\x{7116}\x{7117}\x{7118}\x{7119}\x{711A}\x{711B}\x{711C}' + . '\x{711D}\x{711E}\x{711F}\x{7120}\x{7121}\x{7122}\x{7123}\x{7125}\x{7126}' + . '\x{7127}\x{7128}\x{7129}\x{712A}\x{712B}\x{712C}\x{712D}\x{712E}\x{712F}' + . '\x{7130}\x{7131}\x{7132}\x{7135}\x{7136}\x{7137}\x{7138}\x{7139}\x{713A}' + . '\x{713B}\x{713D}\x{713E}\x{713F}\x{7140}\x{7141}\x{7142}\x{7143}\x{7144}' + . '\x{7145}\x{7146}\x{7147}\x{7148}\x{7149}\x{714A}\x{714B}\x{714C}\x{714D}' + . '\x{714E}\x{714F}\x{7150}\x{7151}\x{7152}\x{7153}\x{7154}\x{7156}\x{7158}' + . '\x{7159}\x{715A}\x{715B}\x{715C}\x{715D}\x{715E}\x{715F}\x{7160}\x{7161}' + . '\x{7162}\x{7163}\x{7164}\x{7165}\x{7166}\x{7167}\x{7168}\x{7169}\x{716A}' + . '\x{716C}\x{716E}\x{716F}\x{7170}\x{7171}\x{7172}\x{7173}\x{7174}\x{7175}' + . '\x{7176}\x{7177}\x{7178}\x{7179}\x{717A}\x{717B}\x{717C}\x{717D}\x{717E}' + . '\x{717F}\x{7180}\x{7181}\x{7182}\x{7183}\x{7184}\x{7185}\x{7186}\x{7187}' + . '\x{7188}\x{7189}\x{718A}\x{718B}\x{718C}\x{718E}\x{718F}\x{7190}\x{7191}' + . '\x{7192}\x{7193}\x{7194}\x{7195}\x{7197}\x{7198}\x{7199}\x{719A}\x{719B}' + . '\x{719C}\x{719D}\x{719E}\x{719F}\x{71A0}\x{71A1}\x{71A2}\x{71A3}\x{71A4}' + . '\x{71A5}\x{71A7}\x{71A8}\x{71A9}\x{71AA}\x{71AC}\x{71AD}\x{71AE}\x{71AF}' + . '\x{71B0}\x{71B1}\x{71B2}\x{71B3}\x{71B4}\x{71B5}\x{71B7}\x{71B8}\x{71B9}' + . '\x{71BA}\x{71BB}\x{71BC}\x{71BD}\x{71BE}\x{71BF}\x{71C0}\x{71C1}\x{71C2}' + . '\x{71C3}\x{71C4}\x{71C5}\x{71C6}\x{71C7}\x{71C8}\x{71C9}\x{71CA}\x{71CB}' + . '\x{71CD}\x{71CE}\x{71CF}\x{71D0}\x{71D1}\x{71D2}\x{71D4}\x{71D5}\x{71D6}' + . '\x{71D7}\x{71D8}\x{71D9}\x{71DA}\x{71DB}\x{71DC}\x{71DD}\x{71DE}\x{71DF}' + . '\x{71E0}\x{71E1}\x{71E2}\x{71E3}\x{71E4}\x{71E5}\x{71E6}\x{71E7}\x{71E8}' + . '\x{71E9}\x{71EA}\x{71EB}\x{71EC}\x{71ED}\x{71EE}\x{71EF}\x{71F0}\x{71F1}' + . '\x{71F2}\x{71F4}\x{71F5}\x{71F6}\x{71F7}\x{71F8}\x{71F9}\x{71FB}\x{71FC}' + . '\x{71FD}\x{71FE}\x{71FF}\x{7201}\x{7202}\x{7203}\x{7204}\x{7205}\x{7206}' + . '\x{7207}\x{7208}\x{7209}\x{720A}\x{720C}\x{720D}\x{720E}\x{720F}\x{7210}' + . '\x{7212}\x{7213}\x{7214}\x{7216}\x{7218}\x{7219}\x{721A}\x{721B}\x{721C}' + . '\x{721D}\x{721E}\x{721F}\x{7221}\x{7222}\x{7223}\x{7226}\x{7227}\x{7228}' + . '\x{7229}\x{722A}\x{722B}\x{722C}\x{722D}\x{722E}\x{7230}\x{7231}\x{7232}' + . '\x{7233}\x{7235}\x{7236}\x{7237}\x{7238}\x{7239}\x{723A}\x{723B}\x{723C}' + . '\x{723D}\x{723E}\x{723F}\x{7240}\x{7241}\x{7242}\x{7243}\x{7244}\x{7246}' + . '\x{7247}\x{7248}\x{7249}\x{724A}\x{724B}\x{724C}\x{724D}\x{724F}\x{7251}' + . '\x{7252}\x{7253}\x{7254}\x{7256}\x{7257}\x{7258}\x{7259}\x{725A}\x{725B}' + . '\x{725C}\x{725D}\x{725E}\x{725F}\x{7260}\x{7261}\x{7262}\x{7263}\x{7264}' + . '\x{7265}\x{7266}\x{7267}\x{7268}\x{7269}\x{726A}\x{726B}\x{726C}\x{726D}' + . '\x{726E}\x{726F}\x{7270}\x{7271}\x{7272}\x{7273}\x{7274}\x{7275}\x{7276}' + . '\x{7277}\x{7278}\x{7279}\x{727A}\x{727B}\x{727C}\x{727D}\x{727E}\x{727F}' + . '\x{7280}\x{7281}\x{7282}\x{7283}\x{7284}\x{7285}\x{7286}\x{7287}\x{7288}' + . '\x{7289}\x{728A}\x{728B}\x{728C}\x{728D}\x{728E}\x{728F}\x{7290}\x{7291}' + . '\x{7292}\x{7293}\x{7294}\x{7295}\x{7296}\x{7297}\x{7298}\x{7299}\x{729A}' + . '\x{729B}\x{729C}\x{729D}\x{729E}\x{729F}\x{72A1}\x{72A2}\x{72A3}\x{72A4}' + . '\x{72A5}\x{72A6}\x{72A7}\x{72A8}\x{72A9}\x{72AA}\x{72AC}\x{72AD}\x{72AE}' + . '\x{72AF}\x{72B0}\x{72B1}\x{72B2}\x{72B3}\x{72B4}\x{72B5}\x{72B6}\x{72B7}' + . '\x{72B8}\x{72B9}\x{72BA}\x{72BB}\x{72BC}\x{72BD}\x{72BF}\x{72C0}\x{72C1}' + . '\x{72C2}\x{72C3}\x{72C4}\x{72C5}\x{72C6}\x{72C7}\x{72C8}\x{72C9}\x{72CA}' + . '\x{72CB}\x{72CC}\x{72CD}\x{72CE}\x{72CF}\x{72D0}\x{72D1}\x{72D2}\x{72D3}' + . '\x{72D4}\x{72D5}\x{72D6}\x{72D7}\x{72D8}\x{72D9}\x{72DA}\x{72DB}\x{72DC}' + . '\x{72DD}\x{72DE}\x{72DF}\x{72E0}\x{72E1}\x{72E2}\x{72E3}\x{72E4}\x{72E5}' + . '\x{72E6}\x{72E7}\x{72E8}\x{72E9}\x{72EA}\x{72EB}\x{72EC}\x{72ED}\x{72EE}' + . '\x{72EF}\x{72F0}\x{72F1}\x{72F2}\x{72F3}\x{72F4}\x{72F5}\x{72F6}\x{72F7}' + . '\x{72F8}\x{72F9}\x{72FA}\x{72FB}\x{72FC}\x{72FD}\x{72FE}\x{72FF}\x{7300}' + . '\x{7301}\x{7303}\x{7304}\x{7305}\x{7306}\x{7307}\x{7308}\x{7309}\x{730A}' + . '\x{730B}\x{730C}\x{730D}\x{730E}\x{730F}\x{7311}\x{7312}\x{7313}\x{7314}' + . '\x{7315}\x{7316}\x{7317}\x{7318}\x{7319}\x{731A}\x{731B}\x{731C}\x{731D}' + . '\x{731E}\x{7320}\x{7321}\x{7322}\x{7323}\x{7324}\x{7325}\x{7326}\x{7327}' + . '\x{7329}\x{732A}\x{732B}\x{732C}\x{732D}\x{732E}\x{7330}\x{7331}\x{7332}' + . '\x{7333}\x{7334}\x{7335}\x{7336}\x{7337}\x{7338}\x{7339}\x{733A}\x{733B}' + . '\x{733C}\x{733D}\x{733E}\x{733F}\x{7340}\x{7341}\x{7342}\x{7343}\x{7344}' + . '\x{7345}\x{7346}\x{7347}\x{7348}\x{7349}\x{734A}\x{734B}\x{734C}\x{734D}' + . '\x{734E}\x{7350}\x{7351}\x{7352}\x{7354}\x{7355}\x{7356}\x{7357}\x{7358}' + . '\x{7359}\x{735A}\x{735B}\x{735C}\x{735D}\x{735E}\x{735F}\x{7360}\x{7361}' + . '\x{7362}\x{7364}\x{7365}\x{7366}\x{7367}\x{7368}\x{7369}\x{736A}\x{736B}' + . '\x{736C}\x{736D}\x{736E}\x{736F}\x{7370}\x{7371}\x{7372}\x{7373}\x{7374}' + . '\x{7375}\x{7376}\x{7377}\x{7378}\x{7379}\x{737A}\x{737B}\x{737C}\x{737D}' + . '\x{737E}\x{737F}\x{7380}\x{7381}\x{7382}\x{7383}\x{7384}\x{7385}\x{7386}' + . '\x{7387}\x{7388}\x{7389}\x{738A}\x{738B}\x{738C}\x{738D}\x{738E}\x{738F}' + . '\x{7390}\x{7391}\x{7392}\x{7393}\x{7394}\x{7395}\x{7396}\x{7397}\x{7398}' + . '\x{7399}\x{739A}\x{739B}\x{739D}\x{739E}\x{739F}\x{73A0}\x{73A1}\x{73A2}' + . '\x{73A3}\x{73A4}\x{73A5}\x{73A6}\x{73A7}\x{73A8}\x{73A9}\x{73AA}\x{73AB}' + . '\x{73AC}\x{73AD}\x{73AE}\x{73AF}\x{73B0}\x{73B1}\x{73B2}\x{73B3}\x{73B4}' + . '\x{73B5}\x{73B6}\x{73B7}\x{73B8}\x{73B9}\x{73BA}\x{73BB}\x{73BC}\x{73BD}' + . '\x{73BE}\x{73BF}\x{73C0}\x{73C2}\x{73C3}\x{73C4}\x{73C5}\x{73C6}\x{73C7}' + . '\x{73C8}\x{73C9}\x{73CA}\x{73CB}\x{73CC}\x{73CD}\x{73CE}\x{73CF}\x{73D0}' + . '\x{73D1}\x{73D2}\x{73D3}\x{73D4}\x{73D5}\x{73D6}\x{73D7}\x{73D8}\x{73D9}' + . '\x{73DA}\x{73DB}\x{73DC}\x{73DD}\x{73DE}\x{73DF}\x{73E0}\x{73E2}\x{73E3}' + . '\x{73E5}\x{73E6}\x{73E7}\x{73E8}\x{73E9}\x{73EA}\x{73EB}\x{73EC}\x{73ED}' + . '\x{73EE}\x{73EF}\x{73F0}\x{73F1}\x{73F2}\x{73F4}\x{73F5}\x{73F6}\x{73F7}' + . '\x{73F8}\x{73F9}\x{73FA}\x{73FC}\x{73FD}\x{73FE}\x{73FF}\x{7400}\x{7401}' + . '\x{7402}\x{7403}\x{7404}\x{7405}\x{7406}\x{7407}\x{7408}\x{7409}\x{740A}' + . '\x{740B}\x{740C}\x{740D}\x{740E}\x{740F}\x{7410}\x{7411}\x{7412}\x{7413}' + . '\x{7414}\x{7415}\x{7416}\x{7417}\x{7419}\x{741A}\x{741B}\x{741C}\x{741D}' + . '\x{741E}\x{741F}\x{7420}\x{7421}\x{7422}\x{7423}\x{7424}\x{7425}\x{7426}' + . '\x{7427}\x{7428}\x{7429}\x{742A}\x{742B}\x{742C}\x{742D}\x{742E}\x{742F}' + . '\x{7430}\x{7431}\x{7432}\x{7433}\x{7434}\x{7435}\x{7436}\x{7437}\x{7438}' + . '\x{743A}\x{743B}\x{743C}\x{743D}\x{743F}\x{7440}\x{7441}\x{7442}\x{7443}' + . '\x{7444}\x{7445}\x{7446}\x{7448}\x{744A}\x{744B}\x{744C}\x{744D}\x{744E}' + . '\x{744F}\x{7450}\x{7451}\x{7452}\x{7453}\x{7454}\x{7455}\x{7456}\x{7457}' + . '\x{7459}\x{745A}\x{745B}\x{745C}\x{745D}\x{745E}\x{745F}\x{7461}\x{7462}' + . '\x{7463}\x{7464}\x{7465}\x{7466}\x{7467}\x{7468}\x{7469}\x{746A}\x{746B}' + . '\x{746C}\x{746D}\x{746E}\x{746F}\x{7470}\x{7471}\x{7472}\x{7473}\x{7474}' + . '\x{7475}\x{7476}\x{7477}\x{7478}\x{7479}\x{747A}\x{747C}\x{747D}\x{747E}' + . '\x{747F}\x{7480}\x{7481}\x{7482}\x{7483}\x{7485}\x{7486}\x{7487}\x{7488}' + . '\x{7489}\x{748A}\x{748B}\x{748C}\x{748D}\x{748E}\x{748F}\x{7490}\x{7491}' + . '\x{7492}\x{7493}\x{7494}\x{7495}\x{7497}\x{7498}\x{7499}\x{749A}\x{749B}' + . '\x{749C}\x{749E}\x{749F}\x{74A0}\x{74A1}\x{74A3}\x{74A4}\x{74A5}\x{74A6}' + . '\x{74A7}\x{74A8}\x{74A9}\x{74AA}\x{74AB}\x{74AC}\x{74AD}\x{74AE}\x{74AF}' + . '\x{74B0}\x{74B1}\x{74B2}\x{74B3}\x{74B4}\x{74B5}\x{74B6}\x{74B7}\x{74B8}' + . '\x{74B9}\x{74BA}\x{74BB}\x{74BC}\x{74BD}\x{74BE}\x{74BF}\x{74C0}\x{74C1}' + . '\x{74C2}\x{74C3}\x{74C4}\x{74C5}\x{74C6}\x{74CA}\x{74CB}\x{74CD}\x{74CE}' + . '\x{74CF}\x{74D0}\x{74D1}\x{74D2}\x{74D3}\x{74D4}\x{74D5}\x{74D6}\x{74D7}' + . '\x{74D8}\x{74D9}\x{74DA}\x{74DB}\x{74DC}\x{74DD}\x{74DE}\x{74DF}\x{74E0}' + . '\x{74E1}\x{74E2}\x{74E3}\x{74E4}\x{74E5}\x{74E6}\x{74E7}\x{74E8}\x{74E9}' + . '\x{74EA}\x{74EC}\x{74ED}\x{74EE}\x{74EF}\x{74F0}\x{74F1}\x{74F2}\x{74F3}' + . '\x{74F4}\x{74F5}\x{74F6}\x{74F7}\x{74F8}\x{74F9}\x{74FA}\x{74FB}\x{74FC}' + . '\x{74FD}\x{74FE}\x{74FF}\x{7500}\x{7501}\x{7502}\x{7503}\x{7504}\x{7505}' + . '\x{7506}\x{7507}\x{7508}\x{7509}\x{750A}\x{750B}\x{750C}\x{750D}\x{750F}' + . '\x{7510}\x{7511}\x{7512}\x{7513}\x{7514}\x{7515}\x{7516}\x{7517}\x{7518}' + . '\x{7519}\x{751A}\x{751B}\x{751C}\x{751D}\x{751E}\x{751F}\x{7521}\x{7522}' + . '\x{7523}\x{7524}\x{7525}\x{7526}\x{7527}\x{7528}\x{7529}\x{752A}\x{752B}' + . '\x{752C}\x{752D}\x{752E}\x{752F}\x{7530}\x{7531}\x{7532}\x{7533}\x{7535}' + . '\x{7536}\x{7537}\x{7538}\x{7539}\x{753A}\x{753B}\x{753C}\x{753D}\x{753E}' + . '\x{753F}\x{7540}\x{7542}\x{7543}\x{7544}\x{7545}\x{7546}\x{7547}\x{7548}' + . '\x{7549}\x{754B}\x{754C}\x{754D}\x{754E}\x{754F}\x{7550}\x{7551}\x{7553}' + . '\x{7554}\x{7556}\x{7557}\x{7558}\x{7559}\x{755A}\x{755B}\x{755C}\x{755D}' + . '\x{755F}\x{7560}\x{7562}\x{7563}\x{7564}\x{7565}\x{7566}\x{7567}\x{7568}' + . '\x{7569}\x{756A}\x{756B}\x{756C}\x{756D}\x{756E}\x{756F}\x{7570}\x{7572}' + . '\x{7574}\x{7575}\x{7576}\x{7577}\x{7578}\x{7579}\x{757C}\x{757D}\x{757E}' + . '\x{757F}\x{7580}\x{7581}\x{7582}\x{7583}\x{7584}\x{7586}\x{7587}\x{7588}' + . '\x{7589}\x{758A}\x{758B}\x{758C}\x{758D}\x{758F}\x{7590}\x{7591}\x{7592}' + . '\x{7593}\x{7594}\x{7595}\x{7596}\x{7597}\x{7598}\x{7599}\x{759A}\x{759B}' + . '\x{759C}\x{759D}\x{759E}\x{759F}\x{75A0}\x{75A1}\x{75A2}\x{75A3}\x{75A4}' + . '\x{75A5}\x{75A6}\x{75A7}\x{75A8}\x{75AA}\x{75AB}\x{75AC}\x{75AD}\x{75AE}' + . '\x{75AF}\x{75B0}\x{75B1}\x{75B2}\x{75B3}\x{75B4}\x{75B5}\x{75B6}\x{75B8}' + . '\x{75B9}\x{75BA}\x{75BB}\x{75BC}\x{75BD}\x{75BE}\x{75BF}\x{75C0}\x{75C1}' + . '\x{75C2}\x{75C3}\x{75C4}\x{75C5}\x{75C6}\x{75C7}\x{75C8}\x{75C9}\x{75CA}' + . '\x{75CB}\x{75CC}\x{75CD}\x{75CE}\x{75CF}\x{75D0}\x{75D1}\x{75D2}\x{75D3}' + . '\x{75D4}\x{75D5}\x{75D6}\x{75D7}\x{75D8}\x{75D9}\x{75DA}\x{75DB}\x{75DD}' + . '\x{75DE}\x{75DF}\x{75E0}\x{75E1}\x{75E2}\x{75E3}\x{75E4}\x{75E5}\x{75E6}' + . '\x{75E7}\x{75E8}\x{75EA}\x{75EB}\x{75EC}\x{75ED}\x{75EF}\x{75F0}\x{75F1}' + . '\x{75F2}\x{75F3}\x{75F4}\x{75F5}\x{75F6}\x{75F7}\x{75F8}\x{75F9}\x{75FA}' + . '\x{75FB}\x{75FC}\x{75FD}\x{75FE}\x{75FF}\x{7600}\x{7601}\x{7602}\x{7603}' + . '\x{7604}\x{7605}\x{7606}\x{7607}\x{7608}\x{7609}\x{760A}\x{760B}\x{760C}' + . '\x{760D}\x{760E}\x{760F}\x{7610}\x{7611}\x{7612}\x{7613}\x{7614}\x{7615}' + . '\x{7616}\x{7617}\x{7618}\x{7619}\x{761A}\x{761B}\x{761C}\x{761D}\x{761E}' + . '\x{761F}\x{7620}\x{7621}\x{7622}\x{7623}\x{7624}\x{7625}\x{7626}\x{7627}' + . '\x{7628}\x{7629}\x{762A}\x{762B}\x{762D}\x{762E}\x{762F}\x{7630}\x{7631}' + . '\x{7632}\x{7633}\x{7634}\x{7635}\x{7636}\x{7637}\x{7638}\x{7639}\x{763A}' + . '\x{763B}\x{763C}\x{763D}\x{763E}\x{763F}\x{7640}\x{7641}\x{7642}\x{7643}' + . '\x{7646}\x{7647}\x{7648}\x{7649}\x{764A}\x{764B}\x{764C}\x{764D}\x{764F}' + . '\x{7650}\x{7652}\x{7653}\x{7654}\x{7656}\x{7657}\x{7658}\x{7659}\x{765A}' + . '\x{765B}\x{765C}\x{765D}\x{765E}\x{765F}\x{7660}\x{7661}\x{7662}\x{7663}' + . '\x{7664}\x{7665}\x{7666}\x{7667}\x{7668}\x{7669}\x{766A}\x{766B}\x{766C}' + . '\x{766D}\x{766E}\x{766F}\x{7670}\x{7671}\x{7672}\x{7674}\x{7675}\x{7676}' + . '\x{7677}\x{7678}\x{7679}\x{767B}\x{767C}\x{767D}\x{767E}\x{767F}\x{7680}' + . '\x{7681}\x{7682}\x{7683}\x{7684}\x{7685}\x{7686}\x{7687}\x{7688}\x{7689}' + . '\x{768A}\x{768B}\x{768C}\x{768E}\x{768F}\x{7690}\x{7691}\x{7692}\x{7693}' + . '\x{7694}\x{7695}\x{7696}\x{7697}\x{7698}\x{7699}\x{769A}\x{769B}\x{769C}' + . '\x{769D}\x{769E}\x{769F}\x{76A0}\x{76A3}\x{76A4}\x{76A6}\x{76A7}\x{76A9}' + . '\x{76AA}\x{76AB}\x{76AC}\x{76AD}\x{76AE}\x{76AF}\x{76B0}\x{76B1}\x{76B2}' + . '\x{76B4}\x{76B5}\x{76B7}\x{76B8}\x{76BA}\x{76BB}\x{76BC}\x{76BD}\x{76BE}' + . '\x{76BF}\x{76C0}\x{76C2}\x{76C3}\x{76C4}\x{76C5}\x{76C6}\x{76C7}\x{76C8}' + . '\x{76C9}\x{76CA}\x{76CD}\x{76CE}\x{76CF}\x{76D0}\x{76D1}\x{76D2}\x{76D3}' + . '\x{76D4}\x{76D5}\x{76D6}\x{76D7}\x{76D8}\x{76DA}\x{76DB}\x{76DC}\x{76DD}' + . '\x{76DE}\x{76DF}\x{76E0}\x{76E1}\x{76E2}\x{76E3}\x{76E4}\x{76E5}\x{76E6}' + . '\x{76E7}\x{76E8}\x{76E9}\x{76EA}\x{76EC}\x{76ED}\x{76EE}\x{76EF}\x{76F0}' + . '\x{76F1}\x{76F2}\x{76F3}\x{76F4}\x{76F5}\x{76F6}\x{76F7}\x{76F8}\x{76F9}' + . '\x{76FA}\x{76FB}\x{76FC}\x{76FD}\x{76FE}\x{76FF}\x{7701}\x{7703}\x{7704}' + . '\x{7705}\x{7706}\x{7707}\x{7708}\x{7709}\x{770A}\x{770B}\x{770C}\x{770D}' + . '\x{770F}\x{7710}\x{7711}\x{7712}\x{7713}\x{7714}\x{7715}\x{7716}\x{7717}' + . '\x{7718}\x{7719}\x{771A}\x{771B}\x{771C}\x{771D}\x{771E}\x{771F}\x{7720}' + . '\x{7722}\x{7723}\x{7725}\x{7726}\x{7727}\x{7728}\x{7729}\x{772A}\x{772C}' + . '\x{772D}\x{772E}\x{772F}\x{7730}\x{7731}\x{7732}\x{7733}\x{7734}\x{7735}' + . '\x{7736}\x{7737}\x{7738}\x{7739}\x{773A}\x{773B}\x{773C}\x{773D}\x{773E}' + . '\x{7740}\x{7741}\x{7743}\x{7744}\x{7745}\x{7746}\x{7747}\x{7748}\x{7749}' + . '\x{774A}\x{774B}\x{774C}\x{774D}\x{774E}\x{774F}\x{7750}\x{7751}\x{7752}' + . '\x{7753}\x{7754}\x{7755}\x{7756}\x{7757}\x{7758}\x{7759}\x{775A}\x{775B}' + . '\x{775C}\x{775D}\x{775E}\x{775F}\x{7760}\x{7761}\x{7762}\x{7763}\x{7765}' + . '\x{7766}\x{7767}\x{7768}\x{7769}\x{776A}\x{776B}\x{776C}\x{776D}\x{776E}' + . '\x{776F}\x{7770}\x{7771}\x{7772}\x{7773}\x{7774}\x{7775}\x{7776}\x{7777}' + . '\x{7778}\x{7779}\x{777A}\x{777B}\x{777C}\x{777D}\x{777E}\x{777F}\x{7780}' + . '\x{7781}\x{7782}\x{7783}\x{7784}\x{7785}\x{7786}\x{7787}\x{7788}\x{7789}' + . '\x{778A}\x{778B}\x{778C}\x{778D}\x{778E}\x{778F}\x{7790}\x{7791}\x{7792}' + . '\x{7793}\x{7794}\x{7795}\x{7797}\x{7798}\x{7799}\x{779A}\x{779B}\x{779C}' + . '\x{779D}\x{779E}\x{779F}\x{77A0}\x{77A1}\x{77A2}\x{77A3}\x{77A5}\x{77A6}' + . '\x{77A7}\x{77A8}\x{77A9}\x{77AA}\x{77AB}\x{77AC}\x{77AD}\x{77AE}\x{77AF}' + . '\x{77B0}\x{77B1}\x{77B2}\x{77B3}\x{77B4}\x{77B5}\x{77B6}\x{77B7}\x{77B8}' + . '\x{77B9}\x{77BA}\x{77BB}\x{77BC}\x{77BD}\x{77BF}\x{77C0}\x{77C2}\x{77C3}' + . '\x{77C4}\x{77C5}\x{77C6}\x{77C7}\x{77C8}\x{77C9}\x{77CA}\x{77CB}\x{77CC}' + . '\x{77CD}\x{77CE}\x{77CF}\x{77D0}\x{77D1}\x{77D3}\x{77D4}\x{77D5}\x{77D6}' + . '\x{77D7}\x{77D8}\x{77D9}\x{77DA}\x{77DB}\x{77DC}\x{77DE}\x{77DF}\x{77E0}' + . '\x{77E1}\x{77E2}\x{77E3}\x{77E5}\x{77E7}\x{77E8}\x{77E9}\x{77EA}\x{77EB}' + . '\x{77EC}\x{77ED}\x{77EE}\x{77EF}\x{77F0}\x{77F1}\x{77F2}\x{77F3}\x{77F6}' + . '\x{77F7}\x{77F8}\x{77F9}\x{77FA}\x{77FB}\x{77FC}\x{77FD}\x{77FE}\x{77FF}' + . '\x{7800}\x{7801}\x{7802}\x{7803}\x{7804}\x{7805}\x{7806}\x{7808}\x{7809}' + . '\x{780A}\x{780B}\x{780C}\x{780D}\x{780E}\x{780F}\x{7810}\x{7811}\x{7812}' + . '\x{7813}\x{7814}\x{7815}\x{7816}\x{7817}\x{7818}\x{7819}\x{781A}\x{781B}' + . '\x{781C}\x{781D}\x{781E}\x{781F}\x{7820}\x{7821}\x{7822}\x{7823}\x{7825}' + . '\x{7826}\x{7827}\x{7828}\x{7829}\x{782A}\x{782B}\x{782C}\x{782D}\x{782E}' + . '\x{782F}\x{7830}\x{7831}\x{7832}\x{7833}\x{7834}\x{7835}\x{7837}\x{7838}' + . '\x{7839}\x{783A}\x{783B}\x{783C}\x{783D}\x{783E}\x{7840}\x{7841}\x{7843}' + . '\x{7844}\x{7845}\x{7847}\x{7848}\x{7849}\x{784A}\x{784C}\x{784D}\x{784E}' + . '\x{7850}\x{7851}\x{7852}\x{7853}\x{7854}\x{7855}\x{7856}\x{7857}\x{7858}' + . '\x{7859}\x{785A}\x{785B}\x{785C}\x{785D}\x{785E}\x{785F}\x{7860}\x{7861}' + . '\x{7862}\x{7863}\x{7864}\x{7865}\x{7866}\x{7867}\x{7868}\x{7869}\x{786A}' + . '\x{786B}\x{786C}\x{786D}\x{786E}\x{786F}\x{7870}\x{7871}\x{7872}\x{7873}' + . '\x{7874}\x{7875}\x{7877}\x{7878}\x{7879}\x{787A}\x{787B}\x{787C}\x{787D}' + . '\x{787E}\x{787F}\x{7880}\x{7881}\x{7882}\x{7883}\x{7884}\x{7885}\x{7886}' + . '\x{7887}\x{7889}\x{788A}\x{788B}\x{788C}\x{788D}\x{788E}\x{788F}\x{7890}' + . '\x{7891}\x{7892}\x{7893}\x{7894}\x{7895}\x{7896}\x{7897}\x{7898}\x{7899}' + . '\x{789A}\x{789B}\x{789C}\x{789D}\x{789E}\x{789F}\x{78A0}\x{78A1}\x{78A2}' + . '\x{78A3}\x{78A4}\x{78A5}\x{78A6}\x{78A7}\x{78A8}\x{78A9}\x{78AA}\x{78AB}' + . '\x{78AC}\x{78AD}\x{78AE}\x{78AF}\x{78B0}\x{78B1}\x{78B2}\x{78B3}\x{78B4}' + . '\x{78B5}\x{78B6}\x{78B7}\x{78B8}\x{78B9}\x{78BA}\x{78BB}\x{78BC}\x{78BD}' + . '\x{78BE}\x{78BF}\x{78C0}\x{78C1}\x{78C3}\x{78C4}\x{78C5}\x{78C6}\x{78C8}' + . '\x{78C9}\x{78CA}\x{78CB}\x{78CC}\x{78CD}\x{78CE}\x{78CF}\x{78D0}\x{78D1}' + . '\x{78D3}\x{78D4}\x{78D5}\x{78D6}\x{78D7}\x{78D8}\x{78D9}\x{78DA}\x{78DB}' + . '\x{78DC}\x{78DD}\x{78DE}\x{78DF}\x{78E0}\x{78E1}\x{78E2}\x{78E3}\x{78E4}' + . '\x{78E5}\x{78E6}\x{78E7}\x{78E8}\x{78E9}\x{78EA}\x{78EB}\x{78EC}\x{78ED}' + . '\x{78EE}\x{78EF}\x{78F1}\x{78F2}\x{78F3}\x{78F4}\x{78F5}\x{78F6}\x{78F7}' + . '\x{78F9}\x{78FA}\x{78FB}\x{78FC}\x{78FD}\x{78FE}\x{78FF}\x{7901}\x{7902}' + . '\x{7903}\x{7904}\x{7905}\x{7906}\x{7907}\x{7909}\x{790A}\x{790B}\x{790C}' + . '\x{790E}\x{790F}\x{7910}\x{7911}\x{7912}\x{7913}\x{7914}\x{7916}\x{7917}' + . '\x{7918}\x{7919}\x{791A}\x{791B}\x{791C}\x{791D}\x{791E}\x{7921}\x{7922}' + . '\x{7923}\x{7924}\x{7925}\x{7926}\x{7927}\x{7928}\x{7929}\x{792A}\x{792B}' + . '\x{792C}\x{792D}\x{792E}\x{792F}\x{7930}\x{7931}\x{7933}\x{7934}\x{7935}' + . '\x{7937}\x{7938}\x{7939}\x{793A}\x{793B}\x{793C}\x{793D}\x{793E}\x{793F}' + . '\x{7940}\x{7941}\x{7942}\x{7943}\x{7944}\x{7945}\x{7946}\x{7947}\x{7948}' + . '\x{7949}\x{794A}\x{794B}\x{794C}\x{794D}\x{794E}\x{794F}\x{7950}\x{7951}' + . '\x{7952}\x{7953}\x{7954}\x{7955}\x{7956}\x{7957}\x{7958}\x{795A}\x{795B}' + . '\x{795C}\x{795D}\x{795E}\x{795F}\x{7960}\x{7961}\x{7962}\x{7963}\x{7964}' + . '\x{7965}\x{7966}\x{7967}\x{7968}\x{7969}\x{796A}\x{796B}\x{796D}\x{796F}' + . '\x{7970}\x{7971}\x{7972}\x{7973}\x{7974}\x{7977}\x{7978}\x{7979}\x{797A}' + . '\x{797B}\x{797C}\x{797D}\x{797E}\x{797F}\x{7980}\x{7981}\x{7982}\x{7983}' + . '\x{7984}\x{7985}\x{7988}\x{7989}\x{798A}\x{798B}\x{798C}\x{798D}\x{798E}' + . '\x{798F}\x{7990}\x{7991}\x{7992}\x{7993}\x{7994}\x{7995}\x{7996}\x{7997}' + . '\x{7998}\x{7999}\x{799A}\x{799B}\x{799C}\x{799F}\x{79A0}\x{79A1}\x{79A2}' + . '\x{79A3}\x{79A4}\x{79A5}\x{79A6}\x{79A7}\x{79A8}\x{79AA}\x{79AB}\x{79AC}' + . '\x{79AD}\x{79AE}\x{79AF}\x{79B0}\x{79B1}\x{79B2}\x{79B3}\x{79B4}\x{79B5}' + . '\x{79B6}\x{79B7}\x{79B8}\x{79B9}\x{79BA}\x{79BB}\x{79BD}\x{79BE}\x{79BF}' + . '\x{79C0}\x{79C1}\x{79C2}\x{79C3}\x{79C5}\x{79C6}\x{79C8}\x{79C9}\x{79CA}' + . '\x{79CB}\x{79CD}\x{79CE}\x{79CF}\x{79D0}\x{79D1}\x{79D2}\x{79D3}\x{79D5}' + . '\x{79D6}\x{79D8}\x{79D9}\x{79DA}\x{79DB}\x{79DC}\x{79DD}\x{79DE}\x{79DF}' + . '\x{79E0}\x{79E1}\x{79E2}\x{79E3}\x{79E4}\x{79E5}\x{79E6}\x{79E7}\x{79E8}' + . '\x{79E9}\x{79EA}\x{79EB}\x{79EC}\x{79ED}\x{79EE}\x{79EF}\x{79F0}\x{79F1}' + . '\x{79F2}\x{79F3}\x{79F4}\x{79F5}\x{79F6}\x{79F7}\x{79F8}\x{79F9}\x{79FA}' + . '\x{79FB}\x{79FC}\x{79FD}\x{79FE}\x{79FF}\x{7A00}\x{7A02}\x{7A03}\x{7A04}' + . '\x{7A05}\x{7A06}\x{7A08}\x{7A0A}\x{7A0B}\x{7A0C}\x{7A0D}\x{7A0E}\x{7A0F}' + . '\x{7A10}\x{7A11}\x{7A12}\x{7A13}\x{7A14}\x{7A15}\x{7A16}\x{7A17}\x{7A18}' + . '\x{7A19}\x{7A1A}\x{7A1B}\x{7A1C}\x{7A1D}\x{7A1E}\x{7A1F}\x{7A20}\x{7A21}' + . '\x{7A22}\x{7A23}\x{7A24}\x{7A25}\x{7A26}\x{7A27}\x{7A28}\x{7A29}\x{7A2A}' + . '\x{7A2B}\x{7A2D}\x{7A2E}\x{7A2F}\x{7A30}\x{7A31}\x{7A32}\x{7A33}\x{7A34}' + . '\x{7A35}\x{7A37}\x{7A39}\x{7A3B}\x{7A3C}\x{7A3D}\x{7A3E}\x{7A3F}\x{7A40}' + . '\x{7A41}\x{7A42}\x{7A43}\x{7A44}\x{7A45}\x{7A46}\x{7A47}\x{7A48}\x{7A49}' + . '\x{7A4A}\x{7A4B}\x{7A4C}\x{7A4D}\x{7A4E}\x{7A50}\x{7A51}\x{7A52}\x{7A53}' + . '\x{7A54}\x{7A55}\x{7A56}\x{7A57}\x{7A58}\x{7A59}\x{7A5A}\x{7A5B}\x{7A5C}' + . '\x{7A5D}\x{7A5E}\x{7A5F}\x{7A60}\x{7A61}\x{7A62}\x{7A65}\x{7A66}\x{7A67}' + . '\x{7A68}\x{7A69}\x{7A6B}\x{7A6C}\x{7A6D}\x{7A6E}\x{7A70}\x{7A71}\x{7A72}' + . '\x{7A73}\x{7A74}\x{7A75}\x{7A76}\x{7A77}\x{7A78}\x{7A79}\x{7A7A}\x{7A7B}' + . '\x{7A7C}\x{7A7D}\x{7A7E}\x{7A7F}\x{7A80}\x{7A81}\x{7A83}\x{7A84}\x{7A85}' + . '\x{7A86}\x{7A87}\x{7A88}\x{7A89}\x{7A8A}\x{7A8B}\x{7A8C}\x{7A8D}\x{7A8E}' + . '\x{7A8F}\x{7A90}\x{7A91}\x{7A92}\x{7A93}\x{7A94}\x{7A95}\x{7A96}\x{7A97}' + . '\x{7A98}\x{7A99}\x{7A9C}\x{7A9D}\x{7A9E}\x{7A9F}\x{7AA0}\x{7AA1}\x{7AA2}' + . '\x{7AA3}\x{7AA4}\x{7AA5}\x{7AA6}\x{7AA7}\x{7AA8}\x{7AA9}\x{7AAA}\x{7AAB}' + . '\x{7AAC}\x{7AAD}\x{7AAE}\x{7AAF}\x{7AB0}\x{7AB1}\x{7AB2}\x{7AB3}\x{7AB4}' + . '\x{7AB5}\x{7AB6}\x{7AB7}\x{7AB8}\x{7ABA}\x{7ABE}\x{7ABF}\x{7AC0}\x{7AC1}' + . '\x{7AC4}\x{7AC5}\x{7AC7}\x{7AC8}\x{7AC9}\x{7ACA}\x{7ACB}\x{7ACC}\x{7ACD}' + . '\x{7ACE}\x{7ACF}\x{7AD0}\x{7AD1}\x{7AD2}\x{7AD3}\x{7AD4}\x{7AD5}\x{7AD6}' + . '\x{7AD8}\x{7AD9}\x{7ADB}\x{7ADC}\x{7ADD}\x{7ADE}\x{7ADF}\x{7AE0}\x{7AE1}' + . '\x{7AE2}\x{7AE3}\x{7AE4}\x{7AE5}\x{7AE6}\x{7AE7}\x{7AE8}\x{7AEA}\x{7AEB}' + . '\x{7AEC}\x{7AED}\x{7AEE}\x{7AEF}\x{7AF0}\x{7AF1}\x{7AF2}\x{7AF3}\x{7AF4}' + . '\x{7AF6}\x{7AF7}\x{7AF8}\x{7AF9}\x{7AFA}\x{7AFB}\x{7AFD}\x{7AFE}\x{7AFF}' + . '\x{7B00}\x{7B01}\x{7B02}\x{7B03}\x{7B04}\x{7B05}\x{7B06}\x{7B08}\x{7B09}' + . '\x{7B0A}\x{7B0B}\x{7B0C}\x{7B0D}\x{7B0E}\x{7B0F}\x{7B10}\x{7B11}\x{7B12}' + . '\x{7B13}\x{7B14}\x{7B15}\x{7B16}\x{7B17}\x{7B18}\x{7B19}\x{7B1A}\x{7B1B}' + . '\x{7B1C}\x{7B1D}\x{7B1E}\x{7B20}\x{7B21}\x{7B22}\x{7B23}\x{7B24}\x{7B25}' + . '\x{7B26}\x{7B28}\x{7B2A}\x{7B2B}\x{7B2C}\x{7B2D}\x{7B2E}\x{7B2F}\x{7B30}' + . '\x{7B31}\x{7B32}\x{7B33}\x{7B34}\x{7B35}\x{7B36}\x{7B37}\x{7B38}\x{7B39}' + . '\x{7B3A}\x{7B3B}\x{7B3C}\x{7B3D}\x{7B3E}\x{7B3F}\x{7B40}\x{7B41}\x{7B43}' + . '\x{7B44}\x{7B45}\x{7B46}\x{7B47}\x{7B48}\x{7B49}\x{7B4A}\x{7B4B}\x{7B4C}' + . '\x{7B4D}\x{7B4E}\x{7B4F}\x{7B50}\x{7B51}\x{7B52}\x{7B54}\x{7B55}\x{7B56}' + . '\x{7B57}\x{7B58}\x{7B59}\x{7B5A}\x{7B5B}\x{7B5C}\x{7B5D}\x{7B5E}\x{7B5F}' + . '\x{7B60}\x{7B61}\x{7B62}\x{7B63}\x{7B64}\x{7B65}\x{7B66}\x{7B67}\x{7B68}' + . '\x{7B69}\x{7B6A}\x{7B6B}\x{7B6C}\x{7B6D}\x{7B6E}\x{7B70}\x{7B71}\x{7B72}' + . '\x{7B73}\x{7B74}\x{7B75}\x{7B76}\x{7B77}\x{7B78}\x{7B79}\x{7B7B}\x{7B7C}' + . '\x{7B7D}\x{7B7E}\x{7B7F}\x{7B80}\x{7B81}\x{7B82}\x{7B83}\x{7B84}\x{7B85}' + . '\x{7B87}\x{7B88}\x{7B89}\x{7B8A}\x{7B8B}\x{7B8C}\x{7B8D}\x{7B8E}\x{7B8F}' + . '\x{7B90}\x{7B91}\x{7B93}\x{7B94}\x{7B95}\x{7B96}\x{7B97}\x{7B98}\x{7B99}' + . '\x{7B9A}\x{7B9B}\x{7B9C}\x{7B9D}\x{7B9E}\x{7B9F}\x{7BA0}\x{7BA1}\x{7BA2}' + . '\x{7BA4}\x{7BA6}\x{7BA7}\x{7BA8}\x{7BA9}\x{7BAA}\x{7BAB}\x{7BAC}\x{7BAD}' + . '\x{7BAE}\x{7BAF}\x{7BB1}\x{7BB3}\x{7BB4}\x{7BB5}\x{7BB6}\x{7BB7}\x{7BB8}' + . '\x{7BB9}\x{7BBA}\x{7BBB}\x{7BBC}\x{7BBD}\x{7BBE}\x{7BBF}\x{7BC0}\x{7BC1}' + . '\x{7BC2}\x{7BC3}\x{7BC4}\x{7BC5}\x{7BC6}\x{7BC7}\x{7BC8}\x{7BC9}\x{7BCA}' + . '\x{7BCB}\x{7BCC}\x{7BCD}\x{7BCE}\x{7BD0}\x{7BD1}\x{7BD2}\x{7BD3}\x{7BD4}' + . '\x{7BD5}\x{7BD6}\x{7BD7}\x{7BD8}\x{7BD9}\x{7BDA}\x{7BDB}\x{7BDC}\x{7BDD}' + . '\x{7BDE}\x{7BDF}\x{7BE0}\x{7BE1}\x{7BE2}\x{7BE3}\x{7BE4}\x{7BE5}\x{7BE6}' + . '\x{7BE7}\x{7BE8}\x{7BE9}\x{7BEA}\x{7BEB}\x{7BEC}\x{7BED}\x{7BEE}\x{7BEF}' + . '\x{7BF0}\x{7BF1}\x{7BF2}\x{7BF3}\x{7BF4}\x{7BF5}\x{7BF6}\x{7BF7}\x{7BF8}' + . '\x{7BF9}\x{7BFB}\x{7BFC}\x{7BFD}\x{7BFE}\x{7BFF}\x{7C00}\x{7C01}\x{7C02}' + . '\x{7C03}\x{7C04}\x{7C05}\x{7C06}\x{7C07}\x{7C08}\x{7C09}\x{7C0A}\x{7C0B}' + . '\x{7C0C}\x{7C0D}\x{7C0E}\x{7C0F}\x{7C10}\x{7C11}\x{7C12}\x{7C13}\x{7C15}' + . '\x{7C16}\x{7C17}\x{7C18}\x{7C19}\x{7C1A}\x{7C1C}\x{7C1D}\x{7C1E}\x{7C1F}' + . '\x{7C20}\x{7C21}\x{7C22}\x{7C23}\x{7C24}\x{7C25}\x{7C26}\x{7C27}\x{7C28}' + . '\x{7C29}\x{7C2A}\x{7C2B}\x{7C2C}\x{7C2D}\x{7C30}\x{7C31}\x{7C32}\x{7C33}' + . '\x{7C34}\x{7C35}\x{7C36}\x{7C37}\x{7C38}\x{7C39}\x{7C3A}\x{7C3B}\x{7C3C}' + . '\x{7C3D}\x{7C3E}\x{7C3F}\x{7C40}\x{7C41}\x{7C42}\x{7C43}\x{7C44}\x{7C45}' + . '\x{7C46}\x{7C47}\x{7C48}\x{7C49}\x{7C4A}\x{7C4B}\x{7C4C}\x{7C4D}\x{7C4E}' + . '\x{7C50}\x{7C51}\x{7C53}\x{7C54}\x{7C56}\x{7C57}\x{7C58}\x{7C59}\x{7C5A}' + . '\x{7C5B}\x{7C5C}\x{7C5E}\x{7C5F}\x{7C60}\x{7C61}\x{7C62}\x{7C63}\x{7C64}' + . '\x{7C65}\x{7C66}\x{7C67}\x{7C68}\x{7C69}\x{7C6A}\x{7C6B}\x{7C6C}\x{7C6D}' + . '\x{7C6E}\x{7C6F}\x{7C70}\x{7C71}\x{7C72}\x{7C73}\x{7C74}\x{7C75}\x{7C77}' + . '\x{7C78}\x{7C79}\x{7C7A}\x{7C7B}\x{7C7C}\x{7C7D}\x{7C7E}\x{7C7F}\x{7C80}' + . '\x{7C81}\x{7C82}\x{7C84}\x{7C85}\x{7C86}\x{7C88}\x{7C89}\x{7C8A}\x{7C8B}' + . '\x{7C8C}\x{7C8D}\x{7C8E}\x{7C8F}\x{7C90}\x{7C91}\x{7C92}\x{7C94}\x{7C95}' + . '\x{7C96}\x{7C97}\x{7C98}\x{7C99}\x{7C9B}\x{7C9C}\x{7C9D}\x{7C9E}\x{7C9F}' + . '\x{7CA0}\x{7CA1}\x{7CA2}\x{7CA3}\x{7CA4}\x{7CA5}\x{7CA6}\x{7CA7}\x{7CA8}' + . '\x{7CA9}\x{7CAA}\x{7CAD}\x{7CAE}\x{7CAF}\x{7CB0}\x{7CB1}\x{7CB2}\x{7CB3}' + . '\x{7CB4}\x{7CB5}\x{7CB6}\x{7CB7}\x{7CB8}\x{7CB9}\x{7CBA}\x{7CBB}\x{7CBC}' + . '\x{7CBD}\x{7CBE}\x{7CBF}\x{7CC0}\x{7CC1}\x{7CC2}\x{7CC3}\x{7CC4}\x{7CC5}' + . '\x{7CC6}\x{7CC7}\x{7CC8}\x{7CC9}\x{7CCA}\x{7CCB}\x{7CCC}\x{7CCD}\x{7CCE}' + . '\x{7CCF}\x{7CD0}\x{7CD1}\x{7CD2}\x{7CD4}\x{7CD5}\x{7CD6}\x{7CD7}\x{7CD8}' + . '\x{7CD9}\x{7CDC}\x{7CDD}\x{7CDE}\x{7CDF}\x{7CE0}\x{7CE2}\x{7CE4}\x{7CE7}' + . '\x{7CE8}\x{7CE9}\x{7CEA}\x{7CEB}\x{7CEC}\x{7CED}\x{7CEE}\x{7CEF}\x{7CF0}' + . '\x{7CF1}\x{7CF2}\x{7CF3}\x{7CF4}\x{7CF5}\x{7CF6}\x{7CF7}\x{7CF8}\x{7CF9}' + . '\x{7CFA}\x{7CFB}\x{7CFD}\x{7CFE}\x{7D00}\x{7D01}\x{7D02}\x{7D03}\x{7D04}' + . '\x{7D05}\x{7D06}\x{7D07}\x{7D08}\x{7D09}\x{7D0A}\x{7D0B}\x{7D0C}\x{7D0D}' + . '\x{7D0E}\x{7D0F}\x{7D10}\x{7D11}\x{7D12}\x{7D13}\x{7D14}\x{7D15}\x{7D16}' + . '\x{7D17}\x{7D18}\x{7D19}\x{7D1A}\x{7D1B}\x{7D1C}\x{7D1D}\x{7D1E}\x{7D1F}' + . '\x{7D20}\x{7D21}\x{7D22}\x{7D24}\x{7D25}\x{7D26}\x{7D27}\x{7D28}\x{7D29}' + . '\x{7D2B}\x{7D2C}\x{7D2E}\x{7D2F}\x{7D30}\x{7D31}\x{7D32}\x{7D33}\x{7D34}' + . '\x{7D35}\x{7D36}\x{7D37}\x{7D38}\x{7D39}\x{7D3A}\x{7D3B}\x{7D3C}\x{7D3D}' + . '\x{7D3E}\x{7D3F}\x{7D40}\x{7D41}\x{7D42}\x{7D43}\x{7D44}\x{7D45}\x{7D46}' + . '\x{7D47}\x{7D49}\x{7D4A}\x{7D4B}\x{7D4C}\x{7D4E}\x{7D4F}\x{7D50}\x{7D51}' + . '\x{7D52}\x{7D53}\x{7D54}\x{7D55}\x{7D56}\x{7D57}\x{7D58}\x{7D59}\x{7D5B}' + . '\x{7D5C}\x{7D5D}\x{7D5E}\x{7D5F}\x{7D60}\x{7D61}\x{7D62}\x{7D63}\x{7D65}' + . '\x{7D66}\x{7D67}\x{7D68}\x{7D69}\x{7D6A}\x{7D6B}\x{7D6C}\x{7D6D}\x{7D6E}' + . '\x{7D6F}\x{7D70}\x{7D71}\x{7D72}\x{7D73}\x{7D74}\x{7D75}\x{7D76}\x{7D77}' + . '\x{7D79}\x{7D7A}\x{7D7B}\x{7D7C}\x{7D7D}\x{7D7E}\x{7D7F}\x{7D80}\x{7D81}' + . '\x{7D83}\x{7D84}\x{7D85}\x{7D86}\x{7D87}\x{7D88}\x{7D89}\x{7D8A}\x{7D8B}' + . '\x{7D8C}\x{7D8D}\x{7D8E}\x{7D8F}\x{7D90}\x{7D91}\x{7D92}\x{7D93}\x{7D94}' + . '\x{7D96}\x{7D97}\x{7D99}\x{7D9B}\x{7D9C}\x{7D9D}\x{7D9E}\x{7D9F}\x{7DA0}' + . '\x{7DA1}\x{7DA2}\x{7DA3}\x{7DA5}\x{7DA6}\x{7DA7}\x{7DA9}\x{7DAA}\x{7DAB}' + . '\x{7DAC}\x{7DAD}\x{7DAE}\x{7DAF}\x{7DB0}\x{7DB1}\x{7DB2}\x{7DB3}\x{7DB4}' + . '\x{7DB5}\x{7DB6}\x{7DB7}\x{7DB8}\x{7DB9}\x{7DBA}\x{7DBB}\x{7DBC}\x{7DBD}' + . '\x{7DBE}\x{7DBF}\x{7DC0}\x{7DC1}\x{7DC2}\x{7DC3}\x{7DC4}\x{7DC5}\x{7DC6}' + . '\x{7DC7}\x{7DC8}\x{7DC9}\x{7DCA}\x{7DCB}\x{7DCC}\x{7DCE}\x{7DCF}\x{7DD0}' + . '\x{7DD1}\x{7DD2}\x{7DD4}\x{7DD5}\x{7DD6}\x{7DD7}\x{7DD8}\x{7DD9}\x{7DDA}' + . '\x{7DDB}\x{7DDD}\x{7DDE}\x{7DDF}\x{7DE0}\x{7DE1}\x{7DE2}\x{7DE3}\x{7DE6}' + . '\x{7DE7}\x{7DE8}\x{7DE9}\x{7DEA}\x{7DEC}\x{7DED}\x{7DEE}\x{7DEF}\x{7DF0}' + . '\x{7DF1}\x{7DF2}\x{7DF3}\x{7DF4}\x{7DF5}\x{7DF6}\x{7DF7}\x{7DF8}\x{7DF9}' + . '\x{7DFA}\x{7DFB}\x{7DFC}\x{7E00}\x{7E01}\x{7E02}\x{7E03}\x{7E04}\x{7E05}' + . '\x{7E06}\x{7E07}\x{7E08}\x{7E09}\x{7E0A}\x{7E0B}\x{7E0C}\x{7E0D}\x{7E0E}' + . '\x{7E0F}\x{7E10}\x{7E11}\x{7E12}\x{7E13}\x{7E14}\x{7E15}\x{7E16}\x{7E17}' + . '\x{7E19}\x{7E1A}\x{7E1B}\x{7E1C}\x{7E1D}\x{7E1E}\x{7E1F}\x{7E20}\x{7E21}' + . '\x{7E22}\x{7E23}\x{7E24}\x{7E25}\x{7E26}\x{7E27}\x{7E28}\x{7E29}\x{7E2A}' + . '\x{7E2B}\x{7E2C}\x{7E2D}\x{7E2E}\x{7E2F}\x{7E30}\x{7E31}\x{7E32}\x{7E33}' + . '\x{7E34}\x{7E35}\x{7E36}\x{7E37}\x{7E38}\x{7E39}\x{7E3A}\x{7E3B}\x{7E3C}' + . '\x{7E3D}\x{7E3E}\x{7E3F}\x{7E40}\x{7E41}\x{7E42}\x{7E43}\x{7E44}\x{7E45}' + . '\x{7E46}\x{7E47}\x{7E48}\x{7E49}\x{7E4C}\x{7E4D}\x{7E4E}\x{7E4F}\x{7E50}' + . '\x{7E51}\x{7E52}\x{7E53}\x{7E54}\x{7E55}\x{7E56}\x{7E57}\x{7E58}\x{7E59}' + . '\x{7E5A}\x{7E5C}\x{7E5D}\x{7E5E}\x{7E5F}\x{7E60}\x{7E61}\x{7E62}\x{7E63}' + . '\x{7E65}\x{7E66}\x{7E67}\x{7E68}\x{7E69}\x{7E6A}\x{7E6B}\x{7E6C}\x{7E6D}' + . '\x{7E6E}\x{7E6F}\x{7E70}\x{7E71}\x{7E72}\x{7E73}\x{7E74}\x{7E75}\x{7E76}' + . '\x{7E77}\x{7E78}\x{7E79}\x{7E7A}\x{7E7B}\x{7E7C}\x{7E7D}\x{7E7E}\x{7E7F}' + . '\x{7E80}\x{7E81}\x{7E82}\x{7E83}\x{7E84}\x{7E85}\x{7E86}\x{7E87}\x{7E88}' + . '\x{7E89}\x{7E8A}\x{7E8B}\x{7E8C}\x{7E8D}\x{7E8E}\x{7E8F}\x{7E90}\x{7E91}' + . '\x{7E92}\x{7E93}\x{7E94}\x{7E95}\x{7E96}\x{7E97}\x{7E98}\x{7E99}\x{7E9A}' + . '\x{7E9B}\x{7E9C}\x{7E9E}\x{7E9F}\x{7EA0}\x{7EA1}\x{7EA2}\x{7EA3}\x{7EA4}' + . '\x{7EA5}\x{7EA6}\x{7EA7}\x{7EA8}\x{7EA9}\x{7EAA}\x{7EAB}\x{7EAC}\x{7EAD}' + . '\x{7EAE}\x{7EAF}\x{7EB0}\x{7EB1}\x{7EB2}\x{7EB3}\x{7EB4}\x{7EB5}\x{7EB6}' + . '\x{7EB7}\x{7EB8}\x{7EB9}\x{7EBA}\x{7EBB}\x{7EBC}\x{7EBD}\x{7EBE}\x{7EBF}' + . '\x{7EC0}\x{7EC1}\x{7EC2}\x{7EC3}\x{7EC4}\x{7EC5}\x{7EC6}\x{7EC7}\x{7EC8}' + . '\x{7EC9}\x{7ECA}\x{7ECB}\x{7ECC}\x{7ECD}\x{7ECE}\x{7ECF}\x{7ED0}\x{7ED1}' + . '\x{7ED2}\x{7ED3}\x{7ED4}\x{7ED5}\x{7ED6}\x{7ED7}\x{7ED8}\x{7ED9}\x{7EDA}' + . '\x{7EDB}\x{7EDC}\x{7EDD}\x{7EDE}\x{7EDF}\x{7EE0}\x{7EE1}\x{7EE2}\x{7EE3}' + . '\x{7EE4}\x{7EE5}\x{7EE6}\x{7EE7}\x{7EE8}\x{7EE9}\x{7EEA}\x{7EEB}\x{7EEC}' + . '\x{7EED}\x{7EEE}\x{7EEF}\x{7EF0}\x{7EF1}\x{7EF2}\x{7EF3}\x{7EF4}\x{7EF5}' + . '\x{7EF6}\x{7EF7}\x{7EF8}\x{7EF9}\x{7EFA}\x{7EFB}\x{7EFC}\x{7EFD}\x{7EFE}' + . '\x{7EFF}\x{7F00}\x{7F01}\x{7F02}\x{7F03}\x{7F04}\x{7F05}\x{7F06}\x{7F07}' + . '\x{7F08}\x{7F09}\x{7F0A}\x{7F0B}\x{7F0C}\x{7F0D}\x{7F0E}\x{7F0F}\x{7F10}' + . '\x{7F11}\x{7F12}\x{7F13}\x{7F14}\x{7F15}\x{7F16}\x{7F17}\x{7F18}\x{7F19}' + . '\x{7F1A}\x{7F1B}\x{7F1C}\x{7F1D}\x{7F1E}\x{7F1F}\x{7F20}\x{7F21}\x{7F22}' + . '\x{7F23}\x{7F24}\x{7F25}\x{7F26}\x{7F27}\x{7F28}\x{7F29}\x{7F2A}\x{7F2B}' + . '\x{7F2C}\x{7F2D}\x{7F2E}\x{7F2F}\x{7F30}\x{7F31}\x{7F32}\x{7F33}\x{7F34}' + . '\x{7F35}\x{7F36}\x{7F37}\x{7F38}\x{7F39}\x{7F3A}\x{7F3D}\x{7F3E}\x{7F3F}' + . '\x{7F40}\x{7F42}\x{7F43}\x{7F44}\x{7F45}\x{7F47}\x{7F48}\x{7F49}\x{7F4A}' + . '\x{7F4B}\x{7F4C}\x{7F4D}\x{7F4E}\x{7F4F}\x{7F50}\x{7F51}\x{7F52}\x{7F53}' + . '\x{7F54}\x{7F55}\x{7F56}\x{7F57}\x{7F58}\x{7F5A}\x{7F5B}\x{7F5C}\x{7F5D}' + . '\x{7F5E}\x{7F5F}\x{7F60}\x{7F61}\x{7F62}\x{7F63}\x{7F64}\x{7F65}\x{7F66}' + . '\x{7F67}\x{7F68}\x{7F69}\x{7F6A}\x{7F6B}\x{7F6C}\x{7F6D}\x{7F6E}\x{7F6F}' + . '\x{7F70}\x{7F71}\x{7F72}\x{7F73}\x{7F74}\x{7F75}\x{7F76}\x{7F77}\x{7F78}' + . '\x{7F79}\x{7F7A}\x{7F7B}\x{7F7C}\x{7F7D}\x{7F7E}\x{7F7F}\x{7F80}\x{7F81}' + . '\x{7F82}\x{7F83}\x{7F85}\x{7F86}\x{7F87}\x{7F88}\x{7F89}\x{7F8A}\x{7F8B}' + . '\x{7F8C}\x{7F8D}\x{7F8E}\x{7F8F}\x{7F91}\x{7F92}\x{7F93}\x{7F94}\x{7F95}' + . '\x{7F96}\x{7F98}\x{7F9A}\x{7F9B}\x{7F9C}\x{7F9D}\x{7F9E}\x{7F9F}\x{7FA0}' + . '\x{7FA1}\x{7FA2}\x{7FA3}\x{7FA4}\x{7FA5}\x{7FA6}\x{7FA7}\x{7FA8}\x{7FA9}' + . '\x{7FAA}\x{7FAB}\x{7FAC}\x{7FAD}\x{7FAE}\x{7FAF}\x{7FB0}\x{7FB1}\x{7FB2}' + . '\x{7FB3}\x{7FB5}\x{7FB6}\x{7FB7}\x{7FB8}\x{7FB9}\x{7FBA}\x{7FBB}\x{7FBC}' + . '\x{7FBD}\x{7FBE}\x{7FBF}\x{7FC0}\x{7FC1}\x{7FC2}\x{7FC3}\x{7FC4}\x{7FC5}' + . '\x{7FC6}\x{7FC7}\x{7FC8}\x{7FC9}\x{7FCA}\x{7FCB}\x{7FCC}\x{7FCD}\x{7FCE}' + . '\x{7FCF}\x{7FD0}\x{7FD1}\x{7FD2}\x{7FD3}\x{7FD4}\x{7FD5}\x{7FD7}\x{7FD8}' + . '\x{7FD9}\x{7FDA}\x{7FDB}\x{7FDC}\x{7FDE}\x{7FDF}\x{7FE0}\x{7FE1}\x{7FE2}' + . '\x{7FE3}\x{7FE5}\x{7FE6}\x{7FE7}\x{7FE8}\x{7FE9}\x{7FEA}\x{7FEB}\x{7FEC}' + . '\x{7FED}\x{7FEE}\x{7FEF}\x{7FF0}\x{7FF1}\x{7FF2}\x{7FF3}\x{7FF4}\x{7FF5}' + . '\x{7FF6}\x{7FF7}\x{7FF8}\x{7FF9}\x{7FFA}\x{7FFB}\x{7FFC}\x{7FFD}\x{7FFE}' + . '\x{7FFF}\x{8000}\x{8001}\x{8002}\x{8003}\x{8004}\x{8005}\x{8006}\x{8007}' + . '\x{8008}\x{8009}\x{800B}\x{800C}\x{800D}\x{800E}\x{800F}\x{8010}\x{8011}' + . '\x{8012}\x{8013}\x{8014}\x{8015}\x{8016}\x{8017}\x{8018}\x{8019}\x{801A}' + . '\x{801B}\x{801C}\x{801D}\x{801E}\x{801F}\x{8020}\x{8021}\x{8022}\x{8023}' + . '\x{8024}\x{8025}\x{8026}\x{8027}\x{8028}\x{8029}\x{802A}\x{802B}\x{802C}' + . '\x{802D}\x{802E}\x{8030}\x{8031}\x{8032}\x{8033}\x{8034}\x{8035}\x{8036}' + . '\x{8037}\x{8038}\x{8039}\x{803A}\x{803B}\x{803D}\x{803E}\x{803F}\x{8041}' + . '\x{8042}\x{8043}\x{8044}\x{8045}\x{8046}\x{8047}\x{8048}\x{8049}\x{804A}' + . '\x{804B}\x{804C}\x{804D}\x{804E}\x{804F}\x{8050}\x{8051}\x{8052}\x{8053}' + . '\x{8054}\x{8055}\x{8056}\x{8057}\x{8058}\x{8059}\x{805A}\x{805B}\x{805C}' + . '\x{805D}\x{805E}\x{805F}\x{8060}\x{8061}\x{8062}\x{8063}\x{8064}\x{8065}' + . '\x{8067}\x{8068}\x{8069}\x{806A}\x{806B}\x{806C}\x{806D}\x{806E}\x{806F}' + . '\x{8070}\x{8071}\x{8072}\x{8073}\x{8074}\x{8075}\x{8076}\x{8077}\x{8078}' + . '\x{8079}\x{807A}\x{807B}\x{807C}\x{807D}\x{807E}\x{807F}\x{8080}\x{8081}' + . '\x{8082}\x{8083}\x{8084}\x{8085}\x{8086}\x{8087}\x{8089}\x{808A}\x{808B}' + . '\x{808C}\x{808D}\x{808F}\x{8090}\x{8091}\x{8092}\x{8093}\x{8095}\x{8096}' + . '\x{8097}\x{8098}\x{8099}\x{809A}\x{809B}\x{809C}\x{809D}\x{809E}\x{809F}' + . '\x{80A0}\x{80A1}\x{80A2}\x{80A3}\x{80A4}\x{80A5}\x{80A9}\x{80AA}\x{80AB}' + . '\x{80AD}\x{80AE}\x{80AF}\x{80B0}\x{80B1}\x{80B2}\x{80B4}\x{80B5}\x{80B6}' + . '\x{80B7}\x{80B8}\x{80BA}\x{80BB}\x{80BC}\x{80BD}\x{80BE}\x{80BF}\x{80C0}' + . '\x{80C1}\x{80C2}\x{80C3}\x{80C4}\x{80C5}\x{80C6}\x{80C7}\x{80C8}\x{80C9}' + . '\x{80CA}\x{80CB}\x{80CC}\x{80CD}\x{80CE}\x{80CF}\x{80D0}\x{80D1}\x{80D2}' + . '\x{80D3}\x{80D4}\x{80D5}\x{80D6}\x{80D7}\x{80D8}\x{80D9}\x{80DA}\x{80DB}' + . '\x{80DC}\x{80DD}\x{80DE}\x{80E0}\x{80E1}\x{80E2}\x{80E3}\x{80E4}\x{80E5}' + . '\x{80E6}\x{80E7}\x{80E8}\x{80E9}\x{80EA}\x{80EB}\x{80EC}\x{80ED}\x{80EE}' + . '\x{80EF}\x{80F0}\x{80F1}\x{80F2}\x{80F3}\x{80F4}\x{80F5}\x{80F6}\x{80F7}' + . '\x{80F8}\x{80F9}\x{80FA}\x{80FB}\x{80FC}\x{80FD}\x{80FE}\x{80FF}\x{8100}' + . '\x{8101}\x{8102}\x{8105}\x{8106}\x{8107}\x{8108}\x{8109}\x{810A}\x{810B}' + . '\x{810C}\x{810D}\x{810E}\x{810F}\x{8110}\x{8111}\x{8112}\x{8113}\x{8114}' + . '\x{8115}\x{8116}\x{8118}\x{8119}\x{811A}\x{811B}\x{811C}\x{811D}\x{811E}' + . '\x{811F}\x{8120}\x{8121}\x{8122}\x{8123}\x{8124}\x{8125}\x{8126}\x{8127}' + . '\x{8128}\x{8129}\x{812A}\x{812B}\x{812C}\x{812D}\x{812E}\x{812F}\x{8130}' + . '\x{8131}\x{8132}\x{8136}\x{8137}\x{8138}\x{8139}\x{813A}\x{813B}\x{813C}' + . '\x{813D}\x{813E}\x{813F}\x{8140}\x{8141}\x{8142}\x{8143}\x{8144}\x{8145}' + . '\x{8146}\x{8147}\x{8148}\x{8149}\x{814A}\x{814B}\x{814C}\x{814D}\x{814E}' + . '\x{814F}\x{8150}\x{8151}\x{8152}\x{8153}\x{8154}\x{8155}\x{8156}\x{8157}' + . '\x{8158}\x{8159}\x{815A}\x{815B}\x{815C}\x{815D}\x{815E}\x{8160}\x{8161}' + . '\x{8162}\x{8163}\x{8164}\x{8165}\x{8166}\x{8167}\x{8168}\x{8169}\x{816A}' + . '\x{816B}\x{816C}\x{816D}\x{816E}\x{816F}\x{8170}\x{8171}\x{8172}\x{8173}' + . '\x{8174}\x{8175}\x{8176}\x{8177}\x{8178}\x{8179}\x{817A}\x{817B}\x{817C}' + . '\x{817D}\x{817E}\x{817F}\x{8180}\x{8181}\x{8182}\x{8183}\x{8185}\x{8186}' + . '\x{8187}\x{8188}\x{8189}\x{818A}\x{818B}\x{818C}\x{818D}\x{818E}\x{818F}' + . '\x{8191}\x{8192}\x{8193}\x{8194}\x{8195}\x{8197}\x{8198}\x{8199}\x{819A}' + . '\x{819B}\x{819C}\x{819D}\x{819E}\x{819F}\x{81A0}\x{81A1}\x{81A2}\x{81A3}' + . '\x{81A4}\x{81A5}\x{81A6}\x{81A7}\x{81A8}\x{81A9}\x{81AA}\x{81AB}\x{81AC}' + . '\x{81AD}\x{81AE}\x{81AF}\x{81B0}\x{81B1}\x{81B2}\x{81B3}\x{81B4}\x{81B5}' + . '\x{81B6}\x{81B7}\x{81B8}\x{81B9}\x{81BA}\x{81BB}\x{81BC}\x{81BD}\x{81BE}' + . '\x{81BF}\x{81C0}\x{81C1}\x{81C2}\x{81C3}\x{81C4}\x{81C5}\x{81C6}\x{81C7}' + . '\x{81C8}\x{81C9}\x{81CA}\x{81CC}\x{81CD}\x{81CE}\x{81CF}\x{81D0}\x{81D1}' + . '\x{81D2}\x{81D4}\x{81D5}\x{81D6}\x{81D7}\x{81D8}\x{81D9}\x{81DA}\x{81DB}' + . '\x{81DC}\x{81DD}\x{81DE}\x{81DF}\x{81E0}\x{81E1}\x{81E2}\x{81E3}\x{81E5}' + . '\x{81E6}\x{81E7}\x{81E8}\x{81E9}\x{81EA}\x{81EB}\x{81EC}\x{81ED}\x{81EE}' + . '\x{81F1}\x{81F2}\x{81F3}\x{81F4}\x{81F5}\x{81F6}\x{81F7}\x{81F8}\x{81F9}' + . '\x{81FA}\x{81FB}\x{81FC}\x{81FD}\x{81FE}\x{81FF}\x{8200}\x{8201}\x{8202}' + . '\x{8203}\x{8204}\x{8205}\x{8206}\x{8207}\x{8208}\x{8209}\x{820A}\x{820B}' + . '\x{820C}\x{820D}\x{820E}\x{820F}\x{8210}\x{8211}\x{8212}\x{8214}\x{8215}' + . '\x{8216}\x{8218}\x{8219}\x{821A}\x{821B}\x{821C}\x{821D}\x{821E}\x{821F}' + . '\x{8220}\x{8221}\x{8222}\x{8223}\x{8225}\x{8226}\x{8227}\x{8228}\x{8229}' + . '\x{822A}\x{822B}\x{822C}\x{822D}\x{822F}\x{8230}\x{8231}\x{8232}\x{8233}' + . '\x{8234}\x{8235}\x{8236}\x{8237}\x{8238}\x{8239}\x{823A}\x{823B}\x{823C}' + . '\x{823D}\x{823E}\x{823F}\x{8240}\x{8242}\x{8243}\x{8244}\x{8245}\x{8246}' + . '\x{8247}\x{8248}\x{8249}\x{824A}\x{824B}\x{824C}\x{824D}\x{824E}\x{824F}' + . '\x{8250}\x{8251}\x{8252}\x{8253}\x{8254}\x{8255}\x{8256}\x{8257}\x{8258}' + . '\x{8259}\x{825A}\x{825B}\x{825C}\x{825D}\x{825E}\x{825F}\x{8260}\x{8261}' + . '\x{8263}\x{8264}\x{8266}\x{8267}\x{8268}\x{8269}\x{826A}\x{826B}\x{826C}' + . '\x{826D}\x{826E}\x{826F}\x{8270}\x{8271}\x{8272}\x{8273}\x{8274}\x{8275}' + . '\x{8276}\x{8277}\x{8278}\x{8279}\x{827A}\x{827B}\x{827C}\x{827D}\x{827E}' + . '\x{827F}\x{8280}\x{8281}\x{8282}\x{8283}\x{8284}\x{8285}\x{8286}\x{8287}' + . '\x{8288}\x{8289}\x{828A}\x{828B}\x{828D}\x{828E}\x{828F}\x{8290}\x{8291}' + . '\x{8292}\x{8293}\x{8294}\x{8295}\x{8296}\x{8297}\x{8298}\x{8299}\x{829A}' + . '\x{829B}\x{829C}\x{829D}\x{829E}\x{829F}\x{82A0}\x{82A1}\x{82A2}\x{82A3}' + . '\x{82A4}\x{82A5}\x{82A6}\x{82A7}\x{82A8}\x{82A9}\x{82AA}\x{82AB}\x{82AC}' + . '\x{82AD}\x{82AE}\x{82AF}\x{82B0}\x{82B1}\x{82B3}\x{82B4}\x{82B5}\x{82B6}' + . '\x{82B7}\x{82B8}\x{82B9}\x{82BA}\x{82BB}\x{82BC}\x{82BD}\x{82BE}\x{82BF}' + . '\x{82C0}\x{82C1}\x{82C2}\x{82C3}\x{82C4}\x{82C5}\x{82C6}\x{82C7}\x{82C8}' + . '\x{82C9}\x{82CA}\x{82CB}\x{82CC}\x{82CD}\x{82CE}\x{82CF}\x{82D0}\x{82D1}' + . '\x{82D2}\x{82D3}\x{82D4}\x{82D5}\x{82D6}\x{82D7}\x{82D8}\x{82D9}\x{82DA}' + . '\x{82DB}\x{82DC}\x{82DD}\x{82DE}\x{82DF}\x{82E0}\x{82E1}\x{82E3}\x{82E4}' + . '\x{82E5}\x{82E6}\x{82E7}\x{82E8}\x{82E9}\x{82EA}\x{82EB}\x{82EC}\x{82ED}' + . '\x{82EE}\x{82EF}\x{82F0}\x{82F1}\x{82F2}\x{82F3}\x{82F4}\x{82F5}\x{82F6}' + . '\x{82F7}\x{82F8}\x{82F9}\x{82FA}\x{82FB}\x{82FD}\x{82FE}\x{82FF}\x{8300}' + . '\x{8301}\x{8302}\x{8303}\x{8304}\x{8305}\x{8306}\x{8307}\x{8308}\x{8309}' + . '\x{830B}\x{830C}\x{830D}\x{830E}\x{830F}\x{8311}\x{8312}\x{8313}\x{8314}' + . '\x{8315}\x{8316}\x{8317}\x{8318}\x{8319}\x{831A}\x{831B}\x{831C}\x{831D}' + . '\x{831E}\x{831F}\x{8320}\x{8321}\x{8322}\x{8323}\x{8324}\x{8325}\x{8326}' + . '\x{8327}\x{8328}\x{8329}\x{832A}\x{832B}\x{832C}\x{832D}\x{832E}\x{832F}' + . '\x{8331}\x{8332}\x{8333}\x{8334}\x{8335}\x{8336}\x{8337}\x{8338}\x{8339}' + . '\x{833A}\x{833B}\x{833C}\x{833D}\x{833E}\x{833F}\x{8340}\x{8341}\x{8342}' + . '\x{8343}\x{8344}\x{8345}\x{8346}\x{8347}\x{8348}\x{8349}\x{834A}\x{834B}' + . '\x{834C}\x{834D}\x{834E}\x{834F}\x{8350}\x{8351}\x{8352}\x{8353}\x{8354}' + . '\x{8356}\x{8357}\x{8358}\x{8359}\x{835A}\x{835B}\x{835C}\x{835D}\x{835E}' + . '\x{835F}\x{8360}\x{8361}\x{8362}\x{8363}\x{8364}\x{8365}\x{8366}\x{8367}' + . '\x{8368}\x{8369}\x{836A}\x{836B}\x{836C}\x{836D}\x{836E}\x{836F}\x{8370}' + . '\x{8371}\x{8372}\x{8373}\x{8374}\x{8375}\x{8376}\x{8377}\x{8378}\x{8379}' + . '\x{837A}\x{837B}\x{837C}\x{837D}\x{837E}\x{837F}\x{8380}\x{8381}\x{8382}' + . '\x{8383}\x{8384}\x{8385}\x{8386}\x{8387}\x{8388}\x{8389}\x{838A}\x{838B}' + . '\x{838C}\x{838D}\x{838E}\x{838F}\x{8390}\x{8391}\x{8392}\x{8393}\x{8394}' + . '\x{8395}\x{8396}\x{8397}\x{8398}\x{8399}\x{839A}\x{839B}\x{839C}\x{839D}' + . '\x{839E}\x{83A0}\x{83A1}\x{83A2}\x{83A3}\x{83A4}\x{83A5}\x{83A6}\x{83A7}' + . '\x{83A8}\x{83A9}\x{83AA}\x{83AB}\x{83AC}\x{83AD}\x{83AE}\x{83AF}\x{83B0}' + . '\x{83B1}\x{83B2}\x{83B3}\x{83B4}\x{83B6}\x{83B7}\x{83B8}\x{83B9}\x{83BA}' + . '\x{83BB}\x{83BC}\x{83BD}\x{83BF}\x{83C0}\x{83C1}\x{83C2}\x{83C3}\x{83C4}' + . '\x{83C5}\x{83C6}\x{83C7}\x{83C8}\x{83C9}\x{83CA}\x{83CB}\x{83CC}\x{83CD}' + . '\x{83CE}\x{83CF}\x{83D0}\x{83D1}\x{83D2}\x{83D3}\x{83D4}\x{83D5}\x{83D6}' + . '\x{83D7}\x{83D8}\x{83D9}\x{83DA}\x{83DB}\x{83DC}\x{83DD}\x{83DE}\x{83DF}' + . '\x{83E0}\x{83E1}\x{83E2}\x{83E3}\x{83E4}\x{83E5}\x{83E7}\x{83E8}\x{83E9}' + . '\x{83EA}\x{83EB}\x{83EC}\x{83EE}\x{83EF}\x{83F0}\x{83F1}\x{83F2}\x{83F3}' + . '\x{83F4}\x{83F5}\x{83F6}\x{83F7}\x{83F8}\x{83F9}\x{83FA}\x{83FB}\x{83FC}' + . '\x{83FD}\x{83FE}\x{83FF}\x{8400}\x{8401}\x{8402}\x{8403}\x{8404}\x{8405}' + . '\x{8406}\x{8407}\x{8408}\x{8409}\x{840A}\x{840B}\x{840C}\x{840D}\x{840E}' + . '\x{840F}\x{8410}\x{8411}\x{8412}\x{8413}\x{8415}\x{8418}\x{8419}\x{841A}' + . '\x{841B}\x{841C}\x{841D}\x{841E}\x{8421}\x{8422}\x{8423}\x{8424}\x{8425}' + . '\x{8426}\x{8427}\x{8428}\x{8429}\x{842A}\x{842B}\x{842C}\x{842D}\x{842E}' + . '\x{842F}\x{8430}\x{8431}\x{8432}\x{8433}\x{8434}\x{8435}\x{8436}\x{8437}' + . '\x{8438}\x{8439}\x{843A}\x{843B}\x{843C}\x{843D}\x{843E}\x{843F}\x{8440}' + . '\x{8441}\x{8442}\x{8443}\x{8444}\x{8445}\x{8446}\x{8447}\x{8448}\x{8449}' + . '\x{844A}\x{844B}\x{844C}\x{844D}\x{844E}\x{844F}\x{8450}\x{8451}\x{8452}' + . '\x{8453}\x{8454}\x{8455}\x{8456}\x{8457}\x{8459}\x{845A}\x{845B}\x{845C}' + . '\x{845D}\x{845E}\x{845F}\x{8460}\x{8461}\x{8462}\x{8463}\x{8464}\x{8465}' + . '\x{8466}\x{8467}\x{8468}\x{8469}\x{846A}\x{846B}\x{846C}\x{846D}\x{846E}' + . '\x{846F}\x{8470}\x{8471}\x{8472}\x{8473}\x{8474}\x{8475}\x{8476}\x{8477}' + . '\x{8478}\x{8479}\x{847A}\x{847B}\x{847C}\x{847D}\x{847E}\x{847F}\x{8480}' + . '\x{8481}\x{8482}\x{8484}\x{8485}\x{8486}\x{8487}\x{8488}\x{8489}\x{848A}' + . '\x{848B}\x{848C}\x{848D}\x{848E}\x{848F}\x{8490}\x{8491}\x{8492}\x{8493}' + . '\x{8494}\x{8496}\x{8497}\x{8498}\x{8499}\x{849A}\x{849B}\x{849C}\x{849D}' + . '\x{849E}\x{849F}\x{84A0}\x{84A1}\x{84A2}\x{84A3}\x{84A4}\x{84A5}\x{84A6}' + . '\x{84A7}\x{84A8}\x{84A9}\x{84AA}\x{84AB}\x{84AC}\x{84AE}\x{84AF}\x{84B0}' + . '\x{84B1}\x{84B2}\x{84B3}\x{84B4}\x{84B5}\x{84B6}\x{84B8}\x{84B9}\x{84BA}' + . '\x{84BB}\x{84BC}\x{84BD}\x{84BE}\x{84BF}\x{84C0}\x{84C1}\x{84C2}\x{84C4}' + . '\x{84C5}\x{84C6}\x{84C7}\x{84C8}\x{84C9}\x{84CA}\x{84CB}\x{84CC}\x{84CD}' + . '\x{84CE}\x{84CF}\x{84D0}\x{84D1}\x{84D2}\x{84D3}\x{84D4}\x{84D5}\x{84D6}' + . '\x{84D7}\x{84D8}\x{84D9}\x{84DB}\x{84DC}\x{84DD}\x{84DE}\x{84DF}\x{84E0}' + . '\x{84E1}\x{84E2}\x{84E3}\x{84E4}\x{84E5}\x{84E6}\x{84E7}\x{84E8}\x{84E9}' + . '\x{84EA}\x{84EB}\x{84EC}\x{84EE}\x{84EF}\x{84F0}\x{84F1}\x{84F2}\x{84F3}' + . '\x{84F4}\x{84F5}\x{84F6}\x{84F7}\x{84F8}\x{84F9}\x{84FA}\x{84FB}\x{84FC}' + . '\x{84FD}\x{84FE}\x{84FF}\x{8500}\x{8501}\x{8502}\x{8503}\x{8504}\x{8506}' + . '\x{8507}\x{8508}\x{8509}\x{850A}\x{850B}\x{850C}\x{850D}\x{850E}\x{850F}' + . '\x{8511}\x{8512}\x{8513}\x{8514}\x{8515}\x{8516}\x{8517}\x{8518}\x{8519}' + . '\x{851A}\x{851B}\x{851C}\x{851D}\x{851E}\x{851F}\x{8520}\x{8521}\x{8522}' + . '\x{8523}\x{8524}\x{8525}\x{8526}\x{8527}\x{8528}\x{8529}\x{852A}\x{852B}' + . '\x{852C}\x{852D}\x{852E}\x{852F}\x{8530}\x{8531}\x{8534}\x{8535}\x{8536}' + . '\x{8537}\x{8538}\x{8539}\x{853A}\x{853B}\x{853C}\x{853D}\x{853E}\x{853F}' + . '\x{8540}\x{8541}\x{8542}\x{8543}\x{8544}\x{8545}\x{8546}\x{8547}\x{8548}' + . '\x{8549}\x{854A}\x{854B}\x{854D}\x{854E}\x{854F}\x{8551}\x{8552}\x{8553}' + . '\x{8554}\x{8555}\x{8556}\x{8557}\x{8558}\x{8559}\x{855A}\x{855B}\x{855C}' + . '\x{855D}\x{855E}\x{855F}\x{8560}\x{8561}\x{8562}\x{8563}\x{8564}\x{8565}' + . '\x{8566}\x{8567}\x{8568}\x{8569}\x{856A}\x{856B}\x{856C}\x{856D}\x{856E}' + . '\x{856F}\x{8570}\x{8571}\x{8572}\x{8573}\x{8574}\x{8575}\x{8576}\x{8577}' + . '\x{8578}\x{8579}\x{857A}\x{857B}\x{857C}\x{857D}\x{857E}\x{8580}\x{8581}' + . '\x{8582}\x{8583}\x{8584}\x{8585}\x{8586}\x{8587}\x{8588}\x{8589}\x{858A}' + . '\x{858B}\x{858C}\x{858D}\x{858E}\x{858F}\x{8590}\x{8591}\x{8592}\x{8594}' + . '\x{8595}\x{8596}\x{8598}\x{8599}\x{859A}\x{859B}\x{859C}\x{859D}\x{859E}' + . '\x{859F}\x{85A0}\x{85A1}\x{85A2}\x{85A3}\x{85A4}\x{85A5}\x{85A6}\x{85A7}' + . '\x{85A8}\x{85A9}\x{85AA}\x{85AB}\x{85AC}\x{85AD}\x{85AE}\x{85AF}\x{85B0}' + . '\x{85B1}\x{85B3}\x{85B4}\x{85B5}\x{85B6}\x{85B7}\x{85B8}\x{85B9}\x{85BA}' + . '\x{85BC}\x{85BD}\x{85BE}\x{85BF}\x{85C0}\x{85C1}\x{85C2}\x{85C3}\x{85C4}' + . '\x{85C5}\x{85C6}\x{85C7}\x{85C8}\x{85C9}\x{85CA}\x{85CB}\x{85CD}\x{85CE}' + . '\x{85CF}\x{85D0}\x{85D1}\x{85D2}\x{85D3}\x{85D4}\x{85D5}\x{85D6}\x{85D7}' + . '\x{85D8}\x{85D9}\x{85DA}\x{85DB}\x{85DC}\x{85DD}\x{85DE}\x{85DF}\x{85E0}' + . '\x{85E1}\x{85E2}\x{85E3}\x{85E4}\x{85E5}\x{85E6}\x{85E7}\x{85E8}\x{85E9}' + . '\x{85EA}\x{85EB}\x{85EC}\x{85ED}\x{85EF}\x{85F0}\x{85F1}\x{85F2}\x{85F4}' + . '\x{85F5}\x{85F6}\x{85F7}\x{85F8}\x{85F9}\x{85FA}\x{85FB}\x{85FD}\x{85FE}' + . '\x{85FF}\x{8600}\x{8601}\x{8602}\x{8604}\x{8605}\x{8606}\x{8607}\x{8608}' + . '\x{8609}\x{860A}\x{860B}\x{860C}\x{860F}\x{8611}\x{8612}\x{8613}\x{8614}' + . '\x{8616}\x{8617}\x{8618}\x{8619}\x{861A}\x{861B}\x{861C}\x{861E}\x{861F}' + . '\x{8620}\x{8621}\x{8622}\x{8623}\x{8624}\x{8625}\x{8626}\x{8627}\x{8628}' + . '\x{8629}\x{862A}\x{862B}\x{862C}\x{862D}\x{862E}\x{862F}\x{8630}\x{8631}' + . '\x{8632}\x{8633}\x{8634}\x{8635}\x{8636}\x{8638}\x{8639}\x{863A}\x{863B}' + . '\x{863C}\x{863D}\x{863E}\x{863F}\x{8640}\x{8641}\x{8642}\x{8643}\x{8644}' + . '\x{8645}\x{8646}\x{8647}\x{8648}\x{8649}\x{864A}\x{864B}\x{864C}\x{864D}' + . '\x{864E}\x{864F}\x{8650}\x{8651}\x{8652}\x{8653}\x{8654}\x{8655}\x{8656}' + . '\x{8658}\x{8659}\x{865A}\x{865B}\x{865C}\x{865D}\x{865E}\x{865F}\x{8660}' + . '\x{8661}\x{8662}\x{8663}\x{8664}\x{8665}\x{8666}\x{8667}\x{8668}\x{8669}' + . '\x{866A}\x{866B}\x{866C}\x{866D}\x{866E}\x{866F}\x{8670}\x{8671}\x{8672}' + . '\x{8673}\x{8674}\x{8676}\x{8677}\x{8678}\x{8679}\x{867A}\x{867B}\x{867C}' + . '\x{867D}\x{867E}\x{867F}\x{8680}\x{8681}\x{8682}\x{8683}\x{8684}\x{8685}' + . '\x{8686}\x{8687}\x{8688}\x{868A}\x{868B}\x{868C}\x{868D}\x{868E}\x{868F}' + . '\x{8690}\x{8691}\x{8693}\x{8694}\x{8695}\x{8696}\x{8697}\x{8698}\x{8699}' + . '\x{869A}\x{869B}\x{869C}\x{869D}\x{869E}\x{869F}\x{86A1}\x{86A2}\x{86A3}' + . '\x{86A4}\x{86A5}\x{86A7}\x{86A8}\x{86A9}\x{86AA}\x{86AB}\x{86AC}\x{86AD}' + . '\x{86AE}\x{86AF}\x{86B0}\x{86B1}\x{86B2}\x{86B3}\x{86B4}\x{86B5}\x{86B6}' + . '\x{86B7}\x{86B8}\x{86B9}\x{86BA}\x{86BB}\x{86BC}\x{86BD}\x{86BE}\x{86BF}' + . '\x{86C0}\x{86C1}\x{86C2}\x{86C3}\x{86C4}\x{86C5}\x{86C6}\x{86C7}\x{86C8}' + . '\x{86C9}\x{86CA}\x{86CB}\x{86CC}\x{86CE}\x{86CF}\x{86D0}\x{86D1}\x{86D2}' + . '\x{86D3}\x{86D4}\x{86D6}\x{86D7}\x{86D8}\x{86D9}\x{86DA}\x{86DB}\x{86DC}' + . '\x{86DD}\x{86DE}\x{86DF}\x{86E1}\x{86E2}\x{86E3}\x{86E4}\x{86E5}\x{86E6}' + . '\x{86E8}\x{86E9}\x{86EA}\x{86EB}\x{86EC}\x{86ED}\x{86EE}\x{86EF}\x{86F0}' + . '\x{86F1}\x{86F2}\x{86F3}\x{86F4}\x{86F5}\x{86F6}\x{86F7}\x{86F8}\x{86F9}' + . '\x{86FA}\x{86FB}\x{86FC}\x{86FE}\x{86FF}\x{8700}\x{8701}\x{8702}\x{8703}' + . '\x{8704}\x{8705}\x{8706}\x{8707}\x{8708}\x{8709}\x{870A}\x{870B}\x{870C}' + . '\x{870D}\x{870E}\x{870F}\x{8710}\x{8711}\x{8712}\x{8713}\x{8714}\x{8715}' + . '\x{8716}\x{8717}\x{8718}\x{8719}\x{871A}\x{871B}\x{871C}\x{871E}\x{871F}' + . '\x{8720}\x{8721}\x{8722}\x{8723}\x{8724}\x{8725}\x{8726}\x{8727}\x{8728}' + . '\x{8729}\x{872A}\x{872B}\x{872C}\x{872D}\x{872E}\x{8730}\x{8731}\x{8732}' + . '\x{8733}\x{8734}\x{8735}\x{8736}\x{8737}\x{8738}\x{8739}\x{873A}\x{873B}' + . '\x{873C}\x{873E}\x{873F}\x{8740}\x{8741}\x{8742}\x{8743}\x{8744}\x{8746}' + . '\x{8747}\x{8748}\x{8749}\x{874A}\x{874C}\x{874D}\x{874E}\x{874F}\x{8750}' + . '\x{8751}\x{8752}\x{8753}\x{8754}\x{8755}\x{8756}\x{8757}\x{8758}\x{8759}' + . '\x{875A}\x{875B}\x{875C}\x{875D}\x{875E}\x{875F}\x{8760}\x{8761}\x{8762}' + . '\x{8763}\x{8764}\x{8765}\x{8766}\x{8767}\x{8768}\x{8769}\x{876A}\x{876B}' + . '\x{876C}\x{876D}\x{876E}\x{876F}\x{8770}\x{8772}\x{8773}\x{8774}\x{8775}' + . '\x{8776}\x{8777}\x{8778}\x{8779}\x{877A}\x{877B}\x{877C}\x{877D}\x{877E}' + . '\x{8780}\x{8781}\x{8782}\x{8783}\x{8784}\x{8785}\x{8786}\x{8787}\x{8788}' + . '\x{8789}\x{878A}\x{878B}\x{878C}\x{878D}\x{878F}\x{8790}\x{8791}\x{8792}' + . '\x{8793}\x{8794}\x{8795}\x{8796}\x{8797}\x{8798}\x{879A}\x{879B}\x{879C}' + . '\x{879D}\x{879E}\x{879F}\x{87A0}\x{87A1}\x{87A2}\x{87A3}\x{87A4}\x{87A5}' + . '\x{87A6}\x{87A7}\x{87A8}\x{87A9}\x{87AA}\x{87AB}\x{87AC}\x{87AD}\x{87AE}' + . '\x{87AF}\x{87B0}\x{87B1}\x{87B2}\x{87B3}\x{87B4}\x{87B5}\x{87B6}\x{87B7}' + . '\x{87B8}\x{87B9}\x{87BA}\x{87BB}\x{87BC}\x{87BD}\x{87BE}\x{87BF}\x{87C0}' + . '\x{87C1}\x{87C2}\x{87C3}\x{87C4}\x{87C5}\x{87C6}\x{87C7}\x{87C8}\x{87C9}' + . '\x{87CA}\x{87CB}\x{87CC}\x{87CD}\x{87CE}\x{87CF}\x{87D0}\x{87D1}\x{87D2}' + . '\x{87D3}\x{87D4}\x{87D5}\x{87D6}\x{87D7}\x{87D8}\x{87D9}\x{87DB}\x{87DC}' + . '\x{87DD}\x{87DE}\x{87DF}\x{87E0}\x{87E1}\x{87E2}\x{87E3}\x{87E4}\x{87E5}' + . '\x{87E6}\x{87E7}\x{87E8}\x{87E9}\x{87EA}\x{87EB}\x{87EC}\x{87ED}\x{87EE}' + . '\x{87EF}\x{87F1}\x{87F2}\x{87F3}\x{87F4}\x{87F5}\x{87F6}\x{87F7}\x{87F8}' + . '\x{87F9}\x{87FA}\x{87FB}\x{87FC}\x{87FD}\x{87FE}\x{87FF}\x{8800}\x{8801}' + . '\x{8802}\x{8803}\x{8804}\x{8805}\x{8806}\x{8808}\x{8809}\x{880A}\x{880B}' + . '\x{880C}\x{880D}\x{880E}\x{880F}\x{8810}\x{8811}\x{8813}\x{8814}\x{8815}' + . '\x{8816}\x{8817}\x{8818}\x{8819}\x{881A}\x{881B}\x{881C}\x{881D}\x{881E}' + . '\x{881F}\x{8820}\x{8821}\x{8822}\x{8823}\x{8824}\x{8825}\x{8826}\x{8827}' + . '\x{8828}\x{8829}\x{882A}\x{882B}\x{882C}\x{882E}\x{882F}\x{8830}\x{8831}' + . '\x{8832}\x{8833}\x{8834}\x{8835}\x{8836}\x{8837}\x{8838}\x{8839}\x{883B}' + . '\x{883C}\x{883D}\x{883E}\x{883F}\x{8840}\x{8841}\x{8842}\x{8843}\x{8844}' + . '\x{8845}\x{8846}\x{8848}\x{8849}\x{884A}\x{884B}\x{884C}\x{884D}\x{884E}' + . '\x{884F}\x{8850}\x{8851}\x{8852}\x{8853}\x{8854}\x{8855}\x{8856}\x{8857}' + . '\x{8859}\x{885A}\x{885B}\x{885D}\x{885E}\x{8860}\x{8861}\x{8862}\x{8863}' + . '\x{8864}\x{8865}\x{8866}\x{8867}\x{8868}\x{8869}\x{886A}\x{886B}\x{886C}' + . '\x{886D}\x{886E}\x{886F}\x{8870}\x{8871}\x{8872}\x{8873}\x{8874}\x{8875}' + . '\x{8876}\x{8877}\x{8878}\x{8879}\x{887B}\x{887C}\x{887D}\x{887E}\x{887F}' + . '\x{8880}\x{8881}\x{8882}\x{8883}\x{8884}\x{8885}\x{8886}\x{8887}\x{8888}' + . '\x{8889}\x{888A}\x{888B}\x{888C}\x{888D}\x{888E}\x{888F}\x{8890}\x{8891}' + . '\x{8892}\x{8893}\x{8894}\x{8895}\x{8896}\x{8897}\x{8898}\x{8899}\x{889A}' + . '\x{889B}\x{889C}\x{889D}\x{889E}\x{889F}\x{88A0}\x{88A1}\x{88A2}\x{88A3}' + . '\x{88A4}\x{88A5}\x{88A6}\x{88A7}\x{88A8}\x{88A9}\x{88AA}\x{88AB}\x{88AC}' + . '\x{88AD}\x{88AE}\x{88AF}\x{88B0}\x{88B1}\x{88B2}\x{88B3}\x{88B4}\x{88B6}' + . '\x{88B7}\x{88B8}\x{88B9}\x{88BA}\x{88BB}\x{88BC}\x{88BD}\x{88BE}\x{88BF}' + . '\x{88C0}\x{88C1}\x{88C2}\x{88C3}\x{88C4}\x{88C5}\x{88C6}\x{88C7}\x{88C8}' + . '\x{88C9}\x{88CA}\x{88CB}\x{88CC}\x{88CD}\x{88CE}\x{88CF}\x{88D0}\x{88D1}' + . '\x{88D2}\x{88D3}\x{88D4}\x{88D5}\x{88D6}\x{88D7}\x{88D8}\x{88D9}\x{88DA}' + . '\x{88DB}\x{88DC}\x{88DD}\x{88DE}\x{88DF}\x{88E0}\x{88E1}\x{88E2}\x{88E3}' + . '\x{88E4}\x{88E5}\x{88E7}\x{88E8}\x{88EA}\x{88EB}\x{88EC}\x{88EE}\x{88EF}' + . '\x{88F0}\x{88F1}\x{88F2}\x{88F3}\x{88F4}\x{88F5}\x{88F6}\x{88F7}\x{88F8}' + . '\x{88F9}\x{88FA}\x{88FB}\x{88FC}\x{88FD}\x{88FE}\x{88FF}\x{8900}\x{8901}' + . '\x{8902}\x{8904}\x{8905}\x{8906}\x{8907}\x{8908}\x{8909}\x{890A}\x{890B}' + . '\x{890C}\x{890D}\x{890E}\x{8910}\x{8911}\x{8912}\x{8913}\x{8914}\x{8915}' + . '\x{8916}\x{8917}\x{8918}\x{8919}\x{891A}\x{891B}\x{891C}\x{891D}\x{891E}' + . '\x{891F}\x{8920}\x{8921}\x{8922}\x{8923}\x{8925}\x{8926}\x{8927}\x{8928}' + . '\x{8929}\x{892A}\x{892B}\x{892C}\x{892D}\x{892E}\x{892F}\x{8930}\x{8931}' + . '\x{8932}\x{8933}\x{8934}\x{8935}\x{8936}\x{8937}\x{8938}\x{8939}\x{893A}' + . '\x{893B}\x{893C}\x{893D}\x{893E}\x{893F}\x{8940}\x{8941}\x{8942}\x{8943}' + . '\x{8944}\x{8945}\x{8946}\x{8947}\x{8948}\x{8949}\x{894A}\x{894B}\x{894C}' + . '\x{894E}\x{894F}\x{8950}\x{8951}\x{8952}\x{8953}\x{8954}\x{8955}\x{8956}' + . '\x{8957}\x{8958}\x{8959}\x{895A}\x{895B}\x{895C}\x{895D}\x{895E}\x{895F}' + . '\x{8960}\x{8961}\x{8962}\x{8963}\x{8964}\x{8966}\x{8967}\x{8968}\x{8969}' + . '\x{896A}\x{896B}\x{896C}\x{896D}\x{896E}\x{896F}\x{8970}\x{8971}\x{8972}' + . '\x{8973}\x{8974}\x{8976}\x{8977}\x{8978}\x{8979}\x{897A}\x{897B}\x{897C}' + . '\x{897E}\x{897F}\x{8980}\x{8981}\x{8982}\x{8983}\x{8984}\x{8985}\x{8986}' + . '\x{8987}\x{8988}\x{8989}\x{898A}\x{898B}\x{898C}\x{898E}\x{898F}\x{8991}' + . '\x{8992}\x{8993}\x{8995}\x{8996}\x{8997}\x{8998}\x{899A}\x{899B}\x{899C}' + . '\x{899D}\x{899E}\x{899F}\x{89A0}\x{89A1}\x{89A2}\x{89A3}\x{89A4}\x{89A5}' + . '\x{89A6}\x{89A7}\x{89A8}\x{89AA}\x{89AB}\x{89AC}\x{89AD}\x{89AE}\x{89AF}' + . '\x{89B1}\x{89B2}\x{89B3}\x{89B5}\x{89B6}\x{89B7}\x{89B8}\x{89B9}\x{89BA}' + . '\x{89BD}\x{89BE}\x{89BF}\x{89C0}\x{89C1}\x{89C2}\x{89C3}\x{89C4}\x{89C5}' + . '\x{89C6}\x{89C7}\x{89C8}\x{89C9}\x{89CA}\x{89CB}\x{89CC}\x{89CD}\x{89CE}' + . '\x{89CF}\x{89D0}\x{89D1}\x{89D2}\x{89D3}\x{89D4}\x{89D5}\x{89D6}\x{89D7}' + . '\x{89D8}\x{89D9}\x{89DA}\x{89DB}\x{89DC}\x{89DD}\x{89DE}\x{89DF}\x{89E0}' + . '\x{89E1}\x{89E2}\x{89E3}\x{89E4}\x{89E5}\x{89E6}\x{89E7}\x{89E8}\x{89E9}' + . '\x{89EA}\x{89EB}\x{89EC}\x{89ED}\x{89EF}\x{89F0}\x{89F1}\x{89F2}\x{89F3}' + . '\x{89F4}\x{89F6}\x{89F7}\x{89F8}\x{89FA}\x{89FB}\x{89FC}\x{89FE}\x{89FF}' + . '\x{8A00}\x{8A01}\x{8A02}\x{8A03}\x{8A04}\x{8A07}\x{8A08}\x{8A09}\x{8A0A}' + . '\x{8A0B}\x{8A0C}\x{8A0D}\x{8A0E}\x{8A0F}\x{8A10}\x{8A11}\x{8A12}\x{8A13}' + . '\x{8A15}\x{8A16}\x{8A17}\x{8A18}\x{8A1A}\x{8A1B}\x{8A1C}\x{8A1D}\x{8A1E}' + . '\x{8A1F}\x{8A22}\x{8A23}\x{8A24}\x{8A25}\x{8A26}\x{8A27}\x{8A28}\x{8A29}' + . '\x{8A2A}\x{8A2C}\x{8A2D}\x{8A2E}\x{8A2F}\x{8A30}\x{8A31}\x{8A32}\x{8A34}' + . '\x{8A35}\x{8A36}\x{8A37}\x{8A38}\x{8A39}\x{8A3A}\x{8A3B}\x{8A3C}\x{8A3E}' + . '\x{8A3F}\x{8A40}\x{8A41}\x{8A42}\x{8A43}\x{8A44}\x{8A45}\x{8A46}\x{8A47}' + . '\x{8A48}\x{8A49}\x{8A4A}\x{8A4C}\x{8A4D}\x{8A4E}\x{8A4F}\x{8A50}\x{8A51}' + . '\x{8A52}\x{8A53}\x{8A54}\x{8A55}\x{8A56}\x{8A57}\x{8A58}\x{8A59}\x{8A5A}' + . '\x{8A5B}\x{8A5C}\x{8A5D}\x{8A5E}\x{8A5F}\x{8A60}\x{8A61}\x{8A62}\x{8A63}' + . '\x{8A65}\x{8A66}\x{8A67}\x{8A68}\x{8A69}\x{8A6A}\x{8A6B}\x{8A6C}\x{8A6D}' + . '\x{8A6E}\x{8A6F}\x{8A70}\x{8A71}\x{8A72}\x{8A73}\x{8A74}\x{8A75}\x{8A76}' + . '\x{8A77}\x{8A79}\x{8A7A}\x{8A7B}\x{8A7C}\x{8A7E}\x{8A7F}\x{8A80}\x{8A81}' + . '\x{8A82}\x{8A83}\x{8A84}\x{8A85}\x{8A86}\x{8A87}\x{8A89}\x{8A8A}\x{8A8B}' + . '\x{8A8C}\x{8A8D}\x{8A8E}\x{8A8F}\x{8A90}\x{8A91}\x{8A92}\x{8A93}\x{8A94}' + . '\x{8A95}\x{8A96}\x{8A97}\x{8A98}\x{8A99}\x{8A9A}\x{8A9B}\x{8A9C}\x{8A9D}' + . '\x{8A9E}\x{8AA0}\x{8AA1}\x{8AA2}\x{8AA3}\x{8AA4}\x{8AA5}\x{8AA6}\x{8AA7}' + . '\x{8AA8}\x{8AA9}\x{8AAA}\x{8AAB}\x{8AAC}\x{8AAE}\x{8AB0}\x{8AB1}\x{8AB2}' + . '\x{8AB3}\x{8AB4}\x{8AB5}\x{8AB6}\x{8AB8}\x{8AB9}\x{8ABA}\x{8ABB}\x{8ABC}' + . '\x{8ABD}\x{8ABE}\x{8ABF}\x{8AC0}\x{8AC1}\x{8AC2}\x{8AC3}\x{8AC4}\x{8AC5}' + . '\x{8AC6}\x{8AC7}\x{8AC8}\x{8AC9}\x{8ACA}\x{8ACB}\x{8ACC}\x{8ACD}\x{8ACE}' + . '\x{8ACF}\x{8AD1}\x{8AD2}\x{8AD3}\x{8AD4}\x{8AD5}\x{8AD6}\x{8AD7}\x{8AD8}' + . '\x{8AD9}\x{8ADA}\x{8ADB}\x{8ADC}\x{8ADD}\x{8ADE}\x{8ADF}\x{8AE0}\x{8AE1}' + . '\x{8AE2}\x{8AE3}\x{8AE4}\x{8AE5}\x{8AE6}\x{8AE7}\x{8AE8}\x{8AE9}\x{8AEA}' + . '\x{8AEB}\x{8AED}\x{8AEE}\x{8AEF}\x{8AF0}\x{8AF1}\x{8AF2}\x{8AF3}\x{8AF4}' + . '\x{8AF5}\x{8AF6}\x{8AF7}\x{8AF8}\x{8AF9}\x{8AFA}\x{8AFB}\x{8AFC}\x{8AFD}' + . '\x{8AFE}\x{8AFF}\x{8B00}\x{8B01}\x{8B02}\x{8B03}\x{8B04}\x{8B05}\x{8B06}' + . '\x{8B07}\x{8B08}\x{8B09}\x{8B0A}\x{8B0B}\x{8B0D}\x{8B0E}\x{8B0F}\x{8B10}' + . '\x{8B11}\x{8B12}\x{8B13}\x{8B14}\x{8B15}\x{8B16}\x{8B17}\x{8B18}\x{8B19}' + . '\x{8B1A}\x{8B1B}\x{8B1C}\x{8B1D}\x{8B1E}\x{8B1F}\x{8B20}\x{8B21}\x{8B22}' + . '\x{8B23}\x{8B24}\x{8B25}\x{8B26}\x{8B27}\x{8B28}\x{8B2A}\x{8B2B}\x{8B2C}' + . '\x{8B2D}\x{8B2E}\x{8B2F}\x{8B30}\x{8B31}\x{8B33}\x{8B34}\x{8B35}\x{8B36}' + . '\x{8B37}\x{8B39}\x{8B3A}\x{8B3B}\x{8B3C}\x{8B3D}\x{8B3E}\x{8B40}\x{8B41}' + . '\x{8B42}\x{8B43}\x{8B44}\x{8B45}\x{8B46}\x{8B47}\x{8B48}\x{8B49}\x{8B4A}' + . '\x{8B4B}\x{8B4C}\x{8B4D}\x{8B4E}\x{8B4F}\x{8B50}\x{8B51}\x{8B52}\x{8B53}' + . '\x{8B54}\x{8B55}\x{8B56}\x{8B57}\x{8B58}\x{8B59}\x{8B5A}\x{8B5B}\x{8B5C}' + . '\x{8B5D}\x{8B5E}\x{8B5F}\x{8B60}\x{8B63}\x{8B64}\x{8B65}\x{8B66}\x{8B67}' + . '\x{8B68}\x{8B6A}\x{8B6B}\x{8B6C}\x{8B6D}\x{8B6E}\x{8B6F}\x{8B70}\x{8B71}' + . '\x{8B73}\x{8B74}\x{8B76}\x{8B77}\x{8B78}\x{8B79}\x{8B7A}\x{8B7B}\x{8B7D}' + . '\x{8B7E}\x{8B7F}\x{8B80}\x{8B82}\x{8B83}\x{8B84}\x{8B85}\x{8B86}\x{8B88}' + . '\x{8B89}\x{8B8A}\x{8B8B}\x{8B8C}\x{8B8E}\x{8B90}\x{8B91}\x{8B92}\x{8B93}' + . '\x{8B94}\x{8B95}\x{8B96}\x{8B97}\x{8B98}\x{8B99}\x{8B9A}\x{8B9C}\x{8B9D}' + . '\x{8B9E}\x{8B9F}\x{8BA0}\x{8BA1}\x{8BA2}\x{8BA3}\x{8BA4}\x{8BA5}\x{8BA6}' + . '\x{8BA7}\x{8BA8}\x{8BA9}\x{8BAA}\x{8BAB}\x{8BAC}\x{8BAD}\x{8BAE}\x{8BAF}' + . '\x{8BB0}\x{8BB1}\x{8BB2}\x{8BB3}\x{8BB4}\x{8BB5}\x{8BB6}\x{8BB7}\x{8BB8}' + . '\x{8BB9}\x{8BBA}\x{8BBB}\x{8BBC}\x{8BBD}\x{8BBE}\x{8BBF}\x{8BC0}\x{8BC1}' + . '\x{8BC2}\x{8BC3}\x{8BC4}\x{8BC5}\x{8BC6}\x{8BC7}\x{8BC8}\x{8BC9}\x{8BCA}' + . '\x{8BCB}\x{8BCC}\x{8BCD}\x{8BCE}\x{8BCF}\x{8BD0}\x{8BD1}\x{8BD2}\x{8BD3}' + . '\x{8BD4}\x{8BD5}\x{8BD6}\x{8BD7}\x{8BD8}\x{8BD9}\x{8BDA}\x{8BDB}\x{8BDC}' + . '\x{8BDD}\x{8BDE}\x{8BDF}\x{8BE0}\x{8BE1}\x{8BE2}\x{8BE3}\x{8BE4}\x{8BE5}' + . '\x{8BE6}\x{8BE7}\x{8BE8}\x{8BE9}\x{8BEA}\x{8BEB}\x{8BEC}\x{8BED}\x{8BEE}' + . '\x{8BEF}\x{8BF0}\x{8BF1}\x{8BF2}\x{8BF3}\x{8BF4}\x{8BF5}\x{8BF6}\x{8BF7}' + . '\x{8BF8}\x{8BF9}\x{8BFA}\x{8BFB}\x{8BFC}\x{8BFD}\x{8BFE}\x{8BFF}\x{8C00}' + . '\x{8C01}\x{8C02}\x{8C03}\x{8C04}\x{8C05}\x{8C06}\x{8C07}\x{8C08}\x{8C09}' + . '\x{8C0A}\x{8C0B}\x{8C0C}\x{8C0D}\x{8C0E}\x{8C0F}\x{8C10}\x{8C11}\x{8C12}' + . '\x{8C13}\x{8C14}\x{8C15}\x{8C16}\x{8C17}\x{8C18}\x{8C19}\x{8C1A}\x{8C1B}' + . '\x{8C1C}\x{8C1D}\x{8C1E}\x{8C1F}\x{8C20}\x{8C21}\x{8C22}\x{8C23}\x{8C24}' + . '\x{8C25}\x{8C26}\x{8C27}\x{8C28}\x{8C29}\x{8C2A}\x{8C2B}\x{8C2C}\x{8C2D}' + . '\x{8C2E}\x{8C2F}\x{8C30}\x{8C31}\x{8C32}\x{8C33}\x{8C34}\x{8C35}\x{8C36}' + . '\x{8C37}\x{8C39}\x{8C3A}\x{8C3B}\x{8C3C}\x{8C3D}\x{8C3E}\x{8C3F}\x{8C41}' + . '\x{8C42}\x{8C43}\x{8C45}\x{8C46}\x{8C47}\x{8C48}\x{8C49}\x{8C4A}\x{8C4B}' + . '\x{8C4C}\x{8C4D}\x{8C4E}\x{8C4F}\x{8C50}\x{8C54}\x{8C55}\x{8C56}\x{8C57}' + . '\x{8C59}\x{8C5A}\x{8C5B}\x{8C5C}\x{8C5D}\x{8C5E}\x{8C5F}\x{8C60}\x{8C61}' + . '\x{8C62}\x{8C63}\x{8C64}\x{8C65}\x{8C66}\x{8C67}\x{8C68}\x{8C69}\x{8C6A}' + . '\x{8C6B}\x{8C6C}\x{8C6D}\x{8C6E}\x{8C6F}\x{8C70}\x{8C71}\x{8C72}\x{8C73}' + . '\x{8C75}\x{8C76}\x{8C77}\x{8C78}\x{8C79}\x{8C7A}\x{8C7B}\x{8C7D}\x{8C7E}' + . '\x{8C80}\x{8C81}\x{8C82}\x{8C84}\x{8C85}\x{8C86}\x{8C88}\x{8C89}\x{8C8A}' + . '\x{8C8C}\x{8C8D}\x{8C8F}\x{8C90}\x{8C91}\x{8C92}\x{8C93}\x{8C94}\x{8C95}' + . '\x{8C96}\x{8C97}\x{8C98}\x{8C99}\x{8C9A}\x{8C9C}\x{8C9D}\x{8C9E}\x{8C9F}' + . '\x{8CA0}\x{8CA1}\x{8CA2}\x{8CA3}\x{8CA4}\x{8CA5}\x{8CA7}\x{8CA8}\x{8CA9}' + . '\x{8CAA}\x{8CAB}\x{8CAC}\x{8CAD}\x{8CAE}\x{8CAF}\x{8CB0}\x{8CB1}\x{8CB2}' + . '\x{8CB3}\x{8CB4}\x{8CB5}\x{8CB6}\x{8CB7}\x{8CB8}\x{8CB9}\x{8CBA}\x{8CBB}' + . '\x{8CBC}\x{8CBD}\x{8CBE}\x{8CBF}\x{8CC0}\x{8CC1}\x{8CC2}\x{8CC3}\x{8CC4}' + . '\x{8CC5}\x{8CC6}\x{8CC7}\x{8CC8}\x{8CC9}\x{8CCA}\x{8CCC}\x{8CCE}\x{8CCF}' + . '\x{8CD0}\x{8CD1}\x{8CD2}\x{8CD3}\x{8CD4}\x{8CD5}\x{8CD7}\x{8CD9}\x{8CDA}' + . '\x{8CDB}\x{8CDC}\x{8CDD}\x{8CDE}\x{8CDF}\x{8CE0}\x{8CE1}\x{8CE2}\x{8CE3}' + . '\x{8CE4}\x{8CE5}\x{8CE6}\x{8CE7}\x{8CE8}\x{8CEA}\x{8CEB}\x{8CEC}\x{8CED}' + . '\x{8CEE}\x{8CEF}\x{8CF0}\x{8CF1}\x{8CF2}\x{8CF3}\x{8CF4}\x{8CF5}\x{8CF6}' + . '\x{8CF8}\x{8CF9}\x{8CFA}\x{8CFB}\x{8CFC}\x{8CFD}\x{8CFE}\x{8CFF}\x{8D00}' + . '\x{8D02}\x{8D03}\x{8D04}\x{8D05}\x{8D06}\x{8D07}\x{8D08}\x{8D09}\x{8D0A}' + . '\x{8D0B}\x{8D0C}\x{8D0D}\x{8D0E}\x{8D0F}\x{8D10}\x{8D13}\x{8D14}\x{8D15}' + . '\x{8D16}\x{8D17}\x{8D18}\x{8D19}\x{8D1A}\x{8D1B}\x{8D1C}\x{8D1D}\x{8D1E}' + . '\x{8D1F}\x{8D20}\x{8D21}\x{8D22}\x{8D23}\x{8D24}\x{8D25}\x{8D26}\x{8D27}' + . '\x{8D28}\x{8D29}\x{8D2A}\x{8D2B}\x{8D2C}\x{8D2D}\x{8D2E}\x{8D2F}\x{8D30}' + . '\x{8D31}\x{8D32}\x{8D33}\x{8D34}\x{8D35}\x{8D36}\x{8D37}\x{8D38}\x{8D39}' + . '\x{8D3A}\x{8D3B}\x{8D3C}\x{8D3D}\x{8D3E}\x{8D3F}\x{8D40}\x{8D41}\x{8D42}' + . '\x{8D43}\x{8D44}\x{8D45}\x{8D46}\x{8D47}\x{8D48}\x{8D49}\x{8D4A}\x{8D4B}' + . '\x{8D4C}\x{8D4D}\x{8D4E}\x{8D4F}\x{8D50}\x{8D51}\x{8D52}\x{8D53}\x{8D54}' + . '\x{8D55}\x{8D56}\x{8D57}\x{8D58}\x{8D59}\x{8D5A}\x{8D5B}\x{8D5C}\x{8D5D}' + . '\x{8D5E}\x{8D5F}\x{8D60}\x{8D61}\x{8D62}\x{8D63}\x{8D64}\x{8D65}\x{8D66}' + . '\x{8D67}\x{8D68}\x{8D69}\x{8D6A}\x{8D6B}\x{8D6C}\x{8D6D}\x{8D6E}\x{8D6F}' + . '\x{8D70}\x{8D71}\x{8D72}\x{8D73}\x{8D74}\x{8D75}\x{8D76}\x{8D77}\x{8D78}' + . '\x{8D79}\x{8D7A}\x{8D7B}\x{8D7D}\x{8D7E}\x{8D7F}\x{8D80}\x{8D81}\x{8D82}' + . '\x{8D83}\x{8D84}\x{8D85}\x{8D86}\x{8D87}\x{8D88}\x{8D89}\x{8D8A}\x{8D8B}' + . '\x{8D8C}\x{8D8D}\x{8D8E}\x{8D8F}\x{8D90}\x{8D91}\x{8D92}\x{8D93}\x{8D94}' + . '\x{8D95}\x{8D96}\x{8D97}\x{8D98}\x{8D99}\x{8D9A}\x{8D9B}\x{8D9C}\x{8D9D}' + . '\x{8D9E}\x{8D9F}\x{8DA0}\x{8DA1}\x{8DA2}\x{8DA3}\x{8DA4}\x{8DA5}\x{8DA7}' + . '\x{8DA8}\x{8DA9}\x{8DAA}\x{8DAB}\x{8DAC}\x{8DAD}\x{8DAE}\x{8DAF}\x{8DB0}' + . '\x{8DB1}\x{8DB2}\x{8DB3}\x{8DB4}\x{8DB5}\x{8DB6}\x{8DB7}\x{8DB8}\x{8DB9}' + . '\x{8DBA}\x{8DBB}\x{8DBC}\x{8DBD}\x{8DBE}\x{8DBF}\x{8DC1}\x{8DC2}\x{8DC3}' + . '\x{8DC4}\x{8DC5}\x{8DC6}\x{8DC7}\x{8DC8}\x{8DC9}\x{8DCA}\x{8DCB}\x{8DCC}' + . '\x{8DCD}\x{8DCE}\x{8DCF}\x{8DD0}\x{8DD1}\x{8DD2}\x{8DD3}\x{8DD4}\x{8DD5}' + . '\x{8DD6}\x{8DD7}\x{8DD8}\x{8DD9}\x{8DDA}\x{8DDB}\x{8DDC}\x{8DDD}\x{8DDE}' + . '\x{8DDF}\x{8DE0}\x{8DE1}\x{8DE2}\x{8DE3}\x{8DE4}\x{8DE6}\x{8DE7}\x{8DE8}' + . '\x{8DE9}\x{8DEA}\x{8DEB}\x{8DEC}\x{8DED}\x{8DEE}\x{8DEF}\x{8DF0}\x{8DF1}' + . '\x{8DF2}\x{8DF3}\x{8DF4}\x{8DF5}\x{8DF6}\x{8DF7}\x{8DF8}\x{8DF9}\x{8DFA}' + . '\x{8DFB}\x{8DFC}\x{8DFD}\x{8DFE}\x{8DFF}\x{8E00}\x{8E02}\x{8E03}\x{8E04}' + . '\x{8E05}\x{8E06}\x{8E07}\x{8E08}\x{8E09}\x{8E0A}\x{8E0C}\x{8E0D}\x{8E0E}' + . '\x{8E0F}\x{8E10}\x{8E11}\x{8E12}\x{8E13}\x{8E14}\x{8E15}\x{8E16}\x{8E17}' + . '\x{8E18}\x{8E19}\x{8E1A}\x{8E1B}\x{8E1C}\x{8E1D}\x{8E1E}\x{8E1F}\x{8E20}' + . '\x{8E21}\x{8E22}\x{8E23}\x{8E24}\x{8E25}\x{8E26}\x{8E27}\x{8E28}\x{8E29}' + . '\x{8E2A}\x{8E2B}\x{8E2C}\x{8E2D}\x{8E2E}\x{8E2F}\x{8E30}\x{8E31}\x{8E33}' + . '\x{8E34}\x{8E35}\x{8E36}\x{8E37}\x{8E38}\x{8E39}\x{8E3A}\x{8E3B}\x{8E3C}' + . '\x{8E3D}\x{8E3E}\x{8E3F}\x{8E40}\x{8E41}\x{8E42}\x{8E43}\x{8E44}\x{8E45}' + . '\x{8E47}\x{8E48}\x{8E49}\x{8E4A}\x{8E4B}\x{8E4C}\x{8E4D}\x{8E4E}\x{8E50}' + . '\x{8E51}\x{8E52}\x{8E53}\x{8E54}\x{8E55}\x{8E56}\x{8E57}\x{8E58}\x{8E59}' + . '\x{8E5A}\x{8E5B}\x{8E5C}\x{8E5D}\x{8E5E}\x{8E5F}\x{8E60}\x{8E61}\x{8E62}' + . '\x{8E63}\x{8E64}\x{8E65}\x{8E66}\x{8E67}\x{8E68}\x{8E69}\x{8E6A}\x{8E6B}' + . '\x{8E6C}\x{8E6D}\x{8E6F}\x{8E70}\x{8E71}\x{8E72}\x{8E73}\x{8E74}\x{8E76}' + . '\x{8E78}\x{8E7A}\x{8E7B}\x{8E7C}\x{8E7D}\x{8E7E}\x{8E7F}\x{8E80}\x{8E81}' + . '\x{8E82}\x{8E83}\x{8E84}\x{8E85}\x{8E86}\x{8E87}\x{8E88}\x{8E89}\x{8E8A}' + . '\x{8E8B}\x{8E8C}\x{8E8D}\x{8E8E}\x{8E8F}\x{8E90}\x{8E91}\x{8E92}\x{8E93}' + . '\x{8E94}\x{8E95}\x{8E96}\x{8E97}\x{8E98}\x{8E9A}\x{8E9C}\x{8E9D}\x{8E9E}' + . '\x{8E9F}\x{8EA0}\x{8EA1}\x{8EA3}\x{8EA4}\x{8EA5}\x{8EA6}\x{8EA7}\x{8EA8}' + . '\x{8EA9}\x{8EAA}\x{8EAB}\x{8EAC}\x{8EAD}\x{8EAE}\x{8EAF}\x{8EB0}\x{8EB1}' + . '\x{8EB2}\x{8EB4}\x{8EB5}\x{8EB8}\x{8EB9}\x{8EBA}\x{8EBB}\x{8EBC}\x{8EBD}' + . '\x{8EBE}\x{8EBF}\x{8EC0}\x{8EC2}\x{8EC3}\x{8EC5}\x{8EC6}\x{8EC7}\x{8EC8}' + . '\x{8EC9}\x{8ECA}\x{8ECB}\x{8ECC}\x{8ECD}\x{8ECE}\x{8ECF}\x{8ED0}\x{8ED1}' + . '\x{8ED2}\x{8ED3}\x{8ED4}\x{8ED5}\x{8ED6}\x{8ED7}\x{8ED8}\x{8EDA}\x{8EDB}' + . '\x{8EDC}\x{8EDD}\x{8EDE}\x{8EDF}\x{8EE0}\x{8EE1}\x{8EE4}\x{8EE5}\x{8EE6}' + . '\x{8EE7}\x{8EE8}\x{8EE9}\x{8EEA}\x{8EEB}\x{8EEC}\x{8EED}\x{8EEE}\x{8EEF}' + . '\x{8EF1}\x{8EF2}\x{8EF3}\x{8EF4}\x{8EF5}\x{8EF6}\x{8EF7}\x{8EF8}\x{8EF9}' + . '\x{8EFA}\x{8EFB}\x{8EFC}\x{8EFD}\x{8EFE}\x{8EFF}\x{8F00}\x{8F01}\x{8F02}' + . '\x{8F03}\x{8F04}\x{8F05}\x{8F06}\x{8F07}\x{8F08}\x{8F09}\x{8F0A}\x{8F0B}' + . '\x{8F0D}\x{8F0E}\x{8F10}\x{8F11}\x{8F12}\x{8F13}\x{8F14}\x{8F15}\x{8F16}' + . '\x{8F17}\x{8F18}\x{8F1A}\x{8F1B}\x{8F1C}\x{8F1D}\x{8F1E}\x{8F1F}\x{8F20}' + . '\x{8F21}\x{8F22}\x{8F23}\x{8F24}\x{8F25}\x{8F26}\x{8F27}\x{8F28}\x{8F29}' + . '\x{8F2A}\x{8F2B}\x{8F2C}\x{8F2E}\x{8F2F}\x{8F30}\x{8F31}\x{8F32}\x{8F33}' + . '\x{8F34}\x{8F35}\x{8F36}\x{8F37}\x{8F38}\x{8F39}\x{8F3B}\x{8F3C}\x{8F3D}' + . '\x{8F3E}\x{8F3F}\x{8F40}\x{8F42}\x{8F43}\x{8F44}\x{8F45}\x{8F46}\x{8F47}' + . '\x{8F48}\x{8F49}\x{8F4A}\x{8F4B}\x{8F4C}\x{8F4D}\x{8F4E}\x{8F4F}\x{8F50}' + . '\x{8F51}\x{8F52}\x{8F53}\x{8F54}\x{8F55}\x{8F56}\x{8F57}\x{8F58}\x{8F59}' + . '\x{8F5A}\x{8F5B}\x{8F5D}\x{8F5E}\x{8F5F}\x{8F60}\x{8F61}\x{8F62}\x{8F63}' + . '\x{8F64}\x{8F65}\x{8F66}\x{8F67}\x{8F68}\x{8F69}\x{8F6A}\x{8F6B}\x{8F6C}' + . '\x{8F6D}\x{8F6E}\x{8F6F}\x{8F70}\x{8F71}\x{8F72}\x{8F73}\x{8F74}\x{8F75}' + . '\x{8F76}\x{8F77}\x{8F78}\x{8F79}\x{8F7A}\x{8F7B}\x{8F7C}\x{8F7D}\x{8F7E}' + . '\x{8F7F}\x{8F80}\x{8F81}\x{8F82}\x{8F83}\x{8F84}\x{8F85}\x{8F86}\x{8F87}' + . '\x{8F88}\x{8F89}\x{8F8A}\x{8F8B}\x{8F8C}\x{8F8D}\x{8F8E}\x{8F8F}\x{8F90}' + . '\x{8F91}\x{8F92}\x{8F93}\x{8F94}\x{8F95}\x{8F96}\x{8F97}\x{8F98}\x{8F99}' + . '\x{8F9A}\x{8F9B}\x{8F9C}\x{8F9E}\x{8F9F}\x{8FA0}\x{8FA1}\x{8FA2}\x{8FA3}' + . '\x{8FA5}\x{8FA6}\x{8FA7}\x{8FA8}\x{8FA9}\x{8FAA}\x{8FAB}\x{8FAC}\x{8FAD}' + . '\x{8FAE}\x{8FAF}\x{8FB0}\x{8FB1}\x{8FB2}\x{8FB4}\x{8FB5}\x{8FB6}\x{8FB7}' + . '\x{8FB8}\x{8FB9}\x{8FBB}\x{8FBC}\x{8FBD}\x{8FBE}\x{8FBF}\x{8FC0}\x{8FC1}' + . '\x{8FC2}\x{8FC4}\x{8FC5}\x{8FC6}\x{8FC7}\x{8FC8}\x{8FC9}\x{8FCB}\x{8FCC}' + . '\x{8FCD}\x{8FCE}\x{8FCF}\x{8FD0}\x{8FD1}\x{8FD2}\x{8FD3}\x{8FD4}\x{8FD5}' + . '\x{8FD6}\x{8FD7}\x{8FD8}\x{8FD9}\x{8FDA}\x{8FDB}\x{8FDC}\x{8FDD}\x{8FDE}' + . '\x{8FDF}\x{8FE0}\x{8FE1}\x{8FE2}\x{8FE3}\x{8FE4}\x{8FE5}\x{8FE6}\x{8FE8}' + . '\x{8FE9}\x{8FEA}\x{8FEB}\x{8FEC}\x{8FED}\x{8FEE}\x{8FEF}\x{8FF0}\x{8FF1}' + . '\x{8FF2}\x{8FF3}\x{8FF4}\x{8FF5}\x{8FF6}\x{8FF7}\x{8FF8}\x{8FF9}\x{8FFA}' + . '\x{8FFB}\x{8FFC}\x{8FFD}\x{8FFE}\x{8FFF}\x{9000}\x{9001}\x{9002}\x{9003}' + . '\x{9004}\x{9005}\x{9006}\x{9007}\x{9008}\x{9009}\x{900A}\x{900B}\x{900C}' + . '\x{900D}\x{900F}\x{9010}\x{9011}\x{9012}\x{9013}\x{9014}\x{9015}\x{9016}' + . '\x{9017}\x{9018}\x{9019}\x{901A}\x{901B}\x{901C}\x{901D}\x{901E}\x{901F}' + . '\x{9020}\x{9021}\x{9022}\x{9023}\x{9024}\x{9025}\x{9026}\x{9027}\x{9028}' + . '\x{9029}\x{902B}\x{902D}\x{902E}\x{902F}\x{9030}\x{9031}\x{9032}\x{9033}' + . '\x{9034}\x{9035}\x{9036}\x{9038}\x{903A}\x{903B}\x{903C}\x{903D}\x{903E}' + . '\x{903F}\x{9041}\x{9042}\x{9043}\x{9044}\x{9045}\x{9047}\x{9048}\x{9049}' + . '\x{904A}\x{904B}\x{904C}\x{904D}\x{904E}\x{904F}\x{9050}\x{9051}\x{9052}' + . '\x{9053}\x{9054}\x{9055}\x{9056}\x{9057}\x{9058}\x{9059}\x{905A}\x{905B}' + . '\x{905C}\x{905D}\x{905E}\x{905F}\x{9060}\x{9061}\x{9062}\x{9063}\x{9064}' + . '\x{9065}\x{9066}\x{9067}\x{9068}\x{9069}\x{906A}\x{906B}\x{906C}\x{906D}' + . '\x{906E}\x{906F}\x{9070}\x{9071}\x{9072}\x{9073}\x{9074}\x{9075}\x{9076}' + . '\x{9077}\x{9078}\x{9079}\x{907A}\x{907B}\x{907C}\x{907D}\x{907E}\x{907F}' + . '\x{9080}\x{9081}\x{9082}\x{9083}\x{9084}\x{9085}\x{9086}\x{9087}\x{9088}' + . '\x{9089}\x{908A}\x{908B}\x{908C}\x{908D}\x{908E}\x{908F}\x{9090}\x{9091}' + . '\x{9092}\x{9093}\x{9094}\x{9095}\x{9096}\x{9097}\x{9098}\x{9099}\x{909A}' + . '\x{909B}\x{909C}\x{909D}\x{909E}\x{909F}\x{90A0}\x{90A1}\x{90A2}\x{90A3}' + . '\x{90A4}\x{90A5}\x{90A6}\x{90A7}\x{90A8}\x{90A9}\x{90AA}\x{90AC}\x{90AD}' + . '\x{90AE}\x{90AF}\x{90B0}\x{90B1}\x{90B2}\x{90B3}\x{90B4}\x{90B5}\x{90B6}' + . '\x{90B7}\x{90B8}\x{90B9}\x{90BA}\x{90BB}\x{90BC}\x{90BD}\x{90BE}\x{90BF}' + . '\x{90C0}\x{90C1}\x{90C2}\x{90C3}\x{90C4}\x{90C5}\x{90C6}\x{90C7}\x{90C8}' + . '\x{90C9}\x{90CA}\x{90CB}\x{90CE}\x{90CF}\x{90D0}\x{90D1}\x{90D3}\x{90D4}' + . '\x{90D5}\x{90D6}\x{90D7}\x{90D8}\x{90D9}\x{90DA}\x{90DB}\x{90DC}\x{90DD}' + . '\x{90DE}\x{90DF}\x{90E0}\x{90E1}\x{90E2}\x{90E3}\x{90E4}\x{90E5}\x{90E6}' + . '\x{90E7}\x{90E8}\x{90E9}\x{90EA}\x{90EB}\x{90EC}\x{90ED}\x{90EE}\x{90EF}' + . '\x{90F0}\x{90F1}\x{90F2}\x{90F3}\x{90F4}\x{90F5}\x{90F7}\x{90F8}\x{90F9}' + . '\x{90FA}\x{90FB}\x{90FC}\x{90FD}\x{90FE}\x{90FF}\x{9100}\x{9101}\x{9102}' + . '\x{9103}\x{9104}\x{9105}\x{9106}\x{9107}\x{9108}\x{9109}\x{910B}\x{910C}' + . '\x{910D}\x{910E}\x{910F}\x{9110}\x{9111}\x{9112}\x{9113}\x{9114}\x{9115}' + . '\x{9116}\x{9117}\x{9118}\x{9119}\x{911A}\x{911B}\x{911C}\x{911D}\x{911E}' + . '\x{911F}\x{9120}\x{9121}\x{9122}\x{9123}\x{9124}\x{9125}\x{9126}\x{9127}' + . '\x{9128}\x{9129}\x{912A}\x{912B}\x{912C}\x{912D}\x{912E}\x{912F}\x{9130}' + . '\x{9131}\x{9132}\x{9133}\x{9134}\x{9135}\x{9136}\x{9137}\x{9138}\x{9139}' + . '\x{913A}\x{913B}\x{913E}\x{913F}\x{9140}\x{9141}\x{9142}\x{9143}\x{9144}' + . '\x{9145}\x{9146}\x{9147}\x{9148}\x{9149}\x{914A}\x{914B}\x{914C}\x{914D}' + . '\x{914E}\x{914F}\x{9150}\x{9151}\x{9152}\x{9153}\x{9154}\x{9155}\x{9156}' + . '\x{9157}\x{9158}\x{915A}\x{915B}\x{915C}\x{915D}\x{915E}\x{915F}\x{9160}' + . '\x{9161}\x{9162}\x{9163}\x{9164}\x{9165}\x{9166}\x{9167}\x{9168}\x{9169}' + . '\x{916A}\x{916B}\x{916C}\x{916D}\x{916E}\x{916F}\x{9170}\x{9171}\x{9172}' + . '\x{9173}\x{9174}\x{9175}\x{9176}\x{9177}\x{9178}\x{9179}\x{917A}\x{917C}' + . '\x{917D}\x{917E}\x{917F}\x{9180}\x{9181}\x{9182}\x{9183}\x{9184}\x{9185}' + . '\x{9186}\x{9187}\x{9188}\x{9189}\x{918A}\x{918B}\x{918C}\x{918D}\x{918E}' + . '\x{918F}\x{9190}\x{9191}\x{9192}\x{9193}\x{9194}\x{9196}\x{9199}\x{919A}' + . '\x{919B}\x{919C}\x{919D}\x{919E}\x{919F}\x{91A0}\x{91A1}\x{91A2}\x{91A3}' + . '\x{91A5}\x{91A6}\x{91A7}\x{91A8}\x{91AA}\x{91AB}\x{91AC}\x{91AD}\x{91AE}' + . '\x{91AF}\x{91B0}\x{91B1}\x{91B2}\x{91B3}\x{91B4}\x{91B5}\x{91B6}\x{91B7}' + . '\x{91B9}\x{91BA}\x{91BB}\x{91BC}\x{91BD}\x{91BE}\x{91C0}\x{91C1}\x{91C2}' + . '\x{91C3}\x{91C5}\x{91C6}\x{91C7}\x{91C9}\x{91CA}\x{91CB}\x{91CC}\x{91CD}' + . '\x{91CE}\x{91CF}\x{91D0}\x{91D1}\x{91D2}\x{91D3}\x{91D4}\x{91D5}\x{91D7}' + . '\x{91D8}\x{91D9}\x{91DA}\x{91DB}\x{91DC}\x{91DD}\x{91DE}\x{91DF}\x{91E2}' + . '\x{91E3}\x{91E4}\x{91E5}\x{91E6}\x{91E7}\x{91E8}\x{91E9}\x{91EA}\x{91EB}' + . '\x{91EC}\x{91ED}\x{91EE}\x{91F0}\x{91F1}\x{91F2}\x{91F3}\x{91F4}\x{91F5}' + . '\x{91F7}\x{91F8}\x{91F9}\x{91FA}\x{91FB}\x{91FD}\x{91FE}\x{91FF}\x{9200}' + . '\x{9201}\x{9202}\x{9203}\x{9204}\x{9205}\x{9206}\x{9207}\x{9208}\x{9209}' + . '\x{920A}\x{920B}\x{920C}\x{920D}\x{920E}\x{920F}\x{9210}\x{9211}\x{9212}' + . '\x{9214}\x{9215}\x{9216}\x{9217}\x{9218}\x{9219}\x{921A}\x{921B}\x{921C}' + . '\x{921D}\x{921E}\x{9220}\x{9221}\x{9223}\x{9224}\x{9225}\x{9226}\x{9227}' + . '\x{9228}\x{9229}\x{922A}\x{922B}\x{922D}\x{922E}\x{922F}\x{9230}\x{9231}' + . '\x{9232}\x{9233}\x{9234}\x{9235}\x{9236}\x{9237}\x{9238}\x{9239}\x{923A}' + . '\x{923B}\x{923C}\x{923D}\x{923E}\x{923F}\x{9240}\x{9241}\x{9242}\x{9245}' + . '\x{9246}\x{9247}\x{9248}\x{9249}\x{924A}\x{924B}\x{924C}\x{924D}\x{924E}' + . '\x{924F}\x{9250}\x{9251}\x{9252}\x{9253}\x{9254}\x{9255}\x{9256}\x{9257}' + . '\x{9258}\x{9259}\x{925A}\x{925B}\x{925C}\x{925D}\x{925E}\x{925F}\x{9260}' + . '\x{9261}\x{9262}\x{9263}\x{9264}\x{9265}\x{9266}\x{9267}\x{9268}\x{926B}' + . '\x{926C}\x{926D}\x{926E}\x{926F}\x{9270}\x{9272}\x{9273}\x{9274}\x{9275}' + . '\x{9276}\x{9277}\x{9278}\x{9279}\x{927A}\x{927B}\x{927C}\x{927D}\x{927E}' + . '\x{927F}\x{9280}\x{9282}\x{9283}\x{9285}\x{9286}\x{9287}\x{9288}\x{9289}' + . '\x{928A}\x{928B}\x{928C}\x{928D}\x{928E}\x{928F}\x{9290}\x{9291}\x{9292}' + . '\x{9293}\x{9294}\x{9295}\x{9296}\x{9297}\x{9298}\x{9299}\x{929A}\x{929B}' + . '\x{929C}\x{929D}\x{929F}\x{92A0}\x{92A1}\x{92A2}\x{92A3}\x{92A4}\x{92A5}' + . '\x{92A6}\x{92A7}\x{92A8}\x{92A9}\x{92AA}\x{92AB}\x{92AC}\x{92AD}\x{92AE}' + . '\x{92AF}\x{92B0}\x{92B1}\x{92B2}\x{92B3}\x{92B4}\x{92B5}\x{92B6}\x{92B7}' + . '\x{92B8}\x{92B9}\x{92BA}\x{92BB}\x{92BC}\x{92BE}\x{92BF}\x{92C0}\x{92C1}' + . '\x{92C2}\x{92C3}\x{92C4}\x{92C5}\x{92C6}\x{92C7}\x{92C8}\x{92C9}\x{92CA}' + . '\x{92CB}\x{92CC}\x{92CD}\x{92CE}\x{92CF}\x{92D0}\x{92D1}\x{92D2}\x{92D3}' + . '\x{92D5}\x{92D6}\x{92D7}\x{92D8}\x{92D9}\x{92DA}\x{92DC}\x{92DD}\x{92DE}' + . '\x{92DF}\x{92E0}\x{92E1}\x{92E3}\x{92E4}\x{92E5}\x{92E6}\x{92E7}\x{92E8}' + . '\x{92E9}\x{92EA}\x{92EB}\x{92EC}\x{92ED}\x{92EE}\x{92EF}\x{92F0}\x{92F1}' + . '\x{92F2}\x{92F3}\x{92F4}\x{92F5}\x{92F6}\x{92F7}\x{92F8}\x{92F9}\x{92FA}' + . '\x{92FB}\x{92FC}\x{92FD}\x{92FE}\x{92FF}\x{9300}\x{9301}\x{9302}\x{9303}' + . '\x{9304}\x{9305}\x{9306}\x{9307}\x{9308}\x{9309}\x{930A}\x{930B}\x{930C}' + . '\x{930D}\x{930E}\x{930F}\x{9310}\x{9311}\x{9312}\x{9313}\x{9314}\x{9315}' + . '\x{9316}\x{9317}\x{9318}\x{9319}\x{931A}\x{931B}\x{931D}\x{931E}\x{931F}' + . '\x{9320}\x{9321}\x{9322}\x{9323}\x{9324}\x{9325}\x{9326}\x{9327}\x{9328}' + . '\x{9329}\x{932A}\x{932B}\x{932D}\x{932E}\x{932F}\x{9332}\x{9333}\x{9334}' + . '\x{9335}\x{9336}\x{9337}\x{9338}\x{9339}\x{933A}\x{933B}\x{933C}\x{933D}' + . '\x{933E}\x{933F}\x{9340}\x{9341}\x{9342}\x{9343}\x{9344}\x{9345}\x{9346}' + . '\x{9347}\x{9348}\x{9349}\x{934A}\x{934B}\x{934C}\x{934D}\x{934E}\x{934F}' + . '\x{9350}\x{9351}\x{9352}\x{9353}\x{9354}\x{9355}\x{9356}\x{9357}\x{9358}' + . '\x{9359}\x{935A}\x{935B}\x{935C}\x{935D}\x{935E}\x{935F}\x{9360}\x{9361}' + . '\x{9363}\x{9364}\x{9365}\x{9366}\x{9367}\x{9369}\x{936A}\x{936C}\x{936D}' + . '\x{936E}\x{9370}\x{9371}\x{9372}\x{9374}\x{9375}\x{9376}\x{9377}\x{9379}' + . '\x{937A}\x{937B}\x{937C}\x{937D}\x{937E}\x{9380}\x{9382}\x{9383}\x{9384}' + . '\x{9385}\x{9386}\x{9387}\x{9388}\x{9389}\x{938A}\x{938C}\x{938D}\x{938E}' + . '\x{938F}\x{9390}\x{9391}\x{9392}\x{9393}\x{9394}\x{9395}\x{9396}\x{9397}' + . '\x{9398}\x{9399}\x{939A}\x{939B}\x{939D}\x{939E}\x{939F}\x{93A1}\x{93A2}' + . '\x{93A3}\x{93A4}\x{93A5}\x{93A6}\x{93A7}\x{93A8}\x{93A9}\x{93AA}\x{93AC}' + . '\x{93AD}\x{93AE}\x{93AF}\x{93B0}\x{93B1}\x{93B2}\x{93B3}\x{93B4}\x{93B5}' + . '\x{93B6}\x{93B7}\x{93B8}\x{93B9}\x{93BA}\x{93BC}\x{93BD}\x{93BE}\x{93BF}' + . '\x{93C0}\x{93C1}\x{93C2}\x{93C3}\x{93C4}\x{93C5}\x{93C6}\x{93C7}\x{93C8}' + . '\x{93C9}\x{93CA}\x{93CB}\x{93CC}\x{93CD}\x{93CE}\x{93CF}\x{93D0}\x{93D1}' + . '\x{93D2}\x{93D3}\x{93D4}\x{93D5}\x{93D6}\x{93D7}\x{93D8}\x{93D9}\x{93DA}' + . '\x{93DB}\x{93DC}\x{93DD}\x{93DE}\x{93DF}\x{93E1}\x{93E2}\x{93E3}\x{93E4}' + . '\x{93E6}\x{93E7}\x{93E8}\x{93E9}\x{93EA}\x{93EB}\x{93EC}\x{93ED}\x{93EE}' + . '\x{93EF}\x{93F0}\x{93F1}\x{93F2}\x{93F4}\x{93F5}\x{93F6}\x{93F7}\x{93F8}' + . '\x{93F9}\x{93FA}\x{93FB}\x{93FC}\x{93FD}\x{93FE}\x{93FF}\x{9400}\x{9401}' + . '\x{9403}\x{9404}\x{9405}\x{9406}\x{9407}\x{9408}\x{9409}\x{940A}\x{940B}' + . '\x{940C}\x{940D}\x{940E}\x{940F}\x{9410}\x{9411}\x{9412}\x{9413}\x{9414}' + . '\x{9415}\x{9416}\x{9418}\x{9419}\x{941B}\x{941D}\x{9420}\x{9422}\x{9423}' + . '\x{9425}\x{9426}\x{9427}\x{9428}\x{9429}\x{942A}\x{942B}\x{942C}\x{942D}' + . '\x{942E}\x{942F}\x{9430}\x{9431}\x{9432}\x{9433}\x{9434}\x{9435}\x{9436}' + . '\x{9437}\x{9438}\x{9439}\x{943A}\x{943B}\x{943C}\x{943D}\x{943E}\x{943F}' + . '\x{9440}\x{9441}\x{9442}\x{9444}\x{9445}\x{9446}\x{9447}\x{9448}\x{9449}' + . '\x{944A}\x{944B}\x{944C}\x{944D}\x{944F}\x{9450}\x{9451}\x{9452}\x{9453}' + . '\x{9454}\x{9455}\x{9456}\x{9457}\x{9458}\x{9459}\x{945B}\x{945C}\x{945D}' + . '\x{945E}\x{945F}\x{9460}\x{9461}\x{9462}\x{9463}\x{9464}\x{9465}\x{9466}' + . '\x{9467}\x{9468}\x{9469}\x{946A}\x{946B}\x{946D}\x{946E}\x{946F}\x{9470}' + . '\x{9471}\x{9472}\x{9473}\x{9474}\x{9475}\x{9476}\x{9477}\x{9478}\x{9479}' + . '\x{947A}\x{947C}\x{947D}\x{947E}\x{947F}\x{9480}\x{9481}\x{9482}\x{9483}' + . '\x{9484}\x{9485}\x{9486}\x{9487}\x{9488}\x{9489}\x{948A}\x{948B}\x{948C}' + . '\x{948D}\x{948E}\x{948F}\x{9490}\x{9491}\x{9492}\x{9493}\x{9494}\x{9495}' + . '\x{9496}\x{9497}\x{9498}\x{9499}\x{949A}\x{949B}\x{949C}\x{949D}\x{949E}' + . '\x{949F}\x{94A0}\x{94A1}\x{94A2}\x{94A3}\x{94A4}\x{94A5}\x{94A6}\x{94A7}' + . '\x{94A8}\x{94A9}\x{94AA}\x{94AB}\x{94AC}\x{94AD}\x{94AE}\x{94AF}\x{94B0}' + . '\x{94B1}\x{94B2}\x{94B3}\x{94B4}\x{94B5}\x{94B6}\x{94B7}\x{94B8}\x{94B9}' + . '\x{94BA}\x{94BB}\x{94BC}\x{94BD}\x{94BE}\x{94BF}\x{94C0}\x{94C1}\x{94C2}' + . '\x{94C3}\x{94C4}\x{94C5}\x{94C6}\x{94C7}\x{94C8}\x{94C9}\x{94CA}\x{94CB}' + . '\x{94CC}\x{94CD}\x{94CE}\x{94CF}\x{94D0}\x{94D1}\x{94D2}\x{94D3}\x{94D4}' + . '\x{94D5}\x{94D6}\x{94D7}\x{94D8}\x{94D9}\x{94DA}\x{94DB}\x{94DC}\x{94DD}' + . '\x{94DE}\x{94DF}\x{94E0}\x{94E1}\x{94E2}\x{94E3}\x{94E4}\x{94E5}\x{94E6}' + . '\x{94E7}\x{94E8}\x{94E9}\x{94EA}\x{94EB}\x{94EC}\x{94ED}\x{94EE}\x{94EF}' + . '\x{94F0}\x{94F1}\x{94F2}\x{94F3}\x{94F4}\x{94F5}\x{94F6}\x{94F7}\x{94F8}' + . '\x{94F9}\x{94FA}\x{94FB}\x{94FC}\x{94FD}\x{94FE}\x{94FF}\x{9500}\x{9501}' + . '\x{9502}\x{9503}\x{9504}\x{9505}\x{9506}\x{9507}\x{9508}\x{9509}\x{950A}' + . '\x{950B}\x{950C}\x{950D}\x{950E}\x{950F}\x{9510}\x{9511}\x{9512}\x{9513}' + . '\x{9514}\x{9515}\x{9516}\x{9517}\x{9518}\x{9519}\x{951A}\x{951B}\x{951C}' + . '\x{951D}\x{951E}\x{951F}\x{9520}\x{9521}\x{9522}\x{9523}\x{9524}\x{9525}' + . '\x{9526}\x{9527}\x{9528}\x{9529}\x{952A}\x{952B}\x{952C}\x{952D}\x{952E}' + . '\x{952F}\x{9530}\x{9531}\x{9532}\x{9533}\x{9534}\x{9535}\x{9536}\x{9537}' + . '\x{9538}\x{9539}\x{953A}\x{953B}\x{953C}\x{953D}\x{953E}\x{953F}\x{9540}' + . '\x{9541}\x{9542}\x{9543}\x{9544}\x{9545}\x{9546}\x{9547}\x{9548}\x{9549}' + . '\x{954A}\x{954B}\x{954C}\x{954D}\x{954E}\x{954F}\x{9550}\x{9551}\x{9552}' + . '\x{9553}\x{9554}\x{9555}\x{9556}\x{9557}\x{9558}\x{9559}\x{955A}\x{955B}' + . '\x{955C}\x{955D}\x{955E}\x{955F}\x{9560}\x{9561}\x{9562}\x{9563}\x{9564}' + . '\x{9565}\x{9566}\x{9567}\x{9568}\x{9569}\x{956A}\x{956B}\x{956C}\x{956D}' + . '\x{956E}\x{956F}\x{9570}\x{9571}\x{9572}\x{9573}\x{9574}\x{9575}\x{9576}' + . '\x{9577}\x{957A}\x{957B}\x{957C}\x{957D}\x{957F}\x{9580}\x{9581}\x{9582}' + . '\x{9583}\x{9584}\x{9586}\x{9587}\x{9588}\x{9589}\x{958A}\x{958B}\x{958C}' + . '\x{958D}\x{958E}\x{958F}\x{9590}\x{9591}\x{9592}\x{9593}\x{9594}\x{9595}' + . '\x{9596}\x{9598}\x{9599}\x{959A}\x{959B}\x{959C}\x{959D}\x{959E}\x{959F}' + . '\x{95A1}\x{95A2}\x{95A3}\x{95A4}\x{95A5}\x{95A6}\x{95A7}\x{95A8}\x{95A9}' + . '\x{95AA}\x{95AB}\x{95AC}\x{95AD}\x{95AE}\x{95AF}\x{95B0}\x{95B1}\x{95B2}' + . '\x{95B5}\x{95B6}\x{95B7}\x{95B9}\x{95BA}\x{95BB}\x{95BC}\x{95BD}\x{95BE}' + . '\x{95BF}\x{95C0}\x{95C2}\x{95C3}\x{95C4}\x{95C5}\x{95C6}\x{95C7}\x{95C8}' + . '\x{95C9}\x{95CA}\x{95CB}\x{95CC}\x{95CD}\x{95CE}\x{95CF}\x{95D0}\x{95D1}' + . '\x{95D2}\x{95D3}\x{95D4}\x{95D5}\x{95D6}\x{95D7}\x{95D8}\x{95DA}\x{95DB}' + . '\x{95DC}\x{95DE}\x{95DF}\x{95E0}\x{95E1}\x{95E2}\x{95E3}\x{95E4}\x{95E5}' + . '\x{95E6}\x{95E7}\x{95E8}\x{95E9}\x{95EA}\x{95EB}\x{95EC}\x{95ED}\x{95EE}' + . '\x{95EF}\x{95F0}\x{95F1}\x{95F2}\x{95F3}\x{95F4}\x{95F5}\x{95F6}\x{95F7}' + . '\x{95F8}\x{95F9}\x{95FA}\x{95FB}\x{95FC}\x{95FD}\x{95FE}\x{95FF}\x{9600}' + . '\x{9601}\x{9602}\x{9603}\x{9604}\x{9605}\x{9606}\x{9607}\x{9608}\x{9609}' + . '\x{960A}\x{960B}\x{960C}\x{960D}\x{960E}\x{960F}\x{9610}\x{9611}\x{9612}' + . '\x{9613}\x{9614}\x{9615}\x{9616}\x{9617}\x{9618}\x{9619}\x{961A}\x{961B}' + . '\x{961C}\x{961D}\x{961E}\x{961F}\x{9620}\x{9621}\x{9622}\x{9623}\x{9624}' + . '\x{9627}\x{9628}\x{962A}\x{962B}\x{962C}\x{962D}\x{962E}\x{962F}\x{9630}' + . '\x{9631}\x{9632}\x{9633}\x{9634}\x{9635}\x{9636}\x{9637}\x{9638}\x{9639}' + . '\x{963A}\x{963B}\x{963C}\x{963D}\x{963F}\x{9640}\x{9641}\x{9642}\x{9643}' + . '\x{9644}\x{9645}\x{9646}\x{9647}\x{9648}\x{9649}\x{964A}\x{964B}\x{964C}' + . '\x{964D}\x{964E}\x{964F}\x{9650}\x{9651}\x{9652}\x{9653}\x{9654}\x{9655}' + . '\x{9658}\x{9659}\x{965A}\x{965B}\x{965C}\x{965D}\x{965E}\x{965F}\x{9660}' + . '\x{9661}\x{9662}\x{9663}\x{9664}\x{9666}\x{9667}\x{9668}\x{9669}\x{966A}' + . '\x{966B}\x{966C}\x{966D}\x{966E}\x{966F}\x{9670}\x{9671}\x{9672}\x{9673}' + . '\x{9674}\x{9675}\x{9676}\x{9677}\x{9678}\x{967C}\x{967D}\x{967E}\x{9680}' + . '\x{9683}\x{9684}\x{9685}\x{9686}\x{9687}\x{9688}\x{9689}\x{968A}\x{968B}' + . '\x{968D}\x{968E}\x{968F}\x{9690}\x{9691}\x{9692}\x{9693}\x{9694}\x{9695}' + . '\x{9697}\x{9698}\x{9699}\x{969B}\x{969C}\x{969E}\x{96A0}\x{96A1}\x{96A2}' + . '\x{96A3}\x{96A4}\x{96A5}\x{96A6}\x{96A7}\x{96A8}\x{96A9}\x{96AA}\x{96AC}' + . '\x{96AD}\x{96AE}\x{96B0}\x{96B1}\x{96B3}\x{96B4}\x{96B6}\x{96B7}\x{96B8}' + . '\x{96B9}\x{96BA}\x{96BB}\x{96BC}\x{96BD}\x{96BE}\x{96BF}\x{96C0}\x{96C1}' + . '\x{96C2}\x{96C3}\x{96C4}\x{96C5}\x{96C6}\x{96C7}\x{96C8}\x{96C9}\x{96CA}' + . '\x{96CB}\x{96CC}\x{96CD}\x{96CE}\x{96CF}\x{96D0}\x{96D1}\x{96D2}\x{96D3}' + . '\x{96D4}\x{96D5}\x{96D6}\x{96D7}\x{96D8}\x{96D9}\x{96DA}\x{96DB}\x{96DC}' + . '\x{96DD}\x{96DE}\x{96DF}\x{96E0}\x{96E1}\x{96E2}\x{96E3}\x{96E5}\x{96E8}' + . '\x{96E9}\x{96EA}\x{96EB}\x{96EC}\x{96ED}\x{96EE}\x{96EF}\x{96F0}\x{96F1}' + . '\x{96F2}\x{96F3}\x{96F4}\x{96F5}\x{96F6}\x{96F7}\x{96F8}\x{96F9}\x{96FA}' + . '\x{96FB}\x{96FD}\x{96FE}\x{96FF}\x{9700}\x{9701}\x{9702}\x{9703}\x{9704}' + . '\x{9705}\x{9706}\x{9707}\x{9708}\x{9709}\x{970A}\x{970B}\x{970C}\x{970D}' + . '\x{970E}\x{970F}\x{9710}\x{9711}\x{9712}\x{9713}\x{9715}\x{9716}\x{9718}' + . '\x{9719}\x{971C}\x{971D}\x{971E}\x{971F}\x{9720}\x{9721}\x{9722}\x{9723}' + . '\x{9724}\x{9725}\x{9726}\x{9727}\x{9728}\x{9729}\x{972A}\x{972B}\x{972C}' + . '\x{972D}\x{972E}\x{972F}\x{9730}\x{9731}\x{9732}\x{9735}\x{9736}\x{9738}' + . '\x{9739}\x{973A}\x{973B}\x{973C}\x{973D}\x{973E}\x{973F}\x{9742}\x{9743}' + . '\x{9744}\x{9745}\x{9746}\x{9747}\x{9748}\x{9749}\x{974A}\x{974B}\x{974C}' + . '\x{974E}\x{974F}\x{9750}\x{9751}\x{9752}\x{9753}\x{9754}\x{9755}\x{9756}' + . '\x{9758}\x{9759}\x{975A}\x{975B}\x{975C}\x{975D}\x{975E}\x{975F}\x{9760}' + . '\x{9761}\x{9762}\x{9765}\x{9766}\x{9767}\x{9768}\x{9769}\x{976A}\x{976B}' + . '\x{976C}\x{976D}\x{976E}\x{976F}\x{9770}\x{9772}\x{9773}\x{9774}\x{9776}' + . '\x{9777}\x{9778}\x{9779}\x{977A}\x{977B}\x{977C}\x{977D}\x{977E}\x{977F}' + . '\x{9780}\x{9781}\x{9782}\x{9783}\x{9784}\x{9785}\x{9786}\x{9788}\x{978A}' + . '\x{978B}\x{978C}\x{978D}\x{978E}\x{978F}\x{9790}\x{9791}\x{9792}\x{9793}' + . '\x{9794}\x{9795}\x{9796}\x{9797}\x{9798}\x{9799}\x{979A}\x{979C}\x{979D}' + . '\x{979E}\x{979F}\x{97A0}\x{97A1}\x{97A2}\x{97A3}\x{97A4}\x{97A5}\x{97A6}' + . '\x{97A7}\x{97A8}\x{97AA}\x{97AB}\x{97AC}\x{97AD}\x{97AE}\x{97AF}\x{97B2}' + . '\x{97B3}\x{97B4}\x{97B6}\x{97B7}\x{97B8}\x{97B9}\x{97BA}\x{97BB}\x{97BC}' + . '\x{97BD}\x{97BF}\x{97C1}\x{97C2}\x{97C3}\x{97C4}\x{97C5}\x{97C6}\x{97C7}' + . '\x{97C8}\x{97C9}\x{97CA}\x{97CB}\x{97CC}\x{97CD}\x{97CE}\x{97CF}\x{97D0}' + . '\x{97D1}\x{97D3}\x{97D4}\x{97D5}\x{97D6}\x{97D7}\x{97D8}\x{97D9}\x{97DA}' + . '\x{97DB}\x{97DC}\x{97DD}\x{97DE}\x{97DF}\x{97E0}\x{97E1}\x{97E2}\x{97E3}' + . '\x{97E4}\x{97E5}\x{97E6}\x{97E7}\x{97E8}\x{97E9}\x{97EA}\x{97EB}\x{97EC}' + . '\x{97ED}\x{97EE}\x{97EF}\x{97F0}\x{97F1}\x{97F2}\x{97F3}\x{97F4}\x{97F5}' + . '\x{97F6}\x{97F7}\x{97F8}\x{97F9}\x{97FA}\x{97FB}\x{97FD}\x{97FE}\x{97FF}' + . '\x{9800}\x{9801}\x{9802}\x{9803}\x{9804}\x{9805}\x{9806}\x{9807}\x{9808}' + . '\x{9809}\x{980A}\x{980B}\x{980C}\x{980D}\x{980E}\x{980F}\x{9810}\x{9811}' + . '\x{9812}\x{9813}\x{9814}\x{9815}\x{9816}\x{9817}\x{9818}\x{9819}\x{981A}' + . '\x{981B}\x{981C}\x{981D}\x{981E}\x{9820}\x{9821}\x{9822}\x{9823}\x{9824}' + . '\x{9826}\x{9827}\x{9828}\x{9829}\x{982B}\x{982D}\x{982E}\x{982F}\x{9830}' + . '\x{9831}\x{9832}\x{9834}\x{9835}\x{9836}\x{9837}\x{9838}\x{9839}\x{983B}' + . '\x{983C}\x{983D}\x{983F}\x{9840}\x{9841}\x{9843}\x{9844}\x{9845}\x{9846}' + . '\x{9848}\x{9849}\x{984A}\x{984C}\x{984D}\x{984E}\x{984F}\x{9850}\x{9851}' + . '\x{9852}\x{9853}\x{9854}\x{9855}\x{9857}\x{9858}\x{9859}\x{985A}\x{985B}' + . '\x{985C}\x{985D}\x{985E}\x{985F}\x{9860}\x{9861}\x{9862}\x{9863}\x{9864}' + . '\x{9865}\x{9867}\x{9869}\x{986A}\x{986B}\x{986C}\x{986D}\x{986E}\x{986F}' + . '\x{9870}\x{9871}\x{9872}\x{9873}\x{9874}\x{9875}\x{9876}\x{9877}\x{9878}' + . '\x{9879}\x{987A}\x{987B}\x{987C}\x{987D}\x{987E}\x{987F}\x{9880}\x{9881}' + . '\x{9882}\x{9883}\x{9884}\x{9885}\x{9886}\x{9887}\x{9888}\x{9889}\x{988A}' + . '\x{988B}\x{988C}\x{988D}\x{988E}\x{988F}\x{9890}\x{9891}\x{9892}\x{9893}' + . '\x{9894}\x{9895}\x{9896}\x{9897}\x{9898}\x{9899}\x{989A}\x{989B}\x{989C}' + . '\x{989D}\x{989E}\x{989F}\x{98A0}\x{98A1}\x{98A2}\x{98A3}\x{98A4}\x{98A5}' + . '\x{98A6}\x{98A7}\x{98A8}\x{98A9}\x{98AA}\x{98AB}\x{98AC}\x{98AD}\x{98AE}' + . '\x{98AF}\x{98B0}\x{98B1}\x{98B2}\x{98B3}\x{98B4}\x{98B5}\x{98B6}\x{98B8}' + . '\x{98B9}\x{98BA}\x{98BB}\x{98BC}\x{98BD}\x{98BE}\x{98BF}\x{98C0}\x{98C1}' + . '\x{98C2}\x{98C3}\x{98C4}\x{98C5}\x{98C6}\x{98C8}\x{98C9}\x{98CB}\x{98CC}' + . '\x{98CD}\x{98CE}\x{98CF}\x{98D0}\x{98D1}\x{98D2}\x{98D3}\x{98D4}\x{98D5}' + . '\x{98D6}\x{98D7}\x{98D8}\x{98D9}\x{98DA}\x{98DB}\x{98DC}\x{98DD}\x{98DE}' + . '\x{98DF}\x{98E0}\x{98E2}\x{98E3}\x{98E5}\x{98E6}\x{98E7}\x{98E8}\x{98E9}' + . '\x{98EA}\x{98EB}\x{98ED}\x{98EF}\x{98F0}\x{98F2}\x{98F3}\x{98F4}\x{98F5}' + . '\x{98F6}\x{98F7}\x{98F9}\x{98FA}\x{98FC}\x{98FD}\x{98FE}\x{98FF}\x{9900}' + . '\x{9901}\x{9902}\x{9903}\x{9904}\x{9905}\x{9906}\x{9907}\x{9908}\x{9909}' + . '\x{990A}\x{990B}\x{990C}\x{990D}\x{990E}\x{990F}\x{9910}\x{9911}\x{9912}' + . '\x{9913}\x{9914}\x{9915}\x{9916}\x{9917}\x{9918}\x{991A}\x{991B}\x{991C}' + . '\x{991D}\x{991E}\x{991F}\x{9920}\x{9921}\x{9922}\x{9923}\x{9924}\x{9925}' + . '\x{9926}\x{9927}\x{9928}\x{9929}\x{992A}\x{992B}\x{992C}\x{992D}\x{992E}' + . '\x{992F}\x{9930}\x{9931}\x{9932}\x{9933}\x{9934}\x{9935}\x{9936}\x{9937}' + . '\x{9938}\x{9939}\x{993A}\x{993C}\x{993D}\x{993E}\x{993F}\x{9940}\x{9941}' + . '\x{9942}\x{9943}\x{9945}\x{9946}\x{9947}\x{9948}\x{9949}\x{994A}\x{994B}' + . '\x{994C}\x{994E}\x{994F}\x{9950}\x{9951}\x{9952}\x{9953}\x{9954}\x{9955}' + . '\x{9956}\x{9957}\x{9958}\x{9959}\x{995B}\x{995C}\x{995E}\x{995F}\x{9960}' + . '\x{9961}\x{9962}\x{9963}\x{9964}\x{9965}\x{9966}\x{9967}\x{9968}\x{9969}' + . '\x{996A}\x{996B}\x{996C}\x{996D}\x{996E}\x{996F}\x{9970}\x{9971}\x{9972}' + . '\x{9973}\x{9974}\x{9975}\x{9976}\x{9977}\x{9978}\x{9979}\x{997A}\x{997B}' + . '\x{997C}\x{997D}\x{997E}\x{997F}\x{9980}\x{9981}\x{9982}\x{9983}\x{9984}' + . '\x{9985}\x{9986}\x{9987}\x{9988}\x{9989}\x{998A}\x{998B}\x{998C}\x{998D}' + . '\x{998E}\x{998F}\x{9990}\x{9991}\x{9992}\x{9993}\x{9994}\x{9995}\x{9996}' + . '\x{9997}\x{9998}\x{9999}\x{999A}\x{999B}\x{999C}\x{999D}\x{999E}\x{999F}' + . '\x{99A0}\x{99A1}\x{99A2}\x{99A3}\x{99A4}\x{99A5}\x{99A6}\x{99A7}\x{99A8}' + . '\x{99A9}\x{99AA}\x{99AB}\x{99AC}\x{99AD}\x{99AE}\x{99AF}\x{99B0}\x{99B1}' + . '\x{99B2}\x{99B3}\x{99B4}\x{99B5}\x{99B6}\x{99B7}\x{99B8}\x{99B9}\x{99BA}' + . '\x{99BB}\x{99BC}\x{99BD}\x{99BE}\x{99C0}\x{99C1}\x{99C2}\x{99C3}\x{99C4}' + . '\x{99C6}\x{99C7}\x{99C8}\x{99C9}\x{99CA}\x{99CB}\x{99CC}\x{99CD}\x{99CE}' + . '\x{99CF}\x{99D0}\x{99D1}\x{99D2}\x{99D3}\x{99D4}\x{99D5}\x{99D6}\x{99D7}' + . '\x{99D8}\x{99D9}\x{99DA}\x{99DB}\x{99DC}\x{99DD}\x{99DE}\x{99DF}\x{99E1}' + . '\x{99E2}\x{99E3}\x{99E4}\x{99E5}\x{99E7}\x{99E8}\x{99E9}\x{99EA}\x{99EC}' + . '\x{99ED}\x{99EE}\x{99EF}\x{99F0}\x{99F1}\x{99F2}\x{99F3}\x{99F4}\x{99F6}' + . '\x{99F7}\x{99F8}\x{99F9}\x{99FA}\x{99FB}\x{99FC}\x{99FD}\x{99FE}\x{99FF}' + . '\x{9A00}\x{9A01}\x{9A02}\x{9A03}\x{9A04}\x{9A05}\x{9A06}\x{9A07}\x{9A08}' + . '\x{9A09}\x{9A0A}\x{9A0B}\x{9A0C}\x{9A0D}\x{9A0E}\x{9A0F}\x{9A11}\x{9A14}' + . '\x{9A15}\x{9A16}\x{9A19}\x{9A1A}\x{9A1B}\x{9A1C}\x{9A1D}\x{9A1E}\x{9A1F}' + . '\x{9A20}\x{9A21}\x{9A22}\x{9A23}\x{9A24}\x{9A25}\x{9A26}\x{9A27}\x{9A29}' + . '\x{9A2A}\x{9A2B}\x{9A2C}\x{9A2D}\x{9A2E}\x{9A2F}\x{9A30}\x{9A31}\x{9A32}' + . '\x{9A33}\x{9A34}\x{9A35}\x{9A36}\x{9A37}\x{9A38}\x{9A39}\x{9A3A}\x{9A3C}' + . '\x{9A3D}\x{9A3E}\x{9A3F}\x{9A40}\x{9A41}\x{9A42}\x{9A43}\x{9A44}\x{9A45}' + . '\x{9A46}\x{9A47}\x{9A48}\x{9A49}\x{9A4A}\x{9A4B}\x{9A4C}\x{9A4D}\x{9A4E}' + . '\x{9A4F}\x{9A50}\x{9A52}\x{9A53}\x{9A54}\x{9A55}\x{9A56}\x{9A57}\x{9A59}' + . '\x{9A5A}\x{9A5B}\x{9A5C}\x{9A5E}\x{9A5F}\x{9A60}\x{9A61}\x{9A62}\x{9A64}' + . '\x{9A65}\x{9A66}\x{9A67}\x{9A68}\x{9A69}\x{9A6A}\x{9A6B}\x{9A6C}\x{9A6D}' + . '\x{9A6E}\x{9A6F}\x{9A70}\x{9A71}\x{9A72}\x{9A73}\x{9A74}\x{9A75}\x{9A76}' + . '\x{9A77}\x{9A78}\x{9A79}\x{9A7A}\x{9A7B}\x{9A7C}\x{9A7D}\x{9A7E}\x{9A7F}' + . '\x{9A80}\x{9A81}\x{9A82}\x{9A83}\x{9A84}\x{9A85}\x{9A86}\x{9A87}\x{9A88}' + . '\x{9A89}\x{9A8A}\x{9A8B}\x{9A8C}\x{9A8D}\x{9A8E}\x{9A8F}\x{9A90}\x{9A91}' + . '\x{9A92}\x{9A93}\x{9A94}\x{9A95}\x{9A96}\x{9A97}\x{9A98}\x{9A99}\x{9A9A}' + . '\x{9A9B}\x{9A9C}\x{9A9D}\x{9A9E}\x{9A9F}\x{9AA0}\x{9AA1}\x{9AA2}\x{9AA3}' + . '\x{9AA4}\x{9AA5}\x{9AA6}\x{9AA7}\x{9AA8}\x{9AAA}\x{9AAB}\x{9AAC}\x{9AAD}' + . '\x{9AAE}\x{9AAF}\x{9AB0}\x{9AB1}\x{9AB2}\x{9AB3}\x{9AB4}\x{9AB5}\x{9AB6}' + . '\x{9AB7}\x{9AB8}\x{9AB9}\x{9ABA}\x{9ABB}\x{9ABC}\x{9ABE}\x{9ABF}\x{9AC0}' + . '\x{9AC1}\x{9AC2}\x{9AC3}\x{9AC4}\x{9AC5}\x{9AC6}\x{9AC7}\x{9AC9}\x{9ACA}' + . '\x{9ACB}\x{9ACC}\x{9ACD}\x{9ACE}\x{9ACF}\x{9AD0}\x{9AD1}\x{9AD2}\x{9AD3}' + . '\x{9AD4}\x{9AD5}\x{9AD6}\x{9AD8}\x{9AD9}\x{9ADA}\x{9ADB}\x{9ADC}\x{9ADD}' + . '\x{9ADE}\x{9ADF}\x{9AE1}\x{9AE2}\x{9AE3}\x{9AE5}\x{9AE6}\x{9AE7}\x{9AEA}' + . '\x{9AEB}\x{9AEC}\x{9AED}\x{9AEE}\x{9AEF}\x{9AF1}\x{9AF2}\x{9AF3}\x{9AF4}' + . '\x{9AF5}\x{9AF6}\x{9AF7}\x{9AF8}\x{9AF9}\x{9AFA}\x{9AFB}\x{9AFC}\x{9AFD}' + . '\x{9AFE}\x{9AFF}\x{9B01}\x{9B03}\x{9B04}\x{9B05}\x{9B06}\x{9B07}\x{9B08}' + . '\x{9B0A}\x{9B0B}\x{9B0C}\x{9B0D}\x{9B0E}\x{9B0F}\x{9B10}\x{9B11}\x{9B12}' + . '\x{9B13}\x{9B15}\x{9B16}\x{9B17}\x{9B18}\x{9B19}\x{9B1A}\x{9B1C}\x{9B1D}' + . '\x{9B1E}\x{9B1F}\x{9B20}\x{9B21}\x{9B22}\x{9B23}\x{9B24}\x{9B25}\x{9B26}' + . '\x{9B27}\x{9B28}\x{9B29}\x{9B2A}\x{9B2B}\x{9B2C}\x{9B2D}\x{9B2E}\x{9B2F}' + . '\x{9B30}\x{9B31}\x{9B32}\x{9B33}\x{9B35}\x{9B36}\x{9B37}\x{9B38}\x{9B39}' + . '\x{9B3A}\x{9B3B}\x{9B3C}\x{9B3E}\x{9B3F}\x{9B41}\x{9B42}\x{9B43}\x{9B44}' + . '\x{9B45}\x{9B46}\x{9B47}\x{9B48}\x{9B49}\x{9B4A}\x{9B4B}\x{9B4C}\x{9B4D}' + . '\x{9B4E}\x{9B4F}\x{9B51}\x{9B52}\x{9B53}\x{9B54}\x{9B55}\x{9B56}\x{9B58}' + . '\x{9B59}\x{9B5A}\x{9B5B}\x{9B5C}\x{9B5D}\x{9B5E}\x{9B5F}\x{9B60}\x{9B61}' + . '\x{9B63}\x{9B64}\x{9B65}\x{9B66}\x{9B67}\x{9B68}\x{9B69}\x{9B6A}\x{9B6B}' + . '\x{9B6C}\x{9B6D}\x{9B6E}\x{9B6F}\x{9B70}\x{9B71}\x{9B73}\x{9B74}\x{9B75}' + . '\x{9B76}\x{9B77}\x{9B78}\x{9B79}\x{9B7A}\x{9B7B}\x{9B7C}\x{9B7D}\x{9B7E}' + . '\x{9B7F}\x{9B80}\x{9B81}\x{9B82}\x{9B83}\x{9B84}\x{9B85}\x{9B86}\x{9B87}' + . '\x{9B88}\x{9B8A}\x{9B8B}\x{9B8D}\x{9B8E}\x{9B8F}\x{9B90}\x{9B91}\x{9B92}' + . '\x{9B93}\x{9B94}\x{9B95}\x{9B96}\x{9B97}\x{9B98}\x{9B9A}\x{9B9B}\x{9B9C}' + . '\x{9B9D}\x{9B9E}\x{9B9F}\x{9BA0}\x{9BA1}\x{9BA2}\x{9BA3}\x{9BA4}\x{9BA5}' + . '\x{9BA6}\x{9BA7}\x{9BA8}\x{9BA9}\x{9BAA}\x{9BAB}\x{9BAC}\x{9BAD}\x{9BAE}' + . '\x{9BAF}\x{9BB0}\x{9BB1}\x{9BB2}\x{9BB3}\x{9BB4}\x{9BB5}\x{9BB6}\x{9BB7}' + . '\x{9BB8}\x{9BB9}\x{9BBA}\x{9BBB}\x{9BBC}\x{9BBD}\x{9BBE}\x{9BBF}\x{9BC0}' + . '\x{9BC1}\x{9BC3}\x{9BC4}\x{9BC5}\x{9BC6}\x{9BC7}\x{9BC8}\x{9BC9}\x{9BCA}' + . '\x{9BCB}\x{9BCC}\x{9BCD}\x{9BCE}\x{9BCF}\x{9BD0}\x{9BD1}\x{9BD2}\x{9BD3}' + . '\x{9BD4}\x{9BD5}\x{9BD6}\x{9BD7}\x{9BD8}\x{9BD9}\x{9BDA}\x{9BDB}\x{9BDC}' + . '\x{9BDD}\x{9BDE}\x{9BDF}\x{9BE0}\x{9BE1}\x{9BE2}\x{9BE3}\x{9BE4}\x{9BE5}' + . '\x{9BE6}\x{9BE7}\x{9BE8}\x{9BE9}\x{9BEA}\x{9BEB}\x{9BEC}\x{9BED}\x{9BEE}' + . '\x{9BEF}\x{9BF0}\x{9BF1}\x{9BF2}\x{9BF3}\x{9BF4}\x{9BF5}\x{9BF7}\x{9BF8}' + . '\x{9BF9}\x{9BFA}\x{9BFB}\x{9BFC}\x{9BFD}\x{9BFE}\x{9BFF}\x{9C02}\x{9C05}' + . '\x{9C06}\x{9C07}\x{9C08}\x{9C09}\x{9C0A}\x{9C0B}\x{9C0C}\x{9C0D}\x{9C0E}' + . '\x{9C0F}\x{9C10}\x{9C11}\x{9C12}\x{9C13}\x{9C14}\x{9C15}\x{9C16}\x{9C17}' + . '\x{9C18}\x{9C19}\x{9C1A}\x{9C1B}\x{9C1C}\x{9C1D}\x{9C1E}\x{9C1F}\x{9C20}' + . '\x{9C21}\x{9C22}\x{9C23}\x{9C24}\x{9C25}\x{9C26}\x{9C27}\x{9C28}\x{9C29}' + . '\x{9C2A}\x{9C2B}\x{9C2C}\x{9C2D}\x{9C2F}\x{9C30}\x{9C31}\x{9C32}\x{9C33}' + . '\x{9C34}\x{9C35}\x{9C36}\x{9C37}\x{9C38}\x{9C39}\x{9C3A}\x{9C3B}\x{9C3C}' + . '\x{9C3D}\x{9C3E}\x{9C3F}\x{9C40}\x{9C41}\x{9C43}\x{9C44}\x{9C45}\x{9C46}' + . '\x{9C47}\x{9C48}\x{9C49}\x{9C4A}\x{9C4B}\x{9C4C}\x{9C4D}\x{9C4E}\x{9C50}' + . '\x{9C52}\x{9C53}\x{9C54}\x{9C55}\x{9C56}\x{9C57}\x{9C58}\x{9C59}\x{9C5A}' + . '\x{9C5B}\x{9C5C}\x{9C5D}\x{9C5E}\x{9C5F}\x{9C60}\x{9C62}\x{9C63}\x{9C65}' + . '\x{9C66}\x{9C67}\x{9C68}\x{9C69}\x{9C6A}\x{9C6B}\x{9C6C}\x{9C6D}\x{9C6E}' + . '\x{9C6F}\x{9C70}\x{9C71}\x{9C72}\x{9C73}\x{9C74}\x{9C75}\x{9C77}\x{9C78}' + . '\x{9C79}\x{9C7A}\x{9C7C}\x{9C7D}\x{9C7E}\x{9C7F}\x{9C80}\x{9C81}\x{9C82}' + . '\x{9C83}\x{9C84}\x{9C85}\x{9C86}\x{9C87}\x{9C88}\x{9C89}\x{9C8A}\x{9C8B}' + . '\x{9C8C}\x{9C8D}\x{9C8E}\x{9C8F}\x{9C90}\x{9C91}\x{9C92}\x{9C93}\x{9C94}' + . '\x{9C95}\x{9C96}\x{9C97}\x{9C98}\x{9C99}\x{9C9A}\x{9C9B}\x{9C9C}\x{9C9D}' + . '\x{9C9E}\x{9C9F}\x{9CA0}\x{9CA1}\x{9CA2}\x{9CA3}\x{9CA4}\x{9CA5}\x{9CA6}' + . '\x{9CA7}\x{9CA8}\x{9CA9}\x{9CAA}\x{9CAB}\x{9CAC}\x{9CAD}\x{9CAE}\x{9CAF}' + . '\x{9CB0}\x{9CB1}\x{9CB2}\x{9CB3}\x{9CB4}\x{9CB5}\x{9CB6}\x{9CB7}\x{9CB8}' + . '\x{9CB9}\x{9CBA}\x{9CBB}\x{9CBC}\x{9CBD}\x{9CBE}\x{9CBF}\x{9CC0}\x{9CC1}' + . '\x{9CC2}\x{9CC3}\x{9CC4}\x{9CC5}\x{9CC6}\x{9CC7}\x{9CC8}\x{9CC9}\x{9CCA}' + . '\x{9CCB}\x{9CCC}\x{9CCD}\x{9CCE}\x{9CCF}\x{9CD0}\x{9CD1}\x{9CD2}\x{9CD3}' + . '\x{9CD4}\x{9CD5}\x{9CD6}\x{9CD7}\x{9CD8}\x{9CD9}\x{9CDA}\x{9CDB}\x{9CDC}' + . '\x{9CDD}\x{9CDE}\x{9CDF}\x{9CE0}\x{9CE1}\x{9CE2}\x{9CE3}\x{9CE4}\x{9CE5}' + . '\x{9CE6}\x{9CE7}\x{9CE8}\x{9CE9}\x{9CEA}\x{9CEB}\x{9CEC}\x{9CED}\x{9CEE}' + . '\x{9CEF}\x{9CF0}\x{9CF1}\x{9CF2}\x{9CF3}\x{9CF4}\x{9CF5}\x{9CF6}\x{9CF7}' + . '\x{9CF8}\x{9CF9}\x{9CFA}\x{9CFB}\x{9CFC}\x{9CFD}\x{9CFE}\x{9CFF}\x{9D00}' + . '\x{9D01}\x{9D02}\x{9D03}\x{9D04}\x{9D05}\x{9D06}\x{9D07}\x{9D08}\x{9D09}' + . '\x{9D0A}\x{9D0B}\x{9D0F}\x{9D10}\x{9D12}\x{9D13}\x{9D14}\x{9D15}\x{9D16}' + . '\x{9D17}\x{9D18}\x{9D19}\x{9D1A}\x{9D1B}\x{9D1C}\x{9D1D}\x{9D1E}\x{9D1F}' + . '\x{9D20}\x{9D21}\x{9D22}\x{9D23}\x{9D24}\x{9D25}\x{9D26}\x{9D28}\x{9D29}' + . '\x{9D2B}\x{9D2D}\x{9D2E}\x{9D2F}\x{9D30}\x{9D31}\x{9D32}\x{9D33}\x{9D34}' + . '\x{9D36}\x{9D37}\x{9D38}\x{9D39}\x{9D3A}\x{9D3B}\x{9D3D}\x{9D3E}\x{9D3F}' + . '\x{9D40}\x{9D41}\x{9D42}\x{9D43}\x{9D45}\x{9D46}\x{9D47}\x{9D48}\x{9D49}' + . '\x{9D4A}\x{9D4B}\x{9D4C}\x{9D4D}\x{9D4E}\x{9D4F}\x{9D50}\x{9D51}\x{9D52}' + . '\x{9D53}\x{9D54}\x{9D55}\x{9D56}\x{9D57}\x{9D58}\x{9D59}\x{9D5A}\x{9D5B}' + . '\x{9D5C}\x{9D5D}\x{9D5E}\x{9D5F}\x{9D60}\x{9D61}\x{9D62}\x{9D63}\x{9D64}' + . '\x{9D65}\x{9D66}\x{9D67}\x{9D68}\x{9D69}\x{9D6A}\x{9D6B}\x{9D6C}\x{9D6E}' + . '\x{9D6F}\x{9D70}\x{9D71}\x{9D72}\x{9D73}\x{9D74}\x{9D75}\x{9D76}\x{9D77}' + . '\x{9D78}\x{9D79}\x{9D7A}\x{9D7B}\x{9D7C}\x{9D7D}\x{9D7E}\x{9D7F}\x{9D80}' + . '\x{9D81}\x{9D82}\x{9D83}\x{9D84}\x{9D85}\x{9D86}\x{9D87}\x{9D88}\x{9D89}' + . '\x{9D8A}\x{9D8B}\x{9D8C}\x{9D8D}\x{9D8E}\x{9D90}\x{9D91}\x{9D92}\x{9D93}' + . '\x{9D94}\x{9D96}\x{9D97}\x{9D98}\x{9D99}\x{9D9A}\x{9D9B}\x{9D9C}\x{9D9D}' + . '\x{9D9E}\x{9D9F}\x{9DA0}\x{9DA1}\x{9DA2}\x{9DA3}\x{9DA4}\x{9DA5}\x{9DA6}' + . '\x{9DA7}\x{9DA8}\x{9DA9}\x{9DAA}\x{9DAB}\x{9DAC}\x{9DAD}\x{9DAF}\x{9DB0}' + . '\x{9DB1}\x{9DB2}\x{9DB3}\x{9DB4}\x{9DB5}\x{9DB6}\x{9DB7}\x{9DB8}\x{9DB9}' + . '\x{9DBA}\x{9DBB}\x{9DBC}\x{9DBE}\x{9DBF}\x{9DC1}\x{9DC2}\x{9DC3}\x{9DC4}' + . '\x{9DC5}\x{9DC7}\x{9DC8}\x{9DC9}\x{9DCA}\x{9DCB}\x{9DCC}\x{9DCD}\x{9DCE}' + . '\x{9DCF}\x{9DD0}\x{9DD1}\x{9DD2}\x{9DD3}\x{9DD4}\x{9DD5}\x{9DD6}\x{9DD7}' + . '\x{9DD8}\x{9DD9}\x{9DDA}\x{9DDB}\x{9DDC}\x{9DDD}\x{9DDE}\x{9DDF}\x{9DE0}' + . '\x{9DE1}\x{9DE2}\x{9DE3}\x{9DE4}\x{9DE5}\x{9DE6}\x{9DE7}\x{9DE8}\x{9DE9}' + . '\x{9DEB}\x{9DEC}\x{9DED}\x{9DEE}\x{9DEF}\x{9DF0}\x{9DF1}\x{9DF2}\x{9DF3}' + . '\x{9DF4}\x{9DF5}\x{9DF6}\x{9DF7}\x{9DF8}\x{9DF9}\x{9DFA}\x{9DFB}\x{9DFD}' + . '\x{9DFE}\x{9DFF}\x{9E00}\x{9E01}\x{9E02}\x{9E03}\x{9E04}\x{9E05}\x{9E06}' + . '\x{9E07}\x{9E08}\x{9E09}\x{9E0A}\x{9E0B}\x{9E0C}\x{9E0D}\x{9E0F}\x{9E10}' + . '\x{9E11}\x{9E12}\x{9E13}\x{9E14}\x{9E15}\x{9E17}\x{9E18}\x{9E19}\x{9E1A}' + . '\x{9E1B}\x{9E1D}\x{9E1E}\x{9E1F}\x{9E20}\x{9E21}\x{9E22}\x{9E23}\x{9E24}' + . '\x{9E25}\x{9E26}\x{9E27}\x{9E28}\x{9E29}\x{9E2A}\x{9E2B}\x{9E2C}\x{9E2D}' + . '\x{9E2E}\x{9E2F}\x{9E30}\x{9E31}\x{9E32}\x{9E33}\x{9E34}\x{9E35}\x{9E36}' + . '\x{9E37}\x{9E38}\x{9E39}\x{9E3A}\x{9E3B}\x{9E3C}\x{9E3D}\x{9E3E}\x{9E3F}' + . '\x{9E40}\x{9E41}\x{9E42}\x{9E43}\x{9E44}\x{9E45}\x{9E46}\x{9E47}\x{9E48}' + . '\x{9E49}\x{9E4A}\x{9E4B}\x{9E4C}\x{9E4D}\x{9E4E}\x{9E4F}\x{9E50}\x{9E51}' + . '\x{9E52}\x{9E53}\x{9E54}\x{9E55}\x{9E56}\x{9E57}\x{9E58}\x{9E59}\x{9E5A}' + . '\x{9E5B}\x{9E5C}\x{9E5D}\x{9E5E}\x{9E5F}\x{9E60}\x{9E61}\x{9E62}\x{9E63}' + . '\x{9E64}\x{9E65}\x{9E66}\x{9E67}\x{9E68}\x{9E69}\x{9E6A}\x{9E6B}\x{9E6C}' + . '\x{9E6D}\x{9E6E}\x{9E6F}\x{9E70}\x{9E71}\x{9E72}\x{9E73}\x{9E74}\x{9E75}' + . '\x{9E76}\x{9E77}\x{9E79}\x{9E7A}\x{9E7C}\x{9E7D}\x{9E7E}\x{9E7F}\x{9E80}' + . '\x{9E81}\x{9E82}\x{9E83}\x{9E84}\x{9E85}\x{9E86}\x{9E87}\x{9E88}\x{9E89}' + . '\x{9E8A}\x{9E8B}\x{9E8C}\x{9E8D}\x{9E8E}\x{9E91}\x{9E92}\x{9E93}\x{9E94}' + . '\x{9E96}\x{9E97}\x{9E99}\x{9E9A}\x{9E9B}\x{9E9C}\x{9E9D}\x{9E9F}\x{9EA0}' + . '\x{9EA1}\x{9EA3}\x{9EA4}\x{9EA5}\x{9EA6}\x{9EA7}\x{9EA8}\x{9EA9}\x{9EAA}' + . '\x{9EAD}\x{9EAE}\x{9EAF}\x{9EB0}\x{9EB2}\x{9EB3}\x{9EB4}\x{9EB5}\x{9EB6}' + . '\x{9EB7}\x{9EB8}\x{9EBB}\x{9EBC}\x{9EBD}\x{9EBE}\x{9EBF}\x{9EC0}\x{9EC1}' + . '\x{9EC2}\x{9EC3}\x{9EC4}\x{9EC5}\x{9EC6}\x{9EC7}\x{9EC8}\x{9EC9}\x{9ECA}' + . '\x{9ECB}\x{9ECC}\x{9ECD}\x{9ECE}\x{9ECF}\x{9ED0}\x{9ED1}\x{9ED2}\x{9ED3}' + . '\x{9ED4}\x{9ED5}\x{9ED6}\x{9ED7}\x{9ED8}\x{9ED9}\x{9EDA}\x{9EDB}\x{9EDC}' + . '\x{9EDD}\x{9EDE}\x{9EDF}\x{9EE0}\x{9EE1}\x{9EE2}\x{9EE3}\x{9EE4}\x{9EE5}' + . '\x{9EE6}\x{9EE7}\x{9EE8}\x{9EE9}\x{9EEA}\x{9EEB}\x{9EED}\x{9EEE}\x{9EEF}' + . '\x{9EF0}\x{9EF2}\x{9EF3}\x{9EF4}\x{9EF5}\x{9EF6}\x{9EF7}\x{9EF8}\x{9EF9}' + . '\x{9EFA}\x{9EFB}\x{9EFC}\x{9EFD}\x{9EFE}\x{9EFF}\x{9F00}\x{9F01}\x{9F02}' + . '\x{9F04}\x{9F05}\x{9F06}\x{9F07}\x{9F08}\x{9F09}\x{9F0A}\x{9F0B}\x{9F0C}' + . '\x{9F0D}\x{9F0E}\x{9F0F}\x{9F10}\x{9F12}\x{9F13}\x{9F15}\x{9F16}\x{9F17}' + . '\x{9F18}\x{9F19}\x{9F1A}\x{9F1B}\x{9F1C}\x{9F1D}\x{9F1E}\x{9F1F}\x{9F20}' + . '\x{9F22}\x{9F23}\x{9F24}\x{9F25}\x{9F27}\x{9F28}\x{9F29}\x{9F2A}\x{9F2B}' + . '\x{9F2C}\x{9F2D}\x{9F2E}\x{9F2F}\x{9F30}\x{9F31}\x{9F32}\x{9F33}\x{9F34}' + . '\x{9F35}\x{9F36}\x{9F37}\x{9F38}\x{9F39}\x{9F3A}\x{9F3B}\x{9F3C}\x{9F3D}' + . '\x{9F3E}\x{9F3F}\x{9F40}\x{9F41}\x{9F42}\x{9F43}\x{9F44}\x{9F46}\x{9F47}' + . '\x{9F48}\x{9F49}\x{9F4A}\x{9F4B}\x{9F4C}\x{9F4D}\x{9F4E}\x{9F4F}\x{9F50}' + . '\x{9F51}\x{9F52}\x{9F54}\x{9F55}\x{9F56}\x{9F57}\x{9F58}\x{9F59}\x{9F5A}' + . '\x{9F5B}\x{9F5C}\x{9F5D}\x{9F5E}\x{9F5F}\x{9F60}\x{9F61}\x{9F63}\x{9F64}' + . '\x{9F65}\x{9F66}\x{9F67}\x{9F68}\x{9F69}\x{9F6A}\x{9F6B}\x{9F6C}\x{9F6E}' + . '\x{9F6F}\x{9F70}\x{9F71}\x{9F72}\x{9F73}\x{9F74}\x{9F75}\x{9F76}\x{9F77}' + . '\x{9F78}\x{9F79}\x{9F7A}\x{9F7B}\x{9F7C}\x{9F7D}\x{9F7E}\x{9F7F}\x{9F80}' + . '\x{9F81}\x{9F82}\x{9F83}\x{9F84}\x{9F85}\x{9F86}\x{9F87}\x{9F88}\x{9F89}' + . '\x{9F8A}\x{9F8B}\x{9F8C}\x{9F8D}\x{9F8E}\x{9F8F}\x{9F90}\x{9F91}\x{9F92}' + . '\x{9F93}\x{9F94}\x{9F95}\x{9F96}\x{9F97}\x{9F98}\x{9F99}\x{9F9A}\x{9F9B}' + . '\x{9F9C}\x{9F9D}\x{9F9E}\x{9F9F}\x{9FA0}\x{9FA2}\x{9FA4}\x{9FA5}]{1,20}$/iu', +]; diff --git a/vendor/laminas/laminas-validator/src/Hostname/Com.php b/vendor/laminas/laminas-validator/src/Hostname/Com.php new file mode 100644 index 00000000..5db58df6 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Hostname/Com.php @@ -0,0 +1,176 @@ + '/^[\x{002d}0-9\x{0400}-\x{052f}]{1,63}$/iu', + 2 => '/^[\x{002d}0-9\x{0370}-\x{03ff}]{1,63}$/iu', + 3 => '/^[\x{002d}0-9a-z\x{ac00}-\x{d7a3}]{1,17}$/iu', + // @codingStandardsIgnoreStart + 4 => '/^[\x{002d}0-9a-z·à-öø-ÿāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıĵķĸĺļľłńņňŋōŏőœŕŗřśŝşšţťŧũūŭůűųŵŷźżž]{1,63}$/iu', + // @codingStandardsIgnoreEnd + 5 => '/^[\x{002d}0-9A-Za-z\x{3400}-\x{3401}\x{3404}-\x{3406}\x{340C}\x{3416}\x{341C}' +. '\x{3421}\x{3424}\x{3428}-\x{3429}\x{342B}-\x{342E}\x{3430}-\x{3434}\x{3436}' +. '\x{3438}-\x{343C}\x{343E}\x{3441}-\x{3445}\x{3447}\x{3449}-\x{3451}\x{3453}' +. '\x{3457}-\x{345F}\x{3463}-\x{3467}\x{346E}-\x{3471}\x{3473}-\x{3477}\x{3479}-\x{348E}\x{3491}-\x{3497}' +. '\x{3499}-\x{34A1}\x{34A4}-\x{34AD}\x{34AF}-\x{34B0}\x{34B2}-\x{34BF}\x{34C2}-\x{34C5}\x{34C7}-\x{34CC}' +. '\x{34CE}-\x{34D1}\x{34D3}-\x{34D8}\x{34DA}-\x{34E4}\x{34E7}-\x{34E9}\x{34EC}-\x{34EF}\x{34F1}-\x{34FE}' +. '\x{3500}-\x{3507}\x{350A}-\x{3513}\x{3515}\x{3517}-\x{351A}\x{351C}-\x{351E}\x{3520}-\x{352A}' +. '\x{352C}-\x{3552}\x{3554}-\x{355C}\x{355E}-\x{3567}\x{3569}-\x{3573}\x{3575}-\x{357C}\x{3580}-\x{3588}' +. '\x{358F}-\x{3598}\x{359E}-\x{35AB}\x{35B4}-\x{35CD}\x{35D0}\x{35D3}-\x{35DC}\x{35E2}-\x{35ED}' +. '\x{35F0}-\x{35F6}\x{35FB}-\x{3602}\x{3605}-\x{360E}\x{3610}-\x{3611}\x{3613}-\x{3616}\x{3619}-\x{362D}' +. '\x{362F}-\x{3634}\x{3636}-\x{363B}\x{363F}-\x{3645}\x{3647}-\x{364B}\x{364D}-\x{3653}\x{3655}' +. '\x{3659}-\x{365E}\x{3660}-\x{3665}\x{3667}-\x{367C}\x{367E}\x{3680}-\x{3685}\x{3687}' +. '\x{3689}-\x{3690}\x{3692}-\x{3698}\x{369A}\x{369C}-\x{36AE}\x{36B0}-\x{36BF}\x{36C1}-\x{36C5}' +. '\x{36C9}-\x{36CA}\x{36CD}-\x{36DE}\x{36E1}-\x{36E2}\x{36E5}-\x{36FE}\x{3701}-\x{3713}\x{3715}-\x{371E}' +. '\x{3720}-\x{372C}\x{372E}-\x{3745}\x{3747}-\x{3748}\x{374A}\x{374C}-\x{3759}\x{375B}-\x{3760}' +. '\x{3762}-\x{3767}\x{3769}-\x{3772}\x{3774}-\x{378C}\x{378F}-\x{379C}\x{379F}\x{37A1}-\x{37AD}' +. '\x{37AF}-\x{37B7}\x{37B9}-\x{37C1}\x{37C3}-\x{37C5}\x{37C7}-\x{37D4}\x{37D6}-\x{37E0}\x{37E2}' +. '\x{37E5}-\x{37ED}\x{37EF}-\x{37F6}\x{37F8}-\x{3802}\x{3804}-\x{381D}\x{3820}-\x{3822}\x{3825}-\x{382A}' +. '\x{382D}-\x{382F}\x{3831}-\x{3832}\x{3834}-\x{384C}\x{384E}-\x{3860}\x{3862}-\x{3863}\x{3865}-\x{386B}' +. '\x{386D}-\x{3886}\x{3888}-\x{38A1}\x{38A3}\x{38A5}-\x{38AA}\x{38AC}\x{38AE}-\x{38B0}' +. '\x{38B2}-\x{38B6}\x{38B8}\x{38BA}-\x{38BE}\x{38C0}-\x{38C9}\x{38CB}-\x{38D4}\x{38D8}-\x{38E0}' +. '\x{38E2}-\x{38E6}\x{38EB}-\x{38ED}\x{38EF}-\x{38F2}\x{38F5}-\x{38F7}\x{38FA}-\x{38FF}\x{3901}-\x{392A}' +. '\x{392C}\x{392E}-\x{393B}\x{393E}-\x{3956}\x{395A}-\x{3969}\x{396B}-\x{397A}\x{397C}-\x{3987}' +. '\x{3989}-\x{3998}\x{399A}-\x{39B0}\x{39B2}\x{39B4}-\x{39D0}\x{39D2}-\x{39DA}\x{39DE}-\x{39DF}' +. '\x{39E1}-\x{39EF}\x{39F1}-\x{3A17}\x{3A19}-\x{3A2A}\x{3A2D}-\x{3A40}\x{3A43}-\x{3A4E}\x{3A50}' +. '\x{3A52}-\x{3A5E}\x{3A60}-\x{3A6D}\x{3A6F}-\x{3A77}\x{3A79}-\x{3A82}\x{3A84}-\x{3A85}\x{3A87}-\x{3A89}' +. '\x{3A8B}-\x{3A8F}\x{3A91}-\x{3A93}\x{3A95}-\x{3A96}\x{3A9A}\x{3A9C}-\x{3AA6}\x{3AA8}-\x{3AA9}' +. '\x{3AAB}-\x{3AB1}\x{3AB4}-\x{3ABC}\x{3ABE}-\x{3AC5}\x{3ACA}-\x{3ACB}\x{3ACD}-\x{3AD5}\x{3AD7}-\x{3AE1}' +. '\x{3AE4}-\x{3AE7}\x{3AE9}-\x{3AEC}\x{3AEE}-\x{3AFD}\x{3B01}-\x{3B10}\x{3B12}-\x{3B15}\x{3B17}-\x{3B1E}' +. '\x{3B20}-\x{3B23}\x{3B25}-\x{3B27}\x{3B29}-\x{3B36}\x{3B38}-\x{3B39}\x{3B3B}-\x{3B3C}\x{3B3F}' +. '\x{3B41}-\x{3B44}\x{3B47}-\x{3B4C}\x{3B4E}\x{3B51}-\x{3B55}\x{3B58}-\x{3B62}\x{3B68}-\x{3B72}' +. '\x{3B78}-\x{3B88}\x{3B8B}-\x{3B9F}\x{3BA1}\x{3BA3}-\x{3BBA}\x{3BBC}\x{3BBF}-\x{3BD0}' +. '\x{3BD3}-\x{3BE6}\x{3BEA}-\x{3BFB}\x{3BFE}-\x{3C12}\x{3C14}-\x{3C1B}\x{3C1D}-\x{3C37}\x{3C39}-\x{3C4F}' +. '\x{3C52}\x{3C54}-\x{3C5C}\x{3C5E}-\x{3C68}\x{3C6A}-\x{3C76}\x{3C78}-\x{3C8F}\x{3C91}-\x{3CA8}' +. '\x{3CAA}-\x{3CAD}\x{3CAF}-\x{3CBE}\x{3CC0}-\x{3CC8}\x{3CCA}-\x{3CD3}\x{3CD6}-\x{3CE0}\x{3CE4}-\x{3CEE}' +. '\x{3CF3}-\x{3D0A}\x{3D0E}-\x{3D1E}\x{3D20}-\x{3D21}\x{3D25}-\x{3D38}\x{3D3B}-\x{3D46}\x{3D4A}-\x{3D59}' +. '\x{3D5D}-\x{3D7B}\x{3D7D}-\x{3D81}\x{3D84}-\x{3D88}\x{3D8C}-\x{3D8F}\x{3D91}-\x{3D98}\x{3D9A}-\x{3D9C}' +. '\x{3D9E}-\x{3DA1}\x{3DA3}-\x{3DB0}\x{3DB2}-\x{3DB5}\x{3DB9}-\x{3DBC}\x{3DBE}-\x{3DCB}\x{3DCD}-\x{3DDB}' +. '\x{3DDF}-\x{3DE8}\x{3DEB}-\x{3DF0}\x{3DF3}-\x{3DF9}\x{3DFB}-\x{3DFC}\x{3DFE}-\x{3E05}\x{3E08}-\x{3E33}' +. '\x{3E35}-\x{3E3E}\x{3E40}-\x{3E47}\x{3E49}-\x{3E67}\x{3E6B}-\x{3E6F}\x{3E71}-\x{3E85}\x{3E87}-\x{3E8C}' +. '\x{3E8E}-\x{3E98}\x{3E9A}-\x{3EA1}\x{3EA3}-\x{3EAE}\x{3EB0}-\x{3EB5}\x{3EB7}-\x{3EBA}\x{3EBD}' +. '\x{3EBF}-\x{3EC4}\x{3EC7}-\x{3ECE}\x{3ED1}-\x{3ED7}\x{3ED9}-\x{3EDA}\x{3EDD}-\x{3EE3}\x{3EE7}-\x{3EE8}' +. '\x{3EEB}-\x{3EF2}\x{3EF5}-\x{3EFF}\x{3F01}-\x{3F02}\x{3F04}-\x{3F07}\x{3F09}-\x{3F44}\x{3F46}-\x{3F4E}' +. '\x{3F50}-\x{3F53}\x{3F55}-\x{3F72}\x{3F74}-\x{3F75}\x{3F77}-\x{3F7B}\x{3F7D}-\x{3FB0}\x{3FB6}-\x{3FBF}' +. '\x{3FC1}-\x{3FCF}\x{3FD1}-\x{3FD3}\x{3FD5}-\x{3FDF}\x{3FE1}-\x{400B}\x{400D}-\x{401C}\x{401E}-\x{4024}' +. '\x{4027}-\x{403F}\x{4041}-\x{4060}\x{4062}-\x{4069}\x{406B}-\x{408A}\x{408C}-\x{40A7}\x{40A9}-\x{40B4}' +. '\x{40B6}-\x{40C2}\x{40C7}-\x{40CF}\x{40D1}-\x{40DE}\x{40E0}-\x{40E7}\x{40E9}-\x{40EE}\x{40F0}-\x{40FB}' +. '\x{40FD}-\x{4109}\x{410B}-\x{4115}\x{4118}-\x{411D}\x{411F}-\x{4122}\x{4124}-\x{4133}\x{4136}-\x{4138}' +. '\x{413A}-\x{4148}\x{414A}-\x{4169}\x{416C}-\x{4185}\x{4188}-\x{418B}\x{418D}-\x{41AD}\x{41AF}-\x{41B3}' +. '\x{41B5}-\x{41C3}\x{41C5}-\x{41C9}\x{41CB}-\x{41F2}\x{41F5}-\x{41FE}\x{4200}-\x{4227}\x{422A}-\x{4246}' +. '\x{4248}-\x{4263}\x{4265}-\x{428B}\x{428D}-\x{42A1}\x{42A3}-\x{42C4}\x{42C8}-\x{42DC}\x{42DE}-\x{430A}' +. '\x{430C}-\x{4335}\x{4337}\x{4342}-\x{435F}\x{4361}-\x{439A}\x{439C}-\x{439D}\x{439F}-\x{43A4}' +. '\x{43A6}-\x{43EC}\x{43EF}-\x{4405}\x{4407}-\x{4429}\x{442B}-\x{4455}\x{4457}-\x{4468}\x{446A}-\x{446D}' +. '\x{446F}-\x{4476}\x{4479}-\x{447D}\x{447F}-\x{4486}\x{4488}-\x{4490}\x{4492}-\x{4498}\x{449A}-\x{44AD}' +. '\x{44B0}-\x{44BD}\x{44C1}-\x{44D3}\x{44D6}-\x{44E7}\x{44EA}\x{44EC}-\x{44FA}\x{44FC}-\x{4541}' +. '\x{4543}-\x{454F}\x{4551}-\x{4562}\x{4564}-\x{4575}\x{4577}-\x{45AB}\x{45AD}-\x{45BD}\x{45BF}-\x{45D5}' +. '\x{45D7}-\x{45EC}\x{45EE}-\x{45F2}\x{45F4}-\x{45FA}\x{45FC}-\x{461A}\x{461C}-\x{461D}\x{461F}-\x{4631}' +. '\x{4633}-\x{4649}\x{464C}\x{464E}-\x{4652}\x{4654}-\x{466A}\x{466C}-\x{4675}\x{4677}-\x{467A}' +. '\x{467C}-\x{4694}\x{4696}-\x{46A3}\x{46A5}-\x{46AB}\x{46AD}-\x{46D2}\x{46D4}-\x{4723}\x{4729}-\x{4732}' +. '\x{4734}-\x{4758}\x{475A}\x{475C}-\x{478B}\x{478D}\x{4791}-\x{47B1}\x{47B3}-\x{47F1}' +. '\x{47F3}-\x{480B}\x{480D}-\x{4815}\x{4817}-\x{4839}\x{483B}-\x{4870}\x{4872}-\x{487A}\x{487C}-\x{487F}' +. '\x{4883}-\x{488E}\x{4890}-\x{4896}\x{4899}-\x{48A2}\x{48A4}-\x{48B9}\x{48BB}-\x{48C8}\x{48CA}-\x{48D1}' +. '\x{48D3}-\x{48E5}\x{48E7}-\x{48F2}\x{48F4}-\x{48FF}\x{4901}-\x{4922}\x{4924}-\x{4928}\x{492A}-\x{4931}' +. '\x{4933}-\x{495B}\x{495D}-\x{4978}\x{497A}\x{497D}\x{4982}-\x{4983}\x{4985}-\x{49A8}' +. '\x{49AA}-\x{49AF}\x{49B1}-\x{49B7}\x{49B9}-\x{49BD}\x{49C1}-\x{49C7}\x{49C9}-\x{49CE}\x{49D0}-\x{49E8}' +. '\x{49EA}\x{49EC}\x{49EE}-\x{4A19}\x{4A1B}-\x{4A43}\x{4A45}-\x{4A4D}\x{4A4F}-\x{4A9E}' +. '\x{4AA0}-\x{4AA9}\x{4AAB}-\x{4B4E}\x{4B50}-\x{4B5B}\x{4B5D}-\x{4B69}\x{4B6B}-\x{4BC2}\x{4BC6}-\x{4BE8}' +. '\x{4BEA}-\x{4BFA}\x{4BFC}-\x{4C06}\x{4C08}-\x{4C2D}\x{4C2F}-\x{4C32}\x{4C34}-\x{4C35}\x{4C37}-\x{4C69}' +. '\x{4C6B}-\x{4C73}\x{4C75}-\x{4C86}\x{4C88}-\x{4C97}\x{4C99}-\x{4C9C}\x{4C9F}-\x{4CA3}\x{4CA5}-\x{4CB5}' +. '\x{4CB7}-\x{4CF8}\x{4CFA}-\x{4D27}\x{4D29}-\x{4DAC}\x{4DAE}-\x{4DB1}\x{4DB3}-\x{4DB5}\x{4E00}-\x{4E54}' +. '\x{4E56}-\x{4E89}\x{4E8B}-\x{4EEC}\x{4EEE}-\x{4FAC}\x{4FAE}-\x{503C}\x{503E}-\x{51E5}\x{51E7}-\x{5270}' +. '\x{5272}-\x{56A1}\x{56A3}-\x{5840}\x{5842}-\x{58B5}\x{58B7}-\x{58CB}\x{58CD}-\x{5BC8}\x{5BCA}-\x{5C01}' +. '\x{5C03}-\x{5C25}\x{5C27}-\x{5D5B}\x{5D5D}-\x{5F08}\x{5F0A}-\x{61F3}\x{61F5}-\x{63BA}\x{63BC}-\x{6441}' +. '\x{6443}-\x{657C}\x{657E}-\x{663E}\x{6640}-\x{66FC}\x{66FE}-\x{6728}\x{672A}-\x{6766}\x{6768}-\x{67A8}' +. '\x{67AA}-\x{685B}\x{685D}-\x{685E}\x{6860}-\x{68B9}\x{68BB}-\x{6AC8}\x{6ACA}-\x{6BB0}\x{6BB2}-\x{6C16}' +. '\x{6C18}-\x{6D9B}\x{6D9D}-\x{6E12}\x{6E14}-\x{6E8B}\x{6E8D}-\x{704D}\x{704F}-\x{7113}\x{7115}-\x{713B}' +. '\x{713D}-\x{7154}\x{7156}-\x{729F}\x{72A1}-\x{731E}\x{7320}-\x{7362}\x{7364}-\x{7533}\x{7535}-\x{7551}' +. '\x{7553}-\x{7572}\x{7574}-\x{75E8}\x{75EA}-\x{7679}\x{767B}-\x{783E}\x{7840}-\x{7A62}\x{7A64}-\x{7AC2}' +. '\x{7AC4}-\x{7B06}\x{7B08}-\x{7B79}\x{7B7B}-\x{7BCE}\x{7BD0}-\x{7D99}\x{7D9B}-\x{7E49}\x{7E4C}-\x{8132}' +. '\x{8134}\x{8136}-\x{81D2}\x{81D4}-\x{8216}\x{8218}-\x{822D}\x{822F}-\x{83B4}\x{83B6}-\x{841F}' +. '\x{8421}-\x{86CC}\x{86CE}-\x{874A}\x{874C}-\x{877E}\x{8780}-\x{8A32}\x{8A34}-\x{8B71}\x{8B73}-\x{8B8E}' +. '\x{8B90}-\x{8DE4}\x{8DE6}-\x{8E9A}\x{8E9C}-\x{8EE1}\x{8EE4}-\x{8F0B}\x{8F0D}-\x{8FB9}\x{8FBB}-\x{9038}' +. '\x{903A}-\x{9196}\x{9198}-\x{91A3}\x{91A5}-\x{91B7}\x{91B9}-\x{91C7}\x{91C9}-\x{91E0}\x{91E2}-\x{91FB}' +. '\x{91FD}-\x{922B}\x{922D}-\x{9270}\x{9272}-\x{9420}\x{9422}-\x{9664}\x{9666}-\x{9679}\x{967B}-\x{9770}' +. '\x{9772}-\x{982B}\x{982D}-\x{98ED}\x{98EF}-\x{99C4}\x{99C6}-\x{9A11}\x{9A14}-\x{9A27}\x{9A29}-\x{9D0D}' +. '\x{9D0F}-\x{9D2B}\x{9D2D}-\x{9D8E}\x{9D90}-\x{9DC5}\x{9DC7}-\x{9E77}\x{9E79}-\x{9EB8}\x{9EBB}-\x{9F20}' +. '\x{9F22}-\x{9F61}\x{9F63}-\x{9FA5}\x{FA28}]{1,20}$/iu', + 6 => '/^[\x{002d}0-9A-Za-z]{1,63}$/iu', + 7 => '/^[\x{00A1}-\x{00FF}]{1,63}$/iu', + 8 => '/^[\x{0100}-\x{017f}]{1,63}$/iu', + 9 => '/^[\x{0180}-\x{024f}]{1,63}$/iu', + 10 => '/^[\x{0250}-\x{02af}]{1,63}$/iu', + 11 => '/^[\x{02b0}-\x{02ff}]{1,63}$/iu', + 12 => '/^[\x{0300}-\x{036f}]{1,63}$/iu', + 13 => '/^[\x{0370}-\x{03ff}]{1,63}$/iu', + 14 => '/^[\x{0400}-\x{04ff}]{1,63}$/iu', + 15 => '/^[\x{0500}-\x{052f}]{1,63}$/iu', + 16 => '/^[\x{0530}-\x{058F}]{1,63}$/iu', + 17 => '/^[\x{0590}-\x{05FF}]{1,63}$/iu', + 18 => '/^[\x{0600}-\x{06FF}]{1,63}$/iu', + 19 => '/^[\x{0700}-\x{074F}]{1,63}$/iu', + 20 => '/^[\x{0780}-\x{07BF}]{1,63}$/iu', + 21 => '/^[\x{0900}-\x{097F}]{1,63}$/iu', + 22 => '/^[\x{0980}-\x{09FF}]{1,63}$/iu', + 23 => '/^[\x{0A00}-\x{0A7F}]{1,63}$/iu', + 24 => '/^[\x{0A80}-\x{0AFF}]{1,63}$/iu', + 25 => '/^[\x{0B00}-\x{0B7F}]{1,63}$/iu', + 26 => '/^[\x{0B80}-\x{0BFF}]{1,63}$/iu', + 27 => '/^[\x{0C00}-\x{0C7F}]{1,63}$/iu', + 28 => '/^[\x{0C80}-\x{0CFF}]{1,63}$/iu', + 29 => '/^[\x{0D00}-\x{0D7F}]{1,63}$/iu', + 30 => '/^[\x{0D80}-\x{0DFF}]{1,63}$/iu', + 31 => '/^[\x{0E00}-\x{0E7F}]{1,63}$/iu', + 32 => '/^[\x{0E80}-\x{0EFF}]{1,63}$/iu', + 33 => '/^[\x{0F00}-\x{0FFF}]{1,63}$/iu', + 34 => '/^[\x{1000}-\x{109F}]{1,63}$/iu', + 35 => '/^[\x{10A0}-\x{10FF}]{1,63}$/iu', + 36 => '/^[\x{1100}-\x{11FF}]{1,63}$/iu', + 37 => '/^[\x{1200}-\x{137F}]{1,63}$/iu', + 38 => '/^[\x{13A0}-\x{13FF}]{1,63}$/iu', + 39 => '/^[\x{1400}-\x{167F}]{1,63}$/iu', + 40 => '/^[\x{1680}-\x{169F}]{1,63}$/iu', + 41 => '/^[\x{16A0}-\x{16FF}]{1,63}$/iu', + 42 => '/^[\x{1700}-\x{171F}]{1,63}$/iu', + 43 => '/^[\x{1720}-\x{173F}]{1,63}$/iu', + 44 => '/^[\x{1740}-\x{175F}]{1,63}$/iu', + 45 => '/^[\x{1760}-\x{177F}]{1,63}$/iu', + 46 => '/^[\x{1780}-\x{17FF}]{1,63}$/iu', + 47 => '/^[\x{1800}-\x{18AF}]{1,63}$/iu', + 48 => '/^[\x{1E00}-\x{1EFF}]{1,63}$/iu', + 49 => '/^[\x{1F00}-\x{1FFF}]{1,63}$/iu', + 50 => '/^[\x{2070}-\x{209F}]{1,63}$/iu', + 51 => '/^[\x{2100}-\x{214F}]{1,63}$/iu', + 52 => '/^[\x{2150}-\x{218F}]{1,63}$/iu', + 53 => '/^[\x{2460}-\x{24FF}]{1,63}$/iu', + 54 => '/^[\x{2E80}-\x{2EFF}]{1,63}$/iu', + 55 => '/^[\x{2F00}-\x{2FDF}]{1,63}$/iu', + 56 => '/^[\x{2FF0}-\x{2FFF}]{1,63}$/iu', + 57 => '/^[\x{3040}-\x{309F}]{1,63}$/iu', + 58 => '/^[\x{30A0}-\x{30FF}]{1,63}$/iu', + 59 => '/^[\x{3100}-\x{312F}]{1,63}$/iu', + 60 => '/^[\x{3130}-\x{318F}]{1,63}$/iu', + 61 => '/^[\x{3190}-\x{319F}]{1,63}$/iu', + 62 => '/^[\x{31A0}-\x{31BF}]{1,63}$/iu', + 63 => '/^[\x{31F0}-\x{31FF}]{1,63}$/iu', + 64 => '/^[\x{3200}-\x{32FF}]{1,63}$/iu', + 65 => '/^[\x{3300}-\x{33FF}]{1,63}$/iu', + 66 => '/^[\x{3400}-\x{4DBF}]{1,63}$/iu', + 67 => '/^[\x{4E00}-\x{9FFF}]{1,63}$/iu', + 68 => '/^[\x{A000}-\x{A48F}]{1,63}$/iu', + 69 => '/^[\x{A490}-\x{A4CF}]{1,63}$/iu', + 70 => '/^[\x{AC00}-\x{D7AF}]{1,63}$/iu', + 73 => '/^[\x{F900}-\x{FAFF}]{1,63}$/iu', + 74 => '/^[\x{FB00}-\x{FB4F}]{1,63}$/iu', + 75 => '/^[\x{FB50}-\x{FDFF}]{1,63}$/iu', + 76 => '/^[\x{FE20}-\x{FE2F}]{1,63}$/iu', + 77 => '/^[\x{FE70}-\x{FEFF}]{1,63}$/iu', + 78 => '/^[\x{FF00}-\x{FFEF}]{1,63}$/iu', + 79 => '/^[\x{20000}-\x{2A6DF}]{1,63}$/iu', + 80 => '/^[\x{2F800}-\x{2FA1F}]{1,63}$/iu', +]; diff --git a/vendor/laminas/laminas-validator/src/Hostname/Jp.php b/vendor/laminas/laminas-validator/src/Hostname/Jp.php new file mode 100644 index 00000000..8520f6a1 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Hostname/Jp.php @@ -0,0 +1,719 @@ + '/^[\x{002d}0-9a-z\x{3005}-\x{3007}\x{3041}-\x{3093}\x{309D}\x{309E}' + . '\x{30A1}-\x{30F6}\x{30FC}' + . '\x{30FD}\x{30FE}\x{4E00}\x{4E01}\x{4E03}\x{4E07}\x{4E08}\x{4E09}\x{4E0A}' + . '\x{4E0B}\x{4E0D}\x{4E0E}\x{4E10}\x{4E11}\x{4E14}\x{4E15}\x{4E16}\x{4E17}' + . '\x{4E18}\x{4E19}\x{4E1E}\x{4E21}\x{4E26}\x{4E2A}\x{4E2D}\x{4E31}\x{4E32}' + . '\x{4E36}\x{4E38}\x{4E39}\x{4E3B}\x{4E3C}\x{4E3F}\x{4E42}\x{4E43}\x{4E45}' + . '\x{4E4B}\x{4E4D}\x{4E4E}\x{4E4F}\x{4E55}\x{4E56}\x{4E57}\x{4E58}\x{4E59}' + . '\x{4E5D}\x{4E5E}\x{4E5F}\x{4E62}\x{4E71}\x{4E73}\x{4E7E}\x{4E80}\x{4E82}' + . '\x{4E85}\x{4E86}\x{4E88}\x{4E89}\x{4E8A}\x{4E8B}\x{4E8C}\x{4E8E}\x{4E91}' + . '\x{4E92}\x{4E94}\x{4E95}\x{4E98}\x{4E99}\x{4E9B}\x{4E9C}\x{4E9E}\x{4E9F}' + . '\x{4EA0}\x{4EA1}\x{4EA2}\x{4EA4}\x{4EA5}\x{4EA6}\x{4EA8}\x{4EAB}\x{4EAC}' + . '\x{4EAD}\x{4EAE}\x{4EB0}\x{4EB3}\x{4EB6}\x{4EBA}\x{4EC0}\x{4EC1}\x{4EC2}' + . '\x{4EC4}\x{4EC6}\x{4EC7}\x{4ECA}\x{4ECB}\x{4ECD}\x{4ECE}\x{4ECF}\x{4ED4}' + . '\x{4ED5}\x{4ED6}\x{4ED7}\x{4ED8}\x{4ED9}\x{4EDD}\x{4EDE}\x{4EDF}\x{4EE3}' + . '\x{4EE4}\x{4EE5}\x{4EED}\x{4EEE}\x{4EF0}\x{4EF2}\x{4EF6}\x{4EF7}\x{4EFB}' + . '\x{4F01}\x{4F09}\x{4F0A}\x{4F0D}\x{4F0E}\x{4F0F}\x{4F10}\x{4F11}\x{4F1A}' + . '\x{4F1C}\x{4F1D}\x{4F2F}\x{4F30}\x{4F34}\x{4F36}\x{4F38}\x{4F3A}\x{4F3C}' + . '\x{4F3D}\x{4F43}\x{4F46}\x{4F47}\x{4F4D}\x{4F4E}\x{4F4F}\x{4F50}\x{4F51}' + . '\x{4F53}\x{4F55}\x{4F57}\x{4F59}\x{4F5A}\x{4F5B}\x{4F5C}\x{4F5D}\x{4F5E}' + . '\x{4F69}\x{4F6F}\x{4F70}\x{4F73}\x{4F75}\x{4F76}\x{4F7B}\x{4F7C}\x{4F7F}' + . '\x{4F83}\x{4F86}\x{4F88}\x{4F8B}\x{4F8D}\x{4F8F}\x{4F91}\x{4F96}\x{4F98}' + . '\x{4F9B}\x{4F9D}\x{4FA0}\x{4FA1}\x{4FAB}\x{4FAD}\x{4FAE}\x{4FAF}\x{4FB5}' + . '\x{4FB6}\x{4FBF}\x{4FC2}\x{4FC3}\x{4FC4}\x{4FCA}\x{4FCE}\x{4FD0}\x{4FD1}' + . '\x{4FD4}\x{4FD7}\x{4FD8}\x{4FDA}\x{4FDB}\x{4FDD}\x{4FDF}\x{4FE1}\x{4FE3}' + . '\x{4FE4}\x{4FE5}\x{4FEE}\x{4FEF}\x{4FF3}\x{4FF5}\x{4FF6}\x{4FF8}\x{4FFA}' + . '\x{4FFE}\x{5005}\x{5006}\x{5009}\x{500B}\x{500D}\x{500F}\x{5011}\x{5012}' + . '\x{5014}\x{5016}\x{5019}\x{501A}\x{501F}\x{5021}\x{5023}\x{5024}\x{5025}' + . '\x{5026}\x{5028}\x{5029}\x{502A}\x{502B}\x{502C}\x{502D}\x{5036}\x{5039}' + . '\x{5043}\x{5047}\x{5048}\x{5049}\x{504F}\x{5050}\x{5055}\x{5056}\x{505A}' + . '\x{505C}\x{5065}\x{506C}\x{5072}\x{5074}\x{5075}\x{5076}\x{5078}\x{507D}' + . '\x{5080}\x{5085}\x{508D}\x{5091}\x{5098}\x{5099}\x{509A}\x{50AC}\x{50AD}' + . '\x{50B2}\x{50B3}\x{50B4}\x{50B5}\x{50B7}\x{50BE}\x{50C2}\x{50C5}\x{50C9}' + . '\x{50CA}\x{50CD}\x{50CF}\x{50D1}\x{50D5}\x{50D6}\x{50DA}\x{50DE}\x{50E3}' + . '\x{50E5}\x{50E7}\x{50ED}\x{50EE}\x{50F5}\x{50F9}\x{50FB}\x{5100}\x{5101}' + . '\x{5102}\x{5104}\x{5109}\x{5112}\x{5114}\x{5115}\x{5116}\x{5118}\x{511A}' + . '\x{511F}\x{5121}\x{512A}\x{5132}\x{5137}\x{513A}\x{513B}\x{513C}\x{513F}' + . '\x{5140}\x{5141}\x{5143}\x{5144}\x{5145}\x{5146}\x{5147}\x{5148}\x{5149}' + . '\x{514B}\x{514C}\x{514D}\x{514E}\x{5150}\x{5152}\x{5154}\x{515A}\x{515C}' + . '\x{5162}\x{5165}\x{5168}\x{5169}\x{516A}\x{516B}\x{516C}\x{516D}\x{516E}' + . '\x{5171}\x{5175}\x{5176}\x{5177}\x{5178}\x{517C}\x{5180}\x{5182}\x{5185}' + . '\x{5186}\x{5189}\x{518A}\x{518C}\x{518D}\x{518F}\x{5190}\x{5191}\x{5192}' + . '\x{5193}\x{5195}\x{5196}\x{5197}\x{5199}\x{51A0}\x{51A2}\x{51A4}\x{51A5}' + . '\x{51A6}\x{51A8}\x{51A9}\x{51AA}\x{51AB}\x{51AC}\x{51B0}\x{51B1}\x{51B2}' + . '\x{51B3}\x{51B4}\x{51B5}\x{51B6}\x{51B7}\x{51BD}\x{51C4}\x{51C5}\x{51C6}' + . '\x{51C9}\x{51CB}\x{51CC}\x{51CD}\x{51D6}\x{51DB}\x{51DC}\x{51DD}\x{51E0}' + . '\x{51E1}\x{51E6}\x{51E7}\x{51E9}\x{51EA}\x{51ED}\x{51F0}\x{51F1}\x{51F5}' + . '\x{51F6}\x{51F8}\x{51F9}\x{51FA}\x{51FD}\x{51FE}\x{5200}\x{5203}\x{5204}' + . '\x{5206}\x{5207}\x{5208}\x{520A}\x{520B}\x{520E}\x{5211}\x{5214}\x{5217}' + . '\x{521D}\x{5224}\x{5225}\x{5227}\x{5229}\x{522A}\x{522E}\x{5230}\x{5233}' + . '\x{5236}\x{5237}\x{5238}\x{5239}\x{523A}\x{523B}\x{5243}\x{5244}\x{5247}' + . '\x{524A}\x{524B}\x{524C}\x{524D}\x{524F}\x{5254}\x{5256}\x{525B}\x{525E}' + . '\x{5263}\x{5264}\x{5265}\x{5269}\x{526A}\x{526F}\x{5270}\x{5271}\x{5272}' + . '\x{5273}\x{5274}\x{5275}\x{527D}\x{527F}\x{5283}\x{5287}\x{5288}\x{5289}' + . '\x{528D}\x{5291}\x{5292}\x{5294}\x{529B}\x{529F}\x{52A0}\x{52A3}\x{52A9}' + . '\x{52AA}\x{52AB}\x{52AC}\x{52AD}\x{52B1}\x{52B4}\x{52B5}\x{52B9}\x{52BC}' + . '\x{52BE}\x{52C1}\x{52C3}\x{52C5}\x{52C7}\x{52C9}\x{52CD}\x{52D2}\x{52D5}' + . '\x{52D7}\x{52D8}\x{52D9}\x{52DD}\x{52DE}\x{52DF}\x{52E0}\x{52E2}\x{52E3}' + . '\x{52E4}\x{52E6}\x{52E7}\x{52F2}\x{52F3}\x{52F5}\x{52F8}\x{52F9}\x{52FA}' + . '\x{52FE}\x{52FF}\x{5301}\x{5302}\x{5305}\x{5306}\x{5308}\x{530D}\x{530F}' + . '\x{5310}\x{5315}\x{5316}\x{5317}\x{5319}\x{531A}\x{531D}\x{5320}\x{5321}' + . '\x{5323}\x{532A}\x{532F}\x{5331}\x{5333}\x{5338}\x{5339}\x{533A}\x{533B}' + . '\x{533F}\x{5340}\x{5341}\x{5343}\x{5345}\x{5346}\x{5347}\x{5348}\x{5349}' + . '\x{534A}\x{534D}\x{5351}\x{5352}\x{5353}\x{5354}\x{5357}\x{5358}\x{535A}' + . '\x{535C}\x{535E}\x{5360}\x{5366}\x{5369}\x{536E}\x{536F}\x{5370}\x{5371}' + . '\x{5373}\x{5374}\x{5375}\x{5377}\x{5378}\x{537B}\x{537F}\x{5382}\x{5384}' + . '\x{5396}\x{5398}\x{539A}\x{539F}\x{53A0}\x{53A5}\x{53A6}\x{53A8}\x{53A9}' + . '\x{53AD}\x{53AE}\x{53B0}\x{53B3}\x{53B6}\x{53BB}\x{53C2}\x{53C3}\x{53C8}' + . '\x{53C9}\x{53CA}\x{53CB}\x{53CC}\x{53CD}\x{53CE}\x{53D4}\x{53D6}\x{53D7}' + . '\x{53D9}\x{53DB}\x{53DF}\x{53E1}\x{53E2}\x{53E3}\x{53E4}\x{53E5}\x{53E8}' + . '\x{53E9}\x{53EA}\x{53EB}\x{53EC}\x{53ED}\x{53EE}\x{53EF}\x{53F0}\x{53F1}' + . '\x{53F2}\x{53F3}\x{53F6}\x{53F7}\x{53F8}\x{53FA}\x{5401}\x{5403}\x{5404}' + . '\x{5408}\x{5409}\x{540A}\x{540B}\x{540C}\x{540D}\x{540E}\x{540F}\x{5410}' + . '\x{5411}\x{541B}\x{541D}\x{541F}\x{5420}\x{5426}\x{5429}\x{542B}\x{542C}' + . '\x{542D}\x{542E}\x{5436}\x{5438}\x{5439}\x{543B}\x{543C}\x{543D}\x{543E}' + . '\x{5440}\x{5442}\x{5446}\x{5448}\x{5449}\x{544A}\x{544E}\x{5451}\x{545F}' + . '\x{5468}\x{546A}\x{5470}\x{5471}\x{5473}\x{5475}\x{5476}\x{5477}\x{547B}' + . '\x{547C}\x{547D}\x{5480}\x{5484}\x{5486}\x{548B}\x{548C}\x{548E}\x{548F}' + . '\x{5490}\x{5492}\x{54A2}\x{54A4}\x{54A5}\x{54A8}\x{54AB}\x{54AC}\x{54AF}' + . '\x{54B2}\x{54B3}\x{54B8}\x{54BC}\x{54BD}\x{54BE}\x{54C0}\x{54C1}\x{54C2}' + . '\x{54C4}\x{54C7}\x{54C8}\x{54C9}\x{54D8}\x{54E1}\x{54E2}\x{54E5}\x{54E6}' + . '\x{54E8}\x{54E9}\x{54ED}\x{54EE}\x{54F2}\x{54FA}\x{54FD}\x{5504}\x{5506}' + . '\x{5507}\x{550F}\x{5510}\x{5514}\x{5516}\x{552E}\x{552F}\x{5531}\x{5533}' + . '\x{5538}\x{5539}\x{553E}\x{5540}\x{5544}\x{5545}\x{5546}\x{554C}\x{554F}' + . '\x{5553}\x{5556}\x{5557}\x{555C}\x{555D}\x{5563}\x{557B}\x{557C}\x{557E}' + . '\x{5580}\x{5583}\x{5584}\x{5587}\x{5589}\x{558A}\x{558B}\x{5598}\x{5599}' + . '\x{559A}\x{559C}\x{559D}\x{559E}\x{559F}\x{55A7}\x{55A8}\x{55A9}\x{55AA}' + . '\x{55AB}\x{55AC}\x{55AE}\x{55B0}\x{55B6}\x{55C4}\x{55C5}\x{55C7}\x{55D4}' + . '\x{55DA}\x{55DC}\x{55DF}\x{55E3}\x{55E4}\x{55F7}\x{55F9}\x{55FD}\x{55FE}' + . '\x{5606}\x{5609}\x{5614}\x{5616}\x{5617}\x{5618}\x{561B}\x{5629}\x{562F}' + . '\x{5631}\x{5632}\x{5634}\x{5636}\x{5638}\x{5642}\x{564C}\x{564E}\x{5650}' + . '\x{565B}\x{5664}\x{5668}\x{566A}\x{566B}\x{566C}\x{5674}\x{5678}\x{567A}' + . '\x{5680}\x{5686}\x{5687}\x{568A}\x{568F}\x{5694}\x{56A0}\x{56A2}\x{56A5}' + . '\x{56AE}\x{56B4}\x{56B6}\x{56BC}\x{56C0}\x{56C1}\x{56C2}\x{56C3}\x{56C8}' + . '\x{56CE}\x{56D1}\x{56D3}\x{56D7}\x{56D8}\x{56DA}\x{56DB}\x{56DE}\x{56E0}' + . '\x{56E3}\x{56EE}\x{56F0}\x{56F2}\x{56F3}\x{56F9}\x{56FA}\x{56FD}\x{56FF}' + . '\x{5700}\x{5703}\x{5704}\x{5708}\x{5709}\x{570B}\x{570D}\x{570F}\x{5712}' + . '\x{5713}\x{5716}\x{5718}\x{571C}\x{571F}\x{5726}\x{5727}\x{5728}\x{572D}' + . '\x{5730}\x{5737}\x{5738}\x{573B}\x{5740}\x{5742}\x{5747}\x{574A}\x{574E}' + . '\x{574F}\x{5750}\x{5751}\x{5761}\x{5764}\x{5766}\x{5769}\x{576A}\x{577F}' + . '\x{5782}\x{5788}\x{5789}\x{578B}\x{5793}\x{57A0}\x{57A2}\x{57A3}\x{57A4}' + . '\x{57AA}\x{57B0}\x{57B3}\x{57C0}\x{57C3}\x{57C6}\x{57CB}\x{57CE}\x{57D2}' + . '\x{57D3}\x{57D4}\x{57D6}\x{57DC}\x{57DF}\x{57E0}\x{57E3}\x{57F4}\x{57F7}' + . '\x{57F9}\x{57FA}\x{57FC}\x{5800}\x{5802}\x{5805}\x{5806}\x{580A}\x{580B}' + . '\x{5815}\x{5819}\x{581D}\x{5821}\x{5824}\x{582A}\x{582F}\x{5830}\x{5831}' + . '\x{5834}\x{5835}\x{583A}\x{583D}\x{5840}\x{5841}\x{584A}\x{584B}\x{5851}' + . '\x{5852}\x{5854}\x{5857}\x{5858}\x{5859}\x{585A}\x{585E}\x{5862}\x{5869}' + . '\x{586B}\x{5870}\x{5872}\x{5875}\x{5879}\x{587E}\x{5883}\x{5885}\x{5893}' + . '\x{5897}\x{589C}\x{589F}\x{58A8}\x{58AB}\x{58AE}\x{58B3}\x{58B8}\x{58B9}' + . '\x{58BA}\x{58BB}\x{58BE}\x{58C1}\x{58C5}\x{58C7}\x{58CA}\x{58CC}\x{58D1}' + . '\x{58D3}\x{58D5}\x{58D7}\x{58D8}\x{58D9}\x{58DC}\x{58DE}\x{58DF}\x{58E4}' + . '\x{58E5}\x{58EB}\x{58EC}\x{58EE}\x{58EF}\x{58F0}\x{58F1}\x{58F2}\x{58F7}' + . '\x{58F9}\x{58FA}\x{58FB}\x{58FC}\x{58FD}\x{5902}\x{5909}\x{590A}\x{590F}' + . '\x{5910}\x{5915}\x{5916}\x{5918}\x{5919}\x{591A}\x{591B}\x{591C}\x{5922}' + . '\x{5925}\x{5927}\x{5929}\x{592A}\x{592B}\x{592C}\x{592D}\x{592E}\x{5931}' + . '\x{5932}\x{5937}\x{5938}\x{593E}\x{5944}\x{5947}\x{5948}\x{5949}\x{594E}' + . '\x{594F}\x{5950}\x{5951}\x{5954}\x{5955}\x{5957}\x{5958}\x{595A}\x{5960}' + . '\x{5962}\x{5965}\x{5967}\x{5968}\x{5969}\x{596A}\x{596C}\x{596E}\x{5973}' + . '\x{5974}\x{5978}\x{597D}\x{5981}\x{5982}\x{5983}\x{5984}\x{598A}\x{598D}' + . '\x{5993}\x{5996}\x{5999}\x{599B}\x{599D}\x{59A3}\x{59A5}\x{59A8}\x{59AC}' + . '\x{59B2}\x{59B9}\x{59BB}\x{59BE}\x{59C6}\x{59C9}\x{59CB}\x{59D0}\x{59D1}' + . '\x{59D3}\x{59D4}\x{59D9}\x{59DA}\x{59DC}\x{59E5}\x{59E6}\x{59E8}\x{59EA}' + . '\x{59EB}\x{59F6}\x{59FB}\x{59FF}\x{5A01}\x{5A03}\x{5A09}\x{5A11}\x{5A18}' + . '\x{5A1A}\x{5A1C}\x{5A1F}\x{5A20}\x{5A25}\x{5A29}\x{5A2F}\x{5A35}\x{5A36}' + . '\x{5A3C}\x{5A40}\x{5A41}\x{5A46}\x{5A49}\x{5A5A}\x{5A62}\x{5A66}\x{5A6A}' + . '\x{5A6C}\x{5A7F}\x{5A92}\x{5A9A}\x{5A9B}\x{5ABC}\x{5ABD}\x{5ABE}\x{5AC1}' + . '\x{5AC2}\x{5AC9}\x{5ACB}\x{5ACC}\x{5AD0}\x{5AD6}\x{5AD7}\x{5AE1}\x{5AE3}' + . '\x{5AE6}\x{5AE9}\x{5AFA}\x{5AFB}\x{5B09}\x{5B0B}\x{5B0C}\x{5B16}\x{5B22}' + . '\x{5B2A}\x{5B2C}\x{5B30}\x{5B32}\x{5B36}\x{5B3E}\x{5B40}\x{5B43}\x{5B45}' + . '\x{5B50}\x{5B51}\x{5B54}\x{5B55}\x{5B57}\x{5B58}\x{5B5A}\x{5B5B}\x{5B5C}' + . '\x{5B5D}\x{5B5F}\x{5B63}\x{5B64}\x{5B65}\x{5B66}\x{5B69}\x{5B6B}\x{5B70}' + . '\x{5B71}\x{5B73}\x{5B75}\x{5B78}\x{5B7A}\x{5B80}\x{5B83}\x{5B85}\x{5B87}' + . '\x{5B88}\x{5B89}\x{5B8B}\x{5B8C}\x{5B8D}\x{5B8F}\x{5B95}\x{5B97}\x{5B98}' + . '\x{5B99}\x{5B9A}\x{5B9B}\x{5B9C}\x{5B9D}\x{5B9F}\x{5BA2}\x{5BA3}\x{5BA4}' + . '\x{5BA5}\x{5BA6}\x{5BAE}\x{5BB0}\x{5BB3}\x{5BB4}\x{5BB5}\x{5BB6}\x{5BB8}' + . '\x{5BB9}\x{5BBF}\x{5BC2}\x{5BC3}\x{5BC4}\x{5BC5}\x{5BC6}\x{5BC7}\x{5BC9}' + . '\x{5BCC}\x{5BD0}\x{5BD2}\x{5BD3}\x{5BD4}\x{5BDB}\x{5BDD}\x{5BDE}\x{5BDF}' + . '\x{5BE1}\x{5BE2}\x{5BE4}\x{5BE5}\x{5BE6}\x{5BE7}\x{5BE8}\x{5BE9}\x{5BEB}' + . '\x{5BEE}\x{5BF0}\x{5BF3}\x{5BF5}\x{5BF6}\x{5BF8}\x{5BFA}\x{5BFE}\x{5BFF}' + . '\x{5C01}\x{5C02}\x{5C04}\x{5C05}\x{5C06}\x{5C07}\x{5C08}\x{5C09}\x{5C0A}' + . '\x{5C0B}\x{5C0D}\x{5C0E}\x{5C0F}\x{5C11}\x{5C13}\x{5C16}\x{5C1A}\x{5C20}' + . '\x{5C22}\x{5C24}\x{5C28}\x{5C2D}\x{5C31}\x{5C38}\x{5C39}\x{5C3A}\x{5C3B}' + . '\x{5C3C}\x{5C3D}\x{5C3E}\x{5C3F}\x{5C40}\x{5C41}\x{5C45}\x{5C46}\x{5C48}' + . '\x{5C4A}\x{5C4B}\x{5C4D}\x{5C4E}\x{5C4F}\x{5C50}\x{5C51}\x{5C53}\x{5C55}' + . '\x{5C5E}\x{5C60}\x{5C61}\x{5C64}\x{5C65}\x{5C6C}\x{5C6E}\x{5C6F}\x{5C71}' + . '\x{5C76}\x{5C79}\x{5C8C}\x{5C90}\x{5C91}\x{5C94}\x{5CA1}\x{5CA8}\x{5CA9}' + . '\x{5CAB}\x{5CAC}\x{5CB1}\x{5CB3}\x{5CB6}\x{5CB7}\x{5CB8}\x{5CBB}\x{5CBC}' + . '\x{5CBE}\x{5CC5}\x{5CC7}\x{5CD9}\x{5CE0}\x{5CE1}\x{5CE8}\x{5CE9}\x{5CEA}' + . '\x{5CED}\x{5CEF}\x{5CF0}\x{5CF6}\x{5CFA}\x{5CFB}\x{5CFD}\x{5D07}\x{5D0B}' + . '\x{5D0E}\x{5D11}\x{5D14}\x{5D15}\x{5D16}\x{5D17}\x{5D18}\x{5D19}\x{5D1A}' + . '\x{5D1B}\x{5D1F}\x{5D22}\x{5D29}\x{5D4B}\x{5D4C}\x{5D4E}\x{5D50}\x{5D52}' + . '\x{5D5C}\x{5D69}\x{5D6C}\x{5D6F}\x{5D73}\x{5D76}\x{5D82}\x{5D84}\x{5D87}' + . '\x{5D8B}\x{5D8C}\x{5D90}\x{5D9D}\x{5DA2}\x{5DAC}\x{5DAE}\x{5DB7}\x{5DBA}' + . '\x{5DBC}\x{5DBD}\x{5DC9}\x{5DCC}\x{5DCD}\x{5DD2}\x{5DD3}\x{5DD6}\x{5DDB}' + . '\x{5DDD}\x{5DDE}\x{5DE1}\x{5DE3}\x{5DE5}\x{5DE6}\x{5DE7}\x{5DE8}\x{5DEB}' + . '\x{5DEE}\x{5DF1}\x{5DF2}\x{5DF3}\x{5DF4}\x{5DF5}\x{5DF7}\x{5DFB}\x{5DFD}' + . '\x{5DFE}\x{5E02}\x{5E03}\x{5E06}\x{5E0B}\x{5E0C}\x{5E11}\x{5E16}\x{5E19}' + . '\x{5E1A}\x{5E1B}\x{5E1D}\x{5E25}\x{5E2B}\x{5E2D}\x{5E2F}\x{5E30}\x{5E33}' + . '\x{5E36}\x{5E37}\x{5E38}\x{5E3D}\x{5E40}\x{5E43}\x{5E44}\x{5E45}\x{5E47}' + . '\x{5E4C}\x{5E4E}\x{5E54}\x{5E55}\x{5E57}\x{5E5F}\x{5E61}\x{5E62}\x{5E63}' + . '\x{5E64}\x{5E72}\x{5E73}\x{5E74}\x{5E75}\x{5E76}\x{5E78}\x{5E79}\x{5E7A}' + . '\x{5E7B}\x{5E7C}\x{5E7D}\x{5E7E}\x{5E7F}\x{5E81}\x{5E83}\x{5E84}\x{5E87}' + . '\x{5E8A}\x{5E8F}\x{5E95}\x{5E96}\x{5E97}\x{5E9A}\x{5E9C}\x{5EA0}\x{5EA6}' + . '\x{5EA7}\x{5EAB}\x{5EAD}\x{5EB5}\x{5EB6}\x{5EB7}\x{5EB8}\x{5EC1}\x{5EC2}' + . '\x{5EC3}\x{5EC8}\x{5EC9}\x{5ECA}\x{5ECF}\x{5ED0}\x{5ED3}\x{5ED6}\x{5EDA}' + . '\x{5EDB}\x{5EDD}\x{5EDF}\x{5EE0}\x{5EE1}\x{5EE2}\x{5EE3}\x{5EE8}\x{5EE9}' + . '\x{5EEC}\x{5EF0}\x{5EF1}\x{5EF3}\x{5EF4}\x{5EF6}\x{5EF7}\x{5EF8}\x{5EFA}' + . '\x{5EFB}\x{5EFC}\x{5EFE}\x{5EFF}\x{5F01}\x{5F03}\x{5F04}\x{5F09}\x{5F0A}' + . '\x{5F0B}\x{5F0C}\x{5F0D}\x{5F0F}\x{5F10}\x{5F11}\x{5F13}\x{5F14}\x{5F15}' + . '\x{5F16}\x{5F17}\x{5F18}\x{5F1B}\x{5F1F}\x{5F25}\x{5F26}\x{5F27}\x{5F29}' + . '\x{5F2D}\x{5F2F}\x{5F31}\x{5F35}\x{5F37}\x{5F38}\x{5F3C}\x{5F3E}\x{5F41}' + . '\x{5F48}\x{5F4A}\x{5F4C}\x{5F4E}\x{5F51}\x{5F53}\x{5F56}\x{5F57}\x{5F59}' + . '\x{5F5C}\x{5F5D}\x{5F61}\x{5F62}\x{5F66}\x{5F69}\x{5F6A}\x{5F6B}\x{5F6C}' + . '\x{5F6D}\x{5F70}\x{5F71}\x{5F73}\x{5F77}\x{5F79}\x{5F7C}\x{5F7F}\x{5F80}' + . '\x{5F81}\x{5F82}\x{5F83}\x{5F84}\x{5F85}\x{5F87}\x{5F88}\x{5F8A}\x{5F8B}' + . '\x{5F8C}\x{5F90}\x{5F91}\x{5F92}\x{5F93}\x{5F97}\x{5F98}\x{5F99}\x{5F9E}' + . '\x{5FA0}\x{5FA1}\x{5FA8}\x{5FA9}\x{5FAA}\x{5FAD}\x{5FAE}\x{5FB3}\x{5FB4}' + . '\x{5FB9}\x{5FBC}\x{5FBD}\x{5FC3}\x{5FC5}\x{5FCC}\x{5FCD}\x{5FD6}\x{5FD7}' + . '\x{5FD8}\x{5FD9}\x{5FDC}\x{5FDD}\x{5FE0}\x{5FE4}\x{5FEB}\x{5FF0}\x{5FF1}' + . '\x{5FF5}\x{5FF8}\x{5FFB}\x{5FFD}\x{5FFF}\x{600E}\x{600F}\x{6010}\x{6012}' + . '\x{6015}\x{6016}\x{6019}\x{601B}\x{601C}\x{601D}\x{6020}\x{6021}\x{6025}' + . '\x{6026}\x{6027}\x{6028}\x{6029}\x{602A}\x{602B}\x{602F}\x{6031}\x{603A}' + . '\x{6041}\x{6042}\x{6043}\x{6046}\x{604A}\x{604B}\x{604D}\x{6050}\x{6052}' + . '\x{6055}\x{6059}\x{605A}\x{605F}\x{6060}\x{6062}\x{6063}\x{6064}\x{6065}' + . '\x{6068}\x{6069}\x{606A}\x{606B}\x{606C}\x{606D}\x{606F}\x{6070}\x{6075}' + . '\x{6077}\x{6081}\x{6083}\x{6084}\x{6089}\x{608B}\x{608C}\x{608D}\x{6092}' + . '\x{6094}\x{6096}\x{6097}\x{609A}\x{609B}\x{609F}\x{60A0}\x{60A3}\x{60A6}' + . '\x{60A7}\x{60A9}\x{60AA}\x{60B2}\x{60B3}\x{60B4}\x{60B5}\x{60B6}\x{60B8}' + . '\x{60BC}\x{60BD}\x{60C5}\x{60C6}\x{60C7}\x{60D1}\x{60D3}\x{60D8}\x{60DA}' + . '\x{60DC}\x{60DF}\x{60E0}\x{60E1}\x{60E3}\x{60E7}\x{60E8}\x{60F0}\x{60F1}' + . '\x{60F3}\x{60F4}\x{60F6}\x{60F7}\x{60F9}\x{60FA}\x{60FB}\x{6100}\x{6101}' + . '\x{6103}\x{6106}\x{6108}\x{6109}\x{610D}\x{610E}\x{610F}\x{6115}\x{611A}' + . '\x{611B}\x{611F}\x{6121}\x{6127}\x{6128}\x{612C}\x{6134}\x{613C}\x{613D}' + . '\x{613E}\x{613F}\x{6142}\x{6144}\x{6147}\x{6148}\x{614A}\x{614B}\x{614C}' + . '\x{614D}\x{614E}\x{6153}\x{6155}\x{6158}\x{6159}\x{615A}\x{615D}\x{615F}' + . '\x{6162}\x{6163}\x{6165}\x{6167}\x{6168}\x{616B}\x{616E}\x{616F}\x{6170}' + . '\x{6171}\x{6173}\x{6174}\x{6175}\x{6176}\x{6177}\x{617E}\x{6182}\x{6187}' + . '\x{618A}\x{618E}\x{6190}\x{6191}\x{6194}\x{6196}\x{6199}\x{619A}\x{61A4}' + . '\x{61A7}\x{61A9}\x{61AB}\x{61AC}\x{61AE}\x{61B2}\x{61B6}\x{61BA}\x{61BE}' + . '\x{61C3}\x{61C6}\x{61C7}\x{61C8}\x{61C9}\x{61CA}\x{61CB}\x{61CC}\x{61CD}' + . '\x{61D0}\x{61E3}\x{61E6}\x{61F2}\x{61F4}\x{61F6}\x{61F7}\x{61F8}\x{61FA}' + . '\x{61FC}\x{61FD}\x{61FE}\x{61FF}\x{6200}\x{6208}\x{6209}\x{620A}\x{620C}' + . '\x{620D}\x{620E}\x{6210}\x{6211}\x{6212}\x{6214}\x{6216}\x{621A}\x{621B}' + . '\x{621D}\x{621E}\x{621F}\x{6221}\x{6226}\x{622A}\x{622E}\x{622F}\x{6230}' + . '\x{6232}\x{6233}\x{6234}\x{6238}\x{623B}\x{623F}\x{6240}\x{6241}\x{6247}' + . '\x{6248}\x{6249}\x{624B}\x{624D}\x{624E}\x{6253}\x{6255}\x{6258}\x{625B}' + . '\x{625E}\x{6260}\x{6263}\x{6268}\x{626E}\x{6271}\x{6276}\x{6279}\x{627C}' + . '\x{627E}\x{627F}\x{6280}\x{6282}\x{6283}\x{6284}\x{6289}\x{628A}\x{6291}' + . '\x{6292}\x{6293}\x{6294}\x{6295}\x{6296}\x{6297}\x{6298}\x{629B}\x{629C}' + . '\x{629E}\x{62AB}\x{62AC}\x{62B1}\x{62B5}\x{62B9}\x{62BB}\x{62BC}\x{62BD}' + . '\x{62C2}\x{62C5}\x{62C6}\x{62C7}\x{62C8}\x{62C9}\x{62CA}\x{62CC}\x{62CD}' + . '\x{62CF}\x{62D0}\x{62D1}\x{62D2}\x{62D3}\x{62D4}\x{62D7}\x{62D8}\x{62D9}' + . '\x{62DB}\x{62DC}\x{62DD}\x{62E0}\x{62E1}\x{62EC}\x{62ED}\x{62EE}\x{62EF}' + . '\x{62F1}\x{62F3}\x{62F5}\x{62F6}\x{62F7}\x{62FE}\x{62FF}\x{6301}\x{6302}' + . '\x{6307}\x{6308}\x{6309}\x{630C}\x{6311}\x{6319}\x{631F}\x{6327}\x{6328}' + . '\x{632B}\x{632F}\x{633A}\x{633D}\x{633E}\x{633F}\x{6349}\x{634C}\x{634D}' + . '\x{634F}\x{6350}\x{6355}\x{6357}\x{635C}\x{6367}\x{6368}\x{6369}\x{636B}' + . '\x{636E}\x{6372}\x{6376}\x{6377}\x{637A}\x{637B}\x{6380}\x{6383}\x{6388}' + . '\x{6389}\x{638C}\x{638E}\x{638F}\x{6392}\x{6396}\x{6398}\x{639B}\x{639F}' + . '\x{63A0}\x{63A1}\x{63A2}\x{63A3}\x{63A5}\x{63A7}\x{63A8}\x{63A9}\x{63AA}' + . '\x{63AB}\x{63AC}\x{63B2}\x{63B4}\x{63B5}\x{63BB}\x{63BE}\x{63C0}\x{63C3}' + . '\x{63C4}\x{63C6}\x{63C9}\x{63CF}\x{63D0}\x{63D2}\x{63D6}\x{63DA}\x{63DB}' + . '\x{63E1}\x{63E3}\x{63E9}\x{63EE}\x{63F4}\x{63F6}\x{63FA}\x{6406}\x{640D}' + . '\x{640F}\x{6413}\x{6416}\x{6417}\x{641C}\x{6426}\x{6428}\x{642C}\x{642D}' + . '\x{6434}\x{6436}\x{643A}\x{643E}\x{6442}\x{644E}\x{6458}\x{6467}\x{6469}' + . '\x{646F}\x{6476}\x{6478}\x{647A}\x{6483}\x{6488}\x{6492}\x{6493}\x{6495}' + . '\x{649A}\x{649E}\x{64A4}\x{64A5}\x{64A9}\x{64AB}\x{64AD}\x{64AE}\x{64B0}' + . '\x{64B2}\x{64B9}\x{64BB}\x{64BC}\x{64C1}\x{64C2}\x{64C5}\x{64C7}\x{64CD}' + . '\x{64D2}\x{64D4}\x{64D8}\x{64DA}\x{64E0}\x{64E1}\x{64E2}\x{64E3}\x{64E6}' + . '\x{64E7}\x{64EC}\x{64EF}\x{64F1}\x{64F2}\x{64F4}\x{64F6}\x{64FA}\x{64FD}' + . '\x{64FE}\x{6500}\x{6505}\x{6518}\x{651C}\x{651D}\x{6523}\x{6524}\x{652A}' + . '\x{652B}\x{652C}\x{652F}\x{6534}\x{6535}\x{6536}\x{6537}\x{6538}\x{6539}' + . '\x{653B}\x{653E}\x{653F}\x{6545}\x{6548}\x{654D}\x{654F}\x{6551}\x{6555}' + . '\x{6556}\x{6557}\x{6558}\x{6559}\x{655D}\x{655E}\x{6562}\x{6563}\x{6566}' + . '\x{656C}\x{6570}\x{6572}\x{6574}\x{6575}\x{6577}\x{6578}\x{6582}\x{6583}' + . '\x{6587}\x{6588}\x{6589}\x{658C}\x{658E}\x{6590}\x{6591}\x{6597}\x{6599}' + . '\x{659B}\x{659C}\x{659F}\x{65A1}\x{65A4}\x{65A5}\x{65A7}\x{65AB}\x{65AC}' + . '\x{65AD}\x{65AF}\x{65B0}\x{65B7}\x{65B9}\x{65BC}\x{65BD}\x{65C1}\x{65C3}' + . '\x{65C4}\x{65C5}\x{65C6}\x{65CB}\x{65CC}\x{65CF}\x{65D2}\x{65D7}\x{65D9}' + . '\x{65DB}\x{65E0}\x{65E1}\x{65E2}\x{65E5}\x{65E6}\x{65E7}\x{65E8}\x{65E9}' + . '\x{65EC}\x{65ED}\x{65F1}\x{65FA}\x{65FB}\x{6602}\x{6603}\x{6606}\x{6607}' + . '\x{660A}\x{660C}\x{660E}\x{660F}\x{6613}\x{6614}\x{661C}\x{661F}\x{6620}' + . '\x{6625}\x{6627}\x{6628}\x{662D}\x{662F}\x{6634}\x{6635}\x{6636}\x{663C}' + . '\x{663F}\x{6641}\x{6642}\x{6643}\x{6644}\x{6649}\x{664B}\x{664F}\x{6652}' + . '\x{665D}\x{665E}\x{665F}\x{6662}\x{6664}\x{6666}\x{6667}\x{6668}\x{6669}' + . '\x{666E}\x{666F}\x{6670}\x{6674}\x{6676}\x{667A}\x{6681}\x{6683}\x{6684}' + . '\x{6687}\x{6688}\x{6689}\x{668E}\x{6691}\x{6696}\x{6697}\x{6698}\x{669D}' + . '\x{66A2}\x{66A6}\x{66AB}\x{66AE}\x{66B4}\x{66B8}\x{66B9}\x{66BC}\x{66BE}' + . '\x{66C1}\x{66C4}\x{66C7}\x{66C9}\x{66D6}\x{66D9}\x{66DA}\x{66DC}\x{66DD}' + . '\x{66E0}\x{66E6}\x{66E9}\x{66F0}\x{66F2}\x{66F3}\x{66F4}\x{66F5}\x{66F7}' + . '\x{66F8}\x{66F9}\x{66FC}\x{66FD}\x{66FE}\x{66FF}\x{6700}\x{6703}\x{6708}' + . '\x{6709}\x{670B}\x{670D}\x{670F}\x{6714}\x{6715}\x{6716}\x{6717}\x{671B}' + . '\x{671D}\x{671E}\x{671F}\x{6726}\x{6727}\x{6728}\x{672A}\x{672B}\x{672C}' + . '\x{672D}\x{672E}\x{6731}\x{6734}\x{6736}\x{6737}\x{6738}\x{673A}\x{673D}' + . '\x{673F}\x{6741}\x{6746}\x{6749}\x{674E}\x{674F}\x{6750}\x{6751}\x{6753}' + . '\x{6756}\x{6759}\x{675C}\x{675E}\x{675F}\x{6760}\x{6761}\x{6762}\x{6763}' + . '\x{6764}\x{6765}\x{676A}\x{676D}\x{676F}\x{6770}\x{6771}\x{6772}\x{6773}' + . '\x{6775}\x{6777}\x{677C}\x{677E}\x{677F}\x{6785}\x{6787}\x{6789}\x{678B}' + . '\x{678C}\x{6790}\x{6795}\x{6797}\x{679A}\x{679C}\x{679D}\x{67A0}\x{67A1}' + . '\x{67A2}\x{67A6}\x{67A9}\x{67AF}\x{67B3}\x{67B4}\x{67B6}\x{67B7}\x{67B8}' + . '\x{67B9}\x{67C1}\x{67C4}\x{67C6}\x{67CA}\x{67CE}\x{67CF}\x{67D0}\x{67D1}' + . '\x{67D3}\x{67D4}\x{67D8}\x{67DA}\x{67DD}\x{67DE}\x{67E2}\x{67E4}\x{67E7}' + . '\x{67E9}\x{67EC}\x{67EE}\x{67EF}\x{67F1}\x{67F3}\x{67F4}\x{67F5}\x{67FB}' + . '\x{67FE}\x{67FF}\x{6802}\x{6803}\x{6804}\x{6813}\x{6816}\x{6817}\x{681E}' + . '\x{6821}\x{6822}\x{6829}\x{682A}\x{682B}\x{6832}\x{6834}\x{6838}\x{6839}' + . '\x{683C}\x{683D}\x{6840}\x{6841}\x{6842}\x{6843}\x{6846}\x{6848}\x{684D}' + . '\x{684E}\x{6850}\x{6851}\x{6853}\x{6854}\x{6859}\x{685C}\x{685D}\x{685F}' + . '\x{6863}\x{6867}\x{6874}\x{6876}\x{6877}\x{687E}\x{687F}\x{6881}\x{6883}' + . '\x{6885}\x{688D}\x{688F}\x{6893}\x{6894}\x{6897}\x{689B}\x{689D}\x{689F}' + . '\x{68A0}\x{68A2}\x{68A6}\x{68A7}\x{68A8}\x{68AD}\x{68AF}\x{68B0}\x{68B1}' + . '\x{68B3}\x{68B5}\x{68B6}\x{68B9}\x{68BA}\x{68BC}\x{68C4}\x{68C6}\x{68C9}' + . '\x{68CA}\x{68CB}\x{68CD}\x{68D2}\x{68D4}\x{68D5}\x{68D7}\x{68D8}\x{68DA}' + . '\x{68DF}\x{68E0}\x{68E1}\x{68E3}\x{68E7}\x{68EE}\x{68EF}\x{68F2}\x{68F9}' + . '\x{68FA}\x{6900}\x{6901}\x{6904}\x{6905}\x{6908}\x{690B}\x{690C}\x{690D}' + . '\x{690E}\x{690F}\x{6912}\x{6919}\x{691A}\x{691B}\x{691C}\x{6921}\x{6922}' + . '\x{6923}\x{6925}\x{6926}\x{6928}\x{692A}\x{6930}\x{6934}\x{6936}\x{6939}' + . '\x{693D}\x{693F}\x{694A}\x{6953}\x{6954}\x{6955}\x{6959}\x{695A}\x{695C}' + . '\x{695D}\x{695E}\x{6960}\x{6961}\x{6962}\x{696A}\x{696B}\x{696D}\x{696E}' + . '\x{696F}\x{6973}\x{6974}\x{6975}\x{6977}\x{6978}\x{6979}\x{697C}\x{697D}' + . '\x{697E}\x{6981}\x{6982}\x{698A}\x{698E}\x{6991}\x{6994}\x{6995}\x{699B}' + . '\x{699C}\x{69A0}\x{69A7}\x{69AE}\x{69B1}\x{69B2}\x{69B4}\x{69BB}\x{69BE}' + . '\x{69BF}\x{69C1}\x{69C3}\x{69C7}\x{69CA}\x{69CB}\x{69CC}\x{69CD}\x{69CE}' + . '\x{69D0}\x{69D3}\x{69D8}\x{69D9}\x{69DD}\x{69DE}\x{69E7}\x{69E8}\x{69EB}' + . '\x{69ED}\x{69F2}\x{69F9}\x{69FB}\x{69FD}\x{69FF}\x{6A02}\x{6A05}\x{6A0A}' + . '\x{6A0B}\x{6A0C}\x{6A12}\x{6A13}\x{6A14}\x{6A17}\x{6A19}\x{6A1B}\x{6A1E}' + . '\x{6A1F}\x{6A21}\x{6A22}\x{6A23}\x{6A29}\x{6A2A}\x{6A2B}\x{6A2E}\x{6A35}' + . '\x{6A36}\x{6A38}\x{6A39}\x{6A3A}\x{6A3D}\x{6A44}\x{6A47}\x{6A48}\x{6A4B}' + . '\x{6A58}\x{6A59}\x{6A5F}\x{6A61}\x{6A62}\x{6A66}\x{6A72}\x{6A78}\x{6A7F}' + . '\x{6A80}\x{6A84}\x{6A8D}\x{6A8E}\x{6A90}\x{6A97}\x{6A9C}\x{6AA0}\x{6AA2}' + . '\x{6AA3}\x{6AAA}\x{6AAC}\x{6AAE}\x{6AB3}\x{6AB8}\x{6ABB}\x{6AC1}\x{6AC2}' + . '\x{6AC3}\x{6AD1}\x{6AD3}\x{6ADA}\x{6ADB}\x{6ADE}\x{6ADF}\x{6AE8}\x{6AEA}' + . '\x{6AFA}\x{6AFB}\x{6B04}\x{6B05}\x{6B0A}\x{6B12}\x{6B16}\x{6B1D}\x{6B1F}' + . '\x{6B20}\x{6B21}\x{6B23}\x{6B27}\x{6B32}\x{6B37}\x{6B38}\x{6B39}\x{6B3A}' + . '\x{6B3D}\x{6B3E}\x{6B43}\x{6B47}\x{6B49}\x{6B4C}\x{6B4E}\x{6B50}\x{6B53}' + . '\x{6B54}\x{6B59}\x{6B5B}\x{6B5F}\x{6B61}\x{6B62}\x{6B63}\x{6B64}\x{6B66}' + . '\x{6B69}\x{6B6A}\x{6B6F}\x{6B73}\x{6B74}\x{6B78}\x{6B79}\x{6B7B}\x{6B7F}' + . '\x{6B80}\x{6B83}\x{6B84}\x{6B86}\x{6B89}\x{6B8A}\x{6B8B}\x{6B8D}\x{6B95}' + . '\x{6B96}\x{6B98}\x{6B9E}\x{6BA4}\x{6BAA}\x{6BAB}\x{6BAF}\x{6BB1}\x{6BB2}' + . '\x{6BB3}\x{6BB4}\x{6BB5}\x{6BB7}\x{6BBA}\x{6BBB}\x{6BBC}\x{6BBF}\x{6BC0}' + . '\x{6BC5}\x{6BC6}\x{6BCB}\x{6BCD}\x{6BCE}\x{6BD2}\x{6BD3}\x{6BD4}\x{6BD8}' + . '\x{6BDB}\x{6BDF}\x{6BEB}\x{6BEC}\x{6BEF}\x{6BF3}\x{6C08}\x{6C0F}\x{6C11}' + . '\x{6C13}\x{6C14}\x{6C17}\x{6C1B}\x{6C23}\x{6C24}\x{6C34}\x{6C37}\x{6C38}' + . '\x{6C3E}\x{6C40}\x{6C41}\x{6C42}\x{6C4E}\x{6C50}\x{6C55}\x{6C57}\x{6C5A}' + . '\x{6C5D}\x{6C5E}\x{6C5F}\x{6C60}\x{6C62}\x{6C68}\x{6C6A}\x{6C70}\x{6C72}' + . '\x{6C73}\x{6C7A}\x{6C7D}\x{6C7E}\x{6C81}\x{6C82}\x{6C83}\x{6C88}\x{6C8C}' + . '\x{6C8D}\x{6C90}\x{6C92}\x{6C93}\x{6C96}\x{6C99}\x{6C9A}\x{6C9B}\x{6CA1}' + . '\x{6CA2}\x{6CAB}\x{6CAE}\x{6CB1}\x{6CB3}\x{6CB8}\x{6CB9}\x{6CBA}\x{6CBB}' + . '\x{6CBC}\x{6CBD}\x{6CBE}\x{6CBF}\x{6CC1}\x{6CC4}\x{6CC5}\x{6CC9}\x{6CCA}' + . '\x{6CCC}\x{6CD3}\x{6CD5}\x{6CD7}\x{6CD9}\x{6CDB}\x{6CDD}\x{6CE1}\x{6CE2}' + . '\x{6CE3}\x{6CE5}\x{6CE8}\x{6CEA}\x{6CEF}\x{6CF0}\x{6CF1}\x{6CF3}\x{6D0B}' + . '\x{6D0C}\x{6D12}\x{6D17}\x{6D19}\x{6D1B}\x{6D1E}\x{6D1F}\x{6D25}\x{6D29}' + . '\x{6D2A}\x{6D2B}\x{6D32}\x{6D33}\x{6D35}\x{6D36}\x{6D38}\x{6D3B}\x{6D3D}' + . '\x{6D3E}\x{6D41}\x{6D44}\x{6D45}\x{6D59}\x{6D5A}\x{6D5C}\x{6D63}\x{6D64}' + . '\x{6D66}\x{6D69}\x{6D6A}\x{6D6C}\x{6D6E}\x{6D74}\x{6D77}\x{6D78}\x{6D79}' + . '\x{6D85}\x{6D88}\x{6D8C}\x{6D8E}\x{6D93}\x{6D95}\x{6D99}\x{6D9B}\x{6D9C}' + . '\x{6DAF}\x{6DB2}\x{6DB5}\x{6DB8}\x{6DBC}\x{6DC0}\x{6DC5}\x{6DC6}\x{6DC7}' + . '\x{6DCB}\x{6DCC}\x{6DD1}\x{6DD2}\x{6DD5}\x{6DD8}\x{6DD9}\x{6DDE}\x{6DE1}' + . '\x{6DE4}\x{6DE6}\x{6DE8}\x{6DEA}\x{6DEB}\x{6DEC}\x{6DEE}\x{6DF1}\x{6DF3}' + . '\x{6DF5}\x{6DF7}\x{6DF9}\x{6DFA}\x{6DFB}\x{6E05}\x{6E07}\x{6E08}\x{6E09}' + . '\x{6E0A}\x{6E0B}\x{6E13}\x{6E15}\x{6E19}\x{6E1A}\x{6E1B}\x{6E1D}\x{6E1F}' + . '\x{6E20}\x{6E21}\x{6E23}\x{6E24}\x{6E25}\x{6E26}\x{6E29}\x{6E2B}\x{6E2C}' + . '\x{6E2D}\x{6E2E}\x{6E2F}\x{6E38}\x{6E3A}\x{6E3E}\x{6E43}\x{6E4A}\x{6E4D}' + . '\x{6E4E}\x{6E56}\x{6E58}\x{6E5B}\x{6E5F}\x{6E67}\x{6E6B}\x{6E6E}\x{6E6F}' + . '\x{6E72}\x{6E76}\x{6E7E}\x{6E7F}\x{6E80}\x{6E82}\x{6E8C}\x{6E8F}\x{6E90}' + . '\x{6E96}\x{6E98}\x{6E9C}\x{6E9D}\x{6E9F}\x{6EA2}\x{6EA5}\x{6EAA}\x{6EAF}' + . '\x{6EB2}\x{6EB6}\x{6EB7}\x{6EBA}\x{6EBD}\x{6EC2}\x{6EC4}\x{6EC5}\x{6EC9}' + . '\x{6ECB}\x{6ECC}\x{6ED1}\x{6ED3}\x{6ED4}\x{6ED5}\x{6EDD}\x{6EDE}\x{6EEC}' + . '\x{6EEF}\x{6EF2}\x{6EF4}\x{6EF7}\x{6EF8}\x{6EFE}\x{6EFF}\x{6F01}\x{6F02}' + . '\x{6F06}\x{6F09}\x{6F0F}\x{6F11}\x{6F13}\x{6F14}\x{6F15}\x{6F20}\x{6F22}' + . '\x{6F23}\x{6F2B}\x{6F2C}\x{6F31}\x{6F32}\x{6F38}\x{6F3E}\x{6F3F}\x{6F41}' + . '\x{6F45}\x{6F54}\x{6F58}\x{6F5B}\x{6F5C}\x{6F5F}\x{6F64}\x{6F66}\x{6F6D}' + . '\x{6F6E}\x{6F6F}\x{6F70}\x{6F74}\x{6F78}\x{6F7A}\x{6F7C}\x{6F80}\x{6F81}' + . '\x{6F82}\x{6F84}\x{6F86}\x{6F8E}\x{6F91}\x{6F97}\x{6FA1}\x{6FA3}\x{6FA4}' + . '\x{6FAA}\x{6FB1}\x{6FB3}\x{6FB9}\x{6FC0}\x{6FC1}\x{6FC2}\x{6FC3}\x{6FC6}' + . '\x{6FD4}\x{6FD5}\x{6FD8}\x{6FDB}\x{6FDF}\x{6FE0}\x{6FE1}\x{6FE4}\x{6FEB}' + . '\x{6FEC}\x{6FEE}\x{6FEF}\x{6FF1}\x{6FF3}\x{6FF6}\x{6FFA}\x{6FFE}\x{7001}' + . '\x{7009}\x{700B}\x{700F}\x{7011}\x{7015}\x{7018}\x{701A}\x{701B}\x{701D}' + . '\x{701E}\x{701F}\x{7026}\x{7027}\x{702C}\x{7030}\x{7032}\x{703E}\x{704C}' + . '\x{7051}\x{7058}\x{7063}\x{706B}\x{706F}\x{7070}\x{7078}\x{707C}\x{707D}' + . '\x{7089}\x{708A}\x{708E}\x{7092}\x{7099}\x{70AC}\x{70AD}\x{70AE}\x{70AF}' + . '\x{70B3}\x{70B8}\x{70B9}\x{70BA}\x{70C8}\x{70CB}\x{70CF}\x{70D9}\x{70DD}' + . '\x{70DF}\x{70F1}\x{70F9}\x{70FD}\x{7109}\x{7114}\x{7119}\x{711A}\x{711C}' + . '\x{7121}\x{7126}\x{7136}\x{713C}\x{7149}\x{714C}\x{714E}\x{7155}\x{7156}' + . '\x{7159}\x{7162}\x{7164}\x{7165}\x{7166}\x{7167}\x{7169}\x{716C}\x{716E}' + . '\x{717D}\x{7184}\x{7188}\x{718A}\x{718F}\x{7194}\x{7195}\x{7199}\x{719F}' + . '\x{71A8}\x{71AC}\x{71B1}\x{71B9}\x{71BE}\x{71C3}\x{71C8}\x{71C9}\x{71CE}' + . '\x{71D0}\x{71D2}\x{71D4}\x{71D5}\x{71D7}\x{71DF}\x{71E0}\x{71E5}\x{71E6}' + . '\x{71E7}\x{71EC}\x{71ED}\x{71EE}\x{71F5}\x{71F9}\x{71FB}\x{71FC}\x{71FF}' + . '\x{7206}\x{720D}\x{7210}\x{721B}\x{7228}\x{722A}\x{722C}\x{722D}\x{7230}' + . '\x{7232}\x{7235}\x{7236}\x{723A}\x{723B}\x{723C}\x{723D}\x{723E}\x{723F}' + . '\x{7240}\x{7246}\x{7247}\x{7248}\x{724B}\x{724C}\x{7252}\x{7258}\x{7259}' + . '\x{725B}\x{725D}\x{725F}\x{7261}\x{7262}\x{7267}\x{7269}\x{7272}\x{7274}' + . '\x{7279}\x{727D}\x{727E}\x{7280}\x{7281}\x{7282}\x{7287}\x{7292}\x{7296}' + . '\x{72A0}\x{72A2}\x{72A7}\x{72AC}\x{72AF}\x{72B2}\x{72B6}\x{72B9}\x{72C2}' + . '\x{72C3}\x{72C4}\x{72C6}\x{72CE}\x{72D0}\x{72D2}\x{72D7}\x{72D9}\x{72DB}' + . '\x{72E0}\x{72E1}\x{72E2}\x{72E9}\x{72EC}\x{72ED}\x{72F7}\x{72F8}\x{72F9}' + . '\x{72FC}\x{72FD}\x{730A}\x{7316}\x{7317}\x{731B}\x{731C}\x{731D}\x{731F}' + . '\x{7325}\x{7329}\x{732A}\x{732B}\x{732E}\x{732F}\x{7334}\x{7336}\x{7337}' + . '\x{733E}\x{733F}\x{7344}\x{7345}\x{734E}\x{734F}\x{7357}\x{7363}\x{7368}' + . '\x{736A}\x{7370}\x{7372}\x{7375}\x{7378}\x{737A}\x{737B}\x{7384}\x{7387}' + . '\x{7389}\x{738B}\x{7396}\x{73A9}\x{73B2}\x{73B3}\x{73BB}\x{73C0}\x{73C2}' + . '\x{73C8}\x{73CA}\x{73CD}\x{73CE}\x{73DE}\x{73E0}\x{73E5}\x{73EA}\x{73ED}' + . '\x{73EE}\x{73F1}\x{73F8}\x{73FE}\x{7403}\x{7405}\x{7406}\x{7409}\x{7422}' + . '\x{7425}\x{7432}\x{7433}\x{7434}\x{7435}\x{7436}\x{743A}\x{743F}\x{7441}' + . '\x{7455}\x{7459}\x{745A}\x{745B}\x{745C}\x{745E}\x{745F}\x{7460}\x{7463}' + . '\x{7464}\x{7469}\x{746A}\x{746F}\x{7470}\x{7473}\x{7476}\x{747E}\x{7483}' + . '\x{748B}\x{749E}\x{74A2}\x{74A7}\x{74B0}\x{74BD}\x{74CA}\x{74CF}\x{74D4}' + . '\x{74DC}\x{74E0}\x{74E2}\x{74E3}\x{74E6}\x{74E7}\x{74E9}\x{74EE}\x{74F0}' + . '\x{74F1}\x{74F2}\x{74F6}\x{74F7}\x{74F8}\x{7503}\x{7504}\x{7505}\x{750C}' + . '\x{750D}\x{750E}\x{7511}\x{7513}\x{7515}\x{7518}\x{751A}\x{751C}\x{751E}' + . '\x{751F}\x{7523}\x{7525}\x{7526}\x{7528}\x{752B}\x{752C}\x{7530}\x{7531}' + . '\x{7532}\x{7533}\x{7537}\x{7538}\x{753A}\x{753B}\x{753C}\x{7544}\x{7546}' + . '\x{7549}\x{754A}\x{754B}\x{754C}\x{754D}\x{754F}\x{7551}\x{7554}\x{7559}' + . '\x{755A}\x{755B}\x{755C}\x{755D}\x{7560}\x{7562}\x{7564}\x{7565}\x{7566}' + . '\x{7567}\x{7569}\x{756A}\x{756B}\x{756D}\x{7570}\x{7573}\x{7574}\x{7576}' + . '\x{7577}\x{7578}\x{757F}\x{7582}\x{7586}\x{7587}\x{7589}\x{758A}\x{758B}' + . '\x{758E}\x{758F}\x{7591}\x{7594}\x{759A}\x{759D}\x{75A3}\x{75A5}\x{75AB}' + . '\x{75B1}\x{75B2}\x{75B3}\x{75B5}\x{75B8}\x{75B9}\x{75BC}\x{75BD}\x{75BE}' + . '\x{75C2}\x{75C3}\x{75C5}\x{75C7}\x{75CA}\x{75CD}\x{75D2}\x{75D4}\x{75D5}' + . '\x{75D8}\x{75D9}\x{75DB}\x{75DE}\x{75E2}\x{75E3}\x{75E9}\x{75F0}\x{75F2}' + . '\x{75F3}\x{75F4}\x{75FA}\x{75FC}\x{75FE}\x{75FF}\x{7601}\x{7609}\x{760B}' + . '\x{760D}\x{761F}\x{7620}\x{7621}\x{7622}\x{7624}\x{7627}\x{7630}\x{7634}' + . '\x{763B}\x{7642}\x{7646}\x{7647}\x{7648}\x{764C}\x{7652}\x{7656}\x{7658}' + . '\x{765C}\x{7661}\x{7662}\x{7667}\x{7668}\x{7669}\x{766A}\x{766C}\x{7670}' + . '\x{7672}\x{7676}\x{7678}\x{767A}\x{767B}\x{767C}\x{767D}\x{767E}\x{7680}' + . '\x{7683}\x{7684}\x{7686}\x{7687}\x{7688}\x{768B}\x{768E}\x{7690}\x{7693}' + . '\x{7696}\x{7699}\x{769A}\x{76AE}\x{76B0}\x{76B4}\x{76B7}\x{76B8}\x{76B9}' + . '\x{76BA}\x{76BF}\x{76C2}\x{76C3}\x{76C6}\x{76C8}\x{76CA}\x{76CD}\x{76D2}' + . '\x{76D6}\x{76D7}\x{76DB}\x{76DC}\x{76DE}\x{76DF}\x{76E1}\x{76E3}\x{76E4}' + . '\x{76E5}\x{76E7}\x{76EA}\x{76EE}\x{76F2}\x{76F4}\x{76F8}\x{76FB}\x{76FE}' + . '\x{7701}\x{7704}\x{7707}\x{7708}\x{7709}\x{770B}\x{770C}\x{771B}\x{771E}' + . '\x{771F}\x{7720}\x{7724}\x{7725}\x{7726}\x{7729}\x{7737}\x{7738}\x{773A}' + . '\x{773C}\x{7740}\x{7747}\x{775A}\x{775B}\x{7761}\x{7763}\x{7765}\x{7766}' + . '\x{7768}\x{776B}\x{7779}\x{777E}\x{777F}\x{778B}\x{778E}\x{7791}\x{779E}' + . '\x{77A0}\x{77A5}\x{77AC}\x{77AD}\x{77B0}\x{77B3}\x{77B6}\x{77B9}\x{77BB}' + . '\x{77BC}\x{77BD}\x{77BF}\x{77C7}\x{77CD}\x{77D7}\x{77DA}\x{77DB}\x{77DC}' + . '\x{77E2}\x{77E3}\x{77E5}\x{77E7}\x{77E9}\x{77ED}\x{77EE}\x{77EF}\x{77F3}' + . '\x{77FC}\x{7802}\x{780C}\x{7812}\x{7814}\x{7815}\x{7820}\x{7825}\x{7826}' + . '\x{7827}\x{7832}\x{7834}\x{783A}\x{783F}\x{7845}\x{785D}\x{786B}\x{786C}' + . '\x{786F}\x{7872}\x{7874}\x{787C}\x{7881}\x{7886}\x{7887}\x{788C}\x{788D}' + . '\x{788E}\x{7891}\x{7893}\x{7895}\x{7897}\x{789A}\x{78A3}\x{78A7}\x{78A9}' + . '\x{78AA}\x{78AF}\x{78B5}\x{78BA}\x{78BC}\x{78BE}\x{78C1}\x{78C5}\x{78C6}' + . '\x{78CA}\x{78CB}\x{78D0}\x{78D1}\x{78D4}\x{78DA}\x{78E7}\x{78E8}\x{78EC}' + . '\x{78EF}\x{78F4}\x{78FD}\x{7901}\x{7907}\x{790E}\x{7911}\x{7912}\x{7919}' + . '\x{7926}\x{792A}\x{792B}\x{792C}\x{793A}\x{793C}\x{793E}\x{7940}\x{7941}' + . '\x{7947}\x{7948}\x{7949}\x{7950}\x{7953}\x{7955}\x{7956}\x{7957}\x{795A}' + . '\x{795D}\x{795E}\x{795F}\x{7960}\x{7962}\x{7965}\x{7968}\x{796D}\x{7977}' + . '\x{797A}\x{797F}\x{7980}\x{7981}\x{7984}\x{7985}\x{798A}\x{798D}\x{798E}' + . '\x{798F}\x{799D}\x{79A6}\x{79A7}\x{79AA}\x{79AE}\x{79B0}\x{79B3}\x{79B9}' + . '\x{79BA}\x{79BD}\x{79BE}\x{79BF}\x{79C0}\x{79C1}\x{79C9}\x{79CB}\x{79D1}' + . '\x{79D2}\x{79D5}\x{79D8}\x{79DF}\x{79E1}\x{79E3}\x{79E4}\x{79E6}\x{79E7}' + . '\x{79E9}\x{79EC}\x{79F0}\x{79FB}\x{7A00}\x{7A08}\x{7A0B}\x{7A0D}\x{7A0E}' + . '\x{7A14}\x{7A17}\x{7A18}\x{7A19}\x{7A1A}\x{7A1C}\x{7A1F}\x{7A20}\x{7A2E}' + . '\x{7A31}\x{7A32}\x{7A37}\x{7A3B}\x{7A3C}\x{7A3D}\x{7A3E}\x{7A3F}\x{7A40}' + . '\x{7A42}\x{7A43}\x{7A46}\x{7A49}\x{7A4D}\x{7A4E}\x{7A4F}\x{7A50}\x{7A57}' + . '\x{7A61}\x{7A62}\x{7A63}\x{7A69}\x{7A6B}\x{7A70}\x{7A74}\x{7A76}\x{7A79}' + . '\x{7A7A}\x{7A7D}\x{7A7F}\x{7A81}\x{7A83}\x{7A84}\x{7A88}\x{7A92}\x{7A93}' + . '\x{7A95}\x{7A96}\x{7A97}\x{7A98}\x{7A9F}\x{7AA9}\x{7AAA}\x{7AAE}\x{7AAF}' + . '\x{7AB0}\x{7AB6}\x{7ABA}\x{7ABF}\x{7AC3}\x{7AC4}\x{7AC5}\x{7AC7}\x{7AC8}' + . '\x{7ACA}\x{7ACB}\x{7ACD}\x{7ACF}\x{7AD2}\x{7AD3}\x{7AD5}\x{7AD9}\x{7ADA}' + . '\x{7ADC}\x{7ADD}\x{7ADF}\x{7AE0}\x{7AE1}\x{7AE2}\x{7AE3}\x{7AE5}\x{7AE6}' + . '\x{7AEA}\x{7AED}\x{7AEF}\x{7AF0}\x{7AF6}\x{7AF8}\x{7AF9}\x{7AFA}\x{7AFF}' + . '\x{7B02}\x{7B04}\x{7B06}\x{7B08}\x{7B0A}\x{7B0B}\x{7B0F}\x{7B11}\x{7B18}' + . '\x{7B19}\x{7B1B}\x{7B1E}\x{7B20}\x{7B25}\x{7B26}\x{7B28}\x{7B2C}\x{7B33}' + . '\x{7B35}\x{7B36}\x{7B39}\x{7B45}\x{7B46}\x{7B48}\x{7B49}\x{7B4B}\x{7B4C}' + . '\x{7B4D}\x{7B4F}\x{7B50}\x{7B51}\x{7B52}\x{7B54}\x{7B56}\x{7B5D}\x{7B65}' + . '\x{7B67}\x{7B6C}\x{7B6E}\x{7B70}\x{7B71}\x{7B74}\x{7B75}\x{7B7A}\x{7B86}' + . '\x{7B87}\x{7B8B}\x{7B8D}\x{7B8F}\x{7B92}\x{7B94}\x{7B95}\x{7B97}\x{7B98}' + . '\x{7B99}\x{7B9A}\x{7B9C}\x{7B9D}\x{7B9F}\x{7BA1}\x{7BAA}\x{7BAD}\x{7BB1}' + . '\x{7BB4}\x{7BB8}\x{7BC0}\x{7BC1}\x{7BC4}\x{7BC6}\x{7BC7}\x{7BC9}\x{7BCB}' + . '\x{7BCC}\x{7BCF}\x{7BDD}\x{7BE0}\x{7BE4}\x{7BE5}\x{7BE6}\x{7BE9}\x{7BED}' + . '\x{7BF3}\x{7BF6}\x{7BF7}\x{7C00}\x{7C07}\x{7C0D}\x{7C11}\x{7C12}\x{7C13}' + . '\x{7C14}\x{7C17}\x{7C1F}\x{7C21}\x{7C23}\x{7C27}\x{7C2A}\x{7C2B}\x{7C37}' + . '\x{7C38}\x{7C3D}\x{7C3E}\x{7C3F}\x{7C40}\x{7C43}\x{7C4C}\x{7C4D}\x{7C4F}' + . '\x{7C50}\x{7C54}\x{7C56}\x{7C58}\x{7C5F}\x{7C60}\x{7C64}\x{7C65}\x{7C6C}' + . '\x{7C73}\x{7C75}\x{7C7E}\x{7C81}\x{7C82}\x{7C83}\x{7C89}\x{7C8B}\x{7C8D}' + . '\x{7C90}\x{7C92}\x{7C95}\x{7C97}\x{7C98}\x{7C9B}\x{7C9F}\x{7CA1}\x{7CA2}' + . '\x{7CA4}\x{7CA5}\x{7CA7}\x{7CA8}\x{7CAB}\x{7CAD}\x{7CAE}\x{7CB1}\x{7CB2}' + . '\x{7CB3}\x{7CB9}\x{7CBD}\x{7CBE}\x{7CC0}\x{7CC2}\x{7CC5}\x{7CCA}\x{7CCE}' + . '\x{7CD2}\x{7CD6}\x{7CD8}\x{7CDC}\x{7CDE}\x{7CDF}\x{7CE0}\x{7CE2}\x{7CE7}' + . '\x{7CEF}\x{7CF2}\x{7CF4}\x{7CF6}\x{7CF8}\x{7CFA}\x{7CFB}\x{7CFE}\x{7D00}' + . '\x{7D02}\x{7D04}\x{7D05}\x{7D06}\x{7D0A}\x{7D0B}\x{7D0D}\x{7D10}\x{7D14}' + . '\x{7D15}\x{7D17}\x{7D18}\x{7D19}\x{7D1A}\x{7D1B}\x{7D1C}\x{7D20}\x{7D21}' + . '\x{7D22}\x{7D2B}\x{7D2C}\x{7D2E}\x{7D2F}\x{7D30}\x{7D32}\x{7D33}\x{7D35}' + . '\x{7D39}\x{7D3A}\x{7D3F}\x{7D42}\x{7D43}\x{7D44}\x{7D45}\x{7D46}\x{7D4B}' + . '\x{7D4C}\x{7D4E}\x{7D4F}\x{7D50}\x{7D56}\x{7D5B}\x{7D5E}\x{7D61}\x{7D62}' + . '\x{7D63}\x{7D66}\x{7D68}\x{7D6E}\x{7D71}\x{7D72}\x{7D73}\x{7D75}\x{7D76}' + . '\x{7D79}\x{7D7D}\x{7D89}\x{7D8F}\x{7D93}\x{7D99}\x{7D9A}\x{7D9B}\x{7D9C}' + . '\x{7D9F}\x{7DA2}\x{7DA3}\x{7DAB}\x{7DAC}\x{7DAD}\x{7DAE}\x{7DAF}\x{7DB0}' + . '\x{7DB1}\x{7DB2}\x{7DB4}\x{7DB5}\x{7DB8}\x{7DBA}\x{7DBB}\x{7DBD}\x{7DBE}' + . '\x{7DBF}\x{7DC7}\x{7DCA}\x{7DCB}\x{7DCF}\x{7DD1}\x{7DD2}\x{7DD5}\x{7DD8}' + . '\x{7DDA}\x{7DDC}\x{7DDD}\x{7DDE}\x{7DE0}\x{7DE1}\x{7DE4}\x{7DE8}\x{7DE9}' + . '\x{7DEC}\x{7DEF}\x{7DF2}\x{7DF4}\x{7DFB}\x{7E01}\x{7E04}\x{7E05}\x{7E09}' + . '\x{7E0A}\x{7E0B}\x{7E12}\x{7E1B}\x{7E1E}\x{7E1F}\x{7E21}\x{7E22}\x{7E23}' + . '\x{7E26}\x{7E2B}\x{7E2E}\x{7E31}\x{7E32}\x{7E35}\x{7E37}\x{7E39}\x{7E3A}' + . '\x{7E3B}\x{7E3D}\x{7E3E}\x{7E41}\x{7E43}\x{7E46}\x{7E4A}\x{7E4B}\x{7E4D}' + . '\x{7E54}\x{7E55}\x{7E56}\x{7E59}\x{7E5A}\x{7E5D}\x{7E5E}\x{7E66}\x{7E67}' + . '\x{7E69}\x{7E6A}\x{7E6D}\x{7E70}\x{7E79}\x{7E7B}\x{7E7C}\x{7E7D}\x{7E7F}' + . '\x{7E82}\x{7E83}\x{7E88}\x{7E89}\x{7E8C}\x{7E8E}\x{7E8F}\x{7E90}\x{7E92}' + . '\x{7E93}\x{7E94}\x{7E96}\x{7E9B}\x{7E9C}\x{7F36}\x{7F38}\x{7F3A}\x{7F45}' + . '\x{7F4C}\x{7F4D}\x{7F4E}\x{7F50}\x{7F51}\x{7F54}\x{7F55}\x{7F58}\x{7F5F}' + . '\x{7F60}\x{7F67}\x{7F68}\x{7F69}\x{7F6A}\x{7F6B}\x{7F6E}\x{7F70}\x{7F72}' + . '\x{7F75}\x{7F77}\x{7F78}\x{7F79}\x{7F82}\x{7F83}\x{7F85}\x{7F86}\x{7F87}' + . '\x{7F88}\x{7F8A}\x{7F8C}\x{7F8E}\x{7F94}\x{7F9A}\x{7F9D}\x{7F9E}\x{7FA3}' + . '\x{7FA4}\x{7FA8}\x{7FA9}\x{7FAE}\x{7FAF}\x{7FB2}\x{7FB6}\x{7FB8}\x{7FB9}' + . '\x{7FBD}\x{7FC1}\x{7FC5}\x{7FC6}\x{7FCA}\x{7FCC}\x{7FD2}\x{7FD4}\x{7FD5}' + . '\x{7FE0}\x{7FE1}\x{7FE6}\x{7FE9}\x{7FEB}\x{7FF0}\x{7FF3}\x{7FF9}\x{7FFB}' + . '\x{7FFC}\x{8000}\x{8001}\x{8003}\x{8004}\x{8005}\x{8006}\x{800B}\x{800C}' + . '\x{8010}\x{8012}\x{8015}\x{8017}\x{8018}\x{8019}\x{801C}\x{8021}\x{8028}' + . '\x{8033}\x{8036}\x{803B}\x{803D}\x{803F}\x{8046}\x{804A}\x{8052}\x{8056}' + . '\x{8058}\x{805A}\x{805E}\x{805F}\x{8061}\x{8062}\x{8068}\x{806F}\x{8070}' + . '\x{8072}\x{8073}\x{8074}\x{8076}\x{8077}\x{8079}\x{807D}\x{807E}\x{807F}' + . '\x{8084}\x{8085}\x{8086}\x{8087}\x{8089}\x{808B}\x{808C}\x{8093}\x{8096}' + . '\x{8098}\x{809A}\x{809B}\x{809D}\x{80A1}\x{80A2}\x{80A5}\x{80A9}\x{80AA}' + . '\x{80AC}\x{80AD}\x{80AF}\x{80B1}\x{80B2}\x{80B4}\x{80BA}\x{80C3}\x{80C4}' + . '\x{80C6}\x{80CC}\x{80CE}\x{80D6}\x{80D9}\x{80DA}\x{80DB}\x{80DD}\x{80DE}' + . '\x{80E1}\x{80E4}\x{80E5}\x{80EF}\x{80F1}\x{80F4}\x{80F8}\x{80FC}\x{80FD}' + . '\x{8102}\x{8105}\x{8106}\x{8107}\x{8108}\x{8109}\x{810A}\x{811A}\x{811B}' + . '\x{8123}\x{8129}\x{812F}\x{8131}\x{8133}\x{8139}\x{813E}\x{8146}\x{814B}' + . '\x{814E}\x{8150}\x{8151}\x{8153}\x{8154}\x{8155}\x{815F}\x{8165}\x{8166}' + . '\x{816B}\x{816E}\x{8170}\x{8171}\x{8174}\x{8178}\x{8179}\x{817A}\x{817F}' + . '\x{8180}\x{8182}\x{8183}\x{8188}\x{818A}\x{818F}\x{8193}\x{8195}\x{819A}' + . '\x{819C}\x{819D}\x{81A0}\x{81A3}\x{81A4}\x{81A8}\x{81A9}\x{81B0}\x{81B3}' + . '\x{81B5}\x{81B8}\x{81BA}\x{81BD}\x{81BE}\x{81BF}\x{81C0}\x{81C2}\x{81C6}' + . '\x{81C8}\x{81C9}\x{81CD}\x{81D1}\x{81D3}\x{81D8}\x{81D9}\x{81DA}\x{81DF}' + . '\x{81E0}\x{81E3}\x{81E5}\x{81E7}\x{81E8}\x{81EA}\x{81ED}\x{81F3}\x{81F4}' + . '\x{81FA}\x{81FB}\x{81FC}\x{81FE}\x{8201}\x{8202}\x{8205}\x{8207}\x{8208}' + . '\x{8209}\x{820A}\x{820C}\x{820D}\x{820E}\x{8210}\x{8212}\x{8216}\x{8217}' + . '\x{8218}\x{821B}\x{821C}\x{821E}\x{821F}\x{8229}\x{822A}\x{822B}\x{822C}' + . '\x{822E}\x{8233}\x{8235}\x{8236}\x{8237}\x{8238}\x{8239}\x{8240}\x{8247}' + . '\x{8258}\x{8259}\x{825A}\x{825D}\x{825F}\x{8262}\x{8264}\x{8266}\x{8268}' + . '\x{826A}\x{826B}\x{826E}\x{826F}\x{8271}\x{8272}\x{8276}\x{8277}\x{8278}' + . '\x{827E}\x{828B}\x{828D}\x{8292}\x{8299}\x{829D}\x{829F}\x{82A5}\x{82A6}' + . '\x{82AB}\x{82AC}\x{82AD}\x{82AF}\x{82B1}\x{82B3}\x{82B8}\x{82B9}\x{82BB}' + . '\x{82BD}\x{82C5}\x{82D1}\x{82D2}\x{82D3}\x{82D4}\x{82D7}\x{82D9}\x{82DB}' + . '\x{82DC}\x{82DE}\x{82DF}\x{82E1}\x{82E3}\x{82E5}\x{82E6}\x{82E7}\x{82EB}' + . '\x{82F1}\x{82F3}\x{82F4}\x{82F9}\x{82FA}\x{82FB}\x{8302}\x{8303}\x{8304}' + . '\x{8305}\x{8306}\x{8309}\x{830E}\x{8316}\x{8317}\x{8318}\x{831C}\x{8323}' + . '\x{8328}\x{832B}\x{832F}\x{8331}\x{8332}\x{8334}\x{8335}\x{8336}\x{8338}' + . '\x{8339}\x{8340}\x{8345}\x{8349}\x{834A}\x{834F}\x{8350}\x{8352}\x{8358}' + . '\x{8373}\x{8375}\x{8377}\x{837B}\x{837C}\x{8385}\x{8387}\x{8389}\x{838A}' + . '\x{838E}\x{8393}\x{8396}\x{839A}\x{839E}\x{839F}\x{83A0}\x{83A2}\x{83A8}' + . '\x{83AA}\x{83AB}\x{83B1}\x{83B5}\x{83BD}\x{83C1}\x{83C5}\x{83CA}\x{83CC}' + . '\x{83CE}\x{83D3}\x{83D6}\x{83D8}\x{83DC}\x{83DF}\x{83E0}\x{83E9}\x{83EB}' + . '\x{83EF}\x{83F0}\x{83F1}\x{83F2}\x{83F4}\x{83F7}\x{83FB}\x{83FD}\x{8403}' + . '\x{8404}\x{8407}\x{840B}\x{840C}\x{840D}\x{840E}\x{8413}\x{8420}\x{8422}' + . '\x{8429}\x{842A}\x{842C}\x{8431}\x{8435}\x{8438}\x{843C}\x{843D}\x{8446}' + . '\x{8449}\x{844E}\x{8457}\x{845B}\x{8461}\x{8462}\x{8463}\x{8466}\x{8469}' + . '\x{846B}\x{846C}\x{846D}\x{846E}\x{846F}\x{8471}\x{8475}\x{8477}\x{8479}' + . '\x{847A}\x{8482}\x{8484}\x{848B}\x{8490}\x{8494}\x{8499}\x{849C}\x{849F}' + . '\x{84A1}\x{84AD}\x{84B2}\x{84B8}\x{84B9}\x{84BB}\x{84BC}\x{84BF}\x{84C1}' + . '\x{84C4}\x{84C6}\x{84C9}\x{84CA}\x{84CB}\x{84CD}\x{84D0}\x{84D1}\x{84D6}' + . '\x{84D9}\x{84DA}\x{84EC}\x{84EE}\x{84F4}\x{84FC}\x{84FF}\x{8500}\x{8506}' + . '\x{8511}\x{8513}\x{8514}\x{8515}\x{8517}\x{8518}\x{851A}\x{851F}\x{8521}' + . '\x{8526}\x{852C}\x{852D}\x{8535}\x{853D}\x{8540}\x{8541}\x{8543}\x{8548}' + . '\x{8549}\x{854A}\x{854B}\x{854E}\x{8555}\x{8557}\x{8558}\x{855A}\x{8563}' + . '\x{8568}\x{8569}\x{856A}\x{856D}\x{8577}\x{857E}\x{8580}\x{8584}\x{8587}' + . '\x{8588}\x{858A}\x{8590}\x{8591}\x{8594}\x{8597}\x{8599}\x{859B}\x{859C}' + . '\x{85A4}\x{85A6}\x{85A8}\x{85A9}\x{85AA}\x{85AB}\x{85AC}\x{85AE}\x{85AF}' + . '\x{85B9}\x{85BA}\x{85C1}\x{85C9}\x{85CD}\x{85CF}\x{85D0}\x{85D5}\x{85DC}' + . '\x{85DD}\x{85E4}\x{85E5}\x{85E9}\x{85EA}\x{85F7}\x{85F9}\x{85FA}\x{85FB}' + . '\x{85FE}\x{8602}\x{8606}\x{8607}\x{860A}\x{860B}\x{8613}\x{8616}\x{8617}' + . '\x{861A}\x{8622}\x{862D}\x{862F}\x{8630}\x{863F}\x{864D}\x{864E}\x{8650}' + . '\x{8654}\x{8655}\x{865A}\x{865C}\x{865E}\x{865F}\x{8667}\x{866B}\x{8671}' + . '\x{8679}\x{867B}\x{868A}\x{868B}\x{868C}\x{8693}\x{8695}\x{86A3}\x{86A4}' + . '\x{86A9}\x{86AA}\x{86AB}\x{86AF}\x{86B0}\x{86B6}\x{86C4}\x{86C6}\x{86C7}' + . '\x{86C9}\x{86CB}\x{86CD}\x{86CE}\x{86D4}\x{86D9}\x{86DB}\x{86DE}\x{86DF}' + . '\x{86E4}\x{86E9}\x{86EC}\x{86ED}\x{86EE}\x{86EF}\x{86F8}\x{86F9}\x{86FB}' + . '\x{86FE}\x{8700}\x{8702}\x{8703}\x{8706}\x{8708}\x{8709}\x{870A}\x{870D}' + . '\x{8711}\x{8712}\x{8718}\x{871A}\x{871C}\x{8725}\x{8729}\x{8734}\x{8737}' + . '\x{873B}\x{873F}\x{8749}\x{874B}\x{874C}\x{874E}\x{8753}\x{8755}\x{8757}' + . '\x{8759}\x{875F}\x{8760}\x{8763}\x{8766}\x{8768}\x{876A}\x{876E}\x{8774}' + . '\x{8776}\x{8778}\x{877F}\x{8782}\x{878D}\x{879F}\x{87A2}\x{87AB}\x{87AF}' + . '\x{87B3}\x{87BA}\x{87BB}\x{87BD}\x{87C0}\x{87C4}\x{87C6}\x{87C7}\x{87CB}' + . '\x{87D0}\x{87D2}\x{87E0}\x{87EF}\x{87F2}\x{87F6}\x{87F7}\x{87F9}\x{87FB}' + . '\x{87FE}\x{8805}\x{880D}\x{880E}\x{880F}\x{8811}\x{8815}\x{8816}\x{8821}' + . '\x{8822}\x{8823}\x{8827}\x{8831}\x{8836}\x{8839}\x{883B}\x{8840}\x{8842}' + . '\x{8844}\x{8846}\x{884C}\x{884D}\x{8852}\x{8853}\x{8857}\x{8859}\x{885B}' + . '\x{885D}\x{885E}\x{8861}\x{8862}\x{8863}\x{8868}\x{886B}\x{8870}\x{8872}' + . '\x{8875}\x{8877}\x{887D}\x{887E}\x{887F}\x{8881}\x{8882}\x{8888}\x{888B}' + . '\x{888D}\x{8892}\x{8896}\x{8897}\x{8899}\x{889E}\x{88A2}\x{88A4}\x{88AB}' + . '\x{88AE}\x{88B0}\x{88B1}\x{88B4}\x{88B5}\x{88B7}\x{88BF}\x{88C1}\x{88C2}' + . '\x{88C3}\x{88C4}\x{88C5}\x{88CF}\x{88D4}\x{88D5}\x{88D8}\x{88D9}\x{88DC}' + . '\x{88DD}\x{88DF}\x{88E1}\x{88E8}\x{88F2}\x{88F3}\x{88F4}\x{88F8}\x{88F9}' + . '\x{88FC}\x{88FD}\x{88FE}\x{8902}\x{8904}\x{8907}\x{890A}\x{890C}\x{8910}' + . '\x{8912}\x{8913}\x{891D}\x{891E}\x{8925}\x{892A}\x{892B}\x{8936}\x{8938}' + . '\x{893B}\x{8941}\x{8943}\x{8944}\x{894C}\x{894D}\x{8956}\x{895E}\x{895F}' + . '\x{8960}\x{8964}\x{8966}\x{896A}\x{896D}\x{896F}\x{8972}\x{8974}\x{8977}' + . '\x{897E}\x{897F}\x{8981}\x{8983}\x{8986}\x{8987}\x{8988}\x{898A}\x{898B}' + . '\x{898F}\x{8993}\x{8996}\x{8997}\x{8998}\x{899A}\x{89A1}\x{89A6}\x{89A7}' + . '\x{89A9}\x{89AA}\x{89AC}\x{89AF}\x{89B2}\x{89B3}\x{89BA}\x{89BD}\x{89BF}' + . '\x{89C0}\x{89D2}\x{89DA}\x{89DC}\x{89DD}\x{89E3}\x{89E6}\x{89E7}\x{89F4}' + . '\x{89F8}\x{8A00}\x{8A02}\x{8A03}\x{8A08}\x{8A0A}\x{8A0C}\x{8A0E}\x{8A10}' + . '\x{8A13}\x{8A16}\x{8A17}\x{8A18}\x{8A1B}\x{8A1D}\x{8A1F}\x{8A23}\x{8A25}' + . '\x{8A2A}\x{8A2D}\x{8A31}\x{8A33}\x{8A34}\x{8A36}\x{8A3A}\x{8A3B}\x{8A3C}' + . '\x{8A41}\x{8A46}\x{8A48}\x{8A50}\x{8A51}\x{8A52}\x{8A54}\x{8A55}\x{8A5B}' + . '\x{8A5E}\x{8A60}\x{8A62}\x{8A63}\x{8A66}\x{8A69}\x{8A6B}\x{8A6C}\x{8A6D}' + . '\x{8A6E}\x{8A70}\x{8A71}\x{8A72}\x{8A73}\x{8A7C}\x{8A82}\x{8A84}\x{8A85}' + . '\x{8A87}\x{8A89}\x{8A8C}\x{8A8D}\x{8A91}\x{8A93}\x{8A95}\x{8A98}\x{8A9A}' + . '\x{8A9E}\x{8AA0}\x{8AA1}\x{8AA3}\x{8AA4}\x{8AA5}\x{8AA6}\x{8AA8}\x{8AAC}' + . '\x{8AAD}\x{8AB0}\x{8AB2}\x{8AB9}\x{8ABC}\x{8ABF}\x{8AC2}\x{8AC4}\x{8AC7}' + . '\x{8ACB}\x{8ACC}\x{8ACD}\x{8ACF}\x{8AD2}\x{8AD6}\x{8ADA}\x{8ADB}\x{8ADC}' + . '\x{8ADE}\x{8AE0}\x{8AE1}\x{8AE2}\x{8AE4}\x{8AE6}\x{8AE7}\x{8AEB}\x{8AED}' + . '\x{8AEE}\x{8AF1}\x{8AF3}\x{8AF7}\x{8AF8}\x{8AFA}\x{8AFE}\x{8B00}\x{8B01}' + . '\x{8B02}\x{8B04}\x{8B07}\x{8B0C}\x{8B0E}\x{8B10}\x{8B14}\x{8B16}\x{8B17}' + . '\x{8B19}\x{8B1A}\x{8B1B}\x{8B1D}\x{8B20}\x{8B21}\x{8B26}\x{8B28}\x{8B2B}' + . '\x{8B2C}\x{8B33}\x{8B39}\x{8B3E}\x{8B41}\x{8B49}\x{8B4C}\x{8B4E}\x{8B4F}' + . '\x{8B56}\x{8B58}\x{8B5A}\x{8B5B}\x{8B5C}\x{8B5F}\x{8B66}\x{8B6B}\x{8B6C}' + . '\x{8B6F}\x{8B70}\x{8B71}\x{8B72}\x{8B74}\x{8B77}\x{8B7D}\x{8B80}\x{8B83}' + . '\x{8B8A}\x{8B8C}\x{8B8E}\x{8B90}\x{8B92}\x{8B93}\x{8B96}\x{8B99}\x{8B9A}' + . '\x{8C37}\x{8C3A}\x{8C3F}\x{8C41}\x{8C46}\x{8C48}\x{8C4A}\x{8C4C}\x{8C4E}' + . '\x{8C50}\x{8C55}\x{8C5A}\x{8C61}\x{8C62}\x{8C6A}\x{8C6B}\x{8C6C}\x{8C78}' + . '\x{8C79}\x{8C7A}\x{8C7C}\x{8C82}\x{8C85}\x{8C89}\x{8C8A}\x{8C8C}\x{8C8D}' + . '\x{8C8E}\x{8C94}\x{8C98}\x{8C9D}\x{8C9E}\x{8CA0}\x{8CA1}\x{8CA2}\x{8CA7}' + . '\x{8CA8}\x{8CA9}\x{8CAA}\x{8CAB}\x{8CAC}\x{8CAD}\x{8CAE}\x{8CAF}\x{8CB0}' + . '\x{8CB2}\x{8CB3}\x{8CB4}\x{8CB6}\x{8CB7}\x{8CB8}\x{8CBB}\x{8CBC}\x{8CBD}' + . '\x{8CBF}\x{8CC0}\x{8CC1}\x{8CC2}\x{8CC3}\x{8CC4}\x{8CC7}\x{8CC8}\x{8CCA}' + . '\x{8CCD}\x{8CCE}\x{8CD1}\x{8CD3}\x{8CDA}\x{8CDB}\x{8CDC}\x{8CDE}\x{8CE0}' + . '\x{8CE2}\x{8CE3}\x{8CE4}\x{8CE6}\x{8CEA}\x{8CED}\x{8CFA}\x{8CFB}\x{8CFC}' + . '\x{8CFD}\x{8D04}\x{8D05}\x{8D07}\x{8D08}\x{8D0A}\x{8D0B}\x{8D0D}\x{8D0F}' + . '\x{8D10}\x{8D13}\x{8D14}\x{8D16}\x{8D64}\x{8D66}\x{8D67}\x{8D6B}\x{8D6D}' + . '\x{8D70}\x{8D71}\x{8D73}\x{8D74}\x{8D77}\x{8D81}\x{8D85}\x{8D8A}\x{8D99}' + . '\x{8DA3}\x{8DA8}\x{8DB3}\x{8DBA}\x{8DBE}\x{8DC2}\x{8DCB}\x{8DCC}\x{8DCF}' + . '\x{8DD6}\x{8DDA}\x{8DDB}\x{8DDD}\x{8DDF}\x{8DE1}\x{8DE3}\x{8DE8}\x{8DEA}' + . '\x{8DEB}\x{8DEF}\x{8DF3}\x{8DF5}\x{8DFC}\x{8DFF}\x{8E08}\x{8E09}\x{8E0A}' + . '\x{8E0F}\x{8E10}\x{8E1D}\x{8E1E}\x{8E1F}\x{8E2A}\x{8E30}\x{8E34}\x{8E35}' + . '\x{8E42}\x{8E44}\x{8E47}\x{8E48}\x{8E49}\x{8E4A}\x{8E4C}\x{8E50}\x{8E55}' + . '\x{8E59}\x{8E5F}\x{8E60}\x{8E63}\x{8E64}\x{8E72}\x{8E74}\x{8E76}\x{8E7C}' + . '\x{8E81}\x{8E84}\x{8E85}\x{8E87}\x{8E8A}\x{8E8B}\x{8E8D}\x{8E91}\x{8E93}' + . '\x{8E94}\x{8E99}\x{8EA1}\x{8EAA}\x{8EAB}\x{8EAC}\x{8EAF}\x{8EB0}\x{8EB1}' + . '\x{8EBE}\x{8EC5}\x{8EC6}\x{8EC8}\x{8ECA}\x{8ECB}\x{8ECC}\x{8ECD}\x{8ED2}' + . '\x{8EDB}\x{8EDF}\x{8EE2}\x{8EE3}\x{8EEB}\x{8EF8}\x{8EFB}\x{8EFC}\x{8EFD}' + . '\x{8EFE}\x{8F03}\x{8F05}\x{8F09}\x{8F0A}\x{8F0C}\x{8F12}\x{8F13}\x{8F14}' + . '\x{8F15}\x{8F19}\x{8F1B}\x{8F1C}\x{8F1D}\x{8F1F}\x{8F26}\x{8F29}\x{8F2A}' + . '\x{8F2F}\x{8F33}\x{8F38}\x{8F39}\x{8F3B}\x{8F3E}\x{8F3F}\x{8F42}\x{8F44}' + . '\x{8F45}\x{8F46}\x{8F49}\x{8F4C}\x{8F4D}\x{8F4E}\x{8F57}\x{8F5C}\x{8F5F}' + . '\x{8F61}\x{8F62}\x{8F63}\x{8F64}\x{8F9B}\x{8F9C}\x{8F9E}\x{8F9F}\x{8FA3}' + . '\x{8FA7}\x{8FA8}\x{8FAD}\x{8FAE}\x{8FAF}\x{8FB0}\x{8FB1}\x{8FB2}\x{8FB7}' + . '\x{8FBA}\x{8FBB}\x{8FBC}\x{8FBF}\x{8FC2}\x{8FC4}\x{8FC5}\x{8FCE}\x{8FD1}' + . '\x{8FD4}\x{8FDA}\x{8FE2}\x{8FE5}\x{8FE6}\x{8FE9}\x{8FEA}\x{8FEB}\x{8FED}' + . '\x{8FEF}\x{8FF0}\x{8FF4}\x{8FF7}\x{8FF8}\x{8FF9}\x{8FFA}\x{8FFD}\x{9000}' + . '\x{9001}\x{9003}\x{9005}\x{9006}\x{900B}\x{900D}\x{900E}\x{900F}\x{9010}' + . '\x{9011}\x{9013}\x{9014}\x{9015}\x{9016}\x{9017}\x{9019}\x{901A}\x{901D}' + . '\x{901E}\x{901F}\x{9020}\x{9021}\x{9022}\x{9023}\x{9027}\x{902E}\x{9031}' + . '\x{9032}\x{9035}\x{9036}\x{9038}\x{9039}\x{903C}\x{903E}\x{9041}\x{9042}' + . '\x{9045}\x{9047}\x{9049}\x{904A}\x{904B}\x{904D}\x{904E}\x{904F}\x{9050}' + . '\x{9051}\x{9052}\x{9053}\x{9054}\x{9055}\x{9056}\x{9058}\x{9059}\x{905C}' + . '\x{905E}\x{9060}\x{9061}\x{9063}\x{9065}\x{9068}\x{9069}\x{906D}\x{906E}' + . '\x{906F}\x{9072}\x{9075}\x{9076}\x{9077}\x{9078}\x{907A}\x{907C}\x{907D}' + . '\x{907F}\x{9080}\x{9081}\x{9082}\x{9083}\x{9084}\x{9087}\x{9089}\x{908A}' + . '\x{908F}\x{9091}\x{90A3}\x{90A6}\x{90A8}\x{90AA}\x{90AF}\x{90B1}\x{90B5}' + . '\x{90B8}\x{90C1}\x{90CA}\x{90CE}\x{90DB}\x{90E1}\x{90E2}\x{90E4}\x{90E8}' + . '\x{90ED}\x{90F5}\x{90F7}\x{90FD}\x{9102}\x{9112}\x{9119}\x{912D}\x{9130}' + . '\x{9132}\x{9149}\x{914A}\x{914B}\x{914C}\x{914D}\x{914E}\x{9152}\x{9154}' + . '\x{9156}\x{9158}\x{9162}\x{9163}\x{9165}\x{9169}\x{916A}\x{916C}\x{9172}' + . '\x{9173}\x{9175}\x{9177}\x{9178}\x{9182}\x{9187}\x{9189}\x{918B}\x{918D}' + . '\x{9190}\x{9192}\x{9197}\x{919C}\x{91A2}\x{91A4}\x{91AA}\x{91AB}\x{91AF}' + . '\x{91B4}\x{91B5}\x{91B8}\x{91BA}\x{91C0}\x{91C1}\x{91C6}\x{91C7}\x{91C8}' + . '\x{91C9}\x{91CB}\x{91CC}\x{91CD}\x{91CE}\x{91CF}\x{91D0}\x{91D1}\x{91D6}' + . '\x{91D8}\x{91DB}\x{91DC}\x{91DD}\x{91DF}\x{91E1}\x{91E3}\x{91E6}\x{91E7}' + . '\x{91F5}\x{91F6}\x{91FC}\x{91FF}\x{920D}\x{920E}\x{9211}\x{9214}\x{9215}' + . '\x{921E}\x{9229}\x{922C}\x{9234}\x{9237}\x{923F}\x{9244}\x{9245}\x{9248}' + . '\x{9249}\x{924B}\x{9250}\x{9257}\x{925A}\x{925B}\x{925E}\x{9262}\x{9264}' + . '\x{9266}\x{9271}\x{927E}\x{9280}\x{9283}\x{9285}\x{9291}\x{9293}\x{9295}' + . '\x{9296}\x{9298}\x{929A}\x{929B}\x{929C}\x{92AD}\x{92B7}\x{92B9}\x{92CF}' + . '\x{92D2}\x{92E4}\x{92E9}\x{92EA}\x{92ED}\x{92F2}\x{92F3}\x{92F8}\x{92FA}' + . '\x{92FC}\x{9306}\x{930F}\x{9310}\x{9318}\x{9319}\x{931A}\x{9320}\x{9322}' + . '\x{9323}\x{9326}\x{9328}\x{932B}\x{932C}\x{932E}\x{932F}\x{9332}\x{9335}' + . '\x{933A}\x{933B}\x{9344}\x{934B}\x{934D}\x{9354}\x{9356}\x{935B}\x{935C}' + . '\x{9360}\x{936C}\x{936E}\x{9375}\x{937C}\x{937E}\x{938C}\x{9394}\x{9396}' + . '\x{9397}\x{939A}\x{93A7}\x{93AC}\x{93AD}\x{93AE}\x{93B0}\x{93B9}\x{93C3}' + . '\x{93C8}\x{93D0}\x{93D1}\x{93D6}\x{93D7}\x{93D8}\x{93DD}\x{93E1}\x{93E4}' + . '\x{93E5}\x{93E8}\x{9403}\x{9407}\x{9410}\x{9413}\x{9414}\x{9418}\x{9419}' + . '\x{941A}\x{9421}\x{942B}\x{9435}\x{9436}\x{9438}\x{943A}\x{9441}\x{9444}' + . '\x{9451}\x{9452}\x{9453}\x{945A}\x{945B}\x{945E}\x{9460}\x{9462}\x{946A}' + . '\x{9470}\x{9475}\x{9477}\x{947C}\x{947D}\x{947E}\x{947F}\x{9481}\x{9577}' + . '\x{9580}\x{9582}\x{9583}\x{9587}\x{9589}\x{958A}\x{958B}\x{958F}\x{9591}' + . '\x{9593}\x{9594}\x{9596}\x{9598}\x{9599}\x{95A0}\x{95A2}\x{95A3}\x{95A4}' + . '\x{95A5}\x{95A7}\x{95A8}\x{95AD}\x{95B2}\x{95B9}\x{95BB}\x{95BC}\x{95BE}' + . '\x{95C3}\x{95C7}\x{95CA}\x{95CC}\x{95CD}\x{95D4}\x{95D5}\x{95D6}\x{95D8}' + . '\x{95DC}\x{95E1}\x{95E2}\x{95E5}\x{961C}\x{9621}\x{9628}\x{962A}\x{962E}' + . '\x{962F}\x{9632}\x{963B}\x{963F}\x{9640}\x{9642}\x{9644}\x{964B}\x{964C}' + . '\x{964D}\x{964F}\x{9650}\x{965B}\x{965C}\x{965D}\x{965E}\x{965F}\x{9662}' + . '\x{9663}\x{9664}\x{9665}\x{9666}\x{966A}\x{966C}\x{9670}\x{9672}\x{9673}' + . '\x{9675}\x{9676}\x{9677}\x{9678}\x{967A}\x{967D}\x{9685}\x{9686}\x{9688}' + . '\x{968A}\x{968B}\x{968D}\x{968E}\x{968F}\x{9694}\x{9695}\x{9697}\x{9698}' + . '\x{9699}\x{969B}\x{969C}\x{96A0}\x{96A3}\x{96A7}\x{96A8}\x{96AA}\x{96B0}' + . '\x{96B1}\x{96B2}\x{96B4}\x{96B6}\x{96B7}\x{96B8}\x{96B9}\x{96BB}\x{96BC}' + . '\x{96C0}\x{96C1}\x{96C4}\x{96C5}\x{96C6}\x{96C7}\x{96C9}\x{96CB}\x{96CC}' + . '\x{96CD}\x{96CE}\x{96D1}\x{96D5}\x{96D6}\x{96D9}\x{96DB}\x{96DC}\x{96E2}' + . '\x{96E3}\x{96E8}\x{96EA}\x{96EB}\x{96F0}\x{96F2}\x{96F6}\x{96F7}\x{96F9}' + . '\x{96FB}\x{9700}\x{9704}\x{9706}\x{9707}\x{9708}\x{970A}\x{970D}\x{970E}' + . '\x{970F}\x{9711}\x{9713}\x{9716}\x{9719}\x{971C}\x{971E}\x{9724}\x{9727}' + . '\x{972A}\x{9730}\x{9732}\x{9738}\x{9739}\x{973D}\x{973E}\x{9742}\x{9744}' + . '\x{9746}\x{9748}\x{9749}\x{9752}\x{9756}\x{9759}\x{975C}\x{975E}\x{9760}' + . '\x{9761}\x{9762}\x{9764}\x{9766}\x{9768}\x{9769}\x{976B}\x{976D}\x{9771}' + . '\x{9774}\x{9779}\x{977A}\x{977C}\x{9781}\x{9784}\x{9785}\x{9786}\x{978B}' + . '\x{978D}\x{978F}\x{9790}\x{9798}\x{979C}\x{97A0}\x{97A3}\x{97A6}\x{97A8}' + . '\x{97AB}\x{97AD}\x{97B3}\x{97B4}\x{97C3}\x{97C6}\x{97C8}\x{97CB}\x{97D3}' + . '\x{97DC}\x{97ED}\x{97EE}\x{97F2}\x{97F3}\x{97F5}\x{97F6}\x{97FB}\x{97FF}' + . '\x{9801}\x{9802}\x{9803}\x{9805}\x{9806}\x{9808}\x{980C}\x{980F}\x{9810}' + . '\x{9811}\x{9812}\x{9813}\x{9817}\x{9818}\x{981A}\x{9821}\x{9824}\x{982C}' + . '\x{982D}\x{9834}\x{9837}\x{9838}\x{983B}\x{983C}\x{983D}\x{9846}\x{984B}' + . '\x{984C}\x{984D}\x{984E}\x{984F}\x{9854}\x{9855}\x{9858}\x{985B}\x{985E}' + . '\x{9867}\x{986B}\x{986F}\x{9870}\x{9871}\x{9873}\x{9874}\x{98A8}\x{98AA}' + . '\x{98AF}\x{98B1}\x{98B6}\x{98C3}\x{98C4}\x{98C6}\x{98DB}\x{98DC}\x{98DF}' + . '\x{98E2}\x{98E9}\x{98EB}\x{98ED}\x{98EE}\x{98EF}\x{98F2}\x{98F4}\x{98FC}' + . '\x{98FD}\x{98FE}\x{9903}\x{9905}\x{9909}\x{990A}\x{990C}\x{9910}\x{9912}' + . '\x{9913}\x{9914}\x{9918}\x{991D}\x{991E}\x{9920}\x{9921}\x{9924}\x{9928}' + . '\x{992C}\x{992E}\x{993D}\x{993E}\x{9942}\x{9945}\x{9949}\x{994B}\x{994C}' + . '\x{9950}\x{9951}\x{9952}\x{9955}\x{9957}\x{9996}\x{9997}\x{9998}\x{9999}' + . '\x{99A5}\x{99A8}\x{99AC}\x{99AD}\x{99AE}\x{99B3}\x{99B4}\x{99BC}\x{99C1}' + . '\x{99C4}\x{99C5}\x{99C6}\x{99C8}\x{99D0}\x{99D1}\x{99D2}\x{99D5}\x{99D8}' + . '\x{99DB}\x{99DD}\x{99DF}\x{99E2}\x{99ED}\x{99EE}\x{99F1}\x{99F2}\x{99F8}' + . '\x{99FB}\x{99FF}\x{9A01}\x{9A05}\x{9A0E}\x{9A0F}\x{9A12}\x{9A13}\x{9A19}' + . '\x{9A28}\x{9A2B}\x{9A30}\x{9A37}\x{9A3E}\x{9A40}\x{9A42}\x{9A43}\x{9A45}' + . '\x{9A4D}\x{9A55}\x{9A57}\x{9A5A}\x{9A5B}\x{9A5F}\x{9A62}\x{9A64}\x{9A65}' + . '\x{9A69}\x{9A6A}\x{9A6B}\x{9AA8}\x{9AAD}\x{9AB0}\x{9AB8}\x{9ABC}\x{9AC0}' + . '\x{9AC4}\x{9ACF}\x{9AD1}\x{9AD3}\x{9AD4}\x{9AD8}\x{9ADE}\x{9ADF}\x{9AE2}' + . '\x{9AE3}\x{9AE6}\x{9AEA}\x{9AEB}\x{9AED}\x{9AEE}\x{9AEF}\x{9AF1}\x{9AF4}' + . '\x{9AF7}\x{9AFB}\x{9B06}\x{9B18}\x{9B1A}\x{9B1F}\x{9B22}\x{9B23}\x{9B25}' + . '\x{9B27}\x{9B28}\x{9B29}\x{9B2A}\x{9B2E}\x{9B2F}\x{9B31}\x{9B32}\x{9B3B}' + . '\x{9B3C}\x{9B41}\x{9B42}\x{9B43}\x{9B44}\x{9B45}\x{9B4D}\x{9B4E}\x{9B4F}' + . '\x{9B51}\x{9B54}\x{9B58}\x{9B5A}\x{9B6F}\x{9B74}\x{9B83}\x{9B8E}\x{9B91}' + . '\x{9B92}\x{9B93}\x{9B96}\x{9B97}\x{9B9F}\x{9BA0}\x{9BA8}\x{9BAA}\x{9BAB}' + . '\x{9BAD}\x{9BAE}\x{9BB4}\x{9BB9}\x{9BC0}\x{9BC6}\x{9BC9}\x{9BCA}\x{9BCF}' + . '\x{9BD1}\x{9BD2}\x{9BD4}\x{9BD6}\x{9BDB}\x{9BE1}\x{9BE2}\x{9BE3}\x{9BE4}' + . '\x{9BE8}\x{9BF0}\x{9BF1}\x{9BF2}\x{9BF5}\x{9C04}\x{9C06}\x{9C08}\x{9C09}' + . '\x{9C0A}\x{9C0C}\x{9C0D}\x{9C10}\x{9C12}\x{9C13}\x{9C14}\x{9C15}\x{9C1B}' + . '\x{9C21}\x{9C24}\x{9C25}\x{9C2D}\x{9C2E}\x{9C2F}\x{9C30}\x{9C32}\x{9C39}' + . '\x{9C3A}\x{9C3B}\x{9C3E}\x{9C46}\x{9C47}\x{9C48}\x{9C52}\x{9C57}\x{9C5A}' + . '\x{9C60}\x{9C67}\x{9C76}\x{9C78}\x{9CE5}\x{9CE7}\x{9CE9}\x{9CEB}\x{9CEC}' + . '\x{9CF0}\x{9CF3}\x{9CF4}\x{9CF6}\x{9D03}\x{9D06}\x{9D07}\x{9D08}\x{9D09}' + . '\x{9D0E}\x{9D12}\x{9D15}\x{9D1B}\x{9D1F}\x{9D23}\x{9D26}\x{9D28}\x{9D2A}' + . '\x{9D2B}\x{9D2C}\x{9D3B}\x{9D3E}\x{9D3F}\x{9D41}\x{9D44}\x{9D46}\x{9D48}' + . '\x{9D50}\x{9D51}\x{9D59}\x{9D5C}\x{9D5D}\x{9D5E}\x{9D60}\x{9D61}\x{9D64}' + . '\x{9D6C}\x{9D6F}\x{9D72}\x{9D7A}\x{9D87}\x{9D89}\x{9D8F}\x{9D9A}\x{9DA4}' + . '\x{9DA9}\x{9DAB}\x{9DAF}\x{9DB2}\x{9DB4}\x{9DB8}\x{9DBA}\x{9DBB}\x{9DC1}' + . '\x{9DC2}\x{9DC4}\x{9DC6}\x{9DCF}\x{9DD3}\x{9DD9}\x{9DE6}\x{9DED}\x{9DEF}' + . '\x{9DF2}\x{9DF8}\x{9DF9}\x{9DFA}\x{9DFD}\x{9E1A}\x{9E1B}\x{9E1E}\x{9E75}' + . '\x{9E78}\x{9E79}\x{9E7D}\x{9E7F}\x{9E81}\x{9E88}\x{9E8B}\x{9E8C}\x{9E91}' + . '\x{9E92}\x{9E93}\x{9E95}\x{9E97}\x{9E9D}\x{9E9F}\x{9EA5}\x{9EA6}\x{9EA9}' + . '\x{9EAA}\x{9EAD}\x{9EB8}\x{9EB9}\x{9EBA}\x{9EBB}\x{9EBC}\x{9EBE}\x{9EBF}' + . '\x{9EC4}\x{9ECC}\x{9ECD}\x{9ECE}\x{9ECF}\x{9ED0}\x{9ED2}\x{9ED4}\x{9ED8}' + . '\x{9ED9}\x{9EDB}\x{9EDC}\x{9EDD}\x{9EDE}\x{9EE0}\x{9EE5}\x{9EE8}\x{9EEF}' + . '\x{9EF4}\x{9EF6}\x{9EF7}\x{9EF9}\x{9EFB}\x{9EFC}\x{9EFD}\x{9F07}\x{9F08}' + . '\x{9F0E}\x{9F13}\x{9F15}\x{9F20}\x{9F21}\x{9F2C}\x{9F3B}\x{9F3E}\x{9F4A}' + . '\x{9F4B}\x{9F4E}\x{9F4F}\x{9F52}\x{9F54}\x{9F5F}\x{9F60}\x{9F61}\x{9F62}' + . '\x{9F63}\x{9F66}\x{9F67}\x{9F6A}\x{9F6C}\x{9F72}\x{9F76}\x{9F77}\x{9F8D}' + . '\x{9F95}\x{9F9C}\x{9F9D}\x{9FA0}]{1,15}$/iu', +]; diff --git a/vendor/laminas/laminas-validator/src/Iban.php b/vendor/laminas/laminas-validator/src/Iban.php new file mode 100644 index 00000000..dfe869a4 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Iban.php @@ -0,0 +1,374 @@ + + */ + protected $messageTemplates = [ + self::NOTSUPPORTED => 'Unknown country within the IBAN', + self::SEPANOTSUPPORTED => 'Countries outside the Single Euro Payments Area (SEPA) are not supported', + self::FALSEFORMAT => 'The input has a false IBAN format', + self::CHECKFAILED => 'The input has failed the IBAN check', + ]; + + /** + * Optional country code by ISO 3166-1 + * + * @var string|null + */ + protected $countryCode; + + /** + * Optionally allow IBAN codes from non-SEPA countries. Defaults to true + * + * @var bool + */ + protected $allowNonSepa = true; + + /** + * The SEPA country codes + * + * @var string[] ISO 3166-1 codes + */ + protected static $sepaCountries = [ + 'AT', + 'BE', + 'BG', + 'CY', + 'CZ', + 'DK', + 'FO', + 'GL', + 'EE', + 'FI', + 'FR', + 'DE', + 'GI', + 'GR', + 'HU', + 'IS', + 'IE', + 'IT', + 'LV', + 'LI', + 'LT', + 'LU', + 'MT', + 'MC', + 'NL', + 'NO', + 'PL', + 'PT', + 'RO', + 'SK', + 'SI', + 'ES', + 'SE', + 'CH', + 'GB', + 'SM', + 'HR', + ]; + + /** + * IBAN regexes by country code + * + * @var array + */ + protected static $ibanRegex = [ + 'AD' => 'AD[0-9]{2}[0-9]{4}[0-9]{4}[A-Z0-9]{12}', + 'AE' => 'AE[0-9]{2}[0-9]{3}[0-9]{16}', + 'AL' => 'AL[0-9]{2}[0-9]{8}[A-Z0-9]{16}', + 'AT' => 'AT[0-9]{2}[0-9]{5}[0-9]{11}', + 'AZ' => 'AZ[0-9]{2}[A-Z]{4}[A-Z0-9]{20}', + 'BA' => 'BA[0-9]{2}[0-9]{3}[0-9]{3}[0-9]{8}[0-9]{2}', + 'BE' => 'BE[0-9]{2}[0-9]{3}[0-9]{7}[0-9]{2}', + 'BG' => 'BG[0-9]{2}[A-Z]{4}[0-9]{4}[0-9]{2}[A-Z0-9]{8}', + 'BH' => 'BH[0-9]{2}[A-Z]{4}[A-Z0-9]{14}', + 'BR' => 'BR[0-9]{2}[0-9]{8}[0-9]{5}[0-9]{10}[A-Z][A-Z0-9]', + 'BY' => 'BY[0-9]{2}[A-Z0-9]{4}[0-9]{4}[A-Z0-9]{16}', + 'CH' => 'CH[0-9]{2}[0-9]{5}[A-Z0-9]{12}', + 'CR' => 'CR[0-9]{2}[0-9]{3}[0-9]{14}', + 'CY' => 'CY[0-9]{2}[0-9]{3}[0-9]{5}[A-Z0-9]{16}', + 'CZ' => 'CZ[0-9]{2}[0-9]{20}', + 'DE' => 'DE[0-9]{2}[0-9]{8}[0-9]{10}', + 'DO' => 'DO[0-9]{2}[A-Z0-9]{4}[0-9]{20}', + 'DK' => 'DK[0-9]{2}[0-9]{14}', + 'EE' => 'EE[0-9]{2}[0-9]{2}[0-9]{2}[0-9]{11}[0-9]{1}', + 'ES' => 'ES[0-9]{2}[0-9]{4}[0-9]{4}[0-9]{1}[0-9]{1}[0-9]{10}', + 'FI' => 'FI[0-9]{2}[0-9]{6}[0-9]{7}[0-9]{1}', + 'FO' => 'FO[0-9]{2}[0-9]{4}[0-9]{9}[0-9]{1}', + 'FR' => 'FR[0-9]{2}[0-9]{5}[0-9]{5}[A-Z0-9]{11}[0-9]{2}', + 'GB' => 'GB[0-9]{2}[A-Z]{4}[0-9]{6}[0-9]{8}', + 'GE' => 'GE[0-9]{2}[A-Z]{2}[0-9]{16}', + 'GI' => 'GI[0-9]{2}[A-Z]{4}[A-Z0-9]{15}', + 'GL' => 'GL[0-9]{2}[0-9]{4}[0-9]{9}[0-9]{1}', + 'GR' => 'GR[0-9]{2}[0-9]{3}[0-9]{4}[A-Z0-9]{16}', + 'GT' => 'GT[0-9]{2}[A-Z0-9]{4}[A-Z0-9]{20}', + 'HR' => 'HR[0-9]{2}[0-9]{7}[0-9]{10}', + 'HU' => 'HU[0-9]{2}[0-9]{3}[0-9]{4}[0-9]{1}[0-9]{15}[0-9]{1}', + 'IE' => 'IE[0-9]{2}[A-Z]{4}[0-9]{6}[0-9]{8}', + 'IL' => 'IL[0-9]{2}[0-9]{3}[0-9]{3}[0-9]{13}', + 'IS' => 'IS[0-9]{2}[0-9]{4}[0-9]{2}[0-9]{6}[0-9]{10}', + 'IT' => 'IT[0-9]{2}[A-Z]{1}[0-9]{5}[0-9]{5}[A-Z0-9]{12}', + 'KW' => 'KW[0-9]{2}[A-Z]{4}[0-9]{22}', + 'KZ' => 'KZ[0-9]{2}[0-9]{3}[A-Z0-9]{13}', + 'LB' => 'LB[0-9]{2}[0-9]{4}[A-Z0-9]{20}', + 'LI' => 'LI[0-9]{2}[0-9]{5}[A-Z0-9]{12}', + 'LT' => 'LT[0-9]{2}[0-9]{5}[0-9]{11}', + 'LU' => 'LU[0-9]{2}[0-9]{3}[A-Z0-9]{13}', + 'LV' => 'LV[0-9]{2}[A-Z]{4}[A-Z0-9]{13}', + 'MC' => 'MC[0-9]{2}[0-9]{5}[0-9]{5}[A-Z0-9]{11}[0-9]{2}', + 'MD' => 'MD[0-9]{2}[A-Z0-9]{20}', + 'ME' => 'ME[0-9]{2}[0-9]{3}[0-9]{13}[0-9]{2}', + 'MK' => 'MK[0-9]{2}[0-9]{3}[A-Z0-9]{10}[0-9]{2}', + 'MR' => 'MR13[0-9]{5}[0-9]{5}[0-9]{11}[0-9]{2}', + 'MT' => 'MT[0-9]{2}[A-Z]{4}[0-9]{5}[A-Z0-9]{18}', + 'MU' => 'MU[0-9]{2}[A-Z]{4}[0-9]{2}[0-9]{2}[0-9]{12}[0-9]{3}[A-Z]{3}', + 'NL' => 'NL[0-9]{2}[A-Z]{4}[0-9]{10}', + 'NO' => 'NO[0-9]{2}[0-9]{4}[0-9]{6}[0-9]{1}', + 'UA' => 'UA[0-9]{2}[0-9]{6}[0-9]{19}', + 'PK' => 'PK[0-9]{2}[A-Z]{4}[A-Z0-9]{16}', + 'PL' => 'PL[0-9]{2}[0-9]{8}[0-9]{16}', + 'PS' => 'PS[0-9]{2}[A-Z]{4}[A-Z0-9]{21}', + 'PT' => 'PT[0-9]{2}[0-9]{4}[0-9]{4}[0-9]{11}[0-9]{2}', + 'RO' => 'RO[0-9]{2}[A-Z]{4}[A-Z0-9]{16}', + 'RS' => 'RS[0-9]{2}[0-9]{3}[0-9]{13}[0-9]{2}', + 'SA' => 'SA[0-9]{2}[0-9]{2}[A-Z0-9]{18}', + 'SE' => 'SE[0-9]{2}[0-9]{3}[0-9]{16}[0-9]{1}', + 'SI' => 'SI[0-9]{2}[0-9]{5}[0-9]{8}[0-9]{2}', + 'SK' => 'SK[0-9]{2}[0-9]{4}[0-9]{6}[0-9]{10}', + 'SM' => 'SM[0-9]{2}[A-Z]{1}[0-9]{5}[0-9]{5}[A-Z0-9]{12}', + 'TN' => 'TN59[0-9]{2}[0-9]{3}[0-9]{13}[0-9]{2}', + 'TR' => 'TR[0-9]{2}[0-9]{5}[A-Z0-9]{1}[A-Z0-9]{16}', + 'VG' => 'VG[0-9]{2}[A-Z]{4}[0-9]{16}', + ]; + + /** + * Sets validator options + * + * @param array|Traversable $options OPTIONAL + */ + public function __construct($options = []) + { + if ($options instanceof Traversable) { + $options = ArrayUtils::iteratorToArray($options); + } + + if (array_key_exists('country_code', $options)) { + $this->setCountryCode($options['country_code']); + } + + if (array_key_exists('allow_non_sepa', $options)) { + $this->setAllowNonSepa($options['allow_non_sepa']); + } + + parent::__construct($options); + } + + /** + * Returns the optional country code by ISO 3166-1 + * + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @return string|null + */ + public function getCountryCode() + { + return $this->countryCode; + } + + /** + * Sets an optional country code by ISO 3166-1 + * + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @param string|null $countryCode + * @return $this provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function setCountryCode($countryCode = null) + { + if ($countryCode !== null) { + $countryCode = (string) $countryCode; + + if (! isset(static::$ibanRegex[$countryCode])) { + throw new Exception\InvalidArgumentException( + "Country code '{$countryCode}' invalid by ISO 3166-1 or not supported" + ); + } + } + + $this->countryCode = $countryCode; + return $this; + } + + /** + * Returns the optional allow non-sepa countries setting + * + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @return bool + */ + public function allowNonSepa() + { + return $this->allowNonSepa; + } + + /** + * Sets the optional allow non-sepa countries setting + * + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @param bool $allowNonSepa + * @return $this provides a fluent interface + */ + public function setAllowNonSepa($allowNonSepa) + { + $this->allowNonSepa = (bool) $allowNonSepa; + return $this; + } + + /** + * Returns true if $value is a valid IBAN + * + * @param string $value + * @return bool + */ + public function isValid($value) + { + if (! is_string($value)) { + $this->error(self::FALSEFORMAT); + return false; + } + + $value = str_replace(' ', '', strtoupper($value)); + $this->setValue($value); + + $countryCode = $this->getCountryCode(); + if ($countryCode === null) { + $countryCode = substr($value, 0, 2); + } + + if (! array_key_exists($countryCode, static::$ibanRegex)) { + $this->setValue($countryCode); + $this->error(self::NOTSUPPORTED); + return false; + } + + if (! $this->allowNonSepa && ! in_array($countryCode, static::$sepaCountries)) { + $this->setValue($countryCode); + $this->error(self::SEPANOTSUPPORTED); + return false; + } + + if (! preg_match('/^' . static::$ibanRegex[$countryCode] . '$/', $value)) { + $this->error(self::FALSEFORMAT); + return false; + } + + $format = substr($value, 4) . substr($value, 0, 4); + $format = str_replace( + [ + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + ], + [ + '10', + '11', + '12', + '13', + '14', + '15', + '16', + '17', + '18', + '19', + '20', + '21', + '22', + '23', + '24', + '25', + '26', + '27', + '28', + '29', + '30', + '31', + '32', + '33', + '34', + '35', + ], + $format + ); + + $temp = intval(substr($format, 0, 1)); + $len = strlen($format); + for ($x = 1; $x < $len; ++$x) { + $temp *= 10; + $temp += intval(substr($format, $x, 1)); + $temp %= 97; + } + + if ($temp !== 1) { + $this->error(self::CHECKFAILED); + return false; + } + + return true; + } +} diff --git a/vendor/laminas/laminas-validator/src/Identical.php b/vendor/laminas/laminas-validator/src/Identical.php new file mode 100644 index 00000000..62733f13 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Identical.php @@ -0,0 +1,231 @@ + 'The two given tokens do not match', + self::MISSING_TOKEN => 'No token was provided to match against', + ]; + + /** @var array */ + protected $messageVariables = [ + 'token' => 'tokenString', + ]; + + /** + * Original token against which to validate + * + * @var null|string + */ + protected $tokenString; + + /** @var null|string */ + protected $token; + + /** @var bool */ + protected $strict = true; + + /** @var bool */ + protected $literal = false; + + /** + * Sets validator options + * + * @param mixed $token + */ + public function __construct($token = null) + { + if ($token instanceof Traversable) { + $token = ArrayUtils::iteratorToArray($token); + } + + if (is_array($token) && array_key_exists('token', $token)) { + if (array_key_exists('strict', $token)) { + $this->setStrict($token['strict']); + } + + if (array_key_exists('literal', $token)) { + $this->setLiteral($token['literal']); + } + + $this->setToken($token['token']); + } elseif (null !== $token) { + $this->setToken($token); + } + + parent::__construct(is_array($token) ? $token : null); + } + + /** + * Retrieve token + * + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @return mixed + */ + public function getToken() + { + return $this->token; + } + + /** + * Set token against which to compare + * + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @return $this + */ + public function setToken(mixed $token) + { + $this->tokenString = is_array($token) ? var_export($token, true) : (string) $token; + $this->token = $token; + return $this; + } + + /** + * Returns the strict parameter + * + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @return bool + */ + public function getStrict() + { + return $this->strict; + } + + /** + * Sets the strict parameter + * + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @param bool $strict + * @return $this + */ + public function setStrict($strict) + { + $this->strict = (bool) $strict; + return $this; + } + + /** + * Returns the literal parameter + * + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @return bool + */ + public function getLiteral() + { + return $this->literal; + } + + /** + * Sets the literal parameter + * + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @param bool $literal + * @return $this + */ + public function setLiteral($literal) + { + $this->literal = (bool) $literal; + return $this; + } + + /** + * Returns true if and only if a token has been set and the provided value + * matches that token. + * + * @param mixed $value + * @param null|array|ArrayAccess $context + * @throws Exception\InvalidArgumentException If context is not array or ArrayObject. + * @return bool + */ + public function isValid($value, $context = null) + { + $this->setValue($value); + + $token = $this->getToken(); + + if (! $this->getLiteral() && $context !== null) { + if (! is_array($context) && ! $context instanceof ArrayAccess) { + throw new Exception\InvalidArgumentException(sprintf( + 'Context passed to %s must be array, ArrayObject or null; received "%s"', + __METHOD__, + get_debug_type($context) + )); + } + + if (is_array($token)) { + while (is_array($token)) { + $key = key($token); + if (! isset($context[$key])) { + break; + } + $context = $context[$key]; + $token = $token[$key]; + } + } + + // if $token is an array it means the above loop didn't went all the way down to the leaf, + // so the $token structure doesn't match the $context structure + if ( + is_array($token) + || (! is_int($token) && ! is_string($token)) + || ! isset($context[$token]) + ) { + $token = $this->getToken(); + } else { + $token = $context[$token]; + } + } + + if ($token === null) { + $this->error(self::MISSING_TOKEN); + return false; + } + + $strict = $this->getStrict(); + if ( + ($strict && ($value !== $token)) + // phpcs:ignore SlevomatCodingStandard.Operators.DisallowEqualOperators.DisallowedNotEqualOperator + || (! $strict && ($value != $token)) + ) { + $this->error(self::NOT_SAME); + return false; + } + + return true; + } +} diff --git a/vendor/laminas/laminas-validator/src/InArray.php b/vendor/laminas/laminas-validator/src/InArray.php new file mode 100644 index 00000000..fd4a4925 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/InArray.php @@ -0,0 +1,266 @@ + */ + protected $messageTemplates = [ + self::NOT_IN_ARRAY => 'The input was not found in the haystack', + ]; + + /** + * Haystack of possible values + * + * @var array + */ + protected $haystack; + + /** + * Type of strict check to be used. Due to "foo" == 0 === TRUE with in_array when strict = false, + * an option has been added to prevent this. When $strict = 0/false, the most + * secure non-strict check is implemented. if $strict = -1, the default in_array non-strict + * behaviour is used + * + * @var int + */ + protected $strict = self::COMPARE_NOT_STRICT_AND_PREVENT_STR_TO_INT_VULNERABILITY; + + /** + * Whether a recursive search should be done + * + * @var bool + */ + protected $recursive = false; + + /** + * Returns the haystack option + * + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @return mixed + * @throws Exception\RuntimeException If haystack option is not set. + */ + public function getHaystack() + { + if ($this->haystack === null) { + throw new Exception\RuntimeException('haystack option is mandatory'); + } + return $this->haystack; + } + + /** + * Sets the haystack option + * + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @param mixed $haystack + * @return $this Provides a fluent interface + */ + public function setHaystack(array $haystack) + { + $this->haystack = $haystack; + return $this; + } + + /** + * Returns the strict option + * + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @return bool|int + */ + public function getStrict() + { + // To keep BC with new strict modes + if ( + $this->strict === self::COMPARE_NOT_STRICT_AND_PREVENT_STR_TO_INT_VULNERABILITY + || $this->strict === self::COMPARE_STRICT + ) { + return (bool) $this->strict; + } + return $this->strict; + } + + /** + * Sets the strict option mode + * InArray::COMPARE_STRICT + * InArray::COMPARE_NOT_STRICT_AND_PREVENT_STR_TO_INT_VULNERABILITY + * InArray::COMPARE_NOT_STRICT + * + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @param int|bool $strict + * @return $this Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function setStrict($strict) + { + if (is_bool($strict)) { + $strict = $strict ? self::COMPARE_STRICT : self::COMPARE_NOT_STRICT_AND_PREVENT_STR_TO_INT_VULNERABILITY; + } + + $checkTypes = [ + self::COMPARE_NOT_STRICT_AND_PREVENT_STR_TO_INT_VULNERABILITY, // 0 + self::COMPARE_STRICT, // 1 + self::COMPARE_NOT_STRICT, // -1 + ]; + + // validate strict value + if (! in_array($strict, $checkTypes)) { + throw new Exception\InvalidArgumentException('Strict option must be one of the COMPARE_ constants'); + } + + $this->strict = $strict; + return $this; + } + + /** + * Returns the recursive option + * + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @return bool + */ + public function getRecursive() + { + return $this->recursive; + } + + /** + * Sets the recursive option + * + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @param bool $recursive + * @return $this Provides a fluent interface + */ + public function setRecursive($recursive) + { + $this->recursive = (bool) $recursive; + return $this; + } + + /** + * Returns true if and only if $value is contained in the haystack option. If the strict + * option is true, then the type of $value is also checked. + * + * @param mixed $value + * See {@link http://php.net/manual/function.in-array.php#104501} + * @return bool + */ + public function isValid($value) + { + // we create a copy of the haystack in case we need to modify it + $haystack = $this->getHaystack(); + + // if the input is a string or float, and vulnerability protection is on + // we type cast the input to a string + if ( + self::COMPARE_NOT_STRICT_AND_PREVENT_STR_TO_INT_VULNERABILITY === $this->strict + && (is_int($value) || is_float($value)) + ) { + $value = (string) $value; + } + + $this->setValue($value); + + if ($this->getRecursive()) { + $iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($haystack)); + foreach ($iterator as $element) { + if (self::COMPARE_STRICT === $this->strict) { + if ($element === $value) { + return true; + } + + continue; + } + + // add protection to prevent string to int vuln's + $el = $element; + if ( + self::COMPARE_NOT_STRICT_AND_PREVENT_STR_TO_INT_VULNERABILITY === $this->strict + && is_string($value) && (is_int($el) || is_float($el)) + ) { + $el = (string) $el; + } + + // phpcs:ignore SlevomatCodingStandard.Operators.DisallowEqualOperators.DisallowedEqualOperator + if ($el == $value) { + return true; + } + } + + $this->error(self::NOT_IN_ARRAY); + return false; + } + + /** + * If the check is not strict, then, to prevent "asdf" being converted to 0 + * and returning a false positive if 0 is in haystack, we type cast + * the haystack to strings. To prevent "56asdf" == 56 === TRUE we also + * type cast values like 56 to strings as well. + * + * This occurs only if the input is a string and a haystack member is an int + */ + if ( + self::COMPARE_NOT_STRICT_AND_PREVENT_STR_TO_INT_VULNERABILITY === $this->strict + && is_string($value) + ) { + foreach ($haystack as &$h) { + if (is_int($h) || is_float($h)) { + $h = (string) $h; + } + } + + if (in_array($value, $haystack, (bool) $this->strict)) { + return true; + } + + $this->error(self::NOT_IN_ARRAY); + return false; + } + + if (in_array($value, $haystack, self::COMPARE_STRICT === $this->strict)) { + return true; + } + + if (self::COMPARE_NOT_STRICT === $this->strict) { + return true; + } + + $this->error(self::NOT_IN_ARRAY); + return false; + } +} diff --git a/vendor/laminas/laminas-validator/src/Ip.php b/vendor/laminas/laminas-validator/src/Ip.php new file mode 100644 index 00000000..d1d1b696 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Ip.php @@ -0,0 +1,198 @@ + 'Invalid type given. String expected', + self::NOT_IP_ADDRESS => 'The input does not appear to be a valid IP address', + ]; + + /** + * Internal options + * + * @var array + */ + protected $options = [ + 'allowipv4' => true, // Enable IPv4 Validation + 'allowipv6' => true, // Enable IPv6 Validation + 'allowipvfuture' => false, // Enable IPvFuture Validation + 'allowliteral' => true, // Enable IPs in literal format (only IPv6 and IPvFuture) + ]; + + /** + * Sets the options for this validator + * + * @param array|Traversable $options + * @throws Exception\InvalidArgumentException If there is any kind of IP allowed or $options is not an array + * or Traversable. + * @return AbstractValidator + */ + public function setOptions($options = []) + { + parent::setOptions($options); + + if (! $this->options['allowipv4'] && ! $this->options['allowipv6'] && ! $this->options['allowipvfuture']) { + throw new Exception\InvalidArgumentException('Nothing to validate. Check your options'); + } + + return $this; + } + + /** + * Returns true if and only if $value is a valid IP address + * + * @param mixed $value + * @return bool + */ + public function isValid($value) + { + if (! is_string($value)) { + $this->error(self::INVALID); + return false; + } + + $this->setValue($value); + + if ($this->options['allowipv4'] && $this->validateIPv4($value)) { + return true; + } else { + if ((bool) $this->options['allowliteral']) { + static $regex = '/^\[(.*)\]$/'; + if ((bool) preg_match($regex, $value, $matches)) { + $value = $matches[1]; + } + } + + $isValidV6Address = $this->validateIPv6($value); + $isValidV6Address = $isValidV6Address !== false && $isValidV6Address !== 0; + + if ( + ($this->options['allowipv6'] && $isValidV6Address) || + ($this->options['allowipvfuture'] && $this->validateIPvFuture($value)) + ) { + return true; + } + } + $this->error(self::NOT_IP_ADDRESS); + return false; + } + + /** + * Validates an IPv4 address + * + * @param string $value + * @return bool + */ + protected function validateIPv4($value) + { + if (preg_match('/^([01]{8}\.){3}[01]{8}\z/i', $value)) { + // binary format 00000000.00000000.00000000.00000000 + $value = bindec(substr($value, 0, 8)) . '.' . bindec(substr($value, 9, 8)) . '.' + . bindec(substr($value, 18, 8)) . '.' . bindec(substr($value, 27, 8)); + } elseif (preg_match('/^([0-9]{3}\.){3}[0-9]{3}\z/i', $value)) { + // octet format 777.777.777.777 + $value = (int) substr($value, 0, 3) . '.' . (int) substr($value, 4, 3) . '.' + . (int) substr($value, 8, 3) . '.' . (int) substr($value, 12, 3); + } elseif (preg_match('/^([0-9a-f]{2}\.){3}[0-9a-f]{2}\z/i', $value)) { + // hex format ff.ff.ff.ff + $value = hexdec(substr($value, 0, 2)) . '.' . hexdec(substr($value, 3, 2)) . '.' + . hexdec(substr($value, 6, 2)) . '.' . hexdec(substr($value, 9, 2)); + } + + $ip2long = ip2long($value); + if ($ip2long === false) { + return false; + } + + return $value === long2ip($ip2long); + } + + /** + * Validates an IPv6 address + * + * @param string $value Value to check against + * @return bool|int True when $value is a valid ipv6 address False otherwise + */ + protected function validateIPv6($value) + { + if (strlen($value) < 3) { + return $value === '::'; + } + + if (strpos($value, '.') !== false) { + $lastcolon = strrpos($value, ':'); + if (! ($lastcolon !== false && $this->validateIPv4(substr($value, $lastcolon + 1)))) { + return false; + } + + $value = substr($value, 0, $lastcolon) . ':0:0'; + } + + if (! str_contains($value, '::')) { + return preg_match('/\A(?:[a-f0-9]{1,4}:){7}[a-f0-9]{1,4}\z/i', $value); + } + + $colonCount = substr_count($value, ':'); + if ($colonCount < 8) { + return preg_match('/\A(?::|(?:[a-f0-9]{1,4}:)+):(?:(?:[a-f0-9]{1,4}:)*[a-f0-9]{1,4})?\z/i', $value); + } + + // special case with ending or starting double colon + if ($colonCount === 8) { + return preg_match('/\A(?:::)?(?:[a-f0-9]{1,4}:){6}[a-f0-9]{1,4}(?:::)?\z/i', $value); + } + + return false; + } + + /** + * Validates an IPvFuture address. + * + * IPvFuture is loosely defined in the Section 3.2.2 of RFC 3986 + * + * @param string $value Value to check against + * @return bool True when $value is a valid IPvFuture address + * False otherwise + */ + protected function validateIPvFuture($value) + { + /* + * ABNF: + * IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) + * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" + * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," + * / ";" / "=" + */ + static $regex = '/^v([[:xdigit:]]+)\.[[:alnum:]\-\._~!\$&\'\(\)\*\+,;=:]+$/'; + + $result = (bool) preg_match($regex, $value, $matches); + + /* + * "As such, implementations must not provide the version flag for the + * existing IPv4 and IPv6 literal address forms described below." + */ + return $result && $matches[1] !== '4' && $matches[1] !== '6'; + } +} diff --git a/vendor/laminas/laminas-validator/src/IsArray.php b/vendor/laminas/laminas-validator/src/IsArray.php new file mode 100644 index 00000000..cba75f2f --- /dev/null +++ b/vendor/laminas/laminas-validator/src/IsArray.php @@ -0,0 +1,40 @@ + */ + protected $messageTemplates = [ + self::NOT_ARRAY => 'Expected an array value but %type% provided', + ]; + + /** @var array */ + protected $messageVariables = [ + 'type' => 'type', + ]; + + protected ?string $type = null; + + /** @var array */ + protected $options = []; + + public function isValid(mixed $value): bool + { + if (is_array($value)) { + return true; + } + + $this->type = get_debug_type($value); + $this->error(self::NOT_ARRAY); + + return false; + } +} diff --git a/vendor/laminas/laminas-validator/src/IsCountable.php b/vendor/laminas/laminas-validator/src/IsCountable.php new file mode 100644 index 00000000..72dac0b9 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/IsCountable.php @@ -0,0 +1,223 @@ + + * @property Options&array $options Required to stop Psalm getting confused about the declaration + * on AbstractValidator + * @final + */ +class IsCountable extends AbstractValidator +{ + public const NOT_COUNTABLE = 'notCountable'; + public const NOT_EQUALS = 'notEquals'; + public const GREATER_THAN = 'greaterThan'; + public const LESS_THAN = 'lessThan'; + + /** + * Validation failure message template definitions + * + * @var array + */ + protected $messageTemplates = [ + self::NOT_COUNTABLE => 'The input must be an array or an instance of \\Countable', + self::NOT_EQUALS => "The input count must equal '%count%'", + self::GREATER_THAN => "The input count must be less than '%max%', inclusively", + self::LESS_THAN => "The input count must be greater than '%min%', inclusively", + ]; + + /** + * Additional variables available for validation failure messages + * + * @var array + */ + protected $messageVariables = [ + 'count' => ['options' => 'count'], + 'min' => ['options' => 'min'], + 'max' => ['options' => 'max'], + ]; + + /** @psalm-var Options */ + protected $options = [ + 'count' => null, + 'min' => null, + 'max' => null, + ]; + + /** + * @param OptionsArgument|iterable $options + * @return $this Provides fluid interface + */ + public function setOptions($options = []) + { + if ($options instanceof Traversable) { + $options = ArrayUtils::iteratorToArray($options); + } + + /** @psalm-var Options $options */ + + if (isset($options['count'])) { + $this->setCount($options['count']); + } + + if (isset($options['min'])) { + $this->setMin($options['min']); + } + + if (isset($options['max'])) { + $this->setMax($options['max']); + } + + unset($options['count'], $options['min'], $options['max']); + + parent::setOptions($options); + + return $this; + } + + /** + * Returns true if and only if $value is countable (and the count validates against optional values). + * + * @param mixed $value + * @return bool + */ + public function isValid($value) + { + if (! is_countable($value)) { + $this->error(self::NOT_COUNTABLE); + return false; + } + + $count = count($value); + + if (is_numeric($this->getCount())) { + if ($count !== $this->getCount()) { + $this->error(self::NOT_EQUALS); + return false; + } + + return true; + } + + if (is_numeric($this->getMax()) && $count > $this->getMax()) { + $this->error(self::GREATER_THAN); + return false; + } + + if (is_numeric($this->getMin()) && $count < $this->getMin()) { + $this->error(self::LESS_THAN); + return false; + } + + return true; + } + + /** + * Returns the count option + * + * @deprecated Since 2.61.0 All option getters and setters will be removed in 3.0 + * + * @return int|null + */ + public function getCount() + { + return $this->options['count']; + } + + /** + * Returns the min option + * + * @deprecated Since 2.61.0 All option getters and setters will be removed in 3.0 + * + * @return int|null + */ + public function getMin() + { + return $this->options['min']; + } + + /** + * Returns the max option + * + * @deprecated Since 2.61.0 All option getters and setters will be removed in 3.0 + * + * @return int|null + */ + public function getMax() + { + return $this->options['max']; + } + + /** + * @throws Exception\InvalidArgumentException If either a min or max option + * was previously set. + */ + private function setCount(int $value): void + { + if (isset($this->options['min']) || isset($this->options['max'])) { + throw new Exception\InvalidArgumentException( + 'Cannot set count; conflicts with either a min or max option previously set' + ); + } + $this->options['count'] = $value; + } + + /** + * @throws Exception\InvalidArgumentException If either a count or max option + * was previously set. + */ + private function setMin(int $value): void + { + if (isset($this->options['count'])) { + throw new Exception\InvalidArgumentException( + 'Cannot set count; conflicts with either a count option previously set' + ); + } + $this->options['min'] = $value; + } + + /** + * @throws Exception\InvalidArgumentException If either a count or min option + * was previously set. + */ + private function setMax(int $value): void + { + if (isset($this->options['count'])) { + throw new Exception\InvalidArgumentException( + 'Cannot set count; conflicts with either a count option previously set' + ); + } + $this->options['max'] = $value; + } +} diff --git a/vendor/laminas/laminas-validator/src/IsInstanceOf.php b/vendor/laminas/laminas-validator/src/IsInstanceOf.php new file mode 100644 index 00000000..9fe273d0 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/IsInstanceOf.php @@ -0,0 +1,108 @@ + "The input is not an instance of '%className%'", + ]; + + /** + * Additional variables available for validation failure messages + * + * @var array + */ + protected $messageVariables = [ + 'className' => 'className', + ]; + + /** @var string */ + protected $className; + + /** + * Sets validator options + * + * @param array|Traversable $options + * @throws Exception\InvalidArgumentException + */ + public function __construct($options = null) + { + if ($options instanceof Traversable) { + $options = iterator_to_array($options); + } + + // If argument is not an array, consider first argument as class name + if (! is_array($options)) { + $options = func_get_args(); + + $tmpOptions = []; + $tmpOptions['className'] = array_shift($options); + + $options = $tmpOptions; + } + + if (! array_key_exists('className', $options)) { + throw new Exception\InvalidArgumentException('Missing option "className"'); + } + + parent::__construct($options); + } + + /** + * Get class name + * + * @deprecated Since 2.61.0 All option setters and getters will be removed in v3.0 + * + * @return string + */ + public function getClassName() + { + return $this->className; + } + + /** + * Set class name + * + * @deprecated Since 2.61.0 All option setters and getters will be removed in v3.0 + * + * @param string $className + * @return $this + */ + public function setClassName($className) + { + $this->className = $className; + return $this; + } + + /** + * Returns true if $value is instance of $this->className + * + * @param mixed $value + * @return bool + */ + public function isValid($value) + { + if ($value instanceof $this->className) { + return true; + } + $this->error(self::NOT_INSTANCE_OF); + return false; + } +} diff --git a/vendor/laminas/laminas-validator/src/IsJsonString.php b/vendor/laminas/laminas-validator/src/IsJsonString.php new file mode 100644 index 00000000..f415ca99 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/IsJsonString.php @@ -0,0 +1,160 @@ +, + * maxDepth: positive-int, + * } + * @psalm-import-type AbstractOptions from AbstractValidator + * @psalm-type Options = AbstractOptions|CustomOptions + */ +final class IsJsonString extends AbstractValidator +{ + public const ERROR_NOT_STRING = 'errorNotString'; + public const ERROR_TYPE_NOT_ALLOWED = 'errorTypeNotAllowed'; + public const ERROR_MAX_DEPTH_EXCEEDED = 'errorMaxDepthExceeded'; + public const ERROR_INVALID_JSON = 'errorInvalidJson'; + + public const ALLOW_INT = 0b0000001; + public const ALLOW_FLOAT = 0b0000010; + public const ALLOW_BOOL = 0b0000100; + public const ALLOW_ARRAY = 0b0001000; + public const ALLOW_OBJECT = 0b0010000; + public const ALLOW_ALL = 0b0011111; + + /** @var array */ + protected $messageTemplates = [ + self::ERROR_NOT_STRING => 'Expected a string but %type% was received', + self::ERROR_TYPE_NOT_ALLOWED => 'Received a JSON %type% but this type is not acceptable', + self::ERROR_MAX_DEPTH_EXCEEDED => 'The decoded JSON payload exceeds the allowed depth of %maxDepth%', + self::ERROR_INVALID_JSON => 'An invalid JSON payload was received', + ]; + + /** @var array */ + protected $messageVariables = [ + 'type' => 'type', + 'maxDepth' => 'maxDepth', + ]; + + protected ?string $type = null; + /** @var int-mask-of */ + protected int $allow = self::ALLOW_ALL; + /** @var positive-int */ + protected int $maxDepth = 512; + + /** + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @param int-mask-of $type + */ + public function setAllow(int $type): void + { + $this->allow = $type; + } + + /** + * @deprecated Since 2.61.0 - All option setters and getters will be removed in 3.0 + * + * @param positive-int $maxDepth + */ + public function setMaxDepth(int $maxDepth): void + { + $this->maxDepth = $maxDepth; + } + + public function isValid(mixed $value): bool + { + if (! is_string($value)) { + $this->error(self::ERROR_NOT_STRING); + $this->type = gettype($value); + + return false; + } + + if (is_numeric($value)) { + /** @psalm-var mixed $value */ + $value = json_decode($value); + + if (is_int($value) && ! $this->isAllowed(self::ALLOW_INT)) { + $this->error(self::ERROR_TYPE_NOT_ALLOWED); + $this->type = 'int'; + + return false; + } + + if (is_float($value) && ! $this->isAllowed(self::ALLOW_FLOAT)) { + $this->error(self::ERROR_TYPE_NOT_ALLOWED); + $this->type = 'float'; + + return false; + } + + return true; + } + + if ($value === 'true' || $value === 'false') { + if (! $this->isAllowed(self::ALLOW_BOOL)) { + $this->error(self::ERROR_TYPE_NOT_ALLOWED); + $this->type = 'boolean'; + + return false; + } + + return true; + } + + if (str_starts_with($value, '[') && ! $this->isAllowed(self::ALLOW_ARRAY)) { + $this->error(self::ERROR_TYPE_NOT_ALLOWED); + $this->type = 'array'; + + return false; + } + + if (str_starts_with($value, '{') && ! $this->isAllowed(self::ALLOW_OBJECT)) { + $this->error(self::ERROR_TYPE_NOT_ALLOWED); + $this->type = 'object'; + + return false; + } + + try { + /** @psalm-suppress UnusedFunctionCall */ + json_decode($value, true, $this->maxDepth, JSON_THROW_ON_ERROR); + + return true; + } catch (JsonException $e) { + if ($e->getCode() === JSON_ERROR_DEPTH) { + $this->error(self::ERROR_MAX_DEPTH_EXCEEDED); + + return false; + } + + $this->error(self::ERROR_INVALID_JSON); + + return false; + } + } + + /** @param self::ALLOW_* $flag */ + private function isAllowed(int $flag): bool + { + return ($this->allow & $flag) === $flag; + } +} diff --git a/vendor/laminas/laminas-validator/src/Isbn.php b/vendor/laminas/laminas-validator/src/Isbn.php new file mode 100644 index 00000000..09abc603 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Isbn.php @@ -0,0 +1,199 @@ + 'Invalid type given. String or integer expected', + self::NO_ISBN => 'The input is not a valid ISBN number', + ]; + + /** @var array */ + protected $options = [ + 'type' => self::AUTO, // Allowed type + 'separator' => '', // Separator character + ]; + + /** + * Detect input format. + * + * @return null|string + */ + protected function detectFormat() + { + // prepare separator and pattern list + $sep = quotemeta($this->getSeparator()); + $patterns = []; + $lengths = []; + $type = $this->getType(); + + // check for ISBN-10 + if ($type === self::ISBN10 || $type === self::AUTO) { + if (empty($sep)) { + $pattern = '/^[0-9]{9}[0-9X]{1}$/'; + $length = 10; + } else { + $pattern = "/^[0-9]{1,7}[{$sep}]{1}[0-9]{1,7}[{$sep}]{1}[0-9]{1,7}[{$sep}]{1}[0-9X]{1}$/"; + $length = 13; + } + + $patterns[$pattern] = self::ISBN10; + $lengths[$pattern] = $length; + } + + // check for ISBN-13 + if ($type === self::ISBN13 || $type === self::AUTO) { + if (empty($sep)) { + $pattern = '/^[0-9]{13}$/'; + $length = 13; + } else { + // @codingStandardsIgnoreStart + $pattern = "/^[0-9]{1,9}[{$sep}]{1}[0-9]{1,5}[{$sep}]{1}[0-9]{1,9}[{$sep}]{1}[0-9]{1,9}[{$sep}]{1}[0-9]{1}$/"; + // @codingStandardsIgnoreEnd + $length = 17; + } + + $patterns[$pattern] = self::ISBN13; + $lengths[$pattern] = $length; + } + + // check pattern list + foreach ($patterns as $pattern => $type) { + if ((strlen($this->getValue()) === $lengths[$pattern]) && preg_match($pattern, $this->getValue())) { + return $type; + } + } + + return null; + } + + /** + * Returns true if and only if $value is a valid ISBN. + * + * @param mixed $value + * @return bool + */ + public function isValid($value) + { + if (! is_string($value) && ! is_int($value)) { + $this->error(self::INVALID); + return false; + } + + $value = (string) $value; + $originalValue = $value; + $this->setValue($value); + + switch ($this->detectFormat()) { + case self::ISBN10: + $isbn = new Isbn\Isbn10(); + break; + + case self::ISBN13: + $isbn = new Isbn\Isbn13(); + break; + + default: + $this->error(self::NO_ISBN); + return false; + } + + $value = str_replace($this->getSeparator(), '', $value); + $checksum = $isbn->getChecksum($value); + + // validate + if (substr($originalValue, -1) !== (string) $checksum) { + $this->error(self::NO_ISBN); + return false; + } + return true; + } + + /** + * Set separator characters. + * + * It is allowed only empty string, hyphen and space. + * + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @param string $separator + * @return $this Provides a fluent interface + * @throws Exception\InvalidArgumentException When $separator is not valid. + */ + public function setSeparator($separator) + { + // check separator + if (! in_array($separator, ['-', ' ', ''])) { + throw new Exception\InvalidArgumentException('Invalid ISBN separator.'); + } + + $this->options['separator'] = $separator; + return $this; + } + + /** + * Get separator characters. + * + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @return string + */ + public function getSeparator() + { + return $this->options['separator']; + } + + /** + * Set allowed ISBN type. + * + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @param string $type + * @return $this Provides a fluent interface + * @throws Exception\InvalidArgumentException When $type is not valid. + */ + public function setType($type) + { + // check type + if (! in_array($type, [self::AUTO, self::ISBN10, self::ISBN13])) { + throw new Exception\InvalidArgumentException('Invalid ISBN type'); + } + + $this->options['type'] = $type; + return $this; + } + + /** + * Get allowed ISBN type. + * + * @deprecated Since 2.61.0 - All option getters and setters will be removed in 3.0 + * + * @return string + */ + public function getType() + { + return $this->options['type']; + } +} diff --git a/vendor/laminas/laminas-validator/src/Isbn/Isbn10.php b/vendor/laminas/laminas-validator/src/Isbn/Isbn10.php new file mode 100755 index 00000000..14fca5ed --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Isbn/Isbn10.php @@ -0,0 +1,59 @@ +sum($value); + return $this->checksum($sum); + } + + /** + * Calculate the value sum. + * + * @param string $value + * @return int + */ + private function sum($value) + { + $sum = 0; + + for ($i = 0; $i < 9; $i++) { + $sum += (10 - $i) * (int) $value[$i]; + } + + return $sum; + } + + /** + * Calculate the checksum for the value's sum. + * + * @param int $sum + * @return int|string + */ + private function checksum($sum) + { + $checksum = 11 - ($sum % 11); + + if ($checksum === 11) { + return '0'; + } + + if ($checksum === 10) { + return 'X'; + } + + return $checksum; + } +} diff --git a/vendor/laminas/laminas-validator/src/Isbn/Isbn13.php b/vendor/laminas/laminas-validator/src/Isbn/Isbn13.php new file mode 100755 index 00000000..8325e1b2 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Isbn/Isbn13.php @@ -0,0 +1,60 @@ +sum($value); + return $this->checksum($sum); + } + + /** + * Calculate the value sum. + * + * @param string $value + * @return int + */ + private function sum($value) + { + $sum = 0; + + for ($i = 0; $i < 12; $i++) { + if ($i % 2 === 0) { + $sum += (int) $value[$i]; + continue; + } + + $sum += 3 * (int) $value[$i]; + } + + return $sum; + } + + /** + * Calculate the checksum for the value's sum. + * + * @param int $sum + * @return int|string + */ + private function checksum($sum) + { + $checksum = 10 - ($sum % 10); + + if ($checksum === 10) { + return '0'; + } + + return $checksum; + } +} diff --git a/vendor/laminas/laminas-validator/src/LessThan.php b/vendor/laminas/laminas-validator/src/LessThan.php new file mode 100644 index 00000000..751099e4 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/LessThan.php @@ -0,0 +1,163 @@ + "The input is not less than '%max%'", + self::NOT_LESS_INCLUSIVE => "The input is not less or equal than '%max%'", + ]; + + /** + * Additional variables available for validation failure messages + * + * @var array + */ + protected $messageVariables = [ + 'max' => 'max', + ]; + + /** + * Maximum value + * + * @var mixed + */ + protected $max; + + /** + * Whether to do inclusive comparisons, allowing equivalence to max + * + * If false, then strict comparisons are done, and the value may equal + * the max option + * + * @var bool + */ + protected $inclusive; + + /** + * Sets validator options + * + * @param array|Traversable $options + * @throws Exception\InvalidArgumentException + */ + public function __construct($options = null) + { + if ($options instanceof Traversable) { + $options = ArrayUtils::iteratorToArray($options); + } + if (! is_array($options)) { + $options = func_get_args(); + $temp['max'] = array_shift($options); + + if (! empty($options)) { + $temp['inclusive'] = array_shift($options); + } + + $options = $temp; + } + + if (! array_key_exists('max', $options)) { + throw new Exception\InvalidArgumentException("Missing option 'max'"); + } + + if (! array_key_exists('inclusive', $options)) { + $options['inclusive'] = false; + } + + $this->setMax($options['max']) + ->setInclusive($options['inclusive']); + + parent::__construct($options); + } + + /** + * Returns the max option + * + * @return mixed + */ + public function getMax() + { + return $this->max; + } + + /** + * Sets the max option + * + * @return $this Provides a fluent interface + */ + public function setMax(mixed $max) + { + $this->max = $max; + return $this; + } + + /** + * Returns the inclusive option + * + * @return bool + */ + public function getInclusive() + { + return $this->inclusive; + } + + /** + * Sets the inclusive option + * + * @param bool $inclusive + * @return $this Provides a fluent interface + */ + public function setInclusive($inclusive) + { + $this->inclusive = $inclusive; + return $this; + } + + /** + * Returns true if and only if $value is less than max option, inclusively + * when the inclusive option is true + * + * @param mixed $value + * @return bool + */ + public function isValid($value) + { + $this->setValue($value); + + if ($this->inclusive) { + if ($value > $this->max) { + $this->error(self::NOT_LESS_INCLUSIVE); + return false; + } + } else { + if ($value >= $this->max) { + $this->error(self::NOT_LESS); + return false; + } + } + + return true; + } +} diff --git a/vendor/laminas/laminas-validator/src/Module.php b/vendor/laminas/laminas-validator/src/Module.php new file mode 100644 index 00000000..06a7be84 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Module.php @@ -0,0 +1,45 @@ + $provider->getDependencyConfig(), + ]; + } + + /** + * Register a specification for the ValidatorManager with the ServiceListener. + * + * @deprecated ModuleManager support will be removed in version 3.0 of this component + * + * @param ModuleManager $moduleManager + * @return void + */ + public function init($moduleManager) + { + $event = $moduleManager->getEvent(); + $container = $event->getParam('ServiceManager'); + $serviceListener = $container->get('ServiceListener'); + + $serviceListener->addServiceManager( + 'ValidatorManager', + 'validators', + ValidatorProviderInterface::class, + 'getValidatorConfig' + ); + } +} diff --git a/vendor/laminas/laminas-validator/src/NotEmpty.php b/vendor/laminas/laminas-validator/src/NotEmpty.php new file mode 100644 index 00000000..57df0786 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/NotEmpty.php @@ -0,0 +1,313 @@ + */ + protected $constants = [ + self::BOOLEAN => 'boolean', + self::INTEGER => 'integer', + self::FLOAT => 'float', + self::STRING => 'string', + self::ZERO => 'zero', + self::EMPTY_ARRAY => 'array', + self::NULL => 'null', + self::PHP => 'php', + self::SPACE => 'space', + self::OBJECT => 'object', + self::OBJECT_STRING => 'objectstring', + self::OBJECT_COUNT => 'objectcount', + self::ALL => 'all', + ]; + + /** + * Default value for types; value = 0b000111101001 + * + * @var array + */ + protected $defaultType = [ + self::OBJECT, + self::SPACE, + self::NULL, + self::EMPTY_ARRAY, + self::STRING, + self::BOOLEAN, + ]; + + /** @var array */ + protected $messageTemplates = [ + self::IS_EMPTY => "Value is required and can't be empty", + self::INVALID => 'Invalid type given. String, integer, float, boolean or array expected', + ]; + + /** + * Options for this validator + * + * @var array + */ + protected $options = []; + + /** + * Constructor + * + * @param array|Traversable|int $options OPTIONAL + */ + public function __construct($options = null) + { + if ($options instanceof Traversable) { + $options = ArrayUtils::iteratorToArray($options); + } + + if (! is_array($options)) { + $options = func_get_args(); + $temp = []; + if (! empty($options)) { + $temp['type'] = array_shift($options); + } + + $options = $temp; + } + + if (! isset($options['type'])) { + if (($type = $this->calculateTypeValue($options)) !== 0) { + $options['type'] = $type; + } else { + $options['type'] = $this->defaultType; + } + } + + parent::__construct($options); + } + + /** + * Returns the set types + * + * @deprecated Since 2.61.0 All option getters and setters will be removed in v3.0 + * + * @return int + */ + public function getType() + { + return $this->options['type']; + } + + /** + * @deprecated Since 2.61.0 All option getters and setters will be removed in v3.0 + * + * @return false|int|string + */ + public function getDefaultType() + { + return $this->calculateTypeValue($this->defaultType); + } + + /** + * @param array|int|string $type + * @return false|int|string + */ + protected function calculateTypeValue($type) + { + if (is_array($type)) { + $detected = 0; + foreach ($type as $value) { + if (is_int($value)) { + $detected |= $value; + } elseif (in_array($value, $this->constants, true)) { + $detected |= (int) array_search($value, $this->constants, true); + } + } + + $type = $detected; + } elseif (is_string($type) && in_array($type, $this->constants, true)) { + $type = array_search($type, $this->constants, true); + } + + return $type; + } + + /** + * Set the types + * + * @deprecated Since 2.61.0 All option getters and setters will be removed in v3.0 + * + * @param int|int[] $type + * @return $this + * @throws Exception\InvalidArgumentException + */ + public function setType($type = null) + { + $type = $this->calculateTypeValue($type); + + if (! is_int($type) || ($type < 0) || ($type > self::ALL)) { + throw new Exception\InvalidArgumentException('Unknown type'); + } + + $this->options['type'] = $type; + + return $this; + } + + /** + * Returns true if and only if $value is not an empty value. + * + * @param mixed $value + * @return bool + */ + public function isValid($value) + { + if ( + $value !== null + && ! is_string($value) + && ! is_int($value) + && ! is_float($value) + && ! is_bool($value) + && ! is_array($value) + && ! is_object($value) + ) { + $this->error(self::INVALID); + return false; + } + + $type = $this->getType(); + $this->setValue($value); + $object = false; + + // OBJECT_COUNT (countable object) + if ($type & self::OBJECT_COUNT) { + $object = true; + + if (is_object($value) && $value instanceof Countable && (count($value) === 0)) { + $this->error(self::IS_EMPTY); + return false; + } + } + + // OBJECT_STRING (object's toString) + if ($type & self::OBJECT_STRING) { + $object = true; + + if ( + (is_object($value) && ! method_exists($value, '__toString')) + || (is_object($value) && method_exists($value, '__toString') && (string) $value === '') + ) { + $this->error(self::IS_EMPTY); + return false; + } + } + + // OBJECT (object) + // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedIf + if ($type & self::OBJECT) { + // fall through, objects are always not empty + } elseif ($object === false) { + // object not allowed but object given -> return false + if (is_object($value)) { + $this->error(self::IS_EMPTY); + return false; + } + } + + // SPACE (' ') + if ($type & self::SPACE) { + if (is_string($value) && (preg_match('/^\s+$/s', $value))) { + $this->error(self::IS_EMPTY); + return false; + } + } + + // NULL (null) + if ($type & self::NULL) { + if ($value === null) { + $this->error(self::IS_EMPTY); + return false; + } + } + + // EMPTY_ARRAY (array()) + if ($type & self::EMPTY_ARRAY) { + if ($value === []) { + $this->error(self::IS_EMPTY); + return false; + } + } + + // ZERO ('0') + if ($type & self::ZERO) { + if ($value === '0') { + $this->error(self::IS_EMPTY); + return false; + } + } + + // STRING ('') + if ($type & self::STRING) { + if ($value === '') { + $this->error(self::IS_EMPTY); + return false; + } + } + + // FLOAT (0.0) + if ($type & self::FLOAT) { + if ($value === 0.0) { + $this->error(self::IS_EMPTY); + return false; + } + } + + // INTEGER (0) + if ($type & self::INTEGER) { + if ($value === 0) { + $this->error(self::IS_EMPTY); + return false; + } + } + + // BOOLEAN (false) + if ($type & self::BOOLEAN) { + if ($value === false) { + $this->error(self::IS_EMPTY); + return false; + } + } + + return true; + } +} diff --git a/vendor/laminas/laminas-validator/src/NumberComparison.php b/vendor/laminas/laminas-validator/src/NumberComparison.php new file mode 100644 index 00000000..c5ca6f13 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/NumberComparison.php @@ -0,0 +1,124 @@ + + * } + * @psalm-type Options = array{ + * min: numeric|null, + * max: numeric|null, + * inclusiveMin: bool, + * inclusiveMax: bool, + * } + */ +final class NumberComparison extends AbstractValidator +{ + public const ERROR_NOT_NUMERIC = 'notNumeric'; + public const ERROR_NOT_GREATER_INCLUSIVE = 'notGreaterInclusive'; + public const ERROR_NOT_GREATER = 'notGreater'; + public const ERROR_NOT_LESS_INCLUSIVE = 'notLessInclusive'; + public const ERROR_NOT_LESS = 'notLess'; + + /** @var array */ + protected array $messageTemplates = [ + self::ERROR_NOT_NUMERIC => 'Expected a numeric value', + self::ERROR_NOT_GREATER_INCLUSIVE => 'Values must be greater than or equal to %min%. Received "%value%"', + self::ERROR_NOT_GREATER => 'Values must be greater than %min%. Received "%value%', + self::ERROR_NOT_LESS_INCLUSIVE => 'Values must be less than or equal to %max%. Received "%value%"', + self::ERROR_NOT_LESS => 'Values must be less than %max%. Received "%value%"', + ]; + + /** @var array> */ + protected array $messageVariables = [ + 'min' => ['options' => 'min'], + 'max' => ['options' => 'max'], + ]; + + /** @var Options */ + protected array $options = [ + 'min' => null, + 'max' => null, + 'inclusiveMin' => true, + 'inclusiveMax' => true, + ]; + + /** @param OptionsArgument $options */ + public function __construct(array $options = []) + { + parent::__construct($options); + + $min = $options['min'] ?? null; + $max = $options['max'] ?? null; + + if (! is_numeric($min) && ! is_numeric($max)) { + throw new InvalidArgumentException( + 'A numeric option value for either min, max or both must be provided', + ); + } + + if ($min !== null && $max !== null && $min > $max) { + throw new InvalidArgumentException( + 'The minimum constraint cannot be greater than the maximum constraint', + ); + } + + $this->options['min'] = $min; + $this->options['max'] = $max; + $this->options['inclusiveMin'] = $options['inclusiveMin'] ?? true; + $this->options['inclusiveMax'] = $options['inclusiveMax'] ?? true; + } + + public function isValid(mixed $value): bool + { + if (! is_numeric($value)) { + $this->error(self::ERROR_NOT_NUMERIC); + + return false; + } + + $this->setValue($value); + + $min = $this->options['min']; + $max = $this->options['max']; + $inclusiveMin = $this->options['inclusiveMin']; + $inclusiveMax = $this->options['inclusiveMax']; + + if ($min !== null && $inclusiveMin && $value < $min) { + $this->error(self::ERROR_NOT_GREATER_INCLUSIVE); + + return false; + } + + if ($min !== null && ! $inclusiveMin && $value <= $min) { + $this->error(self::ERROR_NOT_GREATER); + + return false; + } + + if ($max !== null && $inclusiveMax && $value > $max) { + $this->error(self::ERROR_NOT_LESS_INCLUSIVE); + + return false; + } + + if ($max !== null && ! $inclusiveMax && $value >= $max) { + $this->error(self::ERROR_NOT_LESS); + + return false; + } + + return true; + } +} diff --git a/vendor/laminas/laminas-validator/src/Regex.php b/vendor/laminas/laminas-validator/src/Regex.php new file mode 100644 index 00000000..02cf6dd3 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Regex.php @@ -0,0 +1,145 @@ + 'Invalid type given. String, integer or float expected', + self::NOT_MATCH => "The input does not match against pattern '%pattern%'", + self::ERROROUS => "There was an internal error while using the pattern '%pattern%'", + ]; + + /** @var array */ + protected $messageVariables = [ + 'pattern' => 'pattern', + ]; + + /** + * Regular expression pattern + * + * @var non-empty-string + */ + protected $pattern; + + /** + * Sets validator options + * + * @param non-empty-string|array|Traversable $pattern + * @throws Exception\InvalidArgumentException On missing 'pattern' parameter. + */ + public function __construct($pattern) + { + if (is_string($pattern)) { + $this->setPattern($pattern); + parent::__construct([]); + return; + } + + if ($pattern instanceof Traversable) { + $pattern = ArrayUtils::iteratorToArray($pattern); + } + + if (! is_array($pattern)) { + throw new Exception\InvalidArgumentException('Invalid options provided to constructor'); + } + + if (! array_key_exists('pattern', $pattern) || ! is_string($pattern['pattern']) || $pattern['pattern'] === '') { + throw new Exception\InvalidArgumentException("Missing option 'pattern'"); + } + + $this->setPattern($pattern['pattern']); + unset($pattern['pattern']); + parent::__construct($pattern); + } + + /** + * Returns the pattern option + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @return non-empty-string|null + */ + public function getPattern() + { + return $this->pattern; + } + + /** + * Sets the pattern option + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @param non-empty-string $pattern + * @return $this Provides a fluent interface + * @throws Exception\InvalidArgumentException If there is a fatal error in pattern matching. + */ + public function setPattern($pattern) + { + ErrorHandler::start(); + $this->pattern = (string) $pattern; + $status = preg_match($this->pattern, 'Test'); + $error = ErrorHandler::stop(); + + if (false === $status) { + throw new Exception\InvalidArgumentException( + "Internal error parsing the pattern '{$this->pattern}'", + 0, + $error + ); + } + + return $this; + } + + /** + * Returns true if and only if $value matches against the pattern option + * + * @param mixed $value + * @return bool + */ + public function isValid($value) + { + if (! is_string($value) && ! is_int($value) && ! is_float($value)) { + $this->error(self::INVALID); + return false; + } + + $this->setValue($value); + + ErrorHandler::start(); + $status = preg_match($this->pattern, (string) $value); + ErrorHandler::stop(); + if (false === $status) { + $this->error(self::ERROROUS); + return false; + } + + if (! $status) { + $this->error(self::NOT_MATCH); + return false; + } + + return true; + } +} diff --git a/vendor/laminas/laminas-validator/src/Sitemap/Changefreq.php b/vendor/laminas/laminas-validator/src/Sitemap/Changefreq.php new file mode 100644 index 00000000..83ff0642 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Sitemap/Changefreq.php @@ -0,0 +1,74 @@ + value + * + * @link http://www.sitemaps.org/protocol.php Sitemaps XML format + * + * @final + */ +class Changefreq extends AbstractValidator +{ + /** + * Validation key for not valid + */ + public const NOT_VALID = 'sitemapChangefreqNotValid'; + public const INVALID = 'sitemapChangefreqInvalid'; + + /** + * Validation failure message template definitions + * + * @var array + */ + protected $messageTemplates = [ + self::NOT_VALID => 'The input is not a valid sitemap changefreq', + self::INVALID => 'Invalid type given. String expected', + ]; + + /** + * Valid change frequencies + * + * @var array + */ + protected $changeFreqs = [ + 'always', + 'hourly', + 'daily', + 'weekly', + 'monthly', + 'yearly', + 'never', + ]; + + /** + * Validates if a string is valid as a sitemap changefreq + * + * @link http://www.sitemaps.org/protocol.php#changefreqdef + * + * @param string $value value to validate + * @return bool + */ + public function isValid($value) + { + if (! is_string($value)) { + $this->error(self::INVALID); + return false; + } + + $this->setValue($value); + + if (! in_array($value, $this->changeFreqs, true)) { + $this->error(self::NOT_VALID); + return false; + } + + return true; + } +} diff --git a/vendor/laminas/laminas-validator/src/Sitemap/Lastmod.php b/vendor/laminas/laminas-validator/src/Sitemap/Lastmod.php new file mode 100644 index 00000000..a13f1ca1 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Sitemap/Lastmod.php @@ -0,0 +1,71 @@ + value + * + * @link http://www.sitemaps.org/protocol.php Sitemaps XML format + * + * @final + */ +class Lastmod extends AbstractValidator +{ + // phpcs:disable Generic.Files.LineLength.TooLong + + /** + * Regular expression to use when validating + */ + public const LASTMOD_REGEX = '/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])(T([0-1][0-9]|2[0-3])(:[0-5][0-9])(:[0-5][0-9])?(\\+|-)([0-1][0-9]|2[0-3]):[0-5][0-9])?$/'; + + // phpcs:enable + + /** + * Validation key for not valid + */ + public const NOT_VALID = 'sitemapLastmodNotValid'; + public const INVALID = 'sitemapLastmodInvalid'; + + /** + * Validation failure message template definitions + * + * @var array + */ + protected $messageTemplates = [ + self::NOT_VALID => 'The input is not a valid sitemap lastmod', + self::INVALID => 'Invalid type given. String expected', + ]; + + /** + * Validates if a string is valid as a sitemap lastmod + * + * @link http://www.sitemaps.org/protocol.php#lastmoddef + * + * @param string $value value to validate + * @return bool + */ + public function isValid($value) + { + if (! is_string($value)) { + $this->error(self::INVALID); + return false; + } + + $this->setValue($value); + ErrorHandler::start(); + $result = preg_match(self::LASTMOD_REGEX, $value); + ErrorHandler::stop(); + if ($result !== 1) { + $this->error(self::NOT_VALID); + return false; + } + + return true; + } +} diff --git a/vendor/laminas/laminas-validator/src/Sitemap/Loc.php b/vendor/laminas/laminas-validator/src/Sitemap/Loc.php new file mode 100644 index 00000000..b82f3d2e --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Sitemap/Loc.php @@ -0,0 +1,60 @@ + value + * + * @link http://www.sitemaps.org/protocol.php Sitemaps XML format + * @see Laminas\Uri\Uri + * + * @final + */ +class Loc extends AbstractValidator +{ + /** + * Validation key for not valid + */ + public const NOT_VALID = 'sitemapLocNotValid'; + public const INVALID = 'sitemapLocInvalid'; + + /** + * Validation failure message template definitions + * + * @var array + */ + protected $messageTemplates = [ + self::NOT_VALID => 'The input is not a valid sitemap location', + self::INVALID => 'Invalid type given. String expected', + ]; + + /** + * Validates if a string is valid as a sitemap location + * + * @link http://www.sitemaps.org/protocol.php#locdef + * + * @param string $value value to validate + * @return bool + */ + public function isValid($value) + { + if (! is_string($value)) { + $this->error(self::INVALID); + return false; + } + + $this->setValue($value); + $uri = Uri\UriFactory::factory($value); + if (! $uri->isValid()) { + $this->error(self::NOT_VALID); + return false; + } + + return true; + } +} diff --git a/vendor/laminas/laminas-validator/src/Sitemap/Priority.php b/vendor/laminas/laminas-validator/src/Sitemap/Priority.php new file mode 100644 index 00000000..f61a1a44 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Sitemap/Priority.php @@ -0,0 +1,58 @@ + value + * + * @link http://www.sitemaps.org/protocol.php Sitemaps XML format + * + * @final + */ +class Priority extends AbstractValidator +{ + /** + * Validation key for not valid + */ + public const NOT_VALID = 'sitemapPriorityNotValid'; + public const INVALID = 'sitemapPriorityInvalid'; + + /** + * Validation failure message template definitions + * + * @var array + */ + protected $messageTemplates = [ + self::NOT_VALID => 'The input is not a valid sitemap priority', + self::INVALID => 'Invalid type given. Numeric string, integer or float expected', + ]; + + /** + * Validates if a string is valid as a sitemap priority + * + * @link http://www.sitemaps.org/protocol.php#prioritydef + * + * @param string $value value to validate + * @return bool + */ + public function isValid($value) + { + if (! is_numeric($value)) { + $this->error(self::INVALID); + return false; + } + + $this->setValue($value); + $value = (float) $value; + if ($value < 0 || $value > 1) { + $this->error(self::NOT_VALID); + return false; + } + + return true; + } +} diff --git a/vendor/laminas/laminas-validator/src/StaticValidator.php b/vendor/laminas/laminas-validator/src/StaticValidator.php new file mode 100644 index 00000000..682dcef4 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/StaticValidator.php @@ -0,0 +1,76 @@ +configure(['shared_by_default' => false]); + } else { + $plugins->setShareByDefault(false); + } + } + static::$plugins = $plugins; + } + + /** + * Get plugin manager for locating validators + * + * @return ValidatorPluginManager + */ + public static function getPluginManager() + { + if (! static::$plugins instanceof ValidatorPluginManager) { + $plugins = new ValidatorPluginManager(new ServiceManager()); + static::setPluginManager($plugins); + + return $plugins; + } + return static::$plugins; + } + + /** + * @param class-string $classBaseName + * @param array $options OPTIONAL associative array of options to pass as + * the sole argument to the validator constructor. + * @return bool + * @throws Exception\InvalidArgumentException For an invalid $options argument. + */ + public static function execute(mixed $value, $classBaseName, array $options = []) + { + if ($options && array_values($options) === $options) { + throw new Exception\InvalidArgumentException( + 'Invalid options provided via $options argument; must be an associative array' + ); + } + + $plugins = static::getPluginManager(); + $validator = $plugins->get($classBaseName, $options); + + return $validator->isValid($value); + } +} diff --git a/vendor/laminas/laminas-validator/src/Step.php b/vendor/laminas/laminas-validator/src/Step.php new file mode 100644 index 00000000..6bc93440 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Step.php @@ -0,0 +1,188 @@ + 'Invalid value given. Scalar expected', + self::NOT_STEP => 'The input is not a valid step', + ]; + + /** @var numeric */ + protected $baseValue = 0; + + /** @var numeric */ + protected $step = 1; + + /** + * Set default options for this instance + * + * @param iterable $options + */ + public function __construct($options = []) + { + if ($options instanceof Traversable) { + $options = iterator_to_array($options); + } elseif (! is_array($options)) { + $options = func_get_args(); + $temp['baseValue'] = array_shift($options); + if (! empty($options)) { + $temp['step'] = array_shift($options); + } + + $options = $temp; + } + + if (isset($options['baseValue'])) { + $this->setBaseValue($options['baseValue']); + } + if (isset($options['step'])) { + $this->setStep($options['step']); + } + + parent::__construct($options); + } + + /** + * Sets the base value from which the step should be computed + * + * @deprecated Since 2.61.0 All option getters and setters will be removed in v3.0 + * + * @param numeric $baseValue + * @return $this + */ + public function setBaseValue(mixed $baseValue) + { + $this->baseValue = $baseValue; + return $this; + } + + /** + * Returns the base value from which the step should be computed + * + * @deprecated Since 2.61.0 All option getters and setters will be removed in v3.0 + * + * @return numeric + */ + public function getBaseValue() + { + return $this->baseValue; + } + + /** + * Sets the step value + * + * @deprecated Since 2.61.0 All option getters and setters will be removed in v3.0 + * + * @param numeric $step + * @return $this + */ + public function setStep(mixed $step) + { + $this->step = (float) $step; + return $this; + } + + /** + * Returns the step value + * + * @deprecated Since 2.61.0 All option getters and setters will be removed in v3.0 + * + * @return numeric + */ + public function getStep() + { + return $this->step; + } + + /** + * Returns true if $value is a scalar and a valid step value + * + * @param mixed $value + * @return bool + */ + public function isValid($value) + { + if (! is_numeric($value)) { + $this->error(self::INVALID); + return false; + } + + $this->setValue($value); + + $substract = $this->sub($value, $this->baseValue); + + $fmod = $this->fmod($substract, $this->step); + + if ($fmod !== 0.0 && $fmod !== $this->step) { + $this->error(self::NOT_STEP); + return false; + } + + return true; + } + + /** + * replaces the internal fmod function which give wrong results on many cases + * + * @param numeric $x + * @param numeric $y + * @return float + */ + protected function fmod($x, $y) + { + if ($y === 0.0 || $y === 0) { + return 1.0; + } + + //find the maximum precision from both input params to give accurate results + $precision = $this->getPrecision($x) + $this->getPrecision($y); + + return round($x - $y * floor($x / $y), $precision); + } + + /** + * replaces the internal substraction operation which give wrong results on some cases + * + * @param numeric $x + * @param numeric $y + * @return float + */ + private function sub($x, $y) + { + $precision = $this->getPrecision($x) + $this->getPrecision($y); + return round($x - $y, $precision); + } + + /** + * @param numeric $float + */ + private function getPrecision($float): int + { + $position = strpos((string) $float, '.'); + $segment = $position === false + ? null + : substr((string) $float, $position + 1); + + return $segment !== null ? strlen($segment) : 0; + } +} diff --git a/vendor/laminas/laminas-validator/src/StringLength.php b/vendor/laminas/laminas-validator/src/StringLength.php new file mode 100644 index 00000000..d02f2a6a --- /dev/null +++ b/vendor/laminas/laminas-validator/src/StringLength.php @@ -0,0 +1,254 @@ + */ + protected $messageTemplates = [ + self::INVALID => 'Invalid type given. String expected', + self::TOO_SHORT => 'The input is less than %min% characters long', + self::TOO_LONG => 'The input is more than %max% characters long', + ]; + + /** @var array> */ + protected $messageVariables = [ + 'min' => ['options' => 'min'], + 'max' => ['options' => 'max'], + 'length' => ['options' => 'length'], + ]; + + /** @var array */ + protected $options = [ + 'min' => 0, // Minimum length + 'max' => null, // Maximum length, null if there is no length limitation + 'encoding' => 'UTF-8', // Encoding to use + 'length' => 0, // Actual length + ]; + + /** @var null|StringWrapperInterface */ + protected $stringWrapper; + + /** + * Sets validator options + * + * @param int|array|Traversable $options + */ + public function __construct($options = []) + { + if (! is_array($options)) { + $options = func_get_args(); + $temp['min'] = array_shift($options); + if (! empty($options)) { + $temp['max'] = array_shift($options); + } + + if (! empty($options)) { + $temp['encoding'] = array_shift($options); + } + + $options = $temp; + } + + parent::__construct($options); + } + + /** + * Returns the min option + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @return int + */ + public function getMin() + { + return $this->options['min']; + } + + /** + * Sets the min option + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @param int $min + * @return $this Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function setMin($min) + { + if (null !== $this->getMax() && $min > $this->getMax()) { + throw new Exception\InvalidArgumentException( + "The minimum must be less than or equal to the maximum length, but {$min} > {$this->getMax()}" + ); + } + + $this->options['min'] = max(0, (int) $min); + return $this; + } + + /** + * Returns the max option + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @return int|null + */ + public function getMax() + { + return $this->options['max']; + } + + /** + * Sets the max option + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @param int|null $max + * @return $this Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function setMax($max) + { + if (null === $max) { + $this->options['max'] = null; + } elseif ($max < $this->getMin()) { + throw new Exception\InvalidArgumentException( + "The maximum must be greater than or equal to the minimum length, but {$max} < {$this->getMin()}" + ); + } else { + $this->options['max'] = (int) $max; + } + + return $this; + } + + /** + * Get the string wrapper to detect the string length + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @return StringWrapper + */ + public function getStringWrapper() + { + if (! $this->stringWrapper) { + $this->stringWrapper = StringUtils::getWrapper($this->getEncoding()); + } + return $this->stringWrapper; + } + + /** + * Set the string wrapper to detect the string length + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @return void + */ + public function setStringWrapper(StringWrapper $stringWrapper) + { + $stringWrapper->setEncoding($this->getEncoding()); + $this->stringWrapper = $stringWrapper; + } + + /** + * Returns the actual encoding + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @return string + */ + public function getEncoding() + { + return $this->options['encoding']; + } + + /** + * Sets a new encoding to use + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @param string $encoding + * @return $this + * @throws Exception\InvalidArgumentException + */ + public function setEncoding($encoding) + { + $this->stringWrapper = StringUtils::getWrapper($encoding); + $this->options['encoding'] = $encoding; + return $this; + } + + /** + * Returns the length option + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @return int + */ + private function getLength() + { + return $this->options['length']; + } + + /** + * Sets the length option + * + * @deprecated Since 2.60.0 all option setters and getters are deprecated for removal in 3.0 + * + * @param int $length + * @return $this Provides a fluent interface + */ + private function setLength($length) + { + $this->options['length'] = (int) $length; + return $this; + } + + /** + * Returns true if and only if the string length of $value is at least the min option and + * no greater than the max option (when the max option is not null). + * + * @param string $value + * @return bool + */ + public function isValid($value) + { + if (! is_string($value)) { + $this->error(self::INVALID); + return false; + } + + $this->setValue($value); + + $this->setLength($this->getStringWrapper()->strlen($value)); + if ($this->getLength() < $this->getMin()) { + $this->error(self::TOO_SHORT); + } + + if (null !== $this->getMax() && $this->getMax() < $this->getLength()) { + $this->error(self::TOO_LONG); + } + + if ($this->getMessages()) { + return false; + } + + return true; + } +} diff --git a/vendor/laminas/laminas-validator/src/Timezone.php b/vendor/laminas/laminas-validator/src/Timezone.php new file mode 100644 index 00000000..7aa4da99 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Timezone.php @@ -0,0 +1,175 @@ + 'location', + self::ABBREVIATION => 'abbreviation', + ]; + + /** + * Default value for types; value = 3 + * + * @var array + */ + protected $defaultType = [ + self::LOCATION, + self::ABBREVIATION, + ]; + + /** @var array */ + protected $messageTemplates = [ + self::INVALID => 'Invalid timezone given.', + self::INVALID_TIMEZONE_LOCATION => 'Invalid timezone location given.', + self::INVALID_TIMEZONE_ABBREVIATION => 'Invalid timezone abbreviation given.', + ]; + + /** + * Options for this validator + * + * @var array + */ + protected $options = []; + + /** + * Constructor + * + * @param array|int $options OPTIONAL + */ + public function __construct($options = []) + { + $opts['type'] = $this->defaultType; + + if (is_array($options)) { + if (array_key_exists('type', $options)) { + $opts['type'] = $options['type']; + } + } elseif (! empty($options)) { + $opts['type'] = $options; + } + + // setType called by parent constructor then setOptions method + parent::__construct($opts); + } + + /** + * Set the types + * + * @deprecated Since 2.60.0 All option setters and getters will be removed in v3.0 + * + * @param int|array $type + * @return void + * @throws Exception\InvalidArgumentException + */ + public function setType($type = null) + { + $type = $this->calculateTypeValue($type); + + if (! is_int($type) || ($type < 1) || ($type > self::ALL)) { + throw new Exception\InvalidArgumentException(sprintf( + 'Unknown type "%s" provided', + is_string($type) || is_int($type) + ? $type : gettype($type) + )); + } + + $this->options['type'] = $type; + } + + /** + * Returns true if timezone location or timezone abbreviations is correct. + * + * @param mixed $value + * @return bool + */ + public function isValid($value) + { + if ($value !== null && ! is_string($value)) { + $this->error(self::INVALID); + return false; + } + + $type = $this->options['type']; + $this->setValue($value); + + switch (true) { + // Check in locations and abbreviations + case ($type & self::LOCATION) && ($type & self::ABBREVIATION): + $abbrs = DateTimeZone::listAbbreviations(); + $locations = DateTimeZone::listIdentifiers(); + + if (! array_key_exists($value, $abbrs) && ! in_array($value, $locations)) { + $this->error(self::INVALID); + return false; + } + break; + + // Check only in locations + case $type & self::LOCATION: + $locations = DateTimeZone::listIdentifiers(); + + if (! in_array($value, $locations)) { + $this->error(self::INVALID_TIMEZONE_LOCATION); + return false; + } + break; + + // Check only in abbreviations + case $type & self::ABBREVIATION: + $abbrs = DateTimeZone::listAbbreviations(); + + if (! array_key_exists($value, $abbrs)) { + $this->error(self::INVALID_TIMEZONE_ABBREVIATION); + return false; + } + break; + } + + return true; + } + + /** + * @deprecated Since 2.60.0 This method wil be removed in 3.0 + * + * @param array|int|string $type + * @return float|int + */ + protected function calculateTypeValue($type) + { + $types = (array) $type; + $detected = 0; + + foreach ($types as $value) { + if (is_int($value)) { + $detected |= $value; + } elseif (false !== array_search($value, $this->constants)) { + $detected |= array_search($value, $this->constants); + } + } + + return $detected; + } +} diff --git a/vendor/laminas/laminas-validator/src/Translator/DummyTranslator.php b/vendor/laminas/laminas-validator/src/Translator/DummyTranslator.php new file mode 100644 index 00000000..12aff89f --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Translator/DummyTranslator.php @@ -0,0 +1,27 @@ +translator->translate($message, $textDomain, $locale); + } + + /** + * Provide a pluralized translation of the given string using the given text domain and locale + * + * @param string $singular + * @param string $plural + * @param int $number + * @param string $textDomain + * @param string $locale + * @return string + */ + public function translatePlural($singular, $plural, $number, $textDomain = 'default', $locale = null) + { + return $this->translator->translatePlural($singular, $plural, $number, $textDomain, $locale); + } +} diff --git a/vendor/laminas/laminas-validator/src/Translator/TranslatorAwareInterface.php b/vendor/laminas/laminas-validator/src/Translator/TranslatorAwareInterface.php new file mode 100644 index 00000000..0d3f8961 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Translator/TranslatorAwareInterface.php @@ -0,0 +1,74 @@ +has(TranslatorInterface::class)) { + return new Translator($container->get(TranslatorInterface::class)); + } + + return $this->marshalTranslator($container); + } + + /** + * Marshal an Translator. + * + * If configuration exists, will pass it to the I18nTranslator::factory, + * decorating the returned instance in an MvcTranslator. + * + * Otherwise: + * + * - returns an Translator decorating a DummyTranslator instance if + * ext/intl is not loaded. + * - returns an Translator decorating an empty I18nTranslator instance. + */ + private function marshalTranslator(ContainerInterface $container): Translator + { + // Load a translator from configuration, if possible + $translator = $this->marshalTranslatorFromConfig($container); + + if ($translator instanceof Translator) { + return $translator; + } + + // If ext/intl is not loaded, return a dummy translator + if (! extension_loaded('intl')) { + return new Translator(new DummyTranslator()); + } + + return new Translator(new I18nTranslator()); + } + + /** + * Attempt to marshal a translator from configuration. + * + * Returns: + * - an Translator seeded with a DummyTranslator if "translator" + * configuration is available, and evaluates to boolean false. + * - an Translator seed with an I18nTranslator if "translator" + * configuration is available, and is a non-empty array or a Traversable + * instance. + * - null in all other cases, including absence of a configuration service. + */ + private function marshalTranslatorFromConfig(ContainerInterface $container): ?Translator + { + if (! $container->has('config')) { + return null; + } + + $config = $container->get('config'); + + if (! is_array($config) || ! array_key_exists('translator', $config)) { + return null; + } + + // 'translator' => false + if ($config['translator'] === false) { + return new Translator(new DummyTranslator()); + } + + // Empty translator configuration + if (is_array($config['translator']) && empty($config['translator'])) { + return null; + } + + // Unusable translator configuration + if (! is_array($config['translator']) && ! $config['translator'] instanceof Traversable) { + return null; + } + + // Create translator from configuration + $i18nTranslator = I18nTranslator::factory($config['translator']); + + // Inject plugins, if present + if ($container->has('TranslatorPluginManager')) { + $loaderManager = $container->get('TranslatorPluginManager'); + + assert($loaderManager instanceof LoaderPluginManager); + + $i18nTranslator->setPluginManager($loaderManager); + } + + // Inject into service manager instances + if ($container instanceof ServiceManager) { + $container->setService(TranslatorInterface::class, $i18nTranslator); + } + + return new Translator($i18nTranslator); + } +} diff --git a/vendor/laminas/laminas-validator/src/Translator/TranslatorInterface.php b/vendor/laminas/laminas-validator/src/Translator/TranslatorInterface.php new file mode 100644 index 00000000..77d5f72e --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Translator/TranslatorInterface.php @@ -0,0 +1,18 @@ + */ + protected $messageTemplates = [ + self::PASSWORD_BREACHED => 'The provided password was found in previous breaches, please create another password', + self::NOT_A_STRING => 'The provided password is not a string, please provide a correct password', + ]; + + // phpcs:enable + public function __construct(private ClientInterface $httpClient, private RequestFactoryInterface $makeHttpRequest) + { + parent::__construct(); + } + + // The following rule is buggy for parameters attributes + // phpcs:disable SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing.NoSpaceBetweenTypeHintAndParameter + + /** {@inheritDoc} */ + public function isValid( + #[SensitiveParameter] + $value + ): bool { + if (! is_string($value)) { + $this->error(self::NOT_A_STRING); + return false; + } + + if ($this->isPwnedPassword($value)) { + $this->error(self::PASSWORD_BREACHED); + return false; + } + + return true; + } + + // phpcs:enable SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing.NoSpaceBetweenTypeHintAndParameter + + private function isPwnedPassword( + #[SensitiveParameter] + string $password + ): bool { + $sha1Hash = $this->hashPassword($password); + $rangeHash = $this->getRangeHash($sha1Hash); + $hashList = $this->retrieveHashList($rangeHash); + + return $this->hashInResponse($sha1Hash, $hashList); + } + + /** + * We use a SHA1 hashed password for checking it against + * the breached data set of HIBP. + */ + private function hashPassword( + #[SensitiveParameter] + string $password + ): string { + $hashedPassword = sha1($password); + + return strtoupper($hashedPassword); + } + + /** + * Creates a hash range that will be send to HIBP API + * applying K-Anonymity + * + * @see https://www.troyhunt.com/enhancing-pwned-passwords-privacy-by-exclusively-supporting-anonymity/ + */ + private function getRangeHash( + #[SensitiveParameter] + string $passwordHash + ): string { + return substr($passwordHash, self::HIBP_K_ANONYMITY_HASH_RANGE_BASE, self::HIBP_K_ANONYMITY_HASH_RANGE_LENGTH); + } + + /** + * Making a connection to the HIBP API to retrieve a + * list of hashes that all have the same range as we + * provided. + * + * @throws ClientExceptionInterface + */ + private function retrieveHashList( + #[SensitiveParameter] + string $passwordRange + ): string { + $request = $this->makeHttpRequest->createRequest( + 'GET', + self::HIBP_API_URI . '/range/' . $passwordRange + ); + + $response = $this->httpClient->sendRequest($request); + return (string) $response->getBody(); + } + + /** + * Checks if the password is in the response from HIBP + */ + private function hashInResponse( + #[SensitiveParameter] + string $sha1Hash, + #[SensitiveParameter] + string $resultStream + ): bool { + $data = explode("\r\n", $resultStream); + $hashes = array_filter($data, static function ($value) use ($sha1Hash): bool { + [$hash] = explode(':', $value); + + return strcmp($hash, substr($sha1Hash, self::HIBP_K_ANONYMITY_HASH_RANGE_LENGTH)) === 0; + }); + + return $hashes !== []; + } +} diff --git a/vendor/laminas/laminas-validator/src/Uri.php b/vendor/laminas/laminas-validator/src/Uri.php new file mode 100644 index 00000000..6520f2cc --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Uri.php @@ -0,0 +1,189 @@ + */ + protected $messageTemplates = [ + self::INVALID => 'Invalid type given. String expected', + self::NOT_URI => 'The input does not appear to be a valid Uri', + ]; + + /** @var UriHandler|null|class-string */ + protected $uriHandler; + + /** @var bool */ + protected $allowRelative = true; + + /** @var bool */ + protected $allowAbsolute = true; + + /** + * Sets default option values for this instance + * + * @param array|Traversable $options + */ + public function __construct($options = []) + { + if ($options instanceof Traversable) { + $options = iterator_to_array($options); + } elseif (! is_array($options)) { + $options = func_get_args(); + $temp['uriHandler'] = array_shift($options); + if (! empty($options)) { + $temp['allowRelative'] = array_shift($options); + } + if (! empty($options)) { + $temp['allowAbsolute'] = array_shift($options); + } + + $options = $temp; + } + + if (isset($options['uriHandler'])) { + $this->setUriHandler($options['uriHandler']); + } + if (isset($options['allowRelative'])) { + $this->setAllowRelative($options['allowRelative']); + } + if (isset($options['allowAbsolute'])) { + $this->setAllowAbsolute($options['allowAbsolute']); + } + + parent::__construct($options); + } + + /** + * @throws InvalidArgumentException + * @return UriHandler + */ + public function getUriHandler() + { + if (null === $this->uriHandler) { + // Lazy load the base Uri handler + $this->uriHandler = new UriHandler(); + } elseif (is_string($this->uriHandler) && class_exists($this->uriHandler)) { + // Instantiate string Uri handler that references a class + $this->uriHandler = new $this->uriHandler(); + } + assert($this->uriHandler !== null && ! is_string($this->uriHandler)); + + return $this->uriHandler; + } + + /** + * @param UriHandler|class-string $uriHandler + * @throws InvalidArgumentException + * @return $this + */ + public function setUriHandler($uriHandler) + { + if (! is_a($uriHandler, UriHandler::class, true)) { + throw new InvalidArgumentException(sprintf( + 'Expecting a subclass name or instance of %s as $uriHandler', + UriHandler::class + )); + } + + $this->uriHandler = $uriHandler; + return $this; + } + + /** + * Returns the allowAbsolute option + * + * @return bool + */ + public function getAllowAbsolute() + { + return $this->allowAbsolute; + } + + /** + * Sets the allowAbsolute option + * + * @param bool $allowAbsolute + * @return $this + */ + public function setAllowAbsolute($allowAbsolute) + { + $this->allowAbsolute = (bool) $allowAbsolute; + return $this; + } + + /** + * Returns the allowRelative option + * + * @return bool + */ + public function getAllowRelative() + { + return $this->allowRelative; + } + + /** + * Sets the allowRelative option + * + * @param bool $allowRelative + * @return $this + */ + public function setAllowRelative($allowRelative) + { + $this->allowRelative = (bool) $allowRelative; + return $this; + } + + /** + * Returns true if and only if $value validates as a Uri + * + * @param string $value + * @return bool + */ + public function isValid($value) + { + if (! is_string($value)) { + $this->error(self::INVALID); + return false; + } + + $uriHandler = $this->getUriHandler(); + try { + $uriHandler->parse($value); + if ($uriHandler->isValid()) { + // It will either be a valid absolute or relative URI + if ( + ($this->allowRelative && $this->allowAbsolute) + || ($this->allowAbsolute && $uriHandler->isAbsolute()) + || ($this->allowRelative && $uriHandler->isValidRelative()) + ) { + return true; + } + } + } catch (UriException) { + // Error parsing URI, it must be invalid + } + + $this->error(self::NOT_URI); + return false; + } +} diff --git a/vendor/laminas/laminas-validator/src/Uuid.php b/vendor/laminas/laminas-validator/src/Uuid.php new file mode 100644 index 00000000..77ecdd8b --- /dev/null +++ b/vendor/laminas/laminas-validator/src/Uuid.php @@ -0,0 +1,58 @@ + 'Invalid type given; string expected', + self::INVALID => 'Invalid UUID format', + ]; + + /** + * Returns true if and only if $value meets the validation requirements. + * + * If $value fails validation, then this method returns false, and + * getMessages() will return an array of messages that explain why the + * validation failed. + * + * @param mixed $value + * @return bool + * @throws Exception\RuntimeException If validation of $value is impossible. + */ + public function isValid($value) + { + if (! is_string($value)) { + $this->error(self::NOT_STRING); + return false; + } + + $this->setValue($value); + + if ( + empty($value) + || $value !== '00000000-0000-0000-0000-000000000000' + && ! preg_match(self::REGEX_UUID, $value) + ) { + $this->error(self::INVALID); + return false; + } + + return true; + } +} diff --git a/vendor/laminas/laminas-validator/src/ValidatorChain.php b/vendor/laminas/laminas-validator/src/ValidatorChain.php new file mode 100644 index 00000000..e77c19f1 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/ValidatorChain.php @@ -0,0 +1,340 @@ + + * @final + */ +class ValidatorChain implements Countable, IteratorAggregate, ValidatorInterface +{ + /** + * Default priority at which validators are added + */ + public const DEFAULT_PRIORITY = 1; + + /** @var ValidatorPluginManager|null */ + protected $plugins; + + /** + * Validator chain + * + * @var PriorityQueue + */ + protected $validators; + + /** + * Array of validation failure messages + * + * @var array + */ + protected $messages = []; + + /** + * Initialize validator chain + */ + public function __construct() + { + $this->validators = new PriorityQueue(); + } + + /** + * Return the count of attached validators + * + * @return int + */ + #[ReturnTypeWillChange] + public function count() + { + return count($this->validators); + } + + /** + * Get plugin manager instance + * + * @return ValidatorPluginManager + */ + public function getPluginManager() + { + if (! $this->plugins) { + $this->setPluginManager(new ValidatorPluginManager(new ServiceManager())); + } + return $this->plugins; + } + + /** + * Set plugin manager instance + * + * @param ValidatorPluginManager $plugins Plugin manager + * @psalm-assert ValidatorPluginManager $this->plugins + * @return $this + */ + public function setPluginManager(ValidatorPluginManager $plugins) + { + $this->plugins = $plugins; + return $this; + } + + /** + * Retrieve a validator by name + * + * @param string|class-string $name Name of validator to return + * @param null|array $options Options to pass to validator constructor + * (if not already instantiated) + * @return ValidatorInterface + * @template T of ValidatorInterface + * @psalm-param string|class-string $name + * @psalm-return ValidatorInterface + */ + public function plugin($name, ?array $options = null) + { + $plugins = $this->getPluginManager(); + return $plugins->get($name, $options); + } + + /** + * Attach a validator to the end of the chain + * If $breakChainOnFailure is true, then if the validator fails, the next validator in the chain, + * if one exists, will not be executed. + * + * @param bool $breakChainOnFailure + * @param int $priority Priority at which to enqueue validator; defaults to + * 1 (higher executes earlier) + * @return $this + * @throws Exception\InvalidArgumentException + */ + public function attach( + ValidatorInterface $validator, + $breakChainOnFailure = false, + $priority = self::DEFAULT_PRIORITY + ) { + /** @psalm-suppress RedundantCastGivenDocblockType */ + $this->validators->insert( + [ + 'instance' => $validator, + 'breakChainOnFailure' => (bool) $breakChainOnFailure, + ], + $priority + ); + + return $this; + } + + /** + * Proxy to attach() to keep BC + * + * @deprecated Please use attach() + * + * @param bool $breakChainOnFailure + * @param int $priority + * @return ValidatorChain Provides a fluent interface + */ + public function addValidator( + ValidatorInterface $validator, + $breakChainOnFailure = false, + $priority = self::DEFAULT_PRIORITY + ) { + return $this->attach($validator, $breakChainOnFailure, $priority); + } + + /** + * Adds a validator to the beginning of the chain + * + * If $breakChainOnFailure is true, then if the validator fails, the next validator in the chain, + * if one exists, will not be executed. + * + * @param bool $breakChainOnFailure + * @return $this Provides a fluent interface + */ + public function prependValidator(ValidatorInterface $validator, $breakChainOnFailure = false) + { + $priority = self::DEFAULT_PRIORITY; + + if (! $this->validators->isEmpty()) { + $extractedNodes = $this->validators->toArray(PriorityQueue::EXTR_PRIORITY); + rsort($extractedNodes, SORT_NUMERIC); + $priority = $extractedNodes[0] + 1; + } + + /** @psalm-suppress RedundantCastGivenDocblockType */ + $this->validators->insert( + [ + 'instance' => $validator, + 'breakChainOnFailure' => (bool) $breakChainOnFailure, + ], + $priority + ); + return $this; + } + + /** + * Use the plugin manager to add a validator by name + * + * @param string|class-string $name + * @param array $options + * @param bool $breakChainOnFailure + * @param int $priority + * @return $this + */ + public function attachByName($name, $options = [], $breakChainOnFailure = false, $priority = self::DEFAULT_PRIORITY) + { + if (isset($options['break_chain_on_failure'])) { + $breakChainOnFailure = (bool) $options['break_chain_on_failure']; + } + + if (isset($options['breakchainonfailure'])) { + $breakChainOnFailure = (bool) $options['breakchainonfailure']; + } + + $this->attach($this->plugin($name, $options), $breakChainOnFailure, $priority); + + return $this; + } + + /** + * Proxy to attachByName() to keep BC + * + * @deprecated Please use attachByName() + * + * @param string $name + * @param array $options + * @param bool $breakChainOnFailure + * @return ValidatorChain + */ + public function addByName($name, $options = [], $breakChainOnFailure = false) + { + return $this->attachByName($name, $options, $breakChainOnFailure); + } + + /** + * Use the plugin manager to prepend a validator by name + * + * @param string|class-string $name + * @param array $options + * @param bool $breakChainOnFailure + * @return $this + */ + public function prependByName($name, $options = [], $breakChainOnFailure = false) + { + $validator = $this->plugin($name, $options); + $this->prependValidator($validator, $breakChainOnFailure); + return $this; + } + + /** + * Returns true if and only if $value passes all validations in the chain + * + * Validators are run in the order in which they were added to the chain (FIFO). + * + * @param mixed $value + * @param mixed $context Extra "context" to provide the validator + * @return bool + */ + public function isValid($value, $context = null) + { + $this->messages = []; + $result = true; + foreach ($this as $element) { + $validator = $element['instance']; + assert($validator instanceof ValidatorInterface); + if ($validator->isValid($value, $context)) { + continue; + } + $result = false; + $messages = $validator->getMessages(); + $this->messages = array_replace($this->messages, $messages); + if ($element['breakChainOnFailure']) { + break; + } + } + return $result; + } + + /** + * Merge the validator chain with the one given in parameter + * + * @return $this + */ + public function merge(ValidatorChain $validatorChain) + { + foreach ($validatorChain->validators->toArray(PriorityQueue::EXTR_BOTH) as $item) { + $this->attach($item['data']['instance'], $item['data']['breakChainOnFailure'], $item['priority']); + } + + return $this; + } + + /** + * Returns array of validation failure messages + * + * @return array + */ + public function getMessages() + { + return $this->messages; + } + + /** + * Get all the validators + * + * @return list + */ + public function getValidators() + { + return $this->validators->toArray(PriorityQueue::EXTR_DATA); + } + + /** + * Invoke chain as command + * + * @return bool + */ + public function __invoke(mixed $value) + { + return $this->isValid($value); + } + + /** + * Deep clone handling + */ + public function __clone() + { + $this->validators = clone $this->validators; + } + + /** + * Prepare validator chain for serialization + * + * Plugin manager (property 'plugins') cannot + * be serialized. On wakeup the property remains unset + * and next invocation to getPluginManager() sets + * the default plugin manager instance (ValidatorPluginManager). + * + * @return array + */ + public function __sleep() + { + return ['validators', 'messages']; + } + + /** @return Traversable */ + public function getIterator(): Traversable + { + return clone $this->validators; + } +} diff --git a/vendor/laminas/laminas-validator/src/ValidatorInterface.php b/vendor/laminas/laminas-validator/src/ValidatorInterface.php new file mode 100644 index 00000000..af83fbd0 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/ValidatorInterface.php @@ -0,0 +1,39 @@ +, + * priority?: int, + * break_chain_on_failure?: bool, + * options?: array, + * } + */ +interface ValidatorInterface +{ + /** + * Returns true if and only if $value meets the validation requirements + * + * If $value fails validation, then this method returns false, and + * getMessages() will return an array of messages that explain why the + * validation failed. + * + * @param mixed $value + * @return bool + * @throws Exception\RuntimeException If validation of $value is impossible. + */ + public function isValid($value); + + /** + * Returns an array of messages that explain why the most recent isValid() + * call returned false. The array keys are validation failure message identifiers, + * and the array values are the corresponding human-readable message strings. + * + * If isValid() was never called or if the most recent isValid() call + * returned true, then this method returns an empty array. + * + * @return array + */ + public function getMessages(); +} diff --git a/vendor/laminas/laminas-validator/src/ValidatorPluginManager.php b/vendor/laminas/laminas-validator/src/ValidatorPluginManager.php new file mode 100644 index 00000000..5a49b470 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/ValidatorPluginManager.php @@ -0,0 +1,634 @@ + + * @final + */ +class ValidatorPluginManager extends AbstractPluginManager +{ + /** + * Default set of aliases + * + * @inheritDoc + */ + protected $aliases = [ + 'alnum' => I18nValidator\Alnum::class, + 'Alnum' => I18nValidator\Alnum::class, + 'alpha' => I18nValidator\Alpha::class, + 'Alpha' => I18nValidator\Alpha::class, + 'barcode' => Barcode::class, + 'Barcode' => Barcode::class, + 'between' => Between::class, + 'Between' => Between::class, + 'BIC' => BusinessIdentifierCode::class, + 'bic' => BusinessIdentifierCode::class, + 'bitwise' => Bitwise::class, + 'Bitwise' => Bitwise::class, + 'BusinessIdentifierCode' => BusinessIdentifierCode::class, + 'businessidentifiercode' => BusinessIdentifierCode::class, + 'callback' => Callback::class, + 'Callback' => Callback::class, + 'creditcard' => CreditCard::class, + 'creditCard' => CreditCard::class, + 'CreditCard' => CreditCard::class, + 'csrf' => Csrf::class, + 'Csrf' => Csrf::class, + 'date' => Date::class, + 'Date' => Date::class, + 'datestep' => DateStep::class, + 'dateStep' => DateStep::class, + 'DateStep' => DateStep::class, + 'datetime' => I18nValidator\DateTime::class, + 'dateTime' => I18nValidator\DateTime::class, + 'DateTime' => I18nValidator\DateTime::class, + 'dbnorecordexists' => Db\NoRecordExists::class, + 'dbNoRecordExists' => Db\NoRecordExists::class, + 'DbNoRecordExists' => Db\NoRecordExists::class, + 'dbrecordexists' => Db\RecordExists::class, + 'dbRecordExists' => Db\RecordExists::class, + 'DbRecordExists' => Db\RecordExists::class, + 'digits' => Digits::class, + 'Digits' => Digits::class, + 'emailaddress' => EmailAddress::class, + 'emailAddress' => EmailAddress::class, + 'EmailAddress' => EmailAddress::class, + 'explode' => Explode::class, + 'Explode' => Explode::class, + 'filecount' => File\Count::class, + 'fileCount' => File\Count::class, + 'FileCount' => File\Count::class, + 'filecrc32' => File\Crc32::class, + 'fileCrc32' => File\Crc32::class, + 'FileCrc32' => File\Crc32::class, + 'fileexcludeextension' => File\ExcludeExtension::class, + 'fileExcludeExtension' => File\ExcludeExtension::class, + 'FileExcludeExtension' => File\ExcludeExtension::class, + 'fileexcludemimetype' => File\ExcludeMimeType::class, + 'fileExcludeMimeType' => File\ExcludeMimeType::class, + 'FileExcludeMimeType' => File\ExcludeMimeType::class, + 'fileexists' => File\Exists::class, + 'fileExists' => File\Exists::class, + 'FileExists' => File\Exists::class, + 'fileextension' => File\Extension::class, + 'fileExtension' => File\Extension::class, + 'FileExtension' => File\Extension::class, + 'filefilessize' => File\FilesSize::class, + 'fileFilesSize' => File\FilesSize::class, + 'FileFilesSize' => File\FilesSize::class, + 'filehash' => File\Hash::class, + 'fileHash' => File\Hash::class, + 'FileHash' => File\Hash::class, + 'fileimagesize' => File\ImageSize::class, + 'fileImageSize' => File\ImageSize::class, + 'FileImageSize' => File\ImageSize::class, + 'fileiscompressed' => File\IsCompressed::class, + 'fileIsCompressed' => File\IsCompressed::class, + 'FileIsCompressed' => File\IsCompressed::class, + 'fileisimage' => File\IsImage::class, + 'fileIsImage' => File\IsImage::class, + 'FileIsImage' => File\IsImage::class, + 'filemd5' => File\Md5::class, + 'fileMd5' => File\Md5::class, + 'FileMd5' => File\Md5::class, + 'filemimetype' => File\MimeType::class, + 'fileMimeType' => File\MimeType::class, + 'FileMimeType' => File\MimeType::class, + 'filenotexists' => File\NotExists::class, + 'fileNotExists' => File\NotExists::class, + 'FileNotExists' => File\NotExists::class, + 'filesha1' => File\Sha1::class, + 'fileSha1' => File\Sha1::class, + 'FileSha1' => File\Sha1::class, + 'filesize' => File\Size::class, + 'fileSize' => File\Size::class, + 'FileSize' => File\Size::class, + 'fileupload' => File\Upload::class, + 'fileUpload' => File\Upload::class, + 'FileUpload' => File\Upload::class, + 'fileuploadfile' => File\UploadFile::class, + 'fileUploadFile' => File\UploadFile::class, + 'FileUploadFile' => File\UploadFile::class, + 'filewordcount' => File\WordCount::class, + 'fileWordCount' => File\WordCount::class, + 'FileWordCount' => File\WordCount::class, + 'float' => I18nValidator\IsFloat::class, + 'Float' => I18nValidator\IsFloat::class, + 'gpspoint' => GpsPoint::class, + 'gpsPoint' => GpsPoint::class, + 'GpsPoint' => GpsPoint::class, + 'greaterthan' => GreaterThan::class, + 'greaterThan' => GreaterThan::class, + 'GreaterThan' => GreaterThan::class, + 'hex' => Hex::class, + 'Hex' => Hex::class, + 'hostname' => Hostname::class, + 'Hostname' => Hostname::class, + 'iban' => Iban::class, + 'Iban' => Iban::class, + 'identical' => Identical::class, + 'Identical' => Identical::class, + 'inarray' => InArray::class, + 'inArray' => InArray::class, + 'InArray' => InArray::class, + 'int' => I18nValidator\IsInt::class, + 'Int' => I18nValidator\IsInt::class, + 'ip' => Ip::class, + 'Ip' => Ip::class, + 'IsArray' => IsArray::class, + 'isbn' => Isbn::class, + 'Isbn' => Isbn::class, + 'isCountable' => IsCountable::class, + 'IsCountable' => IsCountable::class, + 'iscountable' => IsCountable::class, + 'isfloat' => I18nValidator\IsFloat::class, + 'isFloat' => I18nValidator\IsFloat::class, + 'IsFloat' => I18nValidator\IsFloat::class, + 'isinstanceof' => IsInstanceOf::class, + 'isInstanceOf' => IsInstanceOf::class, + 'IsInstanceOf' => IsInstanceOf::class, + 'isint' => I18nValidator\IsInt::class, + 'isInt' => I18nValidator\IsInt::class, + 'IsInt' => I18nValidator\IsInt::class, + 'lessthan' => LessThan::class, + 'lessThan' => LessThan::class, + 'LessThan' => LessThan::class, + 'notempty' => NotEmpty::class, + 'notEmpty' => NotEmpty::class, + 'NotEmpty' => NotEmpty::class, + 'phonenumber' => I18nValidator\PhoneNumber::class, + 'phoneNumber' => I18nValidator\PhoneNumber::class, + 'PhoneNumber' => I18nValidator\PhoneNumber::class, + 'postcode' => I18nValidator\PostCode::class, + 'postCode' => I18nValidator\PostCode::class, + 'PostCode' => I18nValidator\PostCode::class, + 'regex' => Regex::class, + 'Regex' => Regex::class, + 'sitemapchangefreq' => Sitemap\Changefreq::class, + 'sitemapChangefreq' => Sitemap\Changefreq::class, + 'SitemapChangefreq' => Sitemap\Changefreq::class, + 'sitemaplastmod' => Sitemap\Lastmod::class, + 'sitemapLastmod' => Sitemap\Lastmod::class, + 'SitemapLastmod' => Sitemap\Lastmod::class, + 'sitemaploc' => Sitemap\Loc::class, + 'sitemapLoc' => Sitemap\Loc::class, + 'SitemapLoc' => Sitemap\Loc::class, + 'sitemappriority' => Sitemap\Priority::class, + 'sitemapPriority' => Sitemap\Priority::class, + 'SitemapPriority' => Sitemap\Priority::class, + 'stringlength' => StringLength::class, + 'stringLength' => StringLength::class, + 'StringLength' => StringLength::class, + 'step' => Step::class, + 'Step' => Step::class, + 'timezone' => Timezone::class, + 'Timezone' => Timezone::class, + 'uri' => Uri::class, + 'Uri' => Uri::class, + 'uuid' => Uuid::class, + 'Uuid' => Uuid::class, + + // Legacy Zend Framework aliases + 'Zend\I18nValidator\Alnum' => I18nValidator\Alnum::class, + 'Zend\I18n\Validator\Alpha' => I18nValidator\Alpha::class, + 'Zend\Validator\Barcode' => Barcode::class, + 'Zend\Validator\Between' => Between::class, + 'Zend\Validator\Bitwise' => Bitwise::class, + 'Zend\Validator\Callback' => Callback::class, + 'Zend\Validator\CreditCard' => CreditCard::class, + 'Zend\Validator\Csrf' => Csrf::class, + 'Zend\Validator\DateStep' => DateStep::class, + 'Zend\Validator\Date' => Date::class, + 'Zend\I18n\Validator\DateTime' => I18nValidator\DateTime::class, + 'Zend\Validator\Db\NoRecordExists' => Db\NoRecordExists::class, + 'Zend\Validator\Db\RecordExists' => Db\RecordExists::class, + 'Zend\Validator\Digits' => Digits::class, + 'Zend\Validator\EmailAddress' => EmailAddress::class, + 'Zend\Validator\Explode' => Explode::class, + 'Zend\Validator\File\Count' => File\Count::class, + 'Zend\Validator\File\Crc32' => File\Crc32::class, + 'Zend\Validator\File\ExcludeExtension' => File\ExcludeExtension::class, + 'Zend\Validator\File\ExcludeMimeType' => File\ExcludeMimeType::class, + 'Zend\Validator\File\Exists' => File\Exists::class, + 'Zend\Validator\File\Extension' => File\Extension::class, + 'Zend\Validator\File\FilesSize' => File\FilesSize::class, + 'Zend\Validator\File\Hash' => File\Hash::class, + 'Zend\Validator\File\ImageSize' => File\ImageSize::class, + 'Zend\Validator\File\IsCompressed' => File\IsCompressed::class, + 'Zend\Validator\File\IsImage' => File\IsImage::class, + 'Zend\Validator\File\Md5' => File\Md5::class, + 'Zend\Validator\File\MimeType' => File\MimeType::class, + 'Zend\Validator\File\NotExists' => File\NotExists::class, + 'Zend\Validator\File\Sha1' => File\Sha1::class, + 'Zend\Validator\File\Size' => File\Size::class, + 'Zend\Validator\File\Upload' => File\Upload::class, + 'Zend\Validator\File\UploadFile' => File\UploadFile::class, + 'Zend\Validator\File\WordCount' => File\WordCount::class, + 'Zend\I18n\Validator\IsFloatIsFloat' => I18nValidator\IsFloat::class, + 'Zend\Validator\GpsPoint' => GpsPoint::class, + 'Zend\Validator\GreaterThan' => GreaterThan::class, + 'Zend\Validator\Hex' => Hex::class, + 'Zend\Validator\Hostname' => Hostname::class, + 'Zend\Validator\Iban' => Iban::class, + 'Zend\Validator\Identical' => Identical::class, + 'Zend\Validator\InArray' => InArray::class, + 'Zend\I18n\Validator\IsInt' => I18nValidator\IsInt::class, + 'Zend\Validator\Ip' => Ip::class, + 'Zend\Validator\Isbn' => Isbn::class, + 'Zend\Validator\IsInstanceOf' => IsInstanceOf::class, + 'Zend\Validator\LessThan' => LessThan::class, + 'Zend\Validator\NotEmpty' => NotEmpty::class, + 'Zend\I18n\Validator\PhoneNumber' => I18nValidator\PhoneNumber::class, + 'Zend\I18n\Validator\PostCode' => I18nValidator\PostCode::class, + 'Zend\Validator\Regex' => Regex::class, + 'Zend\Validator\Sitemap\Changefreq' => Sitemap\Changefreq::class, + 'Zend\Validator\Sitemap\Lastmod' => Sitemap\Lastmod::class, + 'Zend\Validator\Sitemap\Loc' => Sitemap\Loc::class, + 'Zend\Validator\Sitemap\Priority' => Sitemap\Priority::class, + 'Zend\Validator\StringLength' => StringLength::class, + 'Zend\Validator\Step' => Step::class, + 'Zend\Validator\Timezone' => Timezone::class, + 'Zend\Validator\Uri' => Uri::class, + 'Zend\Validator\Uuid' => Uuid::class, + + // v2 normalized FQCNs + 'zendvalidatorbarcode' => Barcode::class, + 'zendvalidatorbetween' => Between::class, + 'zendvalidatorbitwise' => Bitwise::class, + 'zendvalidatorcallback' => Callback::class, + 'zendvalidatorcreditcard' => CreditCard::class, + 'zendvalidatorcsrf' => Csrf::class, + 'zendvalidatordatestep' => DateStep::class, + 'zendvalidatordate' => Date::class, + 'zendvalidatordbnorecordexists' => Db\NoRecordExists::class, + 'zendvalidatordbrecordexists' => Db\RecordExists::class, + 'zendvalidatordigits' => Digits::class, + 'zendvalidatoremailaddress' => EmailAddress::class, + 'zendvalidatorexplode' => Explode::class, + 'zendvalidatorfilecount' => File\Count::class, + 'zendvalidatorfilecrc32' => File\Crc32::class, + 'zendvalidatorfileexcludeextension' => File\ExcludeExtension::class, + 'zendvalidatorfileexcludemimetype' => File\ExcludeMimeType::class, + 'zendvalidatorfileexists' => File\Exists::class, + 'zendvalidatorfileextension' => File\Extension::class, + 'zendvalidatorfilefilessize' => File\FilesSize::class, + 'zendvalidatorfilehash' => File\Hash::class, + 'zendvalidatorfileimagesize' => File\ImageSize::class, + 'zendvalidatorfileiscompressed' => File\IsCompressed::class, + 'zendvalidatorfileisimage' => File\IsImage::class, + 'zendvalidatorfilemd5' => File\Md5::class, + 'zendvalidatorfilemimetype' => File\MimeType::class, + 'zendvalidatorfilenotexists' => File\NotExists::class, + 'zendvalidatorfilesha1' => File\Sha1::class, + 'zendvalidatorfilesize' => File\Size::class, + 'zendvalidatorfileupload' => File\Upload::class, + 'zendvalidatorfileuploadfile' => File\UploadFile::class, + 'zendvalidatorfilewordcount' => File\WordCount::class, + 'zendvalidatorgpspoint' => GpsPoint::class, + 'zendvalidatorgreaterthan' => GreaterThan::class, + 'zendvalidatorhex' => Hex::class, + 'zendvalidatorhostname' => Hostname::class, + 'zendi18nvalidatoralnum' => I18nValidator\Alnum::class, + 'zendi18nvalidatoralpha' => I18nValidator\Alpha::class, + 'zendi18nvalidatordatetime' => I18nValidator\DateTime::class, + 'zendi18nvalidatorisfloat' => I18nValidator\IsFloat::class, + 'zendi18nvalidatorisint' => I18nValidator\IsInt::class, + 'zendi18nvalidatorphonenumber' => I18nValidator\PhoneNumber::class, + 'zendi18nvalidatorpostcode' => I18nValidator\PostCode::class, + 'zendvalidatoriban' => Iban::class, + 'zendvalidatoridentical' => Identical::class, + 'zendvalidatorinarray' => InArray::class, + 'zendvalidatorip' => Ip::class, + 'zendvalidatorisbn' => Isbn::class, + 'zendvalidatorisinstanceof' => IsInstanceOf::class, + 'zendvalidatorlessthan' => LessThan::class, + 'zendvalidatornotempty' => NotEmpty::class, + 'zendvalidatorregex' => Regex::class, + 'zendvalidatorsitemapchangefreq' => Sitemap\Changefreq::class, + 'zendvalidatorsitemaplastmod' => Sitemap\Lastmod::class, + 'zendvalidatorsitemaploc' => Sitemap\Loc::class, + 'zendvalidatorsitemappriority' => Sitemap\Priority::class, + 'zendvalidatorstringlength' => StringLength::class, + 'zendvalidatorstep' => Step::class, + 'zendvalidatortimezone' => Timezone::class, + 'zendvalidatoruri' => Uri::class, + 'zendvalidatoruuid' => Uuid::class, + ]; + + /** + * Default set of factories + * + * @inheritDoc + */ + protected $factories = [ + I18nValidator\Alnum::class => InvokableFactory::class, + I18nValidator\Alpha::class => InvokableFactory::class, + Barcode::class => InvokableFactory::class, + Between::class => InvokableFactory::class, + Bitwise::class => InvokableFactory::class, + BusinessIdentifierCode::class => InvokableFactory::class, + Callback::class => InvokableFactory::class, + CreditCard::class => InvokableFactory::class, + Csrf::class => InvokableFactory::class, + DateStep::class => InvokableFactory::class, + Date::class => InvokableFactory::class, + DateComparison::class => InvokableFactory::class, + I18nValidator\DateTime::class => InvokableFactory::class, + Db\NoRecordExists::class => InvokableFactory::class, + Db\RecordExists::class => InvokableFactory::class, + Digits::class => InvokableFactory::class, + EmailAddress::class => InvokableFactory::class, + Explode::class => InvokableFactory::class, + File\Count::class => InvokableFactory::class, + File\Crc32::class => InvokableFactory::class, + File\ExcludeExtension::class => InvokableFactory::class, + File\ExcludeMimeType::class => InvokableFactory::class, + File\Exists::class => InvokableFactory::class, + File\Extension::class => InvokableFactory::class, + File\FilesSize::class => InvokableFactory::class, + File\Hash::class => InvokableFactory::class, + File\ImageSize::class => InvokableFactory::class, + File\IsCompressed::class => InvokableFactory::class, + File\IsImage::class => InvokableFactory::class, + File\Md5::class => InvokableFactory::class, + File\MimeType::class => InvokableFactory::class, + File\NotExists::class => InvokableFactory::class, + File\Sha1::class => InvokableFactory::class, + File\Size::class => InvokableFactory::class, + File\Upload::class => InvokableFactory::class, + File\UploadFile::class => InvokableFactory::class, + File\WordCount::class => InvokableFactory::class, + I18nValidator\IsFloat::class => InvokableFactory::class, + GpsPoint::class => InvokableFactory::class, + GreaterThan::class => InvokableFactory::class, + Hex::class => InvokableFactory::class, + Hostname::class => InvokableFactory::class, + HostWithPublicIPv4Address::class => InvokableFactory::class, + Iban::class => InvokableFactory::class, + Identical::class => InvokableFactory::class, + InArray::class => InvokableFactory::class, + I18nValidator\IsInt::class => InvokableFactory::class, + Ip::class => InvokableFactory::class, + IsArray::class => InvokableFactory::class, + Isbn::class => InvokableFactory::class, + IsCountable::class => InvokableFactory::class, + IsInstanceOf::class => InvokableFactory::class, + IsJsonString::class => InvokableFactory::class, + LessThan::class => InvokableFactory::class, + NotEmpty::class => InvokableFactory::class, + NumberComparison::class => InvokableFactory::class, + I18nValidator\PhoneNumber::class => InvokableFactory::class, + I18nValidator\PostCode::class => InvokableFactory::class, + Regex::class => InvokableFactory::class, + Sitemap\Changefreq::class => InvokableFactory::class, + Sitemap\Lastmod::class => InvokableFactory::class, + Sitemap\Loc::class => InvokableFactory::class, + Sitemap\Priority::class => InvokableFactory::class, + StringLength::class => InvokableFactory::class, + Step::class => InvokableFactory::class, + Timezone::class => InvokableFactory::class, + Uri::class => InvokableFactory::class, + Uuid::class => InvokableFactory::class, + + // v2 canonical FQCNs + 'laminasvalidatorbarcodecode25interleaved' => InvokableFactory::class, + 'laminasvalidatorbarcodecode25' => InvokableFactory::class, + 'laminasvalidatorbarcodecode39ext' => InvokableFactory::class, + 'laminasvalidatorbarcodecode39' => InvokableFactory::class, + 'laminasvalidatorbarcodecode93ext' => InvokableFactory::class, + 'laminasvalidatorbarcodecode93' => InvokableFactory::class, + 'laminasvalidatorbarcodeean12' => InvokableFactory::class, + 'laminasvalidatorbarcodeean13' => InvokableFactory::class, + 'laminasvalidatorbarcodeean14' => InvokableFactory::class, + 'laminasvalidatorbarcodeean18' => InvokableFactory::class, + 'laminasvalidatorbarcodeean2' => InvokableFactory::class, + 'laminasvalidatorbarcodeean5' => InvokableFactory::class, + 'laminasvalidatorbarcodeean8' => InvokableFactory::class, + 'laminasvalidatorbarcodegtin12' => InvokableFactory::class, + 'laminasvalidatorbarcodegtin13' => InvokableFactory::class, + 'laminasvalidatorbarcodegtin14' => InvokableFactory::class, + 'laminasvalidatorbarcodeidentcode' => InvokableFactory::class, + 'laminasvalidatorbarcodeintelligentmail' => InvokableFactory::class, + 'laminasvalidatorbarcodeissn' => InvokableFactory::class, + 'laminasvalidatorbarcodeitf14' => InvokableFactory::class, + 'laminasvalidatorbarcodeleitcode' => InvokableFactory::class, + 'laminasvalidatorbarcodeplanet' => InvokableFactory::class, + 'laminasvalidatorbarcodepostnet' => InvokableFactory::class, + 'laminasvalidatorbarcoderoyalmail' => InvokableFactory::class, + 'laminasvalidatorbarcodesscc' => InvokableFactory::class, + 'laminasvalidatorbarcodeupca' => InvokableFactory::class, + 'laminasvalidatorbarcodeupce' => InvokableFactory::class, + 'laminasvalidatorbarcode' => InvokableFactory::class, + 'laminasvalidatorbetween' => InvokableFactory::class, + 'laminasvalidatorbitwise' => InvokableFactory::class, + 'laminasvalidatorcallback' => InvokableFactory::class, + 'laminasvalidatorcreditcard' => InvokableFactory::class, + 'laminasvalidatorcsrf' => InvokableFactory::class, + 'laminasvalidatordatestep' => InvokableFactory::class, + 'laminasvalidatordate' => InvokableFactory::class, + 'laminasvalidatordbnorecordexists' => InvokableFactory::class, + 'laminasvalidatordbrecordexists' => InvokableFactory::class, + 'laminasvalidatordigits' => InvokableFactory::class, + 'laminasvalidatoremailaddress' => InvokableFactory::class, + 'laminasvalidatorexplode' => InvokableFactory::class, + 'laminasvalidatorfilecount' => InvokableFactory::class, + 'laminasvalidatorfilecrc32' => InvokableFactory::class, + 'laminasvalidatorfileexcludeextension' => InvokableFactory::class, + 'laminasvalidatorfileexcludemimetype' => InvokableFactory::class, + 'laminasvalidatorfileexists' => InvokableFactory::class, + 'laminasvalidatorfileextension' => InvokableFactory::class, + 'laminasvalidatorfilefilessize' => InvokableFactory::class, + 'laminasvalidatorfilehash' => InvokableFactory::class, + 'laminasvalidatorfileimagesize' => InvokableFactory::class, + 'laminasvalidatorfileiscompressed' => InvokableFactory::class, + 'laminasvalidatorfileisimage' => InvokableFactory::class, + 'laminasvalidatorfilemd5' => InvokableFactory::class, + 'laminasvalidatorfilemimetype' => InvokableFactory::class, + 'laminasvalidatorfilenotexists' => InvokableFactory::class, + 'laminasvalidatorfilesha1' => InvokableFactory::class, + 'laminasvalidatorfilesize' => InvokableFactory::class, + 'laminasvalidatorfileupload' => InvokableFactory::class, + 'laminasvalidatorfileuploadfile' => InvokableFactory::class, + 'laminasvalidatorfilewordcount' => InvokableFactory::class, + 'laminasvalidatorgpspoint' => InvokableFactory::class, + 'laminasvalidatorgreaterthan' => InvokableFactory::class, + 'laminasvalidatorhex' => InvokableFactory::class, + 'laminasvalidatorhostname' => InvokableFactory::class, + 'laminasi18nvalidatoralnum' => InvokableFactory::class, + 'laminasi18nvalidatoralpha' => InvokableFactory::class, + 'laminasi18nvalidatordatetime' => InvokableFactory::class, + 'laminasi18nvalidatorisfloat' => InvokableFactory::class, + 'laminasi18nvalidatorisint' => InvokableFactory::class, + 'laminasi18nvalidatorphonenumber' => InvokableFactory::class, + 'laminasi18nvalidatorpostcode' => InvokableFactory::class, + 'laminasvalidatoriban' => InvokableFactory::class, + 'laminasvalidatoridentical' => InvokableFactory::class, + 'laminasvalidatorinarray' => InvokableFactory::class, + 'laminasvalidatorip' => InvokableFactory::class, + 'laminasvalidatorisbn' => InvokableFactory::class, + 'laminasvalidatoriscountable' => InvokableFactory::class, + 'laminasvalidatorisinstanceof' => InvokableFactory::class, + 'laminasvalidatorlessthan' => InvokableFactory::class, + 'laminasvalidatornotempty' => InvokableFactory::class, + 'laminasvalidatorregex' => InvokableFactory::class, + 'laminasvalidatorsitemapchangefreq' => InvokableFactory::class, + 'laminasvalidatorsitemaplastmod' => InvokableFactory::class, + 'laminasvalidatorsitemaploc' => InvokableFactory::class, + 'laminasvalidatorsitemappriority' => InvokableFactory::class, + 'laminasvalidatorstringlength' => InvokableFactory::class, + 'laminasvalidatorstep' => InvokableFactory::class, + 'laminasvalidatortimezone' => InvokableFactory::class, + 'laminasvalidatoruri' => InvokableFactory::class, + 'laminasvalidatoruuid' => InvokableFactory::class, + ]; + + /** + * Whether or not to share by default; default to false (v2) + * + * @var bool + */ + protected $shareByDefault = false; + + /** + * Whether or not to share by default; default to false (v3) + * + * @var bool + */ + protected $sharedByDefault = false; + + /** + * Default instance type + * + * @inheritDoc + */ + protected $instanceOf = ValidatorInterface::class; + + /** + * Constructor + * + * After invoking parent constructor, add an initializer to inject the + * attached translator, if any, to the currently requested helper. + * + * {@inheritDoc} + * + * @param ServiceManagerConfiguration $v3config + */ + public function __construct($configOrContainerInstance = null, array $v3config = []) + { + parent::__construct($configOrContainerInstance, $v3config); + + $this->addInitializer([$this, 'injectTranslator']); + $this->addInitializer([$this, 'injectValidatorPluginManager']); + } + + /** + * @param mixed $instance + * @psalm-assert ValidatorInterface $instance + */ + public function validate($instance) + { + if (! $instance instanceof $this->instanceOf) { + throw new InvalidServiceException(sprintf( + '%s expects only to create instances of %s; %s is invalid', + static::class, + (string) $this->instanceOf, + get_debug_type($instance) + )); + } + } + + /** + * For v2 compatibility: validate plugin instance. + * + * Proxies to `validate()`. + * + * @return void + * @throws Exception\RuntimeException + */ + public function validatePlugin(mixed $plugin) + { + try { + $this->validate($plugin); + } catch (InvalidServiceException $e) { + throw new Exception\RuntimeException(sprintf( + 'Plugin of type %s is invalid; must implement %s', + get_debug_type($plugin), + ValidatorInterface::class + ), $e->getCode(), $e); + } + } + + /** + * Inject a validator instance with the registered translator + * + * @param ContainerInterface|object $first + * @param ContainerInterface|object $second + * @return void + */ + public function injectTranslator($first, $second) + { + if ($first instanceof ContainerInterface) { + $container = $first; + $validator = $second; + } else { + $container = $second; + $validator = $first; + } + + if (! $validator instanceof Translator\TranslatorAwareInterface) { + return; + } + + // V2 means we pull it from the parent container + if ($container === $this && method_exists($container, 'getServiceLocator') && $container->getServiceLocator()) { + $container = $container->getServiceLocator(); + } + + if (! $container instanceof ContainerInterface) { + return; + } + + if ($container->has('MvcTranslator')) { + $validator->setTranslator($container->get('MvcTranslator')); + + return; + } + + if ($container->has(TranslatorInterface::class)) { + $validator->setTranslator($container->get(Translator\TranslatorInterface::class)); + } + } + + /** + * Inject a validator plugin manager + * + * @param ContainerInterface|object $first + * @param ContainerInterface|object $second + * @return void + */ + public function injectValidatorPluginManager($first, $second) + { + if ($first instanceof ContainerInterface) { + $validator = $second; + } else { + $validator = $first; + } + if ($validator instanceof ValidatorPluginManagerAwareInterface) { + $validator->setValidatorPluginManager($this); + } + } +} diff --git a/vendor/laminas/laminas-validator/src/ValidatorPluginManagerAwareInterface.php b/vendor/laminas/laminas-validator/src/ValidatorPluginManagerAwareInterface.php new file mode 100644 index 00000000..d30cc7e7 --- /dev/null +++ b/vendor/laminas/laminas-validator/src/ValidatorPluginManagerAwareInterface.php @@ -0,0 +1,18 @@ +has('ServiceListener')) { + return $pluginManager; + } + + // If we do not have a config service, nothing more to do + if (! $container->has('config')) { + return $pluginManager; + } + + $config = $container->get('config'); + + // If we do not have validators configuration, nothing more to do + if (! isset($config['validators']) || ! is_array($config['validators'])) { + return $pluginManager; + } + + // Wire service configuration for validators + (new Config($config['validators']))->configureServiceManager($pluginManager); + + return $pluginManager; + } + + /** + * {@inheritDoc} + * + * @param string|null $name + * @param string|null $requestedName + * @return ValidatorPluginManager + */ + public function createService(ServiceLocatorInterface $container, $name = null, $requestedName = null) + { + return $this($container, $requestedName ?? ValidatorPluginManager::class, $this->creationOptions); + } + + /** + * laminas-servicemanager v2 support for invocation options. + * + * @param ServiceManagerConfiguration $options + * @return void + */ + public function setCreationOptions(array $options) + { + $this->creationOptions = $options; + } +} diff --git a/vendor/laminas/laminas-validator/src/ValidatorProviderInterface.php b/vendor/laminas/laminas-validator/src/ValidatorProviderInterface.php new file mode 100644 index 00000000..4850bb2e --- /dev/null +++ b/vendor/laminas/laminas-validator/src/ValidatorProviderInterface.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 PHPSTORM_META +{ + expectedArguments(\League\CommonMark\Util\HtmlElement::__construct(), 0, 'a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kdb', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'pre', 'progress', 'q', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr'); + + expectedArguments(\League\CommonMark\Extension\CommonMark\Node\Block\Heading::__construct(), 0, 1, 2, 3, 4, 5, 6); + expectedReturnValues(\League\CommonMark\Extension\CommonMark\Node\Block\Heading::getLevel(), 1, 2, 3, 4, 5, 6); + + registerArgumentsSet('league_commonmark_htmlblock_types', \League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock::TYPE_1_CODE_CONTAINER, \League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock::TYPE_2_COMMENT, \League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock::TYPE_3, \League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock::TYPE_4, \League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock::TYPE_5_CDATA, \League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock::TYPE_6_BLOCK_ELEMENT, \League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock::TYPE_7_MISC_ELEMENT); + expectedArguments(\League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock::__construct(), 0, argumentsSet('league_commonmark_htmlblock_types')); + expectedArguments(\League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock::setType(), 0, argumentsSet('league_commonmark_htmlblock_types')); + expectedReturnValues(\League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock::getType(), argumentsSet('league_commonmark_htmlblock_types')); + expectedArguments(\League\CommonMark\Util\RegexHelper::getHtmlBlockOpenRegex(), 0, argumentsSet('league_commonmark_htmlblock_types')); + expectedArguments(\League\CommonMark\Util\RegexHelper::getHtmlBlockCloseRegex(), 0, argumentsSet('league_commonmark_htmlblock_types')); + + registerArgumentsSet('league_commonmark_newline_types', \League\CommonMark\Node\Inline\Newline::HARDBREAK, \League\CommonMark\Node\Inline\Newline::SOFTBREAK); + expectedArguments(\League\CommonMark\Node\Inline\Newline::__construct(), 0, argumentsSet('league_commonmark_newline_types')); + expectedReturnValues(\League\CommonMark\Node\Inline\Newline::getType(), argumentsSet('league_commonmark_newline_types')); + + registerArgumentsSet('league_commonmark_options', + 'html_input', + 'allow_unsafe_links', + 'max_nesting_level', + 'renderer', + 'renderer/block_separator', + 'renderer/inner_separator', + 'renderer/soft_break', + 'commonmark', + 'commonmark/enable_em', + 'commonmark/enable_strong', + 'commonmark/use_asterisk', + 'commonmark/use_underscore', + 'commonmark/unordered_list_markers', + 'disallowed_raw_html', + 'disallowed_raw_html/disallowed_tags', + 'external_link', + 'external_link/html_class', + 'external_link/internal_hosts', + 'external_link/nofollow', + 'external_link/noopener', + 'external_link/noreferrer', + 'external_link/open_in_new_window', + 'footnote', + 'footnote/backref_class', + 'footnote/backref_symbol', + 'footnote/container_add_hr', + 'footnote/container_class', + 'footnote/ref_class', + 'footnote/ref_id_prefix', + 'footnote/footnote_class', + 'footnote/footnote_id_prefix', + 'heading_permalink', + 'heading_permalink/apply_id_to_heading', + 'heading_permalink/heading_class', + 'heading_permalink/html_class', + 'heading_permalink/fragment_prefix', + 'heading_permalink/id_prefix', + 'heading_permalink/inner_contents', + 'heading_permalink/insert', + 'heading_permalink/max_heading_level', + 'heading_permalink/min_heading_level', + 'heading_permalink/symbol', + 'heading_permalink/title', + 'mentions', + 'smartpunct/double_quote_closer', + 'smartpunct/double_quote_opener', + 'smartpunct/single_quote_closer', + 'smartpunct/single_quote_opener', + 'slug_normalizer', + 'slug_normalizer/instance', + 'slug_normalizer/max_length', + 'slug_normalizer/unique', + 'table', + 'table/wrap', + 'table/wrap/attributes', + 'table/wrap/enabled', + 'table/wrap/tag', + 'table/alignment_attributes', + 'table/alignment_attributes/left', + 'table/alignment_attributes/center', + 'table/alignment_attributes/right', + 'table_of_contents', + 'table_of_contents/html_class', + 'table_of_contents/max_heading_level', + 'table_of_contents/min_heading_level', + 'table_of_contents/normalize', + 'table_of_contents/placeholder', + 'table_of_contents/position', + 'table_of_contents/style', + ); + expectedArguments(\League\Config\ConfigurationInterface::get(), 0, argumentsSet('league_commonmark_options')); + expectedArguments(\League\Config\ConfigurationInterface::exists(), 0, argumentsSet('league_commonmark_options')); + expectedArguments(\League\Config\MutableConfigurationInterface::set(), 0, argumentsSet('league_commonmark_options')); +} diff --git a/vendor/league/commonmark/CHANGELOG.md b/vendor/league/commonmark/CHANGELOG.md new file mode 100644 index 00000000..917e5e80 --- /dev/null +++ b/vendor/league/commonmark/CHANGELOG.md @@ -0,0 +1,673 @@ +# Change Log +All notable changes to this project will be documented in this file. +Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) principles. + +**Upgrading from 1.x?** See for additional information. + +## [Unreleased][unreleased] + +## [2.5.3] - 2024-08-16 + +### Changed + +- Made compatible with CommonMark spec 0.31.1, including: + - Remove `source`, add `search` to list of recognized block tags + +## [2.5.2] - 2024-08-14 + +### Changed + +- Boolean attributes now require an explicit `true` value (#1040) + +### Fixed + +- Fixed regression where text could be misinterpreted as an attribute (#1040) + +## [2.5.1] - 2024-07-24 + +### Fixed + +- Fixed attribute parsing incorrectly parsing mustache-like syntax (#1035) +- Fixed incorrect `Table` start line numbers (#1037) + +## [2.5.0] - 2024-07-22 + +### Added + +- The `AttributesExtension` now supports attributes without values (#985, #986) +- The `AutolinkExtension` exposes two new configuration options to override the default behavior (#969, #987): + - `autolink/allowed_protocols` - an array of protocols to allow autolinking for + - `autolink/default_protocol` - the default protocol to use when none is specified + +### Changed + +- Made compatible with CommonMark spec 0.31.0, including: + - Allow closing fence to be followed by tabs + - Remove restrictive limitation on inline comments + - Unicode symbols now treated like punctuation (for purposes of flankingness) + - Trailing tabs on the last line of indented code blocks will be excluded + - Improved HTML comment matching +- `Paragraph`s only containing link reference definitions will be kept in the AST until the `Document` is finalized + - (These were previously removed immediately after parsing the `Paragraph`) + +### Fixed + +- Fixed list tightness not being determined properly in some edge cases +- Fixed incorrect ending line numbers for several block types in various scenarios +- Fixed lowercase inline HTML declarations not being accepted + +## [2.4.4] - 2024-07-22 + +### Fixed + +- Fixed SmartPunct extension changing already-formatted quotation marks (#1030) + +## [2.4.3] - 2024-07-22 + +### Fixed + +- Fixed the Attributes extension not supporting CSS level 3 selectors (#1013) +- Fixed `UrlAutolinkParser` incorrectly parsing text containing `www` anywhere before an autolink (#1025) + + +## [2.4.2] - 2024-02-02 + +### Fixed + +- Fixed declaration parser being too strict +- `FencedCodeRenderer`: don't add `language-` to class if already prefixed + +## [2.4.1] - 2023-08-30 + +### Fixed + +- Fixed `ExternalLinkProcessor` not fully disabling the `rel` attribute when configured to do so (#992) + +## [2.4.0] - 2023-03-24 + +### Added + +- Added generic `CommonMarkException` marker interface for all exceptions thrown by the library +- Added several new specific exception types implementing that marker interface: + - `AlreadyInitializedException` + - `InvalidArgumentException` + - `IOException` + - `LogicException` + - `MissingDependencyException` + - `NoMatchingRendererException` + - `ParserLogicException` +- Added more configuration options to the Heading Permalinks extension (#939): + - `heading_permalink/apply_id_to_heading` - When `true`, the `id` attribute will be applied to the heading element itself instead of the `` tag + - `heading_permalink/heading_class` - class to apply to the heading element + - `heading_permalink/insert` - now accepts `none` to prevent the creation of the `` link +- Added new `table/alignment_attributes` configuration option to control how table cell alignment is rendered (#959) + +### Changed + +- Change several thrown exceptions from `RuntimeException` to `LogicException` (or something extending it), including: + - `CallbackGenerator`s that fail to set a URL or return an expected value + - `MarkdownParser` when deactivating the last block parser or attempting to get an active block parser when they've all been closed + - Adding items to an already-initialized `Environment` + - Rendering a `Node` when no renderer has been registered for it +- `HeadingPermalinkProcessor` now throws `InvalidConfigurationException` instead of `RuntimeException` when invalid config values are given. +- `HtmlElement::setAttribute()` no longer requires the second parameter for boolean attributes +- Several small micro-optimizations +- Changed Strikethrough to only allow 1 or 2 tildes per the updated GFM spec + +### Fixed + +- Fixed inaccurate `@throws` docblocks throughout the codebase, including `ConverterInterface`, `MarkdownConverter`, and `MarkdownConverterInterface`. + - These previously suggested that only `\RuntimeException`s were thrown, which was inaccurate as `\LogicException`s were also possible. + +## [2.3.9] - 2023-02-15 + +### Fixed + +- Fixed autolink extension not detecting some URIs with underscores (#956) + +## [2.3.8] - 2022-12-10 + +### Fixed + +- Fixed parsing issues when `mb_internal_encoding()` is set to something other than `UTF-8` (#951) + +## [2.3.7] - 2022-11-03 + +### Fixed + +- Fixed `TaskListItemMarkerRenderer` not including HTML attributes set on the node by other extensions (#947) + +## [2.3.6] - 2022-10-30 + +### Fixed + +- Fixed unquoted attribute parsing when closing curly brace is followed by certain characters (like a `.`) (#943) + +## [2.3.5] - 2022-07-29 + +### Fixed + +- Fixed error using `InlineParserEngine` when no inline parsers are registered in the `Environment` (#908) + +## [2.3.4] - 2022-07-17 + +### Changed + +- Made a number of small tweaks to the embed extension's parsing behavior to fix #898: + - Changed `EmbedStartParser` to always capture embed-like lines in container blocks, regardless of parent block type + - Changed `EmbedProcessor` to also remove `Embed` blocks that aren't direct children of the `Document` + - Increased the priority of `EmbedProcessor` to `1010` + +### Fixed + +- Fixed `EmbedExtension` not parsing embeds following a list block (#898) + +## [2.3.3] - 2022-06-07 + +### Fixed + +- Fixed `DomainFilteringAdapter` not reindexing the embed list (#884, #885) + +## [2.3.2] - 2022-06-03 + +### Fixed + +- Fixed FootnoteExtension stripping extra characters from tab-indented footnotes (#881) + +## [2.2.5] - 2022-06-03 + +### Fixed + +- Fixed FootnoteExtension stripping extra characters from tab-indented footnotes (#881) + +## [2.3.1] - 2022-05-14 + +### Fixed + +- Fixed AutolinkExtension not ignoring trailing strikethrough syntax (#867) + +## [2.2.4] - 2022-05-14 + +### Fixed + +- Fixed AutolinkExtension not ignoring trailing strikethrough syntax (#867) + +## [2.3.0] - 2022-04-07 + +### Added + +- Added new `EmbedExtension` (#805) +- Added `DocumentRendererInterface` as a replacement for the now-deprecated `MarkdownRendererInterface` + +### Deprecated + +- Deprecated `MarkdownRendererInterface`; use `DocumentRendererInterface` instead + +## [2.2.3] - 2022-02-26 + +### Fixed + +- Fixed front matter parsing with Windows line endings (#821) + +## [2.1.3] - 2022-02-26 + +### Fixed + +- Fixed front matter parsing with Windows line endings (#821) + +## [2.0.4] - 2022-02-26 + +### Fixed + +- Fixed front matter parsing with Windows line endings (#821) + +## [2.2.2] - 2022-02-13 + +### Fixed + +- Fixed double-escaping of image alt text (#806, #810) +- Fixed Psalm typehints for event class names + +## [2.2.1] - 2022-01-25 + +### Fixed + + - Fixed `symfony/deprecation-contracts` constraint + +### Removed + + - Removed deprecation trigger from `MarkdownConverterInterface` to reduce noise + +## [2.2.0] - 2022-01-22 + +### Added + + - Added new `ConverterInterface` + - Added new `MarkdownToXmlConverter` class + - Added new `HtmlDecorator` class which can wrap existing renderers with additional HTML tags + - Added new `table/wrap` config to apply an optional wrapping/container element around a table (#780) + +### Changed + + - `HtmlElement` contents can now consist of any `Stringable`, not just `HtmlElement` and `string` + +### Deprecated + + - Deprecated `MarkdownConverterInterface` and its `convertToHtml()` method; use `ConverterInterface` and `convert()` instead + +## [2.1.2] - 2022-02-13 + +### Fixed + +- Fixed double-escaping of image alt text (#806, #810) +- Fixed Psalm typehints for event class names + +## [2.1.1] - 2022-01-02 + +### Added + + - Added missing return type to `Environment::dispatch()` to fix deprecation warning (#778) + +## [2.1.0] - 2021-12-05 + +### Added + +- Added support for ext-yaml in FrontMatterExtension (#715) +- Added support for symfony/yaml v6.0 in FrontMatterExtension (#739) +- Added new `heading_permalink/aria_hidden` config option (#741) + +### Fixed + + - Fixed PHP 8.1 deprecation warning (#759, #762) + +## [2.0.3] - 2022-02-13 + +### Fixed + +- Fixed double-escaping of image alt text (#806, #810) +- Fixed Psalm typehints for event class names + +## [2.0.2] - 2021-08-14 + +### Changed + +- Bumped minimum version of league/config to support PHP 8.1 + +### Fixed + +- Fixed ability to register block parsers that identify lines starting with letters (#706) + +## [2.0.1] - 2021-07-31 + +### Fixed + +- Fixed nested autolinks (#689) +- Fixed description lists being parsed incorrectly (#692) +- Fixed Table of Contents not respecting Heading Permalink prefixes (#690) + +## [2.0.0] - 2021-07-24 + +No changes were introduced since the previous RC2 release. +See all entries below for a list of changes between 1.x and 2.0. + +## [2.0.0-rc2] - 2021-07-17 + +### Fixed + +- Fixed Mentions inside of links creating nested links against the spec's rules (#688) + +## [2.0.0-rc1] - 2021-07-10 + +No changes were introduced since the previous release. + +## [2.0.0-beta3] - 2021-07-03 + +### Changed + + - Any leading UTF-8 BOM will be stripped from the input + - The `getEnvironment()` method of `CommonMarkConverter` and `GithubFlavoredMarkdownConverter` will always return the concrete, configurable `Environment` for upgrading convenience + - Optimized AST iteration + - Lots of small micro-optimizations + +## [2.0.0-beta2] - 2021-06-27 + +### Added + +- Added new `Node::iterator()` method and `NodeIterator` class for faster AST iteration (#683, #684) + +### Changed + +- Made compatible with CommonMark spec 0.30.0 +- Optimized link label parsing +- Optimized AST iteration for a 50% performance boost in some event listeners (#683, #684) + +### Fixed + +- Fixed processing instructions with EOLs +- Fixed case-insensitive matching for HTML tag types +- Fixed type 7 HTML blocks incorrectly interrupting lazy paragraphs +- Fixed newlines in reference labels not collapsing into spaces +- Fixed link label normalization with escaped newlines +- Fixed unnecessary AST iteration when no default attributes are configured + +## [2.0.0-beta1] - 2021-06-20 + +### Added + + - **Added three new extensions:** + - `FrontMatterExtension` ([see documentation](https://commonmark.thephpleague.com/extensions/front-matter/)) + - `DescriptionListExtension` ([see documentation](https://commonmark.thephpleague.com/extensions/description-lists/)) + - `DefaultAttributesExtension` ([see documentation](https://commonmark.thephpleague.com/extensions/default-attributes/)) + - **Added new `XmlRenderer` to simplify AST debugging** ([see documentation](https://commonmark.thephpleague.com/xml/)) (#431) + - **Added the ability to configure disallowed raw HTML tags** (#507) + - **Added the ability for Mentions to use multiple characters for their symbol** (#514, #550) + - **Added the ability to delegate event dispatching to PSR-14 compliant event dispatcher libraries** + - **Added new configuration options:** + - Added `heading_permalink/min_heading_level` and `heading_permalink/max_heading_level` options to control which headings get permalinks (#519) + - Added `heading_permalink/fragment_prefix` to allow customizing the URL fragment prefix (#602) + - Added `footnote/backref_symbol` option for customizing backreference link appearance (#522) + - Added `slug_normalizer/max_length` option to control the maximum length of generated URL slugs + - Added `slug_normalizer/unique` option to control whether unique slugs should be generated per-document or per-environment + - **Added purity markers throughout the codebase** (verified with Psalm) + - Added `Query` class to simplify Node traversal when looking to take action on certain Nodes + - Added new `HtmlFilter` and `StringContainerHelper` utility classes + - Added new `AbstractBlockContinueParser` class to simplify the creation of custom block parsers + - Added several new classes and interfaces: + - `BlockContinue` + - `BlockContinueParserInterface` + - `BlockContinueParserWithInlinesInterface` + - `BlockStart` + - `BlockStartParserInterface` + - `ChildNodeRendererInterface` + - `ConfigurableExtensionInterface` + - `CursorState` + - `DashParser` (extracted from `PunctuationParser`) + - `DelimiterParser` + - `DocumentBlockParser` + - `DocumentPreRenderEvent` + - `DocumentRenderedEvent` + - `EllipsesParser` (extracted from `PunctuationParser`) + - `ExpressionInterface` + - `FallbackNodeXmlRenderer` + - `InlineParserEngineInterface` + - `InlineParserMatch` + - `MarkdownParserState` + - `MarkdownParserStateInterface` + - `MarkdownRendererInterface` + - `Query` + - `RawMarkupContainerInterface` + - `ReferenceableInterface` + - `RenderedContent` + - `RenderedContentInterface` + - `ReplaceUnpairedQuotesListener` + - `SpecReader` + - `TableOfContentsRenderer` + - `UniqueSlugNormalizer` + - `UniqueSlugNormalizerInterface` + - `XmlRenderer` + - `XmlNodeRendererInterface` + - Added several new methods: + - `Cursor::getCurrentCharacter()` + - `Environment::createDefaultConfiguration()` + - `Environment::setEventDispatcher()` + - `EnvironmentInterface::getExtensions()` + - `EnvironmentInterface::getInlineParsers()` + - `EnvironmentInterface::getSlugNormalizer()` + - `FencedCode::setInfo()` + - `Heading::setLevel()` + - `HtmlRenderer::renderDocument()` + - `InlineParserContext::getFullMatch()` + - `InlineParserContext::getFullMatchLength()` + - `InlineParserContext::getMatches()` + - `InlineParserContext::getSubMatches()` + - `LinkParserHelper::parsePartialLinkLabel()` + - `LinkParserHelper::parsePartialLinkTitle()` + - `Node::assertInstanceOf()` + - `RegexHelper::isLetter()` + - `StringContainerInterface::setLiteral()` + - `TableCell::getType()` + - `TableCell::setType()` + - `TableCell::getAlign()` + - `TableCell::setAlign()` + +### Changed + + - **Changed the converter return type** + - `CommonMarkConverter::convertToHtml()` now returns an instance of `RenderedContentInterface`. This can be cast to a string for backward compatibility with 1.x. + - **Table of Contents items are no longer wrapped with `

    ` tags** (#613) + - **Heading Permalinks now link to element IDs instead of using `name` attributes** (#602) + - **Heading Permalink IDs and URL fragments now have a `content` prefix by default** (#602) + - **Changes to configuration options:** + - `enable_em` has been renamed to `commonmark/enable_em` + - `enable_strong` has been renamed to `commonmark/enable_strong` + - `use_asterisk` has been renamed to `commonmark/use_asterisk` + - `use_underscore` has been renamed to `commonmark/use_underscore` + - `unordered_list_markers` has been renamed to `commonmark/unordered_list_markers` + - `mentions/*/symbol` has been renamed to `mentions/*/prefix` + - `mentions/*/regex` has been renamed to `mentions/*/pattern` and requires partial regular expressions (without delimiters or flags) + - `max_nesting_level` now defaults to `PHP_INT_MAX` and no longer supports floats + - `heading_permalink/slug_normalizer` has been renamed to `slug_normalizer/instance` + - **Event dispatching is now fully PSR-14 compliant** + - **Moved and renamed several classes** - [see the full list here](https://commonmark.thephpleague.com/2.0/upgrading/#classesnamespaces-renamed) + - The `HeadingPermalinkExtension` and `FootnoteExtension` were modified to ensure they never produce a slug which conflicts with slugs created by the other extension + - `SlugNormalizer::normalizer()` now supports optional prefixes and max length options passed in via the `$context` argument + - The `AbstractBlock::$data` and `AbstractInline::$data` arrays were replaced with a `Data` array-like object on the base `Node` class + - **Implemented a new approach to block parsing.** This was a massive change, so here are the highlights: + - Functionality previously found in block parsers and node elements has moved to block parser factories and block parsers, respectively ([more details](https://commonmark.thephpleague.com/2.0/upgrading/#new-block-parsing-approach)) + - `ConfigurableEnvironmentInterface::addBlockParser()` is now `EnvironmentBuilderInterface::addBlockParserFactory()` + - `ReferenceParser` was re-implemented and works completely different than before + - The paragraph parser no longer needs to be added manually to the environment + - **Implemented a new approach to inline parsing** where parsers can now specify longer strings or regular expressions they want to parse (instead of just single characters): + - `InlineParserInterface::getCharacters()` is now `getMatchDefinition()` and returns an instance of `InlineParserMatch` + - `InlineParserContext::__construct()` now requires the contents to be provided as a `Cursor` instead of a `string` + - **Implemented delimiter parsing as a special type of inline parser** (via the new `DelimiterParser` class) + - **Changed block and inline rendering to use common methods and interfaces** + - `BlockRendererInterface` and `InlineRendererInterface` were replaced by `NodeRendererInterface` with slightly different parameters. All core renderers now implement this interface. + - `ConfigurableEnvironmentInterface::addBlockRenderer()` and `addInlineRenderer()` were combined into `EnvironmentBuilderInterface::addRenderer()` + - `EnvironmentInterface::getBlockRenderersForClass()` and `getInlineRenderersForClass()` are now just `getRenderersForClass()` + - **Completely refactored the Configuration implementation** + - All configuration-specific classes have been moved into a new `league/config` package with a new namespace + - `Configuration` objects must now be configured with a schema and all options must match that schema - arbitrary keys are no longer permitted + - `Configuration::__construct()` no longer accepts the default configuration values - use `Configuration::merge()` instead + - `ConfigurationInterface` now only contains a `get(string $key)`; this method no longer allows arbitrary default values to be returned if the option is missing + - `ConfigurableEnvironmentInterface` was renamed to `EnvironmentBuilderInterface` + - `ExtensionInterface::register()` now requires an `EnvironmentBuilderInterface` param instead of `ConfigurableEnvironmentInterface` + - **Added missing return types to virtually every class and interface method** + - Re-implemented the GFM Autolink extension using the new inline parser approach instead of document processors + - `EmailAutolinkProcessor` is now `EmailAutolinkParser` + - `UrlAutolinkProcessor` is now `UrlAutolinkParser` + - `HtmlElement` can now properly handle array (i.e. `class`) and boolean (i.e. `checked`) attribute values + - `HtmlElement` automatically flattens any attributes with array values into space-separated strings, removing duplicate entries + - Combined separate classes/interfaces into one: + - `DisallowedRawHtmlRenderer` replaces `DisallowedRawHtmlBlockRenderer` and `DisallowedRawHtmlInlineRenderer` + - `NodeRendererInterface` replaces `BlockRendererInterface` and `InlineRendererInterface` + - Renamed the following methods: + - `Environment` and `ConfigurableEnvironmentInterface`: + - `addBlockParser()` is now `addBlockStartParser()` + - `ReferenceMap` and `ReferenceMapInterface`: + - `addReference()` is now `add()` + - `getReference()` is now `get()` + - `listReferences()` is now `getIterator()` + - Various node (block/inline) classes: + - `getContent()` is now `getLiteral()` + - `setContent()` is now `setLiteral()` + - Moved and renamed the following constants: + - `EnvironmentInterface::HTML_INPUT_ALLOW` is now `HtmlFilter::ALLOW` + - `EnvironmentInterface::HTML_INPUT_ESCAPE` is now `HtmlFilter::ESCAPE` + - `EnvironmentInterface::HTML_INPUT_STRIP` is now `HtmlFilter::STRIP` + - `TableCell::TYPE_HEAD` is now `TableCell::TYPE_HEADER` + - `TableCell::TYPE_BODY` is now `TableCell::TYPE_DATA` + - Changed the visibility of the following properties: + - `AttributesInline::$attributes` is now `private` + - `AttributesInline::$block` is now `private` + - `TableCell::$align` is now `private` + - `TableCell::$type` is now `private` + - `TableSection::$type` is now `private` + - Several methods which previously returned `$this` now return `void` + - `Delimiter::setPrevious()` + - `Node::replaceChildren()` + - `Context::setTip()` + - `Context::setContainer()` + - `Context::setBlocksParsed()` + - `AbstractStringContainer::setContent()` + - `AbstractWebResource::setUrl()` + - Several classes are now marked `final`: + - `ArrayCollection` + - `Emphasis` + - `FencedCode` + - `Heading` + - `HtmlBlock` + - `HtmlElement` + - `HtmlInline` + - `IndentedCode` + - `Newline` + - `Strikethrough` + - `Strong` + - `Text` + - `Heading` nodes no longer directly contain a copy of their inner text + - `StringContainerInterface` can now be used for inlines, not just blocks + - `ArrayCollection` only supports integer keys + - `HtmlElement` now implements `Stringable` + - `Cursor::saveState()` and `Cursor::restoreState()` now use `CursorState` objects instead of arrays + - `NodeWalker::next()` now enters, traverses any children, and leaves all elements which may have children (basically all blocks plus any inlines with children). Previously, it only did this for elements explicitly marked as "containers". + - `InvalidOptionException` was removed + - Anything with a `getReference(): ReferenceInterface` method now implements `ReferencableInterface` + - The `SmartPunct` extension now replaces all unpaired `Quote` elements with `Text` elements towards the end of parsing, making the `QuoteRenderer` unnecessary + - Several changes made to the Footnote extension: + - Footnote identifiers can no longer contain spaces + - Anonymous footnotes can now span subsequent lines + - Footnotes can now contain multiple lines of content, including sub-blocks, by indenting them + - Footnote event listeners now have numbered priorities (but still execute in the same order) + - Footnotes must now be separated from previous content by a blank line + - The line numbers (keys) returned via `MarkdownInput::getLines()` now start at 1 instead of 0 + - `DelimiterProcessorCollectionInterface` now extends `Countable` + - `RegexHelper::PARTIAL_` constants must always be used in case-insensitive contexts + - `HeadingPermalinkProcessor` no longer accepts text normalizers via the constructor - these must be provided via configuration instead + - Blocks which can't contain inlines will no longer be asked to render inlines + - `AnonymousFootnoteRefParser` and `HeadingPermalinkProcessor` now implement `EnvironmentAwareInterface` instead of `ConfigurationAwareInterface` + - The second argument to `TextNormalizerInterface::normalize()` must now be an array + - The `title` attribute for `Link` and `Image` nodes is now stored using a dedicated property instead of stashing it in `$data` + - `ListData::$delimiter` now returns either `ListBlock::DELIM_PERIOD` or `ListBlock::DELIM_PAREN` instead of the literal delimiter + +### Fixed + + - **Fixed parsing of footnotes without content** + - **Fixed rendering of orphaned footnotes and footnote refs** + - **Fixed some URL autolinks breaking too early** (#492) + - Fixed `AbstractStringContainer` not actually being `abstract` + +### Removed + + - **Removed support for PHP 7.1, 7.2, and 7.3** (#625, #671) + - **Removed all previously-deprecated functionality:** + - Removed the ability to pass custom `Environment` instances into the `CommonMarkConverter` and `GithubFlavoredMarkdownConverter` constructors + - Removed the `Converter` class and `ConverterInterface` + - Removed the `bin/commonmark` script + - Removed the `Html5Entities` utility class + - Removed the `InlineMentionParser` (use `MentionParser` instead) + - Removed `DefaultSlugGenerator` and `SlugGeneratorInterface` from the `Extension/HeadingPermalink/Slug` sub-namespace (use the new ones under `./SlugGenerator` instead) + - Removed the following `ArrayCollection` methods: + - `add()` + - `set()` + - `get()` + - `remove()` + - `isEmpty()` + - `contains()` + - `indexOf()` + - `containsKey()` + - `replaceWith()` + - `removeGaps()` + - Removed the `ConfigurableEnvironmentInterface::setConfig()` method + - Removed the `ListBlock::TYPE_UNORDERED` constant + - Removed the `CommonMarkConverter::VERSION` constant + - Removed the `HeadingPermalinkRenderer::DEFAULT_INNER_CONTENTS` constant + - Removed the `heading_permalink/inner_contents` configuration option + - **Removed now-unused classes:** + - `AbstractStringContainerBlock` + - `BlockRendererInterface` + - `Context` + - `ContextInterface` + - `Converter` + - `ConverterInterface` + - `InlineRendererInterface` + - `PunctuationParser` (was split into two classes: `DashParser` and `EllipsesParser`) + - `QuoteRenderer` + - `UnmatchedBlockCloser` + - Removed the following methods, properties, and constants: + - `AbstractBlock::$open` + - `AbstractBlock::$lastLineBlank` + - `AbstractBlock::isContainer()` + - `AbstractBlock::canContain()` + - `AbstractBlock::isCode()` + - `AbstractBlock::matchesNextLine()` + - `AbstractBlock::endsWithBlankLine()` + - `AbstractBlock::setLastLineBlank()` + - `AbstractBlock::shouldLastLineBeBlank()` + - `AbstractBlock::isOpen()` + - `AbstractBlock::finalize()` + - `AbstractBlock::getData()` + - `AbstractInline::getData()` + - `ConfigurableEnvironmentInterface::addBlockParser()` + - `ConfigurableEnvironmentInterface::mergeConfig()` + - `Delimiter::setCanClose()` + - `EnvironmentInterface::getConfig()` + - `EnvironmentInterface::getInlineParsersForCharacter()` + - `EnvironmentInterface::getInlineParserCharacterRegex()` + - `HtmlRenderer::renderBlock()` + - `HtmlRenderer::renderBlocks()` + - `HtmlRenderer::renderInline()` + - `HtmlRenderer::renderInlines()` + - `Node::isContainer()` + - `RegexHelper::matchAll()` (use the new `matchFirst()` method instead) + - `RegexHelper::REGEX_WHITESPACE` + - Removed the second `$contents` argument from the `Heading` constructor + +### Deprecated + +**The following things have been deprecated and will not be supported in v3.0:** + + - `Environment::mergeConfig()` (set configuration before instantiation instead) + - `Environment::createCommonMarkEnvironment()` and `Environment::createGFMEnvironment()` + - Alternative 1: Use `CommonMarkConverter` or `GithubFlavoredMarkdownConverter` if you don't need to customize the environment + - Alternative 2: Instantiate a new `Environment` and add the necessary extensions yourself + +[unreleased]: https://github.com/thephpleague/commonmark/compare/2.5.3...main +[2.5.3]: https://github.com/thephpleague/commonmark/compare/2.5.2...2.5.3 +[2.5.2]: https://github.com/thephpleague/commonmark/compare/2.5.1...2.5.2 +[2.5.1]: https://github.com/thephpleague/commonmark/compare/2.5.0...2.5.1 +[2.5.0]: https://github.com/thephpleague/commonmark/compare/2.4.4...2.5.0 +[2.4.4]: https://github.com/thephpleague/commonmark/compare/2.4.3...2.4.4 +[2.4.3]: https://github.com/thephpleague/commonmark/compare/2.4.2...2.4.3 +[2.4.2]: https://github.com/thephpleague/commonmark/compare/2.4.1...2.4.2 +[2.4.1]: https://github.com/thephpleague/commonmark/compare/2.4.0...2.4.1 +[2.4.0]: https://github.com/thephpleague/commonmark/compare/2.3.9...2.4.0 +[2.3.9]: https://github.com/thephpleague/commonmark/compare/2.3.8...2.3.9 +[2.3.8]: https://github.com/thephpleague/commonmark/compare/2.3.7...2.3.8 +[2.3.7]: https://github.com/thephpleague/commonmark/compare/2.3.6...2.3.7 +[2.3.6]: https://github.com/thephpleague/commonmark/compare/2.3.5...2.3.6 +[2.3.5]: https://github.com/thephpleague/commonmark/compare/2.3.4...2.3.5 +[2.3.4]: https://github.com/thephpleague/commonmark/compare/2.3.3...2.3.4 +[2.3.3]: https://github.com/thephpleague/commonmark/compare/2.3.2...2.3.3 +[2.3.2]: https://github.com/thephpleague/commonmark/compare/2.3.2...main +[2.3.1]: https://github.com/thephpleague/commonmark/compare/2.3.0...2.3.1 +[2.3.0]: https://github.com/thephpleague/commonmark/compare/2.2.3...2.3.0 +[2.2.5]: https://github.com/thephpleague/commonmark/compare/2.2.4...2.2.5 +[2.2.4]: https://github.com/thephpleague/commonmark/compare/2.2.3...2.2.4 +[2.2.3]: https://github.com/thephpleague/commonmark/compare/2.2.2...2.2.3 +[2.2.2]: https://github.com/thephpleague/commonmark/compare/2.2.1...2.2.2 +[2.2.1]: https://github.com/thephpleague/commonmark/compare/2.2.0...2.2.1 +[2.2.0]: https://github.com/thephpleague/commonmark/compare/2.1.1...2.2.0 +[2.1.3]: https://github.com/thephpleague/commonmark/compare/2.1.2...2.1.3 +[2.1.2]: https://github.com/thephpleague/commonmark/compare/2.1.1...2.1.2 +[2.1.1]: https://github.com/thephpleague/commonmark/compare/2.0.2...2.1.1 +[2.1.0]: https://github.com/thephpleague/commonmark/compare/2.0.2...2.1.0 +[2.0.4]: https://github.com/thephpleague/commonmark/compare/2.0.3...2.0.4 +[2.0.3]: https://github.com/thephpleague/commonmark/compare/2.0.2...2.0.3 +[2.0.2]: https://github.com/thephpleague/commonmark/compare/2.0.1...2.0.2 +[2.0.1]: https://github.com/thephpleague/commonmark/compare/2.0.0...2.0.1 +[2.0.0]: https://github.com/thephpleague/commonmark/compare/2.0.0-rc2...2.0.0 +[2.0.0-rc2]: https://github.com/thephpleague/commonmark/compare/2.0.0-rc1...2.0.0-rc2 +[2.0.0-rc1]: https://github.com/thephpleague/commonmark/compare/2.0.0-beta3...2.0.0-rc1 +[2.0.0-beta3]: https://github.com/thephpleague/commonmark/compare/2.0.0-beta2...2.0.0-beta3 +[2.0.0-beta2]: https://github.com/thephpleague/commonmark/compare/2.0.0-beta1...2.0.0-beta2 +[2.0.0-beta1]: https://github.com/thephpleague/commonmark/compare/1.6...2.0.0-beta1 diff --git a/vendor/league/commonmark/LICENSE b/vendor/league/commonmark/LICENSE new file mode 100644 index 00000000..5f04fad7 --- /dev/null +++ b/vendor/league/commonmark/LICENSE @@ -0,0 +1,28 @@ +BSD 3-Clause License + +Copyright (c) 2014-2022, Colin O'Dell. All rights reserved. Some code based on commonmark.js (copyright 2014-2018, John MacFarlane) and commonmark-java (copyright 2015-2016, Atlassian Pty Ltd) + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/league/commonmark/README.md b/vendor/league/commonmark/README.md new file mode 100644 index 00000000..36a337b0 --- /dev/null +++ b/vendor/league/commonmark/README.md @@ -0,0 +1,221 @@ +# league/commonmark + +[![Latest Version](https://img.shields.io/packagist/v/league/commonmark.svg?style=flat-square)](https://packagist.org/packages/league/commonmark) +[![Total Downloads](https://img.shields.io/packagist/dt/league/commonmark.svg?style=flat-square)](https://packagist.org/packages/league/commonmark) +[![Software License](https://img.shields.io/badge/License-BSD--3-brightgreen.svg?style=flat-square)](LICENSE) +[![Build Status](https://img.shields.io/github/actions/workflow/status/thephpleague/commonmark/tests.yml?branch=main&style=flat-square)](https://github.com/thephpleague/commonmark/actions?query=workflow%3ATests+branch%3Amain) +[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/thephpleague/commonmark.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/commonmark/code-structure) +[![Quality Score](https://img.shields.io/scrutinizer/g/thephpleague/commonmark.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/commonmark) +[![Psalm Type Coverage](https://shepherd.dev/github/thephpleague/commonmark/coverage.svg)](https://shepherd.dev/github/thephpleague/commonmark) +[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/126/badge)](https://bestpractices.coreinfrastructure.org/projects/126) +[![Sponsor development of this project](https://img.shields.io/badge/sponsor%20this%20package-%E2%9D%A4-ff69b4.svg?style=flat-square)](https://www.colinodell.com/sponsor) + +![league/commonmark](commonmark-banner.png) + +**league/commonmark** is a highly-extensible PHP Markdown parser created by [Colin O'Dell][@colinodell] which supports the full [CommonMark] spec and [GitHub-Flavored Markdown]. It is based on the [CommonMark JS reference implementation][commonmark.js] by [John MacFarlane] \([@jgm]\). + +## 📦 Installation & Basic Usage + +This project requires PHP 7.4 or higher with the `mbstring` extension. To install it via [Composer] simply run: + +``` bash +$ composer require league/commonmark +``` + +The `CommonMarkConverter` class provides a simple wrapper for converting CommonMark to HTML: + +```php +use League\CommonMark\CommonMarkConverter; + +$converter = new CommonMarkConverter([ + 'html_input' => 'strip', + 'allow_unsafe_links' => false, +]); + +echo $converter->convert('# Hello World!'); + +//

    Hello World!

    +``` + +Or if you want GitHub-Flavored Markdown, use the `GithubFlavoredMarkdownConverter` class instead: + +```php +use League\CommonMark\GithubFlavoredMarkdownConverter; + +$converter = new GithubFlavoredMarkdownConverter([ + 'html_input' => 'strip', + 'allow_unsafe_links' => false, +]); + +echo $converter->convert('# Hello World!'); + +//

    Hello World!

    +``` + +Please note that only UTF-8 and ASCII encodings are supported. If your Markdown uses a different encoding please convert it to UTF-8 before running it through this library. + +🔒 If you will be parsing untrusted input from users, please consider setting the `html_input` and `allow_unsafe_links` options per the example above. See for more details. If you also do choose to allow raw HTML input from untrusted users, consider using a library (like [HTML Purifier](https://github.com/ezyang/htmlpurifier)) to provide additional HTML filtering. + +## 📓 Documentation + +Full documentation on advanced usage, configuration, and customization can be found at [commonmark.thephpleague.com][docs]. + +## ⏫ Upgrading + +Information on how to upgrade to newer versions of this library can be found at . + +## 💻 GitHub-Flavored Markdown + +The `GithubFlavoredMarkdownConverter` shown earlier is a drop-in replacement for the `CommonMarkConverter` which adds additional features found in the GFM spec: + + - Autolinks + - Disallowed raw HTML + - Strikethrough + - Tables + - Task Lists + +See the [Extensions documentation](https://commonmark.thephpleague.com/customization/extensions/) for more details on how to include only certain GFM features if you don't want them all. + +## 🗃️ Related Packages + +### Integrations + +- [CakePHP 3](https://github.com/gourmet/common-mark) +- [Drupal](https://www.drupal.org/project/markdown) +- [Laravel 4+](https://github.com/GrahamCampbell/Laravel-Markdown) +- [Sculpin](https://github.com/bcremer/sculpin-commonmark-bundle) +- [Symfony 2 & 3](https://github.com/webuni/commonmark-bundle) +- [Symfony 4](https://github.com/avensome/commonmark-bundle) +- [Twig Markdown extension](https://github.com/twigphp/markdown-extension) +- [Twig filter and tag](https://github.com/aptoma/twig-markdown) +- [Laravel CommonMark Blog](https://github.com/spekulatius/laravel-commonmark-blog) + +### Included Extensions + +See [our extension documentation](https://commonmark.thephpleague.com/extensions/overview) for a full list of extensions bundled with this library. + +### Community Extensions + +Custom parsers/renderers can be bundled into extensions which extend CommonMark. Here are some that you may find interesting: + + - [Emoji extension](https://github.com/ElGigi/CommonMarkEmoji) - UTF-8 emoji extension with Github tag. + - [Sup Sub extensions](https://github.com/OWS/commonmark-sup-sub-extensions) - Adds support of superscript and subscript (`` and `` HTML tags) + - [YouTube iframe extension](https://github.com/zoonru/commonmark-ext-youtube-iframe) - Replaces youtube link with iframe. + - [Lazy Image extension](https://github.com/simonvomeyser/commonmark-ext-lazy-image) - Adds various options for lazy loading of images. + - [Marker Extension](https://github.com/noah1400/commonmark-marker-extension) - Adds support of highlighted text (`` HTML tag) + +Others can be found on [Packagist under the `commonmark-extension` package type](https://packagist.org/packages/league/commonmark?type=commonmark-extension). + +If you build your own, feel free to submit a PR to add it to this list! + +### Others + +Check out the other cool things people are doing with `league/commonmark`: + +## 🏷️ Versioning + +[SemVer](http://semver.org/) is followed closely. Minor and patch releases should not introduce breaking changes to the codebase; however, they might change the resulting AST or HTML output of parsed Markdown (due to bug fixes, spec changes, etc.) As a result, you might get slightly different HTML, but any custom code built onto this library should still function correctly. + +Any classes or methods marked `@internal` are not intended for use outside of this library and are subject to breaking changes at any time, so please avoid using them. + +## 🛠️ Maintenance & Support + +When a new **minor** version (e.g. `2.0` -> `2.1`) is released, the previous one (`2.0`) will continue to receive security and critical bug fixes for *at least* 3 months. + +When a new **major** version is released (e.g. `1.6` -> `2.0`), the previous one (`1.6`) will receive critical bug fixes for *at least* 3 months and security updates for 6 months after that new release comes out. + +(This policy may change in the future and exceptions may be made on a case-by-case basis.) + +**Professional support, including notification of new releases and security updates, is available through a [Tidelift Subscription](https://tidelift.com/subscription/pkg/packagist-league-commonmark?utm_source=packagist-league-commonmark&utm_medium=referral&utm_campaign=readme).** + +## 👷‍♀️ Contributing + +To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure with us. + +If you encounter a bug in the spec, please report it to the [CommonMark] project. Any resulting fix will eventually be implemented in this project as well. + +Contributions to this library are **welcome**, especially ones that: + + * Improve usability or flexibility without compromising our ability to adhere to the [CommonMark spec] + * Mirror fixes made to the [reference implementation][commonmark.js] + * Optimize performance + * Fix issues with adhering to the [CommonMark spec] + +Major refactoring to core parsing logic should be avoided if possible so that we can easily follow updates made to [the reference implementation][commonmark.js]. That being said, we will absolutely consider changes which don't deviate too far from the reference spec or which are favored by other popular CommonMark implementations. + +Please see [CONTRIBUTING](https://github.com/thephpleague/commonmark/blob/main/.github/CONTRIBUTING.md) for additional details. + +## 🧪 Testing + +``` bash +$ composer test +``` + +This will also test league/commonmark against the latest supported spec. + +## 🚀 Performance Benchmarks + +You can compare the performance of **league/commonmark** to other popular parsers by running the included benchmark tool: + +``` bash +$ ./tests/benchmark/benchmark.php +``` + +## 👥 Credits & Acknowledgements + +- [Colin O'Dell][@colinodell] +- [John MacFarlane][@jgm] +- [All Contributors] + +This code is partially based on the [CommonMark JS reference implementation][commonmark.js] which is written, maintained and copyrighted by [John MacFarlane]. This project simply wouldn't exist without his work. + +### Sponsors + +We'd also like to extend our sincere thanks the following sponsors who support ongoing development of this project: + + - [Tidelift](https://tidelift.com/subscription/pkg/packagist-league-commonmark?utm_source=packagist-league-commonmark&utm_medium=referral&utm_campaign=readme) for offering support to both the maintainers and end-users through their [professional support](https://tidelift.com/subscription/pkg/packagist-league-commonmark?utm_source=packagist-league-commonmark&utm_medium=referral&utm_campaign=readme) program + - [Blackfire](https://www.blackfire.io/) for providing an Open-Source Profiler subscription + - [JetBrains](https://www.jetbrains.com/) for supporting this project with complimentary [PhpStorm](https://www.jetbrains.com/phpstorm/) licenses + - [Taylor Otwell](https://twitter.com/taylorotwell) for sponsoring this project through GitHub sponsors + +Are you interested in sponsoring development of this project? See for a list of ways to contribute. + +## 📄 License + +**league/commonmark** is licensed under the BSD-3 license. See the [`LICENSE`](LICENSE) file for more details. + +## 🏛️ Governance + +This project is primarily maintained by [Colin O'Dell][@colinodell]. Members of the [PHP League] Leadership Team may occasionally assist with some of these duties. + +## 🗺️ Who Uses It? + +This project is used by [Drupal](https://www.drupal.org/project/markdown), [Laravel Framework](https://laravel.com/), [Cachet](https://cachethq.io/), [Firefly III](https://firefly-iii.org/), [Neos](https://www.neos.io/), [Daux.io](https://daux.io/), and [more](https://packagist.org/packages/league/commonmark/dependents)! + +--- + +
    + + Get professional support for league/commonmark with a Tidelift subscription + +
    + + Tidelift helps make open source sustainable for maintainers while giving companies
    assurances about security, maintenance, and licensing for their dependencies. +
    +
    + +[CommonMark]: http://commonmark.org/ +[CommonMark spec]: http://spec.commonmark.org/ +[commonmark.js]: https://github.com/jgm/commonmark.js +[GitHub-Flavored Markdown]: https://github.github.com/gfm/ +[John MacFarlane]: http://johnmacfarlane.net +[docs]: https://commonmark.thephpleague.com/ +[docs-examples]: https://commonmark.thephpleague.com/customization/overview/#examples +[docs-example-twitter]: https://commonmark.thephpleague.com/customization/inline-parsing#example-1---twitter-handles +[docs-example-smilies]: https://commonmark.thephpleague.com/customization/inline-parsing#example-2---emoticons +[All Contributors]: https://github.com/thephpleague/commonmark/contributors +[@colinodell]: https://www.twitter.com/colinodell +[@jgm]: https://github.com/jgm +[jgm/stmd]: https://github.com/jgm/stmd +[Composer]: https://getcomposer.org/ +[PHP League]: https://thephpleague.com diff --git a/vendor/league/commonmark/composer.json b/vendor/league/commonmark/composer.json new file mode 100644 index 00000000..9b906620 --- /dev/null +++ b/vendor/league/commonmark/composer.json @@ -0,0 +1,125 @@ +{ + "name": "league/commonmark", + "type": "library", + "description": "Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)", + "keywords": ["markdown","parser","commonmark","gfm","github","flavored","github-flavored","md"], + "homepage": "https://commonmark.thephpleague.com", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Colin O'Dell", + "email": "colinodell@gmail.com", + "homepage": "https://www.colinodell.com", + "role": "Lead Developer" + } + ], + "support": { + "docs": "https://commonmark.thephpleague.com/", + "forum": "https://github.com/thephpleague/commonmark/discussions", + "issues": "https://github.com/thephpleague/commonmark/issues", + "rss": "https://github.com/thephpleague/commonmark/releases.atom", + "source": "https://github.com/thephpleague/commonmark" + }, + "require": { + "php": "^7.4 || ^8.0", + "ext-mbstring": "*", + "league/config": "^1.1.1", + "psr/event-dispatcher": "^1.0", + "symfony/deprecation-contracts": "^2.1 || ^3.0", + "symfony/polyfill-php80": "^1.16" + }, + "require-dev": { + "ext-json": "*", + "cebe/markdown": "^1.0", + "commonmark/cmark": "0.31.1", + "commonmark/commonmark.js": "0.31.1", + "composer/package-versions-deprecated": "^1.8", + "embed/embed": "^4.4", + "erusev/parsedown": "^1.0", + "github/gfm": "0.29.0", + "michelf/php-markdown": "^1.4 || ^2.0", + "nyholm/psr7": "^1.5", + "phpstan/phpstan": "^1.8.2", + "phpunit/phpunit": "^9.5.21 || ^10.5.9 || ^11.0.0", + "scrutinizer/ocular": "^1.8.1", + "symfony/finder": "^5.3 | ^6.0 || ^7.0", + "symfony/yaml": "^2.3 | ^3.0 | ^4.0 | ^5.0 | ^6.0 || ^7.0", + "unleashedtech/php-coding-standard": "^3.1.1", + "vimeo/psalm": "^4.24.0 || ^5.0.0" + }, + "minimum-stability": "beta", + "suggest": { + "symfony/yaml": "v2.3+ required if using the Front Matter extension" + }, + "repositories": [ + { + "type": "package", + "package": { + "name": "commonmark/commonmark.js", + "version": "0.31.1", + "dist": { + "url": "https://github.com/commonmark/commonmark.js/archive/0.31.1.zip", + "type": "zip" + } + } + }, + { + "type": "package", + "package": { + "name": "commonmark/cmark", + "version": "0.31.1", + "dist": { + "url": "https://github.com/commonmark/cmark/archive/0.31.1.zip", + "type": "zip" + } + } + }, + { + "type": "package", + "package": { + "name": "github/gfm", + "version": "0.29.0", + "dist": { + "url": "https://github.com/github/cmark-gfm/archive/0.29.0.gfm.13.zip", + "type": "zip" + } + } + } + ], + "autoload": { + "psr-4": { + "League\\CommonMark\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "League\\CommonMark\\Tests\\Unit\\": "tests/unit", + "League\\CommonMark\\Tests\\Functional\\": "tests/functional", + "League\\CommonMark\\Tests\\PHPStan\\": "tests/phpstan" + } + }, + "scripts": { + "phpcs": "phpcs", + "phpstan": "phpstan analyse", + "phpunit": "phpunit --no-coverage", + "psalm": "psalm --stats", + "test": [ + "@phpcs", + "@phpstan", + "@psalm", + "@phpunit" + ] + }, + "extra": { + "branch-alias": { + "dev-main": "2.6-dev" + } + }, + "config": { + "allow-plugins": { + "composer/package-versions-deprecated": true, + "dealerdirect/phpcodesniffer-composer-installer": true + }, + "sort-packages": true + } +} diff --git a/vendor/league/commonmark/src/CommonMarkConverter.php b/vendor/league/commonmark/src/CommonMarkConverter.php new file mode 100644 index 00000000..4d700534 --- /dev/null +++ b/vendor/league/commonmark/src/CommonMarkConverter.php @@ -0,0 +1,46 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark; + +use League\CommonMark\Environment\Environment; +use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension; + +/** + * Converts CommonMark-compatible Markdown to HTML. + */ +final class CommonMarkConverter extends MarkdownConverter +{ + /** + * Create a new Markdown converter pre-configured for CommonMark + * + * @param array $config + */ + public function __construct(array $config = []) + { + $environment = new Environment($config); + $environment->addExtension(new CommonMarkCoreExtension()); + + parent::__construct($environment); + } + + public function getEnvironment(): Environment + { + \assert($this->environment instanceof Environment); + + return $this->environment; + } +} diff --git a/vendor/league/commonmark/src/ConverterInterface.php b/vendor/league/commonmark/src/ConverterInterface.php new file mode 100644 index 00000000..8192b0fb --- /dev/null +++ b/vendor/league/commonmark/src/ConverterInterface.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 League\CommonMark; + +use League\CommonMark\Exception\CommonMarkException; +use League\CommonMark\Output\RenderedContentInterface; +use League\Config\Exception\ConfigurationExceptionInterface; + +/** + * Interface for a service which converts content from one format (like Markdown) to another (like HTML). + */ +interface ConverterInterface +{ + /** + * @throws CommonMarkException + * @throws ConfigurationExceptionInterface + */ + public function convert(string $input): RenderedContentInterface; +} diff --git a/vendor/league/commonmark/src/Delimiter/Delimiter.php b/vendor/league/commonmark/src/Delimiter/Delimiter.php new file mode 100644 index 00000000..2f04f248 --- /dev/null +++ b/vendor/league/commonmark/src/Delimiter/Delimiter.php @@ -0,0 +1,134 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Delimiter; + +use League\CommonMark\Node\Inline\AbstractStringContainer; + +final class Delimiter implements DelimiterInterface +{ + /** @psalm-readonly */ + private string $char; + + /** @psalm-readonly-allow-private-mutation */ + private int $length; + + /** @psalm-readonly */ + private int $originalLength; + + /** @psalm-readonly */ + private AbstractStringContainer $inlineNode; + + /** @psalm-readonly-allow-private-mutation */ + private ?DelimiterInterface $previous = null; + + /** @psalm-readonly-allow-private-mutation */ + private ?DelimiterInterface $next = null; + + /** @psalm-readonly */ + private bool $canOpen; + + /** @psalm-readonly */ + private bool $canClose; + + /** @psalm-readonly-allow-private-mutation */ + private bool $active; + + /** @psalm-readonly */ + private ?int $index = null; + + public function __construct(string $char, int $numDelims, AbstractStringContainer $node, bool $canOpen, bool $canClose, ?int $index = null) + { + $this->char = $char; + $this->length = $numDelims; + $this->originalLength = $numDelims; + $this->inlineNode = $node; + $this->canOpen = $canOpen; + $this->canClose = $canClose; + $this->active = true; + $this->index = $index; + } + + public function canClose(): bool + { + return $this->canClose; + } + + public function canOpen(): bool + { + return $this->canOpen; + } + + public function isActive(): bool + { + return $this->active; + } + + public function setActive(bool $active): void + { + $this->active = $active; + } + + public function getChar(): string + { + return $this->char; + } + + public function getIndex(): ?int + { + return $this->index; + } + + public function getNext(): ?DelimiterInterface + { + return $this->next; + } + + public function setNext(?DelimiterInterface $next): void + { + $this->next = $next; + } + + public function getLength(): int + { + return $this->length; + } + + public function setLength(int $length): void + { + $this->length = $length; + } + + public function getOriginalLength(): int + { + return $this->originalLength; + } + + public function getInlineNode(): AbstractStringContainer + { + return $this->inlineNode; + } + + public function getPrevious(): ?DelimiterInterface + { + return $this->previous; + } + + public function setPrevious(?DelimiterInterface $previous): void + { + $this->previous = $previous; + } +} diff --git a/vendor/league/commonmark/src/Delimiter/DelimiterInterface.php b/vendor/league/commonmark/src/Delimiter/DelimiterInterface.php new file mode 100644 index 00000000..6bfa32e4 --- /dev/null +++ b/vendor/league/commonmark/src/Delimiter/DelimiterInterface.php @@ -0,0 +1,50 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Delimiter; + +use League\CommonMark\Node\Inline\AbstractStringContainer; + +interface DelimiterInterface +{ + public function canClose(): bool; + + public function canOpen(): bool; + + public function isActive(): bool; + + public function setActive(bool $active): void; + + public function getChar(): string; + + public function getIndex(): ?int; + + public function getNext(): ?DelimiterInterface; + + public function setNext(?DelimiterInterface $next): void; + + public function getLength(): int; + + public function setLength(int $length): void; + + public function getOriginalLength(): int; + + public function getInlineNode(): AbstractStringContainer; + + public function getPrevious(): ?DelimiterInterface; + + public function setPrevious(?DelimiterInterface $previous): void; +} diff --git a/vendor/league/commonmark/src/Delimiter/DelimiterParser.php b/vendor/league/commonmark/src/Delimiter/DelimiterParser.php new file mode 100644 index 00000000..3f96addf --- /dev/null +++ b/vendor/league/commonmark/src/Delimiter/DelimiterParser.php @@ -0,0 +1,102 @@ +collection = $collection; + } + + public function getMatchDefinition(): InlineParserMatch + { + return InlineParserMatch::oneOf(...$this->collection->getDelimiterCharacters()); + } + + public function parse(InlineParserContext $inlineContext): bool + { + $character = $inlineContext->getFullMatch(); + $numDelims = 0; + $cursor = $inlineContext->getCursor(); + $processor = $this->collection->getDelimiterProcessor($character); + + \assert($processor !== null); // Delimiter processor should never be null here + + $charBefore = $cursor->peek(-1); + if ($charBefore === null) { + $charBefore = "\n"; + } + + while ($cursor->peek($numDelims) === $character) { + ++$numDelims; + } + + if ($numDelims < $processor->getMinLength()) { + return false; + } + + $cursor->advanceBy($numDelims); + + $charAfter = $cursor->getCurrentCharacter(); + if ($charAfter === null) { + $charAfter = "\n"; + } + + [$canOpen, $canClose] = self::determineCanOpenOrClose($charBefore, $charAfter, $character, $processor); + + $node = new Text(\str_repeat($character, $numDelims), [ + 'delim' => true, + ]); + $inlineContext->getContainer()->appendChild($node); + + // Add entry to stack to this opener + if ($canOpen || $canClose) { + $delimiter = new Delimiter($character, $numDelims, $node, $canOpen, $canClose); + $inlineContext->getDelimiterStack()->push($delimiter); + } + + return true; + } + + /** + * @return bool[] + */ + private static function determineCanOpenOrClose(string $charBefore, string $charAfter, string $character, DelimiterProcessorInterface $delimiterProcessor): array + { + $afterIsWhitespace = \preg_match(RegexHelper::REGEX_UNICODE_WHITESPACE_CHAR, $charAfter); + $afterIsPunctuation = \preg_match(RegexHelper::REGEX_PUNCTUATION, $charAfter); + $beforeIsWhitespace = \preg_match(RegexHelper::REGEX_UNICODE_WHITESPACE_CHAR, $charBefore); + $beforeIsPunctuation = \preg_match(RegexHelper::REGEX_PUNCTUATION, $charBefore); + + $leftFlanking = ! $afterIsWhitespace && (! $afterIsPunctuation || $beforeIsWhitespace || $beforeIsPunctuation); + $rightFlanking = ! $beforeIsWhitespace && (! $beforeIsPunctuation || $afterIsWhitespace || $afterIsPunctuation); + + if ($character === '_') { + $canOpen = $leftFlanking && (! $rightFlanking || $beforeIsPunctuation); + $canClose = $rightFlanking && (! $leftFlanking || $afterIsPunctuation); + } else { + $canOpen = $leftFlanking && $character === $delimiterProcessor->getOpeningCharacter(); + $canClose = $rightFlanking && $character === $delimiterProcessor->getClosingCharacter(); + } + + return [$canOpen, $canClose]; + } +} diff --git a/vendor/league/commonmark/src/Delimiter/DelimiterStack.php b/vendor/league/commonmark/src/Delimiter/DelimiterStack.php new file mode 100644 index 00000000..fb95b907 --- /dev/null +++ b/vendor/league/commonmark/src/Delimiter/DelimiterStack.php @@ -0,0 +1,214 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * Additional emphasis processing code based on commonmark-java (https://github.com/atlassian/commonmark-java) + * - (c) Atlassian Pty Ltd + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Delimiter; + +use League\CommonMark\Delimiter\Processor\DelimiterProcessorCollection; +use League\CommonMark\Node\Inline\AdjacentTextMerger; + +final class DelimiterStack +{ + /** @psalm-readonly-allow-private-mutation */ + private ?DelimiterInterface $top = null; + + public function push(DelimiterInterface $newDelimiter): void + { + $newDelimiter->setPrevious($this->top); + + if ($this->top !== null) { + $this->top->setNext($newDelimiter); + } + + $this->top = $newDelimiter; + } + + private function findEarliest(?DelimiterInterface $stackBottom = null): ?DelimiterInterface + { + $delimiter = $this->top; + while ($delimiter !== null && $delimiter->getPrevious() !== $stackBottom) { + $delimiter = $delimiter->getPrevious(); + } + + return $delimiter; + } + + public function removeDelimiter(DelimiterInterface $delimiter): void + { + if ($delimiter->getPrevious() !== null) { + /** @psalm-suppress PossiblyNullReference */ + $delimiter->getPrevious()->setNext($delimiter->getNext()); + } + + if ($delimiter->getNext() === null) { + // top of stack + $this->top = $delimiter->getPrevious(); + } else { + /** @psalm-suppress PossiblyNullReference */ + $delimiter->getNext()->setPrevious($delimiter->getPrevious()); + } + } + + private function removeDelimiterAndNode(DelimiterInterface $delimiter): void + { + $delimiter->getInlineNode()->detach(); + $this->removeDelimiter($delimiter); + } + + private function removeDelimitersBetween(DelimiterInterface $opener, DelimiterInterface $closer): void + { + $delimiter = $closer->getPrevious(); + while ($delimiter !== null && $delimiter !== $opener) { + $previous = $delimiter->getPrevious(); + $this->removeDelimiter($delimiter); + $delimiter = $previous; + } + } + + public function removeAll(?DelimiterInterface $stackBottom = null): void + { + while ($this->top && $this->top !== $stackBottom) { + $this->removeDelimiter($this->top); + } + } + + public function removeEarlierMatches(string $character): void + { + $opener = $this->top; + while ($opener !== null) { + if ($opener->getChar() === $character) { + $opener->setActive(false); + } + + $opener = $opener->getPrevious(); + } + } + + /** + * @param string|string[] $characters + */ + public function searchByCharacter($characters): ?DelimiterInterface + { + if (! \is_array($characters)) { + $characters = [$characters]; + } + + $opener = $this->top; + while ($opener !== null) { + if (\in_array($opener->getChar(), $characters, true)) { + break; + } + + $opener = $opener->getPrevious(); + } + + return $opener; + } + + public function processDelimiters(?DelimiterInterface $stackBottom, DelimiterProcessorCollection $processors): void + { + $openersBottom = []; + + // Find first closer above stackBottom + $closer = $this->findEarliest($stackBottom); + + // Move forward, looking for closers, and handling each + while ($closer !== null) { + $delimiterChar = $closer->getChar(); + + $delimiterProcessor = $processors->getDelimiterProcessor($delimiterChar); + if (! $closer->canClose() || $delimiterProcessor === null) { + $closer = $closer->getNext(); + continue; + } + + $openingDelimiterChar = $delimiterProcessor->getOpeningCharacter(); + + $useDelims = 0; + $openerFound = false; + $potentialOpenerFound = false; + $opener = $closer->getPrevious(); + while ($opener !== null && $opener !== $stackBottom && $opener !== ($openersBottom[$delimiterChar] ?? null)) { + if ($opener->canOpen() && $opener->getChar() === $openingDelimiterChar) { + $potentialOpenerFound = true; + $useDelims = $delimiterProcessor->getDelimiterUse($opener, $closer); + if ($useDelims > 0) { + $openerFound = true; + break; + } + } + + $opener = $opener->getPrevious(); + } + + if (! $openerFound) { + if (! $potentialOpenerFound) { + // Only do this when we didn't even have a potential + // opener (one that matches the character and can open). + // If an opener was rejected because of the number of + // delimiters (e.g. because of the "multiple of 3" + // Set lower bound for future searches for openersrule), + // we want to consider it next time because the number + // of delimiters can change as we continue processing. + $openersBottom[$delimiterChar] = $closer->getPrevious(); + if (! $closer->canOpen()) { + // We can remove a closer that can't be an opener, + // once we've seen there's no matching opener. + $this->removeDelimiter($closer); + } + } + + $closer = $closer->getNext(); + continue; + } + + \assert($opener !== null); + + $openerNode = $opener->getInlineNode(); + $closerNode = $closer->getInlineNode(); + + // Remove number of used delimiters from stack and inline nodes. + $opener->setLength($opener->getLength() - $useDelims); + $closer->setLength($closer->getLength() - $useDelims); + + $openerNode->setLiteral(\substr($openerNode->getLiteral(), 0, -$useDelims)); + $closerNode->setLiteral(\substr($closerNode->getLiteral(), 0, -$useDelims)); + + $this->removeDelimitersBetween($opener, $closer); + // The delimiter processor can re-parent the nodes between opener and closer, + // so make sure they're contiguous already. Exclusive because we want to keep opener/closer themselves. + AdjacentTextMerger::mergeTextNodesBetweenExclusive($openerNode, $closerNode); + $delimiterProcessor->process($openerNode, $closerNode, $useDelims); + + // No delimiter characters left to process, so we can remove delimiter and the now empty node. + if ($opener->getLength() === 0) { + $this->removeDelimiterAndNode($opener); + } + + // phpcs:disable SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed + if ($closer->getLength() === 0) { + $next = $closer->getNext(); + $this->removeDelimiterAndNode($closer); + $closer = $next; + } + } + + // Remove all delimiters + $this->removeAll($stackBottom); + } +} diff --git a/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollection.php b/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollection.php new file mode 100644 index 00000000..6e9f3365 --- /dev/null +++ b/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollection.php @@ -0,0 +1,89 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * Additional emphasis processing code based on commonmark-java (https://github.com/atlassian/commonmark-java) + * - (c) Atlassian Pty Ltd + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Delimiter\Processor; + +use League\CommonMark\Exception\InvalidArgumentException; + +final class DelimiterProcessorCollection implements DelimiterProcessorCollectionInterface +{ + /** + * @var array|DelimiterProcessorInterface[] + * + * @psalm-readonly-allow-private-mutation + */ + private array $processorsByChar = []; + + public function add(DelimiterProcessorInterface $processor): void + { + $opening = $processor->getOpeningCharacter(); + $closing = $processor->getClosingCharacter(); + + if ($opening === $closing) { + $old = $this->processorsByChar[$opening] ?? null; + if ($old !== null && $old->getOpeningCharacter() === $old->getClosingCharacter()) { + $this->addStaggeredDelimiterProcessorForChar($opening, $old, $processor); + } else { + $this->addDelimiterProcessorForChar($opening, $processor); + } + } else { + $this->addDelimiterProcessorForChar($opening, $processor); + $this->addDelimiterProcessorForChar($closing, $processor); + } + } + + public function getDelimiterProcessor(string $char): ?DelimiterProcessorInterface + { + return $this->processorsByChar[$char] ?? null; + } + + /** + * @return string[] + */ + public function getDelimiterCharacters(): array + { + return \array_keys($this->processorsByChar); + } + + private function addDelimiterProcessorForChar(string $delimiterChar, DelimiterProcessorInterface $processor): void + { + if (isset($this->processorsByChar[$delimiterChar])) { + throw new InvalidArgumentException(\sprintf('Delim processor for character "%s" already exists', $processor->getOpeningCharacter())); + } + + $this->processorsByChar[$delimiterChar] = $processor; + } + + private function addStaggeredDelimiterProcessorForChar(string $opening, DelimiterProcessorInterface $old, DelimiterProcessorInterface $new): void + { + if ($old instanceof StaggeredDelimiterProcessor) { + $s = $old; + } else { + $s = new StaggeredDelimiterProcessor($opening, $old); + } + + $s->add($new); + $this->processorsByChar[$opening] = $s; + } + + public function count(): int + { + return \count($this->processorsByChar); + } +} diff --git a/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollectionInterface.php b/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollectionInterface.php new file mode 100644 index 00000000..fea3ddbb --- /dev/null +++ b/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorCollectionInterface.php @@ -0,0 +1,46 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * Additional emphasis processing code based on commonmark-java (https://github.com/atlassian/commonmark-java) + * - (c) Atlassian Pty Ltd + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Delimiter\Processor; + +use League\CommonMark\Exception\InvalidArgumentException; + +interface DelimiterProcessorCollectionInterface extends \Countable +{ + /** + * Add the given delim processor to the collection + * + * @param DelimiterProcessorInterface $processor The delim processor to add + * + * @throws InvalidArgumentException Exception will be thrown if attempting to add multiple processors for the same character + */ + public function add(DelimiterProcessorInterface $processor): void; + + /** + * Returns the delim processor which handles the given character if one exists + */ + public function getDelimiterProcessor(string $char): ?DelimiterProcessorInterface; + + /** + * Returns an array of delimiter characters who have associated processors + * + * @return string[] + */ + public function getDelimiterCharacters(): array; +} diff --git a/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorInterface.php b/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorInterface.php new file mode 100644 index 00000000..465378c3 --- /dev/null +++ b/vendor/league/commonmark/src/Delimiter/Processor/DelimiterProcessorInterface.php @@ -0,0 +1,78 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * Additional emphasis processing code based on commonmark-java (https://github.com/atlassian/commonmark-java) + * - (c) Atlassian Pty Ltd + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Delimiter\Processor; + +use League\CommonMark\Delimiter\DelimiterInterface; +use League\CommonMark\Node\Inline\AbstractStringContainer; + +/** + * Interface for a delimiter processor + */ +interface DelimiterProcessorInterface +{ + /** + * Returns the character that marks the beginning of a delimited node. + * + * This must not clash with any other processors being added to the environment. + */ + public function getOpeningCharacter(): string; + + /** + * Returns the character that marks the ending of a delimited node. + * + * This must not clash with any other processors being added to the environment. + * + * Note that for a symmetric delimiter such as "*", this is the same as the opening. + */ + public function getClosingCharacter(): string; + + /** + * Minimum number of delimiter characters that are needed to active this. + * + * Must be at least 1. + */ + public function getMinLength(): int; + + /** + * Determine how many (if any) of the delimiter characters should be used. + * + * This allows implementations to decide how many characters to be used + * based on the properties of the delimiter runs. An implementation can also + * return 0 when it doesn't want to allow this particular combination of + * delimiter runs. + * + * @param DelimiterInterface $opener The opening delimiter run + * @param DelimiterInterface $closer The closing delimiter run + */ + public function getDelimiterUse(DelimiterInterface $opener, DelimiterInterface $closer): int; + + /** + * Process the matched delimiters, e.g. by wrapping the nodes between opener + * and closer in a new node, or appending a new node after the opener. + * + * Note that removal of the delimiter from the delimiter nodes and detaching + * them is done by the caller. + * + * @param AbstractStringContainer $opener The node that contained the opening delimiter + * @param AbstractStringContainer $closer The node that contained the closing delimiter + * @param int $delimiterUse The number of delimiters that were used + */ + public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse): void; +} diff --git a/vendor/league/commonmark/src/Delimiter/Processor/StaggeredDelimiterProcessor.php b/vendor/league/commonmark/src/Delimiter/Processor/StaggeredDelimiterProcessor.php new file mode 100644 index 00000000..7d33e838 --- /dev/null +++ b/vendor/league/commonmark/src/Delimiter/Processor/StaggeredDelimiterProcessor.php @@ -0,0 +1,111 @@ + + * + * Additional emphasis processing code based on commonmark-java (https://github.com/atlassian/commonmark-java) + * - (c) Atlassian Pty Ltd + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Delimiter\Processor; + +use League\CommonMark\Delimiter\DelimiterInterface; +use League\CommonMark\Exception\InvalidArgumentException; +use League\CommonMark\Node\Inline\AbstractStringContainer; + +/** + * An implementation of DelimiterProcessorInterface that dispatches all calls to two or more other DelimiterProcessors + * depending on the length of the delimiter run. All child DelimiterProcessors must have different minimum + * lengths. A given delimiter run is dispatched to the child with the largest acceptable minimum length. If no + * child is applicable, the one with the largest minimum length is chosen. + * + * @internal + */ +final class StaggeredDelimiterProcessor implements DelimiterProcessorInterface +{ + /** @psalm-readonly */ + private string $delimiterChar; + + /** @psalm-readonly-allow-private-mutation */ + private int $minLength = 0; + + /** + * @var array|DelimiterProcessorInterface[] + * + * @psalm-readonly-allow-private-mutation + */ + private array $processors = []; // keyed by minLength in reverse order + + public function __construct(string $char, DelimiterProcessorInterface $processor) + { + $this->delimiterChar = $char; + $this->add($processor); + } + + public function getOpeningCharacter(): string + { + return $this->delimiterChar; + } + + public function getClosingCharacter(): string + { + return $this->delimiterChar; + } + + public function getMinLength(): int + { + return $this->minLength; + } + + /** + * Adds the given processor to this staggered delimiter processor + * + * @throws InvalidArgumentException if attempting to add another processors for the same character and minimum length + */ + public function add(DelimiterProcessorInterface $processor): void + { + $len = $processor->getMinLength(); + + if (isset($this->processors[$len])) { + throw new InvalidArgumentException(\sprintf('Cannot add two delimiter processors for char "%s" and minimum length %d', $this->delimiterChar, $len)); + } + + $this->processors[$len] = $processor; + \krsort($this->processors); + + $this->minLength = \min($this->minLength, $len); + } + + public function getDelimiterUse(DelimiterInterface $opener, DelimiterInterface $closer): int + { + return $this->findProcessor($opener->getLength())->getDelimiterUse($opener, $closer); + } + + public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse): void + { + $this->findProcessor($delimiterUse)->process($opener, $closer, $delimiterUse); + } + + private function findProcessor(int $len): DelimiterProcessorInterface + { + // Find the "longest" processor which can handle this length + foreach ($this->processors as $processor) { + if ($processor->getMinLength() <= $len) { + return $processor; + } + } + + // Just use the first one in our list + $first = \reset($this->processors); + \assert($first instanceof DelimiterProcessorInterface); + + return $first; + } +} diff --git a/vendor/league/commonmark/src/Environment/Environment.php b/vendor/league/commonmark/src/Environment/Environment.php new file mode 100644 index 00000000..3c24749b --- /dev/null +++ b/vendor/league/commonmark/src/Environment/Environment.php @@ -0,0 +1,447 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Environment; + +use League\CommonMark\Delimiter\DelimiterParser; +use League\CommonMark\Delimiter\Processor\DelimiterProcessorCollection; +use League\CommonMark\Delimiter\Processor\DelimiterProcessorInterface; +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Event\ListenerData; +use League\CommonMark\Exception\AlreadyInitializedException; +use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension; +use League\CommonMark\Extension\ConfigurableExtensionInterface; +use League\CommonMark\Extension\ExtensionInterface; +use League\CommonMark\Extension\GithubFlavoredMarkdownExtension; +use League\CommonMark\Normalizer\SlugNormalizer; +use League\CommonMark\Normalizer\TextNormalizerInterface; +use League\CommonMark\Normalizer\UniqueSlugNormalizer; +use League\CommonMark\Normalizer\UniqueSlugNormalizerInterface; +use League\CommonMark\Parser\Block\BlockStartParserInterface; +use League\CommonMark\Parser\Block\SkipLinesStartingWithLettersParser; +use League\CommonMark\Parser\Inline\InlineParserInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlFilter; +use League\CommonMark\Util\PrioritizedList; +use League\Config\Configuration; +use League\Config\ConfigurationAwareInterface; +use League\Config\ConfigurationInterface; +use Nette\Schema\Expect; +use Psr\EventDispatcher\EventDispatcherInterface; +use Psr\EventDispatcher\ListenerProviderInterface; +use Psr\EventDispatcher\StoppableEventInterface; + +final class Environment implements EnvironmentInterface, EnvironmentBuilderInterface, ListenerProviderInterface +{ + /** + * @var ExtensionInterface[] + * + * @psalm-readonly-allow-private-mutation + */ + private array $extensions = []; + + /** + * @var ExtensionInterface[] + * + * @psalm-readonly-allow-private-mutation + */ + private array $uninitializedExtensions = []; + + /** @psalm-readonly-allow-private-mutation */ + private bool $extensionsInitialized = false; + + /** + * @var PrioritizedList + * + * @psalm-readonly + */ + private PrioritizedList $blockStartParsers; + + /** + * @var PrioritizedList + * + * @psalm-readonly + */ + private PrioritizedList $inlineParsers; + + /** @psalm-readonly */ + private DelimiterProcessorCollection $delimiterProcessors; + + /** + * @var array> + * + * @psalm-readonly-allow-private-mutation + */ + private array $renderersByClass = []; + + /** + * @var PrioritizedList + * + * @psalm-readonly-allow-private-mutation + */ + private PrioritizedList $listenerData; + + private ?EventDispatcherInterface $eventDispatcher = null; + + /** @psalm-readonly */ + private Configuration $config; + + private ?TextNormalizerInterface $slugNormalizer = null; + + /** + * @param array $config + */ + public function __construct(array $config = []) + { + $this->config = self::createDefaultConfiguration(); + $this->config->merge($config); + + $this->blockStartParsers = new PrioritizedList(); + $this->inlineParsers = new PrioritizedList(); + $this->listenerData = new PrioritizedList(); + $this->delimiterProcessors = new DelimiterProcessorCollection(); + + // Performance optimization: always include a block "parser" that aborts parsing if a line starts with a letter + // and is therefore unlikely to match any lines as a block start. + $this->addBlockStartParser(new SkipLinesStartingWithLettersParser(), 249); + } + + public function getConfiguration(): ConfigurationInterface + { + return $this->config->reader(); + } + + /** + * @deprecated Environment::mergeConfig() is deprecated since league/commonmark v2.0 and will be removed in v3.0. Configuration should be set when instantiating the environment instead. + * + * @param array $config + */ + public function mergeConfig(array $config): void + { + @\trigger_error('Environment::mergeConfig() is deprecated since league/commonmark v2.0 and will be removed in v3.0. Configuration should be set when instantiating the environment instead.', \E_USER_DEPRECATED); + + $this->assertUninitialized('Failed to modify configuration.'); + + $this->config->merge($config); + } + + public function addBlockStartParser(BlockStartParserInterface $parser, int $priority = 0): EnvironmentBuilderInterface + { + $this->assertUninitialized('Failed to add block start parser.'); + + $this->blockStartParsers->add($parser, $priority); + $this->injectEnvironmentAndConfigurationIfNeeded($parser); + + return $this; + } + + public function addInlineParser(InlineParserInterface $parser, int $priority = 0): EnvironmentBuilderInterface + { + $this->assertUninitialized('Failed to add inline parser.'); + + $this->inlineParsers->add($parser, $priority); + $this->injectEnvironmentAndConfigurationIfNeeded($parser); + + return $this; + } + + public function addDelimiterProcessor(DelimiterProcessorInterface $processor): EnvironmentBuilderInterface + { + $this->assertUninitialized('Failed to add delimiter processor.'); + $this->delimiterProcessors->add($processor); + $this->injectEnvironmentAndConfigurationIfNeeded($processor); + + return $this; + } + + public function addRenderer(string $nodeClass, NodeRendererInterface $renderer, int $priority = 0): EnvironmentBuilderInterface + { + $this->assertUninitialized('Failed to add renderer.'); + + if (! isset($this->renderersByClass[$nodeClass])) { + $this->renderersByClass[$nodeClass] = new PrioritizedList(); + } + + $this->renderersByClass[$nodeClass]->add($renderer, $priority); + $this->injectEnvironmentAndConfigurationIfNeeded($renderer); + + return $this; + } + + /** + * {@inheritDoc} + */ + public function getBlockStartParsers(): iterable + { + if (! $this->extensionsInitialized) { + $this->initializeExtensions(); + } + + return $this->blockStartParsers->getIterator(); + } + + public function getDelimiterProcessors(): DelimiterProcessorCollection + { + if (! $this->extensionsInitialized) { + $this->initializeExtensions(); + } + + return $this->delimiterProcessors; + } + + /** + * {@inheritDoc} + */ + public function getRenderersForClass(string $nodeClass): iterable + { + if (! $this->extensionsInitialized) { + $this->initializeExtensions(); + } + + // If renderers are defined for this specific class, return them immediately + if (isset($this->renderersByClass[$nodeClass])) { + return $this->renderersByClass[$nodeClass]; + } + + /** @psalm-suppress TypeDoesNotContainType -- Bug: https://github.com/vimeo/psalm/issues/3332 */ + while (\class_exists($parent ??= $nodeClass) && $parent = \get_parent_class($parent)) { + if (! isset($this->renderersByClass[$parent])) { + continue; + } + + // "Cache" this result to avoid future loops + return $this->renderersByClass[$nodeClass] = $this->renderersByClass[$parent]; + } + + return []; + } + + /** + * {@inheritDoc} + */ + public function getExtensions(): iterable + { + return $this->extensions; + } + + /** + * Add a single extension + * + * @return $this + */ + public function addExtension(ExtensionInterface $extension): EnvironmentBuilderInterface + { + $this->assertUninitialized('Failed to add extension.'); + + $this->extensions[] = $extension; + $this->uninitializedExtensions[] = $extension; + + if ($extension instanceof ConfigurableExtensionInterface) { + $extension->configureSchema($this->config); + } + + return $this; + } + + private function initializeExtensions(): void + { + // Initialize the slug normalizer + $this->getSlugNormalizer(); + + // Ask all extensions to register their components + while (\count($this->uninitializedExtensions) > 0) { + foreach ($this->uninitializedExtensions as $i => $extension) { + $extension->register($this); + unset($this->uninitializedExtensions[$i]); + } + } + + $this->extensionsInitialized = true; + + // Create the special delimiter parser if any processors were registered + if ($this->delimiterProcessors->count() > 0) { + $this->inlineParsers->add(new DelimiterParser($this->delimiterProcessors), PHP_INT_MIN); + } + } + + private function injectEnvironmentAndConfigurationIfNeeded(object $object): void + { + if ($object instanceof EnvironmentAwareInterface) { + $object->setEnvironment($this); + } + + if ($object instanceof ConfigurationAwareInterface) { + $object->setConfiguration($this->config->reader()); + } + } + + /** + * @deprecated Instantiate the environment and add the extension yourself + * + * @param array $config + */ + public static function createCommonMarkEnvironment(array $config = []): Environment + { + $environment = new self($config); + $environment->addExtension(new CommonMarkCoreExtension()); + + return $environment; + } + + /** + * @deprecated Instantiate the environment and add the extension yourself + * + * @param array $config + */ + public static function createGFMEnvironment(array $config = []): Environment + { + $environment = new self($config); + $environment->addExtension(new CommonMarkCoreExtension()); + $environment->addExtension(new GithubFlavoredMarkdownExtension()); + + return $environment; + } + + public function addEventListener(string $eventClass, callable $listener, int $priority = 0): EnvironmentBuilderInterface + { + $this->assertUninitialized('Failed to add event listener.'); + + $this->listenerData->add(new ListenerData($eventClass, $listener), $priority); + + if (\is_object($listener)) { + $this->injectEnvironmentAndConfigurationIfNeeded($listener); + } elseif (\is_array($listener) && \is_object($listener[0])) { + $this->injectEnvironmentAndConfigurationIfNeeded($listener[0]); + } + + return $this; + } + + public function dispatch(object $event): object + { + if (! $this->extensionsInitialized) { + $this->initializeExtensions(); + } + + if ($this->eventDispatcher !== null) { + return $this->eventDispatcher->dispatch($event); + } + + foreach ($this->getListenersForEvent($event) as $listener) { + if ($event instanceof StoppableEventInterface && $event->isPropagationStopped()) { + return $event; + } + + $listener($event); + } + + return $event; + } + + public function setEventDispatcher(EventDispatcherInterface $dispatcher): void + { + $this->eventDispatcher = $dispatcher; + } + + /** + * {@inheritDoc} + * + * @return iterable + */ + public function getListenersForEvent(object $event): iterable + { + foreach ($this->listenerData as $listenerData) { + \assert($listenerData instanceof ListenerData); + + /** @psalm-suppress ArgumentTypeCoercion */ + if (! \is_a($event, $listenerData->getEvent())) { + continue; + } + + yield function (object $event) use ($listenerData) { + if (! $this->extensionsInitialized) { + $this->initializeExtensions(); + } + + return \call_user_func($listenerData->getListener(), $event); + }; + } + } + + /** + * @return iterable + */ + public function getInlineParsers(): iterable + { + if (! $this->extensionsInitialized) { + $this->initializeExtensions(); + } + + return $this->inlineParsers->getIterator(); + } + + public function getSlugNormalizer(): TextNormalizerInterface + { + if ($this->slugNormalizer === null) { + $normalizer = $this->config->get('slug_normalizer/instance'); + \assert($normalizer instanceof TextNormalizerInterface); + $this->injectEnvironmentAndConfigurationIfNeeded($normalizer); + + if ($this->config->get('slug_normalizer/unique') !== UniqueSlugNormalizerInterface::DISABLED && ! $normalizer instanceof UniqueSlugNormalizer) { + $normalizer = new UniqueSlugNormalizer($normalizer); + } + + if ($normalizer instanceof UniqueSlugNormalizer) { + if ($this->config->get('slug_normalizer/unique') === UniqueSlugNormalizerInterface::PER_DOCUMENT) { + $this->addEventListener(DocumentParsedEvent::class, [$normalizer, 'clearHistory'], -1000); + } + } + + $this->slugNormalizer = $normalizer; + } + + return $this->slugNormalizer; + } + + /** + * @throws AlreadyInitializedException + */ + private function assertUninitialized(string $message): void + { + if ($this->extensionsInitialized) { + throw new AlreadyInitializedException($message . ' Extensions have already been initialized.'); + } + } + + public static function createDefaultConfiguration(): Configuration + { + return new Configuration([ + 'html_input' => Expect::anyOf(HtmlFilter::STRIP, HtmlFilter::ALLOW, HtmlFilter::ESCAPE)->default(HtmlFilter::ALLOW), + 'allow_unsafe_links' => Expect::bool(true), + 'max_nesting_level' => Expect::type('int')->default(PHP_INT_MAX), + 'renderer' => Expect::structure([ + 'block_separator' => Expect::string("\n"), + 'inner_separator' => Expect::string("\n"), + 'soft_break' => Expect::string("\n"), + ]), + 'slug_normalizer' => Expect::structure([ + 'instance' => Expect::type(TextNormalizerInterface::class)->default(new SlugNormalizer()), + 'max_length' => Expect::int()->min(0)->default(255), + 'unique' => Expect::anyOf(UniqueSlugNormalizerInterface::DISABLED, UniqueSlugNormalizerInterface::PER_ENVIRONMENT, UniqueSlugNormalizerInterface::PER_DOCUMENT)->default(UniqueSlugNormalizerInterface::PER_DOCUMENT), + ]), + ]); + } +} diff --git a/vendor/league/commonmark/src/Environment/EnvironmentAwareInterface.php b/vendor/league/commonmark/src/Environment/EnvironmentAwareInterface.php new file mode 100644 index 00000000..44b9d3ec --- /dev/null +++ b/vendor/league/commonmark/src/Environment/EnvironmentAwareInterface.php @@ -0,0 +1,19 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Environment; + +interface EnvironmentAwareInterface +{ + public function setEnvironment(EnvironmentInterface $environment): void; +} diff --git a/vendor/league/commonmark/src/Environment/EnvironmentBuilderInterface.php b/vendor/league/commonmark/src/Environment/EnvironmentBuilderInterface.php new file mode 100644 index 00000000..4df9761b --- /dev/null +++ b/vendor/league/commonmark/src/Environment/EnvironmentBuilderInterface.php @@ -0,0 +1,97 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Environment; + +use League\CommonMark\Delimiter\Processor\DelimiterProcessorInterface; +use League\CommonMark\Exception\AlreadyInitializedException; +use League\CommonMark\Extension\ExtensionInterface; +use League\CommonMark\Node\Node; +use League\CommonMark\Parser\Block\BlockStartParserInterface; +use League\CommonMark\Parser\Inline\InlineParserInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\Config\ConfigurationProviderInterface; + +/** + * Interface for building the Environment with any extensions, parsers, listeners, etc. that it may need + */ +interface EnvironmentBuilderInterface extends ConfigurationProviderInterface +{ + /** + * Registers the given extension with the Environment + * + * @throws AlreadyInitializedException if the Environment has already been initialized + */ + public function addExtension(ExtensionInterface $extension): EnvironmentBuilderInterface; + + /** + * Registers the given block start parser with the Environment + * + * @param BlockStartParserInterface $parser Block parser instance + * @param int $priority Priority (a higher number will be executed earlier) + * + * @return $this + * + * @throws AlreadyInitializedException if the Environment has already been initialized + */ + public function addBlockStartParser(BlockStartParserInterface $parser, int $priority = 0): EnvironmentBuilderInterface; + + /** + * Registers the given inline parser with the Environment + * + * @param InlineParserInterface $parser Inline parser instance + * @param int $priority Priority (a higher number will be executed earlier) + * + * @return $this + * + * @throws AlreadyInitializedException if the Environment has already been initialized + */ + public function addInlineParser(InlineParserInterface $parser, int $priority = 0): EnvironmentBuilderInterface; + + /** + * Registers the given delimiter processor with the Environment + * + * @param DelimiterProcessorInterface $processor Delimiter processors instance + * + * @throws AlreadyInitializedException if the Environment has already been initialized + */ + public function addDelimiterProcessor(DelimiterProcessorInterface $processor): EnvironmentBuilderInterface; + + /** + * Registers the given node renderer with the Environment + * + * @param string $nodeClass The fully-qualified node element class name the renderer below should handle + * @param NodeRendererInterface $renderer The renderer responsible for rendering the type of element given above + * @param int $priority Priority (a higher number will be executed earlier) + * + * @psalm-param class-string $nodeClass + * + * @return $this + * + * @throws AlreadyInitializedException if the Environment has already been initialized + */ + public function addRenderer(string $nodeClass, NodeRendererInterface $renderer, int $priority = 0): EnvironmentBuilderInterface; + + /** + * Registers the given event listener + * + * @param class-string $eventClass Fully-qualified class name of the event this listener should respond to + * @param callable $listener Listener to be executed + * @param int $priority Priority (a higher number will be executed earlier) + * + * @return $this + * + * @throws AlreadyInitializedException if the Environment has already been initialized + */ + public function addEventListener(string $eventClass, callable $listener, int $priority = 0): EnvironmentBuilderInterface; +} diff --git a/vendor/league/commonmark/src/Environment/EnvironmentInterface.php b/vendor/league/commonmark/src/Environment/EnvironmentInterface.php new file mode 100644 index 00000000..8e19a527 --- /dev/null +++ b/vendor/league/commonmark/src/Environment/EnvironmentInterface.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Environment; + +use League\CommonMark\Delimiter\Processor\DelimiterProcessorCollection; +use League\CommonMark\Extension\ExtensionInterface; +use League\CommonMark\Node\Node; +use League\CommonMark\Normalizer\TextNormalizerInterface; +use League\CommonMark\Parser\Block\BlockStartParserInterface; +use League\CommonMark\Parser\Inline\InlineParserInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\Config\ConfigurationProviderInterface; +use Psr\EventDispatcher\EventDispatcherInterface; + +interface EnvironmentInterface extends ConfigurationProviderInterface, EventDispatcherInterface +{ + /** + * Get all registered extensions + * + * @return ExtensionInterface[] + */ + public function getExtensions(): iterable; + + /** + * @return iterable + */ + public function getBlockStartParsers(): iterable; + + /** + * @return iterable + */ + public function getInlineParsers(): iterable; + + public function getDelimiterProcessors(): DelimiterProcessorCollection; + + /** + * @psalm-param class-string $nodeClass + * + * @return iterable + */ + public function getRenderersForClass(string $nodeClass): iterable; + + public function getSlugNormalizer(): TextNormalizerInterface; +} diff --git a/vendor/league/commonmark/src/Event/AbstractEvent.php b/vendor/league/commonmark/src/Event/AbstractEvent.php new file mode 100644 index 00000000..8c83f922 --- /dev/null +++ b/vendor/league/commonmark/src/Event/AbstractEvent.php @@ -0,0 +1,54 @@ + + * + * Original code based on the Symfony EventDispatcher "Event" contract + * - (c) 2018-2019 Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Event; + +use Psr\EventDispatcher\StoppableEventInterface; + +/** + * Base class for classes containing event data. + * + * This class contains no event data. It is used by events that do not pass + * state information to an event handler when an event is raised. + * + * You can call the method stopPropagation() to abort the execution of + * further listeners in your event listener. + */ +abstract class AbstractEvent implements StoppableEventInterface +{ + /** @psalm-readonly-allow-private-mutation */ + private bool $propagationStopped = false; + + /** + * Returns whether further event listeners should be triggered. + */ + final public function isPropagationStopped(): bool + { + return $this->propagationStopped; + } + + /** + * Stops the propagation of the event to further event listeners. + * + * If multiple event listeners are connected to the same event, no + * further event listener will be triggered once any trigger calls + * stopPropagation(). + */ + final public function stopPropagation(): void + { + $this->propagationStopped = true; + } +} diff --git a/vendor/league/commonmark/src/Event/DocumentParsedEvent.php b/vendor/league/commonmark/src/Event/DocumentParsedEvent.php new file mode 100644 index 00000000..04664c5a --- /dev/null +++ b/vendor/league/commonmark/src/Event/DocumentParsedEvent.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Event; + +use League\CommonMark\Node\Block\Document; + +/** + * Event dispatched when the document has been fully parsed + */ +final class DocumentParsedEvent extends AbstractEvent +{ + /** @psalm-readonly */ + private Document $document; + + public function __construct(Document $document) + { + $this->document = $document; + } + + public function getDocument(): Document + { + return $this->document; + } +} diff --git a/vendor/league/commonmark/src/Event/DocumentPreParsedEvent.php b/vendor/league/commonmark/src/Event/DocumentPreParsedEvent.php new file mode 100644 index 00000000..ad725124 --- /dev/null +++ b/vendor/league/commonmark/src/Event/DocumentPreParsedEvent.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 League\CommonMark\Event; + +use League\CommonMark\Input\MarkdownInputInterface; +use League\CommonMark\Node\Block\Document; + +/** + * Event dispatched when the document is about to be parsed + */ +final class DocumentPreParsedEvent extends AbstractEvent +{ + /** @psalm-readonly */ + private Document $document; + + private MarkdownInputInterface $markdown; + + public function __construct(Document $document, MarkdownInputInterface $markdown) + { + $this->document = $document; + $this->markdown = $markdown; + } + + public function getDocument(): Document + { + return $this->document; + } + + public function getMarkdown(): MarkdownInputInterface + { + return $this->markdown; + } + + public function replaceMarkdown(MarkdownInputInterface $markdownInput): void + { + $this->markdown = $markdownInput; + } +} diff --git a/vendor/league/commonmark/src/Event/DocumentPreRenderEvent.php b/vendor/league/commonmark/src/Event/DocumentPreRenderEvent.php new file mode 100644 index 00000000..c569ca33 --- /dev/null +++ b/vendor/league/commonmark/src/Event/DocumentPreRenderEvent.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Event; + +use League\CommonMark\Node\Block\Document; + +/** + * Event dispatched just before rendering begins + */ +final class DocumentPreRenderEvent extends AbstractEvent +{ + /** @psalm-readonly */ + private Document $document; + + /** @psalm-readonly */ + private string $format; + + public function __construct(Document $document, string $format) + { + $this->document = $document; + $this->format = $format; + } + + public function getDocument(): Document + { + return $this->document; + } + + public function getFormat(): string + { + return $this->format; + } +} diff --git a/vendor/league/commonmark/src/Event/DocumentRenderedEvent.php b/vendor/league/commonmark/src/Event/DocumentRenderedEvent.php new file mode 100644 index 00000000..7e49d01f --- /dev/null +++ b/vendor/league/commonmark/src/Event/DocumentRenderedEvent.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Event; + +use League\CommonMark\Output\RenderedContentInterface; + +final class DocumentRenderedEvent extends AbstractEvent +{ + private RenderedContentInterface $output; + + public function __construct(RenderedContentInterface $output) + { + $this->output = $output; + } + + /** + * @psalm-mutation-free + */ + public function getOutput(): RenderedContentInterface + { + return $this->output; + } + + /** + * @psalm-external-mutation-free + */ + public function replaceOutput(RenderedContentInterface $output): void + { + $this->output = $output; + } +} diff --git a/vendor/league/commonmark/src/Event/ListenerData.php b/vendor/league/commonmark/src/Event/ListenerData.php new file mode 100644 index 00000000..4cf3b3a3 --- /dev/null +++ b/vendor/league/commonmark/src/Event/ListenerData.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Event; + +/** + * @internal + * + * @psalm-immutable + */ +final class ListenerData +{ + /** @var class-string */ + private string $event; + + /** @var callable */ + private $listener; + + /** + * @param class-string $event + */ + public function __construct(string $event, callable $listener) + { + $this->event = $event; + $this->listener = $listener; + } + + /** + * @return class-string + */ + public function getEvent(): string + { + return $this->event; + } + + public function getListener(): callable + { + return $this->listener; + } +} diff --git a/vendor/league/commonmark/src/Exception/AlreadyInitializedException.php b/vendor/league/commonmark/src/Exception/AlreadyInitializedException.php new file mode 100644 index 00000000..5faa6f80 --- /dev/null +++ b/vendor/league/commonmark/src/Exception/AlreadyInitializedException.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Exception; + +class AlreadyInitializedException extends LogicException implements CommonMarkException +{ +} diff --git a/vendor/league/commonmark/src/Exception/CommonMarkException.php b/vendor/league/commonmark/src/Exception/CommonMarkException.php new file mode 100644 index 00000000..9fb349ef --- /dev/null +++ b/vendor/league/commonmark/src/Exception/CommonMarkException.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 League\CommonMark\Exception; + +/** + * Marker interface for all exceptions thrown by this library. + */ +interface CommonMarkException extends \Throwable +{ +} diff --git a/vendor/league/commonmark/src/Exception/IOException.php b/vendor/league/commonmark/src/Exception/IOException.php new file mode 100644 index 00000000..09a55782 --- /dev/null +++ b/vendor/league/commonmark/src/Exception/IOException.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Exception; + +class IOException extends \RuntimeException implements CommonMarkException +{ +} diff --git a/vendor/league/commonmark/src/Exception/InvalidArgumentException.php b/vendor/league/commonmark/src/Exception/InvalidArgumentException.php new file mode 100644 index 00000000..fc67ac42 --- /dev/null +++ b/vendor/league/commonmark/src/Exception/InvalidArgumentException.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Exception; + +class InvalidArgumentException extends \InvalidArgumentException implements CommonMarkException +{ +} diff --git a/vendor/league/commonmark/src/Exception/LogicException.php b/vendor/league/commonmark/src/Exception/LogicException.php new file mode 100644 index 00000000..c1d00df5 --- /dev/null +++ b/vendor/league/commonmark/src/Exception/LogicException.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Exception; + +class LogicException extends \LogicException implements CommonMarkException +{ +} diff --git a/vendor/league/commonmark/src/Exception/MissingDependencyException.php b/vendor/league/commonmark/src/Exception/MissingDependencyException.php new file mode 100644 index 00000000..b8eb8419 --- /dev/null +++ b/vendor/league/commonmark/src/Exception/MissingDependencyException.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Exception; + +class MissingDependencyException extends \RuntimeException implements CommonMarkException +{ +} diff --git a/vendor/league/commonmark/src/Exception/UnexpectedEncodingException.php b/vendor/league/commonmark/src/Exception/UnexpectedEncodingException.php new file mode 100644 index 00000000..0f4e3999 --- /dev/null +++ b/vendor/league/commonmark/src/Exception/UnexpectedEncodingException.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Exception; + +final class UnexpectedEncodingException extends \RuntimeException implements CommonMarkException +{ +} diff --git a/vendor/league/commonmark/src/Extension/Attributes/AttributesExtension.php b/vendor/league/commonmark/src/Extension/Attributes/AttributesExtension.php new file mode 100644 index 00000000..2ef3d85c --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Attributes/AttributesExtension.php @@ -0,0 +1,32 @@ + + * (c) 2015 Martin Hasoň + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Attributes; + +use League\CommonMark\Environment\EnvironmentBuilderInterface; +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\Attributes\Event\AttributesListener; +use League\CommonMark\Extension\Attributes\Parser\AttributesBlockStartParser; +use League\CommonMark\Extension\Attributes\Parser\AttributesInlineParser; +use League\CommonMark\Extension\ExtensionInterface; + +final class AttributesExtension implements ExtensionInterface +{ + public function register(EnvironmentBuilderInterface $environment): void + { + $environment->addBlockStartParser(new AttributesBlockStartParser()); + $environment->addInlineParser(new AttributesInlineParser()); + $environment->addEventListener(DocumentParsedEvent::class, [new AttributesListener(), 'processDocument']); + } +} diff --git a/vendor/league/commonmark/src/Extension/Attributes/Event/AttributesListener.php b/vendor/league/commonmark/src/Extension/Attributes/Event/AttributesListener.php new file mode 100644 index 00000000..feec8cce --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Attributes/Event/AttributesListener.php @@ -0,0 +1,139 @@ + + * (c) 2015 Martin Hasoň + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Attributes\Event; + +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\Attributes\Node\Attributes; +use League\CommonMark\Extension\Attributes\Node\AttributesInline; +use League\CommonMark\Extension\Attributes\Util\AttributesHelper; +use League\CommonMark\Extension\CommonMark\Node\Block\FencedCode; +use League\CommonMark\Extension\CommonMark\Node\Block\ListBlock; +use League\CommonMark\Extension\CommonMark\Node\Block\ListItem; +use League\CommonMark\Node\Inline\AbstractInline; +use League\CommonMark\Node\Node; + +final class AttributesListener +{ + private const DIRECTION_PREFIX = 'prefix'; + private const DIRECTION_SUFFIX = 'suffix'; + + public function processDocument(DocumentParsedEvent $event): void + { + foreach ($event->getDocument()->iterator() as $node) { + if (! ($node instanceof Attributes || $node instanceof AttributesInline)) { + continue; + } + + [$target, $direction] = self::findTargetAndDirection($node); + + if ($target instanceof Node) { + $parent = $target->parent(); + if ($parent instanceof ListItem && $parent->parent() instanceof ListBlock && $parent->parent()->isTight()) { + $target = $parent; + } + + if ($direction === self::DIRECTION_SUFFIX) { + $attributes = AttributesHelper::mergeAttributes($target, $node->getAttributes()); + } else { + $attributes = AttributesHelper::mergeAttributes($node->getAttributes(), $target); + } + + $target->data->set('attributes', $attributes); + } + + $node->detach(); + } + } + + /** + * @param Attributes|AttributesInline $node + * + * @return array + */ + private static function findTargetAndDirection($node): array + { + $target = null; + $direction = null; + $previous = $next = $node; + while (true) { + $previous = self::getPrevious($previous); + $next = self::getNext($next); + + if ($previous === null && $next === null) { + if (! $node->parent() instanceof FencedCode) { + $target = $node->parent(); + $direction = self::DIRECTION_SUFFIX; + } + + break; + } + + if ($node instanceof AttributesInline && ($previous === null || ($previous instanceof AbstractInline && $node->isBlock()))) { + continue; + } + + if ($previous !== null && ! self::isAttributesNode($previous)) { + $target = $previous; + $direction = self::DIRECTION_SUFFIX; + + break; + } + + if ($next !== null && ! self::isAttributesNode($next)) { + $target = $next; + $direction = self::DIRECTION_PREFIX; + + break; + } + } + + return [$target, $direction]; + } + + /** + * Get any previous block (sibling or parent) this might apply to + */ + private static function getPrevious(?Node $node = null): ?Node + { + if ($node instanceof Attributes) { + if ($node->getTarget() === Attributes::TARGET_NEXT) { + return null; + } + + if ($node->getTarget() === Attributes::TARGET_PARENT) { + return $node->parent(); + } + } + + return $node instanceof Node ? $node->previous() : null; + } + + /** + * Get any previous block (sibling or parent) this might apply to + */ + private static function getNext(?Node $node = null): ?Node + { + if ($node instanceof Attributes && $node->getTarget() !== Attributes::TARGET_NEXT) { + return null; + } + + return $node instanceof Node ? $node->next() : null; + } + + private static function isAttributesNode(Node $node): bool + { + return $node instanceof Attributes || $node instanceof AttributesInline; + } +} diff --git a/vendor/league/commonmark/src/Extension/Attributes/Node/Attributes.php b/vendor/league/commonmark/src/Extension/Attributes/Node/Attributes.php new file mode 100644 index 00000000..096f04af --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Attributes/Node/Attributes.php @@ -0,0 +1,65 @@ + + * (c) 2015 Martin Hasoň + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Attributes\Node; + +use League\CommonMark\Node\Block\AbstractBlock; + +final class Attributes extends AbstractBlock +{ + public const TARGET_PARENT = 0; + public const TARGET_PREVIOUS = 1; + public const TARGET_NEXT = 2; + + /** @var array */ + private array $attributes; + + private int $target = self::TARGET_NEXT; + + /** + * @param array $attributes + */ + public function __construct(array $attributes) + { + parent::__construct(); + + $this->attributes = $attributes; + } + + /** + * @return array + */ + public function getAttributes(): array + { + return $this->attributes; + } + + /** + * @param array $attributes + */ + public function setAttributes(array $attributes): void + { + $this->attributes = $attributes; + } + + public function getTarget(): int + { + return $this->target; + } + + public function setTarget(int $target): void + { + $this->target = $target; + } +} diff --git a/vendor/league/commonmark/src/Extension/Attributes/Node/AttributesInline.php b/vendor/league/commonmark/src/Extension/Attributes/Node/AttributesInline.php new file mode 100644 index 00000000..d8b0d08f --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Attributes/Node/AttributesInline.php @@ -0,0 +1,57 @@ + + * (c) 2015 Martin Hasoň + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Attributes\Node; + +use League\CommonMark\Node\Inline\AbstractInline; + +final class AttributesInline extends AbstractInline +{ + /** @var array */ + private array $attributes; + + private bool $block; + + /** + * @param array $attributes + */ + public function __construct(array $attributes, bool $block) + { + parent::__construct(); + + $this->attributes = $attributes; + $this->block = $block; + } + + /** + * @return array + */ + public function getAttributes(): array + { + return $this->attributes; + } + + /** + * @param array $attributes + */ + public function setAttributes(array $attributes): void + { + $this->attributes = $attributes; + } + + public function isBlock(): bool + { + return $this->block; + } +} diff --git a/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesBlockContinueParser.php b/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesBlockContinueParser.php new file mode 100644 index 00000000..6e0cdc6e --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesBlockContinueParser.php @@ -0,0 +1,92 @@ + + * (c) 2015 Martin Hasoň + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Attributes\Parser; + +use League\CommonMark\Extension\Attributes\Node\Attributes; +use League\CommonMark\Extension\Attributes\Util\AttributesHelper; +use League\CommonMark\Node\Block\AbstractBlock; +use League\CommonMark\Parser\Block\AbstractBlockContinueParser; +use League\CommonMark\Parser\Block\BlockContinue; +use League\CommonMark\Parser\Block\BlockContinueParserInterface; +use League\CommonMark\Parser\Cursor; + +final class AttributesBlockContinueParser extends AbstractBlockContinueParser +{ + private Attributes $block; + + private AbstractBlock $container; + + private bool $hasSubsequentLine = false; + + /** + * @param array $attributes The attributes identified by the block start parser + * @param AbstractBlock $container The node we were in when these attributes were discovered + */ + public function __construct(array $attributes, AbstractBlock $container) + { + $this->block = new Attributes($attributes); + + $this->container = $container; + } + + public function getBlock(): AbstractBlock + { + return $this->block; + } + + public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue + { + $this->hasSubsequentLine = true; + + $cursor->advanceToNextNonSpaceOrTab(); + + // Does this next line also have attributes? + $attributes = AttributesHelper::parseAttributes($cursor); + $cursor->advanceToNextNonSpaceOrTab(); + if ($cursor->isAtEnd() && $attributes !== []) { + // It does! Merge them into what we parsed previously + $this->block->setAttributes(AttributesHelper::mergeAttributes( + $this->block->getAttributes(), + $attributes + )); + + // Tell the core parser we've consumed everything + return BlockContinue::at($cursor); + } + + // Okay, so there are no attributes on the next line + // If this next line is blank we know we can't target the next node, it must be a previous one + if ($cursor->isBlank()) { + $this->block->setTarget(Attributes::TARGET_PREVIOUS); + } + + return BlockContinue::none(); + } + + public function closeBlock(): void + { + // Attributes appearing at the very end of the document won't have any last lines to check + // so we can make that determination here + if (! $this->hasSubsequentLine) { + $this->block->setTarget(Attributes::TARGET_PREVIOUS); + } + + // We know this block must apply to the "previous" block, but that could be a sibling or parent, + // so we check the containing block to see which one it might be. + if ($this->block->getTarget() === Attributes::TARGET_PREVIOUS && $this->block->parent() === $this->container) { + $this->block->setTarget(Attributes::TARGET_PARENT); + } + } +} diff --git a/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesBlockStartParser.php b/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesBlockStartParser.php new file mode 100644 index 00000000..299ccd40 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesBlockStartParser.php @@ -0,0 +1,40 @@ + + * (c) 2015 Martin Hasoň + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Attributes\Parser; + +use League\CommonMark\Extension\Attributes\Util\AttributesHelper; +use League\CommonMark\Parser\Block\BlockStart; +use League\CommonMark\Parser\Block\BlockStartParserInterface; +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Parser\MarkdownParserStateInterface; + +final class AttributesBlockStartParser implements BlockStartParserInterface +{ + public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart + { + $originalPosition = $cursor->getPosition(); + $attributes = AttributesHelper::parseAttributes($cursor); + + if ($attributes === [] && $originalPosition === $cursor->getPosition()) { + return BlockStart::none(); + } + + if ($cursor->getNextNonSpaceCharacter() !== null) { + return BlockStart::none(); + } + + return BlockStart::of(new AttributesBlockContinueParser($attributes, $parserState->getActiveBlockParser()->getBlock()))->at($cursor); + } +} diff --git a/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesInlineParser.php b/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesInlineParser.php new file mode 100644 index 00000000..26af3ca5 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Attributes/Parser/AttributesInlineParser.php @@ -0,0 +1,54 @@ + + * (c) 2015 Martin Hasoň + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Attributes\Parser; + +use League\CommonMark\Extension\Attributes\Node\AttributesInline; +use League\CommonMark\Extension\Attributes\Util\AttributesHelper; +use League\CommonMark\Node\StringContainerInterface; +use League\CommonMark\Parser\Inline\InlineParserInterface; +use League\CommonMark\Parser\Inline\InlineParserMatch; +use League\CommonMark\Parser\InlineParserContext; + +final class AttributesInlineParser implements InlineParserInterface +{ + public function getMatchDefinition(): InlineParserMatch + { + return InlineParserMatch::string('{'); + } + + public function parse(InlineParserContext $inlineContext): bool + { + $cursor = $inlineContext->getCursor(); + $char = (string) $cursor->peek(-1); + + $attributes = AttributesHelper::parseAttributes($cursor); + if ($attributes === []) { + return false; + } + + if ($char === ' ' && ($prev = $inlineContext->getContainer()->lastChild()) instanceof StringContainerInterface) { + $prev->setLiteral(\rtrim($prev->getLiteral(), ' ')); + } + + if ($char === '') { + $cursor->advanceToNextNonSpaceOrNewline(); + } + + $node = new AttributesInline($attributes, $char === ' ' || $char === ''); + $inlineContext->getContainer()->appendChild($node); + + return true; + } +} diff --git a/vendor/league/commonmark/src/Extension/Attributes/Util/AttributesHelper.php b/vendor/league/commonmark/src/Extension/Attributes/Util/AttributesHelper.php new file mode 100644 index 00000000..d13a565e --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Attributes/Util/AttributesHelper.php @@ -0,0 +1,142 @@ + + * (c) 2015 Martin Hasoň + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Attributes\Util; + +use League\CommonMark\Node\Node; +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Util\RegexHelper; + +/** + * @internal + */ +final class AttributesHelper +{ + private const SINGLE_ATTRIBUTE = '\s*([.]-?[_a-z][^\s}]*|[#][^\s}]+|' . RegexHelper::PARTIAL_ATTRIBUTENAME . RegexHelper::PARTIAL_ATTRIBUTEVALUESPEC . ')\s*'; + private const ATTRIBUTE_LIST = '/^{:?(' . self::SINGLE_ATTRIBUTE . ')+}/i'; + + /** + * @return array + */ + public static function parseAttributes(Cursor $cursor): array + { + $state = $cursor->saveState(); + $cursor->advanceToNextNonSpaceOrNewline(); + + // Quick check to see if we might have attributes + if ($cursor->getCharacter() !== '{') { + $cursor->restoreState($state); + + return []; + } + + // Attempt to match the entire attribute list expression + // While this is less performant than checking for '{' now and '}' later, it simplifies + // matching individual attributes since they won't need to look ahead for the closing '}' + // while dealing with the fact that attributes can technically contain curly braces. + // So we'll just match the start and end braces up front. + $attributeExpression = $cursor->match(self::ATTRIBUTE_LIST); + if ($attributeExpression === null) { + $cursor->restoreState($state); + + return []; + } + + // Trim the leading '{' or '{:' and the trailing '}' + $attributeExpression = \ltrim(\substr($attributeExpression, 1, -1), ':'); + $attributeCursor = new Cursor($attributeExpression); + + /** @var array $attributes */ + $attributes = []; + while ($attribute = \trim((string) $attributeCursor->match('/^' . self::SINGLE_ATTRIBUTE . '/i'))) { + if ($attribute[0] === '#') { + $attributes['id'] = \substr($attribute, 1); + + continue; + } + + if ($attribute[0] === '.') { + $attributes['class'][] = \substr($attribute, 1); + + continue; + } + + /** @psalm-suppress PossiblyUndefinedArrayOffset */ + [$name, $value] = \explode('=', $attribute, 2); + + if ($value === 'true') { + $attributes[$name] = true; + continue; + } + + $first = $value[0]; + $last = \substr($value, -1); + if (($first === '"' && $last === '"') || ($first === "'" && $last === "'") && \strlen($value) > 1) { + $value = \substr($value, 1, -1); + } + + if (\strtolower(\trim($name)) === 'class') { + foreach (\array_filter(\explode(' ', \trim($value))) as $class) { + $attributes['class'][] = $class; + } + } else { + $attributes[\trim($name)] = \trim($value); + } + } + + if (isset($attributes['class'])) { + $attributes['class'] = \implode(' ', (array) $attributes['class']); + } + + return $attributes; + } + + /** + * @param Node|array $attributes1 + * @param Node|array $attributes2 + * + * @return array + */ + public static function mergeAttributes($attributes1, $attributes2): array + { + $attributes = []; + foreach ([$attributes1, $attributes2] as $arg) { + if ($arg instanceof Node) { + $arg = $arg->data->get('attributes'); + } + + /** @var array $arg */ + $arg = (array) $arg; + if (isset($arg['class'])) { + if (\is_string($arg['class'])) { + $arg['class'] = \array_filter(\explode(' ', \trim($arg['class']))); + } + + foreach ($arg['class'] as $class) { + $attributes['class'][] = $class; + } + + unset($arg['class']); + } + + $attributes = \array_merge($attributes, $arg); + } + + if (isset($attributes['class'])) { + $attributes['class'] = \implode(' ', $attributes['class']); + } + + return $attributes; + } +} diff --git a/vendor/league/commonmark/src/Extension/Autolink/AutolinkExtension.php b/vendor/league/commonmark/src/Extension/Autolink/AutolinkExtension.php new file mode 100644 index 00000000..54aafd4d --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Autolink/AutolinkExtension.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Autolink; + +use League\CommonMark\Environment\EnvironmentBuilderInterface; +use League\CommonMark\Extension\ConfigurableExtensionInterface; +use League\Config\ConfigurationBuilderInterface; +use Nette\Schema\Expect; + +final class AutolinkExtension implements ConfigurableExtensionInterface +{ + public function configureSchema(ConfigurationBuilderInterface $builder): void + { + $builder->addSchema('autolink', Expect::structure([ + 'allowed_protocols' => Expect::listOf('string')->default(['http', 'https', 'ftp'])->mergeDefaults(false), + 'default_protocol' => Expect::string()->default('http'), + ])); + } + + public function register(EnvironmentBuilderInterface $environment): void + { + $environment->addInlineParser(new EmailAutolinkParser()); + $environment->addInlineParser(new UrlAutolinkParser( + $environment->getConfiguration()->get('autolink.allowed_protocols'), + $environment->getConfiguration()->get('autolink.default_protocol'), + )); + } +} diff --git a/vendor/league/commonmark/src/Extension/Autolink/EmailAutolinkParser.php b/vendor/league/commonmark/src/Extension/Autolink/EmailAutolinkParser.php new file mode 100644 index 00000000..15a7d346 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Autolink/EmailAutolinkParser.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Autolink; + +use League\CommonMark\Extension\CommonMark\Node\Inline\Link; +use League\CommonMark\Parser\Inline\InlineParserInterface; +use League\CommonMark\Parser\Inline\InlineParserMatch; +use League\CommonMark\Parser\InlineParserContext; + +final class EmailAutolinkParser implements InlineParserInterface +{ + private const REGEX = '[A-Za-z0-9.\-_+]+@[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_.]+'; + + public function getMatchDefinition(): InlineParserMatch + { + return InlineParserMatch::regex(self::REGEX); + } + + public function parse(InlineParserContext $inlineContext): bool + { + $email = $inlineContext->getFullMatch(); + // The last character cannot be - or _ + if (\in_array(\substr($email, -1), ['-', '_'], true)) { + return false; + } + + // Does the URL end with punctuation that should be stripped? + if (\substr($email, -1) === '.') { + $email = \substr($email, 0, -1); + } + + $inlineContext->getCursor()->advanceBy(\strlen($email)); + $inlineContext->getContainer()->appendChild(new Link('mailto:' . $email, $email)); + + return true; + } +} diff --git a/vendor/league/commonmark/src/Extension/Autolink/UrlAutolinkParser.php b/vendor/league/commonmark/src/Extension/Autolink/UrlAutolinkParser.php new file mode 100644 index 00000000..1ef270fe --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Autolink/UrlAutolinkParser.php @@ -0,0 +1,157 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Autolink; + +use League\CommonMark\Extension\CommonMark\Node\Inline\Link; +use League\CommonMark\Parser\Inline\InlineParserInterface; +use League\CommonMark\Parser\Inline\InlineParserMatch; +use League\CommonMark\Parser\InlineParserContext; + +final class UrlAutolinkParser implements InlineParserInterface +{ + private const ALLOWED_AFTER = [null, ' ', "\t", "\n", "\x0b", "\x0c", "\x0d", '*', '_', '~', '(']; + + // RegEx adapted from https://github.com/symfony/symfony/blob/6.3/src/Symfony/Component/Validator/Constraints/UrlValidator.php + private const REGEX = '~ + ( + # Must start with a supported scheme + auth, or "www" + (?: + (?:%s):// # protocol + (?:(?:(?:[\_\.\pL\pN-]|%%[0-9A-Fa-f]{2})+:)?((?:[\_\.\pL\pN-]|%%[0-9A-Fa-f]{2})+)@)? # basic auth + |www\.) + (?: + (?: + (?:xn--[a-z0-9-]++\.)*+xn--[a-z0-9-]++ # a domain name using punycode + | + (?:[\pL\pN\pS\pM\-\_]++\.)+[\pL\pN\pM]++ # a multi-level domain name + | + [a-z0-9\-\_]++ # a single-level domain name + )\.? + | # or + \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # an IP address + | # or + \[ + (?:(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){6})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:::(?:(?:(?:[0-9a-f]{1,4})):){5})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){4})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,1}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){3})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,2}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){2})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,3}(?:(?:[0-9a-f]{1,4})))?::(?:(?:[0-9a-f]{1,4})):)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,4}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,5}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,6}(?:(?:[0-9a-f]{1,4})))?::)))) + \] # an IPv6 address + ) + (?::[0-9]+)? # a port (optional) + (?:/ (?:[\pL\pN\-._\~!$&\'()*+,;=:@]|%%[0-9A-Fa-f]{2})* )* # a path + (?:\? (?:[\pL\pN\-._\~!$&\'\[\]()*+,;=:@/?]|%%[0-9A-Fa-f]{2})* )? # a query (optional) + (?:\# (?:[\pL\pN\-._\~!$&\'()*+,;=:@/?]|%%[0-9A-Fa-f]{2})* )? # a fragment (optional) + )~ixu'; + + /** + * @var string[] + * + * @psalm-readonly + */ + private array $prefixes = ['www.']; + + /** + * @psalm-var non-empty-string + * + * @psalm-readonly + */ + private string $finalRegex; + + private string $defaultProtocol; + + /** + * @param array $allowedProtocols + */ + public function __construct(array $allowedProtocols = ['http', 'https', 'ftp'], string $defaultProtocol = 'http') + { + /** + * @psalm-suppress PropertyTypeCoercion + */ + $this->finalRegex = \sprintf(self::REGEX, \implode('|', $allowedProtocols)); + + foreach ($allowedProtocols as $protocol) { + $this->prefixes[] = $protocol . '://'; + } + + $this->defaultProtocol = $defaultProtocol; + } + + public function getMatchDefinition(): InlineParserMatch + { + return InlineParserMatch::oneOf(...$this->prefixes); + } + + public function parse(InlineParserContext $inlineContext): bool + { + $cursor = $inlineContext->getCursor(); + + // Autolinks can only come at the beginning of a line, after whitespace, or certain delimiting characters + $previousChar = $cursor->peek(-1); + if (! \in_array($previousChar, self::ALLOWED_AFTER, true)) { + return false; + } + + // Check if we have a valid URL + if (! \preg_match($this->finalRegex, $cursor->getRemainder(), $matches)) { + return false; + } + + $url = $matches[0]; + + // Does the URL end with punctuation that should be stripped? + if (\preg_match('/(.+?)([?!.,:*_~]+)$/', $url, $matches)) { + // Add the punctuation later + $url = $matches[1]; + } + + // Does the URL end with something that looks like an entity reference? + if (\preg_match('/(.+)(&[A-Za-z0-9]+;)$/', $url, $matches)) { + $url = $matches[1]; + } + + // Does the URL need unmatched parens chopped off? + if (\substr($url, -1) === ')' && ($diff = self::diffParens($url)) > 0) { + $url = \substr($url, 0, -$diff); + } + + $cursor->advanceBy(\mb_strlen($url, 'UTF-8')); + + // Auto-prefix 'http(s)://' onto 'www' URLs + if (\substr($url, 0, 4) === 'www.') { + $inlineContext->getContainer()->appendChild(new Link($this->defaultProtocol . '://' . $url, $url)); + + return true; + } + + $inlineContext->getContainer()->appendChild(new Link($url, $url)); + + return true; + } + + /** + * @psalm-pure + */ + private static function diffParens(string $content): int + { + // Scan the entire autolink for the total number of parentheses. + // If there is a greater number of closing parentheses than opening ones, + // we don’t consider ANY of the last characters as part of the autolink, + // in order to facilitate including an autolink inside a parenthesis. + \preg_match_all('/[()]/', $content, $matches); + + $charCount = ['(' => 0, ')' => 0]; + foreach ($matches[0] as $char) { + $charCount[$char]++; + } + + return $charCount[')'] - $charCount['(']; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/CommonMarkCoreExtension.php b/vendor/league/commonmark/src/Extension/CommonMark/CommonMarkCoreExtension.php new file mode 100644 index 00000000..91f7a227 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/CommonMarkCoreExtension.php @@ -0,0 +1,92 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark; + +use League\CommonMark\Environment\EnvironmentBuilderInterface; +use League\CommonMark\Extension\CommonMark\Delimiter\Processor\EmphasisDelimiterProcessor; +use League\CommonMark\Extension\ConfigurableExtensionInterface; +use League\CommonMark\Node as CoreNode; +use League\CommonMark\Parser as CoreParser; +use League\CommonMark\Renderer as CoreRenderer; +use League\Config\ConfigurationBuilderInterface; +use Nette\Schema\Expect; + +final class CommonMarkCoreExtension implements ConfigurableExtensionInterface +{ + public function configureSchema(ConfigurationBuilderInterface $builder): void + { + $builder->addSchema('commonmark', Expect::structure([ + 'use_asterisk' => Expect::bool(true), + 'use_underscore' => Expect::bool(true), + 'enable_strong' => Expect::bool(true), + 'enable_em' => Expect::bool(true), + 'unordered_list_markers' => Expect::listOf('string')->min(1)->default(['*', '+', '-'])->mergeDefaults(false), + ])); + } + + // phpcs:disable Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma,Squiz.WhiteSpace.SemicolonSpacing.Incorrect + public function register(EnvironmentBuilderInterface $environment): void + { + $environment + ->addBlockStartParser(new Parser\Block\BlockQuoteStartParser(), 70) + ->addBlockStartParser(new Parser\Block\HeadingStartParser(), 60) + ->addBlockStartParser(new Parser\Block\FencedCodeStartParser(), 50) + ->addBlockStartParser(new Parser\Block\HtmlBlockStartParser(), 40) + ->addBlockStartParser(new Parser\Block\ThematicBreakStartParser(), 20) + ->addBlockStartParser(new Parser\Block\ListBlockStartParser(), 10) + ->addBlockStartParser(new Parser\Block\IndentedCodeStartParser(), -100) + + ->addInlineParser(new CoreParser\Inline\NewlineParser(), 200) + ->addInlineParser(new Parser\Inline\BacktickParser(), 150) + ->addInlineParser(new Parser\Inline\EscapableParser(), 80) + ->addInlineParser(new Parser\Inline\EntityParser(), 70) + ->addInlineParser(new Parser\Inline\AutolinkParser(), 50) + ->addInlineParser(new Parser\Inline\HtmlInlineParser(), 40) + ->addInlineParser(new Parser\Inline\CloseBracketParser(), 30) + ->addInlineParser(new Parser\Inline\OpenBracketParser(), 20) + ->addInlineParser(new Parser\Inline\BangParser(), 10) + + ->addRenderer(Node\Block\BlockQuote::class, new Renderer\Block\BlockQuoteRenderer(), 0) + ->addRenderer(CoreNode\Block\Document::class, new CoreRenderer\Block\DocumentRenderer(), 0) + ->addRenderer(Node\Block\FencedCode::class, new Renderer\Block\FencedCodeRenderer(), 0) + ->addRenderer(Node\Block\Heading::class, new Renderer\Block\HeadingRenderer(), 0) + ->addRenderer(Node\Block\HtmlBlock::class, new Renderer\Block\HtmlBlockRenderer(), 0) + ->addRenderer(Node\Block\IndentedCode::class, new Renderer\Block\IndentedCodeRenderer(), 0) + ->addRenderer(Node\Block\ListBlock::class, new Renderer\Block\ListBlockRenderer(), 0) + ->addRenderer(Node\Block\ListItem::class, new Renderer\Block\ListItemRenderer(), 0) + ->addRenderer(CoreNode\Block\Paragraph::class, new CoreRenderer\Block\ParagraphRenderer(), 0) + ->addRenderer(Node\Block\ThematicBreak::class, new Renderer\Block\ThematicBreakRenderer(), 0) + + ->addRenderer(Node\Inline\Code::class, new Renderer\Inline\CodeRenderer(), 0) + ->addRenderer(Node\Inline\Emphasis::class, new Renderer\Inline\EmphasisRenderer(), 0) + ->addRenderer(Node\Inline\HtmlInline::class, new Renderer\Inline\HtmlInlineRenderer(), 0) + ->addRenderer(Node\Inline\Image::class, new Renderer\Inline\ImageRenderer(), 0) + ->addRenderer(Node\Inline\Link::class, new Renderer\Inline\LinkRenderer(), 0) + ->addRenderer(CoreNode\Inline\Newline::class, new CoreRenderer\Inline\NewlineRenderer(), 0) + ->addRenderer(Node\Inline\Strong::class, new Renderer\Inline\StrongRenderer(), 0) + ->addRenderer(CoreNode\Inline\Text::class, new CoreRenderer\Inline\TextRenderer(), 0) + ; + + if ($environment->getConfiguration()->get('commonmark/use_asterisk')) { + $environment->addDelimiterProcessor(new EmphasisDelimiterProcessor('*')); + } + + if ($environment->getConfiguration()->get('commonmark/use_underscore')) { + $environment->addDelimiterProcessor(new EmphasisDelimiterProcessor('_')); + } + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Delimiter/Processor/EmphasisDelimiterProcessor.php b/vendor/league/commonmark/src/Extension/CommonMark/Delimiter/Processor/EmphasisDelimiterProcessor.php new file mode 100644 index 00000000..84b46ee6 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Delimiter/Processor/EmphasisDelimiterProcessor.php @@ -0,0 +1,108 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * Additional emphasis processing code based on commonmark-java (https://github.com/atlassian/commonmark-java) + * - (c) Atlassian Pty Ltd + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Delimiter\Processor; + +use League\CommonMark\Delimiter\DelimiterInterface; +use League\CommonMark\Delimiter\Processor\DelimiterProcessorInterface; +use League\CommonMark\Extension\CommonMark\Node\Inline\Emphasis; +use League\CommonMark\Extension\CommonMark\Node\Inline\Strong; +use League\CommonMark\Node\Inline\AbstractStringContainer; +use League\Config\ConfigurationAwareInterface; +use League\Config\ConfigurationInterface; + +final class EmphasisDelimiterProcessor implements DelimiterProcessorInterface, ConfigurationAwareInterface +{ + /** @psalm-readonly */ + private string $char; + + /** @psalm-readonly-allow-private-mutation */ + private ConfigurationInterface $config; + + /** + * @param string $char The emphasis character to use (typically '*' or '_') + */ + public function __construct(string $char) + { + $this->char = $char; + } + + public function getOpeningCharacter(): string + { + return $this->char; + } + + public function getClosingCharacter(): string + { + return $this->char; + } + + public function getMinLength(): int + { + return 1; + } + + public function getDelimiterUse(DelimiterInterface $opener, DelimiterInterface $closer): int + { + // "Multiple of 3" rule for internal delimiter runs + if (($opener->canClose() || $closer->canOpen()) && $closer->getOriginalLength() % 3 !== 0 && ($opener->getOriginalLength() + $closer->getOriginalLength()) % 3 === 0) { + return 0; + } + + // Calculate actual number of delimiters used from this closer + if ($opener->getLength() >= 2 && $closer->getLength() >= 2) { + if ($this->config->get('commonmark/enable_strong')) { + return 2; + } + + return 0; + } + + if ($this->config->get('commonmark/enable_em')) { + return 1; + } + + return 0; + } + + public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse): void + { + if ($delimiterUse === 1) { + $emphasis = new Emphasis($this->char); + } elseif ($delimiterUse === 2) { + $emphasis = new Strong($this->char . $this->char); + } else { + return; + } + + $next = $opener->next(); + while ($next !== null && $next !== $closer) { + $tmp = $next->next(); + $emphasis->appendChild($next); + $next = $tmp; + } + + $opener->insertAfter($emphasis); + } + + public function setConfiguration(ConfigurationInterface $configuration): void + { + $this->config = $configuration; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/BlockQuote.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/BlockQuote.php new file mode 100644 index 00000000..11094b9d --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/BlockQuote.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 League\CommonMark\Extension\CommonMark\Node\Block; + +use League\CommonMark\Node\Block\AbstractBlock; + +class BlockQuote extends AbstractBlock +{ +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/FencedCode.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/FencedCode.php new file mode 100644 index 00000000..b50b4070 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/FencedCode.php @@ -0,0 +1,100 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Node\Block; + +use League\CommonMark\Node\Block\AbstractBlock; +use League\CommonMark\Node\StringContainerInterface; + +final class FencedCode extends AbstractBlock implements StringContainerInterface +{ + private ?string $info = null; + + private string $literal = ''; + + private int $length; + + private string $char; + + private int $offset; + + public function __construct(int $length, string $char, int $offset) + { + parent::__construct(); + + $this->length = $length; + $this->char = $char; + $this->offset = $offset; + } + + public function getInfo(): ?string + { + return $this->info; + } + + /** + * @return string[] + */ + public function getInfoWords(): array + { + return \preg_split('/\s+/', $this->info ?? '') ?: []; + } + + public function setInfo(string $info): void + { + $this->info = $info; + } + + public function getLiteral(): string + { + return $this->literal; + } + + public function setLiteral(string $literal): void + { + $this->literal = $literal; + } + + public function getChar(): string + { + return $this->char; + } + + public function setChar(string $char): void + { + $this->char = $char; + } + + public function getLength(): int + { + return $this->length; + } + + public function setLength(int $length): void + { + $this->length = $length; + } + + public function getOffset(): int + { + return $this->offset; + } + + public function setOffset(int $offset): void + { + $this->offset = $offset; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/Heading.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/Heading.php new file mode 100644 index 00000000..1cf11845 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/Heading.php @@ -0,0 +1,41 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Node\Block; + +use League\CommonMark\Node\Block\AbstractBlock; + +final class Heading extends AbstractBlock +{ + private int $level; + + public function __construct(int $level) + { + parent::__construct(); + + $this->level = $level; + } + + public function getLevel(): int + { + return $this->level; + } + + public function setLevel(int $level): void + { + $this->level = $level; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/HtmlBlock.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/HtmlBlock.php new file mode 100644 index 00000000..9879a89d --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/HtmlBlock.php @@ -0,0 +1,79 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Node\Block; + +use League\CommonMark\Node\Block\AbstractBlock; +use League\CommonMark\Node\RawMarkupContainerInterface; + +final class HtmlBlock extends AbstractBlock implements RawMarkupContainerInterface +{ + // Any changes to these constants should be reflected in .phpstorm.meta.php + public const TYPE_1_CODE_CONTAINER = 1; + public const TYPE_2_COMMENT = 2; + public const TYPE_3 = 3; + public const TYPE_4 = 4; + public const TYPE_5_CDATA = 5; + public const TYPE_6_BLOCK_ELEMENT = 6; + public const TYPE_7_MISC_ELEMENT = 7; + + /** + * @psalm-var self::TYPE_* $type + * @phpstan-var self::TYPE_* $type + */ + private int $type; + + private string $literal = ''; + + /** + * @psalm-param self::TYPE_* $type + * + * @phpstan-param self::TYPE_* $type + */ + public function __construct(int $type) + { + parent::__construct(); + + $this->type = $type; + } + + /** + * @psalm-return self::TYPE_* + * + * @phpstan-return self::TYPE_* + */ + public function getType(): int + { + return $this->type; + } + + /** + * @psalm-param self::TYPE_* $type + * + * @phpstan-param self::TYPE_* $type + */ + public function setType(int $type): void + { + $this->type = $type; + } + + public function getLiteral(): string + { + return $this->literal; + } + + public function setLiteral(string $literal): void + { + $this->literal = $literal; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/IndentedCode.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/IndentedCode.php new file mode 100644 index 00000000..d18be159 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/IndentedCode.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Node\Block; + +use League\CommonMark\Node\Block\AbstractBlock; +use League\CommonMark\Node\StringContainerInterface; + +final class IndentedCode extends AbstractBlock implements StringContainerInterface +{ + private string $literal = ''; + + public function getLiteral(): string + { + return $this->literal; + } + + public function setLiteral(string $literal): void + { + $this->literal = $literal; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListBlock.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListBlock.php new file mode 100644 index 00000000..504a38a2 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListBlock.php @@ -0,0 +1,56 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Node\Block; + +use League\CommonMark\Node\Block\AbstractBlock; +use League\CommonMark\Node\Block\TightBlockInterface; + +class ListBlock extends AbstractBlock implements TightBlockInterface +{ + public const TYPE_BULLET = 'bullet'; + public const TYPE_ORDERED = 'ordered'; + + public const DELIM_PERIOD = 'period'; + public const DELIM_PAREN = 'paren'; + + protected bool $tight = false; // TODO Make lists tight by default in v3 + + /** @psalm-readonly */ + protected ListData $listData; + + public function __construct(ListData $listData) + { + parent::__construct(); + + $this->listData = $listData; + } + + public function getListData(): ListData + { + return $this->listData; + } + + public function isTight(): bool + { + return $this->tight; + } + + public function setTight(bool $tight): void + { + $this->tight = $tight; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListData.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListData.php new file mode 100644 index 00000000..7108a933 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListData.php @@ -0,0 +1,47 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Node\Block; + +class ListData +{ + public ?int $start = null; + + public int $padding = 0; + + /** + * @psalm-var ListBlock::TYPE_* + * @phpstan-var ListBlock::TYPE_* + */ + public string $type; + + /** + * @psalm-var ListBlock::DELIM_*|null + * @phpstan-var ListBlock::DELIM_*|null + */ + public ?string $delimiter = null; + + public ?string $bulletChar = null; + + public int $markerOffset; + + public function equals(ListData $data): bool + { + return $this->type === $data->type && + $this->delimiter === $data->delimiter && + $this->bulletChar === $data->bulletChar; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListItem.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListItem.php new file mode 100644 index 00000000..f136b7e0 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ListItem.php @@ -0,0 +1,37 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Node\Block; + +use League\CommonMark\Node\Block\AbstractBlock; + +class ListItem extends AbstractBlock +{ + /** @psalm-readonly */ + protected ListData $listData; + + public function __construct(ListData $listData) + { + parent::__construct(); + + $this->listData = $listData; + } + + public function getListData(): ListData + { + return $this->listData; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ThematicBreak.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ThematicBreak.php new file mode 100644 index 00000000..bb6cea0b --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Node/Block/ThematicBreak.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 League\CommonMark\Extension\CommonMark\Node\Block; + +use League\CommonMark\Node\Block\AbstractBlock; + +class ThematicBreak extends AbstractBlock +{ +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/AbstractWebResource.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/AbstractWebResource.php new file mode 100644 index 00000000..dc0ed0a8 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/AbstractWebResource.php @@ -0,0 +1,41 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Node\Inline; + +use League\CommonMark\Node\Inline\AbstractInline; + +abstract class AbstractWebResource extends AbstractInline +{ + protected string $url; + + public function __construct(string $url) + { + parent::__construct(); + + $this->url = $url; + } + + public function getUrl(): string + { + return $this->url; + } + + public function setUrl(string $url): void + { + $this->url = $url; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Code.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Code.php new file mode 100644 index 00000000..3a6aca24 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Code.php @@ -0,0 +1,23 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Node\Inline; + +use League\CommonMark\Node\Inline\AbstractStringContainer; + +class Code extends AbstractStringContainer +{ +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Emphasis.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Emphasis.php new file mode 100644 index 00000000..fab6869c --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Emphasis.php @@ -0,0 +1,42 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Node\Inline; + +use League\CommonMark\Node\Inline\AbstractInline; +use League\CommonMark\Node\Inline\DelimitedInterface; + +final class Emphasis extends AbstractInline implements DelimitedInterface +{ + private string $delimiter; + + public function __construct(string $delimiter = '_') + { + parent::__construct(); + + $this->delimiter = $delimiter; + } + + public function getOpeningDelimiter(): string + { + return $this->delimiter; + } + + public function getClosingDelimiter(): string + { + return $this->delimiter; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/HtmlInline.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/HtmlInline.php new file mode 100644 index 00000000..8594a06e --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/HtmlInline.php @@ -0,0 +1,24 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Node\Inline; + +use League\CommonMark\Node\Inline\AbstractStringContainer; +use League\CommonMark\Node\RawMarkupContainerInterface; + +final class HtmlInline extends AbstractStringContainer implements RawMarkupContainerInterface +{ +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Image.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Image.php new file mode 100644 index 00000000..20e3f87b --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Image.php @@ -0,0 +1,49 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Node\Inline; + +use League\CommonMark\Node\Inline\Text; + +class Image extends AbstractWebResource +{ + protected ?string $title = null; + + public function __construct(string $url, ?string $label = null, ?string $title = null) + { + parent::__construct($url); + + if ($label !== null && $label !== '') { + $this->appendChild(new Text($label)); + } + + $this->title = $title; + } + + public function getTitle(): ?string + { + if ($this->title === '') { + return null; + } + + return $this->title; + } + + public function setTitle(?string $title): void + { + $this->title = $title; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Link.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Link.php new file mode 100644 index 00000000..76d5609b --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Link.php @@ -0,0 +1,49 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Node\Inline; + +use League\CommonMark\Node\Inline\Text; + +class Link extends AbstractWebResource +{ + protected ?string $title = null; + + public function __construct(string $url, ?string $label = null, ?string $title = null) + { + parent::__construct($url); + + if ($label !== null && $label !== '') { + $this->appendChild(new Text($label)); + } + + $this->title = $title; + } + + public function getTitle(): ?string + { + if ($this->title === '') { + return null; + } + + return $this->title; + } + + public function setTitle(?string $title): void + { + $this->title = $title; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Strong.php b/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Strong.php new file mode 100644 index 00000000..827960f3 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Node/Inline/Strong.php @@ -0,0 +1,42 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Node\Inline; + +use League\CommonMark\Node\Inline\AbstractInline; +use League\CommonMark\Node\Inline\DelimitedInterface; + +final class Strong extends AbstractInline implements DelimitedInterface +{ + private string $delimiter; + + public function __construct(string $delimiter = '**') + { + parent::__construct(); + + $this->delimiter = $delimiter; + } + + public function getOpeningDelimiter(): string + { + return $this->delimiter; + } + + public function getClosingDelimiter(): string + { + return $this->delimiter; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/BlockQuoteParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/BlockQuoteParser.php new file mode 100644 index 00000000..78db6c5a --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/BlockQuoteParser.php @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Parser\Block; + +use League\CommonMark\Extension\CommonMark\Node\Block\BlockQuote; +use League\CommonMark\Node\Block\AbstractBlock; +use League\CommonMark\Parser\Block\AbstractBlockContinueParser; +use League\CommonMark\Parser\Block\BlockContinue; +use League\CommonMark\Parser\Block\BlockContinueParserInterface; +use League\CommonMark\Parser\Cursor; + +final class BlockQuoteParser extends AbstractBlockContinueParser +{ + /** @psalm-readonly */ + private BlockQuote $block; + + public function __construct() + { + $this->block = new BlockQuote(); + } + + public function getBlock(): BlockQuote + { + return $this->block; + } + + public function isContainer(): bool + { + return true; + } + + public function canContain(AbstractBlock $childBlock): bool + { + return true; + } + + public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue + { + if (! $cursor->isIndented() && $cursor->getNextNonSpaceCharacter() === '>') { + $cursor->advanceToNextNonSpaceOrTab(); + $cursor->advanceBy(1); + $cursor->advanceBySpaceOrTab(); + + return BlockContinue::at($cursor); + } + + return BlockContinue::none(); + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/BlockQuoteStartParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/BlockQuoteStartParser.php new file mode 100644 index 00000000..de9a6bc9 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/BlockQuoteStartParser.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Parser\Block; + +use League\CommonMark\Parser\Block\BlockStart; +use League\CommonMark\Parser\Block\BlockStartParserInterface; +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Parser\MarkdownParserStateInterface; + +final class BlockQuoteStartParser implements BlockStartParserInterface +{ + public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart + { + if ($cursor->isIndented()) { + return BlockStart::none(); + } + + if ($cursor->getNextNonSpaceCharacter() !== '>') { + return BlockStart::none(); + } + + $cursor->advanceToNextNonSpaceOrTab(); + $cursor->advanceBy(1); + $cursor->advanceBySpaceOrTab(); + + return BlockStart::of(new BlockQuoteParser())->at($cursor); + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/FencedCodeParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/FencedCodeParser.php new file mode 100644 index 00000000..96a5baa4 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/FencedCodeParser.php @@ -0,0 +1,84 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Parser\Block; + +use League\CommonMark\Extension\CommonMark\Node\Block\FencedCode; +use League\CommonMark\Parser\Block\AbstractBlockContinueParser; +use League\CommonMark\Parser\Block\BlockContinue; +use League\CommonMark\Parser\Block\BlockContinueParserInterface; +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Util\ArrayCollection; +use League\CommonMark\Util\RegexHelper; + +final class FencedCodeParser extends AbstractBlockContinueParser +{ + /** @psalm-readonly */ + private FencedCode $block; + + /** @var ArrayCollection */ + private ArrayCollection $strings; + + public function __construct(int $fenceLength, string $fenceChar, int $fenceOffset) + { + $this->block = new FencedCode($fenceLength, $fenceChar, $fenceOffset); + $this->strings = new ArrayCollection(); + } + + public function getBlock(): FencedCode + { + return $this->block; + } + + public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue + { + // Check for closing code fence + if (! $cursor->isIndented() && $cursor->getNextNonSpaceCharacter() === $this->block->getChar()) { + $match = RegexHelper::matchFirst('/^(?:`{3,}|~{3,})(?=[ \t]*$)/', $cursor->getLine(), $cursor->getNextNonSpacePosition()); + if ($match !== null && \strlen($match[0]) >= $this->block->getLength()) { + // closing fence - we're at end of line, so we can finalize now + return BlockContinue::finished(); + } + } + + // Skip optional spaces of fence offset + // Optimization: don't attempt to match if we're at a non-space position + if ($cursor->getNextNonSpacePosition() > $cursor->getPosition()) { + $cursor->match('/^ {0,' . $this->block->getOffset() . '}/'); + } + + return BlockContinue::at($cursor); + } + + public function addLine(string $line): void + { + $this->strings[] = $line; + } + + public function closeBlock(): void + { + // first line becomes info string + $firstLine = $this->strings->first(); + if ($firstLine === false) { + $firstLine = ''; + } + + $this->block->setInfo(RegexHelper::unescape(\trim($firstLine))); + + if ($this->strings->count() === 1) { + $this->block->setLiteral(''); + } else { + $this->block->setLiteral(\implode("\n", $this->strings->slice(1)) . "\n"); + } + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/FencedCodeStartParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/FencedCodeStartParser.php new file mode 100644 index 00000000..be1b1dca --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/FencedCodeStartParser.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Parser\Block; + +use League\CommonMark\Parser\Block\BlockStart; +use League\CommonMark\Parser\Block\BlockStartParserInterface; +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Parser\MarkdownParserStateInterface; + +final class FencedCodeStartParser implements BlockStartParserInterface +{ + public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart + { + if ($cursor->isIndented() || ! \in_array($cursor->getNextNonSpaceCharacter(), ['`', '~'], true)) { + return BlockStart::none(); + } + + $indent = $cursor->getIndent(); + $fence = $cursor->match('/^[ \t]*(?:`{3,}(?!.*`)|~{3,})/'); + if ($fence === null) { + return BlockStart::none(); + } + + // fenced code block + $fence = \ltrim($fence, " \t"); + + return BlockStart::of(new FencedCodeParser(\strlen($fence), $fence[0], $indent))->at($cursor); + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HeadingParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HeadingParser.php new file mode 100644 index 00000000..c3e31086 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HeadingParser.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 League\CommonMark\Extension\CommonMark\Parser\Block; + +use League\CommonMark\Extension\CommonMark\Node\Block\Heading; +use League\CommonMark\Parser\Block\AbstractBlockContinueParser; +use League\CommonMark\Parser\Block\BlockContinue; +use League\CommonMark\Parser\Block\BlockContinueParserInterface; +use League\CommonMark\Parser\Block\BlockContinueParserWithInlinesInterface; +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Parser\InlineParserEngineInterface; + +final class HeadingParser extends AbstractBlockContinueParser implements BlockContinueParserWithInlinesInterface +{ + /** @psalm-readonly */ + private Heading $block; + + private string $content; + + public function __construct(int $level, string $content) + { + $this->block = new Heading($level); + $this->content = $content; + } + + public function getBlock(): Heading + { + return $this->block; + } + + public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue + { + return BlockContinue::none(); + } + + public function parseInlines(InlineParserEngineInterface $inlineParser): void + { + $inlineParser->parse($this->content, $this->block); + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HeadingStartParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HeadingStartParser.php new file mode 100644 index 00000000..404f4038 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HeadingStartParser.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Parser\Block; + +use League\CommonMark\Parser\Block\BlockStart; +use League\CommonMark\Parser\Block\BlockStartParserInterface; +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Parser\MarkdownParserStateInterface; +use League\CommonMark\Util\RegexHelper; + +class HeadingStartParser implements BlockStartParserInterface +{ + public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart + { + if ($cursor->isIndented() || ! \in_array($cursor->getNextNonSpaceCharacter(), ['#', '-', '='], true)) { + return BlockStart::none(); + } + + $cursor->advanceToNextNonSpaceOrTab(); + + if ($atxHeading = self::getAtxHeader($cursor)) { + return BlockStart::of($atxHeading)->at($cursor); + } + + $setextHeadingLevel = self::getSetextHeadingLevel($cursor); + if ($setextHeadingLevel > 0) { + $content = $parserState->getParagraphContent(); + if ($content !== null) { + $cursor->advanceToEnd(); + + return BlockStart::of(new HeadingParser($setextHeadingLevel, $content)) + ->at($cursor) + ->replaceActiveBlockParser(); + } + } + + return BlockStart::none(); + } + + private static function getAtxHeader(Cursor $cursor): ?HeadingParser + { + $match = RegexHelper::matchFirst('/^#{1,6}(?:[ \t]+|$)/', $cursor->getRemainder()); + if (! $match) { + return null; + } + + $cursor->advanceToNextNonSpaceOrTab(); + $cursor->advanceBy(\strlen($match[0])); + + $level = \strlen(\trim($match[0])); + $str = $cursor->getRemainder(); + $str = \preg_replace('/^[ \t]*#+[ \t]*$/', '', $str); + \assert(\is_string($str)); + $str = \preg_replace('/[ \t]+#+[ \t]*$/', '', $str); + \assert(\is_string($str)); + + return new HeadingParser($level, $str); + } + + private static function getSetextHeadingLevel(Cursor $cursor): int + { + $match = RegexHelper::matchFirst('/^(?:=+|-+)[ \t]*$/', $cursor->getRemainder()); + if ($match === null) { + return 0; + } + + return $match[0][0] === '=' ? 1 : 2; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HtmlBlockParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HtmlBlockParser.php new file mode 100644 index 00000000..67786762 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HtmlBlockParser.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 League\CommonMark\Extension\CommonMark\Parser\Block; + +use League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock; +use League\CommonMark\Parser\Block\AbstractBlockContinueParser; +use League\CommonMark\Parser\Block\BlockContinue; +use League\CommonMark\Parser\Block\BlockContinueParserInterface; +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Util\RegexHelper; + +final class HtmlBlockParser extends AbstractBlockContinueParser +{ + /** @psalm-readonly */ + private HtmlBlock $block; + + private string $content = ''; + + private bool $finished = false; + + /** + * @psalm-param HtmlBlock::TYPE_* $blockType + * + * @phpstan-param HtmlBlock::TYPE_* $blockType + */ + public function __construct(int $blockType) + { + $this->block = new HtmlBlock($blockType); + } + + public function getBlock(): HtmlBlock + { + return $this->block; + } + + public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue + { + if ($this->finished) { + return BlockContinue::none(); + } + + if ($cursor->isBlank() && \in_array($this->block->getType(), [HtmlBlock::TYPE_6_BLOCK_ELEMENT, HtmlBlock::TYPE_7_MISC_ELEMENT], true)) { + return BlockContinue::none(); + } + + return BlockContinue::at($cursor); + } + + public function addLine(string $line): void + { + if ($this->content !== '') { + $this->content .= "\n"; + } + + $this->content .= $line; + + // Check for end condition + // phpcs:disable SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed + if ($this->block->getType() <= HtmlBlock::TYPE_5_CDATA) { + if (\preg_match(RegexHelper::getHtmlBlockCloseRegex($this->block->getType()), $line) === 1) { + $this->finished = true; + } + } + } + + public function closeBlock(): void + { + $this->block->setLiteral($this->content); + $this->content = ''; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HtmlBlockStartParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HtmlBlockStartParser.php new file mode 100644 index 00000000..bcef0af2 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HtmlBlockStartParser.php @@ -0,0 +1,62 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Parser\Block; + +use League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock; +use League\CommonMark\Node\Block\Paragraph; +use League\CommonMark\Parser\Block\BlockStart; +use League\CommonMark\Parser\Block\BlockStartParserInterface; +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Parser\MarkdownParserStateInterface; +use League\CommonMark\Util\RegexHelper; + +final class HtmlBlockStartParser implements BlockStartParserInterface +{ + public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart + { + if ($cursor->isIndented() || $cursor->getNextNonSpaceCharacter() !== '<') { + return BlockStart::none(); + } + + $tmpCursor = clone $cursor; + $tmpCursor->advanceToNextNonSpaceOrTab(); + $line = $tmpCursor->getRemainder(); + + for ($blockType = 1; $blockType <= 7; $blockType++) { + /** @psalm-var HtmlBlock::TYPE_* $blockType */ + /** @phpstan-var HtmlBlock::TYPE_* $blockType */ + $match = RegexHelper::matchAt( + RegexHelper::getHtmlBlockOpenRegex($blockType), + $line + ); + + if ($match !== null && ($blockType < 7 || $this->isType7BlockAllowed($cursor, $parserState))) { + return BlockStart::of(new HtmlBlockParser($blockType))->at($cursor); + } + } + + return BlockStart::none(); + } + + private function isType7BlockAllowed(Cursor $cursor, MarkdownParserStateInterface $parserState): bool + { + // Type 7 blocks can't interrupt paragraphs + if ($parserState->getLastMatchedBlockParser()->getBlock() instanceof Paragraph) { + return false; + } + + // Even lazy ones + return ! $parserState->getActiveBlockParser()->canHaveLazyContinuationLines(); + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/IndentedCodeParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/IndentedCodeParser.php new file mode 100644 index 00000000..ac6406fb --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/IndentedCodeParser.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Parser\Block; + +use League\CommonMark\Extension\CommonMark\Node\Block\IndentedCode; +use League\CommonMark\Parser\Block\AbstractBlockContinueParser; +use League\CommonMark\Parser\Block\BlockContinue; +use League\CommonMark\Parser\Block\BlockContinueParserInterface; +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Util\ArrayCollection; + +final class IndentedCodeParser extends AbstractBlockContinueParser +{ + /** @psalm-readonly */ + private IndentedCode $block; + + /** @var ArrayCollection */ + private ArrayCollection $strings; + + public function __construct() + { + $this->block = new IndentedCode(); + $this->strings = new ArrayCollection(); + } + + public function getBlock(): IndentedCode + { + return $this->block; + } + + public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue + { + if ($cursor->isIndented()) { + $cursor->advanceBy(Cursor::INDENT_LEVEL, true); + + return BlockContinue::at($cursor); + } + + if ($cursor->isBlank()) { + $cursor->advanceToNextNonSpaceOrTab(); + + return BlockContinue::at($cursor); + } + + return BlockContinue::none(); + } + + public function addLine(string $line): void + { + $this->strings[] = $line; + } + + public function closeBlock(): void + { + $lines = $this->strings->toArray(); + + // Note that indented code block cannot be empty, so $lines will always have at least one non-empty element + while (\preg_match('/^[ \t]*$/', \end($lines))) { // @phpstan-ignore-line + \array_pop($lines); + } + + $this->block->setLiteral(\implode("\n", $lines) . "\n"); + $this->block->setEndLine($this->block->getStartLine() + \count($lines) - 1); + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/IndentedCodeStartParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/IndentedCodeStartParser.php new file mode 100644 index 00000000..bea4bdeb --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/IndentedCodeStartParser.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Parser\Block; + +use League\CommonMark\Node\Block\Paragraph; +use League\CommonMark\Parser\Block\BlockStart; +use League\CommonMark\Parser\Block\BlockStartParserInterface; +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Parser\MarkdownParserStateInterface; + +final class IndentedCodeStartParser implements BlockStartParserInterface +{ + public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart + { + if (! $cursor->isIndented()) { + return BlockStart::none(); + } + + if ($parserState->getActiveBlockParser()->getBlock() instanceof Paragraph) { + return BlockStart::none(); + } + + if ($cursor->isBlank()) { + return BlockStart::none(); + } + + $cursor->advanceBy(Cursor::INDENT_LEVEL, true); + + return BlockStart::of(new IndentedCodeParser())->at($cursor); + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListBlockParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListBlockParser.php new file mode 100644 index 00000000..5a7ee45a --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListBlockParser.php @@ -0,0 +1,93 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Parser\Block; + +use League\CommonMark\Extension\CommonMark\Node\Block\ListBlock; +use League\CommonMark\Extension\CommonMark\Node\Block\ListData; +use League\CommonMark\Extension\CommonMark\Node\Block\ListItem; +use League\CommonMark\Node\Block\AbstractBlock; +use League\CommonMark\Parser\Block\AbstractBlockContinueParser; +use League\CommonMark\Parser\Block\BlockContinue; +use League\CommonMark\Parser\Block\BlockContinueParserInterface; +use League\CommonMark\Parser\Cursor; + +final class ListBlockParser extends AbstractBlockContinueParser +{ + /** @psalm-readonly */ + private ListBlock $block; + + public function __construct(ListData $listData) + { + $this->block = new ListBlock($listData); + } + + public function getBlock(): ListBlock + { + return $this->block; + } + + public function isContainer(): bool + { + return true; + } + + public function canContain(AbstractBlock $childBlock): bool + { + return $childBlock instanceof ListItem; + } + + public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue + { + // List blocks themselves don't have any markers, only list items. So try to stay in the list. + // If there is a block start other than list item, canContain makes sure that this list is closed. + return BlockContinue::at($cursor); + } + + public function closeBlock(): void + { + $item = $this->block->firstChild(); + while ($item instanceof AbstractBlock) { + // check for non-final list item ending with blank line: + if ($item->next() !== null && self::endsWithBlankLine($item)) { + $this->block->setTight(false); + break; + } + + // recurse into children of list item, to see if there are spaces between any of them + $subitem = $item->firstChild(); + while ($subitem instanceof AbstractBlock) { + if ($subitem->next() && self::endsWithBlankLine($subitem)) { + $this->block->setTight(false); + break 2; + } + + $subitem = $subitem->next(); + } + + $item = $item->next(); + } + + $lastChild = $this->block->lastChild(); + if ($lastChild instanceof AbstractBlock) { + $this->block->setEndLine($lastChild->getEndLine()); + } + } + + private static function endsWithBlankLine(AbstractBlock $block): bool + { + $next = $block->next(); + + return $next instanceof AbstractBlock && $block->getEndLine() !== $next->getStartLine() - 1; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListBlockStartParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListBlockStartParser.php new file mode 100644 index 00000000..a55f6f9d --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListBlockStartParser.php @@ -0,0 +1,154 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Parser\Block; + +use League\CommonMark\Extension\CommonMark\Node\Block\ListBlock; +use League\CommonMark\Extension\CommonMark\Node\Block\ListData; +use League\CommonMark\Parser\Block\BlockStart; +use League\CommonMark\Parser\Block\BlockStartParserInterface; +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Parser\MarkdownParserStateInterface; +use League\CommonMark\Util\RegexHelper; +use League\Config\ConfigurationAwareInterface; +use League\Config\ConfigurationInterface; + +final class ListBlockStartParser implements BlockStartParserInterface, ConfigurationAwareInterface +{ + /** @psalm-readonly-allow-private-mutation */ + private ?ConfigurationInterface $config = null; + + /** + * @psalm-var non-empty-string|null + * + * @psalm-readonly-allow-private-mutation + */ + private ?string $listMarkerRegex = null; + + public function setConfiguration(ConfigurationInterface $configuration): void + { + $this->config = $configuration; + } + + public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart + { + if ($cursor->isIndented()) { + return BlockStart::none(); + } + + $listData = $this->parseList($cursor, $parserState->getParagraphContent() !== null); + if ($listData === null) { + return BlockStart::none(); + } + + $listItemParser = new ListItemParser($listData); + + // prepend the list block if needed + $matched = $parserState->getLastMatchedBlockParser(); + if (! ($matched instanceof ListBlockParser) || ! $listData->equals($matched->getBlock()->getListData())) { + $listBlockParser = new ListBlockParser($listData); + // We start out with assuming a list is tight. If we find a blank line, we set it to loose later. + // TODO for 3.0: Just make them tight by default in the block so we can remove this call + $listBlockParser->getBlock()->setTight(true); + + return BlockStart::of($listBlockParser, $listItemParser)->at($cursor); + } + + return BlockStart::of($listItemParser)->at($cursor); + } + + private function parseList(Cursor $cursor, bool $inParagraph): ?ListData + { + $indent = $cursor->getIndent(); + + $tmpCursor = clone $cursor; + $tmpCursor->advanceToNextNonSpaceOrTab(); + $rest = $tmpCursor->getRemainder(); + + if (\preg_match($this->listMarkerRegex ?? $this->generateListMarkerRegex(), $rest) === 1) { + $data = new ListData(); + $data->markerOffset = $indent; + $data->type = ListBlock::TYPE_BULLET; + $data->delimiter = null; + $data->bulletChar = $rest[0]; + $markerLength = 1; + } elseif (($matches = RegexHelper::matchFirst('/^(\d{1,9})([.)])/', $rest)) && (! $inParagraph || $matches[1] === '1')) { + $data = new ListData(); + $data->markerOffset = $indent; + $data->type = ListBlock::TYPE_ORDERED; + $data->start = (int) $matches[1]; + $data->delimiter = $matches[2] === '.' ? ListBlock::DELIM_PERIOD : ListBlock::DELIM_PAREN; + $data->bulletChar = null; + $markerLength = \strlen($matches[0]); + } else { + return null; + } + + // Make sure we have spaces after + $nextChar = $tmpCursor->peek($markerLength); + if (! ($nextChar === null || $nextChar === "\t" || $nextChar === ' ')) { + return null; + } + + // If it interrupts paragraph, make sure first line isn't blank + if ($inParagraph && ! RegexHelper::matchAt(RegexHelper::REGEX_NON_SPACE, $rest, $markerLength)) { + return null; + } + + $cursor->advanceToNextNonSpaceOrTab(); // to start of marker + $cursor->advanceBy($markerLength, true); // to end of marker + $data->padding = self::calculateListMarkerPadding($cursor, $markerLength); + + return $data; + } + + private static function calculateListMarkerPadding(Cursor $cursor, int $markerLength): int + { + $start = $cursor->saveState(); + $spacesStartCol = $cursor->getColumn(); + + while ($cursor->getColumn() - $spacesStartCol < 5) { + if (! $cursor->advanceBySpaceOrTab()) { + break; + } + } + + $blankItem = $cursor->peek() === null; + $spacesAfterMarker = $cursor->getColumn() - $spacesStartCol; + + if ($spacesAfterMarker >= 5 || $spacesAfterMarker < 1 || $blankItem) { + $cursor->restoreState($start); + $cursor->advanceBySpaceOrTab(); + + return $markerLength + 1; + } + + return $markerLength + $spacesAfterMarker; + } + + /** + * @psalm-return non-empty-string + */ + private function generateListMarkerRegex(): string + { + // No configuration given - use the defaults + if ($this->config === null) { + return $this->listMarkerRegex = '/^[*+-]/'; + } + + $markers = $this->config->get('commonmark/unordered_list_markers'); + \assert(\is_array($markers)); + + return $this->listMarkerRegex = '/^[' . \preg_quote(\implode('', $markers), '/') . ']/'; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListItemParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListItemParser.php new file mode 100644 index 00000000..739eefcb --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ListItemParser.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 League\CommonMark\Extension\CommonMark\Parser\Block; + +use League\CommonMark\Extension\CommonMark\Node\Block\ListData; +use League\CommonMark\Extension\CommonMark\Node\Block\ListItem; +use League\CommonMark\Node\Block\AbstractBlock; +use League\CommonMark\Parser\Block\AbstractBlockContinueParser; +use League\CommonMark\Parser\Block\BlockContinue; +use League\CommonMark\Parser\Block\BlockContinueParserInterface; +use League\CommonMark\Parser\Cursor; + +final class ListItemParser extends AbstractBlockContinueParser +{ + /** @psalm-readonly */ + private ListItem $block; + + public function __construct(ListData $listData) + { + $this->block = new ListItem($listData); + } + + public function getBlock(): ListItem + { + return $this->block; + } + + public function isContainer(): bool + { + return true; + } + + public function canContain(AbstractBlock $childBlock): bool + { + return ! $childBlock instanceof ListItem; + } + + public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue + { + if ($cursor->isBlank()) { + if ($this->block->firstChild() === null) { + // Blank line after empty list item + return BlockContinue::none(); + } + + $cursor->advanceToNextNonSpaceOrTab(); + + return BlockContinue::at($cursor); + } + + $contentIndent = $this->block->getListData()->markerOffset + $this->getBlock()->getListData()->padding; + if ($cursor->getIndent() >= $contentIndent) { + $cursor->advanceBy($contentIndent, true); + + return BlockContinue::at($cursor); + } + + // Note: We'll hit this case for lazy continuation lines, they will get added later. + return BlockContinue::none(); + } + + public function closeBlock(): void + { + if (($lastChild = $this->block->lastChild()) instanceof AbstractBlock) { + $this->block->setEndLine($lastChild->getEndLine()); + } else { + // Empty list item + $this->block->setEndLine($this->block->getStartLine()); + } + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ThematicBreakParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ThematicBreakParser.php new file mode 100644 index 00000000..fb46637b --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ThematicBreakParser.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Parser\Block; + +use League\CommonMark\Extension\CommonMark\Node\Block\ThematicBreak; +use League\CommonMark\Parser\Block\AbstractBlockContinueParser; +use League\CommonMark\Parser\Block\BlockContinue; +use League\CommonMark\Parser\Block\BlockContinueParserInterface; +use League\CommonMark\Parser\Cursor; + +final class ThematicBreakParser extends AbstractBlockContinueParser +{ + /** @psalm-readonly */ + private ThematicBreak $block; + + public function __construct() + { + $this->block = new ThematicBreak(); + } + + public function getBlock(): ThematicBreak + { + return $this->block; + } + + public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue + { + // a horizontal rule can never container > 1 line, so fail to match + return BlockContinue::none(); + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ThematicBreakStartParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ThematicBreakStartParser.php new file mode 100644 index 00000000..ba7ddf37 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/ThematicBreakStartParser.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Parser\Block; + +use League\CommonMark\Parser\Block\BlockStart; +use League\CommonMark\Parser\Block\BlockStartParserInterface; +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Parser\MarkdownParserStateInterface; +use League\CommonMark\Util\RegexHelper; + +final class ThematicBreakStartParser implements BlockStartParserInterface +{ + public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart + { + if ($cursor->isIndented()) { + return BlockStart::none(); + } + + $match = RegexHelper::matchAt(RegexHelper::REGEX_THEMATIC_BREAK, $cursor->getLine(), $cursor->getNextNonSpacePosition()); + if ($match === null) { + return BlockStart::none(); + } + + // Advance to the end of the string, consuming the entire line (of the thematic break) + $cursor->advanceToEnd(); + + return BlockStart::of(new ThematicBreakParser())->at($cursor); + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/AutolinkParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/AutolinkParser.php new file mode 100644 index 00000000..810769d7 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/AutolinkParser.php @@ -0,0 +1,54 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Parser\Inline; + +use League\CommonMark\Extension\CommonMark\Node\Inline\Link; +use League\CommonMark\Parser\Inline\InlineParserInterface; +use League\CommonMark\Parser\Inline\InlineParserMatch; +use League\CommonMark\Parser\InlineParserContext; +use League\CommonMark\Util\UrlEncoder; + +final class AutolinkParser implements InlineParserInterface +{ + private const EMAIL_REGEX = '<([a-zA-Z0-9.!#$%&\'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>'; + private const OTHER_LINK_REGEX = '<([A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*)>'; + + public function getMatchDefinition(): InlineParserMatch + { + return InlineParserMatch::regex(self::EMAIL_REGEX . '|' . self::OTHER_LINK_REGEX); + } + + public function parse(InlineParserContext $inlineContext): bool + { + $inlineContext->getCursor()->advanceBy($inlineContext->getFullMatchLength()); + $matches = $inlineContext->getMatches(); + + if ($matches[1] !== '') { + $inlineContext->getContainer()->appendChild(new Link('mailto:' . UrlEncoder::unescapeAndEncode($matches[1]), $matches[1])); + + return true; + } + + if ($matches[2] !== '') { + $inlineContext->getContainer()->appendChild(new Link(UrlEncoder::unescapeAndEncode($matches[2]), $matches[2])); + + return true; + } + + return false; // This should never happen + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/BacktickParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/BacktickParser.php new file mode 100644 index 00000000..9618f2e6 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/BacktickParser.php @@ -0,0 +1,70 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Parser\Inline; + +use League\CommonMark\Extension\CommonMark\Node\Inline\Code; +use League\CommonMark\Node\Inline\Text; +use League\CommonMark\Parser\Inline\InlineParserInterface; +use League\CommonMark\Parser\Inline\InlineParserMatch; +use League\CommonMark\Parser\InlineParserContext; + +final class BacktickParser implements InlineParserInterface +{ + public function getMatchDefinition(): InlineParserMatch + { + return InlineParserMatch::regex('`+'); + } + + public function parse(InlineParserContext $inlineContext): bool + { + $ticks = $inlineContext->getFullMatch(); + $cursor = $inlineContext->getCursor(); + $cursor->advanceBy($inlineContext->getFullMatchLength()); + + $currentPosition = $cursor->getPosition(); + $previousState = $cursor->saveState(); + + while ($matchingTicks = $cursor->match('/`+/m')) { + if ($matchingTicks !== $ticks) { + continue; + } + + $code = $cursor->getSubstring($currentPosition, $cursor->getPosition() - $currentPosition - \strlen($ticks)); + + $c = \preg_replace('/\n/m', ' ', $code) ?? ''; + + if ( + $c !== '' && + $c[0] === ' ' && + \substr($c, -1, 1) === ' ' && + \preg_match('/[^ ]/', $c) + ) { + $c = \substr($c, 1, -1); + } + + $inlineContext->getContainer()->appendChild(new Code($c)); + + return true; + } + + // If we got here, we didn't match a closing backtick sequence + $cursor->restoreState($previousState); + $inlineContext->getContainer()->appendChild(new Text($ticks)); + + return true; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/BangParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/BangParser.php new file mode 100644 index 00000000..8a9e1bd6 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/BangParser.php @@ -0,0 +1,46 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Parser\Inline; + +use League\CommonMark\Delimiter\Delimiter; +use League\CommonMark\Node\Inline\Text; +use League\CommonMark\Parser\Inline\InlineParserInterface; +use League\CommonMark\Parser\Inline\InlineParserMatch; +use League\CommonMark\Parser\InlineParserContext; + +final class BangParser implements InlineParserInterface +{ + public function getMatchDefinition(): InlineParserMatch + { + return InlineParserMatch::string('!['); + } + + public function parse(InlineParserContext $inlineContext): bool + { + $cursor = $inlineContext->getCursor(); + $cursor->advanceBy(2); + + $node = new Text('![', ['delim' => true]); + $inlineContext->getContainer()->appendChild($node); + + // Add entry to stack for this opener + $delimiter = new Delimiter('!', 1, $node, true, false, $cursor->getPosition()); + $inlineContext->getDelimiterStack()->push($delimiter); + + return true; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/CloseBracketParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/CloseBracketParser.php new file mode 100644 index 00000000..16f24dc2 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/CloseBracketParser.php @@ -0,0 +1,212 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Parser\Inline; + +use League\CommonMark\Environment\EnvironmentAwareInterface; +use League\CommonMark\Environment\EnvironmentInterface; +use League\CommonMark\Extension\CommonMark\Node\Inline\AbstractWebResource; +use League\CommonMark\Extension\CommonMark\Node\Inline\Image; +use League\CommonMark\Extension\CommonMark\Node\Inline\Link; +use League\CommonMark\Extension\Mention\Mention; +use League\CommonMark\Node\Inline\AdjacentTextMerger; +use League\CommonMark\Node\Inline\Text; +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Parser\Inline\InlineParserInterface; +use League\CommonMark\Parser\Inline\InlineParserMatch; +use League\CommonMark\Parser\InlineParserContext; +use League\CommonMark\Reference\ReferenceInterface; +use League\CommonMark\Reference\ReferenceMapInterface; +use League\CommonMark\Util\LinkParserHelper; +use League\CommonMark\Util\RegexHelper; + +final class CloseBracketParser implements InlineParserInterface, EnvironmentAwareInterface +{ + /** @psalm-readonly-allow-private-mutation */ + private EnvironmentInterface $environment; + + public function getMatchDefinition(): InlineParserMatch + { + return InlineParserMatch::string(']'); + } + + public function parse(InlineParserContext $inlineContext): bool + { + // Look through stack of delimiters for a [ or ! + $opener = $inlineContext->getDelimiterStack()->searchByCharacter(['[', '!']); + if ($opener === null) { + return false; + } + + if (! $opener->isActive()) { + // no matched opener; remove from emphasis stack + $inlineContext->getDelimiterStack()->removeDelimiter($opener); + + return false; + } + + $cursor = $inlineContext->getCursor(); + + $startPos = $cursor->getPosition(); + $previousState = $cursor->saveState(); + + $cursor->advanceBy(1); + + // Check to see if we have a link/image + + // Inline link? + if ($result = $this->tryParseInlineLinkAndTitle($cursor)) { + $link = $result; + } elseif ($link = $this->tryParseReference($cursor, $inlineContext->getReferenceMap(), $opener->getIndex(), $startPos)) { + $reference = $link; + $link = ['url' => $link->getDestination(), 'title' => $link->getTitle()]; + } else { + // No match + $inlineContext->getDelimiterStack()->removeDelimiter($opener); // Remove this opener from stack + $cursor->restoreState($previousState); + + return false; + } + + $isImage = $opener->getChar() === '!'; + + $inline = $this->createInline($link['url'], $link['title'], $isImage, $reference ?? null); + $opener->getInlineNode()->replaceWith($inline); + while (($label = $inline->next()) !== null) { + // Is there a Mention or Link contained within this link? + // CommonMark does not allow nested links, so we'll restore the original text. + if ($label instanceof Mention) { + $label->replaceWith($replacement = new Text($label->getPrefix() . $label->getIdentifier())); + $inline->appendChild($replacement); + } elseif ($label instanceof Link) { + foreach ($label->children() as $child) { + $label->insertBefore($child); + } + + $label->detach(); + } else { + $inline->appendChild($label); + } + } + + // Process delimiters such as emphasis inside link/image + $delimiterStack = $inlineContext->getDelimiterStack(); + $stackBottom = $opener->getPrevious(); + $delimiterStack->processDelimiters($stackBottom, $this->environment->getDelimiterProcessors()); + $delimiterStack->removeAll($stackBottom); + + // Merge any adjacent Text nodes together + AdjacentTextMerger::mergeChildNodes($inline); + + // processEmphasis will remove this and later delimiters. + // Now, for a link, we also remove earlier link openers (no links in links) + if (! $isImage) { + $inlineContext->getDelimiterStack()->removeEarlierMatches('['); + } + + return true; + } + + public function setEnvironment(EnvironmentInterface $environment): void + { + $this->environment = $environment; + } + + /** + * @return array|null + */ + private function tryParseInlineLinkAndTitle(Cursor $cursor): ?array + { + if ($cursor->getCurrentCharacter() !== '(') { + return null; + } + + $previousState = $cursor->saveState(); + + $cursor->advanceBy(1); + $cursor->advanceToNextNonSpaceOrNewline(); + if (($dest = LinkParserHelper::parseLinkDestination($cursor)) === null) { + $cursor->restoreState($previousState); + + return null; + } + + $cursor->advanceToNextNonSpaceOrNewline(); + $previousCharacter = $cursor->peek(-1); + // We know from previous lines that we've advanced at least one space so far, so this next call should never be null + \assert(\is_string($previousCharacter)); + + $title = ''; + // make sure there's a space before the title: + if (\preg_match(RegexHelper::REGEX_WHITESPACE_CHAR, $previousCharacter)) { + $title = LinkParserHelper::parseLinkTitle($cursor) ?? ''; + } + + $cursor->advanceToNextNonSpaceOrNewline(); + + if ($cursor->getCurrentCharacter() !== ')') { + $cursor->restoreState($previousState); + + return null; + } + + $cursor->advanceBy(1); + + return ['url' => $dest, 'title' => $title]; + } + + private function tryParseReference(Cursor $cursor, ReferenceMapInterface $referenceMap, ?int $openerIndex, int $startPos): ?ReferenceInterface + { + if ($openerIndex === null) { + return null; + } + + $savePos = $cursor->saveState(); + $beforeLabel = $cursor->getPosition(); + $n = LinkParserHelper::parseLinkLabel($cursor); + if ($n === 0 || $n === 2) { + $start = $openerIndex; + $length = $startPos - $openerIndex; + } else { + $start = $beforeLabel + 1; + $length = $n - 2; + } + + $referenceLabel = $cursor->getSubstring($start, $length); + + if ($n === 0) { + // If shortcut reference link, rewind before spaces we skipped + $cursor->restoreState($savePos); + } + + return $referenceMap->get($referenceLabel); + } + + private function createInline(string $url, string $title, bool $isImage, ?ReferenceInterface $reference = null): AbstractWebResource + { + if ($isImage) { + $inline = new Image($url, null, $title); + } else { + $inline = new Link($url, null, $title); + } + + if ($reference) { + $inline->data->set('reference', $reference); + } + + return $inline; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/EntityParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/EntityParser.php new file mode 100644 index 00000000..4122ff70 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/EntityParser.php @@ -0,0 +1,42 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Parser\Inline; + +use League\CommonMark\Node\Inline\Text; +use League\CommonMark\Parser\Inline\InlineParserInterface; +use League\CommonMark\Parser\Inline\InlineParserMatch; +use League\CommonMark\Parser\InlineParserContext; +use League\CommonMark\Util\Html5EntityDecoder; +use League\CommonMark\Util\RegexHelper; + +final class EntityParser implements InlineParserInterface +{ + public function getMatchDefinition(): InlineParserMatch + { + return InlineParserMatch::regex(RegexHelper::PARTIAL_ENTITY); + } + + public function parse(InlineParserContext $inlineContext): bool + { + $entity = $inlineContext->getFullMatch(); + + $inlineContext->getCursor()->advanceBy($inlineContext->getFullMatchLength()); + $inlineContext->getContainer()->appendChild(new Text(Html5EntityDecoder::decode($entity))); + + return true; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/EscapableParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/EscapableParser.php new file mode 100644 index 00000000..64e6fab8 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/EscapableParser.php @@ -0,0 +1,57 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Parser\Inline; + +use League\CommonMark\Node\Inline\Newline; +use League\CommonMark\Node\Inline\Text; +use League\CommonMark\Parser\Inline\InlineParserInterface; +use League\CommonMark\Parser\Inline\InlineParserMatch; +use League\CommonMark\Parser\InlineParserContext; +use League\CommonMark\Util\RegexHelper; + +final class EscapableParser implements InlineParserInterface +{ + public function getMatchDefinition(): InlineParserMatch + { + return InlineParserMatch::string('\\'); + } + + public function parse(InlineParserContext $inlineContext): bool + { + $cursor = $inlineContext->getCursor(); + $nextChar = $cursor->peek(); + + if ($nextChar === "\n") { + $cursor->advanceBy(2); + $inlineContext->getContainer()->appendChild(new Newline(Newline::HARDBREAK)); + + return true; + } + + if ($nextChar !== null && RegexHelper::isEscapable($nextChar)) { + $cursor->advanceBy(2); + $inlineContext->getContainer()->appendChild(new Text($nextChar)); + + return true; + } + + $cursor->advanceBy(1); + $inlineContext->getContainer()->appendChild(new Text('\\')); + + return true; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/HtmlInlineParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/HtmlInlineParser.php new file mode 100644 index 00000000..f38db135 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/HtmlInlineParser.php @@ -0,0 +1,41 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Parser\Inline; + +use League\CommonMark\Extension\CommonMark\Node\Inline\HtmlInline; +use League\CommonMark\Parser\Inline\InlineParserInterface; +use League\CommonMark\Parser\Inline\InlineParserMatch; +use League\CommonMark\Parser\InlineParserContext; +use League\CommonMark\Util\RegexHelper; + +final class HtmlInlineParser implements InlineParserInterface +{ + public function getMatchDefinition(): InlineParserMatch + { + return InlineParserMatch::regex(RegexHelper::PARTIAL_HTMLTAG)->caseSensitive(); + } + + public function parse(InlineParserContext $inlineContext): bool + { + $inline = $inlineContext->getFullMatch(); + + $inlineContext->getCursor()->advanceBy($inlineContext->getFullMatchLength()); + $inlineContext->getContainer()->appendChild(new HtmlInline($inline)); + + return true; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/OpenBracketParser.php b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/OpenBracketParser.php new file mode 100644 index 00000000..2b52d1cd --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Parser/Inline/OpenBracketParser.php @@ -0,0 +1,44 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Parser\Inline; + +use League\CommonMark\Delimiter\Delimiter; +use League\CommonMark\Node\Inline\Text; +use League\CommonMark\Parser\Inline\InlineParserInterface; +use League\CommonMark\Parser\Inline\InlineParserMatch; +use League\CommonMark\Parser\InlineParserContext; + +final class OpenBracketParser implements InlineParserInterface +{ + public function getMatchDefinition(): InlineParserMatch + { + return InlineParserMatch::string('['); + } + + public function parse(InlineParserContext $inlineContext): bool + { + $inlineContext->getCursor()->advanceBy(1); + $node = new Text('[', ['delim' => true]); + $inlineContext->getContainer()->appendChild($node); + + // Add entry to stack for this opener + $delimiter = new Delimiter('[', 1, $node, true, false, $inlineContext->getCursor()->getPosition()); + $inlineContext->getDelimiterStack()->push($delimiter); + + return true; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/BlockQuoteRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/BlockQuoteRenderer.php new file mode 100644 index 00000000..4a59bd36 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/BlockQuoteRenderer.php @@ -0,0 +1,70 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Renderer\Block; + +use League\CommonMark\Extension\CommonMark\Node\Block\BlockQuote; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\CommonMark\Xml\XmlNodeRendererInterface; + +final class BlockQuoteRenderer implements NodeRendererInterface, XmlNodeRendererInterface +{ + /** + * @param BlockQuote $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable + { + BlockQuote::assertInstanceOf($node); + + $attrs = $node->data->get('attributes'); + + $filling = $childRenderer->renderNodes($node->children()); + $innerSeparator = $childRenderer->getInnerSeparator(); + if ($filling === '') { + return new HtmlElement('blockquote', $attrs, $innerSeparator); + } + + return new HtmlElement( + 'blockquote', + $attrs, + $innerSeparator . $filling . $innerSeparator + ); + } + + public function getXmlTagName(Node $node): string + { + return 'block_quote'; + } + + /** + * @param BlockQuote $node + * + * @return array + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function getXmlAttributes(Node $node): array + { + return []; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/FencedCodeRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/FencedCodeRenderer.php new file mode 100644 index 00000000..8df9a40e --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/FencedCodeRenderer.php @@ -0,0 +1,81 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Renderer\Block; + +use League\CommonMark\Extension\CommonMark\Node\Block\FencedCode; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\CommonMark\Util\Xml; +use League\CommonMark\Xml\XmlNodeRendererInterface; + +final class FencedCodeRenderer implements NodeRendererInterface, XmlNodeRendererInterface +{ + /** + * @param FencedCode $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable + { + FencedCode::assertInstanceOf($node); + + $attrs = $node->data->getData('attributes'); + + $infoWords = $node->getInfoWords(); + if (\count($infoWords) !== 0 && $infoWords[0] !== '') { + $class = $infoWords[0]; + if (! \str_starts_with($class, 'language-')) { + $class = 'language-' . $class; + } + + $attrs->append('class', $class); + } + + return new HtmlElement( + 'pre', + [], + new HtmlElement('code', $attrs->export(), Xml::escape($node->getLiteral())) + ); + } + + public function getXmlTagName(Node $node): string + { + return 'code_block'; + } + + /** + * @param FencedCode $node + * + * @return array + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function getXmlAttributes(Node $node): array + { + FencedCode::assertInstanceOf($node); + + if (($info = $node->getInfo()) === null || $info === '') { + return []; + } + + return ['info' => $info]; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/HeadingRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/HeadingRenderer.php new file mode 100644 index 00000000..8718b8c3 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/HeadingRenderer.php @@ -0,0 +1,64 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Renderer\Block; + +use League\CommonMark\Extension\CommonMark\Node\Block\Heading; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\CommonMark\Xml\XmlNodeRendererInterface; + +final class HeadingRenderer implements NodeRendererInterface, XmlNodeRendererInterface +{ + /** + * @param Heading $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable + { + Heading::assertInstanceOf($node); + + $tag = 'h' . $node->getLevel(); + + $attrs = $node->data->get('attributes'); + + return new HtmlElement($tag, $attrs, $childRenderer->renderNodes($node->children())); + } + + public function getXmlTagName(Node $node): string + { + return 'heading'; + } + + /** + * @param Heading $node + * + * @return array + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function getXmlAttributes(Node $node): array + { + Heading::assertInstanceOf($node); + + return ['level' => $node->getLevel()]; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/HtmlBlockRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/HtmlBlockRenderer.php new file mode 100644 index 00000000..63a19076 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/HtmlBlockRenderer.php @@ -0,0 +1,66 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Renderer\Block; + +use League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlFilter; +use League\CommonMark\Xml\XmlNodeRendererInterface; +use League\Config\ConfigurationAwareInterface; +use League\Config\ConfigurationInterface; + +final class HtmlBlockRenderer implements NodeRendererInterface, XmlNodeRendererInterface, ConfigurationAwareInterface +{ + /** @psalm-readonly-allow-private-mutation */ + private ConfigurationInterface $config; + + /** + * @param HtmlBlock $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): string + { + HtmlBlock::assertInstanceOf($node); + + $htmlInput = $this->config->get('html_input'); + + return HtmlFilter::filter($node->getLiteral(), $htmlInput); + } + + public function setConfiguration(ConfigurationInterface $configuration): void + { + $this->config = $configuration; + } + + public function getXmlTagName(Node $node): string + { + return 'html_block'; + } + + /** + * {@inheritDoc} + */ + public function getXmlAttributes(Node $node): array + { + return []; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/IndentedCodeRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/IndentedCodeRenderer.php new file mode 100644 index 00000000..c4bd4eb0 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/IndentedCodeRenderer.php @@ -0,0 +1,61 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Renderer\Block; + +use League\CommonMark\Extension\CommonMark\Node\Block\IndentedCode; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\CommonMark\Util\Xml; +use League\CommonMark\Xml\XmlNodeRendererInterface; + +final class IndentedCodeRenderer implements NodeRendererInterface, XmlNodeRendererInterface +{ + /** + * @param IndentedCode $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable + { + IndentedCode::assertInstanceOf($node); + + $attrs = $node->data->get('attributes'); + + return new HtmlElement( + 'pre', + [], + new HtmlElement('code', $attrs, Xml::escape($node->getLiteral())) + ); + } + + public function getXmlTagName(Node $node): string + { + return 'code_block'; + } + + /** + * @return array + */ + public function getXmlAttributes(Node $node): array + { + return []; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/ListBlockRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/ListBlockRenderer.php new file mode 100644 index 00000000..f79b44dd --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/ListBlockRenderer.php @@ -0,0 +1,86 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Renderer\Block; + +use League\CommonMark\Extension\CommonMark\Node\Block\ListBlock; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\CommonMark\Xml\XmlNodeRendererInterface; + +final class ListBlockRenderer implements NodeRendererInterface, XmlNodeRendererInterface +{ + /** + * @param ListBlock $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable + { + ListBlock::assertInstanceOf($node); + + $listData = $node->getListData(); + + $tag = $listData->type === ListBlock::TYPE_BULLET ? 'ul' : 'ol'; + + $attrs = $node->data->get('attributes'); + + if ($listData->start !== null && $listData->start !== 1) { + $attrs['start'] = (string) $listData->start; + } + + $innerSeparator = $childRenderer->getInnerSeparator(); + + return new HtmlElement($tag, $attrs, $innerSeparator . $childRenderer->renderNodes($node->children()) . $innerSeparator); + } + + public function getXmlTagName(Node $node): string + { + return 'list'; + } + + /** + * @param ListBlock $node + * + * @return array + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function getXmlAttributes(Node $node): array + { + ListBlock::assertInstanceOf($node); + + $data = $node->getListData(); + + if ($data->type === ListBlock::TYPE_BULLET) { + return [ + 'type' => $data->type, + 'tight' => $node->isTight() ? 'true' : 'false', + ]; + } + + return [ + 'type' => $data->type, + 'start' => $data->start ?? 1, + 'tight' => $node->isTight(), + 'delimiter' => $data->delimiter ?? ListBlock::DELIM_PERIOD, + ]; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/ListItemRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/ListItemRenderer.php new file mode 100644 index 00000000..570f5a7f --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/ListItemRenderer.php @@ -0,0 +1,74 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Renderer\Block; + +use League\CommonMark\Extension\CommonMark\Node\Block\ListItem; +use League\CommonMark\Extension\TaskList\TaskListItemMarker; +use League\CommonMark\Node\Block\Paragraph; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\CommonMark\Xml\XmlNodeRendererInterface; + +final class ListItemRenderer implements NodeRendererInterface, XmlNodeRendererInterface +{ + /** + * @param ListItem $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable + { + ListItem::assertInstanceOf($node); + + $contents = $childRenderer->renderNodes($node->children()); + if (\substr($contents, 0, 1) === '<' && ! $this->startsTaskListItem($node)) { + $contents = "\n" . $contents; + } + + if (\substr($contents, -1, 1) === '>') { + $contents .= "\n"; + } + + $attrs = $node->data->get('attributes'); + + return new HtmlElement('li', $attrs, $contents); + } + + public function getXmlTagName(Node $node): string + { + return 'item'; + } + + /** + * {@inheritDoc} + */ + public function getXmlAttributes(Node $node): array + { + return []; + } + + private function startsTaskListItem(ListItem $block): bool + { + $firstChild = $block->firstChild(); + + return $firstChild instanceof Paragraph && $firstChild->firstChild() instanceof TaskListItemMarker; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/ThematicBreakRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/ThematicBreakRenderer.php new file mode 100644 index 00000000..392bfeed --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Block/ThematicBreakRenderer.php @@ -0,0 +1,56 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Renderer\Block; + +use League\CommonMark\Extension\CommonMark\Node\Block\ThematicBreak; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\CommonMark\Xml\XmlNodeRendererInterface; + +final class ThematicBreakRenderer implements NodeRendererInterface, XmlNodeRendererInterface +{ + /** + * @param ThematicBreak $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable + { + ThematicBreak::assertInstanceOf($node); + + $attrs = $node->data->get('attributes'); + + return new HtmlElement('hr', $attrs, '', true); + } + + public function getXmlTagName(Node $node): string + { + return 'thematic_break'; + } + + /** + * {@inheritDoc} + */ + public function getXmlAttributes(Node $node): array + { + return []; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/CodeRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/CodeRenderer.php new file mode 100644 index 00000000..de030e84 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/CodeRenderer.php @@ -0,0 +1,57 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Renderer\Inline; + +use League\CommonMark\Extension\CommonMark\Node\Inline\Code; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\CommonMark\Util\Xml; +use League\CommonMark\Xml\XmlNodeRendererInterface; + +final class CodeRenderer implements NodeRendererInterface, XmlNodeRendererInterface +{ + /** + * @param Code $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable + { + Code::assertInstanceOf($node); + + $attrs = $node->data->get('attributes'); + + return new HtmlElement('code', $attrs, Xml::escape($node->getLiteral())); + } + + public function getXmlTagName(Node $node): string + { + return 'code'; + } + + /** + * {@inheritDoc} + */ + public function getXmlAttributes(Node $node): array + { + return []; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/EmphasisRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/EmphasisRenderer.php new file mode 100644 index 00000000..41169c4d --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/EmphasisRenderer.php @@ -0,0 +1,56 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Renderer\Inline; + +use League\CommonMark\Extension\CommonMark\Node\Inline\Emphasis; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\CommonMark\Xml\XmlNodeRendererInterface; + +final class EmphasisRenderer implements NodeRendererInterface, XmlNodeRendererInterface +{ + /** + * @param Emphasis $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable + { + Emphasis::assertInstanceOf($node); + + $attrs = $node->data->get('attributes'); + + return new HtmlElement('em', $attrs, $childRenderer->renderNodes($node->children())); + } + + public function getXmlTagName(Node $node): string + { + return 'emph'; + } + + /** + * {@inheritDoc} + */ + public function getXmlAttributes(Node $node): array + { + return []; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/HtmlInlineRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/HtmlInlineRenderer.php new file mode 100644 index 00000000..69f0fd5a --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/HtmlInlineRenderer.php @@ -0,0 +1,66 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Renderer\Inline; + +use League\CommonMark\Extension\CommonMark\Node\Inline\HtmlInline; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlFilter; +use League\CommonMark\Xml\XmlNodeRendererInterface; +use League\Config\ConfigurationAwareInterface; +use League\Config\ConfigurationInterface; + +final class HtmlInlineRenderer implements NodeRendererInterface, XmlNodeRendererInterface, ConfigurationAwareInterface +{ + /** @psalm-readonly-allow-private-mutation */ + private ConfigurationInterface $config; + + /** + * @param HtmlInline $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): string + { + HtmlInline::assertInstanceOf($node); + + $htmlInput = $this->config->get('html_input'); + + return HtmlFilter::filter($node->getLiteral(), $htmlInput); + } + + public function setConfiguration(ConfigurationInterface $configuration): void + { + $this->config = $configuration; + } + + public function getXmlTagName(Node $node): string + { + return 'html_inline'; + } + + /** + * {@inheritDoc} + */ + public function getXmlAttributes(Node $node): array + { + return []; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/ImageRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/ImageRenderer.php new file mode 100644 index 00000000..7bf09ac7 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/ImageRenderer.php @@ -0,0 +1,107 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Renderer\Inline; + +use League\CommonMark\Extension\CommonMark\Node\Inline\Image; +use League\CommonMark\Node\Inline\Newline; +use League\CommonMark\Node\Node; +use League\CommonMark\Node\NodeIterator; +use League\CommonMark\Node\StringContainerInterface; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\CommonMark\Util\RegexHelper; +use League\CommonMark\Xml\XmlNodeRendererInterface; +use League\Config\ConfigurationAwareInterface; +use League\Config\ConfigurationInterface; + +final class ImageRenderer implements NodeRendererInterface, XmlNodeRendererInterface, ConfigurationAwareInterface +{ + /** @psalm-readonly-allow-private-mutation */ + private ConfigurationInterface $config; + + /** + * @param Image $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable + { + Image::assertInstanceOf($node); + + $attrs = $node->data->get('attributes'); + + $forbidUnsafeLinks = ! $this->config->get('allow_unsafe_links'); + if ($forbidUnsafeLinks && RegexHelper::isLinkPotentiallyUnsafe($node->getUrl())) { + $attrs['src'] = ''; + } else { + $attrs['src'] = $node->getUrl(); + } + + $attrs['alt'] = $this->getAltText($node); + + if (($title = $node->getTitle()) !== null) { + $attrs['title'] = $title; + } + + return new HtmlElement('img', $attrs, '', true); + } + + public function setConfiguration(ConfigurationInterface $configuration): void + { + $this->config = $configuration; + } + + public function getXmlTagName(Node $node): string + { + return 'image'; + } + + /** + * @param Image $node + * + * @return array + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function getXmlAttributes(Node $node): array + { + Image::assertInstanceOf($node); + + return [ + 'destination' => $node->getUrl(), + 'title' => $node->getTitle() ?? '', + ]; + } + + private function getAltText(Image $node): string + { + $altText = ''; + + foreach ((new NodeIterator($node)) as $n) { + if ($n instanceof StringContainerInterface) { + $altText .= $n->getLiteral(); + } elseif ($n instanceof Newline) { + $altText .= "\n"; + } + } + + return $altText; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/LinkRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/LinkRenderer.php new file mode 100644 index 00000000..4ef96452 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/LinkRenderer.php @@ -0,0 +1,89 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Renderer\Inline; + +use League\CommonMark\Extension\CommonMark\Node\Inline\Link; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\CommonMark\Util\RegexHelper; +use League\CommonMark\Xml\XmlNodeRendererInterface; +use League\Config\ConfigurationAwareInterface; +use League\Config\ConfigurationInterface; + +final class LinkRenderer implements NodeRendererInterface, XmlNodeRendererInterface, ConfigurationAwareInterface +{ + /** @psalm-readonly-allow-private-mutation */ + private ConfigurationInterface $config; + + /** + * @param Link $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable + { + Link::assertInstanceOf($node); + + $attrs = $node->data->get('attributes'); + + $forbidUnsafeLinks = ! $this->config->get('allow_unsafe_links'); + if (! ($forbidUnsafeLinks && RegexHelper::isLinkPotentiallyUnsafe($node->getUrl()))) { + $attrs['href'] = $node->getUrl(); + } + + if (($title = $node->getTitle()) !== null) { + $attrs['title'] = $title; + } + + if (isset($attrs['target']) && $attrs['target'] === '_blank' && ! isset($attrs['rel'])) { + $attrs['rel'] = 'noopener noreferrer'; + } + + return new HtmlElement('a', $attrs, $childRenderer->renderNodes($node->children())); + } + + public function setConfiguration(ConfigurationInterface $configuration): void + { + $this->config = $configuration; + } + + public function getXmlTagName(Node $node): string + { + return 'link'; + } + + /** + * @param Link $node + * + * @return array + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function getXmlAttributes(Node $node): array + { + Link::assertInstanceOf($node); + + return [ + 'destination' => $node->getUrl(), + 'title' => $node->getTitle() ?? '', + ]; + } +} diff --git a/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/StrongRenderer.php b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/StrongRenderer.php new file mode 100644 index 00000000..f0bb8f9c --- /dev/null +++ b/vendor/league/commonmark/src/Extension/CommonMark/Renderer/Inline/StrongRenderer.php @@ -0,0 +1,56 @@ + + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\CommonMark\Renderer\Inline; + +use League\CommonMark\Extension\CommonMark\Node\Inline\Strong; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\CommonMark\Xml\XmlNodeRendererInterface; + +final class StrongRenderer implements NodeRendererInterface, XmlNodeRendererInterface +{ + /** + * @param Strong $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable + { + Strong::assertInstanceOf($node); + + $attrs = $node->data->get('attributes'); + + return new HtmlElement('strong', $attrs, $childRenderer->renderNodes($node->children())); + } + + public function getXmlTagName(Node $node): string + { + return 'strong'; + } + + /** + * {@inheritDoc} + */ + public function getXmlAttributes(Node $node): array + { + return []; + } +} diff --git a/vendor/league/commonmark/src/Extension/ConfigurableExtensionInterface.php b/vendor/league/commonmark/src/Extension/ConfigurableExtensionInterface.php new file mode 100644 index 00000000..63e467cb --- /dev/null +++ b/vendor/league/commonmark/src/Extension/ConfigurableExtensionInterface.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 League\CommonMark\Extension; + +use League\Config\ConfigurationBuilderInterface; + +interface ConfigurableExtensionInterface extends ExtensionInterface +{ + public function configureSchema(ConfigurationBuilderInterface $builder): void; +} diff --git a/vendor/league/commonmark/src/Extension/DefaultAttributes/ApplyDefaultAttributesProcessor.php b/vendor/league/commonmark/src/Extension/DefaultAttributes/ApplyDefaultAttributesProcessor.php new file mode 100644 index 00000000..6b519f86 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/DefaultAttributes/ApplyDefaultAttributesProcessor.php @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\DefaultAttributes; + +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\Attributes\Util\AttributesHelper; +use League\Config\ConfigurationAwareInterface; +use League\Config\ConfigurationInterface; + +final class ApplyDefaultAttributesProcessor implements ConfigurationAwareInterface +{ + private ConfigurationInterface $config; + + public function onDocumentParsed(DocumentParsedEvent $event): void + { + /** @var array> $map */ + $map = $this->config->get('default_attributes'); + + // Don't bother iterating if no default attributes are configured + if (! $map) { + return; + } + + foreach ($event->getDocument()->iterator() as $node) { + // Check to see if any default attributes were defined + if (($attributesToApply = $map[\get_class($node)] ?? []) === []) { + continue; + } + + $newAttributes = []; + foreach ($attributesToApply as $name => $value) { + if (\is_callable($value)) { + $value = $value($node); + // Callables are allowed to return `null` indicating that no changes should be made + if ($value !== null) { + $newAttributes[$name] = $value; + } + } else { + $newAttributes[$name] = $value; + } + } + + // Merge these attributes into the node + if (\count($newAttributes) > 0) { + $node->data->set('attributes', AttributesHelper::mergeAttributes($node, $newAttributes)); + } + } + } + + public function setConfiguration(ConfigurationInterface $configuration): void + { + $this->config = $configuration; + } +} diff --git a/vendor/league/commonmark/src/Extension/DefaultAttributes/DefaultAttributesExtension.php b/vendor/league/commonmark/src/Extension/DefaultAttributes/DefaultAttributesExtension.php new file mode 100644 index 00000000..152c29a0 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/DefaultAttributes/DefaultAttributesExtension.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\DefaultAttributes; + +use League\CommonMark\Environment\EnvironmentBuilderInterface; +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\ConfigurableExtensionInterface; +use League\Config\ConfigurationBuilderInterface; +use Nette\Schema\Expect; + +final class DefaultAttributesExtension implements ConfigurableExtensionInterface +{ + public function configureSchema(ConfigurationBuilderInterface $builder): void + { + $builder->addSchema('default_attributes', Expect::arrayOf( + Expect::arrayOf( + Expect::type('string|string[]|bool|callable'), // attribute value(s) + 'string' // attribute name + ), + 'string' // node FQCN + )->default([])); + } + + public function register(EnvironmentBuilderInterface $environment): void + { + $environment->addEventListener(DocumentParsedEvent::class, [new ApplyDefaultAttributesProcessor(), 'onDocumentParsed']); + } +} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/DescriptionListExtension.php b/vendor/league/commonmark/src/Extension/DescriptionList/DescriptionListExtension.php new file mode 100644 index 00000000..9ddd2a83 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/DescriptionList/DescriptionListExtension.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\DescriptionList; + +use League\CommonMark\Environment\EnvironmentBuilderInterface; +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\DescriptionList\Event\ConsecutiveDescriptionListMerger; +use League\CommonMark\Extension\DescriptionList\Event\LooseDescriptionHandler; +use League\CommonMark\Extension\DescriptionList\Node\Description; +use League\CommonMark\Extension\DescriptionList\Node\DescriptionList; +use League\CommonMark\Extension\DescriptionList\Node\DescriptionTerm; +use League\CommonMark\Extension\DescriptionList\Parser\DescriptionStartParser; +use League\CommonMark\Extension\DescriptionList\Renderer\DescriptionListRenderer; +use League\CommonMark\Extension\DescriptionList\Renderer\DescriptionRenderer; +use League\CommonMark\Extension\DescriptionList\Renderer\DescriptionTermRenderer; +use League\CommonMark\Extension\ExtensionInterface; + +final class DescriptionListExtension implements ExtensionInterface +{ + public function register(EnvironmentBuilderInterface $environment): void + { + $environment->addBlockStartParser(new DescriptionStartParser()); + + $environment->addEventListener(DocumentParsedEvent::class, new LooseDescriptionHandler(), 1001); + $environment->addEventListener(DocumentParsedEvent::class, new ConsecutiveDescriptionListMerger(), 1000); + + $environment->addRenderer(DescriptionList::class, new DescriptionListRenderer()); + $environment->addRenderer(DescriptionTerm::class, new DescriptionTermRenderer()); + $environment->addRenderer(Description::class, new DescriptionRenderer()); + } +} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/Event/ConsecutiveDescriptionListMerger.php b/vendor/league/commonmark/src/Extension/DescriptionList/Event/ConsecutiveDescriptionListMerger.php new file mode 100644 index 00000000..15210e77 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/DescriptionList/Event/ConsecutiveDescriptionListMerger.php @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\DescriptionList\Event; + +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\DescriptionList\Node\DescriptionList; +use League\CommonMark\Node\NodeIterator; + +final class ConsecutiveDescriptionListMerger +{ + public function __invoke(DocumentParsedEvent $event): void + { + foreach ($event->getDocument()->iterator(NodeIterator::FLAG_BLOCKS_ONLY) as $node) { + if (! $node instanceof DescriptionList) { + continue; + } + + if (! ($prev = $node->previous()) instanceof DescriptionList) { + continue; + } + + // There's another description list behind this one; merge the current one into that + foreach ($node->children() as $child) { + $prev->appendChild($child); + } + + $node->detach(); + } + } +} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/Event/LooseDescriptionHandler.php b/vendor/league/commonmark/src/Extension/DescriptionList/Event/LooseDescriptionHandler.php new file mode 100644 index 00000000..a8823fab --- /dev/null +++ b/vendor/league/commonmark/src/Extension/DescriptionList/Event/LooseDescriptionHandler.php @@ -0,0 +1,66 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\DescriptionList\Event; + +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\DescriptionList\Node\Description; +use League\CommonMark\Extension\DescriptionList\Node\DescriptionList; +use League\CommonMark\Extension\DescriptionList\Node\DescriptionTerm; +use League\CommonMark\Node\Block\Paragraph; +use League\CommonMark\Node\Inline\Newline; +use League\CommonMark\Node\NodeIterator; + +final class LooseDescriptionHandler +{ + public function __invoke(DocumentParsedEvent $event): void + { + foreach ($event->getDocument()->iterator(NodeIterator::FLAG_BLOCKS_ONLY) as $description) { + if (! $description instanceof Description) { + continue; + } + + // Does this description need to be added to a list? + if (! $description->parent() instanceof DescriptionList) { + $list = new DescriptionList(); + // Taking any preceding paragraphs with it + if (($paragraph = $description->previous()) instanceof Paragraph) { + $list->appendChild($paragraph); + } + + $description->replaceWith($list); + $list->appendChild($description); + } + + // Is this description preceded by a paragraph that should really be a term? + if (! (($paragraph = $description->previous()) instanceof Paragraph)) { + continue; + } + + // Convert the paragraph into one or more terms + $term = new DescriptionTerm(); + $paragraph->replaceWith($term); + + foreach ($paragraph->children() as $child) { + if ($child instanceof Newline) { + $newTerm = new DescriptionTerm(); + $term->insertAfter($newTerm); + $term = $newTerm; + continue; + } + + $term->appendChild($child); + } + } + } +} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/Node/Description.php b/vendor/league/commonmark/src/Extension/DescriptionList/Node/Description.php new file mode 100644 index 00000000..ccef962f --- /dev/null +++ b/vendor/league/commonmark/src/Extension/DescriptionList/Node/Description.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\DescriptionList\Node; + +use League\CommonMark\Node\Block\AbstractBlock; +use League\CommonMark\Node\Block\TightBlockInterface; + +class Description extends AbstractBlock implements TightBlockInterface +{ + private bool $tight; + + public function __construct(bool $tight = false) + { + parent::__construct(); + + $this->tight = $tight; + } + + public function isTight(): bool + { + return $this->tight; + } + + public function setTight(bool $tight): void + { + $this->tight = $tight; + } +} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/Node/DescriptionList.php b/vendor/league/commonmark/src/Extension/DescriptionList/Node/DescriptionList.php new file mode 100644 index 00000000..90d026c3 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/DescriptionList/Node/DescriptionList.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 League\CommonMark\Extension\DescriptionList\Node; + +use League\CommonMark\Node\Block\AbstractBlock; + +class DescriptionList extends AbstractBlock +{ +} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/Node/DescriptionTerm.php b/vendor/league/commonmark/src/Extension/DescriptionList/Node/DescriptionTerm.php new file mode 100644 index 00000000..b13ec751 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/DescriptionList/Node/DescriptionTerm.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 League\CommonMark\Extension\DescriptionList\Node; + +use League\CommonMark\Node\Block\AbstractBlock; + +class DescriptionTerm extends AbstractBlock +{ +} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionContinueParser.php b/vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionContinueParser.php new file mode 100644 index 00000000..0cdd9d56 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionContinueParser.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\DescriptionList\Parser; + +use League\CommonMark\Extension\DescriptionList\Node\Description; +use League\CommonMark\Node\Block\AbstractBlock; +use League\CommonMark\Parser\Block\AbstractBlockContinueParser; +use League\CommonMark\Parser\Block\BlockContinue; +use League\CommonMark\Parser\Block\BlockContinueParserInterface; +use League\CommonMark\Parser\Cursor; + +final class DescriptionContinueParser extends AbstractBlockContinueParser +{ + private Description $block; + + private int $indentation; + + public function __construct(bool $tight, int $indentation) + { + $this->block = new Description($tight); + $this->indentation = $indentation; + } + + public function getBlock(): Description + { + return $this->block; + } + + public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue + { + if ($cursor->isBlank()) { + if ($this->block->firstChild() === null) { + // Blank line after empty item + return BlockContinue::none(); + } + + $cursor->advanceToNextNonSpaceOrTab(); + + return BlockContinue::at($cursor); + } + + if ($cursor->getIndent() >= $this->indentation) { + $cursor->advanceBy($this->indentation, true); + + return BlockContinue::at($cursor); + } + + return BlockContinue::none(); + } + + public function isContainer(): bool + { + return true; + } + + public function canContain(AbstractBlock $childBlock): bool + { + return true; + } +} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionListContinueParser.php b/vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionListContinueParser.php new file mode 100644 index 00000000..1d446a77 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionListContinueParser.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\DescriptionList\Parser; + +use League\CommonMark\Extension\DescriptionList\Node\Description; +use League\CommonMark\Extension\DescriptionList\Node\DescriptionList; +use League\CommonMark\Extension\DescriptionList\Node\DescriptionTerm; +use League\CommonMark\Node\Block\AbstractBlock; +use League\CommonMark\Parser\Block\AbstractBlockContinueParser; +use League\CommonMark\Parser\Block\BlockContinue; +use League\CommonMark\Parser\Block\BlockContinueParserInterface; +use League\CommonMark\Parser\Cursor; + +final class DescriptionListContinueParser extends AbstractBlockContinueParser +{ + private DescriptionList $block; + + public function __construct() + { + $this->block = new DescriptionList(); + } + + public function getBlock(): DescriptionList + { + return $this->block; + } + + public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue + { + return BlockContinue::at($cursor); + } + + public function isContainer(): bool + { + return true; + } + + public function canContain(AbstractBlock $childBlock): bool + { + return $childBlock instanceof DescriptionTerm || $childBlock instanceof Description; + } +} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionStartParser.php b/vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionStartParser.php new file mode 100644 index 00000000..b4e8c98e --- /dev/null +++ b/vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionStartParser.php @@ -0,0 +1,73 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\DescriptionList\Parser; + +use League\CommonMark\Extension\DescriptionList\Node\Description; +use League\CommonMark\Node\Block\Paragraph; +use League\CommonMark\Parser\Block\BlockStart; +use League\CommonMark\Parser\Block\BlockStartParserInterface; +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Parser\MarkdownParserStateInterface; + +final class DescriptionStartParser implements BlockStartParserInterface +{ + public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart + { + if ($cursor->isIndented()) { + return BlockStart::none(); + } + + $cursor->advanceToNextNonSpaceOrTab(); + if ($cursor->match('/^:[ \t]+/') === null) { + return BlockStart::none(); + } + + $terms = $parserState->getParagraphContent(); + + $activeBlock = $parserState->getActiveBlockParser()->getBlock(); + + if ($terms !== null && $terms !== '') { + // New description; tight; term(s) sitting in pending block that we will replace + return BlockStart::of(...[new DescriptionListContinueParser()], ...self::splitTerms($terms), ...[new DescriptionContinueParser(true, $cursor->getPosition())]) + ->at($cursor) + ->replaceActiveBlockParser(); + } + + if ($activeBlock instanceof Paragraph && $activeBlock->parent() instanceof Description) { + // Additional description in the same list as the parent description + return BlockStart::of(new DescriptionContinueParser(true, $cursor->getPosition()))->at($cursor); + } + + if ($activeBlock->lastChild() instanceof Paragraph) { + // New description; loose; term(s) sitting in previous closed paragraph block + return BlockStart::of(new DescriptionContinueParser(false, $cursor->getPosition()))->at($cursor); + } + + // No preceding terms + return BlockStart::none(); + } + + /** + * @return array + */ + private static function splitTerms(string $terms): array + { + $ret = []; + foreach (\explode("\n", $terms) as $term) { + $ret[] = new DescriptionTermContinueParser($term); + } + + return $ret; + } +} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionTermContinueParser.php b/vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionTermContinueParser.php new file mode 100644 index 00000000..7b43882e --- /dev/null +++ b/vendor/league/commonmark/src/Extension/DescriptionList/Parser/DescriptionTermContinueParser.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\DescriptionList\Parser; + +use League\CommonMark\Extension\DescriptionList\Node\DescriptionTerm; +use League\CommonMark\Parser\Block\AbstractBlockContinueParser; +use League\CommonMark\Parser\Block\BlockContinue; +use League\CommonMark\Parser\Block\BlockContinueParserInterface; +use League\CommonMark\Parser\Block\BlockContinueParserWithInlinesInterface; +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Parser\InlineParserEngineInterface; + +final class DescriptionTermContinueParser extends AbstractBlockContinueParser implements BlockContinueParserWithInlinesInterface +{ + private DescriptionTerm $block; + + private string $term; + + public function __construct(string $term) + { + $this->block = new DescriptionTerm(); + $this->term = $term; + } + + public function getBlock(): DescriptionTerm + { + return $this->block; + } + + public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue + { + return BlockContinue::finished(); + } + + public function parseInlines(InlineParserEngineInterface $inlineParser): void + { + if ($this->term !== '') { + $inlineParser->parse($this->term, $this->block); + } + } +} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/Renderer/DescriptionListRenderer.php b/vendor/league/commonmark/src/Extension/DescriptionList/Renderer/DescriptionListRenderer.php new file mode 100644 index 00000000..7723038f --- /dev/null +++ b/vendor/league/commonmark/src/Extension/DescriptionList/Renderer/DescriptionListRenderer.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\DescriptionList\Renderer; + +use League\CommonMark\Extension\DescriptionList\Node\DescriptionList; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; + +final class DescriptionListRenderer implements NodeRendererInterface +{ + /** + * @param DescriptionList $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): HtmlElement + { + DescriptionList::assertInstanceOf($node); + + $separator = $childRenderer->getBlockSeparator(); + + return new HtmlElement('dl', [], $separator . $childRenderer->renderNodes($node->children()) . $separator); + } +} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/Renderer/DescriptionRenderer.php b/vendor/league/commonmark/src/Extension/DescriptionList/Renderer/DescriptionRenderer.php new file mode 100644 index 00000000..5fcffd6a --- /dev/null +++ b/vendor/league/commonmark/src/Extension/DescriptionList/Renderer/DescriptionRenderer.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\DescriptionList\Renderer; + +use League\CommonMark\Extension\DescriptionList\Node\Description; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; + +final class DescriptionRenderer implements NodeRendererInterface +{ + /** + * @param Description $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable + { + Description::assertInstanceOf($node); + + return new HtmlElement('dd', [], $childRenderer->renderNodes($node->children())); + } +} diff --git a/vendor/league/commonmark/src/Extension/DescriptionList/Renderer/DescriptionTermRenderer.php b/vendor/league/commonmark/src/Extension/DescriptionList/Renderer/DescriptionTermRenderer.php new file mode 100644 index 00000000..ce8a1c44 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/DescriptionList/Renderer/DescriptionTermRenderer.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\DescriptionList\Renderer; + +use League\CommonMark\Extension\DescriptionList\Node\DescriptionTerm; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; + +final class DescriptionTermRenderer implements NodeRendererInterface +{ + /** + * @param DescriptionTerm $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable + { + DescriptionTerm::assertInstanceOf($node); + + return new HtmlElement('dt', [], $childRenderer->renderNodes($node->children())); + } +} diff --git a/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlExtension.php b/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlExtension.php new file mode 100644 index 00000000..0ece0c2f --- /dev/null +++ b/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlExtension.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 League\CommonMark\Extension\DisallowedRawHtml; + +use League\CommonMark\Environment\EnvironmentBuilderInterface; +use League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock; +use League\CommonMark\Extension\CommonMark\Node\Inline\HtmlInline; +use League\CommonMark\Extension\CommonMark\Renderer\Block\HtmlBlockRenderer; +use League\CommonMark\Extension\CommonMark\Renderer\Inline\HtmlInlineRenderer; +use League\CommonMark\Extension\ConfigurableExtensionInterface; +use League\Config\ConfigurationBuilderInterface; +use Nette\Schema\Expect; + +final class DisallowedRawHtmlExtension implements ConfigurableExtensionInterface +{ + private const DEFAULT_DISALLOWED_TAGS = [ + 'title', + 'textarea', + 'style', + 'xmp', + 'iframe', + 'noembed', + 'noframes', + 'script', + 'plaintext', + ]; + + public function configureSchema(ConfigurationBuilderInterface $builder): void + { + $builder->addSchema('disallowed_raw_html', Expect::structure([ + 'disallowed_tags' => Expect::listOf('string')->default(self::DEFAULT_DISALLOWED_TAGS)->mergeDefaults(false), + ])); + } + + public function register(EnvironmentBuilderInterface $environment): void + { + $environment->addRenderer(HtmlBlock::class, new DisallowedRawHtmlRenderer(new HtmlBlockRenderer()), 50); + $environment->addRenderer(HtmlInline::class, new DisallowedRawHtmlRenderer(new HtmlInlineRenderer()), 50); + } +} diff --git a/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlRenderer.php b/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlRenderer.php new file mode 100644 index 00000000..06252a31 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/DisallowedRawHtml/DisallowedRawHtmlRenderer.php @@ -0,0 +1,62 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\DisallowedRawHtml; + +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\Config\ConfigurationAwareInterface; +use League\Config\ConfigurationInterface; + +final class DisallowedRawHtmlRenderer implements NodeRendererInterface, ConfigurationAwareInterface +{ + /** @psalm-readonly */ + private NodeRendererInterface $innerRenderer; + + /** @psalm-readonly-allow-private-mutation */ + private ConfigurationInterface $config; + + public function __construct(NodeRendererInterface $innerRenderer) + { + $this->innerRenderer = $innerRenderer; + } + + public function render(Node $node, ChildNodeRendererInterface $childRenderer): ?string + { + $rendered = (string) $this->innerRenderer->render($node, $childRenderer); + + if ($rendered === '') { + return ''; + } + + $tags = (array) $this->config->get('disallowed_raw_html/disallowed_tags'); + if (\count($tags) === 0) { + return $rendered; + } + + $regex = \sprintf('/<(\/?(?:%s)[ \/>])/i', \implode('|', \array_map('preg_quote', $tags))); + + // Match these types of tags: <title/> <title /> + return \preg_replace($regex, '<$1', $rendered); + } + + public function setConfiguration(ConfigurationInterface $configuration): void + { + $this->config = $configuration; + + if ($this->innerRenderer instanceof ConfigurationAwareInterface) { + $this->innerRenderer->setConfiguration($configuration); + } + } +} diff --git a/vendor/league/commonmark/src/Extension/Embed/Bridge/OscaroteroEmbedAdapter.php b/vendor/league/commonmark/src/Extension/Embed/Bridge/OscaroteroEmbedAdapter.php new file mode 100644 index 00000000..06b8190d --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Embed/Bridge/OscaroteroEmbedAdapter.php @@ -0,0 +1,50 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Embed\Bridge; + +use Embed\Embed as EmbedLib; +use League\CommonMark\Exception\MissingDependencyException; +use League\CommonMark\Extension\Embed\Embed; +use League\CommonMark\Extension\Embed\EmbedAdapterInterface; + +final class OscaroteroEmbedAdapter implements EmbedAdapterInterface +{ + private EmbedLib $embedLib; + + public function __construct(?EmbedLib $embed = null) + { + if ($embed === null) { + if (! \class_exists(EmbedLib::class)) { + throw new MissingDependencyException('The embed/embed package is not installed. Please install it with Composer to use this adapter.'); + } + + $embed = new EmbedLib(); + } + + $this->embedLib = $embed; + } + + /** + * {@inheritDoc} + */ + public function updateEmbeds(array $embeds): void + { + $extractors = $this->embedLib->getMulti(...\array_map(static fn (Embed $embed) => $embed->getUrl(), $embeds)); + foreach ($extractors as $i => $extractor) { + if ($extractor->code !== null) { + $embeds[$i]->setEmbedCode($extractor->code->html); + } + } + } +} diff --git a/vendor/league/commonmark/src/Extension/Embed/DomainFilteringAdapter.php b/vendor/league/commonmark/src/Extension/Embed/DomainFilteringAdapter.php new file mode 100644 index 00000000..d150764a --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Embed/DomainFilteringAdapter.php @@ -0,0 +1,53 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Embed; + +class DomainFilteringAdapter implements EmbedAdapterInterface +{ + private EmbedAdapterInterface $decorated; + + /** @psalm-var non-empty-string */ + private string $regex; + + /** + * @param string[] $allowedDomains + */ + public function __construct(EmbedAdapterInterface $decorated, array $allowedDomains) + { + $this->decorated = $decorated; + $this->regex = self::createRegex($allowedDomains); + } + + /** + * {@inheritDoc} + */ + public function updateEmbeds(array $embeds): void + { + $this->decorated->updateEmbeds(\array_values(\array_filter($embeds, function (Embed $embed): bool { + return \preg_match($this->regex, $embed->getUrl()) === 1; + }))); + } + + /** + * @param string[] $allowedDomains + * + * @psalm-return non-empty-string + */ + private static function createRegex(array $allowedDomains): string + { + $allowedDomains = \array_map('preg_quote', $allowedDomains); + + return '/^(?:https?:\/\/)?(?:[^.]+\.)*(' . \implode('|', $allowedDomains) . ')/'; + } +} diff --git a/vendor/league/commonmark/src/Extension/Embed/Embed.php b/vendor/league/commonmark/src/Extension/Embed/Embed.php new file mode 100644 index 00000000..94c19804 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Embed/Embed.php @@ -0,0 +1,50 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Embed; + +use League\CommonMark\Node\Block\AbstractBlock; + +final class Embed extends AbstractBlock +{ + private string $url; + private ?string $embedCode; + + public function __construct(string $url, ?string $embedCode = null) + { + parent::__construct(); + + $this->url = $url; + $this->embedCode = $embedCode; + } + + public function getUrl(): string + { + return $this->url; + } + + public function setUrl(string $url): void + { + $this->url = $url; + } + + public function getEmbedCode(): ?string + { + return $this->embedCode; + } + + public function setEmbedCode(?string $embedCode): void + { + $this->embedCode = $embedCode; + } +} diff --git a/vendor/league/commonmark/src/Extension/Embed/EmbedAdapterInterface.php b/vendor/league/commonmark/src/Extension/Embed/EmbedAdapterInterface.php new file mode 100644 index 00000000..9880a439 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Embed/EmbedAdapterInterface.php @@ -0,0 +1,25 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Embed; + +/** + * Interface for a service which updates the embed code(s) for the given array of embeds + */ +interface EmbedAdapterInterface +{ + /** + * @param Embed[] $embeds + */ + public function updateEmbeds(array $embeds): void; +} diff --git a/vendor/league/commonmark/src/Extension/Embed/EmbedExtension.php b/vendor/league/commonmark/src/Extension/Embed/EmbedExtension.php new file mode 100644 index 00000000..babf048d --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Embed/EmbedExtension.php @@ -0,0 +1,48 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Embed; + +use League\CommonMark\Environment\EnvironmentBuilderInterface; +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\ConfigurableExtensionInterface; +use League\Config\ConfigurationBuilderInterface; +use Nette\Schema\Expect; + +final class EmbedExtension implements ConfigurableExtensionInterface +{ + public function configureSchema(ConfigurationBuilderInterface $builder): void + { + $builder->addSchema('embed', Expect::structure([ + 'adapter' => Expect::type(EmbedAdapterInterface::class), + 'allowed_domains' => Expect::arrayOf('string')->default([]), + 'fallback' => Expect::anyOf('link', 'remove')->default('link'), + ])); + } + + public function register(EnvironmentBuilderInterface $environment): void + { + $adapter = $environment->getConfiguration()->get('embed.adapter'); + \assert($adapter instanceof EmbedAdapterInterface); + + $allowedDomains = $environment->getConfiguration()->get('embed.allowed_domains'); + if ($allowedDomains !== []) { + $adapter = new DomainFilteringAdapter($adapter, $allowedDomains); + } + + $environment + ->addBlockStartParser(new EmbedStartParser(), 300) + ->addEventListener(DocumentParsedEvent::class, new EmbedProcessor($adapter, $environment->getConfiguration()->get('embed.fallback')), 1010) + ->addRenderer(Embed::class, new EmbedRenderer()); + } +} diff --git a/vendor/league/commonmark/src/Extension/Embed/EmbedParser.php b/vendor/league/commonmark/src/Extension/Embed/EmbedParser.php new file mode 100644 index 00000000..e957caf8 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Embed/EmbedParser.php @@ -0,0 +1,62 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Embed; + +use League\CommonMark\Node\Block\AbstractBlock; +use League\CommonMark\Parser\Block\BlockContinue; +use League\CommonMark\Parser\Block\BlockContinueParserInterface; +use League\CommonMark\Parser\Cursor; + +class EmbedParser implements BlockContinueParserInterface +{ + private Embed $embed; + + public function __construct(string $url) + { + $this->embed = new Embed($url); + } + + public function getBlock(): AbstractBlock + { + return $this->embed; + } + + public function isContainer(): bool + { + return false; + } + + public function canHaveLazyContinuationLines(): bool + { + return false; + } + + public function canContain(AbstractBlock $childBlock): bool + { + return false; + } + + public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue + { + return BlockContinue::none(); + } + + public function addLine(string $line): void + { + } + + public function closeBlock(): void + { + } +} diff --git a/vendor/league/commonmark/src/Extension/Embed/EmbedProcessor.php b/vendor/league/commonmark/src/Extension/Embed/EmbedProcessor.php new file mode 100644 index 00000000..68fb9eeb --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Embed/EmbedProcessor.php @@ -0,0 +1,70 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Embed; + +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\CommonMark\Node\Inline\Link; +use League\CommonMark\Node\Block\Paragraph; +use League\CommonMark\Node\Inline\Text; +use League\CommonMark\Node\NodeIterator; + +final class EmbedProcessor +{ + public const FALLBACK_REMOVE = 'remove'; + public const FALLBACK_LINK = 'link'; + + private EmbedAdapterInterface $adapter; + private string $fallback; + + public function __construct(EmbedAdapterInterface $adapter, string $fallback = self::FALLBACK_REMOVE) + { + $this->adapter = $adapter; + $this->fallback = $fallback; + } + + public function __invoke(DocumentParsedEvent $event): void + { + $document = $event->getDocument(); + $embeds = []; + foreach (new NodeIterator($document) as $node) { + if (! ($node instanceof Embed)) { + continue; + } + + if ($node->parent() !== $document) { + $replacement = new Paragraph(); + $replacement->appendChild(new Text($node->getUrl())); + $node->replaceWith($replacement); + } else { + $embeds[] = $node; + } + } + + $this->adapter->updateEmbeds($embeds); + + foreach ($embeds as $embed) { + if ($embed->getEmbedCode() !== null) { + continue; + } + + if ($this->fallback === self::FALLBACK_REMOVE) { + $embed->detach(); + } elseif ($this->fallback === self::FALLBACK_LINK) { + $paragraph = new Paragraph(); + $paragraph->appendChild(new Link($embed->getUrl(), $embed->getUrl())); + $embed->replaceWith($paragraph); + } + } + } +} diff --git a/vendor/league/commonmark/src/Extension/Embed/EmbedRenderer.php b/vendor/league/commonmark/src/Extension/Embed/EmbedRenderer.php new file mode 100644 index 00000000..91655d88 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Embed/EmbedRenderer.php @@ -0,0 +1,35 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Embed; + +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; + +class EmbedRenderer implements NodeRendererInterface +{ + /** + * @param Embed $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer) + { + Embed::assertInstanceOf($node); + + return $node->getEmbedCode() ?? ''; + } +} diff --git a/vendor/league/commonmark/src/Extension/Embed/EmbedStartParser.php b/vendor/league/commonmark/src/Extension/Embed/EmbedStartParser.php new file mode 100644 index 00000000..5ff38086 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Embed/EmbedStartParser.php @@ -0,0 +1,53 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Embed; + +use League\CommonMark\Parser\Block\BlockStart; +use League\CommonMark\Parser\Block\BlockStartParserInterface; +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Parser\MarkdownParserStateInterface; +use League\CommonMark\Util\LinkParserHelper; + +class EmbedStartParser implements BlockStartParserInterface +{ + public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart + { + if ($cursor->isIndented() || $parserState->getParagraphContent() !== null || ! ($parserState->getActiveBlockParser()->isContainer())) { + return BlockStart::none(); + } + + // 0-3 leading spaces are okay + $cursor->advanceToNextNonSpaceOrTab(); + + // The line must begin with "https://" + if (! str_starts_with($cursor->getRemainder(), 'https://')) { + return BlockStart::none(); + } + + // A valid link must be found next + if (($dest = LinkParserHelper::parseLinkDestination($cursor)) === null) { + return BlockStart::none(); + } + + // Skip any trailing whitespace + $cursor->advanceToNextNonSpaceOrTab(); + + // We must be at the end of the line; otherwise, this link was not by itself + if (! $cursor->isAtEnd()) { + return BlockStart::none(); + } + + return BlockStart::of(new EmbedParser($dest))->at($cursor); + } +} diff --git a/vendor/league/commonmark/src/Extension/ExtensionInterface.php b/vendor/league/commonmark/src/Extension/ExtensionInterface.php new file mode 100644 index 00000000..01a9f2ed --- /dev/null +++ b/vendor/league/commonmark/src/Extension/ExtensionInterface.php @@ -0,0 +1,24 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension; + +use League\CommonMark\Environment\EnvironmentBuilderInterface; + +interface ExtensionInterface +{ + public function register(EnvironmentBuilderInterface $environment): void; +} diff --git a/vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkExtension.php b/vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkExtension.php new file mode 100644 index 00000000..df0079cf --- /dev/null +++ b/vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkExtension.php @@ -0,0 +1,47 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\ExternalLink; + +use League\CommonMark\Environment\EnvironmentBuilderInterface; +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\ConfigurableExtensionInterface; +use League\Config\ConfigurationBuilderInterface; +use Nette\Schema\Expect; + +final class ExternalLinkExtension implements ConfigurableExtensionInterface +{ + public function configureSchema(ConfigurationBuilderInterface $builder): void + { + $applyOptions = [ + ExternalLinkProcessor::APPLY_NONE, + ExternalLinkProcessor::APPLY_ALL, + ExternalLinkProcessor::APPLY_INTERNAL, + ExternalLinkProcessor::APPLY_EXTERNAL, + ]; + + $builder->addSchema('external_link', Expect::structure([ + 'internal_hosts' => Expect::type('string|string[]'), + 'open_in_new_window' => Expect::bool(false), + 'html_class' => Expect::string()->default(''), + 'nofollow' => Expect::anyOf(...$applyOptions)->default(ExternalLinkProcessor::APPLY_NONE), + 'noopener' => Expect::anyOf(...$applyOptions)->default(ExternalLinkProcessor::APPLY_EXTERNAL), + 'noreferrer' => Expect::anyOf(...$applyOptions)->default(ExternalLinkProcessor::APPLY_EXTERNAL), + ])); + } + + public function register(EnvironmentBuilderInterface $environment): void + { + $environment->addEventListener(DocumentParsedEvent::class, new ExternalLinkProcessor($environment->getConfiguration()), -50); + } +} diff --git a/vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkProcessor.php b/vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkProcessor.php new file mode 100644 index 00000000..4a0aa890 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/ExternalLink/ExternalLinkProcessor.php @@ -0,0 +1,119 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\ExternalLink; + +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\CommonMark\Node\Inline\Link; +use League\Config\ConfigurationInterface; + +final class ExternalLinkProcessor +{ + public const APPLY_NONE = ''; + public const APPLY_ALL = 'all'; + public const APPLY_EXTERNAL = 'external'; + public const APPLY_INTERNAL = 'internal'; + + /** @psalm-readonly */ + private ConfigurationInterface $config; + + public function __construct(ConfigurationInterface $config) + { + $this->config = $config; + } + + public function __invoke(DocumentParsedEvent $e): void + { + $internalHosts = $this->config->get('external_link/internal_hosts'); + $openInNewWindow = $this->config->get('external_link/open_in_new_window'); + $classes = $this->config->get('external_link/html_class'); + + foreach ($e->getDocument()->iterator() as $link) { + if (! ($link instanceof Link)) { + continue; + } + + $host = \parse_url($link->getUrl(), PHP_URL_HOST); + if (! \is_string($host)) { + // Something is terribly wrong with this URL + continue; + } + + if (self::hostMatches($host, $internalHosts)) { + $link->data->set('external', false); + $this->applyRelAttribute($link, false); + continue; + } + + // Host does not match our list + $this->markLinkAsExternal($link, $openInNewWindow, $classes); + } + } + + private function markLinkAsExternal(Link $link, bool $openInNewWindow, string $classes): void + { + $link->data->set('external', true); + $this->applyRelAttribute($link, true); + + if ($openInNewWindow) { + $link->data->set('attributes/target', '_blank'); + } + + if ($classes !== '') { + $link->data->append('attributes/class', $classes); + } + } + + private function applyRelAttribute(Link $link, bool $isExternal): void + { + $options = [ + 'nofollow' => $this->config->get('external_link/nofollow'), + 'noopener' => $this->config->get('external_link/noopener'), + 'noreferrer' => $this->config->get('external_link/noreferrer'), + ]; + + foreach ($options as $type => $option) { + switch (true) { + case $option === self::APPLY_ALL: + case $isExternal && $option === self::APPLY_EXTERNAL: + case ! $isExternal && $option === self::APPLY_INTERNAL: + $link->data->append('attributes/rel', $type); + } + } + + // No rel attributes? Mark the attribute as 'false' so LinkRenderer doesn't add defaults + if (! $link->data->has('attributes/rel')) { + $link->data->set('attributes/rel', false); + } + } + + /** + * @internal This method is only public so we can easily test it. DO NOT USE THIS OUTSIDE OF THIS EXTENSION! + * + * @param non-empty-string|list<non-empty-string> $compareTo + */ + public static function hostMatches(string $host, $compareTo): bool + { + foreach ((array) $compareTo as $c) { + if (\strpos($c, '/') === 0) { + if (\preg_match($c, $host)) { + return true; + } + } elseif ($c === $host) { + return true; + } + } + + return false; + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Event/AnonymousFootnotesListener.php b/vendor/league/commonmark/src/Extension/Footnote/Event/AnonymousFootnotesListener.php new file mode 100644 index 00000000..401613a7 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Event/AnonymousFootnotesListener.php @@ -0,0 +1,62 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Event; + +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\Footnote\Node\Footnote; +use League\CommonMark\Extension\Footnote\Node\FootnoteBackref; +use League\CommonMark\Extension\Footnote\Node\FootnoteRef; +use League\CommonMark\Node\Block\Paragraph; +use League\CommonMark\Node\Inline\Text; +use League\CommonMark\Reference\Reference; +use League\Config\ConfigurationAwareInterface; +use League\Config\ConfigurationInterface; + +final class AnonymousFootnotesListener implements ConfigurationAwareInterface +{ + private ConfigurationInterface $config; + + public function onDocumentParsed(DocumentParsedEvent $event): void + { + $document = $event->getDocument(); + foreach ($document->iterator() as $node) { + if (! $node instanceof FootnoteRef || ($text = $node->getContent()) === null) { + continue; + } + + // Anonymous footnote needs to create a footnote from its content + $existingReference = $node->getReference(); + $newReference = new Reference( + $existingReference->getLabel(), + '#' . $this->config->get('footnote/ref_id_prefix') . $existingReference->getLabel(), + $existingReference->getTitle() + ); + + $paragraph = new Paragraph(); + $paragraph->appendChild(new Text($text)); + $paragraph->appendChild(new FootnoteBackref($newReference)); + + $footnote = new Footnote($newReference); + $footnote->appendChild($paragraph); + + $document->appendChild($footnote); + } + } + + public function setConfiguration(ConfigurationInterface $configuration): void + { + $this->config = $configuration; + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Event/FixOrphanedFootnotesAndRefsListener.php b/vendor/league/commonmark/src/Extension/Footnote/Event/FixOrphanedFootnotesAndRefsListener.php new file mode 100644 index 00000000..a0295b53 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Event/FixOrphanedFootnotesAndRefsListener.php @@ -0,0 +1,68 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Event; + +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\Footnote\Node\Footnote; +use League\CommonMark\Extension\Footnote\Node\FootnoteRef; +use League\CommonMark\Node\Block\Document; +use League\CommonMark\Node\Inline\Text; + +final class FixOrphanedFootnotesAndRefsListener +{ + public function onDocumentParsed(DocumentParsedEvent $event): void + { + $document = $event->getDocument(); + $map = $this->buildMapOfKnownFootnotesAndRefs($document); + + foreach ($map['_flat'] as $node) { + if ($node instanceof FootnoteRef && ! isset($map[Footnote::class][$node->getReference()->getLabel()])) { + // Found an orphaned FootnoteRef without a corresponding Footnote + // Restore the original footnote ref text + $node->replaceWith(new Text(\sprintf('[^%s]', $node->getReference()->getLabel()))); + } + + // phpcs:disable SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed + if ($node instanceof Footnote && ! isset($map[FootnoteRef::class][$node->getReference()->getLabel()])) { + // Found an orphaned Footnote without a corresponding FootnoteRef + // Remove the footnote + $node->detach(); + } + } + } + + /** @phpstan-ignore-next-line */ + private function buildMapOfKnownFootnotesAndRefs(Document $document): array // @phpcs:ignore + { + $map = [ + Footnote::class => [], + FootnoteRef::class => [], + '_flat' => [], + ]; + + foreach ($document->iterator() as $node) { + if ($node instanceof Footnote) { + $map[Footnote::class][$node->getReference()->getLabel()] = true; + + $map['_flat'][] = $node; + } elseif ($node instanceof FootnoteRef) { + $map[FootnoteRef::class][$node->getReference()->getLabel()] = true; + + $map['_flat'][] = $node; + } + } + + return $map; + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Event/GatherFootnotesListener.php b/vendor/league/commonmark/src/Extension/Footnote/Event/GatherFootnotesListener.php new file mode 100644 index 00000000..ae8d00b0 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Event/GatherFootnotesListener.php @@ -0,0 +1,106 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Event; + +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\Footnote\Node\Footnote; +use League\CommonMark\Extension\Footnote\Node\FootnoteBackref; +use League\CommonMark\Extension\Footnote\Node\FootnoteContainer; +use League\CommonMark\Node\Block\Document; +use League\CommonMark\Node\NodeIterator; +use League\CommonMark\Reference\Reference; +use League\Config\ConfigurationAwareInterface; +use League\Config\ConfigurationInterface; + +final class GatherFootnotesListener implements ConfigurationAwareInterface +{ + private ConfigurationInterface $config; + + public function onDocumentParsed(DocumentParsedEvent $event): void + { + $document = $event->getDocument(); + $footnotes = []; + + foreach ($document->iterator(NodeIterator::FLAG_BLOCKS_ONLY) as $node) { + if (! $node instanceof Footnote) { + continue; + } + + // Look for existing reference with footnote label + $ref = $document->getReferenceMap()->get($node->getReference()->getLabel()); + if ($ref !== null) { + // Use numeric title to get footnotes order + $footnotes[(int) $ref->getTitle()] = $node; + } else { + // Footnote call is missing, append footnote at the end + $footnotes[\PHP_INT_MAX] = $node; + } + + $key = '#' . $this->config->get('footnote/footnote_id_prefix') . $node->getReference()->getDestination(); + if ($document->data->has($key)) { + $this->createBackrefs($node, $document->data->get($key)); + } + } + + // Only add a footnote container if there are any + if (\count($footnotes) === 0) { + return; + } + + $container = $this->getFootnotesContainer($document); + + \ksort($footnotes); + foreach ($footnotes as $footnote) { + $container->appendChild($footnote); + } + } + + private function getFootnotesContainer(Document $document): FootnoteContainer + { + $footnoteContainer = new FootnoteContainer(); + $document->appendChild($footnoteContainer); + + return $footnoteContainer; + } + + /** + * Look for all footnote refs pointing to this footnote and create each footnote backrefs. + * + * @param Footnote $node The target footnote + * @param Reference[] $backrefs References to create backrefs for + */ + private function createBackrefs(Footnote $node, array $backrefs): void + { + // Backrefs should be added to the child paragraph + $target = $node->lastChild(); + if ($target === null) { + // This should never happen, but you never know + $target = $node; + } + + foreach ($backrefs as $backref) { + $target->appendChild(new FootnoteBackref(new Reference( + $backref->getLabel(), + '#' . $this->config->get('footnote/ref_id_prefix') . $backref->getLabel(), + $backref->getTitle() + ))); + } + } + + public function setConfiguration(ConfigurationInterface $configuration): void + { + $this->config = $configuration; + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Event/NumberFootnotesListener.php b/vendor/league/commonmark/src/Extension/Footnote/Event/NumberFootnotesListener.php new file mode 100644 index 00000000..65600fab --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Event/NumberFootnotesListener.php @@ -0,0 +1,75 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Event; + +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\Footnote\Node\FootnoteRef; +use League\CommonMark\Reference\Reference; + +final class NumberFootnotesListener +{ + public function onDocumentParsed(DocumentParsedEvent $event): void + { + $document = $event->getDocument(); + $nextCounter = 1; + $usedLabels = []; + $usedCounters = []; + + foreach ($document->iterator() as $node) { + if (! $node instanceof FootnoteRef) { + continue; + } + + $existingReference = $node->getReference(); + $label = $existingReference->getLabel(); + $counter = $nextCounter; + $canIncrementCounter = true; + + if (\array_key_exists($label, $usedLabels)) { + /* + * Reference is used again, we need to point + * to the same footnote. But with a different ID + */ + $counter = $usedCounters[$label]; + $label .= '__' . ++$usedLabels[$label]; + $canIncrementCounter = false; + } + + // rewrite reference title to use a numeric link + $newReference = new Reference( + $label, + $existingReference->getDestination(), + (string) $counter + ); + + // Override reference with numeric link + $node->setReference($newReference); + $document->getReferenceMap()->add($newReference); + + /* + * Store created references in document for + * creating FootnoteBackrefs + */ + $document->data->append($existingReference->getDestination(), $newReference); + + $usedLabels[$label] = 1; + $usedCounters[$label] = $nextCounter; + + if ($canIncrementCounter) { + $nextCounter++; + } + } + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/FootnoteExtension.php b/vendor/league/commonmark/src/Extension/Footnote/FootnoteExtension.php new file mode 100644 index 00000000..0fa8038e --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/FootnoteExtension.php @@ -0,0 +1,70 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote; + +use League\CommonMark\Environment\EnvironmentBuilderInterface; +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\ConfigurableExtensionInterface; +use League\CommonMark\Extension\Footnote\Event\AnonymousFootnotesListener; +use League\CommonMark\Extension\Footnote\Event\FixOrphanedFootnotesAndRefsListener; +use League\CommonMark\Extension\Footnote\Event\GatherFootnotesListener; +use League\CommonMark\Extension\Footnote\Event\NumberFootnotesListener; +use League\CommonMark\Extension\Footnote\Node\Footnote; +use League\CommonMark\Extension\Footnote\Node\FootnoteBackref; +use League\CommonMark\Extension\Footnote\Node\FootnoteContainer; +use League\CommonMark\Extension\Footnote\Node\FootnoteRef; +use League\CommonMark\Extension\Footnote\Parser\AnonymousFootnoteRefParser; +use League\CommonMark\Extension\Footnote\Parser\FootnoteRefParser; +use League\CommonMark\Extension\Footnote\Parser\FootnoteStartParser; +use League\CommonMark\Extension\Footnote\Renderer\FootnoteBackrefRenderer; +use League\CommonMark\Extension\Footnote\Renderer\FootnoteContainerRenderer; +use League\CommonMark\Extension\Footnote\Renderer\FootnoteRefRenderer; +use League\CommonMark\Extension\Footnote\Renderer\FootnoteRenderer; +use League\Config\ConfigurationBuilderInterface; +use Nette\Schema\Expect; + +final class FootnoteExtension implements ConfigurableExtensionInterface +{ + public function configureSchema(ConfigurationBuilderInterface $builder): void + { + $builder->addSchema('footnote', Expect::structure([ + 'backref_class' => Expect::string('footnote-backref'), + 'backref_symbol' => Expect::string('↩'), + 'container_add_hr' => Expect::bool(true), + 'container_class' => Expect::string('footnotes'), + 'ref_class' => Expect::string('footnote-ref'), + 'ref_id_prefix' => Expect::string('fnref:'), + 'footnote_class' => Expect::string('footnote'), + 'footnote_id_prefix' => Expect::string('fn:'), + ])); + } + + public function register(EnvironmentBuilderInterface $environment): void + { + $environment->addBlockStartParser(new FootnoteStartParser(), 51); + $environment->addInlineParser(new AnonymousFootnoteRefParser(), 35); + $environment->addInlineParser(new FootnoteRefParser(), 51); + + $environment->addRenderer(FootnoteContainer::class, new FootnoteContainerRenderer()); + $environment->addRenderer(Footnote::class, new FootnoteRenderer()); + $environment->addRenderer(FootnoteRef::class, new FootnoteRefRenderer()); + $environment->addRenderer(FootnoteBackref::class, new FootnoteBackrefRenderer()); + + $environment->addEventListener(DocumentParsedEvent::class, [new AnonymousFootnotesListener(), 'onDocumentParsed'], 40); + $environment->addEventListener(DocumentParsedEvent::class, [new FixOrphanedFootnotesAndRefsListener(), 'onDocumentParsed'], 30); + $environment->addEventListener(DocumentParsedEvent::class, [new NumberFootnotesListener(), 'onDocumentParsed'], 20); + $environment->addEventListener(DocumentParsedEvent::class, [new GatherFootnotesListener(), 'onDocumentParsed'], 10); + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Node/Footnote.php b/vendor/league/commonmark/src/Extension/Footnote/Node/Footnote.php new file mode 100644 index 00000000..c3f77cac --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Node/Footnote.php @@ -0,0 +1,37 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Node; + +use League\CommonMark\Node\Block\AbstractBlock; +use League\CommonMark\Reference\ReferenceInterface; +use League\CommonMark\Reference\ReferenceableInterface; + +final class Footnote extends AbstractBlock implements ReferenceableInterface +{ + /** @psalm-readonly */ + private ReferenceInterface $reference; + + public function __construct(ReferenceInterface $reference) + { + parent::__construct(); + + $this->reference = $reference; + } + + public function getReference(): ReferenceInterface + { + return $this->reference; + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteBackref.php b/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteBackref.php new file mode 100644 index 00000000..f56daa53 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteBackref.php @@ -0,0 +1,40 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Node; + +use League\CommonMark\Node\Inline\AbstractInline; +use League\CommonMark\Reference\ReferenceInterface; +use League\CommonMark\Reference\ReferenceableInterface; + +/** + * Link from the footnote on the bottom of the document back to the reference + */ +final class FootnoteBackref extends AbstractInline implements ReferenceableInterface +{ + /** @psalm-readonly */ + private ReferenceInterface $reference; + + public function __construct(ReferenceInterface $reference) + { + parent::__construct(); + + $this->reference = $reference; + } + + public function getReference(): ReferenceInterface + { + return $this->reference; + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteContainer.php b/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteContainer.php new file mode 100644 index 00000000..af4ee35f --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteContainer.php @@ -0,0 +1,21 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Node; + +use League\CommonMark\Node\Block\AbstractBlock; + +final class FootnoteContainer extends AbstractBlock +{ +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteRef.php b/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteRef.php new file mode 100644 index 00000000..429a1dc8 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Node/FootnoteRef.php @@ -0,0 +1,57 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Node; + +use League\CommonMark\Node\Inline\AbstractInline; +use League\CommonMark\Reference\ReferenceInterface; +use League\CommonMark\Reference\ReferenceableInterface; + +final class FootnoteRef extends AbstractInline implements ReferenceableInterface +{ + private ReferenceInterface $reference; + + /** @psalm-readonly */ + private ?string $content = null; + + /** + * @param array<mixed> $data + */ + public function __construct(ReferenceInterface $reference, ?string $content = null, array $data = []) + { + parent::__construct(); + + $this->reference = $reference; + $this->content = $content; + + if (\count($data) > 0) { + $this->data->import($data); + } + } + + public function getReference(): ReferenceInterface + { + return $this->reference; + } + + public function setReference(ReferenceInterface $reference): void + { + $this->reference = $reference; + } + + public function getContent(): ?string + { + return $this->content; + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Parser/AnonymousFootnoteRefParser.php b/vendor/league/commonmark/src/Extension/Footnote/Parser/AnonymousFootnoteRefParser.php new file mode 100644 index 00000000..4ed93da5 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Parser/AnonymousFootnoteRefParser.php @@ -0,0 +1,66 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Parser; + +use League\CommonMark\Environment\EnvironmentAwareInterface; +use League\CommonMark\Environment\EnvironmentInterface; +use League\CommonMark\Extension\Footnote\Node\FootnoteRef; +use League\CommonMark\Normalizer\TextNormalizerInterface; +use League\CommonMark\Parser\Inline\InlineParserInterface; +use League\CommonMark\Parser\Inline\InlineParserMatch; +use League\CommonMark\Parser\InlineParserContext; +use League\CommonMark\Reference\Reference; +use League\Config\ConfigurationInterface; + +final class AnonymousFootnoteRefParser implements InlineParserInterface, EnvironmentAwareInterface +{ + private ConfigurationInterface $config; + + /** @psalm-readonly-allow-private-mutation */ + private TextNormalizerInterface $slugNormalizer; + + public function getMatchDefinition(): InlineParserMatch + { + return InlineParserMatch::regex('\^\[([^\]]+)\]'); + } + + public function parse(InlineParserContext $inlineContext): bool + { + $inlineContext->getCursor()->advanceBy($inlineContext->getFullMatchLength()); + + [$label] = $inlineContext->getSubMatches(); + $reference = $this->createReference($label); + $inlineContext->getContainer()->appendChild(new FootnoteRef($reference, $label)); + + return true; + } + + private function createReference(string $label): Reference + { + $refLabel = $this->slugNormalizer->normalize($label, ['length' => 20]); + + return new Reference( + $refLabel, + '#' . $this->config->get('footnote/footnote_id_prefix') . $refLabel, + $label + ); + } + + public function setEnvironment(EnvironmentInterface $environment): void + { + $this->config = $environment->getConfiguration(); + $this->slugNormalizer = $environment->getSlugNormalizer(); + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteParser.php b/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteParser.php new file mode 100644 index 00000000..21925468 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteParser.php @@ -0,0 +1,68 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Parser; + +use League\CommonMark\Extension\Footnote\Node\Footnote; +use League\CommonMark\Node\Block\AbstractBlock; +use League\CommonMark\Parser\Block\AbstractBlockContinueParser; +use League\CommonMark\Parser\Block\BlockContinue; +use League\CommonMark\Parser\Block\BlockContinueParserInterface; +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Reference\ReferenceInterface; + +final class FootnoteParser extends AbstractBlockContinueParser +{ + /** @psalm-readonly */ + private Footnote $block; + + /** @psalm-readonly-allow-private-mutation */ + private ?int $indentation = null; + + public function __construct(ReferenceInterface $reference) + { + $this->block = new Footnote($reference); + } + + public function getBlock(): Footnote + { + return $this->block; + } + + public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue + { + if ($cursor->isBlank()) { + return BlockContinue::at($cursor); + } + + if ($cursor->isIndented()) { + $this->indentation ??= $cursor->getIndent(); + $cursor->advanceBy($this->indentation, true); + + return BlockContinue::at($cursor); + } + + return BlockContinue::none(); + } + + public function isContainer(): bool + { + return true; + } + + public function canContain(AbstractBlock $childBlock): bool + { + return true; + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteRefParser.php b/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteRefParser.php new file mode 100644 index 00000000..4032abda --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteRefParser.php @@ -0,0 +1,57 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Parser; + +use League\CommonMark\Extension\Footnote\Node\FootnoteRef; +use League\CommonMark\Parser\Inline\InlineParserInterface; +use League\CommonMark\Parser\Inline\InlineParserMatch; +use League\CommonMark\Parser\InlineParserContext; +use League\CommonMark\Reference\Reference; +use League\Config\ConfigurationAwareInterface; +use League\Config\ConfigurationInterface; + +final class FootnoteRefParser implements InlineParserInterface, ConfigurationAwareInterface +{ + private ConfigurationInterface $config; + + public function getMatchDefinition(): InlineParserMatch + { + return InlineParserMatch::regex('\[\^([^\s\]]+)\]'); + } + + public function parse(InlineParserContext $inlineContext): bool + { + $inlineContext->getCursor()->advanceBy($inlineContext->getFullMatchLength()); + + [$label] = $inlineContext->getSubMatches(); + $inlineContext->getContainer()->appendChild(new FootnoteRef($this->createReference($label))); + + return true; + } + + private function createReference(string $label): Reference + { + return new Reference( + $label, + '#' . $this->config->get('footnote/footnote_id_prefix') . $label, + $label + ); + } + + public function setConfiguration(ConfigurationInterface $configuration): void + { + $this->config = $configuration; + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteStartParser.php b/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteStartParser.php new file mode 100644 index 00000000..734e6786 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Parser/FootnoteStartParser.php @@ -0,0 +1,56 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Parser; + +use League\CommonMark\Parser\Block\BlockStart; +use League\CommonMark\Parser\Block\BlockStartParserInterface; +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Parser\MarkdownParserStateInterface; +use League\CommonMark\Reference\Reference; +use League\CommonMark\Util\RegexHelper; + +final class FootnoteStartParser implements BlockStartParserInterface +{ + public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart + { + if ($cursor->isIndented() || $parserState->getLastMatchedBlockParser()->canHaveLazyContinuationLines()) { + return BlockStart::none(); + } + + $match = RegexHelper::matchFirst( + '/^\[\^([^\s^\]]+)\]\:(?:\s|$)/', + $cursor->getLine(), + $cursor->getNextNonSpacePosition() + ); + + if (! $match) { + return BlockStart::none(); + } + + $cursor->advanceToNextNonSpaceOrTab(); + $cursor->advanceBy(\strlen($match[0])); + $str = $cursor->getRemainder(); + \preg_replace('/^\[\^([^\s^\]]+)\]\:(?:\s|$)/', '', $str); + + if (\preg_match('/^\[\^([^\s^\]]+)\]\:(?:\s|$)/', $match[0], $matches) !== 1) { + return BlockStart::none(); + } + + $reference = new Reference($matches[1], $matches[1], $matches[1]); + $footnoteParser = new FootnoteParser($reference); + + return BlockStart::of($footnoteParser)->at($cursor); + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteBackrefRenderer.php b/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteBackrefRenderer.php new file mode 100644 index 00000000..3b7bc3c2 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteBackrefRenderer.php @@ -0,0 +1,81 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Renderer; + +use League\CommonMark\Extension\Footnote\Node\FootnoteBackref; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\CommonMark\Xml\XmlNodeRendererInterface; +use League\Config\ConfigurationAwareInterface; +use League\Config\ConfigurationInterface; + +final class FootnoteBackrefRenderer implements NodeRendererInterface, XmlNodeRendererInterface, ConfigurationAwareInterface +{ + public const DEFAULT_SYMBOL = '↩'; + + private ConfigurationInterface $config; + + /** + * @param FootnoteBackref $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): string + { + FootnoteBackref::assertInstanceOf($node); + + $attrs = $node->data->getData('attributes'); + + $attrs->append('class', $this->config->get('footnote/backref_class')); + $attrs->set('rev', 'footnote'); + $attrs->set('href', \mb_strtolower($node->getReference()->getDestination(), 'UTF-8')); + $attrs->set('role', 'doc-backlink'); + + $symbol = $this->config->get('footnote/backref_symbol'); + \assert(\is_string($symbol)); + + return ' ' . new HtmlElement('a', $attrs->export(), \htmlspecialchars($symbol), true); + } + + public function setConfiguration(ConfigurationInterface $configuration): void + { + $this->config = $configuration; + } + + public function getXmlTagName(Node $node): string + { + return 'footnote_backref'; + } + + /** + * @param FootnoteBackref $node + * + * @return array<string, scalar> + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function getXmlAttributes(Node $node): array + { + FootnoteBackref::assertInstanceOf($node); + + return [ + 'reference' => $node->getReference()->getLabel(), + ]; + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteContainerRenderer.php b/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteContainerRenderer.php new file mode 100644 index 00000000..74d35ef9 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteContainerRenderer.php @@ -0,0 +1,71 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Renderer; + +use League\CommonMark\Extension\Footnote\Node\FootnoteContainer; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\CommonMark\Xml\XmlNodeRendererInterface; +use League\Config\ConfigurationAwareInterface; +use League\Config\ConfigurationInterface; + +final class FootnoteContainerRenderer implements NodeRendererInterface, XmlNodeRendererInterface, ConfigurationAwareInterface +{ + private ConfigurationInterface $config; + + /** + * @param FootnoteContainer $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable + { + FootnoteContainer::assertInstanceOf($node); + + $attrs = $node->data->getData('attributes'); + + $attrs->append('class', $this->config->get('footnote/container_class')); + $attrs->set('role', 'doc-endnotes'); + + $contents = new HtmlElement('ol', [], $childRenderer->renderNodes($node->children())); + if ($this->config->get('footnote/container_add_hr')) { + $contents = [new HtmlElement('hr', [], null, true), $contents]; + } + + return new HtmlElement('div', $attrs->export(), $contents); + } + + public function setConfiguration(ConfigurationInterface $configuration): void + { + $this->config = $configuration; + } + + public function getXmlTagName(Node $node): string + { + return 'footnote_container'; + } + + /** + * @return array<string, scalar> + */ + public function getXmlAttributes(Node $node): array + { + return []; + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteRefRenderer.php b/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteRefRenderer.php new file mode 100644 index 00000000..c0c07d7c --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteRefRenderer.php @@ -0,0 +1,87 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Renderer; + +use League\CommonMark\Extension\Footnote\Node\FootnoteRef; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\CommonMark\Xml\XmlNodeRendererInterface; +use League\Config\ConfigurationAwareInterface; +use League\Config\ConfigurationInterface; + +final class FootnoteRefRenderer implements NodeRendererInterface, XmlNodeRendererInterface, ConfigurationAwareInterface +{ + private ConfigurationInterface $config; + + /** + * @param FootnoteRef $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable + { + FootnoteRef::assertInstanceOf($node); + + $attrs = $node->data->getData('attributes'); + $attrs->append('class', $this->config->get('footnote/ref_class')); + $attrs->set('href', \mb_strtolower($node->getReference()->getDestination(), 'UTF-8')); + $attrs->set('role', 'doc-noteref'); + + $idPrefix = $this->config->get('footnote/ref_id_prefix'); + + return new HtmlElement( + 'sup', + [ + 'id' => $idPrefix . \mb_strtolower($node->getReference()->getLabel(), 'UTF-8'), + ], + new HtmlElement( + 'a', + $attrs->export(), + $node->getReference()->getTitle() + ), + true + ); + } + + public function setConfiguration(ConfigurationInterface $configuration): void + { + $this->config = $configuration; + } + + public function getXmlTagName(Node $node): string + { + return 'footnote_ref'; + } + + /** + * @param FootnoteRef $node + * + * @return array<string, scalar> + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function getXmlAttributes(Node $node): array + { + FootnoteRef::assertInstanceOf($node); + + return [ + 'reference' => $node->getReference()->getLabel(), + ]; + } +} diff --git a/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteRenderer.php b/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteRenderer.php new file mode 100644 index 00000000..cdd027e6 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Footnote/Renderer/FootnoteRenderer.php @@ -0,0 +1,80 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * (c) Rezo Zero / Ambroise Maupate + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\Footnote\Renderer; + +use League\CommonMark\Extension\Footnote\Node\Footnote; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\CommonMark\Xml\XmlNodeRendererInterface; +use League\Config\ConfigurationAwareInterface; +use League\Config\ConfigurationInterface; + +final class FootnoteRenderer implements NodeRendererInterface, XmlNodeRendererInterface, ConfigurationAwareInterface +{ + private ConfigurationInterface $config; + + /** + * @param Footnote $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable + { + Footnote::assertInstanceOf($node); + + $attrs = $node->data->getData('attributes'); + + $attrs->append('class', $this->config->get('footnote/footnote_class')); + $attrs->set('id', $this->config->get('footnote/footnote_id_prefix') . \mb_strtolower($node->getReference()->getLabel(), 'UTF-8')); + $attrs->set('role', 'doc-endnote'); + + return new HtmlElement( + 'li', + $attrs->export(), + $childRenderer->renderNodes($node->children()), + true + ); + } + + public function setConfiguration(ConfigurationInterface $configuration): void + { + $this->config = $configuration; + } + + public function getXmlTagName(Node $node): string + { + return 'footnote'; + } + + /** + * @param Footnote $node + * + * @return array<string, scalar> + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function getXmlAttributes(Node $node): array + { + Footnote::assertInstanceOf($node); + + return [ + 'reference' => $node->getReference()->getLabel(), + ]; + } +} diff --git a/vendor/league/commonmark/src/Extension/FrontMatter/Data/FrontMatterDataParserInterface.php b/vendor/league/commonmark/src/Extension/FrontMatter/Data/FrontMatterDataParserInterface.php new file mode 100644 index 00000000..6e9db40c --- /dev/null +++ b/vendor/league/commonmark/src/Extension/FrontMatter/Data/FrontMatterDataParserInterface.php @@ -0,0 +1,26 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\FrontMatter\Data; + +use League\CommonMark\Extension\FrontMatter\Exception\InvalidFrontMatterException; + +interface FrontMatterDataParserInterface +{ + /** + * @return mixed|null The parsed data (which may be null, if the input represents a null value) + * + * @throws InvalidFrontMatterException if parsing fails + */ + public function parse(string $frontMatter); +} diff --git a/vendor/league/commonmark/src/Extension/FrontMatter/Data/LibYamlFrontMatterParser.php b/vendor/league/commonmark/src/Extension/FrontMatter/Data/LibYamlFrontMatterParser.php new file mode 100644 index 00000000..b7194f43 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/FrontMatter/Data/LibYamlFrontMatterParser.php @@ -0,0 +1,47 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\FrontMatter\Data; + +use League\CommonMark\Exception\MissingDependencyException; +use League\CommonMark\Extension\FrontMatter\Exception\InvalidFrontMatterException; + +final class LibYamlFrontMatterParser implements FrontMatterDataParserInterface +{ + public static function capable(): ?LibYamlFrontMatterParser + { + if (! \extension_loaded('yaml')) { + return null; + } + + return new LibYamlFrontMatterParser(); + } + + /** + * {@inheritDoc} + */ + public function parse(string $frontMatter) + { + if (! \extension_loaded('yaml')) { + throw new MissingDependencyException('Failed to parse yaml: "ext-yaml" extension is missing'); + } + + $result = @\yaml_parse($frontMatter); + + if ($result === false) { + throw new InvalidFrontMatterException('Failed to parse front matter'); + } + + return $result; + } +} diff --git a/vendor/league/commonmark/src/Extension/FrontMatter/Data/SymfonyYamlFrontMatterParser.php b/vendor/league/commonmark/src/Extension/FrontMatter/Data/SymfonyYamlFrontMatterParser.php new file mode 100644 index 00000000..8d99d336 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/FrontMatter/Data/SymfonyYamlFrontMatterParser.php @@ -0,0 +1,39 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\FrontMatter\Data; + +use League\CommonMark\Exception\MissingDependencyException; +use League\CommonMark\Extension\FrontMatter\Exception\InvalidFrontMatterException; +use Symfony\Component\Yaml\Exception\ParseException; +use Symfony\Component\Yaml\Yaml; + +final class SymfonyYamlFrontMatterParser implements FrontMatterDataParserInterface +{ + /** + * {@inheritDoc} + */ + public function parse(string $frontMatter) + { + if (! \class_exists(Yaml::class)) { + throw new MissingDependencyException('Failed to parse yaml: "symfony/yaml" library is missing'); + } + + try { + /** @psalm-suppress ReservedWord */ + return Yaml::parse($frontMatter); + } catch (ParseException $ex) { + throw InvalidFrontMatterException::wrap($ex); + } + } +} diff --git a/vendor/league/commonmark/src/Extension/FrontMatter/Exception/InvalidFrontMatterException.php b/vendor/league/commonmark/src/Extension/FrontMatter/Exception/InvalidFrontMatterException.php new file mode 100644 index 00000000..ffe0c281 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/FrontMatter/Exception/InvalidFrontMatterException.php @@ -0,0 +1,24 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\FrontMatter\Exception; + +use League\CommonMark\Exception\CommonMarkException; + +class InvalidFrontMatterException extends \RuntimeException implements CommonMarkException +{ + public static function wrap(\Throwable $t): self + { + return new InvalidFrontMatterException('Failed to parse front matter: ' . $t->getMessage(), 0, $t); + } +} diff --git a/vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterExtension.php b/vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterExtension.php new file mode 100644 index 00000000..019ecb40 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterExtension.php @@ -0,0 +1,46 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\FrontMatter; + +use League\CommonMark\Environment\EnvironmentBuilderInterface; +use League\CommonMark\Event\DocumentPreParsedEvent; +use League\CommonMark\Event\DocumentRenderedEvent; +use League\CommonMark\Extension\ExtensionInterface; +use League\CommonMark\Extension\FrontMatter\Data\FrontMatterDataParserInterface; +use League\CommonMark\Extension\FrontMatter\Data\LibYamlFrontMatterParser; +use League\CommonMark\Extension\FrontMatter\Data\SymfonyYamlFrontMatterParser; +use League\CommonMark\Extension\FrontMatter\Listener\FrontMatterPostRenderListener; +use League\CommonMark\Extension\FrontMatter\Listener\FrontMatterPreParser; + +final class FrontMatterExtension implements ExtensionInterface +{ + /** @psalm-readonly */ + private FrontMatterParserInterface $frontMatterParser; + + public function __construct(?FrontMatterDataParserInterface $dataParser = null) + { + $this->frontMatterParser = new FrontMatterParser($dataParser ?? LibYamlFrontMatterParser::capable() ?? new SymfonyYamlFrontMatterParser()); + } + + public function getFrontMatterParser(): FrontMatterParserInterface + { + return $this->frontMatterParser; + } + + public function register(EnvironmentBuilderInterface $environment): void + { + $environment->addEventListener(DocumentPreParsedEvent::class, new FrontMatterPreParser($this->frontMatterParser)); + $environment->addEventListener(DocumentRenderedEvent::class, new FrontMatterPostRenderListener(), -500); + } +} diff --git a/vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterParser.php b/vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterParser.php new file mode 100644 index 00000000..69c41d1f --- /dev/null +++ b/vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterParser.php @@ -0,0 +1,64 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\FrontMatter; + +use League\CommonMark\Extension\FrontMatter\Data\FrontMatterDataParserInterface; +use League\CommonMark\Extension\FrontMatter\Exception\InvalidFrontMatterException; +use League\CommonMark\Extension\FrontMatter\Input\MarkdownInputWithFrontMatter; +use League\CommonMark\Parser\Cursor; + +final class FrontMatterParser implements FrontMatterParserInterface +{ + /** @psalm-readonly */ + private FrontMatterDataParserInterface $frontMatterParser; + + private const REGEX_FRONT_MATTER = '/^---\\R.*?\\R---\\R/s'; + + public function __construct(FrontMatterDataParserInterface $frontMatterParser) + { + $this->frontMatterParser = $frontMatterParser; + } + + /** + * @throws InvalidFrontMatterException if the front matter cannot be parsed + */ + public function parse(string $markdownContent): MarkdownInputWithFrontMatter + { + $cursor = new Cursor($markdownContent); + + // Locate the front matter + $frontMatter = $cursor->match(self::REGEX_FRONT_MATTER); + if ($frontMatter === null) { + return new MarkdownInputWithFrontMatter($markdownContent); + } + + // Trim the last line (ending ---s and newline) + $frontMatter = \preg_replace('/---\R$/', '', $frontMatter); + if ($frontMatter === null) { + return new MarkdownInputWithFrontMatter($markdownContent); + } + + // Parse the resulting YAML data + $data = $this->frontMatterParser->parse($frontMatter); + + // Advance through any remaining newlines which separated the front matter from the Markdown text + $trailingNewlines = $cursor->match('/^\R+/'); + + // Calculate how many lines the Markdown is offset from the front matter by counting the number of newlines + // Don't forget to add 1 because we stripped one out when trimming the trailing delims + $lineOffset = \preg_match_all('/\R/', $frontMatter . $trailingNewlines) + 1; + + return new MarkdownInputWithFrontMatter($cursor->getRemainder(), $lineOffset, $data); + } +} diff --git a/vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterParserInterface.php b/vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterParserInterface.php new file mode 100644 index 00000000..197a33bb --- /dev/null +++ b/vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterParserInterface.php @@ -0,0 +1,21 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\FrontMatter; + +use League\CommonMark\Extension\FrontMatter\Input\MarkdownInputWithFrontMatter; + +interface FrontMatterParserInterface +{ + public function parse(string $markdownContent): MarkdownInputWithFrontMatter; +} diff --git a/vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterProviderInterface.php b/vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterProviderInterface.php new file mode 100644 index 00000000..b5a72784 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/FrontMatter/FrontMatterProviderInterface.php @@ -0,0 +1,22 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\FrontMatter; + +interface FrontMatterProviderInterface +{ + /** + * @return mixed|null + */ + public function getFrontMatter(); +} diff --git a/vendor/league/commonmark/src/Extension/FrontMatter/Input/MarkdownInputWithFrontMatter.php b/vendor/league/commonmark/src/Extension/FrontMatter/Input/MarkdownInputWithFrontMatter.php new file mode 100644 index 00000000..86c982b1 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/FrontMatter/Input/MarkdownInputWithFrontMatter.php @@ -0,0 +1,43 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\FrontMatter\Input; + +use League\CommonMark\Extension\FrontMatter\FrontMatterProviderInterface; +use League\CommonMark\Input\MarkdownInput; + +final class MarkdownInputWithFrontMatter extends MarkdownInput implements FrontMatterProviderInterface +{ + /** @var mixed|null */ + private $frontMatter; + + /** + * @param string $content Markdown content without the raw front matter + * @param int $lineOffset Line offset (based on number of front matter lines removed) + * @param mixed|null $frontMatter Parsed front matter + */ + public function __construct(string $content, int $lineOffset = 0, $frontMatter = null) + { + parent::__construct($content, $lineOffset); + + $this->frontMatter = $frontMatter; + } + + /** + * {@inheritDoc} + */ + public function getFrontMatter() + { + return $this->frontMatter; + } +} diff --git a/vendor/league/commonmark/src/Extension/FrontMatter/Listener/FrontMatterPostRenderListener.php b/vendor/league/commonmark/src/Extension/FrontMatter/Listener/FrontMatterPostRenderListener.php new file mode 100644 index 00000000..14b71917 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/FrontMatter/Listener/FrontMatterPostRenderListener.php @@ -0,0 +1,35 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\FrontMatter\Listener; + +use League\CommonMark\Event\DocumentRenderedEvent; +use League\CommonMark\Extension\FrontMatter\Output\RenderedContentWithFrontMatter; + +final class FrontMatterPostRenderListener +{ + public function __invoke(DocumentRenderedEvent $event): void + { + if ($event->getOutput()->getDocument()->data->get('front_matter', null) === null) { + return; + } + + $frontMatter = $event->getOutput()->getDocument()->data->get('front_matter'); + + $event->replaceOutput(new RenderedContentWithFrontMatter( + $event->getOutput()->getDocument(), + $event->getOutput()->getContent(), + $frontMatter + )); + } +} diff --git a/vendor/league/commonmark/src/Extension/FrontMatter/Listener/FrontMatterPreParser.php b/vendor/league/commonmark/src/Extension/FrontMatter/Listener/FrontMatterPreParser.php new file mode 100644 index 00000000..b0afbeea --- /dev/null +++ b/vendor/league/commonmark/src/Extension/FrontMatter/Listener/FrontMatterPreParser.php @@ -0,0 +1,37 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\FrontMatter\Listener; + +use League\CommonMark\Event\DocumentPreParsedEvent; +use League\CommonMark\Extension\FrontMatter\FrontMatterParserInterface; + +final class FrontMatterPreParser +{ + private FrontMatterParserInterface $parser; + + public function __construct(FrontMatterParserInterface $parser) + { + $this->parser = $parser; + } + + public function __invoke(DocumentPreParsedEvent $event): void + { + $content = $event->getMarkdown()->getContent(); + + $parsed = $this->parser->parse($content); + + $event->getDocument()->data->set('front_matter', $parsed->getFrontMatter()); + $event->replaceMarkdown($parsed); + } +} diff --git a/vendor/league/commonmark/src/Extension/FrontMatter/Output/RenderedContentWithFrontMatter.php b/vendor/league/commonmark/src/Extension/FrontMatter/Output/RenderedContentWithFrontMatter.php new file mode 100644 index 00000000..efaa3428 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/FrontMatter/Output/RenderedContentWithFrontMatter.php @@ -0,0 +1,51 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Extension\FrontMatter\Output; + +use League\CommonMark\Extension\FrontMatter\FrontMatterProviderInterface; +use League\CommonMark\Node\Block\Document; +use League\CommonMark\Output\RenderedContent; + +/** + * @psalm-immutable + */ +final class RenderedContentWithFrontMatter extends RenderedContent implements FrontMatterProviderInterface +{ + /** + * @var mixed + * + * @psalm-readonly + */ + private $frontMatter; + + /** + * @param Document $document The parsed Document object + * @param string $content The final HTML + * @param mixed|null $frontMatter Any parsed front matter + */ + public function __construct(Document $document, string $content, $frontMatter) + { + parent::__construct($document, $content); + + $this->frontMatter = $frontMatter; + } + + /** + * {@inheritDoc} + */ + public function getFrontMatter() + { + return $this->frontMatter; + } +} diff --git a/vendor/league/commonmark/src/Extension/GithubFlavoredMarkdownExtension.php b/vendor/league/commonmark/src/Extension/GithubFlavoredMarkdownExtension.php new file mode 100644 index 00000000..b3920aa5 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/GithubFlavoredMarkdownExtension.php @@ -0,0 +1,33 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension; + +use League\CommonMark\Environment\EnvironmentBuilderInterface; +use League\CommonMark\Extension\Autolink\AutolinkExtension; +use League\CommonMark\Extension\DisallowedRawHtml\DisallowedRawHtmlExtension; +use League\CommonMark\Extension\Strikethrough\StrikethroughExtension; +use League\CommonMark\Extension\Table\TableExtension; +use League\CommonMark\Extension\TaskList\TaskListExtension; + +final class GithubFlavoredMarkdownExtension implements ExtensionInterface +{ + public function register(EnvironmentBuilderInterface $environment): void + { + $environment->addExtension(new AutolinkExtension()); + $environment->addExtension(new DisallowedRawHtmlExtension()); + $environment->addExtension(new StrikethroughExtension()); + $environment->addExtension(new TableExtension()); + $environment->addExtension(new TaskListExtension()); + } +} diff --git a/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalink.php b/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalink.php new file mode 100644 index 00000000..df9bded0 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalink.php @@ -0,0 +1,37 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\HeadingPermalink; + +use League\CommonMark\Node\Inline\AbstractInline; + +/** + * Represents an anchor link within a heading + */ +final class HeadingPermalink extends AbstractInline +{ + /** @psalm-readonly */ + private string $slug; + + public function __construct(string $slug) + { + parent::__construct(); + + $this->slug = $slug; + } + + public function getSlug(): string + { + return $this->slug; + } +} diff --git a/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkExtension.php b/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkExtension.php new file mode 100644 index 00000000..96473a29 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkExtension.php @@ -0,0 +1,49 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\HeadingPermalink; + +use League\CommonMark\Environment\EnvironmentBuilderInterface; +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\ConfigurableExtensionInterface; +use League\Config\ConfigurationBuilderInterface; +use Nette\Schema\Expect; + +/** + * Extension which automatically anchor links to heading elements + */ +final class HeadingPermalinkExtension implements ConfigurableExtensionInterface +{ + public function configureSchema(ConfigurationBuilderInterface $builder): void + { + $builder->addSchema('heading_permalink', Expect::structure([ + 'min_heading_level' => Expect::int()->min(1)->max(6)->default(1), + 'max_heading_level' => Expect::int()->min(1)->max(6)->default(6), + 'insert' => Expect::anyOf(HeadingPermalinkProcessor::INSERT_BEFORE, HeadingPermalinkProcessor::INSERT_AFTER, HeadingPermalinkProcessor::INSERT_NONE)->default(HeadingPermalinkProcessor::INSERT_BEFORE), + 'id_prefix' => Expect::string()->default('content'), + 'apply_id_to_heading' => Expect::bool()->default(false), + 'heading_class' => Expect::string()->default(''), + 'fragment_prefix' => Expect::string()->default('content'), + 'html_class' => Expect::string()->default('heading-permalink'), + 'title' => Expect::string()->default('Permalink'), + 'symbol' => Expect::string()->default(HeadingPermalinkRenderer::DEFAULT_SYMBOL), + 'aria_hidden' => Expect::bool()->default(true), + ])); + } + + public function register(EnvironmentBuilderInterface $environment): void + { + $environment->addEventListener(DocumentParsedEvent::class, new HeadingPermalinkProcessor(), -100); + $environment->addRenderer(HeadingPermalink::class, new HeadingPermalinkRenderer()); + } +} diff --git a/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkProcessor.php b/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkProcessor.php new file mode 100644 index 00000000..871aa21e --- /dev/null +++ b/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkProcessor.php @@ -0,0 +1,101 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\HeadingPermalink; + +use League\CommonMark\Environment\EnvironmentAwareInterface; +use League\CommonMark\Environment\EnvironmentInterface; +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\CommonMark\Node\Block\Heading; +use League\CommonMark\Node\NodeIterator; +use League\CommonMark\Node\RawMarkupContainerInterface; +use League\CommonMark\Node\StringContainerHelper; +use League\CommonMark\Normalizer\TextNormalizerInterface; +use League\Config\ConfigurationInterface; +use League\Config\Exception\InvalidConfigurationException; + +/** + * Searches the Document for Heading elements and adds HeadingPermalinks to each one + */ +final class HeadingPermalinkProcessor implements EnvironmentAwareInterface +{ + public const INSERT_BEFORE = 'before'; + public const INSERT_AFTER = 'after'; + public const INSERT_NONE = 'none'; + + /** @psalm-readonly-allow-private-mutation */ + private TextNormalizerInterface $slugNormalizer; + + /** @psalm-readonly-allow-private-mutation */ + private ConfigurationInterface $config; + + public function setEnvironment(EnvironmentInterface $environment): void + { + $this->config = $environment->getConfiguration(); + $this->slugNormalizer = $environment->getSlugNormalizer(); + } + + public function __invoke(DocumentParsedEvent $e): void + { + $min = (int) $this->config->get('heading_permalink/min_heading_level'); + $max = (int) $this->config->get('heading_permalink/max_heading_level'); + $applyToHeading = (bool) $this->config->get('heading_permalink/apply_id_to_heading'); + $idPrefix = (string) $this->config->get('heading_permalink/id_prefix'); + $slugLength = (int) $this->config->get('slug_normalizer/max_length'); + $headingClass = (string) $this->config->get('heading_permalink/heading_class'); + + if ($idPrefix !== '') { + $idPrefix .= '-'; + } + + foreach ($e->getDocument()->iterator(NodeIterator::FLAG_BLOCKS_ONLY) as $node) { + if ($node instanceof Heading && $node->getLevel() >= $min && $node->getLevel() <= $max) { + $this->addHeadingLink($node, $slugLength, $idPrefix, $applyToHeading, $headingClass); + } + } + } + + private function addHeadingLink(Heading $heading, int $slugLength, string $idPrefix, bool $applyToHeading, string $headingClass): void + { + $text = StringContainerHelper::getChildText($heading, [RawMarkupContainerInterface::class]); + $slug = $this->slugNormalizer->normalize($text, [ + 'node' => $heading, + 'length' => $slugLength, + ]); + + if ($applyToHeading) { + $heading->data->set('attributes/id', $idPrefix . $slug); + } + + if ($headingClass !== '') { + $heading->data->append('attributes/class', $headingClass); + } + + $headingLinkAnchor = new HeadingPermalink($slug); + + switch ($this->config->get('heading_permalink/insert')) { + case self::INSERT_BEFORE: + $heading->prependChild($headingLinkAnchor); + + return; + case self::INSERT_AFTER: + $heading->appendChild($headingLinkAnchor); + + return; + case self::INSERT_NONE: + return; + default: + throw new InvalidConfigurationException("Invalid configuration value for heading_permalink/insert; expected 'before', 'after', or 'none'"); + } + } +} diff --git a/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkRenderer.php b/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkRenderer.php new file mode 100644 index 00000000..59a86a13 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/HeadingPermalink/HeadingPermalinkRenderer.php @@ -0,0 +1,106 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\HeadingPermalink; + +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\CommonMark\Xml\XmlNodeRendererInterface; +use League\Config\ConfigurationAwareInterface; +use League\Config\ConfigurationInterface; + +/** + * Renders the HeadingPermalink elements + */ +final class HeadingPermalinkRenderer implements NodeRendererInterface, XmlNodeRendererInterface, ConfigurationAwareInterface +{ + public const DEFAULT_SYMBOL = '¶'; + + /** @psalm-readonly-allow-private-mutation */ + private ConfigurationInterface $config; + + public function setConfiguration(ConfigurationInterface $configuration): void + { + $this->config = $configuration; + } + + /** + * @param HeadingPermalink $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable + { + HeadingPermalink::assertInstanceOf($node); + + $slug = $node->getSlug(); + + $fragmentPrefix = (string) $this->config->get('heading_permalink/fragment_prefix'); + if ($fragmentPrefix !== '') { + $fragmentPrefix .= '-'; + } + + $attrs = $node->data->getData('attributes'); + $appendId = ! $this->config->get('heading_permalink/apply_id_to_heading'); + + if ($appendId) { + $idPrefix = (string) $this->config->get('heading_permalink/id_prefix'); + + if ($idPrefix !== '') { + $idPrefix .= '-'; + } + + $attrs->set('id', $idPrefix . $slug); + } + + $attrs->set('href', '#' . $fragmentPrefix . $slug); + $attrs->append('class', $this->config->get('heading_permalink/html_class')); + + $hidden = $this->config->get('heading_permalink/aria_hidden'); + if ($hidden) { + $attrs->set('aria-hidden', 'true'); + } + + $attrs->set('title', $this->config->get('heading_permalink/title')); + + $symbol = $this->config->get('heading_permalink/symbol'); + \assert(\is_string($symbol)); + + return new HtmlElement('a', $attrs->export(), \htmlspecialchars($symbol), false); + } + + public function getXmlTagName(Node $node): string + { + return 'heading_permalink'; + } + + /** + * @param HeadingPermalink $node + * + * @return array<string, scalar> + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function getXmlAttributes(Node $node): array + { + HeadingPermalink::assertInstanceOf($node); + + return [ + 'slug' => $node->getSlug(), + ]; + } +} diff --git a/vendor/league/commonmark/src/Extension/InlinesOnly/ChildRenderer.php b/vendor/league/commonmark/src/Extension/InlinesOnly/ChildRenderer.php new file mode 100644 index 00000000..403e948e --- /dev/null +++ b/vendor/league/commonmark/src/Extension/InlinesOnly/ChildRenderer.php @@ -0,0 +1,35 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\InlinesOnly; + +use League\CommonMark\Node\Block\Document; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; + +/** + * Simply renders child elements as-is, adding newlines as needed. + */ +final class ChildRenderer implements NodeRendererInterface +{ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): string + { + $out = $childRenderer->renderNodes($node->children()); + if (! $node instanceof Document) { + $out .= $childRenderer->getBlockSeparator(); + } + + return $out; + } +} diff --git a/vendor/league/commonmark/src/Extension/InlinesOnly/InlinesOnlyExtension.php b/vendor/league/commonmark/src/Extension/InlinesOnly/InlinesOnlyExtension.php new file mode 100644 index 00000000..7777510e --- /dev/null +++ b/vendor/league/commonmark/src/Extension/InlinesOnly/InlinesOnlyExtension.php @@ -0,0 +1,73 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\InlinesOnly; + +use League\CommonMark as Core; +use League\CommonMark\Environment\EnvironmentBuilderInterface; +use League\CommonMark\Extension\CommonMark; +use League\CommonMark\Extension\CommonMark\Delimiter\Processor\EmphasisDelimiterProcessor; +use League\CommonMark\Extension\ConfigurableExtensionInterface; +use League\Config\ConfigurationBuilderInterface; +use Nette\Schema\Expect; + +final class InlinesOnlyExtension implements ConfigurableExtensionInterface +{ + public function configureSchema(ConfigurationBuilderInterface $builder): void + { + $builder->addSchema('commonmark', Expect::structure([ + 'use_asterisk' => Expect::bool(true), + 'use_underscore' => Expect::bool(true), + 'enable_strong' => Expect::bool(true), + 'enable_em' => Expect::bool(true), + ])); + } + + // phpcs:disable Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma,Squiz.WhiteSpace.SemicolonSpacing.Incorrect + public function register(EnvironmentBuilderInterface $environment): void + { + $childRenderer = new ChildRenderer(); + + $environment + ->addInlineParser(new Core\Parser\Inline\NewlineParser(), 200) + ->addInlineParser(new CommonMark\Parser\Inline\BacktickParser(), 150) + ->addInlineParser(new CommonMark\Parser\Inline\EscapableParser(), 80) + ->addInlineParser(new CommonMark\Parser\Inline\EntityParser(), 70) + ->addInlineParser(new CommonMark\Parser\Inline\AutolinkParser(), 50) + ->addInlineParser(new CommonMark\Parser\Inline\HtmlInlineParser(), 40) + ->addInlineParser(new CommonMark\Parser\Inline\CloseBracketParser(), 30) + ->addInlineParser(new CommonMark\Parser\Inline\OpenBracketParser(), 20) + ->addInlineParser(new CommonMark\Parser\Inline\BangParser(), 10) + + ->addRenderer(Core\Node\Block\Document::class, $childRenderer, 0) + ->addRenderer(Core\Node\Block\Paragraph::class, $childRenderer, 0) + + ->addRenderer(CommonMark\Node\Inline\Code::class, new CommonMark\Renderer\Inline\CodeRenderer(), 0) + ->addRenderer(CommonMark\Node\Inline\Emphasis::class, new CommonMark\Renderer\Inline\EmphasisRenderer(), 0) + ->addRenderer(CommonMark\Node\Inline\HtmlInline::class, new CommonMark\Renderer\Inline\HtmlInlineRenderer(), 0) + ->addRenderer(CommonMark\Node\Inline\Image::class, new CommonMark\Renderer\Inline\ImageRenderer(), 0) + ->addRenderer(CommonMark\Node\Inline\Link::class, new CommonMark\Renderer\Inline\LinkRenderer(), 0) + ->addRenderer(Core\Node\Inline\Newline::class, new Core\Renderer\Inline\NewlineRenderer(), 0) + ->addRenderer(CommonMark\Node\Inline\Strong::class, new CommonMark\Renderer\Inline\StrongRenderer(), 0) + ->addRenderer(Core\Node\Inline\Text::class, new Core\Renderer\Inline\TextRenderer(), 0) + ; + + if ($environment->getConfiguration()->get('commonmark/use_asterisk')) { + $environment->addDelimiterProcessor(new EmphasisDelimiterProcessor('*')); + } + + if ($environment->getConfiguration()->get('commonmark/use_underscore')) { + $environment->addDelimiterProcessor(new EmphasisDelimiterProcessor('_')); + } + } +} diff --git a/vendor/league/commonmark/src/Extension/Mention/Generator/CallbackGenerator.php b/vendor/league/commonmark/src/Extension/Mention/Generator/CallbackGenerator.php new file mode 100644 index 00000000..d0b6292e --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Mention/Generator/CallbackGenerator.php @@ -0,0 +1,54 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Mention\Generator; + +use League\CommonMark\Exception\LogicException; +use League\CommonMark\Extension\Mention\Mention; +use League\CommonMark\Node\Inline\AbstractInline; + +final class CallbackGenerator implements MentionGeneratorInterface +{ + /** + * A callback function which sets the URL on the passed mention and returns the mention, return a new AbstractInline based object or null if the mention is not a match + * + * @var callable(Mention): ?AbstractInline + */ + private $callback; + + public function __construct(callable $callback) + { + $this->callback = $callback; + } + + /** + * @throws LogicException + */ + public function generateMention(Mention $mention): ?AbstractInline + { + $result = \call_user_func($this->callback, $mention); + if ($result === null) { + return null; + } + + if ($result instanceof AbstractInline && ! ($result instanceof Mention)) { + return $result; + } + + if ($result instanceof Mention && $result->hasUrl()) { + return $mention; + } + + throw new LogicException('CallbackGenerator callable must set the URL on the passed mention and return the mention, return a new AbstractInline based object or null if the mention is not a match'); + } +} diff --git a/vendor/league/commonmark/src/Extension/Mention/Generator/MentionGeneratorInterface.php b/vendor/league/commonmark/src/Extension/Mention/Generator/MentionGeneratorInterface.php new file mode 100644 index 00000000..30d4a510 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Mention/Generator/MentionGeneratorInterface.php @@ -0,0 +1,22 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Mention\Generator; + +use League\CommonMark\Extension\Mention\Mention; +use League\CommonMark\Node\Inline\AbstractInline; + +interface MentionGeneratorInterface +{ + public function generateMention(Mention $mention): ?AbstractInline; +} diff --git a/vendor/league/commonmark/src/Extension/Mention/Generator/StringTemplateLinkGenerator.php b/vendor/league/commonmark/src/Extension/Mention/Generator/StringTemplateLinkGenerator.php new file mode 100644 index 00000000..5d92897c --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Mention/Generator/StringTemplateLinkGenerator.php @@ -0,0 +1,34 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Mention\Generator; + +use League\CommonMark\Extension\Mention\Mention; +use League\CommonMark\Node\Inline\AbstractInline; + +final class StringTemplateLinkGenerator implements MentionGeneratorInterface +{ + private string $urlTemplate; + + public function __construct(string $urlTemplate) + { + $this->urlTemplate = $urlTemplate; + } + + public function generateMention(Mention $mention): ?AbstractInline + { + $mention->setUrl(\sprintf($this->urlTemplate, $mention->getIdentifier())); + + return $mention; + } +} diff --git a/vendor/league/commonmark/src/Extension/Mention/Mention.php b/vendor/league/commonmark/src/Extension/Mention/Mention.php new file mode 100644 index 00000000..74eaee47 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Mention/Mention.php @@ -0,0 +1,93 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Mention; + +use League\CommonMark\Extension\CommonMark\Node\Inline\Link; +use League\CommonMark\Node\Inline\Text; + +class Mention extends Link +{ + private string $name; + + private string $prefix; + + private string $identifier; + + public function __construct(string $name, string $prefix, string $identifier, ?string $label = null) + { + $this->name = $name; + $this->prefix = $prefix; + $this->identifier = $identifier; + + parent::__construct('', $label ?? \sprintf('%s%s', $prefix, $identifier)); + } + + public function getLabel(): ?string + { + if (($labelNode = $this->findLabelNode()) === null) { + return null; + } + + return $labelNode->getLiteral(); + } + + public function getIdentifier(): string + { + return $this->identifier; + } + + public function getName(): ?string + { + return $this->name; + } + + public function getPrefix(): string + { + return $this->prefix; + } + + public function hasUrl(): bool + { + return $this->url !== ''; + } + + /** + * @return $this + */ + public function setLabel(string $label): self + { + if (($labelNode = $this->findLabelNode()) === null) { + $labelNode = new Text(); + $this->prependChild($labelNode); + } + + $labelNode->setLiteral($label); + + return $this; + } + + private function findLabelNode(): ?Text + { + foreach ($this->children() as $child) { + if ($child instanceof Text) { + return $child; + } + } + + return null; + } +} diff --git a/vendor/league/commonmark/src/Extension/Mention/MentionExtension.php b/vendor/league/commonmark/src/Extension/Mention/MentionExtension.php new file mode 100644 index 00000000..c848c269 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Mention/MentionExtension.php @@ -0,0 +1,61 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Mention; + +use League\CommonMark\Environment\EnvironmentBuilderInterface; +use League\CommonMark\Extension\ConfigurableExtensionInterface; +use League\CommonMark\Extension\Mention\Generator\MentionGeneratorInterface; +use League\Config\ConfigurationBuilderInterface; +use League\Config\Exception\InvalidConfigurationException; +use Nette\Schema\Expect; + +final class MentionExtension implements ConfigurableExtensionInterface +{ + public function configureSchema(ConfigurationBuilderInterface $builder): void + { + $isAValidPartialRegex = static function (string $regex): bool { + $regex = '/' . $regex . '/i'; + + return @\preg_match($regex, '') !== false; + }; + + $builder->addSchema('mentions', Expect::arrayOf( + Expect::structure([ + 'prefix' => Expect::string()->required(), + 'pattern' => Expect::string()->assert($isAValidPartialRegex, 'Pattern must not include starting/ending delimiters (like "/")')->required(), + 'generator' => Expect::anyOf( + Expect::type(MentionGeneratorInterface::class), + Expect::string(), + Expect::type('callable') + )->required(), + ]) + )); + } + + public function register(EnvironmentBuilderInterface $environment): void + { + $mentions = $environment->getConfiguration()->get('mentions'); + foreach ($mentions as $name => $mention) { + if ($mention['generator'] instanceof MentionGeneratorInterface) { + $environment->addInlineParser(new MentionParser($name, $mention['prefix'], $mention['pattern'], $mention['generator'])); + } elseif (\is_string($mention['generator'])) { + $environment->addInlineParser(MentionParser::createWithStringTemplate($name, $mention['prefix'], $mention['pattern'], $mention['generator'])); + } elseif (\is_callable($mention['generator'])) { + $environment->addInlineParser(MentionParser::createWithCallback($name, $mention['prefix'], $mention['pattern'], $mention['generator'])); + } else { + throw new InvalidConfigurationException(\sprintf('The "generator" provided for the "%s" MentionParser configuration must be a string template, callable, or an object that implements %s.', $name, MentionGeneratorInterface::class)); + } + } + } +} diff --git a/vendor/league/commonmark/src/Extension/Mention/MentionParser.php b/vendor/league/commonmark/src/Extension/Mention/MentionParser.php new file mode 100644 index 00000000..a81c787d --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Mention/MentionParser.php @@ -0,0 +1,87 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Mention; + +use League\CommonMark\Extension\Mention\Generator\CallbackGenerator; +use League\CommonMark\Extension\Mention\Generator\MentionGeneratorInterface; +use League\CommonMark\Extension\Mention\Generator\StringTemplateLinkGenerator; +use League\CommonMark\Parser\Inline\InlineParserInterface; +use League\CommonMark\Parser\Inline\InlineParserMatch; +use League\CommonMark\Parser\InlineParserContext; + +final class MentionParser implements InlineParserInterface +{ + /** @psalm-readonly */ + private string $name; + + /** @psalm-readonly */ + private string $prefix; + + /** @psalm-readonly */ + private string $identifierPattern; + + /** @psalm-readonly */ + private MentionGeneratorInterface $mentionGenerator; + + public function __construct(string $name, string $prefix, string $identifierPattern, MentionGeneratorInterface $mentionGenerator) + { + $this->name = $name; + $this->prefix = $prefix; + $this->identifierPattern = $identifierPattern; + $this->mentionGenerator = $mentionGenerator; + } + + public function getMatchDefinition(): InlineParserMatch + { + return InlineParserMatch::join( + InlineParserMatch::string($this->prefix), + InlineParserMatch::regex($this->identifierPattern) + ); + } + + public function parse(InlineParserContext $inlineContext): bool + { + $cursor = $inlineContext->getCursor(); + + // The prefix must not have any other characters immediately prior + $previousChar = $cursor->peek(-1); + if ($previousChar !== null && \preg_match('/\w/', $previousChar)) { + // peek() doesn't modify the cursor, so no need to restore state first + return false; + } + + [$prefix, $identifier] = $inlineContext->getSubMatches(); + + $mention = $this->mentionGenerator->generateMention(new Mention($this->name, $prefix, $identifier)); + + if ($mention === null) { + return false; + } + + $cursor->advanceBy($inlineContext->getFullMatchLength()); + $inlineContext->getContainer()->appendChild($mention); + + return true; + } + + public static function createWithStringTemplate(string $name, string $prefix, string $mentionRegex, string $urlTemplate): MentionParser + { + return new self($name, $prefix, $mentionRegex, new StringTemplateLinkGenerator($urlTemplate)); + } + + public static function createWithCallback(string $name, string $prefix, string $mentionRegex, callable $callback): MentionParser + { + return new self($name, $prefix, $mentionRegex, new CallbackGenerator($callback)); + } +} diff --git a/vendor/league/commonmark/src/Extension/SmartPunct/DashParser.php b/vendor/league/commonmark/src/Extension/SmartPunct/DashParser.php new file mode 100644 index 00000000..cf0e1af6 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/SmartPunct/DashParser.php @@ -0,0 +1,59 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (http://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\SmartPunct; + +use League\CommonMark\Node\Inline\Text; +use League\CommonMark\Parser\Inline\InlineParserInterface; +use League\CommonMark\Parser\Inline\InlineParserMatch; +use League\CommonMark\Parser\InlineParserContext; + +final class DashParser implements InlineParserInterface +{ + private const EN_DASH = '–'; + private const EM_DASH = '—'; + + public function getMatchDefinition(): InlineParserMatch + { + return InlineParserMatch::regex('(?<!-)(-{2,})'); + } + + public function parse(InlineParserContext $inlineContext): bool + { + $count = $inlineContext->getFullMatchLength(); + $inlineContext->getCursor()->advanceBy($count); + + $enCount = 0; + $emCount = 0; + if ($count % 3 === 0) { // If divisible by 3, use all em dashes + $emCount = (int) ($count / 3); + } elseif ($count % 2 === 0) { // If divisible by 2, use all en dashes + $enCount = (int) ($count / 2); + } elseif ($count % 3 === 2) { // If 2 extra dashes, use en dash for last 2; em dashes for rest + $emCount = (int) (($count - 2) / 3); + $enCount = 1; + } else { // Use en dashes for last 4 hyphens; em dashes for rest + $emCount = (int) (($count - 4) / 3); + $enCount = 2; + } + + $inlineContext->getContainer()->appendChild(new Text( + \str_repeat(self::EM_DASH, $emCount) . \str_repeat(self::EN_DASH, $enCount) + )); + + return true; + } +} diff --git a/vendor/league/commonmark/src/Extension/SmartPunct/EllipsesParser.php b/vendor/league/commonmark/src/Extension/SmartPunct/EllipsesParser.php new file mode 100644 index 00000000..9f5b3bdb --- /dev/null +++ b/vendor/league/commonmark/src/Extension/SmartPunct/EllipsesParser.php @@ -0,0 +1,38 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (http://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\SmartPunct; + +use League\CommonMark\Node\Inline\Text; +use League\CommonMark\Parser\Inline\InlineParserInterface; +use League\CommonMark\Parser\Inline\InlineParserMatch; +use League\CommonMark\Parser\InlineParserContext; + +final class EllipsesParser implements InlineParserInterface +{ + public function getMatchDefinition(): InlineParserMatch + { + return InlineParserMatch::oneOf('...', '. . .'); + } + + public function parse(InlineParserContext $inlineContext): bool + { + $inlineContext->getCursor()->advanceBy($inlineContext->getFullMatchLength()); + $inlineContext->getContainer()->appendChild(new Text('…')); + + return true; + } +} diff --git a/vendor/league/commonmark/src/Extension/SmartPunct/Quote.php b/vendor/league/commonmark/src/Extension/SmartPunct/Quote.php new file mode 100644 index 00000000..dee97592 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/SmartPunct/Quote.php @@ -0,0 +1,30 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (http://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\SmartPunct; + +use League\CommonMark\Node\Inline\AbstractStringContainer; + +final class Quote extends AbstractStringContainer +{ + public const DOUBLE_QUOTE = '"'; + public const DOUBLE_QUOTE_OPENER = '“'; + public const DOUBLE_QUOTE_CLOSER = '”'; + + public const SINGLE_QUOTE = "'"; + public const SINGLE_QUOTE_OPENER = '‘'; + public const SINGLE_QUOTE_CLOSER = '’'; +} diff --git a/vendor/league/commonmark/src/Extension/SmartPunct/QuoteParser.php b/vendor/league/commonmark/src/Extension/SmartPunct/QuoteParser.php new file mode 100644 index 00000000..959930b3 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/SmartPunct/QuoteParser.php @@ -0,0 +1,97 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (http://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\SmartPunct; + +use League\CommonMark\Delimiter\Delimiter; +use League\CommonMark\Parser\Inline\InlineParserInterface; +use League\CommonMark\Parser\Inline\InlineParserMatch; +use League\CommonMark\Parser\InlineParserContext; +use League\CommonMark\Util\RegexHelper; + +final class QuoteParser implements InlineParserInterface +{ + /** + * @deprecated This constant is no longer used and will be removed in a future major release + */ + public const DOUBLE_QUOTES = [Quote::DOUBLE_QUOTE, Quote::DOUBLE_QUOTE_OPENER, Quote::DOUBLE_QUOTE_CLOSER]; + + /** + * @deprecated This constant is no longer used and will be removed in a future major release + */ + public const SINGLE_QUOTES = [Quote::SINGLE_QUOTE, Quote::SINGLE_QUOTE_OPENER, Quote::SINGLE_QUOTE_CLOSER]; + + public function getMatchDefinition(): InlineParserMatch + { + return InlineParserMatch::oneOf(Quote::SINGLE_QUOTE, Quote::DOUBLE_QUOTE); + } + + /** + * Normalizes any quote characters found and manually adds them to the delimiter stack + */ + public function parse(InlineParserContext $inlineContext): bool + { + $char = $inlineContext->getFullMatch(); + $cursor = $inlineContext->getCursor(); + + $charBefore = $cursor->peek(-1); + if ($charBefore === null) { + $charBefore = "\n"; + } + + $cursor->advance(); + + $charAfter = $cursor->getCurrentCharacter(); + if ($charAfter === null) { + $charAfter = "\n"; + } + + [$leftFlanking, $rightFlanking] = $this->determineFlanking($charBefore, $charAfter); + $canOpen = $leftFlanking && ! $rightFlanking; + $canClose = $rightFlanking; + + $node = new Quote($char, ['delim' => true]); + $inlineContext->getContainer()->appendChild($node); + + // Add entry to stack to this opener + $inlineContext->getDelimiterStack()->push(new Delimiter($char, 1, $node, $canOpen, $canClose)); + + return true; + } + + /** + * @return bool[] + */ + private function determineFlanking(string $charBefore, string $charAfter): array + { + $afterIsWhitespace = \preg_match('/\pZ|\s/u', $charAfter); + $afterIsPunctuation = \preg_match(RegexHelper::REGEX_PUNCTUATION, $charAfter); + $beforeIsWhitespace = \preg_match('/\pZ|\s/u', $charBefore); + $beforeIsPunctuation = \preg_match(RegexHelper::REGEX_PUNCTUATION, $charBefore); + + $leftFlanking = ! $afterIsWhitespace && + ! ($afterIsPunctuation && + ! $beforeIsWhitespace && + ! $beforeIsPunctuation); + + $rightFlanking = ! $beforeIsWhitespace && + ! ($beforeIsPunctuation && + ! $afterIsWhitespace && + ! $afterIsPunctuation); + + return [$leftFlanking, $rightFlanking]; + } +} diff --git a/vendor/league/commonmark/src/Extension/SmartPunct/QuoteProcessor.php b/vendor/league/commonmark/src/Extension/SmartPunct/QuoteProcessor.php new file mode 100644 index 00000000..1fc30d4e --- /dev/null +++ b/vendor/league/commonmark/src/Extension/SmartPunct/QuoteProcessor.php @@ -0,0 +1,82 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (http://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\SmartPunct; + +use League\CommonMark\Delimiter\DelimiterInterface; +use League\CommonMark\Delimiter\Processor\DelimiterProcessorInterface; +use League\CommonMark\Node\Inline\AbstractStringContainer; + +final class QuoteProcessor implements DelimiterProcessorInterface +{ + /** @psalm-readonly */ + private string $normalizedCharacter; + + /** @psalm-readonly */ + private string $openerCharacter; + + /** @psalm-readonly */ + private string $closerCharacter; + + private function __construct(string $char, string $opener, string $closer) + { + $this->normalizedCharacter = $char; + $this->openerCharacter = $opener; + $this->closerCharacter = $closer; + } + + public function getOpeningCharacter(): string + { + return $this->normalizedCharacter; + } + + public function getClosingCharacter(): string + { + return $this->normalizedCharacter; + } + + public function getMinLength(): int + { + return 1; + } + + public function getDelimiterUse(DelimiterInterface $opener, DelimiterInterface $closer): int + { + return 1; + } + + public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse): void + { + $opener->insertAfter(new Quote($this->openerCharacter)); + $closer->insertBefore(new Quote($this->closerCharacter)); + } + + /** + * Create a double-quote processor + */ + public static function createDoubleQuoteProcessor(string $opener = Quote::DOUBLE_QUOTE_OPENER, string $closer = Quote::DOUBLE_QUOTE_CLOSER): self + { + return new self(Quote::DOUBLE_QUOTE, $opener, $closer); + } + + /** + * Create a single-quote processor + */ + public static function createSingleQuoteProcessor(string $opener = Quote::SINGLE_QUOTE_OPENER, string $closer = Quote::SINGLE_QUOTE_CLOSER): self + { + return new self(Quote::SINGLE_QUOTE, $opener, $closer); + } +} diff --git a/vendor/league/commonmark/src/Extension/SmartPunct/ReplaceUnpairedQuotesListener.php b/vendor/league/commonmark/src/Extension/SmartPunct/ReplaceUnpairedQuotesListener.php new file mode 100644 index 00000000..3536452d --- /dev/null +++ b/vendor/league/commonmark/src/Extension/SmartPunct/ReplaceUnpairedQuotesListener.php @@ -0,0 +1,43 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\SmartPunct; + +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Node\Inline\AdjacentTextMerger; +use League\CommonMark\Node\Inline\Text; +use League\CommonMark\Node\Query; + +/** + * Identifies any lingering Quote nodes that were missing pairs and converts them into Text nodes + */ +final class ReplaceUnpairedQuotesListener +{ + public function __invoke(DocumentParsedEvent $event): void + { + $query = (new Query())->where(Query::type(Quote::class)); + foreach ($query->findAll($event->getDocument()) as $quote) { + \assert($quote instanceof Quote); + + $literal = $quote->getLiteral(); + if ($literal === Quote::SINGLE_QUOTE) { + $literal = Quote::SINGLE_QUOTE_CLOSER; + } elseif ($literal === Quote::DOUBLE_QUOTE) { + $literal = Quote::DOUBLE_QUOTE_OPENER; + } + + $quote->replaceWith($new = new Text($literal)); + AdjacentTextMerger::mergeWithDirectlyAdjacentNodes($new); + } + } +} diff --git a/vendor/league/commonmark/src/Extension/SmartPunct/SmartPunctExtension.php b/vendor/league/commonmark/src/Extension/SmartPunct/SmartPunctExtension.php new file mode 100644 index 00000000..8524ca11 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/SmartPunct/SmartPunctExtension.php @@ -0,0 +1,64 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (http://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\SmartPunct; + +use League\CommonMark\Environment\EnvironmentBuilderInterface; +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\ConfigurableExtensionInterface; +use League\CommonMark\Node\Block\Document; +use League\CommonMark\Node\Block\Paragraph; +use League\CommonMark\Node\Inline\Text; +use League\CommonMark\Renderer\Block as CoreBlockRenderer; +use League\CommonMark\Renderer\Inline as CoreInlineRenderer; +use League\Config\ConfigurationBuilderInterface; +use Nette\Schema\Expect; + +final class SmartPunctExtension implements ConfigurableExtensionInterface +{ + public function configureSchema(ConfigurationBuilderInterface $builder): void + { + $builder->addSchema('smartpunct', Expect::structure([ + 'double_quote_opener' => Expect::string(Quote::DOUBLE_QUOTE_OPENER), + 'double_quote_closer' => Expect::string(Quote::DOUBLE_QUOTE_CLOSER), + 'single_quote_opener' => Expect::string(Quote::SINGLE_QUOTE_OPENER), + 'single_quote_closer' => Expect::string(Quote::SINGLE_QUOTE_CLOSER), + ])); + } + + public function register(EnvironmentBuilderInterface $environment): void + { + $environment + ->addInlineParser(new QuoteParser(), 10) + ->addInlineParser(new DashParser(), 0) + ->addInlineParser(new EllipsesParser(), 0) + + ->addDelimiterProcessor(QuoteProcessor::createDoubleQuoteProcessor( + $environment->getConfiguration()->get('smartpunct/double_quote_opener'), + $environment->getConfiguration()->get('smartpunct/double_quote_closer') + )) + ->addDelimiterProcessor(QuoteProcessor::createSingleQuoteProcessor( + $environment->getConfiguration()->get('smartpunct/single_quote_opener'), + $environment->getConfiguration()->get('smartpunct/single_quote_closer') + )) + + ->addEventListener(DocumentParsedEvent::class, new ReplaceUnpairedQuotesListener()) + + ->addRenderer(Document::class, new CoreBlockRenderer\DocumentRenderer(), 0) + ->addRenderer(Paragraph::class, new CoreBlockRenderer\ParagraphRenderer(), 0) + ->addRenderer(Text::class, new CoreInlineRenderer\TextRenderer(), 0); + } +} diff --git a/vendor/league/commonmark/src/Extension/Strikethrough/Strikethrough.php b/vendor/league/commonmark/src/Extension/Strikethrough/Strikethrough.php new file mode 100644 index 00000000..20ad161c --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Strikethrough/Strikethrough.php @@ -0,0 +1,39 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> and uAfrica.com (http://uafrica.com) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Strikethrough; + +use League\CommonMark\Node\Inline\AbstractInline; +use League\CommonMark\Node\Inline\DelimitedInterface; + +final class Strikethrough extends AbstractInline implements DelimitedInterface +{ + private string $delimiter; + + public function __construct(string $delimiter = '~~') + { + parent::__construct(); + + $this->delimiter = $delimiter; + } + + public function getOpeningDelimiter(): string + { + return $this->delimiter; + } + + public function getClosingDelimiter(): string + { + return $this->delimiter; + } +} diff --git a/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughDelimiterProcessor.php b/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughDelimiterProcessor.php new file mode 100644 index 00000000..af0fdb17 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughDelimiterProcessor.php @@ -0,0 +1,63 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> and uAfrica.com (http://uafrica.com) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Strikethrough; + +use League\CommonMark\Delimiter\DelimiterInterface; +use League\CommonMark\Delimiter\Processor\DelimiterProcessorInterface; +use League\CommonMark\Node\Inline\AbstractStringContainer; + +final class StrikethroughDelimiterProcessor implements DelimiterProcessorInterface +{ + public function getOpeningCharacter(): string + { + return '~'; + } + + public function getClosingCharacter(): string + { + return '~'; + } + + public function getMinLength(): int + { + return 1; + } + + public function getDelimiterUse(DelimiterInterface $opener, DelimiterInterface $closer): int + { + if ($opener->getLength() > 2 && $closer->getLength() > 2) { + return 0; + } + + if ($opener->getLength() !== $closer->getLength()) { + return 0; + } + + return \min($opener->getLength(), $closer->getLength()); + } + + public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse): void + { + $strikethrough = new Strikethrough(\str_repeat('~', $delimiterUse)); + + $tmp = $opener->next(); + while ($tmp !== null && $tmp !== $closer) { + $next = $tmp->next(); + $strikethrough->appendChild($tmp); + $tmp = $next; + } + + $opener->insertAfter($strikethrough); + } +} diff --git a/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughExtension.php b/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughExtension.php new file mode 100644 index 00000000..96ffe7a5 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughExtension.php @@ -0,0 +1,26 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> and uAfrica.com (http://uafrica.com) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Strikethrough; + +use League\CommonMark\Environment\EnvironmentBuilderInterface; +use League\CommonMark\Extension\ExtensionInterface; + +final class StrikethroughExtension implements ExtensionInterface +{ + public function register(EnvironmentBuilderInterface $environment): void + { + $environment->addDelimiterProcessor(new StrikethroughDelimiterProcessor()); + $environment->addRenderer(Strikethrough::class, new StrikethroughRenderer()); + } +} diff --git a/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughRenderer.php b/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughRenderer.php new file mode 100644 index 00000000..a50b895e --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Strikethrough/StrikethroughRenderer.php @@ -0,0 +1,50 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> and uAfrica.com (http://uafrica.com) + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Strikethrough; + +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\CommonMark\Xml\XmlNodeRendererInterface; + +final class StrikethroughRenderer implements NodeRendererInterface, XmlNodeRendererInterface +{ + /** + * @param Strikethrough $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable + { + Strikethrough::assertInstanceOf($node); + + return new HtmlElement('del', $node->data->get('attributes'), $childRenderer->renderNodes($node->children())); + } + + public function getXmlTagName(Node $node): string + { + return 'strikethrough'; + } + + /** + * {@inheritDoc} + */ + public function getXmlAttributes(Node $node): array + { + return []; + } +} diff --git a/vendor/league/commonmark/src/Extension/Table/Table.php b/vendor/league/commonmark/src/Extension/Table/Table.php new file mode 100644 index 00000000..2fe441d6 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Table/Table.php @@ -0,0 +1,22 @@ +<?php + +declare(strict_types=1); + +/* + * This is part of the league/commonmark package. + * + * (c) Martin Hasoň <martin.hason@gmail.com> + * (c) Webuni s.r.o. <info@webuni.cz> + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Table; + +use League\CommonMark\Node\Block\AbstractBlock; + +final class Table extends AbstractBlock +{ +} diff --git a/vendor/league/commonmark/src/Extension/Table/TableCell.php b/vendor/league/commonmark/src/Extension/Table/TableCell.php new file mode 100644 index 00000000..6ed359a6 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Table/TableCell.php @@ -0,0 +1,99 @@ +<?php + +declare(strict_types=1); + +/* + * This is part of the league/commonmark package. + * + * (c) Martin Hasoň <martin.hason@gmail.com> + * (c) Webuni s.r.o. <info@webuni.cz> + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Table; + +use League\CommonMark\Node\Block\AbstractBlock; + +final class TableCell extends AbstractBlock +{ + public const TYPE_HEADER = 'header'; + public const TYPE_DATA = 'data'; + + public const ALIGN_LEFT = 'left'; + public const ALIGN_RIGHT = 'right'; + public const ALIGN_CENTER = 'center'; + + /** + * @psalm-var self::TYPE_* + * @phpstan-var self::TYPE_* + * + * @psalm-readonly-allow-private-mutation + */ + private string $type = self::TYPE_DATA; + + /** + * @psalm-var self::ALIGN_*|null + * @phpstan-var self::ALIGN_*|null + * + * @psalm-readonly-allow-private-mutation + */ + private ?string $align = null; + + /** + * @psalm-param self::TYPE_* $type + * @psalm-param self::ALIGN_*|null $align + * + * @phpstan-param self::TYPE_* $type + * @phpstan-param self::ALIGN_*|null $align + */ + public function __construct(string $type = self::TYPE_DATA, ?string $align = null) + { + parent::__construct(); + + $this->type = $type; + $this->align = $align; + } + + /** + * @psalm-return self::TYPE_* + * + * @phpstan-return self::TYPE_* + */ + public function getType(): string + { + return $this->type; + } + + /** + * @psalm-param self::TYPE_* $type + * + * @phpstan-param self::TYPE_* $type + */ + public function setType(string $type): void + { + $this->type = $type; + } + + /** + * @psalm-return self::ALIGN_*|null + * + * @phpstan-return self::ALIGN_*|null + */ + public function getAlign(): ?string + { + return $this->align; + } + + /** + * @psalm-param self::ALIGN_*|null $align + * + * @phpstan-param self::ALIGN_*|null $align + */ + public function setAlign(?string $align): void + { + $this->align = $align; + } +} diff --git a/vendor/league/commonmark/src/Extension/Table/TableCellRenderer.php b/vendor/league/commonmark/src/Extension/Table/TableCellRenderer.php new file mode 100644 index 00000000..99512c3c --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Table/TableCellRenderer.php @@ -0,0 +1,89 @@ +<?php + +declare(strict_types=1); + +/* + * This is part of the league/commonmark package. + * + * (c) Martin Hasoň <martin.hason@gmail.com> + * (c) Webuni s.r.o. <info@webuni.cz> + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Table; + +use League\CommonMark\Extension\Attributes\Util\AttributesHelper; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\CommonMark\Xml\XmlNodeRendererInterface; + +final class TableCellRenderer implements NodeRendererInterface, XmlNodeRendererInterface +{ + private const DEFAULT_ATTRIBUTES = [ + TableCell::ALIGN_LEFT => ['align' => 'left'], + TableCell::ALIGN_CENTER => ['align' => 'center'], + TableCell::ALIGN_RIGHT => ['align' => 'right'], + ]; + + /** @var array<TableCell::ALIGN_*, array<string, string|string[]|bool>> */ + private array $alignmentAttributes; + + /** + * @param array<TableCell::ALIGN_*, array<string, string|string[]|bool>> $alignmentAttributes + */ + public function __construct(array $alignmentAttributes = self::DEFAULT_ATTRIBUTES) + { + $this->alignmentAttributes = $alignmentAttributes; + } + + /** + * @param TableCell $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable + { + TableCell::assertInstanceOf($node); + + $attrs = $node->data->get('attributes'); + if (($alignment = $node->getAlign()) !== null) { + $attrs = AttributesHelper::mergeAttributes($attrs, $this->alignmentAttributes[$alignment]); + } + + $tag = $node->getType() === TableCell::TYPE_HEADER ? 'th' : 'td'; + + return new HtmlElement($tag, $attrs, $childRenderer->renderNodes($node->children())); + } + + public function getXmlTagName(Node $node): string + { + return 'table_cell'; + } + + /** + * @param TableCell $node + * + * @return array<string, scalar> + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function getXmlAttributes(Node $node): array + { + TableCell::assertInstanceOf($node); + + $ret = ['type' => $node->getType()]; + + if (($align = $node->getAlign()) !== null) { + $ret['align'] = $align; + } + + return $ret; + } +} diff --git a/vendor/league/commonmark/src/Extension/Table/TableExtension.php b/vendor/league/commonmark/src/Extension/Table/TableExtension.php new file mode 100644 index 00000000..27a58bbd --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Table/TableExtension.php @@ -0,0 +1,62 @@ +<?php + +declare(strict_types=1); + +/* + * This is part of the league/commonmark package. + * + * (c) Martin Hasoň <martin.hason@gmail.com> + * (c) Webuni s.r.o. <info@webuni.cz> + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Table; + +use League\CommonMark\Environment\EnvironmentBuilderInterface; +use League\CommonMark\Extension\ConfigurableExtensionInterface; +use League\CommonMark\Renderer\HtmlDecorator; +use League\Config\ConfigurationBuilderInterface; +use Nette\Schema\Expect; + +final class TableExtension implements ConfigurableExtensionInterface +{ + public function configureSchema(ConfigurationBuilderInterface $builder): void + { + $attributeArraySchema = Expect::arrayOf( + Expect::type('string|string[]|bool'), // attribute value(s) + 'string' // attribute name + )->mergeDefaults(false); + + $builder->addSchema('table', Expect::structure([ + 'wrap' => Expect::structure([ + 'enabled' => Expect::bool()->default(false), + 'tag' => Expect::string()->default('div'), + 'attributes' => Expect::arrayOf(Expect::string()), + ]), + 'alignment_attributes' => Expect::structure([ + 'left' => (clone $attributeArraySchema)->default(['align' => 'left']), + 'center' => (clone $attributeArraySchema)->default(['align' => 'center']), + 'right' => (clone $attributeArraySchema)->default(['align' => 'right']), + ]), + ])); + } + + public function register(EnvironmentBuilderInterface $environment): void + { + $tableRenderer = new TableRenderer(); + if ($environment->getConfiguration()->get('table/wrap/enabled')) { + $tableRenderer = new HtmlDecorator($tableRenderer, $environment->getConfiguration()->get('table/wrap/tag'), $environment->getConfiguration()->get('table/wrap/attributes')); + } + + $environment + ->addBlockStartParser(new TableStartParser()) + + ->addRenderer(Table::class, $tableRenderer) + ->addRenderer(TableSection::class, new TableSectionRenderer()) + ->addRenderer(TableRow::class, new TableRowRenderer()) + ->addRenderer(TableCell::class, new TableCellRenderer($environment->getConfiguration()->get('table/alignment_attributes'))); + } +} diff --git a/vendor/league/commonmark/src/Extension/Table/TableParser.php b/vendor/league/commonmark/src/Extension/Table/TableParser.php new file mode 100644 index 00000000..ca340a31 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Table/TableParser.php @@ -0,0 +1,200 @@ +<?php + +declare(strict_types=1); + +/* + * This is part of the league/commonmark package. + * + * (c) Martin Hasoň <martin.hason@gmail.com> + * (c) Webuni s.r.o. <info@webuni.cz> + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Table; + +use League\CommonMark\Parser\Block\AbstractBlockContinueParser; +use League\CommonMark\Parser\Block\BlockContinue; +use League\CommonMark\Parser\Block\BlockContinueParserInterface; +use League\CommonMark\Parser\Block\BlockContinueParserWithInlinesInterface; +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Parser\InlineParserEngineInterface; +use League\CommonMark\Util\ArrayCollection; + +final class TableParser extends AbstractBlockContinueParser implements BlockContinueParserWithInlinesInterface +{ + /** @psalm-readonly */ + private Table $block; + + /** + * @var ArrayCollection<string> + * + * @psalm-readonly-allow-private-mutation + */ + private ArrayCollection $bodyLines; + + /** + * @var array<int, string|null> + * @psalm-var array<int, TableCell::ALIGN_*|null> + * @phpstan-var array<int, TableCell::ALIGN_*|null> + * + * @psalm-readonly + */ + private array $columns; + + /** + * @var array<int, string> + * + * @psalm-readonly-allow-private-mutation + */ + private array $headerCells; + + /** @psalm-readonly-allow-private-mutation */ + private bool $nextIsSeparatorLine = true; + + /** + * @param array<int, string|null> $columns + * @param array<int, string> $headerCells + * + * @psalm-param array<int, TableCell::ALIGN_*|null> $columns + * + * @phpstan-param array<int, TableCell::ALIGN_*|null> $columns + */ + public function __construct(array $columns, array $headerCells) + { + $this->block = new Table(); + $this->bodyLines = new ArrayCollection(); + $this->columns = $columns; + $this->headerCells = $headerCells; + } + + public function canHaveLazyContinuationLines(): bool + { + return true; + } + + public function getBlock(): Table + { + return $this->block; + } + + public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue + { + if (\strpos($cursor->getLine(), '|') === false) { + return BlockContinue::none(); + } + + return BlockContinue::at($cursor); + } + + public function addLine(string $line): void + { + if ($this->nextIsSeparatorLine) { + $this->nextIsSeparatorLine = false; + } else { + $this->bodyLines[] = $line; + } + } + + public function parseInlines(InlineParserEngineInterface $inlineParser): void + { + $headerColumns = \count($this->headerCells); + + $head = new TableSection(TableSection::TYPE_HEAD); + $this->block->appendChild($head); + + $headerRow = new TableRow(); + $head->appendChild($headerRow); + for ($i = 0; $i < $headerColumns; $i++) { + $cell = $this->headerCells[$i]; + $tableCell = $this->parseCell($cell, $i, $inlineParser); + $tableCell->setType(TableCell::TYPE_HEADER); + $headerRow->appendChild($tableCell); + } + + $body = null; + foreach ($this->bodyLines as $rowLine) { + $cells = self::split($rowLine); + $row = new TableRow(); + + // Body can not have more columns than head + for ($i = 0; $i < $headerColumns; $i++) { + $cell = $cells[$i] ?? ''; + $tableCell = $this->parseCell($cell, $i, $inlineParser); + $row->appendChild($tableCell); + } + + if ($body === null) { + // It's valid to have a table without body. In that case, don't add an empty TableBody node. + $body = new TableSection(); + $this->block->appendChild($body); + } + + $body->appendChild($row); + } + } + + private function parseCell(string $cell, int $column, InlineParserEngineInterface $inlineParser): TableCell + { + $tableCell = new TableCell(); + + if ($column < \count($this->columns)) { + $tableCell->setAlign($this->columns[$column]); + } + + $inlineParser->parse(\trim($cell), $tableCell); + + return $tableCell; + } + + /** + * @internal + * + * @return array<int, string> + */ + public static function split(string $line): array + { + $cursor = new Cursor(\trim($line)); + + if ($cursor->getCurrentCharacter() === '|') { + $cursor->advanceBy(1); + } + + $cells = []; + $sb = ''; + + while (! $cursor->isAtEnd()) { + switch ($c = $cursor->getCurrentCharacter()) { + case '\\': + if ($cursor->peek() === '|') { + // Pipe is special for table parsing. An escaped pipe doesn't result in a new cell, but is + // passed down to inline parsing as an unescaped pipe. Note that that applies even for the `\|` + // in an input like `\\|` - in other words, table parsing doesn't support escaping backslashes. + $sb .= '|'; + $cursor->advanceBy(1); + } else { + // Preserve backslash before other characters or at end of line. + $sb .= '\\'; + } + + break; + case '|': + $cells[] = $sb; + $sb = ''; + break; + default: + $sb .= $c; + } + + $cursor->advanceBy(1); + } + + if ($sb !== '') { + $cells[] = $sb; + } + + return $cells; + } +} diff --git a/vendor/league/commonmark/src/Extension/Table/TableRenderer.php b/vendor/league/commonmark/src/Extension/Table/TableRenderer.php new file mode 100644 index 00000000..7799e224 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Table/TableRenderer.php @@ -0,0 +1,58 @@ +<?php + +declare(strict_types=1); + +/* + * This is part of the league/commonmark package. + * + * (c) Martin Hasoň <martin.hason@gmail.com> + * (c) Webuni s.r.o. <info@webuni.cz> + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Table; + +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\CommonMark\Xml\XmlNodeRendererInterface; + +final class TableRenderer implements NodeRendererInterface, XmlNodeRendererInterface +{ + /** + * @param Table $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable + { + Table::assertInstanceOf($node); + + $attrs = $node->data->get('attributes'); + + $separator = $childRenderer->getInnerSeparator(); + + $children = $childRenderer->renderNodes($node->children()); + + return new HtmlElement('table', $attrs, $separator . \trim($children) . $separator); + } + + public function getXmlTagName(Node $node): string + { + return 'table'; + } + + /** + * {@inheritDoc} + */ + public function getXmlAttributes(Node $node): array + { + return []; + } +} diff --git a/vendor/league/commonmark/src/Extension/Table/TableRow.php b/vendor/league/commonmark/src/Extension/Table/TableRow.php new file mode 100644 index 00000000..cd6ac991 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Table/TableRow.php @@ -0,0 +1,22 @@ +<?php + +declare(strict_types=1); + +/* + * This is part of the league/commonmark package. + * + * (c) Martin Hasoň <martin.hason@gmail.com> + * (c) Webuni s.r.o. <info@webuni.cz> + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Table; + +use League\CommonMark\Node\Block\AbstractBlock; + +final class TableRow extends AbstractBlock +{ +} diff --git a/vendor/league/commonmark/src/Extension/Table/TableRowRenderer.php b/vendor/league/commonmark/src/Extension/Table/TableRowRenderer.php new file mode 100644 index 00000000..dee72d2d --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Table/TableRowRenderer.php @@ -0,0 +1,56 @@ +<?php + +declare(strict_types=1); + +/* + * This is part of the league/commonmark package. + * + * (c) Martin Hasoň <martin.hason@gmail.com> + * (c) Webuni s.r.o. <info@webuni.cz> + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Table; + +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\CommonMark\Xml\XmlNodeRendererInterface; + +final class TableRowRenderer implements NodeRendererInterface, XmlNodeRendererInterface +{ + /** + * @param TableRow $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable + { + TableRow::assertInstanceOf($node); + + $attrs = $node->data->get('attributes'); + + $separator = $childRenderer->getInnerSeparator(); + + return new HtmlElement('tr', $attrs, $separator . $childRenderer->renderNodes($node->children()) . $separator); + } + + public function getXmlTagName(Node $node): string + { + return 'table_row'; + } + + /** + * {@inheritDoc} + */ + public function getXmlAttributes(Node $node): array + { + return []; + } +} diff --git a/vendor/league/commonmark/src/Extension/Table/TableSection.php b/vendor/league/commonmark/src/Extension/Table/TableSection.php new file mode 100644 index 00000000..9edd63bc --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Table/TableSection.php @@ -0,0 +1,64 @@ +<?php + +declare(strict_types=1); + +/* + * This is part of the league/commonmark package. + * + * (c) Martin Hasoň <martin.hason@gmail.com> + * (c) Webuni s.r.o. <info@webuni.cz> + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Table; + +use League\CommonMark\Node\Block\AbstractBlock; + +final class TableSection extends AbstractBlock +{ + public const TYPE_HEAD = 'head'; + public const TYPE_BODY = 'body'; + + /** + * @psalm-var self::TYPE_* + * @phpstan-var self::TYPE_* + * + * @psalm-readonly + */ + private string $type; + + /** + * @psalm-param self::TYPE_* $type + * + * @phpstan-param self::TYPE_* $type + */ + public function __construct(string $type = self::TYPE_BODY) + { + parent::__construct(); + + $this->type = $type; + } + + /** + * @psalm-return self::TYPE_* + * + * @phpstan-return self::TYPE_* + */ + public function getType(): string + { + return $this->type; + } + + public function isHead(): bool + { + return $this->type === self::TYPE_HEAD; + } + + public function isBody(): bool + { + return $this->type === self::TYPE_BODY; + } +} diff --git a/vendor/league/commonmark/src/Extension/Table/TableSectionRenderer.php b/vendor/league/commonmark/src/Extension/Table/TableSectionRenderer.php new file mode 100644 index 00000000..cccf06c6 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Table/TableSectionRenderer.php @@ -0,0 +1,70 @@ +<?php + +declare(strict_types=1); + +/* + * This is part of the league/commonmark package. + * + * (c) Martin Hasoň <martin.hason@gmail.com> + * (c) Webuni s.r.o. <info@webuni.cz> + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Table; + +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\CommonMark\Xml\XmlNodeRendererInterface; + +final class TableSectionRenderer implements NodeRendererInterface, XmlNodeRendererInterface +{ + /** + * @param TableSection $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer) + { + TableSection::assertInstanceOf($node); + + if (! $node->hasChildren()) { + return ''; + } + + $attrs = $node->data->get('attributes'); + + $separator = $childRenderer->getInnerSeparator(); + + $tag = $node->getType() === TableSection::TYPE_HEAD ? 'thead' : 'tbody'; + + return new HtmlElement($tag, $attrs, $separator . $childRenderer->renderNodes($node->children()) . $separator); + } + + public function getXmlTagName(Node $node): string + { + return 'table_section'; + } + + /** + * @param TableSection $node + * + * @return array<string, scalar> + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function getXmlAttributes(Node $node): array + { + TableSection::assertInstanceOf($node); + + return [ + 'type' => $node->getType(), + ]; + } +} diff --git a/vendor/league/commonmark/src/Extension/Table/TableStartParser.php b/vendor/league/commonmark/src/Extension/Table/TableStartParser.php new file mode 100644 index 00000000..12206d28 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/Table/TableStartParser.php @@ -0,0 +1,158 @@ +<?php + +declare(strict_types=1); + +/* + * This is part of the league/commonmark package. + * + * (c) Martin Hasoň <martin.hason@gmail.com> + * (c) Webuni s.r.o. <info@webuni.cz> + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\Table; + +use League\CommonMark\Parser\Block\BlockStart; +use League\CommonMark\Parser\Block\BlockStartParserInterface; +use League\CommonMark\Parser\Block\ParagraphParser; +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Parser\MarkdownParserStateInterface; + +final class TableStartParser implements BlockStartParserInterface +{ + public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart + { + $paragraph = $parserState->getParagraphContent(); + if ($paragraph === null || \strpos($paragraph, '|') === false) { + return BlockStart::none(); + } + + $columns = self::parseSeparator($cursor); + if (\count($columns) === 0) { + return BlockStart::none(); + } + + $lines = \explode("\n", $paragraph); + $lastLine = \array_pop($lines); + + $headerCells = TableParser::split($lastLine); + if (\count($headerCells) > \count($columns)) { + return BlockStart::none(); + } + + $cursor->advanceToEnd(); + + $parsers = []; + + if (\count($lines) > 0) { + $p = new ParagraphParser(); + $p->addLine(\implode("\n", $lines)); + $parsers[] = $p; + } + + $parsers[] = new TableParser($columns, $headerCells); + + return BlockStart::of(...$parsers) + ->at($cursor) + ->replaceActiveBlockParser(); + } + + /** + * @return array<int, string|null> + * + * @psalm-return array<int, TableCell::ALIGN_*|null> + * + * @phpstan-return array<int, TableCell::ALIGN_*|null> + */ + private static function parseSeparator(Cursor $cursor): array + { + $columns = []; + $pipes = 0; + $valid = false; + + while (! $cursor->isAtEnd()) { + switch ($c = $cursor->getCurrentCharacter()) { + case '|': + $cursor->advanceBy(1); + $pipes++; + if ($pipes > 1) { + // More than one adjacent pipe not allowed + return []; + } + + // Need at least one pipe, even for a one-column table + $valid = true; + break; + case '-': + case ':': + if ($pipes === 0 && \count($columns) > 0) { + // Need a pipe after the first column (first column doesn't need to start with one) + return []; + } + + $left = false; + $right = false; + if ($c === ':') { + $left = true; + $cursor->advanceBy(1); + } + + if ($cursor->match('/^-+/') === null) { + // Need at least one dash + return []; + } + + if ($cursor->getCurrentCharacter() === ':') { + $right = true; + $cursor->advanceBy(1); + } + + $columns[] = self::getAlignment($left, $right); + // Next, need another pipe + $pipes = 0; + break; + case ' ': + case "\t": + // White space is allowed between pipes and columns + $cursor->advanceToNextNonSpaceOrTab(); + break; + default: + // Any other character is invalid + return []; + } + } + + if (! $valid) { + return []; + } + + return $columns; + } + + /** + * @psalm-return TableCell::ALIGN_*|null + * + * @phpstan-return TableCell::ALIGN_*|null + * + * @psalm-pure + */ + private static function getAlignment(bool $left, bool $right): ?string + { + if ($left && $right) { + return TableCell::ALIGN_CENTER; + } + + if ($left) { + return TableCell::ALIGN_LEFT; + } + + if ($right) { + return TableCell::ALIGN_RIGHT; + } + + return null; + } +} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/Node/TableOfContents.php b/vendor/league/commonmark/src/Extension/TableOfContents/Node/TableOfContents.php new file mode 100644 index 00000000..e040d862 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/TableOfContents/Node/TableOfContents.php @@ -0,0 +1,20 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\TableOfContents\Node; + +use League\CommonMark\Extension\CommonMark\Node\Block\ListBlock; + +final class TableOfContents extends ListBlock +{ +} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/Node/TableOfContentsPlaceholder.php b/vendor/league/commonmark/src/Extension/TableOfContents/Node/TableOfContentsPlaceholder.php new file mode 100644 index 00000000..6d6db100 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/TableOfContents/Node/TableOfContentsPlaceholder.php @@ -0,0 +1,20 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\TableOfContents\Node; + +use League\CommonMark\Node\Block\AbstractBlock; + +final class TableOfContentsPlaceholder extends AbstractBlock +{ +} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/AsIsNormalizerStrategy.php b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/AsIsNormalizerStrategy.php new file mode 100644 index 00000000..f5bb9a4d --- /dev/null +++ b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/AsIsNormalizerStrategy.php @@ -0,0 +1,72 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\TableOfContents\Normalizer; + +use League\CommonMark\Extension\CommonMark\Node\Block\ListBlock; +use League\CommonMark\Extension\CommonMark\Node\Block\ListItem; +use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; + +final class AsIsNormalizerStrategy implements NormalizerStrategyInterface +{ + /** @psalm-readonly-allow-private-mutation */ + private ListBlock $parentListBlock; + + /** @psalm-readonly-allow-private-mutation */ + private int $parentLevel = 1; + + /** @psalm-readonly-allow-private-mutation */ + private ?ListItem $lastListItem = null; + + public function __construct(TableOfContents $toc) + { + $this->parentListBlock = $toc; + } + + public function addItem(int $level, ListItem $listItemToAdd): void + { + while ($level > $this->parentLevel) { + // Descend downwards, creating new ListBlocks if needed, until we reach the correct depth + if ($this->lastListItem === null) { + $this->lastListItem = new ListItem($this->parentListBlock->getListData()); + $this->parentListBlock->appendChild($this->lastListItem); + } + + $newListBlock = new ListBlock($this->parentListBlock->getListData()); + $newListBlock->setStartLine($listItemToAdd->getStartLine()); + $newListBlock->setEndLine($listItemToAdd->getEndLine()); + $this->lastListItem->appendChild($newListBlock); + $this->parentListBlock = $newListBlock; + $this->lastListItem = null; + + $this->parentLevel++; + } + + while ($level < $this->parentLevel) { + // Search upwards for the previous parent list block + $search = $this->parentListBlock; + while ($search = $search->parent()) { + if ($search instanceof ListBlock) { + $this->parentListBlock = $search; + break; + } + } + + $this->parentLevel--; + } + + $this->parentListBlock->appendChild($listItemToAdd); + + $this->lastListItem = $listItemToAdd; + } +} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/FlatNormalizerStrategy.php b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/FlatNormalizerStrategy.php new file mode 100644 index 00000000..8e805ae0 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/FlatNormalizerStrategy.php @@ -0,0 +1,33 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\TableOfContents\Normalizer; + +use League\CommonMark\Extension\CommonMark\Node\Block\ListItem; +use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; + +final class FlatNormalizerStrategy implements NormalizerStrategyInterface +{ + /** @psalm-readonly */ + private TableOfContents $toc; + + public function __construct(TableOfContents $toc) + { + $this->toc = $toc; + } + + public function addItem(int $level, ListItem $listItemToAdd): void + { + $this->toc->appendChild($listItemToAdd); + } +} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/NormalizerStrategyInterface.php b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/NormalizerStrategyInterface.php new file mode 100644 index 00000000..f30afb1b --- /dev/null +++ b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/NormalizerStrategyInterface.php @@ -0,0 +1,21 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\TableOfContents\Normalizer; + +use League\CommonMark\Extension\CommonMark\Node\Block\ListItem; + +interface NormalizerStrategyInterface +{ + public function addItem(int $level, ListItem $listItemToAdd): void; +} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/RelativeNormalizerStrategy.php b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/RelativeNormalizerStrategy.php new file mode 100644 index 00000000..1b2197ff --- /dev/null +++ b/vendor/league/commonmark/src/Extension/TableOfContents/Normalizer/RelativeNormalizerStrategy.php @@ -0,0 +1,67 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\TableOfContents\Normalizer; + +use League\CommonMark\Extension\CommonMark\Node\Block\ListBlock; +use League\CommonMark\Extension\CommonMark\Node\Block\ListItem; +use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; + +final class RelativeNormalizerStrategy implements NormalizerStrategyInterface +{ + /** @psalm-readonly */ + private TableOfContents $toc; + + /** + * @var array<int, ListItem> + * + * @psalm-readonly-allow-private-mutation + */ + private array $listItemStack = []; + + public function __construct(TableOfContents $toc) + { + $this->toc = $toc; + } + + public function addItem(int $level, ListItem $listItemToAdd): void + { + $previousLevel = \array_key_last($this->listItemStack); + + // Pop the stack if we're too deep + while ($previousLevel !== null && $level < $previousLevel) { + \array_pop($this->listItemStack); + $previousLevel = \array_key_last($this->listItemStack); + } + + $lastListItem = \end($this->listItemStack); + + // Need to go one level deeper? Add that level + if ($lastListItem !== false && $level > $previousLevel) { + $targetListBlock = new ListBlock($lastListItem->getListData()); + $targetListBlock->setStartLine($listItemToAdd->getStartLine()); + $targetListBlock->setEndLine($listItemToAdd->getEndLine()); + $lastListItem->appendChild($targetListBlock); + // Otherwise we're at the right level + // If there's no stack we're adding this item directly to the TOC element + } elseif ($lastListItem === false) { + $targetListBlock = $this->toc; + // Otherwise add it to the last list item + } else { + $targetListBlock = $lastListItem->parent(); + } + + $targetListBlock->appendChild($listItemToAdd); + $this->listItemStack[$level] = $listItemToAdd; + } +} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsBuilder.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsBuilder.php new file mode 100644 index 00000000..7fe2b099 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsBuilder.php @@ -0,0 +1,106 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\TableOfContents; + +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\CommonMark\Node\Block\Heading; +use League\CommonMark\Extension\HeadingPermalink\HeadingPermalink; +use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; +use League\CommonMark\Extension\TableOfContents\Node\TableOfContentsPlaceholder; +use League\CommonMark\Node\Block\Document; +use League\CommonMark\Node\NodeIterator; +use League\Config\ConfigurationAwareInterface; +use League\Config\ConfigurationInterface; +use League\Config\Exception\InvalidConfigurationException; + +final class TableOfContentsBuilder implements ConfigurationAwareInterface +{ + public const POSITION_TOP = 'top'; + public const POSITION_BEFORE_HEADINGS = 'before-headings'; + public const POSITION_PLACEHOLDER = 'placeholder'; + + /** @psalm-readonly-allow-private-mutation */ + private ConfigurationInterface $config; + + public function onDocumentParsed(DocumentParsedEvent $event): void + { + $document = $event->getDocument(); + + $generator = new TableOfContentsGenerator( + (string) $this->config->get('table_of_contents/style'), + (string) $this->config->get('table_of_contents/normalize'), + (int) $this->config->get('table_of_contents/min_heading_level'), + (int) $this->config->get('table_of_contents/max_heading_level'), + (string) $this->config->get('heading_permalink/fragment_prefix'), + ); + + $toc = $generator->generate($document); + if ($toc === null) { + // No linkable headers exist, so no TOC could be generated + return; + } + + // Add custom CSS class(es), if defined + $class = $this->config->get('table_of_contents/html_class'); + if ($class !== null) { + $toc->data->append('attributes/class', $class); + } + + // Add the TOC to the Document + $position = $this->config->get('table_of_contents/position'); + if ($position === self::POSITION_TOP) { + $document->prependChild($toc); + } elseif ($position === self::POSITION_BEFORE_HEADINGS) { + $this->insertBeforeFirstLinkedHeading($document, $toc); + } elseif ($position === self::POSITION_PLACEHOLDER) { + $this->replacePlaceholders($document, $toc); + } else { + throw InvalidConfigurationException::forConfigOption('table_of_contents/position', $position); + } + } + + private function insertBeforeFirstLinkedHeading(Document $document, TableOfContents $toc): void + { + foreach ($document->iterator(NodeIterator::FLAG_BLOCKS_ONLY) as $node) { + if (! $node instanceof Heading) { + continue; + } + + foreach ($node->children() as $child) { + if ($child instanceof HeadingPermalink) { + $node->insertBefore($toc); + + return; + } + } + } + } + + private function replacePlaceholders(Document $document, TableOfContents $toc): void + { + foreach ($document->iterator(NodeIterator::FLAG_BLOCKS_ONLY) as $node) { + // Add the block once we find a placeholder + if (! $node instanceof TableOfContentsPlaceholder) { + continue; + } + + $node->replaceWith(clone $toc); + } + } + + public function setConfiguration(ConfigurationInterface $configuration): void + { + $this->config = $configuration; + } +} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsExtension.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsExtension.php new file mode 100644 index 00000000..9c8223be --- /dev/null +++ b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsExtension.php @@ -0,0 +1,53 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\TableOfContents; + +use League\CommonMark\Environment\EnvironmentBuilderInterface; +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Extension\CommonMark\Node\Block\ListBlock; +use League\CommonMark\Extension\CommonMark\Renderer\Block\ListBlockRenderer; +use League\CommonMark\Extension\ConfigurableExtensionInterface; +use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; +use League\CommonMark\Extension\TableOfContents\Node\TableOfContentsPlaceholder; +use League\Config\ConfigurationBuilderInterface; +use Nette\Schema\Expect; + +final class TableOfContentsExtension implements ConfigurableExtensionInterface +{ + public function configureSchema(ConfigurationBuilderInterface $builder): void + { + $builder->addSchema('table_of_contents', Expect::structure([ + 'position' => Expect::anyOf(TableOfContentsBuilder::POSITION_BEFORE_HEADINGS, TableOfContentsBuilder::POSITION_PLACEHOLDER, TableOfContentsBuilder::POSITION_TOP)->default(TableOfContentsBuilder::POSITION_TOP), + 'style' => Expect::anyOf(ListBlock::TYPE_BULLET, ListBlock::TYPE_ORDERED)->default(ListBlock::TYPE_BULLET), + 'normalize' => Expect::anyOf(TableOfContentsGenerator::NORMALIZE_RELATIVE, TableOfContentsGenerator::NORMALIZE_FLAT, TableOfContentsGenerator::NORMALIZE_DISABLED)->default(TableOfContentsGenerator::NORMALIZE_RELATIVE), + 'min_heading_level' => Expect::int()->min(1)->max(6)->default(1), + 'max_heading_level' => Expect::int()->min(1)->max(6)->default(6), + 'html_class' => Expect::string()->default('table-of-contents'), + 'placeholder' => Expect::anyOf(Expect::string(), Expect::null())->default(null), + ])); + } + + public function register(EnvironmentBuilderInterface $environment): void + { + $environment->addRenderer(TableOfContents::class, new TableOfContentsRenderer(new ListBlockRenderer())); + $environment->addEventListener(DocumentParsedEvent::class, [new TableOfContentsBuilder(), 'onDocumentParsed'], -150); + + // phpcs:ignore SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed + if ($environment->getConfiguration()->get('table_of_contents/position') === TableOfContentsBuilder::POSITION_PLACEHOLDER) { + $environment->addBlockStartParser(TableOfContentsPlaceholderParser::blockStartParser(), 200); + // If a placeholder cannot be replaced with a TOC element this renderer will ensure the parser won't error out + $environment->addRenderer(TableOfContentsPlaceholder::class, new TableOfContentsPlaceholderRenderer()); + } + } +} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsGenerator.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsGenerator.php new file mode 100644 index 00000000..f0df96bf --- /dev/null +++ b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsGenerator.php @@ -0,0 +1,168 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\TableOfContents; + +use League\CommonMark\Extension\CommonMark\Node\Block\Heading; +use League\CommonMark\Extension\CommonMark\Node\Block\ListBlock; +use League\CommonMark\Extension\CommonMark\Node\Block\ListData; +use League\CommonMark\Extension\CommonMark\Node\Block\ListItem; +use League\CommonMark\Extension\CommonMark\Node\Inline\Link; +use League\CommonMark\Extension\HeadingPermalink\HeadingPermalink; +use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; +use League\CommonMark\Extension\TableOfContents\Normalizer\AsIsNormalizerStrategy; +use League\CommonMark\Extension\TableOfContents\Normalizer\FlatNormalizerStrategy; +use League\CommonMark\Extension\TableOfContents\Normalizer\NormalizerStrategyInterface; +use League\CommonMark\Extension\TableOfContents\Normalizer\RelativeNormalizerStrategy; +use League\CommonMark\Node\Block\Document; +use League\CommonMark\Node\NodeIterator; +use League\CommonMark\Node\RawMarkupContainerInterface; +use League\CommonMark\Node\StringContainerHelper; +use League\Config\Exception\InvalidConfigurationException; + +final class TableOfContentsGenerator implements TableOfContentsGeneratorInterface +{ + public const STYLE_BULLET = ListBlock::TYPE_BULLET; + public const STYLE_ORDERED = ListBlock::TYPE_ORDERED; + + public const NORMALIZE_DISABLED = 'as-is'; + public const NORMALIZE_RELATIVE = 'relative'; + public const NORMALIZE_FLAT = 'flat'; + + /** @psalm-readonly */ + private string $style; + + /** @psalm-readonly */ + private string $normalizationStrategy; + + /** @psalm-readonly */ + private int $minHeadingLevel; + + /** @psalm-readonly */ + private int $maxHeadingLevel; + + /** @psalm-readonly */ + private string $fragmentPrefix; + + public function __construct(string $style, string $normalizationStrategy, int $minHeadingLevel, int $maxHeadingLevel, string $fragmentPrefix) + { + $this->style = $style; + $this->normalizationStrategy = $normalizationStrategy; + $this->minHeadingLevel = $minHeadingLevel; + $this->maxHeadingLevel = $maxHeadingLevel; + $this->fragmentPrefix = $fragmentPrefix; + + if ($fragmentPrefix !== '') { + $this->fragmentPrefix .= '-'; + } + } + + public function generate(Document $document): ?TableOfContents + { + $toc = $this->createToc($document); + + $normalizer = $this->getNormalizer($toc); + + $firstHeading = null; + + foreach ($this->getHeadingLinks($document) as $headingLink) { + $heading = $headingLink->parent(); + // Make sure this is actually tied to a heading + if (! $heading instanceof Heading) { + continue; + } + + // Skip any headings outside the configured min/max levels + if ($heading->getLevel() < $this->minHeadingLevel || $heading->getLevel() > $this->maxHeadingLevel) { + continue; + } + + // Keep track of the first heading we see - we might need this later + $firstHeading ??= $heading; + + // Keep track of the start and end lines + $toc->setStartLine($firstHeading->getStartLine()); + $toc->setEndLine($heading->getEndLine()); + + // Create the new link + $link = new Link('#' . $this->fragmentPrefix . $headingLink->getSlug(), StringContainerHelper::getChildText($heading, [RawMarkupContainerInterface::class])); + + $listItem = new ListItem($toc->getListData()); + $listItem->setStartLine($heading->getStartLine()); + $listItem->setEndLine($heading->getEndLine()); + $listItem->appendChild($link); + + // Add it to the correct place + $normalizer->addItem($heading->getLevel(), $listItem); + } + + // Don't add the TOC if no headings were present + if (! $toc->hasChildren() || $firstHeading === null) { + return null; + } + + return $toc; + } + + private function createToc(Document $document): TableOfContents + { + $listData = new ListData(); + + if ($this->style === self::STYLE_BULLET) { + $listData->type = ListBlock::TYPE_BULLET; + } elseif ($this->style === self::STYLE_ORDERED) { + $listData->type = ListBlock::TYPE_ORDERED; + } else { + throw new InvalidConfigurationException(\sprintf('Invalid table of contents list style: "%s"', $this->style)); + } + + $toc = new TableOfContents($listData); + + $toc->setStartLine($document->getStartLine()); + $toc->setEndLine($document->getEndLine()); + + return $toc; + } + + /** + * @return iterable<HeadingPermalink> + */ + private function getHeadingLinks(Document $document): iterable + { + foreach ($document->iterator(NodeIterator::FLAG_BLOCKS_ONLY) as $node) { + if (! $node instanceof Heading) { + continue; + } + + foreach ($node->children() as $child) { + if ($child instanceof HeadingPermalink) { + yield $child; + } + } + } + } + + private function getNormalizer(TableOfContents $toc): NormalizerStrategyInterface + { + switch ($this->normalizationStrategy) { + case self::NORMALIZE_DISABLED: + return new AsIsNormalizerStrategy($toc); + case self::NORMALIZE_RELATIVE: + return new RelativeNormalizerStrategy($toc); + case self::NORMALIZE_FLAT: + return new FlatNormalizerStrategy($toc); + default: + throw new InvalidConfigurationException(\sprintf('Invalid table of contents normalization strategy: "%s"', $this->normalizationStrategy)); + } + } +} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsGeneratorInterface.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsGeneratorInterface.php new file mode 100644 index 00000000..64ecb8e5 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsGeneratorInterface.php @@ -0,0 +1,22 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\TableOfContents; + +use League\CommonMark\Extension\TableOfContents\Node\TableOfContents; +use League\CommonMark\Node\Block\Document; + +interface TableOfContentsGeneratorInterface +{ + public function generate(Document $document): ?TableOfContents; +} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsPlaceholderParser.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsPlaceholderParser.php new file mode 100644 index 00000000..b27ddee6 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsPlaceholderParser.php @@ -0,0 +1,74 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\TableOfContents; + +use League\CommonMark\Extension\TableOfContents\Node\TableOfContentsPlaceholder; +use League\CommonMark\Parser\Block\AbstractBlockContinueParser; +use League\CommonMark\Parser\Block\BlockContinue; +use League\CommonMark\Parser\Block\BlockContinueParserInterface; +use League\CommonMark\Parser\Block\BlockStart; +use League\CommonMark\Parser\Block\BlockStartParserInterface; +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Parser\MarkdownParserStateInterface; +use League\Config\ConfigurationAwareInterface; +use League\Config\ConfigurationInterface; + +final class TableOfContentsPlaceholderParser extends AbstractBlockContinueParser +{ + /** @psalm-readonly */ + private TableOfContentsPlaceholder $block; + + public function __construct() + { + $this->block = new TableOfContentsPlaceholder(); + } + + public function getBlock(): TableOfContentsPlaceholder + { + return $this->block; + } + + public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue + { + return BlockContinue::none(); + } + + public static function blockStartParser(): BlockStartParserInterface + { + return new class () implements BlockStartParserInterface, ConfigurationAwareInterface { + /** @psalm-readonly-allow-private-mutation */ + private ConfigurationInterface $config; + + public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart + { + $placeholder = $this->config->get('table_of_contents/placeholder'); + if ($placeholder === null) { + return BlockStart::none(); + } + + // The placeholder must be the only thing on the line + if ($cursor->match('/^' . \preg_quote($placeholder, '/') . '$/') === null) { + return BlockStart::none(); + } + + return BlockStart::of(new TableOfContentsPlaceholderParser())->at($cursor); + } + + public function setConfiguration(ConfigurationInterface $configuration): void + { + $this->config = $configuration; + } + }; + } +} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsPlaceholderRenderer.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsPlaceholderRenderer.php new file mode 100644 index 00000000..0366cb91 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsPlaceholderRenderer.php @@ -0,0 +1,40 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\TableOfContents; + +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Xml\XmlNodeRendererInterface; + +final class TableOfContentsPlaceholderRenderer implements NodeRendererInterface, XmlNodeRendererInterface +{ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): string + { + return '<!-- table of contents -->'; + } + + public function getXmlTagName(Node $node): string + { + return 'table_of_contents_placeholder'; + } + + /** + * @return array<string, scalar> + */ + public function getXmlAttributes(Node $node): array + { + return []; + } +} diff --git a/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsRenderer.php b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsRenderer.php new file mode 100644 index 00000000..da1b6983 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/TableOfContents/TableOfContentsRenderer.php @@ -0,0 +1,56 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\TableOfContents; + +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Xml\XmlNodeRendererInterface; + +final class TableOfContentsRenderer implements NodeRendererInterface, XmlNodeRendererInterface +{ + /** @var NodeRendererInterface&XmlNodeRendererInterface */ + private $innerRenderer; + + /** + * @psalm-param NodeRendererInterface&XmlNodeRendererInterface $innerRenderer + * + * @phpstan-param NodeRendererInterface&XmlNodeRendererInterface $innerRenderer + */ + public function __construct(NodeRendererInterface $innerRenderer) + { + $this->innerRenderer = $innerRenderer; + } + + /** + * {@inheritDoc} + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer) + { + return $this->innerRenderer->render($node, $childRenderer); + } + + public function getXmlTagName(Node $node): string + { + return 'table_of_contents'; + } + + /** + * @return array<string, scalar> + */ + public function getXmlAttributes(Node $node): array + { + return $this->innerRenderer->getXmlAttributes($node); + } +} diff --git a/vendor/league/commonmark/src/Extension/TaskList/TaskListExtension.php b/vendor/league/commonmark/src/Extension/TaskList/TaskListExtension.php new file mode 100644 index 00000000..bf4b0d23 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/TaskList/TaskListExtension.php @@ -0,0 +1,26 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\TaskList; + +use League\CommonMark\Environment\EnvironmentBuilderInterface; +use League\CommonMark\Extension\ExtensionInterface; + +final class TaskListExtension implements ExtensionInterface +{ + public function register(EnvironmentBuilderInterface $environment): void + { + $environment->addInlineParser(new TaskListItemMarkerParser(), 35); + $environment->addRenderer(TaskListItemMarker::class, new TaskListItemMarkerRenderer()); + } +} diff --git a/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarker.php b/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarker.php new file mode 100644 index 00000000..125ae405 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarker.php @@ -0,0 +1,39 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\TaskList; + +use League\CommonMark\Node\Inline\AbstractInline; + +final class TaskListItemMarker extends AbstractInline +{ + /** @psalm-readonly-allow-private-mutation */ + private bool $checked; + + public function __construct(bool $isCompleted) + { + parent::__construct(); + + $this->checked = $isCompleted; + } + + public function isChecked(): bool + { + return $this->checked; + } + + public function setChecked(bool $checked): void + { + $this->checked = $checked; + } +} diff --git a/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerParser.php b/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerParser.php new file mode 100644 index 00000000..30e27316 --- /dev/null +++ b/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerParser.php @@ -0,0 +1,55 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\TaskList; + +use League\CommonMark\Extension\CommonMark\Node\Block\ListItem; +use League\CommonMark\Node\Block\Paragraph; +use League\CommonMark\Parser\Inline\InlineParserInterface; +use League\CommonMark\Parser\Inline\InlineParserMatch; +use League\CommonMark\Parser\InlineParserContext; + +final class TaskListItemMarkerParser implements InlineParserInterface +{ + public function getMatchDefinition(): InlineParserMatch + { + return InlineParserMatch::oneOf('[ ]', '[x]'); + } + + public function parse(InlineParserContext $inlineContext): bool + { + $container = $inlineContext->getContainer(); + + // Checkbox must come at the beginning of the first paragraph of the list item + if ($container->hasChildren() || ! ($container instanceof Paragraph && $container->parent() && $container->parent() instanceof ListItem)) { + return false; + } + + $cursor = $inlineContext->getCursor(); + $oldState = $cursor->saveState(); + + $cursor->advanceBy(3); + + if ($cursor->getNextNonSpaceCharacter() === null) { + $cursor->restoreState($oldState); + + return false; + } + + $isChecked = $inlineContext->getFullMatch() !== '[ ]'; + + $container->appendChild(new TaskListItemMarker($isChecked)); + + return true; + } +} diff --git a/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerRenderer.php b/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerRenderer.php new file mode 100644 index 00000000..a1eb745c --- /dev/null +++ b/vendor/league/commonmark/src/Extension/TaskList/TaskListItemMarkerRenderer.php @@ -0,0 +1,70 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Extension\TaskList; + +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\CommonMark\Xml\XmlNodeRendererInterface; + +final class TaskListItemMarkerRenderer implements NodeRendererInterface, XmlNodeRendererInterface +{ + /** + * @param TaskListItemMarker $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable + { + TaskListItemMarker::assertInstanceOf($node); + + $attrs = $node->data->get('attributes'); + $checkbox = new HtmlElement('input', $attrs, '', true); + + if ($node->isChecked()) { + $checkbox->setAttribute('checked', ''); + } + + $checkbox->setAttribute('disabled', ''); + $checkbox->setAttribute('type', 'checkbox'); + + return $checkbox; + } + + public function getXmlTagName(Node $node): string + { + return 'task_list_item_marker'; + } + + /** + * @param TaskListItemMarker $node + * + * @return array<string, scalar> + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function getXmlAttributes(Node $node): array + { + TaskListItemMarker::assertInstanceOf($node); + + if ($node->isChecked()) { + return ['checked' => 'checked']; + } + + return []; + } +} diff --git a/vendor/league/commonmark/src/GithubFlavoredMarkdownConverter.php b/vendor/league/commonmark/src/GithubFlavoredMarkdownConverter.php new file mode 100644 index 00000000..f2524b22 --- /dev/null +++ b/vendor/league/commonmark/src/GithubFlavoredMarkdownConverter.php @@ -0,0 +1,45 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark; + +use League\CommonMark\Environment\Environment; +use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension; +use League\CommonMark\Extension\GithubFlavoredMarkdownExtension; + +/** + * Converts GitHub Flavored Markdown to HTML. + */ +final class GithubFlavoredMarkdownConverter extends MarkdownConverter +{ + /** + * Create a new Markdown converter pre-configured for GFM + * + * @param array<string, mixed> $config + */ + public function __construct(array $config = []) + { + $environment = new Environment($config); + $environment->addExtension(new CommonMarkCoreExtension()); + $environment->addExtension(new GithubFlavoredMarkdownExtension()); + + parent::__construct($environment); + } + + public function getEnvironment(): Environment + { + \assert($this->environment instanceof Environment); + + return $this->environment; + } +} diff --git a/vendor/league/commonmark/src/Input/MarkdownInput.php b/vendor/league/commonmark/src/Input/MarkdownInput.php new file mode 100644 index 00000000..bbe1618a --- /dev/null +++ b/vendor/league/commonmark/src/Input/MarkdownInput.php @@ -0,0 +1,102 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Input; + +use League\CommonMark\Exception\UnexpectedEncodingException; + +class MarkdownInput implements MarkdownInputInterface +{ + /** + * @var array<int, string>|null + * + * @psalm-readonly-allow-private-mutation + */ + private ?array $lines = null; + + /** @psalm-readonly-allow-private-mutation */ + private string $content; + + /** @psalm-readonly-allow-private-mutation */ + private ?int $lineCount = null; + + /** @psalm-readonly */ + private int $lineOffset; + + public function __construct(string $content, int $lineOffset = 0) + { + if (! \mb_check_encoding($content, 'UTF-8')) { + throw new UnexpectedEncodingException('Unexpected encoding - UTF-8 or ASCII was expected'); + } + + // Strip any leading UTF-8 BOM + if (\substr($content, 0, 3) === "\xEF\xBB\xBF") { + $content = \substr($content, 3); + } + + $this->content = $content; + $this->lineOffset = $lineOffset; + } + + public function getContent(): string + { + return $this->content; + } + + /** + * {@inheritDoc} + */ + public function getLines(): iterable + { + $this->splitLinesIfNeeded(); + + \assert($this->lines !== null); + + /** @psalm-suppress PossiblyNullIterator */ + foreach ($this->lines as $i => $line) { + yield $this->lineOffset + $i + 1 => $line; + } + } + + public function getLineCount(): int + { + $this->splitLinesIfNeeded(); + + \assert($this->lineCount !== null); + + return $this->lineCount; + } + + private function splitLinesIfNeeded(): void + { + if ($this->lines !== null) { + return; + } + + $lines = \preg_split('/\r\n|\n|\r/', $this->content); + if ($lines === false) { + throw new UnexpectedEncodingException('Failed to split Markdown content by line'); + } + + $this->lines = $lines; + + // Remove any newline which appears at the very end of the string. + // We've already split the document by newlines, so we can simply drop + // any empty element which appears on the end. + if (\end($this->lines) === '') { + \array_pop($this->lines); + } + + $this->lineCount = \count($this->lines); + } +} diff --git a/vendor/league/commonmark/src/Input/MarkdownInputInterface.php b/vendor/league/commonmark/src/Input/MarkdownInputInterface.php new file mode 100644 index 00000000..bb8d6f1d --- /dev/null +++ b/vendor/league/commonmark/src/Input/MarkdownInputInterface.php @@ -0,0 +1,26 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Input; + +interface MarkdownInputInterface +{ + public function getContent(): string; + + /** + * @return iterable<int, string> + */ + public function getLines(): iterable; + + public function getLineCount(): int; +} diff --git a/vendor/league/commonmark/src/MarkdownConverter.php b/vendor/league/commonmark/src/MarkdownConverter.php new file mode 100644 index 00000000..037ecffb --- /dev/null +++ b/vendor/league/commonmark/src/MarkdownConverter.php @@ -0,0 +1,93 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark; + +use League\CommonMark\Environment\EnvironmentInterface; +use League\CommonMark\Exception\CommonMarkException; +use League\CommonMark\Output\RenderedContentInterface; +use League\CommonMark\Parser\MarkdownParser; +use League\CommonMark\Parser\MarkdownParserInterface; +use League\CommonMark\Renderer\HtmlRenderer; +use League\CommonMark\Renderer\MarkdownRendererInterface; + +class MarkdownConverter implements ConverterInterface, MarkdownConverterInterface +{ + /** @psalm-readonly */ + protected EnvironmentInterface $environment; + + /** @psalm-readonly */ + protected MarkdownParserInterface $markdownParser; + + /** @psalm-readonly */ + protected MarkdownRendererInterface $htmlRenderer; + + public function __construct(EnvironmentInterface $environment) + { + $this->environment = $environment; + + $this->markdownParser = new MarkdownParser($environment); + $this->htmlRenderer = new HtmlRenderer($environment); + } + + public function getEnvironment(): EnvironmentInterface + { + return $this->environment; + } + + /** + * Converts Markdown to HTML. + * + * @param string $input The Markdown to convert + * + * @return RenderedContentInterface Rendered HTML + * + * @throws CommonMarkException + */ + public function convert(string $input): RenderedContentInterface + { + $documentAST = $this->markdownParser->parse($input); + + return $this->htmlRenderer->renderDocument($documentAST); + } + + /** + * Converts Markdown to HTML. + * + * @deprecated since 2.2; use {@link convert()} instead + * + * @param string $markdown The Markdown to convert + * + * @return RenderedContentInterface Rendered HTML + * + * @throws CommonMarkException + */ + public function convertToHtml(string $markdown): RenderedContentInterface + { + \trigger_deprecation('league/commonmark', '2.2.0', 'Calling "convertToHtml()" on a %s class is deprecated, use "convert()" instead.', self::class); + + return $this->convert($markdown); + } + + /** + * Converts CommonMark to HTML. + * + * @see MarkdownConverter::convert() + * + * @throws CommonMarkException + */ + public function __invoke(string $markdown): RenderedContentInterface + { + return $this->convert($markdown); + } +} diff --git a/vendor/league/commonmark/src/MarkdownConverterInterface.php b/vendor/league/commonmark/src/MarkdownConverterInterface.php new file mode 100644 index 00000000..a52a2866 --- /dev/null +++ b/vendor/league/commonmark/src/MarkdownConverterInterface.php @@ -0,0 +1,34 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark; + +use League\CommonMark\Exception\CommonMarkException; +use League\CommonMark\Output\RenderedContentInterface; + +/** + * Interface for a service which converts Markdown to HTML. + * + * @deprecated since 2.2; use {@link ConverterInterface} instead + */ +interface MarkdownConverterInterface +{ + /** + * Converts Markdown to HTML. + * + * @deprecated since 2.2; use {@link ConverterInterface::convert()} instead + * + * @throws CommonMarkException + */ + public function convertToHtml(string $markdown): RenderedContentInterface; +} diff --git a/vendor/league/commonmark/src/Node/Block/AbstractBlock.php b/vendor/league/commonmark/src/Node/Block/AbstractBlock.php new file mode 100644 index 00000000..417f89b5 --- /dev/null +++ b/vendor/league/commonmark/src/Node/Block/AbstractBlock.php @@ -0,0 +1,64 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Node\Block; + +use League\CommonMark\Exception\InvalidArgumentException; +use League\CommonMark\Node\Node; + +/** + * Block-level element + * + * @method parent() ?AbstractBlock + */ +abstract class AbstractBlock extends Node +{ + protected ?int $startLine = null; + + protected ?int $endLine = null; + + protected function setParent(?Node $node = null): void + { + if ($node && ! $node instanceof self) { + throw new InvalidArgumentException('Parent of block must also be block (cannot be inline)'); + } + + parent::setParent($node); + } + + public function setStartLine(?int $startLine): void + { + $this->startLine = $startLine; + if ($this->endLine === null) { + $this->endLine = $startLine; + } + } + + public function getStartLine(): ?int + { + return $this->startLine; + } + + public function setEndLine(?int $endLine): void + { + $this->endLine = $endLine; + } + + public function getEndLine(): ?int + { + return $this->endLine; + } +} diff --git a/vendor/league/commonmark/src/Node/Block/Document.php b/vendor/league/commonmark/src/Node/Block/Document.php new file mode 100644 index 00000000..ee7ee44e --- /dev/null +++ b/vendor/league/commonmark/src/Node/Block/Document.php @@ -0,0 +1,56 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Node\Block; + +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Reference\ReferenceMap; +use League\CommonMark\Reference\ReferenceMapInterface; + +class Document extends AbstractBlock +{ + /** @psalm-readonly */ + protected ReferenceMapInterface $referenceMap; + + public function __construct(?ReferenceMapInterface $referenceMap = null) + { + parent::__construct(); + + $this->setStartLine(1); + + $this->referenceMap = $referenceMap ?? new ReferenceMap(); + } + + public function getReferenceMap(): ReferenceMapInterface + { + return $this->referenceMap; + } + + public function canContain(AbstractBlock $block): bool + { + return true; + } + + public function isCode(): bool + { + return false; + } + + public function matchesNextLine(Cursor $cursor): bool + { + return true; + } +} diff --git a/vendor/league/commonmark/src/Node/Block/Paragraph.php b/vendor/league/commonmark/src/Node/Block/Paragraph.php new file mode 100644 index 00000000..d06d84ea --- /dev/null +++ b/vendor/league/commonmark/src/Node/Block/Paragraph.php @@ -0,0 +1,23 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Node\Block; + +class Paragraph extends AbstractBlock +{ + /** @internal */ + public bool $onlyContainsLinkReferenceDefinitions = false; +} diff --git a/vendor/league/commonmark/src/Node/Block/TightBlockInterface.php b/vendor/league/commonmark/src/Node/Block/TightBlockInterface.php new file mode 100644 index 00000000..21a5868e --- /dev/null +++ b/vendor/league/commonmark/src/Node/Block/TightBlockInterface.php @@ -0,0 +1,21 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Node\Block; + +interface TightBlockInterface +{ + public function isTight(): bool; + + public function setTight(bool $tight): void; +} diff --git a/vendor/league/commonmark/src/Node/Inline/AbstractInline.php b/vendor/league/commonmark/src/Node/Inline/AbstractInline.php new file mode 100644 index 00000000..d3705b44 --- /dev/null +++ b/vendor/league/commonmark/src/Node/Inline/AbstractInline.php @@ -0,0 +1,23 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Node\Inline; + +use League\CommonMark\Node\Node; + +abstract class AbstractInline extends Node +{ +} diff --git a/vendor/league/commonmark/src/Node/Inline/AbstractStringContainer.php b/vendor/league/commonmark/src/Node/Inline/AbstractStringContainer.php new file mode 100644 index 00000000..f0aab841 --- /dev/null +++ b/vendor/league/commonmark/src/Node/Inline/AbstractStringContainer.php @@ -0,0 +1,47 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Node\Inline; + +use League\CommonMark\Node\StringContainerInterface; + +abstract class AbstractStringContainer extends AbstractInline implements StringContainerInterface +{ + protected string $literal = ''; + + /** + * @param array<string, mixed> $data + */ + public function __construct(string $contents = '', array $data = []) + { + parent::__construct(); + + $this->literal = $contents; + if (\count($data) > 0) { + $this->data->import($data); + } + } + + public function getLiteral(): string + { + return $this->literal; + } + + public function setLiteral(string $literal): void + { + $this->literal = $literal; + } +} diff --git a/vendor/league/commonmark/src/Node/Inline/AdjacentTextMerger.php b/vendor/league/commonmark/src/Node/Inline/AdjacentTextMerger.php new file mode 100644 index 00000000..43922d42 --- /dev/null +++ b/vendor/league/commonmark/src/Node/Inline/AdjacentTextMerger.php @@ -0,0 +1,105 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Additional emphasis processing code based on commonmark-java (https://github.com/atlassian/commonmark-java) + * - (c) Atlassian Pty Ltd + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Node\Inline; + +use League\CommonMark\Node\Node; + +/** + * @internal + */ +final class AdjacentTextMerger +{ + public static function mergeChildNodes(Node $node): void + { + // No children or just one child node, no need for merging + if ($node->firstChild() === $node->lastChild() || $node->firstChild() === null || $node->lastChild() === null) { + return; + } + + /** @psalm-suppress PossiblyNullArgument */ + self::mergeTextNodesInclusive($node->firstChild(), $node->lastChild()); + } + + public static function mergeTextNodesBetweenExclusive(Node $fromNode, Node $toNode): void + { + // No nodes between them + if ($fromNode === $toNode || $fromNode->next() === $toNode || $fromNode->next() === null || $toNode->previous() === null) { + return; + } + + /** @psalm-suppress PossiblyNullArgument */ + self::mergeTextNodesInclusive($fromNode->next(), $toNode->previous()); + } + + public static function mergeWithDirectlyAdjacentNodes(Text $node): void + { + $start = ($previous = $node->previous()) instanceof Text ? $previous : $node; + $end = ($next = $node->next()) instanceof Text ? $next : $node; + + self::mergeIfNeeded($start, $end); + } + + private static function mergeTextNodesInclusive(Node $fromNode, Node $toNode): void + { + $first = null; + $last = null; + + $node = $fromNode; + while ($node !== null) { + if ($node instanceof Text) { + if ($first === null) { + $first = $node; + } + + $last = $node; + } else { + self::mergeIfNeeded($first, $last); + $first = null; + $last = null; + } + + if ($node === $toNode) { + break; + } + + $node = $node->next(); + } + + self::mergeIfNeeded($first, $last); + } + + private static function mergeIfNeeded(?Text $first, ?Text $last): void + { + if ($first === null || $last === null || $first === $last) { + // No merging needed + return; + } + + $s = $first->getLiteral(); + + $node = $first->next(); + $stop = $last->next(); + while ($node !== $stop && $node instanceof Text) { + $s .= $node->getLiteral(); + $unlink = $node; + $node = $node->next(); + $unlink->detach(); + } + + $first->setLiteral($s); + } +} diff --git a/vendor/league/commonmark/src/Node/Inline/DelimitedInterface.php b/vendor/league/commonmark/src/Node/Inline/DelimitedInterface.php new file mode 100644 index 00000000..89773faa --- /dev/null +++ b/vendor/league/commonmark/src/Node/Inline/DelimitedInterface.php @@ -0,0 +1,21 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Node\Inline; + +interface DelimitedInterface +{ + public function getOpeningDelimiter(): string; + + public function getClosingDelimiter(): string; +} diff --git a/vendor/league/commonmark/src/Node/Inline/Newline.php b/vendor/league/commonmark/src/Node/Inline/Newline.php new file mode 100644 index 00000000..68790de0 --- /dev/null +++ b/vendor/league/commonmark/src/Node/Inline/Newline.php @@ -0,0 +1,40 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Node\Inline; + +final class Newline extends AbstractInline +{ + // Any changes to these constants should be reflected in .phpstorm.meta.php + public const HARDBREAK = 0; + public const SOFTBREAK = 1; + + /** @psalm-readonly */ + private int $type; + + public function __construct(int $breakType = self::HARDBREAK) + { + parent::__construct(); + + $this->type = $breakType; + } + + /** @psalm-immutable */ + public function getType(): int + { + return $this->type; + } +} diff --git a/vendor/league/commonmark/src/Node/Inline/Text.php b/vendor/league/commonmark/src/Node/Inline/Text.php new file mode 100644 index 00000000..31387f91 --- /dev/null +++ b/vendor/league/commonmark/src/Node/Inline/Text.php @@ -0,0 +1,25 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Node\Inline; + +final class Text extends AbstractStringContainer +{ + public function append(string $literal): void + { + $this->literal .= $literal; + } +} diff --git a/vendor/league/commonmark/src/Node/Node.php b/vendor/league/commonmark/src/Node/Node.php new file mode 100644 index 00000000..484b39c1 --- /dev/null +++ b/vendor/league/commonmark/src/Node/Node.php @@ -0,0 +1,262 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Node; + +use Dflydev\DotAccessData\Data; +use League\CommonMark\Exception\InvalidArgumentException; + +abstract class Node +{ + /** @psalm-readonly */ + public Data $data; + + /** @psalm-readonly-allow-private-mutation */ + protected int $depth = 0; + + /** @psalm-readonly-allow-private-mutation */ + protected ?Node $parent = null; + + /** @psalm-readonly-allow-private-mutation */ + protected ?Node $previous = null; + + /** @psalm-readonly-allow-private-mutation */ + protected ?Node $next = null; + + /** @psalm-readonly-allow-private-mutation */ + protected ?Node $firstChild = null; + + /** @psalm-readonly-allow-private-mutation */ + protected ?Node $lastChild = null; + + public function __construct() + { + $this->data = new Data([ + 'attributes' => [], + ]); + } + + public function previous(): ?Node + { + return $this->previous; + } + + public function next(): ?Node + { + return $this->next; + } + + public function parent(): ?Node + { + return $this->parent; + } + + protected function setParent(?Node $node = null): void + { + $this->parent = $node; + $this->depth = $node === null ? 0 : $node->depth + 1; + } + + /** + * Inserts the $sibling node after $this + */ + public function insertAfter(Node $sibling): void + { + $sibling->detach(); + $sibling->next = $this->next; + + if ($sibling->next) { + $sibling->next->previous = $sibling; + } + + $sibling->previous = $this; + $this->next = $sibling; + $sibling->setParent($this->parent); + + if (! $sibling->next && $sibling->parent) { + $sibling->parent->lastChild = $sibling; + } + } + + /** + * Inserts the $sibling node before $this + */ + public function insertBefore(Node $sibling): void + { + $sibling->detach(); + $sibling->previous = $this->previous; + + if ($sibling->previous) { + $sibling->previous->next = $sibling; + } + + $sibling->next = $this; + $this->previous = $sibling; + $sibling->setParent($this->parent); + + if (! $sibling->previous && $sibling->parent) { + $sibling->parent->firstChild = $sibling; + } + } + + public function replaceWith(Node $replacement): void + { + $replacement->detach(); + $this->insertAfter($replacement); + $this->detach(); + } + + public function detach(): void + { + if ($this->previous) { + $this->previous->next = $this->next; + } elseif ($this->parent) { + $this->parent->firstChild = $this->next; + } + + if ($this->next) { + $this->next->previous = $this->previous; + } elseif ($this->parent) { + $this->parent->lastChild = $this->previous; + } + + $this->parent = null; + $this->next = null; + $this->previous = null; + $this->depth = 0; + } + + public function hasChildren(): bool + { + return $this->firstChild !== null; + } + + public function firstChild(): ?Node + { + return $this->firstChild; + } + + public function lastChild(): ?Node + { + return $this->lastChild; + } + + /** + * @return Node[] + */ + public function children(): iterable + { + $children = []; + for ($current = $this->firstChild; $current !== null; $current = $current->next) { + $children[] = $current; + } + + return $children; + } + + public function appendChild(Node $child): void + { + if ($this->lastChild) { + $this->lastChild->insertAfter($child); + } else { + $child->detach(); + $child->setParent($this); + $this->lastChild = $this->firstChild = $child; + } + } + + /** + * Adds $child as the very first child of $this + */ + public function prependChild(Node $child): void + { + if ($this->firstChild) { + $this->firstChild->insertBefore($child); + } else { + $child->detach(); + $child->setParent($this); + $this->lastChild = $this->firstChild = $child; + } + } + + /** + * Detaches all child nodes of given node + */ + public function detachChildren(): void + { + foreach ($this->children() as $children) { + $children->setParent(null); + } + + $this->firstChild = $this->lastChild = null; + } + + /** + * Replace all children of given node with collection of another + * + * @param iterable<Node> $children + */ + public function replaceChildren(iterable $children): void + { + $this->detachChildren(); + foreach ($children as $item) { + $this->appendChild($item); + } + } + + public function getDepth(): int + { + return $this->depth; + } + + public function walker(): NodeWalker + { + return new NodeWalker($this); + } + + public function iterator(int $flags = 0): NodeIterator + { + return new NodeIterator($this, $flags); + } + + /** + * Clone the current node and its children + * + * WARNING: This is a recursive function and should not be called on deeply-nested node trees! + */ + public function __clone() + { + // Cloned nodes are detached from their parents, siblings, and children + $this->parent = null; + $this->previous = null; + $this->next = null; + // But save a copy of the children since we'll need that in a moment + $children = $this->children(); + $this->detachChildren(); + + // The original children get cloned and re-added + foreach ($children as $child) { + $this->appendChild(clone $child); + } + } + + public static function assertInstanceOf(Node $node): void + { + if (! $node instanceof static) { + throw new InvalidArgumentException(\sprintf('Incompatible node type: expected %s, got %s', static::class, \get_class($node))); + } + } +} diff --git a/vendor/league/commonmark/src/Node/NodeIterator.php b/vendor/league/commonmark/src/Node/NodeIterator.php new file mode 100644 index 00000000..3d295ef1 --- /dev/null +++ b/vendor/league/commonmark/src/Node/NodeIterator.php @@ -0,0 +1,58 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Node; + +use League\CommonMark\Node\Block\AbstractBlock; + +/** + * @implements \IteratorAggregate<int, Node> + */ +final class NodeIterator implements \IteratorAggregate +{ + public const FLAG_BLOCKS_ONLY = 1; + + private Node $node; + private bool $blocksOnly; + + public function __construct(Node $node, int $flags = 0) + { + $this->node = $node; + $this->blocksOnly = ($flags & self::FLAG_BLOCKS_ONLY) === self::FLAG_BLOCKS_ONLY; + } + + /** + * @return \Generator<int, Node> + */ + public function getIterator(): \Generator + { + $stack = [$this->node]; + $index = 0; + + while ($stack) { + $node = \array_pop($stack); + + yield $index++ => $node; + + // Push all children onto the stack in reverse order + $child = $node->lastChild(); + while ($child !== null) { + if (! $this->blocksOnly || $child instanceof AbstractBlock) { + $stack[] = $child; + } + + $child = $child->previous(); + } + } + } +} diff --git a/vendor/league/commonmark/src/Node/NodeWalker.php b/vendor/league/commonmark/src/Node/NodeWalker.php new file mode 100644 index 00000000..6f922e83 --- /dev/null +++ b/vendor/league/commonmark/src/Node/NodeWalker.php @@ -0,0 +1,80 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Node; + +use League\CommonMark\Node\Block\AbstractBlock; + +final class NodeWalker +{ + /** @psalm-readonly */ + private Node $root; + + /** @psalm-readonly-allow-private-mutation */ + private ?Node $current = null; + + /** @psalm-readonly-allow-private-mutation */ + private bool $entering; + + public function __construct(Node $root) + { + $this->root = $root; + $this->current = $this->root; + $this->entering = true; + } + + /** + * Returns an event which contains node and entering flag + * (entering is true when we enter a Node from a parent or sibling, + * and false when we reenter it from child) + */ + public function next(): ?NodeWalkerEvent + { + $current = $this->current; + $entering = $this->entering; + if ($current === null) { + return null; + } + + if ($entering && ($current instanceof AbstractBlock || $current->hasChildren())) { + if ($current->firstChild()) { + $this->current = $current->firstChild(); + $this->entering = true; + } else { + $this->entering = false; + } + } elseif ($current === $this->root) { + $this->current = null; + } elseif ($current->next() === null) { + $this->current = $current->parent(); + $this->entering = false; + } else { + $this->current = $current->next(); + $this->entering = true; + } + + return new NodeWalkerEvent($current, $entering); + } + + /** + * Resets the iterator to resume at the specified node + */ + public function resumeAt(Node $node, bool $entering = true): void + { + $this->current = $node; + $this->entering = $entering; + } +} diff --git a/vendor/league/commonmark/src/Node/NodeWalkerEvent.php b/vendor/league/commonmark/src/Node/NodeWalkerEvent.php new file mode 100644 index 00000000..773ec3a9 --- /dev/null +++ b/vendor/league/commonmark/src/Node/NodeWalkerEvent.php @@ -0,0 +1,42 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Node; + +final class NodeWalkerEvent +{ + /** @psalm-readonly */ + private Node $node; + + /** @psalm-readonly */ + private bool $isEntering; + + public function __construct(Node $node, bool $isEntering = true) + { + $this->node = $node; + $this->isEntering = $isEntering; + } + + public function getNode(): Node + { + return $this->node; + } + + public function isEntering(): bool + { + return $this->isEntering; + } +} diff --git a/vendor/league/commonmark/src/Node/Query.php b/vendor/league/commonmark/src/Node/Query.php new file mode 100644 index 00000000..7e76fe35 --- /dev/null +++ b/vendor/league/commonmark/src/Node/Query.php @@ -0,0 +1,139 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Node; + +use League\CommonMark\Node\Query\AndExpr; +use League\CommonMark\Node\Query\OrExpr; + +final class Query +{ + /** @var callable(Node): bool $condition */ + private $condition; + + public function __construct() + { + $this->condition = new AndExpr(); + } + + public function where(callable ...$conditions): self + { + return $this->andWhere(...$conditions); + } + + public function andWhere(callable ...$conditions): self + { + if ($this->condition instanceof AndExpr) { + foreach ($conditions as $condition) { + $this->condition->add($condition); + } + } else { + $this->condition = new AndExpr($this->condition, ...$conditions); + } + + return $this; + } + + public function orWhere(callable ...$conditions): self + { + if ($this->condition instanceof OrExpr) { + foreach ($conditions as $condition) { + $this->condition->add($condition); + } + } else { + $this->condition = new OrExpr($this->condition, ...$conditions); + } + + return $this; + } + + public function findOne(Node $node): ?Node + { + foreach ($node->iterator() as $n) { + if (\call_user_func($this->condition, $n)) { + return $n; + } + } + + return null; + } + + /** + * @return iterable<Node> + */ + public function findAll(Node $node, ?int $limit = PHP_INT_MAX): iterable + { + $resultCount = 0; + + foreach ($node->iterator() as $n) { + if ($resultCount >= $limit) { + break; + } + + if (! \call_user_func($this->condition, $n)) { + continue; + } + + ++$resultCount; + + yield $n; + } + } + + /** + * @return callable(Node): bool + */ + public static function type(string $class): callable + { + return static fn (Node $node): bool => $node instanceof $class; + } + + /** + * @psalm-param ?callable(Node): bool $condition + * + * @return callable(Node): bool + */ + public static function hasChild(?callable $condition = null): callable + { + return static function (Node $node) use ($condition): bool { + foreach ($node->children() as $child) { + if ($condition === null || $condition($child)) { + return true; + } + } + + return false; + }; + } + + /** + * @psalm-param ?callable(Node): bool $condition + * + * @return callable(Node): bool + */ + public static function hasParent(?callable $condition = null): callable + { + return static function (Node $node) use ($condition): bool { + $parent = $node->parent(); + if ($parent === null) { + return false; + } + + if ($condition === null) { + return true; + } + + return $condition($parent); + }; + } +} diff --git a/vendor/league/commonmark/src/Node/Query/AndExpr.php b/vendor/league/commonmark/src/Node/Query/AndExpr.php new file mode 100644 index 00000000..d2cd6153 --- /dev/null +++ b/vendor/league/commonmark/src/Node/Query/AndExpr.php @@ -0,0 +1,55 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Node\Query; + +use League\CommonMark\Node\Node; + +/** + * @internal + */ +final class AndExpr implements ExpressionInterface +{ + /** + * @var callable[] + * @psalm-var list<callable(Node): bool> + */ + private array $conditions; + + /** + * @psalm-param callable(Node): bool $expressions + */ + public function __construct(callable ...$expressions) + { + $this->conditions = \array_values($expressions); + } + + /** + * @param callable(Node): bool $expression + */ + public function add(callable $expression): void + { + $this->conditions[] = $expression; + } + + public function __invoke(Node $node): bool + { + foreach ($this->conditions as $condition) { + if (! $condition($node)) { + return false; + } + } + + return true; + } +} diff --git a/vendor/league/commonmark/src/Node/Query/ExpressionInterface.php b/vendor/league/commonmark/src/Node/Query/ExpressionInterface.php new file mode 100644 index 00000000..2bbbc7fe --- /dev/null +++ b/vendor/league/commonmark/src/Node/Query/ExpressionInterface.php @@ -0,0 +1,21 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Node\Query; + +use League\CommonMark\Node\Node; + +interface ExpressionInterface +{ + public function __invoke(Node $node): bool; +} diff --git a/vendor/league/commonmark/src/Node/Query/OrExpr.php b/vendor/league/commonmark/src/Node/Query/OrExpr.php new file mode 100644 index 00000000..b0baad8c --- /dev/null +++ b/vendor/league/commonmark/src/Node/Query/OrExpr.php @@ -0,0 +1,55 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Node\Query; + +use League\CommonMark\Node\Node; + +/** + * @internal + */ +final class OrExpr implements ExpressionInterface +{ + /** + * @var callable[] + * @psalm-var list<callable(Node): bool> + */ + private array $conditions; + + /** + * @psalm-param callable(Node): bool $expressions + */ + public function __construct(callable ...$expressions) + { + $this->conditions = \array_values($expressions); + } + + /** + * @param callable(Node): bool $expression + */ + public function add(callable $expression): void + { + $this->conditions[] = $expression; + } + + public function __invoke(Node $node): bool + { + foreach ($this->conditions as $condition) { + if ($condition($node)) { + return true; + } + } + + return false; + } +} diff --git a/vendor/league/commonmark/src/Node/RawMarkupContainerInterface.php b/vendor/league/commonmark/src/Node/RawMarkupContainerInterface.php new file mode 100644 index 00000000..1545285d --- /dev/null +++ b/vendor/league/commonmark/src/Node/RawMarkupContainerInterface.php @@ -0,0 +1,21 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Node; + +/** + * Interface for a node which contains raw, unprocessed markup (like HTML) + */ +interface RawMarkupContainerInterface extends StringContainerInterface +{ +} diff --git a/vendor/league/commonmark/src/Node/StringContainerHelper.php b/vendor/league/commonmark/src/Node/StringContainerHelper.php new file mode 100644 index 00000000..8e1ec34d --- /dev/null +++ b/vendor/league/commonmark/src/Node/StringContainerHelper.php @@ -0,0 +1,54 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Node; + +final class StringContainerHelper +{ + /** + * Extract text literals from all descendant nodes + * + * @param Node $node Parent node + * @param array<string> $excludeTypes Optional list of node class types to exclude + * + * @return string Concatenated literals + */ + public static function getChildText(Node $node, array $excludeTypes = []): string + { + $text = ''; + + foreach ($node->iterator() as $child) { + if ($child instanceof StringContainerInterface && ! self::isOneOf($child, $excludeTypes)) { + $text .= $child->getLiteral(); + } + } + + return $text; + } + + /** + * @param string[] $classesOrInterfacesToCheck + * + * @psalm-pure + */ + private static function isOneOf(object $object, array $classesOrInterfacesToCheck): bool + { + foreach ($classesOrInterfacesToCheck as $type) { + if ($object instanceof $type) { + return true; + } + } + + return false; + } +} diff --git a/vendor/league/commonmark/src/Node/StringContainerInterface.php b/vendor/league/commonmark/src/Node/StringContainerInterface.php new file mode 100644 index 00000000..23564ae7 --- /dev/null +++ b/vendor/league/commonmark/src/Node/StringContainerInterface.php @@ -0,0 +1,27 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Node; + +/** + * Interface for a node which directly contains line(s) of text + */ +interface StringContainerInterface +{ + public function setLiteral(string $literal): void; + + public function getLiteral(): string; +} diff --git a/vendor/league/commonmark/src/Normalizer/SlugNormalizer.php b/vendor/league/commonmark/src/Normalizer/SlugNormalizer.php new file mode 100644 index 00000000..d41ea24c --- /dev/null +++ b/vendor/league/commonmark/src/Normalizer/SlugNormalizer.php @@ -0,0 +1,56 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Normalizer; + +use League\Config\ConfigurationAwareInterface; +use League\Config\ConfigurationInterface; + +/** + * Creates URL-friendly strings based on the given string input + */ +final class SlugNormalizer implements TextNormalizerInterface, ConfigurationAwareInterface +{ + /** @psalm-allow-private-mutation */ + private int $defaultMaxLength = 255; + + public function setConfiguration(ConfigurationInterface $configuration): void + { + $this->defaultMaxLength = $configuration->get('slug_normalizer/max_length'); + } + + /** + * {@inheritDoc} + * + * @psalm-immutable + */ + public function normalize(string $text, array $context = []): string + { + // Add any requested prefix + $slug = ($context['prefix'] ?? '') . $text; + // Trim whitespace + $slug = \trim($slug); + // Convert to lowercase + $slug = \mb_strtolower($slug, 'UTF-8'); + // Try replacing whitespace with a dash + $slug = \preg_replace('/\s+/u', '-', $slug) ?? $slug; + // Try removing characters other than letters, numbers, and marks. + $slug = \preg_replace('/[^\p{L}\p{Nd}\p{Nl}\p{M}-]+/u', '', $slug) ?? $slug; + // Trim to requested length if given + if ($length = $context['length'] ?? $this->defaultMaxLength) { + $slug = \mb_substr($slug, 0, $length, 'UTF-8'); + } + + return $slug; + } +} diff --git a/vendor/league/commonmark/src/Normalizer/TextNormalizer.php b/vendor/league/commonmark/src/Normalizer/TextNormalizer.php new file mode 100644 index 00000000..7860f1b9 --- /dev/null +++ b/vendor/league/commonmark/src/Normalizer/TextNormalizer.php @@ -0,0 +1,39 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Normalizer; + +/*** + * Normalize text input using the steps given by the CommonMark spec to normalize labels + * + * @see https://spec.commonmark.org/0.29/#matches + * + * @psalm-immutable + */ +final class TextNormalizer implements TextNormalizerInterface +{ + /** + * {@inheritDoc} + * + * @psalm-pure + */ + public function normalize(string $text, array $context = []): string + { + // Collapse internal whitespace to single space and remove + // leading/trailing whitespace + $text = \preg_replace('/[ \t\r\n]+/', ' ', \trim($text)); + \assert(\is_string($text)); + + return \mb_convert_case($text, \MB_CASE_FOLD, 'UTF-8'); + } +} diff --git a/vendor/league/commonmark/src/Normalizer/TextNormalizerInterface.php b/vendor/league/commonmark/src/Normalizer/TextNormalizerInterface.php new file mode 100644 index 00000000..f4762342 --- /dev/null +++ b/vendor/league/commonmark/src/Normalizer/TextNormalizerInterface.php @@ -0,0 +1,33 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Normalizer; + +/** + * Creates a normalized version of the given input text + */ +interface TextNormalizerInterface +{ + /** + * @param string $text The text to normalize + * @param array<string, mixed> $context Additional context about the text being normalized (optional) + * + * $context may include (but is not required to include) the following: + * - `prefix` - A string prefix to prepend to each normalized result + * - `length` - The requested maximum length + * - `node` - The node we're normalizing text for + * + * Implementations do not have to use or respect any information within that $context + */ + public function normalize(string $text, array $context = []): string; +} diff --git a/vendor/league/commonmark/src/Normalizer/UniqueSlugNormalizer.php b/vendor/league/commonmark/src/Normalizer/UniqueSlugNormalizer.php new file mode 100644 index 00000000..591f19fb --- /dev/null +++ b/vendor/league/commonmark/src/Normalizer/UniqueSlugNormalizer.php @@ -0,0 +1,56 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Normalizer; + +// phpcs:disable Squiz.Strings.DoubleQuoteUsage.ContainsVar +final class UniqueSlugNormalizer implements UniqueSlugNormalizerInterface +{ + private TextNormalizerInterface $innerNormalizer; + /** @var array<string, bool> */ + private array $alreadyUsed = []; + + public function __construct(TextNormalizerInterface $innerNormalizer) + { + $this->innerNormalizer = $innerNormalizer; + } + + public function clearHistory(): void + { + $this->alreadyUsed = []; + } + + /** + * {@inheritDoc} + * + * @psalm-allow-private-mutation + */ + public function normalize(string $text, array $context = []): string + { + $normalized = $this->innerNormalizer->normalize($text, $context); + + // If it's not unique, add an incremental number to the end until we get a unique version + if (\array_key_exists($normalized, $this->alreadyUsed)) { + $suffix = 0; + do { + ++$suffix; + } while (\array_key_exists("$normalized-$suffix", $this->alreadyUsed)); + + $normalized = "$normalized-$suffix"; + } + + $this->alreadyUsed[$normalized] = true; + + return $normalized; + } +} diff --git a/vendor/league/commonmark/src/Normalizer/UniqueSlugNormalizerInterface.php b/vendor/league/commonmark/src/Normalizer/UniqueSlugNormalizerInterface.php new file mode 100644 index 00000000..642edebe --- /dev/null +++ b/vendor/league/commonmark/src/Normalizer/UniqueSlugNormalizerInterface.php @@ -0,0 +1,28 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Normalizer; + +interface UniqueSlugNormalizerInterface extends TextNormalizerInterface +{ + public const DISABLED = false; + public const PER_ENVIRONMENT = 'environment'; + public const PER_DOCUMENT = 'document'; + + /** + * Called by the Environment whenever the configured scope changes + * + * Currently, this will only be called PER_DOCUMENT. + */ + public function clearHistory(): void; +} diff --git a/vendor/league/commonmark/src/Output/RenderedContent.php b/vendor/league/commonmark/src/Output/RenderedContent.php new file mode 100644 index 00000000..4bf612d0 --- /dev/null +++ b/vendor/league/commonmark/src/Output/RenderedContent.php @@ -0,0 +1,49 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Output; + +use League\CommonMark\Node\Block\Document; + +class RenderedContent implements RenderedContentInterface, \Stringable +{ + /** @psalm-readonly */ + private Document $document; + + /** @psalm-readonly */ + private string $content; + + public function __construct(Document $document, string $content) + { + $this->document = $document; + $this->content = $content; + } + + public function getDocument(): Document + { + return $this->document; + } + + public function getContent(): string + { + return $this->content; + } + + /** + * @psalm-mutation-free + */ + public function __toString(): string + { + return $this->content; + } +} diff --git a/vendor/league/commonmark/src/Output/RenderedContentInterface.php b/vendor/league/commonmark/src/Output/RenderedContentInterface.php new file mode 100644 index 00000000..2179b1bf --- /dev/null +++ b/vendor/league/commonmark/src/Output/RenderedContentInterface.php @@ -0,0 +1,29 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Output; + +use League\CommonMark\Node\Block\Document; + +interface RenderedContentInterface extends \Stringable +{ + /** + * @psalm-mutation-free + */ + public function getDocument(): Document; + + /** + * @psalm-mutation-free + */ + public function getContent(): string; +} diff --git a/vendor/league/commonmark/src/Parser/Block/AbstractBlockContinueParser.php b/vendor/league/commonmark/src/Parser/Block/AbstractBlockContinueParser.php new file mode 100644 index 00000000..889532ed --- /dev/null +++ b/vendor/league/commonmark/src/Parser/Block/AbstractBlockContinueParser.php @@ -0,0 +1,47 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Parser\Block; + +use League\CommonMark\Node\Block\AbstractBlock; + +/** + * Base class for a block parser + * + * Slightly more convenient to extend from vs. implementing the interface + */ +abstract class AbstractBlockContinueParser implements BlockContinueParserInterface +{ + public function isContainer(): bool + { + return false; + } + + public function canHaveLazyContinuationLines(): bool + { + return false; + } + + public function canContain(AbstractBlock $childBlock): bool + { + return false; + } + + public function addLine(string $line): void + { + } + + public function closeBlock(): void + { + } +} diff --git a/vendor/league/commonmark/src/Parser/Block/BlockContinue.php b/vendor/league/commonmark/src/Parser/Block/BlockContinue.php new file mode 100644 index 00000000..4b5f37d4 --- /dev/null +++ b/vendor/league/commonmark/src/Parser/Block/BlockContinue.php @@ -0,0 +1,73 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Parser\Block; + +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Parser\CursorState; + +/** + * Result object for continuing parsing of a block; see static methods for constructors. + * + * @psalm-immutable + */ +final class BlockContinue +{ + /** @psalm-readonly */ + private ?CursorState $cursorState = null; + + /** @psalm-readonly */ + private bool $finalize; + + private function __construct(?CursorState $cursorState = null, bool $finalize = false) + { + $this->cursorState = $cursorState; + $this->finalize = $finalize; + } + + public function getCursorState(): ?CursorState + { + return $this->cursorState; + } + + public function isFinalize(): bool + { + return $this->finalize; + } + + /** + * Signal that we cannot continue here + * + * @return null + */ + public static function none(): ?self + { + return null; + } + + /** + * Signal that we're continuing at the given position + */ + public static function at(Cursor $cursor): self + { + return new self($cursor->saveState(), false); + } + + /** + * Signal that we want to finalize and close the block + */ + public static function finished(): self + { + return new self(null, true); + } +} diff --git a/vendor/league/commonmark/src/Parser/Block/BlockContinueParserInterface.php b/vendor/league/commonmark/src/Parser/Block/BlockContinueParserInterface.php new file mode 100644 index 00000000..b6e54724 --- /dev/null +++ b/vendor/league/commonmark/src/Parser/Block/BlockContinueParserInterface.php @@ -0,0 +1,64 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Parser\Block; + +use League\CommonMark\Node\Block\AbstractBlock; +use League\CommonMark\Parser\Cursor; + +/** + * Interface for a block continuation parser + * + * A block continue parser can only handle a single block instance. The current block being parsed is stored within this parser and + * can be returned once parsing has completed. If you need to parse multiple block continuations, instantiate a new parser for each one. + */ +interface BlockContinueParserInterface +{ + /** + * Return the current block being parsed by this parser + */ + public function getBlock(): AbstractBlock; + + /** + * Return whether we are parsing a container block + */ + public function isContainer(): bool; + + /** + * Return whether we are interested in possibly lazily parsing any subsequent lines + */ + public function canHaveLazyContinuationLines(): bool; + + /** + * Determine whether the current block being parsed can contain the given child block + */ + public function canContain(AbstractBlock $childBlock): bool; + + /** + * Attempt to parse the given line + */ + public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue; + + /** + * Add the given line of text to the current block + */ + public function addLine(string $line): void; + + /** + * Close and finalize the current block + */ + public function closeBlock(): void; +} diff --git a/vendor/league/commonmark/src/Parser/Block/BlockContinueParserWithInlinesInterface.php b/vendor/league/commonmark/src/Parser/Block/BlockContinueParserWithInlinesInterface.php new file mode 100644 index 00000000..6f826c9a --- /dev/null +++ b/vendor/league/commonmark/src/Parser/Block/BlockContinueParserWithInlinesInterface.php @@ -0,0 +1,24 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Parser\Block; + +use League\CommonMark\Parser\InlineParserEngineInterface; + +interface BlockContinueParserWithInlinesInterface extends BlockContinueParserInterface +{ + /** + * Parse any inlines inside of the current block + */ + public function parseInlines(InlineParserEngineInterface $inlineParser): void; +} diff --git a/vendor/league/commonmark/src/Parser/Block/BlockStart.php b/vendor/league/commonmark/src/Parser/Block/BlockStart.php new file mode 100644 index 00000000..55766228 --- /dev/null +++ b/vendor/league/commonmark/src/Parser/Block/BlockStart.php @@ -0,0 +1,124 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Parser\Block; + +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Parser\CursorState; + +/** + * Result object for starting parsing of a block; see static methods for constructors + */ +final class BlockStart +{ + /** + * @var BlockContinueParserInterface[] + * + * @psalm-readonly + */ + private array $blockParsers; + + /** @psalm-readonly-allow-private-mutation */ + private ?CursorState $cursorState = null; + + /** @psalm-readonly-allow-private-mutation */ + private bool $replaceActiveBlockParser = false; + + private bool $isAborting = false; + + private function __construct(BlockContinueParserInterface ...$blockParsers) + { + $this->blockParsers = $blockParsers; + } + + /** + * @return BlockContinueParserInterface[] + */ + public function getBlockParsers(): iterable + { + return $this->blockParsers; + } + + public function getCursorState(): ?CursorState + { + return $this->cursorState; + } + + public function isReplaceActiveBlockParser(): bool + { + return $this->replaceActiveBlockParser; + } + + /** + * @internal + */ + public function isAborting(): bool + { + return $this->isAborting; + } + + /** + * Signal that we want to parse at the given cursor position + * + * @return $this + */ + public function at(Cursor $cursor): self + { + $this->cursorState = $cursor->saveState(); + + return $this; + } + + /** + * Signal that we want to replace the active block parser with this one + * + * @return $this + */ + public function replaceActiveBlockParser(): self + { + $this->replaceActiveBlockParser = true; + + return $this; + } + + /** + * Signal that we cannot parse whatever is here + * + * @return null + */ + public static function none(): ?self + { + return null; + } + + /** + * Signal that we'd like to register the given parser(s) so they can parse the current block + */ + public static function of(BlockContinueParserInterface ...$blockParsers): self + { + return new self(...$blockParsers); + } + + /** + * Signal that the block parsing process should be aborted (no other block starts should be checked) + * + * @internal + */ + public static function abort(): self + { + $ret = new self(); + $ret->isAborting = true; + + return $ret; + } +} diff --git a/vendor/league/commonmark/src/Parser/Block/BlockStartParserInterface.php b/vendor/league/commonmark/src/Parser/Block/BlockStartParserInterface.php new file mode 100644 index 00000000..90ed7814 --- /dev/null +++ b/vendor/league/commonmark/src/Parser/Block/BlockStartParserInterface.php @@ -0,0 +1,33 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Parser\Block; + +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Parser\MarkdownParserStateInterface; + +/** + * Interface for a block parser which identifies block starts. + */ +interface BlockStartParserInterface +{ + /** + * Check whether we should handle the block at the current position + * + * @param Cursor $cursor A cloned copy of the cursor at the current parsing location + * @param MarkdownParserStateInterface $parserState Additional information about the state of the Markdown parser + * + * @return BlockStart|null The BlockStart that has been identified, or null if the block doesn't match here + */ + public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart; +} diff --git a/vendor/league/commonmark/src/Parser/Block/DocumentBlockParser.php b/vendor/league/commonmark/src/Parser/Block/DocumentBlockParser.php new file mode 100644 index 00000000..c03c24ef --- /dev/null +++ b/vendor/league/commonmark/src/Parser/Block/DocumentBlockParser.php @@ -0,0 +1,80 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Parser\Block; + +use League\CommonMark\Node\Block\AbstractBlock; +use League\CommonMark\Node\Block\Document; +use League\CommonMark\Node\Block\Paragraph; +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Reference\ReferenceMapInterface; + +/** + * Parser implementation which ensures everything is added to the root-level Document + */ +final class DocumentBlockParser extends AbstractBlockContinueParser +{ + /** @psalm-readonly */ + private Document $document; + + public function __construct(ReferenceMapInterface $referenceMap) + { + $this->document = new Document($referenceMap); + } + + public function getBlock(): Document + { + return $this->document; + } + + public function isContainer(): bool + { + return true; + } + + public function canContain(AbstractBlock $childBlock): bool + { + return true; + } + + public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue + { + return BlockContinue::at($cursor); + } + + public function closeBlock(): void + { + $this->removeLinkReferenceDefinitions(); + } + + private function removeLinkReferenceDefinitions(): void + { + $emptyNodes = []; + + $walker = $this->document->walker(); + while ($event = $walker->next()) { + $node = $event->getNode(); + // TODO for v3: It would be great if we could find an alternate way to identify such paragraphs. + // Unfortunately, we can't simply check for empty paragraphs here because inlines haven't been processed yet, + // meaning all paragraphs will appear blank here, and we don't have a way to check the status of the reference parser + // which is attached to the (already-closed) paragraph parser. + if ($event->isEntering() && $node instanceof Paragraph && $node->onlyContainsLinkReferenceDefinitions) { + $emptyNodes[] = $node; + } + } + + foreach ($emptyNodes as $node) { + $node->detach(); + } + } +} diff --git a/vendor/league/commonmark/src/Parser/Block/ParagraphParser.php b/vendor/league/commonmark/src/Parser/Block/ParagraphParser.php new file mode 100644 index 00000000..f9312be9 --- /dev/null +++ b/vendor/league/commonmark/src/Parser/Block/ParagraphParser.php @@ -0,0 +1,85 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Parser\Block; + +use League\CommonMark\Node\Block\Paragraph; +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Parser\InlineParserEngineInterface; +use League\CommonMark\Reference\ReferenceInterface; +use League\CommonMark\Reference\ReferenceParser; + +final class ParagraphParser extends AbstractBlockContinueParser implements BlockContinueParserWithInlinesInterface +{ + /** @psalm-readonly */ + private Paragraph $block; + + /** @psalm-readonly */ + private ReferenceParser $referenceParser; + + public function __construct() + { + $this->block = new Paragraph(); + $this->referenceParser = new ReferenceParser(); + } + + public function canHaveLazyContinuationLines(): bool + { + return true; + } + + public function getBlock(): Paragraph + { + return $this->block; + } + + public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue + { + if ($cursor->isBlank()) { + return BlockContinue::none(); + } + + return BlockContinue::at($cursor); + } + + public function addLine(string $line): void + { + $this->referenceParser->parse($line); + } + + public function closeBlock(): void + { + $this->block->onlyContainsLinkReferenceDefinitions = $this->referenceParser->hasReferences() && $this->referenceParser->getParagraphContent() === ''; + } + + public function parseInlines(InlineParserEngineInterface $inlineParser): void + { + $content = $this->getContentString(); + if ($content !== '') { + $inlineParser->parse($content, $this->block); + } + } + + public function getContentString(): string + { + return $this->referenceParser->getParagraphContent(); + } + + /** + * @return ReferenceInterface[] + */ + public function getReferences(): iterable + { + return $this->referenceParser->getReferences(); + } +} diff --git a/vendor/league/commonmark/src/Parser/Block/SkipLinesStartingWithLettersParser.php b/vendor/league/commonmark/src/Parser/Block/SkipLinesStartingWithLettersParser.php new file mode 100644 index 00000000..95d8bd2f --- /dev/null +++ b/vendor/league/commonmark/src/Parser/Block/SkipLinesStartingWithLettersParser.php @@ -0,0 +1,45 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Parser\Block; + +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Parser\MarkdownParserStateInterface; +use League\CommonMark\Util\RegexHelper; + +/** + * @internal + * + * This "parser" is actually a performance optimization. + * + * Most lines in a typical Markdown document probably won't match a block start. This is especially true for lines starting + * with letters - nothing in the core CommonMark spec or our supported extensions will match those lines as blocks. Therefore, + * if we can identify those lines and skip block start parsing, we can optimize performance by ~10%. + * + * Previously this optimization was hard-coded in the MarkdownParser but did not allow users to override this behavior. + * By implementing this optimization as a block parser instead, users wanting custom blocks starting with letters + * can instead register their block parser with a higher priority to ensure their parser is always called first. + */ +final class SkipLinesStartingWithLettersParser implements BlockStartParserInterface +{ + public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart + { + if (! $cursor->isIndented() && RegexHelper::isLetter($cursor->getNextNonSpaceCharacter())) { + $cursor->advanceToNextNonSpaceOrTab(); + + return BlockStart::abort(); + } + + return BlockStart::none(); + } +} diff --git a/vendor/league/commonmark/src/Parser/Cursor.php b/vendor/league/commonmark/src/Parser/Cursor.php new file mode 100644 index 00000000..d6d76b3a --- /dev/null +++ b/vendor/league/commonmark/src/Parser/Cursor.php @@ -0,0 +1,493 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Parser; + +use League\CommonMark\Exception\UnexpectedEncodingException; + +class Cursor +{ + public const INDENT_LEVEL = 4; + + /** @psalm-readonly */ + private string $line; + + /** @psalm-readonly */ + private int $length; + + /** + * @var int + * + * It's possible for this to be 1 char past the end, meaning we've parsed all chars and have + * reached the end. In this state, any character-returning method MUST return null. + */ + private int $currentPosition = 0; + + private int $column = 0; + + private int $indent = 0; + + private int $previousPosition = 0; + + private ?int $nextNonSpaceCache = null; + + private bool $partiallyConsumedTab = false; + + /** + * @var int|false + * + * @psalm-readonly + */ + private $lastTabPosition; + + /** @psalm-readonly */ + private bool $isMultibyte; + + /** @var array<int, string> */ + private array $charCache = []; + + /** + * @param string $line The line being parsed (ASCII or UTF-8) + */ + public function __construct(string $line) + { + if (! \mb_check_encoding($line, 'UTF-8')) { + throw new UnexpectedEncodingException('Unexpected encoding - UTF-8 or ASCII was expected'); + } + + $this->line = $line; + $this->length = \mb_strlen($line, 'UTF-8') ?: 0; + $this->isMultibyte = $this->length !== \strlen($line); + $this->lastTabPosition = $this->isMultibyte ? \mb_strrpos($line, "\t", 0, 'UTF-8') : \strrpos($line, "\t"); + } + + /** + * Returns the position of the next character which is not a space (or tab) + */ + public function getNextNonSpacePosition(): int + { + if ($this->nextNonSpaceCache !== null) { + return $this->nextNonSpaceCache; + } + + if ($this->currentPosition >= $this->length) { + return $this->length; + } + + $cols = $this->column; + + for ($i = $this->currentPosition; $i < $this->length; $i++) { + // This if-else was copied out of getCharacter() for performance reasons + if ($this->isMultibyte) { + $c = $this->charCache[$i] ??= \mb_substr($this->line, $i, 1, 'UTF-8'); + } else { + $c = $this->line[$i]; + } + + if ($c === ' ') { + $cols++; + } elseif ($c === "\t") { + $cols += 4 - ($cols % 4); + } else { + break; + } + } + + $this->indent = $cols - $this->column; + + return $this->nextNonSpaceCache = $i; + } + + /** + * Returns the next character which isn't a space (or tab) + */ + public function getNextNonSpaceCharacter(): ?string + { + $index = $this->getNextNonSpacePosition(); + if ($index >= $this->length) { + return null; + } + + if ($this->isMultibyte) { + return $this->charCache[$index] ??= \mb_substr($this->line, $index, 1, 'UTF-8'); + } + + return $this->line[$index]; + } + + /** + * Calculates the current indent (number of spaces after current position) + */ + public function getIndent(): int + { + if ($this->nextNonSpaceCache === null) { + $this->getNextNonSpacePosition(); + } + + return $this->indent; + } + + /** + * Whether the cursor is indented to INDENT_LEVEL + */ + public function isIndented(): bool + { + if ($this->nextNonSpaceCache === null) { + $this->getNextNonSpacePosition(); + } + + return $this->indent >= self::INDENT_LEVEL; + } + + public function getCharacter(?int $index = null): ?string + { + if ($index === null) { + $index = $this->currentPosition; + } + + // Index out-of-bounds, or we're at the end + if ($index < 0 || $index >= $this->length) { + return null; + } + + if ($this->isMultibyte) { + return $this->charCache[$index] ??= \mb_substr($this->line, $index, 1, 'UTF-8'); + } + + return $this->line[$index]; + } + + /** + * Slightly-optimized version of getCurrent(null) + */ + public function getCurrentCharacter(): ?string + { + if ($this->currentPosition >= $this->length) { + return null; + } + + if ($this->isMultibyte) { + return $this->charCache[$this->currentPosition] ??= \mb_substr($this->line, $this->currentPosition, 1, 'UTF-8'); + } + + return $this->line[$this->currentPosition]; + } + + /** + * Returns the next character (or null, if none) without advancing forwards + */ + public function peek(int $offset = 1): ?string + { + return $this->getCharacter($this->currentPosition + $offset); + } + + /** + * Whether the remainder is blank + */ + public function isBlank(): bool + { + return $this->nextNonSpaceCache === $this->length || $this->getNextNonSpacePosition() === $this->length; + } + + /** + * Move the cursor forwards + */ + public function advance(): void + { + $this->advanceBy(1); + } + + /** + * Move the cursor forwards + * + * @param int $characters Number of characters to advance by + * @param bool $advanceByColumns Whether to advance by columns instead of spaces + */ + public function advanceBy(int $characters, bool $advanceByColumns = false): void + { + $this->previousPosition = $this->currentPosition; + $this->nextNonSpaceCache = null; + + if ($this->currentPosition >= $this->length || $characters === 0) { + return; + } + + // Optimization to avoid tab handling logic if we have no tabs + if ($this->lastTabPosition === false || $this->currentPosition > $this->lastTabPosition) { + $length = \min($characters, $this->length - $this->currentPosition); + $this->partiallyConsumedTab = false; + $this->currentPosition += $length; + $this->column += $length; + + return; + } + + $nextFewChars = $this->isMultibyte ? + \mb_substr($this->line, $this->currentPosition, $characters, 'UTF-8') : + \substr($this->line, $this->currentPosition, $characters); + + if ($characters === 1) { + $asArray = [$nextFewChars]; + } elseif ($this->isMultibyte) { + /** @var string[] $asArray */ + $asArray = \mb_str_split($nextFewChars, 1, 'UTF-8'); + } else { + $asArray = \str_split($nextFewChars); + } + + foreach ($asArray as $c) { + if ($c === "\t") { + $charsToTab = 4 - ($this->column % 4); + if ($advanceByColumns) { + $this->partiallyConsumedTab = $charsToTab > $characters; + $charsToAdvance = $charsToTab > $characters ? $characters : $charsToTab; + $this->column += $charsToAdvance; + $this->currentPosition += $this->partiallyConsumedTab ? 0 : 1; + $characters -= $charsToAdvance; + } else { + $this->partiallyConsumedTab = false; + $this->column += $charsToTab; + $this->currentPosition++; + $characters--; + } + } else { + $this->partiallyConsumedTab = false; + $this->currentPosition++; + $this->column++; + $characters--; + } + + if ($characters <= 0) { + break; + } + } + } + + /** + * Advances the cursor by a single space or tab, if present + */ + public function advanceBySpaceOrTab(): bool + { + $character = $this->getCurrentCharacter(); + + if ($character === ' ' || $character === "\t") { + $this->advanceBy(1, true); + + return true; + } + + return false; + } + + /** + * Parse zero or more space/tab characters + * + * @return int Number of positions moved + */ + public function advanceToNextNonSpaceOrTab(): int + { + $newPosition = $this->nextNonSpaceCache ?? $this->getNextNonSpacePosition(); + if ($newPosition === $this->currentPosition) { + return 0; + } + + $this->advanceBy($newPosition - $this->currentPosition); + $this->partiallyConsumedTab = false; + + // We've just advanced to where that non-space is, + // so any subsequent calls to find the next one will + // always return the current position. + $this->nextNonSpaceCache = $this->currentPosition; + $this->indent = 0; + + return $this->currentPosition - $this->previousPosition; + } + + /** + * Parse zero or more space characters, including at most one newline. + * + * Tab characters are not parsed with this function. + * + * @return int Number of positions moved + */ + public function advanceToNextNonSpaceOrNewline(): int + { + $remainder = $this->getRemainder(); + + // Optimization: Avoid the regex if we know there are no spaces or newlines + if ($remainder === '' || ($remainder[0] !== ' ' && $remainder[0] !== "\n")) { + $this->previousPosition = $this->currentPosition; + + return 0; + } + + $matches = []; + \preg_match('/^ *(?:\n *)?/', $remainder, $matches, \PREG_OFFSET_CAPTURE); + + // [0][0] contains the matched text + // [0][1] contains the index of that match + $increment = $matches[0][1] + \strlen($matches[0][0]); + + $this->advanceBy($increment); + + return $this->currentPosition - $this->previousPosition; + } + + /** + * Move the position to the very end of the line + * + * @return int The number of characters moved + */ + public function advanceToEnd(): int + { + $this->previousPosition = $this->currentPosition; + $this->nextNonSpaceCache = null; + + $this->currentPosition = $this->length; + + return $this->currentPosition - $this->previousPosition; + } + + public function getRemainder(): string + { + if ($this->currentPosition >= $this->length) { + return ''; + } + + $prefix = ''; + $position = $this->currentPosition; + if ($this->partiallyConsumedTab) { + $position++; + $charsToTab = 4 - ($this->column % 4); + $prefix = \str_repeat(' ', $charsToTab); + } + + $subString = $this->isMultibyte ? + \mb_substr($this->line, $position, null, 'UTF-8') : + \substr($this->line, $position); + + return $prefix . $subString; + } + + public function getLine(): string + { + return $this->line; + } + + public function isAtEnd(): bool + { + return $this->currentPosition >= $this->length; + } + + /** + * Try to match a regular expression + * + * Returns the matching text and advances to the end of that match + * + * @psalm-param non-empty-string $regex + */ + public function match(string $regex): ?string + { + $subject = $this->getRemainder(); + + if (! \preg_match($regex, $subject, $matches, \PREG_OFFSET_CAPTURE)) { + return null; + } + + // $matches[0][0] contains the matched text + // $matches[0][1] contains the index of that match + + if ($this->isMultibyte) { + // PREG_OFFSET_CAPTURE always returns the byte offset, not the char offset, which is annoying + $offset = \mb_strlen(\substr($subject, 0, $matches[0][1]), 'UTF-8'); + $matchLength = \mb_strlen($matches[0][0], 'UTF-8'); + } else { + $offset = $matches[0][1]; + $matchLength = \strlen($matches[0][0]); + } + + // [0][0] contains the matched text + // [0][1] contains the index of that match + $this->advanceBy($offset + $matchLength); + + return $matches[0][0]; + } + + /** + * Encapsulates the current state of this cursor in case you need to rollback later. + * + * WARNING: Do not parse or use the return value for ANYTHING except for + * passing it back into restoreState(), as the number of values and their + * contents may change in any future release without warning. + */ + public function saveState(): CursorState + { + return new CursorState([ + $this->currentPosition, + $this->previousPosition, + $this->nextNonSpaceCache, + $this->indent, + $this->column, + $this->partiallyConsumedTab, + ]); + } + + /** + * Restore the cursor to a previous state. + * + * Pass in the value previously obtained by calling saveState(). + */ + public function restoreState(CursorState $state): void + { + [ + $this->currentPosition, + $this->previousPosition, + $this->nextNonSpaceCache, + $this->indent, + $this->column, + $this->partiallyConsumedTab, + ] = $state->toArray(); + } + + public function getPosition(): int + { + return $this->currentPosition; + } + + public function getPreviousText(): string + { + if ($this->isMultibyte) { + return \mb_substr($this->line, $this->previousPosition, $this->currentPosition - $this->previousPosition, 'UTF-8'); + } + + return \substr($this->line, $this->previousPosition, $this->currentPosition - $this->previousPosition); + } + + public function getSubstring(int $start, ?int $length = null): string + { + if ($this->isMultibyte) { + return \mb_substr($this->line, $start, $length, 'UTF-8'); + } + + if ($length !== null) { + return \substr($this->line, $start, $length); + } + + return \substr($this->line, $start); + } + + public function getColumn(): int + { + return $this->column; + } +} diff --git a/vendor/league/commonmark/src/Parser/CursorState.php b/vendor/league/commonmark/src/Parser/CursorState.php new file mode 100644 index 00000000..4a6c2d96 --- /dev/null +++ b/vendor/league/commonmark/src/Parser/CursorState.php @@ -0,0 +1,56 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Parser; + +/** + * Encapsulates the current state of a cursor in case you need to rollback later. + * + * WARNING: Do not attempt to use this class for ANYTHING except for + * type hinting and passing this object back into restoreState(). + * The constructor, methods, and inner contents may change in any + * future release without warning! + * + * @internal + * + * @psalm-immutable + */ +final class CursorState +{ + /** + * @var array<int, mixed> + * + * @psalm-readonly + */ + private array $state; + + /** + * @internal + * + * @param array<int, mixed> $state + */ + public function __construct(array $state) + { + $this->state = $state; + } + + /** + * @internal + * + * @return array<int, mixed> + */ + public function toArray(): array + { + return $this->state; + } +} diff --git a/vendor/league/commonmark/src/Parser/Inline/InlineParserInterface.php b/vendor/league/commonmark/src/Parser/Inline/InlineParserInterface.php new file mode 100644 index 00000000..fd13435b --- /dev/null +++ b/vendor/league/commonmark/src/Parser/Inline/InlineParserInterface.php @@ -0,0 +1,23 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Parser\Inline; + +use League\CommonMark\Parser\InlineParserContext; + +interface InlineParserInterface +{ + public function getMatchDefinition(): InlineParserMatch; + + public function parse(InlineParserContext $inlineContext): bool; +} diff --git a/vendor/league/commonmark/src/Parser/Inline/InlineParserMatch.php b/vendor/league/commonmark/src/Parser/Inline/InlineParserMatch.php new file mode 100644 index 00000000..e433ed27 --- /dev/null +++ b/vendor/league/commonmark/src/Parser/Inline/InlineParserMatch.php @@ -0,0 +1,87 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Parser\Inline; + +use League\CommonMark\Exception\InvalidArgumentException; + +final class InlineParserMatch +{ + private string $regex; + + private bool $caseSensitive; + + private function __construct(string $regex, bool $caseSensitive = false) + { + $this->regex = $regex; + $this->caseSensitive = $caseSensitive; + } + + public function caseSensitive(): self + { + $this->caseSensitive = true; + + return $this; + } + + /** + * @internal + * + * @psalm-return non-empty-string + */ + public function getRegex(): string + { + return '/' . $this->regex . '/' . ($this->caseSensitive ? '' : 'i'); + } + + /** + * Match the given string (case-insensitive) + */ + public static function string(string $str): self + { + return new self(\preg_quote($str, '/')); + } + + /** + * Match any of the given strings (case-insensitive) + */ + public static function oneOf(string ...$str): self + { + return new self(\implode('|', \array_map(static fn (string $str): string => \preg_quote($str, '/'), $str))); + } + + /** + * Match a partial regular expression without starting/ending delimiters, anchors, or flags + */ + public static function regex(string $regex): self + { + return new self($regex); + } + + public static function join(self ...$definitions): self + { + $regex = ''; + $caseSensitive = null; + foreach ($definitions as $definition) { + $regex .= '(' . $definition->regex . ')'; + + if ($caseSensitive === null) { + $caseSensitive = $definition->caseSensitive; + } elseif ($caseSensitive !== $definition->caseSensitive) { + throw new InvalidArgumentException('Case-sensitive and case-insensitive definitions cannot be combined'); + } + } + + return new self($regex, $caseSensitive ?? false); + } +} diff --git a/vendor/league/commonmark/src/Parser/Inline/NewlineParser.php b/vendor/league/commonmark/src/Parser/Inline/NewlineParser.php new file mode 100644 index 00000000..eb10d917 --- /dev/null +++ b/vendor/league/commonmark/src/Parser/Inline/NewlineParser.php @@ -0,0 +1,53 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Parser\Inline; + +use League\CommonMark\Node\Inline\Newline; +use League\CommonMark\Node\Inline\Text; +use League\CommonMark\Parser\InlineParserContext; + +final class NewlineParser implements InlineParserInterface +{ + public function getMatchDefinition(): InlineParserMatch + { + return InlineParserMatch::regex('\\n'); + } + + public function parse(InlineParserContext $inlineContext): bool + { + $inlineContext->getCursor()->advanceBy(1); + + // Check previous inline for trailing spaces + $spaces = 0; + $lastInline = $inlineContext->getContainer()->lastChild(); + if ($lastInline instanceof Text) { + $trimmed = \rtrim($lastInline->getLiteral(), ' '); + $spaces = \strlen($lastInline->getLiteral()) - \strlen($trimmed); + if ($spaces) { + $lastInline->setLiteral($trimmed); + } + } + + if ($spaces >= 2) { + $inlineContext->getContainer()->appendChild(new Newline(Newline::HARDBREAK)); + } else { + $inlineContext->getContainer()->appendChild(new Newline(Newline::SOFTBREAK)); + } + + return true; + } +} diff --git a/vendor/league/commonmark/src/Parser/InlineParserContext.php b/vendor/league/commonmark/src/Parser/InlineParserContext.php new file mode 100644 index 00000000..796f2f38 --- /dev/null +++ b/vendor/league/commonmark/src/Parser/InlineParserContext.php @@ -0,0 +1,120 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Parser; + +use League\CommonMark\Delimiter\DelimiterStack; +use League\CommonMark\Node\Block\AbstractBlock; +use League\CommonMark\Reference\ReferenceMapInterface; + +final class InlineParserContext +{ + /** @psalm-readonly */ + private AbstractBlock $container; + + /** @psalm-readonly */ + private ReferenceMapInterface $referenceMap; + + /** @psalm-readonly */ + private Cursor $cursor; + + /** @psalm-readonly */ + private DelimiterStack $delimiterStack; + + /** + * @var string[] + * @psalm-var non-empty-array<string> + * + * @psalm-readonly-allow-private-mutation + */ + private array $matches; + + public function __construct(Cursor $contents, AbstractBlock $container, ReferenceMapInterface $referenceMap) + { + $this->referenceMap = $referenceMap; + $this->container = $container; + $this->cursor = $contents; + $this->delimiterStack = new DelimiterStack(); + } + + public function getContainer(): AbstractBlock + { + return $this->container; + } + + public function getReferenceMap(): ReferenceMapInterface + { + return $this->referenceMap; + } + + public function getCursor(): Cursor + { + return $this->cursor; + } + + public function getDelimiterStack(): DelimiterStack + { + return $this->delimiterStack; + } + + /** + * @return string The full text that matched the InlineParserMatch definition + */ + public function getFullMatch(): string + { + return $this->matches[0]; + } + + /** + * @return int The length of the full match (in characters, not bytes) + */ + public function getFullMatchLength(): int + { + return \mb_strlen($this->matches[0], 'UTF-8'); + } + + /** + * @return string[] Similar to preg_match(), index 0 will contain the full match, and any other array elements will be captured sub-matches + * + * @psalm-return non-empty-array<string> + */ + public function getMatches(): array + { + return $this->matches; + } + + /** + * @return string[] + */ + public function getSubMatches(): array + { + return \array_slice($this->matches, 1); + } + + /** + * @param string[] $matches + * + * @psalm-param non-empty-array<string> $matches + */ + public function withMatches(array $matches): InlineParserContext + { + $ctx = clone $this; + + $ctx->matches = $matches; + + return $ctx; + } +} diff --git a/vendor/league/commonmark/src/Parser/InlineParserEngine.php b/vendor/league/commonmark/src/Parser/InlineParserEngine.php new file mode 100644 index 00000000..b91a63f7 --- /dev/null +++ b/vendor/league/commonmark/src/Parser/InlineParserEngine.php @@ -0,0 +1,177 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Parser; + +use League\CommonMark\Environment\EnvironmentInterface; +use League\CommonMark\Node\Block\AbstractBlock; +use League\CommonMark\Node\Inline\AdjacentTextMerger; +use League\CommonMark\Node\Inline\Text; +use League\CommonMark\Parser\Inline\InlineParserInterface; +use League\CommonMark\Reference\ReferenceMapInterface; + +/** + * @internal + */ +final class InlineParserEngine implements InlineParserEngineInterface +{ + /** @psalm-readonly */ + private EnvironmentInterface $environment; + + /** @psalm-readonly */ + private ReferenceMapInterface $referenceMap; + + /** + * @var array<int, InlineParserInterface|string|bool> + * @psalm-var list<array{0: InlineParserInterface, 1: non-empty-string, 2: bool}> + * @phpstan-var array<int, array{0: InlineParserInterface, 1: non-empty-string, 2: bool}> + */ + private array $parsers = []; + + public function __construct(EnvironmentInterface $environment, ReferenceMapInterface $referenceMap) + { + $this->environment = $environment; + $this->referenceMap = $referenceMap; + + foreach ($environment->getInlineParsers() as $parser) { + \assert($parser instanceof InlineParserInterface); + $regex = $parser->getMatchDefinition()->getRegex(); + + $this->parsers[] = [$parser, $regex, \strlen($regex) !== \mb_strlen($regex, 'UTF-8')]; + } + } + + public function parse(string $contents, AbstractBlock $block): void + { + $contents = \trim($contents); + $cursor = new Cursor($contents); + + $inlineParserContext = new InlineParserContext($cursor, $block, $this->referenceMap); + + // Have all parsers look at the line to determine what they might want to parse and what positions they exist at + foreach ($this->matchParsers($contents) as $matchPosition => $parsers) { + $currentPosition = $cursor->getPosition(); + // We've already gone past this point + if ($currentPosition > $matchPosition) { + continue; + } + + // We've skipped over some uninteresting text that should be added as a plain text node + if ($currentPosition < $matchPosition) { + $cursor->advanceBy($matchPosition - $currentPosition); + $this->addPlainText($cursor->getPreviousText(), $block); + } + + // We're now at a potential start - see which of the current parsers can handle it + $parsed = false; + foreach ($parsers as [$parser, $matches]) { + \assert($parser instanceof InlineParserInterface); + if ($parser->parse($inlineParserContext->withMatches($matches))) { + // A parser has successfully handled the text at the given position; don't consider any others at this position + $parsed = true; + break; + } + } + + if ($parsed) { + continue; + } + + // Despite potentially being interested, nothing actually parsed text here, so add the current character and continue onwards + $this->addPlainText((string) $cursor->getCurrentCharacter(), $block); + $cursor->advance(); + } + + // Add any remaining text that wasn't parsed + if (! $cursor->isAtEnd()) { + $this->addPlainText($cursor->getRemainder(), $block); + } + + // Process any delimiters that were found + $delimiterStack = $inlineParserContext->getDelimiterStack(); + $delimiterStack->processDelimiters(null, $this->environment->getDelimiterProcessors()); + $delimiterStack->removeAll(); + + // Combine adjacent text notes into one + AdjacentTextMerger::mergeChildNodes($block); + } + + private function addPlainText(string $text, AbstractBlock $container): void + { + $lastInline = $container->lastChild(); + if ($lastInline instanceof Text && ! $lastInline->data->has('delim')) { + $lastInline->append($text); + } else { + $container->appendChild(new Text($text)); + } + } + + /** + * Given the current line, ask all the parsers which parts of the text they would be interested in parsing. + * + * The resulting array provides a list of character positions, which parsers are interested in trying to parse + * the text at those points, and (for convenience/optimization) what the matching text happened to be. + * + * @return array<array<int, InlineParserInterface|string>> + * + * @psalm-return array<int, list<array{0: InlineParserInterface, 1: non-empty-array<string>}>> + * + * @phpstan-return array<int, array<int, array{0: InlineParserInterface, 1: non-empty-array<string>}>> + */ + private function matchParsers(string $contents): array + { + $contents = \trim($contents); + $isMultibyte = ! \mb_check_encoding($contents, 'ASCII'); + + $ret = []; + + foreach ($this->parsers as [$parser, $regex, $isRegexMultibyte]) { + if ($isMultibyte || $isRegexMultibyte) { + $regex .= 'u'; + } + + // See if the parser's InlineParserMatch regex matched against any part of the string + if (! \preg_match_all($regex, $contents, $matches, \PREG_OFFSET_CAPTURE | \PREG_SET_ORDER)) { + continue; + } + + // For each part that matched... + foreach ($matches as $match) { + if ($isMultibyte) { + // PREG_OFFSET_CAPTURE always returns the byte offset, not the char offset, which is annoying + $offset = \mb_strlen(\substr($contents, 0, $match[0][1]), 'UTF-8'); + } else { + $offset = \intval($match[0][1]); + } + + // Remove the offsets, keeping only the matched text + $m = \array_column($match, 0); + + if ($m === []) { + continue; + } + + // Add this match to the list of character positions to stop at + $ret[$offset][] = [$parser, $m]; + } + } + + // Sort matches by position so we visit them in order + \ksort($ret); + + return $ret; + } +} diff --git a/vendor/league/commonmark/src/Parser/InlineParserEngineInterface.php b/vendor/league/commonmark/src/Parser/InlineParserEngineInterface.php new file mode 100644 index 00000000..8a0986dc --- /dev/null +++ b/vendor/league/commonmark/src/Parser/InlineParserEngineInterface.php @@ -0,0 +1,27 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Parser; + +use League\CommonMark\Node\Block\AbstractBlock; + +/** + * Parser for inline content (text, links, emphasized text, etc). + */ +interface InlineParserEngineInterface +{ + /** + * Parse the given contents as inlines and insert them into the given block + */ + public function parse(string $contents, AbstractBlock $block): void; +} diff --git a/vendor/league/commonmark/src/Parser/MarkdownParser.php b/vendor/league/commonmark/src/Parser/MarkdownParser.php new file mode 100644 index 00000000..2fecb9ba --- /dev/null +++ b/vendor/league/commonmark/src/Parser/MarkdownParser.php @@ -0,0 +1,352 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * Additional code based on commonmark-java (https://github.com/commonmark/commonmark-java) + * - (c) Atlassian Pty Ltd + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Parser; + +use League\CommonMark\Environment\EnvironmentInterface; +use League\CommonMark\Event\DocumentParsedEvent; +use League\CommonMark\Event\DocumentPreParsedEvent; +use League\CommonMark\Exception\CommonMarkException; +use League\CommonMark\Input\MarkdownInput; +use League\CommonMark\Node\Block\Document; +use League\CommonMark\Node\Block\Paragraph; +use League\CommonMark\Parser\Block\BlockContinueParserInterface; +use League\CommonMark\Parser\Block\BlockContinueParserWithInlinesInterface; +use League\CommonMark\Parser\Block\BlockStart; +use League\CommonMark\Parser\Block\BlockStartParserInterface; +use League\CommonMark\Parser\Block\DocumentBlockParser; +use League\CommonMark\Parser\Block\ParagraphParser; +use League\CommonMark\Reference\ReferenceInterface; +use League\CommonMark\Reference\ReferenceMap; + +final class MarkdownParser implements MarkdownParserInterface +{ + /** @psalm-readonly */ + private EnvironmentInterface $environment; + + /** @psalm-readonly-allow-private-mutation */ + private int $maxNestingLevel; + + /** @psalm-readonly-allow-private-mutation */ + private ReferenceMap $referenceMap; + + /** @psalm-readonly-allow-private-mutation */ + private int $lineNumber = 0; + + /** @psalm-readonly-allow-private-mutation */ + private Cursor $cursor; + + /** + * @var array<int, BlockContinueParserInterface> + * + * @psalm-readonly-allow-private-mutation + */ + private array $activeBlockParsers = []; + + /** + * @var array<int, BlockContinueParserWithInlinesInterface> + * + * @psalm-readonly-allow-private-mutation + */ + private array $closedBlockParsers = []; + + public function __construct(EnvironmentInterface $environment) + { + $this->environment = $environment; + } + + private function initialize(): void + { + $this->referenceMap = new ReferenceMap(); + $this->lineNumber = 0; + $this->activeBlockParsers = []; + $this->closedBlockParsers = []; + + $this->maxNestingLevel = $this->environment->getConfiguration()->get('max_nesting_level'); + } + + /** + * @throws CommonMarkException + */ + public function parse(string $input): Document + { + $this->initialize(); + + $documentParser = new DocumentBlockParser($this->referenceMap); + $this->activateBlockParser($documentParser); + + $preParsedEvent = new DocumentPreParsedEvent($documentParser->getBlock(), new MarkdownInput($input)); + $this->environment->dispatch($preParsedEvent); + $markdownInput = $preParsedEvent->getMarkdown(); + + foreach ($markdownInput->getLines() as $lineNumber => $line) { + $this->lineNumber = $lineNumber; + $this->parseLine($line); + } + + // finalizeAndProcess + $this->closeBlockParsers(\count($this->activeBlockParsers), $this->lineNumber); + $this->processInlines(); + + $this->environment->dispatch(new DocumentParsedEvent($documentParser->getBlock())); + + return $documentParser->getBlock(); + } + + /** + * Analyze a line of text and update the document appropriately. We parse markdown text by calling this on each + * line of input, then finalizing the document. + */ + private function parseLine(string $line): void + { + $this->cursor = new Cursor($line); + + $matches = $this->parseBlockContinuation(); + if ($matches === null) { + return; + } + + $unmatchedBlocks = \count($this->activeBlockParsers) - $matches; + $blockParser = $this->activeBlockParsers[$matches - 1]; + $startedNewBlock = false; + + // Unless last matched container is a code block, try new container starts, + // adding children to the last matched container: + $tryBlockStarts = $blockParser->getBlock() instanceof Paragraph || $blockParser->isContainer(); + while ($tryBlockStarts) { + // this is a little performance optimization + if ($this->cursor->isBlank()) { + $this->cursor->advanceToEnd(); + break; + } + + if ($blockParser->getBlock()->getDepth() >= $this->maxNestingLevel) { + break; + } + + $blockStart = $this->findBlockStart($blockParser); + if ($blockStart === null || $blockStart->isAborting()) { + $this->cursor->advanceToNextNonSpaceOrTab(); + break; + } + + if (($state = $blockStart->getCursorState()) !== null) { + $this->cursor->restoreState($state); + } + + $startedNewBlock = true; + + // We're starting a new block. If we have any previous blocks that need to be closed, we need to do it now. + if ($unmatchedBlocks > 0) { + $this->closeBlockParsers($unmatchedBlocks, $this->lineNumber - 1); + $unmatchedBlocks = 0; + } + + $oldBlockLineStart = null; + if ($blockStart->isReplaceActiveBlockParser()) { + $oldBlockLineStart = $this->prepareActiveBlockParserForReplacement(); + } + + foreach ($blockStart->getBlockParsers() as $newBlockParser) { + $blockParser = $this->addChild($newBlockParser, $oldBlockLineStart); + $tryBlockStarts = $newBlockParser->isContainer(); + } + } + + // What remains at the offset is a text line. Add the text to the appropriate block. + + // First check for a lazy paragraph continuation: + if (! $startedNewBlock && ! $this->cursor->isBlank() && $this->getActiveBlockParser()->canHaveLazyContinuationLines()) { + $this->getActiveBlockParser()->addLine($this->cursor->getRemainder()); + } else { + // finalize any blocks not matched + if ($unmatchedBlocks > 0) { + $this->closeBlockParsers($unmatchedBlocks, $this->lineNumber - 1); + } + + if (! $blockParser->isContainer()) { + $this->getActiveBlockParser()->addLine($this->cursor->getRemainder()); + } elseif (! $this->cursor->isBlank()) { + $this->addChild(new ParagraphParser()); + $this->getActiveBlockParser()->addLine($this->cursor->getRemainder()); + } + } + } + + private function parseBlockContinuation(): ?int + { + // For each containing block, try to parse the associated line start. + // The document will always match, so we can skip the first block parser and start at 1 matches + $matches = 1; + for ($i = 1; $i < \count($this->activeBlockParsers); $i++) { + $blockParser = $this->activeBlockParsers[$i]; + $blockContinue = $blockParser->tryContinue(clone $this->cursor, $this->getActiveBlockParser()); + if ($blockContinue === null) { + break; + } + + if ($blockContinue->isFinalize()) { + $this->closeBlockParsers(\count($this->activeBlockParsers) - $i, $this->lineNumber); + + return null; + } + + if (($state = $blockContinue->getCursorState()) !== null) { + $this->cursor->restoreState($state); + } + + $matches++; + } + + return $matches; + } + + private function findBlockStart(BlockContinueParserInterface $lastMatchedBlockParser): ?BlockStart + { + $matchedBlockParser = new MarkdownParserState($this->getActiveBlockParser(), $lastMatchedBlockParser); + + foreach ($this->environment->getBlockStartParsers() as $blockStartParser) { + \assert($blockStartParser instanceof BlockStartParserInterface); + if (($result = $blockStartParser->tryStart(clone $this->cursor, $matchedBlockParser)) !== null) { + return $result; + } + } + + return null; + } + + private function closeBlockParsers(int $count, int $endLineNumber): void + { + for ($i = 0; $i < $count; $i++) { + $blockParser = $this->deactivateBlockParser(); + $this->finalize($blockParser, $endLineNumber); + + // phpcs:disable SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed + if ($blockParser instanceof BlockContinueParserWithInlinesInterface) { + // Remember for inline parsing + $this->closedBlockParsers[] = $blockParser; + } + } + } + + /** + * Finalize a block. Close it and do any necessary postprocessing, e.g. creating string_content from strings, + * setting the 'tight' or 'loose' status of a list, and parsing the beginnings of paragraphs for reference + * definitions. + */ + private function finalize(BlockContinueParserInterface $blockParser, int $endLineNumber): void + { + if ($blockParser instanceof ParagraphParser) { + $this->updateReferenceMap($blockParser->getReferences()); + } + + $blockParser->getBlock()->setEndLine($endLineNumber); + $blockParser->closeBlock(); + } + + /** + * Walk through a block & children recursively, parsing string content into inline content where appropriate. + */ + private function processInlines(): void + { + $p = new InlineParserEngine($this->environment, $this->referenceMap); + + foreach ($this->closedBlockParsers as $blockParser) { + $blockParser->parseInlines($p); + } + } + + /** + * Add block of type tag as a child of the tip. If the tip can't accept children, close and finalize it and try + * its parent, and so on til we find a block that can accept children. + */ + private function addChild(BlockContinueParserInterface $blockParser, ?int $startLineNumber = null): BlockContinueParserInterface + { + $blockParser->getBlock()->setStartLine($startLineNumber ?? $this->lineNumber); + + while (! $this->getActiveBlockParser()->canContain($blockParser->getBlock())) { + $this->closeBlockParsers(1, ($startLineNumber ?? $this->lineNumber) - 1); + } + + $this->getActiveBlockParser()->getBlock()->appendChild($blockParser->getBlock()); + $this->activateBlockParser($blockParser); + + return $blockParser; + } + + private function activateBlockParser(BlockContinueParserInterface $blockParser): void + { + $this->activeBlockParsers[] = $blockParser; + } + + /** + * @throws ParserLogicException + */ + private function deactivateBlockParser(): BlockContinueParserInterface + { + $popped = \array_pop($this->activeBlockParsers); + if ($popped === null) { + throw new ParserLogicException('The last block parser should not be deactivated'); + } + + return $popped; + } + + /** + * @return int|null The line number where the old block started + */ + private function prepareActiveBlockParserForReplacement(): ?int + { + // Note that we don't want to parse inlines or finalize this block, as it's getting replaced. + $old = $this->deactivateBlockParser(); + + if ($old instanceof ParagraphParser) { + $this->updateReferenceMap($old->getReferences()); + } + + $old->getBlock()->detach(); + + return $old->getBlock()->getStartLine(); + } + + /** + * @param ReferenceInterface[] $references + */ + private function updateReferenceMap(iterable $references): void + { + foreach ($references as $reference) { + if (! $this->referenceMap->contains($reference->getLabel())) { + $this->referenceMap->add($reference); + } + } + } + + /** + * @throws ParserLogicException + */ + public function getActiveBlockParser(): BlockContinueParserInterface + { + $active = \end($this->activeBlockParsers); + if ($active === false) { + throw new ParserLogicException('No active block parsers are available'); + } + + return $active; + } +} diff --git a/vendor/league/commonmark/src/Parser/MarkdownParserInterface.php b/vendor/league/commonmark/src/Parser/MarkdownParserInterface.php new file mode 100644 index 00000000..e0a6be41 --- /dev/null +++ b/vendor/league/commonmark/src/Parser/MarkdownParserInterface.php @@ -0,0 +1,25 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Parser; + +use League\CommonMark\Exception\CommonMarkException; +use League\CommonMark\Node\Block\Document; + +interface MarkdownParserInterface +{ + /** + * @throws CommonMarkException + */ + public function parse(string $input): Document; +} diff --git a/vendor/league/commonmark/src/Parser/MarkdownParserState.php b/vendor/league/commonmark/src/Parser/MarkdownParserState.php new file mode 100644 index 00000000..79abd42f --- /dev/null +++ b/vendor/league/commonmark/src/Parser/MarkdownParserState.php @@ -0,0 +1,57 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Parser; + +use League\CommonMark\Parser\Block\BlockContinueParserInterface; +use League\CommonMark\Parser\Block\ParagraphParser; + +/** + * @internal You should rely on the interface instead + */ +final class MarkdownParserState implements MarkdownParserStateInterface +{ + /** @psalm-readonly */ + private BlockContinueParserInterface $activeBlockParser; + + /** @psalm-readonly */ + private BlockContinueParserInterface $lastMatchedBlockParser; + + public function __construct(BlockContinueParserInterface $activeBlockParser, BlockContinueParserInterface $lastMatchedBlockParser) + { + $this->activeBlockParser = $activeBlockParser; + $this->lastMatchedBlockParser = $lastMatchedBlockParser; + } + + public function getActiveBlockParser(): BlockContinueParserInterface + { + return $this->activeBlockParser; + } + + public function getLastMatchedBlockParser(): BlockContinueParserInterface + { + return $this->lastMatchedBlockParser; + } + + public function getParagraphContent(): ?string + { + if (! $this->lastMatchedBlockParser instanceof ParagraphParser) { + return null; + } + + $paragraphParser = $this->lastMatchedBlockParser; + $content = $paragraphParser->getContentString(); + + return $content === '' ? null : $content; + } +} diff --git a/vendor/league/commonmark/src/Parser/MarkdownParserStateInterface.php b/vendor/league/commonmark/src/Parser/MarkdownParserStateInterface.php new file mode 100644 index 00000000..21a9d3ab --- /dev/null +++ b/vendor/league/commonmark/src/Parser/MarkdownParserStateInterface.php @@ -0,0 +1,36 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Parser; + +use League\CommonMark\Parser\Block\BlockContinueParserInterface; + +interface MarkdownParserStateInterface +{ + /** + * Returns the deepest open block parser + */ + public function getActiveBlockParser(): BlockContinueParserInterface; + + /** + * Open block parser that was last matched during the continue phase. This is different from the currently active + * block parser, as an unmatched block is only closed when a new block is started. + */ + public function getLastMatchedBlockParser(): BlockContinueParserInterface; + + /** + * Returns the current content of the paragraph if the matched block is a paragraph. The content can be multiple + * lines separated by newlines. + */ + public function getParagraphContent(): ?string; +} diff --git a/vendor/league/commonmark/src/Parser/ParserLogicException.php b/vendor/league/commonmark/src/Parser/ParserLogicException.php new file mode 100644 index 00000000..592b1a2d --- /dev/null +++ b/vendor/league/commonmark/src/Parser/ParserLogicException.php @@ -0,0 +1,20 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Parser; + +use League\CommonMark\Exception\CommonMarkException; + +class ParserLogicException extends \LogicException implements CommonMarkException +{ +} diff --git a/vendor/league/commonmark/src/Reference/Reference.php b/vendor/league/commonmark/src/Reference/Reference.php new file mode 100644 index 00000000..a0d571d5 --- /dev/null +++ b/vendor/league/commonmark/src/Reference/Reference.php @@ -0,0 +1,54 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Reference; + +/** + * @psalm-immutable + */ +final class Reference implements ReferenceInterface +{ + /** @psalm-readonly */ + private string $label; + + /** @psalm-readonly */ + private string $destination; + + /** @psalm-readonly */ + private string $title; + + public function __construct(string $label, string $destination, string $title) + { + $this->label = $label; + $this->destination = $destination; + $this->title = $title; + } + + public function getLabel(): string + { + return $this->label; + } + + public function getDestination(): string + { + return $this->destination; + } + + public function getTitle(): string + { + return $this->title; + } +} diff --git a/vendor/league/commonmark/src/Reference/ReferenceInterface.php b/vendor/league/commonmark/src/Reference/ReferenceInterface.php new file mode 100644 index 00000000..244b3546 --- /dev/null +++ b/vendor/league/commonmark/src/Reference/ReferenceInterface.php @@ -0,0 +1,29 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Reference; + +/** + * Link reference + */ +interface ReferenceInterface +{ + public function getLabel(): string; + + public function getDestination(): string; + + public function getTitle(): string; +} diff --git a/vendor/league/commonmark/src/Reference/ReferenceMap.php b/vendor/league/commonmark/src/Reference/ReferenceMap.php new file mode 100644 index 00000000..982cb125 --- /dev/null +++ b/vendor/league/commonmark/src/Reference/ReferenceMap.php @@ -0,0 +1,77 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Reference; + +use League\CommonMark\Normalizer\TextNormalizer; + +/** + * A collection of references, indexed by label + */ +final class ReferenceMap implements ReferenceMapInterface +{ + /** @psalm-readonly */ + private TextNormalizer $normalizer; + + /** + * @var array<string, ReferenceInterface> + * + * @psalm-readonly-allow-private-mutation + */ + private array $references = []; + + public function __construct() + { + $this->normalizer = new TextNormalizer(); + } + + public function add(ReferenceInterface $reference): void + { + // Normalize the key + $key = $this->normalizer->normalize($reference->getLabel()); + // Store the reference + $this->references[$key] = $reference; + } + + public function contains(string $label): bool + { + $label = $this->normalizer->normalize($label); + + return isset($this->references[$label]); + } + + public function get(string $label): ?ReferenceInterface + { + $label = $this->normalizer->normalize($label); + + return $this->references[$label] ?? null; + } + + /** + * @return \Traversable<string, ReferenceInterface> + */ + public function getIterator(): \Traversable + { + foreach ($this->references as $normalizedLabel => $reference) { + yield $normalizedLabel => $reference; + } + } + + public function count(): int + { + return \count($this->references); + } +} diff --git a/vendor/league/commonmark/src/Reference/ReferenceMapInterface.php b/vendor/league/commonmark/src/Reference/ReferenceMapInterface.php new file mode 100644 index 00000000..71daa19e --- /dev/null +++ b/vendor/league/commonmark/src/Reference/ReferenceMapInterface.php @@ -0,0 +1,31 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Reference; + +/** + * A collection of references + * + * @phpstan-extends \IteratorAggregate<ReferenceInterface> + */ +interface ReferenceMapInterface extends \IteratorAggregate, \Countable +{ + public function add(ReferenceInterface $reference): void; + + public function contains(string $label): bool; + + public function get(string $label): ?ReferenceInterface; +} diff --git a/vendor/league/commonmark/src/Reference/ReferenceParser.php b/vendor/league/commonmark/src/Reference/ReferenceParser.php new file mode 100644 index 00000000..c01dd213 --- /dev/null +++ b/vendor/league/commonmark/src/Reference/ReferenceParser.php @@ -0,0 +1,324 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Reference; + +use League\CommonMark\Parser\Cursor; +use League\CommonMark\Util\LinkParserHelper; + +final class ReferenceParser +{ + // Looking for the start of a definition, i.e. `[` + private const START_DEFINITION = 0; + // Looking for and parsing the label, i.e. `[foo]` within `[foo]` + private const LABEL = 1; + // Parsing the destination, i.e. `/url` in `[foo]: /url` + private const DESTINATION = 2; + // Looking for the start of a title, i.e. the first `"` in `[foo]: /url "title"` + private const START_TITLE = 3; + // Parsing the content of the title, i.e. `title` in `[foo]: /url "title"` + private const TITLE = 4; + // End state, no matter what kind of lines we add, they won't be references + private const PARAGRAPH = 5; + + /** @psalm-readonly-allow-private-mutation */ + private string $paragraph = ''; + + /** + * @var array<int, ReferenceInterface> + * + * @psalm-readonly-allow-private-mutation + */ + private array $references = []; + + /** @psalm-readonly-allow-private-mutation */ + private int $state = self::START_DEFINITION; + + /** @psalm-readonly-allow-private-mutation */ + private ?string $label = null; + + /** @psalm-readonly-allow-private-mutation */ + private ?string $destination = null; + + /** + * @var string string + * + * @psalm-readonly-allow-private-mutation + */ + private string $title = ''; + + /** @psalm-readonly-allow-private-mutation */ + private ?string $titleDelimiter = null; + + /** @psalm-readonly-allow-private-mutation */ + private bool $referenceValid = false; + + public function getParagraphContent(): string + { + return $this->paragraph; + } + + /** + * @return ReferenceInterface[] + */ + public function getReferences(): iterable + { + $this->finishReference(); + + return $this->references; + } + + public function hasReferences(): bool + { + return $this->references !== []; + } + + public function parse(string $line): void + { + if ($this->paragraph !== '') { + $this->paragraph .= "\n"; + } + + $this->paragraph .= $line; + + $cursor = new Cursor($line); + while (! $cursor->isAtEnd()) { + $result = false; + switch ($this->state) { + case self::PARAGRAPH: + // We're in a paragraph now. Link reference definitions can only appear at the beginning, so once + // we're in a paragraph, there's no going back. + return; + case self::START_DEFINITION: + $result = $this->parseStartDefinition($cursor); + break; + case self::LABEL: + $result = $this->parseLabel($cursor); + break; + case self::DESTINATION: + $result = $this->parseDestination($cursor); + break; + case self::START_TITLE: + $result = $this->parseStartTitle($cursor); + break; + case self::TITLE: + $result = $this->parseTitle($cursor); + break; + default: + // this should never happen + break; + } + + if (! $result) { + $this->state = self::PARAGRAPH; + + return; + } + } + } + + private function parseStartDefinition(Cursor $cursor): bool + { + $cursor->advanceToNextNonSpaceOrTab(); + if ($cursor->isAtEnd() || $cursor->getCurrentCharacter() !== '[') { + return false; + } + + $this->state = self::LABEL; + $this->label = ''; + + $cursor->advance(); + if ($cursor->isAtEnd()) { + $this->label .= "\n"; + } + + return true; + } + + private function parseLabel(Cursor $cursor): bool + { + $cursor->advanceToNextNonSpaceOrTab(); + + $partialLabel = LinkParserHelper::parsePartialLinkLabel($cursor); + if ($partialLabel === null) { + return false; + } + + \assert($this->label !== null); + $this->label .= $partialLabel; + + if ($cursor->isAtEnd()) { + // label might continue on next line + $this->label .= "\n"; + + return true; + } + + if ($cursor->getCurrentCharacter() !== ']') { + return false; + } + + $cursor->advance(); + + // end of label + if ($cursor->getCurrentCharacter() !== ':') { + return false; + } + + $cursor->advance(); + + // spec: A link label can have at most 999 characters inside the square brackets + if (\mb_strlen($this->label, 'UTF-8') > 999) { + return false; + } + + // spec: A link label must contain at least one non-whitespace character + if (\trim($this->label) === '') { + return false; + } + + $cursor->advanceToNextNonSpaceOrTab(); + + $this->state = self::DESTINATION; + + return true; + } + + private function parseDestination(Cursor $cursor): bool + { + $cursor->advanceToNextNonSpaceOrTab(); + + $destination = LinkParserHelper::parseLinkDestination($cursor); + if ($destination === null) { + return false; + } + + $this->destination = $destination; + + $advanced = $cursor->advanceToNextNonSpaceOrTab(); + if ($cursor->isAtEnd()) { + // Destination was at end of line, so this is a valid reference for sure (and maybe a title). + // If not at end of line, wait for title to be valid first. + $this->referenceValid = true; + $this->paragraph = ''; + } elseif ($advanced === 0) { + // spec: The title must be separated from the link destination by whitespace + return false; + } + + $this->state = self::START_TITLE; + + return true; + } + + private function parseStartTitle(Cursor $cursor): bool + { + $cursor->advanceToNextNonSpaceOrTab(); + if ($cursor->isAtEnd()) { + $this->state = self::START_DEFINITION; + + return true; + } + + $this->titleDelimiter = null; + switch ($c = $cursor->getCurrentCharacter()) { + case '"': + case "'": + $this->titleDelimiter = $c; + break; + case '(': + $this->titleDelimiter = ')'; + break; + default: + // no title delimter found + break; + } + + if ($this->titleDelimiter !== null) { + $this->state = self::TITLE; + $cursor->advance(); + if ($cursor->isAtEnd()) { + $this->title .= "\n"; + } + } else { + $this->finishReference(); + // There might be another reference instead, try that for the same character. + $this->state = self::START_DEFINITION; + } + + return true; + } + + private function parseTitle(Cursor $cursor): bool + { + \assert($this->titleDelimiter !== null); + $title = LinkParserHelper::parsePartialLinkTitle($cursor, $this->titleDelimiter); + + if ($title === null) { + // Invalid title, stop + return false; + } + + // Did we find the end delimiter? + $endDelimiterFound = false; + if (\substr($title, -1) === $this->titleDelimiter) { + $endDelimiterFound = true; + // Chop it off + $title = \substr($title, 0, -1); + } + + $this->title .= $title; + + if (! $endDelimiterFound && $cursor->isAtEnd()) { + // Title still going, continue on next line + $this->title .= "\n"; + + return true; + } + + // We either hit the end delimiter or some extra whitespace + $cursor->advanceToNextNonSpaceOrTab(); + if (! $cursor->isAtEnd()) { + // spec: No further non-whitespace characters may occur on the line. + return false; + } + + $this->referenceValid = true; + $this->finishReference(); + $this->paragraph = ''; + + // See if there's another definition + $this->state = self::START_DEFINITION; + + return true; + } + + private function finishReference(): void + { + if (! $this->referenceValid) { + return; + } + + /** @psalm-suppress PossiblyNullArgument -- these can't possibly be null if we're in this state */ + $this->references[] = new Reference($this->label, $this->destination, $this->title); + + $this->label = null; + $this->referenceValid = false; + $this->destination = null; + $this->title = ''; + $this->titleDelimiter = null; + } +} diff --git a/vendor/league/commonmark/src/Reference/ReferenceableInterface.php b/vendor/league/commonmark/src/Reference/ReferenceableInterface.php new file mode 100644 index 00000000..b45f379e --- /dev/null +++ b/vendor/league/commonmark/src/Reference/ReferenceableInterface.php @@ -0,0 +1,19 @@ +<?php + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace League\CommonMark\Reference; + +interface ReferenceableInterface +{ + public function getReference(): ReferenceInterface; +} diff --git a/vendor/league/commonmark/src/Renderer/Block/DocumentRenderer.php b/vendor/league/commonmark/src/Renderer/Block/DocumentRenderer.php new file mode 100644 index 00000000..32626914 --- /dev/null +++ b/vendor/league/commonmark/src/Renderer/Block/DocumentRenderer.php @@ -0,0 +1,57 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Renderer\Block; + +use League\CommonMark\Node\Block\Document; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Xml\XmlNodeRendererInterface; + +final class DocumentRenderer implements NodeRendererInterface, XmlNodeRendererInterface +{ + /** + * @param Document $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): string + { + Document::assertInstanceOf($node); + + $wholeDoc = $childRenderer->renderNodes($node->children()); + + return $wholeDoc === '' ? '' : $wholeDoc . "\n"; + } + + public function getXmlTagName(Node $node): string + { + return 'document'; + } + + /** + * {@inheritDoc} + */ + public function getXmlAttributes(Node $node): array + { + return [ + 'xmlns' => 'http://commonmark.org/xml/1.0', + ]; + } +} diff --git a/vendor/league/commonmark/src/Renderer/Block/ParagraphRenderer.php b/vendor/league/commonmark/src/Renderer/Block/ParagraphRenderer.php new file mode 100644 index 00000000..934eac2d --- /dev/null +++ b/vendor/league/commonmark/src/Renderer/Block/ParagraphRenderer.php @@ -0,0 +1,74 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Renderer\Block; + +use League\CommonMark\Node\Block\Paragraph; +use League\CommonMark\Node\Block\TightBlockInterface; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\HtmlElement; +use League\CommonMark\Xml\XmlNodeRendererInterface; + +final class ParagraphRenderer implements NodeRendererInterface, XmlNodeRendererInterface +{ + /** + * @param Paragraph $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer) + { + Paragraph::assertInstanceOf($node); + + if ($this->inTightList($node)) { + return $childRenderer->renderNodes($node->children()); + } + + $attrs = $node->data->get('attributes'); + + return new HtmlElement('p', $attrs, $childRenderer->renderNodes($node->children())); + } + + public function getXmlTagName(Node $node): string + { + return 'paragraph'; + } + + /** + * {@inheritDoc} + */ + public function getXmlAttributes(Node $node): array + { + return []; + } + + private function inTightList(Paragraph $node): bool + { + // Only check up to two (2) levels above this for tightness + $i = 2; + while (($node = $node->parent()) && $i--) { + if ($node instanceof TightBlockInterface) { + return $node->isTight(); + } + } + + return false; + } +} diff --git a/vendor/league/commonmark/src/Renderer/ChildNodeRendererInterface.php b/vendor/league/commonmark/src/Renderer/ChildNodeRendererInterface.php new file mode 100644 index 00000000..8e866b56 --- /dev/null +++ b/vendor/league/commonmark/src/Renderer/ChildNodeRendererInterface.php @@ -0,0 +1,31 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Renderer; + +use League\CommonMark\Node\Node; + +/** + * Renders multiple nodes by delegating to the individual node renderers and adding spacing where needed + */ +interface ChildNodeRendererInterface +{ + /** + * @param Node[] $nodes + */ + public function renderNodes(iterable $nodes): string; + + public function getBlockSeparator(): string; + + public function getInnerSeparator(): string; +} diff --git a/vendor/league/commonmark/src/Renderer/DocumentRendererInterface.php b/vendor/league/commonmark/src/Renderer/DocumentRendererInterface.php new file mode 100644 index 00000000..dd34dd6b --- /dev/null +++ b/vendor/league/commonmark/src/Renderer/DocumentRendererInterface.php @@ -0,0 +1,28 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Renderer; + +use League\CommonMark\Node\Block\Document; +use League\CommonMark\Output\RenderedContentInterface; + +/** + * Renders a parsed Document AST + */ +interface DocumentRendererInterface extends MarkdownRendererInterface +{ + /** + * Render the given Document node (and all of its children) + */ + public function renderDocument(Document $document): RenderedContentInterface; +} diff --git a/vendor/league/commonmark/src/Renderer/HtmlDecorator.php b/vendor/league/commonmark/src/Renderer/HtmlDecorator.php new file mode 100644 index 00000000..46a38d92 --- /dev/null +++ b/vendor/league/commonmark/src/Renderer/HtmlDecorator.php @@ -0,0 +1,45 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Renderer; + +use League\CommonMark\Node\Node; +use League\CommonMark\Util\HtmlElement; + +final class HtmlDecorator implements NodeRendererInterface +{ + private NodeRendererInterface $inner; + private string $tag; + /** @var array<string, string|string[]|bool> */ + private array $attributes; + private bool $selfClosing; + + /** + * @param array<string, string|string[]|bool> $attributes + */ + public function __construct(NodeRendererInterface $inner, string $tag, array $attributes = [], bool $selfClosing = false) + { + $this->inner = $inner; + $this->tag = $tag; + $this->attributes = $attributes; + $this->selfClosing = $selfClosing; + } + + /** + * {@inheritDoc} + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer) + { + return new HtmlElement($this->tag, $this->attributes, $this->inner->render($node, $childRenderer), $this->selfClosing); + } +} diff --git a/vendor/league/commonmark/src/Renderer/HtmlRenderer.php b/vendor/league/commonmark/src/Renderer/HtmlRenderer.php new file mode 100644 index 00000000..2e05cfbf --- /dev/null +++ b/vendor/league/commonmark/src/Renderer/HtmlRenderer.php @@ -0,0 +1,100 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Renderer; + +use League\CommonMark\Environment\EnvironmentInterface; +use League\CommonMark\Event\DocumentPreRenderEvent; +use League\CommonMark\Event\DocumentRenderedEvent; +use League\CommonMark\Node\Block\AbstractBlock; +use League\CommonMark\Node\Block\Document; +use League\CommonMark\Node\Node; +use League\CommonMark\Output\RenderedContent; +use League\CommonMark\Output\RenderedContentInterface; + +final class HtmlRenderer implements DocumentRendererInterface, ChildNodeRendererInterface +{ + /** @psalm-readonly */ + private EnvironmentInterface $environment; + + public function __construct(EnvironmentInterface $environment) + { + $this->environment = $environment; + } + + public function renderDocument(Document $document): RenderedContentInterface + { + $this->environment->dispatch(new DocumentPreRenderEvent($document, 'html')); + + $output = new RenderedContent($document, (string) $this->renderNode($document)); + + $event = new DocumentRenderedEvent($output); + $this->environment->dispatch($event); + + return $event->getOutput(); + } + + /** + * {@inheritDoc} + */ + public function renderNodes(iterable $nodes): string + { + $output = ''; + + $isFirstItem = true; + + foreach ($nodes as $node) { + if (! $isFirstItem && $node instanceof AbstractBlock) { + $output .= $this->getBlockSeparator(); + } + + $output .= $this->renderNode($node); + + $isFirstItem = false; + } + + return $output; + } + + /** + * @return \Stringable|string + * + * @throws NoMatchingRendererException + */ + private function renderNode(Node $node) + { + $renderers = $this->environment->getRenderersForClass(\get_class($node)); + + foreach ($renderers as $renderer) { + \assert($renderer instanceof NodeRendererInterface); + if (($result = $renderer->render($node, $this)) !== null) { + return $result; + } + } + + throw new NoMatchingRendererException('Unable to find corresponding renderer for node type ' . \get_class($node)); + } + + public function getBlockSeparator(): string + { + return $this->environment->getConfiguration()->get('renderer/block_separator'); + } + + public function getInnerSeparator(): string + { + return $this->environment->getConfiguration()->get('renderer/inner_separator'); + } +} diff --git a/vendor/league/commonmark/src/Renderer/Inline/NewlineRenderer.php b/vendor/league/commonmark/src/Renderer/Inline/NewlineRenderer.php new file mode 100644 index 00000000..f64cc587 --- /dev/null +++ b/vendor/league/commonmark/src/Renderer/Inline/NewlineRenderer.php @@ -0,0 +1,76 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Renderer\Inline; + +use League\CommonMark\Node\Inline\Newline; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Xml\XmlNodeRendererInterface; +use League\Config\ConfigurationAwareInterface; +use League\Config\ConfigurationInterface; + +final class NewlineRenderer implements NodeRendererInterface, XmlNodeRendererInterface, ConfigurationAwareInterface +{ + /** @psalm-readonly-allow-private-mutation */ + private ConfigurationInterface $config; + + public function setConfiguration(ConfigurationInterface $configuration): void + { + $this->config = $configuration; + } + + /** + * @param Newline $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): string + { + Newline::assertInstanceOf($node); + + if ($node->getType() === Newline::HARDBREAK) { + return "<br />\n"; + } + + return $this->config->get('renderer/soft_break'); + } + + /** + * @param Newline $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function getXmlTagName(Node $node): string + { + Newline::assertInstanceOf($node); + + return $node->getType() === Newline::SOFTBREAK ? 'softbreak' : 'linebreak'; + } + + /** + * {@inheritDoc} + */ + public function getXmlAttributes(Node $node): array + { + return []; + } +} diff --git a/vendor/league/commonmark/src/Renderer/Inline/TextRenderer.php b/vendor/league/commonmark/src/Renderer/Inline/TextRenderer.php new file mode 100644 index 00000000..40ad02a5 --- /dev/null +++ b/vendor/league/commonmark/src/Renderer/Inline/TextRenderer.php @@ -0,0 +1,54 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Renderer\Inline; + +use League\CommonMark\Node\Inline\Text; +use League\CommonMark\Node\Node; +use League\CommonMark\Renderer\ChildNodeRendererInterface; +use League\CommonMark\Renderer\NodeRendererInterface; +use League\CommonMark\Util\Xml; +use League\CommonMark\Xml\XmlNodeRendererInterface; + +final class TextRenderer implements NodeRendererInterface, XmlNodeRendererInterface +{ + /** + * @param Text $node + * + * {@inheritDoc} + * + * @psalm-suppress MoreSpecificImplementedParamType + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer): string + { + Text::assertInstanceOf($node); + + return Xml::escape($node->getLiteral()); + } + + public function getXmlTagName(Node $node): string + { + return 'text'; + } + + /** + * {@inheritDoc} + */ + public function getXmlAttributes(Node $node): array + { + return []; + } +} diff --git a/vendor/league/commonmark/src/Renderer/MarkdownRendererInterface.php b/vendor/league/commonmark/src/Renderer/MarkdownRendererInterface.php new file mode 100644 index 00000000..83af8cdc --- /dev/null +++ b/vendor/league/commonmark/src/Renderer/MarkdownRendererInterface.php @@ -0,0 +1,30 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Renderer; + +use League\CommonMark\Node\Block\Document; +use League\CommonMark\Output\RenderedContentInterface; + +/** + * Renders a parsed Document AST + * + * @deprecated since 2.3; use {@link DocumentRendererInterface} instead + */ +interface MarkdownRendererInterface +{ + /** + * Render the given Document node (and all of its children) + */ + public function renderDocument(Document $document): RenderedContentInterface; +} diff --git a/vendor/league/commonmark/src/Renderer/NoMatchingRendererException.php b/vendor/league/commonmark/src/Renderer/NoMatchingRendererException.php new file mode 100644 index 00000000..14fe493b --- /dev/null +++ b/vendor/league/commonmark/src/Renderer/NoMatchingRendererException.php @@ -0,0 +1,20 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Renderer; + +use League\CommonMark\Exception\LogicException; + +class NoMatchingRendererException extends LogicException +{ +} diff --git a/vendor/league/commonmark/src/Renderer/NodeRendererInterface.php b/vendor/league/commonmark/src/Renderer/NodeRendererInterface.php new file mode 100644 index 00000000..5d40582a --- /dev/null +++ b/vendor/league/commonmark/src/Renderer/NodeRendererInterface.php @@ -0,0 +1,27 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Renderer; + +use League\CommonMark\Exception\InvalidArgumentException; +use League\CommonMark\Node\Node; + +interface NodeRendererInterface +{ + /** + * @return \Stringable|string|null + * + * @throws InvalidArgumentException if the wrong type of Node is provided + */ + public function render(Node $node, ChildNodeRendererInterface $childRenderer); +} diff --git a/vendor/league/commonmark/src/Util/ArrayCollection.php b/vendor/league/commonmark/src/Util/ArrayCollection.php new file mode 100644 index 00000000..7210770d --- /dev/null +++ b/vendor/league/commonmark/src/Util/ArrayCollection.php @@ -0,0 +1,173 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Util; + +/** + * Array collection + * + * Provides a wrapper around a standard PHP array. + * + * @internal + * + * @phpstan-template T + * @phpstan-implements \IteratorAggregate<int, T> + * @phpstan-implements \ArrayAccess<int, T> + */ +final class ArrayCollection implements \IteratorAggregate, \Countable, \ArrayAccess +{ + /** + * @var array<int, mixed> + * @phpstan-var array<int, T> + */ + private array $elements; + + /** + * Constructor + * + * @param array<int|string, mixed> $elements + * + * @phpstan-param array<int, T> $elements + */ + public function __construct(array $elements = []) + { + $this->elements = $elements; + } + + /** + * @return mixed|false + * + * @phpstan-return T|false + */ + public function first() + { + return \reset($this->elements); + } + + /** + * @return mixed|false + * + * @phpstan-return T|false + */ + public function last() + { + return \end($this->elements); + } + + /** + * Retrieve an external iterator + * + * @return \ArrayIterator<int, mixed> + * + * @phpstan-return \ArrayIterator<int, T> + */ + #[\ReturnTypeWillChange] + public function getIterator(): \ArrayIterator + { + return new \ArrayIterator($this->elements); + } + + /** + * Count elements of an object + * + * @return int The count as an integer. + */ + public function count(): int + { + return \count($this->elements); + } + + /** + * Whether an offset exists + * + * {@inheritDoc} + * + * @phpstan-param int $offset + */ + public function offsetExists($offset): bool + { + return \array_key_exists($offset, $this->elements); + } + + /** + * Offset to retrieve + * + * {@inheritDoc} + * + * @phpstan-param int $offset + * + * @phpstan-return T|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->elements[$offset] ?? null; + } + + /** + * Offset to set + * + * {@inheritDoc} + * + * @phpstan-param int|null $offset + * @phpstan-param T $value + */ + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value): void + { + if ($offset === null) { + $this->elements[] = $value; + } else { + $this->elements[$offset] = $value; + } + } + + /** + * Offset to unset + * + * {@inheritDoc} + * + * @phpstan-param int $offset + */ + #[\ReturnTypeWillChange] + public function offsetUnset($offset): void + { + if (! \array_key_exists($offset, $this->elements)) { + return; + } + + unset($this->elements[$offset]); + } + + /** + * Returns a subset of the array + * + * @return array<int, mixed> + * + * @phpstan-return array<int, T> + */ + public function slice(int $offset, ?int $length = null): array + { + return \array_slice($this->elements, $offset, $length, true); + } + + /** + * @return array<int, mixed> + * + * @phpstan-return array<int, T> + */ + public function toArray(): array + { + return $this->elements; + } +} diff --git a/vendor/league/commonmark/src/Util/Html5EntityDecoder.php b/vendor/league/commonmark/src/Util/Html5EntityDecoder.php new file mode 100644 index 00000000..52550a01 --- /dev/null +++ b/vendor/league/commonmark/src/Util/Html5EntityDecoder.php @@ -0,0 +1,75 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Util; + +/** + * @psalm-immutable + */ +final class Html5EntityDecoder +{ + /** + * @psalm-pure + */ + public static function decode(string $entity): string + { + if (\substr($entity, -1) !== ';') { + return $entity; + } + + if (\substr($entity, 0, 2) === '&#') { + if (\strtolower(\substr($entity, 2, 1)) === 'x') { + return self::fromHex(\substr($entity, 3, -1)); + } + + return self::fromDecimal(\substr($entity, 2, -1)); + } + + return \html_entity_decode($entity, \ENT_QUOTES | \ENT_HTML5, 'UTF-8'); + } + + /** + * @param mixed $number + * + * @psalm-pure + */ + private static function fromDecimal($number): string + { + // Only convert code points within planes 0-2, excluding NULL + // phpcs:ignore Generic.PHP.ForbiddenFunctions.Found + if (empty($number) || $number > 0x2FFFF) { + return self::fromHex('fffd'); + } + + $entity = '&#' . $number . ';'; + + $converted = \mb_decode_numericentity($entity, [0x0, 0x2FFFF, 0, 0xFFFF], 'UTF-8'); + + if ($converted === $entity) { + return self::fromHex('fffd'); + } + + return $converted; + } + + /** + * @psalm-pure + */ + private static function fromHex(string $hexChars): string + { + return self::fromDecimal(\hexdec($hexChars)); + } +} diff --git a/vendor/league/commonmark/src/Util/HtmlElement.php b/vendor/league/commonmark/src/Util/HtmlElement.php new file mode 100644 index 00000000..51fa6de5 --- /dev/null +++ b/vendor/league/commonmark/src/Util/HtmlElement.php @@ -0,0 +1,160 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Util; + +final class HtmlElement implements \Stringable +{ + /** @psalm-readonly */ + private string $tagName; + + /** @var array<string, string|bool> */ + private array $attributes = []; + + /** @var \Stringable|\Stringable[]|string */ + private $contents; + + /** @psalm-readonly */ + private bool $selfClosing; + + /** + * @param string $tagName Name of the HTML tag + * @param array<string, string|string[]|bool> $attributes Array of attributes (values should be unescaped) + * @param \Stringable|\Stringable[]|string|null $contents Inner contents, pre-escaped if needed + * @param bool $selfClosing Whether the tag is self-closing + */ + public function __construct(string $tagName, array $attributes = [], $contents = '', bool $selfClosing = false) + { + $this->tagName = $tagName; + $this->selfClosing = $selfClosing; + + foreach ($attributes as $name => $value) { + $this->setAttribute($name, $value); + } + + $this->setContents($contents ?? ''); + } + + /** @psalm-immutable */ + public function getTagName(): string + { + return $this->tagName; + } + + /** + * @return array<string, string|bool> + * + * @psalm-immutable + */ + public function getAllAttributes(): array + { + return $this->attributes; + } + + /** + * @return string|bool|null + * + * @psalm-immutable + */ + public function getAttribute(string $key) + { + return $this->attributes[$key] ?? null; + } + + /** + * @param string|string[]|bool $value + */ + public function setAttribute(string $key, $value = true): self + { + if (\is_array($value)) { + $this->attributes[$key] = \implode(' ', \array_unique($value)); + } else { + $this->attributes[$key] = $value; + } + + return $this; + } + + /** + * @return \Stringable|\Stringable[]|string + * + * @psalm-immutable + */ + public function getContents(bool $asString = true) + { + if (! $asString) { + return $this->contents; + } + + return $this->getContentsAsString(); + } + + /** + * Sets the inner contents of the tag (must be pre-escaped if needed) + * + * @param \Stringable|\Stringable[]|string $contents + * + * @return $this + */ + public function setContents($contents): self + { + $this->contents = $contents ?? ''; // @phpstan-ignore-line + + return $this; + } + + /** @psalm-immutable */ + public function __toString(): string + { + $result = '<' . $this->tagName; + + foreach ($this->attributes as $key => $value) { + if ($value === true) { + $result .= ' ' . $key; + } elseif ($value === false) { + continue; + } else { + $result .= ' ' . $key . '="' . Xml::escape($value) . '"'; + } + } + + if ($this->contents !== '') { + $result .= '>' . $this->getContentsAsString() . '</' . $this->tagName . '>'; + } elseif ($this->selfClosing && $this->tagName === 'input') { + $result .= '>'; + } elseif ($this->selfClosing) { + $result .= ' />'; + } else { + $result .= '></' . $this->tagName . '>'; + } + + return $result; + } + + /** @psalm-immutable */ + private function getContentsAsString(): string + { + if (\is_string($this->contents)) { + return $this->contents; + } + + if (\is_array($this->contents)) { + return \implode('', $this->contents); + } + + return (string) $this->contents; + } +} diff --git a/vendor/league/commonmark/src/Util/HtmlFilter.php b/vendor/league/commonmark/src/Util/HtmlFilter.php new file mode 100644 index 00000000..b1e05553 --- /dev/null +++ b/vendor/league/commonmark/src/Util/HtmlFilter.php @@ -0,0 +1,55 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Util; + +use League\CommonMark\Exception\InvalidArgumentException; + +/** + * @psalm-immutable + */ +final class HtmlFilter +{ + // Return the entire string as-is + public const ALLOW = 'allow'; + // Escape the entire string so any HTML/JS won't be interpreted as such + public const ESCAPE = 'escape'; + // Return an empty string + public const STRIP = 'strip'; + + /** + * Runs the given HTML through the given filter + * + * @param string $html HTML input to be filtered + * @param string $filter One of the HtmlFilter constants + * + * @return string Filtered HTML + * + * @throws InvalidArgumentException when an invalid $filter is given + * + * @psalm-pure + */ + public static function filter(string $html, string $filter): string + { + switch ($filter) { + case self::STRIP: + return ''; + case self::ESCAPE: + return \htmlspecialchars($html, \ENT_NOQUOTES); + case self::ALLOW: + return $html; + default: + throw new InvalidArgumentException(\sprintf('Invalid filter provided: "%s"', $filter)); + } + } +} diff --git a/vendor/league/commonmark/src/Util/LinkParserHelper.php b/vendor/league/commonmark/src/Util/LinkParserHelper.php new file mode 100644 index 00000000..e329669b --- /dev/null +++ b/vendor/league/commonmark/src/Util/LinkParserHelper.php @@ -0,0 +1,142 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Util; + +use League\CommonMark\Parser\Cursor; + +/** + * @psalm-immutable + */ +final class LinkParserHelper +{ + /** + * Attempt to parse link destination + * + * @return string|null The string, or null if no match + */ + public static function parseLinkDestination(Cursor $cursor): ?string + { + if ($res = $cursor->match(RegexHelper::REGEX_LINK_DESTINATION_BRACES)) { + // Chop off surrounding <..>: + return UrlEncoder::unescapeAndEncode( + RegexHelper::unescape(\substr($res, 1, -1)) + ); + } + + if ($cursor->getCurrentCharacter() === '<') { + return null; + } + + $destination = self::manuallyParseLinkDestination($cursor); + if ($destination === null) { + return null; + } + + return UrlEncoder::unescapeAndEncode( + RegexHelper::unescape($destination) + ); + } + + public static function parseLinkLabel(Cursor $cursor): int + { + $match = $cursor->match('/^\[(?:[^\\\\\[\]]|\\\\.){0,1000}\]/'); + if ($match === null) { + return 0; + } + + $length = \mb_strlen($match, 'UTF-8'); + + if ($length > 1001) { + return 0; + } + + return $length; + } + + public static function parsePartialLinkLabel(Cursor $cursor): ?string + { + return $cursor->match('/^(?:[^\\\\\[\]]+|\\\\.?)*/'); + } + + /** + * Attempt to parse link title (sans quotes) + * + * @return string|null The string, or null if no match + */ + public static function parseLinkTitle(Cursor $cursor): ?string + { + if ($title = $cursor->match('/' . RegexHelper::PARTIAL_LINK_TITLE . '/')) { + // Chop off quotes from title and unescape + return RegexHelper::unescape(\substr($title, 1, -1)); + } + + return null; + } + + public static function parsePartialLinkTitle(Cursor $cursor, string $endDelimiter): ?string + { + $endDelimiter = \preg_quote($endDelimiter, '/'); + $regex = \sprintf('/(%s|[^%s\x00])*(?:%s)?/', RegexHelper::PARTIAL_ESCAPED_CHAR, $endDelimiter, $endDelimiter); + if (($partialTitle = $cursor->match($regex)) === null) { + return null; + } + + return RegexHelper::unescape($partialTitle); + } + + private static function manuallyParseLinkDestination(Cursor $cursor): ?string + { + $oldPosition = $cursor->getPosition(); + $oldState = $cursor->saveState(); + + $openParens = 0; + while (($c = $cursor->getCurrentCharacter()) !== null) { + if ($c === '\\' && ($peek = $cursor->peek()) !== null && RegexHelper::isEscapable($peek)) { + $cursor->advanceBy(2); + } elseif ($c === '(') { + $cursor->advanceBy(1); + $openParens++; + } elseif ($c === ')') { + if ($openParens < 1) { + break; + } + + $cursor->advanceBy(1); + $openParens--; + } elseif (\preg_match(RegexHelper::REGEX_WHITESPACE_CHAR, $c)) { + break; + } else { + $cursor->advanceBy(1); + } + } + + if ($openParens !== 0) { + return null; + } + + if ($cursor->getPosition() === $oldPosition && (! isset($c) || $c !== ')')) { + return null; + } + + $newPos = $cursor->getPosition(); + $cursor->restoreState($oldState); + + $cursor->advanceBy($newPos - $cursor->getPosition()); + + return $cursor->getPreviousText(); + } +} diff --git a/vendor/league/commonmark/src/Util/PrioritizedList.php b/vendor/league/commonmark/src/Util/PrioritizedList.php new file mode 100644 index 00000000..77ec24a4 --- /dev/null +++ b/vendor/league/commonmark/src/Util/PrioritizedList.php @@ -0,0 +1,73 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Util; + +/** + * @internal + * + * @phpstan-template T + * @phpstan-implements \IteratorAggregate<T> + */ +final class PrioritizedList implements \IteratorAggregate +{ + /** + * @var array<int, array<mixed>> + * @phpstan-var array<int, array<T>> + */ + private array $list = []; + + /** + * @var \Traversable<mixed>|null + * @phpstan-var \Traversable<T>|null + */ + private ?\Traversable $optimized = null; + + /** + * @param mixed $item + * + * @phpstan-param T $item + */ + public function add($item, int $priority): void + { + $this->list[$priority][] = $item; + $this->optimized = null; + } + + /** + * @return \Traversable<int, mixed> + * + * @phpstan-return \Traversable<int, T> + */ + #[\ReturnTypeWillChange] + public function getIterator(): \Traversable + { + if ($this->optimized === null) { + \krsort($this->list); + + $sorted = []; + foreach ($this->list as $group) { + foreach ($group as $item) { + $sorted[] = $item; + } + } + + $this->optimized = new \ArrayIterator($sorted); + } + + return $this->optimized; + } +} diff --git a/vendor/league/commonmark/src/Util/RegexHelper.php b/vendor/league/commonmark/src/Util/RegexHelper.php new file mode 100644 index 00000000..a89e7bda --- /dev/null +++ b/vendor/league/commonmark/src/Util/RegexHelper.php @@ -0,0 +1,237 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Util; + +use League\CommonMark\Exception\InvalidArgumentException; +use League\CommonMark\Extension\CommonMark\Node\Block\HtmlBlock; + +/** + * Provides regular expressions and utilities for parsing Markdown + * + * All of the PARTIAL_ regex constants assume that they'll be used in case-insensitive searches + * All other complete regexes provided by this class (either via constants or methods) will have case-insensitivity enabled. + * + * @phpcs:disable Generic.Strings.UnnecessaryStringConcat.Found + * + * @psalm-immutable + */ +final class RegexHelper +{ + // Partial regular expressions (wrap with `/` on each side and add the case-insensitive `i` flag before use) + public const PARTIAL_ENTITY = '&(?:#x[a-f0-9]{1,6}|#[0-9]{1,7}|[a-z][a-z0-9]{1,31});'; + public const PARTIAL_ESCAPABLE = '[!"#$%&\'()*+,.\/:;<=>?@[\\\\\]^_`{|}~-]'; + public const PARTIAL_ESCAPED_CHAR = '\\\\' . self::PARTIAL_ESCAPABLE; + public const PARTIAL_IN_DOUBLE_QUOTES = '"(' . self::PARTIAL_ESCAPED_CHAR . '|[^"\x00])*"'; + public const PARTIAL_IN_SINGLE_QUOTES = '\'(' . self::PARTIAL_ESCAPED_CHAR . '|[^\'\x00])*\''; + public const PARTIAL_IN_PARENS = '\\((' . self::PARTIAL_ESCAPED_CHAR . '|[^)\x00])*\\)'; + public const PARTIAL_REG_CHAR = '[^\\\\()\x00-\x20]'; + public const PARTIAL_IN_PARENS_NOSP = '\((' . self::PARTIAL_REG_CHAR . '|' . self::PARTIAL_ESCAPED_CHAR . '|\\\\)*\)'; + public const PARTIAL_TAGNAME = '[a-z][a-z0-9-]*'; + public const PARTIAL_BLOCKTAGNAME = '(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)'; + public const PARTIAL_ATTRIBUTENAME = '[a-z_:][a-z0-9:._-]*'; + public const PARTIAL_UNQUOTEDVALUE = '[^"\'=<>`\x00-\x20]+'; + public const PARTIAL_SINGLEQUOTEDVALUE = '\'[^\']*\''; + public const PARTIAL_DOUBLEQUOTEDVALUE = '"[^"]*"'; + public const PARTIAL_ATTRIBUTEVALUE = '(?:' . self::PARTIAL_UNQUOTEDVALUE . '|' . self::PARTIAL_SINGLEQUOTEDVALUE . '|' . self::PARTIAL_DOUBLEQUOTEDVALUE . ')'; + public const PARTIAL_ATTRIBUTEVALUESPEC = '(?:' . '\s*=' . '\s*' . self::PARTIAL_ATTRIBUTEVALUE . ')'; + public const PARTIAL_ATTRIBUTE = '(?:' . '\s+' . self::PARTIAL_ATTRIBUTENAME . self::PARTIAL_ATTRIBUTEVALUESPEC . '?)'; + public const PARTIAL_OPENTAG = '<' . self::PARTIAL_TAGNAME . self::PARTIAL_ATTRIBUTE . '*' . '\s*\/?>'; + public const PARTIAL_CLOSETAG = '<\/' . self::PARTIAL_TAGNAME . '\s*[>]'; + public const PARTIAL_OPENBLOCKTAG = '<' . self::PARTIAL_BLOCKTAGNAME . self::PARTIAL_ATTRIBUTE . '*' . '\s*\/?>'; + public const PARTIAL_CLOSEBLOCKTAG = '<\/' . self::PARTIAL_BLOCKTAGNAME . '\s*[>]'; + public const PARTIAL_HTMLCOMMENT = '<!-->|<!--->|<!--[\s\S]*?-->'; + public const PARTIAL_PROCESSINGINSTRUCTION = '[<][?][\s\S]*?[?][>]'; + public const PARTIAL_DECLARATION = '<![A-Za-z]+' . '[^>]*>'; + public const PARTIAL_CDATA = '<!\[CDATA\[[\s\S]*?]\]>'; + public const PARTIAL_HTMLTAG = '(?:' . self::PARTIAL_OPENTAG . '|' . self::PARTIAL_CLOSETAG . '|' . self::PARTIAL_HTMLCOMMENT . '|' . + self::PARTIAL_PROCESSINGINSTRUCTION . '|' . self::PARTIAL_DECLARATION . '|' . self::PARTIAL_CDATA . ')'; + public const PARTIAL_HTMLBLOCKOPEN = '<(?:' . self::PARTIAL_BLOCKTAGNAME . '(?:[\s\/>]|$)' . '|' . + '\/' . self::PARTIAL_BLOCKTAGNAME . '(?:[\s>]|$)' . '|' . '[?!])'; + public const PARTIAL_LINK_TITLE = '^(?:"(' . self::PARTIAL_ESCAPED_CHAR . '|[^"\x00])*"' . + '|' . '\'(' . self::PARTIAL_ESCAPED_CHAR . '|[^\'\x00])*\'' . + '|' . '\((' . self::PARTIAL_ESCAPED_CHAR . '|[^()\x00])*\))'; + + public const REGEX_PUNCTUATION = '/^[!"#$%&\'()*+,\-.\\/:;<=>?@\\[\\]\\\\^_`{|}~\p{P}\p{S}]/u'; + public const REGEX_UNSAFE_PROTOCOL = '/^javascript:|vbscript:|file:|data:/i'; + public const REGEX_SAFE_DATA_PROTOCOL = '/^data:image\/(?:png|gif|jpeg|webp)/i'; + public const REGEX_NON_SPACE = '/[^ \t\f\v\r\n]/'; + + public const REGEX_WHITESPACE_CHAR = '/^[ \t\n\x0b\x0c\x0d]/'; + public const REGEX_UNICODE_WHITESPACE_CHAR = '/^\pZ|\s/u'; + public const REGEX_THEMATIC_BREAK = '/^(?:\*[ \t]*){3,}$|^(?:_[ \t]*){3,}$|^(?:-[ \t]*){3,}$/'; + public const REGEX_LINK_DESTINATION_BRACES = '/^(?:<(?:[^<>\\n\\\\\\x00]|\\\\.)*>)/'; + + /** + * @psalm-pure + */ + public static function isEscapable(string $character): bool + { + return \preg_match('/' . self::PARTIAL_ESCAPABLE . '/', $character) === 1; + } + + /** + * @psalm-pure + */ + public static function isLetter(?string $character): bool + { + if ($character === null) { + return false; + } + + return \preg_match('/[\pL]/u', $character) === 1; + } + + /** + * Attempt to match a regex in string s at offset offset + * + * @psalm-param non-empty-string $regex + * + * @return int|null Index of match, or null + * + * @psalm-pure + */ + public static function matchAt(string $regex, string $string, int $offset = 0): ?int + { + $matches = []; + $string = \mb_substr($string, $offset, null, 'UTF-8'); + if (! \preg_match($regex, $string, $matches, \PREG_OFFSET_CAPTURE)) { + return null; + } + + // PREG_OFFSET_CAPTURE always returns the byte offset, not the char offset, which is annoying + $charPos = \mb_strlen(\mb_strcut($string, 0, $matches[0][1], 'UTF-8'), 'UTF-8'); + + return $offset + $charPos; + } + + /** + * Functional wrapper around preg_match_all which only returns the first set of matches + * + * @psalm-param non-empty-string $pattern + * + * @return string[]|null + * + * @psalm-pure + */ + public static function matchFirst(string $pattern, string $subject, int $offset = 0): ?array + { + if ($offset !== 0) { + $subject = \substr($subject, $offset); + } + + \preg_match_all($pattern, $subject, $matches, \PREG_SET_ORDER); + + if ($matches === []) { + return null; + } + + return $matches[0] ?: null; + } + + /** + * Replace backslash escapes with literal characters + * + * @psalm-pure + */ + public static function unescape(string $string): string + { + $allEscapedChar = '/\\\\(' . self::PARTIAL_ESCAPABLE . ')/'; + + $escaped = \preg_replace($allEscapedChar, '$1', $string); + \assert(\is_string($escaped)); + + return \preg_replace_callback('/' . self::PARTIAL_ENTITY . '/i', static fn ($e) => Html5EntityDecoder::decode($e[0]), $escaped); + } + + /** + * @internal + * + * @param int $type HTML block type + * + * @psalm-param HtmlBlock::TYPE_* $type + * + * @phpstan-param HtmlBlock::TYPE_* $type + * + * @psalm-return non-empty-string + * + * @throws InvalidArgumentException if an invalid type is given + * + * @psalm-pure + */ + public static function getHtmlBlockOpenRegex(int $type): string + { + switch ($type) { + case HtmlBlock::TYPE_1_CODE_CONTAINER: + return '/^<(?:script|pre|textarea|style)(?:\s|>|$)/i'; + case HtmlBlock::TYPE_2_COMMENT: + return '/^<!--/'; + case HtmlBlock::TYPE_3: + return '/^<[?]/'; + case HtmlBlock::TYPE_4: + return '/^<![A-Z]/i'; + case HtmlBlock::TYPE_5_CDATA: + return '/^<!\[CDATA\[/i'; + case HtmlBlock::TYPE_6_BLOCK_ELEMENT: + return '%^<[/]?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[123456]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|[/]?[>]|$)%i'; + case HtmlBlock::TYPE_7_MISC_ELEMENT: + return '/^(?:' . self::PARTIAL_OPENTAG . '|' . self::PARTIAL_CLOSETAG . ')\\s*$/i'; + default: + throw new InvalidArgumentException('Invalid HTML block type'); + } + } + + /** + * @internal + * + * @param int $type HTML block type + * + * @psalm-param HtmlBlock::TYPE_* $type + * + * @phpstan-param HtmlBlock::TYPE_* $type + * + * @psalm-return non-empty-string + * + * @throws InvalidArgumentException if an invalid type is given + * + * @psalm-pure + */ + public static function getHtmlBlockCloseRegex(int $type): string + { + switch ($type) { + case HtmlBlock::TYPE_1_CODE_CONTAINER: + return '%<\/(?:script|pre|textarea|style)>%i'; + case HtmlBlock::TYPE_2_COMMENT: + return '/-->/'; + case HtmlBlock::TYPE_3: + return '/\?>/'; + case HtmlBlock::TYPE_4: + return '/>/'; + case HtmlBlock::TYPE_5_CDATA: + return '/\]\]>/'; + default: + throw new InvalidArgumentException('Invalid HTML block type'); + } + } + + /** + * @psalm-pure + */ + public static function isLinkPotentiallyUnsafe(string $url): bool + { + return \preg_match(self::REGEX_UNSAFE_PROTOCOL, $url) !== 0 && \preg_match(self::REGEX_SAFE_DATA_PROTOCOL, $url) === 0; + } +} diff --git a/vendor/league/commonmark/src/Util/SpecReader.php b/vendor/league/commonmark/src/Util/SpecReader.php new file mode 100644 index 00000000..7523304e --- /dev/null +++ b/vendor/league/commonmark/src/Util/SpecReader.php @@ -0,0 +1,71 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Util; + +use League\CommonMark\Exception\IOException; + +/** + * Reads in a CommonMark spec document and extracts the input/output examples for testing against them + */ +final class SpecReader +{ + private function __construct() + { + } + + /** + * @return iterable<string, array{input: string, output: string, type: string, section: string, number: int}> + */ + public static function read(string $data): iterable + { + // Normalize newlines for platform independence + $data = \preg_replace('/\r\n?/', "\n", $data); + \assert($data !== null); + $data = \preg_replace('/<!-- END TESTS -->.*$/', '', $data); + \assert($data !== null); + \preg_match_all('/^`{32} (example ?\w*)\n([\s\S]*?)^\.\n([\s\S]*?)^`{32}$|^#{1,6} *(.*)$/m', $data, $matches, PREG_SET_ORDER); + + $currentSection = 'Example'; + $exampleNumber = 0; + + foreach ($matches as $match) { + if (isset($match[4])) { + $currentSection = $match[4]; + continue; + } + + yield \trim($currentSection . ' #' . $exampleNumber) => [ + 'input' => \str_replace('→', "\t", $match[2]), + 'output' => \str_replace('→', "\t", $match[3]), + 'type' => $match[1], + 'section' => $currentSection, + 'number' => $exampleNumber++, + ]; + } + } + + /** + * @return iterable<string, array{input: string, output: string, type: string, section: string, number: int}> + * + * @throws IOException if the file cannot be loaded + */ + public static function readFile(string $filename): iterable + { + if (($data = \file_get_contents($filename)) === false) { + throw new IOException(\sprintf('Failed to load spec from %s', $filename)); + } + + return self::read($data); + } +} diff --git a/vendor/league/commonmark/src/Util/UrlEncoder.php b/vendor/league/commonmark/src/Util/UrlEncoder.php new file mode 100644 index 00000000..bba1af34 --- /dev/null +++ b/vendor/league/commonmark/src/Util/UrlEncoder.php @@ -0,0 +1,69 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Util; + +use League\CommonMark\Exception\UnexpectedEncodingException; + +/** + * @psalm-immutable + */ +final class UrlEncoder +{ + private const ENCODE_CACHE = ['%00', '%01', '%02', '%03', '%04', '%05', '%06', '%07', '%08', '%09', '%0A', '%0B', '%0C', '%0D', '%0E', '%0F', '%10', '%11', '%12', '%13', '%14', '%15', '%16', '%17', '%18', '%19', '%1A', '%1B', '%1C', '%1D', '%1E', '%1F', '%20', '!', '%22', '#', '$', '%25', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '%3C', '=', '%3E', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '%5B', '%5C', '%5D', '%5E', '_', '%60', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '%7B', '%7C', '%7D', '~', '%7F']; + + /** + * @throws UnexpectedEncodingException if a non-UTF-8-compatible encoding is used + * + * @psalm-pure + */ + public static function unescapeAndEncode(string $uri): string + { + // Optimization: if the URL only includes characters we know will be kept as-is, then just return the URL as-is. + if (\preg_match('/^[A-Za-z0-9~!@#$&*()\-_=+;:,.\/?]+$/', $uri)) { + return $uri; + } + + if (! \mb_check_encoding($uri, 'UTF-8')) { + throw new UnexpectedEncodingException('Unexpected encoding - UTF-8 or ASCII was expected'); + } + + $result = ''; + + $chars = \mb_str_split($uri, 1, 'UTF-8'); + + $l = \count($chars); + for ($i = 0; $i < $l; $i++) { + $code = $chars[$i]; + if ($code === '%' && $i + 2 < $l) { + if (\preg_match('/^[0-9a-f]{2}$/i', $chars[$i + 1] . $chars[$i + 2]) === 1) { + $result .= '%' . $chars[$i + 1] . $chars[$i + 2]; + $i += 2; + continue; + } + } + + if (\ord($code) < 128) { + $result .= self::ENCODE_CACHE[\ord($code)]; + continue; + } + + $result .= \rawurlencode($code); + } + + return $result; + } +} diff --git a/vendor/league/commonmark/src/Util/Xml.php b/vendor/league/commonmark/src/Util/Xml.php new file mode 100644 index 00000000..8f9e84d0 --- /dev/null +++ b/vendor/league/commonmark/src/Util/Xml.php @@ -0,0 +1,33 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) + * - (c) John MacFarlane + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Util; + +/** + * Utility class for handling/generating XML and HTML + * + * @psalm-immutable + */ +final class Xml +{ + /** + * @psalm-pure + */ + public static function escape(string $string): string + { + return \str_replace(['&', '<', '>', '"'], ['&', '<', '>', '"'], $string); + } +} diff --git a/vendor/league/commonmark/src/Xml/FallbackNodeXmlRenderer.php b/vendor/league/commonmark/src/Xml/FallbackNodeXmlRenderer.php new file mode 100644 index 00000000..48aa3c8e --- /dev/null +++ b/vendor/league/commonmark/src/Xml/FallbackNodeXmlRenderer.php @@ -0,0 +1,85 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Xml; + +use League\CommonMark\Node\Block\AbstractBlock; +use League\CommonMark\Node\Inline\AbstractInline; +use League\CommonMark\Node\Node; + +/** + * @internal + */ +final class FallbackNodeXmlRenderer implements XmlNodeRendererInterface +{ + /** + * @var array<string, string> + * + * @psalm-allow-private-mutation + */ + private array $classCache = []; + + /** + * @psalm-allow-private-mutation + */ + public function getXmlTagName(Node $node): string + { + $className = \get_class($node); + if (isset($this->classCache[$className])) { + return $this->classCache[$className]; + } + + $type = $node instanceof AbstractBlock ? 'block' : 'inline'; + $shortName = \strtolower((new \ReflectionClass($node))->getShortName()); + + return $this->classCache[$className] = \sprintf('custom_%s_%s', $type, $shortName); + } + + /** + * {@inheritDoc} + */ + public function getXmlAttributes(Node $node): array + { + $attrs = []; + foreach ($node->data->export() as $k => $v) { + if (self::isValueUsable($v)) { + $attrs[$k] = $v; + } + } + + $reflClass = new \ReflectionClass($node); + foreach ($reflClass->getProperties() as $property) { + if (\in_array($property->getDeclaringClass()->getName(), [Node::class, AbstractBlock::class, AbstractInline::class], true)) { + continue; + } + + $property->setAccessible(true); + $value = $property->getValue($node); + if (self::isValueUsable($value)) { + $attrs[$property->getName()] = $value; + } + } + + return $attrs; + } + + /** + * @param mixed $var + * + * @psalm-pure + */ + private static function isValueUsable($var): bool + { + return \is_string($var) || \is_int($var) || \is_float($var) || \is_bool($var); + } +} diff --git a/vendor/league/commonmark/src/Xml/MarkdownToXmlConverter.php b/vendor/league/commonmark/src/Xml/MarkdownToXmlConverter.php new file mode 100644 index 00000000..538ad984 --- /dev/null +++ b/vendor/league/commonmark/src/Xml/MarkdownToXmlConverter.php @@ -0,0 +1,59 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Xml; + +use League\CommonMark\ConverterInterface; +use League\CommonMark\Environment\EnvironmentInterface; +use League\CommonMark\Exception\CommonMarkException; +use League\CommonMark\Output\RenderedContentInterface; +use League\CommonMark\Parser\MarkdownParser; +use League\CommonMark\Parser\MarkdownParserInterface; +use League\CommonMark\Renderer\DocumentRendererInterface; + +final class MarkdownToXmlConverter implements ConverterInterface +{ + /** @psalm-readonly */ + private MarkdownParserInterface $parser; + + /** @psalm-readonly */ + private DocumentRendererInterface $renderer; + + public function __construct(EnvironmentInterface $environment) + { + $this->parser = new MarkdownParser($environment); + $this->renderer = new XmlRenderer($environment); + } + + /** + * Converts Markdown to XML + * + * @throws CommonMarkException + */ + public function convert(string $input): RenderedContentInterface + { + return $this->renderer->renderDocument($this->parser->parse($input)); + } + + /** + * Converts CommonMark to HTML. + * + * @see MarkdownToXmlConverter::convert() + * + * @throws CommonMarkException + */ + public function __invoke(string $input): RenderedContentInterface + { + return $this->convert($input); + } +} diff --git a/vendor/league/commonmark/src/Xml/XmlNodeRendererInterface.php b/vendor/league/commonmark/src/Xml/XmlNodeRendererInterface.php new file mode 100644 index 00000000..aafc9f15 --- /dev/null +++ b/vendor/league/commonmark/src/Xml/XmlNodeRendererInterface.php @@ -0,0 +1,28 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/commonmark package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\CommonMark\Xml; + +use League\CommonMark\Node\Node; + +interface XmlNodeRendererInterface +{ + public function getXmlTagName(Node $node): string; + + /** + * @return array<string, string|int|float|bool> + * + * @psalm-return array<string, scalar> + */ + public function getXmlAttributes(Node $node): array; +} diff --git a/vendor/league/commonmark/src/Xml/XmlRenderer.php b/vendor/league/commonmark/src/Xml/XmlRenderer.php new file mode 100644 index 00000000..2973dd7a --- /dev/null +++ b/vendor/league/commonmark/src/Xml/XmlRenderer.php @@ -0,0 +1,135 @@ +<?php + +declare(strict_types=1); + +namespace League\CommonMark\Xml; + +use League\CommonMark\Environment\EnvironmentInterface; +use League\CommonMark\Event\DocumentPreRenderEvent; +use League\CommonMark\Exception\InvalidArgumentException; +use League\CommonMark\Node\Block\Document; +use League\CommonMark\Node\Node; +use League\CommonMark\Node\StringContainerInterface; +use League\CommonMark\Output\RenderedContent; +use League\CommonMark\Output\RenderedContentInterface; +use League\CommonMark\Renderer\DocumentRendererInterface; +use League\CommonMark\Util\Xml; + +final class XmlRenderer implements DocumentRendererInterface +{ + private const INDENTATION = ' '; + + private EnvironmentInterface $environment; + + private XmlNodeRendererInterface $fallbackRenderer; + + /** @var array<class-string, XmlNodeRendererInterface> */ + private array $rendererCache = []; + + public function __construct(EnvironmentInterface $environment) + { + $this->environment = $environment; + $this->fallbackRenderer = new FallbackNodeXmlRenderer(); + } + + public function renderDocument(Document $document): RenderedContentInterface + { + $this->environment->dispatch(new DocumentPreRenderEvent($document, 'xml')); + + $xml = '<?xml version="1.0" encoding="UTF-8"?>'; + + $indent = 0; + $walker = $document->walker(); + while ($event = $walker->next()) { + $node = $event->getNode(); + + $closeImmediately = ! $node->hasChildren(); + $selfClosing = $closeImmediately && ! $node instanceof StringContainerInterface; + + $renderer = $this->findXmlRenderer($node); + $tagName = $renderer->getXmlTagName($node); + + if ($event->isEntering()) { + $attrs = $renderer->getXmlAttributes($node); + + $xml .= "\n" . \str_repeat(self::INDENTATION, $indent); + $xml .= self::tag($tagName, $attrs, $selfClosing); + + if ($node instanceof StringContainerInterface) { + $xml .= Xml::escape($node->getLiteral()); + } + + if ($closeImmediately && ! $selfClosing) { + $xml .= self::tag('/' . $tagName); + } + + if (! $closeImmediately) { + $indent++; + } + } elseif (! $closeImmediately) { + $indent--; + $xml .= "\n" . \str_repeat(self::INDENTATION, $indent); + $xml .= self::tag('/' . $tagName); + } + } + + return new RenderedContent($document, $xml . "\n"); + } + + /** + * @param array<string, string|int|float|bool> $attrs + */ + private static function tag(string $name, array $attrs = [], bool $selfClosing = \false): string + { + $result = '<' . $name; + foreach ($attrs as $key => $value) { + $result .= \sprintf(' %s="%s"', $key, self::convertAndEscape($value)); + } + + if ($selfClosing) { + $result .= ' /'; + } + + $result .= '>'; + + return $result; + } + + /** + * @param string|int|float|bool $value + */ + private static function convertAndEscape($value): string + { + if (\is_string($value)) { + return Xml::escape($value); + } + + if (\is_int($value) || \is_float($value)) { + return (string) $value; + } + + if (\is_bool($value)) { + return $value ? 'true' : 'false'; + } + + // @phpstan-ignore-next-line + throw new InvalidArgumentException('$value must be a string, int, float, or bool'); + } + + private function findXmlRenderer(Node $node): XmlNodeRendererInterface + { + $class = \get_class($node); + + if (\array_key_exists($class, $this->rendererCache)) { + return $this->rendererCache[$class]; + } + + foreach ($this->environment->getRenderersForClass($class) as $renderer) { + if ($renderer instanceof XmlNodeRendererInterface) { + return $this->rendererCache[$class] = $renderer; + } + } + + return $this->rendererCache[$class] = $this->fallbackRenderer; + } +} diff --git a/vendor/league/config/CHANGELOG.md b/vendor/league/config/CHANGELOG.md new file mode 100644 index 00000000..9a7813ac --- /dev/null +++ b/vendor/league/config/CHANGELOG.md @@ -0,0 +1,42 @@ +# Change Log +All notable changes to this project will be documented in this file. +Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) principles. + +## [Unreleased][unreleased] + +## [1.2.0] - 2022-12-11 + +### Changed + +- Values can now be set prior to the corresponding schema being registered. +- `exists()` and `get()` now only trigger validation for the relevant schema, not the entire config at once. + +## [1.1.1] - 2021-08-14 + +### Changed + + - Bumped the minimum version of dflydev/dot-access-data for PHP 8.1 support + +## [1.1.0] - 2021-06-19 + +### Changed + +- Bumped the minimum PHP version to 7.4+ +- Bumped the minimum version of nette/schema to 1.2.0 + +## [1.0.1] - 2021-05-31 + +### Fixed + +- Fixed the `ConfigurationExceptionInterface` marker interface not extending `Throwable` (#2) + +## [1.0.0] - 2021-05-31 + +Initial release! 🎉 + +[unreleased]: https://github.com/thephpleague/config/compare/v1.2.0...main +[1.2.0]: https://github.com/thephpleague/config/compare/v1.1.1...v.1.2.0 +[1.1.1]: https://github.com/thephpleague/config/compare/v1.1.0...v1.1.1 +[1.1.0]: https://github.com/thephpleague/config/compare/v1.0.1...v1.1.0 +[1.0.1]: https://github.com/thephpleague/config/compare/v1.0.0...v1.0.1 +[1.0.0]: https://github.com/thephpleague/config/releases/tag/v1.0.0 diff --git a/vendor/league/config/LICENSE.md b/vendor/league/config/LICENSE.md new file mode 100644 index 00000000..1a444a17 --- /dev/null +++ b/vendor/league/config/LICENSE.md @@ -0,0 +1,28 @@ +BSD 3-Clause License + +Copyright (c) 2022, Colin O'Dell. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/league/config/README.md b/vendor/league/config/README.md new file mode 100644 index 00000000..23047465 --- /dev/null +++ b/vendor/league/config/README.md @@ -0,0 +1,153 @@ +# league/config + +[![Latest Version](https://img.shields.io/packagist/v/league/config.svg?style=flat-square)](https://packagist.org/packages/league/config) +[![Total Downloads](https://img.shields.io/packagist/dt/league/config.svg?style=flat-square)](https://packagist.org/packages/league/config) +[![Software License](https://img.shields.io/badge/License-BSD--3-brightgreen.svg?style=flat-square)](LICENSE) +[![Build Status](https://img.shields.io/github/workflow/status/thephpleague/config/Tests/main.svg?style=flat-square)](https://github.com/thephpleague/config/actions?query=workflow%3ATests+branch%3Amain) +[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/thephpleague/config.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/config/code-structure) +[![Quality Score](https://img.shields.io/scrutinizer/g/thephpleague/config.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/config) +[![Sponsor development of this project](https://img.shields.io/badge/sponsor%20this%20package-%E2%9D%A4-ff69b4.svg?style=flat-square)](https://www.colinodell.com/sponsor) + +**league/config** helps you define nested configuration arrays with strict schemas and access configuration values with dot notation. It was created by [Colin O'Dell][@colinodell]. + +## 📦 Installation + +This project requires PHP 7.4 or higher. To install it via [Composer] simply run: + +```bash +composer require league/config +``` + +## 🧰️ Basic Usage + +The `Configuration` class provides everything you need to define the configuration structure and fetch values: + +```php +use League\Config\Configuration; +use Nette\Schema\Expect; + +// Define your configuration schema +$config = new Configuration([ + 'database' => Expect::structure([ + 'driver' => Expect::anyOf('mysql', 'postgresql', 'sqlite')->required(), + 'host' => Expect::string()->default('localhost'), + 'port' => Expect::int()->min(1)->max(65535), + 'ssl' => Expect::bool(), + 'database' => Expect::string()->required(), + 'username' => Expect::string()->required(), + 'password' => Expect::string()->nullable(), + ]), + 'logging' => Expect::structure([ + 'enabled' => Expect::bool()->default($_ENV['DEBUG'] == true), + 'file' => Expect::string()->deprecated("use logging.path instead"), + 'path' => Expect::string()->assert(function ($path) { return \is_writeable($path); })->required(), + ]), +]); + +// Set the values, either all at once with `merge()`: +$config->merge([ + 'database' => [ + 'driver' => 'mysql', + 'port' => 3306, + 'database' => 'mydb', + 'username' => 'user', + 'password' => 'secret', + ], +]); + +// Or one-at-a-time with `set()`: +$config->set('logging.path', '/var/log/myapp.log'); + +// You can now retrieve those values with `get()`. +// Validation and defaults will be applied for you automatically +$config->get('database'); // Fetches the entire "database" section as an array +$config->get('database.driver'); // Fetch a specific nested value with dot notation +$config->get('database/driver'); // Fetch a specific nested value with slash notation +$config->get('database.host'); // Returns the default value "localhost" +$config->get('logging.path'); // Guaranteed to be writeable thanks to the assertion in the schema + +// If validation fails an `InvalidConfigurationException` will be thrown: +$config->set('database.driver', 'mongodb'); +$config->get('database.driver'); // InvalidConfigurationException + +// Attempting to fetch a non-existent key will result in an `InvalidConfigurationException` +$config->get('foo.bar'); + +// You could avoid this by checking whether that item exists: +$config->exists('foo.bar'); // Returns `false` +``` + +## 📓 Documentation + +Full documentation can be found at [config.thephpleague.com][docs]. + +## 💭 Philosophy + +This library aims to provide a **simple yet opinionated** approach to configuration with the following goals: + +- The configuration should operate on **arrays with nested values** which are easily accessible +- The configuration structure should be **defined with strict schemas** defining the overall structure, allowed types, and allowed values +- Schemas should be defined using a **simple, fluent interface** +- You should be able to **add and combine schemas but never modify existing ones** +- Both the configuration values and the schema should be **defined and managed with PHP code** +- Schemas should be **immutable**; they should never change once they are set +- Configuration values should never define or influence the schemas + +As a result, this library will likely **never** support features like: + +- Loading and/or exporting configuration values or schemas using YAML, XML, or other files +- Parsing configuration values from a command line or other user interface +- Dynamically changing the schema, allowed values, or default values based on other configuration values + +If you need that functionality you should check out other libraries like: + +- [symfony/config] +- [symfony/options-resolver] +- [hassankhan/config] +- [consolidation/config] +- [laminas/laminas-config] + +## 🏷️ Versioning + +[SemVer](http://semver.org/) is followed closely. Minor and patch releases should not introduce breaking changes to the codebase. + +Any classes or methods marked `@internal` are not intended for use outside this library and are subject to breaking changes at any time, so please avoid using them. + +## 🛠️ Maintenance & Support + +When a new **minor** version (e.g. `1.0` -> `1.1`) is released, the previous one (`1.0`) will continue to receive security and critical bug fixes for *at least* 3 months. + +When a new **major** version is released (e.g. `1.1` -> `2.0`), the previous one (`1.1`) will receive critical bug fixes for *at least* 3 months and security updates for 6 months after that new release comes out. + +(This policy may change in the future and exceptions may be made on a case-by-case basis.) + +## 👷‍️ Contributing + +Contributions to this library are **welcome**! We only ask that you adhere to our [contributor guidelines] and avoid making changes that conflict with our Philosophy above. + +## 🧪 Testing + +```bash +composer test +``` + +## 📄 License + +**league/config** is licensed under the BSD-3 license. See the [`LICENSE.md`][license] file for more details. + +## 🗺️ Who Uses It? + +This project is used by [league/commonmark][league-commonmark]. + +[docs]: https://config.thephpleague.com/ +[@colinodell]: https://www.twitter.com/colinodell +[Composer]: https://getcomposer.org/ +[PHP League]: https://thephpleague.com +[symfony/config]: https://symfony.com/doc/current/components/config.html +[symfony/options-resolver]: https://symfony.com/doc/current/components/options_resolver.html +[hassankhan/config]: https://github.com/hassankhan/config +[consolidation/config]: https://github.com/consolidation/config +[laminas/laminas-config]: https://docs.laminas.dev/laminas-config/ +[contributor guidelines]: https://github.com/thephpleague/config/blob/main/.github/CONTRIBUTING.md +[license]: https://github.com/thephpleague/config/blob/main/LICENSE.md +[league-commonmark]: https://commonmark.thephpleague.com diff --git a/vendor/league/config/composer.json b/vendor/league/config/composer.json new file mode 100644 index 00000000..3cd8d87e --- /dev/null +++ b/vendor/league/config/composer.json @@ -0,0 +1,69 @@ +{ + "name": "league/config", + "type": "library", + "description": "Define configuration arrays with strict schemas and access values with dot notation", + "keywords": ["configuration","config","schema","array","nested","dot","dot-access"], + "homepage": "https://config.thephpleague.com", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Colin O'Dell", + "email": "colinodell@gmail.com", + "homepage": "https://www.colinodell.com", + "role": "Lead Developer" + } + ], + "support": { + "docs": "https://config.thephpleague.com/", + "issues": "https://github.com/thephpleague/config/issues", + "rss": "https://github.com/thephpleague/config/releases.atom", + "source": "https://github.com/thephpleague/config" + }, + "require": { + "php": "^7.4 || ^8.0", + "dflydev/dot-access-data": "^3.0.1", + "nette/schema": "^1.2" + }, + "require-dev": { + "phpstan/phpstan": "^1.8.2", + "phpunit/phpunit": "^9.5.5", + "scrutinizer/ocular": "^1.8.1", + "unleashedtech/php-coding-standard": "^3.1", + "vimeo/psalm": "^4.7.3" + }, + "minimum-stability": "dev", + "prefer-stable": true, + "autoload": { + "psr-4": { + "League\\Config\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "League\\Config\\Tests\\": "tests" + } + }, + "scripts": { + "phpcs": "phpcs", + "phpstan": "phpstan analyse", + "phpunit": "phpunit --no-coverage", + "psalm": "psalm", + "test": [ + "@phpcs", + "@phpstan", + "@psalm", + "@phpunit" + ] + }, + "extra": { + "branch-alias": { + "dev-main": "1.2-dev" + } + }, + "config": { + "sort-packages": true, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + } +} diff --git a/vendor/league/config/src/Configuration.php b/vendor/league/config/src/Configuration.php new file mode 100644 index 00000000..62943678 --- /dev/null +++ b/vendor/league/config/src/Configuration.php @@ -0,0 +1,255 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/config package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\Config; + +use Dflydev\DotAccessData\Data; +use Dflydev\DotAccessData\DataInterface; +use Dflydev\DotAccessData\Exception\DataException; +use Dflydev\DotAccessData\Exception\InvalidPathException; +use Dflydev\DotAccessData\Exception\MissingPathException; +use League\Config\Exception\UnknownOptionException; +use League\Config\Exception\ValidationException; +use Nette\Schema\Expect; +use Nette\Schema\Processor; +use Nette\Schema\Schema; +use Nette\Schema\ValidationException as NetteValidationException; + +final class Configuration implements ConfigurationBuilderInterface, ConfigurationInterface +{ + /** @psalm-readonly */ + private Data $userConfig; + + /** + * @var array<string, Schema> + * + * @psalm-allow-private-mutation + */ + private array $configSchemas = []; + + /** @psalm-allow-private-mutation */ + private Data $finalConfig; + + /** + * @var array<string, mixed> + * + * @psalm-allow-private-mutation + */ + private array $cache = []; + + /** @psalm-readonly */ + private ConfigurationInterface $reader; + + /** + * @param array<string, Schema> $baseSchemas + */ + public function __construct(array $baseSchemas = []) + { + $this->configSchemas = $baseSchemas; + $this->userConfig = new Data(); + $this->finalConfig = new Data(); + + $this->reader = new ReadOnlyConfiguration($this); + } + + /** + * Registers a new configuration schema at the given top-level key + * + * @psalm-allow-private-mutation + */ + public function addSchema(string $key, Schema $schema): void + { + $this->invalidate(); + + $this->configSchemas[$key] = $schema; + } + + /** + * {@inheritDoc} + * + * @psalm-allow-private-mutation + */ + public function merge(array $config = []): void + { + $this->invalidate(); + + $this->userConfig->import($config, DataInterface::REPLACE); + } + + /** + * {@inheritDoc} + * + * @psalm-allow-private-mutation + */ + public function set(string $key, $value): void + { + $this->invalidate(); + + try { + $this->userConfig->set($key, $value); + } catch (DataException $ex) { + throw new UnknownOptionException($ex->getMessage(), $key, (int) $ex->getCode(), $ex); + } + } + + /** + * {@inheritDoc} + * + * @psalm-external-mutation-free + */ + public function get(string $key) + { + if (\array_key_exists($key, $this->cache)) { + return $this->cache[$key]; + } + + try { + $this->build(self::getTopLevelKey($key)); + + return $this->cache[$key] = $this->finalConfig->get($key); + } catch (InvalidPathException | MissingPathException $ex) { + throw new UnknownOptionException($ex->getMessage(), $key, (int) $ex->getCode(), $ex); + } + } + + /** + * {@inheritDoc} + * + * @psalm-external-mutation-free + */ + public function exists(string $key): bool + { + if (\array_key_exists($key, $this->cache)) { + return true; + } + + try { + $this->build(self::getTopLevelKey($key)); + + return $this->finalConfig->has($key); + } catch (InvalidPathException | UnknownOptionException $ex) { + return false; + } + } + + /** + * @psalm-mutation-free + */ + public function reader(): ConfigurationInterface + { + return $this->reader; + } + + /** + * @psalm-external-mutation-free + */ + private function invalidate(): void + { + $this->cache = []; + $this->finalConfig = new Data(); + } + + /** + * Applies the schema against the configuration to return the final configuration + * + * @throws ValidationException|UnknownOptionException|InvalidPathException + * + * @psalm-allow-private-mutation + */ + private function build(string $topLevelKey): void + { + if ($this->finalConfig->has($topLevelKey)) { + return; + } + + if (! isset($this->configSchemas[$topLevelKey])) { + throw new UnknownOptionException(\sprintf('Missing config schema for "%s"', $topLevelKey), $topLevelKey); + } + + try { + $userData = [$topLevelKey => $this->userConfig->get($topLevelKey)]; + } catch (DataException $ex) { + $userData = []; + } + + try { + $schema = $this->configSchemas[$topLevelKey]; + $processor = new Processor(); + + $processed = $processor->process(Expect::structure([$topLevelKey => $schema]), $userData); + + $this->raiseAnyDeprecationNotices($processor->getWarnings()); + + $this->finalConfig->import((array) self::convertStdClassesToArrays($processed)); + } catch (NetteValidationException $ex) { + throw new ValidationException($ex); + } + } + + /** + * Recursively converts stdClass instances to arrays + * + * @phpstan-template T + * + * @param T $data + * + * @return mixed + * + * @phpstan-return ($data is \stdClass ? array<string, mixed> : T) + * + * @psalm-pure + */ + private static function convertStdClassesToArrays($data) + { + if ($data instanceof \stdClass) { + $data = (array) $data; + } + + if (\is_array($data)) { + foreach ($data as $k => $v) { + $data[$k] = self::convertStdClassesToArrays($v); + } + } + + return $data; + } + + /** + * @param string[] $warnings + */ + private function raiseAnyDeprecationNotices(array $warnings): void + { + foreach ($warnings as $warning) { + @\trigger_error($warning, \E_USER_DEPRECATED); + } + } + + /** + * @throws InvalidPathException + */ + private static function getTopLevelKey(string $path): string + { + if (\strlen($path) === 0) { + throw new InvalidPathException('Path cannot be an empty string'); + } + + $path = \str_replace(['.', '/'], '.', $path); + + $firstDelimiter = \strpos($path, '.'); + if ($firstDelimiter === false) { + return $path; + } + + return \substr($path, 0, $firstDelimiter); + } +} diff --git a/vendor/league/config/src/ConfigurationAwareInterface.php b/vendor/league/config/src/ConfigurationAwareInterface.php new file mode 100644 index 00000000..ec5d7b36 --- /dev/null +++ b/vendor/league/config/src/ConfigurationAwareInterface.php @@ -0,0 +1,22 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/config package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\Config; + +/** + * Implement this class to facilitate setter injection of the configuration where needed + */ +interface ConfigurationAwareInterface +{ + public function setConfiguration(ConfigurationInterface $configuration): void; +} diff --git a/vendor/league/config/src/ConfigurationBuilderInterface.php b/vendor/league/config/src/ConfigurationBuilderInterface.php new file mode 100644 index 00000000..e9c5ed6c --- /dev/null +++ b/vendor/league/config/src/ConfigurationBuilderInterface.php @@ -0,0 +1,21 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/config package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\Config; + +/** + * An interface that provides the ability to set both the schema and configuration values + */ +interface ConfigurationBuilderInterface extends MutableConfigurationInterface, SchemaBuilderInterface +{ +} diff --git a/vendor/league/config/src/ConfigurationInterface.php b/vendor/league/config/src/ConfigurationInterface.php new file mode 100644 index 00000000..534bd9fd --- /dev/null +++ b/vendor/league/config/src/ConfigurationInterface.php @@ -0,0 +1,46 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/config package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\Config; + +use League\Config\Exception\UnknownOptionException; +use League\Config\Exception\ValidationException; + +/** + * Interface for reading configuration values + */ +interface ConfigurationInterface +{ + /** + * @param string $key Configuration option path/key + * + * @psalm-param non-empty-string $key + * + * @return mixed + * + * @throws ValidationException if the schema failed to validate the given input + * @throws UnknownOptionException if the requested key does not exist or is malformed + */ + public function get(string $key); + + /** + * @param string $key Configuration option path/key + * + * @psalm-param non-empty-string $key + * + * @return bool Whether the given option exists + * + * @throws ValidationException if the schema failed to validate the given input + */ + public function exists(string $key): bool; +} diff --git a/vendor/league/config/src/ConfigurationProviderInterface.php b/vendor/league/config/src/ConfigurationProviderInterface.php new file mode 100644 index 00000000..7af6148b --- /dev/null +++ b/vendor/league/config/src/ConfigurationProviderInterface.php @@ -0,0 +1,22 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/config package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\Config; + +/** + * Interface for a service which provides a readable configuration object + */ +interface ConfigurationProviderInterface +{ + public function getConfiguration(): ConfigurationInterface; +} diff --git a/vendor/league/config/src/Exception/ConfigurationExceptionInterface.php b/vendor/league/config/src/Exception/ConfigurationExceptionInterface.php new file mode 100644 index 00000000..db9ee783 --- /dev/null +++ b/vendor/league/config/src/Exception/ConfigurationExceptionInterface.php @@ -0,0 +1,21 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/config package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\Config\Exception; + +/** + * Marker interface for any/all exceptions thrown by this library + */ +interface ConfigurationExceptionInterface extends \Throwable +{ +} diff --git a/vendor/league/config/src/Exception/InvalidConfigurationException.php b/vendor/league/config/src/Exception/InvalidConfigurationException.php new file mode 100644 index 00000000..f2a6b697 --- /dev/null +++ b/vendor/league/config/src/Exception/InvalidConfigurationException.php @@ -0,0 +1,46 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/config package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\Config\Exception; + +class InvalidConfigurationException extends \UnexpectedValueException implements ConfigurationExceptionInterface +{ + /** + * @param string $option Name/path of the option + * @param mixed $valueGiven The invalid option that was provided + * @param ?string $description Additional text describing the issue (optional) + */ + public static function forConfigOption(string $option, $valueGiven, ?string $description = null): self + { + $message = \sprintf('Invalid config option for "%s": %s', $option, self::getDebugValue($valueGiven)); + if ($description !== null) { + $message .= \sprintf(' (%s)', $description); + } + + return new self($message); + } + + /** + * @param mixed $value + * + * @psalm-pure + */ + private static function getDebugValue($value): string + { + if (\is_object($value)) { + return \get_class($value); + } + + return \print_r($value, true); + } +} diff --git a/vendor/league/config/src/Exception/UnknownOptionException.php b/vendor/league/config/src/Exception/UnknownOptionException.php new file mode 100644 index 00000000..5afba12a --- /dev/null +++ b/vendor/league/config/src/Exception/UnknownOptionException.php @@ -0,0 +1,33 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/config package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\Config\Exception; + +use Throwable; + +final class UnknownOptionException extends \InvalidArgumentException implements ConfigurationExceptionInterface +{ + private string $path; + + public function __construct(string $message, string $path, int $code = 0, ?Throwable $previous = null) + { + parent::__construct($message, $code, $previous); + + $this->path = $path; + } + + public function getPath(): string + { + return $this->path; + } +} diff --git a/vendor/league/config/src/Exception/ValidationException.php b/vendor/league/config/src/Exception/ValidationException.php new file mode 100644 index 00000000..b43e2f5c --- /dev/null +++ b/vendor/league/config/src/Exception/ValidationException.php @@ -0,0 +1,37 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/config package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\Config\Exception; + +use Nette\Schema\ValidationException as NetteException; + +final class ValidationException extends InvalidConfigurationException +{ + /** @var string[] */ + private array $messages; + + public function __construct(NetteException $innerException) + { + parent::__construct($innerException->getMessage(), (int) $innerException->getCode(), $innerException); + + $this->messages = $innerException->getMessages(); + } + + /** + * @return string[] + */ + public function getMessages(): array + { + return $this->messages; + } +} diff --git a/vendor/league/config/src/MutableConfigurationInterface.php b/vendor/league/config/src/MutableConfigurationInterface.php new file mode 100644 index 00000000..2d4b2ee8 --- /dev/null +++ b/vendor/league/config/src/MutableConfigurationInterface.php @@ -0,0 +1,34 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/config package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\Config; + +use League\Config\Exception\UnknownOptionException; + +/** + * Interface for setting/merging user-defined configuration values into the configuration object + */ +interface MutableConfigurationInterface +{ + /** + * @param mixed $value + * + * @throws UnknownOptionException if $key contains a nested path which doesn't point to an array value + */ + public function set(string $key, $value): void; + + /** + * @param array<string, mixed> $config + */ + public function merge(array $config = []): void; +} diff --git a/vendor/league/config/src/ReadOnlyConfiguration.php b/vendor/league/config/src/ReadOnlyConfiguration.php new file mode 100644 index 00000000..58e61719 --- /dev/null +++ b/vendor/league/config/src/ReadOnlyConfiguration.php @@ -0,0 +1,40 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/config package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\Config; + +/** + * Provides read-only access to a given Configuration object + */ +final class ReadOnlyConfiguration implements ConfigurationInterface +{ + private Configuration $config; + + public function __construct(Configuration $config) + { + $this->config = $config; + } + + /** + * {@inheritDoc} + */ + public function get(string $key) + { + return $this->config->get($key); + } + + public function exists(string $key): bool + { + return $this->config->exists($key); + } +} diff --git a/vendor/league/config/src/SchemaBuilderInterface.php b/vendor/league/config/src/SchemaBuilderInterface.php new file mode 100644 index 00000000..3a198078 --- /dev/null +++ b/vendor/league/config/src/SchemaBuilderInterface.php @@ -0,0 +1,27 @@ +<?php + +declare(strict_types=1); + +/* + * This file is part of the league/config package. + * + * (c) Colin O'Dell <colinodell@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace League\Config; + +use Nette\Schema\Schema; + +/** + * Interface that allows new schemas to be added to a configuration + */ +interface SchemaBuilderInterface +{ + /** + * Registers a new configuration schema at the given top-level key + */ + public function addSchema(string $key, Schema $schema): void; +} diff --git a/vendor/league/flysystem-cached-adapter/.editorconfig b/vendor/league/flysystem-cached-adapter/.editorconfig new file mode 100644 index 00000000..153cf3ef --- /dev/null +++ b/vendor/league/flysystem-cached-adapter/.editorconfig @@ -0,0 +1,10 @@ +; top-most EditorConfig file +root = true + +; Unix-style newlines +[*] +end_of_line = LF + +[*.php] +indent_style = space +indent_size = 4 diff --git a/vendor/league/flysystem-cached-adapter/.gitignore b/vendor/league/flysystem-cached-adapter/.gitignore new file mode 100644 index 00000000..7aea75f4 --- /dev/null +++ b/vendor/league/flysystem-cached-adapter/.gitignore @@ -0,0 +1,4 @@ +coverage +coverage.xml +composer.lock +vendor \ No newline at end of file diff --git a/vendor/league/flysystem-cached-adapter/.php_cs b/vendor/league/flysystem-cached-adapter/.php_cs new file mode 100644 index 00000000..6643a32c --- /dev/null +++ b/vendor/league/flysystem-cached-adapter/.php_cs @@ -0,0 +1,7 @@ +<?php + +return Symfony\CS\Config\Config::create() + ->level(Symfony\CS\FixerInterface::PSR2_LEVEL) + ->fixers(['-yoda_conditions', 'ordered_use', 'short_array_syntax']) + ->finder(Symfony\CS\Finder\DefaultFinder::create() + ->in(__DIR__.'/src/')); \ No newline at end of file diff --git a/vendor/league/flysystem-cached-adapter/.scrutinizer.yml b/vendor/league/flysystem-cached-adapter/.scrutinizer.yml new file mode 100644 index 00000000..fa39b52b --- /dev/null +++ b/vendor/league/flysystem-cached-adapter/.scrutinizer.yml @@ -0,0 +1,34 @@ +filter: + paths: [src/*] +checks: + php: + code_rating: true + remove_extra_empty_lines: true + remove_php_closing_tag: true + remove_trailing_whitespace: true + fix_use_statements: + remove_unused: true + preserve_multiple: false + preserve_blanklines: true + order_alphabetically: true + fix_php_opening_tag: true + fix_linefeed: true + fix_line_ending: true + fix_identation_4spaces: true + fix_doc_comments: true +tools: + external_code_coverage: + timeout: 900 + runs: 6 + php_code_coverage: false + php_code_sniffer: + config: + standard: PSR2 + filter: + paths: ['src'] + php_loc: + enabled: true + excluded_dirs: [vendor, spec, stubs] + php_cpd: + enabled: true + excluded_dirs: [vendor, spec, stubs] \ No newline at end of file diff --git a/vendor/league/flysystem-cached-adapter/.travis.yml b/vendor/league/flysystem-cached-adapter/.travis.yml new file mode 100644 index 00000000..6706449f --- /dev/null +++ b/vendor/league/flysystem-cached-adapter/.travis.yml @@ -0,0 +1,29 @@ +language: php + +php: + - 5.5 + - 5.6 + - 7.0 + - 7.1 + - 7.2 + +matrix: + allow_failures: + - php: 5.5 + +env: + - COMPOSER_OPTS="" + - COMPOSER_OPTS="--prefer-lowest" + +install: + - if [[ "${TRAVIS_PHP_VERSION}" == "5.5" ]]; then composer require phpunit/phpunit:^4.8.36 phpspec/phpspec:^2 --prefer-dist --update-with-dependencies; fi + - if [[ "${TRAVIS_PHP_VERSION}" == "7.2" ]]; then composer require phpunit/phpunit:^6.0 --prefer-dist --update-with-dependencies; fi + - travis_retry composer update --prefer-dist $COMPOSER_OPTS + +script: + - vendor/bin/phpspec run + - vendor/bin/phpunit + +after_script: + - wget https://scrutinizer-ci.com/ocular.phar' + - php ocular.phar code-coverage:upload --format=php-clover ./clover/phpunit.xml' diff --git a/vendor/league/flysystem-cached-adapter/LICENSE b/vendor/league/flysystem-cached-adapter/LICENSE new file mode 100644 index 00000000..666f6c82 --- /dev/null +++ b/vendor/league/flysystem-cached-adapter/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015 Frank de Jonge + +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/vendor/league/flysystem-cached-adapter/clover/.gitignore b/vendor/league/flysystem-cached-adapter/clover/.gitignore new file mode 100644 index 00000000..d6b7ef32 --- /dev/null +++ b/vendor/league/flysystem-cached-adapter/clover/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/vendor/league/flysystem-cached-adapter/composer.json b/vendor/league/flysystem-cached-adapter/composer.json new file mode 100644 index 00000000..df7fb7fd --- /dev/null +++ b/vendor/league/flysystem-cached-adapter/composer.json @@ -0,0 +1,30 @@ +{ + "name": "league/flysystem-cached-adapter", + "description": "An adapter decorator to enable meta-data caching.", + "autoload": { + "psr-4": { + "League\\Flysystem\\Cached\\": "src/" + } + }, + "require": { + "league/flysystem": "~1.0", + "psr/cache": "^1.0.0" + }, + "require-dev": { + "phpspec/phpspec": "^3.4", + "phpunit/phpunit": "^5.7", + "mockery/mockery": "~0.9", + "predis/predis": "~1.0", + "tedivm/stash": "~0.12" + }, + "suggest": { + "ext-phpredis": "Pure C implemented extension for PHP" + }, + "license": "MIT", + "authors": [ + { + "name": "frankdejonge", + "email": "info@frenky.net" + } + ] +} diff --git a/vendor/league/flysystem-cached-adapter/phpspec.yml b/vendor/league/flysystem-cached-adapter/phpspec.yml new file mode 100644 index 00000000..5eabcb21 --- /dev/null +++ b/vendor/league/flysystem-cached-adapter/phpspec.yml @@ -0,0 +1,6 @@ +--- +suites: + cached_adapter_suite: + namespace: League\Flysystem\Cached + psr4_prefix: League\Flysystem\Cached +formatter.name: pretty diff --git a/vendor/league/flysystem-cached-adapter/phpunit.php b/vendor/league/flysystem-cached-adapter/phpunit.php new file mode 100644 index 00000000..d1095879 --- /dev/null +++ b/vendor/league/flysystem-cached-adapter/phpunit.php @@ -0,0 +1,3 @@ +<?php + +include __DIR__.'/vendor/autoload.php'; diff --git a/vendor/league/flysystem-cached-adapter/readme.md b/vendor/league/flysystem-cached-adapter/readme.md new file mode 100644 index 00000000..dd1433d9 --- /dev/null +++ b/vendor/league/flysystem-cached-adapter/readme.md @@ -0,0 +1,20 @@ +# Flysystem Cached CachedAdapter + +[![Author](http://img.shields.io/badge/author-@frankdejonge-blue.svg?style=flat-square)](https://twitter.com/frankdejonge) +[![Build Status](https://img.shields.io/travis/thephpleague/flysystem-cached-adapter/master.svg?style=flat-square)](https://travis-ci.org/thephpleague/flysystem-cached-adapter) +[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/thephpleague/flysystem-cached-adapter.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/flysystem-cached-adapter/code-structure) +[![Quality Score](https://img.shields.io/scrutinizer/g/thephpleague/flysystem-cached-adapter.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/flysystem-cached-adapter) +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) +[![Packagist Version](https://img.shields.io/packagist/v/league/flysystem-cached-adapter.svg?style=flat-square)](https://packagist.org/packages/league/flysystem-cached-adapter) +[![Total Downloads](https://img.shields.io/packagist/dt/league/flysystem-cached-adapter.svg?style=flat-square)](https://packagist.org/packages/league/flysystem-cached-adapter) + + +The adapter decorator caches metadata and directory listings. + +```bash +composer require league/flysystem-cached-adapter +``` + +## Usage + +[Check out the docs.](https://flysystem.thephpleague.com/docs/advanced/caching/) diff --git a/vendor/league/flysystem-cached-adapter/spec/CachedAdapterSpec.php b/vendor/league/flysystem-cached-adapter/spec/CachedAdapterSpec.php new file mode 100644 index 00000000..69428d99 --- /dev/null +++ b/vendor/league/flysystem-cached-adapter/spec/CachedAdapterSpec.php @@ -0,0 +1,435 @@ +<?php + +namespace spec\League\Flysystem\Cached; + +use League\Flysystem\AdapterInterface; +use League\Flysystem\Cached\CacheInterface; +use League\Flysystem\Config; +use PhpSpec\ObjectBehavior; + +class CachedAdapterSpec extends ObjectBehavior +{ + /** + * @var AdapterInterface + */ + private $adapter; + + /** + * @var CacheInterface + */ + private $cache; + + public function let(AdapterInterface $adapter, CacheInterface $cache) + { + $this->adapter = $adapter; + $this->cache = $cache; + $this->cache->load()->shouldBeCalled(); + $this->beConstructedWith($adapter, $cache); + } + + public function it_is_initializable() + { + $this->shouldHaveType('League\Flysystem\Cached\CachedAdapter'); + $this->shouldHaveType('League\Flysystem\AdapterInterface'); + } + + public function it_should_forward_read_streams() + { + $path = 'path.txt'; + $response = ['path' => $path]; + $this->adapter->readStream($path)->willReturn($response); + $this->readStream($path)->shouldbe($response); + } + + public function it_should_cache_writes() + { + $type = 'file'; + $path = 'path.txt'; + $contents = 'contents'; + $config = new Config(); + $response = compact('path', 'contents', 'type'); + $this->adapter->write($path, $contents, $config)->willReturn($response); + $this->cache->updateObject($path, $response, true)->shouldBeCalled(); + $this->write($path, $contents, $config)->shouldBe($response); + } + + public function it_should_cache_streamed_writes() + { + $type = 'file'; + $path = 'path.txt'; + $stream = tmpfile(); + $config = new Config(); + $response = compact('path', 'stream', 'type'); + $this->adapter->writeStream($path, $stream, $config)->willReturn($response); + $this->cache->updateObject($path, ['contents' => false] + $response, true)->shouldBeCalled(); + $this->writeStream($path, $stream, $config)->shouldBe($response); + fclose($stream); + } + + public function it_should_cache_streamed_updates() + { + $type = 'file'; + $path = 'path.txt'; + $stream = tmpfile(); + $config = new Config(); + $response = compact('path', 'stream', 'type'); + $this->adapter->updateStream($path, $stream, $config)->willReturn($response); + $this->cache->updateObject($path, ['contents' => false] + $response, true)->shouldBeCalled(); + $this->updateStream($path, $stream, $config)->shouldBe($response); + fclose($stream); + } + + public function it_should_ignore_failed_writes() + { + $path = 'path.txt'; + $contents = 'contents'; + $config = new Config(); + $this->adapter->write($path, $contents, $config)->willReturn(false); + $this->write($path, $contents, $config)->shouldBe(false); + } + + public function it_should_ignore_failed_streamed_writes() + { + $path = 'path.txt'; + $contents = tmpfile(); + $config = new Config(); + $this->adapter->writeStream($path, $contents, $config)->willReturn(false); + $this->writeStream($path, $contents, $config)->shouldBe(false); + fclose($contents); + } + + public function it_should_cache_updated() + { + $type = 'file'; + $path = 'path.txt'; + $contents = 'contents'; + $config = new Config(); + $response = compact('path', 'contents', 'type'); + $this->adapter->update($path, $contents, $config)->willReturn($response); + $this->cache->updateObject($path, $response, true)->shouldBeCalled(); + $this->update($path, $contents, $config)->shouldBe($response); + } + + public function it_should_ignore_failed_updates() + { + $path = 'path.txt'; + $contents = 'contents'; + $config = new Config(); + $this->adapter->update($path, $contents, $config)->willReturn(false); + $this->update($path, $contents, $config)->shouldBe(false); + } + + public function it_should_ignore_failed_streamed_updates() + { + $path = 'path.txt'; + $contents = tmpfile(); + $config = new Config(); + $this->adapter->updateStream($path, $contents, $config)->willReturn(false); + $this->updateStream($path, $contents, $config)->shouldBe(false); + fclose($contents); + } + + public function it_should_cache_renames() + { + $old = 'old.txt'; + $new = 'new.txt'; + $this->adapter->rename($old, $new)->willReturn(true); + $this->cache->rename($old, $new)->shouldBeCalled(); + $this->rename($old, $new)->shouldBe(true); + } + + public function it_should_ignore_rename_fails() + { + $old = 'old.txt'; + $new = 'new.txt'; + $this->adapter->rename($old, $new)->willReturn(false); + $this->rename($old, $new)->shouldBe(false); + } + + public function it_should_cache_copies() + { + $old = 'old.txt'; + $new = 'new.txt'; + $this->adapter->copy($old, $new)->willReturn(true); + $this->cache->copy($old, $new)->shouldBeCalled(); + $this->copy($old, $new)->shouldBe(true); + } + + public function it_should_ignore_copy_fails() + { + $old = 'old.txt'; + $new = 'new.txt'; + $this->adapter->copy($old, $new)->willReturn(false); + $this->copy($old, $new)->shouldBe(false); + } + + public function it_should_cache_deletes() + { + $delete = 'delete.txt'; + $this->adapter->delete($delete)->willReturn(true); + $this->cache->delete($delete)->shouldBeCalled(); + $this->delete($delete)->shouldBe(true); + } + + public function it_should_ignore_delete_fails() + { + $delete = 'delete.txt'; + $this->adapter->delete($delete)->willReturn(false); + $this->delete($delete)->shouldBe(false); + } + + public function it_should_cache_dir_deletes() + { + $delete = 'delete'; + $this->adapter->deleteDir($delete)->willReturn(true); + $this->cache->deleteDir($delete)->shouldBeCalled(); + $this->deleteDir($delete)->shouldBe(true); + } + + public function it_should_ignore_delete_dir_fails() + { + $delete = 'delete'; + $this->adapter->deleteDir($delete)->willReturn(false); + $this->deleteDir($delete)->shouldBe(false); + } + + public function it_should_cache_dir_creates() + { + $dirname = 'dirname'; + $config = new Config(); + $response = ['path' => $dirname, 'type' => 'dir']; + $this->adapter->createDir($dirname, $config)->willReturn($response); + $this->cache->updateObject($dirname, $response, true)->shouldBeCalled(); + $this->createDir($dirname, $config)->shouldBe($response); + } + + public function it_should_ignore_create_dir_fails() + { + $dirname = 'dirname'; + $config = new Config(); + $this->adapter->createDir($dirname, $config)->willReturn(false); + $this->createDir($dirname, $config)->shouldBe(false); + } + + public function it_should_cache_set_visibility() + { + $path = 'path.txt'; + $visibility = AdapterInterface::VISIBILITY_PUBLIC; + $this->adapter->setVisibility($path, $visibility)->willReturn(true); + $this->cache->updateObject($path, ['path' => $path, 'visibility' => $visibility], true)->shouldBeCalled(); + $this->setVisibility($path, $visibility)->shouldBe(true); + } + + public function it_should_ignore_set_visibility_fails() + { + $dirname = 'delete'; + $visibility = AdapterInterface::VISIBILITY_PUBLIC; + $this->adapter->setVisibility($dirname, $visibility)->willReturn(false); + $this->setVisibility($dirname, $visibility)->shouldBe(false); + } + + public function it_should_indicate_missing_files() + { + $this->cache->has($path = 'path.txt')->willReturn(false); + $this->has($path)->shouldBe(false); + } + + public function it_should_indicate_file_existance() + { + $this->cache->has($path = 'path.txt')->willReturn(true); + $this->has($path)->shouldBe(true); + } + + public function it_should_cache_missing_files() + { + $this->cache->has($path = 'path.txt')->willReturn(null); + $this->adapter->has($path)->willReturn(false); + $this->cache->storeMiss($path)->shouldBeCalled(); + $this->has($path)->shouldBe(false); + } + + public function it_should_delete_when_metadata_is_missing() + { + $path = 'path.txt'; + $this->cache->has($path)->willReturn(true); + $this->cache->getSize($path)->willReturn(['path' => $path]); + $this->adapter->getSize($path)->willReturn($response = ['path' => $path, 'size' => 1024]); + $this->cache->updateObject($path, $response, true)->shouldBeCalled(); + $this->getSize($path)->shouldBe($response); + } + + public function it_should_cache_has() + { + $this->cache->has($path = 'path.txt')->willReturn(null); + $this->adapter->has($path)->willReturn(true); + $this->cache->updateObject($path, compact('path'), true)->shouldBeCalled(); + $this->has($path)->shouldBe(true); + } + + public function it_should_list_cached_contents() + { + $this->cache->isComplete($dirname = 'dirname', $recursive = true)->willReturn(true); + $response = [['path' => 'path.txt']]; + $this->cache->listContents($dirname, $recursive)->willReturn($response); + $this->listContents($dirname, $recursive)->shouldBe($response); + } + + public function it_should_ignore_failed_list_contents() + { + $this->cache->isComplete($dirname = 'dirname', $recursive = true)->willReturn(false); + $this->adapter->listContents($dirname, $recursive)->willReturn(false); + $this->listContents($dirname, $recursive)->shouldBe(false); + } + + public function it_should_cache_contents_listings() + { + $this->cache->isComplete($dirname = 'dirname', $recursive = true)->willReturn(false); + $response = [['path' => 'path.txt']]; + $this->adapter->listContents($dirname, $recursive)->willReturn($response); + $this->cache->storeContents($dirname, $response, $recursive)->shouldBeCalled(); + $this->listContents($dirname, $recursive)->shouldBe($response); + } + + public function it_should_use_cached_visibility() + { + $this->make_it_use_getter_cache('getVisibility', 'path.txt', [ + 'path' => 'path.txt', + 'visibility' => AdapterInterface::VISIBILITY_PUBLIC, + ]); + } + + public function it_should_cache_get_visibility() + { + $path = 'path.txt'; + $response = ['visibility' => AdapterInterface::VISIBILITY_PUBLIC, 'path' => $path]; + $this->make_it_cache_getter('getVisibility', $path, $response); + } + + public function it_should_ignore_failed_get_visibility() + { + $path = 'path.txt'; + $this->make_it_ignore_failed_getter('getVisibility', $path); + } + + public function it_should_use_cached_timestamp() + { + $this->make_it_use_getter_cache('getTimestamp', 'path.txt', [ + 'path' => 'path.txt', + 'timestamp' => 1234, + ]); + } + + public function it_should_cache_timestamps() + { + $this->make_it_cache_getter('getTimestamp', 'path.txt', [ + 'path' => 'path.txt', + 'timestamp' => 1234, + ]); + } + + public function it_should_ignore_failed_get_timestamps() + { + $this->make_it_ignore_failed_getter('getTimestamp', 'path.txt'); + } + + public function it_should_cache_get_metadata() + { + $path = 'path.txt'; + $response = ['visibility' => AdapterInterface::VISIBILITY_PUBLIC, 'path' => $path]; + $this->make_it_cache_getter('getMetadata', $path, $response); + } + + public function it_should_use_cached_metadata() + { + $this->make_it_use_getter_cache('getMetadata', 'path.txt', [ + 'path' => 'path.txt', + 'timestamp' => 1234, + ]); + } + + public function it_should_ignore_failed_get_metadata() + { + $this->make_it_ignore_failed_getter('getMetadata', 'path.txt'); + } + + public function it_should_cache_get_size() + { + $path = 'path.txt'; + $response = ['size' => 1234, 'path' => $path]; + $this->make_it_cache_getter('getSize', $path, $response); + } + + public function it_should_use_cached_size() + { + $this->make_it_use_getter_cache('getSize', 'path.txt', [ + 'path' => 'path.txt', + 'size' => 1234, + ]); + } + + public function it_should_ignore_failed_get_size() + { + $this->make_it_ignore_failed_getter('getSize', 'path.txt'); + } + + public function it_should_cache_get_mimetype() + { + $path = 'path.txt'; + $response = ['mimetype' => 'text/plain', 'path' => $path]; + $this->make_it_cache_getter('getMimetype', $path, $response); + } + + public function it_should_use_cached_mimetype() + { + $this->make_it_use_getter_cache('getMimetype', 'path.txt', [ + 'path' => 'path.txt', + 'mimetype' => 'text/plain', + ]); + } + + public function it_should_ignore_failed_get_mimetype() + { + $this->make_it_ignore_failed_getter('getMimetype', 'path.txt'); + } + + public function it_should_cache_reads() + { + $path = 'path.txt'; + $response = ['path' => $path, 'contents' => 'contents']; + $this->make_it_cache_getter('read', $path, $response); + } + + public function it_should_use_cached_file_contents() + { + $this->make_it_use_getter_cache('read', 'path.txt', [ + 'path' => 'path.txt', + 'contents' => 'contents' + ]); + } + + public function it_should_ignore_failed_reads() + { + $this->make_it_ignore_failed_getter('read', 'path.txt'); + } + + protected function make_it_use_getter_cache($method, $path, $response) + { + $this->cache->{$method}($path)->willReturn($response); + $this->{$method}($path)->shouldBe($response); + } + + protected function make_it_cache_getter($method, $path, $response) + { + $this->cache->{$method}($path)->willReturn(false); + $this->adapter->{$method}($path)->willReturn($response); + $this->cache->updateObject($path, $response, true)->shouldBeCalled(); + $this->{$method}($path)->shouldBe($response); + } + + protected function make_it_ignore_failed_getter($method, $path) + { + $this->cache->{$method}($path)->willReturn(false); + $this->adapter->{$method}($path)->willReturn(false); + $this->{$method}($path)->shouldBe(false); + } +} diff --git a/vendor/league/flysystem-cached-adapter/src/CacheInterface.php b/vendor/league/flysystem-cached-adapter/src/CacheInterface.php new file mode 100644 index 00000000..de3ab3d9 --- /dev/null +++ b/vendor/league/flysystem-cached-adapter/src/CacheInterface.php @@ -0,0 +1,101 @@ +<?php + +namespace League\Flysystem\Cached; + +use League\Flysystem\ReadInterface; + +interface CacheInterface extends ReadInterface +{ + /** + * Check whether the directory listing of a given directory is complete. + * + * @param string $dirname + * @param bool $recursive + * + * @return bool + */ + public function isComplete($dirname, $recursive); + + /** + * Set a directory to completely listed. + * + * @param string $dirname + * @param bool $recursive + */ + public function setComplete($dirname, $recursive); + + /** + * Store the contents of a directory. + * + * @param string $directory + * @param array $contents + * @param bool $recursive + */ + public function storeContents($directory, array $contents, $recursive); + + /** + * Flush the cache. + */ + public function flush(); + + /** + * Autosave trigger. + */ + public function autosave(); + + /** + * Store the cache. + */ + public function save(); + + /** + * Load the cache. + */ + public function load(); + + /** + * Rename a file. + * + * @param string $path + * @param string $newpath + */ + public function rename($path, $newpath); + + /** + * Copy a file. + * + * @param string $path + * @param string $newpath + */ + public function copy($path, $newpath); + + /** + * Delete an object from cache. + * + * @param string $path object path + */ + public function delete($path); + + /** + * Delete all objects from from a directory. + * + * @param string $dirname directory path + */ + public function deleteDir($dirname); + + /** + * Update the metadata for an object. + * + * @param string $path object path + * @param array $object object metadata + * @param bool $autosave whether to trigger the autosave routine + */ + public function updateObject($path, array $object, $autosave = false); + + /** + * Store object hit miss. + * + * @param string $path + */ + public function storeMiss($path); +} diff --git a/vendor/league/flysystem-cached-adapter/src/CachedAdapter.php b/vendor/league/flysystem-cached-adapter/src/CachedAdapter.php new file mode 100644 index 00000000..dcdae9eb --- /dev/null +++ b/vendor/league/flysystem-cached-adapter/src/CachedAdapter.php @@ -0,0 +1,346 @@ +<?php + +namespace League\Flysystem\Cached; + +use League\Flysystem\AdapterInterface; +use League\Flysystem\Config; + +class CachedAdapter implements AdapterInterface +{ + /** + * @var AdapterInterface + */ + private $adapter; + + /** + * @var CacheInterface + */ + private $cache; + + /** + * Constructor. + * + * @param AdapterInterface $adapter + * @param CacheInterface $cache + */ + public function __construct(AdapterInterface $adapter, CacheInterface $cache) + { + $this->adapter = $adapter; + $this->cache = $cache; + $this->cache->load(); + } + + /** + * Get the underlying Adapter implementation. + * + * @return AdapterInterface + */ + public function getAdapter() + { + return $this->adapter; + } + + /** + * Get the used Cache implementation. + * + * @return CacheInterface + */ + public function getCache() + { + return $this->cache; + } + + /** + * {@inheritdoc} + */ + public function write($path, $contents, Config $config) + { + $result = $this->adapter->write($path, $contents, $config); + + if ($result !== false) { + $result['type'] = 'file'; + $this->cache->updateObject($path, $result + compact('path', 'contents'), true); + } + + return $result; + } + + /** + * {@inheritdoc} + */ + public function writeStream($path, $resource, Config $config) + { + $result = $this->adapter->writeStream($path, $resource, $config); + + if ($result !== false) { + $result['type'] = 'file'; + $contents = false; + $this->cache->updateObject($path, $result + compact('path', 'contents'), true); + } + + return $result; + } + + /** + * {@inheritdoc} + */ + public function update($path, $contents, Config $config) + { + $result = $this->adapter->update($path, $contents, $config); + + if ($result !== false) { + $result['type'] = 'file'; + $this->cache->updateObject($path, $result + compact('path', 'contents'), true); + } + + return $result; + } + + /** + * {@inheritdoc} + */ + public function updateStream($path, $resource, Config $config) + { + $result = $this->adapter->updateStream($path, $resource, $config); + + if ($result !== false) { + $result['type'] = 'file'; + $contents = false; + $this->cache->updateObject($path, $result + compact('path', 'contents'), true); + } + + return $result; + } + + /** + * {@inheritdoc} + */ + public function rename($path, $newPath) + { + $result = $this->adapter->rename($path, $newPath); + + if ($result !== false) { + $this->cache->rename($path, $newPath); + } + + return $result; + } + + /** + * {@inheritdoc} + */ + public function copy($path, $newpath) + { + $result = $this->adapter->copy($path, $newpath); + + if ($result !== false) { + $this->cache->copy($path, $newpath); + } + + return $result; + } + + /** + * {@inheritdoc} + */ + public function delete($path) + { + $result = $this->adapter->delete($path); + + if ($result !== false) { + $this->cache->delete($path); + } + + return $result; + } + + /** + * {@inheritdoc} + */ + public function deleteDir($dirname) + { + $result = $this->adapter->deleteDir($dirname); + + if ($result !== false) { + $this->cache->deleteDir($dirname); + } + + return $result; + } + + /** + * {@inheritdoc} + */ + public function createDir($dirname, Config $config) + { + $result = $this->adapter->createDir($dirname, $config); + + if ($result !== false) { + $type = 'dir'; + $path = $dirname; + $this->cache->updateObject($dirname, compact('path', 'type'), true); + } + + return $result; + } + + /** + * {@inheritdoc} + */ + public function setVisibility($path, $visibility) + { + $result = $this->adapter->setVisibility($path, $visibility); + + if ($result !== false) { + $this->cache->updateObject($path, compact('path', 'visibility'), true); + } + + return $result; + } + + /** + * {@inheritdoc} + */ + public function has($path) + { + $cacheHas = $this->cache->has($path); + + if ($cacheHas !== null) { + return $cacheHas; + } + + $adapterResponse = $this->adapter->has($path); + + if (! $adapterResponse) { + $this->cache->storeMiss($path); + } else { + $cacheEntry = is_array($adapterResponse) ? $adapterResponse : compact('path'); + $this->cache->updateObject($path, $cacheEntry, true); + } + + return $adapterResponse; + } + + /** + * {@inheritdoc} + */ + public function read($path) + { + return $this->callWithFallback('contents', $path, 'read'); + } + + /** + * {@inheritdoc} + */ + public function readStream($path) + { + return $this->adapter->readStream($path); + } + + /** + * Get the path prefix. + * + * @return string|null path prefix or null if pathPrefix is empty + */ + public function getPathPrefix() + { + return $this->adapter->getPathPrefix(); + } + + /** + * Prefix a path. + * + * @param string $path + * + * @return string prefixed path + */ + public function applyPathPrefix($path) + { + return $this->adapter->applyPathPrefix($path); + } + + /** + * {@inheritdoc} + */ + public function listContents($directory = '', $recursive = false) + { + if ($this->cache->isComplete($directory, $recursive)) { + return $this->cache->listContents($directory, $recursive); + } + + $result = $this->adapter->listContents($directory, $recursive); + + if ($result !== false) { + $this->cache->storeContents($directory, $result, $recursive); + } + + return $result; + } + + /** + * {@inheritdoc} + */ + public function getMetadata($path) + { + return $this->callWithFallback(null, $path, 'getMetadata'); + } + + /** + * {@inheritdoc} + */ + public function getSize($path) + { + return $this->callWithFallback('size', $path, 'getSize'); + } + + /** + * {@inheritdoc} + */ + public function getMimetype($path) + { + return $this->callWithFallback('mimetype', $path, 'getMimetype'); + } + + /** + * {@inheritdoc} + */ + public function getTimestamp($path) + { + return $this->callWithFallback('timestamp', $path, 'getTimestamp'); + } + + /** + * {@inheritdoc} + */ + public function getVisibility($path) + { + return $this->callWithFallback('visibility', $path, 'getVisibility'); + } + + /** + * Call a method and cache the response. + * + * @param string $property + * @param string $path + * @param string $method + * + * @return mixed + */ + protected function callWithFallback($property, $path, $method) + { + $result = $this->cache->{$method}($path); + + if ($result !== false && ($property === null || array_key_exists($property, $result))) { + return $result; + } + + $result = $this->adapter->{$method}($path); + + if ($result) { + $object = $result + compact('path'); + $this->cache->updateObject($path, $object, true); + } + + return $result; + } +} diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/AbstractCache.php b/vendor/league/flysystem-cached-adapter/src/Storage/AbstractCache.php new file mode 100644 index 00000000..141b4682 --- /dev/null +++ b/vendor/league/flysystem-cached-adapter/src/Storage/AbstractCache.php @@ -0,0 +1,418 @@ +<?php + +namespace League\Flysystem\Cached\Storage; + +use League\Flysystem\Cached\CacheInterface; +use League\Flysystem\Util; + +abstract class AbstractCache implements CacheInterface +{ + /** + * @var bool + */ + protected $autosave = true; + + /** + * @var array + */ + protected $cache = []; + + /** + * @var array + */ + protected $complete = []; + + /** + * Destructor. + */ + public function __destruct() + { + if (! $this->autosave) { + $this->save(); + } + } + + /** + * Get the autosave setting. + * + * @return bool autosave + */ + public function getAutosave() + { + return $this->autosave; + } + + /** + * Get the autosave setting. + * + * @param bool $autosave + */ + public function setAutosave($autosave) + { + $this->autosave = $autosave; + } + + /** + * Store the contents listing. + * + * @param string $directory + * @param array $contents + * @param bool $recursive + * + * @return array contents listing + */ + public function storeContents($directory, array $contents, $recursive = false) + { + $directories = [$directory]; + + foreach ($contents as $object) { + $this->updateObject($object['path'], $object); + $object = $this->cache[$object['path']]; + + if ($recursive && $this->pathIsInDirectory($directory, $object['path'])) { + $directories[] = $object['dirname']; + } + } + + foreach (array_unique($directories) as $directory) { + $this->setComplete($directory, $recursive); + } + + $this->autosave(); + } + + /** + * Update the metadata for an object. + * + * @param string $path object path + * @param array $object object metadata + * @param bool $autosave whether to trigger the autosave routine + */ + public function updateObject($path, array $object, $autosave = false) + { + if (! $this->has($path)) { + $this->cache[$path] = Util::pathinfo($path); + } + + $this->cache[$path] = array_merge($this->cache[$path], $object); + + if ($autosave) { + $this->autosave(); + } + + $this->ensureParentDirectories($path); + } + + /** + * Store object hit miss. + * + * @param string $path + */ + public function storeMiss($path) + { + $this->cache[$path] = false; + $this->autosave(); + } + + /** + * Get the contents listing. + * + * @param string $dirname + * @param bool $recursive + * + * @return array contents listing + */ + public function listContents($dirname = '', $recursive = false) + { + $result = []; + + foreach ($this->cache as $object) { + if ($object === false) { + continue; + } + if ($object['dirname'] === $dirname) { + $result[] = $object; + } elseif ($recursive && $this->pathIsInDirectory($dirname, $object['path'])) { + $result[] = $object; + } + } + + return $result; + } + + /** + * {@inheritdoc} + */ + public function has($path) + { + if ($path !== false && array_key_exists($path, $this->cache)) { + return $this->cache[$path] !== false; + } + + if ($this->isComplete(Util::dirname($path), false)) { + return false; + } + } + + /** + * {@inheritdoc} + */ + public function read($path) + { + if (isset($this->cache[$path]['contents']) && $this->cache[$path]['contents'] !== false) { + return $this->cache[$path]; + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function readStream($path) + { + return false; + } + + /** + * {@inheritdoc} + */ + public function rename($path, $newpath) + { + if ($this->has($path)) { + $object = $this->cache[$path]; + unset($this->cache[$path]); + $object['path'] = $newpath; + $object = array_merge($object, Util::pathinfo($newpath)); + $this->cache[$newpath] = $object; + $this->autosave(); + } + } + + /** + * {@inheritdoc} + */ + public function copy($path, $newpath) + { + if ($this->has($path)) { + $object = $this->cache[$path]; + $object = array_merge($object, Util::pathinfo($newpath)); + $this->updateObject($newpath, $object, true); + } + } + + /** + * {@inheritdoc} + */ + public function delete($path) + { + $this->storeMiss($path); + } + + /** + * {@inheritdoc} + */ + public function deleteDir($dirname) + { + foreach ($this->cache as $path => $object) { + if ($this->pathIsInDirectory($dirname, $path) || $path === $dirname) { + unset($this->cache[$path]); + } + } + + unset($this->complete[$dirname]); + + $this->autosave(); + } + + /** + * {@inheritdoc} + */ + public function getMimetype($path) + { + if (isset($this->cache[$path]['mimetype'])) { + return $this->cache[$path]; + } + + if (! $result = $this->read($path)) { + return false; + } + + $mimetype = Util::guessMimeType($path, $result['contents']); + $this->cache[$path]['mimetype'] = $mimetype; + + return $this->cache[$path]; + } + + /** + * {@inheritdoc} + */ + public function getSize($path) + { + if (isset($this->cache[$path]['size'])) { + return $this->cache[$path]; + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function getTimestamp($path) + { + if (isset($this->cache[$path]['timestamp'])) { + return $this->cache[$path]; + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function getVisibility($path) + { + if (isset($this->cache[$path]['visibility'])) { + return $this->cache[$path]; + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function getMetadata($path) + { + if (isset($this->cache[$path]['type'])) { + return $this->cache[$path]; + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function isComplete($dirname, $recursive) + { + if (! array_key_exists($dirname, $this->complete)) { + return false; + } + + if ($recursive && $this->complete[$dirname] !== 'recursive') { + return false; + } + + return true; + } + + /** + * {@inheritdoc} + */ + public function setComplete($dirname, $recursive) + { + $this->complete[$dirname] = $recursive ? 'recursive' : true; + } + + /** + * Filter the contents from a listing. + * + * @param array $contents object listing + * + * @return array filtered contents + */ + public function cleanContents(array $contents) + { + $cachedProperties = array_flip([ + 'path', 'dirname', 'basename', 'extension', 'filename', + 'size', 'mimetype', 'visibility', 'timestamp', 'type', + 'md5', + ]); + + foreach ($contents as $path => $object) { + if (is_array($object)) { + $contents[$path] = array_intersect_key($object, $cachedProperties); + } + } + + return $contents; + } + + /** + * {@inheritdoc} + */ + public function flush() + { + $this->cache = []; + $this->complete = []; + $this->autosave(); + } + + /** + * {@inheritdoc} + */ + public function autosave() + { + if ($this->autosave) { + $this->save(); + } + } + + /** + * Retrieve serialized cache data. + * + * @return string serialized data + */ + public function getForStorage() + { + $cleaned = $this->cleanContents($this->cache); + + return json_encode([$cleaned, $this->complete]); + } + + /** + * Load from serialized cache data. + * + * @param string $json + */ + public function setFromStorage($json) + { + list($cache, $complete) = json_decode($json, true); + + if (json_last_error() === JSON_ERROR_NONE && is_array($cache) && is_array($complete)) { + $this->cache = $cache; + $this->complete = $complete; + } + } + + /** + * Ensure parent directories of an object. + * + * @param string $path object path + */ + public function ensureParentDirectories($path) + { + $object = $this->cache[$path]; + + while ($object['dirname'] !== '' && ! isset($this->cache[$object['dirname']])) { + $object = Util::pathinfo($object['dirname']); + $object['type'] = 'dir'; + $this->cache[$object['path']] = $object; + } + } + + /** + * Determines if the path is inside the directory. + * + * @param string $directory + * @param string $path + * + * @return bool + */ + protected function pathIsInDirectory($directory, $path) + { + return $directory === '' || strpos($path, $directory . '/') === 0; + } +} diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/Adapter.php b/vendor/league/flysystem-cached-adapter/src/Storage/Adapter.php new file mode 100644 index 00000000..649a60e3 --- /dev/null +++ b/vendor/league/flysystem-cached-adapter/src/Storage/Adapter.php @@ -0,0 +1,115 @@ +<?php + +namespace League\Flysystem\Cached\Storage; + +use League\Flysystem\AdapterInterface; +use League\Flysystem\Config; + +class Adapter extends AbstractCache +{ + /** + * @var AdapterInterface An adapter + */ + protected $adapter; + + /** + * @var string the file to cache to + */ + protected $file; + + /** + * @var int|null seconds until cache expiration + */ + protected $expire = null; + + /** + * Constructor. + * + * @param AdapterInterface $adapter adapter + * @param string $file the file to cache to + * @param int|null $expire seconds until cache expiration + */ + public function __construct(AdapterInterface $adapter, $file, $expire = null) + { + $this->adapter = $adapter; + $this->file = $file; + $this->setExpire($expire); + } + + /** + * Set the expiration time in seconds. + * + * @param int $expire relative expiration time + */ + protected function setExpire($expire) + { + if ($expire) { + $this->expire = $this->getTime($expire); + } + } + + /** + * Get expiration time in seconds. + * + * @param int $time relative expiration time + * + * @return int actual expiration time + */ + protected function getTime($time = 0) + { + return intval(microtime(true)) + $time; + } + + /** + * {@inheritdoc} + */ + public function setFromStorage($json) + { + list($cache, $complete, $expire) = json_decode($json, true); + + if (! $expire || $expire > $this->getTime()) { + $this->cache = is_array($cache) ? $cache : []; + $this->complete = is_array($complete) ? $complete : []; + } else { + $this->adapter->delete($this->file); + } + } + + /** + * {@inheritdoc} + */ + public function load() + { + if ($this->adapter->has($this->file)) { + $file = $this->adapter->read($this->file); + if ($file && !empty($file['contents'])) { + $this->setFromStorage($file['contents']); + } + } + } + + /** + * {@inheritdoc} + */ + public function getForStorage() + { + $cleaned = $this->cleanContents($this->cache); + + return json_encode([$cleaned, $this->complete, $this->expire]); + } + + /** + * {@inheritdoc} + */ + public function save() + { + $config = new Config(); + $contents = $this->getForStorage(); + + if ($this->adapter->has($this->file)) { + $this->adapter->update($this->file, $contents, $config); + } else { + $this->adapter->write($this->file, $contents, $config); + } + } +} diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/Memcached.php b/vendor/league/flysystem-cached-adapter/src/Storage/Memcached.php new file mode 100644 index 00000000..f67d2717 --- /dev/null +++ b/vendor/league/flysystem-cached-adapter/src/Storage/Memcached.php @@ -0,0 +1,59 @@ +<?php + +namespace League\Flysystem\Cached\Storage; + +use Memcached as NativeMemcached; + +class Memcached extends AbstractCache +{ + /** + * @var string storage key + */ + protected $key; + + /** + * @var int|null seconds until cache expiration + */ + protected $expire; + + /** + * @var \Memcached Memcached instance + */ + protected $memcached; + + /** + * Constructor. + * + * @param \Memcached $memcached + * @param string $key storage key + * @param int|null $expire seconds until cache expiration + */ + public function __construct(NativeMemcached $memcached, $key = 'flysystem', $expire = null) + { + $this->key = $key; + $this->expire = $expire; + $this->memcached = $memcached; + } + + /** + * {@inheritdoc} + */ + public function load() + { + $contents = $this->memcached->get($this->key); + + if ($contents !== false) { + $this->setFromStorage($contents); + } + } + + /** + * {@inheritdoc} + */ + public function save() + { + $contents = $this->getForStorage(); + $expiration = $this->expire === null ? 0 : time() + $this->expire; + $this->memcached->set($this->key, $contents, $expiration); + } +} diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/Memory.php b/vendor/league/flysystem-cached-adapter/src/Storage/Memory.php new file mode 100644 index 00000000..d0914fab --- /dev/null +++ b/vendor/league/flysystem-cached-adapter/src/Storage/Memory.php @@ -0,0 +1,22 @@ +<?php + +namespace League\Flysystem\Cached\Storage; + +class Memory extends AbstractCache +{ + /** + * {@inheritdoc} + */ + public function save() + { + // There is nothing to save + } + + /** + * {@inheritdoc} + */ + public function load() + { + // There is nothing to load + } +} diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/Noop.php b/vendor/league/flysystem-cached-adapter/src/Storage/Noop.php new file mode 100644 index 00000000..ff996e07 --- /dev/null +++ b/vendor/league/flysystem-cached-adapter/src/Storage/Noop.php @@ -0,0 +1,171 @@ +<?php + +namespace League\Flysystem\Cached\Storage; + +class Noop extends AbstractCache +{ + /** + * {@inheritdoc} + */ + protected $autosave = false; + + /** + * {@inheritdoc} + */ + public function updateObject($path, array $object, $autosave = false) + { + return $object; + } + + /** + * {@inheritdoc} + */ + public function isComplete($dirname, $recursive) + { + return false; + } + + /** + * {@inheritdoc} + */ + public function setComplete($dirname, $recursive) + { + // + } + + /** + * {@inheritdoc} + */ + public function copy($path, $newpath) + { + return false; + } + + /** + * {@inheritdoc} + */ + public function rename($path, $newpath) + { + return false; + } + + /** + * {@inheritdoc} + */ + public function storeContents($directory, array $contents, $recursive = false) + { + return $contents; + } + + /** + * {@inheritdoc} + */ + public function storeMiss($path) + { + return $this; + } + + /** + * {@inheritdoc} + */ + public function flush() + { + // + } + + /** + * {@inheritdoc} + */ + public function autosave() + { + // + } + + /** + * {@inheritdoc} + */ + public function save() + { + // + } + + /** + * {@inheritdoc} + */ + public function load() + { + // + } + + /** + * {@inheritdoc} + */ + public function has($path) + { + return; + } + + /** + * {@inheritdoc} + */ + public function read($path) + { + return false; + } + + /** + * {@inheritdoc} + */ + public function readStream($path) + { + return false; + } + + /** + * {@inheritdoc} + */ + public function listContents($directory = '', $recursive = false) + { + return []; + } + + /** + * {@inheritdoc} + */ + public function getMetadata($path) + { + return false; + } + + /** + * {@inheritdoc} + */ + public function getSize($path) + { + return false; + } + + /** + * {@inheritdoc} + */ + public function getMimetype($path) + { + return false; + } + + /** + * {@inheritdoc} + */ + public function getTimestamp($path) + { + return false; + } + + /** + * {@inheritdoc} + */ + public function getVisibility($path) + { + return false; + } +} diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/PhpRedis.php b/vendor/league/flysystem-cached-adapter/src/Storage/PhpRedis.php new file mode 100644 index 00000000..4530b141 --- /dev/null +++ b/vendor/league/flysystem-cached-adapter/src/Storage/PhpRedis.php @@ -0,0 +1,62 @@ +<?php + +namespace League\Flysystem\Cached\Storage; + +use Redis; + +class PhpRedis extends AbstractCache +{ + /** + * @var Redis PhpRedis Client + */ + protected $client; + + /** + * @var string storage key + */ + protected $key; + + /** + * @var int|null seconds until cache expiration + */ + protected $expire; + + /** + * Constructor. + * + * @param Redis|null $client phpredis client + * @param string $key storage key + * @param int|null $expire seconds until cache expiration + */ + public function __construct(Redis $client = null, $key = 'flysystem', $expire = null) + { + $this->client = $client ?: new Redis(); + $this->key = $key; + $this->expire = $expire; + } + + /** + * {@inheritdoc} + */ + public function load() + { + $contents = $this->client->get($this->key); + + if ($contents !== false) { + $this->setFromStorage($contents); + } + } + + /** + * {@inheritdoc} + */ + public function save() + { + $contents = $this->getForStorage(); + $this->client->set($this->key, $contents); + + if ($this->expire !== null) { + $this->client->expire($this->key, $this->expire); + } + } +} diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/Predis.php b/vendor/league/flysystem-cached-adapter/src/Storage/Predis.php new file mode 100644 index 00000000..8a295744 --- /dev/null +++ b/vendor/league/flysystem-cached-adapter/src/Storage/Predis.php @@ -0,0 +1,75 @@ +<?php + +namespace League\Flysystem\Cached\Storage; + +use Predis\Client; + +class Predis extends AbstractCache +{ + /** + * @var \Predis\Client Predis Client + */ + protected $client; + + /** + * @var string storage key + */ + protected $key; + + /** + * @var int|null seconds until cache expiration + */ + protected $expire; + + /** + * Constructor. + * + * @param \Predis\Client $client predis client + * @param string $key storage key + * @param int|null $expire seconds until cache expiration + */ + public function __construct(Client $client = null, $key = 'flysystem', $expire = null) + { + $this->client = $client ?: new Client(); + $this->key = $key; + $this->expire = $expire; + } + + /** + * {@inheritdoc} + */ + public function load() + { + if (($contents = $this->executeCommand('get', [$this->key])) !== null) { + $this->setFromStorage($contents); + } + } + + /** + * {@inheritdoc} + */ + public function save() + { + $contents = $this->getForStorage(); + $this->executeCommand('set', [$this->key, $contents]); + + if ($this->expire !== null) { + $this->executeCommand('expire', [$this->key, $this->expire]); + } + } + + /** + * Execute a Predis command. + * + * @param string $name + * @param array $arguments + * + * @return string + */ + protected function executeCommand($name, array $arguments) + { + $command = $this->client->createCommand($name, $arguments); + + return $this->client->executeCommand($command); + } +} diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/Psr6Cache.php b/vendor/league/flysystem-cached-adapter/src/Storage/Psr6Cache.php new file mode 100644 index 00000000..43be87e5 --- /dev/null +++ b/vendor/league/flysystem-cached-adapter/src/Storage/Psr6Cache.php @@ -0,0 +1,59 @@ +<?php + +namespace League\Flysystem\Cached\Storage; + +use Psr\Cache\CacheItemPoolInterface; + +class Psr6Cache extends AbstractCache +{ + /** + * @var CacheItemPoolInterface + */ + private $pool; + + /** + * @var string storage key + */ + protected $key; + + /** + * @var int|null seconds until cache expiration + */ + protected $expire; + + /** + * Constructor. + * + * @param CacheItemPoolInterface $pool + * @param string $key storage key + * @param int|null $expire seconds until cache expiration + */ + public function __construct(CacheItemPoolInterface $pool, $key = 'flysystem', $expire = null) + { + $this->pool = $pool; + $this->key = $key; + $this->expire = $expire; + } + + /** + * {@inheritdoc} + */ + public function save() + { + $item = $this->pool->getItem($this->key); + $item->set($this->getForStorage()); + $item->expiresAfter($this->expire); + $this->pool->save($item); + } + + /** + * {@inheritdoc} + */ + public function load() + { + $item = $this->pool->getItem($this->key); + if ($item->isHit()) { + $this->setFromStorage($item->get()); + } + } +} \ No newline at end of file diff --git a/vendor/league/flysystem-cached-adapter/src/Storage/Stash.php b/vendor/league/flysystem-cached-adapter/src/Storage/Stash.php new file mode 100644 index 00000000..e05b8322 --- /dev/null +++ b/vendor/league/flysystem-cached-adapter/src/Storage/Stash.php @@ -0,0 +1,60 @@ +<?php + +namespace League\Flysystem\Cached\Storage; + +use Stash\Pool; + +class Stash extends AbstractCache +{ + /** + * @var string storage key + */ + protected $key; + + /** + * @var int|null seconds until cache expiration + */ + protected $expire; + + /** + * @var \Stash\Pool Stash pool instance + */ + protected $pool; + + /** + * Constructor. + * + * @param \Stash\Pool $pool + * @param string $key storage key + * @param int|null $expire seconds until cache expiration + */ + public function __construct(Pool $pool, $key = 'flysystem', $expire = null) + { + $this->key = $key; + $this->expire = $expire; + $this->pool = $pool; + } + + /** + * {@inheritdoc} + */ + public function load() + { + $item = $this->pool->getItem($this->key); + $contents = $item->get(); + + if ($item->isMiss() === false) { + $this->setFromStorage($contents); + } + } + + /** + * {@inheritdoc} + */ + public function save() + { + $contents = $this->getForStorage(); + $item = $this->pool->getItem($this->key); + $item->set($contents, $this->expire); + } +} diff --git a/vendor/league/flysystem/CODE_OF_CONDUCT.md b/vendor/league/flysystem/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..89569c01 --- /dev/null +++ b/vendor/league/flysystem/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at info+flysystem@frankdejonge.nl. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/vendor/league/flysystem/LICENSE b/vendor/league/flysystem/LICENSE new file mode 100644 index 00000000..f2684c84 --- /dev/null +++ b/vendor/league/flysystem/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2013-2019 Frank de Jonge + +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/vendor/league/flysystem/SECURITY.md b/vendor/league/flysystem/SECURITY.md new file mode 100644 index 00000000..f5b205ed --- /dev/null +++ b/vendor/league/flysystem/SECURITY.md @@ -0,0 +1,16 @@ +# Security Policy + +## Supported Versions + +| Version | Supported | +| ------- | ------------------ | +| 1.0.x | :white_check_mark: | +| 2.0.x | :x: | + +## Reporting a Vulnerability + +When you've encountered a security vulnerability, please disclose it securely. + +The security process is described at: +[https://flysystem.thephpleague.com/docs/security/](https://flysystem.thephpleague.com/docs/security/) + diff --git a/vendor/league/flysystem/composer.json b/vendor/league/flysystem/composer.json new file mode 100644 index 00000000..32ec81d1 --- /dev/null +++ b/vendor/league/flysystem/composer.json @@ -0,0 +1,68 @@ +{ + "name": "league/flysystem", + "type": "library", + "description": "Filesystem abstraction: Many filesystems, one API.", + "keywords": [ + "filesystem", "filesystems", "files", "storage", "dropbox", "aws", + "abstraction", "s3", "ftp", "sftp", "remote", "webdav", + "file systems", "cloud", "cloud files", "rackspace", "copy.com" + ], + "funding": [ + { + "type": "other", + "url": "https://offset.earth/frankdejonge" + } + ], + "license": "MIT", + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frenky.net" + } + ], + "require": { + "php": "^7.2.5 || ^8.0", + "ext-fileinfo": "*", + "league/mime-type-detection": "^1.3" + }, + "require-dev": { + "phpspec/prophecy": "^1.11.1", + "phpunit/phpunit": "^8.5.8" + }, + "autoload": { + "psr-4": { + "League\\Flysystem\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "League\\Flysystem\\Stub\\": "stub/" + } + }, + "suggest": { + "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", + "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", + "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", + "league/flysystem-webdav": "Allows you to use WebDAV storage", + "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", + "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", + "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", + "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications", + "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", + "ext-ftp": "Allows you to use FTP server storage", + "ext-openssl": "Allows you to use FTPS server storage", + "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", + "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter" + }, + "conflict": { + "league/flysystem-sftp": "<1.0.6" + }, + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "scripts": { + "phpstan": "php phpstan.php" + } +} diff --git a/vendor/league/flysystem/deprecations.md b/vendor/league/flysystem/deprecations.md new file mode 100644 index 00000000..c336a425 --- /dev/null +++ b/vendor/league/flysystem/deprecations.md @@ -0,0 +1,19 @@ +# Deprecations + +This document lists all the planned deprecations. + +## Handlers will be removed in 2.0 + +The `Handler` type and associated calls will be removed in version 2.0. + +### Upgrade path + +You should create your own implementation for handling OOP usage, +but it's recommended to move away from using an OOP-style wrapper entirely. + +The reason for this is that it's too easy for implementation details (for +your application this is Flysystem) to leak into the application. The most +important part for Flysystem is that it improves portability and creates a +solid boundary between your application core and the infrastructure you use. +The OOP-style handling breaks this principle, therefore I want to stop +promoting it. diff --git a/vendor/league/flysystem/src/Adapter/AbstractAdapter.php b/vendor/league/flysystem/src/Adapter/AbstractAdapter.php new file mode 100644 index 00000000..a6a8ed02 --- /dev/null +++ b/vendor/league/flysystem/src/Adapter/AbstractAdapter.php @@ -0,0 +1,72 @@ +<?php + +namespace League\Flysystem\Adapter; + +use League\Flysystem\AdapterInterface; + +abstract class AbstractAdapter implements AdapterInterface +{ + /** + * @var string|null path prefix + */ + protected $pathPrefix; + + /** + * @var string + */ + protected $pathSeparator = '/'; + + /** + * Set the path prefix. + * + * @param string $prefix + * + * @return void + */ + public function setPathPrefix($prefix) + { + $prefix = (string) $prefix; + + if ($prefix === '') { + $this->pathPrefix = null; + + return; + } + + $this->pathPrefix = rtrim($prefix, '\\/') . $this->pathSeparator; + } + + /** + * Get the path prefix. + * + * @return string|null path prefix or null if pathPrefix is empty + */ + public function getPathPrefix() + { + return $this->pathPrefix; + } + + /** + * Prefix a path. + * + * @param string $path + * + * @return string prefixed path + */ + public function applyPathPrefix($path) + { + return $this->getPathPrefix() . ltrim($path, '\\/'); + } + + /** + * Remove a path prefix. + * + * @param string $path + * + * @return string path without the prefix + */ + public function removePathPrefix($path) + { + return substr($path, strlen((string) $this->getPathPrefix())); + } +} diff --git a/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php b/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php new file mode 100644 index 00000000..25d949ea --- /dev/null +++ b/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php @@ -0,0 +1,705 @@ +<?php + +namespace League\Flysystem\Adapter; + +use DateTime; +use League\Flysystem\AdapterInterface; +use League\Flysystem\Config; +use League\Flysystem\NotSupportedException; +use League\Flysystem\SafeStorage; +use RuntimeException; + +abstract class AbstractFtpAdapter extends AbstractAdapter +{ + /** + * @var mixed + */ + protected $connection; + + /** + * @var string + */ + protected $host; + + /** + * @var int + */ + protected $port = 21; + + /** + * @var bool + */ + protected $ssl = false; + + /** + * @var int + */ + protected $timeout = 90; + + /** + * @var bool + */ + protected $passive = true; + + /** + * @var string + */ + protected $separator = '/'; + + /** + * @var string|null + */ + protected $root; + + /** + * @var int + */ + protected $permPublic = 0744; + + /** + * @var int + */ + protected $permPrivate = 0700; + + /** + * @var array + */ + protected $configurable = []; + + /** + * @var string + */ + protected $systemType; + + /** + * @var SafeStorage + */ + protected $safeStorage; + + /** + * True to enable timestamps for FTP servers that return unix-style listings. + * + * @var bool + */ + protected $enableTimestampsOnUnixListings = false; + + /** + * Constructor. + * + * @param array $config + */ + public function __construct(array $config) + { + $this->safeStorage = new SafeStorage(); + $this->setConfig($config); + } + + /** + * Set the config. + * + * @param array $config + * + * @return $this + */ + public function setConfig(array $config) + { + foreach ($this->configurable as $setting) { + if ( ! isset($config[$setting])) { + continue; + } + + $method = 'set' . ucfirst($setting); + + if (method_exists($this, $method)) { + $this->$method($config[$setting]); + } + } + + return $this; + } + + /** + * Returns the host. + * + * @return string + */ + public function getHost() + { + return $this->host; + } + + /** + * Set the host. + * + * @param string $host + * + * @return $this + */ + public function setHost($host) + { + $this->host = $host; + + return $this; + } + + /** + * Set the public permission value. + * + * @param int $permPublic + * + * @return $this + */ + public function setPermPublic($permPublic) + { + $this->permPublic = $permPublic; + + return $this; + } + + /** + * Set the private permission value. + * + * @param int $permPrivate + * + * @return $this + */ + public function setPermPrivate($permPrivate) + { + $this->permPrivate = $permPrivate; + + return $this; + } + + /** + * Returns the ftp port. + * + * @return int + */ + public function getPort() + { + return $this->port; + } + + /** + * Returns the root folder to work from. + * + * @return string + */ + public function getRoot() + { + return $this->root; + } + + /** + * Set the ftp port. + * + * @param int|string $port + * + * @return $this + */ + public function setPort($port) + { + $this->port = (int) $port; + + return $this; + } + + /** + * Set the root folder to work from. + * + * @param string $root + * + * @return $this + */ + public function setRoot($root) + { + $this->root = rtrim($root, '\\/') . $this->separator; + + return $this; + } + + /** + * Returns the ftp username. + * + * @return string username + */ + public function getUsername() + { + $username = $this->safeStorage->retrieveSafely('username'); + + return $username !== null ? $username : 'anonymous'; + } + + /** + * Set ftp username. + * + * @param string $username + * + * @return $this + */ + public function setUsername($username) + { + $this->safeStorage->storeSafely('username', $username); + + return $this; + } + + /** + * Returns the password. + * + * @return string password + */ + public function getPassword() + { + return $this->safeStorage->retrieveSafely('password'); + } + + /** + * Set the ftp password. + * + * @param string $password + * + * @return $this + */ + public function setPassword($password) + { + $this->safeStorage->storeSafely('password', $password); + + return $this; + } + + /** + * Returns the amount of seconds before the connection will timeout. + * + * @return int + */ + public function getTimeout() + { + return $this->timeout; + } + + /** + * Set the amount of seconds before the connection should timeout. + * + * @param int $timeout + * + * @return $this + */ + public function setTimeout($timeout) + { + $this->timeout = (int) $timeout; + + return $this; + } + + /** + * Return the FTP system type. + * + * @return string + */ + public function getSystemType() + { + return $this->systemType; + } + + /** + * Set the FTP system type (windows or unix). + * + * @param string $systemType + * + * @return $this + */ + public function setSystemType($systemType) + { + $this->systemType = strtolower($systemType); + + return $this; + } + + /** + * True to enable timestamps for FTP servers that return unix-style listings. + * + * @param bool $bool + * + * @return $this + */ + public function setEnableTimestampsOnUnixListings($bool = false) + { + $this->enableTimestampsOnUnixListings = $bool; + + return $this; + } + + /** + * @inheritdoc + */ + public function listContents($directory = '', $recursive = false) + { + return $this->listDirectoryContents($directory, $recursive); + } + + abstract protected function listDirectoryContents($directory, $recursive = false); + + /** + * Normalize a directory listing. + * + * @param array $listing + * @param string $prefix + * + * @return array directory listing + */ + protected function normalizeListing(array $listing, $prefix = '') + { + $base = $prefix; + $result = []; + $listing = $this->removeDotDirectories($listing); + + while ($item = array_shift($listing)) { + if (preg_match('#^.*:$#', $item)) { + $base = preg_replace('~^\./*|:$~', '', $item); + continue; + } + + $result[] = $this->normalizeObject($item, $base); + } + + return $this->sortListing($result); + } + + /** + * Sort a directory listing. + * + * @param array $result + * + * @return array sorted listing + */ + protected function sortListing(array $result) + { + $compare = function ($one, $two) { + return strnatcmp($one['path'], $two['path']); + }; + + usort($result, $compare); + + return $result; + } + + /** + * Normalize a file entry. + * + * @param string $item + * @param string $base + * + * @return array normalized file array + * + * @throws NotSupportedException + */ + protected function normalizeObject($item, $base) + { + $systemType = $this->systemType ?: $this->detectSystemType($item); + + if ($systemType === 'unix') { + return $this->normalizeUnixObject($item, $base); + } elseif ($systemType === 'windows') { + return $this->normalizeWindowsObject($item, $base); + } + + throw NotSupportedException::forFtpSystemType($systemType); + } + + /** + * Normalize a Unix file entry. + * + * Given $item contains: + * '-rw-r--r-- 1 ftp ftp 409 Aug 19 09:01 file1.txt' + * + * This function will return: + * [ + * 'type' => 'file', + * 'path' => 'file1.txt', + * 'visibility' => 'public', + * 'size' => 409, + * 'timestamp' => 1566205260 + * ] + * + * @param string $item + * @param string $base + * + * @return array normalized file array + */ + protected function normalizeUnixObject($item, $base) + { + $item = preg_replace('#\s+#', ' ', trim($item), 7); + + if (count(explode(' ', $item, 9)) !== 9) { + throw new RuntimeException("Metadata can't be parsed from item '$item' , not enough parts."); + } + + list($permissions, /* $number */, /* $owner */, /* $group */, $size, $month, $day, $timeOrYear, $name) = explode(' ', $item, 9); + $type = $this->detectType($permissions); + $path = $base === '' ? $name : $base . $this->separator . $name; + + if ($type === 'dir') { + $result = compact('type', 'path'); + if ($this->enableTimestampsOnUnixListings) { + $timestamp = $this->normalizeUnixTimestamp($month, $day, $timeOrYear); + $result += compact('timestamp'); + } + + return $result; + } + + $permissions = $this->normalizePermissions($permissions); + $visibility = $permissions & 0044 ? AdapterInterface::VISIBILITY_PUBLIC : AdapterInterface::VISIBILITY_PRIVATE; + $size = (int) $size; + + $result = compact('type', 'path', 'visibility', 'size'); + if ($this->enableTimestampsOnUnixListings) { + $timestamp = $this->normalizeUnixTimestamp($month, $day, $timeOrYear); + $result += compact('timestamp'); + } + + return $result; + } + + /** + * Only accurate to the minute (current year), or to the day. + * + * Inadequacies in timestamp accuracy are due to limitations of the FTP 'LIST' command + * + * Note: The 'MLSD' command is a machine-readable replacement for 'LIST' + * but many FTP servers do not support it :( + * + * @param string $month e.g. 'Aug' + * @param string $day e.g. '19' + * @param string $timeOrYear e.g. '09:01' OR '2015' + * + * @return int + */ + protected function normalizeUnixTimestamp($month, $day, $timeOrYear) + { + if (is_numeric($timeOrYear)) { + $year = $timeOrYear; + $hour = '00'; + $minute = '00'; + $seconds = '00'; + } else { + $year = date('Y'); + list($hour, $minute) = explode(':', $timeOrYear); + $seconds = '00'; + } + $dateTime = DateTime::createFromFormat('Y-M-j-G:i:s', "{$year}-{$month}-{$day}-{$hour}:{$minute}:{$seconds}"); + + return $dateTime->getTimestamp(); + } + + /** + * Normalize a Windows/DOS file entry. + * + * @param string $item + * @param string $base + * + * @return array normalized file array + */ + protected function normalizeWindowsObject($item, $base) + { + $item = preg_replace('#\s+#', ' ', trim($item), 3); + + if (count(explode(' ', $item, 4)) !== 4) { + throw new RuntimeException("Metadata can't be parsed from item '$item' , not enough parts."); + } + + list($date, $time, $size, $name) = explode(' ', $item, 4); + $path = $base === '' ? $name : $base . $this->separator . $name; + + // Check for the correct date/time format + $format = strlen($date) === 8 ? 'm-d-yH:iA' : 'Y-m-dH:i'; + $dt = DateTime::createFromFormat($format, $date . $time); + $timestamp = $dt ? $dt->getTimestamp() : (int) strtotime("$date $time"); + + if ($size === '<DIR>') { + $type = 'dir'; + + return compact('type', 'path', 'timestamp'); + } + + $type = 'file'; + $visibility = AdapterInterface::VISIBILITY_PUBLIC; + $size = (int) $size; + + return compact('type', 'path', 'visibility', 'size', 'timestamp'); + } + + /** + * Get the system type from a listing item. + * + * @param string $item + * + * @return string the system type + */ + protected function detectSystemType($item) + { + return preg_match('/^[0-9]{2,4}-[0-9]{2}-[0-9]{2}/', trim($item)) ? 'windows' : 'unix'; + } + + /** + * Get the file type from the permissions. + * + * @param string $permissions + * + * @return string file type + */ + protected function detectType($permissions) + { + return substr($permissions, 0, 1) === 'd' ? 'dir' : 'file'; + } + + /** + * Normalize a permissions string. + * + * @param string $permissions + * + * @return int + */ + protected function normalizePermissions($permissions) + { + if (is_numeric($permissions)) { + return ((int) $permissions) & 0777; + } + + // remove the type identifier + $permissions = substr($permissions, 1); + + // map the string rights to the numeric counterparts + $map = ['-' => '0', 'r' => '4', 'w' => '2', 'x' => '1']; + $permissions = strtr($permissions, $map); + + // split up the permission groups + $parts = str_split($permissions, 3); + + // convert the groups + $mapper = function ($part) { + return array_sum(str_split($part)); + }; + + // converts to decimal number + return octdec(implode('', array_map($mapper, $parts))); + } + + /** + * Filter out dot-directories. + * + * @param array $list + * + * @return array + */ + public function removeDotDirectories(array $list) + { + $filter = function ($line) { + return $line !== '' && ! preg_match('#.* \.(\.)?$|^total#', $line); + }; + + return array_filter($list, $filter); + } + + /** + * @inheritdoc + */ + public function has($path) + { + return $this->getMetadata($path); + } + + /** + * @inheritdoc + */ + public function getSize($path) + { + return $this->getMetadata($path); + } + + /** + * @inheritdoc + */ + public function getVisibility($path) + { + return $this->getMetadata($path); + } + + /** + * Ensure a directory exists. + * + * @param string $dirname + */ + public function ensureDirectory($dirname) + { + $dirname = (string) $dirname; + + if ($dirname !== '' && ! $this->has($dirname)) { + $this->createDir($dirname, new Config()); + } + } + + /** + * @return mixed + */ + public function getConnection() + { + if ( ! $this->isConnected()) { + $this->disconnect(); + $this->connect(); + } + + return $this->connection; + } + + /** + * Get the public permission value. + * + * @return int + */ + public function getPermPublic() + { + return $this->permPublic; + } + + /** + * Get the private permission value. + * + * @return int + */ + public function getPermPrivate() + { + return $this->permPrivate; + } + + /** + * Disconnect on destruction. + */ + public function __destruct() + { + $this->disconnect(); + } + + /** + * Establish a connection. + */ + abstract public function connect(); + + /** + * Close the connection. + */ + abstract public function disconnect(); + + /** + * Check if a connection is active. + * + * @return bool + */ + abstract public function isConnected(); + + protected function escapePath($path) + { + return str_replace(['*', '[', ']'], ['\\*', '\\[', '\\]'], $path); + } +} diff --git a/vendor/league/flysystem/src/Adapter/CanOverwriteFiles.php b/vendor/league/flysystem/src/Adapter/CanOverwriteFiles.php new file mode 100644 index 00000000..fd8d2161 --- /dev/null +++ b/vendor/league/flysystem/src/Adapter/CanOverwriteFiles.php @@ -0,0 +1,12 @@ +<?php + + +namespace League\Flysystem\Adapter; + +/** + * Adapters that implement this interface let the Filesystem know that files can be overwritten using the write + * functions and don't need the update function to be called. This can help improve performance when asserts are disabled. + */ +interface CanOverwriteFiles +{ +} diff --git a/vendor/league/flysystem/src/Adapter/Ftp.php b/vendor/league/flysystem/src/Adapter/Ftp.php new file mode 100644 index 00000000..b7886bb2 --- /dev/null +++ b/vendor/league/flysystem/src/Adapter/Ftp.php @@ -0,0 +1,584 @@ +<?php + +namespace League\Flysystem\Adapter; + +use League\Flysystem\Adapter\Polyfill\StreamedCopyTrait; +use League\Flysystem\AdapterInterface; +use League\Flysystem\Config; +use League\Flysystem\ConnectionErrorException; +use League\Flysystem\ConnectionRuntimeException; +use League\Flysystem\InvalidRootException; +use League\Flysystem\Util; +use League\Flysystem\Util\MimeType; + +use function in_array; + +class Ftp extends AbstractFtpAdapter +{ + use StreamedCopyTrait; + + /** + * @var int + */ + protected $transferMode = FTP_BINARY; + + /** + * @var null|bool + */ + protected $ignorePassiveAddress = null; + + /** + * @var bool + */ + protected $recurseManually = false; + + /** + * @var bool + */ + protected $utf8 = false; + + /** + * @var array + */ + protected $configurable = [ + 'host', + 'port', + 'username', + 'password', + 'ssl', + 'timeout', + 'root', + 'permPrivate', + 'permPublic', + 'passive', + 'transferMode', + 'systemType', + 'ignorePassiveAddress', + 'recurseManually', + 'utf8', + 'enableTimestampsOnUnixListings', + ]; + + /** + * @var bool + */ + protected $isPureFtpd; + + /** + * Set the transfer mode. + * + * @param int $mode + * + * @return $this + */ + public function setTransferMode($mode) + { + $this->transferMode = $mode; + + return $this; + } + + /** + * Set if Ssl is enabled. + * + * @param bool $ssl + * + * @return $this + */ + public function setSsl($ssl) + { + $this->ssl = (bool) $ssl; + + return $this; + } + + /** + * Set if passive mode should be used. + * + * @param bool $passive + */ + public function setPassive($passive = true) + { + $this->passive = $passive; + } + + /** + * @param bool $ignorePassiveAddress + */ + public function setIgnorePassiveAddress($ignorePassiveAddress) + { + $this->ignorePassiveAddress = $ignorePassiveAddress; + } + + /** + * @param bool $recurseManually + */ + public function setRecurseManually($recurseManually) + { + $this->recurseManually = $recurseManually; + } + + /** + * @param bool $utf8 + */ + public function setUtf8($utf8) + { + $this->utf8 = (bool) $utf8; + } + + /** + * Connect to the FTP server. + */ + public function connect() + { + $tries = 3; + start_connecting: + + if ($this->ssl) { + $this->connection = @ftp_ssl_connect($this->getHost(), $this->getPort(), $this->getTimeout()); + } else { + $this->connection = @ftp_connect($this->getHost(), $this->getPort(), $this->getTimeout()); + } + + if ( ! $this->connection) { + $tries--; + + if ($tries > 0) goto start_connecting; + + throw new ConnectionRuntimeException('Could not connect to host: ' . $this->getHost() . ', port:' . $this->getPort()); + } + + $this->login(); + $this->setUtf8Mode(); + $this->setConnectionPassiveMode(); + $this->setConnectionRoot(); + $this->isPureFtpd = $this->isPureFtpdServer(); + } + + /** + * Set the connection to UTF-8 mode. + */ + protected function setUtf8Mode() + { + if ($this->utf8) { + $response = ftp_raw($this->connection, "OPTS UTF8 ON"); + if (!in_array(substr($response[0], 0, 3), ['200', '202'])) { + throw new ConnectionRuntimeException( + 'Could not set UTF-8 mode for connection: ' . $this->getHost() . '::' . $this->getPort() + ); + } + } + } + + /** + * Set the connections to passive mode. + * + * @throws ConnectionRuntimeException + */ + protected function setConnectionPassiveMode() + { + if (is_bool($this->ignorePassiveAddress) && defined('FTP_USEPASVADDRESS')) { + ftp_set_option($this->connection, FTP_USEPASVADDRESS, ! $this->ignorePassiveAddress); + } + + if ( ! ftp_pasv($this->connection, $this->passive)) { + throw new ConnectionRuntimeException( + 'Could not set passive mode for connection: ' . $this->getHost() . '::' . $this->getPort() + ); + } + } + + /** + * Set the connection root. + */ + protected function setConnectionRoot() + { + $root = $this->getRoot(); + $connection = $this->connection; + + if ($root && ! ftp_chdir($connection, $root)) { + throw new InvalidRootException('Root is invalid or does not exist: ' . $this->getRoot()); + } + + // Store absolute path for further reference. + // This is needed when creating directories and + // initial root was a relative path, else the root + // would be relative to the chdir'd path. + $this->root = ftp_pwd($connection); + } + + /** + * Login. + * + * @throws ConnectionRuntimeException + */ + protected function login() + { + set_error_handler(function () { + }); + $isLoggedIn = ftp_login( + $this->connection, + $this->getUsername(), + $this->getPassword() + ); + restore_error_handler(); + + if ( ! $isLoggedIn) { + $this->disconnect(); + throw new ConnectionRuntimeException( + 'Could not login with connection: ' . $this->getHost() . '::' . $this->getPort( + ) . ', username: ' . $this->getUsername() + ); + } + } + + /** + * Disconnect from the FTP server. + */ + public function disconnect() + { + if ($this->hasFtpConnection()) { + @ftp_close($this->connection); + } + + $this->connection = null; + } + + /** + * @inheritdoc + */ + public function write($path, $contents, Config $config) + { + $stream = fopen('php://temp', 'w+b'); + fwrite($stream, $contents); + rewind($stream); + $result = $this->writeStream($path, $stream, $config); + fclose($stream); + + if ($result === false) { + return false; + } + + $result['contents'] = $contents; + $result['mimetype'] = $config->get('mimetype') ?: Util::guessMimeType($path, $contents); + + return $result; + } + + /** + * @inheritdoc + */ + public function writeStream($path, $resource, Config $config) + { + $this->ensureDirectory(Util::dirname($path)); + + if ( ! ftp_fput($this->getConnection(), $path, $resource, $this->transferMode)) { + return false; + } + + if ($visibility = $config->get('visibility')) { + $this->setVisibility($path, $visibility); + } + + $type = 'file'; + + return compact('type', 'path', 'visibility'); + } + + /** + * @inheritdoc + */ + public function update($path, $contents, Config $config) + { + return $this->write($path, $contents, $config); + } + + /** + * @inheritdoc + */ + public function updateStream($path, $resource, Config $config) + { + return $this->writeStream($path, $resource, $config); + } + + /** + * @inheritdoc + */ + public function rename($path, $newpath) + { + return ftp_rename($this->getConnection(), $path, $newpath); + } + + /** + * @inheritdoc + */ + public function delete($path) + { + return ftp_delete($this->getConnection(), $path); + } + + /** + * @inheritdoc + */ + public function deleteDir($dirname) + { + $connection = $this->getConnection(); + $contents = array_reverse($this->listDirectoryContents($dirname, false)); + + foreach ($contents as $object) { + if ($object['type'] === 'file') { + if ( ! ftp_delete($connection, $object['path'])) { + return false; + } + } elseif ( ! $this->deleteDir($object['path'])) { + return false; + } + } + + return ftp_rmdir($connection, $dirname); + } + + /** + * @inheritdoc + */ + public function createDir($dirname, Config $config) + { + $connection = $this->getConnection(); + $directories = explode('/', $dirname); + + foreach ($directories as $directory) { + if (false === $this->createActualDirectory($directory, $connection)) { + $this->setConnectionRoot(); + + return false; + } + + ftp_chdir($connection, $directory); + } + + $this->setConnectionRoot(); + + return ['type' => 'dir', 'path' => $dirname]; + } + + /** + * Create a directory. + * + * @param string $directory + * @param resource $connection + * + * @return bool + */ + protected function createActualDirectory($directory, $connection) + { + // List the current directory + $listing = ftp_nlist($connection, '.') ?: []; + + foreach ($listing as $key => $item) { + if (preg_match('~^\./.*~', $item)) { + $listing[$key] = substr($item, 2); + } + } + + if (in_array($directory, $listing, true)) { + return true; + } + + return (boolean) ftp_mkdir($connection, $directory); + } + + /** + * @inheritdoc + */ + public function getMetadata($path) + { + if ($path === '') { + return ['type' => 'dir', 'path' => '']; + } + + if (@ftp_chdir($this->getConnection(), $path) === true) { + $this->setConnectionRoot(); + + return ['type' => 'dir', 'path' => $path]; + } + + $listing = $this->ftpRawlist('-A', $path); + + if (empty($listing) || in_array('total 0', $listing, true)) { + return false; + } + + if (preg_match('/.* not found/', $listing[0])) { + return false; + } + + if (preg_match('/^total [0-9]*$/', $listing[0])) { + array_shift($listing); + } + + return $this->normalizeObject($listing[0], ''); + } + + /** + * @inheritdoc + */ + public function getMimetype($path) + { + if ( ! $metadata = $this->getMetadata($path)) { + return false; + } + + $metadata['mimetype'] = MimeType::detectByFilename($path); + + return $metadata; + } + + /** + * @inheritdoc + */ + public function getTimestamp($path) + { + $timestamp = ftp_mdtm($this->getConnection(), $path); + + return ($timestamp !== -1) ? ['path' => $path, 'timestamp' => $timestamp] : false; + } + + /** + * @inheritdoc + */ + public function read($path) + { + if ( ! $object = $this->readStream($path)) { + return false; + } + + $object['contents'] = stream_get_contents($object['stream']); + fclose($object['stream']); + unset($object['stream']); + + return $object; + } + + /** + * @inheritdoc + */ + public function readStream($path) + { + $stream = fopen('php://temp', 'w+b'); + $result = ftp_fget($this->getConnection(), $stream, $path, $this->transferMode); + rewind($stream); + + if ( ! $result) { + fclose($stream); + + return false; + } + + return ['type' => 'file', 'path' => $path, 'stream' => $stream]; + } + + /** + * @inheritdoc + */ + public function setVisibility($path, $visibility) + { + $mode = $visibility === AdapterInterface::VISIBILITY_PUBLIC ? $this->getPermPublic() : $this->getPermPrivate(); + + if ( ! ftp_chmod($this->getConnection(), $mode, $path)) { + return false; + } + + return compact('path', 'visibility'); + } + + /** + * @inheritdoc + * + * @param string $directory + */ + protected function listDirectoryContents($directory, $recursive = true) + { + if ($recursive && $this->recurseManually) { + return $this->listDirectoryContentsRecursive($directory); + } + + $options = $recursive ? '-alnR' : '-aln'; + $listing = $this->ftpRawlist($options, $directory); + + return $listing ? $this->normalizeListing($listing, $directory) : []; + } + + /** + * @inheritdoc + * + * @param string $directory + */ + protected function listDirectoryContentsRecursive($directory) + { + $listing = $this->normalizeListing($this->ftpRawlist('-aln', $directory) ?: [], $directory); + $output = []; + + foreach ($listing as $item) { + $output[] = $item; + if ($item['type'] !== 'dir') { + continue; + } + $output = array_merge($output, $this->listDirectoryContentsRecursive($item['path'])); + } + + return $output; + } + + /** + * Check if the connection is open. + * + * @return bool + * + * @throws ConnectionErrorException + */ + public function isConnected() + { + return $this->hasFtpConnection() && $this->getRawExecResponseCode('NOOP') === 200; + } + + /** + * @return bool + */ + protected function isPureFtpdServer() + { + $response = ftp_raw($this->connection, 'HELP'); + + return stripos(implode(' ', $response), 'Pure-FTPd') !== false; + } + + /** + * The ftp_rawlist function with optional escaping. + * + * @param string $options + * @param string $path + * + * @return array + */ + protected function ftpRawlist($options, $path) + { + $connection = $this->getConnection(); + + if ($this->isPureFtpd) { + $path = str_replace([' ', '[', ']'], ['\ ', '\\[', '\\]'], $path); + } + + return ftp_rawlist($connection, $options . ' ' . $this->escapePath($path)); + } + + private function getRawExecResponseCode($command) + { + $response = @ftp_raw($this->connection, trim($command)) ?: []; + + return (int) preg_replace('/\D/', '', implode(' ', (array) $response)); + } + + private function hasFtpConnection(): bool + { + return is_resource($this->connection) || $this->connection instanceof \FTP\Connection; + } +} diff --git a/vendor/league/flysystem/src/Adapter/Ftpd.php b/vendor/league/flysystem/src/Adapter/Ftpd.php new file mode 100644 index 00000000..7e71d19f --- /dev/null +++ b/vendor/league/flysystem/src/Adapter/Ftpd.php @@ -0,0 +1,48 @@ +<?php + +namespace League\Flysystem\Adapter; + +class Ftpd extends Ftp +{ + /** + * @inheritdoc + */ + public function getMetadata($path) + { + if ($path === '') { + return ['type' => 'dir', 'path' => '']; + } + + if (@ftp_chdir($this->getConnection(), $path) === true) { + $this->setConnectionRoot(); + + return ['type' => 'dir', 'path' => $path]; + } + + $object = ftp_raw($this->getConnection(), 'STAT ' . $this->escapePath($path)); + + if ( ! $object || count($object) < 3) { + return false; + } + + if (substr($object[1], 0, 5) === "ftpd:") { + return false; + } + + return $this->normalizeObject($object[1], ''); + } + + /** + * @inheritdoc + */ + protected function listDirectoryContents($directory, $recursive = true) + { + $listing = ftp_rawlist($this->getConnection(), $this->escapePath($directory), $recursive); + + if ($listing === false || ( ! empty($listing) && substr($listing[0], 0, 5) === "ftpd:")) { + return []; + } + + return $this->normalizeListing($listing, $directory); + } +} diff --git a/vendor/league/flysystem/src/Adapter/Local.php b/vendor/league/flysystem/src/Adapter/Local.php new file mode 100644 index 00000000..747c463e --- /dev/null +++ b/vendor/league/flysystem/src/Adapter/Local.php @@ -0,0 +1,533 @@ +<?php + +namespace League\Flysystem\Adapter; + +use DirectoryIterator; +use FilesystemIterator; +use finfo as Finfo; +use League\Flysystem\Config; +use League\Flysystem\Exception; +use League\Flysystem\NotSupportedException; +use League\Flysystem\UnreadableFileException; +use League\Flysystem\Util; +use LogicException; +use RecursiveDirectoryIterator; +use RecursiveIteratorIterator; +use SplFileInfo; + +class Local extends AbstractAdapter +{ + /** + * @var int + */ + const SKIP_LINKS = 0001; + + /** + * @var int + */ + const DISALLOW_LINKS = 0002; + + /** + * @var array + */ + protected static $permissions = [ + 'file' => [ + 'public' => 0644, + 'private' => 0600, + ], + 'dir' => [ + 'public' => 0755, + 'private' => 0700, + ], + ]; + + /** + * @var string + */ + protected $pathSeparator = DIRECTORY_SEPARATOR; + + /** + * @var array + */ + protected $permissionMap; + + /** + * @var int + */ + protected $writeFlags; + + /** + * @var int + */ + private $linkHandling; + + /** + * Constructor. + * + * @param string $root + * @param int $writeFlags + * @param int $linkHandling + * @param array $permissions + * + * @throws LogicException + */ + public function __construct($root, $writeFlags = LOCK_EX, $linkHandling = self::DISALLOW_LINKS, array $permissions = []) + { + $root = is_link($root) ? realpath($root) : $root; + $this->permissionMap = array_replace_recursive(static::$permissions, $permissions); + $this->ensureDirectory($root); + + if ( ! is_dir($root) || ! is_readable($root)) { + throw new LogicException('The root path ' . $root . ' is not readable.'); + } + + $this->setPathPrefix($root); + $this->writeFlags = $writeFlags; + $this->linkHandling = $linkHandling; + } + + /** + * Ensure the root directory exists. + * + * @param string $root root directory path + * + * @return void + * + * @throws Exception in case the root directory can not be created + */ + protected function ensureDirectory($root) + { + if ( ! is_dir($root)) { + $umask = umask(0); + + if ( ! @mkdir($root, $this->permissionMap['dir']['public'], true)) { + $mkdirError = error_get_last(); + } + + umask($umask); + clearstatcache(false, $root); + + if ( ! is_dir($root)) { + $errorMessage = isset($mkdirError['message']) ? $mkdirError['message'] : ''; + throw new Exception(sprintf('Impossible to create the root directory "%s". %s', $root, $errorMessage)); + } + } + } + + /** + * @inheritdoc + */ + public function has($path) + { + $location = $this->applyPathPrefix($path); + + return file_exists($location); + } + + /** + * @inheritdoc + */ + public function write($path, $contents, Config $config) + { + $location = $this->applyPathPrefix($path); + $this->ensureDirectory(dirname($location)); + + if (($size = file_put_contents($location, $contents, $this->writeFlags)) === false) { + return false; + } + + $type = 'file'; + $result = compact('contents', 'type', 'size', 'path'); + + if ($visibility = $config->get('visibility')) { + $result['visibility'] = $visibility; + $this->setVisibility($path, $visibility); + } + + return $result; + } + + /** + * @inheritdoc + */ + public function writeStream($path, $resource, Config $config) + { + $location = $this->applyPathPrefix($path); + $this->ensureDirectory(dirname($location)); + $stream = fopen($location, 'w+b'); + + if ( ! $stream || stream_copy_to_stream($resource, $stream) === false || ! fclose($stream)) { + return false; + } + + $type = 'file'; + $result = compact('type', 'path'); + + if ($visibility = $config->get('visibility')) { + $this->setVisibility($path, $visibility); + $result['visibility'] = $visibility; + } + + return $result; + } + + /** + * @inheritdoc + */ + public function readStream($path) + { + $location = $this->applyPathPrefix($path); + $stream = fopen($location, 'rb'); + + return ['type' => 'file', 'path' => $path, 'stream' => $stream]; + } + + /** + * @inheritdoc + */ + public function updateStream($path, $resource, Config $config) + { + return $this->writeStream($path, $resource, $config); + } + + /** + * @inheritdoc + */ + public function update($path, $contents, Config $config) + { + $location = $this->applyPathPrefix($path); + $size = file_put_contents($location, $contents, $this->writeFlags); + + if ($size === false) { + return false; + } + + $type = 'file'; + + $result = compact('type', 'path', 'size', 'contents'); + + if ($visibility = $config->get('visibility')) { + $this->setVisibility($path, $visibility); + $result['visibility'] = $visibility; + } + + return $result; + } + + /** + * @inheritdoc + */ + public function read($path) + { + $location = $this->applyPathPrefix($path); + $contents = @file_get_contents($location); + + if ($contents === false) { + return false; + } + + return ['type' => 'file', 'path' => $path, 'contents' => $contents]; + } + + /** + * @inheritdoc + */ + public function rename($path, $newpath) + { + $location = $this->applyPathPrefix($path); + $destination = $this->applyPathPrefix($newpath); + $parentDirectory = $this->applyPathPrefix(Util::dirname($newpath)); + $this->ensureDirectory($parentDirectory); + + return rename($location, $destination); + } + + /** + * @inheritdoc + */ + public function copy($path, $newpath) + { + $location = $this->applyPathPrefix($path); + $destination = $this->applyPathPrefix($newpath); + $this->ensureDirectory(dirname($destination)); + + return copy($location, $destination); + } + + /** + * @inheritdoc + */ + public function delete($path) + { + $location = $this->applyPathPrefix($path); + + return @unlink($location); + } + + /** + * @inheritdoc + */ + public function listContents($directory = '', $recursive = false) + { + $result = []; + $location = $this->applyPathPrefix($directory); + + if ( ! is_dir($location)) { + return []; + } + + $iterator = $recursive ? $this->getRecursiveDirectoryIterator($location) : $this->getDirectoryIterator($location); + + foreach ($iterator as $file) { + $path = $this->getFilePath($file); + + if (preg_match('#(^|/|\\\\)\.{1,2}$#', $path)) { + continue; + } + + $result[] = $this->normalizeFileInfo($file); + } + + unset($iterator); + + return array_filter($result); + } + + /** + * @inheritdoc + */ + public function getMetadata($path) + { + $location = $this->applyPathPrefix($path); + clearstatcache(false, $location); + $info = new SplFileInfo($location); + + return $this->normalizeFileInfo($info); + } + + /** + * @inheritdoc + */ + public function getSize($path) + { + return $this->getMetadata($path); + } + + /** + * @inheritdoc + */ + public function getMimetype($path) + { + $location = $this->applyPathPrefix($path); + $finfo = new Finfo(FILEINFO_MIME_TYPE); + $mimetype = $finfo->file($location); + + if (in_array($mimetype, ['application/octet-stream', 'inode/x-empty', 'application/x-empty'])) { + $mimetype = Util\MimeType::detectByFilename($location); + } + + return ['path' => $path, 'type' => 'file', 'mimetype' => $mimetype]; + } + + /** + * @inheritdoc + */ + public function getTimestamp($path) + { + return $this->getMetadata($path); + } + + /** + * @inheritdoc + */ + public function getVisibility($path) + { + $location = $this->applyPathPrefix($path); + clearstatcache(false, $location); + $permissions = octdec(substr(sprintf('%o', fileperms($location)), -4)); + $type = is_dir($location) ? 'dir' : 'file'; + + foreach ($this->permissionMap[$type] as $visibility => $visibilityPermissions) { + if ($visibilityPermissions == $permissions) { + return compact('path', 'visibility'); + } + } + + $visibility = substr(sprintf('%o', fileperms($location)), -4); + + return compact('path', 'visibility'); + } + + /** + * @inheritdoc + */ + public function setVisibility($path, $visibility) + { + $location = $this->applyPathPrefix($path); + $type = is_dir($location) ? 'dir' : 'file'; + $success = chmod($location, $this->permissionMap[$type][$visibility]); + + if ($success === false) { + return false; + } + + return compact('path', 'visibility'); + } + + /** + * @inheritdoc + */ + public function createDir($dirname, Config $config) + { + $location = $this->applyPathPrefix($dirname); + $umask = umask(0); + $visibility = $config->get('visibility', 'public'); + $return = ['path' => $dirname, 'type' => 'dir']; + + if ( ! is_dir($location)) { + if (false === @mkdir($location, $this->permissionMap['dir'][$visibility], true) + || false === is_dir($location)) { + $return = false; + } + } + + umask($umask); + + return $return; + } + + /** + * @inheritdoc + */ + public function deleteDir($dirname) + { + $location = $this->applyPathPrefix($dirname); + + if ( ! is_dir($location)) { + return false; + } + + $contents = $this->getRecursiveDirectoryIterator($location, RecursiveIteratorIterator::CHILD_FIRST); + + /** @var SplFileInfo $file */ + foreach ($contents as $file) { + $this->guardAgainstUnreadableFileInfo($file); + $this->deleteFileInfoObject($file); + } + + unset($contents); + + return rmdir($location); + } + + /** + * @param SplFileInfo $file + */ + protected function deleteFileInfoObject(SplFileInfo $file) + { + switch ($file->getType()) { + case 'dir': + rmdir($file->getRealPath()); + break; + case 'link': + unlink($file->getPathname()); + break; + default: + unlink($file->getRealPath()); + } + } + + /** + * Normalize the file info. + * + * @param SplFileInfo $file + * + * @return array|void + * + * @throws NotSupportedException + */ + protected function normalizeFileInfo(SplFileInfo $file) + { + if ( ! $file->isLink()) { + return $this->mapFileInfo($file); + } + + if ($this->linkHandling & self::DISALLOW_LINKS) { + throw NotSupportedException::forLink($file); + } + } + + /** + * Get the normalized path from a SplFileInfo object. + * + * @param SplFileInfo $file + * + * @return string + */ + protected function getFilePath(SplFileInfo $file) + { + $location = $file->getPathname(); + $path = $this->removePathPrefix($location); + + return trim(str_replace('\\', '/', $path), '/'); + } + + /** + * @param string $path + * @param int $mode + * + * @return RecursiveIteratorIterator + */ + protected function getRecursiveDirectoryIterator($path, $mode = RecursiveIteratorIterator::SELF_FIRST) + { + return new RecursiveIteratorIterator( + new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS), + $mode + ); + } + + /** + * @param string $path + * + * @return DirectoryIterator + */ + protected function getDirectoryIterator($path) + { + $iterator = new DirectoryIterator($path); + + return $iterator; + } + + /** + * @param SplFileInfo $file + * + * @return array + */ + protected function mapFileInfo(SplFileInfo $file) + { + $normalized = [ + 'type' => $file->getType(), + 'path' => $this->getFilePath($file), + ]; + + $normalized['timestamp'] = $file->getMTime(); + + if ($normalized['type'] === 'file') { + $normalized['size'] = $file->getSize(); + } + + return $normalized; + } + + /** + * @param SplFileInfo $file + * + * @throws UnreadableFileException + */ + protected function guardAgainstUnreadableFileInfo(SplFileInfo $file) + { + if ( ! $file->isReadable()) { + throw UnreadableFileException::forFileInfo($file); + } + } +} diff --git a/vendor/league/flysystem/src/Adapter/NullAdapter.php b/vendor/league/flysystem/src/Adapter/NullAdapter.php new file mode 100644 index 00000000..2527087f --- /dev/null +++ b/vendor/league/flysystem/src/Adapter/NullAdapter.php @@ -0,0 +1,144 @@ +<?php + +namespace League\Flysystem\Adapter; + +use League\Flysystem\Adapter\Polyfill\StreamedCopyTrait; +use League\Flysystem\Adapter\Polyfill\StreamedTrait; +use League\Flysystem\Config; + +class NullAdapter extends AbstractAdapter +{ + use StreamedTrait; + use StreamedCopyTrait; + + /** + * Check whether a file is present. + * + * @param string $path + * + * @return bool + */ + public function has($path) + { + return false; + } + + /** + * @inheritdoc + */ + public function write($path, $contents, Config $config) + { + $type = 'file'; + $result = compact('contents', 'type', 'path'); + + if ($visibility = $config->get('visibility')) { + $result['visibility'] = $visibility; + } + + return $result; + } + + /** + * @inheritdoc + */ + public function update($path, $contents, Config $config) + { + return false; + } + + /** + * @inheritdoc + */ + public function read($path) + { + return false; + } + + /** + * @inheritdoc + */ + public function rename($path, $newpath) + { + return false; + } + + /** + * @inheritdoc + */ + public function delete($path) + { + return false; + } + + /** + * @inheritdoc + */ + public function listContents($directory = '', $recursive = false) + { + return []; + } + + /** + * @inheritdoc + */ + public function getMetadata($path) + { + return false; + } + + /** + * @inheritdoc + */ + public function getSize($path) + { + return false; + } + + /** + * @inheritdoc + */ + public function getMimetype($path) + { + return false; + } + + /** + * @inheritdoc + */ + public function getTimestamp($path) + { + return false; + } + + /** + * @inheritdoc + */ + public function getVisibility($path) + { + return false; + } + + /** + * @inheritdoc + */ + public function setVisibility($path, $visibility) + { + return compact('visibility'); + } + + /** + * @inheritdoc + */ + public function createDir($dirname, Config $config) + { + return ['path' => $dirname, 'type' => 'dir']; + } + + /** + * @inheritdoc + */ + public function deleteDir($dirname) + { + return false; + } +} diff --git a/vendor/league/flysystem/src/Adapter/Polyfill/NotSupportingVisibilityTrait.php b/vendor/league/flysystem/src/Adapter/Polyfill/NotSupportingVisibilityTrait.php new file mode 100644 index 00000000..fc0a747a --- /dev/null +++ b/vendor/league/flysystem/src/Adapter/Polyfill/NotSupportingVisibilityTrait.php @@ -0,0 +1,33 @@ +<?php + +namespace League\Flysystem\Adapter\Polyfill; + +use LogicException; + +trait NotSupportingVisibilityTrait +{ + /** + * Get the visibility of a file. + * + * @param string $path + * + * @throws LogicException + */ + public function getVisibility($path) + { + throw new LogicException(get_class($this) . ' does not support visibility. Path: ' . $path); + } + + /** + * Set the visibility for a file. + * + * @param string $path + * @param string $visibility + * + * @throws LogicException + */ + public function setVisibility($path, $visibility) + { + throw new LogicException(get_class($this) . ' does not support visibility. Path: ' . $path . ', visibility: ' . $visibility); + } +} diff --git a/vendor/league/flysystem/src/Adapter/Polyfill/StreamedCopyTrait.php b/vendor/league/flysystem/src/Adapter/Polyfill/StreamedCopyTrait.php new file mode 100644 index 00000000..1b491a49 --- /dev/null +++ b/vendor/league/flysystem/src/Adapter/Polyfill/StreamedCopyTrait.php @@ -0,0 +1,51 @@ +<?php + +namespace League\Flysystem\Adapter\Polyfill; + +use League\Flysystem\Config; + +trait StreamedCopyTrait +{ + /** + * Copy a file. + * + * @param string $path + * @param string $newpath + * + * @return bool + */ + public function copy($path, $newpath) + { + $response = $this->readStream($path); + + if ($response === false || ! is_resource($response['stream'])) { + return false; + } + + $result = $this->writeStream($newpath, $response['stream'], new Config()); + + if ($result !== false && is_resource($response['stream'])) { + fclose($response['stream']); + } + + return $result !== false; + } + + // Required abstract method + + /** + * @param string $path + * + * @return resource + */ + abstract public function readStream($path); + + /** + * @param string $path + * @param resource $resource + * @param Config $config + * + * @return resource + */ + abstract public function writeStream($path, $resource, Config $config); +} diff --git a/vendor/league/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php b/vendor/league/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php new file mode 100644 index 00000000..2b31c01d --- /dev/null +++ b/vendor/league/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php @@ -0,0 +1,44 @@ +<?php + +namespace League\Flysystem\Adapter\Polyfill; + +/** + * A helper for adapters that only handle strings to provide read streams. + */ +trait StreamedReadingTrait +{ + /** + * Reads a file as a stream. + * + * @param string $path + * + * @return array|false + * + * @see League\Flysystem\ReadInterface::readStream() + */ + public function readStream($path) + { + if ( ! $data = $this->read($path)) { + return false; + } + + $stream = fopen('php://temp', 'w+b'); + fwrite($stream, $data['contents']); + rewind($stream); + $data['stream'] = $stream; + unset($data['contents']); + + return $data; + } + + /** + * Reads a file. + * + * @param string $path + * + * @return array|false + * + * @see League\Flysystem\ReadInterface::read() + */ + abstract public function read($path); +} diff --git a/vendor/league/flysystem/src/Adapter/Polyfill/StreamedTrait.php b/vendor/league/flysystem/src/Adapter/Polyfill/StreamedTrait.php new file mode 100644 index 00000000..80424960 --- /dev/null +++ b/vendor/league/flysystem/src/Adapter/Polyfill/StreamedTrait.php @@ -0,0 +1,9 @@ +<?php + +namespace League\Flysystem\Adapter\Polyfill; + +trait StreamedTrait +{ + use StreamedReadingTrait; + use StreamedWritingTrait; +} diff --git a/vendor/league/flysystem/src/Adapter/Polyfill/StreamedWritingTrait.php b/vendor/league/flysystem/src/Adapter/Polyfill/StreamedWritingTrait.php new file mode 100644 index 00000000..8c91e83f --- /dev/null +++ b/vendor/league/flysystem/src/Adapter/Polyfill/StreamedWritingTrait.php @@ -0,0 +1,60 @@ +<?php + +namespace League\Flysystem\Adapter\Polyfill; + +use League\Flysystem\Config; +use League\Flysystem\Util; + +trait StreamedWritingTrait +{ + /** + * Stream fallback delegator. + * + * @param string $path + * @param resource $resource + * @param Config $config + * @param string $fallback + * + * @return mixed fallback result + */ + protected function stream($path, $resource, Config $config, $fallback) + { + Util::rewindStream($resource); + $contents = stream_get_contents($resource); + $fallbackCall = [$this, $fallback]; + + return call_user_func($fallbackCall, $path, $contents, $config); + } + + /** + * Write using a stream. + * + * @param string $path + * @param resource $resource + * @param Config $config + * + * @return mixed false or file metadata + */ + public function writeStream($path, $resource, Config $config) + { + return $this->stream($path, $resource, $config, 'write'); + } + + /** + * Update a file using a stream. + * + * @param string $path + * @param resource $resource + * @param Config $config Config object or visibility setting + * + * @return mixed false of file metadata + */ + public function updateStream($path, $resource, Config $config) + { + return $this->stream($path, $resource, $config, 'update'); + } + + // Required abstract methods + abstract public function write($pash, $contents, Config $config); + abstract public function update($pash, $contents, Config $config); +} diff --git a/vendor/league/flysystem/src/Adapter/SynologyFtp.php b/vendor/league/flysystem/src/Adapter/SynologyFtp.php new file mode 100644 index 00000000..fe0d344c --- /dev/null +++ b/vendor/league/flysystem/src/Adapter/SynologyFtp.php @@ -0,0 +1,8 @@ +<?php + +namespace League\Flysystem\Adapter; + +class SynologyFtp extends Ftpd +{ + // This class merely exists because of BC. +} diff --git a/vendor/league/flysystem/src/AdapterInterface.php b/vendor/league/flysystem/src/AdapterInterface.php new file mode 100644 index 00000000..567fc5a2 --- /dev/null +++ b/vendor/league/flysystem/src/AdapterInterface.php @@ -0,0 +1,118 @@ +<?php + +namespace League\Flysystem; + +interface AdapterInterface extends ReadInterface +{ + /** + * @const VISIBILITY_PUBLIC public visibility + */ + const VISIBILITY_PUBLIC = 'public'; + + /** + * @const VISIBILITY_PRIVATE private visibility + */ + const VISIBILITY_PRIVATE = 'private'; + + /** + * Write a new file. + * + * @param string $path + * @param string $contents + * @param Config $config Config object + * + * @return array|false false on failure file meta data on success + */ + public function write($path, $contents, Config $config); + + /** + * Write a new file using a stream. + * + * @param string $path + * @param resource $resource + * @param Config $config Config object + * + * @return array|false false on failure file meta data on success + */ + public function writeStream($path, $resource, Config $config); + + /** + * Update a file. + * + * @param string $path + * @param string $contents + * @param Config $config Config object + * + * @return array|false false on failure file meta data on success + */ + public function update($path, $contents, Config $config); + + /** + * Update a file using a stream. + * + * @param string $path + * @param resource $resource + * @param Config $config Config object + * + * @return array|false false on failure file meta data on success + */ + public function updateStream($path, $resource, Config $config); + + /** + * Rename a file. + * + * @param string $path + * @param string $newpath + * + * @return bool + */ + public function rename($path, $newpath); + + /** + * Copy a file. + * + * @param string $path + * @param string $newpath + * + * @return bool + */ + public function copy($path, $newpath); + + /** + * Delete a file. + * + * @param string $path + * + * @return bool + */ + public function delete($path); + + /** + * Delete a directory. + * + * @param string $dirname + * + * @return bool + */ + public function deleteDir($dirname); + + /** + * Create a directory. + * + * @param string $dirname directory name + * @param Config $config + * + * @return array|false + */ + public function createDir($dirname, Config $config); + + /** + * Set the visibility for a file. + * + * @param string $path + * @param string $visibility + * + * @return array|false file meta data + */ + public function setVisibility($path, $visibility); +} diff --git a/vendor/league/flysystem/src/Config.php b/vendor/league/flysystem/src/Config.php new file mode 100644 index 00000000..639f43d1 --- /dev/null +++ b/vendor/league/flysystem/src/Config.php @@ -0,0 +1,107 @@ +<?php + +namespace League\Flysystem; + +class Config +{ + /** + * @var array + */ + protected $settings = []; + + /** + * @var Config|null + */ + protected $fallback; + + /** + * Constructor. + * + * @param array $settings + */ + public function __construct(array $settings = []) + { + $this->settings = $settings; + } + + /** + * Get a setting. + * + * @param string $key + * @param mixed $default + * + * @return mixed config setting or default when not found + */ + public function get($key, $default = null) + { + if ( ! array_key_exists($key, $this->settings)) { + return $this->getDefault($key, $default); + } + + return $this->settings[$key]; + } + + /** + * Check if an item exists by key. + * + * @param string $key + * + * @return bool + */ + public function has($key) + { + if (array_key_exists($key, $this->settings)) { + return true; + } + + return $this->fallback instanceof Config + ? $this->fallback->has($key) + : false; + } + + /** + * Try to retrieve a default setting from a config fallback. + * + * @param string $key + * @param mixed $default + * + * @return mixed config setting or default when not found + */ + protected function getDefault($key, $default) + { + if ( ! $this->fallback) { + return $default; + } + + return $this->fallback->get($key, $default); + } + + /** + * Set a setting. + * + * @param string $key + * @param mixed $value + * + * @return $this + */ + public function set($key, $value) + { + $this->settings[$key] = $value; + + return $this; + } + + /** + * Set the fallback. + * + * @param Config $fallback + * + * @return $this + */ + public function setFallback(Config $fallback) + { + $this->fallback = $fallback; + + return $this; + } +} diff --git a/vendor/league/flysystem/src/ConfigAwareTrait.php b/vendor/league/flysystem/src/ConfigAwareTrait.php new file mode 100644 index 00000000..202d605d --- /dev/null +++ b/vendor/league/flysystem/src/ConfigAwareTrait.php @@ -0,0 +1,49 @@ +<?php + +namespace League\Flysystem; + +/** + * @internal + */ +trait ConfigAwareTrait +{ + /** + * @var Config + */ + protected $config; + + /** + * Set the config. + * + * @param Config|array|null $config + */ + protected function setConfig($config) + { + $this->config = $config ? Util::ensureConfig($config) : new Config; + } + + /** + * Get the Config. + * + * @return Config config object + */ + public function getConfig() + { + return $this->config; + } + + /** + * Convert a config array to a Config object with the correct fallback. + * + * @param array $config + * + * @return Config + */ + protected function prepareConfig(array $config) + { + $config = new Config($config); + $config->setFallback($this->getConfig()); + + return $config; + } +} diff --git a/vendor/league/flysystem/src/ConnectionErrorException.php b/vendor/league/flysystem/src/ConnectionErrorException.php new file mode 100644 index 00000000..adb651d3 --- /dev/null +++ b/vendor/league/flysystem/src/ConnectionErrorException.php @@ -0,0 +1,9 @@ +<?php + +namespace League\Flysystem; + +use ErrorException; + +class ConnectionErrorException extends ErrorException implements FilesystemException +{ +} diff --git a/vendor/league/flysystem/src/ConnectionRuntimeException.php b/vendor/league/flysystem/src/ConnectionRuntimeException.php new file mode 100644 index 00000000..8b893ef1 --- /dev/null +++ b/vendor/league/flysystem/src/ConnectionRuntimeException.php @@ -0,0 +1,9 @@ +<?php + +namespace League\Flysystem; + +use RuntimeException; + +class ConnectionRuntimeException extends RuntimeException implements FilesystemException +{ +} diff --git a/vendor/league/flysystem/src/CorruptedPathDetected.php b/vendor/league/flysystem/src/CorruptedPathDetected.php new file mode 100644 index 00000000..81a27e5f --- /dev/null +++ b/vendor/league/flysystem/src/CorruptedPathDetected.php @@ -0,0 +1,17 @@ +<?php + +namespace League\Flysystem; + +use LogicException; + +class CorruptedPathDetected extends LogicException implements FilesystemException +{ + /** + * @param string $path + * @return CorruptedPathDetected + */ + public static function forPath($path) + { + return new CorruptedPathDetected("Corrupted path detected: " . $path); + } +} diff --git a/vendor/league/flysystem/src/Directory.php b/vendor/league/flysystem/src/Directory.php new file mode 100644 index 00000000..d4f90a88 --- /dev/null +++ b/vendor/league/flysystem/src/Directory.php @@ -0,0 +1,31 @@ +<?php + +namespace League\Flysystem; + +/** + * @deprecated + */ +class Directory extends Handler +{ + /** + * Delete the directory. + * + * @return bool + */ + public function delete() + { + return $this->filesystem->deleteDir($this->path); + } + + /** + * List the directory contents. + * + * @param bool $recursive + * + * @return array|bool directory contents or false + */ + public function getContents($recursive = false) + { + return $this->filesystem->listContents($this->path, $recursive); + } +} diff --git a/vendor/league/flysystem/src/Exception.php b/vendor/league/flysystem/src/Exception.php new file mode 100644 index 00000000..4596c0a9 --- /dev/null +++ b/vendor/league/flysystem/src/Exception.php @@ -0,0 +1,8 @@ +<?php + +namespace League\Flysystem; + +class Exception extends \Exception implements FilesystemException +{ + // +} diff --git a/vendor/league/flysystem/src/File.php b/vendor/league/flysystem/src/File.php new file mode 100644 index 00000000..4a4b7a02 --- /dev/null +++ b/vendor/league/flysystem/src/File.php @@ -0,0 +1,205 @@ +<?php + +namespace League\Flysystem; + +/** + * @deprecated + */ +class File extends Handler +{ + /** + * Check whether the file exists. + * + * @return bool + */ + public function exists() + { + return $this->filesystem->has($this->path); + } + + /** + * Read the file. + * + * @return string|false file contents + */ + public function read() + { + return $this->filesystem->read($this->path); + } + + /** + * Read the file as a stream. + * + * @return resource|false file stream + */ + public function readStream() + { + return $this->filesystem->readStream($this->path); + } + + /** + * Write the new file. + * + * @param string $content + * + * @return bool success boolean + */ + public function write($content) + { + return $this->filesystem->write($this->path, $content); + } + + /** + * Write the new file using a stream. + * + * @param resource $resource + * + * @return bool success boolean + */ + public function writeStream($resource) + { + return $this->filesystem->writeStream($this->path, $resource); + } + + /** + * Update the file contents. + * + * @param string $content + * + * @return bool success boolean + */ + public function update($content) + { + return $this->filesystem->update($this->path, $content); + } + + /** + * Update the file contents with a stream. + * + * @param resource $resource + * + * @return bool success boolean + */ + public function updateStream($resource) + { + return $this->filesystem->updateStream($this->path, $resource); + } + + /** + * Create the file or update if exists. + * + * @param string $content + * + * @return bool success boolean + */ + public function put($content) + { + return $this->filesystem->put($this->path, $content); + } + + /** + * Create the file or update if exists using a stream. + * + * @param resource $resource + * + * @return bool success boolean + */ + public function putStream($resource) + { + return $this->filesystem->putStream($this->path, $resource); + } + + /** + * Rename the file. + * + * @param string $newpath + * + * @return bool success boolean + */ + public function rename($newpath) + { + if ($this->filesystem->rename($this->path, $newpath)) { + $this->path = $newpath; + + return true; + } + + return false; + } + + /** + * Copy the file. + * + * @param string $newpath + * + * @return File|false new file or false + */ + public function copy($newpath) + { + if ($this->filesystem->copy($this->path, $newpath)) { + return new File($this->filesystem, $newpath); + } + + return false; + } + + /** + * Get the file's timestamp. + * + * @return string|false The timestamp or false on failure. + */ + public function getTimestamp() + { + return $this->filesystem->getTimestamp($this->path); + } + + /** + * Get the file's mimetype. + * + * @return string|false The file mime-type or false on failure. + */ + public function getMimetype() + { + return $this->filesystem->getMimetype($this->path); + } + + /** + * Get the file's visibility. + * + * @return string|false The visibility (public|private) or false on failure. + */ + public function getVisibility() + { + return $this->filesystem->getVisibility($this->path); + } + + /** + * Get the file's metadata. + * + * @return array|false The file metadata or false on failure. + */ + public function getMetadata() + { + return $this->filesystem->getMetadata($this->path); + } + + /** + * Get the file size. + * + * @return int|false The file size or false on failure. + */ + public function getSize() + { + return $this->filesystem->getSize($this->path); + } + + /** + * Delete the file. + * + * @return bool success boolean + */ + public function delete() + { + return $this->filesystem->delete($this->path); + } +} diff --git a/vendor/league/flysystem/src/FileExistsException.php b/vendor/league/flysystem/src/FileExistsException.php new file mode 100644 index 00000000..c82e20c1 --- /dev/null +++ b/vendor/league/flysystem/src/FileExistsException.php @@ -0,0 +1,37 @@ +<?php + +namespace League\Flysystem; + +use Exception as BaseException; + +class FileExistsException extends Exception +{ + /** + * @var string + */ + protected $path; + + /** + * Constructor. + * + * @param string $path + * @param int $code + * @param BaseException $previous + */ + public function __construct($path, $code = 0, BaseException $previous = null) + { + $this->path = $path; + + parent::__construct('File already exists at path: ' . $this->getPath(), $code, $previous); + } + + /** + * Get the path which was found. + * + * @return string + */ + public function getPath() + { + return $this->path; + } +} diff --git a/vendor/league/flysystem/src/FileNotFoundException.php b/vendor/league/flysystem/src/FileNotFoundException.php new file mode 100644 index 00000000..989df69b --- /dev/null +++ b/vendor/league/flysystem/src/FileNotFoundException.php @@ -0,0 +1,37 @@ +<?php + +namespace League\Flysystem; + +use Exception as BaseException; + +class FileNotFoundException extends Exception +{ + /** + * @var string + */ + protected $path; + + /** + * Constructor. + * + * @param string $path + * @param int $code + * @param \Exception $previous + */ + public function __construct($path, $code = 0, BaseException $previous = null) + { + $this->path = $path; + + parent::__construct('File not found at path: ' . $this->getPath(), $code, $previous); + } + + /** + * Get the path which was not found. + * + * @return string + */ + public function getPath() + { + return $this->path; + } +} diff --git a/vendor/league/flysystem/src/Filesystem.php b/vendor/league/flysystem/src/Filesystem.php new file mode 100644 index 00000000..c4eaf278 --- /dev/null +++ b/vendor/league/flysystem/src/Filesystem.php @@ -0,0 +1,409 @@ +<?php + +namespace League\Flysystem; + +use InvalidArgumentException; +use League\Flysystem\Adapter\CanOverwriteFiles; +use League\Flysystem\Plugin\PluggableTrait; +use League\Flysystem\Util\ContentListingFormatter; + +/** + * @method void emptyDir(string $dirname) + * @method array|false getWithMetadata(string $path, string[] $metadata) + * @method bool forceCopy(string $path, string $newpath) + * @method bool forceRename(string $path, string $newpath) + * @method array listFiles(string $path = '', boolean $recursive = false) + * @method string[] listPaths(string $path = '', boolean $recursive = false) + * @method array listWith(string[] $keys = [], $directory = '', $recursive = false) + */ +class Filesystem implements FilesystemInterface +{ + use PluggableTrait; + use ConfigAwareTrait; + + /** + * @var AdapterInterface + */ + protected $adapter; + + /** + * Constructor. + * + * @param AdapterInterface $adapter + * @param Config|array $config + */ + public function __construct(AdapterInterface $adapter, $config = null) + { + $this->adapter = $adapter; + $this->setConfig($config); + } + + /** + * Get the Adapter. + * + * @return AdapterInterface adapter + */ + public function getAdapter() + { + return $this->adapter; + } + + /** + * @inheritdoc + */ + public function has($path) + { + $path = Util::normalizePath($path); + + return strlen($path) === 0 ? false : (bool) $this->getAdapter()->has($path); + } + + /** + * @inheritdoc + */ + public function write($path, $contents, array $config = []) + { + $path = Util::normalizePath($path); + $this->assertAbsent($path); + $config = $this->prepareConfig($config); + + return (bool) $this->getAdapter()->write($path, $contents, $config); + } + + /** + * @inheritdoc + */ + public function writeStream($path, $resource, array $config = []) + { + if ( ! is_resource($resource) || get_resource_type($resource) !== 'stream') { + throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.'); + } + + $path = Util::normalizePath($path); + $this->assertAbsent($path); + $config = $this->prepareConfig($config); + + Util::rewindStream($resource); + + return (bool) $this->getAdapter()->writeStream($path, $resource, $config); + } + + /** + * @inheritdoc + */ + public function put($path, $contents, array $config = []) + { + $path = Util::normalizePath($path); + $config = $this->prepareConfig($config); + + if ( ! $this->getAdapter() instanceof CanOverwriteFiles && $this->has($path)) { + return (bool) $this->getAdapter()->update($path, $contents, $config); + } + + return (bool) $this->getAdapter()->write($path, $contents, $config); + } + + /** + * @inheritdoc + */ + public function putStream($path, $resource, array $config = []) + { + if ( ! is_resource($resource) || get_resource_type($resource) !== 'stream') { + throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.'); + } + + $path = Util::normalizePath($path); + $config = $this->prepareConfig($config); + Util::rewindStream($resource); + + if ( ! $this->getAdapter() instanceof CanOverwriteFiles && $this->has($path)) { + return (bool) $this->getAdapter()->updateStream($path, $resource, $config); + } + + return (bool) $this->getAdapter()->writeStream($path, $resource, $config); + } + + /** + * @inheritdoc + */ + public function readAndDelete($path) + { + $path = Util::normalizePath($path); + $this->assertPresent($path); + $contents = $this->read($path); + + if ($contents === false) { + return false; + } + + $this->delete($path); + + return $contents; + } + + /** + * @inheritdoc + */ + public function update($path, $contents, array $config = []) + { + $path = Util::normalizePath($path); + $config = $this->prepareConfig($config); + + $this->assertPresent($path); + + return (bool) $this->getAdapter()->update($path, $contents, $config); + } + + /** + * @inheritdoc + */ + public function updateStream($path, $resource, array $config = []) + { + if ( ! is_resource($resource) || get_resource_type($resource) !== 'stream') { + throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.'); + } + + $path = Util::normalizePath($path); + $config = $this->prepareConfig($config); + $this->assertPresent($path); + Util::rewindStream($resource); + + return (bool) $this->getAdapter()->updateStream($path, $resource, $config); + } + + /** + * @inheritdoc + */ + public function read($path) + { + $path = Util::normalizePath($path); + $this->assertPresent($path); + + if ( ! ($object = $this->getAdapter()->read($path))) { + return false; + } + + return $object['contents']; + } + + /** + * @inheritdoc + */ + public function readStream($path) + { + $path = Util::normalizePath($path); + $this->assertPresent($path); + + if ( ! $object = $this->getAdapter()->readStream($path)) { + return false; + } + + return $object['stream']; + } + + /** + * @inheritdoc + */ + public function rename($path, $newpath) + { + $path = Util::normalizePath($path); + $newpath = Util::normalizePath($newpath); + $this->assertPresent($path); + $this->assertAbsent($newpath); + + return (bool) $this->getAdapter()->rename($path, $newpath); + } + + /** + * @inheritdoc + */ + public function copy($path, $newpath) + { + $path = Util::normalizePath($path); + $newpath = Util::normalizePath($newpath); + $this->assertPresent($path); + $this->assertAbsent($newpath); + + return $this->getAdapter()->copy($path, $newpath); + } + + /** + * @inheritdoc + */ + public function delete($path) + { + $path = Util::normalizePath($path); + $this->assertPresent($path); + + return $this->getAdapter()->delete($path); + } + + /** + * @inheritdoc + */ + public function deleteDir($dirname) + { + $dirname = Util::normalizePath($dirname); + + if ($dirname === '') { + throw new RootViolationException('Root directories can not be deleted.'); + } + + return (bool) $this->getAdapter()->deleteDir($dirname); + } + + /** + * @inheritdoc + */ + public function createDir($dirname, array $config = []) + { + $dirname = Util::normalizePath($dirname); + $config = $this->prepareConfig($config); + + return (bool) $this->getAdapter()->createDir($dirname, $config); + } + + /** + * @inheritdoc + */ + public function listContents($directory = '', $recursive = false) + { + $directory = Util::normalizePath($directory); + $contents = $this->getAdapter()->listContents($directory, $recursive); + + return (new ContentListingFormatter($directory, $recursive, $this->config->get('case_sensitive', true))) + ->formatListing($contents); + } + + /** + * @inheritdoc + */ + public function getMimetype($path) + { + $path = Util::normalizePath($path); + $this->assertPresent($path); + + if (( ! $object = $this->getAdapter()->getMimetype($path)) || ! array_key_exists('mimetype', $object)) { + return false; + } + + return $object['mimetype']; + } + + /** + * @inheritdoc + */ + public function getTimestamp($path) + { + $path = Util::normalizePath($path); + $this->assertPresent($path); + + if (( ! $object = $this->getAdapter()->getTimestamp($path)) || ! array_key_exists('timestamp', $object)) { + return false; + } + + return (int) $object['timestamp']; + } + + /** + * @inheritdoc + */ + public function getVisibility($path) + { + $path = Util::normalizePath($path); + $this->assertPresent($path); + + if (( ! $object = $this->getAdapter()->getVisibility($path)) || ! array_key_exists('visibility', $object)) { + return false; + } + + return $object['visibility']; + } + + /** + * @inheritdoc + */ + public function getSize($path) + { + $path = Util::normalizePath($path); + $this->assertPresent($path); + + if (( ! $object = $this->getAdapter()->getSize($path)) || ! array_key_exists('size', $object)) { + return false; + } + + return (int) $object['size']; + } + + /** + * @inheritdoc + */ + public function setVisibility($path, $visibility) + { + $path = Util::normalizePath($path); + $this->assertPresent($path); + + return (bool) $this->getAdapter()->setVisibility($path, $visibility); + } + + /** + * @inheritdoc + */ + public function getMetadata($path) + { + $path = Util::normalizePath($path); + $this->assertPresent($path); + + return $this->getAdapter()->getMetadata($path); + } + + /** + * @inheritdoc + */ + public function get($path, Handler $handler = null) + { + $path = Util::normalizePath($path); + + if ( ! $handler) { + $metadata = $this->getMetadata($path); + $handler = ($metadata && $metadata['type'] === 'file') ? new File($this, $path) : new Directory($this, $path); + } + + $handler->setPath($path); + $handler->setFilesystem($this); + + return $handler; + } + + /** + * Assert a file is present. + * + * @param string $path path to file + * + * @throws FileNotFoundException + * + * @return void + */ + public function assertPresent($path) + { + if ($this->config->get('disable_asserts', false) === false && ! $this->has($path)) { + throw new FileNotFoundException($path); + } + } + + /** + * Assert a file is absent. + * + * @param string $path path to file + * + * @throws FileExistsException + * + * @return void + */ + public function assertAbsent($path) + { + if ($this->config->get('disable_asserts', false) === false && $this->has($path)) { + throw new FileExistsException($path); + } + } +} diff --git a/vendor/league/flysystem/src/FilesystemException.php b/vendor/league/flysystem/src/FilesystemException.php new file mode 100644 index 00000000..3121e533 --- /dev/null +++ b/vendor/league/flysystem/src/FilesystemException.php @@ -0,0 +1,7 @@ +<?php + +namespace League\Flysystem; + +interface FilesystemException +{ +} diff --git a/vendor/league/flysystem/src/FilesystemInterface.php b/vendor/league/flysystem/src/FilesystemInterface.php new file mode 100644 index 00000000..a6b99ba0 --- /dev/null +++ b/vendor/league/flysystem/src/FilesystemInterface.php @@ -0,0 +1,284 @@ +<?php + +namespace League\Flysystem; + +use InvalidArgumentException; + +interface FilesystemInterface +{ + /** + * Check whether a file exists. + * + * @param string $path + * + * @return bool + */ + public function has($path); + + /** + * Read a file. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return string|false The file contents or false on failure. + */ + public function read($path); + + /** + * Retrieves a read-stream for a path. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return resource|false The path resource or false on failure. + */ + public function readStream($path); + + /** + * List contents of a directory. + * + * @param string $directory The directory to list. + * @param bool $recursive Whether to list recursively. + * + * @return array A list of file metadata. + */ + public function listContents($directory = '', $recursive = false); + + /** + * Get a file's metadata. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return array|false The file metadata or false on failure. + */ + public function getMetadata($path); + + /** + * Get a file's size. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return int|false The file size or false on failure. + */ + public function getSize($path); + + /** + * Get a file's mime-type. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return string|false The file mime-type or false on failure. + */ + public function getMimetype($path); + + /** + * Get a file's timestamp. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return int|false The timestamp or false on failure. + */ + public function getTimestamp($path); + + /** + * Get a file's visibility. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return string|false The visibility (public|private) or false on failure. + */ + public function getVisibility($path); + + /** + * Write a new file. + * + * @param string $path The path of the new file. + * @param string $contents The file contents. + * @param array $config An optional configuration array. + * + * @throws FileExistsException + * + * @return bool True on success, false on failure. + */ + public function write($path, $contents, array $config = []); + + /** + * Write a new file using a stream. + * + * @param string $path The path of the new file. + * @param resource $resource The file handle. + * @param array $config An optional configuration array. + * + * @throws InvalidArgumentException If $resource is not a file handle. + * @throws FileExistsException + * + * @return bool True on success, false on failure. + */ + public function writeStream($path, $resource, array $config = []); + + /** + * Update an existing file. + * + * @param string $path The path of the existing file. + * @param string $contents The file contents. + * @param array $config An optional configuration array. + * + * @throws FileNotFoundException + * + * @return bool True on success, false on failure. + */ + public function update($path, $contents, array $config = []); + + /** + * Update an existing file using a stream. + * + * @param string $path The path of the existing file. + * @param resource $resource The file handle. + * @param array $config An optional configuration array. + * + * @throws InvalidArgumentException If $resource is not a file handle. + * @throws FileNotFoundException + * + * @return bool True on success, false on failure. + */ + public function updateStream($path, $resource, array $config = []); + + /** + * Rename a file. + * + * @param string $path Path to the existing file. + * @param string $newpath The new path of the file. + * + * @throws FileExistsException Thrown if $newpath exists. + * @throws FileNotFoundException Thrown if $path does not exist. + * + * @return bool True on success, false on failure. + */ + public function rename($path, $newpath); + + /** + * Copy a file. + * + * @param string $path Path to the existing file. + * @param string $newpath The new path of the file. + * + * @throws FileExistsException Thrown if $newpath exists. + * @throws FileNotFoundException Thrown if $path does not exist. + * + * @return bool True on success, false on failure. + */ + public function copy($path, $newpath); + + /** + * Delete a file. + * + * @param string $path + * + * @throws FileNotFoundException + * + * @return bool True on success, false on failure. + */ + public function delete($path); + + /** + * Delete a directory. + * + * @param string $dirname + * + * @throws RootViolationException Thrown if $dirname is empty. + * + * @return bool True on success, false on failure. + */ + public function deleteDir($dirname); + + /** + * Create a directory. + * + * @param string $dirname The name of the new directory. + * @param array $config An optional configuration array. + * + * @return bool True on success, false on failure. + */ + public function createDir($dirname, array $config = []); + + /** + * Set the visibility for a file. + * + * @param string $path The path to the file. + * @param string $visibility One of 'public' or 'private'. + * + * @throws FileNotFoundException + * + * @return bool True on success, false on failure. + */ + public function setVisibility($path, $visibility); + + /** + * Create a file or update if exists. + * + * @param string $path The path to the file. + * @param string $contents The file contents. + * @param array $config An optional configuration array. + * + * @return bool True on success, false on failure. + */ + public function put($path, $contents, array $config = []); + + /** + * Create a file or update if exists. + * + * @param string $path The path to the file. + * @param resource $resource The file handle. + * @param array $config An optional configuration array. + * + * @throws InvalidArgumentException Thrown if $resource is not a resource. + * + * @return bool True on success, false on failure. + */ + public function putStream($path, $resource, array $config = []); + + /** + * Read and delete a file. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return string|false The file contents, or false on failure. + */ + public function readAndDelete($path); + + /** + * Get a file/directory handler. + * + * @deprecated + * + * @param string $path The path to the file. + * @param Handler $handler An optional existing handler to populate. + * + * @return Handler Either a file or directory handler. + */ + public function get($path, Handler $handler = null); + + /** + * Register a plugin. + * + * @param PluginInterface $plugin The plugin to register. + * + * @return $this + */ + public function addPlugin(PluginInterface $plugin); +} diff --git a/vendor/league/flysystem/src/FilesystemNotFoundException.php b/vendor/league/flysystem/src/FilesystemNotFoundException.php new file mode 100644 index 00000000..f928fa1d --- /dev/null +++ b/vendor/league/flysystem/src/FilesystemNotFoundException.php @@ -0,0 +1,12 @@ +<?php + +namespace League\Flysystem; + +use LogicException; + +/** + * Thrown when the MountManager cannot find a filesystem. + */ +class FilesystemNotFoundException extends LogicException implements FilesystemException +{ +} diff --git a/vendor/league/flysystem/src/Handler.php b/vendor/league/flysystem/src/Handler.php new file mode 100644 index 00000000..098bb854 --- /dev/null +++ b/vendor/league/flysystem/src/Handler.php @@ -0,0 +1,137 @@ +<?php + +namespace League\Flysystem; + +use BadMethodCallException; + +/** + * @deprecated + */ +abstract class Handler +{ + /** + * @var string + */ + protected $path; + + /** + * @var FilesystemInterface + */ + protected $filesystem; + + /** + * Constructor. + * + * @param FilesystemInterface $filesystem + * @param string $path + */ + public function __construct(FilesystemInterface $filesystem = null, $path = null) + { + $this->path = $path; + $this->filesystem = $filesystem; + } + + /** + * Check whether the entree is a directory. + * + * @return bool + */ + public function isDir() + { + return $this->getType() === 'dir'; + } + + /** + * Check whether the entree is a file. + * + * @return bool + */ + public function isFile() + { + return $this->getType() === 'file'; + } + + /** + * Retrieve the entree type (file|dir). + * + * @return string file or dir + */ + public function getType() + { + $metadata = $this->filesystem->getMetadata($this->path); + + return $metadata ? $metadata['type'] : 'dir'; + } + + /** + * Set the Filesystem object. + * + * @param FilesystemInterface $filesystem + * + * @return $this + */ + public function setFilesystem(FilesystemInterface $filesystem) + { + $this->filesystem = $filesystem; + + return $this; + } + + /** + * Retrieve the Filesystem object. + * + * @return FilesystemInterface + */ + public function getFilesystem() + { + return $this->filesystem; + } + + /** + * Set the entree path. + * + * @param string $path + * + * @return $this + */ + public function setPath($path) + { + $this->path = $path; + + return $this; + } + + /** + * Retrieve the entree path. + * + * @return string path + */ + public function getPath() + { + return $this->path; + } + + /** + * Plugins pass-through. + * + * @param string $method + * @param array $arguments + * + * @return mixed + */ + public function __call($method, array $arguments) + { + array_unshift($arguments, $this->path); + $callback = [$this->filesystem, $method]; + + try { + return call_user_func_array($callback, $arguments); + } catch (BadMethodCallException $e) { + throw new BadMethodCallException( + 'Call to undefined method ' + . get_called_class() + . '::' . $method + ); + } + } +} diff --git a/vendor/league/flysystem/src/InvalidRootException.php b/vendor/league/flysystem/src/InvalidRootException.php new file mode 100644 index 00000000..468d1d58 --- /dev/null +++ b/vendor/league/flysystem/src/InvalidRootException.php @@ -0,0 +1,9 @@ +<?php + +namespace League\Flysystem; + +use RuntimeException; + +class InvalidRootException extends RuntimeException implements FilesystemException +{ +} diff --git a/vendor/league/flysystem/src/MountManager.php b/vendor/league/flysystem/src/MountManager.php new file mode 100644 index 00000000..620f540e --- /dev/null +++ b/vendor/league/flysystem/src/MountManager.php @@ -0,0 +1,648 @@ +<?php + +namespace League\Flysystem; + +use InvalidArgumentException; +use League\Flysystem\Plugin\PluggableTrait; +use League\Flysystem\Plugin\PluginNotFoundException; + +/** + * Class MountManager. + * + * Proxies methods to Filesystem (@see __call): + * + * @method AdapterInterface getAdapter($prefix) + * @method Config getConfig($prefix) + * @method array listFiles($directory = '', $recursive = false) + * @method array listPaths($directory = '', $recursive = false) + * @method array getWithMetadata($path, array $metadata) + * @method Filesystem flushCache() + * @method void assertPresent($path) + * @method void assertAbsent($path) + * @method Filesystem addPlugin(PluginInterface $plugin) + */ +class MountManager implements FilesystemInterface +{ + use PluggableTrait; + + /** + * @var FilesystemInterface[] + */ + protected $filesystems = []; + + /** + * Constructor. + * + * @param FilesystemInterface[] $filesystems [:prefix => Filesystem,] + * + * @throws InvalidArgumentException + */ + public function __construct(array $filesystems = []) + { + $this->mountFilesystems($filesystems); + } + + /** + * Mount filesystems. + * + * @param FilesystemInterface[] $filesystems [:prefix => Filesystem,] + * + * @throws InvalidArgumentException + * + * @return $this + */ + public function mountFilesystems(array $filesystems) + { + foreach ($filesystems as $prefix => $filesystem) { + $this->mountFilesystem($prefix, $filesystem); + } + + return $this; + } + + /** + * Mount filesystems. + * + * @param string $prefix + * @param FilesystemInterface $filesystem + * + * @throws InvalidArgumentException + * + * @return $this + */ + public function mountFilesystem($prefix, FilesystemInterface $filesystem) + { + if ( ! is_string($prefix)) { + throw new InvalidArgumentException(__METHOD__ . ' expects argument #1 to be a string.'); + } + + $this->filesystems[$prefix] = $filesystem; + + return $this; + } + + /** + * Get the filesystem with the corresponding prefix. + * + * @param string $prefix + * + * @throws FilesystemNotFoundException + * + * @return FilesystemInterface + */ + public function getFilesystem($prefix) + { + if ( ! isset($this->filesystems[$prefix])) { + throw new FilesystemNotFoundException('No filesystem mounted with prefix ' . $prefix); + } + + return $this->filesystems[$prefix]; + } + + /** + * Retrieve the prefix from an arguments array. + * + * @param array $arguments + * + * @throws InvalidArgumentException + * + * @return array [:prefix, :arguments] + */ + public function filterPrefix(array $arguments) + { + if (empty($arguments)) { + throw new InvalidArgumentException('At least one argument needed'); + } + + $path = array_shift($arguments); + + if ( ! is_string($path)) { + throw new InvalidArgumentException('First argument should be a string'); + } + + list($prefix, $path) = $this->getPrefixAndPath($path); + array_unshift($arguments, $path); + + return [$prefix, $arguments]; + } + + /** + * @param string $directory + * @param bool $recursive + * + * @throws InvalidArgumentException + * @throws FilesystemNotFoundException + * + * @return array + */ + public function listContents($directory = '', $recursive = false) + { + list($prefix, $directory) = $this->getPrefixAndPath($directory); + $filesystem = $this->getFilesystem($prefix); + $result = $filesystem->listContents($directory, $recursive); + + foreach ($result as &$file) { + $file['filesystem'] = $prefix; + } + + return $result; + } + + /** + * Call forwarder. + * + * @param string $method + * @param array $arguments + * + * @throws InvalidArgumentException + * @throws FilesystemNotFoundException + * + * @return mixed + */ + public function __call($method, $arguments) + { + list($prefix, $arguments) = $this->filterPrefix($arguments); + + return $this->invokePluginOnFilesystem($method, $arguments, $prefix); + } + + /** + * @param string $from + * @param string $to + * @param array $config + * + * @throws InvalidArgumentException + * @throws FilesystemNotFoundException + * @throws FileExistsException + * + * @return bool + */ + public function copy($from, $to, array $config = []) + { + list($prefixFrom, $from) = $this->getPrefixAndPath($from); + + $buffer = $this->getFilesystem($prefixFrom)->readStream($from); + + if ($buffer === false) { + return false; + } + + list($prefixTo, $to) = $this->getPrefixAndPath($to); + + $result = $this->getFilesystem($prefixTo)->writeStream($to, $buffer, $config); + + if (is_resource($buffer)) { + fclose($buffer); + } + + return $result; + } + + /** + * List with plugin adapter. + * + * @param array $keys + * @param string $directory + * @param bool $recursive + * + * @throws InvalidArgumentException + * @throws FilesystemNotFoundException + * + * @return array + */ + public function listWith(array $keys = [], $directory = '', $recursive = false) + { + list($prefix, $directory) = $this->getPrefixAndPath($directory); + $arguments = [$keys, $directory, $recursive]; + + return $this->invokePluginOnFilesystem('listWith', $arguments, $prefix); + } + + /** + * Move a file. + * + * @param string $from + * @param string $to + * @param array $config + * + * @throws InvalidArgumentException + * @throws FilesystemNotFoundException + * + * @return bool + */ + public function move($from, $to, array $config = []) + { + list($prefixFrom, $pathFrom) = $this->getPrefixAndPath($from); + list($prefixTo, $pathTo) = $this->getPrefixAndPath($to); + + if ($prefixFrom === $prefixTo) { + $filesystem = $this->getFilesystem($prefixFrom); + $renamed = $filesystem->rename($pathFrom, $pathTo); + + if ($renamed && isset($config['visibility'])) { + return $filesystem->setVisibility($pathTo, $config['visibility']); + } + + return $renamed; + } + + $copied = $this->copy($from, $to, $config); + + if ($copied) { + return $this->delete($from); + } + + return false; + } + + /** + * Invoke a plugin on a filesystem mounted on a given prefix. + * + * @param string $method + * @param array $arguments + * @param string $prefix + * + * @throws FilesystemNotFoundException + * + * @return mixed + */ + public function invokePluginOnFilesystem($method, $arguments, $prefix) + { + $filesystem = $this->getFilesystem($prefix); + + try { + return $this->invokePlugin($method, $arguments, $filesystem); + } catch (PluginNotFoundException $e) { + // Let it pass, it's ok, don't panic. + } + + $callback = [$filesystem, $method]; + + return call_user_func_array($callback, $arguments); + } + + /** + * @param string $path + * + * @throws InvalidArgumentException + * + * @return string[] [:prefix, :path] + */ + protected function getPrefixAndPath($path) + { + if (strpos($path, '://') < 1) { + throw new InvalidArgumentException('No prefix detected in path: ' . $path); + } + + return explode('://', $path, 2); + } + + /** + * Check whether a file exists. + * + * @param string $path + * + * @return bool + */ + public function has($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->has($path); + } + + /** + * Read a file. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return string|false The file contents or false on failure. + */ + public function read($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->read($path); + } + + /** + * Retrieves a read-stream for a path. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return resource|false The path resource or false on failure. + */ + public function readStream($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->readStream($path); + } + + /** + * Get a file's metadata. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return array|false The file metadata or false on failure. + */ + public function getMetadata($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->getMetadata($path); + } + + /** + * Get a file's size. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return int|false The file size or false on failure. + */ + public function getSize($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->getSize($path); + } + + /** + * Get a file's mime-type. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return string|false The file mime-type or false on failure. + */ + public function getMimetype($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->getMimetype($path); + } + + /** + * Get a file's timestamp. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return string|false The timestamp or false on failure. + */ + public function getTimestamp($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->getTimestamp($path); + } + + /** + * Get a file's visibility. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return string|false The visibility (public|private) or false on failure. + */ + public function getVisibility($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->getVisibility($path); + } + + /** + * Write a new file. + * + * @param string $path The path of the new file. + * @param string $contents The file contents. + * @param array $config An optional configuration array. + * + * @throws FileExistsException + * + * @return bool True on success, false on failure. + */ + public function write($path, $contents, array $config = []) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->write($path, $contents, $config); + } + + /** + * Write a new file using a stream. + * + * @param string $path The path of the new file. + * @param resource $resource The file handle. + * @param array $config An optional configuration array. + * + * @throws InvalidArgumentException If $resource is not a file handle. + * @throws FileExistsException + * + * @return bool True on success, false on failure. + */ + public function writeStream($path, $resource, array $config = []) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->writeStream($path, $resource, $config); + } + + /** + * Update an existing file. + * + * @param string $path The path of the existing file. + * @param string $contents The file contents. + * @param array $config An optional configuration array. + * + * @throws FileNotFoundException + * + * @return bool True on success, false on failure. + */ + public function update($path, $contents, array $config = []) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->update($path, $contents, $config); + } + + /** + * Update an existing file using a stream. + * + * @param string $path The path of the existing file. + * @param resource $resource The file handle. + * @param array $config An optional configuration array. + * + * @throws InvalidArgumentException If $resource is not a file handle. + * @throws FileNotFoundException + * + * @return bool True on success, false on failure. + */ + public function updateStream($path, $resource, array $config = []) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->updateStream($path, $resource, $config); + } + + /** + * Rename a file. + * + * @param string $path Path to the existing file. + * @param string $newpath The new path of the file. + * + * @throws FileExistsException Thrown if $newpath exists. + * @throws FileNotFoundException Thrown if $path does not exist. + * + * @return bool True on success, false on failure. + */ + public function rename($path, $newpath) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->rename($path, $newpath); + } + + /** + * Delete a file. + * + * @param string $path + * + * @throws FileNotFoundException + * + * @return bool True on success, false on failure. + */ + public function delete($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->delete($path); + } + + /** + * Delete a directory. + * + * @param string $dirname + * + * @throws RootViolationException Thrown if $dirname is empty. + * + * @return bool True on success, false on failure. + */ + public function deleteDir($dirname) + { + list($prefix, $dirname) = $this->getPrefixAndPath($dirname); + + return $this->getFilesystem($prefix)->deleteDir($dirname); + } + + /** + * Create a directory. + * + * @param string $dirname The name of the new directory. + * @param array $config An optional configuration array. + * + * @return bool True on success, false on failure. + */ + public function createDir($dirname, array $config = []) + { + list($prefix, $dirname) = $this->getPrefixAndPath($dirname); + + return $this->getFilesystem($prefix)->createDir($dirname); + } + + /** + * Set the visibility for a file. + * + * @param string $path The path to the file. + * @param string $visibility One of 'public' or 'private'. + * + * @throws FileNotFoundException + * + * @return bool True on success, false on failure. + */ + public function setVisibility($path, $visibility) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->setVisibility($path, $visibility); + } + + /** + * Create a file or update if exists. + * + * @param string $path The path to the file. + * @param string $contents The file contents. + * @param array $config An optional configuration array. + * + * @return bool True on success, false on failure. + */ + public function put($path, $contents, array $config = []) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->put($path, $contents, $config); + } + + /** + * Create a file or update if exists. + * + * @param string $path The path to the file. + * @param resource $resource The file handle. + * @param array $config An optional configuration array. + * + * @throws InvalidArgumentException Thrown if $resource is not a resource. + * + * @return bool True on success, false on failure. + */ + public function putStream($path, $resource, array $config = []) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->putStream($path, $resource, $config); + } + + /** + * Read and delete a file. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return string|false The file contents, or false on failure. + */ + public function readAndDelete($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->readAndDelete($path); + } + + /** + * Get a file/directory handler. + * + * @deprecated + * + * @param string $path The path to the file. + * @param Handler $handler An optional existing handler to populate. + * + * @return Handler Either a file or directory handler. + */ + public function get($path, Handler $handler = null) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->get($path); + } +} diff --git a/vendor/league/flysystem/src/NotSupportedException.php b/vendor/league/flysystem/src/NotSupportedException.php new file mode 100644 index 00000000..e0a989b2 --- /dev/null +++ b/vendor/league/flysystem/src/NotSupportedException.php @@ -0,0 +1,37 @@ +<?php + +namespace League\Flysystem; + +use RuntimeException; +use SplFileInfo; + +class NotSupportedException extends RuntimeException implements FilesystemException +{ + /** + * Create a new exception for a link. + * + * @param SplFileInfo $file + * + * @return static + */ + public static function forLink(SplFileInfo $file) + { + $message = 'Links are not supported, encountered link at '; + + return new static($message . $file->getPathname()); + } + + /** + * Create a new exception for a link. + * + * @param string $systemType + * + * @return static + */ + public static function forFtpSystemType($systemType) + { + $message = "The FTP system type '$systemType' is currently not supported."; + + return new static($message); + } +} diff --git a/vendor/league/flysystem/src/Plugin/AbstractPlugin.php b/vendor/league/flysystem/src/Plugin/AbstractPlugin.php new file mode 100644 index 00000000..0d567897 --- /dev/null +++ b/vendor/league/flysystem/src/Plugin/AbstractPlugin.php @@ -0,0 +1,24 @@ +<?php + +namespace League\Flysystem\Plugin; + +use League\Flysystem\FilesystemInterface; +use League\Flysystem\PluginInterface; + +abstract class AbstractPlugin implements PluginInterface +{ + /** + * @var FilesystemInterface + */ + protected $filesystem; + + /** + * Set the Filesystem object. + * + * @param FilesystemInterface $filesystem + */ + public function setFilesystem(FilesystemInterface $filesystem) + { + $this->filesystem = $filesystem; + } +} diff --git a/vendor/league/flysystem/src/Plugin/EmptyDir.php b/vendor/league/flysystem/src/Plugin/EmptyDir.php new file mode 100644 index 00000000..b5ae7f58 --- /dev/null +++ b/vendor/league/flysystem/src/Plugin/EmptyDir.php @@ -0,0 +1,34 @@ +<?php + +namespace League\Flysystem\Plugin; + +class EmptyDir extends AbstractPlugin +{ + /** + * Get the method name. + * + * @return string + */ + public function getMethod() + { + return 'emptyDir'; + } + + /** + * Empty a directory's contents. + * + * @param string $dirname + */ + public function handle($dirname) + { + $listing = $this->filesystem->listContents($dirname, false); + + foreach ($listing as $item) { + if ($item['type'] === 'dir') { + $this->filesystem->deleteDir($item['path']); + } else { + $this->filesystem->delete($item['path']); + } + } + } +} diff --git a/vendor/league/flysystem/src/Plugin/ForcedCopy.php b/vendor/league/flysystem/src/Plugin/ForcedCopy.php new file mode 100644 index 00000000..a41e9f3a --- /dev/null +++ b/vendor/league/flysystem/src/Plugin/ForcedCopy.php @@ -0,0 +1,44 @@ +<?php + +namespace League\Flysystem\Plugin; + +use League\Flysystem\FileExistsException; +use League\Flysystem\FileNotFoundException; + +class ForcedCopy extends AbstractPlugin +{ + /** + * @inheritdoc + */ + public function getMethod() + { + return 'forceCopy'; + } + + /** + * Copies a file, overwriting any existing files. + * + * @param string $path Path to the existing file. + * @param string $newpath The new path of the file. + * + * @throws FileExistsException + * @throws FileNotFoundException Thrown if $path does not exist. + * + * @return bool True on success, false on failure. + */ + public function handle($path, $newpath) + { + try { + $deleted = $this->filesystem->delete($newpath); + } catch (FileNotFoundException $e) { + // The destination path does not exist. That's ok. + $deleted = true; + } + + if ($deleted) { + return $this->filesystem->copy($path, $newpath); + } + + return false; + } +} diff --git a/vendor/league/flysystem/src/Plugin/ForcedRename.php b/vendor/league/flysystem/src/Plugin/ForcedRename.php new file mode 100644 index 00000000..3f51cd60 --- /dev/null +++ b/vendor/league/flysystem/src/Plugin/ForcedRename.php @@ -0,0 +1,44 @@ +<?php + +namespace League\Flysystem\Plugin; + +use League\Flysystem\FileExistsException; +use League\Flysystem\FileNotFoundException; + +class ForcedRename extends AbstractPlugin +{ + /** + * @inheritdoc + */ + public function getMethod() + { + return 'forceRename'; + } + + /** + * Renames a file, overwriting the destination if it exists. + * + * @param string $path Path to the existing file. + * @param string $newpath The new path of the file. + * + * @throws FileNotFoundException Thrown if $path does not exist. + * @throws FileExistsException + * + * @return bool True on success, false on failure. + */ + public function handle($path, $newpath) + { + try { + $deleted = $this->filesystem->delete($newpath); + } catch (FileNotFoundException $e) { + // The destination path does not exist. That's ok. + $deleted = true; + } + + if ($deleted) { + return $this->filesystem->rename($path, $newpath); + } + + return false; + } +} diff --git a/vendor/league/flysystem/src/Plugin/GetWithMetadata.php b/vendor/league/flysystem/src/Plugin/GetWithMetadata.php new file mode 100644 index 00000000..2f13d2fd --- /dev/null +++ b/vendor/league/flysystem/src/Plugin/GetWithMetadata.php @@ -0,0 +1,51 @@ +<?php + +namespace League\Flysystem\Plugin; + +use InvalidArgumentException; +use League\Flysystem\FileNotFoundException; + +class GetWithMetadata extends AbstractPlugin +{ + /** + * Get the method name. + * + * @return string + */ + public function getMethod() + { + return 'getWithMetadata'; + } + + /** + * Get metadata for an object with required metadata. + * + * @param string $path path to file + * @param string[] $metadata metadata keys + * + * @throws InvalidArgumentException + * @throws FileNotFoundException + * + * @return array|false metadata + */ + public function handle($path, array $metadata) + { + $object = $this->filesystem->getMetadata($path); + + if ( ! $object) { + return false; + } + + $keys = array_diff($metadata, array_keys($object)); + + foreach ($keys as $key) { + if ( ! method_exists($this->filesystem, $method = 'get' . ucfirst($key))) { + throw new InvalidArgumentException('Could not fetch metadata: ' . $key); + } + + $object[$key] = $this->filesystem->{$method}($path); + } + + return $object; + } +} diff --git a/vendor/league/flysystem/src/Plugin/ListFiles.php b/vendor/league/flysystem/src/Plugin/ListFiles.php new file mode 100644 index 00000000..9669fe7e --- /dev/null +++ b/vendor/league/flysystem/src/Plugin/ListFiles.php @@ -0,0 +1,35 @@ +<?php + +namespace League\Flysystem\Plugin; + +class ListFiles extends AbstractPlugin +{ + /** + * Get the method name. + * + * @return string + */ + public function getMethod() + { + return 'listFiles'; + } + + /** + * List all files in the directory. + * + * @param string $directory + * @param bool $recursive + * + * @return array + */ + public function handle($directory = '', $recursive = false) + { + $contents = $this->filesystem->listContents($directory, $recursive); + + $filter = function ($object) { + return $object['type'] === 'file'; + }; + + return array_values(array_filter($contents, $filter)); + } +} diff --git a/vendor/league/flysystem/src/Plugin/ListPaths.php b/vendor/league/flysystem/src/Plugin/ListPaths.php new file mode 100644 index 00000000..0889d1f8 --- /dev/null +++ b/vendor/league/flysystem/src/Plugin/ListPaths.php @@ -0,0 +1,36 @@ +<?php + +namespace League\Flysystem\Plugin; + +class ListPaths extends AbstractPlugin +{ + /** + * Get the method name. + * + * @return string + */ + public function getMethod() + { + return 'listPaths'; + } + + /** + * List all paths. + * + * @param string $directory + * @param bool $recursive + * + * @return string[] paths + */ + public function handle($directory = '', $recursive = false) + { + $result = []; + $contents = $this->filesystem->listContents($directory, $recursive); + + foreach ($contents as $object) { + $result[] = $object['path']; + } + + return $result; + } +} diff --git a/vendor/league/flysystem/src/Plugin/ListWith.php b/vendor/league/flysystem/src/Plugin/ListWith.php new file mode 100644 index 00000000..d64debec --- /dev/null +++ b/vendor/league/flysystem/src/Plugin/ListWith.php @@ -0,0 +1,60 @@ +<?php + +namespace League\Flysystem\Plugin; + +class ListWith extends AbstractPlugin +{ + /** + * Get the method name. + * + * @return string + */ + public function getMethod() + { + return 'listWith'; + } + + /** + * List contents with metadata. + * + * @param string[] $keys + * @param string $directory + * @param bool $recursive + * + * @return array listing with metadata + */ + public function handle(array $keys = [], $directory = '', $recursive = false) + { + $contents = $this->filesystem->listContents($directory, $recursive); + + foreach ($contents as $index => $object) { + if ($object['type'] === 'file') { + $missingKeys = array_diff($keys, array_keys($object)); + $contents[$index] = array_reduce($missingKeys, [$this, 'getMetadataByName'], $object); + } + } + + return $contents; + } + + /** + * Get a meta-data value by key name. + * + * @param array $object + * @param string $key + * + * @return array + */ + protected function getMetadataByName(array $object, $key) + { + $method = 'get' . ucfirst($key); + + if ( ! method_exists($this->filesystem, $method)) { + throw new \InvalidArgumentException('Could not get meta-data for key: ' . $key); + } + + $object[$key] = $this->filesystem->{$method}($object['path']); + + return $object; + } +} diff --git a/vendor/league/flysystem/src/Plugin/PluggableTrait.php b/vendor/league/flysystem/src/Plugin/PluggableTrait.php new file mode 100644 index 00000000..922edfe5 --- /dev/null +++ b/vendor/league/flysystem/src/Plugin/PluggableTrait.php @@ -0,0 +1,97 @@ +<?php + +namespace League\Flysystem\Plugin; + +use BadMethodCallException; +use League\Flysystem\FilesystemInterface; +use League\Flysystem\PluginInterface; +use LogicException; + +trait PluggableTrait +{ + /** + * @var array + */ + protected $plugins = []; + + /** + * Register a plugin. + * + * @param PluginInterface $plugin + * + * @throws LogicException + * + * @return $this + */ + public function addPlugin(PluginInterface $plugin) + { + if ( ! method_exists($plugin, 'handle')) { + throw new LogicException(get_class($plugin) . ' does not have a handle method.'); + } + + $this->plugins[$plugin->getMethod()] = $plugin; + + return $this; + } + + /** + * Find a specific plugin. + * + * @param string $method + * + * @throws PluginNotFoundException + * + * @return PluginInterface + */ + protected function findPlugin($method) + { + if ( ! isset($this->plugins[$method])) { + throw new PluginNotFoundException('Plugin not found for method: ' . $method); + } + + return $this->plugins[$method]; + } + + /** + * Invoke a plugin by method name. + * + * @param string $method + * @param array $arguments + * @param FilesystemInterface $filesystem + * + * @throws PluginNotFoundException + * + * @return mixed + */ + protected function invokePlugin($method, array $arguments, FilesystemInterface $filesystem) + { + $plugin = $this->findPlugin($method); + $plugin->setFilesystem($filesystem); + $callback = [$plugin, 'handle']; + + return call_user_func_array($callback, $arguments); + } + + /** + * Plugins pass-through. + * + * @param string $method + * @param array $arguments + * + * @throws BadMethodCallException + * + * @return mixed + */ + public function __call($method, array $arguments) + { + try { + return $this->invokePlugin($method, $arguments, $this); + } catch (PluginNotFoundException $e) { + throw new BadMethodCallException( + 'Call to undefined method ' + . get_class($this) + . '::' . $method + ); + } + } +} diff --git a/vendor/league/flysystem/src/Plugin/PluginNotFoundException.php b/vendor/league/flysystem/src/Plugin/PluginNotFoundException.php new file mode 100644 index 00000000..fd1d7e7e --- /dev/null +++ b/vendor/league/flysystem/src/Plugin/PluginNotFoundException.php @@ -0,0 +1,10 @@ +<?php + +namespace League\Flysystem\Plugin; + +use LogicException; + +class PluginNotFoundException extends LogicException +{ + // This exception doesn't require additional information. +} diff --git a/vendor/league/flysystem/src/PluginInterface.php b/vendor/league/flysystem/src/PluginInterface.php new file mode 100644 index 00000000..7010a356 --- /dev/null +++ b/vendor/league/flysystem/src/PluginInterface.php @@ -0,0 +1,20 @@ +<?php + +namespace League\Flysystem; + +interface PluginInterface +{ + /** + * Get the method name. + * + * @return string + */ + public function getMethod(); + + /** + * Set the Filesystem object. + * + * @param FilesystemInterface $filesystem + */ + public function setFilesystem(FilesystemInterface $filesystem); +} diff --git a/vendor/league/flysystem/src/ReadInterface.php b/vendor/league/flysystem/src/ReadInterface.php new file mode 100644 index 00000000..898a8d5c --- /dev/null +++ b/vendor/league/flysystem/src/ReadInterface.php @@ -0,0 +1,88 @@ +<?php + +namespace League\Flysystem; + +interface ReadInterface +{ + /** + * Check whether a file exists. + * + * @param string $path + * + * @return array|bool|null + */ + public function has($path); + + /** + * Read a file. + * + * @param string $path + * + * @return array|false + */ + public function read($path); + + /** + * Read a file as a stream. + * + * @param string $path + * + * @return array|false + */ + public function readStream($path); + + /** + * List contents of a directory. + * + * @param string $directory + * @param bool $recursive + * + * @return array + */ + public function listContents($directory = '', $recursive = false); + + /** + * Get all the meta data of a file or directory. + * + * @param string $path + * + * @return array|false + */ + public function getMetadata($path); + + /** + * Get the size of a file. + * + * @param string $path + * + * @return array|false + */ + public function getSize($path); + + /** + * Get the mimetype of a file. + * + * @param string $path + * + * @return array|false + */ + public function getMimetype($path); + + /** + * Get the last modified time of a file as a timestamp. + * + * @param string $path + * + * @return array|false + */ + public function getTimestamp($path); + + /** + * Get the visibility of a file. + * + * @param string $path + * + * @return array|false + */ + public function getVisibility($path); +} diff --git a/vendor/league/flysystem/src/RootViolationException.php b/vendor/league/flysystem/src/RootViolationException.php new file mode 100644 index 00000000..073fc92b --- /dev/null +++ b/vendor/league/flysystem/src/RootViolationException.php @@ -0,0 +1,10 @@ +<?php + +namespace League\Flysystem; + +use LogicException; + +class RootViolationException extends LogicException implements FilesystemException +{ + // +} diff --git a/vendor/league/flysystem/src/SafeStorage.php b/vendor/league/flysystem/src/SafeStorage.php new file mode 100644 index 00000000..5397f580 --- /dev/null +++ b/vendor/league/flysystem/src/SafeStorage.php @@ -0,0 +1,39 @@ +<?php + +namespace League\Flysystem; + +final class SafeStorage +{ + /** + * @var string + */ + private $hash; + + /** + * @var array + */ + protected static $safeStorage = []; + + public function __construct() + { + $this->hash = spl_object_hash($this); + static::$safeStorage[$this->hash] = []; + } + + public function storeSafely($key, $value) + { + static::$safeStorage[$this->hash][$key] = $value; + } + + public function retrieveSafely($key) + { + if (array_key_exists($key, static::$safeStorage[$this->hash])) { + return static::$safeStorage[$this->hash][$key]; + } + } + + public function __destruct() + { + unset(static::$safeStorage[$this->hash]); + } +} diff --git a/vendor/league/flysystem/src/UnreadableFileException.php b/vendor/league/flysystem/src/UnreadableFileException.php new file mode 100644 index 00000000..e6680338 --- /dev/null +++ b/vendor/league/flysystem/src/UnreadableFileException.php @@ -0,0 +1,18 @@ +<?php + +namespace League\Flysystem; + +use SplFileInfo; + +class UnreadableFileException extends Exception +{ + public static function forFileInfo(SplFileInfo $fileInfo) + { + return new static( + sprintf( + 'Unreadable file encountered: %s', + $fileInfo->getRealPath() + ) + ); + } +} diff --git a/vendor/league/flysystem/src/Util.php b/vendor/league/flysystem/src/Util.php new file mode 100644 index 00000000..1a2db718 --- /dev/null +++ b/vendor/league/flysystem/src/Util.php @@ -0,0 +1,354 @@ +<?php + +namespace League\Flysystem; + +use League\Flysystem\Util\MimeType; +use LogicException; + +use function strcmp; + +class Util +{ + /** + * Get normalized pathinfo. + * + * @param string $path + * + * @return array pathinfo + */ + public static function pathinfo($path) + { + $pathinfo = compact('path'); + + if ('' !== $dirname = dirname($path)) { + $pathinfo['dirname'] = static::normalizeDirname($dirname); + } + + $pathinfo['basename'] = static::basename($path); + + $pathinfo += pathinfo($pathinfo['basename']); + + return $pathinfo + ['dirname' => '']; + } + + /** + * Normalize a dirname return value. + * + * @param string $dirname + * + * @return string normalized dirname + */ + public static function normalizeDirname($dirname) + { + return $dirname === '.' ? '' : $dirname; + } + + /** + * Get a normalized dirname from a path. + * + * @param string $path + * + * @return string dirname + */ + public static function dirname($path) + { + return static::normalizeDirname(dirname($path)); + } + + /** + * Map result arrays. + * + * @param array $object + * @param array $map + * + * @return array mapped result + */ + public static function map(array $object, array $map) + { + $result = []; + + foreach ($map as $from => $to) { + if ( ! isset($object[$from])) { + continue; + } + + $result[$to] = $object[$from]; + } + + return $result; + } + + /** + * Normalize path. + * + * @param string $path + * + * @throws LogicException + * + * @return string + */ + public static function normalizePath($path) + { + return static::normalizeRelativePath($path); + } + + /** + * Normalize relative directories in a path. + * + * @param string $path + * + * @throws LogicException + * + * @return string + */ + public static function normalizeRelativePath($path) + { + $path = str_replace('\\', '/', $path); + $path = static::removeFunkyWhiteSpace($path); + $parts = []; + + foreach (explode('/', $path) as $part) { + switch ($part) { + case '': + case '.': + break; + + case '..': + if (empty($parts)) { + throw new LogicException( + 'Path is outside of the defined root, path: [' . $path . ']' + ); + } + array_pop($parts); + break; + + default: + $parts[] = $part; + break; + } + } + + $path = implode('/', $parts); + + return $path; + } + + /** + * Rejects unprintable characters and invalid unicode characters. + * + * @param string $path + * + * @return string $path + */ + protected static function removeFunkyWhiteSpace($path) + { + if (preg_match('#\p{C}+#u', $path)) { + throw CorruptedPathDetected::forPath($path); + } + + return $path; + } + + /** + * Normalize prefix. + * + * @param string $prefix + * @param string $separator + * + * @return string normalized path + */ + public static function normalizePrefix($prefix, $separator) + { + return rtrim($prefix, $separator) . $separator; + } + + /** + * Get content size. + * + * @param string $contents + * + * @return int content size + */ + public static function contentSize($contents) + { + return defined('MB_OVERLOAD_STRING') ? mb_strlen($contents, '8bit') : strlen($contents); + } + + /** + * Guess MIME Type based on the path of the file and it's content. + * + * @param string $path + * @param string|resource $content + * + * @return string|null MIME Type or NULL if no extension detected + */ + public static function guessMimeType($path, $content) + { + $mimeType = MimeType::detectByContent($content); + + if ( ! (empty($mimeType) || in_array($mimeType, ['application/x-empty', 'text/plain', 'text/x-asm']))) { + return $mimeType; + } + + return MimeType::detectByFilename($path); + } + + /** + * Emulate directories. + * + * @param array $listing + * + * @return array listing with emulated directories + */ + public static function emulateDirectories(array $listing) + { + $directories = []; + $listedDirectories = []; + + foreach ($listing as $object) { + [$directories, $listedDirectories] = static::emulateObjectDirectories($object, $directories, $listedDirectories); + } + + $directories = array_diff(array_unique($directories), array_unique($listedDirectories)); + + foreach ($directories as $directory) { + $listing[] = static::pathinfo($directory) + ['type' => 'dir']; + } + + return $listing; + } + + /** + * Ensure a Config instance. + * + * @param null|array|Config $config + * + * @return Config config instance + * + * @throw LogicException + */ + public static function ensureConfig($config) + { + if ($config === null) { + return new Config(); + } + + if ($config instanceof Config) { + return $config; + } + + if (is_array($config)) { + return new Config($config); + } + + throw new LogicException('A config should either be an array or a Flysystem\Config object.'); + } + + /** + * Rewind a stream. + * + * @param resource $resource + */ + public static function rewindStream($resource) + { + if (ftell($resource) !== 0 && static::isSeekableStream($resource)) { + rewind($resource); + } + } + + public static function isSeekableStream($resource) + { + $metadata = stream_get_meta_data($resource); + + return $metadata['seekable']; + } + + /** + * Get the size of a stream. + * + * @param resource $resource + * + * @return int|null stream size + */ + public static function getStreamSize($resource) + { + $stat = fstat($resource); + + if ( ! is_array($stat) || ! isset($stat['size'])) { + return null; + } + + return $stat['size']; + } + + /** + * Emulate the directories of a single object. + * + * @param array $object + * @param array $directories + * @param array $listedDirectories + * + * @return array + */ + protected static function emulateObjectDirectories(array $object, array $directories, array $listedDirectories) + { + if ($object['type'] === 'dir') { + $listedDirectories[] = $object['path']; + } + + if ( ! isset($object['dirname']) || trim($object['dirname']) === '') { + return [$directories, $listedDirectories]; + } + + $parent = $object['dirname']; + + while (isset($parent) && trim($parent) !== '' && ! in_array($parent, $directories)) { + $directories[] = $parent; + $parent = static::dirname($parent); + } + + if (isset($object['type']) && $object['type'] === 'dir') { + $listedDirectories[] = $object['path']; + + return [$directories, $listedDirectories]; + } + + return [$directories, $listedDirectories]; + } + + /** + * Returns the trailing name component of the path. + * + * @param string $path + * + * @return string + */ + private static function basename($path) + { + $separators = DIRECTORY_SEPARATOR === '/' ? '/' : '\/'; + + $path = rtrim($path, $separators); + + $basename = preg_replace('#.*?([^' . preg_quote($separators, '#') . ']+$)#', '$1', $path); + + if (DIRECTORY_SEPARATOR === '/') { + return $basename; + } + // @codeCoverageIgnoreStart + // Extra Windows path munging. This is tested via AppVeyor, but code + // coverage is not reported. + + // Handle relative paths with drive letters. c:file.txt. + while (preg_match('#^[a-zA-Z]{1}:[^\\\/]#', $basename)) { + $basename = substr($basename, 2); + } + + // Remove colon for standalone drive letter names. + if (preg_match('#^[a-zA-Z]{1}:$#', $basename)) { + $basename = rtrim($basename, ':'); + } + + return $basename; + // @codeCoverageIgnoreEnd + } +} diff --git a/vendor/league/flysystem/src/Util/ContentListingFormatter.php b/vendor/league/flysystem/src/Util/ContentListingFormatter.php new file mode 100644 index 00000000..ae0d3b91 --- /dev/null +++ b/vendor/league/flysystem/src/Util/ContentListingFormatter.php @@ -0,0 +1,122 @@ +<?php + +namespace League\Flysystem\Util; + +use League\Flysystem\Util; + +/** + * @internal + */ +class ContentListingFormatter +{ + /** + * @var string + */ + private $directory; + + /** + * @var bool + */ + private $recursive; + + /** + * @var bool + */ + private $caseSensitive; + + /** + * @param string $directory + * @param bool $recursive + */ + public function __construct($directory, $recursive, $caseSensitive = true) + { + $this->directory = rtrim($directory, '/'); + $this->recursive = $recursive; + $this->caseSensitive = $caseSensitive; + } + + /** + * Format contents listing. + * + * @param array $listing + * + * @return array + */ + public function formatListing(array $listing) + { + $listing = array_filter(array_map([$this, 'addPathInfo'], $listing), [$this, 'isEntryOutOfScope']); + + return $this->sortListing(array_values($listing)); + } + + private function addPathInfo(array $entry) + { + return $entry + Util::pathinfo($entry['path']); + } + + /** + * Determine if the entry is out of scope. + * + * @param array $entry + * + * @return bool + */ + private function isEntryOutOfScope(array $entry) + { + if (empty($entry['path']) && $entry['path'] !== '0') { + return false; + } + + if ($this->recursive) { + return $this->residesInDirectory($entry); + } + + return $this->isDirectChild($entry); + } + + /** + * Check if the entry resides within the parent directory. + * + * @param array $entry + * + * @return bool + */ + private function residesInDirectory(array $entry) + { + if ($this->directory === '') { + return true; + } + + return $this->caseSensitive + ? strpos($entry['path'], $this->directory . '/') === 0 + : stripos($entry['path'], $this->directory . '/') === 0; + } + + /** + * Check if the entry is a direct child of the directory. + * + * @param array $entry + * + * @return bool + */ + private function isDirectChild(array $entry) + { + return $this->caseSensitive + ? $entry['dirname'] === $this->directory + : strcasecmp($this->directory, $entry['dirname']) === 0; + } + + /** + * @param array $listing + * + * @return array + */ + private function sortListing(array $listing) + { + usort($listing, function ($a, $b) { + return strcasecmp($a['path'], $b['path']); + }); + + return $listing; + } +} diff --git a/vendor/league/flysystem/src/Util/MimeType.php b/vendor/league/flysystem/src/Util/MimeType.php new file mode 100644 index 00000000..35cba3fb --- /dev/null +++ b/vendor/league/flysystem/src/Util/MimeType.php @@ -0,0 +1,80 @@ +<?php + +namespace League\Flysystem\Util; + +use League\MimeTypeDetection\FinfoMimeTypeDetector; +use League\MimeTypeDetection\GeneratedExtensionToMimeTypeMap; +use League\MimeTypeDetection\MimeTypeDetector; + +/** + * @internal + */ +class MimeType +{ + protected static $extensionToMimeTypeMap = GeneratedExtensionToMimeTypeMap::MIME_TYPES_FOR_EXTENSIONS; + protected static $detector; + + public static function useDetector(MimeTypeDetector $detector) + { + static::$detector = $detector; + } + + /** + * @return MimeTypeDetector + */ + protected static function detector() + { + if ( ! static::$detector instanceof MimeTypeDetector) { + static::$detector = new FinfoMimeTypeDetector(); + } + + return static::$detector; + } + + + /** + * Detects MIME Type based on given content. + * + * @param mixed $content + * + * @return string MIME Type + */ + public static function detectByContent($content) + { + if (is_string($content)) { + return static::detector()->detectMimeTypeFromBuffer($content); + } + + return 'text/plain'; + } + + /** + * Detects MIME Type based on file extension. + * + * @param string $extension + * + * @return string MIME Type + */ + public static function detectByFileExtension($extension) + { + return static::detector()->detectMimeTypeFromPath('artificial.' . $extension) ?: 'text/plain'; + } + + /** + * @param string $filename + * + * @return string MIME Type + */ + public static function detectByFilename($filename) + { + return static::detector()->detectMimeTypeFromPath($filename) ?: 'text/plain'; + } + + /** + * @return array Map of file extension to MIME Type + */ + public static function getExtensionToMimeTypeMap() + { + return static::$extensionToMimeTypeMap; + } +} diff --git a/vendor/league/flysystem/src/Util/StreamHasher.php b/vendor/league/flysystem/src/Util/StreamHasher.php new file mode 100644 index 00000000..938ec5db --- /dev/null +++ b/vendor/league/flysystem/src/Util/StreamHasher.php @@ -0,0 +1,36 @@ +<?php + +namespace League\Flysystem\Util; + +class StreamHasher +{ + /** + * @var string + */ + private $algo; + + /** + * StreamHasher constructor. + * + * @param string $algo + */ + public function __construct($algo) + { + $this->algo = $algo; + } + + /** + * @param resource $resource + * + * @return string + */ + public function hash($resource) + { + rewind($resource); + $context = hash_init($this->algo); + hash_update_stream($context, $resource); + fclose($resource); + + return hash_final($context); + } +} diff --git a/vendor/league/mime-type-detection/CHANGELOG.md b/vendor/league/mime-type-detection/CHANGELOG.md new file mode 100644 index 00000000..a45872a9 --- /dev/null +++ b/vendor/league/mime-type-detection/CHANGELOG.md @@ -0,0 +1,59 @@ +# Changelog + +## 1.15.0 - 2024-01-28 + +- Updated lookup + +## 1.14.0 - 2022-10-17 + +### Updated + +- Updated lookup + +## 1.13.0 - 2023-08-05 + +### Added + +- A reverse lookup mechanism to fetch one or all extensions for a given mimetype + +## 1.12.0 - 2023-08-03 + +### Updated + +- Updated lookup + +## 1.11.0 - 2023-04-17 + +### Updated + +- Updated lookup + +## 1.10.0 - 2022-04-11 + +### Fixed + +- Added Flysystem v1 inconclusive mime-types and made it configurable as a constructor parameter. + +## 1.9.0 - 2021-11-21 + +### Updated + +- Updated lookup + +## 1.8.0 - 2021-09-25 + +### Added + +- Added the decorator `OverridingExtensionToMimeTypeMap` which allows you to override values. + +## 1.7.0 - 2021-01-18 + +### Added + +- Added a `bufferSampleSize` parameter to the `FinfoMimeTypeDetector` class that allows you to send a reduced content sample which costs less memory. + +## 1.6.0 - 2021-01-18 + +### Changes + +- Updated generated mime-type map diff --git a/vendor/league/mime-type-detection/LICENSE b/vendor/league/mime-type-detection/LICENSE new file mode 100644 index 00000000..39d50b5e --- /dev/null +++ b/vendor/league/mime-type-detection/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2013-2023 Frank de Jonge + +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/vendor/league/mime-type-detection/composer.json b/vendor/league/mime-type-detection/composer.json new file mode 100644 index 00000000..cd75beea --- /dev/null +++ b/vendor/league/mime-type-detection/composer.json @@ -0,0 +1,34 @@ +{ + "name": "league/mime-type-detection", + "description": "Mime-type detection for Flysystem", + "license": "MIT", + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frankdejonge.nl" + } + ], + "scripts": { + "test": "vendor/bin/phpunit", + "phpstan": "vendor/bin/phpstan analyse -l 6 src" + }, + "require": { + "php": "^7.4 || ^8.0", + "ext-fileinfo": "*" + }, + "require-dev": { + "phpunit/phpunit": "^8.5.8 || ^9.3 || ^10.0", + "phpstan/phpstan": "^0.12.68", + "friendsofphp/php-cs-fixer": "^3.2" + }, + "autoload": { + "psr-4": { + "League\\MimeTypeDetection\\": "src" + } + }, + "config": { + "platform": { + "php": "7.4.0" + } + } +} diff --git a/vendor/league/mime-type-detection/src/EmptyExtensionToMimeTypeMap.php b/vendor/league/mime-type-detection/src/EmptyExtensionToMimeTypeMap.php new file mode 100644 index 00000000..fc042416 --- /dev/null +++ b/vendor/league/mime-type-detection/src/EmptyExtensionToMimeTypeMap.php @@ -0,0 +1,13 @@ +<?php + +declare(strict_types=1); + +namespace League\MimeTypeDetection; + +class EmptyExtensionToMimeTypeMap implements ExtensionToMimeTypeMap +{ + public function lookupMimeType(string $extension): ?string + { + return null; + } +} diff --git a/vendor/league/mime-type-detection/src/ExtensionLookup.php b/vendor/league/mime-type-detection/src/ExtensionLookup.php new file mode 100644 index 00000000..14b89df5 --- /dev/null +++ b/vendor/league/mime-type-detection/src/ExtensionLookup.php @@ -0,0 +1,14 @@ +<?php +declare(strict_types=1); + +namespace League\MimeTypeDetection; + +interface ExtensionLookup +{ + public function lookupExtension(string $mimetype): ?string; + + /** + * @return string[] + */ + public function lookupAllExtensions(string $mimetype): array; +} diff --git a/vendor/league/mime-type-detection/src/ExtensionMimeTypeDetector.php b/vendor/league/mime-type-detection/src/ExtensionMimeTypeDetector.php new file mode 100644 index 00000000..cd344620 --- /dev/null +++ b/vendor/league/mime-type-detection/src/ExtensionMimeTypeDetector.php @@ -0,0 +1,56 @@ +<?php + +declare(strict_types=1); + +namespace League\MimeTypeDetection; + +use const PATHINFO_EXTENSION; + +class ExtensionMimeTypeDetector implements MimeTypeDetector, ExtensionLookup +{ + /** + * @var ExtensionToMimeTypeMap + */ + private $extensions; + + public function __construct(ExtensionToMimeTypeMap $extensions = null) + { + $this->extensions = $extensions ?: new GeneratedExtensionToMimeTypeMap(); + } + + public function detectMimeType(string $path, $contents): ?string + { + return $this->detectMimeTypeFromPath($path); + } + + public function detectMimeTypeFromPath(string $path): ?string + { + $extension = strtolower(pathinfo($path, PATHINFO_EXTENSION)); + + return $this->extensions->lookupMimeType($extension); + } + + public function detectMimeTypeFromFile(string $path): ?string + { + return $this->detectMimeTypeFromPath($path); + } + + public function detectMimeTypeFromBuffer(string $contents): ?string + { + return null; + } + + public function lookupExtension(string $mimetype): ?string + { + return $this->extensions instanceof ExtensionLookup + ? $this->extensions->lookupExtension($mimetype) + : null; + } + + public function lookupAllExtensions(string $mimetype): array + { + return $this->extensions instanceof ExtensionLookup + ? $this->extensions->lookupAllExtensions($mimetype) + : []; + } +} diff --git a/vendor/league/mime-type-detection/src/ExtensionToMimeTypeMap.php b/vendor/league/mime-type-detection/src/ExtensionToMimeTypeMap.php new file mode 100644 index 00000000..1dad7bc1 --- /dev/null +++ b/vendor/league/mime-type-detection/src/ExtensionToMimeTypeMap.php @@ -0,0 +1,10 @@ +<?php + +declare(strict_types=1); + +namespace League\MimeTypeDetection; + +interface ExtensionToMimeTypeMap +{ + public function lookupMimeType(string $extension): ?string; +} diff --git a/vendor/league/mime-type-detection/src/FinfoMimeTypeDetector.php b/vendor/league/mime-type-detection/src/FinfoMimeTypeDetector.php new file mode 100644 index 00000000..8084f924 --- /dev/null +++ b/vendor/league/mime-type-detection/src/FinfoMimeTypeDetector.php @@ -0,0 +1,106 @@ +<?php + +declare(strict_types=1); + +namespace League\MimeTypeDetection; + +use const FILEINFO_MIME_TYPE; + +use const PATHINFO_EXTENSION; +use finfo; + +class FinfoMimeTypeDetector implements MimeTypeDetector, ExtensionLookup +{ + private const INCONCLUSIVE_MIME_TYPES = [ + 'application/x-empty', + 'text/plain', + 'text/x-asm', + 'application/octet-stream', + 'inode/x-empty', + ]; + + /** + * @var finfo + */ + private $finfo; + + /** + * @var ExtensionToMimeTypeMap + */ + private $extensionMap; + + /** + * @var int|null + */ + private $bufferSampleSize; + + /** + * @var array<string> + */ + private $inconclusiveMimetypes; + + public function __construct( + string $magicFile = '', + ExtensionToMimeTypeMap $extensionMap = null, + ?int $bufferSampleSize = null, + array $inconclusiveMimetypes = self::INCONCLUSIVE_MIME_TYPES + ) { + $this->finfo = new finfo(FILEINFO_MIME_TYPE, $magicFile); + $this->extensionMap = $extensionMap ?: new GeneratedExtensionToMimeTypeMap(); + $this->bufferSampleSize = $bufferSampleSize; + $this->inconclusiveMimetypes = $inconclusiveMimetypes; + } + + public function detectMimeType(string $path, $contents): ?string + { + $mimeType = is_string($contents) + ? (@$this->finfo->buffer($this->takeSample($contents)) ?: null) + : null; + + if ($mimeType !== null && ! in_array($mimeType, $this->inconclusiveMimetypes)) { + return $mimeType; + } + + return $this->detectMimeTypeFromPath($path); + } + + public function detectMimeTypeFromPath(string $path): ?string + { + $extension = strtolower(pathinfo($path, PATHINFO_EXTENSION)); + + return $this->extensionMap->lookupMimeType($extension); + } + + public function detectMimeTypeFromFile(string $path): ?string + { + return @$this->finfo->file($path) ?: null; + } + + public function detectMimeTypeFromBuffer(string $contents): ?string + { + return @$this->finfo->buffer($this->takeSample($contents)) ?: null; + } + + private function takeSample(string $contents): string + { + if ($this->bufferSampleSize === null) { + return $contents; + } + + return (string) substr($contents, 0, $this->bufferSampleSize); + } + + public function lookupExtension(string $mimetype): ?string + { + return $this->extensionMap instanceof ExtensionLookup + ? $this->extensionMap->lookupExtension($mimetype) + : null; + } + + public function lookupAllExtensions(string $mimetype): array + { + return $this->extensionMap instanceof ExtensionLookup + ? $this->extensionMap->lookupAllExtensions($mimetype) + : []; + } +} diff --git a/vendor/league/mime-type-detection/src/GeneratedExtensionToMimeTypeMap.php b/vendor/league/mime-type-detection/src/GeneratedExtensionToMimeTypeMap.php new file mode 100644 index 00000000..1ce17911 --- /dev/null +++ b/vendor/league/mime-type-detection/src/GeneratedExtensionToMimeTypeMap.php @@ -0,0 +1,2298 @@ +<?php + +declare(strict_types=1); + +namespace League\MimeTypeDetection; + +class GeneratedExtensionToMimeTypeMap implements ExtensionToMimeTypeMap, ExtensionLookup +{ + /** + * @var array<string, string> + * + * @internal + */ + public const MIME_TYPES_FOR_EXTENSIONS = [ + '1km' => 'application/vnd.1000minds.decision-model+xml', + '3dml' => 'text/vnd.in3d.3dml', + '3ds' => 'image/x-3ds', + '3g2' => 'video/3gpp2', + '3gp' => 'video/3gp', + '3gpp' => 'video/3gpp', + '3mf' => 'model/3mf', + '7z' => 'application/x-7z-compressed', + '7zip' => 'application/x-7z-compressed', + '123' => 'application/vnd.lotus-1-2-3', + 'aab' => 'application/x-authorware-bin', + 'aac' => 'audio/acc', + 'aam' => 'application/x-authorware-map', + 'aas' => 'application/x-authorware-seg', + 'abw' => 'application/x-abiword', + 'ac' => 'application/vnd.nokia.n-gage.ac+xml', + 'ac3' => 'audio/ac3', + 'acc' => 'application/vnd.americandynamics.acc', + 'ace' => 'application/x-ace-compressed', + 'acu' => 'application/vnd.acucobol', + 'acutc' => 'application/vnd.acucorp', + 'adp' => 'audio/adpcm', + 'adts' => 'audio/aac', + 'aep' => 'application/vnd.audiograph', + 'afm' => 'application/x-font-type1', + 'afp' => 'application/vnd.ibm.modcap', + 'age' => 'application/vnd.age', + 'ahead' => 'application/vnd.ahead.space', + 'ai' => 'application/pdf', + 'aif' => 'audio/x-aiff', + 'aifc' => 'audio/x-aiff', + 'aiff' => 'audio/x-aiff', + 'air' => 'application/vnd.adobe.air-application-installer-package+zip', + 'ait' => 'application/vnd.dvb.ait', + 'ami' => 'application/vnd.amiga.ami', + 'aml' => 'application/automationml-aml+xml', + 'amlx' => 'application/automationml-amlx+zip', + 'amr' => 'audio/amr', + 'apk' => 'application/vnd.android.package-archive', + 'apng' => 'image/apng', + 'appcache' => 'text/cache-manifest', + 'appinstaller' => 'application/appinstaller', + 'application' => 'application/x-ms-application', + 'appx' => 'application/appx', + 'appxbundle' => 'application/appxbundle', + 'apr' => 'application/vnd.lotus-approach', + 'arc' => 'application/x-freearc', + 'arj' => 'application/x-arj', + 'asc' => 'application/pgp-signature', + 'asf' => 'video/x-ms-asf', + 'asm' => 'text/x-asm', + 'aso' => 'application/vnd.accpac.simply.aso', + 'asx' => 'video/x-ms-asf', + 'atc' => 'application/vnd.acucorp', + 'atom' => 'application/atom+xml', + 'atomcat' => 'application/atomcat+xml', + 'atomdeleted' => 'application/atomdeleted+xml', + 'atomsvc' => 'application/atomsvc+xml', + 'atx' => 'application/vnd.antix.game-component', + 'au' => 'audio/x-au', + 'avci' => 'image/avci', + 'avcs' => 'image/avcs', + 'avi' => 'video/x-msvideo', + 'avif' => 'image/avif', + 'aw' => 'application/applixware', + 'azf' => 'application/vnd.airzip.filesecure.azf', + 'azs' => 'application/vnd.airzip.filesecure.azs', + 'azv' => 'image/vnd.airzip.accelerator.azv', + 'azw' => 'application/vnd.amazon.ebook', + 'b16' => 'image/vnd.pco.b16', + 'bat' => 'application/x-msdownload', + 'bcpio' => 'application/x-bcpio', + 'bdf' => 'application/x-font-bdf', + 'bdm' => 'application/vnd.syncml.dm+wbxml', + 'bdoc' => 'application/x-bdoc', + 'bed' => 'application/vnd.realvnc.bed', + 'bh2' => 'application/vnd.fujitsu.oasysprs', + 'bin' => 'application/octet-stream', + 'blb' => 'application/x-blorb', + 'blorb' => 'application/x-blorb', + 'bmi' => 'application/vnd.bmi', + 'bmml' => 'application/vnd.balsamiq.bmml+xml', + 'bmp' => 'image/bmp', + 'book' => 'application/vnd.framemaker', + 'box' => 'application/vnd.previewsystems.box', + 'boz' => 'application/x-bzip2', + 'bpk' => 'application/octet-stream', + 'bpmn' => 'application/octet-stream', + 'brf' => 'application/braille', + 'bsp' => 'model/vnd.valve.source.compiled-map', + 'btf' => 'image/prs.btif', + 'btif' => 'image/prs.btif', + 'buffer' => 'application/octet-stream', + 'bz' => 'application/x-bzip', + 'bz2' => 'application/x-bzip2', + 'c' => 'text/x-c', + 'c4d' => 'application/vnd.clonk.c4group', + 'c4f' => 'application/vnd.clonk.c4group', + 'c4g' => 'application/vnd.clonk.c4group', + 'c4p' => 'application/vnd.clonk.c4group', + 'c4u' => 'application/vnd.clonk.c4group', + 'c11amc' => 'application/vnd.cluetrust.cartomobile-config', + 'c11amz' => 'application/vnd.cluetrust.cartomobile-config-pkg', + 'cab' => 'application/vnd.ms-cab-compressed', + 'caf' => 'audio/x-caf', + 'cap' => 'application/vnd.tcpdump.pcap', + 'car' => 'application/vnd.curl.car', + 'cat' => 'application/vnd.ms-pki.seccat', + 'cb7' => 'application/x-cbr', + 'cba' => 'application/x-cbr', + 'cbr' => 'application/x-cbr', + 'cbt' => 'application/x-cbr', + 'cbz' => 'application/x-cbr', + 'cc' => 'text/x-c', + 'cco' => 'application/x-cocoa', + 'cct' => 'application/x-director', + 'ccxml' => 'application/ccxml+xml', + 'cdbcmsg' => 'application/vnd.contact.cmsg', + 'cdf' => 'application/x-netcdf', + 'cdfx' => 'application/cdfx+xml', + 'cdkey' => 'application/vnd.mediastation.cdkey', + 'cdmia' => 'application/cdmi-capability', + 'cdmic' => 'application/cdmi-container', + 'cdmid' => 'application/cdmi-domain', + 'cdmio' => 'application/cdmi-object', + 'cdmiq' => 'application/cdmi-queue', + 'cdr' => 'application/cdr', + 'cdx' => 'chemical/x-cdx', + 'cdxml' => 'application/vnd.chemdraw+xml', + 'cdy' => 'application/vnd.cinderella', + 'cer' => 'application/pkix-cert', + 'cfs' => 'application/x-cfs-compressed', + 'cgm' => 'image/cgm', + 'chat' => 'application/x-chat', + 'chm' => 'application/vnd.ms-htmlhelp', + 'chrt' => 'application/vnd.kde.kchart', + 'cif' => 'chemical/x-cif', + 'cii' => 'application/vnd.anser-web-certificate-issue-initiation', + 'cil' => 'application/vnd.ms-artgalry', + 'cjs' => 'application/node', + 'cla' => 'application/vnd.claymore', + 'class' => 'application/octet-stream', + 'cld' => 'model/vnd.cld', + 'clkk' => 'application/vnd.crick.clicker.keyboard', + 'clkp' => 'application/vnd.crick.clicker.palette', + 'clkt' => 'application/vnd.crick.clicker.template', + 'clkw' => 'application/vnd.crick.clicker.wordbank', + 'clkx' => 'application/vnd.crick.clicker', + 'clp' => 'application/x-msclip', + 'cmc' => 'application/vnd.cosmocaller', + 'cmdf' => 'chemical/x-cmdf', + 'cml' => 'chemical/x-cml', + 'cmp' => 'application/vnd.yellowriver-custom-menu', + 'cmx' => 'image/x-cmx', + 'cod' => 'application/vnd.rim.cod', + 'coffee' => 'text/coffeescript', + 'com' => 'application/x-msdownload', + 'conf' => 'text/plain', + 'cpio' => 'application/x-cpio', + 'cpl' => 'application/cpl+xml', + 'cpp' => 'text/x-c', + 'cpt' => 'application/mac-compactpro', + 'crd' => 'application/x-mscardfile', + 'crl' => 'application/pkix-crl', + 'crt' => 'application/x-x509-ca-cert', + 'crx' => 'application/x-chrome-extension', + 'cryptonote' => 'application/vnd.rig.cryptonote', + 'csh' => 'application/x-csh', + 'csl' => 'application/vnd.citationstyles.style+xml', + 'csml' => 'chemical/x-csml', + 'csp' => 'application/vnd.commonspace', + 'csr' => 'application/octet-stream', + 'css' => 'text/css', + 'cst' => 'application/x-director', + 'csv' => 'text/csv', + 'cu' => 'application/cu-seeme', + 'curl' => 'text/vnd.curl', + 'cwl' => 'application/cwl', + 'cww' => 'application/prs.cww', + 'cxt' => 'application/x-director', + 'cxx' => 'text/x-c', + 'dae' => 'model/vnd.collada+xml', + 'daf' => 'application/vnd.mobius.daf', + 'dart' => 'application/vnd.dart', + 'dataless' => 'application/vnd.fdsn.seed', + 'davmount' => 'application/davmount+xml', + 'dbf' => 'application/vnd.dbf', + 'dbk' => 'application/docbook+xml', + 'dcr' => 'application/x-director', + 'dcurl' => 'text/vnd.curl.dcurl', + 'dd2' => 'application/vnd.oma.dd2+xml', + 'ddd' => 'application/vnd.fujixerox.ddd', + 'ddf' => 'application/vnd.syncml.dmddf+xml', + 'dds' => 'image/vnd.ms-dds', + 'deb' => 'application/x-debian-package', + 'def' => 'text/plain', + 'deploy' => 'application/octet-stream', + 'der' => 'application/x-x509-ca-cert', + 'dfac' => 'application/vnd.dreamfactory', + 'dgc' => 'application/x-dgc-compressed', + 'dib' => 'image/bmp', + 'dic' => 'text/x-c', + 'dir' => 'application/x-director', + 'dis' => 'application/vnd.mobius.dis', + 'disposition-notification' => 'message/disposition-notification', + 'dist' => 'application/octet-stream', + 'distz' => 'application/octet-stream', + 'djv' => 'image/vnd.djvu', + 'djvu' => 'image/vnd.djvu', + 'dll' => 'application/octet-stream', + 'dmg' => 'application/x-apple-diskimage', + 'dmn' => 'application/octet-stream', + 'dmp' => 'application/vnd.tcpdump.pcap', + 'dms' => 'application/octet-stream', + 'dna' => 'application/vnd.dna', + 'doc' => 'application/msword', + 'docm' => 'application/vnd.ms-word.template.macroEnabled.12', + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'dot' => 'application/msword', + 'dotm' => 'application/vnd.ms-word.template.macroEnabled.12', + 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', + 'dp' => 'application/vnd.osgi.dp', + 'dpg' => 'application/vnd.dpgraph', + 'dpx' => 'image/dpx', + 'dra' => 'audio/vnd.dra', + 'drle' => 'image/dicom-rle', + 'dsc' => 'text/prs.lines.tag', + 'dssc' => 'application/dssc+der', + 'dst' => 'application/octet-stream', + 'dtb' => 'application/x-dtbook+xml', + 'dtd' => 'application/xml-dtd', + 'dts' => 'audio/vnd.dts', + 'dtshd' => 'audio/vnd.dts.hd', + 'dump' => 'application/octet-stream', + 'dvb' => 'video/vnd.dvb.file', + 'dvi' => 'application/x-dvi', + 'dwd' => 'application/atsc-dwd+xml', + 'dwf' => 'model/vnd.dwf', + 'dwg' => 'image/vnd.dwg', + 'dxf' => 'image/vnd.dxf', + 'dxp' => 'application/vnd.spotfire.dxp', + 'dxr' => 'application/x-director', + 'ear' => 'application/java-archive', + 'ecelp4800' => 'audio/vnd.nuera.ecelp4800', + 'ecelp7470' => 'audio/vnd.nuera.ecelp7470', + 'ecelp9600' => 'audio/vnd.nuera.ecelp9600', + 'ecma' => 'application/ecmascript', + 'edm' => 'application/vnd.novadigm.edm', + 'edx' => 'application/vnd.novadigm.edx', + 'efif' => 'application/vnd.picsel', + 'ei6' => 'application/vnd.pg.osasli', + 'elc' => 'application/octet-stream', + 'emf' => 'image/emf', + 'eml' => 'message/rfc822', + 'emma' => 'application/emma+xml', + 'emotionml' => 'application/emotionml+xml', + 'emz' => 'application/x-msmetafile', + 'eol' => 'audio/vnd.digital-winds', + 'eot' => 'application/vnd.ms-fontobject', + 'eps' => 'application/postscript', + 'epub' => 'application/epub+zip', + 'es3' => 'application/vnd.eszigno3+xml', + 'esa' => 'application/vnd.osgi.subsystem', + 'esf' => 'application/vnd.epson.esf', + 'et3' => 'application/vnd.eszigno3+xml', + 'etx' => 'text/x-setext', + 'eva' => 'application/x-eva', + 'evy' => 'application/x-envoy', + 'exe' => 'application/octet-stream', + 'exi' => 'application/exi', + 'exp' => 'application/express', + 'exr' => 'image/aces', + 'ext' => 'application/vnd.novadigm.ext', + 'ez' => 'application/andrew-inset', + 'ez2' => 'application/vnd.ezpix-album', + 'ez3' => 'application/vnd.ezpix-package', + 'f' => 'text/x-fortran', + 'f4v' => 'video/mp4', + 'f77' => 'text/x-fortran', + 'f90' => 'text/x-fortran', + 'fbs' => 'image/vnd.fastbidsheet', + 'fcdt' => 'application/vnd.adobe.formscentral.fcdt', + 'fcs' => 'application/vnd.isac.fcs', + 'fdf' => 'application/vnd.fdf', + 'fdt' => 'application/fdt+xml', + 'fe_launch' => 'application/vnd.denovo.fcselayout-link', + 'fg5' => 'application/vnd.fujitsu.oasysgp', + 'fgd' => 'application/x-director', + 'fh' => 'image/x-freehand', + 'fh4' => 'image/x-freehand', + 'fh5' => 'image/x-freehand', + 'fh7' => 'image/x-freehand', + 'fhc' => 'image/x-freehand', + 'fig' => 'application/x-xfig', + 'fits' => 'image/fits', + 'flac' => 'audio/x-flac', + 'fli' => 'video/x-fli', + 'flo' => 'application/vnd.micrografx.flo', + 'flv' => 'video/x-flv', + 'flw' => 'application/vnd.kde.kivio', + 'flx' => 'text/vnd.fmi.flexstor', + 'fly' => 'text/vnd.fly', + 'fm' => 'application/vnd.framemaker', + 'fnc' => 'application/vnd.frogans.fnc', + 'fo' => 'application/vnd.software602.filler.form+xml', + 'for' => 'text/x-fortran', + 'fpx' => 'image/vnd.fpx', + 'frame' => 'application/vnd.framemaker', + 'fsc' => 'application/vnd.fsc.weblaunch', + 'fst' => 'image/vnd.fst', + 'ftc' => 'application/vnd.fluxtime.clip', + 'fti' => 'application/vnd.anser-web-funds-transfer-initiation', + 'fvt' => 'video/vnd.fvt', + 'fxp' => 'application/vnd.adobe.fxp', + 'fxpl' => 'application/vnd.adobe.fxp', + 'fzs' => 'application/vnd.fuzzysheet', + 'g2w' => 'application/vnd.geoplan', + 'g3' => 'image/g3fax', + 'g3w' => 'application/vnd.geospace', + 'gac' => 'application/vnd.groove-account', + 'gam' => 'application/x-tads', + 'gbr' => 'application/rpki-ghostbusters', + 'gca' => 'application/x-gca-compressed', + 'gdl' => 'model/vnd.gdl', + 'gdoc' => 'application/vnd.google-apps.document', + 'ged' => 'text/vnd.familysearch.gedcom', + 'geo' => 'application/vnd.dynageo', + 'geojson' => 'application/geo+json', + 'gex' => 'application/vnd.geometry-explorer', + 'ggb' => 'application/vnd.geogebra.file', + 'ggt' => 'application/vnd.geogebra.tool', + 'ghf' => 'application/vnd.groove-help', + 'gif' => 'image/gif', + 'gim' => 'application/vnd.groove-identity-message', + 'glb' => 'model/gltf-binary', + 'gltf' => 'model/gltf+json', + 'gml' => 'application/gml+xml', + 'gmx' => 'application/vnd.gmx', + 'gnumeric' => 'application/x-gnumeric', + 'gpg' => 'application/gpg-keys', + 'gph' => 'application/vnd.flographit', + 'gpx' => 'application/gpx+xml', + 'gqf' => 'application/vnd.grafeq', + 'gqs' => 'application/vnd.grafeq', + 'gram' => 'application/srgs', + 'gramps' => 'application/x-gramps-xml', + 'gre' => 'application/vnd.geometry-explorer', + 'grv' => 'application/vnd.groove-injector', + 'grxml' => 'application/srgs+xml', + 'gsf' => 'application/x-font-ghostscript', + 'gsheet' => 'application/vnd.google-apps.spreadsheet', + 'gslides' => 'application/vnd.google-apps.presentation', + 'gtar' => 'application/x-gtar', + 'gtm' => 'application/vnd.groove-tool-message', + 'gtw' => 'model/vnd.gtw', + 'gv' => 'text/vnd.graphviz', + 'gxf' => 'application/gxf', + 'gxt' => 'application/vnd.geonext', + 'gz' => 'application/gzip', + 'gzip' => 'application/gzip', + 'h' => 'text/x-c', + 'h261' => 'video/h261', + 'h263' => 'video/h263', + 'h264' => 'video/h264', + 'hal' => 'application/vnd.hal+xml', + 'hbci' => 'application/vnd.hbci', + 'hbs' => 'text/x-handlebars-template', + 'hdd' => 'application/x-virtualbox-hdd', + 'hdf' => 'application/x-hdf', + 'heic' => 'image/heic', + 'heics' => 'image/heic-sequence', + 'heif' => 'image/heif', + 'heifs' => 'image/heif-sequence', + 'hej2' => 'image/hej2k', + 'held' => 'application/atsc-held+xml', + 'hh' => 'text/x-c', + 'hjson' => 'application/hjson', + 'hlp' => 'application/winhlp', + 'hpgl' => 'application/vnd.hp-hpgl', + 'hpid' => 'application/vnd.hp-hpid', + 'hps' => 'application/vnd.hp-hps', + 'hqx' => 'application/mac-binhex40', + 'hsj2' => 'image/hsj2', + 'htc' => 'text/x-component', + 'htke' => 'application/vnd.kenameaapp', + 'htm' => 'text/html', + 'html' => 'text/html', + 'hvd' => 'application/vnd.yamaha.hv-dic', + 'hvp' => 'application/vnd.yamaha.hv-voice', + 'hvs' => 'application/vnd.yamaha.hv-script', + 'i2g' => 'application/vnd.intergeo', + 'icc' => 'application/vnd.iccprofile', + 'ice' => 'x-conference/x-cooltalk', + 'icm' => 'application/vnd.iccprofile', + 'ico' => 'image/x-icon', + 'ics' => 'text/calendar', + 'ief' => 'image/ief', + 'ifb' => 'text/calendar', + 'ifm' => 'application/vnd.shana.informed.formdata', + 'iges' => 'model/iges', + 'igl' => 'application/vnd.igloader', + 'igm' => 'application/vnd.insors.igm', + 'igs' => 'model/iges', + 'igx' => 'application/vnd.micrografx.igx', + 'iif' => 'application/vnd.shana.informed.interchange', + 'img' => 'application/octet-stream', + 'imp' => 'application/vnd.accpac.simply.imp', + 'ims' => 'application/vnd.ms-ims', + 'in' => 'text/plain', + 'ini' => 'text/plain', + 'ink' => 'application/inkml+xml', + 'inkml' => 'application/inkml+xml', + 'install' => 'application/x-install-instructions', + 'iota' => 'application/vnd.astraea-software.iota', + 'ipfix' => 'application/ipfix', + 'ipk' => 'application/vnd.shana.informed.package', + 'irm' => 'application/vnd.ibm.rights-management', + 'irp' => 'application/vnd.irepository.package+xml', + 'iso' => 'application/x-iso9660-image', + 'itp' => 'application/vnd.shana.informed.formtemplate', + 'its' => 'application/its+xml', + 'ivp' => 'application/vnd.immervision-ivp', + 'ivu' => 'application/vnd.immervision-ivu', + 'jad' => 'text/vnd.sun.j2me.app-descriptor', + 'jade' => 'text/jade', + 'jam' => 'application/vnd.jam', + 'jar' => 'application/java-archive', + 'jardiff' => 'application/x-java-archive-diff', + 'java' => 'text/x-java-source', + 'jhc' => 'image/jphc', + 'jisp' => 'application/vnd.jisp', + 'jls' => 'image/jls', + 'jlt' => 'application/vnd.hp-jlyt', + 'jng' => 'image/x-jng', + 'jnlp' => 'application/x-java-jnlp-file', + 'joda' => 'application/vnd.joost.joda-archive', + 'jp2' => 'image/jp2', + 'jpe' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'jpf' => 'image/jpx', + 'jpg' => 'image/jpeg', + 'jpg2' => 'image/jp2', + 'jpgm' => 'video/jpm', + 'jpgv' => 'video/jpeg', + 'jph' => 'image/jph', + 'jpm' => 'video/jpm', + 'jpx' => 'image/jpx', + 'js' => 'application/javascript', + 'json' => 'application/json', + 'json5' => 'application/json5', + 'jsonld' => 'application/ld+json', + 'jsonml' => 'application/jsonml+json', + 'jsx' => 'text/jsx', + 'jt' => 'model/jt', + 'jxr' => 'image/jxr', + 'jxra' => 'image/jxra', + 'jxrs' => 'image/jxrs', + 'jxs' => 'image/jxs', + 'jxsc' => 'image/jxsc', + 'jxsi' => 'image/jxsi', + 'jxss' => 'image/jxss', + 'kar' => 'audio/midi', + 'karbon' => 'application/vnd.kde.karbon', + 'kdb' => 'application/octet-stream', + 'kdbx' => 'application/x-keepass2', + 'key' => 'application/x-iwork-keynote-sffkey', + 'kfo' => 'application/vnd.kde.kformula', + 'kia' => 'application/vnd.kidspiration', + 'kml' => 'application/vnd.google-earth.kml+xml', + 'kmz' => 'application/vnd.google-earth.kmz', + 'kne' => 'application/vnd.kinar', + 'knp' => 'application/vnd.kinar', + 'kon' => 'application/vnd.kde.kontour', + 'kpr' => 'application/vnd.kde.kpresenter', + 'kpt' => 'application/vnd.kde.kpresenter', + 'kpxx' => 'application/vnd.ds-keypoint', + 'ksp' => 'application/vnd.kde.kspread', + 'ktr' => 'application/vnd.kahootz', + 'ktx' => 'image/ktx', + 'ktx2' => 'image/ktx2', + 'ktz' => 'application/vnd.kahootz', + 'kwd' => 'application/vnd.kde.kword', + 'kwt' => 'application/vnd.kde.kword', + 'lasxml' => 'application/vnd.las.las+xml', + 'latex' => 'application/x-latex', + 'lbd' => 'application/vnd.llamagraphics.life-balance.desktop', + 'lbe' => 'application/vnd.llamagraphics.life-balance.exchange+xml', + 'les' => 'application/vnd.hhe.lesson-player', + 'less' => 'text/less', + 'lgr' => 'application/lgr+xml', + 'lha' => 'application/octet-stream', + 'link66' => 'application/vnd.route66.link66+xml', + 'list' => 'text/plain', + 'list3820' => 'application/vnd.ibm.modcap', + 'listafp' => 'application/vnd.ibm.modcap', + 'litcoffee' => 'text/coffeescript', + 'lnk' => 'application/x-ms-shortcut', + 'log' => 'text/plain', + 'lostxml' => 'application/lost+xml', + 'lrf' => 'application/octet-stream', + 'lrm' => 'application/vnd.ms-lrm', + 'ltf' => 'application/vnd.frogans.ltf', + 'lua' => 'text/x-lua', + 'luac' => 'application/x-lua-bytecode', + 'lvp' => 'audio/vnd.lucent.voice', + 'lwp' => 'application/vnd.lotus-wordpro', + 'lzh' => 'application/octet-stream', + 'm1v' => 'video/mpeg', + 'm2a' => 'audio/mpeg', + 'm2v' => 'video/mpeg', + 'm3a' => 'audio/mpeg', + 'm3u' => 'text/plain', + 'm3u8' => 'application/vnd.apple.mpegurl', + 'm4a' => 'audio/x-m4a', + 'm4p' => 'application/mp4', + 'm4s' => 'video/iso.segment', + 'm4u' => 'application/vnd.mpegurl', + 'm4v' => 'video/x-m4v', + 'm13' => 'application/x-msmediaview', + 'm14' => 'application/x-msmediaview', + 'm21' => 'application/mp21', + 'ma' => 'application/mathematica', + 'mads' => 'application/mads+xml', + 'maei' => 'application/mmt-aei+xml', + 'mag' => 'application/vnd.ecowin.chart', + 'maker' => 'application/vnd.framemaker', + 'man' => 'text/troff', + 'manifest' => 'text/cache-manifest', + 'map' => 'application/json', + 'mar' => 'application/octet-stream', + 'markdown' => 'text/markdown', + 'mathml' => 'application/mathml+xml', + 'mb' => 'application/mathematica', + 'mbk' => 'application/vnd.mobius.mbk', + 'mbox' => 'application/mbox', + 'mc1' => 'application/vnd.medcalcdata', + 'mcd' => 'application/vnd.mcd', + 'mcurl' => 'text/vnd.curl.mcurl', + 'md' => 'text/markdown', + 'mdb' => 'application/x-msaccess', + 'mdi' => 'image/vnd.ms-modi', + 'mdx' => 'text/mdx', + 'me' => 'text/troff', + 'mesh' => 'model/mesh', + 'meta4' => 'application/metalink4+xml', + 'metalink' => 'application/metalink+xml', + 'mets' => 'application/mets+xml', + 'mfm' => 'application/vnd.mfmp', + 'mft' => 'application/rpki-manifest', + 'mgp' => 'application/vnd.osgeo.mapguide.package', + 'mgz' => 'application/vnd.proteus.magazine', + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mie' => 'application/x-mie', + 'mif' => 'application/vnd.mif', + 'mime' => 'message/rfc822', + 'mj2' => 'video/mj2', + 'mjp2' => 'video/mj2', + 'mjs' => 'text/javascript', + 'mk3d' => 'video/x-matroska', + 'mka' => 'audio/x-matroska', + 'mkd' => 'text/x-markdown', + 'mks' => 'video/x-matroska', + 'mkv' => 'video/x-matroska', + 'mlp' => 'application/vnd.dolby.mlp', + 'mmd' => 'application/vnd.chipnuts.karaoke-mmd', + 'mmf' => 'application/vnd.smaf', + 'mml' => 'text/mathml', + 'mmr' => 'image/vnd.fujixerox.edmics-mmr', + 'mng' => 'video/x-mng', + 'mny' => 'application/x-msmoney', + 'mobi' => 'application/x-mobipocket-ebook', + 'mods' => 'application/mods+xml', + 'mov' => 'video/quicktime', + 'movie' => 'video/x-sgi-movie', + 'mp2' => 'audio/mpeg', + 'mp2a' => 'audio/mpeg', + 'mp3' => 'audio/mpeg', + 'mp4' => 'video/mp4', + 'mp4a' => 'audio/mp4', + 'mp4s' => 'application/mp4', + 'mp4v' => 'video/mp4', + 'mp21' => 'application/mp21', + 'mpc' => 'application/vnd.mophun.certificate', + 'mpd' => 'application/dash+xml', + 'mpe' => 'video/mpeg', + 'mpeg' => 'video/mpeg', + 'mpf' => 'application/media-policy-dataset+xml', + 'mpg' => 'video/mpeg', + 'mpg4' => 'video/mp4', + 'mpga' => 'audio/mpeg', + 'mpkg' => 'application/vnd.apple.installer+xml', + 'mpm' => 'application/vnd.blueice.multipass', + 'mpn' => 'application/vnd.mophun.application', + 'mpp' => 'application/vnd.ms-project', + 'mpt' => 'application/vnd.ms-project', + 'mpy' => 'application/vnd.ibm.minipay', + 'mqy' => 'application/vnd.mobius.mqy', + 'mrc' => 'application/marc', + 'mrcx' => 'application/marcxml+xml', + 'ms' => 'text/troff', + 'mscml' => 'application/mediaservercontrol+xml', + 'mseed' => 'application/vnd.fdsn.mseed', + 'mseq' => 'application/vnd.mseq', + 'msf' => 'application/vnd.epson.msf', + 'msg' => 'application/vnd.ms-outlook', + 'msh' => 'model/mesh', + 'msi' => 'application/x-msdownload', + 'msix' => 'application/msix', + 'msixbundle' => 'application/msixbundle', + 'msl' => 'application/vnd.mobius.msl', + 'msm' => 'application/octet-stream', + 'msp' => 'application/octet-stream', + 'msty' => 'application/vnd.muvee.style', + 'mtl' => 'model/mtl', + 'mts' => 'model/vnd.mts', + 'mus' => 'application/vnd.musician', + 'musd' => 'application/mmt-usd+xml', + 'musicxml' => 'application/vnd.recordare.musicxml+xml', + 'mvb' => 'application/x-msmediaview', + 'mvt' => 'application/vnd.mapbox-vector-tile', + 'mwf' => 'application/vnd.mfer', + 'mxf' => 'application/mxf', + 'mxl' => 'application/vnd.recordare.musicxml', + 'mxmf' => 'audio/mobile-xmf', + 'mxml' => 'application/xv+xml', + 'mxs' => 'application/vnd.triscape.mxs', + 'mxu' => 'video/vnd.mpegurl', + 'n-gage' => 'application/vnd.nokia.n-gage.symbian.install', + 'n3' => 'text/n3', + 'nb' => 'application/mathematica', + 'nbp' => 'application/vnd.wolfram.player', + 'nc' => 'application/x-netcdf', + 'ncx' => 'application/x-dtbncx+xml', + 'ndjson' => 'application/x-ndjson', + 'nfo' => 'text/x-nfo', + 'ngdat' => 'application/vnd.nokia.n-gage.data', + 'nitf' => 'application/vnd.nitf', + 'nlu' => 'application/vnd.neurolanguage.nlu', + 'nml' => 'application/vnd.enliven', + 'nnd' => 'application/vnd.noblenet-directory', + 'nns' => 'application/vnd.noblenet-sealer', + 'nnw' => 'application/vnd.noblenet-web', + 'npx' => 'image/vnd.net-fpx', + 'nq' => 'application/n-quads', + 'nsc' => 'application/x-conference', + 'nsf' => 'application/vnd.lotus-notes', + 'nt' => 'application/n-triples', + 'ntf' => 'application/vnd.nitf', + 'numbers' => 'application/x-iwork-numbers-sffnumbers', + 'nzb' => 'application/x-nzb', + 'oa2' => 'application/vnd.fujitsu.oasys2', + 'oa3' => 'application/vnd.fujitsu.oasys3', + 'oas' => 'application/vnd.fujitsu.oasys', + 'obd' => 'application/x-msbinder', + 'obgx' => 'application/vnd.openblox.game+xml', + 'obj' => 'model/obj', + 'oda' => 'application/oda', + 'odb' => 'application/vnd.oasis.opendocument.database', + 'odc' => 'application/vnd.oasis.opendocument.chart', + 'odf' => 'application/vnd.oasis.opendocument.formula', + 'odft' => 'application/vnd.oasis.opendocument.formula-template', + 'odg' => 'application/vnd.oasis.opendocument.graphics', + 'odi' => 'application/vnd.oasis.opendocument.image', + 'odm' => 'application/vnd.oasis.opendocument.text-master', + 'odp' => 'application/vnd.oasis.opendocument.presentation', + 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', + 'odt' => 'application/vnd.oasis.opendocument.text', + 'oga' => 'audio/ogg', + 'ogex' => 'model/vnd.opengex', + 'ogg' => 'audio/ogg', + 'ogv' => 'video/ogg', + 'ogx' => 'application/ogg', + 'omdoc' => 'application/omdoc+xml', + 'onepkg' => 'application/onenote', + 'onetmp' => 'application/onenote', + 'onetoc' => 'application/onenote', + 'onetoc2' => 'application/onenote', + 'opf' => 'application/oebps-package+xml', + 'opml' => 'text/x-opml', + 'oprc' => 'application/vnd.palm', + 'opus' => 'audio/ogg', + 'org' => 'text/x-org', + 'osf' => 'application/vnd.yamaha.openscoreformat', + 'osfpvg' => 'application/vnd.yamaha.openscoreformat.osfpvg+xml', + 'osm' => 'application/vnd.openstreetmap.data+xml', + 'otc' => 'application/vnd.oasis.opendocument.chart-template', + 'otf' => 'font/otf', + 'otg' => 'application/vnd.oasis.opendocument.graphics-template', + 'oth' => 'application/vnd.oasis.opendocument.text-web', + 'oti' => 'application/vnd.oasis.opendocument.image-template', + 'otp' => 'application/vnd.oasis.opendocument.presentation-template', + 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', + 'ott' => 'application/vnd.oasis.opendocument.text-template', + 'ova' => 'application/x-virtualbox-ova', + 'ovf' => 'application/x-virtualbox-ovf', + 'owl' => 'application/rdf+xml', + 'oxps' => 'application/oxps', + 'oxt' => 'application/vnd.openofficeorg.extension', + 'p' => 'text/x-pascal', + 'p7a' => 'application/x-pkcs7-signature', + 'p7b' => 'application/x-pkcs7-certificates', + 'p7c' => 'application/pkcs7-mime', + 'p7m' => 'application/pkcs7-mime', + 'p7r' => 'application/x-pkcs7-certreqresp', + 'p7s' => 'application/pkcs7-signature', + 'p8' => 'application/pkcs8', + 'p10' => 'application/x-pkcs10', + 'p12' => 'application/x-pkcs12', + 'pac' => 'application/x-ns-proxy-autoconfig', + 'pages' => 'application/x-iwork-pages-sffpages', + 'pas' => 'text/x-pascal', + 'paw' => 'application/vnd.pawaafile', + 'pbd' => 'application/vnd.powerbuilder6', + 'pbm' => 'image/x-portable-bitmap', + 'pcap' => 'application/vnd.tcpdump.pcap', + 'pcf' => 'application/x-font-pcf', + 'pcl' => 'application/vnd.hp-pcl', + 'pclxl' => 'application/vnd.hp-pclxl', + 'pct' => 'image/x-pict', + 'pcurl' => 'application/vnd.curl.pcurl', + 'pcx' => 'image/x-pcx', + 'pdb' => 'application/x-pilot', + 'pde' => 'text/x-processing', + 'pdf' => 'application/pdf', + 'pem' => 'application/x-x509-user-cert', + 'pfa' => 'application/x-font-type1', + 'pfb' => 'application/x-font-type1', + 'pfm' => 'application/x-font-type1', + 'pfr' => 'application/font-tdpfr', + 'pfx' => 'application/x-pkcs12', + 'pgm' => 'image/x-portable-graymap', + 'pgn' => 'application/x-chess-pgn', + 'pgp' => 'application/pgp', + 'phar' => 'application/octet-stream', + 'php' => 'application/x-httpd-php', + 'php3' => 'application/x-httpd-php', + 'php4' => 'application/x-httpd-php', + 'phps' => 'application/x-httpd-php-source', + 'phtml' => 'application/x-httpd-php', + 'pic' => 'image/x-pict', + 'pkg' => 'application/octet-stream', + 'pki' => 'application/pkixcmp', + 'pkipath' => 'application/pkix-pkipath', + 'pkpass' => 'application/vnd.apple.pkpass', + 'pl' => 'application/x-perl', + 'plb' => 'application/vnd.3gpp.pic-bw-large', + 'plc' => 'application/vnd.mobius.plc', + 'plf' => 'application/vnd.pocketlearn', + 'pls' => 'application/pls+xml', + 'pm' => 'application/x-perl', + 'pml' => 'application/vnd.ctc-posml', + 'png' => 'image/png', + 'pnm' => 'image/x-portable-anymap', + 'portpkg' => 'application/vnd.macports.portpkg', + 'pot' => 'application/vnd.ms-powerpoint', + 'potm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', + 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', + 'ppa' => 'application/vnd.ms-powerpoint', + 'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12', + 'ppd' => 'application/vnd.cups-ppd', + 'ppm' => 'image/x-portable-pixmap', + 'pps' => 'application/vnd.ms-powerpoint', + 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', + 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', + 'ppt' => 'application/powerpoint', + 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', + 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'pqa' => 'application/vnd.palm', + 'prc' => 'model/prc', + 'pre' => 'application/vnd.lotus-freelance', + 'prf' => 'application/pics-rules', + 'provx' => 'application/provenance+xml', + 'ps' => 'application/postscript', + 'psb' => 'application/vnd.3gpp.pic-bw-small', + 'psd' => 'application/x-photoshop', + 'psf' => 'application/x-font-linux-psf', + 'pskcxml' => 'application/pskc+xml', + 'pti' => 'image/prs.pti', + 'ptid' => 'application/vnd.pvi.ptid1', + 'pub' => 'application/x-mspublisher', + 'pv' => 'application/octet-stream', + 'pvb' => 'application/vnd.3gpp.pic-bw-var', + 'pwn' => 'application/vnd.3m.post-it-notes', + 'pxf' => 'application/octet-stream', + 'pya' => 'audio/vnd.ms-playready.media.pya', + 'pyo' => 'model/vnd.pytha.pyox', + 'pyox' => 'model/vnd.pytha.pyox', + 'pyv' => 'video/vnd.ms-playready.media.pyv', + 'qam' => 'application/vnd.epson.quickanime', + 'qbo' => 'application/vnd.intu.qbo', + 'qfx' => 'application/vnd.intu.qfx', + 'qps' => 'application/vnd.publishare-delta-tree', + 'qt' => 'video/quicktime', + 'qwd' => 'application/vnd.quark.quarkxpress', + 'qwt' => 'application/vnd.quark.quarkxpress', + 'qxb' => 'application/vnd.quark.quarkxpress', + 'qxd' => 'application/vnd.quark.quarkxpress', + 'qxl' => 'application/vnd.quark.quarkxpress', + 'qxt' => 'application/vnd.quark.quarkxpress', + 'ra' => 'audio/x-realaudio', + 'ram' => 'audio/x-pn-realaudio', + 'raml' => 'application/raml+yaml', + 'rapd' => 'application/route-apd+xml', + 'rar' => 'application/x-rar', + 'ras' => 'image/x-cmu-raster', + 'rcprofile' => 'application/vnd.ipunplugged.rcprofile', + 'rdf' => 'application/rdf+xml', + 'rdz' => 'application/vnd.data-vision.rdz', + 'relo' => 'application/p2p-overlay+xml', + 'rep' => 'application/vnd.businessobjects', + 'res' => 'application/x-dtbresource+xml', + 'rgb' => 'image/x-rgb', + 'rif' => 'application/reginfo+xml', + 'rip' => 'audio/vnd.rip', + 'ris' => 'application/x-research-info-systems', + 'rl' => 'application/resource-lists+xml', + 'rlc' => 'image/vnd.fujixerox.edmics-rlc', + 'rld' => 'application/resource-lists-diff+xml', + 'rm' => 'audio/x-pn-realaudio', + 'rmi' => 'audio/midi', + 'rmp' => 'audio/x-pn-realaudio-plugin', + 'rms' => 'application/vnd.jcp.javame.midlet-rms', + 'rmvb' => 'application/vnd.rn-realmedia-vbr', + 'rnc' => 'application/relax-ng-compact-syntax', + 'rng' => 'application/xml', + 'roa' => 'application/rpki-roa', + 'roff' => 'text/troff', + 'rp9' => 'application/vnd.cloanto.rp9', + 'rpm' => 'audio/x-pn-realaudio-plugin', + 'rpss' => 'application/vnd.nokia.radio-presets', + 'rpst' => 'application/vnd.nokia.radio-preset', + 'rq' => 'application/sparql-query', + 'rs' => 'application/rls-services+xml', + 'rsa' => 'application/x-pkcs7', + 'rsat' => 'application/atsc-rsat+xml', + 'rsd' => 'application/rsd+xml', + 'rsheet' => 'application/urc-ressheet+xml', + 'rss' => 'application/rss+xml', + 'rtf' => 'text/rtf', + 'rtx' => 'text/richtext', + 'run' => 'application/x-makeself', + 'rusd' => 'application/route-usd+xml', + 'rv' => 'video/vnd.rn-realvideo', + 's' => 'text/x-asm', + 's3m' => 'audio/s3m', + 'saf' => 'application/vnd.yamaha.smaf-audio', + 'sass' => 'text/x-sass', + 'sbml' => 'application/sbml+xml', + 'sc' => 'application/vnd.ibm.secure-container', + 'scd' => 'application/x-msschedule', + 'scm' => 'application/vnd.lotus-screencam', + 'scq' => 'application/scvp-cv-request', + 'scs' => 'application/scvp-cv-response', + 'scss' => 'text/x-scss', + 'scurl' => 'text/vnd.curl.scurl', + 'sda' => 'application/vnd.stardivision.draw', + 'sdc' => 'application/vnd.stardivision.calc', + 'sdd' => 'application/vnd.stardivision.impress', + 'sdkd' => 'application/vnd.solent.sdkm+xml', + 'sdkm' => 'application/vnd.solent.sdkm+xml', + 'sdp' => 'application/sdp', + 'sdw' => 'application/vnd.stardivision.writer', + 'sea' => 'application/octet-stream', + 'see' => 'application/vnd.seemail', + 'seed' => 'application/vnd.fdsn.seed', + 'sema' => 'application/vnd.sema', + 'semd' => 'application/vnd.semd', + 'semf' => 'application/vnd.semf', + 'senmlx' => 'application/senml+xml', + 'sensmlx' => 'application/sensml+xml', + 'ser' => 'application/java-serialized-object', + 'setpay' => 'application/set-payment-initiation', + 'setreg' => 'application/set-registration-initiation', + 'sfd-hdstx' => 'application/vnd.hydrostatix.sof-data', + 'sfs' => 'application/vnd.spotfire.sfs', + 'sfv' => 'text/x-sfv', + 'sgi' => 'image/sgi', + 'sgl' => 'application/vnd.stardivision.writer-global', + 'sgm' => 'text/sgml', + 'sgml' => 'text/sgml', + 'sh' => 'application/x-sh', + 'shar' => 'application/x-shar', + 'shex' => 'text/shex', + 'shf' => 'application/shf+xml', + 'shtml' => 'text/html', + 'sid' => 'image/x-mrsid-image', + 'sieve' => 'application/sieve', + 'sig' => 'application/pgp-signature', + 'sil' => 'audio/silk', + 'silo' => 'model/mesh', + 'sis' => 'application/vnd.symbian.install', + 'sisx' => 'application/vnd.symbian.install', + 'sit' => 'application/x-stuffit', + 'sitx' => 'application/x-stuffitx', + 'siv' => 'application/sieve', + 'skd' => 'application/vnd.koan', + 'skm' => 'application/vnd.koan', + 'skp' => 'application/vnd.koan', + 'skt' => 'application/vnd.koan', + 'sldm' => 'application/vnd.ms-powerpoint.slide.macroenabled.12', + 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide', + 'slim' => 'text/slim', + 'slm' => 'text/slim', + 'sls' => 'application/route-s-tsid+xml', + 'slt' => 'application/vnd.epson.salt', + 'sm' => 'application/vnd.stepmania.stepchart', + 'smf' => 'application/vnd.stardivision.math', + 'smi' => 'application/smil', + 'smil' => 'application/smil', + 'smv' => 'video/x-smv', + 'smzip' => 'application/vnd.stepmania.package', + 'snd' => 'audio/basic', + 'snf' => 'application/x-font-snf', + 'so' => 'application/octet-stream', + 'spc' => 'application/x-pkcs7-certificates', + 'spdx' => 'text/spdx', + 'spf' => 'application/vnd.yamaha.smaf-phrase', + 'spl' => 'application/x-futuresplash', + 'spot' => 'text/vnd.in3d.spot', + 'spp' => 'application/scvp-vp-response', + 'spq' => 'application/scvp-vp-request', + 'spx' => 'audio/ogg', + 'sql' => 'application/x-sql', + 'src' => 'application/x-wais-source', + 'srt' => 'application/x-subrip', + 'sru' => 'application/sru+xml', + 'srx' => 'application/sparql-results+xml', + 'ssdl' => 'application/ssdl+xml', + 'sse' => 'application/vnd.kodak-descriptor', + 'ssf' => 'application/vnd.epson.ssf', + 'ssml' => 'application/ssml+xml', + 'sst' => 'application/octet-stream', + 'st' => 'application/vnd.sailingtracker.track', + 'stc' => 'application/vnd.sun.xml.calc.template', + 'std' => 'application/vnd.sun.xml.draw.template', + 'step' => 'application/STEP', + 'stf' => 'application/vnd.wt.stf', + 'sti' => 'application/vnd.sun.xml.impress.template', + 'stk' => 'application/hyperstudio', + 'stl' => 'model/stl', + 'stp' => 'application/STEP', + 'stpx' => 'model/step+xml', + 'stpxz' => 'model/step-xml+zip', + 'stpz' => 'model/step+zip', + 'str' => 'application/vnd.pg.format', + 'stw' => 'application/vnd.sun.xml.writer.template', + 'styl' => 'text/stylus', + 'stylus' => 'text/stylus', + 'sub' => 'text/vnd.dvb.subtitle', + 'sus' => 'application/vnd.sus-calendar', + 'susp' => 'application/vnd.sus-calendar', + 'sv4cpio' => 'application/x-sv4cpio', + 'sv4crc' => 'application/x-sv4crc', + 'svc' => 'application/vnd.dvb.service', + 'svd' => 'application/vnd.svd', + 'svg' => 'image/svg+xml', + 'svgz' => 'image/svg+xml', + 'swa' => 'application/x-director', + 'swf' => 'application/x-shockwave-flash', + 'swi' => 'application/vnd.aristanetworks.swi', + 'swidtag' => 'application/swid+xml', + 'sxc' => 'application/vnd.sun.xml.calc', + 'sxd' => 'application/vnd.sun.xml.draw', + 'sxg' => 'application/vnd.sun.xml.writer.global', + 'sxi' => 'application/vnd.sun.xml.impress', + 'sxm' => 'application/vnd.sun.xml.math', + 'sxw' => 'application/vnd.sun.xml.writer', + 't' => 'text/troff', + 't3' => 'application/x-t3vm-image', + 't38' => 'image/t38', + 'taglet' => 'application/vnd.mynfc', + 'tao' => 'application/vnd.tao.intent-module-archive', + 'tap' => 'image/vnd.tencent.tap', + 'tar' => 'application/x-tar', + 'tcap' => 'application/vnd.3gpp2.tcap', + 'tcl' => 'application/x-tcl', + 'td' => 'application/urc-targetdesc+xml', + 'teacher' => 'application/vnd.smart.teacher', + 'tei' => 'application/tei+xml', + 'teicorpus' => 'application/tei+xml', + 'tex' => 'application/x-tex', + 'texi' => 'application/x-texinfo', + 'texinfo' => 'application/x-texinfo', + 'text' => 'text/plain', + 'tfi' => 'application/thraud+xml', + 'tfm' => 'application/x-tex-tfm', + 'tfx' => 'image/tiff-fx', + 'tga' => 'image/x-tga', + 'tgz' => 'application/x-tar', + 'thmx' => 'application/vnd.ms-officetheme', + 'tif' => 'image/tiff', + 'tiff' => 'image/tiff', + 'tk' => 'application/x-tcl', + 'tmo' => 'application/vnd.tmobile-livetv', + 'toml' => 'application/toml', + 'torrent' => 'application/x-bittorrent', + 'tpl' => 'application/vnd.groove-tool-template', + 'tpt' => 'application/vnd.trid.tpt', + 'tr' => 'text/troff', + 'tra' => 'application/vnd.trueapp', + 'trig' => 'application/trig', + 'trm' => 'application/x-msterminal', + 'ts' => 'video/mp2t', + 'tsd' => 'application/timestamped-data', + 'tsv' => 'text/tab-separated-values', + 'ttc' => 'font/collection', + 'ttf' => 'font/ttf', + 'ttl' => 'text/turtle', + 'ttml' => 'application/ttml+xml', + 'twd' => 'application/vnd.simtech-mindmapper', + 'twds' => 'application/vnd.simtech-mindmapper', + 'txd' => 'application/vnd.genomatix.tuxedo', + 'txf' => 'application/vnd.mobius.txf', + 'txt' => 'text/plain', + 'u3d' => 'model/u3d', + 'u8dsn' => 'message/global-delivery-status', + 'u8hdr' => 'message/global-headers', + 'u8mdn' => 'message/global-disposition-notification', + 'u8msg' => 'message/global', + 'u32' => 'application/x-authorware-bin', + 'ubj' => 'application/ubjson', + 'udeb' => 'application/x-debian-package', + 'ufd' => 'application/vnd.ufdl', + 'ufdl' => 'application/vnd.ufdl', + 'ulx' => 'application/x-glulx', + 'umj' => 'application/vnd.umajin', + 'unityweb' => 'application/vnd.unity', + 'uo' => 'application/vnd.uoml+xml', + 'uoml' => 'application/vnd.uoml+xml', + 'uri' => 'text/uri-list', + 'uris' => 'text/uri-list', + 'urls' => 'text/uri-list', + 'usda' => 'model/vnd.usda', + 'usdz' => 'model/vnd.usdz+zip', + 'ustar' => 'application/x-ustar', + 'utz' => 'application/vnd.uiq.theme', + 'uu' => 'text/x-uuencode', + 'uva' => 'audio/vnd.dece.audio', + 'uvd' => 'application/vnd.dece.data', + 'uvf' => 'application/vnd.dece.data', + 'uvg' => 'image/vnd.dece.graphic', + 'uvh' => 'video/vnd.dece.hd', + 'uvi' => 'image/vnd.dece.graphic', + 'uvm' => 'video/vnd.dece.mobile', + 'uvp' => 'video/vnd.dece.pd', + 'uvs' => 'video/vnd.dece.sd', + 'uvt' => 'application/vnd.dece.ttml+xml', + 'uvu' => 'video/vnd.uvvu.mp4', + 'uvv' => 'video/vnd.dece.video', + 'uvva' => 'audio/vnd.dece.audio', + 'uvvd' => 'application/vnd.dece.data', + 'uvvf' => 'application/vnd.dece.data', + 'uvvg' => 'image/vnd.dece.graphic', + 'uvvh' => 'video/vnd.dece.hd', + 'uvvi' => 'image/vnd.dece.graphic', + 'uvvm' => 'video/vnd.dece.mobile', + 'uvvp' => 'video/vnd.dece.pd', + 'uvvs' => 'video/vnd.dece.sd', + 'uvvt' => 'application/vnd.dece.ttml+xml', + 'uvvu' => 'video/vnd.uvvu.mp4', + 'uvvv' => 'video/vnd.dece.video', + 'uvvx' => 'application/vnd.dece.unspecified', + 'uvvz' => 'application/vnd.dece.zip', + 'uvx' => 'application/vnd.dece.unspecified', + 'uvz' => 'application/vnd.dece.zip', + 'vbox' => 'application/x-virtualbox-vbox', + 'vbox-extpack' => 'application/x-virtualbox-vbox-extpack', + 'vcard' => 'text/vcard', + 'vcd' => 'application/x-cdlink', + 'vcf' => 'text/x-vcard', + 'vcg' => 'application/vnd.groove-vcard', + 'vcs' => 'text/x-vcalendar', + 'vcx' => 'application/vnd.vcx', + 'vdi' => 'application/x-virtualbox-vdi', + 'vds' => 'model/vnd.sap.vds', + 'vhd' => 'application/x-virtualbox-vhd', + 'vis' => 'application/vnd.visionary', + 'viv' => 'video/vnd.vivo', + 'vlc' => 'application/videolan', + 'vmdk' => 'application/x-virtualbox-vmdk', + 'vob' => 'video/x-ms-vob', + 'vor' => 'application/vnd.stardivision.writer', + 'vox' => 'application/x-authorware-bin', + 'vrml' => 'model/vrml', + 'vsd' => 'application/vnd.visio', + 'vsf' => 'application/vnd.vsf', + 'vss' => 'application/vnd.visio', + 'vst' => 'application/vnd.visio', + 'vsw' => 'application/vnd.visio', + 'vtf' => 'image/vnd.valve.source.texture', + 'vtt' => 'text/vtt', + 'vtu' => 'model/vnd.vtu', + 'vxml' => 'application/voicexml+xml', + 'w3d' => 'application/x-director', + 'wad' => 'application/x-doom', + 'wadl' => 'application/vnd.sun.wadl+xml', + 'war' => 'application/java-archive', + 'wasm' => 'application/wasm', + 'wav' => 'audio/x-wav', + 'wax' => 'audio/x-ms-wax', + 'wbmp' => 'image/vnd.wap.wbmp', + 'wbs' => 'application/vnd.criticaltools.wbs+xml', + 'wbxml' => 'application/wbxml', + 'wcm' => 'application/vnd.ms-works', + 'wdb' => 'application/vnd.ms-works', + 'wdp' => 'image/vnd.ms-photo', + 'weba' => 'audio/webm', + 'webapp' => 'application/x-web-app-manifest+json', + 'webm' => 'video/webm', + 'webmanifest' => 'application/manifest+json', + 'webp' => 'image/webp', + 'wg' => 'application/vnd.pmi.widget', + 'wgsl' => 'text/wgsl', + 'wgt' => 'application/widget', + 'wif' => 'application/watcherinfo+xml', + 'wks' => 'application/vnd.ms-works', + 'wm' => 'video/x-ms-wm', + 'wma' => 'audio/x-ms-wma', + 'wmd' => 'application/x-ms-wmd', + 'wmf' => 'image/wmf', + 'wml' => 'text/vnd.wap.wml', + 'wmlc' => 'application/wmlc', + 'wmls' => 'text/vnd.wap.wmlscript', + 'wmlsc' => 'application/vnd.wap.wmlscriptc', + 'wmv' => 'video/x-ms-wmv', + 'wmx' => 'video/x-ms-wmx', + 'wmz' => 'application/x-msmetafile', + 'woff' => 'font/woff', + 'woff2' => 'font/woff2', + 'word' => 'application/msword', + 'wpd' => 'application/vnd.wordperfect', + 'wpl' => 'application/vnd.ms-wpl', + 'wps' => 'application/vnd.ms-works', + 'wqd' => 'application/vnd.wqd', + 'wri' => 'application/x-mswrite', + 'wrl' => 'model/vrml', + 'wsc' => 'message/vnd.wfa.wsc', + 'wsdl' => 'application/wsdl+xml', + 'wspolicy' => 'application/wspolicy+xml', + 'wtb' => 'application/vnd.webturbo', + 'wvx' => 'video/x-ms-wvx', + 'x3d' => 'model/x3d+xml', + 'x3db' => 'model/x3d+fastinfoset', + 'x3dbz' => 'model/x3d+binary', + 'x3dv' => 'model/x3d-vrml', + 'x3dvz' => 'model/x3d+vrml', + 'x3dz' => 'model/x3d+xml', + 'x32' => 'application/x-authorware-bin', + 'x_b' => 'model/vnd.parasolid.transmit.binary', + 'x_t' => 'model/vnd.parasolid.transmit.text', + 'xaml' => 'application/xaml+xml', + 'xap' => 'application/x-silverlight-app', + 'xar' => 'application/vnd.xara', + 'xav' => 'application/xcap-att+xml', + 'xbap' => 'application/x-ms-xbap', + 'xbd' => 'application/vnd.fujixerox.docuworks.binder', + 'xbm' => 'image/x-xbitmap', + 'xca' => 'application/xcap-caps+xml', + 'xcs' => 'application/calendar+xml', + 'xdf' => 'application/xcap-diff+xml', + 'xdm' => 'application/vnd.syncml.dm+xml', + 'xdp' => 'application/vnd.adobe.xdp+xml', + 'xdssc' => 'application/dssc+xml', + 'xdw' => 'application/vnd.fujixerox.docuworks', + 'xel' => 'application/xcap-el+xml', + 'xenc' => 'application/xenc+xml', + 'xer' => 'application/patch-ops-error+xml', + 'xfdf' => 'application/xfdf', + 'xfdl' => 'application/vnd.xfdl', + 'xht' => 'application/xhtml+xml', + 'xhtm' => 'application/vnd.pwg-xhtml-print+xml', + 'xhtml' => 'application/xhtml+xml', + 'xhvml' => 'application/xv+xml', + 'xif' => 'image/vnd.xiff', + 'xl' => 'application/excel', + 'xla' => 'application/vnd.ms-excel', + 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', + 'xlc' => 'application/vnd.ms-excel', + 'xlf' => 'application/xliff+xml', + 'xlm' => 'application/vnd.ms-excel', + 'xls' => 'application/vnd.ms-excel', + 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', + 'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12', + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'xlt' => 'application/vnd.ms-excel', + 'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12', + 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', + 'xlw' => 'application/vnd.ms-excel', + 'xm' => 'audio/xm', + 'xml' => 'application/xml', + 'xns' => 'application/xcap-ns+xml', + 'xo' => 'application/vnd.olpc-sugar', + 'xop' => 'application/xop+xml', + 'xpi' => 'application/x-xpinstall', + 'xpl' => 'application/xproc+xml', + 'xpm' => 'image/x-xpixmap', + 'xpr' => 'application/vnd.is-xpr', + 'xps' => 'application/vnd.ms-xpsdocument', + 'xpw' => 'application/vnd.intercon.formnet', + 'xpx' => 'application/vnd.intercon.formnet', + 'xsd' => 'application/xml', + 'xsf' => 'application/prs.xsf+xml', + 'xsl' => 'application/xml', + 'xslt' => 'application/xslt+xml', + 'xsm' => 'application/vnd.syncml+xml', + 'xspf' => 'application/xspf+xml', + 'xul' => 'application/vnd.mozilla.xul+xml', + 'xvm' => 'application/xv+xml', + 'xvml' => 'application/xv+xml', + 'xwd' => 'image/x-xwindowdump', + 'xyz' => 'chemical/x-xyz', + 'xz' => 'application/x-xz', + 'yaml' => 'text/yaml', + 'yang' => 'application/yang', + 'yin' => 'application/yin+xml', + 'yml' => 'text/yaml', + 'ymp' => 'text/x-suse-ymp', + 'z' => 'application/x-compress', + 'z1' => 'application/x-zmachine', + 'z2' => 'application/x-zmachine', + 'z3' => 'application/x-zmachine', + 'z4' => 'application/x-zmachine', + 'z5' => 'application/x-zmachine', + 'z6' => 'application/x-zmachine', + 'z7' => 'application/x-zmachine', + 'z8' => 'application/x-zmachine', + 'zaz' => 'application/vnd.zzazz.deck+xml', + 'zip' => 'application/zip', + 'zir' => 'application/vnd.zul', + 'zirz' => 'application/vnd.zul', + 'zmm' => 'application/vnd.handheld-entertainment+xml', + 'zsh' => 'text/x-scriptzsh', + ]; + + /** + * @var array<string, string> + * + * @internal + */ + public const EXTENSIONS_FOR_MIME_TIMES = [ + 'application/andrew-inset' => ['ez'], + 'application/appinstaller' => ['appinstaller'], + 'application/applixware' => ['aw'], + 'application/appx' => ['appx'], + 'application/appxbundle' => ['appxbundle'], + 'application/atom+xml' => ['atom'], + 'application/atomcat+xml' => ['atomcat'], + 'application/atomdeleted+xml' => ['atomdeleted'], + 'application/atomsvc+xml' => ['atomsvc'], + 'application/atsc-dwd+xml' => ['dwd'], + 'application/atsc-held+xml' => ['held'], + 'application/atsc-rsat+xml' => ['rsat'], + 'application/automationml-aml+xml' => ['aml'], + 'application/automationml-amlx+zip' => ['amlx'], + 'application/bdoc' => ['bdoc'], + 'application/calendar+xml' => ['xcs'], + 'application/ccxml+xml' => ['ccxml'], + 'application/cdfx+xml' => ['cdfx'], + 'application/cdmi-capability' => ['cdmia'], + 'application/cdmi-container' => ['cdmic'], + 'application/cdmi-domain' => ['cdmid'], + 'application/cdmi-object' => ['cdmio'], + 'application/cdmi-queue' => ['cdmiq'], + 'application/cpl+xml' => ['cpl'], + 'application/cu-seeme' => ['cu'], + 'application/cwl' => ['cwl'], + 'application/dash+xml' => ['mpd'], + 'application/dash-patch+xml' => ['mpp'], + 'application/davmount+xml' => ['davmount'], + 'application/docbook+xml' => ['dbk'], + 'application/dssc+der' => ['dssc'], + 'application/dssc+xml' => ['xdssc'], + 'application/ecmascript' => ['ecma'], + 'application/emma+xml' => ['emma'], + 'application/emotionml+xml' => ['emotionml'], + 'application/epub+zip' => ['epub'], + 'application/exi' => ['exi'], + 'application/express' => ['exp'], + 'application/fdf' => ['fdf'], + 'application/fdt+xml' => ['fdt'], + 'application/font-tdpfr' => ['pfr'], + 'application/geo+json' => ['geojson'], + 'application/gml+xml' => ['gml'], + 'application/gpx+xml' => ['gpx'], + 'application/gxf' => ['gxf'], + 'application/gzip' => ['gz', 'gzip'], + 'application/hjson' => ['hjson'], + 'application/hyperstudio' => ['stk'], + 'application/inkml+xml' => ['ink', 'inkml'], + 'application/ipfix' => ['ipfix'], + 'application/its+xml' => ['its'], + 'application/java-archive' => ['jar', 'war', 'ear'], + 'application/java-serialized-object' => ['ser'], + 'application/java-vm' => ['class'], + 'application/javascript' => ['js'], + 'application/json' => ['json', 'map'], + 'application/json5' => ['json5'], + 'application/jsonml+json' => ['jsonml'], + 'application/ld+json' => ['jsonld'], + 'application/lgr+xml' => ['lgr'], + 'application/lost+xml' => ['lostxml'], + 'application/mac-binhex40' => ['hqx'], + 'application/mac-compactpro' => ['cpt'], + 'application/mads+xml' => ['mads'], + 'application/manifest+json' => ['webmanifest'], + 'application/marc' => ['mrc'], + 'application/marcxml+xml' => ['mrcx'], + 'application/mathematica' => ['ma', 'nb', 'mb'], + 'application/mathml+xml' => ['mathml'], + 'application/mbox' => ['mbox'], + 'application/media-policy-dataset+xml' => ['mpf'], + 'application/mediaservercontrol+xml' => ['mscml'], + 'application/metalink+xml' => ['metalink'], + 'application/metalink4+xml' => ['meta4'], + 'application/mets+xml' => ['mets'], + 'application/mmt-aei+xml' => ['maei'], + 'application/mmt-usd+xml' => ['musd'], + 'application/mods+xml' => ['mods'], + 'application/mp21' => ['m21', 'mp21'], + 'application/mp4' => ['mp4', 'mpg4', 'mp4s', 'm4p'], + 'application/msix' => ['msix'], + 'application/msixbundle' => ['msixbundle'], + 'application/msword' => ['doc', 'dot', 'word'], + 'application/mxf' => ['mxf'], + 'application/n-quads' => ['nq'], + 'application/n-triples' => ['nt'], + 'application/node' => ['cjs'], + 'application/octet-stream' => ['bin', 'dms', 'lrf', 'mar', 'so', 'dist', 'distz', 'pkg', 'bpk', 'dump', 'elc', 'deploy', 'exe', 'dll', 'deb', 'dmg', 'iso', 'img', 'msi', 'msp', 'msm', 'buffer', 'phar', 'lha', 'lzh', 'class', 'sea', 'dmn', 'bpmn', 'kdb', 'sst', 'csr', 'dst', 'pv', 'pxf'], + 'application/oda' => ['oda'], + 'application/oebps-package+xml' => ['opf'], + 'application/ogg' => ['ogx'], + 'application/omdoc+xml' => ['omdoc'], + 'application/onenote' => ['onetoc', 'onetoc2', 'onetmp', 'onepkg'], + 'application/oxps' => ['oxps'], + 'application/p2p-overlay+xml' => ['relo'], + 'application/patch-ops-error+xml' => ['xer'], + 'application/pdf' => ['pdf', 'ai'], + 'application/pgp-encrypted' => ['pgp'], + 'application/pgp-keys' => ['asc'], + 'application/pgp-signature' => ['sig', 'asc'], + 'application/pics-rules' => ['prf'], + 'application/pkcs10' => ['p10'], + 'application/pkcs7-mime' => ['p7m', 'p7c'], + 'application/pkcs7-signature' => ['p7s'], + 'application/pkcs8' => ['p8'], + 'application/pkix-attr-cert' => ['ac'], + 'application/pkix-cert' => ['cer'], + 'application/pkix-crl' => ['crl'], + 'application/pkix-pkipath' => ['pkipath'], + 'application/pkixcmp' => ['pki'], + 'application/pls+xml' => ['pls'], + 'application/postscript' => ['ai', 'eps', 'ps'], + 'application/provenance+xml' => ['provx'], + 'application/prs.cww' => ['cww'], + 'application/prs.xsf+xml' => ['xsf'], + 'application/pskc+xml' => ['pskcxml'], + 'application/raml+yaml' => ['raml'], + 'application/rdf+xml' => ['rdf', 'owl'], + 'application/reginfo+xml' => ['rif'], + 'application/relax-ng-compact-syntax' => ['rnc'], + 'application/resource-lists+xml' => ['rl'], + 'application/resource-lists-diff+xml' => ['rld'], + 'application/rls-services+xml' => ['rs'], + 'application/route-apd+xml' => ['rapd'], + 'application/route-s-tsid+xml' => ['sls'], + 'application/route-usd+xml' => ['rusd'], + 'application/rpki-ghostbusters' => ['gbr'], + 'application/rpki-manifest' => ['mft'], + 'application/rpki-roa' => ['roa'], + 'application/rsd+xml' => ['rsd'], + 'application/rss+xml' => ['rss'], + 'application/rtf' => ['rtf'], + 'application/sbml+xml' => ['sbml'], + 'application/scvp-cv-request' => ['scq'], + 'application/scvp-cv-response' => ['scs'], + 'application/scvp-vp-request' => ['spq'], + 'application/scvp-vp-response' => ['spp'], + 'application/sdp' => ['sdp'], + 'application/senml+xml' => ['senmlx'], + 'application/sensml+xml' => ['sensmlx'], + 'application/set-payment-initiation' => ['setpay'], + 'application/set-registration-initiation' => ['setreg'], + 'application/shf+xml' => ['shf'], + 'application/sieve' => ['siv', 'sieve'], + 'application/smil+xml' => ['smi', 'smil'], + 'application/sparql-query' => ['rq'], + 'application/sparql-results+xml' => ['srx'], + 'application/sql' => ['sql'], + 'application/srgs' => ['gram'], + 'application/srgs+xml' => ['grxml'], + 'application/sru+xml' => ['sru'], + 'application/ssdl+xml' => ['ssdl'], + 'application/ssml+xml' => ['ssml'], + 'application/swid+xml' => ['swidtag'], + 'application/tei+xml' => ['tei', 'teicorpus'], + 'application/thraud+xml' => ['tfi'], + 'application/timestamped-data' => ['tsd'], + 'application/toml' => ['toml'], + 'application/trig' => ['trig'], + 'application/ttml+xml' => ['ttml'], + 'application/ubjson' => ['ubj'], + 'application/urc-ressheet+xml' => ['rsheet'], + 'application/urc-targetdesc+xml' => ['td'], + 'application/vnd.1000minds.decision-model+xml' => ['1km'], + 'application/vnd.3gpp.pic-bw-large' => ['plb'], + 'application/vnd.3gpp.pic-bw-small' => ['psb'], + 'application/vnd.3gpp.pic-bw-var' => ['pvb'], + 'application/vnd.3gpp2.tcap' => ['tcap'], + 'application/vnd.3m.post-it-notes' => ['pwn'], + 'application/vnd.accpac.simply.aso' => ['aso'], + 'application/vnd.accpac.simply.imp' => ['imp'], + 'application/vnd.acucobol' => ['acu'], + 'application/vnd.acucorp' => ['atc', 'acutc'], + 'application/vnd.adobe.air-application-installer-package+zip' => ['air'], + 'application/vnd.adobe.formscentral.fcdt' => ['fcdt'], + 'application/vnd.adobe.fxp' => ['fxp', 'fxpl'], + 'application/vnd.adobe.xdp+xml' => ['xdp'], + 'application/vnd.adobe.xfdf' => ['xfdf'], + 'application/vnd.age' => ['age'], + 'application/vnd.ahead.space' => ['ahead'], + 'application/vnd.airzip.filesecure.azf' => ['azf'], + 'application/vnd.airzip.filesecure.azs' => ['azs'], + 'application/vnd.amazon.ebook' => ['azw'], + 'application/vnd.americandynamics.acc' => ['acc'], + 'application/vnd.amiga.ami' => ['ami'], + 'application/vnd.android.package-archive' => ['apk'], + 'application/vnd.anser-web-certificate-issue-initiation' => ['cii'], + 'application/vnd.anser-web-funds-transfer-initiation' => ['fti'], + 'application/vnd.antix.game-component' => ['atx'], + 'application/vnd.apple.installer+xml' => ['mpkg'], + 'application/vnd.apple.keynote' => ['key'], + 'application/vnd.apple.mpegurl' => ['m3u8'], + 'application/vnd.apple.numbers' => ['numbers'], + 'application/vnd.apple.pages' => ['pages'], + 'application/vnd.apple.pkpass' => ['pkpass'], + 'application/vnd.aristanetworks.swi' => ['swi'], + 'application/vnd.astraea-software.iota' => ['iota'], + 'application/vnd.audiograph' => ['aep'], + 'application/vnd.balsamiq.bmml+xml' => ['bmml'], + 'application/vnd.blueice.multipass' => ['mpm'], + 'application/vnd.bmi' => ['bmi'], + 'application/vnd.businessobjects' => ['rep'], + 'application/vnd.chemdraw+xml' => ['cdxml'], + 'application/vnd.chipnuts.karaoke-mmd' => ['mmd'], + 'application/vnd.cinderella' => ['cdy'], + 'application/vnd.citationstyles.style+xml' => ['csl'], + 'application/vnd.claymore' => ['cla'], + 'application/vnd.cloanto.rp9' => ['rp9'], + 'application/vnd.clonk.c4group' => ['c4g', 'c4d', 'c4f', 'c4p', 'c4u'], + 'application/vnd.cluetrust.cartomobile-config' => ['c11amc'], + 'application/vnd.cluetrust.cartomobile-config-pkg' => ['c11amz'], + 'application/vnd.commonspace' => ['csp'], + 'application/vnd.contact.cmsg' => ['cdbcmsg'], + 'application/vnd.cosmocaller' => ['cmc'], + 'application/vnd.crick.clicker' => ['clkx'], + 'application/vnd.crick.clicker.keyboard' => ['clkk'], + 'application/vnd.crick.clicker.palette' => ['clkp'], + 'application/vnd.crick.clicker.template' => ['clkt'], + 'application/vnd.crick.clicker.wordbank' => ['clkw'], + 'application/vnd.criticaltools.wbs+xml' => ['wbs'], + 'application/vnd.ctc-posml' => ['pml'], + 'application/vnd.cups-ppd' => ['ppd'], + 'application/vnd.curl.car' => ['car'], + 'application/vnd.curl.pcurl' => ['pcurl'], + 'application/vnd.dart' => ['dart'], + 'application/vnd.data-vision.rdz' => ['rdz'], + 'application/vnd.dbf' => ['dbf'], + 'application/vnd.dece.data' => ['uvf', 'uvvf', 'uvd', 'uvvd'], + 'application/vnd.dece.ttml+xml' => ['uvt', 'uvvt'], + 'application/vnd.dece.unspecified' => ['uvx', 'uvvx'], + 'application/vnd.dece.zip' => ['uvz', 'uvvz'], + 'application/vnd.denovo.fcselayout-link' => ['fe_launch'], + 'application/vnd.dna' => ['dna'], + 'application/vnd.dolby.mlp' => ['mlp'], + 'application/vnd.dpgraph' => ['dpg'], + 'application/vnd.dreamfactory' => ['dfac'], + 'application/vnd.ds-keypoint' => ['kpxx'], + 'application/vnd.dvb.ait' => ['ait'], + 'application/vnd.dvb.service' => ['svc'], + 'application/vnd.dynageo' => ['geo'], + 'application/vnd.ecowin.chart' => ['mag'], + 'application/vnd.enliven' => ['nml'], + 'application/vnd.epson.esf' => ['esf'], + 'application/vnd.epson.msf' => ['msf'], + 'application/vnd.epson.quickanime' => ['qam'], + 'application/vnd.epson.salt' => ['slt'], + 'application/vnd.epson.ssf' => ['ssf'], + 'application/vnd.eszigno3+xml' => ['es3', 'et3'], + 'application/vnd.ezpix-album' => ['ez2'], + 'application/vnd.ezpix-package' => ['ez3'], + 'application/vnd.fdf' => ['fdf'], + 'application/vnd.fdsn.mseed' => ['mseed'], + 'application/vnd.fdsn.seed' => ['seed', 'dataless'], + 'application/vnd.flographit' => ['gph'], + 'application/vnd.fluxtime.clip' => ['ftc'], + 'application/vnd.framemaker' => ['fm', 'frame', 'maker', 'book'], + 'application/vnd.frogans.fnc' => ['fnc'], + 'application/vnd.frogans.ltf' => ['ltf'], + 'application/vnd.fsc.weblaunch' => ['fsc'], + 'application/vnd.fujitsu.oasys' => ['oas'], + 'application/vnd.fujitsu.oasys2' => ['oa2'], + 'application/vnd.fujitsu.oasys3' => ['oa3'], + 'application/vnd.fujitsu.oasysgp' => ['fg5'], + 'application/vnd.fujitsu.oasysprs' => ['bh2'], + 'application/vnd.fujixerox.ddd' => ['ddd'], + 'application/vnd.fujixerox.docuworks' => ['xdw'], + 'application/vnd.fujixerox.docuworks.binder' => ['xbd'], + 'application/vnd.fuzzysheet' => ['fzs'], + 'application/vnd.genomatix.tuxedo' => ['txd'], + 'application/vnd.geogebra.file' => ['ggb'], + 'application/vnd.geogebra.tool' => ['ggt'], + 'application/vnd.geometry-explorer' => ['gex', 'gre'], + 'application/vnd.geonext' => ['gxt'], + 'application/vnd.geoplan' => ['g2w'], + 'application/vnd.geospace' => ['g3w'], + 'application/vnd.gmx' => ['gmx'], + 'application/vnd.google-apps.document' => ['gdoc'], + 'application/vnd.google-apps.presentation' => ['gslides'], + 'application/vnd.google-apps.spreadsheet' => ['gsheet'], + 'application/vnd.google-earth.kml+xml' => ['kml'], + 'application/vnd.google-earth.kmz' => ['kmz'], + 'application/vnd.grafeq' => ['gqf', 'gqs'], + 'application/vnd.groove-account' => ['gac'], + 'application/vnd.groove-help' => ['ghf'], + 'application/vnd.groove-identity-message' => ['gim'], + 'application/vnd.groove-injector' => ['grv'], + 'application/vnd.groove-tool-message' => ['gtm'], + 'application/vnd.groove-tool-template' => ['tpl'], + 'application/vnd.groove-vcard' => ['vcg'], + 'application/vnd.hal+xml' => ['hal'], + 'application/vnd.handheld-entertainment+xml' => ['zmm'], + 'application/vnd.hbci' => ['hbci'], + 'application/vnd.hhe.lesson-player' => ['les'], + 'application/vnd.hp-hpgl' => ['hpgl'], + 'application/vnd.hp-hpid' => ['hpid'], + 'application/vnd.hp-hps' => ['hps'], + 'application/vnd.hp-jlyt' => ['jlt'], + 'application/vnd.hp-pcl' => ['pcl'], + 'application/vnd.hp-pclxl' => ['pclxl'], + 'application/vnd.hydrostatix.sof-data' => ['sfd-hdstx'], + 'application/vnd.ibm.minipay' => ['mpy'], + 'application/vnd.ibm.modcap' => ['afp', 'listafp', 'list3820'], + 'application/vnd.ibm.rights-management' => ['irm'], + 'application/vnd.ibm.secure-container' => ['sc'], + 'application/vnd.iccprofile' => ['icc', 'icm'], + 'application/vnd.igloader' => ['igl'], + 'application/vnd.immervision-ivp' => ['ivp'], + 'application/vnd.immervision-ivu' => ['ivu'], + 'application/vnd.insors.igm' => ['igm'], + 'application/vnd.intercon.formnet' => ['xpw', 'xpx'], + 'application/vnd.intergeo' => ['i2g'], + 'application/vnd.intu.qbo' => ['qbo'], + 'application/vnd.intu.qfx' => ['qfx'], + 'application/vnd.ipunplugged.rcprofile' => ['rcprofile'], + 'application/vnd.irepository.package+xml' => ['irp'], + 'application/vnd.is-xpr' => ['xpr'], + 'application/vnd.isac.fcs' => ['fcs'], + 'application/vnd.jam' => ['jam'], + 'application/vnd.jcp.javame.midlet-rms' => ['rms'], + 'application/vnd.jisp' => ['jisp'], + 'application/vnd.joost.joda-archive' => ['joda'], + 'application/vnd.kahootz' => ['ktz', 'ktr'], + 'application/vnd.kde.karbon' => ['karbon'], + 'application/vnd.kde.kchart' => ['chrt'], + 'application/vnd.kde.kformula' => ['kfo'], + 'application/vnd.kde.kivio' => ['flw'], + 'application/vnd.kde.kontour' => ['kon'], + 'application/vnd.kde.kpresenter' => ['kpr', 'kpt'], + 'application/vnd.kde.kspread' => ['ksp'], + 'application/vnd.kde.kword' => ['kwd', 'kwt'], + 'application/vnd.kenameaapp' => ['htke'], + 'application/vnd.kidspiration' => ['kia'], + 'application/vnd.kinar' => ['kne', 'knp'], + 'application/vnd.koan' => ['skp', 'skd', 'skt', 'skm'], + 'application/vnd.kodak-descriptor' => ['sse'], + 'application/vnd.las.las+xml' => ['lasxml'], + 'application/vnd.llamagraphics.life-balance.desktop' => ['lbd'], + 'application/vnd.llamagraphics.life-balance.exchange+xml' => ['lbe'], + 'application/vnd.lotus-1-2-3' => ['123'], + 'application/vnd.lotus-approach' => ['apr'], + 'application/vnd.lotus-freelance' => ['pre'], + 'application/vnd.lotus-notes' => ['nsf'], + 'application/vnd.lotus-organizer' => ['org'], + 'application/vnd.lotus-screencam' => ['scm'], + 'application/vnd.lotus-wordpro' => ['lwp'], + 'application/vnd.macports.portpkg' => ['portpkg'], + 'application/vnd.mapbox-vector-tile' => ['mvt'], + 'application/vnd.mcd' => ['mcd'], + 'application/vnd.medcalcdata' => ['mc1'], + 'application/vnd.mediastation.cdkey' => ['cdkey'], + 'application/vnd.mfer' => ['mwf'], + 'application/vnd.mfmp' => ['mfm'], + 'application/vnd.micrografx.flo' => ['flo'], + 'application/vnd.micrografx.igx' => ['igx'], + 'application/vnd.mif' => ['mif'], + 'application/vnd.mobius.daf' => ['daf'], + 'application/vnd.mobius.dis' => ['dis'], + 'application/vnd.mobius.mbk' => ['mbk'], + 'application/vnd.mobius.mqy' => ['mqy'], + 'application/vnd.mobius.msl' => ['msl'], + 'application/vnd.mobius.plc' => ['plc'], + 'application/vnd.mobius.txf' => ['txf'], + 'application/vnd.mophun.application' => ['mpn'], + 'application/vnd.mophun.certificate' => ['mpc'], + 'application/vnd.mozilla.xul+xml' => ['xul'], + 'application/vnd.ms-artgalry' => ['cil'], + 'application/vnd.ms-cab-compressed' => ['cab'], + 'application/vnd.ms-excel' => ['xls', 'xlm', 'xla', 'xlc', 'xlt', 'xlw'], + 'application/vnd.ms-excel.addin.macroenabled.12' => ['xlam'], + 'application/vnd.ms-excel.sheet.binary.macroenabled.12' => ['xlsb'], + 'application/vnd.ms-excel.sheet.macroenabled.12' => ['xlsm'], + 'application/vnd.ms-excel.template.macroenabled.12' => ['xltm'], + 'application/vnd.ms-fontobject' => ['eot'], + 'application/vnd.ms-htmlhelp' => ['chm'], + 'application/vnd.ms-ims' => ['ims'], + 'application/vnd.ms-lrm' => ['lrm'], + 'application/vnd.ms-officetheme' => ['thmx'], + 'application/vnd.ms-outlook' => ['msg'], + 'application/vnd.ms-pki.seccat' => ['cat'], + 'application/vnd.ms-pki.stl' => ['stl'], + 'application/vnd.ms-powerpoint' => ['ppt', 'pps', 'pot', 'ppa'], + 'application/vnd.ms-powerpoint.addin.macroenabled.12' => ['ppam'], + 'application/vnd.ms-powerpoint.presentation.macroenabled.12' => ['pptm'], + 'application/vnd.ms-powerpoint.slide.macroenabled.12' => ['sldm'], + 'application/vnd.ms-powerpoint.slideshow.macroenabled.12' => ['ppsm'], + 'application/vnd.ms-powerpoint.template.macroenabled.12' => ['potm'], + 'application/vnd.ms-project' => ['mpp', 'mpt'], + 'application/vnd.ms-word.document.macroenabled.12' => ['docm'], + 'application/vnd.ms-word.template.macroenabled.12' => ['dotm'], + 'application/vnd.ms-works' => ['wps', 'wks', 'wcm', 'wdb'], + 'application/vnd.ms-wpl' => ['wpl'], + 'application/vnd.ms-xpsdocument' => ['xps'], + 'application/vnd.mseq' => ['mseq'], + 'application/vnd.musician' => ['mus'], + 'application/vnd.muvee.style' => ['msty'], + 'application/vnd.mynfc' => ['taglet'], + 'application/vnd.neurolanguage.nlu' => ['nlu'], + 'application/vnd.nitf' => ['ntf', 'nitf'], + 'application/vnd.noblenet-directory' => ['nnd'], + 'application/vnd.noblenet-sealer' => ['nns'], + 'application/vnd.noblenet-web' => ['nnw'], + 'application/vnd.nokia.n-gage.ac+xml' => ['ac'], + 'application/vnd.nokia.n-gage.data' => ['ngdat'], + 'application/vnd.nokia.n-gage.symbian.install' => ['n-gage'], + 'application/vnd.nokia.radio-preset' => ['rpst'], + 'application/vnd.nokia.radio-presets' => ['rpss'], + 'application/vnd.novadigm.edm' => ['edm'], + 'application/vnd.novadigm.edx' => ['edx'], + 'application/vnd.novadigm.ext' => ['ext'], + 'application/vnd.oasis.opendocument.chart' => ['odc'], + 'application/vnd.oasis.opendocument.chart-template' => ['otc'], + 'application/vnd.oasis.opendocument.database' => ['odb'], + 'application/vnd.oasis.opendocument.formula' => ['odf'], + 'application/vnd.oasis.opendocument.formula-template' => ['odft'], + 'application/vnd.oasis.opendocument.graphics' => ['odg'], + 'application/vnd.oasis.opendocument.graphics-template' => ['otg'], + 'application/vnd.oasis.opendocument.image' => ['odi'], + 'application/vnd.oasis.opendocument.image-template' => ['oti'], + 'application/vnd.oasis.opendocument.presentation' => ['odp'], + 'application/vnd.oasis.opendocument.presentation-template' => ['otp'], + 'application/vnd.oasis.opendocument.spreadsheet' => ['ods'], + 'application/vnd.oasis.opendocument.spreadsheet-template' => ['ots'], + 'application/vnd.oasis.opendocument.text' => ['odt'], + 'application/vnd.oasis.opendocument.text-master' => ['odm'], + 'application/vnd.oasis.opendocument.text-template' => ['ott'], + 'application/vnd.oasis.opendocument.text-web' => ['oth'], + 'application/vnd.olpc-sugar' => ['xo'], + 'application/vnd.oma.dd2+xml' => ['dd2'], + 'application/vnd.openblox.game+xml' => ['obgx'], + 'application/vnd.openofficeorg.extension' => ['oxt'], + 'application/vnd.openstreetmap.data+xml' => ['osm'], + 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => ['pptx'], + 'application/vnd.openxmlformats-officedocument.presentationml.slide' => ['sldx'], + 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => ['ppsx'], + 'application/vnd.openxmlformats-officedocument.presentationml.template' => ['potx'], + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => ['xlsx'], + 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' => ['xltx'], + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => ['docx'], + 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => ['dotx'], + 'application/vnd.osgeo.mapguide.package' => ['mgp'], + 'application/vnd.osgi.dp' => ['dp'], + 'application/vnd.osgi.subsystem' => ['esa'], + 'application/vnd.palm' => ['pdb', 'pqa', 'oprc'], + 'application/vnd.pawaafile' => ['paw'], + 'application/vnd.pg.format' => ['str'], + 'application/vnd.pg.osasli' => ['ei6'], + 'application/vnd.picsel' => ['efif'], + 'application/vnd.pmi.widget' => ['wg'], + 'application/vnd.pocketlearn' => ['plf'], + 'application/vnd.powerbuilder6' => ['pbd'], + 'application/vnd.previewsystems.box' => ['box'], + 'application/vnd.proteus.magazine' => ['mgz'], + 'application/vnd.publishare-delta-tree' => ['qps'], + 'application/vnd.pvi.ptid1' => ['ptid'], + 'application/vnd.pwg-xhtml-print+xml' => ['xhtm'], + 'application/vnd.quark.quarkxpress' => ['qxd', 'qxt', 'qwd', 'qwt', 'qxl', 'qxb'], + 'application/vnd.rar' => ['rar'], + 'application/vnd.realvnc.bed' => ['bed'], + 'application/vnd.recordare.musicxml' => ['mxl'], + 'application/vnd.recordare.musicxml+xml' => ['musicxml'], + 'application/vnd.rig.cryptonote' => ['cryptonote'], + 'application/vnd.rim.cod' => ['cod'], + 'application/vnd.rn-realmedia' => ['rm'], + 'application/vnd.rn-realmedia-vbr' => ['rmvb'], + 'application/vnd.route66.link66+xml' => ['link66'], + 'application/vnd.sailingtracker.track' => ['st'], + 'application/vnd.seemail' => ['see'], + 'application/vnd.sema' => ['sema'], + 'application/vnd.semd' => ['semd'], + 'application/vnd.semf' => ['semf'], + 'application/vnd.shana.informed.formdata' => ['ifm'], + 'application/vnd.shana.informed.formtemplate' => ['itp'], + 'application/vnd.shana.informed.interchange' => ['iif'], + 'application/vnd.shana.informed.package' => ['ipk'], + 'application/vnd.simtech-mindmapper' => ['twd', 'twds'], + 'application/vnd.smaf' => ['mmf'], + 'application/vnd.smart.teacher' => ['teacher'], + 'application/vnd.software602.filler.form+xml' => ['fo'], + 'application/vnd.solent.sdkm+xml' => ['sdkm', 'sdkd'], + 'application/vnd.spotfire.dxp' => ['dxp'], + 'application/vnd.spotfire.sfs' => ['sfs'], + 'application/vnd.stardivision.calc' => ['sdc'], + 'application/vnd.stardivision.draw' => ['sda'], + 'application/vnd.stardivision.impress' => ['sdd'], + 'application/vnd.stardivision.math' => ['smf'], + 'application/vnd.stardivision.writer' => ['sdw', 'vor'], + 'application/vnd.stardivision.writer-global' => ['sgl'], + 'application/vnd.stepmania.package' => ['smzip'], + 'application/vnd.stepmania.stepchart' => ['sm'], + 'application/vnd.sun.wadl+xml' => ['wadl'], + 'application/vnd.sun.xml.calc' => ['sxc'], + 'application/vnd.sun.xml.calc.template' => ['stc'], + 'application/vnd.sun.xml.draw' => ['sxd'], + 'application/vnd.sun.xml.draw.template' => ['std'], + 'application/vnd.sun.xml.impress' => ['sxi'], + 'application/vnd.sun.xml.impress.template' => ['sti'], + 'application/vnd.sun.xml.math' => ['sxm'], + 'application/vnd.sun.xml.writer' => ['sxw'], + 'application/vnd.sun.xml.writer.global' => ['sxg'], + 'application/vnd.sun.xml.writer.template' => ['stw'], + 'application/vnd.sus-calendar' => ['sus', 'susp'], + 'application/vnd.svd' => ['svd'], + 'application/vnd.symbian.install' => ['sis', 'sisx'], + 'application/vnd.syncml+xml' => ['xsm'], + 'application/vnd.syncml.dm+wbxml' => ['bdm'], + 'application/vnd.syncml.dm+xml' => ['xdm'], + 'application/vnd.syncml.dmddf+xml' => ['ddf'], + 'application/vnd.tao.intent-module-archive' => ['tao'], + 'application/vnd.tcpdump.pcap' => ['pcap', 'cap', 'dmp'], + 'application/vnd.tmobile-livetv' => ['tmo'], + 'application/vnd.trid.tpt' => ['tpt'], + 'application/vnd.triscape.mxs' => ['mxs'], + 'application/vnd.trueapp' => ['tra'], + 'application/vnd.ufdl' => ['ufd', 'ufdl'], + 'application/vnd.uiq.theme' => ['utz'], + 'application/vnd.umajin' => ['umj'], + 'application/vnd.unity' => ['unityweb'], + 'application/vnd.uoml+xml' => ['uoml', 'uo'], + 'application/vnd.vcx' => ['vcx'], + 'application/vnd.visio' => ['vsd', 'vst', 'vss', 'vsw'], + 'application/vnd.visionary' => ['vis'], + 'application/vnd.vsf' => ['vsf'], + 'application/vnd.wap.wbxml' => ['wbxml'], + 'application/vnd.wap.wmlc' => ['wmlc'], + 'application/vnd.wap.wmlscriptc' => ['wmlsc'], + 'application/vnd.webturbo' => ['wtb'], + 'application/vnd.wolfram.player' => ['nbp'], + 'application/vnd.wordperfect' => ['wpd'], + 'application/vnd.wqd' => ['wqd'], + 'application/vnd.wt.stf' => ['stf'], + 'application/vnd.xara' => ['xar'], + 'application/vnd.xfdl' => ['xfdl'], + 'application/vnd.yamaha.hv-dic' => ['hvd'], + 'application/vnd.yamaha.hv-script' => ['hvs'], + 'application/vnd.yamaha.hv-voice' => ['hvp'], + 'application/vnd.yamaha.openscoreformat' => ['osf'], + 'application/vnd.yamaha.openscoreformat.osfpvg+xml' => ['osfpvg'], + 'application/vnd.yamaha.smaf-audio' => ['saf'], + 'application/vnd.yamaha.smaf-phrase' => ['spf'], + 'application/vnd.yellowriver-custom-menu' => ['cmp'], + 'application/vnd.zul' => ['zir', 'zirz'], + 'application/vnd.zzazz.deck+xml' => ['zaz'], + 'application/voicexml+xml' => ['vxml'], + 'application/wasm' => ['wasm'], + 'application/watcherinfo+xml' => ['wif'], + 'application/widget' => ['wgt'], + 'application/winhlp' => ['hlp'], + 'application/wsdl+xml' => ['wsdl'], + 'application/wspolicy+xml' => ['wspolicy'], + 'application/x-7z-compressed' => ['7z', '7zip'], + 'application/x-abiword' => ['abw'], + 'application/x-ace-compressed' => ['ace'], + 'application/x-apple-diskimage' => ['dmg'], + 'application/x-arj' => ['arj'], + 'application/x-authorware-bin' => ['aab', 'x32', 'u32', 'vox'], + 'application/x-authorware-map' => ['aam'], + 'application/x-authorware-seg' => ['aas'], + 'application/x-bcpio' => ['bcpio'], + 'application/x-bdoc' => ['bdoc'], + 'application/x-bittorrent' => ['torrent'], + 'application/x-blorb' => ['blb', 'blorb'], + 'application/x-bzip' => ['bz'], + 'application/x-bzip2' => ['bz2', 'boz'], + 'application/x-cbr' => ['cbr', 'cba', 'cbt', 'cbz', 'cb7'], + 'application/x-cdlink' => ['vcd'], + 'application/x-cfs-compressed' => ['cfs'], + 'application/x-chat' => ['chat'], + 'application/x-chess-pgn' => ['pgn'], + 'application/x-chrome-extension' => ['crx'], + 'application/x-cocoa' => ['cco'], + 'application/x-conference' => ['nsc'], + 'application/x-cpio' => ['cpio'], + 'application/x-csh' => ['csh'], + 'application/x-debian-package' => ['deb', 'udeb'], + 'application/x-dgc-compressed' => ['dgc'], + 'application/x-director' => ['dir', 'dcr', 'dxr', 'cst', 'cct', 'cxt', 'w3d', 'fgd', 'swa'], + 'application/x-doom' => ['wad'], + 'application/x-dtbncx+xml' => ['ncx'], + 'application/x-dtbook+xml' => ['dtb'], + 'application/x-dtbresource+xml' => ['res'], + 'application/x-dvi' => ['dvi'], + 'application/x-envoy' => ['evy'], + 'application/x-eva' => ['eva'], + 'application/x-font-bdf' => ['bdf'], + 'application/x-font-ghostscript' => ['gsf'], + 'application/x-font-linux-psf' => ['psf'], + 'application/x-font-pcf' => ['pcf'], + 'application/x-font-snf' => ['snf'], + 'application/x-font-type1' => ['pfa', 'pfb', 'pfm', 'afm'], + 'application/x-freearc' => ['arc'], + 'application/x-futuresplash' => ['spl'], + 'application/x-gca-compressed' => ['gca'], + 'application/x-glulx' => ['ulx'], + 'application/x-gnumeric' => ['gnumeric'], + 'application/x-gramps-xml' => ['gramps'], + 'application/x-gtar' => ['gtar'], + 'application/x-hdf' => ['hdf'], + 'application/x-httpd-php' => ['php', 'php4', 'php3', 'phtml'], + 'application/x-install-instructions' => ['install'], + 'application/x-iso9660-image' => ['iso'], + 'application/x-iwork-keynote-sffkey' => ['key'], + 'application/x-iwork-numbers-sffnumbers' => ['numbers'], + 'application/x-iwork-pages-sffpages' => ['pages'], + 'application/x-java-archive-diff' => ['jardiff'], + 'application/x-java-jnlp-file' => ['jnlp'], + 'application/x-keepass2' => ['kdbx'], + 'application/x-latex' => ['latex'], + 'application/x-lua-bytecode' => ['luac'], + 'application/x-lzh-compressed' => ['lzh', 'lha'], + 'application/x-makeself' => ['run'], + 'application/x-mie' => ['mie'], + 'application/x-mobipocket-ebook' => ['prc', 'mobi'], + 'application/x-ms-application' => ['application'], + 'application/x-ms-shortcut' => ['lnk'], + 'application/x-ms-wmd' => ['wmd'], + 'application/x-ms-wmz' => ['wmz'], + 'application/x-ms-xbap' => ['xbap'], + 'application/x-msaccess' => ['mdb'], + 'application/x-msbinder' => ['obd'], + 'application/x-mscardfile' => ['crd'], + 'application/x-msclip' => ['clp'], + 'application/x-msdos-program' => ['exe'], + 'application/x-msdownload' => ['exe', 'dll', 'com', 'bat', 'msi'], + 'application/x-msmediaview' => ['mvb', 'm13', 'm14'], + 'application/x-msmetafile' => ['wmf', 'wmz', 'emf', 'emz'], + 'application/x-msmoney' => ['mny'], + 'application/x-mspublisher' => ['pub'], + 'application/x-msschedule' => ['scd'], + 'application/x-msterminal' => ['trm'], + 'application/x-mswrite' => ['wri'], + 'application/x-netcdf' => ['nc', 'cdf'], + 'application/x-ns-proxy-autoconfig' => ['pac'], + 'application/x-nzb' => ['nzb'], + 'application/x-perl' => ['pl', 'pm'], + 'application/x-pilot' => ['prc', 'pdb'], + 'application/x-pkcs12' => ['p12', 'pfx'], + 'application/x-pkcs7-certificates' => ['p7b', 'spc'], + 'application/x-pkcs7-certreqresp' => ['p7r'], + 'application/x-rar-compressed' => ['rar'], + 'application/x-redhat-package-manager' => ['rpm'], + 'application/x-research-info-systems' => ['ris'], + 'application/x-sea' => ['sea'], + 'application/x-sh' => ['sh'], + 'application/x-shar' => ['shar'], + 'application/x-shockwave-flash' => ['swf'], + 'application/x-silverlight-app' => ['xap'], + 'application/x-sql' => ['sql'], + 'application/x-stuffit' => ['sit'], + 'application/x-stuffitx' => ['sitx'], + 'application/x-subrip' => ['srt'], + 'application/x-sv4cpio' => ['sv4cpio'], + 'application/x-sv4crc' => ['sv4crc'], + 'application/x-t3vm-image' => ['t3'], + 'application/x-tads' => ['gam'], + 'application/x-tar' => ['tar', 'tgz'], + 'application/x-tcl' => ['tcl', 'tk'], + 'application/x-tex' => ['tex'], + 'application/x-tex-tfm' => ['tfm'], + 'application/x-texinfo' => ['texinfo', 'texi'], + 'application/x-tgif' => ['obj'], + 'application/x-ustar' => ['ustar'], + 'application/x-virtualbox-hdd' => ['hdd'], + 'application/x-virtualbox-ova' => ['ova'], + 'application/x-virtualbox-ovf' => ['ovf'], + 'application/x-virtualbox-vbox' => ['vbox'], + 'application/x-virtualbox-vbox-extpack' => ['vbox-extpack'], + 'application/x-virtualbox-vdi' => ['vdi'], + 'application/x-virtualbox-vhd' => ['vhd'], + 'application/x-virtualbox-vmdk' => ['vmdk'], + 'application/x-wais-source' => ['src'], + 'application/x-web-app-manifest+json' => ['webapp'], + 'application/x-x509-ca-cert' => ['der', 'crt', 'pem'], + 'application/x-xfig' => ['fig'], + 'application/x-xliff+xml' => ['xlf'], + 'application/x-xpinstall' => ['xpi'], + 'application/x-xz' => ['xz'], + 'application/x-zmachine' => ['z1', 'z2', 'z3', 'z4', 'z5', 'z6', 'z7', 'z8'], + 'application/xaml+xml' => ['xaml'], + 'application/xcap-att+xml' => ['xav'], + 'application/xcap-caps+xml' => ['xca'], + 'application/xcap-diff+xml' => ['xdf'], + 'application/xcap-el+xml' => ['xel'], + 'application/xcap-ns+xml' => ['xns'], + 'application/xenc+xml' => ['xenc'], + 'application/xfdf' => ['xfdf'], + 'application/xhtml+xml' => ['xhtml', 'xht'], + 'application/xliff+xml' => ['xlf'], + 'application/xml' => ['xml', 'xsl', 'xsd', 'rng'], + 'application/xml-dtd' => ['dtd'], + 'application/xop+xml' => ['xop'], + 'application/xproc+xml' => ['xpl'], + 'application/xslt+xml' => ['xsl', 'xslt'], + 'application/xspf+xml' => ['xspf'], + 'application/xv+xml' => ['mxml', 'xhvml', 'xvml', 'xvm'], + 'application/yang' => ['yang'], + 'application/yin+xml' => ['yin'], + 'application/zip' => ['zip'], + 'audio/3gpp' => ['3gpp'], + 'audio/aac' => ['adts', 'aac'], + 'audio/adpcm' => ['adp'], + 'audio/amr' => ['amr'], + 'audio/basic' => ['au', 'snd'], + 'audio/midi' => ['mid', 'midi', 'kar', 'rmi'], + 'audio/mobile-xmf' => ['mxmf'], + 'audio/mp3' => ['mp3'], + 'audio/mp4' => ['m4a', 'mp4a'], + 'audio/mpeg' => ['mpga', 'mp2', 'mp2a', 'mp3', 'm2a', 'm3a'], + 'audio/ogg' => ['oga', 'ogg', 'spx', 'opus'], + 'audio/s3m' => ['s3m'], + 'audio/silk' => ['sil'], + 'audio/vnd.dece.audio' => ['uva', 'uvva'], + 'audio/vnd.digital-winds' => ['eol'], + 'audio/vnd.dra' => ['dra'], + 'audio/vnd.dts' => ['dts'], + 'audio/vnd.dts.hd' => ['dtshd'], + 'audio/vnd.lucent.voice' => ['lvp'], + 'audio/vnd.ms-playready.media.pya' => ['pya'], + 'audio/vnd.nuera.ecelp4800' => ['ecelp4800'], + 'audio/vnd.nuera.ecelp7470' => ['ecelp7470'], + 'audio/vnd.nuera.ecelp9600' => ['ecelp9600'], + 'audio/vnd.rip' => ['rip'], + 'audio/wav' => ['wav'], + 'audio/wave' => ['wav'], + 'audio/webm' => ['weba'], + 'audio/x-aac' => ['aac'], + 'audio/x-aiff' => ['aif', 'aiff', 'aifc'], + 'audio/x-caf' => ['caf'], + 'audio/x-flac' => ['flac'], + 'audio/x-m4a' => ['m4a'], + 'audio/x-matroska' => ['mka'], + 'audio/x-mpegurl' => ['m3u'], + 'audio/x-ms-wax' => ['wax'], + 'audio/x-ms-wma' => ['wma'], + 'audio/x-pn-realaudio' => ['ram', 'ra', 'rm'], + 'audio/x-pn-realaudio-plugin' => ['rmp', 'rpm'], + 'audio/x-realaudio' => ['ra'], + 'audio/x-wav' => ['wav'], + 'audio/xm' => ['xm'], + 'chemical/x-cdx' => ['cdx'], + 'chemical/x-cif' => ['cif'], + 'chemical/x-cmdf' => ['cmdf'], + 'chemical/x-cml' => ['cml'], + 'chemical/x-csml' => ['csml'], + 'chemical/x-xyz' => ['xyz'], + 'font/collection' => ['ttc'], + 'font/otf' => ['otf'], + 'font/ttf' => ['ttf'], + 'font/woff' => ['woff'], + 'font/woff2' => ['woff2'], + 'image/aces' => ['exr'], + 'image/apng' => ['apng'], + 'image/avci' => ['avci'], + 'image/avcs' => ['avcs'], + 'image/avif' => ['avif'], + 'image/bmp' => ['bmp', 'dib'], + 'image/cgm' => ['cgm'], + 'image/dicom-rle' => ['drle'], + 'image/dpx' => ['dpx'], + 'image/emf' => ['emf'], + 'image/fits' => ['fits'], + 'image/g3fax' => ['g3'], + 'image/gif' => ['gif'], + 'image/heic' => ['heic'], + 'image/heic-sequence' => ['heics'], + 'image/heif' => ['heif'], + 'image/heif-sequence' => ['heifs'], + 'image/hej2k' => ['hej2'], + 'image/hsj2' => ['hsj2'], + 'image/ief' => ['ief'], + 'image/jls' => ['jls'], + 'image/jp2' => ['jp2', 'jpg2'], + 'image/jpeg' => ['jpeg', 'jpg', 'jpe'], + 'image/jph' => ['jph'], + 'image/jphc' => ['jhc'], + 'image/jpm' => ['jpm', 'jpgm'], + 'image/jpx' => ['jpx', 'jpf'], + 'image/jxr' => ['jxr'], + 'image/jxra' => ['jxra'], + 'image/jxrs' => ['jxrs'], + 'image/jxs' => ['jxs'], + 'image/jxsc' => ['jxsc'], + 'image/jxsi' => ['jxsi'], + 'image/jxss' => ['jxss'], + 'image/ktx' => ['ktx'], + 'image/ktx2' => ['ktx2'], + 'image/png' => ['png'], + 'image/prs.btif' => ['btif', 'btf'], + 'image/prs.pti' => ['pti'], + 'image/sgi' => ['sgi'], + 'image/svg+xml' => ['svg', 'svgz'], + 'image/t38' => ['t38'], + 'image/tiff' => ['tif', 'tiff'], + 'image/tiff-fx' => ['tfx'], + 'image/vnd.adobe.photoshop' => ['psd'], + 'image/vnd.airzip.accelerator.azv' => ['azv'], + 'image/vnd.dece.graphic' => ['uvi', 'uvvi', 'uvg', 'uvvg'], + 'image/vnd.djvu' => ['djvu', 'djv'], + 'image/vnd.dvb.subtitle' => ['sub'], + 'image/vnd.dwg' => ['dwg'], + 'image/vnd.dxf' => ['dxf'], + 'image/vnd.fastbidsheet' => ['fbs'], + 'image/vnd.fpx' => ['fpx'], + 'image/vnd.fst' => ['fst'], + 'image/vnd.fujixerox.edmics-mmr' => ['mmr'], + 'image/vnd.fujixerox.edmics-rlc' => ['rlc'], + 'image/vnd.microsoft.icon' => ['ico'], + 'image/vnd.ms-dds' => ['dds'], + 'image/vnd.ms-modi' => ['mdi'], + 'image/vnd.ms-photo' => ['wdp'], + 'image/vnd.net-fpx' => ['npx'], + 'image/vnd.pco.b16' => ['b16'], + 'image/vnd.tencent.tap' => ['tap'], + 'image/vnd.valve.source.texture' => ['vtf'], + 'image/vnd.wap.wbmp' => ['wbmp'], + 'image/vnd.xiff' => ['xif'], + 'image/vnd.zbrush.pcx' => ['pcx'], + 'image/webp' => ['webp'], + 'image/wmf' => ['wmf'], + 'image/x-3ds' => ['3ds'], + 'image/x-cmu-raster' => ['ras'], + 'image/x-cmx' => ['cmx'], + 'image/x-freehand' => ['fh', 'fhc', 'fh4', 'fh5', 'fh7'], + 'image/x-icon' => ['ico'], + 'image/x-jng' => ['jng'], + 'image/x-mrsid-image' => ['sid'], + 'image/x-ms-bmp' => ['bmp'], + 'image/x-pcx' => ['pcx'], + 'image/x-pict' => ['pic', 'pct'], + 'image/x-portable-anymap' => ['pnm'], + 'image/x-portable-bitmap' => ['pbm'], + 'image/x-portable-graymap' => ['pgm'], + 'image/x-portable-pixmap' => ['ppm'], + 'image/x-rgb' => ['rgb'], + 'image/x-tga' => ['tga'], + 'image/x-xbitmap' => ['xbm'], + 'image/x-xpixmap' => ['xpm'], + 'image/x-xwindowdump' => ['xwd'], + 'message/disposition-notification' => ['disposition-notification'], + 'message/global' => ['u8msg'], + 'message/global-delivery-status' => ['u8dsn'], + 'message/global-disposition-notification' => ['u8mdn'], + 'message/global-headers' => ['u8hdr'], + 'message/rfc822' => ['eml', 'mime'], + 'message/vnd.wfa.wsc' => ['wsc'], + 'model/3mf' => ['3mf'], + 'model/gltf+json' => ['gltf'], + 'model/gltf-binary' => ['glb'], + 'model/iges' => ['igs', 'iges'], + 'model/jt' => ['jt'], + 'model/mesh' => ['msh', 'mesh', 'silo'], + 'model/mtl' => ['mtl'], + 'model/obj' => ['obj'], + 'model/prc' => ['prc'], + 'model/step+xml' => ['stpx'], + 'model/step+zip' => ['stpz'], + 'model/step-xml+zip' => ['stpxz'], + 'model/stl' => ['stl'], + 'model/u3d' => ['u3d'], + 'model/vnd.cld' => ['cld'], + 'model/vnd.collada+xml' => ['dae'], + 'model/vnd.dwf' => ['dwf'], + 'model/vnd.gdl' => ['gdl'], + 'model/vnd.gtw' => ['gtw'], + 'model/vnd.mts' => ['mts'], + 'model/vnd.opengex' => ['ogex'], + 'model/vnd.parasolid.transmit.binary' => ['x_b'], + 'model/vnd.parasolid.transmit.text' => ['x_t'], + 'model/vnd.pytha.pyox' => ['pyo', 'pyox'], + 'model/vnd.sap.vds' => ['vds'], + 'model/vnd.usda' => ['usda'], + 'model/vnd.usdz+zip' => ['usdz'], + 'model/vnd.valve.source.compiled-map' => ['bsp'], + 'model/vnd.vtu' => ['vtu'], + 'model/vrml' => ['wrl', 'vrml'], + 'model/x3d+binary' => ['x3db', 'x3dbz'], + 'model/x3d+fastinfoset' => ['x3db'], + 'model/x3d+vrml' => ['x3dv', 'x3dvz'], + 'model/x3d+xml' => ['x3d', 'x3dz'], + 'model/x3d-vrml' => ['x3dv'], + 'text/cache-manifest' => ['appcache', 'manifest'], + 'text/calendar' => ['ics', 'ifb'], + 'text/coffeescript' => ['coffee', 'litcoffee'], + 'text/css' => ['css'], + 'text/csv' => ['csv'], + 'text/html' => ['html', 'htm', 'shtml'], + 'text/jade' => ['jade'], + 'text/javascript' => ['js', 'mjs'], + 'text/jsx' => ['jsx'], + 'text/less' => ['less'], + 'text/markdown' => ['md', 'markdown'], + 'text/mathml' => ['mml'], + 'text/mdx' => ['mdx'], + 'text/n3' => ['n3'], + 'text/plain' => ['txt', 'text', 'conf', 'def', 'list', 'log', 'in', 'ini', 'm3u'], + 'text/prs.lines.tag' => ['dsc'], + 'text/richtext' => ['rtx'], + 'text/rtf' => ['rtf'], + 'text/sgml' => ['sgml', 'sgm'], + 'text/shex' => ['shex'], + 'text/slim' => ['slim', 'slm'], + 'text/spdx' => ['spdx'], + 'text/stylus' => ['stylus', 'styl'], + 'text/tab-separated-values' => ['tsv'], + 'text/troff' => ['t', 'tr', 'roff', 'man', 'me', 'ms'], + 'text/turtle' => ['ttl'], + 'text/uri-list' => ['uri', 'uris', 'urls'], + 'text/vcard' => ['vcard'], + 'text/vnd.curl' => ['curl'], + 'text/vnd.curl.dcurl' => ['dcurl'], + 'text/vnd.curl.mcurl' => ['mcurl'], + 'text/vnd.curl.scurl' => ['scurl'], + 'text/vnd.dvb.subtitle' => ['sub'], + 'text/vnd.familysearch.gedcom' => ['ged'], + 'text/vnd.fly' => ['fly'], + 'text/vnd.fmi.flexstor' => ['flx'], + 'text/vnd.graphviz' => ['gv'], + 'text/vnd.in3d.3dml' => ['3dml'], + 'text/vnd.in3d.spot' => ['spot'], + 'text/vnd.sun.j2me.app-descriptor' => ['jad'], + 'text/vnd.wap.wml' => ['wml'], + 'text/vnd.wap.wmlscript' => ['wmls'], + 'text/vtt' => ['vtt'], + 'text/wgsl' => ['wgsl'], + 'text/x-asm' => ['s', 'asm'], + 'text/x-c' => ['c', 'cc', 'cxx', 'cpp', 'h', 'hh', 'dic'], + 'text/x-component' => ['htc'], + 'text/x-fortran' => ['f', 'for', 'f77', 'f90'], + 'text/x-handlebars-template' => ['hbs'], + 'text/x-java-source' => ['java'], + 'text/x-lua' => ['lua'], + 'text/x-markdown' => ['mkd'], + 'text/x-nfo' => ['nfo'], + 'text/x-opml' => ['opml'], + 'text/x-org' => ['org'], + 'text/x-pascal' => ['p', 'pas'], + 'text/x-processing' => ['pde'], + 'text/x-sass' => ['sass'], + 'text/x-scss' => ['scss'], + 'text/x-setext' => ['etx'], + 'text/x-sfv' => ['sfv'], + 'text/x-suse-ymp' => ['ymp'], + 'text/x-uuencode' => ['uu'], + 'text/x-vcalendar' => ['vcs'], + 'text/x-vcard' => ['vcf'], + 'text/xml' => ['xml'], + 'text/yaml' => ['yaml', 'yml'], + 'video/3gpp' => ['3gp', '3gpp'], + 'video/3gpp2' => ['3g2'], + 'video/h261' => ['h261'], + 'video/h263' => ['h263'], + 'video/h264' => ['h264'], + 'video/iso.segment' => ['m4s'], + 'video/jpeg' => ['jpgv'], + 'video/jpm' => ['jpm', 'jpgm'], + 'video/mj2' => ['mj2', 'mjp2'], + 'video/mp2t' => ['ts'], + 'video/mp4' => ['mp4', 'mp4v', 'mpg4', 'f4v'], + 'video/mpeg' => ['mpeg', 'mpg', 'mpe', 'm1v', 'm2v'], + 'video/ogg' => ['ogv'], + 'video/quicktime' => ['qt', 'mov'], + 'video/vnd.dece.hd' => ['uvh', 'uvvh'], + 'video/vnd.dece.mobile' => ['uvm', 'uvvm'], + 'video/vnd.dece.pd' => ['uvp', 'uvvp'], + 'video/vnd.dece.sd' => ['uvs', 'uvvs'], + 'video/vnd.dece.video' => ['uvv', 'uvvv'], + 'video/vnd.dvb.file' => ['dvb'], + 'video/vnd.fvt' => ['fvt'], + 'video/vnd.mpegurl' => ['mxu', 'm4u'], + 'video/vnd.ms-playready.media.pyv' => ['pyv'], + 'video/vnd.uvvu.mp4' => ['uvu', 'uvvu'], + 'video/vnd.vivo' => ['viv'], + 'video/webm' => ['webm'], + 'video/x-f4v' => ['f4v'], + 'video/x-fli' => ['fli'], + 'video/x-flv' => ['flv'], + 'video/x-m4v' => ['m4v'], + 'video/x-matroska' => ['mkv', 'mk3d', 'mks'], + 'video/x-mng' => ['mng'], + 'video/x-ms-asf' => ['asf', 'asx'], + 'video/x-ms-vob' => ['vob'], + 'video/x-ms-wm' => ['wm'], + 'video/x-ms-wmv' => ['wmv'], + 'video/x-ms-wmx' => ['wmx'], + 'video/x-ms-wvx' => ['wvx'], + 'video/x-msvideo' => ['avi'], + 'video/x-sgi-movie' => ['movie'], + 'video/x-smv' => ['smv'], + 'x-conference/x-cooltalk' => ['ice'], + 'application/x-photoshop' => ['psd'], + 'application/smil' => ['smi', 'smil'], + 'application/powerpoint' => ['ppt'], + 'application/vnd.ms-powerpoint.addin.macroEnabled.12' => ['ppam'], + 'application/vnd.ms-powerpoint.presentation.macroEnabled.12' => ['pptm', 'potm'], + 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12' => ['ppsm'], + 'application/wbxml' => ['wbxml'], + 'application/wmlc' => ['wmlc'], + 'application/x-httpd-php-source' => ['phps'], + 'application/x-compress' => ['z'], + 'application/x-rar' => ['rar'], + 'video/vnd.rn-realvideo' => ['rv'], + 'application/vnd.ms-word.template.macroEnabled.12' => ['docm', 'dotm'], + 'application/vnd.ms-excel.sheet.macroEnabled.12' => ['xlsm'], + 'application/vnd.ms-excel.template.macroEnabled.12' => ['xltm'], + 'application/vnd.ms-excel.addin.macroEnabled.12' => ['xlam'], + 'application/vnd.ms-excel.sheet.binary.macroEnabled.12' => ['xlsb'], + 'application/excel' => ['xl'], + 'application/x-x509-user-cert' => ['pem'], + 'application/x-pkcs10' => ['p10'], + 'application/x-pkcs7-signature' => ['p7a'], + 'application/pgp' => ['pgp'], + 'application/gpg-keys' => ['gpg'], + 'application/x-pkcs7' => ['rsa'], + 'video/3gp' => ['3gp'], + 'audio/acc' => ['aac'], + 'application/vnd.mpegurl' => ['m4u'], + 'application/videolan' => ['vlc'], + 'audio/x-au' => ['au'], + 'audio/ac3' => ['ac3'], + 'text/x-scriptzsh' => ['zsh'], + 'application/cdr' => ['cdr'], + 'application/STEP' => ['step', 'stp'], + 'application/x-ndjson' => ['ndjson'], + 'application/braille' => ['brf'], + ]; + + public function lookupMimeType(string $extension): ?string + { + return self::MIME_TYPES_FOR_EXTENSIONS[$extension] ?? null; + } + + public function lookupExtension(string $mimetype): ?string + { + return self::EXTENSIONS_FOR_MIME_TIMES[$mimetype][0] ?? null; + } + + /** + * @return string[] + */ + public function lookupAllExtensions(string $mimetype): array + { + return self::EXTENSIONS_FOR_MIME_TIMES[$mimetype] ?? []; + } +} diff --git a/vendor/league/mime-type-detection/src/MimeTypeDetector.php b/vendor/league/mime-type-detection/src/MimeTypeDetector.php new file mode 100644 index 00000000..5d799d2a --- /dev/null +++ b/vendor/league/mime-type-detection/src/MimeTypeDetector.php @@ -0,0 +1,19 @@ +<?php + +declare(strict_types=1); + +namespace League\MimeTypeDetection; + +interface MimeTypeDetector +{ + /** + * @param string|resource $contents + */ + public function detectMimeType(string $path, $contents): ?string; + + public function detectMimeTypeFromBuffer(string $contents): ?string; + + public function detectMimeTypeFromPath(string $path): ?string; + + public function detectMimeTypeFromFile(string $path): ?string; +} diff --git a/vendor/league/mime-type-detection/src/OverridingExtensionToMimeTypeMap.php b/vendor/league/mime-type-detection/src/OverridingExtensionToMimeTypeMap.php new file mode 100644 index 00000000..0c71e4d5 --- /dev/null +++ b/vendor/league/mime-type-detection/src/OverridingExtensionToMimeTypeMap.php @@ -0,0 +1,30 @@ +<?php + +namespace League\MimeTypeDetection; + +class OverridingExtensionToMimeTypeMap implements ExtensionToMimeTypeMap +{ + /** + * @var ExtensionToMimeTypeMap + */ + private $innerMap; + + /** + * @var string[] + */ + private $overrides; + + /** + * @param array<string, string> $overrides + */ + public function __construct(ExtensionToMimeTypeMap $innerMap, array $overrides) + { + $this->innerMap = $innerMap; + $this->overrides = $overrides; + } + + public function lookupMimeType(string $extension): ?string + { + return $this->overrides[$extension] ?? $this->innerMap->lookupMimeType($extension); + } +} diff --git a/vendor/mantle-framework/config/LICENSE b/vendor/mantle-framework/config/LICENSE new file mode 100644 index 00000000..d159169d --- /dev/null +++ b/vendor/mantle-framework/config/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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. + + <signature of Ty Coon>, 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/vendor/mantle-framework/config/autoload.php b/vendor/mantle-framework/config/autoload.php new file mode 100644 index 00000000..63f03ce2 --- /dev/null +++ b/vendor/mantle-framework/config/autoload.php @@ -0,0 +1,30 @@ +<?php +/** + * Mantle Config Application Helpers + * + * Intentionally not Namespaced to allow for root-level access to + * framework methods. + * + * @phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound, Squiz.Commenting.FunctionComment + * + * @package Mantle + */ + +declare( strict_types=1 ); + +if ( ! function_exists( 'config' ) ) { + /** + * Get a configuration value from the Configuration Repository. + * + * @param string $key Key to retrieve. + * @param mixed $default Default configuration value. + * @return mixed + */ + function config( string $key = null, $default = null ) { + if ( is_null( $key ) ) { + return app( 'config' ); + } + + return app( 'config' )->get( $key, $default ); + } +} diff --git a/vendor/mantle-framework/config/class-repository.php b/vendor/mantle-framework/config/class-repository.php new file mode 100644 index 00000000..72d5db85 --- /dev/null +++ b/vendor/mantle-framework/config/class-repository.php @@ -0,0 +1,113 @@ +<?php +/** + * Repository class file. + * + * @package Mantle + */ + +namespace Mantle\Config; + +use ArrayAccess; +use Mantle\Contracts\Config\Repository as Config_Contract; +use Mantle\Support\Arr; + +/** + * Configuration Repository + * + * Used to store configuration items for the application. + */ +class Repository implements ArrayAccess, Config_Contract { + /** + * Configuration Items + * + * @var array + */ + protected $items = []; + + /** + * Constructor. + * + * @param array $items Configuration items for the repository. + */ + public function __construct( array $items = [] ) { + $this->items = $items; + } + + /** + * Check if a configuration value exists. + * + * @param string $key Key to get, period-delimited. + */ + public function has( string $key ): bool { + return Arr::has( $this->items, $key ); + } + + /** + * Retrieve a configuration value. + * + * @param string $key Configuration key to get, period-delimited. + * @param mixed $default Default value, optional. + * @return mixed + */ + public function get( string $key, $default = null ) { + return Arr::get( $this->items, $key, $default ); + } + + /** + * Set a configuration value. + * + * @param array|string $key Key(s) to set. + * @param mixed $value Value to set. + */ + public function set( $key, $value ): void { + $keys = is_array( $key ) ? $key : [ $key => $value ]; + + foreach ( $keys as $key => $value ) { + Arr::set( $this->items, $key, $value ); + } + } + + /** + * Get all configuration values. + */ + public function all(): array { + return $this->items; + } + + /** + * Check if a offset exists. + * + * @param mixed $offset Offset to retrieve. + */ + public function offsetExists( mixed $offset ): bool { + return $this->has( $offset ); + } + + /** + * Get an offset. + * + * @param mixed $offset Offset to retrieve. + */ + public function offsetGet( mixed $offset ): mixed { + return $this->get( $offset ); + } + + /** + * Set an offset. + * + * @param mixed $offset Offset to set. + * @param mixed $value Value to set. + */ + public function offsetSet( mixed $offset, mixed $value ): void { + $this->set( $offset, $value ); + } + + /** + * Unset an offset. + * + * @param mixed $offset Offset to unset. + */ + public function offsetUnset( mixed $offset ): void { + $this->set( $offset, null ); + } +} diff --git a/vendor/mantle-framework/config/composer.json b/vendor/mantle-framework/config/composer.json new file mode 100644 index 00000000..1a79ec36 --- /dev/null +++ b/vendor/mantle-framework/config/composer.json @@ -0,0 +1,34 @@ +{ + "name": "mantle-framework/config", + "description": "The Mantle Framework Config Package", + "type": "library", + "require": { + "php": "^8.1", + "alleyinteractive/composer-wordpress-autoloader": "^1.0", + "mantle-framework/contracts": "^1.0", + "mantle-framework/support": "^1.0" + }, + "extra": { + "wordpress-autoloader": { + "autoload": { + "Mantle\\Config": "./" + } + } + }, + "license": "GPL-2.0-or-later", + "authors": [ + { + "name": "Alley", + "email": "mantle@alley.com" + } + ], + "autoload": { + "files": [ + "autoload.php" + ] + }, + "minimum-stability": "dev", + "config": { + "sort-packages": true + } +} diff --git a/vendor/mantle-framework/container/LICENSE b/vendor/mantle-framework/container/LICENSE new file mode 100644 index 00000000..d159169d --- /dev/null +++ b/vendor/mantle-framework/container/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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. + + <signature of Ty Coon>, 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/vendor/mantle-framework/container/class-binding-resolution-exception.php b/vendor/mantle-framework/container/class-binding-resolution-exception.php new file mode 100644 index 00000000..9ea5849f --- /dev/null +++ b/vendor/mantle-framework/container/class-binding-resolution-exception.php @@ -0,0 +1,16 @@ +<?php +/** + * Binding_Resolution_Exception class file. + * + * @package Mantle + */ + +namespace Mantle\Container; + +use Exception; +use Psr\Container\ContainerExceptionInterface; + +/** + * Binding Resolution Error + */ +class Binding_Resolution_Exception extends Exception implements ContainerExceptionInterface { } diff --git a/vendor/mantle-framework/container/class-bound-method.php b/vendor/mantle-framework/container/class-bound-method.php new file mode 100644 index 00000000..435ffda6 --- /dev/null +++ b/vendor/mantle-framework/container/class-bound-method.php @@ -0,0 +1,198 @@ +<?php +/** + * Bound_Method class file. + * + * @package Mantle + */ + +namespace Mantle\Container; + +use Closure; +use InvalidArgumentException; +use Mantle\Support\Reflector; +use ReflectionFunction; +use ReflectionMethod; + +/** + * Container Bound Method + */ +class Bound_Method { + + /** + * Call the given Closure / class@method and inject its dependencies. + * + * @param Container $container Container instance. + * @param callable|string $callback Callback. + * @param array $parameters Parameters. + * @param string|null $default_method Default method. + * @return mixed + * + * @throws \ReflectionException Throw on invalid arguments. + * @throws \InvalidArgumentException Throw on invalid arguments. + */ + public static function call( $container, $callback, array $parameters = [], $default_method = null ) { + if ( static::is_callable_with_at_sign( $callback ) || $default_method ) { + return static::call_class( $container, $callback, $parameters, $default_method ); + } + + return static::call_bound_method( + $container, + $callback, + fn () => $callback( ...array_values( static::get_method_dependencies( $container, $callback, $parameters ) ) ) + ); + } + + /** + * Call a string reference to a class using Class@method syntax. + * + * @param Container $container Container instance. + * @param string $target Target to call. + * @param array $parameters Parameters for the class. + * @param string|null $default_method Default method to call. + * @return mixed + * + * @throws \InvalidArgumentException Throw on invalid arguments. + */ + protected static function call_class( $container, $target, array $parameters = [], $default_method = null ) { + $segments = explode( '@', $target ); + + // We will assume an @ sign is used to delimit the class name from the method + // name. We will split on this @ sign and then build a callable array that + // we can pass right back into the "call" method for dependency binding. + $method = count( $segments ) === 2 + ? $segments[1] : $default_method; + + if ( is_null( $method ) ) { + throw new \InvalidArgumentException( 'Method not provided.' ); + } + + return static::call( + $container, + [ $container->make( $segments[0] ), $method ], + $parameters + ); + } + + /** + * Call a method that has been bound to the container. + * + * @param Container $container Container instance. + * @param callable $callback Callback function. + * @param mixed $default Default value. + * @return mixed + */ + protected static function call_bound_method( $container, $callback, $default ) { + if ( ! is_array( $callback ) ) { + return Util::unwrap_if_closure( $default ); + } + + // Here we need to turn the array callable into a Class@method string we can use to + // examine the container and see if there are any method bindings for this given + // method. If there are, we can call this method binding callback immediately. + $method = static::normalize_method( $callback ); + + if ( $container->has_method_binding( $method ) ) { + return $container->call_method_binding( $method, $callback[0] ); + } + + return Util::unwrap_if_closure( $default ); + } + + /** + * Normalize the given callback into a Class@method string. + * + * @param callable $callback Callback function. + * @return string + */ + protected static function normalize_method( $callback ) { + $class = is_string( $callback[0] ) ? $callback[0] : $callback[0]::class; + return "{$class}@{$callback[1]}"; + } + + /** + * Get all dependencies for a given method. + * + * @param Container $container Container instance. + * @param callable|string $callback Callback function. + * @param array $parameters Parameters to pass. + * @return array + * + * @throws \ReflectionException Throw on invalid arguments. + */ + protected static function get_method_dependencies( $container, $callback, array $parameters = [] ) { + $dependencies = []; + + foreach ( static::get_call_reflector( $callback )->getParameters() as $parameter ) { + static::add_dependency_for_call_parameter( $container, $parameter, $parameters, $dependencies ); + } + + return array_merge( $dependencies, $parameters ); + } + + /** + * Get the proper reflection instance for the given callback. + * + * @param callable|string $callback Callback to get from. + * @return \ReflectionFunctionAbstract + * + * @throws \ReflectionException Throw on invalid arguments. + */ + protected static function get_call_reflector( $callback ) { + if ( is_string( $callback ) && strpos( $callback, '::' ) !== false ) { + $callback = explode( '::', $callback ); + } elseif ( is_object( $callback ) && ! $callback instanceof Closure ) { + $callback = [ $callback, '__invoke' ]; + } + + return is_array( $callback ) + ? new ReflectionMethod( $callback[0], $callback[1] ) + : new ReflectionFunction( $callback ); + } + + /** + * Get the dependency for the given call parameter. + * + * @param Container $container Container instance. + * @param \ReflectionParameter $parameter Reflect Parameter. + * @param array $parameters Parameters to pass. + * @param array $dependencies Class dependencies. + * @return void + * + * @throws Binding_Resolution_Exception Thrown for invalid binding resolution. + */ + protected static function add_dependency_for_call_parameter( + $container, + $parameter, + array &$parameters, + &$dependencies + ) { + if ( array_key_exists( $parameter->name, $parameters ) ) { + $dependencies[] = $parameters[ $parameter->name ]; + + unset( $parameters[ $parameter->name ] ); + } elseif ( ! is_null( $class_name = Reflector::get_parameter_class_name( $parameter ) ) ) { + if ( array_key_exists( $class_name, $parameters ) ) { + $dependencies[] = $parameters[ $class_name ]; + + unset( $parameters[ $class_name ] ); + } else { + $dependencies[] = $container->make( $class_name ); + } + } elseif ( $parameter->isDefaultValueAvailable() ) { + $dependencies[] = $parameter->getDefaultValue(); + } elseif ( ! $parameter->isOptional() && ! array_key_exists( $parameter->name, $parameters ) ) { + $message = "Unable to resolve dependency [{$parameter}] in class {$parameter->getDeclaringClass()->getName()}"; + + throw new Binding_Resolution_Exception( $message ); + } + } + + /** + * Determine if the given string is in Class@method syntax. + * + * @param mixed $callback Callback. + */ + protected static function is_callable_with_at_sign( $callback ): bool { + return is_string( $callback ) && strpos( $callback, '@' ) !== false; + } +} diff --git a/vendor/mantle-framework/container/class-container.php b/vendor/mantle-framework/container/class-container.php new file mode 100644 index 00000000..83b69f7f --- /dev/null +++ b/vendor/mantle-framework/container/class-container.php @@ -0,0 +1,1186 @@ +<?php +/** + * Container class file. + * + * @package Mantle + */ + +namespace Mantle\Container; + +use ArrayAccess; +use Closure; +use Exception; +use LogicException; +use Mantle\Support\Reflector; +use ReflectionClass; +use ReflectionException; +use ReflectionParameter; + +// phpcs:disable Squiz.Commenting.FunctionComment.MissingParamTag + +/** + * Service Container + */ +class Container implements ArrayAccess, \Mantle\Contracts\Container { + /** + * The current globally available container (if any). + */ + protected static ?\Mantle\Contracts\Container $instance = null; + + /** + * An array of the types that have been resolved. + * + * @var bool[] + */ + protected $resolved = []; + + /** + * The container's bindings. + * + * @var array[] + */ + protected $bindings = []; + + /** + * The container's method bindings. + * + * @var \Closure[] + */ + protected $method_bindings = []; + + /** + * The container's shared instances. + * + * @var object[] + */ + protected $instances = []; + + /** + * The registered type aliases. + * + * @var string[] + */ + protected $aliases = []; + + /** + * The registered aliases keyed by the abstract name. + * + * @var array[] + */ + protected $abstract_aliases = []; + + /** + * The extension closures for services. + * + * @var array[] + */ + protected $extenders = []; + + /** + * All of the registered tags. + * + * @var array[] + */ + protected $tags = []; + + /** + * The stack of concretions currently being built. + * + * @var array + */ + protected $build_stack = []; + + /** + * The parameter override stack. + * + * @var array[] + */ + protected $with = []; + + /** + * The contextual binding map. + * + * @var array[] + */ + public $contextual = []; + + /** + * All of the registered rebound callbacks. + * + * @var array[] + */ + protected $rebound_callbacks = []; + + /** + * All of the global resolving callbacks. + * + * @var \Closure[] + */ + protected $global_resolving_callbacks = []; + + /** + * All of the global after resolving callbacks. + * + * @var \Closure[] + */ + protected $global_after_resolving_callbacks = []; + + /** + * All of the resolving callbacks by class type. + * + * @var array[] + */ + protected $resolving_callbacks = []; + + /** + * All of the after resolving callbacks by class type. + * + * @var array[] + */ + protected $after_resolving_callbacks = []; + + /** + * Determine if the given abstract type has been bound. + * + * @param string $abstract Abstract name. + */ + public function bound( $abstract ): bool { + return isset( $this->bindings[ $abstract ] ) || + isset( $this->instances[ $abstract ] ) || + $this->is_alias( $abstract ); + } + + /** + * {@inheritdoc} + */ + public function has( string $id ): bool { + return $this->bound( $id ); + } + + /** + * Determine if the given abstract type has been resolved. + * + * @param string $abstract Abstract name. + */ + public function resolved( $abstract ): bool { + if ( $this->is_alias( $abstract ) ) { + $abstract = $this->get_alias( $abstract ); + } + + return isset( $this->resolved[ $abstract ] ) || + isset( $this->instances[ $abstract ] ); + } + + /** + * Determine if a given type is shared. + * + * @param string $abstract Abstract name. + */ + public function is_shared( $abstract ): bool { + return isset( $this->instances[ $abstract ] ) || + ( isset( $this->bindings[ $abstract ]['shared'] ) && + true === $this->bindings[ $abstract ]['shared'] ); + } + + /** + * Determine if a given string is an alias. + * + * @param string $name Alias name. + * @return bool + */ + public function is_alias( $name ) { + return isset( $this->aliases[ $name ] ); + } + + /** + * Register a binding with the container. + * + * @param string $abstract + * @param \Closure|string|null $concrete + * @param bool $shared + */ + public function bind( $abstract, $concrete = null, $shared = false ): void { + $this->drop_stale_instances( $abstract ); + + // If no concrete type was given, we will simply set the concrete type to the + // abstract type. After that, the concrete type to be registered as shared + // without being forced to state their classes in both of the parameters. + if ( is_null( $concrete ) ) { + $concrete = $abstract; + } + + // If the factory is not a Closure, it means it is just a class name which is + // bound into this container to the abstract type and we will just wrap it + // up inside its own Closure to give us more convenience when extending. + if ( ! $concrete instanceof Closure ) { + $concrete = $this->get_closure( $abstract, $concrete ); + } + + $this->bindings[ $abstract ] = compact( 'concrete', 'shared' ); + + // If the abstract type was already resolved in this container we'll fire the + // rebound listener so that any objects which have already gotten resolved + // can have their copy of the object updated via the listener callbacks. + if ( $this->resolved( $abstract ) ) { + $this->rebound( $abstract ); + } + } + + /** + * Get the Closure to be used when building a type. + * + * @param string $abstract + * @param string $concrete + * @return \Closure + */ + protected function get_closure( $abstract, $concrete ) { + return function ( $container, $parameters = [] ) use ( $abstract, $concrete ) { + if ( $abstract == $concrete ) { + return $container->build( $concrete ); + } + + return $container->resolve( + $concrete, + $parameters, + $raise_events = false + ); + }; + } + + /** + * Determine if the container has a method binding. + * + * @param string $method Method name. + * @return bool + */ + public function has_method_binding( $method ) { + return isset( $this->method_bindings[ $method ] ); + } + + /** + * Bind a callback to resolve with Container::call. + * + * @param array|string $method + * @param \Closure $callback + */ + public function bind_method( $method, $callback ): void { + $this->method_bindings[ $this->parse_bind_method( $method ) ] = $callback; + } + + /** + * Get the method to be bound in class@method format. + * + * @param array|string $method + * @return string + */ + protected function parse_bind_method( $method ) { + if ( is_array( $method ) ) { + return $method[0] . '@' . $method[1]; + } + + return $method; + } + + /** + * Get the method binding for the given method. + * + * @param string $method + * @param mixed $instance + * @return mixed + */ + public function call_method_binding( $method, $instance ) { + return call_user_func( $this->method_bindings[ $method ], $instance, $this ); + } + + /** + * Register a binding if it hasn't already been registered. + * + * @param string $abstract + * @param \Closure|string|null $concrete + * @param bool $shared + */ + public function bind_if( $abstract, $concrete = null, $shared = false ): void { + if ( ! $this->bound( $abstract ) ) { + $this->bind( $abstract, $concrete, $shared ); + } + } + + /** + * Register a shared binding in the container. + * + * @param string $abstract + * @param \Closure|string|null $concrete + */ + public function singleton( $abstract, $concrete = null ): void { + $this->bind( $abstract, $concrete, true ); + } + + /** + * Register a shared binding if it hasn't already been registered. + * + * @param string $abstract + * @param \Closure|string|null $concrete + */ + public function singleton_if( $abstract, $concrete = null ): void { + if ( ! $this->bound( $abstract ) ) { + $this->singleton( $abstract, $concrete ); + } + } + + /** + * "Extend" an abstract type in the container. + * + * @param string $abstract + * @param \Closure $closure + * + * @throws \InvalidArgumentException Thrown on invalid argument. + */ + public function extend( $abstract, Closure $closure ): void { + $abstract = $this->get_alias( $abstract ); + + if ( isset( $this->instances[ $abstract ] ) ) { + $this->instances[ $abstract ] = $closure( $this->instances[ $abstract ], $this ); + + $this->rebound( $abstract ); + } else { + $this->extenders[ $abstract ][] = $closure; + + if ( $this->resolved( $abstract ) ) { + $this->rebound( $abstract ); + } + } + } + + /** + * Register an existing instance as shared in the container. + * + * @param string $abstract + * @param mixed $instance + * @return mixed + */ + public function instance( $abstract, $instance ) { + $this->remove_abstract_alias( $abstract ); + + $is_bound = $this->bound( $abstract ); + + unset( $this->aliases[ $abstract ] ); + + // We'll check to determine if this type has been bound before, and if it has + // we will fire the rebound callbacks registered with the container and it + // can be updated with consuming classes that have gotten resolved here. + $this->instances[ $abstract ] = $instance; + + if ( $is_bound ) { + $this->rebound( $abstract ); + } + + return $instance; + } + + /** + * Remove an alias from the contextual binding alias cache. + * + * @param string $searched + * @return void + */ + protected function remove_abstract_alias( $searched ) { + if ( ! isset( $this->aliases[ $searched ] ) ) { + return; + } + + foreach ( $this->abstract_aliases as $abstract => $aliases ) { + foreach ( $aliases as $index => $alias ) { + if ( $alias == $searched ) { + unset( $this->abstract_aliases[ $abstract ][ $index ] ); + } + } + } + } + + /** + * Alias a type to a different name. + * + * @param string $abstract + * @param string $alias + * + * @throws LogicException Thrown on logic error. + */ + public function alias( $abstract, $alias ): void { + if ( $alias === $abstract ) { + throw new LogicException( "[{$abstract}] is aliased to itself." ); + } + + $this->aliases[ $alias ] = $abstract; + + $this->abstract_aliases[ $abstract ][] = $alias; + } + + /** + * Bind a new callback to an abstract's rebind event. + * + * @param string $abstract + * @param \Closure $callback + * @return mixed + */ + public function rebinding( $abstract, Closure $callback ) { + $this->rebound_callbacks[ $abstract = $this->get_alias( $abstract ) ][] = $callback; + + if ( $this->bound( $abstract ) ) { + return $this->make( $abstract ); + } + } + + /** + * Refresh an instance on the given target and method. + * + * @param string $abstract + * @param mixed $target + * @param string $method + * @return mixed + */ + public function refresh( $abstract, $target, $method ) { + return $this->rebinding( + $abstract, + function ( $app, $instance ) use ( $target, $method ): void { + $target->{$method}( $instance ); + } + ); + } + + /** + * Fire the "rebound" callbacks for the given abstract type. + * + * @param string $abstract + * @return void + */ + protected function rebound( $abstract ) { + $instance = $this->make( $abstract ); + + foreach ( $this->getReboundCallbacks( $abstract ) as $callback ) { + call_user_func( $callback, $this, $instance ); + } + } + + /** + * Get the rebound callbacks for a given type. + * + * @param string $abstract + * @return array + */ + protected function getReboundCallbacks( $abstract ) { + return $this->rebound_callbacks[ $abstract ] ?? []; + } + + /** + * Wrap the given closure such that its dependencies will be injected when executed. + * + * @param \Closure $callback + * @param array $parameters + * @return \Closure + */ + public function wrap( Closure $callback, array $parameters = [] ) { + return fn () => $this->call( $callback, $parameters ); + } + + /** + * Call the given Closure / class@method and inject its dependencies. + * + * @param callable|string $callback Callback to execute. + * @param string[] $parameters Parameters to pass. + * @param string|null $default_method Default method. + * @return mixed + * + * @throws \InvalidArgumentException Throw for invalid arguments. + */ + public function call( $callback, array $parameters = [], $default_method = null ) { + return Bound_Method::call( $this, $callback, $parameters, $default_method ); + } + + /** + * Get a closure to resolve the given type from the container. + * + * @param string $abstract Abstract name. + * @return \Closure + */ + public function factory( $abstract ) { + return fn () => $this->make( $abstract ); + } + + /** + * An alias function name for make(). + * + * @param string $abstract + * @param array $parameters + * @return mixed + */ + public function make_with( $abstract, array $parameters = [] ) { + return $this->make( $abstract, $parameters ); + } + + /** + * Resolve the given type from the container. + * + * @param string $abstract + * @param array $parameters + * @return mixed + * + * @throws Binding_Resolution_Exception Thrown on missing resolution. + */ + public function make( $abstract, array $parameters = [] ) { + return $this->resolve( $abstract, $parameters ); + } + + /** + * {@inheritdoc} + * + * @throws Entry_Not_Found_Exception Thrown on entry not found. + * @throws Binding_Resolution_Exception Thrown on error resolution. + */ + public function get( $id ) { + try { + return $this->resolve( $id ); + } catch ( Binding_Resolution_Exception $e ) { + if ( $this->has( $id ) ) { + throw $e; + } + + throw new Entry_Not_Found_Exception( $id, $e->getCode(), $e ); + } + } + + /** + * Resolve the given type from the container. + * + * @param string $abstract + * @param array $parameters + * @param bool $raise_events + * @return mixed + * + * @throws Binding_Resolution_Exception Thrown on missing resolution. + */ + protected function resolve( $abstract, $parameters = [], $raise_events = true ) { + $abstract = $this->get_alias( $abstract ); + + $needs_contextual_build = ! empty( $parameters ) || ! is_null( + $this->get_contextual_concrete( $abstract ) + ); + + // If an instance of the type is currently being managed as a singleton we'll + // just return an existing instance instead of instantiating new instances + // so the developer can keep using the same objects instance every time. + if ( isset( $this->instances[ $abstract ] ) && ! $needs_contextual_build ) { + return $this->instances[ $abstract ]; + } + + $this->with[] = $parameters; + + $concrete = $this->getConcrete( $abstract ); + + // We're ready to instantiate an instance of the concrete type registered for + // the binding. This will instantiate the types, as well as resolve any of + // its "nested" dependencies recursively until all have gotten resolved. + if ( $this->is_buildable( $concrete, $abstract ) ) { + $object = $this->build( $concrete ); + } else { + $object = $this->make( $concrete ); + } + + // If we defined any extenders for this type, we'll need to spin through them + // and apply them to the object being built. This allows for the extension + // of services, such as changing configuration or decorating the object. + foreach ( $this->get_extenders( $abstract ) as $extender ) { + $object = $extender( $object, $this ); + } + + // If the requested type is registered as a singleton we'll want to cache off + // the instances in "memory" so we can return it later without creating an + // entirely new instance of an object on each subsequent request for it. + if ( $this->is_shared( $abstract ) && ! $needs_contextual_build ) { + $this->instances[ $abstract ] = $object; + } + + if ( $raise_events ) { + $this->fire_resolving_callbacks( $abstract, $object ); + } + + // Before returning, we will also set the resolved flag to "true" and pop off + // the parameter overrides for this build. After those two things are done + // we will be ready to return back the fully constructed class instance. + $this->resolved[ $abstract ] = true; + + array_pop( $this->with ); + + return $object; + } + + /** + * Get the concrete type for a given abstract. + * + * @param string $abstract + * @return mixed $concrete + */ + protected function getConcrete( $abstract ) { + if ( ! is_null( $concrete = $this->get_contextual_concrete( $abstract ) ) ) { + return $concrete; + } + + // If we don't have a registered resolver or concrete for the type, we'll just + // assume each type is a concrete name and will attempt to resolve it as is + // since the container should be able to resolve concretes automatically. + if ( isset( $this->bindings[ $abstract ] ) ) { + return $this->bindings[ $abstract ]['concrete']; + } + + return $abstract; + } + + /** + * Get the contextual concrete binding for the given abstract. + * + * @param string $abstract + * @return \Closure|array|string|null + */ + protected function get_contextual_concrete( $abstract ) { + if ( ! is_null( $binding = $this->find_in_contextual_bindings( $abstract ) ) ) { + return $binding; + } + + /** + * Next we need to see if a contextual binding might be bound under an alias of the + * given abstract type. + * + * To do that, we will need to check if any aliases exist with this type and then + * spin through them and check each for contextual bindings as well. + */ + if ( empty( $this->abstract_aliases[ $abstract ] ) ) { + return null; + } + + foreach ( $this->abstract_aliases[ $abstract ] as $alias ) { + if ( ! is_null( $binding = $this->find_in_contextual_bindings( $alias ) ) ) { + return $binding; + } + } + + return null; + } + + /** + * Find the concrete binding for the given abstract in the contextual binding array. + * + * @param string $abstract + * @return \Closure|string|null + */ + protected function find_in_contextual_bindings( $abstract ) { + return $this->contextual[ end( $this->build_stack ) ][ $abstract ] ?? null; + } + + /** + * Determine if the given concrete is buildable. + * + * @param mixed $concrete + * @param string $abstract + */ + protected function is_buildable( $concrete, $abstract ): bool { + return $concrete === $abstract || $concrete instanceof Closure; + } + + /** + * Instantiate a concrete instance of the given type. + * + * @param \Closure|string $concrete + * @return mixed + * + * @throws Binding_Resolution_Exception Thrown on missing resolution. + */ + public function build( $concrete ) { + // If the concrete type is actually a Closure, we will just execute it and + // hand back the results of the functions, which allows functions to be + // used as resolvers for more fine-tuned resolution of these objects. + if ( $concrete instanceof Closure ) { + return $concrete( $this, $this->get_last_parameter_override() ); + } + + try { + $reflector = new ReflectionClass( $concrete ); + } catch ( ReflectionException $e ) { + throw new Binding_Resolution_Exception( "Target class [$concrete] does not exist.", 0, $e ); + } + + // If the type is not instantiable, the developer is attempting to resolve + // an abstract type such as an Interface or Abstract Class and there is + // no binding registered for the abstractions so we need to bail out. + if ( ! $reflector->isInstantiable() ) { + $this->not_instantiable( $concrete ); + return; + } + + $this->build_stack[] = $concrete; + + $constructor = $reflector->getConstructor(); + + // If there are no constructors, that means there are no dependencies then + // we can just resolve the instances of the objects right away, without + // resolving any other types or dependencies out of these containers. + if ( is_null( $constructor ) ) { + array_pop( $this->build_stack ); + + return new $concrete(); + } + + $dependencies = $constructor->getParameters(); + + // Once we have all the constructor's parameters we can create each of the + // dependency instances and then use the reflection instances to make a + // new instance of this class, injecting the created dependencies in. + try { + $instances = $this->resolve_dependencies( $dependencies ); + } catch ( Binding_Resolution_Exception $e ) { + array_pop( $this->build_stack ); + + throw $e; + } + + array_pop( $this->build_stack ); + + return $reflector->newInstanceArgs( $instances ); + } + + /** + * Resolve all of the dependencies from the ReflectionParameters. + * + * @param \ReflectionParameter[] $dependencies + * + * @throws Binding_Resolution_Exception Thrown on missing resolution. + */ + protected function resolve_dependencies( array $dependencies ): array { + $results = []; + + foreach ( $dependencies as $dependency ) { + // If this dependency has a override for this particular build we will use + // that instead as the value. Otherwise, we will continue with this run + // of resolutions and let reflection attempt to determine the result. + if ( $this->has_parameter_override( $dependency ) ) { + $results[] = $this->get_parameter_override( $dependency ); + + continue; + } + + // If the class is null, it means the dependency is a string or some other + // primitive type which we can not resolve since it is not a class and + // we will just bomb out with an error since we have no-where to go. + $results[] = is_null( Reflector::get_parameter_class_name( $dependency ) ) + ? $this->resolve_primitive( $dependency ) + : $this->resolveClass( $dependency ); + } + + return $results; + } + + /** + * Determine if the given dependency has a parameter override. + * + * @param \ReflectionParameter $dependency + * @return bool + */ + protected function has_parameter_override( $dependency ) { + return array_key_exists( + $dependency->name, + $this->get_last_parameter_override() + ); + } + + /** + * Get a parameter override for a dependency. + * + * @param \ReflectionParameter $dependency + * @return mixed + */ + protected function get_parameter_override( $dependency ) { + return $this->get_last_parameter_override()[ $dependency->name ]; + } + + /** + * Get the last parameter override. + * + * @return array + */ + protected function get_last_parameter_override() { + return count( $this->with ) ? end( $this->with ) : []; + } + + /** + * Resolve a non-class hinted primitive dependency. + * + * @param \ReflectionParameter $parameter + * @return mixed + * + * @throws Binding_Resolution_Exception Thrown on missing resolution. + */ + protected function resolve_primitive( ReflectionParameter $parameter ) { + if ( ! is_null( $concrete = $this->get_contextual_concrete( '$' . $parameter->getName() ) ) ) { + return $concrete instanceof Closure ? $concrete( $this ) : $concrete; + } + + if ( $parameter->isDefaultValueAvailable() ) { + return $parameter->getDefaultValue(); + } + + $this->unresolvable_primitive( $parameter ); + } + + /** + * Resolve a class based dependency from the container. + * + * @param \ReflectionParameter $parameter + * @return mixed + * + * @throws Binding_Resolution_Exception Thrown on missing resolution. + */ + protected function resolveClass( ReflectionParameter $parameter ) { + try { + return $parameter->isVariadic() + ? $this->resolve_variadic_class( $parameter ) + : $this->make( Reflector::get_parameter_class_name( $parameter ) ); + } catch ( Binding_Resolution_Exception $e ) { + // If we can not resolve the class instance, we will check to see if the value + // is optional, and if it is we will return the optional parameter value as + // the value of the dependency, similarly to how we do this with scalars. + if ( $parameter->isOptional() ) { + return $parameter->getDefaultValue(); + } + + throw $e; + } + } + + /** + * Resolve a class based variadic dependency from the container. + * + * @param \ReflectionParameter $parameter + * @return mixed + */ + protected function resolve_variadic_class( ReflectionParameter $parameter ) { + $class_name = Reflector::get_parameter_class_name( $parameter ); + + $abstract = $this->get_alias( $class_name ); + + if ( ! is_array( $concrete = $this->get_contextual_concrete( $abstract ) ) ) { + return $this->make( $class_name ); + } + + return array_map( + fn ( $abstract) => $this->resolve( $abstract ), + $concrete + ); + } + + /** + * Throw an exception that the concrete is not instantiable. + * + * @param string $concrete + * @return void + * + * @throws Binding_Resolution_Exception Thrown on missing resolution. + */ + protected function not_instantiable( $concrete ) { + if ( ! empty( $this->build_stack ) ) { + $previous = implode( ', ', $this->build_stack ); + + $message = "Target [$concrete] is not instantiable while building [$previous]."; + } else { + $message = "Target [$concrete] is not instantiable."; + } + + throw new Binding_Resolution_Exception( $message ); + } + + /** + * Throw an exception for an unresolvable primitive. + * + * @param \ReflectionParameter $parameter + * + * @throws Binding_Resolution_Exception Thrown on missing resolution. + */ + protected function unresolvable_primitive( ReflectionParameter $parameter ): never { + $message = "Unresolvable dependency resolving [$parameter] in class {$parameter->getDeclaringClass()->getName()}"; + + throw new Binding_Resolution_Exception( $message ); + } + + /** + * Register a new resolving callback. + * + * @param \Closure|string $abstract + * @param \Closure|null $callback + */ + public function resolving( $abstract, Closure $callback = null ): void { + if ( is_string( $abstract ) ) { + $abstract = $this->get_alias( $abstract ); + } + + if ( is_null( $callback ) && $abstract instanceof Closure ) { + $this->global_resolving_callbacks[] = $abstract; + } else { + $this->resolving_callbacks[ $abstract ][] = $callback; + } + } + + /** + * Register a new after resolving callback for all types. + * + * @param \Closure|string $abstract + * @param \Closure|null $callback + */ + public function after_resolving( $abstract, Closure $callback = null ): void { + if ( is_string( $abstract ) ) { + $abstract = $this->get_alias( $abstract ); + } + + if ( $abstract instanceof Closure && is_null( $callback ) ) { + $this->global_after_resolving_callbacks[] = $abstract; + } else { + $this->after_resolving_callbacks[ $abstract ][] = $callback; + } + } + + /** + * Fire all of the resolving callbacks. + * + * @param string $abstract + * @param mixed $object + * @return void + */ + protected function fire_resolving_callbacks( $abstract, $object ) { + $this->fire_callback_array( $object, $this->global_resolving_callbacks ); + + $this->fire_callback_array( + $object, + $this->get_callbacks_for_type( $abstract, $object, $this->resolving_callbacks ) + ); + + $this->fire_after_resolving_callbacks( $abstract, $object ); + } + + /** + * Fire all of the after resolving callbacks. + * + * @param string $abstract + * @param mixed $object + * @return void + */ + protected function fire_after_resolving_callbacks( $abstract, $object ) { + $this->fire_callback_array( $object, $this->global_after_resolving_callbacks ); + + $this->fire_callback_array( + $object, + $this->get_callbacks_for_type( $abstract, $object, $this->after_resolving_callbacks ) + ); + } + + /** + * Get all callbacks for a given type. + * + * @param string $abstract + * @param object $object + * @param array $callbacks_per_type + */ + protected function get_callbacks_for_type( $abstract, $object, array $callbacks_per_type ): array { + $results = []; + + foreach ( $callbacks_per_type as $type => $callbacks ) { + if ( $type === $abstract || $object instanceof $type ) { + $results = array_merge( $results, $callbacks ); + } + } + + return $results; + } + + /** + * Fire an array of callbacks with an object. + * + * @param mixed $object + * @param array $callbacks + * @return void + */ + protected function fire_callback_array( $object, array $callbacks ) { + foreach ( $callbacks as $callback ) { + $callback( $object, $this ); + } + } + + /** + * Get the container's bindings. + * + * @return array + */ + public function get_bindings() { + return $this->bindings; + } + + /** + * Get the alias for an abstract if available. + * + * @param string $abstract + * @return string + */ + public function get_alias( $abstract ) { + if ( ! isset( $this->aliases[ $abstract ] ) ) { + return $abstract; + } + + return $this->get_alias( $this->aliases[ $abstract ] ); + } + + /** + * Get the extender callbacks for a given type. + * + * @param string $abstract + * @return array + */ + protected function get_extenders( $abstract ) { + $abstract = $this->get_alias( $abstract ); + + return $this->extenders[ $abstract ] ?? []; + } + + /** + * Remove all of the extender callbacks for a given type. + * + * @param string $abstract + */ + public function forget_extenders( $abstract ): void { + unset( $this->extenders[ $this->get_alias( $abstract ) ] ); + } + + /** + * Drop all of the stale instances and aliases. + * + * @param string $abstract + * @return void + */ + protected function drop_stale_instances( $abstract ) { + unset( $this->instances[ $abstract ], $this->aliases[ $abstract ] ); + } + + /** + * Remove a resolved instance from the instance cache. + * + * @param string $abstract + */ + public function forget_instance( $abstract ): void { + unset( $this->instances[ $abstract ] ); + } + + /** + * Clear all of the instances from the container. + */ + public function forget_instances(): void { + $this->instances = []; + } + + /** + * Flush the container of all bindings and resolved instances. + */ + public function flush(): void { + $this->aliases = []; + $this->resolved = []; + $this->bindings = []; + $this->instances = []; + $this->abstract_aliases = []; + } + + /** + * Get the globally available instance of the container. + * + * @deprecated Use `get_instance()` instead. + * @return \Mantle\Contracts\Container + */ + public static function getInstance() { + return static::get_instance(); + } + + /** + * Get the globally available instance of the container. + */ + public static function get_instance(): \Mantle\Contracts\Container { + if ( ! isset( static::$instance ) ) { + static::$instance = new static(); + } + + return static::$instance; + } + + /** + * Set the shared instance of the container. + * + * @param \Mantle\Contracts\Container|null $container + */ + public static function set_instance( \Mantle\Contracts\Container|null $container = null ): ?\Mantle\Contracts\Container { + static::$instance = $container; + + return static::$instance; + } + + /** + * Determine if a given offset exists. + * + * @param mixed $key + */ + public function offsetExists( mixed $key ): bool { + return $this->bound( $key ); + } + + /** + * Get the value at a given offset. + * + * @param mixed $key + */ + public function offsetGet( mixed $key ): mixed { + return $this->make( $key ); + } + + /** + * Set the value at a given offset. + * + * @param mixed $key + * @param mixed $value + */ + public function offsetSet( mixed $key, mixed $value ): void { + $this->bind( + $key, + $value instanceof Closure ? $value : fn () => $value + ); + } + + /** + * Unset the value at a given offset. + * + * @param mixed $key + */ + public function offsetUnset( mixed $key ): void { + unset( $this->bindings[ $key ], $this->instances[ $key ], $this->resolved[ $key ] ); + } + + /** + * Dynamically access container services. + * + * @param string $key + * @return mixed + */ + public function __get( $key ) { + return $this[ $key ]; + } + + /** + * Dynamically set container services. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function __set( $key, $value ) { + $this[ $key ] = $value; + } +} diff --git a/vendor/mantle-framework/container/class-entry-not-found-exception.php b/vendor/mantle-framework/container/class-entry-not-found-exception.php new file mode 100644 index 00000000..668dadb7 --- /dev/null +++ b/vendor/mantle-framework/container/class-entry-not-found-exception.php @@ -0,0 +1,16 @@ +<?php +/** + * Entry_Not_Found_Exception class file. + * + * @package Mantle + */ + +namespace Mantle\Container; + +use Exception; +use Psr\Container\NotFoundExceptionInterface; + +/** + * Exception for Entry Not Found + */ +class Entry_Not_Found_Exception extends Exception implements NotFoundExceptionInterface { } diff --git a/vendor/mantle-framework/container/class-util.php b/vendor/mantle-framework/container/class-util.php new file mode 100644 index 00000000..9e89663b --- /dev/null +++ b/vendor/mantle-framework/container/class-util.php @@ -0,0 +1,44 @@ +<?php +/** + * Util class file. + * + * @package Mantle + */ + +namespace Mantle\Container; + +use Closure; + +/** + * Container Utilities + */ +class Util { + + /** + * If the given value is not an array and not null, wrap it in one. + * + * From Arr::wrap() in Illuminate\Support. + * + * @param mixed $value Value to wrap. + * @return array + */ + public static function array_wrap( $value ) { + if ( is_null( $value ) ) { + return []; + } + + return is_array( $value ) ? $value : [ $value ]; + } + + /** + * Return the default value of the given value. + * + * From global value() helper in Illuminate\Support. + * + * @param mixed $value Value to unwrap. + * @return mixed + */ + public static function unwrap_if_closure( $value ) { + return $value instanceof Closure ? $value() : $value; + } +} diff --git a/vendor/mantle-framework/container/composer.json b/vendor/mantle-framework/container/composer.json new file mode 100644 index 00000000..64a9f2f5 --- /dev/null +++ b/vendor/mantle-framework/container/composer.json @@ -0,0 +1,32 @@ +{ + "name": "mantle-framework/container", + "description": "The Mantle Framework Container Package", + "type": "library", + "require": { + "php": "^8.1", + "alleyinteractive/composer-wordpress-autoloader": "^1.0", + "mantle-framework/contracts": "^1.0", + "psr/container": "^1.1.1 || ^2.0.2" + }, + "provide": { + "psr/container-implementation": "1.1|2.0" + }, + "extra": { + "wordpress-autoloader": { + "autoload": { + "Mantle\\Container": "./" + } + } + }, + "license": "GPL-2.0-or-later", + "authors": [ + { + "name": "Alley", + "email": "mantle@alley.com" + } + ], + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/mantle-framework/contracts/LICENSE b/vendor/mantle-framework/contracts/LICENSE new file mode 100644 index 00000000..d159169d --- /dev/null +++ b/vendor/mantle-framework/contracts/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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. + + <signature of Ty Coon>, 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/vendor/mantle-framework/contracts/assets/class-load-hook.php b/vendor/mantle-framework/contracts/assets/class-load-hook.php new file mode 100644 index 00000000..60370dd2 --- /dev/null +++ b/vendor/mantle-framework/contracts/assets/class-load-hook.php @@ -0,0 +1,27 @@ +<?php +/** + * Load_Hook class file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Assets; + +/** + * Asset Load Hooks + */ +class Load_Hook { + /** + * Header load method. + * + * @var string + */ + public const HEADER = 'wp_head'; + + /** + * Footer load method. + * + * @var string + */ + public const FOOTER = 'wp_footer'; +} diff --git a/vendor/mantle-framework/contracts/assets/class-load-method.php b/vendor/mantle-framework/contracts/assets/class-load-method.php new file mode 100644 index 00000000..a96cc2a1 --- /dev/null +++ b/vendor/mantle-framework/contracts/assets/class-load-method.php @@ -0,0 +1,43 @@ +<?php +/** + * Load_Method class file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Assets; + +/** + * Asset Load Methods + * + * @todo Convert to ENUM with PHP 8.1. + */ +class Load_Method { + /** + * Synchronous load method. + * + * @var string + */ + public const SYNC = 'sync'; + + /** + * Asynchronous load method. + * + * @var string + */ + public const ASYNC = 'async'; + + /** + * Defer load method. + * + * @var string + */ + public const DEFER = 'defer'; + + /** + * Asynchronous and Defer load method. + * + * @var string + */ + public const ASYNC_DEFER = 'async-defer'; +} diff --git a/vendor/mantle-framework/contracts/assets/interface-asset-manager.php b/vendor/mantle-framework/contracts/assets/interface-asset-manager.php new file mode 100644 index 00000000..6df8d825 --- /dev/null +++ b/vendor/mantle-framework/contracts/assets/interface-asset-manager.php @@ -0,0 +1,91 @@ +<?php +/** + * Asset_Manager interface file. + * + * phpcs:disable Squiz.Commenting.FunctionComment + * + * @package Mantle + */ + +namespace Mantle\Contracts\Assets; + +/** + * Asset Manager Contract + */ +interface Asset_Manager { + /** + * Load a external script. + * + * @param string $handle Script handle. + * @param string $src Script URL. + * @param string[]|string $deps Script dependencies. + * @param array|string $condition Condition to load. + * @param string $load_method Load method. + * @param string $load_hook Load hook. + * @param string|null $version Script version. + * @return void + */ + public function script( ...$params ); + + /** + * Load an external stylesheet file. + * + * @param string $handle Stylesheet handle. + * @param string $src Stylesheet URL. + * @param string[]|string $deps Stylesheet dependencies. + * @param array|string $condition Condition to load. + * @param string $load_method Load method. + * @param string $load_hook Load hook. + * @param string|null $version Script version. + * @param string $media Style media. + * @return void + */ + public function style( ...$params ); + + /** + * Preload content by URL. + * + * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types/preload + * + * @param string $handle Preload handle. + * @param string $src URL to preload. + * @param string $condition Condition to preload. + * @param string|null $as Preload as, defaults to detect "as" by file URL. + * @param string|null $mime_type Mime type to load as, defaults to detect by file URL. + * @param string $media Media to preload, defaults to 'all'. + * @param bool $crossorigin Flag to load as cross origin, defaults to false. + * @param string|null $version Handle version, optional. + */ + public function preload( + string $handle, + string $src, + $condition = 'global', + ?string $as = null, + ?string $mime_type = null, + string $media = 'all', + bool $crossorigin = false, + ?string $version = null + ): void; + + /** + * Asynchronously load a script file. + * + * @param string $handle Handle to change. + */ + public function async( string $handle ): void; + + /** + * Defer a script file + * + * @param string $handle Handle to change. + */ + public function defer( string $handle ): void; + + /** + * Change the load method of an asset. + * + * @param string $handle Handle to change. + * @param string $load_method Load method to change to. + */ + public function load_method( string $handle, string $load_method = Load_Method::SYNC ): void; +} diff --git a/vendor/mantle-framework/contracts/cache/interface-factory.php b/vendor/mantle-framework/contracts/cache/interface-factory.php new file mode 100644 index 00000000..e855b92f --- /dev/null +++ b/vendor/mantle-framework/contracts/cache/interface-factory.php @@ -0,0 +1,21 @@ +<?php +/** + * Factory interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Cache; + +/** + * Cache Factory + */ +interface Factory { + /** + * Retrieve a cache store by name. + * + * @param string|null $name Cache store name. + * @return Repository + */ + public function store( string $name = null ); +} diff --git a/vendor/mantle-framework/contracts/cache/interface-repository.php b/vendor/mantle-framework/contracts/cache/interface-repository.php new file mode 100644 index 00000000..4b9c611d --- /dev/null +++ b/vendor/mantle-framework/contracts/cache/interface-repository.php @@ -0,0 +1,128 @@ +<?php +/** + * Repository interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Cache; + +use Closure; +use Psr\SimpleCache\CacheInterface; + +/** + * Cache Repository + * Implements PSR-16 standard and follows PSR code naming conventions. + * + * @link https://www.php-fig.org/psr/psr-16/ + */ +interface Repository extends CacheInterface { + /** + * Retrieve a value from cache. + * + * @template TCacheValue + * + * @param string $key Cache key. + * @param TCacheValue|(\Closure(): TCacheValue) $default Default value. + * @return (TCacheValue is null ? mixed : TCacheValue) + */ + public function get( string $key, mixed $default = null ): mixed; + + /** + * Retrieve an item from the cache and delete it. + * + * @template TCacheValue + * + * @param string $key + * @param TCacheValue|(\Closure(): TCacheValue) $default Default value. + * @return (TCacheValue is null ? mixed : TCacheValue) + */ + public function pull( $key, $default = null ); + + /** + * Store an item in the cache. + * + * @param string $key + * @param mixed $value + * @param \DateTimeInterface|\DateInterval|int|null $ttl + * @return bool + */ + public function put( $key, $value, $ttl = null ); + + /** + * Store an item in the cache if the key does not exist. + * + * @param string $key + * @param mixed $value + * @param \DateTimeInterface|\DateInterval|int|null $ttl + * @return bool + */ + public function add( $key, $value, $ttl = null ); + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function increment( $key, $value = 1 ); + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function decrement( $key, $value = 1 ); + + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return bool + */ + public function forever( $key, $value ); + + /** + * Get an item from the cache, or execute the given Closure and store the result. + * + * @template TCacheValue + * + * @param string $key + * @param \DateTimeInterface|\DateInterval|int|null $ttl + * @param (\Closure(): TCacheValue) $callback + * @return mixed + */ + public function remember( $key, $ttl, Closure $callback ); + + /** + * Get an item from the cache, or execute the given Closure and store the result forever. + * + * @param string $key + * @param \Closure $callback + * @return mixed + */ + public function sear( $key, Closure $callback ); + + /** + * Get an item from the cache, or execute the given Closure and store the result forever. + * + * @template TCacheValue + * + * @param string $key + * @param (\Closure(): TCacheValue) $callback + * @return mixed + */ + public function rememberForever( $key, Closure $callback ); + + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget( $key ); +} diff --git a/vendor/mantle-framework/contracts/cache/interface-taggable-repository.php b/vendor/mantle-framework/contracts/cache/interface-taggable-repository.php new file mode 100644 index 00000000..7ea186ce --- /dev/null +++ b/vendor/mantle-framework/contracts/cache/interface-taggable-repository.php @@ -0,0 +1,21 @@ +<?php +/** + * Taggable_Repository interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Cache; + +/** + * Cache Tag Contract + */ +interface Taggable_Repository extends Repository { + /** + * Cache tags to apply. + * + * @param string[]|string $names Cache names. + * @return static + */ + public function tags( $names ); +} diff --git a/vendor/mantle-framework/contracts/composer.json b/vendor/mantle-framework/contracts/composer.json new file mode 100644 index 00000000..47a6f1b6 --- /dev/null +++ b/vendor/mantle-framework/contracts/composer.json @@ -0,0 +1,31 @@ +{ + "name": "mantle-framework/contracts", + "description": "The Mantle Framework Contracts Package", + "type": "library", + "require": { + "php": "^8.1", + "alleyinteractive/composer-wordpress-autoloader": "^1.0", + "psr/container": "^1.1.1 || ^2.0.2" + }, + "provide": { + "psr/container-implementation": "1.1|2.0" + }, + "extra": { + "wordpress-autoloader": { + "autoload": { + "Mantle\\Contracts": "./" + } + } + }, + "license": "GPL-2.0-or-later", + "authors": [ + { + "name": "Alley", + "email": "mantle@alley.com" + } + ], + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/mantle-framework/contracts/config/interface-repository.php b/vendor/mantle-framework/contracts/config/interface-repository.php new file mode 100644 index 00000000..e005fbb3 --- /dev/null +++ b/vendor/mantle-framework/contracts/config/interface-repository.php @@ -0,0 +1,42 @@ +<?php +/** + * Repository interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Config; + +/** + * Config Repository Contract + */ +interface Repository { + /** + * Check if a configuration value exists. + * + * @param string $key Key to get, period-delimited. + */ + public function has( string $key ): bool; + + /** + * Retrieve a configuration value. + * + * @param string $key Configuration key to get, period-delimited. + * @param mixed $default Default value, optional. + * @return mixed + */ + public function get( string $key, $default = null ); + + /** + * Set a configuration value. + * + * @param array|string $key Key(s) to set. + * @param mixed $value Value to set. + */ + public function set( $key, $value ); + + /** + * Get all configuration values. + */ + public function all(): array; +} diff --git a/vendor/mantle-framework/contracts/console/interface-application.php b/vendor/mantle-framework/contracts/console/interface-application.php new file mode 100644 index 00000000..c15b87bb --- /dev/null +++ b/vendor/mantle-framework/contracts/console/interface-application.php @@ -0,0 +1,52 @@ +<?php +/** + * Application interface file + * + * @package Mantle + */ + +namespace Mantle\Contracts\Console; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Tester\CommandTester; +use Throwable; + +/** + * Console Application Contract + */ +interface Application { + /** + * Run the command through the console application. + * + * @param InputInterface|null $input Input interface. + * @param OutputInterface|null $output Output interface. + */ + public function run( InputInterface $input = null, OutputInterface $output = null ): int; + + /** + * Run a command through the console application by name. + * + * @param string $command Command name. + * @param array $parameters Command parameters. + * @param OutputInterface|null $output_buffer Output buffer. + */ + public function call( string $command, array $parameters = [], $output_buffer = null ): int; + + /** + * Test a console command by name. + * + * @param string $command Command name. + * @param array $parameters Command parameters. + */ + public function test( string $command, array $parameters = [] ): CommandTester; + + /** + * Render an exception for the console. + * + * @param Throwable $e + * @param OutputInterface $output + * @return void + */ + public function render_throwable( Throwable $e, OutputInterface $output ); +} diff --git a/vendor/mantle-framework/contracts/console/interface-kernel.php b/vendor/mantle-framework/contracts/console/interface-kernel.php new file mode 100644 index 00000000..eaf3a698 --- /dev/null +++ b/vendor/mantle-framework/contracts/console/interface-kernel.php @@ -0,0 +1,62 @@ +<?php +/** + * Kernel interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Console; + +use Symfony\Component\Console\Tester\CommandTester; + +/** + * Console Kernel + */ +interface Kernel extends \Mantle\Contracts\Kernel { + /** + * Run the console application. + * + * @param mixed $input Console input. + * @param mixed|null $output Console output. + * @return int + */ + public function handle( $input, $output = null ); + + /** + * Run the console application by command name. + * + * @param string $command Command name. + * @param array $parameters Command parameters. + * @param mixed $output_buffer Output buffer. + * @return int + */ + public function call( string $command, array $parameters = [], $output_buffer = null ); + + /** + * Test a console command by name. + * + * @param string $command Command name. + * @param array $parameters Command parameters. + */ + public function test( string $command, array $parameters = [] ): CommandTester; + + /** + * Register the application's commands. + */ + public function register_commands(); + + /** + * Log to the console. + * + * @param string $message Message to log. + */ + public function log( string $message ); + + /** + * Terminate the application. + * + * @param \Symfony\Component\Console\Input\InputInterface $input + * @param int $status + */ + public function terminate( $input, $status ): void; +} diff --git a/vendor/mantle-framework/contracts/database/interface-core-object.php b/vendor/mantle-framework/contracts/database/interface-core-object.php new file mode 100644 index 00000000..fd5ff35f --- /dev/null +++ b/vendor/mantle-framework/contracts/database/interface-core-object.php @@ -0,0 +1,52 @@ +<?php +/** + * Core_Object interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Database; + +/** + * Provides a way to normalize interacting with assorted WordPress objects + * which have different properties. Allows for a uniform experience when + * retrieving/updating object data in posts, terms, etc. + */ +interface Core_Object { + /** + * Getter for Object ID + */ + public function id(): int; + + /** + * Getter for Object Name + */ + public function name(): string; + + /** + * Getter for Object Slug + */ + public function slug(): string; + + /** + * Getter for Object Description + */ + public function description(): string; + + /** + * Getter for Parent Object (if any) + */ + public function parent(): ?Core_Object; + + /** + * Getter for the Object Permalink + */ + public function permalink(): ?string; + + /** + * Retrieve the core object for the underlying object. + * + * @return mixed + */ + public function core_object(); +} diff --git a/vendor/mantle-framework/contracts/database/interface-model-meta.php b/vendor/mantle-framework/contracts/database/interface-model-meta.php new file mode 100644 index 00000000..b35e05d6 --- /dev/null +++ b/vendor/mantle-framework/contracts/database/interface-model-meta.php @@ -0,0 +1,82 @@ +<?php +/** + * Model_Meta interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Database; + +use Mantle\Database\Model\Model_Exception; + +/** + * Model Meta Interface + */ +interface Model_Meta { + /** + * Retrieve meta data for the object. + * + * @param string $meta_key Meta key to retrieve. + * @param bool $single Return the first meta key, defaults to true. + */ + public function get_meta( string $meta_key, bool $single = true ): mixed; + + /** + * Add meta value for the object. + * + * @param string $meta_key Meta key. + * @param mixed $meta_value Meta value to store. + * @param string $prev_value Optional, previous meta value. + */ + public function add_meta( string $meta_key, mixed $meta_value, mixed $prev_value = '' ): void; + + /** + * Update meta value for the object. + * + * @param string $meta_key Meta key. + * @param mixed $meta_value Meta value to store. + * @param string $prev_value Optional, previous meta value. + */ + public function set_meta( string $meta_key, mixed $meta_value, mixed $prev_value = '' ): void; + + /** + * Delete a object's meta. + * + * @param string $meta_key Meta key to delete by. + * @param mixed $meta_value Previous meta value to delete. + */ + public function delete_meta( string $meta_key, mixed $meta_value = '' ); + + /** + * Allow setting meta through an array via an attribute mutator. + * + * @param array $meta_values Meta values to set. + * @throws Model_Exception Thrown on invalid value being set. + */ + public function set_meta_attribute( array $meta_values ): void; + + /** + * Get a queued meta attribute. + * + * @param string $key Meta key. + * @return mixed|null Meta value or null. + */ + public function get_queued_meta_attribute( string $key ): mixed; + + /** + * Queue a meta attribute for saving. + * Allows meta to be set before a model is saved. + * + * Should not be called directly, only to be used via `$model->meta->...`. + * + * @param string $key Meta key. + * @param mixed $value Meta value. + * @param bool $update Flag to update the queued meta. + */ + public function queue_meta_attribute( string $key, $value, bool $update = true ): void; + + /** + * Store queued model meta. + */ + public function store_queued_meta(): void; +} diff --git a/vendor/mantle-framework/contracts/database/interface-registrable-fields.php b/vendor/mantle-framework/contracts/database/interface-registrable-fields.php new file mode 100644 index 00000000..02bd5cd4 --- /dev/null +++ b/vendor/mantle-framework/contracts/database/interface-registrable-fields.php @@ -0,0 +1,20 @@ +<?php +/** + * Registrable interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Database; + +/** + * Registrable Fields Model Interface + * + * Provides methods to register a model's fields automatically. + */ +interface Registrable_Fields { + /** + * Method to register the model's fields. + */ + public static function register_fields(); +} diff --git a/vendor/mantle-framework/contracts/database/interface-registrable-meta.php b/vendor/mantle-framework/contracts/database/interface-registrable-meta.php new file mode 100644 index 00000000..2b16f3d3 --- /dev/null +++ b/vendor/mantle-framework/contracts/database/interface-registrable-meta.php @@ -0,0 +1,49 @@ +<?php +/** + * Registrable_Meta class file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Database; + +/** + * Registrable Model Meta Interface + * + * Provides methods to register a model's meta automatically. + */ +interface Registrable_Meta { + /** + * Register a meta field for the model. + * + * @see register_meta() + * + * @param string $meta_key Meta key to register. + * @param array $args { + * Data used to describe the meta key when registered. + * + * @type string $object_subtype A subtype; e.g. if the object type is "post", the post type. If left empty, + * the meta key will be registered on the entire object type. Default empty. + * @type string $type The type of data associated with this meta key. + * Valid values are 'string', 'boolean', 'integer', 'number', 'array', and 'object'. + * @type string $description A description of the data attached to this meta key. + * @type bool $single Whether the meta key has one value per object, or an array of values per object. + * @type mixed $default The default value returned from get_metadata() if no value has been set yet. + * When using a non-single meta key, the default value is for the first entry. + * In other words, when calling get_metadata() with `$single` set to `false`, + * the default value given here will be wrapped in an array. + * @type callable $sanitize_callback A function or method to call when sanitizing `$meta_key` data. + * @type callable $auth_callback Optional. A function or method to call when performing edit_post_meta, + * add_post_meta, and delete_post_meta capability checks. + * @type bool|array $show_in_rest Whether data associated with this meta key can be considered public and + * should be accessible via the REST API. A custom post type must also declare + * support for custom fields for registered meta to be accessible via REST. + * When registering complex meta values this argument may optionally be an + * array with 'schema' or 'prepare_callback' keys instead of a boolean. + * } + * @return bool True if the meta key was successfully registered in the global array, false if not. + * Registering a meta key with distinct sanitize and auth callbacks will fire those callbacks, + * but will not add to the global registry. + */ + public static function register_meta( string $meta_key, array $args = [] ): bool; +} diff --git a/vendor/mantle-framework/contracts/database/interface-registrable.php b/vendor/mantle-framework/contracts/database/interface-registrable.php new file mode 100644 index 00000000..a5045e97 --- /dev/null +++ b/vendor/mantle-framework/contracts/database/interface-registrable.php @@ -0,0 +1,26 @@ +<?php +/** + * Registrable interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Database; + +/** + * Registrable Model Interface + * + * Provides methods to register a model with WordPress either through a post type or + * a custom taxonomy. + */ +interface Registrable { + /** + * Method to register the model. + */ + public static function register_object(); + + /** + * Arguments to register the model with. + */ + public static function get_registration_args(): array; +} diff --git a/vendor/mantle-framework/contracts/database/interface-scope.php b/vendor/mantle-framework/contracts/database/interface-scope.php new file mode 100644 index 00000000..6c4a6cdf --- /dev/null +++ b/vendor/mantle-framework/contracts/database/interface-scope.php @@ -0,0 +1,24 @@ +<?php +/** + * Scope interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Database; + +use Mantle\Database\Model\Model; +use Mantle\Database\Query\Builder; + +/** + * Query Scope Contract + */ +interface Scope { + /** + * Apply the scope to a given query builder. + * + * @param Builder $builder Query Builder instance. + * @param Model $model Model object. + */ + public function apply( Builder $builder, Model $model ); +} diff --git a/vendor/mantle-framework/contracts/database/interface-updatable.php b/vendor/mantle-framework/contracts/database/interface-updatable.php new file mode 100644 index 00000000..d511cd40 --- /dev/null +++ b/vendor/mantle-framework/contracts/database/interface-updatable.php @@ -0,0 +1,27 @@ +<?php +/** + * Updatable interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Database; + +/** + * Updatable Model Interface + */ +interface Updatable { + /** + * Save the model. + * + * @param array $attributes Attributes to save. + */ + public function save( array $attributes = [] ); + + /** + * Delete the model. + * + * @param bool $force Force delete the mode. + */ + public function delete( bool $force = false ); +} diff --git a/vendor/mantle-framework/contracts/events/interface-dispatcher.php b/vendor/mantle-framework/contracts/events/interface-dispatcher.php new file mode 100644 index 00000000..5c1739eb --- /dev/null +++ b/vendor/mantle-framework/contracts/events/interface-dispatcher.php @@ -0,0 +1,56 @@ +<?php +/** + * Dispatcher interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Events; + +/** + * Event Dispatcher Contract + */ +interface Dispatcher { + /** + * Register an event listener with the dispatcher. + * + * @param string|array $events + * @param \Closure|callable $listener + * @return void + */ + public function listen( $events, $listener ); + + /** + * Determine if a given event has listeners. + * + * @param string $event_name + */ + public function has_listeners( $event_name ): bool; + + /** + * Register an event subscriber with the dispatcher. + * + * @param object|string $subscriber + * @return void + */ + public function subscribe( $subscriber ); + + /** + * Dispatch an event and call the listeners. + * + * @param string|object $event Event name. + * @param mixed $payload Event payload. + * @return mixed + */ + public function dispatch( $event, $payload = [] ); + + /** + * Remove a set of listeners from the dispatcher. + * + * @param string $event Event to remove. + * @param callable|string $listener Listener to remove. + * @param int $priority Priority of the listener. + * @return void + */ + public function forget( $event, $listener = null, int $priority = 10 ); +} diff --git a/vendor/mantle-framework/contracts/exceptions/interface-handler.php b/vendor/mantle-framework/contracts/exceptions/interface-handler.php new file mode 100644 index 00000000..662b1f0b --- /dev/null +++ b/vendor/mantle-framework/contracts/exceptions/interface-handler.php @@ -0,0 +1,54 @@ +<?php +/** + * Handler interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Exceptions; + +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\HttpFoundation\Response as SymfonyResponse; +use Throwable; + +/** + * Error Handler Contract + */ +interface Handler { + /** + * Report or log an exception. + * + * @param Throwable $e Exception thrown. + * + * @throws \Exception Thrown on missing logger. + */ + public function report( Throwable $e ); + + /** + * Determine if the exception should be reported. + * + * @param Throwable $e Exception thrown. + * @return bool + */ + public function should_report( Throwable $e ); + + /** + * Render an exception into an HTTP response. + * + * @param \Mantle\Http\Request $request + * @param \Throwable $e Exception thrown. + * @return mixed + * + * @throws Throwable Thrown on error rendering. + */ + public function render( $request, Throwable $e ); + + /** + * Render an exception for the console. + * + * @param OutputInterface $output + * @param Throwable $e + * @return void + */ + public function render_for_console( OutputInterface $output, Throwable $e ); +} diff --git a/vendor/mantle-framework/contracts/filesystem/interface-filesystem-manager.php b/vendor/mantle-framework/contracts/filesystem/interface-filesystem-manager.php new file mode 100644 index 00000000..c060f21d --- /dev/null +++ b/vendor/mantle-framework/contracts/filesystem/interface-filesystem-manager.php @@ -0,0 +1,20 @@ +<?php +/** + * Filesystem_Manager interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Filesystem; + +/** + * Filesystem Manager Contract + */ +interface Filesystem_Manager { + /** + * Retrieve a filesystem disk. + * + * @param string $name Disk name. + */ + public function drive( string $name = null ): Filesystem; +} diff --git a/vendor/mantle-framework/contracts/filesystem/interface-filesystem.php b/vendor/mantle-framework/contracts/filesystem/interface-filesystem.php new file mode 100644 index 00000000..55a9f6b6 --- /dev/null +++ b/vendor/mantle-framework/contracts/filesystem/interface-filesystem.php @@ -0,0 +1,214 @@ +<?php +/** + * Filesystem interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Filesystem; + +/** + * Filesystem Contract + */ +interface Filesystem { + /** + * The public visibility setting. + * + * @var string + */ + public const VISIBILITY_PUBLIC = 'public'; + + /** + * The private visibility setting. + * + * @var string + */ + public const VISIBILITY_PRIVATE = 'private'; + + /** + * Get all (recursive) of the directories within a given directory. + * + * @param string $directory Directory name. + * @return string[] + */ + public function all_directories( string $directory = null ): array; + + /** + * Get all the directories within a given directory. + * + * @param string $directory Directory name. + * @param bool $recursive Flag if it should be recursive. + */ + public function directories( string $directory = null, bool $recursive = false ): array; + + /** + * Create a directory. + * + * @param string $path Path to create. + */ + public function make_directory( string $path ): bool; + + /** + * Recursively delete a directory. + * + * @param string $directory Directory name. + */ + public function delete_directory( string $directory ): bool; + + /** + * Get all of the files from the given directory (recursive). + * + * @param string $directory Directory name. + * @return string[] + */ + public function all_files( string $directory = null ): array; + + /** + * Get an array of all files in a directory. + * + * @param string $directory Directory name. + * @param bool $recursive Flag if recursive. + * @return string[] + */ + public function files( string $directory = null, bool $recursive = false ): array; + + /** + * Copy a file from one location to another. + * + * @param string $from From location. + * @param string $to To location. + */ + public function copy( string $from, string $to ): bool; + + /** + * Move a file from a location to another. + * + * @param string $from From location. + * @param string $to To location. + */ + public function move( string $from, string $to ): bool; + + /** + * Delete a file at the given paths. + * + * @param string|string[] $paths File paths. + */ + public function delete( $paths ): bool; + + /** + * Check if a file exists at a current path. + * + * @param string $path + */ + public function exists( string $path ): bool; + + /** + * Check if a file is missing at a given path. + * + * @param string $path File path. + */ + public function missing( string $path ): bool; + + /** + * Get the contents of a file. + * + * @param string $path File path. + * @return string|bool + */ + public function get( string $path ); + + /** + * Get the file's last modification time. + * + * @param string $path File path. + * @return int|bool + */ + public function last_modified( string $path ); + + /** + * Write the contents of a file. + * + * @param string $path File path. + * @param string|resource $contents File contents. + * @param array|string $options Options for the files or a string visibility. + */ + public function put( string $path, $contents, $options = [] ): bool; + + /** + * Retrieve the size of the file. + * + * @param string $path File path. + * @return int|bool + */ + public function size( string $path ); + + /** + * Read a file through a stream. + * + * @param string $path File path. + * @return resource|false The path resource or false on failure. + */ + public function read_stream( string $path ); + + /** + * Write a file through a stream. + * + * @param string $path File path. + * @param resource $resource File resource. + * @param array|string $options File options or string visibility. + */ + public function write_stream( string $path, $resource, $options = [] ): bool; + + /** + * Prepend to a file. + * + * @param string $path File to prepend. + * @param string $data Data to prepend. + * @param string $separator Separator from existing data. + * @return bool + */ + public function prepend( string $path, string $data, string $separator = PHP_EOL ); + + /** + * Append to a file. + * + * @param string $path File to append. + * @param string $data Data to append. + * @param string $separator Separator from existing data. + * @return bool + */ + public function append( $path, $data, $separator = PHP_EOL); + + /** + * Retrieve a file's visibility. + * + * @param string $path + */ + public function get_visibility( string $path ): string; + + /** + * Set the visibility for a file. + * + * @param string $path Path to set. + * @param string $visibility Visibility to set. + */ + public function set_visibility( string $path, string $visibility ): bool; + + /** + * Get the URL for the file at the given path. + * + * @param string $path Path to the file. + */ + public function url( string $path ): ?string; + + /** + * Get a temporary URL for the file at the given path. + * + * @param string $path File path. + * @param \DateTimeInterface $expiration File expiration. + * @param array $options Options for the URL. + * + * @throws \RuntimeException Thrown on missing temporary URL. + */ + public function temporary_url( string $path, $expiration, array $options = [] ): string; +} diff --git a/vendor/mantle-framework/contracts/framework/interface-bootloader.php b/vendor/mantle-framework/contracts/framework/interface-bootloader.php new file mode 100644 index 00000000..71628f86 --- /dev/null +++ b/vendor/mantle-framework/contracts/framework/interface-bootloader.php @@ -0,0 +1,30 @@ +<?php +/** + * Bootloader interface file + * + * @package Mantle + */ + +namespace Mantle\Contracts\Framework; + +use Closure; + +/** + * Bootloader Contract + * + * Used to instantiate the application and load the framework. + */ +interface Bootloader { + /** + * Boot the application given the current context. + */ + public function boot(): static; + + /** + * Bind to the container before booting. + * + * @param string $abstract Abstract to bind. + * @param Closure|string|null $concrete Concrete to bind. + */ + public function bind( string $abstract, Closure|string|null $concrete ): static; +} diff --git a/vendor/mantle-framework/contracts/http/interface-kernel.php b/vendor/mantle-framework/contracts/http/interface-kernel.php new file mode 100644 index 00000000..10406461 --- /dev/null +++ b/vendor/mantle-framework/contracts/http/interface-kernel.php @@ -0,0 +1,30 @@ +<?php +/** + * Kernel interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Http; + +use Mantle\Http\Request; +use Mantle\Http\Response; +/** + * Http Kernel + */ +interface Kernel { + /** + * Run the HTTP Application. + * + * @param Request $request Request object. + */ + public function handle( Request $request ); + + /** + * Terminate the HTTP request. + * + * @param Request $request Request object. + * @param Response $response Response object. + */ + public function terminate( Request $request, mixed $response ): void; +} diff --git a/vendor/mantle-framework/contracts/http/routing/interface-entity-router.php b/vendor/mantle-framework/contracts/http/routing/interface-entity-router.php new file mode 100644 index 00000000..1bd4ae73 --- /dev/null +++ b/vendor/mantle-framework/contracts/http/routing/interface-entity-router.php @@ -0,0 +1,22 @@ +<?php +/** + * Entity_Router interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Http\Routing; + +/** + * Entity Router Contract + */ +interface Entity_Router { + /** + * Add an entity to the router. + * + * @param Router $router Router instance. + * @param string $entity Entity class name. + * @param string $controller Controller class name. + */ + public function add( Router $router, string $entity, string $controller ): void; +} diff --git a/vendor/mantle-framework/contracts/http/routing/interface-response-factory.php b/vendor/mantle-framework/contracts/http/routing/interface-response-factory.php new file mode 100644 index 00000000..9a00d2d8 --- /dev/null +++ b/vendor/mantle-framework/contracts/http/routing/interface-response-factory.php @@ -0,0 +1,131 @@ +<?php +/** + * Response_Factory interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Http\Routing; + +use Symfony\Component\HttpFoundation\RedirectResponse; +use Mantle\Http\Response; +use Symfony\Component\HttpFoundation\JsonResponse; + +/** + * Response Factory Contract + */ +interface Response_Factory { + + /** + * Create a new response instance. + * + * @param string $content + * @param int $status + * @param array $headers + * @return Response + */ + public function make( $content = '', $status = 200, array $headers = [] ); + + /** + * Create a new "no content" response. + * + * @param int $status + * @param array $headers + * @return Response + */ + public function no_content( $status = 204, array $headers = [] ); + + /** + * Create a new response for a given view. + * + * @param string $slug View slug. + * @param string $name View name (optional). + * @param array $data Data to pass to the view. + * @param int $status Response status code. + * @param array $headers Additional headers. + * @return Response + */ + public function view( string $slug, $name = null, $data = [], $status = 200, array $headers = [] ); + + /** + * Create a new JSON response instance. + * + * @param mixed $data + * @param int $status + * @param array $headers + * @return JsonResponse + */ + public function json( $data = [], $status = 200, array $headers = [] ); + + /** + * Create a new JSONP response instance. + * + * @param string $callback + * @param mixed $data + * @param int $status + * @param array $headers + * @return JsonResponse + */ + public function jsonp( $callback, $data = [], $status = 200, array $headers = [] ); + + /** + * Create a new streamed response instance. + * + * @param \Closure $callback + * @param int $status + * @param array $headers + * @return \Symfony\Component\HttpFoundation\StreamedResponse + */ + public function stream( $callback, $status = 200, array $headers = []); + + /** + * Create a new streamed response instance as a file download. + * + * @param \Closure $callback + * @param string|null $name + * @param array $headers + * @param string|null $disposition + * @return \Symfony\Component\HttpFoundation\StreamedResponse + */ + public function stream_download( $callback, $name = null, array $headers = [], $disposition = 'attachment' ); + + /** + * Create a new file download response. + * + * @param \SplFileInfo|string $file + * @param string|null $name + * @param array $headers + * @param string|null $disposition + * @return \Symfony\Component\HttpFoundation\BinaryFileResponse + */ + public function download( $file, $name = null, array $headers = [], $disposition = 'attachment' ); + + /** + * Return the raw contents of a binary file. + * + * @param \SplFileInfo|string $file + * @param array $headers + * @return \Symfony\Component\HttpFoundation\BinaryFileResponse + */ + public function file( $file, array $headers = []); + + /** + * Create a new redirect response to the given path. + * + * @param string $path + * @param int $status + * @param array $headers + * @param bool|null $secure + */ + public function redirect_to( $path, $status = 302, $headers = [], $secure = null ): RedirectResponse; + + /** + * Create a new redirect response to a named route. + * + * @param string $route + * @param mixed $parameters + * @param int $status + * @param array $headers + */ + public function redirect_to_route( $route, $parameters = [], $status = 302, $headers = [] ): RedirectResponse; +} diff --git a/vendor/mantle-framework/contracts/http/routing/interface-router.php b/vendor/mantle-framework/contracts/http/routing/interface-router.php new file mode 100644 index 00000000..7328ad86 --- /dev/null +++ b/vendor/mantle-framework/contracts/http/routing/interface-router.php @@ -0,0 +1,153 @@ +<?php +/** + * Router interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Http\Routing; + +use Mantle\Http\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\RouteCollection; + +/** + * Router Contract + */ +interface Router { + /** + * Register a GET route. + * + * @param string $uri URL to register for. + * @param mixed $action Callback action. + */ + public function get( string $uri, $action = '' ); + + /** + * Register a POST route. + * + * @param string $uri URL to register for. + * @param mixed $action Callback action. + */ + public function post( string $uri, $action = '' ); + + /** + * Register a PUT route. + * + * @param string $uri URL to register for. + * @param mixed $action Callback action. + */ + public function put( string $uri, $action = '' ); + + /** + * Register a DELETE route. + * + * @param string $uri URL to register for. + * @param mixed $action Callback action. + */ + public function delete( string $uri, $action = '' ); + + /** + * Register a PATCH route. + * + * @param string $uri URL to register for. + * @param mixed $action Callback action. + */ + public function patch( string $uri, $action = '' ); + + /** + * Register a OPTIONS route. + * + * @param string $uri URL to register for. + * @param mixed $action Callback action. + */ + public function options( string $uri, $action = '' ); + + /** + * Register a route for any HTTP method. + * + * @param string $uri URL to register for. + * @param mixed $action Callback action. + */ + public function any( string $uri, $action = '' ); + + /** + * Dispatch a request to the registered routes. + * + * @param Request $request Request object. + */ + public function dispatch( Request $request ): ?Response; + + /** + * Get registered routes. + */ + public function get_routes(): RouteCollection; + + /** + * Substitute Explicit Bindings + * + * @param Request $request Request object. + */ + public function substitute_bindings( Request $request ); + + /** + * Substitute the implicit Eloquent model bindings for the route. + * + * @param Request $request Request instance. + */ + public function substitute_implicit_bindings( Request $request ); + + /** + * Register a REST API route + * + * @param string $namespace Namespace for the REST API route. + * @param callable|string $callback Callback that will be invoked to register + * routes OR a string route. + * @param array $args Callback for the route if $callback is a + * string route OR arguments to pass to + * the register_rest_route() call. Not used if $callback + * is a closure. + */ + public function rest_api( string $namespace, callable|string $callback, callable|array $args = [] ); + + /** + * Rename a route. + * + * @param string $old_name Old route name. + * @param string $new_name New route name. + * + * @throws \InvalidArgumentException Thrown when attempting to rename a route + * a name that is already taken. + */ + public function rename_route( string $old_name, string $new_name ): static; + + /** + * Register a group of middleware. + * + * @param string $name + * @param array $middleware + */ + public function middleware_group( string $name, array $middleware ): static; + + /** + * Register a short-hand name for a middleware. + * + * @param string $name + * @param string $class + */ + public function alias_middleware( string $name, string $class ): static; + + /** + * Determine if the request should pass through to WordPress. + * + * @param (callable(Request): bool)|bool $callback Callback to determine if the request should pass through to WordPress. + */ + public function pass_requests_to_wordpress( $callback ): static; + + /** + * Determine if the request should pass through to WordPress. + * + * @param Request $request Request object. + */ + public function should_pass_through_request( Request $request ): bool; +} diff --git a/vendor/mantle-framework/contracts/http/routing/interface-url-generator.php b/vendor/mantle-framework/contracts/http/routing/interface-url-generator.php new file mode 100644 index 00000000..53a36014 --- /dev/null +++ b/vendor/mantle-framework/contracts/http/routing/interface-url-generator.php @@ -0,0 +1,49 @@ +<?php +/** + * Url_Generator class file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Http\Routing; + +/** + * URL Generator + */ +interface Url_Generator { + /** + * Get the current URL for the request. + * + * @return string + */ + public function current(); + + /** + * Get the URL for the previous request. + * + * @param string $fallback Fallback value, optional. + */ + public function previous( string $fallback = null ): string; + + /** + * Generate a URL to a specific path. + * + * @param string $path URL Path. + * @param array<string, mixed> $extra_query Extra query parameters to be appended to the URL path. + * @param array $extra_params Extra parameters to be appended to the URL path. + * @param bool $secure Flag if should be forced to be secure. + * @return string + */ + public function to( string $path, array $extra_query = [], array $extra_params = [], bool $secure = null ); + + /** + * Generate a URL for a route. + * + * @param string $name Route name. + * @param array $parameters Route parameters. + * @param bool $absolute Flag if should be absolute. + * + * @throws \Symfony\Component\Routing\Exception\RouteNotFoundException If route not found. + */ + public function route( string $name, array $parameters = [], bool $absolute = true ): string; +} diff --git a/vendor/mantle-framework/contracts/http/routing/interface-url-routable.php b/vendor/mantle-framework/contracts/http/routing/interface-url-routable.php new file mode 100644 index 00000000..198e1d03 --- /dev/null +++ b/vendor/mantle-framework/contracts/http/routing/interface-url-routable.php @@ -0,0 +1,47 @@ +<?php +/** + * Url_Routable class file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Http\Routing; + +/** + * URL Routable Contract + * + * Provides an interface to route to a specific model. + */ +interface Url_Routable { + + /** + * Get the value of the model's route key. + * + * @return mixed + */ + public function get_route_key(); + + /** + * Get the route key for the model. + */ + public function get_route_key_name(): string; + + /** + * Get route for the model. + */ + public static function get_route(): ?string; + + /** + * Get archive route for the model. + */ + public static function get_archive_route(): ?string; + + /** + * Retrieve the model for a bound value. + * + * @param mixed $value + * @param string|null $field + * @return static|null + */ + public function resolve_route_binding( $value, $field = null ); +} diff --git a/vendor/mantle-framework/contracts/http/view/interface-factory.php b/vendor/mantle-framework/contracts/http/view/interface-factory.php new file mode 100644 index 00000000..92e492de --- /dev/null +++ b/vendor/mantle-framework/contracts/http/view/interface-factory.php @@ -0,0 +1,99 @@ +<?php +/** + * Factory interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Http\View; + +use Mantle\Http\View\View; +use Mantle\Support\Collection; + +/** + * View Factory Contract + */ +interface Factory { + /** + * Add a piece of shared data to the environment. + * + * @param array|string $key Key to share. + * @param mixed|null $value Value to share. + * @return mixed + */ + public function share( $key, $value = null ); + + /** + * Get an item from the shared data. + * + * @param string $key Key to get item by. + * @param mixed $default Default value. + * @return mixed + */ + public function shared( $key, $default = null ); + + /** + * Get all of the shared data for the environment. + */ + public function get_shared(): array; + + /** + * Create a collection of views that loop over a collection of WordPress objects. + * + * While iterating over the data, the proper post data is setup for each item. + * + * @param array|\ArrayAccess $data Array of WordPress data to loop over. + * @param string $slug View slug. + * @param array|string $name View name, optional. Supports passing variables in if + * $variables is not used. + * @param array $variables Variables for the view, optional. + */ + public function loop( $data, string $slug, $name = null, array $variables = [] ): Collection; + + /** + * Iterate over an array, loading a given template part for each item in the + * array. + * + * @param array|\ArrayAccess $data Array of data to iterate over over. + * @param string $slug View slug. + * @param array|string $name View name, optional. Supports passing variables in if + * $variables is not used. + * @param array $variables Variables for the view, optional. + */ + public function iterate( $data, string $slug, $name = null, array $variables = [] ): Collection; + + /** + * Get the rendered contents of a view. + * + * @param string $slug View slug. + * @param array|string $name View name, optional. Supports passing variables in if + * $variables is not used. + * @param array $variables Variables for the view, optional. + */ + public function make( string $slug, $name = null, array $variables = [] ): View; + + /** + * Get a variable from the current view. + * + * @param string $key Variable to get. + * @param mixed $default Default value if unset. + * @return mixed + */ + public function get_var( string $key, $default = null ); + + /** + * Push a view onto the stack and set it as the current view. + * + * @param View $view View being loaded. + * @return static + */ + public function push( View $view ); + + /** + * Pop a partial off the top of the stack and set the current partial to the + * next one down. + * + * @return static + */ + public function pop(); +} diff --git a/vendor/mantle-framework/contracts/http/view/interface-view-finder.php b/vendor/mantle-framework/contracts/http/view/interface-view-finder.php new file mode 100644 index 00000000..6a6d0e5e --- /dev/null +++ b/vendor/mantle-framework/contracts/http/view/interface-view-finder.php @@ -0,0 +1,48 @@ +<?php +/** + * View_Finder interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Http\View; + +/** + * View Loader Contract + */ +interface View_Finder { + /** + * Add a path to check against when loading a template. + * + * @param string $path Path to add. + * @return static + */ + public function add_path( string $path ); + + /** + * Remove a path to check against when loading a template. + * + * @param string $path Path to remove. + * @return static + */ + public function remove_path( string $path ); + + /** + * Remove all paths to check against. + * + * @return static + */ + public function clear_paths(); + + /** + * Load a template by template name. + * + * Acts as a replacement to `get_template_part()` to allow sites to load templates + * outside of a theme. + * + * @param string $slug Template slug. + * @param string $name Template name. + * @return string The template filename if one is located. + */ + public function load( string $slug, string $name = null ): string; +} diff --git a/vendor/mantle-framework/contracts/interface-application.php b/vendor/mantle-framework/contracts/interface-application.php new file mode 100644 index 00000000..1131097d --- /dev/null +++ b/vendor/mantle-framework/contracts/interface-application.php @@ -0,0 +1,220 @@ +<?php +/** + * Application Contract interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts; + +use RuntimeException; +use Mantle\Contracts\Kernel as Kernel_Contract; +use Mantle\Support\Service_Provider; + +/** + * Application Contract + */ +interface Application extends Container { + /** + * Getter for the base path. + * + * @param string $path Path to append. + */ + public function get_base_path( string $path = '' ): string; + + /** + * Set the base path for a application. + * + * @param string $path Path to set. + */ + public function set_base_path( string $path ); + + /** + * Get the path to the application "app" directory. + * + * @param string $path Path to append, optional. + */ + public function get_app_path( string $path = '' ): string; + + /** + * Set the application directory. + * + * @param string $path Path to use. + * @return static + */ + public function set_app_path( string $path ); + + /** + * Getter for the bootstrap path. + * + * @param string $path Path to append. + */ + public function get_bootstrap_path( string $path = '' ): string; + + /** + * Set the root URL of the application. + * + * @param string $url Root URL to set. + */ + public function set_root_url( string $url ); + + /** + * Getter for the root URL. + * This would be the root URL to the WordPress installation. + * + * @param string $path Path to append. + */ + public function get_root_url( string $path = '' ): string; + + /** + * Get the cache folder root. + * Folder that stores all compiled server-side assets for the application. + */ + public function get_cache_path(): string; + + /** + * Get the cached Composer packages path. + * + * Used to store all auto-loaded packages that are Composer dependencies. + */ + public function get_cached_packages_path(): string; + + /** + * Get the cached model manifest path. + * Used to store all auto-registered models that are in the application. + */ + public function get_cached_models_path(): string; + + /** + * Get the path to the application configuration files. + */ + public function get_config_path(): string; + + /** + * Determine if the application has been bootstrapped before. + */ + public function has_been_bootstrapped(): bool; + + /** + * Get the Application's Environment + */ + public function environment(): string; + + /** + * Check if the Application's Environment matches a list. + * + * @param string|array ...$environments Environments to check. + */ + public function is_environment( ...$environments ): bool; + + /** + * Get the application namespace. + * + * @throws RuntimeException Thrown on error determining namespace. + */ + public function get_namespace(): string; + + /** + * Alias to get_namespace(). + * + * @throws RuntimeException Thrown on error determining namespace. + */ + public function namespace(): string; + + /** + * Check if the application is running in the console. + */ + public function is_running_in_console(): bool; + + /** + * Check if the application is running in console isolation mode. + */ + public function is_running_in_console_isolation(): bool; + + /** + * Determine if the application has booted. + */ + public function is_booted(): bool; + + /** + * Boot the application's service providers. + */ + public function boot(); + + /** + * Register a new boot listener. + * + * @param callable $callback Callback for the listener. + */ + public function booting( callable $callback ): static; + + /** + * Register a new "booted" listener. + * + * @param callable $callback Callback for the listener. + */ + public function booted( callable $callback ): static; + + /** + * Register a new terminating callback. + * + * @param callable $callback Callback for the listener. + */ + public function terminating( callable $callback ): static; + + /** + * Terminate the application. + */ + public function terminate(): void; + + /** + * Run the given array of bootstrap classes. + * + * Bootstrap classes should implement `Mantle\Contracts\Bootstrapable`. + * + * @param string[] $bootstrappers Class names of packages to boot. + * @param Kernel_Contract $kernel Kernel instance. + */ + public function bootstrap_with( array $bootstrappers, Kernel_Contract $kernel ); + + /** + * Get an instance of a service provider. + * + * @param string $name Provider class name. + */ + public function get_provider( string $name ): ?Service_Provider; + + /** + * Get all service providers. + * + * @return Service_Provider[] + */ + public function get_providers(): array; + + /** + * Determine if the application is cached. + */ + public function is_configuration_cached(): bool; + + /** + * Retrieve the cached configuration path. + */ + public function get_cached_config_path(): string; + + /** + * Determine if events are cached. + */ + public function is_events_cached(): bool; + + /** + * Retrieve the cached configuration path. + */ + public function get_cached_events_path(): string; + + /** + * Register a service provider. + * + * @param Service_Provider|class-string<Service_Provider> $provider Provider to register. + */ + public function register( Service_Provider|string $provider ): static; +} diff --git a/vendor/mantle-framework/contracts/interface-block.php b/vendor/mantle-framework/contracts/interface-block.php new file mode 100644 index 00000000..557f47e3 --- /dev/null +++ b/vendor/mantle-framework/contracts/interface-block.php @@ -0,0 +1,19 @@ +<?php +/** + * Block interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts; + +/** + * Block Contract + */ +interface Block { + /** + * Executed by the Block Service Provider to handle registering the block + * with Mantle and WordPress. + */ + public function register(): void; +} diff --git a/vendor/mantle-framework/contracts/interface-bootstrapable.php b/vendor/mantle-framework/contracts/interface-bootstrapable.php new file mode 100644 index 00000000..1ec645f1 --- /dev/null +++ b/vendor/mantle-framework/contracts/interface-bootstrapable.php @@ -0,0 +1,22 @@ +<?php +/** + * Bootstrapable interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts; + +use Mantle\Application\Application; + +/** + * Bootstrapable Contract + */ +interface Bootstrapable { + /** + * Bootstrap method. + * + * @param Application $app Application instance. + */ + public function bootstrap( Application $app ); +} diff --git a/vendor/mantle-framework/contracts/interface-container.php b/vendor/mantle-framework/contracts/interface-container.php new file mode 100644 index 00000000..1e378ae6 --- /dev/null +++ b/vendor/mantle-framework/contracts/interface-container.php @@ -0,0 +1,138 @@ +<?php +/** + * Container Contract + * + * @package Mantle + */ + +namespace Mantle\Contracts; + +use Closure; +use Psr\Container\ContainerInterface; + +/** + * Container Contract + */ +interface Container extends ContainerInterface { + /** + * Determine if the given abstract type has been bound. + * + * @param string $abstract Abstract name. + * @return bool + */ + public function bound( $abstract ); + + /** + * Alias a type to a different name. + * + * @param string $abstract Abstract name. + * @param string $alias Alias name. + */ + public function alias( $abstract, $alias ); + + /** + * Register a binding with the container. + * + * @param string $abstract Abstract name. + * @param \Closure|string|null $concrete Concrete to bind. + * @param bool $shared Shared flag. + */ + public function bind( $abstract, $concrete = null, $shared = false ); + + /** + * Register a binding if it hasn't already been registered. + * + * @param string $abstract Abstract name. + * @param \Closure|string|null $concrete Concrete to bind. + * @param bool $shared Shared flag. + */ + public function bind_if( $abstract, $concrete = null, $shared = false ); + + /** + * Register a shared binding in the container. + * + * @param string $abstract Abstract name. + * @param \Closure|string|null $concrete Concrete to bind. + */ + public function singleton( $abstract, $concrete = null ); + + /** + * Register a shared binding if it hasn't already been registered. + * + * @param string $abstract Abstract name. + * @param \Closure|string|null $concrete Concrete name. + */ + public function singleton_if( $abstract, $concrete = null ); + + /** + * "Extend" an abstract type in the container. + * + * @param string $abstract Abstract name. + * @param \Closure $closure Closure callback. + */ + public function extend( $abstract, Closure $closure); + + /** + * Register an existing instance as shared in the container. + * + * @param string $abstract Abstract name. + * @param mixed $instance Interface instance. + */ + public function instance( $abstract, $instance ); + + /** + * Get a closure to resolve the given type from the container. + * + * @param string $abstract Abstract name. + * @return \Closure + */ + public function factory( $abstract ); + + /** + * Flush the container of all bindings and resolved instances. + */ + public function flush(); + + /** + * Call the given Closure / class@method and inject its dependencies. + * + * @param callable|string $callback + * @param array $parameters + * @param string|null $default_method + * @return mixed + */ + public function call( $callback, array $parameters = [], $default_method = null ); + + /** + * Resolve the given type from the container. + * + * @param string $abstract Abstract name. + * @param array $parameters Parameters to pass. + * @return mixed + */ + public function make( $abstract, array $parameters = [] ); + + /** + * Determine if the given abstract type has been resolved. + * + * @param string $abstract Abstract name. + * @return bool + */ + public function resolved( $abstract ); + + /** + * Register a new resolving callback. + * + * @param \Closure|string $abstract Abstract name. + * @param \Closure|null $callback Callback. + */ + public function resolving( $abstract, Closure $callback = null ); + + /** + * Register a new after resolving callback. + * + * @param \Closure|string $abstract Abstract name. + * @param \Closure|null $callback Callback. + */ + public function after_resolving( $abstract, Closure $callback = null ); +} diff --git a/vendor/mantle-framework/contracts/interface-kernel.php b/vendor/mantle-framework/contracts/interface-kernel.php new file mode 100644 index 00000000..0cb72df2 --- /dev/null +++ b/vendor/mantle-framework/contracts/interface-kernel.php @@ -0,0 +1,13 @@ +<?php +/** + * Kernel interface. + * + * @package Mantle + */ + +namespace Mantle\Contracts; + +/** + * Core Kernel Interface + */ +interface Kernel { } diff --git a/vendor/mantle-framework/contracts/interface-pipeline.php b/vendor/mantle-framework/contracts/interface-pipeline.php new file mode 100644 index 00000000..8c742d88 --- /dev/null +++ b/vendor/mantle-framework/contracts/interface-pipeline.php @@ -0,0 +1,48 @@ +<?php +/** + * Pipeline interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts; + +use Closure; + +/** + * Pipeline Contract + */ +interface Pipeline { + + /** + * Set the traveler object being sent on the pipeline. + * + * @param mixed $traveler + * @return $this + */ + public function send( $traveler ); + + /** + * Set the stops of the pipeline. + * + * @param array<callable>|null $stops + * @return $this + */ + public function through( $stops ); + + /** + * Set the method to call on the stops. + * + * @param string $method + * @return $this + */ + public function via( $method ); + + /** + * Run the pipeline with a final destination callback. + * + * @param \Closure $destination + * @return mixed + */ + public function then( Closure $destination ); +} diff --git a/vendor/mantle-framework/contracts/paginator/interface-paginator.php b/vendor/mantle-framework/contracts/paginator/interface-paginator.php new file mode 100644 index 00000000..0dbd04ce --- /dev/null +++ b/vendor/mantle-framework/contracts/paginator/interface-paginator.php @@ -0,0 +1,96 @@ +<?php +/** + * Paginator interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Paginator; + +use Mantle\Support\Collection; + +/** + * Paginator Contract + */ +interface Paginator { + /** + * Set the path for the paginator. + * + * @param string $path Path to set. + * @return static + */ + public function path( string $path = null ); + + /** + * Retrieve the paginator's path. + */ + public function get_path(): string; + + /** + * Flag to use query string for pagination. + * + * @return static + */ + public function use_query_string(); + + /** + * Flag to use path for pagination. + * + * @return static + */ + public function use_path(); + + /** + * Set the current page. + * + * @param int $current_page Page to set. + * @return static + */ + public function set_current_page( int $current_page = null ); + + /** + * Retrieve the current page. + */ + public function current_page(): int; + + /** + * Retrieve the items in the paginator. + */ + public function items(): Collection; + + /** + * Retrieve the count of the paginator. + */ + public function count(): int; + + /** + * Append a query variable or set multiple query variables. + * + * @param string $key Query variable or an array of key value query variables. + * @param mixed $value Variable value. + * @return static + */ + public function append( $key, $value = null ); + + /** + * Set the paginator to use the current query variables from the request. + * + * @return static + */ + public function with_query_string(); + + /** + * Retrieve the query variables for the paginator. + */ + public function query(): array; + + /** + * Retrieve the next URL. + */ + public function next_url(): ?string; + + /** + * Retrieve the previous URL. + */ + public function previous_url(): ?string; +} diff --git a/vendor/mantle-framework/contracts/queue/interface-can-queue.php b/vendor/mantle-framework/contracts/queue/interface-can-queue.php new file mode 100644 index 00000000..dc45f823 --- /dev/null +++ b/vendor/mantle-framework/contracts/queue/interface-can-queue.php @@ -0,0 +1,13 @@ +<?php +/** + * Can_Queue interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Queue; + +/** + * Contract to allow a job to be added to a asynchronous queue. + */ +interface Can_Queue { } diff --git a/vendor/mantle-framework/contracts/queue/interface-dispatcher.php b/vendor/mantle-framework/contracts/queue/interface-dispatcher.php new file mode 100644 index 00000000..34729042 --- /dev/null +++ b/vendor/mantle-framework/contracts/queue/interface-dispatcher.php @@ -0,0 +1,29 @@ +<?php +/** + * Dispatcher interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Queue; + +/** + * Queue Dispatcher + */ +interface Dispatcher { + /** + * Dispatch the job to the queue to be handled asynchronously. + * + * @param mixed $job Job instance. + * @return mixed + */ + public function dispatch( $job ); + + /** + * Dispatch the job to the queue to be executed now. + * + * @param mixed $job Job instance. + * @return mixed + */ + public function dispatch_now( $job ); +} diff --git a/vendor/mantle-framework/contracts/queue/interface-job.php b/vendor/mantle-framework/contracts/queue/interface-job.php new file mode 100644 index 00000000..cb1c425d --- /dev/null +++ b/vendor/mantle-framework/contracts/queue/interface-job.php @@ -0,0 +1,18 @@ +<?php +/** + * Job interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Queue; + +/** + * Job interface. + */ +interface Job { + /** + * Handle the job. + */ + public function handle(); +} diff --git a/vendor/mantle-framework/contracts/queue/interface-provider.php b/vendor/mantle-framework/contracts/queue/interface-provider.php new file mode 100644 index 00000000..8fe85d0c --- /dev/null +++ b/vendor/mantle-framework/contracts/queue/interface-provider.php @@ -0,0 +1,45 @@ +<?php +/** + * Provider interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Queue; + +use Mantle\Support\Collection; + +/** + * Queue Provider Contract + */ +interface Provider { + /** + * Push a job to the queue. + * + * @param mixed $job Job instance. + */ + public function push( $job ): bool; + + /** + * Get the next set of jobs in the queue. + * + * @param string $queue Queue name, optional. + * @param int $count Number of items to return. + */ + public function pop( string $queue = null, int $count = 1 ): Collection; + + /** + * Check if a job is in the queue. + * + * @param mixed $job Job instance. + * @param string $queue Queue to compare against. + */ + public function in_queue( mixed $job, string $queue = null ): bool; + + /** + * Retrieve the number of pending jobs in the queue. + * + * @param string $queue Queue name, optional. + */ + public function pending_count( string $queue = null ): int; +} diff --git a/vendor/mantle-framework/contracts/queue/interface-queue-manager.php b/vendor/mantle-framework/contracts/queue/interface-queue-manager.php new file mode 100644 index 00000000..fed776e4 --- /dev/null +++ b/vendor/mantle-framework/contracts/queue/interface-queue-manager.php @@ -0,0 +1,29 @@ +<?php +/** + * Queue_Manager class file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Queue; + +/** + * Queue Manager Contract + */ +interface Queue_Manager { + /** + * Get a queue provider instance. + * + * @param string $name Provider name, optional. + */ + public function get_provider( string $name = null ): Provider; + + /** + * Add a provider for the queue manager. + * + * @param string $name Provider name. + * @param string $class_name Provider class name. + * @return static + */ + public function add_provider( string $name, string $class_name ); +} diff --git a/vendor/mantle-framework/contracts/rest-api/interface-rest-field-get-callback.php b/vendor/mantle-framework/contracts/rest-api/interface-rest-field-get-callback.php new file mode 100644 index 00000000..d396f92e --- /dev/null +++ b/vendor/mantle-framework/contracts/rest-api/interface-rest-field-get-callback.php @@ -0,0 +1,24 @@ +<?php +/** + * Interface file for REST_Get_Callback + * + * @package Mantle + */ + +namespace Mantle\Contracts\Rest_Api; + +/** + * Specifies a REST API field that implements a `get_callback()`. + */ +interface REST_Field_Get_Callback { + /** + * The callback function used to retrieve the field value. + * + * @param array $object REST API object. + * @param string $field_name Field name. + * @param \WP_REST_Request $request REST API request. + * @param string $object_type Object type. + * @return mixed Field value. + */ + public function get_callback( $object, string $field_name, \WP_REST_Request $request, string $object_type ); +} diff --git a/vendor/mantle-framework/contracts/rest-api/interface-rest-field-schema.php b/vendor/mantle-framework/contracts/rest-api/interface-rest-field-schema.php new file mode 100644 index 00000000..35adbe39 --- /dev/null +++ b/vendor/mantle-framework/contracts/rest-api/interface-rest-field-schema.php @@ -0,0 +1,20 @@ +<?php +/** + * Interface file for REST_Field_Schema + * + * @package Mantle + */ + +namespace Mantle\Contracts\REST_API; + +/** + * Specifies a REST field that has schema. + */ +interface REST_Field_Schema { + /** + * Get the field schema, if any. + * + * @return array|null Typically a schema array, but could be null. + */ + public function get_schema(): ?array; +} diff --git a/vendor/mantle-framework/contracts/rest-api/interface-rest-field-update-callback.php b/vendor/mantle-framework/contracts/rest-api/interface-rest-field-update-callback.php new file mode 100644 index 00000000..4cf16bb1 --- /dev/null +++ b/vendor/mantle-framework/contracts/rest-api/interface-rest-field-update-callback.php @@ -0,0 +1,25 @@ +<?php +/** + * Interface file for REST_Update_Callback + * + * @package Mantle + */ + +namespace Mantle\Contracts\REST_API; + +/** + * Specifies a REST field that implements an `update_callback()`. + */ +interface REST_Field_Update_Callback { + /** + * The callback function used to update the field value. + * + * @param mixed $value Submitted field value. + * @param mixed $object REST API data object. + * @param string $field_name Field name. + * @param \WP_REST_Request $request REST API request. + * @param string $object_type Object type. + * @return mixed True on success, \WP_Error object if a field cannot be updated. + */ + public function update_callback( $value, $object, string $field_name, \WP_REST_Request $request, string $object_type ); +} diff --git a/vendor/mantle-framework/contracts/rest-api/interface-rest-field-with-schema.php b/vendor/mantle-framework/contracts/rest-api/interface-rest-field-with-schema.php new file mode 100644 index 00000000..06d2d55b --- /dev/null +++ b/vendor/mantle-framework/contracts/rest-api/interface-rest-field-with-schema.php @@ -0,0 +1,13 @@ +<?php +/** + * Interface file for REST_Field_With_Schema + * + * @package Mantle + */ + +namespace Mantle\Contracts\REST_API; + +/** + * Specifies a REST field that has schema. + */ +interface REST_Field_With_Schema extends REST_Field, REST_Field_Schema {} diff --git a/vendor/mantle-framework/contracts/rest-api/interface-rest-field.php b/vendor/mantle-framework/contracts/rest-api/interface-rest-field.php new file mode 100644 index 00000000..4358c725 --- /dev/null +++ b/vendor/mantle-framework/contracts/rest-api/interface-rest-field.php @@ -0,0 +1,29 @@ +<?php +/** + * Interface file for REST_Field + * + * @package Mantle + */ + +namespace Mantle\Contracts\REST_API; + +/** + * Specifies a registrable REST API field. + * + * @see register_rest_field(). + */ +interface REST_Field { + /** + * Get the object(s) the field is being registered to. + * + * @return string|array Object type or types. + */ + public function get_object_types(); + + /** + * Get the attribute name. + * + * @return string Attribute name. + */ + public function get_attribute(): string; +} diff --git a/vendor/mantle-framework/contracts/support/interface-arrayable.php b/vendor/mantle-framework/contracts/support/interface-arrayable.php new file mode 100644 index 00000000..d38e788a --- /dev/null +++ b/vendor/mantle-framework/contracts/support/interface-arrayable.php @@ -0,0 +1,23 @@ +<?php +/** + * Arrayable interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Support; + +/** + * Arrayable interface. + * + * @template TKey of array-key + * @template TValue + */ +interface Arrayable { + /** + * Get the instance as an array. + * + * @return array<TKey, TValue> + */ + public function to_array(); +} diff --git a/vendor/mantle-framework/contracts/support/interface-htmlable.php b/vendor/mantle-framework/contracts/support/interface-htmlable.php new file mode 100644 index 00000000..0f90e868 --- /dev/null +++ b/vendor/mantle-framework/contracts/support/interface-htmlable.php @@ -0,0 +1,18 @@ +<?php +/** + * Htmlable interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Support; + +interface Htmlable { + + /** + * Get content as a string of HTML. + * + * @return string + */ + public function to_html(); +} diff --git a/vendor/mantle-framework/contracts/support/interface-isolated-service-provider.php b/vendor/mantle-framework/contracts/support/interface-isolated-service-provider.php new file mode 100644 index 00000000..5f1870c1 --- /dev/null +++ b/vendor/mantle-framework/contracts/support/interface-isolated-service-provider.php @@ -0,0 +1,20 @@ +<?php +/** + * Isolated_Service_Provider interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\Support; + +/** + * Isolated Service Provider + * + * A service provider that is isolated from the dependency on WordPress. This + * service provider will be registered when the application is running in + * isolation mode (a non-WordPress environment). The main use case is for + * service providers that are required when running vendor/bin/mantle versus the + * 'wp mantle' WP-CLI command. + */ +interface Isolated_Service_Provider { +} diff --git a/vendor/mantle-framework/contracts/support/interface-jsonable.php b/vendor/mantle-framework/contracts/support/interface-jsonable.php new file mode 100644 index 00000000..cf4e3f98 --- /dev/null +++ b/vendor/mantle-framework/contracts/support/interface-jsonable.php @@ -0,0 +1,13 @@ +<?php + +namespace Mantle\Contracts\Support; + +interface Jsonable { + /** + * Convert the object to its JSON representation. + * + * @param int $options json_encode() options. + * @return string + */ + public function to_json( $options = 0 ); +} diff --git a/vendor/mantle-framework/contracts/view/interface-engine.php b/vendor/mantle-framework/contracts/view/interface-engine.php new file mode 100644 index 00000000..e6aa2c1f --- /dev/null +++ b/vendor/mantle-framework/contracts/view/interface-engine.php @@ -0,0 +1,21 @@ +<?php +/** + * Engine interface file. + * + * @package Mantle + */ + +namespace Mantle\Contracts\View; + +/** + * Engine Interface + */ +interface Engine { + /** + * Get the evaluated contents of the view. + * + * @param string $path View path. + * @param array $data View data. + */ + public function get( string $path, array $data = [] ): string; +} diff --git a/vendor/mantle-framework/database/LICENSE b/vendor/mantle-framework/database/LICENSE new file mode 100644 index 00000000..d159169d --- /dev/null +++ b/vendor/mantle-framework/database/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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. + + <signature of Ty Coon>, 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/vendor/mantle-framework/database/class-factory-service-provider.php b/vendor/mantle-framework/database/class-factory-service-provider.php new file mode 100644 index 00000000..b8fd3a14 --- /dev/null +++ b/vendor/mantle-framework/database/class-factory-service-provider.php @@ -0,0 +1,62 @@ +<?php +/** + * Factory_Service_Provider class file. + * + * @package Mantle + */ + +// phpcs:ignoreFile: WordPressVIPMinimum.Variables.VariableAnalysis.StaticInsideClosure + +namespace Mantle\Database; + +use Faker\Factory; +use Faker\Generator as FakerGenerator; +use Mantle\Faker\Faker_Provider; +use Mantle\Support\Service_Provider; + +/** + * Database Factory + */ +class Factory_Service_Provider extends Service_Provider { + /** + * The array of resolved Faker instances. + * + * @var \Faker\Generator[] + */ + protected static $fakers = []; + + /** + * Register any application services. + */ + public function register(): void { + $this->add_command( Console\Seed_Command::class ); + + $this->register_mantle_factory(); + } + + /** + * Register the Mantle factory instance in the container. + * + * @return void + */ + protected function register_mantle_factory() { + $this->app->singleton( + FakerGenerator::class, + function ( $app, $parameters ) { + $locale = config( 'app.faker_locale', Factory::DEFAULT_LOCALE ); + + if ( ! isset( static::$fakers[ $locale ] ) ) { + static::$fakers[ $locale ] = Factory::create( $locale ); + + static::$fakers[ $locale ]->addProvider( + new Faker_Provider( static::$fakers[ $locale ] ) + ); + } + + static::$fakers[ $locale ]->unique( true ); + + return static::$fakers[ $locale ]; + } + ); + } +} diff --git a/vendor/mantle-framework/database/class-model-service-provider.php b/vendor/mantle-framework/database/class-model-service-provider.php new file mode 100644 index 00000000..fc81f217 --- /dev/null +++ b/vendor/mantle-framework/database/class-model-service-provider.php @@ -0,0 +1,87 @@ +<?php +/** + * Model_Register class file. + * + * @package Mantle + */ + +namespace Mantle\Database; + +use Mantle\Database\Model\Model; +use Mantle\Database\Model\Relations\Relation; +use Mantle\Framework\Manifest\Model_Manifest; +use Mantle\Support\Attributes\Action; +use Mantle\Support\Service_Provider; + +/** + * Model Service Provider + */ +class Model_Service_Provider extends Service_Provider { + /** + * Models to register for the application. + * + * @var string[] + */ + protected $models = []; + + /** + * Register the service provider. + */ + public function register(): void { + } + + /** + * Bootstrap the service provider. + */ + public function boot(): void { + // Allow the configuration to disable discovery. + if ( $this->app['config']->get( 'models.disable_discovery', false ) ) { + return; + } + + $configuration = (array) $this->app['config']->get( 'models.register', [] ); + + // Allows models to always be booted on each request to register whatever side-effects they desire. + $this->set_models_to_register( + array_merge( + $configuration, + $this->app[ Model_Manifest::class ]->models() + ) + ); + + if ( empty( $this->models ) ) { + return; + } + + foreach ( $this->models as $model ) { + if ( class_exists( $model ) ) { + $model::boot_if_not_booted(); + } + } + } + + /** + * Set the models to register. + * + * @param string[] $models Models to register. + */ + public function set_models_to_register( array $models ): void { + $this->models = array_unique( $models ); + } + + /** + * Register the internal taxonomy for post <--> post relationships. + */ + #[Action( 'init', 5 )] + public static function register_internal_taxonomy(): void { + register_taxonomy( + Relation::RELATION_TAXONOMY, + array_keys( get_post_types() ), + [ + 'public' => false, + 'rewrite' => false, + 'show_in_rest' => false, + ] + ); + } +} diff --git a/vendor/mantle-framework/database/class-seeder.php b/vendor/mantle-framework/database/class-seeder.php new file mode 100644 index 00000000..5a0aed83 --- /dev/null +++ b/vendor/mantle-framework/database/class-seeder.php @@ -0,0 +1,136 @@ +<?php +/** + * Seeder class file. + * + * @package Mantle + */ + +namespace Mantle\Database; + +use InvalidArgumentException; +use Mantle\Console\Command; +use Mantle\Contracts\Container; +use Mantle\Support\Arr; + +/** + * Base Database Seeder + */ +abstract class Seeder { + /** + * The container instance. + * + * @var Container|null + */ + protected $container; + + /** + * The console command instance. + * + * @var Command|null + */ + protected $command; + + /** + * Seed the given connection from the given path. + * + * @param array<class-string>|string $class Seed to run. + * @param bool $silent Flag if the seed should be silent. + * @param array $parameters Parameters to pass to the seeder. + */ + public function call( $class, bool $silent = false, array $parameters = [] ): static { + $classes = Arr::wrap( $class ); + + foreach ( $classes as $class ) { + $seeder = $this->resolve( $class ); + $name = $seeder::class; + + if ( ! $silent && isset( $this->command ) ) { + $this->command->line( "Seeding: {$name}" ); + } + + $start_time = microtime( true ); + + $seeder( $parameters ); + + $run_time = number_format( ( microtime( true ) - $start_time ) * 1000, 2 ); + + if ( ! $silent && isset( $this->command ) ) { + $this->command->line( "Seeded: {$name} ({$run_time} seconds)" ); + } + } + + return $this; + } + + /** + * Run the given seeder class with the given arguments. + * + * @param array<class-string>|string $class Seed to run. + * @param array $parameters Parameters to pass to the seeder. + */ + public function call_with( $class, array $parameters = [] ): static { + return $this->call( $class, false, $parameters ); + } + + /** + * Resolve an instance of the given seeder class. + * + * @throws InvalidArgumentException If the class is not an instance of Seeder. + * + * @param class-string $class Seeder class to resolve. + */ + protected function resolve( string $class ): Seeder { + if ( isset( $this->container ) ) { + $instance = $this->container->make( $class ); + + $instance->set_container( $this->container ); + } else { + $instance = new $class(); + } + + if ( ! $instance instanceof Seeder ) { + throw new InvalidArgumentException( "Class [{$class}] must be an instance of " . self::class ); + } + + return $instance; + } + + /** + * Set the IoC container instance. + * + * @param Container $container IoC container. + */ + public function set_container( Container $container ): static { + $this->container = $container; + + return $this; + } + + /** + * Set the command instance instance. + * + * @param Command $command + */ + public function set_command( Command $command ): static { + $this->command = $command; + + return $this; + } + + /** + * Run the database seeds. + * + * @param array $parameters Parameters to pass to the seeder. + * + * @throws InvalidArgumentException Thrown on bad seeder class. + */ + public function __invoke( array $parameters = [] ): mixed { + if ( ! method_exists( $this, 'run' ) ) { + throw new InvalidArgumentException( 'Method [run] missing from ' . static::class ); + } + + return isset( $this->container ) + ? $this->container->call( [ $this, 'run' ], $parameters ) + : $this->run( $parameters ); + } +} diff --git a/vendor/mantle-framework/database/composer.json b/vendor/mantle-framework/database/composer.json new file mode 100644 index 00000000..b29c9f76 --- /dev/null +++ b/vendor/mantle-framework/database/composer.json @@ -0,0 +1,32 @@ +{ + "name": "mantle-framework/database", + "description": "The Mantle Framework Database Package", + "type": "library", + "require": { + "php": "^8.1", + "alleyinteractive/composer-wordpress-autoloader": "^1.0", + "alleyinteractive/wp-filter-side-effects": "^2.0", + "mantle-framework/contracts": "^1.0", + "mantle-framework/support": "^1.0", + "psr/container": "^1.1.1 || ^2.0.2", + "symfony/finder": "^6.2" + }, + "extra": { + "wordpress-autoloader": { + "autoload": { + "Mantle\\Database": "./" + } + } + }, + "license": "GPL-2.0-or-later", + "authors": [ + { + "name": "Alley", + "email": "mantle@alley.com" + } + ], + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/mantle-framework/database/console/class-seed-command.php b/vendor/mantle-framework/database/console/class-seed-command.php new file mode 100644 index 00000000..94f1fe65 --- /dev/null +++ b/vendor/mantle-framework/database/console/class-seed-command.php @@ -0,0 +1,49 @@ +<?php +/** + * Seed_Command class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Console; + +use Mantle\Console\Command; +use Mantle\Console\Confirmable; + +use function Mantle\Support\Helpers\remove_action_validated; + +/** + * Database Seed Command + */ +class Seed_Command extends Command { + use Confirmable; + + /** + * Command signature. + * + * @var string + */ + protected $signature = 'db:seed {--class=}'; + + /** + * Run Database Seeding + */ + public function handle(): void { + if ( ! $this->confirm_to_proceed() ) { + return; + } + + // Disable cache purging. + if ( class_exists( 'WPCOM_VIP_Cache_Manager' ) ) { + remove_action_validated( 'shutdown', [ \WPCOM_VIP_Cache_Manager::instance(), 'execute_purges' ] ); + } + + $this->container + ->make( $this->option( 'class', \App\Database\Seeds\Database_Seeder::class ) ) + ->set_container( $this->container ) + ->set_command( $this ) + ->__invoke(); + + $this->success( __( 'Database seeding completed.', 'mantle' ) ); + } +} diff --git a/vendor/mantle-framework/database/factory/assets/factory/600x480.jpg b/vendor/mantle-framework/database/factory/assets/factory/600x480.jpg new file mode 100644 index 00000000..832a5597 Binary files /dev/null and b/vendor/mantle-framework/database/factory/assets/factory/600x480.jpg differ diff --git a/vendor/mantle-framework/database/factory/class-attachment-factory.php b/vendor/mantle-framework/database/factory/class-attachment-factory.php new file mode 100644 index 00000000..28218504 --- /dev/null +++ b/vendor/mantle-framework/database/factory/class-attachment-factory.php @@ -0,0 +1,176 @@ +<?php +/** + * Attachment_Factory class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Factory; + +use Closure; +use Mantle\Contracts\Database\Core_Object; +use Mantle\Database\Model\Attachment; +use RuntimeException; +use WP_Post; + +use function Mantle\Support\Helpers\get_post_object; + +/** + * Attachment Factory + * + * @template TModel of \Mantle\Database\Model\Attachment + * @template TObject of \WP_Post + * @template TReturnValue + * + * @extends Post_Factory<TModel, TObject, TReturnValue> + */ +class Attachment_Factory extends Post_Factory { + use Concerns\Generates_Images; + + /** + * Model to use when creating objects. + * + * @var class-string<TModel> + */ + protected string $model = Attachment::class; + + /** + * Definition of the factory. + * + * @return array<string, mixed> + */ + public function definition(): array { + return [ + 'post_type' => 'attachment', + ]; + } + + /** + * Create an attachment object with an underlying image file. + * + * @throws RuntimeException If unable to generate image. + * + * @param string $file The file name to create attachment object from. + * @param int $parent The parent post ID. + * @param int $width The width of the image. + * @param int $height The height of the image. + * @param bool $recycle Whether to recycle the image file. + */ + public function with_image( string $file = null, int $parent = 0, int $width = 640, int $height = 480, bool $recycle = true ): static { + if ( ! $file ) { + static $generated_images = [ + // Use the already generated default 600x480 image. + '6421c8050053a960a55c0e70f6006ca9' => __DIR__ . '/assets/factory/600x480.jpg', + ]; + + $hash = md5( $width . $height ); + + // If we're recycling, and we've already generated an image of this size, use it. + if ( $recycle && isset( $generated_images[ $hash ] ) ) { + $file = $generated_images[ $hash ]; + } + + // If we're not recycling, or we haven't generated an image of this size, + // generate one and save it for later. + if ( ! $file ) { + $file = $generated_images[ $hash ] = $this->generate_image( $width, $height ); + } + } + + if ( empty( $file ) ) { + throw new RuntimeException( "Unable to generate {$width}x{$height} image." ); + } + + return $this->with_middleware( + function ( array $args, Closure $next ) use ( $file, $parent ) { + if ( ! function_exists( 'wp_generate_attachment_metadata' ) ) { + require_once ABSPATH . 'wp-admin/includes/image.php'; + } + + $contents = file_get_contents( $file ); // phpcs:ignore WordPressVIPMinimum.Performance.FetchingRemoteData.FileGetContentsUnknown + $upload = wp_upload_bits( wp_basename( $file ), null, $contents ); + + $type = ''; + + if ( ! empty( $upload['type'] ) ) { + $type = $upload['type']; + } else { + $mime = wp_check_filetype( $upload['file'] ); + + if ( ! empty( $mime['type'] ) ) { + $type = $mime['type']; + } + } + + $args = array_merge( + $args, + [ + 'file' => $file, + 'post_title' => wp_basename( $upload['file'] ), + 'post_content' => '', + 'post_type' => 'attachment', + 'post_parent' => $parent, + 'post_mime_type' => $type, + 'guid' => $upload['url'], + ], + ); + + // Create the underlying attachment. + $attachment = $next( $args ); + + $id = $attachment instanceof Core_Object ? $attachment->id() : $attachment; + + update_attached_file( $id, $upload['file'] ); + wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) ); + + return $attachment; + } + ); + } + + /** + * Creates an object and returns its ID. + * + * @deprecated Use create() or create_and_get() instead. + * + * @param array $args The arguments. + * @param int $legacy_parent The parent post ID. + * @param array $legacy_args The arguments. + */ + public function create_object( $args, $legacy_parent = 0, $legacy_args = [] ): int|null { + // Backward compatibility for legacy argument format. + if ( is_string( $args ) ) { // @phpstan-ignore-line + $file = $args; + $args = $legacy_args; + $args['post_parent'] = $legacy_parent; + $args['file'] = $file; + } + + return $this->create( $args ); + } + + /** + * Saves an attachment. + * + * @deprecated Use the `with_image()` method instead. + * + * @param string $file The file name to create attachment object for. + * @param int $parent ID of the post to attach the file to. + * + * @return int|\WP_Error The attachment ID on success. The value 0 or WP_Error on failure. + */ + public function create_upload_object( $file, $parent = 0 ): int|\WP_Error { + return $this->with_image( $file, $parent )->create(); + } + + /** + * Retrieves an object by ID. + * + * @param int $object_id The object ID. + */ + public function get_object_by_id( int $object_id ): Attachment|WP_Post|int|null { + return $this->as_models + ? Attachment::find( $object_id ) + : get_post_object( $object_id ); + } +} diff --git a/vendor/mantle-framework/database/factory/class-blog-factory.php b/vendor/mantle-framework/database/factory/class-blog-factory.php new file mode 100644 index 00000000..29ed305c --- /dev/null +++ b/vendor/mantle-framework/database/factory/class-blog-factory.php @@ -0,0 +1,56 @@ +<?php +/** + * Blog_Factory class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Factory; + +use Mantle\Database\Model\Site; + +use function Mantle\Support\Helpers\get_site_object; + +/** + * Blog Factory + * + * @template TModel of \Mantle\Database\Model\Site + * @template TObject of \WP_Site + * @template TReturnValue + * + * @extends Factory<TModel, TObject, TReturnValue> + */ +class Blog_Factory extends Factory { + /** + * Model to use when creating objects. + * + * @var class-string<TModel> + */ + protected string $model = Site::class; + + /** + * Definition of the factory. + * + * @return array<string, mixed> + */ + public function definition(): array { + global $current_site, $base; + + return [ + 'domain' => $current_site->domain, + 'path' => $base . $this->faker->slug(), + 'title' => $this->faker->text(), + 'network_id' => $current_site->id, + ]; + } + + /** + * Retrieves an object by ID. + * + * @param int $object_id The object ID. + * @return \WP_Site|null + */ + public function get_object_by_id( int $object_id ) { + return get_site_object( $object_id ); + } +} diff --git a/vendor/mantle-framework/database/factory/class-comment-factory.php b/vendor/mantle-framework/database/factory/class-comment-factory.php new file mode 100644 index 00000000..b71189db --- /dev/null +++ b/vendor/mantle-framework/database/factory/class-comment-factory.php @@ -0,0 +1,68 @@ +<?php +/** + * Comment_Factory class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Factory; + +use Mantle\Database\Model\Comment; + +use function Mantle\Support\Helpers\get_comment_object; + +/** + * Term Factory + * + * @template TModel of \Mantle\Database\Model\Comment + * @template TObject of \WP_Comment + * @template TReturnValue + * + * @extends Factory<TModel, TObject, TReturnValue> + */ +class Comment_Factory extends Factory { + /** + * Model to use when creating objects. + * + * @var class-string + */ + protected string $model = Comment::class; + + /** + * Definition of the factory. + * + * @return array<string, mixed> + */ + public function definition(): array { + return [ + 'comment_author' => $this->faker->name(), + 'comment_author_url' => $this->faker->url(), + 'comment_approved' => 1, + 'comment_content' => $this->faker->sentence(), + ]; + } + + /** + * Creates multiple comments on a given post. + * + * @param int $post_id ID of the post to create comments for. + * @param int $count Total amount of comments to create. + * @param array $args The comment details. + * + * @return int[] Array with the comment IDs. + */ + public function create_post_comments( int $post_id, int $count = 1, array $args = [] ) { + $args['comment_post_ID'] = $post_id; + return $this->create_many( $count, $args ); + } + + /** + * Retrieves an object by ID. + * + * @param int $object_id The object ID. + * @return \WP_Comment|null + */ + public function get_object_by_id( int $object_id ) { + return get_comment_object( $object_id ); + } +} diff --git a/vendor/mantle-framework/database/factory/class-factory-container.php b/vendor/mantle-framework/database/factory/class-factory-container.php new file mode 100644 index 00000000..ff2e8923 --- /dev/null +++ b/vendor/mantle-framework/database/factory/class-factory-container.php @@ -0,0 +1,138 @@ +<?php +/** + * Factory_Container class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Factory; + +use Faker\Generator; +use Mantle\Contracts\Container; +use Mantle\Faker\Faker_Provider; + +/** + * Collect all the Database Factories for IDE Support + * + * Allows IDEs to type-hint the individual factories and their child methods. + * + * This method is used in unit testing primarily to mirror core's testing + * factories. + */ +class Factory_Container { + /** + * Attachment Factory + * + * @var Attachment_Factory<\Mantle\Database\Model\Attachment, \WP_Post, \WP_Post> + */ + public Attachment_Factory $attachment; + + /** + * Blog Factory + * + * @var Blog_Factory<\Mantle\Database\Model\Site, \WP_Site, \WP_Site> + */ + public Blog_Factory $blog; + + /** + * Category Factory + * + * @var Term_Factory<\Mantle\Database\Model\Term, \WP_Term, \WP_Term> + */ + public Term_Factory $category; + + /** + * Comment Factory + * + * @var Comment_Factory<\Mantle\Database\Model\Comment, \WP_Comment, \WP_Comment> + */ + public Comment_Factory $comment; + + /** + * Network Factory + * + * @var Network_Factory<null, \WP_Network> + */ + public Network_Factory $network; + + /** + * Page Factory + * + * @var Post_Factory<\Mantle\Database\Model\Post, \WP_Post, \WP_Post> + */ + public $page; + + /** + * Post Factory + * + * @var Post_Factory<\Mantle\Database\Model\Post, \WP_Post, \WP_Post> + */ + public Post_Factory $post; + + /** + * Tag Factory + * + * @var Term_Factory<\Mantle\Database\Model\Term, \WP_Term, \WP_Term> + */ + public Term_Factory $tag; + + /** + * Term Factory (alias for Tag Factory). + * + * @var Term_Factory<\Mantle\Database\Model\Term, \WP_Term, \WP_Term> + */ + public Term_Factory $term; + + /** + * User Factory + * + * @var User_Factory<\Mantle\Database\Model\User, \WP_User, \WP_User> + */ + public User_Factory $user; + + /** + * Constructor. + * + * @param Container $container Container instance. + */ + public function __construct( Container $container ) { + $this->setup_faker( $container ); + + $this->attachment = $container->make( Attachment_Factory::class ); + $this->category = $container->make( Term_Factory::class, [ 'taxonomy' => 'category' ] ); + $this->comment = $container->make( Comment_Factory::class ); + $this->page = $container->make( Post_Factory::class, [ 'post_type' => 'page' ] ); + $this->post = $container->make( Post_Factory::class ); + $this->tag = $container->make( Term_Factory::class, [ 'taxonomy' => 'post_tag' ] ); + $this->term = $container->make( Term_Factory::class, [ 'taxonomy' => 'post_tag' ] ); + $this->user = $container->make( User_Factory::class ); + + if ( is_multisite() ) { + $this->blog = $container->make( Blog_Factory::class ); + $this->network = $container->make( Network_Factory::class ); + } + } + + /** + * Set up the Faker instance in the container. + * + * Primarily used when faker/factory is called from a data provider and the + * application hasn't been setup yet. + * + * @param Container $container Container instance. + */ + protected function setup_faker( Container $container ): void { + $container->singleton_if( + Generator::class, + function () { + $generator = \Faker\Factory::create(); + + $generator->unique(); + + $generator->addProvider( new Faker_Provider( $generator ) ); + + return $generator; + }, + ); + } +} diff --git a/vendor/mantle-framework/database/factory/class-factory.php b/vendor/mantle-framework/database/factory/class-factory.php new file mode 100644 index 00000000..7814fd8b --- /dev/null +++ b/vendor/mantle-framework/database/factory/class-factory.php @@ -0,0 +1,287 @@ +<?php +/** + * Factory class file. + * + * phpcs:disable Squiz.Commenting.FunctionComment.MissingParamTag, Squiz.Commenting.FunctionComment.ParamNameNoMatch + * + * @package Mantle + */ + +namespace Mantle\Database\Factory; + +use Closure; +use Faker\Generator; +use Mantle\Contracts\Database\Core_Object; +use Mantle\Database\Model\Model; +use Mantle\Support\Collection; +use Mantle\Support\Pipeline; +use Mantle\Support\Traits\Conditionable; +use Mantle\Support\Traits\Macroable; + +use function Mantle\Support\Helpers\collect; +use function Mantle\Support\Helpers\tap; + +/** + * Base Factory + * + * @template TModel of \Mantle\Database\Model\Model + * @template TObject + * @template TReturnValue + * + * @method \Mantle\Database\Factory\Fluent_Factory<TModel, TObject, TReturnValue> count(int $count) + */ +abstract class Factory { + use Concerns\Resolves_Factories; + use Conditionable; + use Macroable { + __call as macro_call; + } + + /** + * Flag to return the factory as a model. + */ + protected bool $as_models = false; + + /** + * Array of pipes (middleware) to run through. + * + * @var \Mantle\Support\Collection<int, callable(array $args, Closure $next): mixed> + */ + public Collection $middleware; + + /** + * Model to use when creating objects. + * + * @var class-string + */ + protected string $model; + + /** + * Constructor. + * + * @param Generator $faker The Faker instance. + */ + public function __construct( protected Generator $faker ) { + $this->middleware = new Collection(); + } + + /** + * Definition of the factory. + * + * @return array<string, mixed> + */ + abstract public function definition(): array; + + /** + * Retrieves an object by ID. + * + * @param int $object_id The object ID. + * @return TModel|TObject|null + */ + abstract public function get_object_by_id( int $object_id ); + + /** + * Creates an object. + * + * @param array $args The arguments. + * @return int|null + */ + public function create( array $args = [] ): mixed { + return $this->make( $args )?->id(); + } + + /** + * Creates an object and returns its ID. + * + * @deprecated Use create() or create_and_get() instead. + * + * @param array $args The arguments. + */ + public function create_object( $args ): int|null { + return $this->create( $args ); + } + + /** + * Generate models from the factory. + * + * @return static<TModel, TObject, TModel> + */ + public function as_models() { + return tap( + clone $this, + fn ( Factory $factory ) => $factory->as_models = true, + ); + } + + /** + * Generate core WordPress objects from the factory. + * + * @return static<TModel, TObject, TObject> + */ + public function as_objects() { + return tap( + clone $this, + fn ( Factory $factory ) => $factory->as_models = false, + ); + } + + /** + * Create a new factory instance with middleware. + * + * @param callable(array $args, \Closure $next): mixed $middleware Middleware to run the factory through. + * @return static + */ + public function with_middleware( callable $middleware ) { + return tap( + clone $this, + fn ( Factory $factory ) => $factory->middleware = $this->middleware->merge( $middleware ), + ); + } + + /** + * Create a new factory instance without any middleware. + * + * This will return the factory to its original state with only the factory + * definition applied. + * + * @return static + */ + public function without_middleware() { + return tap( + clone $this, + fn ( Factory $factory ) => $factory->middleware = new Collection(), + ); + } + + /** + * Specify the model to use when creating objects. + * + * @throws \InvalidArgumentException If the model does not extend from the base model class. + * + * @template TNewModel of \Mantle\Database\Model\Model + * + * @param class-string<TNewModel> $model The model to use. + * @return static<TNewModel, TObject, TReturnValue> + */ + public function with_model( string $model ) { + // Validate that model extends from the base model class. + if ( ! is_subclass_of( $model, Model::class ) ) { + throw new \InvalidArgumentException( 'Model must extend from the base model class.' ); + } + + return tap( + clone $this, + fn ( Factory $factory ) => $factory->model = $model, + ); + } + + /** + * Retrieve the model to use when creating objects. + * + * @return class-string<TObject> + */ + public function get_model(): string { + return $this->model; + } + + /** + * Add a new state transformation to the factory. Functions the same as + * middleware but supports returning an array of attributes vs a closure. + * + * @param (callable(array<string, mixed>): array<string, mixed>|array<string, mixed>) $state The state transformation. + * @return static + */ + public function state( array|callable $state ) { + return $this->with_middleware( + function ( array $args, Closure $next ) use ( $state ) { + $args = array_merge( + $args, + is_callable( $state ) ? $state( $args ) : $state, + ); + + return $next( $args ); + }, + ); + } + + /** + * Creates multiple objects. + * + * @param int $count Amount of objects to create. + * @param array $args Optional. The arguments for the object to create. Default is empty array. + * + * @return array<int, int> + */ + public function create_many( int $count, array $args = [] ) { + return collect() + ->pad( $count, null ) + ->map( + fn () => $this->create( $args ), + ) + ->to_array(); + } + + /** + * Creates an object and returns its object. + * + * @param array $args Optional. The arguments for the object to create. Default is empty array. + * @return TReturnValue The created object. + */ + public function create_and_get( array $args = [] ) { + return $this->get_object_by_id( $this->create( $args ) ); + } + + /** + * Pass arguments through the middleware and return a core object. + * + * @param array $args Arguments to pass through the middleware. + * @return TObject|Core_Object|null + */ + protected function make( array $args ) { + // Apply the factory definition to top of the middleware stack. + $this->middleware->prepend( $this->apply_definition() ); + + // Append the arguments passed to make() as the last state values to apply. + $factory = $this->state( $args ); + + return Pipeline::make() + ->send( [] ) + ->through( $factory->middleware->all() ) + ->then( + fn ( array $args ) => $this->get_model()::create( $args ), + ); + } + + /** + * Load the factory's definition and make a new instance of the factory. + */ + public function apply_definition(): Closure { + return fn ( array $args, Closure $next ) => $next( + array_merge( $args, $this->definition() ), + ); + } + + /** + * Create a new fluent factory instance. + */ + protected function create_fluent_factory(): Fluent_Factory { + return new Fluent_Factory( + clone $this, + $this->faker, + ); + } + + /** + * Magic method to proxy calls to the fluent factory. + * + * @param string $method The method name. + * @param array $args The arguments. + */ + public function __call( string $method, array $args ): mixed { + if ( static::has_macro( $method ) ) { + return $this->macro_call( $method, $args ); + } + + return $this->create_fluent_factory()->$method( ...$args ); + } +} diff --git a/vendor/mantle-framework/database/factory/class-fluent-factory.php b/vendor/mantle-framework/database/factory/class-fluent-factory.php new file mode 100644 index 00000000..bae6618c --- /dev/null +++ b/vendor/mantle-framework/database/factory/class-fluent-factory.php @@ -0,0 +1,141 @@ +<?php +/** + * Fluent_Factory class file + * + * @package Mantle + */ + +namespace Mantle\Database\Factory; + +use BadMethodCallException; +use Faker\Generator; + +use function Mantle\Support\Helpers\collect; + +/** + * Fluent Database Factory + * + * Extends upon the factory that is included with Mantle (one that is designed + * to mirror WordPress) and builds upon it to provide a fluent interface. + * + * @template TModel of \Mantle\Database\Model\Model + * @template TObject + * @template TReturnValue + * + * @extends Factory<TModel, TObject, TReturnValue> + */ +class Fluent_Factory extends Factory { + /** + * Number of objects to create. + */ + protected int $count = 1; + + /** + * Constructor. + * + * @param Factory $factory The factory to make fluent. + * @param Generator $faker The Faker instance. + */ + protected function __construct( + protected Factory $factory, + Generator $faker, + ) { + parent::__construct( $faker ); + } + + /** + * Set the number of objects to create in the factory. + * + * @param int $count Count of objects to create. + */ + public function count( int $count ): static { + $this->count = $count; + + return $this; + } + + /** + * Create one or multiple objects and return the IDs. + * + * @param array $args Arguments to pass to the factory. + * @return \Mantle\Support\Collection<int, TReturnValue>|mixed + */ + public function create( array $args = [] ): mixed { + if ( 1 === $this->count ) { + return $this->factory->create( $args ); + } else { + return collect( $this->factory->create_many( $this->count, $args ) ); + } + } + + /** + * Create one or multiple objects and return the objects. + * + * @param array $args Arguments to pass to the factory. + * @return \Mantle\Support\Collection<int, TReturnValue>|TReturnValue + */ + public function create_and_get( array $args = [] ): mixed { + if ( 1 === $this->count ) { + return $this->factory->create_and_get( $args ); + } + + return collect() + ->times( + $this->count, + fn () => $this->factory->create_and_get( $args ), + ); + } + + /** + * Method to proxy back to the definition method on the factory. + */ + public function definition(): array { + return $this->factory->definition(); + } + + /** + * Retrieves an object by ID. + * + * @param mixed $object_id The object ID. + * @return TReturnValue + */ + public function get_object_by_id( mixed $object_id ): mixed { + return $this->factory->get_object_by_id( $object_id ); + } + + /** + * Magic method to prevent an infinite loop when calling methods that do not + * exist on this class. Allows for the factory to proxy back to the base + * factory for scopes and other methods. + * + * @param string $method The method name. + * @param array $args The arguments. + * + * @throws BadMethodCallException If the method does not exist. + */ + public function __call( string $method, array $args ): mixed { + if ( method_exists( $this->factory, $method ) ) { + $value = $this->factory->$method( ...$args ); + + if ( $value instanceof Factory ) { + return $this->make_fluent( $value ); + } + + return $value; + } + + throw new BadMethodCallException( "Method {$method} does not exist." ); + } + + /** + * Convert a factory to a fluent factory and copy over the state from the + * current fluent factory. + * + * @param Factory $factory The factory to convert. + */ + protected function make_fluent( Factory $factory ): self { + return $factory + ->create_fluent_factory() + ->count( $this->count ); + } +} diff --git a/vendor/mantle-framework/database/factory/class-network-factory.php b/vendor/mantle-framework/database/factory/class-network-factory.php new file mode 100644 index 00000000..0b5083e1 --- /dev/null +++ b/vendor/mantle-framework/database/factory/class-network-factory.php @@ -0,0 +1,76 @@ +<?php +/** + * Network_Factory class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Factory; + +/** + * Network Factory + * + * @template TModel + * @template TObject of \WP_Network + * @template TReturnValue + * + * @extends Factory<TModel, TObject, TReturnValue> + */ +class Network_Factory extends Factory { + /** + * Network ID tracker. + */ + protected int $network_id = 2; + + /** + * Definition of the factory. + * + * @return array<string, mixed> + */ + public function definition(): array { + return [ + 'domain' => $this->faker->domainName(), + 'title' => $this->faker->words(), + 'path' => $this->faker->slug(), + ]; + } + + /** + * Creates an object. + * + * @param array $args The arguments to pass to populate_network(). + */ + public function create( array $args = [] ): ?int { + require_once ABSPATH . 'wp-admin/includes/upgrade.php'; + + if ( ! isset( $args['user'] ) ) { + $email = $this->faker->email(); + } else { + $email = get_userdata( $args['user'] )->user_email; + } + + $args = array_merge( + [ + 'domain' => $this->faker->domainName(), + 'title' => $this->faker->words(), + 'path' => $this->faker->slug(), + ], + $args + ); + + $network_id = $args['network_id'] ?? $this->network_id++; + + populate_network( $network_id, $args['domain'], $email, $args['title'], $args['path'], $args['subdomain_install'] ?? false ); + return (int) $network_id; + } + + /** + * Retrieves an object by ID. + * + * @param int $object_id The object ID. + * @return \WP_Network|null + */ + public function get_object_by_id( int $object_id ) { + return get_network( $object_id ); + } +} diff --git a/vendor/mantle-framework/database/factory/class-post-factory.php b/vendor/mantle-framework/database/factory/class-post-factory.php new file mode 100644 index 00000000..99ca7953 --- /dev/null +++ b/vendor/mantle-framework/database/factory/class-post-factory.php @@ -0,0 +1,215 @@ +<?php +/** + * Post_Factory class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Factory; + +use Carbon\Carbon; +use Closure; +use Faker\Generator; +use Mantle\Database\Model\Post; +use WP_Post; + +use function Mantle\Support\Helpers\collect; +use function Mantle\Support\Helpers\get_post_object; +use function Mantle\Support\Helpers\tap; + +/** + * Post Factory + * + * @template TModel of \Mantle\Database\Model\Post + * @template TObject + * @template TReturnValue + * + * @extends Factory<TModel, TObject, TReturnValue> + */ +class Post_Factory extends Factory { + use Concerns\With_Meta; + + /** + * Model to use when creating objects. + * + * @var class-string<TModel> + */ + protected string $model = Post::class; + + /** + * Constructor. + * + * @param Generator $faker Faker generator. + * @param string $post_type Post type to use. + */ + public function __construct( Generator $faker, public string $post_type = 'post' ) { + parent::__construct( $faker ); + } + + /** + * Create a new factory instance to create posts with a set of terms. + * + * @param array<int|string, \WP_Term|int|string|array<string, mixed>>|\WP_Term|int|string ...$terms Terms to assign to the post. + */ + public function with_terms( ...$terms ): static { + // Handle an array in the first argument. + if ( 1 === count( $terms ) && is_array( $terms[0] ) ) { + $terms = $terms[0]; + } + + $terms = collect( $terms )->all(); + + return $this->with_middleware( + fn ( array $args, Closure $next ) => $next( $args )->set_terms( $terms ), + ); + } + + /** + * Attach a post thumbnail to the post. + * + * Note: the underlying attachment does not actually exist for performance. + * You can use `with_real_thumbnail()` to create a real underlying attachment + * for the post thumbnail. + */ + public function with_thumbnail(): static { + return $this->with_meta( + [ + '_thumbnail_id' => ( new Attachment_Factory( $this->faker ) )->create(), + ] + ); + } + + /** + * Attach a thumbnail to the post with an underlying file attachment. + * + * @param string $file The file name to create attachment object from. + * @param int $width The width of the image. + * @param int $height The height of the image. + * @param bool $recycle Whether to recycle the image file. + */ + public function with_real_thumbnail( string $file = null, int $width = 640, int $height = 480, bool $recycle = true ): static { + return $this->with_middleware( + function ( array $args, Closure $next ) use ( $file, $width, $height, $recycle ) { + $post = $next( $args ); + + update_post_meta( + $post->ID, + '_thumbnail_id', + ( new Attachment_Factory( $this->faker ) )->with_image( + file: $file, + width: $width, + parent: $post->ID, + height: $height, + recycle: $recycle + )->create(), + ); + + return $post; + } + ); + } + + /** + * Create a new factory instance to create posts for a specific post type. + * + * @param string $post_type Post type to use. + */ + public function with_post_type( string $post_type ): static { + return tap( + clone $this, + fn ( Post_Factory $factory ) => $factory->post_type = $post_type, + ); + } + + /** + * Alias for {@see Post_Factory::with_post_type()}. + * + * @param string $post_type Post type to use. + */ + public function for( string $post_type ): static { + return $this->with_post_type( $post_type ); + } + + /** + * Definition of the factory. + * + * @return array<string, mixed> + */ + public function definition(): array { + return [ + 'post_content' => trim( (string) $this->faker->paragraph_blocks( 3 ) ), + 'post_excerpt' => trim( $this->faker->paragraph( 2 ) ), + 'post_status' => 'publish', + 'post_title' => $this->faker->sentence(), + 'post_type' => $this->post_type, + ]; + } + + /** + * Create a post with a thumbnail. + * + * @deprecated Use {@see Post_Factory::with_thumbnail()} instead. + * + * @param array $args The arguments. + */ + public function create_with_thumbnail( array $args = [] ): ?int { + return $this->with_thumbnail()->create( $args ); + } + + /** + * Create an ordered set of posts. + * + * Useful to create posts in a specific order for testing. Creates posts in + * chronological order separated by a defined number of seconds, the + * default of which is equal to 1 hour. + * + * @param int $count The number of posts to create. + * @param array $args The arguments. + * @param Carbon|string $starting_date The starting date for the posts, defaults to + * a month ago. + * @param int $separation The number of seconds between each post. + * @return array<int, int> + */ + public function create_ordered_set( + int $count = 10, + array $args = [], + $starting_date = null, + int $separation = 3600 + ): array { + if ( ! ( $starting_date instanceof Carbon ) ) { + $starting_date = $starting_date + ? Carbon::parse( $starting_date ) + : Carbon::now()->subMonth(); + } + + // Set the date for the first post (seconds added before each run). + $date = $starting_date->subSeconds( $separation ); + + return collect() + ->pad( $count, null ) + ->map( + fn () => $this->create( + array_merge( + $args, + [ + 'date' => $date->addSeconds( $separation )->format( 'Y-m-d H:i:s' ), + ] + ) + ) + ) + ->to_array(); + } + + /** + * Retrieves an object by ID. + * + * @param int $object_id The object ID. + * @return Post|WP_Post|null + * @phpstan-return TModel|TObject|null + */ + public function get_object_by_id( int $object_id ) { + return $this->as_models + ? $this->model::find( $object_id ) + : get_post_object( $object_id ); + } +} diff --git a/vendor/mantle-framework/database/factory/class-term-factory.php b/vendor/mantle-framework/database/factory/class-term-factory.php new file mode 100644 index 00000000..f7e26f5c --- /dev/null +++ b/vendor/mantle-framework/database/factory/class-term-factory.php @@ -0,0 +1,124 @@ +<?php +/** + * Term_Factory class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Factory; + +use Closure; +use Faker\Generator; +use Mantle\Database\Model\Term; + +use function Mantle\Support\Helpers\get_term_object; +use function Mantle\Support\Helpers\tap; + +/** + * Term Factory + * + * @template TModel of \Mantle\Database\Model\Term + * @template TObject of \WP_Term + * @template TReturnValue + * + * @extends Factory<TModel, TObject, TReturnValue> + */ +class Term_Factory extends Factory { + use Concerns\With_Meta; + + /** + * Model to use when creating objects. + * + * @var class-string<TModel> + */ + protected string $model = Term::class; + + /** + * Constructor. + * + * @param Generator $faker Faker generator. + * @param string $taxonomy Taxonomy name. + */ + public function __construct( Generator $faker, protected string $taxonomy = 'post_tag' ) { + parent::__construct( $faker ); + } + + /** + * Definition of the factory. + * + * @return array<string, mixed> + */ + public function definition(): array { + return [ + 'description' => trim( $this->faker->paragraph( 2 ) ), + 'name' => $this->faker->words( wp_rand( 2, 4 ), true ), + 'taxonomy' => $this->taxonomy, + ]; + } + + /** + * Create a new factory instance to create terms with a set of posts. + * + * Supports an array of post IDs or WP_Post objects. + * + * @param array<int, \WP_Post|int>|\WP_Post|int ...$posts Posts to assign to the term. + * @return static + */ + public function with_posts( ...$posts ) { + $posts = collect( $posts )->flatten()->all(); + + return $this->with_middleware( + function ( array $args, Closure $next ) use ( $posts ) { + /** + * The created term. + * + * @var \WP_Term $term + */ + $term = $next( $args ); + + foreach ( $posts as $post ) { + if ( $post instanceof \WP_Post ) { + wp_set_object_terms( $post->ID, $term->term_id, $term->taxonomy, true ); + } else { + wp_set_object_terms( $post, $term->term_id, $term->taxonomy, true ); + } + } + + return $term; + }, + ); + } + + /** + * Retrieves an object by ID. + * + * @param int $object_id The object ID. + * @return \WP_Term|Term|null + */ + public function get_object_by_id( int $object_id ) { + return $this->as_models + ? $this->model::find( $object_id ) + : get_term_object( $object_id ); + } + + /** + * Create a new factory instance to create posts for a specific taxonomy. + * + * @param string $taxonomy Post type to use. + */ + public function with_taxonomy( string $taxonomy ): static { + return tap( + clone $this, + fn ( Term_Factory $factory ) => $factory->taxonomy = $taxonomy, + ); + } + + /** + * Alias for {@see Term_Factory::with_taxonomy()}. + * + * @param string $taxonomy Taxonomy to use. + */ + public function for( string $taxonomy ): static { + return $this->with_taxonomy( $taxonomy ); + } +} diff --git a/vendor/mantle-framework/database/factory/class-user-factory.php b/vendor/mantle-framework/database/factory/class-user-factory.php new file mode 100644 index 00000000..927057ad --- /dev/null +++ b/vendor/mantle-framework/database/factory/class-user-factory.php @@ -0,0 +1,57 @@ +<?php +/** + * User_Factory class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Factory; + +use Mantle\Database\Model\User; + +use function Mantle\Support\Helpers\get_user_object; + +/** + * User Factory + * + * @template TModel of \Mantle\Database\Model\User + * @template TObject of \WP_User + * @template TReturnValue + * + * @extends Factory<TModel, TObject, TReturnValue> + */ +class User_Factory extends Factory { + use Concerns\With_Meta; + + /** + * Model to use when creating objects. + * + * @var class-string<TModel> + */ + protected string $model = User::class; + + /** + * Definition of the factory. + * + * @return array<string, mixed> + */ + public function definition(): array { + return [ + 'description' => $this->faker->sentence(), + 'role' => 'subscriber', + 'user_email' => $this->faker->email(), + 'user_login' => $this->faker->userName(), + 'user_pass' => 'password', + ]; + } + + /** + * Retrieves an object by ID. + * + * @param int $object_id The object ID. + * @return \WP_User|\Mantle\Database\Model\User|null + */ + public function get_object_by_id( int $object_id ) { + return $this->as_models ? $this->model::find( $object_id ) : get_user_object( $object_id ); + } +} diff --git a/vendor/mantle-framework/database/factory/concerns/trait-generates-images.php b/vendor/mantle-framework/database/factory/concerns/trait-generates-images.php new file mode 100644 index 00000000..a041dc42 --- /dev/null +++ b/vendor/mantle-framework/database/factory/concerns/trait-generates-images.php @@ -0,0 +1,98 @@ +<?php +/** + * Generates_Images trait file + * + * @package Mantle + */ + +namespace Mantle\Database\Factory\Concerns; + +use Mantle\Http_Client\Factory; +use Mantle\Support\Str; +use RuntimeException; + +/** + * Generate images for testing factories. + * + * Does not rely on FakerPHP since the image generation is being deprecated. + */ +trait Generates_Images { + /** + * Generate an image. + * + * @param int $width The width of the image. + * @param int $height The height of the image. + * @param string|null $directory The directory to store the image to, defaults to the system temp directory. + * @param string|null $filename The filename to save the image as. + */ + public function generate_image( int $width, int $height, ?string $directory = null, ?string $filename = null ): string { + if ( ! $directory ) { + $directory = get_temp_dir(); + } + + $image = imagecreatetruecolor( $width, $height ); + + if ( ! is_gd_image( $image ) ) { + return $this->generate_remote_image( $width, $height, $directory, $filename ); + } + + imagefill( $image, 0, 0, imagecolorallocate( $image, 192, 192, 192 ) ); + + if ( ! $filename ) { + $filename = $this->generate_filename() . '.png'; + } + + // Ensure the filename ends with .png. + if ( ! Str::ends_with( $filename, '.png' ) ) { + $filename .= '.png'; + } + + imagepng( $image, "{$directory}/{$filename}" ); + + imagedestroy( $image ); + + return "{$directory}/{$filename}"; + } + + /** + * Generate an image by fetching the image from picsum.photos. + * + * @throws RuntimeException If the image cannot be fetched. + * + * @param int $width The width of the image. + * @param int $height The height of the image. + * @param string|null $directory The directory to save the image to. + * @param string|null $filename The filename to save the image as. + */ + public function generate_remote_image( int $width, int $height, ?string $directory = null, ?string $filename = null ): string { + if ( ! $directory ) { + $directory = get_temp_dir(); + } + + if ( ! $filename ) { + $filename = $this->generate_filename() . '.jpg'; + } + + // Ensure the filename ends with .jpg. + if ( ! Str::ends_with( $filename, '.jpg' ) ) { + $filename .= '.jpg'; + } + + $request = ( new Factory() ) + ->stream( "{$directory}/{$filename}" ) + ->get( "https://picsum.photos/{$width}/{$height}" ); + + if ( ! $request->ok() ) { + throw new RuntimeException( 'Unable to fetch remote image from picsum.photos.' ); + } + + return "{$directory}/{$filename}"; + } + + /** + * Generate a random filename. + */ + protected function generate_filename(): string { + return md5( (string) wp_generate_password( 15, false ) ); + } +} diff --git a/vendor/mantle-framework/database/factory/concerns/trait-resolves-factories.php b/vendor/mantle-framework/database/factory/concerns/trait-resolves-factories.php new file mode 100644 index 00000000..37066b9f --- /dev/null +++ b/vendor/mantle-framework/database/factory/concerns/trait-resolves-factories.php @@ -0,0 +1,162 @@ +<?php +/** + * Resolves_Factories trait file + * + * @package Mantle + */ + +namespace Mantle\Database\Factory\Concerns; + +use InvalidArgumentException; +use Mantle\Application\Application; +use Mantle\Container\Container; +use Mantle\Database\Factory; +use Mantle\Database\Model; +use Mantle\Support\Str; + +use function Mantle\Support\Helpers\collect; +use function Mantle\Support\Helpers\str; + +/** + * Trait to resolve model factories. + * + * @mixin \Mantle\Database\Factory\Factory + */ +trait Resolves_Factories { + /** + * The callback that should be invoked to resolve model factories. + * + * @var callable(class-string<\Mantle\Database\Model\Model>): class-string<\Mantle\Database\Factory\Factory> + */ + protected static $factory_name_resolver; + + /** + * Get a new factory instance for the given model. + * + * @param class-string<\Mantle\Database\Model\Model> $model Model class name. + */ + public static function factory_for_model( string $model ): Factory\Factory { + $factory = static::resolve_factory_name( $model ); + + return Container::get_instance()->make( $factory ); + } + + /** + * Specify the callback that should be invoked to resolve model factories. + * + * @param callable(class-string<\Mantle\Database\Model\Model>): class-string<\Mantle\Database\Factory\Factory> $resolver Callable resolver. + */ + public static function resolve_factory_using( callable $resolver ): void { + static::$factory_name_resolver = $resolver; + } + + /** + * Resolve the factory name for a model. + * + * Attempts to resolve the custom factory name for the given model. If that + * is not found, it will attempt to resolve the default factory name for + * the given model (e.g. a post model would use Mantle\Database\Factory\Post_Factory). + * + * @param string $model + */ + public static function resolve_factory_name( string $model ): string { + $custom_factory = static::resolve_custom_factory_name( $model ); + + if ( class_exists( $custom_factory ) ) { + return $custom_factory; + } + + return static::default_factory_name( $model ); + } + + /** + * Resolve the factory name for the given model. + * + * Attempts to resolve a factory name for the given model with an option to + * override the resolver using a callback. + * + * @param class-string<\Mantle\Database\Model\Model> $model_name Model class + * name. + * @return class-string<\Mantle\Database\Factory\Factory> + */ + public static function resolve_custom_factory_name( string $model_name ): string { + $resolver = static::$factory_name_resolver ?? function ( string $model_name ) { + $app_namespace = static::app_namespace(); + + return Str::of( $model_name ) + ->after( $app_namespace . 'Models\\' ) + ->prepend( $app_namespace . 'Database\\Factory\\' ) + ->append( '_Factory' ); + }; + + return $resolver( $model_name ); + } + + /** + * Resolve the default factory name for the given model. + * + * Attempts to resolve the type of model and use a built-in factory. + * + * @throws \InvalidArgumentException If the model is not a Mantle model. + * + * @param class-string<\Mantle\Database\Model\Model> $model_name Model class. + * @return class-string<\Mantle\Database\Factory\Factory> + */ + public static function default_factory_name( string $model_name ): string { + $parent_classes = collect( class_parents( $model_name ) ); + $model_namespace = 'Mantle\\Database\\Model'; + + // Attempt to resolve the parent class that is a model and not the base + // model class. + $parent_class = $parent_classes->first( + fn ( string $parent_class ) => Model\Model::class !== $parent_class + && str( $parent_class )->startsWith( $model_namespace ), + ); + + // Use the model name itself if the model is a base model class. + if ( ! $parent_class && str( $model_name )->startsWith( $model_namespace ) ) { + $parent_class = $model_name; + } + + if ( ! $parent_class ) { + throw new InvalidArgumentException( + "Unable to resolve parent model for [{$model_name}]." + ); + } + + // Handle one-off models. + if ( Model\Site::class === $parent_class ) { + return Factory\Blog_Factory::class; + } + + $parent_class = Str::after_last( $parent_class, '\\' ); + + // Translate the parent model class to the respective factory class. + $factory_name = str( $parent_class ) + ->after_last( '\\' ) + ->prepend( 'Mantle\\Database\\Factory\\' ) + ->append( '_Factory' ) + ->value(); + + if ( ! class_exists( $factory_name ) ) { + throw new InvalidArgumentException( + "Unable to resolve factory for model [{$model_name}]." + ); + } + + return $factory_name; + } + + /** + * Get the application namespace for the application. + */ + protected static function app_namespace(): string { + try { + return str( + Container::get_instance()->make( Application::class )->get_namespace() + )->rtrim( '\\' )->append( '\\' ); + } catch ( \Throwable ) { + return 'App\\'; + } + } +} diff --git a/vendor/mantle-framework/database/factory/concerns/trait-with-meta.php b/vendor/mantle-framework/database/factory/concerns/trait-with-meta.php new file mode 100644 index 00000000..8598194d --- /dev/null +++ b/vendor/mantle-framework/database/factory/concerns/trait-with-meta.php @@ -0,0 +1,42 @@ +<?php +/** + * With_Meta trait file + * + * @package Mantle + */ + +namespace Mantle\Database\Factory\Concerns; + +use Closure; +use InvalidArgumentException; + +/** + * Support model meta within the database factory + * + * @mixin \Mantle\Database\Factory\Factory + */ +trait With_Meta { + /** + * Create a new factory instance to create posts with a set of meta. + * + * @param array<string, mixed>|string $meta Meta to assign to the post. + * @param mixed $value Optional. Value to assign to the meta key. + * @return static + */ + public function with_meta( array|string $meta, mixed $value = '' ) { + if ( is_string( $meta ) ) { + $meta = [ $meta => $value ]; + } + + return $this->with_middleware( + function ( array $args, Closure $next ) use ( $meta ) { + $args['meta'] = array_merge_recursive( + $args['meta'] ?? [], + $meta + ); + + return $next( $args ); + } + ); + } +} diff --git a/vendor/mantle-framework/database/model/class-attachment.php b/vendor/mantle-framework/database/model/class-attachment.php new file mode 100644 index 00000000..fcb57c2b --- /dev/null +++ b/vendor/mantle-framework/database/model/class-attachment.php @@ -0,0 +1,215 @@ +<?php +/** + * Attachment class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model; + +use Mantle\Facade\Storage; + +/** + * Attachment Model + * + * @method static \Mantle\Database\Factory\Post_Factory<static, \WP_Post, static> factory( array|callable|null $state = null ) + */ +class Attachment extends Post { + /** + * Attachment type for the model. + * + * @var string + */ + public static $object_name = 'attachment'; + + /** + * Meta key for storage of file information in the cloud. + * + * @var string + */ + public const META_KEY_CLOUD_STORAGE = 'mantle_cloud'; + + /** + * Get an attachment's URL by size. + * + * @param array|string $size Image URL. + * + * @throws Model_Exception Thrown when getting image. + */ + public function image_url( $size ): ?string { + if ( ! $this->id() ) { + throw new Model_Exception( 'Unable to get attachment URL for unsaved attachment.' ); + } + + return wp_get_attachment_image_url( $this->id(), $size ) ?: null; + } + + /** + * Get the full-size attachment URL. + */ + public function url(): ?string { + $settings = $this->get_cloud_settings(); + + if ( empty( $settings['disk'] ) ) { + $url = \wp_get_attachment_url( $this->id() ); + + return $url ?: null; + } + + // For private attachments serve a temporary URL. + // todo: allow some permissions to be used. + if ( ! empty( $settings['visibility'] ) && 'private' === $settings['visibility'] ) { + return $this->get_temporary_url(); + } + + return Storage::drive( $settings['disk'] )->url( untrailingslashit( $settings['path'] ) . $settings['name'] ); + } + + /** + * Retrieve a temporary URL for a file. + * + * @param \DateTimeInterface $expiration File expiration. + */ + public function get_temporary_url( $expiration = null ): ?string { + $settings = $this->get_cloud_settings(); + + if ( empty( $settings['disk'] ) ) { + return null; + } + + $disk = $settings['disk']; + + if ( is_null( $expiration ) ) { + $expiration = time() + max( 1, (int) config( "filesystem.disks.{$disk}.temporary_url_expiration" ) ); + } + + return Storage::drive( $disk )->temporary_url( untrailingslashit( $settings['path'] ) . $settings['name'], $expiration ); + } + + /** + * Get the stored cloud settings for an attachment. + */ + protected function get_cloud_settings(): ?array { + return (array) $this->get_meta( static::META_KEY_CLOUD_STORAGE, true ); + } + + /** + * Create or get an already saved attachment from an URL address. + * + * Mirrors 'media_sideload_image()' with the ability to also load PDFs. + * + * @param string $url Image URL. + * @param array $args { + * Optional. Arguments for the attachment. Default empty array. + * + * @type string $alt Alt text. + * @type string $caption Caption text. + * @type string $description Description text. + * @type array $meta Associate array of meta to set. + * The value of alt text will + * automatically be mapped into + * this value and will be + * overridden by the alt explicitly + * passed into this array. + * @type null|int $parent_post_id Parent post id. + * @type null|string $title Title text. Null defaults to the + * sanitized filename. + * } + * @throws Model_Exception Thrown on error sideloading image. + */ + public static function create_from_url( string $url, array $args = [] ): Model { + $existing = static::query()->whereMeta( '_source_url', $url )->first(); + + if ( $existing ) { + return $existing; + } + + if ( ! function_exists( 'media_handle_sideload' ) ) { + require_once ABSPATH . 'wp-admin/includes/file.php'; + require_once ABSPATH . 'wp-admin/includes/image.php'; + require_once ABSPATH . 'wp-admin/includes/media.php'; + } + + preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png|pdf)\b/i', $url, $matches ); + + if ( ! $matches ) { + throw new Model_Exception( __( 'Invalid URL to create from.', 'mantle' ) ); + } + + $file_array = []; + $file_array['name'] = \wp_basename( $matches[0] ); + + // Download file to temp location. + $file_array['tmp_name'] = \download_url( $url ); + + // If error storing temporarily, return the error. + if ( \is_wp_error( $file_array['tmp_name'] ) ) { + throw new Model_Exception( $file_array['tmp_name']->get_error_message() ); + } + + // Do the validation and storage of the file. + $attachment_id = \media_handle_sideload( $file_array, 0, $args['description'] ?? '' ); + + // If error storing permanently, unlink. + if ( \is_wp_error( $attachment_id ) ) { + @unlink( $file_array['tmp_name'] ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged, WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_unlink + throw new Model_Exception( $attachment_id->get_error_message() ); + } + + // Update the arguments if they exist. + if ( ! empty( array_filter( $args ) ) ) { + $args['ID'] = $attachment_id; + \wp_update_post( $args ); + } + + return static::find( $attachment_id ); + } + + /** + * Save the model. + * + * @param array $attributes Attributes to save. + * + * @throws Model_Exception Thrown on error saving. + */ + public function save( array $attributes = [] ): bool { + $this->set_attributes( $attributes ); + + $id = $this->id(); + + if ( empty( $id ) ) { + $save = \wp_insert_attachment( $this->get_attributes(), false, 0, true ); + } else { + $save = \wp_update_post( + array_merge( + $this->get_modified_attributes(), + [ + 'ID' => $id, + ] + ), + true, + ); + } + + if ( \is_wp_error( $save ) ) { + throw new Model_Exception( 'Error saving model: ' . $save->get_error_message() ); + } + + // Set the attachment ID attribute. + $this->set_raw_attribute( 'ID', $save ); + $this->store_queued_meta(); + $this->reset_modified_attributes(); + + return true; + } + + /** + * Delete the attachment. + * + * @param bool $force Force delete the model. + * @return mixed + */ + public function delete( bool $force = false ) { + return \wp_delete_attachment( $this->id(), $force ); + } +} diff --git a/vendor/mantle-framework/database/model/class-comment.php b/vendor/mantle-framework/database/model/class-comment.php new file mode 100644 index 00000000..7ad354d9 --- /dev/null +++ b/vendor/mantle-framework/database/model/class-comment.php @@ -0,0 +1,174 @@ +<?php +/** + * Comment class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model; + +use Mantle\Contracts; +use Mantle\Support\Helpers; + +/** + * Comment Model + * + * @method static \Mantle\Database\Factory\Post_Factory<static, \WP_Comment, static> factory( array|callable|null $state = null ) + */ +class Comment extends Model implements Contracts\Database\Core_Object, Contracts\Database\Model_Meta, Contracts\Database\Updatable { + use Meta\Model_Meta, + Meta\Comment_Meta; + + /** + * Attributes for the model from the object + * + * @var array<string, string> + */ + protected static $aliases = [ + 'description' => 'comment_content', + 'id' => 'comment_ID', + 'name' => 'comment_author', + 'title' => 'comment_author', + ]; + + /** + * Attributes that are guarded. + * + * @var array + */ + protected $guarded_attributes = [ + 'comment_ID', + ]; + + /** + * Constructor. + * + * @param mixed $object Model object. + */ + public function __construct( $object = [] ) { + $this->attributes = (array) $object; + } + + /** + * Find a model by Object ID. + * + * @param \WP_Comment|string|int $object Comment to retrieve. + * @return Comment|null + */ + public static function find( $object ) { + $post = Helpers\get_comment_object( $object ); + return $post ? new static( $post ) : null; + } + + /** + * Get the meta type for the object. + */ + public function get_meta_type(): string { + return 'comment'; + } + + /** + * Getter for Object ID. + */ + public function id(): int { + return (int) $this->get( 'id' ); + } + + /** + * Getter for Object Name. + */ + public function name(): string { + return (string) $this->get( 'name' ); + } + + /** + * Getter for Object Slug. + */ + public function slug(): string { + return (string) $this->get( 'name' ); + } + + /** + * Getter for Parent Object (if any) + */ + public function parent(): ?Contracts\Database\Core_Object { + $parent = $this->get_attribute( 'comment_parent' ); + + if ( ! empty( $parent ) ) { + return static::find( (int) $parent ); + } + + return null; + } + + /** + * Getter for Object Description + */ + public function description(): string { + return (string) $this->get( 'description' ); + } + + /** + * Getter for the Object Permalink + */ + public function permalink(): ?string { + return (string) \get_comment_link( $this->id() ); + } + + /** + * Retrieve the core object for the underlying object. + */ + public function core_object(): ?\WP_Comment { + $id = $this->id(); + + if ( $id ) { + return Helpers\get_comment_object( $id ); + } + + return null; + } + + /** + * Save the model. + * + * @param array $attributes Attributes to save. + * @throws Model_Exception Thrown on error saving. + */ + public function save( array $attributes = [] ): bool { + $this->set_attributes( $attributes ); + + $id = $this->id(); + + if ( empty( $id ) ) { + $save = \wp_insert_comment( $this->get_attributes() ); + } else { + $save = \wp_update_comment( + array_merge( + $this->get_modified_attributes(), + [ + 'comment_ID' => $id, + ] + ) + ); + } + + if ( ! $save ) { + throw new Model_Exception( 'Error saving model' ); + } + + $this->set_raw_attribute( 'comment_ID', $save ); + $this->store_queued_meta(); + $this->reset_modified_attributes(); + + return true; + } + + /** + * Delete the model. + * + * @param bool $force Force delete the mode. + */ + public function delete( bool $force = false ): void { + \wp_delete_comment( $this->id(), $force ); + } +} diff --git a/vendor/mantle-framework/database/model/class-model-exception.php b/vendor/mantle-framework/database/model/class-model-exception.php new file mode 100644 index 00000000..088acc28 --- /dev/null +++ b/vendor/mantle-framework/database/model/class-model-exception.php @@ -0,0 +1,15 @@ +<?php +/** + * Model_Exception class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model; + +use RuntimeException; + +/** + * Model Exception + */ +class Model_Exception extends RuntimeException {} diff --git a/vendor/mantle-framework/database/model/class-model-not-found-exception.php b/vendor/mantle-framework/database/model/class-model-not-found-exception.php new file mode 100644 index 00000000..8ca69864 --- /dev/null +++ b/vendor/mantle-framework/database/model/class-model-not-found-exception.php @@ -0,0 +1,67 @@ +<?php +/** + * Model_Not_Found_Exception class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model; + +use Mantle\Support\Arr; + +/** + * Model Not Found Exception + */ +class Model_Not_Found_Exception extends Model_Exception { + /** + * Name of the affected Eloquent model. + * + * @var string + */ + protected $model; + + /** + * The affected model IDs. + * + * @var int|array + */ + protected $ids; + + /** + * Set the affected Eloquent model and instance ids. + * + * @param string $model Model name. + * @param int|array $ids Model ID(s). + * @return static + */ + public function set_model( string $model, $ids = [] ) { + $this->model = $model; + $this->ids = Arr::wrap( $ids ); + + $this->message = "No query results for model [{$model}]"; + + if ( count( $this->ids ) > 0 ) { + $this->message .= ' ' . implode( ', ', $this->ids ); + } else { + $this->message .= '.'; + } + + return $this; + } + + /** + * Get the affected Eloquent model. + */ + public function get_model(): string { + return $this->model; + } + + /** + * Get the affected Eloquent model IDs. + * + * @return int|array + */ + public function get_ids() { + return $this->ids; + } +} diff --git a/vendor/mantle-framework/database/model/class-model.php b/vendor/mantle-framework/database/model/class-model.php new file mode 100644 index 00000000..0ba8aca4 --- /dev/null +++ b/vendor/mantle-framework/database/model/class-model.php @@ -0,0 +1,650 @@ +<?php +/** + * Model class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model; + +use ArrayAccess; +use JsonSerializable; +use Mantle\Contracts\Database\Updatable; +use Mantle\Contracts\Http\Routing\Url_Routable; +use Mantle\Contracts\Support\Arrayable; +use Mantle\Contracts\Support\Jsonable; +use Mantle\Database\Query\Builder; +use Mantle\Support\Collection; +use Mantle\Support\Forward_Calls; +use Mantle\Support\Str; + +use function Mantle\Support\Helpers\class_basename; +use function Mantle\Support\Helpers\class_uses_recursive; +use function Mantle\Support\Helpers\tap; + +/** + * Database Model + * + * @template TModelObject of object + * + * @method static \Mantle\Support\Collection all() + * @method static static first() + * @method static static first_or_fail() + * @method static void delete(bool $force) + * @method static boolean chunk(int $count, callable $callback) + * @method static boolean chunk_by_id(int $count, callable $callback) + * @method static boolean each(callable $callback, int $count = 100) + * @method static boolean each_by_id(callable $callback, int $count = 100, string $attribute = 'id') + * @method static \Mantle\Contracts\Paginator\Paginator simple_paginate(int $per_page = 20, int $current_page = null) + * @method static \Mantle\Contracts\Paginator\Paginator paginate(int $per_page = 20, int $current_page = null) + */ +abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializable, Url_Routable { + use Forward_Calls, + Concerns\Has_Aliases, + Concerns\Has_Attributes, + Concerns\Has_Events, + /** @use Concerns\Has_Factory<TModelObject> */ + Concerns\Has_Factory, + Concerns\Has_Global_Scopes, + Concerns\Has_Relationships; + + /** + * The array of booted models. + * + * @var array + */ + protected static $booted = []; + + /** + * The array of trait initializers that will be called on each new instance. + * + * @var array + */ + protected static $trait_initializers = []; + + /** + * The array of global scopes on the model. + * + * @var array + */ + protected static $global_scopes = []; + + /** + * An object's registerable name (post type, taxonomy, etc.). + * + * @var string + */ + public static $object_name; + + /** + * The primary key for the model. + * + * @var string + */ + protected $primary_key = 'id'; + + /** + * Indicates if the model exists. + * + * @var bool + */ + public $exists = false; + + /** + * The relations to eager load on every query. + * + * @var string[] + */ + protected $with = []; + + /** + * Constructor. + * + * @param mixed $object Model object. + */ + public function __construct( $object = [] ) { + static::boot_if_not_booted(); + $this->initialize_traits(); + + $this->set_attributes( (array) $object ); + } + + /** + * Find a model by Object ID. + * + * @param object|string|int $object Object to retrieve. + * @return static|null + */ + abstract public static function find( $object ); + + /** + * Find a model or throw an exception. + * + * @param object|string|int $object Object to retrieve. + * @return static + * + * @throws Model_Not_Found_Exception Thrown on missing resource. + */ + public static function find_or_fail( $object ) { + $find = static::find( $object ); + if ( $find ) { + return $find; + } + + throw ( new Model_Not_Found_Exception() )->set_model( self::class, $object ); + } + + /** + * Query builder class to use. + */ + public static function get_query_builder_class(): ?string { + return null; + } + + /** + * Determine if the model has a given scope. + * + * @param string $scope Scope name. + */ + public function has_named_scope( string $scope ): bool { + return method_exists( $this, 'scope' . ucfirst( $scope ) ); + } + + /** + * Apply the given named scope if possible. + * + * @param string $scope Scope name. + * @param array $parameters Scope parameters. + * @return mixed + */ + public function call_named_scope( string $scope, array $parameters = [] ) { + return $this->{ 'scope' . ucfirst( $scope ) }( ...$parameters ); + } + + /** + * Refresh the model attributes. + * + * @return static|null Model instance or null if not found. + */ + public function refresh() { + if ( ! $this->get( 'id' ) ) { + return null; + } + + $instance = static::find( $this->get( 'id' ) ); + + if ( ! $instance ) { + return null; + } + + $this->exists = true; + $this->set_raw_attributes( $instance->get_raw_attributes() ); + + return $this; + } + + /** + * Reload a fresh model instance from the database. + */ + public function fresh(): ?static { + if ( ! $this->get( 'id' ) ) { + return null; + } + + return static::find( $this->get( 'id' ) ); + } + + /** + * Create an instance of a model from another. + * + * @param Model $instance Instance to clone. + * @return static + */ + public static function instance( Model $instance ) { + return tap( + ( new static() )->set_raw_attributes( $instance->get_raw_attributes() ), + fn ( Model $model ) => $model->exists = true, + ); + } + + /** + * Create a new instance of the model from an existing record in the database. + * + * @param array $attributes Attributes to set. + * @return static + */ + public static function new_from_existing( array $attributes ) { + $instance = new static( [] ); + + $instance->exists = true; + + return $instance->set_raw_attributes( $attributes ); + } + + /** + * Get an attribute model. + * + * @param string $attribute Attribute name. + * @return mixed + */ + public function get( string $attribute ) { + if ( static::has_attribute_alias( $attribute ) ) { + $attribute = static::get_attribute_alias( $attribute ); + } + + return $this->get_attribute( $attribute ); + } + + /** + * Fill the model with an array of attributes. + * + * @param array $attributes Attributes to set. + */ + public function fill( array $attributes ): static { + foreach ( $attributes as $key => $value ) { + $this->set( $key, $value ); + } + + return $this; + } + + /** + * Set an attribute model. + * + * @param string $attribute Attribute name. + * @param mixed $value Value to set. + */ + public function set( string $attribute, $value ): void { + if ( static::has_attribute_alias( $attribute ) ) { + $attribute = static::get_attribute_alias( $attribute ); + } + + $this->set_attribute( $attribute, $value ); + } + + /** + * Check if the model needs to be booted and if so, do it. + */ + public static function boot_if_not_booted(): void { + if ( ! isset( static::$booted[ static::class ] ) ) { + static::boot_traits(); + static::boot(); + + static::$booted[ static::class ] = true; + } + } + + /** + * Clear the list of booted models so they will be re-booted. + */ + public static function clear_booted_models(): void { + static::$booted = []; + } + + /** + * Boot all of the bootable traits on the model. + */ + protected static function boot_traits() { + $class = static::class; + $booted = []; + + static::$trait_initializers[ $class ] = []; + + foreach ( class_uses_recursive( $class ) as $trait ) { + $trait_method = strtolower( class_basename( $trait ) ); + $method = 'boot_' . $trait_method; + + if ( method_exists( $class, $method ) && ! in_array( $method, $booted ) ) { + forward_static_call( [ $class, $method ] ); + + $booted[] = $method; + } + + $method = 'initialize_' . $trait_method; + + if ( method_exists( $class, $method ) ) { + static::$trait_initializers[ $class ][] = $method; + + static::$trait_initializers[ $class ] = array_unique( + static::$trait_initializers[ $class ] + ); + } + } + } + + /** + * Initialize any initializable traits on the model. + * + * @return void + */ + protected function initialize_traits() { + foreach ( static::$trait_initializers[ static::class ] as $method ) { + $this->{ $method }(); + } + } + + /** + * Bootstrap the model. + * + * Model booting is performed the first time a model is used in a request. + */ + protected static function boot() { } + + /** + * Infer the object type for the model. + */ + public static function get_object_name(): ?string { + // Use the model's object name if it exists. + if ( ! empty( static::$object_name ) ) { + return (string) static::$object_name; + } + + // Infer the object name from the model name. + $parts = explode( '\\', static::class ); + return str_replace( '__', '_', Str::snake( array_pop( $parts ) ) ); + } + + /** + * Check if an offset exists. + * + * @param mixed $offset Array offset. + */ + public function offsetExists( mixed $offset ): bool { + return null !== $this->get( $offset ); + } + + /** + * Get data by the offset. + * + * @param mixed $offset Array offset. + */ + public function offsetGet( mixed $offset ): mixed { + return $this->get( $offset ); + } + + /** + * Set data by offset. + * + * @param mixed $offset Offset name. + * @param mixed $value Value to set. + */ + public function offsetSet( mixed $offset, mixed $value ): void { + $this->set( $offset, $value ); + } + + /** + * Unset data by offset. + * + * @param string $offset Offset to unset. + */ + public function offsetUnset( mixed $offset ): void { + $this->set( $offset, null ); + + unset( $this->relations[ $offset ] ); + } + + /** + * Magic Method to get Attributes + * + * @param string $offset Attribute to get. + */ + public function __get( $offset ) { + return $this->get( $offset ); + } + + /** + * Magic Method to set Attributes. + * + * @param string $offset Attribute to get. + * @param mixed $value Value to set. + */ + public function __set( $offset, $value ) { + $this->set( $offset, $value ); + } + + /** + * Create a new query instance. + * + * @return Builder<static> + */ + public static function query(): Builder { + return ( new static() )->new_query(); + } + + /** + * Begin a query with eager loading. + * + * @param string ...$relations Relations to eager load. + * @return Builder<static> + */ + public static function with( ...$relations ): Builder { + return static::query()->with( ...$relations ); + } + + /** + * Begin a query without eager loading relationships. + * + * @param string ...$relations Relations to not eager load. + * @return Builder<static> + */ + public static function without( ...$relations ): Builder { + return static::query()->without( ...$relations ); + } + + /** + * Create a new query instance. + * + * @return Builder<static> + * @throws Model_Exception Thrown for an unknown query builder for the model. + */ + public function new_query(): Builder { + $builder = static::get_query_builder_class(); + + if ( empty( $builder ) ) { + throw new Model_Exception( 'Unknown query builder for model: ' . static::class ); + } + + return $this->register_global_scopes( + new $builder( static::class ) + ) + ->with( ...$this->with ); + } + + /** + * Register the global scopes for this builder instance. + * + * @param Builder $builder Builder instance. + * @return Builder + */ + public function register_global_scopes( Builder $builder ) { + foreach ( $this->get_global_scopes() as $identifier => $scope ) { + $builder->with_global_scope( $identifier, $scope ); + } + + return $builder; + } + + /** + * Handle dynamic method calls into the model. + * + * @param string $method Method name. + * @param array $parameters Method parameters. + * @return mixed + */ + public function __call( string $method, array $parameters ) { + return $this->forward_call_to( $this->new_query(), $method, $parameters ); + } + + /** + * Handle dynamic static method calls into the model. + * + * @param string $method Method name. + * @param array $parameters Method parameters. + * @return mixed + */ + public static function __callStatic( string $method, array $parameters ) { + return ( new static() )->$method( ...$parameters ); + } + + /** + * Get the primary key for the model. + */ + public function get_key_name(): string { + return $this->primary_key; + } + + /** + * Get the default foreign key name for the model. + */ + public function get_foreign_key(): string { + return Str::snake( str_replace( '_', '', class_basename( $this ) ) ) . '_' . $this->get_key_name(); + } + + /** + * Get the value of the model's route key. + * + * @return mixed + */ + public function get_route_key() { + return $this->get_attribute( $this->get_route_key_name() ); + } + + /** + * Get the route key for models. + */ + public function get_route_key_name(): string { + return 'slug'; + } + + /** + * Get the registerable route for the model. By default this is set relative + * the object's archive route with the object's slug. + * + * /object_name/object_slug/ + */ + public static function get_route(): ?string { + return static::get_archive_route() . '/{slug}'; + } + + /** + * Get the registerable archive route for the model. By default this is set to + * the object's name: + * + * /object_name/ + */ + public static function get_archive_route(): ?string { + return '/' . static::get_object_name(); + } + + /** + * Retrieve the model for a bound value. + * + * @param mixed $value Value to compare against. + * @param string|null $field Field to compare against. + * @return static|null + */ + public function resolve_route_binding( $value, $field = null ) { + $key = $field ?? $this->get_route_key_name(); + + // If the key is the same as the primary key, use the find method to help with some caching. + if ( $key === $this->primary_key ) { + return static::find( $value ); + } + + return static::query()->where( $key, $value )->first(); + } + + /** + * Get all the models from the database. + */ + public static function all(): Collection { + return static::query()->take( -1 )->get(); + } + + /** + * Create a new instance of a model and save it. + * + * @param array $args Model arguments. + * @return static + */ + public static function create( array $args ) { + $instance = new static(); + + if ( $instance instanceof Updatable ) { + $instance->save( $args ); + $instance->refresh(); + } + + return $instance; + } + + /** + * Get the first record matching the attributes or instantiate it. + * + * @param array $attributes Attributes to match. + * @param array $values Values to set. + */ + public static function first_or_new( array $attributes, array $values = [] ): static { + $instance = static::query()->where( $attributes )->first(); + + if ( ! $instance ) { + return new static( array_merge( $attributes, $values ) ); + } + + return $instance; + } + + /** + * Get the first record matching the attributes or creates it. + * + * @param array $attributes Attributes to match. + * @param array $values Values to set. + */ + public static function first_or_create( array $attributes, array $values = [] ): static { + $instance = static::query()->where( $attributes )->first(); + + if ( ! $instance ) { + return static::create( array_merge( $attributes, $values ) ); + } + + return $instance; + } + + /** + * Create or update a record matching the attributes, and fill it with values. + * + * @param array $attributes Attributes to match. + * @param array $values Values to set. + */ + public static function update_or_create( array $attributes, array $values = [] ): static { + return tap( + static::first_or_new( $attributes ), + fn ( $instance ) => $instance->fill( $values )->save(), + ); + } + + /** + * Convert the model instance to an array. + */ + public function to_array(): array { + return $this->attributes_to_array(); + } + + /** + * Convert the object into something JSON serializable. + * + * @return array + */ + public function jsonSerialize(): mixed { + return $this->to_array(); + } + + /** + * Convert the object to its JSON representation. + * + * @param int $options json_encode() options. + */ + public function to_json( $options = 0 ): string { + return wp_json_encode( $this->to_array(), $options ); + } +} diff --git a/vendor/mantle-framework/database/model/class-permalink-generator.php b/vendor/mantle-framework/database/model/class-permalink-generator.php new file mode 100644 index 00000000..689eecab --- /dev/null +++ b/vendor/mantle-framework/database/model/class-permalink-generator.php @@ -0,0 +1,129 @@ +<?php +/** + * Permalink_Generator class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model; + +use Mantle\Contracts\Database\Core_Object; +use Mantle\Database\Model\Events\Permalink_Generated; + +use function Mantle\Support\Helpers\event; + +/** + * Model Permalink Generator + * + * Generate a model's permalink using attributes and aliases from the model. + */ +class Permalink_Generator implements \Stringable { + /** + * Attributes for the generator. + * + * @var string[] + */ + protected $attributes = []; + + /** + * Constructor. + * + * @param string $route Route to generate for. + * @param Model|null $model Model to generator for, optional. + */ + public function __construct( protected ?string $route, protected ?Model $model = null ) { + } + + /** + * Generate a new instance. + * + * @param string $route Route to generate for. + * @param Model|null $model Model to generator for, optional. + */ + public static function create( string $route, Model $model = null ): Permalink_Generator { + return new static( $route, $model ); + } + + /** + * Generate the permalink. + */ + public function permalink(): string { + event( new Permalink_Generated( $this ) ); + + $route = preg_replace_callback( + '/({[A-Za-z0-9-_]*})/', + function ( $match ) { + $attribute = substr( $match[0], 1, strlen( $match[0] ) - 2 ); + + return $this->get_attribute( $attribute ); + }, + (string) $this->route + ); + + return home_url( $route ); + } + + /** + * Retrieve the model instance. + */ + public function get_model(): ?Model { + return $this->model; + } + + /** + * Retrieve the generator route. + */ + public function get_route(): ?string { + return $this->route; + } + + /** + * Set the attributes for the generator. + */ + protected function set_attributes(): void { + if ( $this->model ) { + foreach ( $this->model->get_attributes() as $attribute => $value ) { + $this->set_attribute( $attribute, $value ); + } + } + } + + /** + * Get an attribute. + * + * @param string $attribute Attribute to get. + */ + public function get_attribute( string $attribute ): string { + $value = $this->attributes[ $attribute ] ?? $this->model->get( $attribute ); + + // Fallback to the model's slug when using the object name as an attribute. + if ( empty( $value ) && $attribute === $this->model::get_object_name() && $this->model instanceof Core_Object ) { + $value = $this->model->slug(); + } + + if ( ! $value && $this->model instanceof \Mantle\Database\Model\Model ) { + $value = $this->model[ $attribute ] ?? null; + } + + return (string) $value; + } + + /** + * Set an attribute for the generator. + * + * @param string $attribute Attribute to set. + * @param string $value Value to set. + * @return static + */ + public function set_attribute( string $attribute, string $value ) { + $this->attributes[ $attribute ] = $value; + return $this; + } + + /** + * Convert the class to string. + */ + public function __toString(): string { + return $this->permalink(); + } +} diff --git a/vendor/mantle-framework/database/model/class-post.php b/vendor/mantle-framework/database/model/class-post.php new file mode 100644 index 00000000..6e4ec530 --- /dev/null +++ b/vendor/mantle-framework/database/model/class-post.php @@ -0,0 +1,474 @@ +<?php +/** + * Post class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model; + +use Carbon\Carbon; +use DateTime; +use DateTimeInterface; +use Mantle\Contracts; +use Mantle\Database\Query\Builder; +use Mantle\Database\Query\Post_Query_Builder; +use Mantle\Support\Helpers; + +/** + * Post Model + * + * @extends Model<\WP_Post> + * + * @property int $comment_count + * @property int $ID + * @property int $menu_order + * @property int $post_author + * @property int $post_parent + * @property string $comment_status + * @property string $filter + * @property string $guid + * @property string $ping_status + * @property string $pinged + * @property string $post_content + * @property string $post_date + * @property string $post_date_gmt + * @property string $post_excerpt + * @property string $post_mime_type + * @property string $post_modified + * @property string $post_modified_gmt + * @property string $post_name + * @property string $post_password + * @property string $post_status + * @property string $post_title + * @property string $post_type + * @property string $to_ping + * @property string $content Alias to post_content. + * @property string $date Alias to post_date. + * @property string $date_gmt Alias to post_date_gmt. + * @property string $modified Alias to post_modified. + * @property string $modified_gmt Alias to post_modified_gmt. + * @property string $description Alias to post_excerpt. + * @property string $id Alias to ID. + * @property string $name Alias to post_title. + * @property string $slug Alias to post_name. + * @property string $status Alias to post_status. + * @property string $title Alias to post_title. + * + * @method static \Mantle\Database\Factory\Post_Factory<static, \WP_Post, static> factory( array|callable|null $state = null ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> anyStatus() + * @method static \Mantle\Database\Query\Post_Query_Builder<static> where( string|array $attribute, mixed $value ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> whereId( int $id ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> whereNotIn(string $key, array $values) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> whereIn(string $key, array $values) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> whereName( string $name ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> whereSlug( string $slug ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> whereStatus( string $status ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> whereTitle( string $title ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> whereType( string $type ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> whereTerm( array|\WP_Term|\Mantle\Database\Model\Term|int $term, ?string $taxonomy = null, string $operator = 'IN', string $field = 'term_id' ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> andWhereTerm( array|\WP_Term|\Mantle\Database\Model\Term|int $term, ?string $taxonomy = null, string $operator = 'IN', string $field = 'term_id' ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> orWhereTerm( array|\WP_Term|\Mantle\Database\Model\Term|int $term, ?string $taxonomy = null, string $operator = 'IN', string $field = 'term_id' ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> whereMeta( string|\BackedEnum $key, mixed $value, string $operator = '=' ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> whereRaw( array|string $column, ?string $operator = null, mixed $value = null, string $boolean = 'AND' ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> where_raw( array|string $column, ?string $operator = null, mixed $value = null, string $boolean = 'AND' ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> orWhereRaw( array|string $column, ?string $operator = null, mixed $value = null, string $boolean = 'AND' ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> or_where_raw( array|string $column, ?string $operator = null, mixed $value = null, string $boolean = 'AND' ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> whereDate( DateTimeInterface|int|string $date, string $compare = '=', string $column = 'post_date' ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> whereUtcDate( DateTimeInterface|int|string $date, string $compare = '=' ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> whereModifiedDate( DateTimeInterface|int|string $date, string $compare = '=' ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> whereModifiedUtcDate( DateTimeInterface|int|string $date, string $compare = '=' ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> olderThan( DateTimeInterface|int $date, string $column = 'post_date' ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> olderThanOrEqualTo( DateTimeInterface|int $date, string $column = 'post_date' ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> older_than( DateTimeInterface|int $date, string $column = 'post_date' ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> older_than_or_equal_to( DateTimeInterface|int $date, string $column = 'post_date' ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> newerThan( DateTimeInterface|int $date, string $column = 'post_date' ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> newerThanOrEqualTo( DateTimeInterface|int $date, string $column = 'post_date' ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> newer_than( DateTimeInterface|int $date, string $column = 'post_date' ) + * @method static \Mantle\Database\Query\Post_Query_Builder<static> newer_than_or_equal_to( DateTimeInterface|int $date, string $column = 'post_date' ) + */ +class Post extends Model implements Contracts\Database\Core_Object, Contracts\Database\Model_Meta, Contracts\Database\Updatable { + use Dates\Has_Dates, + Events\Post_Events, + Meta\Model_Meta, + Meta\Post_Meta, + Term\Model_Term; + + /** + * Attributes for the model from the object + * + * @var array<string, string> + */ + protected static $aliases = [ + 'content' => 'post_content', + 'date' => 'post_date', + 'date_gmt' => 'post_date_gmt', + 'modified' => 'post_modified', + 'modified_gmt' => 'post_modified_gmt', + 'description' => 'post_excerpt', + 'id' => 'ID', + 'title' => 'post_title', + 'name' => 'post_title', + 'slug' => 'post_name', + 'status' => 'post_status', + ]; + + /** + * Attributes that are guarded. + * + * @var array + */ + protected $guarded_attributes = [ + 'ID', + ]; + + /** + * The attributes that should be hidden for serialization. + * + * @var string[] + */ + protected $hidden = [ + 'post_password', + ]; + + /** + * Post type for the model. + * + * @var string + */ + public static $object_name; + + /** + * Constructor. + * + * @param mixed $object Model object. + */ + public function __construct( $object = [] ) { + // Set the post type on the model by default. + $this->attributes['post_type'] = $this->get_object_name(); + + parent::__construct( $object ); + } + + /** + * Find a model by Object ID. + * + * @todo Add global scopes for the model to allow for the query builder + * to verify the object type as well. + * + * @param \WP_Post|int $object Post to retrieve for. + * @return static|null + */ + public static function find( $object ) { + $post = Helpers\get_post_object( $object ); + + if ( empty( $post ) ) { + return null; + } + + // Verify the object type matches the model type. + if ( static::get_object_name() !== $post->post_type ) { + return null; + } + + return static::new_from_existing( (array) $post ); + } + + /** + * Create a new model instance for a given post type. + * + * @param string $post_type Post type to create the model for. + */ + public static function for( string $post_type ): self { + $instance = new class() extends Post { + /** + * Constructor. + */ + public function __construct() {} + + /** + * Post type for the model. + */ + public static string $for_object_name = ''; + + /** + * Retrieve the object name. + */ + public static function get_object_name(): ?string { + return static::$for_object_name; + } + + /** + * Boot the model if it has not been booted. + * + * Prevent booting the model unless the object name is set. + */ + public static function boot_if_not_booted(): void { + if ( empty( static::$for_object_name ) ) { + return; + } + + parent::boot_if_not_booted(); + } + }; + + $instance::$for_object_name = $post_type; + $instance::boot_if_not_booted(); + + return $instance; + } + + /** + * Query builder class to use. + */ + public static function get_query_builder_class(): ?string { + return Post_Query_Builder::class; + } + + /** + * Create a new query instance. + * + * @return \Mantle\Database\Query\Post_Query_Builder<static> + */ + public static function query(): Post_Query_Builder { + return ( new static() )->new_query(); + } + + /** + * Getter for Object ID. + */ + public function id(): int { + return (int) $this->get( 'id' ); + } + + /** + * Getter for Object Name. + */ + public function name(): string { + return (string) $this->get( 'name' ); + } + + /** + * Getter for Object Slug. + */ + public function slug(): string { + return (string) $this->get( 'slug' ); + } + + /** + * Getter for Parent Object (if any) + */ + public function parent(): ?Contracts\Database\Core_Object { + if ( ! empty( $this->attributes['post_parent'] ) ) { + return static::find( (int) $this->attributes['post_parent'] ); + } + + return null; + } + + /** + * Getter for Object Description + */ + public function description(): string { + return (string) $this->get( 'description' ); + } + + /** + * Getter for Object Status + * + * @return string + */ + public function status(): ?string { + return $this->get( 'status' ) ?? null; + } + + /** + * Getter for the Object Permalink + */ + public function permalink(): ?string { + return (string) \get_permalink( $this->id() ); + } + + /** + * Retrieve the core object for the underlying object. + */ + public function core_object(): ?\WP_Post { + $id = $this->id(); + + if ( $id ) { + return Helpers\get_post_object( $id ); + } + + return null; + } + + /** + * Publish a post. + */ + public function publish() : bool { + return $this->save( [ 'status' => 'publish' ] ); + } + + /** + * Schedule a post for publication. + * + * @param string|DateTime $date Date to schedule the post for. + */ + public function schedule( $date ) : bool { + if ( $date instanceof DateTime ) { + $date = $date->format( 'Y-m-d H:i:s' ); + } else { + $date = Carbon::parse( $date )->format( 'Y-m-d H:i:s' ); + } + + return $this->save( + [ + 'status' => 'future', + 'date' => $date, + ] + ); + } + + /** + * Save the model. + * + * @param array<string, mixed> $attributes Attributes to save. + * + * @throws Model_Exception Thrown on error saving. + */ + public function save( array $attributes = [] ): bool { + $this->set_attributes( $attributes ); + + $id = $this->id(); + + // Update the post modified date if it has been modified. + if ( $this->is_attribute_modified( 'post_modified' ) || $this->is_attribute_modified( 'post_modified_gmt' ) ) { + add_filter( 'wp_insert_post_data', [ $this, 'set_post_modified_date_on_save' ] ); + } + + if ( empty( $id ) ) { + $save = \wp_insert_post( $this->get_attributes(), true ); + + if ( \is_wp_error( $save ) ) { + throw new Model_Exception( 'Error saving model: ' . $save->get_error_message() ); + } + } else { + $save = \wp_update_post( + array_merge( + $this->get_modified_attributes(), + [ + 'ID' => $id, + ] + ), + true + ); + } + + if ( \is_wp_error( $save ) ) { + throw new Model_Exception( 'Error saving model: ' . $save->get_error_message() ); + } + + // Set the post ID attribute. + $this->set_raw_attribute( 'ID', $save ); + + $this->store_queued_meta(); + $this->store_queued_terms(); + $this->refresh(); + $this->reset_modified_attributes(); + + return true; + } + + /** + * Delete the model. + * + * @param bool $force Force delete the mode. + * @return \WP_Post|false|mixed + */ + public function delete( bool $force = false ) { + return \wp_delete_post( $this->id(), $force ); + } + + /** + * Allow the query to query against any post status. + * + * This will check against _any_ post status that is registered and does not + * use the 'any' post_status attribute. + * + * @param Builder $builder Query builder instance. + */ + public function scopeAnyStatus( Builder $builder ): Builder { + return $builder->where( + 'post_status', + array_values( get_post_stati( [], 'names' ) ) + ); + } + + /** + * Get the registerable route for the model. + */ + public static function get_route(): ?string { + if ( 'post' === static::get_object_name() ) { + $structure = get_option( 'permalink_structure' ); + + if ( ! empty( $structure ) ) { + $index = 1; + $structure = preg_replace_callback( + '/\%/', + function () use ( &$index ) { + return ( $index++ ) % 2 ? '{' : '}'; + }, + (string) $structure + ); + + $route_structure = str_replace( '{postname}', '{post}', (string) $structure ); + } else { + $route_structure = null; + } + } else { + $route_structure = '/' . static::get_object_name() . '/{slug}'; + } + + /** + * Filter the route structure for a post handled through the entity router. + * + * @param string $route_structure Route structure. + * @param string $object_name Post type. + * @param string $object_class Model class name. + */ + return (string) apply_filters( + 'mantle_entity_router_post_route', + $route_structure, + static::get_object_name(), + static::class + ); + } + + /** + * Set the post's modified date on save via the 'wp_insert_post_data' filter. + * + * @param array<string, mixed> $data Data to save. + */ + public function set_post_modified_date_on_save( array $data ) { + // Only update the post modified date if the post ID matches the current model. + if ( isset( $data['ID'] ) && $this->id() !== (int) $data['ID'] ) { + return $data; + } + + if ( $this->is_attribute_modified( 'post_modified' ) ) { + $date = Carbon::parse( $this->get_attribute( 'post_modified' ), wp_timezone() ); + } elseif ( $this->is_attribute_modified( 'post_modified_gmt' ) ) { + $date = Carbon::parse( $this->get_attribute( 'post_modified_gmt' ), new \DateTimeZone( 'UTC' ) ); + } else { + return $data; + } + + $data['post_modified'] = $date->setTimezone( wp_timezone() )->format( 'Y-m-d H:i:s' ); + $data['post_modified_gmt'] = $date->setTimezone( new \DateTimeZone( 'UTC' ) )->format( 'Y-m-d H:i:s' ); + + // Unhook the filter after it has been used. + remove_filter( 'wp_insert_post_data', [ $this, 'set_post_modified_date_on_save' ] ); + + return $data; + } +} diff --git a/vendor/mantle-framework/database/model/class-site.php b/vendor/mantle-framework/database/model/class-site.php new file mode 100644 index 00000000..cc977e06 --- /dev/null +++ b/vendor/mantle-framework/database/model/class-site.php @@ -0,0 +1,162 @@ +<?php +/** + * Site class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model; + +use Mantle\Contracts; +use Mantle\Support\Helpers; + +/** + * Site Model + * + * @method static \Mantle\Database\Factory\Post_Factory<static, \WP_Site, static> factory( array|callable|null $state = null ) + */ +class Site extends Model implements Contracts\Database\Core_Object, Contracts\Database\Updatable { + /** + * Attributes for the model from the object + * + * @var array<string, string> + */ + protected static $aliases = [ + 'id' => 'blog_id', + 'name' => 'title', + 'slug' => 'path', + ]; + + /** + * Attributes that are guarded. + * + * @var array + */ + protected $guarded_attributes = [ + 'site_ID', + ]; + + /** + * Constructor. + * + * @param mixed $object Model object. + */ + public function __construct( $object = [] ) { + $this->attributes = (array) $object; + } + + /** + * Find a model by Object ID. + * + * @param \WP_Site|string|int $object Site to retrieve. + * @return Site|null + */ + public static function find( $object ) { + $site = Helpers\get_site_object( $object ); + return $site ? new static( $site ) : null; + } + + /** + * Getter for Object ID. + */ + public function id(): int { + return (int) $this->get( 'id' ); + } + + /** + * Getter for Object Name. + */ + public function name(): string { + return (string) \get_blog_option( $this->id(), 'blogname' ); + } + + /** + * Getter for Object Slug. + */ + public function slug(): string { + return (string) $this->get( 'slug' ); + } + + /** + * Getter for Parent Object (if any) + */ + public function parent(): ?Contracts\Database\Core_Object { + return null; + } + + /** + * Getter for Object Description + */ + public function description(): string { + return (string) $this->get( 'description' ); + } + + /** + * Getter for the Object Permalink + */ + public function permalink(): ?string { + return (string) \get_home_url( $this->id() ); + } + + /** + * Retrieve the core object for the underlying object. + */ + public function core_object(): ?\WP_Site { + $id = $this->id(); + + if ( $id ) { + return Helpers\get_site_object( $id ); + } + + return null; + } + + /** + * Save the model. + * + * @param array $attributes Attributes to save. + * + * @throws Model_Exception Thrown on error saving. + */ + public function save( array $attributes = [] ): bool { + $this->set_attributes( $attributes ); + + $id = $this->id(); + + if ( empty( $id ) ) { + $save = \wp_insert_site( $this->get_attributes() ); + } else { + $save = \wp_update_site( + $this->id(), + array_merge( + $this->get_modified_attributes(), + [ + 'ID' => $id, + ] + ) + ); + } + + if ( \is_wp_error( $save ) ) { + throw new Model_Exception( 'Error saving model: ' . $save->get_error_message() ); + } + + // Set the ID attribute. + $this->set_raw_attribute( 'blog_id', $save ); + + $this->refresh(); + $this->reset_modified_attributes(); + + return true; + } + + /** + * Delete the model. + * + * @param bool $force Force delete the mode. + * @return \WP_Site|\WP_Error The deleted site object on success, or error object on failure. + */ + public function delete( bool $force = false ) { + return \wp_delete_site( $this->id() ); + } +} diff --git a/vendor/mantle-framework/database/model/class-term.php b/vendor/mantle-framework/database/model/class-term.php new file mode 100644 index 00000000..cd92a8ec --- /dev/null +++ b/vendor/mantle-framework/database/model/class-term.php @@ -0,0 +1,296 @@ +<?php +/** + * Term class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model; + +use Mantle\Contracts\Database\Core_Object; +use Mantle\Contracts\Database\Model_Meta; +use Mantle\Contracts\Database\Updatable; +use Mantle\Database\Query\Term_Query_Builder; +use Mantle\Support\Helpers; + +/** + * Term Model + * + * @property int $id + * @property int $term_id + * @property string $name + * @property string $slug + * @property string $taxonomy + * + * @method static \Mantle\Database\Factory\Term_Factory<static, \WP_Term, static> factory( array|callable|null $state = null ) + * @method static \Mantle\Database\Query\Term_Query_Builder<static> whereId( int $id ) + * @method static \Mantle\Database\Query\Term_Query_Builder<static> whereName(string $name) + * @method static \Mantle\Database\Query\Term_Query_Builder<static> whereSlug(string $slug) + * @method static \Mantle\Database\Query\Term_Query_Builder<static> whereTaxonomy(string $taxonomy) + * @method static \Mantle\Database\Query\Term_Query_Builder<static> whereMeta(string $key, string $value) + * @method static \Mantle\Database\Query\Term_Query_Builder<static> whereNotIn(string $key, array $values) + * @method static \Mantle\Database\Query\Term_Query_Builder<static> whereIn(string $key, array $values) + * @method static \Mantle\Database\Query\Term_Query_Builder<static> where(string|array $attribute, mixed $value) + * @method static \Mantle\Database\Query\Term_Query_Builder<static> whereRaw( array|string $column, ?string $operator = null, mixed $value = null, string $boolean = 'AND' ) + * @method static \Mantle\Database\Query\Term_Query_Builder<static> where_raw( array|string $column, ?string $operator = null, mixed $value = null, string $boolean = 'AND' ) + * @method static \Mantle\Database\Query\Term_Query_Builder<static> orWhereRaw( array|string $column, ?string $operator = null, mixed $value = null, string $boolean = 'AND' ) + * @method static \Mantle\Database\Query\Term_Query_Builder<static> or_where_raw( array|string $column, ?string $operator = null, mixed $value = null, string $boolean = 'AND' ) + */ +class Term extends Model implements Core_Object, Model_Meta, Updatable { + use Events\Term_Events, + Meta\Model_Meta, + Meta\Term_Meta; + + /** + * Attributes for the model from the object + * + * @var array<string, string> + */ + protected static $aliases = [ + 'id' => 'term_id', + ]; + + /** + * Attributes that are guarded. + * + * @var array + */ + protected $guarded_attributes = [ + 'term_id', + ]; + + /** + * Object type for the model when registering the taxonomy. + * + * Used to associate a taxonomy with another object (post type). + * + * @var string[] + */ + protected static $object_types = []; + + /** + * Constructor. + * + * @param mixed $object Model object. + */ + public function __construct( $object = [] ) { + // Set the taxonomy on the model by default. + $this->attributes['taxonomy'] = $this->get_object_name(); + + parent::__construct( $object ); + } + + /** + * Taxonomy of the term. + */ + public function taxonomy(): string { + return $this->get( 'taxonomy' ); + } + + /** + * Find a model by Object ID. + * + * @param \WP_Term|string|int $object Term to retrieve. + * @return Term|null + */ + public static function find( $object ) { + $term = Helpers\get_term_object( $object ); + + if ( empty( $term ) ) { + return null; + } + + // Bail if the taxonomy doesn't match the expected object type. + if ( static::get_object_name() !== $term->taxonomy ) { + return null; + } + + return static::new_from_existing( (array) $term ); + } + + /** + * Create a new model instance for a given taxonomy. + * + * @param string $taxonomy Taxonomy to create the model for. + */ + public static function for( string $taxonomy ): self { + $instance = new class() extends Term { + /** + * Constructor. + */ + public function __construct() {} + + /** + * Boot the model if it has not been booted. + * + * Prevent booting the model unless the object name is set. + */ + public static function boot_if_not_booted(): void { + if ( empty( static::$object_name ) ) { + return; + } + + parent::boot_if_not_booted(); + } + }; + + $instance::$object_name = $taxonomy; + $instance::boot_if_not_booted(); + + return $instance; + } + + /** + * Query builder class to use. + */ + public static function get_query_builder_class(): ?string { + return Term_Query_Builder::class; + } + + /** + * Create a new query instance. + * + * @return \Mantle\Database\Query\Term_Query_Builder<static> + */ + public static function query(): Term_Query_Builder { + return ( new static() )->new_query(); + } + + /** + * Get the meta type for the object. + */ + public function get_meta_type(): string { + return 'term'; + } + + /** + * Getter for Object ID. + */ + public function id(): int { + return (int) $this->get( 'id' ); + } + + /** + * Getter for Object Name. + */ + public function name(): string { + return (string) $this->get( 'name' ); + } + + /** + * Getter for Object Slug. + */ + public function slug(): string { + return (string) $this->get( 'slug' ); + } + + /** + * Getter for Parent Object (if any) + */ + public function parent(): ?Core_Object { + $parent = $this->get( 'parent' ); + + if ( ! empty( $parent ) ) { + return static::find( (int) $parent ); + } + + return null; + } + + /** + * Getter for Object Description + */ + public function description(): string { + return (string) $this->get( 'description' ); + } + + /** + * Getter for the Object Permalink + */ + public function permalink(): ?string { + $term_link = \get_term_link( $this->id() ); + return ! \is_wp_error( $term_link ) ? (string) $term_link : null; + } + + /** + * Retrieve the core object for the underlying object. + */ + public function core_object(): ?\WP_Term { + $id = $this->id(); + + if ( $id ) { + return Helpers\get_term_object( $id ); + } + + return null; + } + + /** + * Save the model. + * + * @param array $attributes Attributes to save. + * @throws Model_Exception Thrown on error saving. + */ + public function save( array $attributes = [] ): bool { + $this->set_attributes( $attributes ); + + $id = $this->id(); + + if ( empty( $id ) ) { + $save = \wp_insert_term( + $this->name(), + $this->taxonomy(), + $this->get_attributes() + ); + } else { + $save = \wp_update_term( + $this->id(), + $this->taxonomy(), + $this->get_modified_attributes() + ); + } + + if ( \is_wp_error( $save ) ) { + throw new Model_Exception( 'Error saving model: ' . $save->get_error_message() ); + } + + $this->set_raw_attribute( 'term_id', $save['term_id'] ); + $this->store_queued_meta(); + $this->reset_modified_attributes(); + + return true; + } + + /** + * Delete the model. + * + * @param bool $force Force delete the mode, not used. + */ + public function delete( bool $force = false ): void { + \wp_delete_term( $this->id(), $this->taxonomy() ); + } + + /** + * Get the registerable route for the model. By default this is set relative + * the object's archive route with the object's slug. + * + * /object_name/object_slug/ + */ + public static function get_route(): ?string { + $route_structure = static::get_archive_route() . '/{' . static::get_object_name() . '}/'; + + /** + * Filter the route structure for a term handled through the entity router. + * + * @param string $route_structure Route structure. + * @param string $object_name Taxonomy name. + * @param string $object_class Model class name. + */ + return (string) apply_filters( + 'mantle_entity_router_term_route', + $route_structure, + static::get_object_name(), + static::class + ); + } +} diff --git a/vendor/mantle-framework/database/model/class-user.php b/vendor/mantle-framework/database/model/class-user.php new file mode 100644 index 00000000..dbe8e613 --- /dev/null +++ b/vendor/mantle-framework/database/model/class-user.php @@ -0,0 +1,186 @@ +<?php +/** + * User class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model; + +use Mantle\Contracts; +use Mantle\Support\Helpers; + +/** + * User Model + * + * @method static \Mantle\Database\Factory\User_Factory<static, \WP_User, static> factory( array|callable|null $state = null ) + */ +class User extends Model implements Contracts\Database\Core_Object, Contracts\Database\Model_Meta, Contracts\Database\Updatable { + use Meta\Model_Meta, + Meta\User_Meta; + + /** + * Attributes for the model from the object + * + * @var array<string, string> + */ + protected static $aliases = [ + 'email' => 'user_email', + 'id' => 'ID', + 'name' => 'display_name', + 'password' => 'user_pass', + 'slug' => 'user_login', + 'title' => 'display_name', + ]; + + /** + * Attributes that are guarded. + * + * @var array + */ + protected $guarded_attributes = [ + 'ID', + ]; + + /** + * Object type for the model. + * + * @var string + */ + public static $object_name = 'user'; + + /** + * Find a model by Object ID. + * + * @param \WP_User|int $object User to retrieve for. + * @return User|null + */ + public static function find( $object ) { + $user = Helpers\get_user_object( $object ); + + if ( empty( $user ) ) { + return null; + } + + return static::new_from_existing( (array) $user->data ); + } + + /** + * Query builder class to use. + */ + public static function get_query_builder_class(): ?string { + return null; + } + + /** + * Getter for Object ID. + */ + public function id(): int { + return (int) $this->get( 'id' ); + } + + /** + * Getter for Object Name. + */ + public function name(): string { + return (string) $this->get( 'name' ); + } + + /** + * Getter for Object Slug. + */ + public function slug(): string { + return (string) $this->get( 'slug' ); + } + + /** + * Getter for Parent Object (if any) + */ + public function parent(): ?Contracts\Database\Core_Object { + return null; + } + + /** + * Getter for Object Description + */ + public function description(): string { + return (string) $this->get( 'description' ); + } + + /** + * Getter for Object Status + */ + public function status(): ?string { + return null; + } + + /** + * Getter for the Object Permalink + */ + public function permalink(): ?string { + return (string) \get_author_posts_url( $this->id() ); + } + + /** + * Retrieve the core object for the underlying object. + */ + public function core_object(): ?\WP_User { + $id = $this->id(); + + if ( $id ) { + return Helpers\get_user_object( $id ); + } + + return null; + } + + /** + * Save the model. + * + * @param array $attributes Attributes to save. + * + * @throws Model_Exception Thrown on error saving. + */ + public function save( array $attributes = [] ): bool { + $this->set_attributes( $attributes ); + + $id = $this->id(); + + if ( empty( $id ) ) { + $save = \wp_insert_user( $this->get_attributes() ); + } else { + $save = \wp_update_user( + array_merge( + $this->get_modified_attributes(), + [ + 'ID' => $id, + ] + ) + ); + } + + if ( \is_wp_error( $save ) ) { + throw new Model_Exception( 'Error saving model: ' . $save->get_error_message() ); + } + + // Set the ID attribute. + $this->set_raw_attribute( 'ID', $save ); + $this->store_queued_meta(); + $this->reset_modified_attributes(); + + return true; + } + + /** + * Delete the model. + * + * @param bool $force Force delete the model, unused. + * @return bool Returns value of wp_delete_user(). + */ + public function delete( bool $force = false ) { + // Include user admin functions to get access to wp_delete_user(). + require_once ABSPATH . 'wp-admin/includes/user.php'; + + return \wp_delete_user( $this->id() ); + } +} diff --git a/vendor/mantle-framework/database/model/concerns/trait-custom-post-permalink.php b/vendor/mantle-framework/database/model/concerns/trait-custom-post-permalink.php new file mode 100644 index 00000000..317efbe7 --- /dev/null +++ b/vendor/mantle-framework/database/model/concerns/trait-custom-post-permalink.php @@ -0,0 +1,71 @@ +<?php +/** + * Custom_Post_Permalink trait file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Concerns; + +use Mantle\Database\Model\Permalink_Generator; + +use function Mantle\Support\Helpers\add_filter; + +/** + * Define custom permalink structure for post models. + */ +trait Custom_Post_Permalink { + /** + * Flag if permalinks are being used. + * + * @var bool + */ + protected static $using_permalinks; + + /** + * Boot the trait and add filters for the post type link single and archive link. + */ + public static function boot_custom_post_permalink(): void { + if ( static::get_route() ) { + if ( 'post' === static::get_object_name() ) { + add_filter( 'post_link', [ self::class, 'filter_post_type_link' ] ); + } else { + add_filter( 'post_type_link', [ self::class, 'filter_post_type_link' ] ); + } + } + + if ( static::get_archive_route() ) { + add_filter( 'post_type_archive_link', [ self::class, 'filter_post_type_archive_link' ] ); + } + + static::$using_permalinks = ! empty( get_option( 'permalink_structure' ) ); + } + + /** + * Filter the post type link to allow for customization. + * + * @param string $post_link The post's permalink. + * @param \WP_Post $post The post in question. + */ + public static function filter_post_type_link( string $post_link, \WP_Post $post ): string { + if ( ! static::$using_permalinks || static::get_object_name() !== $post->post_type ) { + return $post_link; + } + + return Permalink_Generator::create( static::get_route(), static::find_or_fail( $post->ID ) ); + } + + /** + * Filter the post type archive link. + * + * @param string $link Post type archive link. + * @param string $post_type Post type. + */ + public static function filter_post_type_archive_link( string $link, string $post_type ): string { + if ( 'post' === $post_type || ! static::$using_permalinks || static::get_object_name() !== $post_type ) { + return $link; + } + + return Permalink_Generator::create( static::get_archive_route() ); + } +} diff --git a/vendor/mantle-framework/database/model/concerns/trait-custom-term-link.php b/vendor/mantle-framework/database/model/concerns/trait-custom-term-link.php new file mode 100644 index 00000000..f9d0e0e8 --- /dev/null +++ b/vendor/mantle-framework/database/model/concerns/trait-custom-term-link.php @@ -0,0 +1,41 @@ +<?php +/** + * Custom_Term_Link trait file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Concerns; + +use Mantle\Database\Model\Permalink_Generator; + +use function Mantle\Support\Helpers\add_filter; + +/** + * Define custom permalink structure for post models. + */ +trait Custom_Term_Link { + /** + * Boot the trait and add filters for the post type link single and archive link. + */ + public static function boot_custom_term_link(): void { + if ( static::get_route() ) { + add_filter( 'term_link', [ self::class, 'filter_term_link' ], 99 ); + } + } + + /** + * Filter the term link to use the model's route. + * + * @param string $term_link Term link to filter. + * @param \WP_Term $term Term object. + * @param string $taxonomy Taxonomy name. + */ + public static function filter_term_link( string $term_link, \WP_Term $term, string $taxonomy ): string { + if ( static::get_object_name() !== $taxonomy ) { + return $term_link; + } + + return Permalink_Generator::create( static::get_route(), static::find_or_fail( $term->term_id ) ); + } +} diff --git a/vendor/mantle-framework/database/model/concerns/trait-has-aliases.php b/vendor/mantle-framework/database/model/concerns/trait-has-aliases.php new file mode 100644 index 00000000..f92da4a7 --- /dev/null +++ b/vendor/mantle-framework/database/model/concerns/trait-has-aliases.php @@ -0,0 +1,38 @@ +<?php +/** + * Has_Aliases trait file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Concerns; + +/** + * Model Aliases + */ +trait Has_Aliases { + /** + * Model aliases. + * + * @var array<string, string> + */ + protected static $aliases = []; + + /** + * Check if an alias exists for an attribute. + * + * @param string $attribute Attribute to check. + */ + public static function has_attribute_alias( string $attribute ): bool { + return ! empty( static::$aliases[ $attribute ] ); // phpcs:ignore WordPressVIPMinimum.Variables.VariableAnalysis.StaticOutsideClass + } + + /** + * Get an alias for an attribute. + * + * @param string $attribute Attribute to get alias for. + */ + public static function get_attribute_alias( string $attribute ): string { + return static::$aliases[ $attribute ] ?? ''; // phpcs:ignore WordPressVIPMinimum.Variables.VariableAnalysis.StaticOutsideClass + } +} diff --git a/vendor/mantle-framework/database/model/concerns/trait-has-attributes.php b/vendor/mantle-framework/database/model/concerns/trait-has-attributes.php new file mode 100644 index 00000000..a1f1afdb --- /dev/null +++ b/vendor/mantle-framework/database/model/concerns/trait-has-attributes.php @@ -0,0 +1,476 @@ +<?php +/** + * Has_Attributes trait file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Concerns; + +use LogicException; +use Mantle\Database\Model\Model_Exception; +use Mantle\Database\Model\Relations\Relation; + +use function Mantle\Support\Helpers\collect; +use function Mantle\Support\Helpers\tap; + +/** + * Model Attributes + */ +trait Has_Attributes { + use Has_Guarded_Attributes, Hides_Attributes; + + /** + * Attributes for the model from the object + * + * @var array + */ + protected $attributes = []; + + /** + * Keep track of attributes that have been modified. + * + * @var array + */ + protected $modified_attributes = []; + + /** + * The attributes that should be cast. + * + * @var array + */ + protected $casts = []; + + /** + * The accessors to append to the model's array form. + * + * @var array + */ + protected $appends = []; + + /** + * The built-in, primitive cast types supported by the model. + * + * @var array + */ + protected static $supported_cast_types = [ + 'array', + 'bool', + 'boolean', + 'double', + 'float', + 'int', + 'integer', + 'json', + 'object', + 'real', + 'string', + 'timestamp', + ]; + + /** + * Get an attribute from the model. + * + * @param string $attribute Attribute name. + * @return mixed + */ + public function get_attribute( string $attribute ) { + // Retrieve the attribute from the object. + if ( isset( $this->attributes[ $attribute ] ) || $this->has_get_mutator( $attribute ) ) { + $value = $this->attributes[ $attribute ] ?? null; + + // Check if an attribute has a cast. + if ( isset( $this->casts[ $attribute ] ) ) { + $this->cast_attribute( $value, $this->casts[ $attribute ] ); + } + + // Pass the attribute to the mutator. + if ( $this->has_get_mutator( $attribute ) ) { + $value = $this->mutate_attribute( $attribute, $value ); + } + } elseif ( 'ID' !== $attribute ) { + $value = $this->get_relation_value( $attribute ); + } + + return $value ?? null; + } + + /** + * Retrieve a relationship value. + * + * @param string $key Relation name. + * @return \Mantle\Database\Model\Relations\Relation|null + */ + public function get_relation_value( string $key ) { + if ( 'ID' === $key ) { + return null; + } + + if ( array_key_exists( $key, $this->relations ) ) { + return $this->relations[ $key ]; + } + + if ( method_exists( $this, $key ) ) { + return $this->get_relationship_from_method( $key ); + } + + return null; + } + + /** + * Retrieve a relationship from a method. + * + * @param string $method + * @return Relation + * + * @throws LogicException Thrown if the relationship method is not an instance + * of Relation. + */ + protected function get_relationship_from_method( string $method ) { + $relation = $this->$method(); + + if ( ! $relation instanceof Relation ) { + throw new LogicException( + sprintf( + '%s::%s must return a relationship instance.', + static::class, + $method + ) + ); + } + + return tap( + $relation->get_results(), + function( $relation ) use ( $method ): void { + $this->set_relation( $method, $relation ); + } + ); + } + + /** + * Set a model attribute. + * + * @todo Add cast support. + * + * @param string $attribute Attribute name. + * @param mixed $value Value to set. + * @return static + * + * @throws Model_Exception Thrown when trying to set 'id'. + */ + public function set_attribute( string $attribute, $value ) { + if ( $this->is_guarded( $attribute ) ) { + throw new Model_Exception( "Unable to set '{$attribute} on model." ); + } + + if ( $this->has_set_mutator( $attribute ) ) { + $value = $this->mutate_set_attribute( $attribute, $value ); + } else { + $this->attributes[ $attribute ] = $value; + } + + $this->modified_attributes[] = $attribute; + + return $this; + } + + /** + * Set a raw attribute on the model. + * + * @param string $attribute Attribute name. + * @param mixed $value Value to set. + * @return static + */ + public function set_raw_attribute( string $attribute, $value ) { + $this->attributes[ $attribute ] = $value; + + return $this; + } + + /** + * Get all model attributes. + */ + public function get_attributes(): array { + $attributes = []; + + foreach ( $this->attributes as $key => $value ) { + $attributes[ $key ] = $this->get_attribute( $key ); + } + + return $attributes; + } + + /** + * Get an attribute array of all arrayable attributes. + */ + protected function get_arrayable_attributes(): array { + return $this->get_arrayable_items( $this->get_attributes() ); + } + + /** + * Convert the models' attributes to an array. + */ + public function attributes_to_array(): array { + // Retrieve all attributes, passing them through the mutators. + $attributes = collect( $this->get_arrayable_attributes() ) + ->map( + fn ( $value, string $attribute) => $this->get_attribute( $attribute ) + ) + ->merge( $this->get_arrayable_appends() ); + + return $attributes->to_array(); + } + + /** + * Get an attribute array of all arrayable values. + * + * Filters out any hidden attribute that shouldn't appear and only includes + * visible attributes if set. + * + * @param string[] $values Values to check. + */ + protected function get_arrayable_items( array $values ): array { + $visible = $this->get_visible(); + $hidden = $this->get_hidden(); + + if ( ! empty( $visible ) ) { + $values = array_intersect_key( $values, array_flip( $visible ) ); + } + + if ( ! empty( $hidden ) ) { + return array_diff_key( $values, array_flip( $hidden ) ); + } + + return $values; + } + + /** + * Get the raw model attributes. + */ + public function get_raw_attributes(): array { + return $this->attributes; + } + + /** + * Get all modified attributes. + */ + public function get_modified_attributes(): array { + if ( empty( $this->modified_attributes ) ) { + return []; + } + + $attributes = []; + foreach ( array_unique( $this->modified_attributes ) as $attribute ) { + $attributes[ $attribute ] = $this->attributes[ $attribute ] ?? null; + } + + return $attributes; + } + + /** + * Check if an attribute has been modified. + * + * @param string $attribute Attribute to check. + */ + public function is_attribute_modified( string $attribute ): bool { + return in_array( $attribute, $this->modified_attributes, true ); + } + + /** + * Set an array of attributes. + * + * @param array $attributes Attributes to set. + * @return static + */ + public function set_attributes( array $attributes ) { + foreach ( $attributes as $key => $value ) { + $this->set( $key, $value ); + } + + return $this; + } + + /** + * Set the raw attributes on the model. + * + * @param array $attributes Raw attributes to set. + * @return static + */ + public function set_raw_attributes( array $attributes ) { + $this->attributes = $attributes; + return $this; + } + + /** + * Reset the modified attributes. + */ + protected function reset_modified_attributes() { + $this->modified_attributes = []; + } + + /** + * Cast an attribute to a specific value. + * + * @todo Add date, collection cast types. + * + * @param mixed $value Attribute value. + * @param string $cast_type Cast type. + * @return mixed + */ + protected function cast_attribute( $value, string $cast_type ) { + return match ($cast_type) { + 'int', 'integer' => (int) $value, + 'real', 'float', 'double' => $this->from_float( $value ), + 'string' => (string) $value, + 'bool', 'boolean' => (bool) $value, + 'object' => $this->from_json( $value, true ), + 'array', 'json' => $this->from_json( $value ), + default => $value, + }; + } + + /** + * Decode the given float. + * + * @param mixed $value Value to decode. + */ + public function from_float( $value ): float { + return match ( (string) $value) { + 'Infinity' => INF, + '-Infinity' => -INF, + 'NaN' => NAN, + default => (float) $value, + }; + } + + /** + * Encode the given value as JSON. + * + * @param mixed $value Value to encode. + */ + protected function as_json( $value ): string { + return \wp_json_encode( $value ); + } + + /** + * Decode the given JSON back into an array or object. + * + * @param string $value Value to convert. + * @param bool $as_object Flag as an object. + * @return mixed + */ + public function from_json( string $value, bool $as_object = false ) { + return json_decode( $value, ! $as_object ); + } + + /** + * Get the mutator method name for an attribute. + * + * @param string $attribute Attribute name. + */ + public function get_mutator_method_name( string $attribute ): string { + return 'get_' . strtolower( $attribute ) . '_attribute'; + } + + /** + * Get the set mutator method name for an attribute. + * + * @param string $attribute Attribute name. + */ + public function get_set_mutator_method_name( string $attribute ): string { + return 'set_' . strtolower( $attribute ) . '_attribute'; + } + + /** + * Check if the attribute has a get mutator. + * + * @param string $attribute Attribute to check. + */ + public function has_get_mutator( string $attribute ): bool { + return method_exists( $this, $this->get_mutator_method_name( $attribute ) ); + } + + /** + * Check if the attribute has a set mutator. + * + * @param string $attribute Attribute to check. + */ + public function has_set_mutator( string $attribute ): bool { + return method_exists( $this, $this->get_set_mutator_method_name( $attribute ) ); + } + + /** + * Pass an attribute through a get mutator. + * + * @param string $attribute Attribute to check. + * @param mixed $value Attribute value. + * @return mixed + */ + public function mutate_attribute( string $attribute, $value ) { + return $this->{ $this->get_mutator_method_name( $attribute ) }( $value ); + } + + /** + * Pass an attribute through a set mutator. + * + * @param string $attribute Attribute to check. + * @param mixed $value Attribute value. + * @return mixed + */ + public function mutate_set_attribute( string $attribute, $value ) { + return $this->{ $this->get_set_mutator_method_name( $attribute ) }( $value ); + } + + /** + * Set the accessors to append to model arrays. + * + * @param string|string[] ...$appends Accessors to append. + * @return static + */ + public function set_appends( ...$appends ) { + $this->appends = $appends; + return $this; + } + + /** + * Check if an attribute is being appended. + * + * @param string $attribute Attribute to check. + */ + public function has_appended( string $attribute ): bool { + return in_array( $attribute, $this->appends, true ); + } + + /** + * Append attributes to the model arrays. + * + * @param string|string[] ...$attributes Attributes to append. + * @return static + */ + public function append( ...$attributes ) { + $this->appends = array_unique( + array_merge( $this->appends, $attributes ) + ); + + return $this; + } + + /** + * Retrieve all the appendable values in an array. + */ + public function get_arrayable_appends(): array { + if ( empty( $this->appends ) ) { + return []; + } + + return $this->get_arrayable_items( + collect( $this->appends ) + ->combine( + collect( $this->appends )->map( + fn ( string $attribute) => $this->get_attribute( $attribute ) + ) + ) + ->to_array() + ); + } +} diff --git a/vendor/mantle-framework/database/model/concerns/trait-has-events.php b/vendor/mantle-framework/database/model/concerns/trait-has-events.php new file mode 100644 index 00000000..de2d38c8 --- /dev/null +++ b/vendor/mantle-framework/database/model/concerns/trait-has-events.php @@ -0,0 +1,189 @@ +<?php +/** + * Has_Events class file. + * + * @package Mantle + * + * @phpcs:disable WordPressVIPMinimum.Variables.VariableAnalysis.StaticOutsideClass + */ + +namespace Mantle\Database\Model\Concerns; + +use Mantle\Events\Dispatcher; +use InvalidArgumentException; + +/** + * Model Event Listener + */ +trait Has_Events { + /** + * The event dispatcher instance. + * + * @var \Mantle\Events\Dispatcher|null + */ + protected static $dispatcher; + + /** + * Register a model event with the dispatcher. + * + * @param string $event Event name to listen to. + * @param \Closure|string $callback + * @throws InvalidArgumentException Thrown on a missing dispatcher. + */ + protected static function register_model_event( $event, $callback ) { + $name = static::class; + if ( isset( static::$dispatcher ) ) { + static::$dispatcher->listen( "model.{$event}: {$name}", $callback ); + } else { + throw new InvalidArgumentException( "Model event dispatcher not set: [{$name}]" ); + } + } + + /** + * Fire the given event for the model. + * + * @param string $event Event being fired. + * @return mixed + */ + public function fire_model_event( $event ) { + if ( ! isset( static::$dispatcher ) ) { + return true; + } + + return static::$dispatcher->dispatch( + "model.{$event}: " . static::class, + $this + ); + } + + /** + * Register a creating model event with the dispatcher. + * + * Note: *is not* supported at this time! + * + * @param \Closure|string $callback + * @throws \RuntimeException Thrown on use. + */ + public static function creating( $callback ): never { + throw new \RuntimeException( 'Listening to the "creating" event on a model is not supported at this time.' ); + } + + /** + * Register a created model event with the dispatcher. + * + * @param \Closure|string $callback + */ + public static function created( $callback ): void { + static::register_model_event( 'created', $callback ); + } + + /** + * Register a updating model event with the dispatcher. + * + * @param \Closure|string $callback + */ + public static function updating( $callback ): void { + static::register_model_event( 'updating', $callback ); + } + + /** + * Register a updated model event with the dispatcher. + * + * @param \Closure|string $callback + */ + public static function updated( $callback ): void { + static::register_model_event( 'updated', $callback ); + } + + /** + * Register a trashing model event with the dispatcher. + * + * @param \Closure|string $callback + */ + public static function trashing( $callback ): void { + static::register_model_event( 'trashing', $callback ); + } + + /** + * Register a trashed model event with the dispatcher. + * + * @param \Closure|string $callback + */ + public static function trashed( $callback ): void { + static::register_model_event( 'trashed', $callback ); + } + + /** + * Register a deleting model event with the dispatcher. + * + * @param \Closure|string $callback + */ + public static function deleting( $callback ): void { + static::register_model_event( 'deleting', $callback ); + } + + /** + * Register a deleted model event with the dispatcher. + * + * @param \Closure|string $callback + */ + public static function deleted( $callback ): void { + static::register_model_event( 'deleted', $callback ); + } + + /** + * Get the event dispatcher instance. + */ + public static function get_event_dispatcher(): Dispatcher { + return static::$dispatcher; + } + + /** + * Set the event dispatcher instance. + * + * @param Dispatcher $dispatcher Dispatcher instance. + */ + public static function set_event_dispatcher( Dispatcher $dispatcher ): void { + static::$dispatcher = $dispatcher; + } + + /** + * Unset the event dispatcher for models. + */ + public static function unset_event_dispatcher(): void { + static::$dispatcher = null; + } + + /** + * Get the observable event names. + * + * @return array + */ + public function get_observable_events() { + return [ + 'creating', + 'created', + 'updating', + 'updated', + 'trashing', + 'trashed', + 'deleting', + 'deleted', + ]; + } + + /** + * Remove all of the event listeners for the model. + */ + public static function flush_event_listeners(): void { + if ( ! isset( static::$dispatcher ) ) { + return; + } + + $instance = new static(); + + foreach ( $instance->get_observable_events() as $event ) { + static::$dispatcher->forget( "model.{$event}: " . static::class ); + } + } +} diff --git a/vendor/mantle-framework/database/model/concerns/trait-has-factory.php b/vendor/mantle-framework/database/model/concerns/trait-has-factory.php new file mode 100644 index 00000000..1ba2a18b --- /dev/null +++ b/vendor/mantle-framework/database/model/concerns/trait-has-factory.php @@ -0,0 +1,53 @@ +<?php +/** + * Has_Factory trait file + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Concerns; + +use Mantle\Database\Factory\Factory; +use Mantle\Database\Factory\Post_Factory; +use Mantle\Database\Factory\Term_Factory; + +/** + * Trait to add a factory to a model. + * + * @template TObject + */ +trait Has_Factory { + /** + * Create a builder for the model. + * + * @param array|callable $state Default state array or callable that will be invoked to set state. + * @return \Mantle\Database\Factory\Factory<static, TObject, static> + */ + public static function factory( array|callable|null $state = null ): Factory { + $factory = static::new_factory() ?: Factory::factory_for_model( static::class ); + + return $factory + ->as_models() + ->with_model( static::class ) + ->when( + $factory instanceof Post_Factory, + fn ( Post_Factory $factory ) => $factory->with_post_type( static::get_object_name() ), // @phpstan-ignore-line expects + ) + ->when( + $factory instanceof Term_Factory, + fn ( Term_Factory $factory ) => $factory->with_taxonomy( static::get_object_name() ), // @phpstan-ignore-line expects + ) + ->when( is_array( $state ) || is_callable( $state ), fn ( Factory $factory ) => $factory->state( $state ) ); + } + + /** + * Create a new factory instance for the model. + * + * Optional: allows for the model factory to be overridden by application code. + * + * @return \Mantle\Database\Factory\Factory<static, TObject, static>|null + */ + protected static function new_factory(): ?Factory { + return null; + } +} diff --git a/vendor/mantle-framework/database/model/concerns/trait-has-global-scopes.php b/vendor/mantle-framework/database/model/concerns/trait-has-global-scopes.php new file mode 100644 index 00000000..f899a69a --- /dev/null +++ b/vendor/mantle-framework/database/model/concerns/trait-has-global-scopes.php @@ -0,0 +1,77 @@ +<?php +/** + * Has_Global_Scopes class file. + * + * @package Mantle + * + * @phpcs:disable WordPressVIPMinimum.Variables.VariableAnalysis.StaticOutsideClass + */ + +namespace Mantle\Database\Model\Concerns; + +use Closure; +use InvalidArgumentException; +use Mantle\Contracts\Database\Scope; +use Mantle\Support\Arr; + +/** + * Query Global Scope + */ +trait Has_Global_Scopes { + /** + * Register a new global scope on the model. + * + * @param Scope|\Closure|string $scope Scope instance/name. + * @param Closure|null $implementation Scope callback. + * @return mixed + * + * @throws InvalidArgumentException Thrown on invalid global scope. + */ + public static function add_global_scope( $scope, Closure $implementation = null ) { + if ( is_string( $scope ) && ! is_null( $implementation ) ) { + static::$global_scopes[ static::class ][ $scope ] = $implementation; + return true; + } elseif ( $scope instanceof Closure ) { + static::$global_scopes[ static::class ][ spl_object_hash( $scope ) ] = $scope; + return true; + } elseif ( $scope instanceof Scope ) { + static::$global_scopes[ static::class ][ $scope::class ] = $scope; + return true; + } + + throw new InvalidArgumentException( 'Global scope must be an instance of Closure or Scope.' ); + } + + /** + * Determine if a model has a global scope. + * + * @param Scope|string $scope Scope name. + */ + public static function has_global_scope( $scope ): bool { + return ! is_null( static::get_global_scope( $scope ) ); + } + + /** + * Get a global scope registered with the model. + * + * @param Scope|string $scope Scope name/instance. + * @return Scope|\Closure|null Scope object. + */ + public static function get_global_scope( $scope ) { + if ( is_string( $scope ) ) { + return Arr::get( static::$global_scopes, static::class . '.' . $scope ); + } + + return Arr::get( + static::$global_scopes, + static::class . '.' . $scope::class + ); + } + + /** + * Get the global scopes for this class instance. + */ + public function get_global_scopes(): array { + return Arr::get( static::$global_scopes, static::class, [] ); + } +} diff --git a/vendor/mantle-framework/database/model/concerns/trait-has-guarded-attributes.php b/vendor/mantle-framework/database/model/concerns/trait-has-guarded-attributes.php new file mode 100644 index 00000000..1e1bc7e9 --- /dev/null +++ b/vendor/mantle-framework/database/model/concerns/trait-has-guarded-attributes.php @@ -0,0 +1,112 @@ +<?php +/** + * Has_Guarded_Attributes class file. + * + * @package Mantle + */ + +// phpcs:disable Squiz.Commenting.FunctionComment.MissingParamComment +// phpcs:ignoreFile: WordPressVIPMinimum.Variables.VariableAnalysis.StaticInsideClosure + +namespace Mantle\Database\Model\Concerns; + +/** + * Guard Specific Attributes from being set. + */ +trait Has_Guarded_Attributes { + /** + * Attributes that are guarded. + * + * @var array + */ + protected $guarded_attributes = []; + + /** + * Flag if the model is being guarded. + * + * @var bool + */ + protected $guarded = true; + + /** + * Indicates if all mass assignment is enabled. + * + * @var bool + */ + protected static $unguarded = false; + + /** + * Check if the model is guarded. + */ + public function is_model_guarded(): bool { + return $this->guarded; + } + + /** + * Set if a model is or is not being guarded. + * + * @param bool $guarded Flag if the model is being guarded. + */ + public function set_model_guard( bool $guarded ): void { + $this->guarded = $guarded; + } + + /** + * Check if a model attribute is guarded. + * + * @param string $attribute Attribute to check. + */ + public function is_guarded( string $attribute ): bool { + if ( ! $this->guarded ) { + return false; + } + + return in_array( $attribute, $this->guarded_attributes, true ); + } + + /** + * Check if the model is currently guarded. + * + * @param bool $guarded Flag if the model is guarded. + */ + public function guard( bool $guarded ): void { + $this->guarded = $guarded; + } + + /** + * Run the given callable while being unguarded. + * + * @param callable $callback + * + * @return mixed + */ + public static function unguarded( callable $callback ) { + if ( static::$unguarded ) { + return $callback(); + } + + static::unguard(); + + try { + return $callback(); + } finally { + static::reguard(); + } + } + + /** + * Disable all mass assignable restrictions. + * + * @param bool $state + */ + public static function unguard( $state = true ): void { + static::$unguarded = $state; + } + + /** + * Enable the mass assignment restrictions. + */ + public static function reguard(): void { + static::$unguarded = false; + } +} diff --git a/vendor/mantle-framework/database/model/concerns/trait-has-relationships.php b/vendor/mantle-framework/database/model/concerns/trait-has-relationships.php new file mode 100644 index 00000000..9e3a312b --- /dev/null +++ b/vendor/mantle-framework/database/model/concerns/trait-has-relationships.php @@ -0,0 +1,158 @@ +<?php +/** + * Has_Relationships trait file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Concerns; + +use InvalidArgumentException; +use Mantle\Database\Model\Post; +use Mantle\Database\Model\Relations\Belongs_To; +use Mantle\Database\Model\Relations\Belongs_To_Many; +use Mantle\Database\Model\Relations\Has_Many; +use Mantle\Database\Model\Relations\Has_One; +use Mantle\Database\Model\Relations\Has_One_Or_Many; +use Mantle\Database\Model\Relations\Relation; +use Mantle\Database\Model\Term; + +/** + * Model Relationships + */ +trait Has_Relationships { + /** + * The loaded relationships for the model. + * + * @var array + */ + protected $relations = []; + + /** + * Define a Has One Relationship + * + * @param string $related Related model name. + * @param string $foreign_key Foreign key. + * @param string $local_key Local key. + */ + public function has_one( string $related, string $foreign_key = null, string $local_key = null ): Relation { + $instance = new $related(); + $foreign_key ??= $this->get_foreign_key(); + $local_key ??= $this->get_key_name(); + + return new Has_One( $instance->new_query(), $this, $foreign_key, $local_key ); + } + + /** + * Define a Has Many Relationship + * + * @param string $related Related model name. + * @param string $foreign_key Foreign key. + * @param string $local_key Local key. + */ + public function has_many( string $related, string $foreign_key = null, string $local_key = null ): Has_Many { + $instance = new $related(); + $foreign_key ??= $this->get_foreign_key(); + $local_key ??= $this->get_key_name(); + + return new Has_Many( $instance->new_query(), $this, $foreign_key, $local_key ); + } + + /** + * Define a belongs to relationship. + * + * Defines a relationship between two models with the reference stored on the remote + * model's meta. + * + * @param string $related Related model name. + * @param string $foreign_key Foreign key. + * @param string $local_key Local key. + * + * @throws InvalidArgumentException Used on the definition of a post and term relationship. + */ + public function belongs_to( string $related, string $foreign_key = null, string $local_key = null ): Belongs_To { + // Check if this a post and term relationship. + if ( + ( $this instanceof Term && is_subclass_of( $related, Post::class ) ) + || ( $this instanceof Post && is_subclass_of( $related, Term::class ) ) + ) { + throw new InvalidArgumentException( 'Post and term relationships must always use has_one() or has_many()' ); + } + + $instance = new $related(); + $foreign_key ??= $this->get_key_name(); + $local_key ??= $instance->get_foreign_key(); + + return new Belongs_To( $instance->new_query(), $this, $foreign_key, $local_key ); + } + + /** + * Define a belongs to relationship. + * + * Defines a relationship between two models with the reference stored on the remote + * object's meta. + * + * @param string $related Related model name. + * @param string $foreign_key Foreign key. + * @param string $local_key Local key. + * + * @throws InvalidArgumentException Used on the definition of a post and term relationship. + */ + public function belongs_to_many( string $related, string $foreign_key = null, string $local_key = null ): Belongs_To_Many { + // Check if this a post and term relationship. + if ( + ( $this instanceof Term && is_subclass_of( $related, Post::class ) ) + || ( $this instanceof Post && is_subclass_of( $related, Term::class ) ) + ) { + throw new InvalidArgumentException( 'Post and term relationships must always use has_one() or has_many()' ); + } + + $instance = new $related(); + $foreign_key ??= $this->get_key_name(); + $local_key ??= $instance->get_foreign_key(); + + return new Belongs_To_Many( $instance->new_query(), $this, $foreign_key, $local_key ); + } + + /** + * Get a relationship for the model. + * + * @param string $relation Relation name. + */ + public function get_relation( string $relation ): ?Relation { + return $this->relations[ $relation ] ?? null; + } + + /** + * Set a relationship for the model. + * + * @param string $relation Relation name. + * @param mixed $value Value to set. + * @return static + */ + public function set_relation( string $relation, $value ) { + $this->relations[ $relation ] = $value; + + return $this; + } + + /** + * Check if the given relation is loaded. + * + * @param string $relation Relation to check. + */ + public function relation_loaded( string $relation ): bool { + return array_key_exists( $relation, $this->relations ); + } + + /** + * Unset a relationship for the model. + * + * @param string $relation Relation name. + * @return static + */ + public function unset_relation( string $relation ) { + unset( $this->relations[ $relation ] ); + return $this; + } +} diff --git a/vendor/mantle-framework/database/model/concerns/trait-hides-attributes.php b/vendor/mantle-framework/database/model/concerns/trait-hides-attributes.php new file mode 100644 index 00000000..64e684b1 --- /dev/null +++ b/vendor/mantle-framework/database/model/concerns/trait-hides-attributes.php @@ -0,0 +1,125 @@ +<?php +/** + * Hides_Attributes trait file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Concerns; + +use Closure; +use function Mantle\Support\Helpers\value; + +/** + * Concern to hide attributes from serialization. + */ +trait Hides_Attributes { + + /** + * The attributes that should be hidden for serialization. + * + * @var string[] + */ + protected $hidden = []; + + /** + * The attributes that should be visible in serialization. + * + * @var string[] + */ + protected $visible = []; + + /** + * Get the hidden attributes for the model. + * + * @return string[] + */ + public function get_hidden(): array { + return $this->hidden; + } + + /** + * Set the hidden attributes for the model. + * + * @param string|string[] ...$hidden Hidden attributes. + * @return static + */ + public function set_hidden( ...$hidden ) { + $this->hidden = $hidden; + + return $this; + } + + /** + * Get the visible attributes for the model. + */ + public function get_visible(): array { + return $this->visible; + } + + /** + * Set the visible attributes for the model. + * + * @param string|string[] ...$visible Visible attributes. + * @return static + */ + public function set_visible( ...$visible ) { + $this->visible = $visible; + + return $this; + } + + /** + * Make the given, typically hidden, attributes visible. + * + * @param array|string ...$attributes Attributes to make visible. + * @return $this + */ + public function make_visible( ...$attributes ) { + $this->hidden = array_diff( $this->hidden, $attributes ); + + if ( ! empty( $this->visible ) ) { + $this->visible = array_merge( $this->visible, $attributes ); + } + + return $this; + } + + /** + * Make the given, typically hidden, attributes visible if the given truth test passes. + * + * @param bool|Closure $condition Condition to check. + * @param string[]|string|null ...$attributes Attributes to make visible. + * @return static + */ + public function make_visible_if( $condition, ...$attributes ) { + $condition = $condition instanceof Closure ? $condition( $this ) : $condition; + + return $condition ? $this->make_visible( ...$attributes ) : $this; + } + + /** + * Make the given, typically visible, attributes hidden. + * + * @param array|string|null ...$attributes Attributes to make hidden. + * @return static + */ + public function make_hidden( ...$attributes ) { + $this->hidden = array_merge( $this->hidden, $attributes ); + + return $this; + } + + /** + * Make the given, typically visible, attributes hidden if the given truth test passes. + * + * @param bool|Closure $condition Condition to check. + * @param string[]|string|null ...$attributes Attributes to make hidden. + * @return static + */ + public function make_hidden_if( $condition, ...$attributes ) { + $condition = $condition instanceof Closure ? $condition( $this ) : $condition; + + return value( $condition ) ? $this->make_hidden( $attributes ) : $this; + } +} diff --git a/vendor/mantle-framework/database/model/dates/class-model-date-proxy.php b/vendor/mantle-framework/database/model/dates/class-model-date-proxy.php new file mode 100644 index 00000000..d937ae4e --- /dev/null +++ b/vendor/mantle-framework/database/model/dates/class-model-date-proxy.php @@ -0,0 +1,137 @@ +<?php +/** + * Model_Date_Proxy class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Dates; + +use ArrayAccess; +use Carbon\Carbon; +use DateTimeInterface; +use DateTimeZone; +use InvalidArgumentException; +use Mantle\Database\Model\Post; +use Mantle\Support\Str; + +/** + * Allow post dates to be retrieved as an attribute on the object as Carbon instances. + * + * @property Carbon $created + * @property Carbon $created_gmt + * @property Carbon $created_utc + * @property Carbon $modified + * @property Carbon $modified_gmt + * @property Carbon $modified_utc + */ +class Model_Date_Proxy implements ArrayAccess { + /** + * Constructor. + * + * @param Post $model Model to reference. + */ + public function __construct( protected Post $model ) {} + + /** + * Retrieve model date by key. + * + * @throws InvalidArgumentException If the key is invalid. + * + * @param string $key Date key. + */ + public function __get( string $key ): Carbon { + return match ( $key ) { + 'date', 'created', 'created_at' => Carbon::parse( $this->model->post_date, wp_timezone() ), + 'date_gmt', 'created_gmt', 'created_utc', 'created_at_gmt', 'created_at_utc' => Carbon::parse( $this->model->post_date_gmt, new DateTimeZone( 'UTC' ) ), + 'modified', 'modified_at', 'updated', 'updated_at' => Carbon::parse( $this->model->post_modified, wp_timezone() ), + 'modified_gmt', 'modified_utc', 'modified_at_gmt', 'modified_at_utc' => Carbon::parse( $this->model->post_modified_gmt, new DateTimeZone( 'UTC' ) ), + default => throw new InvalidArgumentException( "Invalid date attribute: {$key}" ), + }; + } + + /** + * Set model date attribute. + * + * @throws InvalidArgumentException If the key is invalid. + * + * @param string $key Date attribute. + * @param mixed $value Date value. + */ + public function __set( string $key, $value ): void { + $timezone = Str::ends_with( $key, [ '_gmt', '_utc' ] ) ? new DateTimeZone( 'UTC' ) : wp_timezone(); + + if ( is_string( $value ) ) { + $value = Carbon::parse( $value, $timezone ); + } elseif ( is_numeric( $value ) ) { + $value = Carbon::createFromTimestamp( $value, $timezone ); + } elseif ( $value instanceof Carbon ) { + $value->setTimezone( $timezone ); + } elseif ( $value instanceof DateTimeInterface ) { + $value = Carbon::instance( $value )->setTimezone( $timezone ); + } else { + throw new InvalidArgumentException( "Invalid date value for {$key}" ); + } + + match ( $key ) { + 'date', 'created', 'created_at' => $this->model->set_attribute( 'post_date', $value->format( 'Y-m-d H:i:s' ) ), + 'date_gmt', 'created_gmt', 'created_utc', 'created_at_gmt', 'created_at_utc' => $this->model->set_attribute( 'post_date_gmt', $value->format( 'Y-m-d H:i:s' ) ), + 'modified', 'modified_at', 'updated', 'updated_at' => $this->model->set_attribute( 'post_modified', $value->format( 'Y-m-d H:i:s' ) ), + 'modified_gmt', 'modified_utc', 'modified_at_gmt', 'modified_at_utc' => $this->model->set_attribute( 'post_modified_gmt', $value->format( 'Y-m-d H:i:s' ) ), + default => throw new InvalidArgumentException( "Invalid date attribute: {$key}" ), + }; + } + + /** + * Delete model date attribute. + * + * @throws InvalidArgumentException Upon use. + * + * @param string $key Date attribute. + */ + public function __unset( string $key ) { + throw new InvalidArgumentException( 'Cannot unset model date attributes.' ); + } + + /** + * Check if a date exists. + * + * @param mixed $offset Date attribute. + */ + public function offsetExists( mixed $offset ): bool { + try { + $this->__get( $offset ); + return true; + } catch ( InvalidArgumentException ) { + return false; + } + } + + /** + * Retrieve the value of a model date attribute by key. + * + * @param mixed $offset Date attribute. + */ + public function offsetGet( mixed $offset ): mixed { + return $this->__get( $offset ); + } + + /** + * Set the value of a model date attribute by key. + * + * @param mixed $offset Date attribute. + * @param mixed $value Value to set. + */ + public function offsetSet( mixed $offset, mixed $value ): void { + $this->__set( $offset, $value ); + } + + /** + * Delete a model date attribute + * + * @param mixed $offset Date attribute. + */ + public function offsetUnset( mixed $offset ): void { + $this->__unset( $offset ); + } +} diff --git a/vendor/mantle-framework/database/model/dates/trait-has-dates.php b/vendor/mantle-framework/database/model/dates/trait-has-dates.php new file mode 100644 index 00000000..0205e019 --- /dev/null +++ b/vendor/mantle-framework/database/model/dates/trait-has-dates.php @@ -0,0 +1,24 @@ +<?php +/** + * Has_Dates trait file + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Dates; + +/** + * This trait includes functionality for managing date fields on a model. + * + * @mixin \Mantle\Database\Model\Post + * + * @property \Mantle\Database\Model\Dates\Model_Date_Proxy $dates + */ +trait Has_Dates { + /** + * Retrieve the model's dates. + */ + public function get_dates_attribute(): Model_Date_Proxy { + return new Model_Date_Proxy( $this ); + } +} diff --git a/vendor/mantle-framework/database/model/events/class-permalink-generated.php b/vendor/mantle-framework/database/model/events/class-permalink-generated.php new file mode 100644 index 00000000..b1d2384a --- /dev/null +++ b/vendor/mantle-framework/database/model/events/class-permalink-generated.php @@ -0,0 +1,34 @@ +<?php +/** + * Permalink_Generating class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Events; + +use Mantle\Database\Model\Permalink_Generator; + +/** + * Permalink Generated Event + * + * Fired before the permalink is generated to allow for custom attributes to be + * registered. + */ +class Permalink_Generated { + /** + * Permalink generator. + * + * @var Permalink_Generator + */ + public $generator; + + /** + * Constructor. + * + * @param Permalink_Generator $generator + */ + public function __construct( Permalink_Generator $generator ) { + $this->generator = $generator; + } +} diff --git a/vendor/mantle-framework/database/model/events/trait-post-events.php b/vendor/mantle-framework/database/model/events/trait-post-events.php new file mode 100644 index 00000000..190304a1 --- /dev/null +++ b/vendor/mantle-framework/database/model/events/trait-post-events.php @@ -0,0 +1,97 @@ +<?php +/** + * Post_Events trait file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Events; + +use Closure; +use function Alley\WP\add_filter_side_effect; + +/** + * Post Event Subscribers + */ +trait Post_Events { + /** + * Boot the trait. + */ + public static function boot_post_events(): void { + static::subscribe_to_core_events(); + } + + /** + * Subscribe to the core WordPress events for the model. + */ + protected static function subscribe_to_core_events() { + $post_type = static::get_object_name(); + + add_filter_side_effect( + 'wp_insert_post_data', + function( $data, $postarr ) use ( $post_type ): void { + // Skip if the ID isn't found or the post type is incorrect. + if ( empty( $postarr['ID'] ) || empty( $data['post_type'] ) || $post_type !== $data['post_type'] ) { + return; + } + + $updating = ! empty( $postarr['ID'] ); + $model = static::find( $postarr['ID'] ); + + if ( ! $model ) { + return; + } + + $model->fire_model_event( $updating ? 'updating' : 'creating' ); + }, + 10, + 2 + ); + + \add_action( + 'save_post', + function( $post_id, \WP_Post $post, $update ) use ( $post_type ): void { + if ( $post_type !== $post->post_type ) { + return; + } + + $model = static::find( $post_id ); + if ( ! $model ) { + return; + } + + if ( 'trash' === $post->post_status ) { + $model->fire_model_event( 'trashed' ); + } else { + $model->fire_model_event( $update ? 'updated' : 'created' ); + } + }, + 10, + 3 + ); + + \add_action( 'wp_trash_post', static::get_post_event_callback( 'trashing', $post_type ) ); + \add_action( 'before_delete_post', static::get_post_event_callback( 'deleting', $post_type ) ); + \add_action( 'deleted_post', static::get_post_event_callback( 'deleted', $post_type ) ); + } + + /** + * Generate a callback for a WordPress action. + * + * @param string $event Event name to fire. + * @param string $post_type Post type to limit to. + */ + protected static function get_post_event_callback( string $event, string $post_type ): Closure { + return function( $post_id ) use ( $event, $post_type ): void { + $post = \get_post( $post_id ); + if ( empty( $post ) || $post_type !== $post->post_type ) { + return; + } + + $model = static::find( $post_id ); + if ( $model ) { + $model->fire_model_event( $event ); + } + }; + } +} diff --git a/vendor/mantle-framework/database/model/events/trait-term-events.php b/vendor/mantle-framework/database/model/events/trait-term-events.php new file mode 100644 index 00000000..484daf3c --- /dev/null +++ b/vendor/mantle-framework/database/model/events/trait-term-events.php @@ -0,0 +1,65 @@ +<?php +/** + * Term_Events trait file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Events; + +use Closure; + +/** + * Term Event Subscribers + */ +trait Term_Events { + /** + * Boot the trait. + */ + public static function boot_term_events(): void { + static::subscribe_to_core_events(); + } + + /** + * Subscribe to the core WordPress events for the model. + */ + protected static function subscribe_to_core_events() { + $object_name = static::get_object_name(); + + add_action( 'created_term', static::get_term_event_callback( 'created', $object_name ), 10, 3 ); + add_action( 'edit_terms', static::get_term_event_callback( 'updating', $object_name ), 10, 3 ); + add_action( 'edited_term', static::get_term_event_callback( 'updated', $object_name ), 10, 3 ); + add_action( 'pre_delete_term', static::get_term_event_callback( 'deleting', $object_name ), 10, 2 ); + add_action( 'delete_term', static::get_term_event_callback( 'deleted', $object_name ), 10, 4 ); + } + + /** + * Generate a callback for a WordPress action. + * + * @param string $event Event name to fire. + * @param string $taxonomy Taxonomy to limit to. + */ + protected static function get_term_event_callback( string $event, string $taxonomy ): Closure { + return function( $term_id, $tt_id, $term_taxonomy = null, $term = null ) use ( $event, $taxonomy ): void { + // Account for actions that have taxonomy as the second argument. + if ( ( empty( $term_taxonomy ) || ! is_string( $term_taxonomy ) ) && is_string( $tt_id ) ) { + $term_taxonomy = $tt_id; + } + + if ( $taxonomy !== $term_taxonomy ) { + return; + } + + // Use the term object passed from the action for 'deleting'. + if ( 'deleted' === $event && $term ) { + $model = static::new_from_existing( (array) $term ); + } else { + $model = static::find( $term_id ); + } + + if ( $model ) { + $model->fire_model_event( $event ); + } + }; + } +} diff --git a/vendor/mantle-framework/database/model/meta/class-model-meta-proxy.php b/vendor/mantle-framework/database/model/meta/class-model-meta-proxy.php new file mode 100644 index 00000000..1a1a62fd --- /dev/null +++ b/vendor/mantle-framework/database/model/meta/class-model-meta-proxy.php @@ -0,0 +1,94 @@ +<?php +/** + * Model_Meta_Proxy class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Meta; + +use ArrayAccess; +use Mantle\Contracts\Database\Model_Meta; + +/** + * Allow meta to be retrieved as an attribute on the object. + */ +class Model_Meta_Proxy implements ArrayAccess { + /** + * Constructor. + * + * @param Model_Meta $model Model to reference. + */ + public function __construct( protected Model_Meta $model ) {} + + /** + * Retrieve model meta by key. + * + * @param string $key Meta key. + * @return mixed + */ + public function __get( string $key ) { + $queued_value = $this->model->get_queued_meta_attribute( $key ); + if ( null !== $queued_value ) { + return $queued_value; + } + + return $this->model->get_meta( $key ); + } + + /** + * Set model meta. + * + * @param string $key Meta key. + * @param mixed $value Meta value. + */ + public function __set( string $key, $value ) { + $this->model->queue_meta_attribute( $key, $value ); + } + + /** + * Delete model meta. + * + * @param string $key Meta key. + */ + public function __unset( string $key ) { + $this->model->delete_meta( $key ); + } + + /** + * Check if model meta exists. + * + * @param mixed $offset Meta key. + */ + public function offsetExists( mixed $offset ): bool { + return null !== $this->model->get_meta( $offset ); + } + + /** + * Retrieve the value of a model meta by key. + * + * @param mixed $offset Meta key. + */ + public function offsetGet( mixed $offset ): mixed { + return $this->__get( $offset ); + } + + /** + * Set the value of a model meta. + * + * @param mixed $offset Meta key. + * @param mixed $value Meta value. + */ + public function offsetSet( mixed $offset, mixed $value ): void { + $this->__set( $offset, $value ); + } + + /** + * Delete a model meta. + * + * @param mixed $offset Meta key. + */ + public function offsetUnset( mixed $offset ): void { + $this->__unset( $offset ); + } +} diff --git a/vendor/mantle-framework/database/model/meta/trait-comment-meta.php b/vendor/mantle-framework/database/model/meta/trait-comment-meta.php new file mode 100644 index 00000000..97a8e68b --- /dev/null +++ b/vendor/mantle-framework/database/model/meta/trait-comment-meta.php @@ -0,0 +1,20 @@ +<?php +/** + * Comment_Meta class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Meta; + +/** + * Comment Model Meta + */ +trait Comment_Meta { + /** + * Get the meta type for the object. + */ + public function get_meta_type(): string { + return 'comment'; + } +} diff --git a/vendor/mantle-framework/database/model/meta/trait-model-meta.php b/vendor/mantle-framework/database/model/meta/trait-model-meta.php new file mode 100644 index 00000000..aa0d4495 --- /dev/null +++ b/vendor/mantle-framework/database/model/meta/trait-model-meta.php @@ -0,0 +1,156 @@ +<?php +/** + * Model_Meta class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Meta; + +use BackedEnum; +use Mantle\Database\Model\Model_Exception; + +/** + * Interface for interfacing with a model's meta. + * + * @property object $meta + * @property array<string, mixed> $queued_meta + */ +trait Model_Meta { + /** + * Meta queued for saving. + * + * @var array + */ + protected $queued_meta = []; + + /** + * Retrieve meta data for the object. + * + * @param string $meta_key Meta key to retrieve. + * @param bool $single Return the first meta key, defaults to true. + */ + public function get_meta( string $meta_key, bool $single = true ): mixed { + return \get_metadata( $this->get_meta_type(), $this->id(), $meta_key, $single ); + } + + /** + * Add meta value for the object. + * + * @param string $meta_key Meta key. + * @param mixed $meta_value Meta value to store. + * @param string $prev_value Optional, previous meta value. + */ + public function add_meta( string $meta_key, mixed $meta_value, mixed $prev_value = '' ): void { + if ( ! $this->id() ) { + $this->queue_meta_attribute( $meta_key, $meta_value, false ); + return; + } + + \add_metadata( $this->get_meta_type(), $this->id(), $meta_key, $this->serialize_value_for_storage( $meta_value ) ); + } + + /** + * Update meta value for the object. + * + * @param string $meta_key Meta key. + * @param mixed $meta_value Meta value to store. + * @param string $prev_value Optional, previous meta value. + */ + public function set_meta( string $meta_key, mixed $meta_value, mixed $prev_value = '' ): void { + if ( ! $this->id() ) { + $this->queue_meta_attribute( $meta_key, $meta_value ); + return; + } + + \update_metadata( $this->get_meta_type(), $this->id(), $meta_key, $this->serialize_value_for_storage( $meta_value ), $prev_value ); + } + + /** + * Delete a object's meta. + * + * @param string $meta_key Meta key to delete by. + * @param mixed $meta_value Previous meta value to delete. + */ + public function delete_meta( string $meta_key, mixed $meta_value = '' ): void { + \delete_metadata( $this->get_meta_type(), $this->id(), $meta_key, $this->serialize_value_for_storage( $meta_value ) ); + } + + /** + * Retrieve the meta 'attribute'. + * + * @return Model_Meta_Proxy + */ + public function get_meta_attribute() { + return new Model_Meta_Proxy( $this ); + } + + /** + * Allow setting meta through an array via an attribute mutator. + * + * @param array $meta_values Meta values to set. + * @throws Model_Exception Thrown on invalid value being set. + */ + public function set_meta_attribute( $meta_values ): void { + if ( ! is_array( $meta_values ) ) { + throw new Model_Exception( 'Attribute value passed to meta is not an array.' ); + } + + foreach ( $meta_values as $key => $value ) { + $this->queued_meta[ $key ] = $value; + $this->set_meta( $key, $value ); + } + } + + /** + * Get a queued meta attribute. + * + * @param string $key Meta key. + * @return mixed|null Meta value or null. + */ + public function get_queued_meta_attribute( string $key ): mixed { + return ( $this->queued_meta[ $key ] ?? [] )[0] ?? null; + } + + /** + * Queue a meta attribute for saving. + * Allows meta to be set before a model is saved. + * + * Should not be called directly, only to be used via `$model->meta->...`. + * + * @param string $key Meta key. + * @param mixed $value Meta value. + * @param bool $update Flag to update the queued meta. + */ + public function queue_meta_attribute( string $key, $value, bool $update = true ): void { + $this->queued_meta[ $key ] = [ $value, $update ]; + } + + /** + * Store queued model meta. + */ + public function store_queued_meta(): void { + foreach ( $this->queued_meta as $key => [ $value, $update ] ) { + if ( $update ) { + $this->set_meta( $key, $value ); + } else { + $this->add_meta( $key, $value ); + } + } + + $this->queued_meta = []; + } + + /** + * Serialize meta value for storage, converting all backed enums to their value. + * + * @param mixed $value Value to serialize. + */ + protected function serialize_value_for_storage( mixed $value ): mixed { + if ( $value instanceof BackedEnum ) { + return $value->value; + } + + return $value; + } +} diff --git a/vendor/mantle-framework/database/model/meta/trait-post-meta.php b/vendor/mantle-framework/database/model/meta/trait-post-meta.php new file mode 100644 index 00000000..3ae420da --- /dev/null +++ b/vendor/mantle-framework/database/model/meta/trait-post-meta.php @@ -0,0 +1,20 @@ +<?php +/** + * Post_Meta class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Meta; + +/** + * Post Model Meta + */ +trait Post_Meta { + /** + * Get the meta type for the object. + */ + public function get_meta_type(): string { + return 'post'; + } +} diff --git a/vendor/mantle-framework/database/model/meta/trait-term-meta.php b/vendor/mantle-framework/database/model/meta/trait-term-meta.php new file mode 100644 index 00000000..ee0d984b --- /dev/null +++ b/vendor/mantle-framework/database/model/meta/trait-term-meta.php @@ -0,0 +1,20 @@ +<?php +/** + * Term_Meta class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Meta; + +/** + * Term Model Meta + */ +trait Term_Meta { + /** + * Get the meta type for the object. + */ + public function get_meta_type(): string { + return 'term'; + } +} diff --git a/vendor/mantle-framework/database/model/meta/trait-user-meta.php b/vendor/mantle-framework/database/model/meta/trait-user-meta.php new file mode 100644 index 00000000..97553f1a --- /dev/null +++ b/vendor/mantle-framework/database/model/meta/trait-user-meta.php @@ -0,0 +1,20 @@ +<?php +/** + * User_Meta class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Meta; + +/** + * User Model Meta + */ +trait User_Meta { + /** + * Get the meta type for the object. + */ + public function get_meta_type(): string { + return 'user'; + } +} diff --git a/vendor/mantle-framework/database/model/registration/trait-register-meta.php b/vendor/mantle-framework/database/model/registration/trait-register-meta.php new file mode 100644 index 00000000..82a8e2ca --- /dev/null +++ b/vendor/mantle-framework/database/model/registration/trait-register-meta.php @@ -0,0 +1,102 @@ +<?php +/** + * Register_Meta trait file. + * + * @package Mantle + * + * @phpcs:disable WordPressVIPMinimum.Variables.VariableAnalysis.StaticOutsideClass + */ + +namespace Mantle\Database\Model\Registration; + +use Mantle\Database\Model; + +use function Mantle\Support\Helpers\event; + +/** + * Model Trait to register meta for a model. + */ +trait Register_Meta { + /** + * Register the object's meta. + */ + public static function boot_register_meta(): void { + \add_action( 'init', [ self::class, 'register_meta' ], 11 ); + } + + /** + * Register a meta field for the model. + * + * @see register_meta() + * + * @param string $meta_key Meta key to register. + * @param array $args { + * Data used to describe the meta key when registered. + * + * @type string $object_subtype A subtype; e.g. if the object type is "post", the post type. If left empty, + * the meta key will be registered on the entire object type. Default empty. + * @type string $type The type of data associated with this meta key. + * Valid values are 'string', 'boolean', 'integer', 'number', 'array', and 'object'. + * @type string $description A description of the data attached to this meta key. + * @type bool $single Whether the meta key has one value per object, or an array of values per object. + * @type mixed $default The default value returned from get_metadata() if no value has been set yet. + * When using a non-single meta key, the default value is for the first entry. + * In other words, when calling get_metadata() with `$single` set to `false`, + * the default value given here will be wrapped in an array. + * @type callable $sanitize_callback A function or method to call when sanitizing `$meta_key` data. + * @type callable $auth_callback Optional. A function or method to call when performing edit_post_meta, + * add_post_meta, and delete_post_meta capability checks. + * @type bool|array $show_in_rest Whether data associated with this meta key can be considered public and + * should be accessible via the REST API. A custom post type must also declare + * support for custom fields for registered meta to be accessible via REST. + * When registering complex meta values this argument may optionally be an + * array with 'schema' or 'prepare_callback' keys instead of a boolean. + * } + * @return bool True if the meta key was successfully registered in the global array, false if not. + * Registering a meta key with distinct sanitize and auth callbacks will fire those callbacks, + * but will not add to the global registry. + */ + public static function register_meta( string $meta_key, array $args = [] ): bool { + $args = array_merge( + event( + 'mantle_register_meta_default_args', + [ + [ + 'object_subtype' => static::get_object_name(), + 'show_in_rest' => true, + 'single' => true, + 'type' => 'string', + ], + ], + ), + $args, + ); + + return register_meta( static::get_object_type(), $meta_key, $args ); + } + + /** + * Retrieve the object type for the model. + */ + public static function get_object_type(): ?string { + $parent = get_parent_class( static::class ); + + if ( Model\Post::class === $parent ) { + return 'post'; + } + + if ( Model\Term::class === $parent ) { + return 'term'; + } + + if ( Model\User::class === $parent ) { + return 'user'; + } + + if ( Model\Comment::class === $parent ) { + return 'comment'; + } + + return null; + } +} diff --git a/vendor/mantle-framework/database/model/registration/trait-register-post-type.php b/vendor/mantle-framework/database/model/registration/trait-register-post-type.php new file mode 100644 index 00000000..28961345 --- /dev/null +++ b/vendor/mantle-framework/database/model/registration/trait-register-post-type.php @@ -0,0 +1,44 @@ +<?php +/** + * Register_Post_Type trait file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Registration; + +use Mantle\Database\Model\Concerns\Custom_Post_Permalink; +use Mantle\Database\Model\Model_Exception; + +/** + * Model Trait to allow a post type to be registered for a model. + */ +trait Register_Post_Type { + use Custom_Post_Permalink; + + /** + * Register the post type. + */ + public static function boot_register_post_type(): void { + \add_action( 'init', [ self::class, 'register_object' ] ); + } + + /** + * Register the post type for the model. + * + * @throws Model_Exception Thrown when registering a post type that is already registered. + */ + public static function register_object(): void { + $post_type = static::get_object_name(); + + if ( \post_type_exists( $post_type ) ) { + throw new Model_Exception( 'Unable to register post type (post type already exists): ' . $post_type ); + } + + $register = \register_post_type( $post_type, static::get_registration_args() ); + + if ( is_wp_error( $register ) ) { + throw new Model_Exception( 'Error registering post type: ' . $register->get_error_message() ); + } + } +} diff --git a/vendor/mantle-framework/database/model/registration/trait-register-rest-fields.php b/vendor/mantle-framework/database/model/registration/trait-register-rest-fields.php new file mode 100644 index 00000000..5637e5b2 --- /dev/null +++ b/vendor/mantle-framework/database/model/registration/trait-register-rest-fields.php @@ -0,0 +1,90 @@ +<?php +/** + * Register_Post_Type trait file. + * + * @package Mantle + * + * @phpcs:disable WordPressVIPMinimum.Variables.VariableAnalysis.StaticOutsideClass + */ + +namespace Mantle\Database\Model\Registration; + +use Closure; +use Mantle\Database\Model\Model_Exception; +use Mantle\REST_API\REST_Field; +use Mantle\REST_API\REST_Field_Registrar; + +/** + * Model Trait to REST Fields to be registered for a model. + */ +trait Register_Rest_Fields { + /** + * REST Field Registrar + * + * @var REST_Field_Registrar + */ + protected static $rest_registrar; + + /** + * REST API Fields for the model. + * + * @var array + */ + protected static $rest_fields = []; + + /** + * Register the post type. + */ + public static function boot_register_rest_fields(): void { + static::$rest_registrar = new REST_Field_Registrar(); + + \add_action( 'rest_api_init', [ self::class, 'register_fields' ] ); + } + + /** + * Register the fields for the model. + * + * @throws Model_Exception Thrown when registering a post type that is already registered. + */ + public static function register_fields(): void { + if ( ! isset( static::$rest_registrar ) ) { + $class = static::class; + throw new Model_Exception( "REST field registrar is not defined for [{$class}]" ); + } + + array_map( [ static::$rest_registrar, 'register_once' ], static::$rest_fields ); + } + + /** + * Register a REST API field. + * + * @param REST_Field|string $attribute Field instance/field attribute to register. + * @param Closure|string $get_callback Callback for the field if $field isn't a field. + * @return Rest_Field + * + * @throws Model_Exception Thrown on missing REST Registrar. + * + * @todo Allow for creation of a a REST Field from a SML REST Field. + */ + public static function register_field( $attribute, $get_callback = null ): Rest_Field { + if ( ! isset( static::$rest_registrar ) ) { + $class = static::class; + throw new Model_Exception( "REST field registrar is not defined for [{$class}]" ); + } + + // Bail early if the field is a valid REST Field. + if ( $attribute instanceof Rest_Field ) { + static::$rest_fields[] = $attribute; + return $attribute; + } + + if ( is_null( $get_callback ) ) { + throw new Model_Exception( "Missing callback for REST field [{$attribute}]" ); + } + + $field = new Rest_Field( [ static::get_object_name() ], $attribute, $get_callback ); + + static::$rest_fields[ $attribute ] = $field; + return $field; + } +} diff --git a/vendor/mantle-framework/database/model/registration/trait-register-taxonomy.php b/vendor/mantle-framework/database/model/registration/trait-register-taxonomy.php new file mode 100644 index 00000000..99241389 --- /dev/null +++ b/vendor/mantle-framework/database/model/registration/trait-register-taxonomy.php @@ -0,0 +1,80 @@ +<?php +/** + * Register_Taxonomy trait file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Registration; + +use Mantle\Contracts\Database\Registrable as Registrable_Contract; +use Mantle\Database\Model\Concerns\Custom_Term_Link; +use Mantle\Database\Model\Model_Exception; + +/** + * Model Trait to allow a taxonomy to be registered for a model. + * + * @mixin \Mantle\Database\Model\Term + */ +trait Register_Taxonomy { + use Custom_Term_Link; + + /** + * Register the taxonomy. + */ + public static function boot_register_taxonomy(): void { + \add_action( 'init', [ self::class, 'register_object' ] ); + } + + /** + * Register the taxonomy for the model. + * + * @throws Model_Exception Thrown when registering a taxonomy that is already registered. + */ + public static function register_object(): void { + $taxonomy = static::get_object_name(); + + if ( \taxonomy_exists( $taxonomy ) ) { + throw new Model_Exception( 'Unable to register taxonomy (taxonomy already exists): ' . $taxonomy ); + } + + \register_taxonomy( $taxonomy, static::get_taxonomy_object_types(), static::get_registration_args() ); + } + + /** + * Get the object types for the model. + * Supports WordPress object names or the Mantle Model class name. + * + * @return string[] + * @throws Model_Exception Thrown on invalid class name being passed to object types. + */ + protected static function get_taxonomy_object_types(): array { + if ( empty( static::$object_types ) || ! is_array( static::$object_types ) ) { + return []; + } + + foreach ( static::$object_types as $key => $object_type ) { + // Detect a class name being used. + if ( false !== strpos( (string) $object_type, '\\' ) && class_exists( $object_type ) ) { + // Ensure the class name uses the Registrable Contract. + if ( ! in_array( Registrable_Contract::class, class_implements( $object_type ), true ) ) { + throw new Model_Exception( 'Unknown object type class provided: ' . $object_type ); + } + + // Convert the object type to the object's registration name. + static::$object_types[ $key ] = $object_type::get_registration_name(); + } + } + + return static::$object_types; + } + + /** + * Add taxonomy to object type. + * + * @param string $object_type Object type to add. + */ + public function add_to_object_type( string $object_type ): void { + \register_taxonomy_for_object_type( static::get_registration_name(), $object_type ); + } +} diff --git a/vendor/mantle-framework/database/model/relations/class-belongs-to-many.php b/vendor/mantle-framework/database/model/relations/class-belongs-to-many.php new file mode 100644 index 00000000..469dc1b5 --- /dev/null +++ b/vendor/mantle-framework/database/model/relations/class-belongs-to-many.php @@ -0,0 +1,68 @@ +<?php +/** + * Belongs_To_Many class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Relations; + +use Mantle\Support\Collection; + +use function Mantle\Support\Helpers\collect; + +/** + * Creates a 'Belongs To Many' relationship. + */ +class Belongs_To_Many extends Belongs_To { + /** + * Retrieve the results of the query. + * + * @return Collection|null + */ + public function get_results() { + $this->add_constraints(); + + return $this->query->get(); + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param Collection $models Parent models. + * @param Collection $results Eagerly loaded results to match. + */ + public function match( Collection $models, Collection $results ): Collection { + $dictionary = $this->build_dictionary( $results, $models ); + + return $models->each( + function( $model ) use ( $dictionary ): void { + $key = $model->{$this->foreign_key}; + + $model->set_relation( $this->relationship, $dictionary[ $key ] ?? null ); + } + ); + } + + /** + * Build a model dictionary keyed by the relation's foreign key. + * + * @param Collection $results Collection of results. + * @param Collection $models Eagerly loaded results to match. + */ + protected function build_dictionary( Collection $results, Collection $models ): array { + $results = $results->key_by( $this->foreign_key ); + $dictionary = collect(); + + foreach ( $models as $model ) { + $dictionary[ $model->{$this->foreign_key} ] = $model->get_meta( $this->local_key, false ); + } + + return $dictionary + ->map( + fn ( $child_ids) => $results->only( $child_ids )->values()->all() + ) + ->filter() + ->all(); + } +} diff --git a/vendor/mantle-framework/database/model/relations/class-belongs-to.php b/vendor/mantle-framework/database/model/relations/class-belongs-to.php new file mode 100644 index 00000000..da1099f2 --- /dev/null +++ b/vendor/mantle-framework/database/model/relations/class-belongs-to.php @@ -0,0 +1,366 @@ +<?php +/** + * Belongs_To class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Relations; + +use Mantle\Contracts\Database\Core_Object; +use Mantle\Contracts\Database\Model_Meta; +use Mantle\Contracts\Database\Updatable; +use Mantle\Database\Model\Model; +use Mantle\Database\Model\Model_Exception; +use Mantle\Database\Query\Builder; +use Mantle\Support\Collection; +use Mantle\Support\Str; +use RuntimeException; +use Throwable; +use WP_Term; + +use function Mantle\Support\Helpers\collect; + +/** + * Creates a 'Belongs To' relationship. + * Performs a meta query on the parent model with data from the current model. + * + * Example: Search the parent post's meta query with the ID of the current model. + * + * For relationships between posts and term models, the Belongs To relationship + * is not supported for performance reasons. + */ +class Belongs_To extends Relation { + /** + * Local key. + * + * @var string + */ + protected $local_key; + + /** + * Foreign key. + * + * @var string + */ + protected $foreign_key; + + /** + * Create a new has one or many relationship instance. + * + * @param Builder $query Query builder object. + * @param Model $parent Parent model. + * @param string $foreign_key Foreign key. + * @param string $local_key Local key. + */ + public function __construct( Builder $query, Model $parent, string $foreign_key, ?string $local_key = null ) { + $this->foreign_key = $foreign_key; + $this->local_key = $local_key; + + parent::__construct( $query, $parent ); + } + + /** + * Add constraints to the query. + */ + public function add_constraints(): void { + if ( ! static::$constraints ) { + return; + } + + if ( $this->uses_terms ) { + $object_ids = $this->get_term_ids_for_relationship(); + + if ( empty( $object_ids ) ) { + // Prevent the query from going through. + // @todo Handle this better. + $this->query->where( 'id', PHP_INT_MAX ); + } else { + $this->query->whereIn( 'id', $object_ids ); + } + + return; + } elseif ( $this->parent instanceof Model_Meta ) { + $meta_value = $this->parent->get_meta( $this->local_key ); + + if ( empty( $meta_value ) ) { + /** + * Prevent the query from going through. + * + * @todo Handle missing meta value better. + */ + $this->query->where( 'id', PHP_INT_MAX ); + } else { + $this->query->where( $this->foreign_key, $meta_value ); + } + } + } + + /** + * Set the query constraints for an eager load of the relation. + * + * @param Collection $models Models to eager load for. + * + * @throws RuntimeException Thrown on eager loading term relationships. + */ + public function add_eager_constraints( Collection $models ): void { + if ( $this->uses_terms ) { + throw new RuntimeException( 'Eager loading relationships with terms is not supported yet.' ); + } else { + $append = $this->should_append(); + + $meta_values = $models + ->map( + fn ( $model) => $model->get_meta( $this->local_key, ! $append ) + ) + ->filter(); + + if ( $append ) { + $meta_values = $meta_values->collapse(); + } + + $this->query->whereIn( $this->foreign_key, $meta_values->unique()->all() ); + } + } + + /** + * Retrieve the results of the query. + * + * @return \Mantle\Database\Model\Model|null + */ + public function get_results() { + $this->add_constraints(); + + return $this->query->first(); + } + + /** + * Associate a model with a relationship. + * + * @param Model $model Model to save to. + * @return Model + * + * @throws Model_Exception Thrown on error setting term for relationship. + */ + public function associate( Model $model ) { + if ( ! $model->exists && $model instanceof Updatable ) { + $model->save(); + } + + if ( ! $model instanceof Core_Object ) { + throw new Model_Exception( 'Model must be an instance of Core_Object.' ); + } + + if ( ! $this->parent instanceof Core_Object ) { + throw new Model_Exception( 'Parent model must be an instance of Core_Object.' ); + } + + if ( ! $this->parent instanceof Model_Meta ) { + throw new Model_Exception( 'Parent model must be an instance of Model_Meta.' ); + } + + $append = Belongs_To_Many::class === static::class || is_subclass_of( $this, Belongs_To_Many::class ); + + if ( $this->uses_terms ) { + $set = wp_set_post_terms( $this->parent->id(), [ $this->get_term_for_relationship( $model ) ], static::RELATION_TAXONOMY, $append ); + + if ( is_wp_error( $set ) ) { + throw new Model_Exception( "Error associating term relationship for [{$this->parent->id()}]: [{$set->get_error_message()}]" ); + } elseif ( false === $set ) { + throw new Model_Exception( "Unknown error associating term relationship for [{$this->parent->id()}]" ); + } + } elseif ( $append ) { + $this->parent->add_meta( $this->local_key, $model->id() ); + } else { + $this->parent->set_meta( $this->local_key, $model->id() ); + } + + if ( $this->relationship ) { + $this->parent->unset_relation( $this->relationship ); + } + + return $model; + } + + /** + * Proxy to `Belongs_To::associate()`. + * + * @param Model $model Model to save to. + * @return Model + */ + public function save( Model $model ) { + return $this->associate( $model ); + } + + /** + * Remove the relationship from the model. + * + * @throws Model_Exception Thrown when parent is not an instance of Core_Object. + * @throws Model_Exception Thrown when parent is not an instance of Model_Meta. + * + * @return static + */ + public function dissociate() { + // todo: remove in PHP 8.1+. + if ( ! $this->parent instanceof Core_Object ) { + throw new Model_Exception( 'Parent model must be an instance of Core_Object.' ); + } + + if ( ! $this->parent instanceof Model_Meta ) { + throw new Model_Exception( 'Parent model must be an instance of Model_Meta.' ); + } + + if ( $this->uses_terms ) { + $term_ids = $this->get_term_ids_for_relationship( true ); + + if ( ! empty( $term_ids ) ) { + wp_remove_object_terms( $this->parent->id(), $term_ids, static::RELATION_TAXONOMY ); + } + } else { + $this->parent->delete_meta( $this->local_key ); + } + + if ( $this->relationship ) { + $this->parent->unset_relation( $this->relationship ); + } + + return $this; + } + + /** + * Add the query constraints for querying against the relationship. + * + * @param Builder $builder Query builder instance. + * @param string|null $compare_value Value to compare against, optional. + * @param string $compare Comparison operator (=, >, EXISTS, etc.). + * + * @throws Model_Exception Thrown on unsupported relationship method. + */ + public function get_relation_query( Builder $builder, ?string $compare_value = null, string $compare = 'EXISTS' ): Builder { + if ( $this->uses_terms ) { + throw new Model_Exception( 'Queries_Relationships does not support post <--> post relationships with terms.' ); + } + + if ( $compare_value ) { + return $builder->whereMeta( $this->local_key, $compare_value, $compare ); + } + + return $builder->whereMeta( $this->local_key, '', $compare ); + } + + /** + * Retrieve a internal term for a post-to-post relationship. + * + * @param Model|string $model Model instance/id. + * @throws Model_Exception Thrown on error creating internal term with a post to term or term to post relationship. + */ + protected function get_term_for_relationship( $model ): int { + $name = $this->get_term_slug_for_relationship( $model ); + $term = get_term_by( 'name', $name, static::RELATION_TAXONOMY ); + + if ( empty( $term ) ) { + $insert = wp_insert_term( $name, static::RELATION_TAXONOMY ); + + if ( is_wp_error( $insert ) ) { + throw new Model_Exception( "Error creating internal term for relationship: [{$insert->get_error_message()}]" ); + } + + return $insert['term_id']; + } + + return $term->term_id; + } + + /** + * Retrieve the term slug for a post-to-post relationship. + * + * @param Model|string $model Model instance/id. + */ + protected function get_term_slug_for_relationship( $model ): string { + $delimiter = Has_One_Or_Many::DELIMITER; + $model = $model instanceof Model ? $model->get( $this->foreign_key ) : $model; + + return "{$this->local_key}{$delimiter}{$model}"; + } + + /** + * Retrieve term IDs from the current parent for the relationship. + * + * @throws Model_Exception Thrown when parent is not an instance of Core_Object. + * + * @param bool $return_term_ids Flag to return the term ID of the relationship + * term, parent ID otherwise. + * @return int[]|string[] + */ + protected function get_term_ids_for_relationship( bool $return_term_ids = false ): array { + if ( ! $this->parent instanceof Core_Object ) { + throw new Model_Exception( 'Parent model must be an instance of Core_Object.' ); + } + + $object_terms = get_the_terms( $this->parent->id(), static::RELATION_TAXONOMY ); + + if ( empty( $object_terms ) || is_wp_error( $object_terms ) ) { + return []; + } + + return collect( $object_terms ) + ->filter( + function( WP_Term $term ): bool { + $key = Str::before_last( $term->slug, Has_One_Or_Many::DELIMITER ); + $id = Str::after_last( $term->slug, Has_One_Or_Many::DELIMITER ); + + return $key === $this->local_key && ! empty( $id ); + } + ) + ->map( + function( WP_Term $term ) use ( $return_term_ids ) { + if ( $return_term_ids ) { + return $term->term_id; + } + + return (int) Str::after_last( $term->slug, Has_One_Or_Many::DELIMITER ); + } + ) + ->values() + ->to_array(); + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param Collection $models Parent models. + * @param Collection $results Eagerly loaded results to match. + */ + public function match( Collection $models, Collection $results ): Collection { + $dictionary = $this->build_dictionary( $results, $models ); + + return $models->each( + function( $model ) use ( $dictionary ): void { + $key = $model->meta->{$this->local_key}; + + $model->set_relation( $this->relationship, $dictionary[ $key ][0] ?? null ); + } + ); + } + + /** + * Build a model dictionary keyed by the relation's foreign key. + * + * @param Collection $results Collection of results. + * @param Collection $models Eagerly loaded results to match. + */ + protected function build_dictionary( Collection $results, Collection $models ): array { + return $results + ->map_to_dictionary( + fn ( $result) => [ (string) $result[ $this->foreign_key ] => $result ] + ) + ->all(); + } + + /** + * Flag if the meta should appended. + */ + protected function should_append(): bool { + return Belongs_To_Many::class === static::class || is_subclass_of( $this, Belongs_To_Many::class ); + } +} diff --git a/vendor/mantle-framework/database/model/relations/class-has-many.php b/vendor/mantle-framework/database/model/relations/class-has-many.php new file mode 100644 index 00000000..c58ffd86 --- /dev/null +++ b/vendor/mantle-framework/database/model/relations/class-has-many.php @@ -0,0 +1,43 @@ +<?php +/** + * Has_Many class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Relations; + +use Mantle\Support\Collection; + +/** + * Has Many Relationship + */ +class Has_Many extends Has_One_Or_Many { + /** + * Get the results of the relationship. + * + * @return \Mantle\Support\Collection + */ + public function get_results() { + $this->add_constraints(); + + return $this->query->get(); + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param Collection $models Parent models. + * @param Collection $results Eagerly loaded results to match. + */ + public function match( Collection $models, Collection $results ): Collection { + $dictionary = $this->build_dictionary( $results, $models ); + + return $models->each( + function( $model ) use ( $dictionary ): void { + $key = $model[ $this->local_key ]; + $model->set_relation( $this->relationship, $dictionary[ $key ] ?? null ); + } + ); + } +} diff --git a/vendor/mantle-framework/database/model/relations/class-has-one-or-many.php b/vendor/mantle-framework/database/model/relations/class-has-one-or-many.php new file mode 100644 index 00000000..04cf3893 --- /dev/null +++ b/vendor/mantle-framework/database/model/relations/class-has-one-or-many.php @@ -0,0 +1,349 @@ +<?php +/** + * Has_One_Or_Many class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Relations; + +use Mantle\Contracts\Database\Core_Object; +use Mantle\Contracts\Database\Model_Meta; +use Mantle\Contracts\Database\Updatable; +use Mantle\Database\Model\Model; +use Mantle\Database\Model\Model_Exception; +use Mantle\Database\Model\Post; +use Mantle\Database\Model\Term; +use Mantle\Database\Query\Builder; +use Mantle\Database\Query\Post_Query_Builder; +use Mantle\Support\Arr; +use Mantle\Support\Collection; +use RuntimeException; +use Throwable; + +use function Mantle\Support\Helpers\collect; + +/** + * Has One or Many Relationship + */ +abstract class Has_One_Or_Many extends Relation { + /** + * Delimiter for the term slug. + * + * @var string + */ + public const DELIMITER = '__-__'; + + /** + * Local key. + * + * @var string + */ + protected $local_key; + + /** + * Foreign key. + * + * @var string + */ + protected $foreign_key; + + /** + * Create a new has one or many relationship instance. + * + * @param Builder $query Query builder object. + * @param Model $parent Parent model. + * @param string $foreign_key Foreign key. + * @param string $local_key Local key. + */ + public function __construct( Builder $query, Model $parent, string $foreign_key, ?string $local_key = null ) { + $this->foreign_key = $foreign_key; + $this->local_key = $local_key; + + parent::__construct( $query, $parent ); + } + + /** + * Add constraints to the query. + * + * @throws Model_Exception Thrown if the parent model is not an instance of Core_Object. + */ + public function add_constraints(): void { + // todo: remove in PHP 8.1+. + if ( ! $this->parent instanceof Core_Object ) { + throw new Model_Exception( 'Parent model must be an instance of Core_Object.' ); + } + + if ( static::$constraints ) { + if ( $this->is_post_term_relationship() ) { + $term_ids = get_the_terms( $this->parent->id(), $this->related::get_object_name() ); + + $term_ids = collect( is_array( $term_ids ) ? $term_ids : [] ) + ->pluck( 'term_id' ) + ->all(); + + // If the post has no terms, 'kill' the query. + if ( empty( $term_ids ) ) { + $this->query->whereIn( $this->local_key, [ PHP_INT_MAX ] ); + return; + } + + $this->query->whereIn( $this->local_key, $term_ids ); + } elseif ( $this->is_term_post_relationship() && $this->parent instanceof Term && $this->query instanceof Post_Query_Builder ) { + $this->query->whereTerm( $this->parent->id(), $this->parent->taxonomy() ); + } elseif ( $this->uses_terms && $this->query instanceof Post_Query_Builder ) { + $this->query->whereTerm( + $this->get_term_slug_for_relationship(), + static::RELATION_TAXONOMY, + 'IN', + 'slug', + ); + } else { + $this->query->whereMeta( $this->foreign_key, $this->parent->get( $this->local_key ) ); + } + } + } + + /** + * Set the query constraints for an eager load of the relation. + * + * @param Collection $models Models to eager load for. + * + * @throws RuntimeException Thrown on currently unsupported query condition. + */ + public function add_eager_constraints( Collection $models ): void { + $keys = $models->pluck( $this->local_key )->to_array(); + + if ( $this->is_post_term_relationship() ) { + $terms = collect(); + + /** + * Get the terms for the $models. + * + * @todo Optimize this to use a raw query instead of making a bunch of + * unnecessary queries on top of 'eager' loading. + */ + + foreach ( $models as $model ) { + $terms = $terms->merge( + get_the_terms( $model->id(), $this->related::get_object_name() ), + ); + } + + $terms = $terms + ->pluck( 'term_id' ) + ->filter() + ->unique(); + + if ( $terms->is_empty() ) { + $this->query->whereIn( $this->local_key, [ PHP_INT_MAX ] ); + } else { + $this->query->whereIn( $this->local_key, $terms->all() ); + } + } elseif ( $this->is_term_post_relationship() && $this->query instanceof Post_Query_Builder && $this->parent instanceof Term ) { + $this->query->whereTerm( $keys, $this->parent->taxonomy() ); + } elseif ( $this->uses_terms ) { + throw new RuntimeException( 'Eager loading relationships with terms is not supported yet.' ); + } else { + $this->query->whereMeta( $this->foreign_key, $keys, 'IN' ); + } + } + + /** + * Attach a model to a parent model and save it. + * + * @param Model[]|Model $model Model instance to save. + */ + public function save( array|Model $model ): Model { + if ( is_array( $model ) ) { + // Return the first model if saving many. + return collect( $this->save_many( $model ) )->first(); + } + + // Save the model if it doesn't exist. + if ( ! $model->exists && $model instanceof Updatable ) { + $model->save(); + } + + $append = Has_Many::class === static::class || is_subclass_of( $this, Has_Many::class ); + + if ( $this->is_post_term_relationship() && $this->parent instanceof Post ) { + $this->parent->set_terms( $model, $model->first()::get_object_name(), $append ); + } elseif ( $this->is_term_post_relationship() ) { + if ( $model instanceof Post ) { + $model->set_terms( $this->parent, $this->parent::get_object_name(), $append ); + } + } else { + // Set meta or use a hidden taxonomy if using terms. + if ( $this->uses_terms && $model instanceof Core_Object ) { + wp_set_object_terms( $model->id(), [ $this->get_term_for_relationship() ], static::RELATION_TAXONOMY, $append ); + } else { + if ( $model instanceof Model_Meta ) { + $model->set_meta( $this->foreign_key, $this->parent->get( $this->local_key ) ); + } + } + } + + if ( $this->relationship ) { + $this->parent->unset_relation( $this->relationship ); + } + + return $model; + } + + /** + * Save many models to the database. + * + * @param array<int, Model> $models Model instances to save. + * @return array<int, Model> + */ + public function save_many( array $models ): array { + return collect( $models ) + ->map( fn ( $item ) => $this->save( $item ) ) + ->all(); + } + + /** + * Dissociate a model from a parent model. + * + * @param Model|array<mixed, Model> $models Model instance to save. + */ + public function remove( Model|array $models ): void { + $models = is_array( $models ) ? $models : [ $models ]; + + if ( $this->is_post_term_relationship() && $this->parent instanceof Post ) { + $this->parent->remove_terms( $models ); + } elseif ( $this->is_term_post_relationship() ) { + foreach ( $models as $model ) { + if ( $model instanceof Post ) { + $model->remove_terms( $this->parent ); + } + } + } else { + foreach ( $models as $model ) { + if ( $model->exists ) { + if ( $this->uses_terms && $model instanceof Core_Object ) { + $term = $this->get_term_for_relationship(); + + if ( has_term( $term, static::RELATION_TAXONOMY, $model->id() ) ) { + wp_remove_object_terms( $model->id(), $term, static::RELATION_TAXONOMY ); + } + } elseif ( $model instanceof Model_Meta ) { + $model->delete_meta( $this->foreign_key ); + } + } + } + } + + if ( $this->relationship ) { + $this->parent->unset_relation( $this->relationship ); + } + } + + /** + * Retrieve a internal term for a post-to-post relationship. + * + * @throws Model_Exception Thrown on error using internal term with a post to term or term to post relationship. + */ + protected function get_term_for_relationship(): int { + if ( $this->is_post_term_relationship() || $this->is_term_post_relationship() ) { + throw new Model_Exception( 'Unable to retrieve an internal term for a post->term or term->post relationship.' ); + } + + $name = $this->get_term_slug_for_relationship(); + $term = get_term_by( 'name', $name, static::RELATION_TAXONOMY ); + + if ( empty( $term ) ) { + $insert = wp_insert_term( $name, static::RELATION_TAXONOMY ); + + if ( is_wp_error( $insert ) ) { + throw new Model_Exception( "Error creating internal term for relationship: [{$insert->get_error_message()}]" ); + } + + return $insert['term_id']; + } + + return $term->term_id; + } + + /** + * Retrieve the term slug for a post-to-post relationship. + */ + protected function get_term_slug_for_relationship(): string { + $delimiter = static::DELIMITER; + return "{$this->foreign_key}{$delimiter}{$this->parent->get( $this->local_key )}"; + } + + /** + * Build a model dictionary keyed by the relation's foreign key. + * + * @param Collection $results Collection of results. + * @param Collection $models Parent models. + */ + protected function build_dictionary( Collection $results, Collection $models ): array { + // Post term relationships always rely on the underlying term. + if ( $this->is_post_term_relationship() ) { + $post_term_ids = []; + + foreach ( $models as $model ) { + $terms = get_the_terms( $model->id(), $this->related::get_object_name() ); + + $post_term_ids[ $model->id() ] = is_array( $terms ) ? wp_list_pluck( $terms, 'term_id' ) : []; + } + + $results = $results->key_by( 'term_id' ); + $dictionary = []; + + foreach ( $models as $model ) { + if ( empty( $post_term_ids[ $model->id() ] ) ) { + continue; + } + + foreach ( $post_term_ids[ $model->id() ] as $term_id ) { + $dictionary[ $model->id() ][] = $results[ $term_id ]; + } + } + + return $dictionary; + } elseif ( $this->is_term_post_relationship() ) { + // Term post relationships also always rely on the underlying term. + $dictionary = []; + + $post_term_ids = []; + + foreach ( $results as $result ) { + if ( ! $this->parent instanceof Term ) { + continue; + } + + $terms = get_the_terms( $result->id(), $this->parent->taxonomy() ); + $terms = is_array( $terms ) ? wp_list_pluck( $terms, 'term_id' ) : []; + + foreach ( $terms as $term ) { + $post_term_ids[ $term ][] = $result->id(); + } + } + + $results = $results->key_by( 'id' ); + + // End result: a dictionary with key of term IDs and array of post results. + foreach ( $post_term_ids as $term_id => $post_ids ) { + $dictionary[ $term_id ] = $results->only( $post_ids )->values()->all(); + } + + return $dictionary; + } + + return $results + ->map_to_dictionary( + function ( $result ) { + try { + return [ $result->meta->{$this->foreign_key} => $result ]; + } catch ( Throwable ) { // @phpstan-ignore-line Dead catch + return []; + } + } + ) + ->all(); + } +} diff --git a/vendor/mantle-framework/database/model/relations/class-has-one.php b/vendor/mantle-framework/database/model/relations/class-has-one.php new file mode 100644 index 00000000..75934a0a --- /dev/null +++ b/vendor/mantle-framework/database/model/relations/class-has-one.php @@ -0,0 +1,43 @@ +<?php +/** + * Has_One class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Relations; + +use Mantle\Support\Collection; + +/** + * Has One Relationship + */ +class Has_One extends Has_One_Or_Many { + /** + * Get the results of the relationship. + * + * @return \Mantle\Database\Model\Model|null + */ + public function get_results() { + $this->add_constraints(); + + return $this->query->first(); + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param Collection $models Parent models. + * @param Collection $results Eagerly loaded results to match. + */ + public function match( Collection $models, Collection $results ): Collection { + $dictionary = $this->build_dictionary( $results, $models ); + + return $models->each( + function( $model ) use ( $dictionary ): void { + $key = $model[ $this->local_key ]; + $model->set_relation( $this->relationship, $dictionary[ $key ][0] ?? null ); + } + ); + } +} diff --git a/vendor/mantle-framework/database/model/relations/class-relation.php b/vendor/mantle-framework/database/model/relations/class-relation.php new file mode 100644 index 00000000..1ca839fa --- /dev/null +++ b/vendor/mantle-framework/database/model/relations/class-relation.php @@ -0,0 +1,213 @@ +<?php +/** + * Relation class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Relations; + +use Closure; +use Mantle\Database\Model\Model; +use Mantle\Database\Model\Post; +use Mantle\Database\Model\Term; +use Mantle\Database\Query\Builder; +use Mantle\Database\Query\Post_Query_Builder; +use Mantle\Database\Query\Term_Query_Builder; +use Mantle\Support\Collection; +use Mantle\Support\Forward_Calls; + +/** + * Relation base class. + * + * @mixin \Mantle\Database\Query\Builder + * + * @template TParent of Model + */ +abstract class Relation { + use Forward_Calls; + + /** + * Internal taxonomy for post-to-post relationships. + * + * @var string + */ + public const RELATION_TAXONOMY = 'mantle_relationship'; + + /** + * Query Builder instance. + * + * @var Builder + */ + protected $query; + + /** + * The related model (child). + * + * @var string + */ + protected $related; + + /** + * Flag if the relation uses terms. + * + * @var bool|null + */ + protected $uses_terms; + + /** + * Model's relationship name. + * + * @var string|null + */ + protected $relationship; + + /** + * Indicates if the relation is adding constraints. + * + * @var bool + */ + protected static $constraints = true; + + /** + * Create a new relation instance. + * + * @param Builder $query Query builder instance. + * @param Model $parent Model instance. + * @param bool|null $uses_terms Flag if the relation uses terms. + * @param string $relationship Relationship name, optional. + */ + public function __construct( Builder $query, protected Model $parent, ?bool $uses_terms = null, string $relationship = null ) { + $this->query = $query; + $this->related = $query->get_model(); + + if ( ! is_null( $uses_terms ) ) { + $this->uses_terms( $uses_terms ); + } + + $this->relationship = $relationship ?: $this->guess_relationship(); + } + + /** + * Run a callback with constraints disabled on the relation. + * + * @param Closure $callback Callback to invoke. + * @return mixed + */ + public static function no_constraints( Closure $callback ) { + $previous = static::$constraints; + + static::$constraints = false; + + try { + return $callback(); + } finally { + static::$constraints = $previous; + } + } + + + /** + * Set the query constraints to apply to the query. + * + * @return void + */ + abstract public function add_constraints(); + + /** + * Set the query constraints for an eager load of the relation. + * + * @param Collection $models Models to eager load for. + */ + abstract public function add_eager_constraints( Collection $models ): void; + + /** + * Get the results of the relationship. + * + * @return mixed + */ + abstract public function get_results(); + + /** + * Match the eagerly loaded results to their parents. + * + * @param Collection $models Parent models. + * @param Collection $results Eagerly loaded results to match. + */ + abstract public function match( Collection $models, Collection $results ): Collection; + + /** + * Retrieve the query for a relation. + * + * @return Builder; + */ + public function get_query(): Builder { + return $this->query; + } + + /** + * Get the relationship for eager loading. + */ + public function get_eager(): Collection { + return $this->query->get(); + } + + /** + * Handle dynamic method calls to the relationship. + * + * @param string $method Method name. + * @param array $parameters Method arguments. + * @return mixed + */ + public function __call( string $method, array $parameters ) { + $this->add_constraints(); + + $result = $this->forward_call_to( $this->query, $method, $parameters ); + + if ( $this->query === $result ) { + return $this; + } + + return $result; + } + + /** + * Flag if the relation uses terms. + * + * @param bool $uses Flag if the relation uses or doesn't use terms. + * @return static + */ + public function uses_terms( bool $uses = true ) { + $this->uses_terms = $uses; + return $this; + } + + /** + * Guess the name of the relationship. + */ + protected function guess_relationship() : ?string { + $trace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 5 ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_debug_backtrace + + foreach ( $trace as $item ) { + if ( is_subclass_of( $item['class'], Model::class ) ) { + return $item['function']; + } + } + + return null; + } + + /** + * Determine if this is a post -> term relationship. + */ + protected function is_post_term_relationship(): bool { + return $this->parent instanceof Post && $this->query instanceof Term_Query_Builder; + } + + /** + * Determine if this is a term -> post relationship. + */ + protected function is_term_post_relationship(): bool { + return $this->parent instanceof Term && $this->query instanceof Post_Query_Builder; + } +} diff --git a/vendor/mantle-framework/database/model/term/class-model-term-proxy.php b/vendor/mantle-framework/database/model/term/class-model-term-proxy.php new file mode 100644 index 00000000..be65275b --- /dev/null +++ b/vendor/mantle-framework/database/model/term/class-model-term-proxy.php @@ -0,0 +1,64 @@ +<?php +/** + * Model_Term_Proxy class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Term; + +use Mantle\Database\Model\Post; +use Mantle\Database\Model\Term; +use RuntimeException; + +/** + * Allow term to be retrieve as an attribute on the object. + * + * @property Term[] $category Categories for the model. + * @property Term[] $post_tag Tags for the model. + */ +class Model_Term_Proxy { + /** + * Constructor. + * + * @param Post $model Model to reference. + */ + public function __construct( protected Post $model ) { + } + + /** + * Retrieve model terms by taxonomy. + * + * @param string $taxonomy Taxonomy name. + * @return Term[] + */ + public function __get( string $taxonomy ) { + $queued_value = $this->model->get_queued_term_attribute( $taxonomy ); + + if ( null !== $queued_value ) { + return $queued_value; + } + + return $this->model->get_terms( $taxonomy ); + } + + /** + * Set model term. + * + * @param string $taxonomy Taxonomy name.. + * @param Term[]|\WP_Term[]|int[] $values Terms. + */ + public function __set( string $taxonomy, $values ) { + $this->model->queue_term_attribute( $taxonomy, $values ); + } + + /** + * Delete model terms. + * + * @throws RuntimeException Thrown on usage. + * @param string $key Taxonomy key. + */ + public function __unset( string $key ) { + throw new RuntimeException( 'Deleting model terms by attribute is not supported.' ); + } +} diff --git a/vendor/mantle-framework/database/model/term/trait-model-term.php b/vendor/mantle-framework/database/model/term/trait-model-term.php new file mode 100644 index 00000000..1025b12e --- /dev/null +++ b/vendor/mantle-framework/database/model/term/trait-model-term.php @@ -0,0 +1,273 @@ +<?php +/** + * Model_Term class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Model\Term; + +use InvalidArgumentException; +use Mantle\Database\Model\Model_Exception; +use Mantle\Database\Model\Term; +use Mantle\Support\Arr; +use Mantle\Support\Collection; +use WP_Term; + +use function Mantle\Support\Helpers\collect; +use function Mantle\Support\Helpers\get_term_object; +use function Mantle\Support\Helpers\get_term_object_by; + +/** + * Interface for interfacing with a model's terms. + * + * @property Model_Term_Proxy $terms Proxy to manage terms for the model. + */ +trait Model_Term { + /** + * Terms queued for saving. + * + * @var array + */ + protected $queued_terms = []; + + /** + * Retrieve the terms 'attribute'. + * + * @return Model_Term_Proxy + */ + public function get_terms_attribute() { + return new Model_Term_Proxy( $this ); + } + + /** + * Allow setting terms through an array via an attribute mutator. + * + * @param array $values Term values to set. + * @throws Model_Exception Thrown on invalid value being set. + */ + public function set_terms_attribute( $values ): void { + if ( ! is_array( $values ) ) { + throw new Model_Exception( 'Attribute value passed to terms is not an array.' ); + } + + $this->queued_terms = $values; + } + + /** + * Get a queued term attribute. + * + * @param string $key Taxonomy key. + * @return mixed|null Terms or null. + */ + public function get_queued_term_attribute( string $key ) { + return ( $this->queued_terms[ $key ] ?? [] )[0] ?? null; + } + + /** + * Queue a term for saving + * Allows terms to be set before a post is saved. + * + * @param string $taxonomy Taxonomy name. + * @param mixed $value Terms. + */ + public function queue_term_attribute( string $taxonomy, $value ): void { + $this->queued_terms[ $taxonomy ] = $value; + } + + /** + * Store queued model terms. + */ + protected function store_queued_terms() { + if ( empty( $this->queued_terms ) ) { + return; + } + + // Determine if this is an array of terms instead of taxonomy => term pairs. + if ( Arr::is_assoc( $this->queued_terms ) ) { + foreach ( $this->queued_terms as $taxonomy => $values ) { + $this->set_terms( $values, $taxonomy ); + } + } else { + $this->set_terms( $this->queued_terms ); + } + + $this->queued_terms = []; + } + + /** + * Get term(s) associated with a post. + * + * @param string $taxonomy Taxonomy name. + * @return Term[] + */ + public function get_terms( string $taxonomy ): array { + $terms = \get_the_terms( $this->id(), $taxonomy ); + + if ( empty( $terms ) || \is_wp_error( $terms ) ) { + return []; + } + + return array_map( + fn ( WP_Term $term ) => Term::new_from_existing( (array) $term ), + (array) $terms, + ); + } + + /** + * Set the term(s) associated with a post. + * + * @param mixed $terms Accepts an array of or a single instance of terms. + * @param string $taxonomy Taxonomy name, optional. + * @param bool $append Append to the object's terms, defaults to false. + * @return static + * + * @throws Model_Exception Thrown if the $taxonomy cannot be inferred from $terms. + * @throws Model_Exception Thrown if error saving the post's terms. + */ + public function set_terms( $terms, ?string $taxonomy = null, bool $append = false ) { + $terms = collect( Arr::wrap( $terms ) ); + + // If taxonomy is not specified, chunk the terms into taxonomy groups. + if ( ! $taxonomy ) { + $terms = $terms->reduce( + function ( array $carry, $term ): array { + if ( $term instanceof WP_Term ) { + $carry[ $term->taxonomy ][] = $term; + + return $carry; + } + + if ( $term instanceof Term ) { + $carry[ $term->taxonomy ][] = $term->core_object(); + + return $carry; + } + + // Support an array of taxonomy => term ID/object/slug pairs. + if ( is_array( $term ) ) { + foreach ( $term as $taxonomy => $item ) { + if ( $item instanceof WP_Term || $item instanceof Term ) { + $carry[ $item->taxonomy ][] = $item instanceof Term + ? $item->core_object() + : $item; + + continue; + } + + if ( is_numeric( $item ) ) { + $item = get_term_object( $item ); + + if ( $item instanceof WP_Term ) { + $carry[ $item->taxonomy ][] = $item; + } + + continue; + } + + // Attempt to infer if the key is a taxonomy slug and this is a + // taxonomy => term slug pair. + if ( ! is_string( $taxonomy ) || ! taxonomy_exists( $taxonomy ) ) { + continue; + } + + $item = get_term_object_by( 'slug', $item, $taxonomy ); + + if ( $item ) { + $carry[ $taxonomy ][] = $item; + } + } + + return $carry; + } + + if ( ! is_numeric( $term ) ) { + throw new InvalidArgumentException( "Invalid term value passed to set_terms (expected Term/WP_Term/int): {$term}" ); + } + + $term = get_term_object( $term ); + + if ( $term ) { + $carry[ $term->taxonomy ][] = $term; + } + + return $carry; + }, + [], + ); + + foreach ( collect( $terms )->filter() as $taxonomy => $items ) { + $this->set_terms( Arr::pluck( $items, 'term_id' ), $taxonomy, $append ); + } + + return $this; + } + + // Convert the terms to a array of term IDs. + $terms = $terms + ->map( + function ( $term ) { + if ( $term instanceof WP_Term || $term instanceof Term ) { + return $term->term_id; + } + + return $term; + } + ) + ->filter() + ->all(); + + $update = \wp_set_object_terms( $this->id(), $terms, $taxonomy, $append ); + + if ( \is_wp_error( $update ) ) { + throw new Model_Exception( "Error setting model terms: [{$update->get_error_message()}]" ); + } + + return $this; + } + + + /** + * Remove terms from a post. + * + * @param mixed $terms Accepts an array of or a single instance of terms. + * @param string $taxonomy Taxonomy name, optional. + * @return static + * + * @throws Model_Exception Thrown if the $taxonomy cannot be inferred from $terms. + */ + public function remove_terms( $terms, string $taxonomy = null ) { + $terms = collect( Arr::wrap( $terms ) ) + ->map( + function ( $term ) use ( &$taxonomy ) { + if ( $term instanceof Term ) { + if ( empty( $taxonomy ) ) { + $taxonomy = $term->taxonomy(); + } + + return $term->id(); + } + + if ( $term instanceof \WP_Term ) { + if ( empty( $taxonomy ) ) { + $taxonomy = $term->taxonomy; + } + + return $term->term_id; + } + + return $term; + } + ) + ->filter() + ->all(); + + if ( empty( $taxonomy ) ) { + throw new Model_Exception( 'Term taxonomy not able to be inferred.' ); + } + + \wp_remove_object_terms( $this->id(), $terms, $taxonomy ); + + return $this; + } +} diff --git a/vendor/mantle-framework/database/pagination/class-length-aware-paginator.php b/vendor/mantle-framework/database/pagination/class-length-aware-paginator.php new file mode 100644 index 00000000..e49d9aa9 --- /dev/null +++ b/vendor/mantle-framework/database/pagination/class-length-aware-paginator.php @@ -0,0 +1,100 @@ +<?php +/** + * Length_Aware_Paginator class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Pagination; + +/** + * Length Aware Paginator + */ +class Length_Aware_Paginator extends Paginator { + /** + * Storage of the found rows. + * + * @var int + */ + protected $found_rows; + + /** + * View name to load. + * + * @var string + */ + protected $view = 'paginator'; + + /** + * Set the items for the paginator. + * + * @return static + */ + protected function set_items() { + $builder = $this->builder; + + $this->items = $builder->get(); + $this->found_rows = $builder->get_found_rows(); + + return $this; + } + + /** + * Elements for the paginator. + */ + public function elements(): array { + $elements = []; + $current_page = $this->current_page(); + $max_pages = $this->max_pages(); + + // Previous two pages. + for ( $i = $current_page - 2; $i < $current_page; $i++ ) { + if ( $i < 1 ) { + continue; + } + + $elements[][ $i ] = $this->url( $i ); + } + + // Current page. + $elements[][ $current_page ] = $this->url( $current_page ); + + // Previous next pages. + for ( $i = $current_page + 1; $i < $max_pages; $i++ ) { + $elements[][ $i ] = $this->url( $i ); + } + + return $elements; + } + + /** + * Determine if there are more items in the data source. + * + * @param bool $has_more Flag if it has more, unused. + */ + public function has_more( bool $has_more = null ): bool { + if ( empty( $this->found_rows ) ) { + return false; + } + + return ( ( $this->current_page() - 1 ) * $this->per_page ) < $this->found_rows; + } + + /** + * Retrieve the max number of pages. + */ + public function max_pages(): int { + if ( empty( $this->found_rows ) ) { + return 0; + } + + return (int) ceil( $this->found_rows / $this->per_page ); + } + + /** + * Determine if the paginator has a previous page. + */ + public function has_previous(): bool { + return $this->current_page() > $this->max_pages(); + } +} diff --git a/vendor/mantle-framework/database/pagination/class-paginator-service-provider.php b/vendor/mantle-framework/database/pagination/class-paginator-service-provider.php new file mode 100644 index 00000000..b4335951 --- /dev/null +++ b/vendor/mantle-framework/database/pagination/class-paginator-service-provider.php @@ -0,0 +1,24 @@ +<?php +/** + * Paginator_Service_Provider class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Pagination; + +use Mantle\Support\Service_Provider; + +/** + * Paginator Service Provider + */ +class Paginator_Service_Provider extends Service_Provider { + /** + * Register the provider + */ + public function register(): void { + if ( isset( $this->app['view.loader'] ) ) { + $this->app['view.loader']->add_path( __DIR__ . '/resources', 'paginator' ); + } + } +} diff --git a/vendor/mantle-framework/database/pagination/class-paginator.php b/vendor/mantle-framework/database/pagination/class-paginator.php new file mode 100644 index 00000000..8894e3a8 --- /dev/null +++ b/vendor/mantle-framework/database/pagination/class-paginator.php @@ -0,0 +1,564 @@ +<?php +/** + * Paginator class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Pagination; + +use ArrayAccess; +use Countable; +use InvalidArgumentException; +use JsonSerializable; +use Mantle\Contracts\Container; +use Mantle\Contracts\Paginator\Paginator as PaginatorContract; +use Mantle\Contracts\Support\Arrayable; +use Mantle\Contracts\Support\Htmlable; +use Mantle\Contracts\Support\Jsonable; +use Mantle\Database\Query\Builder; +use Mantle\Http\Request; +use Mantle\Http\View\View; +use Mantle\Support\Collection; +use Mantle\Support\Str; + +/** + * Paginator for query results. + */ +class Paginator implements Arrayable, ArrayAccess, Countable, Jsonable, JsonSerializable, Htmlable, PaginatorContract { + /** + * Current page number + * + * @var int + */ + protected $current_page; + + /** + * Container instance. + * + * @var Container + */ + protected $container; + + /** + * Query builder instance. + * + * @var Builder + */ + protected $builder; + + /** + * Items being paginate. + * + * @var \Mantle\Support\Collection + */ + protected $items; + + /** + * Number of items per page. + * + * @var int + */ + protected $per_page; + + /** + * Path for URLs. + * + * @var string + */ + protected $path = '/'; + + /** + * Flag if query strings should be used. + * + * @var bool + */ + protected $use_query_string = true; + + /** + * Set of query string values to use on every URL. + * + * @var array + */ + protected $query = []; + + /** + * View name to load. + * + * @var string + */ + protected $view = 'simple'; + + /** + * Flag if the paginator has more. + * + * @var bool + */ + protected $has_more = true; + + /** + * The current path resolver callback. + * + * @var \Closure|null + */ + protected static $current_path_resolver; + + /** + * The current page resolver callback. + * + * @var \Closure|null + */ + protected static $current_page_resolver; + + /** + * The URL generator callback. + * + * @var \Closure|null + */ + protected static $url_generator; + + /** + * Constructor. + * + * @param Container $container Application instance. + * @param Builder $builder Query builder instance. + * @param int $per_page Items per-page. + * @param int $current_page Current page to set. + */ + public function __construct( Container $container, Builder $builder, int $per_page = 20, int $current_page = null ) { + $this->container = $container; + $this->builder = $builder; + $this->per_page = $per_page; + + $this->builder->take( $per_page ); + + $this->set_current_page( $current_page ); + $this->path(); + $this->set_items(); + } + + /** + * Set the path to use for the request. + * + * @param string $path Path to use. + * @return static + */ + public function path( string $path = null ) { + if ( $path ) { + $this->path = $path; + return $this; + } + + if ( isset( static::$current_path_resolver ) ) { + $this->path = (string) call_user_func( static::$current_path_resolver, $this ); + return $this; + } + + $this->path = static::strip_page_from_path( static::request()->path() ); + + // Ensure the path starts with a /. + if ( $this->path && '/' !== $this->path[0] ) { + $this->path = "/{$this->path}"; + } + + return $this; + } + + /** + * Retrieve the path to use for the paginator. + */ + public function get_path(): string { + return $this->path; + } + + /** + * Flag if query strings should be used for the pagination URLs. + * + * @return static + */ + public function use_query_string() { + $this->use_query_string = true; + return $this; + } + + /** + * Flag if query strings shouldn't be used for the pagination URLs. + * + * @return static + */ + public function use_path() { + $this->use_query_string = false; + return $this; + } + + /** + * Set the current page for the paginator. + * + * @param int $current_page Current page to set, optional. + * @return static + */ + public function set_current_page( int $current_page = null ) { + if ( $current_page && $current_page > 0 ) { + $this->current_page = $current_page; + } else { + $this->current_page = static::resolve_current_page(); + } + + $this->builder->page( $this->current_page ); + return $this; + } + + /** + * Retrieve the current page. + */ + public function current_page(): int { + return $this->current_page; + } + + /** + * Determine if this is the first page. + */ + public function on_first_page(): bool { + return 1 === $this->current_page(); + } + + /** + * Set the items for the paginator. + * + * @return static + */ + protected function set_items() { + $this->items = $this->builder->where( 'no_found_rows', true )->get(); + return $this; + } + + /** + * Retrieve the items for the paginator. + */ + public function items(): Collection { + return $this->items; + } + + /** + * Determine if there are more items in the data source. + * + * @param bool $has_more Flag if there should be more pages. + */ + public function has_more( bool $has_more = null ): bool { + if ( null !== $has_more ) { + $this->has_more = $has_more; + } + + return true; + } + + /** + * Determine if there are enough items to split into multiple pages. + */ + public function has_pages(): bool { + if ( 1 !== $this->current_page() ) { + return true; + } + return $this->has_more(); + } + + /** + * Count the number of items. + */ + public function count(): int { + return $this->items->count(); + } + + /** + * Append query string value to the paginator. + * + * @param string|array $key Query string key or array of key value pairs. + * @param mixed $value Query string value. + * @return static + */ + public function append( $key, $value = null ) { + if ( is_array( $key ) && null === $value ) { + foreach ( $key as $k => $v ) { + $this->append( $k, $v ); + } + + return $this; + } + + $this->query[ $key ] = $value; + return $this; + } + + /** + * Append the current query string parameters. + * + * @return static + */ + public function with_query_string() { + $this->append( static::request()->query() ); + return $this; + } + + /** + * Retrieve the query strings for the paginator. + */ + public function query(): array { + return $this->query; + } + + /** + * Get the current request object. + */ + protected static function request(): Request { + return app( Request::class ); + } + + /** + * Resolve the current page. + */ + protected static function resolve_current_page(): int { + if ( static::$current_page_resolver ) { + return call_user_func( static::$current_page_resolver ); + } + + $request = static::request(); + $query = $request->query( 'page' ); + if ( $query ) { + return (int) $query; + } + + $path = $request->path(); + + if ( ! Str::is( 'page/*', $path ) ) { + return 1; + } + + return static::get_page_from_path( $path ); + } + + /** + * Find the current page from the path. + * + * @param string $path URL path. + */ + protected static function get_page_from_path( string $path ): ?int { + if ( ! Str::is( 'page/*', $path ) ) { + return 1; + } + preg_match_all( '/page\/(\d*)\/?/', $path, $matches ); + return (int) ( $matches[1][0] ?? 1 ); + } + + /** + * Find the current page from the path. + * + * @param string $path URL path. + */ + protected static function strip_page_from_path( string $path ): string { + if ( ! Str::is( 'page/*', $path ) ) { + return $path; + } + preg_match_all( '/page\/(\d*)\/?/', $path, $matches ); + + if ( ! empty( $matches[0][0] ) ) { + return str_replace( $matches[0][0], '', $path ); + } + + return $path; + } + + /** + * Set the current page resolver. + * + * @param callable $callback Callback for the resolver. + */ + public static function current_page_resolver( callable $callback ): void { + static::$current_page_resolver = $callback; + } + + /** + * Set the current path resolver. + * + * @param callable $callback Callback for the resolver. + */ + public static function current_path_resolver( callable $callback ): void { + static::$current_path_resolver = $callback; + } + + /** + * Generate a URL for a given page. + * + * @param int $page Page number. + */ + public function url( int $page ): string { + if ( isset( static::$url_generator ) ) { + return call_user_func( static::$url_generator, $page, $this ); + } + + if ( $this->use_query_string ) { + if ( $page <= 1 ) { + return add_query_arg( $this->query, $this->path ); + } + + return add_query_arg( + [ + 'page' => $page, + ] + $this->query, + $this->path + ); + } + + if ( $page < 1 ) { + return add_query_arg( $this->query, $this->path ); + } + + return add_query_arg( $this->query, trailingslashit( $this->path ) . 'page/' . $page . '/' ); + } + + /** + * Retrieve the URL for the next page. + */ + public function next_url(): ?string { + if ( $this->has_more() ) { + return $this->url( $this->current_page() + 1 ); + } + + return null; + } + + /** + * Retrieve the URL for the previous page. + */ + public function previous_url(): ?string { + if ( $this->current_page() > 1 ) { + return $this->url( $this->current_page() - 1 ); + } + + return null; + } + + /** + * Convert the paginator to an array. + */ + public function to_array(): array { + return [ + 'current_page' => $this->current_page(), + 'data' => $this->items->to_array(), + 'first_page_url' => $this->url( 1 ), + 'next_url' => $this->next_url(), + 'path' => $this->get_path(), + 'previous_url' => $this->previous_url(), + ]; + } + + /** + * Convert the object into something JSON serializable. + * + * @return array + */ + public function jsonSerialize(): mixed { + return $this->to_array(); + } + + /** + * Convert the object to its JSON representation. + * + * @param int $options Options for json_encode(). + * @return string + */ + public function to_json( $options = 0 ) { + return wp_json_encode( $this->jsonSerialize(), $options ); + } + + /** + * Check if an item exists at an offset. + * + * @param mixed $offset Array offset. + */ + public function offsetExists( mixed $offset ): bool { + return isset( $this->items[ $offset ] ); + } + + /** + * Retrieve an item by its offset. + * + * @param mixed $offset Offset to get. + */ + public function offsetGet( mixed $offset ): mixed { + return $this->items[ $offset ]; + } + + /** + * Set an item by its offset. + * + * @param mixed $offset Offset to get. + * @param mixed $value Value to set. + */ + public function offsetSet( mixed $offset, mixed $value ): void { + $this->items[ $offset ] = $value; + } + + /** + * Delete by an offset. + * + * @param mixed $offset Offset to delete. + */ + public function offsetUnset( $offset ): void { + unset( $this->items[ $offset ] ); + } + + /** + * View name to load. + * + * @param string $view View name. + * @return static + */ + public function view( string $view ) { + $this->view = $view; + + return $this; + } + + /** + * Render the paginator + * + * @param string $view View name to load, optional. + * @param array $data View data. + */ + public function render( string $view = null, array $data = [] ): ?View { + try { + return $this->container['view']->make( + $view ?: $this->view, + array_merge( + $data, + [ + 'paginator' => $this, + ] + ) + ); + } catch ( InvalidArgumentException $e ) { + unset( $e ); + return null; + } + } + + /** + * Render the links + * + * @param string $view View name to load, optional. + * @param array $data View data. + */ + public function links( string $view = null, array $data = [] ): string { + return (string) $this->render( $view, $data ); + } + + /** + * Convert the paginator to HTML. + * + * @param string $view View name to load, optional. + * @param array $data View data. + */ + public function to_html( string $view = null, array $data = [] ): string { + return (string) $this->render( $view, $data ); + } +} diff --git a/vendor/mantle-framework/database/pagination/resources/paginator.blade.php b/vendor/mantle-framework/database/pagination/resources/paginator.blade.php new file mode 100644 index 00000000..2cccc49c --- /dev/null +++ b/vendor/mantle-framework/database/pagination/resources/paginator.blade.php @@ -0,0 +1,37 @@ +@if ($paginator->has_pages()) + <nav> + <ul class="pagination"> + {{-- Previous Page Link --}} + @if ($paginator->on_first_page()) + <li class="disabled" aria-disabled="true"><span>‹</span></li> + @else + <li><a href="{{ $paginator->previous_url() }}" rel="prev">‹</a></li> + @endif + + @foreach ($paginator->elements() as $element) + {{-- "Three Dots" Separator --}} + @if (is_string($element)) + <li class="disabled" aria-disabled="true"><span>{{ $element }}</span></li> + @endif + + {{-- Array Of Links --}} + @if (is_array($element)) + @foreach ($element as $page => $url) + @if ($page == $paginator->current_page()) + <li class="active" aria-current="page"><span>{{ $page }}</span></li> + @else + <li><a href="{{ $url }}">{{ $page }}</a></li> + @endif + @endforeach + @endif + @endforeach + + {{-- Next Page Link --}} + @if ($paginator->has_more()) + <li><a href="{{ $paginator->next_url() }}" rel="next">›</a></li> + @else + <li class="disabled" aria-disabled="true"><span>›</span></li> + @endif + </ul> + </nav> +@endif diff --git a/vendor/mantle-framework/database/pagination/resources/simple.blade.php b/vendor/mantle-framework/database/pagination/resources/simple.blade.php new file mode 100644 index 00000000..6614d4fa --- /dev/null +++ b/vendor/mantle-framework/database/pagination/resources/simple.blade.php @@ -0,0 +1,19 @@ +@if ($paginator->has_pages()) + <nav> + <ul class="pagination"> + {{-- Previous Page Link --}} + @if ($paginator->on_first_page()) + <li class="disabled" aria-disabled="true"><span>{{ __('Previous', 'mantle') }}</span></li> + @else + <li><a href="{{ $paginator->previous_url() }}" rel="prev">{{ __('Previous', 'mantle') }}</a></li> + @endif + + {{-- Next Page Link --}} + @if ($paginator->has_more()) + <li><a href="{{ $paginator->next_url() }}" rel="next">{{ __('Next', 'mantle') }}</a></li> + @else + <li class="disabled" aria-disabled="true"><span>{{ __('Next', 'mantle') }}</span></li> + @endif + </ul> + </nav> +@endif diff --git a/vendor/mantle-framework/database/query/class-builder.php b/vendor/mantle-framework/database/query/class-builder.php new file mode 100644 index 00000000..bf5930bf --- /dev/null +++ b/vendor/mantle-framework/database/query/class-builder.php @@ -0,0 +1,963 @@ +<?php +/** + * Builder class file. + * + * phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid + * phpcs:disable Squiz.Commenting.VariableComment.Missing, Squiz.Commenting.FunctionComment + * phpcs:disable PEAR.Functions.FunctionCallSignature.CloseBracketLine, PEAR.Functions.FunctionCallSignature.MultipleArguments, PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket + * + * @package Mantle + */ + +namespace Mantle\Database\Query; + +use BackedEnum; +use Closure; +use Mantle\Container\Container; +use Mantle\Contracts\Database\Scope; +use Mantle\Contracts\Paginator\Paginator as PaginatorContract; +use Mantle\Database\Model\Model; +use Mantle\Database\Model\Model_Not_Found_Exception; +use Mantle\Database\Pagination\Length_Aware_Paginator; +use Mantle\Database\Pagination\Paginator; +use Mantle\Database\Query\Concerns\Query_Bindings; +use Mantle\Database\Query\Concerns\Query_Clauses; +use Mantle\Support\Arr; +use Mantle\Support\Collection; +use Mantle\Support\Str; +use Mantle\Support\Traits\Conditionable; + +/** + * Builder Query Builder + * + * @template TModel of \Mantle\Database\Model\Model + */ +abstract class Builder { + use Conditionable, + Query_Bindings, + Query_Clauses; + + /** + * Result limit per-page. + */ + protected ?int $limit = 100; + + /** + * Result offset. + */ + protected int $offset = 0; + + /** + * Result page. + */ + protected int $page = 1; + + /** + * Where arguments for the query. + */ + protected array $wheres = []; + + /** + * Order of the query. + * + * @var array<int, string> + */ + protected array $order = []; + + /** + * Query by of the query. + * + * @var array<int, string> + */ + protected array $order_by = []; + + /** + * Meta Query. + */ + protected array $meta_query = []; + + /** + * Query Variable Aliases + */ + protected array $query_aliases = []; + + /** + * Query Where In Aliases + */ + protected array $query_where_in_aliases = []; + + /** + * Query Where Not In Aliases + */ + protected array $query_where_not_in_aliases = []; + + /** + * Query order by aliases. + */ + protected array $query_order_by_aliases = []; + + /** + * Applied global scopes. + */ + protected array $scopes = []; + + /** + * Storage of the found rows for a query. + */ + protected ?int $found_rows = 0; + + /** + * Relationships to eager load. + * + * @var string[] + */ + protected array $eager_load = []; + + /** + * Query hash for the built query. + */ + protected string $query_hash = ''; + + /** + * Constructor. + * + * @param string|string[] $model Model name or array of model names. + * @phpstan-param class-string<TModel>|array<class-string<TModel>> $model + */ + public function __construct( protected array|string $model ) {} + + /** + * Get the query results. + * + * @return Collection<int, TModel> + */ + abstract public function get(): Collection; + + /** + * Get the count of the query results. + */ + abstract public function count(): int; + + /** + * Get the query arguments. + */ + abstract public function get_query_args(): array; + + /** + * Dump the SQL query for the request. + */ + abstract public function dumpSql(): static; + + /** + * Dump the SQL query for the request and stop execution. + */ + abstract public function ddSql(): never; + + /** + * Get a model instance for the builder. + * + * @return string|string[] + */ + public function get_model() { + return $this->model; + } + + /** + * Get the model instance for the builder. + * + * @throws Query_Exception Thrown when trying to use with multiple models. + */ + protected function get_model_instance(): Model { + if ( is_array( $this->model ) ) { + throw new Query_Exception( 'Unable to get model instance for multiple models.' ); + } + + return new $this->model(); + } + + /** + * Retrieve the found rows for a query. + */ + public function get_found_rows(): int { + return $this->found_rows; + } + + /** + * Query an attribute against a list. + * + * @param string $attribute Attribute to query against. + * @param array $values List of values. + * @return static + * + * @throws Query_Exception Thrown on an unmapped attribute being used. + */ + public function whereIn( string $attribute, array $values ) { + if ( is_string( $this->model ) && $this->model::has_attribute_alias( $attribute ) ) { + $attribute = $this->model::get_attribute_alias( $attribute ); + } + + if ( ! empty( $this->query_where_in_aliases[ strtolower( $attribute ) ] ) ) { + $attribute = $this->query_where_in_aliases[ strtolower( $attribute ) ]; + } else { + throw new Query_Exception( 'Unknown where in alias: ' . $attribute ); + } + + return $this->where( $attribute, $values ); + } + + /** + * Query an where an attribute is not in a list. + * + * @param string $attribute Attribute to query against. + * @param array $values List of values. + * @return static + * + * @throws Query_Exception Thrown on an unmapped attribute being used. + */ + public function whereNotIn( string $attribute, array $values ) { + if ( is_string( $this->model ) && $this->model::has_attribute_alias( $attribute ) ) { + $attribute = $this->model::get_attribute_alias( $attribute ); + } + + if ( ! empty( $this->query_where_not_in_aliases[ strtolower( $attribute ) ] ) ) { + $attribute = $this->query_where_not_in_aliases[ strtolower( $attribute ) ]; + } else { + throw new Query_Exception( 'Unknown where not in alias: ' . $attribute ); + } + + return $this->where( $attribute, $values ); + } + + /** + * Create a query builder for a model. + * + * @param array|string $model Model name or array of model names. + * @return static + */ + public static function create( $model ) { + return new static( $model ); + } + + /** + * Add a where clause to the query. + * + * @param string|array $attribute Attribute to use or array of key => value + * attributes to set. + * @param mixed $value Value to compare against. + */ + public function where( array|string $attribute, mixed $value = '' ): static { + if ( is_array( $attribute ) && empty( $value ) ) { + foreach ( $attribute as $key => $value ) { + $this->where( $key, $value ); + } + + return $this; + } + + $attribute = $this->resolve_attribute( $attribute ); + + // Pass date attributes to the date query builder if available. + if ( method_exists( $this, 'whereDate' ) && in_array( $attribute, [ 'post_date', 'post_date_gmt', 'post_modified', 'post_modified_gmt' ], true ) ) { + return $this->whereDate( $value, '=', $attribute ); + } + + $this->wheres[ $attribute ] = $value; + + return $this; + } + + /** + * Support a dynamic where query. + * + * @param string $method Method name. + * @param array $args Arguments. + * @return static + */ + public function dynamicWhere( $method, $args ) { + $finder = substr( $method, 5 ); + + $attribute = Str::snake( $finder ); + + // Use the model's alias if one exist. + if ( is_string( $this->model ) && $this->model::has_attribute_alias( $attribute ) ) { + $attribute = $this->model::get_attribute_alias( $attribute ); + } + + return $this->where( $attribute, ...$args ); + } + + /** + * Resolve an attribute name to the database column name with support for + * query aliases. + * + * @param string $attribute Attribute name. + */ + protected function resolve_attribute( string $attribute ): string { + if ( ! empty( $this->query_aliases[ strtolower( $attribute ) ] ) ) { + return $this->query_aliases[ strtolower( $attribute ) ]; + } + + return $attribute; + } + + /** + * Query by a meta field. + * + * @param string|\BackedEnum $key Meta key. + * @param mixed $value Meta value. + * @param string $compare Comparison method, defaults to '='. + * @return static + */ + public function whereMeta( $key, $value, string $compare = '=' ) { + if ( $key instanceof BackedEnum ) { + $key = $key->value; + } + + if ( $value instanceof BackedEnum ) { + $value = $value->value; + } + + $meta_query = [ + 'compare' => $compare, + 'key' => $key, + 'value' => $value, + ]; + + // Remove the value from meta queries checking for existence. + if ( empty( $value ) && ( 'EXISTS' === $compare || 'NOT EXISTS' === $compare ) ) { + unset( $meta_query['value'] ); + } + + $this->meta_query[] = $meta_query; + + return $this; + } + + /** + * Query by a meta field with the relation set to 'and'. + * + * @param string $key Meta key. + * @param mixed $value Meta value. + * @param string $compare Comparison method, defaults to '='. + * @return static + */ + public function andWhereMeta( ...$args ) { + $this->meta_query['relation'] = 'AND'; + + return $this->whereMeta( ...$args ); + } + + /** + * Query by a meta field with the relation set to 'or'. + * + * @param string $key Meta key. + * @param mixed $value Meta value. + * @param string $compare Comparison method, defaults to '='. + * @return static + */ + public function orWhereMeta( ...$args ) { + $this->meta_query['relation'] = 'OR'; + + return $this->whereMeta( ...$args ); + } + + /** + * Order the query by a field. + * + * @param string $attribute Attribute name. + * @param string $direction Order direction. + * @return static + */ + public function orderBy( string $attribute, string $direction = 'asc' ) { + if ( is_string( $this->model ) && $this->model::has_attribute_alias( $attribute ) ) { + $attribute = $this->model::get_attribute_alias( $attribute ); + } + + if ( ! empty( $this->query_order_by_aliases[ strtolower( $attribute ) ] ) ) { + $attribute = $this->query_order_by_aliases[ strtolower( $attribute ) ]; + } + + $this->order[] = strtoupper( $direction ); + $this->order_by[] = $attribute; + + return $this; + } + + /** + * Alias for `orderBy()`. + * + * @param string $attribute Attribute name. + * @param string $direction Order direction. + */ + public function order_by( string $attribute, string $direction = 'asc' ): static { + return $this->orderBy( $attribute, $direction ); + } + + /** + * Reorder the query and remove existing order by clauses. + */ + public function removeOrder(): static { + $this->order_by = []; + $this->order = []; + + return $this; + } + + /** + * Alias for `removeOrder()`. + */ + public function remove_order(): static { + return $this->removeOrder(); + } + + /** + * Support a dynamic order by (orderByName(...)). + * + * @param string $method Method name. Attribute name. + * @param array $args Method arguments. + * @return static + */ + protected function dynamicOrderBy( string $method, array $args ) { + $attribute = Str::snake( substr( $method, 7 ) ); + + $attribute = str_replace( '_in', '__in', $attribute ); + + return $this->orderBy( $attribute, $args[0] ?? 'asc' ); + } + + /** + * Retrieve the builder order to use in the query. + * + * Used internally to get the order/order by for use in term/post queries. + * Queries support multiple conditions to order by but run into issues in some + * cases where arrays are used in place of strings (post__in for example). To + * support both, we'll store the order/order by as arrays and then flatten it + * here if only one pair is set. + * + * @param string $default_order Default order. + * @param string $default_order_by Default order by. + * @return array{0: string, 1: string} + */ + protected function get_builder_order( string $default_order, string $default_order_by ): array { + $order = count( $this->order ) > 1 ? $this->order : Arr::first( $this->order ); + $order_by = count( $this->order_by ) > 1 ? $this->order_by : Arr::first( $this->order_by ); + + // Provide a default order by if none is set. + if ( empty( $order ) ) { + $order = $default_order; + } + + // Provide a default order by if none is set. + if ( empty( $order_by ) ) { + $order_by = $default_order_by; + } + + return [ $order, $order_by ]; + } + + /** + * Order by the value passed in `whereIn()`. + * + * @param string $attribute Attribute to use. + * @return static + * + * @throws Query_Exception Thrown on unknown alias. + */ + public function orderByWhereIn( string $attribute ) { + if ( is_string( $this->model ) && $this->model::has_attribute_alias( $attribute ) ) { + $attribute = $this->model::get_attribute_alias( $attribute ); + } + + if ( ! empty( $this->query_where_in_aliases[ strtolower( $attribute ) ] ) ) { + $attribute = $this->query_where_in_aliases[ strtolower( $attribute ) ]; + } else { + throw new Query_Exception( 'Unknown where in alias: ' . $attribute ); + } + + return $this->orderBy( $attribute ); + } + + /** + * Alias for `orderByWhereIn()`. + * + * @param string $attribute Attribute to use. + */ + public function order_by_where_in( string $attribute ): static { + return $this->orderByWhereIn( $attribute ); + } + + /** + * Determine if the given model has a scope. + * + * @param string $scope Scope name. + */ + public function has_named_scope( string $scope ): bool { + // Disable model scopes for multi-model queries. + if ( is_array( $this->model ) ) { + return false; + } + + return $this->get_model_instance()->has_named_scope( $scope ); + } + + /** + * Apply the given scope on the current builder instance. + * + * @param callable $scope Scope callback. + * @param array $parameters Scope parameters. + * @return mixed + */ + protected function call_scope( callable $scope, array $parameters = [] ) { + array_unshift( $parameters, $this ); + + return $scope( ...array_values( $parameters ) ) ?? $this; + } + + /** + * Apply the given named scope on the current builder instance. + * + * @param string $scope Scope name. + * @param array $parameters Scope parameters. + * @return mixed + */ + protected function call_named_scope( string $scope, array $parameters = [] ) { + return $this->call_scope( + fn ( ...$parameters) => $this->get_model_instance()->call_named_scope( $scope, $parameters ), + $parameters + ); + } + + /** + * Apply the scopes to the Eloquent builder instance and return it. + * + * @return static + */ + protected function apply_scopes() { + // Ignore query builders across multiple models. + if ( is_array( $this->model ) || empty( $this->scopes ) ) { + return $this; + } + + foreach ( $this->scopes as $scope ) { + $this->call_scope( + function( self $builder ) use ( $scope ) { + if ( $scope instanceof Closure ) { + return $scope( $builder ); + } + + if ( $scope instanceof Scope ) { + return $scope->apply( $builder, $this->get_model_instance() ); + } + } + ); + } + + return $this; + } + + /** + * Register a new global scope. + * + * @param string $identifier Scope name. + * @param Scope|\Closure $scope Scope callback. + * @return static + */ + public function with_global_scope( string $identifier, $scope ) { + $this->scopes[ $identifier ] = $scope; + + return $this; + } + + /** + * Set the limit of objects to include. + * + * @param int $limit Limit to set. + * @return static + */ + public function take( int $limit ) { + $this->limit = $limit; + + return $this; + } + + /** + * Set the current page of the builder. + * + * @param int $page Page to set. + * @return static + */ + public function page( int $page ) { + $this->page = $page; + + return $this; + } + + /** + * Set the page and limit of the builder. + * + * @param int $page Page to set. + * @param int $limit Limit to set. + */ + public function for_page( int $page, int $limit = 20 ): static { + return $this->page( $page )->take( $limit ); + } + + /** + * Constrain the query to the next "page" of results after a given ID. + * + * @param int $per_page Per page to set. + * @param int|null $last_id Last ID to use. + * @param string $column Column to use. + */ + public function for_page_after_id( int $per_page, ?int $last_id = null, string $column = 'id' ): static { + if ( ! is_null( $last_id ) ) { + $this->where_raw( $column, '>', $last_id ); + } + + return $this + ->page( 1 ) // Ensure this query is never paged. + ->removeOrder() + ->orderBy( $column, 'asc' ) + ->take( $per_page ); + } + + /** + * Get the first result of the query. + * + * @return TModel|null + */ + public function first(): ?Model { + return $this->take( 1 )->get()->first(); + } + + /** + * Execute the query and get the first result or throw an exception. + * + * @return TModel|\Mantle\Database\Model\Model + * @throws Model_Not_Found_Exception Throws exception if not found. + * + * @phpstan-return TModel + */ + public function firstOrFail() { + $model = $this->first(); + + if ( ! $model ) { + throw ( new Model_Not_Found_Exception() )->set_model( $this->model ); + } + + return $model; + } + + /** + * Alias for firstOrFail(). + * + * @return TModel|\Mantle\Database\Model\Model + * @throws Model_Not_Found_Exception Throws exception if not found. + * + * @phpstan-return TModel + */ + public function first_or_fail() { + return $this->firstOrFail(); + } + + /** + * Get all the results of a query. + * + * @return Collection + */ + public function all(): Collection { + return $this->take( -1 )->get(); + } + + /** + * Delete the results of this query. + * + * @param bool $force Flag to force delete. + */ + public function delete( bool $force = false ): void { + $this->all()->each->delete( $force ); // @phpstan-ignore-line undefined method + } + + /** + * Create a simple paginator instance for the current query. + * + * @param int $per_page Items per page. + * @param int $current_page Current page number. + */ + public function simple_paginate( int $per_page = 20, int $current_page = null ): PaginatorContract { + return Container::get_instance()->make( + Paginator::class, + [ + 'builder' => $this, + 'current_page' => $current_page, + 'per_page' => $per_page, + ] + ); + } + + /** + * Create a length-aware paginator instance for the current query. + * + * @param int $per_page Items per page. + * @param int $current_page Current page number. + */ + public function paginate( int $per_page = 20, int $current_page = null ): PaginatorContract { + return Container::get_instance()->make( + Length_Aware_Paginator::class, + [ + 'builder' => $this, + 'current_page' => $current_page, + 'per_page' => $per_page, + ] + ); + } + + /** + * Chunk the results of the query. + * + * Note: this method uses pagination and not suited for operations where + * data would be deleted which would affect subsequent pagination. For those + * operations, use the {@see Builder::chunk_by_id()} method. + * + * @param int $count Number of items to chunk by. + * @param callable(\Mantle\Support\Collection<int, TModel>, int): mixed $callback Callback to run on each chunk. + */ + public function chunk( int $count, callable $callback ): bool { + $page = 1; + + do { + $results = $this->page( $page )->take( $count )->get(); + + $count_results = $results->count(); + + if ( 0 === $count_results ) { + return true; + } + + // If the callback returns false, we'll stop traversing the results and + // return false from the chunk method. This is useful for selectively + // breaking the iteration when the callback no longer needs more data. + if ( false === $callback( $results, $page ) ) { + return false; + } + + $page++; + } while ( $count_results === $count ); + + return true; + } + + /** + * Chunk the results of the query by ID. + * + * This query handles chunking data where the data is could be + * deleted/modified during the chunking process. + * + * @param int $count Number of items to chunk by. + * @param callable(\Mantle\Support\Collection<int, TModel>, int): mixed $callback Callback to run on each chunk. + * @param string $attribute Attribute to chunk by. + */ + public function chunk_by_id( int $count, callable $callback, string $attribute = 'id' ): bool { + $last_id = null; + $page = 1; + + do { + $clone = clone $this; + + $results = $clone->for_page_after_id( $count, $last_id, $attribute )->get(); + + $count_results = $results->count(); + + if ( 0 === $count_results ) { + return true; + } + + // If the callback returns false, we'll stop traversing the results and + // return false from the chunk method. This is useful for selectively + // breaking the iteration when the callback no longer needs more data. + if ( false === $callback( $results, $page ) ) { + return false; + } + + $page++; + + // Get the last item in the results. + $last_item = $results->last(); + + // Get the last item's ID. + $last_id = $last_item->{$attribute}; + + // Free up memory. + unset( $clone, $results ); + } while ( $count_results === $count ); + + return true; + } + + /** + * Execute a callback over each item while chunking. + * + * @param callable(TModel): mixed $callback Callback to run on each chunk. + * @param int $count Number of items to chunk by. + * @return boolean + */ + public function each( callable $callback, int $count = 100 ) { + return $this->chunk( $count, function ( Collection $results ) use ( $callback ): bool { + foreach ( $results as $result ) { + if ( false === $callback( $result ) ) { + return false; + } + } + + return true; + } ); + } + + /** + * Execute a callback over each item while chunking by ID. + * + * @param callable(TModel): mixed $callback Callback to run on each chunk. + * @param int $count Number of items to chunk by. + * @param string $attribute Attribute to chunk by. + * @return boolean + */ + public function each_by_id( callable $callback, int $count = 100, string $attribute = 'id' ) { + return $this->chunk_by_id( $count, function ( Collection $results ) use ( $callback ): bool { + foreach ( $results as $result ) { + if ( false === $callback( $result ) ) { + return false; + } + } + + return true; + }, $attribute ); + } + + /** + * Map the query results to a new collection. + * + * @template TMapValue + * + * @param callable(TModel): TMapValue $callback Callback to run on each chunk. + * @param int $count Number of items to chunk by. + * @return Collection<int, TMapValue> + */ + public function map( callable $callback, int $count = 100 ) { + $results = new Collection(); + + $this->chunk( $count, function ( Collection $items ) use ( $callback, $results ): bool { + $results->push( ...$items->map( $callback ) ); + + return true; + } ); + + return $results; + } + + /** + * Magic method to proxy to the appropriate query method. + * + * @param string $method Method name. + * @param array $args Method arguments. + * @return mixed + * + * @throws Query_Exception Unknown query method called. + */ + public function __call( $method, $args ) { + if ( Str::starts_with( $method, 'where' ) ) { + return $this->dynamicWhere( $method, $args ); + } + + if ( Str::starts_with( $method, 'orderBy' ) ) { + return $this->dynamicOrderBy( $method, $args ); + } + + // Check if the model has a local/named scope. + if ( $this->has_named_scope( $method ) ) { + return $this->call_named_scope( $method, $args ); + } + + throw new Query_Exception( 'Unknown query builder method: ' . $method ); + } + + /** + * Collect all the model object names in an associative Collection. + * + * @return Collection<string, class-string<\Mantle\Database\Model\Model>> Collection of model class names keyed by object name. + */ + public function get_model_object_names(): Collection { + return ( new Collection( (array) $this->model ) ) // @phpstan-ignore-line should return + ->combine( $this->model ) + ->map( + fn ( $model ) => $model::get_object_name(), + ) + ->flip(); + } + + /** + * Retrieve the hash of the query object. + */ + public function get_query_hash(): string { + return $this->query_hash; + } + + /** + * Begin a query with eager loading. + * + * @param string ...$relations Relations to eager load. + * @return static + */ + public function with( ...$relations ) { + $this->eager_load = array_merge( $this->eager_load, $relations ); + return $this; + } + + /** + * Begin a query without eager loading relationships. + * + * @param string ...$relations Relations to not eager load. + * @return static + */ + public function without( ...$relations ) { + $this->eager_load = array_diff_key( $this->eager_load, array_flip( $relations ) ); + return $this; + } + + /** + * Dump the query variables being passed to WP_Query. + */ + public function dump(): static { + dump( $this->get_query_args() ); + + return $this; + } + + /** + * Dump the query variables being passed to WP_Query and die. + */ + public function dd(): void { + $this->dump(); + die; + } + + /** + * Check if any models are found for the current query. + */ + public function exists(): bool { + return $this->count() > 0; + } + + /** + * Check if no models are found for the current query. + */ + public function doesntExist(): bool { + return ! $this->exists(); + } + + /** + * Alias for `doesntExists()`. + */ + public function doesnt_exist(): bool { + return $this->doesntExist(); + } +} diff --git a/vendor/mantle-framework/database/query/class-collection.php b/vendor/mantle-framework/database/query/class-collection.php new file mode 100644 index 00000000..6374e4c1 --- /dev/null +++ b/vendor/mantle-framework/database/query/class-collection.php @@ -0,0 +1,185 @@ +<?php +/** + * Collection class file + * + * phpcs:disable Generic.Functions.OpeningFunctionBraceKernighanRitchie.ContentAfterBrace + * + * @package Mantle + */ + +namespace Mantle\Database\Query; + +use Mantle\Database\Model\Model; +use Mantle\Support\Collection as Base_Collection; + +/** + * Database Query Collection + * + * @template TKey of array-key + * @template TModel of \Mantle\Database\Model\Model + * + * @extends \Mantle\Support\Collection<TKey, TModel> + */ +class Collection extends Base_Collection { + /** + * Total number of rows found for the query. + */ + public ?int $found_rows = null; + + /** + * Set the total number of rows found for the query. + * + * @param int|null $found_rows Total number of rows found for the query. + */ + public function with_found_rows( ?int $found_rows ): static { + $this->found_rows = $found_rows; + + return $this; + } + + /** + * Get the total number of rows found for the query. + */ + public function found_rows(): ?int { + return $this->found_rows; + } + + /** + * Retrieve the models in the collection. + * + * @return \Mantle\Support\Collection<int, class-string<TModel>> + */ + public function models(): Base_Collection { + return $this->map( fn ( $model ) => $model::class )->values()->unique(); + } + + /** + * Run a map over each of the items. + * + * @template TMapValue + * + * @param callable(TModel, TKey): TMapValue $callback The callback to run. + * @return \Mantle\Support\Collection<TKey, TMapValue>|static<TKey, TMapValue> + */ + public function map( callable $callback ) { + $result = parent::map( $callback ); + + if ( $result instanceof self ) { + $result->with_found_rows( $this->found_rows ); + } + + return $result->contains( fn ( $item ) => ! $item instanceof Model ) + ? $result->to_base() + : $result; + } + + /** + * Run an associative map over each of the items. + * + * The callback should return an associative array with a single key/value pair. + * + * @template TMapWithKeysKey of array-key + * @template TMapWithKeysValue + * + * @param callable(TModel, TKey): array<TMapWithKeysKey, TMapWithKeysValue> $callback The callback to run. + * @return \Mantle\Support\Collection<TMapWithKeysKey, TMapWithKeysValue>|static<TMapWithKeysKey, TMapWithKeysValue> + */ + public function map_with_keys( callable $callback ) { + $result = parent::map_with_keys( $callback ); + + if ( $result instanceof self ) { + $result->with_found_rows( $this->found_rows ); + } + + return $result->contains( fn ( $item ) => ! $item instanceof Model ) + ? $result->to_base() + : $result; + } + + /** + * The following methods are intercepted to always return base collections. + */ + + /** + * Count the number of items in the collection by a field or using a callback. + * + * @param (callable(TModel, TKey): array-key)|string|null $count_by + * @return \Mantle\Support\Collection<array-key, int> + */ + public function count_by( $count_by = null ) { + return $this->to_base()->count_by( $count_by ); + } + + /** + * Collapse the collection of items into a single array. + * + * @return \Mantle\Support\Collection<int, mixed> + */ + public function collapse() { + return $this->to_base()->collapse(); + } + + /** + * Get a flattened array of the items in the collection. + * + * @param int|float $depth + * @return \Mantle\Support\Collection<int, mixed> + */ + public function flatten( $depth = INF ) { + return $this->to_base()->flatten( $depth ); + } + + /** + * Flip the items in the collection. + * + * @return \Mantle\Support\Collection<int|string, TKey> + */ + public function flip() { + return $this->to_base()->flip(); + } + + /** + * Get the keys of the collection items. + * + * @return \Mantle\Support\Collection<int, TKey> + */ + public function keys() { + return $this->to_base()->keys(); + } + + /** + * Pad collection to the specified length with a value. + * + * @template TPadValue + * + * @param int $size + * @param TPadValue $value + * @return \Mantle\Support\Collection<int, TModel|TPadValue> + */ + public function pad( $size, $value ) { + return $this->to_base()->pad( $size, $value ); + } + + /** + * Get an array with the values of a given key. + * + * @param string|array<array-key, string> $value + * @param string|null $key + * @return \Mantle\Support\Collection<array-key, mixed> + */ + public function pluck( $value, $key = null ) { + return $this->to_base()->pluck( $value, $key ); + } + + /** + * Zip the collection together with one or more arrays. + * + * @template TZipValue + * + * @param \Mantle\Contracts\Support\Arrayable<array-key, TZipValue>|iterable<array-key, TZipValue> ...$items + * @return static<int, static<TKey, TModel|TZipValue>> + */ + public function zip( ...$items ) { // @phpstan-ignore-line return + return $this->to_base()->zip( ...$items ); + } +} diff --git a/vendor/mantle-framework/database/query/class-post-query-builder.php b/vendor/mantle-framework/database/query/class-post-query-builder.php new file mode 100644 index 00000000..51580df3 --- /dev/null +++ b/vendor/mantle-framework/database/query/class-post-query-builder.php @@ -0,0 +1,348 @@ +<?php +/** + * Post_Query_Builder class file. + * + * @package Mantle + * + * @phpcs:disable Squiz.Commenting.FunctionComment + */ + +namespace Mantle\Database\Query; + +use Mantle\Database\Model\Term; +use Mantle\Database\Query\Concerns\Queries_Dates; +use Mantle\Support\Helpers; +use RuntimeException; +use WP_Term; + +use function Mantle\Support\Helpers\collect; + +/** + * Post Query Builder + * + * @template TModel of \Mantle\Database\Model\Model + * @extends \Mantle\Database\Query\Builder<TModel> + * + * @method \Mantle\Database\Query\Post_Query_Builder<TModel> anyStatus() + * @method \Mantle\Database\Query\Post_Query_Builder<TModel> whereId( int $id ) + * @method \Mantle\Database\Query\Post_Query_Builder<TModel> whereName( string $name ) + * @method \Mantle\Database\Query\Post_Query_Builder<TModel> whereSlug( string $slug ) + * @method \Mantle\Database\Query\Post_Query_Builder<TModel> whereStatus( string[]|string $status ) + * @method \Mantle\Database\Query\Post_Query_Builder<TModel> whereTitle( string $title ) + * @method \Mantle\Database\Query\Post_Query_Builder<TModel> whereType( string $type ) + */ +class Post_Query_Builder extends Builder { + use Queries_Dates, Queries_Relationships; + + /** + * Query Variable Aliases + */ + protected array $query_aliases = [ + 'date_gmt' => 'post_date_gmt', + 'date_utc' => 'post_date_gmt', + 'date' => 'post_date', + 'id' => 'p', + 'modified_gmt' => 'post_modified_gmt', + 'modified_utc' => 'post_modified_gmt', + 'modified' => 'post_modified', + 'post_author' => 'author', + 'post_name' => 'name', + 'slug' => 'name', + 'status' => 'post_status', + ]; + + /** + * Query Where In Aliases + */ + protected array $query_where_in_aliases = [ + 'author' => 'author__in', + 'id' => 'post__in', + 'post_name' => 'post_name__in', + 'post_parent' => 'post_parent__in', + 'tag' => 'tag__in', + 'tag_slug' => 'tag_slug__in', + ]; + + /** + * Query Where Not In Aliases + */ + protected array $query_where_not_in_aliases = [ + 'author' => 'author__not_in', + 'id' => 'post__not_in', + 'post_name' => 'post_name__not_in', + 'post_parent' => 'post_parent__not_in', + 'tag' => 'tag__not_in', + 'tag_slug' => 'tag_slug__not_in', + ]; + + /** + * Query order by aliases. + */ + protected array $query_order_by_aliases = [ + 'id' => 'ID', + ]; + + /** + * Tax Query. + */ + protected array $tax_query = []; + + /** + * Get the query arguments. + */ + public function get_query_args(): array { + $this->apply_scopes(); + + if ( is_array( $this->model ) ) { + $post_type = []; + + foreach ( $this->model as $model ) { + $post_type[] = $model::get_object_name(); + } + } else { + $post_type = $this->model::get_object_name(); + } + + [ $order, $order_by ] = $this->get_builder_order( 'DESC', 'date' ); + + return array_merge( + [ + 'ignore_sticky_posts' => true, + 'meta_query' => $this->meta_query, // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query + 'order' => $order, + 'orderby' => $order_by, + 'paged' => $this->page, + 'post_type' => $post_type, + 'posts_per_page' => $this->limit, + 'suppress_filters' => false, + 'tax_query' => $this->tax_query, // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query + ], + $this->get_date_query_args(), + $this->wheres, + [ + 'fields' => 'ids', + ] + ); + } + + /** + * Execute the query. + * + * @return Collection<int, TModel> + */ + public function get(): Collection { + $query = new \WP_Query(); + + // Store the query hash for reference by side-effects. + $this->query_hash = spl_object_hash( $query ); + + $this->with_clauses( + fn () => $query->query( $this->get_query_args() ), + ); + + if ( empty( $query->found_posts ) && count( $query->posts ) > 0 ) { + $this->found_rows = null; + } else { + $this->found_rows = $query->found_posts; + } + + $post_ids = $query->posts; + + if ( empty( $post_ids ) ) { + return ( new Collection() )->with_found_rows( $this->found_rows ); // @phpstan-ignore-line should return + } + + $models = $this + ->get_models( $post_ids ) + ->with_found_rows( $this->found_rows ); + + // Return the models if there are no models or if multiple model instances + // are used. Eager loading does not currently support multiple models. + if ( $models->is_empty() || is_array( $this->model ) || empty( $this->eager_load ) ) { + return $models; + } + + return $this->eager_load_relations( $models ); + } + + /** + * Get the count of the query results. + */ + public function count(): int { + $this->take( -1 ); + + $query = new \WP_Query(); + + // Store the query hash for reference by side-effects. + $this->query_hash = spl_object_hash( $query ); + + $this->with_clauses( + fn () => $query->query( $this->get_query_args() ), + ); + + return $query->found_posts; + } + + /** + * Retrieve hydrated models for the post IDs. + * + * @param int[] $post_ids Post IDs. + * @return Collection<int, TModel> + */ + protected function get_models( array $post_ids ): Collection { + if ( is_array( $this->model ) ) { + $model_object_types = $this->get_model_object_names(); + + return Collection::from( $post_ids ) + ->map( + function ( $post_id ) use ( $model_object_types ) { + $post_type = \get_post_type( $post_id ); + + if ( empty( $model_object_types[ $post_type ] ) ) { + throw new RuntimeException( + "Missing model for object type [{ $post_type }]." + ); + } + + if ( empty( $post_type ) ) { + return null; + } + + return $model_object_types[ $post_type ]::find( $post_id ); + } + ) + ->filter() + ->values(); + } + + return Collection::from( $post_ids ) + ->map( [ $this->model, 'find' ] ) + ->filter(); + } + + /** + * Include a taxonomy query. + * + * @param array|string|Term|\WP_Term|int $term Term ID/array of IDs. + * @param string $taxonomy Taxonomy name. + * @param string $operator Operator to use, defaults to 'IN'. + * @param string $field Field to use for the query, defaults to term ID. + * @return static + * + * @throws Query_Exception Unknown term to query against. + */ + public function whereTerm( $term, $taxonomy = null, string $operator = 'IN', string $field = 'term_id' ) { + if ( $term instanceof Term ) { + $taxonomy = $term->taxonomy(); + $term = $term->id(); + } + + if ( $term instanceof \WP_Term ) { + $taxonomy = $term->taxonomy; + $term = $term->term_id; + } + + // Get the taxonomy if it wasn't passed. + if ( empty( $taxonomy ) && ! is_array( $term ) ) { + // Attempt to resolve the term from the slug. + if ( 'slug' === $field ) { + $object = get_term_by( 'slug', $term, $taxonomy ); + + if ( ! ( $object instanceof WP_Term ) ) { + throw new Query_Exception( 'Unknown term to query against with slug (must pass taxonomy): ' . $term ); + } + } else { + $object = Helpers\get_term_object( (int) $term ); + } + + if ( empty( $object ) ) { + throw new Query_Exception( 'Unknown term: ' . $term ); + } + + $taxonomy = $object->taxonomy; + $term = $object->term_id; + } + + $this->tax_query[] = [ + 'field' => $field, + 'include_children' => true, + 'operator' => $operator, + 'taxonomy' => $taxonomy, + 'terms' => $term, + ]; + + return $this; + } + + /** + * Include a taxonomy query with the relation set to 'AND'. + * + * @param array|string $term Term ID/array of IDs. + * @param string $taxonomy Taxonomy name. + * @param string $operator Operator to use, defaults to 'IN'. + * @return static + */ + public function andWhereTerm( ...$args ) { + $this->tax_query['relation'] = 'AND'; + return $this->whereTerm( ...$args ); + } + + /** + * Include a taxonomy query with the relation set to 'OR'. + * + * @param array|string $term Term ID/array of IDs. + * @param string $taxonomy Taxonomy name. + * @param string $operator Operator to use, defaults to 'IN'. + * @return static + */ + public function orWhereTerm( ...$args ) { + $this->tax_query['relation'] = 'OR'; + return $this->whereTerm( ...$args ); + } + + /** + * Fetch the query with 'no_found_rows' set to a value. + * + * Setting to 'true' prevents counting all the available rows for a query. + * + * @param bool $value Whether to set 'no_found_rows' to true. + */ + public function withNoFoundRows( bool $value = true ): static { + return $this->where( 'no_found_rows', $value ); + } + + /** + * Dump the SQL query being executed. + * + * @param bool $die Whether to die after dumping the SQL. + */ + public function dumpSql( bool $die = false ): static { + add_filter( + 'posts_request', + function ( string $sql, \WP_Query $query ) use ( $die ) { + if ( spl_object_hash( $query ) === $this->query_hash ) { + dump( $sql ); + + if ( $die ) { + die; + } + } + + return $sql; + }, + 10, + 2 + ); + + return $this; + } + + /** + * Dump the SQL query being executed and die. + */ + public function ddSql(): never { + $this->dumpSql( true )->get(); + + die( 1 ); + } +} diff --git a/vendor/mantle-framework/database/query/class-query-exception.php b/vendor/mantle-framework/database/query/class-query-exception.php new file mode 100644 index 00000000..7e267cbd --- /dev/null +++ b/vendor/mantle-framework/database/query/class-query-exception.php @@ -0,0 +1,15 @@ +<?php +/** + * Query_Exception class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Query; + +use Exception; + +/** + * Query Exception + */ +class Query_Exception extends Exception { } diff --git a/vendor/mantle-framework/database/query/class-term-query-builder.php b/vendor/mantle-framework/database/query/class-term-query-builder.php new file mode 100644 index 00000000..2f9b1ec1 --- /dev/null +++ b/vendor/mantle-framework/database/query/class-term-query-builder.php @@ -0,0 +1,181 @@ +<?php +/** + * Term_Query_Builder class file. + * + * @package Mantle + */ + +namespace Mantle\Database\Query; + +/** + * Term Query Builder + * + * @template TModel of \Mantle\Database\Model\Model + * @extends \Mantle\Database\Query\Builder<TModel> + * + * @method \Mantle\Database\Query\Term_Query_Builder whereId( int $id ) + * @method \Mantle\Database\Query\Term_Query_Builder whereName( string $name ) + * @method \Mantle\Database\Query\Term_Query_Builder whereSlug( string $slug ) + * @method \Mantle\Database\Query\Term_Query_Builder whereTaxonomy( string $taxonomy ) + */ +class Term_Query_Builder extends Builder { + use Queries_Relationships; + + /** + * Query Variable Aliases + */ + protected array $query_aliases = [ + 'id' => 'include', + 'term_id' => 'include', + ]; + + /** + * Query Where In Aliases + */ + protected array $query_where_in_aliases = [ + 'term_id' => 'include', + 'name' => 'name', + 'slug' => 'slug', + ]; + + /** + * Query Where Not In Aliases + */ + protected array $query_where_not_in_aliases = [ + 'name' => 'name', + 'slug' => 'slug', + 'term_id' => 'exclude', + ]; + + /** + * Query order by aliases. + */ + protected array $query_order_by_aliases = [ + 'id' => 'term_id', + ]; + + /** + * Get the query arguments. + */ + public function get_query_args(): array { + if ( is_array( $this->model ) ) { + $taxonomies = []; + + foreach ( $this->model as $model ) { + $taxonomies[] = $model::get_object_name(); + } + } else { + $taxonomies = $this->model::get_object_name(); + } + + // Limit is handled differently for term queries. + if ( -1 === $this->limit ) { + $this->limit = null; + } + + [ $order, $order_by ] = $this->get_builder_order( 'ASC', 'name' ); + + return array_merge( + [ + 'hide_empty' => false, + 'meta_query' => $this->meta_query, // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query + 'number' => $this->limit, + 'order' => $order, + 'orderby' => $order_by, + 'suppress_filter' => false, + 'taxonomy' => $taxonomies, + ], + $this->wheres, + [ + 'fields' => 'ids', + ] + ); + } + + /** + * Execute the query. + * + * @return Collection<int, TModel> + */ + public function get(): Collection { + $query = new \WP_Term_Query(); + + $this->query_hash = spl_object_hash( $query ); + + /** + * Fetch the terms IDs for the query. + * + * @var int[] + */ + $term_ids = $this->with_clauses( + fn (): array => $query->query( $this->get_query_args() ), + ); + + if ( empty( $term_ids ) ) { + return new Collection(); // @phpstan-ignore-line should return + } + + $models = array_map( [ $this->model, 'find' ], $term_ids ); + + return $this->eager_load_relations( + Collection::from( $models )->filter()->values(), + ); + } + + /** + * Get the count of the query results. + */ + public function count(): int { + $this->take( -1 ); + + $query = new \WP_Term_Query(); + + $this->query_hash = spl_object_hash( $query ); + + return $this->with_clauses( + fn (): int => (int) $query->query( + array_merge( + $this->get_query_args(), + [ + 'fields' => 'count', + ], + ), + ), + ); + } + + /** + * Dump the SQL query being executed. + * + * @param bool $die Whether to die after dumping the SQL. + */ + public function dumpSql( bool $die = false ): static { + add_filter( + 'terms_pre_query', + function ( mixed $terms, \WP_Term_Query $query ) use ( $die ) { + if ( spl_object_hash( $query ) === $this->query_hash ) { + dump( $query->request ); + + if ( $die ) { + die; + } + } + + return $terms; + }, + 10, + 2 + ); + + return $this; + } + + /** + * Dump the SQL query being executed and die. + */ + public function ddSql(): never { + $this->dumpSql( true )->get(); + + die( 1 ); + } +} diff --git a/vendor/mantle-framework/database/query/concerns/trait-queries-dates.php b/vendor/mantle-framework/database/query/concerns/trait-queries-dates.php new file mode 100644 index 00000000..49c05f53 --- /dev/null +++ b/vendor/mantle-framework/database/query/concerns/trait-queries-dates.php @@ -0,0 +1,285 @@ +<?php +/** + * Queries_Dates trait file + * + * phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid + * + * @package Mantle + */ + +namespace Mantle\Database\Query\Concerns; + +use Carbon\Carbon; +use DateTimeInterface; +use InvalidArgumentException; + +/** + * Logic to query posts by dates. + * + * @link https://developer.wordpress.org/reference/classes/wp_query/#date-parameters + * + * @todo Add support for more complex date queries (mixing AND/OR, etc.). + * + * @mixin \Mantle\Database\Query\Post_Query_Builder + */ +trait Queries_Dates { + /** + * Date constraints to apply to the query. + * + * @var array<int, array{date: DateTimeInterface|int|string, compare: string, column: string}> + */ + protected array $date_constraints = []; + + /** + * The valid comparison operators for a date query. + */ + protected array $date_operators = [ + '=', + '!=', + '>', + '>=', + '<', + '<=', + ]; + + /** + * Add a date query for a date to the query. + * + * Defaults to comparing against the post published date. + * + * @throws InvalidArgumentException If an invalid comparison operator is provided. + * + * @param DateTimeInterface|int|string $date + * @param string $compare Comparison operator, defaults to '='. + * @param string $column Column to compare against, defaults to 'post_date'. + */ + public function whereDate( DateTimeInterface|int|string $date, string $compare = '=', string $column = 'post_date' ): static { + if ( ! in_array( $compare, $this->date_operators, true ) ) { + throw new InvalidArgumentException( 'Invalid date comparison operator: ' . $compare ); + } + + $this->date_constraints[] = compact( 'date', 'compare', 'column' ); + + return $this; + } + + /** + * Add a date query for the UTC publish date to the query. + * + * @param DateTimeInterface|int|string $date Date to compare against. + * @param string $compare Comparison operator, defaults to '='. + */ + public function whereUtcDate( DateTimeInterface|int|string $date, string $compare = '=' ): static { + return $this->whereDate( $date, $compare, 'post_date_gmt' ); + } + + /** + * Add a date query for the modified date to the query. + * + * @param DateTimeInterface|int|string $date Date to compare against. + * @param string $compare Comparison operator, defaults to '='. + */ + public function whereModifiedDate( DateTimeInterface|int|string $date, string $compare = '=' ): static { + return $this->whereDate( $date, $compare, 'post_modified' ); + } + + /** + * Add a date query for the modified UTC date to the query. + * + * @param DateTimeInterface|int|string $date Date to compare against. + * @param string $compare Comparison operator, defaults to '='. + */ + public function whereModifiedUtcDate( DateTimeInterface|int|string $date, string $compare = '=' ): static { + return $this->whereDate( $date, $compare, 'post_modified_gmt' ); + } + + /** + * Query for objects older than the given date. + * + * @param DateTimeInterface|int $date Date to compare against. + * @param string $column Column to compare against. + */ + public function olderThan( DateTimeInterface|int $date, string $column = 'post_date' ): static { + return $this->whereDate( $date, '<', $column ); + } + + /** + * Query for objects older than or equal to the given date. + * + * @param DateTimeInterface|int $date Date to compare against. + * @param string $column Column to compare against. + */ + public function olderThanOrEqualTo( DateTimeInterface|int $date, string $column = 'post_date' ): static { + return $this->whereDate( $date, '<=', $column ); + } + + /** + * Query for objects older than or equal to now. + * + * @param string $column Column to compare against. + */ + public function olderThanNow( string $column = 'post_date' ): static { + return $this->olderThanOrEqualTo( now(), $column ); + } + + /** + * Alias for olderThan(). + * + * @param DateTimeInterface|int $date Date to compare against. + * @param string $column Column to compare against. + */ + public function older_than( DateTimeInterface|int $date, string $column = 'post_date' ): static { + return $this->olderThan( $date, $column ); + } + + /** + * Alias for olderThanOrEqualTo(). + * + * @param DateTimeInterface|int $date Date to compare against. + * @param string $column Column to compare against. + */ + public function older_than_or_equal_to( DateTimeInterface|int $date, string $column = 'post_date' ): static { + return $this->whereDate( $date, '<=', $column ); + } + + /** + * Query for objects newer than the given date. + * + * @param DateTimeInterface|int $date + * @param string $column Column to compare against. + */ + public function newerThan( DateTimeInterface|int $date, string $column = 'post_date' ): static { + return $this->whereDate( $date, '>', $column ); + } + + /** + * Query for objects newer than now (in the future from now). + * + * @param string $column Column to compare against. + */ + public function newerThanNow( string $column = 'post_date' ): static { + return $this->newerThan( now(), $column ); + } + + /** + * Query for objects newer than or equal to the given date. + * + * @param DateTimeInterface|int $date + * @param string $column Column to compare against. + */ + public function newerThanOrEqualTo( DateTimeInterface|int $date, string $column = 'post_date' ): static { + return $this->whereDate( $date, '>=', $column ); + } + + /** + * Alias for newerThan(). + * + * @param DateTimeInterface|int $date Date to compare against. + * @param string $column Column to compare against. + */ + public function newer_than( DateTimeInterface|int $date, string $column = 'post_date' ): static { + return $this->newerThan( $date, $column ); + } + + /** + * Alias for newerThanOrEqualTo(). + * + * @param DateTimeInterface|int $date Date to compare against. + * @param string $column Column to compare against. + */ + public function newer_than_or_equal_to( DateTimeInterface|int $date, string $column = 'post_date' ): static { + return $this->newerThanOrEqualTo( $date, $column ); + } + + /** + * Calculate the arguments for the date query to pass to either WP_Query. + */ + protected function get_date_query_args(): array { + if ( empty( $this->date_constraints ) ) { + return []; + } + + $date_query = []; + + foreach ( $this->date_constraints as $date_constraint ) { + $date = $date_constraint['date']; + + if ( is_int( $date ) ) { + $date = Carbon::createFromTimestamp( $date, wp_timezone() ); + } elseif ( is_string( $date ) ) { + $date = Carbon::parse( $date, wp_timezone() ); + } elseif ( $date instanceof DateTimeInterface ) { + $date = Carbon::instance( $date ); + } + + switch ( $date_constraint['compare'] ) { + case '<': + $date_query[] = [ + 'column' => $date_constraint['column'], + 'before' => $date->toDateTimeString(), + ]; + break; + + case '<=': + $date_query[] = [ + 'column' => $date_constraint['column'], + 'before' => $date->toDateTimeString(), + 'inclusive' => true, + ]; + break; + + case '>': + $date_query[] = [ + 'column' => $date_constraint['column'], + 'after' => $date->toDateTimeString(), + ]; + break; + + case '>=': + $date_query[] = [ + 'column' => $date_constraint['column'], + 'after' => $date->toDateTimeString(), + 'inclusive' => true, + ]; + break; + + // TODO: Review if a query for a specific date can be improved. + case '=': + $date_query[] = [ + 'relation' => 'and', + [ + 'column' => $date_constraint['column'], + 'before' => $date->toDateTimeString(), + 'inclusive' => true, + ], + [ + 'column' => $date_constraint['column'], + 'after' => $date->toDateTimeString(), + 'inclusive' => true, + ], + ]; + break; + + case '!=': + $date_query[] = [ + 'relation' => 'or', + [ + 'column' => $date_constraint['column'], + 'before' => $date->toDateTimeString(), + 'inclusive' => false, + ], + [ + 'column' => $date_constraint['column'], + 'after' => $date->toDateTimeString(), + 'inclusive' => false, + ], + ]; + break; + } + } + + return [ + 'date_query' => $date_query, + ]; + } +} diff --git a/vendor/mantle-framework/database/query/concerns/trait-query-bindings.php b/vendor/mantle-framework/database/query/concerns/trait-query-bindings.php new file mode 100644 index 00000000..fadb1160 --- /dev/null +++ b/vendor/mantle-framework/database/query/concerns/trait-query-bindings.php @@ -0,0 +1,205 @@ +<?php +/** + * Query_Bindings trait file + * + * phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid + * + * @package Mantle + */ + +namespace Mantle\Database\Query\Concerns; + +use InvalidArgumentException; + +use function Mantle\Support\Helpers\collect; + +/** + * Allow a query to use raw bindings in a controlled manner. + * + * @todo Add nested queries. + * + * @mixin \Mantle\Database\Query\Builder + */ +trait Query_Bindings { + /** + * Raw query bindings. + */ + protected array $bindings = [ + 'where' => [], + ]; + + /** + * The valid operators for a raw query binding. + */ + protected array $operators = [ + '=', + '!=', + '>', + '>=', + '<', + '<=', + 'LIKE', + 'NOT LIKE', + 'IN', + 'NOT IN', + ]; + + /** + * Flag to indicate if a raw query clause has been added. + */ + protected bool $raw_query_clause_added = false; + + /** + * Add a raw query binding. + * + * Allows the query to be built with raw SQL bindings. + * + * @param array|string $column The column name or array of bindings. + * @param string|null $operator The operator OR the value if no value is provided. + * @param mixed $value The value. + * @param string $boolean The boolean operator (AND/OR) used to concatenate the clause. + */ + public function where_raw( array|string $column, ?string $operator = null, mixed $value = null, string $boolean = 'AND' ): static { + if ( is_array( $column ) ) { + foreach ( $column as $value ) { + $this->where_raw( ...array_values( $value ) ); + } + + return $this; + } + + if ( is_null( $value ) && ! is_null( $operator ) ) { + $value = $operator; + $operator = '='; + } + + $this->bindings['where'][] = [ + 'boolean' => $boolean, + 'column' => $column, + 'operator' => $operator, + 'value' => $value, + ]; + + $this->add_raw_query_clause(); + + return $this; + } + + /** + * Alias for where_raw(). + * + * @param array|string $column The column name or array of bindings. + * @param string|null $operator The operator OR the value if no value is provided. + * @param mixed $value The value. + * @param string $boolean The boolean operator (AND/OR) used to concatenate the clause. + */ + public function whereRaw( array|string $column, ?string $operator = null, mixed $value = null, string $boolean = 'AND' ): static { + return $this->where_raw( $column, $operator, $value, $boolean ); + } + + /** + * Construct a WHERE clause with a boolean OR. + * + * @param array|string $column The column name or array of bindings. + * @param string|null $operator The operator OR the value if no value is provided. + * @param mixed $value The value. + */ + public function or_where_raw( array|string $column, ?string $operator = null, mixed $value = null ): static { + if ( is_array( $column ) ) { + foreach ( $column as $value ) { + $this->or_where_raw( ...array_values( $value ) ); + } + + return $this; + } + + return $this->where_raw( $column, $operator, $value, 'OR' ); + } + + /** + * Alias for or_where_raw(). + * + * @param array|string $column The column name or array of bindings. + * @param string|null $operator The operator OR the value if no value is provided. + * @param mixed $value The value. + */ + public function orWhereRaw( array|string $column, ?string $operator = null, mixed $value = null ): static { + return $this->or_where_raw( $column, $operator, $value ); + } + + /** + * Add the raw query arguments to the query. + */ + public function add_raw_query_clause(): void { + if ( $this->raw_query_clause_added ) { + return; + } + + $this->add_clause( + fn ( array $clauses, \WP_Query|\WP_Term_Query $query ) => $this->apply_query_bindings( $clauses, $query ) + ); + + $this->raw_query_clause_added = true; + } + + /** + * Apply the query bindings to the clauses of a query. + * + * @throws InvalidArgumentException If the query class is invalid. + * + * @param array $clauses The query clauses. + * @param \WP_Query|\WP_Term_Query $query The query object. + * @return array The modified query clauses. + */ + protected function apply_query_bindings( array $clauses, \WP_Query|\WP_Term_Query $query ): array { + global $wpdb; + + $table = match ( $query::class ) { + \WP_Query::class => $wpdb->posts, + \WP_Term_Query::class => $wpdb->terms, + default => throw new InvalidArgumentException( 'Invalid query class: ' . $query::class ), + }; + + foreach ( $this->bindings['where'] as $binding ) { + $clauses['where'] .= $this->get_where_clause( $table, $binding ); + } + + return $clauses; + } + + /** + * Get the where clause for a binding. + * + * @throws InvalidArgumentException If the operator is invalid. + * + * @param string $table The table name. + * @param array $binding The binding. + * @return string The where clause. + */ + protected function get_where_clause( string $table, array $binding ): string { + global $wpdb; + + $boolean = $binding['boolean']; + $column = $binding['column']; + $operator = $binding['operator']; + $value = $binding['value']; + + if ( ! in_array( $operator, $this->operators, true ) ) { + throw new InvalidArgumentException( "Invalid operator for raw query binding: {$operator}" ); + } + + // Handle an array of values, commonly used with IN/NOT IN. + if ( is_array( $value ) ) { + $value = collect( $value ) + ->map( 'esc_sql' ) + ->implode( ', ' ); + + return " {$boolean} {$table}.{$column} {$operator} ({$value})"; + } + + return $wpdb->prepare( + " {$boolean} {$table}.{$column} {$operator} %s", // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared + $value + ); + } +} diff --git a/vendor/mantle-framework/database/query/concerns/trait-query-clauses.php b/vendor/mantle-framework/database/query/concerns/trait-query-clauses.php new file mode 100644 index 00000000..a2a8aa43 --- /dev/null +++ b/vendor/mantle-framework/database/query/concerns/trait-query-clauses.php @@ -0,0 +1,157 @@ +<?php +/** + * Query_Clauses trait file + * + * phpcs:disable Squiz.Commenting.FunctionComment.MissingParamTag, Squiz.Commenting.FunctionComment.ParamNameNoMatch + * + * @package Mantle + */ + +namespace Mantle\Database\Query\Concerns; + +use Mantle\Database\Query\Post_Query_Builder; +use Mantle\Database\Query\Term_Query_Builder; + +/** + * Allow a query to be modified. + * + * Provides an way to modify the subsequent query performed by + * WP_Query/WP_Term_Query/etc. in a controlled manner which will not affect + * other queries. + * + * @mixin \Mantle\Database\Query\Builder + */ +trait Query_Clauses { + /** + * Query clauses to be added to the query. + * + * @var array<int, callable(array<string>, \WP_Query|\WP_Term_Query $query): array<string>> The query clauses. + */ + protected array $clauses = []; + + /** + * Storage of the term query. + */ + protected ?\WP_Term_Query $query_clause_query = null; + + /** + * Add a clause to the query. + * + * @param callable(array<string>, \WP_Query|\WP_Term_Query $query): array<string> $clause The query clause. + */ + public function add_clause( callable $clause ): static { + $this->clauses[] = $clause; + + return $this; + } + + /** + * Remove all clauses from the query. + */ + public function clear_clauses(): static { + $this->clauses = []; + + return $this; + } + + /** + * Apply the query clauses to the query. + * + * @param array<string> $clauses The query clauses. + * @param mixed ...$args Other arguments passed to the filter. + * @return array<string> The modified query clauses. + */ + public function apply_clauses( array $clauses, ...$args ): array { + // Extract the query from the arguments. + $query = $args[0] ?? null; + + if ( is_array( $query ) && isset( $this->query_clause_query ) ) { + $query = $this->query_clause_query; + } + + // Only apply the clauses if the query is set and the query hash matches. + if ( ! $query || spl_object_hash( $query ) !== $this->get_query_hash() ) { + return $clauses; + } + + foreach ( $this->clauses as $clause ) { + $clauses = $clause( $clauses, $query, ...$args ); + } + + return $clauses; + } + + /** + * Register the query clauses before the query is executed. + */ + protected function register_clauses(): void { + if ( $this instanceof Post_Query_Builder ) { + add_filter( 'posts_clauses', [ $this, 'apply_clauses' ], 10, 2 ); + } elseif ( $this instanceof Term_Query_Builder ) { + add_action( 'pre_get_terms', [ $this, 'on_pre_get_terms' ] ); + } + } + + /** + * Unregister the query clauses after the query is executed. + */ + protected function unregister_clauses(): void { + if ( $this instanceof Post_Query_Builder ) { + remove_filter( 'posts_clauses', [ $this, 'apply_clauses' ], 10 ); + } elseif ( $this instanceof Term_Query_Builder ) { + remove_action( 'pre_get_terms', [ $this, 'on_pre_get_terms' ], 10 ); + remove_filter( 'terms_clauses', [ $this, 'apply_clauses' ], 10 ); + + // Reset the query object being stored. + $this->query_clause_query = null; + } + } + + /** + * Execute a callback with the clauses applied only for the closure. + * + * @template TReturnValue + * + * @param callable(): TReturnValue $callback The callback to execute. + * @return TReturnValue The return value of the callback. + */ + protected function with_clauses( callable $callback ): mixed { + // Skip if there are no clauses to apply. + if ( empty( $this->clauses ) ) { + return $callback(); + } + + $this->register_clauses(); + + $result = $callback(); + + $this->unregister_clauses(); + + return $result; + } + + /** + * Register the 'pre_get_terms' listener for a term query. + * + * As a workaround for the lack of query being passed to the 'terms_clauses' + * filter, we use the 'pre_get_terms' filter to register the 'terms_clauses' + * filter and store the query object. + * + * @param \WP_Term_Query $query The term query. + */ + public function on_pre_get_terms( \WP_Term_Query $query ): void { + // Only apply the clauses if the query hash matches. + if ( spl_object_hash( $query ) !== $this->get_query_hash() ) { + return; + } + + // Store the query object. + $this->query_clause_query = $query; + + // Remove the 'pre_get_terms' filter. + remove_action( 'pre_get_terms', [ $this, 'on_pre_get_terms' ] ); + + // Register the 'terms_clauses' filter. + add_filter( 'terms_clauses', [ $this, 'apply_clauses' ], 10, 3 ); + } +} diff --git a/vendor/mantle-framework/database/query/trait-queries-relationships.php b/vendor/mantle-framework/database/query/trait-queries-relationships.php new file mode 100644 index 00000000..18017abe --- /dev/null +++ b/vendor/mantle-framework/database/query/trait-queries-relationships.php @@ -0,0 +1,111 @@ +<?php +/** + * Queries_Relationships trait file. + * + * @package Mantle + */ + +namespace Mantle\Database\Query; + +use Mantle\Database\Model\Relations\Relation; +use Mantle\Support\Collection; + +/** + * Support querying against model relationships. + */ +trait Queries_Relationships { + /** + * Query the existence or a specific value in a model's relationship. + * + * @param string $relation Model relationship. + * @param string $compare Value to compare against, optional. + * + * @throws Query_Exception Thrown on invalid arguments. + */ + public function has( string $relation, string $compare = null ): Builder { + $relation = $this->get_relation( $relation ); + if ( ! $relation ) { + throw new Query_Exception( 'Unknown relation on model: ' . $relation ); + } + + if ( ! method_exists( $relation, 'get_relation_query' ) ) { + throw new Query_Exception( 'Relationship does not support querying against it: ' . $relation::class ); + } + + return $relation->get_relation_query( $this, $compare ); + } + + /** + * Query the non-existence of a model's relationship. + * + * @param string $relation Model relationship. + * @param string $compare Value to compare against, optional. + * @return Builder + * + * @throws Query_Exception Thrown on invalid arguments. + */ + public function doesnt_have( string $relation, string $compare = null ) { + $relation = $this->get_relation( $relation ); + if ( ! $relation ) { + throw new Query_Exception( 'Unknown relation on model: ' . $relation ); + } + + if ( ! method_exists( $relation, 'get_relation_query' ) ) { + throw new Query_Exception( 'Relationship does not support querying against it: ' . $relation::class ); + } + + $comparison = $compare ? '!=' : 'NOT EXISTS'; + return $relation->get_relation_query( $this, $compare, $comparison ); + } + + /** + * Get the model relationship instance. + * + * @param string $relation Relationship name. + */ + protected function get_relation( $relation ): ?Relation { + $model = $this->get_model(); + + if ( is_array( $model ) ) { + return null; + } + + return ( new $model() )->{ $relation }(); + } + + /** + * Eager load relations for a set of models. + * + * @param Collection $models Models to load for. + * @return Collection + */ + protected function eager_load_relations( Collection $models ): Collection { + foreach ( $this->eager_load as $name ) { + $models = $this->eager_load_relation( $models, $name ); + } + + return $models; + } + + /** + * Eager load a relation on a set of models. + * + * @param Collection $models Model instances. + * @param string $name Relation name to eager load. + * @return Collection + */ + protected function eager_load_relation( Collection $models, string $name ) : Collection { + $relation = $this->get_relation( $name ); + + $results = Relation::no_constraints( + function() use ( $models, $relation ) { + // Add the eager constraints from the relation to the query. + $relation->add_eager_constraints( $models ); + + return $relation->get_eager(); + } + ); + + return $relation->match( $models, $results ); + } +} diff --git a/vendor/mantle-framework/events/LICENSE b/vendor/mantle-framework/events/LICENSE new file mode 100644 index 00000000..d159169d --- /dev/null +++ b/vendor/mantle-framework/events/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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. + + <signature of Ty Coon>, 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/vendor/mantle-framework/events/class-dispatcher.php b/vendor/mantle-framework/events/class-dispatcher.php new file mode 100644 index 00000000..a299d639 --- /dev/null +++ b/vendor/mantle-framework/events/class-dispatcher.php @@ -0,0 +1,244 @@ +<?php +/** + * Dispatcher class file. + * + * @package Mantle + * + * @phpcs:disable Squiz.Commenting.FunctionComment + */ + +namespace Mantle\Events; + +use Closure; +use Mantle\Container\Container; +use Mantle\Contracts\Events\Dispatcher as Dispatcher_Contract; +use Mantle\Support\Arr; +use Mantle\Support\Str; + +/** + * Event Dispatcher + * + * @todo Add queued event listeners. + * @todo Add wildcard listeners. + */ +class Dispatcher implements Dispatcher_Contract { + use WordPress_Action; + + /** + * The IoC container instance. + * + * @var Container + */ + protected $container; + + /** + * The queue resolver instance. + * + * @var callable + */ + protected $queue_resolver; + + /** + * Create a new event dispatcher instance. + * + * @param Container|null $container Container instance. + */ + public function __construct( Container $container = null ) { + $this->container = $container ?: new Container(); + } + + /** + * Register an event listener with the dispatcher. + * + * @todo Add wildcard listeners. + * + * @param string|array $events Event(s) to listen to. + * @param mixed $listener Listener to register. + * @param int $priority Event priority. + * @param \Closure|string $listener Listener callback. + */ + public function listen( $events, $listener, int $priority = 10 ): void { + foreach ( (array) $events as $event ) { + add_action( + $event, + $this->make_listener( $listener ), + $priority, + PHP_INT_MAX, + ); + } + } + + /** + * Determine if a given event has listeners. + * + * @param string $event_name Event name. + */ + public function has_listeners( $event_name ): bool { + return has_filter( $event_name ); + } + + /** + * Register an event subscriber with the dispatcher. + * + * @param object|string $subscriber + */ + public function subscribe( $subscriber ): void { + $subscriber = $this->resolve_subscriber( $subscriber ); + + $subscriber->subscribe( $this ); + } + + /** + * Resolve the subscriber instance. + * + * @param object|string $subscriber + * @return mixed + */ + protected function resolve_subscriber( $subscriber ) { + if ( is_string( $subscriber ) ) { + return $this->container->make( $subscriber ); + } + + return $subscriber; + } + + /** + * Fire an event and call the listeners. + * + * @todo Break out support for a filter. + * + * @param string|object $event Event name. + * @param mixed $payload Event payload. + * @return mixed + */ + public function dispatch( $event, $payload = [ null ] ) { + [ $event, $payload ] = $this->parse_event_and_payload( $event, $payload ); + + if ( function_exists( 'apply_filters' ) ) { + return apply_filters( $event, ...$payload ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound + } + + return null; + } + + /** + * Parse the given event and payload and prepare them for dispatching. + * + * @param mixed $event + * @param mixed $payload + * @return array + */ + protected function parse_event_and_payload( $event, $payload ) { + if ( is_object( $event ) ) { + [ $payload, $event ] = [ [ $event ], $event::class ]; + } + + return [ $event, Arr::wrap( $payload ) ]; + } + + /** + * Get all of the listeners for a given event name. + * + * @param string $event_name + * @return array + */ + public function get_listeners( $event_name ) { + $listeners = $this->listeners[ $event_name ] ?? []; + + return class_exists( $event_name, false ) + ? $this->add_interface_listeners( $event_name, $listeners ) + : $listeners; + } + + /** + * Add the listeners for the event's interfaces to the given array. + * + * @param string $event_name + * @param array $listeners + * @return array + */ + protected function add_interface_listeners( $event_name, array $listeners = [] ) { + foreach ( class_implements( $event_name ) as $interface ) { + if ( isset( $this->listeners[ $interface ] ) ) { + foreach ( $this->listeners[ $interface ] as $names ) { + $listeners = array_merge( $listeners, (array) $names ); + } + } + } + + return $listeners; + } + + /** + * Register an event listener with the dispatcher. + * + * @param \Closure|string $listener + */ + public function make_listener( $listener ): Closure { + if ( is_string( $listener ) ) { + return $this->create_class_listener( $listener ); + } + + return fn ( ...$payload) => $this->create_action_callback( + $listener, + )( ...array_values( $payload ) ); + } + + /** + * Create a class based listener using the IoC container. + * + * @param string $listener + */ + public function create_class_listener( $listener ): Closure { + return function ( ...$payload ) use ( $listener ) { + $callable = $this->create_action_callback( + $this->create_class_callable( $listener ), + ); + + return $callable( ...array_values( $payload ) ); + }; + } + + /** + * Create the class based event callable. + * + * @param string $listener + * @return callable + */ + protected function create_class_callable( $listener ) { + [ $class, $method ] = $this->parse_class_callable( $listener ); + + // todo: add queued callback support. + + return [ $this->container->make( $class ), $method ]; + } + + /** + * Parse the class listener into class and method. + * + * @param string $listener + * @return array + */ + protected function parse_class_callable( $listener ) { + return Str::parse_callback( $listener, 'handle' ); + } + + /** + * Remove a set of listeners from the dispatcher. + * + * @param string|object $event Event to remove. + * @param callable|string $listener Listener to remove. + * @param int $priority Priority of the listener. + */ + public function forget( $event, $listener = null, int $priority = 10 ): void { + if ( is_object( $event ) ) { + $event = $event::class; + } + + if ( null === $listener ) { + remove_all_filters( $event, $priority ); + } else { + remove_filter( $event, $listener, $priority ); + } + } +} diff --git a/vendor/mantle-framework/events/class-event-service-provider.php b/vendor/mantle-framework/events/class-event-service-provider.php new file mode 100644 index 00000000..cc69b78c --- /dev/null +++ b/vendor/mantle-framework/events/class-event-service-provider.php @@ -0,0 +1,28 @@ +<?php +/** + * Event_Service_Provider class file. + * + * @package Mantle + */ + +namespace Mantle\Events; + +use Mantle\Support\Service_Provider; + +/** + * Event Service Provider + * + * Registered the internal events dispatcher. The application's event service + * provider extends {@see \Mantle\Framework\Providers\Event_Service_Provider}. + */ +class Event_Service_Provider extends Service_Provider { + /** + * Register any application services. + */ + public function register(): void { + $this->app->singleton_if( + 'events', + fn ( $app ) => new Dispatcher( $app ), + ); + } +} diff --git a/vendor/mantle-framework/events/composer.json b/vendor/mantle-framework/events/composer.json new file mode 100644 index 00000000..3ef0f90b --- /dev/null +++ b/vendor/mantle-framework/events/composer.json @@ -0,0 +1,32 @@ +{ + "name": "mantle-framework/events", + "description": "The Mantle Framework Events Package", + "type": "library", + "require": { + "php": "^8.1", + "alleyinteractive/composer-wordpress-autoloader": "^1.0", + "mantle-framework/container": "^1.0", + "mantle-framework/contracts": "^1.0", + "mantle-framework/support": "^1.0", + "psr/container": "^1.1.1 || ^2.0.2", + "symfony/finder": "^6.2" + }, + "extra": { + "wordpress-autoloader": { + "autoload": { + "Mantle\\Events": "./" + } + } + }, + "license": "GPL-2.0-or-later", + "authors": [ + { + "name": "Alley", + "email": "mantle@alley.com" + } + ], + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/mantle-framework/events/trait-wordpress-action.php b/vendor/mantle-framework/events/trait-wordpress-action.php new file mode 100644 index 00000000..f6237560 --- /dev/null +++ b/vendor/mantle-framework/events/trait-wordpress-action.php @@ -0,0 +1,186 @@ +<?php +/** + * WordPress_Action trait file. + * + * @package Mantle + */ + +namespace Mantle\Events; + +use Closure; +use Mantle\Contracts\Support\Arrayable; +use Mantle\Support\Enumerable; +use Mantle\Support\Reflector; +use ReflectionClass; +use ReflectionException; +use ReflectionFunction; +use ReflectionNamedType; +use ReflectionParameter; +use ReflectionUnionType; +use RuntimeException; + +/** + * Extend the event dispatcher to allow for WordPress action/filter usage with + * type hints. In non-production environments it will throw an error when it is unable + * to translate a parameter. On production, it will handle it gracefully but throw a + * _doing_it_wrong() notice. + */ +trait WordPress_Action { + /** + * Add a WordPress action with type-hint support. + * + * @param string $action Action to listen to. + * @param callable $callback Callback to invoke. + * @param int $priority + */ + public function action( string $action, callable $callback, int $priority = 10 ): void { + \add_action( $action, $this->create_action_callback( $callback ), $priority, 99 ); + } + + /** + * Dispatch an action if a condition resolves true. + * + * @param callable|bool $condition Condition to check. + * @param string $action Action to invoke. + * @param callable $callback Callback to invoke. + * @param int $priority Action priority. + */ + public function action_if( $condition, string $action, callable $callback, int $priority = 10 ): void { + if ( is_callable( $condition ) ) { + $condition = $condition(); + } + + if ( $condition ) { + $this->action( $action, $callback, $priority ); + } + } + + /** + * Add a WordPress filter with type-hint support. + * + * @param string $action Action to listen to. + * @param callable $callback Callback to invoke. + * @param int $priority + */ + public function filter( string $action, callable $callback, int $priority = 10 ): void { + \add_filter( $action, $this->create_action_callback( $callback ), $priority, 99 ); + } + + /** + * Wrap the callback for an action with callback that will preserve type hints. + * + * @param callable $callback + */ + protected function create_action_callback( callable $callback ): Closure { + return function( ...$args ) use ( $callback ) { + if ( is_array( $callback ) ) { + try { + $class = new ReflectionClass( $callback[0] ); + $parameters = $class->getMethod( $callback[1] )->getParameters(); + } catch ( ReflectionException $e ) { + // Pass through if Reflection is unable to find the class and/or methods. + unset( $e ); + return $callback( ...$args ); + } + } else { + $parameters = ( new ReflectionFunction( $callback ) )->getParameters(); + } + + if ( empty( $parameters ) ) { + return $callback( ...$args ); + } + + return $callback( ...$this->validate_arguments( $args, $parameters ) ); + }; + } + + /** + * Validate arguments for a type-hint + * + * @param array $arguments Arguments passed to the hook. + * @param ReflectionParameter[] $parameters parameters for the callback. + * @return array + */ + protected function validate_arguments( $arguments, array $parameters ) { + foreach ( $arguments as $i => &$argument ) { + $parameter = $parameters[ $i ] ?? null; + if ( ! $parameter ) { + continue; + } + + $argument = $this->validate_argument_type( $argument, $parameter ); + } + + return $arguments; + } + + /** + * Validate the argument type matches the expected type-hinted parameter. + * + * @param mixed $argument Argument value. + * @param ReflectionParameter $parameter Callback parameter. + * @return mixed + * + * @throws RuntimeException Thrown when a non-builtin type-hint cannot be translated properly. + */ + protected function validate_argument_type( $argument, ReflectionParameter $parameter ) { + $type = $parameter->getType(); + if ( ! $type ) { + return $argument; + } + + if ( $type instanceof ReflectionNamedType && ! $type->isBuiltin() ) { + $parameter_class = Reflector::get_parameter_class_name( $parameter ); + + if ( Reflector::is_parameter_subclass_of( $parameter, Enumerable::class ) ) { + return $parameter_class::make( $argument ); + } + + // Return the argument if the class matches the typehint. + $class_name = Reflector::get_parameter_class_name( $parameter ); + if ( + $class_name + && ( is_object( $argument ) && $argument::class === $class_name || is_subclass_of( $argument, $class_name ) ) + ) { + return $argument; + } + + /** + * Fire an event to allow a type-hint conversion to be added dynamically. + * + * For example, if you wanted to handle the type-hint conversion to `SomeClass`, one could + * listen for the `mantle-typehint-resolve:SomeClass` event to be fired. Returning a non-null value + * to that event will pass the argument down to the callback for the action/filter. + * + * @param mixed $argument Argument value. + * @param ReflectionParameter $parameter Callback parameter. + */ + $modified_argument = $this->dispatch( 'mantle-typehint-resolve:' . $type->getName(), [ null, $argument, $parameter ] ); + + if ( $modified_argument ) { + return $modified_argument; + } + + return $this->container->make( $parameter_class, [ $parameter ] ); + } + + // Ensure an 'Arrayable' interface is cast to an array properly. + if ( $type instanceof ReflectionNamedType && 'array' === $type->getName() && $argument instanceof Arrayable ) { + return $argument->to_array(); + } + + // Handle type casting internal arguments. + $argument_type = gettype( $argument ); + + if ( ! $type instanceof ReflectionNamedType ) { + throw new RuntimeException( $type::class . ' is not a supported type-hint.' ); + } + + if ( $argument_type === $type->getName() ) { + return $argument; + } + + settype( $argument, $type->getName() ); + return $argument; + } +} diff --git a/vendor/mantle-framework/faker/LICENSE b/vendor/mantle-framework/faker/LICENSE new file mode 100644 index 00000000..d159169d --- /dev/null +++ b/vendor/mantle-framework/faker/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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. + + <signature of Ty Coon>, 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/vendor/mantle-framework/faker/class-faker-provider.php b/vendor/mantle-framework/faker/class-faker-provider.php new file mode 100644 index 00000000..26621094 --- /dev/null +++ b/vendor/mantle-framework/faker/class-faker-provider.php @@ -0,0 +1,101 @@ +<?php +/** + * Faker_Provider class file. + * + * @package Mantle + */ + +namespace Mantle\Faker; + +use Faker\Provider\Base; +use Faker\Provider\Lorem; + +/** + * Faker Block Provider + */ +class Faker_Provider extends Base { + /** + * Compile a set of blocks. + * + * @param array $blocks Blocks to compile. + */ + public static function blocks( array $blocks ): string { + return implode( "\n\n", $blocks ); + } + + /** + * Build a heading block. + * + * @param int $level Heading level. + */ + public static function heading_block( int $level = 2 ): string { + return static::block( + 'heading', + sprintf( '<h%d>%s</h%d>', $level, Lorem::sentence(), $level ), + [ + 'level' => $level, + ], + ); + } + + /** + * Build a paragraph block. + * + * @param int $sentences Number of sentences in the block. + */ + public static function paragraph_block( int $sentences = 3 ): string { + return static::block( + 'paragraph', + sprintf( '<p>%s</p>', Lorem::sentences( $sentences, true ) ) + ); + } + + /** + * Generate a set of paragraph blocks. + * + * @param int $count Number of paragraph blocks to generate. + * @param bool $as_text Return as text or an array of blocks. + * @return string|array + */ + public function paragraph_blocks( int $count = 3, bool $as_text = true ) { + $paragraphs = []; + for ( $i = 0; $i < $count; $i++ ) { + $paragraphs[] = static::paragraph_block(); + } + + return $as_text ? implode( "\n\n", $paragraphs ) : $paragraphs; + } + + /** + * Build an image block. + * + * @param string|null $url Image URL. + * @param string|null $alt Image alt text. + * @param array $attributes Additional attributes for the block. + */ + public function image_block( ?string $url = null, ?string $alt = null, array $attributes = [] ) { + $image = sprintf( + '<figure class="wp-block-image"><img src="%s"%s/></figure>', + $url ?? 'https://picsum.photos/' . wp_rand( 100, 1000 ) . '/' . wp_rand( 100, 1000 ), + $alt ? ' alt="' . esc_attr( $alt ) . '"' : '', + ); + + return static::block( 'image', $image, $attributes ); + } + + /** + * Build a block for Gutenberg. + * + * @param string $block_name Block name. + * @param string $content Content for the block. + * @param array $attributes Attributes for the block. + */ + public static function block( string $block_name, string $content = '', array $attributes = [] ): string { + // Add a newline before and after the content. + if ( ! empty( $content ) ) { + $content = "\n{$content}\n"; + } + + return get_comment_delimited_block_content( $block_name, $attributes, $content ); + } +} diff --git a/vendor/mantle-framework/faker/composer.json b/vendor/mantle-framework/faker/composer.json new file mode 100644 index 00000000..dd19ea97 --- /dev/null +++ b/vendor/mantle-framework/faker/composer.json @@ -0,0 +1,28 @@ +{ + "name": "mantle-framework/faker", + "description": "The Mantle Framework Faker Package", + "type": "library", + "require": { + "php": "^8.1", + "alleyinteractive/composer-wordpress-autoloader": "^1.0", + "fakerphp/faker": "^1.23" + }, + "extra": { + "wordpress-autoloader": { + "autoload": { + "Mantle\\Faker": "./" + } + } + }, + "license": "GPL-2.0-or-later", + "authors": [ + { + "name": "Alley", + "email": "mantle@alley.com" + } + ], + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/mantle-framework/filesystem/LICENSE b/vendor/mantle-framework/filesystem/LICENSE new file mode 100644 index 00000000..d159169d --- /dev/null +++ b/vendor/mantle-framework/filesystem/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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. + + <signature of Ty Coon>, 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/vendor/mantle-framework/filesystem/adapter/class-aws-s3-adapter.php b/vendor/mantle-framework/filesystem/adapter/class-aws-s3-adapter.php new file mode 100644 index 00000000..7f22569f --- /dev/null +++ b/vendor/mantle-framework/filesystem/adapter/class-aws-s3-adapter.php @@ -0,0 +1,149 @@ +<?php +/** + * AWS_S3_Adapter class file + * + * @package Mantle + */ + +namespace Mantle\Filesystem\Adapter; + +use Aws\S3\S3Client; +use DateTimeInterface; +use League\Flysystem\AwsS3V3\AwsS3V3Adapter as S3Adapter; +use League\Flysystem\FilesystemOperator; +use Mantle\Filesystem\Filesystem_Adapter; + +/** + * AWS S3 Adapter + */ +class AWS_S3_Adapter extends Filesystem_Adapter { + /** + * The AWS S3 client. + * + * @var \Aws\S3\S3Client + */ + protected $client; + + /** + * Create a new AwsS3V3FilesystemAdapter instance. + * + * @param \League\Flysystem\FilesystemOperator $driver + * @param \League\Flysystem\AwsS3V3\AwsS3V3Adapter $adapter + * @param array $config + * @param \Aws\S3\S3Client $client + * @return void + */ + public function __construct( FilesystemOperator $driver, S3Adapter $adapter, array $config, S3Client $client ) { + parent::__construct( $driver, $adapter, $config ); + + $this->client = $client; + } + + /** + * Get the URL for the file at the given path. + * + * @param string $path + */ + public function url( string $path ): string { + // If an explicit base URL has been set on the disk configuration then we will use + // it as the base URL instead of the default path. This allows the developer to + // have full control over the base path for this filesystem's generated URLs. + if ( isset( $this->config['url'] ) ) { + return $this->concat_path_to_url( $this->config['url'], $this->prefixer->prefixPath( $path ) ); + } + + return $this->client->getObjectUrl( + $this->config['bucket'], + $this->prefixer->prefixPath( $path ) + ); + } + + /** + * Determine if temporary URLs can be generated. + */ + public function provides_temporary_urls(): bool { + return true; + } + + /** + * Get a temporary URL for the file at the given path. + * + * @param string $path + * @param \DateTimeInterface $expiration + * @param array $options + */ + public function temporary_url( string $path, $expiration, array $options = [] ): string { + $command = $this->client->getCommand( + 'GetObject', + array_merge( + [ + 'Bucket' => $this->config['bucket'], + 'Key' => $this->prefixer->prefixPath( $path ), + ], + $options + ) + ); + + $uri = $this->client->createPresignedRequest( + $command, + $expiration, + $options + )->getUri(); + + // If an explicit base URL has been set on the disk configuration then we will use + // it as the base URL instead of the default path. This allows the developer to + // have full control over the base path for this filesystem's generated URLs. + if ( isset( $this->config['temporary_url'] ) ) { + $uri = $this->replace_base_url( $uri, $this->config['temporary_url'] ); + } + + return (string) $uri; + } + + /** + * Get a temporary upload URL for the file at the given path. + * + * @param string $path + * @param \DateTimeInterface $expiration + * @param array $options + */ + public function temporary_upload_url( string $path, $expiration, array $options = [] ): array { + $command = $this->client->getCommand( + 'PutObject', + array_merge( + [ + 'Bucket' => $this->config['bucket'], + 'Key' => $this->prefixer->prefixPath( $path ), + ], + $options + ) + ); + + $signed_request = $this->client->createPresignedRequest( + $command, + $expiration, + $options + ); + + $uri = $signed_request->getUri(); + + // If an explicit base URL has been set on the disk configuration then we will use + // it as the base URL instead of the default path. This allows the developer to + // have full control over the base path for this filesystem's generated URLs. + if ( isset( $this->config['temporary_url'] ) ) { + $uri = $this->replace_base_url( $uri, $this->config['temporary_url'] ); + } + + return [ + 'url' => (string) $uri, + 'headers' => $signed_request->getHeaders(), + ]; + } + + /** + * Get the underlying S3 client. + */ + public function get_client(): S3Client { + return $this->client; + } +} diff --git a/vendor/mantle-framework/filesystem/adapter/class-local-adapter.php b/vendor/mantle-framework/filesystem/adapter/class-local-adapter.php new file mode 100644 index 00000000..f5bcb099 --- /dev/null +++ b/vendor/mantle-framework/filesystem/adapter/class-local-adapter.php @@ -0,0 +1,32 @@ +<?php +/** + * Local_Adapter class file + * + * @package Mantle + */ + +namespace Mantle\Filesystem\Adapter; + +use Mantle\Filesystem\Filesystem_Adapter; + +/** + * Local Filesystem Adapter + */ +class Local_Adapter extends Filesystem_Adapter { + /** + * Get the URL for the file at the given path. + * + * @param string $path + */ + public function url( string $path ): string { + // If an explicit base URL has been set on the disk configuration then we + // will use it as the base URL instead of the default path. This allows the + // developer to have full control over the base path for this filesystem's + // generated URLs. + if ( ! empty( $this->config['url'] ) ) { + return $this->concat_path_to_url( $this->config['url'], $path ); + } + + return rtrim( (string) wp_upload_dir()['baseurl'], '/' ) . '/' . ltrim( $path, '/' ); + } +} diff --git a/vendor/mantle-framework/filesystem/class-file-not-found-exception.php b/vendor/mantle-framework/filesystem/class-file-not-found-exception.php new file mode 100644 index 00000000..24f037aa --- /dev/null +++ b/vendor/mantle-framework/filesystem/class-file-not-found-exception.php @@ -0,0 +1,15 @@ +<?php +/** + * Filesystem_Manager class file + * + * @package Mantle + */ + +namespace Mantle\Filesystem; + +use Exception; + +/** + * File Not Found Exception + */ +class File_Not_Found_Exception extends Exception {} diff --git a/vendor/mantle-framework/filesystem/class-file.php b/vendor/mantle-framework/filesystem/class-file.php new file mode 100644 index 00000000..153b8c05 --- /dev/null +++ b/vendor/mantle-framework/filesystem/class-file.php @@ -0,0 +1,17 @@ +<?php +/** + * File class file. + * + * @package Mantle + */ + +namespace Mantle\Filesystem; + +use Symfony\Component\HttpFoundation\File\File as SymfonyFile; + +/** + * A file in the filesystem. + */ +class File extends SymfonyFile { + use File_Helpers; +} diff --git a/vendor/mantle-framework/filesystem/class-filesystem-adapter.php b/vendor/mantle-framework/filesystem/class-filesystem-adapter.php new file mode 100644 index 00000000..83ad22ee --- /dev/null +++ b/vendor/mantle-framework/filesystem/class-filesystem-adapter.php @@ -0,0 +1,701 @@ +<?php +/** + * Filesystem_Adapter class file. + * + * phpcs:disable Squiz.Commenting.FunctionComment.MissingParamTag + * + * @package Mantle + */ + +namespace Mantle\Filesystem; + +use InvalidArgumentException; +use League\Flysystem\FilesystemAdapter; +use League\Flysystem\FilesystemOperator; +use League\Flysystem\PathPrefixer; +use League\Flysystem\StorageAttributes; +use League\Flysystem\UnableToCopyFile; +use League\Flysystem\UnableToCreateDirectory; +use League\Flysystem\UnableToDeleteDirectory; +use League\Flysystem\UnableToDeleteFile; +use League\Flysystem\UnableToMoveFile; +use League\Flysystem\UnableToReadFile; +use League\Flysystem\UnableToSetVisibility; +use League\Flysystem\UnableToWriteFile; +use League\Flysystem\Visibility; +use Mantle\Contracts\Filesystem\Filesystem; +use Mantle\Http\Uploaded_File; +use Mantle\Support\Arr; +use Mantle\Support\Str; +use PHPUnit\Framework\Assert as PHPUnit; +use Psr\Http\Message\StreamInterface; +use Psr\Http\Message\UriInterface; +use RuntimeException; +use Symfony\Component\HttpFoundation\StreamedResponse; + +use function Mantle\Support\Helpers\throw_if; + +/** + * Filesystem to Flysystem Adapter + * + * @mixin \League\Flysystem\FilesystemOperator + */ +class Filesystem_Adapter implements Filesystem { + /** + * Path prefixer. + */ + protected PathPrefixer $prefixer; + + /** + * Constructor. + * + * @param FilesystemOperator $driver Filesystem instance. + * @param FilesystemAdapter $adapter Filesystem adapter. + * @param array $config Filesystem configuration. + */ + public function __construct( + protected FilesystemOperator $driver, + protected FilesystemAdapter $adapter, + protected array $config = [], + ) { + $separator = $config['directory_separator'] ?? DIRECTORY_SEPARATOR; + + $this->prefixer = new PathPrefixer( $this->config['root'] ?? '', $separator ); + + if ( isset( $config['prefix'] ) ) { + $this->prefixer = new PathPrefixer( $this->prefixer->prefixPath( $config['prefix'] ), $separator ); + } + } + + /** + * Assert that the given file exists. + * + * @param string[]|string $path File path. + * @return static + */ + public function assertExists( $path ) { + $paths = Arr::wrap( $path ); + + foreach ( $paths as $path ) { + PHPUnit::assertTrue( + $this->exists( $path ), + "Unable to find a file at path [{$path}]." + ); + } + + return $this; + } + + /** + * Assert that the given file does not exist. + * + * @param string[]|string $path File path. + * @return static + */ + public function assertMissing( $path ) { + $paths = Arr::wrap( $path ); + + foreach ( $paths as $path ) { + PHPUnit::assertFalse( + $this->exists( $path ), + "Found unexpected file at path [{$path}]." + ); + } + + return $this; + } + + /** + * Get all (recursive) of the directories within a given directory. + * + * @param string $directory Directory name. + * @return string[] + */ + public function all_directories( string $directory = null ): array { + return $this->directories( $directory, true ); + } + + /** + * Get all the directories within a given directory. + * + * @param string $directory Directory name. + * @param bool $recursive Flag if it should be recursive. + * @return array<string> + */ + public function directories( string $directory = null, bool $recursive = false ): array { + return $this->driver->listContents( $directory, $recursive ) + ->filter( + fn ( StorageAttributes $attributes ) => $attributes->isDir() + ) + ->map( + fn ( StorageAttributes $attributes ) => $attributes->path() + ) + ->toArray(); + } + + /** + * Create a directory. + * + * @param string $path Path to create. + */ + public function make_directory( string $path ): bool { + try { + $this->driver->createDirectory( $path ); + } catch ( UnableToCreateDirectory $e ) { + throw_if( $this->throws_exceptions(), $e ); + + return false; + } + + return true; + } + + /** + * Recursively delete a directory. + * + * @param string $directory Directory name. + */ + public function delete_directory( string $directory ): bool { + try { + $this->driver->deleteDirectory( $directory ); + } catch ( UnableToDeleteDirectory $e ) { + throw_if( $this->throws_exceptions(), $e ); + + return false; + } + + return true; + } + + /** + * Get all of the files from the given directory (recursive). + * + * @param string $directory Directory name. + * @return string[] + */ + public function all_files( string $directory = null ): array { + return $this->files( $directory, true ); + } + + /** + * Get an array of all files in a directory. + * + * @param string $directory Directory name. + * @param bool $recursive Flag if recursive. + * @return string[] + */ + public function files( string $directory = null, bool $recursive = false ): array { + return $this->driver->listContents( $directory, $recursive ) + ->filter( + fn ( StorageAttributes $attributes ) => $attributes->isFile() + ) + ->sortByPath() + ->map( + fn ( StorageAttributes $attributes ) => $attributes->path() + ) + ->toArray(); + } + + /** + * Copy a file from one location to another. + * + * @param string $from From location. + * @param string $to To location. + */ + public function copy( string $from, string $to ): bool { + try { + $this->driver->copy( $from, $to ); + } catch ( UnableToCopyFile $e ) { + throw_if( $this->throws_exceptions(), $e ); + + return false; + } + + return true; + } + + /** + * Move a file from a location to another. + * + * @param string $from From location. + * @param string $to To location. + */ + public function move( string $from, string $to ): bool { + try { + $this->driver->move( $from, $to ); + } catch ( UnableToMoveFile $e ) { + throw_if( $this->throws_exceptions(), $e ); + + return false; + } + + return true; + } + + /** + * Delete a file at the given paths. + * + * @param string|string[] $paths File paths. + */ + public function delete( $paths ): bool { + $paths = is_array( $paths ) ? $paths : func_get_args(); + $success = true; + + foreach ( $paths as $path ) { + try { + $this->driver->delete( $path ); + } catch ( UnableToDeleteFile $e ) { + throw_if( $this->throws_exceptions(), $e ); + + $success = false; + } + } + + return $success; + } + + /** + * Check if a file exists at a current path. + * + * @param string $path + */ + public function exists( string $path ): bool { + return $this->driver->has( $path ); + } + + /** + * Check if a file is missing at a given path. + * + * @param string $path File path. + */ + public function missing( string $path ): bool { + return ! $this->exists( $path ); + } + + /** + * Get the full path for the file at the given "short" path. + * + * @param string $path File path. + */ + public function path( string $path ): string { + return $this->prefixer->prefixPath( $path ); + } + + /** + * Get the contents of a file. + * + * @param string $path File path. + * @return string|null + */ + public function get( string $path ) { + try { + return $this->driver->read( $path ); + } catch ( UnableToReadFile $e ) { + throw_if( $this->throws_exceptions(), $e ); + } + + return null; + } + + /** + * Create a streamed response for a given file. + * + * @param string $path File path. + * @param string|null $name File name. + * @param array $headers Headers to include. + * @param string $disposition File disposition. + */ + public function response( string $path, ?string $name = null, array $headers = [], string $disposition = 'inline' ): StreamedResponse { + $response = new StreamedResponse(); + + if ( ! array_key_exists( 'Content-Type', $headers ) ) { + $headers['Content-Type'] = $this->mimeType( $path ); + } + + if ( ! array_key_exists( 'Content-Length', $headers ) ) { + $headers['Content-Length'] = $this->size( $path ); + } + + if ( ! array_key_exists( 'Content-Disposition', $headers ) ) { + $filename = $name ?? basename( $path ); + + $disposition = $response->headers->makeDisposition( + $disposition, + $filename, + $this->fallback_name( $filename ) + ); + + $headers['Content-Disposition'] = $disposition; + } + + $response->headers->replace( $headers ); + + $response->setCallback( + function () use ( $path ): void { + $stream = $this->readStream( $path ); + fpassthru( $stream ); + fclose( $stream ); + } + ); + + return $response; + } + + /** + * Create a streamed download response for a given file. + * + * @param string $path File path. + * @param string|null $name File name. + * @param array $headers HTTP headers. + */ + public function download( $path, $name = null, array $headers = [] ): StreamedResponse { + return $this->response( $path, $name, $headers, 'attachment' ); + } + + /** + * Convert the string to ASCII characters that are equivalent to the given name. + * + * @param string $name Fallback name. + */ + protected function fallback_name( string $name ): string { + return str_replace( '%', '', Str::ascii( $name ) ); + } + + /** + * Get the file's last modification time. + * + * @param string $path File path. + */ + public function last_modified( string $path ): int { + return $this->driver->lastModified( $path ); + } + + /** + * Get the mime-type of a given file. + * + * @param string $path File path. + * @return string|false + */ + public function mime_type( string $path ) { + return $this->driver->mimeType( $path ); + } + + /** + * Write the contents of a file. + * + * @param string $path File path. + * @param string|File|Uploaded_File|StreamInterface|resource $contents File contents. + * @param array|string $options Options for the files or a string visibility. + */ + public function put( string $path, $contents, $options = [] ): bool { + $options = is_string( $options ) + ? [ 'visibility' => $options ] + : (array) $options; + + if ( + $contents instanceof File + || $contents instanceof Uploaded_File + ) { + return $this->put_file( $path, $contents, $options ) ? true : false; + } + + if ( $contents instanceof StreamInterface ) { + $this->driver->writeStream( $path, $contents->detach(), $options ); + + return true; + } + + is_resource( $contents ) + ? $this->driver->writeStream( $path, $contents, $options ) + : $this->driver->write( $path, $contents, $options ); + + return true; + } + + /** + * Store the uploaded file on the disk. + * + * @param string $path File path. + * @param File|\Mantle\Http\Uploaded_File|string $file File object. + * @param mixed $options Options. + * @return string|false + */ + public function put_file( string $path, $file, $options = [] ): string|bool { + $file = is_string( $file ) ? new File( $file ) : $file; + + return $this->put_file_as( $path, $file, $file->hash_name(), $options ); + } + + /** + * Store the uploaded file on the disk with a given name. + * + * @param string $path File path. + * @param File|\Mantle\Http\Uploaded_File|string $file File object. + * @param string $name File name. + * @param mixed $options Options. + * @return string|false + */ + public function put_file_as( string $path, $file, string $name, $options = [] ): string|bool { + $stream = fopen( is_string( $file ) ? $file : $file->getRealPath(), 'r' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fopen + $path = trim( $path . '/' . $name, '/' ); + + // Next, we will format the path of the file and store the file using a stream since + // they provide better performance than alternatives. Once we write the file this + // stream will get closed automatically by us so the developer doesn't have to. + $result = $this->put( + $path, + $stream, + $options + ); + + if ( is_resource( $stream ) ) { + fclose( $stream ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fclose + } + + return $result ? $path : false; + } + + /** + * Retrieve the size of the file. + * + * @param string $path File path. + */ + public function size( string $path ): int { + return $this->driver->fileSize( $path ); + } + + /** + * {@inheritdoc} + */ + public function readStream( $path ) { + try { + return $this->driver->readStream( $path ); + } catch ( UnableToReadFile $e ) { + throw_if( $this->throws_exceptions(), $e ); + + return false; + } + } + + /** + * Read a file through a stream. + * + * @param string $path File path. + * @return resource|false The path resource or false on failure. + */ + public function read_stream( string $path ) { + return $this->readStream( $path ); + } + + /** + * {@inheritdoc} + */ + public function writeStream( string $path, $resource, $options = [] ): bool { + $options = is_string( $options ) + ? [ 'visibility' => $options ] + : (array) $options; + + try { + $this->driver->writeStream( $path, $resource, $options ); + } catch ( UnableToWriteFile | UnableToSetVisibility $e ) { + throw_if( $this->throws_exceptions(), $e ); + + return false; + } + + return true; + } + + /** + * Write a file through a stream. + * + * @param string $path File path. + * @param resource $resource File resource. + * @param array|string $options File options or string visibility. + */ + public function write_stream( string $path, $resource, $options = [] ): bool { + return $this->writeStream( $path, $resource, $options ); + } + + /** + * Retrieve a file's visibility. + * + * @param string $path + */ + public function get_visibility( string $path ): string { + return $this->driver->visibility( $path ) === Visibility::PUBLIC + ? Filesystem::VISIBILITY_PUBLIC + : Filesystem::VISIBILITY_PRIVATE; + } + + /** + * Set the visibility for a file. + * + * @param string $path Path to set. + * @param string $visibility Visibility to set. + */ + public function setVisibility( string $path, string $visibility ): bool { + try { + $this->driver->setVisibility( $path, $this->parse_visibility( $visibility ) ); + } catch ( UnableToSetVisibility $e ) { + throw_if( $this->throws_exceptions(), $e ); + + return false; + } + + return true; + } + + /** + * Set the visibility for a file (alias). + * + * @param string $path Path to set. + * @param string $visibility Visibility to set. + */ + public function set_visibility( string $path, string $visibility ): bool { + return $this->setVisibility( $path, $visibility ); + } + + /** + * Prepend to a file. + * + * @param string $path File to prepend. + * @param string $data Data to prepend. + * @param string $separator Separator from existing data. + * @return bool + */ + public function prepend( string $path, string $data, string $separator = PHP_EOL ) { + if ( $this->exists( $path ) ) { + return $this->put( $path, $data . $separator . $this->get( $path ) ); + } + + return $this->put( $path, $data ); + } + + /** + * Append to a file. + * + * @param string $path File to append. + * @param string $data Data to append. + * @param string $separator Separator from existing data. + * @return bool + */ + public function append( $path, $data, $separator = PHP_EOL ) { + if ( $this->exists( $path ) ) { + return $this->put( $path, $this->get( $path ) . $separator . $data ); + } + + return $this->put( $path, $data ); + } + + /** + * Get the URL for the file at the given path. + * + * @param string $path Path to the file. + * + * @throws RuntimeException Thrown on invalid filesystem adapter. + */ + public function url( string $path ): ?string { + if ( isset( $this->config['prefix'] ) ) { + $path = $this->concat_path_to_url( $this->config['prefix'], $path ); + } + + $adapter = $this->adapter; + + if ( method_exists( $adapter, 'getUrl' ) ) { + return $adapter->getUrl( $path ); + } elseif ( method_exists( $adapter, 'get_url' ) ) { + return $adapter->get_url( $path ); + } elseif ( method_exists( $this->driver, 'getUrl' ) ) { + return $this->driver->getUrl( $path ); + } elseif ( method_exists( $this->driver, 'get_url' ) ) { + return $this->driver->get_url( $path ); + } else { + throw new RuntimeException( 'This driver does not support retrieving URLs.' ); + } + } + + /** + * Determine if temporary URLs can be generated. + */ + public function provides_temporary_urls(): bool { + return method_exists( $this->adapter, 'getTemporaryUrl' ) || method_exists( $this->adapter, 'get_temporary_url' ); + } + + /** + * Get a temporary URL for the file at the given path. + * + * @param string $path File path. + * @param \DateTimeInterface $expiration File expiration. + * @param array $options Options for the URL. + * + * @throws RuntimeException Thrown on missing temporary URL. + */ + public function temporary_url( string $path, $expiration, array $options = [] ): string { + if ( method_exists( $this->adapter, 'getTemporaryUrl' ) ) { + return $this->adapter->getTemporaryUrl( $path, $expiration, $options ); + } elseif ( method_exists( $this->adapter, 'get_temporary_url' ) ) { + return $this->adapter->get_temporary_url( $path, $expiration, $options ); + } + + throw new RuntimeException( 'This driver does not support creating temporary URLs.' ); + } + + /** + * Concatenate a path to a URL. + * + * @param string $url + * @param string $path + */ + protected function concat_path_to_url( string $url, string $path ): string { + return rtrim( $url, '/' ) . '/' . ltrim( $path, '/' ); + } + + /** + * Replace the scheme, host and port of the given UriInterface with values from the given URL. + * + * @param \Psr\Http\Message\UriInterface $uri + * @param string $url + */ + protected function replace_base_url( UriInterface $uri, string $url ): UriInterface { + $parsed = wp_parse_url( $url ); + + return $uri + ->withScheme( $parsed['scheme'] ) + ->withHost( $parsed['host'] ) + ->withPort( $parsed['port'] ?? null ); + } + + /** + * Parse the given visibility value. + * + * @param string $visibility Visibility to set. + * + * @throws InvalidArgumentException Thrown on invalid visibility. + */ + protected function parse_visibility( string $visibility ): string { + return match ( $visibility ) { + Filesystem::VISIBILITY_PUBLIC => Visibility::PUBLIC, + Filesystem::VISIBILITY_PRIVATE => Visibility::PRIVATE, + default => throw new InvalidArgumentException( "Unknown visibility: {$visibility}." ), + }; + } + + /** + * Determine if Flysystem exceptions should be thrown. + */ + protected function throws_exceptions(): bool { + return (bool) ( $this->config['throw'] ?? false ); + } + + /** + * Pass dynamic methods call onto Flysystem instance. + * + * @param string $method Method to call. + * @param array $parameters Parameters for the driver. + * @return mixed + */ + public function __call( $method, array $parameters ) { + return $this->driver->{$method}( ...$parameters ); + } +} diff --git a/vendor/mantle-framework/filesystem/class-filesystem-manager.php b/vendor/mantle-framework/filesystem/class-filesystem-manager.php new file mode 100644 index 00000000..d529a6be --- /dev/null +++ b/vendor/mantle-framework/filesystem/class-filesystem-manager.php @@ -0,0 +1,264 @@ +<?php +/** + * Filesystem_Manager class file. + * + * @package Mantle + */ + +namespace Mantle\Filesystem; + +use Aws\S3\S3Client; +use Closure; +use InvalidArgumentException; +use League\Flysystem\AwsS3V3\AwsS3V3Adapter as S3Adapter; +use League\Flysystem\AwsS3V3\PortableVisibilityConverter as AwsS3PortableVisibilityConverter; +use League\Flysystem\Filesystem as Flysystem; +use League\Flysystem\FilesystemAdapter; +use League\Flysystem\Local\LocalFilesystemAdapter as LocalAdapter; +use League\Flysystem\UnixVisibility\PortableVisibilityConverter; +use League\Flysystem\Visibility; +use Mantle\Contracts\Application; +use Mantle\Contracts\Filesystem\Filesystem_Manager as Filesystem_Manager_Contract; +use Mantle\Contracts\Filesystem\Filesystem; +use Mantle\Support\Arr; +use RuntimeException; + +/** + * Filesystem Manager + * + * @mixin \Mantle\Contracts\Filesystem\Filesystem + */ +class Filesystem_Manager implements Filesystem_Manager_Contract { + /** + * Disk storage. + * + * @var Filesystem[] + */ + protected $disks = []; + + /** + * Storage of custom drivers for the filesystem. + * + * @var Closure[] + */ + protected $custom_drivers; + + /** + * Constructor. + * + * @param Application $app Application instance. + */ + public function __construct( protected Application $app ) {} + + /** + * Retrieve a filesystem disk. + * + * @param string $name Disk name. + * + * @throws InvalidArgumentException Thrown on invalid disk configuration. + */ + public function drive( string $name = null ): Filesystem { + return $this->resolve_disk( $name ?: $this->get_default_disk() ); + } + + /** + * Retrieve a disk by name. + * + * @param string $name Disk name. + * @return Filesystem + * @throws InvalidArgumentException Thrown on invalid disk/driver configuration. + */ + protected function resolve_disk( string $name ): Filesystem { + if ( isset( $this->disks[ $name ] ) ) { + return $this->disks[ $name ]; + } + + $config = $this->get_config( $name ); + + if ( empty( $config['driver'] ) ) { + throw new InvalidArgumentException( "Disk [{$name}] does not have a configured driver." ); + } + + $driver = $config['driver']; + + // Call a custom driver callback. + if ( isset( $this->custom_drivers[ $driver ] ) ) { + return $this->disks[ $name ] = $this->call_custom_driver( $driver, $config ); + } + + $driver_method = 'create_' . strtolower( (string) $driver ) . '_driver'; + + if ( ! method_exists( $this, $driver_method ) ) { + throw new InvalidArgumentException( "Disk [{$name}] uses a driver [{$driver}] that is not supported." ); + } + + return $this->disks[ $name ] = $this->{$driver_method}( $config ); + } + + /** + * Retrieve configuration for a specific filesystem disk. + * + * @param string $disk Disk name. + */ + protected function get_config( string $disk ): array { + return (array) ( $this->app['config'][ "filesystem.disks.{$disk}" ] ?? [] ); + } + + /** + * Retrieve the default disk driver. + */ + protected function get_default_disk(): string { + return (string) ( $this->app['config']['filesystem.default'] ?? 'local' ); + } + + /** + * Add a custom driver to the filesystem. + * + * @param string $driver Driver name. + * @param \Closure(\Mantle\Contracts\Application, array): \Mantle\Contracts\Filesystem\Filesystem $callback Callback to create the driver. + * @return static + */ + public function extend( string $driver, Closure $callback ) { + $this->custom_drivers[ $driver ] = $callback; + + return $this; + } + + /** + * Call a custom driver. + * + * @param string $driver Driver name. + * @param array $config Configuration from disk. + * @return Filesystem + */ + protected function call_custom_driver( string $driver, array $config ): Filesystem { + return $this->custom_drivers[ $driver ]( $this->app, $config ); + } + + /** + * Create a Flysystem instance with the given adapter. + * + * @param FilesystemAdapter $adapter + * @param array $config Adapter configuration. + */ + protected function create_flysystem( FilesystemAdapter $adapter, array $config = [] ): Flysystem { + return new Flysystem( $adapter, $config ); + } + + /** + * Create an instance of the local driver. + * + * @param array $config Configuration. + * + * @throws InvalidArgumentException Thrown on missing WordPress. + */ + public function create_local_driver( array $config ): Filesystem_Adapter { + if ( ! function_exists( 'wp_upload_dir' ) ) { + throw new InvalidArgumentException( 'The local filesystem cannot be used outside of a WordPress environment.' ); + } + + $visibility = PortableVisibilityConverter::fromArray( + $config['permissions'] ?? [], + $config['directory_visibility'] ?? $config['visibility'] ?? Visibility::PRIVATE + ); + + $links = ( $config['links'] ?? null ) === 'skip' + ? LocalAdapter::SKIP_LINKS + : LocalAdapter::DISALLOW_LINKS; + + $upload_dir = wp_upload_dir(); + + // Default the root to the WordPress uploads directory. + $root = (string) ( $config['root'] ?? $upload_dir['basedir'] ); + + /** + * Filter the local filesystem root directory. + * + * @param string $root Root path. + * @param array $config Configuration. + */ + $root = (string) apply_filters( 'mantle_filesystem_local_root', $root, $config ); + + // Ensure the root configuration has a base URL. + $config['root'] = $root; + $config['url'] ??= $upload_dir['baseurl']; + $config['visibility'] ??= Visibility::PUBLIC; + + /** + * Filter the local filesystem configuration. + * + * @param array $config Configuration. + */ + $config = (array) apply_filters( 'mantle_filesystem_local_config', $config ); + + $adapter = new LocalAdapter( + $root, + $visibility, + $config['lock'] ?? LOCK_EX, + $links + ); + + return new Adapter\Local_Adapter( $this->create_flysystem( $adapter, $config ), $adapter, $config ); + } + + /** + * Create an instance of the Amazon S3 driver. + * + * @param array $config S3 configuration. + * + * @throws RuntimeException Thrown on missing dependency. + */ + public function create_s3_driver( array $config ): Adapter\AWS_S3_Adapter { + if ( ! class_exists( S3Adapter::class ) ) { + throw new RuntimeException( S3Adapter::class . ' class not found. Run `composer require league/flysystem-aws-s3-v3`.' ); + } + + $s3_config = $this->format_s3_config( $config ); + + $root = (string) ( $s3_config['root'] ?? '' ); + + $visibility = new AwsS3PortableVisibilityConverter( + $config['visibility'] ?? Visibility::PUBLIC + ); + + $stream_reads = $s3_config['stream_reads'] ?? false; + + $client = new S3Client( $s3_config ); + + $adapter = new S3Adapter( $client, $s3_config['bucket'], $root, $visibility, null, $config['options'] ?? [], $stream_reads ); + + return new Adapter\AWS_S3_Adapter( + $this->create_flysystem( $adapter, $config ), + $adapter, + $s3_config, + $client + ); + } + + /** + * Format the given S3 configuration with the default options. + * + * @param array $config + * @return array + */ + protected function format_s3_config( array $config ) { + $config += [ 'version' => 'latest' ]; + + if ( ! empty( $config['key'] ) && ! empty( $config['secret'] ) ) { + $config['credentials'] = Arr::only( $config, [ 'key', 'secret', 'token' ] ); + } + + return $config; + } + + /** + * Pass the method calls to the default disk. + * + * @param string $method Method to invoke. + * @param array $arguments Arguments for the method. + * @return mixed + */ + public function __call( string $method, array $arguments ) { + return $this->drive()->$method( ...$arguments ); + } +} diff --git a/vendor/mantle-framework/filesystem/class-filesystem-service-provider.php b/vendor/mantle-framework/filesystem/class-filesystem-service-provider.php new file mode 100644 index 00000000..c060aba5 --- /dev/null +++ b/vendor/mantle-framework/filesystem/class-filesystem-service-provider.php @@ -0,0 +1,70 @@ +<?php +/** + * Filesystem_Service_Provider class file. + * + * @package mantle + */ + +namespace Mantle\Filesystem; + +use Mantle\Contracts\Support\Isolated_Service_Provider; +use Mantle\Database\Model\Attachment; +use Mantle\Support\Service_Provider; +use RuntimeException; + +/** + * Filesystem Service Provider + */ +class Filesystem_Service_Provider extends Service_Provider implements Isolated_Service_Provider { + + /** + * Register the service provider. + */ + public function register(): void { + $this->register_native_filesystem(); + $this->register_flysystem(); + } + + /** + * Register the native filesystem. + * + * @return void + */ + protected function register_native_filesystem() { + $this->app->singleton( 'files', fn () => new Filesystem() ); + } + + /** + * Register the Flysystem Manager + */ + public function register_flysystem(): void { + $this->app->singleton( 'filesystem', fn ( $app ) => new Filesystem_Manager( $app ) ); + } + + /** + * Filter the attachment URL for cloud-stored attachments. + * + * @param string $url Attachment URL. + * @param int $post_id Attachment ID. + */ + public function on_wp_get_attachment_url( string $url, int $post_id ): string { + static $doing_wp_get_attachment_url = false; + + if ( ! $doing_wp_get_attachment_url ) { + $doing_wp_get_attachment_url = true; + + $attachment = Attachment::find( $post_id ); + if ( $attachment ) { + try { + $url = $attachment->url(); + } catch ( RuntimeException $e ) { + unset( $e ); + } + } + + $doing_wp_get_attachment_url = false; + } + + return $url; + } +} diff --git a/vendor/mantle-framework/filesystem/class-filesystem.php b/vendor/mantle-framework/filesystem/class-filesystem.php new file mode 100644 index 00000000..5bd999f0 --- /dev/null +++ b/vendor/mantle-framework/filesystem/class-filesystem.php @@ -0,0 +1,642 @@ +<?php +/** + * Filesystem class file. + * + * phpcs:disable WordPressVIPMinimum.Functions.RestrictedFunctions + * + * @package Mantle + */ + +namespace Mantle\Filesystem; + +use ErrorException; +use FilesystemIterator; +use Mantle\Support\Str; +use Mantle\Support\Traits\Macroable; +use RuntimeException; +use Symfony\Component\Finder\Finder; +use Symfony\Component\Mime\MimeTypes; + +/** + * Filesystem Interface + */ +class Filesystem { + use Macroable; + + /** + * Determine if a file or directory exists. + * + * @param string $path + * @return bool + */ + public function exists( $path ) { + return file_exists( $path ); + } + + /** + * Determine if a file or directory is missing. + * + * @param string $path + * @return bool + */ + public function missing( $path ) { + return ! $this->exists( $path ); + } + + /** + * Get the contents of a file. + * + * @param string $path + * @param bool $lock + * + * @throws File_Not_Found_Exception Thrown on missing file. + */ + public function get( string $path, bool $lock = false ): string { + if ( $this->is_file( $path ) ) { + return $lock ? $this->shared_get( $path ) : file_get_contents( $path ); // phpcs:ignore WordPressVIPMinimum.Performance.FetchingRemoteData.FileGetContentsUnknown + } + + throw new File_Not_Found_Exception( "File does not exist at path {$path}." ); + } + + /** + * Get contents of a file with shared access. + * + * @param string $path + * @return string + */ + public function shared_get( $path ) { + $contents = ''; + + $handle = fopen( $path, 'rb' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fopen + + if ( $handle ) { + try { + if ( flock( $handle, LOCK_SH ) ) { + clearstatcache( true, $path ); + + $contents = fread( $handle, $this->size( $path ) ?: 1 ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fread + + flock( $handle, LOCK_UN ); + } + } finally { + fclose( $handle ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fclose + } + } + + return $contents; + } + + /** + * Get the returned value of a file. + * + * @param string $path + * @param array $data + * @return mixed + * + * @throws File_Not_Found_Exception Thrown on missing file. + */ + public function get_require( $path, array $data = [] ) { + if ( $this->is_file( $path ) ) { + $__path = $path; + $__data = $data; + + return ( static function () use ( $__path, $__data ) { + extract( $__data, EXTR_SKIP ); + + return require $__path; + } )(); + } + + throw new File_Not_Found_Exception( "File does not exist at path {$path}." ); + } + + /** + * Require the given file once. + * + * @param string $path + * @param array $data + * @return mixed + * + * @throws File_Not_Found_Exception Thrown on missing file. + */ + public function require_once( $path, array $data = [] ) { + if ( $this->is_file( $path ) ) { + $__path = $path; + $__data = $data; + + return ( static function () use ( $__path, $__data ) { + extract( $__data, EXTR_SKIP ); + + return require_once $__path; + } )(); + } + + throw new File_Not_Found_Exception( "File does not exist at path {$path}." ); + } + + /** + * Get the MD5 hash of the file at the given path. + * + * @param string $path + * @return string + */ + public function hash( $path ) { + return md5_file( $path ); + } + + /** + * Write the contents of a file. + * + * @param string $path + * @param string $contents + * @param bool $lock + * @return int|bool + */ + public function put( $path, $contents, $lock = false ) { + return file_put_contents( $path, $contents, $lock ? LOCK_EX : 0 ); + } + + /** + * Write the contents of a file, replacing it atomically if it already exists. + * + * @param string $path + * @param string $content + */ + public function replace( $path, $content ): void { + // If the path already exists and is a symlink, get the real path... + clearstatcache( true, $path ); + + $path = realpath( $path ) ?: $path; + + $temp_path = tempnam( dirname( $path ), basename( $path ) ); + + // Fix permissions of tempPath because `tempnam()` creates it with permissions set to 0600... + chmod( $temp_path, 0777 - umask() ); + + file_put_contents( $temp_path, $content ); + + rename( $temp_path, $path ); + } + + /** + * Prepend to a file. + * + * @param string $path + * @param string $data + * @return int + */ + public function prepend( $path, $data ) { + if ( $this->exists( $path ) ) { + return $this->put( $path, $data . $this->get( $path ) ); + } + + return $this->put( $path, $data ); + } + + /** + * Append to a file. + * + * @param string $path + * @param string $data + * @return int + */ + public function append( $path, $data ) { + return file_put_contents( $path, $data, FILE_APPEND ); + } + + /** + * Get or set UNIX mode of a file or directory. + * + * @param string $path + * @param int|null $mode + * @return mixed + */ + public function chmod( $path, $mode = null ) { + if ( $mode ) { + return chmod( $path, $mode ); + } + + return substr( sprintf( '%o', fileperms( $path ) ), -4 ); + } + + /** + * Delete the file at a given path. + * + * @param string|array $paths + * @return bool + */ + public function delete( $paths ) { + $paths = is_array( $paths ) ? $paths : func_get_args(); + + $success = true; + + foreach ( $paths as $path ) { + try { + if ( ! @unlink( $path ) ) { // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged + $success = false; + } + } catch ( ErrorException ) { + $success = false; + } + } + + return $success; + } + + /** + * Move a file to a new location. + * + * @param string $path + * @param string $target + * @return bool + */ + public function move( $path, $target ) { + return rename( $path, $target ); + } + + /** + * Copy a file to a new location. + * + * @param string $path + * @param string $target + * @return bool + */ + public function copy( $path, $target ) { + return copy( $path, $target ); + } + + /** + * Create a symlink to the target file or directory. On Windows, a hard link is created if the target is a file. + * + * @param string $target + * @param string $link + */ + public function link( $target, $link ): void { + $mode = $this->is_directory( $target ) ? 'J' : 'H'; + + exec( "mklink /{$mode} " . escapeshellarg( $link ) . ' ' . escapeshellarg( $target ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.system_calls_exec + } + + /** + * Extract the file name from a file path. + * + * @param string $path + * @return string + */ + public function name( $path ) { + return pathinfo( $path, PATHINFO_FILENAME ); + } + + /** + * Extract the trailing name component from a file path. + * + * @param string $path + * @return string + */ + public function basename( $path ) { + return pathinfo( $path, PATHINFO_BASENAME ); + } + + /** + * Extract the parent directory from a file path. + * + * @param string $path + * @return string + */ + public function dirname( $path ) { + return pathinfo( $path, PATHINFO_DIRNAME ); + } + + /** + * Extract the file extension from a file path. + * + * @param string $path + * @return string + */ + public function extension( $path ) { + return pathinfo( $path, PATHINFO_EXTENSION ); + } + + /** + * Guess the file extension from the mime-type of a given file. + * + * @param string $path + * @return string|null + * + * @throws RuntimeException Thrown on missing extension. + */ + public function guess_extension( $path ) { + if ( ! class_exists( MimeTypes::class ) ) { + throw new RuntimeException( + 'To enable support for guessing extensions, please install the symfony/mime package.' + ); + } + + return ( new MimeTypes() )->getExtensions( $this->mime_type( $path ) )[0] ?? null; + } + + /** + * Guess the class name for a file path. + * + * @param string $path File path. + */ + public function guess_class_name( string $path ): ?string { + $name = $this->name( $path ); + + if ( Str::starts_with( $name, [ 'class-', 'trait-', 'interface-' ] ) ) { + $name = preg_replace( '/^(\w*-)/', '', $name, 1 ); + + return Str::studly_underscore( $name ); + } + + return $name; + } + + /** + * Get the file type of a given file. + * + * @param string $path + * @return string + */ + public function type( $path ) { + return filetype( $path ); + } + + /** + * Get the mime-type of a given file. + * + * @param string $path + * @return string|false + */ + public function mime_type( $path ) { + return finfo_file( finfo_open( FILEINFO_MIME_TYPE ), $path ); + } + + /** + * Get the file size of a given file. + * + * @param string $path + * @return int + */ + public function size( $path ) { + return filesize( $path ); + } + + /** + * Get the file's last modification time. + * + * @param string $path + * @return int + */ + public function last_modified( $path ) { + return filemtime( $path ); + } + + /** + * Determine if the given path is a directory. + * + * @param string $directory + * @return bool + */ + public function is_directory( $directory ) { + return is_dir( $directory ); + } + + /** + * Determine if the given path is readable. + * + * @param string $path + * @return bool + */ + public function is_readable( $path ) { + return is_readable( $path ); + } + + /** + * Determine if the given path is writable. + * + * @param string $path + * @return bool + */ + public function is_writable( $path ) { + return is_writable( $path ); + } + + /** + * Determine if the given path is a file. + * + * @param string $file + * @return bool + */ + public function is_file( $file ) { + return is_file( $file ); + } + + /** + * Find path names matching a given pattern. + * + * @param string $pattern + * @param int $flags + * @return array + */ + public function glob( $pattern, $flags = 0 ) { + return glob( $pattern, $flags ); + } + + /** + * Get an array of all files in a directory. + * + * @param string $directory + * @param bool $hidden + * @return \Symfony\Component\Finder\SplFileInfo[] + */ + public function files( $directory, $hidden = false ) { + return iterator_to_array( + Finder::create()->files()->ignoreDotFiles( ! $hidden )->in( $directory )->depth( 0 )->sortByName(), + false + ); + } + + /** + * Get all of the files from the given directory (recursive). + * + * @param string $directory + * @param bool $hidden + * @return \Symfony\Component\Finder\SplFileInfo[] + */ + public function all_files( $directory, $hidden = false ) { + return iterator_to_array( + Finder::create()->files()->ignoreDotFiles( ! $hidden )->in( $directory )->sortByName(), + false + ); + } + + /** + * Get all of the directories within a given directory. + * + * @param string $directory + */ + public function directories( $directory ): array { + $directories = []; + + foreach ( Finder::create()->in( $directory )->directories()->depth( 0 )->sortByName() as $dir ) { + $directories[] = $dir->getPathname(); + } + + return $directories; + } + + /** + * Ensure a directory exists. + * + * @param string $path + * @param int $mode + * @param bool $recursive + */ + public function ensure_directory_exists( $path, $mode = 0755, $recursive = true ): void { + if ( ! $this->is_directory( $path ) ) { + $this->make_directory( $path, $mode, $recursive ); + } + } + + /** + * Create a directory. + * + * @param string $path + * @param int $mode + * @param bool $recursive + * @return bool + */ + public function make_directory( $path, $mode = 0755, $recursive = false ) { + return mkdir( $path, $mode, $recursive ); + } + + /** + * Move a directory. + * + * @param string $from + * @param string $to + * @param bool $overwrite + */ + public function move_directory( $from, $to, $overwrite = false ): bool { + if ( $overwrite && $this->is_directory( $to ) && ! $this->delete_directory( $to ) ) { + return false; + } + + return @rename( $from, $to ) === true; // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged + } + + /** + * Copy a directory from one location to another. + * + * @param string $directory + * @param string $destination + * @param int|null $options + */ + public function copy_directory( $directory, $destination, $options = null ): bool { + if ( ! $this->is_directory( $directory ) ) { + return false; + } + + $options = $options ?: FilesystemIterator::SKIP_DOTS; + + // If the destination directory does not actually exist, we will go ahead and + // create it recursively, which just gets the destination prepared to copy + // the files over. Once we make the directory we'll proceed the copying. + $this->ensure_directory_exists( $destination, 0777 ); + + $items = new FilesystemIterator( $directory, $options ); + + foreach ( $items as $item ) { + // As we spin through items, we will check to see if the current file is actually + // a directory or a file. When it is actually a directory we will need to call + // back into this function recursively to keep copying these nested folders. + $target = $destination . '/' . $item->getBasename(); + + if ( $item->isDir() ) { + $path = $item->getPathname(); + + if ( ! $this->copy_directory( $path, $target, $options ) ) { + return false; + } + } else { + + // If the current items is just a regular file, we will just copy this to the new + // location and keep looping. If for some reason the copy fails we'll bail out + // and return false, so the developer is aware that the copy process failed. + if ( ! $this->copy( $item->getPathname(), $target ) ) { + return false; + } + } + } + + return true; + } + + /** + * Recursively delete a directory. + * + * The directory itself may be optionally preserved. + * + * @param string $directory + * @param bool $preserve + */ + public function delete_directory( $directory, $preserve = false ): bool { + if ( ! $this->is_directory( $directory ) ) { + return false; + } + + $items = new FilesystemIterator( $directory ); + + foreach ( $items as $item ) { + // If the item is a directory, we can just recurse into the function and + // delete that sub-directory otherwise we'll just delete the file and + // keep iterating through each file until the directory is cleaned. + if ( $item->isDir() && ! $item->isLink() ) { + $this->delete_directory( $item->getPathname() ); + } else { + + // If the item is just a file, we can go ahead and delete it since we're + // just looping through and waxing all of the files in this directory + // and calling directories recursively, so we delete the real path. + $this->delete( $item->getPathname() ); + } + } + + if ( ! $preserve ) { + @rmdir( $directory ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged + } + + return true; + } + + /** + * Remove all of the directories within a given directory. + * + * @param string $directory + */ + public function delete_directories( $directory ): bool { + $all_directories = $this->directories( $directory ); + + if ( ! empty( $all_directories ) ) { + foreach ( $all_directories as $all_directory ) { + $this->delete_directory( $all_directory ); + } + + return true; + } + + return false; + } + + /** + * Empty the specified directory of all files and folders. + * + * @param string $directory + * @return bool + */ + public function clean_directory( $directory ) { + return $this->delete_directory( $directory, true ); + } +} diff --git a/vendor/mantle-framework/filesystem/composer.json b/vendor/mantle-framework/filesystem/composer.json new file mode 100644 index 00000000..147c6feb --- /dev/null +++ b/vendor/mantle-framework/filesystem/composer.json @@ -0,0 +1,34 @@ +{ + "name": "mantle-framework/filesystem", + "description": "The Mantle Framework Filesystem Package", + "type": "library", + "require": { + "php": "^8.1", + "alleyinteractive/composer-wordpress-autoloader": "^1.0", + "league/flysystem": "^1.1.10", + "league/flysystem-cached-adapter": "^1.1", + "mantle-framework/contracts": "^1.0", + "mantle-framework/support": "^1.0", + "psr/container": "^1.1.1 || ^2.0.2", + "symfony/finder": "^6.2", + "symfony/http-foundation": "^6.0.20" + }, + "extra": { + "wordpress-autoloader": { + "autoload": { + "Mantle\\Filesystem": "./" + } + } + }, + "license": "GPL-2.0-or-later", + "authors": [ + { + "name": "Alley", + "email": "mantle@alley.com" + } + ], + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/mantle-framework/filesystem/trait-file-helpers.php b/vendor/mantle-framework/filesystem/trait-file-helpers.php new file mode 100644 index 00000000..68948c2f --- /dev/null +++ b/vendor/mantle-framework/filesystem/trait-file-helpers.php @@ -0,0 +1,56 @@ +<?php +/** + * File_Helpers trait file. + * + * @package Mantle + */ + +namespace Mantle\Filesystem; + +use Mantle\Support\Str; + +/** + * File helpers. + */ +trait File_Helpers { + /** + * The cache copy of the file's hash name. + * + * @var string + */ + protected $hash_name; + + /** + * Get the fully qualified path to the file. + */ + public function path(): string { + return $this->getRealPath(); + } + + /** + * Get the file's extension. + */ + public function extension(): string { + return $this->guessExtension(); + } + + /** + * Get a filename for the file. + * + * @param string|null $path File path. + */ + public function hash_name( string $path = null ): string { + if ( $path ) { + $path = rtrim( $path, '/' ) . '/'; + } + + $hash = $this->hash_name ?: $this->hash_name = Str::random( 40 ); + $extension = $this->guessExtension(); + + if ( $extension ) { + $extension = '.' . $extension; + } + + return $path . $hash . $extension; + } +} diff --git a/vendor/mantle-framework/http-client/LICENSE b/vendor/mantle-framework/http-client/LICENSE new file mode 100644 index 00000000..d159169d --- /dev/null +++ b/vendor/mantle-framework/http-client/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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. + + <signature of Ty Coon>, 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/vendor/mantle-framework/http-client/autoload.php b/vendor/mantle-framework/http-client/autoload.php new file mode 100644 index 00000000..c68b2ef2 --- /dev/null +++ b/vendor/mantle-framework/http-client/autoload.php @@ -0,0 +1,28 @@ +<?php +/** + * Mantle HTTP Client Helpers + * + * Intentionally not Namespaced to allow for root-level access to + * framework methods. + * + * @phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound, Squiz.Commenting.FunctionComment + * + * @package Mantle + */ + +declare( strict_types=1 ); + +use Mantle\Http_Client\Pending_Request; +use Mantle\Http_Client\Response; + +if ( ! function_exists( 'http_client' ) ) { + /** + * Create a new pending request of the the HTTP Client. + * + * @param string|null $url URL to request, optional. + * @return ($url is string ? Response : Pending_Request) + */ + function http_client( ?string $url = null ): Pending_Request|Response { + return $url ? Pending_Request::create()->get( $url ) : Pending_Request::create(); + } +} diff --git a/vendor/mantle-framework/http-client/class-factory.php b/vendor/mantle-framework/http-client/class-factory.php new file mode 100644 index 00000000..4a124f9d --- /dev/null +++ b/vendor/mantle-framework/http-client/class-factory.php @@ -0,0 +1,65 @@ +<?php +/** + * Factory class file + * + * @package Mantle + */ + +namespace Mantle\Http_Client; + +use Mantle\Support\Traits\Macroable; + +/** + * Http Client factory. + * + * @mixin \Mantle\Http_Client\Pending_Request + */ +class Factory { + use Macroable { + __call as macro_call; + } + + /** + * Create a new pending request. + */ + public static function create(): Pending_Request { + return ( new static() )->new_pending_request(); + } + + /** + * Generate a new pending request. + */ + protected function new_pending_request(): Pending_Request { + return new Pending_Request(); + } + + /** + * Forward the call to a new pending request. + * + * @param string $method Method name. + * @param array $parameters Method parameters. + * @return Response|Pending_Request|mixed + */ + public function __call( string $method, array $parameters ) { + if ( static::has_macro( $method ) ) { + return $this->macro_call( $method, $parameters ); + } + + return $this->new_pending_request()->{$method}( ...$parameters ); + } + + /** + * Forward a static call to a new pending request. + * + * @param string $method Method name. + * @param array $parameters Method parameters. + * @return Response|Pending_Request|Pool|mixed + */ + public static function __callStatic( string $method, array $parameters ) { + if ( static::has_macro( $method ) ) { + return ( new static() )->macro_call( $method, $parameters ); + } + + return ( new static() )->{$method}( ...$parameters ); + } +} diff --git a/vendor/mantle-framework/http-client/class-http-client-exception.php b/vendor/mantle-framework/http-client/class-http-client-exception.php new file mode 100644 index 00000000..d4b6f452 --- /dev/null +++ b/vendor/mantle-framework/http-client/class-http-client-exception.php @@ -0,0 +1,23 @@ +<?php +/** + * Http_Client_Exception class file + * + * @package Mantle + */ + +namespace Mantle\Http_Client; + +use Exception; + +/** + * HTTP Client exception. + */ +class Http_Client_Exception extends Exception { + /** + * Constructor. + * + * @param Response $response Http Response. + */ + public function __construct( public Response $response ) { + } +} diff --git a/vendor/mantle-framework/http-client/class-http-client.php b/vendor/mantle-framework/http-client/class-http-client.php new file mode 100644 index 00000000..28149fd4 --- /dev/null +++ b/vendor/mantle-framework/http-client/class-http-client.php @@ -0,0 +1,24 @@ +<?php +/** + * Http_Client class file + * + * @package Mantle + */ + +namespace Mantle\Http_Client; + +/** + * Http Request Client + * + * @deprecated Use \Mantle\Http_Client\Factory instead. + */ +class Http_Client { + /** + * Create an instance of the Http Client + * + * @return Factory + */ + public static function create() { + return new Factory(); + } +} diff --git a/vendor/mantle-framework/http-client/class-pending-request.php b/vendor/mantle-framework/http-client/class-pending-request.php new file mode 100644 index 00000000..cebbbb92 --- /dev/null +++ b/vendor/mantle-framework/http-client/class-pending-request.php @@ -0,0 +1,699 @@ +<?php +/** + * Pending_Request class file + * + * @package Mantle + */ + +namespace Mantle\Http_Client; + +use Mantle\Support\Pipeline; +use Mantle\Support\Traits\Conditionable; +use Mantle\Support\Traits\Macroable; + +use function Mantle\Support\Helpers\retry; +use function Mantle\Support\Helpers\tap; + +/** + * Pending Request to be made with the Http Client. + */ +class Pending_Request { + use Conditionable, Macroable; + + /** + * Base URL for the request. + */ + protected string $base_url = ''; + + /** + * Method for the request. + */ + public string $method; + + /** + * URL for the request. + */ + protected string $url; + + /** + * Options for the request. + */ + protected array $options = []; + + /** + * Pending body for the request. + * + * @var mixed + */ + protected $pending_body; + + /** + * Pending files for the request. + */ + protected array $pending_files = []; + + /** + * Body format. + */ + protected string $body_format; + + /** + * Middleware for the request. + */ + protected array $middleware = []; + + /** + * Flag if the request is for a pooled request. + */ + protected bool $pooled = false; + + /** + * Create an instance of the Http Client + * + * @return static + */ + public static function create() { + return new static(); + } + + /** + * Constructor. + */ + public function __construct() { + $this->as_json(); + } + + /** + * Indicate the request contains form parameters. + */ + public function as_form(): static { + return $this + ->body_format( 'form' ) + ->content_type( 'application/x-www-form-urlencoded' ); + } + + /** + * Indicate the request contains JSON. + */ + public function as_json(): static { + return $this + ->body_format( 'json' ) + ->content_type( 'application/json' ); + } + + /** + * Set the base URL for the pending request. + * + * @param string $url Base URL. + */ + public function base_url( string $url ): static { + $this->base_url = $url; + + return $this; + } + + /** + * Set or get the URL for the request. + * + * @param string $url URL for the request, optional. + * @return static|string + */ + public function url( string $url = null ) { + if ( is_null( $url ) ) { + return $this->url; + } + + $this->url = $url; + + return $this; + } + + /** + * Set or get the method for the request. + * + * @param string $method Http Method for the request, optional. + * @return static|string + */ + public function method( string $method = null ) { + if ( is_null( $method ) ) { + return $this->method; + } + + $this->method = $method; + + return $this; + } + + /** + * Attach a raw body to the request. + * + * @param string $content Content to attach. + * @param string $content_type Content mime type. + */ + public function with_body( string $content, string $content_type ): static { + $this->body_format( 'body' ); + + $this->pending_body = $content; + + $this->content_type( $content_type ); + + return $this; + } + + /** + * Attach JSON data to the request. + * + * @param array $data Data to attach. + */ + public function with_json( array $data ): static { + $this->as_json(); + + $this->options[ $this->body_format ] = $data; + + return $this; + } + + /** + * Retrieve the body for the request. + */ + public function body(): mixed { + return $this->options[ $this->body_format ] ?? $this->pending_body; + } + + /** + * Pass raw options to the request (passed to `wp_remote_request()`). + * + * @param array $options Options for the request. + * @param bool $merge Merge the options with the existing options, default true. + */ + public function with_options( array $options, bool $merge = true ): static { + if ( $merge ) { + $this->options['options'] = array_merge( + $this->options['options'] ?? [], + $options + ); + } else { + $this->options['options'] = $options; + } + + return $this; + } + + /** + * Specify the body format for the request + * + * @param string $format Body format. + * @return static + */ + public function body_format( string $format ) { + $this->body_format = $format; + return $this; + } + + /** + * Specify the request's content type. + * + * @param string $content_type Content type. + */ + public function content_type( string $content_type ): static { + return $this->with_header( 'Content-Type', $content_type, true ); + } + + /** + * Indicate that JSON should be returned by the server. + */ + public function accept_json(): static { + return $this->accept( 'application/json' ); + } + + /** + * Indicate the type of content that should be returned by the server. + * + * @param string $content_type Content type. + */ + public function accept( $content_type ): static { + return $this->with_headers( [ 'Accept' => $content_type ] ); + } + + /** + * Add the given headers to the request. + * + * @param array<string, mixed> $headers Headers to add. + */ + public function with_headers( array $headers ): static { + $this->options = array_merge_recursive( + $this->options, + [ + 'headers' => $headers, + ] + ); + + return $this; + } + + /** + * Add a specific header to the request. + * + * @param string $key Header key. + * @param mixed $value Header value. + * @param bool $replace Replace the existing header, defaults to false. + */ + public function with_header( string $key, $value, bool $replace = false ): static { + if ( $replace && isset( $this->options['headers'][ $key ] ) ) { + unset( $this->options['headers'][ $key ] ); + } + + return $this->with_headers( [ $key => $value ] ); + } + + /** + * Retrieve the headers for the request. + * + * @return array<string, mixed> + */ + public function headers(): array { + return $this->options['headers'] ?? []; + } + + /** + * Clear the headers for the request. + */ + public function clear_headers(): static { + $this->options['headers'] = []; + + return $this; + } + + /** + * Retrieve a specific header for the request. + * + * @param string $key Header key. + */ + public function header( string $key ): mixed { + return $this->headers()[ $key ] ?? null; + } + + /** + * Specify the basic authentication username and password for the request. + * + * @param string $username Username. + * @param string $password Password. + */ + public function with_basic_auth( string $username, string $password ): static { + return $this->with_header( + 'Authorization', + 'Basic ' . base64_encode( $username . ':' . $password ) + ); + } + + /** + * Specify an authorization token for the request. + * + * @param string $token + * @param string $type + */ + public function with_token( string $token, string $type = 'Bearer' ): static { + return $this->with_header( 'Authorization', trim( $type . ' ' . $token ) ); + } + + /** + * Specify the user agent for the request. + * + * @param string $user_agent User agent to set. + */ + public function with_user_agent( string $user_agent ): static { + $this->options['user-agent'] = $user_agent; + return $this; + } + + /** + * Clear the cookies included with the request. + */ + public function clear_cookies(): static { + $this->options['cookies'] = []; + return $this; + } + + /** + * Specify the cookies that should be included with the request. + * + * @param \WP_Http_Cookie[] $cookies Cookies to pass. + */ + public function with_cookies( array $cookies ): static { + $this->options['cookies'] = array_merge_recursive( + $this->options['cookies'] ?? [], + $cookies, + ); + + return $this; + } + + /** + * Specify a single cookie that should be included with the request. + * + * @param \WP_Http_Cookie $cookie Cookie to include. + */ + public function with_cookie( \WP_Http_Cookie $cookie ): static { + return $this->with_cookies( [ $cookie ] ); + } + + /** + * Indicate that redirects should not be followed. + */ + public function without_redirecting(): static { + $this->options['allow_redirects'] = false; + return $this; + } + + /** + * Indicate that redirects should be followed. + * + * @param int $times Number of redirects to allow. + */ + public function with_redirecting( int $times = 5 ): static { + $this->options['allow_redirects'] = $times; + return $this; + } + + /** + * Indicate that TLS certificates should not be verified. + */ + public function without_verifying(): static { + $this->options['verify'] = false; + return $this; + } + + /** + * Specify the timeout (in seconds) for the request. + * + * @param int $seconds + */ + public function timeout( int $seconds ): static { + $this->options['timeout'] = $seconds; + return $this; + } + + /** + * Add middleware for the request. + * + * @param callable $middleware Middleware to call. + */ + public function middleware( $middleware ): static { + $this->middleware[] = $middleware; + return $this; + } + + /** + * Clear all middleware for the request. + */ + public function without_middleware(): static { + $this->middleware = []; + return $this; + } + + /** + * Stream the response body to a file. + * + * @param string|null $file File to stream to, optional. + */ + public function stream( string $file = null ): static { + return $this->with_options( + [ + 'filename' => $file, + 'stream' => true, + ] + ); + } + + /** + * Don't stream the response body to a file. + */ + public function dont_stream(): static { + return $this->with_options( [ 'stream' => false ] ); + } + + /** + * Number of times to retry a failed request. + * + * @param int $retry Number of retries. + * @param int $delay Number of milliseconds to delay between retries, defaults to none. + */ + public function retry( int $retry, int $delay = 0 ): static { + $this->options['retry'] = $retry; + $this->options['delay'] = $delay; + + return $this; + } + + /** + * Flag to throw an Http_Client_Exception on failure. + */ + public function throw_exception(): static { + $this->options['throw_exception'] = true; + return $this; + } + + /** + * Flag to not throw an Http_Client_Exception on failure. + */ + public function dont_throw_exception(): static { + $this->options['throw_exception'] = false; + + return $this; + } + + /** + * Issue a GET request to the given URL. + * + * @param string $url URL to retrieve. + * @param array|string|null $query Query parameters (assumed to be urlencoded). + * @return Response|static + */ + public function get( string $url, array|string|null $query = null ) { + return $this->send( + 'GET', + $url, + ! is_null( $query ) ? [ 'query' => $query ] : [], + ); + } + + /** + * Issue a HEAD request to the given URL. + * + * @param string $url + * @param array|string|null $query + * @return Response|static + */ + public function head( string $url, array|string|null $query = null ) { + return $this->send( + 'HEAD', + $url, + ! is_null( $query ) ? [ 'query' => $query ] : [], + ); + } + + /** + * Issue a POST request to the given URL. + * + * @param string $url + * @param array $data + * @return Response|static + */ + public function post( string $url, ?array $data = null ) { + return $this->send( + 'POST', + $url, + ! is_null( $data ) ? [ $this->body_format => $data ] : [], + ); + } + + /** + * Issue a PATCH request to the given URL. + * + * @param string $url + * @param array $data + * @return Response|static + */ + public function patch( string $url, ?array $data = null ) { + return $this->send( + 'PATCH', + $url, + ! is_null( $data ) ? [ $this->body_format => $data ] : [], + ); + } + + /** + * Issue a PUT request to the given URL. + * + * @param string $url + * @param array $data + * @return Response|static + */ + public function put( string $url, ?array $data = null ) { + return $this->send( + 'PUT', + $url, + ! is_null( $data ) ? [ $this->body_format => $data ] : [], + ); + } + + /** + * Issue a DELETE request to the given URL. + * + * @param string $url + * @param array $data + * @return Response|static + */ + public function delete( string $url, ?array $data = [] ) { + return $this->send( + 'DELETE', + $url, + ! is_null( $data ) ? [ $this->body_format => $data ] : [], + ); + } + + /** + * Issue a single request to the given URL. + * + * @param string $method HTTP Method. + * @param string $url URL for the request. + * @param array $options Options for the request. + * @return Response|static + */ + public function send( string $method, string $url, array $options = [] ) { + $this->url = ltrim( rtrim( $this->base_url, '/' ) . '/' . ltrim( $url, '/' ), '/' ); + $this->options = array_merge( $this->options, $options ); + $this->method = $method; + + // Ensure some options are always set. + $this->options['throw_exception'] ??= false; + $this->options['retry'] = max( 1, $this->options['retry'] ?? 1 ); + + $this->prepare_request_url(); + + // If this is a pooled request, return the instance of the request. + if ( $this->pooled ) { + return $this; + } + + return retry( + $this->options['retry'], + function( int $attempts ) { + $response = ( new Pipeline() ) + ->send( $this ) + ->through( $this->middleware ) + ->then( + fn () => Response::create( + wp_remote_request( + $this->url, + $this->get_request_args(), + ), + ), + ); + + // Throw the exception if the request is being retried (so it can be + // retried) or if configured to always throw the exception. + if ( + ! $response->successful() + && ( + $this->options['throw_exception'] + || $attempts < $this->options['retry'] + ) + ) { + throw new Http_Client_Exception( $response ); + } + + return $response; + }, + $this->options['retry_delay'] ?? 0, + ); + } + + /** + * Determine if this is a pooled request. + * + * @param bool $pooled Whether this is a pooled request. + */ + public function pooled( bool $pooled = true ): static { + $this->pooled = $pooled; + + return $this; + } + + /** + * Create a pool request from the current pending request. + * + * @param callable $callback Callback to build the HTTP pool. + * @return array<int|string, Response> + */ + public function pool( callable $callback ): array { + return tap( new Pool( $this ), $callback )->results(); + } + + /** + * Prepare the request URL. + */ + protected function prepare_request_url(): void { + if ( isset( $this->options['query'] ) ) { + if ( is_array( $this->options['query'] ) ) { + $this->url = add_query_arg( $this->options['query'], $this->url ); + } elseif ( is_string( $this->options['query'] ) ) { + // Append the string query string. + $this->url = "{$this->url}?{$this->options['query']}"; + } + } + } + + /** + * Prepare the request arguments to pass to `wp_remote_request()`. + */ + public function get_request_args(): array { + if ( isset( $this->options[ $this->body_format ] ) ) { + if ( 'body' === $this->body_format ) { + $this->options[ $this->body_format ] = $this->pending_body; + } + + if ( is_array( $this->options[ $this->body_format ] ) ) { + $this->options[ $this->body_format ] = array_merge( + $this->options[ $this->body_format ], + $this->pending_files + ); + } + } else { + $this->options[ $this->body_format ] = $this->pending_body; + } + + // Set some default arguments. + if ( ! isset( $this->options['allow_redirects'] ) ) { + $this->options['allow_redirects'] = true; + } elseif ( true === $this->options['allow_redirects'] ) { + $this->options['allow_redirects'] = 5; + } + + $args = [ + 'cookies' => $this->options['cookies'] ?? [], + 'headers' => $this->options['headers'] ?? [], + 'method' => $this->method, + 'redirection' => $this->options['allow_redirects'], + 'sslverify' => $this->options['verify'] ?? true, + 'timeout' => $this->options['timeout'] ?? 5, + ]; + + switch ( $this->body_format ) { + case 'json': + if ( isset( $this->options[ $this->body_format ] ) ) { + $args['body'] = wp_json_encode( $this->options[ $this->body_format ] ); + } + + break; + default: + if ( isset( $this->options[ $this->body_format ] ) ) { + $args['body'] = $this->options[ $this->body_format ]; + } + + break; + } + + return array_merge( $args, $this->options['options'] ?? [] ); + } +} diff --git a/vendor/mantle-framework/http-client/class-pool.php b/vendor/mantle-framework/http-client/class-pool.php new file mode 100644 index 00000000..010a2846 --- /dev/null +++ b/vendor/mantle-framework/http-client/class-pool.php @@ -0,0 +1,93 @@ +<?php +/** + * Pool class file + * + * @package Mantle + */ + +namespace Mantle\Http_Client; + +use function Alley\WP\Concurrent_Remote_Requests\wp_remote_request; + +/** + * Http Pool for making requests concurrently. + * + * @mixin \Mantle\Http_Client\Pending_Request + */ +class Pool { + /** + * Pool of pending requests. + * + * @var array<string|int, Pending_Request> + */ + protected array $pool = []; + + /** + * Constructor. + * + * @param Pending_Request $base_request + */ + public function __construct( protected Pending_Request $base_request ) { + } + + /** + * Create a pending request for the pool + */ + protected function create_request(): Pending_Request { + return ( clone $this->base_request )->pooled(); + } + + /** + * Retrieve the requests for the given pool + * + * @throws Http_Client_Exception Thrown in error in response from wp_remote_request(). + * @return array<int|string, Response> + */ + public function results(): array { + // Execute the pool of requests. + $results = wp_remote_request( + array_map( + fn ( Pending_Request $request ) => [ + $request->url(), + $request->get_request_args(), + ], + $this->pool, + ) + ); + + if ( is_wp_error( $results ) ) { + throw new Http_Client_Exception( Response::create( $results ) ); + } + + return array_map( + fn ( array $result ) => Response::create( $result ), + $results, + ); + } + + /** + * Call a pending request a specific index name. + * + * @param string $key The name of the pending request. + */ + public function as( string $key ): Pending_Request { + $this->pool[ $key ] = $this->create_request(); + + return $this->pool[ $key ]; + } + + /** + * Add a request to the pool with a numeric index. + * + * @param string $method Method name. + * @param array $args Arguments for the method. + * @return Pending_Request + */ + public function __call( string $method, array $args = [] ) { + $request = $this->create_request()->{$method}( ...$args ); + + $this->pool[] = $request; + + return $request; + } +} diff --git a/vendor/mantle-framework/http-client/class-request.php b/vendor/mantle-framework/http-client/class-request.php new file mode 100644 index 00000000..92a7deb5 --- /dev/null +++ b/vendor/mantle-framework/http-client/class-request.php @@ -0,0 +1,149 @@ +<?php +/** + * Request class file + * + * @package Mantle + */ + +namespace Mantle\Http_Client; + +use Mantle\Support\Str; + +use function Mantle\Support\Helpers\data_get; + +/** + * Request Record + * + * Used to store a request that was made via the WordPress HTTP API that can be + * asserted against. + */ +class Request { + /** + * Constructor + * + * @param array $args Arguments of the request. + * @param string $url URL of the request. + */ + public function __construct( protected array $args, protected string $url ) { + // Format the headers to be lowercase. + $this->args['headers'] = array_change_key_case( $this->args['headers'] ?? [] ); + } + + /** + * Retrieve the URL of the request. + */ + public function url(): string { + return $this->url; + } + + /** + * Retrieve the method of the request. + * The method is always uppercase. + */ + public function method(): string { + return strtoupper( $this->args['method'] ?? '' ); + } + + /** + * Check if the request has a set of headers. + * + * @param array $headers Headers to check for. + */ + public function has_headers( array $headers ): bool { + foreach ( $headers as $key => $value ) { + if ( ! $this->has_header( $key, $value ) ) { + return false; + } + } + + return true; + } + + /** + * Determine if the request has a given header. + * + * @param string $header Header to compare. + * @param mixed $value Header value to compare, optional. + * @return boolean + */ + public function has_header( string $header, $value = null ) { + $header = strtolower( $header ); + + if ( is_null( $value ) ) { + return isset( $this->args['headers'][ $header ] ); + } + + return isset( $this->args['headers'][ $header ] ) && $value === $this->args['headers'][ $header ]; + } + + /** + * Retrieve the value of a header. + * + * @param string $header Header to retrieve. + * @return mixed + */ + public function header( string $header ) { + $header = strtolower( $header ); + + return $this->args['headers'][ $header ] ?? null; + } + + /** + * Retrieve the body of the request. + */ + public function body(): string { + return $this->args['body'] ?? ''; + } + + /** + * Retrieve the JSON decoded body of the request. + * + * @return array|null + */ + public function json() { + return json_decode( $this->body(), true ); + } + + /** + * Determine if the request is simple form data. + */ + public function is_form(): bool { + return $this->has_header( 'Content-Type', 'application/x-www-form-urlencoded' ); + } + + /** + * Determine if the request is JSON. + */ + public function is_json(): bool { + return $this->has_header( 'Content-Type' ) + && Str::contains( $this->header( 'Content-Type' ), 'json' ); + } + + /** + * Retrieve a specific value from the request. + * + * @param string $key Key to retrieve. + * @return mixed + */ + public function get( string $key ) { + return data_get( $this->args, $key ); + } + + /** + * Dump the request to the screen. + * + * @return static + */ + public function dump() { + dump( $this->args, $this->url ); + return $this; + } + + /** + * Dump the request to the screen and die. + */ + public function dd(): void { + $this->dump(); + exit( 1 ); + } +} diff --git a/vendor/mantle-framework/http-client/class-response.php b/vendor/mantle-framework/http-client/class-response.php new file mode 100644 index 00000000..b0aefb74 --- /dev/null +++ b/vendor/mantle-framework/http-client/class-response.php @@ -0,0 +1,399 @@ +<?php +/** + * Response class file. + * + * @package Mantle + */ + +namespace Mantle\Http_Client; + +use ArrayAccess; +use InvalidArgumentException; +use LogicException; +use Mantle\Support\Collection; +use Mantle\Support\Traits\Macroable; +use SimpleXMLElement; +use WP_Error; +use WP_Http_Cookie; +use WpOrg\Requests\Utility\CaseInsensitiveDictionary; + +use function Mantle\Support\Helpers\collect; +use function Mantle\Support\Helpers\data_get; + +/** + * Response object from WordPress HTTP API. + */ +class Response implements ArrayAccess { + use Macroable; + + /** + * The decoded JSON response. + */ + protected ?array $decoded = null; + + /** + * The decoded XML Element response. + */ + protected ?SimpleXMLElement $element = null; + + /** + * Constructor. + * + * @param array $response Raw response from `wp_remote_request()`. + */ + public function __construct( protected array $response ) { + // Serialize the headers from a CaseInsensitiveDictionary to an array. + if ( isset( $this->response['headers'] ) && $this->response['headers'] instanceof CaseInsensitiveDictionary ) { + $this->response['headers'] = $this->response['headers']->getAll(); + } + + // Format the headers to be lower-case. + $this->response['headers'] = array_change_key_case( (array) ( $this->response['headers'] ?? [] ) ); + } + + /** + * Create a response object from a `wp_remote_request()` response. + * + * @throws InvalidArgumentException If the response is not an array or WP_Error. + * @param array|WP_Error $response Raw response from `wp_remote_request()`. + * @return static + */ + public static function create( $response ) { + if ( is_array( $response ) ) { + return new static( $response ); + } + + if ( $response instanceof WP_Error ) { + return static::create_from_wp_error( $response ); + } + } + + /** + * Create a response from a WP_Error object. + * + * @param WP_Error $error WP_Error object. + * @return static + */ + protected static function create_from_wp_error( WP_Error $error ) { + return new static( + [ + 'body' => $error->get_error_message(), + 'headers' => [], + 'is_wp_error' => true, + 'response' => [ + 'code' => $error->get_error_code() ?: 500, + ], + ], + ); + } + + /** + * Retrieve the raw response from `wp_remote_request()`. + */ + public function response(): array { + return $this->response; + } + + /** + * Retrieve all the headers from a response. + */ + public function headers(): array { + return (array) ( $this->response['headers'] ?? [] ); + } + + /** + * Retrieve a specific header (headers are case-insensitive). + * + * @param string $header Header to retrieve. + * @return mixed + */ + public function header( string $header ) { + $header = strtolower( $header ); + return $this->headers()[ $header ] ?? null; + } + + /** + * Retrieve the status code for the response. + */ + public function status(): int { + return (int) ( $this->response['response']['code'] ?? 0 ); + } + + /** + * Determine if the request was successful. + */ + public function successful(): bool { + return $this->status() >= 200 && $this->status() < 300; + } + + /** + * Determine if the response code was "OK". + */ + public function ok(): bool { + return $this->status() === 200; + } + + /** + * Determine if the response code was not found (404). + */ + public function not_found(): bool { + return $this->status() === 404; + } + + /** + * Determine if the response was a redirect. + */ + public function redirect(): bool { + return $this->status() >= 300 && $this->status() < 400; + } + + /** + * Determine if the response was a 401 "Unauthorized" response. + */ + public function unauthorized(): bool { + return $this->status() === 401; + } + + /** + * Determine if the response was a 403 "Forbidden" response. + */ + public function forbidden(): bool { + return $this->status() === 403; + } + + /** + * Determine if the response indicates a client or server error occurred. + */ + public function failed(): bool { + return $this->server_error() || $this->client_error() || $this->is_wp_error(); + } + + /** + * Determine if the response indicates a client error occurred. + */ + public function client_error(): bool { + return $this->status() >= 400 && $this->status() < 500; + } + + /** + * Determine if the response indicates a server error occurred. + */ + public function server_error(): bool { + return $this->status() >= 500; + } + + /** + * Check if the error was an WP_Error. + */ + public function is_wp_error(): bool { + return ! empty( $this->response['is_wp_error'] ); + } + + /** + * Check if the response is JSON. + */ + public function is_json(): bool { + if ( false !== strpos( (string) $this->header( 'content-type' ), 'application/json' ) ) { + return true; + } + + return ! empty( $this->json() ); + } + + /** + * Check if the response is XML. Does not validate if the response is a valid + * XML document. + */ + public function is_xml(): bool { + if ( false !== strpos( (string) $this->header( 'content-type' ), 'application/xml' ) ) { + return true; + } + + return str_starts_with( trim( strtolower( $this->body() ) ), '<?xml' ); + } + + /** + * Check if the response body is a file download (a Binary Large OBject). + */ + public function is_blob(): bool { + return false === mb_detect_encoding( $this->body(), 'UTF-8', true ) && ! ctype_print( $this->body() ); + } + + /** + * Check if the response is a file download. + */ + public function is_file(): bool { + return ! empty( $this->response['filename'] ) && $this->is_blob(); + } + + /** + * Get the raw body of the response. + * + * @return string + */ + public function body() { + return (string) ( $this->response['body'] ?? '' ); + } + + /** + * Retrieve the file path to the downloaded file. + */ + public function file(): ?string { + return $this->response['filename'] ?? null; + } + + /** + * Retrieve the file contents of the downloaded file. + */ + public function file_contents(): ?string { + return ! empty( $this->response['filename'] ) ? file_get_contents( $this->file() ) : null; // phpcs:ignore WordPressVIPMinimum.Performance.FetchingRemoteData.FileGetContentsUnknown + } + + /** + * Get the JSON decoded body of the response as an array or scalar value. + * + * @param string|null $key + * @param mixed $default + * @return mixed + */ + public function json( $key = null, $default = null ) { + if ( ! isset( $this->decoded ) ) { + $this->decoded = json_decode( $this->body(), true ); + } + + if ( is_null( $key ) ) { + return $this->decoded; + } + + return data_get( $this->decoded, $key, $default ); + } + + /** + * Get the XML body of the response. + * + * @param string $xpath Path to pass to `SimpleXMLElement::xpath()`, optional. + * @param string $default Default value to return if the path does not exist. + * @return SimpleXMLElement|string|null Returns a specific SimpleXMLElement if path is specified, otherwise the entire document. + */ + public function xml( string $xpath = null, $default = null ) { + if ( ! isset( $this->element ) ) { + $previous = libxml_use_internal_errors( true ); + + $this->element = new SimpleXMLElement( $this->body() ); + + // Restore the former error level. + libxml_use_internal_errors( $previous ); + } + + if ( ! $xpath ) { + return $this->element; + } + + return $this->element->xpath( $xpath ) ?: $default; + } + + /** + * Get the JSON decoded body of the response as an object. + * + * @return object + */ + public function object() { + return json_decode( $this->body(), false ); + } + + /** + * Get the JSON decoded body of the response as a collection. + * + * @param string|null $key + * @return Collection + */ + public function collect( $key = null ) { + return Collection::make( $this->json( $key ) ); + } + + /** + * Retrieve the cookies from the response. + * + * @return WP_Http_Cookie[] + */ + public function cookies(): array { + return $this->response['cookies'] ?? []; + } + + /** + * Retrieve a specific cookie by name. + * + * @param string $name Cookie name. + */ + public function cookie( string $name ): ?WP_Http_Cookie { + return collect( $this->cookies() ) + ->key_by( 'name' ) + ->get( $name ); + } + + /** + * Dump the response to the screen. + * + * @return static + */ + public function dump() { + dump( $this->response ); + return $this; + } + + /** + * Dump the response to the screen and exit. + */ + public function dd(): void { + $this->dump(); + exit( 1 ); + } + + /** + * Check if an attribute exists on the response. + * + * @param mixed $offset Offset to check. + */ + public function offsetExists( mixed $offset ): bool { + if ( $this->is_xml() ) { + return isset( $this->xml()[ $offset ] ); + } + + return isset( $this->json()[ $offset ] ); + } + + /** + * Retrieve an attribute from the response. + * + * @param mixed $offset Offset to get. + */ + public function offsetGet( mixed $offset ): mixed { + if ( $this->is_xml() ) { + return $this->xml()->{ $offset }; + } + + return $this->json()[ $offset ]; + } + + /** + * Set an attribute on the response. + * + * @throws LogicException Not supported on responses. + * + * @param mixed $offset Offset. + * @param mixed $value Value. + */ + public function offsetSet( mixed $offset, mixed $value ): void { + throw new LogicException( 'Response values are read-only.' ); + } + + /** + * Remove an attribute from the response. + * + * @throws LogicException Not supported on responses. + * @param mixed $offset Offset. + */ + public function offsetUnset( mixed $offset ): void { + throw new LogicException( 'Response values are read-only.' ); + } +} diff --git a/vendor/mantle-framework/http-client/composer.json b/vendor/mantle-framework/http-client/composer.json new file mode 100644 index 00000000..09be35d7 --- /dev/null +++ b/vendor/mantle-framework/http-client/composer.json @@ -0,0 +1,33 @@ +{ + "name": "mantle-framework/http-client", + "description": "The Mantle Framework Http Client Package", + "type": "library", + "require": { + "php": "^8.1", + "alleyinteractive/wp-concurrent-remote-requests": "^1.0.2", + "mantle-framework/support": "^1.0" + }, + "extra": { + "wordpress-autoloader": { + "autoload": { + "Mantle\\Http_Client": "./" + } + } + }, + "autoload": { + "files": [ + "autoload.php" + ] + }, + "license": "GPL-2.0-or-later", + "authors": [ + { + "name": "Alley", + "email": "mantle@alley.com" + } + ], + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/mantle-framework/http/LICENSE b/vendor/mantle-framework/http/LICENSE new file mode 100644 index 00000000..d159169d --- /dev/null +++ b/vendor/mantle-framework/http/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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. + + <signature of Ty Coon>, 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/vendor/mantle-framework/http/autoload.php b/vendor/mantle-framework/http/autoload.php new file mode 100644 index 00000000..097f17eb --- /dev/null +++ b/vendor/mantle-framework/http/autoload.php @@ -0,0 +1,258 @@ +<?php +/** + * Mantle HTTP Helpers + * + * Intentionally not Namespaced to allow for root-level access to + * framework methods. + * + * @phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound, Squiz.Commenting.FunctionComment + * + * @package Mantle + */ + +declare( strict_types=1 ); + +use Mantle\Contracts\Http\Routing\Response_Factory; +use Mantle\Contracts\Http\View\Factory as View_Factory; +use Mantle\Http\View\View; +use Symfony\Component\Routing\Generator\UrlGenerator; + +if ( ! function_exists( 'response' ) ) { + /** + * Return a new response for the application. + * + * @param string $content Response content, optional. + * @param int $status Response status code, optional. + * @param array $headers Response headers, optional. + * @return Response_Factory + */ + function response( ...$args ) { + $factory = app( Response_Factory::class ); + if ( empty( $args ) ) { + return $factory; + } + + return $factory->make( ...$args ); + } +} + +if ( ! function_exists( 'redirect' ) ) { + /** + * Get an instance of the redirector. + * + * @param string|null $to URL to redirect to, optional. + * @param int $status Status code, optional. + * @param array $headers Headers, optional. + * @param bool|null $secure Whether the redirect should be secure, optional. + * @return \Mantle\Http\Routing\Redirector + */ + function redirect( ?string $to = null, int $status = 302, array $headers = [], ?bool $secure = null ) { + if ( is_null( $to ) ) { + return app( 'redirect' ); + } + + return app( 'redirect' )->to( $to, $status, $headers, $secure ); + } +} + +if ( ! function_exists( 'request' ) ) { + /** + * Get an instance of the current request or an input item from the request. + * + * @param array|string|null $key Request key. + * @param mixed $default Default value. + * @return \Mantle\Http\Request|string|array|null + */ + function request( $key = null, $default = null ) { + if ( is_null( $key ) ) { + return app( 'request' ); + } + + if ( is_array( $key ) ) { + return app( 'request' )->only( $key ); + } + + $value = app( 'request' )->__get( $key ); + + return is_null( $value ) ? value( $default ) : $value; + } +} + +if ( ! function_exists( 'view' ) ) { + /** + * Return a new view. + * + * @param string $slug View slug. + * @param array|string $name View name, optional. Supports passing variables in if + * $variables is not used. + * @return View|View_Factory + */ + function view( ...$args ) { + $factory = app( View_Factory::class ); + if ( empty( $args ) ) { + return $factory; + } + + return $factory->make( ...$args ); + } +} + +if ( ! function_exists( 'render_view' ) ) { + /** + * Render a new view. + * + * @param string $slug View slug. + * @param array|string $name View name, optional. Supports passing variables in if + * $variables is not used. + */ + function render_view( ...$args ): void { + echo view( ...$args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + } +} + +if ( ! function_exists( 'render_main_template' ) ) { + /** + * Render the contents of the main template passed to the wrapper. + * + * The contents of the '_mantle_contents' variable are assumed to be pre-sanitized. + */ + function render_main_template(): void { + echo mantle_get_var( '_mantle_contents' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + } +} + +if ( ! function_exists( 'loop' ) ) { + /** + * Loop over a collection/array of posts. + * + * @param \ArrayAccess|array $data Data to loop over. + * @param string $slug View slug. + * @param array|string $name View name, optional. Supports passing variables in if + * $variables is not used. + * @return string + */ + function loop( ...$args ) { + return view() + ->loop( ...$args ) + ->map( fn ( View $item ) => $item->render() ) + ->implode( '' ); + } +} + +if ( ! function_exists( 'render_loop' ) ) { + /** + * Render the loop() function. + * + * @param \ArrayAccess|array $data Data to loop over. + * @param string $slug View slug. + * @param array|string $name View name, optional. Supports passing variables in if + * $variables is not used. + */ + function render_loop( ...$args ): void { + echo loop( ...$args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + } +} + +if ( ! function_exists( 'iterate' ) ) { + /** + * Iterate over an array of arbitrary items, passing the index and item to a + * given template part. + * + * @param \ArrayAccess|array $data Data to loop over. + * @param string $slug View slug. + * @param array|string $name View name, optional. Supports passing variables in if + * $variables is not used. + * @return string + */ + function iterate( ...$args ) { + return view() + ->iterate( ...$args ) + ->map( fn ( View $item ) => $item->render() ) + ->implode( '' ); + } +} + +if ( ! function_exists( 'render_iterate' ) ) { + /** + * Render over iterate(). + * + * @param \ArrayAccess|array $data Data to loop over. + * @param string $slug View slug. + * @param array|string $name View name, optional. Supports passing variables in if + * $variables is not used. + */ + function render_iterate( ...$args ): void { + echo iterate( ...$args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + } +} + +if ( ! function_exists( 'mantle_get_var' ) ) { + /** + * Return a new view. + * + * @param string $key Variable to get. + * @param mixed $default Default value if unset. + * @return mixed + */ + function mantle_get_var( string $key, $default = null ) { + return app( View_Factory::class )->get_var( $key, $default ); + } +} + +if ( ! function_exists( 'route' ) ) { + /** + * Generate a URL to a named route. + * + * @param string $name Route name. + * @param array $args Route arguments. + * @return string + */ + function route( string $name, array $args = [], bool $relative = false ) { + return app( 'url' )->generate( $name, $args, $relative ? UrlGenerator::ABSOLUTE_PATH : UrlGenerator::ABSOLUTE_URL ); + } +} + +if ( ! function_exists( 'abort' ) ) { + /** + * Throw an HttpException with the given data. + * + * @param int $code Error code or exception. + * @param string $message Response message + * @param array $headers HTTP Headers + */ + function abort( $code, $message = '', array $headers = [] ): void { + app()->abort( $code, $message, $headers ); + } +} + +if ( ! function_exists( 'abort_if' ) ) { + /** + * Throw an HttpException with the given data if the given condition is true. + * + * @param bool $boolean + * @param int $code + * @param string $message Response message + * @param array $headers HTTP Headers + */ + function abort_if( $boolean, $code, $message = '', array $headers = [] ): void { + if ( $boolean ) { + abort( $code, $message, $headers ); + } + } +} + +if ( ! function_exists( 'abort_unless' ) ) { + /** + * Throw an HttpException with the given data unless the given condition is true. + * + * @param bool $boolean + * @param int $code + * @param string $message Response message + * @param array $headers HTTP Headers + */ + function abort_unless( $boolean, $code, $message = '', array $headers = [] ): void { + if ( ! $boolean ) { + abort( $code, $message, $headers ); + } + } +} diff --git a/vendor/mantle-framework/http/class-controller.php b/vendor/mantle-framework/http/class-controller.php new file mode 100644 index 00000000..caff392c --- /dev/null +++ b/vendor/mantle-framework/http/class-controller.php @@ -0,0 +1,45 @@ +<?php +/** + * Controller class file. + * + * @package Mantle + */ + +namespace Mantle\Http; + +use BadMethodCallException; + +/** + * Base Controller Class + */ +abstract class Controller { + /** + * Execute an action on the controller. + * + * @param string $method Method to call. + * @param array $parameters Parameters to include. + * @return \Symfony\Component\HttpFoundation\Response + */ + public function call_action( string $method, array $parameters ) { + return $this->{ $method }( ...array_values( $parameters ) ); + } + + /** + * Handle calls to missing methods on the controller. + * + * @param string $method Method name. + * @param array $parameters Method parameters. + * @return mixed + * + * @throws BadMethodCallException Thrown on unknown exception. + */ + public function __call( string $method, array $parameters ) { + throw new BadMethodCallException( + sprintf( + 'Method %s::%s does not exist.', + static::class, + $method + ) + ); + } +} diff --git a/vendor/mantle-framework/http/class-request.php b/vendor/mantle-framework/http/class-request.php new file mode 100644 index 00000000..8d9330a5 --- /dev/null +++ b/vendor/mantle-framework/http/class-request.php @@ -0,0 +1,501 @@ +<?php +/** + * Request class file. + * + * @package Mantle + * + * @phpcs:disable Squiz.Commenting.FunctionComment.MissingParamComment + */ + +namespace Mantle\Http; + +use ArrayAccess; +use Mantle\Contracts\Support\Arrayable; +use Mantle\Http\Routing\Route; +use Mantle\Support\Arr; +use Mantle\Support\Str; +use Symfony\Component\HttpFoundation\ParameterBag; +use Symfony\Component\HttpFoundation\Request as SymfonyRequest; + +use function Mantle\Support\Helpers\data_get; + +/** + * Request Object + */ +class Request extends SymfonyRequest implements ArrayAccess, Arrayable { + use Interacts_With_Input, + Concerns\Interacts_With_Content_Types; + + /** + * Route parameters. + */ + protected ?ParameterBag $route_parameters = null; + + /** + * The decoded JSON content for the request. + */ + protected ?ParameterBag $json = null; + + /** + * Route matched. + * + * @var Route|null + */ + protected $route; + + /** + * All of the converted files for the request. + * + * @var array|null + */ + protected $converted_files; + + /** + * Create a request object. + * + * @return static + */ + public static function capture() { + return static::createFromGlobals(); + } + + /** + * Set the path info for the request. + * + * @param string $path_info Path info. + * @return static + */ + public function setPathInfo( string $path_info ) { + $this->pathInfo = $path_info; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase + return $this; + } + + /** + * Return the Request instance. + * + * @return static + */ + public function instance() { + return $this; + } + + /** + * Get the request method. + * + * @return string + */ + public function method() { + return $this->getMethod(); + } + + /** + * Get the root URL for the application. + * + * @return string + */ + public function root() { + return rtrim( $this->getSchemeAndHttpHost() . $this->getBaseUrl(), '/' ); + } + + /** + * Get the URL (no query string) for the request. + * + * @return string + */ + public function url() { + return rtrim( (string) preg_replace( '/\?.*/', '', $this->getUri() ), '/' ); + } + + /** + * Get the full URL for the request. + * + * @return string + */ + public function full_url() { + $query = $this->getQueryString(); + + $question = $this->getBaseUrl() . $this->getPathInfo() === '/' ? '/?' : '?'; + + return $query ? $this->url() . $question . $query : $this->url(); + } + + /** + * Get the full URL for the request with the added query string parameters. + * + * @param array $query + * @return string + */ + public function full_url_with_query( array $query ) { + $question = $this->getBaseUrl() . $this->getPathInfo() === '/' ? '/?' : '?'; + + return count( $this->query() ) > 0 + ? $this->url() . $question . Arr::query( array_merge( $this->query(), $query ) ) + : $this->full_url() . $question . Arr::query( $query ); + } + + /** + * Get the current path info for the request. + * + * @return string + */ + public function path() { + $pattern = trim( $this->getPathInfo(), '/' ); + + return '' === $pattern ? '/' : $pattern; + } + + /** + * Get the current decoded path info for the request. + * + * @return string + */ + public function decoded_path() { + return rawurldecode( $this->path() ); + } + + /** + * Get a segment from the URI (1 based index). + * + * @param int $index + * @param string|null $default + * @return string|null + */ + public function segment( $index, $default = null ) { + return Arr::get( $this->segments(), $index - 1, $default ); + } + + /** + * Get all of the segments for the request path. + * + * @return array + */ + public function segments() { + $segments = explode( '/', $this->decoded_path() ); + + return array_values( + array_filter( + $segments, + fn ( $value) => '' !== $value + ) + ); + } + + /** + * Determine if the current request URI matches a pattern. + * + * @param mixed ...$patterns + */ + public function is( ...$patterns ): bool { + $path = $this->decoded_path(); + + foreach ( $patterns as $pattern ) { + if ( Str::is( $pattern, $path ) ) { + return true; + } + } + + return false; + } + + /** + * Determine if the current request URL and query string matches a pattern. + * + * @param mixed ...$patterns + */ + public function full_url_is( ...$patterns ): bool { + $url = $this->full_url(); + + foreach ( $patterns as $pattern ) { + if ( Str::is( $pattern, $url ) ) { + return true; + } + } + + return false; + } + + /** + * Determine if the request is the result of an AJAX call. + * + * @return bool + */ + public function ajax() { + return $this->isXmlHttpRequest(); + } + + /** + * Determine if the request is the result of an PJAX call. + */ + public function pjax(): bool { + return $this->headers->get( 'X-PJAX' ) == true; + } + + /** + * Determine if the request is the result of an prefetch call. + */ + public function prefetch(): bool { + return 0 === strcasecmp( (string) $this->server->get( 'HTTP_X_MOZ' ), 'prefetch' ) || + 0 === strcasecmp( (string) $this->headers->get( 'Purpose' ), 'prefetch' ); + } + + /** + * Determine if the request is over HTTPS. + * + * @return bool + */ + public function secure() { + return $this->isSecure(); + } + + /** + * Get the client IP address. + * + * @return string|null + */ + public function ip() { + return $this->getClientIp(); + } + + /** + * Get the client IP addresses. + * + * @return array + */ + public function ips() { + return $this->getClientIps(); + } + + /** + * Get the client user agent. + * + * @return string|null + */ + public function user_agent() { + return $this->headers->get( 'User-Agent' ); + } + + /** + * Merge new input into the current request's input array. + * + * @param array $input + * @return $this + */ + public function merge( array $input ) { + $this->get_input_source()->add( $input ); + + return $this; + } + + /** + * Replace the input for the current request. + * + * @param array $input + * @return $this + */ + public function replace( array $input ) { + $this->get_input_source()->replace( $input ); + + return $this; + } + + /** + * This method belongs to Symfony HttpFoundation and is not usually needed. + * + * Instead, you may use the "input" method. + * + * @param string $key + * @param mixed $default + */ + public function get( string $key, mixed $default = null ): mixed { // phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod.Found + return parent::get( $key, $default ); + } + + /** + * Get the JSON payload for the request. + * + * @param string|null $key + * @param mixed $default + * @return \Symfony\Component\HttpFoundation\ParameterBag|mixed + */ + public function json( $key = null, $default = null ) { + if ( ! isset( $this->json ) ) { + $this->json = new ParameterBag( (array) json_decode( $this->getContent(), true ) ); + } + + if ( is_null( $key ) ) { + return $this->json; + } + + return data_get( $this->json->all(), $key, $default ); + } + + /** + * Determine if the request is JSON. + */ + public function is_json(): bool { + return $this->has_header( 'Content-Type' ) && + Str::contains( $this->header( 'Content-Type' ), 'json' ); + } + + /** + * Get the input source for the request. + * + * @return \Symfony\Component\HttpFoundation\ParameterBag + */ + protected function get_input_source() { + if ( $this->is_json() ) { + return $this->json(); + } + + return in_array( $this->getRealMethod(), [ 'GET', 'HEAD' ] ) ? $this->query : $this->request; + } + + /** + * Set the JSON payload for the request. + * + * @param \Symfony\Component\HttpFoundation\ParameterBag $json + * @return $this + */ + public function set_json( $json ) { + $this->json = $json; + + return $this; + } + + /** + * Get all of the input and files for the request. + * + * @return array + */ + public function to_array() { + return $this->all(); + } + + /** + * Set route parameters. + * + * @param ParameterBag|array $parameters Route parameters to set. + * @return static + */ + public function set_route_parameters( $parameters ) { + if ( ! ( $parameters instanceof ParameterBag ) ) { + // Remove internal route parameters. + $parameters = new ParameterBag( + array_filter( + $parameters, + fn ( $parameter ) => ! str_starts_with( $parameter, '_' ), + ARRAY_FILTER_USE_KEY + ) + ); + } + + $this->route_parameters = $parameters; + + return $this; + } + + /** + * Get route parameters. + */ + public function get_route_parameters(): ?ParameterBag { + return $this->route_parameters; + } + + /** + * Set a parameter to the given value. + * + * @param string $key Parameter to set. + * @param mixed $value Value to set. + * @return static + */ + public function set_route_parameter( string $key, $value ) { + $this->route_parameters->set( $key, $value ); + return $this; + } + + /** + * Get the route. + * + * @return Route + */ + public function get_route(): ?Route { + return $this->route ?? null; + } + + /** + * Set a route match for the current request. + * + * @param Route $route Route instance to set. + * @return static + */ + public function set_route( Route $route ) { + $this->route = $route; + + return $this; + } + + /** + * Determine if the given offset exists. + * + * @param mixed $offset + */ + public function offsetExists( mixed $offset ): bool { + return Arr::has( + $this->all() + $this->get_route_parameters()->all(), + $offset + ); + } + + /** + * Get the value at the given offset. + * + * @param mixed $offset + */ + public function offsetGet( mixed $offset ): mixed { + return $this->__get( $offset ); + } + + /** + * Set the value at the given offset. + * + * @param mixed $offset + * @param mixed $value + */ + public function offsetSet( mixed $offset, mixed $value ): void { + $this->get_input_source()->set( $offset, $value ); + } + + /** + * Remove the value at the given offset. + * + * @param mixed $offset + */ + public function offsetUnset( mixed $offset ): void { + $this->get_input_source()->remove( $offset ); + } + + /** + * Check if an input element is set on the request. + * + * @param string $key + * @return bool + */ + public function __isset( $key ) { + return ! is_null( $this->__get( $key ) ); + } + + /** + * Get an input element from the request. + * + * @param string $key + * @return mixed + */ + public function __get( $key ) { + return Arr::get( + $this->all(), + $key, + fn () => $this->get_route_parameters()->get( $key ) + ); + } + +} diff --git a/vendor/mantle-framework/http/class-response.php b/vendor/mantle-framework/http/class-response.php new file mode 100644 index 00000000..2b853537 --- /dev/null +++ b/vendor/mantle-framework/http/class-response.php @@ -0,0 +1,108 @@ +<?php +/** + * Response class file. + * + * @package Mantle + */ + +namespace Mantle\Http; + +use ArrayObject; +use InvalidArgumentException; +use JsonSerializable; +use Mantle\Contracts\Support\Arrayable; +use Mantle\Contracts\Support\Htmlable; +use Mantle\Contracts\Support\Jsonable; +use Mantle\Support\Traits\Macroable; +use Symfony\Component\HttpFoundation\Response as HttpFoundationResponse; +use Symfony\Component\HttpFoundation\ResponseHeaderBag; + +/** + * HTTP Response + */ +class Response extends HttpFoundationResponse { + use Macroable; + + /** + * The original content of the response. + * + * @var mixed + */ + public $original; + + /** + * Constructor. + * + * @param mixed $content Response content. + * @param int $status Response status code. + * @param array<string, string> $headers Response headers. + * + * @throws InvalidArgumentException When the HTTP status code is not valid. + */ + public function __construct( $content = '', int $status = 200, array $headers = [] ) { + $this->headers = new ResponseHeaderBag( $headers ); + $this->setContent( $content ); + $this->setStatusCode( $status ); + $this->setProtocolVersion( '1.0' ); + } + + /** + * Set the content on the response. + * + * @param mixed $content + * @return $this + * + * @throws InvalidArgumentException When the HTTP status code is not valid. + */ + public function setContent( mixed $content ): static { + $this->original = $content; + + // If the content is "JSONable" we will set the appropriate header and convert + // the content to JSON. This is useful when returning something like models + // from routes that will be automatically transformed to their JSON form. + if ( $this->should_be_json( $content ) ) { + $this->headers->set( 'Content-Type', 'application/json' ); + + $content = $this->morph_to_json( $content ); + + if ( false === $content ) { + throw new InvalidArgumentException( json_last_error_msg() ); + } + } elseif ( $content instanceof Htmlable ) { + $content = $content->to_html(); + } + + parent::setContent( $content ); + + return $this; + } + + /** + * Determine if the given content should be turned into JSON. + * + * @param Arrayable|Jsonable|ArrayObject|JsonSerializable|array|mixed $content + */ + protected function should_be_json( $content ): bool { + return $content instanceof Arrayable || + $content instanceof Jsonable || + $content instanceof ArrayObject || + $content instanceof JsonSerializable || + is_array( $content ); + } + + /** + * Morph the given content into JSON. + * + * @param Arrayable|Jsonable|ArrayObject|JsonSerializable|array|mixed $content + * @return string|false + */ + protected function morph_to_json( $content ) { + if ( $content instanceof Jsonable ) { + return $content->to_json(); + } elseif ( $content instanceof Arrayable ) { + return json_encode( $content->to_array() ); // phpcs:ignore WordPress.WP.AlternativeFunctions.json_encode_json_encode + } + + return json_encode( $content ); // phpcs:ignore WordPress.WP.AlternativeFunctions.json_encode_json_encode + } +} diff --git a/vendor/mantle-framework/http/class-uploaded-file.php b/vendor/mantle-framework/http/class-uploaded-file.php new file mode 100644 index 00000000..b1d7f0b7 --- /dev/null +++ b/vendor/mantle-framework/http/class-uploaded-file.php @@ -0,0 +1,201 @@ +<?php +/** + * Uploaded_File class file. + * + * @package Mantle + * + * @phpcs:disable Squiz.Commenting.FunctionComment.MissingParamComment + */ + +namespace Mantle\Http; + +use Mantle\Container\Container; +use Mantle\Contracts\Filesystem\Filesystem_Manager; +use Mantle\Database\Model\Attachment; +use Mantle\Filesystem\File_Helpers; +use Mantle\Support\Arr; +use Mantle\Support\Str; +use Mantle\Support\Traits\Macroable; +use RuntimeException; +use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; +use Symfony\Component\HttpFoundation\File\UploadedFile as SymfonyUploadedFile; + +/** + * Handles Uploaded Files + */ +class Uploaded_File extends SymfonyUploadedFile { + use File_Helpers, Macroable; + + /** + * Store the uploaded file on a filesystem disk. + * + * @param string $path + * @param array|string $options + * @return string|false + */ + public function store( $path, $options = [] ) { + return $this->store_as( $path, $this->hash_name(), $this->parse_options( $options ) ); + } + + /** + * Store the uploaded file on a filesystem disk with public visibility. + * + * @param string $path + * @param array|string $options + * @return string|false + */ + public function store_publicly( $path, $options = [] ) { + $options = $this->parse_options( $options ); + + $options['visibility'] = 'public'; + + return $this->store_as( $path, $this->getFilename(), $options ); + } + + /** + * Store the uploaded file on a filesystem disk with public visibility. + * + * @param string $path + * @param string $name + * @param array|string $options + * @return string|false + */ + public function store_publicly_as( $path, $name, $options = [] ) { + $options = $this->parse_options( $options ); + + $options['visibility'] = 'public'; + + return $this->store_as( $path, $name, $options ); + } + + /** + * Store the uploaded file on a filesystem disk. + * + * @param string $path + * @param string $name + * @param array|string $options + * @return string|false + */ + public function store_as( $path, $name, $options = [] ) { + $path = untrailingslashit( $path ); + $options = $this->parse_options( $options ); + + $disk = Arr::pull( $options, 'disk' ); + + return Container::get_instance()->make( Filesystem_Manager::class )->drive( $disk )->put_file_as( + $path, + $this, + $name, + $options + ); + } + + /** + * Store the file as a WordPress attachment. + * + * @param string $path Path to store uploaded file to. + * @param string $name File name. + * @param array $options Options for storage, disk name as string. + * + * @throws RuntimeException Thrown on error storing file. + * @todo Enable proper attachment meta data indexing. + */ + public function store_as_attachment( string $path = '/', string $name = null, $options = [] ): Attachment { + $options = $this->parse_options( $options ); + + // Set the default visibility for attachments to public. + if ( ! isset( $options['visibility'] ) ) { + $options['visibility'] = 'public'; + } + + if ( $name ) { + $uploaded_file = $this->store_as( $path, $name, $options ); + } else { + $uploaded_file = $this->store( $path, $options ); + } + + if ( empty( $uploaded_file ) ) { + throw new RuntimeException( "Error uploading file to [{$path}]: [{$this->getFilename()}]" ); + } + + $disk_name = $options['disk'] ?? null; + $disk = Container::getInstance()->make( Filesystem_Manager::class )->drive( $disk_name ); + + // Create the attachment for the file. + $attachment = Attachment::create( + [ + 'post_mime_type' => $this->getClientMimeType(), + 'guid' => $disk->url( $uploaded_file ), + 'post_parent' => 0, + 'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $uploaded_file ) ), + 'post_content' => '', + 'meta' => [ + '_wp_attached_file' => Str::unpreceding_slash( trailingslashit( $path ) . $uploaded_file ), + Attachment::META_KEY_CLOUD_STORAGE => [ + 'disk' => $disk_name, + 'name' => $uploaded_file, + 'path' => $path, + 'visibility' => $options['visibility'], + ], + ], + ] + ); + + return $attachment; + } + + /** + * Get the contents of the uploaded file. + * + * @return bool|string + * + * @throws FileNotFoundException When file not found. + */ + public function get() { + if ( ! $this->isValid() ) { + throw new FileNotFoundException( "File does not exist at path {$this->getPathname()}." ); + } + + return file_get_contents( $this->getPathname() ); // phpcs:ignore WordPressVIPMinimum.Performance.FetchingRemoteData.FileGetContentsUnknown + } + + /** + * Get the file's extension supplied by the client. + * + * @return string + */ + public function clientExtension() { + return $this->guessClientExtension(); + } + + /** + * Parse and format the given options. + * + * @param array|string $options + * @return array + */ + protected function parse_options( $options ) { + if ( is_string( $options ) ) { + return [ 'disk' => $options ]; + } + + return $options; + } + + /** + * Create a new file instance from a base instance. + * + * @param \Symfony\Component\HttpFoundation\File\UploadedFile $file + * @param bool $test + * @return static + */ + public static function createFromBase( \Symfony\Component\HttpFoundation\File\UploadedFile $file, $test = false ) { + return $file instanceof static ? $file : new static( + $file->getPathname(), + $file->getClientOriginalName(), + $file->getClientMimeType(), + $file->getError(), + $test + ); + } +} diff --git a/vendor/mantle-framework/http/composer.json b/vendor/mantle-framework/http/composer.json new file mode 100644 index 00000000..e1d41baa --- /dev/null +++ b/vendor/mantle-framework/http/composer.json @@ -0,0 +1,42 @@ +{ + "name": "mantle-framework/http", + "description": "The Mantle Framework Http Package", + "type": "library", + "require": { + "php": "^8.1", + "mantle-framework/contracts": "^1.0", + "mantle-framework/filesystem": "^1.0", + "mantle-framework/support": "^1.0", + "symfony/http-foundation": "^6.0.20", + "symfony/http-kernel": "^6.0.20", + "symfony/mime": "^6.2", + "symfony/routing": "^6.2", + "symfony/var-dumper": "^6.2" + }, + "extra": { + "wordpress-autoloader": { + "autoload": { + "Mantle\\Http": "./" + } + } + }, + "license": "GPL-2.0-or-later", + "authors": [ + { + "name": "Alley", + "email": "mantle@alley.com" + } + ], + "autoload": { + "files": [ + "autoload.php" + ] + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev", + "suggest": { + "illuminate/view": "For assertions in tests that use Blade templating" + } +} diff --git a/vendor/mantle-framework/http/concerns/trait-interacts-with-content-types.php b/vendor/mantle-framework/http/concerns/trait-interacts-with-content-types.php new file mode 100644 index 00000000..bd40a1a5 --- /dev/null +++ b/vendor/mantle-framework/http/concerns/trait-interacts-with-content-types.php @@ -0,0 +1,175 @@ +<?php +/** + * Interacts_With_Content_Types trait file. + * + * @package Mantle + */ + +namespace Mantle\Http\Concerns; + +use Mantle\Support\Str; + +/** + * Interacts with Content Types Concern + * + * Provides information about the current request to the request object. + */ +trait Interacts_With_Content_Types { + + /** + * Determine if the given content types match. + * + * @param string $actual + * @param string $type + */ + public static function matches_type( $actual, $type ): bool { + if ( $actual === $type ) { + return true; + } + + $split = explode( '/', $actual ); + + return isset( $split[1] ) && preg_match( '#' . preg_quote( $split[0], '#' ) . '/.+\+' . preg_quote( $split[1], '#' ) . '#', $type ); + } + + /** + * Determine if the request is sending JSON. + * + * @return bool + */ + public function is_json() { + return Str::contains( $this->header( 'CONTENT_TYPE' ), [ '/json', '+json' ] ); + } + + /** + * Determine if the current request probably expects a JSON response. + */ + public function expects_json(): bool { + if ( $this->ajax() && ! $this->pjax() && $this->accepts_any_content_type() ) { + return true; + } + + if ( function_exists( 'wp_is_serving_rest_request' ) && wp_is_serving_rest_request() ) { + return true; + } + + return (bool) $this->wants_json(); + } + + /** + * Determine if the current request is asking for JSON. + */ + public function wants_json(): bool { + $acceptable = $this->getAcceptableContentTypes(); + + return isset( $acceptable[0] ) && Str::contains( $acceptable[0], [ '/json', '+json' ] ); + } + + /** + * Determines whether the current requests accepts a given content type. + * + * @param string|array $content_types + */ + public function accepts( $content_types ): bool { + $accepts = $this->getAcceptableContentTypes(); + + if ( count( $accepts ) === 0 ) { + return true; + } + + $types = (array) $content_types; + + foreach ( $accepts as $accept ) { + if ( '*/*' === $accept || '*' === $accept ) { + return true; + } + + foreach ( $types as $type ) { + if ( $this->matches_type( $accept, $type ) || strtok( $type, '/' ) . '/*' === $accept ) { + return true; + } + } + } + + return false; + } + + /** + * Return the most suitable content type from the given array based on content negotiation. + * + * @param string|array $content_types + * @return string|null + */ + public function prefers( $content_types ) { + $accepts = $this->getAcceptableContentTypes(); + + $content_types = (array) $content_types; + + foreach ( $accepts as $accept ) { + if ( in_array( $accept, [ '*/*', '*' ] ) ) { + return $content_types[0]; + } + + foreach ( $content_types as $content_type ) { + $type = $content_type; + + $mime_type = $this->getMimeType( $content_type ); + if ( ! is_null( $mime_type ) ) { + $type = $mime_type; + } + + if ( $this->matches_type( $type, $accept ) || strtok( $type, '/' ) . '/*' === $accept ) { + return $content_type; + } + } + } + + return null; + } + + /** + * Determine if the current request accepts any content type. + */ + public function accepts_any_content_type(): bool { + $acceptable = $this->getAcceptableContentTypes(); + + return count( $acceptable ) === 0 || ( + isset( $acceptable[0] ) && ( '*/*' === $acceptable[0] || '*' === $acceptable[0] ) + ); + } + + /** + * Determines whether a request accepts JSON. + * + * @return bool + */ + public function accepts_json() { + return $this->accepts( 'application/json' ); + } + + /** + * Determines whether a request accepts HTML. + * + * @return bool + */ + public function accepts_html() { + return $this->accepts( 'text/html' ); + } + + /** + * Get the data format expected in the response. + * + * @param string $default + * @return string + */ + public function format( $default = 'html' ) { + foreach ( $this->getAcceptableContentTypes() as $type ) { + $format = $this->getFormat( $type ); + if ( $format ) { + return $format; + } + } + + return $default; + } +} diff --git a/vendor/mantle-framework/http/routing/class-entity-router.php b/vendor/mantle-framework/http/routing/class-entity-router.php new file mode 100644 index 00000000..57e44a6d --- /dev/null +++ b/vendor/mantle-framework/http/routing/class-entity-router.php @@ -0,0 +1,220 @@ +<?php +/** + * Entity_Router class file. + * + * @package Mantle + */ + +namespace Mantle\Http\Routing; + +use InvalidArgumentException; +use Mantle\Contracts\Container; +use Mantle\Contracts\Database\Core_Object; +use Mantle\Contracts\Http\Routing\Entity_Router as Entity_Router_Contract; +use Mantle\Contracts\Http\Routing\Url_Routable; +use Mantle\Contracts\Http\Routing\Router as Router_Contract; +use Mantle\Database\Model\Model; +use Mantle\Database\Model\Post; +use Mantle\Database\Model\Term; +use Mantle\Facade\Log; +use Mantle\Http\Routing\Events\Bindings_Substituted; +use Mantle\Http\Routing\Events\Entity_Route_Added; +use Mantle\Http\Routing\Events\Route_Matched; + +use function Mantle\Support\Helpers\collect; + +/** + * Provide routing to a WordPress data entity: post or term. + */ +class Entity_Router implements Entity_Router_Contract { + + /** + * Events instance. + * + * @var \Mantle\Contracts\Events\Dispatcher + */ + protected $events; + + /** + * Constructor. + * + * @param Container $container The application container. + */ + public function __construct( Container $container ) { + $this->events = $container['events']; + + $this->events->listen( + Route_Matched::class, + fn ( $event ) => $this->handle_route_matched( $event ), + ); + + $this->events->listen( + Bindings_Substituted::class, + fn ( $event ) => $this->handle_bindings_substituted( $event ), + ); + } + + /** + * Add an entity to the router. + * + * @param Router_Contract $router Router instance. + * @param string $entity Entity class name. + * @param string $controller Controller class name. + * + * @throws InvalidArgumentException Thrown on invalid entity. + */ + public function add( Router_Contract $router, string $entity, string $controller ): void { + if ( ! is_subclass_of( $entity, Model::class ) ) { + throw new InvalidArgumentException( "Unknown entity type: [{$entity}]" ); + } + + if ( ! in_array( Url_Routable::class, class_implements( $entity ) ) ) { + throw new InvalidArgumentException( "Unroutable entity: [{$entity}]" ); + } + + static::resolve_entity_endpoints( $router, $entity, $controller ); + + $this->events->dispatch( new Entity_Route_Added( $entity, $controller ) ); + } + + /** + * Handle the route match for entity routes. + * + * @param Route_Matched $event Event instance. + */ + protected function handle_route_matched( Route_Matched $event ): void { + global $wp_query; + + $route = $event->route; + + // Ignore if the route isn't an entity route. + if ( ! $route->hasOption( 'entity_router' ) ) { + return; + } + + // Ignore if the entity model referenced doesn't exist. + $entity = $route->getOption( 'entity' ); + if ( ! class_exists( $entity ) ) { + Log::error( "Entity matched for route not found [{$entity}]" ); + return; + } + + // Instantiate WP_Query if it isn't set already. + if ( ! $wp_query ) { + $wp_query = new \WP_Query(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited + } + + // Setup the WordPress template variables. + if ( 'single' === $route->getOption( 'entity_router' ) ) { + if ( is_subclass_of( $entity, Term::class ) ) { + $wp_query->is_archive = true; + $wp_query->is_tax = true; + + $object_name = $entity::get_object_name(); + + if ( 'post_tag' === $object_name ) { + $wp_query->is_tag = true; + } elseif ( 'category' === $object_name ) { + $wp_query->is_category = true; + } + } elseif ( is_subclass_of( $entity, Post::class ) ) { + $wp_query->is_single = true; + $wp_query->is_singular = true; + } + } elseif ( 'index' === $route->getOption( 'entity_router' ) ) { + $wp_query->is_archive = true; + } + } + + /** + * Handle the bindings being substituted for a route. + * + * @todo Add support for other non-post/term queried objects such as post types. + * + * @param Bindings_Substituted $event Event instance. + */ + protected function handle_bindings_substituted( Bindings_Substituted $event ): void { + global $wp_query, $post; + + $route = $event->request->get_route(); + $parameters = collect( $event->request->get_route_parameters()->all() ); + + // Set the queried object for the entity route. + if ( 'single' === $route->getOption( 'entity_router' ) ) { + $entity = $route->getOption( 'entity' ); + + $queried_object = $parameters + ->filter( fn ( $value ) => $value instanceof $entity ) + ->pop(); + } else { + // Set the queried object for the non-entity route -- uses the last model parameter passed to the route. + $queried_object = $parameters + ->filter( fn ( $value ) => $value instanceof Model || $value instanceof Core_Object ) + ->pop(); + } + + if ( empty( $queried_object ) ) { + return; + } + + if ( $queried_object instanceof Core_Object ) { + $wp_query->queried_object_id = $queried_object->id(); + $wp_query->queried_object = $queried_object->core_object(); + } else { + $wp_query->queried_object = $queried_object; + } + + // Setup the global post object. + if ( $wp_query->queried_object instanceof \WP_Post ) { + $post = $wp_query->queried_object; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited + + setup_postdata( $post ); + } + } + + /** + * Resolve the endpoints to add for an entity. + * + * @param Router_Contract $router Router instance. + * @param string $entity Entity class name. + * @param string $controller Controller class name. + */ + protected static function resolve_entity_endpoints( Router_Contract $router, string $entity, string $controller ): void { + // Singular endpoint. + $single_route = $entity::get_route(); + + if ( $single_route && method_exists( $controller, 'show' ) ) { + $router + ->get( trailingslashit( $single_route ), [ $controller, 'show' ] ) + ->addOptions( + [ + 'entity_router' => 'single', + 'entity' => $entity, + ] + ); + } + + $archive_route = $entity::get_archive_route(); + + if ( $archive_route && method_exists( $controller, 'index' ) ) { + $router + ->get( trailingslashit( $archive_route ), [ $controller, 'index' ] ) + ->addOptions( + [ + 'entity_router' => 'index', + 'entity' => $entity, + ] + ); + + // Add a paginated endpoint for the archive. + $router + ->get( trailingslashit( $archive_route ) . 'page/{page}/', [ $controller, 'index' ] ) + ->addOptions( + [ + 'entity_router' => 'index', + 'entity' => $entity, + ] + ); + } + } +} diff --git a/vendor/mantle-framework/http/routing/class-implicit-route-binding.php b/vendor/mantle-framework/http/routing/class-implicit-route-binding.php new file mode 100644 index 00000000..26889a92 --- /dev/null +++ b/vendor/mantle-framework/http/routing/class-implicit-route-binding.php @@ -0,0 +1,79 @@ +<?php +/** + * Implicit_Route_Binding class file. + * + * @package Mantle + */ + +namespace Mantle\Http\Routing; + +use Mantle\Contracts\Container; +use Mantle\Contracts\Http\Routing\Url_Routable; +use Mantle\Database\Model\Model_Not_Found_Exception; +use Mantle\Http\Request; +use Mantle\Support\Reflector; +use Mantle\Support\Str; + +/** + * Implicit Route Binding + * + * Allow models to be auto-resolved without any additional binding needed. + */ +class Implicit_Route_Binding { + + /** + * Resolve the implicit route bindings for the given route. + * + * @param Container $container Container instance. + * @param Request $request Request instance. + * + * @throws Model_Not_Found_Exception Thrown on missing model. + */ + public static function resolve_for_route( Container $container, Request $request ): void { + $route = $request->get_route(); + $parameters = $request->get_route_parameters()->all(); + + foreach ( $route->get_signature_parameters( Url_Routable::class ) as $parameter ) { + $parameter_name = static::get_parameter_name( $parameter->getName(), $parameters ); + if ( ! $parameter_name ) { + continue; + } + + $parameter_value = $parameters[ $parameter_name ]; + + if ( $parameter_value instanceof Url_Routable ) { + continue; + } + + $instance = $container->make( Reflector::get_parameter_class_name( $parameter ) ); + $model = $instance->resolve_route_binding( $parameter_value ); + + if ( ! $model ) { + throw ( new Model_Not_Found_Exception() )->set_model( $instance::class, [ $parameter_value ] ); + } + + $request->set_route_parameter( $parameter_name, $model ); + } + } + + /** + * Return the parameter name if it exists in the given parameters. + * + * @param string $name + * @param array $parameters + * @return string|null + */ + protected static function get_parameter_name( $name, array $parameters ) { + if ( array_key_exists( $name, $parameters ) ) { + return $name; + } + + $snaked_name = Str::snake( $name ); + + if ( array_key_exists( $snaked_name, $parameters ) ) { + return $snaked_name; + } + + return null; + } +} diff --git a/vendor/mantle-framework/http/routing/class-middleware-name-resolver.php b/vendor/mantle-framework/http/routing/class-middleware-name-resolver.php new file mode 100644 index 00000000..d6acb59e --- /dev/null +++ b/vendor/mantle-framework/http/routing/class-middleware-name-resolver.php @@ -0,0 +1,99 @@ +<?php +/** + * Middleware_Name_Resolver class file. + * + * @package Mantle + */ + +namespace Mantle\Http\Routing; + +use Closure; + +/** + * Middleware Name Resolver + * + * Resolve the middleware names with the actual middleware registered. + */ +class Middleware_Name_Resolver { + + /** + * Resolve the middleware name to a class name(s) preserving passed parameters. + * + * @param \Closure|string $name + * @param array $map + * @param array $middleware_groups + * @return \Closure|string|array + */ + public static function resolve( $name, $map, $middleware_groups ) { + // When the middleware is simply a Closure, we will return this Closure instance + // directly so that Closures can be registered as middleware inline, which is + // convenient on occasions when the developers are experimenting with them. + if ( $name instanceof Closure ) { + return $name; + } + + if ( isset( $map[ $name ] ) && $map[ $name ] instanceof Closure ) { + return $map[ $name ]; + } + + // If the middleware is the name of a middleware group, we will return the array + // of middlewares that belong to the group. This allows developers to group a + // set of middleware under single keys that can be conveniently referenced. + if ( isset( $middleware_groups[ $name ] ) ) { + return static::parse_middleware_group( $name, $map, $middleware_groups ); + } + + // Finally, when the middleware is simply a string mapped to a class name the + // middleware name will get parsed into the full class name and parameters + // which may be run using the Pipeline which accepts this string format. + [$name, $parameters] = array_pad( explode( ':', $name, 2 ), 2, null ); + + return ( $map[ $name ] ?? $name ) . ( ! is_null( $parameters ) ? ':' . $parameters : '' ); + } + + /** + * Parse the middleware group and format it for usage. + * + * @param string $name + * @param array $map + * @param array $middleware_groups + */ + protected static function parse_middleware_group( $name, $map, $middleware_groups ): array { + $results = []; + + foreach ( $middleware_groups[ $name ] as $middleware ) { + // If the middleware is another middleware group we will pull in the group and + // merge its middleware into the results. This allows groups to conveniently + // reference other groups without needing to repeat all their middlewares. + if ( isset( $middleware_groups[ $middleware ] ) ) { + $results = array_merge( + $results, + static::parse_middleware_group( + $middleware, + $map, + $middleware_groups + ) + ); + + continue; + } + + [ $middleware, $parameters ] = array_pad( + explode( ':', (string) $middleware, 2 ), + 2, + null + ); + + // If this middleware is actually a route middleware, we will extract the full + // class name out of the middleware list now. Then we'll add the parameters + // back onto this class' name so the pipeline will properly extract them. + if ( isset( $map[ $middleware ] ) ) { + $middleware = $map[ $middleware ]; + } + + $results[] = $middleware . ( $parameters ? ':' . $parameters : '' ); + } + + return $results; + } +} diff --git a/vendor/mantle-framework/http/routing/class-redirector.php b/vendor/mantle-framework/http/routing/class-redirector.php new file mode 100644 index 00000000..2b62449b --- /dev/null +++ b/vendor/mantle-framework/http/routing/class-redirector.php @@ -0,0 +1,141 @@ +<?php +/** + * Redirector class file. + * + * @package Mantle + */ + +namespace Mantle\Http\Routing; + +use Symfony\Component\HttpFoundation\RedirectResponse; + +/** + * Redirector Response + */ +class Redirector { + /** + * Status code for a permanent redirect. + * + * @var int + */ + public const STATUS_PERMANENT = 301; + + /** + * Status code for a temporary redirect. + * + * @var int + */ + public const STATUS_TEMPORARY = 302; + + /** + * URL Generator instance. + * + * @var Url_Generator + */ + protected $generator; + + /** + * Constructor. + * + * @param Url_Generator $generator Generator instance. + */ + public function __construct( Url_Generator $generator ) { + $this->generator = $generator; + } + + /** + * Generate a redirect to the homepage of the site. + * + * @param int $status Status code. + * @param array $headers Additional headers. + */ + public function home( int $status = self::STATUS_TEMPORARY, array $headers = [] ): RedirectResponse { + return $this->to( $this->generator->to( '/', [], [], null ), $status, $headers ); + } + + /** + * Generate a redirect to the previous page the user was on. + * + * @param int $status Status code. + * @param array $headers Additional headers. + * @param string $fallback Fallback URL. + */ + public function back( int $status = self::STATUS_TEMPORARY, array $headers = [], string $fallback = null ): RedirectResponse { + return $this->to( $this->generator->previous( $fallback ), $status, $headers ); + } + + /** + * Generate a redirect to the current URL. + * + * @param int $status Status code. + * @param array $headers Additional headers. + */ + public function refresh( int $status = self::STATUS_TEMPORARY, array $headers = [] ): RedirectResponse { + return $this->to( $this->generator->get_request()->path(), $status, $headers ); + } + + /** + * Generate a redirect to a specific path on the current site. + * + * @param string $path URL path to redirect to. + * @param int $status Status code. + * @param array $headers Additional headers. + * @param bool $secure Flag if the redirect should be secured with HTTPS. + */ + public function to( string $path, int $status = self::STATUS_TEMPORARY, array $headers = [], bool $secure = null ): RedirectResponse { + return $this->create_redirect( + $this->generator->to( $path, [], [], $secure ), + $status, + $headers + ); + } + + /** + * Generate a redirect to a URL off the site. + * + * @param string $url URL to redirect to. + * @param int $status Status code. + * @param array $headers Additional headers. + */ + public function away( string $url, int $status = self::STATUS_TEMPORARY, array $headers = [] ): RedirectResponse { + return $this->create_redirect( + $url, + $status, + $headers + ); + } + + /** + * Generate a secure redirect. + * + * @param string $path URL path to redirect to. + * @param int $status Status code. + * @param array $headers Additional headers. + */ + public function secure( string $path, int $status = self::STATUS_TEMPORARY, array $headers = [] ): RedirectResponse { + return $this->to( $path, $status, $headers, true ); + } + + /** + * Generate a redirect to a specific route. + * + * @param string $route Route to generate to. + * @param array $parameters Parameters for the route. + * @param int $status Status code. + * @param array $headers Additional headers. + */ + public function route( string $route, array $parameters = [], int $status = self::STATUS_TEMPORARY, array $headers = [] ): RedirectResponse { + return $this->to( $this->generator->generate( $route, $parameters ), $status, $headers ); + } + + /** + * Create a redirect response. + * + * @param string $path URL path. + * @param int $status HTTP status code. + * @param array $headers Array of headers, optional. + */ + protected function create_redirect( string $path, int $status, array $headers = [] ): RedirectResponse { + return new RedirectResponse( $path, $status, $headers ); + } +} diff --git a/vendor/mantle-framework/http/routing/class-response-factory.php b/vendor/mantle-framework/http/routing/class-response-factory.php new file mode 100644 index 00000000..406013a4 --- /dev/null +++ b/vendor/mantle-framework/http/routing/class-response-factory.php @@ -0,0 +1,215 @@ +<?php +/** + * Response_Factory class file. + * + * @package Mantle + */ + +namespace Mantle\Http\Routing; + +use Mantle\Contracts\Http\Routing\Response_Factory as Factory_Contract; +use Mantle\Http\Response; +use Mantle\Http\View\Factory as View_Factory; +use Mantle\Support\Str; +use Symfony\Component\HttpFoundation\BinaryFileResponse; +use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpFoundation\StreamedResponse; + +/** + * Route Response Factory. + */ +class Response_Factory implements Factory_Contract { + /** + * The redirector instance. + * + * @var Redirector + */ + protected $redirector; + + /** + * The view factory instance. + * + * @var View_Factory + */ + protected $view; + + /** + * Create a new response factory instance. + * + * @param Redirector $redirector Redirector instance. + * @param View_Factory $view View factory. + */ + public function __construct( Redirector $redirector, View_Factory $view ) { + $this->redirector = $redirector; + $this->view = $view; + } + + /** + * Create a new response instance. + * + * @param string $content + * @param int $status + * @param array $headers + * @return Response + */ + public function make( $content = '', $status = 200, array $headers = [] ) { + return new Response( $content, $status, $headers ); + } + + /** + * Create a new "no content" response. + * + * @param int $status + * @param array $headers + * @return Response + */ + public function no_content( $status = 204, array $headers = [] ) { + return $this->make( '', $status, $headers ); + } + + /** + * Create a new response for a given view. + * + * @param string $slug View slug. + * @param string $name View name (optional). + * @param array $data Data to pass to the view. + * @param int $status HTTP status code. + * @param array $headers Additional headers. + * @return Response + */ + public function view( string $slug, $name = null, $data = [], $status = 200, array $headers = [] ) { + return $this->make( + $this->view->make( $slug, $name, $data ), + $status, + $headers + ); + } + + /** + * Create a new JSON response instance. + * + * @param mixed $data + * @param int $status + * @param array $headers + * @return JsonResponse + */ + public function json( $data = [], $status = 200, array $headers = [] ) { + return new JsonResponse( $data, $status, $headers, is_string( $data ) ); + } + + /** + * Create a new JSONP response instance. + * + * @param string $callback + * @param mixed $data + * @param int $status + * @param array $headers + * @return JsonResponse + */ + public function jsonp( $callback, $data = [], $status = 200, array $headers = [] ) { + return $this->json( $data, $status, $headers )->setCallback( $callback ); + } + + /** + * Create a new streamed response instance. + * + * @param \Closure $callback + * @param int $status + * @param array $headers + * @return \Symfony\Component\HttpFoundation\StreamedResponse + */ + public function stream( $callback, $status = 200, array $headers = [] ) { + return new StreamedResponse( $callback, $status, $headers ); + } + + /** + * Create a new streamed response instance as a file download. + * + * @param \Closure $callback + * @param string|null $name + * @param array $headers + * @param string|null $disposition + * @return \Symfony\Component\HttpFoundation\StreamedResponse + */ + public function stream_download( $callback, $name = null, array $headers = [], $disposition = 'attachment' ) { + $response = new StreamedResponse( $callback, 200, $headers ); + + if ( ! is_null( $name ) ) { + $response->headers->set( + 'Content-Disposition', + $response->headers->makeDisposition( + $disposition, + $name, + $this->fallbackName( $name ) + ) + ); + } + + return $response; + } + + /** + * Create a new file download response. + * + * @param \SplFileInfo|string $file + * @param string|null $name + * @param array $headers + * @param string|null $disposition + * @return \Symfony\Component\HttpFoundation\BinaryFileResponse + */ + public function download( $file, $name = null, array $headers = [], $disposition = 'attachment' ) { + $response = new BinaryFileResponse( $file, 200, $headers, true, $disposition ); + + if ( ! is_null( $name ) ) { + return $response->setContentDisposition( $disposition, $name, $this->fallbackName( $name ) ); + } + + return $response; + } + + /** + * Convert the string to ASCII characters that are equivalent to the given name. + * + * @param string $name + * @return string + */ + protected function fallbackName( $name ) { + return str_replace( '%', '', Str::ascii( $name ) ); + } + + /** + * Return the raw contents of a binary file. + * + * @param \SplFileInfo|string $file + * @param array $headers + * @return \Symfony\Component\HttpFoundation\BinaryFileResponse + */ + public function file( $file, array $headers = [] ) { + return new BinaryFileResponse( $file, 200, $headers ); + } + + /** + * Create a new redirect response to the given path. + * + * @param string $path + * @param int $status + * @param array $headers + * @param bool|null $secure + */ + public function redirect_to( $path, $status = 302, $headers = [], $secure = null ): RedirectResponse { + return $this->redirector->to( $path, $status, $headers, $secure ); + } + + /** + * Create a new redirect response to a named route. + * + * @param string $route + * @param mixed $parameters + * @param int $status + * @param array $headers + */ + public function redirect_to_route( $route, $parameters = [], $status = 302, $headers = [] ): RedirectResponse { + return $this->redirector->route( $route, $parameters, $status, $headers ); + } +} diff --git a/vendor/mantle-framework/http/routing/class-rest-route-registrar.php b/vendor/mantle-framework/http/routing/class-rest-route-registrar.php new file mode 100644 index 00000000..4e536a26 --- /dev/null +++ b/vendor/mantle-framework/http/routing/class-rest-route-registrar.php @@ -0,0 +1,217 @@ +<?php +/** + * Rest_Route_Registrar class file. + * + * @package Mantle + */ + +namespace Mantle\Http\Routing; + +use InvalidArgumentException; +use Mantle\Http\Routing\Events\Route_Matched; +use Mantle\Support\Pipeline; +use Mantle\Support\Str; +use WP_REST_Request; + +use function Mantle\Support\Helpers\add_action; +use function Mantle\Support\Helpers\collect; + +/** + * REST API Route Registrar + */ +class Rest_Route_Registrar { + /** + * Router instance. + * + * @var Router + */ + protected $router; + + /** + * Queued routes to register. + * + * @var array + */ + protected $routes; + + /** + * Namespace to register to. + * + * @var string + */ + protected $namespace; + + /** + * Constructor. + * + * @param Router $router Router instance. + * @param string $namespace Namespace to register to. + */ + public function __construct( Router $router, string $namespace ) { + $this->router = $router; + $this->namespace = $namespace; + + add_action( 'rest_api_init', [ $this, 'register_routes' ], 20 ); + } + + /** + * Register a REST API Route. + * + * @param string $route Route to register. + * @param array|callable $args Arguments or callback for the route. + */ + public function register_route( string $route, $args = [] ): void { + $args = $this->normalize_args( $args, $route ); + + if ( $this->should_register_now() ) { + register_rest_route( $this->namespace, $route, $args ); + } else { + $this->routes[] = [ $route, $args ]; + } + } + + /** + * Normalize the arguments that are registered. + * + * @param array|callable $args Arguments for the route or callback function. + * @param string $route Route name. + */ + protected function normalize_args( $args, string $route ): array { + if ( ! is_array( $args ) ) { + $args = [ + 'callback' => $args, + ]; + } + + // Fill in the required argument for permission callback. + if ( empty( $args['permission_callback'] ) ) { + $args['permission_callback'] = '__return_true'; + } + + // Ensure the callback returns a valid REST response. + if ( isset( $args['callback'] ) ) { + $args['callback'] = $this->wrap_callback( $args['callback'], $route ); + } + + return $args; + } + + /** + * Wrap the route callback with a valid WordPress REST response. + * + * @param mixed $callback Callback to invoke. + * @param string $route Route name. + */ + protected function wrap_callback( mixed $callback, string $route ): callable { + $callback = $this->parse_route_action( $callback, $route ); + + return function( WP_REST_Request $request ) use ( $callback, $route ) { + $middleware = $request->get_attributes()['middleware'] ?? []; + + if ( empty( $middleware ) ) { + return rest_ensure_response( $callback( $request ) ); + } + + $container = $this->router->get_container(); + + $container['events']->dispatch( + new Route_Matched( + [ + 'namespace' => $this->namespace, + 'route' => $route, + ], + $request, + ) + ); + + return rest_ensure_response( + ( new Pipeline( $container ) ) + ->send( $request ) + ->through( $this->gather_route_middleware( $middleware ) ) + ->then( + fn ( WP_REST_Request $request ) => $callback( $request ), + ) + ); + }; + } + + /** + * Gather the middleware for the given route with resolved class names. + * + * @param string[] $middleware Middleware for the route. + */ + public function gather_route_middleware( array $middleware ): array { + return collect( $middleware ) + ->map( + fn ( $name) => (array) Middleware_Name_Resolver::resolve( + $name, + $this->router->get_middleware(), + $this->router->get_middleware_groups() + ) + ) + ->flatten() + ->values() + ->to_array(); + } + + /** + * Register the queued routes. + */ + public function register_routes(): void { + if ( empty( $this->routes ) ) { + return; + } + + foreach ( $this->routes as $route ) { + register_rest_route( $this->namespace, ...$route ); + } + + $this->routes = []; + } + + /** + * Determine if the routes should be registered now because `rest_api_init` + * was already fired. + */ + protected function should_register_now(): bool { + return function_exists( 'did_action' ) && ! ! did_action( 'rest_api_init' ); + } + + /** + * Parse a route action and return the callback. + * + * Supports closures, invokable classes, and class methods. + * + * @throws InvalidArgumentException If the action is not supported. + * + * @param mixed $action Route action. + * @param string $route Route path. + */ + protected function parse_route_action( mixed $action, string $route ): callable { + if ( is_callable( $action ) ) { + return $action; + } + + if ( is_string( $action ) ) { + // Check for Controller@method callback. + if ( Str::contains( $action, '@' ) ) { + [ $controller, $method ] = explode( '@', $action ); + + return [ $this->router->get_container()->make( $controller ), $method ]; + } + + // Check for invokable classes. + if ( class_exists( $action ) && method_exists( $action, '__invoke' ) ) { + return [ $this->router->get_container()->make( $action ), '__invoke' ]; + } + } + + if ( is_array( $action ) ) { + [ $controller, $method ] = $action; + + return [ $this->router->get_container()->make( $controller ), $method ]; + } + + throw new InvalidArgumentException( "Invalid REST API route action for [{$route}]: " . print_r( $action, true ) ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r + } +} diff --git a/vendor/mantle-framework/http/routing/class-route-binding.php b/vendor/mantle-framework/http/routing/class-route-binding.php new file mode 100644 index 00000000..1555a6af --- /dev/null +++ b/vendor/mantle-framework/http/routing/class-route-binding.php @@ -0,0 +1,90 @@ +<?php +/** + * Route_Binding class file. + * + * @package Mantle + */ + +namespace Mantle\Http\Routing; + +use Closure; +use Mantle\Contracts\Container; +use Mantle\Database\Model\Model_Not_Found_Exception; +use Mantle\Support\Str; + +/** + * Route Binding to support model-resolution in a route. + */ +class Route_Binding { + /** + * Create a Route model binding for a given callback. + * + * @param Container $container Container instance. + * @param \Closure|string $binder Route binding. + * @return \Closure + */ + public static function for_callback( $container, $binder ) { + if ( is_string( $binder ) ) { + return static::create_class_binding( $container, $binder ); + } + + return $binder; + } + + /** + * Create a class based binding using the IoC container. + * + * @param Container $container + * @param string $binding Binding name. + * @return \Closure + */ + protected static function create_class_binding( Container $container, $binding ) { + return function ( $value, $route ) use ( $container, $binding ) { + // If the binding has an @ sign, we will assume it's being used to delimit + // the class name from the bind method name. This allows for bindings + // to run multiple bind methods in a single class for convenience. + [ $class, $method ] = Str::parse_callback( $binding, 'bind' ); + + $callable = [ $container->make( $class ), $method ]; + + return $callable( $value, $route ); + }; + } + + /** + * Create a Route model binding for a model. + * + * @param Container $container Container instance. + * @param string $class Class name. + * @param \Closure|null $callback Callback for binding. + * @return \Closure + * + * @throws Model_Not_Found_Exception Thrown on missing model. + */ + public static function for_model( Container $container, $class, $callback = null ) { + return function ( $value ) use ( $container, $class, $callback ) { + if ( is_null( $value ) ) { + return; + } + + // For model binders, we will attempt to retrieve the models using the first + // method on the model instance. If we cannot retrieve the models we'll + // throw a not found exception otherwise we will return the instance. + $instance = $container->make( $class ); + + $model = $instance->resolve_route_binding( $value ); + if ( $model ) { + return $model; + } + + // If a callback was supplied to the method we will call that to determine + // what we should do when the model is not found. This just gives these + // developer a little greater flexibility to decide what will happen. + if ( $callback instanceof Closure ) { + return $callback( $value ); + } + + throw ( new Model_Not_Found_Exception() )->set_model( $class ); + }; + } +} diff --git a/vendor/mantle-framework/http/routing/class-route-file-registrar.php b/vendor/mantle-framework/http/routing/class-route-file-registrar.php new file mode 100644 index 00000000..1b43029b --- /dev/null +++ b/vendor/mantle-framework/http/routing/class-route-file-registrar.php @@ -0,0 +1,40 @@ +<?php +/** + * Route_File_Registrar class file. + * + * @package Mantle + */ + +namespace Mantle\Http\Routing; + +/** + * Route File Registrar + */ +class Route_File_Registrar { + + /** + * The router instance. + * + * @var Router + */ + protected $router; + + /** + * Create a new route file registrar instance. + * + * @param Router $router Router instance. + */ + public function __construct( Router $router ) { + $this->router = $router; + } + + /** + * Require the given routes file. + * + * @param string $routes Routes to register. + */ + public function register( $routes ): void { + $router = $this->router; + require $routes; + } +} diff --git a/vendor/mantle-framework/http/routing/class-route-registrar.php b/vendor/mantle-framework/http/routing/class-route-registrar.php new file mode 100644 index 00000000..29ebbdf0 --- /dev/null +++ b/vendor/mantle-framework/http/routing/class-route-registrar.php @@ -0,0 +1,198 @@ +<?php +/** + * Route_Registrar class file. + * + * @package Mantle + */ + +namespace Mantle\Http\Routing; + +use BadMethodCallException; +use Closure; +use InvalidArgumentException; +use Mantle\Support\Arr; + +/** + * Router Registrar + * + * @method \Mantle\Http\Routing\Route_Registrar as(string $value) + * @method \Mantle\Http\Routing\Route_Registrar domain(string $value) + * @method \Mantle\Http\Routing\Route_Registrar middleware(array|string|null $middleware) + * @method \Mantle\Http\Routing\Route_Registrar name(string $value) + * @method \Mantle\Http\Routing\Route_Registrar namespace(string $value) + * @method \Mantle\Http\Routing\Route_Registrar prefix(string $value) + * @method \Mantle\Http\Routing\Route_Registrar where(array $where) + */ +class Route_Registrar { + /** + * The attributes to pass on to the router. + * + * @var array + */ + protected $attributes = []; + + /** + * The methods to dynamically pass through to the router. + * + * @var array + */ + protected $passthru = [ + 'get', + 'post', + 'put', + 'patch', + 'delete', + 'options', + 'any', + ]; + + /** + * The attributes that can be set through this class. + * + * @var array + */ + protected $allowed_attributes = [ + 'as_prefix', + 'as', + 'domain', + 'middleware', + 'name', + 'namespace', + 'prefix', + 'where', + ]; + + /** + * The attributes that are aliased. + * + * @var array + */ + protected $aliases = [ + 'as' => 'as_prefix', + 'name' => 'as_prefix', + ]; + + /** + * Constructor. + * + * @param Router $router Router instance. + */ + public function __construct( protected ?Router $router ) { + } + + /** + * Set the value for a given attribute. + * + * @param string $key + * @param mixed $value + * @return $this + * + * @throws InvalidArgumentException Thrown on unknown attribute. + */ + public function attribute( $key, $value ) { + if ( ! in_array( $key, $this->allowed_attributes ) ) { + throw new InvalidArgumentException( "Attribute [{$key}] does not exist." ); + } + + $this->attributes[ Arr::get( $this->aliases, $key, $key ) ] = $value; + + return $this; + } + + /** + * Create a route group with shared attributes. + * + * @param \Closure|string $callback + */ + public function group( $callback ): static { + $this->router->group( $this->attributes, $callback ); + + return $this; + } + + /** + * Register a new route with the router. + * + * @param string $method + * @param string $uri + * @param \Closure|array|string|null $action + * @return \Mantle\Http\Routing\Route + */ + protected function register_route( $method, $uri, $action = null ) { + if ( ! is_array( $action ) ) { + $action = array_merge( $this->attributes, $action ? [ 'callback' => $action ] : [] ); + } + + return $this->router->{$method}( $uri, $this->compile_action( $action ) ); + } + + /** + * Compile the action into an array including the attributes. + * + * @param \Closure|array|string|null $action + * @return array + */ + protected function compile_action( $action ) { + if ( is_null( $action ) ) { + return $this->attributes; + } + + if ( is_string( $action ) || $action instanceof Closure ) { + $action = [ 'callback' => $action ]; + } + + return array_merge( $this->attributes, $action ); + } + + /** + * Pass the REST API method back to the REST API registrar. + * + * @param string $namespace Route namespace. + * @param Closure|string $route Route name or callback to register more routes. + * @param array|Closure $args Route arguments. + */ + public function rest_api( string $namespace, $route, $args = [] ): Rest_Route_Registrar { + if ( $args instanceof Closure ) { + $args = [ + 'callback' => $args, + ]; + } + + if ( is_array( $args ) ) { + $args = array_merge( $this->attributes, $args ); + } + + return $this->router->rest_api( $namespace, $route, $args ); + } + + /** + * Dynamically handle calls into the route registrar. + * + * @param string $method + * @param array $parameters + * @return \Mantle\Http\Routing\Route|$this + * + * @throws BadMethodCallException Thrown on missing method. + */ + public function __call( $method, $parameters ) { + if ( in_array( $method, $this->passthru ) ) { + return $this->register_route( $method, ...$parameters ); + } + + if ( in_array( $method, $this->allowed_attributes ) ) { + if ( 'middleware' === $method ) { + return $this->attribute( $method, is_array( $parameters[0] ) ? $parameters[0] : $parameters ); + } + + return $this->attribute( $method, $parameters[0] ); + } + + throw new BadMethodCallException( + sprintf( + 'Method %s::%s does not exist.', + static::class, + $method + ) + ); + } +} diff --git a/vendor/mantle-framework/http/routing/class-route-signature-parameters.php b/vendor/mantle-framework/http/routing/class-route-signature-parameters.php new file mode 100644 index 00000000..6589b1a8 --- /dev/null +++ b/vendor/mantle-framework/http/routing/class-route-signature-parameters.php @@ -0,0 +1,72 @@ +<?php +/** + * Route_Signature_Parameters class file. + * + * @package Mantle + */ + +namespace Mantle\Http\Routing; + +use Mantle\Support\Reflector; +use Mantle\Support\Str; +use ReflectionClass; +use ReflectionFunction; +use ReflectionMethod; +use Symfony\Component\HttpKernel\Exception\HttpException; + +/** + * Route Signature Parameters + * + * Extract route action parameters for binding resolution. + */ +class Route_Signature_Parameters { + + /** + * Extract the route action's signature parameters. + * + * @param array $action Route action. + * @param string|null $sub_class Route subclass to compare against. + * @return array + * + * @throws HttpException Thrown on missing callback. + */ + public static function from_action( array $action, $sub_class = null ) { + if ( ! isset( $action['callback'] ) ) { + throw new HttpException( 500, 'Unknown route callback.' ); + } + + if ( is_array( $action['callback'] ) ) { + $class = new ReflectionClass( $action['callback'][0] ); + $parameters = $class->getMethod( $action['callback'][1] )->getParameters(); + } else { + $parameters = is_string( $action['callback'] ) + ? static::from_class_method_string( $action['callback'] ) + : ( new ReflectionFunction( $action['callback'] ) )->getParameters(); + } + + return is_null( $sub_class ) ? $parameters : array_filter( + $parameters, + fn ( $p ) => Reflector::is_parameter_subclass_of( $p, $sub_class ), + ); + } + + /** + * Get the parameters for the given class / method by string. + * + * @param string $uses Route callback. + */ + protected static function from_class_method_string( $uses ): array { + [ $class, $method ] = Str::parse_callback( $uses ); + + // Use the invoke method if it found. + if ( empty( $method ) && class_exists( $class ) && method_exists( $class, '__invoke' ) ) { + $method = '__invoke'; + } + + if ( ! method_exists( $class, $method ) && is_callable( [ $class, $method ] ) ) { + return []; + } + + return ( new ReflectionMethod( $class, $method ) )->getParameters(); + } +} diff --git a/vendor/mantle-framework/http/routing/class-route.php b/vendor/mantle-framework/http/routing/class-route.php new file mode 100644 index 00000000..7a723f8b --- /dev/null +++ b/vendor/mantle-framework/http/routing/class-route.php @@ -0,0 +1,454 @@ +<?php +/** + * Route class file. + * + * @package Mantle + */ + +namespace Mantle\Http\Routing; + +use ArrayAccess; +use ArrayObject; +use JsonSerializable; +use Mantle\Contracts\Container; +use Mantle\Contracts\Http\Routing\Router; +use Mantle\Contracts\Support\Arrayable; +use Mantle\Database\Model\Model; +use Mantle\Http\Controller; +use Mantle\Support\Arr; +use Mantle\Support\Str; +use ReflectionFunction; +use Mantle\Http\Response; +use Mantle\Http\Routing\Middleware\Wrap_Template; +use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\Routing\Route as Symfony_Route; +use Symfony\Component\HttpFoundation\Response as Symfony_Response; + +use function Mantle\Support\Helpers\get_callable_fqn; + +/** + * Route Class + */ +class Route extends Symfony_Route { + use Route_Dependency_Resolver; + + /** + * Key to store the Mantle Route object inside of the Symfony Route. + * + * @var string + */ + public const ROUTE_OBJECT_KEY = '_mantle_route'; + + /** + * Route action. + */ + protected array $action; + + /** + * Container instance. + */ + protected Container $container; + + /** + * Router instance. + * + * @var Router|null + */ + protected ?Router $router = null; + + /** + * Get the route object from a Symfony route match. + * + * @param array $match Route match. + */ + public static function get_route_from_match( array $match ): ?Route { + if ( ! empty( $match[ static::ROUTE_OBJECT_KEY ] ) && $match[ static::ROUTE_OBJECT_KEY ] instanceof Route ) { + return $match[ static::ROUTE_OBJECT_KEY ]; + } + + return null; + } + + /** + * Constructor. + * + * @param array $methods HTTP methods the route responds to. + * @param string $path The path the route responds to. + * @param \Closure|array|string $action The route callback or array of actions. + */ + public function __construct( array $methods, string $path, $action ) { + parent::__construct( $path ); + + $this->setOption( 'utf8', true ); + $this->setMethods( $methods ); + + // Store a reference to the route object inside of the Symfony route. + $this->setDefault( static::ROUTE_OBJECT_KEY, $this ); + + if ( is_callable( $action ) || is_string( $action ) ) { + $action = [ + 'callback' => $action, + ]; + } elseif ( + is_array( $action ) + && ! empty( $action[0] ) + && ! empty( $action[1] ) + && is_string( $action[0] ) + && is_string( $action[1] ) + && class_exists( $action[0] ) + ) { + /** + * Handle controller 'static' style callbacks. + * + * They're written as callable-style (class name -> method). For PHP 8, + * they need to be manually detected since is_callable() will return false + * for non-static methods using the array structure. + */ + $action = [ + 'callback' => $action, + ]; + } + + $this->action = $action; + } + + /** + * Set the route container. + * + * @param Router $router Router interface. + * @return static + */ + public function set_router( Router $router ) { + $this->router = $router; + return $this; + } + + /** + * Get the route's name. + */ + public function get_name(): string { + if ( ! empty( $this->action['as'] ) ) { + return (string) $this->action['as']; + } elseif ( ! empty( $this->action['name'] ) ) { + return (string) $this->action['name']; + } + + // Fallback to the default route name. + return strtolower( implode( '.', $this->getMethods() ) . ".{$this->getPath()}" ); + } + + /** + * Set the name for a route. + * + * @param string $name Name for the route. + * @return static + */ + public function name( string $name ) { + $previous_name = $this->get_name(); + + $this->action['as'] = ! empty( $this->action['as_prefix'] ) ? $this->action['as_prefix'] . $name : $name; + + /** + * Attempt to rename the route in the router. + * + * The route object is stored in a route collection as a reference but the + * route name is a static key for the collection. + */ + if ( isset( $this->router ) ) { + $this->router->rename_route( $previous_name, $this->action['as'] ); + } + + return $this; + } + + /** + * Get the action array or one of its properties for the route. + * + * @param string|null $key Key to get. + * @return mixed + */ + public function get_action( string $key = null ) { + return Arr::get( $this->action, $key ); + } + + /** + * Set the action array for the route. + * + * @param array $action Action for the route. + * @return static + */ + public function set_action( array $action ) { + $this->action = $action; + return $this; + } + + /** + * Get or set the middleware attached to the route. + * + * @param array|string|null $middleware Middleware to set, optional. + * @return static|array + */ + public function middleware( $middleware = null ) { + if ( is_null( $middleware ) ) { + return (array) ( $this->action['middleware'] ?? [] ); + } + + $this->action['middleware'] = array_merge( + (array) ( $this->action['middleware'] ?? [] ), + Arr::wrap( $middleware ), + ); + + return $this; + } + + /** + * Retrieve the middleware that should be excluded from the route. + */ + public function excluded_middleware(): array { + return (array) ( $this->action['excluded_middleware'] ?? [] ); + } + + /** + * Exclude middleware from the route. + * + * @param array|string $middleware Middleware to exclude, optional. + */ + public function without_middleware( array|string $middleware = '*' ): static { + $this->action['excluded_middleware'] = array_merge( + (array) ( $this->action['excluded_middleware'] ?? [] ), + Arr::wrap( $middleware ), + ); + + return $this; + } + + /** + * Exclude the wrap template middleware from the route. + */ + public function without_wrap_template(): static { + return $this->without_middleware( Wrap_Template::class ); + } + + /** + * Set a callback for a route. + * + * @param callable $callback Callback to invoke. + */ + public function callback( callable $callback ): static { + $this->action['callback'] = $callback; + + return $this; + } + + /** + * Render a route. + * + * @todo Add route parameters from the request (pass :slug down to the route). + * + * @param Container $container Service Container. + */ + public function run( Container $container ): ?Symfony_Response { + $this->container = $container; + + if ( $this->has_controller_callback() ) { + $response = $this->run_controller_callback(); + } elseif ( $this->has_callback() ) { + $response = $this->run_callback(); + } + + if ( ! isset( $response ) ) { + return null; + } + + return $response ? static::ensure_response( $response ) : null; + } + + + /** + * Retrieve the route's callback name. + */ + public function get_callback_name(): string { + if ( $this->has_controller_callback() ) { + $controller = $this->get_controller_name(); + $method = $this->get_controller_method(); + + return get_callable_fqn( [ $controller, $method ] ); + } elseif ( $this->has_callback() ) { + return get_callable_fqn( $this->action['callback'] ); + } + + return ''; + } + + /** + * Determine if the route has a closure callback. + */ + protected function has_callback(): bool { + return ! empty( $this->action['callback'] ) && is_callable( $this->action['callback'] ); + } + + /** + * Determine if the route has a controller callback. + */ + protected function has_controller_callback(): bool { + if ( empty( $this->action['callback'] ) ) { + return false; + } + + if ( is_string( $this->action['callback'] ) ) { + // Check for Controller@method callback. + if ( Str::contains( $this->action['callback'], '@' ) ) { + return true; + } + + // Assume it is invokable. + $this->action['callback'] = static::make_invokable( $this->action['callback'] ); + return true; + } + + if ( is_array( $this->action['callback'] ) ) { + [ $controller ] = $this->action['callback']; + + if ( class_exists( $controller ) && is_subclass_of( $controller, Controller::class ) ) { + return true; + } + } + + return false; + } + + /** + * Get the controller name used for the route. + */ + protected function get_controller_name(): string { + return $this->parse_controller_callback()[0] ?? ''; + } + + /** + * Get the controller method used for the route. + */ + protected function get_controller_method(): string { + return $this->parse_controller_callback()[1] ?? ''; + } + + /** + * Parse the controller. + * + * @return array + */ + protected function parse_controller_callback() { + if ( is_string( $this->action['callback'] ) ) { + return Str::parse_callback( $this->action['callback'] ); + } + + return $this->action['callback']; + } + + /** + * Get the controller's closure callback. + * + * @return callable:null + */ + protected function get_callback(): ?callable { + return $this->has_callback() ? $this->action['callback'] : null; + } + + /** + * Run the route's closure callback. + * + * @return mixed + */ + protected function run_callback() { + $callback = $this->get_callback(); + $parameters = $this->resolve_method_dependencies( + $this->get_request_parameters(), + new ReflectionFunction( $callback ) + ); + + return $callback( + ...array_values( $parameters ) + ); + } + + /** + * Run the controller callback. + * + * @return mixed + */ + protected function run_controller_callback() { + $controller = $this->get_controller_name(); + $method = $this->get_controller_method(); + + $controller = $this->container->make( $controller ); + + $parameters = $this->resolve_class_method_dependencies( + $this->get_request_parameters(), + $controller, + $method + ); + + if ( method_exists( $controller, 'call_action' ) ) { + return $controller->call_action( $method, $parameters ); + } + + return $controller->{ $method }( ...array_values( $parameters ) ); + } + + /** + * Ensure a proper response object. + * + * @todo Move this to the Router class. + * + * @param mixed $response Response to send. + */ + public static function ensure_response( $response ): Symfony_Response { + if ( $response instanceof Response || $response instanceof Symfony_Response ) { + return $response; + } + + if ( + is_array( $response ) + || $response instanceof Arrayable + || $response instanceof ArrayAccess + || $response instanceof JsonSerializable + || $response instanceof ArrayObject + || $response instanceof Model + ) { + return new JsonResponse( $response ); + } + + return new Response( $response ); + } + + /** + * Get the route parameters. + */ + public function get_request_parameters(): array { + return $this->container['request']->get_route_parameters()->all(); + } + + /** + * Get the parameters that are listed in the route / controller signature. + * + * @param string|null $sub_class Subclass to verify the parameter is an instance of. + * @return array + */ + public function get_signature_parameters( string $sub_class = null ) { + return Route_Signature_Parameters::from_action( $this->action, $sub_class ); + } + + /** + * Make an action for an invokable controller. + * + * @param string $action + * + * @throws \UnexpectedValueException Thrown on missing method. + */ + protected static function make_invokable( string $action ): string { + if ( ! method_exists( $action, '__invoke' ) ) { + throw new \UnexpectedValueException( "Invalid route action: [{$action}]." ); + } + + return "{$action}@__invoke"; + } +} diff --git a/vendor/mantle-framework/http/routing/class-router.php b/vendor/mantle-framework/http/routing/class-router.php new file mode 100644 index 00000000..ff284492 --- /dev/null +++ b/vendor/mantle-framework/http/routing/class-router.php @@ -0,0 +1,665 @@ +<?php +/** + * Router class file. + * + * @package Mantle + */ + +namespace Mantle\Http\Routing; + +use Closure; +use InvalidArgumentException; +use Mantle\Contracts\Container; +use Mantle\Contracts\Events\Dispatcher; +use Mantle\Contracts\Http\Routing\Router as Router_Contract; +use Mantle\Http\Request; +use Mantle\Http\Routing\Events\Route_Matched; +use Mantle\Support\Pipeline; +use Mantle\Support\Traits\Macroable; +use ReflectionClass; +use Symfony\Component\HttpKernel\Exception\HttpException; +use Symfony\Component\Routing\Matcher\UrlMatcher; +use Symfony\Component\Routing\RequestContext; +use Symfony\Component\Routing\RouteCollection; +use Symfony\Component\HttpFoundation\Response as Symfony_Response; + +use function Mantle\Support\Helpers\collect; + +/** + * Mantle Router + * + * Allow registration of routes to the application. On 'parse_request', the + * request will be dispatched to the router by the HTTP kernel. + * + * @mixin \Mantle\Http\Routing\Route_Registrar + */ +class Router implements Router_Contract { + use Concerns\Route_Group; + use Macroable { + __call as macro_call; + } + + /** + * Route Collection + */ + protected RouteCollection $routes; + + /** + * All of the short-hand keys for middlewares. + */ + protected array $middleware = []; + + /** + * All of the middleware groups. + */ + protected array $middleware_groups = []; + + /** + * The registered route value binders. + */ + protected array $binders = []; + + /** + * REST Route Registrar + */ + protected ?Rest_Route_Registrar $rest_registrar = null; + + /** + * Data Object Router + */ + protected Entity_Router $model_router; + + /** + * Flag or callback to determine if requests should pass through to WordPress. + * + * @var bool|callable + */ + protected mixed $pass_requests_to_wordpress = true; + + /** + * Constructor. + * + * @param Dispatcher $events Events dispatcher. + * @param Container $container Container instance. + */ + public function __construct( protected Dispatcher $events, protected Container $container ) { + $this->routes = new RouteCollection(); + } + + /** + * Register a GET route. + * + * @param string $uri URL to register for. + * @param mixed $action Callback action. + * @return Route + */ + public function get( string $uri, $action = '' ) { + return $this->add_route( [ 'GET', 'HEAD' ], $uri, $action ); + } + + /** + * Register a POST route. + * + * @param string $uri URL to register for. + * @param mixed $action Callback action. + * @return Route + */ + public function post( string $uri, $action = '' ) { + return $this->add_route( [ 'POST' ], $uri, $action ); + } + + /** + * Register a PUT route. + * + * @param string $uri URL to register for. + * @param mixed $action Callback action. + * @return Route + */ + public function put( string $uri, $action = '' ) { + return $this->add_route( [ 'PUT' ], $uri, $action ); + } + + /** + * Register a DELETE route. + * + * @param string $uri URL to register for. + * @param mixed $action Callback action. + * @return Route + */ + public function delete( string $uri, $action = '' ) { + return $this->add_route( [ 'DELETE' ], $uri, $action ); + } + + /** + * Register a PATCH route. + * + * @param string $uri URL to register for. + * @param mixed $action Callback action. + * @return Route + */ + public function patch( string $uri, $action = '' ) { + return $this->add_route( [ 'PATCH' ], $uri, $action ); + } + + /** + * Register a OPTIONS route. + * + * @param string $uri URL to register for. + * @param mixed $action Callback action. + * @return Route + */ + public function options( string $uri, $action = '' ) { + return $this->add_route( [ 'OPTIONS' ], $uri, $action ); + } + + /** + * Register a route for any HTTP method. + * + * @param string $uri URL to register for. + * @param mixed $action Callback action. + */ + public function any( string $uri, $action = '' ): ?Route { + return $this->add_route( [ 'GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS' ], $uri, $action ); + } + + /** + * Load the provided routes. + * + * @param \Closure|string $routes + * @return void + */ + protected function load_routes( $routes ) { + if ( $routes instanceof \Closure ) { + $routes( $this ); + } else { + ( new Route_File_Registrar( $this ) )->register( $routes ); + } + } + + /** + * Register a route. + * + * @param array $methods Methods to register. + * @param string $uri URL route. + * @param mixed $action Route callback. + * @return Route|null Route instance for web routes, null for REST routes. + */ + public function add_route( array $methods, string $uri, $action ): ?Route { + // Send the route to the REST Registrar if set. + if ( isset( $this->rest_registrar ) ) { + $this->create_rest_api_route( $methods, $uri, $action ); + + return null; + } + + $route = $this->create_route( $methods, $uri, $action ); + + $this->routes->add( $route->get_name(), $route ); + + return $route; + } + + /** + * Create a new route instance. + * + * @param array $methods Methods to register. + * @param string $uri URL route. + * @param mixed $action Route callback. + */ + protected function create_route( array $methods, string $uri, $action ): Route { + $route = new Route( $methods, $this->prefix( $uri ), $action ); + + if ( $this->has_group_stack() ) { + $this->merge_group_attributes_into_route( $route ); + } + + $route->set_router( $this ); + + return $route; + } + + /** + * Create a REST API route. + * + * @param array $methods Methods to register. + * @param string $uri URL route. + * @param mixed $action Route callback. + */ + protected function create_rest_api_route( array $methods, string $uri, $action ): void { + $args = [ + 'callback' => $action, + 'methods' => $methods, + ]; + + if ( $this->has_group_stack() ) { + $args = $this->merge_with_last_group( $args ); + } + + $this->rest_registrar->register_route( $this->prefix( $uri ), $args ); + } + + /** + * Prefix the given URI with the last prefix. + * + * @param string $uri Uri to prefix. + * @return string + */ + protected function prefix( string $uri ) { + return trim( trim( $this->get_last_group_prefix(), '/' ) . '/' . trim( $uri, '/' ), '/' ) ?: '/'; + } + + /** + * Get registered routes. + */ + public function get_routes(): RouteCollection { + return $this->routes; + } + + /** + * Retrieve the container/application instance. + */ + public function get_container(): Container { + return $this->container; + } + + /** + * Dispatch a request to the registered routes. + * + * @param Request $request Request object. + */ + public function dispatch( Request $request ): ?Symfony_Response { + return $this->execute_route_match( + $this->match_route( $request ), + $request + ); + } + + /** + * Match a request to a registered route. + * + * @param Request $request Request object. + */ + protected function match_route( Request $request ): ?array { + $context = ( new RequestContext() )->fromRequest( $request ); + + return ( new UrlMatcher( $this->get_routes(), $context ) )->matchRequest( $request ); + } + + /** + * Execute a route match and retrieve the response. + * + * @param array $match Route match. + * @param Request $request Request object. + * + * @throws HttpException Thrown on unknown route callback. + */ + protected function execute_route_match( $match, Request $request ): ?Symfony_Response { + // Store the request parameters. + $request->set_route_parameters( $match ); + $this->container->instance( 'request', $request ); + + $route = Route::get_route_from_match( $match ); + + if ( ! $route ) { + throw new HttpException( 500, 'Unknown route method: ' . \wp_json_encode( $match ) ); + } + + // Store the route match in the request object. + $this->container['request']->set_route( $route ); + + $this->events->dispatch( new Route_Matched( $route, $request ) ); + + $middleware = $this->gather_route_middleware( $route ); + + $response = ( new Pipeline( $this->container ) ) + ->send( $this->container['request'] ) + ->through( $middleware ) + ->then( + function( Request $request ) use ( $route ) { + // Refresh the request object in the container with modifications from the middleware. + $this->container['request'] = $request; + + return $route->run( $this->container ); + } + ); + + // Ensure the response is valid since the middleware can modify it after it is run through Route. + return static::to_response( $request, $response ); + } + + /** + * Prepare a response for sending. + * + * @param Request $request + * @param mixed $response + */ + public static function to_response( Request $request, mixed $response ): \Symfony\Component\HttpFoundation\Response { + $response = Route::ensure_response( $response ); + + return $response->prepare( $request ); + } + + /** + * Get all of the defined middleware short-hand names. + * + * @return array + */ + public function get_middleware() { + return $this->middleware; + } + + /** + * Register a short-hand name for a middleware. + * + * @param string $name + * @param string $class + */ + public function alias_middleware( string $name, string $class ): static { + $this->middleware[ $name ] = $class; + + return $this; + } + + /** + * Get all of the defined middleware groups. + * + * @return array + */ + public function get_middleware_groups() { + return $this->middleware_groups; + } + + /** + * Register a group of middleware. + * + * @param string $name + * @param array $middleware + */ + public function middleware_group( string $name, array $middleware ): static { + $this->middleware_groups[ $name ] = $middleware; + + return $this; + } + + /** + * Add a middleware to the beginning of a middleware group. + * + * If the middleware is already in the group, it will not be added again. + * + * @param string $group + * @param string $middleware + * @return static + */ + public function prepend_middleware_to_group( $group, $middleware ) { + if ( isset( $this->middleware_groups[ $group ] ) && ! in_array( $middleware, $this->middleware_groups[ $group ] ) ) { + array_unshift( $this->middleware_groups[ $group ], $middleware ); + } + + return $this; + } + + /** + * Add a middleware to the end of a middleware group. + * + * If the middleware is already in the group, it will not be added again. + * + * @param string $group + * @param string $middleware + * @return static + */ + public function push_middleware_to_group( $group, $middleware ) { + if ( ! array_key_exists( $group, $this->middleware_groups ) ) { + $this->middleware_groups[ $group ] = []; + } + + if ( ! in_array( $middleware, $this->middleware_groups[ $group ] ) ) { + $this->middleware_groups[ $group ][] = $middleware; + } + + return $this; + } + + /** + * Gather the middleware for the given route with resolved class names. + * + * @param Route $route Route instance. + */ + public function gather_route_middleware( Route $route ): array { + $middleware = $route->excluded_middleware(); + + // If the route has a wildcard, we will just skip the middleware gathering. + if ( in_array( '*', $middleware, true ) ) { + return []; + } + + $excluded = collect( $route->excluded_middleware() ) + ->map( + fn ( $name ) => Middleware_Name_Resolver::resolve( $name, $this->middleware, $this->middleware_groups ), + ) + ->flatten() + ->values() + ->all(); + + return collect( $route->middleware() ) + ->map( + fn ( $name ) => (array) Middleware_Name_Resolver::resolve( $name, $this->middleware, $this->middleware_groups ), + ) + ->flatten() + ->reject( + function ( $name ) use ( $excluded ) { + if ( empty( $excluded ) ) { + return false; + } + + if ( $name instanceof Closure ) { + return false; + } + + if ( in_array( $name, $excluded, true ) ) { + return true; + } + + $reflection = new ReflectionClass( $name ); + + return collect( $excluded )->contains( + fn ( $exclude ) => class_exists( $exclude ) && $reflection->isSubclassOf( $exclude ) + ); + } + ) + ->values() + ->all(); + } + + /** + * Add a new route parameter binder. + * + * @param string $key + * @param string|callable $binder + */ + public function bind( string $key, $binder ): void { + $this->binders[ str_replace( '-', '_', $key ) ] = Route_Binding::for_callback( + $this->container, + $binder + ); + } + + /** + * Register a model binder for a wildcard. + * + * @param string $key + * @param string $class + * @param \Closure|null $callback + */ + public function bind_model( $key, $class, Closure $callback = null ): void { + $this->bind( $key, Route_Binding::for_model( $this->container, $class, $callback ) ); + } + + /** + * Substitute Explicit Bindings + * + * @param Request $request Request object. + */ + public function substitute_bindings( Request $request ): void { + foreach ( $request->get_route_parameters() as $key => $value ) { + if ( ! isset( $this->binders[ $key ] ) ) { + continue; + } + + $request->set_route_parameter( $key, $this->perform_binding( $key, $value, $request ) ); + } + } + + /** + * Call the binding callback for the given key. + * + * @param string $key Route key. + * @param string $value Value. + * @param Request $request Request object. + * @return mixed + */ + protected function perform_binding( string $key, $value, Request $request ) { + return call_user_func( $this->binders[ $key ], $value, $request ); + } + + /** + * Substitute the implicit Eloquent model bindings for the route. + * + * @param Request $request Request instance. + */ + public function substitute_implicit_bindings( Request $request ): void { + Implicit_Route_Binding::resolve_for_route( $this->container, $request ); + } + + /** + * Register a REST API route + * + * @param string $namespace Namespace for the REST API route. + * @param callable|string $callback Callback that will be invoked to register + * routes OR a string route. + * @param callable|array|string $args Callback for the route if $callback is a + * string route OR arguments to pass to + * the register_rest_route() call. Not used if $callback + * is a closure. + */ + public function rest_api( string $namespace, callable|string $callback, callable|array|string $args = [] ) { + $registrar = new Rest_Route_Registrar( $this, $namespace ); + + if ( is_callable( $callback ) ) { + $this->rest_registrar = $registrar; + + $callback(); + + $this->rest_registrar = null; + } else { + if ( is_callable( $args ) ) { + $args = [ + 'callback' => $args, + ]; + } + // Include the group attributes. + if ( $this->has_group_stack() ) { + $args = $this->merge_with_last_group( $args ); + } + + $registrar->register_route( $this->prefix( $callback ), $args ); + } + + return $registrar; + } + + /** + * Register routing for a WordPress model. + * + * @param string $model Model class name. + * @param string $controller Controller class name. + */ + public function model( string $model, string $controller ): void { + $this->container->make( Entity_Router::class )->add( $this, $model, $controller ); + } + + /** + * Dynamically handle calls into the router instance. + * + * @param string $method Method name. + * @param array $parameters Parameters for the method. + * @return mixed + */ + public function __call( $method, $parameters ) { + if ( static::has_macro( $method ) ) { + return $this->macro_call( $method, $parameters ); + } + + if ( 'middleware' === $method ) { + return ( new Route_Registrar( $this ) ) + ->attribute( $method, is_array( $parameters[0] ) ? $parameters[0] : $parameters ); + } + + return ( new Route_Registrar( $this ) )->attribute( $method, $parameters[0] ); + } + + /** + * Sync the routes to the URL generator. + */ + public function sync_routes_to_url_generator(): void { + $this->container['url']->set_routes( $this->routes ); + } + + /** + * Rename a route. + * + * @param string $old_name Old route name. + * @param string $new_name New route name. + * + * @throws \InvalidArgumentException Thrown when attempting to rename a route + * a name that is already taken. + */ + public function rename_route( string $old_name, string $new_name ): static { + $old = $this->routes->get( $old_name ); + + if ( ! $old ) { + return $this; + } + + $new = $this->routes->get( $new_name ); + + if ( $new ) { + throw new InvalidArgumentException( "Unable to rename route, name already taken. [{$old_name} => {$new_name}]" ); + } + + $this->routes->add( $new_name, $old ); + $this->routes->remove( $old_name ); + + return $this; + } + + /** + * Determine if the request should pass through to WordPress. + * + * @param (callable(\Mantle\Http\Request): bool)|bool $callback Callback to determine if the request should pass through to WordPress. + */ + public function pass_requests_to_wordpress( $callback ): static { + $this->pass_requests_to_wordpress = $callback; + + return $this; + } + + /** + * Determine if the request should pass through to WordPress. + * + * @param Request $request Request object. + */ + public function should_pass_through_request( Request $request ): bool { + // Early checks to always allow the REST API and prevent routing when not using themes. + if ( str_starts_with( $request->path(), 'wp-json' ) ) { + return true; + } + + if ( ! wp_using_themes() ) { + return true; + } + + $status = $this->pass_requests_to_wordpress; + + return is_callable( $status ) ? (bool) $status( $request ) : $status; + } +} diff --git a/vendor/mantle-framework/http/routing/class-url-generator.php b/vendor/mantle-framework/http/routing/class-url-generator.php new file mode 100644 index 00000000..4f627d08 --- /dev/null +++ b/vendor/mantle-framework/http/routing/class-url-generator.php @@ -0,0 +1,317 @@ +<?php +/** + * Url_Generator class file. + * + * @package Mantle + */ + +namespace Mantle\Http\Routing; + +use Mantle\Contracts\Http\Routing\Url_Generator as Generator_Contract; +use Mantle\Contracts\Http\Routing\Url_Routable; +use Mantle\Http\Request; +use Mantle\Support\Arr; +use Mantle\Support\Str; +use Psr\Log\LoggerInterface; +use Symfony\Component\Routing\Generator\UrlGenerator; +use Symfony\Component\Routing\RequestContext; +use Symfony\Component\Routing\RouteCollection; + +/** + * URL Generator + * + * Generates URLs to routes, paths, etc. on th e site. + */ +class Url_Generator extends UrlGenerator implements Generator_Contract { + /** + * The request instance. + * + * @var Request + */ + protected $request; + + /** + * The forced scheme for URLs. + */ + protected ?string $force_scheme = null; + + /** + * A cached copy of the URL root for the current request. + */ + protected ?string $cached_root = null; + + /** + * A cached copy of the URL scheme for the current request. + */ + protected ?string $cached_scheme = null; + + /** + * Constructor. + * + * @param string $root_url Root URL. + * @param RouteCollection $routes Route collection. + * @param Request $request Request object. + * @param LoggerInterface|null $logger Logger instance. + */ + public function __construct( protected string $root_url, RouteCollection $routes, Request $request, LoggerInterface $logger = null ) { + $this->root_url = $root_url; + $this->routes = $routes; + $this->logger = $logger; + + $this->set_request( $request ); + } + + /** + * Set the request object. + * + * @param Request $request Request object to set. + * @return static + */ + public function set_request( Request $request ) { + $this->request = $request; + $this->context = ( new RequestContext() )->fromRequest( $request ); + + // Set the host for the request context if it is not already set. + if ( empty( $this->context->getHost() ) ) { + $this->context->setHost( (string) parse_url( $this->root_url, PHP_URL_HOST ) ); // phpcs:ignore WordPress.WP.AlternativeFunctions.parse_url_parse_url + } + + if ( ! $this->context->hasParameter( '_locale' ) ) { + $this->context->setParameter( '_locale', 'en' ); + } + + return $this; + } + + /** + * Get the request object. + */ + public function get_request(): Request { + return $this->request; + } + + /** + * Get the current URL for the request. + * + * @return string + */ + public function current() { + return $this->to( $this->request->getPathInfo() ); + } + + /** + * Get the URL for the previous request. + * + * @param string $fallback Fallback value, optional. + */ + public function previous( string $fallback = null ): string { + return $this->to( + $this->request->headers->get( 'referer', $fallback ?? '/' ) + ); + } + + /** + * Generate a URL to a specific path. + * + * @param string $path URL Path. + * @param array<string, mixed> $extra_query Extra query parameters to be appended to the URL path. + * @param array $extra_params Extra parameters to be appended to the URL path. + * @param bool $secure Flag if should be forced to be secure. + * @return string + */ + public function to( string $path, array $extra_query = [], array $extra_params = [], bool $secure = null ) { + // First we will check if the URL is already a valid URL. If it is we will not + // try to generate a new one but will simply return the URL as is, which is + // convenient since developers do not always have to check if it's valid. + if ( $this->is_valid_url( $path ) ) { + return $path; + } + + $tail = implode( + '/', + array_map( + 'rawurlencode', + $this->format_parameters( $extra_params ) + ) + ); + + // Once we have the scheme we will compile the "tail" by collapsing the values + // into a single string delimited by slashes. This just makes it convenient + // for passing the array of parameters to this URL as a list of segments. + $root = $this->format_root( $this->format_scheme( $secure ) ); + + [ $path, $query ] = $this->extract_query_string( $path ); + + // Append the tail to the path while preserving the trailing slash on the path. + if ( ! empty( $tail ) ) { + $path = rtrim( $path, '/' ) . '/' . $tail . ( Str::ends_with( $path, '/' ) ? '/' : '' ); + } + + $url = $this->format( $root, $path ) . $query; + + // Append any extra query parameters. + if ( ! empty( $extra_query ) ) { + $extra_query = Arr::query( $extra_query ); + + $url .= ( Str::contains( $url, '?' ) ? '&' : '?' ) . $extra_query; + } + + return $url; + } + + /** + * Generate a URL for a route. + * + * @param string $name Route name. + * @param array $parameters Route parameters. + * @param bool $absolute Flag if should be absolute. + * + * @throws \Symfony\Component\Routing\Exception\RouteNotFoundException If route not found. + */ + public function route( string $name, array $parameters = [], bool $absolute = true ): string { + return $this->generate( + $name, + $parameters, + $absolute ? self::ABSOLUTE_URL : self::ABSOLUTE_PATH, + ); + } + + /** + * Format the array of URL parameters. + * + * @param mixed|array $parameters + */ + public function format_parameters( $parameters ): array { + $parameters = Arr::wrap( $parameters ); + + foreach ( $parameters as $key => $parameter ) { + if ( $parameter instanceof Url_Routable ) { + $parameters[ $key ] = $parameter->get_route_key(); + } + } + + return $parameters; + } + + /** + * Get the default scheme for a raw URL. + * + * @param bool|null $secure Flag if should be secure. + */ + public function format_scheme( $secure = null ): string { + if ( ! is_null( $secure ) ) { + return $secure ? 'https://' : 'http://'; + } + + if ( empty( $this->cached_scheme ) ) { + $this->cached_scheme = $this->force_scheme ?: $this->context->getScheme() . '://'; + } + + return $this->cached_scheme; + } + + /** + * Extract the query string from the given path. + * + * @param string $path URL Path. + * @return array<int, string> + */ + protected function extract_query_string( $path ) { + $query_position = strpos( $path, '?' ); + if ( false !== $query_position ) { + return [ + substr( $path, 0, $query_position ), + substr( $path, $query_position ), + ]; + } + + return [ $path, '' ]; + } + + /** + * Get the root URL. + */ + public function get_root_url(): string { + return $this->root_url; + } + + /** + * Set the root URL. + * + * @param string $url Root URL to set. + * @return static + */ + public function root_url( string $url ) { + $this->cached_root = null; + + $this->root_url = $url; + + $this->context->setHost( parse_url( $url, PHP_URL_HOST ) ); // phpcs:ignore WordPress.WP.AlternativeFunctions.parse_url_parse_url + + return $this; + } + + /** + * Get the base URL for the request. + * + * @param string $scheme + * @param string|null $root + */ + public function format_root( string $scheme, ?string $root = null ): string { + if ( is_null( $root ) ) { + $root = $this->root_url; + } + + $start = str_starts_with( $root, 'http://' ) ? 'http://' : 'https://'; + + return preg_replace( '~' . $start . '~', $scheme, $root, 1 ); + } + + /** + * Format the given URL segments into a single URL. + * + * Preserves the path's trailing slash if present. + * + * @param string $root URL root. + * @param string $path URL path. + */ + public function format( string $root, string $path ): string { + return trim( rtrim( $root, '/' ) . '/' . ltrim( $path, '/' ) ); + } + + /** + * Determine if the given path is a valid URL. + * + * @param string $path + */ + public function is_valid_url( $path ): bool { + if ( ! preg_match( '~^(#|//|https?://|(mailto|tel|sms):)~', $path ) ) { + return filter_var( $path, FILTER_VALIDATE_URL ) !== false; + } + + return true; + } + + /** + * Force the scheme for URLs. + * + * @param string $scheme + */ + public function force_scheme( string $scheme ): void { + $this->cached_scheme = null; + + $this->force_scheme = $scheme . '://'; + } + + /** + * Set the routes in the generator. + * + * @param RouteCollection $routes Route collection. + * @return static + */ + public function set_routes( RouteCollection $routes ) { + $this->routes = $routes; + + return $this; + } +} diff --git a/vendor/mantle-framework/http/routing/concerns/trait-route-group.php b/vendor/mantle-framework/http/routing/concerns/trait-route-group.php new file mode 100644 index 00000000..1225d888 --- /dev/null +++ b/vendor/mantle-framework/http/routing/concerns/trait-route-group.php @@ -0,0 +1,203 @@ +<?php +/** + * Route_Group trait file. + * + * @package Mantle + */ + +namespace Mantle\Http\Routing\Concerns; + +use Mantle\Http\Routing\Route; +use Mantle\Support\Arr; + +/** + * Route Group functions. + */ +trait Route_Group { + /** + * The route group attribute stack. + * + * @var array + */ + protected $group_stack = []; + + /** + * Determine if the router currently has a group stack. + * + * @return bool + */ + public function has_group_stack() { + return ! empty( $this->group_stack ); + } + + /** + * Get the current group stack for the router. + * + * @return array + */ + public function get_group_stack() { + return $this->group_stack; + } + + /** + * Create a route group with shared attributes. + * + * @param array $attributes + * @param \Closure|string $routes + */ + public function group( array $attributes, $routes ): void { + $this->update_group_stack( $attributes ); + + // Once we have updated the group stack, we'll load the provided routes and + // merge in the group's attributes when the routes are created. After we + // have created the routes, we will pop the attributes off the stack. + $this->load_routes( $routes ); + + array_pop( $this->group_stack ); + } + + /** + * Update the group stack with the given attributes. + * + * @param array $attributes + * @return void + */ + protected function update_group_stack( array $attributes ) { + if ( $this->has_group_stack() ) { + $attributes = $this->merge_with_last_group( $attributes ); + } + + $this->group_stack[] = $attributes; + } + + /** + * Merge the given array with the last group stack. + * + * @param array $new New route attributes. + * @param bool $prepend_existing_prefix Prepend the existing prefix. + */ + public function merge_with_last_group( $new, $prepend_existing_prefix = true ): array { + return static::merge( $new, end( $this->group_stack ), $prepend_existing_prefix ); + } + + /** + * Get the prefix from the last group on the stack. + */ + protected function get_last_group_prefix(): string { + if ( $this->has_group_stack() ) { + $last = end( $this->group_stack ); + + return $last['prefix'] ?? ''; + } + + return ''; + } + + /** + * Merge the group stack with the controller action. + * + * @param Route $route Route instance. + */ + protected function merge_group_attributes_into_route( Route $route ): void { + $route->set_action( + $this->merge_with_last_group( + $route->get_action(), + false + ) + ); + } + + /** + * Merge route groups into a new array. + * + * @param array $new + * @param array $old + * @param bool $prepend_existing_prefix + */ + public static function merge( $new, $old, $prepend_existing_prefix = true ): array { + if ( isset( $new['domain'] ) ) { + unset( $old['domain'] ); + } + + $new = array_merge( + static::format_as( $new, $old ), + [ + 'namespace' => static::format_namespace( $new, $old ), + 'prefix' => static::format_prefix( $new, $old, $prepend_existing_prefix ), + 'where' => static::format_where( $new, $old ), + ] + ); + + return array_merge_recursive( + Arr::except( + $old, + [ 'namespace', 'prefix', 'where', 'as' ] + ), + $new + ); + } + + /** + * Format the namespace for the new group attributes. + * + * @param array $new + * @param array $old + * @return string|null + */ + protected static function format_namespace( $new, $old ) { + if ( isset( $new['namespace'] ) ) { + return isset( $old['namespace'] ) && ! str_starts_with( (string) $new['namespace'], '\\' ) + ? trim( (string) $old['namespace'], '\\' ) . '\\' . trim( (string) $new['namespace'], '\\' ) + : trim( (string) $new['namespace'], '\\' ); + } + + return $old['namespace'] ?? null; + } + + /** + * Format the prefix for the new group attributes. + * + * @param array $new + * @param array $old + * @param bool $prepend_existing_prefix + * @return string|null + */ + protected static function format_prefix( $new, $old, $prepend_existing_prefix = true ) { + $old = $old['prefix'] ?? null; + + if ( $prepend_existing_prefix ) { + return isset( $new['prefix'] ) ? trim( (string) $old, '/' ) . '/' . trim( (string) $new['prefix'], '/' ) : $old; + } else { + return isset( $new['prefix'] ) ? trim( (string) $new['prefix'], '/' ) . '/' . trim( (string) $old, '/' ) : $old; + } + } + + /** + * Format the "wheres" for the new group attributes. + * + * @param array $new + * @param array $old + * @return array + */ + protected static function format_where( $new, $old ) { + return array_merge( + $old['where'] ?? [], + $new['where'] ?? [] + ); + } + + /** + * Format the "as" clause of the new group attributes. + * + * @param array $new + * @param array $old + * @return array + */ + protected static function format_as( $new, $old ) { + if ( isset( $old['as'] ) ) { + $new['as'] = $old['as'] . ( $new['as'] ?? '' ); + } + + return $new; + } +} diff --git a/vendor/mantle-framework/http/routing/events/class-bindings-substituted.php b/vendor/mantle-framework/http/routing/events/class-bindings-substituted.php new file mode 100644 index 00000000..6ddda5f9 --- /dev/null +++ b/vendor/mantle-framework/http/routing/events/class-bindings-substituted.php @@ -0,0 +1,31 @@ +<?php +/** + * Bindings_Substituted class file. + * + * @package Mantle + */ + +namespace Mantle\Http\Routing\Events; + +use Mantle\Http\Request; + +/** + * Event for when bindings are substituted for a request. + */ +class Bindings_Substituted { + /** + * Request instance. + * + * @var Request + */ + public $request; + + /** + * Constructor. + * + * @param Request $request Request instance. + */ + public function __construct( Request $request ) { + $this->request = $request; + } +} diff --git a/vendor/mantle-framework/http/routing/events/class-entity-route-added.php b/vendor/mantle-framework/http/routing/events/class-entity-route-added.php new file mode 100644 index 00000000..56cd661b --- /dev/null +++ b/vendor/mantle-framework/http/routing/events/class-entity-route-added.php @@ -0,0 +1,38 @@ +<?php +/** + * Entity_Route_Added class file. + * + * @package Mantle + */ + +namespace Mantle\Http\Routing\Events; + +/** + * Event for adding an entity route. + */ +class Entity_Route_Added { + /** + * Entity class name. + * + * @var string + */ + public $entity; + + /** + * Controller class name. + * + * @var string + */ + public $controller; + + /** + * Constructor. + * + * @param string $entity Entity class name. + * @param string $controller Controller class name. + */ + public function __construct( string $entity, string $controller ) { + $this->entity = $entity; + $this->controller = $controller; + } +} diff --git a/vendor/mantle-framework/http/routing/events/class-route-matched.php b/vendor/mantle-framework/http/routing/events/class-route-matched.php new file mode 100644 index 00000000..7c5d085e --- /dev/null +++ b/vendor/mantle-framework/http/routing/events/class-route-matched.php @@ -0,0 +1,27 @@ +<?php +/** + * Route_Matched class file. + * + * @package Mantle + */ + +namespace Mantle\Http\Routing\Events; + +use Mantle\Http\Request; +use Mantle\Http\Routing\Route; +use WP_REST_Request; + +/** + * Event for route matched event. + */ +class Route_Matched { + /** + * Constructor. + * + * @param Route|array $route Route matched, Mantle route or an array of route + * information for REST API routes. + * @param Request|WP_REST_Request $request Current request. + */ + public function __construct( public Route|array $route, public Request|WP_REST_Request $request ) { + } +} diff --git a/vendor/mantle-framework/http/routing/middleware/class-setup-wordpress.php b/vendor/mantle-framework/http/routing/middleware/class-setup-wordpress.php new file mode 100644 index 00000000..3efb7f4a --- /dev/null +++ b/vendor/mantle-framework/http/routing/middleware/class-setup-wordpress.php @@ -0,0 +1,86 @@ +<?php +/** + * Setup_WordPress class file. + * + * @package Mantle + */ + +namespace Mantle\Http\Routing\Middleware; + +use Closure; +use Mantle\Contracts\Application; +use Mantle\Http\Request; +use Mantle\Query_Monitor\Query_Monitor_Service_Provider; + +/** + * Setup the WordPress environment for routing. + * + * Ensures that normal WordPress hooks such as 'wp' fire and fixes the Query Monitor. + */ +class Setup_WordPress { + /** + * Store if the admin bar was already setup. + * + * @var bool + */ + protected static $did_setup = false; + + /** + * Application instance. + * + * @var Application + */ + protected $app; + + /** + * Constructor. + * + * @param Application $app Application instance. + */ + public function __construct( Application $app ) { + $this->app = $app; + } + + /** + * Handle an incoming request and setup the admin bar. + * + * @param Request $request Request instance. + * @param \Closure $next Callback for the middleware. + * @return mixed + */ + public function handle( Request $request, Closure $next ) { + global $wp; + + if ( ! static::$did_setup && $wp instanceof \WP && ! \did_action( 'template_redirect' ) ) { + // Allow WP to set the current user and fire the 'WP' hook. + $wp->init(); + + /* Documented in wp-includes/class-wp.php */ + \do_action_ref_array( 'wp', [ $wp ] ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound + \_wp_admin_bar_init(); + } + + $response = $next( $request ); + + // Store the response object for use in Query Monitor. + $this->app->instance( 'response', $response ); + + if ( ! static::$did_setup ) { + static::$did_setup = true; + + $provider = $this->app->get_provider( Query_Monitor_Service_Provider::class ); + + if ( $provider instanceof Query_Monitor_Service_Provider ) { + $qm_output = $provider->fire_query_monitor_dispatches(); + + if ( ! empty( $qm_output ) ) { + $response->setContent( $response->getContent() . $qm_output ); + } + } + } + + unset( $this->app['response'] ); + + return $response; + } +} diff --git a/vendor/mantle-framework/http/routing/middleware/class-substitute-bindings.php b/vendor/mantle-framework/http/routing/middleware/class-substitute-bindings.php new file mode 100644 index 00000000..3754d6eb --- /dev/null +++ b/vendor/mantle-framework/http/routing/middleware/class-substitute-bindings.php @@ -0,0 +1,52 @@ +<?php +/** + * Substitute_Bindings class file. + * + * @package Mantle + */ + +namespace Mantle\Http\Routing\Middleware; + +use Closure; +use Mantle\Contracts\Http\Routing\Router; +use Mantle\Http\Request; +use Mantle\Http\Routing\Events\Bindings_Substituted; + +use function Mantle\Support\Helpers\event; + +/** + * Substitute parameters for the route with dynamically binded models. + */ +class Substitute_Bindings { + /** + * Router Instance + * + * @var Router + */ + protected $router; + + /** + * Constructor. + * + * @param Router $router Router instance. + */ + public function __construct( Router $router ) { + $this->router = $router; + } + + /** + * Handle an incoming request. + * + * @param Request $request Request instance. + * @param \Closure $next Callback for the middleware. + * @return mixed + */ + public function handle( Request $request, Closure $next ) { + $this->router->substitute_bindings( $request ); + $this->router->substitute_implicit_bindings( $request ); + + event( new Bindings_Substituted( $request ) ); + + return $next( $request ); + } +} diff --git a/vendor/mantle-framework/http/routing/middleware/class-wrap-template.php b/vendor/mantle-framework/http/routing/middleware/class-wrap-template.php new file mode 100644 index 00000000..92130499 --- /dev/null +++ b/vendor/mantle-framework/http/routing/middleware/class-wrap-template.php @@ -0,0 +1,103 @@ +<?php +/** + * Wrap_Template class file. + * + * @package Mantle + */ + +namespace Mantle\Http\Routing\Middleware; + +use Closure; +use Mantle\Contracts\Application; +use Mantle\Http\Request; +use Mantle\Http\Response; +use Mantle\Http\View\Factory; +use Symfony\Component\HttpFoundation\Response as Symfony_Response; + +/** + * Wrap the current response with a template. + * + * Passes the current response to a wrapper template. You can display the contents + * with `render_main_template()`. + */ +class Wrap_Template { + /** + * Application instance. + * + * @var Application + */ + protected $app; + + /** + * Constructor. + * + * @param Application $app Application instance. + */ + public function __construct( Application $app ) { + $this->app = $app; + } + + /** + * Handle an incoming request and setup the admin bar. + * + * @param Request $request Request instance. + * @param \Closure $next Callback for the middleware. + * @return mixed + */ + public function handle( Request $request, Closure $next ) { + if ( $request->is_json() ) { + return $next( $request ); + } + + $response = $next( $request ); + + // If the response is not a Response object, we can't wrap it. + if ( ! $response instanceof \Symfony\Component\HttpFoundation\Response ) { + return $response; + } + + /** + * Filter the template for wrapping the content. + * + * @param string|null $template Template to use. + */ + $template = \apply_filters( 'mantle_wrap_template', null ); + + // Fill in the header and footer if no template is specified. + if ( empty( $template ) ) { + return $this->wrap_fallback( $response ); + } + + try { + $factory = $this->app->make( Factory::class ); + } catch ( \Throwable $e ) { + unset( $e ); + return $this->wrap_fallback( $response ); + } + + $response->setContent( + $factory->make( $template, [ '_mantle_contents' => $response->getContent() ] )->render() + ); + + return $response; + } + + /** + * Fallback to running get_header()/get_footer() around the content if a wrapper + * template is not specified. + * + * @param Symfony_Response $response Response object. + * @return Symfony_Response + */ + protected function wrap_fallback( Symfony_Response $response ) { + ob_start(); + \get_header(); + // Assumed to be sanitized. + echo $response->getContent(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + \get_footer(); + + $response->setContent( ob_get_clean() ); + + return $response; + } +} diff --git a/vendor/mantle-framework/http/routing/trait-route-dependency-resolver.php b/vendor/mantle-framework/http/routing/trait-route-dependency-resolver.php new file mode 100644 index 00000000..5b7c5bfe --- /dev/null +++ b/vendor/mantle-framework/http/routing/trait-route-dependency-resolver.php @@ -0,0 +1,129 @@ +<?php +/** + * Route_Dependency_Resolver trait file. + * + * @package Mantle + * + * @phpcs:disable Squiz.Commenting.FunctionComment + */ + +namespace Mantle\Http\Routing; + +use Mantle\Support\Arr; +use Mantle\Support\Reflector; +use ReflectionClass; +use ReflectionFunctionAbstract; +use ReflectionMethod; +use ReflectionParameter; + +/** + * Route Method Dependency Resolver + */ +trait Route_Dependency_Resolver { + + /** + * Resolve the object method's type-hinted dependencies. + * + * @param array $parameters + * @param object $instance + * @param string $method + * @return array + */ + protected function resolve_class_method_dependencies( array $parameters, $instance, $method ) { + if ( ! method_exists( $instance, $method ) ) { + return $parameters; + } + + return $this->resolve_method_dependencies( + $parameters, + new ReflectionMethod( $instance, $method ) + ); + } + + /** + * Resolve the given method's type-hinted dependencies. + * + * @param array $parameters + * @param \ReflectionFunctionAbstract $reflector + */ + public function resolve_method_dependencies( array $parameters, ReflectionFunctionAbstract $reflector ): array { + $instance_count = 0; + + $values = array_values( $parameters ); + + $skippable_value = new \stdClass(); + + foreach ( $reflector->getParameters() as $key => $parameter ) { + $instance = $this->transform_dependency( $parameter, $parameters, $skippable_value ); + + if ( $instance !== $skippable_value ) { + $instance_count++; + + $this->splice_into_parameters( $parameters, $key, $instance ); + } elseif ( ! isset( $values[ $key - $instance_count ] ) && + $parameter->isDefaultValueAvailable() ) { + $this->splice_into_parameters( $parameters, $key, $parameter->getDefaultValue() ); + } + } + + return $parameters; + } + + /** + * Attempt to transform the given parameter into a class instance. + * + * @param \ReflectionParameter $parameter + * @param array $parameters + * @param object $skippable_value + * @return mixed + */ + protected function transform_dependency( ReflectionParameter $parameter, $parameters, $skippable_value ) { + $class_name = Reflector::get_parameter_class_name( $parameter ); + + // If the parameter has a type-hinted class, we will check to see if it is already in + // the list of parameters. If it is we will just skip it as it is probably a model + // binding and we do not want to mess with those; otherwise, we resolve it here. + if ( $class_name && ! $this->already_in_parameters( $class_name, $parameters ) ) { + $is_enum = ( new ReflectionClass( $class_name ) )->isEnum(); + + return $parameter->isDefaultValueAvailable() + ? ( $is_enum ? $parameter->getDefaultValue() : null ) + : $this->container->make( $class_name ); + } + + return $skippable_value; + } + + /** + * Determine if an object of the given class is in a list of parameters. + * + * @param class-string $class + * @param array $parameters + * @return bool + */ + protected function already_in_parameters( string $class, array $parameters ) { + return ! is_null( + Arr::first( + $parameters, + fn ( $value ) => $value instanceof $class, + ) + ); + } + + /** + * Splice the given value into the parameter list. + * + * @param array $parameters + * @param int $offset + * @param mixed $value + * @return void + */ + protected function splice_into_parameters( array &$parameters, int $offset, mixed $value ) { + array_splice( + $parameters, + $offset, + 0, + [ $value ] + ); + } +} diff --git a/vendor/mantle-framework/http/trait-interacts-with-input.php b/vendor/mantle-framework/http/trait-interacts-with-input.php new file mode 100644 index 00000000..f77baf0f --- /dev/null +++ b/vendor/mantle-framework/http/trait-interacts-with-input.php @@ -0,0 +1,404 @@ +<?php +/** + * Interacts_With_Input trait file. + * + * @phpcs:disable Squiz.Commenting.FunctionComment.MissingParamComment + * + * @package Mantle + */ + +namespace Mantle\Http; + +use Mantle\Http\Uploaded_File; +use Mantle\Support\Arr; +use Mantle\Support\Str; +use stdClass; + +use function Mantle\Support\Helpers\data_get; + +/** + * Interacts With Input trait. + */ +trait Interacts_With_Input { + + /** + * Retrieve a server variable from the request. + * + * @param string|null $key + * @param string|array|null $default + * @return string|array|null + */ + public function server( $key = null, $default = null ) { + return $this->retrieve_item( 'server', $key, $default ); + } + + /** + * Determine if a header is set on the request. + * + * @param string $key + * @return bool + */ + public function has_header( $key ) { + return ! is_null( $this->header( $key ) ); + } + + /** + * Retrieve a header from the request. + * + * @param string|null $key + * @param string|array|null $default + */ + public function header( $key = null, $default = null ): string|array|null { + return $this->retrieve_item( 'headers', $key, $default ); + } + + /** + * Get the bearer token from the request headers. + */ + public function bearer_token(): ?string { + $header = $this->header( 'Authorization', '' ); + + if ( is_array( $header ) ) { + $header = Arr::first( $header ); + } + + if ( Str::starts_with( $header, 'Bearer ' ) ) { + return Str::substr( $header, 7 ); + } + + return $header; + } + + /** + * Determine if the request contains a given input item key. + * + * @param string|array $key + */ + public function exists( $key ): bool { + return $this->has( $key ); + } + + /** + * Determine if the request contains a given input item key. + * + * @param string|array $key + */ + public function has( $key ): bool { + $keys = is_array( $key ) ? $key : func_get_args(); + + $input = $this->all(); + + foreach ( $keys as $key ) { + if ( ! Arr::has( $input, $key ) ) { + return false; + } + } + + return true; + } + + /** + * Determine if the request contains any of the given inputs. + * + * @param string|array $keys + * @return bool + */ + public function has_any( $keys ) { + $keys = is_array( $keys ) ? $keys : func_get_args(); + + $input = $this->all(); + + return Arr::has_any( $input, $keys ); + } + + /** + * Determine if the request contains a non-empty value for an input item. + * + * @param string|array $key + */ + public function filled( $key ): bool { + $keys = is_array( $key ) ? $key : func_get_args(); + + foreach ( $keys as $key ) { + if ( $this->is_empty_string( $key ) ) { + return false; + } + } + + return true; + } + + /** + * Determine if the request contains a non-empty value for any of the given inputs. + * + * @param string|array $keys + */ + public function any_filled( $keys ): bool { + $keys = is_array( $keys ) ? $keys : func_get_args(); + + foreach ( $keys as $key ) { + if ( $this->filled( $key ) ) { + return true; + } + } + + return false; + } + + /** + * Determine if the request is missing a given input item key. + * + * @param string|array $key + * @return bool + */ + public function missing( $key ) { + $keys = is_array( $key ) ? $key : func_get_args(); + + return ! $this->has( $keys ); + } + + /** + * Determine if the given input key is an empty string for "has". + * + * @param string $key + */ + protected function is_empty_string( $key ): bool { + $value = $this->input( $key ); + + return ! is_bool( $value ) && ! is_array( $value ) && trim( (string) $value ) === ''; + } + + /** + * Get the keys for all of the input and files. + * + * @return array + */ + public function keys() { + return array_merge( array_keys( $this->input() ), $this->files->keys() ); + } + + /** + * Get all of the input and files for the request. + * + * @param array|mixed|null $keys + * @return array + */ + public function all( $keys = null ) { + $input = $this->input(); + + if ( ! $keys ) { + return $input; + } + + $results = []; + + foreach ( is_array( $keys ) ? $keys : func_get_args() as $key ) { + Arr::set( $results, $key, Arr::get( $input, $key ) ); + } + + return $results; + } + + /** + * Retrieve an input item from the request. + * + * @param string|null $key + * @param mixed $default + * @return mixed + */ + public function input( $key = null, $default = null ) { + return data_get( + $this->get_input_source()->all() + $this->query->all(), + $key, + $default + ); + } + + /** + * Retrieve input as a boolean value. + * + * Returns true when value is "1", "true", "on", and "yes". Otherwise, returns false. + * + * @param string|null $key + * @param bool $default + * @return bool + */ + public function boolean( $key = null, $default = false ) { + return filter_var( $this->input( $key, $default ), FILTER_VALIDATE_BOOLEAN ); + } + + /** + * Get a subset containing the provided keys with values from the input data. + * + * @param array|mixed $keys + * @return array + */ + public function only( $keys ) { + $results = []; + + $input = $this->all(); + + $placeholder = new stdClass(); + + foreach ( is_array( $keys ) ? $keys : func_get_args() as $key ) { + $value = data_get( $input, $key, $placeholder ); + + if ( $value !== $placeholder ) { + Arr::set( $results, $key, $value ); + } + } + + return $results; + } + + /** + * Get all of the input except for a specified array of items. + * + * @param array|mixed $keys + * @return array + */ + public function except( $keys ) { + $keys = is_array( $keys ) ? $keys : func_get_args(); + + $results = $this->all(); + + Arr::forget( $results, $keys ); + + return $results; + } + + /** + * Retrieve a query string item from the request. + * + * @param string|null $key + * @param string|array|null $default + * @return string|array|null + */ + public function query( $key = null, $default = null ) { + return $this->retrieve_item( 'query', $key, $default ); + } + + /** + * Retrieve a request payload item from the request. + * + * @param string|null $key + * @param string|array|null $default + * @return string|array|null + */ + public function post( $key = null, $default = null ) { + return $this->retrieve_item( 'request', $key, $default ); + } + + /** + * Determine if a cookie is set on the request. + * + * @param string $key + * @return bool + */ + public function has_cookie( $key ) { + return ! is_null( $this->cookie( $key ) ); + } + + /** + * Retrieve a cookie from the request. + * + * @param string|null $key + * @param string|array|null $default + * @return string|array|null + */ + public function cookie( $key = null, $default = null ) { + return $this->retrieve_item( 'cookies', $key, $default ); + } + + /** + * Retrieve a parameter item from a given source. + * + * @param string $source + * @param string $key + * @param string|array|null $default + * @return string|array|null + */ + protected function retrieve_item( $source, $key, $default ) { + if ( empty( $key ) ) { + return $this->$source->all(); + } + + return $this->$source->get( $key, $default ); + } + + /** + * Get an array of all of the files on the request. + * + * @return array + */ + public function all_files() { + $files = $this->files->all(); + + if ( ! isset( $this->converted_files ) ) { + $this->converted_files = $this->convert_uploaded_files( $files ); + } + + return $this->converted_files; + } + + /** + * Convert the given array of Symfony Uploaded_Files to custom Mantle Uploaded_Files. + * + * @param array $files + * @return array + */ + protected function convert_uploaded_files( array $files ) { + return array_map( + function ( $file ) { + if ( is_null( $file ) || ( is_array( $file ) && empty( array_filter( $file ) ) ) ) { + return $file; + } + + return is_array( $file ) + ? $this->convert_uploaded_files( $file ) + : Uploaded_File::createFromBase( $file ); + }, + $files + ); + } + + /** + * Determine if the uploaded data contains a file. + * + * @param string $key + */ + public function has_file( $key ): bool { + $files = $this->file( $key ); + if ( ! is_array( $files ) ) { + $files = [ $files ]; + } + + foreach ( $files as $file ) { + if ( $this->is_valid_file( $file ) ) { + return true; + } + } + + return false; + } + + /** + * Check that the given file is a valid file instance. + * + * @param mixed $file + */ + protected function is_valid_file( $file ): bool { + return $file instanceof Uploaded_File && $file->getPath() !== ''; + } + + /** + * Retrieve a file from the request. + * + * @param string|null $key + * @param mixed $default + * @return \Mantle\Http\Uploaded_File|\Mantle\Http\Uploaded_File[]|null + */ + public function file( $key = null, $default = null ) { + return data_get( $this->all_files(), $key, $default ); + } +} diff --git a/vendor/mantle-framework/http/view/class-factory.php b/vendor/mantle-framework/http/view/class-factory.php new file mode 100644 index 00000000..ca4ff547 --- /dev/null +++ b/vendor/mantle-framework/http/view/class-factory.php @@ -0,0 +1,350 @@ +<?php +/** + * Factory class file. + * + * @package Mantle + */ + +namespace Mantle\Http\View; + +use Illuminate\View\Concerns\ManagesLayouts; +use Illuminate\View\Concerns\ManagesLoops; +use Illuminate\View\Concerns\ManagesStacks; +use InvalidArgumentException; +use Mantle\Contracts\Container; +use Mantle\Contracts\Http\View\Factory as ViewFactory; +use Mantle\Contracts\View\Engine; +use Mantle\Support\Arr; +use Mantle\Support\Collection; +use Mantle\Support\Str; +use Mantle\View\Engines\Engine_Resolver; +use WP_Query; + +/** + * View Factory + */ +class Factory implements ViewFactory { + use ManagesLayouts, + ManagesLoops, + ManagesStacks; + + /** + * The IoC container instance. + * + * @var Container + */ + protected $container; + + /** + * The view engine resolver. + * + * @var Engine_Resolver + */ + protected $engines; + + /** + * The view finder. + * + * @var View_Finder + */ + protected $finder; + + /** + * Data that should be available to all templates. + * + * @var array + */ + protected $shared = []; + + /** + * Stack of views being rendered. + * + * @var array + */ + protected $stack; + + /** + * Current view being rendered. + * + * @var View|null + */ + protected $current; + + /** + * The extension to engine bindings. + * + * @var string[] + */ + protected $extensions = [ + 'blade.php' => 'blade', + 'php' => 'php', + 'css' => 'file', + 'html' => 'file', + ]; + + /** + * Constructor. + * + * @param Container $container Container to set. + * @param Engine_Resolver $engines Engine Resolver. + * @param View_Finder $finder View Finder. + */ + public function __construct( Container $container, Engine_Resolver $engines, View_Finder $finder ) { + $this->engines = $engines; + $this->finder = $finder; + + $this->set_container( $container ); + $this->share( '__env', $this ); + } + + /** + * Set the container to use. + * + * @param Container $container Container instance. + */ + public function set_container( Container $container ) { + $this->container = $container; + return $this; + } + + /** + * Get the container to use. + */ + public function get_container(): Container { + return $this->container; + } + + /** + * Get the current view. + */ + public function get_current(): ?View { + return $this->current; + } + + /** + * Add a piece of shared data to the environment. + * + * @param array|string $key Key to share. + * @param mixed|null $value Value to share. + * @return mixed + */ + public function share( $key, $value = null ) { + $keys = is_array( $key ) ? $key : [ $key => $value ]; + + foreach ( $keys as $key => $value ) { + $this->shared[ $key ] = $value; + } + + return $value; + } + + /** + * Get an item from the shared data. + * + * @param string $key Key to get item by. + * @param mixed $default Default value. + * @return mixed + */ + public function shared( $key, $default = null ) { + return Arr::get( $this->shared, $key, $default ); + } + + /** + * Get all of the shared data for the environment. + */ + public function get_shared(): array { + return $this->shared; + } + + /** + * Push a view onto the stack and set it as the current view. + * + * @param View $view View being loaded. + * @return static + */ + public function push( View $view ) { + $this->stack[] = $view; + $this->current = $view; + + return $this; + } + + /** + * Pop a partial off the top of the stack and set the current partial to the + * next one down. + * + * @return static + */ + public function pop() { + array_pop( $this->stack ); + + $this->current = end( $this->stack ); + + if ( ! $this->current ) { + $this->current = null; + } + + return $this; + } + + /** + * Get a variable from the current view. + * + * @param string $key Variable to get. + * @param mixed $default Default value if unset. + * @return mixed + */ + public function get_var( string $key, $default = null ) { + if ( empty( $this->current ) ) { + return $default; + } + + return $this->current->get_variable( $key, $default ); + } + + /** + * Get the rendered contents of a view. + * + * @param string $slug View slug. + * @param array|string $name View name, optional. Supports passing variables in if + * $variables is not used. + * @param array $variables Variables for the view, optional. + */ + public function make( string $slug, $name = null, array $variables = [] ): View { + if ( is_array( $name ) ) { + $variables = array_merge( $name, $variables ); + $name = null; + } + + $variables = array_merge( $this->get_shared(), $variables ); + $path = $this->resolve_view_path( $slug, $name ); + $engine = $this->get_engine_from_path( $path ); + + return new View( $this, $engine, $path, $variables ); + } + + /** + * Resolve the view path for a given template slug and name. + * + * @param string $slug Template slug. + * @param string $name Template name. + * @return string|null File path, null otherwise. + */ + protected function resolve_view_path( string $slug, string $name = null ): ?string { + // Prepend the current view if the requested slug is a child template. + if ( Str::starts_with( $slug, '_' ) && $this->current ) { + return $this->resolve_child_view_path_from_parent( $slug ); + } + + return $this->finder->find( $slug, $name ); + } + + /** + * Resolve a child view path from the current parent. + * + * @param string $slug Slug of the view to load. + * @return string + * @throws InvalidArgumentException Thrown if child view not found. + */ + protected function resolve_child_view_path_from_parent( string $slug ) { + $path = Str::before( $this->current->get_path(), '.' ) . '-' . Str::substr( $slug, 1 ); + + foreach ( $this->finder->get_possible_view_files( $path ) as $file ) { + if ( file_exists( $file ) ) { + return $file; + } + } + + throw new InvalidArgumentException( "Child view not found: [{$path}]" ); + } + + /** + * Create a collection of views that loop over a collection of WordPress objects. + * + * While iterating over the data, the proper post data is setup for each item. + * + * @param array|\ArrayAccess $data Array of WordPress data to loop over. + * @param string $slug View slug. + * @param array|string $name View name, optional. Supports passing variables in if + * $variables is not used. + * @param array $variables Variables for the view, optional. + */ + public function loop( $data, string $slug, $name = null, array $variables = [] ): Collection { + $results = new Collection(); + + // Extract the posts from the query. + if ( $data instanceof WP_Query ) { + $data = $data->posts; + } + + // Loop through an array of posts. + foreach ( $data as $i => $item ) { + // Append the current index as a dynamic variable. + $variables['index'] = $i; + + $results[] = $this->make( $slug, $name, $variables )->set_post( $item ); + } + + return $results; + } + + /** + * Iterate over an array, loading a given template part for each item in the + * array. + * + * @param array|\ArrayAccess $data Array of data to iterate over over. + * @param string $slug View slug. + * @param array|string $name View name, optional. Supports passing variables in if + * $variables is not used. + * @param array $variables Variables for the view, optional. + */ + public function iterate( $data, string $slug, $name = null, array $variables = [] ): Collection { + if ( is_array( $name ) ) { + $variables = array_merge( $name, $variables ); + $name = null; + } + + $results = new Collection(); + + foreach ( $data as $index => $item ) { + $variables['item'] = $item; + $variables['index'] = $index; + + $results[] = $this->make( $slug, $name, $variables ); + } + + return $results; + } + + /** + * Resolve the engine for a given path. + * + * @param string $path Path to resolve. + * @return Engine|\Illuminate\View\Engines\CompilerEngine + * + * @throws InvalidArgumentException Thrown on unknown extension from file. + */ + public function get_engine_from_path( string $path ) { + $extension = $this->get_extension( $path ); + if ( ! $extension ) { + throw new InvalidArgumentException( "Unknown extension in file: {$path}" ); + } + + return $this->engines->resolve( $this->extensions[ $extension ] ); + + } + + /** + * Get the extension used by the view file. + * + * @param string $path Path to check against. + */ + protected function get_extension( string $path ): ?string { + $extensions = array_keys( $this->extensions ); + + return Arr::first( + $extensions, + fn ( $value) => Str::ends_with( $path, '.' . $value ) + ); + } +} diff --git a/vendor/mantle-framework/http/view/class-view-finder.php b/vendor/mantle-framework/http/view/class-view-finder.php new file mode 100644 index 00000000..c552df97 --- /dev/null +++ b/vendor/mantle-framework/http/view/class-view-finder.php @@ -0,0 +1,251 @@ +<?php +/** + * View_Finder class file. + * + * @package Mantle + * + * @phpcs:disable WordPress.WP.DiscouragedConstants + */ + +namespace Mantle\Http\View; + +use InvalidArgumentException; +use Mantle\Support\Str; + +use function Mantle\Support\Helpers\event; + +/** + * View Finder + * + * Handles the flexible location of templates. + */ +class View_Finder { + /** + * Base path for the application. + * + * @var string + */ + protected $base_path; + + /** + * Paths to check against when loading a template. + * + * @var string[] + */ + protected $paths = []; + + /** + * Register a view extension with the finder. + * + * @var string[] + */ + protected $extensions = [ + 'blade.php', + 'php', + 'css', + 'html', + ]; + + /** + * Constructor. + * + * @param string $base_path Base path. + */ + public function __construct( string $base_path ) { + $this->base_path = $base_path; + + $this->set_default_paths(); + + \add_action( 'after_setup_theme', [ $this, 'set_default_paths' ] ); + \add_action( 'switch_theme', [ $this, 'set_default_paths' ] ); + } + + /** + * Register an extension with the view finder. + * + * @param string $extension Extension to add. + * @return static + */ + public function add_extension( $extension ) { + $index = array_search( $extension, $this->extensions ); + if ( false !== $index ) { + unset( $this->extensions[ $index ] ); + } + + array_unshift( $this->extensions, $extension ); + + return $this; + } + + /** + * Get registered extensions. + * + * @return string[] + */ + public function get_extensions(): array { + return $this->extensions; + } + + /** + * Set the default paths to load from for WordPress sites. + */ + public function set_default_paths(): void { + if ( function_exists( 'get_stylesheet_directory' ) ) { + $this->add_path( get_stylesheet_directory(), 'stylesheet-path' ); + $this->add_path( get_template_directory(), 'template-path' ); + } + + if ( defined( 'ABSPATH' ) && defined( 'WPINC' ) ) { + $this->add_path( ABSPATH . WPINC . '/theme-compat', 'theme-compat' ); + } + + // Allow mantle-site to load views. + $this->add_path( $this->base_path . '/views', 'mantle-site' ); + + /** + * Dispatched when the view finder is setting its default paths. + * + * @param View_Finder $view_finder View finder instance. + */ + event( 'mantle_view_finder_paths', $this ); + } + + /** + * Add a path to check against when loading a template. + * + * @param string $path Path to add. + * @param string $alias Alias to set it as, defaults to none. + * @return static + * + * @throws InvalidArgumentException Thrown on invalid alias. + */ + public function add_path( string $path, string $alias = null ) { + if ( $alias && Str::contains( $alias, [ '/', '\\', '@' ] ) ) { + throw new InvalidArgumentException( 'Alias cannot contain invalid characters.' ); + } + + $path = Str::untrailing_slash( $path ); + + if ( $alias ) { + $this->paths[ $alias ] = $path; + } elseif ( ! in_array( $path, $this->paths, true ) ) { + $this->paths[] = $path; + } + + return $this; + } + + /** + * Remove a path to check against when loading a template. + * + * @param string $path Path to remove. + * @return static + */ + public function remove_path( string $path ) { + $index = array_search( $path, $this->paths, true ); + if ( false !== $index ) { + unset( $this->paths[ $index ] ); + } + + return $this; + } + + /** + * Get the registered paths. + */ + public function get_paths(): array { + return array_unique( $this->paths ); + } + + /** + * Remove all paths to check against. + * + * @return static + */ + public function clear_paths() { + $this->paths = []; + return $this; + } + + /** + * Load a template by template name. + * + * Acts as a replacement to `get_template_part()` to allow sites to load templates + * outside of a theme. + * + * @param string $slug Template slug. + * @param string $name Template name. + * @return string The template filename if one is located. + */ + public function find( string $slug, string $name = null ): string { + $alias = null; + + // Extract the alias if passed. + if ( str_starts_with( $slug, '@' ) ) { + $alias = substr( Str::before( $slug, '/' ), 1 ); + $slug = Str::after( $slug, '/' ); + } + + $templates = []; + + if ( $name ) { + $templates[] = "{$slug}-{$name}"; + } + + $templates[] = $slug; + + return $this->locate_template( $templates, $alias ); + } + + /** + * Locate the highest priority template file that exists in a set of templates. + * + * Acts as a replacement to `locate_template()`. + * + * @param array $templates Template files to search for. + * @param string $alias Alias to load, optional. + * @return string The template filename if one is located. + * + * @throws InvalidArgumentException Thrown on unknown view to locate. + */ + public function locate_template( array $templates, string $alias = null ): string { + $paths = $this->get_paths(); + + if ( $alias ) { + $paths = array_filter( + $paths, + fn ( $path_alias) => $alias === $path_alias, + ARRAY_FILTER_USE_KEY + ); + } + + foreach ( $templates as $template ) { + $possible_view_files = $this->get_possible_view_files( $template ); + + foreach ( $possible_view_files as $possible_view_file ) { + foreach ( $this->get_paths() as $path ) { + $path = "{$path}/{$possible_view_file}"; + + if ( file_exists( $path ) ) { + return $path; + } + } + } + } + + throw new InvalidArgumentException( "View [{$templates[0]}] not found." ); + } + + /** + * Calculate the possible view file paths with supported extensions. + * + * @param string $name File path without extension. + * @return string[] + */ + public function get_possible_view_files( string $name ): array { + return array_map( + fn ( $extension) => "{$name}.{$extension}", + $this->extensions + ); + } +} diff --git a/vendor/mantle-framework/http/view/class-view.php b/vendor/mantle-framework/http/view/class-view.php new file mode 100644 index 00000000..cfbafa87 --- /dev/null +++ b/vendor/mantle-framework/http/view/class-view.php @@ -0,0 +1,254 @@ +<?php +/** + * View class file. + * + * @package Mantle + * + * @phpcs:disable WordPress.WP.GlobalVariablesOverride.Prohibited + */ + +namespace Mantle\Http\View; + +use Illuminate\View\Engines\CompilerEngine; +use Mantle\Contracts\Http\View\Factory as Factory_Contract; +use Mantle\Contracts\View\Engine; +use Mantle\Database\Model\Post; +use Mantle\Support\Arr; + +/** + * View Class + */ +class View implements \Stringable { + /** + * Post object to set for the post. + * + * @var Post|\WP_Post|int|null + */ + protected $post; + + /** + * The original post to restore after rendering the view. + * + * @var \WP_Post + */ + protected $original_post; + + /** + * Cache key to use. + * + * @var string + */ + protected $cache_key; + + /** + * Cache TTL for the view. + * + * @var int|null + */ + protected $cache_ttl; + + /** + * Constructor. + * + * @param Factory_Contract $factory View Factory. + * @param Engine|\Illuminate\View\Engines\CompilerEngine $engine View Engine. + * @param string $path View path. + * @param array $data Variables for the view, optional. + */ + public function __construct( + protected Factory_Contract $factory, + protected Engine|CompilerEngine $engine, + protected string $path, + protected array $data = [], + ) { + } + + /** + * Get the view path. + */ + public function get_path(): string { + return $this->path; + } + + /** + * Set the post for the view. + * + * Allows the global WordPress post object to be adjusted when rendering the view. + * + * @param Post|\WP_Post|int $post Post object. + * @return static + */ + public function set_post( $post ) { + $this->post = $post; + return $this; + } + + /** + * Add a piece of data to the view. + * + * @param string|array $key Key to set. + * @param mixed $value Value to set. + * @return static + */ + public function with( $key, $value = null ) { + if ( is_array( $key ) ) { + $this->data = array_merge( $this->data, $key ); + } else { + Arr::set( $this->data, $key, $value ); + } + + return $this; + } + + /** + * Get the data for the view. + */ + public function get_variables(): array { + return $this->data; + } + + /** + * Get a specific variable for the view. + * + * @param string $key Key to get. + * @param mixed $default Default value, optional. + * @return mixed + */ + public function get_variable( string $key, $default = null ) { + return Arr::get( $this->data, $key, $default ); + } + + /** + * Set the cache TTL for the view. + * + * @param int|bool $cache_ttl Cache TTL or false to disable. Defaults to 15 minutes. + * @param string $cache_key Cache key to use, optional. + * @return static + */ + public function cache( $cache_ttl = 900, string $cache_key = null ) { + if ( false === $cache_ttl ) { + $cache_ttl = -1; + } + + $this->cache_ttl = $cache_ttl; + $this->cache_key = $cache_key; + return $this; + } + + /** + * Retrieve the cache key to use for the view. + */ + public function get_cache_key(): string { + if ( ! empty( $this->cache_key ) ) { + return $this->cache_key; + } + + $filtered_data = array_map( + function( $value, $key ) { + // Internal class references do not serialize well. + if ( '__env' === $key ) { + return 'app'; + } + + if ( is_object( $value ) ) { + return spl_object_hash( $value ); + } + + return $value; + }, + $this->data, + array_keys( $this->data ) + ); + + return 'partial_' . md5( $this->path . serialize( $filtered_data ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize + } + + /** + * Set the global post object for the view. + */ + protected function setup_post_object() { + global $post; + + if ( ! isset( $this->post ) ) { + return; + } + + $this->preserve_post(); + + if ( $this->post instanceof Post ) { + $post = \get_post( $this->post->id() ); + } else { + $post = \get_post( $this->post ); + } + + \setup_postdata( $post ); + } + + /** + * Backup the current global `$post`. + */ + protected function preserve_post() { + $this->original_post = $GLOBALS['post'] ?? null; + } + + /** + * Restore the backup of the global $post. + * + * If our template part changed the global post, we reset it to what it was + * before loading the template part. Note that we're not calling + * `wp_reset_postdata()` because `$post` may not have been the current post + * from the global query. + * + * @access protected + */ + protected function restore_post() { + global $post; + + $post = $this->original_post; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited + \setup_postdata( $post ); + } + + /** + * Get the string contents of the view. + */ + public function render(): string { + // Check the cache for the view. + if ( isset( $this->cache_ttl ) ) { + $cache_key = $this->get_cache_key(); + $contents = \get_transient( $cache_key ); + + if ( false !== $contents ) { + return (string) $contents; + } + } + + // Setup the post object if needed. + if ( isset( $this->post ) ) { + $this->setup_post_object(); + } + + $this->factory->push( $this ); + + // Invoke the engine to render the view. + $contents = $this->engine->get( $this->path, $this->data ); + + $this->factory->pop(); + + if ( isset( $this->post ) ) { + $this->restore_post(); + } + + if ( isset( $this->cache_ttl ) ) { + \set_transient( $cache_key, $contents, $this->cache_ttl ); + } + + return $contents; + } + + /** + * Get the string contents of the view. + */ + public function __toString(): string { + return $this->render(); + } +} diff --git a/vendor/mantle-framework/support/LICENSE b/vendor/mantle-framework/support/LICENSE new file mode 100644 index 00000000..d159169d --- /dev/null +++ b/vendor/mantle-framework/support/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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. + + <signature of Ty Coon>, 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/vendor/mantle-framework/support/attributes/class-action.php b/vendor/mantle-framework/support/attributes/class-action.php new file mode 100644 index 00000000..ead14ada --- /dev/null +++ b/vendor/mantle-framework/support/attributes/class-action.php @@ -0,0 +1,26 @@ +<?php +/** + * Action class file + * + * @package Mantle + */ + +namespace Mantle\Support\Attributes; + +use Attribute; + +/** + * Hook Action Attribute + * + * Used to hook a method to an WordPress hook at a specific priority. + */ +#[Attribute] +class Action { + /** + * Constructor. + * + * @param string $hook_name Hook name. + * @param int $priority Priority, defaults to 10. + */ + public function __construct( public string $hook_name, public int $priority = 10 ) {} +} diff --git a/vendor/mantle-framework/support/attributes/class-filter.php b/vendor/mantle-framework/support/attributes/class-filter.php new file mode 100644 index 00000000..ac19fb9b --- /dev/null +++ b/vendor/mantle-framework/support/attributes/class-filter.php @@ -0,0 +1,26 @@ +<?php +/** + * Filter class file + * + * @package Mantle + */ + +namespace Mantle\Support\Attributes; + +use Attribute; + +/** + * Hook Filter Attribute + * + * Used to hook a method to an WordPress hook at a specific priority. + */ +#[Attribute] +class Filter { + /** + * Constructor. + * + * @param string $hook_name Hook name. + * @param int $priority Priority, defaults to 10. + */ + public function __construct( public string $hook_name, public int $priority = 10 ) {} +} diff --git a/vendor/mantle-framework/support/autoload.php b/vendor/mantle-framework/support/autoload.php new file mode 100644 index 00000000..d5196bbe --- /dev/null +++ b/vendor/mantle-framework/support/autoload.php @@ -0,0 +1,10 @@ +<?php +/** + * Autoloaded File for Mantle Support + * + * @package Mantle + */ + +namespace Mantle\Support; + +require_once __DIR__ . '/helpers/helpers.php'; diff --git a/vendor/mantle-framework/support/class-arr.php b/vendor/mantle-framework/support/class-arr.php new file mode 100644 index 00000000..9ff8588f --- /dev/null +++ b/vendor/mantle-framework/support/class-arr.php @@ -0,0 +1,624 @@ +<?php +/** + * Arr class file. + * + * @package Mantle + * + * phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.VariableRedeclaration + */ + +namespace Mantle\Support; + +use ArrayAccess; +use InvalidArgumentException; +use Mantle\Support\Helpers; + +/** + * Array Helpers + */ +class Arr { + + /** + * Determine whether the given value is array accessible. + * + * @param mixed $value Value to check. + */ + public static function accessible( $value ): bool { + return is_array( $value ) || $value instanceof ArrayAccess; + } + + /** + * Add an element to an array using "dot" notation if it doesn't exist. + * + * @param array $array Array to check. + * @param string $key Key to check. + * @param mixed $value Value to use. + */ + public static function add( array $array, string $key, $value ): array { + if ( is_null( static::get( $array, $key ) ) ) { + static::set( $array, $key, $value ); + } + + return $array; + } + + /** + * Collapse an array of arrays into a single array. + * + * @param iterable $array Array to use. + * @return array + */ + public static function collapse( $array ) { + $results = []; + + foreach ( $array as $values ) { + if ( $values instanceof \Mantle\Support\Collection ) { + $values = $values->all(); + } elseif ( ! is_array( $values ) ) { + continue; + } + + $results[] = $values; + } + + return array_merge( [], ...$results ); + } + + /** + * Cross join the given arrays, returning all possible permutations. + * + * @param iterable ...$arrays Arrays to join. + */ + public static function cross_join( ...$arrays ): array { + $results = [ [] ]; + + foreach ( $arrays as $index => $array ) { + $append = []; + + foreach ( $results as $result ) { + foreach ( $array as $item ) { + $result[ $index ] = $item; + + $append[] = $result; + } + } + + $results = $append; + } + + return $results; + } + + /** + * Divide an array into two arrays. One with keys and the other with values. + * + * @param array $array Array to divide. + */ + public static function divide( $array ): array { + return [ array_keys( $array ), array_values( $array ) ]; + } + + /** + * Flatten a multi-dimensional associative array with dots. + * + * @param iterable $array Array to process. + * @param string $prepend String to prepend, optional. + */ + public static function dot( $array, string $prepend = '' ): array { + $results = []; + + foreach ( $array as $key => $value ) { + if ( is_array( $value ) && ! empty( $value ) ) { + $results = array_merge( $results, static::dot( $value, $prepend . $key . '.' ) ); + } else { + $results[ $prepend . $key ] = $value; + } + } + + return $results; + } + + /** + * Get all of the given array except for a specified array of keys. + * + * @param array $array Array to process. + * @param array|string $keys Keys to filter by. + */ + public static function except( array $array, $keys ): array { + static::forget( $array, $keys ); + + return $array; + } + + /** + * Determine if the given key exists in the provided array. + * + * @param \ArrayAccess|array $array Array to process. + * @param string|int $key Key to check if it exists. + */ + public static function exists( $array, $key ): bool { + if ( $array instanceof ArrayAccess ) { + return $array->offsetExists( $key ); + } + + return array_key_exists( $key, $array ); + } + + /** + * Return the first element in an array passing a given truth test. + * + * @param iterable $array Array to process. + * @param callable|null $callback Callback filter on, optional. + * @param mixed $default Default value. + * @return mixed + */ + public static function first( $array, callable $callback = null, $default = null ) { + if ( is_null( $callback ) ) { + if ( empty( $array ) ) { + return Helpers\value( $default ); + } + + foreach ( $array as $item ) { + return $item; + } + } + + foreach ( $array as $key => $value ) { + if ( $callback( $value, $key ) ) { + return $value; + } + } + + return Helpers\value( $default ); + } + + /** + * Return the last element in an array passing a given truth test. + * + * @param array $array Array to process. + * @param callable|null $callback Callback to filter by, optional. + * @param mixed $default Default value. + * @return mixed + */ + public static function last( $array, callable $callback = null, $default = null ) { + if ( is_null( $callback ) ) { + return empty( $array ) ? Helpers\value( $default ) : end( $array ); + } + + return static::first( array_reverse( $array, true ), $callback, $default ); + } + + /** + * Flatten a multi-dimensional array into a single level. + * + * @param iterable $array Array to process. + * @param int|float $depth Depth to handle. + */ + public static function flatten( iterable $array, int|float $depth = INF ): array { + $result = []; + + foreach ( $array as $item ) { + $item = $item instanceof Collection ? $item->all() : $item; + + if ( ! is_array( $item ) ) { + $result[] = $item; + } else { + $values = 1 === $depth + ? array_values( $item ) + : static::flatten( $item, $depth - 1 ); + + foreach ( $values as $value ) { + $result[] = $value; + } + } + } + + return $result; + } + + /** + * Remove one or many array items from a given array using "dot" notation. + * + * @param array $array Array to handle. + * @param array|string $keys Keys to use. + */ + public static function forget( &$array, $keys ): void { + $original = &$array; + + $keys = (array) $keys; + + if ( count( $keys ) === 0 ) { + return; + } + + foreach ( $keys as $key ) { + // if the exact key exists in the top-level, remove it. + if ( static::exists( $array, $key ) ) { + unset( $array[ $key ] ); + + continue; + } + + $parts = explode( '.', (string) $key ); + + // Clean up before each pass. + $array = &$original; + + while ( count( $parts ) > 1 ) { // phpcs:ignore Squiz.PHP.DisallowSizeFunctionsInLoops.Found + $part = array_shift( $parts ); + + if ( isset( $array[ $part ] ) && is_array( $array[ $part ] ) ) { + $array = &$array[ $part ]; + } else { + continue 2; + } + } + + unset( $array[ array_shift( $parts ) ] ); + } + } + + /** + * Get an item from an array using "dot" notation. + * + * @param \ArrayAccess|array $array Array to process. + * @param string|int|null $key Key to retrieve. + * @param mixed $default Default value. + * @return mixed + */ + public static function get( $array, $key, $default = null ) { + if ( ! static::accessible( $array ) ) { + return Helpers\value( $default ); + } + + if ( is_null( $key ) ) { + return $array; + } + + if ( static::exists( $array, $key ) ) { + return $array[ $key ]; + } + + if ( strpos( $key, '.' ) === false ) { + return $array[ $key ] ?? Helpers\value( $default ); + } + + foreach ( explode( '.', $key ) as $segment ) { + if ( static::accessible( $array ) && static::exists( $array, $segment ) ) { + $array = $array[ $segment ]; + } else { + return Helpers\value( $default ); + } + } + + return $array; + } + + /** + * Check if an item or items exist in an array using "dot" notation. + * + * @param \ArrayAccess|array $array Array to process. + * @param string|array $keys Key to check. + */ + public static function has( $array, $keys ): bool { + $keys = (array) $keys; + + if ( ! $array || [] === $keys ) { + return false; + } + + foreach ( $keys as $key ) { + $sub_key_array = $array; + + if ( static::exists( $array, $key ) ) { + continue; + } + + foreach ( explode( '.', (string) $key ) as $segment ) { + if ( static::accessible( $sub_key_array ) && static::exists( $sub_key_array, $segment ) ) { + $sub_key_array = $sub_key_array[ $segment ]; + } else { + return false; + } + } + } + + return true; + } + + /** + * Determine if any of the keys exist in an array using "dot" notation. + * + * @param \ArrayAccess|array $array Array to process. + * @param string|array $keys Keys to check. + */ + public static function has_any( $array, $keys ): bool { + if ( empty( $keys ) ) { + return false; + } + + $keys = (array) $keys; + + if ( empty( $array ) ) { + return false; + } + + foreach ( $keys as $key ) { + if ( static::has( $array, $key ) ) { + return true; + } + } + + return false; + } + + /** + * Determines if an array is associative. + * + * An array is "associative" if it doesn't have sequential numerical keys beginning with zero. + * + * @param array $array Array to process. + */ + public static function is_assoc( array $array ): bool { + $keys = array_keys( $array ); + + return array_keys( $keys ) !== $keys; + } + + /** + * Get a subset of the items from the given array. + * + * @param array $array Array to process. + * @param array|string $keys Keys to process by. + */ + public static function only( array $array, array|string $keys ): array { + return array_intersect_key( $array, array_flip( (array) $keys ) ); + } + + /** + * Pluck an array of values from an array. + * + * @param iterable $array Array to process. + * @param string|array $value Values to pluck. + * @param string|array|null $key Key to use. + */ + public static function pluck( $array, $value, $key = null ): array { + $results = []; + + [ $value, $key ] = static::explode_pluck_parameters( $value, $key ); + + foreach ( $array as $item ) { + $item_value = Helpers\data_get( $item, $value ); + + // If the key is "null", we will just append the value to the array and keep + // looping. Otherwise we will key the array using the value of the key we + // received from the developer. Then we'll return the final array form. + if ( is_null( $key ) ) { + $results[] = $item_value; + } else { + $item_key = Helpers\data_get( $item, $key ); + + if ( is_object( $item_key ) && method_exists( $item_key, '__toString' ) ) { + $item_key = (string) $item_key; + } + + $results[ $item_key ] = $item_value; + } + } + + return $results; + } + + /** + * Explode the "value" and "key" arguments passed to "pluck". + * + * @param string|array $value Value to pluck. + * @param string|array|null $key Key to use. + * @return array + */ + protected static function explode_pluck_parameters( $value, $key ) { + $value = is_string( $value ) ? explode( '.', $value ) : $value; + + $key = is_null( $key ) || is_array( $key ) ? $key : explode( '.', $key ); + + return [ $value, $key ]; + } + + /** + * Push an item onto the beginning of an array. + * + * @param array $array Array to process. + * @param mixed $value Item value. + * @param mixed $key Item key. + */ + public static function prepend( array $array, $value, $key = null ): array { + if ( is_null( $key ) ) { + array_unshift( $array, $value ); + } else { + $array = [ $key => $value ] + $array; + } + + return $array; + } + + /** + * Get a value from the array, and remove it. + * + * @param array $array Array to process. + * @param string $key Key to pull by. + * @param mixed $default Default value. + * @return mixed + */ + public static function pull( array &$array, $key, $default = null ) { + $value = static::get( $array, $key, $default ); + + static::forget( $array, $key ); + + return $value; + } + + /** + * Get one or a specified number of random values from an array. + * + * @param array $array Array to process. + * @param int|null $number Number to pull. + * @return mixed + * + * @throws InvalidArgumentException Thrown when the requested number of items is greater + * than the length of the array. + */ + public static function random( array $array, $number = null ) { + $requested = is_null( $number ) ? 1 : $number; + + $count = count( $array ); + + if ( $requested > $count ) { + throw new InvalidArgumentException( + "You requested {$requested} items, but there are only {$count} items available." + ); + } + + if ( is_null( $number ) ) { + return $array[ array_rand( $array ) ]; + } + + if ( 0 === (int) $number ) { + return []; + } + + $keys = array_rand( $array, $number ); + + $results = []; + + foreach ( (array) $keys as $key ) { + $results[] = $array[ $key ]; + } + + return $results; + } + + /** + * Set an array item to a given value using "dot" notation. + * + * If no key is given to the method, the entire array will be replaced. + * + * @param array $array Array to process. + * @param string|null $key Key to set. + * @param mixed $value Value to set. + */ + public static function set( array &$array, $key, $value ): array { + if ( is_null( $key ) ) { + $array = $value; + return $array; + } + + $keys = explode( '.', $key ); + + foreach ( $keys as $i => $key ) { + if ( count( $keys ) === 1 ) { + break; + } + + unset( $keys[ $i ] ); + + // If the key doesn't exist at this depth, we will just create an empty array + // to hold the next value, allowing us to create the arrays to hold final + // values at the correct depth. Then we'll keep digging into the array. + if ( ! isset( $array[ $key ] ) || ! is_array( $array[ $key ] ) ) { + $array[ $key ] = []; + } + + $array = &$array[ $key ]; + } + + $array[ array_shift( $keys ) ] = $value; + + return $array; + } + + /** + * Shuffle the given array and return the result. + * + * @param array $array Array to process. + * @param int $seed Seed to use. + * @return array + */ + public static function shuffle( $array, ?int $seed = null ) { + if ( is_null( $seed ) ) { + shuffle( $array ); + } else { + mt_srand( $seed ); // phpcs:ignore WordPress.WP.AlternativeFunctions.rand_seeding_mt_srand + shuffle( $array ); + mt_srand(); // phpcs:ignore WordPress.WP.AlternativeFunctions.rand_seeding_mt_srand + } + + return $array; + } + + /** + * Sort the array using the given callback or "dot" notation. + * + * @param array $array Array to sort. + * @param callable|string|null $callback Callback to sort by. + * @return array + */ + public static function sort( $array, $callback = null ) { + return Collection::make( $array )->sort_by( $callback )->all(); + } + + /** + * Recursively sort an array by keys and values. + * + * @param array $array Array to process. + * @return array + */ + public static function sort_recursive( $array ) { + foreach ( $array as &$value ) { + if ( is_array( $value ) ) { + $value = static::sort_recursive( $value ); + } + } + + if ( static::is_assoc( $array ) ) { + ksort( $array ); + } else { + sort( $array ); + } + + return $array; + } + + /** + * Convert the array into a query string. + * + * @param array $array Array to process. + * @return string + */ + public static function query( $array ) { + return http_build_query( $array, '', '&', PHP_QUERY_RFC3986 ); + } + + /** + * Filter the array using the given callback. + * + * @param array $array Array to process. + * @param callable $callback Callback to filter by. + * @return array + */ + public static function where( $array, callable $callback ) { + return array_filter( $array, $callback, ARRAY_FILTER_USE_BOTH ); + } + + /** + * If the given value is not an array and not null, wrap it in one. + * + * @param mixed $value Value to wrap by. + */ + public static function wrap( $value ): array { + if ( is_null( $value ) ) { + return []; + } + + return is_array( $value ) ? $value : [ $value ]; + } +} diff --git a/vendor/mantle-framework/support/class-collection.php b/vendor/mantle-framework/support/class-collection.php new file mode 100644 index 00000000..0483c7a4 --- /dev/null +++ b/vendor/mantle-framework/support/class-collection.php @@ -0,0 +1,1446 @@ +<?php +/** + * Collections class file. + * + * @package Mantle + */ + +// phpcs:disable Squiz.Commenting.FunctionComment.MissingParamComment + +// phpcs:disable Squiz.Commenting.FunctionComment.MissingParamTag + +namespace Mantle\Support; + +use ArrayAccess; +use ArrayIterator; +use Mantle\Contracts\Support\Arrayable; +use Mantle\Support\Traits\Enumerates_Values; +use Mantle\Database\Model; + +use function Mantle\Support\Helpers\data_get; +use function Mantle\Support\Helpers\value; +use stdClass; +use Traversable; + +/** + * Collection + * + * @template TKey of array-key + * @template TValue + * + * @implements \ArrayAccess<TKey, TValue> + * @implements \Mantle\Support\Enumerable<TKey, TValue> + */ +class Collection implements ArrayAccess, Enumerable { + /** + * The enumerated values trait. + * + * @use Enumerates_Values<TKey, TValue> + */ + use Enumerates_Values; + + /** + * The items contained in the collection. + * + * @var array<TKey, TValue> + */ + protected $items = []; + + /** + * Create a new collection. + * + * @param iterable<TKey, TValue> $items + * @return void + */ + public function __construct( $items = [] ) { + $this->items = $this->get_arrayable_items( $items ); + } + + /** + * Create a new collection from some known WordPress object. + * + * Falls back to the normal constructor if $value is unrecognized. + * + * @template TKeyFrom of array-key + * @template TValueFrom + * + * @param iterable<TKeyFrom, TValueFrom>|\WP_Query $value + * @return static<TKeyFrom, TValueFrom> + */ + public static function from( $value ) { + global $post; + if ( $value instanceof \WP_Query ) { + $items = []; + while ( $value->have_posts() ) { + $value->the_post(); + $items[] = Model\Post::find( $post ); + } + return new static( $items ); + } + + return new static( $value ); + } + + /** + * Create a new collection by invoking the callback a given amount of times. + * + * @template TTimesValue + * + * @param int $number + * @param (callable(int): TTimesValue)|null $callback + * @return static<int, TTimesValue> + */ + public static function times( $number, callable $callback = null ) { + if ( $number < 1 ) { + return new static(); + } + + if ( is_null( $callback ) ) { + return new static( range( 1, $number ) ); + } + + return ( new static( range( 1, $number ) ) )->map( $callback ); + } + + /** + * Get all of the items in the collection. + * + * @return array<TKey, TValue> + */ + public function all() { + return $this->items; + } + + /** + * Get the average value of a given key. + * + * @param (callable(TValue): float|int)|string|null $callback + * @return float|int|null + */ + public function avg( $callback = null ) { + $callback = $this->value_retriever( $callback ); + + $items = $this->map( + fn ( $value ) => $callback( $value ), + )->filter( + fn ( $value ) => ! is_null( $value ), + ); + + $count = $items->count(); + + if ( $count ) { + return $items->sum() / $count; + } + + return null; + } + + /** + * Get the median of a given key. + * + * @param string|array<array-key, string>|null $key + * @return float|int|null + */ + public function median( $key = null ) { + $values = ( isset( $key ) ? $this->pluck( $key ) : $this ) + ->filter( + fn ( $item) => ! is_null( $item ) + )->sort()->values(); + + + $count = $values->count(); + + if ( 0 === $count ) { + return null; + } + + $middle = (int) ( $count / 2 ); + + if ( $count % 2 ) { + return $values->get( $middle ); + } + + return ( new static( + [ + $values->get( $middle - 1 ), + $values->get( $middle ), + ] + ) )->average(); + } + + /** + * Get the mode of a given key. + * + * @param string|array<array-key, string>|null $key + * @return array<int, float|int>|null + */ + public function mode( $key = null ) { + if ( $this->count() === 0 ) { + return null; + } + + $collection = isset( $key ) ? $this->pluck( $key ) : $this; + + $counts = new self(); + + $collection->each( + function ( $value ) use ( $counts ): void { + $counts[ $value ] = isset( $counts[ $value ] ) ? $counts[ $value ] + 1 : 1; + } + ); + + $sorted = $counts->sort(); + + $highest_value = $sorted->last(); + + return $sorted->filter( + fn ( $value) => $value == $highest_value + )->sort()->keys()->all(); + } + + /** + * Collapse the collection of items into a single array. + * + * @return static<int, mixed> + */ + public function collapse() { + return new static( Arr::collapse( $this->items ) ); + } + + /** + * Determine if an item exists in the collection. + * + * @param (callable(TValue, TKey): bool)|TValue|string $key + * @param mixed $operator + * @param mixed $value + * @return bool + */ + public function contains( $key, $operator = null, $value = null ) { + if ( func_num_args() === 1 ) { + if ( $this->use_as_callable( $key ) ) { + $placeholder = new stdClass(); + + return $this->first( $key, $placeholder ) !== $placeholder; + } + + return in_array( $key, $this->items ); + } + + return $this->contains( $this->operator_for_where( ...func_get_args() ) ); + } + + /** + * Determine if an item exists, using strict comparison. + * + * @param (callable(TValue): bool)|TValue|array-key $key + * @param TValue|null $value + * @return bool + */ + public function contains_strict( $key, $value = null ) { + if ( func_num_args() === 2 ) { + return $this->contains( fn ( $item) => data_get( $item, $key ) === $value ); + } + + if ( $this->use_as_callable( $key ) ) { + return ! is_null( $this->first( $key ) ); + } + + return in_array( $key, $this->items, true ); + } + + /** + * Determine if an item is not contained in the collection. + * + * @param mixed $key + * @param mixed $operator + * @param mixed $value + * @return bool + */ + public function doesnt_contain( $key, $operator = null, $value = null ) { + return ! $this->contains( ...func_get_args() ); + } + + /** + * Cross join with the given lists, returning all possible permutations. + * + * @template TCrossJoinKey of array-key + * @template TCrossJoinValue + * + * @param \Mantle\Contracts\Support\Arrayable<TCrossJoinKey, TCrossJoinValue>|iterable<TCrossJoinKey, TCrossJoinValue> ...$lists + * @return static<int, array<int, TValue|TCrossJoinValue>> + */ + public function cross_join( ...$lists ) { + return new static( + Arr::cross_join( + $this->items, + ...array_map( [ $this, 'get_arrayable_items' ], $lists ) + ) + ); + } + + /** + * Get the items in the collection that are not present in the given items. + * + * @param \Mantle\Contracts\Support\Arrayable<array-key, TValue>|iterable<array-key, TValue> $items + * @return static + */ + public function diff( $items ) { + return new static( array_diff( $this->items, $this->get_arrayable_items( $items ) ) ); + } + + /** + * Get the items in the collection that are not present in the given items, using the callback. + * + * @param \Mantle\Contracts\Support\Arrayable<array-key, TValue>|iterable<array-key, TValue> $items + * @param callable(TValue, TValue): int $callback + * @return static + */ + public function diff_using( $items, callable $callback ) { + return new static( array_udiff( $this->items, $this->get_arrayable_items( $items ), $callback ) ); + } + + /** + * Get the items in the collection whose keys and values are not present in the given items. + * + * @param \Mantle\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items + * @return static + */ + public function diff_assoc( $items ) { + return new static( array_diff_assoc( $this->items, $this->get_arrayable_items( $items ) ) ); + } + + /** + * Get the items in the collection whose keys and values are not present in the given items, using the callback. + * + * @param \Mantle\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items + * @param callable(TKey, TKey): int $callback + * @return static + */ + public function diff_assoc_using( $items, callable $callback ) { + return new static( array_diff_uassoc( $this->items, $this->get_arrayable_items( $items ), $callback ) ); + } + + /** + * Get the items in the collection whose keys are not present in the given items. + * + * @param \Mantle\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items + * @return static + */ + public function diff_keys( $items ) { + return new static( array_diff_key( $this->items, $this->get_arrayable_items( $items ) ) ); + } + + /** + * Get the items in the collection whose keys are not present in the given items, using the callback. + * + * @param \Mantle\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items + * @param callable(TKey, TKey): int $callback + * @return static + */ + public function diff_keys_using( $items, callable $callback ) { + return new static( array_diff_ukey( $this->items, $this->get_arrayable_items( $items ), $callback ) ); + } + + /** + * Retrieve duplicate items from the collection. + * + * @param (callable(TValue): bool)|string|null $callback + * @param bool $strict + * @return static + */ + public function duplicates( $callback = null, $strict = false ) { + $items = $this->map( $this->value_retriever( $callback ) ); + + $unique_items = $items->unique( null, $strict ); + + $compare = $this->duplicate_comparator( $strict ); + + $duplicates = new static(); + + foreach ( $items as $key => $value ) { + if ( $unique_items->is_not_empty() && $compare( $value, $unique_items->first() ) ) { + $unique_items->shift(); + } else { + $duplicates[ $key ] = $value; + } + } + + return $duplicates; + } + + /** + * Retrieve duplicate items from the collection using strict comparison. + * + * @param (callable(TValue): bool)|string|null $callback + * @return static + */ + public function duplicates_strict( $callback = null ) { + return $this->duplicates( $callback, true ); + } + + /** + * Get the comparison function to detect duplicates. + * + * @param bool $strict + * @return callable(TValue, TValue): bool + */ + protected function duplicate_comparator( $strict ) { + if ( $strict ) { + return fn ( $a, $b) => $a === $b; + } + + return fn ( $a, $b) => $a == $b; + } + + /** + * Get all items except for those with the specified keys. + * + * @param \Mantle\Support\Enumerable<array-key, TKey>|array<array-key, TKey>|string $keys + * @return static + */ + public function except( $keys ) { + if ( $keys instanceof Enumerable ) { + $keys = $keys->all(); + } elseif ( ! is_array( $keys ) ) { + $keys = func_get_args(); + } + + return new static( Arr::except( $this->items, $keys ) ); + } + + /** + * Run a filter over each of the items. + * + * @param (callable(TValue, TKey): bool)|null $callback + * @return static + */ + public function filter( callable $callback = null ) { + if ( $callback ) { + return new static( Arr::where( $this->items, $callback ) ); + } + + return new static( array_filter( $this->items ) ); + } + + /** + * Get the first item from the collection passing the given truth test. + * + * @template TFirstDefault + * + * @param (callable(TValue, TKey): bool)|null $callback + * @param TFirstDefault|(\Closure(): TFirstDefault) $default + * @return TValue|TFirstDefault + */ + public function first( callable $callback = null, $default = null ) { + return Arr::first( $this->items, $callback, $default ); + } + + /** + * Get a flattened array of the items in the collection. + * + * @param int|float $depth + * @return static<int, mixed> + */ + public function flatten( $depth = INF ) { + return new static( Arr::flatten( $this->items, $depth ) ); + } + + /** + * Flip the items in the collection. + * + * @return static<int|string, TKey> + */ + public function flip() { + return new static( array_flip( $this->items ) ); + } + + /** + * Remove an item from the collection by key. + * + * @param TKey|array<array-key, TKey> $keys + * @return $this + */ + public function forget( $keys ) { + foreach ( (array) $keys as $key ) { + $this->offsetUnset( $key ); + } + + return $this; + } + + /** + * Get an item from the collection by key. + * + * @template TGetDefault + * + * @param TKey $key + * @param TGetDefault|(\Closure(): TGetDefault) $default + * @return TValue|TGetDefault + */ + public function get( $key, $default = null ) { + if ( $this->offsetExists( $key ) ) { + return $this->items[ $key ]; + } + + return value( $default ); + } + + /** + * Group an associative array by a field or using a callback. + * + * @param (callable(TValue, TKey): array-key)|array|string $group_by The field or callback to group by. + * @param bool $preserve_keys Whether to preserve the keys of the original array. + * @return static<array-key, static<array-key, TValue>> + */ + public function group_by( $group_by, $preserve_keys = false ) { + if ( ! $this->use_as_callable( $group_by ) && is_array( $group_by ) ) { + $next_groups = $group_by; + + $group_by = array_shift( $next_groups ); + } + + $group_by = $this->value_retriever( $group_by ); + + $results = []; + + foreach ( $this->items as $key => $value ) { + $group_keys = $group_by( $value, $key ); + + if ( ! is_array( $group_keys ) ) { + $group_keys = [ $group_keys ]; + } + + foreach ( $group_keys as $group_key ) { + $group_key = is_bool( $group_key ) ? (int) $group_key : $group_key; + + if ( ! array_key_exists( $group_key, $results ) ) { + $results[ $group_key ] = new static(); + } + + $results[ $group_key ]->offsetSet( $preserve_keys ? $key : null, $value ); + } + } + + $result = new static( $results ); + + if ( ! empty( $next_groups ) ) { + return $result->map->groupBy( $next_groups, $preserve_keys ); // @phpstan-ignore-line undefined method + } + + return $result; + } + + /** + * Key an associative array by a field or using a callback. + * + * @param (callable(TValue, TKey): array-key)|array|string $key_by The field or callback to key by. + * @return static<array-key, TValue> + */ + public function key_by( $key_by ) { + $key_by = $this->value_retriever( $key_by ); + + $results = []; + + foreach ( $this->items as $key => $item ) { + $resolved_key = $key_by( $item, $key ); + + if ( is_object( $resolved_key ) ) { + $resolved_key = (string) $resolved_key; + } + + $results[ $resolved_key ] = $item; + } + + return new static( $results ); + } + + /** + * Determine if an item exists in the collection by key. + * + * @param TKey|array<array-key, TKey> $key + */ + public function has( $key ): bool { + $keys = is_array( $key ) ? $key : func_get_args(); + + foreach ( $keys as $key ) { + if ( ! $this->offsetExists( $key ) ) { + return false; + } + } + + return true; + } + + /** + * Concatenate values of a given key as a string. + * + * @param callable|string|null $value + * @param string|null $glue + * @return string + */ + public function implode( $value, $glue = null ) { + if ( $this->use_as_callable( $value ) ) { + return implode( $glue ?? '', $this->map( $value )->all() ); + } + + $first = $this->first(); + + if ( is_array( $first ) || is_object( $first ) ) { + return implode( $glue ?? '', $this->pluck( $value )->all() ); + } + + return implode( $value ?? '', $this->items ); + } + + /** + * Concatenate values of a given key as a string and returns a stringable class. + * + * @param callable|string|null $value + * @param string|null $glue + */ + public function implode_str( $value, $glue = null ): Stringable { + return new Stringable( $this->implode( $value, $glue ) ); + } + + /** + * Intersect the collection with the given items. + * + * @param \Mantle\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items + * @return static + */ + public function intersect( $items ) { + return new static( array_intersect( $this->items, $this->get_arrayable_items( $items ) ) ); + } + + /** + * Intersect the collection with the given items with additional index check. + * + * @param \Mantle\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items + * @return static + */ + public function intersect_assoc( $items ) { + return new static( array_intersect_assoc( $this->items, $this->get_arrayable_items( $items ) ) ); + } + + /** + * Intersect the collection with the given items with additional index check, using the callback. + * + * @param \Mantle\Contracts\Support\Arrayable<array-key, TValue>|iterable<array-key, TValue> $items + * @param callable(TValue, TValue): int $callback + * @return static + */ + public function intersect_assoc_using( $items, callable $callback ) { + return new static( array_intersect_uassoc( $this->items, $this->get_arrayable_items( $items ), $callback ) ); + } + + /** + * Intersect the collection with the given items by key. + * + * @param \Mantle\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items + * @return static + */ + public function intersect_by_keys( $items ) { + return new static( + array_intersect_key( + $this->items, + $this->get_arrayable_items( $items ) + ) + ); + } + + /** + * Determine if the collection is empty or not. + */ + public function is_empty(): bool { + return empty( $this->items ); + } + + /** + * Determine if the collection contains a single item. + */ + public function contains_one_item(): bool { + return $this->count() === 1; + } + + /** + * Join all items from the collection using a string. The final items can use a separate glue string. + * + * @param string $glue + * @param string $final_glue + * @return string + */ + public function join( $glue, $final_glue = '' ) { + if ( '' === $final_glue ) { + return $this->implode( $glue ); + } + + $count = $this->count(); + + if ( 0 === $count ) { + return ''; + } + + if ( 1 === $count ) { + return $this->last(); + } + + $collection = new static( $this->items ); + + $final_item = $collection->pop(); + + return $collection->implode( $glue ) . $final_glue . $final_item; + } + + /** + * Get the keys of the collection items. + * + * @return static<int, TKey> + */ + public function keys() { + return new static( array_keys( $this->items ) ); + } + + /** + * Get the last item from the collection. + * + * @template TLastDefault + * + * @param (callable(TValue, TKey): bool)|null $callback + * @param TLastDefault|(\Closure(): TLastDefault) $default + * @return TValue|TLastDefault + */ + public function last( callable $callback = null, $default = null ) { + return Arr::last( $this->items, $callback, $default ); + } + + /** + * Get the values of a given key. + * + * @param string|int|array<array-key, string> $value + * @param string|null $key + * @return static<array-key, mixed> + */ + public function pluck( $value, $key = null ) { + return new static( Arr::pluck( $this->items, $value, $key ) ); + } + + /** + * Run a map over each of the items. + * + * @template TMapValue + * + * @param callable(TValue, TKey): TMapValue $callback + * @return static<TKey, TMapValue> + */ + public function map( callable $callback ) { + $keys = array_keys( $this->items ); + + $items = array_map( $callback, $this->items, $keys ); + + return new static( array_combine( $keys, $items ) ); + } + + /** + * Run a dictionary map over the items. + * + * The callback should return an associative array with a single key/value pair. + * + * @template TMapToDictionaryKey of array-key + * @template TMapToDictionaryValue + * + * @param callable(TValue, TKey): array<TMapToDictionaryKey, TMapToDictionaryValue> $callback + * @return static<TMapToDictionaryKey, array<int, TMapToDictionaryValue>> + */ + public function map_to_dictionary( callable $callback ) { + $dictionary = []; + + foreach ( $this->items as $key => $item ) { + $pair = $callback( $item, $key ); + + $key = key( $pair ); + + $value = reset( $pair ); + + if ( ! isset( $dictionary[ $key ] ) ) { + $dictionary[ $key ] = []; + } + + $dictionary[ $key ][] = $value; + } + + return new static( $dictionary ); + } + + /** + * Run an associative map over each of the items. + * + * The callback should return an associative array with a single key/value pair. + * + * @template TMapWithKeysKey of array-key + * @template TMapWithKeysValue + * + * @param callable(TValue, TKey): array<TMapWithKeysKey, TMapWithKeysValue> $callback + * @return static<TMapWithKeysKey, TMapWithKeysValue> + */ + public function map_with_keys( callable $callback ) { + $result = []; + + foreach ( $this->items as $key => $value ) { + $assoc = $callback( $value, $key ); + + foreach ( $assoc as $map_key => $map_value ) { + $result[ $map_key ] = $map_value; + } + } + + return new static( $result ); + } + + /** + * Merge the collection with the given items. + * + * @param \Mantle\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items + * @return static + */ + public function merge( $items ) { + return new static( array_merge( $this->items, $this->get_arrayable_items( $items ) ) ); + } + + /** + * Recursively merge the collection with the given items. + * + * @template TMergeRecursiveValue + * + * @param \Mantle\Contracts\Support\Arrayable<TKey, TMergeRecursiveValue>|iterable<TKey, TMergeRecursiveValue> $items + * @return static<TKey, TValue|TMergeRecursiveValue> + */ + public function merge_recursive( $items ) { + return new static( array_merge_recursive( $this->items, $this->get_arrayable_items( $items ) ) ); + } + + /** + * Create a collection by using this collection for keys and another for its values. + * + * @template TCombineValue + * + * @param \Mantle\Contracts\Support\Arrayable<array-key, TCombineValue>|iterable<array-key, TCombineValue> $values + * @return static<TValue, TCombineValue> + */ + public function combine( $values ) { + return new static( array_combine( $this->all(), $this->get_arrayable_items( $values ) ) ); + } + + /** + * Union the collection with the given items. + * + * @param \Mantle\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items + * @return static + */ + public function union( $items ) { + return new static( $this->items + $this->get_arrayable_items( $items ) ); + } + + /** + * Create a new collection consisting of every n-th element. + * + * @param int $step + * @param int $offset + * @return static + */ + public function nth( $step, $offset = 0 ) { + $new = []; + + $position = 0; + + foreach ( $this->items as $item ) { + if ( $position % $step === $offset ) { + $new[] = $item; + } + + $position++; + } + + return new static( $new ); + } + + /** + * Get the items with the specified keys. + * + * @param \Mantle\Support\Enumerable<array-key, TKey>|array<array-key, TKey>|string|null $keys + * @return static + */ + public function only( $keys ) { + if ( is_null( $keys ) ) { + return new static( $this->items ); + } + + if ( $keys instanceof Enumerable ) { + $keys = $keys->all(); + } + + $keys = is_array( $keys ) ? $keys : func_get_args(); + + return new static( Arr::only( $this->items, $keys ) ); + } + + /** + * Get the items in an collection of arrays with filtered child keys. + * + * @param TKey[]|TKey|static<int, TKey> $keys The keys to filter by. + * @return static<TKey, array> + */ + public function only_children( $keys ) { + if ( empty( $keys ) ) { + return new static( $this->items ); + } + + if ( $keys instanceof Arrayable ) { + $keys = $keys->to_array(); + } + + $keys = is_array( $keys ) ? $keys : func_get_args(); + + return $this->map( + fn ( $item ) => Arr::only( (array) $item, $keys ), + ); + } + + /** + * Get and remove the last item from the collection. + * + * @return static<int, TValue>|TValue|null + */ + public function pop() { + return array_pop( $this->items ); + } + + /** + * Push an item onto the beginning of the collection. + * + * @param mixed $value + * @param mixed $key + * @return $this + */ + public function prepend( $value, $key = null ) { + $this->items = Arr::prepend( $this->items, $value, $key ); + + return $this; + } + + /** + * Push one or more items onto the end of the collection. + * + * @param TValue ...$values + * @return $this + */ + public function push( ...$values ) { + foreach ( $values as $value ) { + $this->items[] = $value; + } + + return $this; + } + + /** + * Push all of the given items onto the collection. + * + * @param iterable<array-key, TValue> $source + * @return static + */ + public function concat( $source ) { + $result = new static( $this ); + + foreach ( $source as $item ) { + $result->push( $item ); + } + + return $result; + } + + /** + * Get and remove an item from the collection. + * + * @template TPullDefault + * + * @param TKey $key + * @param TPullDefault|(\Closure(): TPullDefault) $default + * @return TValue|TPullDefault + */ + public function pull( $key, $default = null ) { + return Arr::pull( $this->items, $key, $default ); + } + + /** + * Put an item in the collection by key. + * + * @param TKey $key + * @param TValue $value + * @return $this + */ + public function put( $key, $value ) { + $this->offsetSet( $key, $value ); + + return $this; + } + + /** + * Get one or a specified number of items randomly from the collection. + * + * @param (callable(self<TKey, TValue>): int)|int|null $number + * @return static<int, TValue>|TValue + * + * @throws \InvalidArgumentException Throws on number larger than collection length. + */ + public function random( $number = null ) { + if ( is_null( $number ) ) { + return Arr::random( $this->items ); + } + + return new static( Arr::random( $this->items, $number ) ); + } + + /** + * Reduce the collection to a single value. + * + * @template TReduceInitial + * @template TReduceReturnType + * + * @param callable(TReduceInitial|TReduceReturnType, TValue, TKey): TReduceReturnType $callback + * @param TReduceInitial $initial + * @return TReduceReturnType|TReduceInitial + */ + public function reduce( callable $callback, $initial = null ) { + $result = $initial; + + foreach ( $this as $key => $value ) { + $result = $callback( $result, $value, $key ); + } + + return $result; + } + + /** + * Replace the collection items with the given items. + * + * @param \Mantle\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items + * @return static + */ + public function replace( $items ) { + return new static( array_replace( $this->items, $this->get_arrayable_items( $items ) ) ); + } + + /** + * Recursively replace the collection items with the given items. + * + * @param \Mantle\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items + * @return static + */ + public function replace_recursive( $items ) { + return new static( array_replace_recursive( $this->items, $this->get_arrayable_items( $items ) ) ); + } + + /** + * Reverse items order. + * + * @return static + */ + public function reverse() { + return new static( array_reverse( $this->items, true ) ); + } + + /** + * Search the collection for a given value and return the corresponding key if successful. + * + * @param TValue|(callable(TValue,TKey): bool) $value + * @param bool $strict + * @return TKey|bool + */ + public function search( $value, $strict = false ) { + if ( ! $this->use_as_callable( $value ) ) { + return array_search( $value, $this->items, $strict ); + } + + foreach ( $this->items as $key => $item ) { + if ( $value( $item, $key ) ) { + return $key; + } + } + + return false; + } + + /** + * Get and remove the first item from the collection. + * + * @return TValue|null + */ + public function shift() { + return array_shift( $this->items ); + } + + /** + * Shuffle the items in the collection. + * + * @param int|null $seed + * @return static + */ + public function shuffle( $seed = null ) { + return new static( Arr::shuffle( $this->items, $seed ) ); + } + + /** + * Skip the first {$count} items. + * + * @param int $count + * @return static + */ + public function skip( $count ) { + return $this->slice( $count ); + } + + /** + * Slice the underlying collection array. + * + * @param int $offset + * @param int|null $length + * @return static + */ + public function slice( $offset, $length = null ) { + return new static( array_slice( $this->items, $offset, $length, true ) ); + } + + /** + * Split a collection into a certain number of groups. + * + * @param int $number_of_groups + * @return static<int, static> + */ + public function split( $number_of_groups ) { + if ( $this->is_empty() ) { + return new static(); + } + + $groups = new static(); + + $group_size = floor( $this->count() / $number_of_groups ); + + $remain = $this->count() % $number_of_groups; + + $start = 0; + + for ( $i = 0; $i < $number_of_groups; $i++ ) { + $size = $group_size; + + if ( $i < $remain ) { + $size++; + } + + if ( $size ) { + $groups->push( new static( array_slice( $this->items, $start, (int) $size ) ) ); + + $start += $size; + } + } + + return $groups; + } + + /** + * Chunk the collection into chunks of the given size. + * + * @param int $size + * @return static<int, static> + */ + public function chunk( $size ) { + if ( $size <= 0 ) { + return new static(); + } + + $chunks = []; + + foreach ( array_chunk( $this->items, $size, true ) as $chunk ) { + $chunks[] = new static( $chunk ); + } + + return new static( $chunks ); + } + + /** + * Sort through each item with a callback. + * + * @param (callable(TValue, TValue): int)|null|int $callback + * @return static + */ + public function sort( $callback = null ) { + $items = $this->items; + + $callback && is_callable( $callback ) + ? uasort( $items, $callback ) + : asort( $items, $callback ?? SORT_REGULAR ); + + return new static( $items ); + } + + /** + * Sort items in descending order. + * + * @param int $options + * @return static + */ + public function sort_desc( $options = SORT_REGULAR ) { + $items = $this->items; + + arsort( $items, $options ); + + return new static( $items ); + } + + /** + * Sort the collection using the given callback. + * + * @param array<array-key, (callable(TValue, TValue): mixed)|(callable(TValue, TKey): mixed)|string|array{string, string}>|(callable(TValue, TKey): mixed)|string $callback + * @param int $options + * @param bool $descending + * @return static + */ + public function sort_by( $callback, $options = SORT_REGULAR, $descending = false ) { + $results = []; + + $callback = $this->value_retriever( $callback ); + + // First we will loop through the items and get the comparator from a callback + // function which we were given. Then, we will sort the returned values and + // and grab the corresponding values for the sorted keys from this array. + foreach ( $this->items as $key => $value ) { + $results[ $key ] = $callback( $value, $key ); + } + + $descending ? arsort( $results, $options ) + : asort( $results, $options ); + + // Once we have sorted all of the keys in the array, we will loop through them + // and grab the corresponding model so we can set the underlying items list + // to the sorted version. Then we'll just return the collection instance. + foreach ( array_keys( $results ) as $key ) { + $results[ $key ] = $this->items[ $key ]; + } + + return new static( $results ); + } + + /** + * Sort the collection in descending order using the given callback. + * + * @param array<array-key, (callable(TValue, TValue): mixed)|(callable(TValue, TKey): mixed)|string|array{string, string}>|(callable(TValue, TKey): mixed)|string $callback + * @param int $options + * @return static + */ + public function sort_by_desc( $callback, $options = SORT_REGULAR ) { + return $this->sort_by( $callback, $options, true ); + } + + /** + * Sort the collection keys. + * + * @param int $options + * @param bool $descending + * @return static + */ + public function sort_keys( $options = SORT_REGULAR, $descending = false ) { + $items = $this->items; + + $descending ? krsort( $items, $options ) : ksort( $items, $options ); + + return new static( $items ); + } + + /** + * Sort the collection keys in descending order. + * + * @param int $options + * @return static + */ + public function sort_keys_desc( $options = SORT_REGULAR ) { + return $this->sort_keys( $options, true ); + } + + /** + * Splice a portion of the underlying collection array. + * + * @param int $offset + * @param int|null $length + * @param array<array-key, TValue> $replacement + * @return static + */ + public function splice( $offset, $length = null, $replacement = [] ) { + if ( func_num_args() === 1 ) { + return new static( array_splice( $this->items, $offset ) ); + } + + return new static( array_splice( $this->items, $offset, $length, $replacement ) ); + } + + /** + * Take the first or last {$limit} items. + * + * @param int $limit + * @return static + */ + public function take( $limit ) { + if ( $limit < 0 ) { + return $this->slice( $limit, abs( $limit ) ); + } + + return $this->slice( 0, $limit ); + } + + /** + * Transform each item in the collection using a callback. + * + * @param callable(TValue, TKey): TValue $callback + * @return $this + */ + public function transform( callable $callback ) { + $this->items = $this->map( $callback )->all(); + + return $this; + } + + /** + * Reset the keys on the underlying array. + * + * @return static<int, TValue> + */ + public function values() { + return new static( array_values( $this->items ) ); + } + + /** + * Zip the collection together with one or more arrays. + * + * E.g. new Collection([1, 2, 3])->zip([4, 5, 6]); + * => [[1, 4], [2, 5], [3, 6]] + * + * @template TZipValue + * + * @param \Mantle\Contracts\Support\Arrayable<array-key, TZipValue>|iterable<array-key, TZipValue> ...$items + * @return static<int, static<TKey, TValue|TZipValue>> + */ + public function zip( ...$items ) { + $arrayable_items = array_map( + fn ( $items ) => $this->get_arrayable_items( $items ), + $items, + ); + + $params = array_merge( + [ + fn () => new static( func_get_args() ), + $this->items, + ], + $arrayable_items + ); + + return new static( call_user_func_array( 'array_map', $params ) ); + } + + /** + * Trim all values in the collection. + * + * @param string $char_list Characters to trim, optional. + * @return static<TKey, string> + */ + public function trim( string $char_list = "\n\r\t\v\x00" ) { + return new static( $this->map( fn ( $item ) => trim( (string) $item, $char_list ) ) ); + } + + /** + * Pad collection to the specified length with a value. + * + * @template TPadValue + * + * @param int $size + * @param TPadValue $value + * @return static<int, TValue|TPadValue> + */ + public function pad( $size, $value ) { + return new static( array_pad( $this->items, $size, $value ) ); + } + + /** + * Get an iterator for the items. + * + * @return \ArrayIterator + */ + public function getIterator(): Traversable { + return new ArrayIterator( $this->items ); + } + + /** + * Count the number of items in the collection. + */ + public function count(): int { + return count( $this->items ); + } + + /** + * Add an item to the collection. + * + * @param TValue $item + * @return $this + */ + public function add( $item ) { + $this->items[] = $item; + + return $this; + } + + /** + * Get a base Support collection instance from this collection. + * + * @return \Mantle\Support\Collection + */ + public function to_base() { + return new self( $this ); + } + + /** + * Determine if an item exists at an offset. + * + * @param mixed $key + */ + public function offsetExists( mixed $key ): bool { + return array_key_exists( $key, $this->items ); + } + + /** + * Get an item at a given offset. + * + * @param mixed $key + */ + public function offsetGet( mixed $key ): mixed { + return $this->items[ $key ]; + } + + /** + * Set the item at a given offset. + * + * @param mixed $key + * @param mixed $value + */ + public function offsetSet( mixed $key, mixed $value ): void { + if ( is_null( $key ) ) { + $this->items[] = $value; + } else { + $this->items[ $key ] = $value; + } + } + + /** + * Unset the item at a given offset. + * + * @param mixed $key + */ + public function offsetUnset( mixed $key ): void { + unset( $this->items[ $key ] ); + } +} diff --git a/vendor/mantle-framework/support/class-driver-manager.php b/vendor/mantle-framework/support/class-driver-manager.php new file mode 100644 index 00000000..c62f1732 --- /dev/null +++ b/vendor/mantle-framework/support/class-driver-manager.php @@ -0,0 +1,134 @@ +<?php +/** + * Driver_Manager class file. + * + * @package Mantle + */ + +namespace Mantle\Support; + +use Closure; +use InvalidArgumentException; + +/** + * Driver Manager for managing multiple stores and pluggable drivers. + */ +abstract class Driver_Manager { + /** + * Custom driver creators. + * + * @var array + */ + protected $custom_creators = []; + + /** + * Resolved cache stores. + * + * @var array + */ + protected $resolved; + + /** + * Retrieve the default store from the configuration. + */ + abstract protected function get_default_store(): string; + + /** + * Retrieve store configuration. + * + * @param string $name Store name. + */ + abstract protected function get_config( string $name ): array; + + /** + * Retrieve a store. + * + * @param string $name Store name, optional. + * @return mixed + */ + public function store( string $name = null ) { + $name = $name ?: $this->get_default_store(); + + if ( ! isset( $this->resolved[ $name ] ) ) { + $this->resolved[ $name ] = $this->resolve( $name ); + } + + return $this->resolved[ $name ]; + } + + /** + * Resolve an instance of a store. + * + * @param string $name Store name. + * @return mixed + * + * @throws InvalidArgumentException Thrown on error resolving. + */ + protected function resolve( string $name ) { + $config = $this->get_config( $name ); + $driver = Arr::pull( $config, 'driver' ); + + if ( empty( $driver ) ) { + throw new InvalidArgumentException( "Driver not specified for [$name]." ); + } + + return $this->resolve_driver( $driver, $config ); + } + + /** + * Resolve a store. + * + * @param string $driver Driver name. + * @param mixed ...$args Arguments for the driver. + * @return mixed + * + * @throws InvalidArgumentException Thrown for unsupported driver. + */ + protected function resolve_driver( string $driver, ...$args ) { + if ( isset( $this->custom_creators[ $driver ] ) ) { + return $this->call_custom_creator( $driver, $args ); + } + + $method = 'create_' . str_replace( '-', '_', Str::snake( $driver ) ) . '_driver'; + + if ( ! method_exists( $this, $method ) ) { + throw new InvalidArgumentException( "Driver [$driver] not supported." ); + } + + return $this->$method( ...$args ); + } + + /** + * Call a custom driver. + * + * @param string $driver Driver name. + * @param array $args Arguments for the creator. + * @return mixed + */ + protected function call_custom_creator( string $driver, array $args ) { + return $this->custom_creators[ $driver ]( ...$args ); + } + + /** + * Extend the manager. + * + * @param string $name Driver name. + * @param Closure $callback Closure to invoke. + * @return static + */ + public function extend( string $name, Closure $callback ) { + $this->custom_creators[ $name ] = $callback; + return $this; + } + + /** + * Pass a static method call to the default store. + * + * @param string $method Method name. + * @param array $args Arguments. + * @return mixed + */ + public function __call( string $method, array $args ) { + return $this->store()->$method( ...$args ); + } +} diff --git a/vendor/mantle-framework/support/class-environment.php b/vendor/mantle-framework/support/class-environment.php new file mode 100644 index 00000000..02845088 --- /dev/null +++ b/vendor/mantle-framework/support/class-environment.php @@ -0,0 +1,97 @@ +<?php +/** + * Environment class file. + * + * @package Mantle + */ + +namespace Mantle\Support; + +use PhpOption\Option; +use Dotenv\Repository\RepositoryBuilder; +use Dotenv\Repository\RepositoryInterface; +use PhpOption\Some; + +use function Mantle\Support\Helpers\value; + +/** + * Storage of environment variables for the application. + */ +class Environment { + /** + * Variable repository. + */ + protected static ?RepositoryInterface $repository = null; + + /** + * Get the environment repository instance. + */ + public static function get_repository(): RepositoryInterface { + if ( ! isset( static::$repository ) ) { + $builder = RepositoryBuilder::createWithDefaultAdapters(); + + static::$repository = $builder->immutable()->make(); + } + + return static::$repository; + } + + /** + * Clear the environment repository instance. + */ + public static function clear(): void { + static::$repository = null; + } + + /** + * Get the value of an environment variable. + * + * @param string $key Variable to retrieve. + * @param mixed $default Default value. Supports a closure callback. + * @return mixed + */ + public static function get( string $key, $default = null ) { + $value = Option::fromValue( static::get_repository()->get( $key ) ); + + // Fallback to the VIP environment variable if the key is not found. + if ( $value instanceof \PhpOption\None ) { + $constant = strtoupper( $key ); + $vip_constant = "VIP_ENV_VAR_{$key}"; + + if ( defined( $vip_constant ) ) { + $value = new Some( constant( $vip_constant ) ); + } elseif ( defined( $constant ) ) { + $value = new Some( constant( $constant ) ); + } + } + + return $value + ->map( + function ( $value ) { + switch ( strtolower( (string) $value ) ) { + case 'true': + case '(true)': + return true; + case 'false': + case '(false)': + return false; + case 'empty': + case '(empty)': + return ''; + case 'null': + case '(null)': + return; + } + + if ( preg_match( '/\A([\'"])(.*)\1\z/', (string) $value, $matches ) ) { + return $matches[2]; + } + + return $value; + } + ) + ->getOrCall( + fn () => value( $default ) + ); + } +} diff --git a/vendor/mantle-framework/support/class-higher-order-collection-proxy.php b/vendor/mantle-framework/support/class-higher-order-collection-proxy.php new file mode 100644 index 00000000..baf660f7 --- /dev/null +++ b/vendor/mantle-framework/support/class-higher-order-collection-proxy.php @@ -0,0 +1,47 @@ +<?php +/** + * Higher_Order_Collection_Proxy class file. + * + * @package Mantle + */ + +namespace Mantle\Support; + +/** + * Higher Order Collection Proxy + * + * @mixin Enumerable + */ +class Higher_Order_Collection_Proxy { + /** + * Create a new proxy instance. + * + * @param Enumerable $collection The collection being operated on. + * @param string $method The method being proxied. + * @return void + */ + public function __construct( protected Enumerable $collection, protected string $method ) {} + + /** + * Proxy accessing an attribute onto the collection items. + * + * @param string $key + */ + public function __get( string $key ): mixed { + return $this->collection->{ $this->method }( + fn ( $value ) => is_array( $value ) ? $value[ $key ] : $value->{$key} + ); + } + + /** + * Proxy a method call onto the collection items. + * + * @param string $method + * @param array $parameters + */ + public function __call( string $method, array $parameters ): mixed { + return $this->collection->{ $this->method }( + fn ( $value) => $value->{ $method }( ...$parameters ) + ); + } +} diff --git a/vendor/mantle-framework/support/class-higher-order-tap-proxy.php b/vendor/mantle-framework/support/class-higher-order-tap-proxy.php new file mode 100644 index 00000000..d838e7b4 --- /dev/null +++ b/vendor/mantle-framework/support/class-higher-order-tap-proxy.php @@ -0,0 +1,33 @@ +<?php +/** + * This file contains the Higher_Order_Tap_Proxy class + * + * @package Mantle + */ + +namespace Mantle\Support; + +/** + * Tap proxy. + */ +class Higher_Order_Tap_Proxy { + /** + * Create a new tap proxy instance. + * + * @param mixed $target The target being tapped. + */ + public function __construct( public mixed $target ) {} + + /** + * Dynamically pass method calls to the target. + * + * @param string $method Method to call. + * @param array $parameters Params to provide to the method. + * @return mixed + */ + public function __call( string $method, array $parameters ) { + $this->target->{$method}( ...$parameters ); + + return $this->target; + } +} diff --git a/vendor/mantle-framework/support/class-higher-order-when-proxy.php b/vendor/mantle-framework/support/class-higher-order-when-proxy.php new file mode 100644 index 00000000..28c05e48 --- /dev/null +++ b/vendor/mantle-framework/support/class-higher-order-when-proxy.php @@ -0,0 +1,48 @@ +<?php +/** + * Higher_Order_When_Proxy class file + * + * @package Mantle + */ + +namespace Mantle\Support; + +/** + * Higher Order When Proxy + * + * Allow a higher-order proxy that can be used conditionally. + */ +class Higher_Order_When_Proxy { + + /** + * Create a new proxy instance. + * + * @param mixed $target The target being conditionally operated on. + * @param bool $condition The condition for proxying. + * @return void + */ + public function __construct( protected mixed $target, protected bool $condition ) {} + + /** + * Proxy accessing an attribute onto the target. + * + * @param string $key The attribute key. + */ + public function __get( string $key ): mixed { + return $this->condition + ? $this->target->{$key} + : $this->target; + } + + /** + * Proxy a method call on the target. + * + * @param string $method + * @param array $parameters + */ + public function __call( string $method, array $parameters ): mixed { + return $this->condition + ? $this->target->{$method}( ...$parameters ) + : $this->target; + } +} diff --git a/vendor/mantle-framework/support/class-pipeline.php b/vendor/mantle-framework/support/class-pipeline.php new file mode 100644 index 00000000..20366a00 --- /dev/null +++ b/vendor/mantle-framework/support/class-pipeline.php @@ -0,0 +1,231 @@ +<?php +/** + * Pipeline class file. + * + * @package Mantle + */ + +namespace Mantle\Support; + +use Closure; +use Mantle\Contracts\Container; +use Mantle\Contracts\Pipeline as PipelineContract; +use Mantle\Support\Traits\Makeable; +use RuntimeException; +use Throwable; + +/** + * Middleware Pipeline + */ +class Pipeline implements PipelineContract { + use Makeable; + + /** + * The object being passed through the pipeline. + * + * @var mixed + */ + protected $passable; + + /** + * The array of class pipes. + * + * @var array + */ + protected $pipes = []; + + /** + * The method to call on each pipe. + * + * @var string + */ + protected $method = 'handle'; + + /** + * Create a new class instance. + * + * @param Container|null $container Container instance. + */ + public function __construct( protected ?Container $container = null ) { + } + + /** + * Set the object being sent through the pipeline. + * + * @param mixed $passable Data to send through the pipeline. + * @return static + */ + public function send( $passable ) { + $this->passable = $passable; + + return $this; + } + + /** + * Set the array of pipes. + * + * @param array<callable>|null $pipes + * @return static + */ + public function through( $pipes ) { + $this->pipes = is_array( $pipes ) ? $pipes : func_get_args(); + + return $this; + } + + /** + * Set the method to call on the pipes. + * + * @param string $method + * @return static + */ + public function via( $method ) { + $this->method = $method; + + return $this; + } + + /** + * Run the pipeline with a final destination callback. + * + * @param \Closure $destination + * @return mixed + */ + public function then( Closure $destination ) { + $pipeline = array_reduce( + array_reverse( $this->pipes() ), + $this->carry(), + $this->prepare_destination( $destination ) + ); + + return $pipeline( $this->passable ); + } + + /** + * Run the pipeline and return the result. + * + * @return mixed + */ + public function thenReturn() { + return $this->then( + fn ( $passable) => $passable + ); + } + + /** + * Get the final piece of the Closure onion. + * + * @param \Closure $destination + * @return \Closure + */ + protected function prepare_destination( Closure $destination ) { + return function ( $passable ) use ( $destination ) { + try { + return $destination( $passable ); + } catch ( Throwable $e ) { + return $this->handle_exception( $passable, $e ); + } + }; + } + + /** + * Get a Closure that represents a slice of the application onion. + * + * @return \Closure + */ + protected function carry() { + return fn ( $stack, $pipe) => function ( $passable ) use ( $stack, $pipe ) { + try { + if ( is_callable( $pipe ) ) { + // If the pipe is a callable, then we will call it directly, but otherwise we + // will resolve the pipes out of the dependency container and call it with + // the appropriate method and arguments, returning the results back out. + return $pipe( $passable, $stack ); + } elseif ( ! is_object( $pipe ) ) { + [$name, $parameters] = $this->parse_pipe_string( $pipe ); + + // If the pipe is a string we will parse the string and resolve the class out + // of the dependency injection container. We can then build a callable and + // execute the pipe function giving in the parameters that are required. + $pipe = $this->get_container()->make( $name ); + + $parameters = array_merge( [ $passable, $stack ], $parameters ); + } else { + // If the pipe is already an object we'll just make a callable and pass it to + // the pipe as-is. There is no need to do any extra parsing and formatting + // since the object we're given was already a fully instantiated object. + $parameters = [ $passable, $stack ]; + } + + $carry = method_exists( $pipe, $this->method ) + ? $pipe->{$this->method}( ...$parameters ) + : $pipe( ...$parameters ); + + return $this->handle_carry( $carry ); + } catch ( Throwable $e ) { + return $this->handle_exception( $passable, $e ); + } + }; + } + + /** + * Parse full pipe string to get name and parameters. + * + * @param string $pipe + * @return array + */ + protected function parse_pipe_string( $pipe ) { + [$name, $parameters] = array_pad( explode( ':', $pipe, 2 ), 2, [] ); + + if ( is_string( $parameters ) ) { + $parameters = explode( ',', $parameters ); + } + + return [ $name, $parameters ]; + } + + /** + * Get the array of configured pipes. + * + * @return array + */ + protected function pipes() { + return $this->pipes; + } + + /** + * Get the container instance. + * + * @return Container + * @throws RuntimeException Thrown on missing container instance. + */ + protected function get_container() { + if ( ! isset( $this->container ) ) { + throw new RuntimeException( 'A container instance has not been passed to the Pipeline.' ); + } + + return $this->container; + } + + /** + * Handle the value returned from each pipe before passing it to the next. + * + * @param mixed $carry + * @return mixed + */ + protected function handle_carry( $carry ) { + return $carry; + } + + /** + * Handle the given exception. + * + * @param mixed $passable Passable object. + * @param Throwable $e Exception thrown. + * + * @throws Throwable Thrown when an exception is passed. + */ + protected function handle_exception( $passable, Throwable $e ): never { + throw $e; + } +} diff --git a/vendor/mantle-framework/support/class-pluralizer.php b/vendor/mantle-framework/support/class-pluralizer.php new file mode 100755 index 00000000..3b630b07 --- /dev/null +++ b/vendor/mantle-framework/support/class-pluralizer.php @@ -0,0 +1,123 @@ +<?php +/** + * Str class file + * + * @package Mantle + */ + +namespace Mantle\Support; + +use Doctrine\Inflector\Inflector; +use Doctrine\Inflector\InflectorFactory; + +/** + * Interface with Doctrine Inflector to pluralize and singularize words. + */ +class Pluralizer { + + /** + * The cached inflector instance. + */ + protected static ?Inflector $inflector = null; + + /** + * The language that should be used by the inflector. + * + * @var string + */ + protected static $language = 'english'; + + /** + * Uncountable non-nouns word forms. + * + * Contains words supported by Doctrine/Inflector/Rules/English/Uninflected.php + * + * @var string[] + */ + public static $uncountable = [ + 'recommended', + 'related', + ]; + + /** + * Get the plural form of an English word. + * + * @param string $value + * @param int|array|\Countable $count + */ + public static function plural( string $value, int|array|\Countable $count = 2 ): string { + if ( is_countable( $count ) ) { + $count = count( $count ); + } + + if ( abs( $count ) === 1 || static::uncountable( $value ) || preg_match( '/^(.*)[A-Za-z0-9\x{0080}-\x{FFFF}]$/u', $value ) == 0 ) { + return $value; + } + + $plural = static::inflector()->pluralize( $value ); + + return static::match_case( $plural, $value ); + } + + /** + * Get the singular form of an English word. + * + * @param string $value + */ + public static function singular( string $value ): string { + $singular = static::inflector()->singularize( $value ); + + return static::match_case( $singular, $value ); + } + + /** + * Determine if the given value is uncountable. + * + * @param string $value + * @return bool + */ + protected static function uncountable( $value ) { + return in_array( strtolower( $value ), static::$uncountable ); + } + + /** + * Attempt to match the case on two strings. + * + * @param string $value + * @param string $comparison + * @return string + */ + protected static function match_case( string $value, string $comparison ) { + $functions = [ 'mb_strtolower', 'mb_strtoupper', 'ucfirst', 'ucwords' ]; + + foreach ( $functions as $function ) { + if ( $function( $comparison ) === $comparison ) { + return $function( $value ); + } + } + + return $value; + } + + /** + * Get the inflector instance. + */ + public static function inflector(): Inflector { + if ( ! isset( static::$inflector ) ) { + static::$inflector = InflectorFactory::createForLanguage( static::$language )->build(); + } + + return static::$inflector; + } + + /** + * Specify the language that should be used by the inflector. + * + * @param string $language + */ + public static function use_language( string $language ): void { + static::$language = $language; + + static::$inflector = null; + } +} diff --git a/vendor/mantle-framework/support/class-reflector.php b/vendor/mantle-framework/support/class-reflector.php new file mode 100644 index 00000000..981c38ec --- /dev/null +++ b/vendor/mantle-framework/support/class-reflector.php @@ -0,0 +1,106 @@ +<?php +/** + * Reflector class file. + * + * @package Mantle + */ + +namespace Mantle\Support; + +use ReflectionClass; +use ReflectionNamedType; +use ReflectionUnionType; + +/** + * Reflector Support + */ +class Reflector { + + /** + * Get the class name of the given parameter's type, if possible. + * + * @param \ReflectionParameter $parameter + * @return string|null + */ + public static function get_parameter_class_name( $parameter ) { + $type = $parameter->getType(); + + if ( ! $type instanceof ReflectionNamedType || $type->isBuiltin() ) { + return null; + } + + $name = $type->getName(); + + if ( ! is_null( $class = $parameter->getDeclaringClass() ) ) { + if ( 'self' === $name ) { + return $class->getName(); + } + + if ( 'parent' === $name && $parent = $class->getParentClass() ) { + return $parent->getName(); + } + } + + return $name; + } + + /** + * Get the class names of the given parameter's type, including union types. + * + * @param \ReflectionParameter $parameter + */ + public static function get_parameter_class_names( $parameter ): array { + $type = $parameter->getType(); + + if ( ! $type instanceof ReflectionUnionType ) { + return array_filter( [ static::get_parameter_class_name( $parameter ) ] ); + } + + $union_types = []; + + foreach ( $type->getTypes() as $listed_type ) { + if ( ! $listed_type instanceof ReflectionNamedType || $listed_type->isBuiltin() ) { + continue; + } + + $union_types[] = static::get_type_name( $parameter, $listed_type ); + } + + return array_filter( $union_types ); + } + + /** + * Get the given type's class name. + * + * @param \ReflectionParameter $parameter + * @param \ReflectionNamedType $type + * @return string + */ + protected static function get_type_name( $parameter, $type ) { + $name = $type->getName(); + + if ( ! is_null( $class = $parameter->getDeclaringClass() ) ) { + if ( 'self' === $name ) { + return $class->getName(); + } + + if ( 'parent' === $name && $parent = $class->getParentClass() ) { + return $parent->getName(); + } + } + + return $name; + } + + /** + * Determine if the parameter's type is a subclass of the given type. + * + * @param \ReflectionParameter $parameter + * @param string $class_name + */ + public static function is_parameter_subclass_of( $parameter, $class_name ): bool { + $param_class_name = static::get_parameter_class_name( $parameter ); + + return $param_class_name && class_exists( $param_class_name ) && ( new ReflectionClass( $param_class_name ) )->isSubclassOf( $class_name ); + } +} diff --git a/vendor/mantle-framework/support/class-service-provider.php b/vendor/mantle-framework/support/class-service-provider.php new file mode 100644 index 00000000..16067287 --- /dev/null +++ b/vendor/mantle-framework/support/class-service-provider.php @@ -0,0 +1,214 @@ +<?php +/** + * Service_Provider class file. + * + * @package Mantle + */ + +namespace Mantle\Support; + +use Mantle\Console\Application as Console_Application; +use Mantle\Console\Command; +use Mantle\Contracts\Application; +use Mantle\Support\Traits\Hookable; +use Psr\Log\{LoggerAwareInterface, LoggerAwareTrait}; + +use function Mantle\Support\Helpers\collect; + +/** + * Application Service Provider + */ +abstract class Service_Provider implements LoggerAwareInterface { + use Hookable; + use LoggerAwareTrait; + + /** + * The paths that should be published. + */ + public static array $publishes = []; + + /** + * The paths that should be published by group. + */ + public static array $publish_tags = []; + + /** + * The application instance. + * + * @var Application|\Mantle\Container\Container + */ + protected $app; + + /** + * Commands to register. + * Register commands through `Service_Provider::add_command()`. + * + * @var \Mantle\Console\Command[] + */ + protected array $commands; + + /** + * Create a new service provider instance. + * + * @param Application $app Application Instance. + */ + public function __construct( Application $app ) { + $this->app = $app; + } + + /** + * Register the service provider. + */ + public function register() {} + + /** + * Boot the service provider. + */ + public function boot() {} + + /** + * Bootstrap services. + */ + public function boot_provider(): void { + if ( isset( $this->app['log'] ) ) { + $this->setLogger( $this->app['log']->driver() ); + } + + $this->register_hooks(); + $this->boot(); + } + + /** + * Register a console command. + * + * @param Command[]|string[]|Command|string $command Command instance or class name to register. + */ + public function add_command( $command ): Service_Provider { + Console_Application::starting( + fn ( Console_Application $console ) => $console->resolve_commands( $command ) + ); + + return $this; + } + + /** + * Setup an after resolving listener, or fire immediately if already resolved. + * + * @param string $name Abstract name. + * @param callable $callback Callback. + */ + protected function call_after_resolving( string $name, callable $callback ): void { + $this->app->after_resolving( $name, $callback ); + + if ( $this->app->resolved( $name ) ) { + $callback( $this->app->make( $name ), $this->app ); + } + } + + /** + * Register paths to be published by the publish command. + * + * @param string[] $paths Paths to publish. + * @param string|array<string>|null $tags Tags to publish. + */ + public function publishes( array $paths, $tags = null ): void { + $class = static::class; + + if ( ! array_key_exists( $class, static::$publishes ) ) { + static::$publishes[ $class ] = []; + } + + static::$publishes[ $class ] = array_merge( static::$publishes[ $class ], $paths ); + + foreach ( (array) $tags as $tag ) { + if ( ! array_key_exists( $tag, static::$publish_tags ) ) { + static::$publish_tags[ $tag ] = []; + } + + static::$publish_tags[ $tag ] = array_merge( + static::$publish_tags[ $tag ], + $paths, + ); + } + } + + /** + * Get the service providers available for publishing. + * + * @return array<class-string<Service_Provider>> + */ + public static function publishable_providers(): array { + return array_keys( static::$publishes ); + } + + /** + * Get the groups available for publishing. + * + * @return string[] + */ + public static function publishable_tags(): array { + return array_keys( static::$publish_tags ); + } + + /** + * Load routes from the given path. + * + * @param string $path Path to routes file. + */ + public function load_routes_from( string $path ): void { + require $path; + } + + /** + * Load views from the given path. + * + * @param string $path Path to views directory. + * @param string $alias Alias to register views under. + */ + public function load_views_from( string $path, string $alias ): void { + $this->call_after_resolving( + 'view.loader', + fn ( \Mantle\Http\View\View_Finder $finder ) => $finder->add_path( $path, $alias ), + ); + } + + /** + * Get the paths to publish. + * + * Passing both a provider and a tag will return all paths that are + * published by that provider and tag. + * + * @param class-string<Service_Provider>|array<class-string<Service_Provider>>|null $providers The service provider class name. + * @param string|array<string>|null $tags The tag name. + * @return array<string, string> The paths to publish. Index is the source path, value is the destination path. + */ + public static function paths_to_publish( array|string|null $providers = null, array|string|null $tags = null ): array { + if ( ! $providers && ! $tags ) { + return []; + } + + $provider_paths = collect(); + $tag_paths = collect(); + + if ( $providers ) { + foreach ( (array) $providers as $item ) { + $provider_paths = $provider_paths->merge( static::$publishes[ $item ] ?? [] ); + } + } + + if ( $tags ) { + foreach ( (array) $tags as $item ) { + $tag_paths = $tag_paths->merge( static::$publish_tags[ $item ] ?? [] ); + } + } + + // If both are passed, find the intersection. + if ( $providers && $tags ) { + return $provider_paths->intersect_by_keys( $tag_paths )->all(); + } elseif ( $providers ) { + return $provider_paths->all(); + } elseif ( $tags ) { + return $tag_paths->all(); + } + } +} diff --git a/vendor/mantle-framework/support/class-str.php b/vendor/mantle-framework/support/class-str.php new file mode 100644 index 00000000..79952796 --- /dev/null +++ b/vendor/mantle-framework/support/class-str.php @@ -0,0 +1,1378 @@ +<?php +/** + * Str class file + * + * phpcs:disable WordPress.PHP.YodaConditions.NotYoda + * + * @package Mantle + */ + +namespace Mantle\Support; + +use JsonException; +use League\CommonMark\Environment\Environment; +use League\CommonMark\Extension\GithubFlavoredMarkdownExtension; +use League\CommonMark\Extension\InlinesOnly\InlinesOnlyExtension; +use League\CommonMark\GithubFlavoredMarkdownConverter; +use League\CommonMark\MarkdownConverter; +use Mantle\Support\Traits\Macroable; +use Ramsey\Uuid\Uuid; +use Ramsey\Uuid\UuidFactory; +use Ramsey\Uuid\UuidInterface; +use Traversable; +use voku\helper\ASCII; + +use function Mantle\Support\Helpers\collect; + +/** + * String Support class + */ +class Str { + use Macroable; + + /** + * The cache of snake-cased words. + * + * @var array + */ + protected static $snake_cache = []; + + /** + * The cache of camel-cased words. + * + * @var array + */ + protected static $camel_cache = []; + + /** + * The cache of studly-cased words. + * + * @var array + */ + protected static $studly_cache = []; + + /** + * The callback that should be used to generate random strings. + * + * @var callable|null + */ + protected static $random_string_factory; + + /** + * Get a new stringable object from the given string. + * + * @param string $string + * @return \Mantle\Support\Stringable + */ + public static function of( $string ) { + return new Stringable( $string ); + } + + /** + * Return the remainder of a string after the first occurrence of a given value. + * + * @param string $subject + * @param string $search + * @return string + */ + public static function after( $subject, $search ) { + return $search === '' ? $subject : array_reverse( explode( $search, $subject, 2 ) )[0]; + } + + /** + * Return the remainder of a string after the last occurrence of a given value. + * + * @param string $subject + * @param string $search + * @return string + */ + public static function after_last( $subject, $search ) { + if ( $search === '' ) { + return $subject; + } + + $position = strrpos( $subject, (string) $search ); + + if ( $position === false ) { + return $subject; + } + + return substr( $subject, $position + strlen( $search ) ); + } + + /** + * Transliterate a UTF-8 value to ASCII. + * + * @param string|null $value + * @param string $language + * @return string + */ + public static function ascii( ?string $value, string $language = 'en' ) { + return ASCII::to_ascii( (string) $value, $language ); + } + + /** + * Transliterate a string to its closest ASCII representation. + * + * @param string $string + * @param string|null $unknown + * @param bool|null $strict + * @return string + */ + public static function transliterate( $string, $unknown = '?', $strict = false ) { + return ASCII::to_transliterate( $string, $unknown, $strict ); + } + + /** + * Get the portion of a string before the first occurrence of a given value. + * + * @param string $subject + * @param string $search + * @return string + */ + public static function before( $subject, $search ) { + if ( '' === $search ) { + return $subject; + } + + $result = strstr( $subject, (string) $search, true ); + + return $result === false ? $subject : $result; + } + + /** + * Get the portion of a string before the last occurrence of a given value. + * + * @param string $subject + * @param string $search + * @return string + */ + public static function before_last( $subject, $search ) { + if ( $search === '' ) { + return $subject; + } + + $pos = mb_strrpos( $subject, $search ); + + if ( $pos === false ) { + return $subject; + } + + return static::substr( $subject, 0, $pos ); + } + + /** + * Get the portion of a string between two given values. + * + * @param string $subject + * @param string $from + * @param string $to + * @return string + */ + public static function between( $subject, $from, $to ) { + if ( $from === '' || $to === '' ) { + return $subject; + } + + return static::before_last( static::after( $subject, $from ), $to ); + } + + /** + * Get the smallest possible portion of a string between two given values. + * + * @param string $subject + * @param string $from + * @param string $to + * @return string + */ + public static function between_first( $subject, $from, $to ) { + if ( $from === '' || $to === '' ) { + return $subject; + } + + return static::before( static::after( $subject, $from ), $to ); + } + + /** + * Convert a value to camel case. + * + * @param string $value + * @return string + */ + public static function camel( $value ) { + return static::$camel_cache[ $value ] ?? ( static::$camel_cache[ $value ] = lcfirst( static::studly( $value ) ) ); + } + + /** + * Get the character at the specified index. + * + * @param string $subject + * @param int $index + * @return string|false + */ + public static function char_at( $subject, $index ) { + $length = mb_strlen( $subject ); + + if ( $index < 0 ? $index < -$length : $index > $length - 1 ) { + return false; + } + + return mb_substr( $subject, $index, 1 ); + } + + /** + * Determine if a given string contains a given substring. + * + * @param string $haystack + * @param string|iterable<string> $needles + * @param bool $ignore_case + */ + public static function contains( $haystack, $needles, $ignore_case = false ): bool { + if ( $ignore_case ) { + $haystack = mb_strtolower( $haystack ); + } + + if ( ! is_iterable( $needles ) ) { + $needles = (array) $needles; + } + + foreach ( $needles as $needle ) { + if ( $ignore_case ) { + $needle = mb_strtolower( $needle ); + } + + if ( $needle !== '' && str_contains( $haystack, $needle ) ) { + return true; + } + } + + return false; + } + + /** + * Determine if a given string contains all array values. + * + * @param string $haystack + * @param iterable<string> $needles + * @param bool $ignore_case + */ + public static function contains_all( $haystack, $needles, bool $ignore_case = false ): bool { + foreach ( $needles as $needle ) { + if ( ! static::contains( $haystack, $needle, $ignore_case ) ) { + return false; + } + } + + return true; + } + + /** + * Determine if a given string ends with a given substring. + * + * @param string $haystack + * @param string|iterable<string> $needles + */ + public static function ends_with( $haystack, $needles ): bool { + if ( ! is_iterable( $needles ) ) { + $needles = (array) $needles; + } + + foreach ( $needles as $needle ) { + if ( (string) $needle !== '' && str_ends_with( $haystack, $needle ) ) { + return true; + } + } + + return false; + } + + /** + * Extracts an excerpt from text that matches the first instance of a phrase. + * + * @param string $text + * @param string $phrase + * @param array $options + * @return string|null + */ + public static function excerpt( $text, $phrase = '', $options = [] ) { + $radius = $options['radius'] ?? 100; + $omission = $options['omission'] ?? '...'; + + preg_match( '/^(.*?)(' . preg_quote( (string) $phrase, null ) . ')(.*)$/iu', (string) $text, $matches ); + + if ( empty( $matches ) ) { + return null; + } + + $start = ltrim( $matches[1] ); + + $start = str( mb_substr( $start, max( mb_strlen( $start, 'UTF-8' ) - $radius, 0 ), $radius, 'UTF-8' ) )->ltrim()->unless( + fn ( $start_with_radius ) => $start_with_radius->exactly( $start ), + fn ( $start_with_radius ) => $start_with_radius->prepend( $omission ), + ); + + $end = rtrim( $matches[3] ); + + $end = str( mb_substr( $end, 0, $radius, 'UTF-8' ) )->rtrim()->unless( + fn ( $end_with_radius ) => $end_with_radius->exactly( $end ), + fn ( $end_with_radius ) => $end_with_radius->append( $omission ), + ); + + return $start->append( $matches[2], $end )->toString(); + } + + /** + * Cap a string with a single instance of a given value. + * + * @param string $value + * @param string $cap + * @return string + */ + public static function finish( $value, $cap ) { + $quoted = preg_quote( $cap, '/' ); + + return preg_replace( '/(?:' . $quoted . ')+$/u', '', $value ) . $cap; + } + + /** + * Wrap the string with the given strings. + * + * @param string $value + * @param string $before + * @param string|null $after + * @return string + */ + public static function wrap( $value, $before, $after = null ) { + return $before . $value . ( $after ??= $before ); + } + + /** + * Determine if a given string matches a given pattern. + * + * @param string|iterable<string> $pattern + * @param string $value + */ + public static function is( $pattern, $value ): bool { + $value = (string) $value; + + if ( ! is_iterable( $pattern ) ) { + $pattern = [ $pattern ]; + } + + foreach ( $pattern as $pattern ) { + $pattern = (string) $pattern; + + // If the given value is an exact match we can of course return true right + // from the beginning. Otherwise, we will translate asterisks and do an + // actual pattern match against the two strings to see if they match. + if ( $pattern === $value ) { + return true; + } + + $pattern = preg_quote( $pattern, '#' ); + + // Asterisks are translated into zero-or-more regular expression wildcards + // to make it convenient to check if the strings starts with the given + // pattern such as "library/*", making any string check convenient. + $pattern = str_replace( '\*', '.*', $pattern ); + + if ( preg_match( '#^' . $pattern . '\z#u', $value ) === 1 ) { + return true; + } + } + + return false; + } + + /** + * Determine if a given string is 7 bit ASCII. + * + * @param string $value + * @return bool + */ + public static function is_ascii( $value ) { + return ASCII::is_ascii( (string) $value ); + } + + /** + * Determine if a given string is valid JSON. + * + * @param string $value + */ + public static function is_json( $value ): bool { + if ( ! is_string( $value ) ) { + return false; + } + + try { + json_decode( $value, true, 512, JSON_THROW_ON_ERROR ); + } catch ( JsonException ) { + return false; + } + + return true; + } + + /** + * Determine if a given string is a valid UUID. + * + * @param string $value + * @return bool + */ + public static function is_uuid( $value ) { + if ( ! is_string( $value ) ) { + return false; + } + + return preg_match( '/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iD', $value ) > 0; + } + + /** + * Convert a string to kebab case. + * + * @param string $value + * @return string + */ + public static function kebab( $value ) { + return static::snake( $value, '-' ); + } + + /** + * Return the length of the given string. + * + * @param string $value + * @param string|null $encoding + */ + public static function length( $value, $encoding = null ): int { + return mb_strlen( $value, $encoding ); + } + + /** + * Limit the number of characters in a string. + * + * @param string $value + * @param int $limit + * @param string $end + * @return string + */ + public static function limit( $value, $limit = 100, $end = '...' ) { + if ( mb_strwidth( $value, 'UTF-8' ) <= $limit ) { + return $value; + } + + return rtrim( mb_strimwidth( $value, 0, $limit, '', 'UTF-8' ) ) . $end; + } + + /** + * Convert the given string to lower-case. + * + * @param string $value + * @return string + */ + public static function lower( $value ) { + return mb_strtolower( $value, 'UTF-8' ); + } + + /** + * Limit the number of words in a string. + * + * @param string $value + * @param int $words + * @param string $end + * @return string + */ + public static function words( $value, $words = 100, $end = '...' ) { + preg_match( '/^\s*+(?:\S++\s*+){1,' . $words . '}/u', $value, $matches ); + + if ( ! isset( $matches[0] ) || static::length( $value ) === static::length( $matches[0] ) ) { + return $value; + } + + return rtrim( $matches[0] ) . $end; + } + + /** + * Converts GitHub flavored Markdown into HTML. + * + * @param string $string + * @param array $options + * @return string + */ + public static function markdown( $string, array $options = [] ) { + $converter = new GithubFlavoredMarkdownConverter( $options ); + + return (string) $converter->convert( $string ); + } + + /** + * Converts inline Markdown into HTML. + * + * @param string $string + * @param array $options + * @return string + */ + public static function inline_markdown( $string, array $options = [] ) { + $environment = new Environment( $options ); + + $environment->addExtension( new GithubFlavoredMarkdownExtension() ); + $environment->addExtension( new InlinesOnlyExtension() ); + + $converter = new MarkdownConverter( $environment ); + + return (string) $converter->convert( $string ); + } + + /** + * Masks a portion of a string with a repeated character. + * + * @param string $string + * @param string $character + * @param int $index + * @param int|null $length + * @param string $encoding + * @return string + */ + public static function mask( $string, $character, $index, $length = null, $encoding = 'UTF-8' ) { + if ( '' === $character ) { + return $string; + } + + $segment = mb_substr( $string, $index, $length, $encoding ); + + if ( '' === $segment ) { + return $string; + } + + $strlen = mb_strlen( $string, $encoding ); + $start_index = $index; + + if ( $index < 0 ) { + $start_index = $index < -$strlen ? 0 : $strlen + $index; + } + + $start = mb_substr( $string, 0, $start_index, $encoding ); + $segment_len = mb_strlen( $segment, $encoding ); + $end = mb_substr( $string, $start_index + $segment_len ); + + return $start . str_repeat( mb_substr( $character, 0, 1, $encoding ), $segment_len ) . $end; + } + + /** + * Get the string matching the given pattern. + * + * @param string $pattern + * @param string $subject + * @return string + */ + public static function match( $pattern, $subject ) { + preg_match( $pattern, $subject, $matches ); + + if ( ! $matches ) { + return ''; + } + + return $matches[1] ?? $matches[0]; + } + + /** + * Determine if a given string matches a given pattern. + * + * @param string|iterable<string> $pattern + * @param string $value + */ + public static function is_match( $pattern, $value ): bool { + $value = (string) $value; + + if ( ! is_iterable( $pattern ) ) { + $pattern = [ $pattern ]; + } + + foreach ( $pattern as $pattern ) { + $pattern = (string) $pattern; + + if ( preg_match( $pattern, $value ) === 1 ) { + return true; + } + } + + return false; + } + + /** + * Get the string matching the given pattern. + * + * @param string $pattern + * @param string $subject + * @return \Mantle\Support\Collection + */ + public static function match_all( $pattern, $subject ) { + preg_match_all( $pattern, $subject, $matches ); + + if ( empty( $matches[0] ) ) { + return collect(); + } + + return collect( $matches[1] ?? $matches[0] ); + } + + /** + * Pad both sides of a string with another. + * + * @param string $value + * @param int $length + * @param string $pad + * @return string + */ + public static function pad_both( $value, $length, $pad = ' ' ) { + $short = max( 0, $length - mb_strlen( $value ) ); + $short_left = (int) floor( $short / 2 ); + $short_right = (int) ceil( $short / 2 ); + + return mb_substr( str_repeat( $pad, $short_left ), 0, $short_left ) . + $value . + mb_substr( str_repeat( $pad, $short_right ), 0, $short_right ); + } + + /** + * Pad the left side of a string with another. + * + * @param string $value + * @param int $length + * @param string $pad + * @return string + */ + public static function pad_left( $value, $length, $pad = ' ' ) { + $short = max( 0, $length - mb_strlen( $value ) ); + + return mb_substr( str_repeat( $pad, $short ), 0, $short ) . $value; + } + + /** + * Pad the right side of a string with another. + * + * @param string $value + * @param int $length + * @param string $pad + * @return string + */ + public static function pad_right( $value, $length, $pad = ' ' ) { + $short = max( 0, $length - mb_strlen( $value ) ); + + return $value . mb_substr( str_repeat( $pad, $short ), 0, $short ); + } + + /** + * Parse a Class[@]method style callback into class and method. + * + * @param string $callback + * @param string|null $default + * @return array<int, string|null> + */ + public static function parse_callback( $callback, $default = null ) { + return static::contains( $callback, '@' ) ? explode( '@', $callback, 2 ) : [ $callback, $default ]; + } + + /** + * Get the plural form of an English word. + * + * @param string $value + * @param int|array|\Countable $count + * @return string + */ + public static function plural( $value, $count = 2 ) { + return Pluralizer::plural( $value, $count ); + } + + /** + * Pluralize the last word of an English, studly caps case string. + * + * @param string $value + * @param int|array|\Countable $count + * @return string + */ + public static function plural_studly( $value, $count = 2 ) { + $parts = preg_split( '/(.)(?=[A-Z])/u', $value, -1, PREG_SPLIT_DELIM_CAPTURE ); + + $last_word = array_pop( $parts ); + + return implode( '', $parts ) . self::plural( $last_word, $count ); + } + + /** + * Generate a random, secure password. + * + * @param int $length + * @param bool $letters + * @param bool $numbers + * @param bool $symbols + * @param bool $spaces + * @return string + */ + public static function password( $length = 32, $letters = true, $numbers = true, $symbols = true, $spaces = false ) { + return ( new Collection() ) + ->when( + $letters, + fn ( $c ) => $c->merge( + [ + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + ] + ) + ) + ->when( + $numbers, + fn ( $c) => $c->merge( + [ + '0', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9', + ] + ) + ) + ->when( + $symbols, + fn ( $c) => $c->merge( + [ + '~', + '!', + '#', + '$', + '%', + '^', + '&', + '*', + '(', + ')', + '-', + '_', + '.', + ',', + '<', + '>', + '?', + '/', + '\\', + '{', + '}', + '[', + ']', + '|', + ':', + ';', + ] + ) + ) + ->when( $spaces, fn ( $c) => $c->merge( [ ' ' ] ) ) + ->pipe( fn ( $c) => Collection::times( $length, fn () => $c[ random_int( 0, $c->count() - 1 ) ] ) ) + ->implode( '' ); + } + + /** + * Generate a more truly "random" alpha-numeric string. + * + * @param int $length + * @return string + */ + public static function random( $length = 16 ) { + return ( static::$random_string_factory ?? function ( $length ) { + $string = ''; + + while ( ( $len = strlen( $string ) ) < $length ) { // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition, Squiz.PHP.DisallowSizeFunctionsInLoops.Found + $size = $length - $len; + + $bytes_size = (int) ceil( $size / 3 ) * 3; + + $bytes = random_bytes( $bytes_size ); + + $string .= substr( str_replace( [ '/', '+', '=' ], '', base64_encode( $bytes ) ), 0, $size ); + } + + return $string; + } )( $length ); + } + + /** + * Set the callable that will be used to generate random strings. + * + * @param callable|null $factory + */ + public static function create_random_strings_using( callable $factory = null ): void { + static::$random_string_factory = $factory; + } + + /** + * Set the sequence that will be used to generate random strings. + * + * @param array $sequence + * @param callable|null $when_missing + */ + public static function create_random_strings_using_sequence( array $sequence, $when_missing = null ): void { + $next = 0; + + $when_missing ??= function ( $length ) use ( &$next ) { + $factory_cache = static::$random_string_factory; + + static::$random_string_factory = null; + + $random_string = static::random( $length ); + + static::$random_string_factory = $factory_cache; + + $next++; + + return $random_string; + }; + + static::create_random_strings_using( + function ( $length ) use ( &$next, $sequence, $when_missing ) { + if ( array_key_exists( $next, $sequence ) ) { + return $sequence[ $next++ ]; + } + + return $when_missing( $length ); + } + ); + } + + /** + * Indicate that random strings should be created normally and not using a custom factory. + */ + public static function create_random_strings_normally(): void { + static::$random_string_factory = null; + } + + /** + * Repeat the given string. + * + * @param string $string + * @param int $times + * @return string + */ + public static function repeat( string $string, int $times ) { + return str_repeat( $string, $times ); + } + + /** + * Replace a given value in the string sequentially with an array. + * + * @param string $search + * @param iterable<string> $replace + * @param string $subject + * @return string + */ + public static function replace_array( $search, $replace, $subject ) { + if ( $replace instanceof Traversable ) { + $replace = collect( $replace )->all(); + } + + $segments = explode( $search, $subject ); + + $result = array_shift( $segments ); + + foreach ( $segments as $segment ) { + $result .= ( array_shift( $replace ) ?? $search ) . $segment; + } + + return $result; + } + + /** + * Replace the given value in the given string. + * + * @param string|iterable<string> $search + * @param string|iterable<string> $replace + * @param string|iterable<string> $subject + * @param bool $case_sensitive + * @return string + */ + public static function replace( $search, $replace, $subject, bool $case_sensitive = true ) { + if ( $search instanceof Traversable ) { + $search = collect( $search )->all(); + } + + if ( $replace instanceof Traversable ) { + $replace = collect( $replace )->all(); + } + + if ( $subject instanceof Traversable ) { + $subject = collect( $subject )->all(); + } + + return $case_sensitive + ? str_replace( $search, $replace, $subject ) + : str_ireplace( $search, $replace, $subject ); + } + + /** + * Replace the first occurrence of a given value in the string. + * + * @param string $search + * @param string $replace + * @param string $subject + * @return string + */ + public static function replace_first( $search, $replace, $subject ) { + $search = (string) $search; + + if ( '' === $search ) { + return $subject; + } + + $position = strpos( $subject, $search ); + + if ( false !== $position ) { + return substr_replace( $subject, $replace, $position, strlen( $search ) ); + } + + return $subject; + } + + /** + * Replace the last occurrence of a given value in the string. + * + * @param string $search + * @param string $replace + * @param string $subject + * @return string + */ + public static function replace_last( $search, $replace, $subject ) { + if ( '' === $search ) { + return $subject; + } + + $position = strrpos( $subject, $search ); + + if ( $position !== false ) { + return substr_replace( $subject, $replace, $position, strlen( $search ) ); + } + + return $subject; + } + + /** + * Remove any occurrence of the given string in the subject. + * + * @param string|iterable<string> $search + * @param string $subject + * @param bool $case_sensitive + * @return string + */ + public static function remove( $search, $subject, bool $case_sensitive = true ) { + if ( $search instanceof Traversable ) { + $search = collect( $search )->all(); + } + + return $case_sensitive + ? str_replace( $search, '', $subject ) + : str_ireplace( $search, '', $subject ); + } + + /** + * Reverse the given string. + * + * @param string $value + * @return string + */ + public static function reverse( string $value ) { + return implode( '', array_reverse( mb_str_split( $value ) ) ); + } + + /** + * Begin a string with a single instance of a given value. + * + * @param string $value + * @param string $prefix + * @return string + */ + public static function start( $value, $prefix ) { + $quoted = preg_quote( $prefix, '/' ); + + return $prefix . preg_replace( '/^(?:' . $quoted . ')+/u', '', $value ); + } + + /** + * Convert the given string to upper-case. + * + * @param string $value + * @return string + */ + public static function upper( $value ) { + return mb_strtoupper( $value, 'UTF-8' ); + } + + /** + * Convert the given string to title case. + * + * @param string $value + */ + public static function title( string $value ): string { + return mb_convert_case( $value, MB_CASE_TITLE, 'UTF-8' ); + } + + /** + * Convert the given string to title case for each word. + * + * @param string $value + */ + public static function headline( string $value ): string { + $parts = explode( ' ', $value ); + + $parts = count( $parts ) > 1 + ? array_map( [ static::class, 'title' ], $parts ) + : array_map( [ static::class, 'title' ], static::ucsplit( implode( '_', $parts ) ) ); + + $collapsed = static::replace( [ '-', '_', ' ' ], '_', implode( '_', $parts ) ); + + return implode( ' ', array_filter( explode( '_', $collapsed ) ) ); + } + + /** + * Get the singular form of an English word. + * + * @param string $value + */ + public static function singular( string $value ): string { + return Pluralizer::singular( $value ); + } + + /** + * Generate a URL friendly "slug" from a given string. + * + * @param string|null $title + * @param string $separator + * @param string|null $language + * @param array<string, string> $dictionary + * @return string + */ + public static function slug( ?string $title, string $separator = '-', ?string $language = 'en', array $dictionary = [ '@' => 'at' ] ) { + $title = $language ? static::ascii( $title, $language ) : $title; + + // Convert all dashes/underscores into separator. + $flip = '-' === $separator ? '_' : '-'; + + $title = preg_replace( '![' . preg_quote( $flip, null ) . ']+!u', $separator, (string) $title ); + + // Replace dictionary words. + foreach ( $dictionary as $key => $value ) { + $dictionary[ $key ] = $separator . $value . $separator; + } + + $title = str_replace( array_keys( $dictionary ), array_values( $dictionary ), (string) $title ); + + // Remove all characters that are not the separator, letters, numbers, or whitespace. + $title = preg_replace( '![^' . preg_quote( $separator, null ) . '\pL\pN\s]+!u', '', static::lower( $title ) ); + + // Replace all separator characters and whitespace by a single separator. + $title = preg_replace( '![' . preg_quote( $separator, null ) . '\s]+!u', $separator, (string) $title ); + + return trim( (string) $title, $separator ); + } + + /** + * Convert a string to snake case. + * + * @param string $value + * @param string $delimiter + * @return string + */ + public static function snake( $value, $delimiter = '_' ) { + $key = $value; + + if ( isset( static::$snake_cache[ $key ][ $delimiter ] ) ) { + return static::$snake_cache[ $key ][ $delimiter ]; + } + + if ( ! ctype_lower( $value ) ) { + $value = preg_replace( '/\s+/u', '', ucwords( $value ) ); + + $value = static::lower( preg_replace( '/(.)(?=[A-Z])/u', '$1' . $delimiter, (string) $value ) ); + } + + return static::$snake_cache[ $key ][ $delimiter ] = $value; + } + + /** + * Remove all "extra" blank space from the given string. + * + * @param string $value + * @return string + */ + public static function squish( $value ) { + return preg_replace( '~(\s|\x{3164}|\x{1160})+~u', ' ', (string) preg_replace( '~^[\s\x{FEFF}]+|[\s\x{FEFF}]+$~u', '', $value ) ); + } + + /** + * Determine if a given string starts with a given substring. + * + * @param string $haystack + * @param string|iterable<string> $needles + */ + public static function starts_with( $haystack, $needles ): bool { + if ( ! is_iterable( $needles ) ) { + $needles = [ $needles ]; + } + + foreach ( $needles as $needle ) { + if ( '' !== (string) $needle && str_starts_with( $haystack, $needle ) ) { + return true; + } + } + + return false; + } + + /** + * Convert a value to studly caps case. + * + * @param string $value + * @return string + */ + public static function studly( $value ) { + $key = $value; + + if ( isset( static::$studly_cache[ $key ] ) ) { + return static::$studly_cache[ $key ]; + } + + $words = explode( ' ', static::replace( [ '-', '_' ], ' ', $value ) ); + + $study_words = array_map( fn ( $word) => static::ucfirst( $word ), $words ); + + return static::$studly_cache[ $key ] = implode( '', $study_words ); + } + + /** + * Convert a value to studly caps case while preserving spaces as underscores. + * + * @param string $value Value to studly. + * @return string + */ + public static function studly_underscore( $value ) { + $value = ucwords( str_replace( [ '-', '_' ], ' ', $value ) ); + return str_replace( ' ', '_', $value ); + } + + /** + * Returns the portion of the string specified by the start and length parameters. + * + * @param string $string + * @param int $start + * @param int|null $length + * @param string $encoding + * @return string + */ + public static function substr( $string, $start, $length = null, $encoding = 'UTF-8' ) { + return mb_substr( $string, $start, $length, $encoding ); + } + + /** + * Returns the number of substring occurrences. + * + * @param string $haystack + * @param string $needle + * @param int $offset + * @param int|null $length + */ + public static function substr_count( $haystack, $needle, $offset = 0, $length = null ): int { + if ( ! is_null( $length ) ) { + return substr_count( $haystack, $needle, $offset, $length ); + } + + return substr_count( $haystack, $needle, $offset ); + } + + /** + * Replace text within a portion of a string. + * + * @param string|string[] $string + * @param string|string[] $replace + * @param int|int[] $offset + * @param int|int[]|null $length + * @return string|string[] + */ + public static function substr_replace( $string, $replace, $offset = 0, $length = null ) { + if ( is_null( $length ) ) { + $length = strlen( $string ); + } + + return substr_replace( $string, $replace, $offset, $length ); + } + + /** + * Swap multiple keywords in a string with other keywords. + * + * @param array $map + * @param string $subject + * @return string + */ + public static function swap( array $map, $subject ) { + return strtr( $subject, $map ); + } + + /** + * Make a string's first character lowercase. + * + * @param string $string + * @return string + */ + public static function lcfirst( $string ) { + return static::lower( static::substr( $string, 0, 1 ) ) . static::substr( $string, 1 ); + } + + /** + * Make a string's first character uppercase. + * + * @param string $string + * @return string + */ + public static function ucfirst( $string ) { + return static::upper( static::substr( $string, 0, 1 ) ) . static::substr( $string, 1 ); + } + + /** + * Split a string into pieces by uppercase characters. + * + * @param string $string + * @return string[] + */ + public static function ucsplit( $string ) { + return preg_split( '/(?=\p{Lu})/u', $string, -1, PREG_SPLIT_NO_EMPTY ); + } + + /** + * Get the number of words a string contains. + * + * @param string $string + * @param string|null $characters + * @return int + */ + public static function word_count( $string, $characters = null ) { + return str_word_count( $string, 0, $characters ); + } + + /** + * Generate a UUID (version 4). + */ + public static function uuid(): UuidInterface { + return Uuid::uuid4(); + } + + /** + * Get the line number for a match from a character position. + * + * Useful inside of a regex match to determine the line number of the + * matched pair. + * + * The character position can be retrieved when matching against a string + * by passing `PREG_OFFSET_CAPTURE` to `preg_match_all()` as a flag. + * + * @param string $contents Contents used to match against. + * @param int $char_pos Character position. + */ + public static function line_number( string $contents, int $char_pos ): int { + [ $before ] = str_split( $contents, $char_pos ); + return strlen( $before ) - strlen( str_replace( PHP_EOL, '', $before ) ) + 1; + } + + /** + * Add a trailing slash to a string. + * + * @param string $string String to trail. + */ + public static function trailing_slash( string $string ): string { + return rtrim( $string, '/' ) . '/'; + } + + /** + * Remove a trailing slash from a string. + * + * @param string $string String to untrail. + */ + public static function untrailing_slash( string $string ): string { + return rtrim( $string, '/' ); + } + + /** + * Add a preceding slash to a string. + * + * @param string $string String to proceed. + */ + public static function preceding_slash( string $string ): string { + return '/' . static::unpreceding_slash( $string ); + } + + /** + * Remove a preceding slash from a string. + * + * @param string $string String to proceed. + */ + public static function unpreceding_slash( string $string ): string { + return ltrim( $string, '/\\' ); + } + + /** + * Remove all strings from the casing caches. + */ + public static function flush_cache(): void { + static::$snake_cache = []; + static::$camel_cache = []; + static::$studly_cache = []; + } +} diff --git a/vendor/mantle-framework/support/class-string-replacements.php b/vendor/mantle-framework/support/class-string-replacements.php new file mode 100644 index 00000000..314ddee4 --- /dev/null +++ b/vendor/mantle-framework/support/class-string-replacements.php @@ -0,0 +1,106 @@ +<?php +/** + * String_Replacements class file + * + * @package Mantle + */ + +namespace Mantle\Support; + +/** + * Collects pairs of strings to search and replace. + */ +class String_Replacements { + /** + * Collected strings to search for. + * + * @var array + */ + protected $search = []; + + /** + * Collected strings to replace found search values. + * + * @var array + */ + protected $replace = []; + + /** + * Number of search-replace pairs collected. + * + * @var int + */ + protected $length = 0; + + /** + * Whether only individual strings have been added and thus can be passed to + * \str_replace() as arrays of strings. + * + * @var bool + */ + protected $only_strings = true; + + /** + * Add a search/replace pair. + * + * @param string|string[] $search The value or values being searched for. + * @param string|string[] $replace The value or values that replaces found $search values. + */ + public function add( $search, $replace ): void { + // Allow passing the results of expressions that might not generate different values. + if ( $search === $replace ) { + return; + } + + if ( $this->only_strings && ( ! \is_string( $search ) || ! \is_string( $replace ) ) ) { + $this->only_strings = false; + } + + $this->search[] = $search; + $this->replace[] = $replace; + $this->length++; + } + + /** + * Apply the search/replace pairs to a subject using \str_replace(). + * + * @param string|string[] $subject String or strings to alter. + * @return string|string[] Altered string or strings. + */ + public function replace( $subject ) { + return $this->apply( $subject, '\str_replace' ); + } + + /** + * Apply the search/replace pairs to a subject using \str_ireplace(). + * + * @param string|string[] $subject String or strings to alter. + * @return string|string[] Altered string or strings. + */ + public function ireplace( $subject ) { + return $this->apply( $subject, '\str_ireplace' ); + } + + /** + * Wrapper to apply the \str_*() function to the subject. + * + * @param string|string[] $subject Subject. + * @param callable $callable \str_replace() or \str_ireplace(). + * @return string|string[] Altered string or strings. + */ + private function apply( $subject, callable $callable ) { + if ( ! $this->length ) { + return $subject; + } + + if ( $this->only_strings ) { + return $callable( $this->search, $this->replace, $subject ); + } + + for ( $i = 0; $i < $this->length; $i++ ) { + $subject = $callable( $this->search[ $i ], $this->replace[ $i ], $subject ); + } + + return $subject; + } +} diff --git a/vendor/mantle-framework/support/class-stringable.php b/vendor/mantle-framework/support/class-stringable.php new file mode 100644 index 00000000..010708ee --- /dev/null +++ b/vendor/mantle-framework/support/class-stringable.php @@ -0,0 +1,1193 @@ +<?php +/** + * Stringable class file + * + * @package Mantle + */ + +namespace Mantle\Support; + +use ArrayAccess; +use Closure; +use Carbon\Carbon as Date; +use Mantle\Support\Traits\Conditionable; +use Mantle\Support\Traits\Macroable; +use JsonSerializable; +use Mantle\Support\Traits\Tappable; +use Symfony\Component\VarDumper\VarDumper; + +use function Mantle\Support\Helpers\collect; + +/** + * Stringable Class + * + * Allows for the chaining of string methods. + */ +class Stringable implements ArrayAccess, JsonSerializable, \Stringable { + + use Conditionable, Macroable, Tappable; + + /** + * The underlying string value. + */ + protected string $value = ''; + + /** + * Create a new instance of the class. + * + * @param string $value + * @return void + */ + public function __construct( $value = '' ) { + $this->value = (string) $value; + } + + /** + * Return the remainder of a string after the first occurrence of a given value. + * + * @param string $search + * @return static + */ + public function after( $search ) { + return new static( Str::after( $this->value, $search ) ); + } + + /** + * Return the remainder of a string after the last occurrence of a given value. + * + * @param string $search + * @return static + */ + public function after_last( $search ) { + return new static( Str::after_last( $this->value, $search ) ); + } + + /** + * Append the given values to the string. + * + * @param array<string>|string ...$values + * @return static + */ + public function append( ...$values ) { + return new static( $this->value . implode( '', $values ) ); // @phpstan-ignore-line implode expects array<string> + } + + /** + * Append a new line to the string. + * + * @param int $count + * @return static + */ + public function newLine( $count = 1 ) { + return $this->append( str_repeat( PHP_EOL, $count ) ); + } + + /** + * Transliterate a UTF-8 value to ASCII. + * + * @param string $language + * @return static + */ + public function ascii( $language = 'en' ) { + return new static( Str::ascii( $this->value, $language ) ); + } + + /** + * Get the trailing name component of the path. + * + * @param string $suffix + * @return static + */ + public function basename( $suffix = '' ) { + return new static( basename( $this->value, $suffix ) ); + } + + /** + * Get the character at the specified index. + * + * @param int $index + * @return string|false + */ + public function char_at( $index ) { + return Str::char_at( $this->value, $index ); + } + + /** + * Get the basename of the class path. + * + * @return static + */ + public function class_basename() { + return new static( class_basename( $this->value ) ); + } + + /** + * Get the portion of a string before the first occurrence of a given value. + * + * @param string $search + * @return static + */ + public function before( $search ) { + return new static( Str::before( $this->value, $search ) ); + } + + /** + * Get the portion of a string before the last occurrence of a given value. + * + * @param string $search + * @return static + */ + public function before_last( $search ) { + return new static( Str::before_last( $this->value, $search ) ); + } + + /** + * Get the portion of a string between two given values. + * + * @param string $from + * @param string $to + * @return static + */ + public function between( $from, $to ) { + return new static( Str::between( $this->value, $from, $to ) ); + } + + /** + * Get the smallest possible portion of a string between two given values. + * + * @param string $from + * @param string $to + * @return static + */ + public function between_first( $from, $to ) { + return new static( Str::between_first( $this->value, $from, $to ) ); + } + + /** + * Convert a value to camel case. + * + * @return static + */ + public function camel() { + return new static( Str::camel( $this->value ) ); + } + + /** + * Determine if a given string contains a given substring. + * + * @param string|iterable<string> $needles + * @param bool $ignore_case + * @return bool + */ + public function contains( $needles, bool $ignore_case = false ) { + return Str::contains( $this->value, $needles, $ignore_case ); + } + + /** + * Determine if a given string contains all array values. + * + * @param iterable<string> $needles + * @param bool $ignore_case + * @return bool + */ + public function contains_all( $needles, bool $ignore_case = false ) { + return Str::contains_all( $this->value, $needles, $ignore_case ); + } + + /** + * Get the parent directory's path. + * + * @param int $levels + * @return static + */ + public function dirname( $levels = 1 ) { + return new static( dirname( $this->value, $levels ) ); + } + + /** + * Alias to ends_with(). + * + * @param string|iterable<string> $needles + * @return bool + */ + public function endsWith( $needles ) { + return $this->ends_with( $needles ); + } + + /** + * Determine if a given string ends with a given substring. + * + * @param string|iterable<string> $needles + * @return bool + */ + public function ends_with( $needles ) { + return Str::ends_with( $this->value, $needles ); + } + + /** + * Determine if the string is an exact match with the given value. + * + * @param \Mantle\Support\Stringable|string $value + */ + public function exactly( $value ): bool { + if ( $value instanceof Stringable ) { + $value = $value->toString(); + } + + return $this->value === $value; + } + + /** + * Extracts an excerpt from text that matches the first instance of a phrase. + * + * @param string $phrase + * @param array $options + * @return string|null + */ + public function excerpt( $phrase = '', $options = [] ) { + return Str::excerpt( $this->value, $phrase, $options ); + } + + /** + * Explode the string into an array. + * + * @param string $delimiter + * @param int $limit + * @return \Mantle\Support\Collection<int, string> + */ + public function explode( $delimiter, $limit = PHP_INT_MAX ) { + return collect( explode( $delimiter, $this->value, $limit ) ); + } + + /** + * Split a string using a regular expression or by length. + * + * @param string|int $pattern + * @param int $limit + * @param int $flags + * @return \Mantle\Support\Collection<int, string> + */ + public function split( $pattern, $limit = -1, $flags = 0 ) { + if ( filter_var( $pattern, FILTER_VALIDATE_INT ) !== false ) { + return collect( mb_str_split( $this->value, $pattern ) ); + } + + $segments = preg_split( $pattern, $this->value, $limit, $flags ); + + return ! empty( $segments ) ? collect( $segments ) : collect(); + } + + /** + * Cap a string with a single instance of a given value. + * + * @param string $cap + * @return static + */ + public function finish( $cap ) { + return new static( Str::finish( $this->value, $cap ) ); + } + + /** + * Ensure the string has a single trailing slash. + * + * @return static + */ + public function trailingSlash() { + return new static( Str::trailing_slash( $this->value ) ); + } + + /** + * Remove a trailing slash from the string. + * + * @return static + */ + public function untrailingSlash() { + return new static( Str::untrailing_slash( $this->value ) ); + } + + /** + * Remove a trailing string from the string. + * + * @param string $cap + * @return static + */ + public function untrailing( $cap ) { + return new static( rtrim( $this->value, $cap ) ); + } + + /** + * Determine if a given string matches a given pattern. + * + * @param string|iterable<string> $pattern + * @return bool + */ + public function is( $pattern ) { + return Str::is( $pattern, $this->value ); + } + + /** + * Determine if a given string is 7 bit ASCII. + * + * @return bool + */ + public function is_ascii() { + return Str::is_ascii( $this->value ); + } + + /** + * Determine if a given string is valid JSON. + * + * @return bool + */ + public function is_json() { + return Str::is_json( $this->value ); + } + + /** + * Determine if a given string is a valid UUID. + * + * @return bool + */ + public function is_uuid() { + return Str::is_uuid( $this->value ); + } + + /** + * Determine if the given string is empty. + */ + public function is_empty(): bool { + return '' === $this->value; + } + + /** + * Determine if the given string is not empty. + * + * @return bool + */ + public function is_not_empty() { + return ! $this->is_empty(); + } + + /** + * Convert a string to kebab case. + * + * @return static + */ + public function kebab() { + return new static( Str::kebab( $this->value ) ); + } + + /** + * Return the length of the given string. + * + * @param string|null $encoding + */ + public function length( $encoding = null ): int { + return Str::length( $this->value, $encoding ); + } + + /** + * Limit the number of characters in a string. + * + * @param int $limit + * @param string $end + * @return static + */ + public function limit( $limit = 100, $end = '...' ) { + return new static( Str::limit( $this->value, $limit, $end ) ); + } + + /** + * Convert the given string to lower-case. + * + * @return static + */ + public function lower() { + return new static( Str::lower( $this->value ) ); + } + + /** + * Convert GitHub flavored Markdown into HTML. + * + * @param array $options + * @return static + */ + public function markdown( array $options = [] ) { + return new static( Str::markdown( $this->value, $options ) ); + } + + /** + * Convert inline Markdown into HTML. + * + * @param array $options + * @return static + */ + public function inline_markdown( array $options = [] ) { + return new static( Str::inline_markdown( $this->value, $options ) ); + } + + /** + * Masks a portion of a string with a repeated character. + * + * @param string $character + * @param int $index + * @param int|null $length + * @param string $encoding + * @return static + */ + public function mask( $character, $index, $length = null, $encoding = 'UTF-8' ) { + return new static( Str::mask( $this->value, $character, $index, $length, $encoding ) ); + } + + /** + * Get the string matching the given pattern. + * + * @param string $pattern + * @return static + */ + public function match( $pattern ) { + return new static( Str::match( $pattern, $this->value ) ); + } + + /** + * Determine if a given string matches a given pattern. + * + * @param string|iterable<string> $pattern + * @return bool + */ + public function is_match( $pattern ) { + return Str::is_match( $pattern, $this->value ); + } + + /** + * Get the string matching the given pattern. + * + * @param string $pattern + * @return \Mantle\Support\Collection + */ + public function match_all( $pattern ) { + return Str::match_all( $pattern, $this->value ); + } + + /** + * Determine if the string matches the given pattern. + * + * @param string $pattern + * @return bool + */ + public function test( $pattern ) { + return $this->is_match( $pattern ); + } + + /** + * Pad both sides of the string with another. + * + * @param int $length + * @param string $pad + * @return static + */ + public function pad_both( $length, $pad = ' ' ) { + return new static( Str::pad_both( $this->value, $length, $pad ) ); + } + + /** + * Pad the left side of the string with another. + * + * @param int $length + * @param string $pad + * @return static + */ + public function pad_left( $length, $pad = ' ' ) { + return new static( Str::pad_left( $this->value, $length, $pad ) ); + } + + /** + * Pad the right side of the string with another. + * + * @param int $length + * @param string $pad + * @return static + */ + public function pad_right( $length, $pad = ' ' ) { + return new static( Str::pad_right( $this->value, $length, $pad ) ); + } + + /** + * Parse a Class@method style callback into class and method. + * + * @param string|null $default + * @return array<int, string|null> + */ + public function parse_callback( $default = null ) { + return Str::parse_callback( $this->value, $default ); + } + + /** + * Call the given callback and return a new string. + * + * @param callable $callback + * @return static + */ + public function pipe( callable $callback ) { + return new static( $callback( $this ) ); + } + + /** + * Get the plural form of an English word. + * + * @param int|array|\Countable $count + * @return static + */ + public function plural( $count = 2 ) { + return new static( Str::plural( $this->value, $count ) ); + } + + /** + * Pluralize the last word of an English, studly caps case string. + * + * @param int|array|\Countable $count + * @return static + */ + public function plural_studly( $count = 2 ) { + return new static( Str::plural_studly( $this->value, $count ) ); + } + + /** + * Prepend the given values to the string. + * + * @param string ...$values + * @return static + */ + public function prepend( ...$values ) { + return new static( implode( '', $values ) . $this->value ); + } + + /** + * Remove any occurrence of the given string in the subject. + * + * @param string|iterable<string> $search + * @param bool $case_sensitive + * @return static + */ + public function remove( $search, bool $case_sensitive = true ) { + return new static( Str::remove( $search, $this->value, $case_sensitive ) ); + } + + /** + * Reverse the string. + * + * @return static + */ + public function reverse() { + return new static( Str::reverse( $this->value ) ); + } + + /** + * Repeat the string. + * + * @param int $times + * @return static + */ + public function repeat( int $times ) { + return new static( str_repeat( $this->value, $times ) ); + } + + /** + * Replace the given value in the given string. + * + * @param string|iterable<string> $search + * @param string|iterable<string> $replace + * @param bool $case_sensitive + * @return static + */ + public function replace( $search, $replace, bool $case_sensitive = true ) { + return new static( Str::replace( $search, $replace, $this->value, $case_sensitive ) ); + } + + /** + * Replace a given value in the string sequentially with an array. + * + * @param string $search + * @param iterable<string> $replace + * @return static + */ + public function replace_array( $search, $replace ) { + return new static( Str::replace_array( $search, $replace, $this->value ) ); + } + + /** + * Replace the first occurrence of a given value in the string. + * + * @param string $search + * @param string $replace + * @return static + */ + public function replace_first( $search, $replace ) { + return new static( Str::replace_first( $search, $replace, $this->value ) ); + } + + /** + * Replace the last occurrence of a given value in the string. + * + * @param string $search + * @param string $replace + * @return static + */ + public function replace_last( $search, $replace ) { + return new static( Str::replace_last( $search, $replace, $this->value ) ); + } + + /** + * Replace the patterns matching the given regular expression. + * + * @param string $pattern + * @param \Closure|string $replace + * @param int $limit + * @return static + */ + public function replace_matches( $pattern, $replace, $limit = -1 ) { + if ( $replace instanceof Closure ) { + return new static( preg_replace_callback( $pattern, $replace, $this->value, $limit ) ); + } + + return new static( preg_replace( $pattern, $replace, $this->value, $limit ) ); + } + + /** + * Parse input from a string to a collection, according to a format. + * + * @param string $format + * @return \Mantle\Support\Collection + */ + public function scan( $format ) { + return collect( sscanf( $this->value, $format ) ); + } + + /** + * Remove all "extra" blank space from the given string. + * + * @return static + */ + public function squish() { + return new static( Str::squish( $this->value ) ); + } + + /** + * Begin a string with a single instance of a given value. + * + * @param string $prefix + * @return static + */ + public function start( $prefix ) { + return new static( Str::start( $this->value, $prefix ) ); + } + + /** + * Strip HTML and PHP tags from the given string. + * + * @param array|string $allowed_tags + * @return static + */ + public function strip_tags( array|string $allowed_tags = null ) { + return new static( strip_tags( $this->value, $allowed_tags ) ); // phpcs:ignore WordPressVIPMinimum.Functions.StripTags.StripTagsTwoParameters + } + + /** + * Convert the given string to upper-case. + * + * @return static + */ + public function upper() { + return new static( Str::upper( $this->value ) ); + } + + /** + * Convert the given string to title case. + * + * @return static + */ + public function title() { + return new static( Str::title( $this->value ) ); + } + + /** + * Convert the given string to title case for each word. + * + * @return static + */ + public function headline() { + return new static( Str::headline( $this->value ) ); + } + + /** + * Get the singular form of an English word. + * + * @return static + */ + public function singular() { + return new static( Str::singular( $this->value ) ); + } + + /** + * Generate a URL friendly "slug" from a given string. + * + * @param string $separator + * @param string|null $language + * @param array<string, string> $dictionary + * @return static + */ + public function slug( $separator = '-', $language = 'en', $dictionary = [ '@' => 'at' ] ) { + return new static( Str::slug( $this->value, $separator, $language, $dictionary ) ); + } + + /** + * Convert a string to snake case. + * + * @param string $delimiter + * @return static + */ + public function snake( $delimiter = '_' ) { + return new static( Str::snake( $this->value, $delimiter ) ); + } + + /** + * Determine if a given string starts with a given substring. + * + * @param string|iterable<string> $needles + * @return bool + */ + public function startsWith( $needles ) { + return Str::starts_with( $this->value, $needles ); + } + + /** + * Convert a value to studly caps case. + * + * @return static + */ + public function studly() { + return new static( Str::studly( $this->value ) ); + } + + /** + * Convert a value to studly caps case using underscores. + * + * @return static + */ + public function studlyUnderscore() { + return new static( Str::studly_underscore( $this->value ) ); + } + + /** + * Returns the portion of the string specified by the start and length parameters. + * + * @param int $start + * @param int|null $length + * @param string $encoding + * @return static + */ + public function substr( $start, $length = null, $encoding = 'UTF-8' ) { + return new static( Str::substr( $this->value, $start, $length, $encoding ) ); + } + + /** + * Returns the number of substring occurrences. + * + * @param string $needle + * @param int $offset + * @param int|null $length + */ + public function substr_count( $needle, $offset = 0, $length = null ): int { + return Str::substr_count( $this->value, $needle, $offset, $length ); + } + + /** + * Replace text within a portion of a string. + * + * @param string|string[] $replace + * @param int|int[] $offset + * @param int|int[]|null $length + * @return static + */ + public function substr_replace( $replace, $offset = 0, $length = null ) { + return new static( Str::substr_replace( $this->value, $replace, $offset, $length ) ); + } + + /** + * Swap multiple keywords in a string with other keywords. + * + * @param array $map + * @return static + */ + public function swap( array $map ) { + return new static( strtr( $this->value, $map ) ); + } + + /** + * Trim the string of the given characters. + * + * @param string $characters + * @return static + */ + public function trim( $characters = null ) { + return new static( trim( ...array_merge( [ $this->value ], func_get_args() ) ) ); + } + + /** + * Left trim the string of the given characters. + * + * @param string $characters + * @return static + */ + public function ltrim( $characters = null ) { + return new static( ltrim( ...array_merge( [ $this->value ], func_get_args() ) ) ); + } + + /** + * Right trim the string of the given characters. + * + * @param string $characters + * @return static + */ + public function rtrim( $characters = null ) { + return new static( rtrim( ...array_merge( [ $this->value ], func_get_args() ) ) ); + } + + /** + * Make a string's first character lowercase. + * + * @return static + */ + public function lcfirst() { + return new static( Str::lcfirst( $this->value ) ); + } + + /** + * Make a string's first character uppercase. + * + * @return static + */ + public function ucfirst() { + return new static( Str::ucfirst( $this->value ) ); + } + + /** + * Split a string by uppercase characters. + * + * @return \Mantle\Support\Collection<int, string> + */ + public function ucsplit() { + return collect( Str::ucsplit( $this->value ) ); + } + + /** + * Execute the given callback if the string contains a given substring. + * + * @param string|iterable<string> $needles + * @param callable $callback + * @param callable|null $default + * @return static + */ + public function when_contains( $needles, $callback, $default = null ) { + return $this->when( $this->contains( $needles ), $callback, $default ); + } + + /** + * Execute the given callback if the string contains all array values. + * + * @param array<string> $needles + * @param callable $callback + * @param callable|null $default + * @return static + */ + public function when_contains_all( array $needles, $callback, $default = null ) { + return $this->when( $this->contains_all( $needles ), $callback, $default ); + } + + /** + * Execute the given callback if the string is empty. + * + * @param callable $callback + * @param callable|null $default + * @return static + */ + public function when_empty( $callback, $default = null ) { + return $this->when( $this->is_empty(), $callback, $default ); + } + + /** + * Execute the given callback if the string is not empty. + * + * @param callable $callback + * @param callable|null $default + * @return static + */ + public function when_not_empty( $callback, $default = null ) { + return $this->when( $this->is_not_empty(), $callback, $default ); + } + + /** + * Execute the given callback if the string ends with a given substring. + * + * @param string|iterable<string> $needles + * @param callable $callback + * @param callable|null $default + * @return static + */ + public function when_ends_with( $needles, $callback, $default = null ) { + return $this->when( $this->ends_with( $needles ), $callback, $default ); + } + + /** + * Execute the given callback if the string is an exact match with the given value. + * + * @param string $value + * @param callable $callback + * @param callable|null $default + * @return static + */ + public function when_exactly( $value, $callback, $default = null ) { + return $this->when( $this->exactly( $value ), $callback, $default ); + } + + /** + * Execute the given callback if the string is not an exact match with the given value. + * + * @param string $value + * @param callable $callback + * @param callable|null $default + * @return static + */ + public function when_not_exactly( $value, $callback, $default = null ) { + return $this->when( ! $this->exactly( $value ), $callback, $default ); + } + + /** + * Execute the given callback if the string matches a given pattern. + * + * @param string|iterable<string> $pattern + * @param callable $callback + * @param callable|null $default + * @return static + */ + public function when_is( $pattern, $callback, $default = null ) { + return $this->when( $this->is( $pattern ), $callback, $default ); + } + + /** + * Execute the given callback if the string is 7 bit ASCII. + * + * @param callable $callback + * @param callable|null $default + * @return static + */ + public function when_is_ascii( $callback, $default = null ) { + return $this->when( $this->is_ascii(), $callback, $default ); + } + + /** + * Execute the given callback if the string is a valid UUID. + * + * @param callable $callback + * @param callable|null $default + * @return static + */ + public function when_is_uuid( $callback, $default = null ) { + return $this->when( $this->is_uuid(), $callback, $default ); + } + + /** + * Execute the given callback if the string starts with a given substring. + * + * @param string|iterable<string> $needles + * @param callable $callback + * @param callable|null $default + * @return static + */ + public function when_starts_with( $needles, $callback, $default = null ) { + return $this->when( $this->startsWith( $needles ), $callback, $default ); + } + + /** + * Execute the given callback if the string matches the given pattern. + * + * @param string $pattern + * @param callable $callback + * @param callable|null $default + * @return static + */ + public function when_test( $pattern, $callback, $default = null ) { + return $this->when( $this->test( $pattern ), $callback, $default ); + } + + /** + * Limit the number of words in a string. + * + * @param int $words + * @param string $end + * @return static + */ + public function words( $words = 100, $end = '...' ) { + return new static( Str::words( $this->value, $words, $end ) ); + } + + /** + * Get the number of words a string contains. + * + * @param string|null $characters + * @return int + */ + public function word_count( $characters = null ) { + return Str::word_count( $this->value, $characters ); + } + + /** + * Wrap the string with the given strings. + * + * @param string $before + * @param string|null $after + * @return static + */ + public function wrap( $before, $after = null ) { + return new static( Str::wrap( $this->value, $before, $after ) ); + } + + /** + * Dump the string. + * + * @return $this + */ + public function dump() { + VarDumper::dump( $this->value ); + + return $this; + } + + /** + * Dump the string and end the script. + */ + public function dd(): void { + $this->dump(); + + exit( 1 ); + } + + /** + * Get the underlying string value. + * + * @return string + */ + public function value() { + return $this->toString(); + } + + /** + * Get the underlying string value. + * + * @return string + */ + public function toString() { + return $this->value; + } + + /** + * Get the underlying string value as an integer. + */ + public function to_integer(): int { + return intval( $this->value ); + } + + /** + * Get the underlying string value as a float. + */ + public function to_float(): float { + return floatval( $this->value ); + } + + /** + * Get the underlying string value as a boolean. + * + * Returns true when value is "1", "true", "on", and "yes". Otherwise, returns false. + * + * @return bool + */ + public function to_boolean() { + return filter_var( $this->value, FILTER_VALIDATE_BOOLEAN ); + } + + /** + * Get the underlying string value as a Carbon instance. + * + * @param string|null $format + * @param string|null $tz + * @return \Carbon\Carbon + */ + public function to_date( $format = null, $tz = null ) { + if ( is_null( $format ) ) { + return Date::parse( $this->value, $tz ); + } + + return Date::createFromFormat( $format, $this->value, $tz ); + } + + /** + * Convert the object to a string when JSON encoded. + */ + public function jsonSerialize(): string { + return $this->__toString(); + } + + /** + * Determine if the given offset exists. + * + * @param mixed $offset + */ + public function offsetExists( mixed $offset ): bool { + return isset( $this->value[ $offset ] ); + } + + /** + * Get the value at the given offset. + * + * @param mixed $offset + */ + public function offsetGet( mixed $offset ): string { + return $this->value[ $offset ]; + } + + /** + * Set the value at the given offset. + * + * @param mixed $offset + * @param mixed $value + */ + public function offsetSet( mixed $offset, mixed $value ): void { + $this->value[ $offset ] = $value; + } + + /** + * Unset the value at the given offset. + * + * @param mixed $offset + */ + public function offsetUnset( mixed $offset ): void { + unset( $this->value[ $offset ] ); + } + + /** + * Proxy dynamic properties onto methods. + * + * @param string $key + * @return mixed + */ + public function __get( $key ) { + return $this->{$key}(); + } + + /** + * Get the raw string value. + */ + public function __toString(): string { + return $this->value; + } +} diff --git a/vendor/mantle-framework/support/composer.json b/vendor/mantle-framework/support/composer.json new file mode 100644 index 00000000..0fa4a336 --- /dev/null +++ b/vendor/mantle-framework/support/composer.json @@ -0,0 +1,46 @@ +{ + "name": "mantle-framework/support", + "description": "The Mantle Framework Support Package", + "type": "library", + "require": { + "php": "^8.1", + "alleyinteractive/composer-wordpress-autoloader": "^1.0", + "doctrine/inflector": "^2.0.8", + "league/commonmark": "^2.4.0", + "mantle-framework/contracts": "^1.0", + "monolog/monolog": "^2.9.1", + "nesbot/carbon": "^2.68.1", + "ramsey/uuid": "^4.7.4", + "symfony/finder": "^6.2", + "symfony/var-dumper": "^6.2", + "voku/portable-ascii": "^2.0.1" + }, + "extra": { + "wordpress-autoloader": { + "autoload": { + "Mantle\\Support": "./" + } + } + }, + "autoload": { + "files": [ + "autoload.php" + ] + }, + "license": "GPL-2.0-or-later", + "authors": [ + { + "name": "Alley", + "email": "mantle@alley.com" + } + ], + "config": { + "sort-packages": true + }, + "suggest": { + "mantle-framework/console": "Required to load Mantle Console Commands", + "mantle-framework/container": "Required to use wrapped add_action/add_filter functions", + "vlucas/phpdotenv": "Required to use Environment class (^5.3)" + }, + "minimum-stability": "dev" +} diff --git a/vendor/mantle-framework/support/helpers/helpers-array.php b/vendor/mantle-framework/support/helpers/helpers-array.php new file mode 100644 index 00000000..5c9c5661 --- /dev/null +++ b/vendor/mantle-framework/support/helpers/helpers-array.php @@ -0,0 +1,162 @@ +<?php +/** + * Array helpers + * + * @package Mantle + */ + +namespace Mantle\Support\Helpers; + +use Mantle\Support; + +/** + * Return the default value of the given value. + * + * @param mixed $value Value to check. + * @return mixed + */ +function value( $value ) { + return $value instanceof \Closure ? $value() : $value; +} + +/** + * Get an item from an array or object using "dot" notation. + * + * @param mixed $target Target to get from. + * @param string|array|int|null $key Key to retrieve. + * @param mixed $default Default value. + * @return mixed + */ +function data_get( $target, $key, $default = null ) { + if ( is_null( $key ) ) { + return $target; + } + + $key = is_array( $key ) ? $key : explode( '.', $key ); + + foreach ( $key as $i => $segment ) { + unset( $key[ $i ] ); + + if ( is_null( $segment ) ) { + return $target; + } + + if ( '*' === $segment ) { + if ( $target instanceof \Mantle\Support\Collection ) { + $target = $target->all(); + } elseif ( ! is_array( $target ) ) { + return value( $default ); + } + + $result = []; + + foreach ( $target as $item ) { + $result[] = data_get( $item, $key ); + } + + return in_array( '*', $key ) ? Support\Arr::collapse( $result ) : $result; + } + + if ( Support\Arr::accessible( $target ) && Support\Arr::exists( $target, $segment ) ) { + $target = $target[ $segment ]; + } elseif ( is_object( $target ) && isset( $target->{$segment} ) ) { + $target = $target->{$segment}; + } else { + return value( $default ); + } + } + + return $target; +} + +/** + * Set an item on an array or object using dot notation. + * + * @param mixed $target Array to update. + * @param string|array $key Key to set. + * @param mixed $value Value to set. + * @param bool $overwrite Flag to overwrite the existing value. + * @return mixed + */ +function data_set( &$target, $key, $value, $overwrite = true ) { + $segments = is_array( $key ) ? $key : explode( '.', $key ); + $segment = array_shift( $segments ); + + if ( '*' === $segment ) { + if ( ! Support\Arr::accessible( $target ) ) { + $target = []; + } + + if ( $segments ) { + foreach ( $target as &$inner ) { + data_set( $inner, $segments, $value, $overwrite ); + } + } elseif ( $overwrite ) { + foreach ( $target as &$inner ) { + $inner = $value; + } + } + } elseif ( Support\Arr::accessible( $target ) ) { + if ( $segments ) { + if ( ! Support\Arr::exists( $target, $segment ) ) { + $target[ $segment ] = []; + } + + data_set( $target[ $segment ], $segments, $value, $overwrite ); + } elseif ( $overwrite || ! Support\Arr::exists( $target, $segment ) ) { + $target[ $segment ] = $value; + } + } elseif ( is_object( $target ) ) { + if ( $segments ) { + if ( ! isset( $target->{$segment} ) ) { + $target->{$segment} = []; + } + + data_set( $target->{$segment}, $segments, $value, $overwrite ); + } elseif ( $overwrite || ! isset( $target->{$segment} ) ) { + $target->{$segment} = $value; + } + } else { + $target = []; + + if ( $segments ) { + data_set( $target[ $segment ], $segments, $value, $overwrite ); // @phpstan-ignore-line offset mixed does not exist + } elseif ( $overwrite ) { + $target[ $segment ] = $value; + } + } + + return $target; +} + +/** + * Fill in data where it's missing. + * + * @param mixed $target Subject to fill into. + * @param string|array $key Key(s) to fill. + * @param mixed $value Value with which to fill. + * @return mixed + */ +function data_fill( &$target, $key, $value ) { + return data_set( $target, $key, $value, false ); +} + +/** + * Get the first element of an array. Useful for method chaining. + * + * @param array $array Array from which to get first element. + * @return mixed + */ +function head( $array ) { + return reset( $array ); +} + +/** + * Get the last element from an array. + * + * @param array $array Array from which to get last element. + * @return mixed + */ +function last( $array ) { + return end( $array ); +} diff --git a/vendor/mantle-framework/support/helpers/helpers-core-objects.php b/vendor/mantle-framework/support/helpers/helpers-core-objects.php new file mode 100644 index 00000000..3d28c15d --- /dev/null +++ b/vendor/mantle-framework/support/helpers/helpers-core-objects.php @@ -0,0 +1,112 @@ +<?php +/** + * Nullable Core Objects functions + * + * @package Mantle + */ + +namespace Mantle\Support\Helpers; + +/** + * Nullable wrapper for `get_post()`. + * + * @param int|\WP_Post|null $post Post ID or post object. + * @param string $output Provided for compatibility with the + * `get_post()` signature. + * @param string $filter Type of filter to apply. + * @return null|\WP_Post Post object or null. + */ +function get_post_object( $post = null, string $output = \OBJECT, string $filter = 'raw' ): ?\WP_Post { + $object = \get_post( $post, $output, $filter ); + + return ( $object instanceof \WP_Post ) ? $object : null; +} + +/** + * Nullable wrapper for `get_term()`. + * + * @param int|\WP_Term|object $term Term ID, database object, or term + * object. + * @param string $taxonomy Taxonomy name that $term is part of. + * @param string $output Provided for compatibility with the + * `get_term()` signature. + * @param string $filter Type of filter to apply. + * @return null|\WP_Term Term object or null. + */ +function get_term_object( $term, string $taxonomy = '', string $output = \OBJECT, string $filter = 'raw' ): ?\WP_Term { + $object = \get_term( $term, $taxonomy, $output, $filter ); + + return ( $object instanceof \WP_Term ) ? $object : null; +} + +/** + * Nullable wrapper for `get_term_by()`. + * + * @param string $field Either 'slug', 'name', 'id', or + * 'term_taxonomy_id'. + * @param string|int $value Search for this term value. + * @param string $taxonomy Taxonomy name. Optional, if $field is + * 'term_taxonomy_id'. + * @param string $output Provided for compatibility with the + * `get_term_by()` signature. + * @param string $filter Type of filter to apply. + * @return null|\WP_Term Term object or null. + */ +function get_term_object_by( string $field, $value, string $taxonomy = '', string $output = \OBJECT, string $filter = 'raw' ): ?\WP_Term { + $object = \get_term_by( $field, $value, $taxonomy, $output, $filter ); + + return ( $object instanceof \WP_Term ) ? $object : null; +} + +/** + * Nullable wrapper for `get_comment()`. + * + * @param \WP_Comment|string|int $comment Comment to retrieve. + * @return null|\WP_Comment Comment object or null. + */ +function get_comment_object( $comment ): ?\WP_Comment { + $object = \get_comment( $comment ); + + return ( $object instanceof \WP_Comment ) ? $object : null; +} + +/** + * Nullable wrapper for `get_userdata()`. + * + * @param \WP_User|int $user User ID/object. + * @return null|\WP_User User object or null. + */ +function get_user_object( $user ): ?\WP_User { + if ( $user instanceof \WP_User ) { + return $user; + } + + $object = \get_userdata( (int) $user ); + + return ( $object instanceof \WP_User ) ? $object : null; +} + +/** + * Nullable wrapper for `get_user_by()`. + * + * @param string $field Either 'id', 'ID', 'slug', 'email', or 'login'. + * @param int|string $value Search for this user value. + * @return null|\WP_User User object or null. + */ +function get_user_object_by( string $field, $value ): ?\WP_User { + $object = \get_user_by( $field, $value ); + + return ( $object instanceof \WP_User ) ? $object : null; +} + +/** + * Nullable wrapper for `get_site()`. + * + * @param \WP_Site|int|null $site Site to retrieve. + * @return null|\WP_Site Site object or null. + */ +function get_site_object( $site = null ): ?\WP_Site { + $object = \get_site( $site ); + + return ( $object instanceof \WP_Site ) ? $object : null; +} diff --git a/vendor/mantle-framework/support/helpers/helpers-environment.php b/vendor/mantle-framework/support/helpers/helpers-environment.php new file mode 100644 index 00000000..3cacbf87 --- /dev/null +++ b/vendor/mantle-framework/support/helpers/helpers-environment.php @@ -0,0 +1,22 @@ +<?php +/** + * Environment helpers. + * + * @package Mantle + */ + +namespace Mantle\Support\Helpers; + +/** + * Check if we are on a hosted environment + */ +function is_hosted_env(): bool { + return app()->is_environment( 'production' ); +} + +/** + * Check if the current environment is a local developer environment. + */ +function is_local_env(): bool { + return ! is_hosted_env(); +} diff --git a/vendor/mantle-framework/support/helpers/helpers-general.php b/vendor/mantle-framework/support/helpers/helpers-general.php new file mode 100644 index 00000000..92c511a4 --- /dev/null +++ b/vendor/mantle-framework/support/helpers/helpers-general.php @@ -0,0 +1,521 @@ +<?php +/** + * This file contains assorted helpers + * + * @phpcs:disable Squiz.Commenting.FunctionComment + * + * @package Mantle + */ + +// phpcs:disable Squiz.Commenting.FunctionComment.MissingParamComment + +namespace Mantle\Support\Helpers; + +use Countable; +use Exception; +use Mantle\Container\Container; +use Mantle\Events\Dispatcher; +use Mantle\Support\Collection; +use Mantle\Support\Higher_Order_Tap_Proxy; +use Mantle\Support\Str; + +/** + * Determine if the given value is "blank". + * + * @param mixed $value Value to check. + */ +function blank( $value ): bool { + if ( is_null( $value ) ) { + return true; + } + + if ( is_string( $value ) ) { + return trim( $value ) === ''; + } + + if ( is_numeric( $value ) || is_bool( $value ) ) { + return false; + } + + if ( $value instanceof Countable ) { + return count( $value ) === 0; + } + + return empty( $value ); +} + +/** + * Get the class "basename" of the given object / class. + * + * @param string|object $class Class or object to basename. + */ +function class_basename( string|object $class ): string { + $class = is_object( $class ) ? $class::class : $class; + + return basename( str_replace( '\\', '/', $class ) ); +} + +/** + * Returns all traits used by a class, its parent classes and trait of their traits. + * + * @param object|string $class Class or object to analyze. + */ +function class_uses_recursive( string|object $class ): array { + if ( is_object( $class ) ) { + $class = $class::class; + } + + $results = []; + + foreach ( array_reverse( class_parents( $class ) ) + [ $class => $class ] as $class ) { + $results += trait_uses_recursive( $class ); + } + + return array_unique( $results ); +} + +/** + * Wrap a string in backticks. + * + * @param string $string The string. + * @return string $string The wrapped string. + */ +function backtickit( string $string ): string { + return "`{$string}`"; +} + +/** + * Translate a callable into a readable string. + * + * Many props to Query Monitor's \QM_Util::populate_callback(). + * + * Internals are not subject to semantic-versioning constraints. + * + * @param mixed $callable The plugin callback. + * @return string The readable function name, or an empty string if untranslatable. + */ +function get_callable_fqn( mixed $callable ): string { + $function_name = ''; + + if ( \is_string( $callable ) ) { + $function_name = $callable . '()'; + } + + if ( \is_array( $callable ) ) { + $class = ''; + $access = ''; + + if ( \is_object( $callable[0] ) ) { + $class = $callable[0]::class; + $access = '->'; + } + + if ( \is_string( $callable[0] ) ) { + $class = $callable[0]; + $access = '::'; + } + + if ( $class && $access ) { + $function_name = $class . $access . $callable[1] . '()'; + } + } + + if ( \is_object( $callable ) ) { + $function_name = $callable::class; + + if ( ! ( $callable instanceof \Closure ) ) { + $function_name .= '->__invoke()'; + } + } + + return $function_name; +} + +/** + * Create a collection from the given value. + * + * @template TKey of array-key + * @template TValue + * + * @param \Mantle\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue>|null $value Value to convert to a collection. + * @return \Mantle\Support\Collection<TKey, TValue> + */ +function collect( $value = null ): Collection { + return new Collection( $value ); +} + +/** + * Determine if a value is "filled". + * + * @param mixed $value Value to check. + */ +function filled( mixed $value ): bool { + return ! blank( $value ); +} + +/** + * Get an item from an object using "dot" notation. + * + * @param object $object Object from which to get an item. + * @param string|null $key Key path at which to get the value. + * @param mixed $default Default value to return on failure. + * + * @return mixed + */ +function object_get( $object, $key, $default = null ) { + if ( is_null( $key ) || trim( $key ) == '' ) { + return $object; + } + + foreach ( explode( '.', $key ) as $segment ) { + if ( ! is_object( $object ) || ! isset( $object->{$segment} ) ) { + return value( $default ); + } + + $object = $object->{$segment}; + } + + return $object; +} + +/** + * Replace a given pattern with each value in the array in sequentially. + * + * @param string $pattern Pattern for which to search. + * @param array $replacements Strings in which to replace sequentially. + * @param string $subject Subject in which to search/replace. + * + * @return string + */ +function preg_replace_array( $pattern, array $replacements, $subject ) { + return preg_replace_callback( + $pattern, + function () use ( &$replacements ) { + foreach ( $replacements as $replacement ) { + return array_shift( $replacements ); + } + }, + $subject + ); +} + +/** + * Retry an operation a given number of times. + * + * @param int $times Number of times to retry. + * @param callable $callback Callable to try. + * @param int $sleep Number of milliseconds to sleep between tries. + * @param callable|null $when Callable against which to check the thrown + * exception to determine if a retry should not + * occur. + * + * @return mixed + * @throws \Exception If the callable throws an exception, it is rethrown when + * the retry limit is hit or when `$when` says so. + */ +function retry( $times, callable $callback, $sleep = 0, $when = null ) { + $attempts = 0; + + // phpcs:ignore Generic.PHP.DiscourageGoto.Found + beginning: + $attempts ++; + $times --; + + try { + return $callback( $attempts ); + } catch ( Exception $e ) { + if ( $times < 1 || ( $when && ! $when( $e ) ) ) { + throw $e; + } + + if ( $sleep ) { + usleep( $sleep * 1000 ); + } + + // phpcs:ignore Generic.PHP.DiscourageGoto.Found + goto beginning; + } +} + +/** + * Get a new stringable object from the given string. + * + * @param string|null $string + * @return \Mantle\Support\Stringable|mixed + */ +function str( ?string $string = null ) { + if ( is_null( $string ) ) { + return new class() { + public function __call( $method, $parameters ) { + return Str::$method( ...$parameters ); + } + + public function __toString() { + return ''; + } + }; + } + + return Str::of( $string ); +} + +/** + * Call the given Closure with the given value then return the value. + * + * @param mixed $value Value to provide to the callback and return. + * @param callable|null $callback Callable to tap. + * + * @return mixed + */ +function tap( $value, $callback = null ) { + if ( is_null( $callback ) ) { + return new Higher_Order_Tap_Proxy( $value ); + } + + $callback( $value ); + + return $value; +} + +/** + * Throw the given exception if the given condition is true. + * + * @param mixed $condition Condition to check. + * @param \Throwable|string $exception Exception to throw. + * @param array ...$parameters Params to pass to a new $exception if + * $exception is a string (classname). + * + * @return mixed + * @throws \Throwable `$exception` is thrown if `$condition` is not met. + */ +function throw_if( $condition, $exception, ...$parameters ) { + if ( $condition ) { + throw ( is_string( $exception ) ? new $exception( ...$parameters ) : $exception ); + } + + return $condition; +} + +/** + * Throw the given exception unless the given condition is true. + * + * @param mixed $condition Condition to check. + * @param \Throwable|string $exception Exception to throw. + * @param array ...$parameters Params to pass to a new $exception if + * $exception is a string (classname). + * + * @return mixed + * @throws \Throwable `$exception` is thrown unless `$condition` is not met. + */ +function throw_unless( $condition, $exception, ...$parameters ) { + if ( ! $condition ) { + throw ( is_string( $exception ) ? new $exception( ...$parameters ) : $exception ); + } + + return $condition; +} + +/** + * Returns all traits used by a trait and its traits. + * + * @param string $trait Trait to check. + * + * @return array + */ +function trait_uses_recursive( $trait ) { + $traits = class_uses( $trait ); + + foreach ( $traits as $trait ) { + $traits += trait_uses_recursive( $trait ); + } + + return $traits; +} + +/** + * Transform the given value if it is present. + * + * @param mixed $value Value to check. + * @param callable $callback Callable to pass `$value`. + * @param mixed $default Fallback if `$value` is not filled. May be a + * callable which accepts `$value`, or it may be any + * other value which is returned directly. + * + * @return mixed|null + */ +function transform( $value, callable $callback, $default = null ) { + if ( filled( $value ) ) { + return $callback( $value ); + } + + if ( is_callable( $default ) ) { + return $default( $value ); + } + + return $default; +} + +/** + * Return the given value, optionally passed through the given callback. + * + * @param mixed $value Value to return. + * @param callable|null $callback Callable to pass `$value` through. + * + * @return mixed + */ +function with( $value, callable $callback = null ) { + return is_null( $callback ) ? $value : $callback( $value ); +} + +/** + * Manage the concatenation of class names based on conditions. + * + * A port of the classnames npm package. + * + * @param mixed ...$args Class names to concatenate. + */ +function classname( ...$args ): string { + $classes = []; + + foreach ( $args as $arg ) { + if ( is_string( $arg ) ) { + $classes[] = $arg; + } elseif ( is_array( $arg ) ) { + if ( array_is_list( $arg ) ) { + $classes[] = classname( ...$arg ); + } else { + foreach ( $arg as $key => $value ) { + // If the key is numeric, it's a value. Otherwise, check if it's truthy. + if ( is_int( $key ) ) { + $classes[] = $value; + } elseif ( $value ) { + $classes[] = $key; + } + } + } + } elseif ( is_object( $arg ) ) { + $classes[] = classname( ...class_uses_recursive( $arg ) ); + } elseif ( is_int( $arg ) ) { + $classes[] = (string) $arg; + } elseif ( is_bool( $arg ) ) { + $classes[] = $arg ? 'true' : 'false'; + } + } + + return collect( $classes )->filter()->implode_str( ' ' )->trim(); +} + +/** + * Display the class names based on conditions. + * + * @param mixed ...$args Class names to concatenate. + */ +function the_classnames( ...$args ): void { + echo esc_attr( classname( ...$args ) ); +} + +/** + * Add a WordPress action with type-hint support. + * + * @param string $action Action to listen to. + * @param callable $callback Callback to invoke. + * @param int $priority + */ +function add_action( string $hook, callable $callable, int $priority = 10 ): void { + if ( ! class_exists( Dispatcher::class ) ) { + \add_action( $hook, $callable, $priority, 99 ); + } else { + Container::get_instance()->make( Dispatcher::class )->listen( $hook, $callable, $priority ); + } +} + +/** + * Add a WordPress filter with type-hint support. + * + * @param string $action Action to listen to. + * @param callable $callback Callback to invoke. + * @param int $priority + */ +function add_filter( string $hook, callable $callable, int $priority = 10 ): void { + if ( ! class_exists( Dispatcher::class ) ) { + \add_filter( $hook, $callable, $priority, 99 ); + } else { + Container::get_instance()->make( Dispatcher::class )->listen( $hook, $callable, $priority ); + } +} + +/** + * Dispatch an event and call the listeners. + * + * @param string|object $event Event object. + * @param mixed $payload Event payload. + * @param bool $halt Flag if the event should halt on a returned value. + * @return array|null + */ +function event( ...$args ) { + return Container::get_instance()->make( 'events' )->dispatch( ...$args ); +} + +/** + * Fire a callback if a hook was fired or is being fired. Otherwise, defer the + * callback until the hook was fired. + * + * @param string $hook Hook to check for. + * @param callable $callable Callable to invoke. + * @param int $priority Hook priority. + */ +function hook_callable( string $hook, callable $callable, int $priority = 10 ): void { + if ( ! did_action( $hook ) && ! doing_action( $hook ) ) { + \add_action( $hook, fn () => $callable(), $priority ); + } else { + $callable(); + } +} + +/** + * Validates a file name and path against an allowed set of rules. + * + * A return value of `1` means the file path contains directory traversal. + * + * A return value of `3` means the file is not in the allowed files list. + * + * @see validate_file() in WordPress core. + * + * @param string $file File path. + * @param string[] $allowed_files Optional. Array of allowed files. Default empty array. + * @return int 0 means nothing is wrong, greater than 0 means something was wrong. + */ +function validate_file( $file, $allowed_files = [] ) { + // Proxy back to the core function if it exists, allowing Windows drive paths. + if ( function_exists( 'validate_file' ) ) { + $retval = \validate_file( $file, $allowed_files ); + return in_array( $retval, [ 0, 2 ], true ) ? 0 : $retval; + } + + if ( ! is_scalar( $file ) || '' === $file ) { + return 0; + } + + // `../` on its own is not allowed: + if ( '../' === $file ) { + return 1; + } + + // More than one occurrence of `../` is not allowed. + if ( preg_match_all( '#\.\./#', $file, $matches, PREG_SET_ORDER ) && ( count( $matches ) > 1 ) ) { + return 1; + } + + // `../` which does not occur at the end of the path is not allowed. + if ( str_contains( $file, '../' ) && '../' !== mb_substr( $file, -3, 3 ) ) { + return 1; + } + + // Files not in the allowed file list are not allowed. + if ( ! empty( $allowed_files ) && ! in_array( $file, $allowed_files, true ) ) { + return 3; + } + + // Absolute Windows drive paths ARE allowed. + return 0; +} diff --git a/vendor/mantle-framework/support/helpers/helpers-log.php b/vendor/mantle-framework/support/helpers/helpers-log.php new file mode 100644 index 00000000..f295a3eb --- /dev/null +++ b/vendor/mantle-framework/support/helpers/helpers-log.php @@ -0,0 +1,36 @@ +<?php +/** + * This file contains assorted log helpers. + * + * @package Mantle + */ + +namespace Mantle\Support\Helpers; + +use Psr\Log\LoggerInterface; + +/** + * Write some information to the log. + * + * @param string $message Log message. + * @param array $context Log context. + */ +function info( string $message, array $context = [] ): void { + app( 'log' )->info( $message, $context ); +} + +/** + * Send a message to the logger. + * + * If no parameters are passed, the logger instance is returned. + * + * @param string|null $message Log message, optional. + * @param array $context Log context, optional. + */ +function logger( string $message = null, array $context = [] ): ?LoggerInterface { + if ( is_null( $message ) ) { + return app( 'log' ); + } + + return app( 'log' )->debug( $message, $context ); +} diff --git a/vendor/mantle-framework/support/helpers/helpers-rest-api.php b/vendor/mantle-framework/support/helpers/helpers-rest-api.php new file mode 100644 index 00000000..88f28c09 --- /dev/null +++ b/vendor/mantle-framework/support/helpers/helpers-rest-api.php @@ -0,0 +1,167 @@ +<?php +/** + * REST API schema functions + * + * @package Mantle + */ + +namespace Mantle\Support\Helpers; + +/** + * Eases writing and reading schema with defaults and requirements. + * + * Ensures that all schema have a type, description, context, and default, and + * that the schema keys are ordered consistently. + * + * @throws \BadFunctionCallException For unmet requirements. + * @throws \InvalidArgumentException For incorrect argument types. + * + * @param string|array $description Attribute description or schema array. + * @param array $args Remaining schema definition, if any. + * @return array Completed schema definition. + */ +function fill_rest_schema( $description, array $args = [] ): array { + // Pass a string to use it as the description and get all the defaults. + if ( \is_string( $description ) ) { + $args['description'] = $description; + } + + if ( \is_array( $description ) && ! $args ) { + $args = $description; + } + + $args = \array_merge( + [ + 'context' => [ + 'view', + ], + ], + $args + ); + + if ( empty( $args['description'] ) ) { + throw new \BadFunctionCallException( \__( 'Please supply a description.', 'mantle' ) ); + } + + if ( ! \is_array( $args['context'] ) ) { + /* + * This value is not cast to an array to avoid reinforcing any + * impression that the API supports a string context. + */ + throw new \InvalidArgumentException( + \sprintf( + /* translators: 1: $context, 2: PHP type */ + \__( '%1$s must be of type %2$s', 'mantle' ), + backtickit( '$context' ), + \gettype( [] ) + ) + ); + } + + // 'object' is inferred if properties are referenced. + if ( isset( $args['properties'] ) || isset( $args['additionalProperties'] ) ) { + $args['type'] = 'object'; + } + + // At last, the default. + if ( empty( $args['type'] ) ) { + $args['type'] = 'string'; + } + + $args['default'] = default_from_rest_schema( $args ); + + if ( 'array' === $args['type'] ) { + if ( empty( $args['items'] ) ) { + throw new \BadFunctionCallException( \__( 'Please supply schema for the array items.', 'mantle' ) ); + } + + if ( empty( $args['items']['type'] ) ) { + throw new \BadFunctionCallException( \__( 'Please supply types for the array items.', 'mantle' ) ); + } + } + + if ( 'object' === $args['type'] ) { + if ( empty( $args['properties'] ) ) { + $args['additionalProperties'] = true; + } elseif ( ! isset( $args['additionalProperties'] ) ) { + // 'additionalProperties' must be explicitly allowed if at least one property is declared. + $args['additionalProperties'] = false; + } + } + + /** + * Filters the completed schema definition. + * + * @param array $args The schema definition array. + */ + $args = apply_filters( 'mantle_fill_rest_schema', $args ); + + \ksort( $args ); + + return $args; +} + +/** + * Get a default value for the provided schema's type and properties. + * + * @throws \InvalidArgumentException For unmet requirements. + * + * @param array $schema Schema. + * @return mixed Default based on the schema. + */ +function default_from_rest_schema( array $schema ) { + if ( \array_key_exists( 'default', $schema ) ) { + return $schema['default']; + } + + $default = null; + + if ( empty( $schema['type'] ) ) { + return $default; + } + + if ( \is_array( $schema['type'] ) && \count( $schema['type'] ) > 1 ) { + throw new \InvalidArgumentException( + /* translators: %s: 'default' */ + \__( 'Please supply a `default` for schema with multiple types.', 'mantle' ), + ); + } + + if ( 'string' === $schema['type'] ) { + $default = (string) $default; + } + + if ( 'integer' === $schema['type'] ) { + $default = (int) $default; + } + + if ( 'number' === $schema['type'] ) { + $default = (float) $default; + } + + if ( 'array' === $schema['type'] ) { + $default = (array) $default; + } + + /* + * Objects in the REST API are represented in PHP as associative arrays, + * which are then encoded in JSON as objects. The exception is an object + * with no properties, which must be a PHP object because empty PHP arrays + * are encoded in JSON as arrays. + */ + if ( 'object' === $schema['type'] ) { + $default = (array) $default; + + if ( isset( $schema['properties'] ) && \is_array( $schema['properties'] ) ) { + foreach ( $schema['properties'] as $property => $subschema ) { + $default[ $property ] = default_from_rest_schema( $subschema ); + } + } + + if ( ! $default ) { + $default = (object) $default; + } + } + + return $default; +} diff --git a/vendor/mantle-framework/support/helpers/helpers-validated-hook-removal.php b/vendor/mantle-framework/support/helpers/helpers-validated-hook-removal.php new file mode 100644 index 00000000..8720638b --- /dev/null +++ b/vendor/mantle-framework/support/helpers/helpers-validated-hook-removal.php @@ -0,0 +1,40 @@ +<?php +/** + * Validated hook removal functions + * + * @package Mantle + */ + +namespace Mantle\Support\Helpers; + +/** + * Remove a function from a filter, and trigger a notice if removal fails. + * + * @param mixed ...$args Arguments for {@see remove_filter()}. + * @return bool Whether the function was removed. + */ +function remove_filter_validated( ...$args ) { + $result = \remove_filter( ...$args ); + + if ( false === $result ) { + invalid_hook_removal( $args ); + } + + return $result; +} + +/** + * Remove a function from an action, and trigger a notice if removal fails. + * + * @param mixed ...$args Arguments for {@see remove_action()}. + * @return bool Whether the function was removed. + */ +function remove_action_validated( ...$args ) { + $result = \remove_action( ...$args ); + + if ( false === $result ) { + invalid_hook_removal( $args ); + } + + return $result; +} diff --git a/vendor/mantle-framework/support/helpers/helpers.php b/vendor/mantle-framework/support/helpers/helpers.php new file mode 100644 index 00000000..3a7301fc --- /dev/null +++ b/vendor/mantle-framework/support/helpers/helpers.php @@ -0,0 +1,22 @@ +<?php +/** + * Helper Functions for the Framework + * + * @package Mantle + */ + +namespace Mantle\Support\Helpers; + +// Bail early if the helper functions are already loaded. +if ( function_exists( __NAMESPACE__ . '\invalid_hook_removal' ) ) { + return; +} + +require_once __DIR__ . '/internals.php'; +require_once __DIR__ . '/helpers-array.php'; +require_once __DIR__ . '/helpers-core-objects.php'; +require_once __DIR__ . '/helpers-environment.php'; +require_once __DIR__ . '/helpers-general.php'; +require_once __DIR__ . '/helpers-log.php'; +require_once __DIR__ . '/helpers-rest-api.php'; +require_once __DIR__ . '/helpers-validated-hook-removal.php'; diff --git a/vendor/mantle-framework/support/helpers/internals.php b/vendor/mantle-framework/support/helpers/internals.php new file mode 100644 index 00000000..5d68377d --- /dev/null +++ b/vendor/mantle-framework/support/helpers/internals.php @@ -0,0 +1,51 @@ +<?php +/** + * Internal functions for helpers. + * + * @package Mantle + */ + +namespace Mantle\Support\Helpers; + +/** + * Mark a hook as incorrectly removed. + * + * Internals are not subject to semantic-versioning constraints. + * + * @param array $args Array with the arguments for {@see remove_filter()}. + */ +function invalid_hook_removal( $args ): void { + // PHPCS does not recognize the [ $arg1, $arg2 ] syntax. + [$hook, $callable] = $args; + + $function_name = get_callable_fqn( $callable ); + + if ( $function_name ) { + \_doing_it_wrong( + __FUNCTION__, + \esc_html( + \sprintf( + /* translators: 1: function name, 2: hook name */ + \__( 'Failed to remove "%1$s" from %2$s!', 'mantle' ), + $function_name, + $hook + ) + ), + '', + ); + } + + if ( ! $function_name ) { + \_doing_it_wrong( + __FUNCTION__, + \esc_html( + \sprintf( + /* translators: 1: hook name */ + \__( 'Failed to remove function from %1$s!', 'mantle' ), + $hook + ) + ), + '', + ); + } +} diff --git a/vendor/mantle-framework/support/interface-enumerable.php b/vendor/mantle-framework/support/interface-enumerable.php new file mode 100644 index 00000000..f338d835 --- /dev/null +++ b/vendor/mantle-framework/support/interface-enumerable.php @@ -0,0 +1,987 @@ +<?php +/** + * Enumerable interface file. + * + * @package Mantle + */ + +// phpcs:disable Squiz.Commenting.FunctionComment + +// phpcs:disable Squiz.Commenting.ClassComment.Missing + +namespace Mantle\Support; + +use Countable; +use Mantle\Contracts\Support\Arrayable; +use Mantle\Contracts\Support\Jsonable; +use IteratorAggregate; +use JsonSerializable; + +/** + * Enumerable interface. + * + * @template TKey of array-key + * @template TValue + * + * @extends \Mantle\Contracts\Support\Arrayable<TKey, TValue> + * @extends \IteratorAggregate<TKey, TValue> + */ +interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable, JsonSerializable { + /** + * Create a new collection instance if the value isn't one already. + * + * @template TMakeKey of array-key + * @template TMakeValue + * + * @param \Mantle\Contracts\Support\Arrayable<TMakeKey, TMakeValue>|iterable<TMakeKey, TMakeValue>|null $items + * @return static<TMakeKey, TMakeValue> + */ + public static function make( $items = []); + + /** + * Create a new instance by invoking the callback a given amount of times. + * + * @param int $number + * @param callable|null $callback + * @return static + */ + public static function times( $number, callable $callback = null ); + + /** + * Wrap the given value in a collection if applicable. + * + * @template TWrapValue + * + * @param iterable<array-key, TWrapValue>|TWrapValue $value + * @return static<array-key, TWrapValue> + */ + public static function wrap( $value); + + /** + * Get the underlying items from the given collection if applicable. + * + * @template TUnwrapKey of array-key + * @template TUnwrapValue + * + * @param array<TUnwrapKey, TUnwrapValue>|static<TUnwrapKey, TUnwrapValue> $value + * @return array<TUnwrapKey, TUnwrapValue> + */ + public static function unwrap( $value); + + /** + * Get all items in the enumerable. + * + * @return array + */ + public function all(); + + /** + * Alias for the "avg" method. + * + * @param (callable(TValue): float|int)|string|null $callback + * @return float|int|null + */ + public function average( $callback = null ); + + /** + * Get the median of a given key. + * + * @param string|array<array-key, string>|null $key + * @return float|int|null + */ + public function median( $key = null ); + + /** + * Get the mode of a given key. + * + * @param string|array<array-key, string>|null $key + * @return array<int, float|int>|null + */ + public function mode( $key = null ); + + /** + * Collapse the items into a single enumerable. + * + * @return static<int, mixed> + */ + public function collapse(); + + /** + * Alias for the "contains" method. + * + * @param (callable(TValue, TKey): bool)|TValue|string $key + * @param mixed $operator + * @param mixed $value + * @return bool + */ + public function some( $key, $operator = null, $value = null ); + + /** + * Determine if an item exists, using strict comparison. + * + * @param (callable(TValue, TKey): bool)|TValue|string $key + * @param mixed $value + * @return bool + */ + public function contains_strict( $key, $value = null ); + + /** + * Get the average value of a given key. + * + * @param callable|string|null $callback + * @return mixed + */ + public function avg( $callback = null ); + + /** + * Determine if an item exists in the enumerable. + * + * @param (callable(TValue, TKey): bool)|TValue|string $key + * @param mixed $operator + * @param mixed $value + * @return bool + */ + public function contains( $key, $operator = null, $value = null ); + + /** + * Dump the collection and end the script. + * + * @param mixed ...$args + * @return void + */ + public function dd( ...$args ); + + /** + * Dump the collection. + * + * @return $this + */ + public function dump(); + + /** + * Get the items that are not present in the given items. + * + * @param \Mantle\Contracts\Support\Arrayable<array-key, TValue>|iterable<array-key, TValue> $items + * @return static + */ + public function diff( $items ); + + /** + * Get the items that are not present in the given items, using the callback. + * + * @param \Mantle\Contracts\Support\Arrayable<array-key, TValue>|iterable<array-key, TValue> $items + * @param callable(TValue, TValue): int $callback + * @return static + */ + public function diff_using( $items, callable $callback); + + /** + * Get the items whose keys and values are not present in the given items. + * + * @param \Mantle\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items + * @return static + */ + public function diff_assoc( $items ); + + /** + * Get the items whose keys and values are not present in the given items, using the callback. + * + * @param \Mantle\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items + * @param callable(TValue, TValue): int $callback + * @return static + */ + public function diff_assoc_using( $items, callable $callback); + + /** + * Get the items whose keys are not present in the given items. + * + * @param \Mantle\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items + * @return static + */ + public function diff_keys( $items ); + + /** + * Get the items whose keys are not present in the given items, using the callback. + * + * @param \Mantle\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items + * @param callable $callback + * @return static + */ + public function diff_keys_using( $items, callable $callback); + + /** + * Retrieve duplicate items. + * + * @param (callable(TValue): bool)|string|null $callback + * @param bool $strict + * @return static + */ + public function duplicates( $callback = null, $strict = false ); + + /** + * Retrieve duplicate items using strict comparison. + * + * @param (callable(TValue): bool)|string|null $callback + * @return static + */ + public function duplicates_strict( $callback = null ); + + /** + * Execute a callback over each item. + * + * @param callable(TValue, TKey): mixed $callback + * @return $this + */ + public function each( callable $callback); + + /** + * Execute a callback over each nested chunk of items. + * + * @param callable $callback + * @return static + */ + public function each_spread( callable $callback); + + /** + * Determine if all items pass the given truth test. + * + * @param (callable(TValue, TKey): bool)|TValue|string $key + * @param mixed $operator + * @param mixed $value + * @return bool + */ + public function every( $key, $operator = null, $value = null ); + + /** + * Get all items except for those with the specified keys. + * + * @param \Mantle\Support\Enumerable<array-key, TKey>|array<array-key, TKey> $keys + * @return static + */ + public function except( $keys ); + + /** + * Run a filter over each of the items. + * + * @param (callable(TValue): bool)|null $callback + * @return static + */ + public function filter( callable $callback = null ); + + /** + * Apply the callback if the value is truthy. + * + * @template TWhenParameter + * @template TWhenReturnType + * + * @param (\Closure($this): TWhenParameter)|TWhenParameter $value + * @param (callable($this, TWhenParameter): TWhenReturnType)|null $callback + * @param (callable($this, TWhenParameter): TWhenReturnType)|null $default + * @return static|TWhenReturnType + */ + public function when( $value, callable $callback = null, callable $default = null ); + + /** + * Apply the callback if the collection is empty. + * + * @template TWhenEmptyReturnType + * + * @param (callable($this): TWhenEmptyReturnType) $callback + * @param (callable($this): TWhenEmptyReturnType)|null $default + * @return $this|TWhenEmptyReturnType + */ + public function when_empty( callable $callback, callable $default = null ); + + /** + * Apply the callback if the collection is not empty. + * + * @template TWhenEmptyReturnType + * + * @param (callable($this): TWhenEmptyReturnType) $callback + * @param (callable($this): TWhenEmptyReturnType)|null $default + * @return $this|TWhenEmptyReturnType + */ + public function when_not_empty( callable $callback, callable $default = null ); + + /** + * Apply the callback if the value is falsy. + * + * @template TUnlessParameter + * @template TUnlessReturnType + * + * @param (\Closure( $this): TUnlessParameter)|TUnlessParameter $value + * @param (callable( $this, TUnlessParameter): TUnlessReturnType)|null $callback + * @param (callable( $this, TUnlessParameter): TUnlessReturnType)|null $default + * @return $this|TUnlessReturnType + */ + public function unless( $value, callable $callback = null, callable $default = null ); + + /** + * Apply the callback unless the collection is empty. + * + * @template TUnlessEmptyReturnType + * + * @param callable($this): TUnlessEmptyReturnType $callback + * @param (callable($this): TUnlessEmptyReturnType)|null $default + * @return $this|TUnlessEmptyReturnType + */ + public function unless_empty( callable $callback, callable $default = null ); + + /** + * Apply the callback unless the collection is not empty. + * + * @template TUnlessNotEmptyReturnType + * + * @param callable($this): TUnlessNotEmptyReturnType $callback + * @param (callable($this): TUnlessNotEmptyReturnType)|null $default + * @return $this|TUnlessNotEmptyReturnType + */ + public function unless_not_empty( callable $callback, callable $default = null ); + + /** + * Filter items by the given key value pair. + * + * @param string $key + * @param mixed $operator + * @param mixed $value + * @return static + */ + public function where( $key, $operator = null, $value = null ); + + /** + * Filter items by the given key value pair using strict comparison. + * + * @param string $key + * @param mixed $value + * @return static + */ + public function where_strict( $key, $value); + + /** + * Filter items by the given key value pair. + * + * @param string $key + * @param \Mantle\Contracts\Support\Arrayable|iterable $values + * @param bool $strict + * @return static + */ + public function where_in( $key, $values, $strict = false ); + + /** + * Filter items by the given key value pair using strict comparison. + * + * @param string $key + * @param \Mantle\Contracts\Support\Arrayable|iterable $values + * @return static + */ + public function where_in_strict( $key, $values ); + + /** + * Filter items such that the value of the given key is between the given values. + * + * @param string $key + * @param \Mantle\Contracts\Support\Arrayable|iterable $values + * @return static + */ + public function where_between( $key, $values ); + + /** + * Filter items such that the value of the given key is not between the given values. + * + * @param string $key + * @param \Mantle\Contracts\Support\Arrayable|iterable $values + * @return static + */ + public function where_not_between( $key, $values ); + + /** + * Filter items by the given key value pair. + * + * @param string $key + * @param \Mantle\Contracts\Support\Arrayable|iterable $values + * @param bool $strict + * @return static + */ + public function where_not_in( $key, $values, $strict = false ); + + /** + * Filter items by the given key value pair using strict comparison. + * + * @param string $key + * @param \Mantle\Contracts\Support\Arrayable|iterable $values + * @return static + */ + public function where_not_in_strict( $key, $values ); + + /** + * Filter the items, removing any items that don't match the given type. + * + * @template TWhereInstanceOf + * + * @param class-string<TWhereInstanceOf>|array<array-key, class-string<TWhereInstanceOf>> $type + * @return static<TKey, TWhereInstanceOf> + */ + public function where_instance_of( $type ); + + /** + * Get the first item from the enumerable passing the given truth test. + * + * @template TFirstDefault + * + * @param (callable(TValue,TKey): bool)|null $callback + * @param TFirstDefault|(\Closure(): TFirstDefault) $default + * @return TValue|TFirstDefault + */ + public function first( callable $callback = null, $default = null ); + + /** + * Get the first item by the given key value pair. + * + * @param string $key + * @param mixed $operator + * @param mixed $value + * @return TValue|null + */ + public function first_where( $key, $operator = null, $value = null ); + + /** + * Flip the values with their keys. + * + * @return static<int|string, TKey> + */ + public function flip(); + + /** + * Get an item from the collection by key. + * + * @template TGetDefault + * + * @param TKey $key + * @param TGetDefault|(\Closure(): TGetDefault) $default + * @return TValue|TGetDefault + */ + public function get( $key, $default = null ); + + /** + * Group an associative array by a field or using a callback. + */ + public function group_by( $group_by, $preserve_keys = false ); + + /** + * Key an associative array by a field or using a callback. + * + * @param (callable(TValue, TKey): array-key)|array|string $keyBy + * @return static<array-key, TValue> + */ + public function key_by( $key_by); + + /** + * Determine if an item exists in the collection by key. + * + * @param TKey|array<array-key, TKey> $key + * @return bool + */ + public function has( $key); + + /** + * Concatenate values of a given key as a string. + * + * @param string $value + * @param string|null $glue + * @return string + */ + public function implode( $value, $glue = null ); + + /** + * Intersect the collection with the given items. + * + * @param \Mantle\Contracts\Support\Arrayable|iterable $items + * @return static + */ + public function intersect( $items ); + + /** + * Intersect the collection with the given items by key. + * + * @param \Mantle\Contracts\Support\Arrayable|iterable $items + * @return static + */ + public function intersect_by_keys( $items ); + + /** + * Determine if the collection is empty or not. + * + * @return bool + */ + public function is_empty(); + + /** + * Determine if the collection is not empty. + * + * @return bool + */ + public function is_not_empty(); + + /** + * Join all items from the collection using a string. The final items can use a separate glue string. + * + * @param string $glue + * @param string $final_glue + * @return string + */ + public function join( $glue, $final_glue = ''); + + /** + * Get the keys of the collection items. + * + * @return static + */ + public function keys(); + + /** + * Get the last item from the collection. + * + * @template TLastDefault + * + * @param (callable(TValue, TKey): bool)|null $callback + * @param TLastDefault|(\Closure(): TLastDefault) $default + * @return TValue|TLastDefault + */ + public function last( callable $callback = null, $default = null ); + + /** + * Run a map over each of the items. + * + * @template TMapValue + * + * @param callable(TValue, TKey): TMapValue $callback + * @return static<TKey, TMapValue> + */ + public function map( callable $callback); + + /** + * Run a map over each nested chunk of items. + * + * @param callable $callback + * @return static + */ + public function map_spread( callable $callback); + + /** + * Run a dictionary map over the items. + * + * The callback should return an associative array with a single key/value pair. + * + * @template TMapToDictionaryKey of array-key + * @template TMapToDictionaryValue + * + * @param callable(TValue, TKey): array<TMapToDictionaryKey, TMapToDictionaryValue> $callback + * @return static<TMapToDictionaryKey, array<int, TMapToDictionaryValue>> + */ + public function map_to_dictionary( callable $callback); + + /** + * Run a grouping map over the items. + * + * The callback should return an associative array with a single key/value pair. + */ + public function map_to_groups( callable $callback); + + /** + * Run an associative map over each of the items. + * + * The callback should return an associative array with a single key/value pair. + * + * @template TMapWithKeysKey of array-key + * @template TMapWithKeysValue + * + * @param callable(TValue, TKey): array<TMapWithKeysKey, TMapWithKeysValue> $callback + * @return static<TMapWithKeysKey, TMapWithKeysValue> + */ + public function map_with_keys( callable $callback); + + /** + * Map a collection and flatten the result by a single level. + * + * @template TFlatMapKey of array-key + * @template TFlatMapValue + * + * @param callable(TValue, TKey): (\Illuminate\Support\Collection<TFlatMapKey, TFlatMapValue>|array<TFlatMapKey, TFlatMapValue>) $callback + * @return static<TFlatMapKey, TFlatMapValue> + */ + public function flat_map( callable $callback); + + /** + * Map the values into a new class. + * + * @template TMapIntoValue + * + * @param class-string<TMapIntoValue> $class + * @return static<TKey, TMapIntoValue> + */ + public function map_into( $class ); + + /** + * Merge the collection with the given items. + * + * @param \Mantle\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items + * @return static + */ + public function merge( $items ); + + /** + * Recursively merge the collection with the given items. + * + * @template TMergeRecursiveValue + * + * @param \Mantle\Contracts\Support\Arrayable<TKey, TMergeRecursiveValue>|iterable<TKey, TMergeRecursiveValue> $items + * @return static<TKey, TValue|TMergeRecursiveValue> + */ + public function merge_recursive( $items ); + + /** + * Create a collection by using this collection for keys and another for its values. + * + * @template TCombineValue + * + * @param \Mantle\Contracts\Support\Arrayable<array-key, TCombineValue>|iterable<array-key, TCombineValue> $values + * @return static<TValue, TCombineValue> + */ + public function combine( $values ); + + /** + * Union the collection with the given items. + * + * @param \Mantle\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items + * @return static + */ + public function union( $items ); + + /** + * Get the min value of a given key. + * + * @param (callable(TValue):mixed)|string|null $callback + * @return mixed + */ + public function min( $callback = null ); + + /** + * Get the max value of a given key. + * + * @param (callable(TValue):mixed)|string|null $callback + * @return mixed + */ + public function max( $callback = null ); + + /** + * Create a new collection consisting of every n-th element. + * + * @param int $step + * @param int $offset + * @return static + */ + public function nth( $step, $offset = 0); + + /** + * Get the items with the specified keys. + * + * @param \Mantle\Support\Enumerable<array-key, TKey>|array<array-key, TKey>|string $keys + * @return static + */ + public function only( $keys ); + + /** + * "Paginate" the collection by slicing it into a smaller collection. + * + * @param int $page + * @param int $per_page + * @return static + */ + public function for_page( $page, $per_page); + + /** + * Partition the collection into two arrays using the given callback or key.\ + */ + public function partition( $key, $operator = null, $value = null ); + + /** + * Push all of the given items onto the collection. + * + * @param iterable<array-key, TValue> $source + * @return static + */ + public function concat( $source); + + /** + * Get one or a specified number of items randomly from the collection. + * + * @param int|null $number + * @return static|mixed + * + * @throws \InvalidArgumentException + */ + public function random( $number = null ); + + /** + * Reduce the collection to a single value. + * + * @template TReduceInitial + * @template TReduceReturnType + * + * @param callable(TReduceInitial|TReduceReturnType, TValue, TKey): TReduceReturnType $callback + * @param TReduceInitial $initial + * @return TReduceReturnType + */ + public function reduce( callable $callback, $initial = null ); + + /** + * Replace the collection items with the given items. + * + * @param mixed $items + * @return static + */ + public function replace( $items ); + + /** + * Recursively replace the collection items with the given items. + * + * @param mixed $items + * @return static + */ + public function replace_recursive( $items ); + + /** + * Reverse items order. + * + * @return static + */ + public function reverse(); + + /** + * Search the collection for a given value and return the corresponding key if successful. + * + * @param TValue|callable(TValue,TKey): bool $value + * @param bool $strict + * @return TKey|bool + */ + public function search( $value, $strict = false ); + + /** + * Shuffle the items in the collection. + * + * @param int|null $seed + * @return static + */ + public function shuffle( $seed = null ); + + /** + * Skip the first {$count} items. + * + * @param int $count + * @return static + */ + public function skip( $count); + + /** + * Get a slice of items from the enumerable. + * + * @param int $offset + * @param int|null $length + * @return static + */ + public function slice( $offset, $length = null ); + + /** + * Split a collection into a certain number of groups. + * + * @param int $number_of_groups + * @return static<int, static> + */ + public function split( $number_of_groups ); + + /** + * Chunk the collection into chunks of the given size. + * + * @param int $size + * @return static<int, static> + */ + public function chunk( $size); + + /** + * Sort through each item with a callback. + * + * @param (callable(TValue, TValue): int)|null|int $callback + * @return static + */ + public function sort( $callback = null ); + + /** + * Sort items in descending order. + * + * @param int $options + * @return static + */ + public function sort_desc( $options = SORT_REGULAR); + + /** + * Sort the collection using the given callback. + * + * @param array<array-key, (callable(TValue, TValue): mixed)|(callable(TValue, TKey): mixed)|string|array{string, string}>|(callable(TValue, TKey): mixed)|string $callback + * @param int $options + * @param bool $descending + * @return static + */ + public function sort_by( $callback, $options = SORT_REGULAR, $descending = false ); + + /** + * Sort the collection in descending order using the given callback. + * + * @param array<array-key, (callable(TValue, TValue): mixed)|(callable(TValue, TKey): mixed)|string|array{string, string}>|(callable(TValue, TKey): mixed)|string $callback + * @param int $options + * @return static + */ + public function sort_by_desc( $callback, $options = SORT_REGULAR); + + /** + * Sort the collection keys. + * + * @param int $options + * @param bool $descending + * @return static + */ + public function sort_keys( $options = SORT_REGULAR, $descending = false ); + + /** + * Sort the collection keys in descending order. + * + * @param int $options + * @return static + */ + public function sort_keys_desc( $options = SORT_REGULAR); + + /** + * Get the sum of the given values. + * + * @param (callable(TValue): mixed)|string|null $callback + * @return mixed + */ + public function sum( $callback = null ); + + /** + * Take the first or last {$limit} items. + * + * @param int $limit + * @return static + */ + public function take( $limit); + + /** + * Pass the collection to the given callback and then return it. + * + * @param callable(TValue): mixed $callback + * @return $this + */ + public function tap( callable $callback); + + /** + * Pass the enumerable to the given callback and return the result. + * + * @template TPipeReturnType + * + * @param callable($this): TPipeReturnType $callback + * @return TPipeReturnType + */ + public function pipe( callable $callback); + + /** + * Get the values of a given key. + * + * @param string|array $value + * @param string|null $key + * @return static + */ + public function pluck( $value, $key = null ); + + /** + * Create a collection of all elements that do not pass a given truth test. + * + * @param (callable(TValue, TKey): bool)|bool|TValue $callback + * @return static + */ + public function reject( $callback = true); + + /** + * Return only unique items from the collection array. + * + * @param (callable(TValue, TKey): mixed)|string|null $key + * @param bool $strict + * @return static + */ + public function unique( $key = null, $strict = false ); + + /** + * Return only unique items from the collection array using strict comparison. + * + * @param (callable(TValue, TKey): mixed)|string|null $key + * @return static + */ + public function unique_strict( $key = null ); + + /** + * Reset the keys on the underlying array. + * + * @return static + */ + public function values(); + + /** + * Pad collection to the specified length with a value. + * + * @template TPadValue + * + * @param int $size + * @param TPadValue $value + * @return static<int, TValue|TPadValue> + */ + public function pad( $size, $value); + + /** + * Count the number of items in the collection using a given truth test. + * + * @param (callable(TValue, TKey): array-key)|string|null $countBy + * @return static<array-key, int> + */ + public function count_by( $callback = null ); + + /** + * Collect the values into a collection. + * + * @return \Mantle\Support\Collection<TKey, TValue> + */ + public function collect(); + + /** + * Convert the collection to its string representation. + * + * @return string + */ + public function __toString(); + + /** + * Add a method to the list of proxied methods. + * + * @param string $method + * @return void + */ + public static function proxy( $method); + + /** + * Dynamically access collection proxies. + * + * @param string $key + * @return mixed + * + * @throws \Exception + */ + public function __get( $key); +} diff --git a/vendor/mantle-framework/support/trait-forward-calls.php b/vendor/mantle-framework/support/trait-forward-calls.php new file mode 100644 index 00000000..58bc1445 --- /dev/null +++ b/vendor/mantle-framework/support/trait-forward-calls.php @@ -0,0 +1,65 @@ +<?php +/** + * Forward_Calls trait file. + * + * @package Mantle + */ + +namespace Mantle\Support; + +use BadMethodCallException; +use Error; + +/** + * Trait to forward calls to a method in an object. + */ +trait Forward_Calls { + /** + * Forward a method call to the given object. + * + * @param mixed $object Object to use. + * @param string $method Method to call. + * @param array $parameters Method parameters. + * @return mixed + * + * @throws \BadMethodCallException Thrown on method exception. + * @throws \Error Thrown on method exception. + */ + protected function forward_call_to( $object, $method, $parameters ) { + try { + return $object->{ $method }( ...$parameters ); + } catch ( Error | BadMethodCallException $e ) { + $pattern = '~^Call to undefined method (?P<class>[^:]+)::(?P<method>[^\(]+)\(\)$~'; + + if ( ! preg_match( $pattern, $e->getMessage(), $matches ) ) { + throw $e; + } + + if ( + $object::class !== $matches['class'] + || $matches['method'] != $method + ) { + throw $e; + } + + static::throw_bad_method_call_exception( $method ); + } + } + + /** + * Throw a bad method call exception for the given method. + * + * @param string $method Method name. + * + * @throws \BadMethodCallException Thrown on invalid method call. + */ + protected static function throw_bad_method_call_exception( string $method ): never { + throw new BadMethodCallException( + sprintf( + 'Call to undefined method %s::%s()', + static::class, + $method + ) + ); + } +} diff --git a/vendor/mantle-framework/support/traits/trait-conditionable.php b/vendor/mantle-framework/support/traits/trait-conditionable.php new file mode 100644 index 00000000..dcdc64dd --- /dev/null +++ b/vendor/mantle-framework/support/traits/trait-conditionable.php @@ -0,0 +1,74 @@ +<?php +/** + * Conditionable trait file. + * + * phpcs:disable Squiz.Commenting.FunctionComment + * + * @package Mantle + */ + +namespace Mantle\Support\Traits; + +use Closure; +use Mantle\Support\Higher_Order_When_Proxy; + +/** + * Allow a class to conditionally invoke a method fluently. + * + * A method can use the trait to invoke a method conditionally upon itself. + */ +trait Conditionable { + /** + * Apply the callback if the given "value" is (or resolves to) truthy. + * + * @template TWhenParameter + * @template TWhenReturnType + * + * @param (\Closure($this): TWhenParameter)|TWhenParameter $value + * @param (callable($this, TWhenParameter): TWhenReturnType)|null $callback + * @param (callable($this, TWhenParameter): TWhenReturnType)|null $default + * @return static|TWhenReturnType + */ + public function when( $value, callable $callback = null, callable $default = null ) { + $value = $value instanceof Closure ? $value( $this ) : $value; + + if ( func_num_args() === 1 ) { + return new Higher_Order_When_Proxy( $this, $value ); + } + + if ( $value ) { + return $callback( $this, $value ) ?? $this; + } elseif ( $default ) { + return $default( $this, $value ) ?? $this; + } + + return $this; + } + + /** + * Apply the callback if the given "value" is (or resolves to) falsy. + * + * @template TUnlessParameter + * @template TUnlessReturnType + * + * @param (\Closure( $this): TUnlessParameter)|TUnlessParameter $value + * @param (callable( $this, TUnlessParameter): TUnlessReturnType)|null $callback + * @param (callable( $this, TUnlessParameter): TUnlessReturnType)|null $default + * @return $this|TUnlessReturnType + */ + public function unless( $value, callable $callback = null, callable $default = null ) { + $value = $value instanceof Closure ? $value( $this ) : $value; + + if ( func_num_args() === 1 ) { + return new Higher_Order_When_Proxy( $this, ! $value ); + } + + if ( ! $value ) { + return $callback( $this, $value ) ?? $this; + } elseif ( $default ) { + return $default( $this, $value ) ?? $this; + } + + return $this; + } +} diff --git a/vendor/mantle-framework/support/traits/trait-enumerates-values.php b/vendor/mantle-framework/support/traits/trait-enumerates-values.php new file mode 100644 index 00000000..81bd60fb --- /dev/null +++ b/vendor/mantle-framework/support/traits/trait-enumerates-values.php @@ -0,0 +1,939 @@ +<?php +/** + * Enumerates_Values trait file. + * + * @package Mantle + */ + +// phpcs:disable Squiz.Commenting.FunctionComment.MissingParamComment + +// phpcs:disable Squiz.Commenting.FunctionComment.ParamNameNoMatch + +// phpcs:disable Squiz.Commenting.FunctionComment.MissingParamTag + +namespace Mantle\Support\Traits; + +use Closure; +use Exception; +use Mantle\Contracts\Support\Arrayable; +use Mantle\Contracts\Support\Jsonable; +use function Mantle\Support\Helpers\data_get; +use Mantle\Support\Arr; +use Mantle\Support\Collection; +use Mantle\Support\Enumerable; +use JsonSerializable; +use Mantle\Support\Higher_Order_Collection_Proxy; +use Symfony\Component\VarDumper\VarDumper; +use Traversable; + +/** + * Enumerate_Values trait. + * + * @template TKey of array-key + * @template TValue + * + * @property-read Higher_Order_Collection_Proxy $average + * @property-read Higher_Order_Collection_Proxy $avg + * @property-read Higher_Order_Collection_Proxy $contains + * @property-read Higher_Order_Collection_Proxy $each + * @property-read Higher_Order_Collection_Proxy $every + * @property-read Higher_Order_Collection_Proxy $filter + * @property-read Higher_Order_Collection_Proxy $first + * @property-read Higher_Order_Collection_Proxy $flat_map + * @property-read Higher_Order_Collection_Proxy $group_by + * @property-read Higher_Order_Collection_Proxy $key_by + * @property-read Higher_Order_Collection_Proxy $map + * @property-read Higher_Order_Collection_Proxy $max + * @property-read Higher_Order_Collection_Proxy $min + * @property-read Higher_Order_Collection_Proxy $partition + * @property-read Higher_Order_Collection_Proxy $reject + * @property-read Higher_Order_Collection_Proxy $some + * @property-read Higher_Order_Collection_Proxy $sort_by + * @property-read Higher_Order_Collection_Proxy $sort_by_desc + * @property-read Higher_Order_Collection_Proxy $sum + * @property-read Higher_Order_Collection_Proxy $unique + * @property-read Higher_Order_Collection_Proxy $until + */ +trait Enumerates_Values { + use Conditionable; + + /** + * The methods that can be proxied. + * + * @var array + */ + protected static $proxies = [ + 'average', + 'avg', + 'contains', + 'each', + 'every', + 'filter', + 'first', + 'flat_map', + 'group_by', + 'key_by', + 'map', + 'max', + 'min', + 'partition', + 'reject', + 'skip_until', + 'skip_while', + 'some', + 'sort_by', + 'sort_by_desc', + 'sum', + 'take_until', + 'take_while', + 'unique', + 'until', + ]; + + /** + * Create a new collection instance if the value isn't one already. + * + * @template TMakeKey of array-key + * @template TMakeValue + * + * @param \Mantle\Contracts\Support\Arrayable<TMakeKey, TMakeValue>|iterable<TMakeKey, TMakeValue>|null $items + * @return static<TMakeKey, TMakeValue> + */ + public static function make( $items = [] ) { + return new static( $items ); + } + + /** + * Wrap the given value in a collection if applicable. + * + * @template TWrapValue + * + * @param iterable<array-key, TWrapValue>|TWrapValue $value + * @return static<array-key, TWrapValue> + */ + public static function wrap( $value ) { + return $value instanceof Enumerable + ? new static( $value ) + : new static( Arr::wrap( $value ) ); + } + + /** + * Get the underlying items from the given collection if applicable. + * + * @template TUnwrapKey of array-key + * @template TUnwrapValue + * + * @param array<TUnwrapKey, TUnwrapValue>|static<TUnwrapKey, TUnwrapValue> $value + * @return array<TUnwrapKey, TUnwrapValue> + */ + public static function unwrap( $value ) { + return $value instanceof Enumerable ? $value->all() : $value; + } + + /** + * Alias for the "avg" method. + * + * @param callable|string|null $callback + * @return mixed + */ + public function average( $callback = null ) { + return $this->avg( $callback ); + } + + /** + * Alias for the "contains" method. + * + * @param mixed $key + * @param mixed $operator + * @param mixed $value + * @return bool + */ + public function some( $key, $operator = null, $value = null ) { + return $this->contains( ...func_get_args() ); + } + + /** + * Determine if an item exists, using strict comparison. + * + * @param mixed $key + * @param mixed $value + * @return bool + */ + public function contains_strict( $key, $value = null ) { + if ( func_num_args() === 2 ) { + return $this->contains( + fn ( $item) => data_get( $item, $key ) === $value + ); + } + + if ( $this->use_as_callable( $key ) ) { + return ! is_null( $this->first( $key ) ); + } + + foreach ( $this as $item ) { + if ( $item === $key ) { + return true; + } + } + + return false; + } + + /** + * Dump the items and end the script. + * + * @param mixed ...$args + */ + public function dd( ...$args ): void { + $this->dump( ...$args ); + + exit( 1 ); + } + + /** + * Dump the items. + */ + public function dump(): static { + ( new static( func_get_args() ) ) + ->push( $this->all() ) + ->each( + fn ( $item ) => VarDumper::dump( $item ), + ); + + return $this; + } + + /** + * Execute a callback over each item. + * + * @param callable(TValue, TKey): mixed $callback + * @return $this + */ + public function each( callable $callback ) { + foreach ( $this as $key => $item ) { + if ( $callback( $item, $key ) === false ) { + break; + } + } + + return $this; + } + + /** + * Execute a callback over each nested chunk of items. + * + * @param callable(array<TKey, TValue>): mixed $callback + * @return static + */ + public function each_spread( callable $callback ) { + return $this->each( + function ( $chunk, $key ) use ( $callback ) { + $chunk[] = $key; + + return $callback( ...$chunk ); + } + ); + } + + /** + * Determine if all items pass the given truth test. + * + * @param (callable(TValue, TKey): bool)|TValue|string $key + * @param mixed $operator + * @param mixed $value + * @return bool + */ + public function every( $key, $operator = null, $value = null ) { + if ( func_num_args() === 1 ) { + $callback = $this->value_retriever( $key ); + + foreach ( $this as $k => $v ) { + if ( ! $callback( $v, $k ) ) { + return false; + } + } + + return true; + } + + return $this->every( $this->operator_for_where( ...func_get_args() ) ); + } + + /** + * Get the first item by the given key value pair. + * + * @param string $key + * @param mixed $operator + * @param mixed $value + * @return TValue|null + */ + public function first_where( $key, $operator = null, $value = null ) { + return $this->first( $this->operator_for_where( ...func_get_args() ) ); + } + + /** + * Determine if the collection is not empty. + * + * @return bool + */ + public function is_not_empty() { + return ! $this->is_empty(); + } + + /** + * Run a map over each nested chunk of items. + * + * @template TMapSpreadValue + * + * @param callable(mixed): TMapSpreadValue $callback + * @return static<TKey, TMapSpreadValue> + */ + public function map_spread( callable $callback ) { + return $this->map( + function ( $chunk, $key ) use ( $callback ) { + $chunk[] = $key; + + return $callback( ...$chunk ); + } + ); + } + + /** + * Run a grouping map over the items. + * + * The callback should return an associative array with a single key/value pair. + * + * @template TMapToGroupsKey of array-key + * @template TMapToGroupsValue + * + * @param callable(TValue, TKey): array<TMapToGroupsKey, TMapToGroupsValue> $callback + * @return static<TMapToGroupsKey, static<int, TMapToGroupsValue>> + */ + public function map_to_groups( callable $callback ) { + $groups = $this->map_to_dictionary( $callback ); + + return $groups->map( [ $this, 'make' ] ); + } + + /** + * Map a collection and flatten the result by a single level. + * + * @template TFlatMapKey of array-key + * @template TFlatMapValue + * + * @param callable(TValue, TKey): (\Illuminate\Support\Collection<TFlatMapKey, TFlatMapValue>|array<TFlatMapKey, TFlatMapValue>) $callback + * @return static<TFlatMapKey, TFlatMapValue> + */ + public function flat_map( callable $callback ) { + return $this->map( $callback )->collapse(); + } + + /** + * Map the values into a new class. + * + * @template TMapIntoValue + * + * @param class-string<TMapIntoValue> $class + * @return static<TKey, TMapIntoValue> + */ + public function map_into( $class ) { + return $this->map( + fn ( $value, $key) => new $class( $value, $key ) + ); + } + + /** + * Get the min value of a given key. + * + * @param (callable(TValue):mixed)|string|null $callback + * @return mixed + */ + public function min( $callback = null ) { + $callback = $this->value_retriever( $callback ); + + return $this->map( + fn ( $value) => $callback( $value ) + )->filter( + fn ( $value) => ! is_null( $value ) + )->reduce( + fn ( $result, $value) => is_null( $result ) || $value < $result ? $value : $result + ); + } + + /** + * Get the max value of a given key. + * + * @param (callable(TValue):mixed)|string|null $callback + * @return mixed + */ + public function max( $callback = null ) { + $callback = $this->value_retriever( $callback ); + + return $this->filter( + fn ( $value) => ! is_null( $value ) + )->reduce( + function ( $result, $item ) use ( $callback ) { + $value = $callback( $item ); + + return is_null( $result ) || $value > $result ? $value : $result; + } + ); + } + + /** + * "Paginate" the collection by slicing it into a smaller collection. + * + * @param int $page + * @param int $per_page + * @return static + */ + public function for_page( $page, $per_page ) { + $offset = max( 0, ( $page - 1 ) * $per_page ); + + return $this->slice( $offset, $per_page ); + } + + /** + * Partition the collection into two arrays using the given callback or key. + * + * @param (callable(TValue, TKey): bool)|TValue|string $key + * @param TValue|string|null $operator + * @param TValue|null $value + * @return static<int<0, 1>, static<TKey, TValue>> + */ + public function partition( $key, $operator = null, $value = null ) { + $passed = []; + $failed = []; + + $callback = func_num_args() === 1 + ? $this->value_retriever( $key ) + : $this->operator_for_where( ...func_get_args() ); + + foreach ( $this as $key => $item ) { + if ( $callback( $item, $key ) ) { + $passed[ $key ] = $item; + } else { + $failed[ $key ] = $item; + } + } + + return new static( [ new static( $passed ), new static( $failed ) ] ); + } + + /** + * Get the sum of the given values. + * + * @param (callable(TValue): mixed)|string|null $callback + * @return mixed + */ + public function sum( $callback = null ) { + if ( is_null( $callback ) ) { + $callback = fn ( $value) => $value; + } else { + $callback = $this->value_retriever( $callback ); + } + + return $this->reduce( + fn ( $result, $item) => $result + $callback( $item ), + 0 + ); + } + + /** + * Apply the callback if the collection is empty. + * + * @template TWhenEmptyReturnType + * + * @param (callable( $this): TWhenEmptyReturnType) $callback The callback to apply. + * @param (callable( $this): TWhenEmptyReturnType)|null $default The callback to apply if the collection is not empty. + * @return $this|TWhenEmptyReturnType + */ + public function when_empty( callable $callback, callable $default = null ) { + return $this->when( $this->is_empty(), $callback, $default ); + } + + /** + * Apply the callback if the collection is not empty. + * + * @template TWhenNotEmptyReturnType + * + * @param callable( $this): TWhenNotEmptyReturnType $callback The callback to apply. + * @param (callable( $this): TWhenNotEmptyReturnType)|null $default The callback to apply if the collection is empty. + * @return $this|TWhenNotEmptyReturnType + */ + public function when_not_empty( callable $callback, callable $default = null ) { + return $this->when( $this->is_not_empty(), $callback, $default ); + } + + /** + * Apply the callback unless the collection is empty. + * + * @template TUnlessEmptyReturnType + * + * @param callable( $this): TUnlessEmptyReturnType $callback The callback to apply. + * @param (callable( $this): TUnlessEmptyReturnType)|null $default The callback to apply if the collection is empty. + * @return $this|TUnlessEmptyReturnType + */ + public function unless_empty( callable $callback, callable $default = null ) { + return $this->when_not_empty( $callback, $default ); + } + + /** + * Apply the callback unless the collection is not empty. + * + * @template TUnlessNotEmptyReturnType + * + * @param callable( $this): TUnlessNotEmptyReturnType $callback The callback to apply. + * @param (callable( $this): TUnlessNotEmptyReturnType)|null $default The callback to apply if the collection is not empty. + * @return $this|TUnlessNotEmptyReturnType + */ + public function unless_not_empty( callable $callback, callable $default = null ) { + return $this->when_empty( $callback, $default ); + } + + /** + * Filter items by the given key value pair. + * + * @param string $key + * @param mixed $operator + * @param mixed $value + * @return static + */ + public function where( $key, $operator = null, $value = null ) { + return $this->filter( $this->operator_for_where( ...func_get_args() ) ); + } + + /** + * Filter items where the given key is not null. + * + * @param string|null $key + * @return static + */ + public function where_null( $key = null ) { + return $this->where_strict( $key, null ); + } + + /** + * Filter items where the given key is null. + * + * @param string|null $key + * @return static + */ + public function where_not_null( $key = null ) { + return $this->where( $key, '!==', null ); + } + + /** + * Filter items by the given key value pair using strict comparison. + * + * @param string $key + * @param mixed $value + * @return static + */ + public function where_strict( $key, $value ) { + return $this->where( $key, '===', $value ); + } + + /** + * Filter items by the given key value pair. + * + * @param string $key The key to check. + * @param \Mantle\Contracts\Support\Arrayable|iterable $values Values to search for. + * @param bool $strict Whether to use strict comparison. + * @return static + */ + public function where_in( $key, $values, $strict = false ) { + $values = $this->get_arrayable_items( $values ); + + return $this->filter( + fn ( $item) => in_array( data_get( $item, $key ), $values, $strict ) + ); + } + + /** + * Filter items by the given key value pair using strict comparison. + * + * @param string $key The key to check. + * @param \Mantle\Contracts\Support\Arrayable|iterable $values Values to search for. + * @return static + */ + public function where_in_strict( $key, $values ) { + return $this->where_in( $key, $values, true ); + } + + /** + * Filter items such that the value of the given key is between the given values. + * + * @param string $key The key to check. + * @param \Mantle\Contracts\Support\Arrayable|iterable $values Values to search for. + * @return static + */ + public function where_between( $key, $values ) { + return $this->where( $key, '>=', reset( $values ) )->where( $key, '<=', end( $values ) ); + } + + /** + * Filter items such that the value of the given key is not between the given values. + * + * @param string $key The key to check. + * @param \Mantle\Contracts\Support\Arrayable|iterable $values Values to search against. + * @return static + */ + public function where_not_between( $key, $values ) { + return $this->filter( + fn ( $item) => data_get( $item, $key ) < reset( $values ) || data_get( $item, $key ) > end( $values ) + ); + } + + /** + * Filter items by the given key value pair. + * + * @param string $key The key to check. + * @param \Mantle\Contracts\Support\Arrayable|iterable $values Values to search against. + * @param bool $strict Whether to use strict comparison. + * @return static + */ + public function where_not_in( $key, $values, $strict = false ) { + $values = $this->get_arrayable_items( $values ); + + return $this->reject( + fn ( $item) => in_array( data_get( $item, $key ), $values, $strict ) + ); + } + + /** + * Filter items by the given key value pair using strict comparison. + * + * @param string $key The key to check. + * @param \Mantle\Contracts\Support\Arrayable|iterable $values Values to search against. + * @return static + */ + public function where_not_in_strict( $key, $values ) { + return $this->where_not_in( $key, $values, true ); + } + + /** + * Filter the items, removing any items that don't match the given type. + * + * @template TWhereInstanceOf + * + * @param class-string<TWhereInstanceOf>|array<array-key, class-string<TWhereInstanceOf>> $type + * @return static<TKey, TWhereInstanceOf> + */ + public function where_instance_of( $type ) { + return $this->filter( + fn ( $value ) => $value instanceof $type, + ); + } + + /** + * Pass the collection to the given callback and return the result. + * + * @template TPipeReturnType + * + * @param callable( $this): TPipeReturnType $callback The callback to pass the collection to. + * @return TPipeReturnType + */ + public function pipe( callable $callback ) { + return $callback( $this ); + } + + /** + * Pass the collection to the given callback and then return it. + * + * @param callable( $this): mixed $callback The callback to pass the collection to. + * @return $this + */ + public function tap( callable $callback ) { + $callback( clone $this ); + + return $this; + } + + /** + * Create a collection of all elements that do not pass a given truth test. + * + * @param callable|mixed $callback + * @return static + */ + public function reject( $callback = true ) { + $use_as_callable = $this->use_as_callable( $callback ); + + return $this->filter( + fn ( $value, $key) => $use_as_callable + ? ! $callback( $value, $key ) + : $value != $callback + ); + } + + /** + * Return only unique items from the collection array. + * + * @param (callable(TValue, TKey): mixed)|string|null $key + * @param bool $strict + * @return static + */ + public function unique( $key = null, $strict = false ) { + $callback = $this->value_retriever( $key ); + + $exists = []; + + return $this->reject( + function ( $item, $key ) use ( $callback, $strict, &$exists ) { + $id = $callback( $item, $key ); + if ( in_array( $id, $exists, $strict ) ) { + return true; + } + + $exists[] = $id; + } + ); + } + + /** + * Return only unique items from the collection array using strict comparison. + * + * @param (callable(TValue, TKey): mixed)|string|null $key + * @return static + */ + public function unique_strict( $key = null ) { + return $this->unique( $key, true ); + } + + /** + * Collect the values into a collection. + * + * @return \Mantle\Support\Collection<TKey, TValue> + */ + public function collect() { + return new Collection( $this->all() ); + } + + /** + * Get the collection of items as a plain array. + * + * @return array<TKey, TValue> + */ + public function to_array() { + return $this->map( + fn ( $value ) => $value instanceof Arrayable ? $value->to_array() : $value, + )->all(); + } + + /** + * Alias for the "to_array" method. + * + * @return array<TKey, TValue> + */ + public function toArray() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid + return $this->to_array(); + } + + /** + * Convert the object into something JSON serializable. + * + * @return array<TKey, TValue> + */ + public function jsonSerialize(): mixed { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid + return array_map( + function ( $value ) { + if ( $value instanceof JsonSerializable ) { + return $value->jsonSerialize(); + } elseif ( $value instanceof Jsonable ) { + return json_decode( $value->to_json(), true ); + } elseif ( $value instanceof Arrayable ) { + return $value->to_array(); + } + + return $value; + }, + $this->all() + ); + } + + /** + * Get the collection of items as JSON. + * + * @param int $options + * @return string + */ + public function to_json( $options = 0 ) { + return json_encode( $this->jsonSerialize(), $options ); // phpcs:ignore WordPress.WP.AlternativeFunctions.json_encode_json_encode + } + + /** + * Count the number of items in the collection using a given truth test. + * + * @param callable|null $callback + * @return static + */ + public function count_by( $callback = null ) { + if ( is_null( $callback ) ) { + $callback = fn ( $value) => $value; + } + + return new static( + $this->group_by( $callback )->map( + fn ( $value) => $value->count() + ) + ); + } + + /** + * Convert the collection to its string representation. + * + * @return string + */ + public function __toString() { + return $this->to_json(); + } + + /** + * Add a method to the list of proxied methods. + * + * @param string $method + */ + public static function proxy( $method ): void { + static::$proxies[] = $method; // phpcs:ignore WordPressVIPMinimum.Variables.VariableAnalysis.StaticOutsideClass + } + + /** + * Dynamically access collection proxies. + * + * @param string $key + * @return mixed + * + * @throws \Exception Throw on nonexistent property keys. + */ + public function __get( $key ) { + if ( ! in_array( $key, static::$proxies ) ) { // phpcs:ignore WordPressVIPMinimum.Variables.VariableAnalysis.StaticOutsideClass + throw new Exception( "Property [{$key}] does not exist on this collection instance." ); + } + + return new Higher_Order_Collection_Proxy( $this, $key ); + } + + /** + * Results array of items from Collection or Arrayable. + * + * @param mixed $items + * @return array<TKey, TValue> + */ + protected function get_arrayable_items( $items ) { + if ( is_array( $items ) ) { + return $items; + } elseif ( $items instanceof Enumerable ) { + return $items->all(); + } elseif ( $items instanceof Arrayable ) { + return $items->to_array(); + } elseif ( $items instanceof Jsonable ) { + return json_decode( $items->to_json(), true ); + } elseif ( $items instanceof JsonSerializable ) { + return (array) $items->jsonSerialize(); + } elseif ( $items instanceof Traversable ) { + return iterator_to_array( $items ); + } + + return (array) $items; + } + + /** + * Get an operator checker callback. + * + * @param string $key + * @param string|null $operator + * @param mixed $value + * @return \Closure + */ + protected function operator_for_where( $key, $operator = null, $value = null ) { + if ( func_num_args() === 1 ) { + $value = true; + + $operator = '='; + } + + if ( func_num_args() === 2 ) { + $value = $operator; + + $operator = '='; + } + + return function ( $item ) use ( $key, $operator, $value ) { + $retrieved = data_get( $item, $key ); + + $strings = array_filter( + [ $retrieved, $value ], + fn ( $value) => is_string( $value ) || ( is_object( $value ) && method_exists( $value, '__toString' ) ) + ); + + if ( count( $strings ) < 2 && count( array_filter( [ $retrieved, $value ], 'is_object' ) ) == 1 ) { + return in_array( $operator, [ '!=', '<>', '!==' ] ); + } + + switch ( $operator ) { + default: + case '=': + case '==': + return $retrieved == $value; + case '!=': + case '<>': + return $retrieved != $value; + case '<': + return $retrieved < $value; + case '>': + return $retrieved > $value; + case '<=': + return $retrieved <= $value; + case '>=': + return $retrieved >= $value; + case '===': + return $retrieved === $value; + case '!==': + return $retrieved !== $value; + } + }; + } + + /** + * Determine if the given value is callable, but not a string. + * + * @param mixed $value + */ + protected function use_as_callable( $value ): bool { + return ! is_string( $value ) && is_callable( $value ); + } + + /** + * Get a value retrieving callback. + * + * @param callable|string|null $value + * @return callable + */ + protected function value_retriever( $value ) { + if ( $this->use_as_callable( $value ) ) { + return $value; + } + + return fn ( $item ) => data_get( $item, $value ); + } + + /** + * Make a function to check an item's equality. + * + * @param mixed $value + * @return \Closure + */ + protected function equality( $value ) { + return fn ( $item ) => $item === $value; + } + + /** + * Make a function using another function, by negating its result. + * + * @param \Closure $callback + * @return \Closure + */ + protected function negate( Closure $callback ) { + return fn ( ...$params ) => ! $callback( ...$params ); + } +} diff --git a/vendor/mantle-framework/support/traits/trait-hookable.php b/vendor/mantle-framework/support/traits/trait-hookable.php new file mode 100644 index 00000000..7255cf63 --- /dev/null +++ b/vendor/mantle-framework/support/traits/trait-hookable.php @@ -0,0 +1,153 @@ +<?php +/** + * Hookable trait file + * + * @package Mantle + */ + +namespace Mantle\Support\Traits; + +use Mantle\Support\Attributes\Action; +use Mantle\Support\Attributes\Filter; +use Mantle\Support\Collection; +use Mantle\Support\Service_Provider; +use Mantle\Support\Str; +use ReflectionClass; + +use function Mantle\Support\Helpers\collect; + +/** + * Register all hooks on a class. + * + * Collects all of the `on_{hook}` and `on_{hook}_at_{priority}` methods as + * well as the attribute based `#[Action]` methods and registers them with + * the respective WordPress hooks. + */ +trait Hookable { + /** + * Boot all actions and attribute methods on the service provider. + * + * Collects all of the `on_{hook}`, `on_{hook}_at_{priority}`, + * `action__{hook}`, and `filter__{hook}` methods as well as the attribute + * based `#[Action]` and `#[Filter]` methods and registers them with the + * respective WordPress hooks. + */ + protected function register_hooks(): void { + $this->collect_action_methods() + ->merge( $this->collect_attribute_hooks() ) + ->unique() + ->each( + function ( array $item ): void { + if ( $this->use_event_dispatcher() ) { + if ( 'action' === $item['type'] ) { + \Mantle\Support\Helpers\add_action( $item['hook'], [ $this, $item['method'] ], $item['priority'] ); + } else { + \Mantle\Support\Helpers\add_filter( $item['hook'], [ $this, $item['method'] ], $item['priority'] ); + } + } else { + // Use the default WordPress action/filter methods. + if ( 'action' === $item['type'] ) { + \add_action( $item['hook'], [ $this, $item['method'] ], $item['priority'], 999 ); + } else { + \add_filter( $item['hook'], [ $this, $item['method'] ], $item['priority'], 999 ); + } + } + }, + ); + } + + /** + * Collect all action methods from the service provider. + * + * @return Collection<int, array{type: string, hook: string, method: string, priority: int}> + */ + protected function collect_action_methods(): Collection { + return collect( get_class_methods( static::class ) ) + ->filter( + fn ( string $method ) => Str::starts_with( $method, [ 'on_', 'action__', 'filter__' ] ) + ) + ->map( + function( string $method ) { + $type = match ( true ) { + Str::starts_with( $method, 'filter__' ) => 'filter', + default => 'action', + }; + + $hook = match ( true ) { + Str::starts_with( $method, 'on_' ) => Str::after( $method, 'on_' ), + default => Str::after( $method, $type . '__' ), + }; + + $priority = 10; + + if ( Str::contains( $hook, '_at_' ) ) { + // Strip the priority from the hook name. + $priority = (int) Str::after_last( $hook, '_at_' ); + $hook = Str::before_last( $hook, '_at_' ); + } + + return [ + 'type' => $type, + 'hook' => $hook, + 'method' => $method, + 'priority' => $priority, + ]; + } + ); + } + + /** + * Collect all attribute actions on the service provider. + * + * Allow methods with the `#[Action]` attribute to automatically register + * WordPress hooks. + * + * @return Collection<int, array{type: string, hook: string, method: string, priority: int}> + */ + protected function collect_attribute_hooks(): Collection { + $items = new Collection(); + $class = new ReflectionClass( static::class ); + + foreach ( $class->getMethods() as $method ) { + foreach ( $method->getAttributes( Action::class ) as $attribute ) { + $instance = $attribute->newInstance(); + + $items->push( + [ + 'type' => 'action', + 'hook' => $instance->hook_name, + 'method' => $method->getName(), + 'priority' => $instance->priority, + ] + ); + } + + foreach ( $method->getAttributes( Filter::class ) as $attribute ) { + $instance = $attribute->newInstance(); + + $items->push( + [ + 'type' => 'filter', + 'hook' => $instance->hook_name, + 'method' => $method->getName(), + 'priority' => $instance->priority, + ] + ); + } + } + + return $items; + } + + /** + * Determine if the service provider should use the event dispatcher or the + * core WordPress hooks. + * + * By default, it is only enabled if the class is an instance of the + * `Service_Provider` class. For external uses of this trait, the event + * dispatcher won't be used. + */ + public function use_event_dispatcher(): bool { + return class_exists( Service_Provider::class ) && $this instanceof Service_Provider; + } +} diff --git a/vendor/mantle-framework/support/traits/trait-loads-classes.php b/vendor/mantle-framework/support/traits/trait-loads-classes.php new file mode 100644 index 00000000..54705ed9 --- /dev/null +++ b/vendor/mantle-framework/support/traits/trait-loads-classes.php @@ -0,0 +1,60 @@ +<?php +/** + * Loads_Classes trait file. + * + * @package Mantle + */ + +namespace Mantle\Support\Traits; + +use Mantle\Filesystem\Filesystem; +use Symfony\Component\Finder\Finder; +use Symfony\Component\Finder\SplFileInfo; +use function Mantle\Support\Helpers\collect; + +/** + * Trait for loading classes + */ +trait Loads_Classes { + /** + * Retrieves expected classes from a folder in a respective namespace. + * + * @param string $path Path to load. + * @param string $root_namespace Root namespace for the files. + * @return string[] + */ + public static function classes_from_path( string $path, string $root_namespace ): array { + $classes = []; + + foreach ( ( new Finder() )->name( '*.php' )->in( $path ) as $file ) { + $class = static::classname_from_path( $file, $root_namespace ); + + if ( $class ) { + $classes[] = $class; + } + } + + return $classes; + } + + /** + * Retrieve the class name from a file. + * + * @param SplFileInfo $file File instance. + * @param string $root_namespace Root namespace. + */ + public static function classname_from_path( SplFileInfo $file, string $root_namespace ): ?string { + // Append the relative path as a namespace to the root namespace. + if ( $relative_path = $file->getRelativePath() ) { + $root_namespace .= '\\' . str_replace( '/', '\\', $relative_path ); + } + + $class_name = $root_namespace . '\\' . ( new Filesystem() )->guess_class_name( $file->getRealPath() ); + + if ( class_exists( $class_name ) ) { + return $class_name; + } + + return null; + } +} diff --git a/vendor/mantle-framework/support/traits/trait-macroable.php b/vendor/mantle-framework/support/traits/trait-macroable.php new file mode 100644 index 00000000..5fbd9d52 --- /dev/null +++ b/vendor/mantle-framework/support/traits/trait-macroable.php @@ -0,0 +1,120 @@ +<?php +/** + * Macroable class file. + * + * @package Mantle + */ + +// phpcs:disable Squiz.Commenting.FunctionComment.MissingParamComment +// phpcs:ignoreFile: WordPressVIPMinimum.Variables.VariableAnalysis.StaticInsideClosure + +namespace Mantle\Support\Traits; + +use BadMethodCallException; +use Closure; +use ReflectionClass; +use ReflectionMethod; + +trait Macroable { + /** + * The registered string macros. + * + * @var array + */ + protected static $macros = []; + + /** + * Register a custom macro. + * + * @param string $name + * @param object|callable $macro + */ + public static function macro( $name, $macro ): void { + static::$macros[ $name ] = $macro; + } + + /** + * Mix another object into the class. + * + * @param object $mixin + * @param bool $replace + * + * + * @throws \ReflectionException + */ + public static function mixin( $mixin, $replace = true ): void { + $methods = ( new ReflectionClass( $mixin ) )->getMethods( + ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED + ); + + foreach ( $methods as $method ) { + if ( $replace || ! static::has_macro( $method->name ) ) { + $method->setAccessible( true ); + static::macro( $method->name, $method->invoke( $mixin ) ); + } + } + } + + /** + * Checks if macro is registered. + * + * @param string $name + * + * @return bool + */ + public static function has_macro( $name ) { + return isset( static::$macros[ $name ] ); + } + + /** + * Dynamically handle calls to the class. + * + * @param string $method + * @param array $parameters + * + * @return mixed + * + * @throws \BadMethodCallException + */ + public static function __callStatic( $method, $parameters ) { + if ( ! static::has_macro( $method ) ) { + throw new BadMethodCallException( sprintf( + 'Method %s::%s does not exist.', static::class, $method + ) ); + } + + $macro = static::$macros[ $method ]; + + if ( $macro instanceof Closure ) { + return call_user_func_array( Closure::bind( $macro, null, static::class ), $parameters ); + } + + return $macro( ...$parameters ); + } + + /** + * Dynamically handle calls to the class. + * + * @param string $method + * @param array $parameters + * + * @return mixed + * + * @throws \BadMethodCallException + */ + public function __call( $method, $parameters ) { + if ( ! static::has_macro( $method ) ) { + throw new BadMethodCallException( sprintf( + 'Method %s::%s does not exist.', static::class, $method + ) ); + } + + $macro = static::$macros[ $method ]; + + if ( $macro instanceof Closure ) { + return call_user_func_array( $macro->bindTo( $this, static::class ), $parameters ); + } + + return $macro( ...$parameters ); + } +} diff --git a/vendor/mantle-framework/support/traits/trait-makeable.php b/vendor/mantle-framework/support/traits/trait-makeable.php new file mode 100644 index 00000000..4f66302e --- /dev/null +++ b/vendor/mantle-framework/support/traits/trait-makeable.php @@ -0,0 +1,20 @@ +<?php +/** + * Makeable trait file. + * + * @package Mantle + */ + +namespace Mantle\Support\Traits; + +trait Makeable { + /** + * Create a new static instance from arguments. + * + * @param mixed ...$arguments Arguments to make from. + * @return static + */ + public static function make( ...$arguments ) { + return new static( ...$arguments ); + } +} diff --git a/vendor/mantle-framework/support/traits/trait-singleton.php b/vendor/mantle-framework/support/traits/trait-singleton.php new file mode 100644 index 00000000..68f0360e --- /dev/null +++ b/vendor/mantle-framework/support/traits/trait-singleton.php @@ -0,0 +1,35 @@ +<?php +/** + * Singleton trait file + * + * @package Mantle + */ + +namespace Mantle\Support\Traits; + +/** + * Make a class into a singleton. + */ +trait Singleton { + /** + * Existing instances. + * + * @var array + */ + protected static $instances = []; + + /** + * Get class instance. + * + * @return static + */ + public static function instance() { + $class = static::class; + + if ( ! isset( static::$instances[ $class ] ) ) { + static::$instances[ $class ] = new static(); + } + + return self::$instances[ $class ]; + } +} diff --git a/vendor/mantle-framework/support/traits/trait-tappable.php b/vendor/mantle-framework/support/traits/trait-tappable.php new file mode 100644 index 00000000..cfd0afa4 --- /dev/null +++ b/vendor/mantle-framework/support/traits/trait-tappable.php @@ -0,0 +1,25 @@ +<?php +/** + * Tappable trait. + * + * @package Mantle + */ + +namespace Mantle\Support\Traits; + +use function Mantle\Support\Helpers\tap; + +/** + * Tappable Trait. + */ +trait Tappable { + /** + * Call the given Closure with this instance then return the instance. + * + * @param callable|null $callback + * @return $this|\Mantle\Support\Higher_Order_Tap_Proxy + */ + public function tap( $callback = null ) { + return tap( $this, $callback ); + } +} diff --git a/vendor/mantle-framework/testing/LICENSE b/vendor/mantle-framework/testing/LICENSE new file mode 100644 index 00000000..d159169d --- /dev/null +++ b/vendor/mantle-framework/testing/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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. + + <signature of Ty Coon>, 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/vendor/mantle-framework/testing/attributes/class-acting-as.php b/vendor/mantle-framework/testing/attributes/class-acting-as.php new file mode 100644 index 00000000..06e51852 --- /dev/null +++ b/vendor/mantle-framework/testing/attributes/class-acting-as.php @@ -0,0 +1,27 @@ +<?php +/** + * Acting_As class file + * + * @package Mantle + */ + +namespace Mantle\Testing\Attributes; + +use Attribute; +use Mantle\Database\Model\User; +use WP_User; + +/** + * Acting As + * + * Used to authenticate a test suite/case as a specific user/role. + */ +#[Attribute] +class Acting_As { + /** + * Constructor. + * + * @param User|WP_User|string|int|null $user User to act as. + */ + public function __construct( public User|WP_User|string|int|null $user ) {} +} diff --git a/vendor/mantle-framework/testing/attributes/class-expected-deprecation.php b/vendor/mantle-framework/testing/attributes/class-expected-deprecation.php new file mode 100644 index 00000000..18a19023 --- /dev/null +++ b/vendor/mantle-framework/testing/attributes/class-expected-deprecation.php @@ -0,0 +1,25 @@ +<?php +/** + * Expected_Deprecation class file + * + * @package Mantle + */ + +namespace Mantle\Testing\Attributes; + +use Attribute; + +/** + * Expected Deprecation + * + * Used to mark a test as expecting a deprecation notice. + */ +#[Attribute] +class Expected_Deprecation { + /** + * Constructor. + * + * @param string $deprecation The expected deprecation method. + */ + public function __construct( public string $deprecation ) {} +} diff --git a/vendor/mantle-framework/testing/attributes/class-expected-incorrect-usage.php b/vendor/mantle-framework/testing/attributes/class-expected-incorrect-usage.php new file mode 100644 index 00000000..a3959c23 --- /dev/null +++ b/vendor/mantle-framework/testing/attributes/class-expected-incorrect-usage.php @@ -0,0 +1,27 @@ +<?php +/** + * Expected_Incorrect_Usage class file + * + * @package Mantle + */ + +namespace Mantle\Testing\Attributes; + +use Attribute; + +/** + * Expected Incorrect Usage + * + * Used to mark a test as expecting a specific doing it wrong call. Supports * as a wildcard. + */ +#[Attribute] +class Expected_Incorrect_Usage { + /** + * Constructor. + * + * @param string $name Name of the function, method, or class that appears in + * the first argument of the source `_doing_it_wrong()` + * call. Supports * as a wildcard. + */ + public function __construct( public string $name = '*' ) {} +} diff --git a/vendor/mantle-framework/testing/attributes/class-ignore-deprecation.php b/vendor/mantle-framework/testing/attributes/class-ignore-deprecation.php new file mode 100644 index 00000000..41abeea4 --- /dev/null +++ b/vendor/mantle-framework/testing/attributes/class-ignore-deprecation.php @@ -0,0 +1,25 @@ +<?php +/** + * Ignore_Deprecation class file + * + * @package Mantle + */ + +namespace Mantle\Testing\Attributes; + +use Attribute; + +/** + * Ignore Deprecation + * + * Used to mark a test as ignoring a specific deprecation notice. Supports * as a wildcard. + */ +#[Attribute] +class Ignore_Deprecation { + /** + * Constructor. + * + * @param string $deprecation The expected deprecation to ignore. Defaults to all deprecations. + */ + public function __construct( public string $deprecation = '*' ) {} +} diff --git a/vendor/mantle-framework/testing/attributes/class-ignore-incorrect-usage.php b/vendor/mantle-framework/testing/attributes/class-ignore-incorrect-usage.php new file mode 100644 index 00000000..fd137ae9 --- /dev/null +++ b/vendor/mantle-framework/testing/attributes/class-ignore-incorrect-usage.php @@ -0,0 +1,27 @@ +<?php +/** + * Ignore_Incorrect_Usage class file + * + * @package Mantle + */ + +namespace Mantle\Testing\Attributes; + +use Attribute; + +/** + * Ignore Incorrect Usage + * + * Used to mark a test as ignoring a specific doing it wrong call. Supports * as a wildcard. + */ +#[Attribute] +class Ignore_Incorrect_Usage { + /** + * Constructor. + * + * @param string $name Name of the function, method, or class that appears in + * the first argument of the source `_doing_it_wrong()` + * call. Supports * as a wildcard. + */ + public function __construct( public string $name = '*' ) {} +} diff --git a/vendor/mantle-framework/testing/autoload.php b/vendor/mantle-framework/testing/autoload.php new file mode 100644 index 00000000..289e6ddf --- /dev/null +++ b/vendor/mantle-framework/testing/autoload.php @@ -0,0 +1,89 @@ +<?php +/** + * Autoloaded File to support Testing + * + * phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped + * + * @package Mantle + */ + +namespace Mantle\Testing; + +use Faker\Factory; +use Faker\Generator; +use Mantle\Container\Container; +use Mantle\Faker\Faker_Provider; + +use function Mantle\Support\Helpers\tap; + +require_once __DIR__ . '/preload.php'; +require_once __DIR__ . '/mail/helpers.php'; + +/** + * Retrieve an instance of the Installation Manager + * + * The manager can install the Mantle Testing Framework but will not by default. + * Call {@see Installation_Manager::install()} to install or use the + * {@see install()} helper. + */ +function manager(): Installation_Manager { + return Installation_Manager::instance(); +} + +/** + * Install the Mantle Testing Framework + * + * @param callable $callback Callback to invoke once the installation has begun. + */ +function install( callable $callback = null ): Installation_Manager { + return tap( + manager(), + fn ( Installation_Manager $manager ) => $manager->before( $callback ), + )->install(); +} + +/** + * Create a new HTML_String instance. + * + * @param string $html The HTML string to test. + */ +function html_string( string $html ): Assertable_HTML_String { + return new Assertable_HTML_String( $html ); +} + +/** + * Create a new Mock HTTP Response + * + * @param string $body Response body. + * @param array $headers Response headers. + */ +function mock_http_response( string $body = '', array $headers = [] ): Mock_Http_Response { + return new Mock_Http_Response( $body, $headers ); +} + +/** + * Create a new Mock HTTP Response Sequence + */ +function mock_http_sequence(): Mock_Http_Sequence { + return new Mock_Http_Sequence(); +} + +/** + * Create a new block factory instance. + */ +function block_factory(): Block_Factory { + $container = Container::get_instance(); + + // If the Generator is not bound to the container, bind it. + if ( ! $container->bound( Generator::class ) ) { + $container->singleton( + Generator::class, + fn () => tap( + Factory::create(), + fn ( Generator $generator ) => $generator->addProvider( new Faker_Provider( $generator ) ), + ), + ); + } + + return $container->make( Block_Factory::class ); +} diff --git a/vendor/mantle-framework/testing/class-assertable-html-string.php b/vendor/mantle-framework/testing/class-assertable-html-string.php new file mode 100644 index 00000000..c8929d98 --- /dev/null +++ b/vendor/mantle-framework/testing/class-assertable-html-string.php @@ -0,0 +1,58 @@ +<?php +/** + * HTML_String class file + * + * phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid + * + * @package Mantle + */ + +namespace Mantle\Testing; + +use Mantle\Testing\Concerns\Element_Assertions; +use PHPUnit\Framework\Assert; + +/** + * HTML String + * + * Perform assertions against a HTML string. + */ +class Assertable_HTML_String { + use Element_Assertions; + + /** + * Constructor. + * + * @param string $content The HTML content to test. + */ + public function __construct( protected string $content ) {} + + /** + * Retrieve the content. + */ + protected function get_content(): string { + return $this->content; + } + + /** + * Assert that the content contains the expected string. + * + * @param string $needle The $needle to assert against. + */ + public function assertContains( string $needle ): static { + Assert::assertStringContainsString( $needle, $this->content, 'The content does not contain the expected string.' ); + + return $this; + } + + /** + * Assert that the content does not contain the expected string. + * + * @param string $needle The $needle to assert against. + */ + public function assertNotContains( string $needle ): static { + Assert::assertStringNotContainsString( $needle, $this->content, 'The content contains the unexpected string.' ); + + return $this; + } +} diff --git a/vendor/mantle-framework/testing/class-assertable-json-string.php b/vendor/mantle-framework/testing/class-assertable-json-string.php new file mode 100644 index 00000000..94d5727e --- /dev/null +++ b/vendor/mantle-framework/testing/class-assertable-json-string.php @@ -0,0 +1,353 @@ +<?php +/** + * Assertable_Json_String class file + * + * @package Mantle + */ + +namespace Mantle\Testing; + +use ArrayAccess; +use Countable; +use JsonSerializable; +use Mantle\Contracts\Support\Jsonable; +use Mantle\Support\Arr; +use Mantle\Support\Str; +use PHPUnit\Framework\Assert as PHPUnit; + +use function Mantle\Support\Helpers\data_get; + +/** + * Assertions that can be made against a JSON string. + */ +class Assertable_Json_String implements ArrayAccess, Countable { + /** + * The decoded JSON contents. + */ + protected ?array $decoded = null; + + /** + * Constructor. + * + * @param string|array|Jsonable|JsonSerializable $json + */ + public function __construct( /** + * The original encoded JSON. + */ + public $json ) { + if ( $this->json instanceof JsonSerializable ) { + $this->decoded = $this->json->jsonSerialize(); + } elseif ( $this->json instanceof Jsonable ) { + $this->decoded = json_decode( $this->json->to_json(), true ); + } elseif ( is_array( $this->json ) ) { + $this->decoded = $this->json; + } else { + $decoded = json_decode( $this->json, true ); + + $this->decoded = is_array( $decoded ) ? $decoded : null; + } + + if ( is_null( $this->decoded ) || false === $this->decoded ) { + PHPUnit::fail( 'Invalid JSON was returned from the response.' ); + } + } + + /** + * Retrieve the decoded JSON. + */ + public function get_decoded(): array { + return $this->decoded; + } + + /** + * Validate and return the decoded response JSON. + * + * @param string|null $key Key to retrieve, optional. + * @return mixed + */ + public function json( $key = null ) { + return data_get( $this->decoded, $key ); + } + + /** + * Assert that the expected value and type exists at the given path in the response. + * + * @param string $path + * @param mixed $expect + * @return $this + */ + public function assertPath( $path, $expect ) { + PHPUnit::assertSame( $expect, $this->json( $path ) ); + + return $this; + } + + /** + * Assert that a specific path exists in the response. + * + * @param string $path Path to check. + */ + public function assertPathExists( string $path ) { + PHPUnit::assertNotNull( $this->json( $path ) ); + + return $this; + } + + /** + * Assert that a specific path does not exist in the response. + * + * @param string $path Path to check. + */ + public function assertPathMissing( string $path ) { + PHPUnit::assertNull( $this->json( $path ) ); + + return $this; + } + + /** + * Assert that the response has the similar JSON as given. + * + * @param array $data + * @return $this + */ + public function assertSimilar( array $data ) { + $actual = json_encode( Arr::sort_recursive( + (array) $this->decoded + ) ); + + PHPUnit::assertEquals( json_encode( Arr::sort_recursive( $data ) ), $actual ); + + return $this; + } + + /** + * Assert that the response has a given JSON structure. + * + * @param array|null $structure + * @param array|null $response_data + * @return $this + */ + public function assertStructure( array $structure = null, $response_data = null ) { + if ( is_null( $structure ) ) { + return $this->assertSimilar( $this->decoded ); + } + + if ( ! is_null( $response_data ) ) { + return ( new static( $response_data ) )->assertStructure( $structure ); + } + + foreach ( $structure as $key => $value ) { + if ( is_array( $value ) && '*' === $key ) { + PHPUnit::assertIsArray($this->decoded); + + foreach ( $this->decoded as $item ) { + $this->assertStructure( $structure['*'], $item ); + } + } elseif ( is_array( $value ) ) { + PHPUnit::assertArrayHasKey($key, $this->decoded); + + $this->assertStructure( $structure[ $key ], $this->decoded[ $key ] ); + } else { + PHPUnit::assertArrayHasKey( $value, $this->decoded ); + } + } + + return $this; + } + + /** + * Assert that the response has the exact given JSON. + * + * @param array $data + * @return $this + */ + public function assertExact( array $data ) { + $actual = wp_json_encode( + Arr::sort_recursive( + (array) $this->json() + ) + ); + + PHPUnit::assertEquals( wp_json_encode( Arr::sort_recursive( $data ) ), $actual ); + + return $this; + } + + /** + * Assert that the response contains the given JSON fragment. + * + * @param array $data Data to compare. + * @return $this + */ + public function assertFragment( array $data ) { + $actual = wp_json_encode( + Arr::sort_recursive( + (array) $this->json() + ) + ); + + foreach ( Arr::sort_recursive( $data ) as $key => $value ) { + $expected = $this->json_search_strings( $key, $value ); + + PHPUnit::assertTrue( + Str::contains( $actual, $expected ), + 'Unable to find JSON fragment: ' . PHP_EOL . PHP_EOL . + '[' . wp_json_encode( [ $key => $value ] ) . ']' . PHP_EOL . PHP_EOL . + 'within' . PHP_EOL . PHP_EOL . + "[{$actual}]." + ); + } + + return $this; + } + + /** + * Assert that the response does not contain the given JSON fragment. + * + * @param array $data Data to compare. + * @param bool $exact Flag for exact match, defaults to false. + * @return $this + */ + public function assertMissing( array $data, $exact = false ) { + if ( $exact ) { + return $this->assertMissingExact( $data ); + } + + $actual = wp_json_encode( + Arr::sort_recursive( + (array) $this->json() + ) + ); + + foreach ( Arr::sort_recursive( $data ) as $key => $value ) { + $unexpected = $this->json_search_strings( $key, $value ); + + PHPUnit::assertFalse( + Str::contains( $actual, $unexpected ), + 'Found unexpected JSON fragment: ' . PHP_EOL . PHP_EOL . + '[' . wp_json_encode( [ $key => $value ] ) . ']' . PHP_EOL . PHP_EOL . + 'within' . PHP_EOL . PHP_EOL . + "[{$actual}]." + ); + } + + return $this; + } + + /** + * Assert that the response does not contain the exact JSON fragment. + * + * @param array $data + * @return $this + */ + public function assertMissingExact( array $data ) { + $actual = wp_json_encode( + Arr::sort_recursive( + (array) $this->json() + ) + ); + + foreach ( Arr::sort_recursive( $data ) as $key => $value ) { + $unexpected = $this->json_search_strings( $key, $value ); + + if ( ! Str::contains( $actual, $unexpected ) ) { + return $this; + } + } + + PHPUnit::fail( + 'Found unexpected JSON fragment: ' . PHP_EOL . PHP_EOL . + '[' . wp_json_encode( $data ) . ']' . PHP_EOL . PHP_EOL . + 'within' . PHP_EOL . PHP_EOL . + "[{$actual}]." + ); + } + + /** + * Assert that the response JSON has the expected count of items at the given key. + * + * @param int $count + * @param string|null $key + * @return $this + */ + public function assertCount( int $count, $key = null ) { + if ( ! is_null( $key ) ) { + PHPUnit::assertCount( + $count, + data_get( $this->json(), $key ), + "Failed to assert that the response count matched the expected {$count}" + ); + + return $this; + } + + PHPUnit::assertCount( + $count, + $this->json(), + "Failed to assert that the response count matched the expected {$count}" + ); + + return $this; + } + + /** + * Get the strings we need to search for when examining the JSON. + * + * @param string $key + * @param string $value + * @return array + */ + protected function json_search_strings( $key, $value ) { + $needle = substr( (string) wp_json_encode( [ $key => $value ] ), 1, -1 ); + + return [ + $needle . ']', + $needle . '}', + $needle . ',', + ]; + } + + /** + * Get the total number of items in the underlying JSON array. + */ + public function count(): int { + return count( $this->decoded ); + } + + /** + * Determine whether an offset exists. + * + * @param mixed $offset + */ + public function offsetExists( $offset ): bool { + return isset( $this->decoded[ $offset ] ); + } + + /** + * Get the value at the given offset. + * + * @param string $offset + */ + public function offsetGet( $offset ): mixed { + return $this->decoded[ $offset ]; + } + + /** + * Set the value at the given offset. + * + * @param string $offset + * @param mixed $value + */ + public function offsetSet($offset, $value): void { + $this->decoded[ $offset ] = $value; + } + + /** + * Unset the value at the given offset. + * + * @param string $offset + */ + public function offsetUnset($offset): void { + unset( $this->decoded[ $offset ] ); + } +} diff --git a/vendor/mantle-framework/testing/class-block-factory.php b/vendor/mantle-framework/testing/class-block-factory.php new file mode 100644 index 00000000..53a3b39c --- /dev/null +++ b/vendor/mantle-framework/testing/class-block-factory.php @@ -0,0 +1,117 @@ +<?php +/** + * Block_Factory class file + * + * @package Mantle + */ + +namespace Mantle\Testing; + +use Faker\Generator; +use InvalidArgumentException; + +use function Mantle\Support\Helpers\collect; + +/** + * Block Factory + * + * Used to generate blocks and create presets of blocks for testing. + * + * @method string block(string $name = 'paragraph', string $content = '', array $attributes = []) + * @method string image(?string $url = null, ?string $alt = null, array $attributes = []) + * @method string heading(int $level = 2) + * @method string paragraph(int $sentences = 3) + * @method string paragraphs(int $count = 3, bool $as_text = true) + */ +class Block_Factory { + /** + * Presets of blocks. + * + * @var array<string, array|string|callable> + */ + public static array $presets = []; + + /** + * Register a preset of blocks. + * + * @param string $name Name of the preset. + * @param array|string|callable $preset Preset to register. + */ + public static function register_preset( string $name, array|string|callable $preset ): void { + static::$presets[ $name ] = $preset; + } + + /** + * Clear all presets. + */ + public static function clear_presets(): void { + static::$presets = []; + } + + + /** + * Constructor. + * + * @param Generator $faker Faker generator. + */ + public function __construct( protected Generator $faker ) {} + + /** + * Apply a preset. + * + * @throws InvalidArgumentException If the preset is not found. + * + * @param string $name Name of the preset. + * @param array $arguments Arguments to pass to the preset. + */ + public function preset( string $name, array $arguments = [] ): string { + if ( ! isset( static::$presets[ $name ] ) ) { + throw new InvalidArgumentException( "Unknown block factory preset: {$name}" ); + } + + $result = static::$presets[ $name ]; + + if ( is_callable( $result ) ) { + $result = $result( $this, ...$arguments ); + } + + return is_array( $result ) ? serialize_blocks( $result ) : $result; + } + + /** + * Magic method to generate blocks from a preset. + * + * @throws InvalidArgumentException If the block method is not found. + * + * @param string $name Name of the preset. + * @param array $arguments Arguments to pass to the preset. + */ + public function __call( string $name, array $arguments ): string { + if ( isset( static::$presets[ $name ] ) ) { + return static::preset( $name, $arguments ); + } + + $method = match ( $name ) { + 'paragraphs' => 'paragraph_blocks', + 'block' => 'block', + default => "{$name}_block", + }; + + try { + return $this->faker->$method( ...$arguments ); + } catch ( InvalidArgumentException ) { + throw new InvalidArgumentException( "Unknown block factory method: {$name}" ); + } + } + + /** + * Generate a collection of blocks. + * + * @param array $blocks Blocks to generate. + */ + public function blocks( array $blocks ): string { + return collect( $blocks ) + ->map( fn ( $block ) => is_array( $block ) ? serialize_blocks( $block ) : $block ) + ->implode( "\n\n" ); + } +} diff --git a/vendor/mantle-framework/testing/class-framework-test-case.php b/vendor/mantle-framework/testing/class-framework-test-case.php new file mode 100644 index 00000000..df2ac98c --- /dev/null +++ b/vendor/mantle-framework/testing/class-framework-test-case.php @@ -0,0 +1,18 @@ +<?php +/** + * Framework_Test_Case class file. + * + * @package Mantle + */ + +namespace Mantle\Testing; + +use Mantle\Testing\Concerns\Create_Application; + +/** + * Test case for use inside of the framework. For external use, please use + * {@see Mantle\Testkit\Test_Case}. + */ +abstract class Framework_Test_Case extends Test_Case { + use Create_Application; +} diff --git a/vendor/mantle-framework/testing/class-installation-manager.php b/vendor/mantle-framework/testing/class-installation-manager.php new file mode 100644 index 00000000..b86a5737 --- /dev/null +++ b/vendor/mantle-framework/testing/class-installation-manager.php @@ -0,0 +1,228 @@ +<?php +/** + * Installation_Manager class file + * + * @package Mantle + */ + +namespace Mantle\Testing; + +use Mantle\Support\Traits\Conditionable; +use Mantle\Support\Traits\Singleton; + +/** + * Installation Manager + */ +class Installation_Manager { + use Conditionable; + use Concerns\PHPUnit_Upgrade_Warning; + use Concerns\Rsync_Installation; + use Singleton; + + /** + * Callbacks for before installation. + * + * @var callable[] + */ + protected array $before_install_callbacks = []; + + /** + * Callbacks for after installation. + * + * @var callable[] + */ + protected array $after_install_callbacks = []; + + /** + * Callback for after WordPress is loaded. + * + * @var callable[] + */ + protected array $after_loaded_callbacks = []; + + /** + * Constructor. + * + * Ensure that any environment variables also call the subsequent methods to + * configure the installation. + */ + public function __construct() { + $this->with_default_exclusions(); + + if ( Utils::env_bool( 'MANTLE_INSTALL_VIP_MU_PLUGINS', false ) ) { + $this->with_vip_mu_plugins(); + } + + if ( Utils::env_bool( 'MANTLE_INSTALL_OBJECT_CACHE', false ) ) { + $this->with_object_cache(); + } elseif ( $object_cache = Utils::env( 'MANTLE_INSTALL_OBJECT_CACHE', false ) ) { + $this->with_object_cache( $object_cache ); + } + + if ( Utils::env_bool( 'MANTLE_USE_SQLITE', false ) ) { + $this->with_sqlite(); + } + } + + /** + * Define a callback to be invoked before installation. + * + * @param callable $callback Callback to invoke before installation. + * @return static + */ + public function before( ?callable $callback ) { + if ( is_callable( $callback ) ) { + $this->before_install_callbacks[] = $callback; + } + + return $this; + } + + /** + * Define a callback to be invoked after installation. + * + * @param callable|null $callback Callback to invoke after installation. + * @param bool $append Whether to append the callback to the list or prepend it. + * @return static + */ + public function after( ?callable $callback, bool $append = true ) { + if ( is_callable( $callback ) ) { + $append + ? $this->after_install_callbacks[] = $callback + : array_unshift( $this->after_install_callbacks, $callback ); + } + + return $this; + } + + /** + * Define a callback for a specific WordPress hook. + * + * @param string $hook Hook name. + * @param callable $callback Callback to invoke. + * @param int $priority Priority. + * @param int $accepted_args Number of accepted arguments. + * @return static + */ + public function on( string $hook, ?callable $callback, int $priority = 10, int $accepted_args = 1 ) { + if ( is_callable( $callback ) ) { + tests_add_filter( $hook, $callback, $priority, $accepted_args ); + } + + return $this; + } + + /** + * Define a callback to be invoked using the 'muplugins_loaded' hook. + * + * @param callable $callback Callback to invoke on 'muplugins_loaded'. + * @return static + */ + public function loaded( ?callable $callback ) { + return $this->on( 'muplugins_loaded', $callback ); + } + + /** + * Define a callback to be invoked on 'init'. + * + * @param callable $callback Callback to invoke on 'init'. + * @return static + */ + public function init( ?callable $callback ) { + return $this->loaded( + fn () => $this->on( 'init', $callback ) + ); + } + + /** + * Define the active theme to be set after the installation is loaded. + * + * @param string $theme Theme name. + * @return static + */ + public function theme( string $theme ) { + return $this->loaded( fn () => switch_theme( $theme ) ); + } + + /** + * Alias for `theme()`. + * + * @param string $theme Theme name. + * @return static + */ + public function with_theme( string $theme ) { + return $this->theme( $theme ); + } + + /** + * Define the active plugins to be set after the installation is loaded. + * + * To install a remote plugin to the installation during the rsync process, + * use the `install_plugin()` method. + * + * @see \Mantle\Testing\Concerns\Rsync_Installation::install_plugin() + * + * @param array<int, string> $plugins Plugin files to activate in WordPress. + * @return static + */ + public function plugins( array $plugins ) { + return $this->loaded( fn () => update_option( 'active_plugins', $plugins ) ); + } + + /** + * Alias for `plugins()`. + * + * @param array<int, string> $plugins Plugin files to activate in WordPress. + * @return static + */ + public function with_plugins( array $plugins ) { + return $this->plugins( $plugins ); + } + + /** + * Alias for `plugins()`. + * + * @param array<int, string> $plugins Plugin files to activate in WordPress. + */ + public function with_active_plugins( array $plugins ): static { + return $this->plugins( $plugins ); + } + + /** + * Install the Mantle Testing Framework. + * + * @return static + */ + public function install() { + $this->warn_if_phpunit_10_or_higher(); + + require_once __DIR__ . '/core-polyfill.php'; + + if ( Utils::is_debug_mode() ) { + Utils::info( '🚨 Debug mode is enabled.' ); + } + + if ( $this->rsync_to ) { + $this->perform_rsync_testsuite(); + return $this; + } + + foreach ( $this->before_install_callbacks as $before_install_callback ) { + $before_install_callback(); + } + + try { + require_once __DIR__ . '/wordpress-bootstrap.php'; + } catch ( \Throwable $throwable ) { + Utils::error( '🚨 Failed to load the WordPress installation. Exception thrown:' ); + Utils::code( $throwable->getMessage() ); + exit( 1 ); + } + + foreach ( $this->after_install_callbacks as $after_install_callback ) { + $after_install_callback(); + } + + return $this; + } +} diff --git a/vendor/mantle-framework/testing/class-mock-action.php b/vendor/mantle-framework/testing/class-mock-action.php new file mode 100644 index 00000000..c6c240fb --- /dev/null +++ b/vendor/mantle-framework/testing/class-mock-action.php @@ -0,0 +1,144 @@ +<?php +/** + * This file contains the MockAction class + * + * @package Mantle + */ + +namespace Mantle\Testing; + +/** + * Helper class for testing code that involves actions and filters. + * + * Typical use: $ma = new MockAction(); add_action( 'foo', [ $ma, 'action' ] ); + * + * @deprecated Used as a shim for core tests. New tests should use Mantle's + * testing hook helpers {@see https://mantle.alley.com/docs/testing/hooks}. + */ +class Mock_Action { + /** + * Events log. When a callback fires, it will log an event to this array. + * + * @var array + */ + public $events = []; + + /** + * Constructor. + */ + public function __construct() { + $this->reset(); + } + + /** + * Reset the events. + */ + public function reset(): void { + $this->events = []; + } + + /** + * Get the current or last-run filter. + * + * @return mixed|string + */ + public function current_filter() { + if ( is_callable( 'current_filter' ) ) { + return current_filter(); + } + global $wp_actions; + return end( $wp_actions ); + } + + /** + * Action callback. + * + * @param mixed ...$args Arguments passed to the callback. + * @return mixed First argument. + */ + public function action( ...$args ) { + $this->events[] = [ + 'action' => __FUNCTION__, + 'tag' => $this->current_filter(), + 'args' => $args, + ]; + return $args[0]; + } + + /** + * Filter callback. + * + * @param mixed ...$args Arguments passed to the callback. + * @return mixed First argument. + */ + public function filter( ...$args ) { + $this->events[] = [ + 'filter' => __FUNCTION__, + 'tag' => $this->current_filter(), + 'args' => $args, + ]; + return $args[0]; + } + + /** + * Filter callback for 'all'. + * + * @param string $tag Action/filter tag. + * @param mixed ...$args Arguments passed to the callback. + */ + public function filter_all( $tag, ...$args ): void { + // This one doesn't return the result, so it's safe to use with the 'all' filter. + $this->events[] = [ + 'filter' => __FUNCTION__, + 'tag' => $tag, + 'args' => $args, + ]; + } + + /** + * Get the events (actions/filters, tags, args) that the mock has logged. + * + * @return array Events. + */ + public function get_events() { + return $this->events; + } + + /** + * Return a count of the number of times the action was called since the last + * reset. + * + * @param string $tag Optional. Action or filter tag. If absent, counts all + * events. + */ + public function get_call_count( $tag = '' ): int { + if ( ! empty( $tag ) ) { + $count = 0; + foreach ( $this->events as $event ) { + if ( $event['action'] === $tag ) { + ++$count; + } + } + return $count; + } + return count( $this->events ); + } + + /** + * Return an array of the tags that triggered calls to this action. + * + * @return array + */ + public function get_tags() { + return array_column( $this->events, 'tag' ); + } + + /** + * Return an array of args passed in calls to this action. + * + * @return array + */ + public function get_args() { + return array_column( $this->events, 'args' ); + } +} diff --git a/vendor/mantle-framework/testing/class-mock-http-response.php b/vendor/mantle-framework/testing/class-mock-http-response.php new file mode 100644 index 00000000..9df9a472 --- /dev/null +++ b/vendor/mantle-framework/testing/class-mock-http-response.php @@ -0,0 +1,296 @@ +<?php +/** + * This file contains the Mock_Http_Response class + * + * @package Mantle + */ + +namespace Mantle\Testing; + +use Mantle\Contracts\Support\Arrayable; +use Mantle\Support\Traits\Conditionable; +use Mantle\Support\Traits\Macroable; + +/** + * This class provides a mock HTTP response to be able to simulate HTTP requests + * in WordPress. + * + * Example: + * + * Mock_Http_Response::create() + * ->with_response_code( 404 ) + * ->with_body( '{"error":true}' ) + * ->with_header( 'Content-Type', 'application/json' ); + */ +class Mock_Http_Response implements Arrayable { + use Conditionable, Macroable; + + /** + * Response data. + * + * @var array + */ + public $response = []; + + /** + * Http Sequences + * Support for faking a series of fake responses in a specific order. + */ + public static function sequence(): Mock_Http_Sequence { + return new Mock_Http_Sequence(); + } + + /** + * Mock_Http_Response constructor. + * + * @param string $body Response body. + * @param array $headers Response headers. + */ + public function __construct( string $body = '', array $headers = [] ) { + $this->response = [ + 'headers' => $headers, + 'body' => $body, + 'response' => [ + 'code' => 200, + 'message' => get_status_header_desc( 200 ), + ], + 'cookies' => [], + 'filename' => '', + ]; + } + + /** + * Ensure that a response is an instance of Mock_Http_Response. + * + * @param mixed $response Response. + */ + public static function ensure( mixed $response ): Mock_Http_Response { + if ( $response instanceof self ) { + return $response; + } + + return static::create( $response ); + } + + + /** + * Helper method to create a response. + * + * @param string $body Response body. + * @param array $headers Response headers. + */ + public static function create( string $body = '', array $headers = [] ): Mock_Http_Response { + return new static( $body, $headers ); + } + + /** + * Add a header to the response. + * + * @param string $key Header key. + * @param string $value Header value. + * @return Mock_Http_Response This object. + */ + public function with_header( string $key, string $value ): Mock_Http_Response { + $this->response['headers'][ $key ] = $value; + + return $this; + } + + /** + * Add an array of headers to the response. + * + * @param array<string, string> $headers Headers to append. + */ + public function with_headers( array $headers ): Mock_Http_Response { + foreach ( $headers as $key => $value ) { + $this->with_header( $key, $value ); + } + + return $this; + } + + /** + * Set the response code. The response message will be inferred from that. + * + * @param int $code HTTP response code. + * @return Mock_Http_Response This object. + */ + public function with_response_code( int $code ): Mock_Http_Response { + $this->response['response'] = [ + 'code' => $code, + 'message' => get_status_header_desc( $code ), + ]; + + return $this; + } + + /** + * Alias for with_response_code(). + * + * @param int $code HTTP response code. + * @return Mock_Http_Response This object. + */ + public function with_status( int $code ): Mock_Http_Response { + return $this->with_response_code( $code ); + } + + /** + * Set the response body. + * + * @param string $body Response body. + * @return Mock_Http_Response This object. + */ + public function with_body( string $body ): Mock_Http_Response { + $this->response['body'] = $body; + + return $this; + } + + /** + * Set a response cookie. + * + * @param \WP_Http_Cookie $cookie Cookie. + * @return Mock_Http_Response This object. + */ + public function with_cookie( \WP_Http_Cookie $cookie ): Mock_Http_Response { + $this->response['cookies'][] = $cookie; + + return $this; + } + + /** + * Set the filename value for the mock response. + * + * @param string $filename Filename. + * @return Mock_Http_Response This object. + */ + public function with_filename( string $filename ): Mock_Http_Response { + $this->response['filename'] = $filename; + + return $this; + } + + /** + * Set the JSON body for the response. + * + * Also sets the proper JSON Content-Type header. + * + * @param array|string $payload JSON Payload to use. + * @return Mock_Http_Response This object. + */ + public function with_json( $payload ): Mock_Http_Response { + return $this + ->with_body( ! is_string( $payload ) ? wp_json_encode( $payload ) : $payload ) + ->with_header( 'Content-Type', 'application/json' ); + } + + /** + * Set the XML body for the response. + * + * Also sets the proper application/xml Content-Type header. + * + * @param string $payload JSON Payload to use. + * @return Mock_Http_Response This object. + */ + public function with_xml( string $payload ): Mock_Http_Response { + return $this + ->with_body( $payload ) + ->with_header( 'Content-Type', 'application/xml' ); + } + + /** + * Set the response as a 301 redirect + * + * @param string $url Redirect URL. + * @param int $code Status code. + * @return Mock_Http_Response This object. + */ + public function with_redirect( string $url, int $code = 301 ): Mock_Http_Response { + return $this + ->with_header( 'Location', $url ) + ->with_response_code( $code ); + } + + /** + * Set the response as a 302 temporary redirect + * + * @param string $url Redirect URL. + * @return Mock_Http_Response This object. + */ + public function with_temporary_redirect( string $url ): Mock_Http_Response { + return $this + ->with_header( 'Location', $url ) + ->with_response_code( 302 ); + } + + /** + * Create a response with the file contents as the body. + * + * @throws \InvalidArgumentException If the file is not readable. + * + * @param string $file File path. + * @param string $filename Optional. Filename to use in the Content-Disposition header. + */ + public function with_file( string $file, ?string $filename = null ): Mock_Http_Response { + if ( ! is_readable( $file ) ) { + throw new \InvalidArgumentException( "File '{$file}' is not readable." ); + } + + if ( ! $filename ) { + $filename = basename( $file ); + } + + // Determine the mime type. + $mime_type = wp_check_filetype( $file ); + + // Set the headers. + if ( ! empty( $mime_type['type'] ) ) { + $this->with_header( 'Content-Type', $mime_type['type'] ); + } + + if ( ! empty( $mime_type['ext'] ) ) { + $this->with_header( + 'Content-Disposition', + sprintf( + 'attachment; filename="%s.%s"', + pathinfo( $filename, PATHINFO_FILENAME ), + $mime_type['ext'], + ), + ); + } + + return $this + ->with_filename( $file ) + ->with_body( file_get_contents( $file ) ); // phpcs:ignore WordPressVIPMinimum.Performance.FetchingRemoteData.FileGetContentsUnknown + } + + /** + * Create a response with an image file as the body. + * + * The image will be a JPEG file. + * + * @param string|null $filename Optional. Filename to use in the Content-Disposition header. + */ + public function with_image( ?string $filename = null ): Mock_Http_Response { + return $this->with_file( + __DIR__ . '/data/images/canola.jpg', + $filename, + ); + } + + /** + * Returns the combined response array. + * + * @return array WP_Http response array, per WP_Http::request(). + */ + public function to_array() { + return $this->response; + } + + /** + * Returns a Http_Client response object. + */ + public function to_response(): \Mantle\Http_Client\Response { + return \Mantle\Http_Client\Response::create( $this->response ); + } +} diff --git a/vendor/mantle-framework/testing/class-mock-http-sequence.php b/vendor/mantle-framework/testing/class-mock-http-sequence.php new file mode 100644 index 00000000..fd32b491 --- /dev/null +++ b/vendor/mantle-framework/testing/class-mock-http-sequence.php @@ -0,0 +1,137 @@ +<?php +/** + * This file contains the Mock_Http_Sequence class + * + * @package Mantle + */ + +namespace Mantle\Testing; + +/** + * Support faking HTTP requests in a specific sequence. + */ +class Mock_Http_Sequence { + /** + * Responses in the sequence. + * + * @var Mock_Http_Response[] + */ + protected array $responses; + + /** + * Indicates that invoking this sequence when it is empty should throw an + * exception. + */ + protected bool $fail_when_empty = true; + + /** + * Empty response when the sequence is empty. + */ + protected ?Mock_Http_Response $empty_response = null; + + /** + * Create a Mock_Http_Sequence instance. + * + * @return static + */ + public static function create() { + return new static(); + } + + /** + * Push a specific response to the sequence + * + * @param Mock_Http_Response $response Response to push. + * @return static + */ + public function push( Mock_Http_Response $response ) { + $this->responses[] = $response; + return $this; + } + + /** + * Push a response with a specific status code to the sequence. + * + * @param int $status Http Status. + * @param array $headers Http Headers. + */ + public function push_status( int $status, array $headers = [] ): static { + return $this->push( + Mock_Http_Response::create() + ->with_response_code( $status ) + ->with_headers( $headers ) + ); + } + + /** + * Push a response with a specific body to the sequence. + * + * @param string $body Response body. + * @param array $headers Response headers. + */ + public function push_body( string $body, array $headers = [] ): static { + return $this->push( + Mock_Http_Response::create( $body, $headers ) + ); + } + + /** + * Push a JSON response to the sequence. + * + * @param array|string $payload Data to encode as JSON. + * @param array $headers Headers to include in the response. + */ + public function push_json( array|string $payload, array $headers = [] ): static { + return $this->push( + Mock_Http_Response::create( '', $headers ) + ->with_json( $payload ) + ->with_headers( [ 'Content-Type' => 'application/json' ] ) + ); + } + + /** + * Make the sequence return a default response when empty. + * + * @param Mock_Http_Response $response Response to return when empty. + * @return static + */ + public function when_empty( Mock_Http_Response $response ) { + $this->fail_when_empty = false; + $this->empty_response = $response; + return $this; + } + + /** + * Don't throw an exception when empty. + * + * @return static + */ + public function dont_fail_when_empty() { + return $this->when_empty( Mock_Http_Response::create() ); + } + + /** + * Indicates if the sequence has any responses remaining. + */ + public function is_empty(): bool { + return empty( $this->responses ); + } + + /** + * Get the nex response in the sequence. + * + * @throws \RuntimeException Thrown on empty sequence. + * @return mixed + */ + public function __invoke() { + if ( empty( $this->responses ) ) { + if ( $this->fail_when_empty ) { + throw new \RuntimeException( 'No more responses in sequence.' ); + } + + return $this->empty_response; + } + + return array_shift( $this->responses ); + } +} diff --git a/vendor/mantle-framework/testing/class-pending-testable-request.php b/vendor/mantle-framework/testing/class-pending-testable-request.php new file mode 100644 index 00000000..590de854 --- /dev/null +++ b/vendor/mantle-framework/testing/class-pending-testable-request.php @@ -0,0 +1,736 @@ +<?php +/** + * Pending_Testable_Request class file + * + * phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPressVIPMinimum.Variables.RestrictedVariables.cache_constraints___COOKIE + * + * @package Mantle + */ + +namespace Mantle\Testing; + +use Mantle\Database\Model\Model; +use Mantle\Framework\Http\Kernel as HttpKernel; +use Mantle\Http\Request; +use Mantle\Support\Str; +use Mantle\Support\Traits\Conditionable; +use Mantle\Testing\Doubles\Spy_REST_Server; +use Mantle\Testing\Exceptions\Exception; +use Mantle\Testing\Exceptions\WP_Redirect_Exception; +use Mantle\Testing\Test_Case; +use Mantle\Testing\Test_Response; +use Mantle\Testing\Utils; +use PHPUnit\Framework\Assert; +use RuntimeException; +use Symfony\Component\HttpFoundation\HeaderBag; +use Symfony\Component\HttpFoundation\InputBag; +use WP_Query; +use WP; + +/** + * Pending Testable Request + * + * A fluent request that is being made to the application. Performs a SUT + * (System Under Test) operation on WordPress and returns a response. + */ +class Pending_Testable_Request { + use Conditionable; + + /** + * Indicates whether redirects should be followed. + */ + public bool $follow_redirects = false; + + /** + * The headers for the request. + */ + public HeaderBag $headers; + + /** + * The cookies for the request. + */ + public InputBag $cookies; + + /** + * Store flag if the request was for the REST API. + * + * @var array{body: string, headers: array<string, string>, status: int}|null + */ + protected ?array $rest_api_response = null; + + /** + * Create a new pending testable request instance. + * + * @param Test_Case $test_case Test case instance. + */ + public function __construct( public Test_Case $test_case ) { + $this->headers = new HeaderBag(); + $this->cookies = new InputBag(); + } + + /** + * Define additional headers to be sent with the request. + * + * @param array $headers Headers for the request. + */ + public function with_headers( array $headers ): static { + $this->headers->add( $headers ); + + return $this; + } + + /** + * Define additional header to be sent with the request. + * + * @param string $name Header name (key). + * @param string $value Header value. + */ + public function with_header( string $name, string $value ): static { + return $this->with_headers( [ $name => $value ] ); + } + + /** + * Set the referer header and previous URL session value in order to simulate + * a previous request. + * + * @param string $url URL for the referer header. + */ + public function from( string $url ): static { + return $this->with_header( 'referer', $url ); + } + + /** + * Make a request with a set of cookies. + * + * @param array<string, string> $cookies Cookies to be sent with the request. + */ + public function with_cookies( array $cookies ): static { + $this->cookies->add( $cookies ); + + return $this; + } + + /** + * Make a request with a specific cookie. + * + * @param string $name Cookie name. + * @param string $value Cookie value. + */ + public function with_cookie( string $name, string $value ): static { + return $this->with_cookies( [ $name => $value ] ); + } + + /** + * Automatically follow any redirects returned from the response. + * + * @param bool $value Whether to follow redirects. + */ + public function following_redirects( bool $value = true ): static { + $this->follow_redirects = $value; + + return $this; + } + + /** + * Visit the given URI with a GET request. + * + * @param mixed $uri Request URI. + * @param array $headers Request headers. + */ + public function get( $uri, array $headers = [] ): Test_Response { + $server = $this->transform_headers_to_server_vars( $headers ); + + return $this->call( 'GET', $uri, [], $server ); + } + + /** + * Legacy support for the WordPress core unit test's `go_to()` method. + * + * @deprecated Use {@see Mantle\Testing\Concerns\Makes_Http_Requests::get()} instead. + * @param string $url The URL for the request. + */ + public function go_to( string $url ): Test_Response { + return $this->get( $url ); + } + + /** + * Infer the request URL from an object like a post or term. + * + * @param mixed $source Source from which to infer the URL. + */ + protected function infer_url( mixed $source ): string { + return match ( true ) { + $source instanceof \WP_Post => get_permalink( $source ), + $source instanceof \WP_Term => get_term_link( $source ), + $source instanceof \WP_User => \get_author_posts_url( $source->ID ), + $source instanceof Model && method_exists( $source, 'permalink' ) => $source->permalink(), + default => '', + }; + } + + /** + * Transform headers array to array of $_SERVER vars with HTTP_* format. + * + * @param array $headers Headers to convert to $_SERVER vars. + */ + protected function transform_headers_to_server_vars( array $headers ): array { + $headers = array_merge( $this->headers->all(), $headers ); + $formatted_headers = []; + + foreach ( $headers as $name => $value ) { + $name = strtr( strtoupper( $name ), '-', '_' ); + + $formatted_headers[ $this->format_server_header_key( $name ) ] = $value; + } + + return $formatted_headers; + } + + /** + * Format the header name for the server array. + * + * @param string $name Header name. + * @return string + */ + protected function format_server_header_key( $name ) { + if ( ! Str::starts_with( $name, 'HTTP_' ) && 'CONTENT_TYPE' !== $name && 'REMOTE_ADDR' !== $name ) { + return 'HTTP_' . $name; + } + + return $name; + } + + /** + * Call the given URI and return the Response. + * + * @param string $method Request method. + * @param mixed $uri Request URI. + * @param array $parameters Request params. + * @param array $server Server vars. + * @param array $cookies Cookies to be sent with the request. + * @param string|null $content Request content. + */ + public function call( string $method, mixed $uri, array $parameters = [], array $server = [], array $cookies = [], ?string $content = null ): Test_Response { + $this->reset_request_state(); + + if ( ! is_string( $uri ) ) { + $uri = $this->infer_url( $uri ); + } + + // Build a full URL from partial URIs. + if ( '/' === $uri[0] ) { + $url = 'https://' . WP_TESTS_DOMAIN . $uri; + } elseif ( false === strpos( $uri, '://' ) ) { + $url = 'https://' . WP_TESTS_DOMAIN . '/' . $uri; + } else { + $url = $uri; + } + + $this->set_server_state( + $method, + $url, + $server, + $parameters, + array_merge( $this->cookies->all(), $cookies ), + ); + + $response_status = null; + $response_headers = []; + + $intercept_status = function( $status_header, $code ) use ( &$response_status ): int { + $response_status = $code; + + return $code; + }; + + $intercept_headers = function( $send_headers ) use ( &$response_headers ): array { + $response_headers = $send_headers; + + return $send_headers; + }; + + $intercept_redirect = function( $location, $status ) use ( &$response_status, &$response_headers ): void { + $response_status = $status; + $response_headers['Location'] = $location; + throw new WP_Redirect_Exception(); + }; + + add_filter( 'exit_on_http_head', '__return_false', 9999 ); + add_filter( 'wp_using_themes', '__return_true', 9999 ); + + $this->test_case->call_before_callbacks(); + + // Attempt to run the query through the Mantle router. + if ( isset( $this->test_case->app['router'] ) ) { + $kernel = new HttpKernel( $this->test_case->app, $this->test_case->app['router'] ); + + // Setup the current request object. + $request = new Request( + $_GET, + $_POST, + [], + $_COOKIE, + $_FILES, + $_SERVER, + $content + ); + + // Mirror the logic from Request::createFromGlobals(). + if ( + str_starts_with( (string) $request->headers->get( 'CONTENT_TYPE', '' ), 'application/x-www-form-urlencoded' ) + && \in_array( strtoupper( (string) $request->server->get( 'REQUEST_METHOD', 'GET' ) ), [ 'PUT', 'DELETE', 'PATCH' ] ) + ) { + parse_str( $request->getContent(), $data ); + + $request->request = new InputBag( $data ); + } + + $this->test_case->app->instance( 'request', $request ); + + $response = $kernel->send_request_through_router( $request ); + + if ( $response ) { + $response = new Test_Response( + $response->getContent(), + $response->getStatusCode(), + $response->headers->all(), + $this->test_case, + ); + } + } + + // Attempt to run the query through the Mantle router. + if ( empty( $response ) ) { + add_filter( 'status_header', $intercept_status, 9999, 2 ); + add_filter( 'wp_headers', $intercept_headers, 9999 ); + add_filter( 'wp_redirect', $intercept_redirect, 9999, 2 ); // @phpstan-ignore-line Filter callback + + ob_start(); + + $this->setup_wordpress_query(); + + if ( $this->rest_api_response ) { + // Use the response from the REST API server. + ob_end_clean(); + + $response_content = $this->rest_api_response['body']; + $response_headers = array_merge( (array) $response_headers, $this->rest_api_response['headers'] ); + $response_status = $this->rest_api_response['status']; + } else { + try { + // Execute the request, inasmuch as WordPress would. + require ABSPATH . WPINC . '/template-loader.php'; + } catch ( Exception ) { // phpcs:ignore + // Mantle Exceptions are thrown to prevent some code from running, e.g. + // the tail end of wp_redirect(). + } + + $response_content = ob_get_clean(); + } + + remove_filter( 'status_header', $intercept_status, 9999 ); + remove_filter( 'wp_headers', $intercept_headers, 9999 ); + remove_filter( 'wp_redirect', $intercept_redirect, 9999 ); + + $response = new Test_Response( + $response_content, + $response_status ?? 200, + $response_headers, + $this->test_case, + ); + } + + $response->set_app( $this->test_case->app ); + + $this->test_case->call_after_callbacks( $response ); + + remove_filter( 'exit_on_http_head', '__return_false', 9999 ); + remove_filter( 'wp_using_themes', '__return_true', 9999 ); + + if ( $this->follow_redirects ) { + return $this->follow_redirects( $response ); + } + + return $response; + } + + /** + * Reset the global state related to requests. + */ + protected function reset_request_state(): void { + // phpcs:disable + + /* + * Note: the WP and WP_Query classes like to silently fetch parameters + * from all over the place (globals, GET, etc), which makes it tricky + * to run them more than once without very carefully clearing everything. + */ + $_GET = []; + $_POST = []; + $_COOKIE = []; + foreach ( + [ + 'query_string', + 'id', + 'postdata', + 'authordata', + 'day', + 'currentmonth', + 'page', + 'pages', + 'multipage', + 'more', + 'numpages', + 'pagenow', + 'current_screen', + ] as $v + ) { + if ( isset( $GLOBALS[ $v ] ) ) { + unset( $GLOBALS[ $v ] ); + } + } + + $this->rest_api_response = null; + + // Remove all HTTP_* headers from $_SERVER. + foreach ( $_SERVER as $key => $value ) { + if ( str_starts_with( $key, 'HTTP_' ) && 'HTTP_HOST' !== $key ) { + unset( $_SERVER[ $key ] ); + } + + if ( isset( $_SERVER['CONTENT_TYPE'] ) ) { + unset( $_SERVER['CONTENT_TYPE'] ); + } + + if ( isset( $_SERVER['REMOTE_ADDR'] ) ) { + unset( $_SERVER['REMOTE_ADDR'] ); + } + } + + // phpcs:enable + } + + /** + * Set $_SERVER keys for the request. + * + * @param string $method HTTP method. + * @param string $url Request URI. + * @param array $server Additional $_SERVER args to set. + * @param array $data POST data to set. + * @param array $cookies Cookies to be sent with the request. + */ + protected function set_server_state( $method, $url, $server, $data, array $cookies = [] ): void { + // phpcs:disable WordPress.Security.NonceVerification + $_SERVER['REQUEST_METHOD'] = strtoupper( $method ); + $_SERVER['SERVER_NAME'] = WP_TESTS_DOMAIN; + $_SERVER['SERVER_PORT'] = '80'; + unset( $_SERVER['PATH_INFO'] ); + + $parts = wp_parse_url( $url ); + if ( isset( $parts['scheme'] ) ) { + $req = $parts['path'] ?? ''; + if ( isset( $parts['query'] ) ) { + $req .= '?' . $parts['query']; + // Parse the URL query vars into $_GET. + parse_str( (string) $parts['query'], $_GET ); + } + } else { + $req = $url; + } + + $_SERVER['REQUEST_URI'] = $req; + + $_POST = $data; + + // The ini setting variable_order determines order; assume GP for simplicity. + $_REQUEST = array_merge( $_GET, $_POST ); + $_SERVER = array_merge( $_SERVER, $server ); + + // Set the cookies for the request. + $_COOKIE = $cookies; // phpcs:ignore WordPressVIPMinimum.Variables.RestrictedVariables.cache_constraints___COOKIE + + // phpcs:enable + } + + /** + * Sets the WordPress query as if a given URL has been requested. + * + * This sets: + * - The super globals. + * - The globals. + * - The query variables. + * - The main query. + */ + protected function setup_wordpress_query(): void { + Test_Case::flush_cache(); + + // phpcs:disable WordPress.WP.GlobalVariablesOverride + unset( $GLOBALS['wp_query'], $GLOBALS['wp_the_query'] ); + $GLOBALS['wp_the_query'] = new WP_Query(); + $GLOBALS['wp_query'] = $GLOBALS['wp_the_query']; + + $public_query_vars = $GLOBALS['wp']->public_query_vars; + $private_query_vars = $GLOBALS['wp']->private_query_vars; + + $GLOBALS['wp'] = new WP(); + $GLOBALS['wp']->public_query_vars = $public_query_vars; + $GLOBALS['wp']->private_query_vars = $private_query_vars; + + Utils::cleanup_query_vars(); + + $this->replace_rest_api(); + + $GLOBALS['wp']->main(); + + // phpcs:enable WordPress.WP.GlobalVariablesOverride + } + + /** + * Replace the REST API request. + * + * This will: + * - Initiate the REST API. + * - Set the WordPress REST Server to use the Mantle Spy REST Server to allow + * for the responses to be read. + * - Replace the REST API `rest_api_loaded` method to allow the REST response + * to be read without terminating the script. + */ + protected function replace_rest_api(): void { + // Ensure the Mantle REST Spy Server is used. + add_filter( 'wp_rest_server_class', [ Utils::class, 'wp_rest_server_class_filter' ], PHP_INT_MAX ); + + rest_api_init(); + + // Replace the `rest_api_loaded()` method with one we can control. + remove_filter( 'parse_request', 'rest_api_loaded' ); + add_action( 'parse_request', [ $this, 'serve_rest_api_request' ] ); + } + + /** + * Server the REST API request if applicable. + * + * Mirroring `{@see rest_api_loaded()}`, this method fires the REST API + * request and stores the response. + */ + public function serve_rest_api_request(): void { + if ( empty( $GLOBALS['wp']->query_vars['rest_route'] ) ) { + return; + } + + $server = rest_get_server(); + + if ( $server instanceof Spy_REST_Server ) { + // Reset the spy to ensure we're not using any previous data. + $server->reset_spy(); + + $route = untrailingslashit( $GLOBALS['wp']->query_vars['rest_route'] ); + + if ( empty( $route ) ) { + $route = '/'; + } + + $server->serve_request( $route ); + + if ( isset( $server->sent_body ) ) { + $this->rest_api_response = [ + 'body' => $server->sent_body, + 'headers' => $server->sent_headers, + 'status' => $server->sent_status, + ]; + } + } else { + trigger_error( // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error + 'Expected the Mantle Spy REST Server to be used. Not able to be tested against.', + E_USER_WARNING, + ); + } + } + + /** + * Turn the given URI into a fully qualified URL. + * + * @param string $uri URI to fully-qualify. + */ + protected function prepare_url_for_request( $uri ): string { + return Str::trailing_slash( home_url( $uri ) ); + } + + /** + * Follow a redirect chain until a non-redirect is received. + * + * @param Test_Response $response Test response. + */ + protected function follow_redirects( $response ): Test_Response { + while ( $response->is_redirect() ) { + $response = $this->get( $response->get_header( 'Location' ) ); + } + + $this->follow_redirects = false; + + return $response; + } + + /** + * Visit the given URI with a GET request, expecting a JSON response. + * + * @param string $uri URI to "get". + * @param array $headers Request headers. + * @param int $options JSON encoding options. + */ + public function get_json( $uri, array $headers = [], int $options = 0 ): Test_Response { + return $this->json( 'GET', $uri, [], $headers, $options ); + } + + /** + * Call the given URI with a JSON request. + * + * @param string $method Request method. + * @param string $uri Request URI. + * @param array $data Request data. + * @param array $headers Request headers. + * @param int $options JSON encoding options. + * + * @throws RuntimeException If not implemented. + */ + public function json( string $method, string $uri, array $data = [], array $headers = [], int $options = 1 ): Test_Response { + $content = json_encode( $data, $options ); // phpcs:ignore WordPress.WP.AlternativeFunctions.json_encode_json_encode + + $headers = array_merge( + $headers, + [ + 'Accept' => 'application/json', + 'Content-Length' => mb_strlen( $content, '8bit' ), + 'Content-Type' => 'application/json', + ] + ); + + $server = $this->transform_headers_to_server_vars( $headers ); + + return $this->call( $method, $uri, $data, $server, [], $content ); + } + + /** + * Visit the given URI with a POST request. + * + * @param string $uri Request URI. + * @param array $data Request data. + * @param array $headers Request headers. + */ + public function post( string $uri, array $data = [], array $headers = [] ): Test_Response { + $server = $this->transform_headers_to_server_vars( $headers ); + + return $this->call( 'POST', $uri, $data, $server ); + } + + /** + * Visit the given URI with a POST request, expecting a JSON response. + * + * @param string $uri Request URI. + * @param array $data Request data. + * @param array $headers Request headers. + * @param int $options JSON encoding options. + */ + public function post_json( string $uri, array $data = [], array $headers = [], int $options = 0 ): Test_Response { + return $this->json( 'POST', $uri, $data, $headers, $options ); + } + + /** + * Visit the given URI with a PUT request. + * + * @param string $uri Request URI. + * @param array $data Request data. + * @param array $headers Request headers. + */ + public function put( string $uri, array $data = [], array $headers = [] ): Test_Response { + $server = $this->transform_headers_to_server_vars( $headers ); + + return $this->call( 'PUT', $uri, $data, $server ); + } + + /** + * Visit the given URI with a PUT request, expecting a JSON response. + * + * @param string $uri Request URI. + * @param array $data Request data. + * @param array $headers Request headers. + * @param int $options JSON encoding options. + */ + public function put_json( string $uri, array $data = [], array $headers = [], int $options = 0 ): Test_Response { + return $this->json( 'PUT', $uri, $data, $headers, $options ); + } + + /** + * Visit the given URI with a PATCH request. + * + * @param string $uri Request URI. + * @param array $data Request data. + * @param array $headers Request headers. + */ + public function patch( $uri, array $data = [], array $headers = [] ): Test_Response { + $server = $this->transform_headers_to_server_vars( $headers ); + + return $this->call( 'PATCH', $uri, $data, $server ); + } + + /** + * Visit the given URI with a PATCH request, expecting a JSON response. + * + * @param string $uri Request URI. + * @param array $data Request data. + * @param array $headers Request headers. + * @param int $options JSON encoding options. + */ + public function patch_json( $uri, array $data = [], array $headers = [], int $options = 0 ): Test_Response { + return $this->json( 'PATCH', $uri, $data, $headers, $options ); + } + + /** + * Visit the given URI with a DELETE request. + * + * @param string $uri Request URI. + * @param array $data Request data. + * @param array $headers Request headers. + */ + public function delete( $uri, array $data = [], array $headers = [] ): Test_Response { + $server = $this->transform_headers_to_server_vars( $headers ); + + return $this->call( 'DELETE', $uri, $data, $server ); + } + + /** + * Visit the given URI with a DELETE request, expecting a JSON response. + * + * @param string $uri Request URI. + * @param array $data Request data. + * @param array $headers Request headers. + * @param int $options JSON encoding options. + */ + public function delete_json( $uri, array $data = [], array $headers = [], int $options = 0 ): Test_Response { + return $this->json( 'DELETE', $uri, $data, $headers, $options ); + } + + /** + * Visit the given URI with a OPTIONS request. + * + * @param string $uri Request URI. + * @param array $data Request data. + * @param array $headers Request headers. + */ + public function options( $uri, array $data = [], array $headers = [] ): Test_Response { + $server = $this->transform_headers_to_server_vars( $headers ); + + return $this->call( 'OPTIONS', $uri, $data, $server ); + } + + /** + * Visit the given URI with a OPTIONS request, expecting a JSON response. + * + * @param string $uri Request URI. + * @param array $data Request data. + * @param array $headers Request headers. + * @param int $options JSON encoding options. + */ + public function options_json( $uri, array $data = [], array $headers = [], int $options = 0 ): Test_Response { + return $this->json( 'OPTIONS', $uri, $data, $headers, $options ); + } +} diff --git a/vendor/mantle-framework/testing/class-test-case.php b/vendor/mantle-framework/testing/class-test-case.php new file mode 100644 index 00000000..aec71c63 --- /dev/null +++ b/vendor/mantle-framework/testing/class-test-case.php @@ -0,0 +1,334 @@ +<?php +/** + * This file contains the Test_Case class. + * + * @package Mantle + */ + +namespace Mantle\Testing; + +use Mantle\Container\Container; +use Mantle\Contracts\Application; +use Mantle\Database\Factory\Factory_Container; +use Mantle\Database\Model\Model; +use Mantle\Facade\Facade; +use Mantle\Framework\Alias_Loader; +use Mantle\Support\Collection; +use Mantle\Testing\Concerns\Admin_Screen; +use Mantle\Testing\Concerns\Assertions; +use Mantle\Testing\Concerns\Core_Shim; +use Mantle\Testing\Concerns\Deprecations; +use Mantle\Testing\Concerns\Hooks; +use Mantle\Testing\Concerns\Incorrect_Usage; +use Mantle\Testing\Concerns\Interacts_With_Console; +use Mantle\Testing\Concerns\Interacts_With_Container; +use Mantle\Testing\Concerns\Interacts_With_Cron; +use Mantle\Testing\Concerns\Interacts_With_Hooks; +use Mantle\Testing\Concerns\Interacts_With_Mail; +use Mantle\Testing\Concerns\Interacts_With_Requests; +use Mantle\Testing\Concerns\Makes_Http_Requests; +use Mantle\Testing\Concerns\Network_Admin_Screen; +use Mantle\Testing\Concerns\Refresh_Database; +use Mantle\Testing\Concerns\WordPress_Authentication; +use Mantle\Testing\Concerns\WordPress_State; +use PHPUnit\Framework\TestCase as BaseTestCase; +use Spatie\Snapshots\MatchesSnapshots; +use WP; +use WP_Query; + +use function Mantle\Support\Helpers\class_basename; +use function Mantle\Support\Helpers\class_uses_recursive; +use function Mantle\Support\Helpers\collect; + +/** + * Root Test Case for Mantle sites. + * + * Not designed for external use. Use {@see Mantle\Testkit\Test_Case} instead. + * + * @property-read Application|null $app + */ +abstract class Test_Case extends BaseTestCase { + use Assertions, + Core_Shim, + Deprecations, + Hooks, + Incorrect_Usage, + Interacts_With_Console, + Interacts_With_Container, + Interacts_With_Cron, + Interacts_With_Hooks, + Interacts_With_Mail, + Interacts_With_Requests, + Makes_Http_Requests, + MatchesSnapshots, + WordPress_State, + WordPress_Authentication; + + /** + * Array of traits that this class uses, with trait names as keys. + * + * @var array + */ + protected static $test_uses; + + /** + * Application instance. + */ + protected ?Application $app = null; + + /** + * Factory Instance. + */ + protected static ?Factory_Container $factory; + + /** + * Creates the application. + */ + abstract public function create_application(): Application; + + /** + * Runs the routine before setting up all tests. + */ + public static function setUpBeforeClass(): void { + static::register_traits(); + + if ( ! empty( static::$test_uses ) ) { + static::get_test_case_traits() + ->each( + function( $trait ): void { + $method = strtolower( class_basename( $trait ) ) . '_set_up_before_class'; + + if ( method_exists( static::class, $method ) ) { + call_user_func( [ static::class, $method ] ); + } + } + ); + } + + parent::setUpBeforeClass(); + + if ( isset( static::$test_uses[ Refresh_Database::class ] ) && method_exists( static::class, 'commit_transaction' ) ) { + static::commit_transaction(); + } + } + + /** + * Runs the routine after all tests have been run. + */ + public static function tearDownAfterClass(): void { + parent::tearDownAfterClass(); + + if ( isset( static::$test_uses[ Refresh_Database::class ] ) ) { + Utils::delete_all_data(); + } + + static::flush_cache(); + + if ( isset( static::$test_uses[ Refresh_Database::class ] ) && method_exists( static::class, 'commit_transaction' ) ) { + static::commit_transaction(); + } + } + + /** + * Runs the routine before each test is executed. + */ + protected function setUp(): void { + set_time_limit( 0 ); + + // Set the default permalink structure on each test before setUp() to allow + // the tests to override it. + $this->set_permalink_structure( Utils::DEFAULT_PERMALINK_STRUCTURE ); + + parent::setUp(); + + if ( ! isset( $this->app ) ) { + $this->refresh_application(); + } + + // Clear the test factory. + static::$factory = null; + + $this->hooks_set_up(); + + $this->clean_up_global_scope(); + + // Boot traits on the test case. + static::get_test_case_traits() + ->each( + function( $trait ): void { + $method = strtolower( class_basename( $trait ) ) . '_set_up'; + + if ( method_exists( $this, $method ) ) { + $this->{$method}(); + } + } + ); + + remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); + add_filter( 'wp_die_handler', [ WP_Die::class, 'get_handler' ] ); + + // Call the PHPUnit 8 'set_up' method if it exists. + if ( method_exists( $this, 'set_up' ) ) { + $this->set_up(); + } + } + + /** + * After a test method runs, reset any state in WordPress the test method might have changed. + */ + protected function tearDown(): void { + // phpcs:disable WordPress.WP.GlobalVariablesOverride,WordPress.NamingConventions.PrefixAllGlobals + global $wp_query, $wp_the_query, $wp; + + // Call the test case's "tear_down" method if it exists. + if ( method_exists( $this, 'tear_down' ) ) { + $this->tear_down(); + } + + static::get_test_case_traits() + // Tearing down requires performing priority traits in opposite order. + ->reverse() + ->each( + function( $trait ): void { + $method = strtolower( class_basename( $trait ) ) . '_tear_down'; + + if ( method_exists( $this, $method ) ) { + $this->{$method}(); + } + } + ); + + if ( is_multisite() ) { + while ( ms_is_switched() ) { + restore_current_blog(); + } + } + + $wp_query = new WP_Query(); + $wp_the_query = $wp_query; + $wp = new WP(); + + // Reset globals related to the post loop and `setup_postdata()`. + $post_globals = [ + 'post', + 'id', + 'authordata', + 'currentday', + 'currentmonth', + 'page', + 'pages', + 'multipage', + 'more', + 'numpages', + ]; + foreach ( $post_globals as $post_global ) { + $GLOBALS[ $post_global ] = null; + } + + $this->unregister_all_meta_keys(); + remove_filter( 'wp_die_handler', [ WP_Die::class, 'get_handler' ] ); + $this->hooks_tear_down(); + wp_set_current_user( 0 ); + // phpcs:enable + + parent::tearDown(); + + // Reset the application instance after everything else. + if ( $this->app ) { + $this->app = null; + + if ( class_exists( Facade::class ) ) { + Facade::set_facade_application( null ); + } + } + } + + /** + * Get the test case traits. + */ + protected static function get_test_case_traits(): Collection { + // Boot traits on the test case. + $traits = array_values( class_uses_recursive( static::class ) ); + + $priority_traits = static::get_priority_traits(); + + // Combine the priority and non-priority traits. + return collect() + ->merge( array_intersect( $priority_traits, $traits ) ) + ->merge( array_diff( $traits, $priority_traits ) ) + ->unique(); + } + + /** + * Get an array of priority traits. + * + * @return array<class-string> + */ + protected static function get_priority_traits(): array { + return [ + // This order is deliberate. + Refresh_Database::class, + WordPress_Authentication::class, + Admin_Screen::class, + Network_Admin_Screen::class, + ]; + } + /** + * Register the traits that this test case uses. + */ + public static function register_traits(): void { + static::$test_uses = array_flip( class_uses_recursive( static::class ) ); + } + + /** + * Refresh the application instance. + */ + protected function refresh_application(): void { + $this->app = $this->create_application(); + + if ( class_exists( Facade::class ) ) { + Facade::set_facade_application( $this->app ); + Facade::clear_resolved_instances(); + } + + if ( class_exists( Alias_Loader::class ) ) { + Alias_Loader::set_instance( null ); + } + + Model::set_event_dispatcher( $this->app['events'] ); + } + + /** + * Fetches the factory object for generating WordPress fixtures. + */ + protected static function factory(): Factory_Container { + if ( ! isset( static::$factory ) ) { + static::$factory = new Factory_Container( Container::get_instance() ); + } + + return static::$factory; + } + + /** + * Allow the factory/app to be checked against. + * + * @param string $name Property name. + */ + public function __isset( $name ): bool { + return 'factory' === $name || 'app' === $name; + } + + /** + * Retrieve the factory/app instance non-statically. + * + * @param string $name Property name. + * @return mixed + */ + public function __get( $name ) { + return match ( $name ) { + 'factory' => self::factory(), + 'app' => $this->app, + default => null, + }; + } +} diff --git a/vendor/mantle-framework/testing/class-test-command.php b/vendor/mantle-framework/testing/class-test-command.php new file mode 100644 index 00000000..f789f5ab --- /dev/null +++ b/vendor/mantle-framework/testing/class-test-command.php @@ -0,0 +1,249 @@ +<?php +/** + * Test_Command class file + * + * phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid, Squiz.PHP.CommentedOutCode.Found, Squiz.Commenting.InlineComment + * + * @package Mantle + */ + +namespace Mantle\Testing; + +use InvalidArgumentException; +use Mantle\Console\Command; +use Mantle\Contracts\Application; +use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Tester\CommandTester; +use PHPUnit\Framework\Assert; +use Symfony\Component\Console\Exception\CommandNotFoundException; + +/** + * Faux "PendingCommand" class for unit testing. + * + * Used for assertions against when testing console commands. + */ +class Test_Command { + /** + * Instance of the Command Tester. + */ + protected CommandTester $tester; + + /** + * Flag if the command has been executed. + */ + protected bool $has_executed = false; + + /** + * All of the expected output lines. + */ + public array $expected_output = []; + + /** + * All of the output lines that aren't expected to be displayed. + */ + public array $unexpected_output = []; + + /** + * Expected exit code. + */ + public ?int $expected_exit_code = null; + + /** + * Constructor. + * + * @param TestCase $test + * @param Application $app + * @param string $command + * @param array $arguments + */ + public function __construct( + protected TestCase $test, + protected Application $app, + protected string $command, + protected array $arguments = [], + ) { + $this->verify_command(); + } + + /** + * Add expected output. + * + * @param string $output + */ + public function assertOutputContains( string $output ): static { + $this->expected_output[] = $output; + + return $this; + } + + /** + * Add unexpected output. + * + * @param string $output + */ + public function assertOutputNotContains( string $output ): static { + $this->unexpected_output[] = $output; + + return $this; + } + + /** + * Add an assertion for a specific exit code. + * + * @param int $code + */ + public function assertExitCode( int $code ): static { + if ( $this->has_executed ) { + Assert::assertSame( $code, $this->tester->getStatusCode() ); + return $this; + } + + $this->expected_exit_code = $code; + + return $this; + } + + /** + * Assert that a command was successful. + */ + public function assertSuccessful(): static { + return $this->assertExitCode( Command::SUCCESS ); + } + + /** + * Assert that a command was OK. + */ + public function assertOk(): static { + return $this->assertSuccessful(); + } + + /** + * Assert that a command failed. + */ + public function assertFailed(): static { + return $this->assertExitCode( Command::FAILURE ); + } + + /** + * Assert that a command was unsuccessful. + */ + public function assertNotSuccessful(): static { + return $this->assertFailed(); + } + + /** + * Dump the output of the command. + */ + public function dd(): never { + if ( ! $this->has_executed ) { + $this->run(); + } + + dd( $this->tester->getDisplay() ); + } + + /** + * Execute the command. + */ + public function execute(): static { + return $this->run(); + } + + /** + * Retrieve the Command Tester instance. + */ + public function get_tester(): CommandTester { + return $this->tester; + } + + /** + * Verify the command is formatted properly. + * + * @throws InvalidArgumentException Thrown on invalid command. + */ + protected function verify_command(): void { + // Remove 'wp' from the command if passed. + if ( str_starts_with( $this->command, 'wp ' ) ) { + $this->command = substr( $this->command, 3 ); + } + + // Ensure that the command is under the 'mantle' namespace for the time being. + if ( ! str_starts_with( trim( $this->command ), 'mantle ' ) && 'mantle' !== $this->command ) { + throw new InvalidArgumentException( 'Command must be prefixed with "mantle" to be tested against.' ); + } + + // Remove the 'mantle' prefix from the command. + if ( str_starts_with( $this->command, 'mantle ' ) ) { + $this->command = substr( $this->command, 7 ); + } + } + + /** + * Run the command. + */ + public function run(): static { + $this->has_executed = true; + + try { + $this->tester = $this->app->make( + \Mantle\Framework\Console\Kernel::class + )->test( $this->command, $this->arguments ); + } catch ( CommandNotFoundException ) { + $this->test->fail( "Command [{$this->command}] not found." ); + } + + $this->verify_expectations(); + + return $this; + } + + /** + * Verify the expectations after the command has been run. + */ + protected function verify_expectations(): void { + // Assert that the exit code matches the expected exit code. + if ( null !== $this->expected_exit_code ) { + $exit_code = $this->tester->getStatusCode(); + + $this->test->assertEquals( + $this->expected_exit_code, + $exit_code, + "Expected exit code {$this->expected_exit_code} but received {$exit_code}." + ); + } + + if ( ! empty( $this->expected_output ) ) { + $output = $this->tester->getDisplay(); + + foreach ( $this->expected_output as $expected_output ) { + $this->test->assertStringContainsString( $expected_output, $output ); + } + } + + if ( ! empty( $this->unexpected_output ) ) { + $output = $this->tester->getDisplay(); + + foreach ( $this->unexpected_output as $unexpected_output ) { + $this->test->assertStringNotContainsString( $unexpected_output, $output ); + } + } + + // todo: add output substring assertions. + // if ( ! empty( $this->expected_output_substrings ) ) { + // $output = $this->tester->getDisplay(); + + // foreach ( $this->expected_output_substrings as $expected_output_substring ) { + // $this->test->assertStringContainsString( $expected_output_substring, $output ); + // } + // } + } + + /** + * Run the command on variable destruct. + */ + public function __destruct() { + if ( ! $this->has_executed ) { + $this->run(); + } + } +} diff --git a/vendor/mantle-framework/testing/class-test-response.php b/vendor/mantle-framework/testing/class-test-response.php new file mode 100644 index 00000000..4d4568db --- /dev/null +++ b/vendor/mantle-framework/testing/class-test-response.php @@ -0,0 +1,874 @@ +<?php // phpcs:disable WordPress.NamingConventions.ValidFunctionName +/** + * This file contains the Test_Response class + * + * @package Mantle + */ + +namespace Mantle\Testing; + +use Exception; +use Mantle\Contracts\Application; +use Mantle\Http\Response; +use Mantle\Support\Traits\Macroable; +use PHPUnit\Framework\Assert as PHPUnit; + +/** + * Faux "Response" class for unit testing. + */ +class Test_Response { + use Concerns\Element_Assertions, + Concerns\Snapshot_Testing, + Macroable; + + /** + * Application instance. + */ + protected Application $app; + + /** + * Response headers. + */ + public array $headers; + + /** + * Response content. + */ + protected string $content; + + /** + * Response status code. + */ + protected int $status_code; + + /** + * Assertable JSON string. + */ + protected Assertable_Json_String $decoded_json; + + /** + * Create a new test response instance. + * + * @param string|null $content HTTP response body. + * @param int $status HTTP response status code. + * @param array $headers HTTP response headers. + * @param Test_Case $test_case Test case instance. + */ + public function __construct( + ?string $content = '', + int $status = 200, + array $headers = [], + public ?Test_Case $test_case = null, + ) { + $this->set_content( $content ) + ->set_status_code( $status ) + ->set_headers( $headers ); + } + + /** + * Set the container instance. + * + * @param Application $app Application instance. + * @return static + */ + public function set_app( Application $app ) { + $this->app = $app; + + return $this; + } + + /** + * Create a response from a base response instance. + * + * @param Response $response Base response instance. + * @return static + */ + public static function from_base_response( Response $response ) { + return new static( $response->getContent(), $response->getStatusCode(), $response->headers->all() ); + } + + /** + * Sets the response status code. + * + * @param int $code Status code. + * @return $this + */ + public function set_status_code( int $code ): object { + $this->status_code = $code; + + return $this; + } + + /** + * Retrieves the status code for the current web response. + */ + public function get_status_code(): int { + return $this->status_code; + } + + /** + * Sets the response content. + * + * @param string|null $content Response content. + * @return $this + */ + public function set_content( ?string $content ): object { + $this->content = $content ?? ''; + + return $this; + } + + /** + * Gets the current response content. + * + * @return string|false + */ + public function get_content() { + return $this->content; + } + + /** + * Sets the response headers. + * + * @param array $headers Headers to set, as key => value pairs. + * @return $this + */ + public function set_headers( array $headers ): object { + $this->headers = array_change_key_case( $headers, CASE_LOWER ); + + return $this; + } + + /** + * Gets the current response headers. + * + * @return array + */ + public function get_headers() { + return $this->headers; + } + + /** + * Gets the current response headers. + * + * @param string $key Header to return. + * @param string|null $default If the header is not set, default to return. + */ + public function get_header( string $key, string $default = null ): ?string { + // Enforce a lowercase header name. + $key = strtolower( $key ); + + // If the header is set and not null, return the string value. + if ( isset( $this->headers[ $key ] ) ) { + // Account for multiple headers with the same key. + return is_array( $this->headers[ $key ] ) + ? (string) ( $this->headers[ $key ][0] ?? '' ) + : (string) $this->headers[ $key ]; + } + + // If the header is set and null, return that. Otherwise, the default. + return array_key_exists( $key, $this->headers ) + ? $this->headers[ $key ] + : $default; + } + + /** + * Assert that the response has a successful status code. + * + * @return $this + */ + public function assertSuccessful() { + $actual = $this->get_status_code(); + + PHPUnit::assertTrue( + $actual >= 200 && $actual < 300, + 'Response status code [' . $actual . '] is not a successful status code.' + ); + + return $this; + } + + /** + * Assert that the response has a 200 status code. + * + * @return $this + */ + public function assertOk() { + return $this->assertStatus( 200 ); + } + + /** + * Assert that the response has the given status code. + * + * @param int $status Status code to assert. + * @return $this + */ + public function assertStatus( $status ) { + $actual = $this->get_status_code(); + + PHPUnit::assertSame( + $actual, + $status, + "Expected status code {$status} but received {$actual}." + ); + + return $this; + } + + /** + * Assert that the response has a 201 status code. + * + * @return $this + */ + public function assertCreated() { + return $this->assertStatus( 201 ); + } + + /** + * Assert that the response has the given status code and no content. + * + * @param int $status Status code to assert. Defaults to 204. + * @return $this + */ + public function assertNoContent( $status = 204 ) { + $this->assertStatus( $status ); + + PHPUnit::assertEmpty( $this->get_content(), 'Response content is not empty.' ); + + return $this; + } + + /** + * Assert that the response has a not found status code. + * + * @return $this + */ + public function assertNotFound() { + return $this->assertStatus( 404 ); + } + + /** + * Assert that the response has a forbidden status code. + * + * @return $this + */ + public function assertForbidden() { + return $this->assertStatus( 403 ); + } + + /** + * Assert that the response has an unauthorized status code. + * + * @return $this + */ + public function assertUnauthorized() { + return $this->assertStatus( 401 ); + } + + /** + * Assert whether the response is redirecting to a given URI. + * + * @param string|null $uri URI to assert redirection to. + * @return static + */ + public function assertRedirect( ?string $uri = null ) { + PHPUnit::assertTrue( + $this->is_redirect(), + 'Response status code [' . $this->get_status_code() . '] is not a redirect status code.' + ); + + if ( $uri ) { + $this->assertLocation( $uri ); + } + + return $this; + } + + /** + * Is the response a redirect of some form? + * + * @param string|null $location Location to check with the redirect. + */ + public function is_redirect( string $location = null ): bool { + return in_array( $this->get_status_code(), [ 201, 301, 302, 303, 307, 308 ], true ) + && ( null === $location ?: $location === $this->get_header( 'Location' ) ); // phpcs:ignore WordPress.PHP.DisallowShortTernary.Found + } + + /** + * Assert that the current location header matches the given URI. + * + * @param string $uri URI to assert that the location header is set to. + * @return static + */ + public function assertLocation( $uri ) { + PHPUnit::assertEquals( + $this->app['url']->to( $uri ), + $this->app['url']->to( $this->get_header( 'location', '' ) ), + ); + + return $this; + } + + /** + * Asserts that the response contains the given header and equals the + * optional value. + * + * @param string $header_name Header name (key) to assert. + * @param mixed $value Header value to assert. + * @return static + */ + public function assertHeader( $header_name, $value = null ) { + // Enforce a lowercase header name. + $header_name = strtolower( $header_name ); + + PHPUnit::assertArrayHasKey( + $header_name, + $this->headers, + "Header [{$header_name}] not present on response." + ); + + $actual = $this->get_header( $header_name ); + + if ( ! is_null( $value ) ) { + PHPUnit::assertEquals( + $value, + $this->get_header( $header_name ), + "Header [{$header_name}] was found, but value [{$actual}] does not match [{$value}]." + ); + } + + return $this; + } + + /** + * Asserts that the response does not contains the given header and optional + * value. + * + * @param string $header_name Header name (key) to check. + * @param mixed $value Header value to check, optional. + * @return $this + */ + public function assertHeaderMissing( string $header_name, mixed $value = null ) { + // Enforce a lowercase header name. + $header_name = strtolower( $header_name ); + + // Compare the header value if one was provided. + if ( ! is_null( $value ) ) { + PHPUnit::assertNotEquals( + $value, + $this->get_header( $header_name ), + "Unexpected header [{$header_name}] was found with value [{$value}]." + ); + } else { + PHPUnit::assertArrayNotHasKey( + $header_name, + $this->headers, + "Unexpected header [{$header_name}] is present on response." + ); + } + + return $this; + } + + /** + * Asset that the contents matches an expected value. + * + * @param mixed $value Contents to compare. + * @return $this + */ + public function assertContent( mixed $value ): static { + PHPUnit::assertEquals( $value, $this->get_content() ); + return $this; + } + + /** + * Assert that the given string is contained within the response. + * + * @param string $value String to search for. + * @return $this + */ + public function assertSee( $value ) { + PHPUnit::assertStringContainsString( (string) $value, $this->get_content() ); + + return $this; + } + + /** + * Look for $values in $content in the specified order. + * + * @throws \Exception On failure. + * + * @param array $values Strings in which to look for in order. + * @param string $content Content in which to look. + * @return bool True on success. + */ + public function see_in_order( array $values, string $content ): bool { + $position = 0; + + foreach ( $values as $value ) { + if ( empty( $value ) ) { + continue; + } + + $value_position = mb_strpos( $content, (string) $value, $position ); + + if ( false === $value_position || $value_position < $position ) { + throw new Exception( + sprintf( + 'Failed asserting that \'%s\' contains "%s" in specified order.', + $content, + $value + ) + ); + } + + $position = $value_position + mb_strlen( (string) $value ); + } + + return true; + } + + /** + * Assert that the given strings are contained in order within the response. + * + * @param array $values Values to check. + * @return $this + */ + public function assertSeeInOrder( array $values ) { + try { + PHPUnit::assertTrue( $this->see_in_order( $values, $this->get_content() ) ); + } catch ( Exception $exception ) { + PHPUnit::fail( $exception->getMessage() ); + } + + return $this; + } + + /** + * Assert that the given string is contained within the response text. + * + * @param string $value Value to check. + * @return $this + */ + public function assertSeeText( $value ) { + PHPUnit::assertStringContainsString( (string) $value, wp_strip_all_tags( $this->get_content() ) ); + + return $this; + } + + /** + * Assert that the given strings are contained in order within the response + * text. + * + * @param array $values Values to check. + * @return $this + */ + public function assertSeeTextInOrder( array $values ) { + try { + PHPUnit::assertTrue( + $this->see_in_order( $values, wp_strip_all_tags( $this->get_content() ) ) + ); + } catch ( Exception $exception ) { + PHPUnit::fail( $exception->getMessage() ); + } + + return $this; + } + + /** + * Assert that the given string is not contained within the response. + * + * @param string $value Value to check. + * @return $this + */ + public function assertDontSee( $value ) { + PHPUnit::assertStringNotContainsString( (string) $value, $this->get_content() ); + + return $this; + } + + /** + * Assert that the given string is not contained within the response text. + * + * @param string $value Value to check. + * @return $this + */ + public function assertDontSeeText( $value ) { + PHPUnit::assertStringNotContainsString( (string) $value, wp_strip_all_tags( $this->get_content() ) ); + + return $this; + } + + /** + * Checks each of the WP_Query is_* functions/properties against expected + * boolean value. + * + * @see Test_Case::assertQueryTrue() + * + * @param string ...$prop Any number of WP_Query properties that are expected + * to be true for the current request. + */ + public function assertQueryTrue( ...$prop ): static { + Test_Case::assertQueryTrue( ...$prop ); + + return $this; + } + + /** + * Assert that a given ID matches the global queried object ID. + * + * @param int $id Expected ID. + * @return $this + */ + public function assertQueriedObjectId( int $id ): static { + Test_Case::assertQueriedObjectId( $id ); + + return $this; + } + + /** + * Assert that a given ID does not the global queried object ID. + * + * @param int $id Expected ID. + * @return $this + */ + public function assertNotQueriedObjectId( int $id ): static { + Test_Case::assertNotQueriedObjectId( $id ); + + return $this; + } + + /** + * Assert that a given object is equivalent to the global queried object. + * + * @param object $object Expected object. + * @return $this + */ + public function assertQueriedObject( mixed $object ): static { + Test_Case::assertQueriedObject( $object ); + + return $this; + } + /** + * Assert that a given object is not equivalent to the global queried object. + * + * @param object $object Expected object. + * @return $this + */ + public function assertNotQueriedObject( mixed $object ): static { + Test_Case::assertNotQueriedObject( $object ); + + return $this; + } + + /** + * Assert that the queried object is null. + * + * @return $this + */ + public function assertQueriedObjectNull(): static { + Test_Case::assertQueriedObjectNull(); + + return $this; + } + + /** + * Assert if the response is a JSON response. + * + * @return $this + */ + public function assertIsJson(): static { + $content_type = $this->get_header( 'Content-Type' ); + + if ( empty( $content_type ) ) { + PHPUnit::fail( 'Response is not JSON.' ); + } + + // Check that the content-type header contains 'application/json'. + PHPUnit::assertStringContainsString( 'application/json', $content_type ); + + // Decode the content and see if it's valid JSON. If it isn't, the test will + // fail. + $this->decoded_json(); + + return $this; + } + + /** + * Assert if the response is not a JSON response. + * + * @return $this + */ + public function assertIsNotJson(): static { + $content_type = $this->get_header( 'Content-Type' ); + + PHPUnit::assertStringNotContainsString( 'application/json', $content_type ); + + // Bail early if the content type is not JSON. + if ( empty( $content_type ) ) { + return $this; + } + + if ( isset( $this->decoded_json ) ) { + PHPUnit::fail( 'Response is JSON.' ); + } + + if ( ! empty( $this->content ) ) { + // Attempt to parse the content and see if it's valid JSON. + $decoded = json_decode( $this->content, true ); + + if ( null !== $decoded ) { + PHPUnit::fail( 'Response is JSON.' ); + } + } + + return $this; + } + + /** + * Assert that the expected value and type exists at the given path in the response. + * + * @param string $path + * @param mixed $expect + * @return $this + */ + public function assertJsonPath( $path, $expect ) { + $this->decoded_json()->assertPath( $path, $expect ); + + return $this; + } + + /** + * Assert that a specific path exists in the response. + * + * @param string $path Path to check. + */ + public function assertJsonPathExists( string $path ) { + $this->decoded_json()->assertPathExists( $path ); + + return $this; + } + + /** + * Assert that a specific path does not exist in the response. + * + * @param string $path Path to check. + */ + public function assertJsonPathMissing( string $path ) { + $this->decoded_json()->assertPathMissing( $path ); + + return $this; + } + + /** + * Assert that the response has the exact given JSON. + * + * @param array $data + * @return $this + */ + public function assertExactJson( array $data ) { + $this->decoded_json()->assertExact( $data ); + + return $this; + } + + /** + * Assert that the response contains the given JSON fragment. + * + * @param array $data Data to compare. + * @return $this + */ + public function assertJsonFragment( array $data ) { + $this->decoded_json()->assertFragment( $data ); + + return $this; + } + + /** + * Assert that the response does not contain the given JSON fragment. + * + * @param array $data Data to compare. + * @param bool $exact Flag for exact match, defaults to false. + * @return $this + */ + public function assertJsonMissing( array $data, $exact = false ) { + $this->decoded_json()->assertMissing( $data, $exact ); + + return $this; + } + + /** + * Assert that the response does not contain the exact JSON fragment. + * + * @param array $data + * @return $this + */ + public function assertJsonMissingExact( array $data ) { + $this->decoded_json()->assertMissingExact( $data ); + + return $this; + } + + /** + * Assert that the response JSON has the expected count of items at the given key. + * + * @param int $count + * @param string|null $key + * @return $this + */ + public function assertJsonCount( int $count, $key = null ) { + $this->decoded_json()->assertCount( $count, $key ); + + return $this; + } + + /** + * Assert that the response has the similar JSON as given. + * + * @param array $data + * @return $this + */ + public function assertJsonSimilar( array $data ) { + $this->decoded_json()->assertSimilar( $data ); + + return $this; + } + + /** + * Assert that the response has a given JSON structure. + * + * @param array|null $structure Structure to check. + * @return $this + */ + public function assertJsonStructure( array $structure = null ) { + $this->decoded_json()->assertStructure( $structure ); + + return $this; + } + + /** + * Validate and assert against the decoded JSON content. + */ + public function decoded_json(): Assertable_Json_String { + if ( ! isset( $this->decoded_json ) ) { + $this->decoded_json = new Assertable_Json_String( $this->get_content() ); + } + + return $this->decoded_json; + } + + /** + * Return the decoded response JSON. + * + * @param string|null $key Key to retrieve, optional. + * @return mixed + */ + public function json( ?string $key = null ) { + return $this->decoded_json()->json( $key ); + } + + /** + * Dump the contents of the response to the screen. + */ + public function dump(): static { + $content = $this->get_content(); + + // If the content is not JSON, dump it as is. + if ( 'application/json' !== $this->get_header( 'Content-Type' ) ) { + dump( $content ); + + return $this; + } + + $json = json_decode( $content ); + + if ( json_last_error() === JSON_ERROR_NONE ) { + $content = $json; + } + + dump( $content ); + + return $this; + } + + /** + * Dump the headers of the response to the screen. + */ + public function dump_headers(): static { + dump( $this->headers ); + + return $this; + } + + /** + * Camel-case alias to dump_headers(). + */ + public function dumpHeaders(): static { + return $this->dump_headers(); + } + + /** + * Dump the JSON, optionally by path, to the screen. + * + * @param string|null $path + */ + public function dump_json( ?string $path = null ): static { + dump( $this->json( $path ) ); + + return $this; + } + + /** + * Camel-case alias to dump_json(). + * + * @param string|null $path + */ + public function dumpJson( ?string $path = null ): static { + return $this->dump_json( $path ); + } + + /** + * Dump the content from the response and end the script. + */ + public function dd(): void { + $this->dump(); + + exit( 1 ); + } + + /** + * Dump the headers from the response and end the script. + */ + public function dd_headers(): void { + $this->dump_headers(); + + exit( 1 ); + } + + /** + * Camel-case alias to dd_headers(). + */ + public function ddHeaders(): void { + $this->dd_headers(); + } + + /** + * Dump the JSON from the response and end the script. + * + * @param string|null $path + */ + public function dd_json( ?string $path = null ): void { + $this->dump_json( $path ); + + exit( 1 ); + } + + /** + * Camel-case alias to dd_json(). + * + * @param string|null $path + */ + public function ddJson( ?string $path = null ): void { + $this->dd_json( $path ); + } +} diff --git a/vendor/mantle-framework/testing/class-utils.php b/vendor/mantle-framework/testing/class-utils.php new file mode 100644 index 00000000..7892dfed --- /dev/null +++ b/vendor/mantle-framework/testing/class-utils.php @@ -0,0 +1,518 @@ +<?php +/** + * This file contains the Utils class + * + * @package Mantle + */ + +namespace Mantle\Testing; + +use Mantle\Support\Collection; +use Mantle\Support\Str; +use Mantle\Testing\Doubles\Spy_REST_Server; + +use function Mantle\Support\Helpers\collect; +use function Termwind\render; + +require_once __DIR__ . '/concerns/trait-output-messages.php'; + +/** + * Assorted testing utilities. + * + * A fork of https://github.com/WordPress/wordpress-develop/blob/master/tests/phpunit/includes/utils.php. + */ +class Utils { + use Concerns\Output_Messages; + + /** + * Default database name. + * + * @var string + */ + public const DEFAULT_DB_NAME = 'wordpress_unit_tests'; + + /** + * Default database user. + * + * @var string + */ + public const DEFAULT_DB_USER = 'root'; + + /** + * Default database password. + * + * @var string + */ + public const DEFAULT_DB_PASSWORD = 'root'; + + /** + * Default database host. + * + * @var string + */ + public const DEFAULT_DB_HOST = 'localhost'; + + /** + * Default permalink structure. + * + * @var string + */ + public const DEFAULT_PERMALINK_STRUCTURE = '/%year%/%monthnum%/%day%/%postname%/'; + + /** + * Get the output from a given callable. + * + * @param callable $callable Callable to execute. + * @param array $args Arguments to pass to the callable. + * @return false|string Rendered output on success, false on failure. + */ + public static function get_echo( $callable, $args = [] ) { + ob_start(); + call_user_func_array( $callable, $args ); + return ob_get_clean(); + } + + /** + * Unregister a post status. + * + * @param string $status Post status to unregister. + */ + public static function unregister_post_status( $status ): void { + unset( $GLOBALS['wp_post_statuses'][ $status ] ); + } + + /** + * Remove WP query vars from the global space. + */ + public static function cleanup_query_vars(): void { + // Clean out globals to stop them polluting wp and wp_query. + foreach ( $GLOBALS['wp']->public_query_vars as $v ) { + unset( $GLOBALS[ $v ] ); + } + + foreach ( $GLOBALS['wp']->private_query_vars as $v ) { + unset( $GLOBALS[ $v ] ); + } + + foreach ( get_taxonomies( [], 'objects' ) as $t ) { + if ( $t->publicly_queryable && ! empty( $t->query_var ) ) { + $GLOBALS['wp']->add_query_var( $t->query_var ); + } + } + + foreach ( get_post_types( [], 'objects' ) as $t ) { + if ( is_post_type_viewable( $t ) && ! empty( $t->query_var ) ) { + $GLOBALS['wp']->add_query_var( $t->query_var ); + } + } + } + + /** + * Reset `$_SERVER` variables + */ + public static function reset_server(): void { + $_SERVER['HTTP_HOST'] = WP_TESTS_DOMAIN; + $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; // phpcs:ignore WordPressVIPMinimum.Variables + $_SERVER['REQUEST_METHOD'] = 'GET'; + $_SERVER['REQUEST_URI'] = ''; + $_SERVER['SERVER_NAME'] = WP_TESTS_DOMAIN; + $_SERVER['SERVER_PORT'] = '80'; + $_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1'; + + unset( $_SERVER['HTTP_REFERER'] ); + unset( $_SERVER['HTTPS'] ); + } + + /** + * Use the Spy_REST_Server class for the REST server. + * + * @return string The server class name. + */ + public static function wp_rest_server_class_filter(): string { + return Spy_REST_Server::class; + } + + /** + * Deletes all data from the database. + */ + public static function delete_all_data(): void { + // phpcs:disable WordPress.DB,WordPressVIPMinimum.Variables + global $wpdb; + + foreach ( [ + $wpdb->posts, + $wpdb->postmeta, + $wpdb->comments, + $wpdb->commentmeta, + $wpdb->term_relationships, + $wpdb->termmeta, + ] as $table ) { + $wpdb->query( "DELETE FROM {$table}" ); + } + + foreach ( [ + $wpdb->terms, + $wpdb->term_taxonomy, + ] as $table ) { + $wpdb->query( "DELETE FROM {$table} WHERE term_id != 1" ); + } + + $wpdb->query( "UPDATE {$wpdb->term_taxonomy} SET count = 0" ); + + $wpdb->query( "DELETE FROM {$wpdb->users} WHERE ID != 1" ); + $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE user_id != 1" ); + // phpcs:enable + } + + /** + * Deletes all posts from the database. + */ + public static function delete_all_posts(): void { + global $wpdb; + + // phpcs:ignore WordPress.DB + $all_posts = $wpdb->get_results( "SELECT ID, post_type from {$wpdb->posts}", ARRAY_A ); + if ( ! $all_posts ) { + return; + } + + foreach ( $all_posts as $all_post ) { + if ( 'attachment' === $all_post['post_type'] ) { + wp_delete_attachment( $all_post['ID'], true ); + } else { + wp_delete_post( $all_post['ID'], true ); + } + } + } + + /** + * Set a permalink structure. + * + * Hooked as a callback to the 'populate_options' action, we use this function to set a permalink structure during + * `wp_install()`, so that WP doesn't attempt to do a time-consuming remote request. + * + * @since 4.2.0 + */ + public static function set_default_permalink_structure_for_tests(): void { + update_option( 'permalink_structure', static::DEFAULT_PERMALINK_STRUCTURE ); + } + + /** + * Define the constants that are necessary for WordPress installation. + * + * Mirrors the wp-tests-config-sample.php file that can optionally be loaded + * before this file. Any constant that is already defined is not overridden + * with the option to use environment variables to override the default + * values. + */ + public static function setup_configuration(): void { + global $table_prefix; + + // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound + defined( 'ABSPATH' ) || define( 'ABSPATH', Str::trailing_slash( preg_replace( '#/wp-content/.*$#', '/', __DIR__ ) ) ); + defined( 'WP_DEBUG' ) || define( 'WP_DEBUG', true ); + + defined( 'DB_NAME' ) || define( 'DB_NAME', static::env( 'WP_DB_NAME', static::DEFAULT_DB_NAME ) ); + defined( 'DB_USER' ) || define( 'DB_USER', static::env( 'WP_DB_USER', static::DEFAULT_DB_USER ) ); + defined( 'DB_PASSWORD' ) || define( 'DB_PASSWORD', static::env( 'WP_DB_PASSWORD', static::DEFAULT_DB_PASSWORD ) ); + defined( 'DB_HOST' ) || define( 'DB_HOST', static::env( 'WP_DB_HOST', static::DEFAULT_DB_HOST ) ); + defined( 'DB_CHARSET' ) || define( 'DB_CHARSET', static::ENV( 'WP_DB_CHARSET', 'utf8' ) ); + defined( 'DB_COLLATE' ) || define( 'DB_COLLATE', static::ENV( 'WP_DB_COLLATE', '' ) ); + + defined( 'AUTH_KEY' ) || define( 'AUTH_KEY', 'put your unique phrase here' ); + defined( 'SECURE_AUTH_KEY' ) || define( 'SECURE_AUTH_KEY', 'put your unique phrase here' ); + defined( 'LOGGED_IN_KEY' ) || define( 'LOGGED_IN_KEY', 'put your unique phrase here' ); + defined( 'NONCE_KEY' ) || define( 'NONCE_KEY', 'put your unique phrase here' ); + defined( 'AUTH_SALT' ) || define( 'AUTH_SALT', 'put your unique phrase here' ); + defined( 'SECURE_AUTH_SALT' ) || define( 'SECURE_AUTH_SALT', 'put your unique phrase here' ); + defined( 'LOGGED_IN_SALT' ) || define( 'LOGGED_IN_SALT', 'put your unique phrase here' ); + defined( 'NONCE_SALT' ) || define( 'NONCE_SALT', 'put your unique phrase here' ); + + $table_prefix = 'wptests_'; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited + + defined( 'WP_TESTS_DOMAIN' ) || define( 'WP_TESTS_DOMAIN', 'example.org' ); + defined( 'WP_TESTS_EMAIL' ) || define( 'WP_TESTS_EMAIL', 'admin@example.org' ); + defined( 'WP_TESTS_TITLE' ) || define( 'WP_TESTS_TITLE', 'Test Site' ); + defined( 'WP_PHP_BINARY' ) || define( 'WP_PHP_BINARY', 'php' ); + defined( 'WPLANG' ) || define( 'WPLANG', '' ); + + // phpcs:enable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound + } + + /** + * Retrieve an environment variable with a fallback. + * + * @param string $variable Variable to get. + * @param mixed $default Default value. + * @return mixed + */ + public static function env( string $variable, $default ) { + $value = getenv( $variable ); + + return false === $value ? $default : $value; + } + + /** + * Retrieve an environment variable and check if it is truthy. + * + * @param string $variable Variable to get. + * @param bool $default Default value used as a fallback. + */ + public static function env_bool( string $variable, bool $default ): bool { + $value = static::env( $variable, $default ); + + return in_array( strtolower( (string) $value ), [ 'true', '1', 'yes' ], true ); + } + + /** + * Ensure an environment variable is is a valid string that can be passed to + * to a shell script. + * + * For example, an empty string should be '' vs a blank space. + * `escapeshellarg()` doesn't fit here because the script is expecting + * unquoted arguments. + * + * @param string|bool $string String to sanitize. + */ + public static function shell_safe( string|bool $string ): string { + if ( is_bool( $string ) ) { + return $string ? 'true' : 'false'; + } + + return empty( trim( $string ) ) ? "''" : "\"{$string}\""; + } + + /** + * Install a WordPress codebase through a shell script. + * + * This installs the WordPress codebase in the specified directory. It does + * not install the WordPress database. + * + * @param string $directory Directory to install WordPress in. + */ + public static function install_wordpress( string $directory ): void { + $install_vip_mu_plugins = static::env_bool( 'MANTLE_INSTALL_VIP_MU_PLUGINS', false ); + $use_sqlite_db = static::env_bool( 'MANTLE_USE_SQLITE', false ); + + // Handle the legacy values for MANTLE_INSTALL_OBJECT_CACHE. + if ( static::env_bool( 'MANTLE_INSTALL_OBJECT_CACHE', false ) ) { + $install_object_cache = 'memcached'; + } else { + $install_object_cache = static::env( 'MANTLE_INSTALL_OBJECT_CACHE', false ); + + if ( $install_object_cache && ! in_array( $install_object_cache, [ 'memcached', 'redis' ], true ) ) { + static::error( '🚨 Invalid value for MANTLE_INSTALL_OBJECT_CACHE (' . $install_object_cache . '). Ignoring...' ); + + $install_object_cache = false; + } + } + + $branch = static::env( 'MANTLE_CI_BRANCH', 'HEAD' ); + + // Compile the variables to pass to the shell script. + $variables = collect( + [ + [ 'WP_CORE_DIR', $directory ], + [ 'WP_MULTISITE', static::env( 'WP_MULTISITE', '0' ) ], + ] + ) + ->when( + $use_sqlite_db, + fn ( Collection $collection ) => $collection->push( [ 'WP_USE_SQLITE', 'true' ] ) + ) + ->when( + static::is_debug_mode(), + fn ( Collection $collection ) => $collection->push( [ 'INSTALL_WP_TEST_DEBUG', 'true' ] ) + ) + ->when( + ! empty( static::env( 'CACHEDIR', '' ) ), + fn ( Collection $collection ) => $collection->push( [ 'CACHEDIR', static::env( 'CACHEDIR', '' ) ] ) + ) + ->map( + fn ( array $item ) => sprintf( 'export %s=%s', $item[0], static::shell_safe( $item[1] ) ) + ) + ->implode( ' && ' ); + + $command = sprintf( + '%s && curl -s %s | bash -s %s', + $variables, + "https://raw.githubusercontent.com/alleyinteractive/mantle-ci/{$branch}/install-wp-tests.sh", + collect( + [ + static::shell_safe( defined( 'DB_NAME' ) ? DB_NAME : static::env( 'WP_DB_NAME', static::DEFAULT_DB_NAME ) ), + static::shell_safe( defined( 'DB_USER' ) ? DB_USER : static::env( 'WP_DB_USER', static::DEFAULT_DB_USER ) ), + static::shell_safe( defined( 'DB_PASSWORD' ) ? DB_PASSWORD : static::env( 'WP_DB_PASSWORD', static::DEFAULT_DB_PASSWORD ) ), + static::shell_safe( defined( 'DB_HOST' ) ? DB_HOST : static::env( 'WP_DB_HOST', static::DEFAULT_DB_HOST ) ), + static::shell_safe( static::env( 'WP_VERSION', 'latest' ) ), + static::shell_safe( static::env( 'WP_SKIP_DB_CREATE', 'false' ) ), + static::shell_safe( $install_vip_mu_plugins ? 'true' : 'false' ), + static::shell_safe( $install_object_cache ), + ] + )->implode( ' ' ), + ); + + $retval = 0; + $output = static::command( $command, $retval ); + + if ( 0 !== $retval ) { + static::error( '🚨 Error installing WordPress! Output from installation:', 'Install Rsync' ); + static::code( $output ); + exit( 1 ); + } + } + + /** + * Install a plugin to a WordPress codebase through a shell script. + * + * @param string $directory Directory to install WordPress in. + * @param string $plugin Plugin slug to install. + * @param string $version_or_url Plugin version to install OR URL to install from. + */ + public static function install_plugin( string $directory, string $plugin, string $version_or_url = 'latest' ): void { + $branch = static::env( 'MANTLE_CI_BRANCH', 'HEAD' ); + + // Compile the variables to pass to the shell script. + $variables = collect( + [ + [ 'WP_CORE_DIR', $directory ], + ] + ) + ->when( + ! empty( static::env( 'CACHEDIR', '' ) ), + fn ( Collection $collection ) => $collection->push( [ 'CACHEDIR', static::env( 'CACHEDIR', '' ) ] ) + ) + ->map( + fn ( array $item ) => sprintf( 'export %s=%s', $item[0], static::shell_safe( $item[1] ) ) + ) + ->implode( ' && ' ); + + $command = sprintf( + '%s && curl -s %s | bash -s %s', + $variables, + "https://raw.githubusercontent.com/alleyinteractive/mantle-ci/{$branch}/install-plugin.sh", + collect( + [ + $plugin, + $version_or_url, + ] + )->implode( ' ' ), + ); + + $retval = 0; + $output = static::command( $command, $retval ); + + if ( 0 !== $retval ) { + static::error( '🚨 Error installing WordPress! Output from installation:', 'Install Rsync' ); + static::code( $output ); + exit( 1 ); + } + } + + /** + * Check if the command is being run in debug mode. + */ + public static function is_debug_mode(): bool { + if ( defined( 'MANTLE_TESTING_DEBUG' ) && MANTLE_TESTING_DEBUG ) { + return true; + } + + return ! empty( + array_intersect( + (array) ( $_SERVER['argv'] ?? [] ), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized + [ + '--debug', + '--verbose', + '-v', + ], + ) + ); + } + + /** + * Run a system command and return the output. + * + * @param string|string[] $command Command to run. + * @param int $exit_code Exit code. + * @return string[] + */ + public static function command( $command, &$exit_code = null ) { + $is_debug_mode = static::is_debug_mode(); + + // Display the command if in debug mode. + if ( $is_debug_mode ) { + $time = microtime( true ); + + render( + '<div class="p-1"> + Running: + <code>' . implode( ' ', (array) $command ) . '</code> + </div>' + ); + } + + if ( is_array( $command ) ) { + $command = implode( ' ', $command ); + } + + $output = null; + + exec( $command, $output, $exit_code ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.system_calls_exec + + // Display the command runtime if in debug mode. + if ( $is_debug_mode ) { + $time = microtime( true ) - $time; + + render( + '<div class="p-1"> + Finished in ' . number_format( $time, 2 ) . 's with exit code ' . $exit_code . '. + </div>' + ); + } + + return $output; + } + + /** + * Ensure that Composer is loaded for the current environment. + */ + public static function ensure_composer_loaded(): void { + $paths = [ + preg_replace( '#/vendor/.*$#', '/vendor/autoload.php', __DIR__ ), + __DIR__ . '/../../../vendor/autoload.php', + __DIR__ . '/../../vendor/autoload.php', + ]; + + foreach ( $paths as $path ) { + if ( ! is_dir( $path ) && file_exists( $path ) ) { + require_once $path; + + return; + } + } + } + + /** + * Register a shutdown function to handle errors. + * + * Used during the WordPress installation process to catch silent errors. + */ + public static function register_shutdown_function(): void { + register_shutdown_function( [ static::class, 'handle_shutdown' ] ); + } + + /** + * Handle a shutdown error and display it. + */ + public static function handle_shutdown(): void { + $error = error_get_last(); + + if ( ! $error ) { + return; + } + + static::error( '🚨 Error during test run:', 'Shutdown' ); + static::code( $error ); + + exit( 1 ); + } +} diff --git a/vendor/mantle-framework/testing/class-wp-die.php b/vendor/mantle-framework/testing/class-wp-die.php new file mode 100644 index 00000000..63bdb89f --- /dev/null +++ b/vendor/mantle-framework/testing/class-wp-die.php @@ -0,0 +1,195 @@ +<?php +/** + * This file contains the WP_Die helper class + * + * @package Mantle + */ + +namespace Mantle\Testing; + +use Mantle\Testing\Exceptions\WP_Die_Exception; + +/** + * WP_Die helpers. + */ +class WP_Die { + + /** + * Retrieves the `wp_die()` handler. + * + * @return callable The test die handler. + */ + public static function get_handler() { + return [ static::class, 'handler' ]; + } + + /** + * Returns the die handler. + * + * @return callable The die handler. + */ + public static function get_toggled_handler() { + return [ static::class, 'toggled_handler' ]; + } + + /** + * Returns the die handler. + * + * @return callable The die handler. + */ + public static function get_exit_handler() { + return [ static::class, 'exit_handler' ]; + } + + /** + * Handles the WP die handler by outputting the given values as text. + * + * @param string $message The message. + * @param string $title The title. + * @param array $args Array with arguments. + */ + public static function toggled_handler( $message, $title = '', $args = [] ): void { + if ( ! $GLOBALS['_wp_die_disabled'] ) { + static::txt_handler( $message, $title, $args ); + } + } + + /** + * Throws an exception when called. + * + * @throws WP_Die_Exception Exception containing the message. + * + * @param string|\WP_Error $message The `wp_die()` message. + */ + public static function handler( $message ): void { + if ( is_wp_error( $message ) ) { + $message = $message->get_error_message(); + } + + if ( ! is_scalar( $message ) ) { + $message = '0'; + } + + throw new WP_Die_Exception( $message ); + } + + /** + * Dies without an exit. + * + * @param string|\WP_Error $message The message. + * @param string $title The title. + * @param array $args Array with arguments. + */ + public static function txt_handler( $message, $title, $args ): void { + // phpcs:disable WordPress.Security.EscapeOutput + + // Display fatal error information from wp_die(). + if ( is_wp_error( $message ) && 'internal_server_error' === $message->get_error_code() ) { + $error = $message->get_error_data( 'internal_server_error' )['error'] ?? []; + + if ( ! empty( $error ) ) { + + echo "\nwp_die called\n"; + echo "Internal server error: {$error['message']}\n\n"; + + if ( ! empty( $error['file'] ) ) { + echo "File: {$error['file']}\n"; + } + + if ( ! empty( $error['line'] ) ) { + echo "Line: {$error['line']}\n"; + } + + return; + } + } + + [ $message, $title, $args ] = _wp_die_process_input( $message, $title, $args ); + + echo "\nwp_die called\n"; + echo "Message : $message\n"; + echo "Title : $title\n"; + if ( ! empty( $args ) ) { + echo "Args: \n"; + foreach ( $args as $k => $v ) { + if ( is_array( $v ) ) { + continue; + } + + echo "\t $k : $v\n"; + } + } + + // Provide a helper message for database errors after displaying the error message. + if ( false !== strpos( (string) $message, 'database' ) ) { + echo "\n\n"; + printf( + "\033[31m%s \033[0m\n\n", + '🚨 It looks like there was an error connecting to the database. Mantle can help!', + ); + + $path = trailingslashit( ABSPATH ) . 'wp-tests-config.php'; + + // Display debug information if wp-tests-config.php doesn't exist. + if ( ! file_exists( $path ) ) { + echo "Try creating a \033[36mwp-tests-config.php\033[0m file in your project root.\n\n"; + echo "Mantle can help with that. Either run `wp mantle test-config` to generate a configuration or download the latest\n"; + echo "copy to the project root to \033[36m{$path}\033[0m: \n\n"; + echo " \033[33mhttps://raw.githubusercontent.com/alleyinteractive/mantle-framework/HEAD/src/mantle/testing/wp-tests-config-sample.php\033[0m \n\n"; + echo " \033[33mwget https://raw.githubusercontent.com/alleyinteractive/mantle-framework/HEAD/src/mantle/testing/wp-tests-config-sample.php -O $path\033[0m \n\n"; + + echo "Mantle can run without a configuration in place but assumes a default set of configuration.\n"; + echo "🔍 Check if your database is configured to allow access with the default credentials:\n\n"; + + echo "DB_NAME: \033[36m" . Utils::env( 'WP_DB_NAME', Utils::DEFAULT_DB_NAME ) . "\033[0m\n"; + echo "DB_USER: \033[36m" . Utils::env( 'WP_DB_USER', Utils::DEFAULT_DB_USER ) . "\033[0m\n"; + echo "DB_PASSWORD: \033[36m" . Utils::env( 'WP_DB_PASSWORD', Utils::DEFAULT_DB_PASSWORD ) . "\033[0m\n"; + echo "DB_HOST: \033[36m" . Utils::env( 'WP_DB_HOST', Utils::DEFAULT_DB_HOST ) . "\033[0m\n"; + + echo "\n"; + } else { + echo "🔍 Check the configuration settings in \033[36m{$path}\033[0m and ensure you have access to the configured database.\n\n"; + } + } + + // phpcs:enable + } + + /** + * Dies with an exit. + * + * @param string $message The message. + * @param string $title The title. + * @param array $args Array with arguments. + */ + public static function exit_handler( $message, $title, $args ): void { + // phpcs:disable WordPress.Security.EscapeOutput + echo "\nwp_die called\n"; + echo "Message : $message\n"; + echo "Title : $title\n"; + if ( ! empty( $args ) ) { + echo "Args: \n"; + foreach ( $args as $k => $v ) { + echo "\t $k : $v\n"; + } + } + exit( 1 ); + // phpcs:enable + } + + /** + * Disables the WP die handler. + */ + public static function disable(): void { + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals + $GLOBALS['_wp_die_disabled'] = true; + } + + /** + * Enables the WP die handler. + */ + public static function enable(): void { + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals + $GLOBALS['_wp_die_disabled'] = false; + } +} diff --git a/vendor/mantle-framework/testing/class-wp-unittestcase.php b/vendor/mantle-framework/testing/class-wp-unittestcase.php new file mode 100644 index 00000000..88928388 --- /dev/null +++ b/vendor/mantle-framework/testing/class-wp-unittestcase.php @@ -0,0 +1,24 @@ +<?php +/** + * WP_UnitTestCase class file. + * + * To prevent this file from being loaded, set the environment variable + * DISABLE_WP_UNIT_TEST_CASE_SHIM to true. + * + * @package Mantle + */ + +use Mantle\Testing\Concerns\Core_Shim; +use Mantle\Testkit\Test_Case; + +if ( ! class_exists( 'WP_UnitTestCase' ) ) { + /** + * WP_UnitTestCase class file. + * + * Acts as a extension of the TestKit TestCase to make it easier to switch to + * the Mantle Testing Framework. + */ + class WP_UnitTestCase extends Test_Case { + use Core_Shim; + } +} diff --git a/vendor/mantle-framework/testing/composer.json b/vendor/mantle-framework/testing/composer.json new file mode 100644 index 00000000..4fa2d201 --- /dev/null +++ b/vendor/mantle-framework/testing/composer.json @@ -0,0 +1,48 @@ +{ + "name": "mantle-framework/testing", + "description": "The Mantle Framework Testing Package", + "keywords": ["testing", "mantle"], + "type": "library", + "require": { + "php": "^8.1", + "alleyinteractive/composer-wordpress-autoloader": "^1.0", + "mantle-framework/contracts": "^1.0", + "mantle-framework/database": "^1.0", + "mantle-framework/faker": "^1.0", + "mantle-framework/http-client": "^1.0", + "mantle-framework/http": "^1.0", + "mantle-framework/support": "^1.0", + "nunomaduro/termwind": "^1.15.1", + "symfony/css-selector": "^6.2", + "spatie/phpunit-snapshot-assertions": "^4.2 || ^5.1" + }, + "extra": { + "wordpress-autoloader": { + "autoload": { + "Mantle\\Testing": "./" + } + } + }, + "license": "GPL-2.0-or-later", + "authors": [ + { + "name": "Alley", + "email": "mantle@alley.com" + } + ], + "suggest": { + "nunomaduro/collision": "For better PHPUnit printing.", + "mantle-framework/console": "Required to assert console commands.", + "mantle-framework/testkit": "For running tests against a WordPress install without Mantle", + "phpunit/phpunit": "Required to use assertions and run tests." + }, + "config": { + "sort-packages": true + }, + "autoload": { + "files": [ + "autoload.php" + ] + }, + "minimum-stability": "dev" +} diff --git a/vendor/mantle-framework/testing/concerns/trait-admin-screen.php b/vendor/mantle-framework/testing/concerns/trait-admin-screen.php new file mode 100644 index 00000000..386bb6b7 --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-admin-screen.php @@ -0,0 +1,64 @@ +<?php +/** + * This file contains the Admin_Screen trait + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +use WP_Screen; + +/** + * This trait, when used, sets the current screen so that `is_admin()` is true. + */ +trait Admin_Screen { + /** + * Backed up screen. + * + * @var \WP_Screen|null + */ + protected $backup_screen; + + /** + * Backup the current screen. + */ + public function admin_screen_set_up(): void { + /** WordPress Administration Screen API */ + if ( ! class_exists( 'WP_Screen' ) ) { + require_once ABSPATH . 'wp-admin/includes/class-wp-screen.php'; + } + + if ( ! function_exists( 'get_current_screen' ) ) { + require_once ABSPATH . 'wp-admin/includes/screen.php'; + } + + // phpcs:disable WordPress.WP.GlobalVariablesOverride + $GLOBALS['pagenow'] = 'index.php'; + $GLOBALS['wp_importers'] = null; + $GLOBALS['hook_suffix'] = 'index.php'; + $GLOBALS['plugin_page'] = null; + $GLOBALS['typenow'] = ''; + $GLOBALS['taxnow'] = ''; + // phpcs:enable + + $this->backup_screen = get_current_screen(); + set_current_screen( 'dashboard-user' ); + } + + /** + * Restore the backed up screen. + */ + public function admin_screen_tear_down(): void { + // Restore current_screen. + set_current_screen( $this->backup_screen ); + unset( + $GLOBALS['pagenow'], + $GLOBALS['wp_importers'], + $GLOBALS['hook_suffix'], + $GLOBALS['plugin_page'], + $GLOBALS['typenow'], + $GLOBALS['taxnow'] + ); + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-assertions.php b/vendor/mantle-framework/testing/concerns/trait-assertions.php new file mode 100644 index 00000000..3b070c41 --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-assertions.php @@ -0,0 +1,502 @@ +<?php //phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid +/** + * This file contains the Assertions trait + * + * phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_print_r + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +use BackedEnum; +use Mantle\Contracts\Database\Core_Object; +use Mantle\Contracts\Support\Arrayable; +use Mantle\Database\Model\Post; +use Mantle\Database\Model\Term; +use Mantle\Database\Model\User; +use PHPUnit\Framework\Assert as PHPUnit; +use WP_Post; +use WP_Term; + +use function Mantle\Support\Helpers\collect; +use function Mantle\Support\Helpers\get_term_object; + +/** + * Assorted Test_Cast assertions. + */ +trait Assertions { + use Asset_Assertions, + Block_Assertions; + + /** + * Asserts that the given value is an instance of WP_Error. + * + * @param mixed $actual The value to check. + * @param string $message Optional. Message to display when the assertion fails. + */ + public static function assertWPError( $actual, $message = '' ): void { + PHPUnit::assertInstanceOf( 'WP_Error', $actual, $message ); + } + + /** + * Asserts that the given value is not an instance of WP_Error. + * + * @param mixed $actual The value to check. + * @param string $message Optional. Message to display when the assertion fails. + */ + public static function assertNotWPError( $actual, $message = '' ): void { + if ( '' === $message && is_wp_error( $actual ) ) { + $message = $actual->get_error_message(); + } + PHPUnit::assertNotInstanceOf( 'WP_Error', $actual, $message ); + } + + /** + * Asserts that the given fields are present in the given object. + * + * @param object $object The object to check. + * @param array $fields The fields to check. + */ + public static function assertEqualFields( $object, $fields ): void { + foreach ( $fields as $field_name => $field_value ) { + if ( $object->$field_name !== $field_value ) { + PHPUnit::fail(); + } + } + } + + /** + * Asserts that two values are equal, with whitespace differences discarded. + * + * @param string $expected The expected value. + * @param string $actual The actual value. + */ + public static function assertDiscardWhitespace( $expected, $actual ): void { + PHPUnit::assertEquals( preg_replace( '/\s*/', '', $expected ), preg_replace( '/\s*/', '', $actual ) ); + } + + /** + * Asserts that two values are equal, with EOL differences discarded. + * + * @param string $expected The expected value. + * @param string $actual The actual value. + */ + public static function assertEqualsIgnoreEOL( $expected, $actual ): void { + PHPUnit::assertEquals( str_replace( "\r\n", "\n", $expected ), str_replace( "\r\n", "\n", $actual ) ); + } + + /** + * Asserts that the contents of two un-keyed, single arrays are equal, without accounting for the order of elements. + * + * @param array $expected Expected array. + * @param array $actual Array to check. + */ + public static function assertEqualSets( $expected, $actual ): void { + sort( $expected ); + sort( $actual ); + PHPUnit::assertEquals( $expected, $actual ); + } + + /** + * Asserts that the contents of two keyed, single arrays are equal, without accounting for the order of elements. + * + * @param array $expected Expected array. + * @param array $actual Array to check. + */ + public static function assertEqualSetsWithIndex( $expected, $actual ): void { + ksort( $expected ); + ksort( $actual ); + PHPUnit::assertEquals( $expected, $actual ); + } + + /** + * Asserts that the given variable is a multidimensional array, and that all arrays are non-empty. + * + * @param array $array Array to check. + */ + public static function assertNonEmptyMultidimensionalArray( $array ): void { + PHPUnit::assertTrue( is_array( $array ) ); + PHPUnit::assertNotEmpty( $array ); + + foreach ( $array as $sub_array ) { + PHPUnit::assertTrue( is_array( $sub_array ) ); + PHPUnit::assertNotEmpty( $sub_array ); + } + } + + /** + * Checks each of the WP_Query is_* functions/properties against expected + * boolean value. + * + * Any properties that are listed by name as parameters will be expected to be + * true; all others are expected to be false. For example, + * assertQueryTrue( 'is_single', 'is_feed' ) means is_single() and is_feed() + * must be true and everything else must be false to pass. + * + * @param string ...$prop Any number of WP_Query properties that are expected + * to be true for the current request. + */ + public static function assertQueryTrue( ...$prop ): void { + global $wp_query; + + $all = [ + 'is_404', + 'is_admin', + 'is_archive', + 'is_attachment', + 'is_author', + 'is_category', + 'is_comment_feed', + 'is_date', + 'is_day', + 'is_embed', + 'is_feed', + 'is_front_page', + 'is_home', + 'is_privacy_policy', + 'is_month', + 'is_page', + 'is_paged', + 'is_post_type_archive', + 'is_posts_page', + 'is_preview', + 'is_robots', + 'is_favicon', + 'is_search', + 'is_single', + 'is_singular', + 'is_tag', + 'is_tax', + 'is_time', + 'is_trackback', + 'is_year', + ]; + + foreach ( $prop as $true_thing ) { + PHPUnit::assertContains( $true_thing, $all, "Unknown conditional: {$true_thing}." ); + } + + $passed = true; + $message = ''; + + foreach ( $all as $query_thing ) { + $result = is_callable( $query_thing ) ? call_user_func( $query_thing ) : $wp_query->$query_thing; + + if ( in_array( $query_thing, $prop, true ) ) { + if ( ! $result ) { + $message .= $query_thing . ' is false but is expected to be true. ' . PHP_EOL; + $passed = false; + } + } elseif ( $result ) { + $message .= $query_thing . ' is true but is expected to be false. ' . PHP_EOL; + $passed = false; + } + } + + if ( ! $passed ) { + PHPUnit::fail( $message ); + } + } + + /** + * Assert that a given ID matches the global queried object ID. + * + * @param int $id Expected ID. + */ + public static function assertQueriedObjectId( int $id ): void { + PHPUnit::assertSame( $id, get_queried_object_id(), 'Queried object ID is not the same.' ); + } + + /** + * Assert that a given ID does not the global queried object ID. + * + * @param int $id Expected ID. + */ + public static function assertNotQueriedObjectId( int $id ): void { + PHPUnit::assertNotSame( $id, get_queried_object_id(), 'Queried object ID is the same.' ); + } + + /** + * Assert that a given object is equivalent to the global queried object. + * + * @param mixed $object Expected object. + * @param bool $strict Whether to assert the same object type or just the same identifying data. + */ + public static function assertQueriedObject( mixed $object, bool $strict = false ): void { + $queried_object = get_queried_object(); + + // Assert the same object types if strict mode. + if ( $strict ) { + PHPUnit::assertInstanceOf( $object::class, $queried_object ); + } + + // Next, assert identifying data about the object. + match ( true ) { + $object instanceof Post || $object instanceof User => PHPUnit::assertSame( $object->id(), $queried_object->ID, 'Queried object ID is not the same.' ), + $object instanceof Term => PHPUnit::assertSame( $object->id(), $queried_object->term_id, 'Queried object ID is not the same.' ), + $object instanceof \WP_Post || $object instanceof \WP_User => PHPUnit::assertSame( $object->ID, $queried_object->ID, 'Queried object ID is not the same.' ), + $object instanceof \WP_Term => PHPUnit::assertSame( $object->term_id, $queried_object->term_id, 'Queried object ID is not the same.' ), + $object instanceof \WP_Post_Type => PHPUnit::assertSame( $object->name, $queried_object->name, 'Queried object name is not the same.' ), + default => PHPUnit::fail( 'Unknown object type.' ), + }; + } + + /** + * Assert that a given object is not equivalent to the global queried object. + * + * @param mixed $object Expected object. + */ + public static function assertNotQueriedObject( mixed $object ): void { + $queried_object = get_queried_object(); + + match ( true ) { + $object instanceof Post || $object instanceof User => PHPUnit::assertNotSame( $object->id(), $queried_object->ID, 'Queried object ID is the same.' ), + $object instanceof Term => PHPUnit::assertNotSame( $object->id(), $queried_object->term_id, 'Queried object ID is the same.' ), + $object instanceof \WP_Post || $object instanceof \WP_User => PHPUnit::assertNotSame( $object->ID, $queried_object->ID, 'Queried object ID is the same.' ), + $object instanceof \WP_Term => PHPUnit::assertNotSame( $object->term_id, $queried_object->term_id, 'Queried object ID is the same.' ), + $object instanceof \WP_Post_Type => PHPUnit::assertNotSame( $object->name, $queried_object->name, 'Queried object name is the same.' ), + default => PHPUnit::fail( 'Unknown object type.' ), + }; + } + + /** + * Assert that the queried object is null. + */ + public static function assertQueriedObjectNull(): void { + PHPUnit::assertNull( get_queried_object(), 'Queried object is not null.' ); + } + + /** + * Assert if a post exists given a set of arguments. + * + * @param array $arguments Arguments to query against. + */ + public function assertPostExists( array $arguments ): void { + $arguments = $this->serialize_arguments( + $arguments, + [ + 'fields' => 'ids', + 'posts_per_page' => 1, + ], + ); + + PHPUnit::assertNotEmpty( + \get_posts( $arguments ), + "Post not found with arguments: \n" . print_r( $arguments, true ), + ); + } + + /** + * Assert if a post does not exist given a set of arguments. + * + * @param array $arguments Arguments to query against. + */ + public function assertPostDoesNotExists( array $arguments ): void { + $arguments = $this->serialize_arguments( + $arguments, + [ + 'fields' => 'ids', + 'posts_per_page' => 1, + ], + ); + + PHPUnit::assertEmpty( + \get_posts( $arguments ), + "Post found with arguments: \n" . print_r( $arguments, true ), + ); + } + + /** + * Assert if a term exists given a set of arguments. + * + * @param array $arguments Arguments to query against. + */ + public function assertTermExists( array $arguments ): void { + $arguments = $this->serialize_arguments( + $arguments, + [ + 'fields' => 'ids', + 'count' => 1, + 'hide_empty' => false, + ], + ); + + PHPUnit::assertNotEmpty( + \get_terms( $arguments ), + "Term not found with arguments: \n" . print_r( $arguments, true ), + ); + } + + /** + * Assert if a term does not exist given a set of arguments. + * + * @param array $arguments Arguments to query against. + */ + public function assertTermDoesNotExists( array $arguments ): void { + $arguments = $this->serialize_arguments( + $arguments, + [ + 'fields' => 'ids', + 'count' => 1, + 'hide_empty' => false, + ], + ); + + PHPUnit::assertEmpty( + \get_terms( $arguments ), + "Term found with arguments: \n" . print_r( $arguments, true ), + ); + } + + /** + * Assert if a user exists given a set of arguments. + * + * @param array $arguments Arguments to query against. + */ + public function assertUserExists( array $arguments ): void { + $arguments = $this->serialize_arguments( + $arguments, + [ + 'fields' => 'ids', + 'count' => 1, + ], + ); + + PHPUnit::assertNotEmpty( + \get_users( $arguments ), + "User not found with arguments: \n" . print_r( $arguments, true ), + ); + } + + /** + * Assert if a user does not exist given a set of arguments. + * + * @param array $arguments Arguments to query against. + */ + public function assertUserDoesNotExists( array $arguments ): void { + $arguments = $this->serialize_arguments( + $arguments, + [ + 'fields' => 'ids', + 'count' => 1, + ], + ); + + PHPUnit::assertEmpty( + \get_users( $arguments ), + "User found with arguments: \n" . print_r( $arguments, true ), + ); + } + + /** + * Get a term object from a flexible argument. + * + * @param mixed $argument Term object, term ID, or term slug. + */ + protected function get_term_from_argument( $argument ): ?WP_Term { + if ( $argument instanceof Term ) { + return $argument->core_object(); + } + + if ( is_int( $argument ) ) { + return get_term_object( $argument ); + } + + if ( $argument instanceof WP_Term ) { + return $argument; + } + + return null; + } + + /** + * Assert that a post has a specific term. + * + * `assertPostNotHasTerm()` is the inverse of this method. + * + * @param Post|\WP_Post|int $post Post to check. + * @param Term|\WP_Term|int $term Term to check. + */ + public function assertPostHasTerm( Post|WP_Post|int $post, Term|WP_Term|int $term ): void { + if ( $post instanceof Post ) { + $post = $post->id(); + } + + $term = $this->get_term_from_argument( $term ); + + PHPUnit::assertInstanceOf( \WP_Term::class, $term, 'Term not found to assert against' ); + PHPUnit::assertTrue( \has_term( $term->term_id, $term->taxonomy, $post ), 'Term not found on post' ); + } + + /** + * Assert that a post doesn't have a specific term. + * + * `assertPostHasTerm()` is the inverse of this method. + * + * @param Post|\WP_Post|int $post Post to check. + * @param Term|\WP_Term|int $term Term to check. + */ + public function assertPostNotHasTerm( Post|WP_Post|int $post, Term|WP_Term|int $term ): void { + if ( $post instanceof Post ) { + $post = $post->id(); + } + + $term = $this->get_term_from_argument( $term ); + + if ( $term ) { + PHPUnit::assertFalse( \has_term( $term->term_id, $term->taxonomy, $post ), 'Term found on post' ); + } + } + + /** + * Alias of `assertPostNotHasTerm()`. + * + * @param Post|\WP_Post|int $post Post to check. + * @param Term|\WP_Term|int $term Term to check. + */ + public function assertPostsDoesNotHaveTerm( Post|WP_Post|int $post, Term|WP_Term|int $term ): void { + $this->assertPostNotHasTerm( $post, $term ); + } + + /** + * Serialize arguments for use in assertions. + * + * Convert string-backed enums to an array of all possible values from an enumeration. + * + * @param array $arguments Arguments to serialize. + * @param array $defaults Default values. + */ + protected function serialize_arguments( array $arguments, array $defaults = [] ): array { + $arguments = array_merge( $defaults, $arguments ); + + foreach ( $arguments as $key => $value ) { + if ( $value instanceof Arrayable ) { + $arguments[ $key ] = $value->to_array(); + } + + // Check for PHP 8.1+ support. + if ( interface_exists( BackedEnum::class ) ) { + // Convert an enum to an array of all possible values. + if ( is_string( $value ) && enum_exists( $value ) && is_subclass_of( $value, BackedEnum::class ) ) { + $arguments[ $key ] = collect( $value::cases() )->pluck( 'value' )->all(); + } + + // Convert an enum object to its value. + if ( is_object( $value ) && $value instanceof BackedEnum ) { + $arguments[ $key ] = $value->value; + } + + // Convert an array of enum objects to an array of their values. + if ( is_array( $value ) ) { + $arguments[ $key ] = array_map( + fn ( $item ) => is_object( $item ) && $item instanceof BackedEnum ? $item->value : $item, + $value, + ); + } + } + } + + return $arguments; + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-asset-assertions.php b/vendor/mantle-framework/testing/concerns/trait-asset-assertions.php new file mode 100644 index 00000000..f3f3320a --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-asset-assertions.php @@ -0,0 +1,97 @@ +<?php //phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid +/** + * Asset_Assertions trait file + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +/** + * Assorted Test_Cast assertions. + */ +trait Asset_Assertions { + /** + * Assert that a script is matching a specific status. + * + * @param string $handle Script handle. + * @param string $status Script status. + */ + public function assertScriptStatus( string $handle, string $status ): void { + // Fire the enqueue scripts hook to ensure the scripts are loaded. + if ( ! did_action( 'wp_enqueue_scripts' ) ) { + do_action( 'wp_enqueue_scripts' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound + } + + $this->assertTrue( wp_script_is( $handle, $status ), "Script {$handle} is not {$status}" ); + } + + /** + * Assert that a style is matching a specific status. + * + * @param string $handle Style handle. + * @param string $status Style status. + */ + public function assertStyleStatus( string $handle, string $status ): void { + // Fire the enqueue scripts hook to ensure the scripts are loaded. + if ( ! did_action( 'wp_enqueue_scripts' ) ) { + do_action( 'wp_enqueue_scripts' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound + } + + $this->assertTrue( wp_style_is( $handle, $status ), "Style {$handle} is not {$status}" ); + } + + /** + * Assert that a script is enqueued. + * + * @param string $handle Script handle. + */ + public function assertScriptEnqueued( string $handle ): void { + $this->assertScriptStatus( $handle, 'enqueued' ); + } + + /** + * Assert that a script is not enqueued. + * + * @param string $handle Script handle. + */ + public function assertScriptNotEnqueued( string $handle ): void { + $this->assertScriptStatus( $handle, 'registered' ); + } + + /** + * Assert that a style is enqueued. + * + * @param string $handle Style handle. + */ + public function assertStyleEnqueued( string $handle ): void { + $this->assertStyleStatus( $handle, 'enqueued' ); + } + + /** + * Assert that a style is not enqueued. + * + * @param string $handle Style handle. + */ + public function assertStyleNotEnqueued( string $handle ): void { + $this->assertStyleStatus( $handle, 'registered' ); + } + + /** + * Assert that a script is registered. + * + * @param string $handle Script handle. + */ + public function assertScriptRegistered( string $handle ): void { + $this->assertScriptStatus( $handle, 'registered' ); + } + + /** + * Assert that a style is registered. + * + * @param string $handle Style handle. + */ + public function assertStyleRegistered( string $handle ): void { + $this->assertStyleStatus( $handle, 'registered' ); + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-block-assertions.php b/vendor/mantle-framework/testing/concerns/trait-block-assertions.php new file mode 100644 index 00000000..70f24892 --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-block-assertions.php @@ -0,0 +1,155 @@ +<?php +/** + * Block_Assertions trait file + * + * phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_print_r, WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +use Mantle\Database\Model\Post; +use WP_Post; + +use function Alley\WP\match_blocks; +use function Mantle\Support\Helpers\collect; + +/** + * Assorted Block assertions + * + * @mixin \PHPUnit\Framework\TestCase + */ +trait Block_Assertions { + /** + * Assert that a string can match a block. + * + * The arguments are passed directly to `match_block()`. + * + * @see \Alley\WP\match_block() + * + * @param string $string The string to check. + * @param array $args The arguments to pass to `match_block()`. + */ + public function assertStringMatchesBlock( string $string, array $args ): void { + $this->assertNotEmpty( + match_blocks( $string, $args ), + 'Failed asserting that string matches block with arguments ' . print_r( $args, true ), + ); + } + + /** + * Assert that a string does not match a block. + * + * The arguments are passed directly to `match_block()`. + * + * @see \Alley\WP\match_block() + * + * @param string $string The string to check. + * @param array $args The arguments to pass to `match_block()`. + */ + public function assertStringNotMatchesBlock( string $string, array $args ): void { + $this->assertEmpty( + match_blocks( $string, $args ), + 'Failed asserting that string does not match block with arguments ' . print_r( $args, true ), + ); + } + + /** + * Assert that a string has a block. + * + * @param string $string The string to check. + * @param string|string[] $block_name The block name(s) to check for. Will attempt to match any of the names. + * @param array $attrs Optional. Attributes to check for. + */ + public function assertStringHasBlock( string $string, string|array $block_name, array $attrs = [] ): void { + $this->assertNotEmpty( + match_blocks( + $string, + [ + 'attrs' => $this->convert_arguments_for_matching( $attrs ), + 'name' => $block_name, + ], + ), + ! empty( $attrs ) + ? "Failed asserting that string has block [{$block_name}] with attributes " . print_r( $attrs, true ) + : "Failed asserting that string has block [{$block_name}]." + ); + } + + /** + * Assert that a string does not have a block. + * + * @param string $string The string to check. + * @param string|string[] $block_name The block name(s) to check for. Will attempt to match any of the names. + * @param array $attrs Optional. Attributes to check for. + */ + public function assertStringNotHasBlock( string $string, string|array $block_name, array $attrs = [] ): void { + $this->assertEmpty( + match_blocks( + $string, + [ + 'attrs' => $this->convert_arguments_for_matching( $attrs ), + 'name' => $block_name, + ], + ), + ! empty( $attrs ) + ? "Failed asserting that string does not have block [{$block_name}] with attributes " . print_r( $attrs, true ) + : "Failed asserting that string does not have block [{$block_name}]", + ); + } + + /** + * Assert that a post has a block in its content. + * + * @param Post|WP_Post $post The post to check. + * @param string|string[] $block_name The block name(s) to check for. Will attempt to match any of the names. + * @param array $attrs Optional. Attributes to check for. + */ + public function assertPostHasBlock( Post|WP_Post $post, string|array $block_name, array $attrs = [] ): void { + $this->assertStringHasBlock( $post->post_content, $block_name, $attrs ); + } + + /** + * Assert that a post does not have a block in its content. + * + * @param Post|WP_Post $post The post to check. + * @param string|string[] $block_name The block name(s) to check for. Will attempt to match any of the names. + * @param array $attrs Optional. Attributes to check for. + */ + public function assertPostNotHasBlock( Post|WP_Post $post, string|array $block_name, array $attrs = [] ): void { + $this->assertStringNotHasBlock( $post->post_content, $block_name, $attrs ); + } + + /** + * Convert the key/value arguments to an array that can be passed to + * `match_block()`. + * + * @param array $args The arguments to convert. + */ + protected function convert_arguments_for_matching( array $args ): array { + // PHPCS is crashing on these lines for some reason. Disabling it for now + // until we've upgrading to WPCS 3.0. + + /* phpcs:disable */ + return collect( $args )->reduce( + function ( array $carry, $value, $key ) { + // Allow for passing an argument pair directly. + if ( is_array( $value ) && isset( $value['key'], $value['value'] ) ) { + $carry[] = $value; + + return $carry; + } + + $carry[] = [ + $key => $value, + 'value' => $value, + ]; + + return $carry; + }, + [] + ); + /* phpcs:enable */ + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-core-shim.php b/vendor/mantle-framework/testing/concerns/trait-core-shim.php new file mode 100644 index 00000000..2f8eedf1 --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-core-shim.php @@ -0,0 +1,84 @@ +<?php +/** + * Core_Shim trait file + * + * phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +use WP_Error; + +/** + * Core Shims + * + * @mixin \PHPUnit\Framework\TestCase + */ +trait Core_Shim { + use Refresh_Database; + + /** + * Fake 'set_up' method to allow for easier transition and some PHPUnit 8 + * compatibility. + */ + public function set_up() { + // Do nothing. + } + + /** + * Fake 'tear_down' method to allow for easier transition and some PHPUnit 8 + * compatibility. + */ + public function tear_down() { + // Do nothing. + } + + /** + * Allows tests to be skipped when Multisite is not in use. + * + * Use in conjunction with the ms-required group. + */ + public function skipWithoutMultisite(): void { + if ( ! is_multisite() ) { + $this->markTestSkipped( 'Test only runs on Multisite' ); + } + } + + /** + * Allows tests to be skipped when Multisite is in use. + * + * Use in conjunction with the ms-excluded group. + */ + public function skipWithMultisite(): void { + if ( is_multisite() ) { + $this->markTestSkipped( 'Test does not run on Multisite' ); + } + } + + /** + * Allows tests to be skipped if the HTTP request times out. + * + * @deprecated Not encouraged for use in Mantle. Remote requests should be mocked. + * + * @param array|WP_Error $response HTTP response. + */ + public function skipTestOnTimeout( $response ): void { + if ( ! is_wp_error( $response ) ) { + return; + } + + if ( 'connect() timed out!' === $response->get_error_message() ) { + $this->markTestSkipped( 'HTTP timeout' ); + } + + if ( false !== strpos( $response->get_error_message(), 'timed out after' ) ) { + $this->markTestSkipped( 'HTTP timeout' ); + } + + if ( str_starts_with( $response->get_error_message(), 'stream_socket_client(): unable to connect to tcp://s.w.org:80' ) ) { + $this->markTestSkipped( 'HTTP timeout' ); + } + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-create-application.php b/vendor/mantle-framework/testing/concerns/trait-create-application.php new file mode 100644 index 00000000..d1b4b2dc --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-create-application.php @@ -0,0 +1,126 @@ +<?php +/** + * Create_Application trait file. + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +use Mantle\Application\Application; +use Mantle\Config\Repository; +use Mantle\Contracts\Exceptions\Handler as Handler_Contract; +use Mantle\Framework\Bootloader; +use Mantle\Framework\Exceptions\Handler; +use Mantle\Support\Collection; + +/** + * Concern for creating the application instance. + */ +trait Create_Application { + /** + * Creates the application. + * + * @return Application + */ + public function create_application(): \Mantle\Contracts\Application { + Bootloader::create( $app = new Application() ) + ->with_config( + [ + 'view' => [ + 'compiled' => sys_get_temp_dir(), + ], + ...$this->override_application_config( $app ), + ] + ); + + $app = new Application(); + + $this->resolve_application_core( $app ); + $this->resolve_application_bindings( $app ); + + return $app; + } + + /** + * Override application bindings, to be overridden by the child unit test. + * + * @param Application $app Application instance. + * @return array + */ + protected function override_application_bindings( $app ) { + return []; + } + + /** + * Resolve application bindings. + * + * @param Application $app Application instance. + */ + final protected function resolve_application_bindings( $app ): void { + $app->singleton( Handler_Contract::class, Handler::class ); + + foreach ( $this->override_application_bindings( $app ) as $original => $replacement ) { + $app->bind( $original, $replacement ); + } + } + + /** + * Configuration for the test. + * + * @param Application $app Application instance. + */ + protected function override_application_config( $app ): array { + return []; + } + + /** + * Resolve application core configuration. + * + * @param Application $app Application instance. + */ + protected function resolve_application_core( $app ) { + $app->make( \Mantle\Framework\Bootstrap\Load_Configuration::class )->bootstrap( $app ); + $app->make( \Mantle\Framework\Bootstrap\Register_Aliases::class )->bootstrap( $app ); + $app->make( \Mantle\Framework\Bootstrap\Register_Providers::class )->bootstrap( $app ); + $app->make( \Mantle\Framework\Bootstrap\Boot_Providers::class )->bootstrap( $app ); + } + + /** + * Get application providers. + * + * @param Application $app Application instance. + * @return array + */ + protected function get_application_providers( $app ) { + return $app['config']['app.providers']; + } + + /** + * Override application aliases. + * + * @param Application $app Application instance. + * @return array + */ + protected function override_application_providers( $app ) { + return []; + } + + /** + * Resolve application aliases. + * + * @param Application $app Application instance. + */ + final protected function resolve_application_providers( $app ): array { + $providers = new Collection( $this->get_application_providers( $app ) ); + $overrides = $this->override_application_providers( $app ); + + if ( ! empty( $overrides ) ) { + $providers->transform( + static fn ( $provider) => $overrides[ $provider ] ?? $provider + ); + } + + return $providers->all(); + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-dependency-assertions.php b/vendor/mantle-framework/testing/concerns/trait-dependency-assertions.php new file mode 100644 index 00000000..0ea9160f --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-dependency-assertions.php @@ -0,0 +1,68 @@ +<?php //phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid +/** + * Dependency_Assertions trait file + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +use PHPUnit\Framework\Assert as PHPUnit; +use Mantle\Support\Collection; + +trait Dependency_Assertions { + + /** + * Asserts that the contents of an array are loaded prior to testing. + * + * Array can be an array of strings or an array of arrays where the first value is a string -- for instance, + * a data provider. + * + * @param array $dependencies Dependencies array. + */ + public static function assertDependenciesLoaded( array $dependencies ): void { + if ( count( $dependencies ) === 0 ) { + PHPUnit::markTestIncomplete( 'Asserting an empty dependency array has been loaded does not assert that no dependencies have been loaded.' ); + } + + foreach ( $dependencies as $dependency ) { + if ( is_array( $dependency ) ) { + $dependency = array_shift( $dependency ); + } + + if ( ! is_string( $dependency ) ) { + PHPUnit::fail( 'Dependency type not string.' ); + continue; + } + + self::assertDependencyLoaded( $dependency ); + } + } + + /** + * Asserts that a file is loaded. + * + * @param string $dependency The dependency file name. + */ + public static function assertDependencyLoaded( string $dependency ): void { + static $includes; + + if ( + ! is_array( $includes ) || + empty( $includes ) + ) { + $includes = new Collection( get_included_files() ); + } + + PHPUnit::assertTrue( + $includes + ->filter( fn ( $file ) => strpos( $file, $dependency ) !== false ) + ->count() > 0, + sprintf( + '%s dependency not found in included files.', + $dependency + ) + ); + } + +} diff --git a/vendor/mantle-framework/testing/concerns/trait-deprecations.php b/vendor/mantle-framework/testing/concerns/trait-deprecations.php new file mode 100644 index 00000000..8d571470 --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-deprecations.php @@ -0,0 +1,176 @@ +<?php +/** + * This file contains the Deprecations Trait + * + * @package Mantle + */ + +// phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid + +namespace Mantle\Testing\Concerns; + +use Mantle\Support\Str; +use Mantle\Testing\Attributes\Expected_Deprecation; +use Mantle\Testing\Attributes\Ignore_Deprecation; + +use function Mantle\Support\Helpers\collect; + +trait Deprecations { + use Output_Messages, Reads_Annotations; + + /** + * Expected deprecation calls. + * + * @var array + */ + private $expected_deprecated = []; + + /** + * Ignored deprecation calls. + * + * @var string[] + */ + private $ignored_deprecated = []; + + /** + * Caught deprecated calls. + * + * @var array + */ + private $caught_deprecated = []; + + /** + * Trace storage for deprecated calls. + */ + private array $caught_deprecated_traces = []; + + /** + * Sets up the expectations for testing a deprecated call. + */ + public function deprecations_set_up(): void { + $annotations = $this->get_annotations_for_method(); + + foreach ( [ 'class', 'method' ] as $depth ) { + if ( ! empty( $annotations[ $depth ]['expectedDeprecated'] ) ) { + $this->expected_deprecated = array_merge( $this->expected_deprecated, $annotations[ $depth ]['expectedDeprecated'] ); + } + } + + add_action( 'deprecated_function_run', [ $this, 'deprecated_function_run' ] ); + add_action( 'deprecated_argument_run', [ $this, 'deprecated_function_run' ] ); + add_action( 'deprecated_hook_run', [ $this, 'deprecated_function_run' ] ); + add_action( 'deprecated_function_trigger_error', '__return_false' ); // @phpstan-ignore-line Action callback returns false + add_action( 'deprecated_argument_trigger_error', '__return_false' ); // @phpstan-ignore-line Action callback returns false + add_action( 'deprecated_hook_trigger_error', '__return_false' ); // @phpstan-ignore-line Action callback returns false + + // Allow attributes to define the expected and ignored deprecations. + foreach ( $this->get_attributes_for_method( Expected_Deprecation::class ) as $attribute ) { + $this->setExpectedDeprecated( $attribute->newInstance()->deprecation ); + } + + foreach ( $this->get_attributes_for_method( Ignore_Deprecation::class ) as $attribute ) { + $this->ignoreDeprecated( $attribute->newInstance()->deprecation ); + } + } + + /** + * Handles a deprecated expectation. + * + * The DocBlock should contain `@expectedDeprecated` to trigger this. + */ + public function deprecations_tear_down(): void { + $errors = []; + + $not_caught_deprecated = array_diff( $this->expected_deprecated, $this->caught_deprecated ); + foreach ( $not_caught_deprecated as $not_caught ) { + $errors[] = "Failed to assert that $not_caught triggered a deprecated notice"; + } + + $unexpected_deprecated = collect( $this->caught_deprecated ) + ->filter( + function ( string $caught ): bool { + $ignored_and_expected = array_merge( $this->expected_deprecated, $this->ignored_deprecated ); + + if ( in_array( $caught, $ignored_and_expected, true ) ) { + return false; + } + + // Allow partial matches when ignoring a deprecation call. + foreach ( $this->ignored_deprecated as $ignored ) { + if ( Str::is( $ignored, $caught ) ) { + return false; + } + } + + return true; + } + ) + ->all(); + + foreach ( $unexpected_deprecated as $index => $unexpected ) { + if ( ! empty( $this->caught_deprecated_traces[ $index ] ) ) { + static::trace( + "Unexpected deprecated notice for $unexpected", + $this->caught_deprecated_traces[ $index ], + ); + } + + $errors[] = $unexpected; + } + + // Perform an assertion, but only if there are expected or unexpected deprecated calls or wrongdoings. + if ( + ! empty( $this->expected_deprecated ) + || ! empty( $this->caught_deprecated ) + ) { + if ( ! empty( $errors ) ) { + $this->fail( 'Unexpected deprecated notices: ' . implode( ', ', $errors ) ); + } else { + $this->assertTrue( true ); + } + } + } + + /** + * Declare an expected `_deprecated_function()` or `_deprecated_argument()` + * call from within a test. + * + * Note: If a deprecation call isn't made within the test, the test will fail. + * To ignore the deprecation entirely, use {@see Deprecations::setExpectedDeprecated()}. + * + * @param string $deprecated Name of the function, method, class, or argument + * that is deprecated. Must match the first + * parameter of the `_deprecated_function()` or + * `_deprecated_argument()` call. + */ + public function setExpectedDeprecated( string $deprecated ): void { + $this->expected_deprecated[] = $deprecated; + } + + /** + * Ignore a deprecation call from within a test. + * + * Supports partial matches using `Str::is()` syntax with * as a wildcard. + * + * @param string $deprecated Name of the function, method, class, or argument + * that is deprecated. Must match the first + * parameter of the `_deprecated_function()` or + * `_deprecated_argument()` call. + */ + public function ignoreDeprecated( $deprecated = '*' ): void { + $this->ignored_deprecated[] = $deprecated; + } + + /** + * Adds a deprecated function to the list of caught deprecated calls. + * + * @param string $function The deprecated function. + */ + public function deprecated_function_run( $function ): void { + if ( ! in_array( $function, $this->caught_deprecated, true ) ) { + $this->caught_deprecated[] = $function; + + $this->caught_deprecated_traces[] = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 10 ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_debug_backtrace + } + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-element-assertions.php b/vendor/mantle-framework/testing/concerns/trait-element-assertions.php new file mode 100644 index 00000000..0b46d069 --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-element-assertions.php @@ -0,0 +1,283 @@ +<?php //phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid +/** + * Element_Assertions trait file + * + * phpcs:disable Squiz.Commenting.FunctionComment.ParamNameNoMatch, Squiz.Commenting.FunctionComment.MissingParamTag + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +use PHPUnit\Framework\Assert as PHPUnit; +use DOMDocument; +use DOMNode; +use DOMXPath; +use Symfony\Component\CssSelector\CssSelectorConverter; + +/** + * Assorted Test_Cast assertions for checking for elements in a response. + */ +trait Element_Assertions { + /** + * DOM Document Storage. + */ + protected DOMDocument $document; + + /** + * Retrieve the DOM Document for the response. + */ + protected function get_dom_document(): DOMDocument { + if ( isset( $this->document ) ) { + return $this->document; + } + + libxml_use_internal_errors( true ); + + $this->document = new DOMDocument(); + $this->document->loadHTML( $this->get_content() ); + + return $this->document; + } + + /** + * Convert a CSS selector to an XPath query. + * + * @param string $selector The selector to convert. + */ + protected function convert_query_selector( string $selector ): string { + $converter = new CssSelectorConverter( true ); + + return $converter->toXPath( $selector ); + } + + /** + * Assert that an element exists in the response. + * + * @param string $expression The XPath expression to execute. + * @param string $message Optional message to display on failure. + */ + public function assertElementExists( string $expression, string $message = null ): static { + $nodes = ( new DOMXPath( $this->get_dom_document() ) )->query( $expression ); + + PHPUnit::assertTrue( + ! $nodes ? false : $nodes->length > 0, + $message ?? 'Element not found for expression: ' . $expression, + ); + + return $this; + } + + /** + * Assert that an element exists by its ID. + * + * @param string $id The ID of the element to check. + */ + public function assertElementExistsById( string $id ): static { + if ( str_starts_with( $id, '#' ) ) { + $id = substr( $id, 1 ); + } + + return $this->assertElementExists( sprintf( '//*[@id="%s"]', $id ), "Element not found for ID: $id" ); + } + + /** + * Assert that an element exists by its class name. + * + * @param string $classname The classname of the element to check. + */ + public function assertElementExistsByClassName( string $classname ): static { + if ( str_starts_with( $classname, '.' ) ) { + $classname = substr( $classname, 1 ); + } + + return $this->assertElementExists( + sprintf( '//*[contains(concat(" ", normalize-space(@class), " "), " %s ")]', $classname ), + "Element not found for class: $classname" + ); + } + + /** + * Assert that an element is missing in the response. + * + * @param string $expression The XPath expression to execute. + * @param string $message The message to display if the assertion fails. + */ + public function assertElementMissing( string $expression, string $message = null ): static { + $nodes = ( new DOMXPath( $this->get_dom_document() ) )->query( $expression ); + + PHPUnit::assertTrue( + false === $nodes || 0 === $nodes->length, + $message ?? "Element found for expression: $expression" + ); + + return $this; + } + + /** + * Assert that an element is missing by its ID. + * + * @param string $id The ID of the element to check. + */ + public function assertElementMissingById( string $id ): static { + if ( str_starts_with( $id, '#' ) ) { + $id = substr( $id, 1 ); + } + + return $this->assertElementMissing( sprintf( '//*[@id="%s"]', $id ), "Element found for ID: $id" ); + } + + /** + * Assert that an element is missing by its class name. + * + * @param string $classname The classname of the element to check. + */ + public function assertElementMissingByClassName( string $classname ): static { + if ( str_starts_with( $classname, '.' ) ) { + $classname = substr( $classname, 1 ); + } + + return $this->assertElementMissing( sprintf( '//*[contains(concat(" ", normalize-space(@class), " "), " %s ")]', $classname ) ); + } + + /** + * Assert that an element exists by tag name. + * + * @param string $type The type of element to check. + */ + public function assertElementExistsByTagName( string $type ): static { + return $this->assertElementExists( sprintf( '//*[local-name()="%s"]', $type ), "Element not found for tag: $type" ); + } + + /** + * Assert that an element is missing by tag name. + * + * @param string $type The type of element to check. + */ + public function assertElementMissingByTagName( string $type ): static { + return $this->assertElementMissing( sprintf( '//*[local-name()="%s"]', $type ), "Element found for tag: $type" ); + } + + /** + * Assert that an element exists by query selector. + * + * @param string $selector The selector to use. + */ + public function assertElementExistsByQuerySelector( string $selector ): static { + return $this->assertElementExists( $this->convert_query_selector( $selector ), "Element not found for selector: $selector" ); + } + + /** + * Alias for assertElementExistsByQuerySelector. + * + * @param string $selector + */ + public function assertQuerySelectorExists( string $selector ): static { + return $this->assertElementExistsByQuerySelector( $selector ); + } + + /** + * Assert that an element is missing by query selector. + * + * @param string $selector The selector to use. + */ + public function assertElementMissingByQuerySelector( string $selector ): static { + return $this->assertElementMissing( $this->convert_query_selector( $selector ), "Element found for selector: $selector" ); + } + + /** + * Alias for assertElementMissingByQuerySelector. + * + * @param string $selector + */ + public function assertQuerySelectorMissing( string $selector ): static { + return $this->assertElementMissingByQuerySelector( $selector ); + } + + /** + * Assert against the expected number of elements for an expression. + * + * @param string $expression The XPath expression to execute. + * @param int $expected The expected number of elements. + */ + public function assertElementCount( string $expression, int $expected ): static { + $nodes = ( new DOMXPath( $this->get_dom_document() ) )->query( $expression ); + + PHPUnit::assertEquals( $expected, $nodes->length, 'Unexpected number of elements found.' ); + + return $this; + } + + /** + * Assert against the expected number of elements for a query selector. + * + * @param string $selector The selector to use. + * @param int $expected The expected number of elements. + */ + public function assertQuerySelectorCount( string $selector, int $expected ): static { + return $this->assertElementCount( $this->convert_query_selector( $selector ), $expected ); + } + + /** + * Assert an element exists by test ID. + * + * @param string $test_id The test ID to check. + */ + public function assertElementExistsByTestId( string $test_id ): static { + return $this->assertQuerySelectorExists( "[data-testid=\"$test_id\"]" ); + } + + /** + * Assert an element is missing by test ID. + * + * @param string $test_id The test ID to check. + */ + public function assertElementMissingByTestId( string $test_id ): static { + return $this->assertQuerySelectorMissing( "[data-testid=\"$test_id\"]" ); + } + + /** + * Assert that an element passes a custom assertion. + * + * The assertion will be called for each node found by the expression. + * + * @param string $expression The XPath expression to execute. + * @param callable(DOMNode $node): bool $assertion The assertion to run. + * @param bool $pass_any Pass if any of the nodes pass the assertion. Otherwise, all must pass. + */ + public function assertElement( string $expression, callable $assertion, bool $pass_any = false ): static { + $nodes = ( new DOMXPath( $this->get_dom_document() ) )->query( $expression ); + + if ( ! $nodes ) { + PHPUnit::fail( 'No nodes found for expression: ' . $expression ); + } + + foreach ( $nodes as $node ) { + if ( $assertion( $node ) ) { + // If we're passing on any, we can return early. + if ( $pass_any ) { + return $this; + } + } elseif ( ! $pass_any ) { + PHPUnit::fail( 'Assertion failed for node: ' . $node->nodeName ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase + } + } + + PHPUnit::assertTrue( true, 'All nodes passed assertion.' ); + + return $this; + } + + /** + * Assert that an element passes a custom assertion by query selector. + * + * The assertion will be called for each node found by the selector. + * + * @param string $selector The selector to use. + * @param callable(DOMNode $node): bool $assertion The assertion to run. + * @param bool $pass_any Pass if any of the nodes pass the assertion. Otherwise, all must pass. + */ + public function assertQuerySelector( string $selector, callable $assertion, bool $pass_any = false ): static { + return $this->assertElement( $this->convert_query_selector( $selector ), $assertion, $pass_any ); + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-hooks.php b/vendor/mantle-framework/testing/concerns/trait-hooks.php new file mode 100644 index 00000000..25bad1f6 --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-hooks.php @@ -0,0 +1,82 @@ +<?php +/** + * This file contains the Hooks Trait + * + * @package Mantle + */ + +// phpcs:disable WordPressVIPMinimum.Variables.VariableAnalysis.SelfOutsideClass + +namespace Mantle\Testing\Concerns; + +trait Hooks { + + /** + * Saved hooks. + * + * @var array + */ + protected static $hooks_saved = []; + + /** + * Routines to run during setUp(). + */ + public function hooks_set_up(): void { + if ( ! self::$hooks_saved ) { + $this->backup_hooks(); + } + } + + /** + * Routines to run during tearDown(). + */ + public function hooks_tear_down(): void { + $this->restore_hooks(); + } + + /** + * Saves the action and filter-related globals so they can be restored later. + * + * Stores $wp_actions, $wp_current_filter, and $wp_filter on a class variable + * so they can be restored on tearDown() using _restore_hooks(). + * + * @global array $wp_actions + * @global array $wp_current_filter + * @global array $wp_filter + */ + protected function backup_hooks() { + $globals = [ 'wp_actions', 'wp_current_filter' ]; + foreach ( $globals as $global ) { + self::$hooks_saved[ $global ] = $GLOBALS[ $global ]; + } + self::$hooks_saved['wp_filter'] = []; + foreach ( $GLOBALS['wp_filter'] as $hook_name => $hook_object ) { + self::$hooks_saved['wp_filter'][ $hook_name ] = clone $hook_object; + } + } + + /** + * Restores the hook-related globals to their state at setUp() + * so that future tests aren't affected by hooks set during this last test. + * + * @global array $wp_actions + * @global array $wp_current_filter + * @global array $wp_filter + */ + protected function restore_hooks() { + // phpcs:disable WordPress.WP.GlobalVariablesOverride,WordPress.NamingConventions.PrefixAllGlobals + $globals = [ 'wp_actions', 'wp_current_filter' ]; + foreach ( $globals as $global ) { + if ( isset( self::$hooks_saved[ $global ] ) ) { + $GLOBALS[ $global ] = self::$hooks_saved[ $global ]; + } + } + if ( isset( self::$hooks_saved['wp_filter'] ) ) { + $GLOBALS['wp_filter'] = []; + foreach ( self::$hooks_saved['wp_filter'] as $hook_name => $hook_object ) { + $GLOBALS['wp_filter'][ $hook_name ] = clone $hook_object; + } + } + // phpcs:enable + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-incorrect-usage.php b/vendor/mantle-framework/testing/concerns/trait-incorrect-usage.php new file mode 100644 index 00000000..e999f3d5 --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-incorrect-usage.php @@ -0,0 +1,177 @@ +<?php +/** + * This file contains the Incorrect_Usage Trait + * + * @package Mantle + */ + +// phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid + +namespace Mantle\Testing\Concerns; + +use Mantle\Support\Str; +use Mantle\Testing\Attributes\Expected_Incorrect_Usage; +use Mantle\Testing\Attributes\Ignore_Incorrect_Usage; + +use function Mantle\Support\Helpers\collect; + +/** + * Check for _doing_it_wrong() calls during testing. + * + * If a _doing_it_wrong() call is made, the test will fail unless it is marked + * as expected or ignored. + */ +trait Incorrect_Usage { + use Output_Messages, Reads_Annotations; + + /** + * Expected "doing it wrong" calls. + * + * @var string[] + */ + private $expected_doing_it_wrong = []; + + /** + * Ignored "doing it wrong" calls. + * + * @var string[] + */ + private $ignored_doing_it_wrong = []; + + /** + * Caught "doing it wrong" calls. + * + * @var array + */ + private $caught_doing_it_wrong = []; + + /** + * Trace storage for "doing it wrong" calls. + * + * @var array + */ + private $caught_doing_it_wrong_traces = []; + + /** + * Sets up the expectations for testing a deprecated call. + */ + public function incorrect_usage_set_up(): void { + $annotations = $this->get_annotations_for_method(); + + foreach ( [ 'class', 'method' ] as $depth ) { + if ( ! empty( $annotations[ $depth ]['expectedIncorrectUsage'] ) ) { + $this->expected_doing_it_wrong = array_merge( $this->expected_doing_it_wrong, $annotations[ $depth ]['expectedIncorrectUsage'] ); + } + } + + add_action( 'doing_it_wrong_run', [ $this, 'doing_it_wrong_run' ] ); // @phpstan-ignore-line Action callback returns false + add_action( 'doing_it_wrong_trigger_error', '__return_false' ); // @phpstan-ignore-line Action callback returns false + + // Allow attributes to define the expected and ignored incorrect usages. + foreach ( $this->get_attributes_for_method( Expected_Incorrect_Usage::class ) as $attribute ) { + $this->setExpectedIncorrectUsage( $attribute->newInstance()->name ); + } + + foreach ( $this->get_attributes_for_method( Ignore_Incorrect_Usage::class ) as $attribute ) { + $this->ignoreIncorrectUsage( $attribute->newInstance()->name ); + } + } + + /** + * Set up handling a _doing_it_wrong() call. + */ + public function incorrect_usage_tear_down(): void { + $errors = []; + + $not_caught_doing_it_wrong = array_diff( $this->expected_doing_it_wrong, $this->caught_doing_it_wrong ); + foreach ( $not_caught_doing_it_wrong as $not_caught ) { + $errors[] = "Failed to assert that $not_caught triggered an incorrect usage notice"; + } + + $unexpected_doing_it_wrong = collect( $this->caught_doing_it_wrong ) + ->filter( + function ( string $caught ): bool { + $ignored_and_expected = array_merge( $this->expected_doing_it_wrong, $this->ignored_doing_it_wrong ); + + if ( in_array( $caught, $ignored_and_expected, true ) ) { + return false; + } + + // Allow partial matches when ignoring a _doing_it_wrong() call. + foreach ( $this->ignored_doing_it_wrong as $ignored ) { + if ( Str::is( $ignored, $caught ) ) { + return false; + } + } + + return true; + } + ) + ->all(); + + foreach ( $unexpected_doing_it_wrong as $index => $unexpected ) { + $errors[] = $unexpected; + + if ( ! empty( $this->caught_doing_it_wrong_traces[ $index ] ) ) { + static::trace( + message: "Unexpected incorrect usage notice for $unexpected", + trace: $this->caught_doing_it_wrong_traces[ $index ], + ); + } + } + + // Perform an assertion, but only if there are expected or unexpected + // deprecated calls or wrongdoings. + if ( + ! empty( $this->expected_doing_it_wrong ) || ! empty( $this->caught_doing_it_wrong ) + ) { + if ( ! empty( $errors ) ) { + $this->fail( 'Unexpected incorrect usage notice(s) triggered: ' . implode( ', ', $errors ) ); + } else { + $this->assertTrue( true ); + } + } + } + + /** + * Declare an expected `_doing_it_wrong()` call from within a test. + * + * Note: If a `_doing_it_wrong()` call isn't made within the test, the test + * will fail. To ignore a `_doing_it_wrong()` call, use + * {@see Incorrect_Usage::ignoreIncorrectUsage()}. + * + * @param string $doing_it_wrong Name of the function, method, or class that + * appears in the first argument of the source + * `_doing_it_wrong()` call. + */ + public function setExpectedIncorrectUsage( $doing_it_wrong ): void { + $this->expected_doing_it_wrong[] = $doing_it_wrong; + } + + /** + * Ignore a `_doing_it_wrong()` call from within a test. + * + * Supports partial matches using `Str::is()` syntax with * as a wildcard. + * + * @param string $doing_it_wrong Name of the function, method, or class that + * appears in the first argument of the source + * `_doing_it_wrong()` call. Supports * as a + * wildcard. + */ + public function ignoreIncorrectUsage( $doing_it_wrong = '*' ): void { + $this->ignored_doing_it_wrong[] = $doing_it_wrong; + } + + /** + * Adds a function called in a wrong way to the list of `_doing_it_wrong()` calls. + * + * @param string $function The function to add. + */ + public function doing_it_wrong_run( $function ): void { + if ( ! in_array( $function, $this->caught_doing_it_wrong, true ) ) { + $this->caught_doing_it_wrong[] = $function; + + $this->caught_doing_it_wrong_traces[] = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 10 ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_debug_backtrace + } + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-interacts-with-console.php b/vendor/mantle-framework/testing/concerns/trait-interacts-with-console.php new file mode 100644 index 00000000..013d46e7 --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-interacts-with-console.php @@ -0,0 +1,26 @@ +<?php +/** + * Interacts_With_Console trait file + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +use Mantle\Console\Command; +use Mantle\Testing\Test_Command; + +/** + * Allow console commands to be tested against. + */ +trait Interacts_With_Console { + /** + * Create a new Test_Command instance and run it. + * + * @param string $command Command to run. + * @param array $args Arguments to pass to the command. + */ + public function command( string $command, array $args = [] ): Test_Command { + return new Test_Command( $this, $this->app, $command, $args ); + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-interacts-with-container.php b/vendor/mantle-framework/testing/concerns/trait-interacts-with-container.php new file mode 100644 index 00000000..476ad7ee --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-interacts-with-container.php @@ -0,0 +1,74 @@ +<?php +/** + * Interacts_With_Container trait file. + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +use Closure; +use Mockery; + +/** + * Concern for interacting with the container for helpful testing. + */ +trait Interacts_With_Container { + + /** + * Register an instance of an object in the container. + * + * @param string $abstract Abstract to swap. + * @param object $instance Instance to use. + * @return object + */ + protected function swap( $abstract, $instance ) { + return $this->instance( $abstract, $instance ); + } + + /** + * Register an instance of an object in the container. + * + * @param string $abstract Abstract to swap. + * @param object $instance Instance to use. + * @return object + */ + protected function instance( $abstract, $instance ) { + $this->app->instance( $abstract, $instance ); + + return $instance; + } + + /** + * Mock an instance of an object in the container. + * + * @param string $abstract Abstract to swap. + * @param \Closure|null $mock Mock to use. + * @return \Mockery\MockInterface + */ + protected function mock( $abstract, Closure $mock = null ) { + return $this->instance( $abstract, Mockery::mock( ...array_filter( func_get_args() ) ) ); + } + + /** + * Mock a partial instance of an object in the container. + * + * @param string $abstract Abstract to swap. + * @param \Closure|null $mock Mock to use. + * @return \Mockery\MockInterface + */ + protected function partial_mock( $abstract, Closure $mock = null ) { + return $this->instance( $abstract, Mockery::mock( ...array_filter( func_get_args() ) )->makePartial() ); + } + + /** + * Spy an instance of an object in the container. + * + * @param string $abstract Abstract to swap. + * @param \Closure|null $mock Mock to use. + * @return \Mockery\MockInterface + */ + protected function spy( $abstract, Closure $mock = null ) { + return $this->instance( $abstract, Mockery::spy( ...array_filter( func_get_args() ) ) ); + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-interacts-with-cron.php b/vendor/mantle-framework/testing/concerns/trait-interacts-with-cron.php new file mode 100644 index 00000000..7ef4d8b1 --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-interacts-with-cron.php @@ -0,0 +1,287 @@ +<?php +/** + * Interacts_With_Cron trait file. + * + * @package Mantle + * + * @phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid + */ + +namespace Mantle\Testing\Concerns; + +use InvalidArgumentException; +use Mantle\Contracts\Queue\Job; +use Mantle\Contracts\Queue\Queue_Manager; +use Mantle\Queue\Worker; +use PHPUnit\Framework\Assert as PHPUnit; +use stdClass; + +use function Mantle\Support\Helpers\collect; + +/** + * Concern for interacting with the WordPress cron and making assertions against + * it. Also supports queued and scheduled jobs. + * + * @mixin \Mantle\Testing\Test_Case + */ +trait Interacts_With_Cron { + /** + * Assert that an action is in the cron queue. + * + * @param string $action Action hook of the event. + * @param array $args Arguments for the cron queue event or null to not check + * arguments (cron only). + */ + public function assertInCronQueue( string $action, array|null $args = [] ): void { + if ( $this->is_job_action( $action ) ) { + $this->assertJobQueued( $action, (array) $args ); + return; + } + + if ( ! is_null( $args ) ) { + PHPUnit::assertNotFalse( + \wp_next_scheduled( $action, $args ), + "Cron action is not in cron queue: [$action]" + ); + } + + PHPUnit::assertNotEmpty( + collect( static::get_cron_events() )->where( 'hook', $action )->all(), + "Cron action is not in cron queue: [$action] (no arguments checked)", + ); + } + + /** + * Assert that an action is not in a cron queue. + * + * @param string $action Action hook of the event. + * @param array $args Arguments for the cron queue event or null to not check + * arguments (cron only). + */ + public function assertNotInCronQueue( string $action, array|null $args = [] ): void { + if ( $this->is_job_action( $action ) ) { + $this->assertJobNotQueued( $action, (array) $args ); + return; + } + + if ( ! is_null( $args ) ) { + PHPUnit::assertFalse( + \wp_next_scheduled( $action, $args ), + "Cron action is in cron queue: [$action]" + ); + } + + PHPUnit::assertEmpty( + collect( static::get_cron_events() )->where( 'hook', $action )->all(), + "Cron action is in cron queue: [$action] (no arguments checked)", + ); + } + + /** + * Determine if a cron 'action' is actually a queued job. + * + * @param class-string|class-string<\Mantle\Contracts\Queue\Job> $action Action name. + */ + protected function is_job_action( string $action ): bool { + return class_exists( $action ) && in_array( Job::class, class_implements( $action ), true ); + } + + /** + * Assert if a job has been queued. + * + * Supports passing a job instance as a class or as a string (class name) with arguments + * in the second function argument. + * + * @param string|mixed $job Job class/instance. + * @param array $args Job arguments for class, optional. + * @param string $queue Queue, optional. + * + * @throws InvalidArgumentException Thrown for missing job class. + */ + public function assertJobQueued( $job, array $args = [], string $queue = null ): void { + /** + * Provider instance. + * + * @var \Mantle\Contracts\Queue\Provider + */ + $provider = app( Queue_Manager::class )->get_provider(); + + if ( is_string( $job ) ) { + if ( ! class_exists( $job ) ) { + throw new InvalidArgumentException( "Job class not found: [$job]" ); + } + + $job = new $job( ...$args ); + } + + $job_name = is_object( $job ) ? $job::class : $job; + + PHPUnit::assertTrue( + $provider->in_queue( $job, $queue ), + "Job [{$job_name}] is not in the queue [{$queue}] for " . $provider::class, + ); + } + + /** + * Assert that a job has not been queued. + * + * Supports passing a job instance as a class or as a string (class name) with arguments + * in the second function argument. + * + * @param string|mixed $job Job class/instance. + * @param array $args Job arguments for class, optional. + * @param string $queue Queue, optional. + * + * @throws InvalidArgumentException Thrown for missing job class. + */ + public function assertJobNotQueued( $job, array $args = [], string $queue = null ): void { + /** + * Provider instance. + * + * @var \Mantle\Contracts\Queue\Provider + */ + $provider = app( Queue_Manager::class )->get_provider(); + + if ( is_string( $job ) ) { + if ( ! class_exists( $job ) ) { + throw new InvalidArgumentException( "Job class not found: [$job]" ); + } + + $job = new $job( ...$args ); + } + + $job_name = is_object( $job ) ? $job::class : $job; + + PHPUnit::assertFalse( + $provider->in_queue( $job, $queue ), + "Job [{$job_name}] is in the queue.", + ); + } + + /** + * Assert the count of the events in the cron queue. + * + * Supports passing a hook name to compare against the number of cron events + * scheduled against that cron hook. Does not support queue jobs. + * + * @param string|class-string $action Cron hook name. + * @param int $expected_count Expected count of cron events. + */ + public function assertCronCount( string $action, int $expected_count ): void { + PHPUnit::assertEquals( + $expected_count, + collect( static::get_cron_events() )->where( 'hook', $action )->count(), + "Cron action count is not as expected: [$action]", + ); + } + + /** + * Dispatch the cron. + * + * @param string $action Optionally run a specific cron action, otherwise run + * all due tasks. + */ + public function dispatch_cron( string $action = null ): void { + $events = static::get_cron_events(); + + if ( empty( $events ) ) { + return; + } + + // Check if the action is in the cron events. + if ( $action ) { + $hooks = \wp_list_pluck( $events, 'hook' ); + + // Bail if the requested action is not found in the schedule. + if ( ! in_array( $action, $hooks, true ) ) { + return; + } + } + + $due_events = []; + foreach ( $events as $event ) { + if ( $action && $event->hook !== $action ) { + continue; + } + + if ( time() >= $event->time ) { + $due_events[] = $event; + } + } + + $events = $due_events; + + if ( empty( $events ) ) { + return; + } + + array_walk( $events, [ static::class, 'run_cron_event' ] ); + } + + /** + * Fetches an array of scheduled cron events. + * + * @return array<int, object{hook: string, time: int, sig: string, args: array, schedule: false|string}> + */ + protected static function get_cron_events(): array { + $crons = _get_cron_array(); + $events = []; + + if ( empty( $crons ) ) { + return []; + } + + foreach ( $crons as $time => $hooks ) { + if ( empty( $hooks ) ) { + continue; + } + + foreach ( (array) $hooks as $hook => $hook_events ) { + foreach ( $hook_events as $sig => $data ) { + + $events[] = (object) [ + 'hook' => $hook, + 'time' => $time, + 'sig' => $sig, + 'args' => $data['args'], + 'schedule' => $data['schedule'], + ]; + } + } + } + + return $events; + } + + /** + * Run a cron event. + * + * @param \stdClass $event Cron event object. + */ + protected static function run_cron_event( \stdClass $event ) { + if ( ! defined( 'DOING_CRON' ) ) { + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound -- Using native WordPress constant. + define( 'DOING_CRON', true ); + } + + if ( false !== $event->schedule ) { + $new_args = [ $event->time, $event->schedule, $event->hook, $event->args ]; + call_user_func_array( 'wp_reschedule_event', $new_args ); + } + + \wp_unschedule_event( $event->time, $event->hook, $event->args ); + + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound -- Can't prefix dynamic hooks here, calling registered hooks. + \do_action_ref_array( $event->hook, $event->args ); + } + + /** + * Dispatch the WordPress cron queue. + * + * @param int $size Size of the queue to run. + * @param string $queue Queue to run. + */ + public function dispatch_queue( int $size = 100, string $queue = null ): void { + $this->app->make( Worker::class )->run( $size, $queue ); + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-interacts-with-hooks.php b/vendor/mantle-framework/testing/concerns/trait-interacts-with-hooks.php new file mode 100644 index 00000000..5315cd01 --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-interacts-with-hooks.php @@ -0,0 +1,128 @@ +<?php +/** + * Interacts_With_Hooks trait file. + * + * phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +use Mantle\Testing\Expectation\Expectation; +use Mantle\Testing\Expectation\Expectation_Container; +use PHPUnit\Framework\Assert as PHPUnit; + +/** + * Assertions and interactions with WordPress hooks. + */ +trait Interacts_With_Hooks { + /** + * Storage of the hooks that have been fired. + * + * @var array<string, int> + */ + protected array $hooks_fired = []; + + /** + * Expectation Container + */ + protected ?Expectation_Container $expectation_container; + + /** + * Setup the trait listener. + */ + public function interacts_with_hooks_set_up(): void { + $this->expectation_container = new Expectation_Container(); + + \add_filter( + 'all', + function( $value ) { + $filter = current_filter(); + + if ( ! isset( $this->hooks_fired[ $filter ] ) ) { + $this->hooks_fired[ $filter ] = 0; + } + + $this->hooks_fired[ $filter ]++; + + return $value; + } + ); + } + + /** + * Tear down the trait. + */ + public function interacts_with_hooks_tear_down(): void { + $this->hooks_fired = []; + + if ( isset( $this->expectation_container ) ) { + $this->expectation_container->tear_down(); + $this->expectation_container = null; + } + } + + /** + * Assert if a hook (action/filter) was applied. + * + * @param string $hook Hook to check against. + * @param int $count Count to compare. + */ + public function assertHookApplied( string $hook, int $count = null ): void { + PHPUnit::assertNotEmpty( + $this->hooks_fired[ $hook ] ?? [], + "Asserted that [{$hook}] was not fired." + ); + + if ( $count ) { + $times_fired = $this->hooks_fired[ $hook ] ?? 0; + + PHPUnit::assertEquals( + $count, + $times_fired, + sprintf( + 'Asserted that [%s] was applied %d %s when only applied %d %s.', + $hook, + $count, + 1 === $count ? 'time' : 'times', + $times_fired, + 1 === $times_fired ? 'time' : 'times', + ), + ); + } + } + + /** + * Assert if a hook (action/filter) was not applied. + * + * @param string $hook Hook to check against. + */ + public function assertHookNotApplied( string $hook ): void { + PHPUnit::assertEquals( + 0, + $this->hooks_fired[ $hook ] ?? 0, + "Asserted that [{$hook}] was fired." + ); + } + + /** + * Add expectation that an action applied. + * + * @param string $hook Action to listen to. + */ + public function expectApplied( string $hook ): Expectation { + return $this->expectation_container->add_applied( $hook ); + } + + /** + * Add expectation that an action added. + * + * @param string $hook Action to listen to. + * @param callable $callback Callback to check was added, optional. + * @return Expectation + */ + public function expectAdded( string $hook, callable $callback = null ) { + return $this->expectation_container->add_added( $hook, $callback ); + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-interacts-with-mail.php b/vendor/mantle-framework/testing/concerns/trait-interacts-with-mail.php new file mode 100644 index 00000000..91f5275c --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-interacts-with-mail.php @@ -0,0 +1,126 @@ +<?php +/** + * Interacts_With_Mail trait file. + * + * @package Mantle + * + * @phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid + */ + +namespace Mantle\Testing\Concerns; + +use Mantle\Support\Collection; +use Mantle\Testing\Mail\Mail_Message; +use Mantle\Testing\Mail\Mock_Mailer; + +use function Mantle\Support\Helpers\collect; + +/** + * Concern for interacting with the WordPress wp_mail() function. + * + * @mixin \Mantle\Testing\Test_Case + */ +trait Interacts_With_Mail { + /** + * Setup the trait and replace the global phpmailer instance with a mock instance. + */ + public function interacts_with_mail_set_up(): void { + reset_phpmailer_instance(); + } + + /** + * Assert that an email was sent to the given recipient. + * + * @param (callable(\Mantle\Testing\Mail\Mail_Message): bool)|string|null $address_or_callback The email address to check for, or a callback to perform custom assertions. + */ + public function assertMailSent( string|callable|null $address_or_callback = null ): void { + $mailer = tests_retrieve_phpmailer_instance(); + + if ( ! ( $mailer instanceof Mock_Mailer ) ) { + $this->fail( 'Mail instance is not a MockPHPMailer instance.' ); + } + + if ( is_null( $address_or_callback ) ) { + $this->assertNotEmpty( $mailer->mock_sent, 'No emails were sent.' ); + return; + } + + $this->assertNotEmpty( + $this->getSentMail( $address_or_callback ), + is_string( $address_or_callback ) ? "No email was sent to [{$address_or_callback}]." : 'No email was sent matching the given callback function.' + ); + } + + /** + * Assert that an email was not sent to the given recipient. + * + * @param (callable(\Mantle\Testing\Mail\Mail_Message): bool)|string|null $address_or_callback The email address to check for, or a callback to perform custom assertions. + */ + public function assertMailNotSent( string|callable|null $address_or_callback = null ): void { + $mailer = tests_retrieve_phpmailer_instance(); + + if ( ! ( $mailer instanceof Mock_Mailer ) ) { + $this->fail( 'Mail instance is not a MockPHPMailer instance.' ); + } + + if ( is_null( $address_or_callback ) ) { + $this->assertEmpty( $mailer->mock_sent, 'An email was sent.' ); + return; + } + + $this->assertEmpty( + $this->getSentMail( $address_or_callback ), + is_string( $address_or_callback ) ? "An email was sent to [{$address_or_callback}]." : 'An email was sent matching the given callback function.' + ); + } + + /** + * Assert that a specific number of emails were sent. + * + * @param int $expected_count The expected number of emails sent. + * @param (callable(\Mantle\Testing\Mail\Mail_Message): bool)|string|null $address_or_callback The email address to check for, or a callback to perform custom assertions. + */ + public function assertMailSentCount( int $expected_count, string|callable|null $address_or_callback = null ): void { + $mailer = tests_retrieve_phpmailer_instance(); + + if ( ! ( $mailer instanceof Mock_Mailer ) ) { + $this->fail( 'Mail instance is not a MockPHPMailer instance.' ); + } + + if ( is_null( $address_or_callback ) ) { + $actual = count( $mailer->mock_sent ); + $this->assertCount( $expected_count, $mailer->mock_sent, "Expected {$expected_count} emails to be sent, but only {$actual} were sent." ); + return; + } + + $sent_mail = $this->getSentMail( $address_or_callback ); + $count = count( $sent_mail ); + + $this->assertCount( $expected_count, $sent_mail, "Expected {$expected_count} emails to be sent, but only {$count} were sent." ); + } + + /** + * Retrieve the sent mail for a given to address or callback function that + * performs a match against sent mail. + * + * @param (callable(\Mantle\Testing\Mail\Mail_Message): bool)|string $address_or_callback The email address to check for, or a callback to perform custom assertions. + * @return Collection<int, \Mantle\Testing\Mail\Mail_Message> + */ + protected function getSentMail( string|callable $address_or_callback = null ): Collection { + $mailer = tests_retrieve_phpmailer_instance(); + + if ( ! ( $mailer instanceof Mock_Mailer ) ) { + $this->fail( 'Mail instance is not a MockPHPMailer instance.' ); + } + + return collect( $mailer->mock_sent )->filter( + function ( Mail_Message $message ) use ( $address_or_callback ) { + if ( is_string( $address_or_callback ) ) { + return $message->sent_to( $address_or_callback ); + } + + return $address_or_callback( $message ); + } + ); + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-interacts-with-requests.php b/vendor/mantle-framework/testing/concerns/trait-interacts-with-requests.php new file mode 100644 index 00000000..10d3a628 --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-interacts-with-requests.php @@ -0,0 +1,470 @@ +<?php +/** + * Interacts_With_Requests trait file. + * + * @phpcs:disable WordPress.NamingConventions.ValidFunctionName, Squiz.Commenting.FunctionComment.SpacingAfterParamType + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +use Closure; +use InvalidArgumentException; +use Mantle\Contracts\Support\Arrayable; +use Mantle\Http_Client\Request; +use Mantle\Support\Collection; +use Mantle\Support\Str; +use Mantle\Testing\Mock_Http_Response; +use Mantle\Testing\Mock_Http_Sequence; +use Mantle\Testing\Utils; +use PHPUnit\Framework\Assert as PHPUnit; +use RuntimeException; +use WP_Error; + +use function Mantle\Support\Helpers\collect; +use function Mantle\Support\Helpers\value; + +/** + * Allow Mock HTTP Requests + * + * @mixin \PHPUnit\Framework\TestCase + */ +trait Interacts_With_Requests { + /** + * Storage of the callbacks to mock the requests. + * + * @var Collection<int, callable(string, array): Mock_Http_Response|Arrayable|WP_Error|null> + */ + protected Collection $stub_callbacks; + + /** + * Storage of request URLs. + * + * @var Collection<int, Request> + */ + protected Collection $recorded_requests; + + /** + * Flag to prevent external requests from being made. By default, this is + * false. + * + * @var Mock_Http_Response|callable|bool + */ + protected mixed $preventing_stray_requests = false; + + /** + * Recorded actual HTTP requests made during the test. + * + * @var Collection<int, string> + */ + protected Collection $recorded_actual_requests; + + /** + * Setup the trait. + */ + public function interacts_with_requests_set_up(): void { + $this->stub_callbacks = collect(); + $this->recorded_requests = collect(); + $this->recorded_actual_requests = collect(); + + \add_filter( 'pre_http_request', [ $this, 'pre_http_request' ], PHP_INT_MAX, 3 ); + } + + /** + * Remove the filter to intercept the request. + */ + public function interacts_with_requests_tear_down(): void { + \remove_filter( 'pre_http_request', [ $this, 'pre_http_request' ], PHP_INT_MAX ); + + $this->report_stray_requests(); + } + + /** + * Prevent stray external requests. + * + * @param Mock_Http_Response|\Closure|bool $response A default response or callback to use, boolean otherwise. + */ + public function prevent_stray_requests( Mock_Http_Response|Closure|bool $response = true ): void { + $this->preventing_stray_requests = $response; + } + + /** + * Allow stray external requests. + */ + public function allow_stray_requests(): void { + $this->preventing_stray_requests = false; + } + + /** + * Fake a remote request. + * + * A response object could be passed with a matching URL to fake. Also supports passing + * a closure that will be invoked when the HTTP request is made. The closure will be passed + * the request URL and request arguments to determine if it wishes to make a response. For more + * information on how this is used, see the `create_stub_request_callback()` method below and the + * relevant test for the trait (Mantle\Tests\Testing\Concerns\Test_Interacts_With_Requests). + * + * Example: + * + * $this->fake_request(); + * $this->fake_request( 'https://testing.com/*' ); + * $this->fake_request( 'https://testing.com/*' )->with_response_code( 404 )->with_body( 'test body' ); + * $this->fake_request( fn () => Mock_Http_Response::create()->with_body( 'test body' ) ); + * $this->fake_request( 'https://testing.com/', fn () => Mock_Http_Response::create()->with_body( 'test body' ) ); + * $this->fake_request( [ 'https://example.org' => Mock_Http_Response::create()->with_body( 'test body' ) ] ); + * + * @link https://mantle.alley.com/docs/testing/remote-requests#faking-requests Documentation + * + * @throws InvalidArgumentException Thrown on invalid argument when response object passed twice. + * @throws InvalidArgumentException Thrown on invalid argument. + * @throws InvalidArgumentException Thrown on invalid response type. + * + * @template TCallableReturn of Mock_Http_Sequence|Mock_Http_Response|Arrayable|null + * + * @param (callable(string, array): TCallableReturn)|Mock_Http_Response|string|array<string, Mock_Http_Response|callable> $url_or_callback URL to fake, array of URL and response pairs, or a closure + * that will return a faked response. + * @param Mock_Http_Response|callable $response Optional response object, defaults to a 200 response with no body. + * @param string $method Optional request method to apply to, defaults to all. Does not apply to array of URL and response pairs OR callbacks. + */ + public function fake_request( + Mock_Http_Response|callable|string|array|null $url_or_callback = null, + Mock_Http_Response|callable $response = null, + ?string $method = null + ): static|Mock_Http_Response { + if ( is_array( $url_or_callback ) ) { + $this->stub_callbacks = $this->stub_callbacks->merge( + collect( $url_or_callback )->map( + fn ( $response, $url_or_callback ) => $this->create_stub_request_callback( $url_or_callback, $response, $method ), + ) + ); + + return $this; + } + + // Allow a callback to be passed instead. + if ( is_callable( $url_or_callback ) ) { + $this->stub_callbacks->push( $url_or_callback ); + + return $this; + } + + // Prevent duplicate responses from being passed. + if ( $url_or_callback instanceof Mock_Http_Response && $response instanceof Mock_Http_Response ) { + throw new InvalidArgumentException( 'Response object passed twice, only one response object should be passed.' ); + } + + // Allow for a catch-all response to be passed in the first argument. + if ( $url_or_callback instanceof Mock_Http_Response && ! $response ) { + $this->stub_callbacks->push( $this->create_stub_request_callback( '*', $url_or_callback, $method ) ); + + return $url_or_callback; + } + + // Throw an exception on an unknown argument. + if ( ! is_string( $url_or_callback ) && ! is_null( $url_or_callback ) ) { + throw new InvalidArgumentException( + sprintf( + 'Expected a URL string or a callback, got %s.', + gettype( $url_or_callback ) + ) + ); + } + + // Renaming for clarity. + $url = $url_or_callback ?? '*'; + + // If no arguments passed, assume that all requests should return an 200 response. + if ( is_null( $response ) ) { + $response = new Mock_Http_Response(); + } + + // Ensure that the response is an instance of Mock_Http_Response. + if ( ! $response instanceof Mock_Http_Response ) { + throw new InvalidArgumentException( 'Response must be an instance of Mock_Http_Response or callable, ' . gettype( $response ) . ' given.' ); + } + + $this->stub_callbacks->push( + $this->create_stub_request_callback( $url, $response, $method ), + ); + + return $response; + } + + /** + * Fluently build a fake request sequence. + * + * @param string $url URL to fake (supports * for wildcard matching). + * @param string|null $method Request method, optional. + */ + public function fake_request_sequence( string $url, ?string $method = null ): Mock_Http_Sequence { + $sequence = Mock_Http_Sequence::create(); + + $this->fake_request( [ $url => $sequence ], method: $method ); + + return $sequence; + } + + /** + * Create a mock HTTP response. + * + * @param string $body Response body. + * @param array $headers Response headers. + */ + public function mock_response( string $body = '', array $headers = [] ): Mock_Http_Response { + return new Mock_Http_Response( $body, $headers ); + } + + /** + * Filters pre_http_request to intercept the request, mock a response, and + * return it. If the response has already been preempted, the preempt will + * be returned instead. Regardless, this object unhooks itself from the + * pre_http_request filter. + * + * @param false|array|\WP_Error $preempt Whether to preempt an HTTP request's return value. Default false. + * @param array $request_args HTTP request arguments. + * @param string $url The request URL. + * @return mixed Array if the request has been preempted, any value that's + * not false otherwise. + * + * @throws RuntimeException If the request was made without a matching faked request. + */ + public function pre_http_request( $preempt, $request_args, $url ) { + // Bail early if the preemption is already set. + if ( false !== $preempt ) { + return $preempt; + } + + $request = new Request( $request_args, $url ); + + $this->recorded_requests[] = $request; + + $stub = $this->get_stub_response( $url, $request_args ); + + if ( $stub ) { + // If the request is for streaming the response to a file, store the + // response body in the requested file. + if ( ! is_wp_error( $stub ) && ! empty( $request_args['stream'] ) ) { + try { + return $this->store_streamed_response( $url, $stub, $request_args ); + } catch ( RuntimeException $e ) { + return new WP_Error( 'http_request_failed', $e->getMessage() ); + } + } + + return $stub; + } + + // Store the actual request for later reporting. + $this->recorded_actual_requests[] = method_exists( $this, 'getName' ) ? static::class . '::' . $this->getName() : static::class; + + return $preempt; + } + + /** + * Retrieve the stub response for a given request URL and arguments. + * + * @throws RuntimeException If the request was made without a matching + * faked request when external requests are prevented. + * + * @param string $url Request URL. + * @param array $request_args Request arguments. + */ + protected function get_stub_response( string $url, array $request_args ): array|WP_Error|null { + if ( ! $this->stub_callbacks->is_empty() ) { + foreach ( $this->stub_callbacks as $stub_callback ) { + $response = $stub_callback( $url, $request_args ); + + if ( $response instanceof Mock_Http_Response || $response instanceof Arrayable ) { + return $response->to_array(); + } + + // Throw an error when an unknown response type is returned from the callback. + if ( $response && ! is_array( $response ) && ! is_wp_error( $response ) ) { + throw new RuntimeException( + sprintf( + 'Unknown response type returned for faked request to [%s]. Expected a (%s|%s|%s|array), got %s.', + $url, + Mock_Http_Response::class, + Arrayable::class, + WP_Error::class, + gettype( $response ) + ), + ); + } + + if ( ! is_null( $response ) ) { + return $response; + } + } + } + + if ( false !== $this->preventing_stray_requests ) { + $prevent = value( $this->preventing_stray_requests ); + + if ( $prevent instanceof Mock_Http_Response || $prevent instanceof Arrayable ) { + return $prevent->to_array(); + } + + throw new RuntimeException( "Attempted request to [{$url}] without a matching fake." ); + } + + return null; + } + + /** + * Store the response body in the requested file for a streamed request. + * + * @throws RuntimeException If the directory is not writable. + * @throws RuntimeException If the file cannot be written. + * + * @param string $url Request URL. + * @param array $response Stubbed response array. + * @param array $request_args Request arguments. + * @return array The modified response array. + */ + protected function store_streamed_response( string $url, array $response, array $request_args ): array { + if ( empty( $request_args['stream'] ) ) { + return $response; + } + + if ( empty( $request_args['filename'] ) ) { + $request_args['filename'] = get_temp_dir() . basename( $url ); + } + + if ( ! wp_is_writable( dirname( (string) $request_args['filename'] ) ) ) { + throw new RuntimeException( "The directory [{$request_args['filename']}] is not writable." ); + } + + if ( ! file_put_contents( $request_args['filename'], $response['body'] ) ) { // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_file_put_contents + throw new RuntimeException( "Unable to write to the file [{$request_args['filename']}]." ); + } + + // Replace the response body with an empty string to prevent the response + // from being returned in the body (since it was streamed to a file). + $response['body'] = ''; + $response['filename'] = $request_args['filename']; + + return $response; + } + + /** + * Retrieve a callback for the stubbed response. + * + * @param string $url URL to stub. + * @param callable|Mock_Http_Response $response Response to send. + * @param string $method Request method, optional. + */ + protected function create_stub_request_callback( string $url, Mock_Http_Response|callable $response, ?string $method = null ): callable { + return function( string $request_url, array $request_args ) use ( $url, $response, $method ) { + if ( ! Str::is( Str::start( $url, '*' ), $request_url ) ) { + return; + } + + // Validate the request method for the stub callback. + if ( $method && isset( $request_args['method'] ) && strtoupper( $method ) !== strtoupper( (string) $request_args['method'] ) ) { + return; + } + + return is_callable( $response ) + ? $response( $request_url, $request_args ) + : $response; + }; + } + + /** + * Get a collection of the request pairs matching the given truth test. + * + * @param callable $callback Callback to invoke on each request. + */ + protected function recorded_requests( callable $callback ): Collection { + if ( empty( $this->recorded_requests ) ) { + return collect(); + } + + return collect( $this->recorded_requests )->filter( fn ( Request $response ) => $callback( $response ) ); + } + + /** + * Report any stray requests that were made during the unit test. + */ + protected function report_stray_requests(): void { + if ( ! isset( $this->recorded_actual_requests ) || $this->recorded_actual_requests->is_empty() ) { + return; + } + + $this->recorded_actual_requests->map( + fn ( $method, $index ) => Utils::info( + "An HTTP request was made in <span class='font-bold'>{$method}</span> to <span class='font-bold'>{$this->recorded_requests[ $index ]->url()}</span> but no faked response was found.", + 'HTTP Requests', + ) + ); + } + + /** + * Assert that a request was sent. + * + * @param string|callable $url_or_callback Specific URL to check against or a callback to + * check against specific request information. + * @param int $expected_times Number of times the request should have been + * sent, optional. + */ + public function assertRequestSent( string|callable|null $url_or_callback = null, int $expected_times = null ): void { + if ( is_null( $url_or_callback ) ) { + PHPUnit::assertTrue( $this->recorded_requests->is_not_empty(), 'A request was made.' ); + + return; + } + + if ( is_string( $url_or_callback ) ) { + $url_or_callback = fn ( $request ) => Str::is( $url_or_callback, $request->url() ); + } + + $requests = $this->recorded_requests( $url_or_callback )->count(); + + PHPUnit::assertTrue( + $requests > 0, + 'An expected request was not recorded.', + ); + + if ( null !== $expected_times ) { + PHPUnit::assertEquals( $expected_times, $requests, 'Expected request count does not match.' ); + } + } + + /** + * Assert that a request was not sent. + * + * @param string|callable $url_or_callback URL to check against or callback. + */ + public function assertRequestNotSent( string|callable|null $url_or_callback = null ): void { + if ( is_string( $url_or_callback ) ) { + $url_or_callback = fn ( $request ) => Str::is( $url_or_callback, $request->url() ); + } + + PHPUnit::assertEquals( + 0, + $this->recorded_requests( $url_or_callback )->count(), + 'Unexpected request was recorded.', + ); + } + + /** + * Assert that no request was sent. + */ + public function assertNoRequestSent(): void { + PHPUnit::assertEmpty( + $this->recorded_requests, + 'Requests were recorded', + ); + } + + /** + * Assert a specific request count was sent. + * + * @param int $count Request count. + */ + public function assertRequestCount( int $count ): void { + PHPUnit::assertCount( $count, $this->recorded_requests ); + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-makes-http-requests.php b/vendor/mantle-framework/testing/concerns/trait-makes-http-requests.php new file mode 100644 index 00000000..362a6328 --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-makes-http-requests.php @@ -0,0 +1,398 @@ +<?php +/** + * This file contains the Makes_Http_Requests trait + * + * phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPressVIPMinimum.Variables.RestrictedVariables.cache_constraints___COOKIE + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +use Mantle\Testing\Pending_Testable_Request; +use Mantle\Testing\Test_Response; +use RuntimeException; + +use function Mantle\Support\Helpers\tap; + +/** + * Trait for Test_Case classes which want to make http-like requests against + * WordPress. + */ +trait Makes_Http_Requests { + /** + * Additional headers for the request. + * + * @var array<string, string> + */ + protected array $default_headers = []; + + /** + * Additional cookies for the request. + * + * @var array<string, string> + */ + protected array $default_cookies = []; + + /** + * The array of callbacks to be run before the event is started. + * + * @var array<callable> + */ + protected array $before_callbacks = []; + + /** + * The array of callbacks to be run after the event is finished. + * + * @var array<callable> + */ + protected array $after_callbacks = []; + + /** + * Setup the trait in the test case. + */ + public function makes_http_requests_set_up(): void { + global $wp_rest_server, $wp_actions; + + // Clear out the existing REST Server to allow for REST API routes to be re-registered. + $wp_rest_server = null; // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals + + // Mark 'rest_api_init' as an un-run action. + unset( $wp_actions['rest_api_init'] ); + + // Clear before/after callbacks. + $this->before_callbacks = []; + $this->after_callbacks = []; + } + + /** + * Create a new request instance with the default headers and cookies. + */ + protected function create_pending_request(): Pending_Testable_Request { + return tap( + new Pending_Testable_Request( $this ), + function ( Pending_Testable_Request $request ): void { + $request->cookies->add( $this->default_cookies ); + $request->headers->add( $this->default_headers ); + }, + ); + } + + /** + * Add default headers to all requests. + * + * @param array<string, string>|string $headers Headers to be added to all requests. + * @param string|null $value Header value. + */ + public function add_default_header( array|string $headers, ?string $value = null ): void { + if ( is_array( $headers ) ) { + $this->default_headers = array_merge( $this->default_headers, $headers ); + } else { + $this->default_headers[ $headers ] = $value; + } + } + + /** + * Flush all the configured headers. + */ + public function flush_default_headers(): static { + $this->default_headers = []; + + return $this; + } + + /** + * Define additional headers to be sent with the request. + * + * @param array $headers Headers for the request. + */ + public function with_headers( array $headers ): Pending_Testable_Request { + return $this->create_pending_request()->with_headers( $headers ); + } + + /** + * Define additional header to be sent with the request. + * + * @param string $name Header name (key). + * @param string $value Header value. + */ + public function with_header( string $name, string $value ): Pending_Testable_Request { + return $this->with_headers( [ $name => $value ] ); + } + + /** + * Set the referer header and previous URL session value in order to simulate + * a previous request. + * + * @param string $url URL for the referer header. + */ + public function from( string $url ): Pending_Testable_Request { + return $this->with_header( 'referer', $url ); + } + + /** + * Make a request with a set of cookies. + * + * @param array<string, string>|string $cookies Cookies to be sent with the request. + * @param string|null $value Cookie value. + */ + public function add_default_cookie( array|string $cookies, ?string $value = null ): static { + if ( is_array( $cookies ) ) { + $this->default_cookies = array_merge( $this->default_cookies, $cookies ); + } else { + $this->default_cookies[ $cookies ] = $value; + } + + return $this; + } + + /** + * Flush the cookies for the request. + */ + public function flush_default_cookies(): static { + $this->default_cookies = []; + + return $this; + } + + /** + * Make a request with a set of cookies. + * + * @param array<string, string> $cookies Cookies to be sent with the request. + */ + public function with_cookies( array $cookies ): Pending_Testable_Request { + return $this->create_pending_request()->with_cookies( $cookies ); + } + + /** + * Make a request with a specific cookie. + * + * @param string $name Cookie name. + * @param string $value Cookie value. + */ + public function with_cookie( string $name, string $value ): Pending_Testable_Request { + return $this->with_cookies( [ $name => $value ] ); + } + + /** + * Automatically follow any redirects returned from the response. + * + * @param bool $value Whether to follow redirects. + */ + public function following_redirects( bool $value = true ): Pending_Testable_Request { + return $this->create_pending_request()->following_redirects( $value ); + } + + /** + * Visit the given URI with a GET request. + * + * @param mixed $uri Request URI. + * @param array $headers Request headers. + */ + public function get( $uri, array $headers = [] ): Test_Response { + return $this->create_pending_request()->get( $uri, $headers ); + } + + /** + * Legacy support for the WordPress core unit test's `go_to()` method. + * + * @deprecated Use {@see Mantle\Testing\Concerns\Makes_Http_Requests::get()} instead. + * @param string $url The URL for the request. + */ + public function go_to( string $url ): Test_Response { + return $this->create_pending_request()->get( $url ); + } + + /** + * Visit the given URI with a GET request, expecting a JSON response. + * + * @param string $uri URI to "get". + * @param array $headers Request headers. + * @param int $options JSON encoding options. + */ + public function get_json( $uri, array $headers = [], int $options = 0 ): Test_Response { + return $this->create_pending_request()->get_json( $uri, $headers, $options ); + } + + /** + * Call the given URI with a JSON request. + * + * @param string $method Request method. + * @param string $uri Request URI. + * @param array $data Request data. + * @param array $headers Request headers. + * @param int $options JSON encoding options. + * + * @throws RuntimeException If not implemented. + */ + public function json( string $method, string $uri, array $data = [], array $headers = [], int $options = 1 ): Test_Response { + return $this->create_pending_request()->json( $method, $uri, $data, $headers, $options ); + } + + /** + * Visit the given URI with a POST request. + * + * @param string $uri Request URI. + * @param array $data Request data. + * @param array $headers Request headers. + */ + public function post( string $uri, array $data = [], array $headers = [] ): Test_Response { + return $this->create_pending_request()->post( $uri, $data, $headers ); + } + + /** + * Visit the given URI with a POST request, expecting a JSON response. + * + * @param string $uri Request URI. + * @param array $data Request data. + * @param array $headers Request headers. + * @param int $options JSON encoding options. + */ + public function post_json( string $uri, array $data = [], array $headers = [], int $options = 0 ): Test_Response { + return $this->create_pending_request()->json( 'POST', $uri, $data, $headers ); + } + + /** + * Visit the given URI with a PUT request. + * + * @param string $uri Request URI. + * @param array $data Request data. + * @param array $headers Request headers. + */ + public function put( string $uri, array $data = [], array $headers = [] ): Test_Response { + return $this->create_pending_request()->put( $uri, $data, $headers ); + } + + /** + * Visit the given URI with a PUT request, expecting a JSON response. + * + * @param string $uri Request URI. + * @param array $data Request data. + * @param array $headers Request headers. + * @param int $options JSON encoding options. + */ + public function put_json( string $uri, array $data = [], array $headers = [], int $options = 0 ): Test_Response { + return $this->create_pending_request()->json( 'PUT', $uri, $data, $headers, $options ); + } + + /** + * Visit the given URI with a PATCH request. + * + * @param string $uri Request URI. + * @param array $data Request data. + * @param array $headers Request headers. + */ + public function patch( $uri, array $data = [], array $headers = [] ): Test_Response { + return $this->create_pending_request()->patch( $uri, $data, $headers ); + } + + /** + * Visit the given URI with a PATCH request, expecting a JSON response. + * + * @param string $uri Request URI. + * @param array $data Request data. + * @param array $headers Request headers. + * @param int $options JSON encoding options. + */ + public function patch_json( $uri, array $data = [], array $headers = [], int $options = 0 ): Test_Response { + return $this->create_pending_request()->json( 'PATCH', $uri, $data, $headers, $options ); + } + + /** + * Visit the given URI with a DELETE request. + * + * @param string $uri Request URI. + * @param array $data Request data. + * @param array $headers Request headers. + */ + public function delete( $uri, array $data = [], array $headers = [] ): Test_Response { + return $this->create_pending_request()->delete( $uri, $data, $headers ); + } + + /** + * Visit the given URI with a DELETE request, expecting a JSON response. + * + * @param string $uri Request URI. + * @param array $data Request data. + * @param array $headers Request headers. + * @param int $options JSON encoding options. + */ + public function delete_json( $uri, array $data = [], array $headers = [], int $options = 0 ): Test_Response { + return $this->create_pending_request()->json( 'DELETE', $uri, $data, $headers, $options ); + } + + /** + * Visit the given URI with a OPTIONS request. + * + * @param string $uri Request URI. + * @param array $data Request data. + * @param array $headers Request headers. + */ + public function options( $uri, array $data = [], array $headers = [] ): Test_Response { + return $this->create_pending_request()->options( $uri, $data, $headers ); + } + + /** + * Visit the given URI with a OPTIONS request, expecting a JSON response. + * + * @param string $uri Request URI. + * @param array $data Request data. + * @param array $headers Request headers. + * @param int $options JSON encoding options. + * @return Test_Response + */ + public function options_json( $uri, array $data = [], array $headers = [], int $options = 0 ) { + return $this->create_pending_request()->json( 'OPTIONS', $uri, $data, $headers, $options ); + } + + /** + * Call a given Closure/method before requests and inject its dependencies. + * + * @param callable|string $callback Callback to invoke. + * @return static + */ + public function before_request( $callback ) { + $this->before_callbacks[] = $callback; + + return $this; + } + + /** + * Call a given Closure/method after requests and inject its dependencies. + * + * Callback will be invoked with a 'response' argument. + * + * @param callable|string $callback Callback to invoke. + * @return static + */ + public function after_request( $callback ) { + $this->after_callbacks[] = $callback; + + return $this; + } + + /** + * Call all of the "before" callbacks for the requests. + */ + public function call_before_callbacks(): void { + foreach ( $this->before_callbacks as $before_callback ) { + $this->app->call( $before_callback ); + } + } + + /** + * Call all of the "after" callbacks for the request. + * + * @param Test_Response $response Response object. + */ + public function call_after_callbacks( Test_Response $response ): void { + foreach ( $this->after_callbacks as $after_callback ) { + $this->app->call( + $after_callback, + [ + 'response' => $response, + ] + ); + } + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-multisite-test.php b/vendor/mantle-framework/testing/concerns/trait-multisite-test.php new file mode 100644 index 00000000..6d43a3f9 --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-multisite-test.php @@ -0,0 +1,22 @@ +<?php +/** + * Multisite_Test trait file + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +/** + * Trait to ensure the request is made in multisite mode and skipped otherwise. + */ +trait Multisite_Test { + /** + * Setup the trait. + */ + public function multisite_test_set_up(): void { + if ( ! is_multisite() ) { + $this->markTestSkipped( 'This test requires multisite.' ); + } + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-network-admin-screen.php b/vendor/mantle-framework/testing/concerns/trait-network-admin-screen.php new file mode 100644 index 00000000..4fa35310 --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-network-admin-screen.php @@ -0,0 +1,64 @@ +<?php +/** + * This file contains the Network_Admin_Screen trait + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +/** + * This trait, when used, sets the current screen so that `is_network_admin()` + * is true. + */ +trait Network_Admin_Screen { + /** + * Backed up screen. + * + * @var \WP_Screen|null + */ + protected $backup_screen; + + /** + * Backup the current screen. + */ + public function network_admin_screen_set_up(): void { + /** WordPress Administration Screen API */ + if ( ! class_exists( 'WP_Screen' ) ) { + require_once ABSPATH . 'wp-admin/includes/class-wp-screen.php'; + } + + if ( ! function_exists( 'get_current_screen' ) ) { + require_once ABSPATH . 'wp-admin/includes/screen.php'; + } + + // phpcs:disable WordPress.WP.GlobalVariablesOverride + $GLOBALS['pagenow'] = 'index.php'; + $GLOBALS['wp_importers'] = null; + $GLOBALS['hook_suffix'] = 'index.php'; + $GLOBALS['plugin_page'] = null; + $GLOBALS['typenow'] = ''; + $GLOBALS['taxnow'] = ''; + // phpcs:enable + + $this->backup_screen = get_current_screen(); + set_current_screen( 'dashboard-network' ); + } + + /** + * Restore the backed up screen. + */ + public function network_admin_screen_tear_down(): void { + // Restore screen to state at setUp. + set_current_screen( $this->backup_screen ); + + unset( + $GLOBALS['pagenow'], + $GLOBALS['wp_importers'], + $GLOBALS['hook_suffix'], + $GLOBALS['plugin_page'], + $GLOBALS['typenow'], + $GLOBALS['taxnow'] + ); + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-output-messages.php b/vendor/mantle-framework/testing/concerns/trait-output-messages.php new file mode 100644 index 00000000..9c5f7d1a --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-output-messages.php @@ -0,0 +1,144 @@ +<?php +/** + * Output_Messages trait file + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +use ErrorException; + +use function Mantle\Support\Helpers\collect; +use function Termwind\render; + +/** + * Messages for testing managed with Termwind. + */ +trait Output_Messages { + /** + * Render a message to the console. + * + * @param string $prefix Prefix for the message. + * @param string $prefix_color Color for the prefix. + * @param string $message Message to render. + * @param string $message_color Color for the message. + * @param string $parent_classes Parent classes for the message. + * @return void + */ + protected static function message( + string $prefix, + string $prefix_color, + string $message, + string $message_color = 'white', + string $parent_classes = '', + ) { + render( + sprintf( + '<div class="%s"> + <div class="px-1 bg-%s text-%s">%s:</div> + <span class="ml-1">%s</span> + </div>', + $parent_classes, + $prefix_color, + $message_color, + $prefix, + $message, + ) + ); + } + + /** + * Output a info message to the console. + * + * @param string $message Message to output. + * @param string $prefix Prefix to output. + */ + public static function info( string $message, $prefix = 'Install' ): void { + static::message( $prefix, 'yellow-600', $message ); + } + + /** + * Output a success message to the console. + * + * @param string $message Message to output. + * @param string $prefix Prefix to output. + */ + public static function success( string $message, $prefix = 'Install' ): void { + static::message( $prefix, 'lime-600', $message ); + } + + /** + * Output a error message to the console. + * + * @param string $message Message to output. + * @param string $prefix Prefix to output. + */ + public static function error( string $message, $prefix = 'Install' ): void { + static::message( $prefix, 'red-800', $message, 'red-100', 'pt-1' ); + } + + /** + * Display a formatted code block. + * + * @link https://github.com/nunomaduro/termwind#code + * + * @param string|string[] $code Code to display. + */ + public static function code( $code ): void { + if ( is_array( $code ) ) { + $code = implode( PHP_EOL, $code ); + } + + render( "<div class=\"my-1\"><code>{$code}</code></div>" ); + } + + /** + * Outputs a trace message to the PHPUnit printer. + * + * @throws ErrorException With the trace found to trigger a trace. + * + * @param string $message Message to output. + * @param array $trace Trace to output. + */ + public static function trace( string $message, array $trace ): void { + $frames = collect( $trace ); + + // Attempt to find the trace with the '_doing_it_wrong' function call. + $function_call_index = $frames + ->filter( + fn ( array $item ) => in_array( + $item['function'], + [ + '_doing_it_wrong', + ], + true, + ) + ) + ->keys() + ->first(); + + if ( null !== $function_call_index ) { + $frame = $frames->get( $function_call_index ); + } else { + // Attempt to find the first trace that is not apart of the testing + // frameworks or packages. + $frame = $frames + ->filter( + fn ( array $item ) => false === strpos( + (string) $item['file'], + 'phpunit/phpunit', + ) + ) + ->first(); + } + + throw new ErrorException( + $message, + E_USER_ERROR, + E_USER_ERROR, + $frame['file'], + $frame['line'], + ); + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-phpunit-upgrade-warning.php b/vendor/mantle-framework/testing/concerns/trait-phpunit-upgrade-warning.php new file mode 100644 index 00000000..280107d5 --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-phpunit-upgrade-warning.php @@ -0,0 +1,130 @@ +<?php +/** + * PHPUnit_Upgrade_Warning trait file + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +use PHPUnit\Runner\Version; +use PHPUnit\TextUI\Configuration\Registry; +use PHPUnit\TextUI\Configuration\TestSuite; + +use function Mantle\Support\Helpers\collect; +use function Termwind\render; + +/** + * Provide a warning to users who are attempting to run PHPUnit 10+ against an + * incompatible codebase. + * + * PHPUnit 10+ requires code bases to use PSR-4 standards for test classes. We + * also need to be careful of any possible changes to the PHPUnit classes we're + * referencing because they are not covered by the backward compatibility promise + * for PHPUnit. + * + * @mixin \Mantle\Testing\Installation_Manager + */ +trait PHPUnit_Upgrade_Warning { + /** + * Whether to silence the PHPUnit 10+ warning. + */ + public bool $silence_phpunit_warning = false; + + /** + * Check if the current codebase is running PHPUnit 10 or higher. + */ + protected function is_running_phpunit_10_or_higher(): bool { + // Prevent conflicts if the internal class API changes. + if ( ! class_exists( Version::class ) || ! method_exists( Version::class, 'id' ) ) { + return false; + } + + return version_compare( '10.0.0', Version::id(), '<=' ); + } + + /** + * Warn the user if they're running PHPUnit 10+ against an incompatible test suite. + * + * @param TestSuite $test_suite Test suite configuration. + */ + protected function warn_if_test_suite_contains_legacy_test_cases( TestSuite $test_suite ): void { + if ( $this->silence_phpunit_warning ) { + return; + } + + // Prevent conflicts if the internal class API changes. + if ( ! method_exists( $test_suite, 'directories' ) ) { + return; + } + + // Check if the test suite contains directories with a 'test-' prefix. That + // is a clear sign of a legacy test suite. + $legacy_test_cases = collect( $test_suite->directories() ) + ->filter( + fn ( $directory ) => method_exists( $directory, 'prefix' ) && 'test-' === $directory->prefix(), + ); + + if ( $legacy_test_cases->is_empty() ) { + return; + } + + render( + <<<HTML + <div class="space-y-1"> + <div class="bg-red-300 text-red-700 pt-2 py-2"> + <strong>🚨 Warning:</strong> You are running PHPUnit 10+ against a test suite that contains legacy test cases. + </div> + <div> + <span class="text-blue-300">Mantle Testing Framework 1.1</span> includes <span class="text-yellow-500 font-bold">✨ PHPUnit 11 ✨</span> which requires test cases to follow PSR-4 standards. + <br /> + For example, that would be <span class="italic">tests/Feature/MyExampleTest.php</span> instead of <span class="italic">tests/feature/test-my-example.php</span>. + <br /> + Fear not, you don't have to upgrade to PHPUnit 11 right away. You can still keep your test suite as-is and use PHPUnit 9 by running the following code: + + <div class="ml-2 mt-1 italic">composer require --dev phpunit/phpunit:^9 nunomaduro/collision:^6 -W</div> + </div> + <div> + For more information and tips on how to upgrade your codebase to PHPUnit 10, please refer to the 1.0 Release Changelog: + + <div class="ml-2 my-1 italic"> + https://github.com/alleyinteractive/mantle-framework/blob/1.x/CHANGELOG.md#phpunit-10-migration + </div> + </div> + </div> + HTML, + ); + + $this->silence_phpunit_warning(); + } + + /** + * Warn the user if they're running PHPUnit 10+ against an incompatible codebase. + */ + protected function warn_if_phpunit_10_or_higher(): void { + if ( $this->silence_phpunit_warning || ! $this->is_running_phpunit_10_or_higher() ) { + return; + } + + if ( ! class_exists( Registry::class ) || ! method_exists( Registry::class, 'get' ) ) { + return; + } + + $registry = Registry::get(); + + foreach ( $registry->testSuite()->asArray() as $test_suite ) { + if ( $test_suite instanceof TestSuite ) { + $this->warn_if_test_suite_contains_legacy_test_cases( $test_suite ); + } + } + } + + /** + * Silence the PHPUnit 10+ warning. + */ + public function silence_phpunit_warning(): static { + $this->silence_phpunit_warning = true; + + return $this; + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-prevent-remote-requests.php b/vendor/mantle-framework/testing/concerns/trait-prevent-remote-requests.php new file mode 100644 index 00000000..a925977a --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-prevent-remote-requests.php @@ -0,0 +1,27 @@ +<?php +/** + * Prevent_Remote_Requests trait file + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +use Mantle\Testing\Mock_Http_Response; + +/** + * Prevent remote requests from being made by providing a default response to + * the remote request. + * + * @mixin \Mantle\Testing\Test_Case + */ +trait Prevent_Remote_Requests { + /** + * Setup the trait. + */ + public function prevent_remote_requests_set_up(): void { + if ( ! $this->prevent_remote_requests ) { + $this->prevent_stray_requests( new Mock_Http_Response() ); + } + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-reads-annotations.php b/vendor/mantle-framework/testing/concerns/trait-reads-annotations.php new file mode 100644 index 00000000..bd222387 --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-reads-annotations.php @@ -0,0 +1,88 @@ +<?php +/** + * Reads_Annotations trait file + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +use PHPUnit\Metadata\Annotation\Parser\DocBlock; +use PHPUnit\Metadata\Annotation\Parser\Registry; +use PHPUnit\Util\Test; +use ReflectionClass; + +/** + * Read annotations for testing that supports multiple versions of PHPUnit. + * + * @mixin \PHPUnit\Framework\TestCase + */ +trait Reads_Annotations { + /** + * Read docblock annotations for the current test case and method. + */ + public function get_annotations_for_method(): array { + // PHPUnit 9.4 and below method. + if ( method_exists( $this, 'getAnnotations' ) ) { + return $this->getAnnotations(); + } + + // Use the PHPUnit ^9.5 method if available. + if ( method_exists( Test::class, 'parseTestMethodAnnotations' ) ) { // @phpstan-ignore-line + return Test::parseTestMethodAnnotations( + static::class, + $this->getName(), // @phpstan-ignore-line + ); + } + + // Use the PHPUnit 10.x method if available. + if ( class_exists( Registry::class ) && class_exists( DocBlock::class ) ) { + $registry = Registry::getInstance(); + + return [ + 'class' => $registry->forClassName( static::class )->symbolAnnotations(), + 'method' => $registry->forMethod( static::class, $this->name() )->symbolAnnotations(), + ]; + } + + // Throw a warning if we can't read annotations. + trigger_error( // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error + 'Unable to read annotations for test method. Please file an issue with https://github.com/alleyinteractive/mantle-framework', + E_USER_WARNING + ); + + return []; + } + + /** + * Read the attributes for the current test case and method. + * + * Supports PHPUnit 9.5+ and 10.x. + * + * @param class-string $name Filter the results to include only ReflectionAttribute instances for attributes matching this class name. + * @return array<\ReflectionAttribute> + */ + public function get_attributes_for_method( ?string $name = null ): array { + $class = new ReflectionClass( $this ); + + // Use either the PHPUnit 9.5+ method or the PHPUnit 10.x method to get the method. + if ( method_exists( $this, 'getName' ) ) { + $method = $class->getMethod( $this->getName( false ) ); + } elseif ( method_exists( $this, 'name' ) ) { + $method = $class->getMethod( $this->name() ); + } elseif ( isset( $this->name ) ) { + $method = $class->getMethod( $this->name ); + } else { + trigger_error( // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error + 'Unable to read annotations for test method. Please file an issue with https://github.com/alleyinteractive/mantle-framework', + ); + + return []; + } + + return [ + ...$class->getAttributes( $name ), + ...$method->getAttributes( $name ), + ]; + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-refresh-database.php b/vendor/mantle-framework/testing/concerns/trait-refresh-database.php new file mode 100644 index 00000000..0dd342e6 --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-refresh-database.php @@ -0,0 +1,89 @@ +<?php +/** + * This file contains the Refresh_Database trait + * + * @package Mantle + */ + +// phpcs:disable WordPress.DB.DirectDatabaseQuery,WordPressVIPMinimum.Variables.RestrictedVariables.user_meta__wpdb__users + +namespace Mantle\Testing\Concerns; + +trait Refresh_Database { + + /** + * Routines to run before setupBeforeClass. + */ + public static function refresh_database_setup_before_class(): void { + global $wpdb; + + $wpdb->suppress_errors = false; + $wpdb->show_errors = true; + $wpdb->db_connect(); + + ini_set( 'display_errors', '1' ); // phpcs:ignore WordPress.PHP.IniSet.display_errors_Blacklisted + } + + /** + * Start the transaction on setUp(). + */ + public function refresh_database_set_up(): void { + $this->start_transaction(); + } + + /** + * Routines to run on tearDown(). + */ + public function refresh_database_tear_down(): void { + global $wpdb; + $wpdb->query( 'ROLLBACK' ); + remove_filter( 'query', [ $this, 'create_temporary_tables' ] ); + remove_filter( 'query', [ $this, 'drop_temporary_tables' ] ); + } + + /** + * Commit the queries in a transaction. + */ + public static function commit_transaction(): void { + global $wpdb; + $wpdb->query( 'COMMIT;' ); + } + + /** + * Starts a database transaction. + */ + public function start_transaction(): void { + global $wpdb; + $wpdb->query( 'SET autocommit = 0;' ); + $wpdb->query( 'START TRANSACTION;' ); + add_filter( 'query', [ $this, 'create_temporary_tables' ] ); + add_filter( 'query', [ $this, 'drop_temporary_tables' ] ); + } + + /** + * Replaces the `CREATE TABLE` statement with a `CREATE TEMPORARY TABLE` statement. + * + * @param string $query The query to replace the statement for. + * @return string The altered query. + */ + public function create_temporary_tables( $query ) { + if ( str_starts_with( trim( $query ), 'CREATE TABLE' ) ) { + return substr_replace( trim( $query ), 'CREATE TEMPORARY TABLE', 0, 12 ); + } + return $query; + } + + /** + * Replaces the `DROP TABLE` statement with a `DROP TEMPORARY TABLE` statement. + * + * @param string $query The query to replace the statement for. + * @return string The altered query. + */ + public function drop_temporary_tables( $query ) { + if ( str_starts_with( trim( $query ), 'DROP TABLE' ) ) { + return substr_replace( trim( $query ), 'DROP TEMPORARY TABLE', 0, 10 ); + } + return $query; + } +} +// phpcs:enable diff --git a/vendor/mantle-framework/testing/concerns/trait-reset-data-structures.php b/vendor/mantle-framework/testing/concerns/trait-reset-data-structures.php new file mode 100644 index 00000000..a62582c0 --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-reset-data-structures.php @@ -0,0 +1,26 @@ +<?php +/** + * Reset_Data_Structures trait file + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +/** + * Reset the data structures on set up. + * + * When the trait is used it will reset the post types and taxonomies back to + * their original state for each test run. + */ +trait Reset_Data_Structures { + use WordPress_State; + + /** + * Reset the data structures on set up. + */ + public function reset_data_structures_set_up(): void { + $this->reset_post_types(); + $this->reset_taxonomies(); + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-rsync-installation.php b/vendor/mantle-framework/testing/concerns/trait-rsync-installation.php new file mode 100644 index 00000000..17b5418a --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-rsync-installation.php @@ -0,0 +1,543 @@ +<?php +/** + * Rsync_Installation trait file + * + * phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound + * phpcs:disable WordPress.PHP.DiscouragedPHPFunctions.runtime_configuration_putenv + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +use Mantle\Support\Traits\Conditionable; +use Mantle\Testing\Utils; + +use function Mantle\Support\Helpers\collect; + +/** + * Trait to manage rsync-ing the codebase to live within a WordPress + * installation. + * + * WordPress plugins/themes commonly need live within within a valid WordPress + * installation. This can allow for end-to-end testing of a WordPress + * plugin/theme from code that is written in a standalone repository. For + * example, a repository can contain only a theme. Mantle will internally rsync + * the theme to a WordPress installation without needing to run a bash script. + * + * After the rsync is complete, PHPUnit will be rerun from the new location. + * + * @mixin \Mantle\Testing\Installation_Manager + */ +trait Rsync_Installation { + use Conditionable; + + /** + * Storage location to rsync the codebase to. + */ + protected ?string $rsync_to = null; + + /** + * Storage location to rsync the codebase from. + */ + protected ?string $rsync_from = null; + + /** + * Subdirectory from the parent folder being rsync-ed to the previous working + * directory. + */ + protected ?string $rsync_subdir = ''; + + /** + * Plugin slugs or URLs to ZIP files to install after rsyncing the codebase. + * + * @var array<int, array{0: string, 1: string|null}> + */ + protected array $plugins = []; + + /** + * Exclusions to be used when rsyncing the codebase. + * + * @var string[] + */ + protected array $rsync_exclusions = []; + + /** + * Add the default set of exclusions to the list of exclusions to be used when rsyncing the codebase. + */ + public function with_default_exclusions(): static { + return $this->exclusions( + [ + '.buddy', + '.git', + '.github', + '.npm', + '.phpcs', + '.turbo', + '.phpunit.result.cache', + 'node_modules', + 'phpstan.neon', + ] + ); + } + + /** + * Rsync the code base to be located under a valid WordPress installation. + * + * By default, the codebase will be rsynced to the `wp-content` directory. The + * `to` path is assumed to be relative to the `wp-content` folder. + * + * @param string $to Location to rsync to within `wp-content`. + * @param string $from Location to rsync from. + */ + public function rsync( string $to = null, string $from = null ): static { + $this->rsync_to = $to ?: '/'; + $this->rsync_from = $from ?: getcwd() . '/'; + + return $this; + } + + /** + * Rsync the code base to be located underneath a WordPress installation if it + * isn't already. + * + * @param string $to Location to rsync to. + * @param string $from Location to rsync from. + */ + public function maybe_rsync( string $to = null, string $from = null ): static { + // Check if we are under an existing WordPress installation. + if ( $this->is_within_wordpress_install() ) { + return $this; + } + + return $this->rsync( $to, $from ); + } + + /** + * Maybe rsync the codebase to the wp-content within WordPress. + * + * Will attempt to locate the wp-content directory relative to the current + * directory. As a fallback, it will assume it is being called from either + * /wp-content/plugin/:plugin/tests OR /wp-content/themes/:theme/tests. Will + * rsync the codebase from the wp-content level to the root of the WordPress + * installation. Also will attempt to locate the wp-content directory relative + * to the current directory. + * + * This isn't a perfect function and can sometimes fail to locate the proper + * `wp-content` directory. If it does fail to work, manually call + * `maybe_rsync()` yourself with the proper paths. + */ + public function maybe_rsync_wp_content(): static { + // Attempt to locate wp-content relative to the current directory. + if ( false !== strpos( __DIR__, '/wp-content/' ) ) { + return $this->maybe_rsync( '/', preg_replace( '/\/wp-content\/.*$/', '/wp-content', __DIR__ ) ); + } elseif ( preg_match( '/\/(?:client-mu-plugins|mu-plugins|plugins|themes)\/.*/', __DIR__ ) ) { + /** + * Attempt to locate the wp-content directory relative to the current + * directory by finding the WordPress-parent folder after wp-content. Used + * when the directory structure doesn't contain wp-content but contains a + * subfolder that we can use to locate the WordPress installation such as + * plugins, themes, etc. This is common for wp-content-rooted projects + * that have the root of their directory structure as the wp-content + * folder. + */ + return $this->maybe_rsync( '/', preg_replace( '/\/(?:client-mu-plugins|mu-plugins|plugins|themes)\/.*/', '', __DIR__ ) ); + } + + return $this->maybe_rsync( '/', dirname( getcwd(), 3 ) ); + } + + /** + * Attempt to install VIP's built mu-plugins into the codebase. + * + * Will only be applied if the codebase is not already within a WordPress and + * is being rsync-ed to one. + * + * @param bool $install Install VIP's built mu-plugins into the codebase. + */ + public function with_vip_mu_plugins( bool $install = true ): static { + if ( $this->is_within_wordpress_install() ) { + return $this; + } + + $this->add_exclusion( 'mu-plugins' ); + + putenv( 'MANTLE_INSTALL_VIP_MU_PLUGINS=' . ( $install ? '1' : '0' ) ); + + return $this; + } + + /** + * Attempt to install the object cache drop-in into the codebase. + * + * Will only be applied if the codebase is not already within a WordPress and + * is being rsync-ed to one. + * + * @param bool|string $install The object cache provider to install (redis/memcached) + * or true to install the default Memcached object cache (legacy). + */ + public function with_object_cache( bool|string $install = true ): static { + if ( $this->is_within_wordpress_install() ) { + return $this; + } + + // Allow object cache to be disabled. + if ( ! $install ) { + putenv( 'MANTLE_INSTALL_OBJECT_CACHE=' ); + + return $this; + } elseif ( true === $install ) { + $install = 'memcached'; + } + + if ( ! in_array( $install, [ 'redis', 'memcached' ], true ) ) { + Utils::error( 'Invalid object cache provider. Must be either "redis" or "memcached". Skipping...' ); + + return $this; + } + + if ( 'memcached' === $install ) { + // Check if Memcached is installed before proceeding. + if ( ! class_exists( \Memcached::class ) && ! Utils::env( 'MANTLE_REQUIRE_OBJECT_CACHE', false ) ) { + Utils::error( 'Memcached is not installed. Cannot install object cache. Skipping...' ); + + return $this; + } + } + + $this->add_exclusion( 'object-cache.php' ); + + putenv( 'MANTLE_INSTALL_OBJECT_CACHE=' . $install ); + + return $this; + } + + /** + * Install SQLite db.php drop-in into the codebase. + * + * This will only be applied if the codebase is being rsync-ed to a WordPress + * installation. + * + * @param bool $install Install the SQLite db.php drop-in into the codebase. + */ + public function with_sqlite( bool $install = true ): static { + if ( $this->is_within_wordpress_install() ) { + return $this; + } + + putenv( 'MANTLE_USE_SQLITE=' . ( $install ? '1' : '0' ) ); + putenv( 'WP_SKIP_DB_CREATE=1' ); + + $this->exclusions( + [ + 'db.php', + 'sqlite-database-integration', + ] + ); + + return $this; + } + + /** + * Install a specific plugin into the rsync-ed codebase. + * + * Used to install a plugin from WordPress.org or a ZIP file to the codebase + * after rsyncing. + * + * @param string $plugin Plugin slug to install. Will be installed at /wp-content/plugins/{plugin}. + * @param string $version_or_url Plugin version to install OR a URL to a ZIP file to install. + */ + public function install_plugin( string $plugin, string $version_or_url = 'latest' ): static { + // Ensure that the plugin slug is not a URL. + if ( false !== strpos( $plugin, '://' ) ) { + Utils::error( + 'Plugin slug cannot be a URL. Please provide a plugin slug and specify the URL or the version in the second argument.', + 'Install Rsync' + ); + + exit( 1 ); + } + + $this->plugins[] = [ $plugin, $version_or_url ]; + + return $this; + } + + /** + * Maybe rsync the codebase as a plugin within WordPress. + * + * By default, the from path will be rsynced to `wp-content/plugins/{directory_name}`. + * + * @param string $name Name of the plugin folder, optional. + * @param string $from Location to rsync from. + */ + public function maybe_rsync_plugin( string $name = null, string $from = null ): static { + if ( ! $name ) { + $name = basename( getcwd() ); + } + + return $this->maybe_rsync( "plugins/{$name}", $from ); + } + + /** + * Maybe rsync the codebase as a theme within WordPress. + * + * By default, the from path will be rsynced to `wp-content/themes/{directory_name}`. + * + * @param string $name Name of the theme folder, optional. + * @param string $from Location to rsync from. + */ + public function maybe_rsync_theme( string $name = null, string $from = null ): static { + if ( ! $name ) { + $name = basename( getcwd() ); + } + + return $this->maybe_rsync( "themes/{$name}", $from ); + } + + /** + * Specify the exclusions to be used when rsyncing the codebase. + * + * @param string[] $exclusions Exclusions to be used when rsyncing the codebase. + * @param bool $merge Whether to merge the exclusions with the default exclusions. + */ + public function exclusions( array $exclusions, bool $merge = true ): static { + $this->rsync_exclusions = collect( $merge ? $this->rsync_exclusions : [] ) + ->merge( $exclusions ) + ->unique() + ->values() + ->all(); + + return $this; + } + + /** + * Add an exclusion to the list of exclusions to be used when rsyncing the codebase. + * + * @param string $exclusion Exclusion to add to the list of exclusions. + */ + public function add_exclusion( string $exclusion ): static { + return $this->exclusions( [ $exclusion ], true ); + } + + /** + * Remove an exclusion from the list of exclusions to be used when rsyncing the codebase. + * + * @param string $exclusion Exclusion to remove from the list of exclusions. + */ + public function remove_exclusion( string $exclusion ): static { + $this->rsync_exclusions = collect( $this->rsync_exclusions ) + ->filter( fn ( $item ) => $item !== $exclusion ) + ->unique() + ->values() + ->all(); + + return $this; + } + + /** + * Retrieve the default installation path to rsync to. + */ + protected function get_installation_path(): string { + return getenv( 'WP_CORE_DIR' ) ?: sys_get_temp_dir() . '/wordpress'; + } + + /** + * Check if the current installation is underneath an existing WordPress + * installation. + */ + protected function is_within_wordpress_install(): bool { + return false !== strpos( __DIR__, '/wp-content/' ); + } + + /** + * Rsync the codebase before installation. + * + * This allows the plugin/theme project to properly situate itself within a + * WordPress installation without needing to rsync it manually. + */ + protected function perform_rsync_testsuite() { + require_once __DIR__ . '/../class-utils.php'; + + $base_install_path = $this->get_installation_path(); + + // Normalize the rsync paths. Ensure that both have a trailing slash to be + // inclusive of the directory's contents and not just the directory itself. + $this->rsync_from = rtrim( $this->rsync_from, '/' ) . '/'; + $this->rsync_to = rtrim( "$base_install_path/wp-content/{$this->rsync_to}", '/' ) . '/'; + + // Store the subdirectory of the current working directory relative to the + // from rsync path. + $this->rsync_subdir = str_replace( $this->rsync_from, '', rtrim( getcwd(), '/' ) . '/' ); + + // Define the constants relative to where the codebase is being rsynced to. + defined( 'WP_TESTS_INSTALL_PATH' ) || define( 'WP_TESTS_INSTALL_PATH', $base_install_path ); + defined( 'WP_TESTS_CONFIG_FILE_PATH' ) || define( 'WP_TESTS_CONFIG_FILE_PATH', "{$base_install_path}/wp-tests-config.php" ); + defined( 'ABSPATH' ) || define( 'ABSPATH', ensure_trailingslash( $base_install_path ) ); + + // Install WordPress at the base installation if it doesn't exist yet. + if ( ! is_dir( $base_install_path ) || ! is_file( "{$base_install_path}/wp-load.php" ) ) { + Utils::info( + "Installing WordPress at <em>{$base_install_path}</em> ...", + 'Install Rsync' + ); + + // Create the installation directory. + if ( ! is_dir( $base_install_path ) && ! mkdir( $base_install_path, 0777, true ) ) { // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.directory_mkdir + Utils::error( + "Unable to create the WordPress installation directory at <em>{$base_install_path}</em>", + 'Install Rsync' + ); + + exit( 1 ); + } + + Utils::install_wordpress( $base_install_path ); + Utils::success( + "WordPress installed at <em>{$base_install_path}</em>", + 'Install Rsync' + ); + } else { + Utils::info( + "WordPress already installed at <em>{$base_install_path}</em>", + 'Install Rsync' + ); + } + + Utils::info( + "Rsyncing <em>{$this->rsync_from}</em> to <em>{$this->rsync_to}</em>...", + 'Install Rsync' + ); + + if ( ! is_dir( $this->rsync_to ) && ! mkdir( $this->rsync_to, 0777, true ) ) { // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.directory_mkdir + Utils::error( + "Unable to create destination directory [{$this->rsync_to}]." + ); + + exit( 1 ); + } + + // Rsync the from folder to the destination. + $output = Utils::command( + [ + 'rsync -aWq --no-compress', + collect( $this->rsync_exclusions )->map( fn ( $exclusion ) => "--exclude '{$exclusion}'" )->implode( ' ' ), + '--delete', + "{$this->rsync_from} {$this->rsync_to}", + ], + $retval + ); + + if ( 0 !== $retval ) { + Utils::error( '🚨 Error rsyncing! Output from command:', 'Install Rsync' ); + Utils::code( $output ); + exit( 1 ); + } + + if ( ! chdir( $this->rsync_to . $this->rsync_subdir ) ) { + // Fallback to just the rsync_to directory without the subdirectory. + if ( ! chdir( $this->rsync_to ) ) { + Utils::error( + "Unable to change directory to <em>{$this->rsync_to}</em>", + 'Install Rsync' + ); + } + + exit( 1 ); + } + + $cwd = getcwd(); + + if ( ! empty( $this->plugins ) ) { + $this->install_plugins( $base_install_path ); + } + + Utils::success( + "Finished rsyncing to <em>{$this->rsync_to}</em> and working directory is now <em>{$cwd}</em>", + 'Install Rsync' + ); + + $command = $this->get_phpunit_command(); + + // Proxy to the phpunit instance within the new rsynced WordPress installation. + Utils::info( + "Running <em>{$command}</em> in <em>{$cwd}</em>", + 'Install Rsync' + ); + + system( $command, $result_code ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.system_calls_system + + exit( (int) $result_code ); + } + + /** + * Install the plugins after rsyncing the codebase. + * + * @param string $dir Directory to the WordPress installation. + */ + protected function install_plugins( string $dir ): void { + foreach ( $this->plugins as $item ) { + [ $plugin, $version_or_url ] = $item; + + if ( empty( $version_or_url ) ) { + $version_or_url = 'latest'; + } + + Utils::info( + "Installing plugin <em>{$plugin}</em> ({$version_or_url})...", + 'Install Rsync' + ); + + Utils::install_plugin( $dir, $plugin, $version_or_url ); + } + } + + /** + * Generate the command that will be run inside the rsync-ed WordPress + * installation to fire off PHPUnit. + */ + protected function get_phpunit_command(): string { + $args = (array) ( $_SERVER['argv'] ?? [] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized + + if ( ! empty( getenv( 'WP_PHPUNIT_PATH' ) ) ) { + $executable = getenv( 'WP_PHPUNIT_PATH' ); + } elseif ( ! empty( $args[0] ) && false !== strpos( (string) $args[0], 'phpunit' ) ) { + // Use the first argument and translate it to the rsync-ed path. + $executable = $this->translate_location( $args[0] ); + + // Attempt to fallback to the phpunit binary reference in PHP_SELF. This + // would be the one used to invoke the current script. With that, we can + // translate it to the new location in the rsync-ed WordPress + // installation. + if ( + ! empty( $_SERVER['PHP_SELF'] ) + && ! is_file( $executable ) + && ! is_executable( $executable ) + && ! str_starts_with( 'composer ', (string) $executable ) + ) { + $executable = $this->translate_location( $_SERVER['PHP_SELF'] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized + } + } + + // Default to a local phpunit in the vendor directory. + if ( empty( $executable ) ) { + $executable = 'vendor/bin/phpunit'; + } + + // Remove the first argument, which is the path to the phpunit binary. The + // rest will be forwarded to the command. + array_shift( $args ); + + return $executable . ' ' . implode( ' ', array_map( 'escapeshellarg', $args ) ); + } + + /** + * Translate a path from the rsync-ed WordPress installation to the original + * location. + * + * @param string $path Path to translate. + */ + protected function translate_location( string $path ): string { + return str_replace( $this->rsync_from, $this->rsync_to, $path ); + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-snapshot-testing.php b/vendor/mantle-framework/testing/concerns/trait-snapshot-testing.php new file mode 100644 index 00000000..7f8ffc1b --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-snapshot-testing.php @@ -0,0 +1,168 @@ +<?php +/** + * Snapshot_Testing trait file + * + * phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid + * phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +use DOMDocument; +use Mantle\Support\Arr; +use Mantle\Support\Str; +use Mantle\Testing\Snapshots\HTML_Driver; + +use function Mantle\Support\Helpers\collect; +use function Mantle\Support\Helpers\data_get; + +/** + * Snapshot Testing + * + * @link https://github.com/spatie/phpunit-snapshot-assertions + * + * @mixin \Mantle\Testing\Test_Response + */ +trait Snapshot_Testing { + /** + * Assert that the response matches a stored snapshot comparing only the content. + * + * Alias to `assertMatchesSnapshotContent()`. + * + * @param mixed ...$args Optional. Additional arguments to pass to the snapshot assertion. + */ + public function assertMatchesSnapshot( ...$args ): static { + return $this->assertMatchesSnapshotContent( ...$args ); + } + + /** + * Assert that the response's content matches a stored snapshot. + * + * Checks the response content-type to use the proper driver to make the + * assertion against. + * + * @param mixed ...$args Optional. Additional arguments to pass to the snapshot assertion. + */ + public function assertMatchesSnapshotContent( ...$args ): static { + if ( $this->test_case ) { + $content_type = $this->get_header( 'content-type' ); + + if ( Str::contains( $content_type, 'application/json', true ) ) { + return $this->assertMatchesSnapshotJson( ...$args ); + } elseif ( Str::contains( $content_type, 'text/html', true ) ) { + return $this->assertMatchesSnapshotHtml( ...$args ); + } else { + $this->test_case->assertMatchesSnapshot( $this->get_content() ); + } + } + + return $this; + } + + /** + * Assert that the response's HTML content matches a stored snapshot. + * + * @param array<string>|string|null $selectors Optional. The XPath selectors to include in the snapshot, or null to include the entire content. Defaults to the entire content. + */ + public function assertMatchesSnapshotHtml( array|string $selectors = null ): static { + if ( ! $this->test_case ) { + return $this; + } + + if ( empty( $selectors ) ) { + $this->test_case->assertMatchesSnapshot( $this->get_content(), new HTML_Driver() ); + + return $this; + } + + if ( ! is_array( $selectors ) ) { + $selectors = [ $selectors ]; + } + + // Extract from the content by the XPath selectors. + libxml_use_internal_errors( true ); + + $document = new DOMDocument( '1.0' ); + + // Mirror the internal HtmlDriver of the snapshot assertions package. + $document->preserveWhiteSpace = false; + $document->formatOutput = true; + + // To ignore HTML5 errors. + @$document->loadHTML( $this->get_content(), LIBXML_HTML_NODEFDTD | LIBXML_HTML_NOIMPLIED ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged + + $nodes = ( new \DOMXPath( $document ) )->query( implode( '|', $selectors ) ); + + if ( 0 === count( $nodes ) ) { + $this->test_case->fail( 'No nodes found for the given XPath selector(s): ' . print_r( $selectors, true ) ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r + } + + $results = []; + + foreach ( $nodes as $node ) { + $results[] = $document->saveHTML( $node ); + } + + $this->test_case->assertMatchesSnapshot( implode( "\n", $results ), new HTML_Driver() ); + + return $this; + } + + /** + * Assert that the response's JSON content matches a stored snapshot. + * + * @param array<string>|string|null $keys Optional. The keys to include in the snapshot. + */ + public function assertMatchesSnapshotJson( array|string|null $keys = null ): static { + if ( $this->test_case ) { + $content = $this->decoded_json()->get_decoded(); + + // If keys are provided, only include those keys in the snapshot. + if ( $keys ) { + $content = collect( Arr::wrap( $keys ) ) + ->unique() + ->flip() + ->map( + fn ( $value, string $key ) => data_get( $content, $key, [] ), + ) + ->to_array(); + } + + $this->test_case->assertMatchesJsonSnapshot( $content ); + } + + return $this; + } + + /** + * Assert that the response matches the stored snapshot, comparing status + * code, headers, and content. + * + * **Note:** asserting against the headers of a response can lead to leaky tests + * that break not too long after they are written. `assertMatchesSnapshotContent()` + * is a better alternative. + */ + public function assertMatchesSnapshotWithStatusAndHeaders(): static { + return $this + ->assertStatusAndHeadersMatchSnapshot() + ->assertMatchesSnapshotContent(); + } + + /** + * Assert that the response's status code and headers match a stored snapshot. + */ + public function assertStatusAndHeadersMatchSnapshot(): static { + if ( $this->test_case ) { + $this->test_case->assertMatchesSnapshot( + [ + $this->get_status_code(), + $this->get_headers(), + ] + ); + } + + return $this; + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-with-faker.php b/vendor/mantle-framework/testing/concerns/trait-with-faker.php new file mode 100644 index 00000000..3a117198 --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-with-faker.php @@ -0,0 +1,50 @@ +<?php +/** + * This file contains the With_Faker trait + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +use Faker\Generator; +use Faker\Factory; +use Mantle\Faker\Faker_Provider; + +/** + * This trait sets up a faker instance for use in tests. + */ +trait With_Faker { + /** + * Faker instance. + */ + protected Generator $faker; + + /** + * Setup the Faker instance. + */ + public function with_faker_set_up(): void { + $this->faker = $this->make_faker(); + + $this->faker->unique( true ); + } + + /** + * Create a faker instance. + */ + protected function make_faker(): Generator { + $locale = isset( $this->app['config'] ) + ? $this->app['config']->get( 'app.faker_locale', Factory::DEFAULT_LOCALE ) + : Factory::DEFAULT_LOCALE; + + if ( isset( $this->app ) && $this->app->bound( Generator::class ) ) { + return $this->app->make( Generator::class, [ 'locale' => $locale ] ); + } + + $generator = Factory::create( $locale ); + + $generator->addProvider( new Faker_Provider( $generator ) ); + + return $generator; + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-wordpress-authentication.php b/vendor/mantle-framework/testing/concerns/trait-wordpress-authentication.php new file mode 100644 index 00000000..4fedadf9 --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-wordpress-authentication.php @@ -0,0 +1,154 @@ +<?php +/** + * This file contains the WordPress_Authentication trait + * + * phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +use Mantle\Database\Model\Model_Exception; +use Mantle\Database\Model\User; +use Mantle\Testing\Attributes\Acting_As; +use Mantle\Testing\Exceptions\Exception; +use PHPUnit\Framework\Assert; +use WP_User; + +use function Mantle\Support\Helpers\get_user_object; + +/** + * Trait to provide authentication-related testing functionality. + * + * @mixin \PHPUnit\Framework\TestCase + */ +trait WordPress_Authentication { + use Reads_Annotations; + + /** + * Backed up global user ID. + * + * @var int + */ + protected $backup_user; + + /** + * Backup the current global user. + */ + public function wordpress_authentication_set_up(): void { + $this->backup_user = get_current_user_id(); + + // Set the test case up using the user from the attribute in descending order (class -> method). + foreach ( $this->get_attributes_for_method( Acting_As::class ) as $attribute ) { + $this->acting_as( $attribute->newInstance()->user ); + } + } + + /** + * Restore the backed up global user. + */ + public function wordpress_authentication_tear_down(): void { + // If the user changed, set it back. + if ( get_current_user_id() !== $this->backup_user ) { + wp_set_current_user( $this->backup_user ); + } + } + + /** + * Set the current user. + * + * If a \WP_User, int (user ID), or Mantle\Database\Model\User is + * passed, that user will be used. If a string is passed, that is assumed to + * be a role, and a new user will be created with that role. The user (as a + * \WP_User) will then be returned. + * + * @throws Exception|Model_Exception If the user could not be set or created. + * + * @param User|WP_User|string|int|null $user Either a user to use, or a role in which to create a new + * user. + * @return \WP_User User which is now being used in the WordPress state. + */ + public function acting_as( User|WP_User|string|int|null $user ): WP_User { + $user_id = null; + if ( is_string( $user ) ) { + $model = $this->create_user_with_role( $user ); + $user_id = $model->id(); + } elseif ( is_int( $user ) ) { + $user_id = $user; + } elseif ( $user instanceof User ) { + $user_id = $user->id(); + } elseif ( $user instanceof WP_User ) { + $user_id = $user->ID; + } + + if ( $user_id ) { + wp_set_current_user( $user_id ); + return get_user_object( $user_id ); + } + + throw new Exception( 'Could not find or create the user' ); + } + + /** + * Alias to `acting_as()`. + * + * @param User|WP_User|string|int|null $user + */ + public function actingAs( User|WP_User|string|int|null $user ): WP_User { + return $this->acting_as( $user ); + } + + /** + * Generate a user with the given role. + * + * @throws Model_Exception If the user could not be saved to the database. + * + * @param string $role Role. + */ + public function create_user_with_role( string $role ): User { + return User::factory()->as_models()->create_and_get( [ 'role' => $role ] ); + } + + /** + * Assert that we are authenticated with a given user/role. + * + * @param User|WP_User|string|int|null|mixed $user User to check. + */ + public function assertAuthenticated( mixed $user = null ): void { + if ( empty( $user ) ) { + Assert::assertTrue( is_user_logged_in(), 'User is not authenticated.' ); + return; + } + + $current_user = wp_get_current_user(); + + if ( ! $current_user ) { // @phpstan-ignore-line always exists + Assert::fail( 'User is not authenticated.' ); + } else { + match ( true ) { + $user instanceof User => Assert::assertEquals( $user->id(), $current_user->ID ), + is_int( $user ) => Assert::assertEquals( $user, $current_user->ID ), + $user instanceof WP_User => Assert::assertEquals( $user->ID, $current_user->ID ), + is_string( $user ) => Assert::assertTrue( in_array( $user, $current_user->roles, true ) ), + default => Assert::fail( 'Unexpected argument passed to assertAuthenticated().' ), + }; + } + } + + /** + * Assert that we are not authenticated. + */ + public function assertGuest(): void { + Assert::assertFalse( is_user_logged_in(), 'User is authenticated.' ); + } + + /** + * Assert that the given user not authenticated. + * + * Alias to `assertGuest()`. + */ + public function assertNotAuthenticated(): void { + $this->assertGuest(); + } +} diff --git a/vendor/mantle-framework/testing/concerns/trait-wordpress-state.php b/vendor/mantle-framework/testing/concerns/trait-wordpress-state.php new file mode 100644 index 00000000..fcb00976 --- /dev/null +++ b/vendor/mantle-framework/testing/concerns/trait-wordpress-state.php @@ -0,0 +1,182 @@ +<?php +/** + * This file contains the WordPress_State trait + * + * @package Mantle + */ + +namespace Mantle\Testing\Concerns; + +use Carbon\Carbon; +use DateTimeInterface; +use Mantle\Database\Model\Post; +use Mantle\Testing\Utils; +use WP_Post; + +/** + * This trait includes functionality for controlling WordPress state during + * testing. + */ +trait WordPress_State { + + /** + * Cleans the global scope (e.g `$_GET` and `$_POST`). + */ + public function clean_up_global_scope(): void { + $_GET = []; + $_POST = []; + self::flush_cache(); + } + + /** + * Flushes the WordPress object cache. + */ + public static function flush_cache(): void { + global $wp_object_cache; + $wp_object_cache->group_ops = []; + $wp_object_cache->stats = []; + $wp_object_cache->memcache_debug = []; + $wp_object_cache->cache = []; + if ( method_exists( $wp_object_cache, '__remoteset' ) ) { + $wp_object_cache->__remoteset(); + } + wp_cache_flush(); + wp_cache_add_global_groups( + [ + 'users', + 'userlogins', + 'usermeta', + 'user_meta', + 'useremail', + 'userslugs', + 'site-transient', + 'site-options', + 'blog-lookup', + 'blog-details', + 'rss', + 'global-posts', + 'blog-id-cache', + 'networks', + 'sites', + 'site-details', + 'blog_meta', + ] + ); + wp_cache_add_non_persistent_groups( [ 'comment', 'counts', 'plugins' ] ); + } + + /** + * Unregister existing post types and register defaults. + * + * Run before each test in order to clean up the global scope, in case + * a test forgets to unregister a post type on its own, or fails before + * it has a chance to do so. + */ + protected function reset_post_types() { + foreach ( get_post_types( [], 'objects' ) as $pt ) { + if ( empty( $pt->tests_no_auto_unregister ) ) { + unregister_post_type( $pt->name ); + } + } + create_initial_post_types(); + } + + /** + * Unregister existing taxonomies and register defaults. + * + * Run before each test in order to clean up the global scope, in case + * a test forgets to unregister a taxonomy on its own, or fails before + * it has a chance to do so. + */ + protected function reset_taxonomies() { + foreach ( get_taxonomies() as $tax ) { + unregister_taxonomy( $tax ); + } + create_initial_taxonomies(); + } + + /** + * Unregister non-built-in post statuses. + */ + protected function reset_post_statuses() { + foreach ( get_post_stati( [ '_builtin' => false ] ) as $post_status ) { + Utils::unregister_post_status( $post_status ); + } + } + + /** + * Clean up any registered meta keys. + * + * @since 5.1.0 + * + * @global array $wp_meta_keys + */ + public function unregister_all_meta_keys(): void { + global $wp_meta_keys; + if ( ! is_array( $wp_meta_keys ) ) { + return; + } + foreach ( $wp_meta_keys as $object_type => $type_keys ) { + foreach ( $type_keys as $object_subtype => $subtype_keys ) { + foreach ( $subtype_keys as $key => $value ) { + unregister_meta_key( $object_type, $key, $object_subtype ); + } + } + } + } + + /** + * Deletes a user from the database in a Multisite-agnostic way. + * + * @since 4.3.0 + * + * @param int $user_id User ID. + * @return bool True if the user was deleted. + */ + public static function delete_user( $user_id ) { + if ( is_multisite() ) { + return wpmu_delete_user( $user_id ); + } + + return wp_delete_user( $user_id ); + } + + /** + * Resets permalinks and flushes rewrites. + * + * @since 4.4.0 + * + * @global \WP_Rewrite $wp_rewrite + * + * @param string $structure Optional. Permalink structure to set. Default empty. + */ + public function set_permalink_structure( $structure = '' ): void { + global $wp_rewrite; + + $wp_rewrite->init(); + $wp_rewrite->set_permalink_structure( $structure ); + $wp_rewrite->flush_rules(); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions + } + + /** + * Updates the modified and modified GMT date of a post in the database. + * + * @param WP_Post|Post|int $post Post ID or post object. + * @param DateTimeInterface|string $date Date object or string to update the + * post with. If a string is passed it + * is assumed to be local timezone. + */ + protected function update_post_modified( WP_Post|Post|int $post, DateTimeInterface|string $date ): bool { + $post = match ( true ) { + $post instanceof WP_Post => Post::for( $post->post_type )->find( $post->ID ), + $post instanceof Post => $post, + default => Post::for( get_post_type( $post ) )->find( $post ), + }; + + return $post->save( + [ + 'post_modified' => $date instanceof DateTimeInterface ? $date->format( 'Y-m-d H:i:s' ) : $date, + ] + ); + } +} diff --git a/vendor/mantle-framework/testing/core-polyfill.php b/vendor/mantle-framework/testing/core-polyfill.php new file mode 100644 index 00000000..d9ae8fd4 --- /dev/null +++ b/vendor/mantle-framework/testing/core-polyfill.php @@ -0,0 +1,106 @@ +<?php +/** + * Functions from the core unit test library that help with testing. + * + * phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound, + * + * @package Mantle + */ + +if ( ! function_exists( 'rand_str' ) ) : + /** + * Provide a random string. + * + * @param int $len String length. + */ + function rand_str( $len = 32 ): string { + return substr( md5( uniqid( (string) wp_rand() ) ), 0, $len ); + } +endif; + +if ( ! function_exists( 'rand_long_str' ) ) : + /** + * Returns a string of the required length containing random characters. + * + * @param int $length The required length. + * @return string The string. + */ + function rand_long_str( $length ) { + $chars = 'abcdefghijklmnopqrstuvwxyz'; + $string = ''; + + for ( $i = 0; $i < $length; $i++ ) { + $rand = random_int( 0, strlen( $chars ) - 1 ); // phpcs:ignore WordPress.WP.AlternativeFunctions.rand_rand + $string .= substr( $chars, $rand, 1 ); + } + + return $string; + } +endif; + +if ( ! function_exists( 'strip_ws' ) ) : + /** + * Strips leading and trailing whitespace from each line in the string. + * + * @param string $txt The text. + * @return string Text with line-leading and line-trailing whitespace stripped. + */ + function strip_ws( $txt ) { + $lines = explode( "\n", $txt ); + $result = []; + foreach ( $lines as $line ) { + if ( trim( $line ) ) { + $result[] = trim( $line ); + } + } + + return trim( implode( "\n", $result ) ); + } +endif; + +if ( ! function_exists( 'ensure_trailingslash' ) ) : + /** + * Appends a trailing slash. + * + * @param string $string String to append a trailing slash to. + * @return string + */ + function ensure_trailingslash( $string ) { + return remove_trailingslash( $string ) . '/'; + } +endif; + +if ( ! function_exists( 'remove_trailingslash' ) ) : + /** + * Removes trailing forward slashes and backslashes if they exist. + * + * @param string $string What to remove the trailing slashes from. + * @return string String without the trailing slashes. + */ + function remove_trailingslash( $string ) { + return rtrim( $string, '/\\' ); + } +endif; + +if ( ! function_exists( 'tests_add_filter' ) ) : + /** + * Polyfill for providing a root namespace tests_add_filter() function for + * easier transition to the testing framework. + * + * @see \Mantle\Testing\tests_add_filter() + * @see add_filter() + * + * @param string $tag The name of the filter to hook the $function_to_add callback to. + * @param callable $function_to_add The callback to be run when the filter is applied. + * @param int $priority Optional. Used to specify the order in which the functions + * associated with a particular action are executed. + * Lower numbers correspond with earlier execution, + * and functions with the same priority are executed + * in the order in which they were added to the action. Default 10. + * @param int $accepted_args Optional. The number of arguments the function accepts. Default 1. + * @return true + */ + function tests_add_filter( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) { + return \Mantle\Testing\tests_add_filter( $tag, $function_to_add, $priority, $accepted_args ); + } +endif; diff --git a/vendor/mantle-framework/testing/data/images/2004-07-22-DSC_0007.jpg b/vendor/mantle-framework/testing/data/images/2004-07-22-DSC_0007.jpg new file mode 100644 index 00000000..a9703f33 Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/2004-07-22-DSC_0007.jpg differ diff --git a/vendor/mantle-framework/testing/data/images/2004-07-22-DSC_0008.jpg b/vendor/mantle-framework/testing/data/images/2004-07-22-DSC_0008.jpg new file mode 100644 index 00000000..faa12f31 Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/2004-07-22-DSC_0008.jpg differ diff --git a/vendor/mantle-framework/testing/data/images/2007-06-17DSC_4173.JPG b/vendor/mantle-framework/testing/data/images/2007-06-17DSC_4173.JPG new file mode 100644 index 00000000..2cbe3b90 Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/2007-06-17DSC_4173.JPG differ diff --git a/vendor/mantle-framework/testing/data/images/33772.jpg b/vendor/mantle-framework/testing/data/images/33772.jpg new file mode 100644 index 00000000..1f6002bf Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/33772.jpg differ diff --git a/vendor/mantle-framework/testing/data/images/a2-small.jpg b/vendor/mantle-framework/testing/data/images/a2-small.jpg new file mode 100644 index 00000000..d3d7bbc3 Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/a2-small.jpg differ diff --git a/vendor/mantle-framework/testing/data/images/canola.jpg b/vendor/mantle-framework/testing/data/images/canola.jpg new file mode 100644 index 00000000..938be00c Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/canola.jpg differ diff --git a/vendor/mantle-framework/testing/data/images/codeispoetry.png b/vendor/mantle-framework/testing/data/images/codeispoetry.png new file mode 100644 index 00000000..5dc5856d Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/codeispoetry.png differ diff --git a/vendor/mantle-framework/testing/data/images/gradient-square.jpg b/vendor/mantle-framework/testing/data/images/gradient-square.jpg new file mode 100644 index 00000000..9f2cb3fb Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/gradient-square.jpg differ diff --git a/vendor/mantle-framework/testing/data/images/one-blue-pixel-1-100x100.png b/vendor/mantle-framework/testing/data/images/one-blue-pixel-1-100x100.png new file mode 100644 index 00000000..1aff0e0c Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/one-blue-pixel-1-100x100.png differ diff --git a/vendor/mantle-framework/testing/data/images/one-blue-pixel-100x100.png b/vendor/mantle-framework/testing/data/images/one-blue-pixel-100x100.png new file mode 100644 index 00000000..1aff0e0c Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/one-blue-pixel-100x100.png differ diff --git a/vendor/mantle-framework/testing/data/images/test-image-cmyk.jpg b/vendor/mantle-framework/testing/data/images/test-image-cmyk.jpg new file mode 100644 index 00000000..9b3b1124 Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/test-image-cmyk.jpg differ diff --git a/vendor/mantle-framework/testing/data/images/test-image-grayscale.jpg b/vendor/mantle-framework/testing/data/images/test-image-grayscale.jpg new file mode 100644 index 00000000..7e890318 Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/test-image-grayscale.jpg differ diff --git a/vendor/mantle-framework/testing/data/images/test-image-iptc.jpg b/vendor/mantle-framework/testing/data/images/test-image-iptc.jpg new file mode 100644 index 00000000..a054dec2 Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/test-image-iptc.jpg differ diff --git a/vendor/mantle-framework/testing/data/images/test-image-large.jpg b/vendor/mantle-framework/testing/data/images/test-image-large.jpg new file mode 100644 index 00000000..1d0a1629 Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/test-image-large.jpg differ diff --git a/vendor/mantle-framework/testing/data/images/test-image-lzw.tiff b/vendor/mantle-framework/testing/data/images/test-image-lzw.tiff new file mode 100644 index 00000000..0fdfc079 Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/test-image-lzw.tiff differ diff --git a/vendor/mantle-framework/testing/data/images/test-image-mime-jpg.png b/vendor/mantle-framework/testing/data/images/test-image-mime-jpg.png new file mode 100644 index 00000000..534aac1d Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/test-image-mime-jpg.png differ diff --git a/vendor/mantle-framework/testing/data/images/test-image-no-extension b/vendor/mantle-framework/testing/data/images/test-image-no-extension new file mode 100644 index 00000000..8fad3644 Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/test-image-no-extension differ diff --git a/vendor/mantle-framework/testing/data/images/test-image-upside-down.jpg b/vendor/mantle-framework/testing/data/images/test-image-upside-down.jpg new file mode 100644 index 00000000..74505cfc Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/test-image-upside-down.jpg differ diff --git a/vendor/mantle-framework/testing/data/images/test-image-zip.tiff b/vendor/mantle-framework/testing/data/images/test-image-zip.tiff new file mode 100644 index 00000000..5ed59863 Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/test-image-zip.tiff differ diff --git a/vendor/mantle-framework/testing/data/images/test-image.bmp b/vendor/mantle-framework/testing/data/images/test-image.bmp new file mode 100644 index 00000000..97a54ce3 Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/test-image.bmp differ diff --git a/vendor/mantle-framework/testing/data/images/test-image.gif b/vendor/mantle-framework/testing/data/images/test-image.gif new file mode 100644 index 00000000..8fad3644 Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/test-image.gif differ diff --git a/vendor/mantle-framework/testing/data/images/test-image.ico b/vendor/mantle-framework/testing/data/images/test-image.ico new file mode 100644 index 00000000..2145492a Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/test-image.ico differ diff --git a/vendor/mantle-framework/testing/data/images/test-image.jp2 b/vendor/mantle-framework/testing/data/images/test-image.jp2 new file mode 100644 index 00000000..4d96c3c4 Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/test-image.jp2 differ diff --git a/vendor/mantle-framework/testing/data/images/test-image.jpg b/vendor/mantle-framework/testing/data/images/test-image.jpg new file mode 100644 index 00000000..534aac1d Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/test-image.jpg differ diff --git a/vendor/mantle-framework/testing/data/images/test-image.pct b/vendor/mantle-framework/testing/data/images/test-image.pct new file mode 100644 index 00000000..74666047 Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/test-image.pct differ diff --git a/vendor/mantle-framework/testing/data/images/test-image.png b/vendor/mantle-framework/testing/data/images/test-image.png new file mode 100644 index 00000000..642ce929 Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/test-image.png differ diff --git a/vendor/mantle-framework/testing/data/images/test-image.psd b/vendor/mantle-framework/testing/data/images/test-image.psd new file mode 100644 index 00000000..3389eb49 Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/test-image.psd differ diff --git a/vendor/mantle-framework/testing/data/images/test-image.sgi b/vendor/mantle-framework/testing/data/images/test-image.sgi new file mode 100644 index 00000000..e5674c0d Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/test-image.sgi differ diff --git a/vendor/mantle-framework/testing/data/images/test-image.tga b/vendor/mantle-framework/testing/data/images/test-image.tga new file mode 100644 index 00000000..b0593cbf Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/test-image.tga differ diff --git a/vendor/mantle-framework/testing/data/images/test-image.tiff b/vendor/mantle-framework/testing/data/images/test-image.tiff new file mode 100644 index 00000000..67c30947 Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/test-image.tiff differ diff --git a/vendor/mantle-framework/testing/data/images/transparent.png b/vendor/mantle-framework/testing/data/images/transparent.png new file mode 100644 index 00000000..d130501e Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/transparent.png differ diff --git a/vendor/mantle-framework/testing/data/images/waffles.jpg b/vendor/mantle-framework/testing/data/images/waffles.jpg new file mode 100644 index 00000000..e69cae58 Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/waffles.jpg differ diff --git a/vendor/mantle-framework/testing/data/images/wordpress-gsoc-flyer.pdf b/vendor/mantle-framework/testing/data/images/wordpress-gsoc-flyer.pdf new file mode 100644 index 00000000..d7e17995 Binary files /dev/null and b/vendor/mantle-framework/testing/data/images/wordpress-gsoc-flyer.pdf differ diff --git a/vendor/mantle-framework/testing/doubles/class-spy-rest-server.php b/vendor/mantle-framework/testing/doubles/class-spy-rest-server.php new file mode 100644 index 00000000..ee16aef6 --- /dev/null +++ b/vendor/mantle-framework/testing/doubles/class-spy-rest-server.php @@ -0,0 +1,126 @@ +<?php // phpcs:disable + +namespace Mantle\Testing\Doubles; + +use WP_REST_Request; +use WP_REST_Server; + +/** + * Spy REST Server + * + * A spy class for WP_REST_Server that allows us to inspect the headers and body + * of the response without sending it to the client. + */ +class Spy_REST_Server extends WP_REST_Server { + + /** + * @var array<string, string> + */ + public ?array $sent_headers = []; + + public ?int $sent_status = null; + + public ?string $sent_body = null; + + public ?WP_REST_Request $last_request = null; + + public bool $override_by_default = false; + + /** + * Gets the raw endpoints data from the server. + * + * @return array + */ + public function get_raw_endpoint_data() { + return $this->endpoints; + } + + /** + * Allow calling protected methods from tests. + * + * @param string $method Method to call. + * @param array $args Arguments to pass to the method. + * @return mixed + */ + public function __call( $method, $args ) { + return call_user_func_array( [ $this, $method ], $args ); + } + + /** + * Sends an HTTP status code. + * + * @param int $code HTTP status. + */ + protected function set_status( $code ) { + $this->sent_status = $code; + } + + /** + * Adds a header to the list of sent headers. + * + * @param string $header Header name. + * @param string $value Header value. + */ + public function send_header( $header, $value ): void { + $this->sent_headers[ $header ] = $value; + } + + /** + * Removes a header from the list of sent headers. + * + * @param string $header Header name. + */ + public function remove_header( $header ): void { + unset( $this->sent_headers[ $header ] ); + } + + /** + * Overrides the dispatch method so we can get a handle on the request object. + * + * @param \WP_REST_Request $request Request to attempt dispatching. + * @return \WP_REST_Response Response returned by the callback. + */ + public function dispatch( $request ) { + $this->last_request = $request; + + return parent::dispatch( $request ); + } + + /** + * Overrides the register_route method so we can re-register routes internally if needed. + * + * @param string $namespace Namespace. + * @param string $route The REST route. + * @param array $route_args Route arguments. + * @param bool $override Optional. Whether the route should be overridden if it already exists. + * Default false. Also set `$GLOBALS['wp_rest_server']->override_by_default = true` + * to set overrides when you don't have access to the caller context. + */ + public function register_route( $namespace, $route, $route_args, $override = false ): void { + parent::register_route( $namespace, $route, $route_args, $override || $this->override_by_default ); + } + + /** + * Serves the request and returns the result. + * + * @param string $path Optional. The request route. If not set, `$_SERVER['PATH_INFO']` will be used. + * Default null. + * @return null|false Null if not served and a HEAD request, false otherwise. + */ + public function serve_request( $path = null ) { + ob_start(); + $result = parent::serve_request( $path ); + $this->sent_body = ob_get_clean(); + return $result; + } + + /** + * Clear the stored response data for the spy. + */ + public function reset_spy(): void { + $this->sent_headers = null; + $this->sent_status = null; + $this->sent_body = null; + $this->last_request = null; + } +} diff --git a/vendor/mantle-framework/testing/exceptions/class-exception.php b/vendor/mantle-framework/testing/exceptions/class-exception.php new file mode 100644 index 00000000..073e590b --- /dev/null +++ b/vendor/mantle-framework/testing/exceptions/class-exception.php @@ -0,0 +1,15 @@ +<?php +/** + * This file contains the WP_Die_Exception class + * + * @package Mantle + */ + +namespace Mantle\Testing\Exceptions; + +use \Exception as Base_Exception; + +/** + * General exception for wp_die(). + */ +class Exception extends Base_Exception {} diff --git a/vendor/mantle-framework/testing/exceptions/class-wp-die-exception.php b/vendor/mantle-framework/testing/exceptions/class-wp-die-exception.php new file mode 100644 index 00000000..84c3a01f --- /dev/null +++ b/vendor/mantle-framework/testing/exceptions/class-wp-die-exception.php @@ -0,0 +1,13 @@ +<?php +/** + * This file contains the WP_Die_Exception class + * + * @package Mantle + */ + +namespace Mantle\Testing\Exceptions; + +/** + * General exception for wp_die(). + */ +class WP_Die_Exception extends Exception {} diff --git a/vendor/mantle-framework/testing/exceptions/class-wp-redirect-exception.php b/vendor/mantle-framework/testing/exceptions/class-wp-redirect-exception.php new file mode 100644 index 00000000..764f5099 --- /dev/null +++ b/vendor/mantle-framework/testing/exceptions/class-wp-redirect-exception.php @@ -0,0 +1,13 @@ +<?php +/** + * This file contains the WP_Redirect_Exception class + * + * @package Mantle + */ + +namespace Mantle\Testing\Exceptions; + +/** + * Exception thrown when a redirect is encountered. + */ +class WP_Redirect_Exception extends Exception {} diff --git a/vendor/mantle-framework/testing/expectation/class-expectation-container.php b/vendor/mantle-framework/testing/expectation/class-expectation-container.php new file mode 100644 index 00000000..e2246089 --- /dev/null +++ b/vendor/mantle-framework/testing/expectation/class-expectation-container.php @@ -0,0 +1,76 @@ +<?php +/** + * Expectation_Container class file. + * + * @package Mantle + */ + +namespace Mantle\Testing\Expectation; + +use Mantle\Support\Collection; + +/** + * Container for the expectation checking. + */ +class Expectation_Container { + /** + * Name for adding an action. + * + * @var string + */ + public const ACTION_ADDED = 'added'; + + /** + * Name for applying an action. + * + * @var string + */ + public const ACTION_APPLIED = 'applied'; + + /** + * Expectations + * + * @var Collection<Expectation> + */ + protected Collection $expectations; + + /** + * Constructor. + */ + public function __construct() { + $this->expectations = new Collection(); + } + + /** + * Create an expectation for checking if a hook was fired. + * + * @param string $hook Hook to check. + * @param array ...$args Arguments for the hook, optional. + */ + public function add_applied( string $hook, ...$args ): Expectation { + $expectation = new Expectation( static::ACTION_APPLIED, $hook, $args ); + $this->expectations->push( $expectation ); + return $expectation; + } + + /** + * Create an expectation for checking if a hook was added. + * + * @param string $hook Hook to check. + * @param callable $callback Callback for the hook, optional. + */ + public function add_added( string $hook, callable $callback = null ): Expectation { + $expectation = new Expectation( static::ACTION_ADDED, $hook, $callback ); + $this->expectations->push( $expectation ); + return $expectation; + } + + /** + * Validate the expectations in the container. + */ + public function tear_down(): void { + $this->expectations->each( + fn ( Expectation $expectation ) => $expectation->validate(), + ); + } +} diff --git a/vendor/mantle-framework/testing/expectation/class-expectation.php b/vendor/mantle-framework/testing/expectation/class-expectation.php new file mode 100644 index 00000000..47f9fb13 --- /dev/null +++ b/vendor/mantle-framework/testing/expectation/class-expectation.php @@ -0,0 +1,352 @@ +<?php +/** + * Expectation class file. + * + * phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid + * + * @package Mantle + */ + +namespace Mantle\Testing\Expectation; + +use PHPUnit\Framework\Assert as PHPUnit; +use SebastianBergmann\Exporter\Exporter; + +/** + * Expectation for an action to be added/applied. + */ +class Expectation { + /** + * Action to expect. + * + * @var string + */ + protected $action; + + /** + * Hook to compare. + * + * @var string + */ + protected $hook; + + /** + * Arguments for the hook. + * + * @var mixed + */ + protected $args; + + /** + * Number of times for the hook to execute. + * + * @var int|null + */ + protected $times; + + /** + * Return value comparison callback. + * + * @var callable|null + */ + protected $return_value_callback; + + /** + * Record of the start value of the hook + * + * @var array + */ + protected $record_start = []; + + /** + * Record of the return value for a hook. + * + * @var array + */ + protected $record_stop = []; + + /** + * Constructor. + * + * @param string $action Action to expect. + * @param string $hook Hook to listen to. + * @param mixed $args Arguments for the hook. + */ + public function __construct( string $action, string $hook, $args = null ) { + $this->action = $action; + $this->hook = $hook; + + if ( ! empty( $args ) ) { + $this->args = $args; + } + + if ( Expectation_Container::ACTION_APPLIED === $action ) { + $this->setup_applied_hooks(); + } + } + + /** + * Setup listeners for the applied action. + */ + protected function setup_applied_hooks() { + add_action( // @phpstan-ignore-line Action callback + $this->hook, + [ $this, 'record_start' ], + -1, + 99 + ); + + add_action( // @phpstan-ignore-line Action callback + $this->hook, + [ $this, 'record_stop' ], + PHP_INT_MAX, + 99 + ); + } + + /** + * Record the start of a hook being applied. + * + * @param array ...$args Hook arguments. + * @return mixed + */ + public function record_start( ...$args ) { + $this->record_start[] = $args; + return array_shift( $args ); + } + + /** + * Record the stop of a hook being applied. + * + * @param array ...$args Hook arguments. + * @return mixed + */ + public function record_stop( ...$args ) { + $this->record_stop[] = $args; + return array_shift( $args ); + } + + /** + * Validate if an expectation meets its expectations. + */ + public function validate(): void { + $exporter = new Exporter(); + + if ( Expectation_Container::ACTION_APPLIED === $this->action ) { + if ( null !== $this->times ) { + $count = count( $this->record_start ); + + PHPUnit::assertEquals( + $this->times, + $count, + "Expected that hook [{$this->hook}] ({$count}) would be applied [{$this->times}] times." + ); + } else { + PHPUnit::assertTrue( + ! empty( $this->record_start ), + "Expected that hook [{$this->hook}] would be applied at least once." + ); + } + + // Compare the arguments for the hook. + if ( null !== $this->args ) { + foreach ( $this->record_start as $record ) { + PHPUnit::assertSame( + $this->args, + $record, + sprintf( + 'Failed asserting that hook [%s] argument passed %s is identical to %s.', + $this->hook, + $exporter->export( $record ), + $exporter->export( $this->args ) + ), + ); + } + } + + // Compare the return value of the hook. + if ( isset( $this->return_value_callback ) ) { + foreach ( $this->record_stop as $record ) { + PHPUnit::assertTrue( + call_user_func_array( $this->return_value_callback, $record ), + sprintf( + 'Failed asserting that hook\'s [%s] return value %s matches the expected return value.', + $this->hook, + $exporter->export( $record ), + ) + ); + } + } + + // Remove the actions for the hook. + remove_action( $this->hook, [ $this, 'record_start' ], -1 ); + remove_action( $this->hook, [ $this, 'record_stop' ], PHP_INT_MAX ); + } + + // Asset if the action was added. + if ( Expectation_Container::ACTION_ADDED === $this->action ) { + PHPUnit::assertTrue( + ! ! has_action( $this->hook, $this->args ?? false ), + "Expected that hook [{$this->hook}] would have action added." + ); + } + } + + /** + * Assert that the action was never applied. + * + * @return static + */ + public function never() { + $this->times = 0; + return $this; + } + + /** + * Assert that the action was applied once. + * + * @return static + */ + public function once() { + $this->times = 1; + return $this; + } + + /** + * Assert that the action was applied twice. + * + * @return static + */ + public function twice() { + $this->times = 2; + return $this; + } + + /** + * Assert that the action was applied a specific number of times. + * + * @param int $times Number of times. + */ + public function times( int $times ): static { + $this->times = $times; + return $this; + } + + /** + * Specify the arguments for the expectation. + * + * @param mixed ...$args Arguments. + */ + public function with( ...$args ): static { + $this->args = $args; + return $this; + } + + /** + * Remove checking the arguments for the action. + */ + public function withAnyArgs(): static { + $this->args = null; + return $this; + } + + /** + * Specify that the filter returns a specific value. + * + * @param mixed $value Return value. + */ + public function andReturn( mixed $value ): static { + return $this->returnComparison( + fn ( $return_value ) => $return_value === $value + ); + } + + /** + * Specify that the filter returns null. + */ + public function andReturnNull(): static { + return $this->andReturn( null ); + } + + /** + * Specify that the filter returns false. + */ + public function andReturnFalse(): static { + return $this->andReturn( false ); + } + + /** + * Specify that the filter returns true. + */ + public function andReturnTrue(): static { + return $this->andReturn( true ); + } + + /** + * Specify that the filter returns a truthy value. + */ + public function andReturnTruthy(): static { + return $this->returnComparison( fn ( $value ) => ! ! $value ); + } + + /** + * Specify that the filter returns a falsy value. + */ + public function andReturnFalsy(): static { + return $this->returnComparison( fn ( $value ) => ! $value ); + } + + /** + * Specify that the filter returns an empty value. + */ + public function andReturnEmpty(): static { + return $this->returnComparison( fn ( $value ) => empty( $value ) ); + } + + /** + * Specify that the filter returns a non-empty value. + */ + public function andReturnNotEmpty(): static { + return $this->returnComparison( fn ( $value ) => ! empty( $value ) ); + } + + /** + * Specify that the filter returns an array value. + */ + public function andReturnArray(): static { + return $this->returnComparison( fn ( $value ) => is_array( $value ) ); + } + + /** + * Specify that the filter returns an instance of a class. + * + * @param string $class Class name. + */ + public function andReturnInstanceOf( string $class ): static { + return $this->returnComparison( fn ( $value ) => $value instanceof $class ); + } + + /** + * Specify that the filter returns a string value. + */ + public function andReturnString(): static { + return $this->returnComparison( fn ( $value ) => is_string( $value ) ); + } + + /** + * Specify that the filter returns an integer value. + */ + public function andReturnInteger(): static { + return $this->returnComparison( fn ( $value ) => is_int( $value ) ); + } + + /** + * Specify the return comparison callback for the filter. + * + * @param callable $callback Callback. + */ + protected function returnComparison( callable $callback ): static { + $this->return_value_callback = $callback; + return $this; + } +} diff --git a/vendor/mantle-framework/testing/install-wordpress.php b/vendor/mantle-framework/testing/install-wordpress.php new file mode 100644 index 00000000..115d1ab5 --- /dev/null +++ b/vendor/mantle-framework/testing/install-wordpress.php @@ -0,0 +1,86 @@ +<?php // phpcs:disable +/** + * Installs WordPress for the purpose of the unit-tests + * + * @todo Reuse the init/load code in init.php + */ + +use Mantle\Testing\Utils; + +error_reporting( E_ALL & ~E_DEPRECATED & ~E_STRICT ); + +define( 'WP_INSTALLING', true ); + +$PHP_SELF = '/index.php'; +$GLOBALS['PHP_SELF'] = '/index.php'; +$_SERVER['PHP_SELF'] = '/index.php'; + +global $wp_rewrite; + +require_once __DIR__ . '/preload.php'; +require_once __DIR__ . '/wordpress-bootstrap.php'; +require_once ABSPATH . '/wp-admin/includes/upgrade.php'; + +if ( file_exists( ABSPATH . '/wp-includes/class-wpdb.php' ) ) { + require_once ABSPATH . '/wp-includes/class-wpdb.php'; +} else { + // Back-compat for WordPress < 6.1.0. + require_once ABSPATH . '/wp-includes/wp-db.php'; +} + +$multisite = ! empty( $argv[1] ); + +$wpdb->query( 'SET default_storage_engine = InnoDB' ); +$wpdb->select( DB_NAME, $wpdb->dbh ); + +echo 'Installing WordPress...' . PHP_EOL; + +$wpdb->query( 'SET foreign_key_checks = 0' ); +foreach ( $wpdb->tables() as $table => $prefixed_table ) { + //phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared + $wpdb->query( "DROP TABLE IF EXISTS $prefixed_table" ); +} + +foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table ) { + //phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared + $wpdb->query( "DROP TABLE IF EXISTS $prefixed_table" ); + + // We need to create references to ms global tables. + if ( $multisite ) { + $wpdb->$table = $prefixed_table; + } +} +$wpdb->query( 'SET foreign_key_checks = 1' ); + +// Prefill a permalink structure so that WP doesn't try to determine one itself. +add_action( 'populate_options', [ Utils::class, 'set_default_permalink_structure_for_tests' ] ); + +wp_install( WP_TESTS_TITLE, 'admin', WP_TESTS_EMAIL, true, null, 'password' ); + +// Delete dummy permalink structure, as prefilled above. +if ( ! is_multisite() ) { + delete_option( 'permalink_structure' ); +} +remove_action( 'populate_options', [ Utils::class, 'set_default_permalink_structure_for_tests' ] ); + +if ( $multisite ) { + echo '... Installing network...' . PHP_EOL; + + define( 'WP_INSTALLING_NETWORK', true ); + + $title = WP_TESTS_TITLE . ' Network'; + $subdomain_install = false; + + install_network(); + + $populate = populate_network( 1, WP_TESTS_DOMAIN, WP_TESTS_EMAIL, $title, '/', $subdomain_install ); + + if ( is_wp_error( $populate ) ) { + echo 'Error populating network: ' . $populate->get_error_message() . PHP_EOL; + exit( 1 ); + } + + $wp_rewrite->set_permalink_structure( '' ); +} + +echo "... Done!\n"; diff --git a/vendor/mantle-framework/testing/mail/class-mail-message.php b/vendor/mantle-framework/testing/mail/class-mail-message.php new file mode 100644 index 00000000..76150971 --- /dev/null +++ b/vendor/mantle-framework/testing/mail/class-mail-message.php @@ -0,0 +1,43 @@ +<?php +/** + * Mail_Message class file + * + * @package Mantle + */ + +namespace Mantle\Testing\Mail; + +use function Mantle\Support\Helpers\collect; + +/** + * Mail Message Record + */ +class Mail_Message { + /** + * Constructor. + * + * @param array $to The recipient of the email. + * @param array $cc The CC recipient of the email. + * @param array $bcc The BCC recipient of the email. + * @param string $subject The subject of the email. + * @param string $body The body of the email. + * @param string $header The header of the email. + */ + public function __construct( + public readonly array $to, + public readonly array $cc, + public readonly array $bcc, + public readonly string $subject, + public readonly string $body, + public readonly string $header + ) {} + + /** + * Check if the email was sent to the given recipient. + * + * @param string $address The email address to check for. + */ + public function sent_to( string $address ): bool { + return collect( $this->to )->pluck( 0 )->contains( $address ); + } +} diff --git a/vendor/mantle-framework/testing/mail/class-mock-mailer.php b/vendor/mantle-framework/testing/mail/class-mock-mailer.php new file mode 100644 index 00000000..e6b308d1 --- /dev/null +++ b/vendor/mantle-framework/testing/mail/class-mock-mailer.php @@ -0,0 +1,90 @@ +<?php +/** + * Mock_Mailer class file + * + * phpcs:disable WordPress.NamingConventions.ValidVariableName + * + * @package Mantle + */ + +namespace Mantle\Testing\Mail; + +if ( ! file_exists( ABSPATH . '/wp-includes/PHPMailer/PHPMailer.php' ) ) { + // todo: add link to documentation when it is available. + echo 'Core PHPMailer file not found. Is WordPress installed properly at ' . ABSPATH . "?\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + return; +} + +require_once ABSPATH . '/wp-includes/PHPMailer/PHPMailer.php'; + +/** + * Mock PHPMailer class. + * + * @package Mantle + */ +class Mock_Mailer extends \PHPMailer\PHPMailer\PHPMailer { + /** @var Mail_Message[] */ + public array $mock_sent = []; + + /** + * Override preSend() method. + */ + public function preSend() { + $this->Encoding = '8bit'; + + return parent::preSend(); + } + + /** + * Override postSend() so mail isn't actually sent. + */ + public function postSend() { + $this->mock_sent[] = new Mail_Message( + to: $this->to, + cc: $this->cc, + bcc: $this->bcc, + subject: $this->Subject, + body: $this->Body, + header: $this->MIMEHeader . $this->mailHeader + ); + + return true; + } + + /** + * Decorator to return the information for a sent mock. + * + * @param int $index Optional. Array index of mock_sent value. + * @return object|false + */ + public function get_sent( $index = 0 ) { + return $this->mock_sent[ $index ] ?? false; + } + + /** + * Get a recipient for a sent mock. + * + * @param string $address_type The type of address for the email such as to, cc or bcc. + * @param int $mock_sent_index Optional. The sent_mock index we want to get the recipient for. + * @param int $recipient_index Optional. The recipient index in the array. + * @return bool|object Returns object on success, or false if any of the indices don't exist. + */ + public function get_recipient( string $address_type, int $mock_sent_index = 0, $recipient_index = 0 ) { + $retval = false; + $mock = $this->get_sent( $mock_sent_index ); + + if ( $mock ) { + if ( isset( $mock->{$address_type}[ $recipient_index ] ) ) { + $address_index = $mock->{$address_type}[ $recipient_index ]; + $recipient_data = [ + 'address' => ( isset( $address_index[0] ) && ! empty( $address_index[0] ) ) ? $address_index[0] : 'No address set', + 'name' => ( isset( $address_index[1] ) && ! empty( $address_index[1] ) ) ? $address_index[1] : 'No name set', + ]; + + $retval = (object) $recipient_data; + } + } + + return $retval; + } +} diff --git a/vendor/mantle-framework/testing/mail/helpers.php b/vendor/mantle-framework/testing/mail/helpers.php new file mode 100644 index 00000000..c02978c9 --- /dev/null +++ b/vendor/mantle-framework/testing/mail/helpers.php @@ -0,0 +1,27 @@ +<?php +/** + * Mail helper methods. + * + * Intentionally not namespaced to mirror core. + * + * phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound + * phpcs:disable WordPress.WP.GlobalVariablesOverride.Prohibited + * + * @package Mantle + */ + +use Mantle\Testing\Mail\Mock_Mailer; + +/** + * Helper method to return the global phpmailer instance defined in the bootstrap + */ +function tests_retrieve_phpmailer_instance(): \PHPMailer\PHPMailer\PHPMailer|bool { + return $GLOBALS['phpmailer'] ?? false; +} + +/** + * Helper method to reset the phpmailer instance. + */ +function reset_phpmailer_instance(): void { + $GLOBALS['phpmailer'] = new Mock_Mailer( true ); +} diff --git a/vendor/mantle-framework/testing/preload.php b/vendor/mantle-framework/testing/preload.php new file mode 100644 index 00000000..45973e41 --- /dev/null +++ b/vendor/mantle-framework/testing/preload.php @@ -0,0 +1,72 @@ +<?php +/** + * Unit tests preload + * + * @package Mantle + */ + +namespace Mantle\Testing; + +/** + * Adds hooks before loading WP. + * + * @see add_filter() + * + * @param string $tag The name of the filter to hook the $function_to_add callback to. + * @param callable $function_to_add The callback to be run when the filter is applied. + * @param int $priority Optional. Used to specify the order in which the functions + * associated with a particular action are executed. + * Lower numbers correspond with earlier execution, + * and functions with the same priority are executed + * in the order in which they were added to the action. Default 10. + * @param int $accepted_args Optional. The number of arguments the function accepts. Default 1. + * @return true + */ +function tests_add_filter( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ): bool { + global $wp_filter; + + if ( function_exists( 'add_filter' ) ) { + add_filter( $tag, $function_to_add, $priority, $accepted_args ); + } else { + $idx = _test_filter_build_unique_id( $tag, $function_to_add, $priority ); + + // phpcs:ignore WordPress.WP.GlobalVariablesOverride + $wp_filter[ $tag ][ $priority ][ $idx ] = [ + 'function' => $function_to_add, + 'accepted_args' => $accepted_args, + ]; + } + return true; +} + +/** + * Generates a unique function ID based on the given arguments. + * + * @see _wp_filter_build_unique_id() + * + * @param string $tag Unused. The name of the filter to build ID for. + * @param callable $function The function to generate ID for. + * @param int $priority Unused. The order in which the functions + * associated with a particular action are executed. + * @return string Unique function ID for usage as array key. + */ +function _test_filter_build_unique_id( $tag, $function, $priority ) { + if ( is_string( $function ) ) { + return $function; + } + + if ( is_object( $function ) ) { + // Closures are currently implemented as objects. + $function = [ $function, '' ]; + } else { + $function = (array) $function; + } + + if ( is_object( $function[0] ) ) { + // Object class calling. + return spl_object_hash( $function[0] ) . $function[1]; + } elseif ( is_string( $function[0] ) ) { + // Static calling. + return $function[0] . '::' . $function[1]; + } +} diff --git a/vendor/mantle-framework/testing/snapshots/class-html-driver.php b/vendor/mantle-framework/testing/snapshots/class-html-driver.php new file mode 100644 index 00000000..fce17f2a --- /dev/null +++ b/vendor/mantle-framework/testing/snapshots/class-html-driver.php @@ -0,0 +1,51 @@ +<?php +/** + * HTML_Driver class file + * + * @package Mantle + */ + +namespace Mantle\Testing\Snapshots; + +use DOMDocument; +use Spatie\Snapshots\Drivers\HtmlDriver; +use Spatie\Snapshots\Exceptions\CantBeSerialized; + +/** + * HTML Driver for Snapshot Testing + * + * Extends the base HtmlDriver with additional flags to ignore HTML errors. + */ +class HTML_Driver extends HtmlDriver { + /** + * Serialize data to html + * + * @param mixed $data Data to serialize. + * @throws CantBeSerialized If data cannot be serialized. + */ + public function serialize( mixed $data ): string { + if ( ! is_string( $data ) ) { + throw new CantBeSerialized( 'Only strings can be serialized to html' ); + } + + if ( '' === $data ) { + return "\n"; + } + + $document = new DOMDocument( '1.0' ); + + $document->preserveWhiteSpace = false; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase + $document->formatOutput = true; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase + + @$document->loadHTML( $data, LIBXML_HTML_NODEFDTD | LIBXML_HTML_NOIMPLIED ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged + + $value = $document->saveHTML(); + + // Normalize line endings for cross-platform tests. + if ( PHP_OS_FAMILY === 'Windows' ) { + return implode( "\n", explode( "\r\n", $value ) ); + } + + return $value; + } +} diff --git a/vendor/mantle-framework/testing/wordpress-bootstrap.php b/vendor/mantle-framework/testing/wordpress-bootstrap.php new file mode 100644 index 00000000..8111a546 --- /dev/null +++ b/vendor/mantle-framework/testing/wordpress-bootstrap.php @@ -0,0 +1,226 @@ +<?php // phpcs:disable +/** + * This file installs and loads WordPress for running tests + * + * @package Mantle + */ + +use Mantle\Testing\Utils; +use Mantle\Testing\WP_Die; + +use function Mantle\Testing\tests_add_filter; + +defined( 'MANTLE_IS_TESTING' ) || define( 'MANTLE_IS_TESTING', true ); + +require_once __DIR__ . '/class-utils.php'; +require_once __DIR__ . '/class-wp-die.php'; + +// Ensure that Composer is loaded properly in the sub-process. +Utils::ensure_composer_loaded(); + +/* + * Globalize some WordPress variables, because PHPUnit loads this file inside a function. + * See: https://github.com/sebastianbergmann/phpunit/issues/325 + */ +global $wpdb, + $current_site, + $current_blog, + $wp_rewrite, + $shortcode_tags, + $wp, + $table_prefix, + $wp_theme_directories, + $PHP_SELF; + +// Load the configuration. +if ( defined( 'WP_TESTS_CONFIG_FILE_PATH' ) && ! empty( WP_TESTS_CONFIG_FILE_PATH ) && is_readable( WP_TESTS_CONFIG_FILE_PATH ) ) { + $config_file_path = WP_TESTS_CONFIG_FILE_PATH; +} elseif ( false === strpos( __DIR__, '/wp-content/' ) ) { + // Check if WP_CORE_DIR is defined and points to a valid installation. + if ( getenv( 'WP_CORE_DIR' ) && ! defined( 'WP_TESTS_INSTALL_PATH' ) && is_readable( getenv( 'WP_CORE_DIR' ) . '/wp-load.php' ) ) { + define( 'WP_TESTS_INSTALL_PATH', getenv( 'WP_CORE_DIR' ) ); + + Utils::info( 'Using the WP_CORE_DIR environment variable: ' . WP_TESTS_INSTALL_PATH ); + + $config_file_path = WP_TESTS_INSTALL_PATH . '/wp-tests-config.php'; + } else { + /** + * Install WordPress automatically in the /tmp/wordpress folder. + * + * Retrieves the latest installation command from Mantle's GitHub and runs + * it to install WordPress to a temporary folder (WP_CORE_DIR if set falling + * back to /tmp/wordpress). This unlocks the ability to run `composer run + * phpunit` both locally and in CI tests. + */ + + defined( 'WP_TESTS_INSTALL_PATH' ) || define( 'WP_TESTS_INSTALL_PATH', getenv( 'WP_CORE_DIR' ) ?: '/tmp/wordpress' ); + + $config_file_path = WP_TESTS_INSTALL_PATH . '/wp-tests-config.php'; + + // Install WordPress if we're not in the sub-process that installs WordPress. + if ( ! defined( 'WP_INSTALLING' ) || ! WP_INSTALLING ) { + Utils::info( + 'WordPress installation not found, installing in temporary directory: <em>' . WP_TESTS_INSTALL_PATH . '</em>' + ); + + // Download the latest installation command from GitHub and install WordPress. + Utils::install_wordpress( WP_TESTS_INSTALL_PATH ); + } + } +} else { + // The project is being loaded from inside a WordPress installation. + if ( defined( 'WP_TESTS_INSTALL_PATH' ) ) { + $config_file_path = preg_replace( '#/wp-content/.*$#', '/wp-tests-config.php', (string) WP_TESTS_INSTALL_PATH ); + } + + if ( empty( $config_file_path ) ) { + $config_file_path = preg_replace( '#/wp-content/.*$#', '/wp-tests-config.php', __DIR__ ); + } +} + +if ( is_readable( $config_file_path ) ) { + Utils::info( "Using configuration file: <em>{$config_file_path}</em>" ); + + require_once $config_file_path; +} elseif ( ! defined( 'WP_INSTALLING' ) || ! WP_INSTALLING ) { + Utils::info( 'No wp-tests-config.php file found, using default configuration.' ); +} + +Utils::setup_configuration(); + +// Attempt to load the vip-config.php file if it exists to play nicely with VIP Go. +if ( Utils::env_bool( 'MANTLE_LOAD_VIP_CONFIG', true ) ) { + if ( file_exists( ABSPATH . '/wp-content/vip-config/vip-config.php' ) ) { + require_once( ABSPATH . '/wp-content/vip-config/vip-config.php' ); + } elseif ( file_exists( ABSPATH . '/vip-config/vip-config.php' ) ) { + require_once( ABSPATH . '/vip-config/vip-config.php' ); + } +} + +Utils::reset_server(); + +define( 'WP_TESTS_TABLE_PREFIX', $table_prefix ); +define( 'DIR_TESTDATA', __DIR__ . '/data' ); + +// Set the core test constant. +if ( ! defined( 'WP_RUN_CORE_TESTS' ) ) { + define( 'WP_RUN_CORE_TESTS', true ); +} + +/* + * Cron tries to make an HTTP request to the site, which always fails, + * because tests are run in CLI mode only. + */ +define( 'DISABLE_WP_CRON', true ); + +define( 'WP_MEMORY_LIMIT', -1 ); +define( 'WP_MAX_MEMORY_LIMIT', -1 ); + +// Disable VIP GO cache purging during testing. +if ( ! defined( 'VIP_GO_DISABLE_CACHE_PURGING' ) ) { + define( 'VIP_GO_DISABLE_CACHE_PURGING', true ); +} + +$PHP_SELF = '/index.php'; +$GLOBALS['PHP_SELF'] = '/index.php'; +$_SERVER['PHP_SELF'] = '/index.php'; + +// Should we run in multisite mode? +$multisite = ( '1' === getenv( 'WP_MULTISITE' ) ); +$multisite = $multisite || ( defined( 'WP_TESTS_MULTISITE' ) && WP_TESTS_MULTISITE ); +$multisite = $multisite || ( defined( 'MULTISITE' ) && MULTISITE ); + +// Replace the global phpmailer instance with a mock instance. +reset_phpmailer_instance(); + +// Include a WP_UnitTestCase class to allow for easier transition to the testing +// framework. +if ( ! Utils::env( 'DISABLE_WP_UNIT_TEST_CASE_SHIM', false ) ) { + require_once __DIR__ . '/class-wp-unittestcase.php'; +} + +if ( ! defined( 'WP_DEFAULT_THEME' ) ) { + define( 'WP_DEFAULT_THEME', Utils::env( 'WP_DEFAULT_THEME', 'default' ) ); +} + +$wp_theme_directories = []; +$installing_wp = defined( 'WP_INSTALLING' ) && WP_INSTALLING; + +if ( ! $installing_wp && '1' !== getenv( 'WP_TESTS_SKIP_INSTALL' ) ) { + $resp = Utils::command( + [ + WP_PHP_BINARY, + escapeshellarg( __DIR__ . '/install-wordpress.php' ), + $multisite, + ], + $retval, + ); + + // Verify the return code and that 'Done!' is included in the output. + if ( 0 !== $retval || empty( $resp ) || false === strpos( implode( ' ', $resp ), 'Done!' ) ) { + Utils::error( + '🚨 Error installing WordPress! Response from installation script:' + ); + + Utils::code( $resp ); + + exit( $retval ); + } elseif ( Utils::is_debug_mode() ) { + Utils::info( 'WordPress installation complete.' ); + } +} + +// Ensure that the shutdown function is registered when installing WordPress. +if ( $installing_wp ) { + Utils::register_shutdown_function(); +} + +if ( $multisite && ! $installing_wp ) { + Utils::info( 'Running as multisite...' ); + defined( 'MULTISITE' ) or define( 'MULTISITE', true ); + defined( 'SUBDOMAIN_INSTALL' ) or define( 'SUBDOMAIN_INSTALL', false ); + $GLOBALS['base'] = '/'; +} elseif ( ! $installing_wp ) { + Utils::info( "Running as single site...\n<br>ℹ️ To run multisite, pass <span class=\"text-orange-500\">WP_MULTISITE=1</span> or set the <span class=\"text-orange-500\">WP_TESTS_MULTISITE=1</span> constant." ); +} +unset( $multisite ); + +$GLOBALS['_wp_die_disabled'] = false; + +// Allow tests to override wp_die(). +tests_add_filter( 'wp_die_handler', [ WP_Die::class, 'get_toggled_handler' ] ); + +// Use the Spy REST Server instead of default. +tests_add_filter( 'wp_rest_server_class', [ Utils::class, 'wp_rest_server_class_filter' ], PHP_INT_MAX ); + +// Prevent updating translations asynchronously. +tests_add_filter( 'async_update_translation', '__return_false' ); + +// Disable background updates. +tests_add_filter( 'automatic_updater_disabled', '__return_true' ); + +// Disable VIP's alloptions protections during unit testing. +tests_add_filter( 'vip_mu_plugins_loaded', function (): void { + remove_filter( 'pre_wp_load_alloptions', 'Automattic\\VIP\\Core\\OptionsAPI\\pre_wp_load_alloptions_protections', 999 ); +} ); + +// Load WordPress. +require_once ABSPATH . '/wp-settings.php'; + +/* + * See https://core.trac.wordpress.org/ticket/48605. + */ +if ( isset( $_SERVER['REQUEST_TIME'] ) ) { + $_SERVER['REQUEST_TIME'] = (int) $_SERVER['REQUEST_TIME']; +} +if ( isset( $_SERVER['REQUEST_TIME_FLOAT'] ) ) { + $_SERVER['REQUEST_TIME_FLOAT'] = (float) $_SERVER['REQUEST_TIME_FLOAT']; +} + +// Disable VIP's alloptions protections during unit testing. +remove_filter( 'pre_wp_load_alloptions', 'Automattic\\VIP\\Core\\OptionsAPI\\pre_wp_load_alloptions_protections', 999 ); + +// Delete any default posts & related data. +if ( is_blog_installed() ) { + Utils::delete_all_posts(); +} diff --git a/vendor/mantle-framework/testing/wp-tests-config-sample.php b/vendor/mantle-framework/testing/wp-tests-config-sample.php new file mode 100644 index 00000000..852246eb --- /dev/null +++ b/vendor/mantle-framework/testing/wp-tests-config-sample.php @@ -0,0 +1,61 @@ +<?php // phpcs:disable + +/* Path to the WordPress codebase you'd like to test. Add a forward slash in the end. */ +define( 'ABSPATH', __DIR__ . '/' ); + +/* + * Path to the theme to test with. + */ +define( 'WP_DEFAULT_THEME', 'twentytwenty' ); + +/* + * Test with multisite enabled. + * Alternatively, use the tests/phpunit/multisite.xml configuration file. + */ +// define( 'WP_TESTS_MULTISITE', true ); + +// Test with WordPress debug mode (default). +define( 'WP_DEBUG', true ); + +// ** MySQL settings ** // + +/* + * This configuration file will be used by the copy of WordPress being tested. + * wordpress/wp-config.php will be ignored. + * + * WARNING WARNING WARNING! + * These tests will DROP ALL TABLES in the database with the prefix named below. + * DO NOT use a production database or one that is shared with something else. + */ + +define( 'DB_NAME', 'wordpress_unit_tests' ); +define( 'DB_USER', 'root' ); +define( 'DB_PASSWORD', 'root' ); +define( 'DB_HOST', 'localhost' ); +define( 'DB_CHARSET', 'utf8' ); +define( 'DB_COLLATE', '' ); + +/**#@+ + * Authentication Unique Keys and Salts. + * + * Change these to different unique phrases! + * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service} + */ +define( 'AUTH_KEY', 'put your unique phrase here' ); +define( 'SECURE_AUTH_KEY', 'put your unique phrase here' ); +define( 'LOGGED_IN_KEY', 'put your unique phrase here' ); +define( 'NONCE_KEY', 'put your unique phrase here' ); +define( 'AUTH_SALT', 'put your unique phrase here' ); +define( 'SECURE_AUTH_SALT', 'put your unique phrase here' ); +define( 'LOGGED_IN_SALT', 'put your unique phrase here' ); +define( 'NONCE_SALT', 'put your unique phrase here' ); + +$table_prefix = 'wptests_'; // Only numbers, letters, and underscores please! + +define( 'WP_TESTS_DOMAIN', 'example.org' ); +define( 'WP_TESTS_EMAIL', 'admin@example.org' ); +define( 'WP_TESTS_TITLE', 'Test Site' ); + +define( 'WP_PHP_BINARY', 'php' ); + +define( 'WPLANG', '' ); diff --git a/vendor/mantle-framework/testkit/LICENSE b/vendor/mantle-framework/testkit/LICENSE new file mode 100644 index 00000000..d159169d --- /dev/null +++ b/vendor/mantle-framework/testkit/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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. + + <signature of Ty Coon>, 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/vendor/mantle-framework/testkit/autoload.php b/vendor/mantle-framework/testkit/autoload.php new file mode 100644 index 00000000..639852c8 --- /dev/null +++ b/vendor/mantle-framework/testkit/autoload.php @@ -0,0 +1,32 @@ +<?php +/** + * Testkit autoload file + * + * @package Mantle + */ + +use NunoMaduro\Collision\Adapters\Phpunit\Subscribers\EnsurePrinterIsRegisteredSubscriber; +use PHPUnit\Event\Facade as PHPUnitFacade; +use PHPUnit\Runner\Version; + +/** + * Register the collision printer for PHPUnit 10. + * + * Due to a change in the collision package, the printer must be registered + * manually unless the test suite is manually invoked by the code base (which + * most projects do not use). + * + * The printer code is largely private and not intended to be used by external + * code, so we need to carefully check for the existence of the classes and + * methods we need to use. + */ +if ( + class_exists( Version::class ) + && version_compare( Version::id(), '10.0.0', '>=' ) + && empty( getenv( 'COLLISION_DISABLE' ) ) // A kill switch for disabling the printer. + && class_exists( PHPUnitFacade::class ) + && class_exists( EnsurePrinterIsRegisteredSubscriber::class ) + && method_exists( PHPUnitFacade::class, 'registerSubscriber' ) +) { + PHPUnitFacade::instance()->registerSubscriber( new EnsurePrinterIsRegisteredSubscriber() ); +} diff --git a/vendor/mantle-framework/testkit/class-application.php b/vendor/mantle-framework/testkit/class-application.php new file mode 100644 index 00000000..9601650e --- /dev/null +++ b/vendor/mantle-framework/testkit/class-application.php @@ -0,0 +1,498 @@ +<?php +/** + * Application class file + * + * phpcs:disable Squiz.Commenting.FunctionComment.InvalidNoReturn + * + * @package Mantle + */ + +namespace Mantle\Testkit; + +use Faker\Generator; +use Faker\Factory; +use Mantle\Container\Container; +use Mantle\Contracts\Application as Application_Contract; +use Mantle\Contracts\Container as Container_Contract; +use Mantle\Contracts\Kernel as Kernel_Contract; +use Mantle\Events\Dispatcher; +use Mantle\Faker\Faker_Provider; +use Mantle\Support\Environment; +use Mantle\Support\Service_Provider; +use RuntimeException; + +/** + * Testkit Application + * + * For use of the Mantle testing framework entirely independent of the Mantle framework. + */ +class Application extends Container implements Application_Contract { + /** + * Base path of the application. + * + * @var string + */ + protected $base_path; + + /** + * Application path of the application. + * + * @var string + */ + protected $app_path; + + /** + * Bootstrap path of the application. + * + * @var string + */ + protected $bootstrap_path; + + /** + * Storage path of the application. + * + * @var string + */ + protected $storage_path; + + /** + * Root URL of the application. + * + * @var string + */ + protected $root_url; + + /** + * Indicates if the application has been bootstrapped before. + * + * @var bool + */ + protected $has_been_bootstrapped = false; + + /** + * Indicates if the application has "booted". + * + * @var bool + */ + protected $booted = false; + + /** + * Environment file name. + * + * @var string + */ + protected $environment_file = '.env'; + + /** + * The custom environment path defined by the developer. + * + * @var string + */ + protected $environment_path; + + /** + * Storage of the overridden environment name. + * + * @var string + */ + protected $environment; + + /** + * Constructor. + * + * @param string $base_path Base path to set. + * @param string $root_url Root URL of the application. + */ + public function __construct( string $base_path = '', string $root_url = null ) { + if ( empty( $base_path ) && defined( 'MANTLE_BASE_DIR' ) ) { + $base_path = \MANTLE_BASE_DIR; + } + + if ( ! $root_url ) { + $root_url = \home_url(); + } + + $this->set_base_path( $base_path ); + $this->set_root_url( $root_url ); + $this->register_base_bindings(); + $this->register_base_service_providers(); + } + + /** + * Set the base path of the application. + * + * @param string $path Path to set. + * @return static + */ + public function set_base_path( string $path ) { + $this->base_path = $path; + + $this->instance( 'path', $this->get_base_path() ); + $this->instance( 'path.bootstrap', $this->get_bootstrap_path() ); + $this->instance( 'path.storage', $this->get_storage_path() ); + + return $this; + } + + /** + * Getter for the base path. + * + * @param string $path Path to append. + */ + public function get_base_path( string $path = '' ): string { + return $this->base_path . ( $path ? DIRECTORY_SEPARATOR . $path : '' ); + } + + /** + * Get the path to the application "app" directory. + * + * @param string $path Path to append, optional. + */ + public function get_app_path( string $path = '' ): string { + $app_path = $this->app_path ?: $this->get_base_path( 'app' ); + + return $app_path . ( $path ? DIRECTORY_SEPARATOR . $path : $path ); + } + + /** + * Set the application directory. + * + * @param string $path Path to use. + * @return static + */ + public function set_app_path( string $path ) { + $this->app_path = $path; + + $this->instance( 'path', $path ); + + return $this; + } + + /** + * Getter for the bootstrap path. + * + * @param string $path Path to append. + */ + public function get_bootstrap_path( string $path = '' ): string { + return ( $this->bootstrap_path ?: $this->base_path . DIRECTORY_SEPARATOR . 'bootstrap' ) . $path; + } + + /** + * Getter for the storage path. + * + * @param string $path Path to append. + */ + public function get_storage_path( string $path = '' ): string { + return ( $this->storage_path ?: $this->base_path . DIRECTORY_SEPARATOR . 'storage' ) . $path; + } + + /** + * Set the root URL of the application. + * + * @param string $url Root URL to set. + */ + public function set_root_url( string $url ): void { + $this->root_url = $url; + } + + /** + * Getter for the root URL. + * + * @param string $path Path to append. + */ + public function get_root_url( string $path = '' ): string { + return $this->root_url . ( $path ? DIRECTORY_SEPARATOR . $path : '' ); + } + + /** + * Get the cache folder root + * Folder that stores all compiled server-side assets for the application. + */ + public function get_cache_path(): string { + return $this->get_bootstrap_path( '/cache' ); + } + + /** + * Get the cached Composer packages path. + * + * Used to store all auto-loaded packages that are Composer dependencies. + */ + public function get_cached_packages_path(): string { + return $this->get_cache_path() . '/packages.php'; + } + + /** + * Get the cached model manifest path. + * Used to store all auto-registered models that are in the application. + */ + public function get_cached_models_path(): string { + return ''; + } + + /** + * Determine if the application is cached. + */ + public function is_configuration_cached(): bool { + return false; + } + + /** + * Retrieve the cached configuration path. + */ + public function get_cached_config_path(): string { + return ''; + } + + /** + * Determine if events are cached. + */ + public function is_events_cached(): bool { + return false; + } + + /** + * Retrieve the cached configuration path. + */ + public function get_cached_events_path(): string { + return ''; + } + + /** + * Get the path to the application configuration files. + */ + public function get_config_path(): string { + return ''; + } + + /** + * Determine if the application has been bootstrapped before. + */ + public function has_been_bootstrapped(): bool { + return (bool) $this->has_been_bootstrapped; + } + + /** + * Register the basic bindings into the container. + * + * @return void + */ + protected function register_base_bindings() { + static::set_instance( $this ); + + $this->instance( 'app', $this ); + $this->instance( Container::class, $this ); + $this->instance( Container_Contract::class, $this ); + $this->instance( static::class, $this ); + } + + /** + * Register the base service providers. + */ + protected function register_base_service_providers() { + $this->singleton( 'events', fn ( $app ) => new Dispatcher( $app ) ); + + $this->singleton( + Generator::class, + function() { + $factory = Factory::create(); + + $factory->unique( true ); + + $factory->addProvider( new Faker_Provider( $factory ) ); + + return $factory; + }, + ); + } + + /** + * Run the given array of bootstrap classes. + * + * @throws RuntimeException Thrown on use. + * + * @param string[] $bootstrappers Class names of packages to boot. + * @param Kernel_Contract $kernel Kernel instance. + */ + public function bootstrap_with( array $bootstrappers, Kernel_Contract $kernel ): never { + throw new RuntimeException( 'Not supported with Testkit' ); + } + + /** + * Get an instance of a service provider. + * + * @throws RuntimeException Thrown on use. + * + * @param string $name Provider class name. + */ + public function get_provider( string $name ): ?Service_Provider { + throw new RuntimeException( 'Not supported with Testkit' ); + } + + /** + * Get all service providers. + */ + public function get_providers(): array { + return []; + } + + /** + * Register a Service Provider + * + * @throws RuntimeException Thrown on use. + * + * @param Service_Provider|string $provider Service provider to register. + */ + public function register( Service_Provider|string $provider ): static { + throw new RuntimeException( 'Not supported with Testkit' ); + } + + /** + * Determine if the application has booted. + */ + public function is_booted(): bool { + return $this->booted; + } + + /** + * Boot the application's service providers. + * + * @return static + */ + public function boot() { + $this->booted = true; + + return $this; + } + + /** + * Set and retrieve the environment file name. + * + * @param string $file File name to set. + */ + public function environment_file( string $file = null ): string { + if ( $file ) { + $this->environment_file = $file; + } + + return $this->environment_file ?: '.env'; + } + + /** + * Set and retrieve the environment path to use. + * + * @param string $path Path to set, optional. + * @return string + */ + public function environment_path( string $path = null ): ?string { + if ( $path ) { + $this->environment_path = $path; + } + + return $this->environment_path; + } + + /** + * Get the Application's Environment + */ + public function environment(): string { + if ( ! empty( $this->environment ) ) { + return $this->environment; + } + + return Environment::get( 'ENV', wp_get_environment_type() ); + } + + /** + * Check if the Application's Environment matches a list. + * + * @param string|array ...$environments Environments to check. + */ + public function is_environment( ...$environments ): bool { + return in_array( $this->environment(), $environments, true ); + } + + /** + * Get the application namespace. + * + * @throws RuntimeException Thrown on error determining namespace. + */ + public function get_namespace(): string { + return Environment::get( 'APP_NAMESPACE', 'App' ); + } + + /** + * Alias to get_namespace(). + * + * @throws RuntimeException Thrown on error determining namespace. + */ + public function namespace(): string { + return $this->get_namespace(); + } + + /** + * Check if the application is running in the console (wp-cli). + */ + public function is_running_in_console(): bool { + return false; + } + + /** + * Check if the application is running in console isolation mode. + */ + public function is_running_in_console_isolation(): bool { + return false; + } + + /** + * Set the environment for the application. + * + * @param string $environment Environment to set. + * @return static + */ + public function set_environment( string $environment ) { + $this->environment = $environment; + return $this; + } + + /** + * Register a new boot listener. + * + * @throws RuntimeException Thrown on use. + * + * @param callable $callback Callback for the listener. + */ + public function booting( callable $callback ): static { + throw new RuntimeException( 'Not supported with Testkit' ); + } + + /** + * Register a new "booted" listener. + * + * @throws RuntimeException Thrown on use. + * + * @param callable $callback Callback for the listener. + */ + public function booted( callable $callback ): static { + throw new RuntimeException( 'Not supported with Testkit' ); + } + + /** + * Register a new terminating callback. + * + * @throws RuntimeException Thrown on use. + * + * @param callable $callback Callback for the listener. + */ + public function terminating( callable $callback ): static { + throw new RuntimeException( 'Not supported with Testkit' ); + } + + /** + * Terminate the application. + * + * @throws RuntimeException Thrown on use. + */ + public function terminate(): void { + throw new RuntimeException( 'Not supported with Testkit' ); + } +} diff --git a/vendor/mantle-framework/testkit/class-exception-handler.php b/vendor/mantle-framework/testkit/class-exception-handler.php new file mode 100644 index 00000000..f07dd5c0 --- /dev/null +++ b/vendor/mantle-framework/testkit/class-exception-handler.php @@ -0,0 +1,59 @@ +<?php +/** + * Exception_Handler class file + * + * @package Mantle + */ + +namespace Mantle\Testkit; + +use Mantle\Contracts\Exceptions\Handler as Exceptions_Handler; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\HttpFoundation\Response; +use Throwable; + +/** + * Testkit Exception Handler + * + * Used to display errors during testing. + */ +class Exception_Handler implements Exceptions_Handler { + /** + * Report or log an exception. + * + * @param Throwable $e Exception thrown. + */ + public function report( Throwable $e ): void { + dump( static::class . '::' . __FUNCTION__ . '()', $e ); + } + + /** + * Determine if the exception should be reported. + * + * @param Throwable $e Exception thrown. + */ + public function should_report( Throwable $e ): bool { + return true; + } + + /** + * Render an exception into an HTTP response. + * + * @param \Mantle\Http\Request $request + * @param \Throwable $e Exception thrown. + * @return \Symfony\Component\HttpFoundation\Response + */ + public function render( $request, Throwable $e ) { + return new Response(); + } + + /** + * Render an exception for the console. + * + * @param OutputInterface $output + * @param Throwable $e + */ + public function render_for_console( OutputInterface $output, Throwable $e ): void { + $output->writeln( "<error>Exception: {$e->getMessage()}</error>" ); + } +} diff --git a/vendor/mantle-framework/testkit/class-integration-test-case.php b/vendor/mantle-framework/testkit/class-integration-test-case.php new file mode 100644 index 00000000..45b5885f --- /dev/null +++ b/vendor/mantle-framework/testkit/class-integration-test-case.php @@ -0,0 +1,21 @@ +<?php +/** + * Integration_Test_Case class file + * + * @package Mantle + */ + +namespace Mantle\Testkit; + +use Mantle\Testkit\Concerns\Installs_WordPress; +use Mantle\Testkit\Test_Case as Testing_Test_Case; + +/** + * Testkit Integration Test Case + * + * For use in integration tests. Will install WordPress during Test Class + * set up process. + */ +abstract class Integration_Test_Case extends Testing_Test_Case { + use Installs_WordPress; +} diff --git a/vendor/mantle-framework/testkit/class-test-case.php b/vendor/mantle-framework/testkit/class-test-case.php new file mode 100644 index 00000000..7e77a030 --- /dev/null +++ b/vendor/mantle-framework/testkit/class-test-case.php @@ -0,0 +1,35 @@ +<?php +/** + * Test_Case class file + * + * @package Mantle + */ + +namespace Mantle\Testkit; + +use Mantle\Testkit\Concerns\Create_Application; +use Mantle\Testkit\Concerns\Installs_WordPress; +use Mantle\Testing\Test_Case as Testing_Test_Case; + +/** + * Testkit Test Case + * + * For use of the Mantle testing framework independent of the Mantle framework. + * Inspired by `Orchestra\Testbench`. + */ +abstract class Test_Case extends Testing_Test_Case { + use Create_Application; + + /** + * Add Testkit specific traits to Priority list. + */ + protected static function get_priority_traits(): array { + $parent_priorities = parent::get_priority_traits(); + + $priorities = [ + Installs_WordPress::class, + ]; + + return array_merge( $priorities, $parent_priorities ); + } +} diff --git a/vendor/mantle-framework/testkit/class-unit-test-case.php b/vendor/mantle-framework/testkit/class-unit-test-case.php new file mode 100644 index 00000000..8a4cdafc --- /dev/null +++ b/vendor/mantle-framework/testkit/class-unit-test-case.php @@ -0,0 +1,35 @@ +<?php +/** + * Unit_Test_Case class file + * + * @package Mantle + */ + +namespace Mantle\Testkit; + +use PHPUnit\Framework\TestCase as Testing_Test_Case; + +/** + * Unit Test Case. + * + * Sets some required defaults for us, such as not preserving global state, + * and running each class in a separate process. This is required to not + * have global state mixed with Integration test global state. + */ +abstract class Unit_Test_Case extends Testing_Test_Case { + /** + * We want to run our unit tests in isolation, allowing us to separate them + * from the WordPress installation cluttered global state. + * + * @param array ...$args The array of arguments passed to the class. + */ + public function __construct( ...$args ) { + parent::__construct( ...$args ); // @phpstan-ignore-line expects string|null + + // Discard all of the WordPress global state. + $this->setPreserveGlobalState( false ); + + // Load a new process to allow us to redefine functions. + $this->setRunClassInSeparateProcess( true ); + } +} diff --git a/vendor/mantle-framework/testkit/composer.json b/vendor/mantle-framework/testkit/composer.json new file mode 100644 index 00000000..2c27cf75 --- /dev/null +++ b/vendor/mantle-framework/testkit/composer.json @@ -0,0 +1,49 @@ +{ + "name": "mantle-framework/testkit", + "description": "The Mantle Framework Teskit Package", + "keywords": ["testing", "mantle"], + "type": "library", + "require": { + "php": "^8.1", + "alleyinteractive/composer-wordpress-autoloader": "^1.0", + "mantle-framework/config": "^1.0", + "mantle-framework/container": "^1.0", + "mantle-framework/contracts": "^1.0", + "mantle-framework/events": "^1.0", + "mantle-framework/faker": "^1.0", + "mantle-framework/support": "^1.0", + "mantle-framework/testing": "^1.0", + "nunomaduro/collision": "^6.0 || ^7.0", + "phpunit/phpunit": "^9.3.3 || ^10.0.7 || ^11.0", + "symfony/http-foundation": "^6.0" + }, + "extra": { + "wordpress-autoloader": { + "autoload": { + "Mantle\\Testkit": "./" + } + } + }, + "autoload": { + "files": [ + "autoload.php" + ] + }, + "license": "GPL-2.0-or-later", + "authors": [ + { + "name": "Alley", + "email": "mantle@alley.com" + } + ], + "config": { + "sort-packages": true + }, + "conflict": { + "alleyinteractive/mantle-framework": "*" + }, + "minimum-stability": "dev", + "suggest": { + "alleyinteractive/mantle-framework": "For the full Mantle Framework, require the base package instead." + } +} diff --git a/vendor/mantle-framework/testkit/concerns/trait-create-application.php b/vendor/mantle-framework/testkit/concerns/trait-create-application.php new file mode 100644 index 00000000..e52f7a1f --- /dev/null +++ b/vendor/mantle-framework/testkit/concerns/trait-create-application.php @@ -0,0 +1,174 @@ +<?php +/** + * Create_Application trait file + * + * @package Mantle + */ + +namespace Mantle\Testkit\Concerns; + +use Mantle\Config\Repository; +use Mantle\Contracts\Exceptions\Handler as Handler_Contract; +use Mantle\Http\Request; +use Mantle\Http\Routing\Url_Generator; +use Mantle\Support\Collection; +use Mantle\Testkit\Application; +use Mantle\Testkit\Exception_Handler; +use Symfony\Component\Routing\RouteCollection; + +/** + * Concern for creating the application instance for Mantle TestKit. + * + * This trait is used to create a semi-isolated instance of the Mantle + * Application that doesn't have all the bells and whistles of a full Mantle + * Application. Notably, the service providers are never registered or booted + * here. + * + * One thing to remember is that this package is largely used in isolation. The + * dependent package will not have the files within the "framework" package and + * cannot be used here. In a future version, we should consider loading the + * framework's base configuration (in the config directory) instead of stubbing + * out our defaults here. We should also consider reusing the bootloader here + * and moving that to a standalone package. + */ +trait Create_Application { + /** + * Creates the application. + * + * @return Application + */ + public function create_application(): \Mantle\Contracts\Application { + $app = new Application(); + + $this->resolve_application_bindings( $app ); + $this->resolve_application_config( $app ); + + return $app; + } + + /** + * Override application bindings, to be overridden by the child unit test. + * + * @param Application $app Application instance. + * @return array + */ + protected function override_application_bindings( $app ) { + return []; + } + + /** + * Resolve application bindings. + * + * @param Application $app Application instance. + */ + final protected function resolve_application_bindings( $app ): void { + $app->singleton( Handler_Contract::class, Exception_Handler::class ); + + foreach ( $this->override_application_bindings( $app ) as $original => $replacement ) { + $app->bind( $original, $replacement ); + } + + $app->singleton_if( + 'url', + fn ( $app ) => new Url_Generator( + $app->get_root_url(), + new RouteCollection(), + $app['request'] ?? new Request(), + ), + ); + } + + /** + * Default configuration for the test. + */ + protected function get_application_config(): array { + return [ + 'app' => [ + 'debug' => true, + 'providers' => [], + ], + 'queue' => [ + 'batch_size' => 100, + 'default' => 'wordpress', + ], + 'logging' => [ + 'default' => 'error_log', + 'channels' => [ + 'error_log' => [ + 'driver' => 'error_log', + ], + ], + ], + 'view' => [ + 'compiled' => sys_get_temp_dir(), + ], + 'filesystem' => [], + 'cache' => [], + ]; + } + + /** + * Configuration for the test. + * + * @param Application $app Application instance. + */ + protected function override_application_config( $app ): array { + return []; + } + + /** + * Resolve application core configuration. + * + * @param Application $app Application instance. + * @todo Allow for overriding the configuration aliases and providers easily within the unit test. + */ + protected function resolve_application_config( $app ) { + $config = new Repository( + array_merge( + $this->get_application_config(), + $this->override_application_config( $app ) + ) + ); + + $app->instance( 'config', $config ); + $app['config']['app.providers'] = $this->resolve_application_providers( $app ); + } + + /** + * Get application providers. + * + * @param Application $app Application instance. + * @return array + */ + protected function get_application_providers( $app ) { + return $app['config']['app.providers']; + } + + /** + * Override application aliases. + * + * @param Application $app Application instance. + * @return array + */ + protected function override_application_providers( $app ) { + return []; + } + + /** + * Resolve application aliases. + * + * @param Application $app Application instance. + */ + final protected function resolve_application_providers( $app ): array { + $providers = new Collection( $this->get_application_providers( $app ) ); + $overrides = $this->override_application_providers( $app ); + + if ( ! empty( $overrides ) ) { + $providers->transform( + static fn ( $provider) => $overrides[ $provider ] ?? $provider + ); + } + + return $providers->all(); + } +} diff --git a/vendor/mantle-framework/testkit/concerns/trait-installs-wordpress.php b/vendor/mantle-framework/testkit/concerns/trait-installs-wordpress.php new file mode 100644 index 00000000..a13a2cca --- /dev/null +++ b/vendor/mantle-framework/testkit/concerns/trait-installs-wordpress.php @@ -0,0 +1,42 @@ +<?php +/** + * Installs_WordPress trait file + * + * @package Mantle + */ + +namespace Mantle\Testkit\Concerns; + +/** + * Concern for handling WordPress installation outside of the bootstrap. + */ +trait Installs_WordPress { + /** + * Manages installing WordPress. + * + * This is useful for installing WordPress in integration tests, while leaving + * the bootstrap free of this overhead during unit tests. To perform actions + * after WordPress is installed, you can use the Installation Manager to + * define a callback to be invoked before/after installation. + */ + public static function installs_wordpress_set_up_before_class(): void { + static $installed = false; + + if ( true === $installed ) { + return; + } + + /** + * Fire a callback to a named function called 'mantle_after_wordpress_install'. + * + * @deprecated Logic condensed into {@see \Mantle\Testing\Installation_Manager::after()}. + */ + $callback = function_exists( 'mantle_after_wordpress_install' ) ? 'mantle_after_wordpress_install' : null; + + \Mantle\Testing\manager() + ->after( $callback ) + ->install(); + + $installed = true; + } +} diff --git a/vendor/monolog/monolog/CHANGELOG.md b/vendor/monolog/monolog/CHANGELOG.md new file mode 100644 index 00000000..a9a31e71 --- /dev/null +++ b/vendor/monolog/monolog/CHANGELOG.md @@ -0,0 +1,633 @@ +### 2.9.3 (2024-04-12) + + * Fixed PHP 8.4 deprecation warnings (#1874) + +### 2.9.2 (2023-10-27) + + * Fixed display_errors parsing in ErrorHandler which did not support string values (#1804) + * Fixed bug where the previous error handler would not be restored in some cases where StreamHandler fails (#1815) + * Fixed normalization error when normalizing incomplete classes (#1833) + +### 2.9.1 (2023-02-06) + + * Fixed Logger not being serializable anymore (#1792) + +### 2.9.0 (2023-02-05) + + * Deprecated FlowdockHandler & Formatter as the flowdock service was shutdown (#1748) + * Added support for enum context values in PsrLogMessageProcessor (#1773) + * Added graylog2/gelf-php 2.x support (#1747) + * Improved `BrowserConsoleHandler` logging to use more appropriate methods than just console.log in the browser (#1739) + * Fixed `WhatFailureGroupHandler` not catching errors happening inside `close()` (#1791) + * Fixed datetime field in `GoogleCloudLoggingFormatter` (#1758) + * Fixed infinite loop detection within Fibers (#1753) + * Fixed `AmqpHandler->setExtraAttributes` not working with buffering handler wrappers (#1781) + +### 2.8.0 (2022-07-24) + + * Deprecated `CubeHandler` and `PHPConsoleHandler` as both projects are abandoned and those should not be used anymore (#1734) + * Added RFC 5424 level (`7` to `0`) support to `Logger::log` and `Logger::addRecord` to increase interoperability (#1723) + * Added support for `__toString` for objects which are not json serializable in `JsonFormatter` (#1733) + * Added `GoogleCloudLoggingFormatter` (#1719) + * Added support for Predis 2.x (#1732) + * Added `AmqpHandler->setExtraAttributes` to allow configuring attributes when using an AMQPExchange (#1724) + * Fixed serialization/unserialization of handlers to make sure private properties are included (#1727) + * Fixed allowInlineLineBreaks in LineFormatter causing issues with windows paths containing `\n` or `\r` sequences (#1720) + * Fixed max normalization depth not being taken into account when formatting exceptions with a deep chain of previous exceptions (#1726) + * Fixed PHP 8.2 deprecation warnings (#1722) + * Fixed rare race condition or filesystem issue where StreamHandler is unable to create the directory the log should go into yet it exists already (#1678) + +### 2.7.0 (2022-06-09) + + * Added `$datetime` parameter to `Logger::addRecord` as low level API to allow logging into the past or future (#1682) + * Added `Logger::useLoggingLoopDetection` to allow disabling cyclic logging detection in concurrent frameworks (#1681) + * Fixed handling of fatal errors if callPrevious is disabled in ErrorHandler (#1670) + * Marked the reusable `Monolog\Test\TestCase` class as `@internal` to make sure PHPStorm does not show it above PHPUnit, you may still use it to test your own handlers/etc though (#1677) + * Fixed RotatingFileHandler issue when the date format contained slashes (#1671) + +### 2.6.0 (2022-05-10) + + * Deprecated `SwiftMailerHandler`, use `SymfonyMailerHandler` instead + * Added `SymfonyMailerHandler` (#1663) + * Added ElasticSearch 8.x support to the ElasticsearchHandler (#1662) + * Added a way to filter/modify stack traces in LineFormatter (#1665) + * Fixed UdpSocket not being able to reopen/reconnect after close() + * Fixed infinite loops if a Handler is triggering logging while handling log records + +### 2.5.0 (2022-04-08) + + * Added `callType` to IntrospectionProcessor (#1612) + * Fixed AsMonologProcessor syntax to be compatible with PHP 7.2 (#1651) + +### 2.4.0 (2022-03-14) + + * Added [`Monolog\LogRecord`](src/Monolog/LogRecord.php) interface that can be used to type-hint records like `array|\Monolog\LogRecord $record` to be forward compatible with the upcoming Monolog 3 changes + * Added `includeStacktraces` constructor params to LineFormatter & JsonFormatter (#1603) + * Added `persistent`, `timeout`, `writingTimeout`, `connectionTimeout`, `chunkSize` constructor params to SocketHandler and derivatives (#1600) + * Added `AsMonologProcessor` PHP attribute which can help autowiring / autoconfiguration of processors if frameworks / integrations decide to make use of it. This is useless when used purely with Monolog (#1637) + * Added support for keeping native BSON types as is in MongoDBFormatter (#1620) + * Added support for a `user_agent` key in WebProcessor, disabled by default but you can use it by configuring the $extraFields you want (#1613) + * Added support for username/userIcon in SlackWebhookHandler (#1617) + * Added extension points to BrowserConsoleHandler (#1593) + * Added record message/context/extra info to exceptions thrown when a StreamHandler cannot open its stream to avoid completely losing the data logged (#1630) + * Fixed error handler signature to accept a null $context which happens with internal PHP errors (#1614) + * Fixed a few setter methods not returning `self` (#1609) + * Fixed handling of records going over the max Telegram message length (#1616) + +### 2.3.5 (2021-10-01) + + * Fixed regression in StreamHandler since 2.3.3 on systems with the memory_limit set to >=20GB (#1592) + +### 2.3.4 (2021-09-15) + + * Fixed support for psr/log 3.x (#1589) + +### 2.3.3 (2021-09-14) + + * Fixed memory usage when using StreamHandler and calling stream_get_contents on the resource you passed to it (#1578, #1577) + * Fixed support for psr/log 2.x (#1587) + * Fixed some type annotations + +### 2.3.2 (2021-07-23) + + * Fixed compatibility with PHP 7.2 - 7.4 when experiencing PCRE errors (#1568) + +### 2.3.1 (2021-07-14) + + * Fixed Utils::getClass handling of anonymous classes not being fully compatible with PHP 8 (#1563) + * Fixed some `@inheritDoc` annotations having the wrong case + +### 2.3.0 (2021-07-05) + + * Added a ton of PHPStan type annotations as well as type aliases on Monolog\Logger for Record, Level and LevelName that you can import (#1557) + * Added ability to customize date format when using JsonFormatter (#1561) + * Fixed FilterHandler not calling reset on its internal handler when reset() is called on it (#1531) + * Fixed SyslogUdpHandler not setting the timezone correctly on DateTimeImmutable instances (#1540) + * Fixed StreamHandler thread safety - chunk size set to 2GB now to avoid interlacing when doing concurrent writes (#1553) + +### 2.2.0 (2020-12-14) + + * Added JSON_PARTIAL_OUTPUT_ON_ERROR to default json encoding flags, to avoid dropping entire context data or even records due to an invalid subset of it somewhere + * Added setDateFormat to NormalizerFormatter (and Line/Json formatters by extension) to allow changing this after object creation + * Added RedisPubSubHandler to log records to a Redis channel using PUBLISH + * Added support for Elastica 7, and deprecated the $type argument of ElasticaFormatter which is not in use anymore as of Elastica 7 + * Added support for millisecond write timeouts in SocketHandler, you can now pass floats to setWritingTimeout, e.g. 0.2 is 200ms + * Added support for unix sockets in SyslogUdpHandler (set $port to 0 to make the $host a unix socket) + * Added handleBatch support for TelegramBotHandler + * Added RFC5424e extended date format including milliseconds to SyslogUdpHandler + * Added support for configuring handlers with numeric level values in strings (coming from e.g. env vars) + * Fixed Wildfire/FirePHP/ChromePHP handling of unicode characters + * Fixed PHP 8 issues in SyslogUdpHandler + * Fixed internal type error when mbstring is missing + +### 2.1.1 (2020-07-23) + + * Fixed removing of json encoding options + * Fixed type hint of $level not accepting strings in SendGridHandler and OverflowHandler + * Fixed SwiftMailerHandler not accepting email templates with an empty subject + * Fixed array access on null in RavenHandler + * Fixed unique_id in WebProcessor not being disableable + +### 2.1.0 (2020-05-22) + + * Added `JSON_INVALID_UTF8_SUBSTITUTE` to default json flags, so that invalid UTF8 characters now get converted to [�](https://en.wikipedia.org/wiki/Specials_(Unicode_block)#Replacement_character) instead of being converted from ISO-8859-15 to UTF8 as it was before, which was hardly a comprehensive solution + * Added `$ignoreEmptyContextAndExtra` option to JsonFormatter to skip empty context/extra entirely from the output + * Added `$parseMode`, `$disableWebPagePreview` and `$disableNotification` options to TelegramBotHandler + * Added tentative support for PHP 8 + * NormalizerFormatter::addJsonEncodeOption and removeJsonEncodeOption are now public to allow modifying default json flags + * Fixed GitProcessor type error when there is no git repo present + * Fixed normalization of SoapFault objects containing deeply nested objects as "detail" + * Fixed support for relative paths in RotatingFileHandler + +### 2.0.2 (2019-12-20) + + * Fixed ElasticsearchHandler swallowing exceptions details when failing to index log records + * Fixed normalization of SoapFault objects containing non-strings as "detail" in LineFormatter + * Fixed formatting of resources in JsonFormatter + * Fixed RedisHandler failing to use MULTI properly when passed a proxied Redis instance (e.g. in Symfony with lazy services) + * Fixed FilterHandler triggering a notice when handleBatch was filtering all records passed to it + * Fixed Turkish locale messing up the conversion of level names to their constant values + +### 2.0.1 (2019-11-13) + + * Fixed normalization of Traversables to avoid traversing them as not all of them are rewindable + * Fixed setFormatter/getFormatter to forward to the nested handler in FilterHandler, FingersCrossedHandler, BufferHandler, OverflowHandler and SamplingHandler + * Fixed BrowserConsoleHandler formatting when using multiple styles + * Fixed normalization of exception codes to be always integers even for PDOException which have them as numeric strings + * Fixed normalization of SoapFault objects containing non-strings as "detail" + * Fixed json encoding across all handlers to always attempt recovery of non-UTF-8 strings instead of failing the whole encoding + * Fixed ChromePHPHandler to avoid sending more data than latest Chrome versions allow in headers (4KB down from 256KB). + * Fixed type error in BrowserConsoleHandler when the context array of log records was not associative. + +### 2.0.0 (2019-08-30) + + * BC Break: This is a major release, see [UPGRADE.md](UPGRADE.md) for details if you are coming from a 1.x release + * BC Break: Logger methods log/debug/info/notice/warning/error/critical/alert/emergency now have explicit void return types + * Added FallbackGroupHandler which works like the WhatFailureGroupHandler but stops dispatching log records as soon as one handler accepted it + * Fixed support for UTF-8 when cutting strings to avoid cutting a multibyte-character in half + * Fixed normalizers handling of exception backtraces to avoid serializing arguments in some cases + * Fixed date timezone handling in SyslogUdpHandler + +### 2.0.0-beta2 (2019-07-06) + + * BC Break: This is a major release, see [UPGRADE.md](UPGRADE.md) for details if you are coming from a 1.x release + * BC Break: PHP 7.2 is now the minimum required PHP version. + * BC Break: Removed SlackbotHandler, RavenHandler and HipChatHandler, see [UPGRADE.md](UPGRADE.md) for details + * Added OverflowHandler which will only flush log records to its nested handler when reaching a certain amount of logs (i.e. only pass through when things go really bad) + * Added TelegramBotHandler to log records to a [Telegram](https://core.telegram.org/bots/api) bot account + * Added support for JsonSerializable when normalizing exceptions + * Added support for RFC3164 (outdated BSD syslog protocol) to SyslogUdpHandler + * Added SoapFault details to formatted exceptions + * Fixed DeduplicationHandler silently failing to start when file could not be opened + * Fixed issue in GroupHandler and WhatFailureGroupHandler where setting multiple processors would duplicate records + * Fixed GelfFormatter losing some data when one attachment was too long + * Fixed issue in SignalHandler restarting syscalls functionality + * Improved performance of LogglyHandler when sending multiple logs in a single request + +### 2.0.0-beta1 (2018-12-08) + + * BC Break: This is a major release, see [UPGRADE.md](UPGRADE.md) for details if you are coming from a 1.x release + * BC Break: PHP 7.1 is now the minimum required PHP version. + * BC Break: Quite a few interface changes, only relevant if you implemented your own handlers/processors/formatters + * BC Break: Removed non-PSR-3 methods to add records, all the `add*` (e.g. `addWarning`) methods as well as `emerg`, `crit`, `err` and `warn` + * BC Break: The record timezone is now set per Logger instance and not statically anymore + * BC Break: There is no more default handler configured on empty Logger instances + * BC Break: ElasticSearchHandler renamed to ElasticaHandler + * BC Break: Various handler-specific breaks, see [UPGRADE.md](UPGRADE.md) for details + * Added scalar type hints and return hints in all the places it was possible. Switched strict_types on for more reliability. + * Added DateTimeImmutable support, all record datetime are now immutable, and will toString/json serialize with the correct date format, including microseconds (unless disabled) + * Added timezone and microseconds to the default date format + * Added SendGridHandler to use the SendGrid API to send emails + * Added LogmaticHandler to use the Logmatic.io API to store log records + * Added SqsHandler to send log records to an AWS SQS queue + * Added ElasticsearchHandler to send records via the official ES library. Elastica users should now use ElasticaHandler instead of ElasticSearchHandler + * Added NoopHandler which is similar to the NullHandle but does not prevent the bubbling of log records to handlers further down the configuration, useful for temporarily disabling a handler in configuration files + * Added ProcessHandler to write log output to the STDIN of a given process + * Added HostnameProcessor that adds the machine's hostname to log records + * Added a `$dateFormat` option to the PsrLogMessageProcessor which lets you format DateTime instances nicely + * Added support for the PHP 7.x `mongodb` extension in the MongoDBHandler + * Fixed many minor issues in various handlers, and probably added a few regressions too + +### 1.26.1 (2021-05-28) + + * Fixed PHP 8.1 deprecation warning + +### 1.26.0 (2020-12-14) + + * Added $dateFormat and $removeUsedContextFields arguments to PsrLogMessageProcessor (backport from 2.x) + +### 1.25.5 (2020-07-23) + + * Fixed array access on null in RavenHandler + * Fixed unique_id in WebProcessor not being disableable + +### 1.25.4 (2020-05-22) + + * Fixed GitProcessor type error when there is no git repo present + * Fixed normalization of SoapFault objects containing deeply nested objects as "detail" + * Fixed support for relative paths in RotatingFileHandler + +### 1.25.3 (2019-12-20) + + * Fixed formatting of resources in JsonFormatter + * Fixed RedisHandler failing to use MULTI properly when passed a proxied Redis instance (e.g. in Symfony with lazy services) + * Fixed FilterHandler triggering a notice when handleBatch was filtering all records passed to it + * Fixed Turkish locale messing up the conversion of level names to their constant values + +### 1.25.2 (2019-11-13) + + * Fixed normalization of Traversables to avoid traversing them as not all of them are rewindable + * Fixed setFormatter/getFormatter to forward to the nested handler in FilterHandler, FingersCrossedHandler, BufferHandler and SamplingHandler + * Fixed BrowserConsoleHandler formatting when using multiple styles + * Fixed normalization of exception codes to be always integers even for PDOException which have them as numeric strings + * Fixed normalization of SoapFault objects containing non-strings as "detail" + * Fixed json encoding across all handlers to always attempt recovery of non-UTF-8 strings instead of failing the whole encoding + +### 1.25.1 (2019-09-06) + + * Fixed forward-compatible interfaces to be compatible with Monolog 1.x too. + +### 1.25.0 (2019-09-06) + + * Deprecated SlackbotHandler, use SlackWebhookHandler or SlackHandler instead + * Deprecated RavenHandler, use sentry/sentry 2.x and their Sentry\Monolog\Handler instead + * Deprecated HipChatHandler, migrate to Slack and use SlackWebhookHandler or SlackHandler instead + * Added forward-compatible interfaces and traits FormattableHandlerInterface, FormattableHandlerTrait, ProcessableHandlerInterface, ProcessableHandlerTrait. If you use modern PHP and want to make code compatible with Monolog 1 and 2 this can help. You will have to require at least Monolog 1.25 though. + * Added support for RFC3164 (outdated BSD syslog protocol) to SyslogUdpHandler + * Fixed issue in GroupHandler and WhatFailureGroupHandler where setting multiple processors would duplicate records + * Fixed issue in SignalHandler restarting syscalls functionality + * Fixed normalizers handling of exception backtraces to avoid serializing arguments in some cases + * Fixed ZendMonitorHandler to work with the latest Zend Server versions + * Fixed ChromePHPHandler to avoid sending more data than latest Chrome versions allow in headers (4KB down from 256KB). + +### 1.24.0 (2018-11-05) + + * BC Notice: If you are extending any of the Monolog's Formatters' `normalize` method, make sure you add the new `$depth = 0` argument to your function signature to avoid strict PHP warnings. + * Added a `ResettableInterface` in order to reset/reset/clear/flush handlers and processors + * Added a `ProcessorInterface` as an optional way to label a class as being a processor (mostly useful for autowiring dependency containers) + * Added a way to log signals being received using Monolog\SignalHandler + * Added ability to customize error handling at the Logger level using Logger::setExceptionHandler + * Added InsightOpsHandler to migrate users of the LogEntriesHandler + * Added protection to NormalizerFormatter against circular and very deep structures, it now stops normalizing at a depth of 9 + * Added capture of stack traces to ErrorHandler when logging PHP errors + * Added RavenHandler support for a `contexts` context or extra key to forward that to Sentry's contexts + * Added forwarding of context info to FluentdFormatter + * Added SocketHandler::setChunkSize to override the default chunk size in case you must send large log lines to rsyslog for example + * Added ability to extend/override BrowserConsoleHandler + * Added SlackWebhookHandler::getWebhookUrl and SlackHandler::getToken to enable class extensibility + * Added SwiftMailerHandler::getSubjectFormatter to enable class extensibility + * Dropped official support for HHVM in test builds + * Fixed normalization of exception traces when call_user_func is used to avoid serializing objects and the data they contain + * Fixed naming of fields in Slack handler, all field names are now capitalized in all cases + * Fixed HipChatHandler bug where slack dropped messages randomly + * Fixed normalization of objects in Slack handlers + * Fixed support for PHP7's Throwable in NewRelicHandler + * Fixed race bug when StreamHandler sometimes incorrectly reported it failed to create a directory + * Fixed table row styling issues in HtmlFormatter + * Fixed RavenHandler dropping the message when logging exception + * Fixed WhatFailureGroupHandler skipping processors when using handleBatch + and implement it where possible + * Fixed display of anonymous class names + +### 1.23.0 (2017-06-19) + + * Improved SyslogUdpHandler's support for RFC5424 and added optional `$ident` argument + * Fixed GelfHandler truncation to be per field and not per message + * Fixed compatibility issue with PHP <5.3.6 + * Fixed support for headless Chrome in ChromePHPHandler + * Fixed support for latest Aws SDK in DynamoDbHandler + * Fixed support for SwiftMailer 6.0+ in SwiftMailerHandler + +### 1.22.1 (2017-03-13) + + * Fixed lots of minor issues in the new Slack integrations + * Fixed support for allowInlineLineBreaks in LineFormatter when formatting exception backtraces + +### 1.22.0 (2016-11-26) + + * Added SlackbotHandler and SlackWebhookHandler to set up Slack integration more easily + * Added MercurialProcessor to add mercurial revision and branch names to log records + * Added support for AWS SDK v3 in DynamoDbHandler + * Fixed fatal errors occurring when normalizing generators that have been fully consumed + * Fixed RollbarHandler to include a level (rollbar level), monolog_level (original name), channel and datetime (unix) + * Fixed RollbarHandler not flushing records automatically, calling close() explicitly is not necessary anymore + * Fixed SyslogUdpHandler to avoid sending empty frames + * Fixed a few PHP 7.0 and 7.1 compatibility issues + +### 1.21.0 (2016-07-29) + + * Break: Reverted the addition of $context when the ErrorHandler handles regular php errors from 1.20.0 as it was causing issues + * Added support for more formats in RotatingFileHandler::setFilenameFormat as long as they have Y, m and d in order + * Added ability to format the main line of text the SlackHandler sends by explicitly setting a formatter on the handler + * Added information about SoapFault instances in NormalizerFormatter + * Added $handleOnlyReportedErrors option on ErrorHandler::registerErrorHandler (default true) to allow logging of all errors no matter the error_reporting level + +### 1.20.0 (2016-07-02) + + * Added FingersCrossedHandler::activate() to manually trigger the handler regardless of the activation policy + * Added StreamHandler::getUrl to retrieve the stream's URL + * Added ability to override addRow/addTitle in HtmlFormatter + * Added the $context to context information when the ErrorHandler handles a regular php error + * Deprecated RotatingFileHandler::setFilenameFormat to only support 3 formats: Y, Y-m and Y-m-d + * Fixed WhatFailureGroupHandler to work with PHP7 throwables + * Fixed a few minor bugs + +### 1.19.0 (2016-04-12) + + * Break: StreamHandler will not close streams automatically that it does not own. If you pass in a stream (not a path/url), then it will not close it for you. You can retrieve those using getStream() if needed + * Added DeduplicationHandler to remove duplicate records from notifications across multiple requests, useful for email or other notifications on errors + * Added ability to use `%message%` and other LineFormatter replacements in the subject line of emails sent with NativeMailHandler and SwiftMailerHandler + * Fixed HipChatHandler handling of long messages + +### 1.18.2 (2016-04-02) + + * Fixed ElasticaFormatter to use more precise dates + * Fixed GelfMessageFormatter sending too long messages + +### 1.18.1 (2016-03-13) + + * Fixed SlackHandler bug where slack dropped messages randomly + * Fixed RedisHandler issue when using with the PHPRedis extension + * Fixed AmqpHandler content-type being incorrectly set when using with the AMQP extension + * Fixed BrowserConsoleHandler regression + +### 1.18.0 (2016-03-01) + + * Added optional reduction of timestamp precision via `Logger->useMicrosecondTimestamps(false)`, disabling it gets you a bit of performance boost but reduces the precision to the second instead of microsecond + * Added possibility to skip some extra stack frames in IntrospectionProcessor if you have some library wrapping Monolog that is always adding frames + * Added `Logger->withName` to clone a logger (keeping all handlers) with a new name + * Added FluentdFormatter for the Fluentd unix socket protocol + * Added HandlerWrapper base class to ease the creation of handler wrappers, just extend it and override as needed + * Added support for replacing context sub-keys using `%context.*%` in LineFormatter + * Added support for `payload` context value in RollbarHandler + * Added setRelease to RavenHandler to describe the application version, sent with every log + * Added support for `fingerprint` context value in RavenHandler + * Fixed JSON encoding errors that would gobble up the whole log record, we now handle those more gracefully by dropping chars as needed + * Fixed write timeouts in SocketHandler and derivatives, set to 10sec by default, lower it with `setWritingTimeout()` + * Fixed PHP7 compatibility with regard to Exception/Throwable handling in a few places + +### 1.17.2 (2015-10-14) + + * Fixed ErrorHandler compatibility with non-Monolog PSR-3 loggers + * Fixed SlackHandler handling to use slack functionalities better + * Fixed SwiftMailerHandler bug when sending multiple emails they all had the same id + * Fixed 5.3 compatibility regression + +### 1.17.1 (2015-08-31) + + * Fixed RollbarHandler triggering PHP notices + +### 1.17.0 (2015-08-30) + + * Added support for `checksum` and `release` context/extra values in RavenHandler + * Added better support for exceptions in RollbarHandler + * Added UidProcessor::getUid + * Added support for showing the resource type in NormalizedFormatter + * Fixed IntrospectionProcessor triggering PHP notices + +### 1.16.0 (2015-08-09) + + * Added IFTTTHandler to notify ifttt.com triggers + * Added Logger::setHandlers() to allow setting/replacing all handlers + * Added $capSize in RedisHandler to cap the log size + * Fixed StreamHandler creation of directory to only trigger when the first log write happens + * Fixed bug in the handling of curl failures + * Fixed duplicate logging of fatal errors when both error and fatal error handlers are registered in monolog's ErrorHandler + * Fixed missing fatal errors records with handlers that need to be closed to flush log records + * Fixed TagProcessor::addTags support for associative arrays + +### 1.15.0 (2015-07-12) + + * Added addTags and setTags methods to change a TagProcessor + * Added automatic creation of directories if they are missing for a StreamHandler to open a log file + * Added retry functionality to Loggly, Cube and Mandrill handlers so they retry up to 5 times in case of network failure + * Fixed process exit code being incorrectly reset to 0 if ErrorHandler::registerExceptionHandler was used + * Fixed HTML/JS escaping in BrowserConsoleHandler + * Fixed JSON encoding errors being silently suppressed (PHP 5.5+ only) + +### 1.14.0 (2015-06-19) + + * Added PHPConsoleHandler to send record to Chrome's PHP Console extension and library + * Added support for objects implementing __toString in the NormalizerFormatter + * Added support for HipChat's v2 API in HipChatHandler + * Added Logger::setTimezone() to initialize the timezone monolog should use in case date.timezone isn't correct for your app + * Added an option to send formatted message instead of the raw record on PushoverHandler via ->useFormattedMessage(true) + * Fixed curl errors being silently suppressed + +### 1.13.1 (2015-03-09) + + * Fixed regression in HipChat requiring a new token to be created + +### 1.13.0 (2015-03-05) + + * Added Registry::hasLogger to check for the presence of a logger instance + * Added context.user support to RavenHandler + * Added HipChat API v2 support in the HipChatHandler + * Added NativeMailerHandler::addParameter to pass params to the mail() process + * Added context data to SlackHandler when $includeContextAndExtra is true + * Added ability to customize the Swift_Message per-email in SwiftMailerHandler + * Fixed SwiftMailerHandler to lazily create message instances if a callback is provided + * Fixed serialization of INF and NaN values in Normalizer and LineFormatter + +### 1.12.0 (2014-12-29) + + * Break: HandlerInterface::isHandling now receives a partial record containing only a level key. This was always the intent and does not break any Monolog handler but is strictly speaking a BC break and you should check if you relied on any other field in your own handlers. + * Added PsrHandler to forward records to another PSR-3 logger + * Added SamplingHandler to wrap around a handler and include only every Nth record + * Added MongoDBFormatter to support better storage with MongoDBHandler (it must be enabled manually for now) + * Added exception codes in the output of most formatters + * Added LineFormatter::includeStacktraces to enable exception stack traces in logs (uses more than one line) + * Added $useShortAttachment to SlackHandler to minify attachment size and $includeExtra to append extra data + * Added $host to HipChatHandler for users of private instances + * Added $transactionName to NewRelicHandler and support for a transaction_name context value + * Fixed MandrillHandler to avoid outputting API call responses + * Fixed some non-standard behaviors in SyslogUdpHandler + +### 1.11.0 (2014-09-30) + + * Break: The NewRelicHandler extra and context data are now prefixed with extra_ and context_ to avoid clashes. Watch out if you have scripts reading those from the API and rely on names + * Added WhatFailureGroupHandler to suppress any exception coming from the wrapped handlers and avoid chain failures if a logging service fails + * Added MandrillHandler to send emails via the Mandrillapp.com API + * Added SlackHandler to log records to a Slack.com account + * Added FleepHookHandler to log records to a Fleep.io account + * Added LogglyHandler::addTag to allow adding tags to an existing handler + * Added $ignoreEmptyContextAndExtra to LineFormatter to avoid empty [] at the end + * Added $useLocking to StreamHandler and RotatingFileHandler to enable flock() while writing + * Added support for PhpAmqpLib in the AmqpHandler + * Added FingersCrossedHandler::clear and BufferHandler::clear to reset them between batches in long running jobs + * Added support for adding extra fields from $_SERVER in the WebProcessor + * Fixed support for non-string values in PrsLogMessageProcessor + * Fixed SwiftMailer messages being sent with the wrong date in long running scripts + * Fixed minor PHP 5.6 compatibility issues + * Fixed BufferHandler::close being called twice + +### 1.10.0 (2014-06-04) + + * Added Logger::getHandlers() and Logger::getProcessors() methods + * Added $passthruLevel argument to FingersCrossedHandler to let it always pass some records through even if the trigger level is not reached + * Added support for extra data in NewRelicHandler + * Added $expandNewlines flag to the ErrorLogHandler to create multiple log entries when a message has multiple lines + +### 1.9.1 (2014-04-24) + + * Fixed regression in RotatingFileHandler file permissions + * Fixed initialization of the BufferHandler to make sure it gets flushed after receiving records + * Fixed ChromePHPHandler and FirePHPHandler's activation strategies to be more conservative + +### 1.9.0 (2014-04-20) + + * Added LogEntriesHandler to send logs to a LogEntries account + * Added $filePermissions to tweak file mode on StreamHandler and RotatingFileHandler + * Added $useFormatting flag to MemoryProcessor to make it send raw data in bytes + * Added support for table formatting in FirePHPHandler via the table context key + * Added a TagProcessor to add tags to records, and support for tags in RavenHandler + * Added $appendNewline flag to the JsonFormatter to enable using it when logging to files + * Added sound support to the PushoverHandler + * Fixed multi-threading support in StreamHandler + * Fixed empty headers issue when ChromePHPHandler received no records + * Fixed default format of the ErrorLogHandler + +### 1.8.0 (2014-03-23) + + * Break: the LineFormatter now strips newlines by default because this was a bug, set $allowInlineLineBreaks to true if you need them + * Added BrowserConsoleHandler to send logs to any browser's console via console.log() injection in the output + * Added FilterHandler to filter records and only allow those of a given list of levels through to the wrapped handler + * Added FlowdockHandler to send logs to a Flowdock account + * Added RollbarHandler to send logs to a Rollbar account + * Added HtmlFormatter to send prettier log emails with colors for each log level + * Added GitProcessor to add the current branch/commit to extra record data + * Added a Monolog\Registry class to allow easier global access to pre-configured loggers + * Added support for the new official graylog2/gelf-php lib for GelfHandler, upgrade if you can by replacing the mlehner/gelf-php requirement + * Added support for HHVM + * Added support for Loggly batch uploads + * Added support for tweaking the content type and encoding in NativeMailerHandler + * Added $skipClassesPartials to tweak the ignored classes in the IntrospectionProcessor + * Fixed batch request support in GelfHandler + +### 1.7.0 (2013-11-14) + + * Added ElasticSearchHandler to send logs to an Elastic Search server + * Added DynamoDbHandler and ScalarFormatter to send logs to Amazon's Dynamo DB + * Added SyslogUdpHandler to send logs to a remote syslogd server + * Added LogglyHandler to send logs to a Loggly account + * Added $level to IntrospectionProcessor so it only adds backtraces when needed + * Added $version to LogstashFormatter to allow using the new v1 Logstash format + * Added $appName to NewRelicHandler + * Added configuration of Pushover notification retries/expiry + * Added $maxColumnWidth to NativeMailerHandler to change the 70 chars default + * Added chainability to most setters for all handlers + * Fixed RavenHandler batch processing so it takes the message from the record with highest priority + * Fixed HipChatHandler batch processing so it sends all messages at once + * Fixed issues with eAccelerator + * Fixed and improved many small things + +### 1.6.0 (2013-07-29) + + * Added HipChatHandler to send logs to a HipChat chat room + * Added ErrorLogHandler to send logs to PHP's error_log function + * Added NewRelicHandler to send logs to NewRelic's service + * Added Monolog\ErrorHandler helper class to register a Logger as exception/error/fatal handler + * Added ChannelLevelActivationStrategy for the FingersCrossedHandler to customize levels by channel + * Added stack traces output when normalizing exceptions (json output & co) + * Added Monolog\Logger::API constant (currently 1) + * Added support for ChromePHP's v4.0 extension + * Added support for message priorities in PushoverHandler, see $highPriorityLevel and $emergencyLevel + * Added support for sending messages to multiple users at once with the PushoverHandler + * Fixed RavenHandler's support for batch sending of messages (when behind a Buffer or FingersCrossedHandler) + * Fixed normalization of Traversables with very large data sets, only the first 1000 items are shown now + * Fixed issue in RotatingFileHandler when an open_basedir restriction is active + * Fixed minor issues in RavenHandler and bumped the API to Raven 0.5.0 + * Fixed SyslogHandler issue when many were used concurrently with different facilities + +### 1.5.0 (2013-04-23) + + * Added ProcessIdProcessor to inject the PID in log records + * Added UidProcessor to inject a unique identifier to all log records of one request/run + * Added support for previous exceptions in the LineFormatter exception serialization + * Added Monolog\Logger::getLevels() to get all available levels + * Fixed ChromePHPHandler so it avoids sending headers larger than Chrome can handle + +### 1.4.1 (2013-04-01) + + * Fixed exception formatting in the LineFormatter to be more minimalistic + * Fixed RavenHandler's handling of context/extra data, requires Raven client >0.1.0 + * Fixed log rotation in RotatingFileHandler to work with long running scripts spanning multiple days + * Fixed WebProcessor array access so it checks for data presence + * Fixed Buffer, Group and FingersCrossed handlers to make use of their processors + +### 1.4.0 (2013-02-13) + + * Added RedisHandler to log to Redis via the Predis library or the phpredis extension + * Added ZendMonitorHandler to log to the Zend Server monitor + * Added the possibility to pass arrays of handlers and processors directly in the Logger constructor + * Added `$useSSL` option to the PushoverHandler which is enabled by default + * Fixed ChromePHPHandler and FirePHPHandler issue when multiple instances are used simultaneously + * Fixed header injection capability in the NativeMailHandler + +### 1.3.1 (2013-01-11) + + * Fixed LogstashFormatter to be usable with stream handlers + * Fixed GelfMessageFormatter levels on Windows + +### 1.3.0 (2013-01-08) + + * Added PSR-3 compliance, the `Monolog\Logger` class is now an instance of `Psr\Log\LoggerInterface` + * Added PsrLogMessageProcessor that you can selectively enable for full PSR-3 compliance + * Added LogstashFormatter (combine with SocketHandler or StreamHandler to send logs to Logstash) + * Added PushoverHandler to send mobile notifications + * Added CouchDBHandler and DoctrineCouchDBHandler + * Added RavenHandler to send data to Sentry servers + * Added support for the new MongoClient class in MongoDBHandler + * Added microsecond precision to log records' timestamps + * Added `$flushOnOverflow` param to BufferHandler to flush by batches instead of losing + the oldest entries + * Fixed normalization of objects with cyclic references + +### 1.2.1 (2012-08-29) + + * Added new $logopts arg to SyslogHandler to provide custom openlog options + * Fixed fatal error in SyslogHandler + +### 1.2.0 (2012-08-18) + + * Added AmqpHandler (for use with AMQP servers) + * Added CubeHandler + * Added NativeMailerHandler::addHeader() to send custom headers in mails + * Added the possibility to specify more than one recipient in NativeMailerHandler + * Added the possibility to specify float timeouts in SocketHandler + * Added NOTICE and EMERGENCY levels to conform with RFC 5424 + * Fixed the log records to use the php default timezone instead of UTC + * Fixed BufferHandler not being flushed properly on PHP fatal errors + * Fixed normalization of exotic resource types + * Fixed the default format of the SyslogHandler to avoid duplicating datetimes in syslog + +### 1.1.0 (2012-04-23) + + * Added Monolog\Logger::isHandling() to check if a handler will + handle the given log level + * Added ChromePHPHandler + * Added MongoDBHandler + * Added GelfHandler (for use with Graylog2 servers) + * Added SocketHandler (for use with syslog-ng for example) + * Added NormalizerFormatter + * Added the possibility to change the activation strategy of the FingersCrossedHandler + * Added possibility to show microseconds in logs + * Added `server` and `referer` to WebProcessor output + +### 1.0.2 (2011-10-24) + + * Fixed bug in IE with large response headers and FirePHPHandler + +### 1.0.1 (2011-08-25) + + * Added MemoryPeakUsageProcessor and MemoryUsageProcessor + * Added Monolog\Logger::getName() to get a logger's channel name + +### 1.0.0 (2011-07-06) + + * Added IntrospectionProcessor to get info from where the logger was called + * Fixed WebProcessor in CLI + +### 1.0.0-RC1 (2011-07-01) + + * Initial release diff --git a/vendor/monolog/monolog/LICENSE b/vendor/monolog/monolog/LICENSE new file mode 100644 index 00000000..aa2a0426 --- /dev/null +++ b/vendor/monolog/monolog/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2011-2020 Jordi Boggiano + +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/vendor/monolog/monolog/README.md b/vendor/monolog/monolog/README.md new file mode 100644 index 00000000..bfcae0c0 --- /dev/null +++ b/vendor/monolog/monolog/README.md @@ -0,0 +1,112 @@ +# Monolog - Logging for PHP [![Continuous Integration](https://github.com/Seldaek/monolog/workflows/Continuous%20Integration/badge.svg?branch=main)](https://github.com/Seldaek/monolog/actions) + +[![Total Downloads](https://img.shields.io/packagist/dt/monolog/monolog.svg)](https://packagist.org/packages/monolog/monolog) +[![Latest Stable Version](https://img.shields.io/packagist/v/monolog/monolog.svg)](https://packagist.org/packages/monolog/monolog) + + +Monolog sends your logs to files, sockets, inboxes, databases and various +web services. See the complete list of handlers below. Special handlers +allow you to build advanced logging strategies. + +This library implements the [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) +interface that you can type-hint against in your own libraries to keep +a maximum of interoperability. You can also use it in your applications to +make sure you can always use another compatible logger at a later time. +As of 1.11.0 Monolog public APIs will also accept PSR-3 log levels. +Internally Monolog still uses its own level scheme since it predates PSR-3. + +## Installation + +Install the latest version with + +```bash +$ composer require monolog/monolog +``` + +## Basic Usage + +```php +<?php + +use Monolog\Logger; +use Monolog\Handler\StreamHandler; + +// create a log channel +$log = new Logger('name'); +$log->pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING)); + +// add records to the log +$log->warning('Foo'); +$log->error('Bar'); +``` + +## Documentation + +- [Usage Instructions](doc/01-usage.md) +- [Handlers, Formatters and Processors](doc/02-handlers-formatters-processors.md) +- [Utility Classes](doc/03-utilities.md) +- [Extending Monolog](doc/04-extending.md) +- [Log Record Structure](doc/message-structure.md) + +## Support Monolog Financially + +Get supported Monolog and help fund the project with the [Tidelift Subscription](https://tidelift.com/subscription/pkg/packagist-monolog-monolog?utm_source=packagist-monolog-monolog&utm_medium=referral&utm_campaign=enterprise) or via [GitHub sponsorship](https://github.com/sponsors/Seldaek). + +Tidelift delivers commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. + +## Third Party Packages + +Third party handlers, formatters and processors are +[listed in the wiki](https://github.com/Seldaek/monolog/wiki/Third-Party-Packages). You +can also add your own there if you publish one. + +## About + +### Requirements + +- Monolog `^2.0` works with PHP 7.2 or above, use Monolog `^1.25` for PHP 5.3+ support. + +### Support + +Monolog 1.x support is somewhat limited at this point and only important fixes will be done. You should migrate to Monolog 2 where possible to benefit from all the latest features and fixes. + +### Submitting bugs and feature requests + +Bugs and feature request are tracked on [GitHub](https://github.com/Seldaek/monolog/issues) + +### Framework Integrations + +- Frameworks and libraries using [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) + can be used very easily with Monolog since it implements the interface. +- [Symfony](http://symfony.com) comes out of the box with Monolog. +- [Laravel](http://laravel.com/) comes out of the box with Monolog. +- [Lumen](http://lumen.laravel.com/) comes out of the box with Monolog. +- [PPI](https://github.com/ppi/framework) comes out of the box with Monolog. +- [CakePHP](http://cakephp.org/) is usable with Monolog via the [cakephp-monolog](https://github.com/jadb/cakephp-monolog) plugin. +- [Slim](http://www.slimframework.com/) is usable with Monolog via the [Slim-Monolog](https://github.com/Flynsarmy/Slim-Monolog) log writer. +- [XOOPS 2.6](http://xoops.org/) comes out of the box with Monolog. +- [Aura.Web_Project](https://github.com/auraphp/Aura.Web_Project) comes out of the box with Monolog. +- [Nette Framework](http://nette.org/en/) is usable with Monolog via the [contributte/monolog](https://github.com/contributte/monolog) or [orisai/nette-monolog](https://github.com/orisai/nette-monolog) extensions. +- [Proton Micro Framework](https://github.com/alexbilbie/Proton) comes out of the box with Monolog. +- [FuelPHP](http://fuelphp.com/) comes out of the box with Monolog. +- [Equip Framework](https://github.com/equip/framework) comes out of the box with Monolog. +- [Yii 2](http://www.yiiframework.com/) is usable with Monolog via the [yii2-monolog](https://github.com/merorafael/yii2-monolog) or [yii2-psr-log-target](https://github.com/samdark/yii2-psr-log-target) plugins. +- [Hawkbit Micro Framework](https://github.com/HawkBitPhp/hawkbit) comes out of the box with Monolog. +- [SilverStripe 4](https://www.silverstripe.org/) comes out of the box with Monolog. +- [Drupal](https://www.drupal.org/) is usable with Monolog via the [monolog](https://www.drupal.org/project/monolog) module. +- [Aimeos ecommerce framework](https://aimeos.org/) is usable with Monolog via the [ai-monolog](https://github.com/aimeos/ai-monolog) extension. +- [Magento](https://magento.com/) comes out of the box with Monolog. + +### Author + +Jordi Boggiano - <j.boggiano@seld.be> - <http://twitter.com/seldaek><br /> +See also the list of [contributors](https://github.com/Seldaek/monolog/contributors) who participated in this project. + +### License + +Monolog is licensed under the MIT License - see the [LICENSE](LICENSE) file for details + +### Acknowledgements + +This library is heavily inspired by Python's [Logbook](https://logbook.readthedocs.io/en/stable/) +library, although most concepts have been adjusted to fit to the PHP world. diff --git a/vendor/monolog/monolog/UPGRADE.md b/vendor/monolog/monolog/UPGRADE.md new file mode 100644 index 00000000..84e15e6b --- /dev/null +++ b/vendor/monolog/monolog/UPGRADE.md @@ -0,0 +1,72 @@ +### 2.0.0 + +- `Monolog\Logger::API` can be used to distinguish between a Monolog `1` and `2` + install of Monolog when writing integration code. + +- Removed non-PSR-3 methods to add records, all the `add*` (e.g. `addWarning`) + methods as well as `emerg`, `crit`, `err` and `warn`. + +- DateTime are now formatted with a timezone and microseconds (unless disabled). + Various formatters and log output might be affected, which may mess with log parsing + in some cases. + +- The `datetime` in every record array is now a DateTimeImmutable, not that you + should have been modifying these anyway. + +- The timezone is now set per Logger instance and not statically, either + via ->setTimezone or passed in the constructor. Calls to Logger::setTimezone + should be converted. + +- `HandlerInterface` has been split off and two new interfaces now exist for + more granular controls: `ProcessableHandlerInterface` and + `FormattableHandlerInterface`. Handlers not extending `AbstractHandler` + should make sure to implement the relevant interfaces. + +- `HandlerInterface` now requires the `close` method to be implemented. This + only impacts you if you implement the interface yourself, but you can extend + the new `Monolog\Handler\Handler` base class too. + +- There is no more default handler configured on empty Logger instances, if + you were relying on that you will not get any output anymore, make sure to + configure the handler you need. + +#### LogglyFormatter + +- The records' `datetime` is not sent anymore. Only `timestamp` is sent to Loggly. + +#### AmqpHandler + +- Log levels are not shortened to 4 characters anymore. e.g. a warning record + will be sent using the `warning.channel` routing key instead of `warn.channel` + as in 1.x. +- The exchange name does not default to 'log' anymore, and it is completely ignored + now for the AMQP extension users. Only PHPAmqpLib uses it if provided. + +#### RotatingFileHandler + +- The file name format must now contain `{date}` and the date format must be set + to one of the predefined FILE_PER_* constants to avoid issues with file rotation. + See `setFilenameFormat`. + +#### LogstashFormatter + +- Removed Logstash V0 support +- Context/extra prefix has been removed in favor of letting users configure the exact key being sent +- Context/extra data are now sent as an object instead of single keys + +#### HipChatHandler + +- Removed deprecated HipChat handler, migrate to Slack and use SlackWebhookHandler or SlackHandler instead + +#### SlackbotHandler + +- Removed deprecated SlackbotHandler handler, use SlackWebhookHandler or SlackHandler instead + +#### RavenHandler + +- Removed deprecated RavenHandler handler, use sentry/sentry 2.x and their Sentry\Monolog\Handler instead + +#### ElasticSearchHandler + +- As support for the official Elasticsearch library was added, the former ElasticSearchHandler has been + renamed to ElasticaHandler and the new one added as ElasticsearchHandler. diff --git a/vendor/monolog/monolog/composer.json b/vendor/monolog/monolog/composer.json new file mode 100644 index 00000000..a1f08a22 --- /dev/null +++ b/vendor/monolog/monolog/composer.json @@ -0,0 +1,81 @@ +{ + "name": "monolog/monolog", + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "keywords": ["log", "logging", "psr-3"], + "homepage": "https://github.com/Seldaek/monolog", + "type": "library", + "license": "MIT", + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "https://seld.be" + } + ], + "require": { + "php": ">=7.2", + "psr/log": "^1.0.1 || ^2.0 || ^3.0" + }, + "require-dev": { + "ext-json": "*", + "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "doctrine/couchdb": "~1.0@dev", + "elasticsearch/elasticsearch": "^7 || ^8", + "graylog2/gelf-php": "^1.4.2 || ^2@dev", + "guzzlehttp/guzzle": "^7.4", + "guzzlehttp/psr7": "^2.2", + "mongodb/mongodb": "^1.8", + "php-amqplib/php-amqplib": "~2.4 || ^3", + "phpspec/prophecy": "^1.15", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^8.5.38 || ^9.6.19", + "predis/predis": "^1.1 || ^2.0", + "rollbar/rollbar": "^1.3 || ^2 || ^3", + "ruflin/elastica": "^7", + "swiftmailer/swiftmailer": "^5.3|^6.0", + "symfony/mailer": "^5.4 || ^6", + "symfony/mime": "^5.4 || ^6" + }, + "suggest": { + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ext-mbstring": "Allow to work properly with unicode symbols", + "ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)", + "ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler", + "ext-openssl": "Required to send log messages using SSL" + }, + "autoload": { + "psr-4": {"Monolog\\": "src/Monolog"} + }, + "autoload-dev": { + "psr-4": {"Monolog\\": "tests/Monolog"} + }, + "provide": { + "psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0" + }, + "extra": { + "branch-alias": { + "dev-main": "2.x-dev" + } + }, + "scripts": { + "test": "@php vendor/bin/phpunit", + "phpstan": "@php vendor/bin/phpstan analyse" + }, + "config": { + "lock": false, + "sort-packages": true, + "platform-check": false, + "allow-plugins": { + "composer/package-versions-deprecated": true + } + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Attribute/AsMonologProcessor.php b/vendor/monolog/monolog/src/Monolog/Attribute/AsMonologProcessor.php new file mode 100644 index 00000000..188bbb0d --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Attribute/AsMonologProcessor.php @@ -0,0 +1,46 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Attribute; + +/** + * A reusable attribute to help configure a class or a method as a processor. + * + * Using it offers no guarantee: it needs to be leveraged by a Monolog third-party consumer. + * + * Using it with the Monolog library only has no effect at all: processors should still be turned into a callable if + * needed and manually pushed to the loggers and to the processable handlers. + */ +#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class AsMonologProcessor +{ + /** @var string|null */ + public $channel = null; + /** @var string|null */ + public $handler = null; + /** @var string|null */ + public $method = null; + + /** + * @param string|null $channel The logging channel the processor should be pushed to. + * @param string|null $handler The handler the processor should be pushed to. + * @param string|null $method The method that processes the records (if the attribute is used at the class level). + */ + public function __construct( + ?string $channel = null, + ?string $handler = null, + ?string $method = null + ) { + $this->channel = $channel; + $this->handler = $handler; + $this->method = $method; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/DateTimeImmutable.php b/vendor/monolog/monolog/src/Monolog/DateTimeImmutable.php new file mode 100644 index 00000000..789f9bfc --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/DateTimeImmutable.php @@ -0,0 +1,51 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog; + +use DateTimeZone; + +/** + * Overrides default json encoding of date time objects + * + * @author Menno Holtkamp + * @author Jordi Boggiano <j.boggiano@seld.be> + */ +class DateTimeImmutable extends \DateTimeImmutable implements \JsonSerializable +{ + /** + * @var bool + */ + private $useMicroseconds; + + public function __construct(bool $useMicroseconds, ?DateTimeZone $timezone = null) + { + $this->useMicroseconds = $useMicroseconds; + + // if you like to use a custom time to pass to Logger::addRecord directly, + // call modify() or setTimestamp() on this instance to change the date after creating it + parent::__construct('now', $timezone); + } + + public function jsonSerialize(): string + { + if ($this->useMicroseconds) { + return $this->format('Y-m-d\TH:i:s.uP'); + } + + return $this->format('Y-m-d\TH:i:sP'); + } + + public function __toString(): string + { + return $this->jsonSerialize(); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/ErrorHandler.php b/vendor/monolog/monolog/src/Monolog/ErrorHandler.php new file mode 100644 index 00000000..1406d34e --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/ErrorHandler.php @@ -0,0 +1,307 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog; + +use Psr\Log\LoggerInterface; +use Psr\Log\LogLevel; + +/** + * Monolog error handler + * + * A facility to enable logging of runtime errors, exceptions and fatal errors. + * + * Quick setup: <code>ErrorHandler::register($logger);</code> + * + * @author Jordi Boggiano <j.boggiano@seld.be> + */ +class ErrorHandler +{ + /** @var LoggerInterface */ + private $logger; + + /** @var ?callable */ + private $previousExceptionHandler = null; + /** @var array<class-string, LogLevel::*> an array of class name to LogLevel::* constant mapping */ + private $uncaughtExceptionLevelMap = []; + + /** @var callable|true|null */ + private $previousErrorHandler = null; + /** @var array<int, LogLevel::*> an array of E_* constant to LogLevel::* constant mapping */ + private $errorLevelMap = []; + /** @var bool */ + private $handleOnlyReportedErrors = true; + + /** @var bool */ + private $hasFatalErrorHandler = false; + /** @var LogLevel::* */ + private $fatalLevel = LogLevel::ALERT; + /** @var ?string */ + private $reservedMemory = null; + /** @var ?array{type: int, message: string, file: string, line: int, trace: mixed} */ + private $lastFatalData = null; + /** @var int[] */ + private static $fatalErrors = [E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR]; + + public function __construct(LoggerInterface $logger) + { + $this->logger = $logger; + } + + /** + * Registers a new ErrorHandler for a given Logger + * + * By default it will handle errors, exceptions and fatal errors + * + * @param LoggerInterface $logger + * @param array<int, LogLevel::*>|false $errorLevelMap an array of E_* constant to LogLevel::* constant mapping, or false to disable error handling + * @param array<class-string, LogLevel::*>|false $exceptionLevelMap an array of class name to LogLevel::* constant mapping, or false to disable exception handling + * @param LogLevel::*|null|false $fatalLevel a LogLevel::* constant, null to use the default LogLevel::ALERT or false to disable fatal error handling + * @return ErrorHandler + */ + public static function register(LoggerInterface $logger, $errorLevelMap = [], $exceptionLevelMap = [], $fatalLevel = null): self + { + /** @phpstan-ignore-next-line */ + $handler = new static($logger); + if ($errorLevelMap !== false) { + $handler->registerErrorHandler($errorLevelMap); + } + if ($exceptionLevelMap !== false) { + $handler->registerExceptionHandler($exceptionLevelMap); + } + if ($fatalLevel !== false) { + $handler->registerFatalHandler($fatalLevel); + } + + return $handler; + } + + /** + * @param array<class-string, LogLevel::*> $levelMap an array of class name to LogLevel::* constant mapping + * @return $this + */ + public function registerExceptionHandler(array $levelMap = [], bool $callPrevious = true): self + { + $prev = set_exception_handler(function (\Throwable $e): void { + $this->handleException($e); + }); + $this->uncaughtExceptionLevelMap = $levelMap; + foreach ($this->defaultExceptionLevelMap() as $class => $level) { + if (!isset($this->uncaughtExceptionLevelMap[$class])) { + $this->uncaughtExceptionLevelMap[$class] = $level; + } + } + if ($callPrevious && $prev) { + $this->previousExceptionHandler = $prev; + } + + return $this; + } + + /** + * @param array<int, LogLevel::*> $levelMap an array of E_* constant to LogLevel::* constant mapping + * @return $this + */ + public function registerErrorHandler(array $levelMap = [], bool $callPrevious = true, int $errorTypes = -1, bool $handleOnlyReportedErrors = true): self + { + $prev = set_error_handler([$this, 'handleError'], $errorTypes); + $this->errorLevelMap = array_replace($this->defaultErrorLevelMap(), $levelMap); + if ($callPrevious) { + $this->previousErrorHandler = $prev ?: true; + } else { + $this->previousErrorHandler = null; + } + + $this->handleOnlyReportedErrors = $handleOnlyReportedErrors; + + return $this; + } + + /** + * @param LogLevel::*|null $level a LogLevel::* constant, null to use the default LogLevel::ALERT + * @param int $reservedMemorySize Amount of KBs to reserve in memory so that it can be freed when handling fatal errors giving Monolog some room in memory to get its job done + */ + public function registerFatalHandler($level = null, int $reservedMemorySize = 20): self + { + register_shutdown_function([$this, 'handleFatalError']); + + $this->reservedMemory = str_repeat(' ', 1024 * $reservedMemorySize); + $this->fatalLevel = null === $level ? LogLevel::ALERT : $level; + $this->hasFatalErrorHandler = true; + + return $this; + } + + /** + * @return array<class-string, LogLevel::*> + */ + protected function defaultExceptionLevelMap(): array + { + return [ + 'ParseError' => LogLevel::CRITICAL, + 'Throwable' => LogLevel::ERROR, + ]; + } + + /** + * @return array<int, LogLevel::*> + */ + protected function defaultErrorLevelMap(): array + { + return [ + E_ERROR => LogLevel::CRITICAL, + E_WARNING => LogLevel::WARNING, + E_PARSE => LogLevel::ALERT, + E_NOTICE => LogLevel::NOTICE, + E_CORE_ERROR => LogLevel::CRITICAL, + E_CORE_WARNING => LogLevel::WARNING, + E_COMPILE_ERROR => LogLevel::ALERT, + E_COMPILE_WARNING => LogLevel::WARNING, + E_USER_ERROR => LogLevel::ERROR, + E_USER_WARNING => LogLevel::WARNING, + E_USER_NOTICE => LogLevel::NOTICE, + E_STRICT => LogLevel::NOTICE, + E_RECOVERABLE_ERROR => LogLevel::ERROR, + E_DEPRECATED => LogLevel::NOTICE, + E_USER_DEPRECATED => LogLevel::NOTICE, + ]; + } + + /** + * @phpstan-return never + */ + private function handleException(\Throwable $e): void + { + $level = LogLevel::ERROR; + foreach ($this->uncaughtExceptionLevelMap as $class => $candidate) { + if ($e instanceof $class) { + $level = $candidate; + break; + } + } + + $this->logger->log( + $level, + sprintf('Uncaught Exception %s: "%s" at %s line %s', Utils::getClass($e), $e->getMessage(), $e->getFile(), $e->getLine()), + ['exception' => $e] + ); + + if ($this->previousExceptionHandler) { + ($this->previousExceptionHandler)($e); + } + + if (!headers_sent() && in_array(strtolower((string) ini_get('display_errors')), ['0', '', 'false', 'off', 'none', 'no'], true)) { + http_response_code(500); + } + + exit(255); + } + + /** + * @private + * + * @param mixed[] $context + */ + public function handleError(int $code, string $message, string $file = '', int $line = 0, ?array $context = []): bool + { + if ($this->handleOnlyReportedErrors && !(error_reporting() & $code)) { + return false; + } + + // fatal error codes are ignored if a fatal error handler is present as well to avoid duplicate log entries + if (!$this->hasFatalErrorHandler || !in_array($code, self::$fatalErrors, true)) { + $level = $this->errorLevelMap[$code] ?? LogLevel::CRITICAL; + $this->logger->log($level, self::codeToString($code).': '.$message, ['code' => $code, 'message' => $message, 'file' => $file, 'line' => $line]); + } else { + $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); + array_shift($trace); // Exclude handleError from trace + $this->lastFatalData = ['type' => $code, 'message' => $message, 'file' => $file, 'line' => $line, 'trace' => $trace]; + } + + if ($this->previousErrorHandler === true) { + return false; + } elseif ($this->previousErrorHandler) { + return (bool) ($this->previousErrorHandler)($code, $message, $file, $line, $context); + } + + return true; + } + + /** + * @private + */ + public function handleFatalError(): void + { + $this->reservedMemory = ''; + + if (is_array($this->lastFatalData)) { + $lastError = $this->lastFatalData; + } else { + $lastError = error_get_last(); + } + + if ($lastError && in_array($lastError['type'], self::$fatalErrors, true)) { + $trace = $lastError['trace'] ?? null; + $this->logger->log( + $this->fatalLevel, + 'Fatal Error ('.self::codeToString($lastError['type']).'): '.$lastError['message'], + ['code' => $lastError['type'], 'message' => $lastError['message'], 'file' => $lastError['file'], 'line' => $lastError['line'], 'trace' => $trace] + ); + + if ($this->logger instanceof Logger) { + foreach ($this->logger->getHandlers() as $handler) { + $handler->close(); + } + } + } + } + + /** + * @param int $code + */ + private static function codeToString($code): string + { + switch ($code) { + case E_ERROR: + return 'E_ERROR'; + case E_WARNING: + return 'E_WARNING'; + case E_PARSE: + return 'E_PARSE'; + case E_NOTICE: + return 'E_NOTICE'; + case E_CORE_ERROR: + return 'E_CORE_ERROR'; + case E_CORE_WARNING: + return 'E_CORE_WARNING'; + case E_COMPILE_ERROR: + return 'E_COMPILE_ERROR'; + case E_COMPILE_WARNING: + return 'E_COMPILE_WARNING'; + case E_USER_ERROR: + return 'E_USER_ERROR'; + case E_USER_WARNING: + return 'E_USER_WARNING'; + case E_USER_NOTICE: + return 'E_USER_NOTICE'; + case E_STRICT: + return 'E_STRICT'; + case E_RECOVERABLE_ERROR: + return 'E_RECOVERABLE_ERROR'; + case E_DEPRECATED: + return 'E_DEPRECATED'; + case E_USER_DEPRECATED: + return 'E_USER_DEPRECATED'; + } + + return 'Unknown PHP error'; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php new file mode 100644 index 00000000..aa1884b9 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php @@ -0,0 +1,83 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Monolog\Logger; + +/** + * Formats a log message according to the ChromePHP array format + * + * @author Christophe Coevoet <stof@notk.org> + */ +class ChromePHPFormatter implements FormatterInterface +{ + /** + * Translates Monolog log levels to Wildfire levels. + * + * @var array<int, 'log'|'info'|'warn'|'error'> + */ + private $logLevels = [ + Logger::DEBUG => 'log', + Logger::INFO => 'info', + Logger::NOTICE => 'info', + Logger::WARNING => 'warn', + Logger::ERROR => 'error', + Logger::CRITICAL => 'error', + Logger::ALERT => 'error', + Logger::EMERGENCY => 'error', + ]; + + /** + * {@inheritDoc} + */ + public function format(array $record) + { + // Retrieve the line and file if set and remove them from the formatted extra + $backtrace = 'unknown'; + if (isset($record['extra']['file'], $record['extra']['line'])) { + $backtrace = $record['extra']['file'].' : '.$record['extra']['line']; + unset($record['extra']['file'], $record['extra']['line']); + } + + $message = ['message' => $record['message']]; + if ($record['context']) { + $message['context'] = $record['context']; + } + if ($record['extra']) { + $message['extra'] = $record['extra']; + } + if (count($message) === 1) { + $message = reset($message); + } + + return [ + $record['channel'], + $message, + $backtrace, + $this->logLevels[$record['level']], + ]; + } + + /** + * {@inheritDoc} + */ + public function formatBatch(array $records) + { + $formatted = []; + + foreach ($records as $record) { + $formatted[] = $this->format($record); + } + + return $formatted; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php new file mode 100644 index 00000000..6c8a9ab5 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php @@ -0,0 +1,89 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Elastica\Document; + +/** + * Format a log message into an Elastica Document + * + * @author Jelle Vink <jelle.vink@gmail.com> + * + * @phpstan-import-type Record from \Monolog\Logger + */ +class ElasticaFormatter extends NormalizerFormatter +{ + /** + * @var string Elastic search index name + */ + protected $index; + + /** + * @var ?string Elastic search document type + */ + protected $type; + + /** + * @param string $index Elastic Search index name + * @param ?string $type Elastic Search document type, deprecated as of Elastica 7 + */ + public function __construct(string $index, ?string $type) + { + // elasticsearch requires a ISO 8601 format date with optional millisecond precision. + parent::__construct('Y-m-d\TH:i:s.uP'); + + $this->index = $index; + $this->type = $type; + } + + /** + * {@inheritDoc} + */ + public function format(array $record) + { + $record = parent::format($record); + + return $this->getDocument($record); + } + + public function getIndex(): string + { + return $this->index; + } + + /** + * @deprecated since Elastica 7 type has no effect + */ + public function getType(): string + { + /** @phpstan-ignore-next-line */ + return $this->type; + } + + /** + * Convert a log message into an Elastica Document + * + * @phpstan-param Record $record + */ + protected function getDocument(array $record): Document + { + $document = new Document(); + $document->setData($record); + if (method_exists($document, 'setType')) { + /** @phpstan-ignore-next-line */ + $document->setType($this->type); + } + $document->setIndex($this->index); + + return $document; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/ElasticsearchFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/ElasticsearchFormatter.php new file mode 100644 index 00000000..b792b819 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/ElasticsearchFormatter.php @@ -0,0 +1,89 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use DateTimeInterface; + +/** + * Format a log message into an Elasticsearch record + * + * @author Avtandil Kikabidze <akalongman@gmail.com> + */ +class ElasticsearchFormatter extends NormalizerFormatter +{ + /** + * @var string Elasticsearch index name + */ + protected $index; + + /** + * @var string Elasticsearch record type + */ + protected $type; + + /** + * @param string $index Elasticsearch index name + * @param string $type Elasticsearch record type + */ + public function __construct(string $index, string $type) + { + // Elasticsearch requires an ISO 8601 format date with optional millisecond precision. + parent::__construct(DateTimeInterface::ISO8601); + + $this->index = $index; + $this->type = $type; + } + + /** + * {@inheritDoc} + */ + public function format(array $record) + { + $record = parent::format($record); + + return $this->getDocument($record); + } + + /** + * Getter index + * + * @return string + */ + public function getIndex(): string + { + return $this->index; + } + + /** + * Getter type + * + * @return string + */ + public function getType(): string + { + return $this->type; + } + + /** + * Convert a log message into an Elasticsearch record + * + * @param mixed[] $record Log message + * @return mixed[] + */ + protected function getDocument(array $record): array + { + $record['_index'] = $this->index; + $record['_type'] = $this->type; + + return $record; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php new file mode 100644 index 00000000..867ae586 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php @@ -0,0 +1,112 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +/** + * formats the record to be used in the FlowdockHandler + * + * @author Dominik Liebler <liebler.dominik@gmail.com> + * @deprecated Since 2.9.0 and 3.3.0, Flowdock was shutdown we will thus drop this handler in Monolog 4 + */ +class FlowdockFormatter implements FormatterInterface +{ + /** + * @var string + */ + private $source; + + /** + * @var string + */ + private $sourceEmail; + + public function __construct(string $source, string $sourceEmail) + { + $this->source = $source; + $this->sourceEmail = $sourceEmail; + } + + /** + * {@inheritDoc} + * + * @return mixed[] + */ + public function format(array $record): array + { + $tags = [ + '#logs', + '#' . strtolower($record['level_name']), + '#' . $record['channel'], + ]; + + foreach ($record['extra'] as $value) { + $tags[] = '#' . $value; + } + + $subject = sprintf( + 'in %s: %s - %s', + $this->source, + $record['level_name'], + $this->getShortMessage($record['message']) + ); + + $record['flowdock'] = [ + 'source' => $this->source, + 'from_address' => $this->sourceEmail, + 'subject' => $subject, + 'content' => $record['message'], + 'tags' => $tags, + 'project' => $this->source, + ]; + + return $record; + } + + /** + * {@inheritDoc} + * + * @return mixed[][] + */ + public function formatBatch(array $records): array + { + $formatted = []; + + foreach ($records as $record) { + $formatted[] = $this->format($record); + } + + return $formatted; + } + + public function getShortMessage(string $message): string + { + static $hasMbString; + + if (null === $hasMbString) { + $hasMbString = function_exists('mb_strlen'); + } + + $maxLength = 45; + + if ($hasMbString) { + if (mb_strlen($message, 'UTF-8') > $maxLength) { + $message = mb_substr($message, 0, $maxLength - 4, 'UTF-8') . ' ...'; + } + } else { + if (strlen($message) > $maxLength) { + $message = substr($message, 0, $maxLength - 4) . ' ...'; + } + } + + return $message; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php new file mode 100644 index 00000000..29b14d30 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php @@ -0,0 +1,88 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Monolog\Utils; + +/** + * Class FluentdFormatter + * + * Serializes a log message to Fluentd unix socket protocol + * + * Fluentd config: + * + * <source> + * type unix + * path /var/run/td-agent/td-agent.sock + * </source> + * + * Monolog setup: + * + * $logger = new Monolog\Logger('fluent.tag'); + * $fluentHandler = new Monolog\Handler\SocketHandler('unix:///var/run/td-agent/td-agent.sock'); + * $fluentHandler->setFormatter(new Monolog\Formatter\FluentdFormatter()); + * $logger->pushHandler($fluentHandler); + * + * @author Andrius Putna <fordnox@gmail.com> + */ +class FluentdFormatter implements FormatterInterface +{ + /** + * @var bool $levelTag should message level be a part of the fluentd tag + */ + protected $levelTag = false; + + public function __construct(bool $levelTag = false) + { + if (!function_exists('json_encode')) { + throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s FluentdUnixFormatter'); + } + + $this->levelTag = $levelTag; + } + + public function isUsingLevelsInTag(): bool + { + return $this->levelTag; + } + + public function format(array $record): string + { + $tag = $record['channel']; + if ($this->levelTag) { + $tag .= '.' . strtolower($record['level_name']); + } + + $message = [ + 'message' => $record['message'], + 'context' => $record['context'], + 'extra' => $record['extra'], + ]; + + if (!$this->levelTag) { + $message['level'] = $record['level']; + $message['level_name'] = $record['level_name']; + } + + return Utils::jsonEncode([$tag, $record['datetime']->getTimestamp(), $message]); + } + + public function formatBatch(array $records): string + { + $message = ''; + foreach ($records as $record) { + $message .= $this->format($record); + } + + return $message; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php b/vendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php new file mode 100644 index 00000000..19617ec5 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php @@ -0,0 +1,42 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +/** + * Interface for formatters + * + * @author Jordi Boggiano <j.boggiano@seld.be> + * + * @phpstan-import-type Record from \Monolog\Logger + */ +interface FormatterInterface +{ + /** + * Formats a log record. + * + * @param array $record A record to format + * @return mixed The formatted record + * + * @phpstan-param Record $record + */ + public function format(array $record); + + /** + * Formats a set of log records. + * + * @param array $records A set of records to format + * @return mixed The formatted set of records + * + * @phpstan-param Record[] $records + */ + public function formatBatch(array $records); +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php new file mode 100644 index 00000000..3b3e1e7f --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php @@ -0,0 +1,175 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Monolog\Logger; +use Gelf\Message; +use Monolog\Utils; + +/** + * Serializes a log message to GELF + * @see http://docs.graylog.org/en/latest/pages/gelf.html + * + * @author Matt Lehner <mlehner@gmail.com> + * + * @phpstan-import-type Level from \Monolog\Logger + */ +class GelfMessageFormatter extends NormalizerFormatter +{ + protected const DEFAULT_MAX_LENGTH = 32766; + + /** + * @var string the name of the system for the Gelf log message + */ + protected $systemName; + + /** + * @var string a prefix for 'extra' fields from the Monolog record (optional) + */ + protected $extraPrefix; + + /** + * @var string a prefix for 'context' fields from the Monolog record (optional) + */ + protected $contextPrefix; + + /** + * @var int max length per field + */ + protected $maxLength; + + /** + * @var int + */ + private $gelfVersion = 2; + + /** + * Translates Monolog log levels to Graylog2 log priorities. + * + * @var array<int, int> + * + * @phpstan-var array<Level, int> + */ + private $logLevels = [ + Logger::DEBUG => 7, + Logger::INFO => 6, + Logger::NOTICE => 5, + Logger::WARNING => 4, + Logger::ERROR => 3, + Logger::CRITICAL => 2, + Logger::ALERT => 1, + Logger::EMERGENCY => 0, + ]; + + public function __construct(?string $systemName = null, ?string $extraPrefix = null, string $contextPrefix = 'ctxt_', ?int $maxLength = null) + { + if (!class_exists(Message::class)) { + throw new \RuntimeException('Composer package graylog2/gelf-php is required to use Monolog\'s GelfMessageFormatter'); + } + + parent::__construct('U.u'); + + $this->systemName = (is_null($systemName) || $systemName === '') ? (string) gethostname() : $systemName; + + $this->extraPrefix = is_null($extraPrefix) ? '' : $extraPrefix; + $this->contextPrefix = $contextPrefix; + $this->maxLength = is_null($maxLength) ? self::DEFAULT_MAX_LENGTH : $maxLength; + + if (method_exists(Message::class, 'setFacility')) { + $this->gelfVersion = 1; + } + } + + /** + * {@inheritDoc} + */ + public function format(array $record): Message + { + $context = $extra = []; + if (isset($record['context'])) { + /** @var mixed[] $context */ + $context = parent::normalize($record['context']); + } + if (isset($record['extra'])) { + /** @var mixed[] $extra */ + $extra = parent::normalize($record['extra']); + } + + if (!isset($record['datetime'], $record['message'], $record['level'])) { + throw new \InvalidArgumentException('The record should at least contain datetime, message and level keys, '.var_export($record, true).' given'); + } + + $message = new Message(); + $message + ->setTimestamp($record['datetime']) + ->setShortMessage((string) $record['message']) + ->setHost($this->systemName) + ->setLevel($this->logLevels[$record['level']]); + + // message length + system name length + 200 for padding / metadata + $len = 200 + strlen((string) $record['message']) + strlen($this->systemName); + + if ($len > $this->maxLength) { + $message->setShortMessage(Utils::substr($record['message'], 0, $this->maxLength)); + } + + if ($this->gelfVersion === 1) { + if (isset($record['channel'])) { + $message->setFacility($record['channel']); + } + if (isset($extra['line'])) { + $message->setLine($extra['line']); + unset($extra['line']); + } + if (isset($extra['file'])) { + $message->setFile($extra['file']); + unset($extra['file']); + } + } else { + $message->setAdditional('facility', $record['channel']); + } + + foreach ($extra as $key => $val) { + $val = is_scalar($val) || null === $val ? $val : $this->toJson($val); + $len = strlen($this->extraPrefix . $key . $val); + if ($len > $this->maxLength) { + $message->setAdditional($this->extraPrefix . $key, Utils::substr((string) $val, 0, $this->maxLength)); + + continue; + } + $message->setAdditional($this->extraPrefix . $key, $val); + } + + foreach ($context as $key => $val) { + $val = is_scalar($val) || null === $val ? $val : $this->toJson($val); + $len = strlen($this->contextPrefix . $key . $val); + if ($len > $this->maxLength) { + $message->setAdditional($this->contextPrefix . $key, Utils::substr((string) $val, 0, $this->maxLength)); + + continue; + } + $message->setAdditional($this->contextPrefix . $key, $val); + } + + if ($this->gelfVersion === 1) { + /** @phpstan-ignore-next-line */ + if (null === $message->getFile() && isset($context['exception']['file'])) { + if (preg_match("/^(.+):([0-9]+)$/", $context['exception']['file'], $matches)) { + $message->setFile($matches[1]); + $message->setLine($matches[2]); + } + } + } + + return $message; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/GoogleCloudLoggingFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/GoogleCloudLoggingFormatter.php new file mode 100644 index 00000000..ca52ebf4 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/GoogleCloudLoggingFormatter.php @@ -0,0 +1,40 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use DateTimeInterface; +use Monolog\LogRecord; + +/** + * Encodes message information into JSON in a format compatible with Cloud logging. + * + * @see https://cloud.google.com/logging/docs/structured-logging + * @see https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry + * + * @author Luís Cobucci <lcobucci@gmail.com> + */ +final class GoogleCloudLoggingFormatter extends JsonFormatter +{ + /** {@inheritdoc} **/ + public function format(array $record): string + { + // Re-key level for GCP logging + $record['severity'] = $record['level_name']; + $record['time'] = $record['datetime']->format(DateTimeInterface::RFC3339_EXTENDED); + + // Remove keys that are not used by GCP + unset($record['level'], $record['level_name'], $record['datetime']); + + return parent::format($record); + } +} + diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php new file mode 100644 index 00000000..10a4311c --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php @@ -0,0 +1,142 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Monolog\Logger; +use Monolog\Utils; + +/** + * Formats incoming records into an HTML table + * + * This is especially useful for html email logging + * + * @author Tiago Brito <tlfbrito@gmail.com> + */ +class HtmlFormatter extends NormalizerFormatter +{ + /** + * Translates Monolog log levels to html color priorities. + * + * @var array<int, string> + */ + protected $logLevels = [ + Logger::DEBUG => '#CCCCCC', + Logger::INFO => '#28A745', + Logger::NOTICE => '#17A2B8', + Logger::WARNING => '#FFC107', + Logger::ERROR => '#FD7E14', + Logger::CRITICAL => '#DC3545', + Logger::ALERT => '#821722', + Logger::EMERGENCY => '#000000', + ]; + + /** + * @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format + */ + public function __construct(?string $dateFormat = null) + { + parent::__construct($dateFormat); + } + + /** + * Creates an HTML table row + * + * @param string $th Row header content + * @param string $td Row standard cell content + * @param bool $escapeTd false if td content must not be html escaped + */ + protected function addRow(string $th, string $td = ' ', bool $escapeTd = true): string + { + $th = htmlspecialchars($th, ENT_NOQUOTES, 'UTF-8'); + if ($escapeTd) { + $td = '<pre>'.htmlspecialchars($td, ENT_NOQUOTES, 'UTF-8').'</pre>'; + } + + return "<tr style=\"padding: 4px;text-align: left;\">\n<th style=\"vertical-align: top;background: #ccc;color: #000\" width=\"100\">$th:</th>\n<td style=\"padding: 4px;text-align: left;vertical-align: top;background: #eee;color: #000\">".$td."</td>\n</tr>"; + } + + /** + * Create a HTML h1 tag + * + * @param string $title Text to be in the h1 + * @param int $level Error level + * @return string + */ + protected function addTitle(string $title, int $level): string + { + $title = htmlspecialchars($title, ENT_NOQUOTES, 'UTF-8'); + + return '<h1 style="background: '.$this->logLevels[$level].';color: #ffffff;padding: 5px;" class="monolog-output">'.$title.'</h1>'; + } + + /** + * Formats a log record. + * + * @return string The formatted record + */ + public function format(array $record): string + { + $output = $this->addTitle($record['level_name'], $record['level']); + $output .= '<table cellspacing="1" width="100%" class="monolog-output">'; + + $output .= $this->addRow('Message', (string) $record['message']); + $output .= $this->addRow('Time', $this->formatDate($record['datetime'])); + $output .= $this->addRow('Channel', $record['channel']); + if ($record['context']) { + $embeddedTable = '<table cellspacing="1" width="100%">'; + foreach ($record['context'] as $key => $value) { + $embeddedTable .= $this->addRow((string) $key, $this->convertToString($value)); + } + $embeddedTable .= '</table>'; + $output .= $this->addRow('Context', $embeddedTable, false); + } + if ($record['extra']) { + $embeddedTable = '<table cellspacing="1" width="100%">'; + foreach ($record['extra'] as $key => $value) { + $embeddedTable .= $this->addRow((string) $key, $this->convertToString($value)); + } + $embeddedTable .= '</table>'; + $output .= $this->addRow('Extra', $embeddedTable, false); + } + + return $output.'</table>'; + } + + /** + * Formats a set of log records. + * + * @return string The formatted set of records + */ + public function formatBatch(array $records): string + { + $message = ''; + foreach ($records as $record) { + $message .= $this->format($record); + } + + return $message; + } + + /** + * @param mixed $data + */ + protected function convertToString($data): string + { + if (null === $data || is_scalar($data)) { + return (string) $data; + } + + $data = $this->normalize($data); + + return Utils::jsonEncode($data, JSON_PRETTY_PRINT | Utils::DEFAULT_JSON_FLAGS, true); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php new file mode 100644 index 00000000..b737d82e --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php @@ -0,0 +1,224 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Throwable; + +/** + * Encodes whatever record data is passed to it as json + * + * This can be useful to log to databases or remote APIs + * + * @author Jordi Boggiano <j.boggiano@seld.be> + * + * @phpstan-import-type Record from \Monolog\Logger + */ +class JsonFormatter extends NormalizerFormatter +{ + public const BATCH_MODE_JSON = 1; + public const BATCH_MODE_NEWLINES = 2; + + /** @var self::BATCH_MODE_* */ + protected $batchMode; + /** @var bool */ + protected $appendNewline; + /** @var bool */ + protected $ignoreEmptyContextAndExtra; + /** @var bool */ + protected $includeStacktraces = false; + + /** + * @param self::BATCH_MODE_* $batchMode + */ + public function __construct(int $batchMode = self::BATCH_MODE_JSON, bool $appendNewline = true, bool $ignoreEmptyContextAndExtra = false, bool $includeStacktraces = false) + { + $this->batchMode = $batchMode; + $this->appendNewline = $appendNewline; + $this->ignoreEmptyContextAndExtra = $ignoreEmptyContextAndExtra; + $this->includeStacktraces = $includeStacktraces; + + parent::__construct(); + } + + /** + * The batch mode option configures the formatting style for + * multiple records. By default, multiple records will be + * formatted as a JSON-encoded array. However, for + * compatibility with some API endpoints, alternative styles + * are available. + */ + public function getBatchMode(): int + { + return $this->batchMode; + } + + /** + * True if newlines are appended to every formatted record + */ + public function isAppendingNewlines(): bool + { + return $this->appendNewline; + } + + /** + * {@inheritDoc} + */ + public function format(array $record): string + { + $normalized = $this->normalize($record); + + if (isset($normalized['context']) && $normalized['context'] === []) { + if ($this->ignoreEmptyContextAndExtra) { + unset($normalized['context']); + } else { + $normalized['context'] = new \stdClass; + } + } + if (isset($normalized['extra']) && $normalized['extra'] === []) { + if ($this->ignoreEmptyContextAndExtra) { + unset($normalized['extra']); + } else { + $normalized['extra'] = new \stdClass; + } + } + + return $this->toJson($normalized, true) . ($this->appendNewline ? "\n" : ''); + } + + /** + * {@inheritDoc} + */ + public function formatBatch(array $records): string + { + switch ($this->batchMode) { + case static::BATCH_MODE_NEWLINES: + return $this->formatBatchNewlines($records); + + case static::BATCH_MODE_JSON: + default: + return $this->formatBatchJson($records); + } + } + + /** + * @return self + */ + public function includeStacktraces(bool $include = true): self + { + $this->includeStacktraces = $include; + + return $this; + } + + /** + * Return a JSON-encoded array of records. + * + * @phpstan-param Record[] $records + */ + protected function formatBatchJson(array $records): string + { + return $this->toJson($this->normalize($records), true); + } + + /** + * Use new lines to separate records instead of a + * JSON-encoded array. + * + * @phpstan-param Record[] $records + */ + protected function formatBatchNewlines(array $records): string + { + $instance = $this; + + $oldNewline = $this->appendNewline; + $this->appendNewline = false; + array_walk($records, function (&$value, $key) use ($instance) { + $value = $instance->format($value); + }); + $this->appendNewline = $oldNewline; + + return implode("\n", $records); + } + + /** + * Normalizes given $data. + * + * @param mixed $data + * + * @return mixed + */ + protected function normalize($data, int $depth = 0) + { + if ($depth > $this->maxNormalizeDepth) { + return 'Over '.$this->maxNormalizeDepth.' levels deep, aborting normalization'; + } + + if (is_array($data)) { + $normalized = []; + + $count = 1; + foreach ($data as $key => $value) { + if ($count++ > $this->maxNormalizeItemCount) { + $normalized['...'] = 'Over '.$this->maxNormalizeItemCount.' items ('.count($data).' total), aborting normalization'; + break; + } + + $normalized[$key] = $this->normalize($value, $depth + 1); + } + + return $normalized; + } + + if (is_object($data)) { + if ($data instanceof \DateTimeInterface) { + return $this->formatDate($data); + } + + if ($data instanceof Throwable) { + return $this->normalizeException($data, $depth); + } + + // if the object has specific json serializability we want to make sure we skip the __toString treatment below + if ($data instanceof \JsonSerializable) { + return $data; + } + + if (method_exists($data, '__toString')) { + return $data->__toString(); + } + + return $data; + } + + if (is_resource($data)) { + return parent::normalize($data); + } + + return $data; + } + + /** + * Normalizes given exception with or without its own stack trace based on + * `includeStacktraces` property. + * + * {@inheritDoc} + */ + protected function normalizeException(Throwable $e, int $depth = 0): array + { + $data = parent::normalizeException($e, $depth); + if (!$this->includeStacktraces) { + unset($data['trace']); + } + + return $data; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php new file mode 100644 index 00000000..e6e78983 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php @@ -0,0 +1,246 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Monolog\Utils; + +/** + * Formats incoming records into a one-line string + * + * This is especially useful for logging to files + * + * @author Jordi Boggiano <j.boggiano@seld.be> + * @author Christophe Coevoet <stof@notk.org> + */ +class LineFormatter extends NormalizerFormatter +{ + public const SIMPLE_FORMAT = "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n"; + + /** @var string */ + protected $format; + /** @var bool */ + protected $allowInlineLineBreaks; + /** @var bool */ + protected $ignoreEmptyContextAndExtra; + /** @var bool */ + protected $includeStacktraces; + /** @var ?callable */ + protected $stacktracesParser; + + /** + * @param string|null $format The format of the message + * @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format + * @param bool $allowInlineLineBreaks Whether to allow inline line breaks in log entries + * @param bool $ignoreEmptyContextAndExtra + */ + public function __construct(?string $format = null, ?string $dateFormat = null, bool $allowInlineLineBreaks = false, bool $ignoreEmptyContextAndExtra = false, bool $includeStacktraces = false) + { + $this->format = $format === null ? static::SIMPLE_FORMAT : $format; + $this->allowInlineLineBreaks = $allowInlineLineBreaks; + $this->ignoreEmptyContextAndExtra = $ignoreEmptyContextAndExtra; + $this->includeStacktraces($includeStacktraces); + parent::__construct($dateFormat); + } + + public function includeStacktraces(bool $include = true, ?callable $parser = null): self + { + $this->includeStacktraces = $include; + if ($this->includeStacktraces) { + $this->allowInlineLineBreaks = true; + $this->stacktracesParser = $parser; + } + + return $this; + } + + public function allowInlineLineBreaks(bool $allow = true): self + { + $this->allowInlineLineBreaks = $allow; + + return $this; + } + + public function ignoreEmptyContextAndExtra(bool $ignore = true): self + { + $this->ignoreEmptyContextAndExtra = $ignore; + + return $this; + } + + /** + * {@inheritDoc} + */ + public function format(array $record): string + { + $vars = parent::format($record); + + $output = $this->format; + + foreach ($vars['extra'] as $var => $val) { + if (false !== strpos($output, '%extra.'.$var.'%')) { + $output = str_replace('%extra.'.$var.'%', $this->stringify($val), $output); + unset($vars['extra'][$var]); + } + } + + foreach ($vars['context'] as $var => $val) { + if (false !== strpos($output, '%context.'.$var.'%')) { + $output = str_replace('%context.'.$var.'%', $this->stringify($val), $output); + unset($vars['context'][$var]); + } + } + + if ($this->ignoreEmptyContextAndExtra) { + if (empty($vars['context'])) { + unset($vars['context']); + $output = str_replace('%context%', '', $output); + } + + if (empty($vars['extra'])) { + unset($vars['extra']); + $output = str_replace('%extra%', '', $output); + } + } + + foreach ($vars as $var => $val) { + if (false !== strpos($output, '%'.$var.'%')) { + $output = str_replace('%'.$var.'%', $this->stringify($val), $output); + } + } + + // remove leftover %extra.xxx% and %context.xxx% if any + if (false !== strpos($output, '%')) { + $output = preg_replace('/%(?:extra|context)\..+?%/', '', $output); + if (null === $output) { + $pcreErrorCode = preg_last_error(); + throw new \RuntimeException('Failed to run preg_replace: ' . $pcreErrorCode . ' / ' . Utils::pcreLastErrorMessage($pcreErrorCode)); + } + } + + return $output; + } + + public function formatBatch(array $records): string + { + $message = ''; + foreach ($records as $record) { + $message .= $this->format($record); + } + + return $message; + } + + /** + * @param mixed $value + */ + public function stringify($value): string + { + return $this->replaceNewlines($this->convertToString($value)); + } + + protected function normalizeException(\Throwable $e, int $depth = 0): string + { + $str = $this->formatException($e); + + if ($previous = $e->getPrevious()) { + do { + $depth++; + if ($depth > $this->maxNormalizeDepth) { + $str .= "\n[previous exception] Over " . $this->maxNormalizeDepth . ' levels deep, aborting normalization'; + break; + } + + $str .= "\n[previous exception] " . $this->formatException($previous); + } while ($previous = $previous->getPrevious()); + } + + return $str; + } + + /** + * @param mixed $data + */ + protected function convertToString($data): string + { + if (null === $data || is_bool($data)) { + return var_export($data, true); + } + + if (is_scalar($data)) { + return (string) $data; + } + + return $this->toJson($data, true); + } + + protected function replaceNewlines(string $str): string + { + if ($this->allowInlineLineBreaks) { + if (0 === strpos($str, '{')) { + $str = preg_replace('/(?<!\\\\)\\\\[rn]/', "\n", $str); + if (null === $str) { + $pcreErrorCode = preg_last_error(); + throw new \RuntimeException('Failed to run preg_replace: ' . $pcreErrorCode . ' / ' . Utils::pcreLastErrorMessage($pcreErrorCode)); + } + } + + return $str; + } + + return str_replace(["\r\n", "\r", "\n"], ' ', $str); + } + + private function formatException(\Throwable $e): string + { + $str = '[object] (' . Utils::getClass($e) . '(code: ' . $e->getCode(); + if ($e instanceof \SoapFault) { + if (isset($e->faultcode)) { + $str .= ' faultcode: ' . $e->faultcode; + } + + if (isset($e->faultactor)) { + $str .= ' faultactor: ' . $e->faultactor; + } + + if (isset($e->detail)) { + if (is_string($e->detail)) { + $str .= ' detail: ' . $e->detail; + } elseif (is_object($e->detail) || is_array($e->detail)) { + $str .= ' detail: ' . $this->toJson($e->detail, true); + } + } + } + $str .= '): ' . $e->getMessage() . ' at ' . $e->getFile() . ':' . $e->getLine() . ')'; + + if ($this->includeStacktraces) { + $str .= $this->stacktracesParser($e); + } + + return $str; + } + + private function stacktracesParser(\Throwable $e): string + { + $trace = $e->getTraceAsString(); + + if ($this->stacktracesParser) { + $trace = $this->stacktracesParserCustom($trace); + } + + return "\n[stacktrace]\n" . $trace . "\n"; + } + + private function stacktracesParserCustom(string $trace): string + { + return implode("\n", array_filter(array_map($this->stacktracesParser, explode("\n", $trace)))); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php new file mode 100644 index 00000000..29841aa3 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php @@ -0,0 +1,45 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +/** + * Encodes message information into JSON in a format compatible with Loggly. + * + * @author Adam Pancutt <adam@pancutt.com> + */ +class LogglyFormatter extends JsonFormatter +{ + /** + * Overrides the default batch mode to new lines for compatibility with the + * Loggly bulk API. + */ + public function __construct(int $batchMode = self::BATCH_MODE_NEWLINES, bool $appendNewline = false) + { + parent::__construct($batchMode, $appendNewline); + } + + /** + * Appends the 'timestamp' parameter for indexing by Loggly. + * + * @see https://www.loggly.com/docs/automated-parsing/#json + * @see \Monolog\Formatter\JsonFormatter::format() + */ + public function format(array $record): string + { + if (isset($record["datetime"]) && ($record["datetime"] instanceof \DateTimeInterface)) { + $record["timestamp"] = $record["datetime"]->format("Y-m-d\TH:i:s.uO"); + unset($record["datetime"]); + } + + return parent::format($record); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/LogmaticFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/LogmaticFormatter.php new file mode 100644 index 00000000..b0451aba --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/LogmaticFormatter.php @@ -0,0 +1,66 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +/** + * Encodes message information into JSON in a format compatible with Logmatic. + * + * @author Julien Breux <julien.breux@gmail.com> + */ +class LogmaticFormatter extends JsonFormatter +{ + protected const MARKERS = ["sourcecode", "php"]; + + /** + * @var string + */ + protected $hostname = ''; + + /** + * @var string + */ + protected $appname = ''; + + public function setHostname(string $hostname): self + { + $this->hostname = $hostname; + + return $this; + } + + public function setAppname(string $appname): self + { + $this->appname = $appname; + + return $this; + } + + /** + * Appends the 'hostname' and 'appname' parameter for indexing by Logmatic. + * + * @see http://doc.logmatic.io/docs/basics-to-send-data + * @see \Monolog\Formatter\JsonFormatter::format() + */ + public function format(array $record): string + { + if (!empty($this->hostname)) { + $record["hostname"] = $this->hostname; + } + if (!empty($this->appname)) { + $record["appname"] = $this->appname; + } + + $record["@marker"] = static::MARKERS; + + return parent::format($record); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php new file mode 100644 index 00000000..f8de0d33 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php @@ -0,0 +1,101 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +/** + * Serializes a log message to Logstash Event Format + * + * @see https://www.elastic.co/products/logstash + * @see https://github.com/elastic/logstash/blob/master/logstash-core/src/main/java/org/logstash/Event.java + * + * @author Tim Mower <timothy.mower@gmail.com> + */ +class LogstashFormatter extends NormalizerFormatter +{ + /** + * @var string the name of the system for the Logstash log message, used to fill the @source field + */ + protected $systemName; + + /** + * @var string an application name for the Logstash log message, used to fill the @type field + */ + protected $applicationName; + + /** + * @var string the key for 'extra' fields from the Monolog record + */ + protected $extraKey; + + /** + * @var string the key for 'context' fields from the Monolog record + */ + protected $contextKey; + + /** + * @param string $applicationName The application that sends the data, used as the "type" field of logstash + * @param string|null $systemName The system/machine name, used as the "source" field of logstash, defaults to the hostname of the machine + * @param string $extraKey The key for extra keys inside logstash "fields", defaults to extra + * @param string $contextKey The key for context keys inside logstash "fields", defaults to context + */ + public function __construct(string $applicationName, ?string $systemName = null, string $extraKey = 'extra', string $contextKey = 'context') + { + // logstash requires a ISO 8601 format date with optional millisecond precision. + parent::__construct('Y-m-d\TH:i:s.uP'); + + $this->systemName = $systemName === null ? (string) gethostname() : $systemName; + $this->applicationName = $applicationName; + $this->extraKey = $extraKey; + $this->contextKey = $contextKey; + } + + /** + * {@inheritDoc} + */ + public function format(array $record): string + { + $record = parent::format($record); + + if (empty($record['datetime'])) { + $record['datetime'] = gmdate('c'); + } + $message = [ + '@timestamp' => $record['datetime'], + '@version' => 1, + 'host' => $this->systemName, + ]; + if (isset($record['message'])) { + $message['message'] = $record['message']; + } + if (isset($record['channel'])) { + $message['type'] = $record['channel']; + $message['channel'] = $record['channel']; + } + if (isset($record['level_name'])) { + $message['level'] = $record['level_name']; + } + if (isset($record['level'])) { + $message['monolog_level'] = $record['level']; + } + if ($this->applicationName) { + $message['type'] = $this->applicationName; + } + if (!empty($record['extra'])) { + $message[$this->extraKey] = $record['extra']; + } + if (!empty($record['context'])) { + $message[$this->contextKey] = $record['context']; + } + + return $this->toJson($message) . "\n"; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php new file mode 100644 index 00000000..fca69a89 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php @@ -0,0 +1,162 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use MongoDB\BSON\Type; +use MongoDB\BSON\UTCDateTime; +use Monolog\Utils; + +/** + * Formats a record for use with the MongoDBHandler. + * + * @author Florian Plattner <me@florianplattner.de> + */ +class MongoDBFormatter implements FormatterInterface +{ + /** @var bool */ + private $exceptionTraceAsString; + /** @var int */ + private $maxNestingLevel; + /** @var bool */ + private $isLegacyMongoExt; + + /** + * @param int $maxNestingLevel 0 means infinite nesting, the $record itself is level 1, $record['context'] is 2 + * @param bool $exceptionTraceAsString set to false to log exception traces as a sub documents instead of strings + */ + public function __construct(int $maxNestingLevel = 3, bool $exceptionTraceAsString = true) + { + $this->maxNestingLevel = max($maxNestingLevel, 0); + $this->exceptionTraceAsString = $exceptionTraceAsString; + + $this->isLegacyMongoExt = extension_loaded('mongodb') && version_compare((string) phpversion('mongodb'), '1.1.9', '<='); + } + + /** + * {@inheritDoc} + * + * @return mixed[] + */ + public function format(array $record): array + { + /** @var mixed[] $res */ + $res = $this->formatArray($record); + + return $res; + } + + /** + * {@inheritDoc} + * + * @return array<mixed[]> + */ + public function formatBatch(array $records): array + { + $formatted = []; + foreach ($records as $key => $record) { + $formatted[$key] = $this->format($record); + } + + return $formatted; + } + + /** + * @param mixed[] $array + * @return mixed[]|string Array except when max nesting level is reached then a string "[...]" + */ + protected function formatArray(array $array, int $nestingLevel = 0) + { + if ($this->maxNestingLevel > 0 && $nestingLevel > $this->maxNestingLevel) { + return '[...]'; + } + + foreach ($array as $name => $value) { + if ($value instanceof \DateTimeInterface) { + $array[$name] = $this->formatDate($value, $nestingLevel + 1); + } elseif ($value instanceof \Throwable) { + $array[$name] = $this->formatException($value, $nestingLevel + 1); + } elseif (is_array($value)) { + $array[$name] = $this->formatArray($value, $nestingLevel + 1); + } elseif (is_object($value) && !$value instanceof Type) { + $array[$name] = $this->formatObject($value, $nestingLevel + 1); + } + } + + return $array; + } + + /** + * @param mixed $value + * @return mixed[]|string + */ + protected function formatObject($value, int $nestingLevel) + { + $objectVars = get_object_vars($value); + $objectVars['class'] = Utils::getClass($value); + + return $this->formatArray($objectVars, $nestingLevel); + } + + /** + * @return mixed[]|string + */ + protected function formatException(\Throwable $exception, int $nestingLevel) + { + $formattedException = [ + 'class' => Utils::getClass($exception), + 'message' => $exception->getMessage(), + 'code' => (int) $exception->getCode(), + 'file' => $exception->getFile() . ':' . $exception->getLine(), + ]; + + if ($this->exceptionTraceAsString === true) { + $formattedException['trace'] = $exception->getTraceAsString(); + } else { + $formattedException['trace'] = $exception->getTrace(); + } + + return $this->formatArray($formattedException, $nestingLevel); + } + + protected function formatDate(\DateTimeInterface $value, int $nestingLevel): UTCDateTime + { + if ($this->isLegacyMongoExt) { + return $this->legacyGetMongoDbDateTime($value); + } + + return $this->getMongoDbDateTime($value); + } + + private function getMongoDbDateTime(\DateTimeInterface $value): UTCDateTime + { + return new UTCDateTime((int) floor(((float) $value->format('U.u')) * 1000)); + } + + /** + * This is needed to support MongoDB Driver v1.19 and below + * + * See https://github.com/mongodb/mongo-php-driver/issues/426 + * + * It can probably be removed in 2.1 or later once MongoDB's 1.2 is released and widely adopted + */ + private function legacyGetMongoDbDateTime(\DateTimeInterface $value): UTCDateTime + { + $milliseconds = floor(((float) $value->format('U.u')) * 1000); + + $milliseconds = (PHP_INT_SIZE == 8) //64-bit OS? + ? (int) $milliseconds + : (string) $milliseconds; + + // @phpstan-ignore-next-line + return new UTCDateTime($milliseconds); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php new file mode 100644 index 00000000..f926a842 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php @@ -0,0 +1,290 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Monolog\DateTimeImmutable; +use Monolog\Utils; +use Throwable; + +/** + * Normalizes incoming records to remove objects/resources so it's easier to dump to various targets + * + * @author Jordi Boggiano <j.boggiano@seld.be> + */ +class NormalizerFormatter implements FormatterInterface +{ + public const SIMPLE_DATE = "Y-m-d\TH:i:sP"; + + /** @var string */ + protected $dateFormat; + /** @var int */ + protected $maxNormalizeDepth = 9; + /** @var int */ + protected $maxNormalizeItemCount = 1000; + + /** @var int */ + private $jsonEncodeOptions = Utils::DEFAULT_JSON_FLAGS; + + /** + * @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format + */ + public function __construct(?string $dateFormat = null) + { + $this->dateFormat = null === $dateFormat ? static::SIMPLE_DATE : $dateFormat; + if (!function_exists('json_encode')) { + throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s NormalizerFormatter'); + } + } + + /** + * {@inheritDoc} + * + * @param mixed[] $record + */ + public function format(array $record) + { + return $this->normalize($record); + } + + /** + * {@inheritDoc} + */ + public function formatBatch(array $records) + { + foreach ($records as $key => $record) { + $records[$key] = $this->format($record); + } + + return $records; + } + + public function getDateFormat(): string + { + return $this->dateFormat; + } + + public function setDateFormat(string $dateFormat): self + { + $this->dateFormat = $dateFormat; + + return $this; + } + + /** + * The maximum number of normalization levels to go through + */ + public function getMaxNormalizeDepth(): int + { + return $this->maxNormalizeDepth; + } + + public function setMaxNormalizeDepth(int $maxNormalizeDepth): self + { + $this->maxNormalizeDepth = $maxNormalizeDepth; + + return $this; + } + + /** + * The maximum number of items to normalize per level + */ + public function getMaxNormalizeItemCount(): int + { + return $this->maxNormalizeItemCount; + } + + public function setMaxNormalizeItemCount(int $maxNormalizeItemCount): self + { + $this->maxNormalizeItemCount = $maxNormalizeItemCount; + + return $this; + } + + /** + * Enables `json_encode` pretty print. + */ + public function setJsonPrettyPrint(bool $enable): self + { + if ($enable) { + $this->jsonEncodeOptions |= JSON_PRETTY_PRINT; + } else { + $this->jsonEncodeOptions &= ~JSON_PRETTY_PRINT; + } + + return $this; + } + + /** + * @param mixed $data + * @return null|scalar|array<array|scalar|null> + */ + protected function normalize($data, int $depth = 0) + { + if ($depth > $this->maxNormalizeDepth) { + return 'Over ' . $this->maxNormalizeDepth . ' levels deep, aborting normalization'; + } + + if (null === $data || is_scalar($data)) { + if (is_float($data)) { + if (is_infinite($data)) { + return ($data > 0 ? '' : '-') . 'INF'; + } + if (is_nan($data)) { + return 'NaN'; + } + } + + return $data; + } + + if (is_array($data)) { + $normalized = []; + + $count = 1; + foreach ($data as $key => $value) { + if ($count++ > $this->maxNormalizeItemCount) { + $normalized['...'] = 'Over ' . $this->maxNormalizeItemCount . ' items ('.count($data).' total), aborting normalization'; + break; + } + + $normalized[$key] = $this->normalize($value, $depth + 1); + } + + return $normalized; + } + + if ($data instanceof \DateTimeInterface) { + return $this->formatDate($data); + } + + if (is_object($data)) { + if ($data instanceof Throwable) { + return $this->normalizeException($data, $depth); + } + + if ($data instanceof \JsonSerializable) { + /** @var null|scalar|array<array|scalar|null> $value */ + $value = $data->jsonSerialize(); + } elseif (\get_class($data) === '__PHP_Incomplete_Class') { + $accessor = new \ArrayObject($data); + $value = (string) $accessor['__PHP_Incomplete_Class_Name']; + } elseif (method_exists($data, '__toString')) { + /** @var string $value */ + $value = $data->__toString(); + } else { + // the rest is normalized by json encoding and decoding it + /** @var null|scalar|array<array|scalar|null> $value */ + $value = json_decode($this->toJson($data, true), true); + } + + return [Utils::getClass($data) => $value]; + } + + if (is_resource($data)) { + return sprintf('[resource(%s)]', get_resource_type($data)); + } + + return '[unknown('.gettype($data).')]'; + } + + /** + * @return mixed[] + */ + protected function normalizeException(Throwable $e, int $depth = 0) + { + if ($depth > $this->maxNormalizeDepth) { + return ['Over ' . $this->maxNormalizeDepth . ' levels deep, aborting normalization']; + } + + if ($e instanceof \JsonSerializable) { + return (array) $e->jsonSerialize(); + } + + $data = [ + 'class' => Utils::getClass($e), + 'message' => $e->getMessage(), + 'code' => (int) $e->getCode(), + 'file' => $e->getFile().':'.$e->getLine(), + ]; + + if ($e instanceof \SoapFault) { + if (isset($e->faultcode)) { + $data['faultcode'] = $e->faultcode; + } + + if (isset($e->faultactor)) { + $data['faultactor'] = $e->faultactor; + } + + if (isset($e->detail)) { + if (is_string($e->detail)) { + $data['detail'] = $e->detail; + } elseif (is_object($e->detail) || is_array($e->detail)) { + $data['detail'] = $this->toJson($e->detail, true); + } + } + } + + $trace = $e->getTrace(); + foreach ($trace as $frame) { + if (isset($frame['file'])) { + $data['trace'][] = $frame['file'].':'.$frame['line']; + } + } + + if ($previous = $e->getPrevious()) { + $data['previous'] = $this->normalizeException($previous, $depth + 1); + } + + return $data; + } + + /** + * Return the JSON representation of a value + * + * @param mixed $data + * @throws \RuntimeException if encoding fails and errors are not ignored + * @return string if encoding fails and ignoreErrors is true 'null' is returned + */ + protected function toJson($data, bool $ignoreErrors = false): string + { + return Utils::jsonEncode($data, $this->jsonEncodeOptions, $ignoreErrors); + } + + /** + * @return string + */ + protected function formatDate(\DateTimeInterface $date) + { + // in case the date format isn't custom then we defer to the custom DateTimeImmutable + // formatting logic, which will pick the right format based on whether useMicroseconds is on + if ($this->dateFormat === self::SIMPLE_DATE && $date instanceof DateTimeImmutable) { + return (string) $date; + } + + return $date->format($this->dateFormat); + } + + public function addJsonEncodeOption(int $option): self + { + $this->jsonEncodeOptions |= $option; + + return $this; + } + + public function removeJsonEncodeOption(int $option): self + { + $this->jsonEncodeOptions &= ~$option; + + return $this; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php new file mode 100644 index 00000000..187bc550 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php @@ -0,0 +1,51 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +/** + * Formats data into an associative array of scalar values. + * Objects and arrays will be JSON encoded. + * + * @author Andrew Lawson <adlawson@gmail.com> + */ +class ScalarFormatter extends NormalizerFormatter +{ + /** + * {@inheritDoc} + * + * @phpstan-return array<string, scalar|null> $record + */ + public function format(array $record): array + { + $result = []; + foreach ($record as $key => $value) { + $result[$key] = $this->normalizeValue($value); + } + + return $result; + } + + /** + * @param mixed $value + * @return scalar|null + */ + protected function normalizeValue($value) + { + $normalized = $this->normalize($value); + + if (is_array($normalized)) { + return $this->toJson($normalized, true); + } + + return $normalized; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php new file mode 100644 index 00000000..6539b347 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php @@ -0,0 +1,139 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Monolog\Logger; + +/** + * Serializes a log message according to Wildfire's header requirements + * + * @author Eric Clemmons (@ericclemmons) <eric@uxdriven.com> + * @author Christophe Coevoet <stof@notk.org> + * @author Kirill chEbba Chebunin <iam@chebba.org> + * + * @phpstan-import-type Level from \Monolog\Logger + */ +class WildfireFormatter extends NormalizerFormatter +{ + /** + * Translates Monolog log levels to Wildfire levels. + * + * @var array<Level, string> + */ + private $logLevels = [ + Logger::DEBUG => 'LOG', + Logger::INFO => 'INFO', + Logger::NOTICE => 'INFO', + Logger::WARNING => 'WARN', + Logger::ERROR => 'ERROR', + Logger::CRITICAL => 'ERROR', + Logger::ALERT => 'ERROR', + Logger::EMERGENCY => 'ERROR', + ]; + + /** + * @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format + */ + public function __construct(?string $dateFormat = null) + { + parent::__construct($dateFormat); + + // http headers do not like non-ISO-8559-1 characters + $this->removeJsonEncodeOption(JSON_UNESCAPED_UNICODE); + } + + /** + * {@inheritDoc} + * + * @return string + */ + public function format(array $record): string + { + // Retrieve the line and file if set and remove them from the formatted extra + $file = $line = ''; + if (isset($record['extra']['file'])) { + $file = $record['extra']['file']; + unset($record['extra']['file']); + } + if (isset($record['extra']['line'])) { + $line = $record['extra']['line']; + unset($record['extra']['line']); + } + + /** @var mixed[] $record */ + $record = $this->normalize($record); + $message = ['message' => $record['message']]; + $handleError = false; + if ($record['context']) { + $message['context'] = $record['context']; + $handleError = true; + } + if ($record['extra']) { + $message['extra'] = $record['extra']; + $handleError = true; + } + if (count($message) === 1) { + $message = reset($message); + } + + if (isset($record['context']['table'])) { + $type = 'TABLE'; + $label = $record['channel'] .': '. $record['message']; + $message = $record['context']['table']; + } else { + $type = $this->logLevels[$record['level']]; + $label = $record['channel']; + } + + // Create JSON object describing the appearance of the message in the console + $json = $this->toJson([ + [ + 'Type' => $type, + 'File' => $file, + 'Line' => $line, + 'Label' => $label, + ], + $message, + ], $handleError); + + // The message itself is a serialization of the above JSON object + it's length + return sprintf( + '%d|%s|', + strlen($json), + $json + ); + } + + /** + * {@inheritDoc} + * + * @phpstan-return never + */ + public function formatBatch(array $records) + { + throw new \BadMethodCallException('Batch formatting does not make sense for the WildfireFormatter'); + } + + /** + * {@inheritDoc} + * + * @return null|scalar|array<array|scalar|null>|object + */ + protected function normalize($data, int $depth = 0) + { + if (is_object($data) && !$data instanceof \DateTimeInterface) { + return $data; + } + + return parent::normalize($data, $depth); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php new file mode 100644 index 00000000..a5cdaa71 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php @@ -0,0 +1,112 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\ResettableInterface; +use Psr\Log\LogLevel; + +/** + * Base Handler class providing basic level/bubble support + * + * @author Jordi Boggiano <j.boggiano@seld.be> + * + * @phpstan-import-type Level from \Monolog\Logger + * @phpstan-import-type LevelName from \Monolog\Logger + */ +abstract class AbstractHandler extends Handler implements ResettableInterface +{ + /** + * @var int + * @phpstan-var Level + */ + protected $level = Logger::DEBUG; + /** @var bool */ + protected $bubble = true; + + /** + * @param int|string $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * + * @phpstan-param Level|LevelName|LogLevel::* $level + */ + public function __construct($level = Logger::DEBUG, bool $bubble = true) + { + $this->setLevel($level); + $this->bubble = $bubble; + } + + /** + * {@inheritDoc} + */ + public function isHandling(array $record): bool + { + return $record['level'] >= $this->level; + } + + /** + * Sets minimum logging level at which this handler will be triggered. + * + * @param Level|LevelName|LogLevel::* $level Level or level name + * @return self + */ + public function setLevel($level): self + { + $this->level = Logger::toMonologLevel($level); + + return $this; + } + + /** + * Gets minimum logging level at which this handler will be triggered. + * + * @return int + * + * @phpstan-return Level + */ + public function getLevel(): int + { + return $this->level; + } + + /** + * Sets the bubbling behavior. + * + * @param bool $bubble true means that this handler allows bubbling. + * false means that bubbling is not permitted. + * @return self + */ + public function setBubble(bool $bubble): self + { + $this->bubble = $bubble; + + return $this; + } + + /** + * Gets the bubbling behavior. + * + * @return bool true means that this handler allows bubbling. + * false means that bubbling is not permitted. + */ + public function getBubble(): bool + { + return $this->bubble; + } + + /** + * {@inheritDoc} + */ + public function reset() + { + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php new file mode 100644 index 00000000..77e533fc --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php @@ -0,0 +1,69 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +/** + * Base Handler class providing the Handler structure, including processors and formatters + * + * Classes extending it should (in most cases) only implement write($record) + * + * @author Jordi Boggiano <j.boggiano@seld.be> + * @author Christophe Coevoet <stof@notk.org> + * + * @phpstan-import-type LevelName from \Monolog\Logger + * @phpstan-import-type Level from \Monolog\Logger + * @phpstan-import-type Record from \Monolog\Logger + * @phpstan-type FormattedRecord array{message: string, context: mixed[], level: Level, level_name: LevelName, channel: string, datetime: \DateTimeImmutable, extra: mixed[], formatted: mixed} + */ +abstract class AbstractProcessingHandler extends AbstractHandler implements ProcessableHandlerInterface, FormattableHandlerInterface +{ + use ProcessableHandlerTrait; + use FormattableHandlerTrait; + + /** + * {@inheritDoc} + */ + public function handle(array $record): bool + { + if (!$this->isHandling($record)) { + return false; + } + + if ($this->processors) { + /** @var Record $record */ + $record = $this->processRecord($record); + } + + $record['formatted'] = $this->getFormatter()->format($record); + + $this->write($record); + + return false === $this->bubble; + } + + /** + * Writes the record down to the log of the implementing handler + * + * @phpstan-param FormattedRecord $record + */ + abstract protected function write(array $record): void; + + /** + * @return void + */ + public function reset() + { + parent::reset(); + + $this->resetProcessors(); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php new file mode 100644 index 00000000..5e5ad1c1 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php @@ -0,0 +1,106 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Formatter\FormatterInterface; +use Monolog\Formatter\LineFormatter; + +/** + * Common syslog functionality + * + * @phpstan-import-type Level from \Monolog\Logger + */ +abstract class AbstractSyslogHandler extends AbstractProcessingHandler +{ + /** @var int */ + protected $facility; + + /** + * Translates Monolog log levels to syslog log priorities. + * @var array + * @phpstan-var array<Level, int> + */ + protected $logLevels = [ + Logger::DEBUG => LOG_DEBUG, + Logger::INFO => LOG_INFO, + Logger::NOTICE => LOG_NOTICE, + Logger::WARNING => LOG_WARNING, + Logger::ERROR => LOG_ERR, + Logger::CRITICAL => LOG_CRIT, + Logger::ALERT => LOG_ALERT, + Logger::EMERGENCY => LOG_EMERG, + ]; + + /** + * List of valid log facility names. + * @var array<string, int> + */ + protected $facilities = [ + 'auth' => LOG_AUTH, + 'authpriv' => LOG_AUTHPRIV, + 'cron' => LOG_CRON, + 'daemon' => LOG_DAEMON, + 'kern' => LOG_KERN, + 'lpr' => LOG_LPR, + 'mail' => LOG_MAIL, + 'news' => LOG_NEWS, + 'syslog' => LOG_SYSLOG, + 'user' => LOG_USER, + 'uucp' => LOG_UUCP, + ]; + + /** + * @param string|int $facility Either one of the names of the keys in $this->facilities, or a LOG_* facility constant + */ + public function __construct($facility = LOG_USER, $level = Logger::DEBUG, bool $bubble = true) + { + parent::__construct($level, $bubble); + + if (!defined('PHP_WINDOWS_VERSION_BUILD')) { + $this->facilities['local0'] = LOG_LOCAL0; + $this->facilities['local1'] = LOG_LOCAL1; + $this->facilities['local2'] = LOG_LOCAL2; + $this->facilities['local3'] = LOG_LOCAL3; + $this->facilities['local4'] = LOG_LOCAL4; + $this->facilities['local5'] = LOG_LOCAL5; + $this->facilities['local6'] = LOG_LOCAL6; + $this->facilities['local7'] = LOG_LOCAL7; + } else { + $this->facilities['local0'] = 128; // LOG_LOCAL0 + $this->facilities['local1'] = 136; // LOG_LOCAL1 + $this->facilities['local2'] = 144; // LOG_LOCAL2 + $this->facilities['local3'] = 152; // LOG_LOCAL3 + $this->facilities['local4'] = 160; // LOG_LOCAL4 + $this->facilities['local5'] = 168; // LOG_LOCAL5 + $this->facilities['local6'] = 176; // LOG_LOCAL6 + $this->facilities['local7'] = 184; // LOG_LOCAL7 + } + + // convert textual description of facility to syslog constant + if (is_string($facility) && array_key_exists(strtolower($facility), $this->facilities)) { + $facility = $this->facilities[strtolower($facility)]; + } elseif (!in_array($facility, array_values($this->facilities), true)) { + throw new \UnexpectedValueException('Unknown facility value "'.$facility.'" given'); + } + + $this->facility = $facility; + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter(): FormatterInterface + { + return new LineFormatter('%channel%.%level_name%: %message% %context% %extra%'); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php new file mode 100644 index 00000000..994872ce --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php @@ -0,0 +1,171 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Formatter\FormatterInterface; +use Monolog\Formatter\JsonFormatter; +use PhpAmqpLib\Message\AMQPMessage; +use PhpAmqpLib\Channel\AMQPChannel; +use AMQPExchange; + +/** + * @phpstan-import-type Record from \Monolog\Logger + */ +class AmqpHandler extends AbstractProcessingHandler +{ + /** + * @var AMQPExchange|AMQPChannel $exchange + */ + protected $exchange; + /** @var array<string, mixed> */ + private $extraAttributes = []; + + /** + * @return array<string, mixed> + */ + public function getExtraAttributes(): array + { + return $this->extraAttributes; + } + + /** + * Configure extra attributes to pass to the AMQPExchange (if you are using the amqp extension) + * + * @param array<string, mixed> $extraAttributes One of content_type, content_encoding, + * message_id, user_id, app_id, delivery_mode, + * priority, timestamp, expiration, type + * or reply_to, headers. + * @return AmqpHandler + */ + public function setExtraAttributes(array $extraAttributes): self + { + $this->extraAttributes = $extraAttributes; + return $this; + } + + /** + * @var string + */ + protected $exchangeName; + + /** + * @param AMQPExchange|AMQPChannel $exchange AMQPExchange (php AMQP ext) or PHP AMQP lib channel, ready for use + * @param string|null $exchangeName Optional exchange name, for AMQPChannel (PhpAmqpLib) only + */ + public function __construct($exchange, ?string $exchangeName = null, $level = Logger::DEBUG, bool $bubble = true) + { + if ($exchange instanceof AMQPChannel) { + $this->exchangeName = (string) $exchangeName; + } elseif (!$exchange instanceof AMQPExchange) { + throw new \InvalidArgumentException('PhpAmqpLib\Channel\AMQPChannel or AMQPExchange instance required'); + } elseif ($exchangeName) { + @trigger_error('The $exchangeName parameter can only be passed when using PhpAmqpLib, if using an AMQPExchange instance configure it beforehand', E_USER_DEPRECATED); + } + $this->exchange = $exchange; + + parent::__construct($level, $bubble); + } + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + $data = $record["formatted"]; + $routingKey = $this->getRoutingKey($record); + + if ($this->exchange instanceof AMQPExchange) { + $attributes = [ + 'delivery_mode' => 2, + 'content_type' => 'application/json', + ]; + if ($this->extraAttributes) { + $attributes = array_merge($attributes, $this->extraAttributes); + } + $this->exchange->publish( + $data, + $routingKey, + 0, + $attributes + ); + } else { + $this->exchange->basic_publish( + $this->createAmqpMessage($data), + $this->exchangeName, + $routingKey + ); + } + } + + /** + * {@inheritDoc} + */ + public function handleBatch(array $records): void + { + if ($this->exchange instanceof AMQPExchange) { + parent::handleBatch($records); + + return; + } + + foreach ($records as $record) { + if (!$this->isHandling($record)) { + continue; + } + + /** @var Record $record */ + $record = $this->processRecord($record); + $data = $this->getFormatter()->format($record); + + $this->exchange->batch_basic_publish( + $this->createAmqpMessage($data), + $this->exchangeName, + $this->getRoutingKey($record) + ); + } + + $this->exchange->publish_batch(); + } + + /** + * Gets the routing key for the AMQP exchange + * + * @phpstan-param Record $record + */ + protected function getRoutingKey(array $record): string + { + $routingKey = sprintf('%s.%s', $record['level_name'], $record['channel']); + + return strtolower($routingKey); + } + + private function createAmqpMessage(string $data): AMQPMessage + { + $attributes = [ + 'delivery_mode' => 2, + 'content_type' => 'application/json', + ]; + if ($this->extraAttributes) { + $attributes = array_merge($attributes, $this->extraAttributes); + } + return new AMQPMessage($data, $attributes); + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter(): FormatterInterface + { + return new JsonFormatter(JsonFormatter::BATCH_MODE_JSON, false); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php new file mode 100644 index 00000000..95bbfed4 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php @@ -0,0 +1,308 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\FormatterInterface; +use Monolog\Formatter\LineFormatter; +use Monolog\Utils; +use Monolog\Logger; + +use function count; +use function headers_list; +use function stripos; +use function trigger_error; + +use const E_USER_DEPRECATED; + +/** + * Handler sending logs to browser's javascript console with no browser extension required + * + * @author Olivier Poitrey <rs@dailymotion.com> + * + * @phpstan-import-type FormattedRecord from AbstractProcessingHandler + */ +class BrowserConsoleHandler extends AbstractProcessingHandler +{ + /** @var bool */ + protected static $initialized = false; + /** @var FormattedRecord[] */ + protected static $records = []; + + protected const FORMAT_HTML = 'html'; + protected const FORMAT_JS = 'js'; + protected const FORMAT_UNKNOWN = 'unknown'; + + /** + * {@inheritDoc} + * + * Formatted output may contain some formatting markers to be transferred to `console.log` using the %c format. + * + * Example of formatted string: + * + * You can do [[blue text]]{color: blue} or [[green background]]{background-color: green; color: white} + */ + protected function getDefaultFormatter(): FormatterInterface + { + return new LineFormatter('[[%channel%]]{macro: autolabel} [[%level_name%]]{font-weight: bold} %message%'); + } + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + // Accumulate records + static::$records[] = $record; + + // Register shutdown handler if not already done + if (!static::$initialized) { + static::$initialized = true; + $this->registerShutdownFunction(); + } + } + + /** + * Convert records to javascript console commands and send it to the browser. + * This method is automatically called on PHP shutdown if output is HTML or Javascript. + */ + public static function send(): void + { + $format = static::getResponseFormat(); + if ($format === self::FORMAT_UNKNOWN) { + return; + } + + if (count(static::$records)) { + if ($format === self::FORMAT_HTML) { + static::writeOutput('<script>' . static::generateScript() . '</script>'); + } elseif ($format === self::FORMAT_JS) { + static::writeOutput(static::generateScript()); + } + static::resetStatic(); + } + } + + public function close(): void + { + self::resetStatic(); + } + + public function reset() + { + parent::reset(); + + self::resetStatic(); + } + + /** + * Forget all logged records + */ + public static function resetStatic(): void + { + static::$records = []; + } + + /** + * Wrapper for register_shutdown_function to allow overriding + */ + protected function registerShutdownFunction(): void + { + if (PHP_SAPI !== 'cli') { + register_shutdown_function(['Monolog\Handler\BrowserConsoleHandler', 'send']); + } + } + + /** + * Wrapper for echo to allow overriding + */ + protected static function writeOutput(string $str): void + { + echo $str; + } + + /** + * Checks the format of the response + * + * If Content-Type is set to application/javascript or text/javascript -> js + * If Content-Type is set to text/html, or is unset -> html + * If Content-Type is anything else -> unknown + * + * @return string One of 'js', 'html' or 'unknown' + * @phpstan-return self::FORMAT_* + */ + protected static function getResponseFormat(): string + { + // Check content type + foreach (headers_list() as $header) { + if (stripos($header, 'content-type:') === 0) { + return static::getResponseFormatFromContentType($header); + } + } + + return self::FORMAT_HTML; + } + + /** + * @return string One of 'js', 'html' or 'unknown' + * @phpstan-return self::FORMAT_* + */ + protected static function getResponseFormatFromContentType(string $contentType): string + { + // This handler only works with HTML and javascript outputs + // text/javascript is obsolete in favour of application/javascript, but still used + if (stripos($contentType, 'application/javascript') !== false || stripos($contentType, 'text/javascript') !== false) { + return self::FORMAT_JS; + } + + if (stripos($contentType, 'text/html') !== false) { + return self::FORMAT_HTML; + } + + return self::FORMAT_UNKNOWN; + } + + private static function generateScript(): string + { + $script = []; + foreach (static::$records as $record) { + $context = static::dump('Context', $record['context']); + $extra = static::dump('Extra', $record['extra']); + + if (empty($context) && empty($extra)) { + $script[] = static::call_array(static::getConsoleMethodForLevel($record['level']), static::handleStyles($record['formatted'])); + } else { + $script = array_merge( + $script, + [static::call_array('groupCollapsed', static::handleStyles($record['formatted']))], + $context, + $extra, + [static::call('groupEnd')] + ); + } + } + + return "(function (c) {if (c && c.groupCollapsed) {\n" . implode("\n", $script) . "\n}})(console);"; + } + + private static function getConsoleMethodForLevel(int $level): string + { + return [ + Logger::DEBUG => 'debug', + Logger::INFO => 'info', + Logger::NOTICE => 'info', + Logger::WARNING => 'warn', + Logger::ERROR => 'error', + Logger::CRITICAL => 'error', + Logger::ALERT => 'error', + Logger::EMERGENCY => 'error', + ][$level] ?? 'log'; + } + + /** + * @return string[] + */ + private static function handleStyles(string $formatted): array + { + $args = []; + $format = '%c' . $formatted; + preg_match_all('/\[\[(.*?)\]\]\{([^}]*)\}/s', $format, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); + + foreach (array_reverse($matches) as $match) { + $args[] = '"font-weight: normal"'; + $args[] = static::quote(static::handleCustomStyles($match[2][0], $match[1][0])); + + $pos = $match[0][1]; + $format = Utils::substr($format, 0, $pos) . '%c' . $match[1][0] . '%c' . Utils::substr($format, $pos + strlen($match[0][0])); + } + + $args[] = static::quote('font-weight: normal'); + $args[] = static::quote($format); + + return array_reverse($args); + } + + private static function handleCustomStyles(string $style, string $string): string + { + static $colors = ['blue', 'green', 'red', 'magenta', 'orange', 'black', 'grey']; + static $labels = []; + + $style = preg_replace_callback('/macro\s*:(.*?)(?:;|$)/', function (array $m) use ($string, &$colors, &$labels) { + if (trim($m[1]) === 'autolabel') { + // Format the string as a label with consistent auto assigned background color + if (!isset($labels[$string])) { + $labels[$string] = $colors[count($labels) % count($colors)]; + } + $color = $labels[$string]; + + return "background-color: $color; color: white; border-radius: 3px; padding: 0 2px 0 2px"; + } + + return $m[1]; + }, $style); + + if (null === $style) { + $pcreErrorCode = preg_last_error(); + throw new \RuntimeException('Failed to run preg_replace_callback: ' . $pcreErrorCode . ' / ' . Utils::pcreLastErrorMessage($pcreErrorCode)); + } + + return $style; + } + + /** + * @param mixed[] $dict + * @return mixed[] + */ + private static function dump(string $title, array $dict): array + { + $script = []; + $dict = array_filter($dict); + if (empty($dict)) { + return $script; + } + $script[] = static::call('log', static::quote('%c%s'), static::quote('font-weight: bold'), static::quote($title)); + foreach ($dict as $key => $value) { + $value = json_encode($value); + if (empty($value)) { + $value = static::quote(''); + } + $script[] = static::call('log', static::quote('%s: %o'), static::quote((string) $key), $value); + } + + return $script; + } + + private static function quote(string $arg): string + { + return '"' . addcslashes($arg, "\"\n\\") . '"'; + } + + /** + * @param mixed $args + */ + private static function call(...$args): string + { + $method = array_shift($args); + if (!is_string($method)) { + throw new \UnexpectedValueException('Expected the first arg to be a string, got: '.var_export($method, true)); + } + + return static::call_array($method, $args); + } + + /** + * @param mixed[] $args + */ + private static function call_array(string $method, array $args): string + { + return 'c.' . $method . '(' . implode(', ', $args) . ');'; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php new file mode 100644 index 00000000..fcce5d63 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php @@ -0,0 +1,167 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\ResettableInterface; +use Monolog\Formatter\FormatterInterface; + +/** + * Buffers all records until closing the handler and then pass them as batch. + * + * This is useful for a MailHandler to send only one mail per request instead of + * sending one per log message. + * + * @author Christophe Coevoet <stof@notk.org> + * + * @phpstan-import-type Record from \Monolog\Logger + */ +class BufferHandler extends AbstractHandler implements ProcessableHandlerInterface, FormattableHandlerInterface +{ + use ProcessableHandlerTrait; + + /** @var HandlerInterface */ + protected $handler; + /** @var int */ + protected $bufferSize = 0; + /** @var int */ + protected $bufferLimit; + /** @var bool */ + protected $flushOnOverflow; + /** @var Record[] */ + protected $buffer = []; + /** @var bool */ + protected $initialized = false; + + /** + * @param HandlerInterface $handler Handler. + * @param int $bufferLimit How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. + * @param bool $flushOnOverflow If true, the buffer is flushed when the max size has been reached, by default oldest entries are discarded + */ + public function __construct(HandlerInterface $handler, int $bufferLimit = 0, $level = Logger::DEBUG, bool $bubble = true, bool $flushOnOverflow = false) + { + parent::__construct($level, $bubble); + $this->handler = $handler; + $this->bufferLimit = $bufferLimit; + $this->flushOnOverflow = $flushOnOverflow; + } + + /** + * {@inheritDoc} + */ + public function handle(array $record): bool + { + if ($record['level'] < $this->level) { + return false; + } + + if (!$this->initialized) { + // __destructor() doesn't get called on Fatal errors + register_shutdown_function([$this, 'close']); + $this->initialized = true; + } + + if ($this->bufferLimit > 0 && $this->bufferSize === $this->bufferLimit) { + if ($this->flushOnOverflow) { + $this->flush(); + } else { + array_shift($this->buffer); + $this->bufferSize--; + } + } + + if ($this->processors) { + /** @var Record $record */ + $record = $this->processRecord($record); + } + + $this->buffer[] = $record; + $this->bufferSize++; + + return false === $this->bubble; + } + + public function flush(): void + { + if ($this->bufferSize === 0) { + return; + } + + $this->handler->handleBatch($this->buffer); + $this->clear(); + } + + public function __destruct() + { + // suppress the parent behavior since we already have register_shutdown_function() + // to call close(), and the reference contained there will prevent this from being + // GC'd until the end of the request + } + + /** + * {@inheritDoc} + */ + public function close(): void + { + $this->flush(); + + $this->handler->close(); + } + + /** + * Clears the buffer without flushing any messages down to the wrapped handler. + */ + public function clear(): void + { + $this->bufferSize = 0; + $this->buffer = []; + } + + public function reset() + { + $this->flush(); + + parent::reset(); + + $this->resetProcessors(); + + if ($this->handler instanceof ResettableInterface) { + $this->handler->reset(); + } + } + + /** + * {@inheritDoc} + */ + public function setFormatter(FormatterInterface $formatter): HandlerInterface + { + if ($this->handler instanceof FormattableHandlerInterface) { + $this->handler->setFormatter($formatter); + + return $this; + } + + throw new \UnexpectedValueException('The nested handler of type '.get_class($this->handler).' does not support formatters.'); + } + + /** + * {@inheritDoc} + */ + public function getFormatter(): FormatterInterface + { + if ($this->handler instanceof FormattableHandlerInterface) { + return $this->handler->getFormatter(); + } + + throw new \UnexpectedValueException('The nested handler of type '.get_class($this->handler).' does not support formatters.'); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php new file mode 100644 index 00000000..234ecf61 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php @@ -0,0 +1,196 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\ChromePHPFormatter; +use Monolog\Formatter\FormatterInterface; +use Monolog\Logger; +use Monolog\Utils; + +/** + * Handler sending logs to the ChromePHP extension (http://www.chromephp.com/) + * + * This also works out of the box with Firefox 43+ + * + * @author Christophe Coevoet <stof@notk.org> + * + * @phpstan-import-type Record from \Monolog\Logger + */ +class ChromePHPHandler extends AbstractProcessingHandler +{ + use WebRequestRecognizerTrait; + + /** + * Version of the extension + */ + protected const VERSION = '4.0'; + + /** + * Header name + */ + protected const HEADER_NAME = 'X-ChromeLogger-Data'; + + /** + * Regular expression to detect supported browsers (matches any Chrome, or Firefox 43+) + */ + protected const USER_AGENT_REGEX = '{\b(?:Chrome/\d+(?:\.\d+)*|HeadlessChrome|Firefox/(?:4[3-9]|[5-9]\d|\d{3,})(?:\.\d)*)\b}'; + + /** @var bool */ + protected static $initialized = false; + + /** + * Tracks whether we sent too much data + * + * Chrome limits the headers to 4KB, so when we sent 3KB we stop sending + * + * @var bool + */ + protected static $overflowed = false; + + /** @var mixed[] */ + protected static $json = [ + 'version' => self::VERSION, + 'columns' => ['label', 'log', 'backtrace', 'type'], + 'rows' => [], + ]; + + /** @var bool */ + protected static $sendHeaders = true; + + public function __construct($level = Logger::DEBUG, bool $bubble = true) + { + parent::__construct($level, $bubble); + if (!function_exists('json_encode')) { + throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s ChromePHPHandler'); + } + } + + /** + * {@inheritDoc} + */ + public function handleBatch(array $records): void + { + if (!$this->isWebRequest()) { + return; + } + + $messages = []; + + foreach ($records as $record) { + if ($record['level'] < $this->level) { + continue; + } + /** @var Record $message */ + $message = $this->processRecord($record); + $messages[] = $message; + } + + if (!empty($messages)) { + $messages = $this->getFormatter()->formatBatch($messages); + self::$json['rows'] = array_merge(self::$json['rows'], $messages); + $this->send(); + } + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter(): FormatterInterface + { + return new ChromePHPFormatter(); + } + + /** + * Creates & sends header for a record + * + * @see sendHeader() + * @see send() + */ + protected function write(array $record): void + { + if (!$this->isWebRequest()) { + return; + } + + self::$json['rows'][] = $record['formatted']; + + $this->send(); + } + + /** + * Sends the log header + * + * @see sendHeader() + */ + protected function send(): void + { + if (self::$overflowed || !self::$sendHeaders) { + return; + } + + if (!self::$initialized) { + self::$initialized = true; + + self::$sendHeaders = $this->headersAccepted(); + if (!self::$sendHeaders) { + return; + } + + self::$json['request_uri'] = $_SERVER['REQUEST_URI'] ?? ''; + } + + $json = Utils::jsonEncode(self::$json, Utils::DEFAULT_JSON_FLAGS & ~JSON_UNESCAPED_UNICODE, true); + $data = base64_encode($json); + if (strlen($data) > 3 * 1024) { + self::$overflowed = true; + + $record = [ + 'message' => 'Incomplete logs, chrome header size limit reached', + 'context' => [], + 'level' => Logger::WARNING, + 'level_name' => Logger::getLevelName(Logger::WARNING), + 'channel' => 'monolog', + 'datetime' => new \DateTimeImmutable(), + 'extra' => [], + ]; + self::$json['rows'][count(self::$json['rows']) - 1] = $this->getFormatter()->format($record); + $json = Utils::jsonEncode(self::$json, Utils::DEFAULT_JSON_FLAGS & ~JSON_UNESCAPED_UNICODE, true); + $data = base64_encode($json); + } + + if (trim($data) !== '') { + $this->sendHeader(static::HEADER_NAME, $data); + } + } + + /** + * Send header string to the client + */ + protected function sendHeader(string $header, string $content): void + { + if (!headers_sent() && self::$sendHeaders) { + header(sprintf('%s: %s', $header, $content)); + } + } + + /** + * Verifies if the headers are accepted by the current user agent + */ + protected function headersAccepted(): bool + { + if (empty($_SERVER['HTTP_USER_AGENT'])) { + return false; + } + + return preg_match(static::USER_AGENT_REGEX, $_SERVER['HTTP_USER_AGENT']) === 1; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php new file mode 100644 index 00000000..52657613 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php @@ -0,0 +1,77 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\FormatterInterface; +use Monolog\Formatter\JsonFormatter; +use Monolog\Logger; + +/** + * CouchDB handler + * + * @author Markus Bachmann <markus.bachmann@bachi.biz> + */ +class CouchDBHandler extends AbstractProcessingHandler +{ + /** @var mixed[] */ + private $options; + + /** + * @param mixed[] $options + */ + public function __construct(array $options = [], $level = Logger::DEBUG, bool $bubble = true) + { + $this->options = array_merge([ + 'host' => 'localhost', + 'port' => 5984, + 'dbname' => 'logger', + 'username' => null, + 'password' => null, + ], $options); + + parent::__construct($level, $bubble); + } + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + $basicAuth = null; + if ($this->options['username']) { + $basicAuth = sprintf('%s:%s@', $this->options['username'], $this->options['password']); + } + + $url = 'http://'.$basicAuth.$this->options['host'].':'.$this->options['port'].'/'.$this->options['dbname']; + $context = stream_context_create([ + 'http' => [ + 'method' => 'POST', + 'content' => $record['formatted'], + 'ignore_errors' => true, + 'max_redirects' => 0, + 'header' => 'Content-type: application/json', + ], + ]); + + if (false === @file_get_contents($url, false, $context)) { + throw new \RuntimeException(sprintf('Could not connect to %s', $url)); + } + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter(): FormatterInterface + { + return new JsonFormatter(JsonFormatter::BATCH_MODE_JSON, false); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php new file mode 100644 index 00000000..3535a4fc --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php @@ -0,0 +1,167 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Utils; + +/** + * Logs to Cube. + * + * @link https://github.com/square/cube/wiki + * @author Wan Chen <kami@kamisama.me> + * @deprecated Since 2.8.0 and 3.2.0, Cube appears abandoned and thus we will drop this handler in Monolog 4 + */ +class CubeHandler extends AbstractProcessingHandler +{ + /** @var resource|\Socket|null */ + private $udpConnection = null; + /** @var resource|\CurlHandle|null */ + private $httpConnection = null; + /** @var string */ + private $scheme; + /** @var string */ + private $host; + /** @var int */ + private $port; + /** @var string[] */ + private $acceptedSchemes = ['http', 'udp']; + + /** + * Create a Cube handler + * + * @throws \UnexpectedValueException when given url is not a valid url. + * A valid url must consist of three parts : protocol://host:port + * Only valid protocols used by Cube are http and udp + */ + public function __construct(string $url, $level = Logger::DEBUG, bool $bubble = true) + { + $urlInfo = parse_url($url); + + if ($urlInfo === false || !isset($urlInfo['scheme'], $urlInfo['host'], $urlInfo['port'])) { + throw new \UnexpectedValueException('URL "'.$url.'" is not valid'); + } + + if (!in_array($urlInfo['scheme'], $this->acceptedSchemes)) { + throw new \UnexpectedValueException( + 'Invalid protocol (' . $urlInfo['scheme'] . ').' + . ' Valid options are ' . implode(', ', $this->acceptedSchemes) + ); + } + + $this->scheme = $urlInfo['scheme']; + $this->host = $urlInfo['host']; + $this->port = (int) $urlInfo['port']; + + parent::__construct($level, $bubble); + } + + /** + * Establish a connection to an UDP socket + * + * @throws \LogicException when unable to connect to the socket + * @throws MissingExtensionException when there is no socket extension + */ + protected function connectUdp(): void + { + if (!extension_loaded('sockets')) { + throw new MissingExtensionException('The sockets extension is required to use udp URLs with the CubeHandler'); + } + + $udpConnection = socket_create(AF_INET, SOCK_DGRAM, 0); + if (false === $udpConnection) { + throw new \LogicException('Unable to create a socket'); + } + + $this->udpConnection = $udpConnection; + if (!socket_connect($this->udpConnection, $this->host, $this->port)) { + throw new \LogicException('Unable to connect to the socket at ' . $this->host . ':' . $this->port); + } + } + + /** + * Establish a connection to an http server + * + * @throws \LogicException when unable to connect to the socket + * @throws MissingExtensionException when no curl extension + */ + protected function connectHttp(): void + { + if (!extension_loaded('curl')) { + throw new MissingExtensionException('The curl extension is required to use http URLs with the CubeHandler'); + } + + $httpConnection = curl_init('http://'.$this->host.':'.$this->port.'/1.0/event/put'); + if (false === $httpConnection) { + throw new \LogicException('Unable to connect to ' . $this->host . ':' . $this->port); + } + + $this->httpConnection = $httpConnection; + curl_setopt($this->httpConnection, CURLOPT_CUSTOMREQUEST, "POST"); + curl_setopt($this->httpConnection, CURLOPT_RETURNTRANSFER, true); + } + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + $date = $record['datetime']; + + $data = ['time' => $date->format('Y-m-d\TH:i:s.uO')]; + unset($record['datetime']); + + if (isset($record['context']['type'])) { + $data['type'] = $record['context']['type']; + unset($record['context']['type']); + } else { + $data['type'] = $record['channel']; + } + + $data['data'] = $record['context']; + $data['data']['level'] = $record['level']; + + if ($this->scheme === 'http') { + $this->writeHttp(Utils::jsonEncode($data)); + } else { + $this->writeUdp(Utils::jsonEncode($data)); + } + } + + private function writeUdp(string $data): void + { + if (!$this->udpConnection) { + $this->connectUdp(); + } + + socket_send($this->udpConnection, $data, strlen($data), 0); + } + + private function writeHttp(string $data): void + { + if (!$this->httpConnection) { + $this->connectHttp(); + } + + if (null === $this->httpConnection) { + throw new \LogicException('No connection could be established'); + } + + curl_setopt($this->httpConnection, CURLOPT_POSTFIELDS, '['.$data.']'); + curl_setopt($this->httpConnection, CURLOPT_HTTPHEADER, [ + 'Content-Type: application/json', + 'Content-Length: ' . strlen('['.$data.']'), + ]); + + Curl\Util::execute($this->httpConnection, 5, false); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php b/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php new file mode 100644 index 00000000..7213e8ee --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php @@ -0,0 +1,71 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler\Curl; + +use CurlHandle; + +/** + * This class is marked as internal and it is not under the BC promise of the package. + * + * @internal + */ +final class Util +{ + /** @var array<int> */ + private static $retriableErrorCodes = [ + CURLE_COULDNT_RESOLVE_HOST, + CURLE_COULDNT_CONNECT, + CURLE_HTTP_NOT_FOUND, + CURLE_READ_ERROR, + CURLE_OPERATION_TIMEOUTED, + CURLE_HTTP_POST_ERROR, + CURLE_SSL_CONNECT_ERROR, + ]; + + /** + * Executes a CURL request with optional retries and exception on failure + * + * @param resource|CurlHandle $ch curl handler + * @param int $retries + * @param bool $closeAfterDone + * @return bool|string @see curl_exec + */ + public static function execute($ch, int $retries = 5, bool $closeAfterDone = true) + { + while ($retries--) { + $curlResponse = curl_exec($ch); + if ($curlResponse === false) { + $curlErrno = curl_errno($ch); + + if (false === in_array($curlErrno, self::$retriableErrorCodes, true) || !$retries) { + $curlError = curl_error($ch); + + if ($closeAfterDone) { + curl_close($ch); + } + + throw new \RuntimeException(sprintf('Curl error (code %d): %s', $curlErrno, $curlError)); + } + + continue; + } + + if ($closeAfterDone) { + curl_close($ch); + } + + return $curlResponse; + } + + return false; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php new file mode 100644 index 00000000..9b85ae7e --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php @@ -0,0 +1,186 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Psr\Log\LogLevel; + +/** + * Simple handler wrapper that deduplicates log records across multiple requests + * + * It also includes the BufferHandler functionality and will buffer + * all messages until the end of the request or flush() is called. + * + * This works by storing all log records' messages above $deduplicationLevel + * to the file specified by $deduplicationStore. When further logs come in at the end of the + * request (or when flush() is called), all those above $deduplicationLevel are checked + * against the existing stored logs. If they match and the timestamps in the stored log is + * not older than $time seconds, the new log record is discarded. If no log record is new, the + * whole data set is discarded. + * + * This is mainly useful in combination with Mail handlers or things like Slack or HipChat handlers + * that send messages to people, to avoid spamming with the same message over and over in case of + * a major component failure like a database server being down which makes all requests fail in the + * same way. + * + * @author Jordi Boggiano <j.boggiano@seld.be> + * + * @phpstan-import-type Record from \Monolog\Logger + * @phpstan-import-type LevelName from \Monolog\Logger + * @phpstan-import-type Level from \Monolog\Logger + */ +class DeduplicationHandler extends BufferHandler +{ + /** + * @var string + */ + protected $deduplicationStore; + + /** + * @var Level + */ + protected $deduplicationLevel; + + /** + * @var int + */ + protected $time; + + /** + * @var bool + */ + private $gc = false; + + /** + * @param HandlerInterface $handler Handler. + * @param string $deduplicationStore The file/path where the deduplication log should be kept + * @param string|int $deduplicationLevel The minimum logging level for log records to be looked at for deduplication purposes + * @param int $time The period (in seconds) during which duplicate entries should be suppressed after a given log is sent through + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * + * @phpstan-param Level|LevelName|LogLevel::* $deduplicationLevel + */ + public function __construct(HandlerInterface $handler, ?string $deduplicationStore = null, $deduplicationLevel = Logger::ERROR, int $time = 60, bool $bubble = true) + { + parent::__construct($handler, 0, Logger::DEBUG, $bubble, false); + + $this->deduplicationStore = $deduplicationStore === null ? sys_get_temp_dir() . '/monolog-dedup-' . substr(md5(__FILE__), 0, 20) .'.log' : $deduplicationStore; + $this->deduplicationLevel = Logger::toMonologLevel($deduplicationLevel); + $this->time = $time; + } + + public function flush(): void + { + if ($this->bufferSize === 0) { + return; + } + + $passthru = null; + + foreach ($this->buffer as $record) { + if ($record['level'] >= $this->deduplicationLevel) { + $passthru = $passthru || !$this->isDuplicate($record); + if ($passthru) { + $this->appendRecord($record); + } + } + } + + // default of null is valid as well as if no record matches duplicationLevel we just pass through + if ($passthru === true || $passthru === null) { + $this->handler->handleBatch($this->buffer); + } + + $this->clear(); + + if ($this->gc) { + $this->collectLogs(); + } + } + + /** + * @phpstan-param Record $record + */ + private function isDuplicate(array $record): bool + { + if (!file_exists($this->deduplicationStore)) { + return false; + } + + $store = file($this->deduplicationStore, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); + if (!is_array($store)) { + return false; + } + + $yesterday = time() - 86400; + $timestampValidity = $record['datetime']->getTimestamp() - $this->time; + $expectedMessage = preg_replace('{[\r\n].*}', '', $record['message']); + + for ($i = count($store) - 1; $i >= 0; $i--) { + list($timestamp, $level, $message) = explode(':', $store[$i], 3); + + if ($level === $record['level_name'] && $message === $expectedMessage && $timestamp > $timestampValidity) { + return true; + } + + if ($timestamp < $yesterday) { + $this->gc = true; + } + } + + return false; + } + + private function collectLogs(): void + { + if (!file_exists($this->deduplicationStore)) { + return; + } + + $handle = fopen($this->deduplicationStore, 'rw+'); + + if (!$handle) { + throw new \RuntimeException('Failed to open file for reading and writing: ' . $this->deduplicationStore); + } + + flock($handle, LOCK_EX); + $validLogs = []; + + $timestampValidity = time() - $this->time; + + while (!feof($handle)) { + $log = fgets($handle); + if ($log && substr($log, 0, 10) >= $timestampValidity) { + $validLogs[] = $log; + } + } + + ftruncate($handle, 0); + rewind($handle); + foreach ($validLogs as $log) { + fwrite($handle, $log); + } + + flock($handle, LOCK_UN); + fclose($handle); + + $this->gc = false; + } + + /** + * @phpstan-param Record $record + */ + private function appendRecord(array $record): void + { + file_put_contents($this->deduplicationStore, $record['datetime']->getTimestamp() . ':' . $record['level_name'] . ':' . preg_replace('{[\r\n].*}', '', $record['message']) . "\n", FILE_APPEND); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php new file mode 100644 index 00000000..ebd52c3a --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php @@ -0,0 +1,47 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Formatter\NormalizerFormatter; +use Monolog\Formatter\FormatterInterface; +use Doctrine\CouchDB\CouchDBClient; + +/** + * CouchDB handler for Doctrine CouchDB ODM + * + * @author Markus Bachmann <markus.bachmann@bachi.biz> + */ +class DoctrineCouchDBHandler extends AbstractProcessingHandler +{ + /** @var CouchDBClient */ + private $client; + + public function __construct(CouchDBClient $client, $level = Logger::DEBUG, bool $bubble = true) + { + $this->client = $client; + parent::__construct($level, $bubble); + } + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + $this->client->postDocument($record['formatted']); + } + + protected function getDefaultFormatter(): FormatterInterface + { + return new NormalizerFormatter; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php new file mode 100644 index 00000000..21840bf6 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php @@ -0,0 +1,104 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Aws\Sdk; +use Aws\DynamoDb\DynamoDbClient; +use Monolog\Formatter\FormatterInterface; +use Aws\DynamoDb\Marshaler; +use Monolog\Formatter\ScalarFormatter; +use Monolog\Logger; + +/** + * Amazon DynamoDB handler (http://aws.amazon.com/dynamodb/) + * + * @link https://github.com/aws/aws-sdk-php/ + * @author Andrew Lawson <adlawson@gmail.com> + */ +class DynamoDbHandler extends AbstractProcessingHandler +{ + public const DATE_FORMAT = 'Y-m-d\TH:i:s.uO'; + + /** + * @var DynamoDbClient + */ + protected $client; + + /** + * @var string + */ + protected $table; + + /** + * @var int + */ + protected $version; + + /** + * @var Marshaler + */ + protected $marshaler; + + public function __construct(DynamoDbClient $client, string $table, $level = Logger::DEBUG, bool $bubble = true) + { + /** @phpstan-ignore-next-line */ + if (defined('Aws\Sdk::VERSION') && version_compare(Sdk::VERSION, '3.0', '>=')) { + $this->version = 3; + $this->marshaler = new Marshaler; + } else { + $this->version = 2; + } + + $this->client = $client; + $this->table = $table; + + parent::__construct($level, $bubble); + } + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + $filtered = $this->filterEmptyFields($record['formatted']); + if ($this->version === 3) { + $formatted = $this->marshaler->marshalItem($filtered); + } else { + /** @phpstan-ignore-next-line */ + $formatted = $this->client->formatAttributes($filtered); + } + + $this->client->putItem([ + 'TableName' => $this->table, + 'Item' => $formatted, + ]); + } + + /** + * @param mixed[] $record + * @return mixed[] + */ + protected function filterEmptyFields(array $record): array + { + return array_filter($record, function ($value) { + return !empty($value) || false === $value || 0 === $value; + }); + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter(): FormatterInterface + { + return new ScalarFormatter(self::DATE_FORMAT); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/ElasticaHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/ElasticaHandler.php new file mode 100644 index 00000000..fc92ca42 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/ElasticaHandler.php @@ -0,0 +1,129 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Elastica\Document; +use Monolog\Formatter\FormatterInterface; +use Monolog\Formatter\ElasticaFormatter; +use Monolog\Logger; +use Elastica\Client; +use Elastica\Exception\ExceptionInterface; + +/** + * Elastic Search handler + * + * Usage example: + * + * $client = new \Elastica\Client(); + * $options = array( + * 'index' => 'elastic_index_name', + * 'type' => 'elastic_doc_type', Types have been removed in Elastica 7 + * ); + * $handler = new ElasticaHandler($client, $options); + * $log = new Logger('application'); + * $log->pushHandler($handler); + * + * @author Jelle Vink <jelle.vink@gmail.com> + */ +class ElasticaHandler extends AbstractProcessingHandler +{ + /** + * @var Client + */ + protected $client; + + /** + * @var mixed[] Handler config options + */ + protected $options = []; + + /** + * @param Client $client Elastica Client object + * @param mixed[] $options Handler configuration + */ + public function __construct(Client $client, array $options = [], $level = Logger::DEBUG, bool $bubble = true) + { + parent::__construct($level, $bubble); + $this->client = $client; + $this->options = array_merge( + [ + 'index' => 'monolog', // Elastic index name + 'type' => 'record', // Elastic document type + 'ignore_error' => false, // Suppress Elastica exceptions + ], + $options + ); + } + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + $this->bulkSend([$record['formatted']]); + } + + /** + * {@inheritDoc} + */ + public function setFormatter(FormatterInterface $formatter): HandlerInterface + { + if ($formatter instanceof ElasticaFormatter) { + return parent::setFormatter($formatter); + } + + throw new \InvalidArgumentException('ElasticaHandler is only compatible with ElasticaFormatter'); + } + + /** + * @return mixed[] + */ + public function getOptions(): array + { + return $this->options; + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter(): FormatterInterface + { + return new ElasticaFormatter($this->options['index'], $this->options['type']); + } + + /** + * {@inheritDoc} + */ + public function handleBatch(array $records): void + { + $documents = $this->getFormatter()->formatBatch($records); + $this->bulkSend($documents); + } + + /** + * Use Elasticsearch bulk API to send list of documents + * + * @param Document[] $documents + * + * @throws \RuntimeException + */ + protected function bulkSend(array $documents): void + { + try { + $this->client->addDocuments($documents); + } catch (ExceptionInterface $e) { + if (!$this->options['ignore_error']) { + throw new \RuntimeException("Error sending messages to Elasticsearch", 0, $e); + } + } + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/ElasticsearchHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/ElasticsearchHandler.php new file mode 100644 index 00000000..e88375c0 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/ElasticsearchHandler.php @@ -0,0 +1,218 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Elastic\Elasticsearch\Response\Elasticsearch; +use Throwable; +use RuntimeException; +use Monolog\Logger; +use Monolog\Formatter\FormatterInterface; +use Monolog\Formatter\ElasticsearchFormatter; +use InvalidArgumentException; +use Elasticsearch\Common\Exceptions\RuntimeException as ElasticsearchRuntimeException; +use Elasticsearch\Client; +use Elastic\Elasticsearch\Exception\InvalidArgumentException as ElasticInvalidArgumentException; +use Elastic\Elasticsearch\Client as Client8; + +/** + * Elasticsearch handler + * + * @link https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/index.html + * + * Simple usage example: + * + * $client = \Elasticsearch\ClientBuilder::create() + * ->setHosts($hosts) + * ->build(); + * + * $options = array( + * 'index' => 'elastic_index_name', + * 'type' => 'elastic_doc_type', + * ); + * $handler = new ElasticsearchHandler($client, $options); + * $log = new Logger('application'); + * $log->pushHandler($handler); + * + * @author Avtandil Kikabidze <akalongman@gmail.com> + */ +class ElasticsearchHandler extends AbstractProcessingHandler +{ + /** + * @var Client|Client8 + */ + protected $client; + + /** + * @var mixed[] Handler config options + */ + protected $options = []; + + /** + * @var bool + */ + private $needsType; + + /** + * @param Client|Client8 $client Elasticsearch Client object + * @param mixed[] $options Handler configuration + */ + public function __construct($client, array $options = [], $level = Logger::DEBUG, bool $bubble = true) + { + if (!$client instanceof Client && !$client instanceof Client8) { + throw new \TypeError('Elasticsearch\Client or Elastic\Elasticsearch\Client instance required'); + } + + parent::__construct($level, $bubble); + $this->client = $client; + $this->options = array_merge( + [ + 'index' => 'monolog', // Elastic index name + 'type' => '_doc', // Elastic document type + 'ignore_error' => false, // Suppress Elasticsearch exceptions + ], + $options + ); + + if ($client instanceof Client8 || $client::VERSION[0] === '7') { + $this->needsType = false; + // force the type to _doc for ES8/ES7 + $this->options['type'] = '_doc'; + } else { + $this->needsType = true; + } + } + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + $this->bulkSend([$record['formatted']]); + } + + /** + * {@inheritDoc} + */ + public function setFormatter(FormatterInterface $formatter): HandlerInterface + { + if ($formatter instanceof ElasticsearchFormatter) { + return parent::setFormatter($formatter); + } + + throw new InvalidArgumentException('ElasticsearchHandler is only compatible with ElasticsearchFormatter'); + } + + /** + * Getter options + * + * @return mixed[] + */ + public function getOptions(): array + { + return $this->options; + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter(): FormatterInterface + { + return new ElasticsearchFormatter($this->options['index'], $this->options['type']); + } + + /** + * {@inheritDoc} + */ + public function handleBatch(array $records): void + { + $documents = $this->getFormatter()->formatBatch($records); + $this->bulkSend($documents); + } + + /** + * Use Elasticsearch bulk API to send list of documents + * + * @param array[] $records Records + _index/_type keys + * @throws \RuntimeException + */ + protected function bulkSend(array $records): void + { + try { + $params = [ + 'body' => [], + ]; + + foreach ($records as $record) { + $params['body'][] = [ + 'index' => $this->needsType ? [ + '_index' => $record['_index'], + '_type' => $record['_type'], + ] : [ + '_index' => $record['_index'], + ], + ]; + unset($record['_index'], $record['_type']); + + $params['body'][] = $record; + } + + /** @var Elasticsearch */ + $responses = $this->client->bulk($params); + + if ($responses['errors'] === true) { + throw $this->createExceptionFromResponses($responses); + } + } catch (Throwable $e) { + if (! $this->options['ignore_error']) { + throw new RuntimeException('Error sending messages to Elasticsearch', 0, $e); + } + } + } + + /** + * Creates elasticsearch exception from responses array + * + * Only the first error is converted into an exception. + * + * @param mixed[]|Elasticsearch $responses returned by $this->client->bulk() + */ + protected function createExceptionFromResponses($responses): Throwable + { + foreach ($responses['items'] ?? [] as $item) { + if (isset($item['index']['error'])) { + return $this->createExceptionFromError($item['index']['error']); + } + } + + if (class_exists(ElasticInvalidArgumentException::class)) { + return new ElasticInvalidArgumentException('Elasticsearch failed to index one or more records.'); + } + + return new ElasticsearchRuntimeException('Elasticsearch failed to index one or more records.'); + } + + /** + * Creates elasticsearch exception from error array + * + * @param mixed[] $error + */ + protected function createExceptionFromError(array $error): Throwable + { + $previous = isset($error['caused_by']) ? $this->createExceptionFromError($error['caused_by']) : null; + + if (class_exists(ElasticInvalidArgumentException::class)) { + return new ElasticInvalidArgumentException($error['type'] . ': ' . $error['reason'], 0, $previous); + } + + return new ElasticsearchRuntimeException($error['type'] . ': ' . $error['reason'], 0, $previous); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php new file mode 100644 index 00000000..f2e22036 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php @@ -0,0 +1,91 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\LineFormatter; +use Monolog\Formatter\FormatterInterface; +use Monolog\Logger; +use Monolog\Utils; + +/** + * Stores to PHP error_log() handler. + * + * @author Elan Ruusamäe <glen@delfi.ee> + */ +class ErrorLogHandler extends AbstractProcessingHandler +{ + public const OPERATING_SYSTEM = 0; + public const SAPI = 4; + + /** @var int */ + protected $messageType; + /** @var bool */ + protected $expandNewlines; + + /** + * @param int $messageType Says where the error should go. + * @param bool $expandNewlines If set to true, newlines in the message will be expanded to be take multiple log entries + */ + public function __construct(int $messageType = self::OPERATING_SYSTEM, $level = Logger::DEBUG, bool $bubble = true, bool $expandNewlines = false) + { + parent::__construct($level, $bubble); + + if (false === in_array($messageType, self::getAvailableTypes(), true)) { + $message = sprintf('The given message type "%s" is not supported', print_r($messageType, true)); + + throw new \InvalidArgumentException($message); + } + + $this->messageType = $messageType; + $this->expandNewlines = $expandNewlines; + } + + /** + * @return int[] With all available types + */ + public static function getAvailableTypes(): array + { + return [ + self::OPERATING_SYSTEM, + self::SAPI, + ]; + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter(): FormatterInterface + { + return new LineFormatter('[%datetime%] %channel%.%level_name%: %message% %context% %extra%'); + } + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + if (!$this->expandNewlines) { + error_log((string) $record['formatted'], $this->messageType); + + return; + } + + $lines = preg_split('{[\r\n]+}', (string) $record['formatted']); + if ($lines === false) { + $pcreErrorCode = preg_last_error(); + throw new \RuntimeException('Failed to preg_split formatted string: ' . $pcreErrorCode . ' / '. Utils::pcreLastErrorMessage($pcreErrorCode)); + } + foreach ($lines as $line) { + error_log($line, $this->messageType); + } + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FallbackGroupHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/FallbackGroupHandler.php new file mode 100644 index 00000000..d4e234ce --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/FallbackGroupHandler.php @@ -0,0 +1,71 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Throwable; + +/** + * Forwards records to at most one handler + * + * If a handler fails, the exception is suppressed and the record is forwarded to the next handler. + * + * As soon as one handler handles a record successfully, the handling stops there. + * + * @phpstan-import-type Record from \Monolog\Logger + */ +class FallbackGroupHandler extends GroupHandler +{ + /** + * {@inheritDoc} + */ + public function handle(array $record): bool + { + if ($this->processors) { + /** @var Record $record */ + $record = $this->processRecord($record); + } + foreach ($this->handlers as $handler) { + try { + $handler->handle($record); + break; + } catch (Throwable $e) { + // What throwable? + } + } + + return false === $this->bubble; + } + + /** + * {@inheritDoc} + */ + public function handleBatch(array $records): void + { + if ($this->processors) { + $processed = []; + foreach ($records as $record) { + $processed[] = $this->processRecord($record); + } + /** @var Record[] $records */ + $records = $processed; + } + + foreach ($this->handlers as $handler) { + try { + $handler->handleBatch($records); + break; + } catch (Throwable $e) { + // What throwable? + } + } + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php new file mode 100644 index 00000000..5e43e1dc --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php @@ -0,0 +1,212 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\ResettableInterface; +use Monolog\Formatter\FormatterInterface; +use Psr\Log\LogLevel; + +/** + * Simple handler wrapper that filters records based on a list of levels + * + * It can be configured with an exact list of levels to allow, or a min/max level. + * + * @author Hennadiy Verkh + * @author Jordi Boggiano <j.boggiano@seld.be> + * + * @phpstan-import-type Record from \Monolog\Logger + * @phpstan-import-type Level from \Monolog\Logger + * @phpstan-import-type LevelName from \Monolog\Logger + */ +class FilterHandler extends Handler implements ProcessableHandlerInterface, ResettableInterface, FormattableHandlerInterface +{ + use ProcessableHandlerTrait; + + /** + * Handler or factory callable($record, $this) + * + * @var callable|HandlerInterface + * @phpstan-var callable(?Record, HandlerInterface): HandlerInterface|HandlerInterface + */ + protected $handler; + + /** + * Minimum level for logs that are passed to handler + * + * @var int[] + * @phpstan-var array<Level, int> + */ + protected $acceptedLevels; + + /** + * Whether the messages that are handled can bubble up the stack or not + * + * @var bool + */ + protected $bubble; + + /** + * @psalm-param HandlerInterface|callable(?Record, HandlerInterface): HandlerInterface $handler + * + * @param callable|HandlerInterface $handler Handler or factory callable($record|null, $filterHandler). + * @param int|array $minLevelOrList A list of levels to accept or a minimum level if maxLevel is provided + * @param int|string $maxLevel Maximum level to accept, only used if $minLevelOrList is not an array + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * + * @phpstan-param Level|LevelName|LogLevel::*|array<Level|LevelName|LogLevel::*> $minLevelOrList + * @phpstan-param Level|LevelName|LogLevel::* $maxLevel + */ + public function __construct($handler, $minLevelOrList = Logger::DEBUG, $maxLevel = Logger::EMERGENCY, bool $bubble = true) + { + $this->handler = $handler; + $this->bubble = $bubble; + $this->setAcceptedLevels($minLevelOrList, $maxLevel); + + if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) { + throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object"); + } + } + + /** + * @phpstan-return array<int, Level> + */ + public function getAcceptedLevels(): array + { + return array_flip($this->acceptedLevels); + } + + /** + * @param int|string|array $minLevelOrList A list of levels to accept or a minimum level or level name if maxLevel is provided + * @param int|string $maxLevel Maximum level or level name to accept, only used if $minLevelOrList is not an array + * + * @phpstan-param Level|LevelName|LogLevel::*|array<Level|LevelName|LogLevel::*> $minLevelOrList + * @phpstan-param Level|LevelName|LogLevel::* $maxLevel + */ + public function setAcceptedLevels($minLevelOrList = Logger::DEBUG, $maxLevel = Logger::EMERGENCY): self + { + if (is_array($minLevelOrList)) { + $acceptedLevels = array_map('Monolog\Logger::toMonologLevel', $minLevelOrList); + } else { + $minLevelOrList = Logger::toMonologLevel($minLevelOrList); + $maxLevel = Logger::toMonologLevel($maxLevel); + $acceptedLevels = array_values(array_filter(Logger::getLevels(), function ($level) use ($minLevelOrList, $maxLevel) { + return $level >= $minLevelOrList && $level <= $maxLevel; + })); + } + $this->acceptedLevels = array_flip($acceptedLevels); + + return $this; + } + + /** + * {@inheritDoc} + */ + public function isHandling(array $record): bool + { + return isset($this->acceptedLevels[$record['level']]); + } + + /** + * {@inheritDoc} + */ + public function handle(array $record): bool + { + if (!$this->isHandling($record)) { + return false; + } + + if ($this->processors) { + /** @var Record $record */ + $record = $this->processRecord($record); + } + + $this->getHandler($record)->handle($record); + + return false === $this->bubble; + } + + /** + * {@inheritDoc} + */ + public function handleBatch(array $records): void + { + $filtered = []; + foreach ($records as $record) { + if ($this->isHandling($record)) { + $filtered[] = $record; + } + } + + if (count($filtered) > 0) { + $this->getHandler($filtered[count($filtered) - 1])->handleBatch($filtered); + } + } + + /** + * Return the nested handler + * + * If the handler was provided as a factory callable, this will trigger the handler's instantiation. + * + * @return HandlerInterface + * + * @phpstan-param Record $record + */ + public function getHandler(?array $record = null) + { + if (!$this->handler instanceof HandlerInterface) { + $this->handler = ($this->handler)($record, $this); + if (!$this->handler instanceof HandlerInterface) { + throw new \RuntimeException("The factory callable should return a HandlerInterface"); + } + } + + return $this->handler; + } + + /** + * {@inheritDoc} + */ + public function setFormatter(FormatterInterface $formatter): HandlerInterface + { + $handler = $this->getHandler(); + if ($handler instanceof FormattableHandlerInterface) { + $handler->setFormatter($formatter); + + return $this; + } + + throw new \UnexpectedValueException('The nested handler of type '.get_class($handler).' does not support formatters.'); + } + + /** + * {@inheritDoc} + */ + public function getFormatter(): FormatterInterface + { + $handler = $this->getHandler(); + if ($handler instanceof FormattableHandlerInterface) { + return $handler->getFormatter(); + } + + throw new \UnexpectedValueException('The nested handler of type '.get_class($handler).' does not support formatters.'); + } + + public function reset() + { + $this->resetProcessors(); + + if ($this->getHandler() instanceof ResettableInterface) { + $this->getHandler()->reset(); + } + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php new file mode 100644 index 00000000..0aa5607b --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler\FingersCrossed; + +/** + * Interface for activation strategies for the FingersCrossedHandler. + * + * @author Johannes M. Schmitt <schmittjoh@gmail.com> + * + * @phpstan-import-type Record from \Monolog\Logger + */ +interface ActivationStrategyInterface +{ + /** + * Returns whether the given record activates the handler. + * + * @phpstan-param Record $record + */ + public function isHandlerActivated(array $record): bool; +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php new file mode 100644 index 00000000..7b9abb58 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php @@ -0,0 +1,77 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler\FingersCrossed; + +use Monolog\Logger; +use Psr\Log\LogLevel; + +/** + * Channel and Error level based monolog activation strategy. Allows to trigger activation + * based on level per channel. e.g. trigger activation on level 'ERROR' by default, except + * for records of the 'sql' channel; those should trigger activation on level 'WARN'. + * + * Example: + * + * <code> + * $activationStrategy = new ChannelLevelActivationStrategy( + * Logger::CRITICAL, + * array( + * 'request' => Logger::ALERT, + * 'sensitive' => Logger::ERROR, + * ) + * ); + * $handler = new FingersCrossedHandler(new StreamHandler('php://stderr'), $activationStrategy); + * </code> + * + * @author Mike Meessen <netmikey@gmail.com> + * + * @phpstan-import-type Record from \Monolog\Logger + * @phpstan-import-type Level from \Monolog\Logger + * @phpstan-import-type LevelName from \Monolog\Logger + */ +class ChannelLevelActivationStrategy implements ActivationStrategyInterface +{ + /** + * @var Level + */ + private $defaultActionLevel; + + /** + * @var array<string, Level> + */ + private $channelToActionLevel; + + /** + * @param int|string $defaultActionLevel The default action level to be used if the record's category doesn't match any + * @param array<string, int> $channelToActionLevel An array that maps channel names to action levels. + * + * @phpstan-param array<string, Level> $channelToActionLevel + * @phpstan-param Level|LevelName|LogLevel::* $defaultActionLevel + */ + public function __construct($defaultActionLevel, array $channelToActionLevel = []) + { + $this->defaultActionLevel = Logger::toMonologLevel($defaultActionLevel); + $this->channelToActionLevel = array_map('Monolog\Logger::toMonologLevel', $channelToActionLevel); + } + + /** + * @phpstan-param Record $record + */ + public function isHandlerActivated(array $record): bool + { + if (isset($this->channelToActionLevel[$record['channel']])) { + return $record['level'] >= $this->channelToActionLevel[$record['channel']]; + } + + return $record['level'] >= $this->defaultActionLevel; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php new file mode 100644 index 00000000..5ec88eab --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php @@ -0,0 +1,46 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler\FingersCrossed; + +use Monolog\Logger; +use Psr\Log\LogLevel; + +/** + * Error level based activation strategy. + * + * @author Johannes M. Schmitt <schmittjoh@gmail.com> + * + * @phpstan-import-type Level from \Monolog\Logger + * @phpstan-import-type LevelName from \Monolog\Logger + */ +class ErrorLevelActivationStrategy implements ActivationStrategyInterface +{ + /** + * @var Level + */ + private $actionLevel; + + /** + * @param int|string $actionLevel Level or name or value + * + * @phpstan-param Level|LevelName|LogLevel::* $actionLevel + */ + public function __construct($actionLevel) + { + $this->actionLevel = Logger::toMonologLevel($actionLevel); + } + + public function isHandlerActivated(array $record): bool + { + return $record['level'] >= $this->actionLevel; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php new file mode 100644 index 00000000..dfcb3af2 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php @@ -0,0 +1,252 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy; +use Monolog\Handler\FingersCrossed\ActivationStrategyInterface; +use Monolog\Logger; +use Monolog\ResettableInterface; +use Monolog\Formatter\FormatterInterface; +use Psr\Log\LogLevel; + +/** + * Buffers all records until a certain level is reached + * + * The advantage of this approach is that you don't get any clutter in your log files. + * Only requests which actually trigger an error (or whatever your actionLevel is) will be + * in the logs, but they will contain all records, not only those above the level threshold. + * + * You can then have a passthruLevel as well which means that at the end of the request, + * even if it did not get activated, it will still send through log records of e.g. at least a + * warning level. + * + * You can find the various activation strategies in the + * Monolog\Handler\FingersCrossed\ namespace. + * + * @author Jordi Boggiano <j.boggiano@seld.be> + * + * @phpstan-import-type Record from \Monolog\Logger + * @phpstan-import-type Level from \Monolog\Logger + * @phpstan-import-type LevelName from \Monolog\Logger + */ +class FingersCrossedHandler extends Handler implements ProcessableHandlerInterface, ResettableInterface, FormattableHandlerInterface +{ + use ProcessableHandlerTrait; + + /** + * @var callable|HandlerInterface + * @phpstan-var callable(?Record, HandlerInterface): HandlerInterface|HandlerInterface + */ + protected $handler; + /** @var ActivationStrategyInterface */ + protected $activationStrategy; + /** @var bool */ + protected $buffering = true; + /** @var int */ + protected $bufferSize; + /** @var Record[] */ + protected $buffer = []; + /** @var bool */ + protected $stopBuffering; + /** + * @var ?int + * @phpstan-var ?Level + */ + protected $passthruLevel; + /** @var bool */ + protected $bubble; + + /** + * @psalm-param HandlerInterface|callable(?Record, HandlerInterface): HandlerInterface $handler + * + * @param callable|HandlerInterface $handler Handler or factory callable($record|null, $fingersCrossedHandler). + * @param int|string|ActivationStrategyInterface $activationStrategy Strategy which determines when this handler takes action, or a level name/value at which the handler is activated + * @param int $bufferSize How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param bool $stopBuffering Whether the handler should stop buffering after being triggered (default true) + * @param int|string $passthruLevel Minimum level to always flush to handler on close, even if strategy not triggered + * + * @phpstan-param Level|LevelName|LogLevel::* $passthruLevel + * @phpstan-param Level|LevelName|LogLevel::*|ActivationStrategyInterface $activationStrategy + */ + public function __construct($handler, $activationStrategy = null, int $bufferSize = 0, bool $bubble = true, bool $stopBuffering = true, $passthruLevel = null) + { + if (null === $activationStrategy) { + $activationStrategy = new ErrorLevelActivationStrategy(Logger::WARNING); + } + + // convert simple int activationStrategy to an object + if (!$activationStrategy instanceof ActivationStrategyInterface) { + $activationStrategy = new ErrorLevelActivationStrategy($activationStrategy); + } + + $this->handler = $handler; + $this->activationStrategy = $activationStrategy; + $this->bufferSize = $bufferSize; + $this->bubble = $bubble; + $this->stopBuffering = $stopBuffering; + + if ($passthruLevel !== null) { + $this->passthruLevel = Logger::toMonologLevel($passthruLevel); + } + + if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) { + throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object"); + } + } + + /** + * {@inheritDoc} + */ + public function isHandling(array $record): bool + { + return true; + } + + /** + * Manually activate this logger regardless of the activation strategy + */ + public function activate(): void + { + if ($this->stopBuffering) { + $this->buffering = false; + } + + $this->getHandler(end($this->buffer) ?: null)->handleBatch($this->buffer); + $this->buffer = []; + } + + /** + * {@inheritDoc} + */ + public function handle(array $record): bool + { + if ($this->processors) { + /** @var Record $record */ + $record = $this->processRecord($record); + } + + if ($this->buffering) { + $this->buffer[] = $record; + if ($this->bufferSize > 0 && count($this->buffer) > $this->bufferSize) { + array_shift($this->buffer); + } + if ($this->activationStrategy->isHandlerActivated($record)) { + $this->activate(); + } + } else { + $this->getHandler($record)->handle($record); + } + + return false === $this->bubble; + } + + /** + * {@inheritDoc} + */ + public function close(): void + { + $this->flushBuffer(); + + $this->getHandler()->close(); + } + + public function reset() + { + $this->flushBuffer(); + + $this->resetProcessors(); + + if ($this->getHandler() instanceof ResettableInterface) { + $this->getHandler()->reset(); + } + } + + /** + * Clears the buffer without flushing any messages down to the wrapped handler. + * + * It also resets the handler to its initial buffering state. + */ + public function clear(): void + { + $this->buffer = []; + $this->reset(); + } + + /** + * Resets the state of the handler. Stops forwarding records to the wrapped handler. + */ + private function flushBuffer(): void + { + if (null !== $this->passthruLevel) { + $level = $this->passthruLevel; + $this->buffer = array_filter($this->buffer, function ($record) use ($level) { + return $record['level'] >= $level; + }); + if (count($this->buffer) > 0) { + $this->getHandler(end($this->buffer))->handleBatch($this->buffer); + } + } + + $this->buffer = []; + $this->buffering = true; + } + + /** + * Return the nested handler + * + * If the handler was provided as a factory callable, this will trigger the handler's instantiation. + * + * @return HandlerInterface + * + * @phpstan-param Record $record + */ + public function getHandler(?array $record = null) + { + if (!$this->handler instanceof HandlerInterface) { + $this->handler = ($this->handler)($record, $this); + if (!$this->handler instanceof HandlerInterface) { + throw new \RuntimeException("The factory callable should return a HandlerInterface"); + } + } + + return $this->handler; + } + + /** + * {@inheritDoc} + */ + public function setFormatter(FormatterInterface $formatter): HandlerInterface + { + $handler = $this->getHandler(); + if ($handler instanceof FormattableHandlerInterface) { + $handler->setFormatter($formatter); + + return $this; + } + + throw new \UnexpectedValueException('The nested handler of type '.get_class($handler).' does not support formatters.'); + } + + /** + * {@inheritDoc} + */ + public function getFormatter(): FormatterInterface + { + $handler = $this->getHandler(); + if ($handler instanceof FormattableHandlerInterface) { + return $handler->getFormatter(); + } + + throw new \UnexpectedValueException('The nested handler of type '.get_class($handler).' does not support formatters.'); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php new file mode 100644 index 00000000..72718de6 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php @@ -0,0 +1,180 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\WildfireFormatter; +use Monolog\Formatter\FormatterInterface; + +/** + * Simple FirePHP Handler (http://www.firephp.org/), which uses the Wildfire protocol. + * + * @author Eric Clemmons (@ericclemmons) <eric@uxdriven.com> + * + * @phpstan-import-type FormattedRecord from AbstractProcessingHandler + */ +class FirePHPHandler extends AbstractProcessingHandler +{ + use WebRequestRecognizerTrait; + + /** + * WildFire JSON header message format + */ + protected const PROTOCOL_URI = 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2'; + + /** + * FirePHP structure for parsing messages & their presentation + */ + protected const STRUCTURE_URI = 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1'; + + /** + * Must reference a "known" plugin, otherwise headers won't display in FirePHP + */ + protected const PLUGIN_URI = 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3'; + + /** + * Header prefix for Wildfire to recognize & parse headers + */ + protected const HEADER_PREFIX = 'X-Wf'; + + /** + * Whether or not Wildfire vendor-specific headers have been generated & sent yet + * @var bool + */ + protected static $initialized = false; + + /** + * Shared static message index between potentially multiple handlers + * @var int + */ + protected static $messageIndex = 1; + + /** @var bool */ + protected static $sendHeaders = true; + + /** + * Base header creation function used by init headers & record headers + * + * @param array<int|string> $meta Wildfire Plugin, Protocol & Structure Indexes + * @param string $message Log message + * + * @return array<string, string> Complete header string ready for the client as key and message as value + * + * @phpstan-return non-empty-array<string, string> + */ + protected function createHeader(array $meta, string $message): array + { + $header = sprintf('%s-%s', static::HEADER_PREFIX, join('-', $meta)); + + return [$header => $message]; + } + + /** + * Creates message header from record + * + * @return array<string, string> + * + * @phpstan-return non-empty-array<string, string> + * + * @see createHeader() + * + * @phpstan-param FormattedRecord $record + */ + protected function createRecordHeader(array $record): array + { + // Wildfire is extensible to support multiple protocols & plugins in a single request, + // but we're not taking advantage of that (yet), so we're using "1" for simplicity's sake. + return $this->createHeader( + [1, 1, 1, self::$messageIndex++], + $record['formatted'] + ); + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter(): FormatterInterface + { + return new WildfireFormatter(); + } + + /** + * Wildfire initialization headers to enable message parsing + * + * @see createHeader() + * @see sendHeader() + * + * @return array<string, string> + */ + protected function getInitHeaders(): array + { + // Initial payload consists of required headers for Wildfire + return array_merge( + $this->createHeader(['Protocol', 1], static::PROTOCOL_URI), + $this->createHeader([1, 'Structure', 1], static::STRUCTURE_URI), + $this->createHeader([1, 'Plugin', 1], static::PLUGIN_URI) + ); + } + + /** + * Send header string to the client + */ + protected function sendHeader(string $header, string $content): void + { + if (!headers_sent() && self::$sendHeaders) { + header(sprintf('%s: %s', $header, $content)); + } + } + + /** + * Creates & sends header for a record, ensuring init headers have been sent prior + * + * @see sendHeader() + * @see sendInitHeaders() + */ + protected function write(array $record): void + { + if (!self::$sendHeaders || !$this->isWebRequest()) { + return; + } + + // WildFire-specific headers must be sent prior to any messages + if (!self::$initialized) { + self::$initialized = true; + + self::$sendHeaders = $this->headersAccepted(); + if (!self::$sendHeaders) { + return; + } + + foreach ($this->getInitHeaders() as $header => $content) { + $this->sendHeader($header, $content); + } + } + + $header = $this->createRecordHeader($record); + if (trim(current($header)) !== '') { + $this->sendHeader(key($header), current($header)); + } + } + + /** + * Verifies if the headers are accepted by the current user agent + */ + protected function headersAccepted(): bool + { + if (!empty($_SERVER['HTTP_USER_AGENT']) && preg_match('{\bFirePHP/\d+\.\d+\b}', $_SERVER['HTTP_USER_AGENT'])) { + return true; + } + + return isset($_SERVER['HTTP_X_FIREPHP_VERSION']); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php new file mode 100644 index 00000000..85c95b9d --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php @@ -0,0 +1,135 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\FormatterInterface; +use Monolog\Formatter\LineFormatter; +use Monolog\Logger; + +/** + * Sends logs to Fleep.io using Webhook integrations + * + * You'll need a Fleep.io account to use this handler. + * + * @see https://fleep.io/integrations/webhooks/ Fleep Webhooks Documentation + * @author Ando Roots <ando@sqroot.eu> + * + * @phpstan-import-type FormattedRecord from AbstractProcessingHandler + */ +class FleepHookHandler extends SocketHandler +{ + protected const FLEEP_HOST = 'fleep.io'; + + protected const FLEEP_HOOK_URI = '/hook/'; + + /** + * @var string Webhook token (specifies the conversation where logs are sent) + */ + protected $token; + + /** + * Construct a new Fleep.io Handler. + * + * For instructions on how to create a new web hook in your conversations + * see https://fleep.io/integrations/webhooks/ + * + * @param string $token Webhook token + * @throws MissingExtensionException + */ + public function __construct( + string $token, + $level = Logger::DEBUG, + bool $bubble = true, + bool $persistent = false, + float $timeout = 0.0, + float $writingTimeout = 10.0, + ?float $connectionTimeout = null, + ?int $chunkSize = null + ) { + if (!extension_loaded('openssl')) { + throw new MissingExtensionException('The OpenSSL PHP extension is required to use the FleepHookHandler'); + } + + $this->token = $token; + + $connectionString = 'ssl://' . static::FLEEP_HOST . ':443'; + parent::__construct( + $connectionString, + $level, + $bubble, + $persistent, + $timeout, + $writingTimeout, + $connectionTimeout, + $chunkSize + ); + } + + /** + * Returns the default formatter to use with this handler + * + * Overloaded to remove empty context and extra arrays from the end of the log message. + * + * @return LineFormatter + */ + protected function getDefaultFormatter(): FormatterInterface + { + return new LineFormatter(null, null, true, true); + } + + /** + * Handles a log record + */ + public function write(array $record): void + { + parent::write($record); + $this->closeSocket(); + } + + /** + * {@inheritDoc} + */ + protected function generateDataStream(array $record): string + { + $content = $this->buildContent($record); + + return $this->buildHeader($content) . $content; + } + + /** + * Builds the header of the API Call + */ + private function buildHeader(string $content): string + { + $header = "POST " . static::FLEEP_HOOK_URI . $this->token . " HTTP/1.1\r\n"; + $header .= "Host: " . static::FLEEP_HOST . "\r\n"; + $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; + $header .= "Content-Length: " . strlen($content) . "\r\n"; + $header .= "\r\n"; + + return $header; + } + + /** + * Builds the body of API call + * + * @phpstan-param FormattedRecord $record + */ + private function buildContent(array $record): string + { + $dataArray = [ + 'message' => $record['formatted'], + ]; + + return http_build_query($dataArray); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php new file mode 100644 index 00000000..5715d580 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php @@ -0,0 +1,133 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Utils; +use Monolog\Formatter\FlowdockFormatter; +use Monolog\Formatter\FormatterInterface; + +/** + * Sends notifications through the Flowdock push API + * + * This must be configured with a FlowdockFormatter instance via setFormatter() + * + * Notes: + * API token - Flowdock API token + * + * @author Dominik Liebler <liebler.dominik@gmail.com> + * @see https://www.flowdock.com/api/push + * + * @phpstan-import-type FormattedRecord from AbstractProcessingHandler + * @deprecated Since 2.9.0 and 3.3.0, Flowdock was shutdown we will thus drop this handler in Monolog 4 + */ +class FlowdockHandler extends SocketHandler +{ + /** + * @var string + */ + protected $apiToken; + + /** + * @throws MissingExtensionException if OpenSSL is missing + */ + public function __construct( + string $apiToken, + $level = Logger::DEBUG, + bool $bubble = true, + bool $persistent = false, + float $timeout = 0.0, + float $writingTimeout = 10.0, + ?float $connectionTimeout = null, + ?int $chunkSize = null + ) { + if (!extension_loaded('openssl')) { + throw new MissingExtensionException('The OpenSSL PHP extension is required to use the FlowdockHandler'); + } + + parent::__construct( + 'ssl://api.flowdock.com:443', + $level, + $bubble, + $persistent, + $timeout, + $writingTimeout, + $connectionTimeout, + $chunkSize + ); + $this->apiToken = $apiToken; + } + + /** + * {@inheritDoc} + */ + public function setFormatter(FormatterInterface $formatter): HandlerInterface + { + if (!$formatter instanceof FlowdockFormatter) { + throw new \InvalidArgumentException('The FlowdockHandler requires an instance of Monolog\Formatter\FlowdockFormatter to function correctly'); + } + + return parent::setFormatter($formatter); + } + + /** + * Gets the default formatter. + */ + protected function getDefaultFormatter(): FormatterInterface + { + throw new \InvalidArgumentException('The FlowdockHandler must be configured (via setFormatter) with an instance of Monolog\Formatter\FlowdockFormatter to function correctly'); + } + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + parent::write($record); + + $this->closeSocket(); + } + + /** + * {@inheritDoc} + */ + protected function generateDataStream(array $record): string + { + $content = $this->buildContent($record); + + return $this->buildHeader($content) . $content; + } + + /** + * Builds the body of API call + * + * @phpstan-param FormattedRecord $record + */ + private function buildContent(array $record): string + { + return Utils::jsonEncode($record['formatted']['flowdock']); + } + + /** + * Builds the header of the API Call + */ + private function buildHeader(string $content): string + { + $header = "POST /v1/messages/team_inbox/" . $this->apiToken . " HTTP/1.1\r\n"; + $header .= "Host: api.flowdock.com\r\n"; + $header .= "Content-Type: application/json\r\n"; + $header .= "Content-Length: " . strlen($content) . "\r\n"; + $header .= "\r\n"; + + return $header; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerInterface.php b/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerInterface.php new file mode 100644 index 00000000..fc1693cd --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerInterface.php @@ -0,0 +1,37 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\FormatterInterface; + +/** + * Interface to describe loggers that have a formatter + * + * @author Jordi Boggiano <j.boggiano@seld.be> + */ +interface FormattableHandlerInterface +{ + /** + * Sets the formatter. + * + * @param FormatterInterface $formatter + * @return HandlerInterface self + */ + public function setFormatter(FormatterInterface $formatter): HandlerInterface; + + /** + * Gets the formatter. + * + * @return FormatterInterface + */ + public function getFormatter(): FormatterInterface; +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerTrait.php b/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerTrait.php new file mode 100644 index 00000000..b60bdce0 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerTrait.php @@ -0,0 +1,60 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\FormatterInterface; +use Monolog\Formatter\LineFormatter; + +/** + * Helper trait for implementing FormattableInterface + * + * @author Jordi Boggiano <j.boggiano@seld.be> + */ +trait FormattableHandlerTrait +{ + /** + * @var ?FormatterInterface + */ + protected $formatter; + + /** + * {@inheritDoc} + */ + public function setFormatter(FormatterInterface $formatter): HandlerInterface + { + $this->formatter = $formatter; + + return $this; + } + + /** + * {@inheritDoc} + */ + public function getFormatter(): FormatterInterface + { + if (!$this->formatter) { + $this->formatter = $this->getDefaultFormatter(); + } + + return $this->formatter; + } + + /** + * Gets the default formatter. + * + * Overwrite this if the LineFormatter is not a good default for your handler. + */ + protected function getDefaultFormatter(): FormatterInterface + { + return new LineFormatter(); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php new file mode 100644 index 00000000..4ff26c4c --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php @@ -0,0 +1,57 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Gelf\PublisherInterface; +use Monolog\Logger; +use Monolog\Formatter\GelfMessageFormatter; +use Monolog\Formatter\FormatterInterface; + +/** + * Handler to send messages to a Graylog2 (http://www.graylog2.org) server + * + * @author Matt Lehner <mlehner@gmail.com> + * @author Benjamin Zikarsky <benjamin@zikarsky.de> + */ +class GelfHandler extends AbstractProcessingHandler +{ + /** + * @var PublisherInterface the publisher object that sends the message to the server + */ + protected $publisher; + + /** + * @param PublisherInterface $publisher a gelf publisher object + */ + public function __construct(PublisherInterface $publisher, $level = Logger::DEBUG, bool $bubble = true) + { + parent::__construct($level, $bubble); + + $this->publisher = $publisher; + } + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + $this->publisher->publish($record['formatted']); + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter(): FormatterInterface + { + return new GelfMessageFormatter(); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php new file mode 100644 index 00000000..3c9dc4b3 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php @@ -0,0 +1,132 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\FormatterInterface; +use Monolog\ResettableInterface; + +/** + * Forwards records to multiple handlers + * + * @author Lenar Lõhmus <lenar@city.ee> + * + * @phpstan-import-type Record from \Monolog\Logger + */ +class GroupHandler extends Handler implements ProcessableHandlerInterface, ResettableInterface +{ + use ProcessableHandlerTrait; + + /** @var HandlerInterface[] */ + protected $handlers; + /** @var bool */ + protected $bubble; + + /** + * @param HandlerInterface[] $handlers Array of Handlers. + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + */ + public function __construct(array $handlers, bool $bubble = true) + { + foreach ($handlers as $handler) { + if (!$handler instanceof HandlerInterface) { + throw new \InvalidArgumentException('The first argument of the GroupHandler must be an array of HandlerInterface instances.'); + } + } + + $this->handlers = $handlers; + $this->bubble = $bubble; + } + + /** + * {@inheritDoc} + */ + public function isHandling(array $record): bool + { + foreach ($this->handlers as $handler) { + if ($handler->isHandling($record)) { + return true; + } + } + + return false; + } + + /** + * {@inheritDoc} + */ + public function handle(array $record): bool + { + if ($this->processors) { + /** @var Record $record */ + $record = $this->processRecord($record); + } + + foreach ($this->handlers as $handler) { + $handler->handle($record); + } + + return false === $this->bubble; + } + + /** + * {@inheritDoc} + */ + public function handleBatch(array $records): void + { + if ($this->processors) { + $processed = []; + foreach ($records as $record) { + $processed[] = $this->processRecord($record); + } + /** @var Record[] $records */ + $records = $processed; + } + + foreach ($this->handlers as $handler) { + $handler->handleBatch($records); + } + } + + public function reset() + { + $this->resetProcessors(); + + foreach ($this->handlers as $handler) { + if ($handler instanceof ResettableInterface) { + $handler->reset(); + } + } + } + + public function close(): void + { + parent::close(); + + foreach ($this->handlers as $handler) { + $handler->close(); + } + } + + /** + * {@inheritDoc} + */ + public function setFormatter(FormatterInterface $formatter): HandlerInterface + { + foreach ($this->handlers as $handler) { + if ($handler instanceof FormattableHandlerInterface) { + $handler->setFormatter($formatter); + } + } + + return $this; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/Handler.php b/vendor/monolog/monolog/src/Monolog/Handler/Handler.php new file mode 100644 index 00000000..34b4935d --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/Handler.php @@ -0,0 +1,62 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +/** + * Base Handler class providing basic close() support as well as handleBatch + * + * @author Jordi Boggiano <j.boggiano@seld.be> + */ +abstract class Handler implements HandlerInterface +{ + /** + * {@inheritDoc} + */ + public function handleBatch(array $records): void + { + foreach ($records as $record) { + $this->handle($record); + } + } + + /** + * {@inheritDoc} + */ + public function close(): void + { + } + + public function __destruct() + { + try { + $this->close(); + } catch (\Throwable $e) { + // do nothing + } + } + + public function __sleep() + { + $this->close(); + + $reflClass = new \ReflectionClass($this); + + $keys = []; + foreach ($reflClass->getProperties() as $reflProp) { + if (!$reflProp->isStatic()) { + $keys[] = $reflProp->getName(); + } + } + + return $keys; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php b/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php new file mode 100644 index 00000000..affcc51f --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php @@ -0,0 +1,85 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +/** + * Interface that all Monolog Handlers must implement + * + * @author Jordi Boggiano <j.boggiano@seld.be> + * + * @phpstan-import-type Record from \Monolog\Logger + * @phpstan-import-type Level from \Monolog\Logger + */ +interface HandlerInterface +{ + /** + * Checks whether the given record will be handled by this handler. + * + * This is mostly done for performance reasons, to avoid calling processors for nothing. + * + * Handlers should still check the record levels within handle(), returning false in isHandling() + * is no guarantee that handle() will not be called, and isHandling() might not be called + * for a given record. + * + * @param array $record Partial log record containing only a level key + * + * @return bool + * + * @phpstan-param array{level: Level} $record + */ + public function isHandling(array $record): bool; + + /** + * Handles a record. + * + * All records may be passed to this method, and the handler should discard + * those that it does not want to handle. + * + * The return value of this function controls the bubbling process of the handler stack. + * Unless the bubbling is interrupted (by returning true), the Logger class will keep on + * calling further handlers in the stack with a given log record. + * + * @param array $record The record to handle + * @return bool true means that this handler handled the record, and that bubbling is not permitted. + * false means the record was either not processed or that this handler allows bubbling. + * + * @phpstan-param Record $record + */ + public function handle(array $record): bool; + + /** + * Handles a set of records at once. + * + * @param array $records The records to handle (an array of record arrays) + * + * @phpstan-param Record[] $records + */ + public function handleBatch(array $records): void; + + /** + * Closes the handler. + * + * Ends a log cycle and frees all resources used by the handler. + * + * Closing a Handler means flushing all buffers and freeing any open resources/handles. + * + * Implementations have to be idempotent (i.e. it should be possible to call close several times without breakage) + * and ideally handlers should be able to reopen themselves on handle() after they have been closed. + * + * This is useful at the end of a request and will be called automatically when the object + * is destroyed if you extend Monolog\Handler\Handler. + * + * If you are thinking of calling this method yourself, most likely you should be + * calling ResettableInterface::reset instead. Have a look. + */ + public function close(): void; +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php b/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php new file mode 100644 index 00000000..d4351b9f --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php @@ -0,0 +1,136 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\ResettableInterface; +use Monolog\Formatter\FormatterInterface; + +/** + * This simple wrapper class can be used to extend handlers functionality. + * + * Example: A custom filtering that can be applied to any handler. + * + * Inherit from this class and override handle() like this: + * + * public function handle(array $record) + * { + * if ($record meets certain conditions) { + * return false; + * } + * return $this->handler->handle($record); + * } + * + * @author Alexey Karapetov <alexey@karapetov.com> + */ +class HandlerWrapper implements HandlerInterface, ProcessableHandlerInterface, FormattableHandlerInterface, ResettableInterface +{ + /** + * @var HandlerInterface + */ + protected $handler; + + public function __construct(HandlerInterface $handler) + { + $this->handler = $handler; + } + + /** + * {@inheritDoc} + */ + public function isHandling(array $record): bool + { + return $this->handler->isHandling($record); + } + + /** + * {@inheritDoc} + */ + public function handle(array $record): bool + { + return $this->handler->handle($record); + } + + /** + * {@inheritDoc} + */ + public function handleBatch(array $records): void + { + $this->handler->handleBatch($records); + } + + /** + * {@inheritDoc} + */ + public function close(): void + { + $this->handler->close(); + } + + /** + * {@inheritDoc} + */ + public function pushProcessor(callable $callback): HandlerInterface + { + if ($this->handler instanceof ProcessableHandlerInterface) { + $this->handler->pushProcessor($callback); + + return $this; + } + + throw new \LogicException('The wrapped handler does not implement ' . ProcessableHandlerInterface::class); + } + + /** + * {@inheritDoc} + */ + public function popProcessor(): callable + { + if ($this->handler instanceof ProcessableHandlerInterface) { + return $this->handler->popProcessor(); + } + + throw new \LogicException('The wrapped handler does not implement ' . ProcessableHandlerInterface::class); + } + + /** + * {@inheritDoc} + */ + public function setFormatter(FormatterInterface $formatter): HandlerInterface + { + if ($this->handler instanceof FormattableHandlerInterface) { + $this->handler->setFormatter($formatter); + + return $this; + } + + throw new \LogicException('The wrapped handler does not implement ' . FormattableHandlerInterface::class); + } + + /** + * {@inheritDoc} + */ + public function getFormatter(): FormatterInterface + { + if ($this->handler instanceof FormattableHandlerInterface) { + return $this->handler->getFormatter(); + } + + throw new \LogicException('The wrapped handler does not implement ' . FormattableHandlerInterface::class); + } + + public function reset() + { + if ($this->handler instanceof ResettableInterface) { + $this->handler->reset(); + } + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php new file mode 100644 index 00000000..000ccea4 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php @@ -0,0 +1,74 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Utils; + +/** + * IFTTTHandler uses cURL to trigger IFTTT Maker actions + * + * Register a secret key and trigger/event name at https://ifttt.com/maker + * + * value1 will be the channel from monolog's Logger constructor, + * value2 will be the level name (ERROR, WARNING, ..) + * value3 will be the log record's message + * + * @author Nehal Patel <nehal@nehalpatel.me> + */ +class IFTTTHandler extends AbstractProcessingHandler +{ + /** @var string */ + private $eventName; + /** @var string */ + private $secretKey; + + /** + * @param string $eventName The name of the IFTTT Maker event that should be triggered + * @param string $secretKey A valid IFTTT secret key + */ + public function __construct(string $eventName, string $secretKey, $level = Logger::ERROR, bool $bubble = true) + { + if (!extension_loaded('curl')) { + throw new MissingExtensionException('The curl extension is needed to use the IFTTTHandler'); + } + + $this->eventName = $eventName; + $this->secretKey = $secretKey; + + parent::__construct($level, $bubble); + } + + /** + * {@inheritDoc} + */ + public function write(array $record): void + { + $postData = [ + "value1" => $record["channel"], + "value2" => $record["level_name"], + "value3" => $record["message"], + ]; + $postString = Utils::jsonEncode($postData); + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, "https://maker.ifttt.com/trigger/" . $this->eventName . "/with/key/" . $this->secretKey); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, $postString); + curl_setopt($ch, CURLOPT_HTTPHEADER, [ + "Content-Type: application/json", + ]); + + Curl\Util::execute($ch); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php new file mode 100644 index 00000000..71f64a26 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php @@ -0,0 +1,76 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; + +/** + * Inspired on LogEntriesHandler. + * + * @author Robert Kaufmann III <rok3@rok3.me> + * @author Gabriel Machado <gabriel.ms1@hotmail.com> + */ +class InsightOpsHandler extends SocketHandler +{ + /** + * @var string + */ + protected $logToken; + + /** + * @param string $token Log token supplied by InsightOps + * @param string $region Region where InsightOps account is hosted. Could be 'us' or 'eu'. + * @param bool $useSSL Whether or not SSL encryption should be used + * + * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing + */ + public function __construct( + string $token, + string $region = 'us', + bool $useSSL = true, + $level = Logger::DEBUG, + bool $bubble = true, + bool $persistent = false, + float $timeout = 0.0, + float $writingTimeout = 10.0, + ?float $connectionTimeout = null, + ?int $chunkSize = null + ) { + if ($useSSL && !extension_loaded('openssl')) { + throw new MissingExtensionException('The OpenSSL PHP plugin is required to use SSL encrypted connection for InsightOpsHandler'); + } + + $endpoint = $useSSL + ? 'ssl://' . $region . '.data.logs.insight.rapid7.com:443' + : $region . '.data.logs.insight.rapid7.com:80'; + + parent::__construct( + $endpoint, + $level, + $bubble, + $persistent, + $timeout, + $writingTimeout, + $connectionTimeout, + $chunkSize + ); + $this->logToken = $token; + } + + /** + * {@inheritDoc} + */ + protected function generateDataStream(array $record): string + { + return $this->logToken . ' ' . $record['formatted']; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php new file mode 100644 index 00000000..25fcd159 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php @@ -0,0 +1,70 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; + +/** + * @author Robert Kaufmann III <rok3@rok3.me> + */ +class LogEntriesHandler extends SocketHandler +{ + /** + * @var string + */ + protected $logToken; + + /** + * @param string $token Log token supplied by LogEntries + * @param bool $useSSL Whether or not SSL encryption should be used. + * @param string $host Custom hostname to send the data to if needed + * + * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing + */ + public function __construct( + string $token, + bool $useSSL = true, + $level = Logger::DEBUG, + bool $bubble = true, + string $host = 'data.logentries.com', + bool $persistent = false, + float $timeout = 0.0, + float $writingTimeout = 10.0, + ?float $connectionTimeout = null, + ?int $chunkSize = null + ) { + if ($useSSL && !extension_loaded('openssl')) { + throw new MissingExtensionException('The OpenSSL PHP plugin is required to use SSL encrypted connection for LogEntriesHandler'); + } + + $endpoint = $useSSL ? 'ssl://' . $host . ':443' : $host . ':80'; + parent::__construct( + $endpoint, + $level, + $bubble, + $persistent, + $timeout, + $writingTimeout, + $connectionTimeout, + $chunkSize + ); + $this->logToken = $token; + } + + /** + * {@inheritDoc} + */ + protected function generateDataStream(array $record): string + { + return $this->logToken . ' ' . $record['formatted']; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php new file mode 100644 index 00000000..6d13db37 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php @@ -0,0 +1,160 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Formatter\FormatterInterface; +use Monolog\Formatter\LogglyFormatter; +use function array_key_exists; +use CurlHandle; + +/** + * Sends errors to Loggly. + * + * @author Przemek Sobstel <przemek@sobstel.org> + * @author Adam Pancutt <adam@pancutt.com> + * @author Gregory Barchard <gregory@barchard.net> + */ +class LogglyHandler extends AbstractProcessingHandler +{ + protected const HOST = 'logs-01.loggly.com'; + protected const ENDPOINT_SINGLE = 'inputs'; + protected const ENDPOINT_BATCH = 'bulk'; + + /** + * Caches the curl handlers for every given endpoint. + * + * @var resource[]|CurlHandle[] + */ + protected $curlHandlers = []; + + /** @var string */ + protected $token; + + /** @var string[] */ + protected $tag = []; + + /** + * @param string $token API token supplied by Loggly + * + * @throws MissingExtensionException If the curl extension is missing + */ + public function __construct(string $token, $level = Logger::DEBUG, bool $bubble = true) + { + if (!extension_loaded('curl')) { + throw new MissingExtensionException('The curl extension is needed to use the LogglyHandler'); + } + + $this->token = $token; + + parent::__construct($level, $bubble); + } + + /** + * Loads and returns the shared curl handler for the given endpoint. + * + * @param string $endpoint + * + * @return resource|CurlHandle + */ + protected function getCurlHandler(string $endpoint) + { + if (!array_key_exists($endpoint, $this->curlHandlers)) { + $this->curlHandlers[$endpoint] = $this->loadCurlHandle($endpoint); + } + + return $this->curlHandlers[$endpoint]; + } + + /** + * Starts a fresh curl session for the given endpoint and returns its handler. + * + * @param string $endpoint + * + * @return resource|CurlHandle + */ + private function loadCurlHandle(string $endpoint) + { + $url = sprintf("https://%s/%s/%s/", static::HOST, $endpoint, $this->token); + + $ch = curl_init(); + + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + + return $ch; + } + + /** + * @param string[]|string $tag + */ + public function setTag($tag): self + { + $tag = !empty($tag) ? $tag : []; + $this->tag = is_array($tag) ? $tag : [$tag]; + + return $this; + } + + /** + * @param string[]|string $tag + */ + public function addTag($tag): self + { + if (!empty($tag)) { + $tag = is_array($tag) ? $tag : [$tag]; + $this->tag = array_unique(array_merge($this->tag, $tag)); + } + + return $this; + } + + protected function write(array $record): void + { + $this->send($record["formatted"], static::ENDPOINT_SINGLE); + } + + public function handleBatch(array $records): void + { + $level = $this->level; + + $records = array_filter($records, function ($record) use ($level) { + return ($record['level'] >= $level); + }); + + if ($records) { + $this->send($this->getFormatter()->formatBatch($records), static::ENDPOINT_BATCH); + } + } + + protected function send(string $data, string $endpoint): void + { + $ch = $this->getCurlHandler($endpoint); + + $headers = ['Content-Type: application/json']; + + if (!empty($this->tag)) { + $headers[] = 'X-LOGGLY-TAG: '.implode(',', $this->tag); + } + + curl_setopt($ch, CURLOPT_POSTFIELDS, $data); + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + + Curl\Util::execute($ch, 5, false); + } + + protected function getDefaultFormatter(): FormatterInterface + { + return new LogglyFormatter(); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/LogmaticHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/LogmaticHandler.php new file mode 100644 index 00000000..859a4690 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/LogmaticHandler.php @@ -0,0 +1,106 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Formatter\FormatterInterface; +use Monolog\Formatter\LogmaticFormatter; + +/** + * @author Julien Breux <julien.breux@gmail.com> + */ +class LogmaticHandler extends SocketHandler +{ + /** + * @var string + */ + private $logToken; + + /** + * @var string + */ + private $hostname; + + /** + * @var string + */ + private $appname; + + /** + * @param string $token Log token supplied by Logmatic. + * @param string $hostname Host name supplied by Logmatic. + * @param string $appname Application name supplied by Logmatic. + * @param bool $useSSL Whether or not SSL encryption should be used. + * + * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing + */ + public function __construct( + string $token, + string $hostname = '', + string $appname = '', + bool $useSSL = true, + $level = Logger::DEBUG, + bool $bubble = true, + bool $persistent = false, + float $timeout = 0.0, + float $writingTimeout = 10.0, + ?float $connectionTimeout = null, + ?int $chunkSize = null + ) { + if ($useSSL && !extension_loaded('openssl')) { + throw new MissingExtensionException('The OpenSSL PHP extension is required to use SSL encrypted connection for LogmaticHandler'); + } + + $endpoint = $useSSL ? 'ssl://api.logmatic.io:10515' : 'api.logmatic.io:10514'; + $endpoint .= '/v1/'; + + parent::__construct( + $endpoint, + $level, + $bubble, + $persistent, + $timeout, + $writingTimeout, + $connectionTimeout, + $chunkSize + ); + + $this->logToken = $token; + $this->hostname = $hostname; + $this->appname = $appname; + } + + /** + * {@inheritDoc} + */ + protected function generateDataStream(array $record): string + { + return $this->logToken . ' ' . $record['formatted']; + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter(): FormatterInterface + { + $formatter = new LogmaticFormatter(); + + if (!empty($this->hostname)) { + $formatter->setHostname($this->hostname); + } + if (!empty($this->appname)) { + $formatter->setAppname($this->appname); + } + + return $formatter; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php new file mode 100644 index 00000000..97f34320 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php @@ -0,0 +1,95 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\FormatterInterface; +use Monolog\Formatter\HtmlFormatter; + +/** + * Base class for all mail handlers + * + * @author Gyula Sallai + * + * @phpstan-import-type Record from \Monolog\Logger + */ +abstract class MailHandler extends AbstractProcessingHandler +{ + /** + * {@inheritDoc} + */ + public function handleBatch(array $records): void + { + $messages = []; + + foreach ($records as $record) { + if ($record['level'] < $this->level) { + continue; + } + /** @var Record $message */ + $message = $this->processRecord($record); + $messages[] = $message; + } + + if (!empty($messages)) { + $this->send((string) $this->getFormatter()->formatBatch($messages), $messages); + } + } + + /** + * Send a mail with the given content + * + * @param string $content formatted email body to be sent + * @param array $records the array of log records that formed this content + * + * @phpstan-param Record[] $records + */ + abstract protected function send(string $content, array $records): void; + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + $this->send((string) $record['formatted'], [$record]); + } + + /** + * @phpstan-param non-empty-array<Record> $records + * @phpstan-return Record + */ + protected function getHighestRecord(array $records): array + { + $highestRecord = null; + foreach ($records as $record) { + if ($highestRecord === null || $highestRecord['level'] < $record['level']) { + $highestRecord = $record; + } + } + + return $highestRecord; + } + + protected function isHtmlBody(string $body): bool + { + return ($body[0] ?? null) === '<'; + } + + /** + * Gets the default formatter. + * + * @return FormatterInterface + */ + protected function getDefaultFormatter(): FormatterInterface + { + return new HtmlFormatter(); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php new file mode 100644 index 00000000..3003500e --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php @@ -0,0 +1,83 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Swift; +use Swift_Message; + +/** + * MandrillHandler uses cURL to send the emails to the Mandrill API + * + * @author Adam Nicholson <adamnicholson10@gmail.com> + */ +class MandrillHandler extends MailHandler +{ + /** @var Swift_Message */ + protected $message; + /** @var string */ + protected $apiKey; + + /** + * @psalm-param Swift_Message|callable(): Swift_Message $message + * + * @param string $apiKey A valid Mandrill API key + * @param callable|Swift_Message $message An example message for real messages, only the body will be replaced + */ + public function __construct(string $apiKey, $message, $level = Logger::ERROR, bool $bubble = true) + { + parent::__construct($level, $bubble); + + if (!$message instanceof Swift_Message && is_callable($message)) { + $message = $message(); + } + if (!$message instanceof Swift_Message) { + throw new \InvalidArgumentException('You must provide either a Swift_Message instance or a callable returning it'); + } + $this->message = $message; + $this->apiKey = $apiKey; + } + + /** + * {@inheritDoc} + */ + protected function send(string $content, array $records): void + { + $mime = 'text/plain'; + if ($this->isHtmlBody($content)) { + $mime = 'text/html'; + } + + $message = clone $this->message; + $message->setBody($content, $mime); + /** @phpstan-ignore-next-line */ + if (version_compare(Swift::VERSION, '6.0.0', '>=')) { + $message->setDate(new \DateTimeImmutable()); + } else { + /** @phpstan-ignore-next-line */ + $message->setDate(time()); + } + + $ch = curl_init(); + + curl_setopt($ch, CURLOPT_URL, 'https://mandrillapp.com/api/1.0/messages/send-raw.json'); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([ + 'key' => $this->apiKey, + 'raw_message' => (string) $message, + 'async' => false, + ])); + + Curl\Util::execute($ch); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php b/vendor/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php new file mode 100644 index 00000000..3965aeea --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php @@ -0,0 +1,21 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +/** + * Exception can be thrown if an extension for a handler is missing + * + * @author Christian Bergau <cbergau86@gmail.com> + */ +class MissingExtensionException extends \Exception +{ +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php new file mode 100644 index 00000000..30630911 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php @@ -0,0 +1,86 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use MongoDB\Driver\BulkWrite; +use MongoDB\Driver\Manager; +use MongoDB\Client; +use Monolog\Logger; +use Monolog\Formatter\FormatterInterface; +use Monolog\Formatter\MongoDBFormatter; + +/** + * Logs to a MongoDB database. + * + * Usage example: + * + * $log = new \Monolog\Logger('application'); + * $client = new \MongoDB\Client('mongodb://localhost:27017'); + * $mongodb = new \Monolog\Handler\MongoDBHandler($client, 'logs', 'prod'); + * $log->pushHandler($mongodb); + * + * The above examples uses the MongoDB PHP library's client class; however, the + * MongoDB\Driver\Manager class from ext-mongodb is also supported. + */ +class MongoDBHandler extends AbstractProcessingHandler +{ + /** @var \MongoDB\Collection */ + private $collection; + /** @var Client|Manager */ + private $manager; + /** @var string */ + private $namespace; + + /** + * Constructor. + * + * @param Client|Manager $mongodb MongoDB library or driver client + * @param string $database Database name + * @param string $collection Collection name + */ + public function __construct($mongodb, string $database, string $collection, $level = Logger::DEBUG, bool $bubble = true) + { + if (!($mongodb instanceof Client || $mongodb instanceof Manager)) { + throw new \InvalidArgumentException('MongoDB\Client or MongoDB\Driver\Manager instance required'); + } + + if ($mongodb instanceof Client) { + $this->collection = $mongodb->selectCollection($database, $collection); + } else { + $this->manager = $mongodb; + $this->namespace = $database . '.' . $collection; + } + + parent::__construct($level, $bubble); + } + + protected function write(array $record): void + { + if (isset($this->collection)) { + $this->collection->insertOne($record['formatted']); + } + + if (isset($this->manager, $this->namespace)) { + $bulk = new BulkWrite; + $bulk->insert($record["formatted"]); + $this->manager->executeBulkWrite($this->namespace, $bulk); + } + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter(): FormatterInterface + { + return new MongoDBFormatter; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php new file mode 100644 index 00000000..0c0a3bdb --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php @@ -0,0 +1,174 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Formatter\LineFormatter; + +/** + * NativeMailerHandler uses the mail() function to send the emails + * + * @author Christophe Coevoet <stof@notk.org> + * @author Mark Garrett <mark@moderndeveloperllc.com> + */ +class NativeMailerHandler extends MailHandler +{ + /** + * The email addresses to which the message will be sent + * @var string[] + */ + protected $to; + + /** + * The subject of the email + * @var string + */ + protected $subject; + + /** + * Optional headers for the message + * @var string[] + */ + protected $headers = []; + + /** + * Optional parameters for the message + * @var string[] + */ + protected $parameters = []; + + /** + * The wordwrap length for the message + * @var int + */ + protected $maxColumnWidth; + + /** + * The Content-type for the message + * @var string|null + */ + protected $contentType; + + /** + * The encoding for the message + * @var string + */ + protected $encoding = 'utf-8'; + + /** + * @param string|string[] $to The receiver of the mail + * @param string $subject The subject of the mail + * @param string $from The sender of the mail + * @param int $maxColumnWidth The maximum column width that the message lines will have + */ + public function __construct($to, string $subject, string $from, $level = Logger::ERROR, bool $bubble = true, int $maxColumnWidth = 70) + { + parent::__construct($level, $bubble); + $this->to = (array) $to; + $this->subject = $subject; + $this->addHeader(sprintf('From: %s', $from)); + $this->maxColumnWidth = $maxColumnWidth; + } + + /** + * Add headers to the message + * + * @param string|string[] $headers Custom added headers + */ + public function addHeader($headers): self + { + foreach ((array) $headers as $header) { + if (strpos($header, "\n") !== false || strpos($header, "\r") !== false) { + throw new \InvalidArgumentException('Headers can not contain newline characters for security reasons'); + } + $this->headers[] = $header; + } + + return $this; + } + + /** + * Add parameters to the message + * + * @param string|string[] $parameters Custom added parameters + */ + public function addParameter($parameters): self + { + $this->parameters = array_merge($this->parameters, (array) $parameters); + + return $this; + } + + /** + * {@inheritDoc} + */ + protected function send(string $content, array $records): void + { + $contentType = $this->getContentType() ?: ($this->isHtmlBody($content) ? 'text/html' : 'text/plain'); + + if ($contentType !== 'text/html') { + $content = wordwrap($content, $this->maxColumnWidth); + } + + $headers = ltrim(implode("\r\n", $this->headers) . "\r\n", "\r\n"); + $headers .= 'Content-type: ' . $contentType . '; charset=' . $this->getEncoding() . "\r\n"; + if ($contentType === 'text/html' && false === strpos($headers, 'MIME-Version:')) { + $headers .= 'MIME-Version: 1.0' . "\r\n"; + } + + $subject = $this->subject; + if ($records) { + $subjectFormatter = new LineFormatter($this->subject); + $subject = $subjectFormatter->format($this->getHighestRecord($records)); + } + + $parameters = implode(' ', $this->parameters); + foreach ($this->to as $to) { + mail($to, $subject, $content, $headers, $parameters); + } + } + + public function getContentType(): ?string + { + return $this->contentType; + } + + public function getEncoding(): string + { + return $this->encoding; + } + + /** + * @param string $contentType The content type of the email - Defaults to text/plain. Use text/html for HTML messages. + */ + public function setContentType(string $contentType): self + { + if (strpos($contentType, "\n") !== false || strpos($contentType, "\r") !== false) { + throw new \InvalidArgumentException('The content type can not contain newline characters to prevent email header injection'); + } + + $this->contentType = $contentType; + + return $this; + } + + public function setEncoding(string $encoding): self + { + if (strpos($encoding, "\n") !== false || strpos($encoding, "\r") !== false) { + throw new \InvalidArgumentException('The encoding can not contain newline characters to prevent email header injection'); + } + + $this->encoding = $encoding; + + return $this; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php new file mode 100644 index 00000000..114d749e --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php @@ -0,0 +1,199 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Utils; +use Monolog\Formatter\NormalizerFormatter; +use Monolog\Formatter\FormatterInterface; + +/** + * Class to record a log on a NewRelic application. + * Enabling New Relic High Security mode may prevent capture of useful information. + * + * This handler requires a NormalizerFormatter to function and expects an array in $record['formatted'] + * + * @see https://docs.newrelic.com/docs/agents/php-agent + * @see https://docs.newrelic.com/docs/accounts-partnerships/accounts/security/high-security + */ +class NewRelicHandler extends AbstractProcessingHandler +{ + /** + * Name of the New Relic application that will receive logs from this handler. + * + * @var ?string + */ + protected $appName; + + /** + * Name of the current transaction + * + * @var ?string + */ + protected $transactionName; + + /** + * Some context and extra data is passed into the handler as arrays of values. Do we send them as is + * (useful if we are using the API), or explode them for display on the NewRelic RPM website? + * + * @var bool + */ + protected $explodeArrays; + + /** + * {@inheritDoc} + * + * @param string|null $appName + * @param bool $explodeArrays + * @param string|null $transactionName + */ + public function __construct( + $level = Logger::ERROR, + bool $bubble = true, + ?string $appName = null, + bool $explodeArrays = false, + ?string $transactionName = null + ) { + parent::__construct($level, $bubble); + + $this->appName = $appName; + $this->explodeArrays = $explodeArrays; + $this->transactionName = $transactionName; + } + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + if (!$this->isNewRelicEnabled()) { + throw new MissingExtensionException('The newrelic PHP extension is required to use the NewRelicHandler'); + } + + if ($appName = $this->getAppName($record['context'])) { + $this->setNewRelicAppName($appName); + } + + if ($transactionName = $this->getTransactionName($record['context'])) { + $this->setNewRelicTransactionName($transactionName); + unset($record['formatted']['context']['transaction_name']); + } + + if (isset($record['context']['exception']) && $record['context']['exception'] instanceof \Throwable) { + newrelic_notice_error($record['message'], $record['context']['exception']); + unset($record['formatted']['context']['exception']); + } else { + newrelic_notice_error($record['message']); + } + + if (isset($record['formatted']['context']) && is_array($record['formatted']['context'])) { + foreach ($record['formatted']['context'] as $key => $parameter) { + if (is_array($parameter) && $this->explodeArrays) { + foreach ($parameter as $paramKey => $paramValue) { + $this->setNewRelicParameter('context_' . $key . '_' . $paramKey, $paramValue); + } + } else { + $this->setNewRelicParameter('context_' . $key, $parameter); + } + } + } + + if (isset($record['formatted']['extra']) && is_array($record['formatted']['extra'])) { + foreach ($record['formatted']['extra'] as $key => $parameter) { + if (is_array($parameter) && $this->explodeArrays) { + foreach ($parameter as $paramKey => $paramValue) { + $this->setNewRelicParameter('extra_' . $key . '_' . $paramKey, $paramValue); + } + } else { + $this->setNewRelicParameter('extra_' . $key, $parameter); + } + } + } + } + + /** + * Checks whether the NewRelic extension is enabled in the system. + * + * @return bool + */ + protected function isNewRelicEnabled(): bool + { + return extension_loaded('newrelic'); + } + + /** + * Returns the appname where this log should be sent. Each log can override the default appname, set in this + * handler's constructor, by providing the appname in it's context. + * + * @param mixed[] $context + */ + protected function getAppName(array $context): ?string + { + if (isset($context['appname'])) { + return $context['appname']; + } + + return $this->appName; + } + + /** + * Returns the name of the current transaction. Each log can override the default transaction name, set in this + * handler's constructor, by providing the transaction_name in it's context + * + * @param mixed[] $context + */ + protected function getTransactionName(array $context): ?string + { + if (isset($context['transaction_name'])) { + return $context['transaction_name']; + } + + return $this->transactionName; + } + + /** + * Sets the NewRelic application that should receive this log. + */ + protected function setNewRelicAppName(string $appName): void + { + newrelic_set_appname($appName); + } + + /** + * Overwrites the name of the current transaction + */ + protected function setNewRelicTransactionName(string $transactionName): void + { + newrelic_name_transaction($transactionName); + } + + /** + * @param string $key + * @param mixed $value + */ + protected function setNewRelicParameter(string $key, $value): void + { + if (null === $value || is_scalar($value)) { + newrelic_add_custom_parameter($key, $value); + } else { + newrelic_add_custom_parameter($key, Utils::jsonEncode($value, null, true)); + } + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter(): FormatterInterface + { + return new NormalizerFormatter(); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/NoopHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/NoopHandler.php new file mode 100644 index 00000000..1ddf0beb --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/NoopHandler.php @@ -0,0 +1,40 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +/** + * No-op + * + * This handler handles anything, but does nothing, and does not stop bubbling to the rest of the stack. + * This can be used for testing, or to disable a handler when overriding a configuration without + * influencing the rest of the stack. + * + * @author Roel Harbers <roelharbers@gmail.com> + */ +class NoopHandler extends Handler +{ + /** + * {@inheritDoc} + */ + public function isHandling(array $record): bool + { + return true; + } + + /** + * {@inheritDoc} + */ + public function handle(array $record): bool + { + return false; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php new file mode 100644 index 00000000..e75ee0c6 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php @@ -0,0 +1,60 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Psr\Log\LogLevel; + +/** + * Blackhole + * + * Any record it can handle will be thrown away. This can be used + * to put on top of an existing stack to override it temporarily. + * + * @author Jordi Boggiano <j.boggiano@seld.be> + * + * @phpstan-import-type Level from \Monolog\Logger + * @phpstan-import-type LevelName from \Monolog\Logger + */ +class NullHandler extends Handler +{ + /** + * @var int + */ + private $level; + + /** + * @param string|int $level The minimum logging level at which this handler will be triggered + * + * @phpstan-param Level|LevelName|LogLevel::* $level + */ + public function __construct($level = Logger::DEBUG) + { + $this->level = Logger::toMonologLevel($level); + } + + /** + * {@inheritDoc} + */ + public function isHandling(array $record): bool + { + return $record['level'] >= $this->level; + } + + /** + * {@inheritDoc} + */ + public function handle(array $record): bool + { + return $record['level'] >= $this->level; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/OverflowHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/OverflowHandler.php new file mode 100644 index 00000000..22068c9a --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/OverflowHandler.php @@ -0,0 +1,149 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Formatter\FormatterInterface; + +/** + * Handler to only pass log messages when a certain threshold of number of messages is reached. + * + * This can be useful in cases of processing a batch of data, but you're for example only interested + * in case it fails catastrophically instead of a warning for 1 or 2 events. Worse things can happen, right? + * + * Usage example: + * + * ``` + * $log = new Logger('application'); + * $handler = new SomeHandler(...) + * + * // Pass all warnings to the handler when more than 10 & all error messages when more then 5 + * $overflow = new OverflowHandler($handler, [Logger::WARNING => 10, Logger::ERROR => 5]); + * + * $log->pushHandler($overflow); + *``` + * + * @author Kris Buist <krisbuist@gmail.com> + */ +class OverflowHandler extends AbstractHandler implements FormattableHandlerInterface +{ + /** @var HandlerInterface */ + private $handler; + + /** @var int[] */ + private $thresholdMap = [ + Logger::DEBUG => 0, + Logger::INFO => 0, + Logger::NOTICE => 0, + Logger::WARNING => 0, + Logger::ERROR => 0, + Logger::CRITICAL => 0, + Logger::ALERT => 0, + Logger::EMERGENCY => 0, + ]; + + /** + * Buffer of all messages passed to the handler before the threshold was reached + * + * @var mixed[][] + */ + private $buffer = []; + + /** + * @param HandlerInterface $handler + * @param int[] $thresholdMap Dictionary of logger level => threshold + */ + public function __construct( + HandlerInterface $handler, + array $thresholdMap = [], + $level = Logger::DEBUG, + bool $bubble = true + ) { + $this->handler = $handler; + foreach ($thresholdMap as $thresholdLevel => $threshold) { + $this->thresholdMap[$thresholdLevel] = $threshold; + } + parent::__construct($level, $bubble); + } + + /** + * Handles a record. + * + * All records may be passed to this method, and the handler should discard + * those that it does not want to handle. + * + * The return value of this function controls the bubbling process of the handler stack. + * Unless the bubbling is interrupted (by returning true), the Logger class will keep on + * calling further handlers in the stack with a given log record. + * + * {@inheritDoc} + */ + public function handle(array $record): bool + { + if ($record['level'] < $this->level) { + return false; + } + + $level = $record['level']; + + if (!isset($this->thresholdMap[$level])) { + $this->thresholdMap[$level] = 0; + } + + if ($this->thresholdMap[$level] > 0) { + // The overflow threshold is not yet reached, so we're buffering the record and lowering the threshold by 1 + $this->thresholdMap[$level]--; + $this->buffer[$level][] = $record; + + return false === $this->bubble; + } + + if ($this->thresholdMap[$level] == 0) { + // This current message is breaking the threshold. Flush the buffer and continue handling the current record + foreach ($this->buffer[$level] ?? [] as $buffered) { + $this->handler->handle($buffered); + } + $this->thresholdMap[$level]--; + unset($this->buffer[$level]); + } + + $this->handler->handle($record); + + return false === $this->bubble; + } + + /** + * {@inheritDoc} + */ + public function setFormatter(FormatterInterface $formatter): HandlerInterface + { + if ($this->handler instanceof FormattableHandlerInterface) { + $this->handler->setFormatter($formatter); + + return $this; + } + + throw new \UnexpectedValueException('The nested handler of type '.get_class($this->handler).' does not support formatters.'); + } + + /** + * {@inheritDoc} + */ + public function getFormatter(): FormatterInterface + { + if ($this->handler instanceof FormattableHandlerInterface) { + return $this->handler->getFormatter(); + } + + throw new \UnexpectedValueException('The nested handler of type '.get_class($this->handler).' does not support formatters.'); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php new file mode 100644 index 00000000..23a1d117 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php @@ -0,0 +1,263 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\LineFormatter; +use Monolog\Formatter\FormatterInterface; +use Monolog\Logger; +use Monolog\Utils; +use PhpConsole\Connector; +use PhpConsole\Handler as VendorPhpConsoleHandler; +use PhpConsole\Helper; + +/** + * Monolog handler for Google Chrome extension "PHP Console" + * + * Display PHP error/debug log messages in Google Chrome console and notification popups, executes PHP code remotely + * + * Usage: + * 1. Install Google Chrome extension [now dead and removed from the chrome store] + * 2. See overview https://github.com/barbushin/php-console#overview + * 3. Install PHP Console library https://github.com/barbushin/php-console#installation + * 4. Example (result will looks like http://i.hizliresim.com/vg3Pz4.png) + * + * $logger = new \Monolog\Logger('all', array(new \Monolog\Handler\PHPConsoleHandler())); + * \Monolog\ErrorHandler::register($logger); + * echo $undefinedVar; + * $logger->debug('SELECT * FROM users', array('db', 'time' => 0.012)); + * PC::debug($_SERVER); // PHP Console debugger for any type of vars + * + * @author Sergey Barbushin https://www.linkedin.com/in/barbushin + * + * @phpstan-import-type Record from \Monolog\Logger + * @deprecated Since 2.8.0 and 3.2.0, PHPConsole is abandoned and thus we will drop this handler in Monolog 4 + */ +class PHPConsoleHandler extends AbstractProcessingHandler +{ + /** @var array<string, mixed> */ + private $options = [ + 'enabled' => true, // bool Is PHP Console server enabled + 'classesPartialsTraceIgnore' => ['Monolog\\'], // array Hide calls of classes started with... + 'debugTagsKeysInContext' => [0, 'tag'], // bool Is PHP Console server enabled + 'useOwnErrorsHandler' => false, // bool Enable errors handling + 'useOwnExceptionsHandler' => false, // bool Enable exceptions handling + 'sourcesBasePath' => null, // string Base path of all project sources to strip in errors source paths + 'registerHelper' => true, // bool Register PhpConsole\Helper that allows short debug calls like PC::debug($var, 'ta.g.s') + 'serverEncoding' => null, // string|null Server internal encoding + 'headersLimit' => null, // int|null Set headers size limit for your web-server + 'password' => null, // string|null Protect PHP Console connection by password + 'enableSslOnlyMode' => false, // bool Force connection by SSL for clients with PHP Console installed + 'ipMasks' => [], // array Set IP masks of clients that will be allowed to connect to PHP Console: array('192.168.*.*', '127.0.0.1') + 'enableEvalListener' => false, // bool Enable eval request to be handled by eval dispatcher(if enabled, 'password' option is also required) + 'dumperDetectCallbacks' => false, // bool Convert callback items in dumper vars to (callback SomeClass::someMethod) strings + 'dumperLevelLimit' => 5, // int Maximum dumped vars array or object nested dump level + 'dumperItemsCountLimit' => 100, // int Maximum dumped var same level array items or object properties number + 'dumperItemSizeLimit' => 5000, // int Maximum length of any string or dumped array item + 'dumperDumpSizeLimit' => 500000, // int Maximum approximate size of dumped vars result formatted in JSON + 'detectDumpTraceAndSource' => false, // bool Autodetect and append trace data to debug + 'dataStorage' => null, // \PhpConsole\Storage|null Fixes problem with custom $_SESSION handler(see http://goo.gl/Ne8juJ) + ]; + + /** @var Connector */ + private $connector; + + /** + * @param array<string, mixed> $options See \Monolog\Handler\PHPConsoleHandler::$options for more details + * @param Connector|null $connector Instance of \PhpConsole\Connector class (optional) + * @throws \RuntimeException + */ + public function __construct(array $options = [], ?Connector $connector = null, $level = Logger::DEBUG, bool $bubble = true) + { + if (!class_exists('PhpConsole\Connector')) { + throw new \RuntimeException('PHP Console library not found. See https://github.com/barbushin/php-console#installation'); + } + parent::__construct($level, $bubble); + $this->options = $this->initOptions($options); + $this->connector = $this->initConnector($connector); + } + + /** + * @param array<string, mixed> $options + * + * @return array<string, mixed> + */ + private function initOptions(array $options): array + { + $wrongOptions = array_diff(array_keys($options), array_keys($this->options)); + if ($wrongOptions) { + throw new \RuntimeException('Unknown options: ' . implode(', ', $wrongOptions)); + } + + return array_replace($this->options, $options); + } + + private function initConnector(?Connector $connector = null): Connector + { + if (!$connector) { + if ($this->options['dataStorage']) { + Connector::setPostponeStorage($this->options['dataStorage']); + } + $connector = Connector::getInstance(); + } + + if ($this->options['registerHelper'] && !Helper::isRegistered()) { + Helper::register(); + } + + if ($this->options['enabled'] && $connector->isActiveClient()) { + if ($this->options['useOwnErrorsHandler'] || $this->options['useOwnExceptionsHandler']) { + $handler = VendorPhpConsoleHandler::getInstance(); + $handler->setHandleErrors($this->options['useOwnErrorsHandler']); + $handler->setHandleExceptions($this->options['useOwnExceptionsHandler']); + $handler->start(); + } + if ($this->options['sourcesBasePath']) { + $connector->setSourcesBasePath($this->options['sourcesBasePath']); + } + if ($this->options['serverEncoding']) { + $connector->setServerEncoding($this->options['serverEncoding']); + } + if ($this->options['password']) { + $connector->setPassword($this->options['password']); + } + if ($this->options['enableSslOnlyMode']) { + $connector->enableSslOnlyMode(); + } + if ($this->options['ipMasks']) { + $connector->setAllowedIpMasks($this->options['ipMasks']); + } + if ($this->options['headersLimit']) { + $connector->setHeadersLimit($this->options['headersLimit']); + } + if ($this->options['detectDumpTraceAndSource']) { + $connector->getDebugDispatcher()->detectTraceAndSource = true; + } + $dumper = $connector->getDumper(); + $dumper->levelLimit = $this->options['dumperLevelLimit']; + $dumper->itemsCountLimit = $this->options['dumperItemsCountLimit']; + $dumper->itemSizeLimit = $this->options['dumperItemSizeLimit']; + $dumper->dumpSizeLimit = $this->options['dumperDumpSizeLimit']; + $dumper->detectCallbacks = $this->options['dumperDetectCallbacks']; + if ($this->options['enableEvalListener']) { + $connector->startEvalRequestsListener(); + } + } + + return $connector; + } + + public function getConnector(): Connector + { + return $this->connector; + } + + /** + * @return array<string, mixed> + */ + public function getOptions(): array + { + return $this->options; + } + + public function handle(array $record): bool + { + if ($this->options['enabled'] && $this->connector->isActiveClient()) { + return parent::handle($record); + } + + return !$this->bubble; + } + + /** + * Writes the record down to the log of the implementing handler + */ + protected function write(array $record): void + { + if ($record['level'] < Logger::NOTICE) { + $this->handleDebugRecord($record); + } elseif (isset($record['context']['exception']) && $record['context']['exception'] instanceof \Throwable) { + $this->handleExceptionRecord($record); + } else { + $this->handleErrorRecord($record); + } + } + + /** + * @phpstan-param Record $record + */ + private function handleDebugRecord(array $record): void + { + $tags = $this->getRecordTags($record); + $message = $record['message']; + if ($record['context']) { + $message .= ' ' . Utils::jsonEncode($this->connector->getDumper()->dump(array_filter($record['context'])), null, true); + } + $this->connector->getDebugDispatcher()->dispatchDebug($message, $tags, $this->options['classesPartialsTraceIgnore']); + } + + /** + * @phpstan-param Record $record + */ + private function handleExceptionRecord(array $record): void + { + $this->connector->getErrorsDispatcher()->dispatchException($record['context']['exception']); + } + + /** + * @phpstan-param Record $record + */ + private function handleErrorRecord(array $record): void + { + $context = $record['context']; + + $this->connector->getErrorsDispatcher()->dispatchError( + $context['code'] ?? null, + $context['message'] ?? $record['message'], + $context['file'] ?? null, + $context['line'] ?? null, + $this->options['classesPartialsTraceIgnore'] + ); + } + + /** + * @phpstan-param Record $record + * @return string + */ + private function getRecordTags(array &$record) + { + $tags = null; + if (!empty($record['context'])) { + $context = & $record['context']; + foreach ($this->options['debugTagsKeysInContext'] as $key) { + if (!empty($context[$key])) { + $tags = $context[$key]; + if ($key === 0) { + array_shift($context); + } else { + unset($context[$key]); + } + break; + } + } + } + + return $tags ?: strtolower($record['level_name']); + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter(): FormatterInterface + { + return new LineFormatter('%message%'); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/ProcessHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/ProcessHandler.php new file mode 100644 index 00000000..8a8cf1be --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/ProcessHandler.php @@ -0,0 +1,191 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; + +/** + * Stores to STDIN of any process, specified by a command. + * + * Usage example: + * <pre> + * $log = new Logger('myLogger'); + * $log->pushHandler(new ProcessHandler('/usr/bin/php /var/www/monolog/someScript.php')); + * </pre> + * + * @author Kolja Zuelsdorf <koljaz@web.de> + */ +class ProcessHandler extends AbstractProcessingHandler +{ + /** + * Holds the process to receive data on its STDIN. + * + * @var resource|bool|null + */ + private $process; + + /** + * @var string + */ + private $command; + + /** + * @var string|null + */ + private $cwd; + + /** + * @var resource[] + */ + private $pipes = []; + + /** + * @var array<int, string[]> + */ + protected const DESCRIPTOR_SPEC = [ + 0 => ['pipe', 'r'], // STDIN is a pipe that the child will read from + 1 => ['pipe', 'w'], // STDOUT is a pipe that the child will write to + 2 => ['pipe', 'w'], // STDERR is a pipe to catch the any errors + ]; + + /** + * @param string $command Command for the process to start. Absolute paths are recommended, + * especially if you do not use the $cwd parameter. + * @param string|null $cwd "Current working directory" (CWD) for the process to be executed in. + * @throws \InvalidArgumentException + */ + public function __construct(string $command, $level = Logger::DEBUG, bool $bubble = true, ?string $cwd = null) + { + if ($command === '') { + throw new \InvalidArgumentException('The command argument must be a non-empty string.'); + } + if ($cwd === '') { + throw new \InvalidArgumentException('The optional CWD argument must be a non-empty string or null.'); + } + + parent::__construct($level, $bubble); + + $this->command = $command; + $this->cwd = $cwd; + } + + /** + * Writes the record down to the log of the implementing handler + * + * @throws \UnexpectedValueException + */ + protected function write(array $record): void + { + $this->ensureProcessIsStarted(); + + $this->writeProcessInput($record['formatted']); + + $errors = $this->readProcessErrors(); + if (empty($errors) === false) { + throw new \UnexpectedValueException(sprintf('Errors while writing to process: %s', $errors)); + } + } + + /** + * Makes sure that the process is actually started, and if not, starts it, + * assigns the stream pipes, and handles startup errors, if any. + */ + private function ensureProcessIsStarted(): void + { + if (is_resource($this->process) === false) { + $this->startProcess(); + + $this->handleStartupErrors(); + } + } + + /** + * Starts the actual process and sets all streams to non-blocking. + */ + private function startProcess(): void + { + $this->process = proc_open($this->command, static::DESCRIPTOR_SPEC, $this->pipes, $this->cwd); + + foreach ($this->pipes as $pipe) { + stream_set_blocking($pipe, false); + } + } + + /** + * Selects the STDERR stream, handles upcoming startup errors, and throws an exception, if any. + * + * @throws \UnexpectedValueException + */ + private function handleStartupErrors(): void + { + $selected = $this->selectErrorStream(); + if (false === $selected) { + throw new \UnexpectedValueException('Something went wrong while selecting a stream.'); + } + + $errors = $this->readProcessErrors(); + + if (is_resource($this->process) === false || empty($errors) === false) { + throw new \UnexpectedValueException( + sprintf('The process "%s" could not be opened: ' . $errors, $this->command) + ); + } + } + + /** + * Selects the STDERR stream. + * + * @return int|bool + */ + protected function selectErrorStream() + { + $empty = []; + $errorPipes = [$this->pipes[2]]; + + return stream_select($errorPipes, $empty, $empty, 1); + } + + /** + * Reads the errors of the process, if there are any. + * + * @codeCoverageIgnore + * @return string Empty string if there are no errors. + */ + protected function readProcessErrors(): string + { + return (string) stream_get_contents($this->pipes[2]); + } + + /** + * Writes to the input stream of the opened process. + * + * @codeCoverageIgnore + */ + protected function writeProcessInput(string $string): void + { + fwrite($this->pipes[0], $string); + } + + /** + * {@inheritDoc} + */ + public function close(): void + { + if (is_resource($this->process)) { + foreach ($this->pipes as $pipe) { + fclose($pipe); + } + proc_close($this->process); + $this->process = null; + } + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerInterface.php b/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerInterface.php new file mode 100644 index 00000000..3adec7a4 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerInterface.php @@ -0,0 +1,44 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Processor\ProcessorInterface; + +/** + * Interface to describe loggers that have processors + * + * @author Jordi Boggiano <j.boggiano@seld.be> + * + * @phpstan-import-type Record from \Monolog\Logger + */ +interface ProcessableHandlerInterface +{ + /** + * Adds a processor in the stack. + * + * @psalm-param ProcessorInterface|callable(Record): Record $callback + * + * @param ProcessorInterface|callable $callback + * @return HandlerInterface self + */ + public function pushProcessor(callable $callback): HandlerInterface; + + /** + * Removes the processor on top of the stack and returns it. + * + * @psalm-return ProcessorInterface|callable(Record): Record $callback + * + * @throws \LogicException In case the processor stack is empty + * @return callable|ProcessorInterface + */ + public function popProcessor(): callable; +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerTrait.php b/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerTrait.php new file mode 100644 index 00000000..9ef6e301 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerTrait.php @@ -0,0 +1,77 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\ResettableInterface; +use Monolog\Processor\ProcessorInterface; + +/** + * Helper trait for implementing ProcessableInterface + * + * @author Jordi Boggiano <j.boggiano@seld.be> + * + * @phpstan-import-type Record from \Monolog\Logger + */ +trait ProcessableHandlerTrait +{ + /** + * @var callable[] + * @phpstan-var array<ProcessorInterface|callable(Record): Record> + */ + protected $processors = []; + + /** + * {@inheritDoc} + */ + public function pushProcessor(callable $callback): HandlerInterface + { + array_unshift($this->processors, $callback); + + return $this; + } + + /** + * {@inheritDoc} + */ + public function popProcessor(): callable + { + if (!$this->processors) { + throw new \LogicException('You tried to pop from an empty processor stack.'); + } + + return array_shift($this->processors); + } + + /** + * Processes a record. + * + * @phpstan-param Record $record + * @phpstan-return Record + */ + protected function processRecord(array $record): array + { + foreach ($this->processors as $processor) { + $record = $processor($record); + } + + return $record; + } + + protected function resetProcessors(): void + { + foreach ($this->processors as $processor) { + if ($processor instanceof ResettableInterface) { + $processor->reset(); + } + } + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php new file mode 100644 index 00000000..36e19ccc --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php @@ -0,0 +1,95 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Psr\Log\LoggerInterface; +use Monolog\Formatter\FormatterInterface; + +/** + * Proxies log messages to an existing PSR-3 compliant logger. + * + * If a formatter is configured, the formatter's output MUST be a string and the + * formatted message will be fed to the wrapped PSR logger instead of the original + * log record's message. + * + * @author Michael Moussa <michael.moussa@gmail.com> + */ +class PsrHandler extends AbstractHandler implements FormattableHandlerInterface +{ + /** + * PSR-3 compliant logger + * + * @var LoggerInterface + */ + protected $logger; + + /** + * @var FormatterInterface|null + */ + protected $formatter; + + /** + * @param LoggerInterface $logger The underlying PSR-3 compliant logger to which messages will be proxied + */ + public function __construct(LoggerInterface $logger, $level = Logger::DEBUG, bool $bubble = true) + { + parent::__construct($level, $bubble); + + $this->logger = $logger; + } + + /** + * {@inheritDoc} + */ + public function handle(array $record): bool + { + if (!$this->isHandling($record)) { + return false; + } + + if ($this->formatter) { + $formatted = $this->formatter->format($record); + $this->logger->log(strtolower($record['level_name']), (string) $formatted, $record['context']); + } else { + $this->logger->log(strtolower($record['level_name']), $record['message'], $record['context']); + } + + return false === $this->bubble; + } + + /** + * Sets the formatter. + * + * @param FormatterInterface $formatter + */ + public function setFormatter(FormatterInterface $formatter): HandlerInterface + { + $this->formatter = $formatter; + + return $this; + } + + /** + * Gets the formatter. + * + * @return FormatterInterface + */ + public function getFormatter(): FormatterInterface + { + if (!$this->formatter) { + throw new \LogicException('No formatter has been set and this handler does not have a default formatter'); + } + + return $this->formatter; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php new file mode 100644 index 00000000..fed2303d --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php @@ -0,0 +1,246 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Utils; +use Psr\Log\LogLevel; + +/** + * Sends notifications through the pushover api to mobile phones + * + * @author Sebastian Göttschkes <sebastian.goettschkes@googlemail.com> + * @see https://www.pushover.net/api + * + * @phpstan-import-type FormattedRecord from AbstractProcessingHandler + * @phpstan-import-type Level from \Monolog\Logger + * @phpstan-import-type LevelName from \Monolog\Logger + */ +class PushoverHandler extends SocketHandler +{ + /** @var string */ + private $token; + /** @var array<int|string> */ + private $users; + /** @var string */ + private $title; + /** @var string|int|null */ + private $user = null; + /** @var int */ + private $retry; + /** @var int */ + private $expire; + + /** @var int */ + private $highPriorityLevel; + /** @var int */ + private $emergencyLevel; + /** @var bool */ + private $useFormattedMessage = false; + + /** + * All parameters that can be sent to Pushover + * @see https://pushover.net/api + * @var array<string, bool> + */ + private $parameterNames = [ + 'token' => true, + 'user' => true, + 'message' => true, + 'device' => true, + 'title' => true, + 'url' => true, + 'url_title' => true, + 'priority' => true, + 'timestamp' => true, + 'sound' => true, + 'retry' => true, + 'expire' => true, + 'callback' => true, + ]; + + /** + * Sounds the api supports by default + * @see https://pushover.net/api#sounds + * @var string[] + */ + private $sounds = [ + 'pushover', 'bike', 'bugle', 'cashregister', 'classical', 'cosmic', 'falling', 'gamelan', 'incoming', + 'intermission', 'magic', 'mechanical', 'pianobar', 'siren', 'spacealarm', 'tugboat', 'alien', 'climb', + 'persistent', 'echo', 'updown', 'none', + ]; + + /** + * @param string $token Pushover api token + * @param string|array $users Pushover user id or array of ids the message will be sent to + * @param string|null $title Title sent to the Pushover API + * @param bool $useSSL Whether to connect via SSL. Required when pushing messages to users that are not + * the pushover.net app owner. OpenSSL is required for this option. + * @param string|int $highPriorityLevel The minimum logging level at which this handler will start + * sending "high priority" requests to the Pushover API + * @param string|int $emergencyLevel The minimum logging level at which this handler will start + * sending "emergency" requests to the Pushover API + * @param int $retry The retry parameter specifies how often (in seconds) the Pushover servers will + * send the same notification to the user. + * @param int $expire The expire parameter specifies how many seconds your notification will continue + * to be retried for (every retry seconds). + * + * @phpstan-param string|array<int|string> $users + * @phpstan-param Level|LevelName|LogLevel::* $highPriorityLevel + * @phpstan-param Level|LevelName|LogLevel::* $emergencyLevel + */ + public function __construct( + string $token, + $users, + ?string $title = null, + $level = Logger::CRITICAL, + bool $bubble = true, + bool $useSSL = true, + $highPriorityLevel = Logger::CRITICAL, + $emergencyLevel = Logger::EMERGENCY, + int $retry = 30, + int $expire = 25200, + bool $persistent = false, + float $timeout = 0.0, + float $writingTimeout = 10.0, + ?float $connectionTimeout = null, + ?int $chunkSize = null + ) { + $connectionString = $useSSL ? 'ssl://api.pushover.net:443' : 'api.pushover.net:80'; + parent::__construct( + $connectionString, + $level, + $bubble, + $persistent, + $timeout, + $writingTimeout, + $connectionTimeout, + $chunkSize + ); + + $this->token = $token; + $this->users = (array) $users; + $this->title = $title ?: (string) gethostname(); + $this->highPriorityLevel = Logger::toMonologLevel($highPriorityLevel); + $this->emergencyLevel = Logger::toMonologLevel($emergencyLevel); + $this->retry = $retry; + $this->expire = $expire; + } + + protected function generateDataStream(array $record): string + { + $content = $this->buildContent($record); + + return $this->buildHeader($content) . $content; + } + + /** + * @phpstan-param FormattedRecord $record + */ + private function buildContent(array $record): string + { + // Pushover has a limit of 512 characters on title and message combined. + $maxMessageLength = 512 - strlen($this->title); + + $message = ($this->useFormattedMessage) ? $record['formatted'] : $record['message']; + $message = Utils::substr($message, 0, $maxMessageLength); + + $timestamp = $record['datetime']->getTimestamp(); + + $dataArray = [ + 'token' => $this->token, + 'user' => $this->user, + 'message' => $message, + 'title' => $this->title, + 'timestamp' => $timestamp, + ]; + + if (isset($record['level']) && $record['level'] >= $this->emergencyLevel) { + $dataArray['priority'] = 2; + $dataArray['retry'] = $this->retry; + $dataArray['expire'] = $this->expire; + } elseif (isset($record['level']) && $record['level'] >= $this->highPriorityLevel) { + $dataArray['priority'] = 1; + } + + // First determine the available parameters + $context = array_intersect_key($record['context'], $this->parameterNames); + $extra = array_intersect_key($record['extra'], $this->parameterNames); + + // Least important info should be merged with subsequent info + $dataArray = array_merge($extra, $context, $dataArray); + + // Only pass sounds that are supported by the API + if (isset($dataArray['sound']) && !in_array($dataArray['sound'], $this->sounds)) { + unset($dataArray['sound']); + } + + return http_build_query($dataArray); + } + + private function buildHeader(string $content): string + { + $header = "POST /1/messages.json HTTP/1.1\r\n"; + $header .= "Host: api.pushover.net\r\n"; + $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; + $header .= "Content-Length: " . strlen($content) . "\r\n"; + $header .= "\r\n"; + + return $header; + } + + protected function write(array $record): void + { + foreach ($this->users as $user) { + $this->user = $user; + + parent::write($record); + $this->closeSocket(); + } + + $this->user = null; + } + + /** + * @param int|string $value + * + * @phpstan-param Level|LevelName|LogLevel::* $value + */ + public function setHighPriorityLevel($value): self + { + $this->highPriorityLevel = Logger::toMonologLevel($value); + + return $this; + } + + /** + * @param int|string $value + * + * @phpstan-param Level|LevelName|LogLevel::* $value + */ + public function setEmergencyLevel($value): self + { + $this->emergencyLevel = Logger::toMonologLevel($value); + + return $this; + } + + /** + * Use the formatted message? + */ + public function useFormattedMessage(bool $value): self + { + $this->useFormattedMessage = $value; + + return $this; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php new file mode 100644 index 00000000..91d16eaf --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php @@ -0,0 +1,101 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\LineFormatter; +use Monolog\Formatter\FormatterInterface; +use Monolog\Logger; + +/** + * Logs to a Redis key using rpush + * + * usage example: + * + * $log = new Logger('application'); + * $redis = new RedisHandler(new Predis\Client("tcp://localhost:6379"), "logs", "prod"); + * $log->pushHandler($redis); + * + * @author Thomas Tourlourat <thomas@tourlourat.com> + * + * @phpstan-import-type FormattedRecord from AbstractProcessingHandler + */ +class RedisHandler extends AbstractProcessingHandler +{ + /** @var \Predis\Client<\Predis\Client>|\Redis */ + private $redisClient; + /** @var string */ + private $redisKey; + /** @var int */ + protected $capSize; + + /** + * @param \Predis\Client<\Predis\Client>|\Redis $redis The redis instance + * @param string $key The key name to push records to + * @param int $capSize Number of entries to limit list size to, 0 = unlimited + */ + public function __construct($redis, string $key, $level = Logger::DEBUG, bool $bubble = true, int $capSize = 0) + { + if (!(($redis instanceof \Predis\Client) || ($redis instanceof \Redis))) { + throw new \InvalidArgumentException('Predis\Client or Redis instance required'); + } + + $this->redisClient = $redis; + $this->redisKey = $key; + $this->capSize = $capSize; + + parent::__construct($level, $bubble); + } + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + if ($this->capSize) { + $this->writeCapped($record); + } else { + $this->redisClient->rpush($this->redisKey, $record["formatted"]); + } + } + + /** + * Write and cap the collection + * Writes the record to the redis list and caps its + * + * @phpstan-param FormattedRecord $record + */ + protected function writeCapped(array $record): void + { + if ($this->redisClient instanceof \Redis) { + $mode = defined('\Redis::MULTI') ? \Redis::MULTI : 1; + $this->redisClient->multi($mode) + ->rpush($this->redisKey, $record["formatted"]) + ->ltrim($this->redisKey, -$this->capSize, -1) + ->exec(); + } else { + $redisKey = $this->redisKey; + $capSize = $this->capSize; + $this->redisClient->transaction(function ($tx) use ($record, $redisKey, $capSize) { + $tx->rpush($redisKey, $record["formatted"]); + $tx->ltrim($redisKey, -$capSize, -1); + }); + } + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter(): FormatterInterface + { + return new LineFormatter(); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/RedisPubSubHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/RedisPubSubHandler.php new file mode 100644 index 00000000..7789309c --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/RedisPubSubHandler.php @@ -0,0 +1,67 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\LineFormatter; +use Monolog\Formatter\FormatterInterface; +use Monolog\Logger; + +/** + * Sends the message to a Redis Pub/Sub channel using PUBLISH + * + * usage example: + * + * $log = new Logger('application'); + * $redis = new RedisPubSubHandler(new Predis\Client("tcp://localhost:6379"), "logs", Logger::WARNING); + * $log->pushHandler($redis); + * + * @author Gaëtan Faugère <gaetan@fauge.re> + */ +class RedisPubSubHandler extends AbstractProcessingHandler +{ + /** @var \Predis\Client<\Predis\Client>|\Redis */ + private $redisClient; + /** @var string */ + private $channelKey; + + /** + * @param \Predis\Client<\Predis\Client>|\Redis $redis The redis instance + * @param string $key The channel key to publish records to + */ + public function __construct($redis, string $key, $level = Logger::DEBUG, bool $bubble = true) + { + if (!(($redis instanceof \Predis\Client) || ($redis instanceof \Redis))) { + throw new \InvalidArgumentException('Predis\Client or Redis instance required'); + } + + $this->redisClient = $redis; + $this->channelKey = $key; + + parent::__construct($level, $bubble); + } + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + $this->redisClient->publish($this->channelKey, $record["formatted"]); + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter(): FormatterInterface + { + return new LineFormatter(); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php new file mode 100644 index 00000000..adcc9395 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php @@ -0,0 +1,131 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Rollbar\RollbarLogger; +use Throwable; +use Monolog\Logger; + +/** + * Sends errors to Rollbar + * + * If the context data contains a `payload` key, that is used as an array + * of payload options to RollbarLogger's log method. + * + * Rollbar's context info will contain the context + extra keys from the log record + * merged, and then on top of that a few keys: + * + * - level (rollbar level name) + * - monolog_level (monolog level name, raw level, as rollbar only has 5 but monolog 8) + * - channel + * - datetime (unix timestamp) + * + * @author Paul Statezny <paulstatezny@gmail.com> + */ +class RollbarHandler extends AbstractProcessingHandler +{ + /** + * @var RollbarLogger + */ + protected $rollbarLogger; + + /** @var string[] */ + protected $levelMap = [ + Logger::DEBUG => 'debug', + Logger::INFO => 'info', + Logger::NOTICE => 'info', + Logger::WARNING => 'warning', + Logger::ERROR => 'error', + Logger::CRITICAL => 'critical', + Logger::ALERT => 'critical', + Logger::EMERGENCY => 'critical', + ]; + + /** + * Records whether any log records have been added since the last flush of the rollbar notifier + * + * @var bool + */ + private $hasRecords = false; + + /** @var bool */ + protected $initialized = false; + + /** + * @param RollbarLogger $rollbarLogger RollbarLogger object constructed with valid token + */ + public function __construct(RollbarLogger $rollbarLogger, $level = Logger::ERROR, bool $bubble = true) + { + $this->rollbarLogger = $rollbarLogger; + + parent::__construct($level, $bubble); + } + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + if (!$this->initialized) { + // __destructor() doesn't get called on Fatal errors + register_shutdown_function(array($this, 'close')); + $this->initialized = true; + } + + $context = $record['context']; + $context = array_merge($context, $record['extra'], [ + 'level' => $this->levelMap[$record['level']], + 'monolog_level' => $record['level_name'], + 'channel' => $record['channel'], + 'datetime' => $record['datetime']->format('U'), + ]); + + if (isset($context['exception']) && $context['exception'] instanceof Throwable) { + $exception = $context['exception']; + unset($context['exception']); + $toLog = $exception; + } else { + $toLog = $record['message']; + } + + // @phpstan-ignore-next-line + $this->rollbarLogger->log($context['level'], $toLog, $context); + + $this->hasRecords = true; + } + + public function flush(): void + { + if ($this->hasRecords) { + $this->rollbarLogger->flush(); + $this->hasRecords = false; + } + } + + /** + * {@inheritDoc} + */ + public function close(): void + { + $this->flush(); + } + + /** + * {@inheritDoc} + */ + public function reset() + { + $this->flush(); + + parent::reset(); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php new file mode 100644 index 00000000..17745d22 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php @@ -0,0 +1,207 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use InvalidArgumentException; +use Monolog\Logger; +use Monolog\Utils; + +/** + * Stores logs to files that are rotated every day and a limited number of files are kept. + * + * This rotation is only intended to be used as a workaround. Using logrotate to + * handle the rotation is strongly encouraged when you can use it. + * + * @author Christophe Coevoet <stof@notk.org> + * @author Jordi Boggiano <j.boggiano@seld.be> + */ +class RotatingFileHandler extends StreamHandler +{ + public const FILE_PER_DAY = 'Y-m-d'; + public const FILE_PER_MONTH = 'Y-m'; + public const FILE_PER_YEAR = 'Y'; + + /** @var string */ + protected $filename; + /** @var int */ + protected $maxFiles; + /** @var bool */ + protected $mustRotate; + /** @var \DateTimeImmutable */ + protected $nextRotation; + /** @var string */ + protected $filenameFormat; + /** @var string */ + protected $dateFormat; + + /** + * @param string $filename + * @param int $maxFiles The maximal amount of files to keep (0 means unlimited) + * @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write) + * @param bool $useLocking Try to lock log file before doing any writes + */ + public function __construct(string $filename, int $maxFiles = 0, $level = Logger::DEBUG, bool $bubble = true, ?int $filePermission = null, bool $useLocking = false) + { + $this->filename = Utils::canonicalizePath($filename); + $this->maxFiles = $maxFiles; + $this->nextRotation = new \DateTimeImmutable('tomorrow'); + $this->filenameFormat = '{filename}-{date}'; + $this->dateFormat = static::FILE_PER_DAY; + + parent::__construct($this->getTimedFilename(), $level, $bubble, $filePermission, $useLocking); + } + + /** + * {@inheritDoc} + */ + public function close(): void + { + parent::close(); + + if (true === $this->mustRotate) { + $this->rotate(); + } + } + + /** + * {@inheritDoc} + */ + public function reset() + { + parent::reset(); + + if (true === $this->mustRotate) { + $this->rotate(); + } + } + + public function setFilenameFormat(string $filenameFormat, string $dateFormat): self + { + if (!preg_match('{^[Yy](([/_.-]?m)([/_.-]?d)?)?$}', $dateFormat)) { + throw new InvalidArgumentException( + 'Invalid date format - format must be one of '. + 'RotatingFileHandler::FILE_PER_DAY ("Y-m-d"), RotatingFileHandler::FILE_PER_MONTH ("Y-m") '. + 'or RotatingFileHandler::FILE_PER_YEAR ("Y"), or you can set one of the '. + 'date formats using slashes, underscores and/or dots instead of dashes.' + ); + } + if (substr_count($filenameFormat, '{date}') === 0) { + throw new InvalidArgumentException( + 'Invalid filename format - format must contain at least `{date}`, because otherwise rotating is impossible.' + ); + } + $this->filenameFormat = $filenameFormat; + $this->dateFormat = $dateFormat; + $this->url = $this->getTimedFilename(); + $this->close(); + + return $this; + } + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + // on the first record written, if the log is new, we should rotate (once per day) + if (null === $this->mustRotate) { + $this->mustRotate = null === $this->url || !file_exists($this->url); + } + + if ($this->nextRotation <= $record['datetime']) { + $this->mustRotate = true; + $this->close(); + } + + parent::write($record); + } + + /** + * Rotates the files. + */ + protected function rotate(): void + { + // update filename + $this->url = $this->getTimedFilename(); + $this->nextRotation = new \DateTimeImmutable('tomorrow'); + + // skip GC of old logs if files are unlimited + if (0 === $this->maxFiles) { + return; + } + + $logFiles = glob($this->getGlobPattern()); + if (false === $logFiles) { + // failed to glob + return; + } + + if ($this->maxFiles >= count($logFiles)) { + // no files to remove + return; + } + + // Sorting the files by name to remove the older ones + usort($logFiles, function ($a, $b) { + return strcmp($b, $a); + }); + + foreach (array_slice($logFiles, $this->maxFiles) as $file) { + if (is_writable($file)) { + // suppress errors here as unlink() might fail if two processes + // are cleaning up/rotating at the same time + set_error_handler(function (int $errno, string $errstr, string $errfile, int $errline): bool { + return false; + }); + unlink($file); + restore_error_handler(); + } + } + + $this->mustRotate = false; + } + + protected function getTimedFilename(): string + { + $fileInfo = pathinfo($this->filename); + $timedFilename = str_replace( + ['{filename}', '{date}'], + [$fileInfo['filename'], date($this->dateFormat)], + $fileInfo['dirname'] . '/' . $this->filenameFormat + ); + + if (isset($fileInfo['extension'])) { + $timedFilename .= '.'.$fileInfo['extension']; + } + + return $timedFilename; + } + + protected function getGlobPattern(): string + { + $fileInfo = pathinfo($this->filename); + $glob = str_replace( + ['{filename}', '{date}'], + [$fileInfo['filename'], str_replace( + ['Y', 'y', 'm', 'd'], + ['[0-9][0-9][0-9][0-9]', '[0-9][0-9]', '[0-9][0-9]', '[0-9][0-9]'], + $this->dateFormat) + ], + $fileInfo['dirname'] . '/' . $this->filenameFormat + ); + if (isset($fileInfo['extension'])) { + $glob .= '.'.$fileInfo['extension']; + } + + return $glob; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php new file mode 100644 index 00000000..25cce07f --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php @@ -0,0 +1,132 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\FormatterInterface; + +/** + * Sampling handler + * + * A sampled event stream can be useful for logging high frequency events in + * a production environment where you only need an idea of what is happening + * and are not concerned with capturing every occurrence. Since the decision to + * handle or not handle a particular event is determined randomly, the + * resulting sampled log is not guaranteed to contain 1/N of the events that + * occurred in the application, but based on the Law of large numbers, it will + * tend to be close to this ratio with a large number of attempts. + * + * @author Bryan Davis <bd808@wikimedia.org> + * @author Kunal Mehta <legoktm@gmail.com> + * + * @phpstan-import-type Record from \Monolog\Logger + * @phpstan-import-type Level from \Monolog\Logger + */ +class SamplingHandler extends AbstractHandler implements ProcessableHandlerInterface, FormattableHandlerInterface +{ + use ProcessableHandlerTrait; + + /** + * @var HandlerInterface|callable + * @phpstan-var HandlerInterface|callable(Record|array{level: Level}|null, HandlerInterface): HandlerInterface + */ + protected $handler; + + /** + * @var int $factor + */ + protected $factor; + + /** + * @psalm-param HandlerInterface|callable(Record|array{level: Level}|null, HandlerInterface): HandlerInterface $handler + * + * @param callable|HandlerInterface $handler Handler or factory callable($record|null, $samplingHandler). + * @param int $factor Sample factor (e.g. 10 means every ~10th record is sampled) + */ + public function __construct($handler, int $factor) + { + parent::__construct(); + $this->handler = $handler; + $this->factor = $factor; + + if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) { + throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object"); + } + } + + public function isHandling(array $record): bool + { + return $this->getHandler($record)->isHandling($record); + } + + public function handle(array $record): bool + { + if ($this->isHandling($record) && mt_rand(1, $this->factor) === 1) { + if ($this->processors) { + /** @var Record $record */ + $record = $this->processRecord($record); + } + + $this->getHandler($record)->handle($record); + } + + return false === $this->bubble; + } + + /** + * Return the nested handler + * + * If the handler was provided as a factory callable, this will trigger the handler's instantiation. + * + * @phpstan-param Record|array{level: Level}|null $record + * + * @return HandlerInterface + */ + public function getHandler(?array $record = null) + { + if (!$this->handler instanceof HandlerInterface) { + $this->handler = ($this->handler)($record, $this); + if (!$this->handler instanceof HandlerInterface) { + throw new \RuntimeException("The factory callable should return a HandlerInterface"); + } + } + + return $this->handler; + } + + /** + * {@inheritDoc} + */ + public function setFormatter(FormatterInterface $formatter): HandlerInterface + { + $handler = $this->getHandler(); + if ($handler instanceof FormattableHandlerInterface) { + $handler->setFormatter($formatter); + + return $this; + } + + throw new \UnexpectedValueException('The nested handler of type '.get_class($handler).' does not support formatters.'); + } + + /** + * {@inheritDoc} + */ + public function getFormatter(): FormatterInterface + { + $handler = $this->getHandler(); + if ($handler instanceof FormattableHandlerInterface) { + return $handler->getFormatter(); + } + + throw new \UnexpectedValueException('The nested handler of type '.get_class($handler).' does not support formatters.'); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SendGridHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SendGridHandler.php new file mode 100644 index 00000000..1280ee70 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/SendGridHandler.php @@ -0,0 +1,102 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; + +/** + * SendGridrHandler uses the SendGrid API v2 function to send Log emails, more information in https://sendgrid.com/docs/API_Reference/Web_API/mail.html + * + * @author Ricardo Fontanelli <ricardo.fontanelli@hotmail.com> + */ +class SendGridHandler extends MailHandler +{ + /** + * The SendGrid API User + * @var string + */ + protected $apiUser; + + /** + * The SendGrid API Key + * @var string + */ + protected $apiKey; + + /** + * The email addresses to which the message will be sent + * @var string + */ + protected $from; + + /** + * The email addresses to which the message will be sent + * @var string[] + */ + protected $to; + + /** + * The subject of the email + * @var string + */ + protected $subject; + + /** + * @param string $apiUser The SendGrid API User + * @param string $apiKey The SendGrid API Key + * @param string $from The sender of the email + * @param string|string[] $to The recipients of the email + * @param string $subject The subject of the mail + */ + public function __construct(string $apiUser, string $apiKey, string $from, $to, string $subject, $level = Logger::ERROR, bool $bubble = true) + { + if (!extension_loaded('curl')) { + throw new MissingExtensionException('The curl extension is needed to use the SendGridHandler'); + } + + parent::__construct($level, $bubble); + $this->apiUser = $apiUser; + $this->apiKey = $apiKey; + $this->from = $from; + $this->to = (array) $to; + $this->subject = $subject; + } + + /** + * {@inheritDoc} + */ + protected function send(string $content, array $records): void + { + $message = []; + $message['api_user'] = $this->apiUser; + $message['api_key'] = $this->apiKey; + $message['from'] = $this->from; + foreach ($this->to as $recipient) { + $message['to[]'] = $recipient; + } + $message['subject'] = $this->subject; + $message['date'] = date('r'); + + if ($this->isHtmlBody($content)) { + $message['html'] = $content; + } else { + $message['text'] = $content; + } + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, 'https://api.sendgrid.com/api/mail.send.json'); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($message)); + Curl\Util::execute($ch, 2); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php b/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php new file mode 100644 index 00000000..9ae10037 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php @@ -0,0 +1,387 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler\Slack; + +use Monolog\Logger; +use Monolog\Utils; +use Monolog\Formatter\NormalizerFormatter; +use Monolog\Formatter\FormatterInterface; + +/** + * Slack record utility helping to log to Slack webhooks or API. + * + * @author Greg Kedzierski <greg@gregkedzierski.com> + * @author Haralan Dobrev <hkdobrev@gmail.com> + * @see https://api.slack.com/incoming-webhooks + * @see https://api.slack.com/docs/message-attachments + * + * @phpstan-import-type FormattedRecord from \Monolog\Handler\AbstractProcessingHandler + * @phpstan-import-type Record from \Monolog\Logger + */ +class SlackRecord +{ + public const COLOR_DANGER = 'danger'; + + public const COLOR_WARNING = 'warning'; + + public const COLOR_GOOD = 'good'; + + public const COLOR_DEFAULT = '#e3e4e6'; + + /** + * Slack channel (encoded ID or name) + * @var string|null + */ + private $channel; + + /** + * Name of a bot + * @var string|null + */ + private $username; + + /** + * User icon e.g. 'ghost', 'http://example.com/user.png' + * @var string|null + */ + private $userIcon; + + /** + * Whether the message should be added to Slack as attachment (plain text otherwise) + * @var bool + */ + private $useAttachment; + + /** + * Whether the the context/extra messages added to Slack as attachments are in a short style + * @var bool + */ + private $useShortAttachment; + + /** + * Whether the attachment should include context and extra data + * @var bool + */ + private $includeContextAndExtra; + + /** + * Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2'] + * @var string[] + */ + private $excludeFields; + + /** + * @var ?FormatterInterface + */ + private $formatter; + + /** + * @var NormalizerFormatter + */ + private $normalizerFormatter; + + /** + * @param string[] $excludeFields + */ + public function __construct( + ?string $channel = null, + ?string $username = null, + bool $useAttachment = true, + ?string $userIcon = null, + bool $useShortAttachment = false, + bool $includeContextAndExtra = false, + array $excludeFields = array(), + ?FormatterInterface $formatter = null + ) { + $this + ->setChannel($channel) + ->setUsername($username) + ->useAttachment($useAttachment) + ->setUserIcon($userIcon) + ->useShortAttachment($useShortAttachment) + ->includeContextAndExtra($includeContextAndExtra) + ->excludeFields($excludeFields) + ->setFormatter($formatter); + + if ($this->includeContextAndExtra) { + $this->normalizerFormatter = new NormalizerFormatter(); + } + } + + /** + * Returns required data in format that Slack + * is expecting. + * + * @phpstan-param FormattedRecord $record + * @phpstan-return mixed[] + */ + public function getSlackData(array $record): array + { + $dataArray = array(); + $record = $this->removeExcludedFields($record); + + if ($this->username) { + $dataArray['username'] = $this->username; + } + + if ($this->channel) { + $dataArray['channel'] = $this->channel; + } + + if ($this->formatter && !$this->useAttachment) { + /** @phpstan-ignore-next-line */ + $message = $this->formatter->format($record); + } else { + $message = $record['message']; + } + + if ($this->useAttachment) { + $attachment = array( + 'fallback' => $message, + 'text' => $message, + 'color' => $this->getAttachmentColor($record['level']), + 'fields' => array(), + 'mrkdwn_in' => array('fields'), + 'ts' => $record['datetime']->getTimestamp(), + 'footer' => $this->username, + 'footer_icon' => $this->userIcon, + ); + + if ($this->useShortAttachment) { + $attachment['title'] = $record['level_name']; + } else { + $attachment['title'] = 'Message'; + $attachment['fields'][] = $this->generateAttachmentField('Level', $record['level_name']); + } + + if ($this->includeContextAndExtra) { + foreach (array('extra', 'context') as $key) { + if (empty($record[$key])) { + continue; + } + + if ($this->useShortAttachment) { + $attachment['fields'][] = $this->generateAttachmentField( + (string) $key, + $record[$key] + ); + } else { + // Add all extra fields as individual fields in attachment + $attachment['fields'] = array_merge( + $attachment['fields'], + $this->generateAttachmentFields($record[$key]) + ); + } + } + } + + $dataArray['attachments'] = array($attachment); + } else { + $dataArray['text'] = $message; + } + + if ($this->userIcon) { + if (filter_var($this->userIcon, FILTER_VALIDATE_URL)) { + $dataArray['icon_url'] = $this->userIcon; + } else { + $dataArray['icon_emoji'] = ":{$this->userIcon}:"; + } + } + + return $dataArray; + } + + /** + * Returns a Slack message attachment color associated with + * provided level. + */ + public function getAttachmentColor(int $level): string + { + switch (true) { + case $level >= Logger::ERROR: + return static::COLOR_DANGER; + case $level >= Logger::WARNING: + return static::COLOR_WARNING; + case $level >= Logger::INFO: + return static::COLOR_GOOD; + default: + return static::COLOR_DEFAULT; + } + } + + /** + * Stringifies an array of key/value pairs to be used in attachment fields + * + * @param mixed[] $fields + */ + public function stringify(array $fields): string + { + /** @var Record $fields */ + $normalized = $this->normalizerFormatter->format($fields); + + $hasSecondDimension = count(array_filter($normalized, 'is_array')); + $hasNonNumericKeys = !count(array_filter(array_keys($normalized), 'is_numeric')); + + return $hasSecondDimension || $hasNonNumericKeys + ? Utils::jsonEncode($normalized, JSON_PRETTY_PRINT|Utils::DEFAULT_JSON_FLAGS) + : Utils::jsonEncode($normalized, Utils::DEFAULT_JSON_FLAGS); + } + + /** + * Channel used by the bot when posting + * + * @param ?string $channel + * + * @return static + */ + public function setChannel(?string $channel = null): self + { + $this->channel = $channel; + + return $this; + } + + /** + * Username used by the bot when posting + * + * @param ?string $username + * + * @return static + */ + public function setUsername(?string $username = null): self + { + $this->username = $username; + + return $this; + } + + public function useAttachment(bool $useAttachment = true): self + { + $this->useAttachment = $useAttachment; + + return $this; + } + + public function setUserIcon(?string $userIcon = null): self + { + $this->userIcon = $userIcon; + + if (\is_string($userIcon)) { + $this->userIcon = trim($userIcon, ':'); + } + + return $this; + } + + public function useShortAttachment(bool $useShortAttachment = false): self + { + $this->useShortAttachment = $useShortAttachment; + + return $this; + } + + public function includeContextAndExtra(bool $includeContextAndExtra = false): self + { + $this->includeContextAndExtra = $includeContextAndExtra; + + if ($this->includeContextAndExtra) { + $this->normalizerFormatter = new NormalizerFormatter(); + } + + return $this; + } + + /** + * @param string[] $excludeFields + */ + public function excludeFields(array $excludeFields = []): self + { + $this->excludeFields = $excludeFields; + + return $this; + } + + public function setFormatter(?FormatterInterface $formatter = null): self + { + $this->formatter = $formatter; + + return $this; + } + + /** + * Generates attachment field + * + * @param string|mixed[] $value + * + * @return array{title: string, value: string, short: false} + */ + private function generateAttachmentField(string $title, $value): array + { + $value = is_array($value) + ? sprintf('```%s```', substr($this->stringify($value), 0, 1990)) + : $value; + + return array( + 'title' => ucfirst($title), + 'value' => $value, + 'short' => false, + ); + } + + /** + * Generates a collection of attachment fields from array + * + * @param mixed[] $data + * + * @return array<array{title: string, value: string, short: false}> + */ + private function generateAttachmentFields(array $data): array + { + /** @var Record $data */ + $normalized = $this->normalizerFormatter->format($data); + + $fields = array(); + foreach ($normalized as $key => $value) { + $fields[] = $this->generateAttachmentField((string) $key, $value); + } + + return $fields; + } + + /** + * Get a copy of record with fields excluded according to $this->excludeFields + * + * @phpstan-param FormattedRecord $record + * + * @return mixed[] + */ + private function removeExcludedFields(array $record): array + { + foreach ($this->excludeFields as $field) { + $keys = explode('.', $field); + $node = &$record; + $lastKey = end($keys); + foreach ($keys as $key) { + if (!isset($node[$key])) { + break; + } + if ($lastKey === $key) { + unset($node[$key]); + break; + } + $node = &$node[$key]; + } + } + + return $record; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php new file mode 100644 index 00000000..a648513e --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php @@ -0,0 +1,256 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\FormatterInterface; +use Monolog\Logger; +use Monolog\Utils; +use Monolog\Handler\Slack\SlackRecord; + +/** + * Sends notifications through Slack API + * + * @author Greg Kedzierski <greg@gregkedzierski.com> + * @see https://api.slack.com/ + * + * @phpstan-import-type FormattedRecord from AbstractProcessingHandler + */ +class SlackHandler extends SocketHandler +{ + /** + * Slack API token + * @var string + */ + private $token; + + /** + * Instance of the SlackRecord util class preparing data for Slack API. + * @var SlackRecord + */ + private $slackRecord; + + /** + * @param string $token Slack API token + * @param string $channel Slack channel (encoded ID or name) + * @param string|null $username Name of a bot + * @param bool $useAttachment Whether the message should be added to Slack as attachment (plain text otherwise) + * @param string|null $iconEmoji The emoji name to use (or null) + * @param bool $useShortAttachment Whether the context/extra messages added to Slack as attachments are in a short style + * @param bool $includeContextAndExtra Whether the attachment should include context and extra data + * @param string[] $excludeFields Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2'] + * @throws MissingExtensionException If no OpenSSL PHP extension configured + */ + public function __construct( + string $token, + string $channel, + ?string $username = null, + bool $useAttachment = true, + ?string $iconEmoji = null, + $level = Logger::CRITICAL, + bool $bubble = true, + bool $useShortAttachment = false, + bool $includeContextAndExtra = false, + array $excludeFields = array(), + bool $persistent = false, + float $timeout = 0.0, + float $writingTimeout = 10.0, + ?float $connectionTimeout = null, + ?int $chunkSize = null + ) { + if (!extension_loaded('openssl')) { + throw new MissingExtensionException('The OpenSSL PHP extension is required to use the SlackHandler'); + } + + parent::__construct( + 'ssl://slack.com:443', + $level, + $bubble, + $persistent, + $timeout, + $writingTimeout, + $connectionTimeout, + $chunkSize + ); + + $this->slackRecord = new SlackRecord( + $channel, + $username, + $useAttachment, + $iconEmoji, + $useShortAttachment, + $includeContextAndExtra, + $excludeFields + ); + + $this->token = $token; + } + + public function getSlackRecord(): SlackRecord + { + return $this->slackRecord; + } + + public function getToken(): string + { + return $this->token; + } + + /** + * {@inheritDoc} + */ + protected function generateDataStream(array $record): string + { + $content = $this->buildContent($record); + + return $this->buildHeader($content) . $content; + } + + /** + * Builds the body of API call + * + * @phpstan-param FormattedRecord $record + */ + private function buildContent(array $record): string + { + $dataArray = $this->prepareContentData($record); + + return http_build_query($dataArray); + } + + /** + * @phpstan-param FormattedRecord $record + * @return string[] + */ + protected function prepareContentData(array $record): array + { + $dataArray = $this->slackRecord->getSlackData($record); + $dataArray['token'] = $this->token; + + if (!empty($dataArray['attachments'])) { + $dataArray['attachments'] = Utils::jsonEncode($dataArray['attachments']); + } + + return $dataArray; + } + + /** + * Builds the header of the API Call + */ + private function buildHeader(string $content): string + { + $header = "POST /api/chat.postMessage HTTP/1.1\r\n"; + $header .= "Host: slack.com\r\n"; + $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; + $header .= "Content-Length: " . strlen($content) . "\r\n"; + $header .= "\r\n"; + + return $header; + } + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + parent::write($record); + $this->finalizeWrite(); + } + + /** + * Finalizes the request by reading some bytes and then closing the socket + * + * If we do not read some but close the socket too early, slack sometimes + * drops the request entirely. + */ + protected function finalizeWrite(): void + { + $res = $this->getResource(); + if (is_resource($res)) { + @fread($res, 2048); + } + $this->closeSocket(); + } + + public function setFormatter(FormatterInterface $formatter): HandlerInterface + { + parent::setFormatter($formatter); + $this->slackRecord->setFormatter($formatter); + + return $this; + } + + public function getFormatter(): FormatterInterface + { + $formatter = parent::getFormatter(); + $this->slackRecord->setFormatter($formatter); + + return $formatter; + } + + /** + * Channel used by the bot when posting + */ + public function setChannel(string $channel): self + { + $this->slackRecord->setChannel($channel); + + return $this; + } + + /** + * Username used by the bot when posting + */ + public function setUsername(string $username): self + { + $this->slackRecord->setUsername($username); + + return $this; + } + + public function useAttachment(bool $useAttachment): self + { + $this->slackRecord->useAttachment($useAttachment); + + return $this; + } + + public function setIconEmoji(string $iconEmoji): self + { + $this->slackRecord->setUserIcon($iconEmoji); + + return $this; + } + + public function useShortAttachment(bool $useShortAttachment): self + { + $this->slackRecord->useShortAttachment($useShortAttachment); + + return $this; + } + + public function includeContextAndExtra(bool $includeContextAndExtra): self + { + $this->slackRecord->includeContextAndExtra($includeContextAndExtra); + + return $this; + } + + /** + * @param string[] $excludeFields + */ + public function excludeFields(array $excludeFields): self + { + $this->slackRecord->excludeFields($excludeFields); + + return $this; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php new file mode 100644 index 00000000..8ae3c788 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php @@ -0,0 +1,130 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\FormatterInterface; +use Monolog\Logger; +use Monolog\Utils; +use Monolog\Handler\Slack\SlackRecord; + +/** + * Sends notifications through Slack Webhooks + * + * @author Haralan Dobrev <hkdobrev@gmail.com> + * @see https://api.slack.com/incoming-webhooks + */ +class SlackWebhookHandler extends AbstractProcessingHandler +{ + /** + * Slack Webhook token + * @var string + */ + private $webhookUrl; + + /** + * Instance of the SlackRecord util class preparing data for Slack API. + * @var SlackRecord + */ + private $slackRecord; + + /** + * @param string $webhookUrl Slack Webhook URL + * @param string|null $channel Slack channel (encoded ID or name) + * @param string|null $username Name of a bot + * @param bool $useAttachment Whether the message should be added to Slack as attachment (plain text otherwise) + * @param string|null $iconEmoji The emoji name to use (or null) + * @param bool $useShortAttachment Whether the the context/extra messages added to Slack as attachments are in a short style + * @param bool $includeContextAndExtra Whether the attachment should include context and extra data + * @param string[] $excludeFields Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2'] + */ + public function __construct( + string $webhookUrl, + ?string $channel = null, + ?string $username = null, + bool $useAttachment = true, + ?string $iconEmoji = null, + bool $useShortAttachment = false, + bool $includeContextAndExtra = false, + $level = Logger::CRITICAL, + bool $bubble = true, + array $excludeFields = array() + ) { + if (!extension_loaded('curl')) { + throw new MissingExtensionException('The curl extension is needed to use the SlackWebhookHandler'); + } + + parent::__construct($level, $bubble); + + $this->webhookUrl = $webhookUrl; + + $this->slackRecord = new SlackRecord( + $channel, + $username, + $useAttachment, + $iconEmoji, + $useShortAttachment, + $includeContextAndExtra, + $excludeFields + ); + } + + public function getSlackRecord(): SlackRecord + { + return $this->slackRecord; + } + + public function getWebhookUrl(): string + { + return $this->webhookUrl; + } + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + $postData = $this->slackRecord->getSlackData($record); + $postString = Utils::jsonEncode($postData); + + $ch = curl_init(); + $options = array( + CURLOPT_URL => $this->webhookUrl, + CURLOPT_POST => true, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_HTTPHEADER => array('Content-type: application/json'), + CURLOPT_POSTFIELDS => $postString, + ); + if (defined('CURLOPT_SAFE_UPLOAD')) { + $options[CURLOPT_SAFE_UPLOAD] = true; + } + + curl_setopt_array($ch, $options); + + Curl\Util::execute($ch); + } + + public function setFormatter(FormatterInterface $formatter): HandlerInterface + { + parent::setFormatter($formatter); + $this->slackRecord->setFormatter($formatter); + + return $this; + } + + public function getFormatter(): FormatterInterface + { + $formatter = parent::getFormatter(); + $this->slackRecord->setFormatter($formatter); + + return $formatter; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php new file mode 100644 index 00000000..21701afa --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php @@ -0,0 +1,448 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; + +/** + * Stores to any socket - uses fsockopen() or pfsockopen(). + * + * @author Pablo de Leon Belloc <pablolb@gmail.com> + * @see http://php.net/manual/en/function.fsockopen.php + * + * @phpstan-import-type Record from \Monolog\Logger + * @phpstan-import-type FormattedRecord from AbstractProcessingHandler + */ +class SocketHandler extends AbstractProcessingHandler +{ + /** @var string */ + private $connectionString; + /** @var float */ + private $connectionTimeout; + /** @var resource|null */ + private $resource; + /** @var float */ + private $timeout; + /** @var float */ + private $writingTimeout; + /** @var ?int */ + private $lastSentBytes = null; + /** @var ?int */ + private $chunkSize; + /** @var bool */ + private $persistent; + /** @var ?int */ + private $errno = null; + /** @var ?string */ + private $errstr = null; + /** @var ?float */ + private $lastWritingAt = null; + + /** + * @param string $connectionString Socket connection string + * @param bool $persistent Flag to enable/disable persistent connections + * @param float $timeout Socket timeout to wait until the request is being aborted + * @param float $writingTimeout Socket timeout to wait until the request should've been sent/written + * @param float|null $connectionTimeout Socket connect timeout to wait until the connection should've been + * established + * @param int|null $chunkSize Sets the chunk size. Only has effect during connection in the writing cycle + * + * @throws \InvalidArgumentException If an invalid timeout value (less than 0) is passed. + */ + public function __construct( + string $connectionString, + $level = Logger::DEBUG, + bool $bubble = true, + bool $persistent = false, + float $timeout = 0.0, + float $writingTimeout = 10.0, + ?float $connectionTimeout = null, + ?int $chunkSize = null + ) { + parent::__construct($level, $bubble); + $this->connectionString = $connectionString; + + if ($connectionTimeout !== null) { + $this->validateTimeout($connectionTimeout); + } + + $this->connectionTimeout = $connectionTimeout ?? (float) ini_get('default_socket_timeout'); + $this->persistent = $persistent; + $this->validateTimeout($timeout); + $this->timeout = $timeout; + $this->validateTimeout($writingTimeout); + $this->writingTimeout = $writingTimeout; + $this->chunkSize = $chunkSize; + } + + /** + * Connect (if necessary) and write to the socket + * + * {@inheritDoc} + * + * @throws \UnexpectedValueException + * @throws \RuntimeException + */ + protected function write(array $record): void + { + $this->connectIfNotConnected(); + $data = $this->generateDataStream($record); + $this->writeToSocket($data); + } + + /** + * We will not close a PersistentSocket instance so it can be reused in other requests. + */ + public function close(): void + { + if (!$this->isPersistent()) { + $this->closeSocket(); + } + } + + /** + * Close socket, if open + */ + public function closeSocket(): void + { + if (is_resource($this->resource)) { + fclose($this->resource); + $this->resource = null; + } + } + + /** + * Set socket connection to be persistent. It only has effect before the connection is initiated. + */ + public function setPersistent(bool $persistent): self + { + $this->persistent = $persistent; + + return $this; + } + + /** + * Set connection timeout. Only has effect before we connect. + * + * @see http://php.net/manual/en/function.fsockopen.php + */ + public function setConnectionTimeout(float $seconds): self + { + $this->validateTimeout($seconds); + $this->connectionTimeout = $seconds; + + return $this; + } + + /** + * Set write timeout. Only has effect before we connect. + * + * @see http://php.net/manual/en/function.stream-set-timeout.php + */ + public function setTimeout(float $seconds): self + { + $this->validateTimeout($seconds); + $this->timeout = $seconds; + + return $this; + } + + /** + * Set writing timeout. Only has effect during connection in the writing cycle. + * + * @param float $seconds 0 for no timeout + */ + public function setWritingTimeout(float $seconds): self + { + $this->validateTimeout($seconds); + $this->writingTimeout = $seconds; + + return $this; + } + + /** + * Set chunk size. Only has effect during connection in the writing cycle. + */ + public function setChunkSize(int $bytes): self + { + $this->chunkSize = $bytes; + + return $this; + } + + /** + * Get current connection string + */ + public function getConnectionString(): string + { + return $this->connectionString; + } + + /** + * Get persistent setting + */ + public function isPersistent(): bool + { + return $this->persistent; + } + + /** + * Get current connection timeout setting + */ + public function getConnectionTimeout(): float + { + return $this->connectionTimeout; + } + + /** + * Get current in-transfer timeout + */ + public function getTimeout(): float + { + return $this->timeout; + } + + /** + * Get current local writing timeout + * + * @return float + */ + public function getWritingTimeout(): float + { + return $this->writingTimeout; + } + + /** + * Get current chunk size + */ + public function getChunkSize(): ?int + { + return $this->chunkSize; + } + + /** + * Check to see if the socket is currently available. + * + * UDP might appear to be connected but might fail when writing. See http://php.net/fsockopen for details. + */ + public function isConnected(): bool + { + return is_resource($this->resource) + && !feof($this->resource); // on TCP - other party can close connection. + } + + /** + * Wrapper to allow mocking + * + * @return resource|false + */ + protected function pfsockopen() + { + return @pfsockopen($this->connectionString, -1, $this->errno, $this->errstr, $this->connectionTimeout); + } + + /** + * Wrapper to allow mocking + * + * @return resource|false + */ + protected function fsockopen() + { + return @fsockopen($this->connectionString, -1, $this->errno, $this->errstr, $this->connectionTimeout); + } + + /** + * Wrapper to allow mocking + * + * @see http://php.net/manual/en/function.stream-set-timeout.php + * + * @return bool + */ + protected function streamSetTimeout() + { + $seconds = floor($this->timeout); + $microseconds = round(($this->timeout - $seconds) * 1e6); + + if (!is_resource($this->resource)) { + throw new \LogicException('streamSetTimeout called but $this->resource is not a resource'); + } + + return stream_set_timeout($this->resource, (int) $seconds, (int) $microseconds); + } + + /** + * Wrapper to allow mocking + * + * @see http://php.net/manual/en/function.stream-set-chunk-size.php + * + * @return int|bool + */ + protected function streamSetChunkSize() + { + if (!is_resource($this->resource)) { + throw new \LogicException('streamSetChunkSize called but $this->resource is not a resource'); + } + + if (null === $this->chunkSize) { + throw new \LogicException('streamSetChunkSize called but $this->chunkSize is not set'); + } + + return stream_set_chunk_size($this->resource, $this->chunkSize); + } + + /** + * Wrapper to allow mocking + * + * @return int|bool + */ + protected function fwrite(string $data) + { + if (!is_resource($this->resource)) { + throw new \LogicException('fwrite called but $this->resource is not a resource'); + } + + return @fwrite($this->resource, $data); + } + + /** + * Wrapper to allow mocking + * + * @return mixed[]|bool + */ + protected function streamGetMetadata() + { + if (!is_resource($this->resource)) { + throw new \LogicException('streamGetMetadata called but $this->resource is not a resource'); + } + + return stream_get_meta_data($this->resource); + } + + private function validateTimeout(float $value): void + { + if ($value < 0) { + throw new \InvalidArgumentException("Timeout must be 0 or a positive float (got $value)"); + } + } + + private function connectIfNotConnected(): void + { + if ($this->isConnected()) { + return; + } + $this->connect(); + } + + /** + * @phpstan-param FormattedRecord $record + */ + protected function generateDataStream(array $record): string + { + return (string) $record['formatted']; + } + + /** + * @return resource|null + */ + protected function getResource() + { + return $this->resource; + } + + private function connect(): void + { + $this->createSocketResource(); + $this->setSocketTimeout(); + $this->setStreamChunkSize(); + } + + private function createSocketResource(): void + { + if ($this->isPersistent()) { + $resource = $this->pfsockopen(); + } else { + $resource = $this->fsockopen(); + } + if (is_bool($resource)) { + throw new \UnexpectedValueException("Failed connecting to $this->connectionString ($this->errno: $this->errstr)"); + } + $this->resource = $resource; + } + + private function setSocketTimeout(): void + { + if (!$this->streamSetTimeout()) { + throw new \UnexpectedValueException("Failed setting timeout with stream_set_timeout()"); + } + } + + private function setStreamChunkSize(): void + { + if ($this->chunkSize && !$this->streamSetChunkSize()) { + throw new \UnexpectedValueException("Failed setting chunk size with stream_set_chunk_size()"); + } + } + + private function writeToSocket(string $data): void + { + $length = strlen($data); + $sent = 0; + $this->lastSentBytes = $sent; + while ($this->isConnected() && $sent < $length) { + if (0 == $sent) { + $chunk = $this->fwrite($data); + } else { + $chunk = $this->fwrite(substr($data, $sent)); + } + if ($chunk === false) { + throw new \RuntimeException("Could not write to socket"); + } + $sent += $chunk; + $socketInfo = $this->streamGetMetadata(); + if (is_array($socketInfo) && $socketInfo['timed_out']) { + throw new \RuntimeException("Write timed-out"); + } + + if ($this->writingIsTimedOut($sent)) { + throw new \RuntimeException("Write timed-out, no data sent for `{$this->writingTimeout}` seconds, probably we got disconnected (sent $sent of $length)"); + } + } + if (!$this->isConnected() && $sent < $length) { + throw new \RuntimeException("End-of-file reached, probably we got disconnected (sent $sent of $length)"); + } + } + + private function writingIsTimedOut(int $sent): bool + { + // convert to ms + if (0.0 == $this->writingTimeout) { + return false; + } + + if ($sent !== $this->lastSentBytes) { + $this->lastWritingAt = microtime(true); + $this->lastSentBytes = $sent; + + return false; + } else { + usleep(100); + } + + if ((microtime(true) - $this->lastWritingAt) >= $this->writingTimeout) { + $this->closeSocket(); + + return true; + } + + return false; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SqsHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SqsHandler.php new file mode 100644 index 00000000..dcf282b4 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/SqsHandler.php @@ -0,0 +1,62 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Aws\Sqs\SqsClient; +use Monolog\Logger; +use Monolog\Utils; + +/** + * Writes to any sqs queue. + * + * @author Martijn van Calker <git@amvc.nl> + */ +class SqsHandler extends AbstractProcessingHandler +{ + /** 256 KB in bytes - maximum message size in SQS */ + protected const MAX_MESSAGE_SIZE = 262144; + /** 100 KB in bytes - head message size for new error log */ + protected const HEAD_MESSAGE_SIZE = 102400; + + /** @var SqsClient */ + private $client; + /** @var string */ + private $queueUrl; + + public function __construct(SqsClient $sqsClient, string $queueUrl, $level = Logger::DEBUG, bool $bubble = true) + { + parent::__construct($level, $bubble); + + $this->client = $sqsClient; + $this->queueUrl = $queueUrl; + } + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + if (!isset($record['formatted']) || 'string' !== gettype($record['formatted'])) { + throw new \InvalidArgumentException('SqsHandler accepts only formatted records as a string' . Utils::getRecordMessageForException($record)); + } + + $messageBody = $record['formatted']; + if (strlen($messageBody) >= static::MAX_MESSAGE_SIZE) { + $messageBody = Utils::substr($messageBody, 0, static::HEAD_MESSAGE_SIZE); + } + + $this->client->sendMessage([ + 'QueueUrl' => $this->queueUrl, + 'MessageBody' => $messageBody, + ]); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php new file mode 100644 index 00000000..82c048e1 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php @@ -0,0 +1,224 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Utils; + +/** + * Stores to any stream resource + * + * Can be used to store into php://stderr, remote and local files, etc. + * + * @author Jordi Boggiano <j.boggiano@seld.be> + * + * @phpstan-import-type FormattedRecord from AbstractProcessingHandler + */ +class StreamHandler extends AbstractProcessingHandler +{ + /** @const int */ + protected const MAX_CHUNK_SIZE = 2147483647; + /** @const int 10MB */ + protected const DEFAULT_CHUNK_SIZE = 10 * 1024 * 1024; + /** @var int */ + protected $streamChunkSize; + /** @var resource|null */ + protected $stream; + /** @var ?string */ + protected $url = null; + /** @var ?string */ + private $errorMessage = null; + /** @var ?int */ + protected $filePermission; + /** @var bool */ + protected $useLocking; + /** @var true|null */ + private $dirCreated = null; + + /** + * @param resource|string $stream If a missing path can't be created, an UnexpectedValueException will be thrown on first write + * @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write) + * @param bool $useLocking Try to lock log file before doing any writes + * + * @throws \InvalidArgumentException If stream is not a resource or string + */ + public function __construct($stream, $level = Logger::DEBUG, bool $bubble = true, ?int $filePermission = null, bool $useLocking = false) + { + parent::__construct($level, $bubble); + + if (($phpMemoryLimit = Utils::expandIniShorthandBytes(ini_get('memory_limit'))) !== false) { + if ($phpMemoryLimit > 0) { + // use max 10% of allowed memory for the chunk size, and at least 100KB + $this->streamChunkSize = min(static::MAX_CHUNK_SIZE, max((int) ($phpMemoryLimit / 10), 100 * 1024)); + } else { + // memory is unlimited, set to the default 10MB + $this->streamChunkSize = static::DEFAULT_CHUNK_SIZE; + } + } else { + // no memory limit information, set to the default 10MB + $this->streamChunkSize = static::DEFAULT_CHUNK_SIZE; + } + + if (is_resource($stream)) { + $this->stream = $stream; + + stream_set_chunk_size($this->stream, $this->streamChunkSize); + } elseif (is_string($stream)) { + $this->url = Utils::canonicalizePath($stream); + } else { + throw new \InvalidArgumentException('A stream must either be a resource or a string.'); + } + + $this->filePermission = $filePermission; + $this->useLocking = $useLocking; + } + + /** + * {@inheritDoc} + */ + public function close(): void + { + if ($this->url && is_resource($this->stream)) { + fclose($this->stream); + } + $this->stream = null; + $this->dirCreated = null; + } + + /** + * Return the currently active stream if it is open + * + * @return resource|null + */ + public function getStream() + { + return $this->stream; + } + + /** + * Return the stream URL if it was configured with a URL and not an active resource + * + * @return string|null + */ + public function getUrl(): ?string + { + return $this->url; + } + + /** + * @return int + */ + public function getStreamChunkSize(): int + { + return $this->streamChunkSize; + } + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + if (!is_resource($this->stream)) { + $url = $this->url; + if (null === $url || '' === $url) { + throw new \LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().' . Utils::getRecordMessageForException($record)); + } + $this->createDir($url); + $this->errorMessage = null; + set_error_handler([$this, 'customErrorHandler']); + try { + $stream = fopen($url, 'a'); + if ($this->filePermission !== null) { + @chmod($url, $this->filePermission); + } + } finally { + restore_error_handler(); + } + if (!is_resource($stream)) { + $this->stream = null; + + throw new \UnexpectedValueException(sprintf('The stream or file "%s" could not be opened in append mode: '.$this->errorMessage, $url) . Utils::getRecordMessageForException($record)); + } + stream_set_chunk_size($stream, $this->streamChunkSize); + $this->stream = $stream; + } + + $stream = $this->stream; + if (!is_resource($stream)) { + throw new \LogicException('No stream was opened yet' . Utils::getRecordMessageForException($record)); + } + + if ($this->useLocking) { + // ignoring errors here, there's not much we can do about them + flock($stream, LOCK_EX); + } + + $this->streamWrite($stream, $record); + + if ($this->useLocking) { + flock($stream, LOCK_UN); + } + } + + /** + * Write to stream + * @param resource $stream + * @param array $record + * + * @phpstan-param FormattedRecord $record + */ + protected function streamWrite($stream, array $record): void + { + fwrite($stream, (string) $record['formatted']); + } + + private function customErrorHandler(int $code, string $msg): bool + { + $this->errorMessage = preg_replace('{^(fopen|mkdir)\(.*?\): }', '', $msg); + + return true; + } + + private function getDirFromStream(string $stream): ?string + { + $pos = strpos($stream, '://'); + if ($pos === false) { + return dirname($stream); + } + + if ('file://' === substr($stream, 0, 7)) { + return dirname(substr($stream, 7)); + } + + return null; + } + + private function createDir(string $url): void + { + // Do not try to create dir if it has already been tried. + if ($this->dirCreated) { + return; + } + + $dir = $this->getDirFromStream($url); + if (null !== $dir && !is_dir($dir)) { + $this->errorMessage = null; + set_error_handler([$this, 'customErrorHandler']); + $status = mkdir($dir, 0777, true); + restore_error_handler(); + if (false === $status && !is_dir($dir) && strpos((string) $this->errorMessage, 'File exists') === false) { + throw new \UnexpectedValueException(sprintf('There is no existing directory at "%s" and it could not be created: '.$this->errorMessage, $dir)); + } + } + $this->dirCreated = true; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php new file mode 100644 index 00000000..fae92514 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php @@ -0,0 +1,115 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Utils; +use Monolog\Formatter\FormatterInterface; +use Monolog\Formatter\LineFormatter; +use Swift_Message; +use Swift; + +/** + * SwiftMailerHandler uses Swift_Mailer to send the emails + * + * @author Gyula Sallai + * + * @phpstan-import-type Record from \Monolog\Logger + * @deprecated Since Monolog 2.6. Use SymfonyMailerHandler instead. + */ +class SwiftMailerHandler extends MailHandler +{ + /** @var \Swift_Mailer */ + protected $mailer; + /** @var Swift_Message|callable(string, Record[]): Swift_Message */ + private $messageTemplate; + + /** + * @psalm-param Swift_Message|callable(string, Record[]): Swift_Message $message + * + * @param \Swift_Mailer $mailer The mailer to use + * @param callable|Swift_Message $message An example message for real messages, only the body will be replaced + */ + public function __construct(\Swift_Mailer $mailer, $message, $level = Logger::ERROR, bool $bubble = true) + { + parent::__construct($level, $bubble); + + @trigger_error('The SwiftMailerHandler is deprecated since Monolog 2.6. Use SymfonyMailerHandler instead.', E_USER_DEPRECATED); + + $this->mailer = $mailer; + $this->messageTemplate = $message; + } + + /** + * {@inheritDoc} + */ + protected function send(string $content, array $records): void + { + $this->mailer->send($this->buildMessage($content, $records)); + } + + /** + * Gets the formatter for the Swift_Message subject. + * + * @param string|null $format The format of the subject + */ + protected function getSubjectFormatter(?string $format): FormatterInterface + { + return new LineFormatter($format); + } + + /** + * Creates instance of Swift_Message to be sent + * + * @param string $content formatted email body to be sent + * @param array $records Log records that formed the content + * @return Swift_Message + * + * @phpstan-param Record[] $records + */ + protected function buildMessage(string $content, array $records): Swift_Message + { + $message = null; + if ($this->messageTemplate instanceof Swift_Message) { + $message = clone $this->messageTemplate; + $message->generateId(); + } elseif (is_callable($this->messageTemplate)) { + $message = ($this->messageTemplate)($content, $records); + } + + if (!$message instanceof Swift_Message) { + $record = reset($records); + throw new \InvalidArgumentException('Could not resolve message as instance of Swift_Message or a callable returning it' . ($record ? Utils::getRecordMessageForException($record) : '')); + } + + if ($records) { + $subjectFormatter = $this->getSubjectFormatter($message->getSubject()); + $message->setSubject($subjectFormatter->format($this->getHighestRecord($records))); + } + + $mime = 'text/plain'; + if ($this->isHtmlBody($content)) { + $mime = 'text/html'; + } + + $message->setBody($content, $mime); + /** @phpstan-ignore-next-line */ + if (version_compare(Swift::VERSION, '6.0.0', '>=')) { + $message->setDate(new \DateTimeImmutable()); + } else { + /** @phpstan-ignore-next-line */ + $message->setDate(time()); + } + + return $message; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SymfonyMailerHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SymfonyMailerHandler.php new file mode 100644 index 00000000..130e6f1f --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/SymfonyMailerHandler.php @@ -0,0 +1,111 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Utils; +use Monolog\Formatter\FormatterInterface; +use Monolog\Formatter\LineFormatter; +use Symfony\Component\Mailer\MailerInterface; +use Symfony\Component\Mailer\Transport\TransportInterface; +use Symfony\Component\Mime\Email; + +/** + * SymfonyMailerHandler uses Symfony's Mailer component to send the emails + * + * @author Jordi Boggiano <j.boggiano@seld.be> + * + * @phpstan-import-type Record from \Monolog\Logger + */ +class SymfonyMailerHandler extends MailHandler +{ + /** @var MailerInterface|TransportInterface */ + protected $mailer; + /** @var Email|callable(string, Record[]): Email */ + private $emailTemplate; + + /** + * @psalm-param Email|callable(string, Record[]): Email $email + * + * @param MailerInterface|TransportInterface $mailer The mailer to use + * @param callable|Email $email An email template, the subject/body will be replaced + */ + public function __construct($mailer, $email, $level = Logger::ERROR, bool $bubble = true) + { + parent::__construct($level, $bubble); + + $this->mailer = $mailer; + $this->emailTemplate = $email; + } + + /** + * {@inheritDoc} + */ + protected function send(string $content, array $records): void + { + $this->mailer->send($this->buildMessage($content, $records)); + } + + /** + * Gets the formatter for the Swift_Message subject. + * + * @param string|null $format The format of the subject + */ + protected function getSubjectFormatter(?string $format): FormatterInterface + { + return new LineFormatter($format); + } + + /** + * Creates instance of Email to be sent + * + * @param string $content formatted email body to be sent + * @param array $records Log records that formed the content + * + * @phpstan-param Record[] $records + */ + protected function buildMessage(string $content, array $records): Email + { + $message = null; + if ($this->emailTemplate instanceof Email) { + $message = clone $this->emailTemplate; + } elseif (is_callable($this->emailTemplate)) { + $message = ($this->emailTemplate)($content, $records); + } + + if (!$message instanceof Email) { + $record = reset($records); + throw new \InvalidArgumentException('Could not resolve message as instance of Email or a callable returning it' . ($record ? Utils::getRecordMessageForException($record) : '')); + } + + if ($records) { + $subjectFormatter = $this->getSubjectFormatter($message->getSubject()); + $message->subject($subjectFormatter->format($this->getHighestRecord($records))); + } + + if ($this->isHtmlBody($content)) { + if (null !== ($charset = $message->getHtmlCharset())) { + $message->html($content, $charset); + } else { + $message->html($content); + } + } else { + if (null !== ($charset = $message->getTextCharset())) { + $message->text($content, $charset); + } else { + $message->text($content); + } + } + + return $message->date(new \DateTimeImmutable()); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php new file mode 100644 index 00000000..1d543b7e --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php @@ -0,0 +1,68 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Utils; + +/** + * Logs to syslog service. + * + * usage example: + * + * $log = new Logger('application'); + * $syslog = new SyslogHandler('myfacility', 'local6'); + * $formatter = new LineFormatter("%channel%.%level_name%: %message% %extra%"); + * $syslog->setFormatter($formatter); + * $log->pushHandler($syslog); + * + * @author Sven Paulus <sven@karlsruhe.org> + */ +class SyslogHandler extends AbstractSyslogHandler +{ + /** @var string */ + protected $ident; + /** @var int */ + protected $logopts; + + /** + * @param string $ident + * @param string|int $facility Either one of the names of the keys in $this->facilities, or a LOG_* facility constant + * @param int $logopts Option flags for the openlog() call, defaults to LOG_PID + */ + public function __construct(string $ident, $facility = LOG_USER, $level = Logger::DEBUG, bool $bubble = true, int $logopts = LOG_PID) + { + parent::__construct($facility, $level, $bubble); + + $this->ident = $ident; + $this->logopts = $logopts; + } + + /** + * {@inheritDoc} + */ + public function close(): void + { + closelog(); + } + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + if (!openlog($this->ident, $this->logopts, $this->facility)) { + throw new \LogicException('Can\'t open syslog for ident "'.$this->ident.'" and facility "'.$this->facility.'"' . Utils::getRecordMessageForException($record)); + } + syslog($this->logLevels[$record['level']], (string) $record['formatted']); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php b/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php new file mode 100644 index 00000000..dbd8ef69 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php @@ -0,0 +1,88 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler\SyslogUdp; + +use Monolog\Utils; +use Socket; + +class UdpSocket +{ + protected const DATAGRAM_MAX_LENGTH = 65023; + + /** @var string */ + protected $ip; + /** @var int */ + protected $port; + /** @var resource|Socket|null */ + protected $socket = null; + + public function __construct(string $ip, int $port = 514) + { + $this->ip = $ip; + $this->port = $port; + } + + /** + * @param string $line + * @param string $header + * @return void + */ + public function write($line, $header = "") + { + $this->send($this->assembleMessage($line, $header)); + } + + public function close(): void + { + if (is_resource($this->socket) || $this->socket instanceof Socket) { + socket_close($this->socket); + $this->socket = null; + } + } + + /** + * @return resource|Socket + */ + protected function getSocket() + { + if (null !== $this->socket) { + return $this->socket; + } + + $domain = AF_INET; + $protocol = SOL_UDP; + // Check if we are using unix sockets. + if ($this->port === 0) { + $domain = AF_UNIX; + $protocol = IPPROTO_IP; + } + + $this->socket = socket_create($domain, SOCK_DGRAM, $protocol) ?: null; + if (null === $this->socket) { + throw new \RuntimeException('The UdpSocket to '.$this->ip.':'.$this->port.' could not be opened via socket_create'); + } + + return $this->socket; + } + + protected function send(string $chunk): void + { + socket_sendto($this->getSocket(), $chunk, strlen($chunk), $flags = 0, $this->ip, $this->port); + } + + protected function assembleMessage(string $line, string $header): string + { + $chunkSize = static::DATAGRAM_MAX_LENGTH - strlen($header); + + return $header . Utils::substr($line, 0, $chunkSize); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php new file mode 100644 index 00000000..deaa19f8 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php @@ -0,0 +1,150 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use DateTimeInterface; +use Monolog\Logger; +use Monolog\Handler\SyslogUdp\UdpSocket; +use Monolog\Utils; + +/** + * A Handler for logging to a remote syslogd server. + * + * @author Jesper Skovgaard Nielsen <nulpunkt@gmail.com> + * @author Dominik Kukacka <dominik.kukacka@gmail.com> + */ +class SyslogUdpHandler extends AbstractSyslogHandler +{ + const RFC3164 = 0; + const RFC5424 = 1; + const RFC5424e = 2; + + /** @var array<self::RFC*, string> */ + private $dateFormats = array( + self::RFC3164 => 'M d H:i:s', + self::RFC5424 => \DateTime::RFC3339, + self::RFC5424e => \DateTime::RFC3339_EXTENDED, + ); + + /** @var UdpSocket */ + protected $socket; + /** @var string */ + protected $ident; + /** @var self::RFC* */ + protected $rfc; + + /** + * @param string $host Either IP/hostname or a path to a unix socket (port must be 0 then) + * @param int $port Port number, or 0 if $host is a unix socket + * @param string|int $facility Either one of the names of the keys in $this->facilities, or a LOG_* facility constant + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param string $ident Program name or tag for each log message. + * @param int $rfc RFC to format the message for. + * @throws MissingExtensionException + * + * @phpstan-param self::RFC* $rfc + */ + public function __construct(string $host, int $port = 514, $facility = LOG_USER, $level = Logger::DEBUG, bool $bubble = true, string $ident = 'php', int $rfc = self::RFC5424) + { + if (!extension_loaded('sockets')) { + throw new MissingExtensionException('The sockets extension is required to use the SyslogUdpHandler'); + } + + parent::__construct($facility, $level, $bubble); + + $this->ident = $ident; + $this->rfc = $rfc; + + $this->socket = new UdpSocket($host, $port); + } + + protected function write(array $record): void + { + $lines = $this->splitMessageIntoLines($record['formatted']); + + $header = $this->makeCommonSyslogHeader($this->logLevels[$record['level']], $record['datetime']); + + foreach ($lines as $line) { + $this->socket->write($line, $header); + } + } + + public function close(): void + { + $this->socket->close(); + } + + /** + * @param string|string[] $message + * @return string[] + */ + private function splitMessageIntoLines($message): array + { + if (is_array($message)) { + $message = implode("\n", $message); + } + + $lines = preg_split('/$\R?^/m', (string) $message, -1, PREG_SPLIT_NO_EMPTY); + if (false === $lines) { + $pcreErrorCode = preg_last_error(); + throw new \RuntimeException('Could not preg_split: ' . $pcreErrorCode . ' / ' . Utils::pcreLastErrorMessage($pcreErrorCode)); + } + + return $lines; + } + + /** + * Make common syslog header (see rfc5424 or rfc3164) + */ + protected function makeCommonSyslogHeader(int $severity, DateTimeInterface $datetime): string + { + $priority = $severity + $this->facility; + + if (!$pid = getmypid()) { + $pid = '-'; + } + + if (!$hostname = gethostname()) { + $hostname = '-'; + } + + if ($this->rfc === self::RFC3164) { + // see https://github.com/phpstan/phpstan/issues/5348 + // @phpstan-ignore-next-line + $dateNew = $datetime->setTimezone(new \DateTimeZone('UTC')); + $date = $dateNew->format($this->dateFormats[$this->rfc]); + + return "<$priority>" . + $date . " " . + $hostname . " " . + $this->ident . "[" . $pid . "]: "; + } + + $date = $datetime->format($this->dateFormats[$this->rfc]); + + return "<$priority>1 " . + $date . " " . + $hostname . " " . + $this->ident . " " . + $pid . " - - "; + } + + /** + * Inject your own socket, mainly used for testing + */ + public function setSocket(UdpSocket $socket): self + { + $this->socket = $socket; + + return $this; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/TelegramBotHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/TelegramBotHandler.php new file mode 100644 index 00000000..a6223b79 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/TelegramBotHandler.php @@ -0,0 +1,274 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use RuntimeException; +use Monolog\Logger; +use Monolog\Utils; + +/** + * Handler send logs to Telegram using Telegram Bot API. + * + * How to use: + * 1) Create telegram bot with https://telegram.me/BotFather + * 2) Create a telegram channel where logs will be recorded. + * 3) Add created bot from step 1 to the created channel from step 2. + * + * Use telegram bot API key from step 1 and channel name with '@' prefix from step 2 to create instance of TelegramBotHandler + * + * @link https://core.telegram.org/bots/api + * + * @author Mazur Alexandr <alexandrmazur96@gmail.com> + * + * @phpstan-import-type Record from \Monolog\Logger + */ +class TelegramBotHandler extends AbstractProcessingHandler +{ + private const BOT_API = 'https://api.telegram.org/bot'; + + /** + * The available values of parseMode according to the Telegram api documentation + */ + private const AVAILABLE_PARSE_MODES = [ + 'HTML', + 'MarkdownV2', + 'Markdown', // legacy mode without underline and strikethrough, use MarkdownV2 instead + ]; + + /** + * The maximum number of characters allowed in a message according to the Telegram api documentation + */ + private const MAX_MESSAGE_LENGTH = 4096; + + /** + * Telegram bot access token provided by BotFather. + * Create telegram bot with https://telegram.me/BotFather and use access token from it. + * @var string + */ + private $apiKey; + + /** + * Telegram channel name. + * Since to start with '@' symbol as prefix. + * @var string + */ + private $channel; + + /** + * The kind of formatting that is used for the message. + * See available options at https://core.telegram.org/bots/api#formatting-options + * or in AVAILABLE_PARSE_MODES + * @var ?string + */ + private $parseMode; + + /** + * Disables link previews for links in the message. + * @var ?bool + */ + private $disableWebPagePreview; + + /** + * Sends the message silently. Users will receive a notification with no sound. + * @var ?bool + */ + private $disableNotification; + + /** + * True - split a message longer than MAX_MESSAGE_LENGTH into parts and send in multiple messages. + * False - truncates a message that is too long. + * @var bool + */ + private $splitLongMessages; + + /** + * Adds 1-second delay between sending a split message (according to Telegram API to avoid 429 Too Many Requests). + * @var bool + */ + private $delayBetweenMessages; + + /** + * @param string $apiKey Telegram bot access token provided by BotFather + * @param string $channel Telegram channel name + * @param bool $splitLongMessages Split a message longer than MAX_MESSAGE_LENGTH into parts and send in multiple messages + * @param bool $delayBetweenMessages Adds delay between sending a split message according to Telegram API + * @throws MissingExtensionException + */ + public function __construct( + string $apiKey, + string $channel, + $level = Logger::DEBUG, + bool $bubble = true, + ?string $parseMode = null, + ?bool $disableWebPagePreview = null, + ?bool $disableNotification = null, + bool $splitLongMessages = false, + bool $delayBetweenMessages = false + ) + { + if (!extension_loaded('curl')) { + throw new MissingExtensionException('The curl extension is needed to use the TelegramBotHandler'); + } + + parent::__construct($level, $bubble); + + $this->apiKey = $apiKey; + $this->channel = $channel; + $this->setParseMode($parseMode); + $this->disableWebPagePreview($disableWebPagePreview); + $this->disableNotification($disableNotification); + $this->splitLongMessages($splitLongMessages); + $this->delayBetweenMessages($delayBetweenMessages); + } + + public function setParseMode(?string $parseMode = null): self + { + if ($parseMode !== null && !in_array($parseMode, self::AVAILABLE_PARSE_MODES)) { + throw new \InvalidArgumentException('Unknown parseMode, use one of these: ' . implode(', ', self::AVAILABLE_PARSE_MODES) . '.'); + } + + $this->parseMode = $parseMode; + + return $this; + } + + public function disableWebPagePreview(?bool $disableWebPagePreview = null): self + { + $this->disableWebPagePreview = $disableWebPagePreview; + + return $this; + } + + public function disableNotification(?bool $disableNotification = null): self + { + $this->disableNotification = $disableNotification; + + return $this; + } + + /** + * True - split a message longer than MAX_MESSAGE_LENGTH into parts and send in multiple messages. + * False - truncates a message that is too long. + * @param bool $splitLongMessages + * @return $this + */ + public function splitLongMessages(bool $splitLongMessages = false): self + { + $this->splitLongMessages = $splitLongMessages; + + return $this; + } + + /** + * Adds 1-second delay between sending a split message (according to Telegram API to avoid 429 Too Many Requests). + * @param bool $delayBetweenMessages + * @return $this + */ + public function delayBetweenMessages(bool $delayBetweenMessages = false): self + { + $this->delayBetweenMessages = $delayBetweenMessages; + + return $this; + } + + /** + * {@inheritDoc} + */ + public function handleBatch(array $records): void + { + /** @var Record[] $messages */ + $messages = []; + + foreach ($records as $record) { + if (!$this->isHandling($record)) { + continue; + } + + if ($this->processors) { + /** @var Record $record */ + $record = $this->processRecord($record); + } + + $messages[] = $record; + } + + if (!empty($messages)) { + $this->send((string)$this->getFormatter()->formatBatch($messages)); + } + } + + /** + * @inheritDoc + */ + protected function write(array $record): void + { + $this->send($record['formatted']); + } + + /** + * Send request to @link https://api.telegram.org/bot on SendMessage action. + * @param string $message + */ + protected function send(string $message): void + { + $messages = $this->handleMessageLength($message); + + foreach ($messages as $key => $msg) { + if ($this->delayBetweenMessages && $key > 0) { + sleep(1); + } + + $this->sendCurl($msg); + } + } + + protected function sendCurl(string $message): void + { + $ch = curl_init(); + $url = self::BOT_API . $this->apiKey . '/SendMessage'; + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([ + 'text' => $message, + 'chat_id' => $this->channel, + 'parse_mode' => $this->parseMode, + 'disable_web_page_preview' => $this->disableWebPagePreview, + 'disable_notification' => $this->disableNotification, + ])); + + $result = Curl\Util::execute($ch); + if (!is_string($result)) { + throw new RuntimeException('Telegram API error. Description: No response'); + } + $result = json_decode($result, true); + + if ($result['ok'] === false) { + throw new RuntimeException('Telegram API error. Description: ' . $result['description']); + } + } + + /** + * Handle a message that is too long: truncates or splits into several + * @param string $message + * @return string[] + */ + private function handleMessageLength(string $message): array + { + $truncatedMarker = ' (...truncated)'; + if (!$this->splitLongMessages && strlen($message) > self::MAX_MESSAGE_LENGTH) { + return [Utils::substr($message, 0, self::MAX_MESSAGE_LENGTH - strlen($truncatedMarker)) . $truncatedMarker]; + } + + return str_split($message, self::MAX_MESSAGE_LENGTH); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php new file mode 100644 index 00000000..0986da27 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php @@ -0,0 +1,231 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Psr\Log\LogLevel; + +/** + * Used for testing purposes. + * + * It records all records and gives you access to them for verification. + * + * @author Jordi Boggiano <j.boggiano@seld.be> + * + * @method bool hasEmergency($record) + * @method bool hasAlert($record) + * @method bool hasCritical($record) + * @method bool hasError($record) + * @method bool hasWarning($record) + * @method bool hasNotice($record) + * @method bool hasInfo($record) + * @method bool hasDebug($record) + * + * @method bool hasEmergencyRecords() + * @method bool hasAlertRecords() + * @method bool hasCriticalRecords() + * @method bool hasErrorRecords() + * @method bool hasWarningRecords() + * @method bool hasNoticeRecords() + * @method bool hasInfoRecords() + * @method bool hasDebugRecords() + * + * @method bool hasEmergencyThatContains($message) + * @method bool hasAlertThatContains($message) + * @method bool hasCriticalThatContains($message) + * @method bool hasErrorThatContains($message) + * @method bool hasWarningThatContains($message) + * @method bool hasNoticeThatContains($message) + * @method bool hasInfoThatContains($message) + * @method bool hasDebugThatContains($message) + * + * @method bool hasEmergencyThatMatches($message) + * @method bool hasAlertThatMatches($message) + * @method bool hasCriticalThatMatches($message) + * @method bool hasErrorThatMatches($message) + * @method bool hasWarningThatMatches($message) + * @method bool hasNoticeThatMatches($message) + * @method bool hasInfoThatMatches($message) + * @method bool hasDebugThatMatches($message) + * + * @method bool hasEmergencyThatPasses($message) + * @method bool hasAlertThatPasses($message) + * @method bool hasCriticalThatPasses($message) + * @method bool hasErrorThatPasses($message) + * @method bool hasWarningThatPasses($message) + * @method bool hasNoticeThatPasses($message) + * @method bool hasInfoThatPasses($message) + * @method bool hasDebugThatPasses($message) + * + * @phpstan-import-type Record from \Monolog\Logger + * @phpstan-import-type Level from \Monolog\Logger + * @phpstan-import-type LevelName from \Monolog\Logger + */ +class TestHandler extends AbstractProcessingHandler +{ + /** @var Record[] */ + protected $records = []; + /** @var array<Level, Record[]> */ + protected $recordsByLevel = []; + /** @var bool */ + private $skipReset = false; + + /** + * @return array + * + * @phpstan-return Record[] + */ + public function getRecords() + { + return $this->records; + } + + /** + * @return void + */ + public function clear() + { + $this->records = []; + $this->recordsByLevel = []; + } + + /** + * @return void + */ + public function reset() + { + if (!$this->skipReset) { + $this->clear(); + } + } + + /** + * @return void + */ + public function setSkipReset(bool $skipReset) + { + $this->skipReset = $skipReset; + } + + /** + * @param string|int $level Logging level value or name + * + * @phpstan-param Level|LevelName|LogLevel::* $level + */ + public function hasRecords($level): bool + { + return isset($this->recordsByLevel[Logger::toMonologLevel($level)]); + } + + /** + * @param string|array $record Either a message string or an array containing message and optionally context keys that will be checked against all records + * @param string|int $level Logging level value or name + * + * @phpstan-param array{message: string, context?: mixed[]}|string $record + * @phpstan-param Level|LevelName|LogLevel::* $level + */ + public function hasRecord($record, $level): bool + { + if (is_string($record)) { + $record = array('message' => $record); + } + + return $this->hasRecordThatPasses(function ($rec) use ($record) { + if ($rec['message'] !== $record['message']) { + return false; + } + if (isset($record['context']) && $rec['context'] !== $record['context']) { + return false; + } + + return true; + }, $level); + } + + /** + * @param string|int $level Logging level value or name + * + * @phpstan-param Level|LevelName|LogLevel::* $level + */ + public function hasRecordThatContains(string $message, $level): bool + { + return $this->hasRecordThatPasses(function ($rec) use ($message) { + return strpos($rec['message'], $message) !== false; + }, $level); + } + + /** + * @param string|int $level Logging level value or name + * + * @phpstan-param Level|LevelName|LogLevel::* $level + */ + public function hasRecordThatMatches(string $regex, $level): bool + { + return $this->hasRecordThatPasses(function (array $rec) use ($regex): bool { + return preg_match($regex, $rec['message']) > 0; + }, $level); + } + + /** + * @param string|int $level Logging level value or name + * @return bool + * + * @psalm-param callable(Record, int): mixed $predicate + * @phpstan-param Level|LevelName|LogLevel::* $level + */ + public function hasRecordThatPasses(callable $predicate, $level) + { + $level = Logger::toMonologLevel($level); + + if (!isset($this->recordsByLevel[$level])) { + return false; + } + + foreach ($this->recordsByLevel[$level] as $i => $rec) { + if ($predicate($rec, $i)) { + return true; + } + } + + return false; + } + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + $this->recordsByLevel[$record['level']][] = $record; + $this->records[] = $record; + } + + /** + * @param string $method + * @param mixed[] $args + * @return bool + */ + public function __call($method, $args) + { + if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { + $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3]; + $level = constant('Monolog\Logger::' . strtoupper($matches[2])); + $callback = [$this, $genericMethod]; + if (is_callable($callback)) { + $args[] = $level; + + return call_user_func_array($callback, $args); + } + } + + throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()'); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/WebRequestRecognizerTrait.php b/vendor/monolog/monolog/src/Monolog/Handler/WebRequestRecognizerTrait.php new file mode 100644 index 00000000..c8183528 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/WebRequestRecognizerTrait.php @@ -0,0 +1,24 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +trait WebRequestRecognizerTrait +{ + /** + * Checks if PHP's serving a web request + * @return bool + */ + protected function isWebRequest(): bool + { + return 'cli' !== \PHP_SAPI && 'phpdbg' !== \PHP_SAPI; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php new file mode 100644 index 00000000..b6d3d3b1 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php @@ -0,0 +1,81 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +/** + * Forwards records to multiple handlers suppressing failures of each handler + * and continuing through to give every handler a chance to succeed. + * + * @author Craig D'Amelio <craig@damelio.ca> + * + * @phpstan-import-type Record from \Monolog\Logger + */ +class WhatFailureGroupHandler extends GroupHandler +{ + /** + * {@inheritDoc} + */ + public function handle(array $record): bool + { + if ($this->processors) { + /** @var Record $record */ + $record = $this->processRecord($record); + } + + foreach ($this->handlers as $handler) { + try { + $handler->handle($record); + } catch (\Throwable $e) { + // What failure? + } + } + + return false === $this->bubble; + } + + /** + * {@inheritDoc} + */ + public function handleBatch(array $records): void + { + if ($this->processors) { + $processed = array(); + foreach ($records as $record) { + $processed[] = $this->processRecord($record); + } + /** @var Record[] $records */ + $records = $processed; + } + + foreach ($this->handlers as $handler) { + try { + $handler->handleBatch($records); + } catch (\Throwable $e) { + // What failure? + } + } + } + + /** + * {@inheritDoc} + */ + public function close(): void + { + foreach ($this->handlers as $handler) { + try { + $handler->close(); + } catch (\Throwable $e) { + // What failure? + } + } + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php new file mode 100644 index 00000000..ddd46d8c --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php @@ -0,0 +1,101 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\FormatterInterface; +use Monolog\Formatter\NormalizerFormatter; +use Monolog\Logger; + +/** + * Handler sending logs to Zend Monitor + * + * @author Christian Bergau <cbergau86@gmail.com> + * @author Jason Davis <happydude@jasondavis.net> + * + * @phpstan-import-type FormattedRecord from AbstractProcessingHandler + */ +class ZendMonitorHandler extends AbstractProcessingHandler +{ + /** + * Monolog level / ZendMonitor Custom Event priority map + * + * @var array<int, int> + */ + protected $levelMap = []; + + /** + * @throws MissingExtensionException + */ + public function __construct($level = Logger::DEBUG, bool $bubble = true) + { + if (!function_exists('zend_monitor_custom_event')) { + throw new MissingExtensionException( + 'You must have Zend Server installed with Zend Monitor enabled in order to use this handler' + ); + } + //zend monitor constants are not defined if zend monitor is not enabled. + $this->levelMap = [ + Logger::DEBUG => \ZEND_MONITOR_EVENT_SEVERITY_INFO, + Logger::INFO => \ZEND_MONITOR_EVENT_SEVERITY_INFO, + Logger::NOTICE => \ZEND_MONITOR_EVENT_SEVERITY_INFO, + Logger::WARNING => \ZEND_MONITOR_EVENT_SEVERITY_WARNING, + Logger::ERROR => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, + Logger::CRITICAL => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, + Logger::ALERT => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, + Logger::EMERGENCY => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, + ]; + parent::__construct($level, $bubble); + } + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + $this->writeZendMonitorCustomEvent( + Logger::getLevelName($record['level']), + $record['message'], + $record['formatted'], + $this->levelMap[$record['level']] + ); + } + + /** + * Write to Zend Monitor Events + * @param string $type Text displayed in "Class Name (custom)" field + * @param string $message Text displayed in "Error String" + * @param array $formatted Displayed in Custom Variables tab + * @param int $severity Set the event severity level (-1,0,1) + * + * @phpstan-param FormattedRecord $formatted + */ + protected function writeZendMonitorCustomEvent(string $type, string $message, array $formatted, int $severity): void + { + zend_monitor_custom_event($type, $message, $formatted, $severity); + } + + /** + * {@inheritDoc} + */ + public function getDefaultFormatter(): FormatterInterface + { + return new NormalizerFormatter(); + } + + /** + * @return array<int, int> + */ + public function getLevelMap(): array + { + return $this->levelMap; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/LogRecord.php b/vendor/monolog/monolog/src/Monolog/LogRecord.php new file mode 100644 index 00000000..702807d7 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/LogRecord.php @@ -0,0 +1,34 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog; + +use ArrayAccess; + +/** + * Monolog log record interface for forward compatibility with Monolog 3.0 + * + * This is just present in Monolog 2.4+ to allow interoperable code to be written against + * both versions by type-hinting arguments as `array|\Monolog\LogRecord $record` + * + * Do not rely on this interface for other purposes, and do not implement it. + * + * @author Jordi Boggiano <j.boggiano@seld.be> + * @template-extends \ArrayAccess<'message'|'level'|'context'|'level_name'|'channel'|'datetime'|'extra'|'formatted', mixed> + * @phpstan-import-type Record from Logger + */ +interface LogRecord extends \ArrayAccess +{ + /** + * @phpstan-return Record + */ + public function toArray(): array; +} diff --git a/vendor/monolog/monolog/src/Monolog/Logger.php b/vendor/monolog/monolog/src/Monolog/Logger.php new file mode 100644 index 00000000..3c588a70 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Logger.php @@ -0,0 +1,761 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog; + +use DateTimeZone; +use Monolog\Handler\HandlerInterface; +use Psr\Log\LoggerInterface; +use Psr\Log\InvalidArgumentException; +use Psr\Log\LogLevel; +use Throwable; +use Stringable; + +/** + * Monolog log channel + * + * It contains a stack of Handlers and a stack of Processors, + * and uses them to store records that are added to it. + * + * @author Jordi Boggiano <j.boggiano@seld.be> + * + * @phpstan-type Level Logger::DEBUG|Logger::INFO|Logger::NOTICE|Logger::WARNING|Logger::ERROR|Logger::CRITICAL|Logger::ALERT|Logger::EMERGENCY + * @phpstan-type LevelName 'DEBUG'|'INFO'|'NOTICE'|'WARNING'|'ERROR'|'CRITICAL'|'ALERT'|'EMERGENCY' + * @phpstan-type Record array{message: string, context: mixed[], level: Level, level_name: LevelName, channel: string, datetime: \DateTimeImmutable, extra: mixed[]} + */ +class Logger implements LoggerInterface, ResettableInterface +{ + /** + * Detailed debug information + */ + public const DEBUG = 100; + + /** + * Interesting events + * + * Examples: User logs in, SQL logs. + */ + public const INFO = 200; + + /** + * Uncommon events + */ + public const NOTICE = 250; + + /** + * Exceptional occurrences that are not errors + * + * Examples: Use of deprecated APIs, poor use of an API, + * undesirable things that are not necessarily wrong. + */ + public const WARNING = 300; + + /** + * Runtime errors + */ + public const ERROR = 400; + + /** + * Critical conditions + * + * Example: Application component unavailable, unexpected exception. + */ + public const CRITICAL = 500; + + /** + * Action must be taken immediately + * + * Example: Entire website down, database unavailable, etc. + * This should trigger the SMS alerts and wake you up. + */ + public const ALERT = 550; + + /** + * Urgent alert. + */ + public const EMERGENCY = 600; + + /** + * Monolog API version + * + * This is only bumped when API breaks are done and should + * follow the major version of the library + * + * @var int + */ + public const API = 2; + + /** + * This is a static variable and not a constant to serve as an extension point for custom levels + * + * @var array<int, string> $levels Logging levels with the levels as key + * + * @phpstan-var array<Level, LevelName> $levels Logging levels with the levels as key + */ + protected static $levels = [ + self::DEBUG => 'DEBUG', + self::INFO => 'INFO', + self::NOTICE => 'NOTICE', + self::WARNING => 'WARNING', + self::ERROR => 'ERROR', + self::CRITICAL => 'CRITICAL', + self::ALERT => 'ALERT', + self::EMERGENCY => 'EMERGENCY', + ]; + + /** + * Mapping between levels numbers defined in RFC 5424 and Monolog ones + * + * @phpstan-var array<int, Level> $rfc_5424_levels + */ + private const RFC_5424_LEVELS = [ + 7 => self::DEBUG, + 6 => self::INFO, + 5 => self::NOTICE, + 4 => self::WARNING, + 3 => self::ERROR, + 2 => self::CRITICAL, + 1 => self::ALERT, + 0 => self::EMERGENCY, + ]; + + /** + * @var string + */ + protected $name; + + /** + * The handler stack + * + * @var HandlerInterface[] + */ + protected $handlers; + + /** + * Processors that will process all log records + * + * To process records of a single handler instead, add the processor on that specific handler + * + * @var callable[] + */ + protected $processors; + + /** + * @var bool + */ + protected $microsecondTimestamps = true; + + /** + * @var DateTimeZone + */ + protected $timezone; + + /** + * @var callable|null + */ + protected $exceptionHandler; + + /** + * @var int Keeps track of depth to prevent infinite logging loops + */ + private $logDepth = 0; + + /** + * @var \WeakMap<\Fiber, int>|null Keeps track of depth inside fibers to prevent infinite logging loops + */ + private $fiberLogDepth; + + /** + * @var bool Whether to detect infinite logging loops + * + * This can be disabled via {@see useLoggingLoopDetection} if you have async handlers that do not play well with this + */ + private $detectCycles = true; + + /** + * @psalm-param array<callable(array): array> $processors + * + * @param string $name The logging channel, a simple descriptive name that is attached to all log records + * @param HandlerInterface[] $handlers Optional stack of handlers, the first one in the array is called first, etc. + * @param callable[] $processors Optional array of processors + * @param DateTimeZone|null $timezone Optional timezone, if not provided date_default_timezone_get() will be used + */ + public function __construct(string $name, array $handlers = [], array $processors = [], ?DateTimeZone $timezone = null) + { + $this->name = $name; + $this->setHandlers($handlers); + $this->processors = $processors; + $this->timezone = $timezone ?: new DateTimeZone(date_default_timezone_get() ?: 'UTC'); + + if (\PHP_VERSION_ID >= 80100) { + // Local variable for phpstan, see https://github.com/phpstan/phpstan/issues/6732#issuecomment-1111118412 + /** @var \WeakMap<\Fiber, int> $fiberLogDepth */ + $fiberLogDepth = new \WeakMap(); + $this->fiberLogDepth = $fiberLogDepth; + } + } + + public function getName(): string + { + return $this->name; + } + + /** + * Return a new cloned instance with the name changed + */ + public function withName(string $name): self + { + $new = clone $this; + $new->name = $name; + + return $new; + } + + /** + * Pushes a handler on to the stack. + */ + public function pushHandler(HandlerInterface $handler): self + { + array_unshift($this->handlers, $handler); + + return $this; + } + + /** + * Pops a handler from the stack + * + * @throws \LogicException If empty handler stack + */ + public function popHandler(): HandlerInterface + { + if (!$this->handlers) { + throw new \LogicException('You tried to pop from an empty handler stack.'); + } + + return array_shift($this->handlers); + } + + /** + * Set handlers, replacing all existing ones. + * + * If a map is passed, keys will be ignored. + * + * @param HandlerInterface[] $handlers + */ + public function setHandlers(array $handlers): self + { + $this->handlers = []; + foreach (array_reverse($handlers) as $handler) { + $this->pushHandler($handler); + } + + return $this; + } + + /** + * @return HandlerInterface[] + */ + public function getHandlers(): array + { + return $this->handlers; + } + + /** + * Adds a processor on to the stack. + */ + public function pushProcessor(callable $callback): self + { + array_unshift($this->processors, $callback); + + return $this; + } + + /** + * Removes the processor on top of the stack and returns it. + * + * @throws \LogicException If empty processor stack + * @return callable + */ + public function popProcessor(): callable + { + if (!$this->processors) { + throw new \LogicException('You tried to pop from an empty processor stack.'); + } + + return array_shift($this->processors); + } + + /** + * @return callable[] + */ + public function getProcessors(): array + { + return $this->processors; + } + + /** + * Control the use of microsecond resolution timestamps in the 'datetime' + * member of new records. + * + * As of PHP7.1 microseconds are always included by the engine, so + * there is no performance penalty and Monolog 2 enabled microseconds + * by default. This function lets you disable them though in case you want + * to suppress microseconds from the output. + * + * @param bool $micro True to use microtime() to create timestamps + */ + public function useMicrosecondTimestamps(bool $micro): self + { + $this->microsecondTimestamps = $micro; + + return $this; + } + + public function useLoggingLoopDetection(bool $detectCycles): self + { + $this->detectCycles = $detectCycles; + + return $this; + } + + /** + * Adds a log record. + * + * @param int $level The logging level (a Monolog or RFC 5424 level) + * @param string $message The log message + * @param mixed[] $context The log context + * @param DateTimeImmutable $datetime Optional log date to log into the past or future + * @return bool Whether the record has been processed + * + * @phpstan-param Level $level + */ + public function addRecord(int $level, string $message, array $context = [], ?DateTimeImmutable $datetime = null): bool + { + if (isset(self::RFC_5424_LEVELS[$level])) { + $level = self::RFC_5424_LEVELS[$level]; + } + + if ($this->detectCycles) { + if (\PHP_VERSION_ID >= 80100 && $fiber = \Fiber::getCurrent()) { + $this->fiberLogDepth[$fiber] = $this->fiberLogDepth[$fiber] ?? 0; + $logDepth = ++$this->fiberLogDepth[$fiber]; + } else { + $logDepth = ++$this->logDepth; + } + } else { + $logDepth = 0; + } + + if ($logDepth === 3) { + $this->warning('A possible infinite logging loop was detected and aborted. It appears some of your handler code is triggering logging, see the previous log record for a hint as to what may be the cause.'); + return false; + } elseif ($logDepth >= 5) { // log depth 4 is let through, so we can log the warning above + return false; + } + + try { + $record = null; + + foreach ($this->handlers as $handler) { + if (null === $record) { + // skip creating the record as long as no handler is going to handle it + if (!$handler->isHandling(['level' => $level])) { + continue; + } + + $levelName = static::getLevelName($level); + + $record = [ + 'message' => $message, + 'context' => $context, + 'level' => $level, + 'level_name' => $levelName, + 'channel' => $this->name, + 'datetime' => $datetime ?? new DateTimeImmutable($this->microsecondTimestamps, $this->timezone), + 'extra' => [], + ]; + + try { + foreach ($this->processors as $processor) { + $record = $processor($record); + } + } catch (Throwable $e) { + $this->handleException($e, $record); + + return true; + } + } + + // once the record exists, send it to all handlers as long as the bubbling chain is not interrupted + try { + if (true === $handler->handle($record)) { + break; + } + } catch (Throwable $e) { + $this->handleException($e, $record); + + return true; + } + } + } finally { + if ($this->detectCycles) { + if (isset($fiber)) { + $this->fiberLogDepth[$fiber]--; + } else { + $this->logDepth--; + } + } + } + + return null !== $record; + } + + /** + * Ends a log cycle and frees all resources used by handlers. + * + * Closing a Handler means flushing all buffers and freeing any open resources/handles. + * Handlers that have been closed should be able to accept log records again and re-open + * themselves on demand, but this may not always be possible depending on implementation. + * + * This is useful at the end of a request and will be called automatically on every handler + * when they get destructed. + */ + public function close(): void + { + foreach ($this->handlers as $handler) { + $handler->close(); + } + } + + /** + * Ends a log cycle and resets all handlers and processors to their initial state. + * + * Resetting a Handler or a Processor means flushing/cleaning all buffers, resetting internal + * state, and getting it back to a state in which it can receive log records again. + * + * This is useful in case you want to avoid logs leaking between two requests or jobs when you + * have a long running process like a worker or an application server serving multiple requests + * in one process. + */ + public function reset(): void + { + foreach ($this->handlers as $handler) { + if ($handler instanceof ResettableInterface) { + $handler->reset(); + } + } + + foreach ($this->processors as $processor) { + if ($processor instanceof ResettableInterface) { + $processor->reset(); + } + } + } + + /** + * Gets all supported logging levels. + * + * @return array<string, int> Assoc array with human-readable level names => level codes. + * @phpstan-return array<LevelName, Level> + */ + public static function getLevels(): array + { + return array_flip(static::$levels); + } + + /** + * Gets the name of the logging level. + * + * @throws \Psr\Log\InvalidArgumentException If level is not defined + * + * @phpstan-param Level $level + * @phpstan-return LevelName + */ + public static function getLevelName(int $level): string + { + if (!isset(static::$levels[$level])) { + throw new InvalidArgumentException('Level "'.$level.'" is not defined, use one of: '.implode(', ', array_keys(static::$levels))); + } + + return static::$levels[$level]; + } + + /** + * Converts PSR-3 levels to Monolog ones if necessary + * + * @param string|int $level Level number (monolog) or name (PSR-3) + * @throws \Psr\Log\InvalidArgumentException If level is not defined + * + * @phpstan-param Level|LevelName|LogLevel::* $level + * @phpstan-return Level + */ + public static function toMonologLevel($level): int + { + if (is_string($level)) { + if (is_numeric($level)) { + /** @phpstan-ignore-next-line */ + return intval($level); + } + + // Contains chars of all log levels and avoids using strtoupper() which may have + // strange results depending on locale (for example, "i" will become "İ" in Turkish locale) + $upper = strtr($level, 'abcdefgilmnortuwy', 'ABCDEFGILMNORTUWY'); + if (defined(__CLASS__.'::'.$upper)) { + return constant(__CLASS__ . '::' . $upper); + } + + throw new InvalidArgumentException('Level "'.$level.'" is not defined, use one of: '.implode(', ', array_keys(static::$levels) + static::$levels)); + } + + if (!is_int($level)) { + throw new InvalidArgumentException('Level "'.var_export($level, true).'" is not defined, use one of: '.implode(', ', array_keys(static::$levels) + static::$levels)); + } + + return $level; + } + + /** + * Checks whether the Logger has a handler that listens on the given level + * + * @phpstan-param Level $level + */ + public function isHandling(int $level): bool + { + $record = [ + 'level' => $level, + ]; + + foreach ($this->handlers as $handler) { + if ($handler->isHandling($record)) { + return true; + } + } + + return false; + } + + /** + * Set a custom exception handler that will be called if adding a new record fails + * + * The callable will receive an exception object and the record that failed to be logged + */ + public function setExceptionHandler(?callable $callback): self + { + $this->exceptionHandler = $callback; + + return $this; + } + + public function getExceptionHandler(): ?callable + { + return $this->exceptionHandler; + } + + /** + * Adds a log record at an arbitrary level. + * + * This method allows for compatibility with common interfaces. + * + * @param mixed $level The log level (a Monolog, PSR-3 or RFC 5424 level) + * @param string|Stringable $message The log message + * @param mixed[] $context The log context + * + * @phpstan-param Level|LevelName|LogLevel::* $level + */ + public function log($level, $message, array $context = []): void + { + if (!is_int($level) && !is_string($level)) { + throw new \InvalidArgumentException('$level is expected to be a string or int'); + } + + if (isset(self::RFC_5424_LEVELS[$level])) { + $level = self::RFC_5424_LEVELS[$level]; + } + + $level = static::toMonologLevel($level); + + $this->addRecord($level, (string) $message, $context); + } + + /** + * Adds a log record at the DEBUG level. + * + * This method allows for compatibility with common interfaces. + * + * @param string|Stringable $message The log message + * @param mixed[] $context The log context + */ + public function debug($message, array $context = []): void + { + $this->addRecord(static::DEBUG, (string) $message, $context); + } + + /** + * Adds a log record at the INFO level. + * + * This method allows for compatibility with common interfaces. + * + * @param string|Stringable $message The log message + * @param mixed[] $context The log context + */ + public function info($message, array $context = []): void + { + $this->addRecord(static::INFO, (string) $message, $context); + } + + /** + * Adds a log record at the NOTICE level. + * + * This method allows for compatibility with common interfaces. + * + * @param string|Stringable $message The log message + * @param mixed[] $context The log context + */ + public function notice($message, array $context = []): void + { + $this->addRecord(static::NOTICE, (string) $message, $context); + } + + /** + * Adds a log record at the WARNING level. + * + * This method allows for compatibility with common interfaces. + * + * @param string|Stringable $message The log message + * @param mixed[] $context The log context + */ + public function warning($message, array $context = []): void + { + $this->addRecord(static::WARNING, (string) $message, $context); + } + + /** + * Adds a log record at the ERROR level. + * + * This method allows for compatibility with common interfaces. + * + * @param string|Stringable $message The log message + * @param mixed[] $context The log context + */ + public function error($message, array $context = []): void + { + $this->addRecord(static::ERROR, (string) $message, $context); + } + + /** + * Adds a log record at the CRITICAL level. + * + * This method allows for compatibility with common interfaces. + * + * @param string|Stringable $message The log message + * @param mixed[] $context The log context + */ + public function critical($message, array $context = []): void + { + $this->addRecord(static::CRITICAL, (string) $message, $context); + } + + /** + * Adds a log record at the ALERT level. + * + * This method allows for compatibility with common interfaces. + * + * @param string|Stringable $message The log message + * @param mixed[] $context The log context + */ + public function alert($message, array $context = []): void + { + $this->addRecord(static::ALERT, (string) $message, $context); + } + + /** + * Adds a log record at the EMERGENCY level. + * + * This method allows for compatibility with common interfaces. + * + * @param string|Stringable $message The log message + * @param mixed[] $context The log context + */ + public function emergency($message, array $context = []): void + { + $this->addRecord(static::EMERGENCY, (string) $message, $context); + } + + /** + * Sets the timezone to be used for the timestamp of log records. + */ + public function setTimezone(DateTimeZone $tz): self + { + $this->timezone = $tz; + + return $this; + } + + /** + * Returns the timezone to be used for the timestamp of log records. + */ + public function getTimezone(): DateTimeZone + { + return $this->timezone; + } + + /** + * Delegates exception management to the custom exception handler, + * or throws the exception if no custom handler is set. + * + * @param array $record + * @phpstan-param Record $record + */ + protected function handleException(Throwable $e, array $record): void + { + if (!$this->exceptionHandler) { + throw $e; + } + + ($this->exceptionHandler)($e, $record); + } + + /** + * @return array<string, mixed> + */ + public function __serialize(): array + { + return [ + 'name' => $this->name, + 'handlers' => $this->handlers, + 'processors' => $this->processors, + 'microsecondTimestamps' => $this->microsecondTimestamps, + 'timezone' => $this->timezone, + 'exceptionHandler' => $this->exceptionHandler, + 'logDepth' => $this->logDepth, + 'detectCycles' => $this->detectCycles, + ]; + } + + /** + * @param array<string, mixed> $data + */ + public function __unserialize(array $data): void + { + foreach (['name', 'handlers', 'processors', 'microsecondTimestamps', 'timezone', 'exceptionHandler', 'logDepth', 'detectCycles'] as $property) { + if (isset($data[$property])) { + $this->$property = $data[$property]; + } + } + + if (\PHP_VERSION_ID >= 80100) { + // Local variable for phpstan, see https://github.com/phpstan/phpstan/issues/6732#issuecomment-1111118412 + /** @var \WeakMap<\Fiber, int> $fiberLogDepth */ + $fiberLogDepth = new \WeakMap(); + $this->fiberLogDepth = $fiberLogDepth; + } + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php new file mode 100644 index 00000000..8166bdca --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php @@ -0,0 +1,77 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +use Monolog\Logger; +use Psr\Log\LogLevel; + +/** + * Injects Git branch and Git commit SHA in all records + * + * @author Nick Otter + * @author Jordi Boggiano <j.boggiano@seld.be> + * + * @phpstan-import-type Level from \Monolog\Logger + * @phpstan-import-type LevelName from \Monolog\Logger + */ +class GitProcessor implements ProcessorInterface +{ + /** @var int */ + private $level; + /** @var array{branch: string, commit: string}|array<never>|null */ + private static $cache = null; + + /** + * @param string|int $level The minimum logging level at which this Processor will be triggered + * + * @phpstan-param Level|LevelName|LogLevel::* $level + */ + public function __construct($level = Logger::DEBUG) + { + $this->level = Logger::toMonologLevel($level); + } + + /** + * {@inheritDoc} + */ + public function __invoke(array $record): array + { + // return if the level is not high enough + if ($record['level'] < $this->level) { + return $record; + } + + $record['extra']['git'] = self::getGitInfo(); + + return $record; + } + + /** + * @return array{branch: string, commit: string}|array<never> + */ + private static function getGitInfo(): array + { + if (self::$cache) { + return self::$cache; + } + + $branches = `git branch -v --no-abbrev`; + if ($branches && preg_match('{^\* (.+?)\s+([a-f0-9]{40})(?:\s|$)}m', $branches, $matches)) { + return self::$cache = [ + 'branch' => $matches[1], + 'commit' => $matches[2], + ]; + } + + return self::$cache = []; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/HostnameProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/HostnameProcessor.php new file mode 100644 index 00000000..91fda7d6 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/HostnameProcessor.php @@ -0,0 +1,36 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +/** + * Injects value of gethostname in all records + */ +class HostnameProcessor implements ProcessorInterface +{ + /** @var string */ + private static $host; + + public function __construct() + { + self::$host = (string) gethostname(); + } + + /** + * {@inheritDoc} + */ + public function __invoke(array $record): array + { + $record['extra']['hostname'] = self::$host; + + return $record; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php new file mode 100644 index 00000000..a32e76b2 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php @@ -0,0 +1,123 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +use Monolog\Logger; +use Psr\Log\LogLevel; + +/** + * Injects line/file:class/function where the log message came from + * + * Warning: This only works if the handler processes the logs directly. + * If you put the processor on a handler that is behind a FingersCrossedHandler + * for example, the processor will only be called once the trigger level is reached, + * and all the log records will have the same file/line/.. data from the call that + * triggered the FingersCrossedHandler. + * + * @author Jordi Boggiano <j.boggiano@seld.be> + * + * @phpstan-import-type Level from \Monolog\Logger + * @phpstan-import-type LevelName from \Monolog\Logger + */ +class IntrospectionProcessor implements ProcessorInterface +{ + /** @var int */ + private $level; + /** @var string[] */ + private $skipClassesPartials; + /** @var int */ + private $skipStackFramesCount; + /** @var string[] */ + private $skipFunctions = [ + 'call_user_func', + 'call_user_func_array', + ]; + + /** + * @param string|int $level The minimum logging level at which this Processor will be triggered + * @param string[] $skipClassesPartials + * + * @phpstan-param Level|LevelName|LogLevel::* $level + */ + public function __construct($level = Logger::DEBUG, array $skipClassesPartials = [], int $skipStackFramesCount = 0) + { + $this->level = Logger::toMonologLevel($level); + $this->skipClassesPartials = array_merge(['Monolog\\'], $skipClassesPartials); + $this->skipStackFramesCount = $skipStackFramesCount; + } + + /** + * {@inheritDoc} + */ + public function __invoke(array $record): array + { + // return if the level is not high enough + if ($record['level'] < $this->level) { + return $record; + } + + $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); + + // skip first since it's always the current method + array_shift($trace); + // the call_user_func call is also skipped + array_shift($trace); + + $i = 0; + + while ($this->isTraceClassOrSkippedFunction($trace, $i)) { + if (isset($trace[$i]['class'])) { + foreach ($this->skipClassesPartials as $part) { + if (strpos($trace[$i]['class'], $part) !== false) { + $i++; + + continue 2; + } + } + } elseif (in_array($trace[$i]['function'], $this->skipFunctions)) { + $i++; + + continue; + } + + break; + } + + $i += $this->skipStackFramesCount; + + // we should have the call source now + $record['extra'] = array_merge( + $record['extra'], + [ + 'file' => isset($trace[$i - 1]['file']) ? $trace[$i - 1]['file'] : null, + 'line' => isset($trace[$i - 1]['line']) ? $trace[$i - 1]['line'] : null, + 'class' => isset($trace[$i]['class']) ? $trace[$i]['class'] : null, + 'callType' => isset($trace[$i]['type']) ? $trace[$i]['type'] : null, + 'function' => isset($trace[$i]['function']) ? $trace[$i]['function'] : null, + ] + ); + + return $record; + } + + /** + * @param array[] $trace + */ + private function isTraceClassOrSkippedFunction(array $trace, int $index): bool + { + if (!isset($trace[$index])) { + return false; + } + + return isset($trace[$index]['class']) || in_array($trace[$index]['function'], $this->skipFunctions); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php new file mode 100644 index 00000000..37c756fc --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php @@ -0,0 +1,37 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +/** + * Injects memory_get_peak_usage in all records + * + * @see Monolog\Processor\MemoryProcessor::__construct() for options + * @author Rob Jensen + */ +class MemoryPeakUsageProcessor extends MemoryProcessor +{ + /** + * {@inheritDoc} + */ + public function __invoke(array $record): array + { + $usage = memory_get_peak_usage($this->realUsage); + + if ($this->useFormatting) { + $usage = $this->formatBytes($usage); + } + + $record['extra']['memory_peak_usage'] = $usage; + + return $record; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php new file mode 100644 index 00000000..227deb7c --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php @@ -0,0 +1,61 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +/** + * Some methods that are common for all memory processors + * + * @author Rob Jensen + */ +abstract class MemoryProcessor implements ProcessorInterface +{ + /** + * @var bool If true, get the real size of memory allocated from system. Else, only the memory used by emalloc() is reported. + */ + protected $realUsage; + + /** + * @var bool If true, then format memory size to human readable string (MB, KB, B depending on size) + */ + protected $useFormatting; + + /** + * @param bool $realUsage Set this to true to get the real size of memory allocated from system. + * @param bool $useFormatting If true, then format memory size to human readable string (MB, KB, B depending on size) + */ + public function __construct(bool $realUsage = true, bool $useFormatting = true) + { + $this->realUsage = $realUsage; + $this->useFormatting = $useFormatting; + } + + /** + * Formats bytes into a human readable string if $this->useFormatting is true, otherwise return $bytes as is + * + * @param int $bytes + * @return string|int Formatted string if $this->useFormatting is true, otherwise return $bytes as int + */ + protected function formatBytes(int $bytes) + { + if (!$this->useFormatting) { + return $bytes; + } + + if ($bytes > 1024 * 1024) { + return round($bytes / 1024 / 1024, 2).' MB'; + } elseif ($bytes > 1024) { + return round($bytes / 1024, 2).' KB'; + } + + return $bytes . ' B'; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php new file mode 100644 index 00000000..e141921e --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php @@ -0,0 +1,37 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +/** + * Injects memory_get_usage in all records + * + * @see Monolog\Processor\MemoryProcessor::__construct() for options + * @author Rob Jensen + */ +class MemoryUsageProcessor extends MemoryProcessor +{ + /** + * {@inheritDoc} + */ + public function __invoke(array $record): array + { + $usage = memory_get_usage($this->realUsage); + + if ($this->useFormatting) { + $usage = $this->formatBytes($usage); + } + + $record['extra']['memory_usage'] = $usage; + + return $record; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php new file mode 100644 index 00000000..d4a628f5 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php @@ -0,0 +1,77 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +use Monolog\Logger; +use Psr\Log\LogLevel; + +/** + * Injects Hg branch and Hg revision number in all records + * + * @author Jonathan A. Schweder <jonathanschweder@gmail.com> + * + * @phpstan-import-type LevelName from \Monolog\Logger + * @phpstan-import-type Level from \Monolog\Logger + */ +class MercurialProcessor implements ProcessorInterface +{ + /** @var Level */ + private $level; + /** @var array{branch: string, revision: string}|array<never>|null */ + private static $cache = null; + + /** + * @param int|string $level The minimum logging level at which this Processor will be triggered + * + * @phpstan-param Level|LevelName|LogLevel::* $level + */ + public function __construct($level = Logger::DEBUG) + { + $this->level = Logger::toMonologLevel($level); + } + + /** + * {@inheritDoc} + */ + public function __invoke(array $record): array + { + // return if the level is not high enough + if ($record['level'] < $this->level) { + return $record; + } + + $record['extra']['hg'] = self::getMercurialInfo(); + + return $record; + } + + /** + * @return array{branch: string, revision: string}|array<never> + */ + private static function getMercurialInfo(): array + { + if (self::$cache) { + return self::$cache; + } + + $result = explode(' ', trim(`hg id -nb`)); + + if (count($result) >= 3) { + return self::$cache = [ + 'branch' => $result[1], + 'revision' => $result[2], + ]; + } + + return self::$cache = []; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php new file mode 100644 index 00000000..3b939a95 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php @@ -0,0 +1,30 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +/** + * Adds value of getmypid into records + * + * @author Andreas Hörnicke + */ +class ProcessIdProcessor implements ProcessorInterface +{ + /** + * {@inheritDoc} + */ + public function __invoke(array $record): array + { + $record['extra']['process_id'] = getmypid(); + + return $record; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php b/vendor/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php new file mode 100644 index 00000000..5defb7eb --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php @@ -0,0 +1,30 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +/** + * An optional interface to allow labelling Monolog processors. + * + * @author Nicolas Grekas <p@tchwork.com> + * + * @phpstan-import-type Record from \Monolog\Logger + */ +interface ProcessorInterface +{ + /** + * @return array The processed record + * + * @phpstan-param Record $record + * @phpstan-return Record + */ + public function __invoke(array $record); +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php new file mode 100644 index 00000000..e7c12176 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php @@ -0,0 +1,88 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +use Monolog\Utils; + +/** + * Processes a record's message according to PSR-3 rules + * + * It replaces {foo} with the value from $context['foo'] + * + * @author Jordi Boggiano <j.boggiano@seld.be> + */ +class PsrLogMessageProcessor implements ProcessorInterface +{ + public const SIMPLE_DATE = "Y-m-d\TH:i:s.uP"; + + /** @var string|null */ + private $dateFormat; + + /** @var bool */ + private $removeUsedContextFields; + + /** + * @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format + * @param bool $removeUsedContextFields If set to true the fields interpolated into message gets unset + */ + public function __construct(?string $dateFormat = null, bool $removeUsedContextFields = false) + { + $this->dateFormat = $dateFormat; + $this->removeUsedContextFields = $removeUsedContextFields; + } + + /** + * {@inheritDoc} + */ + public function __invoke(array $record): array + { + if (false === strpos($record['message'], '{')) { + return $record; + } + + $replacements = []; + foreach ($record['context'] as $key => $val) { + $placeholder = '{' . $key . '}'; + if (strpos($record['message'], $placeholder) === false) { + continue; + } + + if (is_null($val) || is_scalar($val) || (is_object($val) && method_exists($val, "__toString"))) { + $replacements[$placeholder] = $val; + } elseif ($val instanceof \DateTimeInterface) { + if (!$this->dateFormat && $val instanceof \Monolog\DateTimeImmutable) { + // handle monolog dates using __toString if no specific dateFormat was asked for + // so that it follows the useMicroseconds flag + $replacements[$placeholder] = (string) $val; + } else { + $replacements[$placeholder] = $val->format($this->dateFormat ?: static::SIMPLE_DATE); + } + } elseif ($val instanceof \UnitEnum) { + $replacements[$placeholder] = $val instanceof \BackedEnum ? $val->value : $val->name; + } elseif (is_object($val)) { + $replacements[$placeholder] = '[object '.Utils::getClass($val).']'; + } elseif (is_array($val)) { + $replacements[$placeholder] = 'array'.Utils::jsonEncode($val, null, true); + } else { + $replacements[$placeholder] = '['.gettype($val).']'; + } + + if ($this->removeUsedContextFields) { + unset($record['context'][$key]); + } + } + + $record['message'] = strtr($record['message'], $replacements); + + return $record; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php new file mode 100644 index 00000000..80f18747 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php @@ -0,0 +1,61 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +/** + * Adds a tags array into record + * + * @author Martijn Riemers + */ +class TagProcessor implements ProcessorInterface +{ + /** @var string[] */ + private $tags; + + /** + * @param string[] $tags + */ + public function __construct(array $tags = []) + { + $this->setTags($tags); + } + + /** + * @param string[] $tags + */ + public function addTags(array $tags = []): self + { + $this->tags = array_merge($this->tags, $tags); + + return $this; + } + + /** + * @param string[] $tags + */ + public function setTags(array $tags = []): self + { + $this->tags = $tags; + + return $this; + } + + /** + * {@inheritDoc} + */ + public function __invoke(array $record): array + { + $record['extra']['tags'] = $this->tags; + + return $record; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php new file mode 100644 index 00000000..a27b74db --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php @@ -0,0 +1,59 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +use Monolog\ResettableInterface; + +/** + * Adds a unique identifier into records + * + * @author Simon Mönch <sm@webfactory.de> + */ +class UidProcessor implements ProcessorInterface, ResettableInterface +{ + /** @var string */ + private $uid; + + public function __construct(int $length = 7) + { + if ($length > 32 || $length < 1) { + throw new \InvalidArgumentException('The uid length must be an integer between 1 and 32'); + } + + $this->uid = $this->generateUid($length); + } + + /** + * {@inheritDoc} + */ + public function __invoke(array $record): array + { + $record['extra']['uid'] = $this->uid; + + return $record; + } + + public function getUid(): string + { + return $this->uid; + } + + public function reset() + { + $this->uid = $this->generateUid(strlen($this->uid)); + } + + private function generateUid(int $length): string + { + return substr(bin2hex(random_bytes((int) ceil($length / 2))), 0, $length); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php new file mode 100644 index 00000000..887f4d39 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php @@ -0,0 +1,111 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +/** + * Injects url/method and remote IP of the current web request in all records + * + * @author Jordi Boggiano <j.boggiano@seld.be> + */ +class WebProcessor implements ProcessorInterface +{ + /** + * @var array<string, mixed>|\ArrayAccess<string, mixed> + */ + protected $serverData; + + /** + * Default fields + * + * Array is structured as [key in record.extra => key in $serverData] + * + * @var array<string, string> + */ + protected $extraFields = [ + 'url' => 'REQUEST_URI', + 'ip' => 'REMOTE_ADDR', + 'http_method' => 'REQUEST_METHOD', + 'server' => 'SERVER_NAME', + 'referrer' => 'HTTP_REFERER', + 'user_agent' => 'HTTP_USER_AGENT', + ]; + + /** + * @param array<string, mixed>|\ArrayAccess<string, mixed>|null $serverData Array or object w/ ArrayAccess that provides access to the $_SERVER data + * @param array<string, string>|array<string>|null $extraFields Field names and the related key inside $serverData to be added (or just a list of field names to use the default configured $serverData mapping). If not provided it defaults to: [url, ip, http_method, server, referrer] + unique_id if present in server data + */ + public function __construct($serverData = null, ?array $extraFields = null) + { + if (null === $serverData) { + $this->serverData = &$_SERVER; + } elseif (is_array($serverData) || $serverData instanceof \ArrayAccess) { + $this->serverData = $serverData; + } else { + throw new \UnexpectedValueException('$serverData must be an array or object implementing ArrayAccess.'); + } + + $defaultEnabled = ['url', 'ip', 'http_method', 'server', 'referrer']; + if (isset($this->serverData['UNIQUE_ID'])) { + $this->extraFields['unique_id'] = 'UNIQUE_ID'; + $defaultEnabled[] = 'unique_id'; + } + + if (null === $extraFields) { + $extraFields = $defaultEnabled; + } + if (isset($extraFields[0])) { + foreach (array_keys($this->extraFields) as $fieldName) { + if (!in_array($fieldName, $extraFields)) { + unset($this->extraFields[$fieldName]); + } + } + } else { + $this->extraFields = $extraFields; + } + } + + /** + * {@inheritDoc} + */ + public function __invoke(array $record): array + { + // skip processing if for some reason request data + // is not present (CLI or wonky SAPIs) + if (!isset($this->serverData['REQUEST_URI'])) { + return $record; + } + + $record['extra'] = $this->appendExtraFields($record['extra']); + + return $record; + } + + public function addExtraField(string $extraName, string $serverName): self + { + $this->extraFields[$extraName] = $serverName; + + return $this; + } + + /** + * @param mixed[] $extra + * @return mixed[] + */ + private function appendExtraFields(array $extra): array + { + foreach ($this->extraFields as $extraName => $serverName) { + $extra[$extraName] = $this->serverData[$serverName] ?? null; + } + + return $extra; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Registry.php b/vendor/monolog/monolog/src/Monolog/Registry.php new file mode 100644 index 00000000..ae94ae6c --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Registry.php @@ -0,0 +1,134 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog; + +use InvalidArgumentException; + +/** + * Monolog log registry + * + * Allows to get `Logger` instances in the global scope + * via static method calls on this class. + * + * <code> + * $application = new Monolog\Logger('application'); + * $api = new Monolog\Logger('api'); + * + * Monolog\Registry::addLogger($application); + * Monolog\Registry::addLogger($api); + * + * function testLogger() + * { + * Monolog\Registry::api()->error('Sent to $api Logger instance'); + * Monolog\Registry::application()->error('Sent to $application Logger instance'); + * } + * </code> + * + * @author Tomas Tatarko <tomas@tatarko.sk> + */ +class Registry +{ + /** + * List of all loggers in the registry (by named indexes) + * + * @var Logger[] + */ + private static $loggers = []; + + /** + * Adds new logging channel to the registry + * + * @param Logger $logger Instance of the logging channel + * @param string|null $name Name of the logging channel ($logger->getName() by default) + * @param bool $overwrite Overwrite instance in the registry if the given name already exists? + * @throws \InvalidArgumentException If $overwrite set to false and named Logger instance already exists + * @return void + */ + public static function addLogger(Logger $logger, ?string $name = null, bool $overwrite = false) + { + $name = $name ?: $logger->getName(); + + if (isset(self::$loggers[$name]) && !$overwrite) { + throw new InvalidArgumentException('Logger with the given name already exists'); + } + + self::$loggers[$name] = $logger; + } + + /** + * Checks if such logging channel exists by name or instance + * + * @param string|Logger $logger Name or logger instance + */ + public static function hasLogger($logger): bool + { + if ($logger instanceof Logger) { + $index = array_search($logger, self::$loggers, true); + + return false !== $index; + } + + return isset(self::$loggers[$logger]); + } + + /** + * Removes instance from registry by name or instance + * + * @param string|Logger $logger Name or logger instance + */ + public static function removeLogger($logger): void + { + if ($logger instanceof Logger) { + if (false !== ($idx = array_search($logger, self::$loggers, true))) { + unset(self::$loggers[$idx]); + } + } else { + unset(self::$loggers[$logger]); + } + } + + /** + * Clears the registry + */ + public static function clear(): void + { + self::$loggers = []; + } + + /** + * Gets Logger instance from the registry + * + * @param string $name Name of the requested Logger instance + * @throws \InvalidArgumentException If named Logger instance is not in the registry + */ + public static function getInstance($name): Logger + { + if (!isset(self::$loggers[$name])) { + throw new InvalidArgumentException(sprintf('Requested "%s" logger instance is not in the registry', $name)); + } + + return self::$loggers[$name]; + } + + /** + * Gets Logger instance from the registry via static method call + * + * @param string $name Name of the requested Logger instance + * @param mixed[] $arguments Arguments passed to static method call + * @throws \InvalidArgumentException If named Logger instance is not in the registry + * @return Logger Requested instance of Logger + */ + public static function __callStatic($name, $arguments) + { + return self::getInstance($name); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/ResettableInterface.php b/vendor/monolog/monolog/src/Monolog/ResettableInterface.php new file mode 100644 index 00000000..2c5fd785 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/ResettableInterface.php @@ -0,0 +1,34 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog; + +/** + * Handler or Processor implementing this interface will be reset when Logger::reset() is called. + * + * Resetting ends a log cycle gets them back to their initial state. + * + * Resetting a Handler or a Processor means flushing/cleaning all buffers, resetting internal + * state, and getting it back to a state in which it can receive log records again. + * + * This is useful in case you want to avoid logs leaking between two requests or jobs when you + * have a long running process like a worker or an application server serving multiple requests + * in one process. + * + * @author Grégoire Pineau <lyrixx@lyrixx.info> + */ +interface ResettableInterface +{ + /** + * @return void + */ + public function reset(); +} diff --git a/vendor/monolog/monolog/src/Monolog/SignalHandler.php b/vendor/monolog/monolog/src/Monolog/SignalHandler.php new file mode 100644 index 00000000..d730eea3 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/SignalHandler.php @@ -0,0 +1,120 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog; + +use Psr\Log\LoggerInterface; +use Psr\Log\LogLevel; +use ReflectionExtension; + +/** + * Monolog POSIX signal handler + * + * @author Robert Gust-Bardon <robert@gust-bardon.org> + * + * @phpstan-import-type Level from \Monolog\Logger + * @phpstan-import-type LevelName from \Monolog\Logger + */ +class SignalHandler +{ + /** @var LoggerInterface */ + private $logger; + + /** @var array<int, callable|string|int> SIG_DFL, SIG_IGN or previous callable */ + private $previousSignalHandler = []; + /** @var array<int, int> */ + private $signalLevelMap = []; + /** @var array<int, bool> */ + private $signalRestartSyscalls = []; + + public function __construct(LoggerInterface $logger) + { + $this->logger = $logger; + } + + /** + * @param int|string $level Level or level name + * @param bool $callPrevious + * @param bool $restartSyscalls + * @param bool|null $async + * @return $this + * + * @phpstan-param Level|LevelName|LogLevel::* $level + */ + public function registerSignalHandler(int $signo, $level = LogLevel::CRITICAL, bool $callPrevious = true, bool $restartSyscalls = true, ?bool $async = true): self + { + if (!extension_loaded('pcntl') || !function_exists('pcntl_signal')) { + return $this; + } + + $level = Logger::toMonologLevel($level); + + if ($callPrevious) { + $handler = pcntl_signal_get_handler($signo); + $this->previousSignalHandler[$signo] = $handler; + } else { + unset($this->previousSignalHandler[$signo]); + } + $this->signalLevelMap[$signo] = $level; + $this->signalRestartSyscalls[$signo] = $restartSyscalls; + + if ($async !== null) { + pcntl_async_signals($async); + } + + pcntl_signal($signo, [$this, 'handleSignal'], $restartSyscalls); + + return $this; + } + + /** + * @param mixed $siginfo + */ + public function handleSignal(int $signo, $siginfo = null): void + { + static $signals = []; + + if (!$signals && extension_loaded('pcntl')) { + $pcntl = new ReflectionExtension('pcntl'); + // HHVM 3.24.2 returns an empty array. + foreach ($pcntl->getConstants() ?: get_defined_constants(true)['Core'] as $name => $value) { + if (substr($name, 0, 3) === 'SIG' && $name[3] !== '_' && is_int($value)) { + $signals[$value] = $name; + } + } + } + + $level = $this->signalLevelMap[$signo] ?? LogLevel::CRITICAL; + $signal = $signals[$signo] ?? $signo; + $context = $siginfo ?? []; + $this->logger->log($level, sprintf('Program received signal %s', $signal), $context); + + if (!isset($this->previousSignalHandler[$signo])) { + return; + } + + if ($this->previousSignalHandler[$signo] === SIG_DFL) { + if (extension_loaded('pcntl') && function_exists('pcntl_signal') && function_exists('pcntl_sigprocmask') && function_exists('pcntl_signal_dispatch') + && extension_loaded('posix') && function_exists('posix_getpid') && function_exists('posix_kill') + ) { + $restartSyscalls = $this->signalRestartSyscalls[$signo] ?? true; + pcntl_signal($signo, SIG_DFL, $restartSyscalls); + pcntl_sigprocmask(SIG_UNBLOCK, [$signo], $oldset); + posix_kill(posix_getpid(), $signo); + pcntl_signal_dispatch(); + pcntl_sigprocmask(SIG_SETMASK, $oldset); + pcntl_signal($signo, [$this, 'handleSignal'], $restartSyscalls); + } + } elseif (is_callable($this->previousSignalHandler[$signo])) { + $this->previousSignalHandler[$signo]($signo, $siginfo); + } + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Test/TestCase.php b/vendor/monolog/monolog/src/Monolog/Test/TestCase.php new file mode 100644 index 00000000..bc0b425e --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Test/TestCase.php @@ -0,0 +1,85 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Test; + +use Monolog\Logger; +use Monolog\DateTimeImmutable; +use Monolog\Formatter\FormatterInterface; + +/** + * Lets you easily generate log records and a dummy formatter for testing purposes + * + * @author Jordi Boggiano <j.boggiano@seld.be> + * + * @phpstan-import-type Record from \Monolog\Logger + * @phpstan-import-type Level from \Monolog\Logger + * + * @internal feel free to reuse this to test your own handlers, this is marked internal to avoid issues with PHPStorm https://github.com/Seldaek/monolog/issues/1677 + */ +class TestCase extends \PHPUnit\Framework\TestCase +{ + public function tearDown(): void + { + parent::tearDown(); + + if (isset($this->handler)) { + unset($this->handler); + } + } + + /** + * @param mixed[] $context + * + * @return array Record + * + * @phpstan-param Level $level + * @phpstan-return Record + */ + protected function getRecord(int $level = Logger::WARNING, string $message = 'test', array $context = []): array + { + return [ + 'message' => (string) $message, + 'context' => $context, + 'level' => $level, + 'level_name' => Logger::getLevelName($level), + 'channel' => 'test', + 'datetime' => new DateTimeImmutable(true), + 'extra' => [], + ]; + } + + /** + * @phpstan-return Record[] + */ + protected function getMultipleRecords(): array + { + return [ + $this->getRecord(Logger::DEBUG, 'debug message 1'), + $this->getRecord(Logger::DEBUG, 'debug message 2'), + $this->getRecord(Logger::INFO, 'information'), + $this->getRecord(Logger::WARNING, 'warning'), + $this->getRecord(Logger::ERROR, 'error'), + ]; + } + + protected function getIdentityFormatter(): FormatterInterface + { + $formatter = $this->createMock(FormatterInterface::class); + $formatter->expects($this->any()) + ->method('format') + ->will($this->returnCallback(function ($record) { + return $record['message']; + })); + + return $formatter; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Utils.php b/vendor/monolog/monolog/src/Monolog/Utils.php new file mode 100644 index 00000000..360c4219 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Utils.php @@ -0,0 +1,284 @@ +<?php declare(strict_types=1); + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog; + +final class Utils +{ + const DEFAULT_JSON_FLAGS = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRESERVE_ZERO_FRACTION | JSON_INVALID_UTF8_SUBSTITUTE | JSON_PARTIAL_OUTPUT_ON_ERROR; + + public static function getClass(object $object): string + { + $class = \get_class($object); + + if (false === ($pos = \strpos($class, "@anonymous\0"))) { + return $class; + } + + if (false === ($parent = \get_parent_class($class))) { + return \substr($class, 0, $pos + 10); + } + + return $parent . '@anonymous'; + } + + public static function substr(string $string, int $start, ?int $length = null): string + { + if (extension_loaded('mbstring')) { + return mb_strcut($string, $start, $length); + } + + return substr($string, $start, (null === $length) ? strlen($string) : $length); + } + + /** + * Makes sure if a relative path is passed in it is turned into an absolute path + * + * @param string $streamUrl stream URL or path without protocol + */ + public static function canonicalizePath(string $streamUrl): string + { + $prefix = ''; + if ('file://' === substr($streamUrl, 0, 7)) { + $streamUrl = substr($streamUrl, 7); + $prefix = 'file://'; + } + + // other type of stream, not supported + if (false !== strpos($streamUrl, '://')) { + return $streamUrl; + } + + // already absolute + if (substr($streamUrl, 0, 1) === '/' || substr($streamUrl, 1, 1) === ':' || substr($streamUrl, 0, 2) === '\\\\') { + return $prefix.$streamUrl; + } + + $streamUrl = getcwd() . '/' . $streamUrl; + + return $prefix.$streamUrl; + } + + /** + * Return the JSON representation of a value + * + * @param mixed $data + * @param int $encodeFlags flags to pass to json encode, defaults to DEFAULT_JSON_FLAGS + * @param bool $ignoreErrors whether to ignore encoding errors or to throw on error, when ignored and the encoding fails, "null" is returned which is valid json for null + * @throws \RuntimeException if encoding fails and errors are not ignored + * @return string when errors are ignored and the encoding fails, "null" is returned which is valid json for null + */ + public static function jsonEncode($data, ?int $encodeFlags = null, bool $ignoreErrors = false): string + { + if (null === $encodeFlags) { + $encodeFlags = self::DEFAULT_JSON_FLAGS; + } + + if ($ignoreErrors) { + $json = @json_encode($data, $encodeFlags); + if (false === $json) { + return 'null'; + } + + return $json; + } + + $json = json_encode($data, $encodeFlags); + if (false === $json) { + $json = self::handleJsonError(json_last_error(), $data); + } + + return $json; + } + + /** + * Handle a json_encode failure. + * + * If the failure is due to invalid string encoding, try to clean the + * input and encode again. If the second encoding attempt fails, the + * initial error is not encoding related or the input can't be cleaned then + * raise a descriptive exception. + * + * @param int $code return code of json_last_error function + * @param mixed $data data that was meant to be encoded + * @param int $encodeFlags flags to pass to json encode, defaults to JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRESERVE_ZERO_FRACTION + * @throws \RuntimeException if failure can't be corrected + * @return string JSON encoded data after error correction + */ + public static function handleJsonError(int $code, $data, ?int $encodeFlags = null): string + { + if ($code !== JSON_ERROR_UTF8) { + self::throwEncodeError($code, $data); + } + + if (is_string($data)) { + self::detectAndCleanUtf8($data); + } elseif (is_array($data)) { + array_walk_recursive($data, array('Monolog\Utils', 'detectAndCleanUtf8')); + } else { + self::throwEncodeError($code, $data); + } + + if (null === $encodeFlags) { + $encodeFlags = self::DEFAULT_JSON_FLAGS; + } + + $json = json_encode($data, $encodeFlags); + + if ($json === false) { + self::throwEncodeError(json_last_error(), $data); + } + + return $json; + } + + /** + * @internal + */ + public static function pcreLastErrorMessage(int $code): string + { + if (PHP_VERSION_ID >= 80000) { + return preg_last_error_msg(); + } + + $constants = (get_defined_constants(true))['pcre']; + $constants = array_filter($constants, function ($key) { + return substr($key, -6) == '_ERROR'; + }, ARRAY_FILTER_USE_KEY); + + $constants = array_flip($constants); + + return $constants[$code] ?? 'UNDEFINED_ERROR'; + } + + /** + * Throws an exception according to a given code with a customized message + * + * @param int $code return code of json_last_error function + * @param mixed $data data that was meant to be encoded + * @throws \RuntimeException + * + * @return never + */ + private static function throwEncodeError(int $code, $data): void + { + switch ($code) { + case JSON_ERROR_DEPTH: + $msg = 'Maximum stack depth exceeded'; + break; + case JSON_ERROR_STATE_MISMATCH: + $msg = 'Underflow or the modes mismatch'; + break; + case JSON_ERROR_CTRL_CHAR: + $msg = 'Unexpected control character found'; + break; + case JSON_ERROR_UTF8: + $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded'; + break; + default: + $msg = 'Unknown error'; + } + + throw new \RuntimeException('JSON encoding failed: '.$msg.'. Encoding: '.var_export($data, true)); + } + + /** + * Detect invalid UTF-8 string characters and convert to valid UTF-8. + * + * Valid UTF-8 input will be left unmodified, but strings containing + * invalid UTF-8 codepoints will be reencoded as UTF-8 with an assumed + * original encoding of ISO-8859-15. This conversion may result in + * incorrect output if the actual encoding was not ISO-8859-15, but it + * will be clean UTF-8 output and will not rely on expensive and fragile + * detection algorithms. + * + * Function converts the input in place in the passed variable so that it + * can be used as a callback for array_walk_recursive. + * + * @param mixed $data Input to check and convert if needed, passed by ref + */ + private static function detectAndCleanUtf8(&$data): void + { + if (is_string($data) && !preg_match('//u', $data)) { + $data = preg_replace_callback( + '/[\x80-\xFF]+/', + function ($m) { + return function_exists('mb_convert_encoding') ? mb_convert_encoding($m[0], 'UTF-8', 'ISO-8859-1') : utf8_encode($m[0]); + }, + $data + ); + if (!is_string($data)) { + $pcreErrorCode = preg_last_error(); + throw new \RuntimeException('Failed to preg_replace_callback: ' . $pcreErrorCode . ' / ' . self::pcreLastErrorMessage($pcreErrorCode)); + } + $data = str_replace( + ['¤', '¦', '¨', '´', '¸', '¼', '½', '¾'], + ['€', 'Š', 'š', 'Ž', 'ž', 'Œ', 'œ', 'Ÿ'], + $data + ); + } + } + + /** + * Converts a string with a valid 'memory_limit' format, to bytes. + * + * @param string|false $val + * @return int|false Returns an integer representing bytes. Returns FALSE in case of error. + */ + public static function expandIniShorthandBytes($val) + { + if (!is_string($val)) { + return false; + } + + // support -1 + if ((int) $val < 0) { + return (int) $val; + } + + if (!preg_match('/^\s*(?<val>\d+)(?:\.\d+)?\s*(?<unit>[gmk]?)\s*$/i', $val, $match)) { + return false; + } + + $val = (int) $match['val']; + switch (strtolower($match['unit'] ?? '')) { + case 'g': + $val *= 1024; + case 'm': + $val *= 1024; + case 'k': + $val *= 1024; + } + + return $val; + } + + /** + * @param array<mixed> $record + */ + public static function getRecordMessageForException(array $record): string + { + $context = ''; + $extra = ''; + try { + if ($record['context']) { + $context = "\nContext: " . json_encode($record['context']); + } + if ($record['extra']) { + $extra = "\nExtra: " . json_encode($record['extra']); + } + } catch (\Throwable $e) { + // noop + } + + return "\nThe exception occurred while attempting to log: " . $record['message'] . $context . $extra; + } +} diff --git a/vendor/myclabs/deep-copy/LICENSE b/vendor/myclabs/deep-copy/LICENSE new file mode 100644 index 00000000..c3e83500 --- /dev/null +++ b/vendor/myclabs/deep-copy/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2013 My C-Sense + +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/vendor/myclabs/deep-copy/README.md b/vendor/myclabs/deep-copy/README.md new file mode 100644 index 00000000..88ae14cc --- /dev/null +++ b/vendor/myclabs/deep-copy/README.md @@ -0,0 +1,406 @@ +# DeepCopy + +DeepCopy helps you create deep copies (clones) of your objects. It is designed to handle cycles in the association graph. + +[![Total Downloads](https://poser.pugx.org/myclabs/deep-copy/downloads.svg)](https://packagist.org/packages/myclabs/deep-copy) +[![Integrate](https://github.com/myclabs/DeepCopy/actions/workflows/ci.yaml/badge.svg?branch=1.x)](https://github.com/myclabs/DeepCopy/actions/workflows/ci.yaml) + +## Table of Contents + +1. [How](#how) +1. [Why](#why) + 1. [Using simply `clone`](#using-simply-clone) + 1. [Overriding `__clone()`](#overriding-__clone) + 1. [With `DeepCopy`](#with-deepcopy) +1. [How it works](#how-it-works) +1. [Going further](#going-further) + 1. [Matchers](#matchers) + 1. [Property name](#property-name) + 1. [Specific property](#specific-property) + 1. [Type](#type) + 1. [Filters](#filters) + 1. [`SetNullFilter`](#setnullfilter-filter) + 1. [`KeepFilter`](#keepfilter-filter) + 1. [`DoctrineCollectionFilter`](#doctrinecollectionfilter-filter) + 1. [`DoctrineEmptyCollectionFilter`](#doctrineemptycollectionfilter-filter) + 1. [`DoctrineProxyFilter`](#doctrineproxyfilter-filter) + 1. [`ReplaceFilter`](#replacefilter-type-filter) + 1. [`ShallowCopyFilter`](#shallowcopyfilter-type-filter) +1. [Edge cases](#edge-cases) +1. [Contributing](#contributing) + 1. [Tests](#tests) + + +## How? + +Install with Composer: + +``` +composer require myclabs/deep-copy +``` + +Use it: + +```php +use DeepCopy\DeepCopy; + +$copier = new DeepCopy(); +$myCopy = $copier->copy($myObject); +``` + + +## Why? + +- How do you create copies of your objects? + +```php +$myCopy = clone $myObject; +``` + +- How do you create **deep** copies of your objects (i.e. copying also all the objects referenced in the properties)? + +You use [`__clone()`](http://www.php.net/manual/en/language.oop5.cloning.php#object.clone) and implement the behavior +yourself. + +- But how do you handle **cycles** in the association graph? + +Now you're in for a big mess :( + +![association graph](doc/graph.png) + + +### Using simply `clone` + +![Using clone](doc/clone.png) + + +### Overriding `__clone()` + +![Overriding __clone](doc/deep-clone.png) + + +### With `DeepCopy` + +![With DeepCopy](doc/deep-copy.png) + + +## How it works + +DeepCopy recursively traverses all the object's properties and clones them. To avoid cloning the same object twice it +keeps a hash map of all instances and thus preserves the object graph. + +To use it: + +```php +use function DeepCopy\deep_copy; + +$copy = deep_copy($var); +``` + +Alternatively, you can create your own `DeepCopy` instance to configure it differently for example: + +```php +use DeepCopy\DeepCopy; + +$copier = new DeepCopy(true); + +$copy = $copier->copy($var); +``` + +You may want to roll your own deep copy function: + +```php +namespace Acme; + +use DeepCopy\DeepCopy; + +function deep_copy($var) +{ + static $copier = null; + + if (null === $copier) { + $copier = new DeepCopy(true); + } + + return $copier->copy($var); +} +``` + + +## Going further + +You can add filters to customize the copy process. + +The method to add a filter is `DeepCopy\DeepCopy::addFilter($filter, $matcher)`, +with `$filter` implementing `DeepCopy\Filter\Filter` +and `$matcher` implementing `DeepCopy\Matcher\Matcher`. + +We provide some generic filters and matchers. + + +### Matchers + + - `DeepCopy\Matcher` applies on a object attribute. + - `DeepCopy\TypeMatcher` applies on any element found in graph, including array elements. + + +#### Property name + +The `PropertyNameMatcher` will match a property by its name: + +```php +use DeepCopy\Matcher\PropertyNameMatcher; + +// Will apply a filter to any property of any objects named "id" +$matcher = new PropertyNameMatcher('id'); +``` + + +#### Specific property + +The `PropertyMatcher` will match a specific property of a specific class: + +```php +use DeepCopy\Matcher\PropertyMatcher; + +// Will apply a filter to the property "id" of any objects of the class "MyClass" +$matcher = new PropertyMatcher('MyClass', 'id'); +``` + + +#### Type + +The `TypeMatcher` will match any element by its type (instance of a class or any value that could be parameter of +[gettype()](http://php.net/manual/en/function.gettype.php) function): + +```php +use DeepCopy\TypeMatcher\TypeMatcher; + +// Will apply a filter to any object that is an instance of Doctrine\Common\Collections\Collection +$matcher = new TypeMatcher('Doctrine\Common\Collections\Collection'); +``` + + +### Filters + +- `DeepCopy\Filter` applies a transformation to the object attribute matched by `DeepCopy\Matcher` +- `DeepCopy\TypeFilter` applies a transformation to any element matched by `DeepCopy\TypeMatcher` + +By design, matching a filter will stop the chain of filters (i.e. the next ones will not be applied). +Using the ([`ChainableFilter`](#chainablefilter-filter)) won't stop the chain of filters. + + +#### `SetNullFilter` (filter) + +Let's say for example that you are copying a database record (or a Doctrine entity), so you want the copy not to have +any ID: + +```php +use DeepCopy\DeepCopy; +use DeepCopy\Filter\SetNullFilter; +use DeepCopy\Matcher\PropertyNameMatcher; + +$object = MyClass::load(123); +echo $object->id; // 123 + +$copier = new DeepCopy(); +$copier->addFilter(new SetNullFilter(), new PropertyNameMatcher('id')); + +$copy = $copier->copy($object); + +echo $copy->id; // null +``` + + +#### `KeepFilter` (filter) + +If you want a property to remain untouched (for example, an association to an object): + +```php +use DeepCopy\DeepCopy; +use DeepCopy\Filter\KeepFilter; +use DeepCopy\Matcher\PropertyMatcher; + +$copier = new DeepCopy(); +$copier->addFilter(new KeepFilter(), new PropertyMatcher('MyClass', 'category')); + +$copy = $copier->copy($object); +// $copy->category has not been touched +``` + + +#### `ChainableFilter` (filter) + +If you use cloning on proxy classes, you might want to apply two filters for: +1. loading the data +2. applying a transformation + +You can use the `ChainableFilter` as a decorator of the proxy loader filter, which won't stop the chain of filters (i.e. +the next ones may be applied). + + +```php +use DeepCopy\DeepCopy; +use DeepCopy\Filter\ChainableFilter; +use DeepCopy\Filter\Doctrine\DoctrineProxyFilter; +use DeepCopy\Filter\SetNullFilter; +use DeepCopy\Matcher\Doctrine\DoctrineProxyMatcher; +use DeepCopy\Matcher\PropertyNameMatcher; + +$copier = new DeepCopy(); +$copier->addFilter(new ChainableFilter(new DoctrineProxyFilter()), new DoctrineProxyMatcher()); +$copier->addFilter(new SetNullFilter(), new PropertyNameMatcher('id')); + +$copy = $copier->copy($object); + +echo $copy->id; // null +``` + + +#### `DoctrineCollectionFilter` (filter) + +If you use Doctrine and want to copy an entity, you will need to use the `DoctrineCollectionFilter`: + +```php +use DeepCopy\DeepCopy; +use DeepCopy\Filter\Doctrine\DoctrineCollectionFilter; +use DeepCopy\Matcher\PropertyTypeMatcher; + +$copier = new DeepCopy(); +$copier->addFilter(new DoctrineCollectionFilter(), new PropertyTypeMatcher('Doctrine\Common\Collections\Collection')); + +$copy = $copier->copy($object); +``` + + +#### `DoctrineEmptyCollectionFilter` (filter) + +If you use Doctrine and want to copy an entity who contains a `Collection` that you want to be reset, you can use the +`DoctrineEmptyCollectionFilter` + +```php +use DeepCopy\DeepCopy; +use DeepCopy\Filter\Doctrine\DoctrineEmptyCollectionFilter; +use DeepCopy\Matcher\PropertyMatcher; + +$copier = new DeepCopy(); +$copier->addFilter(new DoctrineEmptyCollectionFilter(), new PropertyMatcher('MyClass', 'myProperty')); + +$copy = $copier->copy($object); + +// $copy->myProperty will return an empty collection +``` + + +#### `DoctrineProxyFilter` (filter) + +If you use Doctrine and use cloning on lazy loaded entities, you might encounter errors mentioning missing fields on a +Doctrine proxy class (...\\\_\_CG\_\_\Proxy). +You can use the `DoctrineProxyFilter` to load the actual entity behind the Doctrine proxy class. +**Make sure, though, to put this as one of your very first filters in the filter chain so that the entity is loaded +before other filters are applied!** +We recommend to decorate the `DoctrineProxyFilter` with the `ChainableFilter` to allow applying other filters to the +cloned lazy loaded entities. + +```php +use DeepCopy\DeepCopy; +use DeepCopy\Filter\Doctrine\DoctrineProxyFilter; +use DeepCopy\Matcher\Doctrine\DoctrineProxyMatcher; + +$copier = new DeepCopy(); +$copier->addFilter(new ChainableFilter(new DoctrineProxyFilter()), new DoctrineProxyMatcher()); + +$copy = $copier->copy($object); + +// $copy should now contain a clone of all entities, including those that were not yet fully loaded. +``` + + +#### `ReplaceFilter` (type filter) + +1. If you want to replace the value of a property: + +```php +use DeepCopy\DeepCopy; +use DeepCopy\Filter\ReplaceFilter; +use DeepCopy\Matcher\PropertyMatcher; + +$copier = new DeepCopy(); +$callback = function ($currentValue) { + return $currentValue . ' (copy)' +}; +$copier->addFilter(new ReplaceFilter($callback), new PropertyMatcher('MyClass', 'title')); + +$copy = $copier->copy($object); + +// $copy->title will contain the data returned by the callback, e.g. 'The title (copy)' +``` + +2. If you want to replace whole element: + +```php +use DeepCopy\DeepCopy; +use DeepCopy\TypeFilter\ReplaceFilter; +use DeepCopy\TypeMatcher\TypeMatcher; + +$copier = new DeepCopy(); +$callback = function (MyClass $myClass) { + return get_class($myClass); +}; +$copier->addTypeFilter(new ReplaceFilter($callback), new TypeMatcher('MyClass')); + +$copy = $copier->copy([new MyClass, 'some string', new MyClass]); + +// $copy will contain ['MyClass', 'some string', 'MyClass'] +``` + + +The `$callback` parameter of the `ReplaceFilter` constructor accepts any PHP callable. + + +#### `ShallowCopyFilter` (type filter) + +Stop *DeepCopy* from recursively copying element, using standard `clone` instead: + +```php +use DeepCopy\DeepCopy; +use DeepCopy\TypeFilter\ShallowCopyFilter; +use DeepCopy\TypeMatcher\TypeMatcher; +use Mockery as m; + +$this->deepCopy = new DeepCopy(); +$this->deepCopy->addTypeFilter( + new ShallowCopyFilter, + new TypeMatcher(m\MockInterface::class) +); + +$myServiceWithMocks = new MyService(m::mock(MyDependency1::class), m::mock(MyDependency2::class)); +// All mocks will be just cloned, not deep copied +``` + + +## Edge cases + +The following structures cannot be deep-copied with PHP Reflection. As a result they are shallow cloned and filters are +not applied. There is two ways for you to handle them: + +- Implement your own `__clone()` method +- Use a filter with a type matcher + + +## Contributing + +DeepCopy is distributed under the MIT license. + + +### Tests + +Running the tests is simple: + +```php +vendor/bin/phpunit +``` + +### Support + +Get professional support via [the Tidelift Subscription](https://tidelift.com/subscription/pkg/packagist-myclabs-deep-copy?utm_source=packagist-myclabs-deep-copy&utm_medium=referral&utm_campaign=readme). diff --git a/vendor/myclabs/deep-copy/composer.json b/vendor/myclabs/deep-copy/composer.json new file mode 100644 index 00000000..f115fff8 --- /dev/null +++ b/vendor/myclabs/deep-copy/composer.json @@ -0,0 +1,43 @@ +{ + "name": "myclabs/deep-copy", + "description": "Create deep copies (clones) of your objects", + "license": "MIT", + "type": "library", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3 <3.2.2" + }, + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "autoload-dev": { + "psr-4": { + "DeepCopyTest\\": "tests/DeepCopyTest/", + "DeepCopy\\": "fixtures/" + } + }, + "config": { + "sort-packages": true + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/DeepCopy.php b/vendor/myclabs/deep-copy/src/DeepCopy/DeepCopy.php new file mode 100644 index 00000000..084858ee --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/DeepCopy.php @@ -0,0 +1,313 @@ +<?php + +namespace DeepCopy; + +use ArrayObject; +use DateInterval; +use DateTimeInterface; +use DateTimeZone; +use DeepCopy\Exception\CloneException; +use DeepCopy\Filter\ChainableFilter; +use DeepCopy\Filter\Filter; +use DeepCopy\Matcher\Matcher; +use DeepCopy\Reflection\ReflectionHelper; +use DeepCopy\TypeFilter\Date\DateIntervalFilter; +use DeepCopy\TypeFilter\Spl\ArrayObjectFilter; +use DeepCopy\TypeFilter\Spl\SplDoublyLinkedListFilter; +use DeepCopy\TypeFilter\TypeFilter; +use DeepCopy\TypeMatcher\TypeMatcher; +use ReflectionObject; +use ReflectionProperty; +use SplDoublyLinkedList; + +/** + * @final + */ +class DeepCopy +{ + /** + * @var object[] List of objects copied. + */ + private $hashMap = []; + + /** + * Filters to apply. + * + * @var array Array of ['filter' => Filter, 'matcher' => Matcher] pairs. + */ + private $filters = []; + + /** + * Type Filters to apply. + * + * @var array Array of ['filter' => Filter, 'matcher' => Matcher] pairs. + */ + private $typeFilters = []; + + /** + * @var bool + */ + private $skipUncloneable = false; + + /** + * @var bool + */ + private $useCloneMethod; + + /** + * @param bool $useCloneMethod If set to true, when an object implements the __clone() function, it will be used + * instead of the regular deep cloning. + */ + public function __construct($useCloneMethod = false) + { + $this->useCloneMethod = $useCloneMethod; + + $this->addTypeFilter(new ArrayObjectFilter($this), new TypeMatcher(ArrayObject::class)); + $this->addTypeFilter(new DateIntervalFilter(), new TypeMatcher(DateInterval::class)); + $this->addTypeFilter(new SplDoublyLinkedListFilter($this), new TypeMatcher(SplDoublyLinkedList::class)); + } + + /** + * If enabled, will not throw an exception when coming across an uncloneable property. + * + * @param $skipUncloneable + * + * @return $this + */ + public function skipUncloneable($skipUncloneable = true) + { + $this->skipUncloneable = $skipUncloneable; + + return $this; + } + + /** + * Deep copies the given object. + * + * @param mixed $object + * + * @return mixed + */ + public function copy($object) + { + $this->hashMap = []; + + return $this->recursiveCopy($object); + } + + public function addFilter(Filter $filter, Matcher $matcher) + { + $this->filters[] = [ + 'matcher' => $matcher, + 'filter' => $filter, + ]; + } + + public function prependFilter(Filter $filter, Matcher $matcher) + { + array_unshift($this->filters, [ + 'matcher' => $matcher, + 'filter' => $filter, + ]); + } + + public function addTypeFilter(TypeFilter $filter, TypeMatcher $matcher) + { + $this->typeFilters[] = [ + 'matcher' => $matcher, + 'filter' => $filter, + ]; + } + + private function recursiveCopy($var) + { + // Matches Type Filter + if ($filter = $this->getFirstMatchedTypeFilter($this->typeFilters, $var)) { + return $filter->apply($var); + } + + // Resource + if (is_resource($var)) { + return $var; + } + + // Array + if (is_array($var)) { + return $this->copyArray($var); + } + + // Scalar + if (! is_object($var)) { + return $var; + } + + // Enum + if (PHP_VERSION_ID >= 80100 && enum_exists(get_class($var))) { + return $var; + } + + // Object + return $this->copyObject($var); + } + + /** + * Copy an array + * @param array $array + * @return array + */ + private function copyArray(array $array) + { + foreach ($array as $key => $value) { + $array[$key] = $this->recursiveCopy($value); + } + + return $array; + } + + /** + * Copies an object. + * + * @param object $object + * + * @throws CloneException + * + * @return object + */ + private function copyObject($object) + { + $objectHash = spl_object_hash($object); + + if (isset($this->hashMap[$objectHash])) { + return $this->hashMap[$objectHash]; + } + + $reflectedObject = new ReflectionObject($object); + $isCloneable = $reflectedObject->isCloneable(); + + if (false === $isCloneable) { + if ($this->skipUncloneable) { + $this->hashMap[$objectHash] = $object; + + return $object; + } + + throw new CloneException( + sprintf( + 'The class "%s" is not cloneable.', + $reflectedObject->getName() + ) + ); + } + + $newObject = clone $object; + $this->hashMap[$objectHash] = $newObject; + + if ($this->useCloneMethod && $reflectedObject->hasMethod('__clone')) { + return $newObject; + } + + if ($newObject instanceof DateTimeInterface || $newObject instanceof DateTimeZone) { + return $newObject; + } + + foreach (ReflectionHelper::getProperties($reflectedObject) as $property) { + $this->copyObjectProperty($newObject, $property); + } + + return $newObject; + } + + private function copyObjectProperty($object, ReflectionProperty $property) + { + // Ignore static properties + if ($property->isStatic()) { + return; + } + + // Ignore readonly properties + if (method_exists($property, 'isReadOnly') && $property->isReadOnly()) { + return; + } + + // Apply the filters + foreach ($this->filters as $item) { + /** @var Matcher $matcher */ + $matcher = $item['matcher']; + /** @var Filter $filter */ + $filter = $item['filter']; + + if ($matcher->matches($object, $property->getName())) { + $filter->apply( + $object, + $property->getName(), + function ($object) { + return $this->recursiveCopy($object); + } + ); + + if ($filter instanceof ChainableFilter) { + continue; + } + + // If a filter matches, we stop processing this property + return; + } + } + + $property->setAccessible(true); + + // Ignore uninitialized properties (for PHP >7.4) + if (method_exists($property, 'isInitialized') && !$property->isInitialized($object)) { + return; + } + + $propertyValue = $property->getValue($object); + + // Copy the property + $property->setValue($object, $this->recursiveCopy($propertyValue)); + } + + /** + * Returns first filter that matches variable, `null` if no such filter found. + * + * @param array $filterRecords Associative array with 2 members: 'filter' with value of type {@see TypeFilter} and + * 'matcher' with value of type {@see TypeMatcher} + * @param mixed $var + * + * @return TypeFilter|null + */ + private function getFirstMatchedTypeFilter(array $filterRecords, $var) + { + $matched = $this->first( + $filterRecords, + function (array $record) use ($var) { + /* @var TypeMatcher $matcher */ + $matcher = $record['matcher']; + + return $matcher->matches($var); + } + ); + + return isset($matched) ? $matched['filter'] : null; + } + + /** + * Returns first element that matches predicate, `null` if no such element found. + * + * @param array $elements Array of ['filter' => Filter, 'matcher' => Matcher] pairs. + * @param callable $predicate Predicate arguments are: element. + * + * @return array|null Associative array with 2 members: 'filter' with value of type {@see TypeFilter} and 'matcher' + * with value of type {@see TypeMatcher} or `null`. + */ + private function first(array $elements, callable $predicate) + { + foreach ($elements as $element) { + if (call_user_func($predicate, $element)) { + return $element; + } + } + + return null; + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Exception/CloneException.php b/vendor/myclabs/deep-copy/src/DeepCopy/Exception/CloneException.php new file mode 100644 index 00000000..c046706a --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Exception/CloneException.php @@ -0,0 +1,9 @@ +<?php + +namespace DeepCopy\Exception; + +use UnexpectedValueException; + +class CloneException extends UnexpectedValueException +{ +} \ No newline at end of file diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Exception/PropertyException.php b/vendor/myclabs/deep-copy/src/DeepCopy/Exception/PropertyException.php new file mode 100644 index 00000000..9702101a --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Exception/PropertyException.php @@ -0,0 +1,9 @@ +<?php + +namespace DeepCopy\Exception; + +use ReflectionException; + +class PropertyException extends ReflectionException +{ +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Filter/ChainableFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/ChainableFilter.php new file mode 100644 index 00000000..4e3f7bbc --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/ChainableFilter.php @@ -0,0 +1,24 @@ +<?php + +namespace DeepCopy\Filter; + +/** + * Defines a decorator filter that will not stop the chain of filters. + */ +class ChainableFilter implements Filter +{ + /** + * @var Filter + */ + protected $filter; + + public function __construct(Filter $filter) + { + $this->filter = $filter; + } + + public function apply($object, $property, $objectCopier) + { + $this->filter->apply($object, $property, $objectCopier); + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineCollectionFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineCollectionFilter.php new file mode 100644 index 00000000..e6d93771 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineCollectionFilter.php @@ -0,0 +1,33 @@ +<?php + +namespace DeepCopy\Filter\Doctrine; + +use DeepCopy\Filter\Filter; +use DeepCopy\Reflection\ReflectionHelper; + +/** + * @final + */ +class DoctrineCollectionFilter implements Filter +{ + /** + * Copies the object property doctrine collection. + * + * {@inheritdoc} + */ + public function apply($object, $property, $objectCopier) + { + $reflectionProperty = ReflectionHelper::getProperty($object, $property); + + $reflectionProperty->setAccessible(true); + $oldCollection = $reflectionProperty->getValue($object); + + $newCollection = $oldCollection->map( + function ($item) use ($objectCopier) { + return $objectCopier($item); + } + ); + + $reflectionProperty->setValue($object, $newCollection); + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineEmptyCollectionFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineEmptyCollectionFilter.php new file mode 100644 index 00000000..7b33fd54 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineEmptyCollectionFilter.php @@ -0,0 +1,28 @@ +<?php + +namespace DeepCopy\Filter\Doctrine; + +use DeepCopy\Filter\Filter; +use DeepCopy\Reflection\ReflectionHelper; +use Doctrine\Common\Collections\ArrayCollection; + +/** + * @final + */ +class DoctrineEmptyCollectionFilter implements Filter +{ + /** + * Sets the object property to an empty doctrine collection. + * + * @param object $object + * @param string $property + * @param callable $objectCopier + */ + public function apply($object, $property, $objectCopier) + { + $reflectionProperty = ReflectionHelper::getProperty($object, $property); + $reflectionProperty->setAccessible(true); + + $reflectionProperty->setValue($object, new ArrayCollection()); + } +} \ No newline at end of file diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineProxyFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineProxyFilter.php new file mode 100644 index 00000000..8bee8f76 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineProxyFilter.php @@ -0,0 +1,22 @@ +<?php + +namespace DeepCopy\Filter\Doctrine; + +use DeepCopy\Filter\Filter; + +/** + * @final + */ +class DoctrineProxyFilter implements Filter +{ + /** + * Triggers the magic method __load() on a Doctrine Proxy class to load the + * actual entity from the database. + * + * {@inheritdoc} + */ + public function apply($object, $property, $objectCopier) + { + $object->__load(); + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Filter.php b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Filter.php new file mode 100644 index 00000000..85ba18ce --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Filter.php @@ -0,0 +1,18 @@ +<?php + +namespace DeepCopy\Filter; + +/** + * Filter to apply to a property while copying an object + */ +interface Filter +{ + /** + * Applies the filter to the object. + * + * @param object $object + * @param string $property + * @param callable $objectCopier + */ + public function apply($object, $property, $objectCopier); +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Filter/KeepFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/KeepFilter.php new file mode 100644 index 00000000..4b11a081 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/KeepFilter.php @@ -0,0 +1,16 @@ +<?php + +namespace DeepCopy\Filter; + +class KeepFilter implements Filter +{ + /** + * Keeps the value of the object property. + * + * {@inheritdoc} + */ + public function apply($object, $property, $objectCopier) + { + // Nothing to do + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Filter/ReplaceFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/ReplaceFilter.php new file mode 100644 index 00000000..7aca593b --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/ReplaceFilter.php @@ -0,0 +1,39 @@ +<?php + +namespace DeepCopy\Filter; + +use DeepCopy\Reflection\ReflectionHelper; + +/** + * @final + */ +class ReplaceFilter implements Filter +{ + /** + * @var callable + */ + protected $callback; + + /** + * @param callable $callable Will be called to get the new value for each property to replace + */ + public function __construct(callable $callable) + { + $this->callback = $callable; + } + + /** + * Replaces the object property by the result of the callback called with the object property. + * + * {@inheritdoc} + */ + public function apply($object, $property, $objectCopier) + { + $reflectionProperty = ReflectionHelper::getProperty($object, $property); + $reflectionProperty->setAccessible(true); + + $value = call_user_func($this->callback, $reflectionProperty->getValue($object)); + + $reflectionProperty->setValue($object, $value); + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Filter/SetNullFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/SetNullFilter.php new file mode 100644 index 00000000..bea86b88 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/SetNullFilter.php @@ -0,0 +1,24 @@ +<?php + +namespace DeepCopy\Filter; + +use DeepCopy\Reflection\ReflectionHelper; + +/** + * @final + */ +class SetNullFilter implements Filter +{ + /** + * Sets the object property to null. + * + * {@inheritdoc} + */ + public function apply($object, $property, $objectCopier) + { + $reflectionProperty = ReflectionHelper::getProperty($object, $property); + + $reflectionProperty->setAccessible(true); + $reflectionProperty->setValue($object, null); + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/Doctrine/DoctrineProxyMatcher.php b/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/Doctrine/DoctrineProxyMatcher.php new file mode 100644 index 00000000..c5887b19 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/Doctrine/DoctrineProxyMatcher.php @@ -0,0 +1,22 @@ +<?php + +namespace DeepCopy\Matcher\Doctrine; + +use DeepCopy\Matcher\Matcher; +use Doctrine\Persistence\Proxy; + +/** + * @final + */ +class DoctrineProxyMatcher implements Matcher +{ + /** + * Matches a Doctrine Proxy class. + * + * {@inheritdoc} + */ + public function matches($object, $property) + { + return $object instanceof Proxy; + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/Matcher.php b/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/Matcher.php new file mode 100644 index 00000000..d67f3cac --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/Matcher.php @@ -0,0 +1,14 @@ +<?php + +namespace DeepCopy\Matcher; + +interface Matcher +{ + /** + * @param object $object + * @param string $property + * + * @return boolean + */ + public function matches($object, $property); +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyMatcher.php b/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyMatcher.php new file mode 100644 index 00000000..073b20cb --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyMatcher.php @@ -0,0 +1,39 @@ +<?php + +namespace DeepCopy\Matcher; + +/** + * @final + */ +class PropertyMatcher implements Matcher +{ + /** + * @var string + */ + private $class; + + /** + * @var string + */ + private $property; + + /** + * @param string $class Class name + * @param string $property Property name + */ + public function __construct($class, $property) + { + $this->class = $class; + $this->property = $property; + } + + /** + * Matches a specific property of a specific class. + * + * {@inheritdoc} + */ + public function matches($object, $property) + { + return ($object instanceof $this->class) && $property == $this->property; + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyNameMatcher.php b/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyNameMatcher.php new file mode 100644 index 00000000..c8ec0d2b --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyNameMatcher.php @@ -0,0 +1,32 @@ +<?php + +namespace DeepCopy\Matcher; + +/** + * @final + */ +class PropertyNameMatcher implements Matcher +{ + /** + * @var string + */ + private $property; + + /** + * @param string $property Property name + */ + public function __construct($property) + { + $this->property = $property; + } + + /** + * Matches a property by its name. + * + * {@inheritdoc} + */ + public function matches($object, $property) + { + return $property == $this->property; + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyTypeMatcher.php b/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyTypeMatcher.php new file mode 100644 index 00000000..c7f46908 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyTypeMatcher.php @@ -0,0 +1,52 @@ +<?php + +namespace DeepCopy\Matcher; + +use DeepCopy\Reflection\ReflectionHelper; +use ReflectionException; + +/** + * Matches a property by its type. + * + * It is recommended to use {@see DeepCopy\TypeFilter\TypeFilter} instead, as it applies on all occurrences + * of given type in copied context (eg. array elements), not just on object properties. + * + * @final + */ +class PropertyTypeMatcher implements Matcher +{ + /** + * @var string + */ + private $propertyType; + + /** + * @param string $propertyType Property type + */ + public function __construct($propertyType) + { + $this->propertyType = $propertyType; + } + + /** + * {@inheritdoc} + */ + public function matches($object, $property) + { + try { + $reflectionProperty = ReflectionHelper::getProperty($object, $property); + } catch (ReflectionException $exception) { + return false; + } + + $reflectionProperty->setAccessible(true); + + // Uninitialized properties (for PHP >7.4) + if (method_exists($reflectionProperty, 'isInitialized') && !$reflectionProperty->isInitialized($object)) { + // null instanceof $this->propertyType + return false; + } + + return $reflectionProperty->getValue($object) instanceof $this->propertyType; + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Reflection/ReflectionHelper.php b/vendor/myclabs/deep-copy/src/DeepCopy/Reflection/ReflectionHelper.php new file mode 100644 index 00000000..742410cb --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Reflection/ReflectionHelper.php @@ -0,0 +1,78 @@ +<?php + +namespace DeepCopy\Reflection; + +use DeepCopy\Exception\PropertyException; +use ReflectionClass; +use ReflectionException; +use ReflectionObject; +use ReflectionProperty; + +class ReflectionHelper +{ + /** + * Retrieves all properties (including private ones), from object and all its ancestors. + * + * Standard \ReflectionClass->getProperties() does not return private properties from ancestor classes. + * + * @author muratyaman@gmail.com + * @see http://php.net/manual/en/reflectionclass.getproperties.php + * + * @param ReflectionClass $ref + * + * @return ReflectionProperty[] + */ + public static function getProperties(ReflectionClass $ref) + { + $props = $ref->getProperties(); + $propsArr = array(); + + foreach ($props as $prop) { + $propertyName = $prop->getName(); + $propsArr[$propertyName] = $prop; + } + + if ($parentClass = $ref->getParentClass()) { + $parentPropsArr = self::getProperties($parentClass); + foreach ($propsArr as $key => $property) { + $parentPropsArr[$key] = $property; + } + + return $parentPropsArr; + } + + return $propsArr; + } + + /** + * Retrieves property by name from object and all its ancestors. + * + * @param object|string $object + * @param string $name + * + * @throws PropertyException + * @throws ReflectionException + * + * @return ReflectionProperty + */ + public static function getProperty($object, $name) + { + $reflection = is_object($object) ? new ReflectionObject($object) : new ReflectionClass($object); + + if ($reflection->hasProperty($name)) { + return $reflection->getProperty($name); + } + + if ($parentClass = $reflection->getParentClass()) { + return self::getProperty($parentClass->getName(), $name); + } + + throw new PropertyException( + sprintf( + 'The class "%s" doesn\'t have a property with the given name: "%s".', + is_object($object) ? get_class($object) : $object, + $name + ) + ); + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/Date/DateIntervalFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/Date/DateIntervalFilter.php new file mode 100644 index 00000000..becd1cff --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/Date/DateIntervalFilter.php @@ -0,0 +1,33 @@ +<?php + +namespace DeepCopy\TypeFilter\Date; + +use DateInterval; +use DeepCopy\TypeFilter\TypeFilter; + +/** + * @final + * + * @deprecated Will be removed in 2.0. This filter will no longer be necessary in PHP 7.1+. + */ +class DateIntervalFilter implements TypeFilter +{ + + /** + * {@inheritdoc} + * + * @param DateInterval $element + * + * @see http://news.php.net/php.bugs/205076 + */ + public function apply($element) + { + $copy = new DateInterval('P0D'); + + foreach ($element as $propertyName => $propertyValue) { + $copy->{$propertyName} = $propertyValue; + } + + return $copy; + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/ReplaceFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/ReplaceFilter.php new file mode 100644 index 00000000..164f8b8e --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/ReplaceFilter.php @@ -0,0 +1,30 @@ +<?php + +namespace DeepCopy\TypeFilter; + +/** + * @final + */ +class ReplaceFilter implements TypeFilter +{ + /** + * @var callable + */ + protected $callback; + + /** + * @param callable $callable Will be called to get the new value for each element to replace + */ + public function __construct(callable $callable) + { + $this->callback = $callable; + } + + /** + * {@inheritdoc} + */ + public function apply($element) + { + return call_user_func($this->callback, $element); + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/ShallowCopyFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/ShallowCopyFilter.php new file mode 100644 index 00000000..a5fbd7a2 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/ShallowCopyFilter.php @@ -0,0 +1,17 @@ +<?php + +namespace DeepCopy\TypeFilter; + +/** + * @final + */ +class ShallowCopyFilter implements TypeFilter +{ + /** + * {@inheritdoc} + */ + public function apply($element) + { + return clone $element; + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/Spl/ArrayObjectFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/Spl/ArrayObjectFilter.php new file mode 100644 index 00000000..17846017 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/Spl/ArrayObjectFilter.php @@ -0,0 +1,36 @@ +<?php +namespace DeepCopy\TypeFilter\Spl; + +use DeepCopy\DeepCopy; +use DeepCopy\TypeFilter\TypeFilter; + +/** + * In PHP 7.4 the storage of an ArrayObject isn't returned as + * ReflectionProperty. So we deep copy its array copy. + */ +final class ArrayObjectFilter implements TypeFilter +{ + /** + * @var DeepCopy + */ + private $copier; + + public function __construct(DeepCopy $copier) + { + $this->copier = $copier; + } + + /** + * {@inheritdoc} + */ + public function apply($arrayObject) + { + $clone = clone $arrayObject; + foreach ($arrayObject->getArrayCopy() as $k => $v) { + $clone->offsetSet($k, $this->copier->copy($v)); + } + + return $clone; + } +} + diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/Spl/SplDoublyLinkedList.php b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/Spl/SplDoublyLinkedList.php new file mode 100644 index 00000000..c5644cff --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/Spl/SplDoublyLinkedList.php @@ -0,0 +1,10 @@ +<?php + +namespace DeepCopy\TypeFilter\Spl; + +/** + * @deprecated Use {@see SplDoublyLinkedListFilter} instead. + */ +class SplDoublyLinkedList extends SplDoublyLinkedListFilter +{ +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/Spl/SplDoublyLinkedListFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/Spl/SplDoublyLinkedListFilter.php new file mode 100644 index 00000000..c33be458 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/Spl/SplDoublyLinkedListFilter.php @@ -0,0 +1,51 @@ +<?php + +namespace DeepCopy\TypeFilter\Spl; + +use Closure; +use DeepCopy\DeepCopy; +use DeepCopy\TypeFilter\TypeFilter; +use SplDoublyLinkedList; + +/** + * @final + */ +class SplDoublyLinkedListFilter implements TypeFilter +{ + private $copier; + + public function __construct(DeepCopy $copier) + { + $this->copier = $copier; + } + + /** + * {@inheritdoc} + */ + public function apply($element) + { + $newElement = clone $element; + + $copy = $this->createCopyClosure(); + + return $copy($newElement); + } + + private function createCopyClosure() + { + $copier = $this->copier; + + $copy = function (SplDoublyLinkedList $list) use ($copier) { + // Replace each element in the list with a deep copy of itself + for ($i = 1; $i <= $list->count(); $i++) { + $copy = $copier->recursiveCopy($list->shift()); + + $list->push($copy); + } + + return $list; + }; + + return Closure::bind($copy, null, DeepCopy::class); + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/TypeFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/TypeFilter.php new file mode 100644 index 00000000..5785a7da --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/TypeFilter.php @@ -0,0 +1,13 @@ +<?php + +namespace DeepCopy\TypeFilter; + +interface TypeFilter +{ + /** + * Applies the filter to the object. + * + * @param mixed $element + */ + public function apply($element); +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/TypeMatcher/TypeMatcher.php b/vendor/myclabs/deep-copy/src/DeepCopy/TypeMatcher/TypeMatcher.php new file mode 100644 index 00000000..a563cb29 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/TypeMatcher/TypeMatcher.php @@ -0,0 +1,29 @@ +<?php + +namespace DeepCopy\TypeMatcher; + +class TypeMatcher +{ + /** + * @var string + */ + private $type; + + /** + * @param string $type + */ + public function __construct($type) + { + $this->type = $type; + } + + /** + * @param mixed $element + * + * @return boolean + */ + public function matches($element) + { + return is_object($element) ? is_a($element, $this->type) : gettype($element) === $this->type; + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/deep_copy.php b/vendor/myclabs/deep-copy/src/DeepCopy/deep_copy.php new file mode 100644 index 00000000..55dcc926 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/deep_copy.php @@ -0,0 +1,20 @@ +<?php + +namespace DeepCopy; + +use function function_exists; + +if (false === function_exists('DeepCopy\deep_copy')) { + /** + * Deep copies the given value. + * + * @param mixed $value + * @param bool $useCloneMethod + * + * @return mixed + */ + function deep_copy($value, $useCloneMethod = false) + { + return (new DeepCopy($useCloneMethod))->copy($value); + } +} diff --git a/vendor/nesbot/carbon/.phpstorm.meta.php b/vendor/nesbot/carbon/.phpstorm.meta.php new file mode 100644 index 00000000..bd7c7e0e --- /dev/null +++ b/vendor/nesbot/carbon/.phpstorm.meta.php @@ -0,0 +1,10 @@ +<?php +namespace PHPSTORM_META { + registerArgumentsSet("date_units", "millenania", "millennium", "century", "centuries", "decade", "decades", "year", "years", "y", "yr", "yrs", "quarter", "quarters", "month", "months", "mo", "mos", "week", "weeks", "w", "day", "days", "d", "hour", "hours", "h", "minute", "minutes", "m", "second", "seconds", "s", "millisecond", "milliseconds", "milli", "ms", "microsecond", "microseconds", "micro", "µs"); + expectedArguments(\Carbon\Traits\Units::add(), 0, argumentsSet("date_units")); + expectedArguments(\Carbon\Traits\Units::add(), 1, argumentsSet("date_units")); + expectedArguments(\Carbon\CarbonInterface::add(), 0, argumentsSet("date_units")); + expectedArguments(\Carbon\CarbonInterface::add(), 1, argumentsSet("date_units")); + + expectedArguments(\Carbon\CarbonInterface::getTimeFormatByPrecision(), 0, "minute", "second", "m", "millisecond", "µ", "microsecond", "minutes", "seconds", "ms", "milliseconds", "µs", "microseconds"); +} diff --git a/vendor/nesbot/carbon/LICENSE b/vendor/nesbot/carbon/LICENSE new file mode 100644 index 00000000..6de45ebf --- /dev/null +++ b/vendor/nesbot/carbon/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) Brian Nesbitt + +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/vendor/nesbot/carbon/composer.json b/vendor/nesbot/carbon/composer.json new file mode 100644 index 00000000..0014434e --- /dev/null +++ b/vendor/nesbot/carbon/composer.json @@ -0,0 +1,127 @@ +{ + "name": "nesbot/carbon", + "description": "An API extension for DateTime that supports 281 different languages.", + "license": "MIT", + "type": "library", + "keywords": [ + "date", + "time", + "DateTime" + ], + "authors": [ + { + "name": "Brian Nesbitt", + "email": "brian@nesbot.com", + "homepage": "https://markido.com" + }, + { + "name": "kylekatarnls", + "homepage": "https://github.com/kylekatarnls" + } + ], + "homepage": "https://carbon.nesbot.com", + "support": { + "issues": "https://github.com/briannesbitt/Carbon/issues", + "source": "https://github.com/briannesbitt/Carbon", + "docs": "https://carbon.nesbot.com/docs" + }, + "funding": [ + { + "url": "https://github.com/sponsors/kylekatarnls", + "type": "github" + }, + { + "url": "https://tidelift.com/subscription/pkg/packagist-nesbot-carbon?utm_source=packagist-nesbot-carbon&utm_medium=referral&utm_campaign=readme", + "type": "tidelift" + }, + { + "url": "https://opencollective.com/Carbon#sponsor", + "type": "opencollective" + } + ], + "require": { + "php": "^7.1.8 || ^8.0", + "ext-json": "*", + "carbonphp/carbon-doctrine-types": "*", + "psr/clock": "^1.0", + "symfony/polyfill-mbstring": "^1.0", + "symfony/polyfill-php80": "^1.16", + "symfony/translation": "^3.4 || ^4.0 || ^5.0 || ^6.0" + }, + "require-dev": { + "doctrine/dbal": "^2.0 || ^3.1.4 || ^4.0", + "doctrine/orm": "^2.7 || ^3.0", + "friendsofphp/php-cs-fixer": "^3.0", + "kylekatarnls/multi-tester": "^2.0", + "ondrejmirtes/better-reflection": "*", + "phpmd/phpmd": "^2.9", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^0.12.99 || ^1.7.14", + "phpunit/php-file-iterator": "^2.0.5 || ^3.0.6", + "phpunit/phpunit": "^7.5.20 || ^8.5.26 || ^9.5.20", + "squizlabs/php_codesniffer": "^3.4" + }, + "provide": { + "psr/clock-implementation": "1.0" + }, + "minimum-stability": "dev", + "prefer-stable": true, + "autoload": { + "psr-4": { + "Carbon\\": "src/Carbon/" + } + }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests/" + }, + "files": [ + "tests/Laravel/ServiceProvider.php" + ] + }, + "bin": [ + "bin/carbon" + ], + "config": { + "allow-plugins": { + "phpstan/extension-installer": true, + "composer/package-versions-deprecated": true + }, + "process-timeout": 0, + "sort-packages": true + }, + "extra": { + "branch-alias": { + "dev-master": "3.x-dev", + "dev-2.x": "2.x-dev" + }, + "laravel": { + "providers": [ + "Carbon\\Laravel\\ServiceProvider" + ] + }, + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "scripts": { + "phpcs": "php-cs-fixer fix -v --diff --dry-run", + "phpdoc": "php phpdoc.php", + "phpmd": "phpmd src text /phpmd.xml", + "phpmd-test": "phpmd tests text /tests/phpmd-test.xml", + "phpstan": "phpstan analyse --configuration phpstan.neon", + "phpunit": "phpunit --verbose", + "style-check": [ + "@phpcs", + "@phpstan", + "@phpmd" + ], + "test": [ + "@phpunit", + "@style-check" + ], + "sponsors": "php sponsors.php" + } +} diff --git a/vendor/nesbot/carbon/extension.neon b/vendor/nesbot/carbon/extension.neon new file mode 100644 index 00000000..33bf794f --- /dev/null +++ b/vendor/nesbot/carbon/extension.neon @@ -0,0 +1,5 @@ +services: + - + class: Carbon\PHPStan\MacroExtension + tags: + - phpstan.broker.methodsClassReflectionExtension diff --git a/vendor/nesbot/carbon/lazy/Carbon/MessageFormatter/MessageFormatterMapperStrongType.php b/vendor/nesbot/carbon/lazy/Carbon/MessageFormatter/MessageFormatterMapperStrongType.php new file mode 100644 index 00000000..c2f4bf01 --- /dev/null +++ b/vendor/nesbot/carbon/lazy/Carbon/MessageFormatter/MessageFormatterMapperStrongType.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\MessageFormatter; + +use Symfony\Component\Translation\Formatter\MessageFormatterInterface; + +if (!class_exists(LazyMessageFormatter::class, false)) { + abstract class LazyMessageFormatter implements MessageFormatterInterface + { + public function format(string $message, string $locale, array $parameters = []): string + { + return $this->formatter->format( + $message, + $this->transformLocale($locale), + $parameters + ); + } + } +} diff --git a/vendor/nesbot/carbon/lazy/Carbon/MessageFormatter/MessageFormatterMapperWeakType.php b/vendor/nesbot/carbon/lazy/Carbon/MessageFormatter/MessageFormatterMapperWeakType.php new file mode 100644 index 00000000..cbd890d5 --- /dev/null +++ b/vendor/nesbot/carbon/lazy/Carbon/MessageFormatter/MessageFormatterMapperWeakType.php @@ -0,0 +1,36 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\MessageFormatter; + +use Symfony\Component\Translation\Formatter\ChoiceMessageFormatterInterface; +use Symfony\Component\Translation\Formatter\MessageFormatterInterface; + +if (!class_exists(LazyMessageFormatter::class, false)) { + abstract class LazyMessageFormatter implements MessageFormatterInterface, ChoiceMessageFormatterInterface + { + abstract protected function transformLocale(?string $locale): ?string; + + public function format($message, $locale, array $parameters = []) + { + return $this->formatter->format( + $message, + $this->transformLocale($locale), + $parameters + ); + } + + public function choiceFormat($message, $number, $locale, array $parameters = []) + { + return $this->formatter->choiceFormat($message, $number, $locale, $parameters); + } + } +} diff --git a/vendor/nesbot/carbon/lazy/Carbon/PHPStan/AbstractMacroBuiltin.php b/vendor/nesbot/carbon/lazy/Carbon/PHPStan/AbstractMacroBuiltin.php new file mode 100644 index 00000000..ba7cf632 --- /dev/null +++ b/vendor/nesbot/carbon/lazy/Carbon/PHPStan/AbstractMacroBuiltin.php @@ -0,0 +1,36 @@ +<?php + +declare(strict_types=1); + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\PHPStan; + +use PHPStan\BetterReflection\Reflection; +use ReflectionMethod; + +if (!class_exists(AbstractReflectionMacro::class, false)) { + abstract class AbstractReflectionMacro extends AbstractMacro + { + /** + * {@inheritdoc} + */ + public function getReflection(): ?ReflectionMethod + { + if ($this->reflectionFunction instanceof Reflection\ReflectionMethod) { + return new Reflection\Adapter\ReflectionMethod($this->reflectionFunction); + } + + return $this->reflectionFunction instanceof ReflectionMethod + ? $this->reflectionFunction + : null; + } + } +} diff --git a/vendor/nesbot/carbon/lazy/Carbon/PHPStan/AbstractMacroStatic.php b/vendor/nesbot/carbon/lazy/Carbon/PHPStan/AbstractMacroStatic.php new file mode 100644 index 00000000..bd4c8e80 --- /dev/null +++ b/vendor/nesbot/carbon/lazy/Carbon/PHPStan/AbstractMacroStatic.php @@ -0,0 +1,45 @@ +<?php + +declare(strict_types=1); + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\PHPStan; + +use PHPStan\BetterReflection\Reflection; +use ReflectionMethod; + +if (!class_exists(AbstractReflectionMacro::class, false)) { + abstract class AbstractReflectionMacro extends AbstractMacro + { + /** + * {@inheritdoc} + */ + public function getReflection(): ?Reflection\Adapter\ReflectionMethod + { + if ($this->reflectionFunction instanceof Reflection\Adapter\ReflectionMethod) { + return $this->reflectionFunction; + } + + if ($this->reflectionFunction instanceof Reflection\ReflectionMethod) { + return new Reflection\Adapter\ReflectionMethod($this->reflectionFunction); + } + + return $this->reflectionFunction instanceof ReflectionMethod + ? new Reflection\Adapter\ReflectionMethod( + Reflection\ReflectionMethod::createFromName( + $this->reflectionFunction->getDeclaringClass()->getName(), + $this->reflectionFunction->getName() + ) + ) + : null; + } + } +} diff --git a/vendor/nesbot/carbon/lazy/Carbon/PHPStan/MacroStrongType.php b/vendor/nesbot/carbon/lazy/Carbon/PHPStan/MacroStrongType.php new file mode 100644 index 00000000..f615b3a6 --- /dev/null +++ b/vendor/nesbot/carbon/lazy/Carbon/PHPStan/MacroStrongType.php @@ -0,0 +1,45 @@ +<?php + +declare(strict_types=1); + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\PHPStan; + +if (!class_exists(LazyMacro::class, false)) { + abstract class LazyMacro extends AbstractReflectionMacro + { + /** + * {@inheritdoc} + */ + public function getFileName(): ?string + { + $file = $this->reflectionFunction->getFileName(); + + return (($file ? realpath($file) : null) ?: $file) ?: null; + } + + /** + * {@inheritdoc} + */ + public function getStartLine(): ?int + { + return $this->reflectionFunction->getStartLine(); + } + + /** + * {@inheritdoc} + */ + public function getEndLine(): ?int + { + return $this->reflectionFunction->getEndLine(); + } + } +} diff --git a/vendor/nesbot/carbon/lazy/Carbon/PHPStan/MacroWeakType.php b/vendor/nesbot/carbon/lazy/Carbon/PHPStan/MacroWeakType.php new file mode 100644 index 00000000..bf64c1dd --- /dev/null +++ b/vendor/nesbot/carbon/lazy/Carbon/PHPStan/MacroWeakType.php @@ -0,0 +1,51 @@ +<?php + +declare(strict_types=1); + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\PHPStan; + +if (!class_exists(LazyMacro::class, false)) { + abstract class LazyMacro extends AbstractReflectionMacro + { + /** + * {@inheritdoc} + * + * @return string|false + */ + public function getFileName() + { + $file = $this->reflectionFunction->getFileName(); + + return (($file ? realpath($file) : null) ?: $file) ?: null; + } + + /** + * {@inheritdoc} + * + * @return int|false + */ + public function getStartLine() + { + return $this->reflectionFunction->getStartLine(); + } + + /** + * {@inheritdoc} + * + * @return int|false + */ + public function getEndLine() + { + return $this->reflectionFunction->getEndLine(); + } + } +} diff --git a/vendor/nesbot/carbon/lazy/Carbon/TranslatorStrongType.php b/vendor/nesbot/carbon/lazy/Carbon/TranslatorStrongType.php new file mode 100644 index 00000000..d35308a6 --- /dev/null +++ b/vendor/nesbot/carbon/lazy/Carbon/TranslatorStrongType.php @@ -0,0 +1,52 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon; + +use Symfony\Component\Translation\MessageCatalogueInterface; + +if (!class_exists(LazyTranslator::class, false)) { + class LazyTranslator extends AbstractTranslator implements TranslatorStrongTypeInterface + { + public function trans(?string $id, array $parameters = [], ?string $domain = null, ?string $locale = null): string + { + return $this->translate($id, $parameters, $domain, $locale); + } + + public function getFromCatalogue(MessageCatalogueInterface $catalogue, string $id, string $domain = 'messages') + { + $messages = $this->getPrivateProperty($catalogue, 'messages'); + + if (isset($messages[$domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX][$id])) { + return $messages[$domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX][$id]; + } + + if (isset($messages[$domain][$id])) { + return $messages[$domain][$id]; + } + + $fallbackCatalogue = $this->getPrivateProperty($catalogue, 'fallbackCatalogue'); + + if ($fallbackCatalogue !== null) { + return $this->getFromCatalogue($fallbackCatalogue, $id, $domain); + } + + return $id; + } + + private function getPrivateProperty($instance, string $field) + { + return (function (string $field) { + return $this->$field; + })->call($instance, $field); + } + } +} diff --git a/vendor/nesbot/carbon/lazy/Carbon/TranslatorWeakType.php b/vendor/nesbot/carbon/lazy/Carbon/TranslatorWeakType.php new file mode 100644 index 00000000..94dbdc30 --- /dev/null +++ b/vendor/nesbot/carbon/lazy/Carbon/TranslatorWeakType.php @@ -0,0 +1,32 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon; + +if (!class_exists(LazyTranslator::class, false)) { + class LazyTranslator extends AbstractTranslator + { + /** + * Returns the translation. + * + * @param string|null $id + * @param array $parameters + * @param string|null $domain + * @param string|null $locale + * + * @return string + */ + public function trans($id, array $parameters = [], $domain = null, $locale = null) + { + return $this->translate($id, $parameters, $domain, $locale); + } + } +} diff --git a/vendor/nesbot/carbon/readme.md b/vendor/nesbot/carbon/readme.md new file mode 100644 index 00000000..97ec8ce0 --- /dev/null +++ b/vendor/nesbot/carbon/readme.md @@ -0,0 +1,176 @@ +# Carbon + +[![Latest Stable Version](https://img.shields.io/packagist/v/nesbot/carbon.svg?style=flat-square)](https://packagist.org/packages/nesbot/carbon) +[![Total Downloads](https://img.shields.io/packagist/dt/nesbot/carbon.svg?style=flat-square)](https://packagist.org/packages/nesbot/carbon) +[![GitHub Actions](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fbriannesbitt%2FCarbon%2Fbadge&style=flat-square&label=Build&logo=none)](https://github.com/briannesbitt/Carbon/actions) +[![codecov.io](https://img.shields.io/codecov/c/github/briannesbitt/Carbon.svg?style=flat-square)](https://codecov.io/github/briannesbitt/Carbon?branch=master) +[![Tidelift](https://tidelift.com/badges/github/briannesbitt/Carbon)](https://tidelift.com/subscription/pkg/packagist-nesbot-carbon?utm_source=packagist-nesbot-carbon&utm_medium=referral&utm_campaign=readme) + +An international PHP extension for DateTime. [https://carbon.nesbot.com](https://carbon.nesbot.com) + +```php +<?php + +use Carbon\Carbon; + +printf("Right now is %s", Carbon::now()->toDateTimeString()); +printf("Right now in Vancouver is %s", Carbon::now('America/Vancouver')); //implicit __toString() +$tomorrow = Carbon::now()->addDay(); +$lastWeek = Carbon::now()->subWeek(); +$nextSummerOlympics = Carbon::createFromDate(2016)->addYears(4); + +$officialDate = Carbon::now()->toRfc2822String(); + +$howOldAmI = Carbon::createFromDate(1975, 5, 21)->age; + +$noonTodayLondonTime = Carbon::createFromTime(12, 0, 0, 'Europe/London'); + +$internetWillBlowUpOn = Carbon::create(2038, 01, 19, 3, 14, 7, 'GMT'); + +// Don't really want this to happen so mock now +Carbon::setTestNow(Carbon::createFromDate(2000, 1, 1)); + +// comparisons are always done in UTC +if (Carbon::now()->gte($internetWillBlowUpOn)) { + die(); +} + +// Phew! Return to normal behaviour +Carbon::setTestNow(); + +if (Carbon::now()->isWeekend()) { + echo 'Party!'; +} +// Over 200 languages (and over 500 regional variants) supported: +echo Carbon::now()->subMinutes(2)->diffForHumans(); // '2 minutes ago' +echo Carbon::now()->subMinutes(2)->locale('zh_CN')->diffForHumans(); // '2分钟前' +echo Carbon::parse('2019-07-23 14:51')->isoFormat('LLLL'); // 'Tuesday, July 23, 2019 2:51 PM' +echo Carbon::parse('2019-07-23 14:51')->locale('fr_FR')->isoFormat('LLLL'); // 'mardi 23 juillet 2019 14:51' + +// ... but also does 'from now', 'after' and 'before' +// rolling up to seconds, minutes, hours, days, months, years + +$daysSinceEpoch = Carbon::createFromTimestamp(0)->diffInDays(); +``` + +[Get supported nesbot/carbon with the Tidelift Subscription](https://tidelift.com/subscription/pkg/packagist-nesbot-carbon?utm_source=packagist-nesbot-carbon&utm_medium=referral&utm_campaign=readme) + +## Installation + +### With Composer + +``` +$ composer require nesbot/carbon +``` + +```json +{ + "require": { + "nesbot/carbon": "^2.16" + } +} +``` + +```php +<?php +require 'vendor/autoload.php'; + +use Carbon\Carbon; + +printf("Now: %s", Carbon::now()); +``` + +### Without Composer + +Why are you not using [composer](https://getcomposer.org/)? Download the Carbon [latest release](https://github.com/briannesbitt/Carbon/releases) and put the contents of the ZIP archive into a directory in your project. Then require the file `autoload.php` to get all classes and dependencies loaded on need. + +```php +<?php +require 'path-to-Carbon-directory/autoload.php'; + +use Carbon\Carbon; + +printf("Now: %s", Carbon::now()); +``` + +## Docs + +[https://carbon.nesbot.com/docs](https://carbon.nesbot.com/docs) + +## Security contact information + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. + +## Credits + +### Contributors + +This project exists thanks to all the people who contribute. + +<a href="https://github.com/briannesbitt/Carbon/graphs/contributors" target="_blank"><img src="https://opencollective.com/Carbon/contributors.svg?width=890&button=false" /></a> + +### Translators + +[Thanks to people helping us to translate Carbon in so many languages](https://carbon.nesbot.com/contribute/translators/) + +### Sponsors + +Support this project by becoming a sponsor. Your logo will show up here with a link to your website. + +<a href="https://tidelift.com/subscription/pkg/packagist-nesbot-carbon?utm_source=packagist-nesbot-carbon&utm_medium=referral&utm_campaign=readme" target="_blank"><img src="https://carbon.nesbot.com/tidelift-brand.png" width="256" height="64"></a><!-- <open-collective-sponsors> --> +<a title="Онлайн казино 777 Україна" href="https://777.ua/?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="Онлайн казино" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/7e572d50-1ce8-4d69-ae12-86cc80371373/ok-ua-777.png" width="64" height="64"></a> +<a title="#1 Guide To Online Gambling In Canada" href="https://casinohex.org/canada/?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="CasinoHex Canada" src="https://opencollective-production.s3.us-west-1.amazonaws.com/79fdbcc0-a997-11eb-abbc-25e48b63c6dc.jpg" width="85" height="64"></a> +<a title="Znajdź najlepsze zakłady bukmacherskie w Polsce w 2023 roku. Probukmacher.pl to Twoje kompendium wiedzy na temat bukmacherów!" href="https://www.probukmacher.pl?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="Probukmacher" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/caf50271-4560-4ffe-a434-ea15239168db/Screenshot_1.png" width="89" height="64"></a> +<a title="Casino-portugal.pt" href="https://casino-portugal.pt/?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="Casino-portugal.pt" src="https://logo.clearbit.com/casino-portugal.pt" width="64" height="64"></a> +<a title="Gives a fun for our users" href="https://slotoking.ua/games/?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="Игровые автоматы" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/94601d07-3205-4c60-9c2d-9b8194dbefb7/skg-blue.png" width="64" height="64"></a> +<a title="Slots City® ➢ Лучшее лицензионно казино онлайн и оффлайн на гривны в Украине. 【 Более1500 игровых автоматов и слотов】✅ Официально и Безопасно" href="https://slotscity.ua/?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="Slots City" src="https://opencollective-production.s3.us-west-1.amazonaws.com/d7e298c0-7abe-11ed-8553-230872f5e54d.png" width="90" height="64"></a> +<a title="inkedin" href="https://inkedin.com?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="inkedin" src="https://logo.clearbit.com/inkedin.com" width="64" height="64"></a> +<a title="Актуальний та повносправний рейтинг онлайн казино України, ґрунтований на відгуках реальних гравців." href="https://uk.onlinecasino.in.ua/?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="Онлайн казино України" src="https://opencollective-production.s3.us-west-1.amazonaws.com/c0b4b090-eef8-11ec-9cb7-0527a205b226.png" width="64" height="64"></a> +<a title="OnlineCasinosSpelen" href="https://onlinecasinosspelen.com?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="OnlineCasinosSpelen" src="https://logo.clearbit.com/onlinecasinosspelen.com" width="64" height="64"></a> +<a title="Best non Gamstop sites in the UK" href="https://nongamstopcasinos.net/gb/?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="Best non Gamstop sites in the UK" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/34e340b8-e1de-4932-8a76-1b3ce2ec7ee8/logo_white%20bg%20(8).png" width="64" height="64"></a> +<a title="Real Money Pokies" href="https://www.nzfirst.org.nz/real-money-pokies/?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="Real Money Pokies" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/30d38232-a9d6-4e95-a48c-641fdc4d96fd/NZ_logo%20(6)%20(1)%20(1).jpg" width="64" height="64"></a> +<a title="Non GamStop Bookies UK" href="https://nongamstopbookies.com/uk/?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="Non GamStop Bookies UK" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/43c5561c-8907-4ef7-a4ee-c6da054788b8/logo-site%20(3).jpg" width="64" height="64"></a> +<a title="Актуальний топ-рейтинг українських онлайн казино на гривні! Щоденне оновлення топу та унікальна система ранжування, основана на відгуках гравців!" href="https://onlinecasino.in.ua/?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="Онлайн Казино Украины" src="https://opencollective-production.s3.us-west-1.amazonaws.com/8fdd8aa0-e273-11ec-a95e-d38fd331cabf.png" width="64" height="64"></a> +<a title="Twitter Video Downloader HD Tool allows you to store tweets on your device (mobile or PC) for free." href="https://ssstwitter.online/?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="SSSTwitter" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/ba0d1daf-a894-4d98-95f7-a44d321364b3/Screenshot%202024-01-16%20at%2011.43.22.png" width="76" height="64"></a> +<a title="Entertainment" href="https://www.nongamstopbets.com/casinos-not-on-gamstop/?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="Non-GamStop Bets UK" src="https://logo.clearbit.com/nongamstopbets.com" width="64" height="64"></a> +<a title="Chudovo - international software development company with representative offices in Kyiv, Cologne, New York, Tallinn and London. It has been working on the market since 2006. Company has domain expertise in video security, logistics, medicine, finance and" href="https://chudovo.com/?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="Chudovo" src="https://opencollective-production.s3.us-west-1.amazonaws.com/326c19a0-2e87-11eb-a13a-c99a2a201d11.png" width="84" height="42"></a> +<a title="Entertainment" href="https://casinogap.org/uk/?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="UK Casino Gap" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/143f9301-beec-4118-89d5-9a07a01345f3/casinogap-uk.png" width="42" height="42"></a> +<a title="NZ Gaming Portal" href="https://casinodeps.co.nz?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="NZ Casino Deps" src="https://logo.clearbit.com/casinodeps.co.nz" width="42" height="42"></a> +<a title="NonStop Sites" href="https://uk.nonstopcasino.org/non-gamstop-casinos/?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="NonStopCasino.org" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/fd7ad905-8752-468f-ad20-582a24cca9d9/non-stop-casino.png" width="42" height="42"></a> +<a title="Siti Non AAMS" href="https://www.outlookindia.com/outlook-spotlight/migliori-siti-non-aams-siti-scommesse-senza-licenza-sicuri-news-294715?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="Migliori Siti Non AAMS" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/392810da-6cb6-4938-a3cb-38bd0e1eb7de/migliori-siti-non-aams.png" width="42" height="42"></a> +<a title="List of trusted non GamStop casino reviews" href="https://nongamstopcasinos.org?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="UK NonGamStopCasinos" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/cbda0ee1-26ea-4252-9580-f1f9b317b1f7/nongamstopcasinos-uk.png" width="42" height="42"></a> +<a title="Online TikTok Video Download Tool" href="https://snaptik.pro?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="SnapTik" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/546bcd53-6615-457d-ab21-1db1c52b3af5/logo.jpg" width="42" height="42"></a> +<a title="Proxidize is a mobile proxy creation and management platform that provides all needed components from hardware to cloud software and SIM cards." href="https://proxidize.com/?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="Proxidize" src="https://logo.clearbit.com/proxidize.com" width="42" height="42"></a> +<a title="IG Downloader is an Instagram Downloader service that offers a variety of tools to download Instagram content for free. Listed below are all the tools" href="https://indownloader.app/?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="IG Downloader" src="https://logo.clearbit.com/indownloader.app" width="42" height="42"></a> +<a title="Buy Instagram Likes - Real Likes & Instant Delivery!" href="https://blastup.com/buy-instagram-likes?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="Blastup" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/955a0beb-9fe8-4753-ad92-fae8ef5382fc/favicon--dark.jpg" width="42" height="42"></a> +<a title="We will boost your Social Media Likes, Followers , Comments & Views. 24/7 hour support. Privacy Assured." href="https://organicsocialboost.com/?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="Organic Social Boost" src="https://logo.clearbit.com/organicsocialboost.com" width="84" height="42"></a> +<a title="A self-hosted web radio management suite, including turnkey installer tools and an easy-to-use web app to manage your stations." href="https://azuracast.com/?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="AzuraCast" src="https://opencollective-production.s3.us-west-1.amazonaws.com/3c12ea10-cdfb-11eb-9cf4-3760b386b76d.png" width="42" height="42"></a> +<a title="Triplebyte is the first software engineering job platform that is on the developer's side. Take our coding quiz!" href="https://triplebyte.com/os/opencollective?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="Triplebyte" src="https://opencollective-production.s3.us-west-1.amazonaws.com/43e4f9d0-30cd-11ea-9c6b-e1142996e8b2.png" width="42" height="42"></a> +<a title="Connect your Collective to GitHub Sponsors: https://docs.opencollective.com/help/collectives/github-sponsors" href="https://github.com/sponsors/?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="GitHub Sponsors" src="https://opencollective-production.s3.us-west-1.amazonaws.com/87b1d240-f617-11ea-9960-fd7e8ab20fe4.png" width="48" height="42"></a> +<a title="Salesforce" href="https://engineering.salesforce.com?utm_source=opencollective&utm_medium=github&utm_campaign=Carbon" target="_blank"><img alt="Salesforce" src="https://opencollective-production.s3.us-west-1.amazonaws.com/24d34880-df8d-11e9-949c-6bc2037b6bd5.png" width="42" height="42"></a> +<!-- </open-collective-sponsors> --> + +[[Become a sponsor via OpenCollective](https://opencollective.com/Carbon#sponsor)] + +<a href="https://github.com/johnrsimeone" target="_blank"><img src="https://avatars.githubusercontent.com/u/22871068?s=70&v=4" width="64" height="64"></a> +<a href="https://github.com/taylorotwell" target="_blank"><img src="https://avatars.githubusercontent.com/u/463230?s=128&v=4" width="64" height="64"></a> +<a href="https://github.com/getsentry" target="_blank"><img src="https://avatars.githubusercontent.com/u/1396951?s=128&v=4" width="64" height="64"></a> +<a href="https://github.com/codecov" target="_blank"><img src="https://avatars.githubusercontent.com/u/8226205?s=128&v=4" width="64" height="64"></a> + +[[Become a sponsor via GitHub](https://github.com/sponsors/kylekatarnls)] + +### Backers + +Thank you to all our backers! 🙏 + +<a href="https://opencollective.com/Carbon#backers" target="_blank"><img src="https://opencollective.com/Carbon/backers.svg?width=890&version=2023-06-08-07-12"></a> + +[[Become a backer](https://opencollective.com/Carbon#backer)] + +## Carbon for enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of ``Carbon`` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-nesbot-carbon?utm_source=packagist-nesbot-carbon&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/vendor/nesbot/carbon/sponsors.php b/vendor/nesbot/carbon/sponsors.php new file mode 100644 index 00000000..67b21716 --- /dev/null +++ b/vendor/nesbot/carbon/sponsors.php @@ -0,0 +1,129 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Carbon\CarbonImmutable; + +require_once __DIR__.'/vendor/autoload.php'; + +function getMaxHistoryMonthsByAmount($amount): int +{ + if ($amount >= 50) { + return 6; + } + + if ($amount >= 20) { + return 4; + } + + return 2; +} + +function getHtmlAttribute($rawValue): string +{ + return str_replace( + ['​', "\r"], + '', + trim(htmlspecialchars((string) $rawValue), "  \n\r\t\v\0"), + ); +} + +function getOpenCollectiveSponsors(): string +{ + $customSponsorImages = [ + // For consistency and equity among sponsors, as of now, we kindly ask our sponsors + // to provide an image having a width/height ratio between 1/1 and 2/1. + // By default, we'll show the member picture from OpenCollective, and will resize it if bigger + // int(OpenCollective.MemberId) => ImageURL + ]; + + $members = json_decode(file_get_contents('https://opencollective.com/carbon/members/all.json'), true); + + $list = array_filter($members, static function ($member): bool { + return ($member['lastTransactionAmount'] > 3 || $member['isActive']) && + $member['role'] === 'BACKER' && + $member['type'] !== 'USER' && + ( + $member['totalAmountDonated'] > 100 || + $member['lastTransactionAt'] > CarbonImmutable::now() + ->subMonthsNoOverflow(getMaxHistoryMonthsByAmount($member['lastTransactionAmount'])) + ->format('Y-m-d h:i') || + $member['isActive'] && $member['lastTransactionAmount'] >= 30 + ); + }); + + $list = array_map(static function (array $member): array { + $createdAt = CarbonImmutable::parse($member['createdAt']); + $lastTransactionAt = CarbonImmutable::parse($member['lastTransactionAt']); + + if ($createdAt->format('d H:i:s.u') > $lastTransactionAt->format('d H:i:s.u')) { + $createdAt = $createdAt + ->setDay($lastTransactionAt->day) + ->modify($lastTransactionAt->format('H:i:s.u')); + } + + $monthlyContribution = (float) ($member['totalAmountDonated'] / ceil($createdAt->floatDiffInMonths())); + + if ( + $lastTransactionAt->isAfter('last month') && + $member['lastTransactionAmount'] > $monthlyContribution + ) { + $monthlyContribution = (float) $member['lastTransactionAmount']; + } + + $yearlyContribution = (float) ($member['totalAmountDonated'] / max(1, $createdAt->floatDiffInYears())); + $status = null; + + if ($monthlyContribution > 29) { + $status = 'sponsor'; + } elseif ($monthlyContribution > 4.5 || $yearlyContribution > 29) { + $status = 'backer'; + } elseif ($member['totalAmountDonated'] > 0) { + $status = 'helper'; + } + + return array_merge($member, [ + 'star' => ($monthlyContribution > 98 || $yearlyContribution > 500), + 'status' => $status, + 'monthlyContribution' => $monthlyContribution, + 'yearlyContribution' => $yearlyContribution, + ]); + }, $list); + + usort($list, static function (array $a, array $b): int { + return ($b['monthlyContribution'] <=> $a['monthlyContribution']) + ?: ($b['totalAmountDonated'] <=> $a['totalAmountDonated']); + }); + + return implode('', array_map(static function (array $member) use ($customSponsorImages): string { + $href = htmlspecialchars($member['website'] ?? $member['profile']); + $src = $customSponsorImages[$member['MemberId'] ?? ''] ?? $member['image'] ?? (strtr($member['profile'], ['https://opencollective.com/' => 'https://images.opencollective.com/']).'/avatar/256.png'); + [$x, $y] = @getimagesize($src) ?: [0, 0]; + $validImage = ($x && $y); + $src = $validImage ? htmlspecialchars($src) : 'https://opencollective.com/static/images/default-guest-logo.svg'; + $height = $member['status'] === 'sponsor' ? 64 : 42; + $width = min($height * 2, $validImage ? round($x * $height / $y) : $height); + $href .= (strpos($href, '?') === false ? '?' : '&').'utm_source=opencollective&utm_medium=github&utm_campaign=Carbon'; + $title = getHtmlAttribute(($member['description'] ?? null) ?: $member['name']); + $alt = getHtmlAttribute($member['name']); + + return "\n".'<a title="'.$title.'" href="'.$href.'" target="_blank">'. + '<img alt="'.$alt.'" src="'.$src.'" width="'.$width.'" height="'.$height.'">'. + '</a>'; + }, $list))."\n"; +} + +file_put_contents('readme.md', preg_replace_callback( + '/(<!-- <open-collective-sponsors> -->)[\s\S]+(<!-- <\/open-collective-sponsors> -->)/', + static function (array $match): string { + return $match[1].getOpenCollectiveSponsors().$match[2]; + }, + file_get_contents('readme.md') +)); diff --git a/vendor/nesbot/carbon/src/Carbon/AbstractTranslator.php b/vendor/nesbot/carbon/src/Carbon/AbstractTranslator.php new file mode 100644 index 00000000..8b8fe089 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/AbstractTranslator.php @@ -0,0 +1,398 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon; + +use Carbon\MessageFormatter\MessageFormatterMapper; +use Closure; +use ReflectionException; +use ReflectionFunction; +use Symfony\Component\Translation; +use Symfony\Component\Translation\Formatter\MessageFormatterInterface; +use Symfony\Component\Translation\Loader\ArrayLoader; + +abstract class AbstractTranslator extends Translation\Translator +{ + /** + * Translator singletons for each language. + * + * @var array + */ + protected static $singletons = []; + + /** + * List of custom localized messages. + * + * @var array + */ + protected $messages = []; + + /** + * List of custom directories that contain translation files. + * + * @var string[] + */ + protected $directories = []; + + /** + * Set to true while constructing. + * + * @var bool + */ + protected $initializing = false; + + /** + * List of locales aliases. + * + * @var array<string, string> + */ + protected $aliases = [ + 'me' => 'sr_Latn_ME', + 'scr' => 'sh', + ]; + + /** + * Return a singleton instance of Translator. + * + * @param string|null $locale optional initial locale ("en" - english by default) + * + * @return static + */ + public static function get($locale = null) + { + $locale = $locale ?: 'en'; + $key = static::class === Translator::class ? $locale : static::class.'|'.$locale; + + if (!isset(static::$singletons[$key])) { + static::$singletons[$key] = new static($locale); + } + + return static::$singletons[$key]; + } + + public function __construct($locale, MessageFormatterInterface $formatter = null, $cacheDir = null, $debug = false) + { + parent::setLocale($locale); + $this->initializing = true; + $this->directories = [__DIR__.'/Lang']; + $this->addLoader('array', new ArrayLoader()); + parent::__construct($locale, new MessageFormatterMapper($formatter), $cacheDir, $debug); + $this->initializing = false; + } + + /** + * Returns the list of directories translation files are searched in. + * + * @return array + */ + public function getDirectories(): array + { + return $this->directories; + } + + /** + * Set list of directories translation files are searched in. + * + * @param array $directories new directories list + * + * @return $this + */ + public function setDirectories(array $directories) + { + $this->directories = $directories; + + return $this; + } + + /** + * Add a directory to the list translation files are searched in. + * + * @param string $directory new directory + * + * @return $this + */ + public function addDirectory(string $directory) + { + $this->directories[] = $directory; + + return $this; + } + + /** + * Remove a directory from the list translation files are searched in. + * + * @param string $directory directory path + * + * @return $this + */ + public function removeDirectory(string $directory) + { + $search = rtrim(strtr($directory, '\\', '/'), '/'); + + return $this->setDirectories(array_filter($this->getDirectories(), function ($item) use ($search) { + return rtrim(strtr($item, '\\', '/'), '/') !== $search; + })); + } + + /** + * Reset messages of a locale (all locale if no locale passed). + * Remove custom messages and reload initial messages from matching + * file in Lang directory. + * + * @param string|null $locale + * + * @return bool + */ + public function resetMessages($locale = null) + { + if ($locale === null) { + $this->messages = []; + + return true; + } + + foreach ($this->getDirectories() as $directory) { + $data = @include sprintf('%s/%s.php', rtrim($directory, '\\/'), $locale); + + if ($data !== false) { + $this->messages[$locale] = $data; + $this->addResource('array', $this->messages[$locale], $locale); + + return true; + } + } + + return false; + } + + /** + * Returns the list of files matching a given locale prefix (or all if empty). + * + * @param string $prefix prefix required to filter result + * + * @return array + */ + public function getLocalesFiles($prefix = '') + { + $files = []; + + foreach ($this->getDirectories() as $directory) { + $directory = rtrim($directory, '\\/'); + + foreach (glob("$directory/$prefix*.php") as $file) { + $files[] = $file; + } + } + + return array_unique($files); + } + + /** + * Returns the list of internally available locales and already loaded custom locales. + * (It will ignore custom translator dynamic loading.) + * + * @param string $prefix prefix required to filter result + * + * @return array + */ + public function getAvailableLocales($prefix = '') + { + $locales = []; + foreach ($this->getLocalesFiles($prefix) as $file) { + $locales[] = substr($file, strrpos($file, '/') + 1, -4); + } + + return array_unique(array_merge($locales, array_keys($this->messages))); + } + + protected function translate(?string $id, array $parameters = [], ?string $domain = null, ?string $locale = null): string + { + if ($domain === null) { + $domain = 'messages'; + } + + $catalogue = $this->getCatalogue($locale); + $format = $this instanceof TranslatorStrongTypeInterface + ? $this->getFromCatalogue($catalogue, (string) $id, $domain) + : $this->getCatalogue($locale)->get((string) $id, $domain); // @codeCoverageIgnore + + if ($format instanceof Closure) { + // @codeCoverageIgnoreStart + try { + $count = (new ReflectionFunction($format))->getNumberOfRequiredParameters(); + } catch (ReflectionException $exception) { + $count = 0; + } + // @codeCoverageIgnoreEnd + + return $format( + ...array_values($parameters), + ...array_fill(0, max(0, $count - \count($parameters)), null) + ); + } + + return parent::trans($id, $parameters, $domain, $locale); + } + + /** + * Init messages language from matching file in Lang directory. + * + * @param string $locale + * + * @return bool + */ + protected function loadMessagesFromFile($locale) + { + return isset($this->messages[$locale]) || $this->resetMessages($locale); + } + + /** + * Set messages of a locale and take file first if present. + * + * @param string $locale + * @param array $messages + * + * @return $this + */ + public function setMessages($locale, $messages) + { + $this->loadMessagesFromFile($locale); + $this->addResource('array', $messages, $locale); + $this->messages[$locale] = array_merge( + $this->messages[$locale] ?? [], + $messages + ); + + return $this; + } + + /** + * Set messages of the current locale and take file first if present. + * + * @param array $messages + * + * @return $this + */ + public function setTranslations($messages) + { + return $this->setMessages($this->getLocale(), $messages); + } + + /** + * Get messages of a locale, if none given, return all the + * languages. + * + * @param string|null $locale + * + * @return array + */ + public function getMessages($locale = null) + { + return $locale === null ? $this->messages : $this->messages[$locale]; + } + + /** + * Set the current translator locale and indicate if the source locale file exists + * + * @param string $locale locale ex. en + * + * @return bool + */ + public function setLocale($locale) + { + $locale = preg_replace_callback('/[-_]([a-z]{2,}|\d{2,})/', function ($matches) { + // _2-letters or YUE is a region, _3+-letters is a variant + $upper = strtoupper($matches[1]); + + if ($upper === 'YUE' || $upper === 'ISO' || \strlen($upper) < 3) { + return "_$upper"; + } + + return '_'.ucfirst($matches[1]); + }, strtolower($locale)); + + $previousLocale = $this->getLocale(); + + if ($previousLocale === $locale && isset($this->messages[$locale])) { + return true; + } + + unset(static::$singletons[$previousLocale]); + + if ($locale === 'auto') { + $completeLocale = setlocale(LC_TIME, '0'); + $locale = preg_replace('/^([^_.-]+).*$/', '$1', $completeLocale); + $locales = $this->getAvailableLocales($locale); + + $completeLocaleChunks = preg_split('/[_.-]+/', $completeLocale); + + $getScore = function ($language) use ($completeLocaleChunks) { + return self::compareChunkLists($completeLocaleChunks, preg_split('/[_.-]+/', $language)); + }; + + usort($locales, function ($first, $second) use ($getScore) { + return $getScore($second) <=> $getScore($first); + }); + + $locale = $locales[0]; + } + + if (isset($this->aliases[$locale])) { + $locale = $this->aliases[$locale]; + } + + // If subtag (ex: en_CA) first load the macro (ex: en) to have a fallback + if (str_contains($locale, '_') && + $this->loadMessagesFromFile($macroLocale = preg_replace('/^([^_]+).*$/', '$1', $locale)) + ) { + parent::setLocale($macroLocale); + } + + if (!$this->loadMessagesFromFile($locale) && !$this->initializing) { + return false; + } + + parent::setLocale($locale); + + return true; + } + + /** + * Show locale on var_dump(). + * + * @return array + */ + public function __debugInfo() + { + return [ + 'locale' => $this->getLocale(), + ]; + } + + private static function compareChunkLists($referenceChunks, $chunks) + { + $score = 0; + + foreach ($referenceChunks as $index => $chunk) { + if (!isset($chunks[$index])) { + $score++; + + continue; + } + + if (strtolower($chunks[$index]) === strtolower($chunk)) { + $score += 10; + } + } + + return $score; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Carbon.php b/vendor/nesbot/carbon/src/Carbon/Carbon.php new file mode 100644 index 00000000..e32569ae --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Carbon.php @@ -0,0 +1,523 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon; + +use Carbon\Traits\Date; +use Carbon\Traits\DeprecatedProperties; +use DateTime; +use DateTimeInterface; +use DateTimeZone; + +/** + * A simple API extension for DateTime. + * + * @mixin DeprecatedProperties + * + * <autodoc generated by `composer phpdoc`> + * + * @property int $year + * @property int $yearIso + * @property int $month + * @property int $day + * @property int $hour + * @property int $minute + * @property int $second + * @property int $micro + * @property int $microsecond + * @property int|float|string $timestamp seconds since the Unix Epoch + * @property string $englishDayOfWeek the day of week in English + * @property string $shortEnglishDayOfWeek the abbreviated day of week in English + * @property string $englishMonth the month in English + * @property string $shortEnglishMonth the abbreviated month in English + * @property int $milliseconds + * @property int $millisecond + * @property int $milli + * @property int $week 1 through 53 + * @property int $isoWeek 1 through 53 + * @property int $weekYear year according to week format + * @property int $isoWeekYear year according to ISO week format + * @property int $dayOfYear 1 through 366 + * @property int $age does a diffInYears() with default parameters + * @property int $offset the timezone offset in seconds from UTC + * @property int $offsetMinutes the timezone offset in minutes from UTC + * @property int $offsetHours the timezone offset in hours from UTC + * @property CarbonTimeZone $timezone the current timezone + * @property CarbonTimeZone $tz alias of $timezone + * @property-read int $dayOfWeek 0 (for Sunday) through 6 (for Saturday) + * @property-read int $dayOfWeekIso 1 (for Monday) through 7 (for Sunday) + * @property-read int $weekOfYear ISO-8601 week number of year, weeks starting on Monday + * @property-read int $daysInMonth number of days in the given month + * @property-read string $latinMeridiem "am"/"pm" (Ante meridiem or Post meridiem latin lowercase mark) + * @property-read string $latinUpperMeridiem "AM"/"PM" (Ante meridiem or Post meridiem latin uppercase mark) + * @property-read string $timezoneAbbreviatedName the current timezone abbreviated name + * @property-read string $tzAbbrName alias of $timezoneAbbreviatedName + * @property-read string $dayName long name of weekday translated according to Carbon locale, in english if no translation available for current language + * @property-read string $shortDayName short name of weekday translated according to Carbon locale, in english if no translation available for current language + * @property-read string $minDayName very short name of weekday translated according to Carbon locale, in english if no translation available for current language + * @property-read string $monthName long name of month translated according to Carbon locale, in english if no translation available for current language + * @property-read string $shortMonthName short name of month translated according to Carbon locale, in english if no translation available for current language + * @property-read string $meridiem lowercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language + * @property-read string $upperMeridiem uppercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language + * @property-read int $noZeroHour current hour from 1 to 24 + * @property-read int $weeksInYear 51 through 53 + * @property-read int $isoWeeksInYear 51 through 53 + * @property-read int $weekOfMonth 1 through 5 + * @property-read int $weekNumberInMonth 1 through 5 + * @property-read int $firstWeekDay 0 through 6 + * @property-read int $lastWeekDay 0 through 6 + * @property-read int $daysInYear 365 or 366 + * @property-read int $quarter the quarter of this instance, 1 - 4 + * @property-read int $decade the decade of this instance + * @property-read int $century the century of this instance + * @property-read int $millennium the millennium of this instance + * @property-read bool $dst daylight savings time indicator, true if DST, false otherwise + * @property-read bool $local checks if the timezone is local, true if local, false otherwise + * @property-read bool $utc checks if the timezone is UTC, true if UTC, false otherwise + * @property-read string $timezoneName the current timezone name + * @property-read string $tzName alias of $timezoneName + * @property-read string $locale locale of the current instance + * + * @method bool isUtc() Check if the current instance has UTC timezone. (Both isUtc and isUTC cases are valid.) + * @method bool isLocal() Check if the current instance has non-UTC timezone. + * @method bool isValid() Check if the current instance is a valid date. + * @method bool isDST() Check if the current instance is in a daylight saving time. + * @method bool isSunday() Checks if the instance day is sunday. + * @method bool isMonday() Checks if the instance day is monday. + * @method bool isTuesday() Checks if the instance day is tuesday. + * @method bool isWednesday() Checks if the instance day is wednesday. + * @method bool isThursday() Checks if the instance day is thursday. + * @method bool isFriday() Checks if the instance day is friday. + * @method bool isSaturday() Checks if the instance day is saturday. + * @method bool isSameYear(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same year as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentYear() Checks if the instance is in the same year as the current moment. + * @method bool isNextYear() Checks if the instance is in the same year as the current moment next year. + * @method bool isLastYear() Checks if the instance is in the same year as the current moment last year. + * @method bool isSameWeek(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same week as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentWeek() Checks if the instance is in the same week as the current moment. + * @method bool isNextWeek() Checks if the instance is in the same week as the current moment next week. + * @method bool isLastWeek() Checks if the instance is in the same week as the current moment last week. + * @method bool isSameDay(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same day as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentDay() Checks if the instance is in the same day as the current moment. + * @method bool isNextDay() Checks if the instance is in the same day as the current moment next day. + * @method bool isLastDay() Checks if the instance is in the same day as the current moment last day. + * @method bool isSameHour(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same hour as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentHour() Checks if the instance is in the same hour as the current moment. + * @method bool isNextHour() Checks if the instance is in the same hour as the current moment next hour. + * @method bool isLastHour() Checks if the instance is in the same hour as the current moment last hour. + * @method bool isSameMinute(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same minute as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMinute() Checks if the instance is in the same minute as the current moment. + * @method bool isNextMinute() Checks if the instance is in the same minute as the current moment next minute. + * @method bool isLastMinute() Checks if the instance is in the same minute as the current moment last minute. + * @method bool isSameSecond(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same second as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentSecond() Checks if the instance is in the same second as the current moment. + * @method bool isNextSecond() Checks if the instance is in the same second as the current moment next second. + * @method bool isLastSecond() Checks if the instance is in the same second as the current moment last second. + * @method bool isSameMicro(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMicro() Checks if the instance is in the same microsecond as the current moment. + * @method bool isNextMicro() Checks if the instance is in the same microsecond as the current moment next microsecond. + * @method bool isLastMicro() Checks if the instance is in the same microsecond as the current moment last microsecond. + * @method bool isSameMicrosecond(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMicrosecond() Checks if the instance is in the same microsecond as the current moment. + * @method bool isNextMicrosecond() Checks if the instance is in the same microsecond as the current moment next microsecond. + * @method bool isLastMicrosecond() Checks if the instance is in the same microsecond as the current moment last microsecond. + * @method bool isCurrentMonth() Checks if the instance is in the same month as the current moment. + * @method bool isNextMonth() Checks if the instance is in the same month as the current moment next month. + * @method bool isLastMonth() Checks if the instance is in the same month as the current moment last month. + * @method bool isCurrentQuarter() Checks if the instance is in the same quarter as the current moment. + * @method bool isNextQuarter() Checks if the instance is in the same quarter as the current moment next quarter. + * @method bool isLastQuarter() Checks if the instance is in the same quarter as the current moment last quarter. + * @method bool isSameDecade(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same decade as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentDecade() Checks if the instance is in the same decade as the current moment. + * @method bool isNextDecade() Checks if the instance is in the same decade as the current moment next decade. + * @method bool isLastDecade() Checks if the instance is in the same decade as the current moment last decade. + * @method bool isSameCentury(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same century as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentCentury() Checks if the instance is in the same century as the current moment. + * @method bool isNextCentury() Checks if the instance is in the same century as the current moment next century. + * @method bool isLastCentury() Checks if the instance is in the same century as the current moment last century. + * @method bool isSameMillennium(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same millennium as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMillennium() Checks if the instance is in the same millennium as the current moment. + * @method bool isNextMillennium() Checks if the instance is in the same millennium as the current moment next millennium. + * @method bool isLastMillennium() Checks if the instance is in the same millennium as the current moment last millennium. + * @method $this years(int $value) Set current instance year to the given value. + * @method $this year(int $value) Set current instance year to the given value. + * @method $this setYears(int $value) Set current instance year to the given value. + * @method $this setYear(int $value) Set current instance year to the given value. + * @method $this months(int $value) Set current instance month to the given value. + * @method $this month(int $value) Set current instance month to the given value. + * @method $this setMonths(int $value) Set current instance month to the given value. + * @method $this setMonth(int $value) Set current instance month to the given value. + * @method $this days(int $value) Set current instance day to the given value. + * @method $this day(int $value) Set current instance day to the given value. + * @method $this setDays(int $value) Set current instance day to the given value. + * @method $this setDay(int $value) Set current instance day to the given value. + * @method $this hours(int $value) Set current instance hour to the given value. + * @method $this hour(int $value) Set current instance hour to the given value. + * @method $this setHours(int $value) Set current instance hour to the given value. + * @method $this setHour(int $value) Set current instance hour to the given value. + * @method $this minutes(int $value) Set current instance minute to the given value. + * @method $this minute(int $value) Set current instance minute to the given value. + * @method $this setMinutes(int $value) Set current instance minute to the given value. + * @method $this setMinute(int $value) Set current instance minute to the given value. + * @method $this seconds(int $value) Set current instance second to the given value. + * @method $this second(int $value) Set current instance second to the given value. + * @method $this setSeconds(int $value) Set current instance second to the given value. + * @method $this setSecond(int $value) Set current instance second to the given value. + * @method $this millis(int $value) Set current instance millisecond to the given value. + * @method $this milli(int $value) Set current instance millisecond to the given value. + * @method $this setMillis(int $value) Set current instance millisecond to the given value. + * @method $this setMilli(int $value) Set current instance millisecond to the given value. + * @method $this milliseconds(int $value) Set current instance millisecond to the given value. + * @method $this millisecond(int $value) Set current instance millisecond to the given value. + * @method $this setMilliseconds(int $value) Set current instance millisecond to the given value. + * @method $this setMillisecond(int $value) Set current instance millisecond to the given value. + * @method $this micros(int $value) Set current instance microsecond to the given value. + * @method $this micro(int $value) Set current instance microsecond to the given value. + * @method $this setMicros(int $value) Set current instance microsecond to the given value. + * @method $this setMicro(int $value) Set current instance microsecond to the given value. + * @method $this microseconds(int $value) Set current instance microsecond to the given value. + * @method $this microsecond(int $value) Set current instance microsecond to the given value. + * @method $this setMicroseconds(int $value) Set current instance microsecond to the given value. + * @method $this setMicrosecond(int $value) Set current instance microsecond to the given value. + * @method $this addYears(int $value = 1) Add years (the $value count passed in) to the instance (using date interval). + * @method $this addYear() Add one year to the instance (using date interval). + * @method $this subYears(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval). + * @method $this subYear() Sub one year to the instance (using date interval). + * @method $this addYearsWithOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method $this addYearWithOverflow() Add one year to the instance (using date interval) with overflow explicitly allowed. + * @method $this subYearsWithOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method $this subYearWithOverflow() Sub one year to the instance (using date interval) with overflow explicitly allowed. + * @method $this addYearsWithoutOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addYearWithoutOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subYearsWithoutOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subYearWithoutOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addYearsWithNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addYearWithNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subYearsWithNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subYearWithNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addYearsNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addYearNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subYearsNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subYearNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addMonths(int $value = 1) Add months (the $value count passed in) to the instance (using date interval). + * @method $this addMonth() Add one month to the instance (using date interval). + * @method $this subMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval). + * @method $this subMonth() Sub one month to the instance (using date interval). + * @method $this addMonthsWithOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method $this addMonthWithOverflow() Add one month to the instance (using date interval) with overflow explicitly allowed. + * @method $this subMonthsWithOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method $this subMonthWithOverflow() Sub one month to the instance (using date interval) with overflow explicitly allowed. + * @method $this addMonthsWithoutOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addMonthWithoutOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subMonthsWithoutOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subMonthWithoutOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addMonthsWithNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addMonthWithNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subMonthsWithNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subMonthWithNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addMonthsNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addMonthNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subMonthsNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subMonthNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addDays(int $value = 1) Add days (the $value count passed in) to the instance (using date interval). + * @method $this addDay() Add one day to the instance (using date interval). + * @method $this subDays(int $value = 1) Sub days (the $value count passed in) to the instance (using date interval). + * @method $this subDay() Sub one day to the instance (using date interval). + * @method $this addHours(int $value = 1) Add hours (the $value count passed in) to the instance (using date interval). + * @method $this addHour() Add one hour to the instance (using date interval). + * @method $this subHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using date interval). + * @method $this subHour() Sub one hour to the instance (using date interval). + * @method $this addMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using date interval). + * @method $this addMinute() Add one minute to the instance (using date interval). + * @method $this subMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using date interval). + * @method $this subMinute() Sub one minute to the instance (using date interval). + * @method $this addSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using date interval). + * @method $this addSecond() Add one second to the instance (using date interval). + * @method $this subSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using date interval). + * @method $this subSecond() Sub one second to the instance (using date interval). + * @method $this addMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). + * @method $this addMilli() Add one millisecond to the instance (using date interval). + * @method $this subMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). + * @method $this subMilli() Sub one millisecond to the instance (using date interval). + * @method $this addMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). + * @method $this addMillisecond() Add one millisecond to the instance (using date interval). + * @method $this subMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). + * @method $this subMillisecond() Sub one millisecond to the instance (using date interval). + * @method $this addMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). + * @method $this addMicro() Add one microsecond to the instance (using date interval). + * @method $this subMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). + * @method $this subMicro() Sub one microsecond to the instance (using date interval). + * @method $this addMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). + * @method $this addMicrosecond() Add one microsecond to the instance (using date interval). + * @method $this subMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). + * @method $this subMicrosecond() Sub one microsecond to the instance (using date interval). + * @method $this addMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval). + * @method $this addMillennium() Add one millennium to the instance (using date interval). + * @method $this subMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval). + * @method $this subMillennium() Sub one millennium to the instance (using date interval). + * @method $this addMillenniaWithOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method $this addMillenniumWithOverflow() Add one millennium to the instance (using date interval) with overflow explicitly allowed. + * @method $this subMillenniaWithOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method $this subMillenniumWithOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly allowed. + * @method $this addMillenniaWithoutOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addMillenniumWithoutOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subMillenniaWithoutOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subMillenniumWithoutOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addMillenniaWithNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addMillenniumWithNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subMillenniaWithNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subMillenniumWithNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addMillenniaNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addMillenniumNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subMillenniaNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subMillenniumNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval). + * @method $this addCentury() Add one century to the instance (using date interval). + * @method $this subCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval). + * @method $this subCentury() Sub one century to the instance (using date interval). + * @method $this addCenturiesWithOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method $this addCenturyWithOverflow() Add one century to the instance (using date interval) with overflow explicitly allowed. + * @method $this subCenturiesWithOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method $this subCenturyWithOverflow() Sub one century to the instance (using date interval) with overflow explicitly allowed. + * @method $this addCenturiesWithoutOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addCenturyWithoutOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subCenturiesWithoutOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subCenturyWithoutOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addCenturiesWithNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addCenturyWithNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subCenturiesWithNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subCenturyWithNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addCenturiesNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addCenturyNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subCenturiesNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subCenturyNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval). + * @method $this addDecade() Add one decade to the instance (using date interval). + * @method $this subDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval). + * @method $this subDecade() Sub one decade to the instance (using date interval). + * @method $this addDecadesWithOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method $this addDecadeWithOverflow() Add one decade to the instance (using date interval) with overflow explicitly allowed. + * @method $this subDecadesWithOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method $this subDecadeWithOverflow() Sub one decade to the instance (using date interval) with overflow explicitly allowed. + * @method $this addDecadesWithoutOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addDecadeWithoutOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subDecadesWithoutOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subDecadeWithoutOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addDecadesWithNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addDecadeWithNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subDecadesWithNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subDecadeWithNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addDecadesNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addDecadeNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subDecadesNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subDecadeNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval). + * @method $this addQuarter() Add one quarter to the instance (using date interval). + * @method $this subQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval). + * @method $this subQuarter() Sub one quarter to the instance (using date interval). + * @method $this addQuartersWithOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method $this addQuarterWithOverflow() Add one quarter to the instance (using date interval) with overflow explicitly allowed. + * @method $this subQuartersWithOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method $this subQuarterWithOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly allowed. + * @method $this addQuartersWithoutOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addQuarterWithoutOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subQuartersWithoutOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subQuarterWithoutOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addQuartersWithNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addQuarterWithNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subQuartersWithNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subQuarterWithNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addQuartersNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addQuarterNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subQuartersNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subQuarterNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using date interval). + * @method $this addWeek() Add one week to the instance (using date interval). + * @method $this subWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using date interval). + * @method $this subWeek() Sub one week to the instance (using date interval). + * @method $this addWeekdays(int $value = 1) Add weekdays (the $value count passed in) to the instance (using date interval). + * @method $this addWeekday() Add one weekday to the instance (using date interval). + * @method $this subWeekdays(int $value = 1) Sub weekdays (the $value count passed in) to the instance (using date interval). + * @method $this subWeekday() Sub one weekday to the instance (using date interval). + * @method $this addRealMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). + * @method $this addRealMicro() Add one microsecond to the instance (using timestamp). + * @method $this subRealMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). + * @method $this subRealMicro() Sub one microsecond to the instance (using timestamp). + * @method CarbonPeriod microsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given. + * @method $this addRealMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). + * @method $this addRealMicrosecond() Add one microsecond to the instance (using timestamp). + * @method $this subRealMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). + * @method $this subRealMicrosecond() Sub one microsecond to the instance (using timestamp). + * @method CarbonPeriod microsecondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given. + * @method $this addRealMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). + * @method $this addRealMilli() Add one millisecond to the instance (using timestamp). + * @method $this subRealMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). + * @method $this subRealMilli() Sub one millisecond to the instance (using timestamp). + * @method CarbonPeriod millisUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given. + * @method $this addRealMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). + * @method $this addRealMillisecond() Add one millisecond to the instance (using timestamp). + * @method $this subRealMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). + * @method $this subRealMillisecond() Sub one millisecond to the instance (using timestamp). + * @method CarbonPeriod millisecondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given. + * @method $this addRealSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using timestamp). + * @method $this addRealSecond() Add one second to the instance (using timestamp). + * @method $this subRealSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using timestamp). + * @method $this subRealSecond() Sub one second to the instance (using timestamp). + * @method CarbonPeriod secondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each second or every X seconds if a factor is given. + * @method $this addRealMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using timestamp). + * @method $this addRealMinute() Add one minute to the instance (using timestamp). + * @method $this subRealMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using timestamp). + * @method $this subRealMinute() Sub one minute to the instance (using timestamp). + * @method CarbonPeriod minutesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each minute or every X minutes if a factor is given. + * @method $this addRealHours(int $value = 1) Add hours (the $value count passed in) to the instance (using timestamp). + * @method $this addRealHour() Add one hour to the instance (using timestamp). + * @method $this subRealHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using timestamp). + * @method $this subRealHour() Sub one hour to the instance (using timestamp). + * @method CarbonPeriod hoursUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each hour or every X hours if a factor is given. + * @method $this addRealDays(int $value = 1) Add days (the $value count passed in) to the instance (using timestamp). + * @method $this addRealDay() Add one day to the instance (using timestamp). + * @method $this subRealDays(int $value = 1) Sub days (the $value count passed in) to the instance (using timestamp). + * @method $this subRealDay() Sub one day to the instance (using timestamp). + * @method CarbonPeriod daysUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each day or every X days if a factor is given. + * @method $this addRealWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using timestamp). + * @method $this addRealWeek() Add one week to the instance (using timestamp). + * @method $this subRealWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using timestamp). + * @method $this subRealWeek() Sub one week to the instance (using timestamp). + * @method CarbonPeriod weeksUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each week or every X weeks if a factor is given. + * @method $this addRealMonths(int $value = 1) Add months (the $value count passed in) to the instance (using timestamp). + * @method $this addRealMonth() Add one month to the instance (using timestamp). + * @method $this subRealMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using timestamp). + * @method $this subRealMonth() Sub one month to the instance (using timestamp). + * @method CarbonPeriod monthsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each month or every X months if a factor is given. + * @method $this addRealQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using timestamp). + * @method $this addRealQuarter() Add one quarter to the instance (using timestamp). + * @method $this subRealQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using timestamp). + * @method $this subRealQuarter() Sub one quarter to the instance (using timestamp). + * @method CarbonPeriod quartersUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each quarter or every X quarters if a factor is given. + * @method $this addRealYears(int $value = 1) Add years (the $value count passed in) to the instance (using timestamp). + * @method $this addRealYear() Add one year to the instance (using timestamp). + * @method $this subRealYears(int $value = 1) Sub years (the $value count passed in) to the instance (using timestamp). + * @method $this subRealYear() Sub one year to the instance (using timestamp). + * @method CarbonPeriod yearsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each year or every X years if a factor is given. + * @method $this addRealDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using timestamp). + * @method $this addRealDecade() Add one decade to the instance (using timestamp). + * @method $this subRealDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using timestamp). + * @method $this subRealDecade() Sub one decade to the instance (using timestamp). + * @method CarbonPeriod decadesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each decade or every X decades if a factor is given. + * @method $this addRealCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using timestamp). + * @method $this addRealCentury() Add one century to the instance (using timestamp). + * @method $this subRealCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using timestamp). + * @method $this subRealCentury() Sub one century to the instance (using timestamp). + * @method CarbonPeriod centuriesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each century or every X centuries if a factor is given. + * @method $this addRealMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using timestamp). + * @method $this addRealMillennium() Add one millennium to the instance (using timestamp). + * @method $this subRealMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using timestamp). + * @method $this subRealMillennium() Sub one millennium to the instance (using timestamp). + * @method CarbonPeriod millenniaUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millennium or every X millennia if a factor is given. + * @method $this roundYear(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. + * @method $this roundYears(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. + * @method $this floorYear(float $precision = 1) Truncate the current instance year with given precision. + * @method $this floorYears(float $precision = 1) Truncate the current instance year with given precision. + * @method $this ceilYear(float $precision = 1) Ceil the current instance year with given precision. + * @method $this ceilYears(float $precision = 1) Ceil the current instance year with given precision. + * @method $this roundMonth(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. + * @method $this roundMonths(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. + * @method $this floorMonth(float $precision = 1) Truncate the current instance month with given precision. + * @method $this floorMonths(float $precision = 1) Truncate the current instance month with given precision. + * @method $this ceilMonth(float $precision = 1) Ceil the current instance month with given precision. + * @method $this ceilMonths(float $precision = 1) Ceil the current instance month with given precision. + * @method $this roundDay(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method $this roundDays(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method $this floorDay(float $precision = 1) Truncate the current instance day with given precision. + * @method $this floorDays(float $precision = 1) Truncate the current instance day with given precision. + * @method $this ceilDay(float $precision = 1) Ceil the current instance day with given precision. + * @method $this ceilDays(float $precision = 1) Ceil the current instance day with given precision. + * @method $this roundHour(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. + * @method $this roundHours(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. + * @method $this floorHour(float $precision = 1) Truncate the current instance hour with given precision. + * @method $this floorHours(float $precision = 1) Truncate the current instance hour with given precision. + * @method $this ceilHour(float $precision = 1) Ceil the current instance hour with given precision. + * @method $this ceilHours(float $precision = 1) Ceil the current instance hour with given precision. + * @method $this roundMinute(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. + * @method $this roundMinutes(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. + * @method $this floorMinute(float $precision = 1) Truncate the current instance minute with given precision. + * @method $this floorMinutes(float $precision = 1) Truncate the current instance minute with given precision. + * @method $this ceilMinute(float $precision = 1) Ceil the current instance minute with given precision. + * @method $this ceilMinutes(float $precision = 1) Ceil the current instance minute with given precision. + * @method $this roundSecond(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. + * @method $this roundSeconds(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. + * @method $this floorSecond(float $precision = 1) Truncate the current instance second with given precision. + * @method $this floorSeconds(float $precision = 1) Truncate the current instance second with given precision. + * @method $this ceilSecond(float $precision = 1) Ceil the current instance second with given precision. + * @method $this ceilSeconds(float $precision = 1) Ceil the current instance second with given precision. + * @method $this roundMillennium(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. + * @method $this roundMillennia(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. + * @method $this floorMillennium(float $precision = 1) Truncate the current instance millennium with given precision. + * @method $this floorMillennia(float $precision = 1) Truncate the current instance millennium with given precision. + * @method $this ceilMillennium(float $precision = 1) Ceil the current instance millennium with given precision. + * @method $this ceilMillennia(float $precision = 1) Ceil the current instance millennium with given precision. + * @method $this roundCentury(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. + * @method $this roundCenturies(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. + * @method $this floorCentury(float $precision = 1) Truncate the current instance century with given precision. + * @method $this floorCenturies(float $precision = 1) Truncate the current instance century with given precision. + * @method $this ceilCentury(float $precision = 1) Ceil the current instance century with given precision. + * @method $this ceilCenturies(float $precision = 1) Ceil the current instance century with given precision. + * @method $this roundDecade(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. + * @method $this roundDecades(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. + * @method $this floorDecade(float $precision = 1) Truncate the current instance decade with given precision. + * @method $this floorDecades(float $precision = 1) Truncate the current instance decade with given precision. + * @method $this ceilDecade(float $precision = 1) Ceil the current instance decade with given precision. + * @method $this ceilDecades(float $precision = 1) Ceil the current instance decade with given precision. + * @method $this roundQuarter(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. + * @method $this roundQuarters(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. + * @method $this floorQuarter(float $precision = 1) Truncate the current instance quarter with given precision. + * @method $this floorQuarters(float $precision = 1) Truncate the current instance quarter with given precision. + * @method $this ceilQuarter(float $precision = 1) Ceil the current instance quarter with given precision. + * @method $this ceilQuarters(float $precision = 1) Ceil the current instance quarter with given precision. + * @method $this roundMillisecond(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. + * @method $this roundMilliseconds(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. + * @method $this floorMillisecond(float $precision = 1) Truncate the current instance millisecond with given precision. + * @method $this floorMilliseconds(float $precision = 1) Truncate the current instance millisecond with given precision. + * @method $this ceilMillisecond(float $precision = 1) Ceil the current instance millisecond with given precision. + * @method $this ceilMilliseconds(float $precision = 1) Ceil the current instance millisecond with given precision. + * @method $this roundMicrosecond(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. + * @method $this roundMicroseconds(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. + * @method $this floorMicrosecond(float $precision = 1) Truncate the current instance microsecond with given precision. + * @method $this floorMicroseconds(float $precision = 1) Truncate the current instance microsecond with given precision. + * @method $this ceilMicrosecond(float $precision = 1) Ceil the current instance microsecond with given precision. + * @method $this ceilMicroseconds(float $precision = 1) Ceil the current instance microsecond with given precision. + * @method string shortAbsoluteDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'Absolute' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longAbsoluteDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'Absolute' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string shortRelativeDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'Relative' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longRelativeDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'Relative' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string shortRelativeToNowDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longRelativeToNowDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string shortRelativeToOtherDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longRelativeToOtherDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method static static|false createFromFormat(string $format, string $time, DateTimeZone|string|false|null $timezone = null) Parse a string into a new Carbon object according to the specified format. + * @method static static __set_state(array $array) https://php.net/manual/en/datetime.set-state.php + * + * </autodoc> + */ +class Carbon extends DateTime implements CarbonInterface +{ + use Date; + + /** + * Returns true if the current class/instance is mutable. + * + * @return bool + */ + public static function isMutable() + { + return true; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/CarbonConverterInterface.php b/vendor/nesbot/carbon/src/Carbon/CarbonConverterInterface.php new file mode 100644 index 00000000..1ce967b2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/CarbonConverterInterface.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon; + +use DateTimeInterface; + +interface CarbonConverterInterface +{ + public function convertDate(DateTimeInterface $dateTime, bool $negated = false): CarbonInterface; +} diff --git a/vendor/nesbot/carbon/src/Carbon/CarbonImmutable.php b/vendor/nesbot/carbon/src/Carbon/CarbonImmutable.php new file mode 100644 index 00000000..4c9c1cfe --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/CarbonImmutable.php @@ -0,0 +1,582 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon; + +use Carbon\Traits\Date; +use Carbon\Traits\DeprecatedProperties; +use DateTimeImmutable; +use DateTimeInterface; +use DateTimeZone; + +/** + * A simple API extension for DateTimeImmutable. + * + * @mixin DeprecatedProperties + * + * <autodoc generated by `composer phpdoc`> + * + * @property int $year + * @property int $yearIso + * @property int $month + * @property int $day + * @property int $hour + * @property int $minute + * @property int $second + * @property int $micro + * @property int $microsecond + * @property int|float|string $timestamp seconds since the Unix Epoch + * @property string $englishDayOfWeek the day of week in English + * @property string $shortEnglishDayOfWeek the abbreviated day of week in English + * @property string $englishMonth the month in English + * @property string $shortEnglishMonth the abbreviated month in English + * @property int $milliseconds + * @property int $millisecond + * @property int $milli + * @property int $week 1 through 53 + * @property int $isoWeek 1 through 53 + * @property int $weekYear year according to week format + * @property int $isoWeekYear year according to ISO week format + * @property int $dayOfYear 1 through 366 + * @property int $age does a diffInYears() with default parameters + * @property int $offset the timezone offset in seconds from UTC + * @property int $offsetMinutes the timezone offset in minutes from UTC + * @property int $offsetHours the timezone offset in hours from UTC + * @property CarbonTimeZone $timezone the current timezone + * @property CarbonTimeZone $tz alias of $timezone + * @property-read int $dayOfWeek 0 (for Sunday) through 6 (for Saturday) + * @property-read int $dayOfWeekIso 1 (for Monday) through 7 (for Sunday) + * @property-read int $weekOfYear ISO-8601 week number of year, weeks starting on Monday + * @property-read int $daysInMonth number of days in the given month + * @property-read string $latinMeridiem "am"/"pm" (Ante meridiem or Post meridiem latin lowercase mark) + * @property-read string $latinUpperMeridiem "AM"/"PM" (Ante meridiem or Post meridiem latin uppercase mark) + * @property-read string $timezoneAbbreviatedName the current timezone abbreviated name + * @property-read string $tzAbbrName alias of $timezoneAbbreviatedName + * @property-read string $dayName long name of weekday translated according to Carbon locale, in english if no translation available for current language + * @property-read string $shortDayName short name of weekday translated according to Carbon locale, in english if no translation available for current language + * @property-read string $minDayName very short name of weekday translated according to Carbon locale, in english if no translation available for current language + * @property-read string $monthName long name of month translated according to Carbon locale, in english if no translation available for current language + * @property-read string $shortMonthName short name of month translated according to Carbon locale, in english if no translation available for current language + * @property-read string $meridiem lowercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language + * @property-read string $upperMeridiem uppercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language + * @property-read int $noZeroHour current hour from 1 to 24 + * @property-read int $weeksInYear 51 through 53 + * @property-read int $isoWeeksInYear 51 through 53 + * @property-read int $weekOfMonth 1 through 5 + * @property-read int $weekNumberInMonth 1 through 5 + * @property-read int $firstWeekDay 0 through 6 + * @property-read int $lastWeekDay 0 through 6 + * @property-read int $daysInYear 365 or 366 + * @property-read int $quarter the quarter of this instance, 1 - 4 + * @property-read int $decade the decade of this instance + * @property-read int $century the century of this instance + * @property-read int $millennium the millennium of this instance + * @property-read bool $dst daylight savings time indicator, true if DST, false otherwise + * @property-read bool $local checks if the timezone is local, true if local, false otherwise + * @property-read bool $utc checks if the timezone is UTC, true if UTC, false otherwise + * @property-read string $timezoneName the current timezone name + * @property-read string $tzName alias of $timezoneName + * @property-read string $locale locale of the current instance + * + * @method bool isUtc() Check if the current instance has UTC timezone. (Both isUtc and isUTC cases are valid.) + * @method bool isLocal() Check if the current instance has non-UTC timezone. + * @method bool isValid() Check if the current instance is a valid date. + * @method bool isDST() Check if the current instance is in a daylight saving time. + * @method bool isSunday() Checks if the instance day is sunday. + * @method bool isMonday() Checks if the instance day is monday. + * @method bool isTuesday() Checks if the instance day is tuesday. + * @method bool isWednesday() Checks if the instance day is wednesday. + * @method bool isThursday() Checks if the instance day is thursday. + * @method bool isFriday() Checks if the instance day is friday. + * @method bool isSaturday() Checks if the instance day is saturday. + * @method bool isSameYear(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same year as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentYear() Checks if the instance is in the same year as the current moment. + * @method bool isNextYear() Checks if the instance is in the same year as the current moment next year. + * @method bool isLastYear() Checks if the instance is in the same year as the current moment last year. + * @method bool isSameWeek(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same week as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentWeek() Checks if the instance is in the same week as the current moment. + * @method bool isNextWeek() Checks if the instance is in the same week as the current moment next week. + * @method bool isLastWeek() Checks if the instance is in the same week as the current moment last week. + * @method bool isSameDay(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same day as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentDay() Checks if the instance is in the same day as the current moment. + * @method bool isNextDay() Checks if the instance is in the same day as the current moment next day. + * @method bool isLastDay() Checks if the instance is in the same day as the current moment last day. + * @method bool isSameHour(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same hour as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentHour() Checks if the instance is in the same hour as the current moment. + * @method bool isNextHour() Checks if the instance is in the same hour as the current moment next hour. + * @method bool isLastHour() Checks if the instance is in the same hour as the current moment last hour. + * @method bool isSameMinute(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same minute as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMinute() Checks if the instance is in the same minute as the current moment. + * @method bool isNextMinute() Checks if the instance is in the same minute as the current moment next minute. + * @method bool isLastMinute() Checks if the instance is in the same minute as the current moment last minute. + * @method bool isSameSecond(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same second as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentSecond() Checks if the instance is in the same second as the current moment. + * @method bool isNextSecond() Checks if the instance is in the same second as the current moment next second. + * @method bool isLastSecond() Checks if the instance is in the same second as the current moment last second. + * @method bool isSameMicro(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMicro() Checks if the instance is in the same microsecond as the current moment. + * @method bool isNextMicro() Checks if the instance is in the same microsecond as the current moment next microsecond. + * @method bool isLastMicro() Checks if the instance is in the same microsecond as the current moment last microsecond. + * @method bool isSameMicrosecond(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMicrosecond() Checks if the instance is in the same microsecond as the current moment. + * @method bool isNextMicrosecond() Checks if the instance is in the same microsecond as the current moment next microsecond. + * @method bool isLastMicrosecond() Checks if the instance is in the same microsecond as the current moment last microsecond. + * @method bool isCurrentMonth() Checks if the instance is in the same month as the current moment. + * @method bool isNextMonth() Checks if the instance is in the same month as the current moment next month. + * @method bool isLastMonth() Checks if the instance is in the same month as the current moment last month. + * @method bool isCurrentQuarter() Checks if the instance is in the same quarter as the current moment. + * @method bool isNextQuarter() Checks if the instance is in the same quarter as the current moment next quarter. + * @method bool isLastQuarter() Checks if the instance is in the same quarter as the current moment last quarter. + * @method bool isSameDecade(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same decade as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentDecade() Checks if the instance is in the same decade as the current moment. + * @method bool isNextDecade() Checks if the instance is in the same decade as the current moment next decade. + * @method bool isLastDecade() Checks if the instance is in the same decade as the current moment last decade. + * @method bool isSameCentury(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same century as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentCentury() Checks if the instance is in the same century as the current moment. + * @method bool isNextCentury() Checks if the instance is in the same century as the current moment next century. + * @method bool isLastCentury() Checks if the instance is in the same century as the current moment last century. + * @method bool isSameMillennium(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same millennium as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMillennium() Checks if the instance is in the same millennium as the current moment. + * @method bool isNextMillennium() Checks if the instance is in the same millennium as the current moment next millennium. + * @method bool isLastMillennium() Checks if the instance is in the same millennium as the current moment last millennium. + * @method CarbonImmutable years(int $value) Set current instance year to the given value. + * @method CarbonImmutable year(int $value) Set current instance year to the given value. + * @method CarbonImmutable setYears(int $value) Set current instance year to the given value. + * @method CarbonImmutable setYear(int $value) Set current instance year to the given value. + * @method CarbonImmutable months(int $value) Set current instance month to the given value. + * @method CarbonImmutable month(int $value) Set current instance month to the given value. + * @method CarbonImmutable setMonths(int $value) Set current instance month to the given value. + * @method CarbonImmutable setMonth(int $value) Set current instance month to the given value. + * @method CarbonImmutable days(int $value) Set current instance day to the given value. + * @method CarbonImmutable day(int $value) Set current instance day to the given value. + * @method CarbonImmutable setDays(int $value) Set current instance day to the given value. + * @method CarbonImmutable setDay(int $value) Set current instance day to the given value. + * @method CarbonImmutable hours(int $value) Set current instance hour to the given value. + * @method CarbonImmutable hour(int $value) Set current instance hour to the given value. + * @method CarbonImmutable setHours(int $value) Set current instance hour to the given value. + * @method CarbonImmutable setHour(int $value) Set current instance hour to the given value. + * @method CarbonImmutable minutes(int $value) Set current instance minute to the given value. + * @method CarbonImmutable minute(int $value) Set current instance minute to the given value. + * @method CarbonImmutable setMinutes(int $value) Set current instance minute to the given value. + * @method CarbonImmutable setMinute(int $value) Set current instance minute to the given value. + * @method CarbonImmutable seconds(int $value) Set current instance second to the given value. + * @method CarbonImmutable second(int $value) Set current instance second to the given value. + * @method CarbonImmutable setSeconds(int $value) Set current instance second to the given value. + * @method CarbonImmutable setSecond(int $value) Set current instance second to the given value. + * @method CarbonImmutable millis(int $value) Set current instance millisecond to the given value. + * @method CarbonImmutable milli(int $value) Set current instance millisecond to the given value. + * @method CarbonImmutable setMillis(int $value) Set current instance millisecond to the given value. + * @method CarbonImmutable setMilli(int $value) Set current instance millisecond to the given value. + * @method CarbonImmutable milliseconds(int $value) Set current instance millisecond to the given value. + * @method CarbonImmutable millisecond(int $value) Set current instance millisecond to the given value. + * @method CarbonImmutable setMilliseconds(int $value) Set current instance millisecond to the given value. + * @method CarbonImmutable setMillisecond(int $value) Set current instance millisecond to the given value. + * @method CarbonImmutable micros(int $value) Set current instance microsecond to the given value. + * @method CarbonImmutable micro(int $value) Set current instance microsecond to the given value. + * @method CarbonImmutable setMicros(int $value) Set current instance microsecond to the given value. + * @method CarbonImmutable setMicro(int $value) Set current instance microsecond to the given value. + * @method CarbonImmutable microseconds(int $value) Set current instance microsecond to the given value. + * @method CarbonImmutable microsecond(int $value) Set current instance microsecond to the given value. + * @method CarbonImmutable setMicroseconds(int $value) Set current instance microsecond to the given value. + * @method CarbonImmutable setMicrosecond(int $value) Set current instance microsecond to the given value. + * @method CarbonImmutable addYears(int $value = 1) Add years (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addYear() Add one year to the instance (using date interval). + * @method CarbonImmutable subYears(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subYear() Sub one year to the instance (using date interval). + * @method CarbonImmutable addYearsWithOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addYearWithOverflow() Add one year to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subYearsWithOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subYearWithOverflow() Sub one year to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addYearsWithoutOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addYearWithoutOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subYearsWithoutOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subYearWithoutOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addYearsWithNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addYearWithNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subYearsWithNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subYearWithNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addYearsNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addYearNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subYearsNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subYearNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMonths(int $value = 1) Add months (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addMonth() Add one month to the instance (using date interval). + * @method CarbonImmutable subMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subMonth() Sub one month to the instance (using date interval). + * @method CarbonImmutable addMonthsWithOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addMonthWithOverflow() Add one month to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subMonthsWithOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subMonthWithOverflow() Sub one month to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addMonthsWithoutOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMonthWithoutOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMonthsWithoutOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMonthWithoutOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMonthsWithNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMonthWithNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMonthsWithNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMonthWithNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMonthsNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMonthNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMonthsNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMonthNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addDays(int $value = 1) Add days (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addDay() Add one day to the instance (using date interval). + * @method CarbonImmutable subDays(int $value = 1) Sub days (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subDay() Sub one day to the instance (using date interval). + * @method CarbonImmutable addHours(int $value = 1) Add hours (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addHour() Add one hour to the instance (using date interval). + * @method CarbonImmutable subHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subHour() Sub one hour to the instance (using date interval). + * @method CarbonImmutable addMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addMinute() Add one minute to the instance (using date interval). + * @method CarbonImmutable subMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subMinute() Sub one minute to the instance (using date interval). + * @method CarbonImmutable addSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addSecond() Add one second to the instance (using date interval). + * @method CarbonImmutable subSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subSecond() Sub one second to the instance (using date interval). + * @method CarbonImmutable addMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addMilli() Add one millisecond to the instance (using date interval). + * @method CarbonImmutable subMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subMilli() Sub one millisecond to the instance (using date interval). + * @method CarbonImmutable addMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addMillisecond() Add one millisecond to the instance (using date interval). + * @method CarbonImmutable subMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subMillisecond() Sub one millisecond to the instance (using date interval). + * @method CarbonImmutable addMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addMicro() Add one microsecond to the instance (using date interval). + * @method CarbonImmutable subMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subMicro() Sub one microsecond to the instance (using date interval). + * @method CarbonImmutable addMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addMicrosecond() Add one microsecond to the instance (using date interval). + * @method CarbonImmutable subMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subMicrosecond() Sub one microsecond to the instance (using date interval). + * @method CarbonImmutable addMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addMillennium() Add one millennium to the instance (using date interval). + * @method CarbonImmutable subMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subMillennium() Sub one millennium to the instance (using date interval). + * @method CarbonImmutable addMillenniaWithOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addMillenniumWithOverflow() Add one millennium to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subMillenniaWithOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subMillenniumWithOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addMillenniaWithoutOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMillenniumWithoutOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMillenniaWithoutOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMillenniumWithoutOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMillenniaWithNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMillenniumWithNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMillenniaWithNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMillenniumWithNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMillenniaNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMillenniumNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMillenniaNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMillenniumNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addCentury() Add one century to the instance (using date interval). + * @method CarbonImmutable subCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subCentury() Sub one century to the instance (using date interval). + * @method CarbonImmutable addCenturiesWithOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addCenturyWithOverflow() Add one century to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subCenturiesWithOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subCenturyWithOverflow() Sub one century to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addCenturiesWithoutOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addCenturyWithoutOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subCenturiesWithoutOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subCenturyWithoutOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addCenturiesWithNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addCenturyWithNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subCenturiesWithNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subCenturyWithNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addCenturiesNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addCenturyNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subCenturiesNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subCenturyNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addDecade() Add one decade to the instance (using date interval). + * @method CarbonImmutable subDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subDecade() Sub one decade to the instance (using date interval). + * @method CarbonImmutable addDecadesWithOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addDecadeWithOverflow() Add one decade to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subDecadesWithOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subDecadeWithOverflow() Sub one decade to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addDecadesWithoutOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addDecadeWithoutOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subDecadesWithoutOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subDecadeWithoutOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addDecadesWithNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addDecadeWithNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subDecadesWithNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subDecadeWithNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addDecadesNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addDecadeNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subDecadesNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subDecadeNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addQuarter() Add one quarter to the instance (using date interval). + * @method CarbonImmutable subQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subQuarter() Sub one quarter to the instance (using date interval). + * @method CarbonImmutable addQuartersWithOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addQuarterWithOverflow() Add one quarter to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subQuartersWithOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subQuarterWithOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addQuartersWithoutOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addQuarterWithoutOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subQuartersWithoutOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subQuarterWithoutOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addQuartersWithNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addQuarterWithNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subQuartersWithNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subQuarterWithNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addQuartersNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addQuarterNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subQuartersNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subQuarterNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addWeek() Add one week to the instance (using date interval). + * @method CarbonImmutable subWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subWeek() Sub one week to the instance (using date interval). + * @method CarbonImmutable addWeekdays(int $value = 1) Add weekdays (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addWeekday() Add one weekday to the instance (using date interval). + * @method CarbonImmutable subWeekdays(int $value = 1) Sub weekdays (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subWeekday() Sub one weekday to the instance (using date interval). + * @method CarbonImmutable addRealMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealMicro() Add one microsecond to the instance (using timestamp). + * @method CarbonImmutable subRealMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealMicro() Sub one microsecond to the instance (using timestamp). + * @method CarbonPeriod microsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given. + * @method CarbonImmutable addRealMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealMicrosecond() Add one microsecond to the instance (using timestamp). + * @method CarbonImmutable subRealMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealMicrosecond() Sub one microsecond to the instance (using timestamp). + * @method CarbonPeriod microsecondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given. + * @method CarbonImmutable addRealMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealMilli() Add one millisecond to the instance (using timestamp). + * @method CarbonImmutable subRealMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealMilli() Sub one millisecond to the instance (using timestamp). + * @method CarbonPeriod millisUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given. + * @method CarbonImmutable addRealMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealMillisecond() Add one millisecond to the instance (using timestamp). + * @method CarbonImmutable subRealMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealMillisecond() Sub one millisecond to the instance (using timestamp). + * @method CarbonPeriod millisecondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given. + * @method CarbonImmutable addRealSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealSecond() Add one second to the instance (using timestamp). + * @method CarbonImmutable subRealSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealSecond() Sub one second to the instance (using timestamp). + * @method CarbonPeriod secondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each second or every X seconds if a factor is given. + * @method CarbonImmutable addRealMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealMinute() Add one minute to the instance (using timestamp). + * @method CarbonImmutable subRealMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealMinute() Sub one minute to the instance (using timestamp). + * @method CarbonPeriod minutesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each minute or every X minutes if a factor is given. + * @method CarbonImmutable addRealHours(int $value = 1) Add hours (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealHour() Add one hour to the instance (using timestamp). + * @method CarbonImmutable subRealHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealHour() Sub one hour to the instance (using timestamp). + * @method CarbonPeriod hoursUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each hour or every X hours if a factor is given. + * @method CarbonImmutable addRealDays(int $value = 1) Add days (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealDay() Add one day to the instance (using timestamp). + * @method CarbonImmutable subRealDays(int $value = 1) Sub days (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealDay() Sub one day to the instance (using timestamp). + * @method CarbonPeriod daysUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each day or every X days if a factor is given. + * @method CarbonImmutable addRealWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealWeek() Add one week to the instance (using timestamp). + * @method CarbonImmutable subRealWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealWeek() Sub one week to the instance (using timestamp). + * @method CarbonPeriod weeksUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each week or every X weeks if a factor is given. + * @method CarbonImmutable addRealMonths(int $value = 1) Add months (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealMonth() Add one month to the instance (using timestamp). + * @method CarbonImmutable subRealMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealMonth() Sub one month to the instance (using timestamp). + * @method CarbonPeriod monthsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each month or every X months if a factor is given. + * @method CarbonImmutable addRealQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealQuarter() Add one quarter to the instance (using timestamp). + * @method CarbonImmutable subRealQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealQuarter() Sub one quarter to the instance (using timestamp). + * @method CarbonPeriod quartersUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each quarter or every X quarters if a factor is given. + * @method CarbonImmutable addRealYears(int $value = 1) Add years (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealYear() Add one year to the instance (using timestamp). + * @method CarbonImmutable subRealYears(int $value = 1) Sub years (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealYear() Sub one year to the instance (using timestamp). + * @method CarbonPeriod yearsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each year or every X years if a factor is given. + * @method CarbonImmutable addRealDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealDecade() Add one decade to the instance (using timestamp). + * @method CarbonImmutable subRealDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealDecade() Sub one decade to the instance (using timestamp). + * @method CarbonPeriod decadesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each decade or every X decades if a factor is given. + * @method CarbonImmutable addRealCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealCentury() Add one century to the instance (using timestamp). + * @method CarbonImmutable subRealCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealCentury() Sub one century to the instance (using timestamp). + * @method CarbonPeriod centuriesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each century or every X centuries if a factor is given. + * @method CarbonImmutable addRealMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealMillennium() Add one millennium to the instance (using timestamp). + * @method CarbonImmutable subRealMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealMillennium() Sub one millennium to the instance (using timestamp). + * @method CarbonPeriod millenniaUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millennium or every X millennia if a factor is given. + * @method CarbonImmutable roundYear(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. + * @method CarbonImmutable roundYears(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. + * @method CarbonImmutable floorYear(float $precision = 1) Truncate the current instance year with given precision. + * @method CarbonImmutable floorYears(float $precision = 1) Truncate the current instance year with given precision. + * @method CarbonImmutable ceilYear(float $precision = 1) Ceil the current instance year with given precision. + * @method CarbonImmutable ceilYears(float $precision = 1) Ceil the current instance year with given precision. + * @method CarbonImmutable roundMonth(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. + * @method CarbonImmutable roundMonths(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. + * @method CarbonImmutable floorMonth(float $precision = 1) Truncate the current instance month with given precision. + * @method CarbonImmutable floorMonths(float $precision = 1) Truncate the current instance month with given precision. + * @method CarbonImmutable ceilMonth(float $precision = 1) Ceil the current instance month with given precision. + * @method CarbonImmutable ceilMonths(float $precision = 1) Ceil the current instance month with given precision. + * @method CarbonImmutable roundDay(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method CarbonImmutable roundDays(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method CarbonImmutable floorDay(float $precision = 1) Truncate the current instance day with given precision. + * @method CarbonImmutable floorDays(float $precision = 1) Truncate the current instance day with given precision. + * @method CarbonImmutable ceilDay(float $precision = 1) Ceil the current instance day with given precision. + * @method CarbonImmutable ceilDays(float $precision = 1) Ceil the current instance day with given precision. + * @method CarbonImmutable roundHour(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. + * @method CarbonImmutable roundHours(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. + * @method CarbonImmutable floorHour(float $precision = 1) Truncate the current instance hour with given precision. + * @method CarbonImmutable floorHours(float $precision = 1) Truncate the current instance hour with given precision. + * @method CarbonImmutable ceilHour(float $precision = 1) Ceil the current instance hour with given precision. + * @method CarbonImmutable ceilHours(float $precision = 1) Ceil the current instance hour with given precision. + * @method CarbonImmutable roundMinute(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. + * @method CarbonImmutable roundMinutes(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. + * @method CarbonImmutable floorMinute(float $precision = 1) Truncate the current instance minute with given precision. + * @method CarbonImmutable floorMinutes(float $precision = 1) Truncate the current instance minute with given precision. + * @method CarbonImmutable ceilMinute(float $precision = 1) Ceil the current instance minute with given precision. + * @method CarbonImmutable ceilMinutes(float $precision = 1) Ceil the current instance minute with given precision. + * @method CarbonImmutable roundSecond(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. + * @method CarbonImmutable roundSeconds(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. + * @method CarbonImmutable floorSecond(float $precision = 1) Truncate the current instance second with given precision. + * @method CarbonImmutable floorSeconds(float $precision = 1) Truncate the current instance second with given precision. + * @method CarbonImmutable ceilSecond(float $precision = 1) Ceil the current instance second with given precision. + * @method CarbonImmutable ceilSeconds(float $precision = 1) Ceil the current instance second with given precision. + * @method CarbonImmutable roundMillennium(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. + * @method CarbonImmutable roundMillennia(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. + * @method CarbonImmutable floorMillennium(float $precision = 1) Truncate the current instance millennium with given precision. + * @method CarbonImmutable floorMillennia(float $precision = 1) Truncate the current instance millennium with given precision. + * @method CarbonImmutable ceilMillennium(float $precision = 1) Ceil the current instance millennium with given precision. + * @method CarbonImmutable ceilMillennia(float $precision = 1) Ceil the current instance millennium with given precision. + * @method CarbonImmutable roundCentury(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. + * @method CarbonImmutable roundCenturies(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. + * @method CarbonImmutable floorCentury(float $precision = 1) Truncate the current instance century with given precision. + * @method CarbonImmutable floorCenturies(float $precision = 1) Truncate the current instance century with given precision. + * @method CarbonImmutable ceilCentury(float $precision = 1) Ceil the current instance century with given precision. + * @method CarbonImmutable ceilCenturies(float $precision = 1) Ceil the current instance century with given precision. + * @method CarbonImmutable roundDecade(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. + * @method CarbonImmutable roundDecades(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. + * @method CarbonImmutable floorDecade(float $precision = 1) Truncate the current instance decade with given precision. + * @method CarbonImmutable floorDecades(float $precision = 1) Truncate the current instance decade with given precision. + * @method CarbonImmutable ceilDecade(float $precision = 1) Ceil the current instance decade with given precision. + * @method CarbonImmutable ceilDecades(float $precision = 1) Ceil the current instance decade with given precision. + * @method CarbonImmutable roundQuarter(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. + * @method CarbonImmutable roundQuarters(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. + * @method CarbonImmutable floorQuarter(float $precision = 1) Truncate the current instance quarter with given precision. + * @method CarbonImmutable floorQuarters(float $precision = 1) Truncate the current instance quarter with given precision. + * @method CarbonImmutable ceilQuarter(float $precision = 1) Ceil the current instance quarter with given precision. + * @method CarbonImmutable ceilQuarters(float $precision = 1) Ceil the current instance quarter with given precision. + * @method CarbonImmutable roundMillisecond(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. + * @method CarbonImmutable roundMilliseconds(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. + * @method CarbonImmutable floorMillisecond(float $precision = 1) Truncate the current instance millisecond with given precision. + * @method CarbonImmutable floorMilliseconds(float $precision = 1) Truncate the current instance millisecond with given precision. + * @method CarbonImmutable ceilMillisecond(float $precision = 1) Ceil the current instance millisecond with given precision. + * @method CarbonImmutable ceilMilliseconds(float $precision = 1) Ceil the current instance millisecond with given precision. + * @method CarbonImmutable roundMicrosecond(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. + * @method CarbonImmutable roundMicroseconds(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. + * @method CarbonImmutable floorMicrosecond(float $precision = 1) Truncate the current instance microsecond with given precision. + * @method CarbonImmutable floorMicroseconds(float $precision = 1) Truncate the current instance microsecond with given precision. + * @method CarbonImmutable ceilMicrosecond(float $precision = 1) Ceil the current instance microsecond with given precision. + * @method CarbonImmutable ceilMicroseconds(float $precision = 1) Ceil the current instance microsecond with given precision. + * @method string shortAbsoluteDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'Absolute' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longAbsoluteDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'Absolute' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string shortRelativeDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'Relative' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longRelativeDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'Relative' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string shortRelativeToNowDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longRelativeToNowDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string shortRelativeToOtherDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longRelativeToOtherDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method static static|false createFromFormat(string $format, string $time, DateTimeZone|string|false|null $timezone = null) Parse a string into a new CarbonImmutable object according to the specified format. + * @method static static __set_state(array $array) https://php.net/manual/en/datetime.set-state.php + * + * </autodoc> + */ +class CarbonImmutable extends DateTimeImmutable implements CarbonInterface +{ + use Date { + __clone as dateTraitClone; + } + + public function __clone() + { + $this->dateTraitClone(); + $this->endOfTime = false; + $this->startOfTime = false; + } + + /** + * Create a very old date representing start of time. + * + * @return static + */ + public static function startOfTime(): self + { + $date = static::parse('0001-01-01')->years(self::getStartOfTimeYear()); + $date->startOfTime = true; + + return $date; + } + + /** + * Create a very far date representing end of time. + * + * @return static + */ + public static function endOfTime(): self + { + $date = static::parse('9999-12-31 23:59:59.999999')->years(self::getEndOfTimeYear()); + $date->endOfTime = true; + + return $date; + } + + /** + * @codeCoverageIgnore + */ + private static function getEndOfTimeYear(): int + { + if (version_compare(PHP_VERSION, '7.3.0-dev', '<')) { + return 145261681241552; + } + + // Remove if https://bugs.php.net/bug.php?id=81107 is fixed + if (version_compare(PHP_VERSION, '8.1.0-dev', '>=')) { + return 1118290769066902787; + } + + return PHP_INT_MAX; + } + + /** + * @codeCoverageIgnore + */ + private static function getStartOfTimeYear(): int + { + if (version_compare(PHP_VERSION, '7.3.0-dev', '<')) { + return -135908816449551; + } + + // Remove if https://bugs.php.net/bug.php?id=81107 is fixed + if (version_compare(PHP_VERSION, '8.1.0-dev', '>=')) { + return -1118290769066898816; + } + + return max(PHP_INT_MIN, -9223372036854773760); + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/CarbonInterface.php b/vendor/nesbot/carbon/src/Carbon/CarbonInterface.php new file mode 100644 index 00000000..b90e2981 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/CarbonInterface.php @@ -0,0 +1,5142 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon; + +use BadMethodCallException; +use Carbon\Exceptions\BadComparisonUnitException; +use Carbon\Exceptions\ImmutableException; +use Carbon\Exceptions\InvalidDateException; +use Carbon\Exceptions\InvalidFormatException; +use Carbon\Exceptions\UnknownGetterException; +use Carbon\Exceptions\UnknownMethodException; +use Carbon\Exceptions\UnknownSetterException; +use Closure; +use DateInterval; +use DateTime; +use DateTimeImmutable; +use DateTimeInterface; +use DateTimeZone; +use JsonSerializable; +use ReflectionException; +use ReturnTypeWillChange; +use Symfony\Component\Translation\TranslatorInterface; +use Throwable; + +/** + * Common interface for Carbon and CarbonImmutable. + * + * <autodoc generated by `composer phpdoc`> + * + * @property int $year + * @property int $yearIso + * @property int $month + * @property int $day + * @property int $hour + * @property int $minute + * @property int $second + * @property int $micro + * @property int $microsecond + * @property int|float|string $timestamp seconds since the Unix Epoch + * @property string $englishDayOfWeek the day of week in English + * @property string $shortEnglishDayOfWeek the abbreviated day of week in English + * @property string $englishMonth the month in English + * @property string $shortEnglishMonth the abbreviated month in English + * @property int $milliseconds + * @property int $millisecond + * @property int $milli + * @property int $week 1 through 53 + * @property int $isoWeek 1 through 53 + * @property int $weekYear year according to week format + * @property int $isoWeekYear year according to ISO week format + * @property int $dayOfYear 1 through 366 + * @property int $age does a diffInYears() with default parameters + * @property int $offset the timezone offset in seconds from UTC + * @property int $offsetMinutes the timezone offset in minutes from UTC + * @property int $offsetHours the timezone offset in hours from UTC + * @property CarbonTimeZone $timezone the current timezone + * @property CarbonTimeZone $tz alias of $timezone + * @property-read int $dayOfWeek 0 (for Sunday) through 6 (for Saturday) + * @property-read int $dayOfWeekIso 1 (for Monday) through 7 (for Sunday) + * @property-read int $weekOfYear ISO-8601 week number of year, weeks starting on Monday + * @property-read int $daysInMonth number of days in the given month + * @property-read string $latinMeridiem "am"/"pm" (Ante meridiem or Post meridiem latin lowercase mark) + * @property-read string $latinUpperMeridiem "AM"/"PM" (Ante meridiem or Post meridiem latin uppercase mark) + * @property-read string $timezoneAbbreviatedName the current timezone abbreviated name + * @property-read string $tzAbbrName alias of $timezoneAbbreviatedName + * @property-read string $dayName long name of weekday translated according to Carbon locale, in english if no translation available for current language + * @property-read string $shortDayName short name of weekday translated according to Carbon locale, in english if no translation available for current language + * @property-read string $minDayName very short name of weekday translated according to Carbon locale, in english if no translation available for current language + * @property-read string $monthName long name of month translated according to Carbon locale, in english if no translation available for current language + * @property-read string $shortMonthName short name of month translated according to Carbon locale, in english if no translation available for current language + * @property-read string $meridiem lowercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language + * @property-read string $upperMeridiem uppercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language + * @property-read int $noZeroHour current hour from 1 to 24 + * @property-read int $weeksInYear 51 through 53 + * @property-read int $isoWeeksInYear 51 through 53 + * @property-read int $weekOfMonth 1 through 5 + * @property-read int $weekNumberInMonth 1 through 5 + * @property-read int $firstWeekDay 0 through 6 + * @property-read int $lastWeekDay 0 through 6 + * @property-read int $daysInYear 365 or 366 + * @property-read int $quarter the quarter of this instance, 1 - 4 + * @property-read int $decade the decade of this instance + * @property-read int $century the century of this instance + * @property-read int $millennium the millennium of this instance + * @property-read bool $dst daylight savings time indicator, true if DST, false otherwise + * @property-read bool $local checks if the timezone is local, true if local, false otherwise + * @property-read bool $utc checks if the timezone is UTC, true if UTC, false otherwise + * @property-read string $timezoneName the current timezone name + * @property-read string $tzName alias of $timezoneName + * @property-read string $locale locale of the current instance + * + * @method bool isUtc() Check if the current instance has UTC timezone. (Both isUtc and isUTC cases are valid.) + * @method bool isLocal() Check if the current instance has non-UTC timezone. + * @method bool isValid() Check if the current instance is a valid date. + * @method bool isDST() Check if the current instance is in a daylight saving time. + * @method bool isSunday() Checks if the instance day is sunday. + * @method bool isMonday() Checks if the instance day is monday. + * @method bool isTuesday() Checks if the instance day is tuesday. + * @method bool isWednesday() Checks if the instance day is wednesday. + * @method bool isThursday() Checks if the instance day is thursday. + * @method bool isFriday() Checks if the instance day is friday. + * @method bool isSaturday() Checks if the instance day is saturday. + * @method bool isSameYear(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same year as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentYear() Checks if the instance is in the same year as the current moment. + * @method bool isNextYear() Checks if the instance is in the same year as the current moment next year. + * @method bool isLastYear() Checks if the instance is in the same year as the current moment last year. + * @method bool isSameWeek(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same week as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentWeek() Checks if the instance is in the same week as the current moment. + * @method bool isNextWeek() Checks if the instance is in the same week as the current moment next week. + * @method bool isLastWeek() Checks if the instance is in the same week as the current moment last week. + * @method bool isSameDay(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same day as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentDay() Checks if the instance is in the same day as the current moment. + * @method bool isNextDay() Checks if the instance is in the same day as the current moment next day. + * @method bool isLastDay() Checks if the instance is in the same day as the current moment last day. + * @method bool isSameHour(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same hour as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentHour() Checks if the instance is in the same hour as the current moment. + * @method bool isNextHour() Checks if the instance is in the same hour as the current moment next hour. + * @method bool isLastHour() Checks if the instance is in the same hour as the current moment last hour. + * @method bool isSameMinute(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same minute as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMinute() Checks if the instance is in the same minute as the current moment. + * @method bool isNextMinute() Checks if the instance is in the same minute as the current moment next minute. + * @method bool isLastMinute() Checks if the instance is in the same minute as the current moment last minute. + * @method bool isSameSecond(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same second as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentSecond() Checks if the instance is in the same second as the current moment. + * @method bool isNextSecond() Checks if the instance is in the same second as the current moment next second. + * @method bool isLastSecond() Checks if the instance is in the same second as the current moment last second. + * @method bool isSameMicro(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMicro() Checks if the instance is in the same microsecond as the current moment. + * @method bool isNextMicro() Checks if the instance is in the same microsecond as the current moment next microsecond. + * @method bool isLastMicro() Checks if the instance is in the same microsecond as the current moment last microsecond. + * @method bool isSameMicrosecond(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMicrosecond() Checks if the instance is in the same microsecond as the current moment. + * @method bool isNextMicrosecond() Checks if the instance is in the same microsecond as the current moment next microsecond. + * @method bool isLastMicrosecond() Checks if the instance is in the same microsecond as the current moment last microsecond. + * @method bool isCurrentMonth() Checks if the instance is in the same month as the current moment. + * @method bool isNextMonth() Checks if the instance is in the same month as the current moment next month. + * @method bool isLastMonth() Checks if the instance is in the same month as the current moment last month. + * @method bool isCurrentQuarter() Checks if the instance is in the same quarter as the current moment. + * @method bool isNextQuarter() Checks if the instance is in the same quarter as the current moment next quarter. + * @method bool isLastQuarter() Checks if the instance is in the same quarter as the current moment last quarter. + * @method bool isSameDecade(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same decade as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentDecade() Checks if the instance is in the same decade as the current moment. + * @method bool isNextDecade() Checks if the instance is in the same decade as the current moment next decade. + * @method bool isLastDecade() Checks if the instance is in the same decade as the current moment last decade. + * @method bool isSameCentury(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same century as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentCentury() Checks if the instance is in the same century as the current moment. + * @method bool isNextCentury() Checks if the instance is in the same century as the current moment next century. + * @method bool isLastCentury() Checks if the instance is in the same century as the current moment last century. + * @method bool isSameMillennium(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same millennium as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMillennium() Checks if the instance is in the same millennium as the current moment. + * @method bool isNextMillennium() Checks if the instance is in the same millennium as the current moment next millennium. + * @method bool isLastMillennium() Checks if the instance is in the same millennium as the current moment last millennium. + * @method CarbonInterface years(int $value) Set current instance year to the given value. + * @method CarbonInterface year(int $value) Set current instance year to the given value. + * @method CarbonInterface setYears(int $value) Set current instance year to the given value. + * @method CarbonInterface setYear(int $value) Set current instance year to the given value. + * @method CarbonInterface months(int $value) Set current instance month to the given value. + * @method CarbonInterface month(int $value) Set current instance month to the given value. + * @method CarbonInterface setMonths(int $value) Set current instance month to the given value. + * @method CarbonInterface setMonth(int $value) Set current instance month to the given value. + * @method CarbonInterface days(int $value) Set current instance day to the given value. + * @method CarbonInterface day(int $value) Set current instance day to the given value. + * @method CarbonInterface setDays(int $value) Set current instance day to the given value. + * @method CarbonInterface setDay(int $value) Set current instance day to the given value. + * @method CarbonInterface hours(int $value) Set current instance hour to the given value. + * @method CarbonInterface hour(int $value) Set current instance hour to the given value. + * @method CarbonInterface setHours(int $value) Set current instance hour to the given value. + * @method CarbonInterface setHour(int $value) Set current instance hour to the given value. + * @method CarbonInterface minutes(int $value) Set current instance minute to the given value. + * @method CarbonInterface minute(int $value) Set current instance minute to the given value. + * @method CarbonInterface setMinutes(int $value) Set current instance minute to the given value. + * @method CarbonInterface setMinute(int $value) Set current instance minute to the given value. + * @method CarbonInterface seconds(int $value) Set current instance second to the given value. + * @method CarbonInterface second(int $value) Set current instance second to the given value. + * @method CarbonInterface setSeconds(int $value) Set current instance second to the given value. + * @method CarbonInterface setSecond(int $value) Set current instance second to the given value. + * @method CarbonInterface millis(int $value) Set current instance millisecond to the given value. + * @method CarbonInterface milli(int $value) Set current instance millisecond to the given value. + * @method CarbonInterface setMillis(int $value) Set current instance millisecond to the given value. + * @method CarbonInterface setMilli(int $value) Set current instance millisecond to the given value. + * @method CarbonInterface milliseconds(int $value) Set current instance millisecond to the given value. + * @method CarbonInterface millisecond(int $value) Set current instance millisecond to the given value. + * @method CarbonInterface setMilliseconds(int $value) Set current instance millisecond to the given value. + * @method CarbonInterface setMillisecond(int $value) Set current instance millisecond to the given value. + * @method CarbonInterface micros(int $value) Set current instance microsecond to the given value. + * @method CarbonInterface micro(int $value) Set current instance microsecond to the given value. + * @method CarbonInterface setMicros(int $value) Set current instance microsecond to the given value. + * @method CarbonInterface setMicro(int $value) Set current instance microsecond to the given value. + * @method CarbonInterface microseconds(int $value) Set current instance microsecond to the given value. + * @method CarbonInterface microsecond(int $value) Set current instance microsecond to the given value. + * @method CarbonInterface setMicroseconds(int $value) Set current instance microsecond to the given value. + * @method CarbonInterface setMicrosecond(int $value) Set current instance microsecond to the given value. + * @method CarbonInterface addYears(int $value = 1) Add years (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addYear() Add one year to the instance (using date interval). + * @method CarbonInterface subYears(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subYear() Sub one year to the instance (using date interval). + * @method CarbonInterface addYearsWithOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface addYearWithOverflow() Add one year to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface subYearsWithOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface subYearWithOverflow() Sub one year to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface addYearsWithoutOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addYearWithoutOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subYearsWithoutOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subYearWithoutOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addYearsWithNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addYearWithNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subYearsWithNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subYearWithNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addYearsNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addYearNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subYearsNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subYearNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addMonths(int $value = 1) Add months (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addMonth() Add one month to the instance (using date interval). + * @method CarbonInterface subMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subMonth() Sub one month to the instance (using date interval). + * @method CarbonInterface addMonthsWithOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface addMonthWithOverflow() Add one month to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface subMonthsWithOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface subMonthWithOverflow() Sub one month to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface addMonthsWithoutOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addMonthWithoutOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subMonthsWithoutOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subMonthWithoutOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addMonthsWithNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addMonthWithNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subMonthsWithNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subMonthWithNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addMonthsNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addMonthNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subMonthsNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subMonthNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addDays(int $value = 1) Add days (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addDay() Add one day to the instance (using date interval). + * @method CarbonInterface subDays(int $value = 1) Sub days (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subDay() Sub one day to the instance (using date interval). + * @method CarbonInterface addHours(int $value = 1) Add hours (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addHour() Add one hour to the instance (using date interval). + * @method CarbonInterface subHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subHour() Sub one hour to the instance (using date interval). + * @method CarbonInterface addMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addMinute() Add one minute to the instance (using date interval). + * @method CarbonInterface subMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subMinute() Sub one minute to the instance (using date interval). + * @method CarbonInterface addSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addSecond() Add one second to the instance (using date interval). + * @method CarbonInterface subSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subSecond() Sub one second to the instance (using date interval). + * @method CarbonInterface addMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addMilli() Add one millisecond to the instance (using date interval). + * @method CarbonInterface subMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subMilli() Sub one millisecond to the instance (using date interval). + * @method CarbonInterface addMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addMillisecond() Add one millisecond to the instance (using date interval). + * @method CarbonInterface subMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subMillisecond() Sub one millisecond to the instance (using date interval). + * @method CarbonInterface addMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addMicro() Add one microsecond to the instance (using date interval). + * @method CarbonInterface subMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subMicro() Sub one microsecond to the instance (using date interval). + * @method CarbonInterface addMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addMicrosecond() Add one microsecond to the instance (using date interval). + * @method CarbonInterface subMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subMicrosecond() Sub one microsecond to the instance (using date interval). + * @method CarbonInterface addMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addMillennium() Add one millennium to the instance (using date interval). + * @method CarbonInterface subMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subMillennium() Sub one millennium to the instance (using date interval). + * @method CarbonInterface addMillenniaWithOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface addMillenniumWithOverflow() Add one millennium to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface subMillenniaWithOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface subMillenniumWithOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface addMillenniaWithoutOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addMillenniumWithoutOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subMillenniaWithoutOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subMillenniumWithoutOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addMillenniaWithNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addMillenniumWithNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subMillenniaWithNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subMillenniumWithNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addMillenniaNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addMillenniumNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subMillenniaNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subMillenniumNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addCentury() Add one century to the instance (using date interval). + * @method CarbonInterface subCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subCentury() Sub one century to the instance (using date interval). + * @method CarbonInterface addCenturiesWithOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface addCenturyWithOverflow() Add one century to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface subCenturiesWithOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface subCenturyWithOverflow() Sub one century to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface addCenturiesWithoutOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addCenturyWithoutOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subCenturiesWithoutOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subCenturyWithoutOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addCenturiesWithNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addCenturyWithNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subCenturiesWithNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subCenturyWithNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addCenturiesNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addCenturyNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subCenturiesNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subCenturyNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addDecade() Add one decade to the instance (using date interval). + * @method CarbonInterface subDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subDecade() Sub one decade to the instance (using date interval). + * @method CarbonInterface addDecadesWithOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface addDecadeWithOverflow() Add one decade to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface subDecadesWithOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface subDecadeWithOverflow() Sub one decade to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface addDecadesWithoutOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addDecadeWithoutOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subDecadesWithoutOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subDecadeWithoutOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addDecadesWithNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addDecadeWithNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subDecadesWithNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subDecadeWithNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addDecadesNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addDecadeNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subDecadesNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subDecadeNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addQuarter() Add one quarter to the instance (using date interval). + * @method CarbonInterface subQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subQuarter() Sub one quarter to the instance (using date interval). + * @method CarbonInterface addQuartersWithOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface addQuarterWithOverflow() Add one quarter to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface subQuartersWithOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface subQuarterWithOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface addQuartersWithoutOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addQuarterWithoutOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subQuartersWithoutOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subQuarterWithoutOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addQuartersWithNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addQuarterWithNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subQuartersWithNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subQuarterWithNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addQuartersNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addQuarterNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subQuartersNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subQuarterNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addWeek() Add one week to the instance (using date interval). + * @method CarbonInterface subWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subWeek() Sub one week to the instance (using date interval). + * @method CarbonInterface addWeekdays(int $value = 1) Add weekdays (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addWeekday() Add one weekday to the instance (using date interval). + * @method CarbonInterface subWeekdays(int $value = 1) Sub weekdays (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subWeekday() Sub one weekday to the instance (using date interval). + * @method CarbonInterface addRealMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealMicro() Add one microsecond to the instance (using timestamp). + * @method CarbonInterface subRealMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealMicro() Sub one microsecond to the instance (using timestamp). + * @method CarbonPeriod microsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given. + * @method CarbonInterface addRealMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealMicrosecond() Add one microsecond to the instance (using timestamp). + * @method CarbonInterface subRealMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealMicrosecond() Sub one microsecond to the instance (using timestamp). + * @method CarbonPeriod microsecondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given. + * @method CarbonInterface addRealMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealMilli() Add one millisecond to the instance (using timestamp). + * @method CarbonInterface subRealMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealMilli() Sub one millisecond to the instance (using timestamp). + * @method CarbonPeriod millisUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given. + * @method CarbonInterface addRealMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealMillisecond() Add one millisecond to the instance (using timestamp). + * @method CarbonInterface subRealMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealMillisecond() Sub one millisecond to the instance (using timestamp). + * @method CarbonPeriod millisecondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given. + * @method CarbonInterface addRealSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealSecond() Add one second to the instance (using timestamp). + * @method CarbonInterface subRealSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealSecond() Sub one second to the instance (using timestamp). + * @method CarbonPeriod secondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each second or every X seconds if a factor is given. + * @method CarbonInterface addRealMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealMinute() Add one minute to the instance (using timestamp). + * @method CarbonInterface subRealMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealMinute() Sub one minute to the instance (using timestamp). + * @method CarbonPeriod minutesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each minute or every X minutes if a factor is given. + * @method CarbonInterface addRealHours(int $value = 1) Add hours (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealHour() Add one hour to the instance (using timestamp). + * @method CarbonInterface subRealHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealHour() Sub one hour to the instance (using timestamp). + * @method CarbonPeriod hoursUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each hour or every X hours if a factor is given. + * @method CarbonInterface addRealDays(int $value = 1) Add days (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealDay() Add one day to the instance (using timestamp). + * @method CarbonInterface subRealDays(int $value = 1) Sub days (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealDay() Sub one day to the instance (using timestamp). + * @method CarbonPeriod daysUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each day or every X days if a factor is given. + * @method CarbonInterface addRealWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealWeek() Add one week to the instance (using timestamp). + * @method CarbonInterface subRealWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealWeek() Sub one week to the instance (using timestamp). + * @method CarbonPeriod weeksUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each week or every X weeks if a factor is given. + * @method CarbonInterface addRealMonths(int $value = 1) Add months (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealMonth() Add one month to the instance (using timestamp). + * @method CarbonInterface subRealMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealMonth() Sub one month to the instance (using timestamp). + * @method CarbonPeriod monthsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each month or every X months if a factor is given. + * @method CarbonInterface addRealQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealQuarter() Add one quarter to the instance (using timestamp). + * @method CarbonInterface subRealQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealQuarter() Sub one quarter to the instance (using timestamp). + * @method CarbonPeriod quartersUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each quarter or every X quarters if a factor is given. + * @method CarbonInterface addRealYears(int $value = 1) Add years (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealYear() Add one year to the instance (using timestamp). + * @method CarbonInterface subRealYears(int $value = 1) Sub years (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealYear() Sub one year to the instance (using timestamp). + * @method CarbonPeriod yearsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each year or every X years if a factor is given. + * @method CarbonInterface addRealDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealDecade() Add one decade to the instance (using timestamp). + * @method CarbonInterface subRealDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealDecade() Sub one decade to the instance (using timestamp). + * @method CarbonPeriod decadesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each decade or every X decades if a factor is given. + * @method CarbonInterface addRealCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealCentury() Add one century to the instance (using timestamp). + * @method CarbonInterface subRealCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealCentury() Sub one century to the instance (using timestamp). + * @method CarbonPeriod centuriesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each century or every X centuries if a factor is given. + * @method CarbonInterface addRealMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealMillennium() Add one millennium to the instance (using timestamp). + * @method CarbonInterface subRealMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealMillennium() Sub one millennium to the instance (using timestamp). + * @method CarbonPeriod millenniaUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millennium or every X millennia if a factor is given. + * @method CarbonInterface roundYear(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. + * @method CarbonInterface roundYears(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. + * @method CarbonInterface floorYear(float $precision = 1) Truncate the current instance year with given precision. + * @method CarbonInterface floorYears(float $precision = 1) Truncate the current instance year with given precision. + * @method CarbonInterface ceilYear(float $precision = 1) Ceil the current instance year with given precision. + * @method CarbonInterface ceilYears(float $precision = 1) Ceil the current instance year with given precision. + * @method CarbonInterface roundMonth(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. + * @method CarbonInterface roundMonths(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. + * @method CarbonInterface floorMonth(float $precision = 1) Truncate the current instance month with given precision. + * @method CarbonInterface floorMonths(float $precision = 1) Truncate the current instance month with given precision. + * @method CarbonInterface ceilMonth(float $precision = 1) Ceil the current instance month with given precision. + * @method CarbonInterface ceilMonths(float $precision = 1) Ceil the current instance month with given precision. + * @method CarbonInterface roundDay(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method CarbonInterface roundDays(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method CarbonInterface floorDay(float $precision = 1) Truncate the current instance day with given precision. + * @method CarbonInterface floorDays(float $precision = 1) Truncate the current instance day with given precision. + * @method CarbonInterface ceilDay(float $precision = 1) Ceil the current instance day with given precision. + * @method CarbonInterface ceilDays(float $precision = 1) Ceil the current instance day with given precision. + * @method CarbonInterface roundHour(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. + * @method CarbonInterface roundHours(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. + * @method CarbonInterface floorHour(float $precision = 1) Truncate the current instance hour with given precision. + * @method CarbonInterface floorHours(float $precision = 1) Truncate the current instance hour with given precision. + * @method CarbonInterface ceilHour(float $precision = 1) Ceil the current instance hour with given precision. + * @method CarbonInterface ceilHours(float $precision = 1) Ceil the current instance hour with given precision. + * @method CarbonInterface roundMinute(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. + * @method CarbonInterface roundMinutes(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. + * @method CarbonInterface floorMinute(float $precision = 1) Truncate the current instance minute with given precision. + * @method CarbonInterface floorMinutes(float $precision = 1) Truncate the current instance minute with given precision. + * @method CarbonInterface ceilMinute(float $precision = 1) Ceil the current instance minute with given precision. + * @method CarbonInterface ceilMinutes(float $precision = 1) Ceil the current instance minute with given precision. + * @method CarbonInterface roundSecond(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. + * @method CarbonInterface roundSeconds(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. + * @method CarbonInterface floorSecond(float $precision = 1) Truncate the current instance second with given precision. + * @method CarbonInterface floorSeconds(float $precision = 1) Truncate the current instance second with given precision. + * @method CarbonInterface ceilSecond(float $precision = 1) Ceil the current instance second with given precision. + * @method CarbonInterface ceilSeconds(float $precision = 1) Ceil the current instance second with given precision. + * @method CarbonInterface roundMillennium(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. + * @method CarbonInterface roundMillennia(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. + * @method CarbonInterface floorMillennium(float $precision = 1) Truncate the current instance millennium with given precision. + * @method CarbonInterface floorMillennia(float $precision = 1) Truncate the current instance millennium with given precision. + * @method CarbonInterface ceilMillennium(float $precision = 1) Ceil the current instance millennium with given precision. + * @method CarbonInterface ceilMillennia(float $precision = 1) Ceil the current instance millennium with given precision. + * @method CarbonInterface roundCentury(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. + * @method CarbonInterface roundCenturies(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. + * @method CarbonInterface floorCentury(float $precision = 1) Truncate the current instance century with given precision. + * @method CarbonInterface floorCenturies(float $precision = 1) Truncate the current instance century with given precision. + * @method CarbonInterface ceilCentury(float $precision = 1) Ceil the current instance century with given precision. + * @method CarbonInterface ceilCenturies(float $precision = 1) Ceil the current instance century with given precision. + * @method CarbonInterface roundDecade(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. + * @method CarbonInterface roundDecades(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. + * @method CarbonInterface floorDecade(float $precision = 1) Truncate the current instance decade with given precision. + * @method CarbonInterface floorDecades(float $precision = 1) Truncate the current instance decade with given precision. + * @method CarbonInterface ceilDecade(float $precision = 1) Ceil the current instance decade with given precision. + * @method CarbonInterface ceilDecades(float $precision = 1) Ceil the current instance decade with given precision. + * @method CarbonInterface roundQuarter(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. + * @method CarbonInterface roundQuarters(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. + * @method CarbonInterface floorQuarter(float $precision = 1) Truncate the current instance quarter with given precision. + * @method CarbonInterface floorQuarters(float $precision = 1) Truncate the current instance quarter with given precision. + * @method CarbonInterface ceilQuarter(float $precision = 1) Ceil the current instance quarter with given precision. + * @method CarbonInterface ceilQuarters(float $precision = 1) Ceil the current instance quarter with given precision. + * @method CarbonInterface roundMillisecond(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. + * @method CarbonInterface roundMilliseconds(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. + * @method CarbonInterface floorMillisecond(float $precision = 1) Truncate the current instance millisecond with given precision. + * @method CarbonInterface floorMilliseconds(float $precision = 1) Truncate the current instance millisecond with given precision. + * @method CarbonInterface ceilMillisecond(float $precision = 1) Ceil the current instance millisecond with given precision. + * @method CarbonInterface ceilMilliseconds(float $precision = 1) Ceil the current instance millisecond with given precision. + * @method CarbonInterface roundMicrosecond(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. + * @method CarbonInterface roundMicroseconds(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. + * @method CarbonInterface floorMicrosecond(float $precision = 1) Truncate the current instance microsecond with given precision. + * @method CarbonInterface floorMicroseconds(float $precision = 1) Truncate the current instance microsecond with given precision. + * @method CarbonInterface ceilMicrosecond(float $precision = 1) Ceil the current instance microsecond with given precision. + * @method CarbonInterface ceilMicroseconds(float $precision = 1) Ceil the current instance microsecond with given precision. + * @method string shortAbsoluteDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'Absolute' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longAbsoluteDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'Absolute' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string shortRelativeDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'Relative' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longRelativeDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'Relative' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string shortRelativeToNowDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longRelativeToNowDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string shortRelativeToOtherDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longRelativeToOtherDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * + * </autodoc> + */ +interface CarbonInterface extends DateTimeInterface, JsonSerializable +{ + /** + * Diff wording options(expressed in octal). + */ + public const NO_ZERO_DIFF = 01; + public const JUST_NOW = 02; + public const ONE_DAY_WORDS = 04; + public const TWO_DAY_WORDS = 010; + public const SEQUENTIAL_PARTS_ONLY = 020; + public const ROUND = 040; + public const FLOOR = 0100; + public const CEIL = 0200; + + /** + * Diff syntax options. + */ + public const DIFF_ABSOLUTE = 1; // backward compatibility with true + public const DIFF_RELATIVE_AUTO = 0; // backward compatibility with false + public const DIFF_RELATIVE_TO_NOW = 2; + public const DIFF_RELATIVE_TO_OTHER = 3; + + /** + * Translate string options. + */ + public const TRANSLATE_MONTHS = 1; + public const TRANSLATE_DAYS = 2; + public const TRANSLATE_UNITS = 4; + public const TRANSLATE_MERIDIEM = 8; + public const TRANSLATE_DIFF = 0x10; + public const TRANSLATE_ALL = self::TRANSLATE_MONTHS | self::TRANSLATE_DAYS | self::TRANSLATE_UNITS | self::TRANSLATE_MERIDIEM | self::TRANSLATE_DIFF; + + /** + * The day constants. + */ + public const SUNDAY = 0; + public const MONDAY = 1; + public const TUESDAY = 2; + public const WEDNESDAY = 3; + public const THURSDAY = 4; + public const FRIDAY = 5; + public const SATURDAY = 6; + + /** + * The month constants. + * These aren't used by Carbon itself but exist for + * convenience sake alone. + */ + public const JANUARY = 1; + public const FEBRUARY = 2; + public const MARCH = 3; + public const APRIL = 4; + public const MAY = 5; + public const JUNE = 6; + public const JULY = 7; + public const AUGUST = 8; + public const SEPTEMBER = 9; + public const OCTOBER = 10; + public const NOVEMBER = 11; + public const DECEMBER = 12; + + /** + * Number of X in Y. + */ + public const YEARS_PER_MILLENNIUM = 1000; + public const YEARS_PER_CENTURY = 100; + public const YEARS_PER_DECADE = 10; + public const MONTHS_PER_YEAR = 12; + public const MONTHS_PER_QUARTER = 3; + public const QUARTERS_PER_YEAR = 4; + public const WEEKS_PER_YEAR = 52; + public const WEEKS_PER_MONTH = 4; + public const DAYS_PER_YEAR = 365; + public const DAYS_PER_WEEK = 7; + public const HOURS_PER_DAY = 24; + public const MINUTES_PER_HOUR = 60; + public const SECONDS_PER_MINUTE = 60; + public const MILLISECONDS_PER_SECOND = 1000; + public const MICROSECONDS_PER_MILLISECOND = 1000; + public const MICROSECONDS_PER_SECOND = 1000000; + + /** + * Special settings to get the start of week from current locale culture. + */ + public const WEEK_DAY_AUTO = 'auto'; + + /** + * RFC7231 DateTime format. + * + * @var string + */ + public const RFC7231_FORMAT = 'D, d M Y H:i:s \G\M\T'; + + /** + * Default format to use for __toString method when type juggling occurs. + * + * @var string + */ + public const DEFAULT_TO_STRING_FORMAT = 'Y-m-d H:i:s'; + + /** + * Format for converting mocked time, includes microseconds. + * + * @var string + */ + public const MOCK_DATETIME_FORMAT = 'Y-m-d H:i:s.u'; + + /** + * Pattern detection for ->isoFormat and ::createFromIsoFormat. + * + * @var string + */ + public const ISO_FORMAT_REGEXP = '(O[YMDHhms]|[Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY?|g{1,5}|G{1,5}|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?)'; + + // <methods> + + /** + * Dynamically handle calls to the class. + * + * @param string $method magic method name called + * @param array $parameters parameters list + * + * @throws UnknownMethodException|BadMethodCallException|ReflectionException|Throwable + * + * @return mixed + */ + public function __call($method, $parameters); + + /** + * Dynamically handle calls to the class. + * + * @param string $method magic method name called + * @param array $parameters parameters list + * + * @throws BadMethodCallException + * + * @return mixed + */ + public static function __callStatic($method, $parameters); + + /** + * Update constructedObjectId on cloned. + */ + public function __clone(); + + /** + * Create a new Carbon instance. + * + * Please see the testing aids section (specifically static::setTestNow()) + * for more on the possibility of this constructor returning a test instance. + * + * @param DateTimeInterface|string|null $time + * @param DateTimeZone|string|null $tz + * + * @throws InvalidFormatException + */ + public function __construct($time = null, $tz = null); + + /** + * Show truthy properties on var_dump(). + * + * @return array + */ + public function __debugInfo(); + + /** + * Get a part of the Carbon object + * + * @param string $name + * + * @throws UnknownGetterException + * + * @return string|int|bool|DateTimeZone|null + */ + public function __get($name); + + /** + * Check if an attribute exists on the object + * + * @param string $name + * + * @return bool + */ + public function __isset($name); + + /** + * Set a part of the Carbon object + * + * @param string $name + * @param string|int|DateTimeZone $value + * + * @throws UnknownSetterException|ReflectionException + * + * @return void + */ + public function __set($name, $value); + + /** + * The __set_state handler. + * + * @param string|array $dump + * + * @return static + */ + #[ReturnTypeWillChange] + public static function __set_state($dump); + + /** + * Returns the list of properties to dump on serialize() called on. + * + * Only used by PHP < 7.4. + * + * @return array + */ + public function __sleep(); + + /** + * Format the instance as a string using the set format + * + * @example + * ``` + * echo Carbon::now(); // Carbon instances can be cast to string + * ``` + * + * @return string + */ + public function __toString(); + + /** + * Add given units or interval to the current instance. + * + * @example $date->add('hour', 3) + * @example $date->add(15, 'days') + * @example $date->add(CarbonInterval::days(4)) + * + * @param string|DateInterval|Closure|CarbonConverterInterface $unit + * @param int $value + * @param bool|null $overflow + * + * @return static + */ + #[ReturnTypeWillChange] + public function add($unit, $value = 1, $overflow = null); + + /** + * Add seconds to the instance using timestamp. Positive $value travels + * forward while negative $value travels into the past. + * + * @param string $unit + * @param int $value + * + * @return static + */ + public function addRealUnit($unit, $value = 1); + + /** + * Add given units to the current instance. + * + * @param string $unit + * @param int $value + * @param bool|null $overflow + * + * @return static + */ + public function addUnit($unit, $value = 1, $overflow = null); + + /** + * Add any unit to a new value without overflowing current other unit given. + * + * @param string $valueUnit unit name to modify + * @param int $value amount to add to the input unit + * @param string $overflowUnit unit name to not overflow + * + * @return static + */ + public function addUnitNoOverflow($valueUnit, $value, $overflowUnit); + + /** + * Get the difference in a human readable format in the current locale from an other + * instance given to now + * + * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: + * - 'syntax' entry (see below) + * - 'short' entry (see below) + * - 'parts' entry (see below) + * - 'options' entry (see below) + * - 'join' entry determines how to join multiple parts of the string + * ` - if $join is a string, it's used as a joiner glue + * ` - if $join is a callable/closure, it get the list of string and should return a string + * ` - if $join is an array, the first item will be the default glue, and the second item + * ` will be used instead of the glue for the last item + * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) + * ` - if $join is missing, a space will be used as glue + * if int passed, it add modifiers: + * Possible values: + * - CarbonInterface::DIFF_ABSOLUTE no modifiers + * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier + * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier + * Default value: CarbonInterface::DIFF_ABSOLUTE + * @param bool $short displays short format of time units + * @param int $parts maximum number of parts to display (default value: 1: single part) + * @param int $options human diff options + * + * @return string + */ + public function ago($syntax = null, $short = false, $parts = 1, $options = null); + + /** + * Modify the current instance to the average of a given instance (default now) and the current instance + * (second-precision). + * + * @param \Carbon\Carbon|\DateTimeInterface|null $date + * + * @return static + */ + public function average($date = null); + + /** + * Clone the current instance if it's mutable. + * + * This method is convenient to ensure you don't mutate the initial object + * but avoid to make a useless copy of it if it's already immutable. + * + * @return static + */ + public function avoidMutation(); + + /** + * Determines if the instance is between two others. + * + * The third argument allow you to specify if bounds are included or not (true by default) + * but for when you including/excluding bounds may produce different results in your application, + * we recommend to use the explicit methods ->betweenIncluded() or ->betweenExcluded() instead. + * + * @example + * ``` + * Carbon::parse('2018-07-25')->between('2018-07-14', '2018-08-01'); // true + * Carbon::parse('2018-07-25')->between('2018-08-01', '2018-08-20'); // false + * Carbon::parse('2018-07-25')->between('2018-07-25', '2018-08-01'); // true + * Carbon::parse('2018-07-25')->between('2018-07-25', '2018-08-01', false); // false + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 + * @param bool $equal Indicates if an equal to comparison should be done + * + * @return bool + */ + public function between($date1, $date2, $equal = true): bool; + + /** + * Determines if the instance is between two others, bounds excluded. + * + * @example + * ``` + * Carbon::parse('2018-07-25')->betweenExcluded('2018-07-14', '2018-08-01'); // true + * Carbon::parse('2018-07-25')->betweenExcluded('2018-08-01', '2018-08-20'); // false + * Carbon::parse('2018-07-25')->betweenExcluded('2018-07-25', '2018-08-01'); // false + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 + * + * @return bool + */ + public function betweenExcluded($date1, $date2): bool; + + /** + * Determines if the instance is between two others, bounds included. + * + * @example + * ``` + * Carbon::parse('2018-07-25')->betweenIncluded('2018-07-14', '2018-08-01'); // true + * Carbon::parse('2018-07-25')->betweenIncluded('2018-08-01', '2018-08-20'); // false + * Carbon::parse('2018-07-25')->betweenIncluded('2018-07-25', '2018-08-01'); // true + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 + * + * @return bool + */ + public function betweenIncluded($date1, $date2): bool; + + /** + * Returns either day of week + time (e.g. "Last Friday at 3:30 PM") if reference time is within 7 days, + * or a calendar date (e.g. "10/29/2017") otherwise. + * + * Language, date and time formats will change according to the current locale. + * + * @param Carbon|\DateTimeInterface|string|null $referenceTime + * @param array $formats + * + * @return string + */ + public function calendar($referenceTime = null, array $formats = []); + + /** + * Checks if the (date)time string is in a given format and valid to create a + * new instance. + * + * @example + * ``` + * Carbon::canBeCreatedFromFormat('11:12:45', 'h:i:s'); // true + * Carbon::canBeCreatedFromFormat('13:12:45', 'h:i:s'); // false + * ``` + * + * @param string $date + * @param string $format + * + * @return bool + */ + public static function canBeCreatedFromFormat($date, $format); + + /** + * Return the Carbon instance passed through, a now instance in the same timezone + * if null given or parse the input if string given. + * + * @param Carbon|\Carbon\CarbonPeriod|\Carbon\CarbonInterval|\DateInterval|\DatePeriod|DateTimeInterface|string|null $date + * + * @return static + */ + public function carbonize($date = null); + + /** + * Cast the current instance into the given class. + * + * @param string $className The $className::instance() method will be called to cast the current object. + * + * @return DateTimeInterface + */ + public function cast(string $className); + + /** + * Ceil the current instance second with given precision if specified. + * + * @param float|int|string|\DateInterval|null $precision + * + * @return CarbonInterface + */ + public function ceil($precision = 1); + + /** + * Ceil the current instance at the given unit with given precision if specified. + * + * @param string $unit + * @param float|int $precision + * + * @return CarbonInterface + */ + public function ceilUnit($unit, $precision = 1); + + /** + * Ceil the current instance week. + * + * @param int $weekStartsAt optional start allow you to specify the day of week to use to start the week + * + * @return CarbonInterface + */ + public function ceilWeek($weekStartsAt = null); + + /** + * Similar to native modify() method of DateTime but can handle more grammars. + * + * @example + * ``` + * echo Carbon::now()->change('next 2pm'); + * ``` + * + * @link https://php.net/manual/en/datetime.modify.php + * + * @param string $modifier + * + * @return static|false + */ + public function change($modifier); + + /** + * Cleanup properties attached to the public scope of DateTime when a dump of the date is requested. + * foreach ($date as $_) {} + * serializer($date) + * var_export($date) + * get_object_vars($date) + */ + public function cleanupDumpProperties(); + + /** + * @alias copy + * + * Get a copy of the instance. + * + * @return static + */ + public function clone(); + + /** + * Get the closest date from the instance (second-precision). + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 + * + * @return static + */ + public function closest($date1, $date2); + + /** + * Get a copy of the instance. + * + * @return static + */ + public function copy(); + + /** + * Create a new Carbon instance from a specific date and time. + * + * If any of $year, $month or $day are set to null their now() values will + * be used. + * + * If $hour is null it will be set to its now() value and the default + * values for $minute and $second will be their now() values. + * + * If $hour is not null then the default values for $minute and $second + * will be 0. + * + * @param DateTimeInterface|int|null $year + * @param int|null $month + * @param int|null $day + * @param int|null $hour + * @param int|null $minute + * @param int|null $second + * @param DateTimeZone|string|null $tz + * + * @throws InvalidFormatException + * + * @return static|false + */ + public static function create($year = 0, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0, $tz = null); + + /** + * Create a Carbon instance from just a date. The time portion is set to now. + * + * @param int|null $year + * @param int|null $month + * @param int|null $day + * @param DateTimeZone|string|null $tz + * + * @throws InvalidFormatException + * + * @return static + */ + public static function createFromDate($year = null, $month = null, $day = null, $tz = null); + + /** + * Create a Carbon instance from a specific format. + * + * @param string $format Datetime format + * @param string $time + * @param DateTimeZone|string|false|null $tz + * + * @throws InvalidFormatException + * + * @return static|false + */ + #[ReturnTypeWillChange] + public static function createFromFormat($format, $time, $tz = null); + + /** + * Create a Carbon instance from a specific ISO format (same replacements as ->isoFormat()). + * + * @param string $format Datetime format + * @param string $time + * @param DateTimeZone|string|false|null $tz optional timezone + * @param string|null $locale locale to be used for LTS, LT, LL, LLL, etc. macro-formats (en by fault, unneeded if no such macro-format in use) + * @param \Symfony\Component\Translation\TranslatorInterface $translator optional custom translator to use for macro-formats + * + * @throws InvalidFormatException + * + * @return static|false + */ + public static function createFromIsoFormat($format, $time, $tz = null, $locale = 'en', $translator = null); + + /** + * Create a Carbon instance from a specific format and a string in a given language. + * + * @param string $format Datetime format + * @param string $locale + * @param string $time + * @param DateTimeZone|string|false|null $tz + * + * @throws InvalidFormatException + * + * @return static|false + */ + public static function createFromLocaleFormat($format, $locale, $time, $tz = null); + + /** + * Create a Carbon instance from a specific ISO format and a string in a given language. + * + * @param string $format Datetime ISO format + * @param string $locale + * @param string $time + * @param DateTimeZone|string|false|null $tz + * + * @throws InvalidFormatException + * + * @return static|false + */ + public static function createFromLocaleIsoFormat($format, $locale, $time, $tz = null); + + /** + * Create a Carbon instance from just a time. The date portion is set to today. + * + * @param int|null $hour + * @param int|null $minute + * @param int|null $second + * @param DateTimeZone|string|null $tz + * + * @throws InvalidFormatException + * + * @return static + */ + public static function createFromTime($hour = 0, $minute = 0, $second = 0, $tz = null); + + /** + * Create a Carbon instance from a time string. The date portion is set to today. + * + * @param string $time + * @param DateTimeZone|string|null $tz + * + * @throws InvalidFormatException + * + * @return static + */ + public static function createFromTimeString($time, $tz = null); + + /** + * Create a Carbon instance from a timestamp and set the timezone (use default one if not specified). + * + * Timestamp input can be given as int, float or a string containing one or more numbers. + * + * @param float|int|string $timestamp + * @param \DateTimeZone|string|null $tz + * + * @return static + */ + public static function createFromTimestamp($timestamp, $tz = null); + + /** + * Create a Carbon instance from a timestamp in milliseconds. + * + * Timestamp input can be given as int, float or a string containing one or more numbers. + * + * @param float|int|string $timestamp + * @param \DateTimeZone|string|null $tz + * + * @return static + */ + public static function createFromTimestampMs($timestamp, $tz = null); + + /** + * Create a Carbon instance from a timestamp in milliseconds. + * + * Timestamp input can be given as int, float or a string containing one or more numbers. + * + * @param float|int|string $timestamp + * + * @return static + */ + public static function createFromTimestampMsUTC($timestamp); + + /** + * Create a Carbon instance from an timestamp keeping the timezone to UTC. + * + * Timestamp input can be given as int, float or a string containing one or more numbers. + * + * @param float|int|string $timestamp + * + * @return static + */ + public static function createFromTimestampUTC($timestamp); + + /** + * Create a Carbon instance from just a date. The time portion is set to midnight. + * + * @param int|null $year + * @param int|null $month + * @param int|null $day + * @param DateTimeZone|string|null $tz + * + * @throws InvalidFormatException + * + * @return static + */ + public static function createMidnightDate($year = null, $month = null, $day = null, $tz = null); + + /** + * Create a new safe Carbon instance from a specific date and time. + * + * If any of $year, $month or $day are set to null their now() values will + * be used. + * + * If $hour is null it will be set to its now() value and the default + * values for $minute and $second will be their now() values. + * + * If $hour is not null then the default values for $minute and $second + * will be 0. + * + * If one of the set values is not valid, an InvalidDateException + * will be thrown. + * + * @param int|null $year + * @param int|null $month + * @param int|null $day + * @param int|null $hour + * @param int|null $minute + * @param int|null $second + * @param DateTimeZone|string|null $tz + * + * @throws InvalidDateException + * + * @return static|false + */ + public static function createSafe($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $tz = null); + + /** + * Create a new Carbon instance from a specific date and time using strict validation. + * + * @see create() + * + * @param int|null $year + * @param int|null $month + * @param int|null $day + * @param int|null $hour + * @param int|null $minute + * @param int|null $second + * @param DateTimeZone|string|null $tz + * + * @throws InvalidFormatException + * + * @return static + */ + public static function createStrict(?int $year = 0, ?int $month = 1, ?int $day = 1, ?int $hour = 0, ?int $minute = 0, ?int $second = 0, $tz = null); + + /** + * Get/set the day of year. + * + * @param int|null $value new value for day of year if using as setter. + * + * @return static|int + */ + public function dayOfYear($value = null); + + /** + * Get the difference as a CarbonInterval instance. + * Return relative interval (negative if $absolute flag is not set to true and the given date is before + * current one). + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return CarbonInterval + */ + public function diffAsCarbonInterval($date = null, $absolute = true, array $skip = []); + + /** + * Get the difference by the given interval using a filter closure. + * + * @param CarbonInterval $ci An interval to traverse by + * @param Closure $callback + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffFiltered(CarbonInterval $ci, Closure $callback, $date = null, $absolute = true); + + /** + * Get the difference in a human readable format in the current locale from current instance to an other + * instance given (or now if null given). + * + * @example + * ``` + * echo Carbon::tomorrow()->diffForHumans() . "\n"; + * echo Carbon::tomorrow()->diffForHumans(['parts' => 2]) . "\n"; + * echo Carbon::tomorrow()->diffForHumans(['parts' => 3, 'join' => true]) . "\n"; + * echo Carbon::tomorrow()->diffForHumans(Carbon::yesterday()) . "\n"; + * echo Carbon::tomorrow()->diffForHumans(Carbon::yesterday(), ['short' => true]) . "\n"; + * ``` + * + * @param Carbon|\DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below; + * if null passed, now will be used as comparison reference; + * if any other type, it will be converted to date and used as reference. + * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: + * - 'syntax' entry (see below) + * - 'short' entry (see below) + * - 'parts' entry (see below) + * - 'options' entry (see below) + * - 'skip' entry, list of units to skip (array of strings or a single string, + * ` it can be the unit name (singular or plural) or its shortcut + * ` (y, m, w, d, h, min, s, ms, µs). + * - 'aUnit' entry, prefer "an hour" over "1 hour" if true + * - 'join' entry determines how to join multiple parts of the string + * ` - if $join is a string, it's used as a joiner glue + * ` - if $join is a callable/closure, it get the list of string and should return a string + * ` - if $join is an array, the first item will be the default glue, and the second item + * ` will be used instead of the glue for the last item + * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) + * ` - if $join is missing, a space will be used as glue + * - 'other' entry (see above) + * - 'minimumUnit' entry determines the smallest unit of time to display can be long or + * ` short form of the units, e.g. 'hour' or 'h' (default value: s) + * if int passed, it add modifiers: + * Possible values: + * - CarbonInterface::DIFF_ABSOLUTE no modifiers + * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier + * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier + * Default value: CarbonInterface::DIFF_ABSOLUTE + * @param bool $short displays short format of time units + * @param int $parts maximum number of parts to display (default value: 1: single unit) + * @param int $options human diff options + * + * @return string + */ + public function diffForHumans($other = null, $syntax = null, $short = false, $parts = 1, $options = null); + + /** + * Get the difference in days rounded down. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInDays($date = null, $absolute = true); + + /** + * Get the difference in days using a filter closure rounded down. + * + * @param Closure $callback + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInDaysFiltered(Closure $callback, $date = null, $absolute = true); + + /** + * Get the difference in hours rounded down. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInHours($date = null, $absolute = true); + + /** + * Get the difference in hours using a filter closure rounded down. + * + * @param Closure $callback + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInHoursFiltered(Closure $callback, $date = null, $absolute = true); + + /** + * Get the difference in microseconds. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInMicroseconds($date = null, $absolute = true); + + /** + * Get the difference in milliseconds rounded down. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInMilliseconds($date = null, $absolute = true); + + /** + * Get the difference in minutes rounded down. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInMinutes($date = null, $absolute = true); + + /** + * Get the difference in months rounded down. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInMonths($date = null, $absolute = true); + + /** + * Get the difference in quarters rounded down. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInQuarters($date = null, $absolute = true); + + /** + * Get the difference in hours rounded down using timestamps. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInRealHours($date = null, $absolute = true); + + /** + * Get the difference in microseconds using timestamps. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInRealMicroseconds($date = null, $absolute = true); + + /** + * Get the difference in milliseconds rounded down using timestamps. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInRealMilliseconds($date = null, $absolute = true); + + /** + * Get the difference in minutes rounded down using timestamps. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInRealMinutes($date = null, $absolute = true); + + /** + * Get the difference in seconds using timestamps. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInRealSeconds($date = null, $absolute = true); + + /** + * Get the difference in seconds rounded down. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInSeconds($date = null, $absolute = true); + + /** + * Get the difference in weekdays rounded down. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInWeekdays($date = null, $absolute = true); + + /** + * Get the difference in weekend days using a filter rounded down. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInWeekendDays($date = null, $absolute = true); + + /** + * Get the difference in weeks rounded down. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInWeeks($date = null, $absolute = true); + + /** + * Get the difference in years + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInYears($date = null, $absolute = true); + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * @see settings + * + * @param int $humanDiffOption + */ + public static function disableHumanDiffOption($humanDiffOption); + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * @see settings + * + * @param int $humanDiffOption + */ + public static function enableHumanDiffOption($humanDiffOption); + + /** + * Modify to end of current given unit. + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16.334455') + * ->startOf('month') + * ->endOf('week', Carbon::FRIDAY); + * ``` + * + * @param string $unit + * @param array<int, mixed> $params + * + * @return static + */ + public function endOf($unit, ...$params); + + /** + * Resets the date to end of the century and time to 23:59:59.999999 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->endOfCentury(); + * ``` + * + * @return static + */ + public function endOfCentury(); + + /** + * Resets the time to 23:59:59.999999 end of day + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->endOfDay(); + * ``` + * + * @return static + */ + public function endOfDay(); + + /** + * Resets the date to end of the decade and time to 23:59:59.999999 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->endOfDecade(); + * ``` + * + * @return static + */ + public function endOfDecade(); + + /** + * Modify to end of current hour, minutes and seconds become 59 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->endOfHour(); + * ``` + * + * @return static + */ + public function endOfHour(); + + /** + * Resets the date to end of the millennium and time to 23:59:59.999999 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->endOfMillennium(); + * ``` + * + * @return static + */ + public function endOfMillennium(); + + /** + * Modify to end of current minute, seconds become 59 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->endOfMinute(); + * ``` + * + * @return static + */ + public function endOfMinute(); + + /** + * Resets the date to end of the month and time to 23:59:59.999999 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->endOfMonth(); + * ``` + * + * @return static + */ + public function endOfMonth(); + + /** + * Resets the date to end of the quarter and time to 23:59:59.999999 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->endOfQuarter(); + * ``` + * + * @return static + */ + public function endOfQuarter(); + + /** + * Modify to end of current second, microseconds become 999999 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16.334455') + * ->endOfSecond() + * ->format('H:i:s.u'); + * ``` + * + * @return static + */ + public function endOfSecond(); + + /** + * Resets the date to end of week (defined in $weekEndsAt) and time to 23:59:59.999999 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->endOfWeek() . "\n"; + * echo Carbon::parse('2018-07-25 12:45:16')->locale('ar')->endOfWeek() . "\n"; + * echo Carbon::parse('2018-07-25 12:45:16')->endOfWeek(Carbon::SATURDAY) . "\n"; + * ``` + * + * @param int $weekEndsAt optional start allow you to specify the day of week to use to end the week + * + * @return static + */ + public function endOfWeek($weekEndsAt = null); + + /** + * Resets the date to end of the year and time to 23:59:59.999999 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->endOfYear(); + * ``` + * + * @return static + */ + public function endOfYear(); + + /** + * Determines if the instance is equal to another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->eq('2018-07-25 12:45:16'); // true + * Carbon::parse('2018-07-25 12:45:16')->eq(Carbon::parse('2018-07-25 12:45:16')); // true + * Carbon::parse('2018-07-25 12:45:16')->eq('2018-07-25 12:45:17'); // false + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see equalTo() + * + * @return bool + */ + public function eq($date): bool; + + /** + * Determines if the instance is equal to another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->equalTo('2018-07-25 12:45:16'); // true + * Carbon::parse('2018-07-25 12:45:16')->equalTo(Carbon::parse('2018-07-25 12:45:16')); // true + * Carbon::parse('2018-07-25 12:45:16')->equalTo('2018-07-25 12:45:17'); // false + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @return bool + */ + public function equalTo($date): bool; + + /** + * Set the current locale to the given, execute the passed function, reset the locale to previous one, + * then return the result of the closure (or null if the closure was void). + * + * @param string $locale locale ex. en + * @param callable $func + * + * @return mixed + */ + public static function executeWithLocale($locale, $func); + + /** + * Get the farthest date from the instance (second-precision). + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 + * + * @return static + */ + public function farthest($date1, $date2); + + /** + * Modify to the first occurrence of a given day of the week + * in the current month. If no dayOfWeek is provided, modify to the + * first day of the current month. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int|null $dayOfWeek + * + * @return static + */ + public function firstOfMonth($dayOfWeek = null); + + /** + * Modify to the first occurrence of a given day of the week + * in the current quarter. If no dayOfWeek is provided, modify to the + * first day of the current quarter. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int|null $dayOfWeek day of the week default null + * + * @return static + */ + public function firstOfQuarter($dayOfWeek = null); + + /** + * Modify to the first occurrence of a given day of the week + * in the current year. If no dayOfWeek is provided, modify to the + * first day of the current year. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int|null $dayOfWeek day of the week default null + * + * @return static + */ + public function firstOfYear($dayOfWeek = null); + + /** + * Get the difference in days as float (microsecond-precision). + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInDays($date = null, $absolute = true); + + /** + * Get the difference in hours as float (microsecond-precision). + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInHours($date = null, $absolute = true); + + /** + * Get the difference in minutes as float (microsecond-precision). + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInMinutes($date = null, $absolute = true); + + /** + * Get the difference in months as float (microsecond-precision). + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInMonths($date = null, $absolute = true); + + /** + * Get the difference in days as float (microsecond-precision). + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInRealDays($date = null, $absolute = true); + + /** + * Get the difference in hours as float (microsecond-precision) using timestamps. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInRealHours($date = null, $absolute = true); + + /** + * Get the difference in minutes as float (microsecond-precision) using timestamps. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInRealMinutes($date = null, $absolute = true); + + /** + * Get the difference in months as float (microsecond-precision) using timestamps. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInRealMonths($date = null, $absolute = true); + + /** + * Get the difference in seconds as float (microsecond-precision) using timestamps. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInRealSeconds($date = null, $absolute = true); + + /** + * Get the difference in weeks as float (microsecond-precision). + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInRealWeeks($date = null, $absolute = true); + + /** + * Get the difference in year as float (microsecond-precision) using timestamps. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInRealYears($date = null, $absolute = true); + + /** + * Get the difference in seconds as float (microsecond-precision). + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInSeconds($date = null, $absolute = true); + + /** + * Get the difference in weeks as float (microsecond-precision). + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInWeeks($date = null, $absolute = true); + + /** + * Get the difference in year as float (microsecond-precision). + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInYears($date = null, $absolute = true); + + /** + * Round the current instance second with given precision if specified. + * + * @param float|int|string|\DateInterval|null $precision + * + * @return CarbonInterface + */ + public function floor($precision = 1); + + /** + * Truncate the current instance at the given unit with given precision if specified. + * + * @param string $unit + * @param float|int $precision + * + * @return CarbonInterface + */ + public function floorUnit($unit, $precision = 1); + + /** + * Truncate the current instance week. + * + * @param int $weekStartsAt optional start allow you to specify the day of week to use to start the week + * + * @return CarbonInterface + */ + public function floorWeek($weekStartsAt = null); + + /** + * Format the instance with the current locale. You can set the current + * locale using setlocale() https://php.net/setlocale. + * + * @deprecated It uses OS language package and strftime() which is deprecated since PHP 8.1. + * Use ->isoFormat() instead. + * Deprecated since 2.55.0 + * + * @param string $format + * + * @return string + */ + public function formatLocalized($format); + + /** + * @alias diffForHumans + * + * Get the difference in a human readable format in the current locale from current instance to an other + * instance given (or now if null given). + * + * @param Carbon|\DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below; + * if null passed, now will be used as comparison reference; + * if any other type, it will be converted to date and used as reference. + * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: + * - 'syntax' entry (see below) + * - 'short' entry (see below) + * - 'parts' entry (see below) + * - 'options' entry (see below) + * - 'join' entry determines how to join multiple parts of the string + * ` - if $join is a string, it's used as a joiner glue + * ` - if $join is a callable/closure, it get the list of string and should return a string + * ` - if $join is an array, the first item will be the default glue, and the second item + * ` will be used instead of the glue for the last item + * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) + * ` - if $join is missing, a space will be used as glue + * - 'other' entry (see above) + * if int passed, it add modifiers: + * Possible values: + * - CarbonInterface::DIFF_ABSOLUTE no modifiers + * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier + * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier + * Default value: CarbonInterface::DIFF_ABSOLUTE + * @param bool $short displays short format of time units + * @param int $parts maximum number of parts to display (default value: 1: single unit) + * @param int $options human diff options + * + * @return string + */ + public function from($other = null, $syntax = null, $short = false, $parts = 1, $options = null); + + /** + * Get the difference in a human readable format in the current locale from current + * instance to now. + * + * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: + * - 'syntax' entry (see below) + * - 'short' entry (see below) + * - 'parts' entry (see below) + * - 'options' entry (see below) + * - 'join' entry determines how to join multiple parts of the string + * ` - if $join is a string, it's used as a joiner glue + * ` - if $join is a callable/closure, it get the list of string and should return a string + * ` - if $join is an array, the first item will be the default glue, and the second item + * ` will be used instead of the glue for the last item + * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) + * ` - if $join is missing, a space will be used as glue + * if int passed, it add modifiers: + * Possible values: + * - CarbonInterface::DIFF_ABSOLUTE no modifiers + * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier + * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier + * Default value: CarbonInterface::DIFF_ABSOLUTE + * @param bool $short displays short format of time units + * @param int $parts maximum number of parts to display (default value: 1: single unit) + * @param int $options human diff options + * + * @return string + */ + public function fromNow($syntax = null, $short = false, $parts = 1, $options = null); + + /** + * Create an instance from a serialized string. + * + * @param string $value + * + * @throws InvalidFormatException + * + * @return static + */ + public static function fromSerialized($value); + + /** + * Register a custom macro. + * + * @param object|callable $macro + * @param int $priority marco with higher priority is tried first + * + * @return void + */ + public static function genericMacro($macro, $priority = 0); + + /** + * Get a part of the Carbon object + * + * @param string $name + * + * @throws UnknownGetterException + * + * @return string|int|bool|DateTimeZone|null + */ + public function get($name); + + /** + * Returns the alternative number for a given date property if available in the current locale. + * + * @param string $key date property + * + * @return string + */ + public function getAltNumber(string $key): string; + + /** + * Returns the list of internally available locales and already loaded custom locales. + * (It will ignore custom translator dynamic loading.) + * + * @return array + */ + public static function getAvailableLocales(); + + /** + * Returns list of Language object for each available locale. This object allow you to get the ISO name, native + * name, region and variant of the locale. + * + * @return Language[] + */ + public static function getAvailableLocalesInfo(); + + /** + * Returns list of calendar formats for ISO formatting. + * + * @param string|null $locale current locale used if null + * + * @return array + */ + public function getCalendarFormats($locale = null); + + /** + * Get the days of the week + * + * @return array + */ + public static function getDays(); + + /** + * Return the number of days since the start of the week (using the current locale or the first parameter + * if explicitly given). + * + * @param int|null $weekStartsAt optional start allow you to specify the day of week to use to start the week, + * if not provided, start of week is inferred from the locale + * (Sunday for en_US, Monday for de_DE, etc.) + * + * @return int + */ + public function getDaysFromStartOfWeek(?int $weekStartsAt = null): int; + + /** + * Get the fallback locale. + * + * @see https://symfony.com/doc/current/components/translation.html#fallback-locales + * + * @return string|null + */ + public static function getFallbackLocale(); + + /** + * List of replacements from date() format to isoFormat(). + * + * @return array + */ + public static function getFormatsToIsoReplacements(); + + /** + * Return default humanDiff() options (merged flags as integer). + * + * @return int + */ + public static function getHumanDiffOptions(); + + /** + * Returns list of locale formats for ISO formatting. + * + * @param string|null $locale current locale used if null + * + * @return array + */ + public function getIsoFormats($locale = null); + + /** + * Returns list of locale units for ISO formatting. + * + * @return array + */ + public static function getIsoUnits(); + + /** + * {@inheritdoc} + * + * @return array + */ + #[ReturnTypeWillChange] + public static function getLastErrors(); + + /** + * Get the raw callable macro registered globally or locally for a given name. + * + * @param string $name + * + * @return callable|null + */ + public function getLocalMacro($name); + + /** + * Get the translator of the current instance or the default if none set. + * + * @return \Symfony\Component\Translation\TranslatorInterface + */ + public function getLocalTranslator(); + + /** + * Get the current translator locale. + * + * @return string + */ + public static function getLocale(); + + /** + * Get the raw callable macro registered globally for a given name. + * + * @param string $name + * + * @return callable|null + */ + public static function getMacro($name); + + /** + * get midday/noon hour + * + * @return int + */ + public static function getMidDayAt(); + + /** + * Returns the offset hour and minute formatted with +/- and a given separator (":" by default). + * For example, if the time zone is 9 hours 30 minutes, you'll get "+09:30", with "@@" as first + * argument, "+09@@30", with "" as first argument, "+0930". Negative offset will return something + * like "-12:00". + * + * @param string $separator string to place between hours and minutes (":" by default) + * + * @return string + */ + public function getOffsetString($separator = ':'); + + /** + * Returns a unit of the instance padded with 0 by default or any other string if specified. + * + * @param string $unit Carbon unit name + * @param int $length Length of the output (2 by default) + * @param string $padString String to use for padding ("0" by default) + * @param int $padType Side(s) to pad (STR_PAD_LEFT by default) + * + * @return string + */ + public function getPaddedUnit($unit, $length = 2, $padString = '0', $padType = 0); + + /** + * Returns a timestamp rounded with the given precision (6 by default). + * + * @example getPreciseTimestamp() 1532087464437474 (microsecond maximum precision) + * @example getPreciseTimestamp(6) 1532087464437474 + * @example getPreciseTimestamp(5) 153208746443747 (1/100000 second precision) + * @example getPreciseTimestamp(4) 15320874644375 (1/10000 second precision) + * @example getPreciseTimestamp(3) 1532087464437 (millisecond precision) + * @example getPreciseTimestamp(2) 153208746444 (1/100 second precision) + * @example getPreciseTimestamp(1) 15320874644 (1/10 second precision) + * @example getPreciseTimestamp(0) 1532087464 (second precision) + * @example getPreciseTimestamp(-1) 153208746 (10 second precision) + * @example getPreciseTimestamp(-2) 15320875 (100 second precision) + * + * @param int $precision + * + * @return float + */ + public function getPreciseTimestamp($precision = 6); + + /** + * Returns current local settings. + * + * @return array + */ + public function getSettings(); + + /** + * Get the Carbon instance (real or mock) to be returned when a "now" + * instance is created. + * + * @return Closure|static the current instance used for testing + */ + public static function getTestNow(); + + /** + * Return a format from H:i to H:i:s.u according to given unit precision. + * + * @param string $unitPrecision "minute", "second", "millisecond" or "microsecond" + * + * @return string + */ + public static function getTimeFormatByPrecision($unitPrecision); + + /** + * Returns the timestamp with millisecond precision. + * + * @return int + */ + public function getTimestampMs(); + + /** + * Get the translation of the current week day name (with context for languages with multiple forms). + * + * @param string|null $context whole format string + * @param string $keySuffix "", "_short" or "_min" + * @param string|null $defaultValue default value if translation missing + * + * @return string + */ + public function getTranslatedDayName($context = null, $keySuffix = '', $defaultValue = null); + + /** + * Get the translation of the current abbreviated week day name (with context for languages with multiple forms). + * + * @param string|null $context whole format string + * + * @return string + */ + public function getTranslatedMinDayName($context = null); + + /** + * Get the translation of the current month day name (with context for languages with multiple forms). + * + * @param string|null $context whole format string + * @param string $keySuffix "" or "_short" + * @param string|null $defaultValue default value if translation missing + * + * @return string + */ + public function getTranslatedMonthName($context = null, $keySuffix = '', $defaultValue = null); + + /** + * Get the translation of the current short week day name (with context for languages with multiple forms). + * + * @param string|null $context whole format string + * + * @return string + */ + public function getTranslatedShortDayName($context = null); + + /** + * Get the translation of the current short month day name (with context for languages with multiple forms). + * + * @param string|null $context whole format string + * + * @return string + */ + public function getTranslatedShortMonthName($context = null); + + /** + * Returns raw translation message for a given key. + * + * @param string $key key to find + * @param string|null $locale current locale used if null + * @param string|null $default default value if translation returns the key + * @param \Symfony\Component\Translation\TranslatorInterface $translator an optional translator to use + * + * @return string + */ + public function getTranslationMessage(string $key, ?string $locale = null, ?string $default = null, $translator = null); + + /** + * Returns raw translation message for a given key. + * + * @param \Symfony\Component\Translation\TranslatorInterface $translator the translator to use + * @param string $key key to find + * @param string|null $locale current locale used if null + * @param string|null $default default value if translation returns the key + * + * @return string + */ + public static function getTranslationMessageWith($translator, string $key, ?string $locale = null, ?string $default = null); + + /** + * Get the default translator instance in use. + * + * @return \Symfony\Component\Translation\TranslatorInterface + */ + public static function getTranslator(); + + /** + * Get the last day of week + * + * @return int + */ + public static function getWeekEndsAt(); + + /** + * Get the first day of week + * + * @return int + */ + public static function getWeekStartsAt(); + + /** + * Get weekend days + * + * @return array + */ + public static function getWeekendDays(); + + /** + * Determines if the instance is greater (after) than another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->greaterThan('2018-07-25 12:45:15'); // true + * Carbon::parse('2018-07-25 12:45:16')->greaterThan('2018-07-25 12:45:16'); // false + * Carbon::parse('2018-07-25 12:45:16')->greaterThan('2018-07-25 12:45:17'); // false + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @return bool + */ + public function greaterThan($date): bool; + + /** + * Determines if the instance is greater (after) than or equal to another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->greaterThanOrEqualTo('2018-07-25 12:45:15'); // true + * Carbon::parse('2018-07-25 12:45:16')->greaterThanOrEqualTo('2018-07-25 12:45:16'); // true + * Carbon::parse('2018-07-25 12:45:16')->greaterThanOrEqualTo('2018-07-25 12:45:17'); // false + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @return bool + */ + public function greaterThanOrEqualTo($date): bool; + + /** + * Determines if the instance is greater (after) than another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->gt('2018-07-25 12:45:15'); // true + * Carbon::parse('2018-07-25 12:45:16')->gt('2018-07-25 12:45:16'); // false + * Carbon::parse('2018-07-25 12:45:16')->gt('2018-07-25 12:45:17'); // false + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see greaterThan() + * + * @return bool + */ + public function gt($date): bool; + + /** + * Determines if the instance is greater (after) than or equal to another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->gte('2018-07-25 12:45:15'); // true + * Carbon::parse('2018-07-25 12:45:16')->gte('2018-07-25 12:45:16'); // true + * Carbon::parse('2018-07-25 12:45:16')->gte('2018-07-25 12:45:17'); // false + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see greaterThanOrEqualTo() + * + * @return bool + */ + public function gte($date): bool; + + /** + * Checks if the (date)time string is in a given format. + * + * @example + * ``` + * Carbon::hasFormat('11:12:45', 'h:i:s'); // true + * Carbon::hasFormat('13:12:45', 'h:i:s'); // false + * ``` + * + * @param string $date + * @param string $format + * + * @return bool + */ + public static function hasFormat($date, $format); + + /** + * Checks if the (date)time string is in a given format. + * + * @example + * ``` + * Carbon::hasFormatWithModifiers('31/08/2015', 'd#m#Y'); // true + * Carbon::hasFormatWithModifiers('31/08/2015', 'm#d#Y'); // false + * ``` + * + * @param string $date + * @param string $format + * + * @return bool + */ + public static function hasFormatWithModifiers($date, $format): bool; + + /** + * Checks if macro is registered globally or locally. + * + * @param string $name + * + * @return bool + */ + public function hasLocalMacro($name); + + /** + * Return true if the current instance has its own translator. + * + * @return bool + */ + public function hasLocalTranslator(); + + /** + * Checks if macro is registered globally. + * + * @param string $name + * + * @return bool + */ + public static function hasMacro($name); + + /** + * Determine if a time string will produce a relative date. + * + * @param string $time + * + * @return bool true if time match a relative date, false if absolute or invalid time string + */ + public static function hasRelativeKeywords($time); + + /** + * Determine if there is a valid test instance set. A valid test instance + * is anything that is not null. + * + * @return bool true if there is a test instance, otherwise false + */ + public static function hasTestNow(); + + /** + * Create a Carbon instance from a DateTime one. + * + * @param DateTimeInterface $date + * + * @return static + */ + public static function instance($date); + + /** + * Returns true if the current date matches the given string. + * + * @example + * ``` + * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('2019')); // true + * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('2018')); // false + * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('2019-06')); // true + * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('06-02')); // true + * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('2019-06-02')); // true + * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('Sunday')); // true + * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('June')); // true + * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('12:23')); // true + * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('12:23:45')); // true + * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('12:23:00')); // false + * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('12h')); // true + * var_dump(Carbon::parse('2019-06-02 15:23:45')->is('3pm')); // true + * var_dump(Carbon::parse('2019-06-02 15:23:45')->is('3am')); // false + * ``` + * + * @param string $tester day name, month name, hour, date, etc. as string + * + * @return bool + */ + public function is(string $tester); + + /** + * Determines if the instance is greater (after) than another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->isAfter('2018-07-25 12:45:15'); // true + * Carbon::parse('2018-07-25 12:45:16')->isAfter('2018-07-25 12:45:16'); // false + * Carbon::parse('2018-07-25 12:45:16')->isAfter('2018-07-25 12:45:17'); // false + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see greaterThan() + * + * @return bool + */ + public function isAfter($date): bool; + + /** + * Determines if the instance is less (before) than another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->isBefore('2018-07-25 12:45:15'); // false + * Carbon::parse('2018-07-25 12:45:16')->isBefore('2018-07-25 12:45:16'); // false + * Carbon::parse('2018-07-25 12:45:16')->isBefore('2018-07-25 12:45:17'); // true + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see lessThan() + * + * @return bool + */ + public function isBefore($date): bool; + + /** + * Determines if the instance is between two others + * + * @example + * ``` + * Carbon::parse('2018-07-25')->isBetween('2018-07-14', '2018-08-01'); // true + * Carbon::parse('2018-07-25')->isBetween('2018-08-01', '2018-08-20'); // false + * Carbon::parse('2018-07-25')->isBetween('2018-07-25', '2018-08-01'); // true + * Carbon::parse('2018-07-25')->isBetween('2018-07-25', '2018-08-01', false); // false + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 + * @param bool $equal Indicates if an equal to comparison should be done + * + * @return bool + */ + public function isBetween($date1, $date2, $equal = true): bool; + + /** + * Check if its the birthday. Compares the date/month values of the two dates. + * + * @example + * ``` + * Carbon::now()->subYears(5)->isBirthday(); // true + * Carbon::now()->subYears(5)->subDay()->isBirthday(); // false + * Carbon::parse('2019-06-05')->isBirthday(Carbon::parse('2001-06-05')); // true + * Carbon::parse('2019-06-05')->isBirthday(Carbon::parse('2001-06-06')); // false + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use current day. + * + * @return bool + */ + public function isBirthday($date = null); + + /** + * Determines if the instance is in the current unit given. + * + * @example + * ``` + * Carbon::now()->isCurrentUnit('hour'); // true + * Carbon::now()->subHours(2)->isCurrentUnit('hour'); // false + * ``` + * + * @param string $unit The unit to test. + * + * @throws BadMethodCallException + * + * @return bool + */ + public function isCurrentUnit($unit); + + /** + * Checks if this day is a specific day of the week. + * + * @example + * ``` + * Carbon::parse('2019-07-17')->isDayOfWeek(Carbon::WEDNESDAY); // true + * Carbon::parse('2019-07-17')->isDayOfWeek(Carbon::FRIDAY); // false + * Carbon::parse('2019-07-17')->isDayOfWeek('Wednesday'); // true + * Carbon::parse('2019-07-17')->isDayOfWeek('Friday'); // false + * ``` + * + * @param int $dayOfWeek + * + * @return bool + */ + public function isDayOfWeek($dayOfWeek); + + /** + * Check if the instance is end of day. + * + * @example + * ``` + * Carbon::parse('2019-02-28 23:59:59.999999')->isEndOfDay(); // true + * Carbon::parse('2019-02-28 23:59:59.123456')->isEndOfDay(); // true + * Carbon::parse('2019-02-28 23:59:59')->isEndOfDay(); // true + * Carbon::parse('2019-02-28 23:59:58.999999')->isEndOfDay(); // false + * Carbon::parse('2019-02-28 23:59:59.999999')->isEndOfDay(true); // true + * Carbon::parse('2019-02-28 23:59:59.123456')->isEndOfDay(true); // false + * Carbon::parse('2019-02-28 23:59:59')->isEndOfDay(true); // false + * ``` + * + * @param bool $checkMicroseconds check time at microseconds precision + * + * @return bool + */ + public function isEndOfDay($checkMicroseconds = false); + + /** + * Returns true if the date was created using CarbonImmutable::endOfTime() + * + * @return bool + */ + public function isEndOfTime(): bool; + + /** + * Determines if the instance is in the future, ie. greater (after) than now. + * + * @example + * ``` + * Carbon::now()->addHours(5)->isFuture(); // true + * Carbon::now()->subHours(5)->isFuture(); // false + * ``` + * + * @return bool + */ + public function isFuture(); + + /** + * Returns true if the current class/instance is immutable. + * + * @return bool + */ + public static function isImmutable(); + + /** + * Check if today is the last day of the Month + * + * @example + * ``` + * Carbon::parse('2019-02-28')->isLastOfMonth(); // true + * Carbon::parse('2019-03-28')->isLastOfMonth(); // false + * Carbon::parse('2019-03-30')->isLastOfMonth(); // false + * Carbon::parse('2019-03-31')->isLastOfMonth(); // true + * Carbon::parse('2019-04-30')->isLastOfMonth(); // true + * ``` + * + * @return bool + */ + public function isLastOfMonth(); + + /** + * Determines if the instance is a leap year. + * + * @example + * ``` + * Carbon::parse('2020-01-01')->isLeapYear(); // true + * Carbon::parse('2019-01-01')->isLeapYear(); // false + * ``` + * + * @return bool + */ + public function isLeapYear(); + + /** + * Determines if the instance is a long year (using ISO 8601 year). + * + * @example + * ``` + * Carbon::parse('2015-01-01')->isLongIsoYear(); // true + * Carbon::parse('2016-01-01')->isLongIsoYear(); // true + * Carbon::parse('2016-01-03')->isLongIsoYear(); // false + * Carbon::parse('2019-12-29')->isLongIsoYear(); // false + * Carbon::parse('2019-12-30')->isLongIsoYear(); // true + * ``` + * + * @see https://en.wikipedia.org/wiki/ISO_8601#Week_dates + * + * @return bool + */ + public function isLongIsoYear(); + + /** + * Determines if the instance is a long year (using calendar year). + * + * ⚠️ This method completely ignores month and day to use the numeric year number, + * it's not correct if the exact date matters. For instance as `2019-12-30` is already + * in the first week of the 2020 year, if you want to know from this date if ISO week + * year 2020 is a long year, use `isLongIsoYear` instead. + * + * @example + * ``` + * Carbon::create(2015)->isLongYear(); // true + * Carbon::create(2016)->isLongYear(); // false + * ``` + * + * @see https://en.wikipedia.org/wiki/ISO_8601#Week_dates + * + * @return bool + */ + public function isLongYear(); + + /** + * Check if the instance is midday. + * + * @example + * ``` + * Carbon::parse('2019-02-28 11:59:59.999999')->isMidday(); // false + * Carbon::parse('2019-02-28 12:00:00')->isMidday(); // true + * Carbon::parse('2019-02-28 12:00:00.999999')->isMidday(); // true + * Carbon::parse('2019-02-28 12:00:01')->isMidday(); // false + * ``` + * + * @return bool + */ + public function isMidday(); + + /** + * Check if the instance is start of day / midnight. + * + * @example + * ``` + * Carbon::parse('2019-02-28 00:00:00')->isMidnight(); // true + * Carbon::parse('2019-02-28 00:00:00.999999')->isMidnight(); // true + * Carbon::parse('2019-02-28 00:00:01')->isMidnight(); // false + * ``` + * + * @return bool + */ + public function isMidnight(); + + /** + * Returns true if a property can be changed via setter. + * + * @param string $unit + * + * @return bool + */ + public static function isModifiableUnit($unit); + + /** + * Returns true if the current class/instance is mutable. + * + * @return bool + */ + public static function isMutable(); + + /** + * Determines if the instance is in the past, ie. less (before) than now. + * + * @example + * ``` + * Carbon::now()->subHours(5)->isPast(); // true + * Carbon::now()->addHours(5)->isPast(); // false + * ``` + * + * @return bool + */ + public function isPast(); + + /** + * Compares the formatted values of the two dates. + * + * @example + * ``` + * Carbon::parse('2019-06-13')->isSameAs('Y-d', Carbon::parse('2019-12-13')); // true + * Carbon::parse('2019-06-13')->isSameAs('Y-d', Carbon::parse('2019-06-14')); // false + * ``` + * + * @param string $format date formats to compare. + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date instance to compare with or null to use current day. + * + * @return bool + */ + public function isSameAs($format, $date = null); + + /** + * Checks if the passed in date is in the same month as the instance´s month. + * + * @example + * ``` + * Carbon::parse('2019-01-12')->isSameMonth(Carbon::parse('2019-01-01')); // true + * Carbon::parse('2019-01-12')->isSameMonth(Carbon::parse('2019-02-01')); // false + * Carbon::parse('2019-01-12')->isSameMonth(Carbon::parse('2018-01-01')); // false + * Carbon::parse('2019-01-12')->isSameMonth(Carbon::parse('2018-01-01'), false); // true + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use the current date. + * @param bool $ofSameYear Check if it is the same month in the same year. + * + * @return bool + */ + public function isSameMonth($date = null, $ofSameYear = true); + + /** + * Checks if the passed in date is in the same quarter as the instance quarter (and year if needed). + * + * @example + * ``` + * Carbon::parse('2019-01-12')->isSameQuarter(Carbon::parse('2019-03-01')); // true + * Carbon::parse('2019-01-12')->isSameQuarter(Carbon::parse('2019-04-01')); // false + * Carbon::parse('2019-01-12')->isSameQuarter(Carbon::parse('2018-03-01')); // false + * Carbon::parse('2019-01-12')->isSameQuarter(Carbon::parse('2018-03-01'), false); // true + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date The instance to compare with or null to use current day. + * @param bool $ofSameYear Check if it is the same month in the same year. + * + * @return bool + */ + public function isSameQuarter($date = null, $ofSameYear = true); + + /** + * Determines if the instance is in the current unit given. + * + * @example + * ``` + * Carbon::parse('2019-01-13')->isSameUnit('year', Carbon::parse('2019-12-25')); // true + * Carbon::parse('2018-12-13')->isSameUnit('year', Carbon::parse('2019-12-25')); // false + * ``` + * + * @param string $unit singular unit string + * @param \Carbon\Carbon|\DateTimeInterface|null $date instance to compare with or null to use current day. + * + * @throws BadComparisonUnitException + * + * @return bool + */ + public function isSameUnit($unit, $date = null); + + /** + * Check if the instance is start of day / midnight. + * + * @example + * ``` + * Carbon::parse('2019-02-28 00:00:00')->isStartOfDay(); // true + * Carbon::parse('2019-02-28 00:00:00.999999')->isStartOfDay(); // true + * Carbon::parse('2019-02-28 00:00:01')->isStartOfDay(); // false + * Carbon::parse('2019-02-28 00:00:00.000000')->isStartOfDay(true); // true + * Carbon::parse('2019-02-28 00:00:00.000012')->isStartOfDay(true); // false + * ``` + * + * @param bool $checkMicroseconds check time at microseconds precision + * + * @return bool + */ + public function isStartOfDay($checkMicroseconds = false); + + /** + * Returns true if the date was created using CarbonImmutable::startOfTime() + * + * @return bool + */ + public function isStartOfTime(): bool; + + /** + * Returns true if the strict mode is globally in use, false else. + * (It can be overridden in specific instances.) + * + * @return bool + */ + public static function isStrictModeEnabled(); + + /** + * Determines if the instance is today. + * + * @example + * ``` + * Carbon::today()->isToday(); // true + * Carbon::tomorrow()->isToday(); // false + * ``` + * + * @return bool + */ + public function isToday(); + + /** + * Determines if the instance is tomorrow. + * + * @example + * ``` + * Carbon::tomorrow()->isTomorrow(); // true + * Carbon::yesterday()->isTomorrow(); // false + * ``` + * + * @return bool + */ + public function isTomorrow(); + + /** + * Determines if the instance is a weekday. + * + * @example + * ``` + * Carbon::parse('2019-07-14')->isWeekday(); // false + * Carbon::parse('2019-07-15')->isWeekday(); // true + * ``` + * + * @return bool + */ + public function isWeekday(); + + /** + * Determines if the instance is a weekend day. + * + * @example + * ``` + * Carbon::parse('2019-07-14')->isWeekend(); // true + * Carbon::parse('2019-07-15')->isWeekend(); // false + * ``` + * + * @return bool + */ + public function isWeekend(); + + /** + * Determines if the instance is yesterday. + * + * @example + * ``` + * Carbon::yesterday()->isYesterday(); // true + * Carbon::tomorrow()->isYesterday(); // false + * ``` + * + * @return bool + */ + public function isYesterday(); + + /** + * Format in the current language using ISO replacement patterns. + * + * @param string $format + * @param string|null $originalFormat provide context if a chunk has been passed alone + * + * @return string + */ + public function isoFormat(string $format, ?string $originalFormat = null): string; + + /** + * Get/set the week number using given first day of week and first + * day of year included in the first week. Or use ISO format if no settings + * given. + * + * @param int|null $week + * @param int|null $dayOfWeek + * @param int|null $dayOfYear + * + * @return int|static + */ + public function isoWeek($week = null, $dayOfWeek = null, $dayOfYear = null); + + /** + * Set/get the week number of year using given first day of week and first + * day of year included in the first week. Or use ISO format if no settings + * given. + * + * @param int|null $year if null, act as a getter, if not null, set the year and return current instance. + * @param int|null $dayOfWeek first date of week from 0 (Sunday) to 6 (Saturday) + * @param int|null $dayOfYear first day of year included in the week #1 + * + * @return int|static + */ + public function isoWeekYear($year = null, $dayOfWeek = null, $dayOfYear = null); + + /** + * Get/set the ISO weekday from 1 (Monday) to 7 (Sunday). + * + * @param int|null $value new value for weekday if using as setter. + * + * @return static|int + */ + public function isoWeekday($value = null); + + /** + * Get the number of weeks of the current week-year using given first day of week and first + * day of year included in the first week. Or use ISO format if no settings + * given. + * + * @param int|null $dayOfWeek first date of week from 0 (Sunday) to 6 (Saturday) + * @param int|null $dayOfYear first day of year included in the week #1 + * + * @return int + */ + public function isoWeeksInYear($dayOfWeek = null, $dayOfYear = null); + + /** + * Prepare the object for JSON serialization. + * + * @return array|string + */ + #[ReturnTypeWillChange] + public function jsonSerialize(); + + /** + * Modify to the last occurrence of a given day of the week + * in the current month. If no dayOfWeek is provided, modify to the + * last day of the current month. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int|null $dayOfWeek + * + * @return static + */ + public function lastOfMonth($dayOfWeek = null); + + /** + * Modify to the last occurrence of a given day of the week + * in the current quarter. If no dayOfWeek is provided, modify to the + * last day of the current quarter. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int|null $dayOfWeek day of the week default null + * + * @return static + */ + public function lastOfQuarter($dayOfWeek = null); + + /** + * Modify to the last occurrence of a given day of the week + * in the current year. If no dayOfWeek is provided, modify to the + * last day of the current year. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int|null $dayOfWeek day of the week default null + * + * @return static + */ + public function lastOfYear($dayOfWeek = null); + + /** + * Determines if the instance is less (before) than another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->lessThan('2018-07-25 12:45:15'); // false + * Carbon::parse('2018-07-25 12:45:16')->lessThan('2018-07-25 12:45:16'); // false + * Carbon::parse('2018-07-25 12:45:16')->lessThan('2018-07-25 12:45:17'); // true + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @return bool + */ + public function lessThan($date): bool; + + /** + * Determines if the instance is less (before) or equal to another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->lessThanOrEqualTo('2018-07-25 12:45:15'); // false + * Carbon::parse('2018-07-25 12:45:16')->lessThanOrEqualTo('2018-07-25 12:45:16'); // true + * Carbon::parse('2018-07-25 12:45:16')->lessThanOrEqualTo('2018-07-25 12:45:17'); // true + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @return bool + */ + public function lessThanOrEqualTo($date): bool; + + /** + * Get/set the locale for the current instance. + * + * @param string|null $locale + * @param string ...$fallbackLocales + * + * @return $this|string + */ + public function locale(?string $locale = null, ...$fallbackLocales); + + /** + * Returns true if the given locale is internally supported and has words for 1-day diff (just now, yesterday, tomorrow). + * Support is considered enabled if the 3 words are translated in the given locale. + * + * @param string $locale locale ex. en + * + * @return bool + */ + public static function localeHasDiffOneDayWords($locale); + + /** + * Returns true if the given locale is internally supported and has diff syntax support (ago, from now, before, after). + * Support is considered enabled if the 4 sentences are translated in the given locale. + * + * @param string $locale locale ex. en + * + * @return bool + */ + public static function localeHasDiffSyntax($locale); + + /** + * Returns true if the given locale is internally supported and has words for 2-days diff (before yesterday, after tomorrow). + * Support is considered enabled if the 2 words are translated in the given locale. + * + * @param string $locale locale ex. en + * + * @return bool + */ + public static function localeHasDiffTwoDayWords($locale); + + /** + * Returns true if the given locale is internally supported and has period syntax support (X times, every X, from X, to X). + * Support is considered enabled if the 4 sentences are translated in the given locale. + * + * @param string $locale locale ex. en + * + * @return bool + */ + public static function localeHasPeriodSyntax($locale); + + /** + * Returns true if the given locale is internally supported and has short-units support. + * Support is considered enabled if either year, day or hour has a short variant translated. + * + * @param string $locale locale ex. en + * + * @return bool + */ + public static function localeHasShortUnits($locale); + + /** + * Determines if the instance is less (before) than another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->lt('2018-07-25 12:45:15'); // false + * Carbon::parse('2018-07-25 12:45:16')->lt('2018-07-25 12:45:16'); // false + * Carbon::parse('2018-07-25 12:45:16')->lt('2018-07-25 12:45:17'); // true + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see lessThan() + * + * @return bool + */ + public function lt($date): bool; + + /** + * Determines if the instance is less (before) or equal to another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->lte('2018-07-25 12:45:15'); // false + * Carbon::parse('2018-07-25 12:45:16')->lte('2018-07-25 12:45:16'); // true + * Carbon::parse('2018-07-25 12:45:16')->lte('2018-07-25 12:45:17'); // true + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see lessThanOrEqualTo() + * + * @return bool + */ + public function lte($date): bool; + + /** + * Register a custom macro. + * + * @example + * ``` + * $userSettings = [ + * 'locale' => 'pt', + * 'timezone' => 'America/Sao_Paulo', + * ]; + * Carbon::macro('userFormat', function () use ($userSettings) { + * return $this->copy()->locale($userSettings['locale'])->tz($userSettings['timezone'])->calendar(); + * }); + * echo Carbon::yesterday()->hours(11)->userFormat(); + * ``` + * + * @param string $name + * @param object|callable $macro + * + * @return void + */ + public static function macro($name, $macro); + + /** + * Make a Carbon instance from given variable if possible. + * + * Always return a new instance. Parse only strings and only these likely to be dates (skip intervals + * and recurrences). Throw an exception for invalid format, but otherwise return null. + * + * @param mixed $var + * + * @throws InvalidFormatException + * + * @return static|null + */ + public static function make($var); + + /** + * Get the maximum instance between a given instance (default now) and the current instance. + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @return static + */ + public function max($date = null); + + /** + * Create a Carbon instance for the greatest supported date. + * + * @return static + */ + public static function maxValue(); + + /** + * Get the maximum instance between a given instance (default now) and the current instance. + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see max() + * + * @return static + */ + public function maximum($date = null); + + /** + * Return the meridiem of the current time in the current locale. + * + * @param bool $isLower if true, returns lowercase variant if available in the current locale. + * + * @return string + */ + public function meridiem(bool $isLower = false): string; + + /** + * Modify to midday, default to self::$midDayAt + * + * @return static + */ + public function midDay(); + + /** + * Get the minimum instance between a given instance (default now) and the current instance. + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @return static + */ + public function min($date = null); + + /** + * Create a Carbon instance for the lowest supported date. + * + * @return static + */ + public static function minValue(); + + /** + * Get the minimum instance between a given instance (default now) and the current instance. + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see min() + * + * @return static + */ + public function minimum($date = null); + + /** + * Mix another object into the class. + * + * @example + * ``` + * Carbon::mixin(new class { + * public function addMoon() { + * return function () { + * return $this->addDays(30); + * }; + * } + * public function subMoon() { + * return function () { + * return $this->subDays(30); + * }; + * } + * }); + * $fullMoon = Carbon::create('2018-12-22'); + * $nextFullMoon = $fullMoon->addMoon(); + * $blackMoon = Carbon::create('2019-01-06'); + * $previousBlackMoon = $blackMoon->subMoon(); + * echo "$nextFullMoon\n"; + * echo "$previousBlackMoon\n"; + * ``` + * + * @param object|string $mixin + * + * @throws ReflectionException + * + * @return void + */ + public static function mixin($mixin); + + /** + * Calls \DateTime::modify if mutable or \DateTimeImmutable::modify else. + * + * @see https://php.net/manual/en/datetime.modify.php + * + * @return static|false + */ + #[ReturnTypeWillChange] + public function modify($modify); + + /** + * Determines if the instance is not equal to another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->ne('2018-07-25 12:45:16'); // false + * Carbon::parse('2018-07-25 12:45:16')->ne(Carbon::parse('2018-07-25 12:45:16')); // false + * Carbon::parse('2018-07-25 12:45:16')->ne('2018-07-25 12:45:17'); // true + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see notEqualTo() + * + * @return bool + */ + public function ne($date): bool; + + /** + * Modify to the next occurrence of a given modifier such as a day of + * the week. If no modifier is provided, modify to the next occurrence + * of the current day of the week. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param string|int|null $modifier + * + * @return static|false + */ + public function next($modifier = null); + + /** + * Go forward to the next weekday. + * + * @return static + */ + public function nextWeekday(); + + /** + * Go forward to the next weekend day. + * + * @return static + */ + public function nextWeekendDay(); + + /** + * Determines if the instance is not equal to another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->notEqualTo('2018-07-25 12:45:16'); // false + * Carbon::parse('2018-07-25 12:45:16')->notEqualTo(Carbon::parse('2018-07-25 12:45:16')); // false + * Carbon::parse('2018-07-25 12:45:16')->notEqualTo('2018-07-25 12:45:17'); // true + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @return bool + */ + public function notEqualTo($date): bool; + + /** + * Get a Carbon instance for the current date and time. + * + * @param DateTimeZone|string|null $tz + * + * @return static + */ + public static function now($tz = null); + + /** + * Returns a present instance in the same timezone. + * + * @return static + */ + public function nowWithSameTz(); + + /** + * Modify to the given occurrence of a given day of the week + * in the current month. If the calculated occurrence is outside the scope + * of the current month, then return false and no modifications are made. + * Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int $nth + * @param int $dayOfWeek + * + * @return mixed + */ + public function nthOfMonth($nth, $dayOfWeek); + + /** + * Modify to the given occurrence of a given day of the week + * in the current quarter. If the calculated occurrence is outside the scope + * of the current quarter, then return false and no modifications are made. + * Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int $nth + * @param int $dayOfWeek + * + * @return mixed + */ + public function nthOfQuarter($nth, $dayOfWeek); + + /** + * Modify to the given occurrence of a given day of the week + * in the current year. If the calculated occurrence is outside the scope + * of the current year, then return false and no modifications are made. + * Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int $nth + * @param int $dayOfWeek + * + * @return mixed + */ + public function nthOfYear($nth, $dayOfWeek); + + /** + * Return a property with its ordinal. + * + * @param string $key + * @param string|null $period + * + * @return string + */ + public function ordinal(string $key, ?string $period = null): string; + + /** + * Create a carbon instance from a string. + * + * This is an alias for the constructor that allows better fluent syntax + * as it allows you to do Carbon::parse('Monday next week')->fn() rather + * than (new Carbon('Monday next week'))->fn(). + * + * @param string|DateTimeInterface|null $time + * @param DateTimeZone|string|null $tz + * + * @throws InvalidFormatException + * + * @return static + */ + public static function parse($time = null, $tz = null); + + /** + * Create a carbon instance from a localized string (in French, Japanese, Arabic, etc.). + * + * @param string $time date/time string in the given language (may also contain English). + * @param string|null $locale if locale is null or not specified, current global locale will be + * used instead. + * @param DateTimeZone|string|null $tz optional timezone for the new instance. + * + * @throws InvalidFormatException + * + * @return static + */ + public static function parseFromLocale($time, $locale = null, $tz = null); + + /** + * Returns standardized plural of a given singular/plural unit name (in English). + * + * @param string $unit + * + * @return string + */ + public static function pluralUnit(string $unit): string; + + /** + * Modify to the previous occurrence of a given modifier such as a day of + * the week. If no dayOfWeek is provided, modify to the previous occurrence + * of the current day of the week. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param string|int|null $modifier + * + * @return static|false + */ + public function previous($modifier = null); + + /** + * Go backward to the previous weekday. + * + * @return static + */ + public function previousWeekday(); + + /** + * Go backward to the previous weekend day. + * + * @return static + */ + public function previousWeekendDay(); + + /** + * Create a iterable CarbonPeriod object from current date to a given end date (and optional interval). + * + * @param \DateTimeInterface|Carbon|CarbonImmutable|null $end period end date + * @param int|\DateInterval|string|null $interval period default interval or number of the given $unit + * @param string|null $unit if specified, $interval must be an integer + * + * @return CarbonPeriod + */ + public function range($end = null, $interval = null, $unit = null); + + /** + * Call native PHP DateTime/DateTimeImmutable add() method. + * + * @param DateInterval $interval + * + * @return static + */ + public function rawAdd(DateInterval $interval); + + /** + * Create a Carbon instance from a specific format. + * + * @param string $format Datetime format + * @param string $time + * @param DateTimeZone|string|false|null $tz + * + * @throws InvalidFormatException + * + * @return static|false + */ + public static function rawCreateFromFormat($format, $time, $tz = null); + + /** + * @see https://php.net/manual/en/datetime.format.php + * + * @param string $format + * + * @return string + */ + public function rawFormat($format); + + /** + * Create a carbon instance from a string. + * + * This is an alias for the constructor that allows better fluent syntax + * as it allows you to do Carbon::parse('Monday next week')->fn() rather + * than (new Carbon('Monday next week'))->fn(). + * + * @param string|DateTimeInterface|null $time + * @param DateTimeZone|string|null $tz + * + * @throws InvalidFormatException + * + * @return static + */ + public static function rawParse($time = null, $tz = null); + + /** + * Call native PHP DateTime/DateTimeImmutable sub() method. + * + * @param DateInterval $interval + * + * @return static + */ + public function rawSub(DateInterval $interval); + + /** + * Remove all macros and generic macros. + */ + public static function resetMacros(); + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * Or you can use method variants: addMonthsWithOverflow/addMonthsNoOverflow, same variants + * are available for quarters, years, decade, centuries, millennia (singular and plural forms). + * @see settings + * + * Reset the month overflow behavior. + * + * @return void + */ + public static function resetMonthsOverflow(); + + /** + * Reset the format used to the default when type juggling a Carbon instance to a string + * + * @return void + */ + public static function resetToStringFormat(); + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * Or you can use method variants: addYearsWithOverflow/addYearsNoOverflow, same variants + * are available for quarters, years, decade, centuries, millennia (singular and plural forms). + * @see settings + * + * Reset the month overflow behavior. + * + * @return void + */ + public static function resetYearsOverflow(); + + /** + * Round the current instance second with given precision if specified. + * + * @param float|int|string|\DateInterval|null $precision + * @param string $function + * + * @return CarbonInterface + */ + public function round($precision = 1, $function = 'round'); + + /** + * Round the current instance at the given unit with given precision if specified and the given function. + * + * @param string $unit + * @param float|int $precision + * @param string $function + * + * @return CarbonInterface + */ + public function roundUnit($unit, $precision = 1, $function = 'round'); + + /** + * Round the current instance week. + * + * @param int $weekStartsAt optional start allow you to specify the day of week to use to start the week + * + * @return CarbonInterface + */ + public function roundWeek($weekStartsAt = null); + + /** + * The number of seconds since midnight. + * + * @return int + */ + public function secondsSinceMidnight(); + + /** + * The number of seconds until 23:59:59. + * + * @return int + */ + public function secondsUntilEndOfDay(); + + /** + * Return a serialized string of the instance. + * + * @return string + */ + public function serialize(); + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather transform Carbon object before the serialization. + * + * JSON serialize all Carbon instances using the given callback. + * + * @param callable $callback + * + * @return void + */ + public static function serializeUsing($callback); + + /** + * Set a part of the Carbon object + * + * @param string|array $name + * @param string|int|DateTimeZone $value + * + * @throws ImmutableException|UnknownSetterException + * + * @return $this + */ + public function set($name, $value = null); + + /** + * Set the date with gregorian year, month and day numbers. + * + * @see https://php.net/manual/en/datetime.setdate.php + * + * @param int $year + * @param int $month + * @param int $day + * + * @return static + */ + #[ReturnTypeWillChange] + public function setDate($year, $month, $day); + + /** + * Set the year, month, and date for this instance to that of the passed instance. + * + * @param Carbon|DateTimeInterface $date now if null + * + * @return static + */ + public function setDateFrom($date = null); + + /** + * Set the date and time all together. + * + * @param int $year + * @param int $month + * @param int $day + * @param int $hour + * @param int $minute + * @param int $second + * @param int $microseconds + * + * @return static + */ + public function setDateTime($year, $month, $day, $hour, $minute, $second = 0, $microseconds = 0); + + /** + * Set the date and time for this instance to that of the passed instance. + * + * @param Carbon|DateTimeInterface $date + * + * @return static + */ + public function setDateTimeFrom($date = null); + + /** + * Set the day (keeping the current time) to the start of the week + the number of days passed as the first + * parameter. First day of week is driven by the locale unless explicitly set with the second parameter. + * + * @param int $numberOfDays number of days to add after the start of the current week + * @param int|null $weekStartsAt optional start allow you to specify the day of week to use to start the week, + * if not provided, start of week is inferred from the locale + * (Sunday for en_US, Monday for de_DE, etc.) + * + * @return static + */ + public function setDaysFromStartOfWeek(int $numberOfDays, ?int $weekStartsAt = null); + + /** + * Set the fallback locale. + * + * @see https://symfony.com/doc/current/components/translation.html#fallback-locales + * + * @param string $locale + */ + public static function setFallbackLocale($locale); + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * @see settings + * + * @param int $humanDiffOptions + */ + public static function setHumanDiffOptions($humanDiffOptions); + + /** + * Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates. + * + * @see https://php.net/manual/en/datetime.setisodate.php + * + * @param int $year + * @param int $week + * @param int $day + * + * @return static + */ + #[ReturnTypeWillChange] + public function setISODate($year, $week, $day = 1); + + /** + * Set the translator for the current instance. + * + * @param \Symfony\Component\Translation\TranslatorInterface $translator + * + * @return $this + */ + public function setLocalTranslator(TranslatorInterface $translator); + + /** + * Set the current translator locale and indicate if the source locale file exists. + * Pass 'auto' as locale to use closest language from the current LC_TIME locale. + * + * @param string $locale locale ex. en + * + * @return bool + */ + public static function setLocale($locale); + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather consider mid-day is always 12pm, then if you need to test if it's an other + * hour, test it explicitly: + * $date->format('G') == 13 + * or to set explicitly to a given hour: + * $date->setTime(13, 0, 0, 0) + * + * Set midday/noon hour + * + * @param int $hour midday hour + * + * @return void + */ + public static function setMidDayAt($hour); + + /** + * Set a Carbon instance (real or mock) to be returned when a "now" + * instance is created. The provided instance will be returned + * specifically under the following conditions: + * - A call to the static now() method, ex. Carbon::now() + * - When a null (or blank string) is passed to the constructor or parse(), ex. new Carbon(null) + * - When the string "now" is passed to the constructor or parse(), ex. new Carbon('now') + * - When a string containing the desired time is passed to Carbon::parse(). + * + * Note the timezone parameter was left out of the examples above and + * has no affect as the mock value will be returned regardless of its value. + * + * Only the moment is mocked with setTestNow(), the timezone will still be the one passed + * as parameter of date_default_timezone_get() as a fallback (see setTestNowAndTimezone()). + * + * To clear the test instance call this method using the default + * parameter of null. + * + * /!\ Use this method for unit tests only. + * + * @param DateTimeInterface|Closure|static|string|false|null $testNow real or mock Carbon instance + */ + public static function setTestNow($testNow = null); + + /** + * Set a Carbon instance (real or mock) to be returned when a "now" + * instance is created. The provided instance will be returned + * specifically under the following conditions: + * - A call to the static now() method, ex. Carbon::now() + * - When a null (or blank string) is passed to the constructor or parse(), ex. new Carbon(null) + * - When the string "now" is passed to the constructor or parse(), ex. new Carbon('now') + * - When a string containing the desired time is passed to Carbon::parse(). + * + * It will also align default timezone (e.g. call date_default_timezone_set()) with + * the second argument or if null, with the timezone of the given date object. + * + * To clear the test instance call this method using the default + * parameter of null. + * + * /!\ Use this method for unit tests only. + * + * @param DateTimeInterface|Closure|static|string|false|null $testNow real or mock Carbon instance + */ + public static function setTestNowAndTimezone($testNow = null, $tz = null); + + /** + * Resets the current time of the DateTime object to a different time. + * + * @see https://php.net/manual/en/datetime.settime.php + * + * @param int $hour + * @param int $minute + * @param int $second + * @param int $microseconds + * + * @return static + */ + #[ReturnTypeWillChange] + public function setTime($hour, $minute, $second = 0, $microseconds = 0); + + /** + * Set the hour, minute, second and microseconds for this instance to that of the passed instance. + * + * @param Carbon|DateTimeInterface $date now if null + * + * @return static + */ + public function setTimeFrom($date = null); + + /** + * Set the time by time string. + * + * @param string $time + * + * @return static + */ + public function setTimeFromTimeString($time); + + /** + * Set the instance's timestamp. + * + * Timestamp input can be given as int, float or a string containing one or more numbers. + * + * @param float|int|string $unixTimestamp + * + * @return static + */ + #[ReturnTypeWillChange] + public function setTimestamp($unixTimestamp); + + /** + * Set the instance's timezone from a string or object. + * + * @param DateTimeZone|string $value + * + * @return static + */ + #[ReturnTypeWillChange] + public function setTimezone($value); + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather let Carbon object being cast to string with DEFAULT_TO_STRING_FORMAT, and + * use other method or custom format passed to format() method if you need to dump another string + * format. + * + * Set the default format used when type juggling a Carbon instance to a string. + * + * @param string|Closure|null $format + * + * @return void + */ + public static function setToStringFormat($format); + + /** + * Set the default translator instance to use. + * + * @param \Symfony\Component\Translation\TranslatorInterface $translator + * + * @return void + */ + public static function setTranslator(TranslatorInterface $translator); + + /** + * Set specified unit to new given value. + * + * @param string $unit year, month, day, hour, minute, second or microsecond + * @param int $value new value for given unit + * + * @return static + */ + public function setUnit($unit, $value = null); + + /** + * Set any unit to a new value without overflowing current other unit given. + * + * @param string $valueUnit unit name to modify + * @param int $value new value for the input unit + * @param string $overflowUnit unit name to not overflow + * + * @return static + */ + public function setUnitNoOverflow($valueUnit, $value, $overflowUnit); + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use UTF-8 language packages on every machine. + * + * Set if UTF8 will be used for localized date/time. + * + * @param bool $utf8 + */ + public static function setUtf8($utf8); + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * Use $weekStartsAt optional parameter instead when using startOfWeek, floorWeek, ceilWeek + * or roundWeek method. You can also use the 'first_day_of_week' locale setting to change the + * start of week according to current locale selected and implicitly the end of week. + * + * Set the last day of week + * + * @param int|string $day week end day (or 'auto' to get the day before the first day of week + * from Carbon::getLocale() culture). + * + * @return void + */ + public static function setWeekEndsAt($day); + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * Use $weekEndsAt optional parameter instead when using endOfWeek method. You can also use the + * 'first_day_of_week' locale setting to change the start of week according to current locale + * selected and implicitly the end of week. + * + * Set the first day of week + * + * @param int|string $day week start day (or 'auto' to get the first day of week from Carbon::getLocale() culture). + * + * @return void + */ + public static function setWeekStartsAt($day); + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather consider week-end is always saturday and sunday, and if you have some custom + * week-end days to handle, give to those days an other name and create a macro for them: + * + * ``` + * Carbon::macro('isDayOff', function ($date) { + * return $date->isSunday() || $date->isMonday(); + * }); + * Carbon::macro('isNotDayOff', function ($date) { + * return !$date->isDayOff(); + * }); + * if ($someDate->isDayOff()) ... + * if ($someDate->isNotDayOff()) ... + * // Add 5 not-off days + * $count = 5; + * while ($someDate->isDayOff() || ($count-- > 0)) { + * $someDate->addDay(); + * } + * ``` + * + * Set weekend days + * + * @param array $days + * + * @return void + */ + public static function setWeekendDays($days); + + /** + * Set specific options. + * - strictMode: true|false|null + * - monthOverflow: true|false|null + * - yearOverflow: true|false|null + * - humanDiffOptions: int|null + * - toStringFormat: string|Closure|null + * - toJsonFormat: string|Closure|null + * - locale: string|null + * - timezone: \DateTimeZone|string|int|null + * - macros: array|null + * - genericMacros: array|null + * + * @param array $settings + * + * @return $this|static + */ + public function settings(array $settings); + + /** + * Set the instance's timezone from a string or object and add/subtract the offset difference. + * + * @param DateTimeZone|string $value + * + * @return static + */ + public function shiftTimezone($value); + + /** + * Get the month overflow global behavior (can be overridden in specific instances). + * + * @return bool + */ + public static function shouldOverflowMonths(); + + /** + * Get the month overflow global behavior (can be overridden in specific instances). + * + * @return bool + */ + public static function shouldOverflowYears(); + + /** + * @alias diffForHumans + * + * Get the difference in a human readable format in the current locale from current instance to an other + * instance given (or now if null given). + */ + public function since($other = null, $syntax = null, $short = false, $parts = 1, $options = null); + + /** + * Returns standardized singular of a given singular/plural unit name (in English). + * + * @param string $unit + * + * @return string + */ + public static function singularUnit(string $unit): string; + + /** + * Modify to start of current given unit. + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16.334455') + * ->startOf('month') + * ->endOf('week', Carbon::FRIDAY); + * ``` + * + * @param string $unit + * @param array<int, mixed> $params + * + * @return static + */ + public function startOf($unit, ...$params); + + /** + * Resets the date to the first day of the century and the time to 00:00:00 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->startOfCentury(); + * ``` + * + * @return static + */ + public function startOfCentury(); + + /** + * Resets the time to 00:00:00 start of day + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->startOfDay(); + * ``` + * + * @return static + */ + public function startOfDay(); + + /** + * Resets the date to the first day of the decade and the time to 00:00:00 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->startOfDecade(); + * ``` + * + * @return static + */ + public function startOfDecade(); + + /** + * Modify to start of current hour, minutes and seconds become 0 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->startOfHour(); + * ``` + * + * @return static + */ + public function startOfHour(); + + /** + * Resets the date to the first day of the millennium and the time to 00:00:00 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->startOfMillennium(); + * ``` + * + * @return static + */ + public function startOfMillennium(); + + /** + * Modify to start of current minute, seconds become 0 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->startOfMinute(); + * ``` + * + * @return static + */ + public function startOfMinute(); + + /** + * Resets the date to the first day of the month and the time to 00:00:00 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->startOfMonth(); + * ``` + * + * @return static + */ + public function startOfMonth(); + + /** + * Resets the date to the first day of the quarter and the time to 00:00:00 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->startOfQuarter(); + * ``` + * + * @return static + */ + public function startOfQuarter(); + + /** + * Modify to start of current second, microseconds become 0 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16.334455') + * ->startOfSecond() + * ->format('H:i:s.u'); + * ``` + * + * @return static + */ + public function startOfSecond(); + + /** + * Resets the date to the first day of week (defined in $weekStartsAt) and the time to 00:00:00 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->startOfWeek() . "\n"; + * echo Carbon::parse('2018-07-25 12:45:16')->locale('ar')->startOfWeek() . "\n"; + * echo Carbon::parse('2018-07-25 12:45:16')->startOfWeek(Carbon::SUNDAY) . "\n"; + * ``` + * + * @param int $weekStartsAt optional start allow you to specify the day of week to use to start the week + * + * @return static + */ + public function startOfWeek($weekStartsAt = null); + + /** + * Resets the date to the first day of the year and the time to 00:00:00 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->startOfYear(); + * ``` + * + * @return static + */ + public function startOfYear(); + + /** + * Subtract given units or interval to the current instance. + * + * @example $date->sub('hour', 3) + * @example $date->sub(15, 'days') + * @example $date->sub(CarbonInterval::days(4)) + * + * @param string|DateInterval|Closure|CarbonConverterInterface $unit + * @param int $value + * @param bool|null $overflow + * + * @return static + */ + #[ReturnTypeWillChange] + public function sub($unit, $value = 1, $overflow = null); + + public function subRealUnit($unit, $value = 1); + + /** + * Subtract given units to the current instance. + * + * @param string $unit + * @param int $value + * @param bool|null $overflow + * + * @return static + */ + public function subUnit($unit, $value = 1, $overflow = null); + + /** + * Subtract any unit to a new value without overflowing current other unit given. + * + * @param string $valueUnit unit name to modify + * @param int $value amount to subtract to the input unit + * @param string $overflowUnit unit name to not overflow + * + * @return static + */ + public function subUnitNoOverflow($valueUnit, $value, $overflowUnit); + + /** + * Subtract given units or interval to the current instance. + * + * @see sub() + * + * @param string|DateInterval $unit + * @param int $value + * @param bool|null $overflow + * + * @return static + */ + public function subtract($unit, $value = 1, $overflow = null); + + /** + * Get the difference in a human readable format in the current locale from current instance to an other + * instance given (or now if null given). + * + * @return string + */ + public function timespan($other = null, $timezone = null); + + /** + * Set the instance's timestamp. + * + * Timestamp input can be given as int, float or a string containing one or more numbers. + * + * @param float|int|string $unixTimestamp + * + * @return static + */ + public function timestamp($unixTimestamp); + + /** + * @alias setTimezone + * + * @param DateTimeZone|string $value + * + * @return static + */ + public function timezone($value); + + /** + * Get the difference in a human readable format in the current locale from an other + * instance given (or now if null given) to current instance. + * + * When comparing a value in the past to default now: + * 1 hour from now + * 5 months from now + * + * When comparing a value in the future to default now: + * 1 hour ago + * 5 months ago + * + * When comparing a value in the past to another value: + * 1 hour after + * 5 months after + * + * When comparing a value in the future to another value: + * 1 hour before + * 5 months before + * + * @param Carbon|\DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below; + * if null passed, now will be used as comparison reference; + * if any other type, it will be converted to date and used as reference. + * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: + * - 'syntax' entry (see below) + * - 'short' entry (see below) + * - 'parts' entry (see below) + * - 'options' entry (see below) + * - 'join' entry determines how to join multiple parts of the string + * ` - if $join is a string, it's used as a joiner glue + * ` - if $join is a callable/closure, it get the list of string and should return a string + * ` - if $join is an array, the first item will be the default glue, and the second item + * ` will be used instead of the glue for the last item + * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) + * ` - if $join is missing, a space will be used as glue + * - 'other' entry (see above) + * if int passed, it add modifiers: + * Possible values: + * - CarbonInterface::DIFF_ABSOLUTE no modifiers + * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier + * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier + * Default value: CarbonInterface::DIFF_ABSOLUTE + * @param bool $short displays short format of time units + * @param int $parts maximum number of parts to display (default value: 1: single unit) + * @param int $options human diff options + * + * @return string + */ + public function to($other = null, $syntax = null, $short = false, $parts = 1, $options = null); + + /** + * Get default array representation. + * + * @example + * ``` + * var_dump(Carbon::now()->toArray()); + * ``` + * + * @return array + */ + public function toArray(); + + /** + * Format the instance as ATOM + * + * @example + * ``` + * echo Carbon::now()->toAtomString(); + * ``` + * + * @return string + */ + public function toAtomString(); + + /** + * Format the instance as COOKIE + * + * @example + * ``` + * echo Carbon::now()->toCookieString(); + * ``` + * + * @return string + */ + public function toCookieString(); + + /** + * @alias toDateTime + * + * Return native DateTime PHP object matching the current instance. + * + * @example + * ``` + * var_dump(Carbon::now()->toDate()); + * ``` + * + * @return DateTime + */ + public function toDate(); + + /** + * Format the instance as date + * + * @example + * ``` + * echo Carbon::now()->toDateString(); + * ``` + * + * @return string + */ + public function toDateString(); + + /** + * Return native DateTime PHP object matching the current instance. + * + * @example + * ``` + * var_dump(Carbon::now()->toDateTime()); + * ``` + * + * @return DateTime + */ + public function toDateTime(); + + /** + * Return native toDateTimeImmutable PHP object matching the current instance. + * + * @example + * ``` + * var_dump(Carbon::now()->toDateTimeImmutable()); + * ``` + * + * @return DateTimeImmutable + */ + public function toDateTimeImmutable(); + + /** + * Format the instance as date and time T-separated with no timezone + * + * @example + * ``` + * echo Carbon::now()->toDateTimeLocalString(); + * echo "\n"; + * echo Carbon::now()->toDateTimeLocalString('minute'); // You can specify precision among: minute, second, millisecond and microsecond + * ``` + * + * @param string $unitPrecision + * + * @return string + */ + public function toDateTimeLocalString($unitPrecision = 'second'); + + /** + * Format the instance as date and time + * + * @example + * ``` + * echo Carbon::now()->toDateTimeString(); + * ``` + * + * @param string $unitPrecision + * + * @return string + */ + public function toDateTimeString($unitPrecision = 'second'); + + /** + * Format the instance with day, date and time + * + * @example + * ``` + * echo Carbon::now()->toDayDateTimeString(); + * ``` + * + * @return string + */ + public function toDayDateTimeString(); + + /** + * Format the instance as a readable date + * + * @example + * ``` + * echo Carbon::now()->toFormattedDateString(); + * ``` + * + * @return string + */ + public function toFormattedDateString(); + + /** + * Format the instance with the day, and a readable date + * + * @example + * ``` + * echo Carbon::now()->toFormattedDayDateString(); + * ``` + * + * @return string + */ + public function toFormattedDayDateString(): string; + + /** + * Return the ISO-8601 string (ex: 1977-04-22T06:00:00Z, if $keepOffset truthy, offset will be kept: + * 1977-04-22T01:00:00-05:00). + * + * @example + * ``` + * echo Carbon::now('America/Toronto')->toISOString() . "\n"; + * echo Carbon::now('America/Toronto')->toISOString(true) . "\n"; + * ``` + * + * @param bool $keepOffset Pass true to keep the date offset. Else forced to UTC. + * + * @return null|string + */ + public function toISOString($keepOffset = false); + + /** + * Return a immutable copy of the instance. + * + * @return CarbonImmutable + */ + public function toImmutable(); + + /** + * Format the instance as ISO8601 + * + * @example + * ``` + * echo Carbon::now()->toIso8601String(); + * ``` + * + * @return string + */ + public function toIso8601String(); + + /** + * Convert the instance to UTC and return as Zulu ISO8601 + * + * @example + * ``` + * echo Carbon::now()->toIso8601ZuluString(); + * ``` + * + * @param string $unitPrecision + * + * @return string + */ + public function toIso8601ZuluString($unitPrecision = 'second'); + + /** + * Return the ISO-8601 string (ex: 1977-04-22T06:00:00Z) with UTC timezone. + * + * @example + * ``` + * echo Carbon::now('America/Toronto')->toJSON(); + * ``` + * + * @return null|string + */ + public function toJSON(); + + /** + * Return a mutable copy of the instance. + * + * @return Carbon + */ + public function toMutable(); + + /** + * Get the difference in a human readable format in the current locale from an other + * instance given to now + * + * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: + * - 'syntax' entry (see below) + * - 'short' entry (see below) + * - 'parts' entry (see below) + * - 'options' entry (see below) + * - 'join' entry determines how to join multiple parts of the string + * ` - if $join is a string, it's used as a joiner glue + * ` - if $join is a callable/closure, it get the list of string and should return a string + * ` - if $join is an array, the first item will be the default glue, and the second item + * ` will be used instead of the glue for the last item + * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) + * ` - if $join is missing, a space will be used as glue + * if int passed, it add modifiers: + * Possible values: + * - CarbonInterface::DIFF_ABSOLUTE no modifiers + * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier + * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier + * Default value: CarbonInterface::DIFF_ABSOLUTE + * @param bool $short displays short format of time units + * @param int $parts maximum number of parts to display (default value: 1: single part) + * @param int $options human diff options + * + * @return string + */ + public function toNow($syntax = null, $short = false, $parts = 1, $options = null); + + /** + * Get default object representation. + * + * @example + * ``` + * var_dump(Carbon::now()->toObject()); + * ``` + * + * @return object + */ + public function toObject(); + + /** + * Create a iterable CarbonPeriod object from current date to a given end date (and optional interval). + * + * @param \DateTimeInterface|Carbon|CarbonImmutable|int|null $end period end date or recurrences count if int + * @param int|\DateInterval|string|null $interval period default interval or number of the given $unit + * @param string|null $unit if specified, $interval must be an integer + * + * @return CarbonPeriod + */ + public function toPeriod($end = null, $interval = null, $unit = null); + + /** + * Format the instance as RFC1036 + * + * @example + * ``` + * echo Carbon::now()->toRfc1036String(); + * ``` + * + * @return string + */ + public function toRfc1036String(); + + /** + * Format the instance as RFC1123 + * + * @example + * ``` + * echo Carbon::now()->toRfc1123String(); + * ``` + * + * @return string + */ + public function toRfc1123String(); + + /** + * Format the instance as RFC2822 + * + * @example + * ``` + * echo Carbon::now()->toRfc2822String(); + * ``` + * + * @return string + */ + public function toRfc2822String(); + + /** + * Format the instance as RFC3339 + * + * @param bool $extended + * + * @example + * ``` + * echo Carbon::now()->toRfc3339String() . "\n"; + * echo Carbon::now()->toRfc3339String(true) . "\n"; + * ``` + * + * @return string + */ + public function toRfc3339String($extended = false); + + /** + * Format the instance as RFC7231 + * + * @example + * ``` + * echo Carbon::now()->toRfc7231String(); + * ``` + * + * @return string + */ + public function toRfc7231String(); + + /** + * Format the instance as RFC822 + * + * @example + * ``` + * echo Carbon::now()->toRfc822String(); + * ``` + * + * @return string + */ + public function toRfc822String(); + + /** + * Format the instance as RFC850 + * + * @example + * ``` + * echo Carbon::now()->toRfc850String(); + * ``` + * + * @return string + */ + public function toRfc850String(); + + /** + * Format the instance as RSS + * + * @example + * ``` + * echo Carbon::now()->toRssString(); + * ``` + * + * @return string + */ + public function toRssString(); + + /** + * Returns english human readable complete date string. + * + * @example + * ``` + * echo Carbon::now()->toString(); + * ``` + * + * @return string + */ + public function toString(); + + /** + * Format the instance as time + * + * @example + * ``` + * echo Carbon::now()->toTimeString(); + * ``` + * + * @param string $unitPrecision + * + * @return string + */ + public function toTimeString($unitPrecision = 'second'); + + /** + * Format the instance as W3C + * + * @example + * ``` + * echo Carbon::now()->toW3cString(); + * ``` + * + * @return string + */ + public function toW3cString(); + + /** + * Create a Carbon instance for today. + * + * @param DateTimeZone|string|null $tz + * + * @return static + */ + public static function today($tz = null); + + /** + * Create a Carbon instance for tomorrow. + * + * @param DateTimeZone|string|null $tz + * + * @return static + */ + public static function tomorrow($tz = null); + + /** + * Translate using translation string or callback available. + * + * @param string $key + * @param array $parameters + * @param string|int|float|null $number + * @param \Symfony\Component\Translation\TranslatorInterface|null $translator + * @param bool $altNumbers + * + * @return string + */ + public function translate(string $key, array $parameters = [], $number = null, ?TranslatorInterface $translator = null, bool $altNumbers = false): string; + + /** + * Returns the alternative number for a given integer if available in the current locale. + * + * @param int $number + * + * @return string + */ + public function translateNumber(int $number): string; + + /** + * Translate a time string from a locale to an other. + * + * @param string $timeString date/time/duration string to translate (may also contain English) + * @param string|null $from input locale of the $timeString parameter (`Carbon::getLocale()` by default) + * @param string|null $to output locale of the result returned (`"en"` by default) + * @param int $mode specify what to translate with options: + * - self::TRANSLATE_ALL (default) + * - CarbonInterface::TRANSLATE_MONTHS + * - CarbonInterface::TRANSLATE_DAYS + * - CarbonInterface::TRANSLATE_UNITS + * - CarbonInterface::TRANSLATE_MERIDIEM + * You can use pipe to group: CarbonInterface::TRANSLATE_MONTHS | CarbonInterface::TRANSLATE_DAYS + * + * @return string + */ + public static function translateTimeString($timeString, $from = null, $to = null, $mode = self::TRANSLATE_ALL); + + /** + * Translate a time string from the current locale (`$date->locale()`) to an other. + * + * @param string $timeString time string to translate + * @param string|null $to output locale of the result returned ("en" by default) + * + * @return string + */ + public function translateTimeStringTo($timeString, $to = null); + + /** + * Translate using translation string or callback available. + * + * @param \Symfony\Component\Translation\TranslatorInterface $translator + * @param string $key + * @param array $parameters + * @param null $number + * + * @return string + */ + public static function translateWith(TranslatorInterface $translator, string $key, array $parameters = [], $number = null): string; + + /** + * Format as ->format() do (using date replacements patterns from https://php.net/manual/en/function.date.php) + * but translate words whenever possible (months, day names, etc.) using the current locale. + * + * @param string $format + * + * @return string + */ + public function translatedFormat(string $format): string; + + /** + * Set the timezone or returns the timezone name if no arguments passed. + * + * @param DateTimeZone|string $value + * + * @return static|string + */ + public function tz($value = null); + + /** + * @alias getTimestamp + * + * Returns the UNIX timestamp for the current date. + * + * @return int + */ + public function unix(); + + /** + * @alias to + * + * Get the difference in a human readable format in the current locale from an other + * instance given (or now if null given) to current instance. + * + * @param Carbon|\DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below; + * if null passed, now will be used as comparison reference; + * if any other type, it will be converted to date and used as reference. + * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: + * - 'syntax' entry (see below) + * - 'short' entry (see below) + * - 'parts' entry (see below) + * - 'options' entry (see below) + * - 'join' entry determines how to join multiple parts of the string + * ` - if $join is a string, it's used as a joiner glue + * ` - if $join is a callable/closure, it get the list of string and should return a string + * ` - if $join is an array, the first item will be the default glue, and the second item + * ` will be used instead of the glue for the last item + * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) + * ` - if $join is missing, a space will be used as glue + * - 'other' entry (see above) + * if int passed, it add modifiers: + * Possible values: + * - CarbonInterface::DIFF_ABSOLUTE no modifiers + * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier + * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier + * Default value: CarbonInterface::DIFF_ABSOLUTE + * @param bool $short displays short format of time units + * @param int $parts maximum number of parts to display (default value: 1: single unit) + * @param int $options human diff options + * + * @return string + */ + public function until($other = null, $syntax = null, $short = false, $parts = 1, $options = null); + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * Or you can use method variants: addMonthsWithOverflow/addMonthsNoOverflow, same variants + * are available for quarters, years, decade, centuries, millennia (singular and plural forms). + * @see settings + * + * Indicates if months should be calculated with overflow. + * + * @param bool $monthsOverflow + * + * @return void + */ + public static function useMonthsOverflow($monthsOverflow = true); + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * @see settings + * + * Enable the strict mode (or disable with passing false). + * + * @param bool $strictModeEnabled + */ + public static function useStrictMode($strictModeEnabled = true); + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * Or you can use method variants: addYearsWithOverflow/addYearsNoOverflow, same variants + * are available for quarters, years, decade, centuries, millennia (singular and plural forms). + * @see settings + * + * Indicates if years should be calculated with overflow. + * + * @param bool $yearsOverflow + * + * @return void + */ + public static function useYearsOverflow($yearsOverflow = true); + + /** + * Set the instance's timezone to UTC. + * + * @return static + */ + public function utc(); + + /** + * Returns the minutes offset to UTC if no arguments passed, else set the timezone with given minutes shift passed. + * + * @param int|null $minuteOffset + * + * @return int|static + */ + public function utcOffset(?int $minuteOffset = null); + + /** + * Returns the milliseconds timestamps used amongst other by Date javascript objects. + * + * @return float + */ + public function valueOf(); + + /** + * Get/set the week number using given first day of week and first + * day of year included in the first week. Or use US format if no settings + * given (Sunday / Jan 6). + * + * @param int|null $week + * @param int|null $dayOfWeek + * @param int|null $dayOfYear + * + * @return int|static + */ + public function week($week = null, $dayOfWeek = null, $dayOfYear = null); + + /** + * Set/get the week number of year using given first day of week and first + * day of year included in the first week. Or use US format if no settings + * given (Sunday / Jan 6). + * + * @param int|null $year if null, act as a getter, if not null, set the year and return current instance. + * @param int|null $dayOfWeek first date of week from 0 (Sunday) to 6 (Saturday) + * @param int|null $dayOfYear first day of year included in the week #1 + * + * @return int|static + */ + public function weekYear($year = null, $dayOfWeek = null, $dayOfYear = null); + + /** + * Get/set the weekday from 0 (Sunday) to 6 (Saturday). + * + * @param int|null $value new value for weekday if using as setter. + * + * @return static|int + */ + public function weekday($value = null); + + /** + * Get the number of weeks of the current week-year using given first day of week and first + * day of year included in the first week. Or use US format if no settings + * given (Sunday / Jan 6). + * + * @param int|null $dayOfWeek first date of week from 0 (Sunday) to 6 (Saturday) + * @param int|null $dayOfYear first day of year included in the week #1 + * + * @return int + */ + public function weeksInYear($dayOfWeek = null, $dayOfYear = null); + + /** + * Temporarily sets a static date to be used within the callback. + * Using setTestNow to set the date, executing the callback, then + * clearing the test instance. + * + * /!\ Use this method for unit tests only. + * + * @template T + * + * @param DateTimeInterface|Closure|static|string|false|null $testNow real or mock Carbon instance + * @param Closure(): T $callback + * + * @return T + */ + public static function withTestNow($testNow, $callback); + + /** + * Create a Carbon instance for yesterday. + * + * @param DateTimeZone|string|null $tz + * + * @return static + */ + public static function yesterday($tz = null); + + // </methods> +} diff --git a/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php b/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php new file mode 100644 index 00000000..8437c545 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php @@ -0,0 +1,3054 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon; + +use Carbon\Exceptions\BadFluentConstructorException; +use Carbon\Exceptions\BadFluentSetterException; +use Carbon\Exceptions\InvalidCastException; +use Carbon\Exceptions\InvalidIntervalException; +use Carbon\Exceptions\OutOfRangeException; +use Carbon\Exceptions\ParseErrorException; +use Carbon\Exceptions\UnitNotConfiguredException; +use Carbon\Exceptions\UnknownGetterException; +use Carbon\Exceptions\UnknownSetterException; +use Carbon\Exceptions\UnknownUnitException; +use Carbon\Traits\IntervalRounding; +use Carbon\Traits\IntervalStep; +use Carbon\Traits\MagicParameter; +use Carbon\Traits\Mixin; +use Carbon\Traits\Options; +use Carbon\Traits\ToStringFormat; +use Closure; +use DateInterval; +use DateMalformedIntervalStringException; +use DateTimeInterface; +use DateTimeZone; +use Exception; +use InvalidArgumentException; +use ReflectionException; +use ReturnTypeWillChange; +use RuntimeException; +use Throwable; + +/** + * A simple API extension for DateInterval. + * The implementation provides helpers to handle weeks but only days are saved. + * Weeks are calculated based on the total days of the current instance. + * + * @property int $years Total years of the current interval. + * @property int $months Total months of the current interval. + * @property int $weeks Total weeks of the current interval calculated from the days. + * @property int $dayz Total days of the current interval (weeks * 7 + days). + * @property int $hours Total hours of the current interval. + * @property int $minutes Total minutes of the current interval. + * @property int $seconds Total seconds of the current interval. + * @property int $microseconds Total microseconds of the current interval. + * @property int $milliseconds Total milliseconds of the current interval. + * @property int $microExcludeMilli Remaining microseconds without the milliseconds. + * @property int $dayzExcludeWeeks Total days remaining in the final week of the current instance (days % 7). + * @property int $daysExcludeWeeks alias of dayzExcludeWeeks + * @property-read float $totalYears Number of years equivalent to the interval. + * @property-read float $totalMonths Number of months equivalent to the interval. + * @property-read float $totalWeeks Number of weeks equivalent to the interval. + * @property-read float $totalDays Number of days equivalent to the interval. + * @property-read float $totalDayz Alias for totalDays. + * @property-read float $totalHours Number of hours equivalent to the interval. + * @property-read float $totalMinutes Number of minutes equivalent to the interval. + * @property-read float $totalSeconds Number of seconds equivalent to the interval. + * @property-read float $totalMilliseconds Number of milliseconds equivalent to the interval. + * @property-read float $totalMicroseconds Number of microseconds equivalent to the interval. + * @property-read string $locale locale of the current instance + * + * @method static CarbonInterval years($years = 1) Create instance specifying a number of years or modify the number of years if called on an instance. + * @method static CarbonInterval year($years = 1) Alias for years() + * @method static CarbonInterval months($months = 1) Create instance specifying a number of months or modify the number of months if called on an instance. + * @method static CarbonInterval month($months = 1) Alias for months() + * @method static CarbonInterval weeks($weeks = 1) Create instance specifying a number of weeks or modify the number of weeks if called on an instance. + * @method static CarbonInterval week($weeks = 1) Alias for weeks() + * @method static CarbonInterval days($days = 1) Create instance specifying a number of days or modify the number of days if called on an instance. + * @method static CarbonInterval dayz($days = 1) Alias for days() + * @method static CarbonInterval daysExcludeWeeks($days = 1) Create instance specifying a number of days or modify the number of days (keeping the current number of weeks) if called on an instance. + * @method static CarbonInterval dayzExcludeWeeks($days = 1) Alias for daysExcludeWeeks() + * @method static CarbonInterval day($days = 1) Alias for days() + * @method static CarbonInterval hours($hours = 1) Create instance specifying a number of hours or modify the number of hours if called on an instance. + * @method static CarbonInterval hour($hours = 1) Alias for hours() + * @method static CarbonInterval minutes($minutes = 1) Create instance specifying a number of minutes or modify the number of minutes if called on an instance. + * @method static CarbonInterval minute($minutes = 1) Alias for minutes() + * @method static CarbonInterval seconds($seconds = 1) Create instance specifying a number of seconds or modify the number of seconds if called on an instance. + * @method static CarbonInterval second($seconds = 1) Alias for seconds() + * @method static CarbonInterval milliseconds($milliseconds = 1) Create instance specifying a number of milliseconds or modify the number of milliseconds if called on an instance. + * @method static CarbonInterval millisecond($milliseconds = 1) Alias for milliseconds() + * @method static CarbonInterval microseconds($microseconds = 1) Create instance specifying a number of microseconds or modify the number of microseconds if called on an instance. + * @method static CarbonInterval microsecond($microseconds = 1) Alias for microseconds() + * @method $this addYears(int $years) Add given number of years to the current interval + * @method $this subYears(int $years) Subtract given number of years to the current interval + * @method $this addMonths(int $months) Add given number of months to the current interval + * @method $this subMonths(int $months) Subtract given number of months to the current interval + * @method $this addWeeks(int|float $weeks) Add given number of weeks to the current interval + * @method $this subWeeks(int|float $weeks) Subtract given number of weeks to the current interval + * @method $this addDays(int|float $days) Add given number of days to the current interval + * @method $this subDays(int|float $days) Subtract given number of days to the current interval + * @method $this addHours(int|float $hours) Add given number of hours to the current interval + * @method $this subHours(int|float $hours) Subtract given number of hours to the current interval + * @method $this addMinutes(int|float $minutes) Add given number of minutes to the current interval + * @method $this subMinutes(int|float $minutes) Subtract given number of minutes to the current interval + * @method $this addSeconds(int|float $seconds) Add given number of seconds to the current interval + * @method $this subSeconds(int|float $seconds) Subtract given number of seconds to the current interval + * @method $this addMilliseconds(int|float $milliseconds) Add given number of milliseconds to the current interval + * @method $this subMilliseconds(int|float $milliseconds) Subtract given number of milliseconds to the current interval + * @method $this addMicroseconds(int|float $microseconds) Add given number of microseconds to the current interval + * @method $this subMicroseconds(int|float $microseconds) Subtract given number of microseconds to the current interval + * @method $this roundYear(int|float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. + * @method $this roundYears(int|float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. + * @method $this floorYear(int|float $precision = 1) Truncate the current instance year with given precision. + * @method $this floorYears(int|float $precision = 1) Truncate the current instance year with given precision. + * @method $this ceilYear(int|float $precision = 1) Ceil the current instance year with given precision. + * @method $this ceilYears(int|float $precision = 1) Ceil the current instance year with given precision. + * @method $this roundMonth(int|float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. + * @method $this roundMonths(int|float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. + * @method $this floorMonth(int|float $precision = 1) Truncate the current instance month with given precision. + * @method $this floorMonths(int|float $precision = 1) Truncate the current instance month with given precision. + * @method $this ceilMonth(int|float $precision = 1) Ceil the current instance month with given precision. + * @method $this ceilMonths(int|float $precision = 1) Ceil the current instance month with given precision. + * @method $this roundWeek(int|float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method $this roundWeeks(int|float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method $this floorWeek(int|float $precision = 1) Truncate the current instance day with given precision. + * @method $this floorWeeks(int|float $precision = 1) Truncate the current instance day with given precision. + * @method $this ceilWeek(int|float $precision = 1) Ceil the current instance day with given precision. + * @method $this ceilWeeks(int|float $precision = 1) Ceil the current instance day with given precision. + * @method $this roundDay(int|float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method $this roundDays(int|float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method $this floorDay(int|float $precision = 1) Truncate the current instance day with given precision. + * @method $this floorDays(int|float $precision = 1) Truncate the current instance day with given precision. + * @method $this ceilDay(int|float $precision = 1) Ceil the current instance day with given precision. + * @method $this ceilDays(int|float $precision = 1) Ceil the current instance day with given precision. + * @method $this roundHour(int|float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. + * @method $this roundHours(int|float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. + * @method $this floorHour(int|float $precision = 1) Truncate the current instance hour with given precision. + * @method $this floorHours(int|float $precision = 1) Truncate the current instance hour with given precision. + * @method $this ceilHour(int|float $precision = 1) Ceil the current instance hour with given precision. + * @method $this ceilHours(int|float $precision = 1) Ceil the current instance hour with given precision. + * @method $this roundMinute(int|float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. + * @method $this roundMinutes(int|float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. + * @method $this floorMinute(int|float $precision = 1) Truncate the current instance minute with given precision. + * @method $this floorMinutes(int|float $precision = 1) Truncate the current instance minute with given precision. + * @method $this ceilMinute(int|float $precision = 1) Ceil the current instance minute with given precision. + * @method $this ceilMinutes(int|float $precision = 1) Ceil the current instance minute with given precision. + * @method $this roundSecond(int|float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. + * @method $this roundSeconds(int|float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. + * @method $this floorSecond(int|float $precision = 1) Truncate the current instance second with given precision. + * @method $this floorSeconds(int|float $precision = 1) Truncate the current instance second with given precision. + * @method $this ceilSecond(int|float $precision = 1) Ceil the current instance second with given precision. + * @method $this ceilSeconds(int|float $precision = 1) Ceil the current instance second with given precision. + * @method $this roundMillennium(int|float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. + * @method $this roundMillennia(int|float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. + * @method $this floorMillennium(int|float $precision = 1) Truncate the current instance millennium with given precision. + * @method $this floorMillennia(int|float $precision = 1) Truncate the current instance millennium with given precision. + * @method $this ceilMillennium(int|float $precision = 1) Ceil the current instance millennium with given precision. + * @method $this ceilMillennia(int|float $precision = 1) Ceil the current instance millennium with given precision. + * @method $this roundCentury(int|float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. + * @method $this roundCenturies(int|float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. + * @method $this floorCentury(int|float $precision = 1) Truncate the current instance century with given precision. + * @method $this floorCenturies(int|float $precision = 1) Truncate the current instance century with given precision. + * @method $this ceilCentury(int|float $precision = 1) Ceil the current instance century with given precision. + * @method $this ceilCenturies(int|float $precision = 1) Ceil the current instance century with given precision. + * @method $this roundDecade(int|float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. + * @method $this roundDecades(int|float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. + * @method $this floorDecade(int|float $precision = 1) Truncate the current instance decade with given precision. + * @method $this floorDecades(int|float $precision = 1) Truncate the current instance decade with given precision. + * @method $this ceilDecade(int|float $precision = 1) Ceil the current instance decade with given precision. + * @method $this ceilDecades(int|float $precision = 1) Ceil the current instance decade with given precision. + * @method $this roundQuarter(int|float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. + * @method $this roundQuarters(int|float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. + * @method $this floorQuarter(int|float $precision = 1) Truncate the current instance quarter with given precision. + * @method $this floorQuarters(int|float $precision = 1) Truncate the current instance quarter with given precision. + * @method $this ceilQuarter(int|float $precision = 1) Ceil the current instance quarter with given precision. + * @method $this ceilQuarters(int|float $precision = 1) Ceil the current instance quarter with given precision. + * @method $this roundMillisecond(int|float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. + * @method $this roundMilliseconds(int|float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. + * @method $this floorMillisecond(int|float $precision = 1) Truncate the current instance millisecond with given precision. + * @method $this floorMilliseconds(int|float $precision = 1) Truncate the current instance millisecond with given precision. + * @method $this ceilMillisecond(int|float $precision = 1) Ceil the current instance millisecond with given precision. + * @method $this ceilMilliseconds(int|float $precision = 1) Ceil the current instance millisecond with given precision. + * @method $this roundMicrosecond(int|float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. + * @method $this roundMicroseconds(int|float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. + * @method $this floorMicrosecond(int|float $precision = 1) Truncate the current instance microsecond with given precision. + * @method $this floorMicroseconds(int|float $precision = 1) Truncate the current instance microsecond with given precision. + * @method $this ceilMicrosecond(int|float $precision = 1) Ceil the current instance microsecond with given precision. + * @method $this ceilMicroseconds(int|float $precision = 1) Ceil the current instance microsecond with given precision. + */ +class CarbonInterval extends DateInterval implements CarbonConverterInterface +{ + use IntervalRounding; + use IntervalStep; + use MagicParameter; + use Mixin { + Mixin::mixin as baseMixin; + } + use Options; + use ToStringFormat; + + /** + * Interval spec period designators + */ + public const PERIOD_PREFIX = 'P'; + public const PERIOD_YEARS = 'Y'; + public const PERIOD_MONTHS = 'M'; + public const PERIOD_DAYS = 'D'; + public const PERIOD_TIME_PREFIX = 'T'; + public const PERIOD_HOURS = 'H'; + public const PERIOD_MINUTES = 'M'; + public const PERIOD_SECONDS = 'S'; + + /** + * A translator to ... er ... translate stuff + * + * @var \Symfony\Component\Translation\TranslatorInterface + */ + protected static $translator; + + /** + * @var array|null + */ + protected static $cascadeFactors; + + /** + * @var array + */ + protected static $formats = [ + 'y' => 'y', + 'Y' => 'y', + 'o' => 'y', + 'm' => 'm', + 'n' => 'm', + 'W' => 'weeks', + 'd' => 'd', + 'j' => 'd', + 'z' => 'd', + 'h' => 'h', + 'g' => 'h', + 'H' => 'h', + 'G' => 'h', + 'i' => 'i', + 's' => 's', + 'u' => 'micro', + 'v' => 'milli', + ]; + + /** + * @var array|null + */ + private static $flipCascadeFactors; + + /** + * @var bool + */ + private static $floatSettersEnabled = false; + + /** + * The registered macros. + * + * @var array + */ + protected static $macros = []; + + /** + * Timezone handler for settings() method. + * + * @var mixed + */ + protected $tzName; + + /** + * Set the instance's timezone from a string or object. + * + * @param \DateTimeZone|string $tzName + * + * @return static + */ + public function setTimezone($tzName) + { + $this->tzName = $tzName; + + return $this; + } + + /** + * @internal + * + * Set the instance's timezone from a string or object and add/subtract the offset difference. + * + * @param \DateTimeZone|string $tzName + * + * @return static + */ + public function shiftTimezone($tzName) + { + $this->tzName = $tzName; + + return $this; + } + + /** + * Mapping of units and factors for cascading. + * + * Should only be modified by changing the factors or referenced constants. + * + * @return array + */ + public static function getCascadeFactors() + { + return static::$cascadeFactors ?: static::getDefaultCascadeFactors(); + } + + protected static function getDefaultCascadeFactors(): array + { + return [ + 'milliseconds' => [Carbon::MICROSECONDS_PER_MILLISECOND, 'microseconds'], + 'seconds' => [Carbon::MILLISECONDS_PER_SECOND, 'milliseconds'], + 'minutes' => [Carbon::SECONDS_PER_MINUTE, 'seconds'], + 'hours' => [Carbon::MINUTES_PER_HOUR, 'minutes'], + 'dayz' => [Carbon::HOURS_PER_DAY, 'hours'], + 'weeks' => [Carbon::DAYS_PER_WEEK, 'dayz'], + 'months' => [Carbon::WEEKS_PER_MONTH, 'weeks'], + 'years' => [Carbon::MONTHS_PER_YEAR, 'months'], + ]; + } + + private static function standardizeUnit($unit) + { + $unit = rtrim($unit, 'sz').'s'; + + return $unit === 'days' ? 'dayz' : $unit; + } + + private static function getFlipCascadeFactors() + { + if (!self::$flipCascadeFactors) { + self::$flipCascadeFactors = []; + + foreach (static::getCascadeFactors() as $to => [$factor, $from]) { + self::$flipCascadeFactors[self::standardizeUnit($from)] = [self::standardizeUnit($to), $factor]; + } + } + + return self::$flipCascadeFactors; + } + + /** + * Set default cascading factors for ->cascade() method. + * + * @param array $cascadeFactors + */ + public static function setCascadeFactors(array $cascadeFactors) + { + self::$flipCascadeFactors = null; + static::$cascadeFactors = $cascadeFactors; + } + + /** + * This option allow you to opt-in for the Carbon 3 behavior where float + * values will no longer be cast to integer (so truncated). + * + * ⚠️ This settings will be applied globally, which mean your whole application + * code including the third-party dependencies that also may use Carbon will + * adopt the new behavior. + */ + public static function enableFloatSetters(bool $floatSettersEnabled = true): void + { + self::$floatSettersEnabled = $floatSettersEnabled; + } + + /////////////////////////////////////////////////////////////////// + //////////////////////////// CONSTRUCTORS ///////////////////////// + /////////////////////////////////////////////////////////////////// + + /** + * Create a new CarbonInterval instance. + * + * @param Closure|DateInterval|string|int|null $years + * @param int|float|null $months + * @param int|float|null $weeks + * @param int|float|null $days + * @param int|float|null $hours + * @param int|float|null $minutes + * @param int|float|null $seconds + * @param int|float|null $microseconds + * + * @throws Exception when the interval_spec (passed as $years) cannot be parsed as an interval. + */ + public function __construct($years = 1, $months = null, $weeks = null, $days = null, $hours = null, $minutes = null, $seconds = null, $microseconds = null) + { + if ($years instanceof Closure) { + $this->step = $years; + $years = null; + } + + if ($years instanceof DateInterval) { + parent::__construct(static::getDateIntervalSpec($years)); + $this->f = $years->f; + self::copyNegativeUnits($years, $this); + + return; + } + + $spec = $years; + $isStringSpec = (\is_string($spec) && !preg_match('/^[\d.]/', $spec)); + + if (!$isStringSpec || (float) $years) { + $spec = static::PERIOD_PREFIX; + + $spec .= $years > 0 ? $years.static::PERIOD_YEARS : ''; + $spec .= $months > 0 ? $months.static::PERIOD_MONTHS : ''; + + $specDays = 0; + $specDays += $weeks > 0 ? $weeks * static::getDaysPerWeek() : 0; + $specDays += $days > 0 ? $days : 0; + + $spec .= $specDays > 0 ? $specDays.static::PERIOD_DAYS : ''; + + if ($hours > 0 || $minutes > 0 || $seconds > 0) { + $spec .= static::PERIOD_TIME_PREFIX; + $spec .= $hours > 0 ? $hours.static::PERIOD_HOURS : ''; + $spec .= $minutes > 0 ? $minutes.static::PERIOD_MINUTES : ''; + $spec .= $seconds > 0 ? $seconds.static::PERIOD_SECONDS : ''; + } + + if ($spec === static::PERIOD_PREFIX) { + // Allow the zero interval. + $spec .= '0'.static::PERIOD_YEARS; + } + } + + try { + parent::__construct($spec); + } catch (Throwable $exception) { + try { + parent::__construct('PT0S'); + + if ($isStringSpec) { + if (!preg_match('/^P + (?:(?<year>[+-]?\d*(?:\.\d+)?)Y)? + (?:(?<month>[+-]?\d*(?:\.\d+)?)M)? + (?:(?<week>[+-]?\d*(?:\.\d+)?)W)? + (?:(?<day>[+-]?\d*(?:\.\d+)?)D)? + (?:T + (?:(?<hour>[+-]?\d*(?:\.\d+)?)H)? + (?:(?<minute>[+-]?\d*(?:\.\d+)?)M)? + (?:(?<second>[+-]?\d*(?:\.\d+)?)S)? + )? + $/x', $spec, $match)) { + throw new InvalidArgumentException("Invalid duration: $spec"); + } + + $years = (float) ($match['year'] ?? 0); + $this->assertSafeForInteger('year', $years); + $months = (float) ($match['month'] ?? 0); + $this->assertSafeForInteger('month', $months); + $weeks = (float) ($match['week'] ?? 0); + $this->assertSafeForInteger('week', $weeks); + $days = (float) ($match['day'] ?? 0); + $this->assertSafeForInteger('day', $days); + $hours = (float) ($match['hour'] ?? 0); + $this->assertSafeForInteger('hour', $hours); + $minutes = (float) ($match['minute'] ?? 0); + $this->assertSafeForInteger('minute', $minutes); + $seconds = (float) ($match['second'] ?? 0); + $this->assertSafeForInteger('second', $seconds); + } + + $totalDays = (($weeks * static::getDaysPerWeek()) + $days); + $this->assertSafeForInteger('days total (including weeks)', $totalDays); + + $this->y = (int) $years; + $this->m = (int) $months; + $this->d = (int) $totalDays; + $this->h = (int) $hours; + $this->i = (int) $minutes; + $this->s = (int) $seconds; + + if ( + ((float) $this->y) !== $years || + ((float) $this->m) !== $months || + ((float) $this->d) !== $totalDays || + ((float) $this->h) !== $hours || + ((float) $this->i) !== $minutes || + ((float) $this->s) !== $seconds + ) { + $this->add(static::fromString( + ($years - $this->y).' years '. + ($months - $this->m).' months '. + ($totalDays - $this->d).' days '. + ($hours - $this->h).' hours '. + ($minutes - $this->i).' minutes '. + ($seconds - $this->s).' seconds ' + )); + } + } catch (Throwable $secondException) { + throw $secondException instanceof OutOfRangeException ? $secondException : $exception; + } + } + + if ($microseconds !== null) { + $this->f = $microseconds / Carbon::MICROSECONDS_PER_SECOND; + } + } + + /** + * Returns the factor for a given source-to-target couple. + * + * @param string $source + * @param string $target + * + * @return int|float|null + */ + public static function getFactor($source, $target) + { + $source = self::standardizeUnit($source); + $target = self::standardizeUnit($target); + $factors = self::getFlipCascadeFactors(); + + if (isset($factors[$source])) { + [$to, $factor] = $factors[$source]; + + if ($to === $target) { + return $factor; + } + + return $factor * static::getFactor($to, $target); + } + + return null; + } + + /** + * Returns the factor for a given source-to-target couple if set, + * else try to find the appropriate constant as the factor, such as Carbon::DAYS_PER_WEEK. + * + * @param string $source + * @param string $target + * + * @return int|float|null + */ + public static function getFactorWithDefault($source, $target) + { + $factor = self::getFactor($source, $target); + + if ($factor) { + return $factor; + } + + static $defaults = [ + 'month' => ['year' => Carbon::MONTHS_PER_YEAR], + 'week' => ['month' => Carbon::WEEKS_PER_MONTH], + 'day' => ['week' => Carbon::DAYS_PER_WEEK], + 'hour' => ['day' => Carbon::HOURS_PER_DAY], + 'minute' => ['hour' => Carbon::MINUTES_PER_HOUR], + 'second' => ['minute' => Carbon::SECONDS_PER_MINUTE], + 'millisecond' => ['second' => Carbon::MILLISECONDS_PER_SECOND], + 'microsecond' => ['millisecond' => Carbon::MICROSECONDS_PER_MILLISECOND], + ]; + + return $defaults[$source][$target] ?? null; + } + + /** + * Returns current config for days per week. + * + * @return int|float + */ + public static function getDaysPerWeek() + { + return static::getFactor('dayz', 'weeks') ?: Carbon::DAYS_PER_WEEK; + } + + /** + * Returns current config for hours per day. + * + * @return int|float + */ + public static function getHoursPerDay() + { + return static::getFactor('hours', 'dayz') ?: Carbon::HOURS_PER_DAY; + } + + /** + * Returns current config for minutes per hour. + * + * @return int|float + */ + public static function getMinutesPerHour() + { + return static::getFactor('minutes', 'hours') ?: Carbon::MINUTES_PER_HOUR; + } + + /** + * Returns current config for seconds per minute. + * + * @return int|float + */ + public static function getSecondsPerMinute() + { + return static::getFactor('seconds', 'minutes') ?: Carbon::SECONDS_PER_MINUTE; + } + + /** + * Returns current config for microseconds per second. + * + * @return int|float + */ + public static function getMillisecondsPerSecond() + { + return static::getFactor('milliseconds', 'seconds') ?: Carbon::MILLISECONDS_PER_SECOND; + } + + /** + * Returns current config for microseconds per second. + * + * @return int|float + */ + public static function getMicrosecondsPerMillisecond() + { + return static::getFactor('microseconds', 'milliseconds') ?: Carbon::MICROSECONDS_PER_MILLISECOND; + } + + /** + * Create a new CarbonInterval instance from specific values. + * This is an alias for the constructor that allows better fluent + * syntax as it allows you to do CarbonInterval::create(1)->fn() rather than + * (new CarbonInterval(1))->fn(). + * + * @param int $years + * @param int $months + * @param int $weeks + * @param int $days + * @param int $hours + * @param int $minutes + * @param int $seconds + * @param int $microseconds + * + * @throws Exception when the interval_spec (passed as $years) cannot be parsed as an interval. + * + * @return static + */ + public static function create($years = 1, $months = null, $weeks = null, $days = null, $hours = null, $minutes = null, $seconds = null, $microseconds = null) + { + return new static($years, $months, $weeks, $days, $hours, $minutes, $seconds, $microseconds); + } + + /** + * Parse a string into a new CarbonInterval object according to the specified format. + * + * @example + * ``` + * echo Carboninterval::createFromFormat('H:i', '1:30'); + * ``` + * + * @param string $format Format of the $interval input string + * @param string|null $interval Input string to convert into an interval + * + * @throws \Carbon\Exceptions\ParseErrorException when the $interval cannot be parsed as an interval. + * + * @return static + */ + public static function createFromFormat(string $format, ?string $interval) + { + $instance = new static(0); + $length = mb_strlen($format); + + if (preg_match('/s([,.])([uv])$/', $format, $match)) { + $interval = explode($match[1], $interval); + $index = \count($interval) - 1; + $interval[$index] = str_pad($interval[$index], $match[2] === 'v' ? 3 : 6, '0'); + $interval = implode($match[1], $interval); + } + + $interval = $interval ?? ''; + + for ($index = 0; $index < $length; $index++) { + $expected = mb_substr($format, $index, 1); + $nextCharacter = mb_substr($interval, 0, 1); + $unit = static::$formats[$expected] ?? null; + + if ($unit) { + if (!preg_match('/^-?\d+/', $interval, $match)) { + throw new ParseErrorException('number', $nextCharacter); + } + + $interval = mb_substr($interval, mb_strlen($match[0])); + $instance->$unit += (int) ($match[0]); + + continue; + } + + if ($nextCharacter !== $expected) { + throw new ParseErrorException( + "'$expected'", + $nextCharacter, + 'Allowed substitutes for interval formats are '.implode(', ', array_keys(static::$formats))."\n". + 'See https://php.net/manual/en/function.date.php for their meaning' + ); + } + + $interval = mb_substr($interval, 1); + } + + if ($interval !== '') { + throw new ParseErrorException( + 'end of string', + $interval + ); + } + + return $instance; + } + + /** + * Get a copy of the instance. + * + * @return static + */ + public function copy() + { + $date = new static(0); + $date->copyProperties($this); + $date->step = $this->step; + + return $date; + } + + /** + * Get a copy of the instance. + * + * @return static + */ + public function clone() + { + return $this->copy(); + } + + /** + * Provide static helpers to create instances. Allows CarbonInterval::years(3). + * + * Note: This is done using the magic method to allow static and instance methods to + * have the same names. + * + * @param string $method magic method name called + * @param array $parameters parameters list + * + * @return static|null + */ + public static function __callStatic($method, $parameters) + { + try { + $interval = new static(0); + $localStrictModeEnabled = $interval->localStrictModeEnabled; + $interval->localStrictModeEnabled = true; + + $result = static::hasMacro($method) + ? static::bindMacroContext(null, function () use (&$method, &$parameters, &$interval) { + return $interval->callMacro($method, $parameters); + }) + : $interval->$method(...$parameters); + + $interval->localStrictModeEnabled = $localStrictModeEnabled; + + return $result; + } catch (BadFluentSetterException $exception) { + if (Carbon::isStrictModeEnabled()) { + throw new BadFluentConstructorException($method, 0, $exception); + } + + return null; + } + } + + /** + * Evaluate the PHP generated by var_export() and recreate the exported CarbonInterval instance. + * + * @param array $dump data as exported by var_export() + * + * @return static + */ + #[ReturnTypeWillChange] + public static function __set_state($dump) + { + /** @noinspection PhpVoidFunctionResultUsedInspection */ + /** @var DateInterval $dateInterval */ + $dateInterval = parent::__set_state($dump); + + return static::instance($dateInterval); + } + + /** + * Return the current context from inside a macro callee or a new one if static. + * + * @return static + */ + protected static function this() + { + return end(static::$macroContextStack) ?: new static(0); + } + + /** + * Creates a CarbonInterval from string. + * + * Format: + * + * Suffix | Unit | Example | DateInterval expression + * -------|---------|---------|------------------------ + * y | years | 1y | P1Y + * mo | months | 3mo | P3M + * w | weeks | 2w | P2W + * d | days | 28d | P28D + * h | hours | 4h | PT4H + * m | minutes | 12m | PT12M + * s | seconds | 59s | PT59S + * + * e. g. `1w 3d 4h 32m 23s` is converted to 10 days 4 hours 32 minutes and 23 seconds. + * + * Special cases: + * - An empty string will return a zero interval + * - Fractions are allowed for weeks, days, hours and minutes and will be converted + * and rounded to the next smaller value (caution: 0.5w = 4d) + * + * @param string $intervalDefinition + * + * @return static + */ + public static function fromString($intervalDefinition) + { + if (empty($intervalDefinition)) { + return new static(0); + } + + $years = 0; + $months = 0; + $weeks = 0; + $days = 0; + $hours = 0; + $minutes = 0; + $seconds = 0; + $milliseconds = 0; + $microseconds = 0; + + $pattern = '/(\d+(?:\.\d+)?)\h*([^\d\h]*)/i'; + preg_match_all($pattern, $intervalDefinition, $parts, PREG_SET_ORDER); + + while ([$part, $value, $unit] = array_shift($parts)) { + $intValue = (int) $value; + $fraction = (float) $value - $intValue; + + // Fix calculation precision + switch (round($fraction, 6)) { + case 1: + $fraction = 0; + $intValue++; + + break; + case 0: + $fraction = 0; + + break; + } + + switch ($unit === 'µs' ? 'µs' : strtolower($unit)) { + case 'millennia': + case 'millennium': + $years += $intValue * CarbonInterface::YEARS_PER_MILLENNIUM; + + break; + + case 'century': + case 'centuries': + $years += $intValue * CarbonInterface::YEARS_PER_CENTURY; + + break; + + case 'decade': + case 'decades': + $years += $intValue * CarbonInterface::YEARS_PER_DECADE; + + break; + + case 'year': + case 'years': + case 'y': + case 'yr': + case 'yrs': + $years += $intValue; + + break; + + case 'quarter': + case 'quarters': + $months += $intValue * CarbonInterface::MONTHS_PER_QUARTER; + + break; + + case 'month': + case 'months': + case 'mo': + case 'mos': + $months += $intValue; + + break; + + case 'week': + case 'weeks': + case 'w': + $weeks += $intValue; + + if ($fraction) { + $parts[] = [null, $fraction * static::getDaysPerWeek(), 'd']; + } + + break; + + case 'day': + case 'days': + case 'd': + $days += $intValue; + + if ($fraction) { + $parts[] = [null, $fraction * static::getHoursPerDay(), 'h']; + } + + break; + + case 'hour': + case 'hours': + case 'h': + $hours += $intValue; + + if ($fraction) { + $parts[] = [null, $fraction * static::getMinutesPerHour(), 'm']; + } + + break; + + case 'minute': + case 'minutes': + case 'm': + $minutes += $intValue; + + if ($fraction) { + $parts[] = [null, $fraction * static::getSecondsPerMinute(), 's']; + } + + break; + + case 'second': + case 'seconds': + case 's': + $seconds += $intValue; + + if ($fraction) { + $parts[] = [null, $fraction * static::getMillisecondsPerSecond(), 'ms']; + } + + break; + + case 'millisecond': + case 'milliseconds': + case 'milli': + case 'ms': + $milliseconds += $intValue; + + if ($fraction) { + $microseconds += round($fraction * static::getMicrosecondsPerMillisecond()); + } + + break; + + case 'microsecond': + case 'microseconds': + case 'micro': + case 'µs': + $microseconds += $intValue; + + break; + + default: + throw new InvalidIntervalException( + sprintf('Invalid part %s in definition %s', $part, $intervalDefinition) + ); + } + } + + return new static($years, $months, $weeks, $days, $hours, $minutes, $seconds, $milliseconds * Carbon::MICROSECONDS_PER_MILLISECOND + $microseconds); + } + + /** + * Creates a CarbonInterval from string using a different locale. + * + * @param string $interval interval string in the given language (may also contain English). + * @param string|null $locale if locale is null or not specified, current global locale will be used instead. + * + * @return static + */ + public static function parseFromLocale($interval, $locale = null) + { + return static::fromString(Carbon::translateTimeString($interval, $locale ?: static::getLocale(), 'en')); + } + + private static function castIntervalToClass(DateInterval $interval, string $className, array $skip = []) + { + $mainClass = DateInterval::class; + + if (!is_a($className, $mainClass, true)) { + throw new InvalidCastException("$className is not a sub-class of $mainClass."); + } + + $microseconds = $interval->f; + $instance = new $className(static::getDateIntervalSpec($interval, false, $skip)); + + if ($microseconds) { + $instance->f = $microseconds; + } + + if ($interval instanceof self && is_a($className, self::class, true)) { + self::copyStep($interval, $instance); + } + + self::copyNegativeUnits($interval, $instance); + + return $instance; + } + + private static function copyNegativeUnits(DateInterval $from, DateInterval $to): void + { + $to->invert = $from->invert; + + foreach (['y', 'm', 'd', 'h', 'i', 's'] as $unit) { + if ($from->$unit < 0) { + $to->$unit *= -1; + } + } + } + + private static function copyStep(self $from, self $to): void + { + $to->setStep($from->getStep()); + } + + /** + * Cast the current instance into the given class. + * + * @param string $className The $className::instance() method will be called to cast the current object. + * + * @return DateInterval + */ + public function cast(string $className) + { + return self::castIntervalToClass($this, $className); + } + + /** + * Create a CarbonInterval instance from a DateInterval one. Can not instance + * DateInterval objects created from DateTime::diff() as you can't externally + * set the $days field. + * + * @param DateInterval $interval + * @param bool $skipCopy set to true to return the passed object + * (without copying it) if it's already of the + * current class + * + * @return static + */ + public static function instance(DateInterval $interval, array $skip = [], bool $skipCopy = false) + { + if ($skipCopy && $interval instanceof static) { + return $interval; + } + + return self::castIntervalToClass($interval, static::class, $skip); + } + + /** + * Make a CarbonInterval instance from given variable if possible. + * + * Always return a new instance. Parse only strings and only these likely to be intervals (skip dates + * and recurrences). Throw an exception for invalid format, but otherwise return null. + * + * @param mixed|int|DateInterval|string|Closure|null $interval interval or number of the given $unit + * @param string|null $unit if specified, $interval must be an integer + * @param bool $skipCopy set to true to return the passed object + * (without copying it) if it's already of the + * current class + * + * @return static|null + */ + public static function make($interval, $unit = null, bool $skipCopy = false) + { + if ($unit) { + $interval = "$interval ".Carbon::pluralUnit($unit); + } + + if ($interval instanceof DateInterval) { + return static::instance($interval, [], $skipCopy); + } + + if ($interval instanceof Closure) { + return new static($interval); + } + + if (!\is_string($interval)) { + return null; + } + + return static::makeFromString($interval); + } + + protected static function makeFromString(string $interval) + { + $interval = preg_replace('/\s+/', ' ', trim($interval)); + + if (preg_match('/^P[T\d]/', $interval)) { + return new static($interval); + } + + if (preg_match('/^(?:\h*\d+(?:\.\d+)?\h*[a-z]+)+$/i', $interval)) { + return static::fromString($interval); + } + + // @codeCoverageIgnoreStart + try { + /** @var static $interval */ + $interval = static::createFromDateString($interval); + } catch (DateMalformedIntervalStringException $e) { + return null; + } + // @codeCoverageIgnoreEnd + + return !$interval || $interval->isEmpty() ? null : $interval; + } + + protected function resolveInterval($interval) + { + if (!($interval instanceof self)) { + return self::make($interval); + } + + return $interval; + } + + /** + * Sets up a DateInterval from the relative parts of the string. + * + * @param string $time + * + * @return static + * + * @link https://php.net/manual/en/dateinterval.createfromdatestring.php + */ + #[ReturnTypeWillChange] + public static function createFromDateString($time) + { + $interval = @parent::createFromDateString(strtr($time, [ + ',' => ' ', + ' and ' => ' ', + ])); + + if ($interval instanceof DateInterval) { + $interval = static::instance($interval); + } + + return $interval; + } + + /////////////////////////////////////////////////////////////////// + ///////////////////////// GETTERS AND SETTERS ///////////////////// + /////////////////////////////////////////////////////////////////// + + /** + * Get a part of the CarbonInterval object. + * + * @param string $name + * + * @throws UnknownGetterException + * + * @return int|float|string + */ + public function get($name) + { + if (str_starts_with($name, 'total')) { + return $this->total(substr($name, 5)); + } + + switch ($name) { + case 'years': + return $this->y; + + case 'months': + return $this->m; + + case 'dayz': + return $this->d; + + case 'hours': + return $this->h; + + case 'minutes': + return $this->i; + + case 'seconds': + return $this->s; + + case 'milli': + case 'milliseconds': + return (int) (round($this->f * Carbon::MICROSECONDS_PER_SECOND) / Carbon::MICROSECONDS_PER_MILLISECOND); + + case 'micro': + case 'microseconds': + return (int) round($this->f * Carbon::MICROSECONDS_PER_SECOND); + + case 'microExcludeMilli': + return (int) round($this->f * Carbon::MICROSECONDS_PER_SECOND) % Carbon::MICROSECONDS_PER_MILLISECOND; + + case 'weeks': + return (int) ($this->d / (int) static::getDaysPerWeek()); + + case 'daysExcludeWeeks': + case 'dayzExcludeWeeks': + return $this->d % (int) static::getDaysPerWeek(); + + case 'locale': + return $this->getTranslatorLocale(); + + default: + throw new UnknownGetterException($name); + } + } + + /** + * Get a part of the CarbonInterval object. + * + * @param string $name + * + * @throws UnknownGetterException + * + * @return int|float|string + */ + public function __get($name) + { + return $this->get($name); + } + + /** + * Set a part of the CarbonInterval object. + * + * @param string|array $name + * @param int $value + * + * @throws UnknownSetterException + * + * @return $this + */ + public function set($name, $value = null) + { + $properties = \is_array($name) ? $name : [$name => $value]; + + foreach ($properties as $key => $value) { + switch (Carbon::singularUnit(rtrim($key, 'z'))) { + case 'year': + $this->checkIntegerValue($key, $value); + $this->y = $value; + $this->handleDecimalPart('year', $value, $this->y); + + break; + + case 'month': + $this->checkIntegerValue($key, $value); + $this->m = $value; + $this->handleDecimalPart('month', $value, $this->m); + + break; + + case 'week': + $this->checkIntegerValue($key, $value); + $days = $value * (int) static::getDaysPerWeek(); + $this->assertSafeForInteger('days total (including weeks)', $days); + $this->d = $days; + $this->handleDecimalPart('day', $days, $this->d); + + break; + + case 'day': + $this->checkIntegerValue($key, $value); + $this->d = $value; + $this->handleDecimalPart('day', $value, $this->d); + + break; + + case 'daysexcludeweek': + case 'dayzexcludeweek': + $this->checkIntegerValue($key, $value); + $days = $this->weeks * (int) static::getDaysPerWeek() + $value; + $this->assertSafeForInteger('days total (including weeks)', $days); + $this->d = $days; + $this->handleDecimalPart('day', $days, $this->d); + + break; + + case 'hour': + $this->checkIntegerValue($key, $value); + $this->h = $value; + $this->handleDecimalPart('hour', $value, $this->h); + + break; + + case 'minute': + $this->checkIntegerValue($key, $value); + $this->i = $value; + $this->handleDecimalPart('minute', $value, $this->i); + + break; + + case 'second': + $this->checkIntegerValue($key, $value); + $this->s = $value; + $this->handleDecimalPart('second', $value, $this->s); + + break; + + case 'milli': + case 'millisecond': + $this->microseconds = $value * Carbon::MICROSECONDS_PER_MILLISECOND + $this->microseconds % Carbon::MICROSECONDS_PER_MILLISECOND; + + break; + + case 'micro': + case 'microsecond': + $this->f = $value / Carbon::MICROSECONDS_PER_SECOND; + + break; + + default: + if ($this->localStrictModeEnabled ?? Carbon::isStrictModeEnabled()) { + throw new UnknownSetterException($key); + } + + $this->$key = $value; + } + } + + return $this; + } + + /** + * Set a part of the CarbonInterval object. + * + * @param string $name + * @param int $value + * + * @throws UnknownSetterException + */ + public function __set($name, $value) + { + $this->set($name, $value); + } + + /** + * Allow setting of weeks and days to be cumulative. + * + * @param int $weeks Number of weeks to set + * @param int $days Number of days to set + * + * @return static + */ + public function weeksAndDays($weeks, $days) + { + $this->dayz = ($weeks * static::getDaysPerWeek()) + $days; + + return $this; + } + + /** + * Returns true if the interval is empty for each unit. + * + * @return bool + */ + public function isEmpty() + { + return $this->years === 0 && + $this->months === 0 && + $this->dayz === 0 && + !$this->days && + $this->hours === 0 && + $this->minutes === 0 && + $this->seconds === 0 && + $this->microseconds === 0; + } + + /** + * Register a custom macro. + * + * @example + * ``` + * CarbonInterval::macro('twice', function () { + * return $this->times(2); + * }); + * echo CarbonInterval::hours(2)->twice(); + * ``` + * + * @param string $name + * @param object|callable $macro + * + * @return void + */ + public static function macro($name, $macro) + { + static::$macros[$name] = $macro; + } + + /** + * Register macros from a mixin object. + * + * @example + * ``` + * CarbonInterval::mixin(new class { + * public function daysToHours() { + * return function () { + * $this->hours += $this->days; + * $this->days = 0; + * + * return $this; + * }; + * } + * public function hoursToDays() { + * return function () { + * $this->days += $this->hours; + * $this->hours = 0; + * + * return $this; + * }; + * } + * }); + * echo CarbonInterval::hours(5)->hoursToDays() . "\n"; + * echo CarbonInterval::days(5)->daysToHours() . "\n"; + * ``` + * + * @param object|string $mixin + * + * @throws ReflectionException + * + * @return void + */ + public static function mixin($mixin) + { + static::baseMixin($mixin); + } + + /** + * Check if macro is registered. + * + * @param string $name + * + * @return bool + */ + public static function hasMacro($name) + { + return isset(static::$macros[$name]); + } + + /** + * Call given macro. + * + * @param string $name + * @param array $parameters + * + * @return mixed + */ + protected function callMacro($name, $parameters) + { + $macro = static::$macros[$name]; + + if ($macro instanceof Closure) { + $boundMacro = @$macro->bindTo($this, static::class) ?: @$macro->bindTo(null, static::class); + + return ($boundMacro ?: $macro)(...$parameters); + } + + return $macro(...$parameters); + } + + /** + * Allow fluent calls on the setters... CarbonInterval::years(3)->months(5)->day(). + * + * Note: This is done using the magic method to allow static and instance methods to + * have the same names. + * + * @param string $method magic method name called + * @param array $parameters parameters list + * + * @throws BadFluentSetterException|Throwable + * + * @return static + */ + public function __call($method, $parameters) + { + if (static::hasMacro($method)) { + return static::bindMacroContext($this, function () use (&$method, &$parameters) { + return $this->callMacro($method, $parameters); + }); + } + + $roundedValue = $this->callRoundMethod($method, $parameters); + + if ($roundedValue !== null) { + return $roundedValue; + } + + if (preg_match('/^(?<method>add|sub)(?<unit>[A-Z].*)$/', $method, $match)) { + $value = $this->getMagicParameter($parameters, 0, Carbon::pluralUnit($match['unit']), 0); + + return $this->{$match['method']}($value, $match['unit']); + } + + $value = $this->getMagicParameter($parameters, 0, Carbon::pluralUnit($method), 1); + + try { + $this->set($method, $value); + } catch (UnknownSetterException $exception) { + if ($this->localStrictModeEnabled ?? Carbon::isStrictModeEnabled()) { + throw new BadFluentSetterException($method, 0, $exception); + } + } + + return $this; + } + + protected function getForHumansInitialVariables($syntax, $short) + { + if (\is_array($syntax)) { + return $syntax; + } + + if (\is_int($short)) { + return [ + 'parts' => $short, + 'short' => false, + ]; + } + + if (\is_bool($syntax)) { + return [ + 'short' => $syntax, + 'syntax' => CarbonInterface::DIFF_ABSOLUTE, + ]; + } + + return []; + } + + /** + * @param mixed $syntax + * @param mixed $short + * @param mixed $parts + * @param mixed $options + * + * @return array + */ + protected function getForHumansParameters($syntax = null, $short = false, $parts = -1, $options = null) + { + $optionalSpace = ' '; + $default = $this->getTranslationMessage('list.0') ?? $this->getTranslationMessage('list') ?? ' '; + $join = $default === '' ? '' : ' '; + $altNumbers = false; + $aUnit = false; + $minimumUnit = 's'; + $skip = []; + extract($this->getForHumansInitialVariables($syntax, $short)); + $skip = array_map('strtolower', array_filter((array) $skip, static function ($value) { + return \is_string($value) && $value !== ''; + })); + + if ($syntax === null) { + $syntax = CarbonInterface::DIFF_ABSOLUTE; + } + + if ($parts === -1) { + $parts = INF; + } + + if ($options === null) { + $options = static::getHumanDiffOptions(); + } + + if ($join === false) { + $join = ' '; + } elseif ($join === true) { + $join = [ + $default, + $this->getTranslationMessage('list.1') ?? $default, + ]; + } + + if ($altNumbers && $altNumbers !== true) { + $language = new Language($this->locale); + $altNumbers = \in_array($language->getCode(), (array) $altNumbers, true); + } + + if (\is_array($join)) { + [$default, $last] = $join; + + if ($default !== ' ') { + $optionalSpace = ''; + } + + $join = function ($list) use ($default, $last) { + if (\count($list) < 2) { + return implode('', $list); + } + + $end = array_pop($list); + + return implode($default, $list).$last.$end; + }; + } + + if (\is_string($join)) { + if ($join !== ' ') { + $optionalSpace = ''; + } + + $glue = $join; + $join = function ($list) use ($glue) { + return implode($glue, $list); + }; + } + + $interpolations = [ + ':optional-space' => $optionalSpace, + ]; + + return [$syntax, $short, $parts, $options, $join, $aUnit, $altNumbers, $interpolations, $minimumUnit, $skip]; + } + + protected static function getRoundingMethodFromOptions(int $options): ?string + { + if ($options & CarbonInterface::ROUND) { + return 'round'; + } + + if ($options & CarbonInterface::CEIL) { + return 'ceil'; + } + + if ($options & CarbonInterface::FLOOR) { + return 'floor'; + } + + return null; + } + + /** + * Returns interval values as an array where key are the unit names and values the counts. + * + * @return int[] + */ + public function toArray() + { + return [ + 'years' => $this->years, + 'months' => $this->months, + 'weeks' => $this->weeks, + 'days' => $this->daysExcludeWeeks, + 'hours' => $this->hours, + 'minutes' => $this->minutes, + 'seconds' => $this->seconds, + 'microseconds' => $this->microseconds, + ]; + } + + /** + * Returns interval non-zero values as an array where key are the unit names and values the counts. + * + * @return int[] + */ + public function getNonZeroValues() + { + return array_filter($this->toArray(), 'intval'); + } + + /** + * Returns interval values as an array where key are the unit names and values the counts + * from the biggest non-zero one the the smallest non-zero one. + * + * @return int[] + */ + public function getValuesSequence() + { + $nonZeroValues = $this->getNonZeroValues(); + + if ($nonZeroValues === []) { + return []; + } + + $keys = array_keys($nonZeroValues); + $firstKey = $keys[0]; + $lastKey = $keys[\count($keys) - 1]; + $values = []; + $record = false; + + foreach ($this->toArray() as $unit => $count) { + if ($unit === $firstKey) { + $record = true; + } + + if ($record) { + $values[$unit] = $count; + } + + if ($unit === $lastKey) { + $record = false; + } + } + + return $values; + } + + /** + * Get the current interval in a human readable format in the current locale. + * + * @example + * ``` + * echo CarbonInterval::fromString('4d 3h 40m')->forHumans() . "\n"; + * echo CarbonInterval::fromString('4d 3h 40m')->forHumans(['parts' => 2]) . "\n"; + * echo CarbonInterval::fromString('4d 3h 40m')->forHumans(['parts' => 3, 'join' => true]) . "\n"; + * echo CarbonInterval::fromString('4d 3h 40m')->forHumans(['short' => true]) . "\n"; + * echo CarbonInterval::fromString('1d 24h')->forHumans(['join' => ' or ']) . "\n"; + * echo CarbonInterval::fromString('1d 24h')->forHumans(['minimumUnit' => 'hour']) . "\n"; + * ``` + * + * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: + * - 'syntax' entry (see below) + * - 'short' entry (see below) + * - 'parts' entry (see below) + * - 'options' entry (see below) + * - 'skip' entry, list of units to skip (array of strings or a single string, + * ` it can be the unit name (singular or plural) or its shortcut + * ` (y, m, w, d, h, min, s, ms, µs). + * - 'aUnit' entry, prefer "an hour" over "1 hour" if true + * - 'join' entry determines how to join multiple parts of the string + * ` - if $join is a string, it's used as a joiner glue + * ` - if $join is a callable/closure, it get the list of string and should return a string + * ` - if $join is an array, the first item will be the default glue, and the second item + * ` will be used instead of the glue for the last item + * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) + * ` - if $join is missing, a space will be used as glue + * - 'minimumUnit' entry determines the smallest unit of time to display can be long or + * ` short form of the units, e.g. 'hour' or 'h' (default value: s) + * if int passed, it add modifiers: + * Possible values: + * - CarbonInterface::DIFF_ABSOLUTE no modifiers + * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier + * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier + * Default value: CarbonInterface::DIFF_ABSOLUTE + * @param bool $short displays short format of time units + * @param int $parts maximum number of parts to display (default value: -1: no limits) + * @param int $options human diff options + * + * @throws Exception + * + * @return string + */ + public function forHumans($syntax = null, $short = false, $parts = -1, $options = null) + { + [$syntax, $short, $parts, $options, $join, $aUnit, $altNumbers, $interpolations, $minimumUnit, $skip] = $this + ->getForHumansParameters($syntax, $short, $parts, $options); + + $interval = []; + + $syntax = (int) ($syntax ?? CarbonInterface::DIFF_ABSOLUTE); + $absolute = $syntax === CarbonInterface::DIFF_ABSOLUTE; + $relativeToNow = $syntax === CarbonInterface::DIFF_RELATIVE_TO_NOW; + $count = 1; + $unit = $short ? 's' : 'second'; + $isFuture = $this->invert === 1; + $transId = $relativeToNow ? ($isFuture ? 'from_now' : 'ago') : ($isFuture ? 'after' : 'before'); + $declensionMode = null; + + /** @var \Symfony\Component\Translation\Translator $translator */ + $translator = $this->getLocalTranslator(); + + $handleDeclensions = function ($unit, $count, $index = 0, $parts = 1) use ($interpolations, $transId, $translator, $altNumbers, $absolute, &$declensionMode) { + if (!$absolute) { + $declensionMode = $declensionMode ?? $this->translate($transId.'_mode'); + + if ($this->needsDeclension($declensionMode, $index, $parts)) { + // Some languages have special pluralization for past and future tense. + $key = $unit.'_'.$transId; + $result = $this->translate($key, $interpolations, $count, $translator, $altNumbers); + + if ($result !== $key) { + return $result; + } + } + } + + $result = $this->translate($unit, $interpolations, $count, $translator, $altNumbers); + + if ($result !== $unit) { + return $result; + } + + return null; + }; + + $intervalValues = $this; + $method = static::getRoundingMethodFromOptions($options); + + if ($method) { + $previousCount = INF; + + while ( + \count($intervalValues->getNonZeroValues()) > $parts && + ($count = \count($keys = array_keys($intervalValues->getValuesSequence()))) > 1 + ) { + $index = min($count, $previousCount - 1) - 2; + + if ($index < 0) { + break; + } + + $intervalValues = $this->copy()->roundUnit( + $keys[$index], + 1, + $method + ); + $previousCount = $count; + } + } + + $diffIntervalArray = [ + ['value' => $intervalValues->years, 'unit' => 'year', 'unitShort' => 'y'], + ['value' => $intervalValues->months, 'unit' => 'month', 'unitShort' => 'm'], + ['value' => $intervalValues->weeks, 'unit' => 'week', 'unitShort' => 'w'], + ['value' => $intervalValues->daysExcludeWeeks, 'unit' => 'day', 'unitShort' => 'd'], + ['value' => $intervalValues->hours, 'unit' => 'hour', 'unitShort' => 'h'], + ['value' => $intervalValues->minutes, 'unit' => 'minute', 'unitShort' => 'min'], + ['value' => $intervalValues->seconds, 'unit' => 'second', 'unitShort' => 's'], + ['value' => $intervalValues->milliseconds, 'unit' => 'millisecond', 'unitShort' => 'ms'], + ['value' => $intervalValues->microExcludeMilli, 'unit' => 'microsecond', 'unitShort' => 'µs'], + ]; + + if (!empty($skip)) { + foreach ($diffIntervalArray as $index => &$unitData) { + $nextIndex = $index + 1; + + if ($unitData['value'] && + isset($diffIntervalArray[$nextIndex]) && + \count(array_intersect([$unitData['unit'], $unitData['unit'].'s', $unitData['unitShort']], $skip)) + ) { + $diffIntervalArray[$nextIndex]['value'] += $unitData['value'] * + self::getFactorWithDefault($diffIntervalArray[$nextIndex]['unit'], $unitData['unit']); + $unitData['value'] = 0; + } + } + } + + $transChoice = function ($short, $unitData, $index, $parts) use ($absolute, $handleDeclensions, $translator, $aUnit, $altNumbers, $interpolations) { + $count = $unitData['value']; + + if ($short) { + $result = $handleDeclensions($unitData['unitShort'], $count, $index, $parts); + + if ($result !== null) { + return $result; + } + } elseif ($aUnit) { + $result = $handleDeclensions('a_'.$unitData['unit'], $count, $index, $parts); + + if ($result !== null) { + return $result; + } + } + + if (!$absolute) { + return $handleDeclensions($unitData['unit'], $count, $index, $parts); + } + + return $this->translate($unitData['unit'], $interpolations, $count, $translator, $altNumbers); + }; + + $fallbackUnit = ['second', 's']; + + foreach ($diffIntervalArray as $diffIntervalData) { + if ($diffIntervalData['value'] > 0) { + $unit = $short ? $diffIntervalData['unitShort'] : $diffIntervalData['unit']; + $count = $diffIntervalData['value']; + $interval[] = [$short, $diffIntervalData]; + } elseif ($options & CarbonInterface::SEQUENTIAL_PARTS_ONLY && \count($interval) > 0) { + break; + } + + // break the loop after we get the required number of parts in array + if (\count($interval) >= $parts) { + break; + } + + // break the loop after we have reached the minimum unit + if (\in_array($minimumUnit, [$diffIntervalData['unit'], $diffIntervalData['unitShort']], true)) { + $fallbackUnit = [$diffIntervalData['unit'], $diffIntervalData['unitShort']]; + + break; + } + } + + $actualParts = \count($interval); + + foreach ($interval as $index => &$item) { + $item = $transChoice($item[0], $item[1], $index, $actualParts); + } + + if (\count($interval) === 0) { + if ($relativeToNow && $options & CarbonInterface::JUST_NOW) { + $key = 'diff_now'; + $translation = $this->translate($key, $interpolations, null, $translator); + + if ($translation !== $key) { + return $translation; + } + } + + $count = $options & CarbonInterface::NO_ZERO_DIFF ? 1 : 0; + $unit = $fallbackUnit[$short ? 1 : 0]; + $interval[] = $this->translate($unit, $interpolations, $count, $translator, $altNumbers); + } + + // join the interval parts by a space + $time = $join($interval); + + unset($diffIntervalArray, $interval); + + if ($absolute) { + return $time; + } + + $isFuture = $this->invert === 1; + + $transId = $relativeToNow ? ($isFuture ? 'from_now' : 'ago') : ($isFuture ? 'after' : 'before'); + + if ($parts === 1) { + if ($relativeToNow && $unit === 'day') { + if ($count === 1 && $options & CarbonInterface::ONE_DAY_WORDS) { + $key = $isFuture ? 'diff_tomorrow' : 'diff_yesterday'; + $translation = $this->translate($key, $interpolations, null, $translator); + + if ($translation !== $key) { + return $translation; + } + } + + if ($count === 2 && $options & CarbonInterface::TWO_DAY_WORDS) { + $key = $isFuture ? 'diff_after_tomorrow' : 'diff_before_yesterday'; + $translation = $this->translate($key, $interpolations, null, $translator); + + if ($translation !== $key) { + return $translation; + } + } + } + + $aTime = $aUnit ? $handleDeclensions('a_'.$unit, $count) : null; + + $time = $aTime ?: $handleDeclensions($unit, $count) ?: $time; + } + + $time = [':time' => $time]; + + return $this->translate($transId, array_merge($time, $interpolations, $time), null, $translator); + } + + /** + * Format the instance as a string using the forHumans() function. + * + * @throws Exception + * + * @return string + */ + public function __toString() + { + $format = $this->localToStringFormat ?? static::$toStringFormat; + + if (!$format) { + return $this->forHumans(); + } + + if ($format instanceof Closure) { + return $format($this); + } + + return $this->format($format); + } + + /** + * Return native DateInterval PHP object matching the current instance. + * + * @example + * ``` + * var_dump(CarbonInterval::hours(2)->toDateInterval()); + * ``` + * + * @return DateInterval + */ + public function toDateInterval() + { + return self::castIntervalToClass($this, DateInterval::class); + } + + /** + * Convert the interval to a CarbonPeriod. + * + * @param DateTimeInterface|string|int ...$params Start date, [end date or recurrences] and optional settings. + * + * @return CarbonPeriod + */ + public function toPeriod(...$params) + { + if ($this->tzName) { + $tz = \is_string($this->tzName) ? new DateTimeZone($this->tzName) : $this->tzName; + + if ($tz instanceof DateTimeZone) { + array_unshift($params, $tz); + } + } + + return CarbonPeriod::create($this, ...$params); + } + + /** + * Invert the interval. + * + * @param bool|int $inverted if a parameter is passed, the passed value cast as 1 or 0 is used + * as the new value of the ->invert property. + * + * @return $this + */ + public function invert($inverted = null) + { + $this->invert = (\func_num_args() === 0 ? !$this->invert : $inverted) ? 1 : 0; + + return $this; + } + + protected function solveNegativeInterval() + { + if (!$this->isEmpty() && $this->years <= 0 && $this->months <= 0 && $this->dayz <= 0 && $this->hours <= 0 && $this->minutes <= 0 && $this->seconds <= 0 && $this->microseconds <= 0) { + $this->years *= -1; + $this->months *= -1; + $this->dayz *= -1; + $this->hours *= -1; + $this->minutes *= -1; + $this->seconds *= -1; + $this->microseconds *= -1; + $this->invert(); + } + + return $this; + } + + /** + * Add the passed interval to the current instance. + * + * @param string|DateInterval $unit + * @param int|float $value + * + * @return $this + */ + public function add($unit, $value = 1) + { + if (is_numeric($unit)) { + [$value, $unit] = [$unit, $value]; + } + + if (\is_string($unit) && !preg_match('/^\s*\d/', $unit)) { + $unit = "$value $unit"; + $value = 1; + } + + $interval = static::make($unit); + + if (!$interval) { + throw new InvalidIntervalException('This type of data cannot be added/subtracted.'); + } + + if ($value !== 1) { + $interval->times($value); + } + + $sign = ($this->invert === 1) !== ($interval->invert === 1) ? -1 : 1; + $this->years += $interval->y * $sign; + $this->months += $interval->m * $sign; + $this->dayz += ($interval->days === false ? $interval->d : $interval->days) * $sign; + $this->hours += $interval->h * $sign; + $this->minutes += $interval->i * $sign; + $this->seconds += $interval->s * $sign; + $this->microseconds += $interval->microseconds * $sign; + + $this->solveNegativeInterval(); + + return $this; + } + + /** + * Subtract the passed interval to the current instance. + * + * @param string|DateInterval $unit + * @param int|float $value + * + * @return $this + */ + public function sub($unit, $value = 1) + { + if (is_numeric($unit)) { + [$value, $unit] = [$unit, $value]; + } + + return $this->add($unit, -(float) $value); + } + + /** + * Subtract the passed interval to the current instance. + * + * @param string|DateInterval $unit + * @param int|float $value + * + * @return $this + */ + public function subtract($unit, $value = 1) + { + return $this->sub($unit, $value); + } + + /** + * Add given parameters to the current interval. + * + * @param int $years + * @param int $months + * @param int|float $weeks + * @param int|float $days + * @param int|float $hours + * @param int|float $minutes + * @param int|float $seconds + * @param int|float $microseconds + * + * @return $this + */ + public function plus( + $years = 0, + $months = 0, + $weeks = 0, + $days = 0, + $hours = 0, + $minutes = 0, + $seconds = 0, + $microseconds = 0 + ): self { + return $this->add(" + $years years $months months $weeks weeks $days days + $hours hours $minutes minutes $seconds seconds $microseconds microseconds + "); + } + + /** + * Add given parameters to the current interval. + * + * @param int $years + * @param int $months + * @param int|float $weeks + * @param int|float $days + * @param int|float $hours + * @param int|float $minutes + * @param int|float $seconds + * @param int|float $microseconds + * + * @return $this + */ + public function minus( + $years = 0, + $months = 0, + $weeks = 0, + $days = 0, + $hours = 0, + $minutes = 0, + $seconds = 0, + $microseconds = 0 + ): self { + return $this->sub(" + $years years $months months $weeks weeks $days days + $hours hours $minutes minutes $seconds seconds $microseconds microseconds + "); + } + + /** + * Multiply current instance given number of times. times() is naive, it multiplies each unit + * (so day can be greater than 31, hour can be greater than 23, etc.) and the result is rounded + * separately for each unit. + * + * Use times() when you want a fast and approximated calculation that does not cascade units. + * + * For a precise and cascaded calculation, + * + * @see multiply() + * + * @param float|int $factor + * + * @return $this + */ + public function times($factor) + { + if ($factor < 0) { + $this->invert = $this->invert ? 0 : 1; + $factor = -$factor; + } + + $this->years = (int) round($this->years * $factor); + $this->months = (int) round($this->months * $factor); + $this->dayz = (int) round($this->dayz * $factor); + $this->hours = (int) round($this->hours * $factor); + $this->minutes = (int) round($this->minutes * $factor); + $this->seconds = (int) round($this->seconds * $factor); + $this->microseconds = (int) round($this->microseconds * $factor); + + return $this; + } + + /** + * Divide current instance by a given divider. shares() is naive, it divides each unit separately + * and the result is rounded for each unit. So 5 hours and 20 minutes shared by 3 becomes 2 hours + * and 7 minutes. + * + * Use shares() when you want a fast and approximated calculation that does not cascade units. + * + * For a precise and cascaded calculation, + * + * @see divide() + * + * @param float|int $divider + * + * @return $this + */ + public function shares($divider) + { + return $this->times(1 / $divider); + } + + protected function copyProperties(self $interval, $ignoreSign = false) + { + $this->years = $interval->years; + $this->months = $interval->months; + $this->dayz = $interval->dayz; + $this->hours = $interval->hours; + $this->minutes = $interval->minutes; + $this->seconds = $interval->seconds; + $this->microseconds = $interval->microseconds; + + if (!$ignoreSign) { + $this->invert = $interval->invert; + } + + return $this; + } + + /** + * Multiply and cascade current instance by a given factor. + * + * @param float|int $factor + * + * @return $this + */ + public function multiply($factor) + { + if ($factor < 0) { + $this->invert = $this->invert ? 0 : 1; + $factor = -$factor; + } + + $yearPart = (int) floor($this->years * $factor); // Split calculation to prevent imprecision + + if ($yearPart) { + $this->years -= $yearPart / $factor; + } + + return $this->copyProperties( + static::create($yearPart) + ->microseconds(abs($this->totalMicroseconds) * $factor) + ->cascade(), + true + ); + } + + /** + * Divide and cascade current instance by a given divider. + * + * @param float|int $divider + * + * @return $this + */ + public function divide($divider) + { + return $this->multiply(1 / $divider); + } + + /** + * Get the interval_spec string of a date interval. + * + * @param DateInterval $interval + * + * @return string + */ + public static function getDateIntervalSpec(DateInterval $interval, bool $microseconds = false, array $skip = []) + { + $date = array_filter([ + static::PERIOD_YEARS => abs($interval->y), + static::PERIOD_MONTHS => abs($interval->m), + static::PERIOD_DAYS => abs($interval->d), + ]); + + if ( + $interval->days >= CarbonInterface::DAYS_PER_WEEK * CarbonInterface::WEEKS_PER_MONTH && + (!isset($date[static::PERIOD_YEARS]) || \count(array_intersect(['y', 'year', 'years'], $skip))) && + (!isset($date[static::PERIOD_MONTHS]) || \count(array_intersect(['m', 'month', 'months'], $skip))) + ) { + $date = [ + static::PERIOD_DAYS => abs($interval->days), + ]; + } + + $seconds = abs($interval->s); + if ($microseconds && $interval->f > 0) { + $seconds = sprintf('%d.%06d', $seconds, abs($interval->f) * 1000000); + } + + $time = array_filter([ + static::PERIOD_HOURS => abs($interval->h), + static::PERIOD_MINUTES => abs($interval->i), + static::PERIOD_SECONDS => $seconds, + ]); + + $specString = static::PERIOD_PREFIX; + + foreach ($date as $key => $value) { + $specString .= $value.$key; + } + + if (\count($time) > 0) { + $specString .= static::PERIOD_TIME_PREFIX; + foreach ($time as $key => $value) { + $specString .= $value.$key; + } + } + + return $specString === static::PERIOD_PREFIX ? 'PT0S' : $specString; + } + + /** + * Get the interval_spec string. + * + * @return string + */ + public function spec(bool $microseconds = false) + { + return static::getDateIntervalSpec($this, $microseconds); + } + + /** + * Comparing 2 date intervals. + * + * @param DateInterval $first + * @param DateInterval $second + * + * @return int + */ + public static function compareDateIntervals(DateInterval $first, DateInterval $second) + { + $current = Carbon::now(); + $passed = $current->avoidMutation()->add($second); + $current->add($first); + + if ($current < $passed) { + return -1; + } + if ($current > $passed) { + return 1; + } + + return 0; + } + + /** + * Comparing with passed interval. + * + * @param DateInterval $interval + * + * @return int + */ + public function compare(DateInterval $interval) + { + return static::compareDateIntervals($this, $interval); + } + + private function invertCascade(array $values) + { + return $this->set(array_map(function ($value) { + return -$value; + }, $values))->doCascade(true)->invert(); + } + + private function doCascade(bool $deep) + { + $originalData = $this->toArray(); + $originalData['milliseconds'] = (int) ($originalData['microseconds'] / static::getMicrosecondsPerMillisecond()); + $originalData['microseconds'] = $originalData['microseconds'] % static::getMicrosecondsPerMillisecond(); + $originalData['weeks'] = (int) ($this->d / static::getDaysPerWeek()); + $originalData['daysExcludeWeeks'] = fmod($this->d, static::getDaysPerWeek()); + unset($originalData['days']); + $newData = $originalData; + $previous = []; + + foreach (self::getFlipCascadeFactors() as $source => [$target, $factor]) { + foreach (['source', 'target'] as $key) { + if ($$key === 'dayz') { + $$key = 'daysExcludeWeeks'; + } + } + + $value = $newData[$source]; + $modulo = fmod($factor + fmod($value, $factor), $factor); + $newData[$source] = $modulo; + $newData[$target] += ($value - $modulo) / $factor; + + $decimalPart = fmod($newData[$source], 1); + + if ($decimalPart !== 0.0) { + $unit = $source; + + foreach ($previous as [$subUnit, $subFactor]) { + $newData[$unit] -= $decimalPart; + $newData[$subUnit] += $decimalPart * $subFactor; + $decimalPart = fmod($newData[$subUnit], 1); + + if ($decimalPart === 0.0) { + break; + } + + $unit = $subUnit; + } + } + + array_unshift($previous, [$source, $factor]); + } + + $positive = null; + + if (!$deep) { + foreach ($newData as $value) { + if ($value) { + if ($positive === null) { + $positive = ($value > 0); + + continue; + } + + if (($value > 0) !== $positive) { + return $this->invertCascade($originalData) + ->solveNegativeInterval(); + } + } + } + } + + return $this->set($newData) + ->solveNegativeInterval(); + } + + /** + * Convert overflowed values into bigger units. + * + * @return $this + */ + public function cascade() + { + return $this->doCascade(false); + } + + public function hasNegativeValues(): bool + { + foreach ($this->toArray() as $value) { + if ($value < 0) { + return true; + } + } + + return false; + } + + public function hasPositiveValues(): bool + { + foreach ($this->toArray() as $value) { + if ($value > 0) { + return true; + } + } + + return false; + } + + /** + * Get amount of given unit equivalent to the interval. + * + * @param string $unit + * + * @throws UnknownUnitException|UnitNotConfiguredException + * + * @return float + */ + public function total($unit) + { + $realUnit = $unit = strtolower($unit); + + if (\in_array($unit, ['days', 'weeks'])) { + $realUnit = 'dayz'; + } elseif (!\in_array($unit, ['microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'dayz', 'months', 'years'])) { + throw new UnknownUnitException($unit); + } + + $result = 0; + $cumulativeFactor = 0; + $unitFound = false; + $factors = self::getFlipCascadeFactors(); + $daysPerWeek = (int) static::getDaysPerWeek(); + + $values = [ + 'years' => $this->years, + 'months' => $this->months, + 'weeks' => (int) ($this->d / $daysPerWeek), + 'dayz' => fmod($this->d, $daysPerWeek), + 'hours' => $this->hours, + 'minutes' => $this->minutes, + 'seconds' => $this->seconds, + 'milliseconds' => (int) ($this->microseconds / Carbon::MICROSECONDS_PER_MILLISECOND), + 'microseconds' => $this->microseconds % Carbon::MICROSECONDS_PER_MILLISECOND, + ]; + + if (isset($factors['dayz']) && $factors['dayz'][0] !== 'weeks') { + $values['dayz'] += $values['weeks'] * $daysPerWeek; + $values['weeks'] = 0; + } + + foreach ($factors as $source => [$target, $factor]) { + if ($source === $realUnit) { + $unitFound = true; + $value = $values[$source]; + $result += $value; + $cumulativeFactor = 1; + } + + if ($factor === false) { + if ($unitFound) { + break; + } + + $result = 0; + $cumulativeFactor = 0; + + continue; + } + + if ($target === $realUnit) { + $unitFound = true; + } + + if ($cumulativeFactor) { + $cumulativeFactor *= $factor; + $result += $values[$target] * $cumulativeFactor; + + continue; + } + + $value = $values[$source]; + + $result = ($result + $value) / $factor; + } + + if (isset($target) && !$cumulativeFactor) { + $result += $values[$target]; + } + + if (!$unitFound) { + throw new UnitNotConfiguredException($unit); + } + + if ($this->invert) { + $result *= -1; + } + + if ($unit === 'weeks') { + $result /= $daysPerWeek; + } + + // Cast as int numbers with no decimal part + return fmod($result, 1) === 0.0 ? (int) $result : $result; + } + + /** + * Determines if the instance is equal to another + * + * @param CarbonInterval|DateInterval|mixed $interval + * + * @see equalTo() + * + * @return bool + */ + public function eq($interval): bool + { + return $this->equalTo($interval); + } + + /** + * Determines if the instance is equal to another + * + * @param CarbonInterval|DateInterval|mixed $interval + * + * @return bool + */ + public function equalTo($interval): bool + { + $interval = $this->resolveInterval($interval); + + return $interval !== null && $this->totalMicroseconds === $interval->totalMicroseconds; + } + + /** + * Determines if the instance is not equal to another + * + * @param CarbonInterval|DateInterval|mixed $interval + * + * @see notEqualTo() + * + * @return bool + */ + public function ne($interval): bool + { + return $this->notEqualTo($interval); + } + + /** + * Determines if the instance is not equal to another + * + * @param CarbonInterval|DateInterval|mixed $interval + * + * @return bool + */ + public function notEqualTo($interval): bool + { + return !$this->eq($interval); + } + + /** + * Determines if the instance is greater (longer) than another + * + * @param CarbonInterval|DateInterval|mixed $interval + * + * @see greaterThan() + * + * @return bool + */ + public function gt($interval): bool + { + return $this->greaterThan($interval); + } + + /** + * Determines if the instance is greater (longer) than another + * + * @param CarbonInterval|DateInterval|mixed $interval + * + * @return bool + */ + public function greaterThan($interval): bool + { + $interval = $this->resolveInterval($interval); + + return $interval === null || $this->totalMicroseconds > $interval->totalMicroseconds; + } + + /** + * Determines if the instance is greater (longer) than or equal to another + * + * @param CarbonInterval|DateInterval|mixed $interval + * + * @see greaterThanOrEqualTo() + * + * @return bool + */ + public function gte($interval): bool + { + return $this->greaterThanOrEqualTo($interval); + } + + /** + * Determines if the instance is greater (longer) than or equal to another + * + * @param CarbonInterval|DateInterval|mixed $interval + * + * @return bool + */ + public function greaterThanOrEqualTo($interval): bool + { + return $this->greaterThan($interval) || $this->equalTo($interval); + } + + /** + * Determines if the instance is less (shorter) than another + * + * @param CarbonInterval|DateInterval|mixed $interval + * + * @see lessThan() + * + * @return bool + */ + public function lt($interval): bool + { + return $this->lessThan($interval); + } + + /** + * Determines if the instance is less (shorter) than another + * + * @param CarbonInterval|DateInterval|mixed $interval + * + * @return bool + */ + public function lessThan($interval): bool + { + $interval = $this->resolveInterval($interval); + + return $interval !== null && $this->totalMicroseconds < $interval->totalMicroseconds; + } + + /** + * Determines if the instance is less (shorter) than or equal to another + * + * @param CarbonInterval|DateInterval|mixed $interval + * + * @see lessThanOrEqualTo() + * + * @return bool + */ + public function lte($interval): bool + { + return $this->lessThanOrEqualTo($interval); + } + + /** + * Determines if the instance is less (shorter) than or equal to another + * + * @param CarbonInterval|DateInterval|mixed $interval + * + * @return bool + */ + public function lessThanOrEqualTo($interval): bool + { + return $this->lessThan($interval) || $this->equalTo($interval); + } + + /** + * Determines if the instance is between two others. + * + * The third argument allow you to specify if bounds are included or not (true by default) + * but for when you including/excluding bounds may produce different results in your application, + * we recommend to use the explicit methods ->betweenIncluded() or ->betweenExcluded() instead. + * + * @example + * ``` + * CarbonInterval::hours(48)->between(CarbonInterval::day(), CarbonInterval::days(3)); // true + * CarbonInterval::hours(48)->between(CarbonInterval::day(), CarbonInterval::hours(36)); // false + * CarbonInterval::hours(48)->between(CarbonInterval::day(), CarbonInterval::days(2)); // true + * CarbonInterval::hours(48)->between(CarbonInterval::day(), CarbonInterval::days(2), false); // false + * ``` + * + * @param CarbonInterval|DateInterval|mixed $interval1 + * @param CarbonInterval|DateInterval|mixed $interval2 + * @param bool $equal Indicates if an equal to comparison should be done + * + * @return bool + */ + public function between($interval1, $interval2, $equal = true): bool + { + return $equal + ? $this->greaterThanOrEqualTo($interval1) && $this->lessThanOrEqualTo($interval2) + : $this->greaterThan($interval1) && $this->lessThan($interval2); + } + + /** + * Determines if the instance is between two others, bounds excluded. + * + * @example + * ``` + * CarbonInterval::hours(48)->betweenExcluded(CarbonInterval::day(), CarbonInterval::days(3)); // true + * CarbonInterval::hours(48)->betweenExcluded(CarbonInterval::day(), CarbonInterval::hours(36)); // false + * CarbonInterval::hours(48)->betweenExcluded(CarbonInterval::day(), CarbonInterval::days(2)); // true + * ``` + * + * @param CarbonInterval|DateInterval|mixed $interval1 + * @param CarbonInterval|DateInterval|mixed $interval2 + * + * @return bool + */ + public function betweenIncluded($interval1, $interval2): bool + { + return $this->between($interval1, $interval2, true); + } + + /** + * Determines if the instance is between two others, bounds excluded. + * + * @example + * ``` + * CarbonInterval::hours(48)->betweenExcluded(CarbonInterval::day(), CarbonInterval::days(3)); // true + * CarbonInterval::hours(48)->betweenExcluded(CarbonInterval::day(), CarbonInterval::hours(36)); // false + * CarbonInterval::hours(48)->betweenExcluded(CarbonInterval::day(), CarbonInterval::days(2)); // false + * ``` + * + * @param CarbonInterval|DateInterval|mixed $interval1 + * @param CarbonInterval|DateInterval|mixed $interval2 + * + * @return bool + */ + public function betweenExcluded($interval1, $interval2): bool + { + return $this->between($interval1, $interval2, false); + } + + /** + * Determines if the instance is between two others + * + * @example + * ``` + * CarbonInterval::hours(48)->isBetween(CarbonInterval::day(), CarbonInterval::days(3)); // true + * CarbonInterval::hours(48)->isBetween(CarbonInterval::day(), CarbonInterval::hours(36)); // false + * CarbonInterval::hours(48)->isBetween(CarbonInterval::day(), CarbonInterval::days(2)); // true + * CarbonInterval::hours(48)->isBetween(CarbonInterval::day(), CarbonInterval::days(2), false); // false + * ``` + * + * @param CarbonInterval|DateInterval|mixed $interval1 + * @param CarbonInterval|DateInterval|mixed $interval2 + * @param bool $equal Indicates if an equal to comparison should be done + * + * @return bool + */ + public function isBetween($interval1, $interval2, $equal = true): bool + { + return $this->between($interval1, $interval2, $equal); + } + + /** + * Round the current instance at the given unit with given precision if specified and the given function. + * + * @param string $unit + * @param float|int|string|DateInterval|null $precision + * @param string $function + * + * @throws Exception + * + * @return $this + */ + public function roundUnit($unit, $precision = 1, $function = 'round') + { + if (static::getCascadeFactors() !== static::getDefaultCascadeFactors()) { + $value = $function($this->total($unit) / $precision) * $precision; + $inverted = $value < 0; + + return $this->copyProperties(self::fromString( + number_format(abs($value), 12, '.', '').' '.$unit + )->invert($inverted)->cascade()); + } + + $base = CarbonImmutable::parse('2000-01-01 00:00:00', 'UTC') + ->roundUnit($unit, $precision, $function); + $next = $base->add($this); + $inverted = $next < $base; + + if ($inverted) { + $next = $base->sub($this); + } + + $this->copyProperties( + $next + ->roundUnit($unit, $precision, $function) + ->diffAsCarbonInterval($base) + ); + + return $this->invert($inverted); + } + + /** + * Truncate the current instance at the given unit with given precision if specified. + * + * @param string $unit + * @param float|int|string|DateInterval|null $precision + * + * @throws Exception + * + * @return $this + */ + public function floorUnit($unit, $precision = 1) + { + return $this->roundUnit($unit, $precision, 'floor'); + } + + /** + * Ceil the current instance at the given unit with given precision if specified. + * + * @param string $unit + * @param float|int|string|DateInterval|null $precision + * + * @throws Exception + * + * @return $this + */ + public function ceilUnit($unit, $precision = 1) + { + return $this->roundUnit($unit, $precision, 'ceil'); + } + + /** + * Round the current instance second with given precision if specified. + * + * @param float|int|string|DateInterval|null $precision + * @param string $function + * + * @throws Exception + * + * @return $this + */ + public function round($precision = 1, $function = 'round') + { + return $this->roundWith($precision, $function); + } + + /** + * Round the current instance second with given precision if specified. + * + * @param float|int|string|DateInterval|null $precision + * + * @throws Exception + * + * @return $this + */ + public function floor($precision = 1) + { + return $this->round($precision, 'floor'); + } + + /** + * Ceil the current instance second with given precision if specified. + * + * @param float|int|string|DateInterval|null $precision + * + * @throws Exception + * + * @return $this + */ + public function ceil($precision = 1) + { + return $this->round($precision, 'ceil'); + } + + private function needsDeclension(string $mode, int $index, int $parts): bool + { + switch ($mode) { + case 'last': + return $index === $parts - 1; + default: + return true; + } + } + + private function checkIntegerValue(string $name, $value) + { + if (\is_int($value)) { + return; + } + + $this->assertSafeForInteger($name, $value); + + if (\is_float($value) && (((float) (int) $value) === $value)) { + return; + } + + if (!self::$floatSettersEnabled) { + $type = \gettype($value); + @trigger_error( + "Since 2.70.0, it's deprecated to pass $type value for $name.\n". + "It's truncated when stored as an integer interval unit.\n". + "From 3.0.0, decimal part will no longer be truncated and will be cascaded to smaller units.\n". + "- To maintain the current behavior, use explicit cast: $name((int) \$value)\n". + "- To adopt the new behavior globally, call CarbonInterval::enableFloatSetters()\n", + \E_USER_DEPRECATED + ); + } + } + + /** + * Throw an exception if precision loss when storing the given value as an integer would be >= 1.0. + */ + private function assertSafeForInteger(string $name, $value) + { + if ($value && !\is_int($value) && ($value >= 0x7fffffffffffffff || $value <= -0x7fffffffffffffff)) { + throw new OutOfRangeException($name, -0x7fffffffffffffff, 0x7fffffffffffffff, $value); + } + } + + private function handleDecimalPart(string $unit, $value, $integerValue) + { + if (self::$floatSettersEnabled) { + $floatValue = (float) $value; + $base = (float) $integerValue; + + if ($floatValue === $base) { + return; + } + + $units = [ + 'y' => 'year', + 'm' => 'month', + 'd' => 'day', + 'h' => 'hour', + 'i' => 'minute', + 's' => 'second', + ]; + $upper = true; + + foreach ($units as $property => $name) { + if ($name === $unit) { + $upper = false; + + continue; + } + + if (!$upper && $this->$property !== 0) { + throw new RuntimeException( + "You cannot set $unit to a float value as $name would be overridden, ". + 'set it first to 0 explicitly if you really want to erase its value' + ); + } + } + + $this->add($unit, $floatValue - $base); + } + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php b/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php new file mode 100644 index 00000000..d12a9869 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php @@ -0,0 +1,2742 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon; + +use Carbon\Exceptions\EndLessPeriodException; +use Carbon\Exceptions\InvalidCastException; +use Carbon\Exceptions\InvalidIntervalException; +use Carbon\Exceptions\InvalidPeriodDateException; +use Carbon\Exceptions\InvalidPeriodParameterException; +use Carbon\Exceptions\NotACarbonClassException; +use Carbon\Exceptions\NotAPeriodException; +use Carbon\Exceptions\UnknownGetterException; +use Carbon\Exceptions\UnknownMethodException; +use Carbon\Exceptions\UnreachableException; +use Carbon\Traits\IntervalRounding; +use Carbon\Traits\Mixin; +use Carbon\Traits\Options; +use Carbon\Traits\ToStringFormat; +use Closure; +use Countable; +use DateInterval; +use DatePeriod; +use DateTime; +use DateTimeImmutable; +use DateTimeInterface; +use DateTimeZone; +use InvalidArgumentException; +use Iterator; +use JsonSerializable; +use ReflectionException; +use ReturnTypeWillChange; +use RuntimeException; + +/** + * Substitution of DatePeriod with some modifications and many more features. + * + * @property-read int|float $recurrences number of recurrences (if end not set). + * @property-read bool $include_start_date rather the start date is included in the iteration. + * @property-read bool $include_end_date rather the end date is included in the iteration (if recurrences not set). + * @property-read CarbonInterface $start Period start date. + * @property-read CarbonInterface $current Current date from the iteration. + * @property-read CarbonInterface $end Period end date. + * @property-read CarbonInterval $interval Underlying date interval instance. Always present, one day by default. + * + * @method static static start($date, $inclusive = null) Create instance specifying start date or modify the start date if called on an instance. + * @method static static since($date, $inclusive = null) Alias for start(). + * @method static static sinceNow($inclusive = null) Create instance with start date set to now or set the start date to now if called on an instance. + * @method static static end($date = null, $inclusive = null) Create instance specifying end date or modify the end date if called on an instance. + * @method static static until($date = null, $inclusive = null) Alias for end(). + * @method static static untilNow($inclusive = null) Create instance with end date set to now or set the end date to now if called on an instance. + * @method static static dates($start, $end = null) Create instance with start and end dates or modify the start and end dates if called on an instance. + * @method static static between($start, $end = null) Create instance with start and end dates or modify the start and end dates if called on an instance. + * @method static static recurrences($recurrences = null) Create instance with maximum number of recurrences or modify the number of recurrences if called on an instance. + * @method static static times($recurrences = null) Alias for recurrences(). + * @method static static options($options = null) Create instance with options or modify the options if called on an instance. + * @method static static toggle($options, $state = null) Create instance with options toggled on or off, or toggle options if called on an instance. + * @method static static filter($callback, $name = null) Create instance with filter added to the stack or append a filter if called on an instance. + * @method static static push($callback, $name = null) Alias for filter(). + * @method static static prepend($callback, $name = null) Create instance with filter prepended to the stack or prepend a filter if called on an instance. + * @method static static filters(array $filters = []) Create instance with filters stack or replace the whole filters stack if called on an instance. + * @method static static interval($interval) Create instance with given date interval or modify the interval if called on an instance. + * @method static static each($interval) Create instance with given date interval or modify the interval if called on an instance. + * @method static static every($interval) Create instance with given date interval or modify the interval if called on an instance. + * @method static static step($interval) Create instance with given date interval or modify the interval if called on an instance. + * @method static static stepBy($interval) Create instance with given date interval or modify the interval if called on an instance. + * @method static static invert() Create instance with inverted date interval or invert the interval if called on an instance. + * @method static static years($years = 1) Create instance specifying a number of years for date interval or replace the interval by the given a number of years if called on an instance. + * @method static static year($years = 1) Alias for years(). + * @method static static months($months = 1) Create instance specifying a number of months for date interval or replace the interval by the given a number of months if called on an instance. + * @method static static month($months = 1) Alias for months(). + * @method static static weeks($weeks = 1) Create instance specifying a number of weeks for date interval or replace the interval by the given a number of weeks if called on an instance. + * @method static static week($weeks = 1) Alias for weeks(). + * @method static static days($days = 1) Create instance specifying a number of days for date interval or replace the interval by the given a number of days if called on an instance. + * @method static static dayz($days = 1) Alias for days(). + * @method static static day($days = 1) Alias for days(). + * @method static static hours($hours = 1) Create instance specifying a number of hours for date interval or replace the interval by the given a number of hours if called on an instance. + * @method static static hour($hours = 1) Alias for hours(). + * @method static static minutes($minutes = 1) Create instance specifying a number of minutes for date interval or replace the interval by the given a number of minutes if called on an instance. + * @method static static minute($minutes = 1) Alias for minutes(). + * @method static static seconds($seconds = 1) Create instance specifying a number of seconds for date interval or replace the interval by the given a number of seconds if called on an instance. + * @method static static second($seconds = 1) Alias for seconds(). + * @method static static milliseconds($milliseconds = 1) Create instance specifying a number of milliseconds for date interval or replace the interval by the given a number of milliseconds if called on an instance. + * @method static static millisecond($milliseconds = 1) Alias for milliseconds(). + * @method static static microseconds($microseconds = 1) Create instance specifying a number of microseconds for date interval or replace the interval by the given a number of microseconds if called on an instance. + * @method static static microsecond($microseconds = 1) Alias for microseconds(). + * @method $this roundYear(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. + * @method $this roundYears(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. + * @method $this floorYear(float $precision = 1) Truncate the current instance year with given precision. + * @method $this floorYears(float $precision = 1) Truncate the current instance year with given precision. + * @method $this ceilYear(float $precision = 1) Ceil the current instance year with given precision. + * @method $this ceilYears(float $precision = 1) Ceil the current instance year with given precision. + * @method $this roundMonth(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. + * @method $this roundMonths(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. + * @method $this floorMonth(float $precision = 1) Truncate the current instance month with given precision. + * @method $this floorMonths(float $precision = 1) Truncate the current instance month with given precision. + * @method $this ceilMonth(float $precision = 1) Ceil the current instance month with given precision. + * @method $this ceilMonths(float $precision = 1) Ceil the current instance month with given precision. + * @method $this roundWeek(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method $this roundWeeks(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method $this floorWeek(float $precision = 1) Truncate the current instance day with given precision. + * @method $this floorWeeks(float $precision = 1) Truncate the current instance day with given precision. + * @method $this ceilWeek(float $precision = 1) Ceil the current instance day with given precision. + * @method $this ceilWeeks(float $precision = 1) Ceil the current instance day with given precision. + * @method $this roundDay(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method $this roundDays(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method $this floorDay(float $precision = 1) Truncate the current instance day with given precision. + * @method $this floorDays(float $precision = 1) Truncate the current instance day with given precision. + * @method $this ceilDay(float $precision = 1) Ceil the current instance day with given precision. + * @method $this ceilDays(float $precision = 1) Ceil the current instance day with given precision. + * @method $this roundHour(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. + * @method $this roundHours(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. + * @method $this floorHour(float $precision = 1) Truncate the current instance hour with given precision. + * @method $this floorHours(float $precision = 1) Truncate the current instance hour with given precision. + * @method $this ceilHour(float $precision = 1) Ceil the current instance hour with given precision. + * @method $this ceilHours(float $precision = 1) Ceil the current instance hour with given precision. + * @method $this roundMinute(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. + * @method $this roundMinutes(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. + * @method $this floorMinute(float $precision = 1) Truncate the current instance minute with given precision. + * @method $this floorMinutes(float $precision = 1) Truncate the current instance minute with given precision. + * @method $this ceilMinute(float $precision = 1) Ceil the current instance minute with given precision. + * @method $this ceilMinutes(float $precision = 1) Ceil the current instance minute with given precision. + * @method $this roundSecond(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. + * @method $this roundSeconds(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. + * @method $this floorSecond(float $precision = 1) Truncate the current instance second with given precision. + * @method $this floorSeconds(float $precision = 1) Truncate the current instance second with given precision. + * @method $this ceilSecond(float $precision = 1) Ceil the current instance second with given precision. + * @method $this ceilSeconds(float $precision = 1) Ceil the current instance second with given precision. + * @method $this roundMillennium(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. + * @method $this roundMillennia(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. + * @method $this floorMillennium(float $precision = 1) Truncate the current instance millennium with given precision. + * @method $this floorMillennia(float $precision = 1) Truncate the current instance millennium with given precision. + * @method $this ceilMillennium(float $precision = 1) Ceil the current instance millennium with given precision. + * @method $this ceilMillennia(float $precision = 1) Ceil the current instance millennium with given precision. + * @method $this roundCentury(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. + * @method $this roundCenturies(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. + * @method $this floorCentury(float $precision = 1) Truncate the current instance century with given precision. + * @method $this floorCenturies(float $precision = 1) Truncate the current instance century with given precision. + * @method $this ceilCentury(float $precision = 1) Ceil the current instance century with given precision. + * @method $this ceilCenturies(float $precision = 1) Ceil the current instance century with given precision. + * @method $this roundDecade(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. + * @method $this roundDecades(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. + * @method $this floorDecade(float $precision = 1) Truncate the current instance decade with given precision. + * @method $this floorDecades(float $precision = 1) Truncate the current instance decade with given precision. + * @method $this ceilDecade(float $precision = 1) Ceil the current instance decade with given precision. + * @method $this ceilDecades(float $precision = 1) Ceil the current instance decade with given precision. + * @method $this roundQuarter(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. + * @method $this roundQuarters(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. + * @method $this floorQuarter(float $precision = 1) Truncate the current instance quarter with given precision. + * @method $this floorQuarters(float $precision = 1) Truncate the current instance quarter with given precision. + * @method $this ceilQuarter(float $precision = 1) Ceil the current instance quarter with given precision. + * @method $this ceilQuarters(float $precision = 1) Ceil the current instance quarter with given precision. + * @method $this roundMillisecond(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. + * @method $this roundMilliseconds(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. + * @method $this floorMillisecond(float $precision = 1) Truncate the current instance millisecond with given precision. + * @method $this floorMilliseconds(float $precision = 1) Truncate the current instance millisecond with given precision. + * @method $this ceilMillisecond(float $precision = 1) Ceil the current instance millisecond with given precision. + * @method $this ceilMilliseconds(float $precision = 1) Ceil the current instance millisecond with given precision. + * @method $this roundMicrosecond(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. + * @method $this roundMicroseconds(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. + * @method $this floorMicrosecond(float $precision = 1) Truncate the current instance microsecond with given precision. + * @method $this floorMicroseconds(float $precision = 1) Truncate the current instance microsecond with given precision. + * @method $this ceilMicrosecond(float $precision = 1) Ceil the current instance microsecond with given precision. + * @method $this ceilMicroseconds(float $precision = 1) Ceil the current instance microsecond with given precision. + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class CarbonPeriod implements Iterator, Countable, JsonSerializable +{ + use IntervalRounding; + use Mixin { + Mixin::mixin as baseMixin; + } + use Options; + use ToStringFormat; + + /** + * Built-in filter for limit by recurrences. + * + * @var callable + */ + public const RECURRENCES_FILTER = [self::class, 'filterRecurrences']; + + /** + * Built-in filter for limit to an end. + * + * @var callable + */ + public const END_DATE_FILTER = [self::class, 'filterEndDate']; + + /** + * Special value which can be returned by filters to end iteration. Also a filter. + * + * @var callable + */ + public const END_ITERATION = [self::class, 'endIteration']; + + /** + * Exclude start date from iteration. + * + * @var int + */ + public const EXCLUDE_START_DATE = 1; + + /** + * Exclude end date from iteration. + * + * @var int + */ + public const EXCLUDE_END_DATE = 2; + + /** + * Yield CarbonImmutable instances. + * + * @var int + */ + public const IMMUTABLE = 4; + + /** + * Number of maximum attempts before giving up on finding next valid date. + * + * @var int + */ + public const NEXT_MAX_ATTEMPTS = 1000; + + /** + * Number of maximum attempts before giving up on finding end date. + * + * @var int + */ + public const END_MAX_ATTEMPTS = 10000; + + /** + * Default date class of iteration items. + * + * @var string + */ + protected const DEFAULT_DATE_CLASS = Carbon::class; + + /** + * The registered macros. + * + * @var array + */ + protected static $macros = []; + + /** + * Date class of iteration items. + * + * @var string + */ + protected $dateClass = Carbon::class; + + /** + * Underlying date interval instance. Always present, one day by default. + * + * @var CarbonInterval + */ + protected $dateInterval; + + /** + * True once __construct is finished. + * + * @var bool + */ + protected $constructed = false; + + /** + * Whether current date interval was set by default. + * + * @var bool + */ + protected $isDefaultInterval; + + /** + * The filters stack. + * + * @var array + */ + protected $filters = []; + + /** + * Period start date. Applied on rewind. Always present, now by default. + * + * @var CarbonInterface + */ + protected $startDate; + + /** + * Period end date. For inverted interval should be before the start date. Applied via a filter. + * + * @var CarbonInterface|null + */ + protected $endDate; + + /** + * Limit for number of recurrences. Applied via a filter. + * + * @var int|null + */ + protected $recurrences; + + /** + * Iteration options. + * + * @var int + */ + protected $options; + + /** + * Index of current date. Always sequential, even if some dates are skipped by filters. + * Equal to null only before the first iteration. + * + * @var int + */ + protected $key; + + /** + * Current date. May temporarily hold unaccepted value when looking for a next valid date. + * Equal to null only before the first iteration. + * + * @var CarbonInterface + */ + protected $current; + + /** + * Timezone of current date. Taken from the start date. + * + * @var \DateTimeZone|null + */ + protected $timezone; + + /** + * The cached validation result for current date. + * + * @var bool|string|null + */ + protected $validationResult; + + /** + * Timezone handler for settings() method. + * + * @var mixed + */ + protected $tzName; + + /** + * Make a CarbonPeriod instance from given variable if possible. + * + * @param mixed $var + * + * @return static|null + */ + public static function make($var) + { + try { + return static::instance($var); + } catch (NotAPeriodException $e) { + return static::create($var); + } + } + + /** + * Create a new instance from a DatePeriod or CarbonPeriod object. + * + * @param CarbonPeriod|DatePeriod $period + * + * @return static + */ + public static function instance($period) + { + if ($period instanceof static) { + return $period->copy(); + } + + if ($period instanceof self) { + return new static( + $period->getStartDate(), + $period->getEndDate() ?: $period->getRecurrences(), + $period->getDateInterval(), + $period->getOptions() + ); + } + + if ($period instanceof DatePeriod) { + return new static( + $period->start, + $period->end ?: ($period->recurrences - 1), + $period->interval, + $period->include_start_date ? 0 : static::EXCLUDE_START_DATE + ); + } + + $class = static::class; + $type = \gettype($period); + + throw new NotAPeriodException( + 'Argument 1 passed to '.$class.'::'.__METHOD__.'() '. + 'must be an instance of DatePeriod or '.$class.', '. + ($type === 'object' ? 'instance of '.\get_class($period) : $type).' given.' + ); + } + + /** + * Create a new instance. + * + * @return static + */ + public static function create(...$params) + { + return static::createFromArray($params); + } + + /** + * Create a new instance from an array of parameters. + * + * @param array $params + * + * @return static + */ + public static function createFromArray(array $params) + { + return new static(...$params); + } + + /** + * Create CarbonPeriod from ISO 8601 string. + * + * @param string $iso + * @param int|null $options + * + * @return static + */ + public static function createFromIso($iso, $options = null) + { + $params = static::parseIso8601($iso); + + $instance = static::createFromArray($params); + + if ($options !== null) { + $instance->setOptions($options); + } + + return $instance; + } + + /** + * Return whether given interval contains non zero value of any time unit. + * + * @param \DateInterval $interval + * + * @return bool + */ + protected static function intervalHasTime(DateInterval $interval) + { + return $interval->h || $interval->i || $interval->s || $interval->f; + } + + /** + * Return whether given variable is an ISO 8601 specification. + * + * Note: Check is very basic, as actual validation will be done later when parsing. + * We just want to ensure that variable is not any other type of a valid parameter. + * + * @param mixed $var + * + * @return bool + */ + protected static function isIso8601($var) + { + if (!\is_string($var)) { + return false; + } + + // Match slash but not within a timezone name. + $part = '[a-z]+(?:[_-][a-z]+)*'; + + preg_match("#\b$part/$part\b|(/)#i", $var, $match); + + return isset($match[1]); + } + + /** + * Parse given ISO 8601 string into an array of arguments. + * + * @SuppressWarnings(PHPMD.ElseExpression) + * + * @param string $iso + * + * @return array + */ + protected static function parseIso8601($iso) + { + $result = []; + + $interval = null; + $start = null; + $end = null; + $dateClass = static::DEFAULT_DATE_CLASS; + + foreach (explode('/', $iso) as $key => $part) { + if ($key === 0 && preg_match('/^R(\d*|INF)$/', $part, $match)) { + $parsed = \strlen($match[1]) ? (($match[1] !== 'INF') ? (int) $match[1] : INF) : null; + } elseif ($interval === null && $parsed = CarbonInterval::make($part)) { + $interval = $part; + } elseif ($start === null && $parsed = $dateClass::make($part)) { + $start = $part; + } elseif ($end === null && $parsed = $dateClass::make(static::addMissingParts($start ?? '', $part))) { + $end = $part; + } else { + throw new InvalidPeriodParameterException("Invalid ISO 8601 specification: $iso."); + } + + $result[] = $parsed; + } + + return $result; + } + + /** + * Add missing parts of the target date from the source date. + * + * @param string $source + * @param string $target + * + * @return string + */ + protected static function addMissingParts($source, $target) + { + $pattern = '/'.preg_replace('/\d+/', '[0-9]+', preg_quote($target, '/')).'$/'; + + $result = preg_replace($pattern, $target, $source, 1, $count); + + return $count ? $result : $target; + } + + /** + * Register a custom macro. + * + * @example + * ``` + * CarbonPeriod::macro('middle', function () { + * return $this->getStartDate()->average($this->getEndDate()); + * }); + * echo CarbonPeriod::since('2011-05-12')->until('2011-06-03')->middle(); + * ``` + * + * @param string $name + * @param object|callable $macro + * + * @return void + */ + public static function macro($name, $macro) + { + static::$macros[$name] = $macro; + } + + /** + * Register macros from a mixin object. + * + * @example + * ``` + * CarbonPeriod::mixin(new class { + * public function addDays() { + * return function ($count = 1) { + * return $this->setStartDate( + * $this->getStartDate()->addDays($count) + * )->setEndDate( + * $this->getEndDate()->addDays($count) + * ); + * }; + * } + * public function subDays() { + * return function ($count = 1) { + * return $this->setStartDate( + * $this->getStartDate()->subDays($count) + * )->setEndDate( + * $this->getEndDate()->subDays($count) + * ); + * }; + * } + * }); + * echo CarbonPeriod::create('2000-01-01', '2000-02-01')->addDays(5)->subDays(3); + * ``` + * + * @param object|string $mixin + * + * @throws ReflectionException + * + * @return void + */ + public static function mixin($mixin) + { + static::baseMixin($mixin); + } + + /** + * Check if macro is registered. + * + * @param string $name + * + * @return bool + */ + public static function hasMacro($name) + { + return isset(static::$macros[$name]); + } + + /** + * Provide static proxy for instance aliases. + * + * @param string $method + * @param array $parameters + * + * @return mixed + */ + public static function __callStatic($method, $parameters) + { + $date = new static(); + + if (static::hasMacro($method)) { + return static::bindMacroContext(null, function () use (&$method, &$parameters, &$date) { + return $date->callMacro($method, $parameters); + }); + } + + return $date->$method(...$parameters); + } + + /** + * CarbonPeriod constructor. + * + * @SuppressWarnings(PHPMD.ElseExpression) + * + * @throws InvalidArgumentException + */ + public function __construct(...$arguments) + { + if (is_a($this->dateClass, DateTimeImmutable::class, true)) { + $this->options = static::IMMUTABLE; + } + + // Parse and assign arguments one by one. First argument may be an ISO 8601 spec, + // which will be first parsed into parts and then processed the same way. + + $argumentsCount = \count($arguments); + + if ($argumentsCount && static::isIso8601($iso = $arguments[0])) { + array_splice($arguments, 0, 1, static::parseIso8601($iso)); + } + + if ($argumentsCount === 1) { + if ($arguments[0] instanceof DatePeriod) { + $arguments = [ + $arguments[0]->start, + $arguments[0]->end ?: ($arguments[0]->recurrences - 1), + $arguments[0]->interval, + $arguments[0]->include_start_date ? 0 : static::EXCLUDE_START_DATE, + ]; + } elseif ($arguments[0] instanceof self) { + $arguments = [ + $arguments[0]->getStartDate(), + $arguments[0]->getEndDate() ?: $arguments[0]->getRecurrences(), + $arguments[0]->getDateInterval(), + $arguments[0]->getOptions(), + ]; + } + } + + $optionsSet = false; + + foreach ($arguments as $argument) { + $parsedDate = null; + + if ($argument instanceof DateTimeZone) { + $this->setTimezone($argument); + } elseif ($this->dateInterval === null && + ( + (\is_string($argument) && preg_match( + '/^(-?\d(\d(?![\/-])|[^\d\/-]([\/-])?)*|P[T\d].*|(?:\h*\d+(?:\.\d+)?\h*[a-z]+)+)$/i', + $argument + )) || + $argument instanceof DateInterval || + $argument instanceof Closure + ) && + $parsedInterval = @CarbonInterval::make($argument) + ) { + $this->setDateInterval($parsedInterval); + } elseif ($this->startDate === null && $parsedDate = $this->makeDateTime($argument)) { + $this->setStartDate($parsedDate); + } elseif ($this->endDate === null && ($parsedDate = $parsedDate ?? $this->makeDateTime($argument))) { + $this->setEndDate($parsedDate); + } elseif ($this->recurrences === null && $this->endDate === null && is_numeric($argument)) { + $this->setRecurrences($argument); + } elseif (!$optionsSet && (\is_int($argument) || $argument === null)) { + $optionsSet = true; + $this->setOptions(((int) $this->options) | ((int) $argument)); + } else { + throw new InvalidPeriodParameterException('Invalid constructor parameters.'); + } + } + + if ($this->startDate === null) { + $dateClass = $this->dateClass; + $this->setStartDate($dateClass::now()); + } + + if ($this->dateInterval === null) { + $this->setDateInterval(CarbonInterval::day()); + + $this->isDefaultInterval = true; + } + + if ($this->options === null) { + $this->setOptions(0); + } + + $this->constructed = true; + } + + /** + * Get a copy of the instance. + * + * @return static + */ + public function copy() + { + return clone $this; + } + + /** + * Prepare the instance to be set (self if mutable to be mutated, + * copy if immutable to generate a new instance). + * + * @return static + */ + protected function copyIfImmutable() + { + return $this; + } + + /** + * Get the getter for a property allowing both `DatePeriod` snakeCase and camelCase names. + * + * @param string $name + * + * @return callable|null + */ + protected function getGetter(string $name) + { + switch (strtolower(preg_replace('/[A-Z]/', '_$0', $name))) { + case 'start': + case 'start_date': + return [$this, 'getStartDate']; + case 'end': + case 'end_date': + return [$this, 'getEndDate']; + case 'interval': + case 'date_interval': + return [$this, 'getDateInterval']; + case 'recurrences': + return [$this, 'getRecurrences']; + case 'include_start_date': + return [$this, 'isStartIncluded']; + case 'include_end_date': + return [$this, 'isEndIncluded']; + case 'current': + return [$this, 'current']; + default: + return null; + } + } + + /** + * Get a property allowing both `DatePeriod` snakeCase and camelCase names. + * + * @param string $name + * + * @return bool|CarbonInterface|CarbonInterval|int|null + */ + public function get(string $name) + { + $getter = $this->getGetter($name); + + if ($getter) { + return $getter(); + } + + throw new UnknownGetterException($name); + } + + /** + * Get a property allowing both `DatePeriod` snakeCase and camelCase names. + * + * @param string $name + * + * @return bool|CarbonInterface|CarbonInterval|int|null + */ + public function __get(string $name) + { + return $this->get($name); + } + + /** + * Check if an attribute exists on the object + * + * @param string $name + * + * @return bool + */ + public function __isset(string $name): bool + { + return $this->getGetter($name) !== null; + } + + /** + * @alias copy + * + * Get a copy of the instance. + * + * @return static + */ + public function clone() + { + return clone $this; + } + + /** + * Set the iteration item class. + * + * @param string $dateClass + * + * @return static + */ + public function setDateClass(string $dateClass) + { + if (!is_a($dateClass, CarbonInterface::class, true)) { + throw new NotACarbonClassException($dateClass); + } + + $self = $this->copyIfImmutable(); + $self->dateClass = $dateClass; + + if (is_a($dateClass, Carbon::class, true)) { + $self->options = $self->options & ~static::IMMUTABLE; + } elseif (is_a($dateClass, CarbonImmutable::class, true)) { + $self->options = $self->options | static::IMMUTABLE; + } + + return $self; + } + + /** + * Returns iteration item date class. + * + * @return string + */ + public function getDateClass(): string + { + return $this->dateClass; + } + + /** + * Change the period date interval. + * + * @param DateInterval|string $interval + * + * @throws InvalidIntervalException + * + * @return static + */ + public function setDateInterval($interval) + { + if (!$interval = CarbonInterval::make($interval)) { + throw new InvalidIntervalException('Invalid interval.'); + } + + if ($interval->spec() === 'PT0S' && !$interval->f && !$interval->getStep()) { + throw new InvalidIntervalException('Empty interval is not accepted.'); + } + + $self = $this->copyIfImmutable(); + $self->dateInterval = $interval; + + $self->isDefaultInterval = false; + + $self->handleChangedParameters(); + + return $self; + } + + /** + * Invert the period date interval. + * + * @return static + */ + public function invertDateInterval() + { + return $this->setDateInterval($this->dateInterval->invert()); + } + + /** + * Set start and end date. + * + * @param DateTime|DateTimeInterface|string $start + * @param DateTime|DateTimeInterface|string|null $end + * + * @return static + */ + public function setDates($start, $end) + { + return $this->setStartDate($start)->setEndDate($end); + } + + /** + * Change the period options. + * + * @param int|null $options + * + * @throws InvalidArgumentException + * + * @return static + */ + public function setOptions($options) + { + if (!\is_int($options) && $options !== null) { + throw new InvalidPeriodParameterException('Invalid options.'); + } + + $self = $this->copyIfImmutable(); + $self->options = $options ?: 0; + + $self->handleChangedParameters(); + + return $self; + } + + /** + * Get the period options. + * + * @return int + */ + public function getOptions() + { + return $this->options; + } + + /** + * Toggle given options on or off. + * + * @param int $options + * @param bool|null $state + * + * @throws \InvalidArgumentException + * + * @return static + */ + public function toggleOptions($options, $state = null) + { + if ($state === null) { + $state = ($this->options & $options) !== $options; + } + + return $this->setOptions( + $state ? + $this->options | $options : + $this->options & ~$options + ); + } + + /** + * Toggle EXCLUDE_START_DATE option. + * + * @param bool $state + * + * @return static + */ + public function excludeStartDate($state = true) + { + return $this->toggleOptions(static::EXCLUDE_START_DATE, $state); + } + + /** + * Toggle EXCLUDE_END_DATE option. + * + * @param bool $state + * + * @return static + */ + public function excludeEndDate($state = true) + { + return $this->toggleOptions(static::EXCLUDE_END_DATE, $state); + } + + /** + * Get the underlying date interval. + * + * @return CarbonInterval + */ + public function getDateInterval() + { + return $this->dateInterval->copy(); + } + + /** + * Get start date of the period. + * + * @param string|null $rounding Optional rounding 'floor', 'ceil', 'round' using the period interval. + * + * @return CarbonInterface + */ + public function getStartDate(string $rounding = null) + { + $date = $this->startDate->avoidMutation(); + + return $rounding ? $date->round($this->getDateInterval(), $rounding) : $date; + } + + /** + * Get end date of the period. + * + * @param string|null $rounding Optional rounding 'floor', 'ceil', 'round' using the period interval. + * + * @return CarbonInterface|null + */ + public function getEndDate(string $rounding = null) + { + if (!$this->endDate) { + return null; + } + + $date = $this->endDate->avoidMutation(); + + return $rounding ? $date->round($this->getDateInterval(), $rounding) : $date; + } + + /** + * Get number of recurrences. + * + * @return int|float|null + */ + public function getRecurrences() + { + return $this->recurrences; + } + + /** + * Returns true if the start date should be excluded. + * + * @return bool + */ + public function isStartExcluded() + { + return ($this->options & static::EXCLUDE_START_DATE) !== 0; + } + + /** + * Returns true if the end date should be excluded. + * + * @return bool + */ + public function isEndExcluded() + { + return ($this->options & static::EXCLUDE_END_DATE) !== 0; + } + + /** + * Returns true if the start date should be included. + * + * @return bool + */ + public function isStartIncluded() + { + return !$this->isStartExcluded(); + } + + /** + * Returns true if the end date should be included. + * + * @return bool + */ + public function isEndIncluded() + { + return !$this->isEndExcluded(); + } + + /** + * Return the start if it's included by option, else return the start + 1 period interval. + * + * @return CarbonInterface + */ + public function getIncludedStartDate() + { + $start = $this->getStartDate(); + + if ($this->isStartExcluded()) { + return $start->add($this->getDateInterval()); + } + + return $start; + } + + /** + * Return the end if it's included by option, else return the end - 1 period interval. + * Warning: if the period has no fixed end, this method will iterate the period to calculate it. + * + * @return CarbonInterface + */ + public function getIncludedEndDate() + { + $end = $this->getEndDate(); + + if (!$end) { + return $this->calculateEnd(); + } + + if ($this->isEndExcluded()) { + return $end->sub($this->getDateInterval()); + } + + return $end; + } + + /** + * Add a filter to the stack. + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * + * @param callable $callback + * @param string $name + * + * @return static + */ + public function addFilter($callback, $name = null) + { + $self = $this->copyIfImmutable(); + $tuple = $self->createFilterTuple(\func_get_args()); + + $self->filters[] = $tuple; + + $self->handleChangedParameters(); + + return $self; + } + + /** + * Prepend a filter to the stack. + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * + * @param callable $callback + * @param string $name + * + * @return static + */ + public function prependFilter($callback, $name = null) + { + $self = $this->copyIfImmutable(); + $tuple = $self->createFilterTuple(\func_get_args()); + + array_unshift($self->filters, $tuple); + + $self->handleChangedParameters(); + + return $self; + } + + /** + * Remove a filter by instance or name. + * + * @param callable|string $filter + * + * @return static + */ + public function removeFilter($filter) + { + $self = $this->copyIfImmutable(); + $key = \is_callable($filter) ? 0 : 1; + + $self->filters = array_values(array_filter( + $this->filters, + function ($tuple) use ($key, $filter) { + return $tuple[$key] !== $filter; + } + )); + + $self->updateInternalState(); + + $self->handleChangedParameters(); + + return $self; + } + + /** + * Return whether given instance or name is in the filter stack. + * + * @param callable|string $filter + * + * @return bool + */ + public function hasFilter($filter) + { + $key = \is_callable($filter) ? 0 : 1; + + foreach ($this->filters as $tuple) { + if ($tuple[$key] === $filter) { + return true; + } + } + + return false; + } + + /** + * Get filters stack. + * + * @return array + */ + public function getFilters() + { + return $this->filters; + } + + /** + * Set filters stack. + * + * @param array $filters + * + * @return static + */ + public function setFilters(array $filters) + { + $self = $this->copyIfImmutable(); + $self->filters = $filters; + + $self->updateInternalState(); + + $self->handleChangedParameters(); + + return $self; + } + + /** + * Reset filters stack. + * + * @return static + */ + public function resetFilters() + { + $self = $this->copyIfImmutable(); + $self->filters = []; + + if ($self->endDate !== null) { + $self->filters[] = [static::END_DATE_FILTER, null]; + } + + if ($self->recurrences !== null) { + $self->filters[] = [static::RECURRENCES_FILTER, null]; + } + + $self->handleChangedParameters(); + + return $self; + } + + /** + * Add a recurrences filter (set maximum number of recurrences). + * + * @param int|float|null $recurrences + * + * @throws InvalidArgumentException + * + * @return static + */ + public function setRecurrences($recurrences) + { + if ((!is_numeric($recurrences) && $recurrences !== null) || $recurrences < 0) { + throw new InvalidPeriodParameterException('Invalid number of recurrences.'); + } + + if ($recurrences === null) { + return $this->removeFilter(static::RECURRENCES_FILTER); + } + + /** @var self $self */ + $self = $this->copyIfImmutable(); + $self->recurrences = $recurrences === INF ? INF : (int) $recurrences; + + if (!$self->hasFilter(static::RECURRENCES_FILTER)) { + return $self->addFilter(static::RECURRENCES_FILTER); + } + + $self->handleChangedParameters(); + + return $self; + } + + /** + * Change the period start date. + * + * @param DateTime|DateTimeInterface|string $date + * @param bool|null $inclusive + * + * @throws InvalidPeriodDateException + * + * @return static + */ + public function setStartDate($date, $inclusive = null) + { + if (!$this->isInfiniteDate($date) && !($date = ([$this->dateClass, 'make'])($date))) { + throw new InvalidPeriodDateException('Invalid start date.'); + } + + $self = $this->copyIfImmutable(); + $self->startDate = $date; + + if ($inclusive !== null) { + $self = $self->toggleOptions(static::EXCLUDE_START_DATE, !$inclusive); + } + + return $self; + } + + /** + * Change the period end date. + * + * @param DateTime|DateTimeInterface|string|null $date + * @param bool|null $inclusive + * + * @throws \InvalidArgumentException + * + * @return static + */ + public function setEndDate($date, $inclusive = null) + { + if ($date !== null && !$this->isInfiniteDate($date) && !$date = ([$this->dateClass, 'make'])($date)) { + throw new InvalidPeriodDateException('Invalid end date.'); + } + + if (!$date) { + return $this->removeFilter(static::END_DATE_FILTER); + } + + $self = $this->copyIfImmutable(); + $self->endDate = $date; + + if ($inclusive !== null) { + $self = $self->toggleOptions(static::EXCLUDE_END_DATE, !$inclusive); + } + + if (!$self->hasFilter(static::END_DATE_FILTER)) { + return $self->addFilter(static::END_DATE_FILTER); + } + + $self->handleChangedParameters(); + + return $self; + } + + /** + * Check if the current position is valid. + * + * @return bool + */ + #[ReturnTypeWillChange] + public function valid() + { + return $this->validateCurrentDate() === true; + } + + /** + * Return the current key. + * + * @return int|null + */ + #[ReturnTypeWillChange] + public function key() + { + return $this->valid() + ? $this->key + : null; + } + + /** + * Return the current date. + * + * @return CarbonInterface|null + */ + #[ReturnTypeWillChange] + public function current() + { + return $this->valid() + ? $this->prepareForReturn($this->current) + : null; + } + + /** + * Move forward to the next date. + * + * @throws RuntimeException + * + * @return void + */ + #[ReturnTypeWillChange] + public function next() + { + if ($this->current === null) { + $this->rewind(); + } + + if ($this->validationResult !== static::END_ITERATION) { + $this->key++; + + $this->incrementCurrentDateUntilValid(); + } + } + + /** + * Rewind to the start date. + * + * Iterating over a date in the UTC timezone avoids bug during backward DST change. + * + * @see https://bugs.php.net/bug.php?id=72255 + * @see https://bugs.php.net/bug.php?id=74274 + * @see https://wiki.php.net/rfc/datetime_and_daylight_saving_time + * + * @throws RuntimeException + * + * @return void + */ + #[ReturnTypeWillChange] + public function rewind() + { + $this->key = 0; + $this->current = ([$this->dateClass, 'make'])($this->startDate); + $settings = $this->getSettings(); + + if ($this->hasLocalTranslator()) { + $settings['locale'] = $this->getTranslatorLocale(); + } + + $this->current->settings($settings); + $this->timezone = static::intervalHasTime($this->dateInterval) ? $this->current->getTimezone() : null; + + if ($this->timezone) { + $this->current = $this->current->utc(); + } + + $this->validationResult = null; + + if ($this->isStartExcluded() || $this->validateCurrentDate() === false) { + $this->incrementCurrentDateUntilValid(); + } + } + + /** + * Skip iterations and returns iteration state (false if ended, true if still valid). + * + * @param int $count steps number to skip (1 by default) + * + * @return bool + */ + public function skip($count = 1) + { + for ($i = $count; $this->valid() && $i > 0; $i--) { + $this->next(); + } + + return $this->valid(); + } + + /** + * Format the date period as ISO 8601. + * + * @return string + */ + public function toIso8601String() + { + $parts = []; + + if ($this->recurrences !== null) { + $parts[] = 'R'.$this->recurrences; + } + + $parts[] = $this->startDate->toIso8601String(); + + $parts[] = $this->dateInterval->spec(); + + if ($this->endDate !== null) { + $parts[] = $this->endDate->toIso8601String(); + } + + return implode('/', $parts); + } + + /** + * Convert the date period into a string. + * + * @return string + */ + public function toString() + { + $format = $this->localToStringFormat ?? static::$toStringFormat; + + if ($format instanceof Closure) { + return $format($this); + } + + $translator = ([$this->dateClass, 'getTranslator'])(); + + $parts = []; + + $format = $format ?? ( + !$this->startDate->isStartOfDay() || ($this->endDate && !$this->endDate->isStartOfDay()) + ? 'Y-m-d H:i:s' + : 'Y-m-d' + ); + + if ($this->recurrences !== null) { + $parts[] = $this->translate('period_recurrences', [], $this->recurrences, $translator); + } + + $parts[] = $this->translate('period_interval', [':interval' => $this->dateInterval->forHumans([ + 'join' => true, + ])], null, $translator); + + $parts[] = $this->translate('period_start_date', [':date' => $this->startDate->rawFormat($format)], null, $translator); + + if ($this->endDate !== null) { + $parts[] = $this->translate('period_end_date', [':date' => $this->endDate->rawFormat($format)], null, $translator); + } + + $result = implode(' ', $parts); + + return mb_strtoupper(mb_substr($result, 0, 1)).mb_substr($result, 1); + } + + /** + * Format the date period as ISO 8601. + * + * @return string + */ + public function spec() + { + return $this->toIso8601String(); + } + + /** + * Cast the current instance into the given class. + * + * @param string $className The $className::instance() method will be called to cast the current object. + * + * @return DatePeriod + */ + public function cast(string $className) + { + if (!method_exists($className, 'instance')) { + if (is_a($className, DatePeriod::class, true)) { + return new $className( + $this->rawDate($this->getStartDate()), + $this->getDateInterval(), + $this->getEndDate() ? $this->rawDate($this->getIncludedEndDate()) : $this->getRecurrences(), + $this->isStartExcluded() ? DatePeriod::EXCLUDE_START_DATE : 0 + ); + } + + throw new InvalidCastException("$className has not the instance() method needed to cast the date."); + } + + return $className::instance($this); + } + + /** + * Return native DatePeriod PHP object matching the current instance. + * + * @example + * ``` + * var_dump(CarbonPeriod::create('2021-01-05', '2021-02-15')->toDatePeriod()); + * ``` + * + * @return DatePeriod + */ + public function toDatePeriod() + { + return $this->cast(DatePeriod::class); + } + + /** + * Return `true` if the period has no custom filter and is guaranteed to be endless. + * + * Note that we can't check if a period is endless as soon as it has custom filters + * because filters can emit `CarbonPeriod::END_ITERATION` to stop the iteration in + * a way we can't predict without actually iterating the period. + */ + public function isUnfilteredAndEndLess(): bool + { + foreach ($this->filters as $filter) { + switch ($filter) { + case [static::RECURRENCES_FILTER, null]: + if ($this->recurrences !== null && is_finite($this->recurrences)) { + return false; + } + + break; + + case [static::END_DATE_FILTER, null]: + if ($this->endDate !== null && !$this->endDate->isEndOfTime()) { + return false; + } + + break; + + default: + return false; + } + } + + return true; + } + + /** + * Convert the date period into an array without changing current iteration state. + * + * @return CarbonInterface[] + */ + public function toArray() + { + if ($this->isUnfilteredAndEndLess()) { + throw new EndLessPeriodException("Endless period can't be converted to array nor counted."); + } + + $state = [ + $this->key, + $this->current ? $this->current->avoidMutation() : null, + $this->validationResult, + ]; + + $result = iterator_to_array($this); + + [$this->key, $this->current, $this->validationResult] = $state; + + return $result; + } + + /** + * Count dates in the date period. + * + * @return int + */ + #[ReturnTypeWillChange] + public function count() + { + return \count($this->toArray()); + } + + /** + * Return the first date in the date period. + * + * @return CarbonInterface|null + */ + public function first() + { + if ($this->isUnfilteredAndEndLess()) { + foreach ($this as $date) { + $this->rewind(); + + return $date; + } + + return null; + } + + return ($this->toArray() ?: [])[0] ?? null; + } + + /** + * Return the last date in the date period. + * + * @return CarbonInterface|null + */ + public function last() + { + $array = $this->toArray(); + + return $array ? $array[\count($array) - 1] : null; + } + + /** + * Convert the date period into a string. + * + * @return string + */ + public function __toString() + { + return $this->toString(); + } + + /** + * Add aliases for setters. + * + * CarbonPeriod::days(3)->hours(5)->invert() + * ->sinceNow()->until('2010-01-10') + * ->filter(...) + * ->count() + * + * Note: We use magic method to let static and instance aliases with the same names. + * + * @param string $method + * @param array $parameters + * + * @return mixed + */ + public function __call($method, $parameters) + { + if (static::hasMacro($method)) { + return static::bindMacroContext($this, function () use (&$method, &$parameters) { + return $this->callMacro($method, $parameters); + }); + } + + $roundedValue = $this->callRoundMethod($method, $parameters); + + if ($roundedValue !== null) { + return $roundedValue; + } + + switch ($method) { + case 'start': + case 'since': + self::setDefaultParameters($parameters, [ + [0, 'date', null], + ]); + + return $this->setStartDate(...$parameters); + + case 'sinceNow': + return $this->setStartDate(new Carbon(), ...$parameters); + + case 'end': + case 'until': + self::setDefaultParameters($parameters, [ + [0, 'date', null], + ]); + + return $this->setEndDate(...$parameters); + + case 'untilNow': + return $this->setEndDate(new Carbon(), ...$parameters); + + case 'dates': + case 'between': + self::setDefaultParameters($parameters, [ + [0, 'start', null], + [1, 'end', null], + ]); + + return $this->setDates(...$parameters); + + case 'recurrences': + case 'times': + self::setDefaultParameters($parameters, [ + [0, 'recurrences', null], + ]); + + return $this->setRecurrences(...$parameters); + + case 'options': + self::setDefaultParameters($parameters, [ + [0, 'options', null], + ]); + + return $this->setOptions(...$parameters); + + case 'toggle': + self::setDefaultParameters($parameters, [ + [0, 'options', null], + ]); + + return $this->toggleOptions(...$parameters); + + case 'filter': + case 'push': + return $this->addFilter(...$parameters); + + case 'prepend': + return $this->prependFilter(...$parameters); + + case 'filters': + self::setDefaultParameters($parameters, [ + [0, 'filters', []], + ]); + + return $this->setFilters(...$parameters); + + case 'interval': + case 'each': + case 'every': + case 'step': + case 'stepBy': + return $this->setDateInterval(...$parameters); + + case 'invert': + return $this->invertDateInterval(); + + case 'years': + case 'year': + case 'months': + case 'month': + case 'weeks': + case 'week': + case 'days': + case 'dayz': + case 'day': + case 'hours': + case 'hour': + case 'minutes': + case 'minute': + case 'seconds': + case 'second': + case 'milliseconds': + case 'millisecond': + case 'microseconds': + case 'microsecond': + return $this->setDateInterval(( + // Override default P1D when instantiating via fluent setters. + [$this->isDefaultInterval ? new CarbonInterval('PT0S') : $this->dateInterval, $method] + )(...$parameters)); + } + + $dateClass = $this->dateClass; + + if ($this->localStrictModeEnabled ?? $dateClass::isStrictModeEnabled()) { + throw new UnknownMethodException($method); + } + + return $this; + } + + /** + * Set the instance's timezone from a string or object and apply it to start/end. + * + * @param \DateTimeZone|string $timezone + * + * @return static + */ + public function setTimezone($timezone) + { + $self = $this->copyIfImmutable(); + $self->tzName = $timezone; + $self->timezone = $timezone; + + if ($self->startDate) { + $self = $self->setStartDate($self->startDate->setTimezone($timezone)); + } + + if ($self->endDate) { + $self = $self->setEndDate($self->endDate->setTimezone($timezone)); + } + + return $self; + } + + /** + * Set the instance's timezone from a string or object and add/subtract the offset difference to start/end. + * + * @param \DateTimeZone|string $timezone + * + * @return static + */ + public function shiftTimezone($timezone) + { + $self = $this->copyIfImmutable(); + $self->tzName = $timezone; + $self->timezone = $timezone; + + if ($self->startDate) { + $self = $self->setStartDate($self->startDate->shiftTimezone($timezone)); + } + + if ($self->endDate) { + $self = $self->setEndDate($self->endDate->shiftTimezone($timezone)); + } + + return $self; + } + + /** + * Returns the end is set, else calculated from start an recurrences. + * + * @param string|null $rounding Optional rounding 'floor', 'ceil', 'round' using the period interval. + * + * @return CarbonInterface + */ + public function calculateEnd(string $rounding = null) + { + if ($end = $this->getEndDate($rounding)) { + return $end; + } + + if ($this->dateInterval->isEmpty()) { + return $this->getStartDate($rounding); + } + + $date = $this->getEndFromRecurrences() ?? $this->iterateUntilEnd(); + + if ($date && $rounding) { + $date = $date->avoidMutation()->round($this->getDateInterval(), $rounding); + } + + return $date; + } + + /** + * @return CarbonInterface|null + */ + private function getEndFromRecurrences() + { + if ($this->recurrences === null) { + throw new UnreachableException( + "Could not calculate period end without either explicit end or recurrences.\n". + "If you're looking for a forever-period, use ->setRecurrences(INF)." + ); + } + + if ($this->recurrences === INF) { + $start = $this->getStartDate(); + + return $start < $start->avoidMutation()->add($this->getDateInterval()) + ? CarbonImmutable::endOfTime() + : CarbonImmutable::startOfTime(); + } + + if ($this->filters === [[static::RECURRENCES_FILTER, null]]) { + return $this->getStartDate()->avoidMutation()->add( + $this->getDateInterval()->times( + $this->recurrences - ($this->isStartExcluded() ? 0 : 1) + ) + ); + } + + return null; + } + + /** + * @return CarbonInterface|null + */ + private function iterateUntilEnd() + { + $attempts = 0; + $date = null; + + foreach ($this as $date) { + if (++$attempts > static::END_MAX_ATTEMPTS) { + throw new UnreachableException( + 'Could not calculate period end after iterating '.static::END_MAX_ATTEMPTS.' times.' + ); + } + } + + return $date; + } + + /** + * Returns true if the current period overlaps the given one (if 1 parameter passed) + * or the period between 2 dates (if 2 parameters passed). + * + * @param CarbonPeriod|\DateTimeInterface|Carbon|CarbonImmutable|string $rangeOrRangeStart + * @param \DateTimeInterface|Carbon|CarbonImmutable|string|null $rangeEnd + * + * @return bool + */ + public function overlaps($rangeOrRangeStart, $rangeEnd = null) + { + $range = $rangeEnd ? static::create($rangeOrRangeStart, $rangeEnd) : $rangeOrRangeStart; + + if (!($range instanceof self)) { + $range = static::create($range); + } + + [$start, $end] = $this->orderCouple($this->getStartDate(), $this->calculateEnd()); + [$rangeStart, $rangeEnd] = $this->orderCouple($range->getStartDate(), $range->calculateEnd()); + + return $end > $rangeStart && $rangeEnd > $start; + } + + /** + * Execute a given function on each date of the period. + * + * @example + * ``` + * Carbon::create('2020-11-29')->daysUntil('2020-12-24')->forEach(function (Carbon $date) { + * echo $date->diffInDays('2020-12-25')." days before Christmas!\n"; + * }); + * ``` + * + * @param callable $callback + */ + public function forEach(callable $callback) + { + foreach ($this as $date) { + $callback($date); + } + } + + /** + * Execute a given function on each date of the period and yield the result of this function. + * + * @example + * ``` + * $period = Carbon::create('2020-11-29')->daysUntil('2020-12-24'); + * echo implode("\n", iterator_to_array($period->map(function (Carbon $date) { + * return $date->diffInDays('2020-12-25').' days before Christmas!'; + * }))); + * ``` + * + * @param callable $callback + * + * @return \Generator + */ + public function map(callable $callback) + { + foreach ($this as $date) { + yield $callback($date); + } + } + + /** + * Determines if the instance is equal to another. + * Warning: if options differ, instances will never be equal. + * + * @param mixed $period + * + * @see equalTo() + * + * @return bool + */ + public function eq($period): bool + { + return $this->equalTo($period); + } + + /** + * Determines if the instance is equal to another. + * Warning: if options differ, instances will never be equal. + * + * @param mixed $period + * + * @return bool + */ + public function equalTo($period): bool + { + if (!($period instanceof self)) { + $period = self::make($period); + } + + $end = $this->getEndDate(); + + return $period !== null + && $this->getDateInterval()->eq($period->getDateInterval()) + && $this->getStartDate()->eq($period->getStartDate()) + && ($end ? $end->eq($period->getEndDate()) : $this->getRecurrences() === $period->getRecurrences()) + && ($this->getOptions() & (~static::IMMUTABLE)) === ($period->getOptions() & (~static::IMMUTABLE)); + } + + /** + * Determines if the instance is not equal to another. + * Warning: if options differ, instances will never be equal. + * + * @param mixed $period + * + * @see notEqualTo() + * + * @return bool + */ + public function ne($period): bool + { + return $this->notEqualTo($period); + } + + /** + * Determines if the instance is not equal to another. + * Warning: if options differ, instances will never be equal. + * + * @param mixed $period + * + * @return bool + */ + public function notEqualTo($period): bool + { + return !$this->eq($period); + } + + /** + * Determines if the start date is before an other given date. + * (Rather start/end are included by options is ignored.) + * + * @param mixed $date + * + * @return bool + */ + public function startsBefore($date = null): bool + { + return $this->getStartDate()->lessThan($this->resolveCarbon($date)); + } + + /** + * Determines if the start date is before or the same as a given date. + * (Rather start/end are included by options is ignored.) + * + * @param mixed $date + * + * @return bool + */ + public function startsBeforeOrAt($date = null): bool + { + return $this->getStartDate()->lessThanOrEqualTo($this->resolveCarbon($date)); + } + + /** + * Determines if the start date is after an other given date. + * (Rather start/end are included by options is ignored.) + * + * @param mixed $date + * + * @return bool + */ + public function startsAfter($date = null): bool + { + return $this->getStartDate()->greaterThan($this->resolveCarbon($date)); + } + + /** + * Determines if the start date is after or the same as a given date. + * (Rather start/end are included by options is ignored.) + * + * @param mixed $date + * + * @return bool + */ + public function startsAfterOrAt($date = null): bool + { + return $this->getStartDate()->greaterThanOrEqualTo($this->resolveCarbon($date)); + } + + /** + * Determines if the start date is the same as a given date. + * (Rather start/end are included by options is ignored.) + * + * @param mixed $date + * + * @return bool + */ + public function startsAt($date = null): bool + { + return $this->getStartDate()->equalTo($this->resolveCarbon($date)); + } + + /** + * Determines if the end date is before an other given date. + * (Rather start/end are included by options is ignored.) + * + * @param mixed $date + * + * @return bool + */ + public function endsBefore($date = null): bool + { + return $this->calculateEnd()->lessThan($this->resolveCarbon($date)); + } + + /** + * Determines if the end date is before or the same as a given date. + * (Rather start/end are included by options is ignored.) + * + * @param mixed $date + * + * @return bool + */ + public function endsBeforeOrAt($date = null): bool + { + return $this->calculateEnd()->lessThanOrEqualTo($this->resolveCarbon($date)); + } + + /** + * Determines if the end date is after an other given date. + * (Rather start/end are included by options is ignored.) + * + * @param mixed $date + * + * @return bool + */ + public function endsAfter($date = null): bool + { + return $this->calculateEnd()->greaterThan($this->resolveCarbon($date)); + } + + /** + * Determines if the end date is after or the same as a given date. + * (Rather start/end are included by options is ignored.) + * + * @param mixed $date + * + * @return bool + */ + public function endsAfterOrAt($date = null): bool + { + return $this->calculateEnd()->greaterThanOrEqualTo($this->resolveCarbon($date)); + } + + /** + * Determines if the end date is the same as a given date. + * (Rather start/end are included by options is ignored.) + * + * @param mixed $date + * + * @return bool + */ + public function endsAt($date = null): bool + { + return $this->calculateEnd()->equalTo($this->resolveCarbon($date)); + } + + /** + * Return true if start date is now or later. + * (Rather start/end are included by options is ignored.) + * + * @return bool + */ + public function isStarted(): bool + { + return $this->startsBeforeOrAt(); + } + + /** + * Return true if end date is now or later. + * (Rather start/end are included by options is ignored.) + * + * @return bool + */ + public function isEnded(): bool + { + return $this->endsBeforeOrAt(); + } + + /** + * Return true if now is between start date (included) and end date (excluded). + * (Rather start/end are included by options is ignored.) + * + * @return bool + */ + public function isInProgress(): bool + { + return $this->isStarted() && !$this->isEnded(); + } + + /** + * Round the current instance at the given unit with given precision if specified and the given function. + * + * @param string $unit + * @param float|int|string|\DateInterval|null $precision + * @param string $function + * + * @return static + */ + public function roundUnit($unit, $precision = 1, $function = 'round') + { + $self = $this->copyIfImmutable(); + $self = $self->setStartDate($self->getStartDate()->roundUnit($unit, $precision, $function)); + + if ($self->endDate) { + $self = $self->setEndDate($self->getEndDate()->roundUnit($unit, $precision, $function)); + } + + return $self->setDateInterval($self->getDateInterval()->roundUnit($unit, $precision, $function)); + } + + /** + * Truncate the current instance at the given unit with given precision if specified. + * + * @param string $unit + * @param float|int|string|\DateInterval|null $precision + * + * @return static + */ + public function floorUnit($unit, $precision = 1) + { + return $this->roundUnit($unit, $precision, 'floor'); + } + + /** + * Ceil the current instance at the given unit with given precision if specified. + * + * @param string $unit + * @param float|int|string|\DateInterval|null $precision + * + * @return static + */ + public function ceilUnit($unit, $precision = 1) + { + return $this->roundUnit($unit, $precision, 'ceil'); + } + + /** + * Round the current instance second with given precision if specified (else period interval is used). + * + * @param float|int|string|\DateInterval|null $precision + * @param string $function + * + * @return static + */ + public function round($precision = null, $function = 'round') + { + return $this->roundWith( + $precision ?? $this->getDateInterval()->setLocalTranslator(TranslatorImmutable::get('en'))->forHumans(), + $function + ); + } + + /** + * Round the current instance second with given precision if specified (else period interval is used). + * + * @param float|int|string|\DateInterval|null $precision + * + * @return static + */ + public function floor($precision = null) + { + return $this->round($precision, 'floor'); + } + + /** + * Ceil the current instance second with given precision if specified (else period interval is used). + * + * @param float|int|string|\DateInterval|null $precision + * + * @return static + */ + public function ceil($precision = null) + { + return $this->round($precision, 'ceil'); + } + + /** + * Specify data which should be serialized to JSON. + * + * @link https://php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return CarbonInterface[] + */ + #[ReturnTypeWillChange] + public function jsonSerialize() + { + return $this->toArray(); + } + + /** + * Return true if the given date is between start and end. + * + * @param \Carbon\Carbon|\Carbon\CarbonPeriod|\Carbon\CarbonInterval|\DateInterval|\DatePeriod|\DateTimeInterface|string|null $date + * + * @return bool + */ + public function contains($date = null): bool + { + $startMethod = 'startsBefore'.($this->isStartIncluded() ? 'OrAt' : ''); + $endMethod = 'endsAfter'.($this->isEndIncluded() ? 'OrAt' : ''); + + return $this->$startMethod($date) && $this->$endMethod($date); + } + + /** + * Return true if the current period follows a given other period (with no overlap). + * For instance, [2019-08-01 -> 2019-08-12] follows [2019-07-29 -> 2019-07-31] + * Note than in this example, follows() would be false if 2019-08-01 or 2019-07-31 was excluded by options. + * + * @param \Carbon\CarbonPeriod|\DatePeriod|string $period + * + * @return bool + */ + public function follows($period, ...$arguments): bool + { + $period = $this->resolveCarbonPeriod($period, ...$arguments); + + return $this->getIncludedStartDate()->equalTo($period->getIncludedEndDate()->add($period->getDateInterval())); + } + + /** + * Return true if the given other period follows the current one (with no overlap). + * For instance, [2019-07-29 -> 2019-07-31] is followed by [2019-08-01 -> 2019-08-12] + * Note than in this example, isFollowedBy() would be false if 2019-08-01 or 2019-07-31 was excluded by options. + * + * @param \Carbon\CarbonPeriod|\DatePeriod|string $period + * + * @return bool + */ + public function isFollowedBy($period, ...$arguments): bool + { + $period = $this->resolveCarbonPeriod($period, ...$arguments); + + return $period->follows($this); + } + + /** + * Return true if the given period either follows or is followed by the current one. + * + * @see follows() + * @see isFollowedBy() + * + * @param \Carbon\CarbonPeriod|\DatePeriod|string $period + * + * @return bool + */ + public function isConsecutiveWith($period, ...$arguments): bool + { + return $this->follows($period, ...$arguments) || $this->isFollowedBy($period, ...$arguments); + } + + /** + * Update properties after removing built-in filters. + * + * @return void + */ + protected function updateInternalState() + { + if (!$this->hasFilter(static::END_DATE_FILTER)) { + $this->endDate = null; + } + + if (!$this->hasFilter(static::RECURRENCES_FILTER)) { + $this->recurrences = null; + } + } + + /** + * Create a filter tuple from raw parameters. + * + * Will create an automatic filter callback for one of Carbon's is* methods. + * + * @param array $parameters + * + * @return array + */ + protected function createFilterTuple(array $parameters) + { + $method = array_shift($parameters); + + if (!$this->isCarbonPredicateMethod($method)) { + return [$method, array_shift($parameters)]; + } + + return [function ($date) use ($method, $parameters) { + return ([$date, $method])(...$parameters); + }, $method]; + } + + /** + * Return whether given callable is a string pointing to one of Carbon's is* methods + * and should be automatically converted to a filter callback. + * + * @param callable $callable + * + * @return bool + */ + protected function isCarbonPredicateMethod($callable) + { + return \is_string($callable) && str_starts_with($callable, 'is') && + (method_exists($this->dateClass, $callable) || ([$this->dateClass, 'hasMacro'])($callable)); + } + + /** + * Recurrences filter callback (limits number of recurrences). + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * + * @param \Carbon\Carbon $current + * @param int $key + * + * @return bool|string + */ + protected function filterRecurrences($current, $key) + { + if ($key < $this->recurrences) { + return true; + } + + return static::END_ITERATION; + } + + /** + * End date filter callback. + * + * @param \Carbon\Carbon $current + * + * @return bool|string + */ + protected function filterEndDate($current) + { + if (!$this->isEndExcluded() && $current == $this->endDate) { + return true; + } + + if ($this->dateInterval->invert ? $current > $this->endDate : $current < $this->endDate) { + return true; + } + + return static::END_ITERATION; + } + + /** + * End iteration filter callback. + * + * @return string + */ + protected function endIteration() + { + return static::END_ITERATION; + } + + /** + * Handle change of the parameters. + */ + protected function handleChangedParameters() + { + if (($this->getOptions() & static::IMMUTABLE) && $this->dateClass === Carbon::class) { + $this->dateClass = CarbonImmutable::class; + } elseif (!($this->getOptions() & static::IMMUTABLE) && $this->dateClass === CarbonImmutable::class) { + $this->dateClass = Carbon::class; + } + + $this->validationResult = null; + } + + /** + * Validate current date and stop iteration when necessary. + * + * Returns true when current date is valid, false if it is not, or static::END_ITERATION + * when iteration should be stopped. + * + * @return bool|string + */ + protected function validateCurrentDate() + { + if ($this->current === null) { + $this->rewind(); + } + + // Check after the first rewind to avoid repeating the initial validation. + return $this->validationResult ?? ($this->validationResult = $this->checkFilters()); + } + + /** + * Check whether current value and key pass all the filters. + * + * @return bool|string + */ + protected function checkFilters() + { + $current = $this->prepareForReturn($this->current); + + foreach ($this->filters as $tuple) { + $result = \call_user_func( + $tuple[0], + $current->avoidMutation(), + $this->key, + $this + ); + + if ($result === static::END_ITERATION) { + return static::END_ITERATION; + } + + if (!$result) { + return false; + } + } + + return true; + } + + /** + * Prepare given date to be returned to the external logic. + * + * @param CarbonInterface $date + * + * @return CarbonInterface + */ + protected function prepareForReturn(CarbonInterface $date) + { + $date = ([$this->dateClass, 'make'])($date); + + if ($this->timezone) { + $date = $date->setTimezone($this->timezone); + } + + return $date; + } + + /** + * Keep incrementing the current date until a valid date is found or the iteration is ended. + * + * @throws RuntimeException + * + * @return void + */ + protected function incrementCurrentDateUntilValid() + { + $attempts = 0; + + do { + $this->current = $this->current->add($this->dateInterval); + + $this->validationResult = null; + + if (++$attempts > static::NEXT_MAX_ATTEMPTS) { + throw new UnreachableException('Could not find next valid date.'); + } + } while ($this->validateCurrentDate() === false); + } + + /** + * Call given macro. + * + * @param string $name + * @param array $parameters + * + * @return mixed + */ + protected function callMacro($name, $parameters) + { + $macro = static::$macros[$name]; + + if ($macro instanceof Closure) { + $boundMacro = @$macro->bindTo($this, static::class) ?: @$macro->bindTo(null, static::class); + + return ($boundMacro ?: $macro)(...$parameters); + } + + return $macro(...$parameters); + } + + /** + * Return the Carbon instance passed through, a now instance in the same timezone + * if null given or parse the input if string given. + * + * @param \Carbon\Carbon|\Carbon\CarbonPeriod|\Carbon\CarbonInterval|\DateInterval|\DatePeriod|\DateTimeInterface|string|null $date + * + * @return \Carbon\CarbonInterface + */ + protected function resolveCarbon($date = null) + { + return $this->getStartDate()->nowWithSameTz()->carbonize($date); + } + + /** + * Resolve passed arguments or DatePeriod to a CarbonPeriod object. + * + * @param mixed $period + * @param mixed ...$arguments + * + * @return static + */ + protected function resolveCarbonPeriod($period, ...$arguments) + { + if ($period instanceof self) { + return $period; + } + + return $period instanceof DatePeriod + ? static::instance($period) + : static::create($period, ...$arguments); + } + + private function orderCouple($first, $second): array + { + return $first > $second ? [$second, $first] : [$first, $second]; + } + + private function makeDateTime($value): ?DateTimeInterface + { + if ($value instanceof DateTimeInterface) { + return $value; + } + + if (\is_string($value)) { + $value = trim($value); + + if (!preg_match('/^P[\dT]/', $value) && + !preg_match('/^R\d/', $value) && + preg_match('/[a-z\d]/i', $value) + ) { + $dateClass = $this->dateClass; + + return $dateClass::parse($value, $this->tzName); + } + } + + return null; + } + + private function isInfiniteDate($date): bool + { + return $date instanceof CarbonInterface && ($date->isEndOfTime() || $date->isStartOfTime()); + } + + private function rawDate($date): ?DateTimeInterface + { + if ($date === false || $date === null) { + return null; + } + + if ($date instanceof CarbonInterface) { + return $date->isMutable() + ? $date->toDateTime() + : $date->toDateTimeImmutable(); + } + + if (\in_array(\get_class($date), [DateTime::class, DateTimeImmutable::class], true)) { + return $date; + } + + $class = $date instanceof DateTime ? DateTime::class : DateTimeImmutable::class; + + return new $class($date->format('Y-m-d H:i:s.u'), $date->getTimezone()); + } + + private static function setDefaultParameters(array &$parameters, array $defaults): void + { + foreach ($defaults as [$index, $name, $value]) { + if (!\array_key_exists($index, $parameters) && !\array_key_exists($name, $parameters)) { + $parameters[$index] = $value; + } + } + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/CarbonPeriodImmutable.php b/vendor/nesbot/carbon/src/Carbon/CarbonPeriodImmutable.php new file mode 100644 index 00000000..f0d0ee28 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/CarbonPeriodImmutable.php @@ -0,0 +1,40 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon; + +class CarbonPeriodImmutable extends CarbonPeriod +{ + /** + * Default date class of iteration items. + * + * @var string + */ + protected const DEFAULT_DATE_CLASS = CarbonImmutable::class; + + /** + * Date class of iteration items. + * + * @var string + */ + protected $dateClass = CarbonImmutable::class; + + /** + * Prepare the instance to be set (self if mutable to be mutated, + * copy if immutable to generate a new instance). + * + * @return static + */ + protected function copyIfImmutable() + { + return $this->constructed ? clone $this : $this; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/CarbonTimeZone.php b/vendor/nesbot/carbon/src/Carbon/CarbonTimeZone.php new file mode 100644 index 00000000..c81899f1 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/CarbonTimeZone.php @@ -0,0 +1,320 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon; + +use Carbon\Exceptions\InvalidCastException; +use Carbon\Exceptions\InvalidTimeZoneException; +use DateTimeInterface; +use DateTimeZone; +use Throwable; + +class CarbonTimeZone extends DateTimeZone +{ + public function __construct($timezone = null) + { + parent::__construct(static::getDateTimeZoneNameFromMixed($timezone)); + } + + protected static function parseNumericTimezone($timezone) + { + if ($timezone <= -100 || $timezone >= 100) { + throw new InvalidTimeZoneException('Absolute timezone offset cannot be greater than 100.'); + } + + return ($timezone >= 0 ? '+' : '').ltrim($timezone, '+').':00'; + } + + protected static function getDateTimeZoneNameFromMixed($timezone) + { + if ($timezone === null) { + return date_default_timezone_get(); + } + + if (\is_string($timezone)) { + $timezone = preg_replace('/^\s*([+-]\d+)(\d{2})\s*$/', '$1:$2', $timezone); + } + + if (is_numeric($timezone)) { + return static::parseNumericTimezone($timezone); + } + + return $timezone; + } + + protected static function getDateTimeZoneFromName(&$name) + { + return @timezone_open($name = (string) static::getDateTimeZoneNameFromMixed($name)); + } + + /** + * Cast the current instance into the given class. + * + * @param string $className The $className::instance() method will be called to cast the current object. + * + * @return DateTimeZone + */ + public function cast(string $className) + { + if (!method_exists($className, 'instance')) { + if (is_a($className, DateTimeZone::class, true)) { + return new $className($this->getName()); + } + + throw new InvalidCastException("$className has not the instance() method needed to cast the date."); + } + + return $className::instance($this); + } + + /** + * Create a CarbonTimeZone from mixed input. + * + * @param DateTimeZone|string|int|null $object original value to get CarbonTimeZone from it. + * @param DateTimeZone|string|int|null $objectDump dump of the object for error messages. + * + * @throws InvalidTimeZoneException + * + * @return false|static + */ + public static function instance($object = null, $objectDump = null) + { + $tz = $object; + + if ($tz instanceof static) { + return $tz; + } + + if ($tz === null) { + return new static(); + } + + if (!$tz instanceof DateTimeZone) { + $tz = static::getDateTimeZoneFromName($object); + } + + if ($tz !== false) { + return new static($tz->getName()); + } + + if (Carbon::isStrictModeEnabled()) { + throw new InvalidTimeZoneException('Unknown or bad timezone ('.($objectDump ?: $object).')'); + } + + return false; + } + + /** + * Returns abbreviated name of the current timezone according to DST setting. + * + * @param bool $dst + * + * @return string + */ + public function getAbbreviatedName($dst = false) + { + $name = $this->getName(); + + foreach ($this->listAbbreviations() as $abbreviation => $zones) { + foreach ($zones as $zone) { + if ($zone['timezone_id'] === $name && $zone['dst'] == $dst) { + return $abbreviation; + } + } + } + + return 'unknown'; + } + + /** + * @alias getAbbreviatedName + * + * Returns abbreviated name of the current timezone according to DST setting. + * + * @param bool $dst + * + * @return string + */ + public function getAbbr($dst = false) + { + return $this->getAbbreviatedName($dst); + } + + /** + * Get the offset as string "sHH:MM" (such as "+00:00" or "-12:30"). + * + * @param DateTimeInterface|null $date + * + * @return string + */ + public function toOffsetName(DateTimeInterface $date = null) + { + return static::getOffsetNameFromMinuteOffset( + $this->getOffset($date ?: Carbon::now($this)) / 60 + ); + } + + /** + * Returns a new CarbonTimeZone object using the offset string instead of region string. + * + * @param DateTimeInterface|null $date + * + * @return CarbonTimeZone + */ + public function toOffsetTimeZone(DateTimeInterface $date = null) + { + return new static($this->toOffsetName($date)); + } + + /** + * Returns the first region string (such as "America/Toronto") that matches the current timezone or + * false if no match is found. + * + * @see timezone_name_from_abbr native PHP function. + * + * @param DateTimeInterface|null $date + * @param int $isDst + * + * @return string|false + */ + public function toRegionName(DateTimeInterface $date = null, $isDst = 1) + { + $name = $this->getName(); + $firstChar = substr($name, 0, 1); + + if ($firstChar !== '+' && $firstChar !== '-') { + return $name; + } + + $date = $date ?: Carbon::now($this); + + // Integer construction no longer supported since PHP 8 + // @codeCoverageIgnoreStart + try { + $offset = @$this->getOffset($date) ?: 0; + } catch (Throwable $e) { + $offset = 0; + } + // @codeCoverageIgnoreEnd + + $name = @timezone_name_from_abbr('', $offset, $isDst); + + if ($name) { + return $name; + } + + foreach (timezone_identifiers_list() as $timezone) { + if (Carbon::instance($date)->tz($timezone)->getOffset() === $offset) { + return $timezone; + } + } + + return false; + } + + /** + * Returns a new CarbonTimeZone object using the region string instead of offset string. + * + * @param DateTimeInterface|null $date + * + * @return CarbonTimeZone|false + */ + public function toRegionTimeZone(DateTimeInterface $date = null) + { + $tz = $this->toRegionName($date); + + if ($tz !== false) { + return new static($tz); + } + + if (Carbon::isStrictModeEnabled()) { + throw new InvalidTimeZoneException('Unknown timezone for offset '.$this->getOffset($date ?: Carbon::now($this)).' seconds.'); + } + + return false; + } + + /** + * Cast to string (get timezone name). + * + * @return string + */ + public function __toString() + { + return $this->getName(); + } + + /** + * Return the type number: + * + * Type 1; A UTC offset, such as -0300 + * Type 2; A timezone abbreviation, such as GMT + * Type 3: A timezone identifier, such as Europe/London + */ + public function getType(): int + { + return preg_match('/"timezone_type";i:(\d)/', serialize($this), $match) ? (int) $match[1] : 3; + } + + /** + * Create a CarbonTimeZone from mixed input. + * + * @param DateTimeZone|string|int|null $object + * + * @return false|static + */ + public static function create($object = null) + { + return static::instance($object); + } + + /** + * Create a CarbonTimeZone from int/float hour offset. + * + * @param float $hourOffset number of hour of the timezone shift (can be decimal). + * + * @return false|static + */ + public static function createFromHourOffset(float $hourOffset) + { + return static::createFromMinuteOffset($hourOffset * Carbon::MINUTES_PER_HOUR); + } + + /** + * Create a CarbonTimeZone from int/float minute offset. + * + * @param float $minuteOffset number of total minutes of the timezone shift. + * + * @return false|static + */ + public static function createFromMinuteOffset(float $minuteOffset) + { + return static::instance(static::getOffsetNameFromMinuteOffset($minuteOffset)); + } + + /** + * Convert a total minutes offset into a standardized timezone offset string. + * + * @param float $minutes number of total minutes of the timezone shift. + * + * @return string + */ + public static function getOffsetNameFromMinuteOffset(float $minutes): string + { + $minutes = round($minutes); + $unsignedMinutes = abs($minutes); + + return ($minutes < 0 ? '-' : '+'). + str_pad((string) floor($unsignedMinutes / 60), 2, '0', STR_PAD_LEFT). + ':'. + str_pad((string) ($unsignedMinutes % 60), 2, '0', STR_PAD_LEFT); + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Cli/Invoker.php b/vendor/nesbot/carbon/src/Carbon/Cli/Invoker.php new file mode 100644 index 00000000..4f35d6c6 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Cli/Invoker.php @@ -0,0 +1,38 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Cli; + +class Invoker +{ + public const CLI_CLASS_NAME = 'Carbon\\Cli'; + + protected function runWithCli(string $className, array $parameters): bool + { + $cli = new $className(); + + return $cli(...$parameters); + } + + public function __invoke(...$parameters): bool + { + if (class_exists(self::CLI_CLASS_NAME)) { + return $this->runWithCli(self::CLI_CLASS_NAME, $parameters); + } + + $function = (($parameters[1] ?? '') === 'install' ? ($parameters[2] ?? null) : null) ?: 'shell_exec'; + $function('composer require carbon-cli/carbon-cli --no-interaction'); + + echo 'Installation succeeded.'; + + return true; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/BadComparisonUnitException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/BadComparisonUnitException.php new file mode 100644 index 00000000..3ca8837d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/BadComparisonUnitException.php @@ -0,0 +1,48 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use Throwable; + +class BadComparisonUnitException extends UnitException +{ + /** + * The unit. + * + * @var string + */ + protected $unit; + + /** + * Constructor. + * + * @param string $unit + * @param int $code + * @param Throwable|null $previous + */ + public function __construct($unit, $code = 0, Throwable $previous = null) + { + $this->unit = $unit; + + parent::__construct("Bad comparison unit: '$unit'", $code, $previous); + } + + /** + * Get the unit. + * + * @return string + */ + public function getUnit(): string + { + return $this->unit; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/BadFluentConstructorException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/BadFluentConstructorException.php new file mode 100644 index 00000000..2e222e54 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/BadFluentConstructorException.php @@ -0,0 +1,49 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use BadMethodCallException as BaseBadMethodCallException; +use Throwable; + +class BadFluentConstructorException extends BaseBadMethodCallException implements BadMethodCallException +{ + /** + * The method. + * + * @var string + */ + protected $method; + + /** + * Constructor. + * + * @param string $method + * @param int $code + * @param Throwable|null $previous + */ + public function __construct($method, $code = 0, Throwable $previous = null) + { + $this->method = $method; + + parent::__construct(sprintf("Unknown fluent constructor '%s'.", $method), $code, $previous); + } + + /** + * Get the method. + * + * @return string + */ + public function getMethod(): string + { + return $this->method; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/BadFluentSetterException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/BadFluentSetterException.php new file mode 100644 index 00000000..4ceaa2ef --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/BadFluentSetterException.php @@ -0,0 +1,49 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use BadMethodCallException as BaseBadMethodCallException; +use Throwable; + +class BadFluentSetterException extends BaseBadMethodCallException implements BadMethodCallException +{ + /** + * The setter. + * + * @var string + */ + protected $setter; + + /** + * Constructor. + * + * @param string $setter + * @param int $code + * @param Throwable|null $previous + */ + public function __construct($setter, $code = 0, Throwable $previous = null) + { + $this->setter = $setter; + + parent::__construct(sprintf("Unknown fluent setter '%s'", $setter), $code, $previous); + } + + /** + * Get the setter. + * + * @return string + */ + public function getSetter(): string + { + return $this->setter; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/BadMethodCallException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/BadMethodCallException.php new file mode 100644 index 00000000..108206d3 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/BadMethodCallException.php @@ -0,0 +1,17 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +interface BadMethodCallException extends Exception +{ + // +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/EndLessPeriodException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/EndLessPeriodException.php new file mode 100644 index 00000000..e1049269 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/EndLessPeriodException.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use RuntimeException as BaseRuntimeException; + +final class EndLessPeriodException extends BaseRuntimeException implements RuntimeException +{ + // +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/Exception.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/Exception.php new file mode 100644 index 00000000..8ad747e7 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/Exception.php @@ -0,0 +1,17 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +interface Exception +{ + // +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/ImmutableException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/ImmutableException.php new file mode 100644 index 00000000..db334c6c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/ImmutableException.php @@ -0,0 +1,48 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use RuntimeException as BaseRuntimeException; +use Throwable; + +class ImmutableException extends BaseRuntimeException implements RuntimeException +{ + /** + * The value. + * + * @var string + */ + protected $value; + + /** + * Constructor. + * + * @param string $value the immutable type/value + * @param int $code + * @param Throwable|null $previous + */ + public function __construct($value, $code = 0, Throwable $previous = null) + { + $this->value = $value; + parent::__construct("$value is immutable.", $code, $previous); + } + + /** + * Get the value. + * + * @return string + */ + public function getValue(): string + { + return $this->value; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidArgumentException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidArgumentException.php new file mode 100644 index 00000000..5b013cd5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidArgumentException.php @@ -0,0 +1,17 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +interface InvalidArgumentException extends Exception +{ + // +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidCastException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidCastException.php new file mode 100644 index 00000000..a421401f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidCastException.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use InvalidArgumentException as BaseInvalidArgumentException; + +class InvalidCastException extends BaseInvalidArgumentException implements InvalidArgumentException +{ + // +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php new file mode 100644 index 00000000..c9ecb6b0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php @@ -0,0 +1,67 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use InvalidArgumentException as BaseInvalidArgumentException; +use Throwable; + +class InvalidDateException extends BaseInvalidArgumentException implements InvalidArgumentException +{ + /** + * The invalid field. + * + * @var string + */ + private $field; + + /** + * The invalid value. + * + * @var mixed + */ + private $value; + + /** + * Constructor. + * + * @param string $field + * @param mixed $value + * @param int $code + * @param Throwable|null $previous + */ + public function __construct($field, $value, $code = 0, Throwable $previous = null) + { + $this->field = $field; + $this->value = $value; + parent::__construct($field.' : '.$value.' is not a valid value.', $code, $previous); + } + + /** + * Get the invalid field. + * + * @return string + */ + public function getField() + { + return $this->field; + } + + /** + * Get the invalid value. + * + * @return mixed + */ + public function getValue() + { + return $this->value; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidFormatException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidFormatException.php new file mode 100644 index 00000000..92d55fe3 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidFormatException.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use InvalidArgumentException as BaseInvalidArgumentException; + +class InvalidFormatException extends BaseInvalidArgumentException implements InvalidArgumentException +{ + // +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidIntervalException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidIntervalException.php new file mode 100644 index 00000000..69cf4128 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidIntervalException.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use InvalidArgumentException as BaseInvalidArgumentException; + +class InvalidIntervalException extends BaseInvalidArgumentException implements InvalidArgumentException +{ + // +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidPeriodDateException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidPeriodDateException.php new file mode 100644 index 00000000..9bd84a96 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidPeriodDateException.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use InvalidArgumentException as BaseInvalidArgumentException; + +class InvalidPeriodDateException extends BaseInvalidArgumentException implements InvalidArgumentException +{ + // +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidPeriodParameterException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidPeriodParameterException.php new file mode 100644 index 00000000..cf2c9024 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidPeriodParameterException.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use InvalidArgumentException as BaseInvalidArgumentException; + +class InvalidPeriodParameterException extends BaseInvalidArgumentException implements InvalidArgumentException +{ + // +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidTimeZoneException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidTimeZoneException.php new file mode 100644 index 00000000..f7259558 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidTimeZoneException.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use InvalidArgumentException as BaseInvalidArgumentException; + +class InvalidTimeZoneException extends BaseInvalidArgumentException implements InvalidArgumentException +{ + // +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidTypeException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidTypeException.php new file mode 100644 index 00000000..2c8ec9ba --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidTypeException.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use InvalidArgumentException as BaseInvalidArgumentException; + +class InvalidTypeException extends BaseInvalidArgumentException implements InvalidArgumentException +{ + // +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/NotACarbonClassException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/NotACarbonClassException.php new file mode 100644 index 00000000..7a87632c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/NotACarbonClassException.php @@ -0,0 +1,50 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use Carbon\CarbonInterface; +use InvalidArgumentException as BaseInvalidArgumentException; +use Throwable; + +class NotACarbonClassException extends BaseInvalidArgumentException implements InvalidArgumentException +{ + /** + * The className. + * + * @var string + */ + protected $className; + + /** + * Constructor. + * + * @param string $className + * @param int $code + * @param Throwable|null $previous + */ + public function __construct($className, $code = 0, Throwable $previous = null) + { + $this->className = $className; + + parent::__construct(sprintf('Given class does not implement %s: %s', CarbonInterface::class, $className), $code, $previous); + } + + /** + * Get the className. + * + * @return string + */ + public function getClassName(): string + { + return $this->className; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/NotAPeriodException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/NotAPeriodException.php new file mode 100644 index 00000000..4edd7a48 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/NotAPeriodException.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use InvalidArgumentException as BaseInvalidArgumentException; + +class NotAPeriodException extends BaseInvalidArgumentException implements InvalidArgumentException +{ + // +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/NotLocaleAwareException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/NotLocaleAwareException.php new file mode 100644 index 00000000..f2c54684 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/NotLocaleAwareException.php @@ -0,0 +1,32 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use InvalidArgumentException as BaseInvalidArgumentException; +use Throwable; + +class NotLocaleAwareException extends BaseInvalidArgumentException implements InvalidArgumentException +{ + /** + * Constructor. + * + * @param mixed $object + * @param int $code + * @param Throwable|null $previous + */ + public function __construct($object, $code = 0, Throwable $previous = null) + { + $dump = \is_object($object) ? \get_class($object) : \gettype($object); + + parent::__construct("$dump does neither implements Symfony\Contracts\Translation\LocaleAwareInterface nor getLocale() method.", $code, $previous); + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/OutOfRangeException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/OutOfRangeException.php new file mode 100644 index 00000000..2c586d0b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/OutOfRangeException.php @@ -0,0 +1,101 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use InvalidArgumentException as BaseInvalidArgumentException; +use Throwable; + +// This will extends OutOfRangeException instead of InvalidArgumentException since 3.0.0 +// use OutOfRangeException as BaseOutOfRangeException; + +class OutOfRangeException extends BaseInvalidArgumentException implements InvalidArgumentException +{ + /** + * The unit or name of the value. + * + * @var string + */ + private $unit; + + /** + * The range minimum. + * + * @var mixed + */ + private $min; + + /** + * The range maximum. + * + * @var mixed + */ + private $max; + + /** + * The invalid value. + * + * @var mixed + */ + private $value; + + /** + * Constructor. + * + * @param string $unit + * @param mixed $min + * @param mixed $max + * @param mixed $value + * @param int $code + * @param Throwable|null $previous + */ + public function __construct($unit, $min, $max, $value, $code = 0, Throwable $previous = null) + { + $this->unit = $unit; + $this->min = $min; + $this->max = $max; + $this->value = $value; + + parent::__construct("$unit must be between $min and $max, $value given", $code, $previous); + } + + /** + * @return mixed + */ + public function getMax() + { + return $this->max; + } + + /** + * @return mixed + */ + public function getMin() + { + return $this->min; + } + + /** + * @return mixed + */ + public function getUnit() + { + return $this->unit; + } + + /** + * @return mixed + */ + public function getValue() + { + return $this->value; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/ParseErrorException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/ParseErrorException.php new file mode 100644 index 00000000..5416fd14 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/ParseErrorException.php @@ -0,0 +1,88 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use InvalidArgumentException as BaseInvalidArgumentException; +use Throwable; + +class ParseErrorException extends BaseInvalidArgumentException implements InvalidArgumentException +{ + /** + * The expected. + * + * @var string + */ + protected $expected; + + /** + * The actual. + * + * @var string + */ + protected $actual; + + /** + * The help message. + * + * @var string + */ + protected $help; + + /** + * Constructor. + * + * @param string $expected + * @param string $actual + * @param int $code + * @param Throwable|null $previous + */ + public function __construct($expected, $actual, $help = '', $code = 0, Throwable $previous = null) + { + $this->expected = $expected; + $this->actual = $actual; + $this->help = $help; + + $actual = $actual === '' ? 'data is missing' : "get '$actual'"; + + parent::__construct(trim("Format expected $expected but $actual\n$help"), $code, $previous); + } + + /** + * Get the expected. + * + * @return string + */ + public function getExpected(): string + { + return $this->expected; + } + + /** + * Get the actual. + * + * @return string + */ + public function getActual(): string + { + return $this->actual; + } + + /** + * Get the help message. + * + * @return string + */ + public function getHelp(): string + { + return $this->help; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/RuntimeException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/RuntimeException.php new file mode 100644 index 00000000..ad196f79 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/RuntimeException.php @@ -0,0 +1,17 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +interface RuntimeException extends Exception +{ + // +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/UnitException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/UnitException.php new file mode 100644 index 00000000..ee99953b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/UnitException.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use InvalidArgumentException as BaseInvalidArgumentException; + +class UnitException extends BaseInvalidArgumentException implements InvalidArgumentException +{ + // +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/UnitNotConfiguredException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/UnitNotConfiguredException.php new file mode 100644 index 00000000..0e723056 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/UnitNotConfiguredException.php @@ -0,0 +1,48 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use Throwable; + +class UnitNotConfiguredException extends UnitException +{ + /** + * The unit. + * + * @var string + */ + protected $unit; + + /** + * Constructor. + * + * @param string $unit + * @param int $code + * @param Throwable|null $previous + */ + public function __construct($unit, $code = 0, Throwable $previous = null) + { + $this->unit = $unit; + + parent::__construct("Unit $unit have no configuration to get total from other units.", $code, $previous); + } + + /** + * Get the unit. + * + * @return string + */ + public function getUnit(): string + { + return $this->unit; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownGetterException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownGetterException.php new file mode 100644 index 00000000..5c504975 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownGetterException.php @@ -0,0 +1,49 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use InvalidArgumentException as BaseInvalidArgumentException; +use Throwable; + +class UnknownGetterException extends BaseInvalidArgumentException implements InvalidArgumentException +{ + /** + * The getter. + * + * @var string + */ + protected $getter; + + /** + * Constructor. + * + * @param string $getter getter name + * @param int $code + * @param Throwable|null $previous + */ + public function __construct($getter, $code = 0, Throwable $previous = null) + { + $this->getter = $getter; + + parent::__construct("Unknown getter '$getter'", $code, $previous); + } + + /** + * Get the getter. + * + * @return string + */ + public function getGetter(): string + { + return $this->getter; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownMethodException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownMethodException.php new file mode 100644 index 00000000..75273a70 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownMethodException.php @@ -0,0 +1,49 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use BadMethodCallException as BaseBadMethodCallException; +use Throwable; + +class UnknownMethodException extends BaseBadMethodCallException implements BadMethodCallException +{ + /** + * The method. + * + * @var string + */ + protected $method; + + /** + * Constructor. + * + * @param string $method + * @param int $code + * @param Throwable|null $previous + */ + public function __construct($method, $code = 0, Throwable $previous = null) + { + $this->method = $method; + + parent::__construct("Method $method does not exist.", $code, $previous); + } + + /** + * Get the method. + * + * @return string + */ + public function getMethod(): string + { + return $this->method; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownSetterException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownSetterException.php new file mode 100644 index 00000000..a795f5d7 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownSetterException.php @@ -0,0 +1,49 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use InvalidArgumentException as BaseInvalidArgumentException; +use Throwable; + +class UnknownSetterException extends BaseInvalidArgumentException implements BadMethodCallException +{ + /** + * The setter. + * + * @var string + */ + protected $setter; + + /** + * Constructor. + * + * @param string $setter setter name + * @param int $code + * @param Throwable|null $previous + */ + public function __construct($setter, $code = 0, Throwable $previous = null) + { + $this->setter = $setter; + + parent::__construct("Unknown setter '$setter'", $code, $previous); + } + + /** + * Get the setter. + * + * @return string + */ + public function getSetter(): string + { + return $this->setter; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownUnitException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownUnitException.php new file mode 100644 index 00000000..ecd7f7a5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownUnitException.php @@ -0,0 +1,48 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use Throwable; + +class UnknownUnitException extends UnitException +{ + /** + * The unit. + * + * @var string + */ + protected $unit; + + /** + * Constructor. + * + * @param string $unit + * @param int $code + * @param Throwable|null $previous + */ + public function __construct($unit, $code = 0, Throwable $previous = null) + { + $this->unit = $unit; + + parent::__construct("Unknown unit '$unit'.", $code, $previous); + } + + /** + * Get the unit. + * + * @return string + */ + public function getUnit(): string + { + return $this->unit; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/UnreachableException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/UnreachableException.php new file mode 100644 index 00000000..1654ab11 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/UnreachableException.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use RuntimeException as BaseRuntimeException; + +class UnreachableException extends BaseRuntimeException implements RuntimeException +{ + // +} diff --git a/vendor/nesbot/carbon/src/Carbon/Factory.php b/vendor/nesbot/carbon/src/Carbon/Factory.php new file mode 100644 index 00000000..d497535f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Factory.php @@ -0,0 +1,326 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon; + +use Closure; +use DateTimeInterface; +use ReflectionMethod; + +/** + * A factory to generate Carbon instances with common settings. + * + * <autodoc generated by `composer phpdoc`> + * + * @method bool canBeCreatedFromFormat($date, $format) Checks if the (date)time string is in a given format and valid to create a + * new instance. + * @method Carbon|false create($year = 0, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0, $tz = null) Create a new Carbon instance from a specific date and time. + * If any of $year, $month or $day are set to null their now() values will + * be used. + * If $hour is null it will be set to its now() value and the default + * values for $minute and $second will be their now() values. + * If $hour is not null then the default values for $minute and $second + * will be 0. + * @method Carbon createFromDate($year = null, $month = null, $day = null, $tz = null) Create a Carbon instance from just a date. The time portion is set to now. + * @method Carbon|false createFromFormat($format, $time, $tz = null) Create a Carbon instance from a specific format. + * @method Carbon|false createFromIsoFormat($format, $time, $tz = null, $locale = 'en', $translator = null) Create a Carbon instance from a specific ISO format (same replacements as ->isoFormat()). + * @method Carbon|false createFromLocaleFormat($format, $locale, $time, $tz = null) Create a Carbon instance from a specific format and a string in a given language. + * @method Carbon|false createFromLocaleIsoFormat($format, $locale, $time, $tz = null) Create a Carbon instance from a specific ISO format and a string in a given language. + * @method Carbon createFromTime($hour = 0, $minute = 0, $second = 0, $tz = null) Create a Carbon instance from just a time. The date portion is set to today. + * @method Carbon createFromTimeString($time, $tz = null) Create a Carbon instance from a time string. The date portion is set to today. + * @method Carbon createFromTimestamp($timestamp, $tz = null) Create a Carbon instance from a timestamp and set the timezone (use default one if not specified). + * Timestamp input can be given as int, float or a string containing one or more numbers. + * @method Carbon createFromTimestampMs($timestamp, $tz = null) Create a Carbon instance from a timestamp in milliseconds. + * Timestamp input can be given as int, float or a string containing one or more numbers. + * @method Carbon createFromTimestampMsUTC($timestamp) Create a Carbon instance from a timestamp in milliseconds. + * Timestamp input can be given as int, float or a string containing one or more numbers. + * @method Carbon createFromTimestampUTC($timestamp) Create a Carbon instance from an timestamp keeping the timezone to UTC. + * Timestamp input can be given as int, float or a string containing one or more numbers. + * @method Carbon createMidnightDate($year = null, $month = null, $day = null, $tz = null) Create a Carbon instance from just a date. The time portion is set to midnight. + * @method Carbon|false createSafe($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $tz = null) Create a new safe Carbon instance from a specific date and time. + * If any of $year, $month or $day are set to null their now() values will + * be used. + * If $hour is null it will be set to its now() value and the default + * values for $minute and $second will be their now() values. + * If $hour is not null then the default values for $minute and $second + * will be 0. + * If one of the set values is not valid, an InvalidDateException + * will be thrown. + * @method CarbonInterface createStrict(?int $year = 0, ?int $month = 1, ?int $day = 1, ?int $hour = 0, ?int $minute = 0, ?int $second = 0, $tz = null) Create a new Carbon instance from a specific date and time using strict validation. + * @method Carbon disableHumanDiffOption($humanDiffOption) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * @method Carbon enableHumanDiffOption($humanDiffOption) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * @method mixed executeWithLocale($locale, $func) Set the current locale to the given, execute the passed function, reset the locale to previous one, + * then return the result of the closure (or null if the closure was void). + * @method Carbon fromSerialized($value) Create an instance from a serialized string. + * @method void genericMacro($macro, $priority = 0) Register a custom macro. + * @method array getAvailableLocales() Returns the list of internally available locales and already loaded custom locales. + * (It will ignore custom translator dynamic loading.) + * @method Language[] getAvailableLocalesInfo() Returns list of Language object for each available locale. This object allow you to get the ISO name, native + * name, region and variant of the locale. + * @method array getDays() Get the days of the week + * @method string|null getFallbackLocale() Get the fallback locale. + * @method array getFormatsToIsoReplacements() List of replacements from date() format to isoFormat(). + * @method int getHumanDiffOptions() Return default humanDiff() options (merged flags as integer). + * @method array getIsoUnits() Returns list of locale units for ISO formatting. + * @method array getLastErrors() {@inheritdoc} + * @method string getLocale() Get the current translator locale. + * @method callable|null getMacro($name) Get the raw callable macro registered globally for a given name. + * @method int getMidDayAt() get midday/noon hour + * @method Closure|Carbon getTestNow() Get the Carbon instance (real or mock) to be returned when a "now" + * instance is created. + * @method string getTimeFormatByPrecision($unitPrecision) Return a format from H:i to H:i:s.u according to given unit precision. + * @method string getTranslationMessageWith($translator, string $key, ?string $locale = null, ?string $default = null) Returns raw translation message for a given key. + * @method \Symfony\Component\Translation\TranslatorInterface getTranslator() Get the default translator instance in use. + * @method int getWeekEndsAt() Get the last day of week + * @method int getWeekStartsAt() Get the first day of week + * @method array getWeekendDays() Get weekend days + * @method bool hasFormat($date, $format) Checks if the (date)time string is in a given format. + * @method bool hasFormatWithModifiers($date, $format) Checks if the (date)time string is in a given format. + * @method bool hasMacro($name) Checks if macro is registered globally. + * @method bool hasRelativeKeywords($time) Determine if a time string will produce a relative date. + * @method bool hasTestNow() Determine if there is a valid test instance set. A valid test instance + * is anything that is not null. + * @method Carbon instance($date) Create a Carbon instance from a DateTime one. + * @method bool isImmutable() Returns true if the current class/instance is immutable. + * @method bool isModifiableUnit($unit) Returns true if a property can be changed via setter. + * @method bool isMutable() Returns true if the current class/instance is mutable. + * @method bool isStrictModeEnabled() Returns true if the strict mode is globally in use, false else. + * (It can be overridden in specific instances.) + * @method bool localeHasDiffOneDayWords($locale) Returns true if the given locale is internally supported and has words for 1-day diff (just now, yesterday, tomorrow). + * Support is considered enabled if the 3 words are translated in the given locale. + * @method bool localeHasDiffSyntax($locale) Returns true if the given locale is internally supported and has diff syntax support (ago, from now, before, after). + * Support is considered enabled if the 4 sentences are translated in the given locale. + * @method bool localeHasDiffTwoDayWords($locale) Returns true if the given locale is internally supported and has words for 2-days diff (before yesterday, after tomorrow). + * Support is considered enabled if the 2 words are translated in the given locale. + * @method bool localeHasPeriodSyntax($locale) Returns true if the given locale is internally supported and has period syntax support (X times, every X, from X, to X). + * Support is considered enabled if the 4 sentences are translated in the given locale. + * @method bool localeHasShortUnits($locale) Returns true if the given locale is internally supported and has short-units support. + * Support is considered enabled if either year, day or hour has a short variant translated. + * @method void macro($name, $macro) Register a custom macro. + * @method Carbon|null make($var) Make a Carbon instance from given variable if possible. + * Always return a new instance. Parse only strings and only these likely to be dates (skip intervals + * and recurrences). Throw an exception for invalid format, but otherwise return null. + * @method Carbon maxValue() Create a Carbon instance for the greatest supported date. + * @method Carbon minValue() Create a Carbon instance for the lowest supported date. + * @method void mixin($mixin) Mix another object into the class. + * @method Carbon now($tz = null) Get a Carbon instance for the current date and time. + * @method Carbon parse($time = null, $tz = null) Create a carbon instance from a string. + * This is an alias for the constructor that allows better fluent syntax + * as it allows you to do Carbon::parse('Monday next week')->fn() rather + * than (new Carbon('Monday next week'))->fn(). + * @method Carbon parseFromLocale($time, $locale = null, $tz = null) Create a carbon instance from a localized string (in French, Japanese, Arabic, etc.). + * @method string pluralUnit(string $unit) Returns standardized plural of a given singular/plural unit name (in English). + * @method Carbon|false rawCreateFromFormat($format, $time, $tz = null) Create a Carbon instance from a specific format. + * @method Carbon rawParse($time = null, $tz = null) Create a carbon instance from a string. + * This is an alias for the constructor that allows better fluent syntax + * as it allows you to do Carbon::parse('Monday next week')->fn() rather + * than (new Carbon('Monday next week'))->fn(). + * @method Carbon resetMacros() Remove all macros and generic macros. + * @method void resetMonthsOverflow() @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * Or you can use method variants: addMonthsWithOverflow/addMonthsNoOverflow, same variants + * are available for quarters, years, decade, centuries, millennia (singular and plural forms). + * @method void resetToStringFormat() Reset the format used to the default when type juggling a Carbon instance to a string + * @method void resetYearsOverflow() @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * Or you can use method variants: addYearsWithOverflow/addYearsNoOverflow, same variants + * are available for quarters, years, decade, centuries, millennia (singular and plural forms). + * @method void serializeUsing($callback) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather transform Carbon object before the serialization. + * JSON serialize all Carbon instances using the given callback. + * @method Carbon setFallbackLocale($locale) Set the fallback locale. + * @method Carbon setHumanDiffOptions($humanDiffOptions) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * @method bool setLocale($locale) Set the current translator locale and indicate if the source locale file exists. + * Pass 'auto' as locale to use closest language from the current LC_TIME locale. + * @method void setMidDayAt($hour) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather consider mid-day is always 12pm, then if you need to test if it's an other + * hour, test it explicitly: + * $date->format('G') == 13 + * or to set explicitly to a given hour: + * $date->setTime(13, 0, 0, 0) + * Set midday/noon hour + * @method Carbon setTestNow($testNow = null) Set a Carbon instance (real or mock) to be returned when a "now" + * instance is created. The provided instance will be returned + * specifically under the following conditions: + * - A call to the static now() method, ex. Carbon::now() + * - When a null (or blank string) is passed to the constructor or parse(), ex. new Carbon(null) + * - When the string "now" is passed to the constructor or parse(), ex. new Carbon('now') + * - When a string containing the desired time is passed to Carbon::parse(). + * Note the timezone parameter was left out of the examples above and + * has no affect as the mock value will be returned regardless of its value. + * Only the moment is mocked with setTestNow(), the timezone will still be the one passed + * as parameter of date_default_timezone_get() as a fallback (see setTestNowAndTimezone()). + * To clear the test instance call this method using the default + * parameter of null. + * /!\ Use this method for unit tests only. + * @method Carbon setTestNowAndTimezone($testNow = null, $tz = null) Set a Carbon instance (real or mock) to be returned when a "now" + * instance is created. The provided instance will be returned + * specifically under the following conditions: + * - A call to the static now() method, ex. Carbon::now() + * - When a null (or blank string) is passed to the constructor or parse(), ex. new Carbon(null) + * - When the string "now" is passed to the constructor or parse(), ex. new Carbon('now') + * - When a string containing the desired time is passed to Carbon::parse(). + * It will also align default timezone (e.g. call date_default_timezone_set()) with + * the second argument or if null, with the timezone of the given date object. + * To clear the test instance call this method using the default + * parameter of null. + * /!\ Use this method for unit tests only. + * @method void setToStringFormat($format) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather let Carbon object being cast to string with DEFAULT_TO_STRING_FORMAT, and + * use other method or custom format passed to format() method if you need to dump another string + * format. + * Set the default format used when type juggling a Carbon instance to a string. + * @method void setTranslator(TranslatorInterface $translator) Set the default translator instance to use. + * @method Carbon setUtf8($utf8) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use UTF-8 language packages on every machine. + * Set if UTF8 will be used for localized date/time. + * @method void setWeekEndsAt($day) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * Use $weekStartsAt optional parameter instead when using startOfWeek, floorWeek, ceilWeek + * or roundWeek method. You can also use the 'first_day_of_week' locale setting to change the + * start of week according to current locale selected and implicitly the end of week. + * Set the last day of week + * @method void setWeekStartsAt($day) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * Use $weekEndsAt optional parameter instead when using endOfWeek method. You can also use the + * 'first_day_of_week' locale setting to change the start of week according to current locale + * selected and implicitly the end of week. + * Set the first day of week + * @method void setWeekendDays($days) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather consider week-end is always saturday and sunday, and if you have some custom + * week-end days to handle, give to those days an other name and create a macro for them: + * ``` + * Carbon::macro('isDayOff', function ($date) { + * return $date->isSunday() || $date->isMonday(); + * }); + * Carbon::macro('isNotDayOff', function ($date) { + * return !$date->isDayOff(); + * }); + * if ($someDate->isDayOff()) ... + * if ($someDate->isNotDayOff()) ... + * // Add 5 not-off days + * $count = 5; + * while ($someDate->isDayOff() || ($count-- > 0)) { + * $someDate->addDay(); + * } + * ``` + * Set weekend days + * @method bool shouldOverflowMonths() Get the month overflow global behavior (can be overridden in specific instances). + * @method bool shouldOverflowYears() Get the month overflow global behavior (can be overridden in specific instances). + * @method string singularUnit(string $unit) Returns standardized singular of a given singular/plural unit name (in English). + * @method Carbon today($tz = null) Create a Carbon instance for today. + * @method Carbon tomorrow($tz = null) Create a Carbon instance for tomorrow. + * @method string translateTimeString($timeString, $from = null, $to = null, $mode = CarbonInterface::TRANSLATE_ALL) Translate a time string from a locale to an other. + * @method string translateWith(TranslatorInterface $translator, string $key, array $parameters = [], $number = null) Translate using translation string or callback available. + * @method void useMonthsOverflow($monthsOverflow = true) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * Or you can use method variants: addMonthsWithOverflow/addMonthsNoOverflow, same variants + * are available for quarters, years, decade, centuries, millennia (singular and plural forms). + * @method Carbon useStrictMode($strictModeEnabled = true) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * @method void useYearsOverflow($yearsOverflow = true) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * Or you can use method variants: addYearsWithOverflow/addYearsNoOverflow, same variants + * are available for quarters, years, decade, centuries, millennia (singular and plural forms). + * @method mixed withTestNow($testNow, $callback) Temporarily sets a static date to be used within the callback. + * Using setTestNow to set the date, executing the callback, then + * clearing the test instance. + * /!\ Use this method for unit tests only. + * @method Carbon yesterday($tz = null) Create a Carbon instance for yesterday. + * + * </autodoc> + */ +class Factory +{ + protected $className = Carbon::class; + + protected $settings = []; + + public function __construct(array $settings = [], ?string $className = null) + { + if ($className) { + $this->className = $className; + } + + $this->settings = $settings; + } + + public function getClassName() + { + return $this->className; + } + + public function setClassName(string $className) + { + $this->className = $className; + + return $this; + } + + public function className(string $className = null) + { + return $className === null ? $this->getClassName() : $this->setClassName($className); + } + + public function getSettings() + { + return $this->settings; + } + + public function setSettings(array $settings) + { + $this->settings = $settings; + + return $this; + } + + public function settings(array $settings = null) + { + return $settings === null ? $this->getSettings() : $this->setSettings($settings); + } + + public function mergeSettings(array $settings) + { + $this->settings = array_merge($this->settings, $settings); + + return $this; + } + + public function __call($name, $arguments) + { + $method = new ReflectionMethod($this->className, $name); + $settings = $this->settings; + + if ($settings && isset($settings['timezone'])) { + $tzParameters = array_filter($method->getParameters(), function ($parameter) { + return \in_array($parameter->getName(), ['tz', 'timezone'], true); + }); + + if (isset($arguments[0]) && \in_array($name, ['instance', 'make', 'create', 'parse'], true)) { + if ($arguments[0] instanceof DateTimeInterface) { + $settings['innerTimezone'] = $settings['timezone']; + } elseif (\is_string($arguments[0]) && date_parse($arguments[0])['is_localtime']) { + unset($settings['timezone'], $settings['innerTimezone']); + } + } elseif (\count($tzParameters)) { + array_splice($arguments, key($tzParameters), 0, [$settings['timezone']]); + unset($settings['timezone']); + } + } + + $result = $this->className::$name(...$arguments); + + return $result instanceof CarbonInterface && !empty($settings) + ? $result->settings($settings) + : $result; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/FactoryImmutable.php b/vendor/nesbot/carbon/src/Carbon/FactoryImmutable.php new file mode 100644 index 00000000..d88a1cf6 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/FactoryImmutable.php @@ -0,0 +1,259 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon; + +use Closure; +use DateTimeImmutable; +use DateTimeZone; +use Psr\Clock\ClockInterface; + +/** + * A factory to generate CarbonImmutable instances with common settings. + * + * <autodoc generated by `composer phpdoc`> + * + * @method bool canBeCreatedFromFormat($date, $format) Checks if the (date)time string is in a given format and valid to create a + * new instance. + * @method CarbonImmutable|false create($year = 0, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0, $tz = null) Create a new Carbon instance from a specific date and time. + * If any of $year, $month or $day are set to null their now() values will + * be used. + * If $hour is null it will be set to its now() value and the default + * values for $minute and $second will be their now() values. + * If $hour is not null then the default values for $minute and $second + * will be 0. + * @method CarbonImmutable createFromDate($year = null, $month = null, $day = null, $tz = null) Create a Carbon instance from just a date. The time portion is set to now. + * @method CarbonImmutable|false createFromFormat($format, $time, $tz = null) Create a Carbon instance from a specific format. + * @method CarbonImmutable|false createFromIsoFormat($format, $time, $tz = null, $locale = 'en', $translator = null) Create a Carbon instance from a specific ISO format (same replacements as ->isoFormat()). + * @method CarbonImmutable|false createFromLocaleFormat($format, $locale, $time, $tz = null) Create a Carbon instance from a specific format and a string in a given language. + * @method CarbonImmutable|false createFromLocaleIsoFormat($format, $locale, $time, $tz = null) Create a Carbon instance from a specific ISO format and a string in a given language. + * @method CarbonImmutable createFromTime($hour = 0, $minute = 0, $second = 0, $tz = null) Create a Carbon instance from just a time. The date portion is set to today. + * @method CarbonImmutable createFromTimeString($time, $tz = null) Create a Carbon instance from a time string. The date portion is set to today. + * @method CarbonImmutable createFromTimestamp($timestamp, $tz = null) Create a Carbon instance from a timestamp and set the timezone (use default one if not specified). + * Timestamp input can be given as int, float or a string containing one or more numbers. + * @method CarbonImmutable createFromTimestampMs($timestamp, $tz = null) Create a Carbon instance from a timestamp in milliseconds. + * Timestamp input can be given as int, float or a string containing one or more numbers. + * @method CarbonImmutable createFromTimestampMsUTC($timestamp) Create a Carbon instance from a timestamp in milliseconds. + * Timestamp input can be given as int, float or a string containing one or more numbers. + * @method CarbonImmutable createFromTimestampUTC($timestamp) Create a Carbon instance from an timestamp keeping the timezone to UTC. + * Timestamp input can be given as int, float or a string containing one or more numbers. + * @method CarbonImmutable createMidnightDate($year = null, $month = null, $day = null, $tz = null) Create a Carbon instance from just a date. The time portion is set to midnight. + * @method CarbonImmutable|false createSafe($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $tz = null) Create a new safe Carbon instance from a specific date and time. + * If any of $year, $month or $day are set to null their now() values will + * be used. + * If $hour is null it will be set to its now() value and the default + * values for $minute and $second will be their now() values. + * If $hour is not null then the default values for $minute and $second + * will be 0. + * If one of the set values is not valid, an InvalidDateException + * will be thrown. + * @method CarbonInterface createStrict(?int $year = 0, ?int $month = 1, ?int $day = 1, ?int $hour = 0, ?int $minute = 0, ?int $second = 0, $tz = null) Create a new Carbon instance from a specific date and time using strict validation. + * @method CarbonImmutable disableHumanDiffOption($humanDiffOption) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * @method CarbonImmutable enableHumanDiffOption($humanDiffOption) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * @method mixed executeWithLocale($locale, $func) Set the current locale to the given, execute the passed function, reset the locale to previous one, + * then return the result of the closure (or null if the closure was void). + * @method CarbonImmutable fromSerialized($value) Create an instance from a serialized string. + * @method void genericMacro($macro, $priority = 0) Register a custom macro. + * @method array getAvailableLocales() Returns the list of internally available locales and already loaded custom locales. + * (It will ignore custom translator dynamic loading.) + * @method Language[] getAvailableLocalesInfo() Returns list of Language object for each available locale. This object allow you to get the ISO name, native + * name, region and variant of the locale. + * @method array getDays() Get the days of the week + * @method string|null getFallbackLocale() Get the fallback locale. + * @method array getFormatsToIsoReplacements() List of replacements from date() format to isoFormat(). + * @method int getHumanDiffOptions() Return default humanDiff() options (merged flags as integer). + * @method array getIsoUnits() Returns list of locale units for ISO formatting. + * @method array getLastErrors() {@inheritdoc} + * @method string getLocale() Get the current translator locale. + * @method callable|null getMacro($name) Get the raw callable macro registered globally for a given name. + * @method int getMidDayAt() get midday/noon hour + * @method Closure|CarbonImmutable getTestNow() Get the Carbon instance (real or mock) to be returned when a "now" + * instance is created. + * @method string getTimeFormatByPrecision($unitPrecision) Return a format from H:i to H:i:s.u according to given unit precision. + * @method string getTranslationMessageWith($translator, string $key, ?string $locale = null, ?string $default = null) Returns raw translation message for a given key. + * @method \Symfony\Component\Translation\TranslatorInterface getTranslator() Get the default translator instance in use. + * @method int getWeekEndsAt() Get the last day of week + * @method int getWeekStartsAt() Get the first day of week + * @method array getWeekendDays() Get weekend days + * @method bool hasFormat($date, $format) Checks if the (date)time string is in a given format. + * @method bool hasFormatWithModifiers($date, $format) Checks if the (date)time string is in a given format. + * @method bool hasMacro($name) Checks if macro is registered globally. + * @method bool hasRelativeKeywords($time) Determine if a time string will produce a relative date. + * @method bool hasTestNow() Determine if there is a valid test instance set. A valid test instance + * is anything that is not null. + * @method CarbonImmutable instance($date) Create a Carbon instance from a DateTime one. + * @method bool isImmutable() Returns true if the current class/instance is immutable. + * @method bool isModifiableUnit($unit) Returns true if a property can be changed via setter. + * @method bool isMutable() Returns true if the current class/instance is mutable. + * @method bool isStrictModeEnabled() Returns true if the strict mode is globally in use, false else. + * (It can be overridden in specific instances.) + * @method bool localeHasDiffOneDayWords($locale) Returns true if the given locale is internally supported and has words for 1-day diff (just now, yesterday, tomorrow). + * Support is considered enabled if the 3 words are translated in the given locale. + * @method bool localeHasDiffSyntax($locale) Returns true if the given locale is internally supported and has diff syntax support (ago, from now, before, after). + * Support is considered enabled if the 4 sentences are translated in the given locale. + * @method bool localeHasDiffTwoDayWords($locale) Returns true if the given locale is internally supported and has words for 2-days diff (before yesterday, after tomorrow). + * Support is considered enabled if the 2 words are translated in the given locale. + * @method bool localeHasPeriodSyntax($locale) Returns true if the given locale is internally supported and has period syntax support (X times, every X, from X, to X). + * Support is considered enabled if the 4 sentences are translated in the given locale. + * @method bool localeHasShortUnits($locale) Returns true if the given locale is internally supported and has short-units support. + * Support is considered enabled if either year, day or hour has a short variant translated. + * @method void macro($name, $macro) Register a custom macro. + * @method CarbonImmutable|null make($var) Make a Carbon instance from given variable if possible. + * Always return a new instance. Parse only strings and only these likely to be dates (skip intervals + * and recurrences). Throw an exception for invalid format, but otherwise return null. + * @method CarbonImmutable maxValue() Create a Carbon instance for the greatest supported date. + * @method CarbonImmutable minValue() Create a Carbon instance for the lowest supported date. + * @method void mixin($mixin) Mix another object into the class. + * @method CarbonImmutable parse($time = null, $tz = null) Create a carbon instance from a string. + * This is an alias for the constructor that allows better fluent syntax + * as it allows you to do Carbon::parse('Monday next week')->fn() rather + * than (new Carbon('Monday next week'))->fn(). + * @method CarbonImmutable parseFromLocale($time, $locale = null, $tz = null) Create a carbon instance from a localized string (in French, Japanese, Arabic, etc.). + * @method string pluralUnit(string $unit) Returns standardized plural of a given singular/plural unit name (in English). + * @method CarbonImmutable|false rawCreateFromFormat($format, $time, $tz = null) Create a Carbon instance from a specific format. + * @method CarbonImmutable rawParse($time = null, $tz = null) Create a carbon instance from a string. + * This is an alias for the constructor that allows better fluent syntax + * as it allows you to do Carbon::parse('Monday next week')->fn() rather + * than (new Carbon('Monday next week'))->fn(). + * @method CarbonImmutable resetMacros() Remove all macros and generic macros. + * @method void resetMonthsOverflow() @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * Or you can use method variants: addMonthsWithOverflow/addMonthsNoOverflow, same variants + * are available for quarters, years, decade, centuries, millennia (singular and plural forms). + * @method void resetToStringFormat() Reset the format used to the default when type juggling a Carbon instance to a string + * @method void resetYearsOverflow() @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * Or you can use method variants: addYearsWithOverflow/addYearsNoOverflow, same variants + * are available for quarters, years, decade, centuries, millennia (singular and plural forms). + * @method void serializeUsing($callback) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather transform Carbon object before the serialization. + * JSON serialize all Carbon instances using the given callback. + * @method CarbonImmutable setFallbackLocale($locale) Set the fallback locale. + * @method CarbonImmutable setHumanDiffOptions($humanDiffOptions) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * @method bool setLocale($locale) Set the current translator locale and indicate if the source locale file exists. + * Pass 'auto' as locale to use closest language from the current LC_TIME locale. + * @method void setMidDayAt($hour) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather consider mid-day is always 12pm, then if you need to test if it's an other + * hour, test it explicitly: + * $date->format('G') == 13 + * or to set explicitly to a given hour: + * $date->setTime(13, 0, 0, 0) + * Set midday/noon hour + * @method CarbonImmutable setTestNow($testNow = null) Set a Carbon instance (real or mock) to be returned when a "now" + * instance is created. The provided instance will be returned + * specifically under the following conditions: + * - A call to the static now() method, ex. Carbon::now() + * - When a null (or blank string) is passed to the constructor or parse(), ex. new Carbon(null) + * - When the string "now" is passed to the constructor or parse(), ex. new Carbon('now') + * - When a string containing the desired time is passed to Carbon::parse(). + * Note the timezone parameter was left out of the examples above and + * has no affect as the mock value will be returned regardless of its value. + * Only the moment is mocked with setTestNow(), the timezone will still be the one passed + * as parameter of date_default_timezone_get() as a fallback (see setTestNowAndTimezone()). + * To clear the test instance call this method using the default + * parameter of null. + * /!\ Use this method for unit tests only. + * @method CarbonImmutable setTestNowAndTimezone($testNow = null, $tz = null) Set a Carbon instance (real or mock) to be returned when a "now" + * instance is created. The provided instance will be returned + * specifically under the following conditions: + * - A call to the static now() method, ex. Carbon::now() + * - When a null (or blank string) is passed to the constructor or parse(), ex. new Carbon(null) + * - When the string "now" is passed to the constructor or parse(), ex. new Carbon('now') + * - When a string containing the desired time is passed to Carbon::parse(). + * It will also align default timezone (e.g. call date_default_timezone_set()) with + * the second argument or if null, with the timezone of the given date object. + * To clear the test instance call this method using the default + * parameter of null. + * /!\ Use this method for unit tests only. + * @method void setToStringFormat($format) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather let Carbon object being cast to string with DEFAULT_TO_STRING_FORMAT, and + * use other method or custom format passed to format() method if you need to dump another string + * format. + * Set the default format used when type juggling a Carbon instance to a string. + * @method void setTranslator(TranslatorInterface $translator) Set the default translator instance to use. + * @method CarbonImmutable setUtf8($utf8) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use UTF-8 language packages on every machine. + * Set if UTF8 will be used for localized date/time. + * @method void setWeekEndsAt($day) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * Use $weekStartsAt optional parameter instead when using startOfWeek, floorWeek, ceilWeek + * or roundWeek method. You can also use the 'first_day_of_week' locale setting to change the + * start of week according to current locale selected and implicitly the end of week. + * Set the last day of week + * @method void setWeekStartsAt($day) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * Use $weekEndsAt optional parameter instead when using endOfWeek method. You can also use the + * 'first_day_of_week' locale setting to change the start of week according to current locale + * selected and implicitly the end of week. + * Set the first day of week + * @method void setWeekendDays($days) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather consider week-end is always saturday and sunday, and if you have some custom + * week-end days to handle, give to those days an other name and create a macro for them: + * ``` + * Carbon::macro('isDayOff', function ($date) { + * return $date->isSunday() || $date->isMonday(); + * }); + * Carbon::macro('isNotDayOff', function ($date) { + * return !$date->isDayOff(); + * }); + * if ($someDate->isDayOff()) ... + * if ($someDate->isNotDayOff()) ... + * // Add 5 not-off days + * $count = 5; + * while ($someDate->isDayOff() || ($count-- > 0)) { + * $someDate->addDay(); + * } + * ``` + * Set weekend days + * @method bool shouldOverflowMonths() Get the month overflow global behavior (can be overridden in specific instances). + * @method bool shouldOverflowYears() Get the month overflow global behavior (can be overridden in specific instances). + * @method string singularUnit(string $unit) Returns standardized singular of a given singular/plural unit name (in English). + * @method CarbonImmutable today($tz = null) Create a Carbon instance for today. + * @method CarbonImmutable tomorrow($tz = null) Create a Carbon instance for tomorrow. + * @method string translateTimeString($timeString, $from = null, $to = null, $mode = CarbonInterface::TRANSLATE_ALL) Translate a time string from a locale to an other. + * @method string translateWith(TranslatorInterface $translator, string $key, array $parameters = [], $number = null) Translate using translation string or callback available. + * @method void useMonthsOverflow($monthsOverflow = true) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * Or you can use method variants: addMonthsWithOverflow/addMonthsNoOverflow, same variants + * are available for quarters, years, decade, centuries, millennia (singular and plural forms). + * @method CarbonImmutable useStrictMode($strictModeEnabled = true) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * @method void useYearsOverflow($yearsOverflow = true) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * Or you can use method variants: addYearsWithOverflow/addYearsNoOverflow, same variants + * are available for quarters, years, decade, centuries, millennia (singular and plural forms). + * @method mixed withTestNow($testNow, $callback) Temporarily sets a static date to be used within the callback. + * Using setTestNow to set the date, executing the callback, then + * clearing the test instance. + * /!\ Use this method for unit tests only. + * @method CarbonImmutable yesterday($tz = null) Create a Carbon instance for yesterday. + * + * </autodoc> + */ +class FactoryImmutable extends Factory implements ClockInterface +{ + protected $className = CarbonImmutable::class; + + /** + * Get a Carbon instance for the current date and time. + * + * @param DateTimeZone|string|int|null $tz + * + * @return CarbonImmutable + */ + public function now($tz = null): DateTimeImmutable + { + $className = $this->className; + + return new $className(null, $tz); + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/aa.php b/vendor/nesbot/carbon/src/Carbon/Lang/aa.php new file mode 100644 index 00000000..f3431e4b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/aa.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/aa_DJ.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/aa_DJ.php b/vendor/nesbot/carbon/src/Carbon/Lang/aa_DJ.php new file mode 100644 index 00000000..c6e23c0d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/aa_DJ.php @@ -0,0 +1,44 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Ge'ez Frontier Foundation locales@geez.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD.MM.YYYY', + ], + 'months' => ['Qunxa Garablu', 'Kudo', 'Ciggilta Kudo', 'Agda Baxisso', 'Caxah Alsa', 'Qasa Dirri', 'Qado Dirri', 'Liiqen', 'Waysu', 'Diteli', 'Ximoli', 'Kaxxa Garablu'], + 'months_short' => ['qun', 'nah', 'cig', 'agd', 'cax', 'qas', 'qad', 'leq', 'way', 'dit', 'xim', 'kax'], + 'weekdays' => ['Acaada', 'Etleeni', 'Talaata', 'Arbaqa', 'Kamiisi', 'Gumqata', 'Sabti'], + 'weekdays_short' => ['aca', 'etl', 'tal', 'arb', 'kam', 'gum', 'sab'], + 'weekdays_min' => ['aca', 'etl', 'tal', 'arb', 'kam', 'gum', 'sab'], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['saaku', 'carra'], + + 'year' => ':count gaqambo', // less reliable + 'y' => ':count gaqambo', // less reliable + 'a_year' => ':count gaqambo', // less reliable + + 'month' => ':count àlsa', + 'm' => ':count àlsa', + 'a_month' => ':count àlsa', + + 'day' => ':count saaku', // less reliable + 'd' => ':count saaku', // less reliable + 'a_day' => ':count saaku', // less reliable + + 'hour' => ':count ayti', // less reliable + 'h' => ':count ayti', // less reliable + 'a_hour' => ':count ayti', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/aa_ER.php b/vendor/nesbot/carbon/src/Carbon/Lang/aa_ER.php new file mode 100644 index 00000000..f8f395b7 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/aa_ER.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Ge'ez Frontier Foundation locales@geez.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['Qunxa Garablu', 'Naharsi Kudo', 'Ciggilta Kudo', 'Agda Baxisso', 'Caxah Alsa', 'Qasa Dirri', 'Qado Dirri', 'Leqeeni', 'Waysu', 'Diteli', 'Ximoli', 'Kaxxa Garablu'], + 'months_short' => ['Qun', 'Nah', 'Cig', 'Agd', 'Cax', 'Qas', 'Qad', 'Leq', 'Way', 'Dit', 'Xim', 'Kax'], + 'weekdays' => ['Acaada', 'Etleeni', 'Talaata', 'Arbaqa', 'Kamiisi', 'Gumqata', 'Sabti'], + 'weekdays_short' => ['Aca', 'Etl', 'Tal', 'Arb', 'Kam', 'Gum', 'Sab'], + 'weekdays_min' => ['Aca', 'Etl', 'Tal', 'Arb', 'Kam', 'Gum', 'Sab'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['saaku', 'carra'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/aa_ER@saaho.php b/vendor/nesbot/carbon/src/Carbon/Lang/aa_ER@saaho.php new file mode 100644 index 00000000..64612253 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/aa_ER@saaho.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Ge'ez Frontier Foundation locales@geez.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['Qunxa Garablu', 'Naharsi Kudo', 'Ciggilta Kudo', 'Agda Baxisso', 'Caxah Alsa', 'Qasa Dirri', 'Qado Dirri', 'Leqeeni', 'Waysu', 'Diteli', 'Ximoli', 'Kaxxa Garablu'], + 'months_short' => ['Qun', 'Nah', 'Cig', 'Agd', 'Cax', 'Qas', 'Qad', 'Leq', 'Way', 'Dit', 'Xim', 'Kax'], + 'weekdays' => ['Naba Sambat', 'Sani', 'Salus', 'Rabuq', 'Camus', 'Jumqata', 'Qunxa Sambat'], + 'weekdays_short' => ['Nab', 'San', 'Sal', 'Rab', 'Cam', 'Jum', 'Qun'], + 'weekdays_min' => ['Nab', 'San', 'Sal', 'Rab', 'Cam', 'Jum', 'Qun'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['saaku', 'carra'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/aa_ET.php b/vendor/nesbot/carbon/src/Carbon/Lang/aa_ET.php new file mode 100644 index 00000000..e55e591b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/aa_ET.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Ge'ez Frontier Foundation locales@geez.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['Qunxa Garablu', 'Kudo', 'Ciggilta Kudo', 'Agda Baxisso', 'Caxah Alsa', 'Qasa Dirri', 'Qado Dirri', 'Liiqen', 'Waysu', 'Diteli', 'Ximoli', 'Kaxxa Garablu'], + 'months_short' => ['Qun', 'Kud', 'Cig', 'Agd', 'Cax', 'Qas', 'Qad', 'Leq', 'Way', 'Dit', 'Xim', 'Kax'], + 'weekdays' => ['Acaada', 'Etleeni', 'Talaata', 'Arbaqa', 'Kamiisi', 'Gumqata', 'Sabti'], + 'weekdays_short' => ['Aca', 'Etl', 'Tal', 'Arb', 'Kam', 'Gum', 'Sab'], + 'weekdays_min' => ['Aca', 'Etl', 'Tal', 'Arb', 'Kam', 'Gum', 'Sab'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['saaku', 'carra'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/af.php b/vendor/nesbot/carbon/src/Carbon/Lang/af.php new file mode 100644 index 00000000..27771d7a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/af.php @@ -0,0 +1,79 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - François B + * - JD Isaacks + * - Pierre du Plessis + */ +return [ + 'year' => ':count jaar', + 'a_year' => '\'n jaar|:count jaar', + 'y' => ':count j.', + 'month' => ':count maand|:count maande', + 'a_month' => '\'n maand|:count maande', + 'm' => ':count maa.', + 'week' => ':count week|:count weke', + 'a_week' => '\'n week|:count weke', + 'w' => ':count w.', + 'day' => ':count dag|:count dae', + 'a_day' => '\'n dag|:count dae', + 'd' => ':count d.', + 'hour' => ':count uur', + 'a_hour' => '\'n uur|:count uur', + 'h' => ':count u.', + 'minute' => ':count minuut|:count minute', + 'a_minute' => '\'n minuut|:count minute', + 'min' => ':count min.', + 'second' => ':count sekond|:count sekondes', + 'a_second' => '\'n paar sekondes|:count sekondes', + 's' => ':count s.', + 'ago' => ':time gelede', + 'from_now' => 'oor :time', + 'after' => ':time na', + 'before' => ':time voor', + 'diff_now' => 'Nou', + 'diff_today' => 'Vandag', + 'diff_today_regexp' => 'Vandag(?:\\s+om)?', + 'diff_yesterday' => 'Gister', + 'diff_yesterday_regexp' => 'Gister(?:\\s+om)?', + 'diff_tomorrow' => 'Môre', + 'diff_tomorrow_regexp' => 'Môre(?:\\s+om)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Vandag om] LT', + 'nextDay' => '[Môre om] LT', + 'nextWeek' => 'dddd [om] LT', + 'lastDay' => '[Gister om] LT', + 'lastWeek' => '[Laas] dddd [om] LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + return $number.(($number === 1 || $number === 8 || $number >= 20) ? 'ste' : 'de'); + }, + 'meridiem' => ['VM', 'NM'], + 'months' => ['Januarie', 'Februarie', 'Maart', 'April', 'Mei', 'Junie', 'Julie', 'Augustus', 'September', 'Oktober', 'November', 'Desember'], + 'months_short' => ['Jan', 'Feb', 'Mrt', 'Apr', 'Mei', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'], + 'weekdays' => ['Sondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrydag', 'Saterdag'], + 'weekdays_short' => ['Son', 'Maa', 'Din', 'Woe', 'Don', 'Vry', 'Sat'], + 'weekdays_min' => ['So', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Sa'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' en '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/af_NA.php b/vendor/nesbot/carbon/src/Carbon/Lang/af_NA.php new file mode 100644 index 00000000..f2fcf053 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/af_NA.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/af.php', [ + 'meridiem' => ['v', 'n'], + 'weekdays' => ['Sondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrydag', 'Saterdag'], + 'weekdays_short' => ['So.', 'Ma.', 'Di.', 'Wo.', 'Do.', 'Vr.', 'Sa.'], + 'weekdays_min' => ['So.', 'Ma.', 'Di.', 'Wo.', 'Do.', 'Vr.', 'Sa.'], + 'months' => ['Januarie', 'Februarie', 'Maart', 'April', 'Mei', 'Junie', 'Julie', 'Augustus', 'September', 'Oktober', 'November', 'Desember'], + 'months_short' => ['Jan.', 'Feb.', 'Mrt.', 'Apr.', 'Mei', 'Jun.', 'Jul.', 'Aug.', 'Sep.', 'Okt.', 'Nov.', 'Des.'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY-MM-DD', + 'LL' => 'DD MMM YYYY', + 'LLL' => 'DD MMMM YYYY HH:mm', + 'LLLL' => 'dddd, DD MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/af_ZA.php b/vendor/nesbot/carbon/src/Carbon/Lang/af_ZA.php new file mode 100644 index 00000000..27896bd0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/af_ZA.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/af.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/agq.php b/vendor/nesbot/carbon/src/Carbon/Lang/agq.php new file mode 100644 index 00000000..70114649 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/agq.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['a.g', 'a.k'], + 'weekdays' => ['tsuʔntsɨ', 'tsuʔukpà', 'tsuʔughɔe', 'tsuʔutɔ̀mlò', 'tsuʔumè', 'tsuʔughɨ̂m', 'tsuʔndzɨkɔʔɔ'], + 'weekdays_short' => ['nts', 'kpa', 'ghɔ', 'tɔm', 'ume', 'ghɨ', 'dzk'], + 'weekdays_min' => ['nts', 'kpa', 'ghɔ', 'tɔm', 'ume', 'ghɨ', 'dzk'], + 'months' => ['ndzɔ̀ŋɔ̀nùm', 'ndzɔ̀ŋɔ̀kƗ̀zùʔ', 'ndzɔ̀ŋɔ̀tƗ̀dʉ̀ghà', 'ndzɔ̀ŋɔ̀tǎafʉ̄ghā', 'ndzɔ̀ŋèsèe', 'ndzɔ̀ŋɔ̀nzùghò', 'ndzɔ̀ŋɔ̀dùmlo', 'ndzɔ̀ŋɔ̀kwîfɔ̀e', 'ndzɔ̀ŋɔ̀tƗ̀fʉ̀ghàdzughù', 'ndzɔ̀ŋɔ̀ghǔuwelɔ̀m', 'ndzɔ̀ŋɔ̀chwaʔàkaa wo', 'ndzɔ̀ŋèfwòo'], + 'months_short' => ['nùm', 'kɨz', 'tɨd', 'taa', 'see', 'nzu', 'dum', 'fɔe', 'dzu', 'lɔm', 'kaa', 'fwo'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMM, YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/agr.php b/vendor/nesbot/carbon/src/Carbon/Lang/agr.php new file mode 100644 index 00000000..8f036ae8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/agr.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/agr_PE.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/agr_PE.php b/vendor/nesbot/carbon/src/Carbon/Lang/agr_PE.php new file mode 100644 index 00000000..54a326af --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/agr_PE.php @@ -0,0 +1,44 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - somosazucar.org libc-alpha@sourceware.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YY', + ], + 'months' => ['Petsatin', 'Kupitin', 'Uyaitin', 'Tayutin', 'Kegketin', 'Tegmatin', 'Kuntutin', 'Yagkujutin', 'Daiktatin', 'Ipamtatin', 'Shinutin', 'Sakamtin'], + 'months_short' => ['Pet', 'Kup', 'Uya', 'Tay', 'Keg', 'Teg', 'Kun', 'Yag', 'Dait', 'Ipam', 'Shin', 'Sak'], + 'weekdays' => ['Tuntuamtin', 'Achutin', 'Kugkuktin', 'Saketin', 'Shimpitin', 'Imaptin', 'Bataetin'], + 'weekdays_short' => ['Tun', 'Ach', 'Kug', 'Sak', 'Shim', 'Im', 'Bat'], + 'weekdays_min' => ['Tun', 'Ach', 'Kug', 'Sak', 'Shim', 'Im', 'Bat'], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 7, + 'meridiem' => ['VM', 'NM'], + + 'year' => ':count yaya', // less reliable + 'y' => ':count yaya', // less reliable + 'a_year' => ':count yaya', // less reliable + + 'month' => ':count nantu', // less reliable + 'm' => ':count nantu', // less reliable + 'a_month' => ':count nantu', // less reliable + + 'day' => ':count nayaim', // less reliable + 'd' => ':count nayaim', // less reliable + 'a_day' => ':count nayaim', // less reliable + + 'hour' => ':count kuwiš', // less reliable + 'h' => ':count kuwiš', // less reliable + 'a_hour' => ':count kuwiš', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ak.php b/vendor/nesbot/carbon/src/Carbon/Lang/ak.php new file mode 100644 index 00000000..5a64be37 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ak.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/ak_GH.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ak_GH.php b/vendor/nesbot/carbon/src/Carbon/Lang/ak_GH.php new file mode 100644 index 00000000..13819467 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ak_GH.php @@ -0,0 +1,40 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Sugar Labs // OLPC sugarlabs.org libc-alpha@sourceware.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'YYYY/MM/DD', + ], + 'months' => ['Sanda-Ɔpɛpɔn', 'Kwakwar-Ɔgyefuo', 'Ebɔw-Ɔbenem', 'Ebɔbira-Oforisuo', 'Esusow Aketseaba-Kɔtɔnimba', 'Obirade-Ayɛwohomumu', 'Ayɛwoho-Kitawonsa', 'Difuu-Ɔsandaa', 'Fankwa-Ɛbɔ', 'Ɔbɛsɛ-Ahinime', 'Ɔberɛfɛw-Obubuo', 'Mumu-Ɔpɛnimba'], + 'months_short' => ['S-Ɔ', 'K-Ɔ', 'E-Ɔ', 'E-O', 'E-K', 'O-A', 'A-K', 'D-Ɔ', 'F-Ɛ', 'Ɔ-A', 'Ɔ-O', 'M-Ɔ'], + 'weekdays' => ['Kwesida', 'Dwowda', 'Benada', 'Wukuda', 'Yawda', 'Fida', 'Memeneda'], + 'weekdays_short' => ['Kwe', 'Dwo', 'Ben', 'Wuk', 'Yaw', 'Fia', 'Mem'], + 'weekdays_min' => ['Kwe', 'Dwo', 'Ben', 'Wuk', 'Yaw', 'Fia', 'Mem'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['AN', 'EW'], + + 'year' => ':count afe', + 'y' => ':count afe', + 'a_year' => ':count afe', + + 'month' => ':count bosume', + 'm' => ':count bosume', + 'a_month' => ':count bosume', + + 'day' => ':count ɛda', + 'd' => ':count ɛda', + 'a_day' => ':count ɛda', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/am.php b/vendor/nesbot/carbon/src/Carbon/Lang/am.php new file mode 100644 index 00000000..63bf72d2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/am.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/am_ET.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/am_ET.php b/vendor/nesbot/carbon/src/Carbon/Lang/am_ET.php new file mode 100644 index 00000000..ece80621 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/am_ET.php @@ -0,0 +1,58 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Ge'ez Frontier Foundation locales@geez.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['ጃንዩወሪ', 'ፌብሩወሪ', 'ማርች', 'ኤፕሪል', 'ሜይ', 'ጁን', 'ጁላይ', 'ኦገስት', 'ሴፕቴምበር', 'ኦክቶበር', 'ኖቬምበር', 'ዲሴምበር'], + 'months_short' => ['ጃንዩ', 'ፌብሩ', 'ማርች', 'ኤፕረ', 'ሜይ ', 'ጁን ', 'ጁላይ', 'ኦገስ', 'ሴፕቴ', 'ኦክተ', 'ኖቬም', 'ዲሴም'], + 'weekdays' => ['እሑድ', 'ሰኞ', 'ማክሰኞ', 'ረቡዕ', 'ሐሙስ', 'ዓርብ', 'ቅዳሜ'], + 'weekdays_short' => ['እሑድ', 'ሰኞ ', 'ማክሰ', 'ረቡዕ', 'ሐሙስ', 'ዓርብ', 'ቅዳሜ'], + 'weekdays_min' => ['እሑድ', 'ሰኞ ', 'ማክሰ', 'ረቡዕ', 'ሐሙስ', 'ዓርብ', 'ቅዳሜ'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['ጡዋት', 'ከሰዓት'], + + 'year' => ':count አመት', + 'y' => ':count አመት', + 'a_year' => ':count አመት', + + 'month' => ':count ወር', + 'm' => ':count ወር', + 'a_month' => ':count ወር', + + 'week' => ':count ሳምንት', + 'w' => ':count ሳምንት', + 'a_week' => ':count ሳምንት', + + 'day' => ':count ቀን', + 'd' => ':count ቀን', + 'a_day' => ':count ቀን', + + 'hour' => ':count ሰዓት', + 'h' => ':count ሰዓት', + 'a_hour' => ':count ሰዓት', + + 'minute' => ':count ደቂቃ', + 'min' => ':count ደቂቃ', + 'a_minute' => ':count ደቂቃ', + + 'second' => ':count ሴኮንድ', + 's' => ':count ሴኮንድ', + 'a_second' => ':count ሴኮንድ', + + 'ago' => 'ከ:time በፊት', + 'from_now' => 'በ:time ውስጥ', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/an.php b/vendor/nesbot/carbon/src/Carbon/Lang/an.php new file mode 100644 index 00000000..565abf26 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/an.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/an_ES.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/an_ES.php b/vendor/nesbot/carbon/src/Carbon/Lang/an_ES.php new file mode 100644 index 00000000..faf8ae07 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/an_ES.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Softaragones Jordi Mallach Pérez, Juan Pablo Martínez bug-glibc-locales@gnu.org, softaragones@softaragones.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['chinero', 'febrero', 'marzo', 'abril', 'mayo', 'chunyo', 'chuliol', 'agosto', 'setiembre', 'octubre', 'noviembre', 'aviento'], + 'months_short' => ['chi', 'feb', 'mar', 'abr', 'may', 'chn', 'chl', 'ago', 'set', 'oct', 'nov', 'avi'], + 'weekdays' => ['domingo', 'luns', 'martes', 'mierques', 'chueves', 'viernes', 'sabado'], + 'weekdays_short' => ['dom', 'lun', 'mar', 'mie', 'chu', 'vie', 'sab'], + 'weekdays_min' => ['dom', 'lun', 'mar', 'mie', 'chu', 'vie', 'sab'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + + 'year' => ':count año', + 'y' => ':count año', + 'a_year' => ':count año', + + 'month' => ':count mes', + 'm' => ':count mes', + 'a_month' => ':count mes', + + 'week' => ':count semana', + 'w' => ':count semana', + 'a_week' => ':count semana', + + 'day' => ':count día', + 'd' => ':count día', + 'a_day' => ':count día', + + 'hour' => ':count reloch', // less reliable + 'h' => ':count reloch', // less reliable + 'a_hour' => ':count reloch', // less reliable + + 'minute' => ':count minuto', + 'min' => ':count minuto', + 'a_minute' => ':count minuto', + + 'second' => ':count segundo', + 's' => ':count segundo', + 'a_second' => ':count segundo', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/anp.php b/vendor/nesbot/carbon/src/Carbon/Lang/anp.php new file mode 100644 index 00000000..b56c67bb --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/anp.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/anp_IN.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/anp_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/anp_IN.php new file mode 100644 index 00000000..11069be3 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/anp_IN.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - bhashaghar@googlegroups.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'D/M/YY', + ], + 'months' => ['जनवरी', 'फरवरी', 'मार्च', 'अप्रैल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितंबर', 'अक्टूबर', 'नवंबर', 'दिसंबर"'], + 'months_short' => ['जनवरी', 'फरवरी', 'मार्च', 'अप्रैल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितंबर', 'अक्टूबर', 'नवंबर', 'दिसंबर'], + 'weekdays' => ['रविवार', 'सोमवार', 'मंगलवार', 'बुधवार', 'बृहस्पतिवार', 'शुक्रवार', 'शनिवार'], + 'weekdays_short' => ['रवि', 'सोम', 'मंगल', 'बुध', 'बृहस्पति', 'शुक्र', 'शनि'], + 'weekdays_min' => ['रवि', 'सोम', 'मंगल', 'बुध', 'बृहस्पति', 'शुक्र', 'शनि'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['पूर्वाह्न', 'अपराह्न'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar.php new file mode 100644 index 00000000..5f73f639 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar.php @@ -0,0 +1,93 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Atef Ben Ali (atefBB) + * - Ibrahim AshShohail + * - MLTDev + * - Mohamed Sabil (mohamedsabil83) + * - Yazan Alnugnugh (yazan-alnugnugh) + */ +$months = [ + 'يناير', + 'فبراير', + 'مارس', + 'أبريل', + 'مايو', + 'يونيو', + 'يوليو', + 'أغسطس', + 'سبتمبر', + 'أكتوبر', + 'نوفمبر', + 'ديسمبر', +]; + +return [ + 'year' => implode('|', ['{0}:count سنة', '{1}سنة', '{2}سنتين', ']2,11[:count سنوات', ']10,Inf[:count سنة']), + 'a_year' => implode('|', ['{0}:count سنة', '{1}سنة', '{2}سنتين', ']2,11[:count سنوات', ']10,Inf[:count سنة']), + 'month' => implode('|', ['{0}:count شهر', '{1}شهر', '{2}شهرين', ']2,11[:count أشهر', ']10,Inf[:count شهر']), + 'a_month' => implode('|', ['{0}:count شهر', '{1}شهر', '{2}شهرين', ']2,11[:count أشهر', ']10,Inf[:count شهر']), + 'week' => implode('|', ['{0}:count أسبوع', '{1}أسبوع', '{2}أسبوعين', ']2,11[:count أسابيع', ']10,Inf[:count أسبوع']), + 'a_week' => implode('|', ['{0}:count أسبوع', '{1}أسبوع', '{2}أسبوعين', ']2,11[:count أسابيع', ']10,Inf[:count أسبوع']), + 'day' => implode('|', ['{0}:count يوم', '{1}يوم', '{2}يومين', ']2,11[:count أيام', ']10,Inf[:count يوم']), + 'a_day' => implode('|', ['{0}:count يوم', '{1}يوم', '{2}يومين', ']2,11[:count أيام', ']10,Inf[:count يوم']), + 'hour' => implode('|', ['{0}:count ساعة', '{1}ساعة', '{2}ساعتين', ']2,11[:count ساعات', ']10,Inf[:count ساعة']), + 'a_hour' => implode('|', ['{0}:count ساعة', '{1}ساعة', '{2}ساعتين', ']2,11[:count ساعات', ']10,Inf[:count ساعة']), + 'minute' => implode('|', ['{0}:count دقيقة', '{1}دقيقة', '{2}دقيقتين', ']2,11[:count دقائق', ']10,Inf[:count دقيقة']), + 'a_minute' => implode('|', ['{0}:count دقيقة', '{1}دقيقة', '{2}دقيقتين', ']2,11[:count دقائق', ']10,Inf[:count دقيقة']), + 'second' => implode('|', ['{0}:count ثانية', '{1}ثانية', '{2}ثانيتين', ']2,11[:count ثواني', ']10,Inf[:count ثانية']), + 'a_second' => implode('|', ['{0}:count ثانية', '{1}ثانية', '{2}ثانيتين', ']2,11[:count ثواني', ']10,Inf[:count ثانية']), + 'ago' => 'منذ :time', + 'from_now' => ':time من الآن', + 'after' => 'بعد :time', + 'before' => 'قبل :time', + 'diff_now' => 'الآن', + 'diff_today' => 'اليوم', + 'diff_today_regexp' => 'اليوم(?:\\s+عند)?(?:\\s+الساعة)?', + 'diff_yesterday' => 'أمس', + 'diff_yesterday_regexp' => 'أمس(?:\\s+عند)?(?:\\s+الساعة)?', + 'diff_tomorrow' => 'غداً', + 'diff_tomorrow_regexp' => 'غدًا(?:\\s+عند)?(?:\\s+الساعة)?', + 'diff_before_yesterday' => 'قبل الأمس', + 'diff_after_tomorrow' => 'بعد غد', + 'period_recurrences' => implode('|', ['{0}مرة', '{1}مرة', '{2}:count مرتين', ']2,11[:count مرات', ']10,Inf[:count مرة']), + 'period_interval' => 'كل :interval', + 'period_start_date' => 'من :date', + 'period_end_date' => 'إلى :date', + 'months' => $months, + 'months_short' => $months, + 'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], + 'weekdays_short' => ['أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'], + 'weekdays_min' => ['ح', 'اث', 'ثل', 'أر', 'خم', 'ج', 'س'], + 'list' => ['، ', ' و '], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[اليوم عند الساعة] LT', + 'nextDay' => '[غدًا عند الساعة] LT', + 'nextWeek' => 'dddd [عند الساعة] LT', + 'lastDay' => '[أمس عند الساعة] LT', + 'lastWeek' => 'dddd [عند الساعة] LT', + 'sameElse' => 'L', + ], + 'meridiem' => ['ص', 'م'], + 'weekend' => [5, 6], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_AE.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_AE.php new file mode 100644 index 00000000..35a22b1d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_AE.php @@ -0,0 +1,29 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri + */ +return array_replace_recursive(require __DIR__.'/ar.php', [ + 'formats' => [ + 'L' => 'DD MMM, YYYY', + ], + 'months' => ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر'], + 'months_short' => ['ينا', 'فبر', 'مار', 'أبر', 'ماي', 'يون', 'يول', 'أغس', 'سبت', 'أكت', 'نوف', 'ديس'], + 'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت '], + 'weekdays_short' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_BH.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_BH.php new file mode 100644 index 00000000..35180965 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_BH.php @@ -0,0 +1,29 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri + */ +return array_replace_recursive(require __DIR__.'/ar.php', [ + 'formats' => [ + 'L' => 'DD MMM, YYYY', + ], + 'months' => ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر'], + 'months_short' => ['ينا', 'فبر', 'مار', 'أبر', 'ماي', 'يون', 'يول', 'أغس', 'سبت', 'أكت', 'نوف', 'ديس'], + 'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], + 'weekdays_short' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_DJ.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_DJ.php new file mode 100644 index 00000000..e790b99e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_DJ.php @@ -0,0 +1,13 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ar.php', [ +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_DZ.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_DZ.php new file mode 100644 index 00000000..aea4eeec --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_DZ.php @@ -0,0 +1,92 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * Authors: + * - Josh Soref + * - Noureddine LOUAHEDJ + * - JD Isaacks + * - Atef Ben Ali (atefBB) + * - Mohamed Sabil (mohamedsabil83) + */ +$months = [ + 'جانفي', + 'فيفري', + 'مارس', + 'أفريل', + 'ماي', + 'جوان', + 'جويلية', + 'أوت', + 'سبتمبر', + 'أكتوبر', + 'نوفمبر', + 'ديسمبر', +]; + +return [ + 'year' => implode('|', ['{0}:count سنة', '{1}سنة', '{2}سنتين', ']2,11[:count سنوات', ']10,Inf[:count سنة']), + 'a_year' => implode('|', ['{0}:count سنة', '{1}سنة', '{2}سنتين', ']2,11[:count سنوات', ']10,Inf[:count سنة']), + 'month' => implode('|', ['{0}:count شهر', '{1}شهر', '{2}شهرين', ']2,11[:count أشهر', ']10,Inf[:count شهر']), + 'a_month' => implode('|', ['{0}:count شهر', '{1}شهر', '{2}شهرين', ']2,11[:count أشهر', ']10,Inf[:count شهر']), + 'week' => implode('|', ['{0}:count أسبوع', '{1}أسبوع', '{2}أسبوعين', ']2,11[:count أسابيع', ']10,Inf[:count أسبوع']), + 'a_week' => implode('|', ['{0}:count أسبوع', '{1}أسبوع', '{2}أسبوعين', ']2,11[:count أسابيع', ']10,Inf[:count أسبوع']), + 'day' => implode('|', ['{0}:count يوم', '{1}يوم', '{2}يومين', ']2,11[:count أيام', ']10,Inf[:count يوم']), + 'a_day' => implode('|', ['{0}:count يوم', '{1}يوم', '{2}يومين', ']2,11[:count أيام', ']10,Inf[:count يوم']), + 'hour' => implode('|', ['{0}:count ساعة', '{1}ساعة', '{2}ساعتين', ']2,11[:count ساعات', ']10,Inf[:count ساعة']), + 'a_hour' => implode('|', ['{0}:count ساعة', '{1}ساعة', '{2}ساعتين', ']2,11[:count ساعات', ']10,Inf[:count ساعة']), + 'minute' => implode('|', ['{0}:count دقيقة', '{1}دقيقة', '{2}دقيقتين', ']2,11[:count دقائق', ']10,Inf[:count دقيقة']), + 'a_minute' => implode('|', ['{0}:count دقيقة', '{1}دقيقة', '{2}دقيقتين', ']2,11[:count دقائق', ']10,Inf[:count دقيقة']), + 'second' => implode('|', ['{0}:count ثانية', '{1}ثانية', '{2}ثانيتين', ']2,11[:count ثواني', ']10,Inf[:count ثانية']), + 'a_second' => implode('|', ['{0}:count ثانية', '{1}ثانية', '{2}ثانيتين', ']2,11[:count ثواني', ']10,Inf[:count ثانية']), + 'ago' => 'منذ :time', + 'from_now' => 'في :time', + 'after' => 'بعد :time', + 'before' => 'قبل :time', + 'diff_now' => 'الآن', + 'diff_today' => 'اليوم', + 'diff_today_regexp' => 'اليوم(?:\\s+على)?(?:\\s+الساعة)?', + 'diff_yesterday' => 'أمس', + 'diff_yesterday_regexp' => 'أمس(?:\\s+على)?(?:\\s+الساعة)?', + 'diff_tomorrow' => 'غداً', + 'diff_tomorrow_regexp' => 'غدا(?:\\s+على)?(?:\\s+الساعة)?', + 'diff_before_yesterday' => 'قبل الأمس', + 'diff_after_tomorrow' => 'بعد غد', + 'period_recurrences' => implode('|', ['{0}مرة', '{1}مرة', '{2}:count مرتين', ']2,11[:count مرات', ']10,Inf[:count مرة']), + 'period_interval' => 'كل :interval', + 'period_start_date' => 'من :date', + 'period_end_date' => 'إلى :date', + 'months' => $months, + 'months_short' => $months, + 'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], + 'weekdays_short' => ['أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'], + 'weekdays_min' => ['أح', 'إث', 'ثلا', 'أر', 'خم', 'جم', 'سب'], + 'list' => ['، ', ' و '], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 4, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[اليوم على الساعة] LT', + 'nextDay' => '[غدا على الساعة] LT', + 'nextWeek' => 'dddd [على الساعة] LT', + 'lastDay' => '[أمس على الساعة] LT', + 'lastWeek' => 'dddd [على الساعة] LT', + 'sameElse' => 'L', + ], + 'meridiem' => ['ص', 'م'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_EG.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_EG.php new file mode 100644 index 00000000..35180965 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_EG.php @@ -0,0 +1,29 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri + */ +return array_replace_recursive(require __DIR__.'/ar.php', [ + 'formats' => [ + 'L' => 'DD MMM, YYYY', + ], + 'months' => ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر'], + 'months_short' => ['ينا', 'فبر', 'مار', 'أبر', 'ماي', 'يون', 'يول', 'أغس', 'سبت', 'أكت', 'نوف', 'ديس'], + 'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], + 'weekdays_short' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_EH.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_EH.php new file mode 100644 index 00000000..e790b99e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_EH.php @@ -0,0 +1,13 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ar.php', [ +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_ER.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_ER.php new file mode 100644 index 00000000..e790b99e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_ER.php @@ -0,0 +1,13 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ar.php', [ +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_IL.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_IL.php new file mode 100644 index 00000000..e790b99e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_IL.php @@ -0,0 +1,13 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ar.php', [ +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_IN.php new file mode 100644 index 00000000..5fecf70f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_IN.php @@ -0,0 +1,26 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/ar.php', [ + 'formats' => [ + 'L' => 'D/M/YY', + ], + 'months' => ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر'], + 'months_short' => ['ينا', 'فبر', 'مار', 'أبر', 'ماي', 'يون', 'يول', 'أغس', 'سبت', 'أكت', 'نوف', 'ديس'], + 'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], + 'weekdays_short' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_IQ.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_IQ.php new file mode 100644 index 00000000..2d420084 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_IQ.php @@ -0,0 +1,29 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri + */ +return array_replace_recursive(require __DIR__.'/ar.php', [ + 'formats' => [ + 'L' => 'DD MMM, YYYY', + ], + 'months' => ['كانون الثاني', 'شباط', 'آذار', 'نيسان', 'أيار', 'حزيران', 'تموز', 'آب', 'أيلول', 'تشرين الأول', 'تشرين الثاني', 'كانون الأول'], + 'months_short' => ['كانون الثاني', 'شباط', 'آذار', 'نيسان', 'أيار', 'حزيران', 'تموز', 'آب', 'أيلول', 'تشرين الأول', 'تشرين الثاني', 'كانون الأول'], + 'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], + 'weekdays_short' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_JO.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_JO.php new file mode 100644 index 00000000..2d420084 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_JO.php @@ -0,0 +1,29 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri + */ +return array_replace_recursive(require __DIR__.'/ar.php', [ + 'formats' => [ + 'L' => 'DD MMM, YYYY', + ], + 'months' => ['كانون الثاني', 'شباط', 'آذار', 'نيسان', 'أيار', 'حزيران', 'تموز', 'آب', 'أيلول', 'تشرين الأول', 'تشرين الثاني', 'كانون الأول'], + 'months_short' => ['كانون الثاني', 'شباط', 'آذار', 'نيسان', 'أيار', 'حزيران', 'تموز', 'آب', 'أيلول', 'تشرين الأول', 'تشرين الثاني', 'كانون الأول'], + 'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], + 'weekdays_short' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_KM.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_KM.php new file mode 100644 index 00000000..e790b99e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_KM.php @@ -0,0 +1,13 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ar.php', [ +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_KW.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_KW.php new file mode 100644 index 00000000..b3fb1cfe --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_KW.php @@ -0,0 +1,95 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * Authors: + * - Josh Soref + * - Nusret Parlak + * - JD Isaacks + * - Atef Ben Ali (atefBB) + * - Mohamed Sabil (mohamedsabil83) + * - Abdullah-Alhariri + */ +$months = [ + 'يناير', + 'فبراير', + 'مارس', + 'أبريل', + 'ماي', + 'يونيو', + 'يوليوز', + 'غشت', + 'شتنبر', + 'أكتوبر', + 'نونبر', + 'دجنبر', +]; + +return [ + 'year' => implode('|', ['{0}:count سنة', '{1}سنة', '{2}سنتين', ']2,11[:count سنوات', ']10,Inf[:count سنة']), + 'a_year' => implode('|', ['{0}:count سنة', '{1}سنة', '{2}سنتين', ']2,11[:count سنوات', ']10,Inf[:count سنة']), + 'month' => implode('|', ['{0}:count شهر', '{1}شهر', '{2}شهرين', ']2,11[:count أشهر', ']10,Inf[:count شهر']), + 'a_month' => implode('|', ['{0}:count شهر', '{1}شهر', '{2}شهرين', ']2,11[:count أشهر', ']10,Inf[:count شهر']), + 'week' => implode('|', ['{0}:count أسبوع', '{1}أسبوع', '{2}أسبوعين', ']2,11[:count أسابيع', ']10,Inf[:count أسبوع']), + 'a_week' => implode('|', ['{0}:count أسبوع', '{1}أسبوع', '{2}أسبوعين', ']2,11[:count أسابيع', ']10,Inf[:count أسبوع']), + 'day' => implode('|', ['{0}:count يوم', '{1}يوم', '{2}يومين', ']2,11[:count أيام', ']10,Inf[:count يوم']), + 'a_day' => implode('|', ['{0}:count يوم', '{1}يوم', '{2}يومين', ']2,11[:count أيام', ']10,Inf[:count يوم']), + 'hour' => implode('|', ['{0}:count ساعة', '{1}ساعة', '{2}ساعتين', ']2,11[:count ساعات', ']10,Inf[:count ساعة']), + 'a_hour' => implode('|', ['{0}:count ساعة', '{1}ساعة', '{2}ساعتين', ']2,11[:count ساعات', ']10,Inf[:count ساعة']), + 'minute' => implode('|', ['{0}:count دقيقة', '{1}دقيقة', '{2}دقيقتين', ']2,11[:count دقائق', ']10,Inf[:count دقيقة']), + 'a_minute' => implode('|', ['{0}:count دقيقة', '{1}دقيقة', '{2}دقيقتين', ']2,11[:count دقائق', ']10,Inf[:count دقيقة']), + 'second' => implode('|', ['{0}:count ثانية', '{1}ثانية', '{2}ثانيتين', ']2,11[:count ثواني', ']10,Inf[:count ثانية']), + 'a_second' => implode('|', ['{0}:count ثانية', '{1}ثانية', '{2}ثانيتين', ']2,11[:count ثواني', ']10,Inf[:count ثانية']), + 'ago' => 'منذ :time', + 'from_now' => 'في :time', + 'after' => 'بعد :time', + 'before' => 'قبل :time', + 'diff_now' => 'الآن', + 'diff_today' => 'اليوم', + 'diff_today_regexp' => 'اليوم(?:\\s+على)?(?:\\s+الساعة)?', + 'diff_yesterday' => 'أمس', + 'diff_yesterday_regexp' => 'أمس(?:\\s+على)?(?:\\s+الساعة)?', + 'diff_tomorrow' => 'غداً', + 'diff_tomorrow_regexp' => 'غدا(?:\\s+على)?(?:\\s+الساعة)?', + 'diff_before_yesterday' => 'قبل الأمس', + 'diff_after_tomorrow' => 'بعد غد', + 'period_recurrences' => implode('|', ['{0}مرة', '{1}مرة', '{2}:count مرتين', ']2,11[:count مرات', ']10,Inf[:count مرة']), + 'period_interval' => 'كل :interval', + 'period_start_date' => 'من :date', + 'period_end_date' => 'إلى :date', + 'months' => $months, + 'months_short' => $months, + 'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], + 'weekdays_short' => ['أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'], + 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'list' => ['، ', ' و '], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[اليوم على الساعة] LT', + 'nextDay' => '[غدا على الساعة] LT', + 'nextWeek' => 'dddd [على الساعة] LT', + 'lastDay' => '[أمس على الساعة] LT', + 'lastWeek' => 'dddd [على الساعة] LT', + 'sameElse' => 'L', + ], + 'meridiem' => ['ص', 'م'], + 'weekend' => [5, 6], + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_LB.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_LB.php new file mode 100644 index 00000000..2792745c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_LB.php @@ -0,0 +1,29 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri + */ +return array_replace_recursive(require __DIR__.'/ar.php', [ + 'formats' => [ + 'L' => 'DD MMM, YYYY', + ], + 'months' => ['كانون الثاني', 'شباط', 'آذار', 'نيسان', 'أيار', 'حزيران', 'تموز', 'آب', 'أيلول', 'تشرين الأول', 'تشرين الثاني', 'كانون الأول'], + 'months_short' => ['كانون الثاني', 'شباط', 'آذار', 'نيسان', 'أيار', 'حزيران', 'تموز', 'آب', 'أيلول', 'تشرين الأول', 'تشرين الثاني', 'كانون الأول'], + 'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], + 'weekdays_short' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_LY.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_LY.php new file mode 100644 index 00000000..1f0af49d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_LY.php @@ -0,0 +1,92 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Atef Ben Ali (atefBB) + * - Ibrahim AshShohail + * - MLTDev + */ + +$months = [ + 'يناير', + 'فبراير', + 'مارس', + 'أبريل', + 'مايو', + 'يونيو', + 'يوليو', + 'أغسطس', + 'سبتمبر', + 'أكتوبر', + 'نوفمبر', + 'ديسمبر', +]; + +return [ + 'year' => implode('|', [':count سنة', 'سنة', 'سنتين', ':count سنوات', ':count سنة']), + 'a_year' => implode('|', [':count سنة', 'سنة', 'سنتين', ':count سنوات', ':count سنة']), + 'month' => implode('|', [':count شهر', 'شهر', 'شهرين', ':count أشهر', ':count شهر']), + 'a_month' => implode('|', [':count شهر', 'شهر', 'شهرين', ':count أشهر', ':count شهر']), + 'week' => implode('|', [':count أسبوع', 'أسبوع', 'أسبوعين', ':count أسابيع', ':count أسبوع']), + 'a_week' => implode('|', [':count أسبوع', 'أسبوع', 'أسبوعين', ':count أسابيع', ':count أسبوع']), + 'day' => implode('|', [':count يوم', 'يوم', 'يومين', ':count أيام', ':count يوم']), + 'a_day' => implode('|', [':count يوم', 'يوم', 'يومين', ':count أيام', ':count يوم']), + 'hour' => implode('|', [':count ساعة', 'ساعة', 'ساعتين', ':count ساعات', ':count ساعة']), + 'a_hour' => implode('|', [':count ساعة', 'ساعة', 'ساعتين', ':count ساعات', ':count ساعة']), + 'minute' => implode('|', [':count دقيقة', 'دقيقة', 'دقيقتين', ':count دقائق', ':count دقيقة']), + 'a_minute' => implode('|', [':count دقيقة', 'دقيقة', 'دقيقتين', ':count دقائق', ':count دقيقة']), + 'second' => implode('|', [':count ثانية', 'ثانية', 'ثانيتين', ':count ثواني', ':count ثانية']), + 'a_second' => implode('|', [':count ثانية', 'ثانية', 'ثانيتين', ':count ثواني', ':count ثانية']), + 'ago' => 'منذ :time', + 'from_now' => ':time من الآن', + 'after' => 'بعد :time', + 'before' => 'قبل :time', + 'diff_now' => 'الآن', + 'diff_today' => 'اليوم', + 'diff_today_regexp' => 'اليوم(?:\\s+عند)?(?:\\s+الساعة)?', + 'diff_yesterday' => 'أمس', + 'diff_yesterday_regexp' => 'أمس(?:\\s+عند)?(?:\\s+الساعة)?', + 'diff_tomorrow' => 'غداً', + 'diff_tomorrow_regexp' => 'غدًا(?:\\s+عند)?(?:\\s+الساعة)?', + 'diff_before_yesterday' => 'قبل الأمس', + 'diff_after_tomorrow' => 'بعد غد', + 'period_recurrences' => implode('|', ['مرة', 'مرة', ':count مرتين', ':count مرات', ':count مرة']), + 'period_interval' => 'كل :interval', + 'period_start_date' => 'من :date', + 'period_end_date' => 'إلى :date', + 'months' => $months, + 'months_short' => $months, + 'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], + 'weekdays_short' => ['أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'], + 'weekdays_min' => ['ح', 'اث', 'ثل', 'أر', 'خم', 'ج', 'س'], + 'list' => ['، ', ' و '], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[اليوم عند الساعة] LT', + 'nextDay' => '[غدًا عند الساعة] LT', + 'nextWeek' => 'dddd [عند الساعة] LT', + 'lastDay' => '[أمس عند الساعة] LT', + 'lastWeek' => 'dddd [عند الساعة] LT', + 'sameElse' => 'L', + ], + 'meridiem' => ['ص', 'م'], + 'weekend' => [5, 6], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_MA.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_MA.php new file mode 100644 index 00000000..047ae05a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_MA.php @@ -0,0 +1,92 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * Authors: + * - Josh Soref + * - JD Isaacks + * - Atef Ben Ali (atefBB) + * - Mohamed Sabil (mohamedsabil83) + */ +$months = [ + 'يناير', + 'فبراير', + 'مارس', + 'أبريل', + 'ماي', + 'يونيو', + 'يوليوز', + 'غشت', + 'شتنبر', + 'أكتوبر', + 'نونبر', + 'دجنبر', +]; + +return [ + 'year' => implode('|', ['{0}:count سنة', '{1}سنة', '{2}سنتين', ']2,11[:count سنوات', ']10,Inf[:count سنة']), + 'a_year' => implode('|', ['{0}:count سنة', '{1}سنة', '{2}سنتين', ']2,11[:count سنوات', ']10,Inf[:count سنة']), + 'month' => implode('|', ['{0}:count شهر', '{1}شهر', '{2}شهرين', ']2,11[:count أشهر', ']10,Inf[:count شهر']), + 'a_month' => implode('|', ['{0}:count شهر', '{1}شهر', '{2}شهرين', ']2,11[:count أشهر', ']10,Inf[:count شهر']), + 'week' => implode('|', ['{0}:count أسبوع', '{1}أسبوع', '{2}أسبوعين', ']2,11[:count أسابيع', ']10,Inf[:count أسبوع']), + 'a_week' => implode('|', ['{0}:count أسبوع', '{1}أسبوع', '{2}أسبوعين', ']2,11[:count أسابيع', ']10,Inf[:count أسبوع']), + 'day' => implode('|', ['{0}:count يوم', '{1}يوم', '{2}يومين', ']2,11[:count أيام', ']10,Inf[:count يوم']), + 'a_day' => implode('|', ['{0}:count يوم', '{1}يوم', '{2}يومين', ']2,11[:count أيام', ']10,Inf[:count يوم']), + 'hour' => implode('|', ['{0}:count ساعة', '{1}ساعة', '{2}ساعتين', ']2,11[:count ساعات', ']10,Inf[:count ساعة']), + 'a_hour' => implode('|', ['{0}:count ساعة', '{1}ساعة', '{2}ساعتين', ']2,11[:count ساعات', ']10,Inf[:count ساعة']), + 'minute' => implode('|', ['{0}:count دقيقة', '{1}دقيقة', '{2}دقيقتين', ']2,11[:count دقائق', ']10,Inf[:count دقيقة']), + 'a_minute' => implode('|', ['{0}:count دقيقة', '{1}دقيقة', '{2}دقيقتين', ']2,11[:count دقائق', ']10,Inf[:count دقيقة']), + 'second' => implode('|', ['{0}:count ثانية', '{1}ثانية', '{2}ثانيتين', ']2,11[:count ثواني', ']10,Inf[:count ثانية']), + 'a_second' => implode('|', ['{0}:count ثانية', '{1}ثانية', '{2}ثانيتين', ']2,11[:count ثواني', ']10,Inf[:count ثانية']), + 'ago' => 'منذ :time', + 'from_now' => 'في :time', + 'after' => 'بعد :time', + 'before' => 'قبل :time', + 'diff_now' => 'الآن', + 'diff_today' => 'اليوم', + 'diff_today_regexp' => 'اليوم(?:\\s+على)?(?:\\s+الساعة)?', + 'diff_yesterday' => 'أمس', + 'diff_yesterday_regexp' => 'أمس(?:\\s+على)?(?:\\s+الساعة)?', + 'diff_tomorrow' => 'غداً', + 'diff_tomorrow_regexp' => 'غدا(?:\\s+على)?(?:\\s+الساعة)?', + 'diff_before_yesterday' => 'قبل الأمس', + 'diff_after_tomorrow' => 'بعد غد', + 'period_recurrences' => implode('|', ['{0}مرة', '{1}مرة', '{2}:count مرتين', ']2,11[:count مرات', ']10,Inf[:count مرة']), + 'period_interval' => 'كل :interval', + 'period_start_date' => 'من :date', + 'period_end_date' => 'إلى :date', + 'months' => $months, + 'months_short' => $months, + 'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], + 'weekdays_short' => ['أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'], + 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'list' => ['، ', ' و '], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[اليوم على الساعة] LT', + 'nextDay' => '[غدا على الساعة] LT', + 'nextWeek' => 'dddd [على الساعة] LT', + 'lastDay' => '[أمس على الساعة] LT', + 'lastWeek' => 'dddd [على الساعة] LT', + 'sameElse' => 'L', + ], + 'meridiem' => ['ص', 'م'], + 'weekend' => [5, 6], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_MR.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_MR.php new file mode 100644 index 00000000..e790b99e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_MR.php @@ -0,0 +1,13 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ar.php', [ +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_OM.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_OM.php new file mode 100644 index 00000000..35180965 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_OM.php @@ -0,0 +1,29 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri + */ +return array_replace_recursive(require __DIR__.'/ar.php', [ + 'formats' => [ + 'L' => 'DD MMM, YYYY', + ], + 'months' => ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر'], + 'months_short' => ['ينا', 'فبر', 'مار', 'أبر', 'ماي', 'يون', 'يول', 'أغس', 'سبت', 'أكت', 'نوف', 'ديس'], + 'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], + 'weekdays_short' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_PS.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_PS.php new file mode 100644 index 00000000..503c60d2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_PS.php @@ -0,0 +1,18 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Abdullah-Alhariri + */ +return array_replace_recursive(require __DIR__.'/ar.php', [ + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_QA.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_QA.php new file mode 100644 index 00000000..35180965 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_QA.php @@ -0,0 +1,29 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri + */ +return array_replace_recursive(require __DIR__.'/ar.php', [ + 'formats' => [ + 'L' => 'DD MMM, YYYY', + ], + 'months' => ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر'], + 'months_short' => ['ينا', 'فبر', 'مار', 'أبر', 'ماي', 'يون', 'يول', 'أغس', 'سبت', 'أكت', 'نوف', 'ديس'], + 'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], + 'weekdays_short' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_SA.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_SA.php new file mode 100644 index 00000000..550b0c73 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_SA.php @@ -0,0 +1,94 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * Authors: + * - Josh Soref + * - JD Isaacks + * - Atef Ben Ali (atefBB) + * - Mohamed Sabil (mohamedsabil83) + * - Abdullah-Alhariri + */ +$months = [ + 'يناير', + 'فبراير', + 'مارس', + 'أبريل', + 'مايو', + 'يونيو', + 'يوليو', + 'أغسطس', + 'سبتمبر', + 'أكتوبر', + 'نوفمبر', + 'ديسمبر', +]; + +return [ + 'year' => implode('|', ['{0}:count سنة', '{1}سنة', '{2}سنتين', ']2,11[:count سنوات', ']10,Inf[:count سنة']), + 'a_year' => implode('|', ['{0}:count سنة', '{1}سنة', '{2}سنتين', ']2,11[:count سنوات', ']10,Inf[:count سنة']), + 'month' => implode('|', ['{0}:count شهر', '{1}شهر', '{2}شهرين', ']2,11[:count أشهر', ']10,Inf[:count شهر']), + 'a_month' => implode('|', ['{0}:count شهر', '{1}شهر', '{2}شهرين', ']2,11[:count أشهر', ']10,Inf[:count شهر']), + 'week' => implode('|', ['{0}:count أسبوع', '{1}أسبوع', '{2}أسبوعين', ']2,11[:count أسابيع', ']10,Inf[:count أسبوع']), + 'a_week' => implode('|', ['{0}:count أسبوع', '{1}أسبوع', '{2}أسبوعين', ']2,11[:count أسابيع', ']10,Inf[:count أسبوع']), + 'day' => implode('|', ['{0}:count يوم', '{1}يوم', '{2}يومين', ']2,11[:count أيام', ']10,Inf[:count يوم']), + 'a_day' => implode('|', ['{0}:count يوم', '{1}يوم', '{2}يومين', ']2,11[:count أيام', ']10,Inf[:count يوم']), + 'hour' => implode('|', ['{0}:count ساعة', '{1}ساعة', '{2}ساعتين', ']2,11[:count ساعات', ']10,Inf[:count ساعة']), + 'a_hour' => implode('|', ['{0}:count ساعة', '{1}ساعة', '{2}ساعتين', ']2,11[:count ساعات', ']10,Inf[:count ساعة']), + 'minute' => implode('|', ['{0}:count دقيقة', '{1}دقيقة', '{2}دقيقتين', ']2,11[:count دقائق', ']10,Inf[:count دقيقة']), + 'a_minute' => implode('|', ['{0}:count دقيقة', '{1}دقيقة', '{2}دقيقتين', ']2,11[:count دقائق', ']10,Inf[:count دقيقة']), + 'second' => implode('|', ['{0}:count ثانية', '{1}ثانية', '{2}ثانيتين', ']2,11[:count ثواني', ']10,Inf[:count ثانية']), + 'a_second' => implode('|', ['{0}:count ثانية', '{1}ثانية', '{2}ثانيتين', ']2,11[:count ثواني', ']10,Inf[:count ثانية']), + 'ago' => 'منذ :time', + 'from_now' => 'في :time', + 'after' => 'بعد :time', + 'before' => 'قبل :time', + 'diff_now' => 'الآن', + 'diff_today' => 'اليوم', + 'diff_today_regexp' => 'اليوم(?:\\s+على)?(?:\\s+الساعة)?', + 'diff_yesterday' => 'أمس', + 'diff_yesterday_regexp' => 'أمس(?:\\s+على)?(?:\\s+الساعة)?', + 'diff_tomorrow' => 'غداً', + 'diff_tomorrow_regexp' => 'غدا(?:\\s+على)?(?:\\s+الساعة)?', + 'diff_before_yesterday' => 'قبل الأمس', + 'diff_after_tomorrow' => 'بعد غد', + 'period_recurrences' => implode('|', ['{0}مرة', '{1}مرة', '{2}:count مرتين', ']2,11[:count مرات', ']10,Inf[:count مرة']), + 'period_interval' => 'كل :interval', + 'period_start_date' => 'من :date', + 'period_end_date' => 'إلى :date', + 'months' => $months, + 'months_short' => $months, + 'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], + 'weekdays_short' => ['أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'], + 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'list' => ['، ', ' و '], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[اليوم على الساعة] LT', + 'nextDay' => '[غدا على الساعة] LT', + 'nextWeek' => 'dddd [على الساعة] LT', + 'lastDay' => '[أمس على الساعة] LT', + 'lastWeek' => 'dddd [على الساعة] LT', + 'sameElse' => 'L', + ], + 'meridiem' => ['ص', 'م'], + 'weekend' => [5, 6], + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_SD.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_SD.php new file mode 100644 index 00000000..35180965 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_SD.php @@ -0,0 +1,29 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri + */ +return array_replace_recursive(require __DIR__.'/ar.php', [ + 'formats' => [ + 'L' => 'DD MMM, YYYY', + ], + 'months' => ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر'], + 'months_short' => ['ينا', 'فبر', 'مار', 'أبر', 'ماي', 'يون', 'يول', 'أغس', 'سبت', 'أكت', 'نوف', 'ديس'], + 'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], + 'weekdays_short' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_SO.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_SO.php new file mode 100644 index 00000000..e790b99e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_SO.php @@ -0,0 +1,13 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ar.php', [ +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_SS.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_SS.php new file mode 100644 index 00000000..32f32825 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_SS.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/ar.php', [ + 'formats' => [ + 'L' => 'DD MMM, YYYY', + ], + 'months' => ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر'], + 'months_short' => ['ينا', 'فبر', 'مار', 'أبر', 'ماي', 'يون', 'يول', 'أغس', 'سبت', 'أكت', 'نوف', 'ديس'], + 'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], + 'weekdays_short' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_SY.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_SY.php new file mode 100644 index 00000000..2d420084 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_SY.php @@ -0,0 +1,29 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri + */ +return array_replace_recursive(require __DIR__.'/ar.php', [ + 'formats' => [ + 'L' => 'DD MMM, YYYY', + ], + 'months' => ['كانون الثاني', 'شباط', 'آذار', 'نيسان', 'أيار', 'حزيران', 'تموز', 'آب', 'أيلول', 'تشرين الأول', 'تشرين الثاني', 'كانون الأول'], + 'months_short' => ['كانون الثاني', 'شباط', 'آذار', 'نيسان', 'أيار', 'حزيران', 'تموز', 'آب', 'أيلول', 'تشرين الأول', 'تشرين الثاني', 'كانون الأول'], + 'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], + 'weekdays_short' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_Shakl.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_Shakl.php new file mode 100644 index 00000000..c2d4b43d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_Shakl.php @@ -0,0 +1,95 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Abdellah Chadidi + * - Atef Ben Ali (atefBB) + * - Mohamed Sabil (mohamedsabil83) + */ +// Same for long and short +$months = [ + // @TODO add shakl to months + 'يناير', + 'فبراير', + 'مارس', + 'أبريل', + 'مايو', + 'يونيو', + 'يوليو', + 'أغسطس', + 'سبتمبر', + 'أكتوبر', + 'نوفمبر', + 'ديسمبر', +]; + +return [ + 'year' => implode('|', ['{0}:count سَنَة', '{1}سَنَة', '{2}سَنَتَيْن', ']2,11[:count سَنَوَات', ']10,Inf[:count سَنَة']), + 'a_year' => implode('|', ['{0}:count سَنَة', '{1}سَنَة', '{2}سَنَتَيْن', ']2,11[:count سَنَوَات', ']10,Inf[:count سَنَة']), + 'month' => implode('|', ['{0}:count شَهْرَ', '{1}شَهْرَ', '{2}شَهْرَيْن', ']2,11[:count أَشْهُر', ']10,Inf[:count شَهْرَ']), + 'a_month' => implode('|', ['{0}:count شَهْرَ', '{1}شَهْرَ', '{2}شَهْرَيْن', ']2,11[:count أَشْهُر', ']10,Inf[:count شَهْرَ']), + 'week' => implode('|', ['{0}:count أُسْبُوع', '{1}أُسْبُوع', '{2}أُسْبُوعَيْن', ']2,11[:count أَسَابِيع', ']10,Inf[:count أُسْبُوع']), + 'a_week' => implode('|', ['{0}:count أُسْبُوع', '{1}أُسْبُوع', '{2}أُسْبُوعَيْن', ']2,11[:count أَسَابِيع', ']10,Inf[:count أُسْبُوع']), + 'day' => implode('|', ['{0}:count يَوْم', '{1}يَوْم', '{2}يَوْمَيْن', ']2,11[:count أَيَّام', ']10,Inf[:count يَوْم']), + 'a_day' => implode('|', ['{0}:count يَوْم', '{1}يَوْم', '{2}يَوْمَيْن', ']2,11[:count أَيَّام', ']10,Inf[:count يَوْم']), + 'hour' => implode('|', ['{0}:count سَاعَة', '{1}سَاعَة', '{2}سَاعَتَيْن', ']2,11[:count سَاعَات', ']10,Inf[:count سَاعَة']), + 'a_hour' => implode('|', ['{0}:count سَاعَة', '{1}سَاعَة', '{2}سَاعَتَيْن', ']2,11[:count سَاعَات', ']10,Inf[:count سَاعَة']), + 'minute' => implode('|', ['{0}:count دَقِيقَة', '{1}دَقِيقَة', '{2}دَقِيقَتَيْن', ']2,11[:count دَقَائِق', ']10,Inf[:count دَقِيقَة']), + 'a_minute' => implode('|', ['{0}:count دَقِيقَة', '{1}دَقِيقَة', '{2}دَقِيقَتَيْن', ']2,11[:count دَقَائِق', ']10,Inf[:count دَقِيقَة']), + 'second' => implode('|', ['{0}:count ثَانِيَة', '{1}ثَانِيَة', '{2}ثَانِيَتَيْن', ']2,11[:count ثَوَان', ']10,Inf[:count ثَانِيَة']), + 'a_second' => implode('|', ['{0}:count ثَانِيَة', '{1}ثَانِيَة', '{2}ثَانِيَتَيْن', ']2,11[:count ثَوَان', ']10,Inf[:count ثَانِيَة']), + 'ago' => 'مُنْذُ :time', + 'from_now' => 'مِنَ الْآن :time', + 'after' => 'بَعْدَ :time', + 'before' => 'قَبْلَ :time', + + // @TODO add shakl to translations below + 'diff_now' => 'الآن', + 'diff_today' => 'اليوم', + 'diff_today_regexp' => 'اليوم(?:\\s+عند)?(?:\\s+الساعة)?', + 'diff_yesterday' => 'أمس', + 'diff_yesterday_regexp' => 'أمس(?:\\s+عند)?(?:\\s+الساعة)?', + 'diff_tomorrow' => 'غداً', + 'diff_tomorrow_regexp' => 'غدًا(?:\\s+عند)?(?:\\s+الساعة)?', + 'diff_before_yesterday' => 'قبل الأمس', + 'diff_after_tomorrow' => 'بعد غد', + 'period_recurrences' => implode('|', ['{0}مرة', '{1}مرة', '{2}:count مرتين', ']2,11[:count مرات', ']10,Inf[:count مرة']), + 'period_interval' => 'كل :interval', + 'period_start_date' => 'من :date', + 'period_end_date' => 'إلى :date', + 'months' => $months, + 'months_short' => $months, + 'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], + 'weekdays_short' => ['أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'], + 'weekdays_min' => ['ح', 'اث', 'ثل', 'أر', 'خم', 'ج', 'س'], + 'list' => ['، ', ' و '], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[اليوم عند الساعة] LT', + 'nextDay' => '[غدًا عند الساعة] LT', + 'nextWeek' => 'dddd [عند الساعة] LT', + 'lastDay' => '[أمس عند الساعة] LT', + 'lastWeek' => 'dddd [عند الساعة] LT', + 'sameElse' => 'L', + ], + 'meridiem' => ['ص', 'م'], + 'weekend' => [5, 6], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_TD.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_TD.php new file mode 100644 index 00000000..e790b99e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_TD.php @@ -0,0 +1,13 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ar.php', [ +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_TN.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_TN.php new file mode 100644 index 00000000..f096678f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_TN.php @@ -0,0 +1,91 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * Authors: + * - JD Isaacks + * - Atef Ben Ali (atefBB) + * - Mohamed Sabil (mohamedsabil83) + */ +$months = [ + 'جانفي', + 'فيفري', + 'مارس', + 'أفريل', + 'ماي', + 'جوان', + 'جويلية', + 'أوت', + 'سبتمبر', + 'أكتوبر', + 'نوفمبر', + 'ديسمبر', +]; + +return [ + 'year' => implode('|', ['{0}:count سنة', '{1}سنة', '{2}سنتين', ']2,11[:count سنوات', ']10,Inf[:count سنة']), + 'a_year' => implode('|', ['{0}:count سنة', '{1}سنة', '{2}سنتين', ']2,11[:count سنوات', ']10,Inf[:count سنة']), + 'month' => implode('|', ['{0}:count شهر', '{1}شهر', '{2}شهرين', ']2,11[:count أشهر', ']10,Inf[:count شهر']), + 'a_month' => implode('|', ['{0}:count شهر', '{1}شهر', '{2}شهرين', ']2,11[:count أشهر', ']10,Inf[:count شهر']), + 'week' => implode('|', ['{0}:count أسبوع', '{1}أسبوع', '{2}أسبوعين', ']2,11[:count أسابيع', ']10,Inf[:count أسبوع']), + 'a_week' => implode('|', ['{0}:count أسبوع', '{1}أسبوع', '{2}أسبوعين', ']2,11[:count أسابيع', ']10,Inf[:count أسبوع']), + 'day' => implode('|', ['{0}:count يوم', '{1}يوم', '{2}يومين', ']2,11[:count أيام', ']10,Inf[:count يوم']), + 'a_day' => implode('|', ['{0}:count يوم', '{1}يوم', '{2}يومين', ']2,11[:count أيام', ']10,Inf[:count يوم']), + 'hour' => implode('|', ['{0}:count ساعة', '{1}ساعة', '{2}ساعتين', ']2,11[:count ساعات', ']10,Inf[:count ساعة']), + 'a_hour' => implode('|', ['{0}:count ساعة', '{1}ساعة', '{2}ساعتين', ']2,11[:count ساعات', ']10,Inf[:count ساعة']), + 'minute' => implode('|', ['{0}:count دقيقة', '{1}دقيقة', '{2}دقيقتين', ']2,11[:count دقائق', ']10,Inf[:count دقيقة']), + 'a_minute' => implode('|', ['{0}:count دقيقة', '{1}دقيقة', '{2}دقيقتين', ']2,11[:count دقائق', ']10,Inf[:count دقيقة']), + 'second' => implode('|', ['{0}:count ثانية', '{1}ثانية', '{2}ثانيتين', ']2,11[:count ثواني', ']10,Inf[:count ثانية']), + 'a_second' => implode('|', ['{0}:count ثانية', '{1}ثانية', '{2}ثانيتين', ']2,11[:count ثواني', ']10,Inf[:count ثانية']), + 'ago' => 'منذ :time', + 'from_now' => 'في :time', + 'after' => 'بعد :time', + 'before' => 'قبل :time', + 'diff_now' => 'الآن', + 'diff_today' => 'اليوم', + 'diff_today_regexp' => 'اليوم(?:\\s+على)?(?:\\s+الساعة)?', + 'diff_yesterday' => 'أمس', + 'diff_yesterday_regexp' => 'أمس(?:\\s+على)?(?:\\s+الساعة)?', + 'diff_tomorrow' => 'غداً', + 'diff_tomorrow_regexp' => 'غدا(?:\\s+على)?(?:\\s+الساعة)?', + 'diff_before_yesterday' => 'قبل الأمس', + 'diff_after_tomorrow' => 'بعد غد', + 'period_recurrences' => implode('|', ['{0}مرة', '{1}مرة', '{2}:count مرتين', ']2,11[:count مرات', ']10,Inf[:count مرة']), + 'period_interval' => 'كل :interval', + 'period_start_date' => 'من :date', + 'period_end_date' => 'إلى :date', + 'months' => $months, + 'months_short' => $months, + 'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], + 'weekdays_short' => ['أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'], + 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'list' => ['، ', ' و '], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[اليوم على الساعة] LT', + 'nextDay' => '[غدا على الساعة] LT', + 'nextWeek' => 'dddd [على الساعة] LT', + 'lastDay' => '[أمس على الساعة] LT', + 'lastWeek' => 'dddd [على الساعة] LT', + 'sameElse' => 'L', + ], + 'meridiem' => ['ص', 'م'], + 'weekend' => [5, 6], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_YE.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_YE.php new file mode 100644 index 00000000..169fe88a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_YE.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri + */ +return array_replace_recursive(require __DIR__.'/ar.php', [ + 'formats' => [ + 'L' => 'DD MMM, YYYY', + ], + 'months' => ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر'], + 'months_short' => ['ينا', 'فبر', 'مار', 'أبر', 'ماي', 'يون', 'يول', 'أغس', 'سبت', 'أكت', 'نوف', 'ديس'], + 'weekdays' => ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], + 'weekdays_short' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], + 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/as.php b/vendor/nesbot/carbon/src/Carbon/Lang/as.php new file mode 100644 index 00000000..04bc3dfd --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/as.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/as_IN.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/as_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/as_IN.php new file mode 100644 index 00000000..5fbc3dba --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/as_IN.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Amitakhya Phukan, Red Hat bug-glibc@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'D-MM-YYYY', + ], + 'months' => ['জানুৱাৰী', 'ফেব্ৰুৱাৰী', 'মাৰ্চ', 'এপ্ৰিল', 'মে', 'জুন', 'জুলাই', 'আগষ্ট', 'ছেপ্তেম্বৰ', 'অক্টোবৰ', 'নৱেম্বৰ', 'ডিচেম্বৰ'], + 'months_short' => ['জানু', 'ফেব্ৰু', 'মাৰ্চ', 'এপ্ৰিল', 'মে', 'জুন', 'জুলাই', 'আগ', 'সেপ্ট', 'অক্টো', 'নভে', 'ডিসে'], + 'weekdays' => ['দেওবাৰ', 'সোমবাৰ', 'মঙ্গলবাৰ', 'বুধবাৰ', 'বৃহষ্পতিবাৰ', 'শুক্ৰবাৰ', 'শনিবাৰ'], + 'weekdays_short' => ['দেও', 'সোম', 'মঙ্গল', 'বুধ', 'বৃহষ্পতি', 'শুক্ৰ', 'শনি'], + 'weekdays_min' => ['দেও', 'সোম', 'মঙ্গল', 'বুধ', 'বৃহষ্পতি', 'শুক্ৰ', 'শনি'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['পূৰ্ব্বাহ্ন', 'অপৰাহ্ন'], + + 'year' => ':count বছৰ', + 'y' => ':count বছৰ', + 'a_year' => ':count বছৰ', + + 'month' => ':count মাহ', + 'm' => ':count মাহ', + 'a_month' => ':count মাহ', + + 'week' => ':count সপ্তাহ', + 'w' => ':count সপ্তাহ', + 'a_week' => ':count সপ্তাহ', + + 'day' => ':count বাৰ', + 'd' => ':count বাৰ', + 'a_day' => ':count বাৰ', + + 'hour' => ':count ঘণ্টা', + 'h' => ':count ঘণ্টা', + 'a_hour' => ':count ঘণ্টা', + + 'minute' => ':count মিনিট', + 'min' => ':count মিনিট', + 'a_minute' => ':count মিনিট', + + 'second' => ':count দ্বিতীয়', + 's' => ':count দ্বিতীয়', + 'a_second' => ':count দ্বিতীয়', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/asa.php b/vendor/nesbot/carbon/src/Carbon/Lang/asa.php new file mode 100644 index 00000000..03bb4839 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/asa.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['icheheavo', 'ichamthi'], + 'weekdays' => ['Jumapili', 'Jumatatu', 'Jumanne', 'Jumatano', 'Alhamisi', 'Ijumaa', 'Jumamosi'], + 'weekdays_short' => ['Jpi', 'Jtt', 'Jnn', 'Jtn', 'Alh', 'Ijm', 'Jmo'], + 'weekdays_min' => ['Jpi', 'Jtt', 'Jnn', 'Jtn', 'Alh', 'Ijm', 'Jmo'], + 'months' => ['Januari', 'Februari', 'Machi', 'Aprili', 'Mei', 'Juni', 'Julai', 'Agosti', 'Septemba', 'Oktoba', 'Novemba', 'Desemba'], + 'months_short' => ['Jan', 'Feb', 'Mac', 'Apr', 'Mei', 'Jun', 'Jul', 'Ago', 'Sep', 'Okt', 'Nov', 'Dec'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ast.php b/vendor/nesbot/carbon/src/Carbon/Lang/ast.php new file mode 100644 index 00000000..d9bdebe5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ast.php @@ -0,0 +1,59 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Jordi Mallach jordi@gnu.org + * - Adolfo Jayme-Barrientos (fitojb) + */ +return array_replace_recursive(require __DIR__.'/es.php', [ + 'formats' => [ + 'L' => 'DD/MM/YY', + ], + 'months' => ['de xineru', 'de febreru', 'de marzu', 'd’abril', 'de mayu', 'de xunu', 'de xunetu', 'd’agostu', 'de setiembre', 'd’ochobre', 'de payares', 'd’avientu'], + 'months_short' => ['xin', 'feb', 'mar', 'abr', 'may', 'xun', 'xnt', 'ago', 'set', 'och', 'pay', 'avi'], + 'weekdays' => ['domingu', 'llunes', 'martes', 'miércoles', 'xueves', 'vienres', 'sábadu'], + 'weekdays_short' => ['dom', 'llu', 'mar', 'mié', 'xue', 'vie', 'sáb'], + 'weekdays_min' => ['dom', 'llu', 'mar', 'mié', 'xue', 'vie', 'sáb'], + + 'year' => ':count añu|:count años', + 'y' => ':count añu|:count años', + 'a_year' => 'un añu|:count años', + + 'month' => ':count mes', + 'm' => ':count mes', + 'a_month' => 'un mes|:count mes', + + 'week' => ':count selmana|:count selmanes', + 'w' => ':count selmana|:count selmanes', + 'a_week' => 'una selmana|:count selmanes', + + 'day' => ':count día|:count díes', + 'd' => ':count día|:count díes', + 'a_day' => 'un día|:count díes', + + 'hour' => ':count hora|:count hores', + 'h' => ':count hora|:count hores', + 'a_hour' => 'una hora|:count hores', + + 'minute' => ':count minutu|:count minutos', + 'min' => ':count minutu|:count minutos', + 'a_minute' => 'un minutu|:count minutos', + + 'second' => ':count segundu|:count segundos', + 's' => ':count segundu|:count segundos', + 'a_second' => 'un segundu|:count segundos', + + 'ago' => 'hai :time', + 'from_now' => 'en :time', + 'after' => ':time dempués', + 'before' => ':time enantes', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ast_ES.php b/vendor/nesbot/carbon/src/Carbon/Lang/ast_ES.php new file mode 100644 index 00000000..04d75621 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ast_ES.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/ast.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ayc.php b/vendor/nesbot/carbon/src/Carbon/Lang/ayc.php new file mode 100644 index 00000000..d6a6f638 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ayc.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/ayc_PE.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ayc_PE.php b/vendor/nesbot/carbon/src/Carbon/Lang/ayc_PE.php new file mode 100644 index 00000000..ff18504f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ayc_PE.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - runasimipi.org libc-alpha@sourceware.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YY', + ], + 'months' => ['inïru', 'phiwriru', 'marsu', 'awrila', 'mayu', 'junyu', 'julyu', 'awustu', 'sitimri', 'uktuwri', 'nuwimri', 'risimri'], + 'months_short' => ['ini', 'phi', 'mar', 'awr', 'may', 'jun', 'jul', 'awu', 'sit', 'ukt', 'nuw', 'ris'], + 'weekdays' => ['tuminku', 'lunisa', 'martisa', 'mirkulisa', 'juywisa', 'wirnisa', 'sawäru'], + 'weekdays_short' => ['tum', 'lun', 'mar', 'mir', 'juy', 'wir', 'saw'], + 'weekdays_min' => ['tum', 'lun', 'mar', 'mir', 'juy', 'wir', 'saw'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['VM', 'NM'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/az.php b/vendor/nesbot/carbon/src/Carbon/Lang/az.php new file mode 100644 index 00000000..1e92106d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/az.php @@ -0,0 +1,128 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - Kunal Marwaha + * - François B + * - JD Isaacks + * - Orxan + * - Şəhriyar İmanov + * - Baran Şengül + */ +return [ + 'year' => ':count il', + 'a_year' => '{1}bir il|]1,Inf[:count il', + 'y' => ':count il', + 'month' => ':count ay', + 'a_month' => '{1}bir ay|]1,Inf[:count ay', + 'm' => ':count ay', + 'week' => ':count həftə', + 'a_week' => '{1}bir həftə|]1,Inf[:count həftə', + 'w' => ':count h.', + 'day' => ':count gün', + 'a_day' => '{1}bir gün|]1,Inf[:count gün', + 'd' => ':count g.', + 'hour' => ':count saat', + 'a_hour' => '{1}bir saat|]1,Inf[:count saat', + 'h' => ':count saat', + 'minute' => ':count d.', + 'a_minute' => '{1}bir dəqiqə|]1,Inf[:count dəqiqə', + 'min' => ':count dəqiqə', + 'second' => ':count san.', + 'a_second' => '{1}birneçə saniyə|]1,Inf[:count saniyə', + 's' => ':count saniyə', + 'ago' => ':time əvvəl', + 'from_now' => ':time sonra', + 'after' => ':time sonra', + 'before' => ':time əvvəl', + 'diff_now' => 'indi', + 'diff_today' => 'bugün', + 'diff_today_regexp' => 'bugün(?:\\s+saat)?', + 'diff_yesterday' => 'dünən', + 'diff_tomorrow' => 'sabah', + 'diff_tomorrow_regexp' => 'sabah(?:\\s+saat)?', + 'diff_before_yesterday' => 'srağagün', + 'diff_after_tomorrow' => 'birisi gün', + 'period_recurrences' => ':count dəfədən bir', + 'period_interval' => 'hər :interval', + 'period_start_date' => ':date tarixindən başlayaraq', + 'period_end_date' => ':date tarixinədək', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[bugün saat] LT', + 'nextDay' => '[sabah saat] LT', + 'nextWeek' => '[gələn həftə] dddd [saat] LT', + 'lastDay' => '[dünən] LT', + 'lastWeek' => '[keçən həftə] dddd [saat] LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + if ($number === 0) { // special case for zero + return "$number-ıncı"; + } + + static $suffixes = [ + 1 => '-inci', + 5 => '-inci', + 8 => '-inci', + 70 => '-inci', + 80 => '-inci', + 2 => '-nci', + 7 => '-nci', + 20 => '-nci', + 50 => '-nci', + 3 => '-üncü', + 4 => '-üncü', + 100 => '-üncü', + 6 => '-ncı', + 9 => '-uncu', + 10 => '-uncu', + 30 => '-uncu', + 60 => '-ıncı', + 90 => '-ıncı', + ]; + + $lastDigit = $number % 10; + + return $number.($suffixes[$lastDigit] ?? $suffixes[$number % 100 - $lastDigit] ?? $suffixes[$number >= 100 ? 100 : -1] ?? ''); + }, + 'meridiem' => function ($hour) { + if ($hour < 4) { + return 'gecə'; + } + if ($hour < 12) { + return 'səhər'; + } + if ($hour < 17) { + return 'gündüz'; + } + + return 'axşam'; + }, + 'months' => ['yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun', 'iyul', 'avqust', 'sentyabr', 'oktyabr', 'noyabr', 'dekabr'], + 'months_short' => ['yan', 'fev', 'mar', 'apr', 'may', 'iyn', 'iyl', 'avq', 'sen', 'okt', 'noy', 'dek'], + 'months_standalone' => ['Yanvar', 'Fevral', 'Mart', 'Aprel', 'May', 'İyun', 'İyul', 'Avqust', 'Sentyabr', 'Oktyabr', 'Noyabr', 'Dekabr'], + 'weekdays' => ['bazar', 'bazar ertəsi', 'çərşənbə axşamı', 'çərşənbə', 'cümə axşamı', 'cümə', 'şənbə'], + 'weekdays_short' => ['baz', 'bze', 'çax', 'çər', 'cax', 'cüm', 'şən'], + 'weekdays_min' => ['bz', 'be', 'ça', 'çə', 'ca', 'cü', 'şə'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' və '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/az_AZ.php b/vendor/nesbot/carbon/src/Carbon/Lang/az_AZ.php new file mode 100644 index 00000000..2acf881a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/az_AZ.php @@ -0,0 +1,21 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Pablo Saratxaga pablo@mandrakesoft.com + */ +return array_replace_recursive(require __DIR__.'/az.php', [ + 'months_short' => ['Yan', 'Fev', 'Mar', 'Apr', 'May', 'İyn', 'İyl', 'Avq', 'Sen', 'Okt', 'Noy', 'Dek'], + 'weekdays' => ['bazar günü', 'bazar ertəsi', 'çərşənbə axşamı', 'çərşənbə', 'cümə axşamı', 'cümə', 'şənbə'], + 'weekdays_short' => ['baz', 'ber', 'çax', 'çər', 'cax', 'cüm', 'şnb'], + 'weekdays_min' => ['baz', 'ber', 'çax', 'çər', 'cax', 'cüm', 'şnb'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/az_Cyrl.php b/vendor/nesbot/carbon/src/Carbon/Lang/az_Cyrl.php new file mode 100644 index 00000000..28fc62fe --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/az_Cyrl.php @@ -0,0 +1,20 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/az.php', [ + 'weekdays' => ['базар', 'базар ертәси', 'чәршәнбә ахшамы', 'чәршәнбә', 'ҹүмә ахшамы', 'ҹүмә', 'шәнбә'], + 'weekdays_short' => ['Б.', 'Б.Е.', 'Ч.А.', 'Ч.', 'Ҹ.А.', 'Ҹ.', 'Ш.'], + 'weekdays_min' => ['Б.', 'Б.Е.', 'Ч.А.', 'Ч.', 'Ҹ.А.', 'Ҹ.', 'Ш.'], + 'months' => ['јанвар', 'феврал', 'март', 'апрел', 'май', 'ијун', 'ијул', 'август', 'сентјабр', 'октјабр', 'нојабр', 'декабр'], + 'months_short' => ['јан', 'фев', 'мар', 'апр', 'май', 'ијн', 'ијл', 'авг', 'сен', 'окт', 'ној', 'дек'], + 'months_standalone' => ['Јанвар', 'Феврал', 'Март', 'Апрел', 'Май', 'Ијун', 'Ијул', 'Август', 'Сентјабр', 'Октјабр', 'Нојабр', 'Декабр'], + 'meridiem' => ['а', 'п'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/az_IR.php b/vendor/nesbot/carbon/src/Carbon/Lang/az_IR.php new file mode 100644 index 00000000..991a0efb --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/az_IR.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Mousa Moradi mousamk@gmail.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'OY/OM/OD', + ], + 'months' => ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مئی', 'ژوئن', 'جولای', 'آقۇست', 'سپتامبر', 'اوْکتوْبر', 'نوْوامبر', 'دسامبر'], + 'months_short' => ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مئی', 'ژوئن', 'جولای', 'آقۇست', 'سپتامبر', 'اوْکتوْبر', 'نوْوامبر', 'دسامبر'], + 'weekdays' => ['یکشنبه', 'دوشنبه', 'سه‌شنبه', 'چارشنبه', 'جۆمعه آخشامی', 'جۆمعه', 'شنبه'], + 'weekdays_short' => ['یکشنبه', 'دوشنبه', 'سه‌شنبه', 'چارشنبه', 'جۆمعه آخشامی', 'جۆمعه', 'شنبه'], + 'weekdays_min' => ['یکشنبه', 'دوشنبه', 'سه‌شنبه', 'چارشنبه', 'جۆمعه آخشامی', 'جۆمعه', 'شنبه'], + 'first_day_of_week' => 6, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰۴', '۰۵', '۰۶', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱۴', '۱۵', '۱۶', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲۴', '۲۵', '۲۶', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳۴', '۳۵', '۳۶', '۳۷', '۳۸', '۳۹', '۴۰', '۴۱', '۴۲', '۴۳', '۴۴', '۴۵', '۴۶', '۴۷', '۴۸', '۴۹', '۵۰', '۵۱', '۵۲', '۵۳', '۵۴', '۵۵', '۵۶', '۵۷', '۵۸', '۵۹', '۶۰', '۶۱', '۶۲', '۶۳', '۶۴', '۶۵', '۶۶', '۶۷', '۶۸', '۶۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷۴', '۷۵', '۷۶', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸۴', '۸۵', '۸۶', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹۴', '۹۵', '۹۶', '۹۷', '۹۸', '۹۹'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/az_Latn.php b/vendor/nesbot/carbon/src/Carbon/Lang/az_Latn.php new file mode 100644 index 00000000..0be33914 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/az_Latn.php @@ -0,0 +1,29 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/az.php', [ + 'meridiem' => ['a', 'p'], + 'weekdays' => ['bazar', 'bazar ertəsi', 'çərşənbə axşamı', 'çərşənbə', 'cümə axşamı', 'cümə', 'şənbə'], + 'weekdays_short' => ['B.', 'B.E.', 'Ç.A.', 'Ç.', 'C.A.', 'C.', 'Ş.'], + 'weekdays_min' => ['B.', 'B.E.', 'Ç.A.', 'Ç.', 'C.A.', 'C.', 'Ş.'], + 'months' => ['yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun', 'iyul', 'avqust', 'sentyabr', 'oktyabr', 'noyabr', 'dekabr'], + 'months_short' => ['yan', 'fev', 'mar', 'apr', 'may', 'iyn', 'iyl', 'avq', 'sen', 'okt', 'noy', 'dek'], + 'months_standalone' => ['Yanvar', 'Fevral', 'Mart', 'Aprel', 'May', 'İyun', 'İyul', 'Avqust', 'Sentyabr', 'Oktyabr', 'Noyabr', 'Dekabr'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'D MMMM YYYY, dddd HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bas.php b/vendor/nesbot/carbon/src/Carbon/Lang/bas.php new file mode 100644 index 00000000..41bfa1d8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bas.php @@ -0,0 +1,32 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['I bikɛ̂glà', 'I ɓugajɔp'], + 'weekdays' => ['ŋgwà nɔ̂y', 'ŋgwà njaŋgumba', 'ŋgwà ûm', 'ŋgwà ŋgê', 'ŋgwà mbɔk', 'ŋgwà kɔɔ', 'ŋgwà jôn'], + 'weekdays_short' => ['nɔy', 'nja', 'uum', 'ŋge', 'mbɔ', 'kɔɔ', 'jon'], + 'weekdays_min' => ['nɔy', 'nja', 'uum', 'ŋge', 'mbɔ', 'kɔɔ', 'jon'], + 'months' => ['Kɔndɔŋ', 'Màcɛ̂l', 'Màtùmb', 'Màtop', 'M̀puyɛ', 'Hìlòndɛ̀', 'Njèbà', 'Hìkaŋ', 'Dìpɔ̀s', 'Bìòôm', 'Màyɛsèp', 'Lìbuy li ńyèe'], + 'months_short' => ['kɔn', 'mac', 'mat', 'mto', 'mpu', 'hil', 'nje', 'hik', 'dip', 'bio', 'may', 'liɓ'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMM, YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + + 'second' => ':count móndî', // less reliable + 's' => ':count móndî', // less reliable + 'a_second' => ':count móndî', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/be.php b/vendor/nesbot/carbon/src/Carbon/Lang/be.php new file mode 100644 index 00000000..ee736365 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/be.php @@ -0,0 +1,172 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Carbon\CarbonInterface; +use Symfony\Component\Translation\PluralizationRules; + +// @codeCoverageIgnoreStart +if (class_exists(PluralizationRules::class)) { + PluralizationRules::set(static function ($number) { + return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); + }, 'be'); +} +// @codeCoverageIgnoreEnd + +/* + * Authors: + * - Josh Soref + * - SobakaSlava + * - François B + * - Serhan Apaydın + * - JD Isaacks + * - AbadonnaAbbys + * - Siomkin Alexander + */ +return [ + 'year' => ':count год|:count гады|:count гадоў', + 'a_year' => '{1}год|:count год|:count гады|:count гадоў', + 'y' => ':count год|:count гады|:count гадоў', + 'month' => ':count месяц|:count месяцы|:count месяцаў', + 'a_month' => '{1}месяц|:count месяц|:count месяцы|:count месяцаў', + 'm' => ':count месяц|:count месяцы|:count месяцаў', + 'week' => ':count тыдзень|:count тыдні|:count тыдняў', + 'a_week' => '{1}тыдзень|:count тыдзень|:count тыдні|:count тыдняў', + 'w' => ':count тыдзень|:count тыдні|:count тыдняў', + 'day' => ':count дзень|:count дні|:count дзён', + 'a_day' => '{1}дзень|:count дзень|:count дні|:count дзён', + 'd' => ':count дн', + 'hour' => ':count гадзіну|:count гадзіны|:count гадзін', + 'a_hour' => '{1}гадзіна|:count гадзіна|:count гадзіны|:count гадзін', + 'h' => ':count гадзіна|:count гадзіны|:count гадзін', + 'minute' => ':count хвіліна|:count хвіліны|:count хвілін', + 'a_minute' => '{1}хвіліна|:count хвіліна|:count хвіліны|:count хвілін', + 'min' => ':count хв', + 'second' => ':count секунда|:count секунды|:count секунд', + 'a_second' => '{1}некалькі секунд|:count секунда|:count секунды|:count секунд', + 's' => ':count сек', + + 'hour_ago' => ':count гадзіну|:count гадзіны|:count гадзін', + 'a_hour_ago' => '{1}гадзіну|:count гадзіну|:count гадзіны|:count гадзін', + 'h_ago' => ':count гадзіну|:count гадзіны|:count гадзін', + 'minute_ago' => ':count хвіліну|:count хвіліны|:count хвілін', + 'a_minute_ago' => '{1}хвіліну|:count хвіліну|:count хвіліны|:count хвілін', + 'min_ago' => ':count хвіліну|:count хвіліны|:count хвілін', + 'second_ago' => ':count секунду|:count секунды|:count секунд', + 'a_second_ago' => '{1}некалькі секунд|:count секунду|:count секунды|:count секунд', + 's_ago' => ':count секунду|:count секунды|:count секунд', + + 'hour_from_now' => ':count гадзіну|:count гадзіны|:count гадзін', + 'a_hour_from_now' => '{1}гадзіну|:count гадзіну|:count гадзіны|:count гадзін', + 'h_from_now' => ':count гадзіну|:count гадзіны|:count гадзін', + 'minute_from_now' => ':count хвіліну|:count хвіліны|:count хвілін', + 'a_minute_from_now' => '{1}хвіліну|:count хвіліну|:count хвіліны|:count хвілін', + 'min_from_now' => ':count хвіліну|:count хвіліны|:count хвілін', + 'second_from_now' => ':count секунду|:count секунды|:count секунд', + 'a_second_from_now' => '{1}некалькі секунд|:count секунду|:count секунды|:count секунд', + 's_from_now' => ':count секунду|:count секунды|:count секунд', + + 'hour_after' => ':count гадзіну|:count гадзіны|:count гадзін', + 'a_hour_after' => '{1}гадзіну|:count гадзіну|:count гадзіны|:count гадзін', + 'h_after' => ':count гадзіну|:count гадзіны|:count гадзін', + 'minute_after' => ':count хвіліну|:count хвіліны|:count хвілін', + 'a_minute_after' => '{1}хвіліну|:count хвіліну|:count хвіліны|:count хвілін', + 'min_after' => ':count хвіліну|:count хвіліны|:count хвілін', + 'second_after' => ':count секунду|:count секунды|:count секунд', + 'a_second_after' => '{1}некалькі секунд|:count секунду|:count секунды|:count секунд', + 's_after' => ':count секунду|:count секунды|:count секунд', + + 'hour_before' => ':count гадзіну|:count гадзіны|:count гадзін', + 'a_hour_before' => '{1}гадзіну|:count гадзіну|:count гадзіны|:count гадзін', + 'h_before' => ':count гадзіну|:count гадзіны|:count гадзін', + 'minute_before' => ':count хвіліну|:count хвіліны|:count хвілін', + 'a_minute_before' => '{1}хвіліну|:count хвіліну|:count хвіліны|:count хвілін', + 'min_before' => ':count хвіліну|:count хвіліны|:count хвілін', + 'second_before' => ':count секунду|:count секунды|:count секунд', + 'a_second_before' => '{1}некалькі секунд|:count секунду|:count секунды|:count секунд', + 's_before' => ':count секунду|:count секунды|:count секунд', + + 'ago' => ':time таму', + 'from_now' => 'праз :time', + 'after' => ':time пасля', + 'before' => ':time да', + 'diff_now' => 'цяпер', + 'diff_today' => 'Сёння', + 'diff_today_regexp' => 'Сёння(?:\\s+ў)?', + 'diff_yesterday' => 'учора', + 'diff_yesterday_regexp' => 'Учора(?:\\s+ў)?', + 'diff_tomorrow' => 'заўтра', + 'diff_tomorrow_regexp' => 'Заўтра(?:\\s+ў)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMMM YYYY г.', + 'LLL' => 'D MMMM YYYY г., HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY г., HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Сёння ў] LT', + 'nextDay' => '[Заўтра ў] LT', + 'nextWeek' => '[У] dddd [ў] LT', + 'lastDay' => '[Учора ў] LT', + 'lastWeek' => function (CarbonInterface $current) { + switch ($current->dayOfWeek) { + case 1: + case 2: + case 4: + return '[У мінулы] dddd [ў] LT'; + default: + return '[У мінулую] dddd [ў] LT'; + } + }, + 'sameElse' => 'L', + ], + 'ordinal' => function ($number, $period) { + switch ($period) { + case 'M': + case 'd': + case 'DDD': + case 'w': + case 'W': + return ($number % 10 === 2 || $number % 10 === 3) && ($number % 100 !== 12 && $number % 100 !== 13) ? $number.'-і' : $number.'-ы'; + case 'D': + return $number.'-га'; + default: + return $number; + } + }, + 'meridiem' => function ($hour) { + if ($hour < 4) { + return 'ночы'; + } + if ($hour < 12) { + return 'раніцы'; + } + if ($hour < 17) { + return 'дня'; + } + + return 'вечара'; + }, + 'months' => ['студзеня', 'лютага', 'сакавіка', 'красавіка', 'траўня', 'чэрвеня', 'ліпеня', 'жніўня', 'верасня', 'кастрычніка', 'лістапада', 'снежня'], + 'months_standalone' => ['студзень', 'люты', 'сакавік', 'красавік', 'травень', 'чэрвень', 'ліпень', 'жнівень', 'верасень', 'кастрычнік', 'лістапад', 'снежань'], + 'months_short' => ['студ', 'лют', 'сак', 'крас', 'трав', 'чэрв', 'ліп', 'жнів', 'вер', 'каст', 'ліст', 'снеж'], + 'months_regexp' => '/(DD?o?\.?(\[[^\[\]]*\]|\s)+MMMM?|L{2,4}|l{2,4})/', + 'weekdays' => ['нядзелю', 'панядзелак', 'аўторак', 'сераду', 'чацвер', 'пятніцу', 'суботу'], + 'weekdays_standalone' => ['нядзеля', 'панядзелак', 'аўторак', 'серада', 'чацвер', 'пятніца', 'субота'], + 'weekdays_short' => ['нд', 'пн', 'ат', 'ср', 'чц', 'пт', 'сб'], + 'weekdays_min' => ['нд', 'пн', 'ат', 'ср', 'чц', 'пт', 'сб'], + 'weekdays_regexp' => '/\[ ?[Ууў] ?(?:мінулую|наступную)? ?\] ?dddd/', + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' і '], + 'months_short_standalone' => ['сту', 'лют', 'сак', 'кра', 'май', 'чэр', 'ліп', 'жні', 'вер', 'кас', 'ліс', 'сне'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/be_BY.php b/vendor/nesbot/carbon/src/Carbon/Lang/be_BY.php new file mode 100644 index 00000000..26684b40 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/be_BY.php @@ -0,0 +1,22 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/be.php', [ + 'months' => ['студзеня', 'лютага', 'сакавіка', 'красавіка', 'мая', 'чэрвеня', 'ліпеня', 'жніўня', 'верасня', 'кастрычніка', 'лістапада', 'снежня'], + 'months_short' => ['сту', 'лют', 'сак', 'кра', 'мая', 'чэр', 'ліп', 'жні', 'вер', 'кас', 'ліс', 'сне'], + 'weekdays' => ['Нядзеля', 'Панядзелак', 'Аўторак', 'Серада', 'Чацвер', 'Пятніца', 'Субота'], + 'weekdays_short' => ['Няд', 'Пан', 'Аўт', 'Срд', 'Чцв', 'Пят', 'Суб'], + 'weekdays_min' => ['Няд', 'Пан', 'Аўт', 'Срд', 'Чцв', 'Пят', 'Суб'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/be_BY@latin.php b/vendor/nesbot/carbon/src/Carbon/Lang/be_BY@latin.php new file mode 100644 index 00000000..517ce83a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/be_BY@latin.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD.MM.YYYY', + ], + 'months' => ['studzienia', 'lutaha', 'sakavika', 'krasavika', 'maja', 'červienia', 'lipienia', 'žniŭnia', 'vieraśnia', 'kastryčnika', 'listapada', 'śniežnia'], + 'months_short' => ['Stu', 'Lut', 'Sak', 'Kra', 'Maj', 'Čer', 'Lip', 'Žni', 'Vie', 'Kas', 'Lis', 'Śni'], + 'weekdays' => ['Niadziela', 'Paniadziełak', 'Aŭtorak', 'Sierada', 'Čaćvier', 'Piatnica', 'Subota'], + 'weekdays_short' => ['Nia', 'Pan', 'Aŭt', 'Sie', 'Čać', 'Pia', 'Sub'], + 'weekdays_min' => ['Nia', 'Pan', 'Aŭt', 'Sie', 'Čać', 'Pia', 'Sub'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bem.php b/vendor/nesbot/carbon/src/Carbon/Lang/bem.php new file mode 100644 index 00000000..1c3ef039 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bem.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/bem_ZM.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bem_ZM.php b/vendor/nesbot/carbon/src/Carbon/Lang/bem_ZM.php new file mode 100644 index 00000000..620b5795 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bem_ZM.php @@ -0,0 +1,56 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - ANLoc Martin Benjamin locales@africanlocalization.net + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'MM/DD/YYYY', + ], + 'months' => ['Januari', 'Februari', 'Machi', 'Epreo', 'Mei', 'Juni', 'Julai', 'Ogasti', 'Septemba', 'Oktoba', 'Novemba', 'Disemba'], + 'months_short' => ['Jan', 'Feb', 'Mac', 'Epr', 'Mei', 'Jun', 'Jul', 'Oga', 'Sep', 'Okt', 'Nov', 'Dis'], + 'weekdays' => ['Pa Mulungu', 'Palichimo', 'Palichibuli', 'Palichitatu', 'Palichine', 'Palichisano', 'Pachibelushi'], + 'weekdays_short' => ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], + 'weekdays_min' => ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['uluchelo', 'akasuba'], + + 'year' => 'myaka :count', + 'y' => 'myaka :count', + 'a_year' => 'myaka :count', + + 'month' => 'myeshi :count', + 'm' => 'myeshi :count', + 'a_month' => 'myeshi :count', + + 'week' => 'umulungu :count', + 'w' => 'umulungu :count', + 'a_week' => 'umulungu :count', + + 'day' => 'inshiku :count', + 'd' => 'inshiku :count', + 'a_day' => 'inshiku :count', + + 'hour' => 'awala :count', + 'h' => 'awala :count', + 'a_hour' => 'awala :count', + + 'minute' => 'miniti :count', + 'min' => 'miniti :count', + 'a_minute' => 'miniti :count', + + 'second' => 'sekondi :count', + 's' => 'sekondi :count', + 'a_second' => 'sekondi :count', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ber.php b/vendor/nesbot/carbon/src/Carbon/Lang/ber.php new file mode 100644 index 00000000..685603c0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ber.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/ber_DZ.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ber_DZ.php b/vendor/nesbot/carbon/src/Carbon/Lang/ber_DZ.php new file mode 100644 index 00000000..38de10ab --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ber_DZ.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Pablo Saratxaga pablo@mandrakesoft.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD.MM.YYYY', + ], + 'months' => ['yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun', 'iyul', 'avqust', 'sentyabr', 'oktyabr', 'noyabr', 'dekabr'], + 'months_short' => ['Yan', 'Fev', 'Mar', 'Apr', 'May', 'İyn', 'İyl', 'Avq', 'Sen', 'Okt', 'Noy', 'Dek'], + 'weekdays' => ['bazar günü', 'birinci gün', 'ikinci gün', 'üçüncü gün', 'dördüncü gün', 'beşinci gün', 'altıncı gün'], + 'weekdays_short' => ['baz', 'bir', 'iki', 'üçü', 'dör', 'beş', 'alt'], + 'weekdays_min' => ['baz', 'bir', 'iki', 'üçü', 'dör', 'beş', 'alt'], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ber_MA.php b/vendor/nesbot/carbon/src/Carbon/Lang/ber_MA.php new file mode 100644 index 00000000..38de10ab --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ber_MA.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Pablo Saratxaga pablo@mandrakesoft.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD.MM.YYYY', + ], + 'months' => ['yanvar', 'fevral', 'mart', 'aprel', 'may', 'iyun', 'iyul', 'avqust', 'sentyabr', 'oktyabr', 'noyabr', 'dekabr'], + 'months_short' => ['Yan', 'Fev', 'Mar', 'Apr', 'May', 'İyn', 'İyl', 'Avq', 'Sen', 'Okt', 'Noy', 'Dek'], + 'weekdays' => ['bazar günü', 'birinci gün', 'ikinci gün', 'üçüncü gün', 'dördüncü gün', 'beşinci gün', 'altıncı gün'], + 'weekdays_short' => ['baz', 'bir', 'iki', 'üçü', 'dör', 'beş', 'alt'], + 'weekdays_min' => ['baz', 'bir', 'iki', 'üçü', 'dör', 'beş', 'alt'], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bez.php b/vendor/nesbot/carbon/src/Carbon/Lang/bez.php new file mode 100644 index 00000000..d59c5ef5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bez.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['pamilau', 'pamunyi'], + 'weekdays' => ['pa mulungu', 'pa shahuviluha', 'pa hivili', 'pa hidatu', 'pa hitayi', 'pa hihanu', 'pa shahulembela'], + 'weekdays_short' => ['Mul', 'Vil', 'Hiv', 'Hid', 'Hit', 'Hih', 'Lem'], + 'weekdays_min' => ['Mul', 'Vil', 'Hiv', 'Hid', 'Hit', 'Hih', 'Lem'], + 'months' => ['pa mwedzi gwa hutala', 'pa mwedzi gwa wuvili', 'pa mwedzi gwa wudatu', 'pa mwedzi gwa wutai', 'pa mwedzi gwa wuhanu', 'pa mwedzi gwa sita', 'pa mwedzi gwa saba', 'pa mwedzi gwa nane', 'pa mwedzi gwa tisa', 'pa mwedzi gwa kumi', 'pa mwedzi gwa kumi na moja', 'pa mwedzi gwa kumi na mbili'], + 'months_short' => ['Hut', 'Vil', 'Dat', 'Tai', 'Han', 'Sit', 'Sab', 'Nan', 'Tis', 'Kum', 'Kmj', 'Kmb'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bg.php b/vendor/nesbot/carbon/src/Carbon/Lang/bg.php new file mode 100644 index 00000000..f7680740 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bg.php @@ -0,0 +1,114 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - François B + * - Serhan Apaydın + * - JD Isaacks + * - Glavić + */ + +use Carbon\CarbonInterface; + +return [ + 'year' => ':count година|:count години', + 'a_year' => 'година|:count години', + 'y' => ':count година|:count години', + 'month' => ':count месец|:count месеца', + 'a_month' => 'месец|:count месеца', + 'm' => ':count месец|:count месеца', + 'week' => ':count седмица|:count седмици', + 'a_week' => 'седмица|:count седмици', + 'w' => ':count седмица|:count седмици', + 'day' => ':count ден|:count дни', + 'a_day' => 'ден|:count дни', + 'd' => ':count ден|:count дни', + 'hour' => ':count час|:count часа', + 'a_hour' => 'час|:count часа', + 'h' => ':count час|:count часа', + 'minute' => ':count минута|:count минути', + 'a_minute' => 'минута|:count минути', + 'min' => ':count минута|:count минути', + 'second' => ':count секунда|:count секунди', + 'a_second' => 'няколко секунди|:count секунди', + 's' => ':count секунда|:count секунди', + 'ago' => 'преди :time', + 'from_now' => 'след :time', + 'after' => 'след :time', + 'before' => 'преди :time', + 'diff_now' => 'сега', + 'diff_today' => 'Днес', + 'diff_today_regexp' => 'Днес(?:\\s+в)?', + 'diff_yesterday' => 'вчера', + 'diff_yesterday_regexp' => 'Вчера(?:\\s+в)?', + 'diff_tomorrow' => 'утре', + 'diff_tomorrow_regexp' => 'Утре(?:\\s+в)?', + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'D.MM.YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY H:mm', + 'LLLL' => 'dddd, D MMMM YYYY H:mm', + ], + 'calendar' => [ + 'sameDay' => '[Днес в] LT', + 'nextDay' => '[Утре в] LT', + 'nextWeek' => 'dddd [в] LT', + 'lastDay' => '[Вчера в] LT', + 'lastWeek' => function (CarbonInterface $current) { + switch ($current->dayOfWeek) { + case 0: + case 3: + case 6: + return '[В изминалата] dddd [в] LT'; + default: + return '[В изминалия] dddd [в] LT'; + } + }, + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + $lastDigit = $number % 10; + $last2Digits = $number % 100; + if ($number === 0) { + return "$number-ев"; + } + if ($last2Digits === 0) { + return "$number-ен"; + } + if ($last2Digits > 10 && $last2Digits < 20) { + return "$number-ти"; + } + if ($lastDigit === 1) { + return "$number-ви"; + } + if ($lastDigit === 2) { + return "$number-ри"; + } + if ($lastDigit === 7 || $lastDigit === 8) { + return "$number-ми"; + } + + return "$number-ти"; + }, + 'months' => ['януари', 'февруари', 'март', 'април', 'май', 'юни', 'юли', 'август', 'септември', 'октомври', 'ноември', 'декември'], + 'months_short' => ['яну', 'фев', 'мар', 'апр', 'май', 'юни', 'юли', 'авг', 'сеп', 'окт', 'ное', 'дек'], + 'weekdays' => ['неделя', 'понеделник', 'вторник', 'сряда', 'четвъртък', 'петък', 'събота'], + 'weekdays_short' => ['нед', 'пон', 'вто', 'сря', 'чет', 'пет', 'съб'], + 'weekdays_min' => ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' и '], + 'meridiem' => ['преди обяд', 'следобед'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bg_BG.php b/vendor/nesbot/carbon/src/Carbon/Lang/bg_BG.php new file mode 100644 index 00000000..b53874d3 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bg_BG.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/bg.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bhb.php b/vendor/nesbot/carbon/src/Carbon/Lang/bhb.php new file mode 100644 index 00000000..49f08032 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bhb.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/bhb_IN.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bhb_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/bhb_IN.php new file mode 100644 index 00000000..ab557cbf --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bhb_IN.php @@ -0,0 +1,26 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Samsung Electronics Co., Ltd. alexey.merzlyakov@samsung.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'D/M/YY', + ], + 'months' => ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], + 'months_short' => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], + 'weekdays' => ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], + 'weekdays_short' => ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], + 'weekdays_min' => ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bho.php b/vendor/nesbot/carbon/src/Carbon/Lang/bho.php new file mode 100644 index 00000000..e9ed0b68 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bho.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/bho_IN.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bho_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/bho_IN.php new file mode 100644 index 00000000..bc54f363 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bho_IN.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - bhashaghar@googlegroups.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'D/M/YY', + ], + 'months' => ['जनवरी', 'फरवरी', 'मार्च', 'अप्रैल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितम्बर', 'अक्टूबर', 'नवम्बर', 'दिसम्बर"'], + 'months_short' => ['जनवरी', 'फरवरी', 'मार्च', 'अप्रैल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितम्बर', 'अक्टूबर', 'नवम्बर', 'दिसम्बर"'], + 'weekdays' => ['रविवार', 'सोमवार', 'मंगलवार', 'बुधवार', 'गुरुवार', 'शुक्रवार', 'शनिवार'], + 'weekdays_short' => ['रवि', 'सोम', 'मंगल', 'बुध', 'गुरु', 'शुक्र', 'शनि'], + 'weekdays_min' => ['रवि', 'सोम', 'मंगल', 'बुध', 'गुरु', 'शुक्र', 'शनि'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['पूर्वाह्न', 'अपराह्न'], + + 'hour' => ':count मौसम', + 'h' => ':count मौसम', + 'a_hour' => ':count मौसम', + + 'minute' => ':count कला', + 'min' => ':count कला', + 'a_minute' => ':count कला', + + 'second' => ':count सोमार', + 's' => ':count सोमार', + 'a_second' => ':count सोमार', + + 'year' => ':count साल', + 'y' => ':count साल', + 'a_year' => ':count साल', + + 'month' => ':count महिना', + 'm' => ':count महिना', + 'a_month' => ':count महिना', + + 'week' => ':count सप्ताह', + 'w' => ':count सप्ताह', + 'a_week' => ':count सप्ताह', + + 'day' => ':count दिन', + 'd' => ':count दिन', + 'a_day' => ':count दिन', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bi.php b/vendor/nesbot/carbon/src/Carbon/Lang/bi.php new file mode 100644 index 00000000..dd08128e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bi.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/bi_VU.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bi_VU.php b/vendor/nesbot/carbon/src/Carbon/Lang/bi_VU.php new file mode 100644 index 00000000..1fe77705 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bi_VU.php @@ -0,0 +1,53 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Samsung Electronics Co., Ltd. akhilesh.k@samsung.com & maninder1.s@samsung.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'dddd DD MMM YYYY', + ], + 'months' => ['jenuware', 'febwari', 'maj', 'epril', 'mei', 'jun', 'julae', 'ogis', 'septemba', 'oktoba', 'novemba', 'disemba'], + 'months_short' => ['jen', 'feb', 'maj', 'epr', 'mei', 'jun', 'jul', 'ogi', 'sep', 'okt', 'nov', 'dis'], + 'weekdays' => ['sande', 'mande', 'maj', 'wota', 'fraede', 'sarede'], + 'weekdays_short' => ['san', 'man', 'maj', 'wot', 'fra', 'sar'], + 'weekdays_min' => ['san', 'man', 'maj', 'wot', 'fra', 'sar'], + + 'year' => ':count seven', // less reliable + 'y' => ':count seven', // less reliable + 'a_year' => ':count seven', // less reliable + + 'month' => ':count mi', // less reliable + 'm' => ':count mi', // less reliable + 'a_month' => ':count mi', // less reliable + + 'week' => ':count sarede', // less reliable + 'w' => ':count sarede', // less reliable + 'a_week' => ':count sarede', // less reliable + + 'day' => ':count betde', // less reliable + 'd' => ':count betde', // less reliable + 'a_day' => ':count betde', // less reliable + + 'hour' => ':count klok', // less reliable + 'h' => ':count klok', // less reliable + 'a_hour' => ':count klok', // less reliable + + 'minute' => ':count smol', // less reliable + 'min' => ':count smol', // less reliable + 'a_minute' => ':count smol', // less reliable + + 'second' => ':count tu', // less reliable + 's' => ':count tu', // less reliable + 'a_second' => ':count tu', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bm.php b/vendor/nesbot/carbon/src/Carbon/Lang/bm.php new file mode 100644 index 00000000..92822d29 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bm.php @@ -0,0 +1,70 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Estelle Comment + */ +return [ + 'year' => 'san :count', + 'a_year' => '{1}san kelen|san :count', + 'y' => 'san :count', + 'month' => 'kalo :count', + 'a_month' => '{1}kalo kelen|kalo :count', + 'm' => 'k. :count', + 'week' => 'dɔgɔkun :count', + 'a_week' => 'dɔgɔkun kelen', + 'w' => 'd. :count', + 'day' => 'tile :count', + 'd' => 't. :count', + 'a_day' => '{1}tile kelen|tile :count', + 'hour' => 'lɛrɛ :count', + 'a_hour' => '{1}lɛrɛ kelen|lɛrɛ :count', + 'h' => 'l. :count', + 'minute' => 'miniti :count', + 'a_minute' => '{1}miniti kelen|miniti :count', + 'min' => 'm. :count', + 'second' => 'sekondi :count', + 'a_second' => '{1}sanga dama dama|sekondi :count', + 's' => 'sek. :count', + 'ago' => 'a bɛ :time bɔ', + 'from_now' => ':time kɔnɔ', + 'diff_today' => 'Bi', + 'diff_yesterday' => 'Kunu', + 'diff_yesterday_regexp' => 'Kunu(?:\\s+lɛrɛ)?', + 'diff_tomorrow' => 'Sini', + 'diff_tomorrow_regexp' => 'Sini(?:\\s+lɛrɛ)?', + 'diff_today_regexp' => 'Bi(?:\\s+lɛrɛ)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'MMMM [tile] D [san] YYYY', + 'LLL' => 'MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm', + 'LLLL' => 'dddd MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Bi lɛrɛ] LT', + 'nextDay' => '[Sini lɛrɛ] LT', + 'nextWeek' => 'dddd [don lɛrɛ] LT', + 'lastDay' => '[Kunu lɛrɛ] LT', + 'lastWeek' => 'dddd [tɛmɛnen lɛrɛ] LT', + 'sameElse' => 'L', + ], + 'months' => ['Zanwuyekalo', 'Fewuruyekalo', 'Marisikalo', 'Awirilikalo', 'Mɛkalo', 'Zuwɛnkalo', 'Zuluyekalo', 'Utikalo', 'Sɛtanburukalo', 'ɔkutɔburukalo', 'Nowanburukalo', 'Desanburukalo'], + 'months_short' => ['Zan', 'Few', 'Mar', 'Awi', 'Mɛ', 'Zuw', 'Zul', 'Uti', 'Sɛt', 'ɔku', 'Now', 'Des'], + 'weekdays' => ['Kari', 'Ntɛnɛn', 'Tarata', 'Araba', 'Alamisa', 'Juma', 'Sibiri'], + 'weekdays_short' => ['Kar', 'Ntɛ', 'Tar', 'Ara', 'Ala', 'Jum', 'Sib'], + 'weekdays_min' => ['Ka', 'Nt', 'Ta', 'Ar', 'Al', 'Ju', 'Si'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' ni '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bn.php b/vendor/nesbot/carbon/src/Carbon/Lang/bn.php new file mode 100644 index 00000000..8e147899 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bn.php @@ -0,0 +1,100 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - Shakib Hossain + * - Raju + * - Aniruddha Adhikary + * - JD Isaacks + * - Saiful Islam + * - Faisal Islam + */ +return [ + 'year' => ':count বছর', + 'a_year' => 'এক বছর|:count বছর', + 'y' => '১ বছর|:count বছর', + 'month' => ':count মাস', + 'a_month' => 'এক মাস|:count মাস', + 'm' => '১ মাস|:count মাস', + 'week' => ':count সপ্তাহ', + 'a_week' => '১ সপ্তাহ|:count সপ্তাহ', + 'w' => '১ সপ্তাহ|:count সপ্তাহ', + 'day' => ':count দিন', + 'a_day' => 'এক দিন|:count দিন', + 'd' => '১ দিন|:count দিন', + 'hour' => ':count ঘন্টা', + 'a_hour' => 'এক ঘন্টা|:count ঘন্টা', + 'h' => '১ ঘন্টা|:count ঘন্টা', + 'minute' => ':count মিনিট', + 'a_minute' => 'এক মিনিট|:count মিনিট', + 'min' => '১ মিনিট|:count মিনিট', + 'second' => ':count সেকেন্ড', + 'a_second' => 'কয়েক সেকেন্ড|:count সেকেন্ড', + 's' => '১ সেকেন্ড|:count সেকেন্ড', + 'ago' => ':time আগে', + 'from_now' => ':time পরে', + 'after' => ':time পরে', + 'before' => ':time আগে', + 'diff_now' => 'এখন', + 'diff_today' => 'আজ', + 'diff_yesterday' => 'গতকাল', + 'diff_tomorrow' => 'আগামীকাল', + 'period_recurrences' => ':count বার|:count বার', + 'period_interval' => 'প্রতি :interval', + 'period_start_date' => ':date থেকে', + 'period_end_date' => ':date পর্যন্ত', + 'formats' => [ + 'LT' => 'A Oh:Om সময়', + 'LTS' => 'A Oh:Om:Os সময়', + 'L' => 'OD/OM/OY', + 'LL' => 'OD MMMM OY', + 'LLL' => 'OD MMMM OY, A Oh:Om সময়', + 'LLLL' => 'dddd, OD MMMM OY, A Oh:Om সময়', + ], + 'calendar' => [ + 'sameDay' => '[আজ] LT', + 'nextDay' => '[আগামীকাল] LT', + 'nextWeek' => 'dddd, LT', + 'lastDay' => '[গতকাল] LT', + 'lastWeek' => '[গত] dddd, LT', + 'sameElse' => 'L', + ], + 'meridiem' => function ($hour) { + if ($hour < 4) { + return 'রাত'; + } + if ($hour < 10) { + return 'সকাল'; + } + if ($hour < 17) { + return 'দুপুর'; + } + if ($hour < 20) { + return 'বিকাল'; + } + + return 'রাত'; + }, + 'months' => ['জানুয়ারী', 'ফেব্রুয়ারি', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'আগস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর'], + 'months_short' => ['জানু', 'ফেব', 'মার্চ', 'এপ্র', 'মে', 'জুন', 'জুল', 'আগ', 'সেপ্ট', 'অক্টো', 'নভে', 'ডিসে'], + 'weekdays' => ['রবিবার', 'সোমবার', 'মঙ্গলবার', 'বুধবার', 'বৃহস্পতিবার', 'শুক্রবার', 'শনিবার'], + 'weekdays_short' => ['রবি', 'সোম', 'মঙ্গল', 'বুধ', 'বৃহস্পতি', 'শুক্র', 'শনি'], + 'weekdays_min' => ['রবি', 'সোম', 'মঙ্গ', 'বুধ', 'বৃহঃ', 'শুক্র', 'শনি'], + 'list' => [', ', ' এবং '], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, + 'weekdays_standalone' => ['রবিবার', 'সোমবার', 'মঙ্গলবার', 'বুধবার', 'বৃহষ্পতিবার', 'শুক্রবার', 'শনিবার'], + 'weekdays_min_standalone' => ['রঃ', 'সোঃ', 'মঃ', 'বুঃ', 'বৃঃ', 'শুঃ', 'শনি'], + 'months_short_standalone' => ['জানুয়ারী', 'ফেব্রুয়ারী', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'আগস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর'], + 'alt_numbers' => ['০', '১', '২', '৩', '৪', '৫', '৬', '৭', '৮', '৯'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bn_BD.php b/vendor/nesbot/carbon/src/Carbon/Lang/bn_BD.php new file mode 100644 index 00000000..b5b28dd1 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bn_BD.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Ankur Group, Taneem Ahmed, Jamil Ahmed + */ +return array_replace_recursive(require __DIR__.'/bn.php', [ + 'formats' => [ + 'L' => 'D/M/YY', + ], + 'months' => ['জানুয়ারী', 'ফেব্রুয়ারী', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'আগস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর'], + 'months_short' => ['জানু', 'ফেব', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'আগস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর'], + 'weekdays' => ['রবিবার', 'সোমবার', 'মঙ্গলবার', 'বুধবার', 'বৃহস্পতিবার', 'শুক্রবার', 'শনিবার'], + 'weekdays_short' => ['রবি', 'সোম', 'মঙ্গল', 'বুধ', 'বৃহঃ', 'শুক্র', 'শনি'], + 'weekdays_min' => ['রবি', 'সোম', 'মঙ্গল', 'বুধ', 'বৃহঃ', 'শুক্র', 'শনি'], + 'first_day_of_week' => 5, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bn_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/bn_IN.php new file mode 100644 index 00000000..8b3a50e5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bn_IN.php @@ -0,0 +1,26 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/bn.php', [ + 'formats' => [ + 'L' => 'D/M/YY', + ], + 'months' => ['জানুয়ারী', 'ফেব্রুয়ারী', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'আগস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর'], + 'months_short' => ['জানু', 'ফেব', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'আগস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর'], + 'weekdays' => ['রবিবার', 'সোমবার', 'মঙ্গলবার', 'বুধবার', 'বৃহস্পতিবার', 'শুক্রবার', 'শনিবার'], + 'weekdays_short' => ['রবি', 'সোম', 'মঙ্গল', 'বুধ', 'বৃহস্পতি', 'শুক্র', 'শনি'], + 'weekdays_min' => ['রবি', 'সোম', 'মঙ্গল', 'বুধ', 'বৃহস্পতি', 'শুক্র', 'শনি'], + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bo.php b/vendor/nesbot/carbon/src/Carbon/Lang/bo.php new file mode 100644 index 00000000..99e1bf4c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bo.php @@ -0,0 +1,71 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - JD Isaacks + */ +return [ + 'year' => '{1}ལོ་གཅིག|]1,Inf[:count ལོ', + 'month' => '{1}ཟླ་བ་གཅིག|]1,Inf[:count ཟླ་བ', + 'week' => ':count བདུན་ཕྲག', + 'day' => '{1}ཉིན་གཅིག|]1,Inf[:count ཉིན་', + 'hour' => '{1}ཆུ་ཚོད་གཅིག|]1,Inf[:count ཆུ་ཚོད', + 'minute' => '{1}སྐར་མ་གཅིག|]1,Inf[:count སྐར་མ', + 'second' => '{1}ལམ་སང|]1,Inf[:count སྐར་ཆ།', + 'ago' => ':time སྔན་ལ', + 'from_now' => ':time ལ་', + 'diff_yesterday' => 'ཁ་སང', + 'diff_today' => 'དི་རིང', + 'diff_tomorrow' => 'སང་ཉིན', + 'formats' => [ + 'LT' => 'A h:mm', + 'LTS' => 'A h:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY, A h:mm', + 'LLLL' => 'dddd, D MMMM YYYY, A h:mm', + ], + 'calendar' => [ + 'sameDay' => '[དི་རིང] LT', + 'nextDay' => '[སང་ཉིན] LT', + 'nextWeek' => '[བདུན་ཕྲག་རྗེས་མ], LT', + 'lastDay' => '[ཁ་སང] LT', + 'lastWeek' => '[བདུན་ཕྲག་མཐའ་མ] dddd, LT', + 'sameElse' => 'L', + ], + 'meridiem' => function ($hour) { + if ($hour < 4) { + return 'མཚན་མོ'; + } + if ($hour < 10) { + return 'ཞོགས་ཀས'; + } + if ($hour < 17) { + return 'ཉིན་གུང'; + } + if ($hour < 20) { + return 'དགོང་དག'; + } + + return 'མཚན་མོ'; + }, + 'months' => ['ཟླ་བ་དང་པོ', 'ཟླ་བ་གཉིས་པ', 'ཟླ་བ་གསུམ་པ', 'ཟླ་བ་བཞི་པ', 'ཟླ་བ་ལྔ་པ', 'ཟླ་བ་དྲུག་པ', 'ཟླ་བ་བདུན་པ', 'ཟླ་བ་བརྒྱད་པ', 'ཟླ་བ་དགུ་པ', 'ཟླ་བ་བཅུ་པ', 'ཟླ་བ་བཅུ་གཅིག་པ', 'ཟླ་བ་བཅུ་གཉིས་པ'], + 'months_short' => ['ཟླ་བ་དང་པོ', 'ཟླ་བ་གཉིས་པ', 'ཟླ་བ་གསུམ་པ', 'ཟླ་བ་བཞི་པ', 'ཟླ་བ་ལྔ་པ', 'ཟླ་བ་དྲུག་པ', 'ཟླ་བ་བདུན་པ', 'ཟླ་བ་བརྒྱད་པ', 'ཟླ་བ་དགུ་པ', 'ཟླ་བ་བཅུ་པ', 'ཟླ་བ་བཅུ་གཅིག་པ', 'ཟླ་བ་བཅུ་གཉིས་པ'], + 'weekdays' => ['གཟའ་ཉི་མ་', 'གཟའ་ཟླ་བ་', 'གཟའ་མིག་དམར་', 'གཟའ་ལྷག་པ་', 'གཟའ་ཕུར་བུ', 'གཟའ་པ་སངས་', 'གཟའ་སྤེན་པ་'], + 'weekdays_short' => ['ཉི་མ་', 'ཟླ་བ་', 'མིག་དམར་', 'ལྷག་པ་', 'ཕུར་བུ', 'པ་སངས་', 'སྤེན་པ་'], + 'weekdays_min' => ['ཉི་མ་', 'ཟླ་བ་', 'མིག་དམར་', 'ལྷག་པ་', 'ཕུར་བུ', 'པ་སངས་', 'སྤེན་པ་'], + 'list' => [', ', ' ཨནད་ '], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, + 'months_standalone' => ['ཟླ་བ་དང་པོ་', 'ཟླ་བ་གཉིས་པ་', 'ཟླ་བ་གསུམ་པ་', 'ཟླ་བ་བཞི་པ་', 'ཟླ་བ་ལྔ་པ་', 'ཟླ་བ་དྲུག་པ་', 'ཟླ་བ་བདུན་པ་', 'ཟླ་བ་བརྒྱད་པ་', 'ཟླ་བ་དགུ་པ་', 'ཟླ་བ་བཅུ་པ་', 'ཟླ་བ་བཅུ་གཅིག་པ་', 'ཟླ་བ་བཅུ་གཉིས་པ་'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bo_CN.php b/vendor/nesbot/carbon/src/Carbon/Lang/bo_CN.php new file mode 100644 index 00000000..380abb1e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bo_CN.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/bo.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bo_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/bo_IN.php new file mode 100644 index 00000000..ca50d049 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bo_IN.php @@ -0,0 +1,29 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/bo.php', [ + 'meridiem' => ['སྔ་དྲོ་', 'ཕྱི་དྲོ་'], + 'weekdays' => ['གཟའ་ཉི་མ་', 'གཟའ་ཟླ་བ་', 'གཟའ་མིག་དམར་', 'གཟའ་ལྷག་པ་', 'གཟའ་ཕུར་བུ་', 'གཟའ་པ་སངས་', 'གཟའ་སྤེན་པ་'], + 'weekdays_short' => ['ཉི་མ་', 'ཟླ་བ་', 'མིག་དམར་', 'ལྷག་པ་', 'ཕུར་བུ་', 'པ་སངས་', 'སྤེན་པ་'], + 'weekdays_min' => ['ཉི་མ་', 'ཟླ་བ་', 'མིག་དམར་', 'ལྷག་པ་', 'ཕུར་བུ་', 'པ་སངས་', 'སྤེན་པ་'], + 'months' => ['ཟླ་བ་དང་པོ', 'ཟླ་བ་གཉིས་པ', 'ཟླ་བ་གསུམ་པ', 'ཟླ་བ་བཞི་པ', 'ཟླ་བ་ལྔ་པ', 'ཟླ་བ་དྲུག་པ', 'ཟླ་བ་བདུན་པ', 'ཟླ་བ་བརྒྱད་པ', 'ཟླ་བ་དགུ་པ', 'ཟླ་བ་བཅུ་པ', 'ཟླ་བ་བཅུ་གཅིག་པ', 'ཟླ་བ་བཅུ་གཉིས་པ'], + 'months_short' => ['ཟླ་༡', 'ཟླ་༢', 'ཟླ་༣', 'ཟླ་༤', 'ཟླ་༥', 'ཟླ་༦', 'ཟླ་༧', 'ཟླ་༨', 'ཟླ་༩', 'ཟླ་༡༠', 'ཟླ་༡༡', 'ཟླ་༡༢'], + 'months_standalone' => ['ཟླ་བ་དང་པོ་', 'ཟླ་བ་གཉིས་པ་', 'ཟླ་བ་གསུམ་པ་', 'ཟླ་བ་བཞི་པ་', 'ཟླ་བ་ལྔ་པ་', 'ཟླ་བ་དྲུག་པ་', 'ཟླ་བ་བདུན་པ་', 'ཟླ་བ་བརྒྱད་པ་', 'ཟླ་བ་དགུ་པ་', 'ཟླ་བ་བཅུ་པ་', 'ཟླ་བ་བཅུ་གཅིག་པ་', 'ཟླ་བ་བཅུ་གཉིས་པ་'], + 'weekend' => [0, 0], + 'formats' => [ + 'LT' => 'h:mm a', + 'LTS' => 'h:mm:ss a', + 'L' => 'YYYY-MM-DD', + 'LL' => 'YYYY ལོའི་MMMཚེས་D', + 'LLL' => 'སྤྱི་ལོ་YYYY MMMMའི་ཚེས་D h:mm a', + 'LLLL' => 'YYYY MMMMའི་ཚེས་D, dddd h:mm a', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/br.php b/vendor/nesbot/carbon/src/Carbon/Lang/br.php new file mode 100644 index 00000000..583472fb --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/br.php @@ -0,0 +1,76 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - François B + * - Serhan Apaydın + * - JD Isaacks + */ +return [ + 'year' => '{1}:count bloaz|{3,4,5,9}:count bloaz|[0,Inf[:count vloaz', + 'a_year' => '{1}ur bloaz|{3,4,5,9}:count bloaz|[0,Inf[:count vloaz', + 'month' => '{1}:count miz|{2}:count viz|[0,Inf[:count miz', + 'a_month' => '{1}ur miz|{2}:count viz|[0,Inf[:count miz', + 'week' => ':count sizhun', + 'a_week' => '{1}ur sizhun|:count sizhun', + 'day' => '{1}:count devezh|{2}:count zevezh|[0,Inf[:count devezh', + 'a_day' => '{1}un devezh|{2}:count zevezh|[0,Inf[:count devezh', + 'hour' => ':count eur', + 'a_hour' => '{1}un eur|:count eur', + 'minute' => '{1}:count vunutenn|{2}:count vunutenn|[0,Inf[:count munutenn', + 'a_minute' => '{1}ur vunutenn|{2}:count vunutenn|[0,Inf[:count munutenn', + 'second' => ':count eilenn', + 'a_second' => '{1}un nebeud segondennoù|[0,Inf[:count eilenn', + 'ago' => ':time \'zo', + 'from_now' => 'a-benn :time', + 'diff_now' => 'bremañ', + 'diff_today' => 'Hiziv', + 'diff_today_regexp' => 'Hiziv(?:\\s+da)?', + 'diff_yesterday' => 'decʼh', + 'diff_yesterday_regexp' => 'Dec\'h(?:\\s+da)?', + 'diff_tomorrow' => 'warcʼhoazh', + 'diff_tomorrow_regexp' => 'Warc\'hoazh(?:\\s+da)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D [a viz] MMMM YYYY', + 'LLL' => 'D [a viz] MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D [a viz] MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Hiziv da] LT', + 'nextDay' => '[Warc\'hoazh da] LT', + 'nextWeek' => 'dddd [da] LT', + 'lastDay' => '[Dec\'h da] LT', + 'lastWeek' => 'dddd [paset da] LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + return $number.($number === 1 ? 'añ' : 'vet'); + }, + 'months' => ['Genver', 'C\'hwevrer', 'Meurzh', 'Ebrel', 'Mae', 'Mezheven', 'Gouere', 'Eost', 'Gwengolo', 'Here', 'Du', 'Kerzu'], + 'months_short' => ['Gen', 'C\'hwe', 'Meu', 'Ebr', 'Mae', 'Eve', 'Gou', 'Eos', 'Gwe', 'Her', 'Du', 'Ker'], + 'weekdays' => ['Sul', 'Lun', 'Meurzh', 'Merc\'her', 'Yaou', 'Gwener', 'Sadorn'], + 'weekdays_short' => ['Sul', 'Lun', 'Meu', 'Mer', 'Yao', 'Gwe', 'Sad'], + 'weekdays_min' => ['Su', 'Lu', 'Me', 'Mer', 'Ya', 'Gw', 'Sa'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' hag '], + 'meridiem' => ['A.M.', 'G.M.'], + + 'y' => ':count bl.', + 'd' => ':count d', + 'h' => ':count e', + 'min' => ':count min', + 's' => ':count s', +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/br_FR.php b/vendor/nesbot/carbon/src/Carbon/Lang/br_FR.php new file mode 100644 index 00000000..7f541858 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/br_FR.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/br.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/brx.php b/vendor/nesbot/carbon/src/Carbon/Lang/brx.php new file mode 100644 index 00000000..a0a7bf9b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/brx.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/brx_IN.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/brx_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/brx_IN.php new file mode 100644 index 00000000..2d80ced2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/brx_IN.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Red Hat Pune bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'M/D/YY', + ], + 'months' => ['जानुवारी', 'फेब्रुवारी', 'मार्स', 'एफ्रिल', 'मे', 'जुन', 'जुलाइ', 'आगस्थ', 'सेबथेज्ब़र', 'अखथबर', 'नबेज्ब़र', 'दिसेज्ब़र'], + 'months_short' => ['जानुवारी', 'फेब्रुवारी', 'मार्स', 'एप्रिल', 'मे', 'जुन', 'जुलाइ', 'आगस्थ', 'सेबथेज्ब़र', 'अखथबर', 'नबेज्ब़र', 'दिसेज्ब़र'], + 'weekdays' => ['रबिबार', 'सोबार', 'मंगलबार', 'बुदबार', 'बिसथिबार', 'सुखुरबार', 'सुनिबार'], + 'weekdays_short' => ['रबि', 'सम', 'मंगल', 'बुद', 'बिसथि', 'सुखुर', 'सुनि'], + 'weekdays_min' => ['रबि', 'सम', 'मंगल', 'बुद', 'बिसथि', 'सुखुर', 'सुनि'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['फुं.', 'बेलासे.'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bs.php b/vendor/nesbot/carbon/src/Carbon/Lang/bs.php new file mode 100644 index 00000000..e5d68083 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bs.php @@ -0,0 +1,97 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - bokideckonja + * - Josh Soref + * - François B + * - shaishavgandhi05 + * - Serhan Apaydın + * - JD Isaacks + */ + +use Carbon\CarbonInterface; + +return [ + 'year' => ':count godina|:count godine|:count godina', + 'y' => ':count godina|:count godine|:count godina', + 'month' => ':count mjesec|:count mjeseca|:count mjeseci', + 'm' => ':count mjesec|:count mjeseca|:count mjeseci', + 'week' => ':count sedmice|:count sedmicu|:count sedmica', + 'w' => ':count sedmice|:count sedmicu|:count sedmica', + 'day' => ':count dan|:count dana|:count dana', + 'd' => ':count dan|:count dana|:count dana', + 'hour' => ':count sat|:count sata|:count sati', + 'h' => ':count sat|:count sata|:count sati', + 'minute' => ':count minut|:count minuta|:count minuta', + 'min' => ':count minut|:count minuta|:count minuta', + 'second' => ':count sekund|:count sekunda|:count sekundi', + 's' => ':count sekund|:count sekunda|:count sekundi', + 'ago' => 'prije :time', + 'from_now' => 'za :time', + 'after' => 'nakon :time', + 'before' => ':time ranije', + 'diff_now' => 'sada', + 'diff_today' => 'danas', + 'diff_today_regexp' => 'danas(?:\\s+u)?', + 'diff_yesterday' => 'jučer', + 'diff_yesterday_regexp' => 'jučer(?:\\s+u)?', + 'diff_tomorrow' => 'sutra', + 'diff_tomorrow_regexp' => 'sutra(?:\\s+u)?', + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D. MMMM YYYY', + 'LLL' => 'D. MMMM YYYY H:mm', + 'LLLL' => 'dddd, D. MMMM YYYY H:mm', + ], + 'calendar' => [ + 'sameDay' => '[danas u] LT', + 'nextDay' => '[sutra u] LT', + 'nextWeek' => function (CarbonInterface $current) { + switch ($current->dayOfWeek) { + case 0: + return '[u] [nedjelju] [u] LT'; + case 3: + return '[u] [srijedu] [u] LT'; + case 6: + return '[u] [subotu] [u] LT'; + default: + return '[u] dddd [u] LT'; + } + }, + 'lastDay' => '[jučer u] LT', + 'lastWeek' => function (CarbonInterface $current) { + switch ($current->dayOfWeek) { + case 0: + case 3: + return '[prošlu] dddd [u] LT'; + case 6: + return '[prošle] [subote] [u] LT'; + default: + return '[prošli] dddd [u] LT'; + } + }, + 'sameElse' => 'L', + ], + 'ordinal' => ':number.', + 'months' => ['januar', 'februar', 'mart', 'april', 'maj', 'juni', 'juli', 'august', 'septembar', 'oktobar', 'novembar', 'decembar'], + 'months_short' => ['jan.', 'feb.', 'mar.', 'apr.', 'maj.', 'jun.', 'jul.', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'], + 'weekdays' => ['nedjelja', 'ponedjeljak', 'utorak', 'srijeda', 'četvrtak', 'petak', 'subota'], + 'weekdays_short' => ['ned.', 'pon.', 'uto.', 'sri.', 'čet.', 'pet.', 'sub.'], + 'weekdays_min' => ['ne', 'po', 'ut', 'sr', 'če', 'pe', 'su'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' i '], + 'meridiem' => ['prijepodne', 'popodne'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bs_BA.php b/vendor/nesbot/carbon/src/Carbon/Lang/bs_BA.php new file mode 100644 index 00000000..0a591176 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bs_BA.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/bs.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bs_Cyrl.php b/vendor/nesbot/carbon/src/Carbon/Lang/bs_Cyrl.php new file mode 100644 index 00000000..e1a17447 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bs_Cyrl.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/bs.php', [ + 'meridiem' => ['пре подне', 'поподне'], + 'weekdays' => ['недјеља', 'понедјељак', 'уторак', 'сриједа', 'четвртак', 'петак', 'субота'], + 'weekdays_short' => ['нед', 'пон', 'уто', 'сри', 'чет', 'пет', 'суб'], + 'weekdays_min' => ['нед', 'пон', 'уто', 'сри', 'чет', 'пет', 'суб'], + 'months' => ['јануар', 'фебруар', 'март', 'април', 'мај', 'јуни', 'јули', 'аугуст', 'септембар', 'октобар', 'новембар', 'децембар'], + 'months_short' => ['јан', 'феб', 'мар', 'апр', 'мај', 'јун', 'јул', 'ауг', 'сеп', 'окт', 'нов', 'дец'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D.M.YYYY.', + 'LL' => 'DD.MM.YYYY.', + 'LLL' => 'DD. MMMM YYYY. HH:mm', + 'LLLL' => 'dddd, DD. MMMM YYYY. HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bs_Latn.php b/vendor/nesbot/carbon/src/Carbon/Lang/bs_Latn.php new file mode 100644 index 00000000..b4e363e7 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bs_Latn.php @@ -0,0 +1,13 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/bs.php', [ +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/byn.php b/vendor/nesbot/carbon/src/Carbon/Lang/byn.php new file mode 100644 index 00000000..7125f3d6 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/byn.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/byn_ER.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/byn_ER.php b/vendor/nesbot/carbon/src/Carbon/Lang/byn_ER.php new file mode 100644 index 00000000..ad675334 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/byn_ER.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Ge'ez Frontier Foundation locales@geez.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['ልደትሪ', 'ካብኽብቲ', 'ክብላ', 'ፋጅኺሪ', 'ክቢቅሪ', 'ምኪኤል ትጓ̅ኒሪ', 'ኰርኩ', 'ማርያም ትሪ', 'ያኸኒ መሳቅለሪ', 'መተሉ', 'ምኪኤል መሽወሪ', 'ተሕሳስሪ'], + 'months_short' => ['ልደት', 'ካብኽ', 'ክብላ', 'ፋጅኺ', 'ክቢቅ', 'ም/ት', 'ኰር', 'ማርያ', 'ያኸኒ', 'መተሉ', 'ም/ም', 'ተሕሳ'], + 'weekdays' => ['ሰንበር ቅዳዅ', 'ሰኑ', 'ሰሊጝ', 'ለጓ ወሪ ለብዋ', 'ኣምድ', 'ኣርብ', 'ሰንበር ሽጓዅ'], + 'weekdays_short' => ['ሰ/ቅ', 'ሰኑ', 'ሰሊጝ', 'ለጓ', 'ኣምድ', 'ኣርብ', 'ሰ/ሽ'], + 'weekdays_min' => ['ሰ/ቅ', 'ሰኑ', 'ሰሊጝ', 'ለጓ', 'ኣምድ', 'ኣርብ', 'ሰ/ሽ'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['ፋዱስ ጃብ', 'ፋዱስ ደምቢ'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ca.php b/vendor/nesbot/carbon/src/Carbon/Lang/ca.php new file mode 100644 index 00000000..b8b19946 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ca.php @@ -0,0 +1,117 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - mestremuten + * - François B + * - Marc Ordinas i Llopis + * - Pere Orga + * - JD Isaacks + * - Quentí + * - Víctor Díaz + * - Xavi + * - qcardona + */ + +use Carbon\CarbonInterface; + +return [ + 'year' => ':count any|:count anys', + 'a_year' => 'un any|:count anys', + 'y' => ':count any|:count anys', + 'month' => ':count mes|:count mesos', + 'a_month' => 'un mes|:count mesos', + 'm' => ':count mes|:count mesos', + 'week' => ':count setmana|:count setmanes', + 'a_week' => 'una setmana|:count setmanes', + 'w' => ':count setmana|:count setmanes', + 'day' => ':count dia|:count dies', + 'a_day' => 'un dia|:count dies', + 'd' => ':count d', + 'hour' => ':count hora|:count hores', + 'a_hour' => 'una hora|:count hores', + 'h' => ':count h', + 'minute' => ':count minut|:count minuts', + 'a_minute' => 'un minut|:count minuts', + 'min' => ':count min', + 'second' => ':count segon|:count segons', + 'a_second' => 'uns segons|:count segons', + 's' => ':count s', + 'ago' => 'fa :time', + 'from_now' => 'd\'aquí a :time', + 'after' => ':time després', + 'before' => ':time abans', + 'diff_now' => 'ara mateix', + 'diff_today' => 'avui', + 'diff_today_regexp' => 'avui(?:\\s+a)?(?:\\s+les)?', + 'diff_yesterday' => 'ahir', + 'diff_yesterday_regexp' => 'ahir(?:\\s+a)?(?:\\s+les)?', + 'diff_tomorrow' => 'demà', + 'diff_tomorrow_regexp' => 'demà(?:\\s+a)?(?:\\s+les)?', + 'diff_before_yesterday' => 'abans d\'ahir', + 'diff_after_tomorrow' => 'demà passat', + 'period_recurrences' => ':count cop|:count cops', + 'period_interval' => 'cada :interval', + 'period_start_date' => 'de :date', + 'period_end_date' => 'fins a :date', + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM [de] YYYY', + 'LLL' => 'D MMMM [de] YYYY [a les] H:mm', + 'LLLL' => 'dddd D MMMM [de] YYYY [a les] H:mm', + ], + 'calendar' => [ + 'sameDay' => function (CarbonInterface $current) { + return '[avui a '.($current->hour !== 1 ? 'les' : 'la').'] LT'; + }, + 'nextDay' => function (CarbonInterface $current) { + return '[demà a '.($current->hour !== 1 ? 'les' : 'la').'] LT'; + }, + 'nextWeek' => function (CarbonInterface $current) { + return 'dddd [a '.($current->hour !== 1 ? 'les' : 'la').'] LT'; + }, + 'lastDay' => function (CarbonInterface $current) { + return '[ahir a '.($current->hour !== 1 ? 'les' : 'la').'] LT'; + }, + 'lastWeek' => function (CarbonInterface $current) { + return '[el] dddd [passat a '.($current->hour !== 1 ? 'les' : 'la').'] LT'; + }, + 'sameElse' => 'L', + ], + 'ordinal' => function ($number, $period) { + return $number.( + ($period === 'w' || $period === 'W') ? 'a' : ( + ($number === 1) ? 'r' : ( + ($number === 2) ? 'n' : ( + ($number === 3) ? 'r' : ( + ($number === 4) ? 't' : 'è' + ) + ) + ) + ) + ); + }, + 'months' => ['de gener', 'de febrer', 'de març', 'd\'abril', 'de maig', 'de juny', 'de juliol', 'd\'agost', 'de setembre', 'd\'octubre', 'de novembre', 'de desembre'], + 'months_standalone' => ['gener', 'febrer', 'març', 'abril', 'maig', 'juny', 'juliol', 'agost', 'setembre', 'octubre', 'novembre', 'desembre'], + 'months_short' => ['de gen.', 'de febr.', 'de març', 'd\'abr.', 'de maig', 'de juny', 'de jul.', 'd\'ag.', 'de set.', 'd\'oct.', 'de nov.', 'de des.'], + 'months_short_standalone' => ['gen.', 'febr.', 'març', 'abr.', 'maig', 'juny', 'jul.', 'ag.', 'set.', 'oct.', 'nov.', 'des.'], + 'months_regexp' => '/(D[oD]?[\s,]+MMMM?|L{2,4}|l{2,4})/', + 'weekdays' => ['diumenge', 'dilluns', 'dimarts', 'dimecres', 'dijous', 'divendres', 'dissabte'], + 'weekdays_short' => ['dg.', 'dl.', 'dt.', 'dc.', 'dj.', 'dv.', 'ds.'], + 'weekdays_min' => ['dg', 'dl', 'dt', 'dc', 'dj', 'dv', 'ds'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' i '], + 'meridiem' => ['a. m.', 'p. m.'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ca_AD.php b/vendor/nesbot/carbon/src/Carbon/Lang/ca_AD.php new file mode 100644 index 00000000..861acd2a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ca_AD.php @@ -0,0 +1,13 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ca.php', [ +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ca_ES.php b/vendor/nesbot/carbon/src/Carbon/Lang/ca_ES.php new file mode 100644 index 00000000..50049786 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ca_ES.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/ca.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ca_ES_Valencia.php b/vendor/nesbot/carbon/src/Carbon/Lang/ca_ES_Valencia.php new file mode 100644 index 00000000..1c16421a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ca_ES_Valencia.php @@ -0,0 +1,23 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Component\Translation\PluralizationRules; + +// @codeCoverageIgnoreStart +if (class_exists(PluralizationRules::class)) { + PluralizationRules::set(static function ($number) { + return PluralizationRules::get($number, 'ca'); + }, 'ca_ES_Valencia'); +} +// @codeCoverageIgnoreEnd + +return array_replace_recursive(require __DIR__.'/ca.php', [ +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ca_FR.php b/vendor/nesbot/carbon/src/Carbon/Lang/ca_FR.php new file mode 100644 index 00000000..861acd2a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ca_FR.php @@ -0,0 +1,13 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ca.php', [ +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ca_IT.php b/vendor/nesbot/carbon/src/Carbon/Lang/ca_IT.php new file mode 100644 index 00000000..861acd2a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ca_IT.php @@ -0,0 +1,13 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ca.php', [ +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ccp.php b/vendor/nesbot/carbon/src/Carbon/Lang/ccp.php new file mode 100644 index 00000000..99c1dcac --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ccp.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'weekdays' => ['𑄢𑄧𑄝𑄨𑄝𑄢𑄴', '𑄥𑄧𑄟𑄴𑄝𑄢𑄴', '𑄟𑄧𑄁𑄉𑄧𑄣𑄴𑄝𑄢𑄴', '𑄝𑄪𑄖𑄴𑄝𑄢𑄴', '𑄝𑄳𑄢𑄨𑄥𑄪𑄛𑄴𑄝𑄢𑄴', '𑄥𑄪𑄇𑄴𑄇𑄮𑄢𑄴𑄝𑄢𑄴', '𑄥𑄧𑄚𑄨𑄝𑄢𑄴'], + 'weekdays_short' => ['𑄢𑄧𑄝𑄨', '𑄥𑄧𑄟𑄴', '𑄟𑄧𑄁𑄉𑄧𑄣𑄴', '𑄝𑄪𑄖𑄴', '𑄝𑄳𑄢𑄨𑄥𑄪𑄛𑄴', '𑄥𑄪𑄇𑄴𑄇𑄮𑄢𑄴', '𑄥𑄧𑄚𑄨'], + 'weekdays_min' => ['𑄢𑄧𑄝𑄨', '𑄥𑄧𑄟𑄴', '𑄟𑄧𑄁𑄉𑄧𑄣𑄴', '𑄝𑄪𑄖𑄴', '𑄝𑄳𑄢𑄨𑄥𑄪𑄛𑄴', '𑄥𑄪𑄇𑄴𑄇𑄮𑄢𑄴', '𑄥𑄧𑄚𑄨'], + 'months' => ['𑄎𑄚𑄪𑄠𑄢𑄨', '𑄜𑄬𑄛𑄴𑄝𑄳𑄢𑄪𑄠𑄢𑄨', '𑄟𑄢𑄴𑄌𑄧', '𑄃𑄬𑄛𑄳𑄢𑄨𑄣𑄴', '𑄟𑄬', '𑄎𑄪𑄚𑄴', '𑄎𑄪𑄣𑄭', '𑄃𑄉𑄧𑄌𑄴𑄑𑄴', '𑄥𑄬𑄛𑄴𑄑𑄬𑄟𑄴𑄝𑄧𑄢𑄴', '𑄃𑄧𑄇𑄴𑄑𑄬𑄝𑄧𑄢𑄴', '𑄚𑄧𑄞𑄬𑄟𑄴𑄝𑄧𑄢𑄴', '𑄓𑄨𑄥𑄬𑄟𑄴𑄝𑄧𑄢𑄴'], + 'months_short' => ['𑄎𑄚𑄪', '𑄜𑄬𑄛𑄴', '𑄟𑄢𑄴𑄌𑄧', '𑄃𑄬𑄛𑄳𑄢𑄨𑄣𑄴', '𑄟𑄬', '𑄎𑄪𑄚𑄴', '𑄎𑄪𑄣𑄭', '𑄃𑄉𑄧𑄌𑄴𑄑𑄴', '𑄥𑄬𑄛𑄴𑄑𑄬𑄟𑄴𑄝𑄧𑄢𑄴', '𑄃𑄧𑄇𑄴𑄑𑄮𑄝𑄧𑄢𑄴', '𑄚𑄧𑄞𑄬𑄟𑄴𑄝𑄧𑄢𑄴', '𑄓𑄨𑄥𑄬𑄟𑄴𑄝𑄢𑄴'], + 'months_short_standalone' => ['𑄎𑄚𑄪𑄠𑄢𑄨', '𑄜𑄬𑄛𑄴𑄝𑄳𑄢𑄪𑄠𑄢𑄨', '𑄟𑄢𑄴𑄌𑄧', '𑄃𑄬𑄛𑄳𑄢𑄨𑄣𑄴', '𑄟𑄬', '𑄎𑄪𑄚𑄴', '𑄎𑄪𑄣𑄭', '𑄃𑄉𑄧𑄌𑄴𑄑𑄴', '𑄥𑄬𑄛𑄴𑄑𑄬𑄟𑄴𑄝𑄧𑄢𑄴', '𑄃𑄧𑄇𑄴𑄑𑄮𑄝𑄧𑄢𑄴', '𑄚𑄧𑄞𑄬𑄟𑄴𑄝𑄧𑄢𑄴', '𑄓𑄨𑄥𑄬𑄟𑄴𑄝𑄧𑄢𑄴'], + 'formats' => [ + 'LT' => 'h:mm a', + 'LTS' => 'h:mm:ss a', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMM, YYYY', + 'LLL' => 'D MMMM, YYYY h:mm a', + 'LLLL' => 'dddd, D MMMM, YYYY h:mm a', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ccp_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/ccp_IN.php new file mode 100644 index 00000000..c1fa8af0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ccp_IN.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ccp.php', [ + 'weekend' => [0, 0], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ce.php b/vendor/nesbot/carbon/src/Carbon/Lang/ce.php new file mode 100644 index 00000000..f99f6ffd --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ce.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/ce_RU.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ce_RU.php b/vendor/nesbot/carbon/src/Carbon/Lang/ce_RU.php new file mode 100644 index 00000000..f7698562 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ce_RU.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - ANCHR + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'YYYY.DD.MM', + ], + 'months' => ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'], + 'months_short' => ['янв', 'фев', 'мар', 'апр', 'май', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек'], + 'weekdays' => ['КӀиранан де', 'Оршотан де', 'Шинарин де', 'Кхаарин де', 'Еарин де', 'ПӀераскан де', 'Шот де'], + 'weekdays_short' => ['КӀ', 'Ор', 'Ши', 'Кх', 'Еа', 'ПӀ', 'Шо'], + 'weekdays_min' => ['КӀ', 'Ор', 'Ши', 'Кх', 'Еа', 'ПӀ', 'Шо'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + + 'year' => ':count шо', + 'y' => ':count шо', + 'a_year' => ':count шо', + + 'month' => ':count бутт', + 'm' => ':count бутт', + 'a_month' => ':count бутт', + + 'week' => ':count кӏира', + 'w' => ':count кӏира', + 'a_week' => ':count кӏира', + + 'day' => ':count де', + 'd' => ':count де', + 'a_day' => ':count де', + + 'hour' => ':count сахьт', + 'h' => ':count сахьт', + 'a_hour' => ':count сахьт', + + 'minute' => ':count минот', + 'min' => ':count минот', + 'a_minute' => ':count минот', + + 'second' => ':count секунд', + 's' => ':count секунд', + 'a_second' => ':count секунд', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/cgg.php b/vendor/nesbot/carbon/src/Carbon/Lang/cgg.php new file mode 100644 index 00000000..09bcc1c7 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/cgg.php @@ -0,0 +1,31 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'weekdays' => ['Sande', 'Orwokubanza', 'Orwakabiri', 'Orwakashatu', 'Orwakana', 'Orwakataano', 'Orwamukaaga'], + 'weekdays_short' => ['SAN', 'ORK', 'OKB', 'OKS', 'OKN', 'OKT', 'OMK'], + 'weekdays_min' => ['SAN', 'ORK', 'OKB', 'OKS', 'OKN', 'OKT', 'OMK'], + 'months' => ['Okwokubanza', 'Okwakabiri', 'Okwakashatu', 'Okwakana', 'Okwakataana', 'Okwamukaaga', 'Okwamushanju', 'Okwamunaana', 'Okwamwenda', 'Okwaikumi', 'Okwaikumi na kumwe', 'Okwaikumi na ibiri'], + 'months_short' => ['KBZ', 'KBR', 'KST', 'KKN', 'KTN', 'KMK', 'KMS', 'KMN', 'KMW', 'KKM', 'KNK', 'KNB'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + + 'day' => ':count ruhanga', // less reliable + 'd' => ':count ruhanga', // less reliable + 'a_day' => ':count ruhanga', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/chr.php b/vendor/nesbot/carbon/src/Carbon/Lang/chr.php new file mode 100644 index 00000000..e26190f1 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/chr.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/chr_US.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/chr_US.php b/vendor/nesbot/carbon/src/Carbon/Lang/chr_US.php new file mode 100644 index 00000000..371353ef --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/chr_US.php @@ -0,0 +1,58 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Cherokee Nation Joseph Erb josepherb7@gmail.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'MM/DD/YYYY', + ], + 'months' => ['ᎤᏃᎸᏔᏅ', 'ᎧᎦᎵ', 'ᎠᏅᏱ', 'ᎧᏬᏂ', 'ᎠᏂᏍᎬᏘ', 'ᏕᎭᎷᏱ', 'ᎫᏰᏉᏂ', 'ᎦᎶᏂ', 'ᏚᎵᏍᏗ', 'ᏚᏂᏅᏗ', 'ᏅᏓᏕᏆ', 'ᎥᏍᎩᏱ'], + 'months_short' => ['ᎤᏃ', 'ᎧᎦ', 'ᎠᏅ', 'ᎧᏬ', 'ᎠᏂ', 'ᏕᎭ', 'ᎫᏰ', 'ᎦᎶ', 'ᏚᎵ', 'ᏚᏂ', 'ᏅᏓ', 'ᎥᏍ'], + 'weekdays' => ['ᎤᎾᏙᏓᏆᏍᎬ', 'ᎤᎾᏙᏓᏉᏅᎯ', 'ᏔᎵᏁᎢᎦ', 'ᏦᎢᏁᎢᎦ', 'ᏅᎩᏁᎢᎦ', 'ᏧᎾᎩᎶᏍᏗ', 'ᎤᎾᏙᏓᏈᏕᎾ'], + 'weekdays_short' => ['ᏆᏍᎬ', 'ᏉᏅᎯ', 'ᏔᎵᏁ', 'ᏦᎢᏁ', 'ᏅᎩᏁ', 'ᏧᎾᎩ', 'ᏈᏕᎾ'], + 'weekdays_min' => ['ᏆᏍᎬ', 'ᏉᏅᎯ', 'ᏔᎵᏁ', 'ᏦᎢᏁ', 'ᏅᎩᏁ', 'ᏧᎾᎩ', 'ᏈᏕᎾ'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['ᏌᎾᎴ', 'ᏒᎯᏱᎢᏗᏢ', 'ꮜꮎꮄ', 'ꮢꭿᏹꭲꮧꮲ'], + + 'second' => ':count ᏐᎢ', // less reliable + 's' => ':count ᏐᎢ', // less reliable + 'a_second' => ':count ᏐᎢ', // less reliable + + 'year' => ':count ᏑᏕᏘᏴᏓ', + 'y' => ':count ᏑᏕᏘᏴᏓ', + 'a_year' => ':count ᏑᏕᏘᏴᏓ', + + 'month' => ':count ᏏᏅᏙ', + 'm' => ':count ᏏᏅᏙ', + 'a_month' => ':count ᏏᏅᏙ', + + 'week' => ':count ᏑᎾᏙᏓᏆᏍᏗ', + 'w' => ':count ᏑᎾᏙᏓᏆᏍᏗ', + 'a_week' => ':count ᏑᎾᏙᏓᏆᏍᏗ', + + 'day' => ':count ᎢᎦ', + 'd' => ':count ᎢᎦ', + 'a_day' => ':count ᎢᎦ', + + 'hour' => ':count ᏑᏟᎶᏛ', + 'h' => ':count ᏑᏟᎶᏛ', + 'a_hour' => ':count ᏑᏟᎶᏛ', + + 'minute' => ':count ᎢᏯᏔᏬᏍᏔᏅ', + 'min' => ':count ᎢᏯᏔᏬᏍᏔᏅ', + 'a_minute' => ':count ᎢᏯᏔᏬᏍᏔᏅ', + + 'ago' => ':time ᏥᎨᏒ', + 'from_now' => 'ᎾᎿ :time', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ckb.php b/vendor/nesbot/carbon/src/Carbon/Lang/ckb.php new file mode 100644 index 00000000..acf4dc28 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ckb.php @@ -0,0 +1,89 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Swara Mohammed + */ +$months = [ + 'ڕێبەندان', + 'ڕەشەمە', + 'نەورۆز', + 'گوڵان', + 'جۆزەردان', + 'پوشپەڕ', + 'گەلاوێژ', + 'خەرمانان', + 'ڕەزبەر', + 'گەڵاڕێزان', + 'سەرماوەرز', + 'بەفرانبار', +]; + +return [ + 'year' => implode('|', ['{0}:count ساڵێک', '{1}ساڵێک', '{2}دوو ساڵ', ']2,11[:count ساڵ', ']10,Inf[:count ساڵ']), + 'a_year' => implode('|', ['{0}:count ساڵێک', '{1}ساڵێک', '{2}دوو ساڵ', ']2,11[:count ساڵ', ']10,Inf[:count ساڵ']), + 'month' => implode('|', ['{0}:count مانگێک', '{1}مانگێک', '{2}دوو مانگ', ']2,11[:count مانگ', ']10,Inf[:count مانگ']), + 'a_month' => implode('|', ['{0}:count مانگێک', '{1}مانگێک', '{2}دوو مانگ', ']2,11[:count مانگ', ']10,Inf[:count مانگ']), + 'week' => implode('|', ['{0}:count هەفتەیەک', '{1}هەفتەیەک', '{2}دوو هەفتە', ']2,11[:count هەفتە', ']10,Inf[:count هەفتە']), + 'a_week' => implode('|', ['{0}:count هەفتەیەک', '{1}هەفتەیەک', '{2}دوو هەفتە', ']2,11[:count هەفتە', ']10,Inf[:count هەفتە']), + 'day' => implode('|', ['{0}:count ڕۆژێک', '{1}ڕۆژێک', '{2}دوو ڕۆژ', ']2,11[:count ڕۆژ', ']10,Inf[:count ڕۆژ']), + 'a_day' => implode('|', ['{0}:count ڕۆژێک', '{1}ڕۆژێک', '{2}دوو ڕۆژ', ']2,11[:count ڕۆژ', ']10,Inf[:count ڕۆژ']), + 'hour' => implode('|', ['{0}:count کاتژمێرێک', '{1}کاتژمێرێک', '{2}دوو کاتژمێر', ']2,11[:count کاتژمێر', ']10,Inf[:count کاتژمێر']), + 'a_hour' => implode('|', ['{0}:count کاتژمێرێک', '{1}کاتژمێرێک', '{2}دوو کاتژمێر', ']2,11[:count کاتژمێر', ']10,Inf[:count کاتژمێر']), + 'minute' => implode('|', ['{0}:count خولەکێک', '{1}خولەکێک', '{2}دوو خولەک', ']2,11[:count خولەک', ']10,Inf[:count خولەک']), + 'a_minute' => implode('|', ['{0}:count خولەکێک', '{1}خولەکێک', '{2}دوو خولەک', ']2,11[:count خولەک', ']10,Inf[:count خولەک']), + 'second' => implode('|', ['{0}:count چرکەیەک', '{1}چرکەیەک', '{2}دوو چرکە', ']2,11[:count چرکە', ']10,Inf[:count چرکە']), + 'a_second' => implode('|', ['{0}:count چرکەیەک', '{1}چرکەیەک', '{2}دوو چرکە', ']2,11[:count چرکە', ']10,Inf[:count چرکە']), + 'ago' => 'پێش :time', + 'from_now' => ':time لە ئێستاوە', + 'after' => 'دوای :time', + 'before' => 'پێش :time', + 'diff_now' => 'ئێستا', + 'diff_today' => 'ئەمڕۆ', + 'diff_today_regexp' => 'ڕۆژ(?:\\s+لە)?(?:\\s+کاتژمێر)?', + 'diff_yesterday' => 'دوێنێ', + 'diff_yesterday_regexp' => 'دوێنێ(?:\\s+لە)?(?:\\s+کاتژمێر)?', + 'diff_tomorrow' => 'سبەینێ', + 'diff_tomorrow_regexp' => 'سبەینێ(?:\\s+لە)?(?:\\s+کاتژمێر)?', + 'diff_before_yesterday' => 'پێش دوێنێ', + 'diff_after_tomorrow' => 'دوای سبەینێ', + 'period_recurrences' => implode('|', ['{0}جار', '{1}جار', '{2}:count دووجار', ']2,11[:count جار', ']10,Inf[:count جار']), + 'period_interval' => 'هەموو :interval', + 'period_start_date' => 'لە :date', + 'period_end_date' => 'بۆ :date', + 'months' => $months, + 'months_short' => $months, + 'weekdays' => ['یەکشەممە', 'دووشەممە', 'سێشەممە', 'چوارشەممە', 'پێنجشەممە', 'هەینی', 'شەممە'], + 'weekdays_short' => ['یەکشەممە', 'دووشەممە', 'سێشەممە', 'چوارشەممە', 'پێنجشەممە', 'هەینی', 'شەممە'], + 'weekdays_min' => ['یەکشەممە', 'دووشەممە', 'سێشەممە', 'چوارشەممە', 'پێنجشەممە', 'هەینی', 'شەممە'], + 'list' => ['، ', ' و '], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[ئەمڕۆ لە کاتژمێر] LT', + 'nextDay' => '[سبەینێ لە کاتژمێر] LT', + 'nextWeek' => 'dddd [لە کاتژمێر] LT', + 'lastDay' => '[دوێنێ لە کاتژمێر] LT', + 'lastWeek' => 'dddd [لە کاتژمێر] LT', + 'sameElse' => 'L', + ], + 'meridiem' => ['پ.ن', 'د.ن'], + 'weekend' => [5, 6], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/cmn.php b/vendor/nesbot/carbon/src/Carbon/Lang/cmn.php new file mode 100644 index 00000000..80b1d694 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/cmn.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/cmn_TW.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/cmn_TW.php b/vendor/nesbot/carbon/src/Carbon/Lang/cmn_TW.php new file mode 100644 index 00000000..7e43f9de --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/cmn_TW.php @@ -0,0 +1,54 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'YYYY年MM月DD號', + ], + 'months' => ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], + 'months_short' => [' 1月', ' 2月', ' 3月', ' 4月', ' 5月', ' 6月', ' 7月', ' 8月', ' 9月', '10月', '11月', '12月'], + 'weekdays' => ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'], + 'weekdays_short' => ['日', '一', '二', '三', '四', '五', '六'], + 'weekdays_min' => ['日', '一', '二', '三', '四', '五', '六'], + 'meridiem' => ['上午', '下午'], + + 'year' => ':count 年', + 'y' => ':count 年', + 'a_year' => ':count 年', + + 'month' => ':count 月', + 'm' => ':count 月', + 'a_month' => ':count 月', + + 'week' => ':count 周', + 'w' => ':count 周', + 'a_week' => ':count 周', + + 'day' => ':count 白天', + 'd' => ':count 白天', + 'a_day' => ':count 白天', + + 'hour' => ':count 小时', + 'h' => ':count 小时', + 'a_hour' => ':count 小时', + + 'minute' => ':count 分钟', + 'min' => ':count 分钟', + 'a_minute' => ':count 分钟', + + 'second' => ':count 秒', + 's' => ':count 秒', + 'a_second' => ':count 秒', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/crh.php b/vendor/nesbot/carbon/src/Carbon/Lang/crh.php new file mode 100644 index 00000000..a1d7ce63 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/crh.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/crh_UA.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/crh_UA.php b/vendor/nesbot/carbon/src/Carbon/Lang/crh_UA.php new file mode 100644 index 00000000..05139331 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/crh_UA.php @@ -0,0 +1,56 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Reşat SABIQ tilde.birlik@gmail.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD.MM.YYYY', + ], + 'months' => ['Yanvar', 'Fevral', 'Mart', 'Aprel', 'Mayıs', 'İyun', 'İyul', 'Avgust', 'Sentâbr', 'Oktâbr', 'Noyabr', 'Dekabr'], + 'months_short' => ['Yan', 'Fev', 'Mar', 'Apr', 'May', 'İyn', 'İyl', 'Avg', 'Sen', 'Okt', 'Noy', 'Dek'], + 'weekdays' => ['Bazar', 'Bazarertesi', 'Salı', 'Çarşembe', 'Cumaaqşamı', 'Cuma', 'Cumaertesi'], + 'weekdays_short' => ['Baz', 'Ber', 'Sal', 'Çar', 'Caq', 'Cum', 'Cer'], + 'weekdays_min' => ['Baz', 'Ber', 'Sal', 'Çar', 'Caq', 'Cum', 'Cer'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['ÜE', 'ÜS'], + + 'year' => ':count yıl', + 'y' => ':count yıl', + 'a_year' => ':count yıl', + + 'month' => ':count ay', + 'm' => ':count ay', + 'a_month' => ':count ay', + + 'week' => ':count afta', + 'w' => ':count afta', + 'a_week' => ':count afta', + + 'day' => ':count kün', + 'd' => ':count kün', + 'a_day' => ':count kün', + + 'hour' => ':count saat', + 'h' => ':count saat', + 'a_hour' => ':count saat', + + 'minute' => ':count daqqa', + 'min' => ':count daqqa', + 'a_minute' => ':count daqqa', + + 'second' => ':count ekinci', + 's' => ':count ekinci', + 'a_second' => ':count ekinci', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/cs.php b/vendor/nesbot/carbon/src/Carbon/Lang/cs.php new file mode 100644 index 00000000..c01e3ccc --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/cs.php @@ -0,0 +1,123 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Philippe Vaucher + * - Jakub Tesinsky + * - Martin Suja + * - Nikos Timiopulos + * - Bohuslav Blín + * - Tsutomu Kuroda + * - tjku + * - Lukas Svoboda + * - Max Melentiev + * - Juanito Fatas + * - Akira Matsuda + * - Christopher Dell + * - Václav Pávek + * - CodeSkills + * - Tlapi + * - newman101 + * - Petr Kadlec + * - tommaskraus + * - Karel Sommer (calvera) + */ +$za = function ($time) { + return 'za '.strtr($time, [ + 'hodina' => 'hodinu', + 'minuta' => 'minutu', + 'sekunda' => 'sekundu', + ]); +}; + +$pred = function ($time) { + $time = strtr($time, [ + 'hodina' => 'hodinou', + 'minuta' => 'minutou', + 'sekunda' => 'sekundou', + ]); + $time = preg_replace('/hodiny?(?!\w)/', 'hodinami', $time); + $time = preg_replace('/minuty?(?!\w)/', 'minutami', $time); + $time = preg_replace('/sekundy?(?!\w)/', 'sekundami', $time); + + return "před $time"; +}; + +return [ + 'year' => ':count rok|:count roky|:count let', + 'y' => ':count rok|:count roky|:count let', + 'a_year' => 'rok|:count roky|:count let', + 'month' => ':count měsíc|:count měsíce|:count měsíců', + 'm' => ':count měs.', + 'a_month' => 'měsíc|:count měsíce|:count měsíců', + 'week' => ':count týden|:count týdny|:count týdnů', + 'w' => ':count týd.', + 'a_week' => 'týden|:count týdny|:count týdnů', + 'day' => ':count den|:count dny|:count dní', + 'd' => ':count den|:count dny|:count dní', + 'a_day' => 'den|:count dny|:count dní', + 'hour' => ':count hodina|:count hodiny|:count hodin', + 'h' => ':count hod.', + 'a_hour' => 'hodina|:count hodiny|:count hodin', + 'minute' => ':count minuta|:count minuty|:count minut', + 'min' => ':count min.', + 'a_minute' => 'minuta|:count minuty|:count minut', + 'second' => ':count sekunda|:count sekundy|:count sekund', + 's' => ':count sek.', + 'a_second' => 'pár sekund|:count sekundy|:count sekund', + + 'month_ago' => ':count měsícem|:count měsíci|:count měsíci', + 'a_month_ago' => 'měsícem|:count měsíci|:count měsíci', + 'day_ago' => ':count dnem|:count dny|:count dny', + 'a_day_ago' => 'dnem|:count dny|:count dny', + 'week_ago' => ':count týdnem|:count týdny|:count týdny', + 'a_week_ago' => 'týdnem|:count týdny|:count týdny', + 'year_ago' => ':count rokem|:count roky|:count lety', + 'y_ago' => ':count rok.|:count rok.|:count let.', + 'a_year_ago' => 'rokem|:count roky|:count lety', + + 'month_before' => ':count měsícem|:count měsíci|:count měsíci', + 'a_month_before' => 'měsícem|:count měsíci|:count měsíci', + 'day_before' => ':count dnem|:count dny|:count dny', + 'a_day_before' => 'dnem|:count dny|:count dny', + 'week_before' => ':count týdnem|:count týdny|:count týdny', + 'a_week_before' => 'týdnem|:count týdny|:count týdny', + 'year_before' => ':count rokem|:count roky|:count lety', + 'y_before' => ':count rok.|:count rok.|:count let.', + 'a_year_before' => 'rokem|:count roky|:count lety', + + 'ago' => $pred, + 'from_now' => $za, + 'before' => $pred, + 'after' => $za, + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'months' => ['ledna', 'února', 'března', 'dubna', 'května', 'června', 'července', 'srpna', 'září', 'října', 'listopadu', 'prosince'], + 'months_standalone' => ['leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec'], + 'months_short' => ['led', 'úno', 'bře', 'dub', 'kvě', 'čvn', 'čvc', 'srp', 'zář', 'říj', 'lis', 'pro'], + 'weekdays' => ['neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota'], + 'weekdays_short' => ['ned', 'pon', 'úte', 'stř', 'čtv', 'pát', 'sob'], + 'weekdays_min' => ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'], + 'list' => [', ', ' a '], + 'diff_now' => 'nyní', + 'diff_yesterday' => 'včera', + 'diff_tomorrow' => 'zítra', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD. MM. YYYY', + 'LL' => 'D. MMMM YYYY', + 'LLL' => 'D. MMMM YYYY HH:mm', + 'LLLL' => 'dddd D. MMMM YYYY HH:mm', + ], + 'meridiem' => ['dopoledne', 'odpoledne'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/cs_CZ.php b/vendor/nesbot/carbon/src/Carbon/Lang/cs_CZ.php new file mode 100644 index 00000000..ea2517e8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/cs_CZ.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/cs.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/csb.php b/vendor/nesbot/carbon/src/Carbon/Lang/csb.php new file mode 100644 index 00000000..a35d2815 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/csb.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/csb_PL.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/csb_PL.php b/vendor/nesbot/carbon/src/Carbon/Lang/csb_PL.php new file mode 100644 index 00000000..25e0ca89 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/csb_PL.php @@ -0,0 +1,41 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - csb_PL locale Michal Ostrowski bug-glibc-locales@gnu.org + */ +return [ + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY-MM-DD', + 'LL' => 'MMMM DD, YYYY', + 'LLL' => 'DD MMM HH:mm', + 'LLLL' => 'MMMM DD, YYYY HH:mm', + ], + 'months' => ['stëcznika', 'gromicznika', 'strëmiannika', 'łżëkwiata', 'maja', 'czerwińca', 'lëpińca', 'zélnika', 'séwnika', 'rujana', 'lëstopadnika', 'gòdnika'], + 'months_short' => ['stë', 'gro', 'str', 'łżë', 'maj', 'cze', 'lëp', 'zél', 'séw', 'ruj', 'lës', 'gòd'], + 'weekdays' => ['niedzela', 'pòniedzôłk', 'wtórk', 'strzoda', 'czwiôrtk', 'piątk', 'sobòta'], + 'weekdays_short' => ['nie', 'pòn', 'wtó', 'str', 'czw', 'pią', 'sob'], + 'weekdays_min' => ['nie', 'pòn', 'wtó', 'str', 'czw', 'pią', 'sob'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' a téż '], + 'two_words_connector' => ' a téż ', + 'year' => ':count rok', + 'month' => ':count miesiąc', + 'week' => ':count tidzéń', + 'day' => ':count dzéń', + 'hour' => ':count gòdzëna', + 'minute' => ':count minuta', + 'second' => ':count sekunda', +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/cu.php b/vendor/nesbot/carbon/src/Carbon/Lang/cu.php new file mode 100644 index 00000000..d6d13128 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/cu.php @@ -0,0 +1,52 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'months' => ['M01', 'M02', 'M03', 'M04', 'M05', 'M06', 'M07', 'M08', 'M09', 'M10', 'M11', 'M12'], + 'months_short' => ['M01', 'M02', 'M03', 'M04', 'M05', 'M06', 'M07', 'M08', 'M09', 'M10', 'M11', 'M12'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY-MM-DD', + 'LL' => 'YYYY MMM D', + 'LLL' => 'YYYY MMMM D HH:mm', + 'LLLL' => 'YYYY MMMM D, dddd HH:mm', + ], + + 'year' => ':count лѣто', + 'y' => ':count лѣто', + 'a_year' => ':count лѣто', + + 'month' => ':count мѣсѧць', + 'm' => ':count мѣсѧць', + 'a_month' => ':count мѣсѧць', + + 'week' => ':count сєдмица', + 'w' => ':count сєдмица', + 'a_week' => ':count сєдмица', + + 'day' => ':count дьнь', + 'd' => ':count дьнь', + 'a_day' => ':count дьнь', + + 'hour' => ':count година', + 'h' => ':count година', + 'a_hour' => ':count година', + + 'minute' => ':count малъ', // less reliable + 'min' => ':count малъ', // less reliable + 'a_minute' => ':count малъ', // less reliable + + 'second' => ':count въторъ', + 's' => ':count въторъ', + 'a_second' => ':count въторъ', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/cv.php b/vendor/nesbot/carbon/src/Carbon/Lang/cv.php new file mode 100644 index 00000000..8aeb73aa --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/cv.php @@ -0,0 +1,65 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - François B + * - JD Isaacks + */ +return [ + 'year' => ':count ҫул', + 'a_year' => '{1}пӗр ҫул|:count ҫул', + 'month' => ':count уйӑх', + 'a_month' => '{1}пӗр уйӑх|:count уйӑх', + 'week' => ':count эрне', + 'a_week' => '{1}пӗр эрне|:count эрне', + 'day' => ':count кун', + 'a_day' => '{1}пӗр кун|:count кун', + 'hour' => ':count сехет', + 'a_hour' => '{1}пӗр сехет|:count сехет', + 'minute' => ':count минут', + 'a_minute' => '{1}пӗр минут|:count минут', + 'second' => ':count ҫеккунт', + 'a_second' => '{1}пӗр-ик ҫеккунт|:count ҫеккунт', + 'ago' => ':time каялла', + 'from_now' => function ($time) { + return $time.(preg_match('/сехет$/u', $time) ? 'рен' : (preg_match('/ҫул/u', $time) ? 'тан' : 'ран')); + }, + 'diff_yesterday' => 'Ӗнер', + 'diff_today' => 'Паян', + 'diff_tomorrow' => 'Ыран', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD-MM-YYYY', + 'LL' => 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]', + 'LLL' => 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm', + 'LLLL' => 'dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Паян] LT [сехетре]', + 'nextDay' => '[Ыран] LT [сехетре]', + 'nextWeek' => '[Ҫитес] dddd LT [сехетре]', + 'lastDay' => '[Ӗнер] LT [сехетре]', + 'lastWeek' => '[Иртнӗ] dddd LT [сехетре]', + 'sameElse' => 'L', + ], + 'ordinal' => ':number-мӗш', + 'months' => ['кӑрлач', 'нарӑс', 'пуш', 'ака', 'май', 'ҫӗртме', 'утӑ', 'ҫурла', 'авӑн', 'юпа', 'чӳк', 'раштав'], + 'months_short' => ['кӑр', 'нар', 'пуш', 'ака', 'май', 'ҫӗр', 'утӑ', 'ҫур', 'авн', 'юпа', 'чӳк', 'раш'], + 'weekdays' => ['вырсарникун', 'тунтикун', 'ытларикун', 'юнкун', 'кӗҫнерникун', 'эрнекун', 'шӑматкун'], + 'weekdays_short' => ['выр', 'тун', 'ытл', 'юн', 'кӗҫ', 'эрн', 'шӑм'], + 'weekdays_min' => ['вр', 'тн', 'ыт', 'юн', 'кҫ', 'эр', 'шм'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' тата '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/cv_RU.php b/vendor/nesbot/carbon/src/Carbon/Lang/cv_RU.php new file mode 100644 index 00000000..197bd8d3 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/cv_RU.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/cv.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/cy.php b/vendor/nesbot/carbon/src/Carbon/Lang/cy.php new file mode 100644 index 00000000..119274f0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/cy.php @@ -0,0 +1,79 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - François B + * - JD Isaacks + * - Daniel Monaghan + */ +return [ + 'year' => '{1}blwyddyn|]1,Inf[:count flynedd', + 'y' => ':countbl', + 'month' => '{1}mis|]1,Inf[:count mis', + 'm' => ':countmi', + 'week' => ':count wythnos', + 'w' => ':countw', + 'day' => '{1}diwrnod|]1,Inf[:count diwrnod', + 'd' => ':countd', + 'hour' => '{1}awr|]1,Inf[:count awr', + 'h' => ':counth', + 'minute' => '{1}munud|]1,Inf[:count munud', + 'min' => ':countm', + 'second' => '{1}ychydig eiliadau|]1,Inf[:count eiliad', + 's' => ':counts', + 'ago' => ':time yn ôl', + 'from_now' => 'mewn :time', + 'after' => ':time ar ôl', + 'before' => ':time o\'r blaen', + 'diff_now' => 'nawr', + 'diff_today' => 'Heddiw', + 'diff_today_regexp' => 'Heddiw(?:\\s+am)?', + 'diff_yesterday' => 'ddoe', + 'diff_yesterday_regexp' => 'Ddoe(?:\\s+am)?', + 'diff_tomorrow' => 'yfory', + 'diff_tomorrow_regexp' => 'Yfory(?:\\s+am)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Heddiw am] LT', + 'nextDay' => '[Yfory am] LT', + 'nextWeek' => 'dddd [am] LT', + 'lastDay' => '[Ddoe am] LT', + 'lastWeek' => 'dddd [diwethaf am] LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + return $number.( + $number > 20 + ? (\in_array((int) $number, [40, 50, 60, 80, 100], true) ? 'fed' : 'ain') + : ([ + '', 'af', 'il', 'ydd', 'ydd', 'ed', 'ed', 'ed', 'fed', 'fed', 'fed', // 1af to 10fed + 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'fed', // 11eg to 20fed + ])[$number] ?? '' + ); + }, + 'months' => ['Ionawr', 'Chwefror', 'Mawrth', 'Ebrill', 'Mai', 'Mehefin', 'Gorffennaf', 'Awst', 'Medi', 'Hydref', 'Tachwedd', 'Rhagfyr'], + 'months_short' => ['Ion', 'Chwe', 'Maw', 'Ebr', 'Mai', 'Meh', 'Gor', 'Aws', 'Med', 'Hyd', 'Tach', 'Rhag'], + 'weekdays' => ['Dydd Sul', 'Dydd Llun', 'Dydd Mawrth', 'Dydd Mercher', 'Dydd Iau', 'Dydd Gwener', 'Dydd Sadwrn'], + 'weekdays_short' => ['Sul', 'Llun', 'Maw', 'Mer', 'Iau', 'Gwe', 'Sad'], + 'weekdays_min' => ['Su', 'Ll', 'Ma', 'Me', 'Ia', 'Gw', 'Sa'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' a '], + 'meridiem' => ['yb', 'yh'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/cy_GB.php b/vendor/nesbot/carbon/src/Carbon/Lang/cy_GB.php new file mode 100644 index 00000000..2c8148d0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/cy_GB.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/cy.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/da.php b/vendor/nesbot/carbon/src/Carbon/Lang/da.php new file mode 100644 index 00000000..322f91d5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/da.php @@ -0,0 +1,81 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Rune Mønnike + * - François B + * - codenhagen + * - JD Isaacks + * - Jens Herlevsen + * - Ulrik McArdle (mcardle) + * - Frederik Sauer (FrittenKeeZ) + * - Janus Bahs Jacquet (kokoshneta) + */ +return [ + 'year' => ':count år|:count år', + 'a_year' => 'et år|:count år', + 'y' => ':count år|:count år', + 'month' => ':count måned|:count måneder', + 'a_month' => 'en måned|:count måneder', + 'm' => ':count mdr.', + 'week' => ':count uge|:count uger', + 'a_week' => 'en uge|:count uger', + 'w' => ':count u.', + 'day' => ':count dag|:count dage', + 'a_day' => ':count dag|:count dage', + 'd' => ':count d.', + 'hour' => ':count time|:count timer', + 'a_hour' => 'en time|:count timer', + 'h' => ':count t.', + 'minute' => ':count minut|:count minutter', + 'a_minute' => 'et minut|:count minutter', + 'min' => ':count min.', + 'second' => ':count sekund|:count sekunder', + 'a_second' => 'få sekunder|:count sekunder', + 's' => ':count s.', + 'ago' => 'for :time siden', + 'from_now' => 'om :time', + 'after' => ':time efter', + 'before' => ':time før', + 'diff_now' => 'nu', + 'diff_today' => 'i dag', + 'diff_today_regexp' => 'i dag(?:\\s+kl.)?', + 'diff_yesterday' => 'i går', + 'diff_yesterday_regexp' => 'i går(?:\\s+kl.)?', + 'diff_tomorrow' => 'i morgen', + 'diff_tomorrow_regexp' => 'i morgen(?:\\s+kl.)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D. MMMM YYYY', + 'LLL' => 'D. MMMM YYYY HH:mm', + 'LLLL' => 'dddd [d.] D. MMMM YYYY [kl.] HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[i dag kl.] LT', + 'nextDay' => '[i morgen kl.] LT', + 'nextWeek' => 'på dddd [kl.] LT', + 'lastDay' => '[i går kl.] LT', + 'lastWeek' => '[i] dddd[s kl.] LT', + 'sameElse' => 'L', + ], + 'ordinal' => ':number.', + 'months' => ['januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'], + 'months_short' => ['jan.', 'feb.', 'mar.', 'apr.', 'maj.', 'jun.', 'jul.', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'], + 'weekdays' => ['søndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'lørdag'], + 'weekdays_short' => ['søn.', 'man.', 'tir.', 'ons.', 'tor.', 'fre.', 'lør.'], + 'weekdays_min' => ['sø', 'ma', 'ti', 'on', 'to', 'fr', 'lø'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' og '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/da_DK.php b/vendor/nesbot/carbon/src/Carbon/Lang/da_DK.php new file mode 100644 index 00000000..392c4841 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/da_DK.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/da.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/da_GL.php b/vendor/nesbot/carbon/src/Carbon/Lang/da_GL.php new file mode 100644 index 00000000..ea5698b9 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/da_GL.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/da.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + 'LL' => 'D. MMM YYYY', + 'LLL' => 'D. MMMM YYYY HH.mm', + 'LLLL' => 'dddd [den] D. MMMM YYYY HH.mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/dav.php b/vendor/nesbot/carbon/src/Carbon/Lang/dav.php new file mode 100644 index 00000000..e95ec4bb --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/dav.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['Luma lwa K', 'luma lwa p'], + 'weekdays' => ['Ituku ja jumwa', 'Kuramuka jimweri', 'Kuramuka kawi', 'Kuramuka kadadu', 'Kuramuka kana', 'Kuramuka kasanu', 'Kifula nguwo'], + 'weekdays_short' => ['Jum', 'Jim', 'Kaw', 'Kad', 'Kan', 'Kas', 'Ngu'], + 'weekdays_min' => ['Jum', 'Jim', 'Kaw', 'Kad', 'Kan', 'Kas', 'Ngu'], + 'months' => ['Mori ghwa imbiri', 'Mori ghwa kawi', 'Mori ghwa kadadu', 'Mori ghwa kana', 'Mori ghwa kasanu', 'Mori ghwa karandadu', 'Mori ghwa mfungade', 'Mori ghwa wunyanya', 'Mori ghwa ikenda', 'Mori ghwa ikumi', 'Mori ghwa ikumi na imweri', 'Mori ghwa ikumi na iwi'], + 'months_short' => ['Imb', 'Kaw', 'Kad', 'Kan', 'Kas', 'Kar', 'Mfu', 'Wun', 'Ike', 'Iku', 'Imw', 'Iwi'], + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/de.php b/vendor/nesbot/carbon/src/Carbon/Lang/de.php new file mode 100644 index 00000000..3b70750e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/de.php @@ -0,0 +1,117 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Michael Hohl + * - sheriffmarley + * - dennisoderwald + * - Timo + * - Karag2006 + * - Pete Scopes (pdscopes) + */ +return [ + 'year' => ':count Jahr|:count Jahre', + 'a_year' => 'ein Jahr|:count Jahre', + 'y' => ':count J.', + 'month' => ':count Monat|:count Monate', + 'a_month' => 'ein Monat|:count Monate', + 'm' => ':count Mon.', + 'week' => ':count Woche|:count Wochen', + 'a_week' => 'eine Woche|:count Wochen', + 'w' => ':count Wo.', + 'day' => ':count Tag|:count Tage', + 'a_day' => 'ein Tag|:count Tage', + 'd' => ':count Tg.', + 'hour' => ':count Stunde|:count Stunden', + 'a_hour' => 'eine Stunde|:count Stunden', + 'h' => ':count Std.', + 'minute' => ':count Minute|:count Minuten', + 'a_minute' => 'eine Minute|:count Minuten', + 'min' => ':count Min.', + 'second' => ':count Sekunde|:count Sekunden', + 'a_second' => 'ein paar Sekunden|:count Sekunden', + 's' => ':count Sek.', + 'millisecond' => ':count Millisekunde|:count Millisekunden', + 'a_millisecond' => 'eine Millisekunde|:count Millisekunden', + 'ms' => ':countms', + 'microsecond' => ':count Mikrosekunde|:count Mikrosekunden', + 'a_microsecond' => 'eine Mikrosekunde|:count Mikrosekunden', + 'µs' => ':countµs', + 'ago' => 'vor :time', + 'from_now' => 'in :time', + 'after' => ':time später', + 'before' => ':time zuvor', + + 'year_from_now' => ':count Jahr|:count Jahren', + 'month_from_now' => ':count Monat|:count Monaten', + 'week_from_now' => ':count Woche|:count Wochen', + 'day_from_now' => ':count Tag|:count Tagen', + 'year_ago' => ':count Jahr|:count Jahren', + 'month_ago' => ':count Monat|:count Monaten', + 'week_ago' => ':count Woche|:count Wochen', + 'day_ago' => ':count Tag|:count Tagen', + 'a_year_from_now' => 'ein Jahr|:count Jahren', + 'a_month_from_now' => 'ein Monat|:count Monaten', + 'a_week_from_now' => 'eine Woche|:count Wochen', + 'a_day_from_now' => 'ein Tag|:count Tagen', + 'a_year_ago' => 'ein Jahr|:count Jahren', + 'a_month_ago' => 'ein Monat|:count Monaten', + 'a_week_ago' => 'eine Woche|:count Wochen', + 'a_day_ago' => 'ein Tag|:count Tagen', + + 'diff_now' => 'Gerade eben', + 'diff_today' => 'heute', + 'diff_today_regexp' => 'heute(?:\\s+um)?', + 'diff_yesterday' => 'Gestern', + 'diff_yesterday_regexp' => 'gestern(?:\\s+um)?', + 'diff_tomorrow' => 'Morgen', + 'diff_tomorrow_regexp' => 'morgen(?:\\s+um)?', + 'diff_before_yesterday' => 'Vorgestern', + 'diff_after_tomorrow' => 'Übermorgen', + + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D. MMMM YYYY', + 'LLL' => 'D. MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D. MMMM YYYY HH:mm', + ], + + 'calendar' => [ + 'sameDay' => '[heute um] LT [Uhr]', + 'nextDay' => '[morgen um] LT [Uhr]', + 'nextWeek' => 'dddd [um] LT [Uhr]', + 'lastDay' => '[gestern um] LT [Uhr]', + 'lastWeek' => '[letzten] dddd [um] LT [Uhr]', + 'sameElse' => 'L', + ], + + 'months' => ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], + 'months_short' => ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'], + 'weekdays' => ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'], + 'weekdays_short' => ['So.', 'Mo.', 'Di.', 'Mi.', 'Do.', 'Fr.', 'Sa.'], + 'weekdays_min' => ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'], + 'ordinal' => ':number.', + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' und '], + 'ordinal_words' => [ + 'of' => 'im', + 'first' => 'erster', + 'second' => 'zweiter', + 'third' => 'dritter', + 'fourth' => 'vierten', + 'fifth' => 'fünfter', + 'last' => 'letzten', + ], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/de_AT.php b/vendor/nesbot/carbon/src/Carbon/Lang/de_AT.php new file mode 100644 index 00000000..a2ea4c08 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/de_AT.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - sheriffmarley + * - Timo + * - Michael Hohl + * - Namoshek + * - Bernhard Baumrock (BernhardBaumrock) + */ +return array_replace_recursive(require __DIR__.'/de.php', [ + 'months' => [ + 0 => 'Jänner', + ], + 'months_short' => [ + 0 => 'Jän', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/de_BE.php b/vendor/nesbot/carbon/src/Carbon/Lang/de_BE.php new file mode 100644 index 00000000..8ed8dc62 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/de_BE.php @@ -0,0 +1,20 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/de.php', [ + 'formats' => [ + 'L' => 'YYYY-MM-DD', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/de_CH.php b/vendor/nesbot/carbon/src/Carbon/Lang/de_CH.php new file mode 100644 index 00000000..a869ab48 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/de_CH.php @@ -0,0 +1,20 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - sheriffmarley + * - Timo + * - Michael Hohl + */ +return array_replace_recursive(require __DIR__.'/de.php', [ + 'weekdays_short' => ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/de_DE.php b/vendor/nesbot/carbon/src/Carbon/Lang/de_DE.php new file mode 100644 index 00000000..fb1209d2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/de_DE.php @@ -0,0 +1,16 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Free Software Foundation, Inc. bug-glibc-locales@gnu.org + */ +return require __DIR__.'/de.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/de_IT.php b/vendor/nesbot/carbon/src/Carbon/Lang/de_IT.php new file mode 100644 index 00000000..604a8568 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/de_IT.php @@ -0,0 +1,16 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Matthias Dieter Wallno:fer libc-locales@sourceware.org + */ +return require __DIR__.'/de.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/de_LI.php b/vendor/nesbot/carbon/src/Carbon/Lang/de_LI.php new file mode 100644 index 00000000..03e606a6 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/de_LI.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/de.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/de_LU.php b/vendor/nesbot/carbon/src/Carbon/Lang/de_LU.php new file mode 100644 index 00000000..8ed8dc62 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/de_LU.php @@ -0,0 +1,20 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/de.php', [ + 'formats' => [ + 'L' => 'YYYY-MM-DD', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/dje.php b/vendor/nesbot/carbon/src/Carbon/Lang/dje.php new file mode 100644 index 00000000..74b7ac12 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/dje.php @@ -0,0 +1,40 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['Subbaahi', 'Zaarikay b'], + 'weekdays' => ['Alhadi', 'Atinni', 'Atalaata', 'Alarba', 'Alhamisi', 'Alzuma', 'Asibti'], + 'weekdays_short' => ['Alh', 'Ati', 'Ata', 'Ala', 'Alm', 'Alz', 'Asi'], + 'weekdays_min' => ['Alh', 'Ati', 'Ata', 'Ala', 'Alm', 'Alz', 'Asi'], + 'months' => ['Žanwiye', 'Feewiriye', 'Marsi', 'Awiril', 'Me', 'Žuweŋ', 'Žuyye', 'Ut', 'Sektanbur', 'Oktoobur', 'Noowanbur', 'Deesanbur'], + 'months_short' => ['Žan', 'Fee', 'Mar', 'Awi', 'Me', 'Žuw', 'Žuy', 'Ut', 'Sek', 'Okt', 'Noo', 'Dee'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMM, YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + + 'year' => ':count hari', // less reliable + 'y' => ':count hari', // less reliable + 'a_year' => ':count hari', // less reliable + + 'week' => ':count alzuma', // less reliable + 'w' => ':count alzuma', // less reliable + 'a_week' => ':count alzuma', // less reliable + + 'second' => ':count atinni', // less reliable + 's' => ':count atinni', // less reliable + 'a_second' => ':count atinni', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/doi.php b/vendor/nesbot/carbon/src/Carbon/Lang/doi.php new file mode 100644 index 00000000..cb679c58 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/doi.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/doi_IN.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/doi_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/doi_IN.php new file mode 100644 index 00000000..d3597214 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/doi_IN.php @@ -0,0 +1,31 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Red Hat Pune libc-alpha@sourceware.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'D/M/YY', + ], + 'months' => ['जनवरी', 'फरवरी', 'मार्च', 'एप्रैल', 'मेई', 'जून', 'जूलै', 'अगस्त', 'सितंबर', 'अक्तूबर', 'नवंबर', 'दिसंबर'], + 'months_short' => ['जनवरी', 'फरवरी', 'मार्च', 'एप्रैल', 'मेई', 'जून', 'जूलै', 'अगस्त', 'सितंबर', 'अक्तूबर', 'नवंबर', 'दिसंबर'], + 'weekdays' => ['ऐतबार', 'सोमबार', 'मंगलबर', 'बुधबार', 'बीरबार', 'शुक्करबार', 'श्नीचरबार'], + 'weekdays_short' => ['ऐत', 'सोम', 'मंगल', 'बुध', 'बीर', 'शुक्कर', 'श्नीचर'], + 'weekdays_min' => ['ऐत', 'सोम', 'मंगल', 'बुध', 'बीर', 'शुक्कर', 'श्नीचर'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['सञं', 'सबेर'], + + 'second' => ':count सङार', // less reliable + 's' => ':count सङार', // less reliable + 'a_second' => ':count सङार', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/dsb.php b/vendor/nesbot/carbon/src/Carbon/Lang/dsb.php new file mode 100644 index 00000000..1d214d56 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/dsb.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/dsb_DE.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/dsb_DE.php b/vendor/nesbot/carbon/src/Carbon/Lang/dsb_DE.php new file mode 100644 index 00000000..1b941870 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/dsb_DE.php @@ -0,0 +1,60 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Information from Michael Wolf bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'DD. MMMM YYYY', + 'LLL' => 'DD. MMMM, HH:mm [góź.]', + 'LLLL' => 'dddd, DD. MMMM YYYY, HH:mm [góź.]', + ], + 'months' => ['januara', 'februara', 'měrca', 'apryla', 'maja', 'junija', 'julija', 'awgusta', 'septembra', 'oktobra', 'nowembra', 'decembra'], + 'months_short' => ['Jan', 'Feb', 'Měr', 'Apr', 'Maj', 'Jun', 'Jul', 'Awg', 'Sep', 'Okt', 'Now', 'Dec'], + 'weekdays' => ['Njeźela', 'Pónjeźele', 'Wałtora', 'Srjoda', 'Stwórtk', 'Pětk', 'Sobota'], + 'weekdays_short' => ['Nj', 'Pó', 'Wa', 'Sr', 'St', 'Pě', 'So'], + 'weekdays_min' => ['Nj', 'Pó', 'Wa', 'Sr', 'St', 'Pě', 'So'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + + 'year' => ':count lěto', + 'y' => ':count lěto', + 'a_year' => ':count lěto', + + 'month' => ':count mjasec', + 'm' => ':count mjasec', + 'a_month' => ':count mjasec', + + 'week' => ':count tyźeń', + 'w' => ':count tyźeń', + 'a_week' => ':count tyźeń', + + 'day' => ':count źeń', + 'd' => ':count źeń', + 'a_day' => ':count źeń', + + 'hour' => ':count góźina', + 'h' => ':count góźina', + 'a_hour' => ':count góźina', + + 'minute' => ':count minuta', + 'min' => ':count minuta', + 'a_minute' => ':count minuta', + + 'second' => ':count drugi', + 's' => ':count drugi', + 'a_second' => ':count drugi', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/dua.php b/vendor/nesbot/carbon/src/Carbon/Lang/dua.php new file mode 100644 index 00000000..55e5c7c3 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/dua.php @@ -0,0 +1,56 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['idiɓa', 'ebyámu'], + 'weekdays' => ['éti', 'mɔ́sú', 'kwasú', 'mukɔ́sú', 'ŋgisú', 'ɗónɛsú', 'esaɓasú'], + 'weekdays_short' => ['ét', 'mɔ́s', 'kwa', 'muk', 'ŋgi', 'ɗón', 'esa'], + 'weekdays_min' => ['ét', 'mɔ́s', 'kwa', 'muk', 'ŋgi', 'ɗón', 'esa'], + 'months' => ['dimɔ́di', 'ŋgɔndɛ', 'sɔŋɛ', 'diɓáɓá', 'emiasele', 'esɔpɛsɔpɛ', 'madiɓɛ́díɓɛ́', 'diŋgindi', 'nyɛtɛki', 'mayésɛ́', 'tiníní', 'eláŋgɛ́'], + 'months_short' => ['di', 'ŋgɔn', 'sɔŋ', 'diɓ', 'emi', 'esɔ', 'mad', 'diŋ', 'nyɛt', 'may', 'tin', 'elá'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + + 'year' => ':count ma mbu', // less reliable + 'y' => ':count ma mbu', // less reliable + 'a_year' => ':count ma mbu', // less reliable + + 'month' => ':count myo̱di', // less reliable + 'm' => ':count myo̱di', // less reliable + 'a_month' => ':count myo̱di', // less reliable + + 'week' => ':count woki', // less reliable + 'w' => ':count woki', // less reliable + 'a_week' => ':count woki', // less reliable + + 'day' => ':count buńa', // less reliable + 'd' => ':count buńa', // less reliable + 'a_day' => ':count buńa', // less reliable + + 'hour' => ':count ma awa', // less reliable + 'h' => ':count ma awa', // less reliable + 'a_hour' => ':count ma awa', // less reliable + + 'minute' => ':count minuti', // less reliable + 'min' => ':count minuti', // less reliable + 'a_minute' => ':count minuti', // less reliable + + 'second' => ':count maba', // less reliable + 's' => ':count maba', // less reliable + 'a_second' => ':count maba', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/dv.php b/vendor/nesbot/carbon/src/Carbon/Lang/dv.php new file mode 100644 index 00000000..4b8d7e1a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/dv.php @@ -0,0 +1,89 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +$months = [ + 'ޖެނުއަރީ', + 'ފެބްރުއަރީ', + 'މާރިޗު', + 'އޭޕްރީލު', + 'މޭ', + 'ޖޫން', + 'ޖުލައި', + 'އޯގަސްޓު', + 'ސެޕްޓެމްބަރު', + 'އޮކްޓޯބަރު', + 'ނޮވެމްބަރު', + 'ޑިސެމްބަރު', +]; + +$weekdays = [ + 'އާދިއްތަ', + 'ހޯމަ', + 'އަންގާރަ', + 'ބުދަ', + 'ބުރާސްފަތި', + 'ހުކުރު', + 'ހޮނިހިރު', +]; + +/* + * Authors: + * - Josh Soref + * - Jawish Hameed + */ +return [ + 'year' => ':count '.'އަހަރު', + 'a_year' => '{1}'.'އަހަރެއް'.'|:count '.'އަހަރު', + 'month' => ':count '.'މަސް', + 'a_month' => '{1}'.'މަހެއް'.'|:count '.'މަސް', + 'week' => ':count '.'ހަފްތާ', + 'a_week' => '{1}'.'ސިކުންތުކޮޅެއް'.'|:count '.'ހަފްތާ', + 'day' => ':count '.'ދުވަސް', + 'a_day' => '{1}'.'ދުވަހެއް'.'|:count '.'ދުވަސް', + 'hour' => ':count '.'ގަޑިއިރު', + 'a_hour' => '{1}'.'ގަޑިއިރެއް'.'|:count '.'ގަޑިއިރު', + 'minute' => ':count '.'މިނިޓު', + 'a_minute' => '{1}'.'މިނިޓެއް'.'|:count '.'މިނިޓު', + 'second' => ':count '.'ސިކުންތު', + 'a_second' => '{1}'.'ސިކުންތުކޮޅެއް'.'|:count '.'ސިކުންތު', + 'ago' => 'ކުރިން :time', + 'from_now' => 'ތެރޭގައި :time', + 'after' => ':time ފަހުން', + 'before' => ':time ކުރި', + 'diff_yesterday' => 'އިއްޔެ', + 'diff_today' => 'މިއަދު', + 'diff_tomorrow' => 'މާދަމާ', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[މިއަދު] LT', + 'nextDay' => '[މާދަމާ] LT', + 'nextWeek' => 'dddd LT', + 'lastDay' => '[އިއްޔެ] LT', + 'lastWeek' => '[ފާއިތުވި] dddd LT', + 'sameElse' => 'L', + ], + 'meridiem' => ['މކ', 'މފ'], + 'months' => $months, + 'months_short' => $months, + 'weekdays' => $weekdays, + 'weekdays_short' => $weekdays, + 'weekdays_min' => ['އާދި', 'ހޯމަ', 'އަން', 'ބުދަ', 'ބުރާ', 'ހުކު', 'ހޮނި'], + 'list' => [', ', ' އަދި '], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/dv_MV.php b/vendor/nesbot/carbon/src/Carbon/Lang/dv_MV.php new file mode 100644 index 00000000..2668d5b0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/dv_MV.php @@ -0,0 +1,87 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Ahmed Ali + */ + +$months = [ + 'ޖެނުއަރީ', + 'ފެބްރުއަރީ', + 'މާރިޗު', + 'އޭޕްރީލު', + 'މޭ', + 'ޖޫން', + 'ޖުލައި', + 'އޯގަސްޓު', + 'ސެޕްޓެމްބަރު', + 'އޮކްޓޯބަރު', + 'ނޮވެމްބަރު', + 'ޑިސެމްބަރު', +]; + +$weekdays = [ + 'އާދިއްތަ', + 'ހޯމަ', + 'އަންގާރަ', + 'ބުދަ', + 'ބުރާސްފަތި', + 'ހުކުރު', + 'ހޮނިހިރު', +]; + +return [ + 'year' => '{0}އަހަރެއް|[1,Inf]:count އަހަރު', + 'y' => '{0}އަހަރެއް|[1,Inf]:count އަހަރު', + 'month' => '{0}މައްސަރެއް|[1,Inf]:count މަސް', + 'm' => '{0}މައްސަރެއް|[1,Inf]:count މަސް', + 'week' => '{0}ހަފްތާއެއް|[1,Inf]:count ހަފްތާ', + 'w' => '{0}ހަފްތާއެއް|[1,Inf]:count ހަފްތާ', + 'day' => '{0}ދުވަސް|[1,Inf]:count ދުވަސް', + 'd' => '{0}ދުވަސް|[1,Inf]:count ދުވަސް', + 'hour' => '{0}ގަޑިއިރެއް|[1,Inf]:count ގަޑި', + 'h' => '{0}ގަޑިއިރެއް|[1,Inf]:count ގަޑި', + 'minute' => '{0}މިނެޓެއް|[1,Inf]:count މިނެޓް', + 'min' => '{0}މިނެޓެއް|[1,Inf]:count މިނެޓް', + 'second' => '{0}ސިކުންތެއް|[1,Inf]:count ސިކުންތު', + 's' => '{0}ސިކުންތެއް|[1,Inf]:count ސިކުންތު', + 'ago' => ':time ކުރިން', + 'from_now' => ':time ފަހުން', + 'after' => ':time ފަހުން', + 'before' => ':time ކުރި', + 'diff_yesterday' => 'އިއްޔެ', + 'diff_today' => 'މިއަދު', + 'diff_tomorrow' => 'މާދަމާ', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[މިއަދު] LT', + 'nextDay' => '[މާދަމާ] LT', + 'nextWeek' => 'dddd LT', + 'lastDay' => '[އިއްޔެ] LT', + 'lastWeek' => '[ފާއިތުވި] dddd LT', + 'sameElse' => 'L', + ], + 'meridiem' => ['މކ', 'މފ'], + 'months' => $months, + 'months_short' => $months, + 'weekdays' => $weekdays, + 'weekdays_short' => $weekdays, + 'weekdays_min' => ['އާދި', 'ހޯމަ', 'އަން', 'ބުދަ', 'ބުރާ', 'ހުކު', 'ހޮނި'], + 'list' => [', ', ' އަދި '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/dyo.php b/vendor/nesbot/carbon/src/Carbon/Lang/dyo.php new file mode 100644 index 00000000..33082e67 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/dyo.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'weekdays' => ['Dimas', 'Teneŋ', 'Talata', 'Alarbay', 'Aramisay', 'Arjuma', 'Sibiti'], + 'weekdays_short' => ['Dim', 'Ten', 'Tal', 'Ala', 'Ara', 'Arj', 'Sib'], + 'weekdays_min' => ['Dim', 'Ten', 'Tal', 'Ala', 'Ara', 'Arj', 'Sib'], + 'months' => ['Sanvie', 'Fébirie', 'Mars', 'Aburil', 'Mee', 'Sueŋ', 'Súuyee', 'Ut', 'Settembar', 'Oktobar', 'Novembar', 'Disambar'], + 'months_short' => ['Sa', 'Fe', 'Ma', 'Ab', 'Me', 'Su', 'Sú', 'Ut', 'Se', 'Ok', 'No', 'De'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/dz.php b/vendor/nesbot/carbon/src/Carbon/Lang/dz.php new file mode 100644 index 00000000..cc17e69e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/dz.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/dz_BT.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/dz_BT.php b/vendor/nesbot/carbon/src/Carbon/Lang/dz_BT.php new file mode 100644 index 00000000..bfbcaf46 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/dz_BT.php @@ -0,0 +1,43 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Sherubtse College bug-glibc@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'པསྱི་ལོYYཟལMMཚེསDD', + ], + 'months' => ['ཟླ་བ་དང་པ་', 'ཟླ་བ་གཉིས་པ་', 'ཟླ་བ་གསུམ་པ་', 'ཟླ་བ་བཞི་པ་', 'ཟླ་བ་ལྔ་ཕ་', 'ཟླ་བ་དྲུག་པ་', 'ཟླ་བ་བདུནཔ་', 'ཟླ་བ་བརྒྱད་པ་', 'ཟླ་བ་དགུ་པ་', 'ཟླ་བ་བཅུ་པ་', 'ཟླ་བ་བཅུ་གཅིག་པ་', 'ཟླ་བ་བཅུ་གཉིས་པ་'], + 'months_short' => ['ཟླ་༡', 'ཟླ་༢', 'ཟླ་༣', 'ཟླ་༤', 'ཟླ་༥', 'ཟླ་༦', 'ཟླ་༧', 'ཟླ་༨', 'ཟླ་༩', 'ཟླ་༡༠', 'ཟླ་༡༡', 'ཟླ་༡༢'], + 'weekdays' => ['གཟའ་ཟླ་བ་', 'གཟའ་མིག་དམར་', 'གཟའ་ལྷག་ཕ་', 'གཟའ་པུར་བུ་', 'གཟའ་པ་སངས་', 'གཟའ་སྤེན་ཕ་', 'གཟའ་ཉི་མ་'], + 'weekdays_short' => ['ཟླ་', 'མིར་', 'ལྷག་', 'པུར་', 'སངས་', 'སྤེན་', 'ཉི་'], + 'weekdays_min' => ['ཟླ་', 'མིར་', 'ལྷག་', 'པུར་', 'སངས་', 'སྤེན་', 'ཉི་'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['ངས་ཆ', 'ཕྱི་ཆ'], + + 'year' => ':count ཆརཔ', // less reliable + 'y' => ':count ཆརཔ', // less reliable + 'a_year' => ':count ཆརཔ', // less reliable + + 'month' => ':count ཟླ་བ', // less reliable + 'm' => ':count ཟླ་བ', // less reliable + 'a_month' => ':count ཟླ་བ', // less reliable + + 'day' => ':count ཉི', // less reliable + 'd' => ':count ཉི', // less reliable + 'a_day' => ':count ཉི', // less reliable + + 'second' => ':count ཆ', // less reliable + 's' => ':count ཆ', // less reliable + 'a_second' => ':count ཆ', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ebu.php b/vendor/nesbot/carbon/src/Carbon/Lang/ebu.php new file mode 100644 index 00000000..f60bc6f2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ebu.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['KI', 'UT'], + 'weekdays' => ['Kiumia', 'Njumatatu', 'Njumaine', 'Njumatano', 'Aramithi', 'Njumaa', 'NJumamothii'], + 'weekdays_short' => ['Kma', 'Tat', 'Ine', 'Tan', 'Arm', 'Maa', 'NMM'], + 'weekdays_min' => ['Kma', 'Tat', 'Ine', 'Tan', 'Arm', 'Maa', 'NMM'], + 'months' => ['Mweri wa mbere', 'Mweri wa kaĩri', 'Mweri wa kathatũ', 'Mweri wa kana', 'Mweri wa gatano', 'Mweri wa gatantatũ', 'Mweri wa mũgwanja', 'Mweri wa kanana', 'Mweri wa kenda', 'Mweri wa ikũmi', 'Mweri wa ikũmi na ũmwe', 'Mweri wa ikũmi na Kaĩrĩ'], + 'months_short' => ['Mbe', 'Kai', 'Kat', 'Kan', 'Gat', 'Gan', 'Mug', 'Knn', 'Ken', 'Iku', 'Imw', 'Igi'], + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ee.php b/vendor/nesbot/carbon/src/Carbon/Lang/ee.php new file mode 100644 index 00000000..f96c5c9d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ee.php @@ -0,0 +1,56 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['ŋ', 'ɣ'], + 'weekdays' => ['kɔsiɖa', 'dzoɖa', 'blaɖa', 'kuɖa', 'yawoɖa', 'fiɖa', 'memleɖa'], + 'weekdays_short' => ['kɔs', 'dzo', 'bla', 'kuɖ', 'yaw', 'fiɖ', 'mem'], + 'weekdays_min' => ['kɔs', 'dzo', 'bla', 'kuɖ', 'yaw', 'fiɖ', 'mem'], + 'months' => ['dzove', 'dzodze', 'tedoxe', 'afɔfĩe', 'dama', 'masa', 'siamlɔm', 'deasiamime', 'anyɔnyɔ', 'kele', 'adeɛmekpɔxe', 'dzome'], + 'months_short' => ['dzv', 'dzd', 'ted', 'afɔ', 'dam', 'mas', 'sia', 'dea', 'any', 'kel', 'ade', 'dzm'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'a [ga] h:mm', + 'LTS' => 'a [ga] h:mm:ss', + 'L' => 'M/D/YYYY', + 'LL' => 'MMM D [lia], YYYY', + 'LLL' => 'a [ga] h:mm MMMM D [lia] YYYY', + 'LLLL' => 'a [ga] h:mm dddd, MMMM D [lia] YYYY', + ], + + 'year' => 'ƒe :count', + 'y' => 'ƒe :count', + 'a_year' => 'ƒe :count', + + 'month' => 'ɣleti :count', + 'm' => 'ɣleti :count', + 'a_month' => 'ɣleti :count', + + 'week' => 'kwasiɖa :count', + 'w' => 'kwasiɖa :count', + 'a_week' => 'kwasiɖa :count', + + 'day' => 'ŋkeke :count', + 'd' => 'ŋkeke :count', + 'a_day' => 'ŋkeke :count', + + 'hour' => 'gaƒoƒo :count', + 'h' => 'gaƒoƒo :count', + 'a_hour' => 'gaƒoƒo :count', + + 'minute' => 'miniti :count', // less reliable + 'min' => 'miniti :count', // less reliable + 'a_minute' => 'miniti :count', // less reliable + + 'second' => 'sɛkɛnd :count', // less reliable + 's' => 'sɛkɛnd :count', // less reliable + 'a_second' => 'sɛkɛnd :count', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ee_TG.php b/vendor/nesbot/carbon/src/Carbon/Lang/ee_TG.php new file mode 100644 index 00000000..7a8b36c9 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ee_TG.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ee.php', [ + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'LLL' => 'HH:mm MMMM D [lia] YYYY', + 'LLLL' => 'HH:mm dddd, MMMM D [lia] YYYY', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/el.php b/vendor/nesbot/carbon/src/Carbon/Lang/el.php new file mode 100644 index 00000000..7c40f9c1 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/el.php @@ -0,0 +1,93 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Alessandro Di Felice + * - François B + * - Tim Fish + * - Gabriel Monteagudo + * - JD Isaacks + * - yiannisdesp + * - Ilias Kasmeridis (iliaskasm) + */ + +use Carbon\CarbonInterface; + +return [ + 'year' => ':count χρόνος|:count χρόνια', + 'a_year' => 'ένας χρόνος|:count χρόνια', + 'y' => ':count χρ.', + 'month' => ':count μήνας|:count μήνες', + 'a_month' => 'ένας μήνας|:count μήνες', + 'm' => ':count μήν.', + 'week' => ':count εβδομάδα|:count εβδομάδες', + 'a_week' => 'μια εβδομάδα|:count εβδομάδες', + 'w' => ':count εβδ.', + 'day' => ':count μέρα|:count μέρες', + 'a_day' => 'μία μέρα|:count μέρες', + 'd' => ':count μέρ.', + 'hour' => ':count ώρα|:count ώρες', + 'a_hour' => 'μία ώρα|:count ώρες', + 'h' => ':count ώρα|:count ώρες', + 'minute' => ':count λεπτό|:count λεπτά', + 'a_minute' => 'ένα λεπτό|:count λεπτά', + 'min' => ':count λεπ.', + 'second' => ':count δευτερόλεπτο|:count δευτερόλεπτα', + 'a_second' => 'λίγα δευτερόλεπτα|:count δευτερόλεπτα', + 's' => ':count δευ.', + 'ago' => 'πριν :time', + 'from_now' => 'σε :time', + 'after' => ':time μετά', + 'before' => ':time πριν', + 'diff_now' => 'τώρα', + 'diff_today' => 'Σήμερα', + 'diff_today_regexp' => 'Σήμερα(?:\\s+{})?', + 'diff_yesterday' => 'χθες', + 'diff_yesterday_regexp' => 'Χθες(?:\\s+{})?', + 'diff_tomorrow' => 'αύριο', + 'diff_tomorrow_regexp' => 'Αύριο(?:\\s+{})?', + 'formats' => [ + 'LT' => 'h:mm A', + 'LTS' => 'h:mm:ss A', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY h:mm A', + 'LLLL' => 'dddd, D MMMM YYYY h:mm A', + ], + 'calendar' => [ + 'sameDay' => '[Σήμερα {}] LT', + 'nextDay' => '[Αύριο {}] LT', + 'nextWeek' => 'dddd [{}] LT', + 'lastDay' => '[Χθες {}] LT', + 'lastWeek' => function (CarbonInterface $current) { + switch ($current->dayOfWeek) { + case 6: + return '[το προηγούμενο] dddd [{}] LT'; + default: + return '[την προηγούμενη] dddd [{}] LT'; + } + }, + 'sameElse' => 'L', + ], + 'ordinal' => ':numberη', + 'meridiem' => ['ΠΜ', 'ΜΜ', 'πμ', 'μμ'], + 'months' => ['Ιανουαρίου', 'Φεβρουαρίου', 'Μαρτίου', 'Απριλίου', 'Μαΐου', 'Ιουνίου', 'Ιουλίου', 'Αυγούστου', 'Σεπτεμβρίου', 'Οκτωβρίου', 'Νοεμβρίου', 'Δεκεμβρίου'], + 'months_standalone' => ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος'], + 'months_regexp' => '/(D[oD]?[\s,]+MMMM|L{2,4}|l{2,4})/', + 'months_short' => ['Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μαϊ', 'Ιουν', 'Ιουλ', 'Αυγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'], + 'weekdays' => ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'], + 'weekdays_short' => ['Κυρ', 'Δευ', 'Τρι', 'Τετ', 'Πεμ', 'Παρ', 'Σαβ'], + 'weekdays_min' => ['Κυ', 'Δε', 'Τρ', 'Τε', 'Πε', 'Πα', 'Σα'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' και '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/el_CY.php b/vendor/nesbot/carbon/src/Carbon/Lang/el_CY.php new file mode 100644 index 00000000..8a693c15 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/el_CY.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Greek Debian Translation Team bug-glibc@gnu.org + */ +return array_replace_recursive(require __DIR__.'/el.php', [ + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/el_GR.php b/vendor/nesbot/carbon/src/Carbon/Lang/el_GR.php new file mode 100644 index 00000000..df196af9 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/el_GR.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/el.php', [ + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en.php b/vendor/nesbot/carbon/src/Carbon/Lang/en.php new file mode 100644 index 00000000..f81f617e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en.php @@ -0,0 +1,87 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Milos Sakovic + * - Paul + * - Pete Scopes (pdscopes) + */ +return [ + /* + * {1}, {0} and ]1,Inf[ are not needed as it's the default for English pluralization. + * But as some languages are using en.php as a fallback, it's better to specify it + * explicitly so those languages also fallback to English pluralization when a unit + * is missing. + */ + 'year' => '{1}:count year|{0}:count years|]1,Inf[:count years', + 'a_year' => '{1}a year|{0}:count years|]1,Inf[:count years', + 'y' => '{1}:countyr|{0}:countyrs|]1,Inf[:countyrs', + 'month' => '{1}:count month|{0}:count months|]1,Inf[:count months', + 'a_month' => '{1}a month|{0}:count months|]1,Inf[:count months', + 'm' => '{1}:countmo|{0}:countmos|]1,Inf[:countmos', + 'week' => '{1}:count week|{0}:count weeks|]1,Inf[:count weeks', + 'a_week' => '{1}a week|{0}:count weeks|]1,Inf[:count weeks', + 'w' => ':countw', + 'day' => '{1}:count day|{0}:count days|]1,Inf[:count days', + 'a_day' => '{1}a day|{0}:count days|]1,Inf[:count days', + 'd' => ':countd', + 'hour' => '{1}:count hour|{0}:count hours|]1,Inf[:count hours', + 'a_hour' => '{1}an hour|{0}:count hours|]1,Inf[:count hours', + 'h' => ':counth', + 'minute' => '{1}:count minute|{0}:count minutes|]1,Inf[:count minutes', + 'a_minute' => '{1}a minute|{0}:count minutes|]1,Inf[:count minutes', + 'min' => ':countm', + 'second' => '{1}:count second|{0}:count seconds|]1,Inf[:count seconds', + 'a_second' => '{1}a few seconds|{0}:count seconds|]1,Inf[:count seconds', + 's' => ':counts', + 'millisecond' => '{1}:count millisecond|{0}:count milliseconds|]1,Inf[:count milliseconds', + 'a_millisecond' => '{1}a millisecond|{0}:count milliseconds|]1,Inf[:count milliseconds', + 'ms' => ':countms', + 'microsecond' => '{1}:count microsecond|{0}:count microseconds|]1,Inf[:count microseconds', + 'a_microsecond' => '{1}a microsecond|{0}:count microseconds|]1,Inf[:count microseconds', + 'µs' => ':countµs', + 'ago' => ':time ago', + 'from_now' => ':time from now', + 'after' => ':time after', + 'before' => ':time before', + 'diff_now' => 'just now', + 'diff_today' => 'today', + 'diff_yesterday' => 'yesterday', + 'diff_tomorrow' => 'tomorrow', + 'diff_before_yesterday' => 'before yesterday', + 'diff_after_tomorrow' => 'after tomorrow', + 'period_recurrences' => '{1}once|{0}:count times|]1,Inf[:count times', + 'period_interval' => 'every :interval', + 'period_start_date' => 'from :date', + 'period_end_date' => 'to :date', + 'months' => ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], + 'months_short' => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], + 'weekdays' => ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], + 'weekdays_short' => ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], + 'weekdays_min' => ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], + 'ordinal' => function ($number) { + $lastDigit = $number % 10; + + return $number.( + ((int) ($number % 100 / 10) === 1) ? 'th' : ( + ($lastDigit === 1) ? 'st' : ( + ($lastDigit === 2) ? 'nd' : ( + ($lastDigit === 3) ? 'rd' : 'th' + ) + ) + ) + ); + }, + 'list' => [', ', ' and '], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_001.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_001.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_001.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_150.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_150.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_150.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_AG.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_AG.php new file mode 100644 index 00000000..2c1c64f0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_AG.php @@ -0,0 +1,21 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Free Software Foundation, Inc. bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YY', + ], + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_AI.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_AI.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_AI.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_AS.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_AS.php new file mode 100644 index 00000000..f086dc63 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_AS.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/en.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_AT.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_AT.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_AT.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_AU.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_AU.php new file mode 100644 index 00000000..f16bd4f5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_AU.php @@ -0,0 +1,31 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Kunal Marwaha + * - François B + * - Mayank Badola + * - JD Isaacks + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'from_now' => 'in :time', + 'formats' => [ + 'LT' => 'h:mm A', + 'LTS' => 'h:mm:ss A', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY h:mm A', + 'LLLL' => 'dddd, D MMMM YYYY h:mm A', + ], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_BB.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_BB.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_BB.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_BE.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_BE.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_BE.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_BI.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_BI.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_BI.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_BM.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_BM.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_BM.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_BS.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_BS.php new file mode 100644 index 00000000..f086dc63 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_BS.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/en.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_BW.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_BW.php new file mode 100644 index 00000000..f086dc63 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_BW.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/en.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_BZ.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_BZ.php new file mode 100644 index 00000000..f086dc63 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_BZ.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/en.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_CA.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_CA.php new file mode 100644 index 00000000..e6560868 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_CA.php @@ -0,0 +1,29 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - François B + * - Zhan Tong Zhang + * - Mayank Badola + * - JD Isaacks + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'from_now' => 'in :time', + 'formats' => [ + 'LT' => 'h:mm A', + 'LTS' => 'h:mm:ss A', + 'L' => 'YYYY-MM-DD', + 'LL' => 'MMMM D, YYYY', + 'LLL' => 'MMMM D, YYYY h:mm A', + 'LLLL' => 'dddd, MMMM D, YYYY h:mm A', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_CC.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_CC.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_CC.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_CH.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_CH.php new file mode 100644 index 00000000..10d9cd8f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_CH.php @@ -0,0 +1,22 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_CK.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_CK.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_CK.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_CM.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_CM.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_CM.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_CX.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_CX.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_CX.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_CY.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_CY.php new file mode 100644 index 00000000..a44c3508 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_CY.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - NehaGautam + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'from_now' => 'in :time', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD-MM-YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_DE.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_DE.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_DE.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_DG.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_DG.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_DG.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_DK.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_DK.php new file mode 100644 index 00000000..9e8a8c68 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_DK.php @@ -0,0 +1,22 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Danish Standards Association bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'YYYY-MM-DD', + ], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_DM.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_DM.php new file mode 100644 index 00000000..f086dc63 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_DM.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/en.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_ER.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_ER.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_ER.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_FI.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_FI.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_FI.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_FJ.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_FJ.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_FJ.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_FK.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_FK.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_FK.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_FM.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_FM.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_FM.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_GB.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_GB.php new file mode 100644 index 00000000..67d9fd64 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_GB.php @@ -0,0 +1,30 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - François B + * - Mayank Badola + * - JD Isaacks + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'from_now' => 'in :time', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_GD.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_GD.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_GD.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_GG.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_GG.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_GG.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_GH.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_GH.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_GH.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_GI.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_GI.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_GI.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_GM.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_GM.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_GM.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_GU.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_GU.php new file mode 100644 index 00000000..f086dc63 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_GU.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/en.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_GY.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_GY.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_GY.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_HK.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_HK.php new file mode 100644 index 00000000..34aae989 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_HK.php @@ -0,0 +1,18 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_IE.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_IE.php new file mode 100644 index 00000000..c8d3c2fc --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_IE.php @@ -0,0 +1,31 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Martin McWhorter + * - François B + * - Chris Cartlidge + * - JD Isaacks + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'from_now' => 'in :time', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD-MM-YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_IL.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_IL.php new file mode 100644 index 00000000..e607924e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_IL.php @@ -0,0 +1,29 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Yoav Amit + * - François B + * - Mayank Badola + * - JD Isaacks + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'from_now' => 'in :time', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_IM.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_IM.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_IM.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_IN.php new file mode 100644 index 00000000..00414e9a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_IN.php @@ -0,0 +1,26 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YY', + 'LL' => 'MMMM DD, YYYY', + 'LLL' => 'DD MMM HH:mm', + 'LLLL' => 'MMMM DD, YYYY HH:mm', + ], + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_IO.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_IO.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_IO.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_ISO.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_ISO.php new file mode 100644 index 00000000..11457b0c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_ISO.php @@ -0,0 +1,21 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY-MM-dd', + 'LL' => 'YYYY MMM D', + 'LLL' => 'YYYY MMMM D HH:mm', + 'LLLL' => 'dddd, YYYY MMMM DD HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_JE.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_JE.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_JE.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_JM.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_JM.php new file mode 100644 index 00000000..f086dc63 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_JM.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/en.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_KE.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_KE.php new file mode 100644 index 00000000..f086dc63 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_KE.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/en.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_KI.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_KI.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_KI.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_KN.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_KN.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_KN.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_KY.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_KY.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_KY.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_LC.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_LC.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_LC.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_LR.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_LR.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_LR.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_LS.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_LS.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_LS.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_MG.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_MG.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_MG.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_MH.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_MH.php new file mode 100644 index 00000000..f086dc63 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_MH.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/en.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_MO.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_MO.php new file mode 100644 index 00000000..f086dc63 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_MO.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/en.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_MP.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_MP.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_MP.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_MS.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_MS.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_MS.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_MT.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_MT.php new file mode 100644 index 00000000..f086dc63 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_MT.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/en.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_MU.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_MU.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_MU.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_MW.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_MW.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_MW.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_MY.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_MY.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_MY.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_NA.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_NA.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_NA.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_NF.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_NF.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_NF.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_NG.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_NG.php new file mode 100644 index 00000000..67bceaad --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_NG.php @@ -0,0 +1,18 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YY', + ], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_NL.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_NL.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_NL.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_NR.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_NR.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_NR.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_NU.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_NU.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_NU.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_NZ.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_NZ.php new file mode 100644 index 00000000..6a206a0d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_NZ.php @@ -0,0 +1,31 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - François B + * - Mayank Badola + * - Luke McGregor + * - JD Isaacks + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'from_now' => 'in :time', + 'formats' => [ + 'LT' => 'h:mm A', + 'LTS' => 'h:mm:ss A', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY h:mm A', + 'LLLL' => 'dddd, D MMMM YYYY h:mm A', + ], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_PG.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_PG.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_PG.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_PH.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_PH.php new file mode 100644 index 00000000..34aae989 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_PH.php @@ -0,0 +1,18 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_PK.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_PK.php new file mode 100644 index 00000000..f086dc63 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_PK.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/en.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_PN.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_PN.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_PN.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_PR.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_PR.php new file mode 100644 index 00000000..f086dc63 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_PR.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/en.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_PW.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_PW.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_PW.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_RW.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_RW.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_RW.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_SB.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_SB.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_SB.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_SC.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_SC.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_SC.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_SD.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_SD.php new file mode 100644 index 00000000..c4e2557e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_SD.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 6, + 'weekend' => [5, 6], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_SE.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_SE.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_SE.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_SG.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_SG.php new file mode 100644 index 00000000..5ee95241 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_SG.php @@ -0,0 +1,24 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'from_now' => 'in :time', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_SH.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_SH.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_SH.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_SI.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_SI.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_SI.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_SL.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_SL.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_SL.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_SS.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_SS.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_SS.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_SX.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_SX.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_SX.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_SZ.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_SZ.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_SZ.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_TC.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_TC.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_TC.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_TK.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_TK.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_TK.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_TO.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_TO.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_TO.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_TT.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_TT.php new file mode 100644 index 00000000..f086dc63 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_TT.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/en.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_TV.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_TV.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_TV.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_TZ.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_TZ.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_TZ.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_UG.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_UG.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_UG.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_UM.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_UM.php new file mode 100644 index 00000000..f086dc63 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_UM.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/en.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_US.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_US.php new file mode 100644 index 00000000..f086dc63 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_US.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/en.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_US_Posix.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_US_Posix.php new file mode 100644 index 00000000..f086dc63 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_US_Posix.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/en.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_VC.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_VC.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_VC.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_VG.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_VG.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_VG.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_VI.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_VI.php new file mode 100644 index 00000000..f086dc63 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_VI.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/en.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_VU.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_VU.php new file mode 100644 index 00000000..e2dd81db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_VU.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_WS.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_WS.php new file mode 100644 index 00000000..f086dc63 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_WS.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/en.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_ZA.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_ZA.php new file mode 100644 index 00000000..48ea9471 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_ZA.php @@ -0,0 +1,26 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Zuza Software Foundation (Translate.org.za) Dwayne Bailey dwayne@translate.org.za + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YY', + 'LL' => 'MMMM DD, YYYY', + 'LLL' => 'DD MMM HH:mm', + 'LLLL' => 'MMMM DD, YYYY HH:mm', + ], + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_ZM.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_ZM.php new file mode 100644 index 00000000..d8a8cb59 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_ZM.php @@ -0,0 +1,22 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - ANLoc Martin Benjamin locales@africanlocalization.net + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YY', + ], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en_ZW.php b/vendor/nesbot/carbon/src/Carbon/Lang/en_ZW.php new file mode 100644 index 00000000..f086dc63 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en_ZW.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/en.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/eo.php b/vendor/nesbot/carbon/src/Carbon/Lang/eo.php new file mode 100644 index 00000000..7c2efba2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/eo.php @@ -0,0 +1,77 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - François B + * - Mia Nordentoft + * - JD Isaacks + */ +return [ + 'year' => ':count jaro|:count jaroj', + 'a_year' => 'jaro|:count jaroj', + 'y' => ':count j.', + 'month' => ':count monato|:count monatoj', + 'a_month' => 'monato|:count monatoj', + 'm' => ':count mo.', + 'week' => ':count semajno|:count semajnoj', + 'a_week' => 'semajno|:count semajnoj', + 'w' => ':count sem.', + 'day' => ':count tago|:count tagoj', + 'a_day' => 'tago|:count tagoj', + 'd' => ':count t.', + 'hour' => ':count horo|:count horoj', + 'a_hour' => 'horo|:count horoj', + 'h' => ':count h.', + 'minute' => ':count minuto|:count minutoj', + 'a_minute' => 'minuto|:count minutoj', + 'min' => ':count min.', + 'second' => ':count sekundo|:count sekundoj', + 'a_second' => 'sekundoj|:count sekundoj', + 's' => ':count sek.', + 'ago' => 'antaŭ :time', + 'from_now' => 'post :time', + 'after' => ':time poste', + 'before' => ':time antaŭe', + 'diff_yesterday' => 'Hieraŭ', + 'diff_yesterday_regexp' => 'Hieraŭ(?:\\s+je)?', + 'diff_today' => 'Hodiaŭ', + 'diff_today_regexp' => 'Hodiaŭ(?:\\s+je)?', + 'diff_tomorrow' => 'Morgaŭ', + 'diff_tomorrow_regexp' => 'Morgaŭ(?:\\s+je)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY-MM-DD', + 'LL' => 'D[-a de] MMMM, YYYY', + 'LLL' => 'D[-a de] MMMM, YYYY HH:mm', + 'LLLL' => 'dddd, [la] D[-a de] MMMM, YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Hodiaŭ je] LT', + 'nextDay' => '[Morgaŭ je] LT', + 'nextWeek' => 'dddd [je] LT', + 'lastDay' => '[Hieraŭ je] LT', + 'lastWeek' => '[pasinta] dddd [je] LT', + 'sameElse' => 'L', + ], + 'ordinal' => ':numbera', + 'meridiem' => ['a.t.m.', 'p.t.m.'], + 'months' => ['januaro', 'februaro', 'marto', 'aprilo', 'majo', 'junio', 'julio', 'aŭgusto', 'septembro', 'oktobro', 'novembro', 'decembro'], + 'months_short' => ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aŭg', 'sep', 'okt', 'nov', 'dec'], + 'weekdays' => ['dimanĉo', 'lundo', 'mardo', 'merkredo', 'ĵaŭdo', 'vendredo', 'sabato'], + 'weekdays_short' => ['dim', 'lun', 'mard', 'merk', 'ĵaŭ', 'ven', 'sab'], + 'weekdays_min' => ['di', 'lu', 'ma', 'me', 'ĵa', 've', 'sa'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' kaj '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es.php b/vendor/nesbot/carbon/src/Carbon/Lang/es.php new file mode 100644 index 00000000..1c4fcfd0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es.php @@ -0,0 +1,121 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Kunal Marwaha + * - kostas + * - François B + * - Tim Fish + * - Claire Coloma + * - Steven Heinrich + * - JD Isaacks + * - Raphael Amorim + * - Jorge Y. Castillo + * - Víctor Díaz + * - Diego + * - Sebastian Thierer + * - quinterocesar + * - Daniel Commesse Liévanos (danielcommesse) + * - Pete Scopes (pdscopes) + * - gam04 + */ + +use Carbon\CarbonInterface; + +return [ + 'year' => ':count año|:count años', + 'a_year' => 'un año|:count años', + 'y' => ':count año|:count años', + 'month' => ':count mes|:count meses', + 'a_month' => 'un mes|:count meses', + 'm' => ':count mes|:count meses', + 'week' => ':count semana|:count semanas', + 'a_week' => 'una semana|:count semanas', + 'w' => ':countsem', + 'day' => ':count día|:count días', + 'a_day' => 'un día|:count días', + 'd' => ':countd', + 'hour' => ':count hora|:count horas', + 'a_hour' => 'una hora|:count horas', + 'h' => ':counth', + 'minute' => ':count minuto|:count minutos', + 'a_minute' => 'un minuto|:count minutos', + 'min' => ':countm', + 'second' => ':count segundo|:count segundos', + 'a_second' => 'unos segundos|:count segundos', + 's' => ':counts', + 'millisecond' => ':count milisegundo|:count milisegundos', + 'a_millisecond' => 'un milisegundo|:count milisegundos', + 'ms' => ':countms', + 'microsecond' => ':count microsegundo|:count microsegundos', + 'a_microsecond' => 'un microsegundo|:count microsegundos', + 'µs' => ':countµs', + 'ago' => 'hace :time', + 'from_now' => 'en :time', + 'after' => ':time después', + 'before' => ':time antes', + 'diff_now' => 'ahora mismo', + 'diff_today' => 'hoy', + 'diff_today_regexp' => 'hoy(?:\\s+a)?(?:\\s+las)?', + 'diff_yesterday' => 'ayer', + 'diff_yesterday_regexp' => 'ayer(?:\\s+a)?(?:\\s+las)?', + 'diff_tomorrow' => 'mañana', + 'diff_tomorrow_regexp' => 'mañana(?:\\s+a)?(?:\\s+las)?', + 'diff_before_yesterday' => 'anteayer', + 'diff_after_tomorrow' => 'pasado mañana', + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D [de] MMMM [de] YYYY', + 'LLL' => 'D [de] MMMM [de] YYYY H:mm', + 'LLLL' => 'dddd, D [de] MMMM [de] YYYY H:mm', + ], + 'calendar' => [ + 'sameDay' => function (CarbonInterface $current) { + return '[hoy a la'.($current->hour !== 1 ? 's' : '').'] LT'; + }, + 'nextDay' => function (CarbonInterface $current) { + return '[mañana a la'.($current->hour !== 1 ? 's' : '').'] LT'; + }, + 'nextWeek' => function (CarbonInterface $current) { + return 'dddd [a la'.($current->hour !== 1 ? 's' : '').'] LT'; + }, + 'lastDay' => function (CarbonInterface $current) { + return '[ayer a la'.($current->hour !== 1 ? 's' : '').'] LT'; + }, + 'lastWeek' => function (CarbonInterface $current) { + return '[el] dddd [pasado a la'.($current->hour !== 1 ? 's' : '').'] LT'; + }, + 'sameElse' => 'L', + ], + 'months' => ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'], + 'months_short' => ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sep', 'oct', 'nov', 'dic'], + 'mmm_suffix' => '.', + 'ordinal' => ':numberº', + 'weekdays' => ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado'], + 'weekdays_short' => ['dom.', 'lun.', 'mar.', 'mié.', 'jue.', 'vie.', 'sáb.'], + 'weekdays_min' => ['do', 'lu', 'ma', 'mi', 'ju', 'vi', 'sá'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' y '], + 'meridiem' => ['a. m.', 'p. m.'], + 'ordinal_words' => [ + 'of' => 'de', + 'first' => 'primer', + 'second' => 'segundo', + 'third' => 'tercer', + 'fourth' => 'cuarto', + 'fifth' => 'quinto', + 'last' => 'último', + ], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_419.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_419.php new file mode 100644 index 00000000..a74806e8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_419.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/es.php', [ + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_AR.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_AR.php new file mode 100644 index 00000000..a74806e8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_AR.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/es.php', [ + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_BO.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_BO.php new file mode 100644 index 00000000..c9b8432e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_BO.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/es.php', [ + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_BR.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_BR.php new file mode 100644 index 00000000..378d0547 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_BR.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/es.php', [ + 'first_day_of_week' => 0, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_BZ.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_BZ.php new file mode 100644 index 00000000..378d0547 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_BZ.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/es.php', [ + 'first_day_of_week' => 0, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_CL.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_CL.php new file mode 100644 index 00000000..a74806e8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_CL.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/es.php', [ + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_CO.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_CO.php new file mode 100644 index 00000000..a74806e8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_CO.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/es.php', [ + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_CR.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_CR.php new file mode 100644 index 00000000..553fc09f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_CR.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Free Software Foundation, Inc. bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/es.php', [ + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_CU.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_CU.php new file mode 100644 index 00000000..f02e1a66 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_CU.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/es.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_DO.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_DO.php new file mode 100644 index 00000000..0f855bac --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_DO.php @@ -0,0 +1,31 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - kostas + * - François B + * - Tim Fish + * - Chiel Robben + * - Claire Coloma + * - Steven Heinrich + * - JD Isaacks + * - Raphael Amorim + */ +return array_replace_recursive(require __DIR__.'/es.php', [ + 'diff_before_yesterday' => 'anteayer', + 'formats' => [ + 'LT' => 'h:mm A', + 'LTS' => 'h:mm:ss A', + 'LLL' => 'D [de] MMMM [de] YYYY h:mm A', + 'LLLL' => 'dddd, D [de] MMMM [de] YYYY h:mm A', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_EA.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_EA.php new file mode 100644 index 00000000..f02e1a66 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_EA.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/es.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_EC.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_EC.php new file mode 100644 index 00000000..a74806e8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_EC.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/es.php', [ + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_ES.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_ES.php new file mode 100644 index 00000000..19217c27 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_ES.php @@ -0,0 +1,16 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP bug-glibc-locales@gnu.org + */ +return require __DIR__.'/es.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_GQ.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_GQ.php new file mode 100644 index 00000000..f02e1a66 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_GQ.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/es.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_GT.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_GT.php new file mode 100644 index 00000000..a74806e8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_GT.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/es.php', [ + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_HN.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_HN.php new file mode 100644 index 00000000..a74806e8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_HN.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/es.php', [ + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_IC.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_IC.php new file mode 100644 index 00000000..f02e1a66 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_IC.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/es.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_MX.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_MX.php new file mode 100644 index 00000000..61e14cfa --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_MX.php @@ -0,0 +1,20 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/es.php', [ + 'diff_before_yesterday' => 'antier', + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_NI.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_NI.php new file mode 100644 index 00000000..6b964c14 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_NI.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Free Software Foundation, Inc. bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/es.php', [ + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_PA.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_PA.php new file mode 100644 index 00000000..a74806e8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_PA.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/es.php', [ + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_PE.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_PE.php new file mode 100644 index 00000000..a74806e8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_PE.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/es.php', [ + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_PH.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_PH.php new file mode 100644 index 00000000..deae06a1 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_PH.php @@ -0,0 +1,22 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/es.php', [ + 'first_day_of_week' => 0, + 'formats' => [ + 'LT' => 'h:mm a', + 'LTS' => 'h:mm:ss a', + 'L' => 'D/M/yy', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D [de] MMMM [de] YYYY h:mm a', + 'LLLL' => 'dddd, D [de] MMMM [de] YYYY h:mm a', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_PR.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_PR.php new file mode 100644 index 00000000..6b964c14 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_PR.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Free Software Foundation, Inc. bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/es.php', [ + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_PY.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_PY.php new file mode 100644 index 00000000..a74806e8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_PY.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/es.php', [ + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_SV.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_SV.php new file mode 100644 index 00000000..00db08e2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_SV.php @@ -0,0 +1,20 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/es.php', [ + 'months' => ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'], + 'months_short' => ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sep', 'oct', 'nov', 'dic'], + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_US.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_US.php new file mode 100644 index 00000000..f333136f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_US.php @@ -0,0 +1,38 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Kunal Marwaha + * - Josh Soref + * - Jørn Ølmheim + * - Craig Patik + * - bustta + * - François B + * - Tim Fish + * - Claire Coloma + * - Steven Heinrich + * - JD Isaacks + * - Raphael Amorim + */ +return array_replace_recursive(require __DIR__.'/es.php', [ + 'diff_before_yesterday' => 'anteayer', + 'formats' => [ + 'LT' => 'h:mm A', + 'LTS' => 'h:mm:ss A', + 'L' => 'MM/DD/YYYY', + 'LL' => 'MMMM [de] D [de] YYYY', + 'LLL' => 'MMMM [de] D [de] YYYY h:mm A', + 'LLLL' => 'dddd, MMMM [de] D [de] YYYY h:mm A', + ], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_UY.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_UY.php new file mode 100644 index 00000000..39baff8b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_UY.php @@ -0,0 +1,21 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/es.php', [ + 'months' => ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'setiembre', 'octubre', 'noviembre', 'diciembre'], + 'months_short' => ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'set', 'oct', 'nov', 'dic'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es_VE.php b/vendor/nesbot/carbon/src/Carbon/Lang/es_VE.php new file mode 100644 index 00000000..a74806e8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es_VE.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/es.php', [ + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/et.php b/vendor/nesbot/carbon/src/Carbon/Lang/et.php new file mode 100644 index 00000000..f49c8806 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/et.php @@ -0,0 +1,93 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Philippe Vaucher + * - Andres Ivanov + * - Tsutomu Kuroda + * - tjku + * - Max Melentiev + * - Juanito Fatas + * - RM87 + * - Akira Matsuda + * - Christopher Dell + * - Enrique Vidal + * - Simone Carletti + * - Aaron Patterson + * - Esko Lehtme + * - Mart Karu + * - Nicolás Hock Isaza + * - Kevin Valdek + * - Zahhar Kirillov + * - João Magalhães + * - Ingmar + * - Illimar Tambek + * - Mihkel + */ +return [ + 'year' => ':count aasta|:count aastat', + 'y' => ':count a', + 'month' => ':count kuu|:count kuud', + 'm' => ':count k', + 'week' => ':count nädal|:count nädalat', + 'w' => ':count näd', + 'day' => ':count päev|:count päeva', + 'd' => ':count p', + 'hour' => ':count tund|:count tundi', + 'h' => ':count t', + 'minute' => ':count minut|:count minutit', + 'min' => ':count min', + 'second' => ':count sekund|:count sekundit', + 's' => ':count s', + 'ago' => ':time tagasi', + 'from_now' => ':time pärast', + 'after' => ':time pärast', + 'before' => ':time enne', + 'year_from_now' => ':count aasta', + 'month_from_now' => ':count kuu', + 'week_from_now' => ':count nädala', + 'day_from_now' => ':count päeva', + 'hour_from_now' => ':count tunni', + 'minute_from_now' => ':count minuti', + 'second_from_now' => ':count sekundi', + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'diff_now' => 'nüüd', + 'diff_today' => 'täna', + 'diff_yesterday' => 'eile', + 'diff_tomorrow' => 'homme', + 'diff_before_yesterday' => 'üleeile', + 'diff_after_tomorrow' => 'ülehomme', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D. MMMM YYYY', + 'LLL' => 'D. MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D. MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[täna] LT', + 'nextDay' => '[homme] LT', + 'lastDay' => '[eile] LT', + 'nextWeek' => 'dddd LT', + 'lastWeek' => '[eelmine] dddd LT', + 'sameElse' => 'L', + ], + 'months' => ['jaanuar', 'veebruar', 'märts', 'aprill', 'mai', 'juuni', 'juuli', 'august', 'september', 'oktoober', 'november', 'detsember'], + 'months_short' => ['jaan', 'veebr', 'märts', 'apr', 'mai', 'juuni', 'juuli', 'aug', 'sept', 'okt', 'nov', 'dets'], + 'weekdays' => ['pühapäev', 'esmaspäev', 'teisipäev', 'kolmapäev', 'neljapäev', 'reede', 'laupäev'], + 'weekdays_short' => ['P', 'E', 'T', 'K', 'N', 'R', 'L'], + 'weekdays_min' => ['P', 'E', 'T', 'K', 'N', 'R', 'L'], + 'list' => [', ', ' ja '], + 'meridiem' => ['enne lõunat', 'pärast lõunat'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/et_EE.php b/vendor/nesbot/carbon/src/Carbon/Lang/et_EE.php new file mode 100644 index 00000000..0f112b34 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/et_EE.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/et.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/eu.php b/vendor/nesbot/carbon/src/Carbon/Lang/eu.php new file mode 100644 index 00000000..a543f1a6 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/eu.php @@ -0,0 +1,67 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - François B + * - JD Isaacks + */ +return [ + 'year' => 'urte bat|:count urte', + 'y' => 'Urte 1|:count urte', + 'month' => 'hilabete bat|:count hilabete', + 'm' => 'Hile 1|:count hile', + 'week' => 'Aste 1|:count aste', + 'w' => 'Aste 1|:count aste', + 'day' => 'egun bat|:count egun', + 'd' => 'Egun 1|:count egun', + 'hour' => 'ordu bat|:count ordu', + 'h' => 'Ordu 1|:count ordu', + 'minute' => 'minutu bat|:count minutu', + 'min' => 'Minutu 1|:count minutu', + 'second' => 'segundo batzuk|:count segundo', + 's' => 'Segundu 1|:count segundu', + 'ago' => 'duela :time', + 'from_now' => ':time barru', + 'after' => ':time geroago', + 'before' => ':time lehenago', + 'diff_now' => 'orain', + 'diff_today' => 'gaur', + 'diff_yesterday' => 'atzo', + 'diff_tomorrow' => 'bihar', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY-MM-DD', + 'LL' => 'YYYY[ko] MMMM[ren] D[a]', + 'LLL' => 'YYYY[ko] MMMM[ren] D[a] HH:mm', + 'LLLL' => 'dddd, YYYY[ko] MMMM[ren] D[a] HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[gaur] LT[etan]', + 'nextDay' => '[bihar] LT[etan]', + 'nextWeek' => 'dddd LT[etan]', + 'lastDay' => '[atzo] LT[etan]', + 'lastWeek' => '[aurreko] dddd LT[etan]', + 'sameElse' => 'L', + ], + 'ordinal' => ':number.', + 'months' => ['urtarrila', 'otsaila', 'martxoa', 'apirila', 'maiatza', 'ekaina', 'uztaila', 'abuztua', 'iraila', 'urria', 'azaroa', 'abendua'], + 'months_short' => ['urt.', 'ots.', 'mar.', 'api.', 'mai.', 'eka.', 'uzt.', 'abu.', 'ira.', 'urr.', 'aza.', 'abe.'], + 'weekdays' => ['igandea', 'astelehena', 'asteartea', 'asteazkena', 'osteguna', 'ostirala', 'larunbata'], + 'weekdays_short' => ['ig.', 'al.', 'ar.', 'az.', 'og.', 'ol.', 'lr.'], + 'weekdays_min' => ['ig', 'al', 'ar', 'az', 'og', 'ol', 'lr'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' eta '], + 'meridiem' => ['g', 'a'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/eu_ES.php b/vendor/nesbot/carbon/src/Carbon/Lang/eu_ES.php new file mode 100644 index 00000000..0d1e82a9 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/eu_ES.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/eu.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ewo.php b/vendor/nesbot/carbon/src/Carbon/Lang/ewo.php new file mode 100644 index 00000000..7808ab50 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ewo.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['kíkíríg', 'ngəgógəle'], + 'weekdays' => ['sɔ́ndɔ', 'mɔ́ndi', 'sɔ́ndɔ məlú mə́bɛ̌', 'sɔ́ndɔ məlú mə́lɛ́', 'sɔ́ndɔ məlú mə́nyi', 'fúladé', 'séradé'], + 'weekdays_short' => ['sɔ́n', 'mɔ́n', 'smb', 'sml', 'smn', 'fúl', 'sér'], + 'weekdays_min' => ['sɔ́n', 'mɔ́n', 'smb', 'sml', 'smn', 'fúl', 'sér'], + 'months' => ['ngɔn osú', 'ngɔn bɛ̌', 'ngɔn lála', 'ngɔn nyina', 'ngɔn tána', 'ngɔn saməna', 'ngɔn zamgbála', 'ngɔn mwom', 'ngɔn ebulú', 'ngɔn awóm', 'ngɔn awóm ai dziá', 'ngɔn awóm ai bɛ̌'], + 'months_short' => ['ngo', 'ngb', 'ngl', 'ngn', 'ngt', 'ngs', 'ngz', 'ngm', 'nge', 'nga', 'ngad', 'ngab'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + + // Too unreliable + /* + 'year' => ':count mbu', // less reliable + 'y' => ':count mbu', // less reliable + 'a_year' => ':count mbu', // less reliable + + 'month' => ':count ngòn', // less reliable + 'm' => ':count ngòn', // less reliable + 'a_month' => ':count ngòn', // less reliable + + 'week' => ':count mësë', // less reliable + 'w' => ':count mësë', // less reliable + 'a_week' => ':count mësë', // less reliable + + 'day' => ':count mësë', // less reliable + 'd' => ':count mësë', // less reliable + 'a_day' => ':count mësë', // less reliable + + 'hour' => ':count awola', // less reliable + 'h' => ':count awola', // less reliable + 'a_hour' => ':count awola', // less reliable + + 'minute' => ':count awola', // less reliable + 'min' => ':count awola', // less reliable + 'a_minute' => ':count awola', // less reliable + */ +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fa.php b/vendor/nesbot/carbon/src/Carbon/Lang/fa.php new file mode 100644 index 00000000..72e03085 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fa.php @@ -0,0 +1,84 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - François B + * - Nasser Ghiasi + * - JD Isaacks + * - Hossein Jabbari + * - nimamo + * - hafezdivandari + * - Hassan Pezeshk (hpez) + */ +return [ + 'year' => ':count سال', + 'a_year' => 'یک سال'.'|:count '.'سال', + 'y' => ':count سال', + 'month' => ':count ماه', + 'a_month' => 'یک ماه'.'|:count '.'ماه', + 'm' => ':count ماه', + 'week' => ':count هفته', + 'a_week' => 'یک هفته'.'|:count '.'هفته', + 'w' => ':count هفته', + 'day' => ':count روز', + 'a_day' => 'یک روز'.'|:count '.'روز', + 'd' => ':count روز', + 'hour' => ':count ساعت', + 'a_hour' => 'یک ساعت'.'|:count '.'ساعت', + 'h' => ':count ساعت', + 'minute' => ':count دقیقه', + 'a_minute' => 'یک دقیقه'.'|:count '.'دقیقه', + 'min' => ':count دقیقه', + 'second' => ':count ثانیه', + 's' => ':count ثانیه', + 'ago' => ':time پیش', + 'from_now' => ':time دیگر', + 'after' => ':time پس از', + 'before' => ':time پیش از', + 'diff_now' => 'اکنون', + 'diff_today' => 'امروز', + 'diff_today_regexp' => 'امروز(?:\\s+ساعت)?', + 'diff_yesterday' => 'دیروز', + 'diff_yesterday_regexp' => 'دیروز(?:\\s+ساعت)?', + 'diff_tomorrow' => 'فردا', + 'diff_tomorrow_regexp' => 'فردا(?:\\s+ساعت)?', + 'formats' => [ + 'LT' => 'OH:Om', + 'LTS' => 'OH:Om:Os', + 'L' => 'OD/OM/OY', + 'LL' => 'OD MMMM OY', + 'LLL' => 'OD MMMM OY OH:Om', + 'LLLL' => 'dddd, OD MMMM OY OH:Om', + ], + 'calendar' => [ + 'sameDay' => '[امروز ساعت] LT', + 'nextDay' => '[فردا ساعت] LT', + 'nextWeek' => 'dddd [ساعت] LT', + 'lastDay' => '[دیروز ساعت] LT', + 'lastWeek' => 'dddd [پیش] [ساعت] LT', + 'sameElse' => 'L', + ], + 'ordinal' => ':timeم', + 'meridiem' => ['قبل از ظهر', 'بعد از ظهر'], + 'months' => ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'], + 'months_short' => ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'], + 'weekdays' => ['یکشنبه', 'دوشنبه', 'سه‌شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'], + 'weekdays_short' => ['یکشنبه', 'دوشنبه', 'سه‌شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'], + 'weekdays_min' => ['ی', 'د', 'س', 'چ', 'پ', 'ج', 'ش'], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, + 'list' => ['، ', ' و '], + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰۴', '۰۵', '۰۶', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱۴', '۱۵', '۱۶', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲۴', '۲۵', '۲۶', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳۴', '۳۵', '۳۶', '۳۷', '۳۸', '۳۹', '۴۰', '۴۱', '۴۲', '۴۳', '۴۴', '۴۵', '۴۶', '۴۷', '۴۸', '۴۹', '۵۰', '۵۱', '۵۲', '۵۳', '۵۴', '۵۵', '۵۶', '۵۷', '۵۸', '۵۹', '۶۰', '۶۱', '۶۲', '۶۳', '۶۴', '۶۵', '۶۶', '۶۷', '۶۸', '۶۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷۴', '۷۵', '۷۶', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸۴', '۸۵', '۸۶', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹۴', '۹۵', '۹۶', '۹۷', '۹۸', '۹۹'], + 'months_short_standalone' => ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'], + 'weekend' => [5, 5], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fa_AF.php b/vendor/nesbot/carbon/src/Carbon/Lang/fa_AF.php new file mode 100644 index 00000000..69471004 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fa_AF.php @@ -0,0 +1,21 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/fa.php', [ + 'meridiem' => ['ق', 'ب'], + 'weekend' => [4, 5], + 'formats' => [ + 'L' => 'OY/OM/OD', + 'LL' => 'OD MMM OY', + 'LLL' => 'OD MMMM OY،‏ H:mm', + 'LLLL' => 'dddd OD MMMM OY،‏ H:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fa_IR.php b/vendor/nesbot/carbon/src/Carbon/Lang/fa_IR.php new file mode 100644 index 00000000..08d01825 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fa_IR.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fa.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ff.php b/vendor/nesbot/carbon/src/Carbon/Lang/ff.php new file mode 100644 index 00000000..9525c95a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ff.php @@ -0,0 +1,60 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM, YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'months' => ['siilo', 'colte', 'mbooy', 'seeɗto', 'duujal', 'korse', 'morso', 'juko', 'siilto', 'yarkomaa', 'jolal', 'bowte'], + 'months_short' => ['sii', 'col', 'mbo', 'see', 'duu', 'kor', 'mor', 'juk', 'slt', 'yar', 'jol', 'bow'], + 'weekdays' => ['dewo', 'aaɓnde', 'mawbaare', 'njeslaare', 'naasaande', 'mawnde', 'hoore-biir'], + 'weekdays_short' => ['dew', 'aaɓ', 'maw', 'nje', 'naa', 'mwd', 'hbi'], + 'weekdays_min' => ['dew', 'aaɓ', 'maw', 'nje', 'naa', 'mwd', 'hbi'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['subaka', 'kikiiɗe'], + + 'year' => ':count baret', // less reliable + 'y' => ':count baret', // less reliable + 'a_year' => ':count baret', // less reliable + + 'month' => ':count lewru', // less reliable + 'm' => ':count lewru', // less reliable + 'a_month' => ':count lewru', // less reliable + + 'week' => ':count naange', // less reliable + 'w' => ':count naange', // less reliable + 'a_week' => ':count naange', // less reliable + + 'day' => ':count dian', // less reliable + 'd' => ':count dian', // less reliable + 'a_day' => ':count dian', // less reliable + + 'hour' => ':count montor', // less reliable + 'h' => ':count montor', // less reliable + 'a_hour' => ':count montor', // less reliable + + 'minute' => ':count tokossuoum', // less reliable + 'min' => ':count tokossuoum', // less reliable + 'a_minute' => ':count tokossuoum', // less reliable + + 'second' => ':count tenen', // less reliable + 's' => ':count tenen', // less reliable + 'a_second' => ':count tenen', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ff_CM.php b/vendor/nesbot/carbon/src/Carbon/Lang/ff_CM.php new file mode 100644 index 00000000..b797ac09 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ff_CM.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/ff.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ff_GN.php b/vendor/nesbot/carbon/src/Carbon/Lang/ff_GN.php new file mode 100644 index 00000000..b797ac09 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ff_GN.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/ff.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ff_MR.php b/vendor/nesbot/carbon/src/Carbon/Lang/ff_MR.php new file mode 100644 index 00000000..2f4c29f6 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ff_MR.php @@ -0,0 +1,21 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ff.php', [ + 'formats' => [ + 'LT' => 'h:mm a', + 'LTS' => 'h:mm:ss a', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMM, YYYY', + 'LLL' => 'D MMMM YYYY h:mm a', + 'LLLL' => 'dddd D MMMM YYYY h:mm a', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ff_SN.php b/vendor/nesbot/carbon/src/Carbon/Lang/ff_SN.php new file mode 100644 index 00000000..1e4c8b6c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ff_SN.php @@ -0,0 +1,16 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Pular-Fulfulde.org Ibrahima Sarr admin@pulaar-fulfulde.org + */ +return require __DIR__.'/ff.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fi.php b/vendor/nesbot/carbon/src/Carbon/Lang/fi.php new file mode 100644 index 00000000..edf2d6d3 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fi.php @@ -0,0 +1,88 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Philippe Vaucher + * - Janne Warén + * - digitalfrost + * - Tsutomu Kuroda + * - Roope Salmi + * - tjku + * - Max Melentiev + * - Sami Haahtinen + * - Teemu Leisti + * - Artem Ignatyev + * - Akira Matsuda + * - Christopher Dell + * - Enrique Vidal + * - Simone Carletti + * - Robert Bjarnason + * - Aaron Patterson + * - Nicolás Hock Isaza + * - Tom Hughes + * - Sven Fuchs + * - Petri Kivikangas + * - Nizar Jouini + * - Marko Seppae + * - Tomi Mynttinen (Pikseli) + * - Petteri (powergrip) + */ +return [ + 'year' => ':count vuosi|:count vuotta', + 'y' => ':count v', + 'month' => ':count kuukausi|:count kuukautta', + 'm' => ':count kk', + 'week' => ':count viikko|:count viikkoa', + 'w' => ':count vk', + 'day' => ':count päivä|:count päivää', + 'd' => ':count pv', + 'hour' => ':count tunti|:count tuntia', + 'h' => ':count t', + 'minute' => ':count minuutti|:count minuuttia', + 'min' => ':count min', + 'second' => ':count sekunti|:count sekuntia', + 'a_second' => 'muutama sekunti|:count sekuntia', + 's' => ':count s', + 'ago' => ':time sitten', + 'from_now' => ':time päästä', + 'year_from_now' => ':count vuoden', + 'month_from_now' => ':count kuukauden', + 'week_from_now' => ':count viikon', + 'day_from_now' => ':count päivän', + 'hour_from_now' => ':count tunnin', + 'minute_from_now' => ':count minuutin', + 'second_from_now' => ':count sekunnin', + 'after' => ':time sen jälkeen', + 'before' => ':time ennen', + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' ja '], + 'diff_now' => 'nyt', + 'diff_yesterday' => 'eilen', + 'diff_tomorrow' => 'huomenna', + 'formats' => [ + 'LT' => 'HH.mm', + 'LTS' => 'HH.mm:ss', + 'L' => 'D.M.YYYY', + 'LL' => 'dddd D. MMMM[ta] YYYY', + 'll' => 'ddd D. MMM YYYY', + 'LLL' => 'D.MM. HH.mm', + 'LLLL' => 'D. MMMM[ta] YYYY HH.mm', + 'llll' => 'D. MMM YY HH.mm', + ], + 'weekdays' => ['sunnuntai', 'maanantai', 'tiistai', 'keskiviikko', 'torstai', 'perjantai', 'lauantai'], + 'weekdays_short' => ['su', 'ma', 'ti', 'ke', 'to', 'pe', 'la'], + 'weekdays_min' => ['su', 'ma', 'ti', 'ke', 'to', 'pe', 'la'], + 'months' => ['tammikuu', 'helmikuu', 'maaliskuu', 'huhtikuu', 'toukokuu', 'kesäkuu', 'heinäkuu', 'elokuu', 'syyskuu', 'lokakuu', 'marraskuu', 'joulukuu'], + 'months_short' => ['tammi', 'helmi', 'maalis', 'huhti', 'touko', 'kesä', 'heinä', 'elo', 'syys', 'loka', 'marras', 'joulu'], + 'meridiem' => ['aamupäivä', 'iltapäivä'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fi_FI.php b/vendor/nesbot/carbon/src/Carbon/Lang/fi_FI.php new file mode 100644 index 00000000..920f1caa --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fi_FI.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fi.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fil.php b/vendor/nesbot/carbon/src/Carbon/Lang/fil.php new file mode 100644 index 00000000..61114e3a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fil.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/fil_PH.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fil_PH.php b/vendor/nesbot/carbon/src/Carbon/Lang/fil_PH.php new file mode 100644 index 00000000..bcf15807 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fil_PH.php @@ -0,0 +1,62 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Rene Torres Rene Torres, Pablo Saratxaga rgtorre@rocketmail.com, pablo@mandrakesoft.com + * - Jaycee Mariano (alohajaycee) + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'MM/DD/YY', + ], + 'months' => ['Enero', 'Pebrero', 'Marso', 'Abril', 'Mayo', 'Hunyo', 'Hulyo', 'Agosto', 'Setyembre', 'Oktubre', 'Nobyembre', 'Disyembre'], + 'months_short' => ['Ene', 'Peb', 'Mar', 'Abr', 'May', 'Hun', 'Hul', 'Ago', 'Set', 'Okt', 'Nob', 'Dis'], + 'weekdays' => ['Linggo', 'Lunes', 'Martes', 'Miyerkoles', 'Huwebes', 'Biyernes', 'Sabado'], + 'weekdays_short' => ['Lin', 'Lun', 'Mar', 'Miy', 'Huw', 'Biy', 'Sab'], + 'weekdays_min' => ['Lin', 'Lun', 'Mar', 'Miy', 'Huw', 'Biy', 'Sab'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['N.U.', 'N.H.'], + + 'before' => ':time bago', + 'after' => ':time pagkatapos', + + 'year' => ':count taon', + 'y' => ':count taon', + 'a_year' => ':count taon', + + 'month' => ':count buwan', + 'm' => ':count buwan', + 'a_month' => ':count buwan', + + 'week' => ':count linggo', + 'w' => ':count linggo', + 'a_week' => ':count linggo', + + 'day' => ':count araw', + 'd' => ':count araw', + 'a_day' => ':count araw', + + 'hour' => ':count oras', + 'h' => ':count oras', + 'a_hour' => ':count oras', + + 'minute' => ':count minuto', + 'min' => ':count minuto', + 'a_minute' => ':count minuto', + + 'second' => ':count segundo', + 's' => ':count segundo', + 'a_second' => ':count segundo', + + 'ago' => ':time ang nakalipas', + 'from_now' => 'sa :time', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fo.php b/vendor/nesbot/carbon/src/Carbon/Lang/fo.php new file mode 100644 index 00000000..6a14a6fb --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fo.php @@ -0,0 +1,69 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Kristian Sakarisson + * - François B + * - JD Isaacks + * - Sverri Mohr Olsen + */ +return [ + 'year' => 'eitt ár|:count ár', + 'y' => ':count ár|:count ár', + 'month' => 'ein mánaði|:count mánaðir', + 'm' => ':count mánaður|:count mánaðir', + 'week' => ':count vika|:count vikur', + 'w' => ':count vika|:count vikur', + 'day' => 'ein dagur|:count dagar', + 'd' => ':count dag|:count dagar', + 'hour' => 'ein tími|:count tímar', + 'h' => ':count tími|:count tímar', + 'minute' => 'ein minutt|:count minuttir', + 'min' => ':count minutt|:count minuttir', + 'second' => 'fá sekund|:count sekundir', + 's' => ':count sekund|:count sekundir', + 'ago' => ':time síðani', + 'from_now' => 'um :time', + 'after' => ':time aftaná', + 'before' => ':time áðrenn', + 'diff_today' => 'Í', + 'diff_yesterday' => 'Í', + 'diff_yesterday_regexp' => 'Í(?:\\s+gjár)?(?:\\s+kl.)?', + 'diff_tomorrow' => 'Í', + 'diff_tomorrow_regexp' => 'Í(?:\\s+morgin)?(?:\\s+kl.)?', + 'diff_today_regexp' => 'Í(?:\\s+dag)?(?:\\s+kl.)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D. MMMM, YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Í dag kl.] LT', + 'nextDay' => '[Í morgin kl.] LT', + 'nextWeek' => 'dddd [kl.] LT', + 'lastDay' => '[Í gjár kl.] LT', + 'lastWeek' => '[síðstu] dddd [kl] LT', + 'sameElse' => 'L', + ], + 'ordinal' => ':number.', + 'months' => ['januar', 'februar', 'mars', 'apríl', 'mai', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'desember'], + 'months_short' => ['jan', 'feb', 'mar', 'apr', 'mai', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'des'], + 'weekdays' => ['sunnudagur', 'mánadagur', 'týsdagur', 'mikudagur', 'hósdagur', 'fríggjadagur', 'leygardagur'], + 'weekdays_short' => ['sun', 'mán', 'týs', 'mik', 'hós', 'frí', 'ley'], + 'weekdays_min' => ['su', 'má', 'tý', 'mi', 'hó', 'fr', 'le'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' og '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fo_DK.php b/vendor/nesbot/carbon/src/Carbon/Lang/fo_DK.php new file mode 100644 index 00000000..657f2c5b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fo_DK.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/fo.php', [ + 'formats' => [ + 'L' => 'DD.MM.yy', + 'LL' => 'DD.MM.YYYY', + 'LLL' => 'D. MMMM YYYY, HH:mm', + 'LLLL' => 'dddd, D. MMMM YYYY, HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fo_FO.php b/vendor/nesbot/carbon/src/Carbon/Lang/fo_FO.php new file mode 100644 index 00000000..6d736167 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fo_FO.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fo.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr.php new file mode 100644 index 00000000..f4c7247b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr.php @@ -0,0 +1,123 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Dieter Sting + * - François B + * - Maxime VALY + * - JD Isaacks + * - Dieter Sting + * - François B + * - JD Isaacks + * - Sebastian Thierer + * - Fastfuel + * - Pete Scopes (pdscopes) + */ +return [ + 'year' => ':count an|:count ans', + 'a_year' => 'un an|:count ans', + 'y' => ':count an|:count ans', + 'month' => ':count mois|:count mois', + 'a_month' => 'un mois|:count mois', + 'm' => ':count mois', + 'week' => ':count semaine|:count semaines', + 'a_week' => 'une semaine|:count semaines', + 'w' => ':count sem.', + 'day' => ':count jour|:count jours', + 'a_day' => 'un jour|:count jours', + 'd' => ':count j', + 'hour' => ':count heure|:count heures', + 'a_hour' => 'une heure|:count heures', + 'h' => ':count h', + 'minute' => ':count minute|:count minutes', + 'a_minute' => 'une minute|:count minutes', + 'min' => ':count min', + 'second' => ':count seconde|:count secondes', + 'a_second' => 'quelques secondes|:count secondes', + 's' => ':count s', + 'millisecond' => ':count milliseconde|:count millisecondes', + 'a_millisecond' => 'une milliseconde|:count millisecondes', + 'ms' => ':countms', + 'microsecond' => ':count microseconde|:count microsecondes', + 'a_microsecond' => 'une microseconde|:count microsecondes', + 'µs' => ':countµs', + 'ago' => 'il y a :time', + 'from_now' => 'dans :time', + 'after' => ':time après', + 'before' => ':time avant', + 'diff_now' => "à l'instant", + 'diff_today' => "aujourd'hui", + 'diff_today_regexp' => "aujourd'hui(?:\s+à)?", + 'diff_yesterday' => 'hier', + 'diff_yesterday_regexp' => 'hier(?:\s+à)?', + 'diff_tomorrow' => 'demain', + 'diff_tomorrow_regexp' => 'demain(?:\s+à)?', + 'diff_before_yesterday' => 'avant-hier', + 'diff_after_tomorrow' => 'après-demain', + 'period_recurrences' => ':count fois', + 'period_interval' => 'tous les :interval', + 'period_start_date' => 'de :date', + 'period_end_date' => 'à :date', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Aujourd’hui à] LT', + 'nextDay' => '[Demain à] LT', + 'nextWeek' => 'dddd [à] LT', + 'lastDay' => '[Hier à] LT', + 'lastWeek' => 'dddd [dernier à] LT', + 'sameElse' => 'L', + ], + 'months' => ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'], + 'months_short' => ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'], + 'weekdays' => ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'], + 'weekdays_short' => ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'], + 'weekdays_min' => ['di', 'lu', 'ma', 'me', 'je', 've', 'sa'], + 'ordinal' => function ($number, $period) { + switch ($period) { + // In French, only the first has to be ordinal, other number remains cardinal + // @link https://fr.wikihow.com/%C3%A9crire-la-date-en-fran%C3%A7ais + case 'D': + return $number.($number === 1 ? 'er' : ''); + + default: + case 'M': + case 'Q': + case 'DDD': + case 'd': + return $number.($number === 1 ? 'er' : 'e'); + + // Words with feminine grammatical gender: semaine + case 'w': + case 'W': + return $number.($number === 1 ? 're' : 'e'); + } + }, + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' et '], + 'ordinal_words' => [ + 'of' => 'de', + 'first' => 'premier', + 'second' => 'deuxième', + 'third' => 'troisième', + 'fourth' => 'quatrième', + 'fifth' => 'cinquième', + 'last' => 'dernier', + ], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_BE.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_BE.php new file mode 100644 index 00000000..f6cafe87 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_BE.php @@ -0,0 +1,18 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/fr.php', [ + 'months_short' => ['jan', 'fév', 'mar', 'avr', 'mai', 'jun', 'jui', 'aoû', 'sep', 'oct', 'nov', 'déc'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_BF.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_BF.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_BF.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_BI.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_BI.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_BI.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_BJ.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_BJ.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_BJ.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_BL.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_BL.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_BL.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_CA.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_CA.php new file mode 100644 index 00000000..c9f6346f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_CA.php @@ -0,0 +1,25 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Dieter Sting + * - François B + * - Maxime VALY + * - JD Isaacks + */ +return array_replace_recursive(require __DIR__.'/fr.php', [ + 'formats' => [ + 'L' => 'YYYY-MM-DD', + ], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_CD.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_CD.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_CD.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_CF.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_CF.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_CF.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_CG.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_CG.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_CG.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_CH.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_CH.php new file mode 100644 index 00000000..8674c27d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_CH.php @@ -0,0 +1,24 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Dieter Sting + * - François B + * - Gaspard Bucher + * - Maxime VALY + * - JD Isaacks + */ +return array_replace_recursive(require __DIR__.'/fr.php', [ + 'formats' => [ + 'L' => 'DD.MM.YYYY', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_CI.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_CI.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_CI.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_CM.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_CM.php new file mode 100644 index 00000000..67d37878 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_CM.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/fr.php', [ + 'meridiem' => ['mat.', 'soir'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_DJ.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_DJ.php new file mode 100644 index 00000000..2f060869 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_DJ.php @@ -0,0 +1,22 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/fr.php', [ + 'first_day_of_week' => 6, + 'formats' => [ + 'LT' => 'h:mm a', + 'LTS' => 'h:mm:ss a', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY h:mm a', + 'LLLL' => 'dddd D MMMM YYYY h:mm a', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_DZ.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_DZ.php new file mode 100644 index 00000000..ae8db5fa --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_DZ.php @@ -0,0 +1,23 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/fr.php', [ + 'first_day_of_week' => 6, + 'weekend' => [5, 6], + 'formats' => [ + 'LT' => 'h:mm a', + 'LTS' => 'h:mm:ss a', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY h:mm a', + 'LLLL' => 'dddd D MMMM YYYY h:mm a', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_FR.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_FR.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_FR.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_GA.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_GA.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_GA.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_GF.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_GF.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_GF.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_GN.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_GN.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_GN.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_GP.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_GP.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_GP.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_GQ.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_GQ.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_GQ.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_HT.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_HT.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_HT.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_KM.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_KM.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_KM.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_LU.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_LU.php new file mode 100644 index 00000000..8e37d852 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_LU.php @@ -0,0 +1,21 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/fr.php', [ + 'formats' => [ + 'L' => 'DD.MM.YYYY', + ], + 'months_short' => ['jan', 'fév', 'mar', 'avr', 'mai', 'jun', 'jui', 'aoû', 'sep', 'oct', 'nov', 'déc'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_MA.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_MA.php new file mode 100644 index 00000000..1bf034dc --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_MA.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/fr.php', [ + 'first_day_of_week' => 6, + 'weekend' => [5, 6], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_MC.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_MC.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_MC.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_MF.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_MF.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_MF.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_MG.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_MG.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_MG.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_ML.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_ML.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_ML.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_MQ.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_MQ.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_MQ.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_MR.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_MR.php new file mode 100644 index 00000000..37cf83f0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_MR.php @@ -0,0 +1,21 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/fr.php', [ + 'formats' => [ + 'LT' => 'h:mm a', + 'LTS' => 'h:mm:ss a', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY h:mm a', + 'LLLL' => 'dddd D MMMM YYYY h:mm a', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_MU.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_MU.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_MU.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_NC.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_NC.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_NC.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_NE.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_NE.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_NE.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_PF.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_PF.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_PF.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_PM.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_PM.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_PM.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_RE.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_RE.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_RE.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_RW.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_RW.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_RW.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_SC.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_SC.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_SC.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_SN.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_SN.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_SN.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_SY.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_SY.php new file mode 100644 index 00000000..ae8db5fa --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_SY.php @@ -0,0 +1,23 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/fr.php', [ + 'first_day_of_week' => 6, + 'weekend' => [5, 6], + 'formats' => [ + 'LT' => 'h:mm a', + 'LTS' => 'h:mm:ss a', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY h:mm a', + 'LLLL' => 'dddd D MMMM YYYY h:mm a', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_TD.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_TD.php new file mode 100644 index 00000000..37cf83f0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_TD.php @@ -0,0 +1,21 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/fr.php', [ + 'formats' => [ + 'LT' => 'h:mm a', + 'LTS' => 'h:mm:ss a', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY h:mm a', + 'LLLL' => 'dddd D MMMM YYYY h:mm a', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_TG.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_TG.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_TG.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_TN.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_TN.php new file mode 100644 index 00000000..6905e7a8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_TN.php @@ -0,0 +1,22 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/fr.php', [ + 'weekend' => [5, 6], + 'formats' => [ + 'LT' => 'h:mm a', + 'LTS' => 'h:mm:ss a', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY h:mm a', + 'LLLL' => 'dddd D MMMM YYYY h:mm a', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_VU.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_VU.php new file mode 100644 index 00000000..37cf83f0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_VU.php @@ -0,0 +1,21 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/fr.php', [ + 'formats' => [ + 'LT' => 'h:mm a', + 'LTS' => 'h:mm:ss a', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY h:mm a', + 'LLLL' => 'dddd D MMMM YYYY h:mm a', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_WF.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_WF.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_WF.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr_YT.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr_YT.php new file mode 100644 index 00000000..ec3ee359 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr_YT.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/fr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fur.php b/vendor/nesbot/carbon/src/Carbon/Lang/fur.php new file mode 100644 index 00000000..36c2564f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fur.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/fur_IT.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fur_IT.php b/vendor/nesbot/carbon/src/Carbon/Lang/fur_IT.php new file mode 100644 index 00000000..0147a596 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fur_IT.php @@ -0,0 +1,39 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Pablo Saratxaga pablo@mandrakesoft.com + */ +return [ + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD. MM. YY', + 'LL' => 'DD di MMMM dal YYYY', + 'LLL' => 'DD di MMM HH:mm', + 'LLLL' => 'DD di MMMM dal YYYY HH:mm', + ], + 'months' => ['zenâr', 'fevrâr', 'març', 'avrîl', 'mai', 'jugn', 'lui', 'avost', 'setembar', 'otubar', 'novembar', 'dicembar'], + 'months_short' => ['zen', 'fev', 'mar', 'avr', 'mai', 'jug', 'lui', 'avo', 'set', 'otu', 'nov', 'dic'], + 'weekdays' => ['domenie', 'lunis', 'martars', 'miercus', 'joibe', 'vinars', 'sabide'], + 'weekdays_short' => ['dom', 'lun', 'mar', 'mie', 'joi', 'vin', 'sab'], + 'weekdays_min' => ['dom', 'lun', 'mar', 'mie', 'joi', 'vin', 'sab'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'year' => ':count an', + 'month' => ':count mês', + 'week' => ':count setemane', + 'day' => ':count zornade', + 'hour' => ':count ore', + 'minute' => ':count minût', + 'second' => ':count secont', +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fy.php b/vendor/nesbot/carbon/src/Carbon/Lang/fy.php new file mode 100644 index 00000000..c1b54397 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fy.php @@ -0,0 +1,76 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - François B + * - Tim Fish + * - JD Isaacks + */ +return [ + 'year' => ':count jier|:count jierren', + 'a_year' => 'ien jier|:count jierren', + 'y' => ':count j', + 'month' => ':count moanne|:count moannen', + 'a_month' => 'ien moanne|:count moannen', + 'm' => ':count moa.', + 'week' => ':count wike|:count wiken', + 'a_week' => 'in wike|:count wiken', + 'a' => ':count w.', + 'day' => ':count dei|:count dagen', + 'a_day' => 'ien dei|:count dagen', + 'd' => ':count d.', + 'hour' => ':count oere|:count oeren', + 'a_hour' => 'ien oere|:count oeren', + 'h' => ':count o.', + 'minute' => ':count minút|:count minuten', + 'a_minute' => 'ien minút|:count minuten', + 'min' => ':count min.', + 'second' => ':count sekonde|:count sekonden', + 'a_second' => 'in pear sekonden|:count sekonden', + 's' => ':count s.', + 'ago' => ':time lyn', + 'from_now' => 'oer :time', + 'diff_yesterday' => 'juster', + 'diff_yesterday_regexp' => 'juster(?:\\s+om)?', + 'diff_today' => 'hjoed', + 'diff_today_regexp' => 'hjoed(?:\\s+om)?', + 'diff_tomorrow' => 'moarn', + 'diff_tomorrow_regexp' => 'moarn(?:\\s+om)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD-MM-YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[hjoed om] LT', + 'nextDay' => '[moarn om] LT', + 'nextWeek' => 'dddd [om] LT', + 'lastDay' => '[juster om] LT', + 'lastWeek' => '[ôfrûne] dddd [om] LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + return $number.(($number === 1 || $number === 8 || $number >= 20) ? 'ste' : 'de'); + }, + 'months' => ['jannewaris', 'febrewaris', 'maart', 'april', 'maaie', 'juny', 'july', 'augustus', 'septimber', 'oktober', 'novimber', 'desimber'], + 'months_short' => ['jan', 'feb', 'mrt', 'apr', 'mai', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'des'], + 'mmm_suffix' => '.', + 'weekdays' => ['snein', 'moandei', 'tiisdei', 'woansdei', 'tongersdei', 'freed', 'sneon'], + 'weekdays_short' => ['si.', 'mo.', 'ti.', 'wo.', 'to.', 'fr.', 'so.'], + 'weekdays_min' => ['Si', 'Mo', 'Ti', 'Wo', 'To', 'Fr', 'So'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' en '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fy_DE.php b/vendor/nesbot/carbon/src/Carbon/Lang/fy_DE.php new file mode 100644 index 00000000..8559d5c2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fy_DE.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - information from Kenneth Christiansen Kenneth Christiansen, Pablo Saratxaga kenneth@gnu.org, pablo@mandriva.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD.MM.YYYY', + ], + 'months' => ['Jaunuwoa', 'Februwoa', 'Moaz', 'Aprell', 'Mai', 'Juni', 'Juli', 'August', 'Septamba', 'Oktoba', 'Nowamba', 'Dezamba'], + 'months_short' => ['Jan', 'Feb', 'Moz', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Now', 'Dez'], + 'weekdays' => ['Sinndag', 'Mondag', 'Dingsdag', 'Meddwäakj', 'Donnadag', 'Friedag', 'Sinnowend'], + 'weekdays_short' => ['Sdg', 'Mdg', 'Dsg', 'Mwk', 'Ddg', 'Fdg', 'Swd'], + 'weekdays_min' => ['Sdg', 'Mdg', 'Dsg', 'Mwk', 'Ddg', 'Fdg', 'Swd'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fy_NL.php b/vendor/nesbot/carbon/src/Carbon/Lang/fy_NL.php new file mode 100644 index 00000000..01cc96c3 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fy_NL.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Free Software Foundation, Inc. bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/fy.php', [ + 'formats' => [ + 'L' => 'DD-MM-YY', + ], + 'months' => ['Jannewaris', 'Febrewaris', 'Maart', 'April', 'Maaie', 'Juny', 'July', 'Augustus', 'Septimber', 'Oktober', 'Novimber', 'Desimber'], + 'months_short' => ['Jan', 'Feb', 'Mrt', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'], + 'weekdays' => ['Snein', 'Moandei', 'Tiisdei', 'Woansdei', 'Tongersdei', 'Freed', 'Sneon'], + 'weekdays_short' => ['Sn', 'Mo', 'Ti', 'Wo', 'To', 'Fr', 'Sn'], + 'weekdays_min' => ['Sn', 'Mo', 'Ti', 'Wo', 'To', 'Fr', 'Sn'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ga.php b/vendor/nesbot/carbon/src/Carbon/Lang/ga.php new file mode 100644 index 00000000..9f07a26c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ga.php @@ -0,0 +1,77 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Thanks to André Silva : https://github.com/askpt + */ + +return [ + 'year' => ':count bliain', + 'a_year' => '{1}bliain|:count bliain', + 'y' => ':countb', + 'month' => ':count mí', + 'a_month' => '{1}mí|:count mí', + 'm' => ':countm', + 'week' => ':count sheachtain', + 'a_week' => '{1}sheachtain|:count sheachtain', + 'w' => ':countsh', + 'day' => ':count lá', + 'a_day' => '{1}lá|:count lá', + 'd' => ':countl', + 'hour' => ':count uair an chloig', + 'a_hour' => '{1}uair an chloig|:count uair an chloig', + 'h' => ':countu', + 'minute' => ':count nóiméad', + 'a_minute' => '{1}nóiméad|:count nóiméad', + 'min' => ':countn', + 'second' => ':count soicind', + 'a_second' => '{1}cúpla soicind|:count soicind', + 's' => ':countso', + 'ago' => ':time ó shin', + 'from_now' => 'i :time', + 'after' => ':time tar éis', + 'before' => ':time roimh', + 'diff_now' => 'anois', + 'diff_today' => 'Inniu', + 'diff_today_regexp' => 'Inniu(?:\\s+ag)?', + 'diff_yesterday' => 'inné', + 'diff_yesterday_regexp' => 'Inné(?:\\s+aig)?', + 'diff_tomorrow' => 'amárach', + 'diff_tomorrow_regexp' => 'Amárach(?:\\s+ag)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Inniu ag] LT', + 'nextDay' => '[Amárach ag] LT', + 'nextWeek' => 'dddd [ag] LT', + 'lastDay' => '[Inné aig] LT', + 'lastWeek' => 'dddd [seo caite] [ag] LT', + 'sameElse' => 'L', + ], + 'months' => ['Eanáir', 'Feabhra', 'Márta', 'Aibreán', 'Bealtaine', 'Méitheamh', 'Iúil', 'Lúnasa', 'Meán Fómhair', 'Deaireadh Fómhair', 'Samhain', 'Nollaig'], + 'months_short' => ['Eaná', 'Feab', 'Márt', 'Aibr', 'Beal', 'Méit', 'Iúil', 'Lúna', 'Meán', 'Deai', 'Samh', 'Noll'], + 'weekdays' => ['Dé Domhnaigh', 'Dé Luain', 'Dé Máirt', 'Dé Céadaoin', 'Déardaoin', 'Dé hAoine', 'Dé Satharn'], + 'weekdays_short' => ['Dom', 'Lua', 'Mái', 'Céa', 'Déa', 'hAo', 'Sat'], + 'weekdays_min' => ['Do', 'Lu', 'Má', 'Ce', 'Dé', 'hA', 'Sa'], + 'ordinal' => function ($number) { + return $number.($number === 1 ? 'd' : ($number % 10 === 2 ? 'na' : 'mh')); + }, + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' agus '], + 'meridiem' => ['r.n.', 'i.n.'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ga_IE.php b/vendor/nesbot/carbon/src/Carbon/Lang/ga_IE.php new file mode 100644 index 00000000..57b0c4fb --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ga_IE.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/ga.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/gd.php b/vendor/nesbot/carbon/src/Carbon/Lang/gd.php new file mode 100644 index 00000000..63d064dd --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/gd.php @@ -0,0 +1,75 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - François B + * - Jon Ashdown + */ +return [ + 'year' => ':count bliadhna', + 'a_year' => '{1}bliadhna|:count bliadhna', + 'y' => ':count b.', + 'month' => ':count mìosan', + 'a_month' => '{1}mìos|:count mìosan', + 'm' => ':count ms.', + 'week' => ':count seachdainean', + 'a_week' => '{1}seachdain|:count seachdainean', + 'w' => ':count s.', + 'day' => ':count latha', + 'a_day' => '{1}latha|:count latha', + 'd' => ':count l.', + 'hour' => ':count uairean', + 'a_hour' => '{1}uair|:count uairean', + 'h' => ':count u.', + 'minute' => ':count mionaidean', + 'a_minute' => '{1}mionaid|:count mionaidean', + 'min' => ':count md.', + 'second' => ':count diogan', + 'a_second' => '{1}beagan diogan|:count diogan', + 's' => ':count d.', + 'ago' => 'bho chionn :time', + 'from_now' => 'ann an :time', + 'diff_yesterday' => 'An-dè', + 'diff_yesterday_regexp' => 'An-dè(?:\\s+aig)?', + 'diff_today' => 'An-diugh', + 'diff_today_regexp' => 'An-diugh(?:\\s+aig)?', + 'diff_tomorrow' => 'A-màireach', + 'diff_tomorrow_regexp' => 'A-màireach(?:\\s+aig)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[An-diugh aig] LT', + 'nextDay' => '[A-màireach aig] LT', + 'nextWeek' => 'dddd [aig] LT', + 'lastDay' => '[An-dè aig] LT', + 'lastWeek' => 'dddd [seo chaidh] [aig] LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + return $number.($number === 1 ? 'd' : ($number % 10 === 2 ? 'na' : 'mh')); + }, + 'months' => ['Am Faoilleach', 'An Gearran', 'Am Màrt', 'An Giblean', 'An Cèitean', 'An t-Ògmhios', 'An t-Iuchar', 'An Lùnastal', 'An t-Sultain', 'An Dàmhair', 'An t-Samhain', 'An Dùbhlachd'], + 'months_short' => ['Faoi', 'Gear', 'Màrt', 'Gibl', 'Cèit', 'Ògmh', 'Iuch', 'Lùn', 'Sult', 'Dàmh', 'Samh', 'Dùbh'], + 'weekdays' => ['Didòmhnaich', 'Diluain', 'Dimàirt', 'Diciadain', 'Diardaoin', 'Dihaoine', 'Disathairne'], + 'weekdays_short' => ['Did', 'Dil', 'Dim', 'Dic', 'Dia', 'Dih', 'Dis'], + 'weekdays_min' => ['Dò', 'Lu', 'Mà', 'Ci', 'Ar', 'Ha', 'Sa'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' agus '], + 'meridiem' => ['m', 'f'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/gd_GB.php b/vendor/nesbot/carbon/src/Carbon/Lang/gd_GB.php new file mode 100644 index 00000000..4fc26b3d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/gd_GB.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/gd.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/gez.php b/vendor/nesbot/carbon/src/Carbon/Lang/gez.php new file mode 100644 index 00000000..b8a2f0eb --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/gez.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/gez_ER.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/gez_ER.php b/vendor/nesbot/carbon/src/Carbon/Lang/gez_ER.php new file mode 100644 index 00000000..f19d1df1 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/gez_ER.php @@ -0,0 +1,56 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Ge'ez Frontier Foundation locales@geez.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['ጠሐረ', 'ከተተ', 'መገበ', 'አኀዘ', 'ግንባት', 'ሠንየ', 'ሐመለ', 'ነሐሰ', 'ከረመ', 'ጠቀመ', 'ኀደረ', 'ኀሠሠ'], + 'months_short' => ['ጠሐረ', 'ከተተ', 'መገበ', 'አኀዘ', 'ግንባ', 'ሠንየ', 'ሐመለ', 'ነሐሰ', 'ከረመ', 'ጠቀመ', 'ኀደረ', 'ኀሠሠ'], + 'weekdays' => ['እኁድ', 'ሰኑይ', 'ሠሉስ', 'ራብዕ', 'ሐሙስ', 'ዓርበ', 'ቀዳሚት'], + 'weekdays_short' => ['እኁድ', 'ሰኑይ', 'ሠሉስ', 'ራብዕ', 'ሐሙስ', 'ዓርበ', 'ቀዳሚ'], + 'weekdays_min' => ['እኁድ', 'ሰኑይ', 'ሠሉስ', 'ራብዕ', 'ሐሙስ', 'ዓርበ', 'ቀዳሚ'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['ጽባሕ', 'ምሴት'], + + 'month' => ':count ወርሕ', // less reliable + 'm' => ':count ወርሕ', // less reliable + 'a_month' => ':count ወርሕ', // less reliable + + 'week' => ':count ሰብዑ', // less reliable + 'w' => ':count ሰብዑ', // less reliable + 'a_week' => ':count ሰብዑ', // less reliable + + 'hour' => ':count አንትሙ', // less reliable + 'h' => ':count አንትሙ', // less reliable + 'a_hour' => ':count አንትሙ', // less reliable + + 'minute' => ':count ንኡስ', // less reliable + 'min' => ':count ንኡስ', // less reliable + 'a_minute' => ':count ንኡስ', // less reliable + + 'year' => ':count ዓመት', + 'y' => ':count ዓመት', + 'a_year' => ':count ዓመት', + + 'day' => ':count ዕለት', + 'd' => ':count ዕለት', + 'a_day' => ':count ዕለት', + + 'second' => ':count ካልእ', + 's' => ':count ካልእ', + 'a_second' => ':count ካልእ', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/gez_ET.php b/vendor/nesbot/carbon/src/Carbon/Lang/gez_ET.php new file mode 100644 index 00000000..39330096 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/gez_ET.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Ge'ez Frontier Foundation locales@geez.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['ጃንዩወሪ', 'ፌብሩወሪ', 'ማርች', 'ኤፕረል', 'ሜይ', 'ጁን', 'ጁላይ', 'ኦገስት', 'ሴፕቴምበር', 'ኦክተውበር', 'ኖቬምበር', 'ዲሴምበር'], + 'months_short' => ['ጃንዩ', 'ፌብሩ', 'ማርች', 'ኤፕረ', 'ሜይ ', 'ጁን ', 'ጁላይ', 'ኦገስ', 'ሴፕቴ', 'ኦክተ', 'ኖቬም', 'ዲሴም'], + 'weekdays' => ['እኁድ', 'ሰኑይ', 'ሠሉስ', 'ራብዕ', 'ሐሙስ', 'ዓርበ', 'ቀዳሚት'], + 'weekdays_short' => ['እኁድ', 'ሰኑይ', 'ሠሉስ', 'ራብዕ', 'ሐሙስ', 'ዓርበ', 'ቀዳሚ'], + 'weekdays_min' => ['እኁድ', 'ሰኑይ', 'ሠሉስ', 'ራብዕ', 'ሐሙስ', 'ዓርበ', 'ቀዳሚ'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['ጽባሕ', 'ምሴት'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/gl.php b/vendor/nesbot/carbon/src/Carbon/Lang/gl.php new file mode 100644 index 00000000..088b0f28 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/gl.php @@ -0,0 +1,98 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - François B + * - Fidel Pita + * - JD Isaacks + * - Diego Vilariño + * - Sebastian Thierer + */ + +use Carbon\CarbonInterface; + +return [ + 'year' => ':count ano|:count anos', + 'a_year' => 'un ano|:count anos', + 'y' => ':count a.', + 'month' => ':count mes|:count meses', + 'a_month' => 'un mes|:count meses', + 'm' => ':count mes.', + 'week' => ':count semana|:count semanas', + 'a_week' => 'unha semana|:count semanas', + 'w' => ':count sem.', + 'day' => ':count día|:count días', + 'a_day' => 'un día|:count días', + 'd' => ':count d.', + 'hour' => ':count hora|:count horas', + 'a_hour' => 'unha hora|:count horas', + 'h' => ':count h.', + 'minute' => ':count minuto|:count minutos', + 'a_minute' => 'un minuto|:count minutos', + 'min' => ':count min.', + 'second' => ':count segundo|:count segundos', + 'a_second' => 'uns segundos|:count segundos', + 's' => ':count seg.', + 'ago' => 'hai :time', + 'from_now' => function ($time) { + if (str_starts_with($time, 'un')) { + return "n$time"; + } + + return "en $time"; + }, + 'diff_now' => 'agora', + 'diff_today' => 'hoxe', + 'diff_today_regexp' => 'hoxe(?:\\s+ás)?', + 'diff_yesterday' => 'onte', + 'diff_yesterday_regexp' => 'onte(?:\\s+á)?', + 'diff_tomorrow' => 'mañá', + 'diff_tomorrow_regexp' => 'mañá(?:\\s+ás)?', + 'after' => ':time despois', + 'before' => ':time antes', + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D [de] MMMM [de] YYYY', + 'LLL' => 'D [de] MMMM [de] YYYY H:mm', + 'LLLL' => 'dddd, D [de] MMMM [de] YYYY H:mm', + ], + 'calendar' => [ + 'sameDay' => function (CarbonInterface $current) { + return '[hoxe '.($current->hour !== 1 ? 'ás' : 'á').'] LT'; + }, + 'nextDay' => function (CarbonInterface $current) { + return '[mañá '.($current->hour !== 1 ? 'ás' : 'á').'] LT'; + }, + 'nextWeek' => function (CarbonInterface $current) { + return 'dddd ['.($current->hour !== 1 ? 'ás' : 'á').'] LT'; + }, + 'lastDay' => function (CarbonInterface $current) { + return '[onte '.($current->hour !== 1 ? 'á' : 'a').'] LT'; + }, + 'lastWeek' => function (CarbonInterface $current) { + return '[o] dddd [pasado '.($current->hour !== 1 ? 'ás' : 'á').'] LT'; + }, + 'sameElse' => 'L', + ], + 'ordinal' => ':numberº', + 'months' => ['xaneiro', 'febreiro', 'marzo', 'abril', 'maio', 'xuño', 'xullo', 'agosto', 'setembro', 'outubro', 'novembro', 'decembro'], + 'months_short' => ['xan.', 'feb.', 'mar.', 'abr.', 'mai.', 'xuñ.', 'xul.', 'ago.', 'set.', 'out.', 'nov.', 'dec.'], + 'weekdays' => ['domingo', 'luns', 'martes', 'mércores', 'xoves', 'venres', 'sábado'], + 'weekdays_short' => ['dom.', 'lun.', 'mar.', 'mér.', 'xov.', 'ven.', 'sáb.'], + 'weekdays_min' => ['do', 'lu', 'ma', 'mé', 'xo', 've', 'sá'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' e '], + 'meridiem' => ['a.m.', 'p.m.'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/gl_ES.php b/vendor/nesbot/carbon/src/Carbon/Lang/gl_ES.php new file mode 100644 index 00000000..9d6c1d96 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/gl_ES.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/gl.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/gom.php b/vendor/nesbot/carbon/src/Carbon/Lang/gom.php new file mode 100644 index 00000000..2a0584f8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/gom.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/gom_Latn.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/gom_Latn.php b/vendor/nesbot/carbon/src/Carbon/Lang/gom_Latn.php new file mode 100644 index 00000000..612bb886 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/gom_Latn.php @@ -0,0 +1,79 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return [ + 'year' => ':count voros|:count vorsam', + 'y' => ':countv', + 'month' => ':count mhoino|:count mhoine', + 'm' => ':countmh', + 'week' => ':count satolleacho|:count satolleache', + 'w' => ':countsa|:countsa', + 'day' => ':count dis', + 'd' => ':countd', + 'hour' => ':count hor|:count horam', + 'h' => ':counth', + 'minute' => ':count minute|:count mintam', + 'min' => ':countm', + 'second' => ':count second', + 's' => ':counts', + + 'diff_today' => 'Aiz', + 'diff_yesterday' => 'Kal', + 'diff_tomorrow' => 'Faleam', + 'formats' => [ + 'LT' => 'A h:mm [vazta]', + 'LTS' => 'A h:mm:ss [vazta]', + 'L' => 'DD-MM-YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY A h:mm [vazta]', + 'LLLL' => 'dddd, MMMM[achea] Do, YYYY, A h:mm [vazta]', + 'llll' => 'ddd, D MMM YYYY, A h:mm [vazta]', + ], + + 'calendar' => [ + 'sameDay' => '[Aiz] LT', + 'nextDay' => '[Faleam] LT', + 'nextWeek' => '[Ieta to] dddd[,] LT', + 'lastDay' => '[Kal] LT', + 'lastWeek' => '[Fatlo] dddd[,] LT', + 'sameElse' => 'L', + ], + + 'months' => ['Janer', 'Febrer', 'Mars', 'Abril', 'Mai', 'Jun', 'Julai', 'Agost', 'Setembr', 'Otubr', 'Novembr', 'Dezembr'], + 'months_short' => ['Jan.', 'Feb.', 'Mars', 'Abr.', 'Mai', 'Jun', 'Jul.', 'Ago.', 'Set.', 'Otu.', 'Nov.', 'Dez.'], + 'weekdays' => ['Aitar', 'Somar', 'Mongllar', 'Budvar', 'Brestar', 'Sukrar', 'Son\'var'], + 'weekdays_short' => ['Ait.', 'Som.', 'Mon.', 'Bud.', 'Bre.', 'Suk.', 'Son.'], + 'weekdays_min' => ['Ai', 'Sm', 'Mo', 'Bu', 'Br', 'Su', 'Sn'], + + 'ordinal' => function ($number, $period) { + return $number.($period === 'D' ? 'er' : ''); + }, + + 'meridiem' => function ($hour) { + if ($hour < 4) { + return 'rati'; + } + if ($hour < 12) { + return 'sokalli'; + } + if ($hour < 16) { + return 'donparam'; + } + if ($hour < 20) { + return 'sanje'; + } + + return 'rati'; + }, + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' ani '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/gsw.php b/vendor/nesbot/carbon/src/Carbon/Lang/gsw.php new file mode 100644 index 00000000..c5c850ed --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/gsw.php @@ -0,0 +1,49 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Christopher Dell + * - Akira Matsuda + * - Enrique Vidal + * - Simone Carletti + * - Henning Kiel + * - Aaron Patterson + * - Florian Hanke + */ +return [ + 'year' => ':count Johr', + 'month' => ':count Monet', + 'week' => ':count Woche', + 'day' => ':count Tag', + 'hour' => ':count Schtund', + 'minute' => ':count Minute', + 'second' => ':count Sekunde', + 'weekdays' => ['Sunntig', 'Mäntig', 'Ziischtig', 'Mittwuch', 'Dunschtig', 'Friitig', 'Samschtig'], + 'weekdays_short' => ['Su', 'Mä', 'Zi', 'Mi', 'Du', 'Fr', 'Sa'], + 'weekdays_min' => ['Su', 'Mä', 'Zi', 'Mi', 'Du', 'Fr', 'Sa'], + 'months' => ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'Auguscht', 'September', 'Oktober', 'November', 'Dezember'], + 'months_short' => ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'], + 'meridiem' => ['am Vormittag', 'am Namittag'], + 'ordinal' => ':number.', + 'list' => [', ', ' und '], + 'diff_now' => 'now', + 'diff_yesterday' => 'geschter', + 'diff_tomorrow' => 'moorn', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'Do MMMM YYYY', + 'LLL' => 'Do MMMM, HH:mm [Uhr]', + 'LLLL' => 'dddd, Do MMMM YYYY, HH:mm [Uhr]', + ], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/gsw_CH.php b/vendor/nesbot/carbon/src/Carbon/Lang/gsw_CH.php new file mode 100644 index 00000000..594eb25d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/gsw_CH.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/gsw.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/gsw_FR.php b/vendor/nesbot/carbon/src/Carbon/Lang/gsw_FR.php new file mode 100644 index 00000000..3581dcfb --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/gsw_FR.php @@ -0,0 +1,20 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/gsw.php', [ + 'meridiem' => ['vorm.', 'nam.'], + 'months' => ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'Auguscht', 'Septämber', 'Oktoober', 'Novämber', 'Dezämber'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LLL' => 'Do MMMM YYYY HH:mm', + 'LLLL' => 'dddd, Do MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/gsw_LI.php b/vendor/nesbot/carbon/src/Carbon/Lang/gsw_LI.php new file mode 100644 index 00000000..3581dcfb --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/gsw_LI.php @@ -0,0 +1,20 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/gsw.php', [ + 'meridiem' => ['vorm.', 'nam.'], + 'months' => ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'Auguscht', 'Septämber', 'Oktoober', 'Novämber', 'Dezämber'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LLL' => 'Do MMMM YYYY HH:mm', + 'LLLL' => 'dddd, Do MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/gu.php b/vendor/nesbot/carbon/src/Carbon/Lang/gu.php new file mode 100644 index 00000000..8bc43114 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/gu.php @@ -0,0 +1,82 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - Kaushik Thanki + * - Josh Soref + */ +return [ + 'year' => 'એક વર્ષ|:count વર્ષ', + 'y' => ':countવર્ષ|:countવર્ષો', + 'month' => 'એક મહિનો|:count મહિના', + 'm' => ':countમહિનો|:countમહિના', + 'week' => ':count અઠવાડિયું|:count અઠવાડિયા', + 'w' => ':countઅઠ.|:countઅઠ.', + 'day' => 'એક દિવસ|:count દિવસ', + 'd' => ':countદિ.|:countદિ.', + 'hour' => 'એક કલાક|:count કલાક', + 'h' => ':countક.|:countક.', + 'minute' => 'એક મિનિટ|:count મિનિટ', + 'min' => ':countમિ.|:countમિ.', + 'second' => 'અમુક પળો|:count સેકંડ', + 's' => ':countસે.|:countસે.', + 'ago' => ':time પેહલા', + 'from_now' => ':time મા', + 'after' => ':time પછી', + 'before' => ':time પહેલા', + 'diff_now' => 'હમણાં', + 'diff_today' => 'આજ', + 'diff_yesterday' => 'ગઇકાલે', + 'diff_tomorrow' => 'કાલે', + 'formats' => [ + 'LT' => 'A h:mm વાગ્યે', + 'LTS' => 'A h:mm:ss વાગ્યે', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY, A h:mm વાગ્યે', + 'LLLL' => 'dddd, D MMMM YYYY, A h:mm વાગ્યે', + ], + 'calendar' => [ + 'sameDay' => '[આજ] LT', + 'nextDay' => '[કાલે] LT', + 'nextWeek' => 'dddd, LT', + 'lastDay' => '[ગઇકાલે] LT', + 'lastWeek' => '[પાછલા] dddd, LT', + 'sameElse' => 'L', + ], + 'meridiem' => function ($hour) { + if ($hour < 4) { + return 'રાત'; + } + if ($hour < 10) { + return 'સવાર'; + } + if ($hour < 17) { + return 'બપોર'; + } + if ($hour < 20) { + return 'સાંજ'; + } + + return 'રાત'; + }, + 'months' => ['જાન્યુઆરી', 'ફેબ્રુઆરી', 'માર્ચ', 'એપ્રિલ', 'મે', 'જૂન', 'જુલાઈ', 'ઑગસ્ટ', 'સપ્ટેમ્બર', 'ઑક્ટ્બર', 'નવેમ્બર', 'ડિસેમ્બર'], + 'months_short' => ['જાન્યુ.', 'ફેબ્રુ.', 'માર્ચ', 'એપ્રિ.', 'મે', 'જૂન', 'જુલા.', 'ઑગ.', 'સપ્ટે.', 'ઑક્ટ્.', 'નવે.', 'ડિસે.'], + 'weekdays' => ['રવિવાર', 'સોમવાર', 'મંગળવાર', 'બુધ્વાર', 'ગુરુવાર', 'શુક્રવાર', 'શનિવાર'], + 'weekdays_short' => ['રવિ', 'સોમ', 'મંગળ', 'બુધ્', 'ગુરુ', 'શુક્ર', 'શનિ'], + 'weekdays_min' => ['ર', 'સો', 'મં', 'બુ', 'ગુ', 'શુ', 'શ'], + 'list' => [', ', ' અને '], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, + 'weekend' => [0, 0], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/gu_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/gu_IN.php new file mode 100644 index 00000000..02654b1f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/gu_IN.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/gu.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/guz.php b/vendor/nesbot/carbon/src/Carbon/Lang/guz.php new file mode 100644 index 00000000..6230165c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/guz.php @@ -0,0 +1,47 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['Ma', 'Mo'], + 'weekdays' => ['Chumapiri', 'Chumatato', 'Chumaine', 'Chumatano', 'Aramisi', 'Ichuma', 'Esabato'], + 'weekdays_short' => ['Cpr', 'Ctt', 'Cmn', 'Cmt', 'Ars', 'Icm', 'Est'], + 'weekdays_min' => ['Cpr', 'Ctt', 'Cmn', 'Cmt', 'Ars', 'Icm', 'Est'], + 'months' => ['Chanuari', 'Feburari', 'Machi', 'Apiriri', 'Mei', 'Juni', 'Chulai', 'Agosti', 'Septemba', 'Okitoba', 'Nobemba', 'Disemba'], + 'months_short' => ['Can', 'Feb', 'Mac', 'Apr', 'Mei', 'Jun', 'Cul', 'Agt', 'Sep', 'Okt', 'Nob', 'Dis'], + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + + 'month' => ':count omotunyi', // less reliable + 'm' => ':count omotunyi', // less reliable + 'a_month' => ':count omotunyi', // less reliable + + 'week' => ':count isano naibere', // less reliable + 'w' => ':count isano naibere', // less reliable + 'a_week' => ':count isano naibere', // less reliable + + 'second' => ':count ibere', // less reliable + 's' => ':count ibere', // less reliable + 'a_second' => ':count ibere', // less reliable + + 'year' => ':count omwaka', + 'y' => ':count omwaka', + 'a_year' => ':count omwaka', + + 'day' => ':count rituko', + 'd' => ':count rituko', + 'a_day' => ':count rituko', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/gv.php b/vendor/nesbot/carbon/src/Carbon/Lang/gv.php new file mode 100644 index 00000000..7c52b940 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/gv.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/gv_GB.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/gv_GB.php b/vendor/nesbot/carbon/src/Carbon/Lang/gv_GB.php new file mode 100644 index 00000000..6b1168f9 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/gv_GB.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Alastair McKinstry bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YY', + ], + 'months' => ['Jerrey-geuree', 'Toshiaght-arree', 'Mayrnt', 'Averil', 'Boaldyn', 'Mean-souree', 'Jerrey-souree', 'Luanistyn', 'Mean-fouyir', 'Jerrey-fouyir', 'Mee Houney', 'Mee ny Nollick'], + 'months_short' => ['J-guer', 'T-arree', 'Mayrnt', 'Avrril', 'Boaldyn', 'M-souree', 'J-souree', 'Luanistyn', 'M-fouyir', 'J-fouyir', 'M.Houney', 'M.Nollick'], + 'weekdays' => ['Jedoonee', 'Jelhein', 'Jemayrt', 'Jercean', 'Jerdein', 'Jeheiney', 'Jesarn'], + 'weekdays_short' => ['Jed', 'Jel', 'Jem', 'Jerc', 'Jerd', 'Jeh', 'Jes'], + 'weekdays_min' => ['Jed', 'Jel', 'Jem', 'Jerc', 'Jerd', 'Jeh', 'Jes'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + + 'year' => ':count blein', + 'y' => ':count blein', + 'a_year' => ':count blein', + + 'month' => ':count mee', + 'm' => ':count mee', + 'a_month' => ':count mee', + + 'week' => ':count shiaghtin', + 'w' => ':count shiaghtin', + 'a_week' => ':count shiaghtin', + + 'day' => ':count laa', + 'd' => ':count laa', + 'a_day' => ':count laa', + + 'hour' => ':count oor', + 'h' => ':count oor', + 'a_hour' => ':count oor', + + 'minute' => ':count feer veg', + 'min' => ':count feer veg', + 'a_minute' => ':count feer veg', + + 'second' => ':count derrey', + 's' => ':count derrey', + 'a_second' => ':count derrey', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ha.php b/vendor/nesbot/carbon/src/Carbon/Lang/ha.php new file mode 100644 index 00000000..cd8e34d0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ha.php @@ -0,0 +1,60 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - pablo@mandriva.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMM, YYYY', + 'LLL' => 'D MMMM, YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM, YYYY HH:mm', + ], + 'months' => ['Janairu', 'Faburairu', 'Maris', 'Afirilu', 'Mayu', 'Yuni', 'Yuli', 'Agusta', 'Satumba', 'Oktoba', 'Nuwamba', 'Disamba'], + 'months_short' => ['Jan', 'Fab', 'Mar', 'Afi', 'May', 'Yun', 'Yul', 'Agu', 'Sat', 'Okt', 'Nuw', 'Dis'], + 'weekdays' => ['Lahadi', 'Litini', 'Talata', 'Laraba', 'Alhamis', 'Jumaʼa', 'Asabar'], + 'weekdays_short' => ['Lah', 'Lit', 'Tal', 'Lar', 'Alh', 'Jum', 'Asa'], + 'weekdays_min' => ['Lh', 'Li', 'Ta', 'Lr', 'Al', 'Ju', 'As'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + + 'year' => 'shekara :count', + 'y' => 'shekara :count', + 'a_year' => 'shekara :count', + + 'month' => ':count wátàa', + 'm' => ':count wátàa', + 'a_month' => ':count wátàa', + + 'week' => ':count mako', + 'w' => ':count mako', + 'a_week' => ':count mako', + + 'day' => ':count rana', + 'd' => ':count rana', + 'a_day' => ':count rana', + + 'hour' => ':count áwàa', + 'h' => ':count áwàa', + 'a_hour' => ':count áwàa', + + 'minute' => 'minti :count', + 'min' => 'minti :count', + 'a_minute' => 'minti :count', + + 'second' => ':count ná bíyú', + 's' => ':count ná bíyú', + 'a_second' => ':count ná bíyú', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ha_GH.php b/vendor/nesbot/carbon/src/Carbon/Lang/ha_GH.php new file mode 100644 index 00000000..f9f99a73 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ha_GH.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/ha.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ha_NE.php b/vendor/nesbot/carbon/src/Carbon/Lang/ha_NE.php new file mode 100644 index 00000000..f9f99a73 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ha_NE.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/ha.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ha_NG.php b/vendor/nesbot/carbon/src/Carbon/Lang/ha_NG.php new file mode 100644 index 00000000..f9f99a73 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ha_NG.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/ha.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hak.php b/vendor/nesbot/carbon/src/Carbon/Lang/hak.php new file mode 100644 index 00000000..6c3260e8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/hak.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/hak_TW.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hak_TW.php b/vendor/nesbot/carbon/src/Carbon/Lang/hak_TW.php new file mode 100644 index 00000000..fe239865 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/hak_TW.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'YYYY年MM月DD日', + ], + 'months' => ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], + 'months_short' => [' 1月', ' 2月', ' 3月', ' 4月', ' 5月', ' 6月', ' 7月', ' 8月', ' 9月', '10月', '11月', '12月'], + 'weekdays' => ['禮拜日', '禮拜一', '禮拜二', '禮拜三', '禮拜四', '禮拜五', '禮拜六'], + 'weekdays_short' => ['日', '一', '二', '三', '四', '五', '六'], + 'weekdays_min' => ['日', '一', '二', '三', '四', '五', '六'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['上晝', '下晝'], + + 'year' => ':count ngien11', + 'y' => ':count ngien11', + 'a_year' => ':count ngien11', + + 'month' => ':count ngie̍t', + 'm' => ':count ngie̍t', + 'a_month' => ':count ngie̍t', + + 'week' => ':count lî-pai', + 'w' => ':count lî-pai', + 'a_week' => ':count lî-pai', + + 'day' => ':count ngit', + 'd' => ':count ngit', + 'a_day' => ':count ngit', + + 'hour' => ':count sṳ̀', + 'h' => ':count sṳ̀', + 'a_hour' => ':count sṳ̀', + + 'minute' => ':count fûn', + 'min' => ':count fûn', + 'a_minute' => ':count fûn', + + 'second' => ':count miéu', + 's' => ':count miéu', + 'a_second' => ':count miéu', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/haw.php b/vendor/nesbot/carbon/src/Carbon/Lang/haw.php new file mode 100644 index 00000000..cdd36861 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/haw.php @@ -0,0 +1,54 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'months' => ['Ianuali', 'Pepeluali', 'Malaki', 'ʻApelila', 'Mei', 'Iune', 'Iulai', 'ʻAukake', 'Kepakemapa', 'ʻOkakopa', 'Nowemapa', 'Kekemapa'], + 'months_short' => ['Ian.', 'Pep.', 'Mal.', 'ʻAp.', 'Mei', 'Iun.', 'Iul.', 'ʻAu.', 'Kep.', 'ʻOk.', 'Now.', 'Kek.'], + 'weekdays' => ['Lāpule', 'Poʻakahi', 'Poʻalua', 'Poʻakolu', 'Poʻahā', 'Poʻalima', 'Poʻaono'], + 'weekdays_short' => ['LP', 'P1', 'P2', 'P3', 'P4', 'P5', 'P6'], + 'weekdays_min' => ['S', 'M', 'T', 'W', 'T', 'F', 'S'], + 'formats' => [ + 'LT' => 'h:mm a', + 'LTS' => 'h:mm:ss a', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY h:mm a', + 'LLLL' => 'dddd, D MMMM YYYY h:mm a', + ], + + 'year' => ':count makahiki', + 'y' => ':count makahiki', + 'a_year' => ':count makahiki', + + 'month' => ':count mahina', + 'm' => ':count mahina', + 'a_month' => ':count mahina', + + 'week' => ':count pule', + 'w' => ':count pule', + 'a_week' => ':count pule', + + 'day' => ':count lā', + 'd' => ':count lā', + 'a_day' => ':count lā', + + 'hour' => ':count hola', + 'h' => ':count hola', + 'a_hour' => ':count hola', + + 'minute' => ':count minuke', + 'min' => ':count minuke', + 'a_minute' => ':count minuke', + + 'second' => ':count lua', + 's' => ':count lua', + 'a_second' => ':count lua', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/he.php b/vendor/nesbot/carbon/src/Carbon/Lang/he.php new file mode 100644 index 00000000..c3fb3e97 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/he.php @@ -0,0 +1,86 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Daniel Cohen Gindi + * - JD Isaacks + * - Itai Nathaniel + * - GabMic + * - Yaakov Dahan (yakidahan) + */ +return [ + 'year' => 'שנה|{2}שנתיים|:count שנים', + 'y' => 'שנה|:count שנ׳', + 'month' => 'חודש|{2}חודשיים|:count חודשים', + 'm' => 'חודש|:count חו׳', + 'week' => 'שבוע|{2}שבועיים|:count שבועות', + 'w' => 'שבוע|:count שב׳', + 'day' => 'יום|{2}יומיים|:count ימים', + 'd' => 'יום|:count ימ׳', + 'hour' => 'שעה|{2}שעתיים|:count שעות', + 'h' => 'שעה|:count שע׳', + 'minute' => 'דקה|{2}שתי דקות|:count דקות', + 'min' => 'דקה|:count דק׳', + 'second' => 'שנייה|:count שניות', + 'a_second' => 'כמה שניות|:count שניות', + 's' => 'שניה|:count שנ׳', + 'ago' => 'לפני :time', + 'from_now' => 'בעוד :time מעכשיו', + 'after' => 'אחרי :time', + 'before' => 'לפני :time', + 'diff_now' => 'עכשיו', + 'diff_today' => 'היום', + 'diff_today_regexp' => 'היום(?:\\s+ב־)?', + 'diff_yesterday' => 'אתמול', + 'diff_yesterday_regexp' => 'אתמול(?:\\s+ב־)?', + 'diff_tomorrow' => 'מחר', + 'diff_tomorrow_regexp' => 'מחר(?:\\s+ב־)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D [ב]MMMM YYYY', + 'LLL' => 'D [ב]MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D [ב]MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[היום ב־]LT', + 'nextDay' => '[מחר ב־]LT', + 'nextWeek' => 'dddd [בשעה] LT', + 'lastDay' => '[אתמול ב־]LT', + 'lastWeek' => '[ביום] dddd [האחרון בשעה] LT', + 'sameElse' => 'L', + ], + 'meridiem' => function ($hour, $minute, $isLower) { + if ($hour < 5) { + return 'לפנות בוקר'; + } + if ($hour < 10) { + return 'בבוקר'; + } + if ($hour < 12) { + return $isLower ? 'לפנה"צ' : 'לפני הצהריים'; + } + if ($hour < 18) { + return $isLower ? 'אחה"צ' : 'אחרי הצהריים'; + } + + return 'בערב'; + }, + 'months' => ['ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'], + 'months_short' => ['ינו׳', 'פבר׳', 'מרץ', 'אפר׳', 'מאי', 'יוני', 'יולי', 'אוג׳', 'ספט׳', 'אוק׳', 'נוב׳', 'דצמ׳'], + 'weekdays' => ['ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת'], + 'weekdays_short' => ['א׳', 'ב׳', 'ג׳', 'ד׳', 'ה׳', 'ו׳', 'ש׳'], + 'weekdays_min' => ['א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ש'], + 'list' => [', ', ' ו -'], + 'weekend' => [5, 6], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/he_IL.php b/vendor/nesbot/carbon/src/Carbon/Lang/he_IL.php new file mode 100644 index 00000000..14fab3e9 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/he_IL.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/he.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hi.php b/vendor/nesbot/carbon/src/Carbon/Lang/hi.php new file mode 100644 index 00000000..70c57a29 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/hi.php @@ -0,0 +1,82 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - abhimanyu003 + * - Josh Soref + * - JD Isaacks + */ +return [ + 'year' => 'एक वर्ष|:count वर्ष', + 'y' => '1 वर्ष|:count वर्षों', + 'month' => 'एक महीने|:count महीने', + 'm' => '1 माह|:count महीने', + 'week' => '1 सप्ताह|:count सप्ताह', + 'w' => '1 सप्ताह|:count सप्ताह', + 'day' => 'एक दिन|:count दिन', + 'd' => '1 दिन|:count दिनों', + 'hour' => 'एक घंटा|:count घंटे', + 'h' => '1 घंटा|:count घंटे', + 'minute' => 'एक मिनट|:count मिनट', + 'min' => '1 मिनट|:count मिनटों', + 'second' => 'कुछ ही क्षण|:count सेकंड', + 's' => '1 सेकंड|:count सेकंड', + 'ago' => ':time पहले', + 'from_now' => ':time में', + 'after' => ':time के बाद', + 'before' => ':time के पहले', + 'diff_now' => 'अब', + 'diff_today' => 'आज', + 'diff_yesterday' => 'कल', + 'diff_tomorrow' => 'कल', + 'formats' => [ + 'LT' => 'A h:mm बजे', + 'LTS' => 'A h:mm:ss बजे', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY, A h:mm बजे', + 'LLLL' => 'dddd, D MMMM YYYY, A h:mm बजे', + ], + 'calendar' => [ + 'sameDay' => '[आज] LT', + 'nextDay' => '[कल] LT', + 'nextWeek' => 'dddd, LT', + 'lastDay' => '[कल] LT', + 'lastWeek' => '[पिछले] dddd, LT', + 'sameElse' => 'L', + ], + 'meridiem' => function ($hour) { + if ($hour < 4) { + return 'रात'; + } + if ($hour < 10) { + return 'सुबह'; + } + if ($hour < 17) { + return 'दोपहर'; + } + if ($hour < 20) { + return 'शाम'; + } + + return 'रात'; + }, + 'months' => ['जनवरी', 'फ़रवरी', 'मार्च', 'अप्रैल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितम्बर', 'अक्टूबर', 'नवम्बर', 'दिसम्बर'], + 'months_short' => ['जन.', 'फ़र.', 'मार्च', 'अप्रै.', 'मई', 'जून', 'जुल.', 'अग.', 'सित.', 'अक्टू.', 'नव.', 'दिस.'], + 'weekdays' => ['रविवार', 'सोमवार', 'मंगलवार', 'बुधवार', 'गुरूवार', 'शुक्रवार', 'शनिवार'], + 'weekdays_short' => ['रवि', 'सोम', 'मंगल', 'बुध', 'गुरू', 'शुक्र', 'शनि'], + 'weekdays_min' => ['र', 'सो', 'मं', 'बु', 'गु', 'शु', 'श'], + 'list' => [', ', ' और '], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, + 'weekend' => [0, 0], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hi_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/hi_IN.php new file mode 100644 index 00000000..749dd97c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/hi_IN.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/hi.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hif.php b/vendor/nesbot/carbon/src/Carbon/Lang/hif.php new file mode 100644 index 00000000..65791dd4 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/hif.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/hif_FJ.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hif_FJ.php b/vendor/nesbot/carbon/src/Carbon/Lang/hif_FJ.php new file mode 100644 index 00000000..30ad5e74 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/hif_FJ.php @@ -0,0 +1,54 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Samsung Electronics Co., Ltd. akhilesh.k@samsung.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'dddd DD MMM YYYY', + ], + 'months' => ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], + 'months_short' => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], + 'weekdays' => ['Ravivar', 'Somvar', 'Mangalvar', 'Budhvar', 'Guruvar', 'Shukravar', 'Shanivar'], + 'weekdays_short' => ['Ravi', 'Som', 'Mangal', 'Budh', 'Guru', 'Shukra', 'Shani'], + 'weekdays_min' => ['Ravi', 'Som', 'Mangal', 'Budh', 'Guru', 'Shukra', 'Shani'], + 'meridiem' => ['Purvahan', 'Aparaahna'], + + 'hour' => ':count minit', // less reliable + 'h' => ':count minit', // less reliable + 'a_hour' => ':count minit', // less reliable + + 'year' => ':count saal', + 'y' => ':count saal', + 'a_year' => ':count saal', + + 'month' => ':count Mahina', + 'm' => ':count Mahina', + 'a_month' => ':count Mahina', + + 'week' => ':count Hafta', + 'w' => ':count Hafta', + 'a_week' => ':count Hafta', + + 'day' => ':count Din', + 'd' => ':count Din', + 'a_day' => ':count Din', + + 'minute' => ':count Minit', + 'min' => ':count Minit', + 'a_minute' => ':count Minit', + + 'second' => ':count Second', + 's' => ':count Second', + 'a_second' => ':count Second', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hne.php b/vendor/nesbot/carbon/src/Carbon/Lang/hne.php new file mode 100644 index 00000000..4bcb05c7 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/hne.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/hne_IN.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hne_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/hne_IN.php new file mode 100644 index 00000000..a5ca758b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/hne_IN.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Red Hat, Pune bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'D/M/YY', + ], + 'months' => ['जनवरी', 'फरवरी', 'मार्च', 'अपरेल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितमबर', 'अकटूबर', 'नवमबर', 'दिसमबर'], + 'months_short' => ['जन', 'फर', 'मार्च', 'अप', 'मई', 'जून', 'जुला', 'अग', 'सित', 'अकटू', 'नव', 'दिस'], + 'weekdays' => ['इतवार', 'सोमवार', 'मंगलवार', 'बुधवार', 'बिरसपत', 'सुकरवार', 'सनिवार'], + 'weekdays_short' => ['इत', 'सोम', 'मंग', 'बुध', 'बिर', 'सुक', 'सनि'], + 'weekdays_min' => ['इत', 'सोम', 'मंग', 'बुध', 'बिर', 'सुक', 'सनि'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['बिहिनियाँ', 'मंझनियाँ'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hr.php b/vendor/nesbot/carbon/src/Carbon/Lang/hr.php new file mode 100644 index 00000000..cfd85fd4 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/hr.php @@ -0,0 +1,111 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - François B + * - Tim Fish + * - shaishavgandhi05 + * - Serhan Apaydın + * - JD Isaacks + * - tomhorvat + * - Josh Soref + * - François B + * - shaishavgandhi05 + * - Serhan Apaydın + * - JD Isaacks + * - tomhorvat + * - Stjepan Majdak + * - Vanja Retkovac (vr00) + */ + +use Carbon\CarbonInterface; + +return [ + 'year' => ':count godinu|:count godine|:count godina', + 'y' => ':count god.|:count god.|:count god.', + 'month' => ':count mjesec|:count mjeseca|:count mjeseci', + 'm' => ':count mj.|:count mj.|:count mj.', + 'week' => ':count tjedan|:count tjedna|:count tjedana', + 'w' => ':count tj.|:count tj.|:count tj.', + 'day' => ':count dan|:count dana|:count dana', + 'd' => ':count d.|:count d.|:count d.', + 'hour' => ':count sat|:count sata|:count sati', + 'h' => ':count sat|:count sata|:count sati', + 'minute' => ':count minutu|:count minute|:count minuta', + 'min' => ':count min.|:count min.|:count min.', + 'second' => ':count sekundu|:count sekunde|:count sekundi', + 'a_second' => 'nekoliko sekundi|:count sekunde|:count sekundi', + 's' => ':count sek.|:count sek.|:count sek.', + 'ago' => 'prije :time', + 'from_now' => 'za :time', + 'after' => ':time poslije', + 'before' => ':time prije', + 'diff_now' => 'sad', + 'diff_today' => 'danas', + 'diff_today_regexp' => 'danas(?:\\s+u)?', + 'diff_yesterday' => 'jučer', + 'diff_yesterday_regexp' => 'jučer(?:\\s+u)?', + 'diff_tomorrow' => 'sutra', + 'diff_tomorrow_regexp' => 'sutra(?:\\s+u)?', + 'diff_before_yesterday' => 'prekjučer', + 'diff_after_tomorrow' => 'prekosutra', + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'D. M. YYYY.', + 'LL' => 'D. MMMM YYYY.', + 'LLL' => 'D. MMMM YYYY. H:mm', + 'LLLL' => 'dddd, D. MMMM YYYY. H:mm', + ], + 'calendar' => [ + 'sameDay' => '[danas u] LT', + 'nextDay' => '[sutra u] LT', + 'nextWeek' => function (CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[u] [nedjelju] [u] LT'; + case 3: + return '[u] [srijedu] [u] LT'; + case 6: + return '[u] [subotu] [u] LT'; + default: + return '[u] dddd [u] LT'; + } + }, + 'lastDay' => '[jučer u] LT', + 'lastWeek' => function (CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + case 3: + return '[prošlu] dddd [u] LT'; + case 6: + return '[prošle] [subote] [u] LT'; + default: + return '[prošli] dddd [u] LT'; + } + }, + 'sameElse' => 'L', + ], + 'ordinal' => ':number.', + 'months' => ['siječnja', 'veljače', 'ožujka', 'travnja', 'svibnja', 'lipnja', 'srpnja', 'kolovoza', 'rujna', 'listopada', 'studenoga', 'prosinca'], + 'months_standalone' => ['siječanj', 'veljača', 'ožujak', 'travanj', 'svibanj', 'lipanj', 'srpanj', 'kolovoz', 'rujan', 'listopad', 'studeni', 'prosinac'], + 'months_short' => ['sij.', 'velj.', 'ožu.', 'tra.', 'svi.', 'lip.', 'srp.', 'kol.', 'ruj.', 'lis.', 'stu.', 'pro.'], + 'months_regexp' => '/(D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|L{2,4}|l{2,4})/', + 'weekdays' => ['nedjelju', 'ponedjeljak', 'utorak', 'srijedu', 'četvrtak', 'petak', 'subotu'], + 'weekdays_standalone' => ['nedjelja', 'ponedjeljak', 'utorak', 'srijeda', 'četvrtak', 'petak', 'subota'], + 'weekdays_short' => ['ned.', 'pon.', 'uto.', 'sri.', 'čet.', 'pet.', 'sub.'], + 'weekdays_min' => ['ne', 'po', 'ut', 'sr', 'če', 'pe', 'su'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' i '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hr_BA.php b/vendor/nesbot/carbon/src/Carbon/Lang/hr_BA.php new file mode 100644 index 00000000..7763a458 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/hr_BA.php @@ -0,0 +1,32 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - DarkoDevelop + */ +return array_replace_recursive(require __DIR__.'/hr.php', [ + 'weekdays' => ['nedjelja', 'ponedjeljak', 'utorak', 'srijeda', 'četvrtak', 'petak', 'subota'], + 'weekdays_short' => ['ned', 'pon', 'uto', 'sri', 'čet', 'pet', 'sub'], + 'weekdays_min' => ['ned', 'pon', 'uto', 'sri', 'čet', 'pet', 'sub'], + 'months' => ['siječnja', 'veljače', 'ožujka', 'travnja', 'svibnja', 'lipnja', 'srpnja', 'kolovoza', 'rujna', 'listopada', 'studenoga', 'prosinca'], + 'months_short' => ['sij', 'velj', 'ožu', 'tra', 'svi', 'lip', 'srp', 'kol', 'ruj', 'lis', 'stu', 'pro'], + 'months_standalone' => ['siječanj', 'veljača', 'ožujak', 'travanj', 'svibanj', 'lipanj', 'srpanj', 'kolovoz', 'rujan', 'listopad', 'studeni', 'prosinac'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D. M. yy.', + 'LL' => 'D. MMM YYYY.', + 'LLL' => 'D. MMMM YYYY. HH:mm', + 'LLLL' => 'dddd, D. MMMM YYYY. HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hr_HR.php b/vendor/nesbot/carbon/src/Carbon/Lang/hr_HR.php new file mode 100644 index 00000000..db74d8c7 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/hr_HR.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/hr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hsb.php b/vendor/nesbot/carbon/src/Carbon/Lang/hsb.php new file mode 100644 index 00000000..3537b8ba --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/hsb.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/hsb_DE.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hsb_DE.php b/vendor/nesbot/carbon/src/Carbon/Lang/hsb_DE.php new file mode 100644 index 00000000..6ba22716 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/hsb_DE.php @@ -0,0 +1,60 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Information from Michael Wolf Andrzej Krzysztofowicz ankry@mif.pg.gda.pl + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'DD. MMMM YYYY', + 'LLL' => 'DD. MMMM, HH:mm [hodź.]', + 'LLLL' => 'dddd, DD. MMMM YYYY, HH:mm [hodź.]', + ], + 'months' => ['januara', 'februara', 'měrca', 'apryla', 'meje', 'junija', 'julija', 'awgusta', 'septembra', 'oktobra', 'nowembra', 'decembra'], + 'months_short' => ['Jan', 'Feb', 'Měr', 'Apr', 'Mej', 'Jun', 'Jul', 'Awg', 'Sep', 'Okt', 'Now', 'Dec'], + 'weekdays' => ['Njedźela', 'Póndźela', 'Wutora', 'Srjeda', 'Štvórtk', 'Pjatk', 'Sobota'], + 'weekdays_short' => ['Nj', 'Pó', 'Wu', 'Sr', 'Št', 'Pj', 'So'], + 'weekdays_min' => ['Nj', 'Pó', 'Wu', 'Sr', 'Št', 'Pj', 'So'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + + 'year' => ':count lěto', + 'y' => ':count lěto', + 'a_year' => ':count lěto', + + 'month' => ':count měsac', + 'm' => ':count měsac', + 'a_month' => ':count měsac', + + 'week' => ':count tydźeń', + 'w' => ':count tydźeń', + 'a_week' => ':count tydźeń', + + 'day' => ':count dźeń', + 'd' => ':count dźeń', + 'a_day' => ':count dźeń', + + 'hour' => ':count hodźina', + 'h' => ':count hodźina', + 'a_hour' => ':count hodźina', + + 'minute' => ':count chwila', + 'min' => ':count chwila', + 'a_minute' => ':count chwila', + + 'second' => ':count druhi', + 's' => ':count druhi', + 'a_second' => ':count druhi', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ht.php b/vendor/nesbot/carbon/src/Carbon/Lang/ht.php new file mode 100644 index 00000000..ebd12ad1 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ht.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/ht_HT.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ht_HT.php b/vendor/nesbot/carbon/src/Carbon/Lang/ht_HT.php new file mode 100644 index 00000000..139b813b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ht_HT.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Sugar Labs // OLPC sugarlabs.org libc-alpha@sourceware.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['janvye', 'fevriye', 'mas', 'avril', 'me', 'jen', 'jiyè', 'out', 'septanm', 'oktòb', 'novanm', 'desanm'], + 'months_short' => ['jan', 'fev', 'mas', 'avr', 'me', 'jen', 'jiy', 'out', 'sep', 'okt', 'nov', 'des'], + 'weekdays' => ['dimanch', 'lendi', 'madi', 'mèkredi', 'jedi', 'vandredi', 'samdi'], + 'weekdays_short' => ['dim', 'len', 'mad', 'mèk', 'jed', 'van', 'sam'], + 'weekdays_min' => ['dim', 'len', 'mad', 'mèk', 'jed', 'van', 'sam'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + + 'year' => ':count lane', + 'y' => ':count lane', + 'a_year' => ':count lane', + + 'month' => 'mwa :count', + 'm' => 'mwa :count', + 'a_month' => 'mwa :count', + + 'week' => 'semèn :count', + 'w' => 'semèn :count', + 'a_week' => 'semèn :count', + + 'day' => ':count jou', + 'd' => ':count jou', + 'a_day' => ':count jou', + + 'hour' => ':count lè', + 'h' => ':count lè', + 'a_hour' => ':count lè', + + 'minute' => ':count minit', + 'min' => ':count minit', + 'a_minute' => ':count minit', + + 'second' => ':count segonn', + 's' => ':count segonn', + 'a_second' => ':count segonn', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hu.php b/vendor/nesbot/carbon/src/Carbon/Lang/hu.php new file mode 100644 index 00000000..b7583eec --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/hu.php @@ -0,0 +1,118 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Adam Brunner + * - Brett Johnson + * - balping + */ + +use Carbon\CarbonInterface; + +$huWeekEndings = ['vasárnap', 'hétfőn', 'kedden', 'szerdán', 'csütörtökön', 'pénteken', 'szombaton']; + +return [ + 'year' => ':count év', + 'y' => ':count év', + 'month' => ':count hónap', + 'm' => ':count hónap', + 'week' => ':count hét', + 'w' => ':count hét', + 'day' => ':count nap', + 'd' => ':count nap', + 'hour' => ':count óra', + 'h' => ':count óra', + 'minute' => ':count perc', + 'min' => ':count perc', + 'second' => ':count másodperc', + 's' => ':count másodperc', + 'ago' => ':time', + 'from_now' => ':time múlva', + 'after' => ':time később', + 'before' => ':time korábban', + 'year_ago' => ':count éve', + 'y_ago' => ':count éve', + 'month_ago' => ':count hónapja', + 'm_ago' => ':count hónapja', + 'week_ago' => ':count hete', + 'w_ago' => ':count hete', + 'day_ago' => ':count napja', + 'd_ago' => ':count napja', + 'hour_ago' => ':count órája', + 'h_ago' => ':count órája', + 'minute_ago' => ':count perce', + 'min_ago' => ':count perce', + 'second_ago' => ':count másodperce', + 's_ago' => ':count másodperce', + 'year_after' => ':count évvel', + 'y_after' => ':count évvel', + 'month_after' => ':count hónappal', + 'm_after' => ':count hónappal', + 'week_after' => ':count héttel', + 'w_after' => ':count héttel', + 'day_after' => ':count nappal', + 'd_after' => ':count nappal', + 'hour_after' => ':count órával', + 'h_after' => ':count órával', + 'minute_after' => ':count perccel', + 'min_after' => ':count perccel', + 'second_after' => ':count másodperccel', + 's_after' => ':count másodperccel', + 'year_before' => ':count évvel', + 'y_before' => ':count évvel', + 'month_before' => ':count hónappal', + 'm_before' => ':count hónappal', + 'week_before' => ':count héttel', + 'w_before' => ':count héttel', + 'day_before' => ':count nappal', + 'd_before' => ':count nappal', + 'hour_before' => ':count órával', + 'h_before' => ':count órával', + 'minute_before' => ':count perccel', + 'min_before' => ':count perccel', + 'second_before' => ':count másodperccel', + 's_before' => ':count másodperccel', + 'months' => ['január', 'február', 'március', 'április', 'május', 'június', 'július', 'augusztus', 'szeptember', 'október', 'november', 'december'], + 'months_short' => ['jan.', 'febr.', 'márc.', 'ápr.', 'máj.', 'jún.', 'júl.', 'aug.', 'szept.', 'okt.', 'nov.', 'dec.'], + 'weekdays' => ['vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat'], + 'weekdays_short' => ['vas', 'hét', 'kedd', 'sze', 'csüt', 'pén', 'szo'], + 'weekdays_min' => ['v', 'h', 'k', 'sze', 'cs', 'p', 'sz'], + 'ordinal' => ':number.', + 'diff_now' => 'most', + 'diff_today' => 'ma', + 'diff_yesterday' => 'tegnap', + 'diff_tomorrow' => 'holnap', + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'YYYY.MM.DD.', + 'LL' => 'YYYY. MMMM D.', + 'LLL' => 'YYYY. MMMM D. H:mm', + 'LLLL' => 'YYYY. MMMM D., dddd H:mm', + ], + 'calendar' => [ + 'sameDay' => '[ma] LT[-kor]', + 'nextDay' => '[holnap] LT[-kor]', + 'nextWeek' => function (CarbonInterface $date) use ($huWeekEndings) { + return '['.$huWeekEndings[$date->dayOfWeek].'] LT[-kor]'; + }, + 'lastDay' => '[tegnap] LT[-kor]', + 'lastWeek' => function (CarbonInterface $date) use ($huWeekEndings) { + return '[múlt '.$huWeekEndings[$date->dayOfWeek].'] LT[-kor]'; + }, + 'sameElse' => 'L', + ], + 'meridiem' => ['DE', 'DU'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' és '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hu_HU.php b/vendor/nesbot/carbon/src/Carbon/Lang/hu_HU.php new file mode 100644 index 00000000..b1c48541 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/hu_HU.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/hu.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hy.php b/vendor/nesbot/carbon/src/Carbon/Lang/hy.php new file mode 100644 index 00000000..8b129947 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/hy.php @@ -0,0 +1,95 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - mhamlet + */ +return [ + 'year' => ':count տարի', + 'a_year' => 'տարի|:count տարի', + 'y' => ':countտ', + 'month' => ':count ամիս', + 'a_month' => 'ամիս|:count ամիս', + 'm' => ':countամ', + 'week' => ':count շաբաթ', + 'a_week' => 'շաբաթ|:count շաբաթ', + 'w' => ':countշ', + 'day' => ':count օր', + 'a_day' => 'օր|:count օր', + 'd' => ':countօր', + 'hour' => ':count ժամ', + 'a_hour' => 'ժամ|:count ժամ', + 'h' => ':countժ', + 'minute' => ':count րոպե', + 'a_minute' => 'րոպե|:count րոպե', + 'min' => ':countր', + 'second' => ':count վայրկյան', + 'a_second' => 'մի քանի վայրկյան|:count վայրկյան', + 's' => ':countվրկ', + 'ago' => ':time առաջ', + 'from_now' => ':timeից', + 'after' => ':time հետո', + 'before' => ':time առաջ', + 'diff_now' => 'հիմա', + 'diff_today' => 'այսօր', + 'diff_yesterday' => 'երեկ', + 'diff_tomorrow' => 'վաղը', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMMM YYYY թ.', + 'LLL' => 'D MMMM YYYY թ., HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY թ., HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[այսօր] LT', + 'nextDay' => '[վաղը] LT', + 'nextWeek' => 'dddd [օրը ժամը] LT', + 'lastDay' => '[երեկ] LT', + 'lastWeek' => '[անցած] dddd [օրը ժամը] LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number, $period) { + switch ($period) { + case 'DDD': + case 'w': + case 'W': + case 'DDDo': + return $number.($number === 1 ? '-ին' : '-րդ'); + default: + return $number; + } + }, + 'meridiem' => function ($hour) { + if ($hour < 4) { + return 'գիշերվա'; + } + if ($hour < 12) { + return 'առավոտվա'; + } + if ($hour < 17) { + return 'ցերեկվա'; + } + + return 'երեկոյան'; + }, + 'months' => ['հունվարի', 'փետրվարի', 'մարտի', 'ապրիլի', 'մայիսի', 'հունիսի', 'հուլիսի', 'օգոստոսի', 'սեպտեմբերի', 'հոկտեմբերի', 'նոյեմբերի', 'դեկտեմբերի'], + 'months_standalone' => ['հունվար', 'փետրվար', 'մարտ', 'ապրիլ', 'մայիս', 'հունիս', 'հուլիս', 'օգոստոս', 'սեպտեմբեր', 'հոկտեմբեր', 'նոյեմբեր', 'դեկտեմբեր'], + 'months_short' => ['հնվ', 'փտր', 'մրտ', 'ապր', 'մյս', 'հնս', 'հլս', 'օգս', 'սպտ', 'հկտ', 'նմբ', 'դկտ'], + 'months_regexp' => '/(D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|L{2,4}|l{2,4})/', + 'weekdays' => ['կիրակի', 'երկուշաբթի', 'երեքշաբթի', 'չորեքշաբթի', 'հինգշաբթի', 'ուրբաթ', 'շաբաթ'], + 'weekdays_short' => ['կրկ', 'երկ', 'երք', 'չրք', 'հնգ', 'ուրբ', 'շբթ'], + 'weekdays_min' => ['կրկ', 'երկ', 'երք', 'չրք', 'հնգ', 'ուրբ', 'շբթ'], + 'list' => [', ', ' եւ '], + 'first_day_of_week' => 1, +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hy_AM.php b/vendor/nesbot/carbon/src/Carbon/Lang/hy_AM.php new file mode 100644 index 00000000..4587df56 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/hy_AM.php @@ -0,0 +1,24 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - François B + * - Tim Fish + * - Serhan Apaydın + * - JD Isaacks + */ +return array_replace_recursive(require __DIR__.'/hy.php', [ + 'from_now' => ':time հետո', + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/i18n.php b/vendor/nesbot/carbon/src/Carbon/Lang/i18n.php new file mode 100644 index 00000000..e65449b8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/i18n.php @@ -0,0 +1,23 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'YYYY-MM-DD', + ], + 'months' => ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'], + 'months_short' => ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'], + 'weekdays' => ['1', '2', '3', '4', '5', '6', '7'], + 'weekdays_short' => ['1', '2', '3', '4', '5', '6', '7'], + 'weekdays_min' => ['1', '2', '3', '4', '5', '6', '7'], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 4, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ia.php b/vendor/nesbot/carbon/src/Carbon/Lang/ia.php new file mode 100644 index 00000000..0a0d5e61 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ia.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/ia_FR.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ia_FR.php b/vendor/nesbot/carbon/src/Carbon/Lang/ia_FR.php new file mode 100644 index 00000000..de4b2fa0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ia_FR.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Fedora Project Nik Kalach nikka@fedoraproject.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD.MM.YYYY', + ], + 'months' => ['januario', 'februario', 'martio', 'april', 'maio', 'junio', 'julio', 'augusto', 'septembre', 'octobre', 'novembre', 'decembre'], + 'months_short' => ['jan', 'feb', 'mar', 'apr', 'mai', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'], + 'weekdays' => ['dominica', 'lunedi', 'martedi', 'mercuridi', 'jovedi', 'venerdi', 'sabbato'], + 'weekdays_short' => ['dom', 'lun', 'mar', 'mer', 'jov', 'ven', 'sab'], + 'weekdays_min' => ['dom', 'lun', 'mar', 'mer', 'jov', 'ven', 'sab'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + + 'year' => 'anno :count', + 'y' => 'anno :count', + 'a_year' => 'anno :count', + + 'month' => ':count mense', + 'm' => ':count mense', + 'a_month' => ':count mense', + + 'week' => ':count septimana', + 'w' => ':count septimana', + 'a_week' => ':count septimana', + + 'day' => ':count die', + 'd' => ':count die', + 'a_day' => ':count die', + + 'hour' => ':count hora', + 'h' => ':count hora', + 'a_hour' => ':count hora', + + 'minute' => ':count minuscule', + 'min' => ':count minuscule', + 'a_minute' => ':count minuscule', + + 'second' => ':count secunda', + 's' => ':count secunda', + 'a_second' => ':count secunda', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/id.php b/vendor/nesbot/carbon/src/Carbon/Lang/id.php new file mode 100644 index 00000000..afaf78f2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/id.php @@ -0,0 +1,92 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - du + * - JD Isaacks + * - Nafies Luthfi + * - Raymundus Jati Primanda (mundusjp) + * - diankur313 + * - a-wip0 + */ +return [ + 'year' => ':count tahun', + 'a_year' => '{1}setahun|]1,Inf[:count tahun', + 'y' => ':countthn', + 'month' => ':count bulan', + 'a_month' => '{1}sebulan|]1,Inf[:count bulan', + 'm' => ':countbln', + 'week' => ':count minggu', + 'a_week' => '{1}seminggu|]1,Inf[:count minggu', + 'w' => ':countmgg', + 'day' => ':count hari', + 'a_day' => '{1}sehari|]1,Inf[:count hari', + 'd' => ':counthr', + 'hour' => ':count jam', + 'a_hour' => '{1}sejam|]1,Inf[:count jam', + 'h' => ':countj', + 'minute' => ':count menit', + 'a_minute' => '{1}semenit|]1,Inf[:count menit', + 'min' => ':countmnt', + 'second' => ':count detik', + 'a_second' => '{1}beberapa detik|]1,Inf[:count detik', + 's' => ':countdt', + 'ago' => ':time yang lalu', + 'from_now' => ':time dari sekarang', + 'after' => ':time setelahnya', + 'before' => ':time sebelumnya', + 'diff_now' => 'sekarang', + 'diff_today' => 'Hari', + 'diff_today_regexp' => 'Hari(?:\\s+ini)?(?:\\s+pukul)?', + 'diff_yesterday' => 'kemarin', + 'diff_yesterday_regexp' => 'Kemarin(?:\\s+pukul)?', + 'diff_tomorrow' => 'besok', + 'diff_tomorrow_regexp' => 'Besok(?:\\s+pukul)?', + 'formats' => [ + 'LT' => 'HH.mm', + 'LTS' => 'HH.mm.ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY [pukul] HH.mm', + 'LLLL' => 'dddd, D MMMM YYYY [pukul] HH.mm', + ], + 'calendar' => [ + 'sameDay' => '[Hari ini pukul] LT', + 'nextDay' => '[Besok pukul] LT', + 'nextWeek' => 'dddd [pukul] LT', + 'lastDay' => '[Kemarin pukul] LT', + 'lastWeek' => 'dddd [lalu pukul] LT', + 'sameElse' => 'L', + ], + 'meridiem' => function ($hour) { + if ($hour < 11) { + return 'pagi'; + } + if ($hour < 15) { + return 'siang'; + } + if ($hour < 19) { + return 'sore'; + } + + return 'malam'; + }, + 'months' => ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'], + 'months_short' => ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Agt', 'Sep', 'Okt', 'Nov', 'Des'], + 'weekdays' => ['Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu'], + 'weekdays_short' => ['Min', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'], + 'weekdays_min' => ['Mg', 'Sn', 'Sl', 'Rb', 'Km', 'Jm', 'Sb'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' dan '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/id_ID.php b/vendor/nesbot/carbon/src/Carbon/Lang/id_ID.php new file mode 100644 index 00000000..d5953a14 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/id_ID.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/id.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ig.php b/vendor/nesbot/carbon/src/Carbon/Lang/ig.php new file mode 100644 index 00000000..de51e9cc --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ig.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/ig_NG.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ig_NG.php b/vendor/nesbot/carbon/src/Carbon/Lang/ig_NG.php new file mode 100644 index 00000000..0034e35d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ig_NG.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - pablo@mandriva.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YY', + ], + 'months' => ['Jenụwarị', 'Febrụwarị', 'Maachị', 'Eprel', 'Mee', 'Juun', 'Julaị', 'Ọgọọst', 'Septemba', 'Ọktoba', 'Novemba', 'Disemba'], + 'months_short' => ['Jen', 'Feb', 'Maa', 'Epr', 'Mee', 'Juu', 'Jul', 'Ọgọ', 'Sep', 'Ọkt', 'Nov', 'Dis'], + 'weekdays' => ['sọnde', 'mọnde', 'tuzde', 'wenzde', 'tọsde', 'fraịde', 'satọde'], + 'weekdays_short' => ['sọn', 'mọn', 'tuz', 'wen', 'tọs', 'fra', 'sat'], + 'weekdays_min' => ['sọn', 'mọn', 'tuz', 'wen', 'tọs', 'fra', 'sat'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + + 'year' => 'afo :count', + 'y' => 'afo :count', + 'a_year' => 'afo :count', + + 'month' => 'önwa :count', + 'm' => 'önwa :count', + 'a_month' => 'önwa :count', + + 'week' => 'izu :count', + 'w' => 'izu :count', + 'a_week' => 'izu :count', + + 'day' => 'ụbọchị :count', + 'd' => 'ụbọchị :count', + 'a_day' => 'ụbọchị :count', + + 'hour' => 'awa :count', + 'h' => 'awa :count', + 'a_hour' => 'awa :count', + + 'minute' => 'minit :count', + 'min' => 'minit :count', + 'a_minute' => 'minit :count', + + 'second' => 'sekọnd :count', + 's' => 'sekọnd :count', + 'a_second' => 'sekọnd :count', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ii.php b/vendor/nesbot/carbon/src/Carbon/Lang/ii.php new file mode 100644 index 00000000..a4246c27 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ii.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['ꎸꄑ', 'ꁯꋒ'], + 'weekdays' => ['ꑭꆏꑍ', 'ꆏꊂꋍ', 'ꆏꊂꑍ', 'ꆏꊂꌕ', 'ꆏꊂꇖ', 'ꆏꊂꉬ', 'ꆏꊂꃘ'], + 'weekdays_short' => ['ꑭꆏ', 'ꆏꋍ', 'ꆏꑍ', 'ꆏꌕ', 'ꆏꇖ', 'ꆏꉬ', 'ꆏꃘ'], + 'weekdays_min' => ['ꑭꆏ', 'ꆏꋍ', 'ꆏꑍ', 'ꆏꌕ', 'ꆏꇖ', 'ꆏꉬ', 'ꆏꃘ'], + 'months' => null, + 'months_short' => ['ꋍꆪ', 'ꑍꆪ', 'ꌕꆪ', 'ꇖꆪ', 'ꉬꆪ', 'ꃘꆪ', 'ꏃꆪ', 'ꉆꆪ', 'ꈬꆪ', 'ꊰꆪ', 'ꊰꊪꆪ', 'ꊰꑋꆪ'], + 'formats' => [ + 'LT' => 'h:mm a', + 'LTS' => 'h:mm:ss a', + 'L' => 'YYYY-MM-dd', + 'LL' => 'YYYY MMM D', + 'LLL' => 'YYYY MMMM D h:mm a', + 'LLLL' => 'YYYY MMMM D, dddd h:mm a', + ], + + 'year' => ':count ꒉ', // less reliable + 'y' => ':count ꒉ', // less reliable + 'a_year' => ':count ꒉ', // less reliable + + 'month' => ':count ꆪ', + 'm' => ':count ꆪ', + 'a_month' => ':count ꆪ', + + 'week' => ':count ꏃ', // less reliable + 'w' => ':count ꏃ', // less reliable + 'a_week' => ':count ꏃ', // less reliable + + 'day' => ':count ꏜ', // less reliable + 'd' => ':count ꏜ', // less reliable + 'a_day' => ':count ꏜ', // less reliable + + 'hour' => ':count ꄮꈉ', + 'h' => ':count ꄮꈉ', + 'a_hour' => ':count ꄮꈉ', + + 'minute' => ':count ꀄꊭ', // less reliable + 'min' => ':count ꀄꊭ', // less reliable + 'a_minute' => ':count ꀄꊭ', // less reliable + + 'second' => ':count ꇅ', // less reliable + 's' => ':count ꇅ', // less reliable + 'a_second' => ':count ꇅ', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ik.php b/vendor/nesbot/carbon/src/Carbon/Lang/ik.php new file mode 100644 index 00000000..7a13aa2d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ik.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/ik_CA.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ik_CA.php b/vendor/nesbot/carbon/src/Carbon/Lang/ik_CA.php new file mode 100644 index 00000000..bb2a109b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ik_CA.php @@ -0,0 +1,50 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - pablo@mandriva.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YY', + ], + 'months' => ['Siqiññaatchiaq', 'Siqiññaasrugruk', 'Paniqsiqsiivik', 'Qilġich Tatqiat', 'Suppivik', 'Iġñivik', 'Itchavik', 'Tiññivik', 'Amiġaiqsivik', 'Sikkuvik', 'Nippivik', 'Siqiñġiḷaq'], + 'months_short' => ['Sñt', 'Sñs', 'Pan', 'Qil', 'Sup', 'Iġñ', 'Itc', 'Tiñ', 'Ami', 'Sik', 'Nip', 'Siq'], + 'weekdays' => ['Minġuiqsioiq', 'Savałłiq', 'Ilaqtchiioiq', 'Qitchiioiq', 'Sisamiioiq', 'Tallimmiioiq', 'Maqinġuoiq'], + 'weekdays_short' => ['Min', 'Sav', 'Ila', 'Qit', 'Sis', 'Tal', 'Maq'], + 'weekdays_min' => ['Min', 'Sav', 'Ila', 'Qit', 'Sis', 'Tal', 'Maq'], + 'day_of_first_week_of_year' => 1, + + 'year' => ':count ukiuq', + 'y' => ':count ukiuq', + 'a_year' => ':count ukiuq', + + 'month' => ':count Tatqiat', + 'm' => ':count Tatqiat', + 'a_month' => ':count Tatqiat', + + 'week' => ':count tatqiat', // less reliable + 'w' => ':count tatqiat', // less reliable + 'a_week' => ':count tatqiat', // less reliable + + 'day' => ':count siqiñiq', // less reliable + 'd' => ':count siqiñiq', // less reliable + 'a_day' => ':count siqiñiq', // less reliable + + 'hour' => ':count Siḷa', // less reliable + 'h' => ':count Siḷa', // less reliable + 'a_hour' => ':count Siḷa', // less reliable + + 'second' => ':count iġñiq', // less reliable + 's' => ':count iġñiq', // less reliable + 'a_second' => ':count iġñiq', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/in.php b/vendor/nesbot/carbon/src/Carbon/Lang/in.php new file mode 100644 index 00000000..d5953a14 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/in.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/id.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/is.php b/vendor/nesbot/carbon/src/Carbon/Lang/is.php new file mode 100644 index 00000000..9990168c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/is.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Kristján Ingi Geirsson + */ +return [ + 'year' => '1 ár|:count ár', + 'y' => '1 ár|:count ár', + 'month' => '1 mánuður|:count mánuðir', + 'm' => '1 mánuður|:count mánuðir', + 'week' => '1 vika|:count vikur', + 'w' => '1 vika|:count vikur', + 'day' => '1 dagur|:count dagar', + 'd' => '1 dagur|:count dagar', + 'hour' => '1 klukkutími|:count klukkutímar', + 'h' => '1 klukkutími|:count klukkutímar', + 'minute' => '1 mínúta|:count mínútur', + 'min' => '1 mínúta|:count mínútur', + 'second' => '1 sekúnda|:count sekúndur', + 's' => '1 sekúnda|:count sekúndur', + 'ago' => ':time síðan', + 'from_now' => ':time síðan', + 'after' => ':time eftir', + 'before' => ':time fyrir', + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' og '], + 'meridiem' => ['fh', 'eh'], + 'diff_now' => 'núna', + 'diff_yesterday' => 'í gær', + 'diff_tomorrow' => 'á morgun', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D. MMMM YYYY', + 'LLL' => 'D. MMMM [kl.] HH:mm', + 'LLLL' => 'dddd D. MMMM YYYY [kl.] HH:mm', + ], + 'weekdays' => ['sunnudaginn', 'mánudaginn', 'þriðjudaginn', 'miðvikudaginn', 'fimmtudaginn', 'föstudaginn', 'laugardaginn'], + 'weekdays_short' => ['sun', 'mán', 'þri', 'mið', 'fim', 'fös', 'lau'], + 'weekdays_min' => ['sun', 'mán', 'þri', 'mið', 'fim', 'fös', 'lau'], + 'months' => ['janúar', 'febrúar', 'mars', 'apríl', 'maí', 'júní', 'júlí', 'ágúst', 'september', 'október', 'nóvember', 'desember'], + 'months_short' => ['jan', 'feb', 'mar', 'apr', 'maí', 'jún', 'júl', 'ágú', 'sep', 'okt', 'nóv', 'des'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/is_IS.php b/vendor/nesbot/carbon/src/Carbon/Lang/is_IS.php new file mode 100644 index 00000000..4d35c448 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/is_IS.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/is.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/it.php b/vendor/nesbot/carbon/src/Carbon/Lang/it.php new file mode 100644 index 00000000..49875d7e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/it.php @@ -0,0 +1,115 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Ash + * - François B + * - Marco Perrando + * - Massimiliano Caniparoli + * - JD Isaacks + * - Andrea Martini + * - Francesco Marasco + * - Tizianoz93 + * - Davide Casiraghi (davide-casiraghi) + * - Pete Scopes (pdscopes) + */ + +use Carbon\CarbonInterface; + +return [ + 'year' => ':count anno|:count anni', + 'a_year' => 'un anno|:count anni', + 'y' => ':count anno|:count anni', + 'month' => ':count mese|:count mesi', + 'a_month' => 'un mese|:count mesi', + 'm' => ':count mese|:count mesi', + 'week' => ':count settimana|:count settimane', + 'a_week' => 'una settimana|:count settimane', + 'w' => ':count set.', + 'day' => ':count giorno|:count giorni', + 'a_day' => 'un giorno|:count giorni', + 'd' => ':count g|:count gg', + 'hour' => ':count ora|:count ore', + 'a_hour' => 'un\'ora|:count ore', + 'h' => ':count h', + 'minute' => ':count minuto|:count minuti', + 'a_minute' => 'un minuto|:count minuti', + 'min' => ':count min.', + 'second' => ':count secondo|:count secondi', + 'a_second' => 'alcuni secondi|:count secondi', + 's' => ':count sec.', + 'millisecond' => ':count millisecondo|:count millisecondi', + 'a_millisecond' => 'un millisecondo|:count millisecondi', + 'ms' => ':countms', + 'microsecond' => ':count microsecondo|:count microsecondi', + 'a_microsecond' => 'un microsecondo|:count microsecondi', + 'µs' => ':countµs', + 'ago' => ':time fa', + 'from_now' => function ($time) { + return (preg_match('/^\d.+$/', $time) ? 'tra' : 'in')." $time"; + }, + 'after' => ':time dopo', + 'before' => ':time prima', + 'diff_now' => 'proprio ora', + 'diff_today' => 'Oggi', + 'diff_today_regexp' => 'Oggi(?:\\s+alle)?', + 'diff_yesterday' => 'ieri', + 'diff_yesterday_regexp' => 'Ieri(?:\\s+alle)?', + 'diff_tomorrow' => 'domani', + 'diff_tomorrow_regexp' => 'Domani(?:\\s+alle)?', + 'diff_before_yesterday' => 'l\'altro ieri', + 'diff_after_tomorrow' => 'dopodomani', + 'period_interval' => 'ogni :interval', + 'period_start_date' => 'dal :date', + 'period_end_date' => 'al :date', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Oggi alle] LT', + 'nextDay' => '[Domani alle] LT', + 'nextWeek' => 'dddd [alle] LT', + 'lastDay' => '[Ieri alle] LT', + 'lastWeek' => function (CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[la scorsa] dddd [alle] LT'; + default: + return '[lo scorso] dddd [alle] LT'; + } + }, + 'sameElse' => 'L', + ], + 'ordinal' => ':numberº', + 'months' => ['gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre'], + 'months_short' => ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'], + 'weekdays' => ['domenica', 'lunedì', 'martedì', 'mercoledì', 'giovedì', 'venerdì', 'sabato'], + 'weekdays_short' => ['dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab'], + 'weekdays_min' => ['do', 'lu', 'ma', 'me', 'gi', 've', 'sa'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' e '], + 'ordinal_words' => [ + 'of' => 'di', + 'first' => 'primo', + 'second' => 'secondo', + 'third' => 'terzo', + 'fourth' => 'quarto', + 'fifth' => 'quinto', + 'last' => 'ultimo', + ], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/it_CH.php b/vendor/nesbot/carbon/src/Carbon/Lang/it_CH.php new file mode 100644 index 00000000..c23cc50e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/it_CH.php @@ -0,0 +1,20 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Propaganistas + */ +return array_replace_recursive(require __DIR__.'/it.php', [ + 'formats' => [ + 'L' => 'DD.MM.YYYY', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/it_IT.php b/vendor/nesbot/carbon/src/Carbon/Lang/it_IT.php new file mode 100644 index 00000000..a5d19818 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/it_IT.php @@ -0,0 +1,16 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP bug-glibc-locales@gnu.org + */ +return require __DIR__.'/it.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/it_SM.php b/vendor/nesbot/carbon/src/Carbon/Lang/it_SM.php new file mode 100644 index 00000000..5e8fc92f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/it_SM.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/it.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/it_VA.php b/vendor/nesbot/carbon/src/Carbon/Lang/it_VA.php new file mode 100644 index 00000000..5e8fc92f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/it_VA.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/it.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/iu.php b/vendor/nesbot/carbon/src/Carbon/Lang/iu.php new file mode 100644 index 00000000..4fa97427 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/iu.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/iu_CA.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/iu_CA.php b/vendor/nesbot/carbon/src/Carbon/Lang/iu_CA.php new file mode 100644 index 00000000..6ab7e149 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/iu_CA.php @@ -0,0 +1,54 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Pablo Saratxaga pablo@mandriva.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'MM/DD/YY', + ], + 'months' => ['ᔮᓄᐊᓕ', 'ᕕᕗᐊᓕ', 'ᒪᔅᓯ', 'ᐃᐳᓗ', 'ᒪᐃ', 'ᔪᓂ', 'ᔪᓚᐃ', 'ᐊᒋᓯ', 'ᓯᑎᕙ', 'ᐊᑦᑐᕙ', 'ᓄᕕᕙ', 'ᑎᓯᕝᕙ'], + 'months_short' => ['ᔮᓄ', 'ᕕᕗ', 'ᒪᔅ', 'ᐃᐳ', 'ᒪᐃ', 'ᔪᓂ', 'ᔪᓚ', 'ᐊᒋ', 'ᓯᑎ', 'ᐊᑦ', 'ᓄᕕ', 'ᑎᓯ'], + 'weekdays' => ['ᓈᑦᑎᖑᔭᕐᕕᒃ', 'ᓇᒡᒐᔾᔭᐅ', 'ᓇᒡᒐᔾᔭᐅᓕᖅᑭᑦ', 'ᐱᖓᓲᓕᖅᓯᐅᑦ', 'ᕿᑎᖅᑰᑦ', 'ᐅᓪᓗᕈᓘᑐᐃᓇᖅ', 'ᓯᕙᑖᕕᒃ'], + 'weekdays_short' => ['ᓈ', 'ᓇ', 'ᓕ', 'ᐱ', 'ᕿ', 'ᐅ', 'ᓯ'], + 'weekdays_min' => ['ᓈ', 'ᓇ', 'ᓕ', 'ᐱ', 'ᕿ', 'ᐅ', 'ᓯ'], + 'day_of_first_week_of_year' => 1, + + 'year' => ':count ᐅᑭᐅᖅ', + 'y' => ':count ᐅᑭᐅᖅ', + 'a_year' => ':count ᐅᑭᐅᖅ', + + 'month' => ':count qaammat', + 'm' => ':count qaammat', + 'a_month' => ':count qaammat', + + 'week' => ':count sapaatip akunnera', + 'w' => ':count sapaatip akunnera', + 'a_week' => ':count sapaatip akunnera', + + 'day' => ':count ulloq', + 'd' => ':count ulloq', + 'a_day' => ':count ulloq', + + 'hour' => ':count ikarraq', + 'h' => ':count ikarraq', + 'a_hour' => ':count ikarraq', + + 'minute' => ':count titiqqaralaaq', // less reliable + 'min' => ':count titiqqaralaaq', // less reliable + 'a_minute' => ':count titiqqaralaaq', // less reliable + + 'second' => ':count marluk', // less reliable + 's' => ':count marluk', // less reliable + 'a_second' => ':count marluk', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/iw.php b/vendor/nesbot/carbon/src/Carbon/Lang/iw.php new file mode 100644 index 00000000..a26e3506 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/iw.php @@ -0,0 +1,58 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'months' => ['ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'], + 'months_short' => ['ינו׳', 'פבר׳', 'מרץ', 'אפר׳', 'מאי', 'יוני', 'יולי', 'אוג׳', 'ספט׳', 'אוק׳', 'נוב׳', 'דצמ׳'], + 'weekdays' => ['יום ראשון', 'יום שני', 'יום שלישי', 'יום רביעי', 'יום חמישי', 'יום שישי', 'יום שבת'], + 'weekdays_short' => ['יום א׳', 'יום ב׳', 'יום ג׳', 'יום ד׳', 'יום ה׳', 'יום ו׳', 'שבת'], + 'weekdays_min' => ['א׳', 'ב׳', 'ג׳', 'ד׳', 'ה׳', 'ו׳', 'ש׳'], + 'meridiem' => ['לפנה״צ', 'אחה״צ'], + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'D.M.YYYY', + 'LL' => 'D בMMM YYYY', + 'LLL' => 'D בMMMM YYYY H:mm', + 'LLLL' => 'dddd, D בMMMM YYYY H:mm', + ], + + 'year' => ':count שנה', + 'y' => ':count שנה', + 'a_year' => ':count שנה', + + 'month' => ':count חודש', + 'm' => ':count חודש', + 'a_month' => ':count חודש', + + 'week' => ':count שבוע', + 'w' => ':count שבוע', + 'a_week' => ':count שבוע', + + 'day' => ':count יום', + 'd' => ':count יום', + 'a_day' => ':count יום', + + 'hour' => ':count שעה', + 'h' => ':count שעה', + 'a_hour' => ':count שעה', + + 'minute' => ':count דקה', + 'min' => ':count דקה', + 'a_minute' => ':count דקה', + + 'second' => ':count שניה', + 's' => ':count שניה', + 'a_second' => ':count שניה', + + 'ago' => 'לפני :time', + 'from_now' => 'בעוד :time', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ja.php b/vendor/nesbot/carbon/src/Carbon/Lang/ja.php new file mode 100644 index 00000000..1ca67519 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ja.php @@ -0,0 +1,102 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Takuya Sawada + * - Atsushi Tanaka + * - François B + * - Jason Katz-Brown + * - Serhan Apaydın + * - XueWei + * - JD Isaacks + * - toyama satoshi + * - atakigawa + */ + +use Carbon\CarbonInterface; + +return [ + 'year' => ':count年', + 'y' => ':count年', + 'month' => ':countヶ月', + 'm' => ':countヶ月', + 'week' => ':count週間', + 'w' => ':count週間', + 'day' => ':count日', + 'd' => ':count日', + 'hour' => ':count時間', + 'h' => ':count時間', + 'minute' => ':count分', + 'min' => ':count分', + 'second' => ':count秒', + 'a_second' => '{1}数秒|]1,Inf[:count秒', + 's' => ':count秒', + 'ago' => ':time前', + 'from_now' => ':time後', + 'after' => ':time後', + 'before' => ':time前', + 'diff_now' => '今', + 'diff_today' => '今日', + 'diff_yesterday' => '昨日', + 'diff_tomorrow' => '明日', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY/MM/DD', + 'LL' => 'YYYY年M月D日', + 'LLL' => 'YYYY年M月D日 HH:mm', + 'LLLL' => 'YYYY年M月D日 dddd HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[今日] LT', + 'nextDay' => '[明日] LT', + 'nextWeek' => function (CarbonInterface $current, CarbonInterface $other) { + if ($other->week !== $current->week) { + return '[来週]dddd LT'; + } + + return 'dddd LT'; + }, + 'lastDay' => '[昨日] LT', + 'lastWeek' => function (CarbonInterface $current, CarbonInterface $other) { + if ($other->week !== $current->week) { + return '[先週]dddd LT'; + } + + return 'dddd LT'; + }, + 'sameElse' => 'L', + ], + 'ordinal' => function ($number, $period) { + switch ($period) { + case 'd': + case 'D': + case 'DDD': + return $number.'日'; + default: + return $number; + } + }, + 'meridiem' => ['午前', '午後'], + 'months' => ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], + 'months_short' => ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], + 'weekdays' => ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'], + 'weekdays_short' => ['日', '月', '火', '水', '木', '金', '土'], + 'weekdays_min' => ['日', '月', '火', '水', '木', '金', '土'], + 'list' => '、', + 'alt_numbers' => ['〇', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二', '十三', '十四', '十五', '十六', '十七', '十八', '十九', '二十', '二十一', '二十二', '二十三', '二十四', '二十五', '二十六', '二十七', '二十八', '二十九', '三十', '三十一', '三十二', '三十三', '三十四', '三十五', '三十六', '三十七', '三十八', '三十九', '四十', '四十一', '四十二', '四十三', '四十四', '四十五', '四十六', '四十七', '四十八', '四十九', '五十', '五十一', '五十二', '五十三', '五十四', '五十五', '五十六', '五十七', '五十八', '五十九', '六十', '六十一', '六十二', '六十三', '六十四', '六十五', '六十六', '六十七', '六十八', '六十九', '七十', '七十一', '七十二', '七十三', '七十四', '七十五', '七十六', '七十七', '七十八', '七十九', '八十', '八十一', '八十二', '八十三', '八十四', '八十五', '八十六', '八十七', '八十八', '八十九', '九十', '九十一', '九十二', '九十三', '九十四', '九十五', '九十六', '九十七', '九十八', '九十九'], + 'alt_numbers_pow' => [ + 10000 => '万', + 1000 => '千', + 100 => '百', + ], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ja_JP.php b/vendor/nesbot/carbon/src/Carbon/Lang/ja_JP.php new file mode 100644 index 00000000..c2836253 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ja_JP.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/ja.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/jgo.php b/vendor/nesbot/carbon/src/Carbon/Lang/jgo.php new file mode 100644 index 00000000..6a1e77a8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/jgo.php @@ -0,0 +1,13 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/jmc.php b/vendor/nesbot/carbon/src/Carbon/Lang/jmc.php new file mode 100644 index 00000000..ed92e8e7 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/jmc.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['utuko', 'kyiukonyi'], + 'weekdays' => ['Jumapilyi', 'Jumatatuu', 'Jumanne', 'Jumatanu', 'Alhamisi', 'Ijumaa', 'Jumamosi'], + 'weekdays_short' => ['Jpi', 'Jtt', 'Jnn', 'Jtn', 'Alh', 'Iju', 'Jmo'], + 'weekdays_min' => ['Jpi', 'Jtt', 'Jnn', 'Jtn', 'Alh', 'Iju', 'Jmo'], + 'months' => ['Januari', 'Februari', 'Machi', 'Aprilyi', 'Mei', 'Junyi', 'Julyai', 'Agusti', 'Septemba', 'Oktoba', 'Novemba', 'Desemba'], + 'months_short' => ['Jan', 'Feb', 'Mac', 'Apr', 'Mei', 'Jun', 'Jul', 'Ago', 'Sep', 'Okt', 'Nov', 'Des'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/jv.php b/vendor/nesbot/carbon/src/Carbon/Lang/jv.php new file mode 100644 index 00000000..bcbe044e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/jv.php @@ -0,0 +1,71 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - tgfjt + * - JD Isaacks + */ +return [ + 'year' => '{1}setaun|]1,Inf[:count taun', + 'month' => '{1}sewulan|]1,Inf[:count wulan', + 'week' => '{1}sakminggu|]1,Inf[:count minggu', + 'day' => '{1}sedinten|]1,Inf[:count dinten', + 'hour' => '{1}setunggal jam|]1,Inf[:count jam', + 'minute' => '{1}setunggal menit|]1,Inf[:count menit', + 'second' => '{1}sawetawis detik|]1,Inf[:count detik', + 'ago' => ':time ingkang kepengker', + 'from_now' => 'wonten ing :time', + 'diff_today' => 'Dinten', + 'diff_yesterday' => 'Kala', + 'diff_yesterday_regexp' => 'Kala(?:\\s+wingi)?(?:\\s+pukul)?', + 'diff_tomorrow' => 'Mbenjang', + 'diff_tomorrow_regexp' => 'Mbenjang(?:\\s+pukul)?', + 'diff_today_regexp' => 'Dinten(?:\\s+puniko)?(?:\\s+pukul)?', + 'formats' => [ + 'LT' => 'HH.mm', + 'LTS' => 'HH.mm.ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY [pukul] HH.mm', + 'LLLL' => 'dddd, D MMMM YYYY [pukul] HH.mm', + ], + 'calendar' => [ + 'sameDay' => '[Dinten puniko pukul] LT', + 'nextDay' => '[Mbenjang pukul] LT', + 'nextWeek' => 'dddd [pukul] LT', + 'lastDay' => '[Kala wingi pukul] LT', + 'lastWeek' => 'dddd [kepengker pukul] LT', + 'sameElse' => 'L', + ], + 'meridiem' => function ($hour) { + if ($hour < 11) { + return 'enjing'; + } + if ($hour < 15) { + return 'siyang'; + } + if ($hour < 19) { + return 'sonten'; + } + + return 'ndalu'; + }, + 'months' => ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'Nopember', 'Desember'], + 'months_short' => ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Ags', 'Sep', 'Okt', 'Nop', 'Des'], + 'weekdays' => ['Minggu', 'Senen', 'Seloso', 'Rebu', 'Kemis', 'Jemuwah', 'Septu'], + 'weekdays_short' => ['Min', 'Sen', 'Sel', 'Reb', 'Kem', 'Jem', 'Sep'], + 'weekdays_min' => ['Mg', 'Sn', 'Sl', 'Rb', 'Km', 'Jm', 'Sp'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' lan '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ka.php b/vendor/nesbot/carbon/src/Carbon/Lang/ka.php new file mode 100644 index 00000000..a5d563d3 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ka.php @@ -0,0 +1,204 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Tornike Razmadze + * - François B + * - Lasha Dolidze + * - Tim Fish + * - JD Isaacks + * - Tornike Razmadze + * - François B + * - Lasha Dolidze + * - JD Isaacks + * - LONGMAN + * - Avtandil Kikabidze (akalongman) + * - Levan Velijanashvili (Stichoza) + */ + +use Carbon\CarbonInterface; + +return [ + 'year' => ':count წელი', + 'y' => ':count წელი', + 'a_year' => '{1}წელი|]1,Inf[:count წელი', + 'month' => ':count თვე', + 'm' => ':count თვე', + 'a_month' => '{1}თვე|]1,Inf[:count თვე', + 'week' => ':count კვირა', + 'w' => ':count კვირა', + 'a_week' => '{1}კვირა|]1,Inf[:count კვირა', + 'day' => ':count დღე', + 'd' => ':count დღე', + 'a_day' => '{1}დღე|]1,Inf[:count დღე', + 'hour' => ':count საათი', + 'h' => ':count საათი', + 'a_hour' => '{1}საათი|]1,Inf[:count საათი', + 'minute' => ':count წუთი', + 'min' => ':count წუთი', + 'a_minute' => '{1}წუთი|]1,Inf[:count წუთი', + 'second' => ':count წამი', + 's' => ':count წამი', + 'a_second' => '{1}რამდენიმე წამი|]1,Inf[:count წამი', + 'ago' => function ($time) { + $replacements = [ + // year + 'წელი' => 'წლის', + // month + 'თვე' => 'თვის', + // week + 'კვირა' => 'კვირის', + // day + 'დღე' => 'დღის', + // hour + 'საათი' => 'საათის', + // minute + 'წუთი' => 'წუთის', + // second + 'წამი' => 'წამის', + ]; + $time = strtr($time, array_flip($replacements)); + $time = strtr($time, $replacements); + + return "$time წინ"; + }, + 'from_now' => function ($time) { + $replacements = [ + // year + 'წელი' => 'წელიწადში', + // week + 'კვირა' => 'კვირაში', + // day + 'დღე' => 'დღეში', + // month + 'თვე' => 'თვეში', + // hour + 'საათი' => 'საათში', + // minute + 'წუთი' => 'წუთში', + // second + 'წამი' => 'წამში', + ]; + $time = strtr($time, array_flip($replacements)); + $time = strtr($time, $replacements); + + return $time; + }, + 'after' => function ($time) { + $replacements = [ + // year + 'წელი' => 'წლის', + // month + 'თვე' => 'თვის', + // week + 'კვირა' => 'კვირის', + // day + 'დღე' => 'დღის', + // hour + 'საათი' => 'საათის', + // minute + 'წუთი' => 'წუთის', + // second + 'წამი' => 'წამის', + ]; + $time = strtr($time, array_flip($replacements)); + $time = strtr($time, $replacements); + + return "$time შემდეგ"; + }, + 'before' => function ($time) { + $replacements = [ + // year + 'წელი' => 'წლით', + // month + 'თვე' => 'თვით', + // week + 'კვირა' => 'კვირით', + // day + 'დღე' => 'დღით', + // hour + 'საათი' => 'საათით', + // minute + 'წუთი' => 'წუთით', + // second + 'წამი' => 'წამით', + ]; + $time = strtr($time, array_flip($replacements)); + $time = strtr($time, $replacements); + + return "$time ადრე"; + }, + 'diff_now' => 'ახლა', + 'diff_today' => 'დღეს', + 'diff_yesterday' => 'გუშინ', + 'diff_tomorrow' => 'ხვალ', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[დღეს], LT[-ზე]', + 'nextDay' => '[ხვალ], LT[-ზე]', + 'nextWeek' => function (CarbonInterface $current, CarbonInterface $other) { + return ($current->isSameWeek($other) ? '' : '[შემდეგ] ').'dddd, LT[-ზე]'; + }, + 'lastDay' => '[გუშინ], LT[-ზე]', + 'lastWeek' => '[წინა] dddd, LT-ზე', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + if ($number === 0) { + return $number; + } + if ($number === 1) { + return $number.'-ლი'; + } + if (($number < 20) || ($number <= 100 && ($number % 20 === 0)) || ($number % 100 === 0)) { + return 'მე-'.$number; + } + + return $number.'-ე'; + }, + 'months' => ['იანვარი', 'თებერვალი', 'მარტი', 'აპრილი', 'მაისი', 'ივნისი', 'ივლისი', 'აგვისტო', 'სექტემბერი', 'ოქტომბერი', 'ნოემბერი', 'დეკემბერი'], + 'months_standalone' => ['იანვარს', 'თებერვალს', 'მარტს', 'აპრილს', 'მაისს', 'ივნისს', 'ივლისს', 'აგვისტოს', 'სექტემბერს', 'ოქტომბერს', 'ნოემბერს', 'დეკემბერს'], + 'months_short' => ['იან', 'თებ', 'მარ', 'აპრ', 'მაი', 'ივნ', 'ივლ', 'აგვ', 'სექ', 'ოქტ', 'ნოე', 'დეკ'], + 'months_regexp' => '/(D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|L{2,4}|l{2,4})/', + 'weekdays' => ['კვირას', 'ორშაბათს', 'სამშაბათს', 'ოთხშაბათს', 'ხუთშაბათს', 'პარასკევს', 'შაბათს'], + 'weekdays_standalone' => ['კვირა', 'ორშაბათი', 'სამშაბათი', 'ოთხშაბათი', 'ხუთშაბათი', 'პარასკევი', 'შაბათი'], + 'weekdays_short' => ['კვი', 'ორშ', 'სამ', 'ოთხ', 'ხუთ', 'პარ', 'შაბ'], + 'weekdays_min' => ['კვ', 'ორ', 'სა', 'ოთ', 'ხუ', 'პა', 'შა'], + 'weekdays_regexp' => '/^([^d].*|.*[^d])$/', + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' და '], + 'meridiem' => function ($hour) { + if ($hour >= 4) { + if ($hour < 11) { + return 'დილის'; + } + + if ($hour < 16) { + return 'შუადღის'; + } + + if ($hour < 22) { + return 'საღამოს'; + } + } + + return 'ღამის'; + }, +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ka_GE.php b/vendor/nesbot/carbon/src/Carbon/Lang/ka_GE.php new file mode 100644 index 00000000..a26d9305 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ka_GE.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/ka.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/kab.php b/vendor/nesbot/carbon/src/Carbon/Lang/kab.php new file mode 100644 index 00000000..94d64737 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/kab.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/kab_DZ.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/kab_DZ.php b/vendor/nesbot/carbon/src/Carbon/Lang/kab_DZ.php new file mode 100644 index 00000000..796660be --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/kab_DZ.php @@ -0,0 +1,56 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - belkacem77@gmail.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['Yennayer', 'Fuṛar', 'Meɣres', 'Yebrir', 'Mayyu', 'Yunyu', 'Yulyu', 'ɣuct', 'Ctembeṛ', 'Tubeṛ', 'Wambeṛ', 'Dujembeṛ'], + 'months_short' => ['Yen', 'Fur', 'Meɣ', 'Yeb', 'May', 'Yun', 'Yul', 'ɣuc', 'Cte', 'Tub', 'Wam', 'Duj'], + 'weekdays' => ['Acer', 'Arim', 'Aram', 'Ahad', 'Amhad', 'Sem', 'Sed'], + 'weekdays_short' => ['Ace', 'Ari', 'Ara', 'Aha', 'Amh', 'Sem', 'Sed'], + 'weekdays_min' => ['Ace', 'Ari', 'Ara', 'Aha', 'Amh', 'Sem', 'Sed'], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['FT', 'MD'], + + 'year' => ':count n yiseggasen', + 'y' => ':count n yiseggasen', + 'a_year' => ':count n yiseggasen', + + 'month' => ':count n wayyuren', + 'm' => ':count n wayyuren', + 'a_month' => ':count n wayyuren', + + 'week' => ':count n ledwaṛ', // less reliable + 'w' => ':count n ledwaṛ', // less reliable + 'a_week' => ':count n ledwaṛ', // less reliable + + 'day' => ':count n wussan', + 'd' => ':count n wussan', + 'a_day' => ':count n wussan', + + 'hour' => ':count n tsaɛtin', + 'h' => ':count n tsaɛtin', + 'a_hour' => ':count n tsaɛtin', + + 'minute' => ':count n tedqiqin', + 'min' => ':count n tedqiqin', + 'a_minute' => ':count n tedqiqin', + + 'second' => ':count tasdidt', // less reliable + 's' => ':count tasdidt', // less reliable + 'a_second' => ':count tasdidt', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/kam.php b/vendor/nesbot/carbon/src/Carbon/Lang/kam.php new file mode 100644 index 00000000..0fc70d70 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/kam.php @@ -0,0 +1,50 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['Ĩyakwakya', 'Ĩyawĩoo'], + 'weekdays' => ['Wa kyumwa', 'Wa kwambĩlĩlya', 'Wa kelĩ', 'Wa katatũ', 'Wa kana', 'Wa katano', 'Wa thanthatũ'], + 'weekdays_short' => ['Wky', 'Wkw', 'Wkl', 'Wtũ', 'Wkn', 'Wtn', 'Wth'], + 'weekdays_min' => ['Wky', 'Wkw', 'Wkl', 'Wtũ', 'Wkn', 'Wtn', 'Wth'], + 'months' => ['Mwai wa mbee', 'Mwai wa kelĩ', 'Mwai wa katatũ', 'Mwai wa kana', 'Mwai wa katano', 'Mwai wa thanthatũ', 'Mwai wa muonza', 'Mwai wa nyaanya', 'Mwai wa kenda', 'Mwai wa ĩkumi', 'Mwai wa ĩkumi na ĩmwe', 'Mwai wa ĩkumi na ilĩ'], + 'months_short' => ['Mbe', 'Kel', 'Ktũ', 'Kan', 'Ktn', 'Tha', 'Moo', 'Nya', 'Knd', 'Ĩku', 'Ĩkm', 'Ĩkl'], + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + + // Too unreliable + /* + 'year' => ':count mbua', // less reliable + 'y' => ':count mbua', // less reliable + 'a_year' => ':count mbua', // less reliable + + 'month' => ':count ndakitali', // less reliable + 'm' => ':count ndakitali', // less reliable + 'a_month' => ':count ndakitali', // less reliable + + 'day' => ':count wia', // less reliable + 'd' => ':count wia', // less reliable + 'a_day' => ':count wia', // less reliable + + 'hour' => ':count orasan', // less reliable + 'h' => ':count orasan', // less reliable + 'a_hour' => ':count orasan', // less reliable + + 'minute' => ':count orasan', // less reliable + 'min' => ':count orasan', // less reliable + 'a_minute' => ':count orasan', // less reliable + */ +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/kde.php b/vendor/nesbot/carbon/src/Carbon/Lang/kde.php new file mode 100644 index 00000000..fbcc9f3d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/kde.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['Muhi', 'Chilo'], + 'weekdays' => ['Liduva lyapili', 'Liduva lyatatu', 'Liduva lyanchechi', 'Liduva lyannyano', 'Liduva lyannyano na linji', 'Liduva lyannyano na mavili', 'Liduva litandi'], + 'weekdays_short' => ['Ll2', 'Ll3', 'Ll4', 'Ll5', 'Ll6', 'Ll7', 'Ll1'], + 'weekdays_min' => ['Ll2', 'Ll3', 'Ll4', 'Ll5', 'Ll6', 'Ll7', 'Ll1'], + 'months' => ['Mwedi Ntandi', 'Mwedi wa Pili', 'Mwedi wa Tatu', 'Mwedi wa Nchechi', 'Mwedi wa Nnyano', 'Mwedi wa Nnyano na Umo', 'Mwedi wa Nnyano na Mivili', 'Mwedi wa Nnyano na Mitatu', 'Mwedi wa Nnyano na Nchechi', 'Mwedi wa Nnyano na Nnyano', 'Mwedi wa Nnyano na Nnyano na U', 'Mwedi wa Nnyano na Nnyano na M'], + 'months_short' => ['Jan', 'Feb', 'Mac', 'Apr', 'Mei', 'Jun', 'Jul', 'Ago', 'Sep', 'Okt', 'Nov', 'Des'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/kea.php b/vendor/nesbot/carbon/src/Carbon/Lang/kea.php new file mode 100644 index 00000000..8b6c21b9 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/kea.php @@ -0,0 +1,49 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['a', 'p'], + 'weekdays' => ['dumingu', 'sigunda-fera', 'tersa-fera', 'kuarta-fera', 'kinta-fera', 'sesta-fera', 'sabadu'], + 'weekdays_short' => ['dum', 'sig', 'ter', 'kua', 'kin', 'ses', 'sab'], + 'weekdays_min' => ['du', 'si', 'te', 'ku', 'ki', 'se', 'sa'], + 'weekdays_standalone' => ['dumingu', 'sigunda-fera', 'tersa-fera', 'kuarta-fera', 'kinta-fera', 'sesta-fera', 'sábadu'], + 'months' => ['Janeru', 'Febreru', 'Marsu', 'Abril', 'Maiu', 'Junhu', 'Julhu', 'Agostu', 'Setenbru', 'Otubru', 'Nuvenbru', 'Dizenbru'], + 'months_short' => ['Jan', 'Feb', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Otu', 'Nuv', 'Diz'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D [di] MMMM [di] YYYY HH:mm', + 'LLLL' => 'dddd, D [di] MMMM [di] YYYY HH:mm', + ], + + 'year' => ':count otunu', // less reliable + 'y' => ':count otunu', // less reliable + 'a_year' => ':count otunu', // less reliable + + 'week' => ':count día dumingu', // less reliable + 'w' => ':count día dumingu', // less reliable + 'a_week' => ':count día dumingu', // less reliable + + 'day' => ':count diâ', // less reliable + 'd' => ':count diâ', // less reliable + 'a_day' => ':count diâ', // less reliable + + 'minute' => ':count sugundu', // less reliable + 'min' => ':count sugundu', // less reliable + 'a_minute' => ':count sugundu', // less reliable + + 'second' => ':count dós', // less reliable + 's' => ':count dós', // less reliable + 'a_second' => ':count dós', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/khq.php b/vendor/nesbot/carbon/src/Carbon/Lang/khq.php new file mode 100644 index 00000000..7a834cf0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/khq.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['Adduha', 'Aluula'], + 'weekdays' => ['Alhadi', 'Atini', 'Atalata', 'Alarba', 'Alhamiisa', 'Aljuma', 'Assabdu'], + 'weekdays_short' => ['Alh', 'Ati', 'Ata', 'Ala', 'Alm', 'Alj', 'Ass'], + 'weekdays_min' => ['Alh', 'Ati', 'Ata', 'Ala', 'Alm', 'Alj', 'Ass'], + 'months' => ['Žanwiye', 'Feewiriye', 'Marsi', 'Awiril', 'Me', 'Žuweŋ', 'Žuyye', 'Ut', 'Sektanbur', 'Oktoobur', 'Noowanbur', 'Deesanbur'], + 'months_short' => ['Žan', 'Fee', 'Mar', 'Awi', 'Me', 'Žuw', 'Žuy', 'Ut', 'Sek', 'Okt', 'Noo', 'Dee'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMM, YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ki.php b/vendor/nesbot/carbon/src/Carbon/Lang/ki.php new file mode 100644 index 00000000..d86afc50 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ki.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['Kiroko', 'Hwaĩ-inĩ'], + 'weekdays' => ['Kiumia', 'Njumatatũ', 'Njumaine', 'Njumatana', 'Aramithi', 'Njumaa', 'Njumamothi'], + 'weekdays_short' => ['KMA', 'NTT', 'NMN', 'NMT', 'ART', 'NMA', 'NMM'], + 'weekdays_min' => ['KMA', 'NTT', 'NMN', 'NMT', 'ART', 'NMA', 'NMM'], + 'months' => ['Njenuarĩ', 'Mwere wa kerĩ', 'Mwere wa gatatũ', 'Mwere wa kana', 'Mwere wa gatano', 'Mwere wa gatandatũ', 'Mwere wa mũgwanja', 'Mwere wa kanana', 'Mwere wa kenda', 'Mwere wa ikũmi', 'Mwere wa ikũmi na ũmwe', 'Ndithemba'], + 'months_short' => ['JEN', 'WKR', 'WGT', 'WKN', 'WTN', 'WTD', 'WMJ', 'WNN', 'WKD', 'WIK', 'WMW', 'DIT'], + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + + 'year' => ':count mĩaka', // less reliable + 'y' => ':count mĩaka', // less reliable + 'a_year' => ':count mĩaka', // less reliable + + 'month' => ':count mweri', // less reliable + 'm' => ':count mweri', // less reliable + 'a_month' => ':count mweri', // less reliable + + 'week' => ':count kiumia', // less reliable + 'w' => ':count kiumia', // less reliable + 'a_week' => ':count kiumia', // less reliable + + 'day' => ':count mũthenya', // less reliable + 'd' => ':count mũthenya', // less reliable + 'a_day' => ':count mũthenya', // less reliable + + 'hour' => ':count thaa', // less reliable + 'h' => ':count thaa', // less reliable + 'a_hour' => ':count thaa', // less reliable + + 'minute' => ':count mundu', // less reliable + 'min' => ':count mundu', // less reliable + 'a_minute' => ':count mundu', // less reliable + + 'second' => ':count igego', // less reliable + 's' => ':count igego', // less reliable + 'a_second' => ':count igego', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/kk.php b/vendor/nesbot/carbon/src/Carbon/Lang/kk.php new file mode 100644 index 00000000..59fa9aff --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/kk.php @@ -0,0 +1,103 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - François B + * - Talat Uspanov + * - Нурлан Рахимжанов + * - Toleugazy Kali + */ +return [ + 'year' => ':count жыл', + 'a_year' => '{1}бір жыл|:count жыл', + 'y' => ':count ж.', + 'month' => ':count ай', + 'a_month' => '{1}бір ай|:count ай', + 'm' => ':count ай', + 'week' => ':count апта', + 'a_week' => '{1}бір апта', + 'w' => ':count ап.', + 'day' => ':count күн', + 'a_day' => '{1}бір күн|:count күн', + 'd' => ':count к.', + 'hour' => ':count сағат', + 'a_hour' => '{1}бір сағат|:count сағат', + 'h' => ':count са.', + 'minute' => ':count минут', + 'a_minute' => '{1}бір минут|:count минут', + 'min' => ':count м.', + 'second' => ':count секунд', + 'a_second' => '{1}бірнеше секунд|:count секунд', + 's' => ':count се.', + 'ago' => ':time бұрын', + 'from_now' => ':time ішінде', + 'after' => ':time кейін', + 'before' => ':time бұрын', + 'diff_now' => 'қазір', + 'diff_today' => 'Бүгін', + 'diff_today_regexp' => 'Бүгін(?:\\s+сағат)?', + 'diff_yesterday' => 'кеше', + 'diff_yesterday_regexp' => 'Кеше(?:\\s+сағат)?', + 'diff_tomorrow' => 'ертең', + 'diff_tomorrow_regexp' => 'Ертең(?:\\s+сағат)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Бүгін сағат] LT', + 'nextDay' => '[Ертең сағат] LT', + 'nextWeek' => 'dddd [сағат] LT', + 'lastDay' => '[Кеше сағат] LT', + 'lastWeek' => '[Өткен аптаның] dddd [сағат] LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + static $suffixes = [ + 0 => '-ші', + 1 => '-ші', + 2 => '-ші', + 3 => '-ші', + 4 => '-ші', + 5 => '-ші', + 6 => '-шы', + 7 => '-ші', + 8 => '-ші', + 9 => '-шы', + 10 => '-шы', + 20 => '-шы', + 30 => '-шы', + 40 => '-шы', + 50 => '-ші', + 60 => '-шы', + 70 => '-ші', + 80 => '-ші', + 90 => '-шы', + 100 => '-ші', + ]; + + return $number.($suffixes[$number] ?? $suffixes[$number % 10] ?? $suffixes[$number >= 100 ? 100 : -1] ?? ''); + }, + 'months' => ['қаңтар', 'ақпан', 'наурыз', 'сәуір', 'мамыр', 'маусым', 'шілде', 'тамыз', 'қыркүйек', 'қазан', 'қараша', 'желтоқсан'], + 'months_short' => ['қаң', 'ақп', 'нау', 'сәу', 'мам', 'мау', 'шіл', 'там', 'қыр', 'қаз', 'қар', 'жел'], + 'weekdays' => ['жексенбі', 'дүйсенбі', 'сейсенбі', 'сәрсенбі', 'бейсенбі', 'жұма', 'сенбі'], + 'weekdays_short' => ['жек', 'дүй', 'сей', 'сәр', 'бей', 'жұм', 'сен'], + 'weekdays_min' => ['жк', 'дй', 'сй', 'ср', 'бй', 'жм', 'сн'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' және '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/kk_KZ.php b/vendor/nesbot/carbon/src/Carbon/Lang/kk_KZ.php new file mode 100644 index 00000000..7dc5ebcc --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/kk_KZ.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/kk.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/kkj.php b/vendor/nesbot/carbon/src/Carbon/Lang/kkj.php new file mode 100644 index 00000000..6a1e77a8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/kkj.php @@ -0,0 +1,13 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/kl.php b/vendor/nesbot/carbon/src/Carbon/Lang/kl.php new file mode 100644 index 00000000..7329a075 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/kl.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/kl_GL.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/kl_GL.php b/vendor/nesbot/carbon/src/Carbon/Lang/kl_GL.php new file mode 100644 index 00000000..4fed720a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/kl_GL.php @@ -0,0 +1,64 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Danish Standards Association bug-glibc-locales@gnu.org + * - John Eyðstein Johannesen (mashema) + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D. MMMM YYYY', + 'LLL' => 'D. MMMM YYYY HH:mm', + 'LLLL' => 'dddd [d.] D. MMMM YYYY [kl.] HH:mm', + ], + 'months' => ['januaarip', 'februaarip', 'marsip', 'apriilip', 'maajip', 'juunip', 'juulip', 'aggustip', 'septembarip', 'oktobarip', 'novembarip', 'decembarip'], + 'months_short' => ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'], + 'weekdays' => ['sapaat', 'ataasinngorneq', 'marlunngorneq', 'pingasunngorneq', 'sisamanngorneq', 'tallimanngorneq', 'arfininngorneq'], + 'weekdays_short' => ['sap', 'ata', 'mar', 'pin', 'sis', 'tal', 'arf'], + 'weekdays_min' => ['sap', 'ata', 'mar', 'pin', 'sis', 'tal', 'arf'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + + 'year' => '{1}ukioq :count|{0}:count ukiut|]1,Inf[ukiut :count', + 'a_year' => '{1}ukioq|{0}:count ukiut|]1,Inf[ukiut :count', + 'y' => '{1}:countyr|{0}:countyrs|]1,Inf[:countyrs', + + 'month' => '{1}qaammat :count|{0}:count qaammatit|]1,Inf[qaammatit :count', + 'a_month' => '{1}qaammat|{0}:count qaammatit|]1,Inf[qaammatit :count', + 'm' => '{1}:countmo|{0}:countmos|]1,Inf[:countmos', + + 'week' => '{1}:count sap. ak.|{0}:count sap. ak.|]1,Inf[:count sap. ak.', + 'a_week' => '{1}a sap. ak.|{0}:count sap. ak.|]1,Inf[:count sap. ak.', + 'w' => ':countw', + + 'day' => '{1}:count ulloq|{0}:count ullut|]1,Inf[:count ullut', + 'a_day' => '{1}a ulloq|{0}:count ullut|]1,Inf[:count ullut', + 'd' => ':countd', + + 'hour' => '{1}:count tiimi|{0}:count tiimit|]1,Inf[:count tiimit', + 'a_hour' => '{1}tiimi|{0}:count tiimit|]1,Inf[:count tiimit', + 'h' => ':counth', + + 'minute' => '{1}:count minutsi|{0}:count minutsit|]1,Inf[:count minutsit', + 'a_minute' => '{1}a minutsi|{0}:count minutsit|]1,Inf[:count minutsit', + 'min' => ':countm', + + 'second' => '{1}:count sikunti|{0}:count sikuntit|]1,Inf[:count sikuntit', + 'a_second' => '{1}sikunti|{0}:count sikuntit|]1,Inf[:count sikuntit', + 's' => ':counts', + + 'ago' => ':time matuma siorna', + +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/kln.php b/vendor/nesbot/carbon/src/Carbon/Lang/kln.php new file mode 100644 index 00000000..b9c39968 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/kln.php @@ -0,0 +1,31 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['krn', 'koosk'], + 'weekdays' => ['Kotisap', 'Kotaai', 'Koaeng’', 'Kosomok', 'Koang’wan', 'Komuut', 'Kolo'], + 'weekdays_short' => ['Kts', 'Kot', 'Koo', 'Kos', 'Koa', 'Kom', 'Kol'], + 'weekdays_min' => ['Kts', 'Kot', 'Koo', 'Kos', 'Koa', 'Kom', 'Kol'], + 'months' => ['Mulgul', 'Ng’atyaato', 'Kiptaamo', 'Iwootkuut', 'Mamuut', 'Paagi', 'Ng’eiyeet', 'Rooptui', 'Bureet', 'Epeeso', 'Kipsuunde ne taai', 'Kipsuunde nebo aeng’'], + 'months_short' => ['Mul', 'Ngat', 'Taa', 'Iwo', 'Mam', 'Paa', 'Nge', 'Roo', 'Bur', 'Epe', 'Kpt', 'Kpa'], + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + + 'year' => ':count maghatiat', // less reliable + 'y' => ':count maghatiat', // less reliable + 'a_year' => ':count maghatiat', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/km.php b/vendor/nesbot/carbon/src/Carbon/Lang/km.php new file mode 100644 index 00000000..da790ac8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/km.php @@ -0,0 +1,71 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Kruy Vanna + * - Sereysethy Touch + * - JD Isaacks + * - Sovichet Tep + */ +return [ + 'year' => '{1}មួយឆ្នាំ|]1,Inf[:count ឆ្នាំ', + 'y' => ':count ឆ្នាំ', + 'month' => '{1}មួយខែ|]1,Inf[:count ខែ', + 'm' => ':count ខែ', + 'week' => ':count សប្ដាហ៍', + 'w' => ':count សប្ដាហ៍', + 'day' => '{1}មួយថ្ងៃ|]1,Inf[:count ថ្ងៃ', + 'd' => ':count ថ្ងៃ', + 'hour' => '{1}មួយម៉ោង|]1,Inf[:count ម៉ោង', + 'h' => ':count ម៉ោង', + 'minute' => '{1}មួយនាទី|]1,Inf[:count នាទី', + 'min' => ':count នាទី', + 'second' => '{1}ប៉ុន្មានវិនាទី|]1,Inf[:count វិនាទី', + 's' => ':count វិនាទី', + 'ago' => ':timeមុន', + 'from_now' => ':timeទៀត', + 'after' => 'នៅ​ក្រោយ :time', + 'before' => 'នៅ​មុន :time', + 'diff_now' => 'ឥឡូវ', + 'diff_today' => 'ថ្ងៃនេះ', + 'diff_today_regexp' => 'ថ្ងៃនេះ(?:\\s+ម៉ោង)?', + 'diff_yesterday' => 'ម្សិលមិញ', + 'diff_yesterday_regexp' => 'ម្សិលមិញ(?:\\s+ម៉ោង)?', + 'diff_tomorrow' => 'ថ្ងៃ​ស្អែក', + 'diff_tomorrow_regexp' => 'ស្អែក(?:\\s+ម៉ោង)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[ថ្ងៃនេះ ម៉ោង] LT', + 'nextDay' => '[ស្អែក ម៉ោង] LT', + 'nextWeek' => 'dddd [ម៉ោង] LT', + 'lastDay' => '[ម្សិលមិញ ម៉ោង] LT', + 'lastWeek' => 'dddd [សប្តាហ៍មុន] [ម៉ោង] LT', + 'sameElse' => 'L', + ], + 'ordinal' => 'ទី:number', + 'meridiem' => ['ព្រឹក', 'ល្ងាច'], + 'months' => ['មករា', 'កុម្ភៈ', 'មីនា', 'មេសា', 'ឧសភា', 'មិថុនា', 'កក្កដា', 'សីហា', 'កញ្ញា', 'តុលា', 'វិច្ឆិកា', 'ធ្នូ'], + 'months_short' => ['មករា', 'កុម្ភៈ', 'មីនា', 'មេសា', 'ឧសភា', 'មិថុនា', 'កក្កដា', 'សីហា', 'កញ្ញា', 'តុលា', 'វិច្ឆិកា', 'ធ្នូ'], + 'weekdays' => ['អាទិត្យ', 'ច័ន្ទ', 'អង្គារ', 'ពុធ', 'ព្រហស្បតិ៍', 'សុក្រ', 'សៅរ៍'], + 'weekdays_short' => ['អា', 'ច', 'អ', 'ព', 'ព្រ', 'សុ', 'ស'], + 'weekdays_min' => ['អា', 'ច', 'អ', 'ព', 'ព្រ', 'សុ', 'ស'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', 'និង '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/km_KH.php b/vendor/nesbot/carbon/src/Carbon/Lang/km_KH.php new file mode 100644 index 00000000..92e5fdbd --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/km_KH.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/km.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/kn.php b/vendor/nesbot/carbon/src/Carbon/Lang/kn.php new file mode 100644 index 00000000..0d2ad08b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/kn.php @@ -0,0 +1,75 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - MOHAN M U + * - François B + * - rajeevnaikte + */ +return [ + 'year' => '{1}ಒಂದು ವರ್ಷ|]1,Inf[:count ವರ್ಷ', + 'month' => '{1}ಒಂದು ತಿಂಗಳು|]1,Inf[:count ತಿಂಗಳು', + 'week' => '{1}ಒಂದು ವಾರ|]1,Inf[:count ವಾರಗಳು', + 'day' => '{1}ಒಂದು ದಿನ|]1,Inf[:count ದಿನ', + 'hour' => '{1}ಒಂದು ಗಂಟೆ|]1,Inf[:count ಗಂಟೆ', + 'minute' => '{1}ಒಂದು ನಿಮಿಷ|]1,Inf[:count ನಿಮಿಷ', + 'second' => '{1}ಕೆಲವು ಕ್ಷಣಗಳು|]1,Inf[:count ಸೆಕೆಂಡುಗಳು', + 'ago' => ':time ಹಿಂದೆ', + 'from_now' => ':time ನಂತರ', + 'diff_now' => 'ಈಗ', + 'diff_today' => 'ಇಂದು', + 'diff_yesterday' => 'ನಿನ್ನೆ', + 'diff_tomorrow' => 'ನಾಳೆ', + 'formats' => [ + 'LT' => 'A h:mm', + 'LTS' => 'A h:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY, A h:mm', + 'LLLL' => 'dddd, D MMMM YYYY, A h:mm', + ], + 'calendar' => [ + 'sameDay' => '[ಇಂದು] LT', + 'nextDay' => '[ನಾಳೆ] LT', + 'nextWeek' => 'dddd, LT', + 'lastDay' => '[ನಿನ್ನೆ] LT', + 'lastWeek' => '[ಕೊನೆಯ] dddd, LT', + 'sameElse' => 'L', + ], + 'ordinal' => ':numberನೇ', + 'meridiem' => function ($hour) { + if ($hour < 4) { + return 'ರಾತ್ರಿ'; + } + if ($hour < 10) { + return 'ಬೆಳಿಗ್ಗೆ'; + } + if ($hour < 17) { + return 'ಮಧ್ಯಾಹ್ನ'; + } + if ($hour < 20) { + return 'ಸಂಜೆ'; + } + + return 'ರಾತ್ರಿ'; + }, + 'months' => ['ಜನವರಿ', 'ಫೆಬ್ರವರಿ', 'ಮಾರ್ಚ್', 'ಏಪ್ರಿಲ್', 'ಮೇ', 'ಜೂನ್', 'ಜುಲೈ', 'ಆಗಸ್ಟ್', 'ಸೆಪ್ಟೆಂಬರ್', 'ಅಕ್ಟೋಬರ್', 'ನವೆಂಬರ್', 'ಡಿಸೆಂಬರ್'], + 'months_short' => ['ಜನ', 'ಫೆಬ್ರ', 'ಮಾರ್ಚ್', 'ಏಪ್ರಿಲ್', 'ಮೇ', 'ಜೂನ್', 'ಜುಲೈ', 'ಆಗಸ್ಟ್', 'ಸೆಪ್ಟೆಂ', 'ಅಕ್ಟೋ', 'ನವೆಂ', 'ಡಿಸೆಂ'], + 'weekdays' => ['ಭಾನುವಾರ', 'ಸೋಮವಾರ', 'ಮಂಗಳವಾರ', 'ಬುಧವಾರ', 'ಗುರುವಾರ', 'ಶುಕ್ರವಾರ', 'ಶನಿವಾರ'], + 'weekdays_short' => ['ಭಾನು', 'ಸೋಮ', 'ಮಂಗಳ', 'ಬುಧ', 'ಗುರು', 'ಶುಕ್ರ', 'ಶನಿ'], + 'weekdays_min' => ['ಭಾ', 'ಸೋ', 'ಮಂ', 'ಬು', 'ಗು', 'ಶು', 'ಶ'], + 'list' => ', ', + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, + 'weekend' => [0, 0], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/kn_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/kn_IN.php new file mode 100644 index 00000000..30e3d886 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/kn_IN.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/kn.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ko.php b/vendor/nesbot/carbon/src/Carbon/Lang/ko.php new file mode 100644 index 00000000..4fa62376 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ko.php @@ -0,0 +1,91 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Kunal Marwaha + * - FourwingsY + * - François B + * - Jason Katz-Brown + * - Seokjun Kim + * - Junho Kim + * - JD Isaacks + * - Juwon Kim + */ +return [ + 'year' => ':count년', + 'a_year' => '{1}일년|]1,Inf[:count년', + 'y' => ':count년', + 'month' => ':count개월', + 'a_month' => '{1}한달|]1,Inf[:count개월', + 'm' => ':count개월', + 'week' => ':count주', + 'a_week' => '{1}일주일|]1,Inf[:count 주', + 'w' => ':count주일', + 'day' => ':count일', + 'a_day' => '{1}하루|]1,Inf[:count일', + 'd' => ':count일', + 'hour' => ':count시간', + 'a_hour' => '{1}한시간|]1,Inf[:count시간', + 'h' => ':count시간', + 'minute' => ':count분', + 'a_minute' => '{1}일분|]1,Inf[:count분', + 'min' => ':count분', + 'second' => ':count초', + 'a_second' => '{1}몇초|]1,Inf[:count초', + 's' => ':count초', + 'ago' => ':time 전', + 'from_now' => ':time 후', + 'after' => ':time 후', + 'before' => ':time 전', + 'diff_now' => '지금', + 'diff_today' => '오늘', + 'diff_yesterday' => '어제', + 'diff_tomorrow' => '내일', + 'formats' => [ + 'LT' => 'A h:mm', + 'LTS' => 'A h:mm:ss', + 'L' => 'YYYY.MM.DD.', + 'LL' => 'YYYY년 MMMM D일', + 'LLL' => 'YYYY년 MMMM D일 A h:mm', + 'LLLL' => 'YYYY년 MMMM D일 dddd A h:mm', + ], + 'calendar' => [ + 'sameDay' => '오늘 LT', + 'nextDay' => '내일 LT', + 'nextWeek' => 'dddd LT', + 'lastDay' => '어제 LT', + 'lastWeek' => '지난주 dddd LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number, $period) { + switch ($period) { + case 'd': + case 'D': + case 'DDD': + return $number.'일'; + case 'M': + return $number.'월'; + case 'w': + case 'W': + return $number.'주'; + default: + return $number; + } + }, + 'meridiem' => ['오전', '오후'], + 'months' => ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'], + 'months_short' => ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'], + 'weekdays' => ['일요일', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일'], + 'weekdays_short' => ['일', '월', '화', '수', '목', '금', '토'], + 'weekdays_min' => ['일', '월', '화', '수', '목', '금', '토'], + 'list' => ' ', +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ko_KP.php b/vendor/nesbot/carbon/src/Carbon/Lang/ko_KP.php new file mode 100644 index 00000000..4ba802b3 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ko_KP.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ko.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ko_KR.php b/vendor/nesbot/carbon/src/Carbon/Lang/ko_KR.php new file mode 100644 index 00000000..9d873a27 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ko_KR.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/ko.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/kok.php b/vendor/nesbot/carbon/src/Carbon/Lang/kok.php new file mode 100644 index 00000000..4adcddcc --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/kok.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/kok_IN.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/kok_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/kok_IN.php new file mode 100644 index 00000000..92ba844c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/kok_IN.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Red Hat, Pune bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'D-M-YY', + ], + 'months' => ['जानेवारी', 'फेब्रुवारी', 'मार्च', 'एप्रिल', 'मे', 'जून', 'जुलै', 'ओगस्ट', 'सेप्टेंबर', 'ओक्टोबर', 'नोव्हेंबर', 'डिसेंबर'], + 'months_short' => ['जानेवारी', 'फेब्रुवारी', 'मार्च', 'एप्रिल', 'मे', 'जून', 'जुलै', 'ओगस्ट', 'सेप्टेंबर', 'ओक्टोबर', 'नोव्हेंबर', 'डिसेंबर'], + 'weekdays' => ['आयतार', 'सोमार', 'मंगळवार', 'बुधवार', 'बेरेसतार', 'शुकरार', 'शेनवार'], + 'weekdays_short' => ['आयतार', 'सोमार', 'मंगळवार', 'बुधवार', 'बेरेसतार', 'शुकरार', 'शेनवार'], + 'weekdays_min' => ['आयतार', 'सोमार', 'मंगळवार', 'बुधवार', 'बेरेसतार', 'शुकरार', 'शेनवार'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['म.पू.', 'म.नं.'], + + 'year' => ':count वैशाकु', // less reliable + 'y' => ':count वैशाकु', // less reliable + 'a_year' => ':count वैशाकु', // less reliable + + 'week' => ':count आदित्यवार', // less reliable + 'w' => ':count आदित्यवार', // less reliable + 'a_week' => ':count आदित्यवार', // less reliable + + 'minute' => ':count नोंद', // less reliable + 'min' => ':count नोंद', // less reliable + 'a_minute' => ':count नोंद', // less reliable + + 'second' => ':count तेंको', // less reliable + 's' => ':count तेंको', // less reliable + 'a_second' => ':count तेंको', // less reliable + + 'month' => ':count मैनो', + 'm' => ':count मैनो', + 'a_month' => ':count मैनो', + + 'day' => ':count दिवसु', + 'd' => ':count दिवसु', + 'a_day' => ':count दिवसु', + + 'hour' => ':count घंते', + 'h' => ':count घंते', + 'a_hour' => ':count घंते', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ks.php b/vendor/nesbot/carbon/src/Carbon/Lang/ks.php new file mode 100644 index 00000000..98760790 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ks.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/ks_IN.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ks_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/ks_IN.php new file mode 100644 index 00000000..ce9d5d4a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ks_IN.php @@ -0,0 +1,51 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Red Hat, Pune bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'M/D/YY', + ], + 'months' => ['جنؤری', 'فرؤری', 'مارٕچ', 'اپریل', 'میٔ', 'جوٗن', 'جوٗلایی', 'اگست', 'ستمبر', 'اکتوٗبر', 'نومبر', 'دسمبر'], + 'months_short' => ['جنؤری', 'فرؤری', 'مارٕچ', 'اپریل', 'میٔ', 'جوٗن', 'جوٗلایی', 'اگست', 'ستمبر', 'اکتوٗبر', 'نومبر', 'دسمبر'], + 'weekdays' => ['آتهوار', 'ژءندروار', 'بوءںوار', 'بودهوار', 'برىسوار', 'جمع', 'بٹوار'], + 'weekdays_short' => ['آتهوار', 'ژءنتروار', 'بوءںوار', 'بودهوار', 'برىسوار', 'جمع', 'بٹوار'], + 'weekdays_min' => ['آتهوار', 'ژءنتروار', 'بوءںوار', 'بودهوار', 'برىسوار', 'جمع', 'بٹوار'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['دوپھربرونھ', 'دوپھرپتھ'], + + 'year' => ':count آب', // less reliable + 'y' => ':count آب', // less reliable + 'a_year' => ':count آب', // less reliable + + 'month' => ':count रान्', // less reliable + 'm' => ':count रान्', // less reliable + 'a_month' => ':count रान्', // less reliable + + 'week' => ':count آتھٕوار', // less reliable + 'w' => ':count آتھٕوار', // less reliable + 'a_week' => ':count آتھٕوار', // less reliable + + 'hour' => ':count سۄن', // less reliable + 'h' => ':count سۄن', // less reliable + 'a_hour' => ':count سۄن', // less reliable + + 'minute' => ':count فَن', // less reliable + 'min' => ':count فَن', // less reliable + 'a_minute' => ':count فَن', // less reliable + + 'second' => ':count दोʼयुम', // less reliable + 's' => ':count दोʼयुम', // less reliable + 'a_second' => ':count दोʼयुम', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ks_IN@devanagari.php b/vendor/nesbot/carbon/src/Carbon/Lang/ks_IN@devanagari.php new file mode 100644 index 00000000..a2ae8b64 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ks_IN@devanagari.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - ks-gnome-trans-commits@lists.code.indlinux.net + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'M/D/YY', + ], + 'months' => ['जनवरी', 'फ़रवरी', 'मार्च', 'अप्रेल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितम्बर', 'अक्टूबर', 'नवम्बर', 'दिसम्बर'], + 'months_short' => ['जनवरी', 'फ़रवरी', 'मार्च', 'अप्रेल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितम्बर', 'अक्टूबर', 'नवम्बर', 'दिसम्बर'], + 'weekdays' => ['आथवार', 'चॅ़दुरवार', 'बोमवार', 'ब्वदवार', 'ब्रसवार', 'शोकुरवार', 'बटुवार'], + 'weekdays_short' => ['आथ ', 'चॅ़दुर', 'बोम', 'ब्वद', 'ब्रस', 'शोकुर', 'बटु'], + 'weekdays_min' => ['आथ ', 'चॅ़दुर', 'बोम', 'ब्वद', 'ब्रस', 'शोकुर', 'बटु'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['पूर्वाह्न', 'अपराह्न'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ksb.php b/vendor/nesbot/carbon/src/Carbon/Lang/ksb.php new file mode 100644 index 00000000..aaa00614 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ksb.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['makeo', 'nyiaghuo'], + 'weekdays' => ['Jumaapii', 'Jumaatatu', 'Jumaane', 'Jumaatano', 'Alhamisi', 'Ijumaa', 'Jumaamosi'], + 'weekdays_short' => ['Jpi', 'Jtt', 'Jmn', 'Jtn', 'Alh', 'Iju', 'Jmo'], + 'weekdays_min' => ['Jpi', 'Jtt', 'Jmn', 'Jtn', 'Alh', 'Iju', 'Jmo'], + 'months' => ['Januali', 'Febluali', 'Machi', 'Aplili', 'Mei', 'Juni', 'Julai', 'Agosti', 'Septemba', 'Oktoba', 'Novemba', 'Desemba'], + 'months_short' => ['Jan', 'Feb', 'Mac', 'Apr', 'Mei', 'Jun', 'Jul', 'Ago', 'Sep', 'Okt', 'Nov', 'Des'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ksf.php b/vendor/nesbot/carbon/src/Carbon/Lang/ksf.php new file mode 100644 index 00000000..84a59672 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ksf.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['sárúwá', 'cɛɛ́nko'], + 'weekdays' => ['sɔ́ndǝ', 'lǝndí', 'maadí', 'mɛkrɛdí', 'jǝǝdí', 'júmbá', 'samdí'], + 'weekdays_short' => ['sɔ́n', 'lǝn', 'maa', 'mɛk', 'jǝǝ', 'júm', 'sam'], + 'weekdays_min' => ['sɔ́n', 'lǝn', 'maa', 'mɛk', 'jǝǝ', 'júm', 'sam'], + 'months' => ['ŋwíí a ntɔ́ntɔ', 'ŋwíí akǝ bɛ́ɛ', 'ŋwíí akǝ ráá', 'ŋwíí akǝ nin', 'ŋwíí akǝ táan', 'ŋwíí akǝ táafɔk', 'ŋwíí akǝ táabɛɛ', 'ŋwíí akǝ táaraa', 'ŋwíí akǝ táanin', 'ŋwíí akǝ ntɛk', 'ŋwíí akǝ ntɛk di bɔ́k', 'ŋwíí akǝ ntɛk di bɛ́ɛ'], + 'months_short' => ['ŋ1', 'ŋ2', 'ŋ3', 'ŋ4', 'ŋ5', 'ŋ6', 'ŋ7', 'ŋ8', 'ŋ9', 'ŋ10', 'ŋ11', 'ŋ12'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ksh.php b/vendor/nesbot/carbon/src/Carbon/Lang/ksh.php new file mode 100644 index 00000000..95457e24 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ksh.php @@ -0,0 +1,57 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['v.M.', 'n.M.'], + 'weekdays' => ['Sunndaach', 'Mohndaach', 'Dinnsdaach', 'Metwoch', 'Dunnersdaach', 'Friidaach', 'Samsdaach'], + 'weekdays_short' => ['Su.', 'Mo.', 'Di.', 'Me.', 'Du.', 'Fr.', 'Sa.'], + 'weekdays_min' => ['Su', 'Mo', 'Di', 'Me', 'Du', 'Fr', 'Sa'], + 'months' => ['Jannewa', 'Fäbrowa', 'Määz', 'Aprell', 'Mai', 'Juuni', 'Juuli', 'Oujoß', 'Septämber', 'Oktohber', 'Novämber', 'Dezämber'], + 'months_short' => ['Jan', 'Fäb', 'Mäz', 'Apr', 'Mai', 'Jun', 'Jul', 'Ouj', 'Säp', 'Okt', 'Nov', 'Dez'], + 'months_short_standalone' => ['Jan.', 'Fäb.', 'Mäz.', 'Apr.', 'Mai', 'Jun.', 'Jul.', 'Ouj.', 'Säp.', 'Okt.', 'Nov.', 'Dez.'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D. M. YYYY', + 'LL' => 'D. MMM. YYYY', + 'LLL' => 'D. MMMM YYYY HH:mm', + 'LLLL' => 'dddd, [dä] D. MMMM YYYY HH:mm', + ], + + 'year' => ':count Johr', + 'y' => ':count Johr', + 'a_year' => ':count Johr', + + 'month' => ':count Moohnd', + 'm' => ':count Moohnd', + 'a_month' => ':count Moohnd', + + 'week' => ':count woch', + 'w' => ':count woch', + 'a_week' => ':count woch', + + 'day' => ':count Daach', + 'd' => ':count Daach', + 'a_day' => ':count Daach', + + 'hour' => ':count Uhr', + 'h' => ':count Uhr', + 'a_hour' => ':count Uhr', + + 'minute' => ':count Menutt', + 'min' => ':count Menutt', + 'a_minute' => ':count Menutt', + + 'second' => ':count Sekůndt', + 's' => ':count Sekůndt', + 'a_second' => ':count Sekůndt', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ku.php b/vendor/nesbot/carbon/src/Carbon/Lang/ku.php new file mode 100644 index 00000000..189960c8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ku.php @@ -0,0 +1,40 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Unicode, Inc. + */ + +return [ + 'ago' => 'berî :time', + 'from_now' => 'di :time de', + 'after' => ':time piştî', + 'before' => ':time berê', + 'year' => ':count sal', + 'year_ago' => ':count salê|:count salan', + 'year_from_now' => 'salekê|:count salan', + 'month' => ':count meh', + 'week' => ':count hefte', + 'day' => ':count roj', + 'hour' => ':count saet', + 'minute' => ':count deqîqe', + 'second' => ':count saniye', + 'months' => ['rêbendanê', 'reşemiyê', 'adarê', 'avrêlê', 'gulanê', 'pûşperê', 'tîrmehê', 'gelawêjê', 'rezberê', 'kewçêrê', 'sermawezê', 'berfanbarê'], + 'months_standalone' => ['rêbendan', 'reşemî', 'adar', 'avrêl', 'gulan', 'pûşper', 'tîrmeh', 'gelawêj', 'rezber', 'kewçêr', 'sermawez', 'berfanbar'], + 'months_short' => ['rêb', 'reş', 'ada', 'avr', 'gul', 'pûş', 'tîr', 'gel', 'rez', 'kew', 'ser', 'ber'], + 'weekdays' => ['yekşem', 'duşem', 'sêşem', 'çarşem', 'pêncşem', 'în', 'şemî'], + 'weekdays_short' => ['yş', 'dş', 'sş', 'çş', 'pş', 'în', 'ş'], + 'weekdays_min' => ['Y', 'D', 'S', 'Ç', 'P', 'Î', 'Ş'], + 'list' => [', ', ' û '], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ku_TR.php b/vendor/nesbot/carbon/src/Carbon/Lang/ku_TR.php new file mode 100644 index 00000000..4243a82f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ku_TR.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/ku.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/kw.php b/vendor/nesbot/carbon/src/Carbon/Lang/kw.php new file mode 100644 index 00000000..26e242e7 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/kw.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/kw_GB.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/kw_GB.php b/vendor/nesbot/carbon/src/Carbon/Lang/kw_GB.php new file mode 100644 index 00000000..00bf52bd --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/kw_GB.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Alastair McKinstry bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YY', + ], + 'months' => ['mis Genver', 'mis Hwevrer', 'mis Meurth', 'mis Ebrel', 'mis Me', 'mis Metheven', 'mis Gortheren', 'mis Est', 'mis Gwynngala', 'mis Hedra', 'mis Du', 'mis Kevardhu'], + 'months_short' => ['Gen', 'Hwe', 'Meu', 'Ebr', 'Me', 'Met', 'Gor', 'Est', 'Gwn', 'Hed', 'Du', 'Kev'], + 'weekdays' => ['De Sul', 'De Lun', 'De Merth', 'De Merher', 'De Yow', 'De Gwener', 'De Sadorn'], + 'weekdays_short' => ['Sul', 'Lun', 'Mth', 'Mhr', 'Yow', 'Gwe', 'Sad'], + 'weekdays_min' => ['Sul', 'Lun', 'Mth', 'Mhr', 'Yow', 'Gwe', 'Sad'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + + 'year' => ':count bledhen', + 'y' => ':count bledhen', + 'a_year' => ':count bledhen', + + 'month' => ':count mis', + 'm' => ':count mis', + 'a_month' => ':count mis', + + 'week' => ':count seythen', + 'w' => ':count seythen', + 'a_week' => ':count seythen', + + 'day' => ':count dydh', + 'd' => ':count dydh', + 'a_day' => ':count dydh', + + 'hour' => ':count eur', + 'h' => ':count eur', + 'a_hour' => ':count eur', + + 'minute' => ':count mynysen', + 'min' => ':count mynysen', + 'a_minute' => ':count mynysen', + + 'second' => ':count pryjwyth', + 's' => ':count pryjwyth', + 'a_second' => ':count pryjwyth', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ky.php b/vendor/nesbot/carbon/src/Carbon/Lang/ky.php new file mode 100644 index 00000000..e0d1af10 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ky.php @@ -0,0 +1,106 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - acutexyz + * - Josh Soref + * - François B + * - Chyngyz Arystan uulu + * - Chyngyz + * - acutexyz + * - Josh Soref + * - François B + * - Chyngyz Arystan uulu + */ +return [ + 'year' => ':count жыл', + 'a_year' => '{1}бир жыл|:count жыл', + 'y' => ':count жыл', + 'month' => ':count ай', + 'a_month' => '{1}бир ай|:count ай', + 'm' => ':count ай', + 'week' => ':count апта', + 'a_week' => '{1}бир апта|:count апта', + 'w' => ':count апт.', + 'day' => ':count күн', + 'a_day' => '{1}бир күн|:count күн', + 'd' => ':count күн', + 'hour' => ':count саат', + 'a_hour' => '{1}бир саат|:count саат', + 'h' => ':count саат.', + 'minute' => ':count мүнөт', + 'a_minute' => '{1}бир мүнөт|:count мүнөт', + 'min' => ':count мүн.', + 'second' => ':count секунд', + 'a_second' => '{1}бирнече секунд|:count секунд', + 's' => ':count сек.', + 'ago' => ':time мурун', + 'from_now' => ':time ичинде', + 'diff_now' => 'азыр', + 'diff_today' => 'Бүгүн', + 'diff_today_regexp' => 'Бүгүн(?:\\s+саат)?', + 'diff_yesterday' => 'кечээ', + 'diff_yesterday_regexp' => 'Кече(?:\\s+саат)?', + 'diff_tomorrow' => 'эртең', + 'diff_tomorrow_regexp' => 'Эртең(?:\\s+саат)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Бүгүн саат] LT', + 'nextDay' => '[Эртең саат] LT', + 'nextWeek' => 'dddd [саат] LT', + 'lastDay' => '[Кече саат] LT', + 'lastWeek' => '[Өткен аптанын] dddd [күнү] [саат] LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + static $suffixes = [ + 0 => '-чү', + 1 => '-чи', + 2 => '-чи', + 3 => '-чү', + 4 => '-чү', + 5 => '-чи', + 6 => '-чы', + 7 => '-чи', + 8 => '-чи', + 9 => '-чу', + 10 => '-чу', + 20 => '-чы', + 30 => '-чу', + 40 => '-чы', + 50 => '-чү', + 60 => '-чы', + 70 => '-чи', + 80 => '-чи', + 90 => '-чу', + 100 => '-чү', + ]; + + return $number.($suffixes[$number] ?? $suffixes[$number % 10] ?? $suffixes[$number >= 100 ? 100 : -1] ?? ''); + }, + 'months' => ['январь', 'февраль', 'март', 'апрель', 'май', 'июнь', 'июль', 'август', 'сентябрь', 'октябрь', 'ноябрь', 'декабрь'], + 'months_short' => ['янв', 'фев', 'март', 'апр', 'май', 'июнь', 'июль', 'авг', 'сен', 'окт', 'ноя', 'дек'], + 'weekdays' => ['Жекшемби', 'Дүйшөмбү', 'Шейшемби', 'Шаршемби', 'Бейшемби', 'Жума', 'Ишемби'], + 'weekdays_short' => ['Жек', 'Дүй', 'Шей', 'Шар', 'Бей', 'Жум', 'Ише'], + 'weekdays_min' => ['Жк', 'Дй', 'Шй', 'Шр', 'Бй', 'Жм', 'Иш'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => ' ', + 'meridiem' => ['таңкы', 'түштөн кийинки'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ky_KG.php b/vendor/nesbot/carbon/src/Carbon/Lang/ky_KG.php new file mode 100644 index 00000000..9923a31e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ky_KG.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/ky.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/lag.php b/vendor/nesbot/carbon/src/Carbon/Lang/lag.php new file mode 100644 index 00000000..f3f57f6a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/lag.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['TOO', 'MUU'], + 'weekdays' => ['Jumapíiri', 'Jumatátu', 'Jumaíne', 'Jumatáano', 'Alamíisi', 'Ijumáa', 'Jumamóosi'], + 'weekdays_short' => ['Píili', 'Táatu', 'Íne', 'Táano', 'Alh', 'Ijm', 'Móosi'], + 'weekdays_min' => ['Píili', 'Táatu', 'Íne', 'Táano', 'Alh', 'Ijm', 'Móosi'], + 'months' => ['Kʉfúngatɨ', 'Kʉnaanɨ', 'Kʉkeenda', 'Kwiikumi', 'Kwiinyambála', 'Kwiidwaata', 'Kʉmʉʉnchɨ', 'Kʉvɨɨrɨ', 'Kʉsaatʉ', 'Kwiinyi', 'Kʉsaano', 'Kʉsasatʉ'], + 'months_short' => ['Fúngatɨ', 'Naanɨ', 'Keenda', 'Ikúmi', 'Inyambala', 'Idwaata', 'Mʉʉnchɨ', 'Vɨɨrɨ', 'Saatʉ', 'Inyi', 'Saano', 'Sasatʉ'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/lb.php b/vendor/nesbot/carbon/src/Carbon/Lang/lb.php new file mode 100644 index 00000000..7636655e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/lb.php @@ -0,0 +1,88 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Philippe Vaucher + * - Tsutomu Kuroda + * - dan-nl + * - Simon Lelorrain (slelorrain) + */ + +use Carbon\CarbonInterface; + +return [ + 'year' => ':count Joer', + 'y' => ':countJ', + 'month' => ':count Mount|:count Méint', + 'm' => ':countMo', + 'week' => ':count Woch|:count Wochen', + 'w' => ':countWo|:countWo', + 'day' => ':count Dag|:count Deeg', + 'd' => ':countD', + 'hour' => ':count Stonn|:count Stonnen', + 'h' => ':countSto', + 'minute' => ':count Minutt|:count Minutten', + 'min' => ':countM', + 'second' => ':count Sekonn|:count Sekonnen', + 's' => ':countSek', + + 'ago' => 'virun :time', + 'from_now' => 'an :time', + 'before' => ':time virdrun', + 'after' => ':time duerno', + + 'diff_today' => 'Haut', + 'diff_yesterday' => 'Gëschter', + 'diff_yesterday_regexp' => 'Gëschter(?:\\s+um)?', + 'diff_tomorrow' => 'Muer', + 'diff_tomorrow_regexp' => 'Muer(?:\\s+um)?', + 'diff_today_regexp' => 'Haut(?:\\s+um)?', + 'formats' => [ + 'LT' => 'H:mm [Auer]', + 'LTS' => 'H:mm:ss [Auer]', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D. MMMM YYYY', + 'LLL' => 'D. MMMM YYYY H:mm [Auer]', + 'LLLL' => 'dddd, D. MMMM YYYY H:mm [Auer]', + ], + + 'calendar' => [ + 'sameDay' => '[Haut um] LT', + 'nextDay' => '[Muer um] LT', + 'nextWeek' => 'dddd [um] LT', + 'lastDay' => '[Gëschter um] LT', + 'lastWeek' => function (CarbonInterface $date) { + // Different date string for 'Dënschdeg' (Tuesday) and 'Donneschdeg' (Thursday) due to phonological rule + switch ($date->dayOfWeek) { + case 2: + case 4: + return '[Leschten] dddd [um] LT'; + default: + return '[Leschte] dddd [um] LT'; + } + }, + 'sameElse' => 'L', + ], + + 'months' => ['Januar', 'Februar', 'Mäerz', 'Abrëll', 'Mee', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], + 'months_short' => ['Jan.', 'Febr.', 'Mrz.', 'Abr.', 'Mee', 'Jun.', 'Jul.', 'Aug.', 'Sept.', 'Okt.', 'Nov.', 'Dez.'], + 'weekdays' => ['Sonndeg', 'Méindeg', 'Dënschdeg', 'Mëttwoch', 'Donneschdeg', 'Freideg', 'Samschdeg'], + 'weekdays_short' => ['So.', 'Mé.', 'Dë.', 'Më.', 'Do.', 'Fr.', 'Sa.'], + 'weekdays_min' => ['So', 'Mé', 'Dë', 'Më', 'Do', 'Fr', 'Sa'], + 'ordinal' => ':number.', + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' an '], + 'meridiem' => ['moies', 'mëttes'], + 'weekdays_short_standalone' => ['Son', 'Méi', 'Dën', 'Mët', 'Don', 'Fre', 'Sam'], + 'months_short_standalone' => ['Jan', 'Feb', 'Mäe', 'Abr', 'Mee', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/lb_LU.php b/vendor/nesbot/carbon/src/Carbon/Lang/lb_LU.php new file mode 100644 index 00000000..414bd4d0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/lb_LU.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/lb.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/lg.php b/vendor/nesbot/carbon/src/Carbon/Lang/lg.php new file mode 100644 index 00000000..48bc68be --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/lg.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/lg_UG.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/lg_UG.php b/vendor/nesbot/carbon/src/Carbon/Lang/lg_UG.php new file mode 100644 index 00000000..aa022140 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/lg_UG.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Akademe ya Luganda Kizito Birabwa kompyuta@kizito.uklinux.net + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YY', + ], + 'months' => ['Janwaliyo', 'Febwaliyo', 'Marisi', 'Apuli', 'Maayi', 'Juuni', 'Julaayi', 'Agusito', 'Sebuttemba', 'Okitobba', 'Novemba', 'Desemba'], + 'months_short' => ['Jan', 'Feb', 'Mar', 'Apu', 'Maa', 'Juu', 'Jul', 'Agu', 'Seb', 'Oki', 'Nov', 'Des'], + 'weekdays' => ['Sabiiti', 'Balaza', 'Lwakubiri', 'Lwakusatu', 'Lwakuna', 'Lwakutaano', 'Lwamukaaga'], + 'weekdays_short' => ['Sab', 'Bal', 'Lw2', 'Lw3', 'Lw4', 'Lw5', 'Lw6'], + 'weekdays_min' => ['Sab', 'Bal', 'Lw2', 'Lw3', 'Lw4', 'Lw5', 'Lw6'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + + 'month' => ':count njuba', // less reliable + 'm' => ':count njuba', // less reliable + 'a_month' => ':count njuba', // less reliable + + 'year' => ':count mwaaka', + 'y' => ':count mwaaka', + 'a_year' => ':count mwaaka', + + 'week' => ':count sabbiiti', + 'w' => ':count sabbiiti', + 'a_week' => ':count sabbiiti', + + 'day' => ':count lunaku', + 'd' => ':count lunaku', + 'a_day' => ':count lunaku', + + 'hour' => 'saawa :count', + 'h' => 'saawa :count', + 'a_hour' => 'saawa :count', + + 'minute' => 'ddakiika :count', + 'min' => 'ddakiika :count', + 'a_minute' => 'ddakiika :count', + + 'second' => ':count kyʼokubiri', + 's' => ':count kyʼokubiri', + 'a_second' => ':count kyʼokubiri', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/li.php b/vendor/nesbot/carbon/src/Carbon/Lang/li.php new file mode 100644 index 00000000..86c3009e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/li.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/li_NL.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/li_NL.php b/vendor/nesbot/carbon/src/Carbon/Lang/li_NL.php new file mode 100644 index 00000000..6c5feb79 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/li_NL.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - information from Kenneth Christiansen Kenneth Christiansen, Pablo Saratxaga kenneth@gnu.org, pablo@mandriva.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD.MM.YYYY', + ], + 'months' => ['jannewarie', 'fibberwarie', 'miert', 'eprèl', 'meij', 'junie', 'julie', 'augustus', 'september', 'oktober', 'november', 'desember'], + 'months_short' => ['jan', 'fib', 'mie', 'epr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'des'], + 'weekdays' => ['zóndig', 'maondig', 'daensdig', 'goonsdig', 'dónderdig', 'vriedig', 'zaoterdig'], + 'weekdays_short' => ['zón', 'mao', 'dae', 'goo', 'dón', 'vri', 'zao'], + 'weekdays_min' => ['zón', 'mao', 'dae', 'goo', 'dón', 'vri', 'zao'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + + 'minute' => ':count momênt', // less reliable + 'min' => ':count momênt', // less reliable + 'a_minute' => ':count momênt', // less reliable + + 'year' => ':count jaor', + 'y' => ':count jaor', + 'a_year' => ':count jaor', + + 'month' => ':count maond', + 'm' => ':count maond', + 'a_month' => ':count maond', + + 'week' => ':count waek', + 'w' => ':count waek', + 'a_week' => ':count waek', + + 'day' => ':count daag', + 'd' => ':count daag', + 'a_day' => ':count daag', + + 'hour' => ':count oer', + 'h' => ':count oer', + 'a_hour' => ':count oer', + + 'second' => ':count Secónd', + 's' => ':count Secónd', + 'a_second' => ':count Secónd', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/lij.php b/vendor/nesbot/carbon/src/Carbon/Lang/lij.php new file mode 100644 index 00000000..45732b55 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/lij.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/lij_IT.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/lij_IT.php b/vendor/nesbot/carbon/src/Carbon/Lang/lij_IT.php new file mode 100644 index 00000000..f8726fd2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/lij_IT.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Gastaldi alessio.gastaldi@libero.it + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['zenâ', 'fevrâ', 'marzo', 'avrî', 'mazzo', 'zûgno', 'lûggio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dixembre'], + 'months_short' => ['zen', 'fev', 'mar', 'arv', 'maz', 'zûg', 'lûg', 'ago', 'set', 'ött', 'nov', 'dix'], + 'weekdays' => ['domenega', 'lûnedì', 'martedì', 'mercUrdì', 'zêggia', 'venardì', 'sabbo'], + 'weekdays_short' => ['dom', 'lûn', 'mar', 'mer', 'zêu', 'ven', 'sab'], + 'weekdays_min' => ['dom', 'lûn', 'mar', 'mer', 'zêu', 'ven', 'sab'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + + 'year' => ':count etæ', // less reliable + 'y' => ':count etæ', // less reliable + 'a_year' => ':count etæ', // less reliable + + 'month' => ':count meize', + 'm' => ':count meize', + 'a_month' => ':count meize', + + 'week' => ':count settemannha', + 'w' => ':count settemannha', + 'a_week' => ':count settemannha', + + 'day' => ':count giorno', + 'd' => ':count giorno', + 'a_day' => ':count giorno', + + 'hour' => ':count reléuio', // less reliable + 'h' => ':count reléuio', // less reliable + 'a_hour' => ':count reléuio', // less reliable + + 'minute' => ':count menûo', + 'min' => ':count menûo', + 'a_minute' => ':count menûo', + + 'second' => ':count segondo', + 's' => ':count segondo', + 'a_second' => ':count segondo', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/lkt.php b/vendor/nesbot/carbon/src/Carbon/Lang/lkt.php new file mode 100644 index 00000000..ae73a97b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/lkt.php @@ -0,0 +1,41 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + + 'month' => ':count haŋwí', // less reliable + 'm' => ':count haŋwí', // less reliable + 'a_month' => ':count haŋwí', // less reliable + + 'week' => ':count šakówiŋ', // less reliable + 'w' => ':count šakówiŋ', // less reliable + 'a_week' => ':count šakówiŋ', // less reliable + + 'hour' => ':count maza škaŋškaŋ', // less reliable + 'h' => ':count maza škaŋškaŋ', // less reliable + 'a_hour' => ':count maza škaŋškaŋ', // less reliable + + 'minute' => ':count číkʼala', // less reliable + 'min' => ':count číkʼala', // less reliable + 'a_minute' => ':count číkʼala', // less reliable + + 'year' => ':count waníyetu', + 'y' => ':count waníyetu', + 'a_year' => ':count waníyetu', + + 'day' => ':count aŋpétu', + 'd' => ':count aŋpétu', + 'a_day' => ':count aŋpétu', + + 'second' => ':count icinuŋpa', + 's' => ':count icinuŋpa', + 'a_second' => ':count icinuŋpa', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ln.php b/vendor/nesbot/carbon/src/Carbon/Lang/ln.php new file mode 100644 index 00000000..9d5c35dd --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ln.php @@ -0,0 +1,60 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Ubuntu René Manassé GALEKWA renemanasse@gmail.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'months' => ['sánzá ya yambo', 'sánzá ya míbalé', 'sánzá ya mísáto', 'sánzá ya mínei', 'sánzá ya mítáno', 'sánzá ya motóbá', 'sánzá ya nsambo', 'sánzá ya mwambe', 'sánzá ya libwa', 'sánzá ya zómi', 'sánzá ya zómi na mɔ̌kɔ́', 'sánzá ya zómi na míbalé'], + 'months_short' => ['yan', 'fbl', 'msi', 'apl', 'mai', 'yun', 'yul', 'agt', 'stb', 'ɔtb', 'nvb', 'dsb'], + 'weekdays' => ['Lomíngo', 'Mosálá mɔ̌kɔ́', 'Misálá míbalé', 'Misálá mísáto', 'Misálá mínei', 'Misálá mítáno', 'Mpɔ́sɔ'], + 'weekdays_short' => ['m1.', 'm2.', 'm3.', 'm4.', 'm5.', 'm6.', 'm7.'], + 'weekdays_min' => ['m1.', 'm2.', 'm3.', 'm4.', 'm5.', 'm6.', 'm7.'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + + 'year' => 'mbula :count', + 'y' => 'mbula :count', + 'a_year' => 'mbula :count', + + 'month' => 'sánzá :count', + 'm' => 'sánzá :count', + 'a_month' => 'sánzá :count', + + 'week' => 'mpɔ́sɔ :count', + 'w' => 'mpɔ́sɔ :count', + 'a_week' => 'mpɔ́sɔ :count', + + 'day' => 'mokɔlɔ :count', + 'd' => 'mokɔlɔ :count', + 'a_day' => 'mokɔlɔ :count', + + 'hour' => 'ngonga :count', + 'h' => 'ngonga :count', + 'a_hour' => 'ngonga :count', + + 'minute' => 'miniti :count', + 'min' => 'miniti :count', + 'a_minute' => 'miniti :count', + + 'second' => 'segɔnde :count', + 's' => 'segɔnde :count', + 'a_second' => 'segɔnde :count', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ln_AO.php b/vendor/nesbot/carbon/src/Carbon/Lang/ln_AO.php new file mode 100644 index 00000000..7fdb7f1b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ln_AO.php @@ -0,0 +1,17 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ln.php', [ + 'weekdays' => ['eyenga', 'mokɔlɔ mwa yambo', 'mokɔlɔ mwa míbalé', 'mokɔlɔ mwa mísáto', 'mokɔlɔ ya mínéi', 'mokɔlɔ ya mítáno', 'mpɔ́sɔ'], + 'weekdays_short' => ['eye', 'ybo', 'mbl', 'mst', 'min', 'mtn', 'mps'], + 'weekdays_min' => ['eye', 'ybo', 'mbl', 'mst', 'min', 'mtn', 'mps'], + 'meridiem' => ['ntɔ́ngɔ́', 'mpókwa'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ln_CD.php b/vendor/nesbot/carbon/src/Carbon/Lang/ln_CD.php new file mode 100644 index 00000000..13635fcc --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ln_CD.php @@ -0,0 +1,16 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Ubuntu René Manassé GALEKWA renemanasse@gmail.com + */ +return require __DIR__.'/ln.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ln_CF.php b/vendor/nesbot/carbon/src/Carbon/Lang/ln_CF.php new file mode 100644 index 00000000..7fdb7f1b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ln_CF.php @@ -0,0 +1,17 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ln.php', [ + 'weekdays' => ['eyenga', 'mokɔlɔ mwa yambo', 'mokɔlɔ mwa míbalé', 'mokɔlɔ mwa mísáto', 'mokɔlɔ ya mínéi', 'mokɔlɔ ya mítáno', 'mpɔ́sɔ'], + 'weekdays_short' => ['eye', 'ybo', 'mbl', 'mst', 'min', 'mtn', 'mps'], + 'weekdays_min' => ['eye', 'ybo', 'mbl', 'mst', 'min', 'mtn', 'mps'], + 'meridiem' => ['ntɔ́ngɔ́', 'mpókwa'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ln_CG.php b/vendor/nesbot/carbon/src/Carbon/Lang/ln_CG.php new file mode 100644 index 00000000..7fdb7f1b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ln_CG.php @@ -0,0 +1,17 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ln.php', [ + 'weekdays' => ['eyenga', 'mokɔlɔ mwa yambo', 'mokɔlɔ mwa míbalé', 'mokɔlɔ mwa mísáto', 'mokɔlɔ ya mínéi', 'mokɔlɔ ya mítáno', 'mpɔ́sɔ'], + 'weekdays_short' => ['eye', 'ybo', 'mbl', 'mst', 'min', 'mtn', 'mps'], + 'weekdays_min' => ['eye', 'ybo', 'mbl', 'mst', 'min', 'mtn', 'mps'], + 'meridiem' => ['ntɔ́ngɔ́', 'mpókwa'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/lo.php b/vendor/nesbot/carbon/src/Carbon/Lang/lo.php new file mode 100644 index 00000000..48715f5c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/lo.php @@ -0,0 +1,62 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - François B + * - ryanhart2 + */ +return [ + 'year' => ':count ປີ', + 'y' => ':count ປີ', + 'month' => ':count ເດືອນ', + 'm' => ':count ດ. ', + 'week' => ':count ອາທິດ', + 'w' => ':count ອທ. ', + 'day' => ':count ມື້', + 'd' => ':count ມື້', + 'hour' => ':count ຊົ່ວໂມງ', + 'h' => ':count ຊມ. ', + 'minute' => ':count ນາທີ', + 'min' => ':count ນທ. ', + 'second' => '{1}ບໍ່ເທົ່າໃດວິນາທີ|]1,Inf[:count ວິນາທີ', + 's' => ':count ວິ. ', + 'ago' => ':timeຜ່ານມາ', + 'from_now' => 'ອີກ :time', + 'diff_now' => 'ຕອນນີ້', + 'diff_today' => 'ມື້ນີ້ເວລາ', + 'diff_yesterday' => 'ມື້ວານນີ້ເວລາ', + 'diff_tomorrow' => 'ມື້ອື່ນເວລາ', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'ວັນdddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[ມື້ນີ້ເວລາ] LT', + 'nextDay' => '[ມື້ອື່ນເວລາ] LT', + 'nextWeek' => '[ວັນ]dddd[ໜ້າເວລາ] LT', + 'lastDay' => '[ມື້ວານນີ້ເວລາ] LT', + 'lastWeek' => '[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT', + 'sameElse' => 'L', + ], + 'ordinal' => 'ທີ່:number', + 'meridiem' => ['ຕອນເຊົ້າ', 'ຕອນແລງ'], + 'months' => ['ມັງກອນ', 'ກຸມພາ', 'ມີນາ', 'ເມສາ', 'ພຶດສະພາ', 'ມິຖຸນາ', 'ກໍລະກົດ', 'ສິງຫາ', 'ກັນຍາ', 'ຕຸລາ', 'ພະຈິກ', 'ທັນວາ'], + 'months_short' => ['ມັງກອນ', 'ກຸມພາ', 'ມີນາ', 'ເມສາ', 'ພຶດສະພາ', 'ມິຖຸນາ', 'ກໍລະກົດ', 'ສິງຫາ', 'ກັນຍາ', 'ຕຸລາ', 'ພະຈິກ', 'ທັນວາ'], + 'weekdays' => ['ອາທິດ', 'ຈັນ', 'ອັງຄານ', 'ພຸດ', 'ພະຫັດ', 'ສຸກ', 'ເສົາ'], + 'weekdays_short' => ['ທິດ', 'ຈັນ', 'ອັງຄານ', 'ພຸດ', 'ພະຫັດ', 'ສຸກ', 'ເສົາ'], + 'weekdays_min' => ['ທ', 'ຈ', 'ອຄ', 'ພ', 'ພຫ', 'ສກ', 'ສ'], + 'list' => [', ', 'ແລະ '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/lo_LA.php b/vendor/nesbot/carbon/src/Carbon/Lang/lo_LA.php new file mode 100644 index 00000000..9b7fd9bf --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/lo_LA.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/lo.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/lrc.php b/vendor/nesbot/carbon/src/Carbon/Lang/lrc.php new file mode 100644 index 00000000..546e6791 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/lrc.php @@ -0,0 +1,17 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + + 'minute' => ':count هنر', // less reliable + 'min' => ':count هنر', // less reliable + 'a_minute' => ':count هنر', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/lrc_IQ.php b/vendor/nesbot/carbon/src/Carbon/Lang/lrc_IQ.php new file mode 100644 index 00000000..d42f5e97 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/lrc_IQ.php @@ -0,0 +1,13 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/lrc.php', [ +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/lt.php b/vendor/nesbot/carbon/src/Carbon/Lang/lt.php new file mode 100644 index 00000000..7d1b6f74 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/lt.php @@ -0,0 +1,135 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Philippe Vaucher + * - Tsutomu Kuroda + * - tjku + * - valdas406 + * - Justas Palumickas + * - Max Melentiev + * - Andrius Janauskas + * - Juanito Fatas + * - Akira Matsuda + * - Christopher Dell + * - Enrique Vidal + * - Simone Carletti + * - Aaron Patterson + * - Nicolás Hock Isaza + * - Laurynas Butkus + * - Sven Fuchs + * - Dominykas Tijūnaitis + * - Justinas Bolys + * - Ričardas + * - Kirill Chalkin + * - Rolandas + * - Justinas (Gamesh) + */ +return [ + 'year' => ':count metai|:count metai|:count metų', + 'y' => ':count m.', + 'month' => ':count mėnuo|:count mėnesiai|:count mėnesį', + 'm' => ':count mėn.', + 'week' => ':count savaitė|:count savaitės|:count savaitę', + 'w' => ':count sav.', + 'day' => ':count diena|:count dienos|:count dienų', + 'd' => ':count d.', + 'hour' => ':count valanda|:count valandos|:count valandų', + 'h' => ':count val.', + 'minute' => ':count minutė|:count minutės|:count minutę', + 'min' => ':count min.', + 'second' => ':count sekundė|:count sekundės|:count sekundžių', + 's' => ':count sek.', + + 'year_ago' => ':count metus|:count metus|:count metų', + 'month_ago' => ':count mėnesį|:count mėnesius|:count mėnesių', + 'week_ago' => ':count savaitę|:count savaites|:count savaičių', + 'day_ago' => ':count dieną|:count dienas|:count dienų', + 'hour_ago' => ':count valandą|:count valandas|:count valandų', + 'minute_ago' => ':count minutę|:count minutes|:count minučių', + 'second_ago' => ':count sekundę|:count sekundes|:count sekundžių', + + 'year_from_now' => ':count metų', + 'month_from_now' => ':count mėnesio|:count mėnesių|:count mėnesių', + 'week_from_now' => ':count savaitės|:count savaičių|:count savaičių', + 'day_from_now' => ':count dienos|:count dienų|:count dienų', + 'hour_from_now' => ':count valandos|:count valandų|:count valandų', + 'minute_from_now' => ':count minutės|:count minučių|:count minučių', + 'second_from_now' => ':count sekundės|:count sekundžių|:count sekundžių', + + 'year_after' => ':count metų', + 'month_after' => ':count mėnesio|:count mėnesių|:count mėnesių', + 'week_after' => ':count savaitės|:count savaičių|:count savaičių', + 'day_after' => ':count dienos|:count dienų|:count dienų', + 'hour_after' => ':count valandos|:count valandų|:count valandų', + 'minute_after' => ':count minutės|:count minučių|:count minučių', + 'second_after' => ':count sekundės|:count sekundžių|:count sekundžių', + + 'ago' => 'prieš :time', + 'from_now' => ':time nuo dabar', + 'after' => 'po :time', + 'before' => 'už :time', + + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + + 'diff_now' => 'ką tik', + 'diff_today' => 'Šiandien', + 'diff_yesterday' => 'vakar', + 'diff_yesterday_regexp' => 'Vakar', + 'diff_tomorrow' => 'rytoj', + 'diff_tomorrow_regexp' => 'Rytoj', + 'diff_before_yesterday' => 'užvakar', + 'diff_after_tomorrow' => 'poryt', + + 'period_recurrences' => 'kartą|:count kartų', + 'period_interval' => 'kiekvieną :interval', + 'period_start_date' => 'nuo :date', + 'period_end_date' => 'iki :date', + + 'months' => ['sausio', 'vasario', 'kovo', 'balandžio', 'gegužės', 'birželio', 'liepos', 'rugpjūčio', 'rugsėjo', 'spalio', 'lapkričio', 'gruodžio'], + 'months_standalone' => ['sausis', 'vasaris', 'kovas', 'balandis', 'gegužė', 'birželis', 'liepa', 'rugpjūtis', 'rugsėjis', 'spalis', 'lapkritis', 'gruodis'], + 'months_regexp' => '/(L{2,4}|D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|MMMM?(\[[^\[\]]*\]|\s)+D[oD]?)/', + 'months_short' => ['sau', 'vas', 'kov', 'bal', 'geg', 'bir', 'lie', 'rgp', 'rgs', 'spa', 'lap', 'gru'], + 'weekdays' => ['sekmadienį', 'pirmadienį', 'antradienį', 'trečiadienį', 'ketvirtadienį', 'penktadienį', 'šeštadienį'], + 'weekdays_standalone' => ['sekmadienis', 'pirmadienis', 'antradienis', 'trečiadienis', 'ketvirtadienis', 'penktadienis', 'šeštadienis'], + 'weekdays_short' => ['sek', 'pir', 'ant', 'tre', 'ket', 'pen', 'šeš'], + 'weekdays_min' => ['se', 'pi', 'an', 'tr', 'ke', 'pe', 'še'], + 'list' => [', ', ' ir '], + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY-MM-DD', + 'LL' => 'MMMM DD, YYYY', + 'LLL' => 'DD MMM HH:mm', + 'LLLL' => 'MMMM DD, YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Šiandien] LT', + 'nextDay' => '[Rytoj] LT', + 'nextWeek' => 'dddd LT', + 'lastDay' => '[Vakar] LT', + 'lastWeek' => '[Paskutinį] dddd LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + switch ($number) { + case 0: + return '0-is'; + case 3: + return '3-ias'; + default: + return "$number-as"; + } + }, + 'meridiem' => ['priešpiet', 'popiet'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/lt_LT.php b/vendor/nesbot/carbon/src/Carbon/Lang/lt_LT.php new file mode 100644 index 00000000..f772d38b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/lt_LT.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/lt.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/lu.php b/vendor/nesbot/carbon/src/Carbon/Lang/lu.php new file mode 100644 index 00000000..c8cd83af --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/lu.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['Dinda', 'Dilolo'], + 'weekdays' => ['Lumingu', 'Nkodya', 'Ndàayà', 'Ndangù', 'Njòwa', 'Ngòvya', 'Lubingu'], + 'weekdays_short' => ['Lum', 'Nko', 'Ndy', 'Ndg', 'Njw', 'Ngv', 'Lub'], + 'weekdays_min' => ['Lum', 'Nko', 'Ndy', 'Ndg', 'Njw', 'Ngv', 'Lub'], + 'months' => ['Ciongo', 'Lùishi', 'Lusòlo', 'Mùuyà', 'Lumùngùlù', 'Lufuimi', 'Kabàlàshìpù', 'Lùshìkà', 'Lutongolo', 'Lungùdi', 'Kaswèkèsè', 'Ciswà'], + 'months_short' => ['Cio', 'Lui', 'Lus', 'Muu', 'Lum', 'Luf', 'Kab', 'Lush', 'Lut', 'Lun', 'Kas', 'Cis'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/luo.php b/vendor/nesbot/carbon/src/Carbon/Lang/luo.php new file mode 100644 index 00000000..b55af731 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/luo.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['OD', 'OT'], + 'weekdays' => ['Jumapil', 'Wuok Tich', 'Tich Ariyo', 'Tich Adek', 'Tich Ang’wen', 'Tich Abich', 'Ngeso'], + 'weekdays_short' => ['JMP', 'WUT', 'TAR', 'TAD', 'TAN', 'TAB', 'NGS'], + 'weekdays_min' => ['JMP', 'WUT', 'TAR', 'TAD', 'TAN', 'TAB', 'NGS'], + 'months' => ['Dwe mar Achiel', 'Dwe mar Ariyo', 'Dwe mar Adek', 'Dwe mar Ang’wen', 'Dwe mar Abich', 'Dwe mar Auchiel', 'Dwe mar Abiriyo', 'Dwe mar Aboro', 'Dwe mar Ochiko', 'Dwe mar Apar', 'Dwe mar gi achiel', 'Dwe mar Apar gi ariyo'], + 'months_short' => ['DAC', 'DAR', 'DAD', 'DAN', 'DAH', 'DAU', 'DAO', 'DAB', 'DOC', 'DAP', 'DGI', 'DAG'], + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + + 'year' => 'higni :count', + 'y' => 'higni :count', + 'a_year' => ':higni :count', + + 'month' => 'dweche :count', + 'm' => 'dweche :count', + 'a_month' => 'dweche :count', + + 'week' => 'jumbe :count', + 'w' => 'jumbe :count', + 'a_week' => 'jumbe :count', + + 'day' => 'ndalo :count', + 'd' => 'ndalo :count', + 'a_day' => 'ndalo :count', + + 'hour' => 'seche :count', + 'h' => 'seche :count', + 'a_hour' => 'seche :count', + + 'minute' => 'dakika :count', + 'min' => 'dakika :count', + 'a_minute' => 'dakika :count', + + 'second' => 'nus dakika :count', + 's' => 'nus dakika :count', + 'a_second' => 'nus dakika :count', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/luy.php b/vendor/nesbot/carbon/src/Carbon/Lang/luy.php new file mode 100644 index 00000000..2b37e3e3 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/luy.php @@ -0,0 +1,57 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'weekdays' => ['Jumapiri', 'Jumatatu', 'Jumanne', 'Jumatano', 'Murwa wa Kanne', 'Murwa wa Katano', 'Jumamosi'], + 'weekdays_short' => ['J2', 'J3', 'J4', 'J5', 'Al', 'Ij', 'J1'], + 'weekdays_min' => ['J2', 'J3', 'J4', 'J5', 'Al', 'Ij', 'J1'], + 'months' => ['Januari', 'Februari', 'Machi', 'Aprili', 'Mei', 'Juni', 'Julai', 'Agosti', 'Septemba', 'Oktoba', 'Novemba', 'Desemba'], + 'months_short' => ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Ago', 'Sep', 'Okt', 'Nov', 'Des'], + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + + // Too unreliable + /* + 'year' => ':count liliino', // less reliable + 'y' => ':count liliino', // less reliable + 'a_year' => ':count liliino', // less reliable + + 'month' => ':count kumwesi', // less reliable + 'm' => ':count kumwesi', // less reliable + 'a_month' => ':count kumwesi', // less reliable + + 'week' => ':count olutambi', // less reliable + 'w' => ':count olutambi', // less reliable + 'a_week' => ':count olutambi', // less reliable + + 'day' => ':count luno', // less reliable + 'd' => ':count luno', // less reliable + 'a_day' => ':count luno', // less reliable + + 'hour' => ':count ekengele', // less reliable + 'h' => ':count ekengele', // less reliable + 'a_hour' => ':count ekengele', // less reliable + + 'minute' => ':count omundu', // less reliable + 'min' => ':count omundu', // less reliable + 'a_minute' => ':count omundu', // less reliable + + 'second' => ':count liliino', // less reliable + 's' => ':count liliino', // less reliable + 'a_second' => ':count liliino', // less reliable + */ +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/lv.php b/vendor/nesbot/carbon/src/Carbon/Lang/lv.php new file mode 100644 index 00000000..d5cba7ca --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/lv.php @@ -0,0 +1,183 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Carbon\CarbonInterface; + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Philippe Vaucher + * - pirminis + * - Tsutomu Kuroda + * - tjku + * - Andris Zāģeris + * - Max Melentiev + * - Edgars Beigarts + * - Juanito Fatas + * - Vitauts Stočka + * - Akira Matsuda + * - Christopher Dell + * - Enrique Vidal + * - Simone Carletti + * - Aaron Patterson + * - Kaspars Bankovskis + * - Nicolás Hock Isaza + * - Viesturs Kavacs (Kavacky) + * - zakse + * - Janis Eglitis (janiseglitis) + * - Guntars + * - Juris Sudmalis + */ +$daysOfWeek = ['svētdiena', 'pirmdiena', 'otrdiena', 'trešdiena', 'ceturtdiena', 'piektdiena', 'sestdiena']; +$daysOfWeekLocativum = ['svētdien', 'pirmdien', 'otrdien', 'trešdien', 'ceturtdien', 'piektdien', 'sestdien']; + +$transformDiff = function ($input) { + return strtr($input, [ + // Nominative => "pirms/pēc" Dative + 'gads' => 'gada', + 'gadi' => 'gadiem', + 'gadu' => 'gadiem', + 'mēnesis' => 'mēneša', + 'mēneši' => 'mēnešiem', + 'mēnešu' => 'mēnešiem', + 'nedēļa' => 'nedēļas', + 'nedēļas' => 'nedēļām', + 'nedēļu' => 'nedēļām', + 'diena' => 'dienas', + 'dienas' => 'dienām', + 'dienu' => 'dienām', + 'stunda' => 'stundas', + 'stundas' => 'stundām', + 'stundu' => 'stundām', + 'minūte' => 'minūtes', + 'minūtes' => 'minūtēm', + 'minūšu' => 'minūtēm', + 'sekunde' => 'sekundes', + 'sekundes' => 'sekundēm', + 'sekunžu' => 'sekundēm', + ]); +}; + +return [ + 'ago' => function ($time) use ($transformDiff) { + return 'pirms '.$transformDiff($time); + }, + 'from_now' => function ($time) use ($transformDiff) { + return 'pēc '.$transformDiff($time); + }, + + 'year' => '0 gadu|:count gads|:count gadi', + 'y' => ':count g.', + 'a_year' => '{1}gads|0 gadu|:count gads|:count gadi', + 'month' => '0 mēnešu|:count mēnesis|:count mēneši', + 'm' => ':count mēn.', + 'a_month' => '{1}mēnesis|0 mēnešu|:count mēnesis|:count mēneši', + 'week' => '0 nedēļu|:count nedēļa|:count nedēļas', + 'w' => ':count ned.', + 'a_week' => '{1}nedēļa|0 nedēļu|:count nedēļa|:count nedēļas', + 'day' => '0 dienu|:count diena|:count dienas', + 'd' => ':count d.', + 'a_day' => '{1}diena|0 dienu|:count diena|:count dienas', + 'hour' => '0 stundu|:count stunda|:count stundas', + 'h' => ':count st.', + 'a_hour' => '{1}stunda|0 stundu|:count stunda|:count stundas', + 'minute' => '0 minūšu|:count minūte|:count minūtes', + 'min' => ':count min.', + 'a_minute' => '{1}minūte|0 minūšu|:count minūte|:count minūtes', + 'second' => '0 sekunžu|:count sekunde|:count sekundes', + 's' => ':count sek.', + 'a_second' => '{1}sekunde|0 sekunžu|:count sekunde|:count sekundes', + + 'after' => ':time vēlāk', + 'year_after' => '0 gadus|:count gadu|:count gadus', + 'a_year_after' => '{1}gadu|0 gadus|:count gadu|:count gadus', + 'month_after' => '0 mēnešus|:count mēnesi|:count mēnešus', + 'a_month_after' => '{1}mēnesi|0 mēnešus|:count mēnesi|:count mēnešus', + 'week_after' => '0 nedēļas|:count nedēļu|:count nedēļas', + 'a_week_after' => '{1}nedēļu|0 nedēļas|:count nedēļu|:count nedēļas', + 'day_after' => '0 dienas|:count dienu|:count dienas', + 'a_day_after' => '{1}dienu|0 dienas|:count dienu|:count dienas', + 'hour_after' => '0 stundas|:count stundu|:count stundas', + 'a_hour_after' => '{1}stundu|0 stundas|:count stundu|:count stundas', + 'minute_after' => '0 minūtes|:count minūti|:count minūtes', + 'a_minute_after' => '{1}minūti|0 minūtes|:count minūti|:count minūtes', + 'second_after' => '0 sekundes|:count sekundi|:count sekundes', + 'a_second_after' => '{1}sekundi|0 sekundes|:count sekundi|:count sekundes', + + 'before' => ':time agrāk', + 'year_before' => '0 gadus|:count gadu|:count gadus', + 'a_year_before' => '{1}gadu|0 gadus|:count gadu|:count gadus', + 'month_before' => '0 mēnešus|:count mēnesi|:count mēnešus', + 'a_month_before' => '{1}mēnesi|0 mēnešus|:count mēnesi|:count mēnešus', + 'week_before' => '0 nedēļas|:count nedēļu|:count nedēļas', + 'a_week_before' => '{1}nedēļu|0 nedēļas|:count nedēļu|:count nedēļas', + 'day_before' => '0 dienas|:count dienu|:count dienas', + 'a_day_before' => '{1}dienu|0 dienas|:count dienu|:count dienas', + 'hour_before' => '0 stundas|:count stundu|:count stundas', + 'a_hour_before' => '{1}stundu|0 stundas|:count stundu|:count stundas', + 'minute_before' => '0 minūtes|:count minūti|:count minūtes', + 'a_minute_before' => '{1}minūti|0 minūtes|:count minūti|:count minūtes', + 'second_before' => '0 sekundes|:count sekundi|:count sekundes', + 'a_second_before' => '{1}sekundi|0 sekundes|:count sekundi|:count sekundes', + + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' un '], + + 'diff_now' => 'tagad', + 'diff_today' => 'šodien', + 'diff_yesterday' => 'vakar', + 'diff_before_yesterday' => 'aizvakar', + 'diff_tomorrow' => 'rīt', + 'diff_after_tomorrow' => 'parīt', + + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY.', + 'LL' => 'YYYY. [gada] D. MMMM', + 'LLL' => 'DD.MM.YYYY., HH:mm', + 'LLLL' => 'YYYY. [gada] D. MMMM, HH:mm', + ], + + 'calendar' => [ + 'sameDay' => '[šodien] [plkst.] LT', + 'nextDay' => '[rīt] [plkst.] LT', + 'nextWeek' => function (CarbonInterface $current, CarbonInterface $other) use ($daysOfWeekLocativum) { + if ($current->week !== $other->week) { + return '[nākošo] ['.$daysOfWeekLocativum[$current->dayOfWeek].'] [plkst.] LT'; + } + + return '['.$daysOfWeekLocativum[$current->dayOfWeek].'] [plkst.] LT'; + }, + 'lastDay' => '[vakar] [plkst.] LT', + 'lastWeek' => function (CarbonInterface $current) use ($daysOfWeekLocativum) { + return '[pagājušo] ['.$daysOfWeekLocativum[$current->dayOfWeek].'] [plkst.] LT'; + }, + 'sameElse' => 'L', + ], + + 'weekdays' => $daysOfWeek, + 'weekdays_short' => ['Sv.', 'P.', 'O.', 'T.', 'C.', 'Pk.', 'S.'], + 'weekdays_min' => ['Sv.', 'P.', 'O.', 'T.', 'C.', 'Pk.', 'S.'], + 'months' => ['janvāris', 'februāris', 'marts', 'aprīlis', 'maijs', 'jūnijs', 'jūlijs', 'augusts', 'septembris', 'oktobris', 'novembris', 'decembris'], + 'months_standalone' => ['janvārī', 'februārī', 'martā', 'aprīlī', 'maijā', 'jūnijā', 'jūlijā', 'augustā', 'septembrī', 'oktobrī', 'novembrī', 'decembrī'], + 'months_short' => ['janv.', 'febr.', 'martā', 'apr.', 'maijā', 'jūn.', 'jūl.', 'aug.', 'sept.', 'okt.', 'nov.', 'dec.'], + 'meridiem' => ['priekšpusdiena', 'pēcpusdiena'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/lv_LV.php b/vendor/nesbot/carbon/src/Carbon/Lang/lv_LV.php new file mode 100644 index 00000000..ee91c369 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/lv_LV.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/lv.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/lzh.php b/vendor/nesbot/carbon/src/Carbon/Lang/lzh.php new file mode 100644 index 00000000..1180c6bb --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/lzh.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/lzh_TW.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/lzh_TW.php b/vendor/nesbot/carbon/src/Carbon/Lang/lzh_TW.php new file mode 100644 index 00000000..3b1493ee --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/lzh_TW.php @@ -0,0 +1,56 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'OY[年]MMMMOD[日]', + ], + 'months' => ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], + 'months_short' => [' 一 ', ' 二 ', ' 三 ', ' 四 ', ' 五 ', ' 六 ', ' 七 ', ' 八 ', ' 九 ', ' 十 ', '十一', '十二'], + 'weekdays' => ['週日', '週一', '週二', '週三', '週四', '週五', '週六'], + 'weekdays_short' => ['日', '一', '二', '三', '四', '五', '六'], + 'weekdays_min' => ['日', '一', '二', '三', '四', '五', '六'], + 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['〇', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二', '十三', '十四', '十五', '十六', '十七', '十八', '十九', '廿', '廿一', '廿二', '廿三', '廿四', '廿五', '廿六', '廿七', '廿八', '廿九', '卅', '卅一'], + 'meridiem' => ['朝', '暮'], + + 'year' => ':count 夏', // less reliable + 'y' => ':count 夏', // less reliable + 'a_year' => ':count 夏', // less reliable + + 'month' => ':count 月', // less reliable + 'm' => ':count 月', // less reliable + 'a_month' => ':count 月', // less reliable + + 'hour' => ':count 氧', // less reliable + 'h' => ':count 氧', // less reliable + 'a_hour' => ':count 氧', // less reliable + + 'minute' => ':count 點', // less reliable + 'min' => ':count 點', // less reliable + 'a_minute' => ':count 點', // less reliable + + 'second' => ':count 楚', // less reliable + 's' => ':count 楚', // less reliable + 'a_second' => ':count 楚', // less reliable + + 'week' => ':count 星期', + 'w' => ':count 星期', + 'a_week' => ':count 星期', + + 'day' => ':count 日(曆法)', + 'd' => ':count 日(曆法)', + 'a_day' => ':count 日(曆法)', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mag.php b/vendor/nesbot/carbon/src/Carbon/Lang/mag.php new file mode 100644 index 00000000..7532436d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mag.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/mag_IN.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mag_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/mag_IN.php new file mode 100644 index 00000000..193f67a7 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mag_IN.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - bhashaghar@googlegroups.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'D/M/YY', + ], + 'months' => ['जनवरी', 'फ़रवरी', 'मार्च', 'अप्रेल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितम्बर', 'अक्टूबर', 'नवम्बर', 'दिसम्बर'], + 'months_short' => ['जनवरी', 'फ़रवरी', 'मार्च', 'अप्रेल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितम्बर', 'अक्टूबर', 'नवम्बर', 'दिसम्बर'], + 'weekdays' => ['एतवार', 'सोमार', 'मंगर', 'बुध', 'बिफे', 'सूक', 'सनिचर'], + 'weekdays_short' => ['एतवार', 'सोमार', 'मंगर', 'बुध', 'बिफे', 'सूक', 'सनिचर'], + 'weekdays_min' => ['एतवार', 'सोमार', 'मंगर', 'बुध', 'बिफे', 'सूक', 'सनिचर'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['पूर्वाह्न', 'अपराह्न'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mai.php b/vendor/nesbot/carbon/src/Carbon/Lang/mai.php new file mode 100644 index 00000000..792b9739 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mai.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/mai_IN.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mai_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/mai_IN.php new file mode 100644 index 00000000..03049d45 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mai_IN.php @@ -0,0 +1,51 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Maithili Computing Research Center, Pune, India rajeshkajha@yahoo.com,akhilesh.k@samusng.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'D/M/YY', + ], + 'months' => ['बैसाख', 'जेठ', 'अषाढ़', 'सावोन', 'भादो', 'आसिन', 'कातिक', 'अगहन', 'पूस', 'माघ', 'फागुन', 'चैति'], + 'months_short' => ['बैसाख', 'जेठ', 'अषाढ़', 'सावोन', 'भादो', 'आसिन', 'कातिक', 'अगहन', 'पूस', 'माघ', 'फागुन', 'चैति'], + 'weekdays' => ['रविदिन', 'सोमदिन', 'मंगलदिन', 'बुधदिन', 'बृहस्पतीदिन', 'शुक्रदिन', 'शनीदिन'], + 'weekdays_short' => ['रवि', 'सोम', 'मंगल', 'बुध', 'बृहस्पती', 'शुक्र', 'शनी'], + 'weekdays_min' => ['रवि', 'सोम', 'मंगल', 'बुध', 'बृहस्पती', 'शुक्र', 'शनी'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['पूर्वाह्न', 'अपराह्न'], + + 'year' => ':count ऋतु', // less reliable + 'y' => ':count ऋतु', // less reliable + 'a_year' => ':count ऋतु', // less reliable + + 'month' => ':count महिना', + 'm' => ':count महिना', + 'a_month' => ':count महिना', + + 'week' => ':count श्रेणी:क्यालेन्डर', // less reliable + 'w' => ':count श्रेणी:क्यालेन्डर', // less reliable + 'a_week' => ':count श्रेणी:क्यालेन्डर', // less reliable + + 'day' => ':count दिन', + 'd' => ':count दिन', + 'a_day' => ':count दिन', + + 'hour' => ':count घण्टा', + 'h' => ':count घण्टा', + 'a_hour' => ':count घण्टा', + + 'minute' => ':count समय', // less reliable + 'min' => ':count समय', // less reliable + 'a_minute' => ':count समय', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mas.php b/vendor/nesbot/carbon/src/Carbon/Lang/mas.php new file mode 100644 index 00000000..cbd610c2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mas.php @@ -0,0 +1,51 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['Ɛnkakɛnyá', 'Ɛndámâ'], + 'weekdays' => ['Jumapílí', 'Jumatátu', 'Jumane', 'Jumatánɔ', 'Alaámisi', 'Jumáa', 'Jumamósi'], + 'weekdays_short' => ['Jpi', 'Jtt', 'Jnn', 'Jtn', 'Alh', 'Iju', 'Jmo'], + 'weekdays_min' => ['Jpi', 'Jtt', 'Jnn', 'Jtn', 'Alh', 'Iju', 'Jmo'], + 'months' => ['Oladalʉ́', 'Arát', 'Ɔɛnɨ́ɔɨŋɔk', 'Olodoyíóríê inkókúâ', 'Oloilépūnyīē inkókúâ', 'Kújúɔrɔk', 'Mórusásin', 'Ɔlɔ́ɨ́bɔ́rárɛ', 'Kúshîn', 'Olgísan', 'Pʉshʉ́ka', 'Ntʉ́ŋʉ́s'], + 'months_short' => ['Dal', 'Ará', 'Ɔɛn', 'Doy', 'Lép', 'Rok', 'Sás', 'Bɔ́r', 'Kús', 'Gís', 'Shʉ́', 'Ntʉ́'], + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + + 'year' => ':count olameyu', // less reliable + 'y' => ':count olameyu', // less reliable + 'a_year' => ':count olameyu', // less reliable + + 'week' => ':count engolongeare orwiki', // less reliable + 'w' => ':count engolongeare orwiki', // less reliable + 'a_week' => ':count engolongeare orwiki', // less reliable + + 'hour' => ':count esahabu', // less reliable + 'h' => ':count esahabu', // less reliable + 'a_hour' => ':count esahabu', // less reliable + + 'second' => ':count are', // less reliable + 's' => ':count are', // less reliable + 'a_second' => ':count are', // less reliable + + 'month' => ':count olapa', + 'm' => ':count olapa', + 'a_month' => ':count olapa', + + 'day' => ':count enkolongʼ', + 'd' => ':count enkolongʼ', + 'a_day' => ':count enkolongʼ', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mas_TZ.php b/vendor/nesbot/carbon/src/Carbon/Lang/mas_TZ.php new file mode 100644 index 00000000..56e29053 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mas_TZ.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/mas.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mer.php b/vendor/nesbot/carbon/src/Carbon/Lang/mer.php new file mode 100644 index 00000000..2e14597f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mer.php @@ -0,0 +1,43 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['RŨ', 'ŨG'], + 'weekdays' => ['Kiumia', 'Muramuko', 'Wairi', 'Wethatu', 'Wena', 'Wetano', 'Jumamosi'], + 'weekdays_short' => ['KIU', 'MRA', 'WAI', 'WET', 'WEN', 'WTN', 'JUM'], + 'weekdays_min' => ['KIU', 'MRA', 'WAI', 'WET', 'WEN', 'WTN', 'JUM'], + 'months' => ['Januarĩ', 'Feburuarĩ', 'Machi', 'Ĩpurũ', 'Mĩĩ', 'Njuni', 'Njuraĩ', 'Agasti', 'Septemba', 'Oktũba', 'Novemba', 'Dicemba'], + 'months_short' => ['JAN', 'FEB', 'MAC', 'ĨPU', 'MĨĨ', 'NJU', 'NJR', 'AGA', 'SPT', 'OKT', 'NOV', 'DEC'], + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + + 'year' => ':count murume', // less reliable + 'y' => ':count murume', // less reliable + 'a_year' => ':count murume', // less reliable + + 'month' => ':count muchaara', // less reliable + 'm' => ':count muchaara', // less reliable + 'a_month' => ':count muchaara', // less reliable + + 'minute' => ':count monto', // less reliable + 'min' => ':count monto', // less reliable + 'a_minute' => ':count monto', // less reliable + + 'second' => ':count gikeno', // less reliable + 's' => ':count gikeno', // less reliable + 'a_second' => ':count gikeno', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mfe.php b/vendor/nesbot/carbon/src/Carbon/Lang/mfe.php new file mode 100644 index 00000000..4d6e6b69 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mfe.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/mfe_MU.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mfe_MU.php b/vendor/nesbot/carbon/src/Carbon/Lang/mfe_MU.php new file mode 100644 index 00000000..2d27b457 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mfe_MU.php @@ -0,0 +1,53 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Samsung Electronics Co., Ltd. akhilesh.k@samsung.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YY', + ], + 'months' => ['zanvie', 'fevriye', 'mars', 'avril', 'me', 'zin', 'zilye', 'out', 'septam', 'oktob', 'novam', 'desam'], + 'months_short' => ['zan', 'fev', 'mar', 'avr', 'me', 'zin', 'zil', 'out', 'sep', 'okt', 'nov', 'des'], + 'weekdays' => ['dimans', 'lindi', 'mardi', 'merkredi', 'zedi', 'vandredi', 'samdi'], + 'weekdays_short' => ['dim', 'lin', 'mar', 'mer', 'ze', 'van', 'sam'], + 'weekdays_min' => ['dim', 'lin', 'mar', 'mer', 'ze', 'van', 'sam'], + + 'year' => ':count banané', + 'y' => ':count banané', + 'a_year' => ':count banané', + + 'month' => ':count mwa', + 'm' => ':count mwa', + 'a_month' => ':count mwa', + + 'week' => ':count sémenn', + 'w' => ':count sémenn', + 'a_week' => ':count sémenn', + + 'day' => ':count zour', + 'd' => ':count zour', + 'a_day' => ':count zour', + + 'hour' => ':count -er-tan', + 'h' => ':count -er-tan', + 'a_hour' => ':count -er-tan', + + 'minute' => ':count minitt', + 'min' => ':count minitt', + 'a_minute' => ':count minitt', + + 'second' => ':count déziém', + 's' => ':count déziém', + 'a_second' => ':count déziém', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mg.php b/vendor/nesbot/carbon/src/Carbon/Lang/mg.php new file mode 100644 index 00000000..40bc2a82 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mg.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/mg_MG.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mg_MG.php b/vendor/nesbot/carbon/src/Carbon/Lang/mg_MG.php new file mode 100644 index 00000000..6a14535a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mg_MG.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - The Debian Project modified by GNU//Linux Malagasy Rado Ramarotafika,Do-Risika RAFIEFERANTSIARONJY rado@linuxmg.org,dourix@free.fr + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD.MM.YYYY', + ], + 'months' => ['Janoary', 'Febroary', 'Martsa', 'Aprily', 'Mey', 'Jona', 'Jolay', 'Aogositra', 'Septambra', 'Oktobra', 'Novambra', 'Desambra'], + 'months_short' => ['Jan', 'Feb', 'Mar', 'Apr', 'Mey', 'Jon', 'Jol', 'Aog', 'Sep', 'Okt', 'Nov', 'Des'], + 'weekdays' => ['alahady', 'alatsinainy', 'talata', 'alarobia', 'alakamisy', 'zoma', 'sabotsy'], + 'weekdays_short' => ['lhd', 'lts', 'tlt', 'lrb', 'lkm', 'zom', 'sab'], + 'weekdays_min' => ['lhd', 'lts', 'tlt', 'lrb', 'lkm', 'zom', 'sab'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + + 'minute' => ':count minitra', // less reliable + 'min' => ':count minitra', // less reliable + 'a_minute' => ':count minitra', // less reliable + + 'year' => ':count taona', + 'y' => ':count taona', + 'a_year' => ':count taona', + + 'month' => ':count volana', + 'm' => ':count volana', + 'a_month' => ':count volana', + + 'week' => ':count herinandro', + 'w' => ':count herinandro', + 'a_week' => ':count herinandro', + + 'day' => ':count andro', + 'd' => ':count andro', + 'a_day' => ':count andro', + + 'hour' => ':count ora', + 'h' => ':count ora', + 'a_hour' => ':count ora', + + 'second' => ':count segondra', + 's' => ':count segondra', + 'a_second' => ':count segondra', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mgh.php b/vendor/nesbot/carbon/src/Carbon/Lang/mgh.php new file mode 100644 index 00000000..2a80960d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mgh.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['wichishu', 'mchochil’l'], + 'weekdays' => ['Sabato', 'Jumatatu', 'Jumanne', 'Jumatano', 'Arahamisi', 'Ijumaa', 'Jumamosi'], + 'weekdays_short' => ['Sab', 'Jtt', 'Jnn', 'Jtn', 'Ara', 'Iju', 'Jmo'], + 'weekdays_min' => ['Sab', 'Jtt', 'Jnn', 'Jtn', 'Ara', 'Iju', 'Jmo'], + 'months' => ['Mweri wo kwanza', 'Mweri wo unayeli', 'Mweri wo uneraru', 'Mweri wo unecheshe', 'Mweri wo unethanu', 'Mweri wo thanu na mocha', 'Mweri wo saba', 'Mweri wo nane', 'Mweri wo tisa', 'Mweri wo kumi', 'Mweri wo kumi na moja', 'Mweri wo kumi na yel’li'], + 'months_short' => ['Kwa', 'Una', 'Rar', 'Che', 'Tha', 'Moc', 'Sab', 'Nan', 'Tis', 'Kum', 'Moj', 'Yel'], + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mgo.php b/vendor/nesbot/carbon/src/Carbon/Lang/mgo.php new file mode 100644 index 00000000..a126c9ff --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mgo.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'weekdays' => ['Aneg 1', 'Aneg 2', 'Aneg 3', 'Aneg 4', 'Aneg 5', 'Aneg 6', 'Aneg 7'], + 'weekdays_short' => ['Aneg 1', 'Aneg 2', 'Aneg 3', 'Aneg 4', 'Aneg 5', 'Aneg 6', 'Aneg 7'], + 'weekdays_min' => ['1', '2', '3', '4', '5', '6', '7'], + 'months' => ['iməg mbegtug', 'imeg àbùbì', 'imeg mbəŋchubi', 'iməg ngwə̀t', 'iməg fog', 'iməg ichiibɔd', 'iməg àdùmbə̀ŋ', 'iməg ichika', 'iməg kud', 'iməg tèsiʼe', 'iməg zò', 'iməg krizmed'], + 'months_short' => ['mbegtug', 'imeg àbùbì', 'imeg mbəŋchubi', 'iməg ngwə̀t', 'iməg fog', 'iməg ichiibɔd', 'iməg àdùmbə̀ŋ', 'iməg ichika', 'iməg kud', 'iməg tèsiʼe', 'iməg zò', 'iməg krizmed'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY-MM-dd', + 'LL' => 'YYYY MMM D', + 'LLL' => 'YYYY MMMM D HH:mm', + 'LLLL' => 'dddd, YYYY MMMM DD HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mhr.php b/vendor/nesbot/carbon/src/Carbon/Lang/mhr.php new file mode 100644 index 00000000..6bbc9f6d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mhr.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/mhr_RU.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mhr_RU.php b/vendor/nesbot/carbon/src/Carbon/Lang/mhr_RU.php new file mode 100644 index 00000000..309ead9d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mhr_RU.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - PeshSajSoft Ltd. Vyacheslav Kileev slavakileev@yandex.ru + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'YYYY.MM.DD', + ], + 'months' => ['Шорыкйол', 'Пургыж', 'Ӱярня', 'Вӱдшор', 'Ага', 'Пеледыш', 'Сӱрем', 'Сорла', 'Идым', 'Шыжа', 'Кылме', 'Теле'], + 'months_short' => ['Шрк', 'Пгж', 'Ӱрн', 'Вшр', 'Ага', 'Пдш', 'Срм', 'Срл', 'Идм', 'Шыж', 'Клм', 'Тел'], + 'weekdays' => ['Рушарня', 'Шочмо', 'Кушкыжмо', 'Вӱргече', 'Изарня', 'Кугарня', 'Шуматкече'], + 'weekdays_short' => ['Ршр', 'Шчм', 'Кжм', 'Вгч', 'Изр', 'Кгр', 'Шмт'], + 'weekdays_min' => ['Ршр', 'Шчм', 'Кжм', 'Вгч', 'Изр', 'Кгр', 'Шмт'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + + 'year' => ':count идалык', + 'y' => ':count идалык', + 'a_year' => ':count идалык', + + 'month' => ':count Тылзе', + 'm' => ':count Тылзе', + 'a_month' => ':count Тылзе', + + 'week' => ':count арня', + 'w' => ':count арня', + 'a_week' => ':count арня', + + 'day' => ':count кече', + 'd' => ':count кече', + 'a_day' => ':count кече', + + 'hour' => ':count час', + 'h' => ':count час', + 'a_hour' => ':count час', + + 'minute' => ':count минут', + 'min' => ':count минут', + 'a_minute' => ':count минут', + + 'second' => ':count кокымшан', + 's' => ':count кокымшан', + 'a_second' => ':count кокымшан', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mi.php b/vendor/nesbot/carbon/src/Carbon/Lang/mi.php new file mode 100644 index 00000000..b7f51ec2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mi.php @@ -0,0 +1,66 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - François B + * - John Corrigan + * - François B + */ +return [ + 'year' => ':count tau', + 'a_year' => '{1}he tau|:count tau', + 'month' => ':count marama', + 'a_month' => '{1}he marama|:count marama', + 'week' => ':count wiki', + 'a_week' => '{1}he wiki|:count wiki', + 'day' => ':count ra', + 'a_day' => '{1}he ra|:count ra', + 'hour' => ':count haora', + 'a_hour' => '{1}te haora|:count haora', + 'minute' => ':count meneti', + 'a_minute' => '{1}he meneti|:count meneti', + 'second' => ':count hēkona', + 'a_second' => '{1}te hēkona ruarua|:count hēkona', + 'ago' => ':time i mua', + 'from_now' => 'i roto i :time', + 'diff_yesterday' => 'inanahi', + 'diff_yesterday_regexp' => 'inanahi(?:\\s+i)?', + 'diff_today' => 'i teie', + 'diff_today_regexp' => 'i teie(?:\\s+mahana,)?(?:\\s+i)?', + 'diff_tomorrow' => 'apopo', + 'diff_tomorrow_regexp' => 'apopo(?:\\s+i)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY [i] HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY [i] HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[i teie mahana, i] LT', + 'nextDay' => '[apopo i] LT', + 'nextWeek' => 'dddd [i] LT', + 'lastDay' => '[inanahi i] LT', + 'lastWeek' => 'dddd [whakamutunga i] LT', + 'sameElse' => 'L', + ], + 'ordinal' => ':numberº', + 'months' => ['Kohi-tāte', 'Hui-tanguru', 'Poutū-te-rangi', 'Paenga-whāwhā', 'Haratua', 'Pipiri', 'Hōngoingoi', 'Here-turi-kōkā', 'Mahuru', 'Whiringa-ā-nuku', 'Whiringa-ā-rangi', 'Hakihea'], + 'months_short' => ['Kohi', 'Hui', 'Pou', 'Pae', 'Hara', 'Pipi', 'Hōngoi', 'Here', 'Mahu', 'Whi-nu', 'Whi-ra', 'Haki'], + 'weekdays' => ['Rātapu', 'Mane', 'Tūrei', 'Wenerei', 'Tāite', 'Paraire', 'Hātarei'], + 'weekdays_short' => ['Ta', 'Ma', 'Tū', 'We', 'Tāi', 'Pa', 'Hā'], + 'weekdays_min' => ['Ta', 'Ma', 'Tū', 'We', 'Tāi', 'Pa', 'Hā'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' me te '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mi_NZ.php b/vendor/nesbot/carbon/src/Carbon/Lang/mi_NZ.php new file mode 100644 index 00000000..6b964e3a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mi_NZ.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/mi.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/miq.php b/vendor/nesbot/carbon/src/Carbon/Lang/miq.php new file mode 100644 index 00000000..51e5a985 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/miq.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/miq_NI.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/miq_NI.php b/vendor/nesbot/carbon/src/Carbon/Lang/miq_NI.php new file mode 100644 index 00000000..57faa318 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/miq_NI.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YY', + ], + 'months' => ['siakwa kati', 'kuswa kati', 'kakamuk kati', 'lî wainhka kati', 'lih mairin kati', 'lî kati', 'pastara kati', 'sikla kati', 'wîs kati', 'waupasa kati', 'yahbra kati', 'trisu kati'], + 'months_short' => ['siakwa kati', 'kuswa kati', 'kakamuk kati', 'lî wainhka kati', 'lih mairin kati', 'lî kati', 'pastara kati', 'sikla kati', 'wîs kati', 'waupasa kati', 'yahbra kati', 'trisu kati'], + 'weekdays' => ['sandi', 'mundi', 'tiusdi', 'wensde', 'tausde', 'praidi', 'satadi'], + 'weekdays_short' => ['san', 'mun', 'tius', 'wens', 'taus', 'prai', 'sat'], + 'weekdays_min' => ['san', 'mun', 'tius', 'wens', 'taus', 'prai', 'sat'], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 7, + 'meridiem' => ['VM', 'NM'], + + 'month' => ':count kati', // less reliable + 'm' => ':count kati', // less reliable + 'a_month' => ':count kati', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mjw.php b/vendor/nesbot/carbon/src/Carbon/Lang/mjw.php new file mode 100644 index 00000000..617154cd --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mjw.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/mjw_IN.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mjw_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/mjw_IN.php new file mode 100644 index 00000000..58ed0d18 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mjw_IN.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Jor Teron bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'D/M/YY', + ], + 'months' => ['Arkoi', 'Thangthang', 'There', 'Jangmi', 'Aru', 'Vosik', 'Jakhong', 'Paipai', 'Chiti', 'Phere', 'Phaikuni', 'Matijong'], + 'months_short' => ['Ark', 'Thang', 'The', 'Jang', 'Aru', 'Vos', 'Jak', 'Pai', 'Chi', 'Phe', 'Phai', 'Mati'], + 'weekdays' => ['Bhomkuru', 'Urmi', 'Durmi', 'Thelang', 'Theman', 'Bhomta', 'Bhomti'], + 'weekdays_short' => ['Bhom', 'Ur', 'Dur', 'Tkel', 'Tkem', 'Bhta', 'Bhti'], + 'weekdays_min' => ['Bhom', 'Ur', 'Dur', 'Tkel', 'Tkem', 'Bhta', 'Bhti'], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mk.php b/vendor/nesbot/carbon/src/Carbon/Lang/mk.php new file mode 100644 index 00000000..d822de09 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mk.php @@ -0,0 +1,116 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Sashko Todorov + * - Josh Soref + * - François B + * - Serhan Apaydın + * - Borislav Mickov + * - JD Isaacks + * - Tomi Atanasoski + */ + +use Carbon\CarbonInterface; + +return [ + 'year' => ':count година|:count години', + 'a_year' => 'година|:count години', + 'y' => ':count год.', + 'month' => ':count месец|:count месеци', + 'a_month' => 'месец|:count месеци', + 'm' => ':count месец|:count месеци', + 'week' => ':count седмица|:count седмици', + 'a_week' => 'седмица|:count седмици', + 'w' => ':count седмица|:count седмици', + 'day' => ':count ден|:count дена', + 'a_day' => 'ден|:count дена', + 'd' => ':count ден|:count дена', + 'hour' => ':count час|:count часа', + 'a_hour' => 'час|:count часа', + 'h' => ':count час|:count часа', + 'minute' => ':count минута|:count минути', + 'a_minute' => 'минута|:count минути', + 'min' => ':count мин.', + 'second' => ':count секунда|:count секунди', + 'a_second' => 'неколку секунди|:count секунди', + 's' => ':count сек.', + 'ago' => 'пред :time', + 'from_now' => 'после :time', + 'after' => 'по :time', + 'before' => 'пред :time', + 'diff_now' => 'сега', + 'diff_today' => 'Денес', + 'diff_today_regexp' => 'Денес(?:\\s+во)?', + 'diff_yesterday' => 'вчера', + 'diff_yesterday_regexp' => 'Вчера(?:\\s+во)?', + 'diff_tomorrow' => 'утре', + 'diff_tomorrow_regexp' => 'Утре(?:\\s+во)?', + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'D.MM.YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY H:mm', + 'LLLL' => 'dddd, D MMMM YYYY H:mm', + ], + 'calendar' => [ + 'sameDay' => '[Денес во] LT', + 'nextDay' => '[Утре во] LT', + 'nextWeek' => '[Во] dddd [во] LT', + 'lastDay' => '[Вчера во] LT', + 'lastWeek' => function (CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + case 3: + case 6: + return '[Изминатата] dddd [во] LT'; + default: + return '[Изминатиот] dddd [во] LT'; + } + }, + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + $lastDigit = $number % 10; + $last2Digits = $number % 100; + if ($number === 0) { + return $number.'-ев'; + } + if ($last2Digits === 0) { + return $number.'-ен'; + } + if ($last2Digits > 10 && $last2Digits < 20) { + return $number.'-ти'; + } + if ($lastDigit === 1) { + return $number.'-ви'; + } + if ($lastDigit === 2) { + return $number.'-ри'; + } + if ($lastDigit === 7 || $lastDigit === 8) { + return $number.'-ми'; + } + + return $number.'-ти'; + }, + 'months' => ['јануари', 'февруари', 'март', 'април', 'мај', 'јуни', 'јули', 'август', 'септември', 'октомври', 'ноември', 'декември'], + 'months_short' => ['јан', 'фев', 'мар', 'апр', 'мај', 'јун', 'јул', 'авг', 'сеп', 'окт', 'ное', 'дек'], + 'weekdays' => ['недела', 'понеделник', 'вторник', 'среда', 'четврток', 'петок', 'сабота'], + 'weekdays_short' => ['нед', 'пон', 'вто', 'сре', 'чет', 'пет', 'саб'], + 'weekdays_min' => ['нe', 'пo', 'вт', 'ср', 'че', 'пе', 'сa'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' и '], + 'meridiem' => ['АМ', 'ПМ'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mk_MK.php b/vendor/nesbot/carbon/src/Carbon/Lang/mk_MK.php new file mode 100644 index 00000000..95e2ff9c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mk_MK.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/mk.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ml.php b/vendor/nesbot/carbon/src/Carbon/Lang/ml.php new file mode 100644 index 00000000..1abd6c44 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ml.php @@ -0,0 +1,76 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - JD Isaacks + */ +return [ + 'year' => ':count വർഷം', + 'a_year' => 'ഒരു വർഷം|:count വർഷം', + 'month' => ':count മാസം', + 'a_month' => 'ഒരു മാസം|:count മാസം', + 'week' => ':count ആഴ്ച', + 'a_week' => 'ഒരാഴ്ച|:count ആഴ്ച', + 'day' => ':count ദിവസം', + 'a_day' => 'ഒരു ദിവസം|:count ദിവസം', + 'hour' => ':count മണിക്കൂർ', + 'a_hour' => 'ഒരു മണിക്കൂർ|:count മണിക്കൂർ', + 'minute' => ':count മിനിറ്റ്', + 'a_minute' => 'ഒരു മിനിറ്റ്|:count മിനിറ്റ്', + 'second' => ':count സെക്കൻഡ്', + 'a_second' => 'അൽപ നിമിഷങ്ങൾ|:count സെക്കൻഡ്', + 'ago' => ':time മുൻപ്', + 'from_now' => ':time കഴിഞ്ഞ്', + 'diff_now' => 'ഇപ്പോൾ', + 'diff_today' => 'ഇന്ന്', + 'diff_yesterday' => 'ഇന്നലെ', + 'diff_tomorrow' => 'നാളെ', + 'formats' => [ + 'LT' => 'A h:mm -നു', + 'LTS' => 'A h:mm:ss -നു', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY, A h:mm -നു', + 'LLLL' => 'dddd, D MMMM YYYY, A h:mm -നു', + ], + 'calendar' => [ + 'sameDay' => '[ഇന്ന്] LT', + 'nextDay' => '[നാളെ] LT', + 'nextWeek' => 'dddd, LT', + 'lastDay' => '[ഇന്നലെ] LT', + 'lastWeek' => '[കഴിഞ്ഞ] dddd, LT', + 'sameElse' => 'L', + ], + 'meridiem' => function ($hour) { + if ($hour < 4) { + return 'രാത്രി'; + } + if ($hour < 12) { + return 'രാവിലെ'; + } + if ($hour < 17) { + return 'ഉച്ച കഴിഞ്ഞ്'; + } + if ($hour < 20) { + return 'വൈകുന്നേരം'; + } + + return 'രാത്രി'; + }, + 'months' => ['ജനുവരി', 'ഫെബ്രുവരി', 'മാർച്ച്', 'ഏപ്രിൽ', 'മേയ്', 'ജൂൺ', 'ജൂലൈ', 'ഓഗസ്റ്റ്', 'സെപ്റ്റംബർ', 'ഒക്ടോബർ', 'നവംബർ', 'ഡിസംബർ'], + 'months_short' => ['ജനു.', 'ഫെബ്രു.', 'മാർ.', 'ഏപ്രി.', 'മേയ്', 'ജൂൺ', 'ജൂലൈ.', 'ഓഗ.', 'സെപ്റ്റ.', 'ഒക്ടോ.', 'നവം.', 'ഡിസം.'], + 'weekdays' => ['ഞായറാഴ്ച', 'തിങ്കളാഴ്ച', 'ചൊവ്വാഴ്ച', 'ബുധനാഴ്ച', 'വ്യാഴാഴ്ച', 'വെള്ളിയാഴ്ച', 'ശനിയാഴ്ച'], + 'weekdays_short' => ['ഞായർ', 'തിങ്കൾ', 'ചൊവ്വ', 'ബുധൻ', 'വ്യാഴം', 'വെള്ളി', 'ശനി'], + 'weekdays_min' => ['ഞാ', 'തി', 'ചൊ', 'ബു', 'വ്യാ', 'വെ', 'ശ'], + 'list' => ', ', + 'weekend' => [0, 0], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ml_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/ml_IN.php new file mode 100644 index 00000000..000e7958 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ml_IN.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/ml.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mn.php b/vendor/nesbot/carbon/src/Carbon/Lang/mn.php new file mode 100644 index 00000000..38c6434d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mn.php @@ -0,0 +1,116 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Philippe Vaucher + * - Tsutomu Kuroda + * - tjku + * - Max Melentiev + * - Zolzaya Erdenebaatar + * - Tom Hughes + * - Akira Matsuda + * - Christopher Dell + * - Michael Kessler + * - Enrique Vidal + * - Simone Carletti + * - Aaron Patterson + * - Nicolás Hock Isaza + * - Ochirkhuyag + * - Batmandakh + * - lucifer-crybaby + */ +return [ + 'year' => ':count жил', + 'y' => ':count жил', + 'month' => ':count сар', + 'm' => ':count сар', + 'week' => ':count долоо хоног', + 'w' => ':count долоо хоног', + 'day' => ':count өдөр', + 'd' => ':count өдөр', + 'hour' => ':count цаг', + 'h' => ':countц', + 'minute' => ':count минут', + 'min' => ':countм', + 'second' => ':count секунд', + 's' => ':countс', + + 'ago_mode' => 'last', + 'ago' => ':time өмнө', + 'year_ago' => ':count жилийн', + 'y_ago' => ':count жилийн', + 'month_ago' => ':count сарын', + 'm_ago' => ':count сарын', + 'day_ago' => ':count хоногийн', + 'd_ago' => ':count хоногийн', + 'week_ago' => ':count долоо хоногийн', + 'w_ago' => ':count долоо хоногийн', + 'hour_ago' => ':count цагийн', + 'minute_ago' => ':count минутын', + 'second_ago' => ':count секундын', + + 'from_now_mode' => 'last', + 'from_now' => 'одоогоос :time', + 'year_from_now' => ':count жилийн дараа', + 'y_from_now' => ':count жилийн дараа', + 'month_from_now' => ':count сарын дараа', + 'm_from_now' => ':count сарын дараа', + 'day_from_now' => ':count хоногийн дараа', + 'd_from_now' => ':count хоногийн дараа', + 'hour_from_now' => ':count цагийн дараа', + 'minute_from_now' => ':count минутын дараа', + 'second_from_now' => ':count секундын дараа', + + 'after_mode' => 'last', + 'after' => ':time дараа', + 'year_after' => ':count жилийн', + 'y_after' => ':count жилийн', + 'month_after' => ':count сарын', + 'm_after' => ':count сарын', + 'day_after' => ':count хоногийн', + 'd_after' => ':count хоногийн', + 'hour_after' => ':count цагийн', + 'minute_after' => ':count минутын', + 'second_after' => ':count секундын', + + 'before_mode' => 'last', + 'before' => ':time өмнө', + 'year_before' => ':count жилийн', + 'y_before' => ':count жилийн', + 'month_before' => ':count сарын', + 'm_before' => ':count сарын', + 'day_before' => ':count хоногийн', + 'd_before' => ':count хоногийн', + 'hour_before' => ':count цагийн', + 'minute_before' => ':count минутын', + 'second_before' => ':count секундын', + + 'list' => ', ', + 'diff_now' => 'одоо', + 'diff_yesterday' => 'өчигдөр', + 'diff_tomorrow' => 'маргааш', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY-MM-DD', + 'LL' => 'YYYY MMMM DD', + 'LLL' => 'YY-MM-DD, HH:mm', + 'LLLL' => 'YYYY MMMM DD, HH:mm', + ], + 'weekdays' => ['Ням', 'Даваа', 'Мягмар', 'Лхагва', 'Пүрэв', 'Баасан', 'Бямба'], + 'weekdays_short' => ['Ня', 'Да', 'Мя', 'Лх', 'Пү', 'Ба', 'Бя'], + 'weekdays_min' => ['Ня', 'Да', 'Мя', 'Лх', 'Пү', 'Ба', 'Бя'], + 'months' => ['1 сар', '2 сар', '3 сар', '4 сар', '5 сар', '6 сар', '7 сар', '8 сар', '9 сар', '10 сар', '11 сар', '12 сар'], + 'months_short' => ['1 сар', '2 сар', '3 сар', '4 сар', '5 сар', '6 сар', '7 сар', '8 сар', '9 сар', '10 сар', '11 сар', '12 сар'], + 'meridiem' => ['өглөө', 'орой'], + 'first_day_of_week' => 1, +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mn_MN.php b/vendor/nesbot/carbon/src/Carbon/Lang/mn_MN.php new file mode 100644 index 00000000..e5ce426c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mn_MN.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/mn.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mni.php b/vendor/nesbot/carbon/src/Carbon/Lang/mni.php new file mode 100644 index 00000000..cafa2f87 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mni.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/mni_IN.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mni_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/mni_IN.php new file mode 100644 index 00000000..45d430ef --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mni_IN.php @@ -0,0 +1,35 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Red Hat Pune libc-alpha@sourceware.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'D/M/YY', + ], + 'months' => ['জানুৱারি', 'ফেব্রুৱারি', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'আগষ্ট', 'সেপ্তেম্বর', 'ওক্তোবর', 'নবেম্বর', 'ডিসেম্বর'], + 'months_short' => ['জান', 'ফেব', 'মার', 'এপ্রি', 'মে', 'জুন', 'জুল', 'আগ', 'সেপ', 'ওক্ত', 'নবে', 'ডিস'], + 'weekdays' => ['নোংমাইজিং', 'নিংথৌকাবা', 'লৈবাকপোকপা', 'য়ুমশকৈশা', 'শগোলশেন', 'ইরাই', 'থাংজ'], + 'weekdays_short' => ['নোং', 'নিং', 'লৈবাক', 'য়ুম', 'শগোল', 'ইরা', 'থাং'], + 'weekdays_min' => ['নোং', 'নিং', 'লৈবাক', 'য়ুম', 'শগোল', 'ইরা', 'থাং'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['এ.ম.', 'প.ম.'], + + 'year' => ':count ইসিং', // less reliable + 'y' => ':count ইসিং', // less reliable + 'a_year' => ':count ইসিং', // less reliable + + 'second' => ':count ꯅꯤꯡꯊꯧꯀꯥꯕ', // less reliable + 's' => ':count ꯅꯤꯡꯊꯧꯀꯥꯕ', // less reliable + 'a_second' => ':count ꯅꯤꯡꯊꯧꯀꯥꯕ', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mo.php b/vendor/nesbot/carbon/src/Carbon/Lang/mo.php new file mode 100644 index 00000000..102afcde --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mo.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/ro.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mr.php b/vendor/nesbot/carbon/src/Carbon/Lang/mr.php new file mode 100644 index 00000000..4aaeafd0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mr.php @@ -0,0 +1,86 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Vikram-enyota + */ +return [ + 'year' => ':count वर्ष', + 'y' => ':count वर्ष', + 'month' => ':count महिना|:count महिने', + 'm' => ':count महिना|:count महिने', + 'week' => ':count आठवडा|:count आठवडे', + 'w' => ':count आठवडा|:count आठवडे', + 'day' => ':count दिवस', + 'd' => ':count दिवस', + 'hour' => ':count तास', + 'h' => ':count तास', + 'minute' => ':count मिनिटे', + 'min' => ':count मिनिटे', + 'second' => ':count सेकंद', + 's' => ':count सेकंद', + + 'ago' => ':timeपूर्वी', + 'from_now' => ':timeमध्ये', + 'before' => ':timeपूर्वी', + 'after' => ':timeनंतर', + + 'diff_now' => 'आत्ता', + 'diff_today' => 'आज', + 'diff_yesterday' => 'काल', + 'diff_tomorrow' => 'उद्या', + + 'formats' => [ + 'LT' => 'A h:mm वाजता', + 'LTS' => 'A h:mm:ss वाजता', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY, A h:mm वाजता', + 'LLLL' => 'dddd, D MMMM YYYY, A h:mm वाजता', + ], + + 'calendar' => [ + 'sameDay' => '[आज] LT', + 'nextDay' => '[उद्या] LT', + 'nextWeek' => 'dddd, LT', + 'lastDay' => '[काल] LT', + 'lastWeek' => '[मागील] dddd, LT', + 'sameElse' => 'L', + ], + + 'meridiem' => function ($hour) { + if ($hour < 4) { + return 'रात्री'; + } + if ($hour < 10) { + return 'सकाळी'; + } + if ($hour < 17) { + return 'दुपारी'; + } + if ($hour < 20) { + return 'सायंकाळी'; + } + + return 'रात्री'; + }, + + 'months' => ['जानेवारी', 'फेब्रुवारी', 'मार्च', 'एप्रिल', 'मे', 'जून', 'जुलै', 'ऑगस्ट', 'सप्टेंबर', 'ऑक्टोबर', 'नोव्हेंबर', 'डिसेंबर'], + 'months_short' => ['जाने.', 'फेब्रु.', 'मार्च.', 'एप्रि.', 'मे.', 'जून.', 'जुलै.', 'ऑग.', 'सप्टें.', 'ऑक्टो.', 'नोव्हें.', 'डिसें.'], + 'weekdays' => ['रविवार', 'सोमवार', 'मंगळवार', 'बुधवार', 'गुरूवार', 'शुक्रवार', 'शनिवार'], + 'weekdays_short' => ['रवि', 'सोम', 'मंगळ', 'बुध', 'गुरू', 'शुक्र', 'शनि'], + 'weekdays_min' => ['र', 'सो', 'मं', 'बु', 'गु', 'शु', 'श'], + 'list' => [', ', ' आणि '], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, + 'weekend' => [0, 0], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mr_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/mr_IN.php new file mode 100644 index 00000000..7bca919f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mr_IN.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/mr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ms.php b/vendor/nesbot/carbon/src/Carbon/Lang/ms.php new file mode 100644 index 00000000..c9e80854 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ms.php @@ -0,0 +1,104 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - Azri Jamil + * - JD Isaacks + * - Josh Soref + * - Azri Jamil + * - Hariadi Hinta + * - Ashraf Kamarudin + */ +return [ + 'year' => ':count tahun', + 'a_year' => '{1}setahun|]1,Inf[:count tahun', + 'y' => ':count tahun', + 'month' => ':count bulan', + 'a_month' => '{1}sebulan|]1,Inf[:count bulan', + 'm' => ':count bulan', + 'week' => ':count minggu', + 'a_week' => '{1}seminggu|]1,Inf[:count minggu', + 'w' => ':count minggu', + 'day' => ':count hari', + 'a_day' => '{1}sehari|]1,Inf[:count hari', + 'd' => ':count hari', + 'hour' => ':count jam', + 'a_hour' => '{1}sejam|]1,Inf[:count jam', + 'h' => ':count jam', + 'minute' => ':count minit', + 'a_minute' => '{1}seminit|]1,Inf[:count minit', + 'min' => ':count minit', + 'second' => ':count saat', + 'a_second' => '{1}beberapa saat|]1,Inf[:count saat', + 'millisecond' => ':count milisaat', + 'a_millisecond' => '{1}semilisaat|]1,Inf[:count milliseconds', + 'microsecond' => ':count mikrodetik', + 'a_microsecond' => '{1}semikrodetik|]1,Inf[:count mikrodetik', + 's' => ':count saat', + 'ago' => ':time yang lepas', + 'from_now' => ':time dari sekarang', + 'after' => ':time kemudian', + 'before' => ':time sebelum', + 'diff_now' => 'sekarang', + 'diff_today' => 'Hari', + 'diff_today_regexp' => 'Hari(?:\\s+ini)?(?:\\s+pukul)?', + 'diff_yesterday' => 'semalam', + 'diff_yesterday_regexp' => 'Semalam(?:\\s+pukul)?', + 'diff_tomorrow' => 'esok', + 'diff_tomorrow_regexp' => 'Esok(?:\\s+pukul)?', + 'diff_before_yesterday' => 'kelmarin', + 'diff_after_tomorrow' => 'lusa', + 'formats' => [ + 'LT' => 'HH.mm', + 'LTS' => 'HH.mm.ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY [pukul] HH.mm', + 'LLLL' => 'dddd, D MMMM YYYY [pukul] HH.mm', + ], + 'calendar' => [ + 'sameDay' => '[Hari ini pukul] LT', + 'nextDay' => '[Esok pukul] LT', + 'nextWeek' => 'dddd [pukul] LT', + 'lastDay' => '[Kelmarin pukul] LT', + 'lastWeek' => 'dddd [lepas pukul] LT', + 'sameElse' => 'L', + ], + 'meridiem' => function ($hour) { + if ($hour < 1) { + return 'tengah malam'; + } + + if ($hour < 12) { + return 'pagi'; + } + + if ($hour < 13) { + return 'tengah hari'; + } + + if ($hour < 19) { + return 'petang'; + } + + return 'malam'; + }, + 'months' => ['Januari', 'Februari', 'Mac', 'April', 'Mei', 'Jun', 'Julai', 'Ogos', 'September', 'Oktober', 'November', 'Disember'], + 'months_short' => ['Jan', 'Feb', 'Mac', 'Apr', 'Mei', 'Jun', 'Jul', 'Ogs', 'Sep', 'Okt', 'Nov', 'Dis'], + 'weekdays' => ['Ahad', 'Isnin', 'Selasa', 'Rabu', 'Khamis', 'Jumaat', 'Sabtu'], + 'weekdays_short' => ['Ahd', 'Isn', 'Sel', 'Rab', 'Kha', 'Jum', 'Sab'], + 'weekdays_min' => ['Ah', 'Is', 'Sl', 'Rb', 'Km', 'Jm', 'Sb'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' dan '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ms_BN.php b/vendor/nesbot/carbon/src/Carbon/Lang/ms_BN.php new file mode 100644 index 00000000..ef837a2d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ms_BN.php @@ -0,0 +1,22 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ms.php', [ + 'formats' => [ + 'LT' => 'h:mm a', + 'LTS' => 'h:mm:ss a', + 'L' => 'D/MM/yy', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY, h:mm a', + 'LLLL' => 'dd MMMM YYYY, h:mm a', + ], + 'meridiem' => ['a', 'p'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ms_MY.php b/vendor/nesbot/carbon/src/Carbon/Lang/ms_MY.php new file mode 100644 index 00000000..970d6048 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ms_MY.php @@ -0,0 +1,18 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - Azri Jamil + * - JD Isaacks + */ +return require __DIR__.'/ms.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ms_SG.php b/vendor/nesbot/carbon/src/Carbon/Lang/ms_SG.php new file mode 100644 index 00000000..77cb83d2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ms_SG.php @@ -0,0 +1,22 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ms.php', [ + 'formats' => [ + 'LT' => 'h:mm a', + 'LTS' => 'h:mm:ss a', + 'L' => 'D/MM/yy', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY, h:mm a', + 'LLLL' => 'dddd, D MMMM YYYY, h:mm a', + ], + 'meridiem' => ['a', 'p'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mt.php b/vendor/nesbot/carbon/src/Carbon/Lang/mt.php new file mode 100644 index 00000000..e8aadcc9 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mt.php @@ -0,0 +1,65 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Alessandro Maruccia + */ +return [ + 'year' => 'sena|:count sni|:count sni|:count sni', + 'y' => 'sa sena|:count snin|:count snin|:count snin', + 'month' => 'xahar|:count xhur|:count xhur|:count xhur', + 'm' => ':count xahar|:count xhur|:count xhur|:count xhur', + 'week' => 'gimgħa|:count ġimgħat|:count ġimgħat|:count ġimgħat', + 'w' => 'ġimgħa|:count ġimgħat|:count ġimgħat|:count ġimgħat', + 'day' => 'ġurnata|:count ġranet|:count ġranet|:count ġranet', + 'd' => 'ġurnata|:count ġranet|:count ġranet|:count ġranet', + 'hour' => 'siegħa|:count siegħat|:count siegħat|:count siegħat', + 'h' => 'siegħa|:count sigħat|:count sigħat|:count sigħat', + 'minute' => 'minuta|:count minuti|:count minuti|:count minuti', + 'min' => 'min.|:count min.|:count min.|:count min.', + 'second' => 'ftit sekondi|:count sekondi|:count sekondi|:count sekondi', + 's' => 'sek.|:count sek.|:count sek.|:count sek.', + 'ago' => ':time ilu', + 'from_now' => 'f’ :time', + 'diff_now' => 'issa', + 'diff_today' => 'Illum', + 'diff_today_regexp' => 'Illum(?:\\s+fil-)?', + 'diff_yesterday' => 'lbieraħ', + 'diff_yesterday_regexp' => 'Il-bieraħ(?:\\s+fil-)?', + 'diff_tomorrow' => 'għada', + 'diff_tomorrow_regexp' => 'Għada(?:\\s+fil-)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Illum fil-]LT', + 'nextDay' => '[Għada fil-]LT', + 'nextWeek' => 'dddd [fil-]LT', + 'lastDay' => '[Il-bieraħ fil-]LT', + 'lastWeek' => 'dddd [li għadda] [fil-]LT', + 'sameElse' => 'L', + ], + 'ordinal' => ':numberº', + 'months' => ['Jannar', 'Frar', 'Marzu', 'April', 'Mejju', 'Ġunju', 'Lulju', 'Awwissu', 'Settembru', 'Ottubru', 'Novembru', 'Diċembru'], + 'months_short' => ['Jan', 'Fra', 'Mar', 'Apr', 'Mej', 'Ġun', 'Lul', 'Aww', 'Set', 'Ott', 'Nov', 'Diċ'], + 'weekdays' => ['Il-Ħadd', 'It-Tnejn', 'It-Tlieta', 'L-Erbgħa', 'Il-Ħamis', 'Il-Ġimgħa', 'Is-Sibt'], + 'weekdays_short' => ['Ħad', 'Tne', 'Tli', 'Erb', 'Ħam', 'Ġim', 'Sib'], + 'weekdays_min' => ['Ħa', 'Tn', 'Tl', 'Er', 'Ħa', 'Ġi', 'Si'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' u '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mt_MT.php b/vendor/nesbot/carbon/src/Carbon/Lang/mt_MT.php new file mode 100644 index 00000000..9534f687 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mt_MT.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/mt.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mua.php b/vendor/nesbot/carbon/src/Carbon/Lang/mua.php new file mode 100644 index 00000000..a3a3c6fd --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mua.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['comme', 'lilli'], + 'weekdays' => ['Com’yakke', 'Comlaaɗii', 'Comzyiiɗii', 'Comkolle', 'Comkaldǝɓlii', 'Comgaisuu', 'Comzyeɓsuu'], + 'weekdays_short' => ['Cya', 'Cla', 'Czi', 'Cko', 'Cka', 'Cga', 'Cze'], + 'weekdays_min' => ['Cya', 'Cla', 'Czi', 'Cko', 'Cka', 'Cga', 'Cze'], + 'months' => ['Fĩi Loo', 'Cokcwaklaŋne', 'Cokcwaklii', 'Fĩi Marfoo', 'Madǝǝuutǝbijaŋ', 'Mamǝŋgwãafahbii', 'Mamǝŋgwãalii', 'Madǝmbii', 'Fĩi Dǝɓlii', 'Fĩi Mundaŋ', 'Fĩi Gwahlle', 'Fĩi Yuru'], + 'months_short' => ['FLO', 'CLA', 'CKI', 'FMF', 'MAD', 'MBI', 'MLI', 'MAM', 'FDE', 'FMU', 'FGW', 'FYU'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/my.php b/vendor/nesbot/carbon/src/Carbon/Lang/my.php new file mode 100644 index 00000000..bbdfba40 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/my.php @@ -0,0 +1,70 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - JD Isaacks + * - Nay Lin Aung + */ +return [ + 'year' => '{1}တစ်နှစ်|]1,Inf[:count နှစ်', + 'y' => ':count နှစ်', + 'month' => '{1}တစ်လ|]1,Inf[:count လ', + 'm' => ':count လ', + 'week' => ':count ပတ်', + 'w' => ':count ပတ်', + 'day' => '{1}တစ်ရက်|]1,Inf[:count ရက်', + 'd' => ':count ရက်', + 'hour' => '{1}တစ်နာရီ|]1,Inf[:count နာရီ', + 'h' => ':count နာရီ', + 'minute' => '{1}တစ်မိနစ်|]1,Inf[:count မိနစ်', + 'min' => ':count မိနစ်', + 'second' => '{1}စက္ကန်.အနည်းငယ်|]1,Inf[:count စက္ကန့်', + 's' => ':count စက္ကန့်', + 'ago' => 'လွန်ခဲ့သော :time က', + 'from_now' => 'လာမည့် :time မှာ', + 'after' => ':time ကြာပြီးနောက်', + 'before' => ':time မတိုင်ခင်', + 'diff_now' => 'အခုလေးတင်', + 'diff_today' => 'ယနေ.', + 'diff_yesterday' => 'မနေ့က', + 'diff_yesterday_regexp' => 'မနေ.က', + 'diff_tomorrow' => 'မနက်ဖြန်', + 'diff_before_yesterday' => 'တမြန်နေ့က', + 'diff_after_tomorrow' => 'တဘက်ခါ', + 'period_recurrences' => ':count ကြိမ်', + 'formats' => [ + 'LT' => 'Oh:Om A', + 'LTS' => 'Oh:Om:Os A', + 'L' => 'OD/OM/OY', + 'LL' => 'OD MMMM OY', + 'LLL' => 'OD MMMM OY Oh:Om A', + 'LLLL' => 'dddd OD MMMM OY Oh:Om A', + ], + 'calendar' => [ + 'sameDay' => '[ယနေ.] LT [မှာ]', + 'nextDay' => '[မနက်ဖြန်] LT [မှာ]', + 'nextWeek' => 'dddd LT [မှာ]', + 'lastDay' => '[မနေ.က] LT [မှာ]', + 'lastWeek' => '[ပြီးခဲ့သော] dddd LT [မှာ]', + 'sameElse' => 'L', + ], + 'months' => ['ဇန်နဝါရီ', 'ဖေဖော်ဝါရီ', 'မတ်', 'ဧပြီ', 'မေ', 'ဇွန်', 'ဇူလိုင်', 'သြဂုတ်', 'စက်တင်ဘာ', 'အောက်တိုဘာ', 'နိုဝင်ဘာ', 'ဒီဇင်ဘာ'], + 'months_short' => ['ဇန်', 'ဖေ', 'မတ်', 'ပြီ', 'မေ', 'ဇွန်', 'လိုင်', 'သြ', 'စက်', 'အောက်', 'နို', 'ဒီ'], + 'weekdays' => ['တနင်္ဂနွေ', 'တနင်္လာ', 'အင်္ဂါ', 'ဗုဒ္ဓဟူး', 'ကြာသပတေး', 'သောကြာ', 'စနေ'], + 'weekdays_short' => ['နွေ', 'လာ', 'ဂါ', 'ဟူး', 'ကြာ', 'သော', 'နေ'], + 'weekdays_min' => ['နွေ', 'လာ', 'ဂါ', 'ဟူး', 'ကြာ', 'သော', 'နေ'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'alt_numbers' => ['၀၀', '၀၁', '၀၂', '၀၃', '၀၄', '၀၅', '၀၆', '၀၇', '၀၈', '၀၉', '၁၀', '၁၁', '၁၂', '၁၃', '၁၄', '၁၅', '၁၆', '၁၇', '၁၈', '၁၉', '၂၀', '၂၁', '၂၂', '၂၃', '၂၄', '၂၅', '၂၆', '၂၇', '၂၈', '၂၉', '၃၀', '၃၁', '၃၂', '၃၃', '၃၄', '၃၅', '၃၆', '၃၇', '၃၈', '၃၉', '၄၀', '၄၁', '၄၂', '၄၃', '၄၄', '၄၅', '၄၆', '၄၇', '၄၈', '၄၉', '၅၀', '၅၁', '၅၂', '၅၃', '၅၄', '၅၅', '၅၆', '၅၇', '၅၈', '၅၉', '၆၀', '၆၁', '၆၂', '၆၃', '၆၄', '၆၅', '၆၆', '၆၇', '၆၈', '၆၉', '၇၀', '၇၁', '၇၂', '၇၃', '၇၄', '၇၅', '၇၆', '၇၇', '၇၈', '၇၉', '၈၀', '၈၁', '၈၂', '၈၃', '၈၄', '၈၅', '၈၆', '၈၇', '၈၈', '၈၉', '၉၀', '၉၁', '၉၂', '၉၃', '၉၄', '၉၅', '၉၆', '၉၇', '၉၈', '၉၉'], + 'meridiem' => ['နံနက်', 'ညနေ'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/my_MM.php b/vendor/nesbot/carbon/src/Carbon/Lang/my_MM.php new file mode 100644 index 00000000..a0108dd4 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/my_MM.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/my.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mzn.php b/vendor/nesbot/carbon/src/Carbon/Lang/mzn.php new file mode 100644 index 00000000..70f5f23c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mzn.php @@ -0,0 +1,25 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/fa.php', [ + 'months' => ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'], + 'months_short' => ['ژانویه', 'فوریه', 'مارس', 'آوریل', 'مه', 'ژوئن', 'ژوئیه', 'اوت', 'سپتامبر', 'اکتبر', 'نوامبر', 'دسامبر'], + 'first_day_of_week' => 6, + 'weekend' => [5, 5], + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY-MM-dd', + 'LL' => 'YYYY MMM D', + 'LLL' => 'YYYY MMMM D HH:mm', + 'LLLL' => 'YYYY MMMM D, dddd HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nan.php b/vendor/nesbot/carbon/src/Carbon/Lang/nan.php new file mode 100644 index 00000000..0affece8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nan.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/nan_TW.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nan_TW.php b/vendor/nesbot/carbon/src/Carbon/Lang/nan_TW.php new file mode 100644 index 00000000..5c50aa48 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nan_TW.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'YYYY年MM月DD日', + ], + 'months' => ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], + 'months_short' => [' 1月', ' 2月', ' 3月', ' 4月', ' 5月', ' 6月', ' 7月', ' 8月', ' 9月', '10月', '11月', '12月'], + 'weekdays' => ['禮拜日', '禮拜一', '禮拜二', '禮拜三', '禮拜四', '禮拜五', '禮拜六'], + 'weekdays_short' => ['日', '一', '二', '三', '四', '五', '六'], + 'weekdays_min' => ['日', '一', '二', '三', '四', '五', '六'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['頂晡', '下晡'], + + 'year' => ':count 年', + 'y' => ':count 年', + 'a_year' => ':count 年', + + 'month' => ':count goe̍h', + 'm' => ':count goe̍h', + 'a_month' => ':count goe̍h', + + 'week' => ':count lé-pài', + 'w' => ':count lé-pài', + 'a_week' => ':count lé-pài', + + 'day' => ':count 日', + 'd' => ':count 日', + 'a_day' => ':count 日', + + 'hour' => ':count tiám-cheng', + 'h' => ':count tiám-cheng', + 'a_hour' => ':count tiám-cheng', + + 'minute' => ':count Hun-cheng', + 'min' => ':count Hun-cheng', + 'a_minute' => ':count Hun-cheng', + + 'second' => ':count Bió', + 's' => ':count Bió', + 'a_second' => ':count Bió', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nan_TW@latin.php b/vendor/nesbot/carbon/src/Carbon/Lang/nan_TW@latin.php new file mode 100644 index 00000000..99ca2a42 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nan_TW@latin.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Arne Goetje arne@canonical.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'YYYY-MM-DD', + ], + 'months' => ['1goe̍h', '2goe̍h', '3goe̍h', '4goe̍h', '5goe̍h', '6goe̍h', '7goe̍h', '8goe̍h', '9goe̍h', '10goe̍h', '11goe̍h', '12goe̍h'], + 'months_short' => ['1g', '2g', '3g', '4g', '5g', '6g', '7g', '8g', '9g', '10g', '11g', '12g'], + 'weekdays' => ['lé-pài-ji̍t', 'pài-it', 'pài-jī', 'pài-saⁿ', 'pài-sì', 'pài-gō͘', 'pài-la̍k'], + 'weekdays_short' => ['lp', 'p1', 'p2', 'p3', 'p4', 'p5', 'p6'], + 'weekdays_min' => ['lp', 'p1', 'p2', 'p3', 'p4', 'p5', 'p6'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['téng-po͘', 'ē-po͘'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/naq.php b/vendor/nesbot/carbon/src/Carbon/Lang/naq.php new file mode 100644 index 00000000..fbd9be91 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/naq.php @@ -0,0 +1,52 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['ǁgoagas', 'ǃuias'], + 'weekdays' => ['Sontaxtsees', 'Mantaxtsees', 'Denstaxtsees', 'Wunstaxtsees', 'Dondertaxtsees', 'Fraitaxtsees', 'Satertaxtsees'], + 'weekdays_short' => ['Son', 'Ma', 'De', 'Wu', 'Do', 'Fr', 'Sat'], + 'weekdays_min' => ['Son', 'Ma', 'De', 'Wu', 'Do', 'Fr', 'Sat'], + 'months' => ['ǃKhanni', 'ǃKhanǀgôab', 'ǀKhuuǁkhâb', 'ǃHôaǂkhaib', 'ǃKhaitsâb', 'Gamaǀaeb', 'ǂKhoesaob', 'Aoǁkhuumûǁkhâb', 'Taraǀkhuumûǁkhâb', 'ǂNûǁnâiseb', 'ǀHooǂgaeb', 'Hôasoreǁkhâb'], + 'months_short' => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'h:mm a', + 'LTS' => 'h:mm:ss a', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY h:mm a', + 'LLLL' => 'dddd, D MMMM YYYY h:mm a', + ], + + 'year' => ':count kurigu', + 'y' => ':count kurigu', + 'a_year' => ':count kurigu', + + 'month' => ':count ǁaub', // less reliable + 'm' => ':count ǁaub', // less reliable + 'a_month' => ':count ǁaub', // less reliable + + 'week' => ':count hû', // less reliable + 'w' => ':count hû', // less reliable + 'a_week' => ':count hû', // less reliable + + 'day' => ':count ǀhobas', // less reliable + 'd' => ':count ǀhobas', // less reliable + 'a_day' => ':count ǀhobas', // less reliable + + 'hour' => ':count ǂgaes', // less reliable + 'h' => ':count ǂgaes', // less reliable + 'a_hour' => ':count ǂgaes', // less reliable + + 'minute' => ':count minutga', // less reliable + 'min' => ':count minutga', // less reliable + 'a_minute' => ':count minutga', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nb.php b/vendor/nesbot/carbon/src/Carbon/Lang/nb.php new file mode 100644 index 00000000..371ee840 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nb.php @@ -0,0 +1,84 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - François B + * - Alexander Tømmerås + * - Sigurd Gartmann + * - JD Isaacks + */ +return [ + 'year' => ':count år|:count år', + 'a_year' => 'ett år|:count år', + 'y' => ':count år|:count år', + 'month' => ':count måned|:count måneder', + 'a_month' => 'en måned|:count måneder', + 'm' => ':count md.', + 'week' => ':count uke|:count uker', + 'a_week' => 'en uke|:count uker', + 'w' => ':count u.', + 'day' => ':count dag|:count dager', + 'a_day' => 'en dag|:count dager', + 'd' => ':count d.', + 'hour' => ':count time|:count timer', + 'a_hour' => 'en time|:count timer', + 'h' => ':count t', + 'minute' => ':count minutt|:count minutter', + 'a_minute' => 'ett minutt|:count minutter', + 'min' => ':count min', + 'second' => ':count sekund|:count sekunder', + 'a_second' => 'noen sekunder|:count sekunder', + 's' => ':count sek', + 'ago' => ':time siden', + 'from_now' => 'om :time', + 'after' => ':time etter', + 'before' => ':time før', + 'diff_now' => 'akkurat nå', + 'diff_today' => 'i dag', + 'diff_today_regexp' => 'i dag(?:\\s+kl.)?', + 'diff_yesterday' => 'i går', + 'diff_yesterday_regexp' => 'i går(?:\\s+kl.)?', + 'diff_tomorrow' => 'i morgen', + 'diff_tomorrow_regexp' => 'i morgen(?:\\s+kl.)?', + 'diff_before_yesterday' => 'i forgårs', + 'diff_after_tomorrow' => 'i overmorgen', + 'period_recurrences' => 'en gang|:count ganger', + 'period_interval' => 'hver :interval', + 'period_start_date' => 'fra :date', + 'period_end_date' => 'til :date', + 'months' => ['januar', 'februar', 'mars', 'april', 'mai', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'desember'], + 'months_short' => ['jan', 'feb', 'mar', 'apr', 'mai', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'des'], + 'weekdays' => ['søndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'lørdag'], + 'weekdays_short' => ['søn', 'man', 'tir', 'ons', 'tor', 'fre', 'lør'], + 'weekdays_min' => ['sø', 'ma', 'ti', 'on', 'to', 'fr', 'lø'], + 'ordinal' => ':number.', + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D. MMMM YYYY', + 'LLL' => 'D. MMMM YYYY [kl.] HH:mm', + 'LLLL' => 'dddd D. MMMM YYYY [kl.] HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[i dag kl.] LT', + 'nextDay' => '[i morgen kl.] LT', + 'nextWeek' => 'dddd [kl.] LT', + 'lastDay' => '[i går kl.] LT', + 'lastWeek' => '[forrige] dddd [kl.] LT', + 'sameElse' => 'L', + ], + 'list' => [', ', ' og '], + 'meridiem' => ['a.m.', 'p.m.'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nb_NO.php b/vendor/nesbot/carbon/src/Carbon/Lang/nb_NO.php new file mode 100644 index 00000000..31678c53 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nb_NO.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/nb.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nb_SJ.php b/vendor/nesbot/carbon/src/Carbon/Lang/nb_SJ.php new file mode 100644 index 00000000..ce0210bc --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nb_SJ.php @@ -0,0 +1,18 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/nb.php', [ + 'formats' => [ + 'LL' => 'D. MMM YYYY', + 'LLL' => 'D. MMMM YYYY, HH:mm', + 'LLLL' => 'dddd D. MMMM YYYY, HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nd.php b/vendor/nesbot/carbon/src/Carbon/Lang/nd.php new file mode 100644 index 00000000..f75d9a71 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nd.php @@ -0,0 +1,54 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'weekdays' => ['Sonto', 'Mvulo', 'Sibili', 'Sithathu', 'Sine', 'Sihlanu', 'Mgqibelo'], + 'weekdays_short' => ['Son', 'Mvu', 'Sib', 'Sit', 'Sin', 'Sih', 'Mgq'], + 'weekdays_min' => ['Son', 'Mvu', 'Sib', 'Sit', 'Sin', 'Sih', 'Mgq'], + 'months' => ['Zibandlela', 'Nhlolanja', 'Mbimbitho', 'Mabasa', 'Nkwenkwezi', 'Nhlangula', 'Ntulikazi', 'Ncwabakazi', 'Mpandula', 'Mfumfu', 'Lwezi', 'Mpalakazi'], + 'months_short' => ['Zib', 'Nhlo', 'Mbi', 'Mab', 'Nkw', 'Nhla', 'Ntu', 'Ncw', 'Mpan', 'Mfu', 'Lwe', 'Mpal'], + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + + 'year' => 'okweminyaka engu-:count', // less reliable + 'y' => 'okweminyaka engu-:count', // less reliable + 'a_year' => 'okweminyaka engu-:count', // less reliable + + 'month' => 'inyanga ezingu-:count', + 'm' => 'inyanga ezingu-:count', + 'a_month' => 'inyanga ezingu-:count', + + 'week' => 'amaviki angu-:count', + 'w' => 'amaviki angu-:count', + 'a_week' => 'amaviki angu-:count', + + 'day' => 'kwamalanga angu-:count', + 'd' => 'kwamalanga angu-:count', + 'a_day' => 'kwamalanga angu-:count', + + 'hour' => 'amahola angu-:count', + 'h' => 'amahola angu-:count', + 'a_hour' => 'amahola angu-:count', + + 'minute' => 'imizuzu engu-:count', + 'min' => 'imizuzu engu-:count', + 'a_minute' => 'imizuzu engu-:count', + + 'second' => 'imizuzwana engu-:count', + 's' => 'imizuzwana engu-:count', + 'a_second' => 'imizuzwana engu-:count', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nds.php b/vendor/nesbot/carbon/src/Carbon/Lang/nds.php new file mode 100644 index 00000000..c0b3775e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nds.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/nds_DE.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nds_DE.php b/vendor/nesbot/carbon/src/Carbon/Lang/nds_DE.php new file mode 100644 index 00000000..a6c57a91 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nds_DE.php @@ -0,0 +1,60 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - information from Kenneth Christiansen Kenneth Christiansen, Pablo Saratxaga kenneth@gnu.org, pablo@mandrakesoft.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD.MM.YYYY', + ], + 'months' => ['Jannuaar', 'Feberwaar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], + 'months_short' => ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'], + 'weekdays' => ['Sünndag', 'Maandag', 'Dingsdag', 'Middeweek', 'Dunnersdag', 'Freedag', 'Sünnavend'], + 'weekdays_short' => ['Sdag', 'Maan', 'Ding', 'Midd', 'Dunn', 'Free', 'Svd.'], + 'weekdays_min' => ['Sd', 'Ma', 'Di', 'Mi', 'Du', 'Fr', 'Sa'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + + 'year' => ':count Johr', + 'y' => ':countJ', + 'a_year' => '{1}een Johr|:count Johr', + + 'month' => ':count Maand', + 'm' => ':countM', + 'a_month' => '{1}een Maand|:count Maand', + + 'week' => ':count Week|:count Weken', + 'w' => ':countW', + 'a_week' => '{1}een Week|:count Week|:count Weken', + + 'day' => ':count Dag|:count Daag', + 'd' => ':countD', + 'a_day' => '{1}een Dag|:count Dag|:count Daag', + + 'hour' => ':count Stünn|:count Stünnen', + 'h' => ':countSt', + 'a_hour' => '{1}een Stünn|:count Stünn|:count Stünnen', + + 'minute' => ':count Minuut|:count Minuten', + 'min' => ':countm', + 'a_minute' => '{1}een Minuut|:count Minuut|:count Minuten', + + 'second' => ':count Sekunn|:count Sekunnen', + 's' => ':counts', + 'a_second' => 'en poor Sekunnen|:count Sekunn|:count Sekunnen', + + 'ago' => 'vör :time', + 'from_now' => 'in :time', + 'before' => ':time vörher', + 'after' => ':time later', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nds_NL.php b/vendor/nesbot/carbon/src/Carbon/Lang/nds_NL.php new file mode 100644 index 00000000..de2c57bc --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nds_NL.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - information from Kenneth Christiansen Kenneth Christiansen, Pablo Saratxaga kenneth@gnu.org, pablo@mandrakesoft.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD.MM.YYYY', + ], + 'months' => ['Jaunuwoa', 'Februwoa', 'Moaz', 'Aprell', 'Mai', 'Juni', 'Juli', 'August', 'Septamba', 'Oktoba', 'Nowamba', 'Dezamba'], + 'months_short' => ['Jan', 'Feb', 'Moz', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Now', 'Dez'], + 'weekdays' => ['Sinndag', 'Mondag', 'Dingsdag', 'Meddwäakj', 'Donnadag', 'Friedag', 'Sinnowend'], + 'weekdays_short' => ['Sdg', 'Mdg', 'Dsg', 'Mwk', 'Ddg', 'Fdg', 'Swd'], + 'weekdays_min' => ['Sdg', 'Mdg', 'Dsg', 'Mwk', 'Ddg', 'Fdg', 'Swd'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ne.php b/vendor/nesbot/carbon/src/Carbon/Lang/ne.php new file mode 100644 index 00000000..d4caf0e2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ne.php @@ -0,0 +1,82 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - nootanghimire + * - Josh Soref + * - Nj Subedi + * - JD Isaacks + */ +return [ + 'year' => 'एक बर्ष|:count बर्ष', + 'y' => ':count वर्ष', + 'month' => 'एक महिना|:count महिना', + 'm' => ':count महिना', + 'week' => ':count हप्ता', + 'w' => ':count हप्ता', + 'day' => 'एक दिन|:count दिन', + 'd' => ':count दिन', + 'hour' => 'एक घण्टा|:count घण्टा', + 'h' => ':count घण्टा', + 'minute' => 'एक मिनेट|:count मिनेट', + 'min' => ':count मिनेट', + 'second' => 'केही क्षण|:count सेकेण्ड', + 's' => ':count सेकेण्ड', + 'ago' => ':time अगाडि', + 'from_now' => ':timeमा', + 'after' => ':time पछि', + 'before' => ':time अघि', + 'diff_now' => 'अहिले', + 'diff_today' => 'आज', + 'diff_yesterday' => 'हिजो', + 'diff_tomorrow' => 'भोलि', + 'formats' => [ + 'LT' => 'Aको h:mm बजे', + 'LTS' => 'Aको h:mm:ss बजे', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY, Aको h:mm बजे', + 'LLLL' => 'dddd, D MMMM YYYY, Aको h:mm बजे', + ], + 'calendar' => [ + 'sameDay' => '[आज] LT', + 'nextDay' => '[भोलि] LT', + 'nextWeek' => '[आउँदो] dddd[,] LT', + 'lastDay' => '[हिजो] LT', + 'lastWeek' => '[गएको] dddd[,] LT', + 'sameElse' => 'L', + ], + 'meridiem' => function ($hour) { + if ($hour < 3) { + return 'राति'; + } + if ($hour < 12) { + return 'बिहान'; + } + if ($hour < 16) { + return 'दिउँसो'; + } + if ($hour < 20) { + return 'साँझ'; + } + + return 'राति'; + }, + 'months' => ['जनवरी', 'फेब्रुवरी', 'मार्च', 'अप्रिल', 'मई', 'जुन', 'जुलाई', 'अगष्ट', 'सेप्टेम्बर', 'अक्टोबर', 'नोभेम्बर', 'डिसेम्बर'], + 'months_short' => ['जन.', 'फेब्रु.', 'मार्च', 'अप्रि.', 'मई', 'जुन', 'जुलाई.', 'अग.', 'सेप्ट.', 'अक्टो.', 'नोभे.', 'डिसे.'], + 'weekdays' => ['आइतबार', 'सोमबार', 'मङ्गलबार', 'बुधबार', 'बिहिबार', 'शुक्रबार', 'शनिबार'], + 'weekdays_short' => ['आइत.', 'सोम.', 'मङ्गल.', 'बुध.', 'बिहि.', 'शुक्र.', 'शनि.'], + 'weekdays_min' => ['आ.', 'सो.', 'मं.', 'बु.', 'बि.', 'शु.', 'श.'], + 'list' => [', ', ' र '], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ne_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/ne_IN.php new file mode 100644 index 00000000..f68d00e3 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ne_IN.php @@ -0,0 +1,25 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ne.php', [ + 'formats' => [ + 'LT' => 'h:mm a', + 'LTS' => 'h:mm:ss a', + 'L' => 'yy/M/d', + 'LL' => 'YYYY MMM D', + 'LLL' => 'YYYY MMMM D, h:mm a', + 'LLLL' => 'YYYY MMMM D, dddd, h:mm a', + ], + 'months' => ['जनवरी', 'फेब्रुअरी', 'मार्च', 'अप्रिल', 'मे', 'जुन', 'जुलाई', 'अगस्ट', 'सेप्टेम्बर', 'अक्टोबर', 'नोभेम्बर', 'डिसेम्बर'], + 'months_short' => ['जनवरी', 'फेब्रुअरी', 'मार्च', 'अप्रिल', 'मे', 'जुन', 'जुलाई', 'अगस्ट', 'सेप्टेम्बर', 'अक्टोबर', 'नोभेम्बर', 'डिसेम्बर'], + 'weekend' => [0, 0], + 'meridiem' => ['पूर्वाह्न', 'अपराह्न'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ne_NP.php b/vendor/nesbot/carbon/src/Carbon/Lang/ne_NP.php new file mode 100644 index 00000000..27840c0f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ne_NP.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/ne.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nhn.php b/vendor/nesbot/carbon/src/Carbon/Lang/nhn.php new file mode 100644 index 00000000..5a858315 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nhn.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/nhn_MX.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nhn_MX.php b/vendor/nesbot/carbon/src/Carbon/Lang/nhn_MX.php new file mode 100644 index 00000000..9db88a12 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nhn_MX.php @@ -0,0 +1,50 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP libc-alpha@sourceware.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YY', + ], + 'months' => ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'], + 'months_short' => ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sep', 'oct', 'nov', 'dic'], + 'weekdays' => ['teoilhuitl', 'ceilhuitl', 'omeilhuitl', 'yeilhuitl', 'nahuilhuitl', 'macuililhuitl', 'chicuaceilhuitl'], + 'weekdays_short' => ['teo', 'cei', 'ome', 'yei', 'nau', 'mac', 'chi'], + 'weekdays_min' => ['teo', 'cei', 'ome', 'yei', 'nau', 'mac', 'chi'], + 'day_of_first_week_of_year' => 1, + + 'month' => ':count metztli', // less reliable + 'm' => ':count metztli', // less reliable + 'a_month' => ':count metztli', // less reliable + + 'week' => ':count tonalli', // less reliable + 'w' => ':count tonalli', // less reliable + 'a_week' => ':count tonalli', // less reliable + + 'day' => ':count tonatih', // less reliable + 'd' => ':count tonatih', // less reliable + 'a_day' => ':count tonatih', // less reliable + + 'minute' => ':count toltecayotl', // less reliable + 'min' => ':count toltecayotl', // less reliable + 'a_minute' => ':count toltecayotl', // less reliable + + 'second' => ':count ome', // less reliable + 's' => ':count ome', // less reliable + 'a_second' => ':count ome', // less reliable + + 'year' => ':count xihuitl', + 'y' => ':count xihuitl', + 'a_year' => ':count xihuitl', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/niu.php b/vendor/nesbot/carbon/src/Carbon/Lang/niu.php new file mode 100644 index 00000000..bd9be8aa --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/niu.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/niu_NU.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/niu_NU.php b/vendor/nesbot/carbon/src/Carbon/Lang/niu_NU.php new file mode 100644 index 00000000..6e7a697b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/niu_NU.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RockET Systems Emani Fakaotimanava-Lui emani@niue.nu + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YY', + ], + 'months' => ['Ianuali', 'Fepuali', 'Masi', 'Apelila', 'Me', 'Iuni', 'Iulai', 'Aokuso', 'Sepetema', 'Oketopa', 'Novema', 'Tesemo'], + 'months_short' => ['Ian', 'Fep', 'Mas', 'Ape', 'Me', 'Iun', 'Iul', 'Aok', 'Sep', 'Oke', 'Nov', 'Tes'], + 'weekdays' => ['Aho Tapu', 'Aho Gofua', 'Aho Ua', 'Aho Lotu', 'Aho Tuloto', 'Aho Falaile', 'Aho Faiumu'], + 'weekdays_short' => ['Tapu', 'Gofua', 'Ua', 'Lotu', 'Tuloto', 'Falaile', 'Faiumu'], + 'weekdays_min' => ['Tapu', 'Gofua', 'Ua', 'Lotu', 'Tuloto', 'Falaile', 'Faiumu'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + + 'year' => ':count tau', + 'y' => ':count tau', + 'a_year' => ':count tau', + + 'month' => ':count mahina', + 'm' => ':count mahina', + 'a_month' => ':count mahina', + + 'week' => ':count faahi tapu', + 'w' => ':count faahi tapu', + 'a_week' => ':count faahi tapu', + + 'day' => ':count aho', + 'd' => ':count aho', + 'a_day' => ':count aho', + + 'hour' => ':count e tulā', + 'h' => ':count e tulā', + 'a_hour' => ':count e tulā', + + 'minute' => ':count minuti', + 'min' => ':count minuti', + 'a_minute' => ':count minuti', + + 'second' => ':count sekone', + 's' => ':count sekone', + 'a_second' => ':count sekone', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nl.php b/vendor/nesbot/carbon/src/Carbon/Lang/nl.php new file mode 100644 index 00000000..2d737703 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nl.php @@ -0,0 +1,113 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Roy + * - Stephan + * - François B + * - Tim Fish + * - Kevin Huang + * - Jacob Middag + * - JD Isaacks + * - Roy + * - Stephan + * - François B + * - Tim Fish + * - Jacob Middag + * - JD Isaacks + * - Propaganistas + * - MegaXLR + * - adriaanzon + * - MonkeyPhysics + * - JeroenG + * - RikSomers + * - proclame + * - Rik de Groot (hwdegroot) + */ +return [ + 'year' => ':count jaar|:count jaar', + 'a_year' => 'een jaar|:count jaar', + 'y' => ':countj', + 'month' => ':count maand|:count maanden', + 'a_month' => 'een maand|:count maanden', + 'm' => ':countmnd', + 'week' => ':count week|:count weken', + 'a_week' => 'een week|:count weken', + 'w' => ':countw', + 'day' => ':count dag|:count dagen', + 'a_day' => 'een dag|:count dagen', + 'd' => ':countd', + 'hour' => ':count uur|:count uur', + 'a_hour' => 'een uur|:count uur', + 'h' => ':countu', + 'minute' => ':count minuut|:count minuten', + 'a_minute' => 'een minuut|:count minuten', + 'min' => ':countmin', + 'second' => ':count seconde|:count seconden', + 'a_second' => 'een paar seconden|:count seconden', + 's' => ':counts', + 'ago' => ':time geleden', + 'from_now' => 'over :time', + 'after' => ':time later', + 'before' => ':time eerder', + 'diff_now' => 'nu', + 'diff_today' => 'vandaag', + 'diff_today_regexp' => 'vandaag(?:\\s+om)?', + 'diff_yesterday' => 'gisteren', + 'diff_yesterday_regexp' => 'gisteren(?:\\s+om)?', + 'diff_tomorrow' => 'morgen', + 'diff_tomorrow_regexp' => 'morgen(?:\\s+om)?', + 'diff_after_tomorrow' => 'overmorgen', + 'diff_before_yesterday' => 'eergisteren', + 'period_recurrences' => ':count keer', + 'period_interval' => function (string $interval = '') { + /** @var string $output */ + $output = preg_replace('/^(een|één|1)\s+/u', '', $interval); + + if (preg_match('/^(een|één|1)( jaar|j| uur|u)/u', $interval)) { + return "elk $output"; + } + + return "elke $output"; + }, + 'period_start_date' => 'van :date', + 'period_end_date' => 'tot :date', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD-MM-YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[vandaag om] LT', + 'nextDay' => '[morgen om] LT', + 'nextWeek' => 'dddd [om] LT', + 'lastDay' => '[gisteren om] LT', + 'lastWeek' => '[afgelopen] dddd [om] LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + return $number.(($number === 1 || $number === 8 || $number >= 20) ? 'ste' : 'de'); + }, + 'months' => ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'], + 'months_short' => ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'], + 'mmm_suffix' => '.', + 'weekdays' => ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'], + 'weekdays_short' => ['zo.', 'ma.', 'di.', 'wo.', 'do.', 'vr.', 'za.'], + 'weekdays_min' => ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' en '], + 'meridiem' => ['\'s ochtends', '\'s middags'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nl_AW.php b/vendor/nesbot/carbon/src/Carbon/Lang/nl_AW.php new file mode 100644 index 00000000..5ec136d1 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nl_AW.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Free Software Foundation, Inc. bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/nl.php', [ + 'formats' => [ + 'L' => 'DD-MM-YY', + ], + 'months' => ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'], + 'months_short' => ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'], + 'weekdays' => ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'], + 'weekdays_short' => ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'], + 'weekdays_min' => ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nl_BE.php b/vendor/nesbot/carbon/src/Carbon/Lang/nl_BE.php new file mode 100644 index 00000000..037f5b4a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nl_BE.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Roy + * - Stephan + * - François B + * - Tim Fish + * - Kevin Huang + * - Jacob Middag + * - JD Isaacks + * - Propaganistas + */ +return array_replace_recursive(require __DIR__.'/nl.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nl_BQ.php b/vendor/nesbot/carbon/src/Carbon/Lang/nl_BQ.php new file mode 100644 index 00000000..c269197b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nl_BQ.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/nl.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nl_CW.php b/vendor/nesbot/carbon/src/Carbon/Lang/nl_CW.php new file mode 100644 index 00000000..c269197b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nl_CW.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/nl.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nl_NL.php b/vendor/nesbot/carbon/src/Carbon/Lang/nl_NL.php new file mode 100644 index 00000000..14e4853e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nl_NL.php @@ -0,0 +1,24 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/nl.php', [ + 'months' => ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'], + 'months_short' => ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'], + 'weekdays' => ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'], + 'weekdays_short' => ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'], + 'weekdays_min' => ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nl_SR.php b/vendor/nesbot/carbon/src/Carbon/Lang/nl_SR.php new file mode 100644 index 00000000..c269197b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nl_SR.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/nl.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nl_SX.php b/vendor/nesbot/carbon/src/Carbon/Lang/nl_SX.php new file mode 100644 index 00000000..c269197b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nl_SX.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/nl.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nmg.php b/vendor/nesbot/carbon/src/Carbon/Lang/nmg.php new file mode 100644 index 00000000..4d1df6e5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nmg.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['maná', 'kugú'], + 'weekdays' => ['sɔ́ndɔ', 'mɔ́ndɔ', 'sɔ́ndɔ mafú mába', 'sɔ́ndɔ mafú málal', 'sɔ́ndɔ mafú mána', 'mabágá má sukul', 'sásadi'], + 'weekdays_short' => ['sɔ́n', 'mɔ́n', 'smb', 'sml', 'smn', 'mbs', 'sas'], + 'weekdays_min' => ['sɔ́n', 'mɔ́n', 'smb', 'sml', 'smn', 'mbs', 'sas'], + 'months' => ['ngwɛn matáhra', 'ngwɛn ńmba', 'ngwɛn ńlal', 'ngwɛn ńna', 'ngwɛn ńtan', 'ngwɛn ńtuó', 'ngwɛn hɛmbuɛrí', 'ngwɛn lɔmbi', 'ngwɛn rɛbvuâ', 'ngwɛn wum', 'ngwɛn wum navǔr', 'krísimin'], + 'months_short' => ['ng1', 'ng2', 'ng3', 'ng4', 'ng5', 'ng6', 'ng7', 'ng8', 'ng9', 'ng10', 'ng11', 'kris'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nn.php b/vendor/nesbot/carbon/src/Carbon/Lang/nn.php new file mode 100644 index 00000000..041f7b29 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nn.php @@ -0,0 +1,78 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - François B + * - Alexander Tømmerås + * - Øystein + * - JD Isaacks + * - Gaute Hvoslef Kvalnes (gaute) + */ +return [ + 'year' => ':count år', + 'a_year' => 'eit år|:count år', + 'y' => ':count år', + 'month' => ':count månad|:count månader', + 'a_month' => 'ein månad|:count månader', + 'm' => ':count md', + 'week' => ':count veke|:count veker', + 'a_week' => 'ei veke|:count veker', + 'w' => ':countv', + 'day' => ':count dag|:count dagar', + 'a_day' => 'ein dag|:count dagar', + 'd' => ':countd', + 'hour' => ':count time|:count timar', + 'a_hour' => 'ein time|:count timar', + 'h' => ':countt', + 'minute' => ':count minutt', + 'a_minute' => 'eit minutt|:count minutt', + 'min' => ':countm', + 'second' => ':count sekund', + 'a_second' => 'nokre sekund|:count sekund', + 's' => ':counts', + 'ago' => ':time sidan', + 'from_now' => 'om :time', + 'after' => ':time etter', + 'before' => ':time før', + 'diff_today' => 'I dag', + 'diff_yesterday' => 'I går', + 'diff_yesterday_regexp' => 'I går(?:\\s+klokka)?', + 'diff_tomorrow' => 'I morgon', + 'diff_tomorrow_regexp' => 'I morgon(?:\\s+klokka)?', + 'diff_today_regexp' => 'I dag(?:\\s+klokka)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D. MMMM YYYY', + 'LLL' => 'D. MMMM YYYY [kl.] H:mm', + 'LLLL' => 'dddd D. MMMM YYYY [kl.] HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[I dag klokka] LT', + 'nextDay' => '[I morgon klokka] LT', + 'nextWeek' => 'dddd [klokka] LT', + 'lastDay' => '[I går klokka] LT', + 'lastWeek' => '[Føregåande] dddd [klokka] LT', + 'sameElse' => 'L', + ], + 'ordinal' => ':number.', + 'months' => ['januar', 'februar', 'mars', 'april', 'mai', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'desember'], + 'months_short' => ['jan', 'feb', 'mar', 'apr', 'mai', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'des'], + 'weekdays' => ['sundag', 'måndag', 'tysdag', 'onsdag', 'torsdag', 'fredag', 'laurdag'], + 'weekdays_short' => ['sun', 'mån', 'tys', 'ons', 'tor', 'fre', 'lau'], + 'weekdays_min' => ['su', 'må', 'ty', 'on', 'to', 'fr', 'la'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' og '], + 'meridiem' => ['f.m.', 'e.m.'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nn_NO.php b/vendor/nesbot/carbon/src/Carbon/Lang/nn_NO.php new file mode 100644 index 00000000..8e168711 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nn_NO.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/nn.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nnh.php b/vendor/nesbot/carbon/src/Carbon/Lang/nnh.php new file mode 100644 index 00000000..007d2399 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nnh.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['mbaʼámbaʼ', 'ncwònzém'], + 'weekdays' => null, + 'weekdays_short' => ['lyɛʼɛ́ sẅíŋtè', 'mvfò lyɛ̌ʼ', 'mbɔ́ɔntè mvfò lyɛ̌ʼ', 'tsètsɛ̀ɛ lyɛ̌ʼ', 'mbɔ́ɔntè tsetsɛ̀ɛ lyɛ̌ʼ', 'mvfò màga lyɛ̌ʼ', 'màga lyɛ̌ʼ'], + 'weekdays_min' => null, + 'months' => null, + 'months_short' => ['saŋ tsetsɛ̀ɛ lùm', 'saŋ kàg ngwóŋ', 'saŋ lepyè shúm', 'saŋ cÿó', 'saŋ tsɛ̀ɛ cÿó', 'saŋ njÿoláʼ', 'saŋ tyɛ̀b tyɛ̀b mbʉ̀ŋ', 'saŋ mbʉ̀ŋ', 'saŋ ngwɔ̀ʼ mbÿɛ', 'saŋ tàŋa tsetsáʼ', 'saŋ mejwoŋó', 'saŋ lùm'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/yy', + 'LL' => 'D MMM, YYYY', + 'LLL' => '[lyɛ]̌ʼ d [na] MMMM, YYYY HH:mm', + 'LLLL' => 'dddd , [lyɛ]̌ʼ d [na] MMMM, YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/no.php b/vendor/nesbot/carbon/src/Carbon/Lang/no.php new file mode 100644 index 00000000..f4497c75 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/no.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Daniel S. Billing + * - Paul + * - Jimmie Johansson + * - Jens Herlevsen + */ +return array_replace_recursive(require __DIR__.'/nb.php', [ + 'formats' => [ + 'LLL' => 'D. MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D. MMMM YYYY [kl.] HH:mm', + ], + 'calendar' => [ + 'nextWeek' => 'på dddd [kl.] LT', + 'lastWeek' => '[i] dddd[s kl.] LT', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nr.php b/vendor/nesbot/carbon/src/Carbon/Lang/nr.php new file mode 100644 index 00000000..1bc999f9 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nr.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/nr_ZA.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nr_ZA.php b/vendor/nesbot/carbon/src/Carbon/Lang/nr_ZA.php new file mode 100644 index 00000000..f9a7be82 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nr_ZA.php @@ -0,0 +1,26 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Zuza Software Foundation (Translate.org.za) Dwayne Bailey dwayne@translate.org.za + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['Janabari', 'uFeberbari', 'uMatjhi', 'u-Apreli', 'Meyi', 'Juni', 'Julayi', 'Arhostosi', 'Septemba', 'Oktoba', 'Usinyikhaba', 'Disemba'], + 'months_short' => ['Jan', 'Feb', 'Mat', 'Apr', 'Mey', 'Jun', 'Jul', 'Arh', 'Sep', 'Okt', 'Usi', 'Dis'], + 'weekdays' => ['uSonto', 'uMvulo', 'uLesibili', 'lesithathu', 'uLesine', 'ngoLesihlanu', 'umGqibelo'], + 'weekdays_short' => ['Son', 'Mvu', 'Bil', 'Tha', 'Ne', 'Hla', 'Gqi'], + 'weekdays_min' => ['Son', 'Mvu', 'Bil', 'Tha', 'Ne', 'Hla', 'Gqi'], + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nso.php b/vendor/nesbot/carbon/src/Carbon/Lang/nso.php new file mode 100644 index 00000000..2a6cabbf --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nso.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/nso_ZA.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nso_ZA.php b/vendor/nesbot/carbon/src/Carbon/Lang/nso_ZA.php new file mode 100644 index 00000000..b08fe6dc --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nso_ZA.php @@ -0,0 +1,54 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Zuza Software Foundation (Translate.org.za) Dwayne Bailey dwayne@translate.org.za + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['Janaware', 'Febereware', 'Matšhe', 'Aprele', 'Mei', 'June', 'Julae', 'Agostose', 'Setemere', 'Oktobere', 'Nofemere', 'Disemere'], + 'months_short' => ['Jan', 'Feb', 'Mat', 'Apr', 'Mei', 'Jun', 'Jul', 'Ago', 'Set', 'Okt', 'Nof', 'Dis'], + 'weekdays' => ['LaMorena', 'Mošupologo', 'Labobedi', 'Laboraro', 'Labone', 'Labohlano', 'Mokibelo'], + 'weekdays_short' => ['Son', 'Moš', 'Bed', 'Rar', 'Ne', 'Hla', 'Mok'], + 'weekdays_min' => ['Son', 'Moš', 'Bed', 'Rar', 'Ne', 'Hla', 'Mok'], + 'day_of_first_week_of_year' => 1, + + 'year' => ':count ngwaga', + 'y' => ':count ngwaga', + 'a_year' => ':count ngwaga', + + 'month' => ':count Kgwedi', + 'm' => ':count Kgwedi', + 'a_month' => ':count Kgwedi', + + 'week' => ':count Beke', + 'w' => ':count Beke', + 'a_week' => ':count Beke', + + 'day' => ':count Letšatši', + 'd' => ':count Letšatši', + 'a_day' => ':count Letšatši', + + 'hour' => ':count Iri', + 'h' => ':count Iri', + 'a_hour' => ':count Iri', + + 'minute' => ':count Motsotso', + 'min' => ':count Motsotso', + 'a_minute' => ':count Motsotso', + + 'second' => ':count motsotswana', + 's' => ':count motsotswana', + 'a_second' => ':count motsotswana', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nus.php b/vendor/nesbot/carbon/src/Carbon/Lang/nus.php new file mode 100644 index 00000000..789bc391 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nus.php @@ -0,0 +1,36 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['RW', 'TŊ'], + 'weekdays' => ['Cäŋ kuɔth', 'Jiec la̱t', 'Rɛw lätni', 'Diɔ̱k lätni', 'Ŋuaan lätni', 'Dhieec lätni', 'Bäkɛl lätni'], + 'weekdays_short' => ['Cäŋ', 'Jiec', 'Rɛw', 'Diɔ̱k', 'Ŋuaan', 'Dhieec', 'Bäkɛl'], + 'weekdays_min' => ['Cäŋ', 'Jiec', 'Rɛw', 'Diɔ̱k', 'Ŋuaan', 'Dhieec', 'Bäkɛl'], + 'months' => ['Tiop thar pɛt', 'Pɛt', 'Duɔ̱ɔ̱ŋ', 'Guak', 'Duät', 'Kornyoot', 'Pay yie̱tni', 'Tho̱o̱r', 'Tɛɛr', 'Laath', 'Kur', 'Tio̱p in di̱i̱t'], + 'months_short' => ['Tiop', 'Pɛt', 'Duɔ̱ɔ̱', 'Guak', 'Duä', 'Kor', 'Pay', 'Thoo', 'Tɛɛ', 'Laa', 'Kur', 'Tid'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'h:mm a', + 'LTS' => 'h:mm:ss a', + 'L' => 'D/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY h:mm a', + 'LLLL' => 'dddd D MMMM YYYY h:mm a', + ], + + 'year' => ':count jiök', // less reliable + 'y' => ':count jiök', // less reliable + 'a_year' => ':count jiök', // less reliable + + 'month' => ':count pay', // less reliable + 'm' => ':count pay', // less reliable + 'a_month' => ':count pay', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nyn.php b/vendor/nesbot/carbon/src/Carbon/Lang/nyn.php new file mode 100644 index 00000000..8660ea42 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nyn.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'weekdays' => ['Sande', 'Orwokubanza', 'Orwakabiri', 'Orwakashatu', 'Orwakana', 'Orwakataano', 'Orwamukaaga'], + 'weekdays_short' => ['SAN', 'ORK', 'OKB', 'OKS', 'OKN', 'OKT', 'OMK'], + 'weekdays_min' => ['SAN', 'ORK', 'OKB', 'OKS', 'OKN', 'OKT', 'OMK'], + 'months' => ['Okwokubanza', 'Okwakabiri', 'Okwakashatu', 'Okwakana', 'Okwakataana', 'Okwamukaaga', 'Okwamushanju', 'Okwamunaana', 'Okwamwenda', 'Okwaikumi', 'Okwaikumi na kumwe', 'Okwaikumi na ibiri'], + 'months_short' => ['KBZ', 'KBR', 'KST', 'KKN', 'KTN', 'KMK', 'KMS', 'KMN', 'KMW', 'KKM', 'KNK', 'KNB'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/oc.php b/vendor/nesbot/carbon/src/Carbon/Lang/oc.php new file mode 100644 index 00000000..c9411d69 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/oc.php @@ -0,0 +1,100 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Quentí + */ +// @codeCoverageIgnoreStart +use Symfony\Component\Translation\PluralizationRules; + +if (class_exists('Symfony\\Component\\Translation\\PluralizationRules')) { + PluralizationRules::set(static function ($number) { + return $number == 1 ? 0 : 1; + }, 'oc'); +} +// @codeCoverageIgnoreEnd + +return [ + 'year' => ':count an|:count ans', + 'a_year' => 'un an|:count ans', + 'y' => ':count an|:count ans', + 'month' => ':count mes|:count meses', + 'a_month' => 'un mes|:count meses', + 'm' => ':count mes|:count meses', + 'week' => ':count setmana|:count setmanas', + 'a_week' => 'una setmana|:count setmanas', + 'w' => ':count setmana|:count setmanas', + 'day' => ':count jorn|:count jorns', + 'a_day' => 'un jorn|:count jorns', + 'd' => ':count jorn|:count jorns', + 'hour' => ':count ora|:count oras', + 'a_hour' => 'una ora|:count oras', + 'h' => ':count ora|:count oras', + 'minute' => ':count minuta|:count minutas', + 'a_minute' => 'una minuta|:count minutas', + 'min' => ':count minuta|:count minutas', + 'second' => ':count segonda|:count segondas', + 'a_second' => 'una segonda|:count segondas', + 's' => ':count segonda|:count segondas', + 'ago' => 'fa :time', + 'from_now' => 'd\'aquí :time', + 'after' => ':time aprèp', + 'before' => ':time abans', + 'diff_now' => 'ara meteis', + 'diff_today' => 'Uèi', + 'diff_today_regexp' => 'Uèi(?:\\s+a)?', + 'diff_yesterday' => 'ièr', + 'diff_yesterday_regexp' => 'Ièr(?:\\s+a)?', + 'diff_tomorrow' => 'deman', + 'diff_tomorrow_regexp' => 'Deman(?:\\s+a)?', + 'diff_before_yesterday' => 'ièr delà', + 'diff_after_tomorrow' => 'deman passat', + 'period_recurrences' => ':count còp|:count còps', + 'period_interval' => 'cada :interval', + 'period_start_date' => 'de :date', + 'period_end_date' => 'fins a :date', + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM [de] YYYY', + 'LLL' => 'D MMMM [de] YYYY [a] H:mm', + 'LLLL' => 'dddd D MMMM [de] YYYY [a] H:mm', + ], + 'calendar' => [ + 'sameDay' => '[Uèi a] LT', + 'nextDay' => '[Deman a] LT', + 'nextWeek' => 'dddd [a] LT', + 'lastDay' => '[Ièr a] LT', + 'lastWeek' => 'dddd [passat a] LT', + 'sameElse' => 'L', + ], + 'months' => ['de genièr', 'de febrièr', 'de març', 'd\'abrial', 'de mai', 'de junh', 'de julhet', 'd\'agost', 'de setembre', 'd’octòbre', 'de novembre', 'de decembre'], + 'months_standalone' => ['genièr', 'febrièr', 'març', 'abrial', 'mai', 'junh', 'julh', 'agost', 'setembre', 'octòbre', 'novembre', 'decembre'], + 'months_short' => ['gen.', 'feb.', 'març', 'abr.', 'mai', 'junh', 'julh', 'ago.', 'sep.', 'oct.', 'nov.', 'dec.'], + 'weekdays' => ['dimenge', 'diluns', 'dimars', 'dimècres', 'dijòus', 'divendres', 'dissabte'], + 'weekdays_short' => ['dg', 'dl', 'dm', 'dc', 'dj', 'dv', 'ds'], + 'weekdays_min' => ['dg', 'dl', 'dm', 'dc', 'dj', 'dv', 'ds'], + 'ordinal' => function ($number, string $period = '') { + $ordinal = [1 => 'èr', 2 => 'nd'][(int) $number] ?? 'en'; + + // feminine for year, week, hour, minute, second + if (preg_match('/^[yYwWhHgGis]$/', $period)) { + $ordinal .= 'a'; + } + + return $number.$ordinal; + }, + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' e '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/oc_FR.php b/vendor/nesbot/carbon/src/Carbon/Lang/oc_FR.php new file mode 100644 index 00000000..01eb5c14 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/oc_FR.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/oc.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/om.php b/vendor/nesbot/carbon/src/Carbon/Lang/om.php new file mode 100644 index 00000000..b8d5a0b0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/om.php @@ -0,0 +1,60 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Ge'ez Frontier Foundation & Sagalee Oromoo Publishing Co. Inc. locales@geez.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'dd-MMM-YYYY', + 'LLL' => 'dd MMMM YYYY HH:mm', + 'LLLL' => 'dddd, MMMM D, YYYY HH:mm', + ], + 'months' => ['Amajjii', 'Guraandhala', 'Bitooteessa', 'Elba', 'Caamsa', 'Waxabajjii', 'Adooleessa', 'Hagayya', 'Fuulbana', 'Onkololeessa', 'Sadaasa', 'Muddee'], + 'months_short' => ['Ama', 'Gur', 'Bit', 'Elb', 'Cam', 'Wax', 'Ado', 'Hag', 'Ful', 'Onk', 'Sad', 'Mud'], + 'weekdays' => ['Dilbata', 'Wiixata', 'Qibxata', 'Roobii', 'Kamiisa', 'Jimaata', 'Sanbata'], + 'weekdays_short' => ['Dil', 'Wix', 'Qib', 'Rob', 'Kam', 'Jim', 'San'], + 'weekdays_min' => ['Dil', 'Wix', 'Qib', 'Rob', 'Kam', 'Jim', 'San'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['WD', 'WB'], + + 'year' => 'wggoota :count', + 'y' => 'wggoota :count', + 'a_year' => 'wggoota :count', + + 'month' => 'ji’a :count', + 'm' => 'ji’a :count', + 'a_month' => 'ji’a :count', + + 'week' => 'torban :count', + 'w' => 'torban :count', + 'a_week' => 'torban :count', + + 'day' => 'guyyaa :count', + 'd' => 'guyyaa :count', + 'a_day' => 'guyyaa :count', + + 'hour' => 'saʼaatii :count', + 'h' => 'saʼaatii :count', + 'a_hour' => 'saʼaatii :count', + + 'minute' => 'daqiiqaa :count', + 'min' => 'daqiiqaa :count', + 'a_minute' => 'daqiiqaa :count', + + 'second' => 'sekoondii :count', + 's' => 'sekoondii :count', + 'a_second' => 'sekoondii :count', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/om_ET.php b/vendor/nesbot/carbon/src/Carbon/Lang/om_ET.php new file mode 100644 index 00000000..044760e3 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/om_ET.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/om.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/om_KE.php b/vendor/nesbot/carbon/src/Carbon/Lang/om_KE.php new file mode 100644 index 00000000..f5a4d1c9 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/om_KE.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/om.php', [ + 'day_of_first_week_of_year' => 0, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/or.php b/vendor/nesbot/carbon/src/Carbon/Lang/or.php new file mode 100644 index 00000000..3aa71732 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/or.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/or_IN.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/or_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/or_IN.php new file mode 100644 index 00000000..57a89f5d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/or_IN.php @@ -0,0 +1,51 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - IBM AP Linux Technology Center, Yamato Software Laboratory bug-glibc@gnu.org + */ +return [ + 'diff_now' => 'ବର୍ତ୍ତମାନ', + 'diff_yesterday' => 'ଗତକାଲି', + 'diff_tomorrow' => 'ଆସନ୍ତାକାଲି', + 'formats' => [ + 'LT' => 'Oh:Om A', + 'LTS' => 'Oh:Om:Os A', + 'L' => 'OD-OM-OY', + 'LL' => 'OD MMMM OY', + 'LLL' => 'OD MMMM OY Oh:Om A', + 'LLLL' => 'dddd OD MMMM OY Oh:Om A', + ], + 'months' => ['ଜାନୁଆରୀ', 'ଫେବୃଆରୀ', 'ମାର୍ଚ୍ଚ', 'ଅପ୍ରେଲ', 'ମଇ', 'ଜୁନ', 'ଜୁଲାଇ', 'ଅଗଷ୍ଟ', 'ସେପ୍ଟେମ୍ବର', 'ଅକ୍ଟୋବର', 'ନଭେମ୍ବର', 'ଡିସେମ୍ବର'], + 'months_short' => ['ଜାନୁଆରୀ', 'ଫେବୃଆରୀ', 'ମାର୍ଚ୍ଚ', 'ଅପ୍ରେଲ', 'ମଇ', 'ଜୁନ', 'ଜୁଲାଇ', 'ଅଗଷ୍ଟ', 'ସେପ୍ଟେମ୍ବର', 'ଅକ୍ଟୋବର', 'ନଭେମ୍ବର', 'ଡିସେମ୍ବର'], + 'weekdays' => ['ରବିବାର', 'ସୋମବାର', 'ମଙ୍ଗଳବାର', 'ବୁଧବାର', 'ଗୁରୁବାର', 'ଶୁକ୍ରବାର', 'ଶନିବାର'], + 'weekdays_short' => ['ରବି', 'ସୋମ', 'ମଙ୍ଗଳ', 'ବୁଧ', 'ଗୁରୁ', 'ଶୁକ୍ର', 'ଶନି'], + 'weekdays_min' => ['ରବି', 'ସୋମ', 'ମଙ୍ଗଳ', 'ବୁଧ', 'ଗୁରୁ', 'ଶୁକ୍ର', 'ଶନି'], + 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['୦', '୧', '୨', '୩', '୪', '୫', '୬', '୭', '୮', '୯', '୧୦', '୧୧', '୧୨', '୧୩', '୧୪', '୧୫', '୧୬', '୧୭', '୧୮', '୧୯', '୨୦', '୨୧', '୨୨', '୨୩', '୨୪', '୨୫', '୨୬', '୨୭', '୨୮', '୨୯', '୩୦', '୩୧', '୩୨', '୩୩', '୩୪', '୩୫', '୩୬', '୩୭', '୩୮', '୩୯', '୪୦', '୪୧', '୪୨', '୪୩', '୪୪', '୪୫', '୪୬', '୪୭', '୪୮', '୪୯', '୫୦', '୫୧', '୫୨', '୫୩', '୫୪', '୫୫', '୫୬', '୫୭', '୫୮', '୫୯', '୬୦', '୬୧', '୬୨', '୬୩', '୬୪', '୬୫', '୬୬', '୬୭', '୬୮', '୬୯', '୭୦', '୭୧', '୭୨', '୭୩', '୭୪', '୭୫', '୭୬', '୭୭', '୭୮', '୭୯', '୮୦', '୮୧', '୮୨', '୮୩', '୮୪', '୮୫', '୮୬', '୮୭', '୮୮', '୮୯', '୯୦', '୯୧', '୯୨', '୯୩', '୯୪', '୯୫', '୯୬', '୯୭', '୯୮', '୯୯'], + 'year' => ':count ବର୍ଷ', + 'y' => ':count ବ.', + 'month' => ':count ମାସ', + 'm' => ':count ମା.', + 'week' => ':count ସପ୍ତାହ', + 'w' => ':count ସପ୍ତା.', + 'day' => ':count ଦିନ', + 'd' => ':count ଦିନ', + 'hour' => ':count ଘଣ୍ତ', + 'h' => ':count ଘ.', + 'minute' => ':count ମିନଟ', + 'min' => ':count ମି.', + 'second' => ':count ସେକଣ୍ଢ', + 's' => ':count ସେ.', + 'ago' => ':time ପୂର୍ବେ', + 'from_now' => ':timeରେ', +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/os.php b/vendor/nesbot/carbon/src/Carbon/Lang/os.php new file mode 100644 index 00000000..5f55e8a2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/os.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/os_RU.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/os_RU.php b/vendor/nesbot/carbon/src/Carbon/Lang/os_RU.php new file mode 100644 index 00000000..9592d15d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/os_RU.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD.MM.YYYY', + ], + 'months' => ['январы', 'февралы', 'мартъийы', 'апрелы', 'майы', 'июны', 'июлы', 'августы', 'сентябры', 'октябры', 'ноябры', 'декабры'], + 'months_short' => ['Янв', 'Фев', 'Мар', 'Апр', 'Май', 'Июн', 'Июл', 'Авг', 'Сен', 'Окт', 'Ноя', 'Дек'], + 'weekdays' => ['Хуыцаубон', 'Къуырисæр', 'Дыццæг', 'Æртыццæг', 'Цыппæрæм', 'Майрæмбон', 'Сабат'], + 'weekdays_short' => ['Хцб', 'Крс', 'Дцг', 'Æрт', 'Цпр', 'Мрб', 'Сбт'], + 'weekdays_min' => ['Хцб', 'Крс', 'Дцг', 'Æрт', 'Цпр', 'Мрб', 'Сбт'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + + 'minute' => ':count гыццыл', // less reliable + 'min' => ':count гыццыл', // less reliable + 'a_minute' => ':count гыццыл', // less reliable + + 'second' => ':count æндæр', // less reliable + 's' => ':count æндæр', // less reliable + 'a_second' => ':count æндæр', // less reliable + + 'year' => ':count аз', + 'y' => ':count аз', + 'a_year' => ':count аз', + + 'month' => ':count мӕй', + 'm' => ':count мӕй', + 'a_month' => ':count мӕй', + + 'week' => ':count къуыри', + 'w' => ':count къуыри', + 'a_week' => ':count къуыри', + + 'day' => ':count бон', + 'd' => ':count бон', + 'a_day' => ':count бон', + + 'hour' => ':count сахат', + 'h' => ':count сахат', + 'a_hour' => ':count сахат', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pa.php b/vendor/nesbot/carbon/src/Carbon/Lang/pa.php new file mode 100644 index 00000000..48b20331 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pa.php @@ -0,0 +1,76 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Philippe Vaucher + * - Tsutomu Kuroda + * - Punjab + */ +return [ + 'year' => 'ਇੱਕ ਸਾਲ|:count ਸਾਲ', + 'month' => 'ਇੱਕ ਮਹੀਨਾ|:count ਮਹੀਨੇ', + 'week' => 'ਹਫਤਾ|:count ਹਫ਼ਤੇ', + 'day' => 'ਇੱਕ ਦਿਨ|:count ਦਿਨ', + 'hour' => 'ਇੱਕ ਘੰਟਾ|:count ਘੰਟੇ', + 'minute' => 'ਇਕ ਮਿੰਟ|:count ਮਿੰਟ', + 'second' => 'ਕੁਝ ਸਕਿੰਟ|:count ਸਕਿੰਟ', + 'ago' => ':time ਪਹਿਲਾਂ', + 'from_now' => ':time ਵਿੱਚ', + 'before' => ':time ਤੋਂ ਪਹਿਲਾਂ', + 'after' => ':time ਤੋਂ ਬਾਅਦ', + 'diff_now' => 'ਹੁਣ', + 'diff_today' => 'ਅਜ', + 'diff_yesterday' => 'ਕਲ', + 'diff_tomorrow' => 'ਕਲ', + 'formats' => [ + 'LT' => 'A h:mm ਵਜੇ', + 'LTS' => 'A h:mm:ss ਵਜੇ', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY, A h:mm ਵਜੇ', + 'LLLL' => 'dddd, D MMMM YYYY, A h:mm ਵਜੇ', + ], + 'calendar' => [ + 'sameDay' => '[ਅਜ] LT', + 'nextDay' => '[ਕਲ] LT', + 'nextWeek' => '[ਅਗਲਾ] dddd, LT', + 'lastDay' => '[ਕਲ] LT', + 'lastWeek' => '[ਪਿਛਲੇ] dddd, LT', + 'sameElse' => 'L', + ], + 'meridiem' => function ($hour) { + if ($hour < 4) { + return 'ਰਾਤ'; + } + if ($hour < 10) { + return 'ਸਵੇਰ'; + } + if ($hour < 17) { + return 'ਦੁਪਹਿਰ'; + } + if ($hour < 20) { + return 'ਸ਼ਾਮ'; + } + + return 'ਰਾਤ'; + }, + 'months' => ['ਜਨਵਰੀ', 'ਫ਼ਰਵਰੀ', 'ਮਾਰਚ', 'ਅਪ੍ਰੈਲ', 'ਮਈ', 'ਜੂਨ', 'ਜੁਲਾਈ', 'ਅਗਸਤ', 'ਸਤੰਬਰ', 'ਅਕਤੂਬਰ', 'ਨਵੰਬਰ', 'ਦਸੰਬਰ'], + 'months_short' => ['ਜਨਵਰੀ', 'ਫ਼ਰਵਰੀ', 'ਮਾਰਚ', 'ਅਪ੍ਰੈਲ', 'ਮਈ', 'ਜੂਨ', 'ਜੁਲਾਈ', 'ਅਗਸਤ', 'ਸਤੰਬਰ', 'ਅਕਤੂਬਰ', 'ਨਵੰਬਰ', 'ਦਸੰਬਰ'], + 'weekdays' => ['ਐਤਵਾਰ', 'ਸੋਮਵਾਰ', 'ਮੰਗਲਵਾਰ', 'ਬੁਧਵਾਰ', 'ਵੀਰਵਾਰ', 'ਸ਼ੁੱਕਰਵਾਰ', 'ਸ਼ਨੀਚਰਵਾਰ'], + 'weekdays_short' => ['ਐਤ', 'ਸੋਮ', 'ਮੰਗਲ', 'ਬੁਧ', 'ਵੀਰ', 'ਸ਼ੁਕਰ', 'ਸ਼ਨੀ'], + 'weekdays_min' => ['ਐਤ', 'ਸੋਮ', 'ਮੰਗਲ', 'ਬੁਧ', 'ਵੀਰ', 'ਸ਼ੁਕਰ', 'ਸ਼ਨੀ'], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' ਅਤੇ '], + 'weekend' => [0, 0], + 'alt_numbers' => ['੦', '੧', '੨', '੩', '੪', '੫', '੬', '੭', '੮', '੯'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pa_Arab.php b/vendor/nesbot/carbon/src/Carbon/Lang/pa_Arab.php new file mode 100644 index 00000000..39b06532 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pa_Arab.php @@ -0,0 +1,26 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ur.php', [ + 'weekdays' => ['اتوار', 'پیر', 'منگل', 'بُدھ', 'جمعرات', 'جمعہ', 'ہفتہ'], + 'weekdays_short' => ['اتوار', 'پیر', 'منگل', 'بُدھ', 'جمعرات', 'جمعہ', 'ہفتہ'], + 'weekdays_min' => ['اتوار', 'پیر', 'منگل', 'بُدھ', 'جمعرات', 'جمعہ', 'ہفتہ'], + 'months' => ['جنوری', 'فروری', 'مارچ', 'اپریل', 'مئ', 'جون', 'جولائی', 'اگست', 'ستمبر', 'اکتوبر', 'نومبر', 'دسمبر'], + 'months_short' => ['جنوری', 'فروری', 'مارچ', 'اپریل', 'مئ', 'جون', 'جولائی', 'اگست', 'ستمبر', 'اکتوبر', 'نومبر', 'دسمبر'], + 'formats' => [ + 'LT' => 'h:mm a', + 'LTS' => 'h:mm:ss a', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY h:mm a', + 'LLLL' => 'dddd, DD MMMM YYYY h:mm a', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pa_Guru.php b/vendor/nesbot/carbon/src/Carbon/Lang/pa_Guru.php new file mode 100644 index 00000000..7adff5c3 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pa_Guru.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/pa.php', [ + 'formats' => [ + 'LT' => 'h:mm a', + 'LTS' => 'h:mm:ss a', + 'L' => 'D/M/yy', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY, h:mm a', + 'LLLL' => 'dddd, D MMMM YYYY, h:mm a', + ], + 'months' => ['ਜਨਵਰੀ', 'ਫ਼ਰਵਰੀ', 'ਮਾਰਚ', 'ਅਪ੍ਰੈਲ', 'ਮਈ', 'ਜੂਨ', 'ਜੁਲਾਈ', 'ਅਗਸਤ', 'ਸਤੰਬਰ', 'ਅਕਤੂਬਰ', 'ਨਵੰਬਰ', 'ਦਸੰਬਰ'], + 'months_short' => ['ਜਨ', 'ਫ਼ਰ', 'ਮਾਰਚ', 'ਅਪ੍ਰੈ', 'ਮਈ', 'ਜੂਨ', 'ਜੁਲਾ', 'ਅਗ', 'ਸਤੰ', 'ਅਕਤੂ', 'ਨਵੰ', 'ਦਸੰ'], + 'weekdays' => ['ਐਤਵਾਰ', 'ਸੋਮਵਾਰ', 'ਮੰਗਲਵਾਰ', 'ਬੁੱਧਵਾਰ', 'ਵੀਰਵਾਰ', 'ਸ਼ੁੱਕਰਵਾਰ', 'ਸ਼ਨਿੱਚਰਵਾਰ'], + 'weekdays_short' => ['ਐਤ', 'ਸੋਮ', 'ਮੰਗਲ', 'ਬੁੱਧ', 'ਵੀਰ', 'ਸ਼ੁੱਕਰ', 'ਸ਼ਨਿੱਚਰ'], + 'weekdays_min' => ['ਐਤ', 'ਸੋਮ', 'ਮੰਗ', 'ਬੁੱਧ', 'ਵੀਰ', 'ਸ਼ੁੱਕ', 'ਸ਼ਨਿੱ'], + 'weekend' => [0, 0], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pa_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/pa_IN.php new file mode 100644 index 00000000..ca67642a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pa_IN.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Guo Xiang Tan + * - Josh Soref + * - Ash + * - harpreetkhalsagtbit + */ +return require __DIR__.'/pa.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pa_PK.php b/vendor/nesbot/carbon/src/Carbon/Lang/pa_PK.php new file mode 100644 index 00000000..f9af11c6 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pa_PK.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['جنوري', 'فروري', 'مارچ', 'اپريل', 'مٓی', 'جون', 'جولاي', 'اگست', 'ستمبر', 'اكتوبر', 'نومبر', 'دسمبر'], + 'months_short' => ['جنوري', 'فروري', 'مارچ', 'اپريل', 'مٓی', 'جون', 'جولاي', 'اگست', 'ستمبر', 'اكتوبر', 'نومبر', 'دسمبر'], + 'weekdays' => ['اتوار', 'پير', 'منگل', 'بدھ', 'جمعرات', 'جمعه', 'هفته'], + 'weekdays_short' => ['اتوار', 'پير', 'منگل', 'بدھ', 'جمعرات', 'جمعه', 'هفته'], + 'weekdays_min' => ['اتوار', 'پير', 'منگل', 'بدھ', 'جمعرات', 'جمعه', 'هفته'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['ص', 'ش'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pap.php b/vendor/nesbot/carbon/src/Carbon/Lang/pap.php new file mode 100644 index 00000000..b4c1706f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pap.php @@ -0,0 +1,39 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return [ + 'formats' => [ + 'LT' => 'HH.mm', + 'LTS' => 'HH.mm:ss', + 'L' => 'DD-MM-YY', + 'LL' => 'MMMM [di] DD, YYYY', + 'LLL' => 'DD MMM HH.mm', + 'LLLL' => 'MMMM DD, YYYY HH.mm', + ], + 'months' => ['yanüari', 'febrüari', 'mart', 'aprel', 'mei', 'yüni', 'yüli', 'ougùstùs', 'sèptèmber', 'oktober', 'novèmber', 'desèmber'], + 'months_short' => ['yan', 'feb', 'mar', 'apr', 'mei', 'yün', 'yül', 'oug', 'sèp', 'okt', 'nov', 'des'], + 'weekdays' => ['djadomingo', 'djaluna', 'djamars', 'djawebs', 'djarason', 'djabierne', 'djasabra'], + 'weekdays_short' => ['do', 'lu', 'ma', 'we', 'ra', 'bi', 'sa'], + 'weekdays_min' => ['do', 'lu', 'ma', 'we', 'ra', 'bi', 'sa'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'year' => ':count aña', + 'month' => ':count luna', + 'week' => ':count siman', + 'day' => ':count dia', + 'hour' => ':count ora', + 'minute' => ':count minüt', + 'second' => ':count sekònde', + 'list' => [', ', ' i '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pap_AW.php b/vendor/nesbot/carbon/src/Carbon/Lang/pap_AW.php new file mode 100644 index 00000000..e9a48ffc --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pap_AW.php @@ -0,0 +1,16 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - information from native speaker Pablo Saratxaga pablo@mandrakesoft.com + */ +return require __DIR__.'/pap.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pap_CW.php b/vendor/nesbot/carbon/src/Carbon/Lang/pap_CW.php new file mode 100644 index 00000000..e9a48ffc --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pap_CW.php @@ -0,0 +1,16 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - information from native speaker Pablo Saratxaga pablo@mandrakesoft.com + */ +return require __DIR__.'/pap.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pl.php b/vendor/nesbot/carbon/src/Carbon/Lang/pl.php new file mode 100644 index 00000000..b7205354 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pl.php @@ -0,0 +1,126 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Wacław Jacek + * - François B + * - Tim Fish + * - Serhan Apaydın + * - Massimiliano Caniparoli + * - JD Isaacks + * - Jakub Szwacz + * - Jan + * - Paul + * - damlys + * - Marek (marast78) + * - Peter (UnrulyNatives) + * - Qrzysio + * - Jan (aso824) + * - diverpl + */ + +use Carbon\CarbonInterface; + +return [ + 'year' => ':count rok|:count lata|:count lat', + 'a_year' => 'rok|:count lata|:count lat', + 'y' => ':count r|:count l|:count l', + 'month' => ':count miesiąc|:count miesiące|:count miesięcy', + 'a_month' => 'miesiąc|:count miesiące|:count miesięcy', + 'm' => ':count mies.', + 'week' => ':count tydzień|:count tygodnie|:count tygodni', + 'a_week' => 'tydzień|:count tygodnie|:count tygodni', + 'w' => ':count tyg.', + 'day' => ':count dzień|:count dni|:count dni', + 'a_day' => 'dzień|:count dni|:count dni', + 'd' => ':count d', + 'hour' => ':count godzina|:count godziny|:count godzin', + 'a_hour' => 'godzina|:count godziny|:count godzin', + 'h' => ':count godz.', + 'minute' => ':count minuta|:count minuty|:count minut', + 'a_minute' => 'minuta|:count minuty|:count minut', + 'min' => ':count min', + 'second' => ':count sekunda|:count sekundy|:count sekund', + 'a_second' => '{1}kilka sekund|:count sekunda|:count sekundy|:count sekund', + 's' => ':count sek.', + 'ago' => ':time temu', + 'from_now' => static function ($time) { + return 'za '.strtr($time, [ + 'godzina' => 'godzinę', + 'minuta' => 'minutę', + 'sekunda' => 'sekundę', + ]); + }, + 'after' => ':time po', + 'before' => ':time przed', + 'diff_now' => 'teraz', + 'diff_today' => 'Dziś', + 'diff_today_regexp' => 'Dziś(?:\\s+o)?', + 'diff_yesterday' => 'wczoraj', + 'diff_yesterday_regexp' => 'Wczoraj(?:\\s+o)?', + 'diff_tomorrow' => 'jutro', + 'diff_tomorrow_regexp' => 'Jutro(?:\\s+o)?', + 'diff_before_yesterday' => 'przedwczoraj', + 'diff_after_tomorrow' => 'pojutrze', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Dziś o] LT', + 'nextDay' => '[Jutro o] LT', + 'nextWeek' => function (CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[W niedzielę o] LT'; + case 2: + return '[We wtorek o] LT'; + case 3: + return '[W środę o] LT'; + case 6: + return '[W sobotę o] LT'; + default: + return '[W] dddd [o] LT'; + } + }, + 'lastDay' => '[Wczoraj o] LT', + 'lastWeek' => function (CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[W zeszłą niedzielę o] LT'; + case 3: + return '[W zeszłą środę o] LT'; + case 6: + return '[W zeszłą sobotę o] LT'; + default: + return '[W zeszły] dddd [o] LT'; + } + }, + 'sameElse' => 'L', + ], + 'ordinal' => ':number.', + 'months' => ['stycznia', 'lutego', 'marca', 'kwietnia', 'maja', 'czerwca', 'lipca', 'sierpnia', 'września', 'października', 'listopada', 'grudnia'], + 'months_standalone' => ['styczeń', 'luty', 'marzec', 'kwiecień', 'maj', 'czerwiec', 'lipiec', 'sierpień', 'wrzesień', 'październik', 'listopad', 'grudzień'], + 'months_short' => ['sty', 'lut', 'mar', 'kwi', 'maj', 'cze', 'lip', 'sie', 'wrz', 'paź', 'lis', 'gru'], + 'months_regexp' => '/(DD?o?\.?(\[[^\[\]]*\]|\s)+MMMM?|L{2,4}|l{2,4})/', + 'weekdays' => ['niedziela', 'poniedziałek', 'wtorek', 'środa', 'czwartek', 'piątek', 'sobota'], + 'weekdays_short' => ['ndz', 'pon', 'wt', 'śr', 'czw', 'pt', 'sob'], + 'weekdays_min' => ['Nd', 'Pn', 'Wt', 'Śr', 'Cz', 'Pt', 'So'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' i '], + 'meridiem' => ['przed południem', 'po południu'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pl_PL.php b/vendor/nesbot/carbon/src/Carbon/Lang/pl_PL.php new file mode 100644 index 00000000..222bcdb4 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pl_PL.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/pl.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/prg.php b/vendor/nesbot/carbon/src/Carbon/Lang/prg.php new file mode 100644 index 00000000..6e63f4ad --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/prg.php @@ -0,0 +1,52 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'months' => ['M01', 'M02', 'M03', 'M04', 'M05', 'M06', 'M07', 'M08', 'M09', 'M10', 'M11', 'M12'], + 'months_short' => ['M01', 'M02', 'M03', 'M04', 'M05', 'M06', 'M07', 'M08', 'M09', 'M10', 'M11', 'M12'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY-MM-dd', + 'LL' => 'YYYY MMM D', + 'LLL' => 'YYYY MMMM D HH:mm', + 'LLLL' => 'YYYY MMMM D, dddd HH:mm', + ], + + 'year' => ':count meta', + 'y' => ':count meta', + 'a_year' => ':count meta', + + 'month' => ':count mēniks', // less reliable + 'm' => ':count mēniks', // less reliable + 'a_month' => ':count mēniks', // less reliable + + 'week' => ':count sawaītin', // less reliable + 'w' => ':count sawaītin', // less reliable + 'a_week' => ':count sawaītin', // less reliable + + 'day' => ':count di', + 'd' => ':count di', + 'a_day' => ':count di', + + 'hour' => ':count bruktēt', // less reliable + 'h' => ':count bruktēt', // less reliable + 'a_hour' => ':count bruktēt', // less reliable + + 'minute' => ':count līkuts', // less reliable + 'min' => ':count līkuts', // less reliable + 'a_minute' => ':count līkuts', // less reliable + + 'second' => ':count kitan', // less reliable + 's' => ':count kitan', // less reliable + 'a_second' => ':count kitan', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ps.php b/vendor/nesbot/carbon/src/Carbon/Lang/ps.php new file mode 100644 index 00000000..a928b28e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ps.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Muhammad Nasir Rahimi + * - Nassim Nasibullah (spinzar) + */ +return [ + 'year' => ':count کال|:count کاله', + 'y' => ':countکال|:countکاله', + 'month' => ':count مياشت|:count مياشتي', + 'm' => ':countمياشت|:countمياشتي', + 'week' => ':count اونۍ|:count اونۍ', + 'w' => ':countاونۍ|:countاونۍ', + 'day' => ':count ورځ|:count ورځي', + 'd' => ':countورځ|:countورځي', + 'hour' => ':count ساعت|:count ساعته', + 'h' => ':countساعت|:countساعته', + 'minute' => ':count دقيقه|:count دقيقې', + 'min' => ':countدقيقه|:countدقيقې', + 'second' => ':count ثانيه|:count ثانيې', + 's' => ':countثانيه|:countثانيې', + 'ago' => ':time دمخه', + 'from_now' => ':time له اوس څخه', + 'after' => ':time وروسته', + 'before' => ':time دمخه', + 'list' => ['، ', ' او '], + 'meridiem' => ['غ.م.', 'غ.و.'], + 'weekdays' => ['اتوار', 'ګل', 'نهه', 'شورو', 'زيارت', 'جمعه', 'خالي'], + 'weekdays_short' => ['ا', 'ګ', 'ن', 'ش', 'ز', 'ج', 'خ'], + 'weekdays_min' => ['ا', 'ګ', 'ن', 'ش', 'ز', 'ج', 'خ'], + 'months' => ['جنوري', 'فبروري', 'مارچ', 'اپریل', 'مۍ', 'جون', 'جولای', 'اگست', 'سېپتمبر', 'اکتوبر', 'نومبر', 'دسمبر'], + 'months_short' => ['جنوري', 'فبروري', 'مارچ', 'اپریل', 'مۍ', 'جون', 'جولای', 'اگست', 'سېپتمبر', 'اکتوبر', 'نومبر', 'دسمبر'], + 'months_standalone' => ['جنوري', 'فېبروري', 'مارچ', 'اپریل', 'مۍ', 'جون', 'جولای', 'اگست', 'سپتمبر', 'اکتوبر', 'نومبر', 'دسمبر'], + 'months_short_standalone' => ['جنوري', 'فبروري', 'مارچ', 'اپریل', 'مۍ', 'جون', 'جولای', 'اگست', 'سپتمبر', 'اکتوبر', 'نومبر', 'دسمبر'], + 'first_day_of_week' => 6, + 'weekend' => [4, 5], + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'YYYY/M/d', + 'LL' => 'YYYY MMM D', + 'LLL' => 'د YYYY د MMMM D H:mm', + 'LLLL' => 'dddd د YYYY د MMMM D H:mm', + ], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ps_AF.php b/vendor/nesbot/carbon/src/Carbon/Lang/ps_AF.php new file mode 100644 index 00000000..6ec51804 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ps_AF.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/ps.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pt.php b/vendor/nesbot/carbon/src/Carbon/Lang/pt.php new file mode 100644 index 00000000..bb6359b1 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pt.php @@ -0,0 +1,116 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Cassiano Montanari + * - Matt Pope + * - François B + * - Prodis + * - JD Isaacks + * - Raphael Amorim + * - João Magalhães + * - victortobias + * - Paulo Freitas + * - Sebastian Thierer + * - Claudson Martins (claudsonm) + */ + +use Carbon\CarbonInterface; + +return [ + 'year' => ':count ano|:count anos', + 'a_year' => 'um ano|:count anos', + 'y' => ':counta', + 'month' => ':count mês|:count meses', + 'a_month' => 'um mês|:count meses', + 'm' => ':countm', + 'week' => ':count semana|:count semanas', + 'a_week' => 'uma semana|:count semanas', + 'w' => ':countsem', + 'day' => ':count dia|:count dias', + 'a_day' => 'um dia|:count dias', + 'd' => ':countd', + 'hour' => ':count hora|:count horas', + 'a_hour' => 'uma hora|:count horas', + 'h' => ':counth', + 'minute' => ':count minuto|:count minutos', + 'a_minute' => 'um minuto|:count minutos', + 'min' => ':countmin', + 'second' => ':count segundo|:count segundos', + 'a_second' => 'alguns segundos|:count segundos', + 's' => ':counts', + 'millisecond' => ':count milissegundo|:count milissegundos', + 'a_millisecond' => 'um milissegundo|:count milissegundos', + 'ms' => ':countms', + 'microsecond' => ':count microssegundo|:count microssegundos', + 'a_microsecond' => 'um microssegundo|:count microssegundos', + 'µs' => ':countµs', + 'ago' => 'há :time', + 'from_now' => 'em :time', + 'after' => ':time depois', + 'before' => ':time antes', + 'diff_now' => 'agora', + 'diff_today' => 'Hoje', + 'diff_today_regexp' => 'Hoje(?:\\s+às)?', + 'diff_yesterday' => 'ontem', + 'diff_yesterday_regexp' => 'Ontem(?:\\s+às)?', + 'diff_tomorrow' => 'amanhã', + 'diff_tomorrow_regexp' => 'Amanhã(?:\\s+às)?', + 'diff_before_yesterday' => 'anteontem', + 'diff_after_tomorrow' => 'depois de amanhã', + 'period_recurrences' => 'uma vez|:count vezes', + 'period_interval' => 'cada :interval', + 'period_start_date' => 'de :date', + 'period_end_date' => 'até :date', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D [de] MMMM [de] YYYY', + 'LLL' => 'D [de] MMMM [de] YYYY HH:mm', + 'LLLL' => 'dddd, D [de] MMMM [de] YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Hoje às] LT', + 'nextDay' => '[Amanhã às] LT', + 'nextWeek' => 'dddd [às] LT', + 'lastDay' => '[Ontem às] LT', + 'lastWeek' => function (CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + case 6: + return '[Último] dddd [às] LT'; + default: + return '[Última] dddd [às] LT'; + } + }, + 'sameElse' => 'L', + ], + 'ordinal' => ':numberº', + 'months' => ['janeiro', 'fevereiro', 'março', 'abril', 'maio', 'junho', 'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro'], + 'months_short' => ['jan', 'fev', 'mar', 'abr', 'mai', 'jun', 'jul', 'ago', 'set', 'out', 'nov', 'dez'], + 'weekdays' => ['domingo', 'segunda-feira', 'terça-feira', 'quarta-feira', 'quinta-feira', 'sexta-feira', 'sábado'], + 'weekdays_short' => ['dom', 'seg', 'ter', 'qua', 'qui', 'sex', 'sáb'], + 'weekdays_min' => ['Do', '2ª', '3ª', '4ª', '5ª', '6ª', 'Sá'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' e '], + 'ordinal_words' => [ + 'of' => 'de', + 'first' => 'primeira', + 'second' => 'segunda', + 'third' => 'terceira', + 'fourth' => 'quarta', + 'fifth' => 'quinta', + 'last' => 'última', + ], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pt_AO.php b/vendor/nesbot/carbon/src/Carbon/Lang/pt_AO.php new file mode 100644 index 00000000..22c01ec5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pt_AO.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/pt.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pt_BR.php b/vendor/nesbot/carbon/src/Carbon/Lang/pt_BR.php new file mode 100644 index 00000000..e917c5cd --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pt_BR.php @@ -0,0 +1,39 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Cassiano Montanari + * - Eduardo Dalla Vecchia + * - David Rodrigues + * - Matt Pope + * - François B + * - Prodis + * - Marlon Maxwel + * - JD Isaacks + * - Raphael Amorim + * - Rafael Raupp + * - felipeleite1 + * - swalker + * - Lucas Macedo + * - Paulo Freitas + * - Sebastian Thierer + */ +return array_replace_recursive(require __DIR__.'/pt.php', [ + 'period_recurrences' => 'uma|:count vez', + 'period_interval' => 'toda :interval', + 'formats' => [ + 'LLL' => 'D [de] MMMM [de] YYYY [às] HH:mm', + 'LLLL' => 'dddd, D [de] MMMM [de] YYYY [às] HH:mm', + ], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pt_CH.php b/vendor/nesbot/carbon/src/Carbon/Lang/pt_CH.php new file mode 100644 index 00000000..22c01ec5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pt_CH.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/pt.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pt_CV.php b/vendor/nesbot/carbon/src/Carbon/Lang/pt_CV.php new file mode 100644 index 00000000..22c01ec5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pt_CV.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/pt.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pt_GQ.php b/vendor/nesbot/carbon/src/Carbon/Lang/pt_GQ.php new file mode 100644 index 00000000..22c01ec5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pt_GQ.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/pt.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pt_GW.php b/vendor/nesbot/carbon/src/Carbon/Lang/pt_GW.php new file mode 100644 index 00000000..22c01ec5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pt_GW.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/pt.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pt_LU.php b/vendor/nesbot/carbon/src/Carbon/Lang/pt_LU.php new file mode 100644 index 00000000..22c01ec5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pt_LU.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/pt.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pt_MO.php b/vendor/nesbot/carbon/src/Carbon/Lang/pt_MO.php new file mode 100644 index 00000000..f2b5eab7 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pt_MO.php @@ -0,0 +1,20 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/pt.php', [ + 'formats' => [ + 'LT' => 'h:mm a', + 'LTS' => 'h:mm:ss a', + 'LLL' => 'D [de] MMMM [de] YYYY, h:mm a', + 'LLLL' => 'dddd, D [de] MMMM [de] YYYY, h:mm a', + ], + 'first_day_of_week' => 0, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pt_MZ.php b/vendor/nesbot/carbon/src/Carbon/Lang/pt_MZ.php new file mode 100644 index 00000000..fbc0c97b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pt_MZ.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/pt.php', [ + 'first_day_of_week' => 0, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pt_PT.php b/vendor/nesbot/carbon/src/Carbon/Lang/pt_PT.php new file mode 100644 index 00000000..2a76fc1f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pt_PT.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RAP bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/pt.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['janeiro', 'fevereiro', 'março', 'abril', 'maio', 'junho', 'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro'], + 'months_short' => ['jan', 'fev', 'mar', 'abr', 'mai', 'jun', 'jul', 'ago', 'set', 'out', 'nov', 'dez'], + 'weekdays' => ['domingo', 'segunda', 'terça', 'quarta', 'quinta', 'sexta', 'sábado'], + 'weekdays_short' => ['dom', 'seg', 'ter', 'qua', 'qui', 'sex', 'sáb'], + 'weekdays_min' => ['dom', 'seg', 'ter', 'qua', 'qui', 'sex', 'sáb'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pt_ST.php b/vendor/nesbot/carbon/src/Carbon/Lang/pt_ST.php new file mode 100644 index 00000000..22c01ec5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pt_ST.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/pt.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pt_TL.php b/vendor/nesbot/carbon/src/Carbon/Lang/pt_TL.php new file mode 100644 index 00000000..22c01ec5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pt_TL.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/pt.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/qu.php b/vendor/nesbot/carbon/src/Carbon/Lang/qu.php new file mode 100644 index 00000000..65278cd1 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/qu.php @@ -0,0 +1,22 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/es_UY.php', [ + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM, YYYY HH:mm', + ], + 'first_day_of_week' => 0, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/qu_BO.php b/vendor/nesbot/carbon/src/Carbon/Lang/qu_BO.php new file mode 100644 index 00000000..d5db6bf5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/qu_BO.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/qu.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/qu_EC.php b/vendor/nesbot/carbon/src/Carbon/Lang/qu_EC.php new file mode 100644 index 00000000..d5db6bf5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/qu_EC.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/qu.php', [ + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/quz.php b/vendor/nesbot/carbon/src/Carbon/Lang/quz.php new file mode 100644 index 00000000..1640c02f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/quz.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/quz_PE.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/quz_PE.php b/vendor/nesbot/carbon/src/Carbon/Lang/quz_PE.php new file mode 100644 index 00000000..d3229189 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/quz_PE.php @@ -0,0 +1,54 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Sugar Labs // OLPC sugarlabs.org libc-alpha@sourceware.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YY', + ], + 'months' => ['iniru', 'phiwriru', 'marsu', 'awril', 'mayu', 'huniyu', 'huliyu', 'agustu', 'siptiyimri', 'uktuwri', 'nuwiyimri', 'tisiyimri'], + 'months_short' => ['ini', 'phi', 'mar', 'awr', 'may', 'hun', 'hul', 'agu', 'sip', 'ukt', 'nuw', 'tis'], + 'weekdays' => ['tuminku', 'lunis', 'martis', 'miyirkulis', 'juywis', 'wiyirnis', 'sawatu'], + 'weekdays_short' => ['tum', 'lun', 'mar', 'miy', 'juy', 'wiy', 'saw'], + 'weekdays_min' => ['tum', 'lun', 'mar', 'miy', 'juy', 'wiy', 'saw'], + 'day_of_first_week_of_year' => 1, + + 'minute' => ':count uchuy', // less reliable + 'min' => ':count uchuy', // less reliable + 'a_minute' => ':count uchuy', // less reliable + + 'year' => ':count wata', + 'y' => ':count wata', + 'a_year' => ':count wata', + + 'month' => ':count killa', + 'm' => ':count killa', + 'a_month' => ':count killa', + + 'week' => ':count simana', + 'w' => ':count simana', + 'a_week' => ':count simana', + + 'day' => ':count pʼunchaw', + 'd' => ':count pʼunchaw', + 'a_day' => ':count pʼunchaw', + + 'hour' => ':count ura', + 'h' => ':count ura', + 'a_hour' => ':count ura', + + 'second' => ':count iskay ñiqin', + 's' => ':count iskay ñiqin', + 'a_second' => ':count iskay ñiqin', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/raj.php b/vendor/nesbot/carbon/src/Carbon/Lang/raj.php new file mode 100644 index 00000000..26138c9b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/raj.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/raj_IN.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/raj_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/raj_IN.php new file mode 100644 index 00000000..7b4589cd --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/raj_IN.php @@ -0,0 +1,47 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - meghrajsuthar03@gmail.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'D/M/YY', + ], + 'months' => ['जनवरी', 'फरवरी', 'मार्च', 'अप्रैल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितंबर', 'अक्टूबर', 'नवंबर', 'दिसंबर'], + 'months_short' => ['जन', 'फर', 'मार्च', 'अप्रै', 'मई', 'जून', 'जुल', 'अग', 'सित', 'अक्टू', 'नव', 'दिस'], + 'weekdays' => ['रविवार', 'सोमवार', 'मंगल्लवार', 'बुधवार', 'बृहस्पतिवार', 'शुक्रवार', 'शनिवार'], + 'weekdays_short' => ['रवि', 'सोम', 'मंगल', 'बुध', 'बृहस्पति', 'शुक्र', 'शनि'], + 'weekdays_min' => ['रवि', 'सोम', 'मंगल', 'बुध', 'बृहस्पति', 'शुक्र', 'शनि'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['पूर्वाह्न', 'अपराह्न'], + + 'year' => ':count आंहू', // less reliable + 'y' => ':count आंहू', // less reliable + 'a_year' => ':count आंहू', // less reliable + + 'month' => ':count सूरज', // less reliable + 'm' => ':count सूरज', // less reliable + 'a_month' => ':count सूरज', // less reliable + + 'week' => ':count निवाज', // less reliable + 'w' => ':count निवाज', // less reliable + 'a_week' => ':count निवाज', // less reliable + + 'day' => ':count अेक', // less reliable + 'd' => ':count अेक', // less reliable + 'a_day' => ':count अेक', // less reliable + + 'hour' => ':count दुनियांण', // less reliable + 'h' => ':count दुनियांण', // less reliable + 'a_hour' => ':count दुनियांण', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/rm.php b/vendor/nesbot/carbon/src/Carbon/Lang/rm.php new file mode 100644 index 00000000..1843f456 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/rm.php @@ -0,0 +1,51 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Philippe Vaucher + * - tjku + * - Max Melentiev + * - Juanito Fatas + * - Tsutomu Kuroda + * - Akira Matsuda + * - Christopher Dell + * - Enrique Vidal + * - Simone Carletti + * - Aaron Patterson + * - Nicolás Hock Isaza + * - sebastian de castelberg + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'Do MMMM YYYY', + 'LLL' => 'Do MMMM, HH:mm [Uhr]', + 'LLLL' => 'dddd, Do MMMM YYYY, HH:mm [Uhr]', + ], + 'year' => ':count onn|:count onns', + 'month' => ':count mais', + 'week' => ':count emna|:count emnas', + 'day' => ':count di|:count dis', + 'hour' => ':count oura|:count ouras', + 'minute' => ':count minuta|:count minutas', + 'second' => ':count secunda|:count secundas', + 'weekdays' => ['dumengia', 'glindesdi', 'mardi', 'mesemna', 'gievgia', 'venderdi', 'sonda'], + 'weekdays_short' => ['du', 'gli', 'ma', 'me', 'gie', 've', 'so'], + 'weekdays_min' => ['du', 'gli', 'ma', 'me', 'gie', 've', 'so'], + 'months' => ['schaner', 'favrer', 'mars', 'avrigl', 'matg', 'zercladur', 'fanadur', 'avust', 'settember', 'october', 'november', 'december'], + 'months_short' => ['schan', 'favr', 'mars', 'avr', 'matg', 'zercl', 'fan', 'avust', 'sett', 'oct', 'nov', 'dec'], + 'meridiem' => ['avantmezdi', 'suentermezdi'], + 'list' => [', ', ' e '], + 'first_day_of_week' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/rn.php b/vendor/nesbot/carbon/src/Carbon/Lang/rn.php new file mode 100644 index 00000000..8ab958eb --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/rn.php @@ -0,0 +1,56 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['Z.MU.', 'Z.MW.'], + 'weekdays' => ['Ku w’indwi', 'Ku wa mbere', 'Ku wa kabiri', 'Ku wa gatatu', 'Ku wa kane', 'Ku wa gatanu', 'Ku wa gatandatu'], + 'weekdays_short' => ['cu.', 'mbe.', 'kab.', 'gtu.', 'kan.', 'gnu.', 'gnd.'], + 'weekdays_min' => ['cu.', 'mbe.', 'kab.', 'gtu.', 'kan.', 'gnu.', 'gnd.'], + 'months' => ['Nzero', 'Ruhuhuma', 'Ntwarante', 'Ndamukiza', 'Rusama', 'Ruheshi', 'Mukakaro', 'Nyandagaro', 'Nyakanga', 'Gitugutu', 'Munyonyo', 'Kigarama'], + 'months_short' => ['Mut.', 'Gas.', 'Wer.', 'Mat.', 'Gic.', 'Kam.', 'Nya.', 'Kan.', 'Nze.', 'Ukw.', 'Ugu.', 'Uku.'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + + 'year' => 'imyaka :count', + 'y' => 'imyaka :count', + 'a_year' => 'imyaka :count', + + 'month' => 'amezi :count', + 'm' => 'amezi :count', + 'a_month' => 'amezi :count', + + 'week' => 'indwi :count', + 'w' => 'indwi :count', + 'a_week' => 'indwi :count', + + 'day' => 'imisi :count', + 'd' => 'imisi :count', + 'a_day' => 'imisi :count', + + 'hour' => 'amasaha :count', + 'h' => 'amasaha :count', + 'a_hour' => 'amasaha :count', + + 'minute' => 'iminuta :count', + 'min' => 'iminuta :count', + 'a_minute' => 'iminuta :count', + + 'second' => 'inguvu :count', // less reliable + 's' => 'inguvu :count', // less reliable + 'a_second' => 'inguvu :count', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ro.php b/vendor/nesbot/carbon/src/Carbon/Lang/ro.php new file mode 100644 index 00000000..868a3279 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ro.php @@ -0,0 +1,77 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - JD Isaacks + * - Cătălin Georgescu + * - Valentin Ivaşcu (oriceon) + */ +return [ + 'year' => ':count an|:count ani|:count ani', + 'a_year' => 'un an|:count ani|:count ani', + 'y' => ':count a.', + 'month' => ':count lună|:count luni|:count luni', + 'a_month' => 'o lună|:count luni|:count luni', + 'm' => ':count l.', + 'week' => ':count săptămână|:count săptămâni|:count săptămâni', + 'a_week' => 'o săptămână|:count săptămâni|:count săptămâni', + 'w' => ':count săp.', + 'day' => ':count zi|:count zile|:count zile', + 'a_day' => 'o zi|:count zile|:count zile', + 'd' => ':count z.', + 'hour' => ':count oră|:count ore|:count ore', + 'a_hour' => 'o oră|:count ore|:count ore', + 'h' => ':count o.', + 'minute' => ':count minut|:count minute|:count minute', + 'a_minute' => 'un minut|:count minute|:count minute', + 'min' => ':count m.', + 'second' => ':count secundă|:count secunde|:count secunde', + 'a_second' => 'câteva secunde|:count secunde|:count secunde', + 's' => ':count sec.', + 'ago' => ':time în urmă', + 'from_now' => 'peste :time', + 'after' => 'peste :time', + 'before' => 'acum :time', + 'diff_now' => 'acum', + 'diff_today' => 'azi', + 'diff_today_regexp' => 'azi(?:\\s+la)?', + 'diff_yesterday' => 'ieri', + 'diff_yesterday_regexp' => 'ieri(?:\\s+la)?', + 'diff_tomorrow' => 'mâine', + 'diff_tomorrow_regexp' => 'mâine(?:\\s+la)?', + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY H:mm', + 'LLLL' => 'dddd, D MMMM YYYY H:mm', + ], + 'calendar' => [ + 'sameDay' => '[azi la] LT', + 'nextDay' => '[mâine la] LT', + 'nextWeek' => 'dddd [la] LT', + 'lastDay' => '[ieri la] LT', + 'lastWeek' => '[fosta] dddd [la] LT', + 'sameElse' => 'L', + ], + 'months' => ['ianuarie', 'februarie', 'martie', 'aprilie', 'mai', 'iunie', 'iulie', 'august', 'septembrie', 'octombrie', 'noiembrie', 'decembrie'], + 'months_short' => ['ian.', 'feb.', 'mar.', 'apr.', 'mai', 'iun.', 'iul.', 'aug.', 'sept.', 'oct.', 'nov.', 'dec.'], + 'weekdays' => ['duminică', 'luni', 'marți', 'miercuri', 'joi', 'vineri', 'sâmbătă'], + 'weekdays_short' => ['dum', 'lun', 'mar', 'mie', 'joi', 'vin', 'sâm'], + 'weekdays_min' => ['du', 'lu', 'ma', 'mi', 'jo', 'vi', 'sâ'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' și '], + 'meridiem' => ['a.m.', 'p.m.'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ro_MD.php b/vendor/nesbot/carbon/src/Carbon/Lang/ro_MD.php new file mode 100644 index 00000000..ad1d2fa8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ro_MD.php @@ -0,0 +1,21 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ro.php', [ + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY, HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY, HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ro_RO.php b/vendor/nesbot/carbon/src/Carbon/Lang/ro_RO.php new file mode 100644 index 00000000..102afcde --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ro_RO.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/ro.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/rof.php b/vendor/nesbot/carbon/src/Carbon/Lang/rof.php new file mode 100644 index 00000000..205fc266 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/rof.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['kang’ama', 'kingoto'], + 'weekdays' => ['Ijumapili', 'Ijumatatu', 'Ijumanne', 'Ijumatano', 'Alhamisi', 'Ijumaa', 'Ijumamosi'], + 'weekdays_short' => ['Ijp', 'Ijt', 'Ijn', 'Ijtn', 'Alh', 'Iju', 'Ijm'], + 'weekdays_min' => ['Ijp', 'Ijt', 'Ijn', 'Ijtn', 'Alh', 'Iju', 'Ijm'], + 'months' => ['Mweri wa kwanza', 'Mweri wa kaili', 'Mweri wa katatu', 'Mweri wa kaana', 'Mweri wa tanu', 'Mweri wa sita', 'Mweri wa saba', 'Mweri wa nane', 'Mweri wa tisa', 'Mweri wa ikumi', 'Mweri wa ikumi na moja', 'Mweri wa ikumi na mbili'], + 'months_short' => ['M1', 'M2', 'M3', 'M4', 'M5', 'M6', 'M7', 'M8', 'M9', 'M10', 'M11', 'M12'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ru.php b/vendor/nesbot/carbon/src/Carbon/Lang/ru.php new file mode 100644 index 00000000..673b043b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ru.php @@ -0,0 +1,191 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Bari Badamshin + * - Jørn Ølmheim + * - François B + * - Tim Fish + * - Коренберг Марк (imac) + * - Serhan Apaydın + * - RomeroMsk + * - vsn4ik + * - JD Isaacks + * - Bari Badamshin + * - Jørn Ølmheim + * - François B + * - Коренберг Марк (imac) + * - Serhan Apaydın + * - RomeroMsk + * - vsn4ik + * - JD Isaacks + * - Fellzo + * - andrey-helldar + * - Pavel Skripkin (psxx) + * - AlexWalkerson + * - Vladislav UnsealedOne + * - dima-bzz + */ + +use Carbon\CarbonInterface; + +$transformDiff = function ($input) { + return strtr($input, [ + 'неделя' => 'неделю', + 'секунда' => 'секунду', + 'минута' => 'минуту', + ]); +}; + +return [ + 'year' => ':count год|:count года|:count лет', + 'y' => ':count г.|:count г.|:count л.', + 'a_year' => '{1}год|:count год|:count года|:count лет', + 'month' => ':count месяц|:count месяца|:count месяцев', + 'm' => ':count мес.', + 'a_month' => '{1}месяц|:count месяц|:count месяца|:count месяцев', + 'week' => ':count неделя|:count недели|:count недель', + 'w' => ':count нед.', + 'a_week' => '{1}неделя|:count неделю|:count недели|:count недель', + 'day' => ':count день|:count дня|:count дней', + 'd' => ':count д.', + 'a_day' => '{1}день|:count день|:count дня|:count дней', + 'hour' => ':count час|:count часа|:count часов', + 'h' => ':count ч.', + 'a_hour' => '{1}час|:count час|:count часа|:count часов', + 'minute' => ':count минута|:count минуты|:count минут', + 'min' => ':count мин.', + 'a_minute' => '{1}минута|:count минута|:count минуты|:count минут', + 'second' => ':count секунда|:count секунды|:count секунд', + 's' => ':count сек.', + 'a_second' => '{1}несколько секунд|:count секунду|:count секунды|:count секунд', + 'ago' => function ($time) use ($transformDiff) { + return $transformDiff($time).' назад'; + }, + 'from_now' => function ($time) use ($transformDiff) { + return 'через '.$transformDiff($time); + }, + 'after' => function ($time) use ($transformDiff) { + return $transformDiff($time).' после'; + }, + 'before' => function ($time) use ($transformDiff) { + return $transformDiff($time).' до'; + }, + 'diff_now' => 'только что', + 'diff_today' => 'Сегодня,', + 'diff_today_regexp' => 'Сегодня,?(?:\\s+в)?', + 'diff_yesterday' => 'вчера', + 'diff_yesterday_regexp' => 'Вчера,?(?:\\s+в)?', + 'diff_tomorrow' => 'завтра', + 'diff_tomorrow_regexp' => 'Завтра,?(?:\\s+в)?', + 'diff_before_yesterday' => 'позавчера', + 'diff_after_tomorrow' => 'послезавтра', + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMMM YYYY г.', + 'LLL' => 'D MMMM YYYY г., H:mm', + 'LLLL' => 'dddd, D MMMM YYYY г., H:mm', + ], + 'calendar' => [ + 'sameDay' => '[Сегодня, в] LT', + 'nextDay' => '[Завтра, в] LT', + 'nextWeek' => function (CarbonInterface $current, CarbonInterface $other) { + if ($current->week !== $other->week) { + switch ($current->dayOfWeek) { + case 0: + return '[В следующее] dddd, [в] LT'; + case 1: + case 2: + case 4: + return '[В следующий] dddd, [в] LT'; + case 3: + case 5: + case 6: + return '[В следующую] dddd, [в] LT'; + } + } + + if ($current->dayOfWeek === 2) { + return '[Во] dddd, [в] LT'; + } + + return '[В] dddd, [в] LT'; + }, + 'lastDay' => '[Вчера, в] LT', + 'lastWeek' => function (CarbonInterface $current, CarbonInterface $other) { + if ($current->week !== $other->week) { + switch ($current->dayOfWeek) { + case 0: + return '[В прошлое] dddd, [в] LT'; + case 1: + case 2: + case 4: + return '[В прошлый] dddd, [в] LT'; + case 3: + case 5: + case 6: + return '[В прошлую] dddd, [в] LT'; + } + } + + if ($current->dayOfWeek === 2) { + return '[Во] dddd, [в] LT'; + } + + return '[В] dddd, [в] LT'; + }, + 'sameElse' => 'L', + ], + 'ordinal' => function ($number, $period) { + switch ($period) { + case 'M': + case 'd': + case 'DDD': + return $number.'-й'; + case 'D': + return $number.'-го'; + case 'w': + case 'W': + return $number.'-я'; + default: + return $number; + } + }, + 'meridiem' => function ($hour) { + if ($hour < 4) { + return 'ночи'; + } + if ($hour < 12) { + return 'утра'; + } + if ($hour < 17) { + return 'дня'; + } + + return 'вечера'; + }, + 'months' => ['января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря'], + 'months_standalone' => ['январь', 'февраль', 'март', 'апрель', 'май', 'июнь', 'июль', 'август', 'сентябрь', 'октябрь', 'ноябрь', 'декабрь'], + 'months_short' => ['янв', 'фев', 'мар', 'апр', 'мая', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек'], + 'months_short_standalone' => ['янв', 'фев', 'мар', 'апр', 'май', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек'], + 'months_regexp' => '/(DD?o?\.?(\[[^\[\]]*\]|\s)+MMMM?|L{2,4}|l{2,4})/', + 'weekdays' => ['воскресенье', 'понедельник', 'вторник', 'среду', 'четверг', 'пятницу', 'субботу'], + 'weekdays_standalone' => ['воскресенье', 'понедельник', 'вторник', 'среда', 'четверг', 'пятница', 'суббота'], + 'weekdays_short' => ['вск', 'пнд', 'втр', 'срд', 'чтв', 'птн', 'сбт'], + 'weekdays_min' => ['вс', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'], + 'weekdays_regexp' => '/\[\s*(В|в)\s*((?:прошлую|следующую|эту)\s*)?\]\s*dddd/', + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' и '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ru_BY.php b/vendor/nesbot/carbon/src/Carbon/Lang/ru_BY.php new file mode 100644 index 00000000..8ca7df34 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ru_BY.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/ru.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ru_KG.php b/vendor/nesbot/carbon/src/Carbon/Lang/ru_KG.php new file mode 100644 index 00000000..8ca7df34 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ru_KG.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/ru.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ru_KZ.php b/vendor/nesbot/carbon/src/Carbon/Lang/ru_KZ.php new file mode 100644 index 00000000..8ca7df34 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ru_KZ.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/ru.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ru_MD.php b/vendor/nesbot/carbon/src/Carbon/Lang/ru_MD.php new file mode 100644 index 00000000..8ca7df34 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ru_MD.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/ru.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ru_RU.php b/vendor/nesbot/carbon/src/Carbon/Lang/ru_RU.php new file mode 100644 index 00000000..8ca7df34 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ru_RU.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/ru.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ru_UA.php b/vendor/nesbot/carbon/src/Carbon/Lang/ru_UA.php new file mode 100644 index 00000000..db958d68 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ru_UA.php @@ -0,0 +1,20 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - RFC 2319 bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/ru.php', [ + 'weekdays' => ['воскресенье', 'понедельник', 'вторник', 'среда', 'четверг', 'пятница', 'суббота'], + 'weekdays_short' => ['вск', 'пнд', 'вто', 'срд', 'чтв', 'птн', 'суб'], + 'weekdays_min' => ['вс', 'пн', 'вт', 'ср', 'чт', 'пт', 'су'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/rw.php b/vendor/nesbot/carbon/src/Carbon/Lang/rw.php new file mode 100644 index 00000000..bc4a347f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/rw.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/rw_RW.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/rw_RW.php b/vendor/nesbot/carbon/src/Carbon/Lang/rw_RW.php new file mode 100644 index 00000000..9b3e0682 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/rw_RW.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Rwanda Steve Murphy murf@e-tools.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD.MM.YYYY', + ], + 'months' => ['Mutarama', 'Gashyantare', 'Werurwe', 'Mata', 'Gicuransi', 'Kamena', 'Nyakanga', 'Kanama', 'Nzeli', 'Ukwakira', 'Ugushyingo', 'Ukuboza'], + 'months_short' => ['Mut', 'Gas', 'Wer', 'Mat', 'Gic', 'Kam', 'Nya', 'Kan', 'Nze', 'Ukw', 'Ugu', 'Uku'], + 'weekdays' => ['Ku cyumweru', 'Kuwa mbere', 'Kuwa kabiri', 'Kuwa gatatu', 'Kuwa kane', 'Kuwa gatanu', 'Kuwa gatandatu'], + 'weekdays_short' => ['Mwe', 'Mbe', 'Kab', 'Gtu', 'Kan', 'Gnu', 'Gnd'], + 'weekdays_min' => ['Mwe', 'Mbe', 'Kab', 'Gtu', 'Kan', 'Gnu', 'Gnd'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + + 'second' => ':count vuna', // less reliable + 's' => ':count vuna', // less reliable + 'a_second' => ':count vuna', // less reliable + + 'year' => 'aka :count', + 'y' => 'aka :count', + 'a_year' => 'aka :count', + + 'month' => 'ezi :count', + 'm' => 'ezi :count', + 'a_month' => 'ezi :count', + + 'week' => ':count icyumweru', + 'w' => ':count icyumweru', + 'a_week' => ':count icyumweru', + + 'day' => ':count nsi', + 'd' => ':count nsi', + 'a_day' => ':count nsi', + + 'hour' => 'saha :count', + 'h' => 'saha :count', + 'a_hour' => 'saha :count', + + 'minute' => ':count -nzinya', + 'min' => ':count -nzinya', + 'a_minute' => ':count -nzinya', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/rwk.php b/vendor/nesbot/carbon/src/Carbon/Lang/rwk.php new file mode 100644 index 00000000..ed92e8e7 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/rwk.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['utuko', 'kyiukonyi'], + 'weekdays' => ['Jumapilyi', 'Jumatatuu', 'Jumanne', 'Jumatanu', 'Alhamisi', 'Ijumaa', 'Jumamosi'], + 'weekdays_short' => ['Jpi', 'Jtt', 'Jnn', 'Jtn', 'Alh', 'Iju', 'Jmo'], + 'weekdays_min' => ['Jpi', 'Jtt', 'Jnn', 'Jtn', 'Alh', 'Iju', 'Jmo'], + 'months' => ['Januari', 'Februari', 'Machi', 'Aprilyi', 'Mei', 'Junyi', 'Julyai', 'Agusti', 'Septemba', 'Oktoba', 'Novemba', 'Desemba'], + 'months_short' => ['Jan', 'Feb', 'Mac', 'Apr', 'Mei', 'Jun', 'Jul', 'Ago', 'Sep', 'Okt', 'Nov', 'Des'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sa.php b/vendor/nesbot/carbon/src/Carbon/Lang/sa.php new file mode 100644 index 00000000..1357c030 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sa.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/sa_IN.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sa_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/sa_IN.php new file mode 100644 index 00000000..cfda9a63 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sa_IN.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - The Debian project Christian Perrier bubulle@debian.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'D-MM-YY', + ], + 'months' => ['जनवरी', 'फ़रवरी', 'मार्च', 'अप्रेल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितम्बर', 'अक्टूबर', 'नवम्बर', 'दिसम्बर'], + 'months_short' => ['जनवरी', 'फ़रवरी', 'मार्च', 'अप्रेल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितम्बर', 'अक्टूबर', 'नवम्बर', 'दिसम्बर'], + 'weekdays' => ['रविवासर:', 'सोमवासर:', 'मंगलवासर:', 'बुधवासर:', 'बृहस्पतिवासरः', 'शुक्रवासर', 'शनिवासर:'], + 'weekdays_short' => ['रविः', 'सोम:', 'मंगल:', 'बुध:', 'बृहस्पतिः', 'शुक्र', 'शनि:'], + 'weekdays_min' => ['रविः', 'सोम:', 'मंगल:', 'बुध:', 'बृहस्पतिः', 'शुक्र', 'शनि:'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['पूर्वाह्न', 'अपराह्न'], + + 'minute' => ':count होरा', // less reliable + 'min' => ':count होरा', // less reliable + 'a_minute' => ':count होरा', // less reliable + + 'year' => ':count वर्ष', + 'y' => ':count वर्ष', + 'a_year' => ':count वर्ष', + + 'month' => ':count मास', + 'm' => ':count मास', + 'a_month' => ':count मास', + + 'week' => ':count सप्ताहः saptahaĥ', + 'w' => ':count सप्ताहः saptahaĥ', + 'a_week' => ':count सप्ताहः saptahaĥ', + + 'day' => ':count दिन', + 'd' => ':count दिन', + 'a_day' => ':count दिन', + + 'hour' => ':count घण्टा', + 'h' => ':count घण्टा', + 'a_hour' => ':count घण्टा', + + 'second' => ':count द्वितीयः', + 's' => ':count द्वितीयः', + 'a_second' => ':count द्वितीयः', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sah.php b/vendor/nesbot/carbon/src/Carbon/Lang/sah.php new file mode 100644 index 00000000..b8288242 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sah.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/sah_RU.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sah_RU.php b/vendor/nesbot/carbon/src/Carbon/Lang/sah_RU.php new file mode 100644 index 00000000..94cc0cb0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sah_RU.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Valery Timiriliyev Valery Timiriliyev timiriliyev@gmail.com + */ +return array_replace_recursive(require __DIR__.'/ru.php', [ + 'formats' => [ + 'L' => 'YYYY.MM.DD', + ], + 'months' => ['тохсунньу', 'олунньу', 'кулун тутар', 'муус устар', 'ыам ыйын', 'бэс ыйын', 'от ыйын', 'атырдьах ыйын', 'балаҕан ыйын', 'алтынньы', 'сэтинньи', 'ахсынньы'], + 'months_short' => ['тохс', 'олун', 'кул', 'муус', 'ыам', 'бэс', 'от', 'атыр', 'бал', 'алт', 'сэт', 'ахс'], + 'weekdays' => ['баскыһыанньа', 'бэнидиэнньик', 'оптуорунньук', 'сэрэдэ', 'чэппиэр', 'бээтинсэ', 'субуота'], + 'weekdays_short' => ['бс', 'бн', 'оп', 'ср', 'чп', 'бт', 'сб'], + 'weekdays_min' => ['бс', 'бн', 'оп', 'ср', 'чп', 'бт', 'сб'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/saq.php b/vendor/nesbot/carbon/src/Carbon/Lang/saq.php new file mode 100644 index 00000000..ff8bf604 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/saq.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['Tesiran', 'Teipa'], + 'weekdays' => ['Mderot ee are', 'Mderot ee kuni', 'Mderot ee ong’wan', 'Mderot ee inet', 'Mderot ee ile', 'Mderot ee sapa', 'Mderot ee kwe'], + 'weekdays_short' => ['Are', 'Kun', 'Ong', 'Ine', 'Ile', 'Sap', 'Kwe'], + 'weekdays_min' => ['Are', 'Kun', 'Ong', 'Ine', 'Ile', 'Sap', 'Kwe'], + 'months' => ['Lapa le obo', 'Lapa le waare', 'Lapa le okuni', 'Lapa le ong’wan', 'Lapa le imet', 'Lapa le ile', 'Lapa le sapa', 'Lapa le isiet', 'Lapa le saal', 'Lapa le tomon', 'Lapa le tomon obo', 'Lapa le tomon waare'], + 'months_short' => ['Obo', 'Waa', 'Oku', 'Ong', 'Ime', 'Ile', 'Sap', 'Isi', 'Saa', 'Tom', 'Tob', 'Tow'], + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sat.php b/vendor/nesbot/carbon/src/Carbon/Lang/sat.php new file mode 100644 index 00000000..c9914c66 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sat.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/sat_IN.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sat_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/sat_IN.php new file mode 100644 index 00000000..632b1af6 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sat_IN.php @@ -0,0 +1,54 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Red Hat Pune libc-alpha@sourceware.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'D/M/YY', + ], + 'months' => ['जनवरी', 'फरवरी', 'मार्च', 'अप्रेल', 'मई', 'जुन', 'जुलाई', 'अगस्त', 'सितम्बर', 'अखथबर', 'नवम्बर', 'दिसम्बर'], + 'months_short' => ['जनवरी', 'फरवरी', 'मार्च', 'अप्रेल', 'मई', 'जुन', 'जुलाई', 'अगस्त', 'सितम्बर', 'अखथबर', 'नवम्बर', 'दिसम्बर'], + 'weekdays' => ['सिंगेमाँहाँ', 'ओतेमाँहाँ', 'बालेमाँहाँ', 'सागुनमाँहाँ', 'सारदीमाँहाँ', 'जारुममाँहाँ', 'ञुहुममाँहाँ'], + 'weekdays_short' => ['सिंगे', 'ओते', 'बाले', 'सागुन', 'सारदी', 'जारुम', 'ञुहुम'], + 'weekdays_min' => ['सिंगे', 'ओते', 'बाले', 'सागुन', 'सारदी', 'जारुम', 'ञुहुम'], + 'day_of_first_week_of_year' => 1, + + 'month' => ':count ńindạ cando', // less reliable + 'm' => ':count ńindạ cando', // less reliable + 'a_month' => ':count ńindạ cando', // less reliable + + 'week' => ':count mãhã', // less reliable + 'w' => ':count mãhã', // less reliable + 'a_week' => ':count mãhã', // less reliable + + 'hour' => ':count ᱥᱳᱱᱚ', // less reliable + 'h' => ':count ᱥᱳᱱᱚ', // less reliable + 'a_hour' => ':count ᱥᱳᱱᱚ', // less reliable + + 'minute' => ':count ᱯᱤᱞᱪᱩ', // less reliable + 'min' => ':count ᱯᱤᱞᱪᱩ', // less reliable + 'a_minute' => ':count ᱯᱤᱞᱪᱩ', // less reliable + + 'second' => ':count ar', // less reliable + 's' => ':count ar', // less reliable + 'a_second' => ':count ar', // less reliable + + 'year' => ':count ne̲s', + 'y' => ':count ne̲s', + 'a_year' => ':count ne̲s', + + 'day' => ':count ᱫᱤᱱ', + 'd' => ':count ᱫᱤᱱ', + 'a_day' => ':count ᱫᱤᱱ', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sbp.php b/vendor/nesbot/carbon/src/Carbon/Lang/sbp.php new file mode 100644 index 00000000..e29ca379 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sbp.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['Lwamilawu', 'Pashamihe'], + 'weekdays' => ['Mulungu', 'Jumatatu', 'Jumanne', 'Jumatano', 'Alahamisi', 'Ijumaa', 'Jumamosi'], + 'weekdays_short' => ['Mul', 'Jtt', 'Jnn', 'Jtn', 'Alh', 'Iju', 'Jmo'], + 'weekdays_min' => ['Mul', 'Jtt', 'Jnn', 'Jtn', 'Alh', 'Iju', 'Jmo'], + 'months' => ['Mupalangulwa', 'Mwitope', 'Mushende', 'Munyi', 'Mushende Magali', 'Mujimbi', 'Mushipepo', 'Mupuguto', 'Munyense', 'Mokhu', 'Musongandembwe', 'Muhaano'], + 'months_short' => ['Mup', 'Mwi', 'Msh', 'Mun', 'Mag', 'Muj', 'Msp', 'Mpg', 'Mye', 'Mok', 'Mus', 'Muh'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sc.php b/vendor/nesbot/carbon/src/Carbon/Lang/sc.php new file mode 100644 index 00000000..7178cf4f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sc.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/sc_IT.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sc_IT.php b/vendor/nesbot/carbon/src/Carbon/Lang/sc_IT.php new file mode 100644 index 00000000..5d1e4cec --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sc_IT.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Sardinian Translators Team Massimeddu Cireddu massimeddu@gmail.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD. MM. YY', + ], + 'months' => ['Ghennàrgiu', 'Freàrgiu', 'Martzu', 'Abrile', 'Maju', 'Làmpadas', 'Argiolas//Trìulas', 'Austu', 'Cabudanni', 'Santugaine//Ladàmine', 'Onniasantu//Santandria', 'Nadale//Idas'], + 'months_short' => ['Ghe', 'Fre', 'Mar', 'Abr', 'Maj', 'Làm', 'Arg', 'Aus', 'Cab', 'Lad', 'Onn', 'Nad'], + 'weekdays' => ['Domìnigu', 'Lunis', 'Martis', 'Mèrcuris', 'Giòbia', 'Chenàbura', 'Sàbadu'], + 'weekdays_short' => ['Dom', 'Lun', 'Mar', 'Mèr', 'Giò', 'Che', 'Sàb'], + 'weekdays_min' => ['Dom', 'Lun', 'Mar', 'Mèr', 'Giò', 'Che', 'Sàb'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + + 'minute' => ':count mementu', // less reliable + 'min' => ':count mementu', // less reliable + 'a_minute' => ':count mementu', // less reliable + + 'year' => ':count annu', + 'y' => ':count annu', + 'a_year' => ':count annu', + + 'month' => ':count mese', + 'm' => ':count mese', + 'a_month' => ':count mese', + + 'week' => ':count chida', + 'w' => ':count chida', + 'a_week' => ':count chida', + + 'day' => ':count dí', + 'd' => ':count dí', + 'a_day' => ':count dí', + + 'hour' => ':count ora', + 'h' => ':count ora', + 'a_hour' => ':count ora', + + 'second' => ':count secundu', + 's' => ':count secundu', + 'a_second' => ':count secundu', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sd.php b/vendor/nesbot/carbon/src/Carbon/Lang/sd.php new file mode 100644 index 00000000..0022c5a9 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sd.php @@ -0,0 +1,81 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +$months = [ + 'جنوري', + 'فيبروري', + 'مارچ', + 'اپريل', + 'مئي', + 'جون', + 'جولاءِ', + 'آگسٽ', + 'سيپٽمبر', + 'آڪٽوبر', + 'نومبر', + 'ڊسمبر', +]; + +$weekdays = [ + 'آچر', + 'سومر', + 'اڱارو', + 'اربع', + 'خميس', + 'جمع', + 'ڇنڇر', +]; + +/* + * Authors: + * - Narain Sagar + * - Sawood Alam + * - Narain Sagar + */ +return [ + 'year' => '{1}'.'هڪ سال'.'|:count '.'سال', + 'month' => '{1}'.'هڪ مهينو'.'|:count '.'مهينا', + 'week' => '{1}'.'ھڪ ھفتو'.'|:count '.'هفتا', + 'day' => '{1}'.'هڪ ڏينهن'.'|:count '.'ڏينهن', + 'hour' => '{1}'.'هڪ ڪلاڪ'.'|:count '.'ڪلاڪ', + 'minute' => '{1}'.'هڪ منٽ'.'|:count '.'منٽ', + 'second' => '{1}'.'چند سيڪنڊ'.'|:count '.'سيڪنڊ', + 'ago' => ':time اڳ', + 'from_now' => ':time پوء', + 'diff_yesterday' => 'ڪالهه', + 'diff_today' => 'اڄ', + 'diff_tomorrow' => 'سڀاڻي', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd، D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[اڄ] LT', + 'nextDay' => '[سڀاڻي] LT', + 'nextWeek' => 'dddd [اڳين هفتي تي] LT', + 'lastDay' => '[ڪالهه] LT', + 'lastWeek' => '[گزريل هفتي] dddd [تي] LT', + 'sameElse' => 'L', + ], + 'meridiem' => ['صبح', 'شام'], + 'months' => $months, + 'months_short' => $months, + 'weekdays' => $weekdays, + 'weekdays_short' => $weekdays, + 'weekdays_min' => $weekdays, + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => ['، ', ' ۽ '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sd_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/sd_IN.php new file mode 100644 index 00000000..de1dad05 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sd_IN.php @@ -0,0 +1,26 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Red Hat, Pune bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/sd.php', [ + 'formats' => [ + 'L' => 'D/M/YY', + ], + 'months' => ['جنوري', 'فبروري', 'مارچ', 'اپريل', 'مي', 'جون', 'جولاءِ', 'آگسٽ', 'سيپٽيمبر', 'آڪٽوبر', 'نومبر', 'ڊسمبر'], + 'months_short' => ['جنوري', 'فبروري', 'مارچ', 'اپريل', 'مي', 'جون', 'جولاءِ', 'آگسٽ', 'سيپٽيمبر', 'آڪٽوبر', 'نومبر', 'ڊسمبر'], + 'weekdays' => ['آرتوارُ', 'سومرُ', 'منگلُ', 'ٻُڌرُ', 'وسپت', 'جُمو', 'ڇنڇر'], + 'weekdays_short' => ['آرتوارُ', 'سومرُ', 'منگلُ', 'ٻُڌرُ', 'وسپت', 'جُمو', 'ڇنڇر'], + 'weekdays_min' => ['آرتوارُ', 'سومرُ', 'منگلُ', 'ٻُڌرُ', 'وسپت', 'جُمو', 'ڇنڇر'], + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sd_IN@devanagari.php b/vendor/nesbot/carbon/src/Carbon/Lang/sd_IN@devanagari.php new file mode 100644 index 00000000..061fcc16 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sd_IN@devanagari.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Red Hat, Pune bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/sd.php', [ + 'formats' => [ + 'L' => 'D/M/YY', + ], + 'months' => ['जनवरी', 'फबरवरी', 'मार्चि', 'अप्रेल', 'मे', 'जूनि', 'जूलाइ', 'आगस्टु', 'सेप्टेंबरू', 'आक्टूबरू', 'नवंबरू', 'ॾिसंबरू'], + 'months_short' => ['जनवरी', 'फबरवरी', 'मार्चि', 'अप्रेल', 'मे', 'जूनि', 'जूलाइ', 'आगस्टु', 'सेप्टेंबरू', 'आक्टूबरू', 'नवंबरू', 'ॾिसंबरू'], + 'weekdays' => ['आर्तवारू', 'सूमरू', 'मंगलू', 'ॿुधरू', 'विस्पति', 'जुमो', 'छंछस'], + 'weekdays_short' => ['आर्तवारू', 'सूमरू', 'मंगलू', 'ॿुधरू', 'विस्पति', 'जुमो', 'छंछस'], + 'weekdays_min' => ['आर्तवारू', 'सूमरू', 'मंगलू', 'ॿुधरू', 'विस्पति', 'जुमो', 'छंछस'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['म.पू.', 'म.नं.'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/se.php b/vendor/nesbot/carbon/src/Carbon/Lang/se.php new file mode 100644 index 00000000..7c4b92a5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/se.php @@ -0,0 +1,73 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - François B + * - Karamell + */ +return [ + 'year' => '{1}:count jahki|:count jagit', + 'a_year' => '{1}okta jahki|:count jagit', + 'y' => ':count j.', + 'month' => '{1}:count mánnu|:count mánut', + 'a_month' => '{1}okta mánnu|:count mánut', + 'm' => ':count mán.', + 'week' => '{1}:count vahkku|:count vahkku', + 'a_week' => '{1}okta vahkku|:count vahkku', + 'w' => ':count v.', + 'day' => '{1}:count beaivi|:count beaivvit', + 'a_day' => '{1}okta beaivi|:count beaivvit', + 'd' => ':count b.', + 'hour' => '{1}:count diimmu|:count diimmut', + 'a_hour' => '{1}okta diimmu|:count diimmut', + 'h' => ':count d.', + 'minute' => '{1}:count minuhta|:count minuhtat', + 'a_minute' => '{1}okta minuhta|:count minuhtat', + 'min' => ':count min.', + 'second' => '{1}:count sekunddat|:count sekunddat', + 'a_second' => '{1}moadde sekunddat|:count sekunddat', + 's' => ':count s.', + 'ago' => 'maŋit :time', + 'from_now' => ':time geažes', + 'diff_yesterday' => 'ikte', + 'diff_yesterday_regexp' => 'ikte(?:\\s+ti)?', + 'diff_today' => 'otne', + 'diff_today_regexp' => 'otne(?:\\s+ti)?', + 'diff_tomorrow' => 'ihttin', + 'diff_tomorrow_regexp' => 'ihttin(?:\\s+ti)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'MMMM D. [b.] YYYY', + 'LLL' => 'MMMM D. [b.] YYYY [ti.] HH:mm', + 'LLLL' => 'dddd, MMMM D. [b.] YYYY [ti.] HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[otne ti] LT', + 'nextDay' => '[ihttin ti] LT', + 'nextWeek' => 'dddd [ti] LT', + 'lastDay' => '[ikte ti] LT', + 'lastWeek' => '[ovddit] dddd [ti] LT', + 'sameElse' => 'L', + ], + 'ordinal' => ':number.', + 'months' => ['ođđajagemánnu', 'guovvamánnu', 'njukčamánnu', 'cuoŋománnu', 'miessemánnu', 'geassemánnu', 'suoidnemánnu', 'borgemánnu', 'čakčamánnu', 'golggotmánnu', 'skábmamánnu', 'juovlamánnu'], + 'months_short' => ['ođđj', 'guov', 'njuk', 'cuo', 'mies', 'geas', 'suoi', 'borg', 'čakč', 'golg', 'skáb', 'juov'], + 'weekdays' => ['sotnabeaivi', 'vuossárga', 'maŋŋebárga', 'gaskavahkku', 'duorastat', 'bearjadat', 'lávvardat'], + 'weekdays_short' => ['sotn', 'vuos', 'maŋ', 'gask', 'duor', 'bear', 'láv'], + 'weekdays_min' => ['s', 'v', 'm', 'g', 'd', 'b', 'L'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' ja '], + 'meridiem' => ['i.b.', 'e.b.'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/se_FI.php b/vendor/nesbot/carbon/src/Carbon/Lang/se_FI.php new file mode 100644 index 00000000..cf01805d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/se_FI.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/se.php', [ + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'months' => ['ođđajagemánnu', 'guovvamánnu', 'njukčamánnu', 'cuoŋománnu', 'miessemánnu', 'geassemánnu', 'suoidnemánnu', 'borgemánnu', 'čakčamánnu', 'golggotmánnu', 'skábmamánnu', 'juovlamánnu'], + 'months_short' => ['ođđj', 'guov', 'njuk', 'cuoŋ', 'mies', 'geas', 'suoi', 'borg', 'čakč', 'golg', 'skáb', 'juov'], + 'weekdays' => ['sotnabeaivi', 'mánnodat', 'disdat', 'gaskavahkku', 'duorastat', 'bearjadat', 'lávvordat'], + 'weekdays_short' => ['so', 'má', 'di', 'ga', 'du', 'be', 'lá'], + 'weekdays_min' => ['so', 'má', 'di', 'ga', 'du', 'be', 'lá'], + 'meridiem' => ['i', 'e'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/se_NO.php b/vendor/nesbot/carbon/src/Carbon/Lang/se_NO.php new file mode 100644 index 00000000..177c7e94 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/se_NO.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/se.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/se_SE.php b/vendor/nesbot/carbon/src/Carbon/Lang/se_SE.php new file mode 100644 index 00000000..177c7e94 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/se_SE.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/se.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/seh.php b/vendor/nesbot/carbon/src/Carbon/Lang/seh.php new file mode 100644 index 00000000..babf9afb --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/seh.php @@ -0,0 +1,26 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'weekdays' => ['Dimingu', 'Chiposi', 'Chipiri', 'Chitatu', 'Chinai', 'Chishanu', 'Sabudu'], + 'weekdays_short' => ['Dim', 'Pos', 'Pir', 'Tat', 'Nai', 'Sha', 'Sab'], + 'weekdays_min' => ['Dim', 'Pos', 'Pir', 'Tat', 'Nai', 'Sha', 'Sab'], + 'months' => ['Janeiro', 'Fevreiro', 'Marco', 'Abril', 'Maio', 'Junho', 'Julho', 'Augusto', 'Setembro', 'Otubro', 'Novembro', 'Decembro'], + 'months_short' => ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Aug', 'Set', 'Otu', 'Nov', 'Dec'], + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'd [de] MMM [de] YYYY', + 'LLL' => 'd [de] MMMM [de] YYYY HH:mm', + 'LLLL' => 'dddd, d [de] MMMM [de] YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ses.php b/vendor/nesbot/carbon/src/Carbon/Lang/ses.php new file mode 100644 index 00000000..e1099e65 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ses.php @@ -0,0 +1,56 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['Adduha', 'Aluula'], + 'weekdays' => ['Alhadi', 'Atinni', 'Atalaata', 'Alarba', 'Alhamiisa', 'Alzuma', 'Asibti'], + 'weekdays_short' => ['Alh', 'Ati', 'Ata', 'Ala', 'Alm', 'Alz', 'Asi'], + 'weekdays_min' => ['Alh', 'Ati', 'Ata', 'Ala', 'Alm', 'Alz', 'Asi'], + 'months' => ['Žanwiye', 'Feewiriye', 'Marsi', 'Awiril', 'Me', 'Žuweŋ', 'Žuyye', 'Ut', 'Sektanbur', 'Oktoobur', 'Noowanbur', 'Deesanbur'], + 'months_short' => ['Žan', 'Fee', 'Mar', 'Awi', 'Me', 'Žuw', 'Žuy', 'Ut', 'Sek', 'Okt', 'Noo', 'Dee'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + + 'month' => ':count alaada', // less reliable + 'm' => ':count alaada', // less reliable + 'a_month' => ':count alaada', // less reliable + + 'hour' => ':count ɲaajin', // less reliable + 'h' => ':count ɲaajin', // less reliable + 'a_hour' => ':count ɲaajin', // less reliable + + 'minute' => ':count zarbu', // less reliable + 'min' => ':count zarbu', // less reliable + 'a_minute' => ':count zarbu', // less reliable + + 'year' => ':count jiiri', + 'y' => ':count jiiri', + 'a_year' => ':count jiiri', + + 'week' => ':count jirbiiyye', + 'w' => ':count jirbiiyye', + 'a_week' => ':count jirbiiyye', + + 'day' => ':count zaari', + 'd' => ':count zaari', + 'a_day' => ':count zaari', + + 'second' => ':count ihinkante', + 's' => ':count ihinkante', + 'a_second' => ':count ihinkante', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sg.php b/vendor/nesbot/carbon/src/Carbon/Lang/sg.php new file mode 100644 index 00000000..9264e893 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sg.php @@ -0,0 +1,52 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['ND', 'LK'], + 'weekdays' => ['Bikua-ôko', 'Bïkua-ûse', 'Bïkua-ptâ', 'Bïkua-usïö', 'Bïkua-okü', 'Lâpôsö', 'Lâyenga'], + 'weekdays_short' => ['Bk1', 'Bk2', 'Bk3', 'Bk4', 'Bk5', 'Lâp', 'Lây'], + 'weekdays_min' => ['Bk1', 'Bk2', 'Bk3', 'Bk4', 'Bk5', 'Lâp', 'Lây'], + 'months' => ['Nyenye', 'Fulundïgi', 'Mbängü', 'Ngubùe', 'Bêläwü', 'Föndo', 'Lengua', 'Kükürü', 'Mvuka', 'Ngberere', 'Nabändüru', 'Kakauka'], + 'months_short' => ['Nye', 'Ful', 'Mbä', 'Ngu', 'Bêl', 'Fön', 'Len', 'Kük', 'Mvu', 'Ngb', 'Nab', 'Kak'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMM, YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + + 'year' => ':count dā', // less reliable + 'y' => ':count dā', // less reliable + 'a_year' => ':count dā', // less reliable + + 'week' => ':count bïkua-okü', // less reliable + 'w' => ':count bïkua-okü', // less reliable + 'a_week' => ':count bïkua-okü', // less reliable + + 'day' => ':count ziggawâ', // less reliable + 'd' => ':count ziggawâ', // less reliable + 'a_day' => ':count ziggawâ', // less reliable + + 'hour' => ':count yângâködörö', // less reliable + 'h' => ':count yângâködörö', // less reliable + 'a_hour' => ':count yângâködörö', // less reliable + + 'second' => ':count bïkua-ôko', // less reliable + 's' => ':count bïkua-ôko', // less reliable + 'a_second' => ':count bïkua-ôko', // less reliable + + 'month' => ':count Nze tî ngu', + 'm' => ':count Nze tî ngu', + 'a_month' => ':count Nze tî ngu', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sgs.php b/vendor/nesbot/carbon/src/Carbon/Lang/sgs.php new file mode 100644 index 00000000..864b9892 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sgs.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/sgs_LT.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sgs_LT.php b/vendor/nesbot/carbon/src/Carbon/Lang/sgs_LT.php new file mode 100644 index 00000000..aa9e942e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sgs_LT.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Arnas Udovičius bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'YYYY.MM.DD', + ], + 'months' => ['sausė', 'vasarė', 'kuova', 'balondė', 'gegožės', 'bėrželė', 'lëpas', 'rogpjūtė', 'siejės', 'spalė', 'lapkrėstė', 'grůdė'], + 'months_short' => ['Sau', 'Vas', 'Kuo', 'Bal', 'Geg', 'Bėr', 'Lëp', 'Rgp', 'Sie', 'Spa', 'Lap', 'Grd'], + 'weekdays' => ['nedielės dëna', 'panedielis', 'oterninks', 'sereda', 'četvergs', 'petnīčė', 'sobata'], + 'weekdays_short' => ['Nd', 'Pn', 'Ot', 'Sr', 'Čt', 'Pt', 'Sb'], + 'weekdays_min' => ['Nd', 'Pn', 'Ot', 'Sr', 'Čt', 'Pt', 'Sb'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + + 'minute' => ':count mažos', // less reliable + 'min' => ':count mažos', // less reliable + 'a_minute' => ':count mažos', // less reliable + + 'year' => ':count metā', + 'y' => ':count metā', + 'a_year' => ':count metā', + + 'month' => ':count mienou', + 'm' => ':count mienou', + 'a_month' => ':count mienou', + + 'week' => ':count nedielė', + 'w' => ':count nedielė', + 'a_week' => ':count nedielė', + + 'day' => ':count dīna', + 'd' => ':count dīna', + 'a_day' => ':count dīna', + + 'hour' => ':count adīna', + 'h' => ':count adīna', + 'a_hour' => ':count adīna', + + 'second' => ':count Sekondė', + 's' => ':count Sekondė', + 'a_second' => ':count Sekondė', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sh.php b/vendor/nesbot/carbon/src/Carbon/Lang/sh.php new file mode 100644 index 00000000..e03b5067 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sh.php @@ -0,0 +1,68 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +// @codeCoverageIgnoreStart +use Symfony\Component\Translation\PluralizationRules; + +if (class_exists('Symfony\\Component\\Translation\\PluralizationRules')) { + PluralizationRules::set(static function ($number) { + return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); + }, 'sh'); +} +// @codeCoverageIgnoreEnd + +/* + * Authors: + * - Томица Кораћ + * - Enrique Vidal + * - Christopher Dell + * - dmilisic + * - danijel + * - Miroslav Matkovic (mikki021) + */ +return [ + 'diff_now' => 'sada', + 'diff_yesterday' => 'juče', + 'diff_tomorrow' => 'sutra', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'MMMM D, YYYY', + 'LLL' => 'DD MMM HH:mm', + 'LLLL' => 'MMMM DD, YYYY HH:mm', + ], + 'year' => ':count godina|:count godine|:count godina', + 'y' => ':count g.', + 'month' => ':count mesec|:count meseca|:count meseci', + 'm' => ':count m.', + 'week' => ':count nedelja|:count nedelje|:count nedelja', + 'w' => ':count n.', + 'day' => ':count dan|:count dana|:count dana', + 'd' => ':count d.', + 'hour' => ':count sat|:count sata|:count sati', + 'h' => ':count č.', + 'minute' => ':count minut|:count minuta|:count minuta', + 'min' => ':count min.', + 'second' => ':count sekund|:count sekunde|:count sekundi', + 's' => ':count s.', + 'ago' => 'pre :time', + 'from_now' => 'za :time', + 'after' => 'nakon :time', + 'before' => ':time raniјe', + 'weekdays' => ['Nedelja', 'Ponedeljak', 'Utorak', 'Sreda', 'Četvrtak', 'Petak', 'Subota'], + 'weekdays_short' => ['Ned', 'Pon', 'Uto', 'Sre', 'Čet', 'Pet', 'Sub'], + 'weekdays_min' => ['Ned', 'Pon', 'Uto', 'Sre', 'Čet', 'Pet', 'Sub'], + 'months' => ['Januar', 'Februar', 'Mart', 'April', 'Maj', 'Jun', 'Jul', 'Avgust', 'Septembar', 'Oktobar', 'Novembar', 'Decembar'], + 'months_short' => ['Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Avg', 'Sep', 'Okt', 'Nov', 'Dec'], + 'list' => [', ', ' i '], + 'meridiem' => ['pre podne', 'po podne'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/shi.php b/vendor/nesbot/carbon/src/Carbon/Lang/shi.php new file mode 100644 index 00000000..78151869 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/shi.php @@ -0,0 +1,57 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['ⵜⵉⴼⴰⵡⵜ', 'ⵜⴰⴷⴳⴳⵯⴰⵜ'], + 'weekdays' => ['ⴰⵙⴰⵎⴰⵙ', 'ⴰⵢⵏⴰⵙ', 'ⴰⵙⵉⵏⴰⵙ', 'ⴰⴽⵕⴰⵙ', 'ⴰⴽⵡⴰⵙ', 'ⵙⵉⵎⵡⴰⵙ', 'ⴰⵙⵉⴹⵢⴰⵙ'], + 'weekdays_short' => ['ⴰⵙⴰ', 'ⴰⵢⵏ', 'ⴰⵙⵉ', 'ⴰⴽⵕ', 'ⴰⴽⵡ', 'ⴰⵙⵉⵎ', 'ⴰⵙⵉⴹ'], + 'weekdays_min' => ['ⴰⵙⴰ', 'ⴰⵢⵏ', 'ⴰⵙⵉ', 'ⴰⴽⵕ', 'ⴰⴽⵡ', 'ⴰⵙⵉⵎ', 'ⴰⵙⵉⴹ'], + 'months' => ['ⵉⵏⵏⴰⵢⵔ', 'ⴱⵕⴰⵢⵕ', 'ⵎⴰⵕⵚ', 'ⵉⴱⵔⵉⵔ', 'ⵎⴰⵢⵢⵓ', 'ⵢⵓⵏⵢⵓ', 'ⵢⵓⵍⵢⵓⵣ', 'ⵖⵓⵛⵜ', 'ⵛⵓⵜⴰⵏⴱⵉⵔ', 'ⴽⵜⵓⴱⵔ', 'ⵏⵓⵡⴰⵏⴱⵉⵔ', 'ⴷⵓⵊⴰⵏⴱⵉⵔ'], + 'months_short' => ['ⵉⵏⵏ', 'ⴱⵕⴰ', 'ⵎⴰⵕ', 'ⵉⴱⵔ', 'ⵎⴰⵢ', 'ⵢⵓⵏ', 'ⵢⵓⵍ', 'ⵖⵓⵛ', 'ⵛⵓⵜ', 'ⴽⵜⵓ', 'ⵏⵓⵡ', 'ⴷⵓⵊ'], + 'first_day_of_week' => 6, + 'weekend' => [5, 6], + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMM, YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + + 'year' => ':count aseggwas', + 'y' => ':count aseggwas', + 'a_year' => ':count aseggwas', + + 'month' => ':count ayyur', + 'm' => ':count ayyur', + 'a_month' => ':count ayyur', + + 'week' => ':count imalass', + 'w' => ':count imalass', + 'a_week' => ':count imalass', + + 'day' => ':count ass', + 'd' => ':count ass', + 'a_day' => ':count ass', + + 'hour' => ':count urɣ', // less reliable + 'h' => ':count urɣ', // less reliable + 'a_hour' => ':count urɣ', // less reliable + + 'minute' => ':count ⴰⵎⵥⵉ', // less reliable + 'min' => ':count ⴰⵎⵥⵉ', // less reliable + 'a_minute' => ':count ⴰⵎⵥⵉ', // less reliable + + 'second' => ':count sin', // less reliable + 's' => ':count sin', // less reliable + 'a_second' => ':count sin', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/shi_Latn.php b/vendor/nesbot/carbon/src/Carbon/Lang/shi_Latn.php new file mode 100644 index 00000000..cddfb242 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/shi_Latn.php @@ -0,0 +1,33 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/shi.php', [ + 'meridiem' => ['tifawt', 'tadggʷat'], + 'weekdays' => ['asamas', 'aynas', 'asinas', 'akṛas', 'akwas', 'asimwas', 'asiḍyas'], + 'weekdays_short' => ['asa', 'ayn', 'asi', 'akṛ', 'akw', 'asim', 'asiḍ'], + 'weekdays_min' => ['asa', 'ayn', 'asi', 'akṛ', 'akw', 'asim', 'asiḍ'], + 'months' => ['innayr', 'bṛayṛ', 'maṛṣ', 'ibrir', 'mayyu', 'yunyu', 'yulyuz', 'ɣuct', 'cutanbir', 'ktubr', 'nuwanbir', 'dujanbir'], + 'months_short' => ['inn', 'bṛa', 'maṛ', 'ibr', 'may', 'yun', 'yul', 'ɣuc', 'cut', 'ktu', 'nuw', 'duj'], + 'first_day_of_week' => 6, + 'weekend' => [5, 6], + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMM, YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + + 'minute' => ':count agur', // less reliable + 'min' => ':count agur', // less reliable + 'a_minute' => ':count agur', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/shi_Tfng.php b/vendor/nesbot/carbon/src/Carbon/Lang/shi_Tfng.php new file mode 100644 index 00000000..f3df1f2c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/shi_Tfng.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/shi.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/shn.php b/vendor/nesbot/carbon/src/Carbon/Lang/shn.php new file mode 100644 index 00000000..fe7b1ea5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/shn.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/shn_MM.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/shn_MM.php b/vendor/nesbot/carbon/src/Carbon/Lang/shn_MM.php new file mode 100644 index 00000000..f399acf0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/shn_MM.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - ubuntu Myanmar LoCo Team https://ubuntu-mm.net Bone Pyae Sone bone.burma@mail.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'OY MMM OD dddd', + ], + 'months' => ['လိူၼ်ၵမ်', 'လိူၼ်သၢမ်', 'လိူၼ်သီ', 'လိူၼ်ႁႃႈ', 'လိူၼ်ႁူၵ်း', 'လိူၼ်ၸဵတ်း', 'လိူၼ်ပႅတ်ႇ', 'လိူၼ်ၵဝ်ႈ', 'လိူၼ်သိပ်း', 'လိူၼ်သိပ်းဢိတ်း', 'လိူၼ်သိပ်းဢိတ်းသွင်', 'လိူၼ်ၸဵင်'], + 'months_short' => ['လိူၼ်ၵမ်', 'လိူၼ်သၢမ်', 'လိူၼ်သီ', 'လိူၼ်ႁႃႈ', 'လိူၼ်ႁူၵ်း', 'လိူၼ်ၸဵတ်း', 'လိူၼ်ပႅတ်ႇ', 'လိူၼ်ၵဝ်ႈ', 'လိူၼ်သိပ်း', 'လိူၼ်သိပ်းဢိတ်း', 'လိူၼ်သိပ်းဢိတ်းသွင်', 'လိူၼ်ၸဵင်'], + 'weekdays' => ['ဝၼ်းဢႃးတိတ်ႉ', 'ဝၼ်းၸၼ်', 'ဝၼ်း​ဢၢင်း​ၵၢၼ်း', 'ဝၼ်းပူတ်ႉ', 'ဝၼ်းၽတ်း', 'ဝၼ်းသုၵ်း', 'ဝၼ်းသဝ်'], + 'weekdays_short' => ['တိတ့်', 'ၸၼ်', 'ၵၢၼ်း', 'ပုတ့်', 'ၽတ်း', 'သုၵ်း', 'သဝ်'], + 'weekdays_min' => ['တိတ့်', 'ၸၼ်', 'ၵၢၼ်း', 'ပုတ့်', 'ၽတ်း', 'သုၵ်း', 'သဝ်'], + 'alt_numbers' => ['႐႐', '႐႑', '႐႒', '႐႓', '႐႔', '႐႕', '႐႖', '႐႗', '႐႘', '႐႙', '႑႐', '႑႑', '႑႒', '႑႓', '႑႔', '႑႕', '႑႖', '႑႗', '႑႘', '႑႙', '႒႐', '႒႑', '႒႒', '႒႓', '႒႔', '႒႕', '႒႖', '႒႗', '႒႘', '႒႙', '႓႐', '႓႑', '႓႒', '႓႓', '႓႔', '႓႕', '႓႖', '႓႗', '႓႘', '႓႙', '႔႐', '႔႑', '႔႒', '႔႓', '႔႔', '႔႕', '႔႖', '႔႗', '႔႘', '႔႙', '႕႐', '႕႑', '႕႒', '႕႓', '႕႔', '႕႕', '႕႖', '႕႗', '႕႘', '႕႙', '႖႐', '႖႑', '႖႒', '႖႓', '႖႔', '႖႕', '႖႖', '႖႗', '႖႘', '႖႙', '႗႐', '႗႑', '႗႒', '႗႓', '႗႔', '႗႕', '႗႖', '႗႗', '႗႘', '႗႙', '႘႐', '႘႑', '႘႒', '႘႓', '႘႔', '႘႕', '႘႖', '႘႗', '႘႘', '႘႙', '႙႐', '႙႑', '႙႒', '႙႓', '႙႔', '႙႕', '႙႖', '႙႗', '႙႘', '႙႙'], + 'meridiem' => ['ၵၢင်ၼႂ်', 'တၢမ်းၶမ်ႈ'], + + 'month' => ':count လိူၼ်', // less reliable + 'm' => ':count လိူၼ်', // less reliable + 'a_month' => ':count လိူၼ်', // less reliable + + 'week' => ':count ဝၼ်း', // less reliable + 'w' => ':count ဝၼ်း', // less reliable + 'a_week' => ':count ဝၼ်း', // less reliable + + 'hour' => ':count ຕີ', // less reliable + 'h' => ':count ຕີ', // less reliable + 'a_hour' => ':count ຕີ', // less reliable + + 'minute' => ':count ເດັກ', // less reliable + 'min' => ':count ເດັກ', // less reliable + 'a_minute' => ':count ເດັກ', // less reliable + + 'second' => ':count ဢိုၼ်ႇ', // less reliable + 's' => ':count ဢိုၼ်ႇ', // less reliable + 'a_second' => ':count ဢိုၼ်ႇ', // less reliable + + 'year' => ':count ပီ', + 'y' => ':count ပီ', + 'a_year' => ':count ပီ', + + 'day' => ':count ກາງວັນ', + 'd' => ':count ກາງວັນ', + 'a_day' => ':count ກາງວັນ', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/shs.php b/vendor/nesbot/carbon/src/Carbon/Lang/shs.php new file mode 100644 index 00000000..8d2e1d7d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/shs.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/shs_CA.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/shs_CA.php b/vendor/nesbot/carbon/src/Carbon/Lang/shs_CA.php new file mode 100644 index 00000000..08d385e6 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/shs_CA.php @@ -0,0 +1,38 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Neskie Manuel bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YY', + ], + 'months' => ['Pellkwet̓min', 'Pelctsipwen̓ten', 'Pellsqépts', 'Peslléwten', 'Pell7ell7é7llqten', 'Pelltspéntsk', 'Pelltqwelq̓wél̓t', 'Pellct̓éxel̓cten', 'Pesqelqlélten', 'Pesllwélsten', 'Pellc7ell7é7llcwten̓', 'Pelltetétq̓em'], + 'months_short' => ['Kwe', 'Tsi', 'Sqe', 'Éwt', 'Ell', 'Tsp', 'Tqw', 'Ct̓é', 'Qel', 'Wél', 'U7l', 'Tet'], + 'weekdays' => ['Sxetspesq̓t', 'Spetkesq̓t', 'Selesq̓t', 'Skellesq̓t', 'Smesesq̓t', 'Stselkstesq̓t', 'Stqmekstesq̓t'], + 'weekdays_short' => ['Sxe', 'Spe', 'Sel', 'Ske', 'Sme', 'Sts', 'Stq'], + 'weekdays_min' => ['Sxe', 'Spe', 'Sel', 'Ske', 'Sme', 'Sts', 'Stq'], + 'day_of_first_week_of_year' => 1, + + 'year' => ':count sqlélten', // less reliable + 'y' => ':count sqlélten', // less reliable + 'a_year' => ':count sqlélten', // less reliable + + 'month' => ':count swewll', // less reliable + 'm' => ':count swewll', // less reliable + 'a_month' => ':count swewll', // less reliable + + 'hour' => ':count seqwlút', // less reliable + 'h' => ':count seqwlút', // less reliable + 'a_hour' => ':count seqwlút', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/si.php b/vendor/nesbot/carbon/src/Carbon/Lang/si.php new file mode 100644 index 00000000..636bf691 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/si.php @@ -0,0 +1,78 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - François B + * - Serhan Apaydın + * - JD Isaacks + * - Malinda Weerasinghe (MalindaWMD) + */ +return [ + 'year' => '{1}වසර 1|වසර :count', + 'a_year' => '{1}වසරක්|වසර :count', + 'month' => '{1}මාස 1|මාස :count', + 'a_month' => '{1}මාසය|මාස :count', + 'week' => '{1}සති 1|සති :count', + 'a_week' => '{1}සතියක්|සති :count', + 'day' => '{1}දින 1|දින :count', + 'a_day' => '{1}දිනක්|දින :count', + 'hour' => '{1}පැය 1|පැය :count', + 'a_hour' => '{1}පැයක්|පැය :count', + 'minute' => '{1}මිනිත්තු 1|මිනිත්තු :count', + 'a_minute' => '{1}මිනිත්තුවක්|මිනිත්තු :count', + 'second' => '{1}තත්පර 1|තත්පර :count', + 'a_second' => '{1}තත්පර කිහිපයකට|තත්පර :count', + 'ago' => ':time කට පෙර', + 'from_now' => function ($time) { + if (preg_match('/දින \d/u', $time)) { + return $time.' න්'; + } + + return $time.' කින්'; + }, + 'before' => ':time කට පෙර', + 'after' => function ($time) { + if (preg_match('/දින \d/u', $time)) { + return $time.' න්'; + } + + return $time.' කින්'; + }, + 'diff_now' => 'දැන්', + 'diff_today' => 'අද', + 'diff_yesterday' => 'ඊයේ', + 'diff_tomorrow' => 'හෙට', + 'formats' => [ + 'LT' => 'a h:mm', + 'LTS' => 'a h:mm:ss', + 'L' => 'YYYY/MM/DD', + 'LL' => 'YYYY MMMM D', + 'LLL' => 'YYYY MMMM D, a h:mm', + 'LLLL' => 'YYYY MMMM D [වැනි] dddd, a h:mm:ss', + ], + 'calendar' => [ + 'sameDay' => '[අද] LT[ට]', + 'nextDay' => '[හෙට] LT[ට]', + 'nextWeek' => 'dddd LT[ට]', + 'lastDay' => '[ඊයේ] LT[ට]', + 'lastWeek' => '[පසුගිය] dddd LT[ට]', + 'sameElse' => 'L', + ], + 'ordinal' => ':number වැනි', + 'meridiem' => ['පෙර වරු', 'පස් වරු', 'පෙ.ව.', 'ප.ව.'], + 'months' => ['ජනවාරි', 'පෙබරවාරි', 'මාර්තු', 'අප්‍රේල්', 'මැයි', 'ජූනි', 'ජූලි', 'අගෝස්තු', 'සැප්තැම්බර්', 'ඔක්තෝබර්', 'නොවැම්බර්', 'දෙසැම්බර්'], + 'months_short' => ['ජන', 'පෙබ', 'මාර්', 'අප්', 'මැයි', 'ජූනි', 'ජූලි', 'අගෝ', 'සැප්', 'ඔක්', 'නොවැ', 'දෙසැ'], + 'weekdays' => ['ඉරිදා', 'සඳුදා', 'අඟහරුවාදා', 'බදාදා', 'බ්‍රහස්පතින්දා', 'සිකුරාදා', 'සෙනසුරාදා'], + 'weekdays_short' => ['ඉරි', 'සඳු', 'අඟ', 'බදා', 'බ්‍රහ', 'සිකු', 'සෙන'], + 'weekdays_min' => ['ඉ', 'ස', 'අ', 'බ', 'බ්‍ර', 'සි', 'සෙ'], + 'first_day_of_week' => 1, +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/si_LK.php b/vendor/nesbot/carbon/src/Carbon/Lang/si_LK.php new file mode 100644 index 00000000..81c44e0e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/si_LK.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/si.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sid.php b/vendor/nesbot/carbon/src/Carbon/Lang/sid.php new file mode 100644 index 00000000..b1c65218 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sid.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/sid_ET.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sid_ET.php b/vendor/nesbot/carbon/src/Carbon/Lang/sid_ET.php new file mode 100644 index 00000000..1296f9be --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sid_ET.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Ge'ez Frontier Foundation locales@geez.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], + 'months_short' => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], + 'weekdays' => ['Sambata', 'Sanyo', 'Maakisanyo', 'Roowe', 'Hamuse', 'Arbe', 'Qidaame'], + 'weekdays_short' => ['Sam', 'San', 'Mak', 'Row', 'Ham', 'Arb', 'Qid'], + 'weekdays_min' => ['Sam', 'San', 'Mak', 'Row', 'Ham', 'Arb', 'Qid'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['soodo', 'hawwaro'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sk.php b/vendor/nesbot/carbon/src/Carbon/Lang/sk.php new file mode 100644 index 00000000..f9702e96 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sk.php @@ -0,0 +1,155 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Philippe Vaucher + * - Martin Suja + * - Tsutomu Kuroda + * - tjku + * - Max Melentiev + * - Juanito Fatas + * - Ivan Stana + * - Akira Matsuda + * - Christopher Dell + * - James McKinney + * - Enrique Vidal + * - Simone Carletti + * - Aaron Patterson + * - Jozef Fulop + * - Nicolás Hock Isaza + * - Tom Hughes + * - Simon Hürlimann (CyT) + * - jofi + * - Jakub ADAMEC + * - Marek Adamický + * - AlterwebStudio + */ + +use Carbon\CarbonInterface; + +$fromNow = function ($time) { + return 'o '.strtr($time, [ + 'hodina' => 'hodinu', + 'minúta' => 'minútu', + 'sekunda' => 'sekundu', + ]); +}; + +$ago = function ($time) { + $replacements = [ + '/\bhodina\b/' => 'hodinou', + '/\bminúta\b/' => 'minútou', + '/\bsekunda\b/' => 'sekundou', + '/\bdeň\b/u' => 'dňom', + '/\btýždeň\b/u' => 'týždňom', + '/\bmesiac\b/' => 'mesiacom', + '/\brok\b/' => 'rokom', + ]; + + $replacementsPlural = [ + '/\bhodiny\b/' => 'hodinami', + '/\bminúty\b/' => 'minútami', + '/\bsekundy\b/' => 'sekundami', + '/\bdni\b/' => 'dňami', + '/\btýždne\b/' => 'týždňami', + '/\bmesiace\b/' => 'mesiacmi', + '/\broky\b/' => 'rokmi', + ]; + + foreach ($replacements + $replacementsPlural as $pattern => $replacement) { + $time = preg_replace($pattern, $replacement, $time); + } + + return "pred $time"; +}; + +return [ + 'year' => ':count rok|:count roky|:count rokov', + 'a_year' => 'rok|:count roky|:count rokov', + 'y' => ':count r', + 'month' => ':count mesiac|:count mesiace|:count mesiacov', + 'a_month' => 'mesiac|:count mesiace|:count mesiacov', + 'm' => ':count m', + 'week' => ':count týždeň|:count týždne|:count týždňov', + 'a_week' => 'týždeň|:count týždne|:count týždňov', + 'w' => ':count t', + 'day' => ':count deň|:count dni|:count dní', + 'a_day' => 'deň|:count dni|:count dní', + 'd' => ':count d', + 'hour' => ':count hodina|:count hodiny|:count hodín', + 'a_hour' => 'hodina|:count hodiny|:count hodín', + 'h' => ':count h', + 'minute' => ':count minúta|:count minúty|:count minút', + 'a_minute' => 'minúta|:count minúty|:count minút', + 'min' => ':count min', + 'second' => ':count sekunda|:count sekundy|:count sekúnd', + 'a_second' => 'sekunda|:count sekundy|:count sekúnd', + 's' => ':count s', + 'millisecond' => ':count milisekunda|:count milisekundy|:count milisekúnd', + 'a_millisecond' => 'milisekunda|:count milisekundy|:count milisekúnd', + 'ms' => ':count ms', + 'microsecond' => ':count mikrosekunda|:count mikrosekundy|:count mikrosekúnd', + 'a_microsecond' => 'mikrosekunda|:count mikrosekundy|:count mikrosekúnd', + 'µs' => ':count µs', + + 'ago' => $ago, + 'from_now' => $fromNow, + 'before' => ':time pred', + 'after' => ':time po', + + 'hour_after' => ':count hodinu|:count hodiny|:count hodín', + 'minute_after' => ':count minútu|:count minúty|:count minút', + 'second_after' => ':count sekundu|:count sekundy|:count sekúnd', + + 'hour_before' => ':count hodinu|:count hodiny|:count hodín', + 'minute_before' => ':count minútu|:count minúty|:count minút', + 'second_before' => ':count sekundu|:count sekundy|:count sekúnd', + + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' a '], + 'diff_now' => 'teraz', + 'diff_yesterday' => 'včera', + 'diff_tomorrow' => 'zajtra', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'DD. MMMM YYYY', + 'LLL' => 'D. M. HH:mm', + 'LLLL' => 'dddd D. MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[dnes o] LT', + 'nextDay' => '[zajtra o] LT', + 'lastDay' => '[včera o] LT', + 'nextWeek' => 'dddd [o] LT', + 'lastWeek' => static function (CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 1: + case 2: + case 4: + case 5: + return '[minulý] dddd [o] LT'; //pondelok/utorok/štvrtok/piatok + default: + return '[minulá] dddd [o] LT'; + } + }, + 'sameElse' => 'L', + ], + 'weekdays' => ['nedeľa', 'pondelok', 'utorok', 'streda', 'štvrtok', 'piatok', 'sobota'], + 'weekdays_short' => ['ned', 'pon', 'uto', 'str', 'štv', 'pia', 'sob'], + 'weekdays_min' => ['ne', 'po', 'ut', 'st', 'št', 'pi', 'so'], + 'months' => ['január', 'február', 'marec', 'apríl', 'máj', 'jún', 'júl', 'august', 'september', 'október', 'november', 'december'], + 'months_short' => ['jan', 'feb', 'mar', 'apr', 'máj', 'jún', 'júl', 'aug', 'sep', 'okt', 'nov', 'dec'], + 'meridiem' => ['dopoludnia', 'popoludní'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sk_SK.php b/vendor/nesbot/carbon/src/Carbon/Lang/sk_SK.php new file mode 100644 index 00000000..0515601a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sk_SK.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/sk.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sl.php b/vendor/nesbot/carbon/src/Carbon/Lang/sl.php new file mode 100644 index 00000000..1f1d1b33 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sl.php @@ -0,0 +1,129 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Philippe Vaucher + * - Tsutomu Kuroda + * - tjku + * - Max Melentiev + * - Juanito Fatas + * - Akira Matsuda + * - Christopher Dell + * - Enrique Vidal + * - Simone Carletti + * - Aaron Patterson + * - Nicolás Hock Isaza + * - Miha Rebernik + * - Gal Jakič (morpheus7CS) + * - Glavić + * - Anže Časar + * - Lovro Tramšek (Lovro1107) + * - burut13 + */ + +use Carbon\CarbonInterface; + +return [ + 'year' => ':count leto|:count leti|:count leta|:count let', + 'y' => ':count leto|:count leti|:count leta|:count let', + 'month' => ':count mesec|:count meseca|:count mesece|:count mesecev', + 'm' => ':count mes.', + 'week' => ':count teden|:count tedna|:count tedne|:count tednov', + 'w' => ':count ted.', + 'day' => ':count dan|:count dni|:count dni|:count dni', + 'd' => ':count dan|:count dni|:count dni|:count dni', + 'hour' => ':count ura|:count uri|:count ure|:count ur', + 'h' => ':count h', + 'minute' => ':count minuta|:count minuti|:count minute|:count minut', + 'min' => ':count min.', + 'second' => ':count sekunda|:count sekundi|:count sekunde|:count sekund', + 'a_second' => '{1}nekaj sekund|:count sekunda|:count sekundi|:count sekunde|:count sekund', + 's' => ':count s', + + 'year_ago' => ':count letom|:count letoma|:count leti|:count leti', + 'y_ago' => ':count letom|:count letoma|:count leti|:count leti', + 'month_ago' => ':count mesecem|:count mesecema|:count meseci|:count meseci', + 'week_ago' => ':count tednom|:count tednoma|:count tedni|:count tedni', + 'day_ago' => ':count dnem|:count dnevoma|:count dnevi|:count dnevi', + 'd_ago' => ':count dnem|:count dnevoma|:count dnevi|:count dnevi', + 'hour_ago' => ':count uro|:count urama|:count urami|:count urami', + 'minute_ago' => ':count minuto|:count minutama|:count minutami|:count minutami', + 'second_ago' => ':count sekundo|:count sekundama|:count sekundami|:count sekundami', + + 'day_from_now' => ':count dan|:count dneva|:count dni|:count dni', + 'd_from_now' => ':count dan|:count dneva|:count dni|:count dni', + 'hour_from_now' => ':count uro|:count uri|:count ure|:count ur', + 'minute_from_now' => ':count minuto|:count minuti|:count minute|:count minut', + 'second_from_now' => ':count sekundo|:count sekundi|:count sekunde|:count sekund', + + 'ago' => 'pred :time', + 'from_now' => 'čez :time', + 'after' => ':time kasneje', + 'before' => ':time prej', + + 'diff_now' => 'ravnokar', + 'diff_today' => 'danes', + 'diff_today_regexp' => 'danes(?:\\s+ob)?', + 'diff_yesterday' => 'včeraj', + 'diff_yesterday_regexp' => 'včeraj(?:\\s+ob)?', + 'diff_tomorrow' => 'jutri', + 'diff_tomorrow_regexp' => 'jutri(?:\\s+ob)?', + 'diff_before_yesterday' => 'predvčerajšnjim', + 'diff_after_tomorrow' => 'pojutrišnjem', + + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + + 'period_start_date' => 'od :date', + 'period_end_date' => 'do :date', + + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D. MMMM YYYY', + 'LLL' => 'D. MMMM YYYY H:mm', + 'LLLL' => 'dddd, D. MMMM YYYY H:mm', + ], + 'calendar' => [ + 'sameDay' => '[danes ob] LT', + 'nextDay' => '[jutri ob] LT', + 'nextWeek' => 'dddd [ob] LT', + 'lastDay' => '[včeraj ob] LT', + 'lastWeek' => function (CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[preteklo] [nedeljo] [ob] LT'; + case 1: + return '[pretekli] [ponedeljek] [ob] LT'; + case 2: + return '[pretekli] [torek] [ob] LT'; + case 3: + return '[preteklo] [sredo] [ob] LT'; + case 4: + return '[pretekli] [četrtek] [ob] LT'; + case 5: + return '[pretekli] [petek] [ob] LT'; + case 6: + return '[preteklo] [soboto] [ob] LT'; + } + }, + 'sameElse' => 'L', + ], + 'months' => ['januar', 'februar', 'marec', 'april', 'maj', 'junij', 'julij', 'avgust', 'september', 'oktober', 'november', 'december'], + 'months_short' => ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'avg', 'sep', 'okt', 'nov', 'dec'], + 'weekdays' => ['nedelja', 'ponedeljek', 'torek', 'sreda', 'četrtek', 'petek', 'sobota'], + 'weekdays_short' => ['ned', 'pon', 'tor', 'sre', 'čet', 'pet', 'sob'], + 'weekdays_min' => ['ne', 'po', 'to', 'sr', 'če', 'pe', 'so'], + 'list' => [', ', ' in '], + 'meridiem' => ['dopoldan', 'popoldan'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sl_SI.php b/vendor/nesbot/carbon/src/Carbon/Lang/sl_SI.php new file mode 100644 index 00000000..5dad8c81 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sl_SI.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/sl.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sm.php b/vendor/nesbot/carbon/src/Carbon/Lang/sm.php new file mode 100644 index 00000000..e8c118ac --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sm.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/sm_WS.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sm_WS.php b/vendor/nesbot/carbon/src/Carbon/Lang/sm_WS.php new file mode 100644 index 00000000..f0660687 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sm_WS.php @@ -0,0 +1,53 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Samsung Electronics Co., Ltd. akhilesh.k@samsung.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['Ianuari', 'Fepuari', 'Mati', 'Aperila', 'Me', 'Iuni', 'Iulai', 'Auguso', 'Setema', 'Oketopa', 'Novema', 'Tesema'], + 'months_short' => ['Ian', 'Fep', 'Mat', 'Ape', 'Me', 'Iun', 'Iul', 'Aug', 'Set', 'Oke', 'Nov', 'Tes'], + 'weekdays' => ['Aso Sa', 'Aso Gafua', 'Aso Lua', 'Aso Lulu', 'Aso Tofi', 'Aso Farail', 'Aso To\'ana\'i'], + 'weekdays_short' => ['Aso Sa', 'Aso Gaf', 'Aso Lua', 'Aso Lul', 'Aso Tof', 'Aso Far', 'Aso To\''], + 'weekdays_min' => ['Aso Sa', 'Aso Gaf', 'Aso Lua', 'Aso Lul', 'Aso Tof', 'Aso Far', 'Aso To\''], + + 'hour' => ':count uati', // less reliable + 'h' => ':count uati', // less reliable + 'a_hour' => ':count uati', // less reliable + + 'minute' => ':count itiiti', // less reliable + 'min' => ':count itiiti', // less reliable + 'a_minute' => ':count itiiti', // less reliable + + 'second' => ':count lua', // less reliable + 's' => ':count lua', // less reliable + 'a_second' => ':count lua', // less reliable + + 'year' => ':count tausaga', + 'y' => ':count tausaga', + 'a_year' => ':count tausaga', + + 'month' => ':count māsina', + 'm' => ':count māsina', + 'a_month' => ':count māsina', + + 'week' => ':count vaiaso', + 'w' => ':count vaiaso', + 'a_week' => ':count vaiaso', + + 'day' => ':count aso', + 'd' => ':count aso', + 'a_day' => ':count aso', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/smn.php b/vendor/nesbot/carbon/src/Carbon/Lang/smn.php new file mode 100644 index 00000000..20add023 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/smn.php @@ -0,0 +1,57 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['ip.', 'ep.'], + 'weekdays' => ['pasepeeivi', 'vuossaargâ', 'majebaargâ', 'koskoho', 'tuorâstuv', 'vástuppeeivi', 'lávurduv'], + 'weekdays_short' => ['pas', 'vuo', 'maj', 'kos', 'tuo', 'vás', 'láv'], + 'weekdays_min' => ['pa', 'vu', 'ma', 'ko', 'tu', 'vá', 'lá'], + 'weekdays_standalone' => ['pasepeivi', 'vuossargâ', 'majebargâ', 'koskokko', 'tuorâstâh', 'vástuppeivi', 'lávurdâh'], + 'months' => ['uđđâivemáánu', 'kuovâmáánu', 'njuhčâmáánu', 'cuáŋuimáánu', 'vyesimáánu', 'kesimáánu', 'syeinimáánu', 'porgemáánu', 'čohčâmáánu', 'roovvâdmáánu', 'skammâmáánu', 'juovlâmáánu'], + 'months_short' => ['uđiv', 'kuovâ', 'njuhčâ', 'cuáŋui', 'vyesi', 'kesi', 'syeini', 'porge', 'čohčâ', 'roovvâd', 'skammâ', 'juovlâ'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'H.mm', + 'LTS' => 'H.mm.ss', + 'L' => 'D.M.YYYY', + 'LL' => 'MMM D. YYYY', + 'LLL' => 'MMMM D. YYYY H.mm', + 'LLLL' => 'dddd, MMMM D. YYYY H.mm', + ], + + 'hour' => ':count äigi', // less reliable + 'h' => ':count äigi', // less reliable + 'a_hour' => ':count äigi', // less reliable + + 'year' => ':count ihe', + 'y' => ':count ihe', + 'a_year' => ':count ihe', + + 'month' => ':count mánuppaje', + 'm' => ':count mánuppaje', + 'a_month' => ':count mánuppaje', + + 'week' => ':count okko', + 'w' => ':count okko', + 'a_week' => ':count okko', + + 'day' => ':count peivi', + 'd' => ':count peivi', + 'a_day' => ':count peivi', + + 'minute' => ':count miinut', + 'min' => ':count miinut', + 'a_minute' => ':count miinut', + + 'second' => ':count nubbe', + 's' => ':count nubbe', + 'a_second' => ':count nubbe', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sn.php b/vendor/nesbot/carbon/src/Carbon/Lang/sn.php new file mode 100644 index 00000000..4f25028a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sn.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['a', 'p'], + 'weekdays' => ['Svondo', 'Muvhuro', 'Chipiri', 'Chitatu', 'China', 'Chishanu', 'Mugovera'], + 'weekdays_short' => ['Svo', 'Muv', 'Chp', 'Cht', 'Chn', 'Chs', 'Mug'], + 'weekdays_min' => ['Sv', 'Mu', 'Cp', 'Ct', 'Cn', 'Cs', 'Mg'], + 'months' => ['Ndira', 'Kukadzi', 'Kurume', 'Kubvumbi', 'Chivabvu', 'Chikumi', 'Chikunguru', 'Nyamavhuvhu', 'Gunyana', 'Gumiguru', 'Mbudzi', 'Zvita'], + 'months_short' => ['Ndi', 'Kuk', 'Kur', 'Kub', 'Chv', 'Chk', 'Chg', 'Nya', 'Gun', 'Gum', 'Mbu', 'Zvi'], + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY-MM-dd', + 'LL' => 'YYYY MMM D', + 'LLL' => 'YYYY MMMM D HH:mm', + 'LLLL' => 'YYYY MMMM D, dddd HH:mm', + ], + + 'year' => 'makore :count', + 'y' => 'makore :count', + 'a_year' => 'makore :count', + + 'month' => 'mwedzi :count', + 'm' => 'mwedzi :count', + 'a_month' => 'mwedzi :count', + + 'week' => 'vhiki :count', + 'w' => 'vhiki :count', + 'a_week' => 'vhiki :count', + + 'day' => 'mazuva :count', + 'd' => 'mazuva :count', + 'a_day' => 'mazuva :count', + + 'hour' => 'maawa :count', + 'h' => 'maawa :count', + 'a_hour' => 'maawa :count', + + 'minute' => 'minitsi :count', + 'min' => 'minitsi :count', + 'a_minute' => 'minitsi :count', + + 'second' => 'sekonzi :count', + 's' => 'sekonzi :count', + 'a_second' => 'sekonzi :count', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/so.php b/vendor/nesbot/carbon/src/Carbon/Lang/so.php new file mode 100644 index 00000000..57852719 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/so.php @@ -0,0 +1,74 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Author: + * - Abdifatah Abdilahi(@abdifatahz) + */ +return [ + 'year' => ':count sanad|:count sanadood', + 'a_year' => 'sanad|:count sanadood', + 'y' => '{1}:countsn|{0}:countsns|]1,Inf[:countsn', + 'month' => ':count bil|:count bilood', + 'a_month' => 'bil|:count bilood', + 'm' => ':countbil', + 'week' => ':count isbuuc', + 'a_week' => 'isbuuc|:count isbuuc', + 'w' => ':countis', + 'day' => ':count maalin|:count maalmood', + 'a_day' => 'maalin|:count maalmood', + 'd' => ':countml', + 'hour' => ':count saac', + 'a_hour' => 'saacad|:count saac', + 'h' => ':countsc', + 'minute' => ':count daqiiqo', + 'a_minute' => 'daqiiqo|:count daqiiqo', + 'min' => ':countdq', + 'second' => ':count ilbidhiqsi', + 'a_second' => 'xooga ilbidhiqsiyo|:count ilbidhiqsi', + 's' => ':countil', + 'ago' => ':time kahor', + 'from_now' => ':time gudahood', + 'after' => ':time kedib', + 'before' => ':time kahor', + 'diff_now' => 'hada', + 'diff_today' => 'maanta', + 'diff_today_regexp' => 'maanta(?:\s+markay\s+(?:tahay|ahayd))?', + 'diff_yesterday' => 'shalayto', + 'diff_yesterday_regexp' => 'shalayto(?:\s+markay\s+ahayd)?', + 'diff_tomorrow' => 'beri', + 'diff_tomorrow_regexp' => 'beri(?:\s+markay\s+tahay)?', + 'diff_before_yesterday' => 'doraato', + 'diff_after_tomorrow' => 'saadanbe', + 'period_recurrences' => 'mar|:count jeer', + 'period_interval' => ':interval kasta', + 'period_start_date' => 'laga bilaabo :date', + 'period_end_date' => 'ilaa :date', + 'months' => ['Janaayo', 'Febraayo', 'Abriil', 'Maajo', 'Juun', 'Luuliyo', 'Agoosto', 'Sebteembar', 'Oktoobar', 'Nofeembar', 'Diseembar'], + 'months_short' => ['Jan', 'Feb', 'Mar', 'Abr', 'Mjo', 'Jun', 'Lyo', 'Agt', 'Seb', 'Okt', 'Nof', 'Dis'], + 'weekdays' => ['Axad', 'Isniin', 'Talaada', 'Arbaca', 'Khamiis', 'Jimce', 'Sabti'], + 'weekdays_short' => ['Axd', 'Isn', 'Tal', 'Arb', 'Kha', 'Jim', 'Sbt'], + 'weekdays_min' => ['Ax', 'Is', 'Ta', 'Ar', 'Kh', 'Ji', 'Sa'], + 'list' => [', ', ' and '], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'calendar' => [ + 'sameDay' => '[Maanta markay tahay] LT', + 'nextDay' => '[Beri markay tahay] LT', + 'nextWeek' => 'dddd [markay tahay] LT', + 'lastDay' => '[Shalay markay ahayd] LT', + 'lastWeek' => '[Hore] dddd [Markay ahayd] LT', + 'sameElse' => 'L', + ], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/so_DJ.php b/vendor/nesbot/carbon/src/Carbon/Lang/so_DJ.php new file mode 100644 index 00000000..273dda8d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/so_DJ.php @@ -0,0 +1,20 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Ge'ez Frontier Foundation locales@geez.org + */ +return array_replace_recursive(require __DIR__.'/so.php', [ + 'formats' => [ + 'L' => 'DD.MM.YYYY', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/so_ET.php b/vendor/nesbot/carbon/src/Carbon/Lang/so_ET.php new file mode 100644 index 00000000..7b699715 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/so_ET.php @@ -0,0 +1,16 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Ge'ez Frontier Foundation locales@geez.org + */ +return require __DIR__.'/so.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/so_KE.php b/vendor/nesbot/carbon/src/Carbon/Lang/so_KE.php new file mode 100644 index 00000000..7b699715 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/so_KE.php @@ -0,0 +1,16 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Ge'ez Frontier Foundation locales@geez.org + */ +return require __DIR__.'/so.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/so_SO.php b/vendor/nesbot/carbon/src/Carbon/Lang/so_SO.php new file mode 100644 index 00000000..7b699715 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/so_SO.php @@ -0,0 +1,16 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Ge'ez Frontier Foundation locales@geez.org + */ +return require __DIR__.'/so.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sq.php b/vendor/nesbot/carbon/src/Carbon/Lang/sq.php new file mode 100644 index 00000000..ffa592ec --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sq.php @@ -0,0 +1,79 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - François B + * - JD Isaacks + * - Fadion Dashi + */ +return [ + 'year' => ':count vit|:count vjet', + 'a_year' => 'një vit|:count vite', + 'y' => ':count v.', + 'month' => ':count muaj', + 'a_month' => 'një muaj|:count muaj', + 'm' => ':count muaj', + 'week' => ':count javë', + 'a_week' => ':count javë|:count javë', + 'w' => ':count j.', + 'day' => ':count ditë', + 'a_day' => 'një ditë|:count ditë', + 'd' => ':count d.', + 'hour' => ':count orë', + 'a_hour' => 'një orë|:count orë', + 'h' => ':count o.', + 'minute' => ':count minutë|:count minuta', + 'a_minute' => 'një minutë|:count minuta', + 'min' => ':count min.', + 'second' => ':count sekondë|:count sekonda', + 'a_second' => 'disa sekonda|:count sekonda', + 's' => ':count s.', + 'ago' => ':time më parë', + 'from_now' => 'në :time', + 'after' => ':time pas', + 'before' => ':time para', + 'diff_now' => 'tani', + 'diff_today' => 'Sot', + 'diff_today_regexp' => 'Sot(?:\\s+në)?', + 'diff_yesterday' => 'dje', + 'diff_yesterday_regexp' => 'Dje(?:\\s+në)?', + 'diff_tomorrow' => 'nesër', + 'diff_tomorrow_regexp' => 'Nesër(?:\\s+në)?', + 'diff_before_yesterday' => 'pardje', + 'diff_after_tomorrow' => 'pasnesër', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Sot në] LT', + 'nextDay' => '[Nesër në] LT', + 'nextWeek' => 'dddd [në] LT', + 'lastDay' => '[Dje në] LT', + 'lastWeek' => 'dddd [e kaluar në] LT', + 'sameElse' => 'L', + ], + 'ordinal' => ':number.', + 'meridiem' => ['PD', 'MD'], + 'months' => ['janar', 'shkurt', 'mars', 'prill', 'maj', 'qershor', 'korrik', 'gusht', 'shtator', 'tetor', 'nëntor', 'dhjetor'], + 'months_short' => ['jan', 'shk', 'mar', 'pri', 'maj', 'qer', 'kor', 'gus', 'sht', 'tet', 'nën', 'dhj'], + 'weekdays' => ['e diel', 'e hënë', 'e martë', 'e mërkurë', 'e enjte', 'e premte', 'e shtunë'], + 'weekdays_short' => ['die', 'hën', 'mar', 'mër', 'enj', 'pre', 'sht'], + 'weekdays_min' => ['d', 'h', 'ma', 'më', 'e', 'p', 'sh'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' dhe '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sq_AL.php b/vendor/nesbot/carbon/src/Carbon/Lang/sq_AL.php new file mode 100644 index 00000000..ea5df3f2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sq_AL.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/sq.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sq_MK.php b/vendor/nesbot/carbon/src/Carbon/Lang/sq_MK.php new file mode 100644 index 00000000..62f752c4 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sq_MK.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/sq.php', [ + 'formats' => [ + 'L' => 'D.M.YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY, HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY, HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sq_XK.php b/vendor/nesbot/carbon/src/Carbon/Lang/sq_XK.php new file mode 100644 index 00000000..62f752c4 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sq_XK.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/sq.php', [ + 'formats' => [ + 'L' => 'D.M.YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY, HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY, HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr.php new file mode 100644 index 00000000..68ba663a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr.php @@ -0,0 +1,112 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - François B + * - shaishavgandhi05 + * - Serhan Apaydın + * - JD Isaacks + * - Glavić + * - Milos Sakovic + */ + +use Carbon\CarbonInterface; + +return [ + 'year' => ':count godina|:count godine|:count godina', + 'y' => ':count g.', + 'month' => ':count mesec|:count meseca|:count meseci', + 'm' => ':count mj.', + 'week' => ':count nedelja|:count nedelje|:count nedelja', + 'w' => ':count ned.', + 'day' => ':count dan|:count dana|:count dana', + 'd' => ':count d.', + 'hour' => ':count sat|:count sata|:count sati', + 'h' => ':count č.', + 'minute' => ':count minut|:count minuta|:count minuta', + 'min' => ':count min.', + 'second' => ':count sekundu|:count sekunde|:count sekundi', + 's' => ':count sek.', + 'ago' => 'pre :time', + 'from_now' => 'za :time', + 'after' => 'nakon :time', + 'before' => 'pre :time', + + 'year_from_now' => ':count godinu|:count godine|:count godina', + 'year_ago' => ':count godinu|:count godine|:count godina', + 'week_from_now' => ':count nedelju|:count nedelje|:count nedelja', + 'week_ago' => ':count nedelju|:count nedelje|:count nedelja', + + 'diff_now' => 'upravo sada', + 'diff_today' => 'danas', + 'diff_today_regexp' => 'danas(?:\\s+u)?', + 'diff_yesterday' => 'juče', + 'diff_yesterday_regexp' => 'juče(?:\\s+u)?', + 'diff_tomorrow' => 'sutra', + 'diff_tomorrow_regexp' => 'sutra(?:\\s+u)?', + 'diff_before_yesterday' => 'prekjuče', + 'diff_after_tomorrow' => 'preksutra', + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D. MMMM YYYY', + 'LLL' => 'D. MMMM YYYY H:mm', + 'LLLL' => 'dddd, D. MMMM YYYY H:mm', + ], + 'calendar' => [ + 'sameDay' => '[danas u] LT', + 'nextDay' => '[sutra u] LT', + 'nextWeek' => function (CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[u nedelju u] LT'; + case 3: + return '[u sredu u] LT'; + case 6: + return '[u subotu u] LT'; + default: + return '[u] dddd [u] LT'; + } + }, + 'lastDay' => '[juče u] LT', + 'lastWeek' => function (CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[prošle nedelje u] LT'; + case 1: + return '[prošlog ponedeljka u] LT'; + case 2: + return '[prošlog utorka u] LT'; + case 3: + return '[prošle srede u] LT'; + case 4: + return '[prošlog četvrtka u] LT'; + case 5: + return '[prošlog petka u] LT'; + default: + return '[prošle subote u] LT'; + } + }, + 'sameElse' => 'L', + ], + 'ordinal' => ':number.', + 'months' => ['januar', 'februar', 'mart', 'april', 'maj', 'jun', 'jul', 'avgust', 'septembar', 'oktobar', 'novembar', 'decembar'], + 'months_short' => ['jan.', 'feb.', 'mar.', 'apr.', 'maj', 'jun', 'jul', 'avg.', 'sep.', 'okt.', 'nov.', 'dec.'], + 'weekdays' => ['nedelja', 'ponedeljak', 'utorak', 'sreda', 'četvrtak', 'petak', 'subota'], + 'weekdays_short' => ['ned.', 'pon.', 'uto.', 'sre.', 'čet.', 'pet.', 'sub.'], + 'weekdays_min' => ['ne', 'po', 'ut', 'sr', 'če', 'pe', 'su'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' i '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php new file mode 100644 index 00000000..8becbc57 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php @@ -0,0 +1,112 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - François B + * - shaishavgandhi05 + * - Serhan Apaydın + * - JD Isaacks + * - Glavić + * - Nikola Zeravcic + * - Milos Sakovic + */ + +use Carbon\CarbonInterface; + +return [ + 'year' => ':count година|:count године|:count година', + 'y' => ':count г.', + 'month' => ':count месец|:count месеца|:count месеци', + 'm' => ':count м.', + 'week' => ':count недеља|:count недеље|:count недеља', + 'w' => ':count нед.', + 'day' => ':count дан|:count дана|:count дана', + 'd' => ':count д.', + 'hour' => ':count сат|:count сата|:count сати', + 'h' => ':count ч.', + 'minute' => ':count минут|:count минута|:count минута', + 'min' => ':count мин.', + 'second' => ':count секунд|:count секунде|:count секунди', + 's' => ':count сек.', + 'ago' => 'пре :time', + 'from_now' => 'за :time', + 'after' => ':time након', + 'before' => ':time пре', + 'year_from_now' => ':count годину|:count године|:count година', + 'year_ago' => ':count годину|:count године|:count година', + 'week_from_now' => ':count недељу|:count недеље|:count недеља', + 'week_ago' => ':count недељу|:count недеље|:count недеља', + 'diff_now' => 'управо сада', + 'diff_today' => 'данас', + 'diff_today_regexp' => 'данас(?:\\s+у)?', + 'diff_yesterday' => 'јуче', + 'diff_yesterday_regexp' => 'јуче(?:\\s+у)?', + 'diff_tomorrow' => 'сутра', + 'diff_tomorrow_regexp' => 'сутра(?:\\s+у)?', + 'diff_before_yesterday' => 'прекјуче', + 'diff_after_tomorrow' => 'прекосутра', + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D. MMMM YYYY', + 'LLL' => 'D. MMMM YYYY H:mm', + 'LLLL' => 'dddd, D. MMMM YYYY H:mm', + ], + 'calendar' => [ + 'sameDay' => '[данас у] LT', + 'nextDay' => '[сутра у] LT', + 'nextWeek' => function (CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[у недељу у] LT'; + case 3: + return '[у среду у] LT'; + case 6: + return '[у суботу у] LT'; + default: + return '[у] dddd [у] LT'; + } + }, + 'lastDay' => '[јуче у] LT', + 'lastWeek' => function (CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[прошле недеље у] LT'; + case 1: + return '[прошлог понедељка у] LT'; + case 2: + return '[прошлог уторка у] LT'; + case 3: + return '[прошле среде у] LT'; + case 4: + return '[прошлог четвртка у] LT'; + case 5: + return '[прошлог петка у] LT'; + default: + return '[прошле суботе у] LT'; + } + }, + 'sameElse' => 'L', + ], + 'ordinal' => ':number.', + 'months' => ['јануар', 'фебруар', 'март', 'април', 'мај', 'јун', 'јул', 'август', 'септембар', 'октобар', 'новембар', 'децембар'], + 'months_short' => ['јан.', 'феб.', 'мар.', 'апр.', 'мај', 'јун', 'јул', 'авг.', 'сеп.', 'окт.', 'нов.', 'дец.'], + 'weekdays' => ['недеља', 'понедељак', 'уторак', 'среда', 'четвртак', 'петак', 'субота'], + 'weekdays_short' => ['нед.', 'пон.', 'уто.', 'сре.', 'чет.', 'пет.', 'суб.'], + 'weekdays_min' => ['не', 'по', 'ут', 'ср', 'че', 'пе', 'су'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' и '], + 'meridiem' => ['АМ', 'ПМ'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_BA.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_BA.php new file mode 100644 index 00000000..4b29a45c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_BA.php @@ -0,0 +1,33 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Component\Translation\PluralizationRules; + +// @codeCoverageIgnoreStart +if (class_exists(PluralizationRules::class)) { + PluralizationRules::set(static function ($number) { + return PluralizationRules::get($number, 'sr'); + }, 'sr_Cyrl_BA'); +} +// @codeCoverageIgnoreEnd + +return array_replace_recursive(require __DIR__.'/sr_Cyrl.php', [ + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D.M.yy.', + 'LL' => 'DD.MM.YYYY.', + 'LLL' => 'DD. MMMM YYYY. HH:mm', + 'LLLL' => 'dddd, DD. MMMM YYYY. HH:mm', + ], + 'weekdays' => ['недјеља', 'понедељак', 'уторак', 'сриједа', 'четвртак', 'петак', 'субота'], + 'weekdays_short' => ['нед.', 'пон.', 'ут.', 'ср.', 'чет.', 'пет.', 'суб.'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php new file mode 100644 index 00000000..28d22fd2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php @@ -0,0 +1,118 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Glavić + * - Milos Sakovic + */ + +use Carbon\CarbonInterface; +use Symfony\Component\Translation\PluralizationRules; + +// @codeCoverageIgnoreStart +if (class_exists(PluralizationRules::class)) { + PluralizationRules::set(static function ($number) { + return PluralizationRules::get($number, 'sr'); + }, 'sr_Cyrl_ME'); +} +// @codeCoverageIgnoreEnd + +return [ + 'year' => ':count година|:count године|:count година', + 'y' => ':count г.', + 'month' => ':count мјесец|:count мјесеца|:count мјесеци', + 'm' => ':count мј.', + 'week' => ':count недјеља|:count недјеље|:count недјеља', + 'w' => ':count нед.', + 'day' => ':count дан|:count дана|:count дана', + 'd' => ':count д.', + 'hour' => ':count сат|:count сата|:count сати', + 'h' => ':count ч.', + 'minute' => ':count минут|:count минута|:count минута', + 'min' => ':count мин.', + 'second' => ':count секунд|:count секунде|:count секунди', + 's' => ':count сек.', + 'ago' => 'прије :time', + 'from_now' => 'за :time', + 'after' => ':time након', + 'before' => ':time прије', + + 'year_from_now' => ':count годину|:count године|:count година', + 'year_ago' => ':count годину|:count године|:count година', + + 'week_from_now' => ':count недјељу|:count недјеље|:count недјеља', + 'week_ago' => ':count недјељу|:count недјеље|:count недјеља', + + 'diff_now' => 'управо сада', + 'diff_today' => 'данас', + 'diff_today_regexp' => 'данас(?:\\s+у)?', + 'diff_yesterday' => 'јуче', + 'diff_yesterday_regexp' => 'јуче(?:\\s+у)?', + 'diff_tomorrow' => 'сутра', + 'diff_tomorrow_regexp' => 'сутра(?:\\s+у)?', + 'diff_before_yesterday' => 'прекјуче', + 'diff_after_tomorrow' => 'прекосјутра', + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D. MMMM YYYY', + 'LLL' => 'D. MMMM YYYY H:mm', + 'LLLL' => 'dddd, D. MMMM YYYY H:mm', + ], + 'calendar' => [ + 'sameDay' => '[данас у] LT', + 'nextDay' => '[сутра у] LT', + 'nextWeek' => function (CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[у недељу у] LT'; + case 3: + return '[у среду у] LT'; + case 6: + return '[у суботу у] LT'; + default: + return '[у] dddd [у] LT'; + } + }, + 'lastDay' => '[јуче у] LT', + 'lastWeek' => function (CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[прошле недеље у] LT'; + case 1: + return '[прошлог понедељка у] LT'; + case 2: + return '[прошлог уторка у] LT'; + case 3: + return '[прошле среде у] LT'; + case 4: + return '[прошлог четвртка у] LT'; + case 5: + return '[прошлог петка у] LT'; + default: + return '[прошле суботе у] LT'; + } + }, + 'sameElse' => 'L', + ], + 'ordinal' => ':number.', + 'months' => ['јануар', 'фебруар', 'март', 'април', 'мај', 'јун', 'јул', 'август', 'септембар', 'октобар', 'новембар', 'децембар'], + 'months_short' => ['јан.', 'феб.', 'мар.', 'апр.', 'мај', 'јун', 'јул', 'авг.', 'сеп.', 'окт.', 'нов.', 'дец.'], + 'weekdays' => ['недеља', 'понедељак', 'уторак', 'среда', 'четвртак', 'петак', 'субота'], + 'weekdays_short' => ['нед.', 'пон.', 'уто.', 'сре.', 'чет.', 'пет.', 'суб.'], + 'weekdays_min' => ['не', 'по', 'ут', 'ср', 'че', 'пе', 'су'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' и '], + 'meridiem' => ['АМ', 'ПМ'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_XK.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_XK.php new file mode 100644 index 00000000..d6e29b86 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_XK.php @@ -0,0 +1,24 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Component\Translation\PluralizationRules; + +// @codeCoverageIgnoreStart +if (class_exists(PluralizationRules::class)) { + PluralizationRules::set(static function ($number) { + return PluralizationRules::get($number, 'sr'); + }, 'sr_Cyrl_XK'); +} +// @codeCoverageIgnoreEnd + +return array_replace_recursive(require __DIR__.'/sr_Cyrl_BA.php', [ + 'weekdays' => ['недеља', 'понедељак', 'уторак', 'среда', 'четвртак', 'петак', 'субота'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn.php new file mode 100644 index 00000000..99716747 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/sr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_BA.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_BA.php new file mode 100644 index 00000000..95b2770d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_BA.php @@ -0,0 +1,33 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Component\Translation\PluralizationRules; + +// @codeCoverageIgnoreStart +if (class_exists(PluralizationRules::class)) { + PluralizationRules::set(static function ($number) { + return PluralizationRules::get($number, 'sr'); + }, 'sr_Latn_BA'); +} +// @codeCoverageIgnoreEnd + +return array_replace_recursive(require __DIR__.'/sr_Latn.php', [ + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D.M.yy.', + 'LL' => 'DD.MM.YYYY.', + 'LLL' => 'DD. MMMM YYYY. HH:mm', + 'LLLL' => 'dddd, DD. MMMM YYYY. HH:mm', + ], + 'weekdays' => ['nedjelja', 'ponedeljak', 'utorak', 'srijeda', 'četvrtak', 'petak', 'subota'], + 'weekdays_short' => ['ned.', 'pon.', 'ut.', 'sr.', 'čet.', 'pet.', 'sub.'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php new file mode 100644 index 00000000..5b8f2d06 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php @@ -0,0 +1,76 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Glavić + * - Milos Sakovic + */ + +use Carbon\CarbonInterface; +use Symfony\Component\Translation\PluralizationRules; + +// @codeCoverageIgnoreStart +if (class_exists(PluralizationRules::class)) { + PluralizationRules::set(static function ($number) { + return PluralizationRules::get($number, 'sr'); + }, 'sr_Latn_ME'); +} +// @codeCoverageIgnoreEnd + +return array_replace_recursive(require __DIR__.'/sr.php', [ + 'month' => ':count mjesec|:count mjeseca|:count mjeseci', + 'week' => ':count nedjelja|:count nedjelje|:count nedjelja', + 'second' => ':count sekund|:count sekunde|:count sekundi', + 'ago' => 'prije :time', + 'from_now' => 'za :time', + 'after' => ':time nakon', + 'before' => ':time prije', + 'week_from_now' => ':count nedjelju|:count nedjelje|:count nedjelja', + 'week_ago' => ':count nedjelju|:count nedjelje|:count nedjelja', + 'second_ago' => ':count sekund|:count sekunde|:count sekundi', + 'diff_tomorrow' => 'sjutra', + 'calendar' => [ + 'nextDay' => '[sjutra u] LT', + 'nextWeek' => function (CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[u nedjelju u] LT'; + case 3: + return '[u srijedu u] LT'; + case 6: + return '[u subotu u] LT'; + default: + return '[u] dddd [u] LT'; + } + }, + 'lastWeek' => function (CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 0: + return '[prošle nedjelje u] LT'; + case 1: + return '[prošle nedjelje u] LT'; + case 2: + return '[prošlog utorka u] LT'; + case 3: + return '[prošle srijede u] LT'; + case 4: + return '[prošlog četvrtka u] LT'; + case 5: + return '[prošlog petka u] LT'; + default: + return '[prošle subote u] LT'; + } + }, + ], + 'weekdays' => ['nedjelja', 'ponedjeljak', 'utorak', 'srijeda', 'četvrtak', 'petak', 'subota'], + 'weekdays_short' => ['ned.', 'pon.', 'uto.', 'sri.', 'čet.', 'pet.', 'sub.'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_XK.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_XK.php new file mode 100644 index 00000000..5278e2e5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_XK.php @@ -0,0 +1,24 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Component\Translation\PluralizationRules; + +// @codeCoverageIgnoreStart +if (class_exists(PluralizationRules::class)) { + PluralizationRules::set(static function ($number) { + return PluralizationRules::get($number, 'sr'); + }, 'sr_Latn_XK'); +} +// @codeCoverageIgnoreEnd + +return array_replace_recursive(require __DIR__.'/sr_Latn_BA.php', [ + 'weekdays' => ['nedelja', 'ponedeljak', 'utorak', 'sreda', 'četvrtak', 'petak', 'subota'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_ME.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_ME.php new file mode 100644 index 00000000..d7c65b91 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_ME.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/sr_Latn_ME.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_RS.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_RS.php new file mode 100644 index 00000000..bc5e04bf --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_RS.php @@ -0,0 +1,16 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - sr_YU, sr_CS locale Danilo Segan bug-glibc-locales@gnu.org + */ +return require __DIR__.'/sr_Cyrl.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_RS@latin.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_RS@latin.php new file mode 100644 index 00000000..99716747 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_RS@latin.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/sr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ss.php b/vendor/nesbot/carbon/src/Carbon/Lang/ss.php new file mode 100644 index 00000000..1c52c9bf --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ss.php @@ -0,0 +1,78 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - François B + * - Nicolai Davies + */ +return [ + 'year' => '{1}umnyaka|:count iminyaka', + 'month' => '{1}inyanga|:count tinyanga', + 'week' => '{1}:count liviki|:count emaviki', + 'day' => '{1}lilanga|:count emalanga', + 'hour' => '{1}lihora|:count emahora', + 'minute' => '{1}umzuzu|:count emizuzu', + 'second' => '{1}emizuzwana lomcane|:count mzuzwana', + 'ago' => 'wenteka nga :time', + 'from_now' => 'nga :time', + 'diff_yesterday' => 'Itolo', + 'diff_yesterday_regexp' => 'Itolo(?:\\s+nga)?', + 'diff_today' => 'Namuhla', + 'diff_today_regexp' => 'Namuhla(?:\\s+nga)?', + 'diff_tomorrow' => 'Kusasa', + 'diff_tomorrow_regexp' => 'Kusasa(?:\\s+nga)?', + 'formats' => [ + 'LT' => 'h:mm A', + 'LTS' => 'h:mm:ss A', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY h:mm A', + 'LLLL' => 'dddd, D MMMM YYYY h:mm A', + ], + 'calendar' => [ + 'sameDay' => '[Namuhla nga] LT', + 'nextDay' => '[Kusasa nga] LT', + 'nextWeek' => 'dddd [nga] LT', + 'lastDay' => '[Itolo nga] LT', + 'lastWeek' => 'dddd [leliphelile] [nga] LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + $lastDigit = $number % 10; + + return $number.( + ((int) ($number % 100 / 10) === 1) ? 'e' : ( + ($lastDigit === 1 || $lastDigit === 2) ? 'a' : 'e' + ) + ); + }, + 'meridiem' => function ($hour) { + if ($hour < 11) { + return 'ekuseni'; + } + if ($hour < 15) { + return 'emini'; + } + if ($hour < 19) { + return 'entsambama'; + } + + return 'ebusuku'; + }, + 'months' => ['Bhimbidvwane', 'Indlovana', 'Indlov\'lenkhulu', 'Mabasa', 'Inkhwekhweti', 'Inhlaba', 'Kholwane', 'Ingci', 'Inyoni', 'Imphala', 'Lweti', 'Ingongoni'], + 'months_short' => ['Bhi', 'Ina', 'Inu', 'Mab', 'Ink', 'Inh', 'Kho', 'Igc', 'Iny', 'Imp', 'Lwe', 'Igo'], + 'weekdays' => ['Lisontfo', 'Umsombuluko', 'Lesibili', 'Lesitsatfu', 'Lesine', 'Lesihlanu', 'Umgcibelo'], + 'weekdays_short' => ['Lis', 'Umb', 'Lsb', 'Les', 'Lsi', 'Lsh', 'Umg'], + 'weekdays_min' => ['Li', 'Us', 'Lb', 'Lt', 'Ls', 'Lh', 'Ug'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ss_ZA.php b/vendor/nesbot/carbon/src/Carbon/Lang/ss_ZA.php new file mode 100644 index 00000000..ba89527c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ss_ZA.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/ss.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/st.php b/vendor/nesbot/carbon/src/Carbon/Lang/st.php new file mode 100644 index 00000000..b065445b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/st.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/st_ZA.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/st_ZA.php b/vendor/nesbot/carbon/src/Carbon/Lang/st_ZA.php new file mode 100644 index 00000000..5bce7f20 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/st_ZA.php @@ -0,0 +1,54 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Zuza Software Foundation (Translate.org.za) Dwayne Bailey dwayne@translate.org.za + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['Pherekgong', 'Hlakola', 'Tlhakubele', 'Mmese', 'Motsheanong', 'Phupjane', 'Phupu', 'Phato', 'Leotse', 'Mphalane', 'Pudungwana', 'Tshitwe'], + 'months_short' => ['Phe', 'Hla', 'TlH', 'Mme', 'Mot', 'Jan', 'Upu', 'Pha', 'Leo', 'Mph', 'Pud', 'Tsh'], + 'weekdays' => ['Sontaha', 'Mantaha', 'Labobedi', 'Laboraro', 'Labone', 'Labohlano', 'Moqebelo'], + 'weekdays_short' => ['Son', 'Mma', 'Bed', 'Rar', 'Ne', 'Hla', 'Moq'], + 'weekdays_min' => ['Son', 'Mma', 'Bed', 'Rar', 'Ne', 'Hla', 'Moq'], + 'day_of_first_week_of_year' => 1, + + 'week' => ':count Sontaha', // less reliable + 'w' => ':count Sontaha', // less reliable + 'a_week' => ':count Sontaha', // less reliable + + 'day' => ':count letsatsi', // less reliable + 'd' => ':count letsatsi', // less reliable + 'a_day' => ':count letsatsi', // less reliable + + 'hour' => ':count sešupanako', // less reliable + 'h' => ':count sešupanako', // less reliable + 'a_hour' => ':count sešupanako', // less reliable + + 'minute' => ':count menyane', // less reliable + 'min' => ':count menyane', // less reliable + 'a_minute' => ':count menyane', // less reliable + + 'second' => ':count thusa', // less reliable + 's' => ':count thusa', // less reliable + 'a_second' => ':count thusa', // less reliable + + 'year' => ':count selemo', + 'y' => ':count selemo', + 'a_year' => ':count selemo', + + 'month' => ':count kgwedi', + 'm' => ':count kgwedi', + 'a_month' => ':count kgwedi', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sv.php b/vendor/nesbot/carbon/src/Carbon/Lang/sv.php new file mode 100644 index 00000000..1706c719 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sv.php @@ -0,0 +1,87 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - François B + * - Kristoffer Snabb + * - JD Isaacks + * - Jens Herlevsen + * - Nightpine + * - Anders Nygren (litemerafrukt) + */ +return [ + 'year' => ':count år', + 'a_year' => 'ett år|:count år', + 'y' => ':count år', + 'month' => ':count månad|:count månader', + 'a_month' => 'en månad|:count månader', + 'm' => ':count mån', + 'week' => ':count vecka|:count veckor', + 'a_week' => 'en vecka|:count veckor', + 'w' => ':count v', + 'day' => ':count dag|:count dagar', + 'a_day' => 'en dag|:count dagar', + 'd' => ':count dgr', + 'hour' => ':count timme|:count timmar', + 'a_hour' => 'en timme|:count timmar', + 'h' => ':count tim', + 'minute' => ':count minut|:count minuter', + 'a_minute' => 'en minut|:count minuter', + 'min' => ':count min', + 'second' => ':count sekund|:count sekunder', + 'a_second' => 'några sekunder|:count sekunder', + 's' => ':count s', + 'ago' => 'för :time sedan', + 'from_now' => 'om :time', + 'after' => ':time efter', + 'before' => ':time före', + 'diff_now' => 'nu', + 'diff_today' => 'I dag', + 'diff_yesterday' => 'i går', + 'diff_yesterday_regexp' => 'I går', + 'diff_tomorrow' => 'i morgon', + 'diff_tomorrow_regexp' => 'I morgon', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY-MM-DD', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY [kl.] HH:mm', + 'LLLL' => 'dddd D MMMM YYYY [kl.] HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[I dag] LT', + 'nextDay' => '[I morgon] LT', + 'nextWeek' => '[På] dddd LT', + 'lastDay' => '[I går] LT', + 'lastWeek' => '[I] dddd[s] LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + $lastDigit = $number % 10; + + return $number.( + ((int) ($number % 100 / 10) === 1) ? 'e' : ( + ($lastDigit === 1 || $lastDigit === 2) ? 'a' : 'e' + ) + ); + }, + 'months' => ['januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december'], + 'months_short' => ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'], + 'weekdays' => ['söndag', 'måndag', 'tisdag', 'onsdag', 'torsdag', 'fredag', 'lördag'], + 'weekdays_short' => ['sön', 'mån', 'tis', 'ons', 'tors', 'fre', 'lör'], + 'weekdays_min' => ['sö', 'må', 'ti', 'on', 'to', 'fr', 'lö'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' och '], + 'meridiem' => ['fm', 'em'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sv_AX.php b/vendor/nesbot/carbon/src/Carbon/Lang/sv_AX.php new file mode 100644 index 00000000..70cc5585 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sv_AX.php @@ -0,0 +1,19 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/sv.php', [ + 'formats' => [ + 'L' => 'YYYY-MM-dd', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sv_FI.php b/vendor/nesbot/carbon/src/Carbon/Lang/sv_FI.php new file mode 100644 index 00000000..d7182c83 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sv_FI.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/sv.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sv_SE.php b/vendor/nesbot/carbon/src/Carbon/Lang/sv_SE.php new file mode 100644 index 00000000..d7182c83 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sv_SE.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/sv.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sw.php b/vendor/nesbot/carbon/src/Carbon/Lang/sw.php new file mode 100644 index 00000000..f8630d53 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sw.php @@ -0,0 +1,74 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - leyluj + * - Josh Soref + * - ryanhart2 + */ +return [ + 'year' => 'mwaka :count|miaka :count', + 'a_year' => 'mwaka mmoja|miaka :count', + 'y' => 'mwaka :count|miaka :count', + 'month' => 'mwezi :count|miezi :count', + 'a_month' => 'mwezi mmoja|miezi :count', + 'm' => 'mwezi :count|miezi :count', + 'week' => 'wiki :count', + 'a_week' => 'wiki mmoja|wiki :count', + 'w' => 'w. :count', + 'day' => 'siku :count', + 'a_day' => 'siku moja|masiku :count', + 'd' => 'si. :count', + 'hour' => 'saa :count|masaa :count', + 'a_hour' => 'saa limoja|masaa :count', + 'h' => 'saa :count|masaa :count', + 'minute' => 'dakika :count', + 'a_minute' => 'dakika moja|dakika :count', + 'min' => 'd. :count', + 'second' => 'sekunde :count', + 'a_second' => 'hivi punde|sekunde :count', + 's' => 'se. :count', + 'ago' => 'tokea :time', + 'from_now' => ':time baadaye', + 'after' => ':time baada', + 'before' => ':time kabla', + 'diff_now' => 'sasa hivi', + 'diff_today' => 'leo', + 'diff_today_regexp' => 'leo(?:\\s+saa)?', + 'diff_yesterday' => 'jana', + 'diff_tomorrow' => 'kesho', + 'diff_tomorrow_regexp' => 'kesho(?:\\s+saa)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[leo saa] LT', + 'nextDay' => '[kesho saa] LT', + 'nextWeek' => '[wiki ijayo] dddd [saat] LT', + 'lastDay' => '[jana] LT', + 'lastWeek' => '[wiki iliyopita] dddd [saat] LT', + 'sameElse' => 'L', + ], + 'months' => ['Januari', 'Februari', 'Machi', 'Aprili', 'Mei', 'Juni', 'Julai', 'Agosti', 'Septemba', 'Oktoba', 'Novemba', 'Desemba'], + 'months_short' => ['Jan', 'Feb', 'Mac', 'Apr', 'Mei', 'Jun', 'Jul', 'Ago', 'Sep', 'Okt', 'Nov', 'Des'], + 'weekdays' => ['Jumapili', 'Jumatatu', 'Jumanne', 'Jumatano', 'Alhamisi', 'Ijumaa', 'Jumamosi'], + 'weekdays_short' => ['Jpl', 'Jtat', 'Jnne', 'Jtan', 'Alh', 'Ijm', 'Jmos'], + 'weekdays_min' => ['J2', 'J3', 'J4', 'J5', 'Al', 'Ij', 'J1'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' na '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sw_CD.php b/vendor/nesbot/carbon/src/Carbon/Lang/sw_CD.php new file mode 100644 index 00000000..ec9117b5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sw_CD.php @@ -0,0 +1,17 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/sw.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sw_KE.php b/vendor/nesbot/carbon/src/Carbon/Lang/sw_KE.php new file mode 100644 index 00000000..2ace0db2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sw_KE.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Kamusi Project Martin Benjamin locales@kamusi.org + */ +return array_replace_recursive(require __DIR__.'/sw.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['Januari', 'Februari', 'Machi', 'Aprili', 'Mei', 'Juni', 'Julai', 'Agosti', 'Septemba', 'Oktoba', 'Novemba', 'Desemba'], + 'months_short' => ['Jan', 'Feb', 'Mac', 'Apr', 'Mei', 'Jun', 'Jul', 'Ago', 'Sep', 'Okt', 'Nov', 'Des'], + 'weekdays' => ['Jumapili', 'Jumatatu', 'Jumanne', 'Jumatano', 'Alhamisi', 'Ijumaa', 'Jumamosi'], + 'weekdays_short' => ['J2', 'J3', 'J4', 'J5', 'Alh', 'Ij', 'J1'], + 'weekdays_min' => ['J2', 'J3', 'J4', 'J5', 'Alh', 'Ij', 'J1'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['asubuhi', 'alasiri'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sw_TZ.php b/vendor/nesbot/carbon/src/Carbon/Lang/sw_TZ.php new file mode 100644 index 00000000..fab3cd68 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sw_TZ.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Kamusi Project Martin Benjamin locales@kamusi.org + */ +return array_replace_recursive(require __DIR__.'/sw.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['Januari', 'Februari', 'Machi', 'Aprili', 'Mei', 'Juni', 'Julai', 'Agosti', 'Septemba', 'Oktoba', 'Novemba', 'Desemba'], + 'months_short' => ['Jan', 'Feb', 'Mac', 'Apr', 'Mei', 'Jun', 'Jul', 'Ago', 'Sep', 'Okt', 'Nov', 'Des'], + 'weekdays' => ['Jumapili', 'Jumatatu', 'Jumanne', 'Jumatano', 'Alhamisi', 'Ijumaa', 'Jumamosi'], + 'weekdays_short' => ['J2', 'J3', 'J4', 'J5', 'Alh', 'Ij', 'J1'], + 'weekdays_min' => ['J2', 'J3', 'J4', 'J5', 'Alh', 'Ij', 'J1'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['asubuhi', 'alasiri'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sw_UG.php b/vendor/nesbot/carbon/src/Carbon/Lang/sw_UG.php new file mode 100644 index 00000000..ec9117b5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sw_UG.php @@ -0,0 +1,17 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/sw.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/szl.php b/vendor/nesbot/carbon/src/Carbon/Lang/szl.php new file mode 100644 index 00000000..4429c4f5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/szl.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/szl_PL.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/szl_PL.php b/vendor/nesbot/carbon/src/Carbon/Lang/szl_PL.php new file mode 100644 index 00000000..9adddcf8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/szl_PL.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - szl_PL locale Przemyslaw Buczkowski libc-alpha@sourceware.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD.MM.YYYY', + ], + 'months' => ['styczyń', 'luty', 'merc', 'kwjeciyń', 'moj', 'czyrwjyń', 'lipjyń', 'siyrpjyń', 'wrzesiyń', 'październik', 'listopad', 'grudziyń'], + 'months_short' => ['sty', 'lut', 'mer', 'kwj', 'moj', 'czy', 'lip', 'siy', 'wrz', 'paź', 'lis', 'gru'], + 'weekdays' => ['niydziela', 'pyńdziŏek', 'wtŏrek', 'strzŏda', 'sztwortek', 'pjōntek', 'sobŏta'], + 'weekdays_short' => ['niy', 'pyń', 'wtŏ', 'str', 'szt', 'pjō', 'sob'], + 'weekdays_min' => ['niy', 'pyń', 'wtŏ', 'str', 'szt', 'pjō', 'sob'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + + 'year' => ':count rok', + 'y' => ':count rok', + 'a_year' => ':count rok', + + 'month' => ':count mjeśůnc', + 'm' => ':count mjeśůnc', + 'a_month' => ':count mjeśůnc', + + 'week' => ':count tydźyń', + 'w' => ':count tydźyń', + 'a_week' => ':count tydźyń', + + 'day' => ':count dźyń', + 'd' => ':count dźyń', + 'a_day' => ':count dźyń', + + 'hour' => ':count godzina', + 'h' => ':count godzina', + 'a_hour' => ':count godzina', + + 'minute' => ':count minuta', + 'min' => ':count minuta', + 'a_minute' => ':count minuta', + + 'second' => ':count sekůnda', + 's' => ':count sekůnda', + 'a_second' => ':count sekůnda', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ta.php b/vendor/nesbot/carbon/src/Carbon/Lang/ta.php new file mode 100644 index 00000000..c1d89cbb --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ta.php @@ -0,0 +1,97 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - François B + * - JD Isaacks + * - Satheez + */ +return [ + 'year' => ':count வருடம்|:count ஆண்டுகள்', + 'a_year' => 'ஒரு வருடம்|:count ஆண்டுகள்', + 'y' => ':count வருட.|:count ஆண்.', + 'month' => ':count மாதம்|:count மாதங்கள்', + 'a_month' => 'ஒரு மாதம்|:count மாதங்கள்', + 'm' => ':count மாத.', + 'week' => ':count வாரம்|:count வாரங்கள்', + 'a_week' => 'ஒரு வாரம்|:count வாரங்கள்', + 'w' => ':count வார.', + 'day' => ':count நாள்|:count நாட்கள்', + 'a_day' => 'ஒரு நாள்|:count நாட்கள்', + 'd' => ':count நாள்|:count நாட்.', + 'hour' => ':count மணி நேரம்|:count மணி நேரம்', + 'a_hour' => 'ஒரு மணி நேரம்|:count மணி நேரம்', + 'h' => ':count மணி.', + 'minute' => ':count நிமிடம்|:count நிமிடங்கள்', + 'a_minute' => 'ஒரு நிமிடம்|:count நிமிடங்கள்', + 'min' => ':count நிமி.', + 'second' => ':count சில விநாடிகள்|:count விநாடிகள்', + 'a_second' => 'ஒரு சில விநாடிகள்|:count விநாடிகள்', + 's' => ':count விநா.', + 'ago' => ':time முன்', + 'from_now' => ':time இல்', + 'before' => ':time முன்', + 'after' => ':time பின்', + 'diff_now' => 'இப்போது', + 'diff_today' => 'இன்று', + 'diff_yesterday' => 'நேற்று', + 'diff_tomorrow' => 'நாளை', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY, HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY, HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[இன்று] LT', + 'nextDay' => '[நாளை] LT', + 'nextWeek' => 'dddd, LT', + 'lastDay' => '[நேற்று] LT', + 'lastWeek' => '[கடந்த வாரம்] dddd, LT', + 'sameElse' => 'L', + ], + 'ordinal' => ':numberவது', + 'meridiem' => function ($hour) { + if ($hour < 2) { + return ' யாமம்'; + } + if ($hour < 6) { + return ' வைகறை'; + } + if ($hour < 10) { + return ' காலை'; + } + if ($hour < 14) { + return ' நண்பகல்'; + } + if ($hour < 18) { + return ' எற்பாடு'; + } + if ($hour < 22) { + return ' மாலை'; + } + + return ' யாமம்'; + }, + 'months' => ['ஜனவரி', 'பிப்ரவரி', 'மார்ச்', 'ஏப்ரல்', 'மே', 'ஜூன்', 'ஜூலை', 'ஆகஸ்ட்', 'செப்டெம்பர்', 'அக்டோபர்', 'நவம்பர்', 'டிசம்பர்'], + 'months_short' => ['ஜனவரி', 'பிப்ரவரி', 'மார்ச்', 'ஏப்ரல்', 'மே', 'ஜூன்', 'ஜூலை', 'ஆகஸ்ட்', 'செப்டெம்பர்', 'அக்டோபர்', 'நவம்பர்', 'டிசம்பர்'], + 'weekdays' => ['ஞாயிற்றுக்கிழமை', 'திங்கட்கிழமை', 'செவ்வாய்கிழமை', 'புதன்கிழமை', 'வியாழக்கிழமை', 'வெள்ளிக்கிழமை', 'சனிக்கிழமை'], + 'weekdays_short' => ['ஞாயிறு', 'திங்கள்', 'செவ்வாய்', 'புதன்', 'வியாழன்', 'வெள்ளி', 'சனி'], + 'weekdays_min' => ['ஞா', 'தி', 'செ', 'பு', 'வி', 'வெ', 'ச'], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' மற்றும் '], + 'weekend' => [0, 0], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ta_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/ta_IN.php new file mode 100644 index 00000000..492d4c56 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ta_IN.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/ta.php', [ + 'formats' => [ + 'L' => 'D/M/YY', + ], + 'months' => ['ஜனவரி', 'பிப்ரவரி', 'மார்ச்', 'ஏப்ரல்', 'மே', 'ஜூன்', 'ஜூலை', 'ஆகஸ்ட்', 'செப்டம்பர்', 'அக்டோபர்', 'நவம்பர்', 'டிசம்பர்'], + 'months_short' => ['ஜன.', 'பிப்.', 'மார்.', 'ஏப்.', 'மே', 'ஜூன்', 'ஜூலை', 'ஆக.', 'செப்.', 'அக்.', 'நவ.', 'டிச.'], + 'weekdays' => ['ஞாயிறு', 'திங்கள்', 'செவ்வாய்', 'புதன்', 'வியாழன்', 'வெள்ளி', 'சனி'], + 'weekdays_short' => ['ஞா', 'தி', 'செ', 'பு', 'வி', 'வெ', 'ச'], + 'weekdays_min' => ['ஞா', 'தி', 'செ', 'பு', 'வி', 'வெ', 'ச'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['காலை', 'மாலை'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ta_LK.php b/vendor/nesbot/carbon/src/Carbon/Lang/ta_LK.php new file mode 100644 index 00000000..8e2afbf6 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ta_LK.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - J.Yogaraj 94-777-315206 yogaraj.ubuntu@gmail.com + */ +return array_replace_recursive(require __DIR__.'/ta.php', [ + 'formats' => [ + 'L' => 'D/M/YY', + ], + 'months' => ['ஜனவரி', 'பிப்ரவரி', 'மார்ச்', 'ஏப்ரல்', 'மே', 'ஜூன்', 'ஜூலை', 'ஆகஸ்ட்', 'செப்டம்பர்', 'அக்டோபர்', 'நவம்பர்', 'டிசம்பர்'], + 'months_short' => ['ஜன', 'பிப்', 'மார்', 'ஏப்', 'மே', 'ஜூன்', 'ஜூலை', 'ஆக', 'செப்', 'அக்', 'நவ', 'டிச'], + 'weekdays' => ['ஞாயிறு', 'திங்கள்', 'செவ்வாய்', 'புதன்', 'வியாழன்', 'வெள்ளி', 'சனி'], + 'weekdays_short' => ['ஞா', 'தி', 'செ', 'பு', 'வி', 'வெ', 'ச'], + 'weekdays_min' => ['ஞா', 'தி', 'செ', 'பு', 'வி', 'வெ', 'ச'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['காலை', 'மாலை'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ta_MY.php b/vendor/nesbot/carbon/src/Carbon/Lang/ta_MY.php new file mode 100644 index 00000000..a6cd8b51 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ta_MY.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ta.php', [ + 'formats' => [ + 'LT' => 'a h:mm', + 'LTS' => 'a h:mm:ss', + 'L' => 'D/M/yy', + 'LL' => 'D MMM, YYYY', + 'LLL' => 'D MMMM, YYYY, a h:mm', + 'LLLL' => 'dddd, D MMMM, YYYY, a h:mm', + ], + 'months' => ['ஜனவரி', 'பிப்ரவரி', 'மார்ச்', 'ஏப்ரல்', 'மே', 'ஜூன்', 'ஜூலை', 'ஆகஸ்ட்', 'செப்டம்பர்', 'அக்டோபர்', 'நவம்பர்', 'டிசம்பர்'], + 'months_short' => ['ஜன.', 'பிப்.', 'மார்.', 'ஏப்.', 'மே', 'ஜூன்', 'ஜூலை', 'ஆக.', 'செப்.', 'அக்.', 'நவ.', 'டிச.'], + 'weekdays' => ['ஞாயிறு', 'திங்கள்', 'செவ்வாய்', 'புதன்', 'வியாழன்', 'வெள்ளி', 'சனி'], + 'weekdays_short' => ['ஞாயி.', 'திங்.', 'செவ்.', 'புத.', 'வியா.', 'வெள்.', 'சனி'], + 'weekdays_min' => ['ஞா', 'தி', 'செ', 'பு', 'வி', 'வெ', 'ச'], + 'first_day_of_week' => 1, + 'meridiem' => ['மு.ப', 'பி.ப'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ta_SG.php b/vendor/nesbot/carbon/src/Carbon/Lang/ta_SG.php new file mode 100644 index 00000000..7dbedeee --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ta_SG.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ta.php', [ + 'formats' => [ + 'LT' => 'a h:mm', + 'LTS' => 'a h:mm:ss', + 'L' => 'D/M/yy', + 'LL' => 'D MMM, YYYY', + 'LLL' => 'D MMMM, YYYY, a h:mm', + 'LLLL' => 'dddd, D MMMM, YYYY, a h:mm', + ], + 'months' => ['ஜனவரி', 'பிப்ரவரி', 'மார்ச்', 'ஏப்ரல்', 'மே', 'ஜூன்', 'ஜூலை', 'ஆகஸ்ட்', 'செப்டம்பர்', 'அக்டோபர்', 'நவம்பர்', 'டிசம்பர்'], + 'months_short' => ['ஜன.', 'பிப்.', 'மார்.', 'ஏப்.', 'மே', 'ஜூன்', 'ஜூலை', 'ஆக.', 'செப்.', 'அக்.', 'நவ.', 'டிச.'], + 'weekdays' => ['ஞாயிறு', 'திங்கள்', 'செவ்வாய்', 'புதன்', 'வியாழன்', 'வெள்ளி', 'சனி'], + 'weekdays_short' => ['ஞாயி.', 'திங்.', 'செவ்.', 'புத.', 'வியா.', 'வெள்.', 'சனி'], + 'weekdays_min' => ['ஞா', 'தி', 'செ', 'பு', 'வி', 'வெ', 'ச'], + 'meridiem' => ['மு.ப', 'பி.ப'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tcy.php b/vendor/nesbot/carbon/src/Carbon/Lang/tcy.php new file mode 100644 index 00000000..2eb99057 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tcy.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/tcy_IN.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tcy_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/tcy_IN.php new file mode 100644 index 00000000..2ff20e0e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tcy_IN.php @@ -0,0 +1,39 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - IndLinux.org, Samsung Electronics Co., Ltd. alexey.merzlyakov@samsung.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'D/M/YY', + ], + 'months' => ['ಜನವರಿ', 'ಫೆಬ್ರುವರಿ', 'ಮಾರ್ಚ್', 'ಏಪ್ರಿಲ್‌‌', 'ಮೇ', 'ಜೂನ್', 'ಜುಲೈ', 'ಆಗಸ್ಟ್', 'ಸೆಪ್ಟೆಂಬರ್‌', 'ಅಕ್ಟೋಬರ್', 'ನವೆಂಬರ್', 'ಡಿಸೆಂಬರ್'], + 'months_short' => ['ಜ', 'ಫೆ', 'ಮಾ', 'ಏ', 'ಮೇ', 'ಜೂ', 'ಜು', 'ಆ', 'ಸೆ', 'ಅ', 'ನ', 'ಡಿ'], + 'weekdays' => ['ಐಥಾರ', 'ಸೋಮಾರ', 'ಅಂಗರೆ', 'ಬುಧಾರ', 'ಗುರುವಾರ', 'ಶುಕ್ರರ', 'ಶನಿವಾರ'], + 'weekdays_short' => ['ಐ', 'ಸೋ', 'ಅಂ', 'ಬು', 'ಗು', 'ಶು', 'ಶ'], + 'weekdays_min' => ['ಐ', 'ಸೋ', 'ಅಂ', 'ಬು', 'ಗು', 'ಶು', 'ಶ'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['ಕಾಂಡೆ', 'ಬಯ್ಯ'], + + 'year' => ':count ನೀರ್', // less reliable + 'y' => ':count ನೀರ್', // less reliable + 'a_year' => ':count ನೀರ್', // less reliable + + 'month' => ':count ಮೀನ್', // less reliable + 'm' => ':count ಮೀನ್', // less reliable + 'a_month' => ':count ಮೀನ್', // less reliable + + 'day' => ':count ಸುಗ್ಗಿ', // less reliable + 'd' => ':count ಸುಗ್ಗಿ', // less reliable + 'a_day' => ':count ಸುಗ್ಗಿ', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/te.php b/vendor/nesbot/carbon/src/Carbon/Lang/te.php new file mode 100644 index 00000000..ac38218f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/te.php @@ -0,0 +1,89 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Kunal Marwaha + * - Josh Soref + * - François B + * - kc + */ +return [ + 'year' => ':count సంవత్సరం|:count సంవత్సరాలు', + 'a_year' => 'ఒక సంవత్సరం|:count సంవత్సరాలు', + 'y' => ':count సం.', + 'month' => ':count నెల|:count నెలలు', + 'a_month' => 'ఒక నెల|:count నెలలు', + 'm' => ':count నెల|:count నెల.', + 'week' => ':count వారం|:count వారాలు', + 'a_week' => 'ఒక వారం|:count వారాలు', + 'w' => ':count వార.|:count వారా.', + 'day' => ':count రోజు|:count రోజులు', + 'a_day' => 'ఒక రోజు|:count రోజులు', + 'd' => ':count రోజు|:count రోజు.', + 'hour' => ':count గంట|:count గంటలు', + 'a_hour' => 'ఒక గంట|:count గంటలు', + 'h' => ':count గం.', + 'minute' => ':count నిమిషం|:count నిమిషాలు', + 'a_minute' => 'ఒక నిమిషం|:count నిమిషాలు', + 'min' => ':count నిమి.', + 'second' => ':count సెకను|:count సెకన్లు', + 'a_second' => 'కొన్ని క్షణాలు|:count సెకన్లు', + 's' => ':count సెక.', + 'ago' => ':time క్రితం', + 'from_now' => ':time లో', + 'diff_now' => 'ప్రస్తుతం', + 'diff_today' => 'నేడు', + 'diff_yesterday' => 'నిన్న', + 'diff_tomorrow' => 'రేపు', + 'formats' => [ + 'LT' => 'A h:mm', + 'LTS' => 'A h:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY, A h:mm', + 'LLLL' => 'dddd, D MMMM YYYY, A h:mm', + ], + 'calendar' => [ + 'sameDay' => '[నేడు] LT', + 'nextDay' => '[రేపు] LT', + 'nextWeek' => 'dddd, LT', + 'lastDay' => '[నిన్న] LT', + 'lastWeek' => '[గత] dddd, LT', + 'sameElse' => 'L', + ], + 'ordinal' => ':numberవ', + 'meridiem' => function ($hour) { + if ($hour < 4) { + return 'రాత్రి'; + } + if ($hour < 10) { + return 'ఉదయం'; + } + if ($hour < 17) { + return 'మధ్యాహ్నం'; + } + if ($hour < 20) { + return 'సాయంత్రం'; + } + + return ' రాత్రి'; + }, + 'months' => ['జనవరి', 'ఫిబ్రవరి', 'మార్చి', 'ఏప్రిల్', 'మే', 'జూన్', 'జూలై', 'ఆగస్టు', 'సెప్టెంబర్', 'అక్టోబర్', 'నవంబర్', 'డిసెంబర్'], + 'months_short' => ['జన.', 'ఫిబ్ర.', 'మార్చి', 'ఏప్రి.', 'మే', 'జూన్', 'జూలై', 'ఆగ.', 'సెప్.', 'అక్టో.', 'నవ.', 'డిసె.'], + 'weekdays' => ['ఆదివారం', 'సోమవారం', 'మంగళవారం', 'బుధవారం', 'గురువారం', 'శుక్రవారం', 'శనివారం'], + 'weekdays_short' => ['ఆది', 'సోమ', 'మంగళ', 'బుధ', 'గురు', 'శుక్ర', 'శని'], + 'weekdays_min' => ['ఆ', 'సో', 'మం', 'బు', 'గు', 'శు', 'శ'], + 'list' => ', ', + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, + 'weekend' => [0, 0], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/te_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/te_IN.php new file mode 100644 index 00000000..3963f8d5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/te_IN.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/te.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/teo.php b/vendor/nesbot/carbon/src/Carbon/Lang/teo.php new file mode 100644 index 00000000..ca30c37d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/teo.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ta.php', [ + 'meridiem' => ['Taparachu', 'Ebongi'], + 'weekdays' => ['Nakaejuma', 'Nakaebarasa', 'Nakaare', 'Nakauni', 'Nakaung’on', 'Nakakany', 'Nakasabiti'], + 'weekdays_short' => ['Jum', 'Bar', 'Aar', 'Uni', 'Ung', 'Kan', 'Sab'], + 'weekdays_min' => ['Jum', 'Bar', 'Aar', 'Uni', 'Ung', 'Kan', 'Sab'], + 'months' => ['Orara', 'Omuk', 'Okwamg’', 'Odung’el', 'Omaruk', 'Omodok’king’ol', 'Ojola', 'Opedel', 'Osokosokoma', 'Otibar', 'Olabor', 'Opoo'], + 'months_short' => ['Rar', 'Muk', 'Kwa', 'Dun', 'Mar', 'Mod', 'Jol', 'Ped', 'Sok', 'Tib', 'Lab', 'Poo'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/teo_KE.php b/vendor/nesbot/carbon/src/Carbon/Lang/teo_KE.php new file mode 100644 index 00000000..010a04f5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/teo_KE.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/teo.php', [ + 'first_day_of_week' => 0, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tet.php b/vendor/nesbot/carbon/src/Carbon/Lang/tet.php new file mode 100644 index 00000000..d0544d4e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tet.php @@ -0,0 +1,64 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Joshua Brooks + * - François B + */ +return [ + 'year' => 'tinan :count', + 'a_year' => '{1}tinan ida|tinan :count', + 'month' => 'fulan :count', + 'a_month' => '{1}fulan ida|fulan :count', + 'week' => 'semana :count', + 'a_week' => '{1}semana ida|semana :count', + 'day' => 'loron :count', + 'a_day' => '{1}loron ida|loron :count', + 'hour' => 'oras :count', + 'a_hour' => '{1}oras ida|oras :count', + 'minute' => 'minutu :count', + 'a_minute' => '{1}minutu ida|minutu :count', + 'second' => 'segundu :count', + 'a_second' => '{1}segundu balun|segundu :count', + 'ago' => ':time liuba', + 'from_now' => 'iha :time', + 'diff_yesterday' => 'Horiseik', + 'diff_yesterday_regexp' => 'Horiseik(?:\\s+iha)?', + 'diff_today' => 'Ohin', + 'diff_today_regexp' => 'Ohin(?:\\s+iha)?', + 'diff_tomorrow' => 'Aban', + 'diff_tomorrow_regexp' => 'Aban(?:\\s+iha)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Ohin iha] LT', + 'nextDay' => '[Aban iha] LT', + 'nextWeek' => 'dddd [iha] LT', + 'lastDay' => '[Horiseik iha] LT', + 'lastWeek' => 'dddd [semana kotuk] [iha] LT', + 'sameElse' => 'L', + ], + 'ordinal' => ':numberº', + 'months' => ['Janeiru', 'Fevereiru', 'Marsu', 'Abril', 'Maiu', 'Juñu', 'Jullu', 'Agustu', 'Setembru', 'Outubru', 'Novembru', 'Dezembru'], + 'months_short' => ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'], + 'weekdays' => ['Domingu', 'Segunda', 'Tersa', 'Kuarta', 'Kinta', 'Sesta', 'Sabadu'], + 'weekdays_short' => ['Dom', 'Seg', 'Ters', 'Kua', 'Kint', 'Sest', 'Sab'], + 'weekdays_min' => ['Do', 'Seg', 'Te', 'Ku', 'Ki', 'Ses', 'Sa'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tg.php b/vendor/nesbot/carbon/src/Carbon/Lang/tg.php new file mode 100644 index 00000000..b7df893c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tg.php @@ -0,0 +1,104 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Orif N. Jr + */ +return [ + 'year' => '{1}як сол|:count сол', + 'month' => '{1}як моҳ|:count моҳ', + 'week' => '{1}як ҳафта|:count ҳафта', + 'day' => '{1}як рӯз|:count рӯз', + 'hour' => '{1}як соат|:count соат', + 'minute' => '{1}як дақиқа|:count дақиқа', + 'second' => '{1}якчанд сония|:count сония', + 'ago' => ':time пеш', + 'from_now' => 'баъди :time', + 'diff_today' => 'Имрӯз', + 'diff_yesterday' => 'Дирӯз', + 'diff_yesterday_regexp' => 'Дирӯз(?:\\s+соати)?', + 'diff_tomorrow' => 'Пагоҳ', + 'diff_tomorrow_regexp' => 'Пагоҳ(?:\\s+соати)?', + 'diff_today_regexp' => 'Имрӯз(?:\\s+соати)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Имрӯз соати] LT', + 'nextDay' => '[Пагоҳ соати] LT', + 'nextWeek' => 'dddd[и] [ҳафтаи оянда соати] LT', + 'lastDay' => '[Дирӯз соати] LT', + 'lastWeek' => 'dddd[и] [ҳафтаи гузашта соати] LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number) { + if ($number === 0) { // special case for zero + return "$number-ıncı"; + } + + static $suffixes = [ + 0 => '-ум', + 1 => '-ум', + 2 => '-юм', + 3 => '-юм', + 4 => '-ум', + 5 => '-ум', + 6 => '-ум', + 7 => '-ум', + 8 => '-ум', + 9 => '-ум', + 10 => '-ум', + 12 => '-ум', + 13 => '-ум', + 20 => '-ум', + 30 => '-юм', + 40 => '-ум', + 50 => '-ум', + 60 => '-ум', + 70 => '-ум', + 80 => '-ум', + 90 => '-ум', + 100 => '-ум', + ]; + + return $number.($suffixes[$number] ?? $suffixes[$number % 10] ?? $suffixes[$number >= 100 ? 100 : -1] ?? ''); + }, + 'meridiem' => function ($hour) { + if ($hour < 4) { + return 'шаб'; + } + if ($hour < 11) { + return 'субҳ'; + } + if ($hour < 16) { + return 'рӯз'; + } + if ($hour < 19) { + return 'бегоҳ'; + } + + return 'шаб'; + }, + 'months' => ['январ', 'феврал', 'март', 'апрел', 'май', 'июн', 'июл', 'август', 'сентябр', 'октябр', 'ноябр', 'декабр'], + 'months_short' => ['янв', 'фев', 'мар', 'апр', 'май', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек'], + 'weekdays' => ['якшанбе', 'душанбе', 'сешанбе', 'чоршанбе', 'панҷшанбе', 'ҷумъа', 'шанбе'], + 'weekdays_short' => ['яшб', 'дшб', 'сшб', 'чшб', 'пшб', 'ҷум', 'шнб'], + 'weekdays_min' => ['яш', 'дш', 'сш', 'чш', 'пш', 'ҷм', 'шб'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' ва '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tg_TJ.php b/vendor/nesbot/carbon/src/Carbon/Lang/tg_TJ.php new file mode 100644 index 00000000..badc7d1f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tg_TJ.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/tg.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/th.php b/vendor/nesbot/carbon/src/Carbon/Lang/th.php new file mode 100644 index 00000000..6397f6e4 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/th.php @@ -0,0 +1,73 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Nate Whittaker + * - John MacAslan + * - Chanintorn Asavavichairoj + * - JD Isaacks + * - ROKAISAKKON + * - RO'KAISAKKON + * - Andreas Möller + * - nithisa + */ +return [ + 'year' => ':count ปี', + 'y' => ':count ปี', + 'month' => ':count เดือน', + 'm' => ':count เดือน', + 'week' => ':count สัปดาห์', + 'w' => ':count สัปดาห์', + 'day' => ':count วัน', + 'd' => ':count วัน', + 'hour' => ':count ชั่วโมง', + 'h' => ':count ชั่วโมง', + 'minute' => ':count นาที', + 'min' => ':count นาที', + 'second' => ':count วินาที', + 'a_second' => '{1}ไม่กี่วินาที|]1,Inf[:count วินาที', + 's' => ':count วินาที', + 'ago' => ':timeที่แล้ว', + 'from_now' => 'อีก :time', + 'after' => ':timeหลังจากนี้', + 'before' => ':timeก่อน', + 'diff_now' => 'ขณะนี้', + 'diff_today' => 'วันนี้', + 'diff_today_regexp' => 'วันนี้(?:\\s+เวลา)?', + 'diff_yesterday' => 'เมื่อวาน', + 'diff_yesterday_regexp' => 'เมื่อวานนี้(?:\\s+เวลา)?', + 'diff_tomorrow' => 'พรุ่งนี้', + 'diff_tomorrow_regexp' => 'พรุ่งนี้(?:\\s+เวลา)?', + 'formats' => [ + 'LT' => 'H:mm', + 'LTS' => 'H:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY เวลา H:mm', + 'LLLL' => 'วันddddที่ D MMMM YYYY เวลา H:mm', + ], + 'calendar' => [ + 'sameDay' => '[วันนี้ เวลา] LT', + 'nextDay' => '[พรุ่งนี้ เวลา] LT', + 'nextWeek' => 'dddd[หน้า เวลา] LT', + 'lastDay' => '[เมื่อวานนี้ เวลา] LT', + 'lastWeek' => '[วัน]dddd[ที่แล้ว เวลา] LT', + 'sameElse' => 'L', + ], + 'meridiem' => ['ก่อนเที่ยง', 'หลังเที่ยง'], + 'months' => ['มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'], + 'months_short' => ['ม.ค.', 'ก.พ.', 'มี.ค.', 'เม.ย.', 'พ.ค.', 'มิ.ย.', 'ก.ค.', 'ส.ค.', 'ก.ย.', 'ต.ค.', 'พ.ย.', 'ธ.ค.'], + 'weekdays' => ['อาทิตย์', 'จันทร์', 'อังคาร', 'พุธ', 'พฤหัสบดี', 'ศุกร์', 'เสาร์'], + 'weekdays_short' => ['อาทิตย์', 'จันทร์', 'อังคาร', 'พุธ', 'พฤหัส', 'ศุกร์', 'เสาร์'], + 'weekdays_min' => ['อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.'], + 'list' => [', ', ' และ '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/th_TH.php b/vendor/nesbot/carbon/src/Carbon/Lang/th_TH.php new file mode 100644 index 00000000..b9f94b2d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/th_TH.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/th.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/the.php b/vendor/nesbot/carbon/src/Carbon/Lang/the.php new file mode 100644 index 00000000..85f8333b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/the.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/the_NP.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/the_NP.php b/vendor/nesbot/carbon/src/Carbon/Lang/the_NP.php new file mode 100644 index 00000000..34da1627 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/the_NP.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Chitwanix OS Development info@chitwanix.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'dddd DD MMM YYYY', + ], + 'months' => ['जनवरी', 'फ़रवरी', 'मार्च', 'अप्रेल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितम्बर', 'अक्टूबर', 'नवम्बर', 'दिसम्बर'], + 'months_short' => ['जनवरी', 'फ़रवरी', 'मार्च', 'अप्रेल', 'मई', 'जून', 'जुलाई', 'अगस्त', 'सितम्बर', 'अक्टूबर', 'नवम्बर', 'दिसम्बर'], + 'weekdays' => ['आइतबार', 'सोमबार', 'मंगलबार', 'बुधबार', 'बिहिबार', 'शुक्रबार', 'शनिबार'], + 'weekdays_short' => ['आइत', 'सोम', 'मंगल', 'बुध', 'बिहि', 'शुक्र', 'शनि'], + 'weekdays_min' => ['आइत', 'सोम', 'मंगल', 'बुध', 'बिहि', 'शुक्र', 'शनि'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['पूर्वाह्न', 'अपराह्न'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ti.php b/vendor/nesbot/carbon/src/Carbon/Lang/ti.php new file mode 100644 index 00000000..ffd32369 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ti.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/ti_ER.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ti_ER.php b/vendor/nesbot/carbon/src/Carbon/Lang/ti_ER.php new file mode 100644 index 00000000..310c51cc --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ti_ER.php @@ -0,0 +1,56 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Ge'ez Frontier Foundation locales@geez.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['ጥሪ', 'ለካቲት', 'መጋቢት', 'ሚያዝያ', 'ግንቦት', 'ሰነ', 'ሓምለ', 'ነሓሰ', 'መስከረም', 'ጥቅምቲ', 'ሕዳር', 'ታሕሳስ'], + 'months_short' => ['ጥሪ ', 'ለካቲ', 'መጋቢ', 'ሚያዝ', 'ግንቦ', 'ሰነ ', 'ሓምለ', 'ነሓሰ', 'መስከ', 'ጥቅም', 'ሕዳር', 'ታሕሳ'], + 'weekdays' => ['ሰንበት', 'ሰኑይ', 'ሰሉስ', 'ረቡዕ', 'ሓሙስ', 'ዓርቢ', 'ቀዳም'], + 'weekdays_short' => ['ሰንበ', 'ሰኑይ', 'ሰሉስ', 'ረቡዕ', 'ሓሙስ', 'ዓርቢ', 'ቀዳም'], + 'weekdays_min' => ['ሰንበ', 'ሰኑይ', 'ሰሉስ', 'ረቡዕ', 'ሓሙስ', 'ዓርቢ', 'ቀዳም'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['ንጉሆ ሰዓተ', 'ድሕር ሰዓት'], + + 'year' => ':count ዓመት', + 'y' => ':count ዓመት', + 'a_year' => ':count ዓመት', + + 'month' => 'ወርሒ :count', + 'm' => 'ወርሒ :count', + 'a_month' => 'ወርሒ :count', + + 'week' => ':count ሰሙን', + 'w' => ':count ሰሙን', + 'a_week' => ':count ሰሙን', + + 'day' => ':count መዓልቲ', + 'd' => ':count መዓልቲ', + 'a_day' => ':count መዓልቲ', + + 'hour' => ':count ሰዓት', + 'h' => ':count ሰዓት', + 'a_hour' => ':count ሰዓት', + + 'minute' => ':count ደቒቕ', + 'min' => ':count ደቒቕ', + 'a_minute' => ':count ደቒቕ', + + 'second' => ':count ሰከንድ', + 's' => ':count ሰከንድ', + 'a_second' => ':count ሰከንድ', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ti_ET.php b/vendor/nesbot/carbon/src/Carbon/Lang/ti_ET.php new file mode 100644 index 00000000..024217f2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ti_ET.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Ge'ez Frontier Foundation locales@geez.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['ጃንዩወሪ', 'ፌብሩወሪ', 'ማርች', 'ኤፕረል', 'ሜይ', 'ጁን', 'ጁላይ', 'ኦገስት', 'ሴፕቴምበር', 'ኦክተውበር', 'ኖቬምበር', 'ዲሴምበር'], + 'months_short' => ['ጃንዩ', 'ፌብሩ', 'ማርች', 'ኤፕረ', 'ሜይ ', 'ጁን ', 'ጁላይ', 'ኦገስ', 'ሴፕቴ', 'ኦክተ', 'ኖቬም', 'ዲሴም'], + 'weekdays' => ['ሰንበት', 'ሰኑይ', 'ሰሉስ', 'ረቡዕ', 'ሓሙስ', 'ዓርቢ', 'ቀዳም'], + 'weekdays_short' => ['ሰንበ', 'ሰኑይ', 'ሰሉስ', 'ረቡዕ', 'ሓሙስ', 'ዓርቢ', 'ቀዳም'], + 'weekdays_min' => ['ሰንበ', 'ሰኑይ', 'ሰሉስ', 'ረቡዕ', 'ሓሙስ', 'ዓርቢ', 'ቀዳም'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['ንጉሆ ሰዓተ', 'ድሕር ሰዓት'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tig.php b/vendor/nesbot/carbon/src/Carbon/Lang/tig.php new file mode 100644 index 00000000..186fe713 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tig.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/tig_ER.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tig_ER.php b/vendor/nesbot/carbon/src/Carbon/Lang/tig_ER.php new file mode 100644 index 00000000..46887b05 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tig_ER.php @@ -0,0 +1,56 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Ge'ez Frontier Foundation locales@geez.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['ጥሪ', 'ለካቲት', 'መጋቢት', 'ሚያዝያ', 'ግንቦት', 'ሰነ', 'ሓምለ', 'ነሓሰ', 'መስከረም', 'ጥቅምቲ', 'ሕዳር', 'ታሕሳስ'], + 'months_short' => ['ጥሪ ', 'ለካቲ', 'መጋቢ', 'ሚያዝ', 'ግንቦ', 'ሰነ ', 'ሓምለ', 'ነሓሰ', 'መስከ', 'ጥቅም', 'ሕዳር', 'ታሕሳ'], + 'weekdays' => ['ሰንበት ዓባይ', 'ሰኖ', 'ታላሸኖ', 'ኣረርባዓ', 'ከሚሽ', 'ጅምዓት', 'ሰንበት ንኢሽ'], + 'weekdays_short' => ['ሰ//ዓ', 'ሰኖ ', 'ታላሸ', 'ኣረር', 'ከሚሽ', 'ጅምዓ', 'ሰ//ን'], + 'weekdays_min' => ['ሰ//ዓ', 'ሰኖ ', 'ታላሸ', 'ኣረር', 'ከሚሽ', 'ጅምዓ', 'ሰ//ን'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['ቀደም ሰር ምዕል', 'ሓቆ ሰር ምዕል'], + + 'year' => ':count ማይ', // less reliable + 'y' => ':count ማይ', // less reliable + 'a_year' => ':count ማይ', // less reliable + + 'month' => ':count ሸምሽ', // less reliable + 'm' => ':count ሸምሽ', // less reliable + 'a_month' => ':count ሸምሽ', // less reliable + + 'week' => ':count ሰቡዕ', // less reliable + 'w' => ':count ሰቡዕ', // less reliable + 'a_week' => ':count ሰቡዕ', // less reliable + + 'day' => ':count ዎሮ', // less reliable + 'd' => ':count ዎሮ', // less reliable + 'a_day' => ':count ዎሮ', // less reliable + + 'hour' => ':count ሰዓት', // less reliable + 'h' => ':count ሰዓት', // less reliable + 'a_hour' => ':count ሰዓት', // less reliable + + 'minute' => ':count ካልኣይት', // less reliable + 'min' => ':count ካልኣይት', // less reliable + 'a_minute' => ':count ካልኣይት', // less reliable + + 'second' => ':count ካልኣይ', + 's' => ':count ካልኣይ', + 'a_second' => ':count ካልኣይ', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tk.php b/vendor/nesbot/carbon/src/Carbon/Lang/tk.php new file mode 100644 index 00000000..d8f7d19d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tk.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/tk_TM.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tk_TM.php b/vendor/nesbot/carbon/src/Carbon/Lang/tk_TM.php new file mode 100644 index 00000000..f949a430 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tk_TM.php @@ -0,0 +1,77 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * Authors: + * - Ghorban M. Tavakoly Pablo Saratxaga & Ghorban M. Tavakoly pablo@walon.org & gmt314@yahoo.com + * - SuperManPHP + * - Maksat Meredow (isadma) + */ +$transformDiff = function ($input) { + return strtr($input, [ + 'sekunt' => 'sekunt', + 'hepde' => 'hepde', + ]); +}; + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD.MM.YYYY', + ], + 'months' => ['Ýanwar', 'Fewral', 'Mart', 'Aprel', 'Maý', 'Iýun', 'Iýul', 'Awgust', 'Sentýabr', 'Oktýabr', 'Noýabr', 'Dekabr'], + 'months_short' => ['Ýan', 'Few', 'Mar', 'Apr', 'Maý', 'Iýn', 'Iýl', 'Awg', 'Sen', 'Okt', 'Noý', 'Dek'], + 'weekdays' => ['Duşenbe', 'Sişenbe', 'Çarşenbe', 'Penşenbe', 'Anna', 'Şenbe', 'Ýekşenbe'], + 'weekdays_short' => ['Duş', 'Siş', 'Çar', 'Pen', 'Ann', 'Şen', 'Ýek'], + 'weekdays_min' => ['Du', 'Si', 'Ça', 'Pe', 'An', 'Şe', 'Ýe'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + + 'year' => ':count ýyl', + 'y' => ':count ýyl', + 'a_year' => ':count ýyl', + + 'month' => ':count aý', + 'm' => ':count aý', + 'a_month' => ':count aý', + + 'week' => ':count hepde', + 'w' => ':count hepde', + 'a_week' => ':count hepde', + + 'day' => ':count gün', + 'd' => ':count gün', + 'a_day' => ':count gün', + + 'hour' => ':count sagat', + 'h' => ':count sagat', + 'a_hour' => ':count sagat', + + 'minute' => ':count minut', + 'min' => ':count minut', + 'a_minute' => ':count minut', + + 'second' => ':count sekunt', + 's' => ':count sekunt', + 'a_second' => ':count sekunt', + + 'ago' => function ($time) use ($transformDiff) { + return $transformDiff($time).' ozal'; + }, + 'from_now' => function ($time) use ($transformDiff) { + return $transformDiff($time).' soňra'; + }, + 'after' => function ($time) use ($transformDiff) { + return $transformDiff($time).' soň'; + }, + 'before' => function ($time) use ($transformDiff) { + return $transformDiff($time).' öň'; + }, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tl.php b/vendor/nesbot/carbon/src/Carbon/Lang/tl.php new file mode 100644 index 00000000..410a2660 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tl.php @@ -0,0 +1,61 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return [ + 'year' => ':count taon', + 'a_year' => '{1}isang taon|:count taon', + 'month' => ':count buwan', + 'a_month' => '{1}isang buwan|:count buwan', + 'week' => ':count linggo', + 'a_week' => '{1}isang linggo|:count linggo', + 'day' => ':count araw', + 'a_day' => '{1}isang araw|:count araw', + 'hour' => ':count oras', + 'a_hour' => '{1}isang oras|:count oras', + 'minute' => ':count minuto', + 'a_minute' => '{1}isang minuto|:count minuto', + 'min' => ':count min.', + 'second' => ':count segundo', + 'a_second' => '{1}ilang segundo|:count segundo', + 's' => ':count seg.', + 'ago' => ':time ang nakalipas', + 'from_now' => 'sa loob ng :time', + 'diff_now' => 'ngayon', + 'diff_today' => 'ngayong', + 'diff_today_regexp' => 'ngayong(?:\\s+araw)?', + 'diff_yesterday' => 'kahapon', + 'diff_tomorrow' => 'bukas', + 'diff_tomorrow_regexp' => 'Bukas(?:\\s+ng)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'MM/D/YYYY', + 'LL' => 'MMMM D, YYYY', + 'LLL' => 'MMMM D, YYYY HH:mm', + 'LLLL' => 'dddd, MMMM DD, YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => 'LT [ngayong araw]', + 'nextDay' => '[Bukas ng] LT', + 'nextWeek' => 'LT [sa susunod na] dddd', + 'lastDay' => 'LT [kahapon]', + 'lastWeek' => 'LT [noong nakaraang] dddd', + 'sameElse' => 'L', + ], + 'months' => ['Enero', 'Pebrero', 'Marso', 'Abril', 'Mayo', 'Hunyo', 'Hulyo', 'Agosto', 'Setyembre', 'Oktubre', 'Nobyembre', 'Disyembre'], + 'months_short' => ['Ene', 'Peb', 'Mar', 'Abr', 'May', 'Hun', 'Hul', 'Ago', 'Set', 'Okt', 'Nob', 'Dis'], + 'weekdays' => ['Linggo', 'Lunes', 'Martes', 'Miyerkules', 'Huwebes', 'Biyernes', 'Sabado'], + 'weekdays_short' => ['Lin', 'Lun', 'Mar', 'Miy', 'Huw', 'Biy', 'Sab'], + 'weekdays_min' => ['Li', 'Lu', 'Ma', 'Mi', 'Hu', 'Bi', 'Sab'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' at '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tl_PH.php b/vendor/nesbot/carbon/src/Carbon/Lang/tl_PH.php new file mode 100644 index 00000000..95f508c3 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tl_PH.php @@ -0,0 +1,18 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - François B + * - Ian De La Cruz + * - JD Isaacks + */ +return require __DIR__.'/tl.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tlh.php b/vendor/nesbot/carbon/src/Carbon/Lang/tlh.php new file mode 100644 index 00000000..fbf9e6f7 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tlh.php @@ -0,0 +1,72 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - François B + * - Serhan Apaydın + * - Dominika + */ +return [ + 'year' => '{1}wa’ DIS|:count DIS', + 'month' => '{1}wa’ jar|:count jar', + 'week' => '{1}wa’ hogh|:count hogh', + 'day' => '{1}wa’ jaj|:count jaj', + 'hour' => '{1}wa’ rep|:count rep', + 'minute' => '{1}wa’ tup|:count tup', + 'second' => '{1}puS lup|:count lup', + 'ago' => function ($time) { + $output = strtr($time, [ + 'jaj' => 'Hu’', + 'jar' => 'wen', + 'DIS' => 'ben', + ]); + + return $output === $time ? "$time ret" : $output; + }, + 'from_now' => function ($time) { + $output = strtr($time, [ + 'jaj' => 'leS', + 'jar' => 'waQ', + 'DIS' => 'nem', + ]); + + return $output === $time ? "$time pIq" : $output; + }, + 'diff_yesterday' => 'wa’Hu’', + 'diff_today' => 'DaHjaj', + 'diff_tomorrow' => 'wa’leS', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[DaHjaj] LT', + 'nextDay' => '[wa’leS] LT', + 'nextWeek' => 'LLL', + 'lastDay' => '[wa’Hu’] LT', + 'lastWeek' => 'LLL', + 'sameElse' => 'L', + ], + 'ordinal' => ':number.', + 'months' => ['tera’ jar wa’', 'tera’ jar cha’', 'tera’ jar wej', 'tera’ jar loS', 'tera’ jar vagh', 'tera’ jar jav', 'tera’ jar Soch', 'tera’ jar chorgh', 'tera’ jar Hut', 'tera’ jar wa’maH', 'tera’ jar wa’maH wa’', 'tera’ jar wa’maH cha’'], + 'months_short' => ['jar wa’', 'jar cha’', 'jar wej', 'jar loS', 'jar vagh', 'jar jav', 'jar Soch', 'jar chorgh', 'jar Hut', 'jar wa’maH', 'jar wa’maH wa’', 'jar wa’maH cha’'], + 'weekdays' => ['lojmItjaj', 'DaSjaj', 'povjaj', 'ghItlhjaj', 'loghjaj', 'buqjaj', 'ghInjaj'], + 'weekdays_short' => ['lojmItjaj', 'DaSjaj', 'povjaj', 'ghItlhjaj', 'loghjaj', 'buqjaj', 'ghInjaj'], + 'weekdays_min' => ['lojmItjaj', 'DaSjaj', 'povjaj', 'ghItlhjaj', 'loghjaj', 'buqjaj', 'ghInjaj'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' ’ej '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tn.php b/vendor/nesbot/carbon/src/Carbon/Lang/tn.php new file mode 100644 index 00000000..f29bdf68 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tn.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/tn_ZA.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tn_ZA.php b/vendor/nesbot/carbon/src/Carbon/Lang/tn_ZA.php new file mode 100644 index 00000000..aada7db5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tn_ZA.php @@ -0,0 +1,54 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Zuza Software Foundation (Translate.org.za) Dwayne Bailey dwayne@translate.org.za + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['Ferikgong', 'Tlhakole', 'Mopitlwe', 'Moranang', 'Motsheganong', 'Seetebosigo', 'Phukwi', 'Phatwe', 'Lwetse', 'Diphalane', 'Ngwanatsele', 'Sedimonthole'], + 'months_short' => ['Fer', 'Tlh', 'Mop', 'Mor', 'Mot', 'See', 'Phu', 'Pha', 'Lwe', 'Dip', 'Ngw', 'Sed'], + 'weekdays' => ['laTshipi', 'Mosupologo', 'Labobedi', 'Laboraro', 'Labone', 'Labotlhano', 'Lamatlhatso'], + 'weekdays_short' => ['Tsh', 'Mos', 'Bed', 'Rar', 'Ne', 'Tlh', 'Mat'], + 'weekdays_min' => ['Tsh', 'Mos', 'Bed', 'Rar', 'Ne', 'Tlh', 'Mat'], + 'day_of_first_week_of_year' => 1, + + 'year' => 'dingwaga di le :count', + 'y' => 'dingwaga di le :count', + 'a_year' => 'dingwaga di le :count', + + 'month' => 'dikgwedi di le :count', + 'm' => 'dikgwedi di le :count', + 'a_month' => 'dikgwedi di le :count', + + 'week' => 'dibeke di le :count', + 'w' => 'dibeke di le :count', + 'a_week' => 'dibeke di le :count', + + 'day' => 'malatsi :count', + 'd' => 'malatsi :count', + 'a_day' => 'malatsi :count', + + 'hour' => 'diura di le :count', + 'h' => 'diura di le :count', + 'a_hour' => 'diura di le :count', + + 'minute' => 'metsotso e le :count', + 'min' => 'metsotso e le :count', + 'a_minute' => 'metsotso e le :count', + + 'second' => 'metsotswana e le :count', + 's' => 'metsotswana e le :count', + 'a_second' => 'metsotswana e le :count', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/to.php b/vendor/nesbot/carbon/src/Carbon/Lang/to.php new file mode 100644 index 00000000..20581bba --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/to.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/to_TO.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/to_TO.php b/vendor/nesbot/carbon/src/Carbon/Lang/to_TO.php new file mode 100644 index 00000000..335c69a8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/to_TO.php @@ -0,0 +1,54 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - International Components for Unicode akhilesh.k@samsung.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'dddd DD MMM YYYY', + ], + 'months' => ['Sānuali', 'Fēpueli', 'Maʻasi', 'ʻEpeleli', 'Mē', 'Sune', 'Siulai', 'ʻAokosi', 'Sepitema', 'ʻOkatopa', 'Nōvema', 'Tīsema'], + 'months_short' => ['Sān', 'Fēp', 'Maʻa', 'ʻEpe', 'Mē', 'Sun', 'Siu', 'ʻAok', 'Sep', 'ʻOka', 'Nōv', 'Tīs'], + 'weekdays' => ['Sāpate', 'Mōnite', 'Tūsite', 'Pulelulu', 'Tuʻapulelulu', 'Falaite', 'Tokonaki'], + 'weekdays_short' => ['Sāp', 'Mōn', 'Tūs', 'Pul', 'Tuʻa', 'Fal', 'Tok'], + 'weekdays_min' => ['Sāp', 'Mōn', 'Tūs', 'Pul', 'Tuʻa', 'Fal', 'Tok'], + 'meridiem' => ['hengihengi', 'efiafi'], + + 'year' => ':count fitu', // less reliable + 'y' => ':count fitu', // less reliable + 'a_year' => ':count fitu', // less reliable + + 'month' => ':count mahina', // less reliable + 'm' => ':count mahina', // less reliable + 'a_month' => ':count mahina', // less reliable + + 'week' => ':count Sapate', // less reliable + 'w' => ':count Sapate', // less reliable + 'a_week' => ':count Sapate', // less reliable + + 'day' => ':count ʻaho', // less reliable + 'd' => ':count ʻaho', // less reliable + 'a_day' => ':count ʻaho', // less reliable + + 'hour' => ':count houa', + 'h' => ':count houa', + 'a_hour' => ':count houa', + + 'minute' => ':count miniti', + 'min' => ':count miniti', + 'a_minute' => ':count miniti', + + 'second' => ':count sekoni', + 's' => ':count sekoni', + 'a_second' => ':count sekoni', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tpi.php b/vendor/nesbot/carbon/src/Carbon/Lang/tpi.php new file mode 100644 index 00000000..7d38daed --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tpi.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/tpi_PG.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tpi_PG.php b/vendor/nesbot/carbon/src/Carbon/Lang/tpi_PG.php new file mode 100644 index 00000000..5f58c44c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tpi_PG.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Samsung Electronics Co., Ltd. akhilesh.k@samsung.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['Janueri', 'Februeri', 'Mas', 'Epril', 'Me', 'Jun', 'Julai', 'Ogas', 'Septemba', 'Oktoba', 'Novemba', 'Desemba'], + 'months_short' => ['Jan', 'Feb', 'Mas', 'Epr', 'Me', 'Jun', 'Jul', 'Oga', 'Sep', 'Okt', 'Nov', 'Des'], + 'weekdays' => ['Sande', 'Mande', 'Tunde', 'Trinde', 'Fonde', 'Fraide', 'Sarere'], + 'weekdays_short' => ['San', 'Man', 'Tun', 'Tri', 'Fon', 'Fra', 'Sar'], + 'weekdays_min' => ['San', 'Man', 'Tun', 'Tri', 'Fon', 'Fra', 'Sar'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['biknait', 'apinun'], + + 'year' => 'yia :count', + 'y' => 'yia :count', + 'a_year' => 'yia :count', + + 'month' => ':count mun', + 'm' => ':count mun', + 'a_month' => ':count mun', + + 'week' => ':count wik', + 'w' => ':count wik', + 'a_week' => ':count wik', + + 'day' => ':count de', + 'd' => ':count de', + 'a_day' => ':count de', + + 'hour' => ':count aua', + 'h' => ':count aua', + 'a_hour' => ':count aua', + + 'minute' => ':count minit', + 'min' => ':count minit', + 'a_minute' => ':count minit', + + 'second' => ':count namba tu', + 's' => ':count namba tu', + 'a_second' => ':count namba tu', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tr.php b/vendor/nesbot/carbon/src/Carbon/Lang/tr.php new file mode 100644 index 00000000..f5d9f4cc --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tr.php @@ -0,0 +1,121 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - Alan Agius + * - Erhan Gundogan + * - François B + * - JD Isaacks + * - Murat Yüksel + * - Baran Şengül + * - Selami (selamialtin) + * - TeomanBey + */ +return [ + 'year' => ':count yıl', + 'a_year' => '{1}bir yıl|]1,Inf[:count yıl', + 'y' => ':county', + 'month' => ':count ay', + 'a_month' => '{1}bir ay|]1,Inf[:count ay', + 'm' => ':countay', + 'week' => ':count hafta', + 'a_week' => '{1}bir hafta|]1,Inf[:count hafta', + 'w' => ':counth', + 'day' => ':count gün', + 'a_day' => '{1}bir gün|]1,Inf[:count gün', + 'd' => ':countg', + 'hour' => ':count saat', + 'a_hour' => '{1}bir saat|]1,Inf[:count saat', + 'h' => ':countsa', + 'minute' => ':count dakika', + 'a_minute' => '{1}bir dakika|]1,Inf[:count dakika', + 'min' => ':countdk', + 'second' => ':count saniye', + 'a_second' => '{1}birkaç saniye|]1,Inf[:count saniye', + 's' => ':countsn', + 'ago' => ':time önce', + 'from_now' => ':time sonra', + 'after' => ':time sonra', + 'before' => ':time önce', + 'diff_now' => 'şimdi', + 'diff_today' => 'bugün', + 'diff_today_regexp' => 'bugün(?:\\s+saat)?', + 'diff_yesterday' => 'dün', + 'diff_tomorrow' => 'yarın', + 'diff_tomorrow_regexp' => 'yarın(?:\\s+saat)?', + 'diff_before_yesterday' => 'evvelsi gün', + 'diff_after_tomorrow' => 'öbür gün', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[bugün saat] LT', + 'nextDay' => '[yarın saat] LT', + 'nextWeek' => '[gelecek] dddd [saat] LT', + 'lastDay' => '[dün] LT', + 'lastWeek' => '[geçen] dddd [saat] LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number, $period) { + switch ($period) { + case 'd': + case 'D': + case 'Do': + case 'DD': + return $number; + default: + if ($number === 0) { // special case for zero + return "$number'ıncı"; + } + + static $suffixes = [ + 1 => '\'inci', + 5 => '\'inci', + 8 => '\'inci', + 70 => '\'inci', + 80 => '\'inci', + 2 => '\'nci', + 7 => '\'nci', + 20 => '\'nci', + 50 => '\'nci', + 3 => '\'üncü', + 4 => '\'üncü', + 100 => '\'üncü', + 6 => '\'ncı', + 9 => '\'uncu', + 10 => '\'uncu', + 30 => '\'uncu', + 60 => '\'ıncı', + 90 => '\'ıncı', + ]; + + $lastDigit = $number % 10; + + return $number.($suffixes[$lastDigit] ?? $suffixes[$number % 100 - $lastDigit] ?? $suffixes[$number >= 100 ? 100 : -1] ?? ''); + } + }, + 'meridiem' => ['ÖÖ', 'ÖS', 'öö', 'ös'], + 'months' => ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık'], + 'months_short' => ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara'], + 'weekdays' => ['Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'], + 'weekdays_short' => ['Paz', 'Pts', 'Sal', 'Çar', 'Per', 'Cum', 'Cts'], + 'weekdays_min' => ['Pz', 'Pt', 'Sa', 'Ça', 'Pe', 'Cu', 'Ct'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' ve '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tr_CY.php b/vendor/nesbot/carbon/src/Carbon/Lang/tr_CY.php new file mode 100644 index 00000000..23f11449 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tr_CY.php @@ -0,0 +1,23 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/tr.php', [ + 'weekdays_short' => ['Paz', 'Pzt', 'Sal', 'Çar', 'Per', 'Cum', 'Cmt'], + 'weekdays_min' => ['Pa', 'Pt', 'Sa', 'Ça', 'Pe', 'Cu', 'Ct'], + 'formats' => [ + 'LT' => 'h:mm a', + 'LTS' => 'h:mm:ss a', + 'L' => 'D.MM.YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY h:mm a', + 'LLLL' => 'D MMMM YYYY dddd h:mm a', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tr_TR.php b/vendor/nesbot/carbon/src/Carbon/Lang/tr_TR.php new file mode 100644 index 00000000..9e994824 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tr_TR.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/tr.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ts.php b/vendor/nesbot/carbon/src/Carbon/Lang/ts.php new file mode 100644 index 00000000..525736bf --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ts.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/ts_ZA.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ts_ZA.php b/vendor/nesbot/carbon/src/Carbon/Lang/ts_ZA.php new file mode 100644 index 00000000..37a24ec4 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ts_ZA.php @@ -0,0 +1,54 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Zuza Software Foundation (Translate.org.za) Dwayne Bailey dwayne@translate.org.za + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['Sunguti', 'Nyenyenyani', 'Nyenyankulu', 'Dzivamisoko', 'Mudyaxihi', 'Khotavuxika', 'Mawuwani', 'Mhawuri', 'Ndzhati', 'Nhlangula', 'Hukuri', 'N\'wendzamhala'], + 'months_short' => ['Sun', 'Yan', 'Kul', 'Dzi', 'Mud', 'Kho', 'Maw', 'Mha', 'Ndz', 'Nhl', 'Huk', 'N\'w'], + 'weekdays' => ['Sonto', 'Musumbhunuku', 'Ravumbirhi', 'Ravunharhu', 'Ravumune', 'Ravuntlhanu', 'Mugqivela'], + 'weekdays_short' => ['Son', 'Mus', 'Bir', 'Har', 'Ne', 'Tlh', 'Mug'], + 'weekdays_min' => ['Son', 'Mus', 'Bir', 'Har', 'Ne', 'Tlh', 'Mug'], + 'day_of_first_week_of_year' => 1, + + 'year' => 'malembe ya :count', + 'y' => 'malembe ya :count', + 'a_year' => 'malembe ya :count', + + 'month' => 'tin’hweti ta :count', + 'm' => 'tin’hweti ta :count', + 'a_month' => 'tin’hweti ta :count', + + 'week' => 'mavhiki ya :count', + 'w' => 'mavhiki ya :count', + 'a_week' => 'mavhiki ya :count', + + 'day' => 'masiku :count', + 'd' => 'masiku :count', + 'a_day' => 'masiku :count', + + 'hour' => 'tiawara ta :count', + 'h' => 'tiawara ta :count', + 'a_hour' => 'tiawara ta :count', + + 'minute' => 'timinete ta :count', + 'min' => 'timinete ta :count', + 'a_minute' => 'timinete ta :count', + + 'second' => 'tisekoni ta :count', + 's' => 'tisekoni ta :count', + 'a_second' => 'tisekoni ta :count', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tt.php b/vendor/nesbot/carbon/src/Carbon/Lang/tt.php new file mode 100644 index 00000000..d67d896e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tt.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/tt_RU.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tt_RU.php b/vendor/nesbot/carbon/src/Carbon/Lang/tt_RU.php new file mode 100644 index 00000000..38e42d05 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tt_RU.php @@ -0,0 +1,39 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Rinat Norkin Pablo Saratxaga, Rinat Norkin pablo@mandrakesoft.com, rinat@taif.ru + */ +return [ + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'DD MMM, HH:mm', + 'LLLL' => 'DD MMMM YYYY, HH:mm', + ], + 'months' => ['января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря'], + 'months_short' => ['янв', 'фев', 'мар', 'апр', 'май', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек'], + 'weekdays' => ['якшәмбе', 'дышәмбе', 'сишәмбе', 'чәршәәмбе', 'пәнҗешмбе', 'җомга', 'шимбә'], + 'weekdays_short' => ['якш', 'дыш', 'сиш', 'чәрш', 'пәнҗ', 'җом', 'шим'], + 'weekdays_min' => ['якш', 'дыш', 'сиш', 'чәрш', 'пәнҗ', 'җом', 'шим'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'year' => ':count ел', + 'month' => ':count ай', + 'week' => ':count атна', + 'day' => ':count көн', + 'hour' => ':count сәгать', + 'minute' => ':count минут', + 'second' => ':count секунд', +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tt_RU@iqtelif.php b/vendor/nesbot/carbon/src/Carbon/Lang/tt_RU@iqtelif.php new file mode 100644 index 00000000..16b8efb1 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tt_RU@iqtelif.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Reshat Sabiq tatar.iqtelif.i18n@gmail.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD.MM.YYYY', + ], + 'months' => ['Ğınwar', 'Fiwral\'', 'Mart', 'April', 'May', 'Yün', 'Yül', 'Awgust', 'Sintebír', 'Üktebír', 'Noyebír', 'Dikebír'], + 'months_short' => ['Ğın', 'Fiw', 'Mar', 'Apr', 'May', 'Yün', 'Yül', 'Awg', 'Sin', 'Ükt', 'Noy', 'Dik'], + 'weekdays' => ['Yekşembí', 'Düşembí', 'Sişembí', 'Çerşembí', 'Pencíşembí', 'Comğa', 'Şimbe'], + 'weekdays_short' => ['Yek', 'Düş', 'Siş', 'Çer', 'Pen', 'Com', 'Şim'], + 'weekdays_min' => ['Yek', 'Düş', 'Siş', 'Çer', 'Pen', 'Com', 'Şim'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['ÖA', 'ÖS'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/twq.php b/vendor/nesbot/carbon/src/Carbon/Lang/twq.php new file mode 100644 index 00000000..5cbb46e0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/twq.php @@ -0,0 +1,14 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/ses.php', [ + 'meridiem' => ['Subbaahi', 'Zaarikay b'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tzl.php b/vendor/nesbot/carbon/src/Carbon/Lang/tzl.php new file mode 100644 index 00000000..50bf26d2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tzl.php @@ -0,0 +1,65 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return [ + 'year' => '[0,1]:count ar|:count ars', + 'y' => '[0,1]:count ar|:count ars', + 'month' => '[0,1]:count mes|:count mesen', + 'm' => '[0,1]:count mes|:count mesen', + 'week' => '[0,1]:count seifetziua|:count seifetziuas', + 'w' => '[0,1]:count seifetziua|:count seifetziuas', + 'day' => '[0,1]:count ziua|:count ziuas', + 'd' => '[0,1]:count ziua|:count ziuas', + 'hour' => '[0,1]:count þora|:count þoras', + 'h' => '[0,1]:count þora|:count þoras', + 'minute' => '[0,1]:count míut|:count míuts', + 'min' => '[0,1]:count míut|:count míuts', + 'second' => ':count secunds', + 's' => ':count secunds', + + 'ago' => 'ja :time', + 'from_now' => 'osprei :time', + + 'diff_yesterday' => 'ieiri', + 'diff_yesterday_regexp' => 'ieiri(?:\\s+à)?', + 'diff_today' => 'oxhi', + 'diff_today_regexp' => 'oxhi(?:\\s+à)?', + 'diff_tomorrow' => 'demà', + 'diff_tomorrow_regexp' => 'demà(?:\\s+à)?', + + 'formats' => [ + 'LT' => 'HH.mm', + 'LTS' => 'HH.mm.ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D. MMMM [dallas] YYYY', + 'LLL' => 'D. MMMM [dallas] YYYY HH.mm', + 'LLLL' => 'dddd, [li] D. MMMM [dallas] YYYY HH.mm', + ], + + 'calendar' => [ + 'sameDay' => '[oxhi à] LT', + 'nextDay' => '[demà à] LT', + 'nextWeek' => 'dddd [à] LT', + 'lastDay' => '[ieiri à] LT', + 'lastWeek' => '[sür el] dddd [lasteu à] LT', + 'sameElse' => 'L', + ], + + 'meridiem' => ["D'A", "D'O"], + 'months' => ['Januar', 'Fevraglh', 'Març', 'Avrïu', 'Mai', 'Gün', 'Julia', 'Guscht', 'Setemvar', 'Listopäts', 'Noemvar', 'Zecemvar'], + 'months_short' => ['Jan', 'Fev', 'Mar', 'Avr', 'Mai', 'Gün', 'Jul', 'Gus', 'Set', 'Lis', 'Noe', 'Zec'], + 'weekdays' => ['Súladi', 'Lúneçi', 'Maitzi', 'Márcuri', 'Xhúadi', 'Viénerçi', 'Sáturi'], + 'weekdays_short' => ['Súl', 'Lún', 'Mai', 'Már', 'Xhú', 'Vié', 'Sát'], + 'weekdays_min' => ['Sú', 'Lú', 'Ma', 'Má', 'Xh', 'Vi', 'Sá'], + 'ordinal' => ':number.', + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tzm.php b/vendor/nesbot/carbon/src/Carbon/Lang/tzm.php new file mode 100644 index 00000000..2a1a0f2b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tzm.php @@ -0,0 +1,57 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - JD Isaacks + */ +return [ + 'year' => '{1}ⴰⵙⴳⴰⵙ|:count ⵉⵙⴳⴰⵙⵏ', + 'month' => '{1}ⴰⵢoⵓⵔ|:count ⵉⵢⵢⵉⵔⵏ', + 'week' => ':count ⵉⵎⴰⵍⴰⵙⵙ', + 'day' => '{1}ⴰⵙⵙ|:count oⵙⵙⴰⵏ', + 'hour' => '{1}ⵙⴰⵄⴰ|:count ⵜⴰⵙⵙⴰⵄⵉⵏ', + 'minute' => '{1}ⵎⵉⵏⵓⴺ|:count ⵎⵉⵏⵓⴺ', + 'second' => '{1}ⵉⵎⵉⴽ|:count ⵉⵎⵉⴽ', + 'ago' => 'ⵢⴰⵏ :time', + 'from_now' => 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ :time', + 'diff_today' => 'ⴰⵙⴷⵅ', + 'diff_yesterday' => 'ⴰⵚⴰⵏⵜ', + 'diff_yesterday_regexp' => 'ⴰⵚⴰⵏⵜ(?:\\s+ⴴ)?', + 'diff_tomorrow' => 'ⴰⵙⴽⴰ', + 'diff_tomorrow_regexp' => 'ⴰⵙⴽⴰ(?:\\s+ⴴ)?', + 'diff_today_regexp' => 'ⴰⵙⴷⵅ(?:\\s+ⴴ)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[ⴰⵙⴷⵅ ⴴ] LT', + 'nextDay' => '[ⴰⵙⴽⴰ ⴴ] LT', + 'nextWeek' => 'dddd [ⴴ] LT', + 'lastDay' => '[ⴰⵚⴰⵏⵜ ⴴ] LT', + 'lastWeek' => 'dddd [ⴴ] LT', + 'sameElse' => 'L', + ], + 'months' => ['ⵉⵏⵏⴰⵢⵔ', 'ⴱⵕⴰⵢⵕ', 'ⵎⴰⵕⵚ', 'ⵉⴱⵔⵉⵔ', 'ⵎⴰⵢⵢⵓ', 'ⵢⵓⵏⵢⵓ', 'ⵢⵓⵍⵢⵓⵣ', 'ⵖⵓⵛⵜ', 'ⵛⵓⵜⴰⵏⴱⵉⵔ', 'ⴽⵟⵓⴱⵕ', 'ⵏⵓⵡⴰⵏⴱⵉⵔ', 'ⴷⵓⵊⵏⴱⵉⵔ'], + 'months_short' => ['ⵉⵏⵏⴰⵢⵔ', 'ⴱⵕⴰⵢⵕ', 'ⵎⴰⵕⵚ', 'ⵉⴱⵔⵉⵔ', 'ⵎⴰⵢⵢⵓ', 'ⵢⵓⵏⵢⵓ', 'ⵢⵓⵍⵢⵓⵣ', 'ⵖⵓⵛⵜ', 'ⵛⵓⵜⴰⵏⴱⵉⵔ', 'ⴽⵟⵓⴱⵕ', 'ⵏⵓⵡⴰⵏⴱⵉⵔ', 'ⴷⵓⵊⵏⴱⵉⵔ'], + 'weekdays' => ['ⴰⵙⴰⵎⴰⵙ', 'ⴰⵢⵏⴰⵙ', 'ⴰⵙⵉⵏⴰⵙ', 'ⴰⴽⵔⴰⵙ', 'ⴰⴽⵡⴰⵙ', 'ⴰⵙⵉⵎⵡⴰⵙ', 'ⴰⵙⵉⴹⵢⴰⵙ'], + 'weekdays_short' => ['ⴰⵙⴰⵎⴰⵙ', 'ⴰⵢⵏⴰⵙ', 'ⴰⵙⵉⵏⴰⵙ', 'ⴰⴽⵔⴰⵙ', 'ⴰⴽⵡⴰⵙ', 'ⴰⵙⵉⵎⵡⴰⵙ', 'ⴰⵙⵉⴹⵢⴰⵙ'], + 'weekdays_min' => ['ⴰⵙⴰⵎⴰⵙ', 'ⴰⵢⵏⴰⵙ', 'ⴰⵙⵉⵏⴰⵙ', 'ⴰⴽⵔⴰⵙ', 'ⴰⴽⵡⴰⵙ', 'ⴰⵙⵉⵎⵡⴰⵙ', 'ⴰⵙⵉⴹⵢⴰⵙ'], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, + 'weekend' => [5, 6], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tzm_Latn.php b/vendor/nesbot/carbon/src/Carbon/Lang/tzm_Latn.php new file mode 100644 index 00000000..5840d209 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tzm_Latn.php @@ -0,0 +1,64 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - JD Isaacks + */ +return [ + 'year' => '{1}:count asgas|:count isgasn', + 'a_year' => 'asgas|:count isgasn', + 'month' => '{1}:count ayowr|:count iyyirn', + 'a_month' => 'ayowr|:count iyyirn', + 'week' => ':count imalass', + 'a_week' => ':imalass', + 'day' => '{1}:count ass|:count ossan', + 'a_day' => 'ass|:count ossan', + 'hour' => '{1}:count saɛa|:count tassaɛin', + 'a_hour' => '{1}saɛa|:count tassaɛin', + 'minute' => ':count minuḍ', + 'a_minute' => '{1}minuḍ|:count minuḍ', + 'second' => ':count imik', + 'a_second' => '{1}imik|:count imik', + 'ago' => 'yan :time', + 'from_now' => 'dadkh s yan :time', + 'diff_yesterday' => 'assant', + 'diff_yesterday_regexp' => 'assant(?:\\s+g)?', + 'diff_today' => 'asdkh', + 'diff_today_regexp' => 'asdkh(?:\\s+g)?', + 'diff_tomorrow' => 'aska', + 'diff_tomorrow_regexp' => 'aska(?:\\s+g)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[asdkh g] LT', + 'nextDay' => '[aska g] LT', + 'nextWeek' => 'dddd [g] LT', + 'lastDay' => '[assant g] LT', + 'lastWeek' => 'dddd [g] LT', + 'sameElse' => 'L', + ], + 'months' => ['innayr', 'brˤayrˤ', 'marˤsˤ', 'ibrir', 'mayyw', 'ywnyw', 'ywlywz', 'ɣwšt', 'šwtanbir', 'ktˤwbrˤ', 'nwwanbir', 'dwjnbir'], + 'months_short' => ['innayr', 'brˤayrˤ', 'marˤsˤ', 'ibrir', 'mayyw', 'ywnyw', 'ywlywz', 'ɣwšt', 'šwtanbir', 'ktˤwbrˤ', 'nwwanbir', 'dwjnbir'], + 'weekdays' => ['asamas', 'aynas', 'asinas', 'akras', 'akwas', 'asimwas', 'asiḍyas'], + 'weekdays_short' => ['asamas', 'aynas', 'asinas', 'akras', 'akwas', 'asimwas', 'asiḍyas'], + 'weekdays_min' => ['asamas', 'aynas', 'asinas', 'akras', 'akwas', 'asimwas', 'asiḍyas'], + 'meridiem' => ['Zdat azal', 'Ḍeffir aza'], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ug.php b/vendor/nesbot/carbon/src/Carbon/Lang/ug.php new file mode 100644 index 00000000..259b99a4 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ug.php @@ -0,0 +1,90 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Philippe Vaucher + * - Tsutomu Kuroda + * - yasinn + */ +return [ + 'year' => '{1}'.'بىر يىل'.'|:count '.'يىل', + 'month' => '{1}'.'بىر ئاي'.'|:count '.'ئاي', + 'week' => '{1}'.'بىر ھەپتە'.'|:count '.'ھەپتە', + 'day' => '{1}'.'بىر كۈن'.'|:count '.'كۈن', + 'hour' => '{1}'.'بىر سائەت'.'|:count '.'سائەت', + 'minute' => '{1}'.'بىر مىنۇت'.'|:count '.'مىنۇت', + 'second' => '{1}'.'نەچچە سېكونت'.'|:count '.'سېكونت', + 'ago' => ':time بۇرۇن', + 'from_now' => ':time كېيىن', + 'diff_today' => 'بۈگۈن', + 'diff_yesterday' => 'تۆنۈگۈن', + 'diff_tomorrow' => 'ئەتە', + 'diff_tomorrow_regexp' => 'ئەتە(?:\\s+سائەت)?', + 'diff_today_regexp' => 'بۈگۈن(?:\\s+سائەت)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY-MM-DD', + 'LL' => 'YYYY-يىلىM-ئاينىڭD-كۈنى', + 'LLL' => 'YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm', + 'LLLL' => 'dddd، YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[بۈگۈن سائەت] LT', + 'nextDay' => '[ئەتە سائەت] LT', + 'nextWeek' => '[كېلەركى] dddd [سائەت] LT', + 'lastDay' => '[تۆنۈگۈن] LT', + 'lastWeek' => '[ئالدىنقى] dddd [سائەت] LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number, $period) { + switch ($period) { + case 'd': + case 'D': + case 'DDD': + return $number.'-كۈنى'; + case 'w': + case 'W': + return $number.'-ھەپتە'; + default: + return $number; + } + }, + 'meridiem' => function ($hour, $minute) { + $time = $hour * 100 + $minute; + if ($time < 600) { + return 'يېرىم كېچە'; + } + if ($time < 900) { + return 'سەھەر'; + } + if ($time < 1130) { + return 'چۈشتىن بۇرۇن'; + } + if ($time < 1230) { + return 'چۈش'; + } + if ($time < 1800) { + return 'چۈشتىن كېيىن'; + } + + return 'كەچ'; + }, + 'months' => ['يانۋار', 'فېۋرال', 'مارت', 'ئاپرېل', 'ماي', 'ئىيۇن', 'ئىيۇل', 'ئاۋغۇست', 'سېنتەبىر', 'ئۆكتەبىر', 'نويابىر', 'دېكابىر'], + 'months_short' => ['يانۋار', 'فېۋرال', 'مارت', 'ئاپرېل', 'ماي', 'ئىيۇن', 'ئىيۇل', 'ئاۋغۇست', 'سېنتەبىر', 'ئۆكتەبىر', 'نويابىر', 'دېكابىر'], + 'weekdays' => ['يەكشەنبە', 'دۈشەنبە', 'سەيشەنبە', 'چارشەنبە', 'پەيشەنبە', 'جۈمە', 'شەنبە'], + 'weekdays_short' => ['يە', 'دۈ', 'سە', 'چا', 'پە', 'جۈ', 'شە'], + 'weekdays_min' => ['يە', 'دۈ', 'سە', 'چا', 'پە', 'جۈ', 'شە'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' ۋە '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ug_CN.php b/vendor/nesbot/carbon/src/Carbon/Lang/ug_CN.php new file mode 100644 index 00000000..deb828c5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ug_CN.php @@ -0,0 +1,17 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Kunal Marwaha + * - Alim Boyaq + */ +return require __DIR__.'/ug.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/uk.php b/vendor/nesbot/carbon/src/Carbon/Lang/uk.php new file mode 100644 index 00000000..4217d16e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/uk.php @@ -0,0 +1,212 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Carbon\CarbonInterface; + +$processHoursFunction = function (CarbonInterface $date, string $format) { + return $format.'о'.($date->hour === 11 ? 'б' : '').'] LT'; +}; + +/* + * Authors: + * - Kunal Marwaha + * - Josh Soref + * - François B + * - Tim Fish + * - Serhan Apaydın + * - Max Mykhailenko + * - JD Isaacks + * - Max Kovpak + * - AucT + * - Philippe Vaucher + * - Ilya Shaplyko + * - Vadym Ievsieiev + * - Denys Kurets + * - Igor Kasyanchuk + * - Tsutomu Kuroda + * - tjku + * - Max Melentiev + * - Oleh + * - epaminond + * - Juanito Fatas + * - Vitalii Khustochka + * - Akira Matsuda + * - Christopher Dell + * - Enrique Vidal + * - Simone Carletti + * - Aaron Patterson + * - Andriy Tyurnikov + * - Nicolás Hock Isaza + * - Iwakura Taro + * - Andrii Ponomarov + * - alecrabbit + * - vystepanenko + * - AlexWalkerson + * - Andre Havryliuk (Andrend) + * - Max Datsenko (datsenko-md) + */ +return [ + 'year' => ':count рік|:count роки|:count років', + 'y' => ':countр|:countрр|:countрр', + 'a_year' => '{1}рік|:count рік|:count роки|:count років', + 'month' => ':count місяць|:count місяці|:count місяців', + 'm' => ':countм', + 'a_month' => '{1}місяць|:count місяць|:count місяці|:count місяців', + 'week' => ':count тиждень|:count тижні|:count тижнів', + 'w' => ':countт', + 'a_week' => '{1}тиждень|:count тиждень|:count тижні|:count тижнів', + 'day' => ':count день|:count дні|:count днів', + 'd' => ':countд', + 'a_day' => '{1}день|:count день|:count дні|:count днів', + 'hour' => ':count година|:count години|:count годин', + 'h' => ':countг', + 'a_hour' => '{1}година|:count година|:count години|:count годин', + 'minute' => ':count хвилина|:count хвилини|:count хвилин', + 'min' => ':countхв', + 'a_minute' => '{1}хвилина|:count хвилина|:count хвилини|:count хвилин', + 'second' => ':count секунда|:count секунди|:count секунд', + 's' => ':countсек', + 'a_second' => '{1}декілька секунд|:count секунда|:count секунди|:count секунд', + + 'hour_ago' => ':count годину|:count години|:count годин', + 'a_hour_ago' => '{1}годину|:count годину|:count години|:count годин', + 'minute_ago' => ':count хвилину|:count хвилини|:count хвилин', + 'a_minute_ago' => '{1}хвилину|:count хвилину|:count хвилини|:count хвилин', + 'second_ago' => ':count секунду|:count секунди|:count секунд', + 'a_second_ago' => '{1}декілька секунд|:count секунду|:count секунди|:count секунд', + + 'hour_from_now' => ':count годину|:count години|:count годин', + 'a_hour_from_now' => '{1}годину|:count годину|:count години|:count годин', + 'minute_from_now' => ':count хвилину|:count хвилини|:count хвилин', + 'a_minute_from_now' => '{1}хвилину|:count хвилину|:count хвилини|:count хвилин', + 'second_from_now' => ':count секунду|:count секунди|:count секунд', + 'a_second_from_now' => '{1}декілька секунд|:count секунду|:count секунди|:count секунд', + + 'hour_after' => ':count годину|:count години|:count годин', + 'a_hour_after' => '{1}годину|:count годину|:count години|:count годин', + 'minute_after' => ':count хвилину|:count хвилини|:count хвилин', + 'a_minute_after' => '{1}хвилину|:count хвилину|:count хвилини|:count хвилин', + 'second_after' => ':count секунду|:count секунди|:count секунд', + 'a_second_after' => '{1}декілька секунд|:count секунду|:count секунди|:count секунд', + + 'hour_before' => ':count годину|:count години|:count годин', + 'a_hour_before' => '{1}годину|:count годину|:count години|:count годин', + 'minute_before' => ':count хвилину|:count хвилини|:count хвилин', + 'a_minute_before' => '{1}хвилину|:count хвилину|:count хвилини|:count хвилин', + 'second_before' => ':count секунду|:count секунди|:count секунд', + 'a_second_before' => '{1}декілька секунд|:count секунду|:count секунди|:count секунд', + + 'ago' => ':time тому', + 'from_now' => 'за :time', + 'after' => ':time після', + 'before' => ':time до', + 'diff_now' => 'щойно', + 'diff_today' => 'Сьогодні', + 'diff_today_regexp' => 'Сьогодні(?:\\s+о)?', + 'diff_yesterday' => 'вчора', + 'diff_yesterday_regexp' => 'Вчора(?:\\s+о)?', + 'diff_tomorrow' => 'завтра', + 'diff_tomorrow_regexp' => 'Завтра(?:\\s+о)?', + 'diff_before_yesterday' => 'позавчора', + 'diff_after_tomorrow' => 'післязавтра', + 'period_recurrences' => 'один раз|:count рази|:count разів', + 'period_interval' => 'кожні :interval', + 'period_start_date' => 'з :date', + 'period_end_date' => 'до :date', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY, HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY, HH:mm', + ], + 'calendar' => [ + 'sameDay' => function (CarbonInterface $date) use ($processHoursFunction) { + return $processHoursFunction($date, '[Сьогодні '); + }, + 'nextDay' => function (CarbonInterface $date) use ($processHoursFunction) { + return $processHoursFunction($date, '[Завтра '); + }, + 'nextWeek' => function (CarbonInterface $date) use ($processHoursFunction) { + return $processHoursFunction($date, '[У] dddd ['); + }, + 'lastDay' => function (CarbonInterface $date) use ($processHoursFunction) { + return $processHoursFunction($date, '[Вчора '); + }, + 'lastWeek' => function (CarbonInterface $date) use ($processHoursFunction) { + switch ($date->dayOfWeek) { + case 0: + case 3: + case 5: + case 6: + return $processHoursFunction($date, '[Минулої] dddd ['); + default: + return $processHoursFunction($date, '[Минулого] dddd ['); + } + }, + 'sameElse' => 'L', + ], + 'ordinal' => function ($number, $period) { + switch ($period) { + case 'M': + case 'd': + case 'DDD': + case 'w': + case 'W': + return $number.'-й'; + case 'D': + return $number.'-го'; + default: + return $number; + } + }, + 'meridiem' => function ($hour) { + if ($hour < 4) { + return 'ночі'; + } + if ($hour < 12) { + return 'ранку'; + } + if ($hour < 17) { + return 'дня'; + } + + return 'вечора'; + }, + 'months' => ['січня', 'лютого', 'березня', 'квітня', 'травня', 'червня', 'липня', 'серпня', 'вересня', 'жовтня', 'листопада', 'грудня'], + 'months_standalone' => ['січень', 'лютий', 'березень', 'квітень', 'травень', 'червень', 'липень', 'серпень', 'вересень', 'жовтень', 'листопад', 'грудень'], + 'months_short' => ['січ', 'лют', 'бер', 'кві', 'тра', 'чер', 'лип', 'сер', 'вер', 'жов', 'лис', 'гру'], + 'months_regexp' => '/(D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|L{2,4}|l{2,4})/', + 'weekdays' => function (CarbonInterface $date, $format, $index) { + static $words = [ + 'nominative' => ['неділя', 'понеділок', 'вівторок', 'середа', 'четвер', 'п’ятниця', 'субота'], + 'accusative' => ['неділю', 'понеділок', 'вівторок', 'середу', 'четвер', 'п’ятницю', 'суботу'], + 'genitive' => ['неділі', 'понеділка', 'вівторка', 'середи', 'четверга', 'п’ятниці', 'суботи'], + ]; + + $format = $format ?? ''; + $nounCase = preg_match('/(\[(В|в|У|у)\])\s+dddd/u', $format) + ? 'accusative' + : ( + preg_match('/\[?(?:минулої|наступної)?\s*\]\s+dddd/u', $format) + ? 'genitive' + : 'nominative' + ); + + return $words[$nounCase][$index] ?? null; + }, + 'weekdays_short' => ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'], + 'weekdays_min' => ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' i '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/uk_UA.php b/vendor/nesbot/carbon/src/Carbon/Lang/uk_UA.php new file mode 100644 index 00000000..bd11d86e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/uk_UA.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/uk.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/unm.php b/vendor/nesbot/carbon/src/Carbon/Lang/unm.php new file mode 100644 index 00000000..d3f19f06 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/unm.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/unm_US.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/unm_US.php b/vendor/nesbot/carbon/src/Carbon/Lang/unm_US.php new file mode 100644 index 00000000..fa5c374e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/unm_US.php @@ -0,0 +1,57 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YY', + ], + 'months' => ['enikwsi', 'chkwali', 'xamokhwite', 'kwetayoxe', 'tainipen', 'kichinipen', 'lainipen', 'winaminke', 'kichitahkok', 'puksit', 'wini', 'muxkotae'], + 'months_short' => ['eni', 'chk', 'xam', 'kwe', 'tai', 'nip', 'lai', 'win', 'tah', 'puk', 'kun', 'mux'], + 'weekdays' => ['kentuwei', 'manteke', 'tusteke', 'lelai', 'tasteke', 'pelaiteke', 'sateteke'], + 'weekdays_short' => ['ken', 'man', 'tus', 'lel', 'tas', 'pel', 'sat'], + 'weekdays_min' => ['ken', 'man', 'tus', 'lel', 'tas', 'pel', 'sat'], + 'day_of_first_week_of_year' => 1, + + // Too unreliable + /* + 'year' => ':count kaxtëne', + 'y' => ':count kaxtëne', + 'a_year' => ':count kaxtëne', + + 'month' => ':count piskewëni kishux', // less reliable + 'm' => ':count piskewëni kishux', // less reliable + 'a_month' => ':count piskewëni kishux', // less reliable + + 'week' => ':count kishku', // less reliable + 'w' => ':count kishku', // less reliable + 'a_week' => ':count kishku', // less reliable + + 'day' => ':count kishku', + 'd' => ':count kishku', + 'a_day' => ':count kishku', + + 'hour' => ':count xkuk', // less reliable + 'h' => ':count xkuk', // less reliable + 'a_hour' => ':count xkuk', // less reliable + + 'minute' => ':count txituwàk', // less reliable + 'min' => ':count txituwàk', // less reliable + 'a_minute' => ':count txituwàk', // less reliable + + 'second' => ':count nisha', // less reliable + 's' => ':count nisha', // less reliable + 'a_second' => ':count nisha', // less reliable + */ +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ur.php b/vendor/nesbot/carbon/src/Carbon/Lang/ur.php new file mode 100644 index 00000000..dc16c2c3 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ur.php @@ -0,0 +1,94 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +$months = [ + 'جنوری', + 'فروری', + 'مارچ', + 'اپریل', + 'مئی', + 'جون', + 'جولائی', + 'اگست', + 'ستمبر', + 'اکتوبر', + 'نومبر', + 'دسمبر', +]; + +$weekdays = [ + 'اتوار', + 'پیر', + 'منگل', + 'بدھ', + 'جمعرات', + 'جمعہ', + 'ہفتہ', +]; + +/* + * Authors: + * - Sawood Alam + * - Mehshan + * - Philippe Vaucher + * - Tsutomu Kuroda + * - tjku + * - Zaid Akram + * - Max Melentiev + * - hafezdivandari + * - Hossein Jabbari + * - nimamo + */ +return [ + 'year' => 'ایک سال|:count سال', + 'month' => 'ایک ماہ|:count ماہ', + 'week' => ':count ہفتے', + 'day' => 'ایک دن|:count دن', + 'hour' => 'ایک گھنٹہ|:count گھنٹے', + 'minute' => 'ایک منٹ|:count منٹ', + 'second' => 'چند سیکنڈ|:count سیکنڈ', + 'ago' => ':time قبل', + 'from_now' => ':time بعد', + 'after' => ':time بعد', + 'before' => ':time پہلے', + 'diff_now' => 'اب', + 'diff_today' => 'آج', + 'diff_today_regexp' => 'آج(?:\\s+بوقت)?', + 'diff_yesterday' => 'گزشتہ کل', + 'diff_yesterday_regexp' => 'گذشتہ(?:\\s+روز)?(?:\\s+بوقت)?', + 'diff_tomorrow' => 'آئندہ کل', + 'diff_tomorrow_regexp' => 'کل(?:\\s+بوقت)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd، D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[آج بوقت] LT', + 'nextDay' => '[کل بوقت] LT', + 'nextWeek' => 'dddd [بوقت] LT', + 'lastDay' => '[گذشتہ روز بوقت] LT', + 'lastWeek' => '[گذشتہ] dddd [بوقت] LT', + 'sameElse' => 'L', + ], + 'meridiem' => ['صبح', 'شام'], + 'months' => $months, + 'months_short' => $months, + 'weekdays' => $weekdays, + 'weekdays_short' => $weekdays, + 'weekdays_min' => $weekdays, + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => ['، ', ' اور '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ur_IN.php b/vendor/nesbot/carbon/src/Carbon/Lang/ur_IN.php new file mode 100644 index 00000000..f81c84d3 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ur_IN.php @@ -0,0 +1,26 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Red Hat, Pune bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/ur.php', [ + 'formats' => [ + 'L' => 'D/M/YY', + ], + 'months' => ['جنوری', 'فروری', 'مارچ', 'اپریل', 'مئی', 'جون', 'جولائی', 'اگست', 'ستمبر', 'اکتوبر', 'نومبر', 'دسمبر'], + 'months_short' => ['جنوری', 'فروری', 'مارچ', 'اپریل', 'مئی', 'جون', 'جولائی', 'اگست', 'ستمبر', 'اکتوبر', 'نومبر', 'دسمبر'], + 'weekdays' => ['اتوار', 'پیر', 'منگل', 'بدھ', 'جمعرات', 'جمعہ', 'سنیچر'], + 'weekdays_short' => ['اتوار', 'پیر', 'منگل', 'بدھ', 'جمعرات', 'جمعہ', 'سنیچر'], + 'weekdays_min' => ['اتوار', 'پیر', 'منگل', 'بدھ', 'جمعرات', 'جمعہ', 'سنیچر'], + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ur_PK.php b/vendor/nesbot/carbon/src/Carbon/Lang/ur_PK.php new file mode 100644 index 00000000..8cd593db --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ur_PK.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/ur.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['جنوری', 'فروری', 'مارچ', 'اپریل', 'مئی', 'جون', 'جولائی', 'اگست', 'ستمبر', 'اکتوبر', 'نومبر', 'دسمبر'], + 'months_short' => ['جنوری', 'فروری', 'مارچ', 'اپریل', 'مئی', 'جون', 'جولائی', 'اگست', 'ستمبر', 'اکتوبر', 'نومبر', 'دسمبر'], + 'weekdays' => ['اتوار', 'پير', 'منگل', 'بدھ', 'جمعرات', 'جمعه', 'هفته'], + 'weekdays_short' => ['اتوار', 'پير', 'منگل', 'بدھ', 'جمعرات', 'جمعه', 'هفته'], + 'weekdays_min' => ['اتوار', 'پير', 'منگل', 'بدھ', 'جمعرات', 'جمعه', 'هفته'], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['ص', 'ش'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/uz.php b/vendor/nesbot/carbon/src/Carbon/Lang/uz.php new file mode 100644 index 00000000..61f3b64b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/uz.php @@ -0,0 +1,85 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Dmitriy Shabanov + * - JD Isaacks + * - Inoyatulloh + * - Jamshid + * - aarkhipov + * - Philippe Vaucher + * - felixthemagnificent + * - Tsutomu Kuroda + * - tjku + * - Max Melentiev + * - Juanito Fatas + * - Alisher Ulugbekov + * - Ergashev Adizbek + */ +return [ + 'year' => ':count йил', + 'a_year' => '{1}бир йил|:count йил', + 'y' => ':count й', + 'month' => ':count ой', + 'a_month' => '{1}бир ой|:count ой', + 'm' => ':count о', + 'week' => ':count ҳафта', + 'a_week' => '{1}бир ҳафта|:count ҳафта', + 'w' => ':count ҳ', + 'day' => ':count кун', + 'a_day' => '{1}бир кун|:count кун', + 'd' => ':count к', + 'hour' => ':count соат', + 'a_hour' => '{1}бир соат|:count соат', + 'h' => ':count с', + 'minute' => ':count дақиқа', + 'a_minute' => '{1}бир дақиқа|:count дақиқа', + 'min' => ':count д', + 'second' => ':count сония', + 'a_second' => '{1}сония|:count сония', + 's' => ':count с', + 'ago' => ':time аввал', + 'from_now' => 'Якин :time ичида', + 'after' => ':timeдан кейин', + 'before' => ':time олдин', + 'diff_now' => 'ҳозир', + 'diff_today' => 'Бугун', + 'diff_today_regexp' => 'Бугун(?:\\s+соат)?', + 'diff_yesterday' => 'Кеча', + 'diff_yesterday_regexp' => 'Кеча(?:\\s+соат)?', + 'diff_tomorrow' => 'Эртага', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'D MMMM YYYY, dddd HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Бугун соат] LT [да]', + 'nextDay' => '[Эртага] LT [да]', + 'nextWeek' => 'dddd [куни соат] LT [да]', + 'lastDay' => '[Кеча соат] LT [да]', + 'lastWeek' => '[Утган] dddd [куни соат] LT [да]', + 'sameElse' => 'L', + ], + 'months' => ['январ', 'феврал', 'март', 'апрел', 'май', 'июн', 'июл', 'август', 'сентябр', 'октябр', 'ноябр', 'декабр'], + 'months_short' => ['янв', 'фев', 'мар', 'апр', 'май', 'июн', 'июл', 'авг', 'сен', 'окт', 'ноя', 'дек'], + 'weekdays' => ['якшанба', 'душанба', 'сешанба', 'чоршанба', 'пайшанба', 'жума', 'шанба'], + 'weekdays_short' => ['якш', 'душ', 'сеш', 'чор', 'пай', 'жум', 'шан'], + 'weekdays_min' => ['як', 'ду', 'се', 'чо', 'па', 'жу', 'ша'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['эрталаб', 'кечаси'], + 'list' => [', ', ' ва '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/uz_Arab.php b/vendor/nesbot/carbon/src/Carbon/Lang/uz_Arab.php new file mode 100644 index 00000000..ffb51319 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/uz_Arab.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/fa.php', [ + 'weekdays' => ['یکشنبه', 'دوشنبه', 'سه‌شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'], + 'weekdays_short' => ['ی.', 'د.', 'س.', 'چ.', 'پ.', 'ج.', 'ش.'], + 'weekdays_min' => ['ی.', 'د.', 'س.', 'چ.', 'پ.', 'ج.', 'ش.'], + 'months' => ['جنوری', 'فبروری', 'مارچ', 'اپریل', 'می', 'جون', 'جولای', 'اگست', 'سپتمبر', 'اکتوبر', 'نومبر', 'دسمبر'], + 'months_short' => ['جنو', 'فبر', 'مار', 'اپر', 'می', 'جون', 'جول', 'اگس', 'سپت', 'اکت', 'نوم', 'دسم'], + 'first_day_of_week' => 6, + 'weekend' => [4, 5], + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY-MM-dd', + 'LL' => 'YYYY MMM D', + 'LLL' => 'YYYY MMMM D HH:mm', + 'LLLL' => 'YYYY MMMM D, dddd HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/uz_Cyrl.php b/vendor/nesbot/carbon/src/Carbon/Lang/uz_Cyrl.php new file mode 100644 index 00000000..89e99718 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/uz_Cyrl.php @@ -0,0 +1,20 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/uz.php', [ + 'formats' => [ + 'L' => 'DD/MM/yy', + 'LL' => 'D MMM, YYYY', + 'LLL' => 'D MMMM, YYYY HH:mm', + 'LLLL' => 'dddd, DD MMMM, YYYY HH:mm', + ], + 'meridiem' => ['ТО', 'ТК'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/uz_Latn.php b/vendor/nesbot/carbon/src/Carbon/Lang/uz_Latn.php new file mode 100644 index 00000000..ecceeaa3 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/uz_Latn.php @@ -0,0 +1,74 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Josh Soref + * - Rasulbek + * - Ilyosjon Kamoldinov (ilyosjon09) + */ +return [ + 'year' => ':count yil', + 'a_year' => '{1}bir yil|:count yil', + 'y' => ':count y', + 'month' => ':count oy', + 'a_month' => '{1}bir oy|:count oy', + 'm' => ':count o', + 'week' => ':count hafta', + 'a_week' => '{1}bir hafta|:count hafta', + 'w' => ':count h', + 'day' => ':count kun', + 'a_day' => '{1}bir kun|:count kun', + 'd' => ':count k', + 'hour' => ':count soat', + 'a_hour' => '{1}bir soat|:count soat', + 'h' => ':count soat', + 'minute' => ':count daqiqa', + 'a_minute' => '{1}bir daqiqa|:count daqiqa', + 'min' => ':count d', + 'second' => ':count soniya', + 'a_second' => '{1}soniya|:count soniya', + 's' => ':count son.', + 'ago' => ':time avval', + 'from_now' => 'Yaqin :time ichida', + 'after' => ':timedan keyin', + 'before' => ':time oldin', + 'diff_yesterday' => 'Kecha', + 'diff_yesterday_regexp' => 'Kecha(?:\\s+soat)?', + 'diff_today' => 'Bugun', + 'diff_today_regexp' => 'Bugun(?:\\s+soat)?', + 'diff_tomorrow' => 'Ertaga', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'D MMMM YYYY, dddd HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Bugun soat] LT [da]', + 'nextDay' => '[Ertaga] LT [da]', + 'nextWeek' => 'dddd [kuni soat] LT [da]', + 'lastDay' => '[Kecha soat] LT [da]', + 'lastWeek' => '[O\'tgan] dddd [kuni soat] LT [da]', + 'sameElse' => 'L', + ], + 'months' => ['Yanvar', 'Fevral', 'Mart', 'Aprel', 'May', 'Iyun', 'Iyul', 'Avgust', 'Sentabr', 'Oktabr', 'Noyabr', 'Dekabr'], + 'months_short' => ['Yan', 'Fev', 'Mar', 'Apr', 'May', 'Iyun', 'Iyul', 'Avg', 'Sen', 'Okt', 'Noy', 'Dek'], + 'weekdays' => ['Yakshanba', 'Dushanba', 'Seshanba', 'Chorshanba', 'Payshanba', 'Juma', 'Shanba'], + 'weekdays_short' => ['Yak', 'Dush', 'Sesh', 'Chor', 'Pay', 'Jum', 'Shan'], + 'weekdays_min' => ['Ya', 'Du', 'Se', 'Cho', 'Pa', 'Ju', 'Sha'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' va '], + 'meridiem' => ['TO', 'TK'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/uz_UZ.php b/vendor/nesbot/carbon/src/Carbon/Lang/uz_UZ.php new file mode 100644 index 00000000..d41bfee2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/uz_UZ.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Bobir Ismailov Bobir Ismailov, Pablo Saratxaga, Mashrab Kuvatov bobir_is@yahoo.com, pablo@mandrakesoft.com, kmashrab@uni-bremen.de + */ +return array_replace_recursive(require __DIR__.'/uz_Latn.php', [ + 'formats' => [ + 'L' => 'DD/MM/YY', + ], + 'months' => ['Yanvar', 'Fevral', 'Mart', 'Aprel', 'May', 'Iyun', 'Iyul', 'Avgust', 'Sentabr', 'Oktabr', 'Noyabr', 'Dekabr'], + 'months_short' => ['Yan', 'Fev', 'Mar', 'Apr', 'May', 'Iyn', 'Iyl', 'Avg', 'Sen', 'Okt', 'Noy', 'Dek'], + 'weekdays' => ['Yakshanba', 'Dushanba', 'Seshanba', 'Chorshanba', 'Payshanba', 'Juma', 'Shanba'], + 'weekdays_short' => ['Yak', 'Du', 'Se', 'Cho', 'Pay', 'Ju', 'Sha'], + 'weekdays_min' => ['Yak', 'Du', 'Se', 'Cho', 'Pay', 'Ju', 'Sha'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/uz_UZ@cyrillic.php b/vendor/nesbot/carbon/src/Carbon/Lang/uz_UZ@cyrillic.php new file mode 100644 index 00000000..2fa967c9 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/uz_UZ@cyrillic.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Mashrab Kuvatov Mashrab Kuvatov, Pablo Saratxaga kmashrab@uni-bremen.de, pablo@mandrakesoft.com + */ +return array_replace_recursive(require __DIR__.'/uz.php', [ + 'formats' => [ + 'L' => 'DD/MM/YY', + ], + 'months' => ['Январ', 'Феврал', 'Март', 'Апрел', 'Май', 'Июн', 'Июл', 'Август', 'Сентябр', 'Октябр', 'Ноябр', 'Декабр'], + 'months_short' => ['Янв', 'Фев', 'Мар', 'Апр', 'Май', 'Июн', 'Июл', 'Авг', 'Сен', 'Окт', 'Ноя', 'Дек'], + 'weekdays' => ['Якшанба', 'Душанба', 'Сешанба', 'Чоршанба', 'Пайшанба', 'Жума', 'Шанба'], + 'weekdays_short' => ['Якш', 'Душ', 'Сеш', 'Чор', 'Пай', 'Жум', 'Шан'], + 'weekdays_min' => ['Якш', 'Душ', 'Сеш', 'Чор', 'Пай', 'Жум', 'Шан'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/vai.php b/vendor/nesbot/carbon/src/Carbon/Lang/vai.php new file mode 100644 index 00000000..3c378dfb --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/vai.php @@ -0,0 +1,35 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'weekdays' => ['ꕞꕌꔵ', 'ꗳꗡꘉ', 'ꕚꕞꕚ', 'ꕉꕞꕒ', 'ꕉꔤꕆꕢ', 'ꕉꔤꕀꕮ', 'ꔻꔬꔳ'], + 'weekdays_short' => ['ꕞꕌꔵ', 'ꗳꗡꘉ', 'ꕚꕞꕚ', 'ꕉꕞꕒ', 'ꕉꔤꕆꕢ', 'ꕉꔤꕀꕮ', 'ꔻꔬꔳ'], + 'weekdays_min' => ['ꕞꕌꔵ', 'ꗳꗡꘉ', 'ꕚꕞꕚ', 'ꕉꕞꕒ', 'ꕉꔤꕆꕢ', 'ꕉꔤꕀꕮ', 'ꔻꔬꔳ'], + 'months' => ['ꖨꖕ ꕪꕴ ꔞꔀꕮꕊ', 'ꕒꕡꖝꖕ', 'ꕾꖺ', 'ꖢꖕ', 'ꖑꕱ', 'ꖱꘋ', 'ꖱꕞꔤ', 'ꗛꔕ', 'ꕢꕌ', 'ꕭꖃ', 'ꔞꘋꕔꕿ ꕸꖃꗏ', 'ꖨꖕ ꕪꕴ ꗏꖺꕮꕊ'], + 'months_short' => ['ꖨꖕꔞ', 'ꕒꕡ', 'ꕾꖺ', 'ꖢꖕ', 'ꖑꕱ', 'ꖱꘋ', 'ꖱꕞ', 'ꗛꔕ', 'ꕢꕌ', 'ꕭꖃ', 'ꔞꘋ', 'ꖨꖕꗏ'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'h:mm a', + 'LTS' => 'h:mm:ss a', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY h:mm a', + 'LLLL' => 'dddd, D MMMM YYYY h:mm a', + ], + + 'year' => ':count ꕀ', // less reliable + 'y' => ':count ꕀ', // less reliable + 'a_year' => ':count ꕀ', // less reliable + + 'second' => ':count ꗱꕞꕯꕊ', // less reliable + 's' => ':count ꗱꕞꕯꕊ', // less reliable + 'a_second' => ':count ꗱꕞꕯꕊ', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/vai_Latn.php b/vendor/nesbot/carbon/src/Carbon/Lang/vai_Latn.php new file mode 100644 index 00000000..51e83cc5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/vai_Latn.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'weekdays' => ['lahadi', 'tɛɛnɛɛ', 'talata', 'alaba', 'aimisa', 'aijima', 'siɓiti'], + 'weekdays_short' => ['lahadi', 'tɛɛnɛɛ', 'talata', 'alaba', 'aimisa', 'aijima', 'siɓiti'], + 'weekdays_min' => ['lahadi', 'tɛɛnɛɛ', 'talata', 'alaba', 'aimisa', 'aijima', 'siɓiti'], + 'months' => ['luukao kemã', 'ɓandaɓu', 'vɔɔ', 'fulu', 'goo', '6', '7', 'kɔnde', 'saah', 'galo', 'kenpkato ɓololɔ', 'luukao lɔma'], + 'months_short' => ['luukao kemã', 'ɓandaɓu', 'vɔɔ', 'fulu', 'goo', '6', '7', 'kɔnde', 'saah', 'galo', 'kenpkato ɓololɔ', 'luukao lɔma'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'h:mm a', + 'LTS' => 'h:mm:ss a', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY h:mm a', + 'LLLL' => 'dddd, D MMMM YYYY h:mm a', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/vai_Vaii.php b/vendor/nesbot/carbon/src/Carbon/Lang/vai_Vaii.php new file mode 100644 index 00000000..b4bb533f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/vai_Vaii.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/vai.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ve.php b/vendor/nesbot/carbon/src/Carbon/Lang/ve.php new file mode 100644 index 00000000..7f10aeb9 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ve.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/ve_ZA.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ve_ZA.php b/vendor/nesbot/carbon/src/Carbon/Lang/ve_ZA.php new file mode 100644 index 00000000..5eb2b912 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ve_ZA.php @@ -0,0 +1,49 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Zuza Software Foundation (Translate.org.za) Dwayne Bailey dwayne@translate.org.za + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['Phando', 'Luhuhi', 'Ṱhafamuhwe', 'Lambamai', 'Shundunthule', 'Fulwi', 'Fulwana', 'Ṱhangule', 'Khubvumedzi', 'Tshimedzi', 'Ḽara', 'Nyendavhusiku'], + 'months_short' => ['Pha', 'Luh', 'Fam', 'Lam', 'Shu', 'Lwi', 'Lwa', 'Ngu', 'Khu', 'Tsh', 'Ḽar', 'Nye'], + 'weekdays' => ['Swondaha', 'Musumbuluwo', 'Ḽavhuvhili', 'Ḽavhuraru', 'Ḽavhuṋa', 'Ḽavhuṱanu', 'Mugivhela'], + 'weekdays_short' => ['Swo', 'Mus', 'Vhi', 'Rar', 'ṋa', 'Ṱan', 'Mug'], + 'weekdays_min' => ['Swo', 'Mus', 'Vhi', 'Rar', 'ṋa', 'Ṱan', 'Mug'], + 'day_of_first_week_of_year' => 1, + + // Too unreliable + /* + 'day' => ':count vhege', // less reliable + 'd' => ':count vhege', // less reliable + 'a_day' => ':count vhege', // less reliable + + 'hour' => ':count watshi', // less reliable + 'h' => ':count watshi', // less reliable + 'a_hour' => ':count watshi', // less reliable + + 'minute' => ':count watshi', // less reliable + 'min' => ':count watshi', // less reliable + 'a_minute' => ':count watshi', // less reliable + + 'second' => ':count Mu', // less reliable + 's' => ':count Mu', // less reliable + 'a_second' => ':count Mu', // less reliable + + 'week' => ':count vhege', + 'w' => ':count vhege', + 'a_week' => ':count vhege', + */ +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/vi.php b/vendor/nesbot/carbon/src/Carbon/Lang/vi.php new file mode 100644 index 00000000..73e2852e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/vi.php @@ -0,0 +1,76 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - François B + * - Andre Polykanine A.K.A. Menelion Elensúlë + * - JD Isaacks + */ +return [ + 'year' => ':count năm', + 'a_year' => '{1}một năm|]1, Inf[:count năm', + 'y' => ':count năm', + 'month' => ':count tháng', + 'a_month' => '{1}một tháng|]1, Inf[:count tháng', + 'm' => ':count tháng', + 'week' => ':count tuần', + 'a_week' => '{1}một tuần|]1, Inf[:count tuần', + 'w' => ':count tuần', + 'day' => ':count ngày', + 'a_day' => '{1}một ngày|]1, Inf[:count ngày', + 'd' => ':count ngày', + 'hour' => ':count giờ', + 'a_hour' => '{1}một giờ|]1, Inf[:count giờ', + 'h' => ':count giờ', + 'minute' => ':count phút', + 'a_minute' => '{1}một phút|]1, Inf[:count phút', + 'min' => ':count phút', + 'second' => ':count giây', + 'a_second' => '{1}vài giây|]1, Inf[:count giây', + 's' => ':count giây', + 'ago' => ':time trước', + 'from_now' => ':time tới', + 'after' => ':time sau', + 'before' => ':time trước', + 'diff_now' => 'bây giờ', + 'diff_today' => 'Hôm', + 'diff_today_regexp' => 'Hôm(?:\\s+nay)?(?:\\s+lúc)?', + 'diff_yesterday' => 'Hôm qua', + 'diff_yesterday_regexp' => 'Hôm(?:\\s+qua)?(?:\\s+lúc)?', + 'diff_tomorrow' => 'Ngày mai', + 'diff_tomorrow_regexp' => 'Ngày(?:\\s+mai)?(?:\\s+lúc)?', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM [năm] YYYY', + 'LLL' => 'D MMMM [năm] YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM [năm] YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[Hôm nay lúc] LT', + 'nextDay' => '[Ngày mai lúc] LT', + 'nextWeek' => 'dddd [tuần tới lúc] LT', + 'lastDay' => '[Hôm qua lúc] LT', + 'lastWeek' => 'dddd [tuần trước lúc] LT', + 'sameElse' => 'L', + ], + 'meridiem' => ['SA', 'CH'], + 'months' => ['tháng 1', 'tháng 2', 'tháng 3', 'tháng 4', 'tháng 5', 'tháng 6', 'tháng 7', 'tháng 8', 'tháng 9', 'tháng 10', 'tháng 11', 'tháng 12'], + 'months_short' => ['Th01', 'Th02', 'Th03', 'Th04', 'Th05', 'Th06', 'Th07', 'Th08', 'Th09', 'Th10', 'Th11', 'Th12'], + 'weekdays' => ['chủ nhật', 'thứ hai', 'thứ ba', 'thứ tư', 'thứ năm', 'thứ sáu', 'thứ bảy'], + 'weekdays_short' => ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'], + 'weekdays_min' => ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => [', ', ' và '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/vi_VN.php b/vendor/nesbot/carbon/src/Carbon/Lang/vi_VN.php new file mode 100644 index 00000000..18d89876 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/vi_VN.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/vi.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/vo.php b/vendor/nesbot/carbon/src/Carbon/Lang/vo.php new file mode 100644 index 00000000..e273033f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/vo.php @@ -0,0 +1,52 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'months' => ['M01', 'M02', 'M03', 'M04', 'M05', 'M06', 'M07', 'M08', 'M09', 'M10', 'M11', 'M12'], + 'months_short' => ['M01', 'M02', 'M03', 'M04', 'M05', 'M06', 'M07', 'M08', 'M09', 'M10', 'M11', 'M12'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY-MM-dd', + 'LL' => 'YYYY MMM D', + 'LLL' => 'YYYY MMMM D HH:mm', + 'LLLL' => 'YYYY MMMM D, dddd HH:mm', + ], + + 'year' => ':count yel', + 'y' => ':count yel', + 'a_year' => ':count yel', + + 'month' => ':count mul', + 'm' => ':count mul', + 'a_month' => ':count mul', + + 'week' => ':count vig', + 'w' => ':count vig', + 'a_week' => ':count vig', + + 'day' => ':count del', + 'd' => ':count del', + 'a_day' => ':count del', + + 'hour' => ':count düp', + 'h' => ':count düp', + 'a_hour' => ':count düp', + + 'minute' => ':count minut', + 'min' => ':count minut', + 'a_minute' => ':count minut', + + 'second' => ':count sekun', + 's' => ':count sekun', + 'a_second' => ':count sekun', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/vun.php b/vendor/nesbot/carbon/src/Carbon/Lang/vun.php new file mode 100644 index 00000000..ed92e8e7 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/vun.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['utuko', 'kyiukonyi'], + 'weekdays' => ['Jumapilyi', 'Jumatatuu', 'Jumanne', 'Jumatanu', 'Alhamisi', 'Ijumaa', 'Jumamosi'], + 'weekdays_short' => ['Jpi', 'Jtt', 'Jnn', 'Jtn', 'Alh', 'Iju', 'Jmo'], + 'weekdays_min' => ['Jpi', 'Jtt', 'Jnn', 'Jtn', 'Alh', 'Iju', 'Jmo'], + 'months' => ['Januari', 'Februari', 'Machi', 'Aprilyi', 'Mei', 'Junyi', 'Julyai', 'Agusti', 'Septemba', 'Oktoba', 'Novemba', 'Desemba'], + 'months_short' => ['Jan', 'Feb', 'Mac', 'Apr', 'Mei', 'Jun', 'Jul', 'Ago', 'Sep', 'Okt', 'Nov', 'Des'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/wa.php b/vendor/nesbot/carbon/src/Carbon/Lang/wa.php new file mode 100644 index 00000000..f6dc4ccd --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/wa.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/wa_BE.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/wa_BE.php b/vendor/nesbot/carbon/src/Carbon/Lang/wa_BE.php new file mode 100644 index 00000000..a76d80d9 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/wa_BE.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Djan SACRE Pablo Saratxaga pablo@mandrakesoft.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['di djanvî', 'di fevrî', 'di måss', 'd’ avri', 'di may', 'di djun', 'di djulete', 'd’ awousse', 'di setimbe', 'd’ octôbe', 'di nôvimbe', 'di decimbe'], + 'months_short' => ['dja', 'fev', 'mås', 'avr', 'may', 'djn', 'djl', 'awo', 'set', 'oct', 'nôv', 'dec'], + 'weekdays' => ['dimegne', 'londi', 'mårdi', 'mierkidi', 'djudi', 'vénrdi', 'semdi'], + 'weekdays_short' => ['dim', 'lon', 'mår', 'mie', 'dju', 'vén', 'sem'], + 'weekdays_min' => ['dim', 'lon', 'mår', 'mie', 'dju', 'vén', 'sem'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + + 'year' => ':count anêye', + 'y' => ':count anêye', + 'a_year' => ':count anêye', + + 'month' => ':count meûs', + 'm' => ':count meûs', + 'a_month' => ':count meûs', + + 'week' => ':count samwinne', + 'w' => ':count samwinne', + 'a_week' => ':count samwinne', + + 'day' => ':count djoû', + 'd' => ':count djoû', + 'a_day' => ':count djoû', + + 'hour' => ':count eure', + 'h' => ':count eure', + 'a_hour' => ':count eure', + + 'minute' => ':count munute', + 'min' => ':count munute', + 'a_minute' => ':count munute', + + 'second' => ':count Sigonde', + 's' => ':count Sigonde', + 'a_second' => ':count Sigonde', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/wae.php b/vendor/nesbot/carbon/src/Carbon/Lang/wae.php new file mode 100644 index 00000000..bf57f23e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/wae.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/wae_CH.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/wae_CH.php b/vendor/nesbot/carbon/src/Carbon/Lang/wae_CH.php new file mode 100644 index 00000000..2af50b4b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/wae_CH.php @@ -0,0 +1,31 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Walser Translation Team ml@translate-wae.ch + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'YYYY-MM-DD', + ], + 'months' => ['Jenner', 'Hornig', 'Märze', 'Abrille', 'Meije', 'Bráčet', 'Heiwet', 'Öigšte', 'Herbštmánet', 'Wímánet', 'Wintermánet', 'Chrištmánet'], + 'months_short' => ['Jen', 'Hor', 'Mär', 'Abr', 'Mei', 'Brá', 'Hei', 'Öig', 'Her', 'Wím', 'Win', 'Chr'], + 'weekdays' => ['Suntag', 'Mäntag', 'Zischtag', 'Mittwuch', 'Frontag', 'Fritag', 'Samschtag'], + 'weekdays_short' => ['Sun', 'Män', 'Zis', 'Mit', 'Fro', 'Fri', 'Sam'], + 'weekdays_min' => ['Sun', 'Män', 'Zis', 'Mit', 'Fro', 'Fri', 'Sam'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + + 'month' => ':count Maano', // less reliable + 'm' => ':count Maano', // less reliable + 'a_month' => ':count Maano', // less reliable +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/wal.php b/vendor/nesbot/carbon/src/Carbon/Lang/wal.php new file mode 100644 index 00000000..e8ec40ff --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/wal.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/wal_ET.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/wal_ET.php b/vendor/nesbot/carbon/src/Carbon/Lang/wal_ET.php new file mode 100644 index 00000000..a4e619a8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/wal_ET.php @@ -0,0 +1,27 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Ge'ez Frontier Foundation locales@geez.org + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['ጃንዩወሪ', 'ፌብሩወሪ', 'ማርች', 'ኤፕረል', 'ሜይ', 'ጁን', 'ጁላይ', 'ኦገስት', 'ሴፕቴምበር', 'ኦክተውበር', 'ኖቬምበር', 'ዲሴምበር'], + 'months_short' => ['ጃንዩ', 'ፌብሩ', 'ማርች', 'ኤፕረ', 'ሜይ ', 'ጁን ', 'ጁላይ', 'ኦገስ', 'ሴፕቴ', 'ኦክተ', 'ኖቬም', 'ዲሴም'], + 'weekdays' => ['ወጋ', 'ሳይኖ', 'ማቆሳኛ', 'አሩዋ', 'ሃሙሳ', 'አርባ', 'ቄራ'], + 'weekdays_short' => ['ወጋ ', 'ሳይኖ', 'ማቆሳ', 'አሩዋ', 'ሃሙሳ', 'አርባ', 'ቄራ '], + 'weekdays_min' => ['ወጋ ', 'ሳይኖ', 'ማቆሳ', 'አሩዋ', 'ሃሙሳ', 'አርባ', 'ቄራ '], + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['ማለዶ', 'ቃማ'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/wo.php b/vendor/nesbot/carbon/src/Carbon/Lang/wo.php new file mode 100644 index 00000000..74b95df0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/wo.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/wo_SN.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/wo_SN.php b/vendor/nesbot/carbon/src/Carbon/Lang/wo_SN.php new file mode 100644 index 00000000..f8a85b3e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/wo_SN.php @@ -0,0 +1,39 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - The Debian Project Christian Perrier bubulle@debian.org + */ +return [ + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'MMMM DD, YYYY', + 'LLL' => 'DD MMM HH:mm', + 'LLLL' => 'MMMM DD, YYYY HH:mm', + ], + 'months' => ['sanwiy\'e', 'feebriy\'e', 'mars', 'awril', 'me', 'suwen', 'sulet', 'uut', 'septaambar', 'oktoobar', 'nowaambar', 'desaambar'], + 'months_short' => ['san', 'fee', 'mar', 'awr', 'me ', 'suw', 'sul', 'uut', 'sep', 'okt', 'now', 'des'], + 'weekdays' => ['dib\'eer', 'altine', 'talaata', 'allarba', 'alxames', 'ajjuma', 'gaawu'], + 'weekdays_short' => ['dib', 'alt', 'tal', 'all', 'alx', 'ajj', 'gaa'], + 'weekdays_min' => ['dib', 'alt', 'tal', 'all', 'alx', 'ajj', 'gaa'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'year' => ':count at', + 'month' => ':count wèr', + 'week' => ':count ayubés', + 'day' => ':count bés', + 'hour' => ':count waxtu', + 'minute' => ':count simili', + 'second' => ':count saa', +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/xh.php b/vendor/nesbot/carbon/src/Carbon/Lang/xh.php new file mode 100644 index 00000000..e88c78d9 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/xh.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/xh_ZA.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/xh_ZA.php b/vendor/nesbot/carbon/src/Carbon/Lang/xh_ZA.php new file mode 100644 index 00000000..910f8311 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/xh_ZA.php @@ -0,0 +1,54 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Zuza Software Foundation (Translate.org.za) Dwayne Bailey dwayne@translate.org.za + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['eyoMqungu', 'eyoMdumba', 'eyoKwindla', 'uTshazimpuzi', 'uCanzibe', 'eyeSilimela', 'eyeKhala', 'eyeThupa', 'eyoMsintsi', 'eyeDwarha', 'eyeNkanga', 'eyoMnga'], + 'months_short' => ['Mqu', 'Mdu', 'Kwi', 'Tsh', 'Can', 'Sil', 'Kha', 'Thu', 'Msi', 'Dwa', 'Nka', 'Mng'], + 'weekdays' => ['iCawa', 'uMvulo', 'lwesiBini', 'lwesiThathu', 'ulweSine', 'lwesiHlanu', 'uMgqibelo'], + 'weekdays_short' => ['Caw', 'Mvu', 'Bin', 'Tha', 'Sin', 'Hla', 'Mgq'], + 'weekdays_min' => ['Caw', 'Mvu', 'Bin', 'Tha', 'Sin', 'Hla', 'Mgq'], + 'day_of_first_week_of_year' => 1, + + 'year' => ':count ihlobo', // less reliable + 'y' => ':count ihlobo', // less reliable + 'a_year' => ':count ihlobo', // less reliable + + 'hour' => ':count iwotshi', // less reliable + 'h' => ':count iwotshi', // less reliable + 'a_hour' => ':count iwotshi', // less reliable + + 'minute' => ':count ingqalelo', // less reliable + 'min' => ':count ingqalelo', // less reliable + 'a_minute' => ':count ingqalelo', // less reliable + + 'second' => ':count nceda', // less reliable + 's' => ':count nceda', // less reliable + 'a_second' => ':count nceda', // less reliable + + 'month' => ':count inyanga', + 'm' => ':count inyanga', + 'a_month' => ':count inyanga', + + 'week' => ':count veki', + 'w' => ':count veki', + 'a_week' => ':count veki', + + 'day' => ':count imini', + 'd' => ':count imini', + 'a_day' => ':count imini', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/xog.php b/vendor/nesbot/carbon/src/Carbon/Lang/xog.php new file mode 100644 index 00000000..eb55b4ab --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/xog.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['Munkyo', 'Eigulo'], + 'weekdays' => ['Sabiiti', 'Balaza', 'Owokubili', 'Owokusatu', 'Olokuna', 'Olokutaanu', 'Olomukaaga'], + 'weekdays_short' => ['Sabi', 'Bala', 'Kubi', 'Kusa', 'Kuna', 'Kuta', 'Muka'], + 'weekdays_min' => ['Sabi', 'Bala', 'Kubi', 'Kusa', 'Kuna', 'Kuta', 'Muka'], + 'months' => ['Janwaliyo', 'Febwaliyo', 'Marisi', 'Apuli', 'Maayi', 'Juuni', 'Julaayi', 'Agusito', 'Sebuttemba', 'Okitobba', 'Novemba', 'Desemba'], + 'months_short' => ['Jan', 'Feb', 'Mar', 'Apu', 'Maa', 'Juu', 'Jul', 'Agu', 'Seb', 'Oki', 'Nov', 'Des'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/yav.php b/vendor/nesbot/carbon/src/Carbon/Lang/yav.php new file mode 100644 index 00000000..225a20d8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/yav.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/en.php', [ + 'meridiem' => ['kiɛmɛ́ɛm', 'kisɛ́ndɛ'], + 'weekdays' => ['sɔ́ndiɛ', 'móndie', 'muányáŋmóndie', 'metúkpíápɛ', 'kúpélimetúkpiapɛ', 'feléte', 'séselé'], + 'weekdays_short' => ['sd', 'md', 'mw', 'et', 'kl', 'fl', 'ss'], + 'weekdays_min' => ['sd', 'md', 'mw', 'et', 'kl', 'fl', 'ss'], + 'months' => ['pikítíkítie, oólí ú kutúan', 'siɛyɛ́, oóli ú kándíɛ', 'ɔnsúmbɔl, oóli ú kátátúɛ', 'mesiŋ, oóli ú kénie', 'ensil, oóli ú kátánuɛ', 'ɔsɔn', 'efute', 'pisuyú', 'imɛŋ i puɔs', 'imɛŋ i putúk,oóli ú kátíɛ', 'makandikɛ', 'pilɔndɔ́'], + 'months_short' => ['o.1', 'o.2', 'o.3', 'o.4', 'o.5', 'o.6', 'o.7', 'o.8', 'o.9', 'o.10', 'o.11', 'o.12'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/yi.php b/vendor/nesbot/carbon/src/Carbon/Lang/yi.php new file mode 100644 index 00000000..8f320229 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/yi.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/yi_US.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/yi_US.php b/vendor/nesbot/carbon/src/Carbon/Lang/yi_US.php new file mode 100644 index 00000000..f764d36f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/yi_US.php @@ -0,0 +1,54 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - http://www.uyip.org/ Pablo Saratxaga pablo@mandrakesoft.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YY', + ], + 'months' => ['יאַנואַר', 'פֿעברואַר', 'מערץ', 'אַפּריל', 'מיי', 'יוני', 'יולי', 'אויגוסט', 'סעפּטעמבער', 'אקטאבער', 'נאוועמבער', 'דעצעמבער'], + 'months_short' => ['יאַנ', 'פֿעב', 'מאַר', 'אַפּר', 'מײַ ', 'יונ', 'יול', 'אױג', 'סעפּ', 'אָקט', 'נאָװ', 'דעצ'], + 'weekdays' => ['זונטיק', 'מאָנטיק', 'דינסטיק', 'מיטװאָך', 'דאָנערשטיק', 'פֿרײַטיק', 'שבת'], + 'weekdays_short' => ['זונ\'', 'מאָנ\'', 'דינ\'', 'מיט\'', 'דאָנ\'', 'פֿרײַ\'', 'שבת'], + 'weekdays_min' => ['זונ\'', 'מאָנ\'', 'דינ\'', 'מיט\'', 'דאָנ\'', 'פֿרײַ\'', 'שבת'], + 'day_of_first_week_of_year' => 1, + + 'year' => ':count יאר', + 'y' => ':count יאר', + 'a_year' => ':count יאר', + + 'month' => ':count חודש', + 'm' => ':count חודש', + 'a_month' => ':count חודש', + + 'week' => ':count וואָך', + 'w' => ':count וואָך', + 'a_week' => ':count וואָך', + + 'day' => ':count טאָג', + 'd' => ':count טאָג', + 'a_day' => ':count טאָג', + + 'hour' => ':count שעה', + 'h' => ':count שעה', + 'a_hour' => ':count שעה', + + 'minute' => ':count מינוט', + 'min' => ':count מינוט', + 'a_minute' => ':count מינוט', + + 'second' => ':count סעקונדע', + 's' => ':count סעקונדע', + 'a_second' => ':count סעקונדע', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/yo.php b/vendor/nesbot/carbon/src/Carbon/Lang/yo.php new file mode 100644 index 00000000..0a829810 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/yo.php @@ -0,0 +1,65 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - François B + * - Atolagbe Abisoye + */ +return [ + 'year' => 'ọdún :count', + 'a_year' => '{1}ọdún kan|ọdún :count', + 'month' => 'osù :count', + 'a_month' => '{1}osù kan|osù :count', + 'week' => 'ọsẹ :count', + 'a_week' => '{1}ọsẹ kan|ọsẹ :count', + 'day' => 'ọjọ́ :count', + 'a_day' => '{1}ọjọ́ kan|ọjọ́ :count', + 'hour' => 'wákati :count', + 'a_hour' => '{1}wákati kan|wákati :count', + 'minute' => 'ìsẹjú :count', + 'a_minute' => '{1}ìsẹjú kan|ìsẹjú :count', + 'second' => 'iaayá :count', + 'a_second' => '{1}ìsẹjú aayá die|aayá :count', + 'ago' => ':time kọjá', + 'from_now' => 'ní :time', + 'diff_yesterday' => 'Àna', + 'diff_yesterday_regexp' => 'Àna(?:\\s+ni)?', + 'diff_today' => 'Ònì', + 'diff_today_regexp' => 'Ònì(?:\\s+ni)?', + 'diff_tomorrow' => 'Ọ̀la', + 'diff_tomorrow_regexp' => 'Ọ̀la(?:\\s+ni)?', + 'formats' => [ + 'LT' => 'h:mm A', + 'LTS' => 'h:mm:ss A', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY h:mm A', + 'LLLL' => 'dddd, D MMMM YYYY h:mm A', + ], + 'calendar' => [ + 'sameDay' => '[Ònì ni] LT', + 'nextDay' => '[Ọ̀la ni] LT', + 'nextWeek' => 'dddd [Ọsẹ̀ tón\'bọ] [ni] LT', + 'lastDay' => '[Àna ni] LT', + 'lastWeek' => 'dddd [Ọsẹ̀ tólọ́] [ni] LT', + 'sameElse' => 'L', + ], + 'ordinal' => 'ọjọ́ :number', + 'months' => ['Sẹ́rẹ́', 'Èrèlè', 'Ẹrẹ̀nà', 'Ìgbé', 'Èbibi', 'Òkùdu', 'Agẹmo', 'Ògún', 'Owewe', 'Ọ̀wàrà', 'Bélú', 'Ọ̀pẹ̀̀'], + 'months_short' => ['Sẹ́r', 'Èrl', 'Ẹrn', 'Ìgb', 'Èbi', 'Òkù', 'Agẹ', 'Ògú', 'Owe', 'Ọ̀wà', 'Bél', 'Ọ̀pẹ̀̀'], + 'weekdays' => ['Àìkú', 'Ajé', 'Ìsẹ́gun', 'Ọjọ́rú', 'Ọjọ́bọ', 'Ẹtì', 'Àbámẹ́ta'], + 'weekdays_short' => ['Àìk', 'Ajé', 'Ìsẹ́', 'Ọjr', 'Ọjb', 'Ẹtì', 'Àbá'], + 'weekdays_min' => ['Àì', 'Aj', 'Ìs', 'Ọr', 'Ọb', 'Ẹt', 'Àb'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'meridiem' => ['Àárọ̀', 'Ọ̀sán'], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/yo_BJ.php b/vendor/nesbot/carbon/src/Carbon/Lang/yo_BJ.php new file mode 100644 index 00000000..12b9e815 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/yo_BJ.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array_replace_recursive(require __DIR__.'/yo.php', [ + 'meridiem' => ['Àárɔ̀', 'Ɔ̀sán'], + 'weekdays' => ['Ɔjɔ́ Àìkú', 'Ɔjɔ́ Ajé', 'Ɔjɔ́ Ìsɛ́gun', 'Ɔjɔ́rú', 'Ɔjɔ́bɔ', 'Ɔjɔ́ Ɛtì', 'Ɔjɔ́ Àbámɛ́ta'], + 'weekdays_short' => ['Àìkú', 'Ajé', 'Ìsɛ́gun', 'Ɔjɔ́rú', 'Ɔjɔ́bɔ', 'Ɛtì', 'Àbámɛ́ta'], + 'weekdays_min' => ['Àìkú', 'Ajé', 'Ìsɛ́gun', 'Ɔjɔ́rú', 'Ɔjɔ́bɔ', 'Ɛtì', 'Àbámɛ́ta'], + 'months' => ['Oshù Shɛ́rɛ́', 'Oshù Èrèlè', 'Oshù Ɛrɛ̀nà', 'Oshù Ìgbé', 'Oshù Ɛ̀bibi', 'Oshù Òkúdu', 'Oshù Agɛmɔ', 'Oshù Ògún', 'Oshù Owewe', 'Oshù Ɔ̀wàrà', 'Oshù Bélú', 'Oshù Ɔ̀pɛ̀'], + 'months_short' => ['Shɛ́rɛ́', 'Èrèlè', 'Ɛrɛ̀nà', 'Ìgbé', 'Ɛ̀bibi', 'Òkúdu', 'Agɛmɔ', 'Ògún', 'Owewe', 'Ɔ̀wàrà', 'Bélú', 'Ɔ̀pɛ̀'], + 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd, D MMMM YYYY HH:mm', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/yo_NG.php b/vendor/nesbot/carbon/src/Carbon/Lang/yo_NG.php new file mode 100644 index 00000000..6860bc1a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/yo_NG.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/yo.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/yue.php b/vendor/nesbot/carbon/src/Carbon/Lang/yue.php new file mode 100644 index 00000000..ce233a4f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/yue.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/yue_HK.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/yue_HK.php b/vendor/nesbot/carbon/src/Carbon/Lang/yue_HK.php new file mode 100644 index 00000000..4e7d5c36 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/yue_HK.php @@ -0,0 +1,28 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/zh_HK.php', [ + 'formats' => [ + 'L' => 'YYYY年MM月DD日 dddd', + ], + 'months' => ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], + 'months_short' => ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], + 'weekdays' => ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'], + 'weekdays_short' => ['日', '一', '二', '三', '四', '五', '六'], + 'weekdays_min' => ['日', '一', '二', '三', '四', '五', '六'], + 'first_day_of_week' => 0, + 'day_of_first_week_of_year' => 1, + 'meridiem' => ['上午', '下午'], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/yue_Hans.php b/vendor/nesbot/carbon/src/Carbon/Lang/yue_Hans.php new file mode 100644 index 00000000..db913caa --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/yue_Hans.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/zh_Hans.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/yue_Hant.php b/vendor/nesbot/carbon/src/Carbon/Lang/yue_Hant.php new file mode 100644 index 00000000..e2526f13 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/yue_Hant.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/zh_Hant.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/yuw.php b/vendor/nesbot/carbon/src/Carbon/Lang/yuw.php new file mode 100644 index 00000000..8efdc937 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/yuw.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/yuw_PG.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/yuw_PG.php b/vendor/nesbot/carbon/src/Carbon/Lang/yuw_PG.php new file mode 100644 index 00000000..b99ad2e8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/yuw_PG.php @@ -0,0 +1,26 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Information from native speakers Hannah Sarvasy nungon.localization@gmail.com + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YY', + ], + 'months' => ['jenuari', 'febuari', 'mas', 'epril', 'mei', 'jun', 'julai', 'ögus', 'septemba', 'öktoba', 'nöwemba', 'diksemba'], + 'months_short' => ['jen', 'feb', 'mas', 'epr', 'mei', 'jun', 'jul', 'ögu', 'sep', 'ökt', 'nöw', 'dis'], + 'weekdays' => ['sönda', 'mönda', 'sinda', 'mitiwö', 'sogipbono', 'nenggo', 'söndanggie'], + 'weekdays_short' => ['sön', 'mön', 'sin', 'mit', 'soi', 'nen', 'sab'], + 'weekdays_min' => ['sön', 'mön', 'sin', 'mit', 'soi', 'nen', 'sab'], + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/zgh.php b/vendor/nesbot/carbon/src/Carbon/Lang/zgh.php new file mode 100644 index 00000000..4d2c3b37 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/zgh.php @@ -0,0 +1,80 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - BAKTETE Miloud + */ +return [ + 'year' => ':count ⵓⵙⴳⴳⵯⴰⵙ|:count ⵉⵙⴳⴳⵓⵙⴰ', + 'a_year' => 'ⵓⵙⴳⴳⵯⴰⵙ|:count ⵉⵙⴳⴳⵓⵙⴰ', + 'y' => ':count ⵓⵙⴳⴳⵯⴰⵙ|:count ⵉⵙⴳⴳⵓⵙⴰ', + 'month' => ':count ⵡⴰⵢⵢⵓⵔ|:count ⴰⵢⵢⵓⵔⵏ', + 'a_month' => 'ⵉⴷⵊ ⵡⴰⵢⵢⵓⵔ|:count ⴰⵢⵢⵓⵔⵏ', + 'm' => ':count ⴰⵢⵢⵓⵔⵏ', + 'week' => ':count ⵉⵎⴰⵍⴰⵙⵙ|:count ⵉⵎⴰⵍⴰⵙⵙⵏ', + 'a_week' => 'ⵉⵛⵜ ⵉⵎⴰⵍⴰⵙⵙ|:count ⵉⵎⴰⵍⴰⵙⵙⵏ', + 'w' => ':count ⵉⵎⴰⵍⴰⵙⵙ.', + 'day' => ':count ⵡⴰⵙⵙ|:count ⵓⵙⵙⴰⵏ', + 'a_day' => 'ⵉⴷⵊ ⵡⴰⵙⵙ|:count ⵓⵙⵙⴰⵏ', + 'd' => ':count ⵓ', + 'hour' => ':count ⵜⵙⵔⴰⴳⵜ|:count ⵜⵉⵙⵔⴰⴳⵉⵏ', + 'a_hour' => 'ⵉⵛⵜ ⵜⵙⵔⴰⴳⵜ|:count ⵜⵉⵙⵔⴰⴳⵉⵏ', + 'h' => ':count ⵜ', + 'minute' => ':count ⵜⵓⵙⴷⵉⴷⵜ|:count ⵜⵓⵙⴷⵉⴷⵉⵏ', + 'a_minute' => 'ⵉⵛⵜ ⵜⵓⵙⴷⵉⴷⵜ|:count ⵜⵓⵙⴷⵉⴷⵉⵏ', + 'min' => ':count ⵜⵓⵙ', + 'second' => ':count ⵜⵙⵉⵏⵜ|:count ⵜⵉⵙⵉⵏⴰ', + 'a_second' => 'ⴽⵔⴰ ⵜⵉⵙⵉⵏⴰ|:count ⵜⵉⵙⵉⵏⴰ', + 's' => ':count ⵜ', + 'ago' => 'ⵣⴳ :time', + 'from_now' => 'ⴷⴳ :time', + 'after' => ':time ⴰⵡⴰⵔ', + 'before' => ':time ⴷⴰⵜ', + 'diff_now' => 'ⴰⴷⵡⴰⵍⵉ', + 'diff_today' => 'ⴰⵙⵙ', + 'diff_today_regexp' => 'ⴰⵙⵙ(?:\\s+ⴰ/ⴰⴷ)?(?:\\s+ⴳ)?', + 'diff_yesterday' => 'ⴰⵙⵙⵏⵏⴰⵟ', + 'diff_yesterday_regexp' => 'ⴰⵙⵙⵏⵏⴰⵟ(?:\\s+ⴳ)?', + 'diff_tomorrow' => 'ⴰⵙⴽⴽⴰ', + 'diff_tomorrow_regexp' => 'ⴰⵙⴽⴽⴰ(?:\\s+ⴳ)?', + 'diff_before_yesterday' => 'ⴼⵔ ⵉⴹⵏⵏⴰⵟ', + 'diff_after_tomorrow' => 'ⵏⴰⴼ ⵓⵙⴽⴽⴰ', + 'period_recurrences' => ':count ⵜⵉⴽⴽⴰⵍ', + 'period_interval' => 'ⴽⵓ :interval', + 'period_start_date' => 'ⴳ :date', + 'period_end_date' => 'ⵉ :date', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD/MM/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[ⴰⵙⵙ ⴰ/ⴰⴷ ⴳ] LT', + 'nextDay' => '[ⴰⵙⴽⴽⴰ ⴳ] LT', + 'nextWeek' => 'dddd [ⴳ] LT', + 'lastDay' => '[ⴰⵙⵙⵏⵏⴰⵟ ⴳ] LT', + 'lastWeek' => 'dddd [ⴰⵎⴳⴳⴰⵔⵓ ⴳ] LT', + 'sameElse' => 'L', + ], + 'meridiem' => ['ⵜⵉⴼⴰⵡⵜ', 'ⵜⴰⴷⴳⴳⵯⴰⵜ'], + 'months' => ['ⵉⵏⵏⴰⵢⵔ', 'ⴱⵕⴰⵢⵕ', 'ⵎⴰⵕⵚ', 'ⵉⴱⵔⵉⵔ', 'ⵎⴰⵢⵢⵓ', 'ⵢⵓⵏⵢⵓ', 'ⵢⵓⵍⵢⵓⵣ', 'ⵖⵓⵛⵜ', 'ⵛⵓⵜⴰⵏⴱⵉⵔ', 'ⴽⵟⵓⴱⵕ', 'ⵏⵓⵡⴰⵏⴱⵉⵔ', 'ⴷⵓⵊⴰⵏⴱⵉⵔ'], + 'months_short' => ['ⵉⵏⵏ', 'ⴱⵕⴰ', 'ⵎⴰⵕ', 'ⵉⴱⵔ', 'ⵎⴰⵢ', 'ⵢⵓⵏ', 'ⵢⵓⵍ', 'ⵖⵓⵛ', 'ⵛⵓⵜ', 'ⴽⵟⵓ', 'ⵏⵓⵡ', 'ⴷⵓⵊ'], + 'weekdays' => ['ⵓⵙⴰⵎⴰⵙ', 'ⵡⴰⵢⵏⴰⵙ', 'ⵓⵙⵉⵏⴰⵙ', 'ⵡⴰⴽⵕⴰⵙ', 'ⵓⴽⵡⴰⵙ', 'ⵓⵙⵉⵎⵡⴰⵙ', 'ⵓⵙⵉⴹⵢⴰⵙ'], + 'weekdays_short' => ['ⵓⵙⴰ', 'ⵡⴰⵢ', 'ⵓⵙⵉ', 'ⵡⴰⴽ', 'ⵓⴽⵡ', 'ⵓⵙⵉⵎ', 'ⵓⵙⵉⴹ'], + 'weekdays_min' => ['ⵓⵙⴰ', 'ⵡⴰⵢ', 'ⵓⵙⵉ', 'ⵡⴰⴽ', 'ⵓⴽⵡ', 'ⵓⵙⵉⵎ', 'ⵓⵙⵉⴹ'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 1, + 'list' => [', ', ' ⴷ '], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/zh.php b/vendor/nesbot/carbon/src/Carbon/Lang/zh.php new file mode 100644 index 00000000..1187c3d7 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/zh.php @@ -0,0 +1,29 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - xuri + * - sycuato + * - bokideckonja + * - Luo Ning + * - William Yang (williamyang233) + */ +return array_merge(require __DIR__.'/zh_Hans.php', [ + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY/MM/DD', + 'LL' => 'YYYY年M月D日', + 'LLL' => 'YYYY年M月D日 A h点mm分', + 'LLLL' => 'YYYY年M月D日dddd A h点mm分', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/zh_CN.php b/vendor/nesbot/carbon/src/Carbon/Lang/zh_CN.php new file mode 100644 index 00000000..9c05d5a8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/zh_CN.php @@ -0,0 +1,33 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - monkeycon + * - François B + * - Jason Katz-Brown + * - Serhan Apaydın + * - Matt Johnson + * - JD Isaacks + * - Zeno Zeng + * - Chris Hemp + * - shankesgk2 + */ +return array_merge(require __DIR__.'/zh.php', [ + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY/MM/DD', + 'LL' => 'YYYY年M月D日', + 'LLL' => 'YYYY年M月D日Ah点mm分', + 'LLLL' => 'YYYY年M月D日ddddAh点mm分', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/zh_HK.php b/vendor/nesbot/carbon/src/Carbon/Lang/zh_HK.php new file mode 100644 index 00000000..c3ee9fcb --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/zh_HK.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/zh_Hant_HK.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/zh_Hans.php b/vendor/nesbot/carbon/src/Carbon/Lang/zh_Hans.php new file mode 100644 index 00000000..9b91785e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/zh_Hans.php @@ -0,0 +1,109 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - monkeycon + * - François B + * - Jason Katz-Brown + * - Konstantin Konev + * - Chris Lam + * - Serhan Apaydın + * - Gary Lo + * - JD Isaacks + * - Chris Hemp + * - shankesgk2 + * - Daniel Cheung (danvim) + */ +return [ + 'year' => ':count:optional-space年', + 'y' => ':count:optional-space年', + 'month' => ':count:optional-space个月', + 'm' => ':count:optional-space个月', + 'week' => ':count:optional-space周', + 'w' => ':count:optional-space周', + 'day' => ':count:optional-space天', + 'd' => ':count:optional-space天', + 'hour' => ':count:optional-space小时', + 'h' => ':count:optional-space小时', + 'minute' => ':count:optional-space分钟', + 'min' => ':count:optional-space分钟', + 'second' => ':count:optional-space秒', + 'a_second' => '{1}几秒|]1,Inf[:count:optional-space秒', + 's' => ':count:optional-space秒', + 'ago' => ':time前', + 'from_now' => ':time后', + 'after' => ':time后', + 'before' => ':time前', + 'diff_now' => '现在', + 'diff_today' => '今天', + 'diff_yesterday' => '昨天', + 'diff_tomorrow' => '明天', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY/MM/DD', + 'LL' => 'YYYY年M月D日', + 'LLL' => 'YYYY年M月D日 HH:mm', + 'LLLL' => 'YYYY年M月D日dddd HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[今天]LT', + 'nextDay' => '[明天]LT', + 'nextWeek' => '[下]ddddLT', + 'lastDay' => '[昨天]LT', + 'lastWeek' => '[上]ddddLT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number, $period) { + switch ($period) { + case 'd': + case 'D': + case 'DDD': + return $number.'日'; + case 'M': + return $number.'月'; + case 'w': + case 'W': + return $number.'周'; + default: + return $number; + } + }, + 'meridiem' => function ($hour, $minute) { + $time = $hour * 100 + $minute; + if ($time < 600) { + return '凌晨'; + } + if ($time < 900) { + return '早上'; + } + if ($time < 1130) { + return '上午'; + } + if ($time < 1230) { + return '中午'; + } + if ($time < 1800) { + return '下午'; + } + + return '晚上'; + }, + 'months' => ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], + 'months_short' => ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], + 'weekdays' => ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'], + 'weekdays_short' => ['周日', '周一', '周二', '周三', '周四', '周五', '周六'], + 'weekdays_min' => ['日', '一', '二', '三', '四', '五', '六'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => '', +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/zh_Hans_HK.php b/vendor/nesbot/carbon/src/Carbon/Lang/zh_Hans_HK.php new file mode 100644 index 00000000..db913caa --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/zh_Hans_HK.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/zh_Hans.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/zh_Hans_MO.php b/vendor/nesbot/carbon/src/Carbon/Lang/zh_Hans_MO.php new file mode 100644 index 00000000..db913caa --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/zh_Hans_MO.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/zh_Hans.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/zh_Hans_SG.php b/vendor/nesbot/carbon/src/Carbon/Lang/zh_Hans_SG.php new file mode 100644 index 00000000..db913caa --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/zh_Hans_SG.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/zh_Hans.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/zh_Hant.php b/vendor/nesbot/carbon/src/Carbon/Lang/zh_Hant.php new file mode 100644 index 00000000..a27b6109 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/zh_Hant.php @@ -0,0 +1,111 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Adam + * - monkeycon + * - François B + * - Jason Katz-Brown + * - Chris Lam + * - Serhan Apaydın + * - Gary Lo + * - JD Isaacks + * - Chris Hemp + * - Eddie + * - KID + * - shankesgk2 + * - Daniel Cheung (danvim) + */ +return [ + 'year' => ':count:optional-space年', + 'y' => ':count:optional-space年', + 'month' => ':count:optional-space個月', + 'm' => ':count:optional-space月', + 'week' => ':count:optional-space週', + 'w' => ':count:optional-space週', + 'day' => ':count:optional-space天', + 'd' => ':count:optional-space天', + 'hour' => ':count:optional-space小時', + 'h' => ':count:optional-space小時', + 'minute' => ':count:optional-space分鐘', + 'min' => ':count:optional-space分鐘', + 'second' => ':count:optional-space秒', + 'a_second' => '{1}幾秒|]1,Inf[:count:optional-space秒', + 's' => ':count:optional-space秒', + 'ago' => ':time前', + 'from_now' => ':time後', + 'after' => ':time後', + 'before' => ':time前', + 'diff_now' => '現在', + 'diff_today' => '今天', + 'diff_yesterday' => '昨天', + 'diff_tomorrow' => '明天', + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'YYYY/MM/DD', + 'LL' => 'YYYY年M月D日', + 'LLL' => 'YYYY年M月D日 HH:mm', + 'LLLL' => 'YYYY年M月D日dddd HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[今天] LT', + 'nextDay' => '[明天] LT', + 'nextWeek' => '[下]dddd LT', + 'lastDay' => '[昨天] LT', + 'lastWeek' => '[上]dddd LT', + 'sameElse' => 'L', + ], + 'ordinal' => function ($number, $period) { + switch ($period) { + case 'd': + case 'D': + case 'DDD': + return $number.'日'; + case 'M': + return $number.'月'; + case 'w': + case 'W': + return $number.'周'; + default: + return $number; + } + }, + 'meridiem' => function ($hour, $minute) { + $time = $hour * 100 + $minute; + if ($time < 600) { + return '凌晨'; + } + if ($time < 900) { + return '早上'; + } + if ($time < 1130) { + return '上午'; + } + if ($time < 1230) { + return '中午'; + } + if ($time < 1800) { + return '下午'; + } + + return '晚上'; + }, + 'months' => ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], + 'months_short' => ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], + 'weekdays' => ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'], + 'weekdays_short' => ['週日', '週一', '週二', '週三', '週四', '週五', '週六'], + 'weekdays_min' => ['日', '一', '二', '三', '四', '五', '六'], + 'first_day_of_week' => 1, + 'day_of_first_week_of_year' => 4, + 'list' => '', +]; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/zh_Hant_HK.php b/vendor/nesbot/carbon/src/Carbon/Lang/zh_Hant_HK.php new file mode 100644 index 00000000..e2526f13 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/zh_Hant_HK.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/zh_Hant.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/zh_Hant_MO.php b/vendor/nesbot/carbon/src/Carbon/Lang/zh_Hant_MO.php new file mode 100644 index 00000000..e2526f13 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/zh_Hant_MO.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/zh_Hant.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/zh_Hant_TW.php b/vendor/nesbot/carbon/src/Carbon/Lang/zh_Hant_TW.php new file mode 100644 index 00000000..e2526f13 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/zh_Hant_TW.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/zh_Hant.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/zh_MO.php b/vendor/nesbot/carbon/src/Carbon/Lang/zh_MO.php new file mode 100644 index 00000000..1c86d477 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/zh_MO.php @@ -0,0 +1,21 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - tarunvelli + * - Eddie + * - KID + * - shankesgk2 + */ +return array_replace_recursive(require __DIR__.'/zh_Hant.php', [ + 'after' => ':time后', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/zh_SG.php b/vendor/nesbot/carbon/src/Carbon/Lang/zh_SG.php new file mode 100644 index 00000000..c451a562 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/zh_SG.php @@ -0,0 +1,26 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/zh.php', [ + 'formats' => [ + 'L' => 'YYYY年MM月DD日', + ], + 'months' => ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], + 'months_short' => ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], + 'weekdays' => ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'], + 'weekdays_short' => ['日', '一', '二', '三', '四', '五', '六'], + 'weekdays_min' => ['日', '一', '二', '三', '四', '五', '六'], + 'day_of_first_week_of_year' => 1, +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/zh_TW.php b/vendor/nesbot/carbon/src/Carbon/Lang/zh_TW.php new file mode 100644 index 00000000..c6789ed2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/zh_TW.php @@ -0,0 +1,12 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/zh_Hant_TW.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/zh_YUE.php b/vendor/nesbot/carbon/src/Carbon/Lang/zh_YUE.php new file mode 100644 index 00000000..b0d9ba86 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/zh_YUE.php @@ -0,0 +1,20 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + */ +return array_replace_recursive(require __DIR__.'/zh.php', [ + 'formats' => [ + 'L' => 'YYYY-MM-DD', + ], +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/zu.php b/vendor/nesbot/carbon/src/Carbon/Lang/zu.php new file mode 100644 index 00000000..9a6cce02 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/zu.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Unknown default region, use the first alphabetically. + */ +return require __DIR__.'/zu_ZA.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/zu_ZA.php b/vendor/nesbot/carbon/src/Carbon/Lang/zu_ZA.php new file mode 100644 index 00000000..6bfb72f0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/zu_ZA.php @@ -0,0 +1,54 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Zuza Software Foundation (Translate.org.za) Dwayne Bailey dwayne@translate.org.za + */ +return array_replace_recursive(require __DIR__.'/en.php', [ + 'formats' => [ + 'L' => 'DD/MM/YYYY', + ], + 'months' => ['Januwari', 'Februwari', 'Mashi', 'Ephreli', 'Meyi', 'Juni', 'Julayi', 'Agasti', 'Septhemba', 'Okthoba', 'Novemba', 'Disemba'], + 'months_short' => ['Jan', 'Feb', 'Mas', 'Eph', 'Mey', 'Jun', 'Jul', 'Aga', 'Sep', 'Okt', 'Nov', 'Dis'], + 'weekdays' => ['iSonto', 'uMsombuluko', 'uLwesibili', 'uLwesithathu', 'uLwesine', 'uLwesihlanu', 'uMgqibelo'], + 'weekdays_short' => ['Son', 'Mso', 'Bil', 'Tha', 'Sin', 'Hla', 'Mgq'], + 'weekdays_min' => ['Son', 'Mso', 'Bil', 'Tha', 'Sin', 'Hla', 'Mgq'], + 'day_of_first_week_of_year' => 1, + + 'year' => 'kweminyaka engu-:count', + 'y' => 'kweminyaka engu-:count', + 'a_year' => 'kweminyaka engu-:count', + + 'month' => 'izinyanga ezingu-:count', + 'm' => 'izinyanga ezingu-:count', + 'a_month' => 'izinyanga ezingu-:count', + + 'week' => 'lwamasonto angu-:count', + 'w' => 'lwamasonto angu-:count', + 'a_week' => 'lwamasonto angu-:count', + + 'day' => 'ezingaba ngu-:count', + 'd' => 'ezingaba ngu-:count', + 'a_day' => 'ezingaba ngu-:count', + + 'hour' => 'amahora angu-:count', + 'h' => 'amahora angu-:count', + 'a_hour' => 'amahora angu-:count', + + 'minute' => 'ngemizuzu engu-:count', + 'min' => 'ngemizuzu engu-:count', + 'a_minute' => 'ngemizuzu engu-:count', + + 'second' => 'imizuzwana engu-:count', + 's' => 'imizuzwana engu-:count', + 'a_second' => 'imizuzwana engu-:count', +]); diff --git a/vendor/nesbot/carbon/src/Carbon/Language.php b/vendor/nesbot/carbon/src/Carbon/Language.php new file mode 100644 index 00000000..1fb5bafd --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Language.php @@ -0,0 +1,342 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon; + +use JsonSerializable; +use ReturnTypeWillChange; + +class Language implements JsonSerializable +{ + /** + * @var array + */ + protected static $languagesNames; + + /** + * @var array + */ + protected static $regionsNames; + + /** + * @var string + */ + protected $id; + + /** + * @var string + */ + protected $code; + + /** + * @var string|null + */ + protected $variant; + + /** + * @var string|null + */ + protected $region; + + /** + * @var array + */ + protected $names; + + /** + * @var string + */ + protected $isoName; + + /** + * @var string + */ + protected $nativeName; + + public function __construct(string $id) + { + $this->id = str_replace('-', '_', $id); + $parts = explode('_', $this->id); + $this->code = $parts[0]; + + if (isset($parts[1])) { + if (!preg_match('/^[A-Z]+$/', $parts[1])) { + $this->variant = $parts[1]; + $parts[1] = $parts[2] ?? null; + } + if ($parts[1]) { + $this->region = $parts[1]; + } + } + } + + /** + * Get the list of the known languages. + * + * @return array + */ + public static function all() + { + if (!static::$languagesNames) { + static::$languagesNames = require __DIR__.'/List/languages.php'; + } + + return static::$languagesNames; + } + + /** + * Get the list of the known regions. + * + * @return array + */ + public static function regions() + { + if (!static::$regionsNames) { + static::$regionsNames = require __DIR__.'/List/regions.php'; + } + + return static::$regionsNames; + } + + /** + * Get both isoName and nativeName as an array. + * + * @return array + */ + public function getNames(): array + { + if (!$this->names) { + $this->names = static::all()[$this->code] ?? [ + 'isoName' => $this->code, + 'nativeName' => $this->code, + ]; + } + + return $this->names; + } + + /** + * Returns the original locale ID. + * + * @return string + */ + public function getId(): string + { + return $this->id; + } + + /** + * Returns the code of the locale "en"/"fr". + * + * @return string + */ + public function getCode(): string + { + return $this->code; + } + + /** + * Returns the variant code such as cyrl/latn. + * + * @return string|null + */ + public function getVariant(): ?string + { + return $this->variant; + } + + /** + * Returns the variant such as Cyrillic/Latin. + * + * @return string|null + */ + public function getVariantName(): ?string + { + if ($this->variant === 'Latn') { + return 'Latin'; + } + + if ($this->variant === 'Cyrl') { + return 'Cyrillic'; + } + + return $this->variant; + } + + /** + * Returns the region part of the locale. + * + * @return string|null + */ + public function getRegion(): ?string + { + return $this->region; + } + + /** + * Returns the region name for the current language. + * + * @return string|null + */ + public function getRegionName(): ?string + { + return $this->region ? (static::regions()[$this->region] ?? $this->region) : null; + } + + /** + * Returns the long ISO language name. + * + * @return string + */ + public function getFullIsoName(): string + { + if (!$this->isoName) { + $this->isoName = $this->getNames()['isoName']; + } + + return $this->isoName; + } + + /** + * Set the ISO language name. + * + * @param string $isoName + */ + public function setIsoName(string $isoName): self + { + $this->isoName = $isoName; + + return $this; + } + + /** + * Return the full name of the language in this language. + * + * @return string + */ + public function getFullNativeName(): string + { + if (!$this->nativeName) { + $this->nativeName = $this->getNames()['nativeName']; + } + + return $this->nativeName; + } + + /** + * Set the name of the language in this language. + * + * @param string $nativeName + */ + public function setNativeName(string $nativeName): self + { + $this->nativeName = $nativeName; + + return $this; + } + + /** + * Returns the short ISO language name. + * + * @return string + */ + public function getIsoName(): string + { + $name = $this->getFullIsoName(); + + return trim(strstr($name, ',', true) ?: $name); + } + + /** + * Get the short name of the language in this language. + * + * @return string + */ + public function getNativeName(): string + { + $name = $this->getFullNativeName(); + + return trim(strstr($name, ',', true) ?: $name); + } + + /** + * Get a string with short ISO name, region in parentheses if applicable, variant in parentheses if applicable. + * + * @return string + */ + public function getIsoDescription() + { + $region = $this->getRegionName(); + $variant = $this->getVariantName(); + + return $this->getIsoName().($region ? ' ('.$region.')' : '').($variant ? ' ('.$variant.')' : ''); + } + + /** + * Get a string with short native name, region in parentheses if applicable, variant in parentheses if applicable. + * + * @return string + */ + public function getNativeDescription() + { + $region = $this->getRegionName(); + $variant = $this->getVariantName(); + + return $this->getNativeName().($region ? ' ('.$region.')' : '').($variant ? ' ('.$variant.')' : ''); + } + + /** + * Get a string with long ISO name, region in parentheses if applicable, variant in parentheses if applicable. + * + * @return string + */ + public function getFullIsoDescription() + { + $region = $this->getRegionName(); + $variant = $this->getVariantName(); + + return $this->getFullIsoName().($region ? ' ('.$region.')' : '').($variant ? ' ('.$variant.')' : ''); + } + + /** + * Get a string with long native name, region in parentheses if applicable, variant in parentheses if applicable. + * + * @return string + */ + public function getFullNativeDescription() + { + $region = $this->getRegionName(); + $variant = $this->getVariantName(); + + return $this->getFullNativeName().($region ? ' ('.$region.')' : '').($variant ? ' ('.$variant.')' : ''); + } + + /** + * Returns the original locale ID. + * + * @return string + */ + public function __toString() + { + return $this->getId(); + } + + /** + * Get a string with short ISO name, region in parentheses if applicable, variant in parentheses if applicable. + * + * @return string + */ + #[ReturnTypeWillChange] + public function jsonSerialize() + { + return $this->getIsoDescription(); + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php b/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php new file mode 100644 index 00000000..84e241e3 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php @@ -0,0 +1,127 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Laravel; + +use Carbon\Carbon; +use Carbon\CarbonImmutable; +use Carbon\CarbonInterval; +use Carbon\CarbonPeriod; +use Illuminate\Contracts\Events\Dispatcher as DispatcherContract; +use Illuminate\Events\Dispatcher; +use Illuminate\Events\EventDispatcher; +use Illuminate\Support\Carbon as IlluminateCarbon; +use Illuminate\Support\Facades\Date; +use Throwable; + +class ServiceProvider extends \Illuminate\Support\ServiceProvider +{ + /** @var callable|null */ + protected $appGetter = null; + + /** @var callable|null */ + protected $localeGetter = null; + + public function setAppGetter(?callable $appGetter): void + { + $this->appGetter = $appGetter; + } + + public function setLocaleGetter(?callable $localeGetter): void + { + $this->localeGetter = $localeGetter; + } + + public function boot() + { + $this->updateLocale(); + + if (!$this->app->bound('events')) { + return; + } + + $service = $this; + $events = $this->app['events']; + + if ($this->isEventDispatcher($events)) { + $events->listen(class_exists('Illuminate\Foundation\Events\LocaleUpdated') ? 'Illuminate\Foundation\Events\LocaleUpdated' : 'locale.changed', function () use ($service) { + $service->updateLocale(); + }); + } + } + + public function updateLocale() + { + $locale = $this->getLocale(); + + if ($locale === null) { + return; + } + + Carbon::setLocale($locale); + CarbonImmutable::setLocale($locale); + CarbonPeriod::setLocale($locale); + CarbonInterval::setLocale($locale); + + if (class_exists(IlluminateCarbon::class)) { + IlluminateCarbon::setLocale($locale); + } + + if (class_exists(Date::class)) { + try { + $root = Date::getFacadeRoot(); + $root->setLocale($locale); + } catch (Throwable $e) { + // Non Carbon class in use in Date facade + } + } + } + + public function register() + { + // Needed for Laravel < 5.3 compatibility + } + + protected function getLocale() + { + if ($this->localeGetter) { + return ($this->localeGetter)(); + } + + $app = $this->getApp(); + $app = $app && method_exists($app, 'getLocale') + ? $app + : $this->getGlobalApp('translator'); + + return $app ? $app->getLocale() : null; + } + + protected function getApp() + { + if ($this->appGetter) { + return ($this->appGetter)(); + } + + return $this->app ?? $this->getGlobalApp(); + } + + protected function getGlobalApp(...$args) + { + return \function_exists('app') ? \app(...$args) : null; + } + + protected function isEventDispatcher($instance) + { + return $instance instanceof EventDispatcher + || $instance instanceof Dispatcher + || $instance instanceof DispatcherContract; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/List/languages.php b/vendor/nesbot/carbon/src/Carbon/List/languages.php new file mode 100644 index 00000000..5b5d9a1e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/List/languages.php @@ -0,0 +1,1239 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return [ + /* + * ISO 639-2 + */ + 'ab' => [ + 'isoName' => 'Abkhazian', + 'nativeName' => 'аҧсуа бызшәа, аҧсшәа', + ], + 'aa' => [ + 'isoName' => 'Afar', + 'nativeName' => 'Afaraf', + ], + 'af' => [ + 'isoName' => 'Afrikaans', + 'nativeName' => 'Afrikaans', + ], + 'ak' => [ + 'isoName' => 'Akan', + 'nativeName' => 'Akan', + ], + 'sq' => [ + 'isoName' => 'Albanian', + 'nativeName' => 'Shqip', + ], + 'am' => [ + 'isoName' => 'Amharic', + 'nativeName' => 'አማርኛ', + ], + 'ar' => [ + 'isoName' => 'Arabic', + 'nativeName' => 'العربية', + ], + 'an' => [ + 'isoName' => 'Aragonese', + 'nativeName' => 'aragonés', + ], + 'hy' => [ + 'isoName' => 'Armenian', + 'nativeName' => 'Հայերեն', + ], + 'as' => [ + 'isoName' => 'Assamese', + 'nativeName' => 'অসমীয়া', + ], + 'av' => [ + 'isoName' => 'Avaric', + 'nativeName' => 'авар мацӀ, магӀарул мацӀ', + ], + 'ae' => [ + 'isoName' => 'Avestan', + 'nativeName' => 'avesta', + ], + 'ay' => [ + 'isoName' => 'Aymara', + 'nativeName' => 'aymar aru', + ], + 'az' => [ + 'isoName' => 'Azerbaijani', + 'nativeName' => 'azərbaycan dili', + ], + 'bm' => [ + 'isoName' => 'Bambara', + 'nativeName' => 'bamanankan', + ], + 'ba' => [ + 'isoName' => 'Bashkir', + 'nativeName' => 'башҡорт теле', + ], + 'eu' => [ + 'isoName' => 'Basque', + 'nativeName' => 'euskara, euskera', + ], + 'be' => [ + 'isoName' => 'Belarusian', + 'nativeName' => 'беларуская мова', + ], + 'bn' => [ + 'isoName' => 'Bengali', + 'nativeName' => 'বাংলা', + ], + 'bh' => [ + 'isoName' => 'Bihari languages', + 'nativeName' => 'भोजपुरी', + ], + 'bi' => [ + 'isoName' => 'Bislama', + 'nativeName' => 'Bislama', + ], + 'bs' => [ + 'isoName' => 'Bosnian', + 'nativeName' => 'bosanski jezik', + ], + 'br' => [ + 'isoName' => 'Breton', + 'nativeName' => 'brezhoneg', + ], + 'bg' => [ + 'isoName' => 'Bulgarian', + 'nativeName' => 'български език', + ], + 'my' => [ + 'isoName' => 'Burmese', + 'nativeName' => 'ဗမာစာ', + ], + 'ca' => [ + 'isoName' => 'Catalan, Valencian', + 'nativeName' => 'català, valencià', + ], + 'ch' => [ + 'isoName' => 'Chamorro', + 'nativeName' => 'Chamoru', + ], + 'ce' => [ + 'isoName' => 'Chechen', + 'nativeName' => 'нохчийн мотт', + ], + 'ny' => [ + 'isoName' => 'Chichewa, Chewa, Nyanja', + 'nativeName' => 'chiCheŵa, chinyanja', + ], + 'zh' => [ + 'isoName' => 'Chinese', + 'nativeName' => '中文 (Zhōngwén), 汉语, 漢語', + ], + 'cv' => [ + 'isoName' => 'Chuvash', + 'nativeName' => 'чӑваш чӗлхи', + ], + 'kw' => [ + 'isoName' => 'Cornish', + 'nativeName' => 'Kernewek', + ], + 'co' => [ + 'isoName' => 'Corsican', + 'nativeName' => 'corsu, lingua corsa', + ], + 'cr' => [ + 'isoName' => 'Cree', + 'nativeName' => 'ᓀᐦᐃᔭᐍᐏᐣ', + ], + 'hr' => [ + 'isoName' => 'Croatian', + 'nativeName' => 'hrvatski jezik', + ], + 'cs' => [ + 'isoName' => 'Czech', + 'nativeName' => 'čeština, český jazyk', + ], + 'da' => [ + 'isoName' => 'Danish', + 'nativeName' => 'dansk', + ], + 'dv' => [ + 'isoName' => 'Divehi, Dhivehi, Maldivian', + 'nativeName' => 'ދިވެހި', + ], + 'nl' => [ + 'isoName' => 'Dutch, Flemish', + 'nativeName' => 'Nederlands, Vlaams', + ], + 'dz' => [ + 'isoName' => 'Dzongkha', + 'nativeName' => 'རྫོང་ཁ', + ], + 'en' => [ + 'isoName' => 'English', + 'nativeName' => 'English', + ], + 'eo' => [ + 'isoName' => 'Esperanto', + 'nativeName' => 'Esperanto', + ], + 'et' => [ + 'isoName' => 'Estonian', + 'nativeName' => 'eesti, eesti keel', + ], + 'ee' => [ + 'isoName' => 'Ewe', + 'nativeName' => 'Eʋegbe', + ], + 'fo' => [ + 'isoName' => 'Faroese', + 'nativeName' => 'føroyskt', + ], + 'fj' => [ + 'isoName' => 'Fijian', + 'nativeName' => 'vosa Vakaviti', + ], + 'fi' => [ + 'isoName' => 'Finnish', + 'nativeName' => 'suomi, suomen kieli', + ], + 'fr' => [ + 'isoName' => 'French', + 'nativeName' => 'français', + ], + 'ff' => [ + 'isoName' => 'Fulah', + 'nativeName' => 'Fulfulde, Pulaar, Pular', + ], + 'gl' => [ + 'isoName' => 'Galician', + 'nativeName' => 'Galego', + ], + 'ka' => [ + 'isoName' => 'Georgian', + 'nativeName' => 'ქართული', + ], + 'de' => [ + 'isoName' => 'German', + 'nativeName' => 'Deutsch', + ], + 'el' => [ + 'isoName' => 'Greek (modern)', + 'nativeName' => 'ελληνικά', + ], + 'gn' => [ + 'isoName' => 'Guaraní', + 'nativeName' => 'Avañe\'ẽ', + ], + 'gu' => [ + 'isoName' => 'Gujarati', + 'nativeName' => 'ગુજરાતી', + ], + 'ht' => [ + 'isoName' => 'Haitian, Haitian Creole', + 'nativeName' => 'Kreyòl ayisyen', + ], + 'ha' => [ + 'isoName' => 'Hausa', + 'nativeName' => '(Hausa) هَوُسَ', + ], + 'he' => [ + 'isoName' => 'Hebrew (modern)', + 'nativeName' => 'עברית', + ], + 'hz' => [ + 'isoName' => 'Herero', + 'nativeName' => 'Otjiherero', + ], + 'hi' => [ + 'isoName' => 'Hindi', + 'nativeName' => 'हिन्दी, हिंदी', + ], + 'ho' => [ + 'isoName' => 'Hiri Motu', + 'nativeName' => 'Hiri Motu', + ], + 'hu' => [ + 'isoName' => 'Hungarian', + 'nativeName' => 'magyar', + ], + 'ia' => [ + 'isoName' => 'Interlingua', + 'nativeName' => 'Interlingua', + ], + 'id' => [ + 'isoName' => 'Indonesian', + 'nativeName' => 'Bahasa Indonesia', + ], + 'ie' => [ + 'isoName' => 'Interlingue', + 'nativeName' => 'Originally called Occidental; then Interlingue after WWII', + ], + 'ga' => [ + 'isoName' => 'Irish', + 'nativeName' => 'Gaeilge', + ], + 'ig' => [ + 'isoName' => 'Igbo', + 'nativeName' => 'Asụsụ Igbo', + ], + 'ik' => [ + 'isoName' => 'Inupiaq', + 'nativeName' => 'Iñupiaq, Iñupiatun', + ], + 'io' => [ + 'isoName' => 'Ido', + 'nativeName' => 'Ido', + ], + 'is' => [ + 'isoName' => 'Icelandic', + 'nativeName' => 'Íslenska', + ], + 'it' => [ + 'isoName' => 'Italian', + 'nativeName' => 'Italiano', + ], + 'iu' => [ + 'isoName' => 'Inuktitut', + 'nativeName' => 'ᐃᓄᒃᑎᑐᑦ', + ], + 'ja' => [ + 'isoName' => 'Japanese', + 'nativeName' => '日本語 (にほんご)', + ], + 'jv' => [ + 'isoName' => 'Javanese', + 'nativeName' => 'ꦧꦱꦗꦮ, Basa Jawa', + ], + 'kl' => [ + 'isoName' => 'Kalaallisut, Greenlandic', + 'nativeName' => 'kalaallisut, kalaallit oqaasii', + ], + 'kn' => [ + 'isoName' => 'Kannada', + 'nativeName' => 'ಕನ್ನಡ', + ], + 'kr' => [ + 'isoName' => 'Kanuri', + 'nativeName' => 'Kanuri', + ], + 'ks' => [ + 'isoName' => 'Kashmiri', + 'nativeName' => 'कश्मीरी, كشميري‎', + ], + 'kk' => [ + 'isoName' => 'Kazakh', + 'nativeName' => 'қазақ тілі', + ], + 'km' => [ + 'isoName' => 'Central Khmer', + 'nativeName' => 'ខ្មែរ, ខេមរភាសា, ភាសាខ្មែរ', + ], + 'ki' => [ + 'isoName' => 'Kikuyu, Gikuyu', + 'nativeName' => 'Gĩkũyũ', + ], + 'rw' => [ + 'isoName' => 'Kinyarwanda', + 'nativeName' => 'Ikinyarwanda', + ], + 'ky' => [ + 'isoName' => 'Kirghiz, Kyrgyz', + 'nativeName' => 'Кыргызча, Кыргыз тили', + ], + 'kv' => [ + 'isoName' => 'Komi', + 'nativeName' => 'коми кыв', + ], + 'kg' => [ + 'isoName' => 'Kongo', + 'nativeName' => 'Kikongo', + ], + 'ko' => [ + 'isoName' => 'Korean', + 'nativeName' => '한국어', + ], + 'ku' => [ + 'isoName' => 'Kurdish', + 'nativeName' => 'Kurdî, کوردی‎', + ], + 'kj' => [ + 'isoName' => 'Kuanyama, Kwanyama', + 'nativeName' => 'Kuanyama', + ], + 'la' => [ + 'isoName' => 'Latin', + 'nativeName' => 'latine, lingua latina', + ], + 'lb' => [ + 'isoName' => 'Luxembourgish, Letzeburgesch', + 'nativeName' => 'Lëtzebuergesch', + ], + 'lg' => [ + 'isoName' => 'Ganda', + 'nativeName' => 'Luganda', + ], + 'li' => [ + 'isoName' => 'Limburgan, Limburger, Limburgish', + 'nativeName' => 'Limburgs', + ], + 'ln' => [ + 'isoName' => 'Lingala', + 'nativeName' => 'Lingála', + ], + 'lo' => [ + 'isoName' => 'Lao', + 'nativeName' => 'ພາສາລາວ', + ], + 'lt' => [ + 'isoName' => 'Lithuanian', + 'nativeName' => 'lietuvių kalba', + ], + 'lu' => [ + 'isoName' => 'Luba-Katanga', + 'nativeName' => 'Kiluba', + ], + 'lv' => [ + 'isoName' => 'Latvian', + 'nativeName' => 'latviešu valoda', + ], + 'gv' => [ + 'isoName' => 'Manx', + 'nativeName' => 'Gaelg, Gailck', + ], + 'mk' => [ + 'isoName' => 'Macedonian', + 'nativeName' => 'македонски јазик', + ], + 'mg' => [ + 'isoName' => 'Malagasy', + 'nativeName' => 'fiteny malagasy', + ], + 'ms' => [ + 'isoName' => 'Malay', + 'nativeName' => 'Bahasa Melayu, بهاس ملايو‎', + ], + 'ml' => [ + 'isoName' => 'Malayalam', + 'nativeName' => 'മലയാളം', + ], + 'mt' => [ + 'isoName' => 'Maltese', + 'nativeName' => 'Malti', + ], + 'mi' => [ + 'isoName' => 'Maori', + 'nativeName' => 'te reo Māori', + ], + 'mr' => [ + 'isoName' => 'Marathi', + 'nativeName' => 'मराठी', + ], + 'mh' => [ + 'isoName' => 'Marshallese', + 'nativeName' => 'Kajin M̧ajeļ', + ], + 'mn' => [ + 'isoName' => 'Mongolian', + 'nativeName' => 'Монгол хэл', + ], + 'na' => [ + 'isoName' => 'Nauru', + 'nativeName' => 'Dorerin Naoero', + ], + 'nv' => [ + 'isoName' => 'Navajo, Navaho', + 'nativeName' => 'Diné bizaad', + ], + 'nd' => [ + 'isoName' => 'North Ndebele', + 'nativeName' => 'isiNdebele', + ], + 'ne' => [ + 'isoName' => 'Nepali', + 'nativeName' => 'नेपाली', + ], + 'ng' => [ + 'isoName' => 'Ndonga', + 'nativeName' => 'Owambo', + ], + 'nb' => [ + 'isoName' => 'Norwegian Bokmål', + 'nativeName' => 'Norsk Bokmål', + ], + 'nn' => [ + 'isoName' => 'Norwegian Nynorsk', + 'nativeName' => 'Norsk Nynorsk', + ], + 'no' => [ + 'isoName' => 'Norwegian', + 'nativeName' => 'Norsk', + ], + 'ii' => [ + 'isoName' => 'Sichuan Yi, Nuosu', + 'nativeName' => 'ꆈꌠ꒿ Nuosuhxop', + ], + 'nr' => [ + 'isoName' => 'South Ndebele', + 'nativeName' => 'isiNdebele', + ], + 'oc' => [ + 'isoName' => 'Occitan', + 'nativeName' => 'occitan, lenga d\'òc', + ], + 'oj' => [ + 'isoName' => 'Ojibwa', + 'nativeName' => 'ᐊᓂᔑᓈᐯᒧᐎᓐ', + ], + 'cu' => [ + 'isoName' => 'Church Slavic, Church Slavonic, Old Church Slavonic, Old Slavonic, Old Bulgarian', + 'nativeName' => 'ѩзыкъ словѣньскъ', + ], + 'om' => [ + 'isoName' => 'Oromo', + 'nativeName' => 'Afaan Oromoo', + ], + 'or' => [ + 'isoName' => 'Oriya', + 'nativeName' => 'ଓଡ଼ିଆ', + ], + 'os' => [ + 'isoName' => 'Ossetian, Ossetic', + 'nativeName' => 'ирон æвзаг', + ], + 'pa' => [ + 'isoName' => 'Panjabi, Punjabi', + 'nativeName' => 'ਪੰਜਾਬੀ', + ], + 'pi' => [ + 'isoName' => 'Pali', + 'nativeName' => 'पाऴि', + ], + 'fa' => [ + 'isoName' => 'Persian', + 'nativeName' => 'فارسی', + ], + 'pl' => [ + 'isoName' => 'Polish', + 'nativeName' => 'język polski, polszczyzna', + ], + 'ps' => [ + 'isoName' => 'Pashto, Pushto', + 'nativeName' => 'پښتو', + ], + 'pt' => [ + 'isoName' => 'Portuguese', + 'nativeName' => 'Português', + ], + 'qu' => [ + 'isoName' => 'Quechua', + 'nativeName' => 'Runa Simi, Kichwa', + ], + 'rm' => [ + 'isoName' => 'Romansh', + 'nativeName' => 'Rumantsch Grischun', + ], + 'rn' => [ + 'isoName' => 'Rundi', + 'nativeName' => 'Ikirundi', + ], + 'ro' => [ + 'isoName' => 'Romanian, Moldavian, Moldovan', + 'nativeName' => 'Română', + ], + 'ru' => [ + 'isoName' => 'Russian', + 'nativeName' => 'русский', + ], + 'sa' => [ + 'isoName' => 'Sanskrit', + 'nativeName' => 'संस्कृतम्', + ], + 'sc' => [ + 'isoName' => 'Sardinian', + 'nativeName' => 'sardu', + ], + 'sd' => [ + 'isoName' => 'Sindhi', + 'nativeName' => 'सिन्धी, سنڌي، سندھی‎', + ], + 'se' => [ + 'isoName' => 'Northern Sami', + 'nativeName' => 'Davvisámegiella', + ], + 'sm' => [ + 'isoName' => 'Samoan', + 'nativeName' => 'gagana fa\'a Samoa', + ], + 'sg' => [ + 'isoName' => 'Sango', + 'nativeName' => 'yângâ tî sängö', + ], + 'sr' => [ + 'isoName' => 'Serbian', + 'nativeName' => 'српски језик', + ], + 'gd' => [ + 'isoName' => 'Gaelic, Scottish Gaelic', + 'nativeName' => 'Gàidhlig', + ], + 'sn' => [ + 'isoName' => 'Shona', + 'nativeName' => 'chiShona', + ], + 'si' => [ + 'isoName' => 'Sinhala, Sinhalese', + 'nativeName' => 'සිංහල', + ], + 'sk' => [ + 'isoName' => 'Slovak', + 'nativeName' => 'Slovenčina, Slovenský Jazyk', + ], + 'sl' => [ + 'isoName' => 'Slovene', + 'nativeName' => 'Slovenski Jezik, Slovenščina', + ], + 'so' => [ + 'isoName' => 'Somali', + 'nativeName' => 'Soomaaliga, af Soomaali', + ], + 'st' => [ + 'isoName' => 'Southern Sotho', + 'nativeName' => 'Sesotho', + ], + 'es' => [ + 'isoName' => 'Spanish, Castilian', + 'nativeName' => 'Español', + ], + 'su' => [ + 'isoName' => 'Sundanese', + 'nativeName' => 'Basa Sunda', + ], + 'sw' => [ + 'isoName' => 'Swahili', + 'nativeName' => 'Kiswahili', + ], + 'ss' => [ + 'isoName' => 'Swati', + 'nativeName' => 'SiSwati', + ], + 'sv' => [ + 'isoName' => 'Swedish', + 'nativeName' => 'Svenska', + ], + 'ta' => [ + 'isoName' => 'Tamil', + 'nativeName' => 'தமிழ்', + ], + 'te' => [ + 'isoName' => 'Telugu', + 'nativeName' => 'తెలుగు', + ], + 'tg' => [ + 'isoName' => 'Tajik', + 'nativeName' => 'тоҷикӣ, toçikī, تاجیکی‎', + ], + 'th' => [ + 'isoName' => 'Thai', + 'nativeName' => 'ไทย', + ], + 'ti' => [ + 'isoName' => 'Tigrinya', + 'nativeName' => 'ትግርኛ', + ], + 'bo' => [ + 'isoName' => 'Tibetan', + 'nativeName' => 'བོད་ཡིག', + ], + 'tk' => [ + 'isoName' => 'Turkmen', + 'nativeName' => 'Türkmen, Түркмен', + ], + 'tl' => [ + 'isoName' => 'Tagalog', + 'nativeName' => 'Wikang Tagalog', + ], + 'tn' => [ + 'isoName' => 'Tswana', + 'nativeName' => 'Setswana', + ], + 'to' => [ + 'isoName' => 'Tongan (Tonga Islands)', + 'nativeName' => 'Faka Tonga', + ], + 'tr' => [ + 'isoName' => 'Turkish', + 'nativeName' => 'Türkçe', + ], + 'ts' => [ + 'isoName' => 'Tsonga', + 'nativeName' => 'Xitsonga', + ], + 'tt' => [ + 'isoName' => 'Tatar', + 'nativeName' => 'татар теле, tatar tele', + ], + 'tw' => [ + 'isoName' => 'Twi', + 'nativeName' => 'Twi', + ], + 'ty' => [ + 'isoName' => 'Tahitian', + 'nativeName' => 'Reo Tahiti', + ], + 'ug' => [ + 'isoName' => 'Uighur, Uyghur', + 'nativeName' => 'Uyƣurqə, ‫ئۇيغۇرچ', + ], + 'uk' => [ + 'isoName' => 'Ukrainian', + 'nativeName' => 'Українська', + ], + 'ur' => [ + 'isoName' => 'Urdu', + 'nativeName' => 'اردو', + ], + 'uz' => [ + 'isoName' => 'Uzbek', + 'nativeName' => 'Oʻzbek, Ўзбек, أۇزبېك‎', + ], + 've' => [ + 'isoName' => 'Venda', + 'nativeName' => 'Tshivenḓa', + ], + 'vi' => [ + 'isoName' => 'Vietnamese', + 'nativeName' => 'Tiếng Việt', + ], + 'vo' => [ + 'isoName' => 'Volapük', + 'nativeName' => 'Volapük', + ], + 'wa' => [ + 'isoName' => 'Walloon', + 'nativeName' => 'Walon', + ], + 'cy' => [ + 'isoName' => 'Welsh', + 'nativeName' => 'Cymraeg', + ], + 'wo' => [ + 'isoName' => 'Wolof', + 'nativeName' => 'Wollof', + ], + 'fy' => [ + 'isoName' => 'Western Frisian', + 'nativeName' => 'Frysk', + ], + 'xh' => [ + 'isoName' => 'Xhosa', + 'nativeName' => 'isiXhosa', + ], + 'yi' => [ + 'isoName' => 'Yiddish', + 'nativeName' => 'ייִדיש', + ], + 'yo' => [ + 'isoName' => 'Yoruba', + 'nativeName' => 'Yorùbá', + ], + 'za' => [ + 'isoName' => 'Zhuang, Chuang', + 'nativeName' => 'Saɯ cueŋƅ, Saw cuengh', + ], + 'zu' => [ + 'isoName' => 'Zulu', + 'nativeName' => 'isiZulu', + ], + /* + * Add ISO 639-3 languages available in Carbon + */ + 'agq' => [ + 'isoName' => 'Aghem', + 'nativeName' => 'Aghem', + ], + 'agr' => [ + 'isoName' => 'Aguaruna', + 'nativeName' => 'Aguaruna', + ], + 'anp' => [ + 'isoName' => 'Angika', + 'nativeName' => 'Angika', + ], + 'asa' => [ + 'isoName' => 'Asu', + 'nativeName' => 'Asu', + ], + 'ast' => [ + 'isoName' => 'Asturian', + 'nativeName' => 'Asturian', + ], + 'ayc' => [ + 'isoName' => 'Southern Aymara', + 'nativeName' => 'Southern Aymara', + ], + 'bas' => [ + 'isoName' => 'Basaa', + 'nativeName' => 'Basaa', + ], + 'bem' => [ + 'isoName' => 'Bemba', + 'nativeName' => 'Bemba', + ], + 'bez' => [ + 'isoName' => 'Bena', + 'nativeName' => 'Bena', + ], + 'bhb' => [ + 'isoName' => 'Bhili', + 'nativeName' => 'Bhili', + ], + 'bho' => [ + 'isoName' => 'Bhojpuri', + 'nativeName' => 'Bhojpuri', + ], + 'brx' => [ + 'isoName' => 'Bodo', + 'nativeName' => 'Bodo', + ], + 'byn' => [ + 'isoName' => 'Bilin', + 'nativeName' => 'Bilin', + ], + 'ccp' => [ + 'isoName' => 'Chakma', + 'nativeName' => 'Chakma', + ], + 'cgg' => [ + 'isoName' => 'Chiga', + 'nativeName' => 'Chiga', + ], + 'chr' => [ + 'isoName' => 'Cherokee', + 'nativeName' => 'Cherokee', + ], + 'cmn' => [ + 'isoName' => 'Chinese', + 'nativeName' => 'Chinese', + ], + 'crh' => [ + 'isoName' => 'Crimean Turkish', + 'nativeName' => 'Crimean Turkish', + ], + 'csb' => [ + 'isoName' => 'Kashubian', + 'nativeName' => 'Kashubian', + ], + 'dav' => [ + 'isoName' => 'Taita', + 'nativeName' => 'Taita', + ], + 'dje' => [ + 'isoName' => 'Zarma', + 'nativeName' => 'Zarma', + ], + 'doi' => [ + 'isoName' => 'Dogri (macrolanguage)', + 'nativeName' => 'Dogri (macrolanguage)', + ], + 'dsb' => [ + 'isoName' => 'Lower Sorbian', + 'nativeName' => 'Lower Sorbian', + ], + 'dua' => [ + 'isoName' => 'Duala', + 'nativeName' => 'Duala', + ], + 'dyo' => [ + 'isoName' => 'Jola-Fonyi', + 'nativeName' => 'Jola-Fonyi', + ], + 'ebu' => [ + 'isoName' => 'Embu', + 'nativeName' => 'Embu', + ], + 'ewo' => [ + 'isoName' => 'Ewondo', + 'nativeName' => 'Ewondo', + ], + 'fil' => [ + 'isoName' => 'Filipino', + 'nativeName' => 'Filipino', + ], + 'fur' => [ + 'isoName' => 'Friulian', + 'nativeName' => 'Friulian', + ], + 'gez' => [ + 'isoName' => 'Geez', + 'nativeName' => 'Geez', + ], + 'gom' => [ + 'isoName' => 'Konkani, Goan', + 'nativeName' => 'ಕೊಂಕಣಿ', + ], + 'gsw' => [ + 'isoName' => 'Swiss German', + 'nativeName' => 'Swiss German', + ], + 'guz' => [ + 'isoName' => 'Gusii', + 'nativeName' => 'Gusii', + ], + 'hak' => [ + 'isoName' => 'Hakka Chinese', + 'nativeName' => 'Hakka Chinese', + ], + 'haw' => [ + 'isoName' => 'Hawaiian', + 'nativeName' => 'Hawaiian', + ], + 'hif' => [ + 'isoName' => 'Fiji Hindi', + 'nativeName' => 'Fiji Hindi', + ], + 'hne' => [ + 'isoName' => 'Chhattisgarhi', + 'nativeName' => 'Chhattisgarhi', + ], + 'hsb' => [ + 'isoName' => 'Upper Sorbian', + 'nativeName' => 'Upper Sorbian', + ], + 'jgo' => [ + 'isoName' => 'Ngomba', + 'nativeName' => 'Ngomba', + ], + 'jmc' => [ + 'isoName' => 'Machame', + 'nativeName' => 'Machame', + ], + 'kab' => [ + 'isoName' => 'Kabyle', + 'nativeName' => 'Kabyle', + ], + 'kam' => [ + 'isoName' => 'Kamba', + 'nativeName' => 'Kamba', + ], + 'kde' => [ + 'isoName' => 'Makonde', + 'nativeName' => 'Makonde', + ], + 'kea' => [ + 'isoName' => 'Kabuverdianu', + 'nativeName' => 'Kabuverdianu', + ], + 'khq' => [ + 'isoName' => 'Koyra Chiini', + 'nativeName' => 'Koyra Chiini', + ], + 'kkj' => [ + 'isoName' => 'Kako', + 'nativeName' => 'Kako', + ], + 'kln' => [ + 'isoName' => 'Kalenjin', + 'nativeName' => 'Kalenjin', + ], + 'kok' => [ + 'isoName' => 'Konkani', + 'nativeName' => 'Konkani', + ], + 'ksb' => [ + 'isoName' => 'Shambala', + 'nativeName' => 'Shambala', + ], + 'ksf' => [ + 'isoName' => 'Bafia', + 'nativeName' => 'Bafia', + ], + 'ksh' => [ + 'isoName' => 'Colognian', + 'nativeName' => 'Colognian', + ], + 'lag' => [ + 'isoName' => 'Langi', + 'nativeName' => 'Langi', + ], + 'lij' => [ + 'isoName' => 'Ligurian', + 'nativeName' => 'Ligurian', + ], + 'lkt' => [ + 'isoName' => 'Lakota', + 'nativeName' => 'Lakota', + ], + 'lrc' => [ + 'isoName' => 'Northern Luri', + 'nativeName' => 'Northern Luri', + ], + 'luo' => [ + 'isoName' => 'Luo', + 'nativeName' => 'Luo', + ], + 'luy' => [ + 'isoName' => 'Luyia', + 'nativeName' => 'Luyia', + ], + 'lzh' => [ + 'isoName' => 'Literary Chinese', + 'nativeName' => 'Literary Chinese', + ], + 'mag' => [ + 'isoName' => 'Magahi', + 'nativeName' => 'Magahi', + ], + 'mai' => [ + 'isoName' => 'Maithili', + 'nativeName' => 'Maithili', + ], + 'mas' => [ + 'isoName' => 'Masai', + 'nativeName' => 'Masai', + ], + 'mer' => [ + 'isoName' => 'Meru', + 'nativeName' => 'Meru', + ], + 'mfe' => [ + 'isoName' => 'Morisyen', + 'nativeName' => 'Morisyen', + ], + 'mgh' => [ + 'isoName' => 'Makhuwa-Meetto', + 'nativeName' => 'Makhuwa-Meetto', + ], + 'mgo' => [ + 'isoName' => 'Metaʼ', + 'nativeName' => 'Metaʼ', + ], + 'mhr' => [ + 'isoName' => 'Eastern Mari', + 'nativeName' => 'Eastern Mari', + ], + 'miq' => [ + 'isoName' => 'Mískito', + 'nativeName' => 'Mískito', + ], + 'mjw' => [ + 'isoName' => 'Karbi', + 'nativeName' => 'Karbi', + ], + 'mni' => [ + 'isoName' => 'Manipuri', + 'nativeName' => 'Manipuri', + ], + 'mua' => [ + 'isoName' => 'Mundang', + 'nativeName' => 'Mundang', + ], + 'mzn' => [ + 'isoName' => 'Mazanderani', + 'nativeName' => 'Mazanderani', + ], + 'nan' => [ + 'isoName' => 'Min Nan Chinese', + 'nativeName' => 'Min Nan Chinese', + ], + 'naq' => [ + 'isoName' => 'Nama', + 'nativeName' => 'Nama', + ], + 'nds' => [ + 'isoName' => 'Low German', + 'nativeName' => 'Low German', + ], + 'nhn' => [ + 'isoName' => 'Central Nahuatl', + 'nativeName' => 'Central Nahuatl', + ], + 'niu' => [ + 'isoName' => 'Niuean', + 'nativeName' => 'Niuean', + ], + 'nmg' => [ + 'isoName' => 'Kwasio', + 'nativeName' => 'Kwasio', + ], + 'nnh' => [ + 'isoName' => 'Ngiemboon', + 'nativeName' => 'Ngiemboon', + ], + 'nso' => [ + 'isoName' => 'Northern Sotho', + 'nativeName' => 'Northern Sotho', + ], + 'nus' => [ + 'isoName' => 'Nuer', + 'nativeName' => 'Nuer', + ], + 'nyn' => [ + 'isoName' => 'Nyankole', + 'nativeName' => 'Nyankole', + ], + 'pap' => [ + 'isoName' => 'Papiamento', + 'nativeName' => 'Papiamento', + ], + 'prg' => [ + 'isoName' => 'Prussian', + 'nativeName' => 'Prussian', + ], + 'quz' => [ + 'isoName' => 'Cusco Quechua', + 'nativeName' => 'Cusco Quechua', + ], + 'raj' => [ + 'isoName' => 'Rajasthani', + 'nativeName' => 'Rajasthani', + ], + 'rof' => [ + 'isoName' => 'Rombo', + 'nativeName' => 'Rombo', + ], + 'rwk' => [ + 'isoName' => 'Rwa', + 'nativeName' => 'Rwa', + ], + 'sah' => [ + 'isoName' => 'Sakha', + 'nativeName' => 'Sakha', + ], + 'saq' => [ + 'isoName' => 'Samburu', + 'nativeName' => 'Samburu', + ], + 'sat' => [ + 'isoName' => 'Santali', + 'nativeName' => 'Santali', + ], + 'sbp' => [ + 'isoName' => 'Sangu', + 'nativeName' => 'Sangu', + ], + 'scr' => [ + 'isoName' => 'Serbo Croatian', + 'nativeName' => 'Serbo Croatian', + ], + 'seh' => [ + 'isoName' => 'Sena', + 'nativeName' => 'Sena', + ], + 'ses' => [ + 'isoName' => 'Koyraboro Senni', + 'nativeName' => 'Koyraboro Senni', + ], + 'sgs' => [ + 'isoName' => 'Samogitian', + 'nativeName' => 'Samogitian', + ], + 'shi' => [ + 'isoName' => 'Tachelhit', + 'nativeName' => 'Tachelhit', + ], + 'shn' => [ + 'isoName' => 'Shan', + 'nativeName' => 'Shan', + ], + 'shs' => [ + 'isoName' => 'Shuswap', + 'nativeName' => 'Shuswap', + ], + 'sid' => [ + 'isoName' => 'Sidamo', + 'nativeName' => 'Sidamo', + ], + 'smn' => [ + 'isoName' => 'Inari Sami', + 'nativeName' => 'Inari Sami', + ], + 'szl' => [ + 'isoName' => 'Silesian', + 'nativeName' => 'Silesian', + ], + 'tcy' => [ + 'isoName' => 'Tulu', + 'nativeName' => 'Tulu', + ], + 'teo' => [ + 'isoName' => 'Teso', + 'nativeName' => 'Teso', + ], + 'tet' => [ + 'isoName' => 'Tetum', + 'nativeName' => 'Tetum', + ], + 'the' => [ + 'isoName' => 'Chitwania Tharu', + 'nativeName' => 'Chitwania Tharu', + ], + 'tig' => [ + 'isoName' => 'Tigre', + 'nativeName' => 'Tigre', + ], + 'tlh' => [ + 'isoName' => 'Klingon', + 'nativeName' => 'tlhIngan Hol', + ], + 'tpi' => [ + 'isoName' => 'Tok Pisin', + 'nativeName' => 'Tok Pisin', + ], + 'twq' => [ + 'isoName' => 'Tasawaq', + 'nativeName' => 'Tasawaq', + ], + 'tzl' => [ + 'isoName' => 'Talossan', + 'nativeName' => 'Talossan', + ], + 'tzm' => [ + 'isoName' => 'Tamazight, Central Atlas', + 'nativeName' => 'ⵜⵎⴰⵣⵉⵖⵜ', + ], + 'unm' => [ + 'isoName' => 'Unami', + 'nativeName' => 'Unami', + ], + 'vai' => [ + 'isoName' => 'Vai', + 'nativeName' => 'Vai', + ], + 'vun' => [ + 'isoName' => 'Vunjo', + 'nativeName' => 'Vunjo', + ], + 'wae' => [ + 'isoName' => 'Walser', + 'nativeName' => 'Walser', + ], + 'wal' => [ + 'isoName' => 'Wolaytta', + 'nativeName' => 'Wolaytta', + ], + 'xog' => [ + 'isoName' => 'Soga', + 'nativeName' => 'Soga', + ], + 'yav' => [ + 'isoName' => 'Yangben', + 'nativeName' => 'Yangben', + ], + 'yue' => [ + 'isoName' => 'Cantonese', + 'nativeName' => 'Cantonese', + ], + 'yuw' => [ + 'isoName' => 'Yau (Morobe Province)', + 'nativeName' => 'Yau (Morobe Province)', + ], + 'zgh' => [ + 'isoName' => 'Standard Moroccan Tamazight', + 'nativeName' => 'Standard Moroccan Tamazight', + ], +]; diff --git a/vendor/nesbot/carbon/src/Carbon/List/regions.php b/vendor/nesbot/carbon/src/Carbon/List/regions.php new file mode 100644 index 00000000..8ab8a9e3 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/List/regions.php @@ -0,0 +1,265 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * ISO 3166-2 + */ +return [ + 'AD' => 'Andorra', + 'AE' => 'United Arab Emirates', + 'AF' => 'Afghanistan', + 'AG' => 'Antigua and Barbuda', + 'AI' => 'Anguilla', + 'AL' => 'Albania', + 'AM' => 'Armenia', + 'AO' => 'Angola', + 'AQ' => 'Antarctica', + 'AR' => 'Argentina', + 'AS' => 'American Samoa', + 'AT' => 'Austria', + 'AU' => 'Australia', + 'AW' => 'Aruba', + 'AX' => 'Åland Islands', + 'AZ' => 'Azerbaijan', + 'BA' => 'Bosnia and Herzegovina', + 'BB' => 'Barbados', + 'BD' => 'Bangladesh', + 'BE' => 'Belgium', + 'BF' => 'Burkina Faso', + 'BG' => 'Bulgaria', + 'BH' => 'Bahrain', + 'BI' => 'Burundi', + 'BJ' => 'Benin', + 'BL' => 'Saint Barthélemy', + 'BM' => 'Bermuda', + 'BN' => 'Brunei Darussalam', + 'BO' => 'Bolivia (Plurinational State of)', + 'BQ' => 'Bonaire, Sint Eustatius and Saba', + 'BR' => 'Brazil', + 'BS' => 'Bahamas', + 'BT' => 'Bhutan', + 'BV' => 'Bouvet Island', + 'BW' => 'Botswana', + 'BY' => 'Belarus', + 'BZ' => 'Belize', + 'CA' => 'Canada', + 'CC' => 'Cocos (Keeling) Islands', + 'CD' => 'Congo, Democratic Republic of the', + 'CF' => 'Central African Republic', + 'CG' => 'Congo', + 'CH' => 'Switzerland', + 'CI' => 'Côte d\'Ivoire', + 'CK' => 'Cook Islands', + 'CL' => 'Chile', + 'CM' => 'Cameroon', + 'CN' => 'China', + 'CO' => 'Colombia', + 'CR' => 'Costa Rica', + 'CU' => 'Cuba', + 'CV' => 'Cabo Verde', + 'CW' => 'Curaçao', + 'CX' => 'Christmas Island', + 'CY' => 'Cyprus', + 'CZ' => 'Czechia', + 'DE' => 'Germany', + 'DJ' => 'Djibouti', + 'DK' => 'Denmark', + 'DM' => 'Dominica', + 'DO' => 'Dominican Republic', + 'DZ' => 'Algeria', + 'EC' => 'Ecuador', + 'EE' => 'Estonia', + 'EG' => 'Egypt', + 'EH' => 'Western Sahara', + 'ER' => 'Eritrea', + 'ES' => 'Spain', + 'ET' => 'Ethiopia', + 'FI' => 'Finland', + 'FJ' => 'Fiji', + 'FK' => 'Falkland Islands (Malvinas)', + 'FM' => 'Micronesia (Federated States of)', + 'FO' => 'Faroe Islands', + 'FR' => 'France', + 'GA' => 'Gabon', + 'GB' => 'United Kingdom of Great Britain and Northern Ireland', + 'GD' => 'Grenada', + 'GE' => 'Georgia', + 'GF' => 'French Guiana', + 'GG' => 'Guernsey', + 'GH' => 'Ghana', + 'GI' => 'Gibraltar', + 'GL' => 'Greenland', + 'GM' => 'Gambia', + 'GN' => 'Guinea', + 'GP' => 'Guadeloupe', + 'GQ' => 'Equatorial Guinea', + 'GR' => 'Greece', + 'GS' => 'South Georgia and the South Sandwich Islands', + 'GT' => 'Guatemala', + 'GU' => 'Guam', + 'GW' => 'Guinea-Bissau', + 'GY' => 'Guyana', + 'HK' => 'Hong Kong', + 'HM' => 'Heard Island and McDonald Islands', + 'HN' => 'Honduras', + 'HR' => 'Croatia', + 'HT' => 'Haiti', + 'HU' => 'Hungary', + 'ID' => 'Indonesia', + 'IE' => 'Ireland', + 'IL' => 'Israel', + 'IM' => 'Isle of Man', + 'IN' => 'India', + 'IO' => 'British Indian Ocean Territory', + 'IQ' => 'Iraq', + 'IR' => 'Iran (Islamic Republic of)', + 'IS' => 'Iceland', + 'IT' => 'Italy', + 'JE' => 'Jersey', + 'JM' => 'Jamaica', + 'JO' => 'Jordan', + 'JP' => 'Japan', + 'KE' => 'Kenya', + 'KG' => 'Kyrgyzstan', + 'KH' => 'Cambodia', + 'KI' => 'Kiribati', + 'KM' => 'Comoros', + 'KN' => 'Saint Kitts and Nevis', + 'KP' => 'Korea (Democratic People\'s Republic of)', + 'KR' => 'Korea, Republic of', + 'KW' => 'Kuwait', + 'KY' => 'Cayman Islands', + 'KZ' => 'Kazakhstan', + 'LA' => 'Lao People\'s Democratic Republic', + 'LB' => 'Lebanon', + 'LC' => 'Saint Lucia', + 'LI' => 'Liechtenstein', + 'LK' => 'Sri Lanka', + 'LR' => 'Liberia', + 'LS' => 'Lesotho', + 'LT' => 'Lithuania', + 'LU' => 'Luxembourg', + 'LV' => 'Latvia', + 'LY' => 'Libya', + 'MA' => 'Morocco', + 'MC' => 'Monaco', + 'MD' => 'Moldova, Republic of', + 'ME' => 'Montenegro', + 'MF' => 'Saint Martin (French part)', + 'MG' => 'Madagascar', + 'MH' => 'Marshall Islands', + 'MK' => 'Macedonia, the former Yugoslav Republic of', + 'ML' => 'Mali', + 'MM' => 'Myanmar', + 'MN' => 'Mongolia', + 'MO' => 'Macao', + 'MP' => 'Northern Mariana Islands', + 'MQ' => 'Martinique', + 'MR' => 'Mauritania', + 'MS' => 'Montserrat', + 'MT' => 'Malta', + 'MU' => 'Mauritius', + 'MV' => 'Maldives', + 'MW' => 'Malawi', + 'MX' => 'Mexico', + 'MY' => 'Malaysia', + 'MZ' => 'Mozambique', + 'NA' => 'Namibia', + 'NC' => 'New Caledonia', + 'NE' => 'Niger', + 'NF' => 'Norfolk Island', + 'NG' => 'Nigeria', + 'NI' => 'Nicaragua', + 'NL' => 'Netherlands', + 'NO' => 'Norway', + 'NP' => 'Nepal', + 'NR' => 'Nauru', + 'NU' => 'Niue', + 'NZ' => 'New Zealand', + 'OM' => 'Oman', + 'PA' => 'Panama', + 'PE' => 'Peru', + 'PF' => 'French Polynesia', + 'PG' => 'Papua New Guinea', + 'PH' => 'Philippines', + 'PK' => 'Pakistan', + 'PL' => 'Poland', + 'PM' => 'Saint Pierre and Miquelon', + 'PN' => 'Pitcairn', + 'PR' => 'Puerto Rico', + 'PS' => 'Palestine, State of', + 'PT' => 'Portugal', + 'PW' => 'Palau', + 'PY' => 'Paraguay', + 'QA' => 'Qatar', + 'RE' => 'Réunion', + 'RO' => 'Romania', + 'RS' => 'Serbia', + 'RU' => 'Russian Federation', + 'RW' => 'Rwanda', + 'SA' => 'Saudi Arabia', + 'SB' => 'Solomon Islands', + 'SC' => 'Seychelles', + 'SD' => 'Sudan', + 'SE' => 'Sweden', + 'SG' => 'Singapore', + 'SH' => 'Saint Helena, Ascension and Tristan da Cunha', + 'SI' => 'Slovenia', + 'SJ' => 'Svalbard and Jan Mayen', + 'SK' => 'Slovakia', + 'SL' => 'Sierra Leone', + 'SM' => 'San Marino', + 'SN' => 'Senegal', + 'SO' => 'Somalia', + 'SR' => 'Suriname', + 'SS' => 'South Sudan', + 'ST' => 'Sao Tome and Principe', + 'SV' => 'El Salvador', + 'SX' => 'Sint Maarten (Dutch part)', + 'SY' => 'Syrian Arab Republic', + 'SZ' => 'Eswatini', + 'TC' => 'Turks and Caicos Islands', + 'TD' => 'Chad', + 'TF' => 'French Southern Territories', + 'TG' => 'Togo', + 'TH' => 'Thailand', + 'TJ' => 'Tajikistan', + 'TK' => 'Tokelau', + 'TL' => 'Timor-Leste', + 'TM' => 'Turkmenistan', + 'TN' => 'Tunisia', + 'TO' => 'Tonga', + 'TR' => 'Turkey', + 'TT' => 'Trinidad and Tobago', + 'TV' => 'Tuvalu', + 'TW' => 'Taiwan, Province of China', + 'TZ' => 'Tanzania, United Republic of', + 'UA' => 'Ukraine', + 'UG' => 'Uganda', + 'UM' => 'United States Minor Outlying Islands', + 'US' => 'United States of America', + 'UY' => 'Uruguay', + 'UZ' => 'Uzbekistan', + 'VA' => 'Holy See', + 'VC' => 'Saint Vincent and the Grenadines', + 'VE' => 'Venezuela (Bolivarian Republic of)', + 'VG' => 'Virgin Islands (British)', + 'VI' => 'Virgin Islands (U.S.)', + 'VN' => 'Viet Nam', + 'VU' => 'Vanuatu', + 'WF' => 'Wallis and Futuna', + 'WS' => 'Samoa', + 'YE' => 'Yemen', + 'YT' => 'Mayotte', + 'ZA' => 'South Africa', + 'ZM' => 'Zambia', + 'ZW' => 'Zimbabwe', +]; diff --git a/vendor/nesbot/carbon/src/Carbon/MessageFormatter/MessageFormatterMapper.php b/vendor/nesbot/carbon/src/Carbon/MessageFormatter/MessageFormatterMapper.php new file mode 100644 index 00000000..c0548087 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/MessageFormatter/MessageFormatterMapper.php @@ -0,0 +1,44 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\MessageFormatter; + +use ReflectionMethod; +use Symfony\Component\Translation\Formatter\MessageFormatter; +use Symfony\Component\Translation\Formatter\MessageFormatterInterface; + +// @codeCoverageIgnoreStart +$transMethod = new ReflectionMethod(MessageFormatterInterface::class, 'format'); + +require $transMethod->getParameters()[0]->hasType() + ? __DIR__.'/../../../lazy/Carbon/MessageFormatter/MessageFormatterMapperStrongType.php' + : __DIR__.'/../../../lazy/Carbon/MessageFormatter/MessageFormatterMapperWeakType.php'; +// @codeCoverageIgnoreEnd + +final class MessageFormatterMapper extends LazyMessageFormatter +{ + /** + * Wrapped formatter. + * + * @var MessageFormatterInterface + */ + protected $formatter; + + public function __construct(?MessageFormatterInterface $formatter = null) + { + $this->formatter = $formatter ?? new MessageFormatter(); + } + + protected function transformLocale(?string $locale): ?string + { + return $locale ? preg_replace('/[_@][A-Za-z][a-z]{2,}/', '', $locale) : $locale; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/PHPStan/AbstractMacro.php b/vendor/nesbot/carbon/src/Carbon/PHPStan/AbstractMacro.php new file mode 100644 index 00000000..fde67b36 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/PHPStan/AbstractMacro.php @@ -0,0 +1,286 @@ +<?php + +declare(strict_types=1); + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\PHPStan; + +use Closure; +use InvalidArgumentException; +use PHPStan\BetterReflection\Reflection\Adapter\ReflectionParameter as AdapterReflectionParameter; +use PHPStan\BetterReflection\Reflection\Adapter\ReflectionType as AdapterReflectionType; +use PHPStan\BetterReflection\Reflection\ReflectionClass as BetterReflectionClass; +use PHPStan\BetterReflection\Reflection\ReflectionFunction as BetterReflectionFunction; +use PHPStan\BetterReflection\Reflection\ReflectionParameter as BetterReflectionParameter; +use PHPStan\Reflection\Php\BuiltinMethodReflection; +use PHPStan\TrinaryLogic; +use ReflectionClass; +use ReflectionFunction; +use ReflectionMethod; +use ReflectionParameter; +use ReflectionType; +use stdClass; +use Throwable; + +abstract class AbstractMacro implements BuiltinMethodReflection +{ + /** + * The reflection function/method. + * + * @var ReflectionFunction|ReflectionMethod + */ + protected $reflectionFunction; + + /** + * The class name. + * + * @var class-string + */ + private $className; + + /** + * The method name. + * + * @var string + */ + private $methodName; + + /** + * The parameters. + * + * @var ReflectionParameter[] + */ + private $parameters; + + /** + * The is static. + * + * @var bool + */ + private $static = false; + + /** + * Macro constructor. + * + * @param class-string $className + * @param string $methodName + * @param callable $macro + */ + public function __construct(string $className, string $methodName, $macro) + { + $this->className = $className; + $this->methodName = $methodName; + $rawReflectionFunction = \is_array($macro) + ? new ReflectionMethod($macro[0], $macro[1]) + : new ReflectionFunction($macro); + $this->reflectionFunction = self::hasModernParser() + ? $this->getReflectionFunction($macro) + : $rawReflectionFunction; // @codeCoverageIgnore + $this->parameters = array_map( + function ($parameter) { + if ($parameter instanceof BetterReflectionParameter) { + return new AdapterReflectionParameter($parameter); + } + + return $parameter; // @codeCoverageIgnore + }, + $this->reflectionFunction->getParameters() + ); + + if ($rawReflectionFunction->isClosure()) { + try { + $closure = $rawReflectionFunction->getClosure(); + $boundClosure = Closure::bind($closure, new stdClass()); + $this->static = (!$boundClosure || (new ReflectionFunction($boundClosure))->getClosureThis() === null); + } catch (Throwable $e) { + $this->static = true; + } + } + } + + private function getReflectionFunction($spec) + { + if (\is_array($spec) && \count($spec) === 2 && \is_string($spec[1])) { + \assert($spec[1] !== ''); + + if (\is_object($spec[0])) { + return BetterReflectionClass::createFromInstance($spec[0]) + ->getMethod($spec[1]); + } + + return BetterReflectionClass::createFromName($spec[0]) + ->getMethod($spec[1]); + } + + if (\is_string($spec)) { + return BetterReflectionFunction::createFromName($spec); + } + + if ($spec instanceof Closure) { + return BetterReflectionFunction::createFromClosure($spec); + } + + throw new InvalidArgumentException('Could not create reflection from the spec given'); // @codeCoverageIgnore + } + + /** + * {@inheritdoc} + */ + public function getDeclaringClass(): ReflectionClass + { + return new ReflectionClass($this->className); + } + + /** + * {@inheritdoc} + */ + public function isPrivate(): bool + { + return false; + } + + /** + * {@inheritdoc} + */ + public function isPublic(): bool + { + return true; + } + + /** + * {@inheritdoc} + */ + public function isFinal(): bool + { + return false; + } + + /** + * {@inheritdoc} + */ + public function isInternal(): bool + { + return false; + } + + /** + * {@inheritdoc} + */ + public function isAbstract(): bool + { + return false; + } + + /** + * {@inheritdoc} + */ + public function isStatic(): bool + { + return $this->static; + } + + /** + * {@inheritdoc} + */ + public function getDocComment(): ?string + { + return $this->reflectionFunction->getDocComment() ?: null; + } + + /** + * {@inheritdoc} + */ + public function getName(): string + { + return $this->methodName; + } + + /** + * {@inheritdoc} + */ + public function getParameters(): array + { + return $this->parameters; + } + + /** + * {@inheritdoc} + */ + public function getReturnType(): ?ReflectionType + { + $type = $this->reflectionFunction->getReturnType(); + + if ($type instanceof ReflectionType) { + return $type; // @codeCoverageIgnore + } + + return self::adaptType($type); + } + + /** + * {@inheritdoc} + */ + public function isDeprecated(): TrinaryLogic + { + return TrinaryLogic::createFromBoolean( + $this->reflectionFunction->isDeprecated() || + preg_match('/@deprecated/i', $this->getDocComment() ?: '') + ); + } + + /** + * {@inheritdoc} + */ + public function isVariadic(): bool + { + return $this->reflectionFunction->isVariadic(); + } + + /** + * {@inheritdoc} + */ + public function getPrototype(): BuiltinMethodReflection + { + return $this; + } + + public function getTentativeReturnType(): ?ReflectionType + { + return null; + } + + public function returnsByReference(): TrinaryLogic + { + return TrinaryLogic::createNo(); + } + + private static function adaptType($type) + { + $method = method_exists(AdapterReflectionType::class, 'fromTypeOrNull') + ? 'fromTypeOrNull' + : 'fromReturnTypeOrNull'; // @codeCoverageIgnore + + return AdapterReflectionType::$method($type); + } + + private static function hasModernParser(): bool + { + static $modernParser = null; + + if ($modernParser !== null) { + return $modernParser; + } + + $modernParser = method_exists(AdapterReflectionType::class, 'fromTypeOrNull'); + + return $modernParser; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/PHPStan/Macro.php b/vendor/nesbot/carbon/src/Carbon/PHPStan/Macro.php new file mode 100644 index 00000000..de3e51f6 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/PHPStan/Macro.php @@ -0,0 +1,34 @@ +<?php + +declare(strict_types=1); + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\PHPStan; + +use PHPStan\BetterReflection\Reflection\Adapter; +use PHPStan\Reflection\Php\BuiltinMethodReflection; +use ReflectionMethod; + +$method = new ReflectionMethod(BuiltinMethodReflection::class, 'getReflection'); + +require $method->hasReturnType() && $method->getReturnType()->getName() === Adapter\ReflectionMethod::class + ? __DIR__.'/../../../lazy/Carbon/PHPStan/AbstractMacroStatic.php' + : __DIR__.'/../../../lazy/Carbon/PHPStan/AbstractMacroBuiltin.php'; + +$method = new ReflectionMethod(BuiltinMethodReflection::class, 'getFileName'); + +require $method->hasReturnType() + ? __DIR__.'/../../../lazy/Carbon/PHPStan/MacroStrongType.php' + : __DIR__.'/../../../lazy/Carbon/PHPStan/MacroWeakType.php'; + +final class Macro extends LazyMacro +{ +} diff --git a/vendor/nesbot/carbon/src/Carbon/PHPStan/MacroExtension.php b/vendor/nesbot/carbon/src/Carbon/PHPStan/MacroExtension.php new file mode 100644 index 00000000..2cd6fce5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/PHPStan/MacroExtension.php @@ -0,0 +1,88 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\PHPStan; + +use PHPStan\Reflection\Assertions; +use PHPStan\Reflection\ClassReflection; +use PHPStan\Reflection\MethodReflection; +use PHPStan\Reflection\MethodsClassReflectionExtension; +use PHPStan\Reflection\Php\PhpMethodReflectionFactory; +use PHPStan\Reflection\ReflectionProvider; +use PHPStan\Type\TypehintHelper; + +/** + * Class MacroExtension. + * + * @codeCoverageIgnore Pure PHPStan wrapper. + */ +final class MacroExtension implements MethodsClassReflectionExtension +{ + /** + * @var PhpMethodReflectionFactory + */ + protected $methodReflectionFactory; + + /** + * @var MacroScanner + */ + protected $scanner; + + /** + * Extension constructor. + * + * @param PhpMethodReflectionFactory $methodReflectionFactory + * @param ReflectionProvider $reflectionProvider + */ + public function __construct( + PhpMethodReflectionFactory $methodReflectionFactory, + ReflectionProvider $reflectionProvider + ) { + $this->scanner = new MacroScanner($reflectionProvider); + $this->methodReflectionFactory = $methodReflectionFactory; + } + + /** + * {@inheritdoc} + */ + public function hasMethod(ClassReflection $classReflection, string $methodName): bool + { + return $this->scanner->hasMethod($classReflection->getName(), $methodName); + } + + /** + * {@inheritdoc} + */ + public function getMethod(ClassReflection $classReflection, string $methodName): MethodReflection + { + $builtinMacro = $this->scanner->getMethod($classReflection->getName(), $methodName); + $supportAssertions = class_exists(Assertions::class); + + return $this->methodReflectionFactory->create( + $classReflection, + null, + $builtinMacro, + $classReflection->getActiveTemplateTypeMap(), + [], + TypehintHelper::decideTypeFromReflection($builtinMacro->getReturnType()), + null, + null, + $builtinMacro->isDeprecated()->yes(), + $builtinMacro->isInternal(), + $builtinMacro->isFinal(), + $supportAssertions ? null : $builtinMacro->getDocComment(), + $supportAssertions ? Assertions::createEmpty() : null, + null, + $builtinMacro->getDocComment(), + [] + ); + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/PHPStan/MacroScanner.php b/vendor/nesbot/carbon/src/Carbon/PHPStan/MacroScanner.php new file mode 100644 index 00000000..eb8957d4 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/PHPStan/MacroScanner.php @@ -0,0 +1,83 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\PHPStan; + +use Carbon\CarbonInterface; +use PHPStan\Reflection\ReflectionProvider; +use ReflectionClass; +use ReflectionException; + +final class MacroScanner +{ + /** + * @var \PHPStan\Reflection\ReflectionProvider + */ + private $reflectionProvider; + + /** + * MacroScanner constructor. + * + * @param \PHPStan\Reflection\ReflectionProvider $reflectionProvider + */ + public function __construct(ReflectionProvider $reflectionProvider) + { + $this->reflectionProvider = $reflectionProvider; + } + + /** + * Return true if the given pair class-method is a Carbon macro. + * + * @param class-string $className + * @param string $methodName + * + * @return bool + */ + public function hasMethod(string $className, string $methodName): bool + { + $classReflection = $this->reflectionProvider->getClass($className); + + if ( + $classReflection->getName() !== CarbonInterface::class && + !$classReflection->isSubclassOf(CarbonInterface::class) + ) { + return false; + } + + return \is_callable([$className, 'hasMacro']) && + $className::hasMacro($methodName); + } + + /** + * Return the Macro for a given pair class-method. + * + * @param class-string $className + * @param string $methodName + * + * @throws ReflectionException + * + * @return Macro + */ + public function getMethod(string $className, string $methodName): Macro + { + $reflectionClass = new ReflectionClass($className); + $property = $reflectionClass->getProperty('globalMacros'); + + $property->setAccessible(true); + $macro = $property->getValue()[$methodName]; + + return new Macro( + $className, + $methodName, + $macro + ); + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Boundaries.php b/vendor/nesbot/carbon/src/Carbon/Traits/Boundaries.php new file mode 100644 index 00000000..71bbb723 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Boundaries.php @@ -0,0 +1,443 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +use Carbon\Exceptions\UnknownUnitException; + +/** + * Trait Boundaries. + * + * startOf, endOf and derived method for each unit. + * + * Depends on the following properties: + * + * @property int $year + * @property int $month + * @property int $daysInMonth + * @property int $quarter + * + * Depends on the following methods: + * + * @method $this setTime(int $hour, int $minute, int $second = 0, int $microseconds = 0) + * @method $this setDate(int $year, int $month, int $day) + * @method $this addMonths(int $value = 1) + */ +trait Boundaries +{ + /** + * Resets the time to 00:00:00 start of day + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->startOfDay(); + * ``` + * + * @return static + */ + public function startOfDay() + { + return $this->setTime(0, 0, 0, 0); + } + + /** + * Resets the time to 23:59:59.999999 end of day + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->endOfDay(); + * ``` + * + * @return static + */ + public function endOfDay() + { + return $this->setTime(static::HOURS_PER_DAY - 1, static::MINUTES_PER_HOUR - 1, static::SECONDS_PER_MINUTE - 1, static::MICROSECONDS_PER_SECOND - 1); + } + + /** + * Resets the date to the first day of the month and the time to 00:00:00 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->startOfMonth(); + * ``` + * + * @return static + */ + public function startOfMonth() + { + return $this->setDate($this->year, $this->month, 1)->startOfDay(); + } + + /** + * Resets the date to end of the month and time to 23:59:59.999999 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->endOfMonth(); + * ``` + * + * @return static + */ + public function endOfMonth() + { + return $this->setDate($this->year, $this->month, $this->daysInMonth)->endOfDay(); + } + + /** + * Resets the date to the first day of the quarter and the time to 00:00:00 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->startOfQuarter(); + * ``` + * + * @return static + */ + public function startOfQuarter() + { + $month = ($this->quarter - 1) * static::MONTHS_PER_QUARTER + 1; + + return $this->setDate($this->year, $month, 1)->startOfDay(); + } + + /** + * Resets the date to end of the quarter and time to 23:59:59.999999 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->endOfQuarter(); + * ``` + * + * @return static + */ + public function endOfQuarter() + { + return $this->startOfQuarter()->addMonths(static::MONTHS_PER_QUARTER - 1)->endOfMonth(); + } + + /** + * Resets the date to the first day of the year and the time to 00:00:00 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->startOfYear(); + * ``` + * + * @return static + */ + public function startOfYear() + { + return $this->setDate($this->year, 1, 1)->startOfDay(); + } + + /** + * Resets the date to end of the year and time to 23:59:59.999999 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->endOfYear(); + * ``` + * + * @return static + */ + public function endOfYear() + { + return $this->setDate($this->year, 12, 31)->endOfDay(); + } + + /** + * Resets the date to the first day of the decade and the time to 00:00:00 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->startOfDecade(); + * ``` + * + * @return static + */ + public function startOfDecade() + { + $year = $this->year - $this->year % static::YEARS_PER_DECADE; + + return $this->setDate($year, 1, 1)->startOfDay(); + } + + /** + * Resets the date to end of the decade and time to 23:59:59.999999 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->endOfDecade(); + * ``` + * + * @return static + */ + public function endOfDecade() + { + $year = $this->year - $this->year % static::YEARS_PER_DECADE + static::YEARS_PER_DECADE - 1; + + return $this->setDate($year, 12, 31)->endOfDay(); + } + + /** + * Resets the date to the first day of the century and the time to 00:00:00 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->startOfCentury(); + * ``` + * + * @return static + */ + public function startOfCentury() + { + $year = $this->year - ($this->year - 1) % static::YEARS_PER_CENTURY; + + return $this->setDate($year, 1, 1)->startOfDay(); + } + + /** + * Resets the date to end of the century and time to 23:59:59.999999 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->endOfCentury(); + * ``` + * + * @return static + */ + public function endOfCentury() + { + $year = $this->year - 1 - ($this->year - 1) % static::YEARS_PER_CENTURY + static::YEARS_PER_CENTURY; + + return $this->setDate($year, 12, 31)->endOfDay(); + } + + /** + * Resets the date to the first day of the millennium and the time to 00:00:00 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->startOfMillennium(); + * ``` + * + * @return static + */ + public function startOfMillennium() + { + $year = $this->year - ($this->year - 1) % static::YEARS_PER_MILLENNIUM; + + return $this->setDate($year, 1, 1)->startOfDay(); + } + + /** + * Resets the date to end of the millennium and time to 23:59:59.999999 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->endOfMillennium(); + * ``` + * + * @return static + */ + public function endOfMillennium() + { + $year = $this->year - 1 - ($this->year - 1) % static::YEARS_PER_MILLENNIUM + static::YEARS_PER_MILLENNIUM; + + return $this->setDate($year, 12, 31)->endOfDay(); + } + + /** + * Resets the date to the first day of week (defined in $weekStartsAt) and the time to 00:00:00 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->startOfWeek() . "\n"; + * echo Carbon::parse('2018-07-25 12:45:16')->locale('ar')->startOfWeek() . "\n"; + * echo Carbon::parse('2018-07-25 12:45:16')->startOfWeek(Carbon::SUNDAY) . "\n"; + * ``` + * + * @param int $weekStartsAt optional start allow you to specify the day of week to use to start the week + * + * @return static + */ + public function startOfWeek($weekStartsAt = null) + { + return $this->subDays((7 + $this->dayOfWeek - ($weekStartsAt ?? $this->firstWeekDay)) % 7)->startOfDay(); + } + + /** + * Resets the date to end of week (defined in $weekEndsAt) and time to 23:59:59.999999 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->endOfWeek() . "\n"; + * echo Carbon::parse('2018-07-25 12:45:16')->locale('ar')->endOfWeek() . "\n"; + * echo Carbon::parse('2018-07-25 12:45:16')->endOfWeek(Carbon::SATURDAY) . "\n"; + * ``` + * + * @param int $weekEndsAt optional start allow you to specify the day of week to use to end the week + * + * @return static + */ + public function endOfWeek($weekEndsAt = null) + { + return $this->addDays((7 - $this->dayOfWeek + ($weekEndsAt ?? $this->lastWeekDay)) % 7)->endOfDay(); + } + + /** + * Modify to start of current hour, minutes and seconds become 0 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->startOfHour(); + * ``` + * + * @return static + */ + public function startOfHour() + { + return $this->setTime($this->hour, 0, 0, 0); + } + + /** + * Modify to end of current hour, minutes and seconds become 59 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->endOfHour(); + * ``` + * + * @return static + */ + public function endOfHour() + { + return $this->setTime($this->hour, static::MINUTES_PER_HOUR - 1, static::SECONDS_PER_MINUTE - 1, static::MICROSECONDS_PER_SECOND - 1); + } + + /** + * Modify to start of current minute, seconds become 0 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->startOfMinute(); + * ``` + * + * @return static + */ + public function startOfMinute() + { + return $this->setTime($this->hour, $this->minute, 0, 0); + } + + /** + * Modify to end of current minute, seconds become 59 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16')->endOfMinute(); + * ``` + * + * @return static + */ + public function endOfMinute() + { + return $this->setTime($this->hour, $this->minute, static::SECONDS_PER_MINUTE - 1, static::MICROSECONDS_PER_SECOND - 1); + } + + /** + * Modify to start of current second, microseconds become 0 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16.334455') + * ->startOfSecond() + * ->format('H:i:s.u'); + * ``` + * + * @return static + */ + public function startOfSecond() + { + return $this->setTime($this->hour, $this->minute, $this->second, 0); + } + + /** + * Modify to end of current second, microseconds become 999999 + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16.334455') + * ->endOfSecond() + * ->format('H:i:s.u'); + * ``` + * + * @return static + */ + public function endOfSecond() + { + return $this->setTime($this->hour, $this->minute, $this->second, static::MICROSECONDS_PER_SECOND - 1); + } + + /** + * Modify to start of current given unit. + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16.334455') + * ->startOf('month') + * ->endOf('week', Carbon::FRIDAY); + * ``` + * + * @param string $unit + * @param array<int, mixed> $params + * + * @return static + */ + public function startOf($unit, ...$params) + { + $ucfUnit = ucfirst(static::singularUnit($unit)); + $method = "startOf$ucfUnit"; + if (!method_exists($this, $method)) { + throw new UnknownUnitException($unit); + } + + return $this->$method(...$params); + } + + /** + * Modify to end of current given unit. + * + * @example + * ``` + * echo Carbon::parse('2018-07-25 12:45:16.334455') + * ->startOf('month') + * ->endOf('week', Carbon::FRIDAY); + * ``` + * + * @param string $unit + * @param array<int, mixed> $params + * + * @return static + */ + public function endOf($unit, ...$params) + { + $ucfUnit = ucfirst(static::singularUnit($unit)); + $method = "endOf$ucfUnit"; + if (!method_exists($this, $method)) { + throw new UnknownUnitException($unit); + } + + return $this->$method(...$params); + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Cast.php b/vendor/nesbot/carbon/src/Carbon/Traits/Cast.php new file mode 100644 index 00000000..5f7c7c01 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Cast.php @@ -0,0 +1,43 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +use Carbon\Exceptions\InvalidCastException; +use DateTimeInterface; + +/** + * Trait Cast. + * + * Utils to cast into an other class. + */ +trait Cast +{ + /** + * Cast the current instance into the given class. + * + * @param string $className The $className::instance() method will be called to cast the current object. + * + * @return DateTimeInterface + */ + public function cast(string $className) + { + if (!method_exists($className, 'instance')) { + if (is_a($className, DateTimeInterface::class, true)) { + return new $className($this->rawFormat('Y-m-d H:i:s.u'), $this->getTimezone()); + } + + throw new InvalidCastException("$className has not the instance() method needed to cast the date."); + } + + return $className::instance($this); + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Comparison.php b/vendor/nesbot/carbon/src/Carbon/Traits/Comparison.php new file mode 100644 index 00000000..daee19cc --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Comparison.php @@ -0,0 +1,1129 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +use BadMethodCallException; +use Carbon\CarbonInterface; +use Carbon\Exceptions\BadComparisonUnitException; +use InvalidArgumentException; + +/** + * Trait Comparison. + * + * Comparison utils and testers. All the following methods return booleans. + * nowWithSameTz + * + * Depends on the following methods: + * + * @method static resolveCarbon($date) + * @method static copy() + * @method static nowWithSameTz() + * @method static static yesterday($timezone = null) + * @method static static tomorrow($timezone = null) + */ +trait Comparison +{ + /** @var bool */ + protected $endOfTime = false; + + /** @var bool */ + protected $startOfTime = false; + + /** + * Determines if the instance is equal to another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->eq('2018-07-25 12:45:16'); // true + * Carbon::parse('2018-07-25 12:45:16')->eq(Carbon::parse('2018-07-25 12:45:16')); // true + * Carbon::parse('2018-07-25 12:45:16')->eq('2018-07-25 12:45:17'); // false + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see equalTo() + * + * @return bool + */ + public function eq($date): bool + { + return $this->equalTo($date); + } + + /** + * Determines if the instance is equal to another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->equalTo('2018-07-25 12:45:16'); // true + * Carbon::parse('2018-07-25 12:45:16')->equalTo(Carbon::parse('2018-07-25 12:45:16')); // true + * Carbon::parse('2018-07-25 12:45:16')->equalTo('2018-07-25 12:45:17'); // false + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @return bool + */ + public function equalTo($date): bool + { + $this->discourageNull($date); + $this->discourageBoolean($date); + + return $this == $this->resolveCarbon($date); + } + + /** + * Determines if the instance is not equal to another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->ne('2018-07-25 12:45:16'); // false + * Carbon::parse('2018-07-25 12:45:16')->ne(Carbon::parse('2018-07-25 12:45:16')); // false + * Carbon::parse('2018-07-25 12:45:16')->ne('2018-07-25 12:45:17'); // true + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see notEqualTo() + * + * @return bool + */ + public function ne($date): bool + { + return $this->notEqualTo($date); + } + + /** + * Determines if the instance is not equal to another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->notEqualTo('2018-07-25 12:45:16'); // false + * Carbon::parse('2018-07-25 12:45:16')->notEqualTo(Carbon::parse('2018-07-25 12:45:16')); // false + * Carbon::parse('2018-07-25 12:45:16')->notEqualTo('2018-07-25 12:45:17'); // true + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @return bool + */ + public function notEqualTo($date): bool + { + return !$this->equalTo($date); + } + + /** + * Determines if the instance is greater (after) than another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->gt('2018-07-25 12:45:15'); // true + * Carbon::parse('2018-07-25 12:45:16')->gt('2018-07-25 12:45:16'); // false + * Carbon::parse('2018-07-25 12:45:16')->gt('2018-07-25 12:45:17'); // false + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see greaterThan() + * + * @return bool + */ + public function gt($date): bool + { + return $this->greaterThan($date); + } + + /** + * Determines if the instance is greater (after) than another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->greaterThan('2018-07-25 12:45:15'); // true + * Carbon::parse('2018-07-25 12:45:16')->greaterThan('2018-07-25 12:45:16'); // false + * Carbon::parse('2018-07-25 12:45:16')->greaterThan('2018-07-25 12:45:17'); // false + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @return bool + */ + public function greaterThan($date): bool + { + $this->discourageNull($date); + $this->discourageBoolean($date); + + return $this > $this->resolveCarbon($date); + } + + /** + * Determines if the instance is greater (after) than another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->isAfter('2018-07-25 12:45:15'); // true + * Carbon::parse('2018-07-25 12:45:16')->isAfter('2018-07-25 12:45:16'); // false + * Carbon::parse('2018-07-25 12:45:16')->isAfter('2018-07-25 12:45:17'); // false + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see greaterThan() + * + * @return bool + */ + public function isAfter($date): bool + { + return $this->greaterThan($date); + } + + /** + * Determines if the instance is greater (after) than or equal to another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->gte('2018-07-25 12:45:15'); // true + * Carbon::parse('2018-07-25 12:45:16')->gte('2018-07-25 12:45:16'); // true + * Carbon::parse('2018-07-25 12:45:16')->gte('2018-07-25 12:45:17'); // false + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see greaterThanOrEqualTo() + * + * @return bool + */ + public function gte($date): bool + { + return $this->greaterThanOrEqualTo($date); + } + + /** + * Determines if the instance is greater (after) than or equal to another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->greaterThanOrEqualTo('2018-07-25 12:45:15'); // true + * Carbon::parse('2018-07-25 12:45:16')->greaterThanOrEqualTo('2018-07-25 12:45:16'); // true + * Carbon::parse('2018-07-25 12:45:16')->greaterThanOrEqualTo('2018-07-25 12:45:17'); // false + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @return bool + */ + public function greaterThanOrEqualTo($date): bool + { + $this->discourageNull($date); + $this->discourageBoolean($date); + + return $this >= $this->resolveCarbon($date); + } + + /** + * Determines if the instance is less (before) than another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->lt('2018-07-25 12:45:15'); // false + * Carbon::parse('2018-07-25 12:45:16')->lt('2018-07-25 12:45:16'); // false + * Carbon::parse('2018-07-25 12:45:16')->lt('2018-07-25 12:45:17'); // true + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see lessThan() + * + * @return bool + */ + public function lt($date): bool + { + return $this->lessThan($date); + } + + /** + * Determines if the instance is less (before) than another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->lessThan('2018-07-25 12:45:15'); // false + * Carbon::parse('2018-07-25 12:45:16')->lessThan('2018-07-25 12:45:16'); // false + * Carbon::parse('2018-07-25 12:45:16')->lessThan('2018-07-25 12:45:17'); // true + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @return bool + */ + public function lessThan($date): bool + { + $this->discourageNull($date); + $this->discourageBoolean($date); + + return $this < $this->resolveCarbon($date); + } + + /** + * Determines if the instance is less (before) than another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->isBefore('2018-07-25 12:45:15'); // false + * Carbon::parse('2018-07-25 12:45:16')->isBefore('2018-07-25 12:45:16'); // false + * Carbon::parse('2018-07-25 12:45:16')->isBefore('2018-07-25 12:45:17'); // true + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see lessThan() + * + * @return bool + */ + public function isBefore($date): bool + { + return $this->lessThan($date); + } + + /** + * Determines if the instance is less (before) or equal to another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->lte('2018-07-25 12:45:15'); // false + * Carbon::parse('2018-07-25 12:45:16')->lte('2018-07-25 12:45:16'); // true + * Carbon::parse('2018-07-25 12:45:16')->lte('2018-07-25 12:45:17'); // true + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see lessThanOrEqualTo() + * + * @return bool + */ + public function lte($date): bool + { + return $this->lessThanOrEqualTo($date); + } + + /** + * Determines if the instance is less (before) or equal to another + * + * @example + * ``` + * Carbon::parse('2018-07-25 12:45:16')->lessThanOrEqualTo('2018-07-25 12:45:15'); // false + * Carbon::parse('2018-07-25 12:45:16')->lessThanOrEqualTo('2018-07-25 12:45:16'); // true + * Carbon::parse('2018-07-25 12:45:16')->lessThanOrEqualTo('2018-07-25 12:45:17'); // true + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @return bool + */ + public function lessThanOrEqualTo($date): bool + { + $this->discourageNull($date); + $this->discourageBoolean($date); + + return $this <= $this->resolveCarbon($date); + } + + /** + * Determines if the instance is between two others. + * + * The third argument allow you to specify if bounds are included or not (true by default) + * but for when you including/excluding bounds may produce different results in your application, + * we recommend to use the explicit methods ->betweenIncluded() or ->betweenExcluded() instead. + * + * @example + * ``` + * Carbon::parse('2018-07-25')->between('2018-07-14', '2018-08-01'); // true + * Carbon::parse('2018-07-25')->between('2018-08-01', '2018-08-20'); // false + * Carbon::parse('2018-07-25')->between('2018-07-25', '2018-08-01'); // true + * Carbon::parse('2018-07-25')->between('2018-07-25', '2018-08-01', false); // false + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 + * @param bool $equal Indicates if an equal to comparison should be done + * + * @return bool + */ + public function between($date1, $date2, $equal = true): bool + { + $date1 = $this->resolveCarbon($date1); + $date2 = $this->resolveCarbon($date2); + + if ($date1->greaterThan($date2)) { + [$date1, $date2] = [$date2, $date1]; + } + + if ($equal) { + return $this >= $date1 && $this <= $date2; + } + + return $this > $date1 && $this < $date2; + } + + /** + * Determines if the instance is between two others, bounds included. + * + * @example + * ``` + * Carbon::parse('2018-07-25')->betweenIncluded('2018-07-14', '2018-08-01'); // true + * Carbon::parse('2018-07-25')->betweenIncluded('2018-08-01', '2018-08-20'); // false + * Carbon::parse('2018-07-25')->betweenIncluded('2018-07-25', '2018-08-01'); // true + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 + * + * @return bool + */ + public function betweenIncluded($date1, $date2): bool + { + return $this->between($date1, $date2, true); + } + + /** + * Determines if the instance is between two others, bounds excluded. + * + * @example + * ``` + * Carbon::parse('2018-07-25')->betweenExcluded('2018-07-14', '2018-08-01'); // true + * Carbon::parse('2018-07-25')->betweenExcluded('2018-08-01', '2018-08-20'); // false + * Carbon::parse('2018-07-25')->betweenExcluded('2018-07-25', '2018-08-01'); // false + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 + * + * @return bool + */ + public function betweenExcluded($date1, $date2): bool + { + return $this->between($date1, $date2, false); + } + + /** + * Determines if the instance is between two others + * + * @example + * ``` + * Carbon::parse('2018-07-25')->isBetween('2018-07-14', '2018-08-01'); // true + * Carbon::parse('2018-07-25')->isBetween('2018-08-01', '2018-08-20'); // false + * Carbon::parse('2018-07-25')->isBetween('2018-07-25', '2018-08-01'); // true + * Carbon::parse('2018-07-25')->isBetween('2018-07-25', '2018-08-01', false); // false + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 + * @param bool $equal Indicates if an equal to comparison should be done + * + * @return bool + */ + public function isBetween($date1, $date2, $equal = true): bool + { + return $this->between($date1, $date2, $equal); + } + + /** + * Determines if the instance is a weekday. + * + * @example + * ``` + * Carbon::parse('2019-07-14')->isWeekday(); // false + * Carbon::parse('2019-07-15')->isWeekday(); // true + * ``` + * + * @return bool + */ + public function isWeekday() + { + return !$this->isWeekend(); + } + + /** + * Determines if the instance is a weekend day. + * + * @example + * ``` + * Carbon::parse('2019-07-14')->isWeekend(); // true + * Carbon::parse('2019-07-15')->isWeekend(); // false + * ``` + * + * @return bool + */ + public function isWeekend() + { + return \in_array($this->dayOfWeek, static::$weekendDays, true); + } + + /** + * Determines if the instance is yesterday. + * + * @example + * ``` + * Carbon::yesterday()->isYesterday(); // true + * Carbon::tomorrow()->isYesterday(); // false + * ``` + * + * @return bool + */ + public function isYesterday() + { + return $this->toDateString() === static::yesterday($this->getTimezone())->toDateString(); + } + + /** + * Determines if the instance is today. + * + * @example + * ``` + * Carbon::today()->isToday(); // true + * Carbon::tomorrow()->isToday(); // false + * ``` + * + * @return bool + */ + public function isToday() + { + return $this->toDateString() === $this->nowWithSameTz()->toDateString(); + } + + /** + * Determines if the instance is tomorrow. + * + * @example + * ``` + * Carbon::tomorrow()->isTomorrow(); // true + * Carbon::yesterday()->isTomorrow(); // false + * ``` + * + * @return bool + */ + public function isTomorrow() + { + return $this->toDateString() === static::tomorrow($this->getTimezone())->toDateString(); + } + + /** + * Determines if the instance is in the future, ie. greater (after) than now. + * + * @example + * ``` + * Carbon::now()->addHours(5)->isFuture(); // true + * Carbon::now()->subHours(5)->isFuture(); // false + * ``` + * + * @return bool + */ + public function isFuture() + { + return $this->greaterThan($this->nowWithSameTz()); + } + + /** + * Determines if the instance is in the past, ie. less (before) than now. + * + * @example + * ``` + * Carbon::now()->subHours(5)->isPast(); // true + * Carbon::now()->addHours(5)->isPast(); // false + * ``` + * + * @return bool + */ + public function isPast() + { + return $this->lessThan($this->nowWithSameTz()); + } + + /** + * Determines if the instance is a leap year. + * + * @example + * ``` + * Carbon::parse('2020-01-01')->isLeapYear(); // true + * Carbon::parse('2019-01-01')->isLeapYear(); // false + * ``` + * + * @return bool + */ + public function isLeapYear() + { + return $this->rawFormat('L') === '1'; + } + + /** + * Determines if the instance is a long year (using calendar year). + * + * ⚠️ This method completely ignores month and day to use the numeric year number, + * it's not correct if the exact date matters. For instance as `2019-12-30` is already + * in the first week of the 2020 year, if you want to know from this date if ISO week + * year 2020 is a long year, use `isLongIsoYear` instead. + * + * @example + * ``` + * Carbon::create(2015)->isLongYear(); // true + * Carbon::create(2016)->isLongYear(); // false + * ``` + * + * @see https://en.wikipedia.org/wiki/ISO_8601#Week_dates + * + * @return bool + */ + public function isLongYear() + { + return static::create($this->year, 12, 28, 0, 0, 0, $this->tz)->weekOfYear === 53; + } + + /** + * Determines if the instance is a long year (using ISO 8601 year). + * + * @example + * ``` + * Carbon::parse('2015-01-01')->isLongIsoYear(); // true + * Carbon::parse('2016-01-01')->isLongIsoYear(); // true + * Carbon::parse('2016-01-03')->isLongIsoYear(); // false + * Carbon::parse('2019-12-29')->isLongIsoYear(); // false + * Carbon::parse('2019-12-30')->isLongIsoYear(); // true + * ``` + * + * @see https://en.wikipedia.org/wiki/ISO_8601#Week_dates + * + * @return bool + */ + public function isLongIsoYear() + { + return static::create($this->isoWeekYear, 12, 28, 0, 0, 0, $this->tz)->weekOfYear === 53; + } + + /** + * Compares the formatted values of the two dates. + * + * @example + * ``` + * Carbon::parse('2019-06-13')->isSameAs('Y-d', Carbon::parse('2019-12-13')); // true + * Carbon::parse('2019-06-13')->isSameAs('Y-d', Carbon::parse('2019-06-14')); // false + * ``` + * + * @param string $format date formats to compare. + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date instance to compare with or null to use current day. + * + * @return bool + */ + public function isSameAs($format, $date = null) + { + return $this->rawFormat($format) === $this->resolveCarbon($date)->rawFormat($format); + } + + /** + * Determines if the instance is in the current unit given. + * + * @example + * ``` + * Carbon::parse('2019-01-13')->isSameUnit('year', Carbon::parse('2019-12-25')); // true + * Carbon::parse('2018-12-13')->isSameUnit('year', Carbon::parse('2019-12-25')); // false + * ``` + * + * @param string $unit singular unit string + * @param \Carbon\Carbon|\DateTimeInterface|null $date instance to compare with or null to use current day. + * + * @throws BadComparisonUnitException + * + * @return bool + */ + public function isSameUnit($unit, $date = null) + { + $units = [ + // @call isSameUnit + 'year' => 'Y', + // @call isSameUnit + 'week' => 'o-W', + // @call isSameUnit + 'day' => 'Y-m-d', + // @call isSameUnit + 'hour' => 'Y-m-d H', + // @call isSameUnit + 'minute' => 'Y-m-d H:i', + // @call isSameUnit + 'second' => 'Y-m-d H:i:s', + // @call isSameUnit + 'micro' => 'Y-m-d H:i:s.u', + // @call isSameUnit + 'microsecond' => 'Y-m-d H:i:s.u', + ]; + + if (isset($units[$unit])) { + return $this->isSameAs($units[$unit], $date); + } + + if (isset($this->$unit)) { + return $this->resolveCarbon($date)->$unit === $this->$unit; + } + + if ($this->localStrictModeEnabled ?? static::isStrictModeEnabled()) { + throw new BadComparisonUnitException($unit); + } + + return false; + } + + /** + * Determines if the instance is in the current unit given. + * + * @example + * ``` + * Carbon::now()->isCurrentUnit('hour'); // true + * Carbon::now()->subHours(2)->isCurrentUnit('hour'); // false + * ``` + * + * @param string $unit The unit to test. + * + * @throws BadMethodCallException + * + * @return bool + */ + public function isCurrentUnit($unit) + { + return $this->{'isSame'.ucfirst($unit)}(); + } + + /** + * Checks if the passed in date is in the same quarter as the instance quarter (and year if needed). + * + * @example + * ``` + * Carbon::parse('2019-01-12')->isSameQuarter(Carbon::parse('2019-03-01')); // true + * Carbon::parse('2019-01-12')->isSameQuarter(Carbon::parse('2019-04-01')); // false + * Carbon::parse('2019-01-12')->isSameQuarter(Carbon::parse('2018-03-01')); // false + * Carbon::parse('2019-01-12')->isSameQuarter(Carbon::parse('2018-03-01'), false); // true + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date The instance to compare with or null to use current day. + * @param bool $ofSameYear Check if it is the same month in the same year. + * + * @return bool + */ + public function isSameQuarter($date = null, $ofSameYear = true) + { + $date = $this->resolveCarbon($date); + + return $this->quarter === $date->quarter && (!$ofSameYear || $this->isSameYear($date)); + } + + /** + * Checks if the passed in date is in the same month as the instance´s month. + * + * @example + * ``` + * Carbon::parse('2019-01-12')->isSameMonth(Carbon::parse('2019-01-01')); // true + * Carbon::parse('2019-01-12')->isSameMonth(Carbon::parse('2019-02-01')); // false + * Carbon::parse('2019-01-12')->isSameMonth(Carbon::parse('2018-01-01')); // false + * Carbon::parse('2019-01-12')->isSameMonth(Carbon::parse('2018-01-01'), false); // true + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use the current date. + * @param bool $ofSameYear Check if it is the same month in the same year. + * + * @return bool + */ + public function isSameMonth($date = null, $ofSameYear = true) + { + return $this->isSameAs($ofSameYear ? 'Y-m' : 'm', $date); + } + + /** + * Checks if this day is a specific day of the week. + * + * @example + * ``` + * Carbon::parse('2019-07-17')->isDayOfWeek(Carbon::WEDNESDAY); // true + * Carbon::parse('2019-07-17')->isDayOfWeek(Carbon::FRIDAY); // false + * Carbon::parse('2019-07-17')->isDayOfWeek('Wednesday'); // true + * Carbon::parse('2019-07-17')->isDayOfWeek('Friday'); // false + * ``` + * + * @param int $dayOfWeek + * + * @return bool + */ + public function isDayOfWeek($dayOfWeek) + { + if (\is_string($dayOfWeek) && \defined($constant = static::class.'::'.strtoupper($dayOfWeek))) { + $dayOfWeek = \constant($constant); + } + + return $this->dayOfWeek === $dayOfWeek; + } + + /** + * Check if its the birthday. Compares the date/month values of the two dates. + * + * @example + * ``` + * Carbon::now()->subYears(5)->isBirthday(); // true + * Carbon::now()->subYears(5)->subDay()->isBirthday(); // false + * Carbon::parse('2019-06-05')->isBirthday(Carbon::parse('2001-06-05')); // true + * Carbon::parse('2019-06-05')->isBirthday(Carbon::parse('2001-06-06')); // false + * ``` + * + * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use current day. + * + * @return bool + */ + public function isBirthday($date = null) + { + return $this->isSameAs('md', $date); + } + + /** + * Check if today is the last day of the Month + * + * @example + * ``` + * Carbon::parse('2019-02-28')->isLastOfMonth(); // true + * Carbon::parse('2019-03-28')->isLastOfMonth(); // false + * Carbon::parse('2019-03-30')->isLastOfMonth(); // false + * Carbon::parse('2019-03-31')->isLastOfMonth(); // true + * Carbon::parse('2019-04-30')->isLastOfMonth(); // true + * ``` + * + * @return bool + */ + public function isLastOfMonth() + { + return $this->day === $this->daysInMonth; + } + + /** + * Check if the instance is start of day / midnight. + * + * @example + * ``` + * Carbon::parse('2019-02-28 00:00:00')->isStartOfDay(); // true + * Carbon::parse('2019-02-28 00:00:00.999999')->isStartOfDay(); // true + * Carbon::parse('2019-02-28 00:00:01')->isStartOfDay(); // false + * Carbon::parse('2019-02-28 00:00:00.000000')->isStartOfDay(true); // true + * Carbon::parse('2019-02-28 00:00:00.000012')->isStartOfDay(true); // false + * ``` + * + * @param bool $checkMicroseconds check time at microseconds precision + * + * @return bool + */ + public function isStartOfDay($checkMicroseconds = false) + { + /* @var CarbonInterface $this */ + return $checkMicroseconds + ? $this->rawFormat('H:i:s.u') === '00:00:00.000000' + : $this->rawFormat('H:i:s') === '00:00:00'; + } + + /** + * Check if the instance is end of day. + * + * @example + * ``` + * Carbon::parse('2019-02-28 23:59:59.999999')->isEndOfDay(); // true + * Carbon::parse('2019-02-28 23:59:59.123456')->isEndOfDay(); // true + * Carbon::parse('2019-02-28 23:59:59')->isEndOfDay(); // true + * Carbon::parse('2019-02-28 23:59:58.999999')->isEndOfDay(); // false + * Carbon::parse('2019-02-28 23:59:59.999999')->isEndOfDay(true); // true + * Carbon::parse('2019-02-28 23:59:59.123456')->isEndOfDay(true); // false + * Carbon::parse('2019-02-28 23:59:59')->isEndOfDay(true); // false + * ``` + * + * @param bool $checkMicroseconds check time at microseconds precision + * + * @return bool + */ + public function isEndOfDay($checkMicroseconds = false) + { + /* @var CarbonInterface $this */ + return $checkMicroseconds + ? $this->rawFormat('H:i:s.u') === '23:59:59.999999' + : $this->rawFormat('H:i:s') === '23:59:59'; + } + + /** + * Check if the instance is start of day / midnight. + * + * @example + * ``` + * Carbon::parse('2019-02-28 00:00:00')->isMidnight(); // true + * Carbon::parse('2019-02-28 00:00:00.999999')->isMidnight(); // true + * Carbon::parse('2019-02-28 00:00:01')->isMidnight(); // false + * ``` + * + * @return bool + */ + public function isMidnight() + { + return $this->isStartOfDay(); + } + + /** + * Check if the instance is midday. + * + * @example + * ``` + * Carbon::parse('2019-02-28 11:59:59.999999')->isMidday(); // false + * Carbon::parse('2019-02-28 12:00:00')->isMidday(); // true + * Carbon::parse('2019-02-28 12:00:00.999999')->isMidday(); // true + * Carbon::parse('2019-02-28 12:00:01')->isMidday(); // false + * ``` + * + * @return bool + */ + public function isMidday() + { + /* @var CarbonInterface $this */ + return $this->rawFormat('G:i:s') === static::$midDayAt.':00:00'; + } + + /** + * Checks if the (date)time string is in a given format. + * + * @example + * ``` + * Carbon::hasFormat('11:12:45', 'h:i:s'); // true + * Carbon::hasFormat('13:12:45', 'h:i:s'); // false + * ``` + * + * @param string $date + * @param string $format + * + * @return bool + */ + public static function hasFormat($date, $format) + { + // createFromFormat() is known to handle edge cases silently. + // E.g. "1975-5-1" (Y-n-j) will still be parsed correctly when "Y-m-d" is supplied as the format. + // To ensure we're really testing against our desired format, perform an additional regex validation. + + return self::matchFormatPattern((string) $date, preg_quote((string) $format, '/'), static::$regexFormats); + } + + /** + * Checks if the (date)time string is in a given format. + * + * @example + * ``` + * Carbon::hasFormatWithModifiers('31/08/2015', 'd#m#Y'); // true + * Carbon::hasFormatWithModifiers('31/08/2015', 'm#d#Y'); // false + * ``` + * + * @param string $date + * @param string $format + * + * @return bool + */ + public static function hasFormatWithModifiers($date, $format): bool + { + return self::matchFormatPattern((string) $date, (string) $format, array_merge(static::$regexFormats, static::$regexFormatModifiers)); + } + + /** + * Checks if the (date)time string is in a given format and valid to create a + * new instance. + * + * @example + * ``` + * Carbon::canBeCreatedFromFormat('11:12:45', 'h:i:s'); // true + * Carbon::canBeCreatedFromFormat('13:12:45', 'h:i:s'); // false + * ``` + * + * @param string $date + * @param string $format + * + * @return bool + */ + public static function canBeCreatedFromFormat($date, $format) + { + try { + // Try to create a DateTime object. Throws an InvalidArgumentException if the provided time string + // doesn't match the format in any way. + if (!static::rawCreateFromFormat($format, $date)) { + return false; + } + } catch (InvalidArgumentException $e) { + return false; + } + + return static::hasFormatWithModifiers($date, $format); + } + + /** + * Returns true if the current date matches the given string. + * + * @example + * ``` + * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('2019')); // true + * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('2018')); // false + * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('2019-06')); // true + * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('06-02')); // true + * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('2019-06-02')); // true + * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('Sunday')); // true + * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('June')); // true + * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('12:23')); // true + * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('12:23:45')); // true + * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('12:23:00')); // false + * var_dump(Carbon::parse('2019-06-02 12:23:45')->is('12h')); // true + * var_dump(Carbon::parse('2019-06-02 15:23:45')->is('3pm')); // true + * var_dump(Carbon::parse('2019-06-02 15:23:45')->is('3am')); // false + * ``` + * + * @param string $tester day name, month name, hour, date, etc. as string + * + * @return bool + */ + public function is(string $tester) + { + $tester = trim($tester); + + if (preg_match('/^\d+$/', $tester)) { + return $this->year === (int) $tester; + } + + if (preg_match('/^(?:Jan|January|Feb|February|Mar|March|Apr|April|May|Jun|June|Jul|July|Aug|August|Sep|September|Oct|October|Nov|November|Dec|December)$/i', $tester)) { + return $this->isSameMonth(static::parse($tester), false); + } + + if (preg_match('/^\d{3,}-\d{1,2}$/', $tester)) { + return $this->isSameMonth(static::parse($tester)); + } + + if (preg_match('/^\d{1,2}-\d{1,2}$/', $tester)) { + return $this->isSameDay(static::parse($this->year.'-'.$tester)); + } + + $modifier = preg_replace('/(\d)h$/i', '$1:00', $tester); + + /* @var CarbonInterface $max */ + $median = static::parse('5555-06-15 12:30:30.555555')->modify($modifier); + $current = $this->avoidMutation(); + /* @var CarbonInterface $other */ + $other = $this->avoidMutation()->modify($modifier); + + if ($current->eq($other)) { + return true; + } + + if (preg_match('/\d:\d{1,2}:\d{1,2}$/', $tester)) { + return $current->startOfSecond()->eq($other); + } + + if (preg_match('/\d:\d{1,2}$/', $tester)) { + return $current->startOfMinute()->eq($other); + } + + if (preg_match('/\d(?:h|am|pm)$/', $tester)) { + return $current->startOfHour()->eq($other); + } + + if (preg_match( + '/^(?:january|february|march|april|may|june|july|august|september|october|november|december)(?:\s+\d+)?$/i', + $tester + )) { + return $current->startOfMonth()->eq($other->startOfMonth()); + } + + $units = [ + 'month' => [1, 'year'], + 'day' => [1, 'month'], + 'hour' => [0, 'day'], + 'minute' => [0, 'hour'], + 'second' => [0, 'minute'], + 'microsecond' => [0, 'second'], + ]; + + foreach ($units as $unit => [$minimum, $startUnit]) { + if ($minimum === $median->$unit) { + $current = $current->startOf($startUnit); + + break; + } + } + + return $current->eq($other); + } + + /** + * Checks if the (date)time string is in a given format with + * given list of pattern replacements. + * + * @example + * ``` + * Carbon::hasFormat('11:12:45', 'h:i:s'); // true + * Carbon::hasFormat('13:12:45', 'h:i:s'); // false + * ``` + * + * @param string $date + * @param string $format + * @param array $replacements + * + * @return bool + */ + private static function matchFormatPattern(string $date, string $format, array $replacements): bool + { + // Preg quote, but remove escaped backslashes since we'll deal with escaped characters in the format string. + $regex = str_replace('\\\\', '\\', $format); + // Replace not-escaped letters + $regex = preg_replace_callback( + '/(?<!\\\\)((?:\\\\{2})*)(['.implode('', array_keys($replacements)).'])/', + function ($match) use ($replacements) { + return $match[1].strtr($match[2], $replacements); + }, + $regex + ); + // Replace escaped letters by the letter itself + $regex = preg_replace('/(?<!\\\\)((?:\\\\{2})*)\\\\(\w)/', '$1$2', $regex); + // Escape not escaped slashes + $regex = preg_replace('#(?<!\\\\)((?:\\\\{2})*)/#', '$1\\/', $regex); + + return (bool) @preg_match('/^'.$regex.'$/', $date); + } + + /** + * Returns true if the date was created using CarbonImmutable::startOfTime() + * + * @return bool + */ + public function isStartOfTime(): bool + { + return $this->startOfTime ?? false; + } + + /** + * Returns true if the date was created using CarbonImmutable::endOfTime() + * + * @return bool + */ + public function isEndOfTime(): bool + { + return $this->endOfTime ?? false; + } + + private function discourageNull($value): void + { + if ($value === null) { + @trigger_error("Since 2.61.0, it's deprecated to compare a date to null, meaning of such comparison is ambiguous and will no longer be possible in 3.0.0, you should explicitly pass 'now' or make an other check to eliminate null values.", \E_USER_DEPRECATED); + } + } + + private function discourageBoolean($value): void + { + if (\is_bool($value)) { + @trigger_error("Since 2.61.0, it's deprecated to compare a date to true or false, meaning of such comparison is ambiguous and will no longer be possible in 3.0.0, you should explicitly pass 'now' or make an other check to eliminate boolean values.", \E_USER_DEPRECATED); + } + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Converter.php b/vendor/nesbot/carbon/src/Carbon/Traits/Converter.php new file mode 100644 index 00000000..fff8a600 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Converter.php @@ -0,0 +1,639 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +use Carbon\Carbon; +use Carbon\CarbonImmutable; +use Carbon\CarbonInterface; +use Carbon\CarbonInterval; +use Carbon\CarbonPeriod; +use Carbon\CarbonPeriodImmutable; +use Carbon\Exceptions\UnitException; +use Closure; +use DateTime; +use DateTimeImmutable; +use ReturnTypeWillChange; + +/** + * Trait Converter. + * + * Change date into different string formats and types and + * handle the string cast. + * + * Depends on the following methods: + * + * @method static copy() + */ +trait Converter +{ + use ToStringFormat; + + /** + * Returns the formatted date string on success or FALSE on failure. + * + * @see https://php.net/manual/en/datetime.format.php + * + * @param string $format + * + * @return string + */ + #[ReturnTypeWillChange] + public function format($format) + { + $function = $this->localFormatFunction ?: static::$formatFunction; + + if (!$function) { + return $this->rawFormat($format); + } + + if (\is_string($function) && method_exists($this, $function)) { + $function = [$this, $function]; + } + + return $function(...\func_get_args()); + } + + /** + * @see https://php.net/manual/en/datetime.format.php + * + * @param string $format + * + * @return string + */ + public function rawFormat($format) + { + return parent::format($format); + } + + /** + * Format the instance as a string using the set format + * + * @example + * ``` + * echo Carbon::now(); // Carbon instances can be cast to string + * ``` + * + * @return string + */ + public function __toString() + { + $format = $this->localToStringFormat ?? static::$toStringFormat; + + return $format instanceof Closure + ? $format($this) + : $this->rawFormat($format ?: ( + \defined('static::DEFAULT_TO_STRING_FORMAT') + ? static::DEFAULT_TO_STRING_FORMAT + : CarbonInterface::DEFAULT_TO_STRING_FORMAT + )); + } + + /** + * Format the instance as date + * + * @example + * ``` + * echo Carbon::now()->toDateString(); + * ``` + * + * @return string + */ + public function toDateString() + { + return $this->rawFormat('Y-m-d'); + } + + /** + * Format the instance as a readable date + * + * @example + * ``` + * echo Carbon::now()->toFormattedDateString(); + * ``` + * + * @return string + */ + public function toFormattedDateString() + { + return $this->rawFormat('M j, Y'); + } + + /** + * Format the instance with the day, and a readable date + * + * @example + * ``` + * echo Carbon::now()->toFormattedDayDateString(); + * ``` + * + * @return string + */ + public function toFormattedDayDateString(): string + { + return $this->rawFormat('D, M j, Y'); + } + + /** + * Format the instance as time + * + * @example + * ``` + * echo Carbon::now()->toTimeString(); + * ``` + * + * @param string $unitPrecision + * + * @return string + */ + public function toTimeString($unitPrecision = 'second') + { + return $this->rawFormat(static::getTimeFormatByPrecision($unitPrecision)); + } + + /** + * Format the instance as date and time + * + * @example + * ``` + * echo Carbon::now()->toDateTimeString(); + * ``` + * + * @param string $unitPrecision + * + * @return string + */ + public function toDateTimeString($unitPrecision = 'second') + { + return $this->rawFormat('Y-m-d '.static::getTimeFormatByPrecision($unitPrecision)); + } + + /** + * Return a format from H:i to H:i:s.u according to given unit precision. + * + * @param string $unitPrecision "minute", "second", "millisecond" or "microsecond" + * + * @return string + */ + public static function getTimeFormatByPrecision($unitPrecision) + { + switch (static::singularUnit($unitPrecision)) { + case 'minute': + return 'H:i'; + case 'second': + return 'H:i:s'; + case 'm': + case 'millisecond': + return 'H:i:s.v'; + case 'µ': + case 'microsecond': + return 'H:i:s.u'; + } + + throw new UnitException('Precision unit expected among: minute, second, millisecond and microsecond.'); + } + + /** + * Format the instance as date and time T-separated with no timezone + * + * @example + * ``` + * echo Carbon::now()->toDateTimeLocalString(); + * echo "\n"; + * echo Carbon::now()->toDateTimeLocalString('minute'); // You can specify precision among: minute, second, millisecond and microsecond + * ``` + * + * @param string $unitPrecision + * + * @return string + */ + public function toDateTimeLocalString($unitPrecision = 'second') + { + return $this->rawFormat('Y-m-d\T'.static::getTimeFormatByPrecision($unitPrecision)); + } + + /** + * Format the instance with day, date and time + * + * @example + * ``` + * echo Carbon::now()->toDayDateTimeString(); + * ``` + * + * @return string + */ + public function toDayDateTimeString() + { + return $this->rawFormat('D, M j, Y g:i A'); + } + + /** + * Format the instance as ATOM + * + * @example + * ``` + * echo Carbon::now()->toAtomString(); + * ``` + * + * @return string + */ + public function toAtomString() + { + return $this->rawFormat(DateTime::ATOM); + } + + /** + * Format the instance as COOKIE + * + * @example + * ``` + * echo Carbon::now()->toCookieString(); + * ``` + * + * @return string + */ + public function toCookieString() + { + return $this->rawFormat(DateTime::COOKIE); + } + + /** + * Format the instance as ISO8601 + * + * @example + * ``` + * echo Carbon::now()->toIso8601String(); + * ``` + * + * @return string + */ + public function toIso8601String() + { + return $this->toAtomString(); + } + + /** + * Format the instance as RFC822 + * + * @example + * ``` + * echo Carbon::now()->toRfc822String(); + * ``` + * + * @return string + */ + public function toRfc822String() + { + return $this->rawFormat(DateTime::RFC822); + } + + /** + * Convert the instance to UTC and return as Zulu ISO8601 + * + * @example + * ``` + * echo Carbon::now()->toIso8601ZuluString(); + * ``` + * + * @param string $unitPrecision + * + * @return string + */ + public function toIso8601ZuluString($unitPrecision = 'second') + { + return $this->avoidMutation() + ->utc() + ->rawFormat('Y-m-d\T'.static::getTimeFormatByPrecision($unitPrecision).'\Z'); + } + + /** + * Format the instance as RFC850 + * + * @example + * ``` + * echo Carbon::now()->toRfc850String(); + * ``` + * + * @return string + */ + public function toRfc850String() + { + return $this->rawFormat(DateTime::RFC850); + } + + /** + * Format the instance as RFC1036 + * + * @example + * ``` + * echo Carbon::now()->toRfc1036String(); + * ``` + * + * @return string + */ + public function toRfc1036String() + { + return $this->rawFormat(DateTime::RFC1036); + } + + /** + * Format the instance as RFC1123 + * + * @example + * ``` + * echo Carbon::now()->toRfc1123String(); + * ``` + * + * @return string + */ + public function toRfc1123String() + { + return $this->rawFormat(DateTime::RFC1123); + } + + /** + * Format the instance as RFC2822 + * + * @example + * ``` + * echo Carbon::now()->toRfc2822String(); + * ``` + * + * @return string + */ + public function toRfc2822String() + { + return $this->rawFormat(DateTime::RFC2822); + } + + /** + * Format the instance as RFC3339 + * + * @param bool $extended + * + * @example + * ``` + * echo Carbon::now()->toRfc3339String() . "\n"; + * echo Carbon::now()->toRfc3339String(true) . "\n"; + * ``` + * + * @return string + */ + public function toRfc3339String($extended = false) + { + $format = DateTime::RFC3339; + if ($extended) { + $format = DateTime::RFC3339_EXTENDED; + } + + return $this->rawFormat($format); + } + + /** + * Format the instance as RSS + * + * @example + * ``` + * echo Carbon::now()->toRssString(); + * ``` + * + * @return string + */ + public function toRssString() + { + return $this->rawFormat(DateTime::RSS); + } + + /** + * Format the instance as W3C + * + * @example + * ``` + * echo Carbon::now()->toW3cString(); + * ``` + * + * @return string + */ + public function toW3cString() + { + return $this->rawFormat(DateTime::W3C); + } + + /** + * Format the instance as RFC7231 + * + * @example + * ``` + * echo Carbon::now()->toRfc7231String(); + * ``` + * + * @return string + */ + public function toRfc7231String() + { + return $this->avoidMutation() + ->setTimezone('GMT') + ->rawFormat(\defined('static::RFC7231_FORMAT') ? static::RFC7231_FORMAT : CarbonInterface::RFC7231_FORMAT); + } + + /** + * Get default array representation. + * + * @example + * ``` + * var_dump(Carbon::now()->toArray()); + * ``` + * + * @return array + */ + public function toArray() + { + return [ + 'year' => $this->year, + 'month' => $this->month, + 'day' => $this->day, + 'dayOfWeek' => $this->dayOfWeek, + 'dayOfYear' => $this->dayOfYear, + 'hour' => $this->hour, + 'minute' => $this->minute, + 'second' => $this->second, + 'micro' => $this->micro, + 'timestamp' => $this->timestamp, + 'formatted' => $this->rawFormat(\defined('static::DEFAULT_TO_STRING_FORMAT') ? static::DEFAULT_TO_STRING_FORMAT : CarbonInterface::DEFAULT_TO_STRING_FORMAT), + 'timezone' => $this->timezone, + ]; + } + + /** + * Get default object representation. + * + * @example + * ``` + * var_dump(Carbon::now()->toObject()); + * ``` + * + * @return object + */ + public function toObject() + { + return (object) $this->toArray(); + } + + /** + * Returns english human readable complete date string. + * + * @example + * ``` + * echo Carbon::now()->toString(); + * ``` + * + * @return string + */ + public function toString() + { + return $this->avoidMutation()->locale('en')->isoFormat('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); + } + + /** + * Return the ISO-8601 string (ex: 1977-04-22T06:00:00Z, if $keepOffset truthy, offset will be kept: + * 1977-04-22T01:00:00-05:00). + * + * @example + * ``` + * echo Carbon::now('America/Toronto')->toISOString() . "\n"; + * echo Carbon::now('America/Toronto')->toISOString(true) . "\n"; + * ``` + * + * @param bool $keepOffset Pass true to keep the date offset. Else forced to UTC. + * + * @return null|string + */ + public function toISOString($keepOffset = false) + { + if (!$this->isValid()) { + return null; + } + + $yearFormat = $this->year < 0 || $this->year > 9999 ? 'YYYYYY' : 'YYYY'; + $tzFormat = $keepOffset ? 'Z' : '[Z]'; + $date = $keepOffset ? $this : $this->avoidMutation()->utc(); + + return $date->isoFormat("$yearFormat-MM-DD[T]HH:mm:ss.SSSSSS$tzFormat"); + } + + /** + * Return the ISO-8601 string (ex: 1977-04-22T06:00:00Z) with UTC timezone. + * + * @example + * ``` + * echo Carbon::now('America/Toronto')->toJSON(); + * ``` + * + * @return null|string + */ + public function toJSON() + { + return $this->toISOString(); + } + + /** + * Return native DateTime PHP object matching the current instance. + * + * @example + * ``` + * var_dump(Carbon::now()->toDateTime()); + * ``` + * + * @return DateTime + */ + public function toDateTime() + { + return new DateTime($this->rawFormat('Y-m-d H:i:s.u'), $this->getTimezone()); + } + + /** + * Return native toDateTimeImmutable PHP object matching the current instance. + * + * @example + * ``` + * var_dump(Carbon::now()->toDateTimeImmutable()); + * ``` + * + * @return DateTimeImmutable + */ + public function toDateTimeImmutable() + { + return new DateTimeImmutable($this->rawFormat('Y-m-d H:i:s.u'), $this->getTimezone()); + } + + /** + * @alias toDateTime + * + * Return native DateTime PHP object matching the current instance. + * + * @example + * ``` + * var_dump(Carbon::now()->toDate()); + * ``` + * + * @return DateTime + */ + public function toDate() + { + return $this->toDateTime(); + } + + /** + * Create a iterable CarbonPeriod object from current date to a given end date (and optional interval). + * + * @param \DateTimeInterface|Carbon|CarbonImmutable|int|null $end period end date or recurrences count if int + * @param int|\DateInterval|string|null $interval period default interval or number of the given $unit + * @param string|null $unit if specified, $interval must be an integer + * + * @return CarbonPeriod + */ + public function toPeriod($end = null, $interval = null, $unit = null) + { + if ($unit) { + $interval = CarbonInterval::make("$interval ".static::pluralUnit($unit)); + } + + $period = ($this->isMutable() ? new CarbonPeriod() : new CarbonPeriodImmutable()) + ->setDateClass(static::class) + ->setStartDate($this); + + if ($interval) { + $period = $period->setDateInterval($interval); + } + + if (\is_int($end) || (\is_string($end) && ctype_digit($end))) { + $period = $period->setRecurrences($end); + } elseif ($end) { + $period = $period->setEndDate($end); + } + + return $period; + } + + /** + * Create a iterable CarbonPeriod object from current date to a given end date (and optional interval). + * + * @param \DateTimeInterface|Carbon|CarbonImmutable|null $end period end date + * @param int|\DateInterval|string|null $interval period default interval or number of the given $unit + * @param string|null $unit if specified, $interval must be an integer + * + * @return CarbonPeriod + */ + public function range($end = null, $interval = null, $unit = null) + { + return $this->toPeriod($end, $interval, $unit); + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php b/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php new file mode 100644 index 00000000..0d611ea2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php @@ -0,0 +1,977 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +use Carbon\Carbon; +use Carbon\CarbonImmutable; +use Carbon\CarbonInterface; +use Carbon\Exceptions\InvalidDateException; +use Carbon\Exceptions\InvalidFormatException; +use Carbon\Exceptions\OutOfRangeException; +use Carbon\Translator; +use Closure; +use DateMalformedStringException; +use DateTimeImmutable; +use DateTimeInterface; +use DateTimeZone; +use Exception; +use ReturnTypeWillChange; + +/** + * Trait Creator. + * + * Static creators. + * + * Depends on the following methods: + * + * @method static Carbon|CarbonImmutable getTestNow() + */ +trait Creator +{ + use ObjectInitialisation; + + /** + * The errors that can occur. + * + * @var array + */ + protected static $lastErrors; + + /** + * Create a new Carbon instance. + * + * Please see the testing aids section (specifically static::setTestNow()) + * for more on the possibility of this constructor returning a test instance. + * + * @param DateTimeInterface|string|null $time + * @param DateTimeZone|string|null $tz + * + * @throws InvalidFormatException + */ + public function __construct($time = null, $tz = null) + { + if ($time instanceof DateTimeInterface) { + $time = $this->constructTimezoneFromDateTime($time, $tz)->format('Y-m-d H:i:s.u'); + } + + if (is_numeric($time) && (!\is_string($time) || !preg_match('/^\d{1,14}$/', $time))) { + $time = static::createFromTimestampUTC($time)->format('Y-m-d\TH:i:s.uP'); + } + + // If the class has a test now set and we are trying to create a now() + // instance then override as required + $isNow = empty($time) || $time === 'now'; + + if (method_exists(static::class, 'hasTestNow') && + method_exists(static::class, 'getTestNow') && + static::hasTestNow() && + ($isNow || static::hasRelativeKeywords($time)) + ) { + static::mockConstructorParameters($time, $tz); + } + + // Work-around for PHP bug https://bugs.php.net/bug.php?id=67127 + if (!str_contains((string) .1, '.')) { + $locale = setlocale(LC_NUMERIC, '0'); // @codeCoverageIgnore + setlocale(LC_NUMERIC, 'C'); // @codeCoverageIgnore + } + + try { + parent::__construct($time ?: 'now', static::safeCreateDateTimeZone($tz) ?: null); + } catch (Exception $exception) { + throw new InvalidFormatException($exception->getMessage(), 0, $exception); + } + + $this->constructedObjectId = spl_object_hash($this); + + if (isset($locale)) { + setlocale(LC_NUMERIC, $locale); // @codeCoverageIgnore + } + + self::setLastErrors(parent::getLastErrors()); + } + + /** + * Get timezone from a datetime instance. + * + * @param DateTimeInterface $date + * @param DateTimeZone|string|null $tz + * + * @return DateTimeInterface + */ + private function constructTimezoneFromDateTime(DateTimeInterface $date, &$tz) + { + if ($tz !== null) { + $safeTz = static::safeCreateDateTimeZone($tz); + + if ($safeTz) { + return ($date instanceof DateTimeImmutable ? $date : clone $date)->setTimezone($safeTz); + } + + return $date; + } + + $tz = $date->getTimezone(); + + return $date; + } + + /** + * Update constructedObjectId on cloned. + */ + public function __clone() + { + $this->constructedObjectId = spl_object_hash($this); + } + + /** + * Create a Carbon instance from a DateTime one. + * + * @param DateTimeInterface $date + * + * @return static + */ + public static function instance($date) + { + if ($date instanceof static) { + return clone $date; + } + + static::expectDateTime($date); + + $instance = new static($date->format('Y-m-d H:i:s.u'), $date->getTimezone()); + + if ($date instanceof CarbonInterface) { + $settings = $date->getSettings(); + + if (!$date->hasLocalTranslator()) { + unset($settings['locale']); + } + + $instance->settings($settings); + } + + return $instance; + } + + /** + * Create a carbon instance from a string. + * + * This is an alias for the constructor that allows better fluent syntax + * as it allows you to do Carbon::parse('Monday next week')->fn() rather + * than (new Carbon('Monday next week'))->fn(). + * + * @param string|DateTimeInterface|null $time + * @param DateTimeZone|string|null $tz + * + * @throws InvalidFormatException + * + * @return static + */ + public static function rawParse($time = null, $tz = null) + { + if ($time instanceof DateTimeInterface) { + return static::instance($time); + } + + try { + return new static($time, $tz); + } catch (Exception $exception) { + // @codeCoverageIgnoreStart + try { + $date = @static::now($tz)->change($time); + } catch (DateMalformedStringException $ignoredException) { + $date = null; + } + // @codeCoverageIgnoreEnd + + if (!$date) { + throw new InvalidFormatException("Could not parse '$time': ".$exception->getMessage(), 0, $exception); + } + + return $date; + } + } + + /** + * Create a carbon instance from a string. + * + * This is an alias for the constructor that allows better fluent syntax + * as it allows you to do Carbon::parse('Monday next week')->fn() rather + * than (new Carbon('Monday next week'))->fn(). + * + * @param string|DateTimeInterface|null $time + * @param DateTimeZone|string|null $tz + * + * @throws InvalidFormatException + * + * @return static + */ + public static function parse($time = null, $tz = null) + { + $function = static::$parseFunction; + + if (!$function) { + return static::rawParse($time, $tz); + } + + if (\is_string($function) && method_exists(static::class, $function)) { + $function = [static::class, $function]; + } + + return $function(...\func_get_args()); + } + + /** + * Create a carbon instance from a localized string (in French, Japanese, Arabic, etc.). + * + * @param string $time date/time string in the given language (may also contain English). + * @param string|null $locale if locale is null or not specified, current global locale will be + * used instead. + * @param DateTimeZone|string|null $tz optional timezone for the new instance. + * + * @throws InvalidFormatException + * + * @return static + */ + public static function parseFromLocale($time, $locale = null, $tz = null) + { + return static::rawParse(static::translateTimeString($time, $locale, 'en'), $tz); + } + + /** + * Get a Carbon instance for the current date and time. + * + * @param DateTimeZone|string|null $tz + * + * @return static + */ + public static function now($tz = null) + { + return new static(null, $tz); + } + + /** + * Create a Carbon instance for today. + * + * @param DateTimeZone|string|null $tz + * + * @return static + */ + public static function today($tz = null) + { + return static::rawParse('today', $tz); + } + + /** + * Create a Carbon instance for tomorrow. + * + * @param DateTimeZone|string|null $tz + * + * @return static + */ + public static function tomorrow($tz = null) + { + return static::rawParse('tomorrow', $tz); + } + + /** + * Create a Carbon instance for yesterday. + * + * @param DateTimeZone|string|null $tz + * + * @return static + */ + public static function yesterday($tz = null) + { + return static::rawParse('yesterday', $tz); + } + + /** + * Create a Carbon instance for the greatest supported date. + * + * @return static + */ + public static function maxValue() + { + if (self::$PHPIntSize === 4) { + // 32 bit + return static::createFromTimestamp(PHP_INT_MAX); // @codeCoverageIgnore + } + + // 64 bit + return static::create(9999, 12, 31, 23, 59, 59); + } + + /** + * Create a Carbon instance for the lowest supported date. + * + * @return static + */ + public static function minValue() + { + if (self::$PHPIntSize === 4) { + // 32 bit + return static::createFromTimestamp(~PHP_INT_MAX); // @codeCoverageIgnore + } + + // 64 bit + return static::create(1, 1, 1, 0, 0, 0); + } + + private static function assertBetween($unit, $value, $min, $max) + { + if (static::isStrictModeEnabled() && ($value < $min || $value > $max)) { + throw new OutOfRangeException($unit, $min, $max, $value); + } + } + + private static function createNowInstance($tz) + { + if (!static::hasTestNow()) { + return static::now($tz); + } + + $now = static::getTestNow(); + + if ($now instanceof Closure) { + return $now(static::now($tz)); + } + + return $now->avoidMutation()->tz($tz); + } + + /** + * Create a new Carbon instance from a specific date and time. + * + * If any of $year, $month or $day are set to null their now() values will + * be used. + * + * If $hour is null it will be set to its now() value and the default + * values for $minute and $second will be their now() values. + * + * If $hour is not null then the default values for $minute and $second + * will be 0. + * + * @param DateTimeInterface|int|null $year + * @param int|null $month + * @param int|null $day + * @param int|null $hour + * @param int|null $minute + * @param int|null $second + * @param DateTimeZone|string|null $tz + * + * @throws InvalidFormatException + * + * @return static|false + */ + public static function create($year = 0, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0, $tz = null) + { + if ((\is_string($year) && !is_numeric($year)) || $year instanceof DateTimeInterface) { + return static::parse($year, $tz ?: (\is_string($month) || $month instanceof DateTimeZone ? $month : null)); + } + + $defaults = null; + $getDefault = function ($unit) use ($tz, &$defaults) { + if ($defaults === null) { + $now = self::createNowInstance($tz); + + $defaults = array_combine([ + 'year', + 'month', + 'day', + 'hour', + 'minute', + 'second', + ], explode('-', $now->rawFormat('Y-n-j-G-i-s.u'))); + } + + return $defaults[$unit]; + }; + + $year = $year ?? $getDefault('year'); + $month = $month ?? $getDefault('month'); + $day = $day ?? $getDefault('day'); + $hour = $hour ?? $getDefault('hour'); + $minute = $minute ?? $getDefault('minute'); + $second = (float) ($second ?? $getDefault('second')); + + self::assertBetween('month', $month, 0, 99); + self::assertBetween('day', $day, 0, 99); + self::assertBetween('hour', $hour, 0, 99); + self::assertBetween('minute', $minute, 0, 99); + self::assertBetween('second', $second, 0, 99); + + $fixYear = null; + + if ($year < 0) { + $fixYear = $year; + $year = 0; + } elseif ($year > 9999) { + $fixYear = $year - 9999; + $year = 9999; + } + + $second = ($second < 10 ? '0' : '').number_format($second, 6); + $instance = static::rawCreateFromFormat('!Y-n-j G:i:s.u', sprintf('%s-%s-%s %s:%02s:%02s', $year, $month, $day, $hour, $minute, $second), $tz); + + if ($fixYear !== null) { + $instance = $instance->addYears($fixYear); + } + + return $instance; + } + + /** + * Create a new safe Carbon instance from a specific date and time. + * + * If any of $year, $month or $day are set to null their now() values will + * be used. + * + * If $hour is null it will be set to its now() value and the default + * values for $minute and $second will be their now() values. + * + * If $hour is not null then the default values for $minute and $second + * will be 0. + * + * If one of the set values is not valid, an InvalidDateException + * will be thrown. + * + * @param int|null $year + * @param int|null $month + * @param int|null $day + * @param int|null $hour + * @param int|null $minute + * @param int|null $second + * @param DateTimeZone|string|null $tz + * + * @throws InvalidDateException + * + * @return static|false + */ + public static function createSafe($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $tz = null) + { + $fields = static::getRangesByUnit(); + + foreach ($fields as $field => $range) { + if ($$field !== null && (!\is_int($$field) || $$field < $range[0] || $$field > $range[1])) { + if (static::isStrictModeEnabled()) { + throw new InvalidDateException($field, $$field); + } + + return false; + } + } + + $instance = static::create($year, $month, $day, $hour, $minute, $second, $tz); + + foreach (array_reverse($fields) as $field => $range) { + if ($$field !== null && (!\is_int($$field) || $$field !== $instance->$field)) { + if (static::isStrictModeEnabled()) { + throw new InvalidDateException($field, $$field); + } + + return false; + } + } + + return $instance; + } + + /** + * Create a new Carbon instance from a specific date and time using strict validation. + * + * @see create() + * + * @param int|null $year + * @param int|null $month + * @param int|null $day + * @param int|null $hour + * @param int|null $minute + * @param int|null $second + * @param DateTimeZone|string|null $tz + * + * @throws InvalidFormatException + * + * @return static + */ + public static function createStrict(?int $year = 0, ?int $month = 1, ?int $day = 1, ?int $hour = 0, ?int $minute = 0, ?int $second = 0, $tz = null): self + { + $initialStrictMode = static::isStrictModeEnabled(); + static::useStrictMode(true); + + try { + $date = static::create($year, $month, $day, $hour, $minute, $second, $tz); + } finally { + static::useStrictMode($initialStrictMode); + } + + return $date; + } + + /** + * Create a Carbon instance from just a date. The time portion is set to now. + * + * @param int|null $year + * @param int|null $month + * @param int|null $day + * @param DateTimeZone|string|null $tz + * + * @throws InvalidFormatException + * + * @return static + */ + public static function createFromDate($year = null, $month = null, $day = null, $tz = null) + { + return static::create($year, $month, $day, null, null, null, $tz); + } + + /** + * Create a Carbon instance from just a date. The time portion is set to midnight. + * + * @param int|null $year + * @param int|null $month + * @param int|null $day + * @param DateTimeZone|string|null $tz + * + * @throws InvalidFormatException + * + * @return static + */ + public static function createMidnightDate($year = null, $month = null, $day = null, $tz = null) + { + return static::create($year, $month, $day, 0, 0, 0, $tz); + } + + /** + * Create a Carbon instance from just a time. The date portion is set to today. + * + * @param int|null $hour + * @param int|null $minute + * @param int|null $second + * @param DateTimeZone|string|null $tz + * + * @throws InvalidFormatException + * + * @return static + */ + public static function createFromTime($hour = 0, $minute = 0, $second = 0, $tz = null) + { + return static::create(null, null, null, $hour, $minute, $second, $tz); + } + + /** + * Create a Carbon instance from a time string. The date portion is set to today. + * + * @param string $time + * @param DateTimeZone|string|null $tz + * + * @throws InvalidFormatException + * + * @return static + */ + public static function createFromTimeString($time, $tz = null) + { + return static::today($tz)->setTimeFromTimeString($time); + } + + /** + * @param string $format Datetime format + * @param string $time + * @param DateTimeZone|string|false|null $originalTz + * + * @return DateTimeInterface|false + */ + private static function createFromFormatAndTimezone($format, $time, $originalTz) + { + // Work-around for https://bugs.php.net/bug.php?id=75577 + // @codeCoverageIgnoreStart + if (version_compare(PHP_VERSION, '7.3.0-dev', '<')) { + $format = str_replace('.v', '.u', $format); + } + // @codeCoverageIgnoreEnd + + if ($originalTz === null) { + return parent::createFromFormat($format, (string) $time); + } + + $tz = \is_int($originalTz) + ? @timezone_name_from_abbr('', (int) ($originalTz * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE), 1) + : $originalTz; + + $tz = static::safeCreateDateTimeZone($tz, $originalTz); + + if ($tz === false) { + return false; + } + + return parent::createFromFormat($format, (string) $time, $tz); + } + + /** + * Create a Carbon instance from a specific format. + * + * @param string $format Datetime format + * @param string $time + * @param DateTimeZone|string|false|null $tz + * + * @throws InvalidFormatException + * + * @return static|false + */ + public static function rawCreateFromFormat($format, $time, $tz = null) + { + // Work-around for https://bugs.php.net/bug.php?id=80141 + $format = preg_replace('/(?<!\\\\)((?:\\\\{2})*)c/', '$1Y-m-d\TH:i:sP', $format); + + if (preg_match('/(?<!\\\\)(?:\\\\{2})*(a|A)/', $format, $aMatches, PREG_OFFSET_CAPTURE) && + preg_match('/(?<!\\\\)(?:\\\\{2})*(h|g|H|G)/', $format, $hMatches, PREG_OFFSET_CAPTURE) && + $aMatches[1][1] < $hMatches[1][1] && + preg_match('/(am|pm|AM|PM)/', $time) + ) { + $format = preg_replace('/^(.*)(?<!\\\\)((?:\\\\{2})*)(a|A)(.*)$/U', '$1$2$4 $3', $format); + $time = preg_replace('/^(.*)(am|pm|AM|PM)(.*)$/U', '$1$3 $2', $time); + } + + if ($tz === false) { + $tz = null; + } + + // First attempt to create an instance, so that error messages are based on the unmodified format. + $date = self::createFromFormatAndTimezone($format, $time, $tz); + $lastErrors = parent::getLastErrors(); + /** @var \Carbon\CarbonImmutable|\Carbon\Carbon|null $mock */ + $mock = static::getMockedTestNow($tz); + + if ($mock && $date instanceof DateTimeInterface) { + // Set timezone from mock if custom timezone was neither given directly nor as a part of format. + // First let's skip the part that will be ignored by the parser. + $nonEscaped = '(?<!\\\\)(\\\\{2})*'; + + $nonIgnored = preg_replace("/^.*{$nonEscaped}!/s", '', $format); + + if ($tz === null && !preg_match("/{$nonEscaped}[eOPT]/", $nonIgnored)) { + $tz = clone $mock->getTimezone(); + } + + $mock = $mock->copy(); + + // Prepend mock datetime only if the format does not contain non escaped unix epoch reset flag. + if (!preg_match("/{$nonEscaped}[!|]/", $format)) { + if (preg_match('/[HhGgisvuB]/', $format)) { + $mock = $mock->setTime(0, 0); + } + + $format = static::MOCK_DATETIME_FORMAT.' '.$format; + $time = ($mock instanceof self ? $mock->rawFormat(static::MOCK_DATETIME_FORMAT) : $mock->format(static::MOCK_DATETIME_FORMAT)).' '.$time; + } + + // Regenerate date from the modified format to base result on the mocked instance instead of now. + $date = self::createFromFormatAndTimezone($format, $time, $tz); + } + + if ($date instanceof DateTimeInterface) { + $instance = static::instance($date); + $instance::setLastErrors($lastErrors); + + return $instance; + } + + if (static::isStrictModeEnabled()) { + throw new InvalidFormatException(implode(PHP_EOL, $lastErrors['errors'])); + } + + return false; + } + + /** + * Create a Carbon instance from a specific format. + * + * @param string $format Datetime format + * @param string $time + * @param DateTimeZone|string|false|null $tz + * + * @throws InvalidFormatException + * + * @return static|false + */ + #[ReturnTypeWillChange] + public static function createFromFormat($format, $time, $tz = null) + { + $function = static::$createFromFormatFunction; + + if (!$function) { + return static::rawCreateFromFormat($format, $time, $tz); + } + + if (\is_string($function) && method_exists(static::class, $function)) { + $function = [static::class, $function]; + } + + return $function(...\func_get_args()); + } + + /** + * Create a Carbon instance from a specific ISO format (same replacements as ->isoFormat()). + * + * @param string $format Datetime format + * @param string $time + * @param DateTimeZone|string|false|null $tz optional timezone + * @param string|null $locale locale to be used for LTS, LT, LL, LLL, etc. macro-formats (en by fault, unneeded if no such macro-format in use) + * @param \Symfony\Component\Translation\TranslatorInterface $translator optional custom translator to use for macro-formats + * + * @throws InvalidFormatException + * + * @return static|false + */ + public static function createFromIsoFormat($format, $time, $tz = null, $locale = 'en', $translator = null) + { + $format = preg_replace_callback('/(?<!\\\\)(\\\\{2})*(LTS|LT|[Ll]{1,4})/', function ($match) use ($locale, $translator) { + [$code] = $match; + + static $formats = null; + + if ($formats === null) { + $translator = $translator ?: Translator::get($locale); + + $formats = [ + 'LT' => static::getTranslationMessageWith($translator, 'formats.LT', $locale, 'h:mm A'), + 'LTS' => static::getTranslationMessageWith($translator, 'formats.LTS', $locale, 'h:mm:ss A'), + 'L' => static::getTranslationMessageWith($translator, 'formats.L', $locale, 'MM/DD/YYYY'), + 'LL' => static::getTranslationMessageWith($translator, 'formats.LL', $locale, 'MMMM D, YYYY'), + 'LLL' => static::getTranslationMessageWith($translator, 'formats.LLL', $locale, 'MMMM D, YYYY h:mm A'), + 'LLLL' => static::getTranslationMessageWith($translator, 'formats.LLLL', $locale, 'dddd, MMMM D, YYYY h:mm A'), + ]; + } + + return $formats[$code] ?? preg_replace_callback( + '/MMMM|MM|DD|dddd/', + function ($code) { + return mb_substr($code[0], 1); + }, + $formats[strtoupper($code)] ?? '' + ); + }, $format); + + $format = preg_replace_callback('/(?<!\\\\)(\\\\{2})*('.CarbonInterface::ISO_FORMAT_REGEXP.'|[A-Za-z])/', function ($match) { + [$code] = $match; + + static $replacements = null; + + if ($replacements === null) { + $replacements = [ + 'OD' => 'd', + 'OM' => 'M', + 'OY' => 'Y', + 'OH' => 'G', + 'Oh' => 'g', + 'Om' => 'i', + 'Os' => 's', + 'D' => 'd', + 'DD' => 'd', + 'Do' => 'd', + 'd' => '!', + 'dd' => '!', + 'ddd' => 'D', + 'dddd' => 'D', + 'DDD' => 'z', + 'DDDD' => 'z', + 'DDDo' => 'z', + 'e' => '!', + 'E' => '!', + 'H' => 'G', + 'HH' => 'H', + 'h' => 'g', + 'hh' => 'h', + 'k' => 'G', + 'kk' => 'G', + 'hmm' => 'gi', + 'hmmss' => 'gis', + 'Hmm' => 'Gi', + 'Hmmss' => 'Gis', + 'm' => 'i', + 'mm' => 'i', + 'a' => 'a', + 'A' => 'a', + 's' => 's', + 'ss' => 's', + 'S' => '*', + 'SS' => '*', + 'SSS' => '*', + 'SSSS' => '*', + 'SSSSS' => '*', + 'SSSSSS' => 'u', + 'SSSSSSS' => 'u*', + 'SSSSSSSS' => 'u*', + 'SSSSSSSSS' => 'u*', + 'M' => 'm', + 'MM' => 'm', + 'MMM' => 'M', + 'MMMM' => 'M', + 'Mo' => 'm', + 'Q' => '!', + 'Qo' => '!', + 'G' => '!', + 'GG' => '!', + 'GGG' => '!', + 'GGGG' => '!', + 'GGGGG' => '!', + 'g' => '!', + 'gg' => '!', + 'ggg' => '!', + 'gggg' => '!', + 'ggggg' => '!', + 'W' => '!', + 'WW' => '!', + 'Wo' => '!', + 'w' => '!', + 'ww' => '!', + 'wo' => '!', + 'x' => 'U???', + 'X' => 'U', + 'Y' => 'Y', + 'YY' => 'y', + 'YYYY' => 'Y', + 'YYYYY' => 'Y', + 'YYYYYY' => 'Y', + 'z' => 'e', + 'zz' => 'e', + 'Z' => 'e', + 'ZZ' => 'e', + ]; + } + + $format = $replacements[$code] ?? '?'; + + if ($format === '!') { + throw new InvalidFormatException("Format $code not supported for creation."); + } + + return $format; + }, $format); + + return static::rawCreateFromFormat($format, $time, $tz); + } + + /** + * Create a Carbon instance from a specific format and a string in a given language. + * + * @param string $format Datetime format + * @param string $locale + * @param string $time + * @param DateTimeZone|string|false|null $tz + * + * @throws InvalidFormatException + * + * @return static|false + */ + public static function createFromLocaleFormat($format, $locale, $time, $tz = null) + { + $format = preg_replace_callback( + '/(?:\\\\[a-zA-Z]|[bfkqCEJKQRV]){2,}/', + static function (array $match) use ($locale): string { + $word = str_replace('\\', '', $match[0]); + $translatedWord = static::translateTimeString($word, $locale, 'en'); + + return $word === $translatedWord + ? $match[0] + : preg_replace('/[a-zA-Z]/', '\\\\$0', $translatedWord); + }, + $format + ); + + return static::rawCreateFromFormat($format, static::translateTimeString($time, $locale, 'en'), $tz); + } + + /** + * Create a Carbon instance from a specific ISO format and a string in a given language. + * + * @param string $format Datetime ISO format + * @param string $locale + * @param string $time + * @param DateTimeZone|string|false|null $tz + * + * @throws InvalidFormatException + * + * @return static|false + */ + public static function createFromLocaleIsoFormat($format, $locale, $time, $tz = null) + { + $time = static::translateTimeString($time, $locale, 'en', CarbonInterface::TRANSLATE_MONTHS | CarbonInterface::TRANSLATE_DAYS | CarbonInterface::TRANSLATE_MERIDIEM); + + return static::createFromIsoFormat($format, $time, $tz, $locale); + } + + /** + * Make a Carbon instance from given variable if possible. + * + * Always return a new instance. Parse only strings and only these likely to be dates (skip intervals + * and recurrences). Throw an exception for invalid format, but otherwise return null. + * + * @param mixed $var + * + * @throws InvalidFormatException + * + * @return static|null + */ + public static function make($var) + { + if ($var instanceof DateTimeInterface) { + return static::instance($var); + } + + $date = null; + + if (\is_string($var)) { + $var = trim($var); + + if (!preg_match('/^P[\dT]/', $var) && + !preg_match('/^R\d/', $var) && + preg_match('/[a-z\d]/i', $var) + ) { + $date = static::parse($var); + } + } + + return $date; + } + + /** + * Set last errors. + * + * @param array|bool $lastErrors + * + * @return void + */ + private static function setLastErrors($lastErrors) + { + if (\is_array($lastErrors) || $lastErrors === false) { + static::$lastErrors = \is_array($lastErrors) ? $lastErrors : [ + 'warning_count' => 0, + 'warnings' => [], + 'error_count' => 0, + 'errors' => [], + ]; + } + } + + /** + * {@inheritdoc} + * + * @return array + */ + #[ReturnTypeWillChange] + public static function getLastErrors() + { + return static::$lastErrors; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Date.php b/vendor/nesbot/carbon/src/Carbon/Traits/Date.php new file mode 100644 index 00000000..8ae5c178 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Date.php @@ -0,0 +1,2747 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +use BadMethodCallException; +use Carbon\Carbon; +use Carbon\CarbonInterface; +use Carbon\CarbonPeriod; +use Carbon\CarbonTimeZone; +use Carbon\Exceptions\BadComparisonUnitException; +use Carbon\Exceptions\ImmutableException; +use Carbon\Exceptions\InvalidTimeZoneException; +use Carbon\Exceptions\InvalidTypeException; +use Carbon\Exceptions\UnknownGetterException; +use Carbon\Exceptions\UnknownMethodException; +use Carbon\Exceptions\UnknownSetterException; +use Carbon\Exceptions\UnknownUnitException; +use Closure; +use DateInterval; +use DatePeriod; +use DateTime; +use DateTimeImmutable; +use DateTimeInterface; +use DateTimeZone; +use InvalidArgumentException; +use ReflectionException; +use ReturnTypeWillChange; +use Throwable; + +/** + * A simple API extension for DateTime. + * + * @mixin DeprecatedProperties + * + * <autodoc generated by `composer phpdoc`> + * + * @property int $year + * @property int $yearIso + * @property int $month + * @property int $day + * @property int $hour + * @property int $minute + * @property int $second + * @property int $micro + * @property int $microsecond + * @property int|float|string $timestamp seconds since the Unix Epoch + * @property string $englishDayOfWeek the day of week in English + * @property string $shortEnglishDayOfWeek the abbreviated day of week in English + * @property string $englishMonth the month in English + * @property string $shortEnglishMonth the abbreviated month in English + * @property int $milliseconds + * @property int $millisecond + * @property int $milli + * @property int $week 1 through 53 + * @property int $isoWeek 1 through 53 + * @property int $weekYear year according to week format + * @property int $isoWeekYear year according to ISO week format + * @property int $dayOfYear 1 through 366 + * @property int $age does a diffInYears() with default parameters + * @property int $offset the timezone offset in seconds from UTC + * @property int $offsetMinutes the timezone offset in minutes from UTC + * @property int $offsetHours the timezone offset in hours from UTC + * @property CarbonTimeZone $timezone the current timezone + * @property CarbonTimeZone $tz alias of $timezone + * @property-read int $dayOfWeek 0 (for Sunday) through 6 (for Saturday) + * @property-read int $dayOfWeekIso 1 (for Monday) through 7 (for Sunday) + * @property-read int $weekOfYear ISO-8601 week number of year, weeks starting on Monday + * @property-read int $daysInMonth number of days in the given month + * @property-read string $latinMeridiem "am"/"pm" (Ante meridiem or Post meridiem latin lowercase mark) + * @property-read string $latinUpperMeridiem "AM"/"PM" (Ante meridiem or Post meridiem latin uppercase mark) + * @property-read string $timezoneAbbreviatedName the current timezone abbreviated name + * @property-read string $tzAbbrName alias of $timezoneAbbreviatedName + * @property-read string $dayName long name of weekday translated according to Carbon locale, in english if no translation available for current language + * @property-read string $shortDayName short name of weekday translated according to Carbon locale, in english if no translation available for current language + * @property-read string $minDayName very short name of weekday translated according to Carbon locale, in english if no translation available for current language + * @property-read string $monthName long name of month translated according to Carbon locale, in english if no translation available for current language + * @property-read string $shortMonthName short name of month translated according to Carbon locale, in english if no translation available for current language + * @property-read string $meridiem lowercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language + * @property-read string $upperMeridiem uppercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language + * @property-read int $noZeroHour current hour from 1 to 24 + * @property-read int $weeksInYear 51 through 53 + * @property-read int $isoWeeksInYear 51 through 53 + * @property-read int $weekOfMonth 1 through 5 + * @property-read int $weekNumberInMonth 1 through 5 + * @property-read int $firstWeekDay 0 through 6 + * @property-read int $lastWeekDay 0 through 6 + * @property-read int $daysInYear 365 or 366 + * @property-read int $quarter the quarter of this instance, 1 - 4 + * @property-read int $decade the decade of this instance + * @property-read int $century the century of this instance + * @property-read int $millennium the millennium of this instance + * @property-read bool $dst daylight savings time indicator, true if DST, false otherwise + * @property-read bool $local checks if the timezone is local, true if local, false otherwise + * @property-read bool $utc checks if the timezone is UTC, true if UTC, false otherwise + * @property-read string $timezoneName the current timezone name + * @property-read string $tzName alias of $timezoneName + * @property-read string $locale locale of the current instance + * + * @method bool isUtc() Check if the current instance has UTC timezone. (Both isUtc and isUTC cases are valid.) + * @method bool isLocal() Check if the current instance has non-UTC timezone. + * @method bool isValid() Check if the current instance is a valid date. + * @method bool isDST() Check if the current instance is in a daylight saving time. + * @method bool isSunday() Checks if the instance day is sunday. + * @method bool isMonday() Checks if the instance day is monday. + * @method bool isTuesday() Checks if the instance day is tuesday. + * @method bool isWednesday() Checks if the instance day is wednesday. + * @method bool isThursday() Checks if the instance day is thursday. + * @method bool isFriday() Checks if the instance day is friday. + * @method bool isSaturday() Checks if the instance day is saturday. + * @method bool isSameYear(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same year as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentYear() Checks if the instance is in the same year as the current moment. + * @method bool isNextYear() Checks if the instance is in the same year as the current moment next year. + * @method bool isLastYear() Checks if the instance is in the same year as the current moment last year. + * @method bool isSameWeek(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same week as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentWeek() Checks if the instance is in the same week as the current moment. + * @method bool isNextWeek() Checks if the instance is in the same week as the current moment next week. + * @method bool isLastWeek() Checks if the instance is in the same week as the current moment last week. + * @method bool isSameDay(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same day as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentDay() Checks if the instance is in the same day as the current moment. + * @method bool isNextDay() Checks if the instance is in the same day as the current moment next day. + * @method bool isLastDay() Checks if the instance is in the same day as the current moment last day. + * @method bool isSameHour(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same hour as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentHour() Checks if the instance is in the same hour as the current moment. + * @method bool isNextHour() Checks if the instance is in the same hour as the current moment next hour. + * @method bool isLastHour() Checks if the instance is in the same hour as the current moment last hour. + * @method bool isSameMinute(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same minute as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMinute() Checks if the instance is in the same minute as the current moment. + * @method bool isNextMinute() Checks if the instance is in the same minute as the current moment next minute. + * @method bool isLastMinute() Checks if the instance is in the same minute as the current moment last minute. + * @method bool isSameSecond(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same second as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentSecond() Checks if the instance is in the same second as the current moment. + * @method bool isNextSecond() Checks if the instance is in the same second as the current moment next second. + * @method bool isLastSecond() Checks if the instance is in the same second as the current moment last second. + * @method bool isSameMicro(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMicro() Checks if the instance is in the same microsecond as the current moment. + * @method bool isNextMicro() Checks if the instance is in the same microsecond as the current moment next microsecond. + * @method bool isLastMicro() Checks if the instance is in the same microsecond as the current moment last microsecond. + * @method bool isSameMicrosecond(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMicrosecond() Checks if the instance is in the same microsecond as the current moment. + * @method bool isNextMicrosecond() Checks if the instance is in the same microsecond as the current moment next microsecond. + * @method bool isLastMicrosecond() Checks if the instance is in the same microsecond as the current moment last microsecond. + * @method bool isCurrentMonth() Checks if the instance is in the same month as the current moment. + * @method bool isNextMonth() Checks if the instance is in the same month as the current moment next month. + * @method bool isLastMonth() Checks if the instance is in the same month as the current moment last month. + * @method bool isCurrentQuarter() Checks if the instance is in the same quarter as the current moment. + * @method bool isNextQuarter() Checks if the instance is in the same quarter as the current moment next quarter. + * @method bool isLastQuarter() Checks if the instance is in the same quarter as the current moment last quarter. + * @method bool isSameDecade(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same decade as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentDecade() Checks if the instance is in the same decade as the current moment. + * @method bool isNextDecade() Checks if the instance is in the same decade as the current moment next decade. + * @method bool isLastDecade() Checks if the instance is in the same decade as the current moment last decade. + * @method bool isSameCentury(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same century as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentCentury() Checks if the instance is in the same century as the current moment. + * @method bool isNextCentury() Checks if the instance is in the same century as the current moment next century. + * @method bool isLastCentury() Checks if the instance is in the same century as the current moment last century. + * @method bool isSameMillennium(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same millennium as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMillennium() Checks if the instance is in the same millennium as the current moment. + * @method bool isNextMillennium() Checks if the instance is in the same millennium as the current moment next millennium. + * @method bool isLastMillennium() Checks if the instance is in the same millennium as the current moment last millennium. + * @method CarbonInterface years(int $value) Set current instance year to the given value. + * @method CarbonInterface year(int $value) Set current instance year to the given value. + * @method CarbonInterface setYears(int $value) Set current instance year to the given value. + * @method CarbonInterface setYear(int $value) Set current instance year to the given value. + * @method CarbonInterface months(int $value) Set current instance month to the given value. + * @method CarbonInterface month(int $value) Set current instance month to the given value. + * @method CarbonInterface setMonths(int $value) Set current instance month to the given value. + * @method CarbonInterface setMonth(int $value) Set current instance month to the given value. + * @method CarbonInterface days(int $value) Set current instance day to the given value. + * @method CarbonInterface day(int $value) Set current instance day to the given value. + * @method CarbonInterface setDays(int $value) Set current instance day to the given value. + * @method CarbonInterface setDay(int $value) Set current instance day to the given value. + * @method CarbonInterface hours(int $value) Set current instance hour to the given value. + * @method CarbonInterface hour(int $value) Set current instance hour to the given value. + * @method CarbonInterface setHours(int $value) Set current instance hour to the given value. + * @method CarbonInterface setHour(int $value) Set current instance hour to the given value. + * @method CarbonInterface minutes(int $value) Set current instance minute to the given value. + * @method CarbonInterface minute(int $value) Set current instance minute to the given value. + * @method CarbonInterface setMinutes(int $value) Set current instance minute to the given value. + * @method CarbonInterface setMinute(int $value) Set current instance minute to the given value. + * @method CarbonInterface seconds(int $value) Set current instance second to the given value. + * @method CarbonInterface second(int $value) Set current instance second to the given value. + * @method CarbonInterface setSeconds(int $value) Set current instance second to the given value. + * @method CarbonInterface setSecond(int $value) Set current instance second to the given value. + * @method CarbonInterface millis(int $value) Set current instance millisecond to the given value. + * @method CarbonInterface milli(int $value) Set current instance millisecond to the given value. + * @method CarbonInterface setMillis(int $value) Set current instance millisecond to the given value. + * @method CarbonInterface setMilli(int $value) Set current instance millisecond to the given value. + * @method CarbonInterface milliseconds(int $value) Set current instance millisecond to the given value. + * @method CarbonInterface millisecond(int $value) Set current instance millisecond to the given value. + * @method CarbonInterface setMilliseconds(int $value) Set current instance millisecond to the given value. + * @method CarbonInterface setMillisecond(int $value) Set current instance millisecond to the given value. + * @method CarbonInterface micros(int $value) Set current instance microsecond to the given value. + * @method CarbonInterface micro(int $value) Set current instance microsecond to the given value. + * @method CarbonInterface setMicros(int $value) Set current instance microsecond to the given value. + * @method CarbonInterface setMicro(int $value) Set current instance microsecond to the given value. + * @method CarbonInterface microseconds(int $value) Set current instance microsecond to the given value. + * @method CarbonInterface microsecond(int $value) Set current instance microsecond to the given value. + * @method CarbonInterface setMicroseconds(int $value) Set current instance microsecond to the given value. + * @method CarbonInterface setMicrosecond(int $value) Set current instance microsecond to the given value. + * @method CarbonInterface addYears(int $value = 1) Add years (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addYear() Add one year to the instance (using date interval). + * @method CarbonInterface subYears(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subYear() Sub one year to the instance (using date interval). + * @method CarbonInterface addYearsWithOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface addYearWithOverflow() Add one year to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface subYearsWithOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface subYearWithOverflow() Sub one year to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface addYearsWithoutOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addYearWithoutOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subYearsWithoutOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subYearWithoutOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addYearsWithNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addYearWithNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subYearsWithNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subYearWithNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addYearsNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addYearNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subYearsNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subYearNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addMonths(int $value = 1) Add months (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addMonth() Add one month to the instance (using date interval). + * @method CarbonInterface subMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subMonth() Sub one month to the instance (using date interval). + * @method CarbonInterface addMonthsWithOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface addMonthWithOverflow() Add one month to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface subMonthsWithOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface subMonthWithOverflow() Sub one month to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface addMonthsWithoutOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addMonthWithoutOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subMonthsWithoutOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subMonthWithoutOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addMonthsWithNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addMonthWithNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subMonthsWithNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subMonthWithNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addMonthsNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addMonthNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subMonthsNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subMonthNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addDays(int $value = 1) Add days (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addDay() Add one day to the instance (using date interval). + * @method CarbonInterface subDays(int $value = 1) Sub days (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subDay() Sub one day to the instance (using date interval). + * @method CarbonInterface addHours(int $value = 1) Add hours (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addHour() Add one hour to the instance (using date interval). + * @method CarbonInterface subHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subHour() Sub one hour to the instance (using date interval). + * @method CarbonInterface addMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addMinute() Add one minute to the instance (using date interval). + * @method CarbonInterface subMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subMinute() Sub one minute to the instance (using date interval). + * @method CarbonInterface addSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addSecond() Add one second to the instance (using date interval). + * @method CarbonInterface subSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subSecond() Sub one second to the instance (using date interval). + * @method CarbonInterface addMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addMilli() Add one millisecond to the instance (using date interval). + * @method CarbonInterface subMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subMilli() Sub one millisecond to the instance (using date interval). + * @method CarbonInterface addMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addMillisecond() Add one millisecond to the instance (using date interval). + * @method CarbonInterface subMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subMillisecond() Sub one millisecond to the instance (using date interval). + * @method CarbonInterface addMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addMicro() Add one microsecond to the instance (using date interval). + * @method CarbonInterface subMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subMicro() Sub one microsecond to the instance (using date interval). + * @method CarbonInterface addMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addMicrosecond() Add one microsecond to the instance (using date interval). + * @method CarbonInterface subMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subMicrosecond() Sub one microsecond to the instance (using date interval). + * @method CarbonInterface addMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addMillennium() Add one millennium to the instance (using date interval). + * @method CarbonInterface subMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subMillennium() Sub one millennium to the instance (using date interval). + * @method CarbonInterface addMillenniaWithOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface addMillenniumWithOverflow() Add one millennium to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface subMillenniaWithOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface subMillenniumWithOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface addMillenniaWithoutOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addMillenniumWithoutOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subMillenniaWithoutOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subMillenniumWithoutOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addMillenniaWithNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addMillenniumWithNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subMillenniaWithNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subMillenniumWithNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addMillenniaNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addMillenniumNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subMillenniaNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subMillenniumNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addCentury() Add one century to the instance (using date interval). + * @method CarbonInterface subCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subCentury() Sub one century to the instance (using date interval). + * @method CarbonInterface addCenturiesWithOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface addCenturyWithOverflow() Add one century to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface subCenturiesWithOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface subCenturyWithOverflow() Sub one century to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface addCenturiesWithoutOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addCenturyWithoutOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subCenturiesWithoutOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subCenturyWithoutOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addCenturiesWithNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addCenturyWithNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subCenturiesWithNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subCenturyWithNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addCenturiesNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addCenturyNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subCenturiesNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subCenturyNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addDecade() Add one decade to the instance (using date interval). + * @method CarbonInterface subDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subDecade() Sub one decade to the instance (using date interval). + * @method CarbonInterface addDecadesWithOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface addDecadeWithOverflow() Add one decade to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface subDecadesWithOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface subDecadeWithOverflow() Sub one decade to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface addDecadesWithoutOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addDecadeWithoutOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subDecadesWithoutOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subDecadeWithoutOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addDecadesWithNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addDecadeWithNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subDecadesWithNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subDecadeWithNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addDecadesNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addDecadeNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subDecadesNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subDecadeNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addQuarter() Add one quarter to the instance (using date interval). + * @method CarbonInterface subQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subQuarter() Sub one quarter to the instance (using date interval). + * @method CarbonInterface addQuartersWithOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface addQuarterWithOverflow() Add one quarter to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface subQuartersWithOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface subQuarterWithOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonInterface addQuartersWithoutOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addQuarterWithoutOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subQuartersWithoutOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subQuarterWithoutOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addQuartersWithNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addQuarterWithNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subQuartersWithNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subQuarterWithNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addQuartersNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addQuarterNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subQuartersNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface subQuarterNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonInterface addWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addWeek() Add one week to the instance (using date interval). + * @method CarbonInterface subWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subWeek() Sub one week to the instance (using date interval). + * @method CarbonInterface addWeekdays(int $value = 1) Add weekdays (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface addWeekday() Add one weekday to the instance (using date interval). + * @method CarbonInterface subWeekdays(int $value = 1) Sub weekdays (the $value count passed in) to the instance (using date interval). + * @method CarbonInterface subWeekday() Sub one weekday to the instance (using date interval). + * @method CarbonInterface addRealMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealMicro() Add one microsecond to the instance (using timestamp). + * @method CarbonInterface subRealMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealMicro() Sub one microsecond to the instance (using timestamp). + * @method CarbonPeriod microsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given. + * @method CarbonInterface addRealMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealMicrosecond() Add one microsecond to the instance (using timestamp). + * @method CarbonInterface subRealMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealMicrosecond() Sub one microsecond to the instance (using timestamp). + * @method CarbonPeriod microsecondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given. + * @method CarbonInterface addRealMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealMilli() Add one millisecond to the instance (using timestamp). + * @method CarbonInterface subRealMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealMilli() Sub one millisecond to the instance (using timestamp). + * @method CarbonPeriod millisUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given. + * @method CarbonInterface addRealMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealMillisecond() Add one millisecond to the instance (using timestamp). + * @method CarbonInterface subRealMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealMillisecond() Sub one millisecond to the instance (using timestamp). + * @method CarbonPeriod millisecondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given. + * @method CarbonInterface addRealSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealSecond() Add one second to the instance (using timestamp). + * @method CarbonInterface subRealSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealSecond() Sub one second to the instance (using timestamp). + * @method CarbonPeriod secondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each second or every X seconds if a factor is given. + * @method CarbonInterface addRealMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealMinute() Add one minute to the instance (using timestamp). + * @method CarbonInterface subRealMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealMinute() Sub one minute to the instance (using timestamp). + * @method CarbonPeriod minutesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each minute or every X minutes if a factor is given. + * @method CarbonInterface addRealHours(int $value = 1) Add hours (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealHour() Add one hour to the instance (using timestamp). + * @method CarbonInterface subRealHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealHour() Sub one hour to the instance (using timestamp). + * @method CarbonPeriod hoursUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each hour or every X hours if a factor is given. + * @method CarbonInterface addRealDays(int $value = 1) Add days (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealDay() Add one day to the instance (using timestamp). + * @method CarbonInterface subRealDays(int $value = 1) Sub days (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealDay() Sub one day to the instance (using timestamp). + * @method CarbonPeriod daysUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each day or every X days if a factor is given. + * @method CarbonInterface addRealWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealWeek() Add one week to the instance (using timestamp). + * @method CarbonInterface subRealWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealWeek() Sub one week to the instance (using timestamp). + * @method CarbonPeriod weeksUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each week or every X weeks if a factor is given. + * @method CarbonInterface addRealMonths(int $value = 1) Add months (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealMonth() Add one month to the instance (using timestamp). + * @method CarbonInterface subRealMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealMonth() Sub one month to the instance (using timestamp). + * @method CarbonPeriod monthsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each month or every X months if a factor is given. + * @method CarbonInterface addRealQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealQuarter() Add one quarter to the instance (using timestamp). + * @method CarbonInterface subRealQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealQuarter() Sub one quarter to the instance (using timestamp). + * @method CarbonPeriod quartersUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each quarter or every X quarters if a factor is given. + * @method CarbonInterface addRealYears(int $value = 1) Add years (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealYear() Add one year to the instance (using timestamp). + * @method CarbonInterface subRealYears(int $value = 1) Sub years (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealYear() Sub one year to the instance (using timestamp). + * @method CarbonPeriod yearsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each year or every X years if a factor is given. + * @method CarbonInterface addRealDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealDecade() Add one decade to the instance (using timestamp). + * @method CarbonInterface subRealDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealDecade() Sub one decade to the instance (using timestamp). + * @method CarbonPeriod decadesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each decade or every X decades if a factor is given. + * @method CarbonInterface addRealCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealCentury() Add one century to the instance (using timestamp). + * @method CarbonInterface subRealCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealCentury() Sub one century to the instance (using timestamp). + * @method CarbonPeriod centuriesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each century or every X centuries if a factor is given. + * @method CarbonInterface addRealMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface addRealMillennium() Add one millennium to the instance (using timestamp). + * @method CarbonInterface subRealMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using timestamp). + * @method CarbonInterface subRealMillennium() Sub one millennium to the instance (using timestamp). + * @method CarbonPeriod millenniaUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millennium or every X millennia if a factor is given. + * @method CarbonInterface roundYear(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. + * @method CarbonInterface roundYears(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. + * @method CarbonInterface floorYear(float $precision = 1) Truncate the current instance year with given precision. + * @method CarbonInterface floorYears(float $precision = 1) Truncate the current instance year with given precision. + * @method CarbonInterface ceilYear(float $precision = 1) Ceil the current instance year with given precision. + * @method CarbonInterface ceilYears(float $precision = 1) Ceil the current instance year with given precision. + * @method CarbonInterface roundMonth(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. + * @method CarbonInterface roundMonths(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. + * @method CarbonInterface floorMonth(float $precision = 1) Truncate the current instance month with given precision. + * @method CarbonInterface floorMonths(float $precision = 1) Truncate the current instance month with given precision. + * @method CarbonInterface ceilMonth(float $precision = 1) Ceil the current instance month with given precision. + * @method CarbonInterface ceilMonths(float $precision = 1) Ceil the current instance month with given precision. + * @method CarbonInterface roundDay(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method CarbonInterface roundDays(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method CarbonInterface floorDay(float $precision = 1) Truncate the current instance day with given precision. + * @method CarbonInterface floorDays(float $precision = 1) Truncate the current instance day with given precision. + * @method CarbonInterface ceilDay(float $precision = 1) Ceil the current instance day with given precision. + * @method CarbonInterface ceilDays(float $precision = 1) Ceil the current instance day with given precision. + * @method CarbonInterface roundHour(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. + * @method CarbonInterface roundHours(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. + * @method CarbonInterface floorHour(float $precision = 1) Truncate the current instance hour with given precision. + * @method CarbonInterface floorHours(float $precision = 1) Truncate the current instance hour with given precision. + * @method CarbonInterface ceilHour(float $precision = 1) Ceil the current instance hour with given precision. + * @method CarbonInterface ceilHours(float $precision = 1) Ceil the current instance hour with given precision. + * @method CarbonInterface roundMinute(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. + * @method CarbonInterface roundMinutes(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. + * @method CarbonInterface floorMinute(float $precision = 1) Truncate the current instance minute with given precision. + * @method CarbonInterface floorMinutes(float $precision = 1) Truncate the current instance minute with given precision. + * @method CarbonInterface ceilMinute(float $precision = 1) Ceil the current instance minute with given precision. + * @method CarbonInterface ceilMinutes(float $precision = 1) Ceil the current instance minute with given precision. + * @method CarbonInterface roundSecond(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. + * @method CarbonInterface roundSeconds(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. + * @method CarbonInterface floorSecond(float $precision = 1) Truncate the current instance second with given precision. + * @method CarbonInterface floorSeconds(float $precision = 1) Truncate the current instance second with given precision. + * @method CarbonInterface ceilSecond(float $precision = 1) Ceil the current instance second with given precision. + * @method CarbonInterface ceilSeconds(float $precision = 1) Ceil the current instance second with given precision. + * @method CarbonInterface roundMillennium(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. + * @method CarbonInterface roundMillennia(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. + * @method CarbonInterface floorMillennium(float $precision = 1) Truncate the current instance millennium with given precision. + * @method CarbonInterface floorMillennia(float $precision = 1) Truncate the current instance millennium with given precision. + * @method CarbonInterface ceilMillennium(float $precision = 1) Ceil the current instance millennium with given precision. + * @method CarbonInterface ceilMillennia(float $precision = 1) Ceil the current instance millennium with given precision. + * @method CarbonInterface roundCentury(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. + * @method CarbonInterface roundCenturies(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. + * @method CarbonInterface floorCentury(float $precision = 1) Truncate the current instance century with given precision. + * @method CarbonInterface floorCenturies(float $precision = 1) Truncate the current instance century with given precision. + * @method CarbonInterface ceilCentury(float $precision = 1) Ceil the current instance century with given precision. + * @method CarbonInterface ceilCenturies(float $precision = 1) Ceil the current instance century with given precision. + * @method CarbonInterface roundDecade(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. + * @method CarbonInterface roundDecades(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. + * @method CarbonInterface floorDecade(float $precision = 1) Truncate the current instance decade with given precision. + * @method CarbonInterface floorDecades(float $precision = 1) Truncate the current instance decade with given precision. + * @method CarbonInterface ceilDecade(float $precision = 1) Ceil the current instance decade with given precision. + * @method CarbonInterface ceilDecades(float $precision = 1) Ceil the current instance decade with given precision. + * @method CarbonInterface roundQuarter(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. + * @method CarbonInterface roundQuarters(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. + * @method CarbonInterface floorQuarter(float $precision = 1) Truncate the current instance quarter with given precision. + * @method CarbonInterface floorQuarters(float $precision = 1) Truncate the current instance quarter with given precision. + * @method CarbonInterface ceilQuarter(float $precision = 1) Ceil the current instance quarter with given precision. + * @method CarbonInterface ceilQuarters(float $precision = 1) Ceil the current instance quarter with given precision. + * @method CarbonInterface roundMillisecond(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. + * @method CarbonInterface roundMilliseconds(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. + * @method CarbonInterface floorMillisecond(float $precision = 1) Truncate the current instance millisecond with given precision. + * @method CarbonInterface floorMilliseconds(float $precision = 1) Truncate the current instance millisecond with given precision. + * @method CarbonInterface ceilMillisecond(float $precision = 1) Ceil the current instance millisecond with given precision. + * @method CarbonInterface ceilMilliseconds(float $precision = 1) Ceil the current instance millisecond with given precision. + * @method CarbonInterface roundMicrosecond(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. + * @method CarbonInterface roundMicroseconds(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. + * @method CarbonInterface floorMicrosecond(float $precision = 1) Truncate the current instance microsecond with given precision. + * @method CarbonInterface floorMicroseconds(float $precision = 1) Truncate the current instance microsecond with given precision. + * @method CarbonInterface ceilMicrosecond(float $precision = 1) Ceil the current instance microsecond with given precision. + * @method CarbonInterface ceilMicroseconds(float $precision = 1) Ceil the current instance microsecond with given precision. + * @method string shortAbsoluteDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'Absolute' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longAbsoluteDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'Absolute' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string shortRelativeDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'Relative' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longRelativeDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'Relative' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string shortRelativeToNowDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longRelativeToNowDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string shortRelativeToOtherDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longRelativeToOtherDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * + * </autodoc> + */ +trait Date +{ + use Boundaries; + use Comparison; + use Converter; + use Creator; + use Difference; + use Macro; + use MagicParameter; + use Modifiers; + use Mutability; + use ObjectInitialisation; + use Options; + use Rounding; + use Serialization; + use Test; + use Timestamp; + use Units; + use Week; + + /** + * Names of days of the week. + * + * @var array + */ + protected static $days = [ + // @call isDayOfWeek + CarbonInterface::SUNDAY => 'Sunday', + // @call isDayOfWeek + CarbonInterface::MONDAY => 'Monday', + // @call isDayOfWeek + CarbonInterface::TUESDAY => 'Tuesday', + // @call isDayOfWeek + CarbonInterface::WEDNESDAY => 'Wednesday', + // @call isDayOfWeek + CarbonInterface::THURSDAY => 'Thursday', + // @call isDayOfWeek + CarbonInterface::FRIDAY => 'Friday', + // @call isDayOfWeek + CarbonInterface::SATURDAY => 'Saturday', + ]; + + /** + * Will UTF8 encoding be used to print localized date/time ? + * + * @var bool + */ + protected static $utf8 = false; + + /** + * List of unit and magic methods associated as doc-comments. + * + * @var array + */ + protected static $units = [ + // @call setUnit + // @call addUnit + 'year', + // @call setUnit + // @call addUnit + 'month', + // @call setUnit + // @call addUnit + 'day', + // @call setUnit + // @call addUnit + 'hour', + // @call setUnit + // @call addUnit + 'minute', + // @call setUnit + // @call addUnit + 'second', + // @call setUnit + // @call addUnit + 'milli', + // @call setUnit + // @call addUnit + 'millisecond', + // @call setUnit + // @call addUnit + 'micro', + // @call setUnit + // @call addUnit + 'microsecond', + ]; + + /** + * Creates a DateTimeZone from a string, DateTimeZone or integer offset. + * + * @param DateTimeZone|string|int|null $object original value to get CarbonTimeZone from it. + * @param DateTimeZone|string|int|null $objectDump dump of the object for error messages. + * + * @throws InvalidTimeZoneException + * + * @return CarbonTimeZone|false + */ + protected static function safeCreateDateTimeZone($object, $objectDump = null) + { + return CarbonTimeZone::instance($object, $objectDump); + } + + /** + * Get the TimeZone associated with the Carbon instance (as CarbonTimeZone). + * + * @return CarbonTimeZone + * + * @link https://php.net/manual/en/datetime.gettimezone.php + */ + #[ReturnTypeWillChange] + public function getTimezone() + { + return CarbonTimeZone::instance(parent::getTimezone()); + } + + /** + * List of minimum and maximums for each unit. + * + * @param int $daysInMonth + * + * @return array + */ + protected static function getRangesByUnit(int $daysInMonth = 31): array + { + return [ + // @call roundUnit + 'year' => [1, 9999], + // @call roundUnit + 'month' => [1, static::MONTHS_PER_YEAR], + // @call roundUnit + 'day' => [1, $daysInMonth], + // @call roundUnit + 'hour' => [0, static::HOURS_PER_DAY - 1], + // @call roundUnit + 'minute' => [0, static::MINUTES_PER_HOUR - 1], + // @call roundUnit + 'second' => [0, static::SECONDS_PER_MINUTE - 1], + ]; + } + + /** + * Get a copy of the instance. + * + * @return static + */ + public function copy() + { + return clone $this; + } + + /** + * @alias copy + * + * Get a copy of the instance. + * + * @return static + */ + public function clone() + { + return clone $this; + } + + /** + * Clone the current instance if it's mutable. + * + * This method is convenient to ensure you don't mutate the initial object + * but avoid to make a useless copy of it if it's already immutable. + * + * @return static + */ + public function avoidMutation(): self + { + if ($this instanceof DateTimeImmutable) { + return $this; + } + + return clone $this; + } + + /** + * Returns a present instance in the same timezone. + * + * @return static + */ + public function nowWithSameTz() + { + return static::now($this->getTimezone()); + } + + /** + * Throws an exception if the given object is not a DateTime and does not implement DateTimeInterface. + * + * @param mixed $date + * @param string|array $other + * + * @throws InvalidTypeException + */ + protected static function expectDateTime($date, $other = []) + { + $message = 'Expected '; + foreach ((array) $other as $expect) { + $message .= "$expect, "; + } + + if (!$date instanceof DateTime && !$date instanceof DateTimeInterface) { + throw new InvalidTypeException( + $message.'DateTime or DateTimeInterface, '. + (\is_object($date) ? \get_class($date) : \gettype($date)).' given' + ); + } + } + + /** + * Return the Carbon instance passed through, a now instance in the same timezone + * if null given or parse the input if string given. + * + * @param Carbon|DateTimeInterface|string|null $date + * + * @return static + */ + protected function resolveCarbon($date = null) + { + if (!$date) { + return $this->nowWithSameTz(); + } + + if (\is_string($date)) { + return static::parse($date, $this->getTimezone()); + } + + static::expectDateTime($date, ['null', 'string']); + + return $date instanceof self ? $date : static::instance($date); + } + + /** + * Return the Carbon instance passed through, a now instance in UTC + * if null given or parse the input if string given (using current timezone + * then switching to UTC). + * + * @param Carbon|DateTimeInterface|string|null $date + * + * @return static + */ + protected function resolveUTC($date = null): self + { + if (!$date) { + return static::now('UTC'); + } + + if (\is_string($date)) { + return static::parse($date, $this->getTimezone())->utc(); + } + + static::expectDateTime($date, ['null', 'string']); + + return $date instanceof self ? $date : static::instance($date)->utc(); + } + + /** + * Return the Carbon instance passed through, a now instance in the same timezone + * if null given or parse the input if string given. + * + * @param Carbon|\Carbon\CarbonPeriod|\Carbon\CarbonInterval|\DateInterval|\DatePeriod|DateTimeInterface|string|null $date + * + * @return static + */ + public function carbonize($date = null) + { + if ($date instanceof DateInterval) { + return $this->avoidMutation()->add($date); + } + + if ($date instanceof DatePeriod || $date instanceof CarbonPeriod) { + $date = $date->getStartDate(); + } + + return $this->resolveCarbon($date); + } + + /////////////////////////////////////////////////////////////////// + ///////////////////////// GETTERS AND SETTERS ///////////////////// + /////////////////////////////////////////////////////////////////// + + /** + * Get a part of the Carbon object + * + * @param string $name + * + * @throws UnknownGetterException + * + * @return string|int|bool|DateTimeZone|null + */ + public function __get($name) + { + return $this->get($name); + } + + /** + * Get a part of the Carbon object + * + * @param string $name + * + * @throws UnknownGetterException + * + * @return string|int|bool|DateTimeZone|null + */ + public function get($name) + { + static $formats = [ + // @property int + 'year' => 'Y', + // @property int + 'yearIso' => 'o', + // @property int + // @call isSameUnit + 'month' => 'n', + // @property int + 'day' => 'j', + // @property int + 'hour' => 'G', + // @property int + 'minute' => 'i', + // @property int + 'second' => 's', + // @property int + 'micro' => 'u', + // @property int + 'microsecond' => 'u', + // @property-read int 0 (for Sunday) through 6 (for Saturday) + 'dayOfWeek' => 'w', + // @property-read int 1 (for Monday) through 7 (for Sunday) + 'dayOfWeekIso' => 'N', + // @property-read int ISO-8601 week number of year, weeks starting on Monday + 'weekOfYear' => 'W', + // @property-read int number of days in the given month + 'daysInMonth' => 't', + // @property int|float|string seconds since the Unix Epoch + 'timestamp' => 'U', + // @property-read string "am"/"pm" (Ante meridiem or Post meridiem latin lowercase mark) + 'latinMeridiem' => 'a', + // @property-read string "AM"/"PM" (Ante meridiem or Post meridiem latin uppercase mark) + 'latinUpperMeridiem' => 'A', + // @property string the day of week in English + 'englishDayOfWeek' => 'l', + // @property string the abbreviated day of week in English + 'shortEnglishDayOfWeek' => 'D', + // @property string the month in English + 'englishMonth' => 'F', + // @property string the abbreviated month in English + 'shortEnglishMonth' => 'M', + // @property string the day of week in current locale LC_TIME + // @deprecated + // reason: It uses OS language package and strftime() which is deprecated since PHP 8.1. + // replacement: Use ->isoFormat('MMM') instead. + // since: 2.55.0 + 'localeDayOfWeek' => '%A', + // @property string the abbreviated day of week in current locale LC_TIME + // @deprecated + // reason: It uses OS language package and strftime() which is deprecated since PHP 8.1. + // replacement: Use ->isoFormat('dddd') instead. + // since: 2.55.0 + 'shortLocaleDayOfWeek' => '%a', + // @property string the month in current locale LC_TIME + // @deprecated + // reason: It uses OS language package and strftime() which is deprecated since PHP 8.1. + // replacement: Use ->isoFormat('ddd') instead. + // since: 2.55.0 + 'localeMonth' => '%B', + // @property string the abbreviated month in current locale LC_TIME + // @deprecated + // reason: It uses OS language package and strftime() which is deprecated since PHP 8.1. + // replacement: Use ->isoFormat('MMMM') instead. + // since: 2.55.0 + 'shortLocaleMonth' => '%b', + // @property-read string $timezoneAbbreviatedName the current timezone abbreviated name + 'timezoneAbbreviatedName' => 'T', + // @property-read string $tzAbbrName alias of $timezoneAbbreviatedName + 'tzAbbrName' => 'T', + ]; + + switch (true) { + case isset($formats[$name]): + $format = $formats[$name]; + $method = str_starts_with($format, '%') ? 'formatLocalized' : 'rawFormat'; + $value = $this->$method($format); + + return is_numeric($value) ? (int) $value : $value; + + // @property-read string long name of weekday translated according to Carbon locale, in english if no translation available for current language + case $name === 'dayName': + return $this->getTranslatedDayName(); + // @property-read string short name of weekday translated according to Carbon locale, in english if no translation available for current language + case $name === 'shortDayName': + return $this->getTranslatedShortDayName(); + // @property-read string very short name of weekday translated according to Carbon locale, in english if no translation available for current language + case $name === 'minDayName': + return $this->getTranslatedMinDayName(); + // @property-read string long name of month translated according to Carbon locale, in english if no translation available for current language + case $name === 'monthName': + return $this->getTranslatedMonthName(); + // @property-read string short name of month translated according to Carbon locale, in english if no translation available for current language + case $name === 'shortMonthName': + return $this->getTranslatedShortMonthName(); + // @property-read string lowercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language + case $name === 'meridiem': + return $this->meridiem(true); + // @property-read string uppercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language + case $name === 'upperMeridiem': + return $this->meridiem(); + // @property-read int current hour from 1 to 24 + case $name === 'noZeroHour': + return $this->hour ?: 24; + // @property int + case $name === 'milliseconds': + // @property int + case $name === 'millisecond': + // @property int + case $name === 'milli': + return (int) floor(((int) $this->rawFormat('u')) / 1000); + + // @property int 1 through 53 + case $name === 'week': + return (int) $this->week(); + + // @property int 1 through 53 + case $name === 'isoWeek': + return (int) $this->isoWeek(); + + // @property int year according to week format + case $name === 'weekYear': + return (int) $this->weekYear(); + + // @property int year according to ISO week format + case $name === 'isoWeekYear': + return (int) $this->isoWeekYear(); + + // @property-read int 51 through 53 + case $name === 'weeksInYear': + return $this->weeksInYear(); + + // @property-read int 51 through 53 + case $name === 'isoWeeksInYear': + return $this->isoWeeksInYear(); + + // @property-read int 1 through 5 + case $name === 'weekOfMonth': + return (int) ceil($this->day / static::DAYS_PER_WEEK); + + // @property-read int 1 through 5 + case $name === 'weekNumberInMonth': + return (int) ceil(($this->day + $this->avoidMutation()->startOfMonth()->dayOfWeekIso - 1) / static::DAYS_PER_WEEK); + + // @property-read int 0 through 6 + case $name === 'firstWeekDay': + return $this->localTranslator ? ($this->getTranslationMessage('first_day_of_week') ?? 0) : static::getWeekStartsAt(); + + // @property-read int 0 through 6 + case $name === 'lastWeekDay': + return $this->localTranslator ? (($this->getTranslationMessage('first_day_of_week') ?? 0) + static::DAYS_PER_WEEK - 1) % static::DAYS_PER_WEEK : static::getWeekEndsAt(); + + // @property int 1 through 366 + case $name === 'dayOfYear': + return 1 + (int) ($this->rawFormat('z')); + + // @property-read int 365 or 366 + case $name === 'daysInYear': + return $this->isLeapYear() ? 366 : 365; + + // @property int does a diffInYears() with default parameters + case $name === 'age': + return $this->diffInYears(); + + // @property-read int the quarter of this instance, 1 - 4 + // @call isSameUnit + case $name === 'quarter': + return (int) ceil($this->month / static::MONTHS_PER_QUARTER); + + // @property-read int the decade of this instance + // @call isSameUnit + case $name === 'decade': + return (int) ceil($this->year / static::YEARS_PER_DECADE); + + // @property-read int the century of this instance + // @call isSameUnit + case $name === 'century': + $factor = 1; + $year = $this->year; + if ($year < 0) { + $year = -$year; + $factor = -1; + } + + return (int) ($factor * ceil($year / static::YEARS_PER_CENTURY)); + + // @property-read int the millennium of this instance + // @call isSameUnit + case $name === 'millennium': + $factor = 1; + $year = $this->year; + if ($year < 0) { + $year = -$year; + $factor = -1; + } + + return (int) ($factor * ceil($year / static::YEARS_PER_MILLENNIUM)); + + // @property int the timezone offset in seconds from UTC + case $name === 'offset': + return $this->getOffset(); + + // @property int the timezone offset in minutes from UTC + case $name === 'offsetMinutes': + return $this->getOffset() / static::SECONDS_PER_MINUTE; + + // @property int the timezone offset in hours from UTC + case $name === 'offsetHours': + return $this->getOffset() / static::SECONDS_PER_MINUTE / static::MINUTES_PER_HOUR; + + // @property-read bool daylight savings time indicator, true if DST, false otherwise + case $name === 'dst': + return $this->rawFormat('I') === '1'; + + // @property-read bool checks if the timezone is local, true if local, false otherwise + case $name === 'local': + return $this->getOffset() === $this->avoidMutation()->setTimezone(date_default_timezone_get())->getOffset(); + + // @property-read bool checks if the timezone is UTC, true if UTC, false otherwise + case $name === 'utc': + return $this->getOffset() === 0; + + // @property CarbonTimeZone $timezone the current timezone + // @property CarbonTimeZone $tz alias of $timezone + case $name === 'timezone' || $name === 'tz': + return CarbonTimeZone::instance($this->getTimezone()); + + // @property-read string $timezoneName the current timezone name + // @property-read string $tzName alias of $timezoneName + case $name === 'timezoneName' || $name === 'tzName': + return $this->getTimezone()->getName(); + + // @property-read string locale of the current instance + case $name === 'locale': + return $this->getTranslatorLocale(); + + default: + $macro = $this->getLocalMacro('get'.ucfirst($name)); + + if ($macro) { + return $this->executeCallableWithContext($macro); + } + + throw new UnknownGetterException($name); + } + } + + /** + * Check if an attribute exists on the object + * + * @param string $name + * + * @return bool + */ + public function __isset($name) + { + try { + $this->__get($name); + } catch (UnknownGetterException | ReflectionException $e) { + return false; + } + + return true; + } + + /** + * Set a part of the Carbon object + * + * @param string $name + * @param string|int|DateTimeZone $value + * + * @throws UnknownSetterException|ReflectionException + * + * @return void + */ + public function __set($name, $value) + { + if ($this->constructedObjectId === spl_object_hash($this)) { + $this->set($name, $value); + + return; + } + + $this->$name = $value; + } + + /** + * Set a part of the Carbon object + * + * @param string|array $name + * @param string|int|DateTimeZone $value + * + * @throws ImmutableException|UnknownSetterException + * + * @return $this + */ + public function set($name, $value = null) + { + if ($this->isImmutable()) { + throw new ImmutableException(sprintf('%s class', static::class)); + } + + if (\is_array($name)) { + foreach ($name as $key => $value) { + $this->set($key, $value); + } + + return $this; + } + + switch ($name) { + case 'milliseconds': + case 'millisecond': + case 'milli': + case 'microseconds': + case 'microsecond': + case 'micro': + if (str_starts_with($name, 'milli')) { + $value *= 1000; + } + + while ($value < 0) { + $this->subSecond(); + $value += static::MICROSECONDS_PER_SECOND; + } + + while ($value >= static::MICROSECONDS_PER_SECOND) { + $this->addSecond(); + $value -= static::MICROSECONDS_PER_SECOND; + } + + $this->modify($this->rawFormat('H:i:s.').str_pad((string) round($value), 6, '0', STR_PAD_LEFT)); + + break; + + case 'year': + case 'month': + case 'day': + case 'hour': + case 'minute': + case 'second': + [$year, $month, $day, $hour, $minute, $second] = array_map('intval', explode('-', $this->rawFormat('Y-n-j-G-i-s'))); + $$name = $value; + $this->setDateTime($year, $month, $day, $hour, $minute, $second); + + break; + + case 'week': + $this->week($value); + + break; + + case 'isoWeek': + $this->isoWeek($value); + + break; + + case 'weekYear': + $this->weekYear($value); + + break; + + case 'isoWeekYear': + $this->isoWeekYear($value); + + break; + + case 'dayOfYear': + $this->addDays($value - $this->dayOfYear); + + break; + + case 'timestamp': + $this->setTimestamp($value); + + break; + + case 'offset': + $this->setTimezone(static::safeCreateDateTimeZone($value / static::SECONDS_PER_MINUTE / static::MINUTES_PER_HOUR)); + + break; + + case 'offsetMinutes': + $this->setTimezone(static::safeCreateDateTimeZone($value / static::MINUTES_PER_HOUR)); + + break; + + case 'offsetHours': + $this->setTimezone(static::safeCreateDateTimeZone($value)); + + break; + + case 'timezone': + case 'tz': + $this->setTimezone($value); + + break; + + default: + $macro = $this->getLocalMacro('set'.ucfirst($name)); + + if ($macro) { + $this->executeCallableWithContext($macro, $value); + + break; + } + + if ($this->localStrictModeEnabled ?? static::isStrictModeEnabled()) { + throw new UnknownSetterException($name); + } + + $this->$name = $value; + } + + return $this; + } + + protected function getTranslatedFormByRegExp($baseKey, $keySuffix, $context, $subKey, $defaultValue) + { + $key = $baseKey.$keySuffix; + $standaloneKey = "{$key}_standalone"; + $baseTranslation = $this->getTranslationMessage($key); + + if ($baseTranslation instanceof Closure) { + return $baseTranslation($this, $context, $subKey) ?: $defaultValue; + } + + if ( + $this->getTranslationMessage("$standaloneKey.$subKey") && + (!$context || (($regExp = $this->getTranslationMessage("{$baseKey}_regexp")) && !preg_match($regExp, $context))) + ) { + $key = $standaloneKey; + } + + return $this->getTranslationMessage("$key.$subKey", null, $defaultValue); + } + + /** + * Get the translation of the current week day name (with context for languages with multiple forms). + * + * @param string|null $context whole format string + * @param string $keySuffix "", "_short" or "_min" + * @param string|null $defaultValue default value if translation missing + * + * @return string + */ + public function getTranslatedDayName($context = null, $keySuffix = '', $defaultValue = null) + { + return $this->getTranslatedFormByRegExp('weekdays', $keySuffix, $context, $this->dayOfWeek, $defaultValue ?: $this->englishDayOfWeek); + } + + /** + * Get the translation of the current short week day name (with context for languages with multiple forms). + * + * @param string|null $context whole format string + * + * @return string + */ + public function getTranslatedShortDayName($context = null) + { + return $this->getTranslatedDayName($context, '_short', $this->shortEnglishDayOfWeek); + } + + /** + * Get the translation of the current abbreviated week day name (with context for languages with multiple forms). + * + * @param string|null $context whole format string + * + * @return string + */ + public function getTranslatedMinDayName($context = null) + { + return $this->getTranslatedDayName($context, '_min', $this->shortEnglishDayOfWeek); + } + + /** + * Get the translation of the current month day name (with context for languages with multiple forms). + * + * @param string|null $context whole format string + * @param string $keySuffix "" or "_short" + * @param string|null $defaultValue default value if translation missing + * + * @return string + */ + public function getTranslatedMonthName($context = null, $keySuffix = '', $defaultValue = null) + { + return $this->getTranslatedFormByRegExp('months', $keySuffix, $context, $this->month - 1, $defaultValue ?: $this->englishMonth); + } + + /** + * Get the translation of the current short month day name (with context for languages with multiple forms). + * + * @param string|null $context whole format string + * + * @return string + */ + public function getTranslatedShortMonthName($context = null) + { + return $this->getTranslatedMonthName($context, '_short', $this->shortEnglishMonth); + } + + /** + * Get/set the day of year. + * + * @param int|null $value new value for day of year if using as setter. + * + * @return static|int + */ + public function dayOfYear($value = null) + { + $dayOfYear = $this->dayOfYear; + + return $value === null ? $dayOfYear : $this->addDays($value - $dayOfYear); + } + + /** + * Get/set the weekday from 0 (Sunday) to 6 (Saturday). + * + * @param int|null $value new value for weekday if using as setter. + * + * @return static|int + */ + public function weekday($value = null) + { + if ($value === null) { + return $this->dayOfWeek; + } + + $firstDay = (int) ($this->getTranslationMessage('first_day_of_week') ?? 0); + $dayOfWeek = ($this->dayOfWeek + 7 - $firstDay) % 7; + + return $this->addDays((($value + 7 - $firstDay) % 7) - $dayOfWeek); + } + + /** + * Get/set the ISO weekday from 1 (Monday) to 7 (Sunday). + * + * @param int|null $value new value for weekday if using as setter. + * + * @return static|int + */ + public function isoWeekday($value = null) + { + $dayOfWeekIso = $this->dayOfWeekIso; + + return $value === null ? $dayOfWeekIso : $this->addDays($value - $dayOfWeekIso); + } + + /** + * Return the number of days since the start of the week (using the current locale or the first parameter + * if explicitly given). + * + * @param int|null $weekStartsAt optional start allow you to specify the day of week to use to start the week, + * if not provided, start of week is inferred from the locale + * (Sunday for en_US, Monday for de_DE, etc.) + * + * @return int + */ + public function getDaysFromStartOfWeek(int $weekStartsAt = null): int + { + $firstDay = (int) ($weekStartsAt ?? $this->getTranslationMessage('first_day_of_week') ?? 0); + + return ($this->dayOfWeek + 7 - $firstDay) % 7; + } + + /** + * Set the day (keeping the current time) to the start of the week + the number of days passed as the first + * parameter. First day of week is driven by the locale unless explicitly set with the second parameter. + * + * @param int $numberOfDays number of days to add after the start of the current week + * @param int|null $weekStartsAt optional start allow you to specify the day of week to use to start the week, + * if not provided, start of week is inferred from the locale + * (Sunday for en_US, Monday for de_DE, etc.) + * + * @return static + */ + public function setDaysFromStartOfWeek(int $numberOfDays, int $weekStartsAt = null) + { + return $this->addDays($numberOfDays - $this->getDaysFromStartOfWeek($weekStartsAt)); + } + + /** + * Set any unit to a new value without overflowing current other unit given. + * + * @param string $valueUnit unit name to modify + * @param int $value new value for the input unit + * @param string $overflowUnit unit name to not overflow + * + * @return static + */ + public function setUnitNoOverflow($valueUnit, $value, $overflowUnit) + { + try { + $original = $this->avoidMutation(); + /** @var static $date */ + $date = $this->$valueUnit($value); + $end = $original->avoidMutation()->endOf($overflowUnit); + $start = $original->avoidMutation()->startOf($overflowUnit); + if ($date < $start) { + $date = $date->setDateTimeFrom($start); + } elseif ($date > $end) { + $date = $date->setDateTimeFrom($end); + } + + return $date; + } catch (BadMethodCallException | ReflectionException $exception) { + throw new UnknownUnitException($valueUnit, 0, $exception); + } + } + + /** + * Add any unit to a new value without overflowing current other unit given. + * + * @param string $valueUnit unit name to modify + * @param int $value amount to add to the input unit + * @param string $overflowUnit unit name to not overflow + * + * @return static + */ + public function addUnitNoOverflow($valueUnit, $value, $overflowUnit) + { + return $this->setUnitNoOverflow($valueUnit, $this->$valueUnit + $value, $overflowUnit); + } + + /** + * Subtract any unit to a new value without overflowing current other unit given. + * + * @param string $valueUnit unit name to modify + * @param int $value amount to subtract to the input unit + * @param string $overflowUnit unit name to not overflow + * + * @return static + */ + public function subUnitNoOverflow($valueUnit, $value, $overflowUnit) + { + return $this->setUnitNoOverflow($valueUnit, $this->$valueUnit - $value, $overflowUnit); + } + + /** + * Returns the minutes offset to UTC if no arguments passed, else set the timezone with given minutes shift passed. + * + * @param int|null $minuteOffset + * + * @return int|static + */ + public function utcOffset(int $minuteOffset = null) + { + if (\func_num_args() < 1) { + return $this->offsetMinutes; + } + + return $this->setTimezone(CarbonTimeZone::createFromMinuteOffset($minuteOffset)); + } + + /** + * Set the date with gregorian year, month and day numbers. + * + * @see https://php.net/manual/en/datetime.setdate.php + * + * @param int $year + * @param int $month + * @param int $day + * + * @return static + */ + #[ReturnTypeWillChange] + public function setDate($year, $month, $day) + { + return parent::setDate((int) $year, (int) $month, (int) $day); + } + + /** + * Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates. + * + * @see https://php.net/manual/en/datetime.setisodate.php + * + * @param int $year + * @param int $week + * @param int $day + * + * @return static + */ + #[ReturnTypeWillChange] + public function setISODate($year, $week, $day = 1) + { + return parent::setISODate((int) $year, (int) $week, (int) $day); + } + + /** + * Set the date and time all together. + * + * @param int $year + * @param int $month + * @param int $day + * @param int $hour + * @param int $minute + * @param int $second + * @param int $microseconds + * + * @return static + */ + public function setDateTime($year, $month, $day, $hour, $minute, $second = 0, $microseconds = 0) + { + return $this->setDate($year, $month, $day)->setTime((int) $hour, (int) $minute, (int) $second, (int) $microseconds); + } + + /** + * Resets the current time of the DateTime object to a different time. + * + * @see https://php.net/manual/en/datetime.settime.php + * + * @param int $hour + * @param int $minute + * @param int $second + * @param int $microseconds + * + * @return static + */ + #[ReturnTypeWillChange] + public function setTime($hour, $minute, $second = 0, $microseconds = 0) + { + return parent::setTime((int) $hour, (int) $minute, (int) $second, (int) $microseconds); + } + + /** + * Set the instance's timestamp. + * + * Timestamp input can be given as int, float or a string containing one or more numbers. + * + * @param float|int|string $unixTimestamp + * + * @return static + */ + #[ReturnTypeWillChange] + public function setTimestamp($unixTimestamp) + { + [$timestamp, $microseconds] = self::getIntegerAndDecimalParts($unixTimestamp); + + return parent::setTimestamp((int) $timestamp)->setMicroseconds((int) $microseconds); + } + + /** + * Set the time by time string. + * + * @param string $time + * + * @return static + */ + public function setTimeFromTimeString($time) + { + if (!str_contains($time, ':')) { + $time .= ':0'; + } + + return $this->modify($time); + } + + /** + * @alias setTimezone + * + * @param DateTimeZone|string $value + * + * @return static + */ + public function timezone($value) + { + return $this->setTimezone($value); + } + + /** + * Set the timezone or returns the timezone name if no arguments passed. + * + * @param DateTimeZone|string $value + * + * @return static|string + */ + public function tz($value = null) + { + if (\func_num_args() < 1) { + return $this->tzName; + } + + return $this->setTimezone($value); + } + + /** + * Set the instance's timezone from a string or object. + * + * @param DateTimeZone|string $value + * + * @return static + */ + #[ReturnTypeWillChange] + public function setTimezone($value) + { + $tz = static::safeCreateDateTimeZone($value); + + if ($tz === false && !self::isStrictModeEnabled()) { + $tz = new CarbonTimeZone(); + } + + return parent::setTimezone($tz); + } + + /** + * Set the instance's timezone from a string or object and add/subtract the offset difference. + * + * @param DateTimeZone|string $value + * + * @return static + */ + public function shiftTimezone($value) + { + $dateTimeString = $this->format('Y-m-d H:i:s.u'); + + return $this + ->setTimezone($value) + ->modify($dateTimeString); + } + + /** + * Set the instance's timezone to UTC. + * + * @return static + */ + public function utc() + { + return $this->setTimezone('UTC'); + } + + /** + * Set the year, month, and date for this instance to that of the passed instance. + * + * @param Carbon|DateTimeInterface $date now if null + * + * @return static + */ + public function setDateFrom($date = null) + { + $date = $this->resolveCarbon($date); + + return $this->setDate($date->year, $date->month, $date->day); + } + + /** + * Set the hour, minute, second and microseconds for this instance to that of the passed instance. + * + * @param Carbon|DateTimeInterface $date now if null + * + * @return static + */ + public function setTimeFrom($date = null) + { + $date = $this->resolveCarbon($date); + + return $this->setTime($date->hour, $date->minute, $date->second, $date->microsecond); + } + + /** + * Set the date and time for this instance to that of the passed instance. + * + * @param Carbon|DateTimeInterface $date + * + * @return static + */ + public function setDateTimeFrom($date = null) + { + $date = $this->resolveCarbon($date); + + return $this->modify($date->rawFormat('Y-m-d H:i:s.u')); + } + + /** + * Get the days of the week + * + * @return array + */ + public static function getDays() + { + return static::$days; + } + + /////////////////////////////////////////////////////////////////// + /////////////////////// WEEK SPECIAL DAYS ///////////////////////// + /////////////////////////////////////////////////////////////////// + + private static function getFirstDayOfWeek(): int + { + return (int) static::getTranslationMessageWith( + static::getTranslator(), + 'first_day_of_week' + ); + } + + /** + * Get the first day of week + * + * @return int + */ + public static function getWeekStartsAt() + { + if (static::$weekStartsAt === static::WEEK_DAY_AUTO) { + return self::getFirstDayOfWeek(); + } + + return static::$weekStartsAt; + } + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * Use $weekEndsAt optional parameter instead when using endOfWeek method. You can also use the + * 'first_day_of_week' locale setting to change the start of week according to current locale + * selected and implicitly the end of week. + * + * Set the first day of week + * + * @param int|string $day week start day (or 'auto' to get the first day of week from Carbon::getLocale() culture). + * + * @return void + */ + public static function setWeekStartsAt($day) + { + static::$weekStartsAt = $day === static::WEEK_DAY_AUTO ? $day : max(0, (7 + $day) % 7); + } + + /** + * Get the last day of week + * + * @return int + */ + public static function getWeekEndsAt() + { + if (static::$weekStartsAt === static::WEEK_DAY_AUTO) { + return (int) (static::DAYS_PER_WEEK - 1 + self::getFirstDayOfWeek()) % static::DAYS_PER_WEEK; + } + + return static::$weekEndsAt; + } + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * Use $weekStartsAt optional parameter instead when using startOfWeek, floorWeek, ceilWeek + * or roundWeek method. You can also use the 'first_day_of_week' locale setting to change the + * start of week according to current locale selected and implicitly the end of week. + * + * Set the last day of week + * + * @param int|string $day week end day (or 'auto' to get the day before the first day of week + * from Carbon::getLocale() culture). + * + * @return void + */ + public static function setWeekEndsAt($day) + { + static::$weekEndsAt = $day === static::WEEK_DAY_AUTO ? $day : max(0, (7 + $day) % 7); + } + + /** + * Get weekend days + * + * @return array + */ + public static function getWeekendDays() + { + return static::$weekendDays; + } + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather consider week-end is always saturday and sunday, and if you have some custom + * week-end days to handle, give to those days an other name and create a macro for them: + * + * ``` + * Carbon::macro('isDayOff', function ($date) { + * return $date->isSunday() || $date->isMonday(); + * }); + * Carbon::macro('isNotDayOff', function ($date) { + * return !$date->isDayOff(); + * }); + * if ($someDate->isDayOff()) ... + * if ($someDate->isNotDayOff()) ... + * // Add 5 not-off days + * $count = 5; + * while ($someDate->isDayOff() || ($count-- > 0)) { + * $someDate->addDay(); + * } + * ``` + * + * Set weekend days + * + * @param array $days + * + * @return void + */ + public static function setWeekendDays($days) + { + static::$weekendDays = $days; + } + + /** + * Determine if a time string will produce a relative date. + * + * @param string $time + * + * @return bool true if time match a relative date, false if absolute or invalid time string + */ + public static function hasRelativeKeywords($time) + { + if (!$time || strtotime($time) === false) { + return false; + } + + $date1 = new DateTime('2000-01-01T00:00:00Z'); + $date1->modify($time); + $date2 = new DateTime('2001-12-25T00:00:00Z'); + $date2->modify($time); + + return $date1 != $date2; + } + + /////////////////////////////////////////////////////////////////// + /////////////////////// STRING FORMATTING ///////////////////////// + /////////////////////////////////////////////////////////////////// + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use UTF-8 language packages on every machine. + * + * Set if UTF8 will be used for localized date/time. + * + * @param bool $utf8 + */ + public static function setUtf8($utf8) + { + static::$utf8 = $utf8; + } + + /** + * Format the instance with the current locale. You can set the current + * locale using setlocale() https://php.net/setlocale. + * + * @deprecated It uses OS language package and strftime() which is deprecated since PHP 8.1. + * Use ->isoFormat() instead. + * Deprecated since 2.55.0 + * + * @param string $format + * + * @return string + */ + public function formatLocalized($format) + { + // Check for Windows to find and replace the %e modifier correctly. + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + $format = preg_replace('#(?<!%)((?:%%)*)%e#', '\1%#d', $format); // @codeCoverageIgnore + } + + $time = strtotime($this->toDateTimeString()); + $formatted = ($this->localStrictModeEnabled ?? static::isStrictModeEnabled()) + ? strftime($format, $time) + : @strftime($format, $time); + + return static::$utf8 + ? ( + \function_exists('mb_convert_encoding') + ? mb_convert_encoding($formatted, 'UTF-8', mb_list_encodings()) + : utf8_encode($formatted) + ) + : $formatted; + } + + /** + * Returns list of locale formats for ISO formatting. + * + * @param string|null $locale current locale used if null + * + * @return array + */ + public function getIsoFormats($locale = null) + { + return [ + 'LT' => $this->getTranslationMessage('formats.LT', $locale, 'h:mm A'), + 'LTS' => $this->getTranslationMessage('formats.LTS', $locale, 'h:mm:ss A'), + 'L' => $this->getTranslationMessage('formats.L', $locale, 'MM/DD/YYYY'), + 'LL' => $this->getTranslationMessage('formats.LL', $locale, 'MMMM D, YYYY'), + 'LLL' => $this->getTranslationMessage('formats.LLL', $locale, 'MMMM D, YYYY h:mm A'), + 'LLLL' => $this->getTranslationMessage('formats.LLLL', $locale, 'dddd, MMMM D, YYYY h:mm A'), + 'l' => $this->getTranslationMessage('formats.l', $locale), + 'll' => $this->getTranslationMessage('formats.ll', $locale), + 'lll' => $this->getTranslationMessage('formats.lll', $locale), + 'llll' => $this->getTranslationMessage('formats.llll', $locale), + ]; + } + + /** + * Returns list of calendar formats for ISO formatting. + * + * @param string|null $locale current locale used if null + * + * @return array + */ + public function getCalendarFormats($locale = null) + { + return [ + 'sameDay' => $this->getTranslationMessage('calendar.sameDay', $locale, '[Today at] LT'), + 'nextDay' => $this->getTranslationMessage('calendar.nextDay', $locale, '[Tomorrow at] LT'), + 'nextWeek' => $this->getTranslationMessage('calendar.nextWeek', $locale, 'dddd [at] LT'), + 'lastDay' => $this->getTranslationMessage('calendar.lastDay', $locale, '[Yesterday at] LT'), + 'lastWeek' => $this->getTranslationMessage('calendar.lastWeek', $locale, '[Last] dddd [at] LT'), + 'sameElse' => $this->getTranslationMessage('calendar.sameElse', $locale, 'L'), + ]; + } + + /** + * Returns list of locale units for ISO formatting. + * + * @return array + */ + public static function getIsoUnits() + { + static $units = null; + + if ($units === null) { + $units = [ + 'OD' => ['getAltNumber', ['day']], + 'OM' => ['getAltNumber', ['month']], + 'OY' => ['getAltNumber', ['year']], + 'OH' => ['getAltNumber', ['hour']], + 'Oh' => ['getAltNumber', ['h']], + 'Om' => ['getAltNumber', ['minute']], + 'Os' => ['getAltNumber', ['second']], + 'D' => 'day', + 'DD' => ['rawFormat', ['d']], + 'Do' => ['ordinal', ['day', 'D']], + 'd' => 'dayOfWeek', + 'dd' => function (CarbonInterface $date, $originalFormat = null) { + return $date->getTranslatedMinDayName($originalFormat); + }, + 'ddd' => function (CarbonInterface $date, $originalFormat = null) { + return $date->getTranslatedShortDayName($originalFormat); + }, + 'dddd' => function (CarbonInterface $date, $originalFormat = null) { + return $date->getTranslatedDayName($originalFormat); + }, + 'DDD' => 'dayOfYear', + 'DDDD' => ['getPaddedUnit', ['dayOfYear', 3]], + 'DDDo' => ['ordinal', ['dayOfYear', 'DDD']], + 'e' => ['weekday', []], + 'E' => 'dayOfWeekIso', + 'H' => ['rawFormat', ['G']], + 'HH' => ['rawFormat', ['H']], + 'h' => ['rawFormat', ['g']], + 'hh' => ['rawFormat', ['h']], + 'k' => 'noZeroHour', + 'kk' => ['getPaddedUnit', ['noZeroHour']], + 'hmm' => ['rawFormat', ['gi']], + 'hmmss' => ['rawFormat', ['gis']], + 'Hmm' => ['rawFormat', ['Gi']], + 'Hmmss' => ['rawFormat', ['Gis']], + 'm' => 'minute', + 'mm' => ['rawFormat', ['i']], + 'a' => 'meridiem', + 'A' => 'upperMeridiem', + 's' => 'second', + 'ss' => ['getPaddedUnit', ['second']], + 'S' => function (CarbonInterface $date) { + return (string) floor($date->micro / 100000); + }, + 'SS' => function (CarbonInterface $date) { + return str_pad((string) floor($date->micro / 10000), 2, '0', STR_PAD_LEFT); + }, + 'SSS' => function (CarbonInterface $date) { + return str_pad((string) floor($date->micro / 1000), 3, '0', STR_PAD_LEFT); + }, + 'SSSS' => function (CarbonInterface $date) { + return str_pad((string) floor($date->micro / 100), 4, '0', STR_PAD_LEFT); + }, + 'SSSSS' => function (CarbonInterface $date) { + return str_pad((string) floor($date->micro / 10), 5, '0', STR_PAD_LEFT); + }, + 'SSSSSS' => ['getPaddedUnit', ['micro', 6]], + 'SSSSSSS' => function (CarbonInterface $date) { + return str_pad((string) floor($date->micro * 10), 7, '0', STR_PAD_LEFT); + }, + 'SSSSSSSS' => function (CarbonInterface $date) { + return str_pad((string) floor($date->micro * 100), 8, '0', STR_PAD_LEFT); + }, + 'SSSSSSSSS' => function (CarbonInterface $date) { + return str_pad((string) floor($date->micro * 1000), 9, '0', STR_PAD_LEFT); + }, + 'M' => 'month', + 'MM' => ['rawFormat', ['m']], + 'MMM' => function (CarbonInterface $date, $originalFormat = null) { + $month = $date->getTranslatedShortMonthName($originalFormat); + $suffix = $date->getTranslationMessage('mmm_suffix'); + if ($suffix && $month !== $date->monthName) { + $month .= $suffix; + } + + return $month; + }, + 'MMMM' => function (CarbonInterface $date, $originalFormat = null) { + return $date->getTranslatedMonthName($originalFormat); + }, + 'Mo' => ['ordinal', ['month', 'M']], + 'Q' => 'quarter', + 'Qo' => ['ordinal', ['quarter', 'M']], + 'G' => 'isoWeekYear', + 'GG' => ['getPaddedUnit', ['isoWeekYear']], + 'GGG' => ['getPaddedUnit', ['isoWeekYear', 3]], + 'GGGG' => ['getPaddedUnit', ['isoWeekYear', 4]], + 'GGGGG' => ['getPaddedUnit', ['isoWeekYear', 5]], + 'g' => 'weekYear', + 'gg' => ['getPaddedUnit', ['weekYear']], + 'ggg' => ['getPaddedUnit', ['weekYear', 3]], + 'gggg' => ['getPaddedUnit', ['weekYear', 4]], + 'ggggg' => ['getPaddedUnit', ['weekYear', 5]], + 'W' => 'isoWeek', + 'WW' => ['getPaddedUnit', ['isoWeek']], + 'Wo' => ['ordinal', ['isoWeek', 'W']], + 'w' => 'week', + 'ww' => ['getPaddedUnit', ['week']], + 'wo' => ['ordinal', ['week', 'w']], + 'x' => ['valueOf', []], + 'X' => 'timestamp', + 'Y' => 'year', + 'YY' => ['rawFormat', ['y']], + 'YYYY' => ['getPaddedUnit', ['year', 4]], + 'YYYYY' => ['getPaddedUnit', ['year', 5]], + 'YYYYYY' => function (CarbonInterface $date) { + return ($date->year < 0 ? '' : '+').$date->getPaddedUnit('year', 6); + }, + 'z' => ['rawFormat', ['T']], + 'zz' => 'tzName', + 'Z' => ['getOffsetString', []], + 'ZZ' => ['getOffsetString', ['']], + ]; + } + + return $units; + } + + /** + * Returns a unit of the instance padded with 0 by default or any other string if specified. + * + * @param string $unit Carbon unit name + * @param int $length Length of the output (2 by default) + * @param string $padString String to use for padding ("0" by default) + * @param int $padType Side(s) to pad (STR_PAD_LEFT by default) + * + * @return string + */ + public function getPaddedUnit($unit, $length = 2, $padString = '0', $padType = STR_PAD_LEFT) + { + return ($this->$unit < 0 ? '-' : '').str_pad((string) abs($this->$unit), $length, $padString, $padType); + } + + /** + * Return a property with its ordinal. + * + * @param string $key + * @param string|null $period + * + * @return string + */ + public function ordinal(string $key, ?string $period = null): string + { + $number = $this->$key; + $result = $this->translate('ordinal', [ + ':number' => $number, + ':period' => (string) $period, + ]); + + return (string) ($result === 'ordinal' ? $number : $result); + } + + /** + * Return the meridiem of the current time in the current locale. + * + * @param bool $isLower if true, returns lowercase variant if available in the current locale. + * + * @return string + */ + public function meridiem(bool $isLower = false): string + { + $hour = $this->hour; + $index = $hour < 12 ? 0 : 1; + + if ($isLower) { + $key = 'meridiem.'.($index + 2); + $result = $this->translate($key); + + if ($result !== $key) { + return $result; + } + } + + $key = "meridiem.$index"; + $result = $this->translate($key); + if ($result === $key) { + $result = $this->translate('meridiem', [ + ':hour' => $this->hour, + ':minute' => $this->minute, + ':isLower' => $isLower, + ]); + + if ($result === 'meridiem') { + return $isLower ? $this->latinMeridiem : $this->latinUpperMeridiem; + } + } elseif ($isLower) { + $result = mb_strtolower($result); + } + + return $result; + } + + /** + * Returns the alternative number for a given date property if available in the current locale. + * + * @param string $key date property + * + * @return string + */ + public function getAltNumber(string $key): string + { + return $this->translateNumber(\strlen($key) > 1 ? $this->$key : $this->rawFormat('h')); + } + + /** + * Format in the current language using ISO replacement patterns. + * + * @param string $format + * @param string|null $originalFormat provide context if a chunk has been passed alone + * + * @return string + */ + public function isoFormat(string $format, ?string $originalFormat = null): string + { + $result = ''; + $length = mb_strlen($format); + $originalFormat = $originalFormat ?: $format; + $inEscaped = false; + $formats = null; + $units = null; + + for ($i = 0; $i < $length; $i++) { + $char = mb_substr($format, $i, 1); + + if ($char === '\\') { + $result .= mb_substr($format, ++$i, 1); + + continue; + } + + if ($char === '[' && !$inEscaped) { + $inEscaped = true; + + continue; + } + + if ($char === ']' && $inEscaped) { + $inEscaped = false; + + continue; + } + + if ($inEscaped) { + $result .= $char; + + continue; + } + + $input = mb_substr($format, $i); + + if (preg_match('/^(LTS|LT|l{1,4}|L{1,4})/', $input, $match)) { + if ($formats === null) { + $formats = $this->getIsoFormats(); + } + + $code = $match[0]; + $sequence = $formats[$code] ?? preg_replace_callback( + '/MMMM|MM|DD|dddd/', + function ($code) { + return mb_substr($code[0], 1); + }, + $formats[strtoupper($code)] ?? '' + ); + $rest = mb_substr($format, $i + mb_strlen($code)); + $format = mb_substr($format, 0, $i).$sequence.$rest; + $length = mb_strlen($format); + $input = $sequence.$rest; + } + + if (preg_match('/^'.CarbonInterface::ISO_FORMAT_REGEXP.'/', $input, $match)) { + $code = $match[0]; + + if ($units === null) { + $units = static::getIsoUnits(); + } + + $sequence = $units[$code] ?? ''; + + if ($sequence instanceof Closure) { + $sequence = $sequence($this, $originalFormat); + } elseif (\is_array($sequence)) { + try { + $sequence = $this->{$sequence[0]}(...$sequence[1]); + } catch (ReflectionException | InvalidArgumentException | BadMethodCallException $e) { + $sequence = ''; + } + } elseif (\is_string($sequence)) { + $sequence = $this->$sequence ?? $code; + } + + $format = mb_substr($format, 0, $i).$sequence.mb_substr($format, $i + mb_strlen($code)); + $i += mb_strlen((string) $sequence) - 1; + $length = mb_strlen($format); + $char = $sequence; + } + + $result .= $char; + } + + return $result; + } + + /** + * List of replacements from date() format to isoFormat(). + * + * @return array + */ + public static function getFormatsToIsoReplacements() + { + static $replacements = null; + + if ($replacements === null) { + $replacements = [ + 'd' => true, + 'D' => 'ddd', + 'j' => true, + 'l' => 'dddd', + 'N' => true, + 'S' => function ($date) { + $day = $date->rawFormat('j'); + + return str_replace((string) $day, '', $date->isoFormat('Do')); + }, + 'w' => true, + 'z' => true, + 'W' => true, + 'F' => 'MMMM', + 'm' => true, + 'M' => 'MMM', + 'n' => true, + 't' => true, + 'L' => true, + 'o' => true, + 'Y' => true, + 'y' => true, + 'a' => 'a', + 'A' => 'A', + 'B' => true, + 'g' => true, + 'G' => true, + 'h' => true, + 'H' => true, + 'i' => true, + 's' => true, + 'u' => true, + 'v' => true, + 'E' => true, + 'I' => true, + 'O' => true, + 'P' => true, + 'Z' => true, + 'c' => true, + 'r' => true, + 'U' => true, + 'T' => true, + ]; + } + + return $replacements; + } + + /** + * Format as ->format() do (using date replacements patterns from https://php.net/manual/en/function.date.php) + * but translate words whenever possible (months, day names, etc.) using the current locale. + * + * @param string $format + * + * @return string + */ + public function translatedFormat(string $format): string + { + $replacements = static::getFormatsToIsoReplacements(); + $context = ''; + $isoFormat = ''; + $length = mb_strlen($format); + + for ($i = 0; $i < $length; $i++) { + $char = mb_substr($format, $i, 1); + + if ($char === '\\') { + $replacement = mb_substr($format, $i, 2); + $isoFormat .= $replacement; + $i++; + + continue; + } + + if (!isset($replacements[$char])) { + $replacement = preg_match('/^[A-Za-z]$/', $char) ? "\\$char" : $char; + $isoFormat .= $replacement; + $context .= $replacement; + + continue; + } + + $replacement = $replacements[$char]; + + if ($replacement === true) { + static $contextReplacements = null; + + if ($contextReplacements === null) { + $contextReplacements = [ + 'm' => 'MM', + 'd' => 'DD', + 't' => 'D', + 'j' => 'D', + 'N' => 'e', + 'w' => 'e', + 'n' => 'M', + 'o' => 'YYYY', + 'Y' => 'YYYY', + 'y' => 'YY', + 'g' => 'h', + 'G' => 'H', + 'h' => 'hh', + 'H' => 'HH', + 'i' => 'mm', + 's' => 'ss', + ]; + } + + $isoFormat .= '['.$this->rawFormat($char).']'; + $context .= $contextReplacements[$char] ?? ' '; + + continue; + } + + if ($replacement instanceof Closure) { + $replacement = '['.$replacement($this).']'; + $isoFormat .= $replacement; + $context .= $replacement; + + continue; + } + + $isoFormat .= $replacement; + $context .= $replacement; + } + + return $this->isoFormat($isoFormat, $context); + } + + /** + * Returns the offset hour and minute formatted with +/- and a given separator (":" by default). + * For example, if the time zone is 9 hours 30 minutes, you'll get "+09:30", with "@@" as first + * argument, "+09@@30", with "" as first argument, "+0930". Negative offset will return something + * like "-12:00". + * + * @param string $separator string to place between hours and minutes (":" by default) + * + * @return string + */ + public function getOffsetString($separator = ':') + { + $second = $this->getOffset(); + $symbol = $second < 0 ? '-' : '+'; + $minute = abs($second) / static::SECONDS_PER_MINUTE; + $hour = str_pad((string) floor($minute / static::MINUTES_PER_HOUR), 2, '0', STR_PAD_LEFT); + $minute = str_pad((string) (((int) $minute) % static::MINUTES_PER_HOUR), 2, '0', STR_PAD_LEFT); + + return "$symbol$hour$separator$minute"; + } + + protected static function executeStaticCallable($macro, ...$parameters) + { + return static::bindMacroContext(null, function () use (&$macro, &$parameters) { + if ($macro instanceof Closure) { + $boundMacro = @Closure::bind($macro, null, static::class); + + return ($boundMacro ?: $macro)(...$parameters); + } + + return $macro(...$parameters); + }); + } + + /** + * Dynamically handle calls to the class. + * + * @param string $method magic method name called + * @param array $parameters parameters list + * + * @throws BadMethodCallException + * + * @return mixed + */ + public static function __callStatic($method, $parameters) + { + if (!static::hasMacro($method)) { + foreach (static::getGenericMacros() as $callback) { + try { + return static::executeStaticCallable($callback, $method, ...$parameters); + } catch (BadMethodCallException $exception) { + continue; + } + } + if (static::isStrictModeEnabled()) { + throw new UnknownMethodException(sprintf('%s::%s', static::class, $method)); + } + + return null; + } + + return static::executeStaticCallable(static::$globalMacros[$method], ...$parameters); + } + + /** + * Set specified unit to new given value. + * + * @param string $unit year, month, day, hour, minute, second or microsecond + * @param int $value new value for given unit + * + * @return static + */ + public function setUnit($unit, $value = null) + { + $unit = static::singularUnit($unit); + $dateUnits = ['year', 'month', 'day']; + if (\in_array($unit, $dateUnits)) { + return $this->setDate(...array_map(function ($name) use ($unit, $value) { + return (int) ($name === $unit ? $value : $this->$name); + }, $dateUnits)); + } + + $units = ['hour', 'minute', 'second', 'micro']; + if ($unit === 'millisecond' || $unit === 'milli') { + $value *= 1000; + $unit = 'micro'; + } elseif ($unit === 'microsecond') { + $unit = 'micro'; + } + + return $this->setTime(...array_map(function ($name) use ($unit, $value) { + return (int) ($name === $unit ? $value : $this->$name); + }, $units)); + } + + /** + * Returns standardized singular of a given singular/plural unit name (in English). + * + * @param string $unit + * + * @return string + */ + public static function singularUnit(string $unit): string + { + $unit = rtrim(mb_strtolower($unit), 's'); + + if ($unit === 'centurie') { + return 'century'; + } + + if ($unit === 'millennia') { + return 'millennium'; + } + + return $unit; + } + + /** + * Returns standardized plural of a given singular/plural unit name (in English). + * + * @param string $unit + * + * @return string + */ + public static function pluralUnit(string $unit): string + { + $unit = rtrim(strtolower($unit), 's'); + + if ($unit === 'century') { + return 'centuries'; + } + + if ($unit === 'millennium' || $unit === 'millennia') { + return 'millennia'; + } + + return "{$unit}s"; + } + + protected function executeCallable($macro, ...$parameters) + { + if ($macro instanceof Closure) { + $boundMacro = @$macro->bindTo($this, static::class) ?: @$macro->bindTo(null, static::class); + + return ($boundMacro ?: $macro)(...$parameters); + } + + return $macro(...$parameters); + } + + protected function executeCallableWithContext($macro, ...$parameters) + { + return static::bindMacroContext($this, function () use (&$macro, &$parameters) { + return $this->executeCallable($macro, ...$parameters); + }); + } + + protected static function getGenericMacros() + { + foreach (static::$globalGenericMacros as $list) { + foreach ($list as $macro) { + yield $macro; + } + } + } + + /** + * Dynamically handle calls to the class. + * + * @param string $method magic method name called + * @param array $parameters parameters list + * + * @throws UnknownMethodException|BadMethodCallException|ReflectionException|Throwable + * + * @return mixed + */ + public function __call($method, $parameters) + { + $diffSizes = [ + // @mode diffForHumans + 'short' => true, + // @mode diffForHumans + 'long' => false, + ]; + $diffSyntaxModes = [ + // @call diffForHumans + 'Absolute' => CarbonInterface::DIFF_ABSOLUTE, + // @call diffForHumans + 'Relative' => CarbonInterface::DIFF_RELATIVE_AUTO, + // @call diffForHumans + 'RelativeToNow' => CarbonInterface::DIFF_RELATIVE_TO_NOW, + // @call diffForHumans + 'RelativeToOther' => CarbonInterface::DIFF_RELATIVE_TO_OTHER, + ]; + $sizePattern = implode('|', array_keys($diffSizes)); + $syntaxPattern = implode('|', array_keys($diffSyntaxModes)); + + if (preg_match("/^(?<size>$sizePattern)(?<syntax>$syntaxPattern)DiffForHumans$/", $method, $match)) { + $dates = array_filter($parameters, function ($parameter) { + return $parameter instanceof DateTimeInterface; + }); + $other = null; + + if (\count($dates)) { + $key = key($dates); + $other = current($dates); + array_splice($parameters, $key, 1); + } + + return $this->diffForHumans($other, $diffSyntaxModes[$match['syntax']], $diffSizes[$match['size']], ...$parameters); + } + + $roundedValue = $this->callRoundMethod($method, $parameters); + + if ($roundedValue !== null) { + return $roundedValue; + } + + $unit = rtrim($method, 's'); + + if (str_starts_with($unit, 'is')) { + $word = substr($unit, 2); + + if (\in_array($word, static::$days, true)) { + return $this->isDayOfWeek($word); + } + + switch ($word) { + // @call is Check if the current instance has UTC timezone. (Both isUtc and isUTC cases are valid.) + case 'Utc': + case 'UTC': + return $this->utc; + // @call is Check if the current instance has non-UTC timezone. + case 'Local': + return $this->local; + // @call is Check if the current instance is a valid date. + case 'Valid': + return $this->year !== 0; + // @call is Check if the current instance is in a daylight saving time. + case 'DST': + return $this->dst; + } + } + + $action = substr($unit, 0, 3); + $overflow = null; + + if ($action === 'set') { + $unit = strtolower(substr($unit, 3)); + } + + if (\in_array($unit, static::$units, true)) { + return $this->setUnit($unit, ...$parameters); + } + + if ($action === 'add' || $action === 'sub') { + $unit = substr($unit, 3); + + if (str_starts_with($unit, 'Real')) { + $unit = static::singularUnit(substr($unit, 4)); + + return $this->{"{$action}RealUnit"}($unit, ...$parameters); + } + + if (preg_match('/^(Month|Quarter|Year|Decade|Century|Centurie|Millennium|Millennia)s?(No|With|Without|WithNo)Overflow$/', $unit, $match)) { + $unit = $match[1]; + $overflow = $match[2] === 'With'; + } + + $unit = static::singularUnit($unit); + } + + if (static::isModifiableUnit($unit)) { + return $this->{"{$action}Unit"}($unit, $this->getMagicParameter($parameters, 0, 'value', 1), $overflow); + } + + $sixFirstLetters = substr($unit, 0, 6); + $factor = -1; + + if ($sixFirstLetters === 'isLast') { + $sixFirstLetters = 'isNext'; + $factor = 1; + } + + if ($sixFirstLetters === 'isNext') { + $lowerUnit = strtolower(substr($unit, 6)); + + if (static::isModifiableUnit($lowerUnit)) { + return $this->copy()->addUnit($lowerUnit, $factor, false)->isSameUnit($lowerUnit, ...$parameters); + } + } + + if ($sixFirstLetters === 'isSame') { + try { + return $this->isSameUnit(strtolower(substr($unit, 6)), ...$parameters); + } catch (BadComparisonUnitException $exception) { + // Try next + } + } + + if (str_starts_with($unit, 'isCurrent')) { + try { + return $this->isCurrentUnit(strtolower(substr($unit, 9))); + } catch (BadComparisonUnitException | BadMethodCallException $exception) { + // Try next + } + } + + if (str_ends_with($method, 'Until')) { + try { + $unit = static::singularUnit(substr($method, 0, -5)); + + return $this->range( + $this->getMagicParameter($parameters, 0, 'endDate', $this), + $this->getMagicParameter($parameters, 1, 'factor', 1), + $unit + ); + } catch (InvalidArgumentException $exception) { + // Try macros + } + } + + return static::bindMacroContext($this, function () use (&$method, &$parameters) { + $macro = $this->getLocalMacro($method); + + if (!$macro) { + foreach ([$this->localGenericMacros ?: [], static::getGenericMacros()] as $list) { + foreach ($list as $callback) { + try { + return $this->executeCallable($callback, $method, ...$parameters); + } catch (BadMethodCallException $exception) { + continue; + } + } + } + + if ($this->localStrictModeEnabled ?? static::isStrictModeEnabled()) { + throw new UnknownMethodException($method); + } + + return null; + } + + return $this->executeCallable($macro, ...$parameters); + }); + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/DeprecatedProperties.php b/vendor/nesbot/carbon/src/Carbon/Traits/DeprecatedProperties.php new file mode 100644 index 00000000..5acc6f5c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/DeprecatedProperties.php @@ -0,0 +1,61 @@ +<?php + +declare(strict_types=1); + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +trait DeprecatedProperties +{ + /** + * the day of week in current locale LC_TIME + * + * @var string + * + * @deprecated It uses OS language package and strftime() which is deprecated since PHP 8.1. + * Use ->isoFormat('MMM') instead. + * Deprecated since 2.55.0 + */ + public $localeDayOfWeek; + + /** + * the abbreviated day of week in current locale LC_TIME + * + * @var string + * + * @deprecated It uses OS language package and strftime() which is deprecated since PHP 8.1. + * Use ->isoFormat('dddd') instead. + * Deprecated since 2.55.0 + */ + public $shortLocaleDayOfWeek; + + /** + * the month in current locale LC_TIME + * + * @var string + * + * @deprecated It uses OS language package and strftime() which is deprecated since PHP 8.1. + * Use ->isoFormat('ddd') instead. + * Deprecated since 2.55.0 + */ + public $localeMonth; + + /** + * the abbreviated month in current locale LC_TIME + * + * @var string + * + * @deprecated It uses OS language package and strftime() which is deprecated since PHP 8.1. + * Use ->isoFormat('MMMM') instead. + * Deprecated since 2.55.0 + */ + public $shortLocaleMonth; +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Difference.php b/vendor/nesbot/carbon/src/Carbon/Traits/Difference.php new file mode 100644 index 00000000..ab5b65d2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Difference.php @@ -0,0 +1,1182 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +use Carbon\Carbon; +use Carbon\CarbonImmutable; +use Carbon\CarbonInterface; +use Carbon\CarbonInterval; +use Carbon\CarbonPeriod; +use Carbon\Translator; +use Closure; +use DateInterval; +use DateTimeInterface; +use ReturnTypeWillChange; + +/** + * Trait Difference. + * + * Depends on the following methods: + * + * @method bool lessThan($date) + * @method static copy() + * @method static resolveCarbon($date = null) + * @method static Translator translator() + */ +trait Difference +{ + /** + * @codeCoverageIgnore + * + * @param CarbonInterval $diff + */ + protected static function fixNegativeMicroseconds(CarbonInterval $diff) + { + if ($diff->s !== 0 || $diff->i !== 0 || $diff->h !== 0 || $diff->d !== 0 || $diff->m !== 0 || $diff->y !== 0) { + $diff->f = (round($diff->f * 1000000) + 1000000) / 1000000; + $diff->s--; + + if ($diff->s < 0) { + $diff->s += 60; + $diff->i--; + + if ($diff->i < 0) { + $diff->i += 60; + $diff->h--; + + if ($diff->h < 0) { + $diff->h += 24; + $diff->d--; + + if ($diff->d < 0) { + $diff->d += 30; + $diff->m--; + + if ($diff->m < 0) { + $diff->m += 12; + $diff->y--; + } + } + } + } + } + + return; + } + + $diff->f *= -1; + $diff->invert(); + } + + /** + * @param DateInterval $diff + * @param bool $absolute + * + * @return CarbonInterval + */ + protected static function fixDiffInterval(DateInterval $diff, $absolute, array $skip = []) + { + $diff = CarbonInterval::instance($diff, $skip); + + // Work-around for https://bugs.php.net/bug.php?id=77145 + // @codeCoverageIgnoreStart + if ($diff->f > 0 && $diff->y === -1 && $diff->m === 11 && $diff->d >= 27 && $diff->h === 23 && $diff->i === 59 && $diff->s === 59) { + $diff->y = 0; + $diff->m = 0; + $diff->d = 0; + $diff->h = 0; + $diff->i = 0; + $diff->s = 0; + $diff->f = (1000000 - round($diff->f * 1000000)) / 1000000; + $diff->invert(); + } elseif ($diff->f < 0) { + static::fixNegativeMicroseconds($diff); + } + // @codeCoverageIgnoreEnd + + if ($absolute && $diff->invert) { + $diff->invert(); + } + + return $diff; + } + + /** + * Get the difference as a DateInterval instance. + * Return relative interval (negative if $absolute flag is not set to true and the given date is before + * current one). + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return DateInterval + */ + #[ReturnTypeWillChange] + public function diff($date = null, $absolute = false) + { + $other = $this->resolveCarbon($date); + + // Work-around for https://bugs.php.net/bug.php?id=81458 + // It was initially introduced for https://bugs.php.net/bug.php?id=80998 + // The very specific case of 80998 was fixed in PHP 8.1beta3, but it introduced 81458 + // So we still need to keep this for now + // @codeCoverageIgnoreStart + if (version_compare(PHP_VERSION, '8.1.0-dev', '>=') && $other->tz !== $this->tz) { + $other = $other->avoidMutation()->tz($this->tz); + } + // @codeCoverageIgnoreEnd + + return parent::diff($other, (bool) $absolute); + } + + /** + * Get the difference as a CarbonInterval instance. + * Return relative interval (negative if $absolute flag is not set to true and the given date is before + * current one). + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return CarbonInterval + */ + public function diffAsCarbonInterval($date = null, $absolute = true, array $skip = []) + { + return static::fixDiffInterval($this->diff($this->resolveCarbon($date), $absolute), $absolute, $skip); + } + + /** + * Get the difference in years + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInYears($date = null, $absolute = true) + { + return (int) $this->diff($this->resolveCarbon($date), $absolute)->format('%r%y'); + } + + /** + * Get the difference in quarters rounded down. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInQuarters($date = null, $absolute = true) + { + return (int) ($this->diffInMonths($date, $absolute) / static::MONTHS_PER_QUARTER); + } + + /** + * Get the difference in months rounded down. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInMonths($date = null, $absolute = true) + { + $date = $this->resolveCarbon($date)->avoidMutation()->tz($this->tz); + + [$yearStart, $monthStart, $dayStart] = explode('-', $this->format('Y-m-dHisu')); + [$yearEnd, $monthEnd, $dayEnd] = explode('-', $date->format('Y-m-dHisu')); + + $diff = (((int) $yearEnd) - ((int) $yearStart)) * static::MONTHS_PER_YEAR + + ((int) $monthEnd) - ((int) $monthStart); + + if ($diff > 0) { + $diff -= ($dayStart > $dayEnd ? 1 : 0); + } elseif ($diff < 0) { + $diff += ($dayStart < $dayEnd ? 1 : 0); + } + + return $absolute ? abs($diff) : $diff; + } + + /** + * Get the difference in weeks rounded down. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInWeeks($date = null, $absolute = true) + { + return (int) ($this->diffInDays($date, $absolute) / static::DAYS_PER_WEEK); + } + + /** + * Get the difference in days rounded down. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInDays($date = null, $absolute = true) + { + return $this->getIntervalDayDiff($this->diff($this->resolveCarbon($date), $absolute)); + } + + /** + * Get the difference in days using a filter closure rounded down. + * + * @param Closure $callback + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInDaysFiltered(Closure $callback, $date = null, $absolute = true) + { + return $this->diffFiltered(CarbonInterval::day(), $callback, $date, $absolute); + } + + /** + * Get the difference in hours using a filter closure rounded down. + * + * @param Closure $callback + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInHoursFiltered(Closure $callback, $date = null, $absolute = true) + { + return $this->diffFiltered(CarbonInterval::hour(), $callback, $date, $absolute); + } + + /** + * Get the difference by the given interval using a filter closure. + * + * @param CarbonInterval $ci An interval to traverse by + * @param Closure $callback + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffFiltered(CarbonInterval $ci, Closure $callback, $date = null, $absolute = true) + { + $start = $this; + $end = $this->resolveCarbon($date); + $inverse = false; + + if ($end < $start) { + $start = $end; + $end = $this; + $inverse = true; + } + + $options = CarbonPeriod::EXCLUDE_END_DATE | ($this->isMutable() ? 0 : CarbonPeriod::IMMUTABLE); + $diff = $ci->toPeriod($start, $end, $options)->filter($callback)->count(); + + return $inverse && !$absolute ? -$diff : $diff; + } + + /** + * Get the difference in weekdays rounded down. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInWeekdays($date = null, $absolute = true) + { + return $this->diffInDaysFiltered(static function (CarbonInterface $date) { + return $date->isWeekday(); + }, $this->resolveCarbon($date)->avoidMutation()->modify($this->format('H:i:s.u')), $absolute); + } + + /** + * Get the difference in weekend days using a filter rounded down. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInWeekendDays($date = null, $absolute = true) + { + return $this->diffInDaysFiltered(static function (CarbonInterface $date) { + return $date->isWeekend(); + }, $this->resolveCarbon($date)->avoidMutation()->modify($this->format('H:i:s.u')), $absolute); + } + + /** + * Get the difference in hours rounded down. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInHours($date = null, $absolute = true) + { + return (int) ($this->diffInSeconds($date, $absolute) / static::SECONDS_PER_MINUTE / static::MINUTES_PER_HOUR); + } + + /** + * Get the difference in hours rounded down using timestamps. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInRealHours($date = null, $absolute = true) + { + return (int) ($this->diffInRealSeconds($date, $absolute) / static::SECONDS_PER_MINUTE / static::MINUTES_PER_HOUR); + } + + /** + * Get the difference in minutes rounded down. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInMinutes($date = null, $absolute = true) + { + return (int) ($this->diffInSeconds($date, $absolute) / static::SECONDS_PER_MINUTE); + } + + /** + * Get the difference in minutes rounded down using timestamps. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInRealMinutes($date = null, $absolute = true) + { + return (int) ($this->diffInRealSeconds($date, $absolute) / static::SECONDS_PER_MINUTE); + } + + /** + * Get the difference in seconds rounded down. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInSeconds($date = null, $absolute = true) + { + $diff = $this->diff($date); + + if ($diff->days === 0) { + $diff = static::fixDiffInterval($diff, $absolute); + } + + $value = (((($diff->m || $diff->y ? $diff->days : $diff->d) * static::HOURS_PER_DAY) + + $diff->h) * static::MINUTES_PER_HOUR + + $diff->i) * static::SECONDS_PER_MINUTE + + $diff->s; + + return $absolute || !$diff->invert ? $value : -$value; + } + + /** + * Get the difference in microseconds. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInMicroseconds($date = null, $absolute = true) + { + $diff = $this->diff($date); + $value = (int) round(((((($diff->m || $diff->y ? $diff->days : $diff->d) * static::HOURS_PER_DAY) + + $diff->h) * static::MINUTES_PER_HOUR + + $diff->i) * static::SECONDS_PER_MINUTE + + ($diff->f + $diff->s)) * static::MICROSECONDS_PER_SECOND); + + return $absolute || !$diff->invert ? $value : -$value; + } + + /** + * Get the difference in milliseconds rounded down. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInMilliseconds($date = null, $absolute = true) + { + return (int) ($this->diffInMicroseconds($date, $absolute) / static::MICROSECONDS_PER_MILLISECOND); + } + + /** + * Get the difference in seconds using timestamps. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInRealSeconds($date = null, $absolute = true) + { + /** @var CarbonInterface $date */ + $date = $this->resolveCarbon($date); + $value = $date->getTimestamp() - $this->getTimestamp(); + + return $absolute ? abs($value) : $value; + } + + /** + * Get the difference in microseconds using timestamps. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInRealMicroseconds($date = null, $absolute = true) + { + /** @var CarbonInterface $date */ + $date = $this->resolveCarbon($date); + $value = ($date->timestamp - $this->timestamp) * static::MICROSECONDS_PER_SECOND + + $date->micro - $this->micro; + + return $absolute ? abs($value) : $value; + } + + /** + * Get the difference in milliseconds rounded down using timestamps. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInRealMilliseconds($date = null, $absolute = true) + { + return (int) ($this->diffInRealMicroseconds($date, $absolute) / static::MICROSECONDS_PER_MILLISECOND); + } + + /** + * Get the difference in seconds as float (microsecond-precision). + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInSeconds($date = null, $absolute = true) + { + return (float) ($this->diffInMicroseconds($date, $absolute) / static::MICROSECONDS_PER_SECOND); + } + + /** + * Get the difference in minutes as float (microsecond-precision). + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInMinutes($date = null, $absolute = true) + { + return $this->floatDiffInSeconds($date, $absolute) / static::SECONDS_PER_MINUTE; + } + + /** + * Get the difference in hours as float (microsecond-precision). + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInHours($date = null, $absolute = true) + { + return $this->floatDiffInMinutes($date, $absolute) / static::MINUTES_PER_HOUR; + } + + /** + * Get the difference in days as float (microsecond-precision). + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInDays($date = null, $absolute = true) + { + $hoursDiff = $this->floatDiffInHours($date, $absolute); + $interval = $this->diff($date, $absolute); + + if ($interval->y === 0 && $interval->m === 0 && $interval->d === 0) { + return $hoursDiff / static::HOURS_PER_DAY; + } + + $daysDiff = $this->getIntervalDayDiff($interval); + + return $daysDiff + fmod($hoursDiff, static::HOURS_PER_DAY) / static::HOURS_PER_DAY; + } + + /** + * Get the difference in weeks as float (microsecond-precision). + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInWeeks($date = null, $absolute = true) + { + return $this->floatDiffInDays($date, $absolute) / static::DAYS_PER_WEEK; + } + + /** + * Get the difference in months as float (microsecond-precision). + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInMonths($date = null, $absolute = true) + { + $start = $this; + $end = $this->resolveCarbon($date); + $ascending = ($start <= $end); + $sign = $absolute || $ascending ? 1 : -1; + if (!$ascending) { + [$start, $end] = [$end, $start]; + } + $monthsDiff = $start->diffInMonths($end); + /** @var Carbon|CarbonImmutable $floorEnd */ + $floorEnd = $start->avoidMutation()->addMonths($monthsDiff); + + if ($floorEnd >= $end) { + return $sign * $monthsDiff; + } + + /** @var Carbon|CarbonImmutable $startOfMonthAfterFloorEnd */ + $startOfMonthAfterFloorEnd = $floorEnd->avoidMutation()->addMonth()->startOfMonth(); + + if ($startOfMonthAfterFloorEnd > $end) { + return $sign * ($monthsDiff + $floorEnd->floatDiffInDays($end) / $floorEnd->daysInMonth); + } + + return $sign * ($monthsDiff + $floorEnd->floatDiffInDays($startOfMonthAfterFloorEnd) / $floorEnd->daysInMonth + $startOfMonthAfterFloorEnd->floatDiffInDays($end) / $end->daysInMonth); + } + + /** + * Get the difference in year as float (microsecond-precision). + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInYears($date = null, $absolute = true) + { + $start = $this; + $end = $this->resolveCarbon($date); + $ascending = ($start <= $end); + $sign = $absolute || $ascending ? 1 : -1; + if (!$ascending) { + [$start, $end] = [$end, $start]; + } + $yearsDiff = $start->diffInYears($end); + /** @var Carbon|CarbonImmutable $floorEnd */ + $floorEnd = $start->avoidMutation()->addYears($yearsDiff); + + if ($floorEnd >= $end) { + return $sign * $yearsDiff; + } + + /** @var Carbon|CarbonImmutable $startOfYearAfterFloorEnd */ + $startOfYearAfterFloorEnd = $floorEnd->avoidMutation()->addYear()->startOfYear(); + + if ($startOfYearAfterFloorEnd > $end) { + return $sign * ($yearsDiff + $floorEnd->floatDiffInDays($end) / $floorEnd->daysInYear); + } + + return $sign * ($yearsDiff + $floorEnd->floatDiffInDays($startOfYearAfterFloorEnd) / $floorEnd->daysInYear + $startOfYearAfterFloorEnd->floatDiffInDays($end) / $end->daysInYear); + } + + /** + * Get the difference in seconds as float (microsecond-precision) using timestamps. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInRealSeconds($date = null, $absolute = true) + { + return $this->diffInRealMicroseconds($date, $absolute) / static::MICROSECONDS_PER_SECOND; + } + + /** + * Get the difference in minutes as float (microsecond-precision) using timestamps. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInRealMinutes($date = null, $absolute = true) + { + return $this->floatDiffInRealSeconds($date, $absolute) / static::SECONDS_PER_MINUTE; + } + + /** + * Get the difference in hours as float (microsecond-precision) using timestamps. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInRealHours($date = null, $absolute = true) + { + return $this->floatDiffInRealMinutes($date, $absolute) / static::MINUTES_PER_HOUR; + } + + /** + * Get the difference in days as float (microsecond-precision). + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInRealDays($date = null, $absolute = true) + { + $date = $this->resolveUTC($date); + $utc = $this->avoidMutation()->utc(); + $hoursDiff = $utc->floatDiffInRealHours($date, $absolute); + + return ($hoursDiff < 0 ? -1 : 1) * $utc->diffInDays($date) + fmod($hoursDiff, static::HOURS_PER_DAY) / static::HOURS_PER_DAY; + } + + /** + * Get the difference in weeks as float (microsecond-precision). + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInRealWeeks($date = null, $absolute = true) + { + return $this->floatDiffInRealDays($date, $absolute) / static::DAYS_PER_WEEK; + } + + /** + * Get the difference in months as float (microsecond-precision) using timestamps. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInRealMonths($date = null, $absolute = true) + { + $start = $this; + $end = $this->resolveCarbon($date); + $ascending = ($start <= $end); + $sign = $absolute || $ascending ? 1 : -1; + if (!$ascending) { + [$start, $end] = [$end, $start]; + } + $monthsDiff = $start->diffInMonths($end); + /** @var Carbon|CarbonImmutable $floorEnd */ + $floorEnd = $start->avoidMutation()->addMonths($monthsDiff); + + if ($floorEnd >= $end) { + return $sign * $monthsDiff; + } + + /** @var Carbon|CarbonImmutable $startOfMonthAfterFloorEnd */ + $startOfMonthAfterFloorEnd = $floorEnd->avoidMutation()->addMonth()->startOfMonth(); + + if ($startOfMonthAfterFloorEnd > $end) { + return $sign * ($monthsDiff + $floorEnd->floatDiffInRealDays($end) / $floorEnd->daysInMonth); + } + + return $sign * ($monthsDiff + $floorEnd->floatDiffInRealDays($startOfMonthAfterFloorEnd) / $floorEnd->daysInMonth + $startOfMonthAfterFloorEnd->floatDiffInRealDays($end) / $end->daysInMonth); + } + + /** + * Get the difference in year as float (microsecond-precision) using timestamps. + * + * @param \Carbon\CarbonInterface|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return float + */ + public function floatDiffInRealYears($date = null, $absolute = true) + { + $start = $this; + $end = $this->resolveCarbon($date); + $ascending = ($start <= $end); + $sign = $absolute || $ascending ? 1 : -1; + if (!$ascending) { + [$start, $end] = [$end, $start]; + } + $yearsDiff = $start->diffInYears($end); + /** @var Carbon|CarbonImmutable $floorEnd */ + $floorEnd = $start->avoidMutation()->addYears($yearsDiff); + + if ($floorEnd >= $end) { + return $sign * $yearsDiff; + } + + /** @var Carbon|CarbonImmutable $startOfYearAfterFloorEnd */ + $startOfYearAfterFloorEnd = $floorEnd->avoidMutation()->addYear()->startOfYear(); + + if ($startOfYearAfterFloorEnd > $end) { + return $sign * ($yearsDiff + $floorEnd->floatDiffInRealDays($end) / $floorEnd->daysInYear); + } + + return $sign * ($yearsDiff + $floorEnd->floatDiffInRealDays($startOfYearAfterFloorEnd) / $floorEnd->daysInYear + $startOfYearAfterFloorEnd->floatDiffInRealDays($end) / $end->daysInYear); + } + + /** + * The number of seconds since midnight. + * + * @return int + */ + public function secondsSinceMidnight() + { + return $this->diffInSeconds($this->avoidMutation()->startOfDay()); + } + + /** + * The number of seconds until 23:59:59. + * + * @return int + */ + public function secondsUntilEndOfDay() + { + return $this->diffInSeconds($this->avoidMutation()->endOfDay()); + } + + /** + * Get the difference in a human readable format in the current locale from current instance to an other + * instance given (or now if null given). + * + * @example + * ``` + * echo Carbon::tomorrow()->diffForHumans() . "\n"; + * echo Carbon::tomorrow()->diffForHumans(['parts' => 2]) . "\n"; + * echo Carbon::tomorrow()->diffForHumans(['parts' => 3, 'join' => true]) . "\n"; + * echo Carbon::tomorrow()->diffForHumans(Carbon::yesterday()) . "\n"; + * echo Carbon::tomorrow()->diffForHumans(Carbon::yesterday(), ['short' => true]) . "\n"; + * ``` + * + * @param Carbon|\DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below; + * if null passed, now will be used as comparison reference; + * if any other type, it will be converted to date and used as reference. + * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: + * - 'syntax' entry (see below) + * - 'short' entry (see below) + * - 'parts' entry (see below) + * - 'options' entry (see below) + * - 'skip' entry, list of units to skip (array of strings or a single string, + * ` it can be the unit name (singular or plural) or its shortcut + * ` (y, m, w, d, h, min, s, ms, µs). + * - 'aUnit' entry, prefer "an hour" over "1 hour" if true + * - 'join' entry determines how to join multiple parts of the string + * ` - if $join is a string, it's used as a joiner glue + * ` - if $join is a callable/closure, it get the list of string and should return a string + * ` - if $join is an array, the first item will be the default glue, and the second item + * ` will be used instead of the glue for the last item + * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) + * ` - if $join is missing, a space will be used as glue + * - 'other' entry (see above) + * - 'minimumUnit' entry determines the smallest unit of time to display can be long or + * ` short form of the units, e.g. 'hour' or 'h' (default value: s) + * if int passed, it add modifiers: + * Possible values: + * - CarbonInterface::DIFF_ABSOLUTE no modifiers + * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier + * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier + * Default value: CarbonInterface::DIFF_ABSOLUTE + * @param bool $short displays short format of time units + * @param int $parts maximum number of parts to display (default value: 1: single unit) + * @param int $options human diff options + * + * @return string + */ + public function diffForHumans($other = null, $syntax = null, $short = false, $parts = 1, $options = null) + { + /* @var CarbonInterface $this */ + if (\is_array($other)) { + $other['syntax'] = \array_key_exists('syntax', $other) ? $other['syntax'] : $syntax; + $syntax = $other; + $other = $syntax['other'] ?? null; + } + + $intSyntax = &$syntax; + if (\is_array($syntax)) { + $syntax['syntax'] = $syntax['syntax'] ?? null; + $intSyntax = &$syntax['syntax']; + } + $intSyntax = (int) ($intSyntax ?? static::DIFF_RELATIVE_AUTO); + $intSyntax = $intSyntax === static::DIFF_RELATIVE_AUTO && $other === null ? static::DIFF_RELATIVE_TO_NOW : $intSyntax; + + $parts = min(7, max(1, (int) $parts)); + $skip = \is_array($syntax) ? ($syntax['skip'] ?? []) : []; + + return $this->diffAsCarbonInterval($other, false, (array) $skip) + ->setLocalTranslator($this->getLocalTranslator()) + ->forHumans($syntax, (bool) $short, $parts, $options ?? $this->localHumanDiffOptions ?? static::getHumanDiffOptions()); + } + + /** + * @alias diffForHumans + * + * Get the difference in a human readable format in the current locale from current instance to an other + * instance given (or now if null given). + * + * @param Carbon|\DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below; + * if null passed, now will be used as comparison reference; + * if any other type, it will be converted to date and used as reference. + * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: + * - 'syntax' entry (see below) + * - 'short' entry (see below) + * - 'parts' entry (see below) + * - 'options' entry (see below) + * - 'join' entry determines how to join multiple parts of the string + * ` - if $join is a string, it's used as a joiner glue + * ` - if $join is a callable/closure, it get the list of string and should return a string + * ` - if $join is an array, the first item will be the default glue, and the second item + * ` will be used instead of the glue for the last item + * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) + * ` - if $join is missing, a space will be used as glue + * - 'other' entry (see above) + * if int passed, it add modifiers: + * Possible values: + * - CarbonInterface::DIFF_ABSOLUTE no modifiers + * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier + * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier + * Default value: CarbonInterface::DIFF_ABSOLUTE + * @param bool $short displays short format of time units + * @param int $parts maximum number of parts to display (default value: 1: single unit) + * @param int $options human diff options + * + * @return string + */ + public function from($other = null, $syntax = null, $short = false, $parts = 1, $options = null) + { + return $this->diffForHumans($other, $syntax, $short, $parts, $options); + } + + /** + * @alias diffForHumans + * + * Get the difference in a human readable format in the current locale from current instance to an other + * instance given (or now if null given). + */ + public function since($other = null, $syntax = null, $short = false, $parts = 1, $options = null) + { + return $this->diffForHumans($other, $syntax, $short, $parts, $options); + } + + /** + * Get the difference in a human readable format in the current locale from an other + * instance given (or now if null given) to current instance. + * + * When comparing a value in the past to default now: + * 1 hour from now + * 5 months from now + * + * When comparing a value in the future to default now: + * 1 hour ago + * 5 months ago + * + * When comparing a value in the past to another value: + * 1 hour after + * 5 months after + * + * When comparing a value in the future to another value: + * 1 hour before + * 5 months before + * + * @param Carbon|\DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below; + * if null passed, now will be used as comparison reference; + * if any other type, it will be converted to date and used as reference. + * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: + * - 'syntax' entry (see below) + * - 'short' entry (see below) + * - 'parts' entry (see below) + * - 'options' entry (see below) + * - 'join' entry determines how to join multiple parts of the string + * ` - if $join is a string, it's used as a joiner glue + * ` - if $join is a callable/closure, it get the list of string and should return a string + * ` - if $join is an array, the first item will be the default glue, and the second item + * ` will be used instead of the glue for the last item + * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) + * ` - if $join is missing, a space will be used as glue + * - 'other' entry (see above) + * if int passed, it add modifiers: + * Possible values: + * - CarbonInterface::DIFF_ABSOLUTE no modifiers + * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier + * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier + * Default value: CarbonInterface::DIFF_ABSOLUTE + * @param bool $short displays short format of time units + * @param int $parts maximum number of parts to display (default value: 1: single unit) + * @param int $options human diff options + * + * @return string + */ + public function to($other = null, $syntax = null, $short = false, $parts = 1, $options = null) + { + if (!$syntax && !$other) { + $syntax = CarbonInterface::DIFF_RELATIVE_TO_NOW; + } + + return $this->resolveCarbon($other)->diffForHumans($this, $syntax, $short, $parts, $options); + } + + /** + * @alias to + * + * Get the difference in a human readable format in the current locale from an other + * instance given (or now if null given) to current instance. + * + * @param Carbon|\DateTimeInterface|string|array|null $other if array passed, will be used as parameters array, see $syntax below; + * if null passed, now will be used as comparison reference; + * if any other type, it will be converted to date and used as reference. + * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: + * - 'syntax' entry (see below) + * - 'short' entry (see below) + * - 'parts' entry (see below) + * - 'options' entry (see below) + * - 'join' entry determines how to join multiple parts of the string + * ` - if $join is a string, it's used as a joiner glue + * ` - if $join is a callable/closure, it get the list of string and should return a string + * ` - if $join is an array, the first item will be the default glue, and the second item + * ` will be used instead of the glue for the last item + * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) + * ` - if $join is missing, a space will be used as glue + * - 'other' entry (see above) + * if int passed, it add modifiers: + * Possible values: + * - CarbonInterface::DIFF_ABSOLUTE no modifiers + * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier + * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier + * Default value: CarbonInterface::DIFF_ABSOLUTE + * @param bool $short displays short format of time units + * @param int $parts maximum number of parts to display (default value: 1: single unit) + * @param int $options human diff options + * + * @return string + */ + public function until($other = null, $syntax = null, $short = false, $parts = 1, $options = null) + { + return $this->to($other, $syntax, $short, $parts, $options); + } + + /** + * Get the difference in a human readable format in the current locale from current + * instance to now. + * + * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: + * - 'syntax' entry (see below) + * - 'short' entry (see below) + * - 'parts' entry (see below) + * - 'options' entry (see below) + * - 'join' entry determines how to join multiple parts of the string + * ` - if $join is a string, it's used as a joiner glue + * ` - if $join is a callable/closure, it get the list of string and should return a string + * ` - if $join is an array, the first item will be the default glue, and the second item + * ` will be used instead of the glue for the last item + * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) + * ` - if $join is missing, a space will be used as glue + * if int passed, it add modifiers: + * Possible values: + * - CarbonInterface::DIFF_ABSOLUTE no modifiers + * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier + * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier + * Default value: CarbonInterface::DIFF_ABSOLUTE + * @param bool $short displays short format of time units + * @param int $parts maximum number of parts to display (default value: 1: single unit) + * @param int $options human diff options + * + * @return string + */ + public function fromNow($syntax = null, $short = false, $parts = 1, $options = null) + { + $other = null; + + if ($syntax instanceof DateTimeInterface) { + [$other, $syntax, $short, $parts, $options] = array_pad(\func_get_args(), 5, null); + } + + return $this->from($other, $syntax, $short, $parts, $options); + } + + /** + * Get the difference in a human readable format in the current locale from an other + * instance given to now + * + * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: + * - 'syntax' entry (see below) + * - 'short' entry (see below) + * - 'parts' entry (see below) + * - 'options' entry (see below) + * - 'join' entry determines how to join multiple parts of the string + * ` - if $join is a string, it's used as a joiner glue + * ` - if $join is a callable/closure, it get the list of string and should return a string + * ` - if $join is an array, the first item will be the default glue, and the second item + * ` will be used instead of the glue for the last item + * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) + * ` - if $join is missing, a space will be used as glue + * if int passed, it add modifiers: + * Possible values: + * - CarbonInterface::DIFF_ABSOLUTE no modifiers + * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier + * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier + * Default value: CarbonInterface::DIFF_ABSOLUTE + * @param bool $short displays short format of time units + * @param int $parts maximum number of parts to display (default value: 1: single part) + * @param int $options human diff options + * + * @return string + */ + public function toNow($syntax = null, $short = false, $parts = 1, $options = null) + { + return $this->to(null, $syntax, $short, $parts, $options); + } + + /** + * Get the difference in a human readable format in the current locale from an other + * instance given to now + * + * @param int|array $syntax if array passed, parameters will be extracted from it, the array may contains: + * - 'syntax' entry (see below) + * - 'short' entry (see below) + * - 'parts' entry (see below) + * - 'options' entry (see below) + * - 'join' entry determines how to join multiple parts of the string + * ` - if $join is a string, it's used as a joiner glue + * ` - if $join is a callable/closure, it get the list of string and should return a string + * ` - if $join is an array, the first item will be the default glue, and the second item + * ` will be used instead of the glue for the last item + * ` - if $join is true, it will be guessed from the locale ('list' translation file entry) + * ` - if $join is missing, a space will be used as glue + * if int passed, it add modifiers: + * Possible values: + * - CarbonInterface::DIFF_ABSOLUTE no modifiers + * - CarbonInterface::DIFF_RELATIVE_TO_NOW add ago/from now modifier + * - CarbonInterface::DIFF_RELATIVE_TO_OTHER add before/after modifier + * Default value: CarbonInterface::DIFF_ABSOLUTE + * @param bool $short displays short format of time units + * @param int $parts maximum number of parts to display (default value: 1: single part) + * @param int $options human diff options + * + * @return string + */ + public function ago($syntax = null, $short = false, $parts = 1, $options = null) + { + $other = null; + + if ($syntax instanceof DateTimeInterface) { + [$other, $syntax, $short, $parts, $options] = array_pad(\func_get_args(), 5, null); + } + + return $this->from($other, $syntax, $short, $parts, $options); + } + + /** + * Get the difference in a human readable format in the current locale from current instance to an other + * instance given (or now if null given). + * + * @return string + */ + public function timespan($other = null, $timezone = null) + { + if (!$other instanceof DateTimeInterface) { + $other = static::parse($other, $timezone); + } + + return $this->diffForHumans($other, [ + 'join' => ', ', + 'syntax' => CarbonInterface::DIFF_ABSOLUTE, + 'options' => CarbonInterface::NO_ZERO_DIFF, + 'parts' => -1, + ]); + } + + /** + * Returns either day of week + time (e.g. "Last Friday at 3:30 PM") if reference time is within 7 days, + * or a calendar date (e.g. "10/29/2017") otherwise. + * + * Language, date and time formats will change according to the current locale. + * + * @param Carbon|\DateTimeInterface|string|null $referenceTime + * @param array $formats + * + * @return string + */ + public function calendar($referenceTime = null, array $formats = []) + { + /** @var CarbonInterface $current */ + $current = $this->avoidMutation()->startOfDay(); + /** @var CarbonInterface $other */ + $other = $this->resolveCarbon($referenceTime)->avoidMutation()->setTimezone($this->getTimezone())->startOfDay(); + $diff = $other->diffInDays($current, false); + $format = $diff < -6 ? 'sameElse' : ( + $diff < -1 ? 'lastWeek' : ( + $diff < 0 ? 'lastDay' : ( + $diff < 1 ? 'sameDay' : ( + $diff < 2 ? 'nextDay' : ( + $diff < 7 ? 'nextWeek' : 'sameElse' + ) + ) + ) + ) + ); + $format = array_merge($this->getCalendarFormats(), $formats)[$format]; + if ($format instanceof Closure) { + $format = $format($current, $other) ?? ''; + } + + return $this->isoFormat((string) $format); + } + + private function getIntervalDayDiff(DateInterval $interval): int + { + $daysDiff = (int) $interval->format('%a'); + $sign = $interval->format('%r') === '-' ? -1 : 1; + + if (\is_int($interval->days) && + $interval->y === 0 && + $interval->m === 0 && + version_compare(PHP_VERSION, '8.1.0-dev', '<') && + abs($interval->d - $daysDiff) === 1 + ) { + $daysDiff = abs($interval->d); // @codeCoverageIgnore + } + + return $daysDiff * $sign; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/IntervalRounding.php b/vendor/nesbot/carbon/src/Carbon/Traits/IntervalRounding.php new file mode 100644 index 00000000..f069c280 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/IntervalRounding.php @@ -0,0 +1,57 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +use Carbon\CarbonInterval; +use Carbon\Exceptions\InvalidIntervalException; +use DateInterval; + +/** + * Trait to call rounding methods to interval or the interval of a period. + */ +trait IntervalRounding +{ + protected function callRoundMethod(string $method, array $parameters) + { + $action = substr($method, 0, 4); + + if ($action !== 'ceil') { + $action = substr($method, 0, 5); + } + + if (\in_array($action, ['round', 'floor', 'ceil'])) { + return $this->{$action.'Unit'}(substr($method, \strlen($action)), ...$parameters); + } + + return null; + } + + protected function roundWith($precision, $function) + { + $unit = 'second'; + + if ($precision instanceof DateInterval) { + $precision = (string) CarbonInterval::instance($precision, [], true); + } + + if (\is_string($precision) && preg_match('/^\s*(?<precision>\d+)?\s*(?<unit>\w+)(?<other>\W.*)?$/', $precision, $match)) { + if (trim($match['other'] ?? '') !== '') { + throw new InvalidIntervalException('Rounding is only possible with single unit intervals.'); + } + + $precision = (int) ($match['precision'] ?: 1); + $unit = $match['unit']; + } + + return $this->roundUnit($unit, $precision, $function); + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/IntervalStep.php b/vendor/nesbot/carbon/src/Carbon/Traits/IntervalStep.php new file mode 100644 index 00000000..82d7c326 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/IntervalStep.php @@ -0,0 +1,93 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +use Carbon\Carbon; +use Carbon\CarbonImmutable; +use Carbon\CarbonInterface; +use Closure; +use DateTimeImmutable; +use DateTimeInterface; + +trait IntervalStep +{ + /** + * Step to apply instead of a fixed interval to get the new date. + * + * @var Closure|null + */ + protected $step; + + /** + * Get the dynamic step in use. + * + * @return Closure + */ + public function getStep(): ?Closure + { + return $this->step; + } + + /** + * Set a step to apply instead of a fixed interval to get the new date. + * + * Or pass null to switch to fixed interval. + * + * @param Closure|null $step + */ + public function setStep(?Closure $step): void + { + $this->step = $step; + } + + /** + * Take a date and apply either the step if set, or the current interval else. + * + * The interval/step is applied negatively (typically subtraction instead of addition) if $negated is true. + * + * @param DateTimeInterface $dateTime + * @param bool $negated + * + * @return CarbonInterface + */ + public function convertDate(DateTimeInterface $dateTime, bool $negated = false): CarbonInterface + { + /** @var CarbonInterface $carbonDate */ + $carbonDate = $dateTime instanceof CarbonInterface ? $dateTime : $this->resolveCarbon($dateTime); + + if ($this->step) { + return $carbonDate->setDateTimeFrom(($this->step)($carbonDate->avoidMutation(), $negated)); + } + + if ($negated) { + return $carbonDate->rawSub($this); + } + + return $carbonDate->rawAdd($this); + } + + /** + * Convert DateTimeImmutable instance to CarbonImmutable instance and DateTime instance to Carbon instance. + * + * @param DateTimeInterface $dateTime + * + * @return Carbon|CarbonImmutable + */ + private function resolveCarbon(DateTimeInterface $dateTime) + { + if ($dateTime instanceof DateTimeImmutable) { + return CarbonImmutable::instance($dateTime); + } + + return Carbon::instance($dateTime); + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Localization.php b/vendor/nesbot/carbon/src/Carbon/Traits/Localization.php new file mode 100644 index 00000000..46aff113 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Localization.php @@ -0,0 +1,840 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +use Carbon\CarbonInterface; +use Carbon\Exceptions\InvalidTypeException; +use Carbon\Exceptions\NotLocaleAwareException; +use Carbon\Language; +use Carbon\Translator; +use Carbon\TranslatorStrongTypeInterface; +use Closure; +use Symfony\Component\Translation\TranslatorBagInterface; +use Symfony\Component\Translation\TranslatorInterface; +use Symfony\Contracts\Translation\LocaleAwareInterface; +use Symfony\Contracts\Translation\TranslatorInterface as ContractsTranslatorInterface; + +// @codeCoverageIgnoreStart +if (interface_exists('Symfony\\Contracts\\Translation\\TranslatorInterface') && + !interface_exists('Symfony\\Component\\Translation\\TranslatorInterface') +) { + class_alias( + 'Symfony\\Contracts\\Translation\\TranslatorInterface', + 'Symfony\\Component\\Translation\\TranslatorInterface' + ); +} +// @codeCoverageIgnoreEnd + +/** + * Trait Localization. + * + * Embed default and locale translators and translation base methods. + */ +trait Localization +{ + /** + * Default translator. + * + * @var \Symfony\Component\Translation\TranslatorInterface + */ + protected static $translator; + + /** + * Specific translator of the current instance. + * + * @var \Symfony\Component\Translation\TranslatorInterface + */ + protected $localTranslator; + + /** + * Options for diffForHumans(). + * + * @var int + */ + protected static $humanDiffOptions = CarbonInterface::NO_ZERO_DIFF; + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * @see settings + * + * @param int $humanDiffOptions + */ + public static function setHumanDiffOptions($humanDiffOptions) + { + static::$humanDiffOptions = $humanDiffOptions; + } + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * @see settings + * + * @param int $humanDiffOption + */ + public static function enableHumanDiffOption($humanDiffOption) + { + static::$humanDiffOptions = static::getHumanDiffOptions() | $humanDiffOption; + } + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * @see settings + * + * @param int $humanDiffOption + */ + public static function disableHumanDiffOption($humanDiffOption) + { + static::$humanDiffOptions = static::getHumanDiffOptions() & ~$humanDiffOption; + } + + /** + * Return default humanDiff() options (merged flags as integer). + * + * @return int + */ + public static function getHumanDiffOptions() + { + return static::$humanDiffOptions; + } + + /** + * Get the default translator instance in use. + * + * @return \Symfony\Component\Translation\TranslatorInterface + */ + public static function getTranslator() + { + return static::translator(); + } + + /** + * Set the default translator instance to use. + * + * @param \Symfony\Component\Translation\TranslatorInterface $translator + * + * @return void + */ + public static function setTranslator(TranslatorInterface $translator) + { + static::$translator = $translator; + } + + /** + * Return true if the current instance has its own translator. + * + * @return bool + */ + public function hasLocalTranslator() + { + return isset($this->localTranslator); + } + + /** + * Get the translator of the current instance or the default if none set. + * + * @return \Symfony\Component\Translation\TranslatorInterface + */ + public function getLocalTranslator() + { + return $this->localTranslator ?: static::translator(); + } + + /** + * Set the translator for the current instance. + * + * @param \Symfony\Component\Translation\TranslatorInterface $translator + * + * @return $this + */ + public function setLocalTranslator(TranslatorInterface $translator) + { + $this->localTranslator = $translator; + + return $this; + } + + /** + * Returns raw translation message for a given key. + * + * @param \Symfony\Component\Translation\TranslatorInterface $translator the translator to use + * @param string $key key to find + * @param string|null $locale current locale used if null + * @param string|null $default default value if translation returns the key + * + * @return string + */ + public static function getTranslationMessageWith($translator, string $key, ?string $locale = null, ?string $default = null) + { + if (!($translator instanceof TranslatorBagInterface && $translator instanceof TranslatorInterface)) { + throw new InvalidTypeException( + 'Translator does not implement '.TranslatorInterface::class.' and '.TranslatorBagInterface::class.'. '. + (\is_object($translator) ? \get_class($translator) : \gettype($translator)).' has been given.' + ); + } + + if (!$locale && $translator instanceof LocaleAwareInterface) { + $locale = $translator->getLocale(); + } + + $result = self::getFromCatalogue($translator, $translator->getCatalogue($locale), $key); + + return $result === $key ? $default : $result; + } + + /** + * Returns raw translation message for a given key. + * + * @param string $key key to find + * @param string|null $locale current locale used if null + * @param string|null $default default value if translation returns the key + * @param \Symfony\Component\Translation\TranslatorInterface $translator an optional translator to use + * + * @return string + */ + public function getTranslationMessage(string $key, ?string $locale = null, ?string $default = null, $translator = null) + { + return static::getTranslationMessageWith($translator ?: $this->getLocalTranslator(), $key, $locale, $default); + } + + /** + * Translate using translation string or callback available. + * + * @param \Symfony\Component\Translation\TranslatorInterface $translator + * @param string $key + * @param array $parameters + * @param null $number + * + * @return string + */ + public static function translateWith(TranslatorInterface $translator, string $key, array $parameters = [], $number = null): string + { + $message = static::getTranslationMessageWith($translator, $key, null, $key); + if ($message instanceof Closure) { + return (string) $message(...array_values($parameters)); + } + + if ($number !== null) { + $parameters['%count%'] = $number; + } + if (isset($parameters['%count%'])) { + $parameters[':count'] = $parameters['%count%']; + } + + // @codeCoverageIgnoreStart + $choice = $translator instanceof ContractsTranslatorInterface + ? $translator->trans($key, $parameters) + : $translator->transChoice($key, $number, $parameters); + // @codeCoverageIgnoreEnd + + return (string) $choice; + } + + /** + * Translate using translation string or callback available. + * + * @param string $key + * @param array $parameters + * @param string|int|float|null $number + * @param \Symfony\Component\Translation\TranslatorInterface|null $translator + * @param bool $altNumbers + * + * @return string + */ + public function translate(string $key, array $parameters = [], $number = null, ?TranslatorInterface $translator = null, bool $altNumbers = false): string + { + $translation = static::translateWith($translator ?: $this->getLocalTranslator(), $key, $parameters, $number); + + if ($number !== null && $altNumbers) { + return str_replace($number, $this->translateNumber($number), $translation); + } + + return $translation; + } + + /** + * Returns the alternative number for a given integer if available in the current locale. + * + * @param int $number + * + * @return string + */ + public function translateNumber(int $number): string + { + $translateKey = "alt_numbers.$number"; + $symbol = $this->translate($translateKey); + + if ($symbol !== $translateKey) { + return $symbol; + } + + if ($number > 99 && $this->translate('alt_numbers.99') !== 'alt_numbers.99') { + $start = ''; + foreach ([10000, 1000, 100] as $exp) { + $key = "alt_numbers_pow.$exp"; + if ($number >= $exp && $number < $exp * 10 && ($pow = $this->translate($key)) !== $key) { + $unit = floor($number / $exp); + $number -= $unit * $exp; + $start .= ($unit > 1 ? $this->translate("alt_numbers.$unit") : '').$pow; + } + } + $result = ''; + while ($number) { + $chunk = $number % 100; + $result = $this->translate("alt_numbers.$chunk").$result; + $number = floor($number / 100); + } + + return "$start$result"; + } + + if ($number > 9 && $this->translate('alt_numbers.9') !== 'alt_numbers.9') { + $result = ''; + while ($number) { + $chunk = $number % 10; + $result = $this->translate("alt_numbers.$chunk").$result; + $number = floor($number / 10); + } + + return $result; + } + + return (string) $number; + } + + /** + * Translate a time string from a locale to an other. + * + * @param string $timeString date/time/duration string to translate (may also contain English) + * @param string|null $from input locale of the $timeString parameter (`Carbon::getLocale()` by default) + * @param string|null $to output locale of the result returned (`"en"` by default) + * @param int $mode specify what to translate with options: + * - CarbonInterface::TRANSLATE_ALL (default) + * - CarbonInterface::TRANSLATE_MONTHS + * - CarbonInterface::TRANSLATE_DAYS + * - CarbonInterface::TRANSLATE_UNITS + * - CarbonInterface::TRANSLATE_MERIDIEM + * You can use pipe to group: CarbonInterface::TRANSLATE_MONTHS | CarbonInterface::TRANSLATE_DAYS + * + * @return string + */ + public static function translateTimeString($timeString, $from = null, $to = null, $mode = CarbonInterface::TRANSLATE_ALL) + { + // Fallback source and destination locales + $from = $from ?: static::getLocale(); + $to = $to ?: 'en'; + + if ($from === $to) { + return $timeString; + } + + // Standardize apostrophe + $timeString = strtr($timeString, ['’' => "'"]); + + $fromTranslations = []; + $toTranslations = []; + + foreach (['from', 'to'] as $key) { + $language = $$key; + $translator = Translator::get($language); + $translations = $translator->getMessages(); + + if (!isset($translations[$language])) { + return $timeString; + } + + $translationKey = $key.'Translations'; + $messages = $translations[$language]; + $months = $messages['months'] ?? []; + $weekdays = $messages['weekdays'] ?? []; + $meridiem = $messages['meridiem'] ?? ['AM', 'PM']; + + if (isset($messages['ordinal_words'])) { + $timeString = self::replaceOrdinalWords( + $timeString, + $key === 'from' ? array_flip($messages['ordinal_words']) : $messages['ordinal_words'] + ); + } + + if ($key === 'from') { + foreach (['months', 'weekdays'] as $variable) { + $list = $messages[$variable.'_standalone'] ?? null; + + if ($list) { + foreach ($$variable as $index => &$name) { + $name .= '|'.$messages[$variable.'_standalone'][$index]; + } + } + } + } + + $$translationKey = array_merge( + $mode & CarbonInterface::TRANSLATE_MONTHS ? static::getTranslationArray($months, 12, $timeString) : [], + $mode & CarbonInterface::TRANSLATE_MONTHS ? static::getTranslationArray($messages['months_short'] ?? [], 12, $timeString) : [], + $mode & CarbonInterface::TRANSLATE_DAYS ? static::getTranslationArray($weekdays, 7, $timeString) : [], + $mode & CarbonInterface::TRANSLATE_DAYS ? static::getTranslationArray($messages['weekdays_short'] ?? [], 7, $timeString) : [], + $mode & CarbonInterface::TRANSLATE_DIFF ? static::translateWordsByKeys([ + 'diff_now', + 'diff_today', + 'diff_yesterday', + 'diff_tomorrow', + 'diff_before_yesterday', + 'diff_after_tomorrow', + ], $messages, $key) : [], + $mode & CarbonInterface::TRANSLATE_UNITS ? static::translateWordsByKeys([ + 'year', + 'month', + 'week', + 'day', + 'hour', + 'minute', + 'second', + ], $messages, $key) : [], + $mode & CarbonInterface::TRANSLATE_MERIDIEM ? array_map(function ($hour) use ($meridiem) { + if (\is_array($meridiem)) { + return $meridiem[$hour < 12 ? 0 : 1]; + } + + return $meridiem($hour, 0, false); + }, range(0, 23)) : [] + ); + } + + return substr(preg_replace_callback('/(?<=[\d\s+.\/,_-])('.implode('|', $fromTranslations).')(?=[\d\s+.\/,_-])/iu', function ($match) use ($fromTranslations, $toTranslations) { + [$chunk] = $match; + + foreach ($fromTranslations as $index => $word) { + if (preg_match("/^$word\$/iu", $chunk)) { + return $toTranslations[$index] ?? ''; + } + } + + return $chunk; // @codeCoverageIgnore + }, " $timeString "), 1, -1); + } + + /** + * Translate a time string from the current locale (`$date->locale()`) to an other. + * + * @param string $timeString time string to translate + * @param string|null $to output locale of the result returned ("en" by default) + * + * @return string + */ + public function translateTimeStringTo($timeString, $to = null) + { + return static::translateTimeString($timeString, $this->getTranslatorLocale(), $to); + } + + /** + * Get/set the locale for the current instance. + * + * @param string|null $locale + * @param string ...$fallbackLocales + * + * @return $this|string + */ + public function locale(string $locale = null, ...$fallbackLocales) + { + if ($locale === null) { + return $this->getTranslatorLocale(); + } + + if (!$this->localTranslator || $this->getTranslatorLocale($this->localTranslator) !== $locale) { + $translator = Translator::get($locale); + + if (!empty($fallbackLocales)) { + $translator->setFallbackLocales($fallbackLocales); + + foreach ($fallbackLocales as $fallbackLocale) { + $messages = Translator::get($fallbackLocale)->getMessages(); + + if (isset($messages[$fallbackLocale])) { + $translator->setMessages($fallbackLocale, $messages[$fallbackLocale]); + } + } + } + + $this->localTranslator = $translator; + } + + return $this; + } + + /** + * Get the current translator locale. + * + * @return string + */ + public static function getLocale() + { + return static::getLocaleAwareTranslator()->getLocale(); + } + + /** + * Set the current translator locale and indicate if the source locale file exists. + * Pass 'auto' as locale to use closest language from the current LC_TIME locale. + * + * @param string $locale locale ex. en + * + * @return bool + */ + public static function setLocale($locale) + { + return static::getLocaleAwareTranslator()->setLocale($locale) !== false; + } + + /** + * Set the fallback locale. + * + * @see https://symfony.com/doc/current/components/translation.html#fallback-locales + * + * @param string $locale + */ + public static function setFallbackLocale($locale) + { + $translator = static::getTranslator(); + + if (method_exists($translator, 'setFallbackLocales')) { + $translator->setFallbackLocales([$locale]); + + if ($translator instanceof Translator) { + $preferredLocale = $translator->getLocale(); + $translator->setMessages($preferredLocale, array_replace_recursive( + $translator->getMessages()[$locale] ?? [], + Translator::get($locale)->getMessages()[$locale] ?? [], + $translator->getMessages($preferredLocale) + )); + } + } + } + + /** + * Get the fallback locale. + * + * @see https://symfony.com/doc/current/components/translation.html#fallback-locales + * + * @return string|null + */ + public static function getFallbackLocale() + { + $translator = static::getTranslator(); + + if (method_exists($translator, 'getFallbackLocales')) { + return $translator->getFallbackLocales()[0] ?? null; + } + + return null; + } + + /** + * Set the current locale to the given, execute the passed function, reset the locale to previous one, + * then return the result of the closure (or null if the closure was void). + * + * @param string $locale locale ex. en + * @param callable $func + * + * @return mixed + */ + public static function executeWithLocale($locale, $func) + { + $currentLocale = static::getLocale(); + $result = $func(static::setLocale($locale) ? static::getLocale() : false, static::translator()); + static::setLocale($currentLocale); + + return $result; + } + + /** + * Returns true if the given locale is internally supported and has short-units support. + * Support is considered enabled if either year, day or hour has a short variant translated. + * + * @param string $locale locale ex. en + * + * @return bool + */ + public static function localeHasShortUnits($locale) + { + return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { + return ($newLocale && (($y = static::translateWith($translator, 'y')) !== 'y' && $y !== static::translateWith($translator, 'year'))) || ( + ($y = static::translateWith($translator, 'd')) !== 'd' && + $y !== static::translateWith($translator, 'day') + ) || ( + ($y = static::translateWith($translator, 'h')) !== 'h' && + $y !== static::translateWith($translator, 'hour') + ); + }); + } + + /** + * Returns true if the given locale is internally supported and has diff syntax support (ago, from now, before, after). + * Support is considered enabled if the 4 sentences are translated in the given locale. + * + * @param string $locale locale ex. en + * + * @return bool + */ + public static function localeHasDiffSyntax($locale) + { + return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { + if (!$newLocale) { + return false; + } + + foreach (['ago', 'from_now', 'before', 'after'] as $key) { + if ($translator instanceof TranslatorBagInterface && + self::getFromCatalogue($translator, $translator->getCatalogue($newLocale), $key) instanceof Closure + ) { + continue; + } + + if ($translator->trans($key) === $key) { + return false; + } + } + + return true; + }); + } + + /** + * Returns true if the given locale is internally supported and has words for 1-day diff (just now, yesterday, tomorrow). + * Support is considered enabled if the 3 words are translated in the given locale. + * + * @param string $locale locale ex. en + * + * @return bool + */ + public static function localeHasDiffOneDayWords($locale) + { + return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { + return $newLocale && + $translator->trans('diff_now') !== 'diff_now' && + $translator->trans('diff_yesterday') !== 'diff_yesterday' && + $translator->trans('diff_tomorrow') !== 'diff_tomorrow'; + }); + } + + /** + * Returns true if the given locale is internally supported and has words for 2-days diff (before yesterday, after tomorrow). + * Support is considered enabled if the 2 words are translated in the given locale. + * + * @param string $locale locale ex. en + * + * @return bool + */ + public static function localeHasDiffTwoDayWords($locale) + { + return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { + return $newLocale && + $translator->trans('diff_before_yesterday') !== 'diff_before_yesterday' && + $translator->trans('diff_after_tomorrow') !== 'diff_after_tomorrow'; + }); + } + + /** + * Returns true if the given locale is internally supported and has period syntax support (X times, every X, from X, to X). + * Support is considered enabled if the 4 sentences are translated in the given locale. + * + * @param string $locale locale ex. en + * + * @return bool + */ + public static function localeHasPeriodSyntax($locale) + { + return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { + return $newLocale && + $translator->trans('period_recurrences') !== 'period_recurrences' && + $translator->trans('period_interval') !== 'period_interval' && + $translator->trans('period_start_date') !== 'period_start_date' && + $translator->trans('period_end_date') !== 'period_end_date'; + }); + } + + /** + * Returns the list of internally available locales and already loaded custom locales. + * (It will ignore custom translator dynamic loading.) + * + * @return array + */ + public static function getAvailableLocales() + { + $translator = static::getLocaleAwareTranslator(); + + return $translator instanceof Translator + ? $translator->getAvailableLocales() + : [$translator->getLocale()]; + } + + /** + * Returns list of Language object for each available locale. This object allow you to get the ISO name, native + * name, region and variant of the locale. + * + * @return Language[] + */ + public static function getAvailableLocalesInfo() + { + $languages = []; + foreach (static::getAvailableLocales() as $id) { + $languages[$id] = new Language($id); + } + + return $languages; + } + + /** + * Initialize the default translator instance if necessary. + * + * @return \Symfony\Component\Translation\TranslatorInterface + */ + protected static function translator() + { + if (static::$translator === null) { + static::$translator = Translator::get(); + } + + return static::$translator; + } + + /** + * Get the locale of a given translator. + * + * If null or omitted, current local translator is used. + * If no local translator is in use, current global translator is used. + * + * @param null $translator + * + * @return string|null + */ + protected function getTranslatorLocale($translator = null): ?string + { + if (\func_num_args() === 0) { + $translator = $this->getLocalTranslator(); + } + + $translator = static::getLocaleAwareTranslator($translator); + + return $translator ? $translator->getLocale() : null; + } + + /** + * Throw an error if passed object is not LocaleAwareInterface. + * + * @param LocaleAwareInterface|null $translator + * + * @return LocaleAwareInterface|null + */ + protected static function getLocaleAwareTranslator($translator = null) + { + if (\func_num_args() === 0) { + $translator = static::translator(); + } + + if ($translator && !($translator instanceof LocaleAwareInterface || method_exists($translator, 'getLocale'))) { + throw new NotLocaleAwareException($translator); // @codeCoverageIgnore + } + + return $translator; + } + + /** + * @param mixed $translator + * @param \Symfony\Component\Translation\MessageCatalogueInterface $catalogue + * + * @return mixed + */ + private static function getFromCatalogue($translator, $catalogue, string $id, string $domain = 'messages') + { + return $translator instanceof TranslatorStrongTypeInterface + ? $translator->getFromCatalogue($catalogue, $id, $domain) // @codeCoverageIgnore + : $catalogue->get($id, $domain); + } + + /** + * Return the word cleaned from its translation codes. + * + * @param string $word + * + * @return string + */ + private static function cleanWordFromTranslationString($word) + { + $word = str_replace([':count', '%count', ':time'], '', $word); + $word = strtr($word, ['’' => "'"]); + $word = preg_replace('/({\d+(,(\d+|Inf))?}|[\[\]]\d+(,(\d+|Inf))?[\[\]])/', '', $word); + + return trim($word); + } + + /** + * Translate a list of words. + * + * @param string[] $keys keys to translate. + * @param string[] $messages messages bag handling translations. + * @param string $key 'to' (to get the translation) or 'from' (to get the detection RegExp pattern). + * + * @return string[] + */ + private static function translateWordsByKeys($keys, $messages, $key): array + { + return array_map(function ($wordKey) use ($messages, $key) { + $message = $key === 'from' && isset($messages[$wordKey.'_regexp']) + ? $messages[$wordKey.'_regexp'] + : ($messages[$wordKey] ?? null); + + if (!$message) { + return '>>DO NOT REPLACE<<'; + } + + $parts = explode('|', $message); + + return $key === 'to' + ? self::cleanWordFromTranslationString(end($parts)) + : '(?:'.implode('|', array_map([static::class, 'cleanWordFromTranslationString'], $parts)).')'; + }, $keys); + } + + /** + * Get an array of translations based on the current date. + * + * @param callable $translation + * @param int $length + * @param string $timeString + * + * @return string[] + */ + private static function getTranslationArray($translation, $length, $timeString): array + { + $filler = '>>DO NOT REPLACE<<'; + + if (\is_array($translation)) { + return array_pad($translation, $length, $filler); + } + + $list = []; + $date = static::now(); + + for ($i = 0; $i < $length; $i++) { + $list[] = $translation($date, $timeString, $i) ?? $filler; + } + + return $list; + } + + private static function replaceOrdinalWords(string $timeString, array $ordinalWords): string + { + return preg_replace_callback('/(?<![a-z])[a-z]+(?![a-z])/i', function (array $match) use ($ordinalWords) { + return $ordinalWords[mb_strtolower($match[0])] ?? $match[0]; + }, $timeString); + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Macro.php b/vendor/nesbot/carbon/src/Carbon/Traits/Macro.php new file mode 100644 index 00000000..92b6c9d8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Macro.php @@ -0,0 +1,136 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +/** + * Trait Macros. + * + * Allows users to register macros within the Carbon class. + */ +trait Macro +{ + use Mixin; + + /** + * The registered macros. + * + * @var array + */ + protected static $globalMacros = []; + + /** + * The registered generic macros. + * + * @var array + */ + protected static $globalGenericMacros = []; + + /** + * Register a custom macro. + * + * @example + * ``` + * $userSettings = [ + * 'locale' => 'pt', + * 'timezone' => 'America/Sao_Paulo', + * ]; + * Carbon::macro('userFormat', function () use ($userSettings) { + * return $this->copy()->locale($userSettings['locale'])->tz($userSettings['timezone'])->calendar(); + * }); + * echo Carbon::yesterday()->hours(11)->userFormat(); + * ``` + * + * @param string $name + * @param object|callable $macro + * + * @return void + */ + public static function macro($name, $macro) + { + static::$globalMacros[$name] = $macro; + } + + /** + * Remove all macros and generic macros. + */ + public static function resetMacros() + { + static::$globalMacros = []; + static::$globalGenericMacros = []; + } + + /** + * Register a custom macro. + * + * @param object|callable $macro + * @param int $priority marco with higher priority is tried first + * + * @return void + */ + public static function genericMacro($macro, $priority = 0) + { + if (!isset(static::$globalGenericMacros[$priority])) { + static::$globalGenericMacros[$priority] = []; + krsort(static::$globalGenericMacros, SORT_NUMERIC); + } + + static::$globalGenericMacros[$priority][] = $macro; + } + + /** + * Checks if macro is registered globally. + * + * @param string $name + * + * @return bool + */ + public static function hasMacro($name) + { + return isset(static::$globalMacros[$name]); + } + + /** + * Get the raw callable macro registered globally for a given name. + * + * @param string $name + * + * @return callable|null + */ + public static function getMacro($name) + { + return static::$globalMacros[$name] ?? null; + } + + /** + * Checks if macro is registered globally or locally. + * + * @param string $name + * + * @return bool + */ + public function hasLocalMacro($name) + { + return ($this->localMacros && isset($this->localMacros[$name])) || static::hasMacro($name); + } + + /** + * Get the raw callable macro registered globally or locally for a given name. + * + * @param string $name + * + * @return callable|null + */ + public function getLocalMacro($name) + { + return ($this->localMacros ?? [])[$name] ?? static::getMacro($name); + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/MagicParameter.php b/vendor/nesbot/carbon/src/Carbon/Traits/MagicParameter.php new file mode 100644 index 00000000..310a44d0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/MagicParameter.php @@ -0,0 +1,33 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +/** + * Trait MagicParameter. + * + * Allows to retrieve parameter in magic calls by index or name. + */ +trait MagicParameter +{ + private function getMagicParameter(array $parameters, int $index, string $key, $default) + { + if (\array_key_exists($index, $parameters)) { + return $parameters[$index]; + } + + if (\array_key_exists($key, $parameters)) { + return $parameters[$key]; + } + + return $default; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Mixin.php b/vendor/nesbot/carbon/src/Carbon/Traits/Mixin.php new file mode 100644 index 00000000..58224545 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Mixin.php @@ -0,0 +1,226 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +use Carbon\CarbonInterface; +use Carbon\CarbonInterval; +use Carbon\CarbonPeriod; +use Closure; +use Generator; +use ReflectionClass; +use ReflectionException; +use ReflectionMethod; +use Throwable; + +/** + * Trait Mixin. + * + * Allows mixing in entire classes with multiple macros. + */ +trait Mixin +{ + /** + * Stack of macro instance contexts. + * + * @var array + */ + protected static $macroContextStack = []; + + /** + * Mix another object into the class. + * + * @example + * ``` + * Carbon::mixin(new class { + * public function addMoon() { + * return function () { + * return $this->addDays(30); + * }; + * } + * public function subMoon() { + * return function () { + * return $this->subDays(30); + * }; + * } + * }); + * $fullMoon = Carbon::create('2018-12-22'); + * $nextFullMoon = $fullMoon->addMoon(); + * $blackMoon = Carbon::create('2019-01-06'); + * $previousBlackMoon = $blackMoon->subMoon(); + * echo "$nextFullMoon\n"; + * echo "$previousBlackMoon\n"; + * ``` + * + * @param object|string $mixin + * + * @throws ReflectionException + * + * @return void + */ + public static function mixin($mixin) + { + \is_string($mixin) && trait_exists($mixin) + ? self::loadMixinTrait($mixin) + : self::loadMixinClass($mixin); + } + + /** + * @param object|string $mixin + * + * @throws ReflectionException + */ + private static function loadMixinClass($mixin) + { + $methods = (new ReflectionClass($mixin))->getMethods( + ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED + ); + + foreach ($methods as $method) { + if ($method->isConstructor() || $method->isDestructor()) { + continue; + } + + $method->setAccessible(true); + + static::macro($method->name, $method->invoke($mixin)); + } + } + + /** + * @param string $trait + */ + private static function loadMixinTrait($trait) + { + $context = eval(self::getAnonymousClassCodeForTrait($trait)); + $className = \get_class($context); + $baseClass = static::class; + + foreach (self::getMixableMethods($context) as $name) { + $closureBase = Closure::fromCallable([$context, $name]); + + static::macro($name, function (...$parameters) use ($closureBase, $className, $baseClass) { + $downContext = isset($this) ? ($this) : new $baseClass(); + $context = isset($this) ? $this->cast($className) : new $className(); + + try { + // @ is required to handle error if not converted into exceptions + $closure = @$closureBase->bindTo($context); + } catch (Throwable $throwable) { // @codeCoverageIgnore + $closure = $closureBase; // @codeCoverageIgnore + } + + // in case of errors not converted into exceptions + $closure = $closure ?: $closureBase; + + $result = $closure(...$parameters); + + if (!($result instanceof $className)) { + return $result; + } + + if ($downContext instanceof CarbonInterface && $result instanceof CarbonInterface) { + if ($context !== $result) { + $downContext = $downContext->copy(); + } + + return $downContext + ->setTimezone($result->getTimezone()) + ->modify($result->format('Y-m-d H:i:s.u')) + ->settings($result->getSettings()); + } + + if ($downContext instanceof CarbonInterval && $result instanceof CarbonInterval) { + if ($context !== $result) { + $downContext = $downContext->copy(); + } + + $downContext->copyProperties($result); + self::copyStep($downContext, $result); + self::copyNegativeUnits($downContext, $result); + + return $downContext->settings($result->getSettings()); + } + + if ($downContext instanceof CarbonPeriod && $result instanceof CarbonPeriod) { + if ($context !== $result) { + $downContext = $downContext->copy(); + } + + return $downContext + ->setDates($result->getStartDate(), $result->getEndDate()) + ->setRecurrences($result->getRecurrences()) + ->setOptions($result->getOptions()) + ->settings($result->getSettings()); + } + + return $result; + }); + } + } + + private static function getAnonymousClassCodeForTrait(string $trait) + { + return 'return new class() extends '.static::class.' {use '.$trait.';};'; + } + + private static function getMixableMethods(self $context): Generator + { + foreach (get_class_methods($context) as $name) { + if (method_exists(static::class, $name)) { + continue; + } + + yield $name; + } + } + + /** + * Stack a Carbon context from inside calls of self::this() and execute a given action. + * + * @param static|null $context + * @param callable $callable + * + * @throws Throwable + * + * @return mixed + */ + protected static function bindMacroContext($context, callable $callable) + { + static::$macroContextStack[] = $context; + + try { + return $callable(); + } finally { + array_pop(static::$macroContextStack); + } + } + + /** + * Return the current context from inside a macro callee or a null if static. + * + * @return static|null + */ + protected static function context() + { + return end(static::$macroContextStack) ?: null; + } + + /** + * Return the current context from inside a macro callee or a new one if static. + * + * @return static + */ + protected static function this() + { + return end(static::$macroContextStack) ?: new static(); + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Modifiers.php b/vendor/nesbot/carbon/src/Carbon/Traits/Modifiers.php new file mode 100644 index 00000000..39343d8f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Modifiers.php @@ -0,0 +1,472 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +use Carbon\CarbonInterface; +use ReturnTypeWillChange; + +/** + * Trait Modifiers. + * + * Returns dates relative to current date using modifier short-hand. + */ +trait Modifiers +{ + /** + * Midday/noon hour. + * + * @var int + */ + protected static $midDayAt = 12; + + /** + * get midday/noon hour + * + * @return int + */ + public static function getMidDayAt() + { + return static::$midDayAt; + } + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather consider mid-day is always 12pm, then if you need to test if it's an other + * hour, test it explicitly: + * $date->format('G') == 13 + * or to set explicitly to a given hour: + * $date->setTime(13, 0, 0, 0) + * + * Set midday/noon hour + * + * @param int $hour midday hour + * + * @return void + */ + public static function setMidDayAt($hour) + { + static::$midDayAt = $hour; + } + + /** + * Modify to midday, default to self::$midDayAt + * + * @return static + */ + public function midDay() + { + return $this->setTime(static::$midDayAt, 0, 0, 0); + } + + /** + * Modify to the next occurrence of a given modifier such as a day of + * the week. If no modifier is provided, modify to the next occurrence + * of the current day of the week. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param string|int|null $modifier + * + * @return static|false + */ + public function next($modifier = null) + { + if ($modifier === null) { + $modifier = $this->dayOfWeek; + } + + return $this->change( + 'next '.(\is_string($modifier) ? $modifier : static::$days[$modifier]) + ); + } + + /** + * Go forward or backward to the next week- or weekend-day. + * + * @param bool $weekday + * @param bool $forward + * + * @return static + */ + private function nextOrPreviousDay($weekday = true, $forward = true) + { + /** @var CarbonInterface $date */ + $date = $this; + $step = $forward ? 1 : -1; + + do { + $date = $date->addDays($step); + } while ($weekday ? $date->isWeekend() : $date->isWeekday()); + + return $date; + } + + /** + * Go forward to the next weekday. + * + * @return static + */ + public function nextWeekday() + { + return $this->nextOrPreviousDay(); + } + + /** + * Go backward to the previous weekday. + * + * @return static + */ + public function previousWeekday() + { + return $this->nextOrPreviousDay(true, false); + } + + /** + * Go forward to the next weekend day. + * + * @return static + */ + public function nextWeekendDay() + { + return $this->nextOrPreviousDay(false); + } + + /** + * Go backward to the previous weekend day. + * + * @return static + */ + public function previousWeekendDay() + { + return $this->nextOrPreviousDay(false, false); + } + + /** + * Modify to the previous occurrence of a given modifier such as a day of + * the week. If no dayOfWeek is provided, modify to the previous occurrence + * of the current day of the week. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param string|int|null $modifier + * + * @return static|false + */ + public function previous($modifier = null) + { + if ($modifier === null) { + $modifier = $this->dayOfWeek; + } + + return $this->change( + 'last '.(\is_string($modifier) ? $modifier : static::$days[$modifier]) + ); + } + + /** + * Modify to the first occurrence of a given day of the week + * in the current month. If no dayOfWeek is provided, modify to the + * first day of the current month. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int|null $dayOfWeek + * + * @return static + */ + public function firstOfMonth($dayOfWeek = null) + { + $date = $this->startOfDay(); + + if ($dayOfWeek === null) { + return $date->day(1); + } + + return $date->modify('first '.static::$days[$dayOfWeek].' of '.$date->rawFormat('F').' '.$date->year); + } + + /** + * Modify to the last occurrence of a given day of the week + * in the current month. If no dayOfWeek is provided, modify to the + * last day of the current month. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int|null $dayOfWeek + * + * @return static + */ + public function lastOfMonth($dayOfWeek = null) + { + $date = $this->startOfDay(); + + if ($dayOfWeek === null) { + return $date->day($date->daysInMonth); + } + + return $date->modify('last '.static::$days[$dayOfWeek].' of '.$date->rawFormat('F').' '.$date->year); + } + + /** + * Modify to the given occurrence of a given day of the week + * in the current month. If the calculated occurrence is outside the scope + * of the current month, then return false and no modifications are made. + * Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int $nth + * @param int $dayOfWeek + * + * @return mixed + */ + public function nthOfMonth($nth, $dayOfWeek) + { + $date = $this->avoidMutation()->firstOfMonth(); + $check = $date->rawFormat('Y-m'); + $date = $date->modify('+'.$nth.' '.static::$days[$dayOfWeek]); + + return $date->rawFormat('Y-m') === $check ? $this->modify((string) $date) : false; + } + + /** + * Modify to the first occurrence of a given day of the week + * in the current quarter. If no dayOfWeek is provided, modify to the + * first day of the current quarter. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int|null $dayOfWeek day of the week default null + * + * @return static + */ + public function firstOfQuarter($dayOfWeek = null) + { + return $this->setDate($this->year, $this->quarter * static::MONTHS_PER_QUARTER - 2, 1)->firstOfMonth($dayOfWeek); + } + + /** + * Modify to the last occurrence of a given day of the week + * in the current quarter. If no dayOfWeek is provided, modify to the + * last day of the current quarter. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int|null $dayOfWeek day of the week default null + * + * @return static + */ + public function lastOfQuarter($dayOfWeek = null) + { + return $this->setDate($this->year, $this->quarter * static::MONTHS_PER_QUARTER, 1)->lastOfMonth($dayOfWeek); + } + + /** + * Modify to the given occurrence of a given day of the week + * in the current quarter. If the calculated occurrence is outside the scope + * of the current quarter, then return false and no modifications are made. + * Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int $nth + * @param int $dayOfWeek + * + * @return mixed + */ + public function nthOfQuarter($nth, $dayOfWeek) + { + $date = $this->avoidMutation()->day(1)->month($this->quarter * static::MONTHS_PER_QUARTER); + $lastMonth = $date->month; + $year = $date->year; + $date = $date->firstOfQuarter()->modify('+'.$nth.' '.static::$days[$dayOfWeek]); + + return ($lastMonth < $date->month || $year !== $date->year) ? false : $this->modify((string) $date); + } + + /** + * Modify to the first occurrence of a given day of the week + * in the current year. If no dayOfWeek is provided, modify to the + * first day of the current year. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int|null $dayOfWeek day of the week default null + * + * @return static + */ + public function firstOfYear($dayOfWeek = null) + { + return $this->month(1)->firstOfMonth($dayOfWeek); + } + + /** + * Modify to the last occurrence of a given day of the week + * in the current year. If no dayOfWeek is provided, modify to the + * last day of the current year. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int|null $dayOfWeek day of the week default null + * + * @return static + */ + public function lastOfYear($dayOfWeek = null) + { + return $this->month(static::MONTHS_PER_YEAR)->lastOfMonth($dayOfWeek); + } + + /** + * Modify to the given occurrence of a given day of the week + * in the current year. If the calculated occurrence is outside the scope + * of the current year, then return false and no modifications are made. + * Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int $nth + * @param int $dayOfWeek + * + * @return mixed + */ + public function nthOfYear($nth, $dayOfWeek) + { + $date = $this->avoidMutation()->firstOfYear()->modify('+'.$nth.' '.static::$days[$dayOfWeek]); + + return $this->year === $date->year ? $this->modify((string) $date) : false; + } + + /** + * Modify the current instance to the average of a given instance (default now) and the current instance + * (second-precision). + * + * @param \Carbon\Carbon|\DateTimeInterface|null $date + * + * @return static + */ + public function average($date = null) + { + return $this->addRealMicroseconds((int) ($this->diffInRealMicroseconds($this->resolveCarbon($date), false) / 2)); + } + + /** + * Get the closest date from the instance (second-precision). + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 + * + * @return static + */ + public function closest($date1, $date2) + { + return $this->diffInRealMicroseconds($date1) < $this->diffInRealMicroseconds($date2) ? $date1 : $date2; + } + + /** + * Get the farthest date from the instance (second-precision). + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 + * + * @return static + */ + public function farthest($date1, $date2) + { + return $this->diffInRealMicroseconds($date1) > $this->diffInRealMicroseconds($date2) ? $date1 : $date2; + } + + /** + * Get the minimum instance between a given instance (default now) and the current instance. + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @return static + */ + public function min($date = null) + { + $date = $this->resolveCarbon($date); + + return $this->lt($date) ? $this : $date; + } + + /** + * Get the minimum instance between a given instance (default now) and the current instance. + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see min() + * + * @return static + */ + public function minimum($date = null) + { + return $this->min($date); + } + + /** + * Get the maximum instance between a given instance (default now) and the current instance. + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @return static + */ + public function max($date = null) + { + $date = $this->resolveCarbon($date); + + return $this->gt($date) ? $this : $date; + } + + /** + * Get the maximum instance between a given instance (default now) and the current instance. + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see max() + * + * @return static + */ + public function maximum($date = null) + { + return $this->max($date); + } + + /** + * Calls \DateTime::modify if mutable or \DateTimeImmutable::modify else. + * + * @see https://php.net/manual/en/datetime.modify.php + * + * @return static|false + */ + #[ReturnTypeWillChange] + public function modify($modify) + { + return parent::modify((string) $modify); + } + + /** + * Similar to native modify() method of DateTime but can handle more grammars. + * + * @example + * ``` + * echo Carbon::now()->change('next 2pm'); + * ``` + * + * @link https://php.net/manual/en/datetime.modify.php + * + * @param string $modifier + * + * @return static|false + */ + public function change($modifier) + { + return $this->modify(preg_replace_callback('/^(next|previous|last)\s+(\d{1,2}(h|am|pm|:\d{1,2}(:\d{1,2})?))$/i', function ($match) { + $match[2] = str_replace('h', ':00', $match[2]); + $test = $this->avoidMutation()->modify($match[2]); + $method = $match[1] === 'next' ? 'lt' : 'gt'; + $match[1] = $test->$method($this) ? $match[1].' day' : 'today'; + + return $match[1].' '.$match[2]; + }, strtr(trim($modifier), [ + ' at ' => ' ', + 'just now' => 'now', + 'after tomorrow' => 'tomorrow +1 day', + 'before yesterday' => 'yesterday -1 day', + ]))); + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Mutability.php b/vendor/nesbot/carbon/src/Carbon/Traits/Mutability.php new file mode 100644 index 00000000..561c867d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Mutability.php @@ -0,0 +1,71 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +use Carbon\Carbon; +use Carbon\CarbonImmutable; + +/** + * Trait Mutability. + * + * Utils to know if the current object is mutable or immutable and convert it. + */ +trait Mutability +{ + use Cast; + + /** + * Returns true if the current class/instance is mutable. + * + * @return bool + */ + public static function isMutable() + { + return false; + } + + /** + * Returns true if the current class/instance is immutable. + * + * @return bool + */ + public static function isImmutable() + { + return !static::isMutable(); + } + + /** + * Return a mutable copy of the instance. + * + * @return Carbon + */ + public function toMutable() + { + /** @var Carbon $date */ + $date = $this->cast(Carbon::class); + + return $date; + } + + /** + * Return a immutable copy of the instance. + * + * @return CarbonImmutable + */ + public function toImmutable() + { + /** @var CarbonImmutable $date */ + $date = $this->cast(CarbonImmutable::class); + + return $date; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/ObjectInitialisation.php b/vendor/nesbot/carbon/src/Carbon/Traits/ObjectInitialisation.php new file mode 100644 index 00000000..c77a1024 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/ObjectInitialisation.php @@ -0,0 +1,22 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +trait ObjectInitialisation +{ + /** + * True when parent::__construct has been called. + * + * @var string + */ + protected $constructedObjectId; +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Options.php b/vendor/nesbot/carbon/src/Carbon/Traits/Options.php new file mode 100644 index 00000000..ffad4f14 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Options.php @@ -0,0 +1,471 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +use Carbon\CarbonInterface; +use DateTimeInterface; +use Throwable; + +/** + * Trait Options. + * + * Embed base methods to change settings of Carbon classes. + * + * Depends on the following methods: + * + * @method static shiftTimezone($timezone) Set the timezone + */ +trait Options +{ + use Localization; + + /** + * Customizable PHP_INT_SIZE override. + * + * @var int + */ + public static $PHPIntSize = PHP_INT_SIZE; + + /** + * First day of week. + * + * @var int|string + */ + protected static $weekStartsAt = CarbonInterface::MONDAY; + + /** + * Last day of week. + * + * @var int|string + */ + protected static $weekEndsAt = CarbonInterface::SUNDAY; + + /** + * Days of weekend. + * + * @var array + */ + protected static $weekendDays = [ + CarbonInterface::SATURDAY, + CarbonInterface::SUNDAY, + ]; + + /** + * Format regex patterns. + * + * @var array<string, string> + */ + protected static $regexFormats = [ + 'd' => '(3[01]|[12][0-9]|0[1-9])', + 'D' => '(Sun|Mon|Tue|Wed|Thu|Fri|Sat)', + 'j' => '([123][0-9]|[1-9])', + 'l' => '([a-zA-Z]{2,})', + 'N' => '([1-7])', + 'S' => '(st|nd|rd|th)', + 'w' => '([0-6])', + 'z' => '(36[0-5]|3[0-5][0-9]|[12][0-9]{2}|[1-9]?[0-9])', + 'W' => '(5[012]|[1-4][0-9]|0?[1-9])', + 'F' => '([a-zA-Z]{2,})', + 'm' => '(1[012]|0[1-9])', + 'M' => '([a-zA-Z]{3})', + 'n' => '(1[012]|[1-9])', + 't' => '(2[89]|3[01])', + 'L' => '(0|1)', + 'o' => '([1-9][0-9]{0,4})', + 'Y' => '([1-9]?[0-9]{4})', + 'y' => '([0-9]{2})', + 'a' => '(am|pm)', + 'A' => '(AM|PM)', + 'B' => '([0-9]{3})', + 'g' => '(1[012]|[1-9])', + 'G' => '(2[0-3]|1?[0-9])', + 'h' => '(1[012]|0[1-9])', + 'H' => '(2[0-3]|[01][0-9])', + 'i' => '([0-5][0-9])', + 's' => '([0-5][0-9])', + 'u' => '([0-9]{1,6})', + 'v' => '([0-9]{1,3})', + 'e' => '([a-zA-Z]{1,5})|([a-zA-Z]*\\/[a-zA-Z]*)', + 'I' => '(0|1)', + 'O' => '([+-](1[0123]|0[0-9])[0134][05])', + 'P' => '([+-](1[0123]|0[0-9]):[0134][05])', + 'p' => '(Z|[+-](1[0123]|0[0-9]):[0134][05])', + 'T' => '([a-zA-Z]{1,5})', + 'Z' => '(-?[1-5]?[0-9]{1,4})', + 'U' => '([0-9]*)', + + // The formats below are combinations of the above formats. + 'c' => '(([1-9]?[0-9]{4})-(1[012]|0[1-9])-(3[01]|[12][0-9]|0[1-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])[+-](1[012]|0[0-9]):([0134][05]))', // Y-m-dTH:i:sP + 'r' => '(([a-zA-Z]{3}), ([123][0-9]|0[1-9]) ([a-zA-Z]{3}) ([1-9]?[0-9]{4}) (2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9]) [+-](1[012]|0[0-9])([0134][05]))', // D, d M Y H:i:s O + ]; + + /** + * Format modifiers (such as available in createFromFormat) regex patterns. + * + * @var array + */ + protected static $regexFormatModifiers = [ + '*' => '.+', + ' ' => '[ ]', + '#' => '[;:\\/.,()-]', + '?' => '([^a]|[a])', + '!' => '', + '|' => '', + '+' => '', + ]; + + /** + * Indicates if months should be calculated with overflow. + * Global setting. + * + * @var bool + */ + protected static $monthsOverflow = true; + + /** + * Indicates if years should be calculated with overflow. + * Global setting. + * + * @var bool + */ + protected static $yearsOverflow = true; + + /** + * Indicates if the strict mode is in use. + * Global setting. + * + * @var bool + */ + protected static $strictModeEnabled = true; + + /** + * Function to call instead of format. + * + * @var string|callable|null + */ + protected static $formatFunction; + + /** + * Function to call instead of createFromFormat. + * + * @var string|callable|null + */ + protected static $createFromFormatFunction; + + /** + * Function to call instead of parse. + * + * @var string|callable|null + */ + protected static $parseFunction; + + /** + * Indicates if months should be calculated with overflow. + * Specific setting. + * + * @var bool|null + */ + protected $localMonthsOverflow; + + /** + * Indicates if years should be calculated with overflow. + * Specific setting. + * + * @var bool|null + */ + protected $localYearsOverflow; + + /** + * Indicates if the strict mode is in use. + * Specific setting. + * + * @var bool|null + */ + protected $localStrictModeEnabled; + + /** + * Options for diffForHumans and forHumans methods. + * + * @var bool|null + */ + protected $localHumanDiffOptions; + + /** + * Format to use on string cast. + * + * @var string|null + */ + protected $localToStringFormat; + + /** + * Format to use on JSON serialization. + * + * @var string|null + */ + protected $localSerializer; + + /** + * Instance-specific macros. + * + * @var array|null + */ + protected $localMacros; + + /** + * Instance-specific generic macros. + * + * @var array|null + */ + protected $localGenericMacros; + + /** + * Function to call instead of format. + * + * @var string|callable|null + */ + protected $localFormatFunction; + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * @see settings + * + * Enable the strict mode (or disable with passing false). + * + * @param bool $strictModeEnabled + */ + public static function useStrictMode($strictModeEnabled = true) + { + static::$strictModeEnabled = $strictModeEnabled; + } + + /** + * Returns true if the strict mode is globally in use, false else. + * (It can be overridden in specific instances.) + * + * @return bool + */ + public static function isStrictModeEnabled() + { + return static::$strictModeEnabled; + } + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * Or you can use method variants: addMonthsWithOverflow/addMonthsNoOverflow, same variants + * are available for quarters, years, decade, centuries, millennia (singular and plural forms). + * @see settings + * + * Indicates if months should be calculated with overflow. + * + * @param bool $monthsOverflow + * + * @return void + */ + public static function useMonthsOverflow($monthsOverflow = true) + { + static::$monthsOverflow = $monthsOverflow; + } + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * Or you can use method variants: addMonthsWithOverflow/addMonthsNoOverflow, same variants + * are available for quarters, years, decade, centuries, millennia (singular and plural forms). + * @see settings + * + * Reset the month overflow behavior. + * + * @return void + */ + public static function resetMonthsOverflow() + { + static::$monthsOverflow = true; + } + + /** + * Get the month overflow global behavior (can be overridden in specific instances). + * + * @return bool + */ + public static function shouldOverflowMonths() + { + return static::$monthsOverflow; + } + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * Or you can use method variants: addYearsWithOverflow/addYearsNoOverflow, same variants + * are available for quarters, years, decade, centuries, millennia (singular and plural forms). + * @see settings + * + * Indicates if years should be calculated with overflow. + * + * @param bool $yearsOverflow + * + * @return void + */ + public static function useYearsOverflow($yearsOverflow = true) + { + static::$yearsOverflow = $yearsOverflow; + } + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather use the ->settings() method. + * Or you can use method variants: addYearsWithOverflow/addYearsNoOverflow, same variants + * are available for quarters, years, decade, centuries, millennia (singular and plural forms). + * @see settings + * + * Reset the month overflow behavior. + * + * @return void + */ + public static function resetYearsOverflow() + { + static::$yearsOverflow = true; + } + + /** + * Get the month overflow global behavior (can be overridden in specific instances). + * + * @return bool + */ + public static function shouldOverflowYears() + { + return static::$yearsOverflow; + } + + /** + * Set specific options. + * - strictMode: true|false|null + * - monthOverflow: true|false|null + * - yearOverflow: true|false|null + * - humanDiffOptions: int|null + * - toStringFormat: string|Closure|null + * - toJsonFormat: string|Closure|null + * - locale: string|null + * - timezone: \DateTimeZone|string|int|null + * - macros: array|null + * - genericMacros: array|null + * + * @param array $settings + * + * @return $this|static + */ + public function settings(array $settings) + { + $this->localStrictModeEnabled = $settings['strictMode'] ?? null; + $this->localMonthsOverflow = $settings['monthOverflow'] ?? null; + $this->localYearsOverflow = $settings['yearOverflow'] ?? null; + $this->localHumanDiffOptions = $settings['humanDiffOptions'] ?? null; + $this->localToStringFormat = $settings['toStringFormat'] ?? null; + $this->localSerializer = $settings['toJsonFormat'] ?? null; + $this->localMacros = $settings['macros'] ?? null; + $this->localGenericMacros = $settings['genericMacros'] ?? null; + $this->localFormatFunction = $settings['formatFunction'] ?? null; + + if (isset($settings['locale'])) { + $locales = $settings['locale']; + + if (!\is_array($locales)) { + $locales = [$locales]; + } + + $this->locale(...$locales); + } + + if (isset($settings['innerTimezone'])) { + return $this->setTimezone($settings['innerTimezone']); + } + + if (isset($settings['timezone'])) { + return $this->shiftTimezone($settings['timezone']); + } + + return $this; + } + + /** + * Returns current local settings. + * + * @return array + */ + public function getSettings() + { + $settings = []; + $map = [ + 'localStrictModeEnabled' => 'strictMode', + 'localMonthsOverflow' => 'monthOverflow', + 'localYearsOverflow' => 'yearOverflow', + 'localHumanDiffOptions' => 'humanDiffOptions', + 'localToStringFormat' => 'toStringFormat', + 'localSerializer' => 'toJsonFormat', + 'localMacros' => 'macros', + 'localGenericMacros' => 'genericMacros', + 'locale' => 'locale', + 'tzName' => 'timezone', + 'localFormatFunction' => 'formatFunction', + ]; + + foreach ($map as $property => $key) { + $value = $this->$property ?? null; + + if ($value !== null && ($key !== 'locale' || $value !== 'en' || $this->localTranslator)) { + $settings[$key] = $value; + } + } + + return $settings; + } + + /** + * Show truthy properties on var_dump(). + * + * @return array + */ + public function __debugInfo() + { + $infos = array_filter(get_object_vars($this), static function ($var) { + return $var; + }); + + foreach (['dumpProperties', 'constructedObjectId', 'constructed'] as $property) { + if (isset($infos[$property])) { + unset($infos[$property]); + } + } + + $this->addExtraDebugInfos($infos); + + return $infos; + } + + protected function addExtraDebugInfos(&$infos): void + { + if ($this instanceof DateTimeInterface) { + try { + if (!isset($infos['date'])) { + $infos['date'] = $this->format(CarbonInterface::MOCK_DATETIME_FORMAT); + } + + if (!isset($infos['timezone'])) { + $infos['timezone'] = $this->tzName; + } + } catch (Throwable $exception) { + // noop + } + } + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Rounding.php b/vendor/nesbot/carbon/src/Carbon/Traits/Rounding.php new file mode 100644 index 00000000..85ff5a71 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Rounding.php @@ -0,0 +1,254 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +use Carbon\CarbonInterface; +use Carbon\Exceptions\UnknownUnitException; + +/** + * Trait Rounding. + * + * Round, ceil, floor units. + * + * Depends on the following methods: + * + * @method static copy() + * @method static startOfWeek(int $weekStartsAt = null) + */ +trait Rounding +{ + use IntervalRounding; + + /** + * Round the current instance at the given unit with given precision if specified and the given function. + * + * @param string $unit + * @param float|int $precision + * @param string $function + * + * @return CarbonInterface + */ + public function roundUnit($unit, $precision = 1, $function = 'round') + { + $metaUnits = [ + // @call roundUnit + 'millennium' => [static::YEARS_PER_MILLENNIUM, 'year'], + // @call roundUnit + 'century' => [static::YEARS_PER_CENTURY, 'year'], + // @call roundUnit + 'decade' => [static::YEARS_PER_DECADE, 'year'], + // @call roundUnit + 'quarter' => [static::MONTHS_PER_QUARTER, 'month'], + // @call roundUnit + 'millisecond' => [1000, 'microsecond'], + ]; + $normalizedUnit = static::singularUnit($unit); + $ranges = array_merge(static::getRangesByUnit($this->daysInMonth), [ + // @call roundUnit + 'microsecond' => [0, 999999], + ]); + $factor = 1; + + if ($normalizedUnit === 'week') { + $normalizedUnit = 'day'; + $precision *= static::DAYS_PER_WEEK; + } + + if (isset($metaUnits[$normalizedUnit])) { + [$factor, $normalizedUnit] = $metaUnits[$normalizedUnit]; + } + + $precision *= $factor; + + if (!isset($ranges[$normalizedUnit])) { + throw new UnknownUnitException($unit); + } + + $found = false; + $fraction = 0; + $arguments = null; + $initialValue = null; + $factor = $this->year < 0 ? -1 : 1; + $changes = []; + $minimumInc = null; + + foreach ($ranges as $unit => [$minimum, $maximum]) { + if ($normalizedUnit === $unit) { + $arguments = [$this->$unit, $minimum]; + $initialValue = $this->$unit; + $fraction = $precision - floor($precision); + $found = true; + + continue; + } + + if ($found) { + $delta = $maximum + 1 - $minimum; + $factor /= $delta; + $fraction *= $delta; + $inc = ($this->$unit - $minimum) * $factor; + + if ($inc !== 0.0) { + $minimumInc = $minimumInc ?? ($arguments[0] / pow(2, 52)); + + // If value is still the same when adding a non-zero increment/decrement, + // it means precision got lost in the addition + if (abs($inc) < $minimumInc) { + $inc = $minimumInc * ($inc < 0 ? -1 : 1); + } + + // If greater than $precision, assume precision loss caused an overflow + if ($function !== 'floor' || abs($arguments[0] + $inc - $initialValue) >= $precision) { + $arguments[0] += $inc; + } + } + + $changes[$unit] = round( + $minimum + ($fraction ? $fraction * $function(($this->$unit - $minimum) / $fraction) : 0) + ); + + // Cannot use modulo as it lose double precision + while ($changes[$unit] >= $delta) { + $changes[$unit] -= $delta; + } + + $fraction -= floor($fraction); + } + } + + [$value, $minimum] = $arguments; + $normalizedValue = floor($function(($value - $minimum) / $precision) * $precision + $minimum); + + /** @var CarbonInterface $result */ + $result = $this; + + foreach ($changes as $unit => $value) { + $result = $result->$unit($value); + } + + return $result->$normalizedUnit($normalizedValue); + } + + /** + * Truncate the current instance at the given unit with given precision if specified. + * + * @param string $unit + * @param float|int $precision + * + * @return CarbonInterface + */ + public function floorUnit($unit, $precision = 1) + { + return $this->roundUnit($unit, $precision, 'floor'); + } + + /** + * Ceil the current instance at the given unit with given precision if specified. + * + * @param string $unit + * @param float|int $precision + * + * @return CarbonInterface + */ + public function ceilUnit($unit, $precision = 1) + { + return $this->roundUnit($unit, $precision, 'ceil'); + } + + /** + * Round the current instance second with given precision if specified. + * + * @param float|int|string|\DateInterval|null $precision + * @param string $function + * + * @return CarbonInterface + */ + public function round($precision = 1, $function = 'round') + { + return $this->roundWith($precision, $function); + } + + /** + * Round the current instance second with given precision if specified. + * + * @param float|int|string|\DateInterval|null $precision + * + * @return CarbonInterface + */ + public function floor($precision = 1) + { + return $this->round($precision, 'floor'); + } + + /** + * Ceil the current instance second with given precision if specified. + * + * @param float|int|string|\DateInterval|null $precision + * + * @return CarbonInterface + */ + public function ceil($precision = 1) + { + return $this->round($precision, 'ceil'); + } + + /** + * Round the current instance week. + * + * @param int $weekStartsAt optional start allow you to specify the day of week to use to start the week + * + * @return CarbonInterface + */ + public function roundWeek($weekStartsAt = null) + { + return $this->closest( + $this->avoidMutation()->floorWeek($weekStartsAt), + $this->avoidMutation()->ceilWeek($weekStartsAt) + ); + } + + /** + * Truncate the current instance week. + * + * @param int $weekStartsAt optional start allow you to specify the day of week to use to start the week + * + * @return CarbonInterface + */ + public function floorWeek($weekStartsAt = null) + { + return $this->startOfWeek($weekStartsAt); + } + + /** + * Ceil the current instance week. + * + * @param int $weekStartsAt optional start allow you to specify the day of week to use to start the week + * + * @return CarbonInterface + */ + public function ceilWeek($weekStartsAt = null) + { + if ($this->isMutable()) { + $startOfWeek = $this->avoidMutation()->startOfWeek($weekStartsAt); + + return $startOfWeek != $this ? + $this->startOfWeek($weekStartsAt)->addWeek() : + $this; + } + + $startOfWeek = $this->startOfWeek($weekStartsAt); + + return $startOfWeek != $this ? + $startOfWeek->addWeek() : + $this->avoidMutation(); + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Serialization.php b/vendor/nesbot/carbon/src/Carbon/Traits/Serialization.php new file mode 100644 index 00000000..c1d5c5e1 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Serialization.php @@ -0,0 +1,326 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +use Carbon\Exceptions\InvalidFormatException; +use ReturnTypeWillChange; +use Throwable; + +/** + * Trait Serialization. + * + * Serialization and JSON stuff. + * + * Depends on the following properties: + * + * @property int $year + * @property int $month + * @property int $daysInMonth + * @property int $quarter + * + * Depends on the following methods: + * + * @method string|static locale(string $locale = null, string ...$fallbackLocales) + * @method string toJSON() + */ +trait Serialization +{ + use ObjectInitialisation; + + /** + * The custom Carbon JSON serializer. + * + * @var callable|null + */ + protected static $serializer; + + /** + * List of key to use for dump/serialization. + * + * @var string[] + */ + protected $dumpProperties = ['date', 'timezone_type', 'timezone']; + + /** + * Locale to dump comes here before serialization. + * + * @var string|null + */ + protected $dumpLocale; + + /** + * Embed date properties to dump in a dedicated variables so it won't overlap native + * DateTime ones. + * + * @var array|null + */ + protected $dumpDateProperties; + + /** + * Return a serialized string of the instance. + * + * @return string + */ + public function serialize() + { + return serialize($this); + } + + /** + * Create an instance from a serialized string. + * + * @param string $value + * + * @throws InvalidFormatException + * + * @return static + */ + public static function fromSerialized($value) + { + $instance = @unserialize((string) $value); + + if (!$instance instanceof static) { + throw new InvalidFormatException("Invalid serialized value: $value"); + } + + return $instance; + } + + /** + * The __set_state handler. + * + * @param string|array $dump + * + * @return static + */ + #[ReturnTypeWillChange] + public static function __set_state($dump) + { + if (\is_string($dump)) { + return static::parse($dump); + } + + /** @var \DateTimeInterface $date */ + $date = get_parent_class(static::class) && method_exists(parent::class, '__set_state') + ? parent::__set_state((array) $dump) + : (object) $dump; + + return static::instance($date); + } + + /** + * Returns the list of properties to dump on serialize() called on. + * + * Only used by PHP < 7.4. + * + * @return array + */ + public function __sleep() + { + $properties = $this->getSleepProperties(); + + if ($this->localTranslator ?? null) { + $properties[] = 'dumpLocale'; + $this->dumpLocale = $this->locale ?? null; + } + + return $properties; + } + + /** + * Returns the values to dump on serialize() called on. + * + * Only used by PHP >= 7.4. + * + * @return array + */ + public function __serialize(): array + { + // @codeCoverageIgnoreStart + if (isset($this->timezone_type, $this->timezone, $this->date)) { + return [ + 'date' => $this->date ?? null, + 'timezone_type' => $this->timezone_type, + 'timezone' => $this->timezone ?? null, + ]; + } + // @codeCoverageIgnoreEnd + + $timezone = $this->getTimezone(); + $export = [ + 'date' => $this->format('Y-m-d H:i:s.u'), + 'timezone_type' => $timezone->getType(), + 'timezone' => $timezone->getName(), + ]; + + // @codeCoverageIgnoreStart + if (\extension_loaded('msgpack') && isset($this->constructedObjectId)) { + $export['dumpDateProperties'] = [ + 'date' => $this->format('Y-m-d H:i:s.u'), + 'timezone' => serialize($this->timezone ?? null), + ]; + } + // @codeCoverageIgnoreEnd + + if ($this->localTranslator ?? null) { + $export['dumpLocale'] = $this->locale ?? null; + } + + return $export; + } + + /** + * Set locale if specified on unserialize() called. + * + * Only used by PHP < 7.4. + * + * @return void + */ + #[ReturnTypeWillChange] + public function __wakeup() + { + if (parent::class && method_exists(parent::class, '__wakeup')) { + // @codeCoverageIgnoreStart + try { + parent::__wakeup(); + } catch (Throwable $exception) { + try { + // FatalError occurs when calling msgpack_unpack() in PHP 7.4 or later. + ['date' => $date, 'timezone' => $timezone] = $this->dumpDateProperties; + parent::__construct($date, unserialize($timezone)); + } catch (Throwable $ignoredException) { + throw $exception; + } + } + // @codeCoverageIgnoreEnd + } + + $this->constructedObjectId = spl_object_hash($this); + + if (isset($this->dumpLocale)) { + $this->locale($this->dumpLocale); + $this->dumpLocale = null; + } + + $this->cleanupDumpProperties(); + } + + /** + * Set locale if specified on unserialize() called. + * + * Only used by PHP >= 7.4. + * + * @return void + */ + public function __unserialize(array $data): void + { + // @codeCoverageIgnoreStart + try { + $this->__construct($data['date'] ?? null, $data['timezone'] ?? null); + } catch (Throwable $exception) { + if (!isset($data['dumpDateProperties']['date'], $data['dumpDateProperties']['timezone'])) { + throw $exception; + } + + try { + // FatalError occurs when calling msgpack_unpack() in PHP 7.4 or later. + ['date' => $date, 'timezone' => $timezone] = $data['dumpDateProperties']; + $this->__construct($date, unserialize($timezone)); + } catch (Throwable $ignoredException) { + throw $exception; + } + } + // @codeCoverageIgnoreEnd + + if (isset($data['dumpLocale'])) { + $this->locale($data['dumpLocale']); + } + } + + /** + * Prepare the object for JSON serialization. + * + * @return array|string + */ + #[ReturnTypeWillChange] + public function jsonSerialize() + { + $serializer = $this->localSerializer ?? static::$serializer; + + if ($serializer) { + return \is_string($serializer) + ? $this->rawFormat($serializer) + : $serializer($this); + } + + return $this->toJSON(); + } + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather transform Carbon object before the serialization. + * + * JSON serialize all Carbon instances using the given callback. + * + * @param callable $callback + * + * @return void + */ + public static function serializeUsing($callback) + { + static::$serializer = $callback; + } + + /** + * Cleanup properties attached to the public scope of DateTime when a dump of the date is requested. + * foreach ($date as $_) {} + * serializer($date) + * var_export($date) + * get_object_vars($date) + */ + public function cleanupDumpProperties() + { + // @codeCoverageIgnoreStart + if (PHP_VERSION < 8.2) { + foreach ($this->dumpProperties as $property) { + if (isset($this->$property)) { + unset($this->$property); + } + } + } + // @codeCoverageIgnoreEnd + + return $this; + } + + private function getSleepProperties(): array + { + $properties = $this->dumpProperties; + + // @codeCoverageIgnoreStart + if (!\extension_loaded('msgpack')) { + return $properties; + } + + if (isset($this->constructedObjectId)) { + $this->dumpDateProperties = [ + 'date' => $this->format('Y-m-d H:i:s.u'), + 'timezone' => serialize($this->timezone ?? null), + ]; + + $properties[] = 'dumpDateProperties'; + } + + return $properties; + // @codeCoverageIgnoreEnd + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Test.php b/vendor/nesbot/carbon/src/Carbon/Traits/Test.php new file mode 100644 index 00000000..f23c72e8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Test.php @@ -0,0 +1,228 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +use Carbon\CarbonInterface; +use Carbon\CarbonTimeZone; +use Closure; +use DateTimeImmutable; +use DateTimeInterface; +use InvalidArgumentException; +use Throwable; + +trait Test +{ + /////////////////////////////////////////////////////////////////// + ///////////////////////// TESTING AIDS //////////////////////////// + /////////////////////////////////////////////////////////////////// + + /** + * A test Carbon instance to be returned when now instances are created. + * + * @var Closure|static|null + */ + protected static $testNow; + + /** + * The timezone to resto to when clearing the time mock. + * + * @var string|null + */ + protected static $testDefaultTimezone; + + /** + * Set a Carbon instance (real or mock) to be returned when a "now" + * instance is created. The provided instance will be returned + * specifically under the following conditions: + * - A call to the static now() method, ex. Carbon::now() + * - When a null (or blank string) is passed to the constructor or parse(), ex. new Carbon(null) + * - When the string "now" is passed to the constructor or parse(), ex. new Carbon('now') + * - When a string containing the desired time is passed to Carbon::parse(). + * + * Note the timezone parameter was left out of the examples above and + * has no affect as the mock value will be returned regardless of its value. + * + * Only the moment is mocked with setTestNow(), the timezone will still be the one passed + * as parameter of date_default_timezone_get() as a fallback (see setTestNowAndTimezone()). + * + * To clear the test instance call this method using the default + * parameter of null. + * + * /!\ Use this method for unit tests only. + * + * @param DateTimeInterface|Closure|static|string|false|null $testNow real or mock Carbon instance + */ + public static function setTestNow($testNow = null) + { + static::$testNow = $testNow instanceof self || $testNow instanceof Closure + ? $testNow + : static::make($testNow); + } + + /** + * Set a Carbon instance (real or mock) to be returned when a "now" + * instance is created. The provided instance will be returned + * specifically under the following conditions: + * - A call to the static now() method, ex. Carbon::now() + * - When a null (or blank string) is passed to the constructor or parse(), ex. new Carbon(null) + * - When the string "now" is passed to the constructor or parse(), ex. new Carbon('now') + * - When a string containing the desired time is passed to Carbon::parse(). + * + * It will also align default timezone (e.g. call date_default_timezone_set()) with + * the second argument or if null, with the timezone of the given date object. + * + * To clear the test instance call this method using the default + * parameter of null. + * + * /!\ Use this method for unit tests only. + * + * @param DateTimeInterface|Closure|static|string|false|null $testNow real or mock Carbon instance + */ + public static function setTestNowAndTimezone($testNow = null, $tz = null) + { + if ($testNow) { + self::$testDefaultTimezone = self::$testDefaultTimezone ?? date_default_timezone_get(); + } + + $useDateInstanceTimezone = $testNow instanceof DateTimeInterface; + + if ($useDateInstanceTimezone) { + self::setDefaultTimezone($testNow->getTimezone()->getName(), $testNow); + } + + static::setTestNow($testNow); + + if (!$useDateInstanceTimezone) { + $now = static::getMockedTestNow(\func_num_args() === 1 ? null : $tz); + $tzName = $now ? $now->tzName : null; + self::setDefaultTimezone($tzName ?? self::$testDefaultTimezone ?? 'UTC', $now); + } + + if (!$testNow) { + self::$testDefaultTimezone = null; + } + } + + /** + * Temporarily sets a static date to be used within the callback. + * Using setTestNow to set the date, executing the callback, then + * clearing the test instance. + * + * /!\ Use this method for unit tests only. + * + * @template T + * + * @param DateTimeInterface|Closure|static|string|false|null $testNow real or mock Carbon instance + * @param Closure(): T $callback + * + * @return T + */ + public static function withTestNow($testNow, $callback) + { + static::setTestNow($testNow); + + try { + $result = $callback(); + } finally { + static::setTestNow(); + } + + return $result; + } + + /** + * Get the Carbon instance (real or mock) to be returned when a "now" + * instance is created. + * + * @return Closure|static the current instance used for testing + */ + public static function getTestNow() + { + return static::$testNow; + } + + /** + * Determine if there is a valid test instance set. A valid test instance + * is anything that is not null. + * + * @return bool true if there is a test instance, otherwise false + */ + public static function hasTestNow() + { + return static::getTestNow() !== null; + } + + /** + * Get the mocked date passed in setTestNow() and if it's a Closure, execute it. + * + * @param string|\DateTimeZone $tz + * + * @return \Carbon\CarbonImmutable|\Carbon\Carbon|null + */ + protected static function getMockedTestNow($tz) + { + $testNow = static::getTestNow(); + + if ($testNow instanceof Closure) { + $realNow = new DateTimeImmutable('now'); + $testNow = $testNow(static::parse( + $realNow->format('Y-m-d H:i:s.u'), + $tz ?: $realNow->getTimezone() + )); + } + /* @var \Carbon\CarbonImmutable|\Carbon\Carbon|null $testNow */ + + return $testNow instanceof CarbonInterface + ? $testNow->avoidMutation()->tz($tz) + : $testNow; + } + + protected static function mockConstructorParameters(&$time, $tz) + { + /** @var \Carbon\CarbonImmutable|\Carbon\Carbon $testInstance */ + $testInstance = clone static::getMockedTestNow($tz); + + if (static::hasRelativeKeywords($time)) { + $testInstance = $testInstance->modify($time); + } + + $time = $testInstance instanceof self + ? $testInstance->rawFormat(static::MOCK_DATETIME_FORMAT) + : $testInstance->format(static::MOCK_DATETIME_FORMAT); + } + + private static function setDefaultTimezone($timezone, DateTimeInterface $date = null) + { + $previous = null; + $success = false; + + try { + $success = date_default_timezone_set($timezone); + } catch (Throwable $exception) { + $previous = $exception; + } + + if (!$success) { + $suggestion = @CarbonTimeZone::create($timezone)->toRegionName($date); + + throw new InvalidArgumentException( + "Timezone ID '$timezone' is invalid". + ($suggestion && $suggestion !== $timezone ? ", did you mean '$suggestion'?" : '.')."\n". + "It must be one of the IDs from DateTimeZone::listIdentifiers(),\n". + 'For the record, hours/minutes offset are relevant only for a particular moment, '. + 'but not as a default timezone.', + 0, + $previous + ); + } + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Timestamp.php b/vendor/nesbot/carbon/src/Carbon/Traits/Timestamp.php new file mode 100644 index 00000000..88a465c9 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Timestamp.php @@ -0,0 +1,198 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +/** + * Trait Timestamp. + */ +trait Timestamp +{ + /** + * Create a Carbon instance from a timestamp and set the timezone (use default one if not specified). + * + * Timestamp input can be given as int, float or a string containing one or more numbers. + * + * @param float|int|string $timestamp + * @param \DateTimeZone|string|null $tz + * + * @return static + */ + public static function createFromTimestamp($timestamp, $tz = null) + { + return static::createFromTimestampUTC($timestamp)->setTimezone($tz); + } + + /** + * Create a Carbon instance from an timestamp keeping the timezone to UTC. + * + * Timestamp input can be given as int, float or a string containing one or more numbers. + * + * @param float|int|string $timestamp + * + * @return static + */ + public static function createFromTimestampUTC($timestamp) + { + [$integer, $decimal] = self::getIntegerAndDecimalParts($timestamp); + $delta = floor($decimal / static::MICROSECONDS_PER_SECOND); + $integer += $delta; + $decimal -= $delta * static::MICROSECONDS_PER_SECOND; + $decimal = str_pad((string) $decimal, 6, '0', STR_PAD_LEFT); + + return static::rawCreateFromFormat('U u', "$integer $decimal"); + } + + /** + * Create a Carbon instance from a timestamp in milliseconds. + * + * Timestamp input can be given as int, float or a string containing one or more numbers. + * + * @param float|int|string $timestamp + * + * @return static + */ + public static function createFromTimestampMsUTC($timestamp) + { + [$milliseconds, $microseconds] = self::getIntegerAndDecimalParts($timestamp, 3); + $sign = $milliseconds < 0 || ($milliseconds === 0.0 && $microseconds < 0) ? -1 : 1; + $milliseconds = abs($milliseconds); + $microseconds = $sign * abs($microseconds) + static::MICROSECONDS_PER_MILLISECOND * ($milliseconds % static::MILLISECONDS_PER_SECOND); + $seconds = $sign * floor($milliseconds / static::MILLISECONDS_PER_SECOND); + $delta = floor($microseconds / static::MICROSECONDS_PER_SECOND); + $seconds += $delta; + $microseconds -= $delta * static::MICROSECONDS_PER_SECOND; + $microseconds = str_pad($microseconds, 6, '0', STR_PAD_LEFT); + + return static::rawCreateFromFormat('U u', "$seconds $microseconds"); + } + + /** + * Create a Carbon instance from a timestamp in milliseconds. + * + * Timestamp input can be given as int, float or a string containing one or more numbers. + * + * @param float|int|string $timestamp + * @param \DateTimeZone|string|null $tz + * + * @return static + */ + public static function createFromTimestampMs($timestamp, $tz = null) + { + return static::createFromTimestampMsUTC($timestamp) + ->setTimezone($tz); + } + + /** + * Set the instance's timestamp. + * + * Timestamp input can be given as int, float or a string containing one or more numbers. + * + * @param float|int|string $unixTimestamp + * + * @return static + */ + public function timestamp($unixTimestamp) + { + return $this->setTimestamp($unixTimestamp); + } + + /** + * Returns a timestamp rounded with the given precision (6 by default). + * + * @example getPreciseTimestamp() 1532087464437474 (microsecond maximum precision) + * @example getPreciseTimestamp(6) 1532087464437474 + * @example getPreciseTimestamp(5) 153208746443747 (1/100000 second precision) + * @example getPreciseTimestamp(4) 15320874644375 (1/10000 second precision) + * @example getPreciseTimestamp(3) 1532087464437 (millisecond precision) + * @example getPreciseTimestamp(2) 153208746444 (1/100 second precision) + * @example getPreciseTimestamp(1) 15320874644 (1/10 second precision) + * @example getPreciseTimestamp(0) 1532087464 (second precision) + * @example getPreciseTimestamp(-1) 153208746 (10 second precision) + * @example getPreciseTimestamp(-2) 15320875 (100 second precision) + * + * @param int $precision + * + * @return float + */ + public function getPreciseTimestamp($precision = 6) + { + return round(((float) $this->rawFormat('Uu')) / pow(10, 6 - $precision)); + } + + /** + * Returns the milliseconds timestamps used amongst other by Date javascript objects. + * + * @return float + */ + public function valueOf() + { + return $this->getPreciseTimestamp(3); + } + + /** + * Returns the timestamp with millisecond precision. + * + * @return int + */ + public function getTimestampMs() + { + return (int) $this->getPreciseTimestamp(3); + } + + /** + * @alias getTimestamp + * + * Returns the UNIX timestamp for the current date. + * + * @return int + */ + public function unix() + { + return $this->getTimestamp(); + } + + /** + * Return an array with integer part digits and decimals digits split from one or more positive numbers + * (such as timestamps) as string with the given number of decimals (6 by default). + * + * By splitting integer and decimal, this method obtain a better precision than + * number_format when the input is a string. + * + * @param float|int|string $numbers one or more numbers + * @param int $decimals number of decimals precision (6 by default) + * + * @return array 0-index is integer part, 1-index is decimal part digits + */ + private static function getIntegerAndDecimalParts($numbers, $decimals = 6) + { + if (\is_int($numbers) || \is_float($numbers)) { + $numbers = number_format($numbers, $decimals, '.', ''); + } + + $sign = str_starts_with($numbers, '-') ? -1 : 1; + $integer = 0; + $decimal = 0; + + foreach (preg_split('`[^\d.]+`', $numbers) as $chunk) { + [$integerPart, $decimalPart] = explode('.', "$chunk."); + + $integer += (int) $integerPart; + $decimal += (float) ("0.$decimalPart"); + } + + $overflow = floor($decimal); + $integer += $overflow; + $decimal -= $overflow; + + return [$sign * $integer, $decimal === 0.0 ? 0.0 : $sign * round($decimal * pow(10, $decimals))]; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/ToStringFormat.php b/vendor/nesbot/carbon/src/Carbon/Traits/ToStringFormat.php new file mode 100644 index 00000000..a81164f9 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/ToStringFormat.php @@ -0,0 +1,56 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +use Closure; + +/** + * Trait ToStringFormat. + * + * Handle global format customization for string cast of the object. + */ +trait ToStringFormat +{ + /** + * Format to use for __toString method when type juggling occurs. + * + * @var string|Closure|null + */ + protected static $toStringFormat; + + /** + * Reset the format used to the default when type juggling a Carbon instance to a string + * + * @return void + */ + public static function resetToStringFormat() + { + static::setToStringFormat(null); + } + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather let Carbon object being cast to string with DEFAULT_TO_STRING_FORMAT, and + * use other method or custom format passed to format() method if you need to dump another string + * format. + * + * Set the default format used when type juggling a Carbon instance to a string. + * + * @param string|Closure|null $format + * + * @return void + */ + public static function setToStringFormat($format) + { + static::$toStringFormat = $format; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Units.php b/vendor/nesbot/carbon/src/Carbon/Traits/Units.php new file mode 100644 index 00000000..5be14ec7 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Units.php @@ -0,0 +1,412 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +use Carbon\CarbonConverterInterface; +use Carbon\CarbonInterface; +use Carbon\CarbonInterval; +use Carbon\Exceptions\UnitException; +use Closure; +use DateInterval; +use DateMalformedStringException; +use ReturnTypeWillChange; + +/** + * Trait Units. + * + * Add, subtract and set units. + */ +trait Units +{ + /** + * Add seconds to the instance using timestamp. Positive $value travels + * forward while negative $value travels into the past. + * + * @param string $unit + * @param int $value + * + * @return static + */ + public function addRealUnit($unit, $value = 1) + { + switch ($unit) { + // @call addRealUnit + case 'micro': + + // @call addRealUnit + case 'microsecond': + /* @var CarbonInterface $this */ + $diff = $this->microsecond + $value; + $time = $this->getTimestamp(); + $seconds = (int) floor($diff / static::MICROSECONDS_PER_SECOND); + $time += $seconds; + $diff -= $seconds * static::MICROSECONDS_PER_SECOND; + $microtime = str_pad((string) $diff, 6, '0', STR_PAD_LEFT); + $tz = $this->tz; + + return $this->tz('UTC')->modify("@$time.$microtime")->tz($tz); + + // @call addRealUnit + case 'milli': + // @call addRealUnit + case 'millisecond': + return $this->addRealUnit('microsecond', $value * static::MICROSECONDS_PER_MILLISECOND); + + // @call addRealUnit + case 'second': + break; + + // @call addRealUnit + case 'minute': + $value *= static::SECONDS_PER_MINUTE; + + break; + + // @call addRealUnit + case 'hour': + $value *= static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE; + + break; + + // @call addRealUnit + case 'day': + $value *= static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE; + + break; + + // @call addRealUnit + case 'week': + $value *= static::DAYS_PER_WEEK * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE; + + break; + + // @call addRealUnit + case 'month': + $value *= 30 * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE; + + break; + + // @call addRealUnit + case 'quarter': + $value *= static::MONTHS_PER_QUARTER * 30 * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE; + + break; + + // @call addRealUnit + case 'year': + $value *= 365 * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE; + + break; + + // @call addRealUnit + case 'decade': + $value *= static::YEARS_PER_DECADE * 365 * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE; + + break; + + // @call addRealUnit + case 'century': + $value *= static::YEARS_PER_CENTURY * 365 * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE; + + break; + + // @call addRealUnit + case 'millennium': + $value *= static::YEARS_PER_MILLENNIUM * 365 * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE; + + break; + + default: + if ($this->localStrictModeEnabled ?? static::isStrictModeEnabled()) { + throw new UnitException("Invalid unit for real timestamp add/sub: '$unit'"); + } + + return $this; + } + + /* @var CarbonInterface $this */ + return $this->setTimestamp((int) ($this->getTimestamp() + $value)); + } + + public function subRealUnit($unit, $value = 1) + { + return $this->addRealUnit($unit, -$value); + } + + /** + * Returns true if a property can be changed via setter. + * + * @param string $unit + * + * @return bool + */ + public static function isModifiableUnit($unit) + { + static $modifiableUnits = [ + // @call addUnit + 'millennium', + // @call addUnit + 'century', + // @call addUnit + 'decade', + // @call addUnit + 'quarter', + // @call addUnit + 'week', + // @call addUnit + 'weekday', + ]; + + return \in_array($unit, $modifiableUnits, true) || \in_array($unit, static::$units, true); + } + + /** + * Call native PHP DateTime/DateTimeImmutable add() method. + * + * @param DateInterval $interval + * + * @return static + */ + public function rawAdd(DateInterval $interval) + { + return parent::add($interval); + } + + /** + * Add given units or interval to the current instance. + * + * @example $date->add('hour', 3) + * @example $date->add(15, 'days') + * @example $date->add(CarbonInterval::days(4)) + * + * @param string|DateInterval|Closure|CarbonConverterInterface $unit + * @param int $value + * @param bool|null $overflow + * + * @return static + */ + #[ReturnTypeWillChange] + public function add($unit, $value = 1, $overflow = null) + { + if (\is_string($unit) && \func_num_args() === 1) { + $unit = CarbonInterval::make($unit, [], true); + } + + if ($unit instanceof CarbonConverterInterface) { + return $this->resolveCarbon($unit->convertDate($this, false)); + } + + if ($unit instanceof Closure) { + return $this->resolveCarbon($unit($this, false)); + } + + if ($unit instanceof DateInterval) { + return parent::add($unit); + } + + if (is_numeric($unit)) { + [$value, $unit] = [$unit, $value]; + } + + return $this->addUnit($unit, $value, $overflow); + } + + /** + * Add given units to the current instance. + * + * @param string $unit + * @param int $value + * @param bool|null $overflow + * + * @return static + */ + public function addUnit($unit, $value = 1, $overflow = null) + { + $originalArgs = \func_get_args(); + + $date = $this; + + if (!is_numeric($value) || !(float) $value) { + return $date->isMutable() ? $date : $date->avoidMutation(); + } + + $unit = self::singularUnit($unit); + $metaUnits = [ + 'millennium' => [static::YEARS_PER_MILLENNIUM, 'year'], + 'century' => [static::YEARS_PER_CENTURY, 'year'], + 'decade' => [static::YEARS_PER_DECADE, 'year'], + 'quarter' => [static::MONTHS_PER_QUARTER, 'month'], + ]; + + if (isset($metaUnits[$unit])) { + [$factor, $unit] = $metaUnits[$unit]; + $value *= $factor; + } + + if ($unit === 'weekday') { + $weekendDays = static::getWeekendDays(); + + if ($weekendDays !== [static::SATURDAY, static::SUNDAY]) { + $absoluteValue = abs($value); + $sign = $value / max(1, $absoluteValue); + $weekDaysCount = 7 - min(6, \count(array_unique($weekendDays))); + $weeks = floor($absoluteValue / $weekDaysCount); + + for ($diff = $absoluteValue % $weekDaysCount; $diff; $diff--) { + /** @var static $date */ + $date = $date->addDays($sign); + + while (\in_array($date->dayOfWeek, $weekendDays, true)) { + $date = $date->addDays($sign); + } + } + + $value = $weeks * $sign; + $unit = 'week'; + } + + $timeString = $date->toTimeString(); + } elseif ($canOverflow = (\in_array($unit, [ + 'month', + 'year', + ]) && ($overflow === false || ( + $overflow === null && + ($ucUnit = ucfirst($unit).'s') && + !($this->{'local'.$ucUnit.'Overflow'} ?? static::{'shouldOverflow'.$ucUnit}()) + )))) { + $day = $date->day; + } + + $value = (int) $value; + + if ($unit === 'milli' || $unit === 'millisecond') { + $unit = 'microsecond'; + $value *= static::MICROSECONDS_PER_MILLISECOND; + } + + // Work-around for bug https://bugs.php.net/bug.php?id=75642 + if ($unit === 'micro' || $unit === 'microsecond') { + $microseconds = $this->micro + $value; + $second = (int) floor($microseconds / static::MICROSECONDS_PER_SECOND); + $microseconds %= static::MICROSECONDS_PER_SECOND; + if ($microseconds < 0) { + $microseconds += static::MICROSECONDS_PER_SECOND; + } + $date = $date->microseconds($microseconds); + $unit = 'second'; + $value = $second; + } + + try { + $date = $date->modify("$value $unit"); + + if (isset($timeString)) { + $date = $date->setTimeFromTimeString($timeString); + } elseif (isset($canOverflow, $day) && $canOverflow && $day !== $date->day) { + $date = $date->modify('last day of previous month'); + } + } catch (DateMalformedStringException $ignoredException) { // @codeCoverageIgnore + $date = null; // @codeCoverageIgnore + } + + if (!$date) { + throw new UnitException('Unable to add unit '.var_export($originalArgs, true)); + } + + return $date; + } + + /** + * Subtract given units to the current instance. + * + * @param string $unit + * @param int $value + * @param bool|null $overflow + * + * @return static + */ + public function subUnit($unit, $value = 1, $overflow = null) + { + return $this->addUnit($unit, -$value, $overflow); + } + + /** + * Call native PHP DateTime/DateTimeImmutable sub() method. + * + * @param DateInterval $interval + * + * @return static + */ + public function rawSub(DateInterval $interval) + { + return parent::sub($interval); + } + + /** + * Subtract given units or interval to the current instance. + * + * @example $date->sub('hour', 3) + * @example $date->sub(15, 'days') + * @example $date->sub(CarbonInterval::days(4)) + * + * @param string|DateInterval|Closure|CarbonConverterInterface $unit + * @param int $value + * @param bool|null $overflow + * + * @return static + */ + #[ReturnTypeWillChange] + public function sub($unit, $value = 1, $overflow = null) + { + if (\is_string($unit) && \func_num_args() === 1) { + $unit = CarbonInterval::make($unit, [], true); + } + + if ($unit instanceof CarbonConverterInterface) { + return $this->resolveCarbon($unit->convertDate($this, true)); + } + + if ($unit instanceof Closure) { + return $this->resolveCarbon($unit($this, true)); + } + + if ($unit instanceof DateInterval) { + return parent::sub($unit); + } + + if (is_numeric($unit)) { + [$value, $unit] = [$unit, $value]; + } + + return $this->addUnit($unit, -(float) $value, $overflow); + } + + /** + * Subtract given units or interval to the current instance. + * + * @see sub() + * + * @param string|DateInterval $unit + * @param int $value + * @param bool|null $overflow + * + * @return static + */ + public function subtract($unit, $value = 1, $overflow = null) + { + if (\is_string($unit) && \func_num_args() === 1) { + $unit = CarbonInterval::make($unit, [], true); + } + + return $this->sub($unit, $value, $overflow); + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Traits/Week.php b/vendor/nesbot/carbon/src/Carbon/Traits/Week.php new file mode 100644 index 00000000..6f148145 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Traits/Week.php @@ -0,0 +1,219 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +/** + * Trait Week. + * + * week and ISO week number, year and count in year. + * + * Depends on the following properties: + * + * @property int $daysInYear + * @property int $dayOfWeek + * @property int $dayOfYear + * @property int $year + * + * Depends on the following methods: + * + * @method static addWeeks(int $weeks = 1) + * @method static copy() + * @method static dayOfYear(int $dayOfYear) + * @method string getTranslationMessage(string $key, ?string $locale = null, ?string $default = null, $translator = null) + * @method static next(int|string $day = null) + * @method static startOfWeek(int $day = 1) + * @method static subWeeks(int $weeks = 1) + * @method static year(int $year = null) + */ +trait Week +{ + /** + * Set/get the week number of year using given first day of week and first + * day of year included in the first week. Or use ISO format if no settings + * given. + * + * @param int|null $year if null, act as a getter, if not null, set the year and return current instance. + * @param int|null $dayOfWeek first date of week from 0 (Sunday) to 6 (Saturday) + * @param int|null $dayOfYear first day of year included in the week #1 + * + * @return int|static + */ + public function isoWeekYear($year = null, $dayOfWeek = null, $dayOfYear = null) + { + return $this->weekYear( + $year, + $dayOfWeek ?? 1, + $dayOfYear ?? 4 + ); + } + + /** + * Set/get the week number of year using given first day of week and first + * day of year included in the first week. Or use US format if no settings + * given (Sunday / Jan 6). + * + * @param int|null $year if null, act as a getter, if not null, set the year and return current instance. + * @param int|null $dayOfWeek first date of week from 0 (Sunday) to 6 (Saturday) + * @param int|null $dayOfYear first day of year included in the week #1 + * + * @return int|static + */ + public function weekYear($year = null, $dayOfWeek = null, $dayOfYear = null) + { + $dayOfWeek = $dayOfWeek ?? $this->getTranslationMessage('first_day_of_week') ?? 0; + $dayOfYear = $dayOfYear ?? $this->getTranslationMessage('day_of_first_week_of_year') ?? 1; + + if ($year !== null) { + $year = (int) round($year); + + if ($this->weekYear(null, $dayOfWeek, $dayOfYear) === $year) { + return $this->avoidMutation(); + } + + $week = $this->week(null, $dayOfWeek, $dayOfYear); + $day = $this->dayOfWeek; + $date = $this->year($year); + switch ($date->weekYear(null, $dayOfWeek, $dayOfYear) - $year) { + case 1: + $date = $date->subWeeks(26); + + break; + case -1: + $date = $date->addWeeks(26); + + break; + } + + $date = $date->addWeeks($week - $date->week(null, $dayOfWeek, $dayOfYear))->startOfWeek($dayOfWeek); + + if ($date->dayOfWeek === $day) { + return $date; + } + + return $date->next($day); + } + + $year = $this->year; + $day = $this->dayOfYear; + $date = $this->avoidMutation()->dayOfYear($dayOfYear)->startOfWeek($dayOfWeek); + + if ($date->year === $year && $day < $date->dayOfYear) { + return $year - 1; + } + + $date = $this->avoidMutation()->addYear()->dayOfYear($dayOfYear)->startOfWeek($dayOfWeek); + + if ($date->year === $year && $day >= $date->dayOfYear) { + return $year + 1; + } + + return $year; + } + + /** + * Get the number of weeks of the current week-year using given first day of week and first + * day of year included in the first week. Or use ISO format if no settings + * given. + * + * @param int|null $dayOfWeek first date of week from 0 (Sunday) to 6 (Saturday) + * @param int|null $dayOfYear first day of year included in the week #1 + * + * @return int + */ + public function isoWeeksInYear($dayOfWeek = null, $dayOfYear = null) + { + return $this->weeksInYear( + $dayOfWeek ?? 1, + $dayOfYear ?? 4 + ); + } + + /** + * Get the number of weeks of the current week-year using given first day of week and first + * day of year included in the first week. Or use US format if no settings + * given (Sunday / Jan 6). + * + * @param int|null $dayOfWeek first date of week from 0 (Sunday) to 6 (Saturday) + * @param int|null $dayOfYear first day of year included in the week #1 + * + * @return int + */ + public function weeksInYear($dayOfWeek = null, $dayOfYear = null) + { + $dayOfWeek = $dayOfWeek ?? $this->getTranslationMessage('first_day_of_week') ?? 0; + $dayOfYear = $dayOfYear ?? $this->getTranslationMessage('day_of_first_week_of_year') ?? 1; + $year = $this->year; + $start = $this->avoidMutation()->dayOfYear($dayOfYear)->startOfWeek($dayOfWeek); + $startDay = $start->dayOfYear; + if ($start->year !== $year) { + $startDay -= $start->daysInYear; + } + $end = $this->avoidMutation()->addYear()->dayOfYear($dayOfYear)->startOfWeek($dayOfWeek); + $endDay = $end->dayOfYear; + if ($end->year !== $year) { + $endDay += $this->daysInYear; + } + + return (int) round(($endDay - $startDay) / 7); + } + + /** + * Get/set the week number using given first day of week and first + * day of year included in the first week. Or use US format if no settings + * given (Sunday / Jan 6). + * + * @param int|null $week + * @param int|null $dayOfWeek + * @param int|null $dayOfYear + * + * @return int|static + */ + public function week($week = null, $dayOfWeek = null, $dayOfYear = null) + { + $date = $this; + $dayOfWeek = $dayOfWeek ?? $this->getTranslationMessage('first_day_of_week') ?? 0; + $dayOfYear = $dayOfYear ?? $this->getTranslationMessage('day_of_first_week_of_year') ?? 1; + + if ($week !== null) { + return $date->addWeeks(round($week) - $this->week(null, $dayOfWeek, $dayOfYear)); + } + + $start = $date->avoidMutation()->dayOfYear($dayOfYear)->startOfWeek($dayOfWeek); + $end = $date->avoidMutation()->startOfWeek($dayOfWeek); + if ($start > $end) { + $start = $start->subWeeks(26)->dayOfYear($dayOfYear)->startOfWeek($dayOfWeek); + } + $week = (int) ($start->diffInDays($end) / 7 + 1); + + return $week > $end->weeksInYear($dayOfWeek, $dayOfYear) ? 1 : $week; + } + + /** + * Get/set the week number using given first day of week and first + * day of year included in the first week. Or use ISO format if no settings + * given. + * + * @param int|null $week + * @param int|null $dayOfWeek + * @param int|null $dayOfYear + * + * @return int|static + */ + public function isoWeek($week = null, $dayOfWeek = null, $dayOfYear = null) + { + return $this->week( + $week, + $dayOfWeek ?? 1, + $dayOfYear ?? 4 + ); + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Translator.php b/vendor/nesbot/carbon/src/Carbon/Translator.php new file mode 100644 index 00000000..491c9e72 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Translator.php @@ -0,0 +1,32 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon; + +use ReflectionMethod; +use Symfony\Component\Translation; +use Symfony\Contracts\Translation\TranslatorInterface; + +$transMethod = new ReflectionMethod( + class_exists(TranslatorInterface::class) + ? TranslatorInterface::class + : Translation\Translator::class, + 'trans' +); + +require $transMethod->hasReturnType() + ? __DIR__.'/../../lazy/Carbon/TranslatorStrongType.php' + : __DIR__.'/../../lazy/Carbon/TranslatorWeakType.php'; + +class Translator extends LazyTranslator +{ + // Proxy dynamically loaded LazyTranslator in a static way +} diff --git a/vendor/nesbot/carbon/src/Carbon/TranslatorImmutable.php b/vendor/nesbot/carbon/src/Carbon/TranslatorImmutable.php new file mode 100644 index 00000000..ce6b2f90 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/TranslatorImmutable.php @@ -0,0 +1,99 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon; + +use Carbon\Exceptions\ImmutableException; +use Symfony\Component\Config\ConfigCacheFactoryInterface; +use Symfony\Component\Translation\Formatter\MessageFormatterInterface; + +class TranslatorImmutable extends Translator +{ + /** @var bool */ + private $constructed = false; + + public function __construct($locale, MessageFormatterInterface $formatter = null, $cacheDir = null, $debug = false) + { + parent::__construct($locale, $formatter, $cacheDir, $debug); + $this->constructed = true; + } + + /** + * @codeCoverageIgnore + */ + public function setDirectories(array $directories) + { + $this->disallowMutation(__METHOD__); + + return parent::setDirectories($directories); + } + + public function setLocale($locale) + { + $this->disallowMutation(__METHOD__); + + return parent::setLocale($locale); + } + + /** + * @codeCoverageIgnore + */ + public function setMessages($locale, $messages) + { + $this->disallowMutation(__METHOD__); + + return parent::setMessages($locale, $messages); + } + + /** + * @codeCoverageIgnore + */ + public function setTranslations($messages) + { + $this->disallowMutation(__METHOD__); + + return parent::setTranslations($messages); + } + + /** + * @codeCoverageIgnore + */ + public function setConfigCacheFactory(ConfigCacheFactoryInterface $configCacheFactory): void + { + $this->disallowMutation(__METHOD__); + + parent::setConfigCacheFactory($configCacheFactory); + } + + public function resetMessages($locale = null) + { + $this->disallowMutation(__METHOD__); + + return parent::resetMessages($locale); + } + + /** + * @codeCoverageIgnore + */ + public function setFallbackLocales(array $locales) + { + $this->disallowMutation(__METHOD__); + + parent::setFallbackLocales($locales); + } + + private function disallowMutation($method) + { + if ($this->constructed) { + throw new ImmutableException($method.' not allowed on '.static::class); + } + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/TranslatorStrongTypeInterface.php b/vendor/nesbot/carbon/src/Carbon/TranslatorStrongTypeInterface.php new file mode 100644 index 00000000..ef4dee8e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/TranslatorStrongTypeInterface.php @@ -0,0 +1,22 @@ +<?php + +/** + * This file is part of the Carbon package. + * + * (c) Brian Nesbitt <brian@nesbot.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon; + +use Symfony\Component\Translation\MessageCatalogueInterface; + +/** + * Mark translator using strong type from symfony/translation >= 6. + */ +interface TranslatorStrongTypeInterface +{ + public function getFromCatalogue(MessageCatalogueInterface $catalogue, string $id, string $domain = 'messages'); +} diff --git a/vendor/nette/schema/composer.json b/vendor/nette/schema/composer.json new file mode 100644 index 00000000..626e98f9 --- /dev/null +++ b/vendor/nette/schema/composer.json @@ -0,0 +1,39 @@ +{ + "name": "nette/schema", + "description": "📐 Nette Schema: validating data structures against a given Schema.", + "keywords": ["nette", "config"], + "homepage": "https://nette.org", + "license": ["BSD-3-Clause", "GPL-2.0-only", "GPL-3.0-only"], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "require": { + "php": "8.1 - 8.3", + "nette/utils": "^4.0" + }, + "require-dev": { + "nette/tester": "^2.4", + "tracy/tracy": "^2.8", + "phpstan/phpstan-nette": "^1.0" + }, + "autoload": { + "classmap": ["src/"] + }, + "minimum-stability": "dev", + "scripts": { + "phpstan": "phpstan analyse", + "tester": "tester tests -s" + }, + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + } +} diff --git a/vendor/nette/schema/license.md b/vendor/nette/schema/license.md new file mode 100644 index 00000000..cf741bd0 --- /dev/null +++ b/vendor/nette/schema/license.md @@ -0,0 +1,60 @@ +Licenses +======== + +Good news! You may use Nette Framework under the terms of either +the New BSD License or the GNU General Public License (GPL) version 2 or 3. + +The BSD License is recommended for most projects. It is easy to understand and it +places almost no restrictions on what you can do with the framework. If the GPL +fits better to your project, you can use the framework under this license. + +You don't have to notify anyone which license you are using. You can freely +use Nette Framework in commercial projects as long as the copyright header +remains intact. + +Please be advised that the name "Nette Framework" is a protected trademark and its +usage has some limitations. So please do not use word "Nette" in the name of your +project or top-level domain, and choose a name that stands on its own merits. +If your stuff is good, it will not take long to establish a reputation for yourselves. + + +New BSD License +--------------- + +Copyright (c) 2004, 2014 David Grudl (https://davidgrudl.com) +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of "Nette Framework" nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +This software is provided by the copyright holders and contributors "as is" and +any express or implied warranties, including, but not limited to, the implied +warranties of merchantability and fitness for a particular purpose are +disclaimed. In no event shall the copyright owner or contributors be liable for +any direct, indirect, incidental, special, exemplary, or consequential damages +(including, but not limited to, procurement of substitute goods or services; +loss of use, data, or profits; or business interruption) however caused and on +any theory of liability, whether in contract, strict liability, or tort +(including negligence or otherwise) arising in any way out of the use of this +software, even if advised of the possibility of such damage. + + +GNU General Public License +-------------------------- + +GPL licenses are very very long, so instead of including them here we offer +you URLs with full text: + +- [GPL version 2](http://www.gnu.org/licenses/gpl-2.0.html) +- [GPL version 3](http://www.gnu.org/licenses/gpl-3.0.html) diff --git a/vendor/nette/schema/readme.md b/vendor/nette/schema/readme.md new file mode 100644 index 00000000..c88f6bd2 --- /dev/null +++ b/vendor/nette/schema/readme.md @@ -0,0 +1,537 @@ +Nette Schema +************ + +[![Downloads this Month](https://img.shields.io/packagist/dm/nette/schema.svg)](https://packagist.org/packages/nette/schema) +[![Tests](https://github.com/nette/schema/workflows/Tests/badge.svg?branch=master)](https://github.com/nette/schema/actions) +[![Coverage Status](https://coveralls.io/repos/github/nette/schema/badge.svg?branch=master)](https://coveralls.io/github/nette/schema?branch=master) +[![Latest Stable Version](https://poser.pugx.org/nette/schema/v/stable)](https://github.com/nette/schema/releases) +[![License](https://img.shields.io/badge/license-New%20BSD-blue.svg)](https://github.com/nette/schema/blob/master/license.md) + + +Introduction +============ + +A practical library for validation and normalization of data structures against a given schema with a smart & easy-to-understand API. + +Documentation can be found on the [website](https://doc.nette.org/schema). + +Installation: + +```shell +composer require nette/schema +``` + +It requires PHP version 8.1 and supports PHP up to 8.3. + + +[Support Me](https://github.com/sponsors/dg) +-------------------------------------------- + +Do you like Nette Schema? Are you looking forward to the new features? + +[![Buy me a coffee](https://files.nette.org/icons/donation-3.svg)](https://github.com/sponsors/dg) + +Thank you! + + +Basic Usage +----------- + +In variable `$schema` we have a validation schema (what exactly this means and how to create it we will say later) and in variable `$data` we have a data structure that we want to validate and normalize. This can be, for example, data sent by the user through an API, configuration file, etc. + +The task is handled by the [Nette\Schema\Processor](https://api.nette.org/schema/master/Nette/Schema/Processor.html) class, which processes the input and either returns normalized data or throws an [Nette\Schema\ValidationException](https://api.nette.org/schema/master/Nette/Schema/ValidationException.html) exception on error. + +```php +$processor = new Nette\Schema\Processor; + +try { + $normalized = $processor->process($schema, $data); +} catch (Nette\Schema\ValidationException $e) { + echo 'Data is invalid: ' . $e->getMessage(); +} +``` + +Method `$e->getMessages()` returns array of all message strings and `$e->getMessageObjects()` return all messages as [Nette\Schema\Message](https://api.nette.org/schema/master/Nette/Schema/Message.html) objects. + + +Defining Schema +--------------- + +And now let's create a schema. The class [Nette\Schema\Expect](https://api.nette.org/schema/master/Nette/Schema/Expect.html) is used to define it, we actually define expectations of what the data should look like. Let's say that the input data must be a structure (e.g. an array) containing elements `processRefund` of type bool and `refundAmount` of type int. + +```php +use Nette\Schema\Expect; + +$schema = Expect::structure([ + 'processRefund' => Expect::bool(), + 'refundAmount' => Expect::int(), +]); +``` + +We believe that the schema definition looks clear, even if you see it for the very first time. + +Lets send the following data for validation: + +```php +$data = [ + 'processRefund' => true, + 'refundAmount' => 17, +]; + +$normalized = $processor->process($schema, $data); // OK, it passes +``` + +The output, i.e. the value `$normalized`, is the object `stdClass`. If we want the output to be an array, we add a cast to schema `Expect::structure([...])->castTo('array')`. + +All elements of the structure are optional and have a default value `null`. Example: + +```php +$data = [ + 'refundAmount' => 17, +]; + +$normalized = $processor->process($schema, $data); // OK, it passes +// $normalized = {'processRefund' => null, 'refundAmount' => 17} +``` + +The fact that the default value is `null` does not mean that it would be accepted in the input data `'processRefund' => null`. No, the input must be boolean, i.e. only `true` or `false`. We would have to explicitly allow `null` via `Expect::bool()->nullable()`. + +An item can be made mandatory using `Expect::bool()->required()`. We change the default value to `false` using `Expect::bool()->default(false)` or shortly using `Expect::bool(false)`. + +And what if we wanted to accept `1` and `0` besides booleans? Then we list the allowed values, which we will also normalize to boolean: + +```php +$schema = Expect::structure([ + 'processRefund' => Expect::anyOf(true, false, 1, 0)->castTo('bool'), + 'refundAmount' => Expect::int(), +]); + +$normalized = $processor->process($schema, $data); +is_bool($normalized->processRefund); // true +``` + +Now you know the basics of how the schema is defined and how the individual elements of the structure behave. We will now show what all the other elements can be used in defining a schema. + + +Data Types: type() +------------------ + +All standard PHP data types can be listed in the schema: + +```php +Expect::string($default = null) +Expect::int($default = null) +Expect::float($default = null) +Expect::bool($default = null) +Expect::null() +Expect::array($default = []) +``` + +And then all types [supported by the Validators](https://doc.nette.org/validators#toc-validation-rules) via `Expect::type('scalar')` or abbreviated `Expect::scalar()`. Also class or interface names are accepted, e.g. `Expect::type('AddressEntity')`. + +You can also use union notation: + +```php +Expect::type('bool|string|array') +``` + +The default value is always `null` except for `array` and `list`, where it is an empty array. (A list is an array indexed in ascending order of numeric keys from zero, that is, a non-associative array). + + +Array of Values: arrayOf() listOf() +----------------------------------- + +The array is too general structure, it is more useful to specify exactly what elements it can contain. For example, an array whose elements can only be strings: + +```php +$schema = Expect::arrayOf('string'); + +$processor->process($schema, ['hello', 'world']); // OK +$processor->process($schema, ['a' => 'hello', 'b' => 'world']); // OK +$processor->process($schema, ['key' => 123]); // ERROR: 123 is not a string +``` + +The second parameter can be used to specify keys (since version 1.2): + +```php +$schema = Expect::arrayOf('string', 'int'); + +$processor->process($schema, ['hello', 'world']); // OK +$processor->process($schema, ['a' => 'hello']); // ERROR: 'a' is not int +``` + +The list is an indexed array: + +```php +$schema = Expect::listOf('string'); + +$processor->process($schema, ['a', 'b']); // OK +$processor->process($schema, ['a', 123]); // ERROR: 123 is not a string +$processor->process($schema, ['key' => 'a']); // ERROR: is not a list +$processor->process($schema, [1 => 'a', 0 => 'b']); // ERROR: is not a list +``` + +The parameter can also be a schema, so we can write: + +```php +Expect::arrayOf(Expect::bool()) +``` + +The default value is an empty array. If you specify a default value, it will be merged with the passed data. This can be disabled using `mergeDefaults(false)`. + + +Enumeration: anyOf() +-------------------- + +`anyOf()` is a set of values ​​or schemas that a value can be. Here's how to write an array of elements that can be either `'a'`, `true`, or `null`: + +```php +$schema = Expect::listOf( + Expect::anyOf('a', true, null), +); + +$processor->process($schema, ['a', true, null, 'a']); // OK +$processor->process($schema, ['a', false]); // ERROR: false does not belong there +``` + +The enumeration elements can also be schemas: + +```php +$schema = Expect::listOf( + Expect::anyOf(Expect::string(), true, null), +); + +$processor->process($schema, ['foo', true, null, 'bar']); // OK +$processor->process($schema, [123]); // ERROR +``` + +The `anyOf()` method accepts variants as individual parameters, not as array. To pass it an array of values, use the unpacking operator `anyOf(...$variants)`. + +The default value is `null`. Use the `firstIsDefault()` method to make the first element the default: + +```php +// default is 'hello' +Expect::anyOf(Expect::string('hello'), true, null)->firstIsDefault(); +``` + + +Structures +---------- + +Structures are objects with defined keys. Each of these key => value pairs is referred to as a "property": + +Structures accept arrays and objects and return objects `stdClass` (unless you change it with `castTo('array')`, etc.). + +By default, all properties are optional and have a default value of `null`. You can define mandatory properties using `required()`: + +```php +$schema = Expect::structure([ + 'required' => Expect::string()->required(), + 'optional' => Expect::string(), // the default value is null +]); + +$processor->process($schema, ['optional' => '']); +// ERROR: option 'required' is missing + +$processor->process($schema, ['required' => 'foo']); +// OK, returns {'required' => 'foo', 'optional' => null} +``` + +If you do not want to output properties with only a default value, use `skipDefaults()`: + +```php +$schema = Expect::structure([ + 'required' => Expect::string()->required(), + 'optional' => Expect::string(), +])->skipDefaults(); + +$processor->process($schema, ['required' => 'foo']); +// OK, returns {'required' => 'foo'} +``` + +Although `null` is the default value of the `optional` property, it is not allowed in the input data (the value must be a string). Properties accepting `null` are defined using `nullable()`: + +```php +$schema = Expect::structure([ + 'optional' => Expect::string(), + 'nullable' => Expect::string()->nullable(), +]); + +$processor->process($schema, ['optional' => null]); +// ERROR: 'optional' expects to be string, null given. + +$processor->process($schema, ['nullable' => null]); +// OK, returns {'optional' => null, 'nullable' => null} +``` + +By default, there can be no extra items in the input data: + +```php +$schema = Expect::structure([ + 'key' => Expect::string(), +]); + +$processor->process($schema, ['additional' => 1]); +// ERROR: Unexpected item 'additional' +``` + +Which we can change with `otherItems()`. As a parameter, we will specify the schema for each extra element: + +```php +$schema = Expect::structure([ + 'key' => Expect::string(), +])->otherItems(Expect::int()); + +$processor->process($schema, ['additional' => 1]); // OK +$processor->process($schema, ['additional' => true]); // ERROR +``` + + +Deprecations +------------ + +You can deprecate property using the `deprecated([string $message])` method. Deprecation notices are returned by `$processor->getWarnings()`: + +```php +$schema = Expect::structure([ + 'old' => Expect::int()->deprecated('The item %path% is deprecated'), +]); + +$processor->process($schema, ['old' => 1]); // OK +$processor->getWarnings(); // ["The item 'old' is deprecated"] +``` + + +Ranges: min() max() +------------------- + +Use `min()` and `max()` to limit the number of elements for arrays: + +```php +// array, at least 10 items, maximum 20 items +Expect::array()->min(10)->max(20); +``` + +For strings, limit their length: + +```php +// string, at least 10 characters long, maximum 20 characters +Expect::string()->min(10)->max(20); +``` + +For numbers, limit their value: + +```php +// integer, between 10 and 20 inclusive +Expect::int()->min(10)->max(20); +``` + +Of course, it is possible to mention only `min()`, or only `max()`: + +```php +// string, maximum 20 characters +Expect::string()->max(20); +``` + + +Regular Expressions: pattern() +------------------------------ + +Using `pattern()`, you can specify a regular expression which the **whole** input string must match (i.e. as if it were wrapped in characters `^` a `$`): + +```php +// just 9 digits +Expect::string()->pattern('\d{9}'); +``` + + +Custom Assertions: assert() +--------------------------- + +You can add any other restrictions using `assert(callable $fn)`. + +```php +$countIsEven = fn($v) => count($v) % 2 === 0; + +$schema = Expect::arrayOf('string') + ->assert($countIsEven); // the count must be even + +$processor->process($schema, ['a', 'b']); // OK +$processor->process($schema, ['a', 'b', 'c']); // ERROR: 3 is not even +``` + +Or + +```php +Expect::string()->assert('is_file'); // the file must exist +``` + +You can add your own description for each assertion. It will be part of the error message. + +```php +$schema = Expect::arrayOf('string') + ->assert($countIsEven, 'Even items in array'); + +$processor->process($schema, ['a', 'b', 'c']); +// Failed assertion "Even items in array" for item with value array. +``` + +The method can be called repeatedly to add multiple constraints. It can be intermixed with calls to `transform()` and `castTo()`. + + +Transformation: transform() +--------------------------- + +Successfully validated data can be modified using a custom function: + +```php +// conversion to uppercase: +Expect::string()->transform(fn(string $s) => strtoupper($s)); +``` + +The method can be called repeatedly to add multiple transformations. It can be intermixed with calls to `assert()` and `castTo()`. The operations will be executed in the order in which they are declared: + +```php +Expect::type('string|int') + ->castTo('string') + ->assert('ctype_lower', 'All characters must be lowercased') + ->transform(fn(string $s) => strtoupper($s)); // conversion to uppercase +``` + +The `transform()` method can both transform and validate the value simultaneously. This is often simpler and less redundant than chaining `transform()` and `assert()`. For this purpose, the function receives a [Nette\Schema\Context](https://api.nette.org/schema/master/Nette/Schema/Context.html) object with an `addError()` method, which can be used to add information about validation issues: + +```php +Expect::string() + ->transform(function (string $s, Nette\Schema\Context $context) { + if (!ctype_lower($s)) { + $context->addError('All characters must be lowercased', 'my.case.error'); + return null; + } + + return strtoupper($s); + }); +``` + + +Casting: castTo() +----------------- + +Successfully validated data can be cast: + +```php +Expect::scalar()->castTo('string'); +``` + +In addition to native PHP types, you can also cast to classes. It distinguishes whether it is a simple class without a constructor or a class with a constructor. If the class has no constructor, an instance of it is created and all elements of the structure are written to its properties: + +```php +class Info +{ + public bool $processRefund; + public int $refundAmount; +} + +Expect::structure([ + 'processRefund' => Expect::bool(), + 'refundAmount' => Expect::int(), +])->castTo(Info::class); + +// creates '$obj = new Info' and writes to $obj->processRefund and $obj->refundAmount +``` + +If the class has a constructor, the elements of the structure are passed as named parameters to the constructor: + +```php +class Info +{ + public function __construct( + public bool $processRefund, + public int $refundAmount, + ) { + } +} + +// creates $obj = new Info(processRefund: ..., refundAmount: ...) +``` + +Casting combined with a scalar parameter creates an object and passes the value as the sole parameter to the constructor: + +```php +Expect::string()->castTo(DateTime::class); +// creates new DateTime(...) +``` + + +Normalization: before() +----------------------- + +Prior to the validation itself, the data can be normalized using the method `before()`. As an example, let's have an element that must be an array of strings (eg `['a', 'b', 'c']`), but receives input in the form of a string `a b c`: + +```php +$explode = fn($v) => explode(' ', $v); + +$schema = Expect::arrayOf('string') + ->before($explode); + +$normalized = $processor->process($schema, 'a b c'); +// OK, returns ['a', 'b', 'c'] +``` + + +Mapping to Objects: from() +-------------------------- + +You can generate structure schema from the class. Example: + +```php +class Config +{ + /** @var string */ + public $name; + /** @var string|null */ + public $password; + /** @var bool */ + public $admin = false; +} + +$schema = Expect::from(new Config); + +$data = [ + 'name' => 'jeff', +]; + +$normalized = $processor->process($schema, $data); +// $normalized instanceof Config +// $normalized = {'name' => 'jeff', 'password' => null, 'admin' => false} +``` + +If you are using PHP 7.4 or higher, you can use native types: + +```php +class Config +{ + public string $name; + public ?string $password; + public bool $admin = false; +} + +$schema = Expect::from(new Config); +``` + +Anonymous classes are also supported: + +```php +$schema = Expect::from(new class { + public string $name; + public ?string $password; + public bool $admin = false; +}); +``` + +Because the information obtained from the class definition may not be sufficient, you can add a custom schema for the elements with the second parameter: + +```php +$schema = Expect::from(new Config, [ + 'name' => Expect::string()->pattern('\w:.*'), +]); +``` diff --git a/vendor/nette/schema/src/Schema/Context.php b/vendor/nette/schema/src/Schema/Context.php new file mode 100644 index 00000000..0f512656 --- /dev/null +++ b/vendor/nette/schema/src/Schema/Context.php @@ -0,0 +1,51 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Schema; + + +final class Context +{ + public bool $skipDefaults = false; + + /** @var string[] */ + public array $path = []; + + public bool $isKey = false; + + /** @var Message[] */ + public array $errors = []; + + /** @var Message[] */ + public array $warnings = []; + + /** @var array[] */ + public array $dynamics = []; + + + public function addError(string $message, string $code, array $variables = []): Message + { + $variables['isKey'] = $this->isKey; + return $this->errors[] = new Message($message, $code, $this->path, $variables); + } + + + public function addWarning(string $message, string $code, array $variables = []): Message + { + return $this->warnings[] = new Message($message, $code, $this->path, $variables); + } + + + /** @return \Closure(): bool */ + public function createChecker(): \Closure + { + $count = count($this->errors); + return fn(): bool => $count === count($this->errors); + } +} diff --git a/vendor/nette/schema/src/Schema/DynamicParameter.php b/vendor/nette/schema/src/Schema/DynamicParameter.php new file mode 100644 index 00000000..8dd61050 --- /dev/null +++ b/vendor/nette/schema/src/Schema/DynamicParameter.php @@ -0,0 +1,15 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Schema; + + +interface DynamicParameter +{ +} diff --git a/vendor/nette/schema/src/Schema/Elements/AnyOf.php b/vendor/nette/schema/src/Schema/Elements/AnyOf.php new file mode 100644 index 00000000..6c9d0cea --- /dev/null +++ b/vendor/nette/schema/src/Schema/Elements/AnyOf.php @@ -0,0 +1,147 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Schema\Elements; + +use Nette; +use Nette\Schema\Context; +use Nette\Schema\Helpers; +use Nette\Schema\Schema; + + +final class AnyOf implements Schema +{ + use Base; + + private array $set; + + + public function __construct(mixed ...$set) + { + if (!$set) { + throw new Nette\InvalidStateException('The enumeration must not be empty.'); + } + + $this->set = $set; + } + + + public function firstIsDefault(): self + { + $this->default = $this->set[0]; + return $this; + } + + + public function nullable(): self + { + $this->set[] = null; + return $this; + } + + + public function dynamic(): self + { + $this->set[] = new Type(Nette\Schema\DynamicParameter::class); + return $this; + } + + + /********************* processing ****************d*g**/ + + + public function normalize(mixed $value, Context $context): mixed + { + return $this->doNormalize($value, $context); + } + + + public function merge(mixed $value, mixed $base): mixed + { + if (is_array($value) && isset($value[Helpers::PreventMerging])) { + unset($value[Helpers::PreventMerging]); + return $value; + } + + return Helpers::merge($value, $base); + } + + + public function complete(mixed $value, Context $context): mixed + { + $isOk = $context->createChecker(); + $value = $this->findAlternative($value, $context); + $isOk() && $value = $this->doTransform($value, $context); + return $isOk() ? $value : null; + } + + + private function findAlternative(mixed $value, Context $context): mixed + { + $expecteds = $innerErrors = []; + foreach ($this->set as $item) { + if ($item instanceof Schema) { + $dolly = new Context; + $dolly->path = $context->path; + $res = $item->complete($item->normalize($value, $dolly), $dolly); + if (!$dolly->errors) { + $context->warnings = array_merge($context->warnings, $dolly->warnings); + return $res; + } + + foreach ($dolly->errors as $error) { + if ($error->path !== $context->path || empty($error->variables['expected'])) { + $innerErrors[] = $error; + } else { + $expecteds[] = $error->variables['expected']; + } + } + } else { + if ($item === $value) { + return $value; + } + + $expecteds[] = Nette\Schema\Helpers::formatValue($item); + } + } + + if ($innerErrors) { + $context->errors = array_merge($context->errors, $innerErrors); + } else { + $context->addError( + 'The %label% %path% expects to be %expected%, %value% given.', + Nette\Schema\Message::TypeMismatch, + [ + 'value' => $value, + 'expected' => implode('|', array_unique($expecteds)), + ], + ); + } + + return null; + } + + + public function completeDefault(Context $context): mixed + { + if ($this->required) { + $context->addError( + 'The mandatory item %path% is missing.', + Nette\Schema\Message::MissingItem, + ); + return null; + } + + if ($this->default instanceof Schema) { + return $this->default->completeDefault($context); + } + + return $this->default; + } +} diff --git a/vendor/nette/schema/src/Schema/Elements/Base.php b/vendor/nette/schema/src/Schema/Elements/Base.php new file mode 100644 index 00000000..1dfda8a2 --- /dev/null +++ b/vendor/nette/schema/src/Schema/Elements/Base.php @@ -0,0 +1,162 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Schema\Elements; + +use Nette; +use Nette\Schema\Context; +use Nette\Schema\Helpers; + + +/** + * @internal + */ +trait Base +{ + private bool $required = false; + private mixed $default = null; + + /** @var ?callable */ + private $before; + + /** @var callable[] */ + private array $transforms = []; + private ?string $deprecated = null; + + + public function default(mixed $value): self + { + $this->default = $value; + return $this; + } + + + public function required(bool $state = true): self + { + $this->required = $state; + return $this; + } + + + public function before(callable $handler): self + { + $this->before = $handler; + return $this; + } + + + public function castTo(string $type): self + { + return $this->transform(Helpers::getCastStrategy($type)); + } + + + public function transform(callable $handler): self + { + $this->transforms[] = $handler; + return $this; + } + + + public function assert(callable $handler, ?string $description = null): self + { + $expected = $description ?: (is_string($handler) ? "$handler()" : '#' . count($this->transforms)); + return $this->transform(function ($value, Context $context) use ($handler, $description, $expected) { + if ($handler($value)) { + return $value; + } + $context->addError( + 'Failed assertion ' . ($description ? "'%assertion%'" : '%assertion%') . ' for %label% %path% with value %value%.', + Nette\Schema\Message::FailedAssertion, + ['value' => $value, 'assertion' => $expected], + ); + }); + } + + + /** Marks as deprecated */ + public function deprecated(string $message = 'The item %path% is deprecated.'): self + { + $this->deprecated = $message; + return $this; + } + + + public function completeDefault(Context $context): mixed + { + if ($this->required) { + $context->addError( + 'The mandatory item %path% is missing.', + Nette\Schema\Message::MissingItem, + ); + return null; + } + + return $this->default; + } + + + public function doNormalize(mixed $value, Context $context): mixed + { + if ($this->before) { + $value = ($this->before)($value); + } + + return $value; + } + + + private function doDeprecation(Context $context): void + { + if ($this->deprecated !== null) { + $context->addWarning( + $this->deprecated, + Nette\Schema\Message::Deprecated, + ); + } + } + + + private function doTransform(mixed $value, Context $context): mixed + { + $isOk = $context->createChecker(); + foreach ($this->transforms as $handler) { + $value = $handler($value, $context); + if (!$isOk()) { + return null; + } + } + return $value; + } + + + /** @deprecated use Nette\Schema\Validators::validateType() */ + private function doValidate(mixed $value, string $expected, Context $context): bool + { + $isOk = $context->createChecker(); + Helpers::validateType($value, $expected, $context); + return $isOk(); + } + + + /** @deprecated use Nette\Schema\Validators::validateRange() */ + private static function doValidateRange(mixed $value, array $range, Context $context, string $types = ''): bool + { + $isOk = $context->createChecker(); + Helpers::validateRange($value, $range, $context, $types); + return $isOk(); + } + + + /** @deprecated use doTransform() */ + private function doFinalize(mixed $value, Context $context): mixed + { + return $this->doTransform($value, $context); + } +} diff --git a/vendor/nette/schema/src/Schema/Elements/Structure.php b/vendor/nette/schema/src/Schema/Elements/Structure.php new file mode 100644 index 00000000..56f5ffe8 --- /dev/null +++ b/vendor/nette/schema/src/Schema/Elements/Structure.php @@ -0,0 +1,200 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Schema\Elements; + +use Nette; +use Nette\Schema\Context; +use Nette\Schema\Helpers; +use Nette\Schema\Schema; + + +final class Structure implements Schema +{ + use Base; + + /** @var Schema[] */ + private array $items; + + /** for array|list */ + private ?Schema $otherItems = null; + + /** @var array{?int, ?int} */ + private array $range = [null, null]; + private bool $skipDefaults = false; + + + /** + * @param Schema[] $items + */ + public function __construct(array $items) + { + (function (Schema ...$items) {})(...array_values($items)); + $this->items = $items; + $this->castTo('object'); + $this->required = true; + } + + + public function default(mixed $value): self + { + throw new Nette\InvalidStateException('Structure cannot have default value.'); + } + + + public function min(?int $min): self + { + $this->range[0] = $min; + return $this; + } + + + public function max(?int $max): self + { + $this->range[1] = $max; + return $this; + } + + + public function otherItems(string|Schema $type = 'mixed'): self + { + $this->otherItems = $type instanceof Schema ? $type : new Type($type); + return $this; + } + + + public function skipDefaults(bool $state = true): self + { + $this->skipDefaults = $state; + return $this; + } + + + /********************* processing ****************d*g**/ + + + public function normalize(mixed $value, Context $context): mixed + { + if ($prevent = (is_array($value) && isset($value[Helpers::PreventMerging]))) { + unset($value[Helpers::PreventMerging]); + } + + $value = $this->doNormalize($value, $context); + if (is_object($value)) { + $value = (array) $value; + } + + if (is_array($value)) { + foreach ($value as $key => $val) { + $itemSchema = $this->items[$key] ?? $this->otherItems; + if ($itemSchema) { + $context->path[] = $key; + $value[$key] = $itemSchema->normalize($val, $context); + array_pop($context->path); + } + } + + if ($prevent) { + $value[Helpers::PreventMerging] = true; + } + } + + return $value; + } + + + public function merge(mixed $value, mixed $base): mixed + { + if (is_array($value) && isset($value[Helpers::PreventMerging])) { + unset($value[Helpers::PreventMerging]); + $base = null; + } + + if (is_array($value) && is_array($base)) { + $index = 0; + foreach ($value as $key => $val) { + if ($key === $index) { + $base[] = $val; + $index++; + } elseif (array_key_exists($key, $base)) { + $itemSchema = $this->items[$key] ?? $this->otherItems; + $base[$key] = $itemSchema + ? $itemSchema->merge($val, $base[$key]) + : Helpers::merge($val, $base[$key]); + } else { + $base[$key] = $val; + } + } + + return $base; + } + + return Helpers::merge($value, $base); + } + + + public function complete(mixed $value, Context $context): mixed + { + if ($value === null) { + $value = []; // is unable to distinguish null from array in NEON + } + + $this->doDeprecation($context); + + $isOk = $context->createChecker(); + Helpers::validateType($value, 'array', $context); + $isOk() && Helpers::validateRange($value, $this->range, $context); + $isOk() && $this->validateItems($value, $context); + $isOk() && $value = $this->doTransform($value, $context); + return $isOk() ? $value : null; + } + + + private function validateItems(array &$value, Context $context): void + { + $items = $this->items; + if ($extraKeys = array_keys(array_diff_key($value, $items))) { + if ($this->otherItems) { + $items += array_fill_keys($extraKeys, $this->otherItems); + } else { + $keys = array_map('strval', array_keys($items)); + foreach ($extraKeys as $key) { + $hint = Nette\Utils\Helpers::getSuggestion($keys, (string) $key); + $context->addError( + 'Unexpected item %path%' . ($hint ? ", did you mean '%hint%'?" : '.'), + Nette\Schema\Message::UnexpectedItem, + ['hint' => $hint], + )->path[] = $key; + } + } + } + + foreach ($items as $itemKey => $itemVal) { + $context->path[] = $itemKey; + if (array_key_exists($itemKey, $value)) { + $value[$itemKey] = $itemVal->complete($value[$itemKey], $context); + } else { + $default = $itemVal->completeDefault($context); // checks required item + if (!$context->skipDefaults && !$this->skipDefaults) { + $value[$itemKey] = $default; + } + } + + array_pop($context->path); + } + } + + + public function completeDefault(Context $context): mixed + { + return $this->required + ? $this->complete([], $context) + : null; + } +} diff --git a/vendor/nette/schema/src/Schema/Elements/Type.php b/vendor/nette/schema/src/Schema/Elements/Type.php new file mode 100644 index 00000000..4094442e --- /dev/null +++ b/vendor/nette/schema/src/Schema/Elements/Type.php @@ -0,0 +1,208 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Schema\Elements; + +use Nette\Schema\Context; +use Nette\Schema\DynamicParameter; +use Nette\Schema\Helpers; +use Nette\Schema\Schema; + + +final class Type implements Schema +{ + use Base; + + private string $type; + private ?Schema $itemsValue = null; + private ?Schema $itemsKey = null; + + /** @var array{?float, ?float} */ + private array $range = [null, null]; + private ?string $pattern = null; + private bool $merge = true; + + + public function __construct(string $type) + { + $defaults = ['list' => [], 'array' => []]; + $this->type = $type; + $this->default = strpos($type, '[]') ? [] : $defaults[$type] ?? null; + } + + + public function nullable(): self + { + $this->type = 'null|' . $this->type; + return $this; + } + + + public function mergeDefaults(bool $state = true): self + { + $this->merge = $state; + return $this; + } + + + public function dynamic(): self + { + $this->type = DynamicParameter::class . '|' . $this->type; + return $this; + } + + + public function min(?float $min): self + { + $this->range[0] = $min; + return $this; + } + + + public function max(?float $max): self + { + $this->range[1] = $max; + return $this; + } + + + /** + * @internal use arrayOf() or listOf() + */ + public function items(string|Schema $valueType = 'mixed', string|Schema $keyType = null): self + { + $this->itemsValue = $valueType instanceof Schema + ? $valueType + : new self($valueType); + $this->itemsKey = $keyType instanceof Schema || $keyType === null + ? $keyType + : new self($keyType); + return $this; + } + + + public function pattern(?string $pattern): self + { + $this->pattern = $pattern; + return $this; + } + + + /********************* processing ****************d*g**/ + + + public function normalize(mixed $value, Context $context): mixed + { + if ($prevent = (is_array($value) && isset($value[Helpers::PreventMerging]))) { + unset($value[Helpers::PreventMerging]); + } + + $value = $this->doNormalize($value, $context); + if (is_array($value) && $this->itemsValue) { + $res = []; + foreach ($value as $key => $val) { + $context->path[] = $key; + $context->isKey = true; + $key = $this->itemsKey + ? $this->itemsKey->normalize($key, $context) + : $key; + $context->isKey = false; + $res[$key] = $this->itemsValue->normalize($val, $context); + array_pop($context->path); + } + + $value = $res; + } + + if ($prevent && is_array($value)) { + $value[Helpers::PreventMerging] = true; + } + + return $value; + } + + + public function merge(mixed $value, mixed $base): mixed + { + if (is_array($value) && isset($value[Helpers::PreventMerging])) { + unset($value[Helpers::PreventMerging]); + return $value; + } + + if (is_array($value) && is_array($base) && $this->itemsValue) { + $index = 0; + foreach ($value as $key => $val) { + if ($key === $index) { + $base[] = $val; + $index++; + } else { + $base[$key] = array_key_exists($key, $base) + ? $this->itemsValue->merge($val, $base[$key]) + : $val; + } + } + + return $base; + } + + return Helpers::merge($value, $base); + } + + + public function complete(mixed $value, Context $context): mixed + { + $merge = $this->merge; + if (is_array($value) && isset($value[Helpers::PreventMerging])) { + unset($value[Helpers::PreventMerging]); + $merge = false; + } + + if ($value === null && is_array($this->default)) { + $value = []; // is unable to distinguish null from array in NEON + } + + $this->doDeprecation($context); + + $isOk = $context->createChecker(); + Helpers::validateType($value, $this->type, $context); + $isOk() && Helpers::validateRange($value, $this->range, $context, $this->type); + $isOk() && $value !== null && $this->pattern !== null && Helpers::validatePattern($value, $this->pattern, $context); + $isOk() && is_array($value) && $this->validateItems($value, $context); + $isOk() && $merge && $value = Helpers::merge($value, $this->default); + $isOk() && $value = $this->doTransform($value, $context); + if (!$isOk()) { + return null; + } + + if ($value instanceof DynamicParameter) { + $expected = $this->type . ($this->range === [null, null] ? '' : ':' . implode('..', $this->range)); + $context->dynamics[] = [$value, str_replace(DynamicParameter::class . '|', '', $expected), $context->path]; + } + return $value; + } + + + private function validateItems(array &$value, Context $context): void + { + if (!$this->itemsValue) { + return; + } + + $res = []; + foreach ($value as $key => $val) { + $context->path[] = $key; + $context->isKey = true; + $key = $this->itemsKey ? $this->itemsKey->complete($key, $context) : $key; + $context->isKey = false; + $res[$key] = $this->itemsValue->complete($val, $context); + array_pop($context->path); + } + $value = $res; + } +} diff --git a/vendor/nette/schema/src/Schema/Expect.php b/vendor/nette/schema/src/Schema/Expect.php new file mode 100644 index 00000000..38f1c81f --- /dev/null +++ b/vendor/nette/schema/src/Schema/Expect.php @@ -0,0 +1,108 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Schema; + +use Nette; +use Nette\Schema\Elements\AnyOf; +use Nette\Schema\Elements\Structure; +use Nette\Schema\Elements\Type; + + +/** + * Schema generator. + * + * @method static Type scalar($default = null) + * @method static Type string($default = null) + * @method static Type int($default = null) + * @method static Type float($default = null) + * @method static Type bool($default = null) + * @method static Type null() + * @method static Type array($default = []) + * @method static Type list($default = []) + * @method static Type mixed($default = null) + * @method static Type email($default = null) + * @method static Type unicode($default = null) + */ +final class Expect +{ + public static function __callStatic(string $name, array $args): Type + { + $type = new Type($name); + if ($args) { + $type->default($args[0]); + } + + return $type; + } + + + public static function type(string $type): Type + { + return new Type($type); + } + + + public static function anyOf(mixed ...$set): AnyOf + { + return new AnyOf(...$set); + } + + + /** + * @param Schema[] $items + */ + public static function structure(array $items): Structure + { + return new Structure($items); + } + + + public static function from(object $object, array $items = []): Structure + { + $ro = new \ReflectionObject($object); + $props = $ro->hasMethod('__construct') + ? $ro->getMethod('__construct')->getParameters() + : $ro->getProperties(); + + foreach ($props as $prop) { + $item = &$items[$prop->getName()]; + if (!$item) { + $type = Helpers::getPropertyType($prop) ?? 'mixed'; + $item = new Type($type); + if ($prop instanceof \ReflectionProperty ? $prop->isInitialized($object) : $prop->isOptional()) { + $def = ($prop instanceof \ReflectionProperty ? $prop->getValue($object) : $prop->getDefaultValue()); + if (is_object($def)) { + $item = static::from($def); + } elseif ($def === null && !Nette\Utils\Validators::is(null, $type)) { + $item->required(); + } else { + $item->default($def); + } + } else { + $item->required(); + } + } + } + + return (new Structure($items))->castTo($ro->getName()); + } + + + public static function arrayOf(string|Schema $valueType, string|Schema $keyType = null): Type + { + return (new Type('array'))->items($valueType, $keyType); + } + + + public static function listOf(string|Schema $type): Type + { + return (new Type('list'))->items($type); + } +} diff --git a/vendor/nette/schema/src/Schema/Helpers.php b/vendor/nette/schema/src/Schema/Helpers.php new file mode 100644 index 00000000..70bf1836 --- /dev/null +++ b/vendor/nette/schema/src/Schema/Helpers.php @@ -0,0 +1,183 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Schema; + +use Nette; +use Nette\Utils\Reflection; + + +/** + * @internal + */ +final class Helpers +{ + use Nette\StaticClass; + + public const PreventMerging = '_prevent_merging'; + + + /** + * Merges dataset. Left has higher priority than right one. + */ + public static function merge(mixed $value, mixed $base): mixed + { + if (is_array($value) && isset($value[self::PreventMerging])) { + unset($value[self::PreventMerging]); + return $value; + } + + if (is_array($value) && is_array($base)) { + $index = 0; + foreach ($value as $key => $val) { + if ($key === $index) { + $base[] = $val; + $index++; + } else { + $base[$key] = static::merge($val, $base[$key] ?? null); + } + } + + return $base; + + } elseif ($value === null && is_array($base)) { + return $base; + + } else { + return $value; + } + } + + + public static function getPropertyType(\ReflectionProperty|\ReflectionParameter $prop): ?string + { + if ($type = Nette\Utils\Type::fromReflection($prop)) { + return (string) $type; + } elseif ( + ($prop instanceof \ReflectionProperty) + && ($type = preg_replace('#\s.*#', '', (string) self::parseAnnotation($prop, 'var'))) + ) { + $class = Reflection::getPropertyDeclaringClass($prop); + return preg_replace_callback('#[\w\\\\]+#', fn($m) => Reflection::expandClassName($m[0], $class), $type); + } + + return null; + } + + + /** + * Returns an annotation value. + * @param \ReflectionProperty $ref + */ + public static function parseAnnotation(\Reflector $ref, string $name): ?string + { + if (!Reflection::areCommentsAvailable()) { + throw new Nette\InvalidStateException('You have to enable phpDoc comments in opcode cache.'); + } + + $re = '#[\s*]@' . preg_quote($name, '#') . '(?=\s|$)(?:[ \t]+([^@\s]\S*))?#'; + if ($ref->getDocComment() && preg_match($re, trim($ref->getDocComment(), '/*'), $m)) { + return $m[1] ?? ''; + } + + return null; + } + + + public static function formatValue(mixed $value): string + { + if ($value instanceof DynamicParameter) { + return 'dynamic'; + } elseif (is_object($value)) { + return 'object ' . $value::class; + } elseif (is_string($value)) { + return "'" . Nette\Utils\Strings::truncate($value, 15, '...') . "'"; + } elseif (is_scalar($value)) { + return var_export($value, return: true); + } else { + return get_debug_type($value); + } + } + + + public static function validateType(mixed $value, string $expected, Context $context): void + { + if (!Nette\Utils\Validators::is($value, $expected)) { + $expected = str_replace(DynamicParameter::class . '|', '', $expected); + $expected = str_replace(['|', ':'], [' or ', ' in range '], $expected); + $context->addError( + 'The %label% %path% expects to be %expected%, %value% given.', + Message::TypeMismatch, + ['value' => $value, 'expected' => $expected], + ); + } + } + + + public static function validateRange(mixed $value, array $range, Context $context, string $types = ''): void + { + if (is_array($value) || is_string($value)) { + [$length, $label] = is_array($value) + ? [count($value), 'items'] + : (in_array('unicode', explode('|', $types), true) + ? [Nette\Utils\Strings::length($value), 'characters'] + : [strlen($value), 'bytes']); + + if (!self::isInRange($length, $range)) { + $context->addError( + "The length of %label% %path% expects to be in range %expected%, %length% $label given.", + Message::LengthOutOfRange, + ['value' => $value, 'length' => $length, 'expected' => implode('..', $range)], + ); + } + } elseif ((is_int($value) || is_float($value)) && !self::isInRange($value, $range)) { + $context->addError( + 'The %label% %path% expects to be in range %expected%, %value% given.', + Message::ValueOutOfRange, + ['value' => $value, 'expected' => implode('..', $range)], + ); + } + } + + + public static function isInRange(mixed $value, array $range): bool + { + return ($range[0] === null || $value >= $range[0]) + && ($range[1] === null || $value <= $range[1]); + } + + + public static function validatePattern(string $value, string $pattern, Context $context): void + { + if (!preg_match("\x01^(?:$pattern)$\x01Du", $value)) { + $context->addError( + "The %label% %path% expects to match pattern '%pattern%', %value% given.", + Message::PatternMismatch, + ['value' => $value, 'pattern' => $pattern], + ); + } + } + + + public static function getCastStrategy(string $type): \Closure + { + if (Nette\Utils\Reflection::isBuiltinType($type)) { + return static function ($value) use ($type) { + settype($value, $type); + return $value; + }; + } elseif (method_exists($type, '__construct')) { + return static fn($value) => is_array($value) || $value instanceof \stdClass + ? new $type(...(array) $value) + : new $type($value); + } else { + return static fn($value) => Nette\Utils\Arrays::toObject((array) $value, new $type); + } + } +} diff --git a/vendor/nette/schema/src/Schema/Message.php b/vendor/nette/schema/src/Schema/Message.php new file mode 100644 index 00000000..4e976d03 --- /dev/null +++ b/vendor/nette/schema/src/Schema/Message.php @@ -0,0 +1,98 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Schema; + +use Nette; + + +final class Message +{ + /** variables: {value: mixed, expected: string} */ + public const TypeMismatch = 'schema.typeMismatch'; + + /** variables: {value: mixed, expected: string} */ + public const ValueOutOfRange = 'schema.valueOutOfRange'; + + /** variables: {value: mixed, length: int, expected: string} */ + public const LengthOutOfRange = 'schema.lengthOutOfRange'; + + /** variables: {value: string, pattern: string} */ + public const PatternMismatch = 'schema.patternMismatch'; + + /** variables: {value: mixed, assertion: string} */ + public const FailedAssertion = 'schema.failedAssertion'; + + /** no variables */ + public const MissingItem = 'schema.missingItem'; + + /** variables: {hint: string} */ + public const UnexpectedItem = 'schema.unexpectedItem'; + + /** no variables */ + public const Deprecated = 'schema.deprecated'; + + /** @deprecated use Message::TypeMismatch */ + public const TYPE_MISMATCH = self::TypeMismatch; + + /** @deprecated use Message::ValueOutOfRange */ + public const VALUE_OUT_OF_RANGE = self::ValueOutOfRange; + + /** @deprecated use Message::LengthOutOfRange */ + public const LENGTH_OUT_OF_RANGE = self::LengthOutOfRange; + + /** @deprecated use Message::PatternMismatch */ + public const PATTERN_MISMATCH = self::PatternMismatch; + + /** @deprecated use Message::FailedAssertion */ + public const FAILED_ASSERTION = self::FailedAssertion; + + /** @deprecated use Message::MissingItem */ + public const MISSING_ITEM = self::MissingItem; + + /** @deprecated use Message::UnexpectedItem */ + public const UNEXPECTED_ITEM = self::UnexpectedItem; + + /** @deprecated use Message::Deprecated */ + public const DEPRECATED = self::Deprecated; + + public string $message; + public string $code; + + /** @var string[] */ + public array $path; + + /** @var string[] */ + public array $variables; + + + public function __construct(string $message, string $code, array $path, array $variables = []) + { + $this->message = $message; + $this->code = $code; + $this->path = $path; + $this->variables = $variables; + } + + + public function toString(): string + { + $vars = $this->variables; + $vars['label'] = empty($vars['isKey']) ? 'item' : 'key of item'; + $vars['path'] = $this->path + ? "'" . implode("\u{a0}›\u{a0}", $this->path) . "'" + : null; + $vars['value'] = Helpers::formatValue($vars['value'] ?? null); + + return preg_replace_callback('~( ?)%(\w+)%~', function ($m) use ($vars) { + [, $space, $key] = $m; + return $vars[$key] === null ? '' : $space . $vars[$key]; + }, $this->message) ?? throw new Nette\InvalidStateException(preg_last_error_msg()); + } +} diff --git a/vendor/nette/schema/src/Schema/Processor.php b/vendor/nette/schema/src/Schema/Processor.php new file mode 100644 index 00000000..3290ba60 --- /dev/null +++ b/vendor/nette/schema/src/Schema/Processor.php @@ -0,0 +1,96 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Schema; + +use Nette; + + +/** + * Schema validator. + */ +final class Processor +{ + public array $onNewContext = []; + private Context $context; + private bool $skipDefaults = false; + + + public function skipDefaults(bool $value = true): void + { + $this->skipDefaults = $value; + } + + + /** + * Normalizes and validates data. Result is a clean completed data. + * @throws ValidationException + */ + public function process(Schema $schema, mixed $data): mixed + { + $this->createContext(); + $data = $schema->normalize($data, $this->context); + $this->throwsErrors(); + $data = $schema->complete($data, $this->context); + $this->throwsErrors(); + return $data; + } + + + /** + * Normalizes and validates and merges multiple data. Result is a clean completed data. + * @throws ValidationException + */ + public function processMultiple(Schema $schema, array $dataset): mixed + { + $this->createContext(); + $flatten = null; + $first = true; + foreach ($dataset as $data) { + $data = $schema->normalize($data, $this->context); + $this->throwsErrors(); + $flatten = $first ? $data : $schema->merge($data, $flatten); + $first = false; + } + + $data = $schema->complete($flatten, $this->context); + $this->throwsErrors(); + return $data; + } + + + /** + * @return string[] + */ + public function getWarnings(): array + { + $res = []; + foreach ($this->context->warnings as $message) { + $res[] = $message->toString(); + } + + return $res; + } + + + private function throwsErrors(): void + { + if ($this->context->errors) { + throw new ValidationException(null, $this->context->errors); + } + } + + + private function createContext(): void + { + $this->context = new Context; + $this->context->skipDefaults = $this->skipDefaults; + Nette\Utils\Arrays::invoke($this->onNewContext, $this->context); + } +} diff --git a/vendor/nette/schema/src/Schema/Schema.php b/vendor/nette/schema/src/Schema/Schema.php new file mode 100644 index 00000000..3ded7698 --- /dev/null +++ b/vendor/nette/schema/src/Schema/Schema.php @@ -0,0 +1,37 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Schema; + + +interface Schema +{ + /** + * Normalization. + * @return mixed + */ + function normalize(mixed $value, Context $context); + + /** + * Merging. + * @return mixed + */ + function merge(mixed $value, mixed $base); + + /** + * Validation and finalization. + * @return mixed + */ + function complete(mixed $value, Context $context); + + /** + * @return mixed + */ + function completeDefault(Context $context); +} diff --git a/vendor/nette/schema/src/Schema/ValidationException.php b/vendor/nette/schema/src/Schema/ValidationException.php new file mode 100644 index 00000000..caae0be4 --- /dev/null +++ b/vendor/nette/schema/src/Schema/ValidationException.php @@ -0,0 +1,55 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Schema; + +use Nette; + + +/** + * Validation error. + */ +class ValidationException extends Nette\InvalidStateException +{ + /** @var Message[] */ + private array $messages; + + + /** + * @param Message[] $messages + */ + public function __construct(?string $message, array $messages = []) + { + parent::__construct($message ?: $messages[0]->toString()); + $this->messages = $messages; + } + + + /** + * @return string[] + */ + public function getMessages(): array + { + $res = []; + foreach ($this->messages as $message) { + $res[] = $message->toString(); + } + + return $res; + } + + + /** + * @return Message[] + */ + public function getMessageObjects(): array + { + return $this->messages; + } +} diff --git a/vendor/nette/utils/.phpstorm.meta.php b/vendor/nette/utils/.phpstorm.meta.php new file mode 100644 index 00000000..25851af6 --- /dev/null +++ b/vendor/nette/utils/.phpstorm.meta.php @@ -0,0 +1,13 @@ +<?php + +declare(strict_types=1); + +namespace PHPSTORM_META; + +override(\Nette\Utils\Arrays::get(0), elementType(0)); +override(\Nette\Utils\Arrays::getRef(0), elementType(0)); +override(\Nette\Utils\Arrays::grep(0), type(0)); +override(\Nette\Utils\Arrays::toObject(0), type(1)); + +expectedArguments(\Nette\Utils\Image::resize(), 2, \Nette\Utils\Image::ShrinkOnly, \Nette\Utils\Image::Stretch, \Nette\Utils\Image::OrSmaller, \Nette\Utils\Image::OrBigger, \Nette\Utils\Image::Cover); +expectedArguments(\Nette\Utils\Image::calculateSize(), 4, \Nette\Utils\Image::ShrinkOnly, \Nette\Utils\Image::Stretch, \Nette\Utils\Image::OrSmaller, \Nette\Utils\Image::OrBigger, \Nette\Utils\Image::Cover); diff --git a/vendor/nette/utils/composer.json b/vendor/nette/utils/composer.json new file mode 100644 index 00000000..74bd6183 --- /dev/null +++ b/vendor/nette/utils/composer.json @@ -0,0 +1,51 @@ +{ + "name": "nette/utils", + "description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", + "keywords": ["nette", "images", "json", "password", "validation", "utility", "string", "array", "core", "slugify", "utf-8", "unicode", "paginator", "datetime"], + "homepage": "https://nette.org", + "license": ["BSD-3-Clause", "GPL-2.0-only", "GPL-3.0-only"], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "require": { + "php": "8.0 - 8.4" + }, + "require-dev": { + "nette/tester": "^2.5", + "tracy/tracy": "^2.9", + "phpstan/phpstan": "^1.0", + "jetbrains/phpstorm-attributes": "dev-master" + }, + "conflict": { + "nette/finder": "<3", + "nette/schema": "<1.2.2" + }, + "suggest": { + "ext-iconv": "to use Strings::webalize(), toAscii(), chr() and reverse()", + "ext-json": "to use Nette\\Utils\\Json", + "ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()", + "ext-mbstring": "to use Strings::lower() etc...", + "ext-gd": "to use Image", + "ext-tokenizer": "to use Nette\\Utils\\Reflection::getUseStatements()" + }, + "autoload": { + "classmap": ["src/"] + }, + "minimum-stability": "dev", + "scripts": { + "phpstan": "phpstan analyse", + "tester": "tester tests -s" + }, + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + } +} diff --git a/vendor/nette/utils/license.md b/vendor/nette/utils/license.md new file mode 100644 index 00000000..cf741bd0 --- /dev/null +++ b/vendor/nette/utils/license.md @@ -0,0 +1,60 @@ +Licenses +======== + +Good news! You may use Nette Framework under the terms of either +the New BSD License or the GNU General Public License (GPL) version 2 or 3. + +The BSD License is recommended for most projects. It is easy to understand and it +places almost no restrictions on what you can do with the framework. If the GPL +fits better to your project, you can use the framework under this license. + +You don't have to notify anyone which license you are using. You can freely +use Nette Framework in commercial projects as long as the copyright header +remains intact. + +Please be advised that the name "Nette Framework" is a protected trademark and its +usage has some limitations. So please do not use word "Nette" in the name of your +project or top-level domain, and choose a name that stands on its own merits. +If your stuff is good, it will not take long to establish a reputation for yourselves. + + +New BSD License +--------------- + +Copyright (c) 2004, 2014 David Grudl (https://davidgrudl.com) +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of "Nette Framework" nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +This software is provided by the copyright holders and contributors "as is" and +any express or implied warranties, including, but not limited to, the implied +warranties of merchantability and fitness for a particular purpose are +disclaimed. In no event shall the copyright owner or contributors be liable for +any direct, indirect, incidental, special, exemplary, or consequential damages +(including, but not limited to, procurement of substitute goods or services; +loss of use, data, or profits; or business interruption) however caused and on +any theory of liability, whether in contract, strict liability, or tort +(including negligence or otherwise) arising in any way out of the use of this +software, even if advised of the possibility of such damage. + + +GNU General Public License +-------------------------- + +GPL licenses are very very long, so instead of including them here we offer +you URLs with full text: + +- [GPL version 2](http://www.gnu.org/licenses/gpl-2.0.html) +- [GPL version 3](http://www.gnu.org/licenses/gpl-3.0.html) diff --git a/vendor/nette/utils/readme.md b/vendor/nette/utils/readme.md new file mode 100644 index 00000000..0038f534 --- /dev/null +++ b/vendor/nette/utils/readme.md @@ -0,0 +1,55 @@ +[![Nette Utils](https://github.com/nette/utils/assets/194960/c33fdb74-0652-4cad-ac6e-c1ce0d29e32a)](https://doc.nette.org/en/utils) + +[![Downloads this Month](https://img.shields.io/packagist/dm/nette/utils.svg)](https://packagist.org/packages/nette/utils) +[![Tests](https://github.com/nette/utils/workflows/Tests/badge.svg?branch=master)](https://github.com/nette/utils/actions) +[![Coverage Status](https://coveralls.io/repos/github/nette/utils/badge.svg?branch=master)](https://coveralls.io/github/nette/utils?branch=master) +[![Latest Stable Version](https://poser.pugx.org/nette/utils/v/stable)](https://github.com/nette/utils/releases) +[![License](https://img.shields.io/badge/license-New%20BSD-blue.svg)](https://github.com/nette/utils/blob/master/license.md) + + +Introduction +------------ + +In package nette/utils you will find a set of useful classes for everyday use: + +✅ [Arrays](https://doc.nette.org/utils/arrays)<br> +✅ [Callback](https://doc.nette.org/utils/callback) - PHP callbacks<br> +✅ [Filesystem](https://doc.nette.org/utils/filesystem) - copying, renaming, …<br> +✅ [Finder](https://doc.nette.org/utils/finder) - finds files and directories<br> +✅ [Floats](https://doc.nette.org/utils/floats) - floating point numbers<br> +✅ [Helper Functions](https://doc.nette.org/utils/helpers)<br> +✅ [HTML elements](https://doc.nette.org/utils/html-elements) - generate HTML<br> +✅ [Images](https://doc.nette.org/utils/images) - crop, resize, rotate images<br> +✅ [Iterables](https://doc.nette.org/utils/iterables) <br> +✅ [JSON](https://doc.nette.org/utils/json) - encoding and decoding<br> +✅ [Generating Random Strings](https://doc.nette.org/utils/random)<br> +✅ [Paginator](https://doc.nette.org/utils/paginator) - pagination math<br> +✅ [PHP Reflection](https://doc.nette.org/utils/reflection)<br> +✅ [Strings](https://doc.nette.org/utils/strings) - useful text functions<br> +✅ [SmartObject](https://doc.nette.org/utils/smartobject) - PHP object enhancements<br> +✅ [Type](https://doc.nette.org/utils/type) - PHP data type<br> +✅ [Validation](https://doc.nette.org/utils/validators) - validate inputs<br> + + <!----> + +Installation +------------ + +The recommended way to install is via Composer: + +``` +composer require nette/utils +``` + +Nette Utils 4.0 is compatible with PHP 8.0 to 8.4. + + <!----> + +[Support Me](https://github.com/sponsors/dg) +-------------------------------------------- + +Do you like Nette Utils? Are you looking forward to the new features? + +[![Buy me a coffee](https://files.nette.org/icons/donation-3.svg)](https://github.com/sponsors/dg) + +Thank you! diff --git a/vendor/nette/utils/src/HtmlStringable.php b/vendor/nette/utils/src/HtmlStringable.php new file mode 100644 index 00000000..d749d4ee --- /dev/null +++ b/vendor/nette/utils/src/HtmlStringable.php @@ -0,0 +1,22 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette; + + +interface HtmlStringable +{ + /** + * Returns string in HTML format + */ + function __toString(): string; +} + + +interface_exists(Utils\IHtmlString::class); diff --git a/vendor/nette/utils/src/Iterators/CachingIterator.php b/vendor/nette/utils/src/Iterators/CachingIterator.php new file mode 100644 index 00000000..02bd7407 --- /dev/null +++ b/vendor/nette/utils/src/Iterators/CachingIterator.php @@ -0,0 +1,150 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Iterators; + +use Nette; + + +/** + * Smarter caching iterator. + * + * @property-read bool $first + * @property-read bool $last + * @property-read bool $empty + * @property-read bool $odd + * @property-read bool $even + * @property-read int $counter + * @property-read mixed $nextKey + * @property-read mixed $nextValue + */ +class CachingIterator extends \CachingIterator implements \Countable +{ + use Nette\SmartObject; + + private int $counter = 0; + + + public function __construct(iterable|\stdClass $iterable) + { + $iterable = $iterable instanceof \stdClass + ? new \ArrayIterator($iterable) + : Nette\Utils\Iterables::toIterator($iterable); + parent::__construct($iterable, 0); + } + + + /** + * Is the current element the first one? + */ + public function isFirst(?int $gridWidth = null): bool + { + return $this->counter === 1 || ($gridWidth && $this->counter !== 0 && (($this->counter - 1) % $gridWidth) === 0); + } + + + /** + * Is the current element the last one? + */ + public function isLast(?int $gridWidth = null): bool + { + return !$this->hasNext() || ($gridWidth && ($this->counter % $gridWidth) === 0); + } + + + /** + * Is the iterator empty? + */ + public function isEmpty(): bool + { + return $this->counter === 0; + } + + + /** + * Is the counter odd? + */ + public function isOdd(): bool + { + return $this->counter % 2 === 1; + } + + + /** + * Is the counter even? + */ + public function isEven(): bool + { + return $this->counter % 2 === 0; + } + + + /** + * Returns the counter. + */ + public function getCounter(): int + { + return $this->counter; + } + + + /** + * Returns the count of elements. + */ + public function count(): int + { + $inner = $this->getInnerIterator(); + if ($inner instanceof \Countable) { + return $inner->count(); + + } else { + throw new Nette\NotSupportedException('Iterator is not countable.'); + } + } + + + /** + * Forwards to the next element. + */ + public function next(): void + { + parent::next(); + if (parent::valid()) { + $this->counter++; + } + } + + + /** + * Rewinds the Iterator. + */ + public function rewind(): void + { + parent::rewind(); + $this->counter = parent::valid() ? 1 : 0; + } + + + /** + * Returns the next key. + */ + public function getNextKey(): mixed + { + return $this->getInnerIterator()->key(); + } + + + /** + * Returns the next element. + */ + public function getNextValue(): mixed + { + return $this->getInnerIterator()->current(); + } +} diff --git a/vendor/nette/utils/src/Iterators/Mapper.php b/vendor/nette/utils/src/Iterators/Mapper.php new file mode 100644 index 00000000..284da29d --- /dev/null +++ b/vendor/nette/utils/src/Iterators/Mapper.php @@ -0,0 +1,33 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Iterators; + + +/** + * @deprecated use Nette\Utils\Iterables::map() + */ +class Mapper extends \IteratorIterator +{ + /** @var callable */ + private $callback; + + + public function __construct(\Traversable $iterator, callable $callback) + { + parent::__construct($iterator); + $this->callback = $callback; + } + + + public function current(): mixed + { + return ($this->callback)(parent::current(), parent::key()); + } +} diff --git a/vendor/nette/utils/src/SmartObject.php b/vendor/nette/utils/src/SmartObject.php new file mode 100644 index 00000000..3b2203f1 --- /dev/null +++ b/vendor/nette/utils/src/SmartObject.php @@ -0,0 +1,140 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette; + +use Nette\Utils\ObjectHelpers; + + +/** + * Strict class for better experience. + * - 'did you mean' hints + * - access to undeclared members throws exceptions + * - support for @property annotations + * - support for calling event handlers stored in $onEvent via onEvent() + */ +trait SmartObject +{ + /** + * @return mixed + * @throws MemberAccessException + */ + public function __call(string $name, array $args) + { + $class = static::class; + + if (ObjectHelpers::hasProperty($class, $name) === 'event') { // calling event handlers + $handlers = $this->$name ?? null; + if (is_iterable($handlers)) { + foreach ($handlers as $handler) { + $handler(...$args); + } + } elseif ($handlers !== null) { + throw new UnexpectedValueException("Property $class::$$name must be iterable or null, " . get_debug_type($handlers) . ' given.'); + } + + return null; + } + + ObjectHelpers::strictCall($class, $name); + } + + + /** + * @throws MemberAccessException + */ + public static function __callStatic(string $name, array $args) + { + ObjectHelpers::strictStaticCall(static::class, $name); + } + + + /** + * @return mixed + * @throws MemberAccessException if the property is not defined. + */ + public function &__get(string $name) + { + $class = static::class; + + if ($prop = ObjectHelpers::getMagicProperties($class)[$name] ?? null) { // property getter + if (!($prop & 0b0001)) { + throw new MemberAccessException("Cannot read a write-only property $class::\$$name."); + } + + $m = ($prop & 0b0010 ? 'get' : 'is') . ucfirst($name); + if ($prop & 0b10000) { + $trace = debug_backtrace(0, 1)[0]; // suppose this method is called from __call() + $loc = isset($trace['file'], $trace['line']) + ? " in $trace[file] on line $trace[line]" + : ''; + trigger_error("Property $class::\$$name is deprecated, use $class::$m() method$loc.", E_USER_DEPRECATED); + } + + if ($prop & 0b0100) { // return by reference + return $this->$m(); + } else { + $val = $this->$m(); + return $val; + } + } else { + ObjectHelpers::strictGet($class, $name); + } + } + + + /** + * @throws MemberAccessException if the property is not defined or is read-only + */ + public function __set(string $name, mixed $value): void + { + $class = static::class; + + if (ObjectHelpers::hasProperty($class, $name)) { // unsetted property + $this->$name = $value; + + } elseif ($prop = ObjectHelpers::getMagicProperties($class)[$name] ?? null) { // property setter + if (!($prop & 0b1000)) { + throw new MemberAccessException("Cannot write to a read-only property $class::\$$name."); + } + + $m = 'set' . ucfirst($name); + if ($prop & 0b10000) { + $trace = debug_backtrace(0, 1)[0]; // suppose this method is called from __call() + $loc = isset($trace['file'], $trace['line']) + ? " in $trace[file] on line $trace[line]" + : ''; + trigger_error("Property $class::\$$name is deprecated, use $class::$m() method$loc.", E_USER_DEPRECATED); + } + + $this->$m($value); + + } else { + ObjectHelpers::strictSet($class, $name); + } + } + + + /** + * @throws MemberAccessException + */ + public function __unset(string $name): void + { + $class = static::class; + if (!ObjectHelpers::hasProperty($class, $name)) { + throw new MemberAccessException("Cannot unset the property $class::\$$name."); + } + } + + + public function __isset(string $name): bool + { + return isset(ObjectHelpers::getMagicProperties(static::class)[$name]); + } +} diff --git a/vendor/nette/utils/src/StaticClass.php b/vendor/nette/utils/src/StaticClass.php new file mode 100644 index 00000000..b1d84862 --- /dev/null +++ b/vendor/nette/utils/src/StaticClass.php @@ -0,0 +1,34 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette; + + +/** + * Static class. + */ +trait StaticClass +{ + /** + * Class is static and cannot be instantiated. + */ + private function __construct() + { + } + + + /** + * Call to undefined static method. + * @throws MemberAccessException + */ + public static function __callStatic(string $name, array $args): mixed + { + Utils\ObjectHelpers::strictStaticCall(static::class, $name); + } +} diff --git a/vendor/nette/utils/src/Translator.php b/vendor/nette/utils/src/Translator.php new file mode 100644 index 00000000..f973f5f1 --- /dev/null +++ b/vendor/nette/utils/src/Translator.php @@ -0,0 +1,25 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Localization; + + +/** + * Translator adapter. + */ +interface Translator +{ + /** + * Translates the given string. + */ + function translate(string|\Stringable $message, mixed ...$parameters): string|\Stringable; +} + + +interface_exists(ITranslator::class); diff --git a/vendor/nette/utils/src/Utils/ArrayHash.php b/vendor/nette/utils/src/Utils/ArrayHash.php new file mode 100644 index 00000000..349ffe0e --- /dev/null +++ b/vendor/nette/utils/src/Utils/ArrayHash.php @@ -0,0 +1,106 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + +use Nette; + + +/** + * Provides objects to work as array. + * @template T + * @implements \IteratorAggregate<array-key, T> + * @implements \ArrayAccess<array-key, T> + */ +class ArrayHash extends \stdClass implements \ArrayAccess, \Countable, \IteratorAggregate +{ + /** + * Transforms array to ArrayHash. + * @param array<T> $array + */ + public static function from(array $array, bool $recursive = true): static + { + $obj = new static; + foreach ($array as $key => $value) { + $obj->$key = $recursive && is_array($value) + ? static::from($value) + : $value; + } + + return $obj; + } + + + /** + * Returns an iterator over all items. + * @return \Iterator<array-key, T> + */ + public function &getIterator(): \Iterator + { + foreach ((array) $this as $key => $foo) { + yield $key => $this->$key; + } + } + + + /** + * Returns items count. + */ + public function count(): int + { + return count((array) $this); + } + + + /** + * Replaces or appends a item. + * @param array-key $key + * @param T $value + */ + public function offsetSet($key, $value): void + { + if (!is_scalar($key)) { // prevents null + throw new Nette\InvalidArgumentException(sprintf('Key must be either a string or an integer, %s given.', get_debug_type($key))); + } + + $this->$key = $value; + } + + + /** + * Returns a item. + * @param array-key $key + * @return T + */ + #[\ReturnTypeWillChange] + public function offsetGet($key) + { + return $this->$key; + } + + + /** + * Determines whether a item exists. + * @param array-key $key + */ + public function offsetExists($key): bool + { + return isset($this->$key); + } + + + /** + * Removes the element from this list. + * @param array-key $key + */ + public function offsetUnset($key): void + { + unset($this->$key); + } +} diff --git a/vendor/nette/utils/src/Utils/ArrayList.php b/vendor/nette/utils/src/Utils/ArrayList.php new file mode 100644 index 00000000..a402f9bf --- /dev/null +++ b/vendor/nette/utils/src/Utils/ArrayList.php @@ -0,0 +1,136 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + +use Nette; + + +/** + * Provides the base class for a generic list (items can be accessed by index). + * @template T + * @implements \IteratorAggregate<int, T> + * @implements \ArrayAccess<int, T> + */ +class ArrayList implements \ArrayAccess, \Countable, \IteratorAggregate +{ + use Nette\SmartObject; + + private array $list = []; + + + /** + * Transforms array to ArrayList. + * @param list<T> $array + */ + public static function from(array $array): static + { + if (!Arrays::isList($array)) { + throw new Nette\InvalidArgumentException('Array is not valid list.'); + } + + $obj = new static; + $obj->list = $array; + return $obj; + } + + + /** + * Returns an iterator over all items. + * @return \Iterator<int, T> + */ + public function &getIterator(): \Iterator + { + foreach ($this->list as &$item) { + yield $item; + } + } + + + /** + * Returns items count. + */ + public function count(): int + { + return count($this->list); + } + + + /** + * Replaces or appends a item. + * @param int|null $index + * @param T $value + * @throws Nette\OutOfRangeException + */ + public function offsetSet($index, $value): void + { + if ($index === null) { + $this->list[] = $value; + + } elseif (!is_int($index) || $index < 0 || $index >= count($this->list)) { + throw new Nette\OutOfRangeException('Offset invalid or out of range'); + + } else { + $this->list[$index] = $value; + } + } + + + /** + * Returns a item. + * @param int $index + * @return T + * @throws Nette\OutOfRangeException + */ + public function offsetGet($index): mixed + { + if (!is_int($index) || $index < 0 || $index >= count($this->list)) { + throw new Nette\OutOfRangeException('Offset invalid or out of range'); + } + + return $this->list[$index]; + } + + + /** + * Determines whether a item exists. + * @param int $index + */ + public function offsetExists($index): bool + { + return is_int($index) && $index >= 0 && $index < count($this->list); + } + + + /** + * Removes the element at the specified position in this list. + * @param int $index + * @throws Nette\OutOfRangeException + */ + public function offsetUnset($index): void + { + if (!is_int($index) || $index < 0 || $index >= count($this->list)) { + throw new Nette\OutOfRangeException('Offset invalid or out of range'); + } + + array_splice($this->list, $index, 1); + } + + + /** + * Prepends a item. + * @param T $value + */ + public function prepend(mixed $value): void + { + $first = array_slice($this->list, 0, 1); + $this->offsetSet(0, $value); + array_splice($this->list, 1, 0, $first); + } +} diff --git a/vendor/nette/utils/src/Utils/Arrays.php b/vendor/nette/utils/src/Utils/Arrays.php new file mode 100644 index 00000000..00a4a8cd --- /dev/null +++ b/vendor/nette/utils/src/Utils/Arrays.php @@ -0,0 +1,553 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + +use JetBrains\PhpStorm\Language; +use Nette; +use function is_array, is_int, is_object, count; + + +/** + * Array tools library. + */ +class Arrays +{ + use Nette\StaticClass; + + /** + * Returns item from array. If it does not exist, it throws an exception, unless a default value is set. + * @template T + * @param array<T> $array + * @param array-key|array-key[] $key + * @param ?T $default + * @return ?T + * @throws Nette\InvalidArgumentException if item does not exist and default value is not provided + */ + public static function get(array $array, string|int|array $key, mixed $default = null): mixed + { + foreach (is_array($key) ? $key : [$key] as $k) { + if (is_array($array) && array_key_exists($k, $array)) { + $array = $array[$k]; + } else { + if (func_num_args() < 3) { + throw new Nette\InvalidArgumentException("Missing item '$k'."); + } + + return $default; + } + } + + return $array; + } + + + /** + * Returns reference to array item. If the index does not exist, new one is created with value null. + * @template T + * @param array<T> $array + * @param array-key|array-key[] $key + * @return ?T + * @throws Nette\InvalidArgumentException if traversed item is not an array + */ + public static function &getRef(array &$array, string|int|array $key): mixed + { + foreach (is_array($key) ? $key : [$key] as $k) { + if (is_array($array) || $array === null) { + $array = &$array[$k]; + } else { + throw new Nette\InvalidArgumentException('Traversed item is not an array.'); + } + } + + return $array; + } + + + /** + * Recursively merges two fields. It is useful, for example, for merging tree structures. It behaves as + * the + operator for array, ie. it adds a key/value pair from the second array to the first one and retains + * the value from the first array in the case of a key collision. + * @template T1 + * @template T2 + * @param array<T1> $array1 + * @param array<T2> $array2 + * @return array<T1|T2> + */ + public static function mergeTree(array $array1, array $array2): array + { + $res = $array1 + $array2; + foreach (array_intersect_key($array1, $array2) as $k => $v) { + if (is_array($v) && is_array($array2[$k])) { + $res[$k] = self::mergeTree($v, $array2[$k]); + } + } + + return $res; + } + + + /** + * Returns zero-indexed position of given array key. Returns null if key is not found. + */ + public static function getKeyOffset(array $array, string|int $key): ?int + { + return Helpers::falseToNull(array_search(self::toKey($key), array_keys($array), strict: true)); + } + + + /** + * @deprecated use getKeyOffset() + */ + public static function searchKey(array $array, $key): ?int + { + return self::getKeyOffset($array, $key); + } + + + /** + * Tests an array for the presence of value. + */ + public static function contains(array $array, mixed $value): bool + { + return in_array($value, $array, true); + } + + + /** + * Returns the first item (matching the specified predicate if given). If there is no such item, it returns result of invoking $else or null. + * @template K of int|string + * @template V + * @param array<K, V> $array + * @param ?callable(V, K, array<K, V>): bool $predicate + * @return ?V + */ + public static function first(array $array, ?callable $predicate = null, ?callable $else = null): mixed + { + $key = self::firstKey($array, $predicate); + return $key === null + ? ($else ? $else() : null) + : $array[$key]; + } + + + /** + * Returns the last item (matching the specified predicate if given). If there is no such item, it returns result of invoking $else or null. + * @template K of int|string + * @template V + * @param array<K, V> $array + * @param ?callable(V, K, array<K, V>): bool $predicate + * @return ?V + */ + public static function last(array $array, ?callable $predicate = null, ?callable $else = null): mixed + { + $key = self::lastKey($array, $predicate); + return $key === null + ? ($else ? $else() : null) + : $array[$key]; + } + + + /** + * Returns the key of first item (matching the specified predicate if given) or null if there is no such item. + * @template K of int|string + * @template V + * @param array<K, V> $array + * @param ?callable(V, K, array<K, V>): bool $predicate + * @return ?K + */ + public static function firstKey(array $array, ?callable $predicate = null): int|string|null + { + if (!$predicate) { + return array_key_first($array); + } + foreach ($array as $k => $v) { + if ($predicate($v, $k, $array)) { + return $k; + } + } + return null; + } + + + /** + * Returns the key of last item (matching the specified predicate if given) or null if there is no such item. + * @template K of int|string + * @template V + * @param array<K, V> $array + * @param ?callable(V, K, array<K, V>): bool $predicate + * @return ?K + */ + public static function lastKey(array $array, ?callable $predicate = null): int|string|null + { + return $predicate + ? self::firstKey(array_reverse($array, preserve_keys: true), $predicate) + : array_key_last($array); + } + + + /** + * Inserts the contents of the $inserted array into the $array immediately after the $key. + * If $key is null (or does not exist), it is inserted at the beginning. + */ + public static function insertBefore(array &$array, string|int|null $key, array $inserted): void + { + $offset = $key === null ? 0 : (int) self::getKeyOffset($array, $key); + $array = array_slice($array, 0, $offset, preserve_keys: true) + + $inserted + + array_slice($array, $offset, count($array), preserve_keys: true); + } + + + /** + * Inserts the contents of the $inserted array into the $array before the $key. + * If $key is null (or does not exist), it is inserted at the end. + */ + public static function insertAfter(array &$array, string|int|null $key, array $inserted): void + { + if ($key === null || ($offset = self::getKeyOffset($array, $key)) === null) { + $offset = count($array) - 1; + } + + $array = array_slice($array, 0, $offset + 1, preserve_keys: true) + + $inserted + + array_slice($array, $offset + 1, count($array), preserve_keys: true); + } + + + /** + * Renames key in array. + */ + public static function renameKey(array &$array, string|int $oldKey, string|int $newKey): bool + { + $offset = self::getKeyOffset($array, $oldKey); + if ($offset === null) { + return false; + } + + $val = &$array[$oldKey]; + $keys = array_keys($array); + $keys[$offset] = $newKey; + $array = array_combine($keys, $array); + $array[$newKey] = &$val; + return true; + } + + + /** + * Returns only those array items, which matches a regular expression $pattern. + * @param string[] $array + * @return string[] + */ + public static function grep( + array $array, + #[Language('RegExp')] + string $pattern, + bool|int $invert = false, + ): array + { + $flags = $invert ? PREG_GREP_INVERT : 0; + return Strings::pcre('preg_grep', [$pattern, $array, $flags]); + } + + + /** + * Transforms multidimensional array to flat array. + */ + public static function flatten(array $array, bool $preserveKeys = false): array + { + $res = []; + $cb = $preserveKeys + ? function ($v, $k) use (&$res): void { $res[$k] = $v; } + : function ($v) use (&$res): void { $res[] = $v; }; + array_walk_recursive($array, $cb); + return $res; + } + + + /** + * Checks if the array is indexed in ascending order of numeric keys from zero, a.k.a list. + * @return ($value is list ? true : false) + */ + public static function isList(mixed $value): bool + { + return is_array($value) && (PHP_VERSION_ID < 80100 + ? !$value || array_keys($value) === range(0, count($value) - 1) + : array_is_list($value) + ); + } + + + /** + * Reformats table to associative tree. Path looks like 'field|field[]field->field=field'. + * @param string|string[] $path + */ + public static function associate(array $array, $path): array|\stdClass + { + $parts = is_array($path) + ? $path + : preg_split('#(\[\]|->|=|\|)#', $path, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); + + if (!$parts || $parts === ['->'] || $parts[0] === '=' || $parts[0] === '|') { + throw new Nette\InvalidArgumentException("Invalid path '$path'."); + } + + $res = $parts[0] === '->' ? new \stdClass : []; + + foreach ($array as $rowOrig) { + $row = (array) $rowOrig; + $x = &$res; + + for ($i = 0; $i < count($parts); $i++) { + $part = $parts[$i]; + if ($part === '[]') { + $x = &$x[]; + + } elseif ($part === '=') { + if (isset($parts[++$i])) { + $x = $row[$parts[$i]]; + $row = null; + } + } elseif ($part === '->') { + if (isset($parts[++$i])) { + if ($x === null) { + $x = new \stdClass; + } + + $x = &$x->{$row[$parts[$i]]}; + } else { + $row = is_object($rowOrig) ? $rowOrig : (object) $row; + } + } elseif ($part !== '|') { + $x = &$x[(string) $row[$part]]; + } + } + + if ($x === null) { + $x = $row; + } + } + + return $res; + } + + + /** + * Normalizes array to associative array. Replace numeric keys with their values, the new value will be $filling. + */ + public static function normalize(array $array, mixed $filling = null): array + { + $res = []; + foreach ($array as $k => $v) { + $res[is_int($k) ? $v : $k] = is_int($k) ? $filling : $v; + } + + return $res; + } + + + /** + * Returns and removes the value of an item from an array. If it does not exist, it throws an exception, + * or returns $default, if provided. + * @template T + * @param array<T> $array + * @param ?T $default + * @return ?T + * @throws Nette\InvalidArgumentException if item does not exist and default value is not provided + */ + public static function pick(array &$array, string|int $key, mixed $default = null): mixed + { + if (array_key_exists($key, $array)) { + $value = $array[$key]; + unset($array[$key]); + return $value; + + } elseif (func_num_args() < 3) { + throw new Nette\InvalidArgumentException("Missing item '$key'."); + + } else { + return $default; + } + } + + + /** + * Tests whether at least one element in the array passes the test implemented by the provided function. + * @template K of int|string + * @template V + * @param array<K, V> $array + * @param callable(V, K, array<K, V>): bool $predicate + */ + public static function some(iterable $array, callable $predicate): bool + { + foreach ($array as $k => $v) { + if ($predicate($v, $k, $array)) { + return true; + } + } + + return false; + } + + + /** + * Tests whether all elements in the array pass the test implemented by the provided function. + * @template K of int|string + * @template V + * @param array<K, V> $array + * @param callable(V, K, array<K, V>): bool $predicate + */ + public static function every(iterable $array, callable $predicate): bool + { + foreach ($array as $k => $v) { + if (!$predicate($v, $k, $array)) { + return false; + } + } + + return true; + } + + + /** + * Returns a new array containing all key-value pairs matching the given $predicate. + * @template K of int|string + * @template V + * @param array<K, V> $array + * @param callable(V, K, array<K, V>): bool $predicate + * @return array<K, V> + */ + public static function filter(array $array, callable $predicate): array + { + $res = []; + foreach ($array as $k => $v) { + if ($predicate($v, $k, $array)) { + $res[$k] = $v; + } + } + return $res; + } + + + /** + * Returns an array containing the original keys and results of applying the given transform function to each element. + * @template K of int|string + * @template V + * @template R + * @param array<K, V> $array + * @param callable(V, K, array<K, V>): R $transformer + * @return array<K, R> + */ + public static function map(iterable $array, callable $transformer): array + { + $res = []; + foreach ($array as $k => $v) { + $res[$k] = $transformer($v, $k, $array); + } + + return $res; + } + + + /** + * Returns an array containing new keys and values generated by applying the given transform function to each element. + * If the function returns null, the element is skipped. + * @template K of int|string + * @template V + * @template ResK of int|string + * @template ResV + * @param array<K, V> $array + * @param callable(V, K, array<K, V>): ?array{ResK, ResV} $transformer + * @return array<ResK, ResV> + */ + public static function mapWithKeys(array $array, callable $transformer): array + { + $res = []; + foreach ($array as $k => $v) { + $pair = $transformer($v, $k, $array); + if ($pair) { + $res[$pair[0]] = $pair[1]; + } + } + + return $res; + } + + + /** + * Invokes all callbacks and returns array of results. + * @param callable[] $callbacks + */ + public static function invoke(iterable $callbacks, ...$args): array + { + $res = []; + foreach ($callbacks as $k => $cb) { + $res[$k] = $cb(...$args); + } + + return $res; + } + + + /** + * Invokes method on every object in an array and returns array of results. + * @param object[] $objects + */ + public static function invokeMethod(iterable $objects, string $method, ...$args): array + { + $res = []; + foreach ($objects as $k => $obj) { + $res[$k] = $obj->$method(...$args); + } + + return $res; + } + + + /** + * Copies the elements of the $array array to the $object object and then returns it. + * @template T of object + * @param T $object + * @return T + */ + public static function toObject(iterable $array, object $object): object + { + foreach ($array as $k => $v) { + $object->$k = $v; + } + + return $object; + } + + + /** + * Converts value to array key. + */ + public static function toKey(mixed $value): int|string + { + return key([$value => null]); + } + + + /** + * Returns copy of the $array where every item is converted to string + * and prefixed by $prefix and suffixed by $suffix. + * @param string[] $array + * @return string[] + */ + public static function wrap(array $array, string $prefix = '', string $suffix = ''): array + { + $res = []; + foreach ($array as $k => $v) { + $res[$k] = $prefix . $v . $suffix; + } + + return $res; + } +} diff --git a/vendor/nette/utils/src/Utils/Callback.php b/vendor/nette/utils/src/Utils/Callback.php new file mode 100644 index 00000000..1777428f --- /dev/null +++ b/vendor/nette/utils/src/Utils/Callback.php @@ -0,0 +1,137 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + +use Nette; +use function is_array, is_object, is_string; + + +/** + * PHP callable tools. + */ +final class Callback +{ + use Nette\StaticClass; + + /** + * Invokes internal PHP function with own error handler. + */ + public static function invokeSafe(string $function, array $args, callable $onError): mixed + { + $prev = set_error_handler(function ($severity, $message, $file) use ($onError, &$prev, $function): ?bool { + if ($file === __FILE__) { + $msg = ini_get('html_errors') + ? Html::htmlToText($message) + : $message; + $msg = preg_replace("#^$function\\(.*?\\): #", '', $msg); + if ($onError($msg, $severity) !== false) { + return null; + } + } + + return $prev ? $prev(...func_get_args()) : false; + }); + + try { + return $function(...$args); + } finally { + restore_error_handler(); + } + } + + + /** + * Checks that $callable is valid PHP callback. Otherwise throws exception. If the $syntax is set to true, only verifies + * that $callable has a valid structure to be used as a callback, but does not verify if the class or method actually exists. + * @return callable + * @throws Nette\InvalidArgumentException + */ + public static function check(mixed $callable, bool $syntax = false) + { + if (!is_callable($callable, $syntax)) { + throw new Nette\InvalidArgumentException( + $syntax + ? 'Given value is not a callable type.' + : sprintf("Callback '%s' is not callable.", self::toString($callable)), + ); + } + + return $callable; + } + + + /** + * Converts PHP callback to textual form. Class or method may not exists. + */ + public static function toString(mixed $callable): string + { + if ($callable instanceof \Closure) { + $inner = self::unwrap($callable); + return '{closure' . ($inner instanceof \Closure ? '}' : ' ' . self::toString($inner) . '}'); + } else { + is_callable(is_object($callable) ? [$callable, '__invoke'] : $callable, true, $textual); + return $textual; + } + } + + + /** + * Returns reflection for method or function used in PHP callback. + * @param callable $callable type check is escalated to ReflectionException + * @throws \ReflectionException if callback is not valid + */ + public static function toReflection($callable): \ReflectionMethod|\ReflectionFunction + { + if ($callable instanceof \Closure) { + $callable = self::unwrap($callable); + } + + if (is_string($callable) && str_contains($callable, '::')) { + return new ReflectionMethod(...explode('::', $callable, 2)); + } elseif (is_array($callable)) { + return new ReflectionMethod($callable[0], $callable[1]); + } elseif (is_object($callable) && !$callable instanceof \Closure) { + return new ReflectionMethod($callable, '__invoke'); + } else { + return new \ReflectionFunction($callable); + } + } + + + /** + * Checks whether PHP callback is function or static method. + */ + public static function isStatic(callable $callable): bool + { + return is_string(is_array($callable) ? $callable[0] : $callable); + } + + + /** + * Unwraps closure created by Closure::fromCallable(). + */ + public static function unwrap(\Closure $closure): callable|array + { + $r = new \ReflectionFunction($closure); + $class = $r->getClosureScopeClass()?->name; + if (str_ends_with($r->name, '}')) { + return $closure; + + } elseif (($obj = $r->getClosureThis()) && $obj::class === $class) { + return [$obj, $r->name]; + + } elseif ($class) { + return [$class, $r->name]; + + } else { + return $r->name; + } + } +} diff --git a/vendor/nette/utils/src/Utils/DateTime.php b/vendor/nette/utils/src/Utils/DateTime.php new file mode 100644 index 00000000..6ad65205 --- /dev/null +++ b/vendor/nette/utils/src/Utils/DateTime.php @@ -0,0 +1,140 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + +use Nette; + + +/** + * DateTime. + */ +class DateTime extends \DateTime implements \JsonSerializable +{ + use Nette\SmartObject; + + /** minute in seconds */ + public const MINUTE = 60; + + /** hour in seconds */ + public const HOUR = 60 * self::MINUTE; + + /** day in seconds */ + public const DAY = 24 * self::HOUR; + + /** week in seconds */ + public const WEEK = 7 * self::DAY; + + /** average month in seconds */ + public const MONTH = 2_629_800; + + /** average year in seconds */ + public const YEAR = 31_557_600; + + + /** + * Creates a DateTime object from a string, UNIX timestamp, or other DateTimeInterface object. + * @throws \Exception if the date and time are not valid. + */ + public static function from(string|int|\DateTimeInterface|null $time): static + { + if ($time instanceof \DateTimeInterface) { + return new static($time->format('Y-m-d H:i:s.u'), $time->getTimezone()); + + } elseif (is_numeric($time)) { + if ($time <= self::YEAR) { + $time += time(); + } + + return (new static)->setTimestamp((int) $time); + + } else { // textual or null + return new static((string) $time); + } + } + + + /** + * Creates DateTime object. + * @throws Nette\InvalidArgumentException if the date and time are not valid. + */ + public static function fromParts( + int $year, + int $month, + int $day, + int $hour = 0, + int $minute = 0, + float $second = 0.0, + ): static + { + $s = sprintf('%04d-%02d-%02d %02d:%02d:%02.5F', $year, $month, $day, $hour, $minute, $second); + if ( + !checkdate($month, $day, $year) + || $hour < 0 + || $hour > 23 + || $minute < 0 + || $minute > 59 + || $second < 0 + || $second >= 60 + ) { + throw new Nette\InvalidArgumentException("Invalid date '$s'"); + } + + return new static($s); + } + + + /** + * Returns new DateTime object formatted according to the specified format. + */ + public static function createFromFormat( + string $format, + string $time, + string|\DateTimeZone|null $timezone = null, + ): static|false + { + if ($timezone === null) { + $timezone = new \DateTimeZone(date_default_timezone_get()); + + } elseif (is_string($timezone)) { + $timezone = new \DateTimeZone($timezone); + } + + $date = parent::createFromFormat($format, $time, $timezone); + return $date ? static::from($date) : false; + } + + + /** + * Returns JSON representation in ISO 8601 (used by JavaScript). + */ + public function jsonSerialize(): string + { + return $this->format('c'); + } + + + /** + * Returns the date and time in the format 'Y-m-d H:i:s'. + */ + public function __toString(): string + { + return $this->format('Y-m-d H:i:s'); + } + + + /** + * You'd better use: (clone $dt)->modify(...) + */ + public function modifyClone(string $modify = ''): static + { + $dolly = clone $this; + return $modify ? $dolly->modify($modify) : $dolly; + } +} diff --git a/vendor/nette/utils/src/Utils/FileInfo.php b/vendor/nette/utils/src/Utils/FileInfo.php new file mode 100644 index 00000000..fb92d119 --- /dev/null +++ b/vendor/nette/utils/src/Utils/FileInfo.php @@ -0,0 +1,69 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + +use Nette; + + +/** + * Represents the file or directory returned by the Finder. + * @internal do not create instances directly + */ +final class FileInfo extends \SplFileInfo +{ + private string $relativePath; + + + public function __construct(string $file, string $relativePath = '') + { + parent::__construct($file); + $this->setInfoClass(static::class); + $this->relativePath = $relativePath; + } + + + /** + * Returns the relative directory path. + */ + public function getRelativePath(): string + { + return $this->relativePath; + } + + + /** + * Returns the relative path including file name. + */ + public function getRelativePathname(): string + { + return ($this->relativePath === '' ? '' : $this->relativePath . DIRECTORY_SEPARATOR) + . $this->getBasename(); + } + + + /** + * Returns the contents of the file. + * @throws Nette\IOException + */ + public function read(): string + { + return FileSystem::read($this->getPathname()); + } + + + /** + * Writes the contents to the file. + * @throws Nette\IOException + */ + public function write(string $content): void + { + FileSystem::write($this->getPathname(), $content); + } +} diff --git a/vendor/nette/utils/src/Utils/FileSystem.php b/vendor/nette/utils/src/Utils/FileSystem.php new file mode 100644 index 00000000..ab9a7e87 --- /dev/null +++ b/vendor/nette/utils/src/Utils/FileSystem.php @@ -0,0 +1,326 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + +use Nette; + + +/** + * File system tool. + */ +final class FileSystem +{ + /** + * Creates a directory if it does not exist, including parent directories. + * @throws Nette\IOException on error occurred + */ + public static function createDir(string $dir, int $mode = 0777): void + { + if (!is_dir($dir) && !@mkdir($dir, $mode, recursive: true) && !is_dir($dir)) { // @ - dir may already exist + throw new Nette\IOException(sprintf( + "Unable to create directory '%s' with mode %s. %s", + self::normalizePath($dir), + decoct($mode), + Helpers::getLastError(), + )); + } + } + + + /** + * Copies a file or an entire directory. Overwrites existing files and directories by default. + * @throws Nette\IOException on error occurred + * @throws Nette\InvalidStateException if $overwrite is set to false and destination already exists + */ + public static function copy(string $origin, string $target, bool $overwrite = true): void + { + if (stream_is_local($origin) && !file_exists($origin)) { + throw new Nette\IOException(sprintf("File or directory '%s' not found.", self::normalizePath($origin))); + + } elseif (!$overwrite && file_exists($target)) { + throw new Nette\InvalidStateException(sprintf("File or directory '%s' already exists.", self::normalizePath($target))); + + } elseif (is_dir($origin)) { + static::createDir($target); + foreach (new \FilesystemIterator($target) as $item) { + static::delete($item->getPathname()); + } + + foreach ($iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($origin, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) { + if ($item->isDir()) { + static::createDir($target . '/' . $iterator->getSubPathName()); + } else { + static::copy($item->getPathname(), $target . '/' . $iterator->getSubPathName()); + } + } + } else { + static::createDir(dirname($target)); + if (@stream_copy_to_stream(static::open($origin, 'rb'), static::open($target, 'wb')) === false) { // @ is escalated to exception + throw new Nette\IOException(sprintf( + "Unable to copy file '%s' to '%s'. %s", + self::normalizePath($origin), + self::normalizePath($target), + Helpers::getLastError(), + )); + } + } + } + + + /** + * Opens file and returns resource. + * @return resource + * @throws Nette\IOException on error occurred + */ + public static function open(string $path, string $mode) + { + $f = @fopen($path, $mode); // @ is escalated to exception + if (!$f) { + throw new Nette\IOException(sprintf( + "Unable to open file '%s'. %s", + self::normalizePath($path), + Helpers::getLastError(), + )); + } + return $f; + } + + + /** + * Deletes a file or an entire directory if exists. If the directory is not empty, it deletes its contents first. + * @throws Nette\IOException on error occurred + */ + public static function delete(string $path): void + { + if (is_file($path) || is_link($path)) { + $func = DIRECTORY_SEPARATOR === '\\' && is_dir($path) ? 'rmdir' : 'unlink'; + if (!@$func($path)) { // @ is escalated to exception + throw new Nette\IOException(sprintf( + "Unable to delete '%s'. %s", + self::normalizePath($path), + Helpers::getLastError(), + )); + } + } elseif (is_dir($path)) { + foreach (new \FilesystemIterator($path) as $item) { + static::delete($item->getPathname()); + } + + if (!@rmdir($path)) { // @ is escalated to exception + throw new Nette\IOException(sprintf( + "Unable to delete directory '%s'. %s", + self::normalizePath($path), + Helpers::getLastError(), + )); + } + } + } + + + /** + * Renames or moves a file or a directory. Overwrites existing files and directories by default. + * @throws Nette\IOException on error occurred + * @throws Nette\InvalidStateException if $overwrite is set to false and destination already exists + */ + public static function rename(string $origin, string $target, bool $overwrite = true): void + { + if (!$overwrite && file_exists($target)) { + throw new Nette\InvalidStateException(sprintf("File or directory '%s' already exists.", self::normalizePath($target))); + + } elseif (!file_exists($origin)) { + throw new Nette\IOException(sprintf("File or directory '%s' not found.", self::normalizePath($origin))); + + } else { + static::createDir(dirname($target)); + if (realpath($origin) !== realpath($target)) { + static::delete($target); + } + + if (!@rename($origin, $target)) { // @ is escalated to exception + throw new Nette\IOException(sprintf( + "Unable to rename file or directory '%s' to '%s'. %s", + self::normalizePath($origin), + self::normalizePath($target), + Helpers::getLastError(), + )); + } + } + } + + + /** + * Reads the content of a file. + * @throws Nette\IOException on error occurred + */ + public static function read(string $file): string + { + $content = @file_get_contents($file); // @ is escalated to exception + if ($content === false) { + throw new Nette\IOException(sprintf( + "Unable to read file '%s'. %s", + self::normalizePath($file), + Helpers::getLastError(), + )); + } + + return $content; + } + + + /** + * Reads the file content line by line. Because it reads continuously as we iterate over the lines, + * it is possible to read files larger than the available memory. + * @return \Generator<int, string> + * @throws Nette\IOException on error occurred + */ + public static function readLines(string $file, bool $stripNewLines = true): \Generator + { + return (function ($f) use ($file, $stripNewLines) { + $counter = 0; + do { + $line = Callback::invokeSafe('fgets', [$f], fn($error) => throw new Nette\IOException(sprintf( + "Unable to read file '%s'. %s", + self::normalizePath($file), + $error, + ))); + if ($line === false) { + fclose($f); + break; + } + if ($stripNewLines) { + $line = rtrim($line, "\r\n"); + } + + yield $counter++ => $line; + + } while (true); + })(static::open($file, 'r')); + } + + + /** + * Writes the string to a file. + * @throws Nette\IOException on error occurred + */ + public static function write(string $file, string $content, ?int $mode = 0666): void + { + static::createDir(dirname($file)); + if (@file_put_contents($file, $content) === false) { // @ is escalated to exception + throw new Nette\IOException(sprintf( + "Unable to write file '%s'. %s", + self::normalizePath($file), + Helpers::getLastError(), + )); + } + + if ($mode !== null && !@chmod($file, $mode)) { // @ is escalated to exception + throw new Nette\IOException(sprintf( + "Unable to chmod file '%s' to mode %s. %s", + self::normalizePath($file), + decoct($mode), + Helpers::getLastError(), + )); + } + } + + + /** + * Sets file permissions to `$fileMode` or directory permissions to `$dirMode`. + * Recursively traverses and sets permissions on the entire contents of the directory as well. + * @throws Nette\IOException on error occurred + */ + public static function makeWritable(string $path, int $dirMode = 0777, int $fileMode = 0666): void + { + if (is_file($path)) { + if (!@chmod($path, $fileMode)) { // @ is escalated to exception + throw new Nette\IOException(sprintf( + "Unable to chmod file '%s' to mode %s. %s", + self::normalizePath($path), + decoct($fileMode), + Helpers::getLastError(), + )); + } + } elseif (is_dir($path)) { + foreach (new \FilesystemIterator($path) as $item) { + static::makeWritable($item->getPathname(), $dirMode, $fileMode); + } + + if (!@chmod($path, $dirMode)) { // @ is escalated to exception + throw new Nette\IOException(sprintf( + "Unable to chmod directory '%s' to mode %s. %s", + self::normalizePath($path), + decoct($dirMode), + Helpers::getLastError(), + )); + } + } else { + throw new Nette\IOException(sprintf("File or directory '%s' not found.", self::normalizePath($path))); + } + } + + + /** + * Determines if the path is absolute. + */ + public static function isAbsolute(string $path): bool + { + return (bool) preg_match('#([a-z]:)?[/\\\\]|[a-z][a-z0-9+.-]*://#Ai', $path); + } + + + /** + * Normalizes `..` and `.` and directory separators in path. + */ + public static function normalizePath(string $path): string + { + $parts = $path === '' ? [] : preg_split('~[/\\\\]+~', $path); + $res = []; + foreach ($parts as $part) { + if ($part === '..' && $res && end($res) !== '..' && end($res) !== '') { + array_pop($res); + } elseif ($part !== '.') { + $res[] = $part; + } + } + + return $res === [''] + ? DIRECTORY_SEPARATOR + : implode(DIRECTORY_SEPARATOR, $res); + } + + + /** + * Joins all segments of the path and normalizes the result. + */ + public static function joinPaths(string ...$paths): string + { + return self::normalizePath(implode('/', $paths)); + } + + + /** + * Converts backslashes to slashes. + */ + public static function unixSlashes(string $path): string + { + return strtr($path, '\\', '/'); + } + + + /** + * Converts slashes to platform-specific directory separators. + */ + public static function platformSlashes(string $path): string + { + return DIRECTORY_SEPARATOR === '/' + ? strtr($path, '\\', '/') + : str_replace(':\\\\', '://', strtr($path, '/', '\\')); // protocol:// + } +} diff --git a/vendor/nette/utils/src/Utils/Finder.php b/vendor/nette/utils/src/Utils/Finder.php new file mode 100644 index 00000000..a496528a --- /dev/null +++ b/vendor/nette/utils/src/Utils/Finder.php @@ -0,0 +1,510 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + +use Nette; + + +/** + * Finder allows searching through directory trees using iterator. + * + * Finder::findFiles('*.php') + * ->size('> 10kB') + * ->from('.') + * ->exclude('temp'); + * + * @implements \IteratorAggregate<string, FileInfo> + */ +class Finder implements \IteratorAggregate +{ + use Nette\SmartObject; + + /** @var array<array{string, string}> */ + private array $find = []; + + /** @var string[] */ + private array $in = []; + + /** @var \Closure[] */ + private array $filters = []; + + /** @var \Closure[] */ + private array $descentFilters = []; + + /** @var array<string|self> */ + private array $appends = []; + private bool $childFirst = false; + + /** @var ?callable */ + private $sort; + private int $maxDepth = -1; + private bool $ignoreUnreadableDirs = true; + + + /** + * Begins search for files and directories matching mask. + */ + public static function find(string|array $masks = ['*']): static + { + $masks = is_array($masks) ? $masks : func_get_args(); // compatibility with variadic + return (new static)->addMask($masks, 'dir')->addMask($masks, 'file'); + } + + + /** + * Begins search for files matching mask. + */ + public static function findFiles(string|array $masks = ['*']): static + { + $masks = is_array($masks) ? $masks : func_get_args(); // compatibility with variadic + return (new static)->addMask($masks, 'file'); + } + + + /** + * Begins search for directories matching mask. + */ + public static function findDirectories(string|array $masks = ['*']): static + { + $masks = is_array($masks) ? $masks : func_get_args(); // compatibility with variadic + return (new static)->addMask($masks, 'dir'); + } + + + /** + * Finds files matching the specified masks. + */ + public function files(string|array $masks = ['*']): static + { + return $this->addMask((array) $masks, 'file'); + } + + + /** + * Finds directories matching the specified masks. + */ + public function directories(string|array $masks = ['*']): static + { + return $this->addMask((array) $masks, 'dir'); + } + + + private function addMask(array $masks, string $mode): static + { + foreach ($masks as $mask) { + $mask = FileSystem::unixSlashes($mask); + if ($mode === 'dir') { + $mask = rtrim($mask, '/'); + } + if ($mask === '' || ($mode === 'file' && str_ends_with($mask, '/'))) { + throw new Nette\InvalidArgumentException("Invalid mask '$mask'"); + } + if (str_starts_with($mask, '**/')) { + $mask = substr($mask, 3); + } + $this->find[] = [$mask, $mode]; + } + return $this; + } + + + /** + * Searches in the given directories. Wildcards are allowed. + */ + public function in(string|array $paths): static + { + $paths = is_array($paths) ? $paths : func_get_args(); // compatibility with variadic + $this->addLocation($paths, ''); + return $this; + } + + + /** + * Searches recursively from the given directories. Wildcards are allowed. + */ + public function from(string|array $paths): static + { + $paths = is_array($paths) ? $paths : func_get_args(); // compatibility with variadic + $this->addLocation($paths, '/**'); + return $this; + } + + + private function addLocation(array $paths, string $ext): void + { + foreach ($paths as $path) { + if ($path === '') { + throw new Nette\InvalidArgumentException("Invalid directory '$path'"); + } + $path = rtrim(FileSystem::unixSlashes($path), '/'); + $this->in[] = $path . $ext; + } + } + + + /** + * Lists directory's contents before the directory itself. By default, this is disabled. + */ + public function childFirst(bool $state = true): static + { + $this->childFirst = $state; + return $this; + } + + + /** + * Ignores unreadable directories. By default, this is enabled. + */ + public function ignoreUnreadableDirs(bool $state = true): static + { + $this->ignoreUnreadableDirs = $state; + return $this; + } + + + /** + * Set a compare function for sorting directory entries. The function will be called to sort entries from the same directory. + * @param callable(FileInfo, FileInfo): int $callback + */ + public function sortBy(callable $callback): static + { + $this->sort = $callback; + return $this; + } + + + /** + * Sorts files in each directory naturally by name. + */ + public function sortByName(): static + { + $this->sort = fn(FileInfo $a, FileInfo $b): int => strnatcmp($a->getBasename(), $b->getBasename()); + return $this; + } + + + /** + * Adds the specified paths or appends a new finder that returns. + */ + public function append(string|array|null $paths = null): static + { + if ($paths === null) { + return $this->appends[] = new static; + } + + $this->appends = array_merge($this->appends, (array) $paths); + return $this; + } + + + /********************* filtering ****************d*g**/ + + + /** + * Skips entries that matches the given masks relative to the ones defined with the in() or from() methods. + */ + public function exclude(string|array $masks): static + { + $masks = is_array($masks) ? $masks : func_get_args(); // compatibility with variadic + foreach ($masks as $mask) { + $mask = FileSystem::unixSlashes($mask); + if (!preg_match('~^/?(\*\*/)?(.+)(/\*\*|/\*|/|)$~D', $mask, $m)) { + throw new Nette\InvalidArgumentException("Invalid mask '$mask'"); + } + $end = $m[3]; + $re = $this->buildPattern($m[2]); + $filter = fn(FileInfo $file): bool => ($end && !$file->isDir()) + || !preg_match($re, FileSystem::unixSlashes($file->getRelativePathname())); + + $this->descentFilter($filter); + if ($end !== '/*') { + $this->filter($filter); + } + } + + return $this; + } + + + /** + * Yields only entries which satisfy the given filter. + * @param callable(FileInfo): bool $callback + */ + public function filter(callable $callback): static + { + $this->filters[] = \Closure::fromCallable($callback); + return $this; + } + + + /** + * It descends only to directories that match the specified filter. + * @param callable(FileInfo): bool $callback + */ + public function descentFilter(callable $callback): static + { + $this->descentFilters[] = \Closure::fromCallable($callback); + return $this; + } + + + /** + * Sets the maximum depth of entries. + */ + public function limitDepth(?int $depth): static + { + $this->maxDepth = $depth ?? -1; + return $this; + } + + + /** + * Restricts the search by size. $operator accepts "[operator] [size] [unit]" example: >=10kB + */ + public function size(string $operator, ?int $size = null): static + { + if (func_num_args() === 1) { // in $operator is predicate + if (!preg_match('#^(?:([=<>!]=?|<>)\s*)?((?:\d*\.)?\d+)\s*(K|M|G|)B?$#Di', $operator, $matches)) { + throw new Nette\InvalidArgumentException('Invalid size predicate format.'); + } + + [, $operator, $size, $unit] = $matches; + $units = ['' => 1, 'k' => 1e3, 'm' => 1e6, 'g' => 1e9]; + $size *= $units[strtolower($unit)]; + $operator = $operator ?: '='; + } + + return $this->filter(fn(FileInfo $file): bool => !$file->isFile() || Helpers::compare($file->getSize(), $operator, $size)); + } + + + /** + * Restricts the search by modified time. $operator accepts "[operator] [date]" example: >1978-01-23 + */ + public function date(string $operator, string|int|\DateTimeInterface|null $date = null): static + { + if (func_num_args() === 1) { // in $operator is predicate + if (!preg_match('#^(?:([=<>!]=?|<>)\s*)?(.+)$#Di', $operator, $matches)) { + throw new Nette\InvalidArgumentException('Invalid date predicate format.'); + } + + [, $operator, $date] = $matches; + $operator = $operator ?: '='; + } + + $date = DateTime::from($date)->format('U'); + return $this->filter(fn(FileInfo $file): bool => !$file->isFile() || Helpers::compare($file->getMTime(), $operator, $date)); + } + + + /********************* iterator generator ****************d*g**/ + + + /** + * Returns an array with all found files and directories. + * @return list<FileInfo> + */ + public function collect(): array + { + return iterator_to_array($this->getIterator(), preserve_keys: false); + } + + + /** @return \Generator<string, FileInfo> */ + public function getIterator(): \Generator + { + $plan = $this->buildPlan(); + foreach ($plan as $dir => $searches) { + yield from $this->traverseDir($dir, $searches); + } + + foreach ($this->appends as $item) { + if ($item instanceof self) { + yield from $item->getIterator(); + } else { + $item = FileSystem::platformSlashes($item); + yield $item => new FileInfo($item); + } + } + } + + + /** + * @param array<object{pattern: string, mode: string, recursive: bool}> $searches + * @param string[] $subdirs + * @return \Generator<string, FileInfo> + */ + private function traverseDir(string $dir, array $searches, array $subdirs = []): \Generator + { + if ($this->maxDepth >= 0 && count($subdirs) > $this->maxDepth) { + return; + } elseif (!is_dir($dir)) { + throw new Nette\InvalidStateException(sprintf("Directory '%s' does not exist.", rtrim($dir, '/\\'))); + } + + try { + $pathNames = new \FilesystemIterator($dir, \FilesystemIterator::FOLLOW_SYMLINKS | \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::UNIX_PATHS); + } catch (\UnexpectedValueException $e) { + if ($this->ignoreUnreadableDirs) { + return; + } else { + throw new Nette\InvalidStateException($e->getMessage()); + } + } + + $files = $this->convertToFiles($pathNames, implode('/', $subdirs), FileSystem::isAbsolute($dir)); + + if ($this->sort) { + $files = iterator_to_array($files); + usort($files, $this->sort); + } + + foreach ($files as $file) { + $pathName = $file->getPathname(); + $cache = $subSearch = []; + + if ($file->isDir()) { + foreach ($searches as $search) { + if ($search->recursive && $this->proveFilters($this->descentFilters, $file, $cache)) { + $subSearch[] = $search; + } + } + } + + if ($this->childFirst && $subSearch) { + yield from $this->traverseDir($pathName, $subSearch, array_merge($subdirs, [$file->getBasename()])); + } + + $relativePathname = FileSystem::unixSlashes($file->getRelativePathname()); + foreach ($searches as $search) { + if ( + $file->{'is' . $search->mode}() + && preg_match($search->pattern, $relativePathname) + && $this->proveFilters($this->filters, $file, $cache) + ) { + yield $pathName => $file; + break; + } + } + + if (!$this->childFirst && $subSearch) { + yield from $this->traverseDir($pathName, $subSearch, array_merge($subdirs, [$file->getBasename()])); + } + } + } + + + private function convertToFiles(iterable $pathNames, string $relativePath, bool $absolute): \Generator + { + foreach ($pathNames as $pathName) { + if (!$absolute) { + $pathName = preg_replace('~\.?/~A', '', $pathName); + } + $pathName = FileSystem::platformSlashes($pathName); + yield new FileInfo($pathName, $relativePath); + } + } + + + private function proveFilters(array $filters, FileInfo $file, array &$cache): bool + { + foreach ($filters as $filter) { + $res = &$cache[spl_object_id($filter)]; + $res ??= $filter($file); + if (!$res) { + return false; + } + } + + return true; + } + + + /** @return array<string, array<object{pattern: string, mode: string, recursive: bool}>> */ + private function buildPlan(): array + { + $plan = $dirCache = []; + foreach ($this->find as [$mask, $mode]) { + $splits = []; + if (FileSystem::isAbsolute($mask)) { + if ($this->in) { + throw new Nette\InvalidStateException("You cannot combine the absolute path in the mask '$mask' and the directory to search '{$this->in[0]}'."); + } + $splits[] = self::splitRecursivePart($mask); + } else { + foreach ($this->in ?: ['.'] as $in) { + $in = strtr($in, ['[' => '[[]', ']' => '[]]']); // in path, do not treat [ and ] as a pattern by glob() + $splits[] = self::splitRecursivePart($in . '/' . $mask); + } + } + + foreach ($splits as [$base, $rest, $recursive]) { + $base = $base === '' ? '.' : $base; + $dirs = $dirCache[$base] ??= strpbrk($base, '*?[') + ? glob($base, GLOB_NOSORT | GLOB_ONLYDIR | GLOB_NOESCAPE) + : [strtr($base, ['[[]' => '[', '[]]' => ']'])]; // unescape [ and ] + + if (!$dirs) { + throw new Nette\InvalidStateException(sprintf("Directory '%s' does not exist.", rtrim($base, '/\\'))); + } + + $search = (object) ['pattern' => $this->buildPattern($rest), 'mode' => $mode, 'recursive' => $recursive]; + foreach ($dirs as $dir) { + $plan[$dir][] = $search; + } + } + } + + return $plan; + } + + + /** + * Since glob() does not know ** wildcard, we divide the path into a part for glob and a part for manual traversal. + */ + private static function splitRecursivePart(string $path): array + { + $a = strrpos($path, '/'); + $parts = preg_split('~(?<=^|/)\*\*($|/)~', substr($path, 0, $a + 1), 2); + return isset($parts[1]) + ? [$parts[0], $parts[1] . substr($path, $a + 1), true] + : [$parts[0], substr($path, $a + 1), false]; + } + + + /** + * Converts wildcards to regular expression. + */ + private function buildPattern(string $mask): string + { + if ($mask === '*') { + return '##'; + } elseif (str_starts_with($mask, './')) { + $anchor = '^'; + $mask = substr($mask, 2); + } else { + $anchor = '(?:^|/)'; + } + + $pattern = strtr( + preg_quote($mask, '#'), + [ + '\*\*/' => '(.+/)?', + '\*' => '[^/]*', + '\?' => '[^/]', + '\[\!' => '[^', + '\[' => '[', + '\]' => ']', + '\-' => '-', + ], + ); + return '#' . $anchor . $pattern . '$#D' . (defined('PHP_WINDOWS_VERSION_BUILD') ? 'i' : ''); + } +} diff --git a/vendor/nette/utils/src/Utils/Floats.php b/vendor/nette/utils/src/Utils/Floats.php new file mode 100644 index 00000000..cc2781d7 --- /dev/null +++ b/vendor/nette/utils/src/Utils/Floats.php @@ -0,0 +1,107 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + +use Nette; + + +/** + * Floating-point numbers comparison. + */ +class Floats +{ + use Nette\StaticClass; + + private const Epsilon = 1e-10; + + + public static function isZero(float $value): bool + { + return abs($value) < self::Epsilon; + } + + + public static function isInteger(float $value): bool + { + return abs(round($value) - $value) < self::Epsilon; + } + + + /** + * Compare two floats. If $a < $b it returns -1, if they are equal it returns 0 and if $a > $b it returns 1 + * @throws \LogicException if one of parameters is NAN + */ + public static function compare(float $a, float $b): int + { + if (is_nan($a) || is_nan($b)) { + throw new \LogicException('Trying to compare NAN'); + + } elseif (!is_finite($a) && !is_finite($b) && $a === $b) { + return 0; + } + + $diff = abs($a - $b); + if (($diff < self::Epsilon || ($diff / max(abs($a), abs($b)) < self::Epsilon))) { + return 0; + } + + return $a < $b ? -1 : 1; + } + + + /** + * Returns true if $a = $b + * @throws \LogicException if one of parameters is NAN + */ + public static function areEqual(float $a, float $b): bool + { + return self::compare($a, $b) === 0; + } + + + /** + * Returns true if $a < $b + * @throws \LogicException if one of parameters is NAN + */ + public static function isLessThan(float $a, float $b): bool + { + return self::compare($a, $b) < 0; + } + + + /** + * Returns true if $a <= $b + * @throws \LogicException if one of parameters is NAN + */ + public static function isLessThanOrEqualTo(float $a, float $b): bool + { + return self::compare($a, $b) <= 0; + } + + + /** + * Returns true if $a > $b + * @throws \LogicException if one of parameters is NAN + */ + public static function isGreaterThan(float $a, float $b): bool + { + return self::compare($a, $b) > 0; + } + + + /** + * Returns true if $a >= $b + * @throws \LogicException if one of parameters is NAN + */ + public static function isGreaterThanOrEqualTo(float $a, float $b): bool + { + return self::compare($a, $b) >= 0; + } +} diff --git a/vendor/nette/utils/src/Utils/Helpers.php b/vendor/nette/utils/src/Utils/Helpers.php new file mode 100644 index 00000000..b3586c16 --- /dev/null +++ b/vendor/nette/utils/src/Utils/Helpers.php @@ -0,0 +1,104 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + +use Nette; + + +class Helpers +{ + /** + * Executes a callback and returns the captured output as a string. + */ + public static function capture(callable $func): string + { + ob_start(function () {}); + try { + $func(); + return ob_get_clean(); + } catch (\Throwable $e) { + ob_end_clean(); + throw $e; + } + } + + + /** + * Returns the last occurred PHP error or an empty string if no error occurred. Unlike error_get_last(), + * it is nit affected by the PHP directive html_errors and always returns text, not HTML. + */ + public static function getLastError(): string + { + $message = error_get_last()['message'] ?? ''; + $message = ini_get('html_errors') ? Html::htmlToText($message) : $message; + $message = preg_replace('#^\w+\(.*?\): #', '', $message); + return $message; + } + + + /** + * Converts false to null, does not change other values. + */ + public static function falseToNull(mixed $value): mixed + { + return $value === false ? null : $value; + } + + + /** + * Returns value clamped to the inclusive range of min and max. + */ + public static function clamp(int|float $value, int|float $min, int|float $max): int|float + { + if ($min > $max) { + throw new Nette\InvalidArgumentException("Minimum ($min) is not less than maximum ($max)."); + } + + return min(max($value, $min), $max); + } + + + /** + * Looks for a string from possibilities that is most similar to value, but not the same (for 8-bit encoding). + * @param string[] $possibilities + */ + public static function getSuggestion(array $possibilities, string $value): ?string + { + $best = null; + $min = (strlen($value) / 4 + 1) * 10 + .1; + foreach (array_unique($possibilities) as $item) { + if ($item !== $value && ($len = levenshtein($item, $value, 10, 11, 10)) < $min) { + $min = $len; + $best = $item; + } + } + + return $best; + } + + + /** + * Compares two values in the same way that PHP does. Recognizes operators: >, >=, <, <=, =, ==, ===, !=, !==, <> + */ + public static function compare(mixed $left, string $operator, mixed $right): bool + { + return match ($operator) { + '>' => $left > $right, + '>=' => $left >= $right, + '<' => $left < $right, + '<=' => $left <= $right, + '=', '==' => $left == $right, + '===' => $left === $right, + '!=', '<>' => $left != $right, + '!==' => $left !== $right, + default => throw new Nette\InvalidArgumentException("Unknown operator '$operator'"), + }; + } +} diff --git a/vendor/nette/utils/src/Utils/Html.php b/vendor/nette/utils/src/Utils/Html.php new file mode 100644 index 00000000..fc0e3ef2 --- /dev/null +++ b/vendor/nette/utils/src/Utils/Html.php @@ -0,0 +1,839 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + +use Nette; +use Nette\HtmlStringable; +use function is_array, is_float, is_object, is_string; + + +/** + * HTML helper. + * + * @property string|null $accept + * @property string|null $accesskey + * @property string|null $action + * @property string|null $align + * @property string|null $allow + * @property string|null $alt + * @property bool|null $async + * @property string|null $autocapitalize + * @property string|null $autocomplete + * @property bool|null $autofocus + * @property bool|null $autoplay + * @property string|null $charset + * @property bool|null $checked + * @property string|null $cite + * @property string|null $class + * @property int|null $cols + * @property int|null $colspan + * @property string|null $content + * @property bool|null $contenteditable + * @property bool|null $controls + * @property string|null $coords + * @property string|null $crossorigin + * @property string|null $data + * @property string|null $datetime + * @property string|null $decoding + * @property bool|null $default + * @property bool|null $defer + * @property string|null $dir + * @property string|null $dirname + * @property bool|null $disabled + * @property bool|null $download + * @property string|null $draggable + * @property string|null $dropzone + * @property string|null $enctype + * @property string|null $for + * @property string|null $form + * @property string|null $formaction + * @property string|null $formenctype + * @property string|null $formmethod + * @property bool|null $formnovalidate + * @property string|null $formtarget + * @property string|null $headers + * @property int|null $height + * @property bool|null $hidden + * @property float|null $high + * @property string|null $href + * @property string|null $hreflang + * @property string|null $id + * @property string|null $integrity + * @property string|null $inputmode + * @property bool|null $ismap + * @property string|null $itemprop + * @property string|null $kind + * @property string|null $label + * @property string|null $lang + * @property string|null $list + * @property bool|null $loop + * @property float|null $low + * @property float|null $max + * @property int|null $maxlength + * @property int|null $minlength + * @property string|null $media + * @property string|null $method + * @property float|null $min + * @property bool|null $multiple + * @property bool|null $muted + * @property string|null $name + * @property bool|null $novalidate + * @property bool|null $open + * @property float|null $optimum + * @property string|null $pattern + * @property string|null $ping + * @property string|null $placeholder + * @property string|null $poster + * @property string|null $preload + * @property string|null $radiogroup + * @property bool|null $readonly + * @property string|null $rel + * @property bool|null $required + * @property bool|null $reversed + * @property int|null $rows + * @property int|null $rowspan + * @property string|null $sandbox + * @property string|null $scope + * @property bool|null $selected + * @property string|null $shape + * @property int|null $size + * @property string|null $sizes + * @property string|null $slot + * @property int|null $span + * @property string|null $spellcheck + * @property string|null $src + * @property string|null $srcdoc + * @property string|null $srclang + * @property string|null $srcset + * @property int|null $start + * @property float|null $step + * @property string|null $style + * @property int|null $tabindex + * @property string|null $target + * @property string|null $title + * @property string|null $translate + * @property string|null $type + * @property string|null $usemap + * @property string|null $value + * @property int|null $width + * @property string|null $wrap + * + * @method self accept(?string $val) + * @method self accesskey(?string $val, bool $state = null) + * @method self action(?string $val) + * @method self align(?string $val) + * @method self allow(?string $val, bool $state = null) + * @method self alt(?string $val) + * @method self async(?bool $val) + * @method self autocapitalize(?string $val) + * @method self autocomplete(?string $val) + * @method self autofocus(?bool $val) + * @method self autoplay(?bool $val) + * @method self charset(?string $val) + * @method self checked(?bool $val) + * @method self cite(?string $val) + * @method self class(?string $val, bool $state = null) + * @method self cols(?int $val) + * @method self colspan(?int $val) + * @method self content(?string $val) + * @method self contenteditable(?bool $val) + * @method self controls(?bool $val) + * @method self coords(?string $val) + * @method self crossorigin(?string $val) + * @method self datetime(?string $val) + * @method self decoding(?string $val) + * @method self default(?bool $val) + * @method self defer(?bool $val) + * @method self dir(?string $val) + * @method self dirname(?string $val) + * @method self disabled(?bool $val) + * @method self download(?bool $val) + * @method self draggable(?string $val) + * @method self dropzone(?string $val) + * @method self enctype(?string $val) + * @method self for(?string $val) + * @method self form(?string $val) + * @method self formaction(?string $val) + * @method self formenctype(?string $val) + * @method self formmethod(?string $val) + * @method self formnovalidate(?bool $val) + * @method self formtarget(?string $val) + * @method self headers(?string $val, bool $state = null) + * @method self height(?int $val) + * @method self hidden(?bool $val) + * @method self high(?float $val) + * @method self hreflang(?string $val) + * @method self id(?string $val) + * @method self integrity(?string $val) + * @method self inputmode(?string $val) + * @method self ismap(?bool $val) + * @method self itemprop(?string $val) + * @method self kind(?string $val) + * @method self label(?string $val) + * @method self lang(?string $val) + * @method self list(?string $val) + * @method self loop(?bool $val) + * @method self low(?float $val) + * @method self max(?float $val) + * @method self maxlength(?int $val) + * @method self minlength(?int $val) + * @method self media(?string $val) + * @method self method(?string $val) + * @method self min(?float $val) + * @method self multiple(?bool $val) + * @method self muted(?bool $val) + * @method self name(?string $val) + * @method self novalidate(?bool $val) + * @method self open(?bool $val) + * @method self optimum(?float $val) + * @method self pattern(?string $val) + * @method self ping(?string $val, bool $state = null) + * @method self placeholder(?string $val) + * @method self poster(?string $val) + * @method self preload(?string $val) + * @method self radiogroup(?string $val) + * @method self readonly(?bool $val) + * @method self rel(?string $val) + * @method self required(?bool $val) + * @method self reversed(?bool $val) + * @method self rows(?int $val) + * @method self rowspan(?int $val) + * @method self sandbox(?string $val, bool $state = null) + * @method self scope(?string $val) + * @method self selected(?bool $val) + * @method self shape(?string $val) + * @method self size(?int $val) + * @method self sizes(?string $val) + * @method self slot(?string $val) + * @method self span(?int $val) + * @method self spellcheck(?string $val) + * @method self src(?string $val) + * @method self srcdoc(?string $val) + * @method self srclang(?string $val) + * @method self srcset(?string $val) + * @method self start(?int $val) + * @method self step(?float $val) + * @method self style(?string $property, string $val = null) + * @method self tabindex(?int $val) + * @method self target(?string $val) + * @method self title(?string $val) + * @method self translate(?string $val) + * @method self type(?string $val) + * @method self usemap(?string $val) + * @method self value(?string $val) + * @method self width(?int $val) + * @method self wrap(?string $val) + */ +class Html implements \ArrayAccess, \Countable, \IteratorAggregate, HtmlStringable +{ + use Nette\SmartObject; + + /** @var array<string, mixed> element's attributes */ + public $attrs = []; + + /** void elements */ + public static $emptyElements = [ + 'img' => 1, 'hr' => 1, 'br' => 1, 'input' => 1, 'meta' => 1, 'area' => 1, 'embed' => 1, 'keygen' => 1, + 'source' => 1, 'base' => 1, 'col' => 1, 'link' => 1, 'param' => 1, 'basefont' => 1, 'frame' => 1, + 'isindex' => 1, 'wbr' => 1, 'command' => 1, 'track' => 1, + ]; + + /** @var array<int, HtmlStringable|string> nodes */ + protected $children = []; + + /** element's name */ + private string $name = ''; + + private bool $isEmpty = false; + + + /** + * Constructs new HTML element. + * @param array|string $attrs element's attributes or plain text content + */ + public static function el(?string $name = null, array|string|null $attrs = null): static + { + $el = new static; + $parts = explode(' ', (string) $name, 2); + $el->setName($parts[0]); + + if (is_array($attrs)) { + $el->attrs = $attrs; + + } elseif ($attrs !== null) { + $el->setText($attrs); + } + + if (isset($parts[1])) { + foreach (Strings::matchAll($parts[1] . ' ', '#([a-z0-9:-]+)(?:=(["\'])?(.*?)(?(2)\2|\s))?#i') as $m) { + $el->attrs[$m[1]] = $m[3] ?? true; + } + } + + return $el; + } + + + /** + * Returns an object representing HTML text. + */ + public static function fromHtml(string $html): static + { + return (new static)->setHtml($html); + } + + + /** + * Returns an object representing plain text. + */ + public static function fromText(string $text): static + { + return (new static)->setText($text); + } + + + /** + * Converts to HTML. + */ + final public function toHtml(): string + { + return $this->render(); + } + + + /** + * Converts to plain text. + */ + final public function toText(): string + { + return $this->getText(); + } + + + /** + * Converts given HTML code to plain text. + */ + public static function htmlToText(string $html): string + { + return html_entity_decode(strip_tags($html), ENT_QUOTES | ENT_HTML5, 'UTF-8'); + } + + + /** + * Changes element's name. + */ + final public function setName(string $name, ?bool $isEmpty = null): static + { + $this->name = $name; + $this->isEmpty = $isEmpty ?? isset(static::$emptyElements[$name]); + return $this; + } + + + /** + * Returns element's name. + */ + final public function getName(): string + { + return $this->name; + } + + + /** + * Is element empty? + */ + final public function isEmpty(): bool + { + return $this->isEmpty; + } + + + /** + * Sets multiple attributes. + */ + public function addAttributes(array $attrs): static + { + $this->attrs = array_merge($this->attrs, $attrs); + return $this; + } + + + /** + * Appends value to element's attribute. + */ + public function appendAttribute(string $name, mixed $value, mixed $option = true): static + { + if (is_array($value)) { + $prev = isset($this->attrs[$name]) ? (array) $this->attrs[$name] : []; + $this->attrs[$name] = $value + $prev; + + } elseif ((string) $value === '') { + $tmp = &$this->attrs[$name]; // appending empty value? -> ignore, but ensure it exists + + } elseif (!isset($this->attrs[$name]) || is_array($this->attrs[$name])) { // needs array + $this->attrs[$name][$value] = $option; + + } else { + $this->attrs[$name] = [$this->attrs[$name] => true, $value => $option]; + } + + return $this; + } + + + /** + * Sets element's attribute. + */ + public function setAttribute(string $name, mixed $value): static + { + $this->attrs[$name] = $value; + return $this; + } + + + /** + * Returns element's attribute. + */ + public function getAttribute(string $name): mixed + { + return $this->attrs[$name] ?? null; + } + + + /** + * Unsets element's attribute. + */ + public function removeAttribute(string $name): static + { + unset($this->attrs[$name]); + return $this; + } + + + /** + * Unsets element's attributes. + */ + public function removeAttributes(array $attributes): static + { + foreach ($attributes as $name) { + unset($this->attrs[$name]); + } + + return $this; + } + + + /** + * Overloaded setter for element's attribute. + */ + final public function __set(string $name, mixed $value): void + { + $this->attrs[$name] = $value; + } + + + /** + * Overloaded getter for element's attribute. + */ + final public function &__get(string $name): mixed + { + return $this->attrs[$name]; + } + + + /** + * Overloaded tester for element's attribute. + */ + final public function __isset(string $name): bool + { + return isset($this->attrs[$name]); + } + + + /** + * Overloaded unsetter for element's attribute. + */ + final public function __unset(string $name): void + { + unset($this->attrs[$name]); + } + + + /** + * Overloaded setter for element's attribute. + */ + final public function __call(string $m, array $args): mixed + { + $p = substr($m, 0, 3); + if ($p === 'get' || $p === 'set' || $p === 'add') { + $m = substr($m, 3); + $m[0] = $m[0] | "\x20"; + if ($p === 'get') { + return $this->attrs[$m] ?? null; + + } elseif ($p === 'add') { + $args[] = true; + } + } + + if (count($args) === 0) { // invalid + + } elseif (count($args) === 1) { // set + $this->attrs[$m] = $args[0]; + + } else { // add + $this->appendAttribute($m, $args[0], $args[1]); + } + + return $this; + } + + + /** + * Special setter for element's attribute. + */ + final public function href(string $path, array $query = []): static + { + if ($query) { + $query = http_build_query($query, '', '&'); + if ($query !== '') { + $path .= '?' . $query; + } + } + + $this->attrs['href'] = $path; + return $this; + } + + + /** + * Setter for data-* attributes. Booleans are converted to 'true' resp. 'false'. + */ + public function data(string $name, mixed $value = null): static + { + if (func_num_args() === 1) { + $this->attrs['data'] = $name; + } else { + $this->attrs["data-$name"] = is_bool($value) + ? json_encode($value) + : $value; + } + + return $this; + } + + + /** + * Sets element's HTML content. + */ + final public function setHtml(mixed $html): static + { + $this->children = [(string) $html]; + return $this; + } + + + /** + * Returns element's HTML content. + */ + final public function getHtml(): string + { + return implode('', $this->children); + } + + + /** + * Sets element's textual content. + */ + final public function setText(mixed $text): static + { + if (!$text instanceof HtmlStringable) { + $text = htmlspecialchars((string) $text, ENT_NOQUOTES, 'UTF-8'); + } + + $this->children = [(string) $text]; + return $this; + } + + + /** + * Returns element's textual content. + */ + final public function getText(): string + { + return self::htmlToText($this->getHtml()); + } + + + /** + * Adds new element's child. + */ + final public function addHtml(mixed $child): static + { + return $this->insert(null, $child); + } + + + /** + * Appends plain-text string to element content. + */ + public function addText(mixed $text): static + { + if (!$text instanceof HtmlStringable) { + $text = htmlspecialchars((string) $text, ENT_NOQUOTES, 'UTF-8'); + } + + return $this->insert(null, $text); + } + + + /** + * Creates and adds a new Html child. + */ + final public function create(string $name, array|string|null $attrs = null): static + { + $this->insert(null, $child = static::el($name, $attrs)); + return $child; + } + + + /** + * Inserts child node. + */ + public function insert(?int $index, HtmlStringable|string $child, bool $replace = false): static + { + $child = $child instanceof self ? $child : (string) $child; + if ($index === null) { // append + $this->children[] = $child; + + } else { // insert or replace + array_splice($this->children, $index, $replace ? 1 : 0, [$child]); + } + + return $this; + } + + + /** + * Inserts (replaces) child node (\ArrayAccess implementation). + * @param int|null $index position or null for appending + * @param Html|string $child Html node or raw HTML string + */ + final public function offsetSet($index, $child): void + { + $this->insert($index, $child, replace: true); + } + + + /** + * Returns child node (\ArrayAccess implementation). + * @param int $index + */ + final public function offsetGet($index): HtmlStringable|string + { + return $this->children[$index]; + } + + + /** + * Exists child node? (\ArrayAccess implementation). + * @param int $index + */ + final public function offsetExists($index): bool + { + return isset($this->children[$index]); + } + + + /** + * Removes child node (\ArrayAccess implementation). + * @param int $index + */ + public function offsetUnset($index): void + { + if (isset($this->children[$index])) { + array_splice($this->children, $index, 1); + } + } + + + /** + * Returns children count. + */ + final public function count(): int + { + return count($this->children); + } + + + /** + * Removes all children. + */ + public function removeChildren(): void + { + $this->children = []; + } + + + /** + * Iterates over elements. + * @return \ArrayIterator<int, HtmlStringable|string> + */ + final public function getIterator(): \ArrayIterator + { + return new \ArrayIterator($this->children); + } + + + /** + * Returns all children. + */ + final public function getChildren(): array + { + return $this->children; + } + + + /** + * Renders element's start tag, content and end tag. + */ + final public function render(?int $indent = null): string + { + $s = $this->startTag(); + + if (!$this->isEmpty) { + // add content + if ($indent !== null) { + $indent++; + } + + foreach ($this->children as $child) { + if ($child instanceof self) { + $s .= $child->render($indent); + } else { + $s .= $child; + } + } + + // add end tag + $s .= $this->endTag(); + } + + if ($indent !== null) { + return "\n" . str_repeat("\t", $indent - 1) . $s . "\n" . str_repeat("\t", max(0, $indent - 2)); + } + + return $s; + } + + + final public function __toString(): string + { + return $this->render(); + } + + + /** + * Returns element's start tag. + */ + final public function startTag(): string + { + return $this->name + ? '<' . $this->name . $this->attributes() . '>' + : ''; + } + + + /** + * Returns element's end tag. + */ + final public function endTag(): string + { + return $this->name && !$this->isEmpty ? '</' . $this->name . '>' : ''; + } + + + /** + * Returns element's attributes. + * @internal + */ + final public function attributes(): string + { + if (!is_array($this->attrs)) { + return ''; + } + + $s = ''; + $attrs = $this->attrs; + foreach ($attrs as $key => $value) { + if ($value === null || $value === false) { + continue; + + } elseif ($value === true) { + $s .= ' ' . $key; + + continue; + + } elseif (is_array($value)) { + if (strncmp($key, 'data-', 5) === 0) { + $value = Json::encode($value); + + } else { + $tmp = null; + foreach ($value as $k => $v) { + if ($v != null) { // intentionally ==, skip nulls & empty string + // composite 'style' vs. 'others' + $tmp[] = $v === true + ? $k + : (is_string($k) ? $k . ':' . $v : $v); + } + } + + if ($tmp === null) { + continue; + } + + $value = implode($key === 'style' || !strncmp($key, 'on', 2) ? ';' : ' ', $tmp); + } + } elseif (is_float($value)) { + $value = rtrim(rtrim(number_format($value, 10, '.', ''), '0'), '.'); + + } else { + $value = (string) $value; + } + + $q = str_contains($value, '"') ? "'" : '"'; + $s .= ' ' . $key . '=' . $q + . str_replace( + ['&', $q, '<'], + ['&', $q === '"' ? '"' : ''', '<'], + $value, + ) + . (str_contains($value, '`') && strpbrk($value, ' <>"\'') === false ? ' ' : '') + . $q; + } + + $s = str_replace('@', '@', $s); + return $s; + } + + + /** + * Clones all children too. + */ + public function __clone() + { + foreach ($this->children as $key => $value) { + if (is_object($value)) { + $this->children[$key] = clone $value; + } + } + } +} diff --git a/vendor/nette/utils/src/Utils/Image.php b/vendor/nette/utils/src/Utils/Image.php new file mode 100644 index 00000000..d2947c72 --- /dev/null +++ b/vendor/nette/utils/src/Utils/Image.php @@ -0,0 +1,831 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + +use Nette; + + +/** + * Basic manipulation with images. Supported types are JPEG, PNG, GIF, WEBP, AVIF and BMP. + * + * <code> + * $image = Image::fromFile('nette.jpg'); + * $image->resize(150, 100); + * $image->sharpen(); + * $image->send(); + * </code> + * + * @method Image affine(array $affine, ?array $clip = null) + * @method void alphaBlending(bool $enable) + * @method void antialias(bool $enable) + * @method void arc(int $centerX, int $centerY, int $width, int $height, int $startAngle, int $endAngle, ImageColor $color) + * @method int colorAllocate(int $red, int $green, int $blue) + * @method int colorAllocateAlpha(int $red, int $green, int $blue, int $alpha) + * @method int colorAt(int $x, int $y) + * @method int colorClosest(int $red, int $green, int $blue) + * @method int colorClosestAlpha(int $red, int $green, int $blue, int $alpha) + * @method int colorClosestHWB(int $red, int $green, int $blue) + * @method void colorDeallocate(int $color) + * @method int colorExact(int $red, int $green, int $blue) + * @method int colorExactAlpha(int $red, int $green, int $blue, int $alpha) + * @method void colorMatch(Image $image2) + * @method int colorResolve(int $red, int $green, int $blue) + * @method int colorResolveAlpha(int $red, int $green, int $blue, int $alpha) + * @method void colorSet(int $index, int $red, int $green, int $blue, int $alpha = 0) + * @method array colorsForIndex(int $color) + * @method int colorsTotal() + * @method int colorTransparent(?int $color = null) + * @method void convolution(array $matrix, float $div, float $offset) + * @method void copy(Image $src, int $dstX, int $dstY, int $srcX, int $srcY, int $srcW, int $srcH) + * @method void copyMerge(Image $src, int $dstX, int $dstY, int $srcX, int $srcY, int $srcW, int $srcH, int $pct) + * @method void copyMergeGray(Image $src, int $dstX, int $dstY, int $srcX, int $srcY, int $srcW, int $srcH, int $pct) + * @method void copyResampled(Image $src, int $dstX, int $dstY, int $srcX, int $srcY, int $dstW, int $dstH, int $srcW, int $srcH) + * @method void copyResized(Image $src, int $dstX, int $dstY, int $srcX, int $srcY, int $dstW, int $dstH, int $srcW, int $srcH) + * @method Image cropAuto(int $mode = IMG_CROP_DEFAULT, float $threshold = .5, ?ImageColor $color = null) + * @method void ellipse(int $centerX, int $centerY, int $width, int $height, ImageColor $color) + * @method void fill(int $x, int $y, ImageColor $color) + * @method void filledArc(int $centerX, int $centerY, int $width, int $height, int $startAngle, int $endAngle, ImageColor $color, int $style) + * @method void filledEllipse(int $centerX, int $centerY, int $width, int $height, ImageColor $color) + * @method void filledPolygon(array $points, ImageColor $color) + * @method void filledRectangle(int $x1, int $y1, int $x2, int $y2, ImageColor $color) + * @method void fillToBorder(int $x, int $y, ImageColor $borderColor, ImageColor $color) + * @method void filter(int $filter, ...$args) + * @method void flip(int $mode) + * @method array ftText(float $size, float $angle, int $x, int $y, ImageColor $color, string $fontFile, string $text, array $options = []) + * @method void gammaCorrect(float $inputgamma, float $outputgamma) + * @method array getClip() + * @method int getInterpolation() + * @method int interlace(?bool $enable = null) + * @method bool isTrueColor() + * @method void layerEffect(int $effect) + * @method void line(int $x1, int $y1, int $x2, int $y2, ImageColor $color) + * @method void openPolygon(array $points, ImageColor $color) + * @method void paletteCopy(Image $source) + * @method void paletteToTrueColor() + * @method void polygon(array $points, ImageColor $color) + * @method void rectangle(int $x1, int $y1, int $x2, int $y2, ImageColor $color) + * @method mixed resolution(?int $resolutionX = null, ?int $resolutionY = null) + * @method Image rotate(float $angle, ImageColor $backgroundColor) + * @method void saveAlpha(bool $enable) + * @method Image scale(int $newWidth, int $newHeight = -1, int $mode = IMG_BILINEAR_FIXED) + * @method void setBrush(Image $brush) + * @method void setClip(int $x1, int $y1, int $x2, int $y2) + * @method void setInterpolation(int $method = IMG_BILINEAR_FIXED) + * @method void setPixel(int $x, int $y, ImageColor $color) + * @method void setStyle(array $style) + * @method void setThickness(int $thickness) + * @method void setTile(Image $tile) + * @method void trueColorToPalette(bool $dither, int $ncolors) + * @method array ttfText(float $size, float $angle, int $x, int $y, ImageColor $color, string $fontfile, string $text, array $options = []) + * @property-read positive-int $width + * @property-read positive-int $height + * @property-read \GdImage $imageResource + */ +class Image +{ + use Nette\SmartObject; + + /** Prevent from getting resized to a bigger size than the original */ + public const ShrinkOnly = 0b0001; + + /** Resizes to a specified width and height without keeping aspect ratio */ + public const Stretch = 0b0010; + + /** Resizes to fit into a specified width and height and preserves aspect ratio */ + public const OrSmaller = 0b0000; + + /** Resizes while bounding the smaller dimension to the specified width or height and preserves aspect ratio */ + public const OrBigger = 0b0100; + + /** Resizes to the smallest possible size to completely cover specified width and height and reserves aspect ratio */ + public const Cover = 0b1000; + + /** @deprecated use Image::ShrinkOnly */ + public const SHRINK_ONLY = self::ShrinkOnly; + + /** @deprecated use Image::Stretch */ + public const STRETCH = self::Stretch; + + /** @deprecated use Image::OrSmaller */ + public const FIT = self::OrSmaller; + + /** @deprecated use Image::OrBigger */ + public const FILL = self::OrBigger; + + /** @deprecated use Image::Cover */ + public const EXACT = self::Cover; + + /** @deprecated use Image::EmptyGIF */ + public const EMPTY_GIF = self::EmptyGIF; + + /** image types */ + public const + JPEG = ImageType::JPEG, + PNG = ImageType::PNG, + GIF = ImageType::GIF, + WEBP = ImageType::WEBP, + AVIF = ImageType::AVIF, + BMP = ImageType::BMP; + + public const EmptyGIF = "GIF89a\x01\x00\x01\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00!\xf9\x04\x01\x00\x00\x00\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02D\x01\x00;"; + + private const Formats = [ImageType::JPEG => 'jpeg', ImageType::PNG => 'png', ImageType::GIF => 'gif', ImageType::WEBP => 'webp', ImageType::AVIF => 'avif', ImageType::BMP => 'bmp']; + + private \GdImage $image; + + + /** + * Returns RGB color (0..255) and transparency (0..127). + * @deprecated use ImageColor::rgb() + */ + public static function rgb(int $red, int $green, int $blue, int $transparency = 0): array + { + return [ + 'red' => max(0, min(255, $red)), + 'green' => max(0, min(255, $green)), + 'blue' => max(0, min(255, $blue)), + 'alpha' => max(0, min(127, $transparency)), + ]; + } + + + /** + * Reads an image from a file and returns its type in $type. + * @throws Nette\NotSupportedException if gd extension is not loaded + * @throws UnknownImageFileException if file not found or file type is not known + */ + public static function fromFile(string $file, ?int &$type = null): static + { + self::ensureExtension(); + $type = self::detectTypeFromFile($file); + if (!$type) { + throw new UnknownImageFileException(is_file($file) ? "Unknown type of file '$file'." : "File '$file' not found."); + } + + return self::invokeSafe('imagecreatefrom' . self::Formats[$type], $file, "Unable to open file '$file'.", __METHOD__); + } + + + /** + * Reads an image from a string and returns its type in $type. + * @throws Nette\NotSupportedException if gd extension is not loaded + * @throws ImageException + */ + public static function fromString(string $s, ?int &$type = null): static + { + self::ensureExtension(); + $type = self::detectTypeFromString($s); + if (!$type) { + throw new UnknownImageFileException('Unknown type of image.'); + } + + return self::invokeSafe('imagecreatefromstring', $s, 'Unable to open image from string.', __METHOD__); + } + + + private static function invokeSafe(string $func, string $arg, string $message, string $callee): static + { + $errors = []; + $res = Callback::invokeSafe($func, [$arg], function (string $message) use (&$errors): void { + $errors[] = $message; + }); + + if (!$res) { + throw new ImageException($message . ' Errors: ' . implode(', ', $errors)); + } elseif ($errors) { + trigger_error($callee . '(): ' . implode(', ', $errors), E_USER_WARNING); + } + + return new static($res); + } + + + /** + * Creates a new true color image of the given dimensions. The default color is black. + * @param positive-int $width + * @param positive-int $height + * @throws Nette\NotSupportedException if gd extension is not loaded + */ + public static function fromBlank(int $width, int $height, ImageColor|array|null $color = null): static + { + self::ensureExtension(); + if ($width < 1 || $height < 1) { + throw new Nette\InvalidArgumentException('Image width and height must be greater than zero.'); + } + + $image = new static(imagecreatetruecolor($width, $height)); + if ($color) { + $image->alphablending(false); + $image->filledrectangle(0, 0, $width - 1, $height - 1, $color); + $image->alphablending(true); + } + + return $image; + } + + + /** + * Returns the type of image from file. + * @return ImageType::*|null + */ + public static function detectTypeFromFile(string $file, &$width = null, &$height = null): ?int + { + [$width, $height, $type] = @getimagesize($file); // @ - files smaller than 12 bytes causes read error + return isset(self::Formats[$type]) ? $type : null; + } + + + /** + * Returns the type of image from string. + * @return ImageType::*|null + */ + public static function detectTypeFromString(string $s, &$width = null, &$height = null): ?int + { + [$width, $height, $type] = @getimagesizefromstring($s); // @ - strings smaller than 12 bytes causes read error + return isset(self::Formats[$type]) ? $type : null; + } + + + /** + * Returns the file extension for the given image type. + * @param ImageType::* $type + * @return value-of<self::Formats> + */ + public static function typeToExtension(int $type): string + { + if (!isset(self::Formats[$type])) { + throw new Nette\InvalidArgumentException("Unsupported image type '$type'."); + } + + return self::Formats[$type]; + } + + + /** + * Returns the image type for given file extension. + * @return ImageType::* + */ + public static function extensionToType(string $extension): int + { + $extensions = array_flip(self::Formats) + ['jpg' => ImageType::JPEG]; + $extension = strtolower($extension); + if (!isset($extensions[$extension])) { + throw new Nette\InvalidArgumentException("Unsupported file extension '$extension'."); + } + + return $extensions[$extension]; + } + + + /** + * Returns the mime type for the given image type. + * @param ImageType::* $type + */ + public static function typeToMimeType(int $type): string + { + return 'image/' . self::typeToExtension($type); + } + + + /** + * @param ImageType::* $type + */ + public static function isTypeSupported(int $type): bool + { + self::ensureExtension(); + return (bool) (imagetypes() & match ($type) { + ImageType::JPEG => IMG_JPG, + ImageType::PNG => IMG_PNG, + ImageType::GIF => IMG_GIF, + ImageType::WEBP => IMG_WEBP, + ImageType::AVIF => 256, // IMG_AVIF, + ImageType::BMP => IMG_BMP, + default => 0, + }); + } + + + /** @return ImageType[] */ + public static function getSupportedTypes(): array + { + self::ensureExtension(); + $flag = imagetypes(); + return array_filter([ + $flag & IMG_GIF ? ImageType::GIF : null, + $flag & IMG_JPG ? ImageType::JPEG : null, + $flag & IMG_PNG ? ImageType::PNG : null, + $flag & IMG_WEBP ? ImageType::WEBP : null, + $flag & 256 ? ImageType::AVIF : null, // IMG_AVIF + $flag & IMG_BMP ? ImageType::BMP : null, + ]); + } + + + /** + * Wraps GD image. + */ + public function __construct(\GdImage $image) + { + $this->setImageResource($image); + imagesavealpha($image, true); + } + + + /** + * Returns image width. + * @return positive-int + */ + public function getWidth(): int + { + return imagesx($this->image); + } + + + /** + * Returns image height. + * @return positive-int + */ + public function getHeight(): int + { + return imagesy($this->image); + } + + + /** + * Sets image resource. + */ + protected function setImageResource(\GdImage $image): static + { + $this->image = $image; + return $this; + } + + + /** + * Returns image GD resource. + */ + public function getImageResource(): \GdImage + { + return $this->image; + } + + + /** + * Scales an image. Width and height accept pixels or percent. + * @param int-mask-of<self::OrSmaller|self::OrBigger|self::Stretch|self::Cover|self::ShrinkOnly> $mode + */ + public function resize(int|string|null $width, int|string|null $height, int $mode = self::OrSmaller): static + { + if ($mode & self::Cover) { + return $this->resize($width, $height, self::OrBigger)->crop('50%', '50%', $width, $height); + } + + [$newWidth, $newHeight] = static::calculateSize($this->getWidth(), $this->getHeight(), $width, $height, $mode); + + if ($newWidth !== $this->getWidth() || $newHeight !== $this->getHeight()) { // resize + $newImage = static::fromBlank($newWidth, $newHeight, ImageColor::rgb(0, 0, 0, 0))->getImageResource(); + imagecopyresampled( + $newImage, + $this->image, + 0, + 0, + 0, + 0, + $newWidth, + $newHeight, + $this->getWidth(), + $this->getHeight(), + ); + $this->image = $newImage; + } + + if ($width < 0 || $height < 0) { + imageflip($this->image, $width < 0 ? ($height < 0 ? IMG_FLIP_BOTH : IMG_FLIP_HORIZONTAL) : IMG_FLIP_VERTICAL); + } + + return $this; + } + + + /** + * Calculates dimensions of resized image. Width and height accept pixels or percent. + * @param int-mask-of<self::OrSmaller|self::OrBigger|self::Stretch|self::Cover|self::ShrinkOnly> $mode + */ + public static function calculateSize( + int $srcWidth, + int $srcHeight, + $newWidth, + $newHeight, + int $mode = self::OrSmaller, + ): array + { + if ($newWidth === null) { + } elseif (self::isPercent($newWidth)) { + $newWidth = (int) round($srcWidth / 100 * abs($newWidth)); + $percents = true; + } else { + $newWidth = abs($newWidth); + } + + if ($newHeight === null) { + } elseif (self::isPercent($newHeight)) { + $newHeight = (int) round($srcHeight / 100 * abs($newHeight)); + $mode |= empty($percents) ? 0 : self::Stretch; + } else { + $newHeight = abs($newHeight); + } + + if ($mode & self::Stretch) { // non-proportional + if (!$newWidth || !$newHeight) { + throw new Nette\InvalidArgumentException('For stretching must be both width and height specified.'); + } + + if ($mode & self::ShrinkOnly) { + $newWidth = min($srcWidth, $newWidth); + $newHeight = min($srcHeight, $newHeight); + } + } else { // proportional + if (!$newWidth && !$newHeight) { + throw new Nette\InvalidArgumentException('At least width or height must be specified.'); + } + + $scale = []; + if ($newWidth > 0) { // fit width + $scale[] = $newWidth / $srcWidth; + } + + if ($newHeight > 0) { // fit height + $scale[] = $newHeight / $srcHeight; + } + + if ($mode & self::OrBigger) { + $scale = [max($scale)]; + } + + if ($mode & self::ShrinkOnly) { + $scale[] = 1; + } + + $scale = min($scale); + $newWidth = (int) round($srcWidth * $scale); + $newHeight = (int) round($srcHeight * $scale); + } + + return [max($newWidth, 1), max($newHeight, 1)]; + } + + + /** + * Crops image. Arguments accepts pixels or percent. + */ + public function crop(int|string $left, int|string $top, int|string $width, int|string $height): static + { + [$r['x'], $r['y'], $r['width'], $r['height']] + = static::calculateCutout($this->getWidth(), $this->getHeight(), $left, $top, $width, $height); + if (gd_info()['GD Version'] === 'bundled (2.1.0 compatible)') { + $this->image = imagecrop($this->image, $r); + imagesavealpha($this->image, true); + } else { + $newImage = static::fromBlank($r['width'], $r['height'], ImageColor::rgb(0, 0, 0, 0))->getImageResource(); + imagecopy($newImage, $this->image, 0, 0, $r['x'], $r['y'], $r['width'], $r['height']); + $this->image = $newImage; + } + + return $this; + } + + + /** + * Calculates dimensions of cutout in image. Arguments accepts pixels or percent. + */ + public static function calculateCutout( + int $srcWidth, + int $srcHeight, + int|string $left, + int|string $top, + int|string $newWidth, + int|string $newHeight, + ): array + { + if (self::isPercent($newWidth)) { + $newWidth = (int) round($srcWidth / 100 * $newWidth); + } + + if (self::isPercent($newHeight)) { + $newHeight = (int) round($srcHeight / 100 * $newHeight); + } + + if (self::isPercent($left)) { + $left = (int) round(($srcWidth - $newWidth) / 100 * $left); + } + + if (self::isPercent($top)) { + $top = (int) round(($srcHeight - $newHeight) / 100 * $top); + } + + if ($left < 0) { + $newWidth += $left; + $left = 0; + } + + if ($top < 0) { + $newHeight += $top; + $top = 0; + } + + $newWidth = min($newWidth, $srcWidth - $left); + $newHeight = min($newHeight, $srcHeight - $top); + return [$left, $top, $newWidth, $newHeight]; + } + + + /** + * Sharpens image a little bit. + */ + public function sharpen(): static + { + imageconvolution($this->image, [ // my magic numbers ;) + [-1, -1, -1], + [-1, 24, -1], + [-1, -1, -1], + ], 16, 0); + return $this; + } + + + /** + * Puts another image into this image. Left and top accepts pixels or percent. + * @param int<0, 100> $opacity 0..100 + */ + public function place(self $image, int|string $left = 0, int|string $top = 0, int $opacity = 100): static + { + $opacity = max(0, min(100, $opacity)); + if ($opacity === 0) { + return $this; + } + + $width = $image->getWidth(); + $height = $image->getHeight(); + + if (self::isPercent($left)) { + $left = (int) round(($this->getWidth() - $width) / 100 * $left); + } + + if (self::isPercent($top)) { + $top = (int) round(($this->getHeight() - $height) / 100 * $top); + } + + $output = $input = $image->image; + if ($opacity < 100) { + $tbl = []; + for ($i = 0; $i < 128; $i++) { + $tbl[$i] = round(127 - (127 - $i) * $opacity / 100); + } + + $output = imagecreatetruecolor($width, $height); + imagealphablending($output, false); + if (!$image->isTrueColor()) { + $input = $output; + imagefilledrectangle($output, 0, 0, $width, $height, imagecolorallocatealpha($output, 0, 0, 0, 127)); + imagecopy($output, $image->image, 0, 0, 0, 0, $width, $height); + } + + for ($x = 0; $x < $width; $x++) { + for ($y = 0; $y < $height; $y++) { + $c = \imagecolorat($input, $x, $y); + $c = ($c & 0xFFFFFF) + ($tbl[$c >> 24] << 24); + \imagesetpixel($output, $x, $y, $c); + } + } + + imagealphablending($output, true); + } + + imagecopy( + $this->image, + $output, + $left, + $top, + 0, + 0, + $width, + $height, + ); + return $this; + } + + + /** + * Calculates the bounding box for a TrueType text. Returns keys left, top, width and height. + */ + public static function calculateTextBox( + string $text, + string $fontFile, + float $size, + float $angle = 0, + array $options = [], + ): array + { + self::ensureExtension(); + $box = imagettfbbox($size, $angle, $fontFile, $text, $options); + return [ + 'left' => $minX = min([$box[0], $box[2], $box[4], $box[6]]), + 'top' => $minY = min([$box[1], $box[3], $box[5], $box[7]]), + 'width' => max([$box[0], $box[2], $box[4], $box[6]]) - $minX + 1, + 'height' => max([$box[1], $box[3], $box[5], $box[7]]) - $minY + 1, + ]; + } + + + /** + * Draw a rectangle. + */ + public function rectangleWH(int $x, int $y, int $width, int $height, ImageColor $color): void + { + if ($width !== 0 && $height !== 0) { + $this->rectangle($x, $y, $x + $width + ($width > 0 ? -1 : 1), $y + $height + ($height > 0 ? -1 : 1), $color); + } + } + + + /** + * Draw a filled rectangle. + */ + public function filledRectangleWH(int $x, int $y, int $width, int $height, ImageColor $color): void + { + if ($width !== 0 && $height !== 0) { + $this->filledRectangle($x, $y, $x + $width + ($width > 0 ? -1 : 1), $y + $height + ($height > 0 ? -1 : 1), $color); + } + } + + + /** + * Saves image to the file. Quality is in the range 0..100 for JPEG (default 85), WEBP (default 80) and AVIF (default 30) and 0..9 for PNG (default 9). + * @param ImageType::*|null $type + * @throws ImageException + */ + public function save(string $file, ?int $quality = null, ?int $type = null): void + { + $type ??= self::extensionToType(pathinfo($file, PATHINFO_EXTENSION)); + $this->output($type, $quality, $file); + } + + + /** + * Outputs image to string. Quality is in the range 0..100 for JPEG (default 85), WEBP (default 80) and AVIF (default 30) and 0..9 for PNG (default 9). + * @param ImageType::* $type + */ + public function toString(int $type = ImageType::JPEG, ?int $quality = null): string + { + return Helpers::capture(function () use ($type, $quality): void { + $this->output($type, $quality); + }); + } + + + /** + * Outputs image to string. + */ + public function __toString(): string + { + return $this->toString(); + } + + + /** + * Outputs image to browser. Quality is in the range 0..100 for JPEG (default 85), WEBP (default 80) and AVIF (default 30) and 0..9 for PNG (default 9). + * @param ImageType::* $type + * @throws ImageException + */ + public function send(int $type = ImageType::JPEG, ?int $quality = null): void + { + header('Content-Type: ' . self::typeToMimeType($type)); + $this->output($type, $quality); + } + + + /** + * Outputs image to browser or file. + * @param ImageType::* $type + * @throws ImageException + */ + private function output(int $type, ?int $quality, ?string $file = null): void + { + switch ($type) { + case ImageType::JPEG: + $quality = $quality === null ? 85 : max(0, min(100, $quality)); + $success = @imagejpeg($this->image, $file, $quality); // @ is escalated to exception + break; + + case ImageType::PNG: + $quality = $quality === null ? 9 : max(0, min(9, $quality)); + $success = @imagepng($this->image, $file, $quality); // @ is escalated to exception + break; + + case ImageType::GIF: + $success = @imagegif($this->image, $file); // @ is escalated to exception + break; + + case ImageType::WEBP: + $quality = $quality === null ? 80 : max(0, min(100, $quality)); + $success = @imagewebp($this->image, $file, $quality); // @ is escalated to exception + break; + + case ImageType::AVIF: + $quality = $quality === null ? 30 : max(0, min(100, $quality)); + $success = @imageavif($this->image, $file, $quality); // @ is escalated to exception + break; + + case ImageType::BMP: + $success = @imagebmp($this->image, $file); // @ is escalated to exception + break; + + default: + throw new Nette\InvalidArgumentException("Unsupported image type '$type'."); + } + + if (!$success) { + throw new ImageException(Helpers::getLastError() ?: 'Unknown error'); + } + } + + + /** + * Call to undefined method. + * @throws Nette\MemberAccessException + */ + public function __call(string $name, array $args): mixed + { + $function = 'image' . $name; + if (!function_exists($function)) { + ObjectHelpers::strictCall(static::class, $name); + } + + foreach ($args as $key => $value) { + if ($value instanceof self) { + $args[$key] = $value->getImageResource(); + + } elseif ($value instanceof ImageColor || (is_array($value) && isset($value['red']))) { + $args[$key] = $this->resolveColor($value); + } + } + + $res = $function($this->image, ...$args); + return $res instanceof \GdImage + ? $this->setImageResource($res) + : $res; + } + + + public function __clone() + { + ob_start(function () {}); + imagepng($this->image, null, 0); + $this->setImageResource(imagecreatefromstring(ob_get_clean())); + } + + + private static function isPercent(int|string &$num): bool + { + if (is_string($num) && str_ends_with($num, '%')) { + $num = (float) substr($num, 0, -1); + return true; + } elseif (is_int($num) || $num === (string) (int) $num) { + $num = (int) $num; + return false; + } + + throw new Nette\InvalidArgumentException("Expected dimension in int|string, '$num' given."); + } + + + /** + * Prevents serialization. + */ + public function __sleep(): array + { + throw new Nette\NotSupportedException('You cannot serialize or unserialize ' . self::class . ' instances.'); + } + + + public function resolveColor(ImageColor|array $color): int + { + $color = $color instanceof ImageColor ? $color->toRGBA() : array_values($color); + return imagecolorallocatealpha($this->image, ...$color) ?: imagecolorresolvealpha($this->image, ...$color); + } + + + private static function ensureExtension(): void + { + if (!extension_loaded('gd')) { + throw new Nette\NotSupportedException('PHP extension GD is not loaded.'); + } + } +} diff --git a/vendor/nette/utils/src/Utils/ImageColor.php b/vendor/nette/utils/src/Utils/ImageColor.php new file mode 100644 index 00000000..013adbd6 --- /dev/null +++ b/vendor/nette/utils/src/Utils/ImageColor.php @@ -0,0 +1,75 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + +use Nette; + + +/** + * Represent RGB color (0..255) with opacity (0..1). + */ +class ImageColor +{ + public static function rgb(int $red, int $green, int $blue, float $opacity = 1): self + { + return new self($red, $green, $blue, $opacity); + } + + + /** + * Accepts formats #RRGGBB, #RRGGBBAA, #RGB, #RGBA + */ + public static function hex(string $hex): self + { + $hex = ltrim($hex, '#'); + $len = strlen($hex); + if ($len === 3 || $len === 4) { + return new self( + (int) hexdec($hex[0]) * 17, + (int) hexdec($hex[1]) * 17, + (int) hexdec($hex[2]) * 17, + (int) hexdec($hex[3] ?? 'F') * 17 / 255, + ); + } elseif ($len === 6 || $len === 8) { + return new self( + (int) hexdec($hex[0] . $hex[1]), + (int) hexdec($hex[2] . $hex[3]), + (int) hexdec($hex[4] . $hex[5]), + (int) hexdec(($hex[6] ?? 'F') . ($hex[7] ?? 'F')) / 255, + ); + } else { + throw new Nette\InvalidArgumentException('Invalid hex color format.'); + } + } + + + private function __construct( + public int $red, + public int $green, + public int $blue, + public float $opacity = 1, + ) { + $this->red = max(0, min(255, $red)); + $this->green = max(0, min(255, $green)); + $this->blue = max(0, min(255, $blue)); + $this->opacity = max(0, min(1, $opacity)); + } + + + public function toRGBA(): array + { + return [ + max(0, min(255, $this->red)), + max(0, min(255, $this->green)), + max(0, min(255, $this->blue)), + max(0, min(127, (int) round(127 - $this->opacity * 127))), + ]; + } +} diff --git a/vendor/nette/utils/src/Utils/ImageType.php b/vendor/nette/utils/src/Utils/ImageType.php new file mode 100644 index 00000000..3092c8f0 --- /dev/null +++ b/vendor/nette/utils/src/Utils/ImageType.php @@ -0,0 +1,25 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + + +/** + * Type of image file. + */ +/*enum*/ final class ImageType +{ + public const + JPEG = IMAGETYPE_JPEG, + PNG = IMAGETYPE_PNG, + GIF = IMAGETYPE_GIF, + WEBP = IMAGETYPE_WEBP, + AVIF = 19, // IMAGETYPE_AVIF, + BMP = IMAGETYPE_BMP; +} diff --git a/vendor/nette/utils/src/Utils/Iterables.php b/vendor/nette/utils/src/Utils/Iterables.php new file mode 100644 index 00000000..cc751520 --- /dev/null +++ b/vendor/nette/utils/src/Utils/Iterables.php @@ -0,0 +1,238 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + +use Nette; + + +/** + * Utilities for iterables. + */ +final class Iterables +{ + use Nette\StaticClass; + + /** + * Tests for the presence of value. + */ + public static function contains(iterable $iterable, mixed $value): bool + { + foreach ($iterable as $v) { + if ($v === $value) { + return true; + } + } + return false; + } + + + /** + * Tests for the presence of key. + */ + public static function containsKey(iterable $iterable, mixed $key): bool + { + foreach ($iterable as $k => $v) { + if ($k === $key) { + return true; + } + } + return false; + } + + + /** + * Returns the first item (matching the specified predicate if given). If there is no such item, it returns result of invoking $else or null. + * @template K + * @template V + * @param iterable<K, V> $iterable + * @param ?callable(V, K, iterable<K, V>): bool $predicate + * @return ?V + */ + public static function first(iterable $iterable, ?callable $predicate = null, ?callable $else = null): mixed + { + foreach ($iterable as $k => $v) { + if (!$predicate || $predicate($v, $k, $iterable)) { + return $v; + } + } + return $else ? $else() : null; + } + + + /** + * Returns the key of first item (matching the specified predicate if given). If there is no such item, it returns result of invoking $else or null. + * @template K + * @template V + * @param iterable<K, V> $iterable + * @param ?callable(V, K, iterable<K, V>): bool $predicate + * @return ?K + */ + public static function firstKey(iterable $iterable, ?callable $predicate = null, ?callable $else = null): mixed + { + foreach ($iterable as $k => $v) { + if (!$predicate || $predicate($v, $k, $iterable)) { + return $k; + } + } + return $else ? $else() : null; + } + + + /** + * Tests whether at least one element in the iterator passes the test implemented by the provided function. + * @template K + * @template V + * @param iterable<K, V> $iterable + * @param callable(V, K, iterable<K, V>): bool $predicate + */ + public static function some(iterable $iterable, callable $predicate): bool + { + foreach ($iterable as $k => $v) { + if ($predicate($v, $k, $iterable)) { + return true; + } + } + return false; + } + + + /** + * Tests whether all elements in the iterator pass the test implemented by the provided function. + * @template K + * @template V + * @param iterable<K, V> $iterable + * @param callable(V, K, iterable<K, V>): bool $predicate + */ + public static function every(iterable $iterable, callable $predicate): bool + { + foreach ($iterable as $k => $v) { + if (!$predicate($v, $k, $iterable)) { + return false; + } + } + return true; + } + + + /** + * Iterator that filters elements according to a given $predicate. Maintains original keys. + * @template K + * @template V + * @param iterable<K, V> $iterable + * @param callable(V, K, iterable<K, V>): bool $predicate + * @return \Generator<K, V> + */ + public static function filter(iterable $iterable, callable $predicate): \Generator + { + foreach ($iterable as $k => $v) { + if ($predicate($v, $k, $iterable)) { + yield $k => $v; + } + } + } + + + /** + * Iterator that transforms values by calling $transformer. Maintains original keys. + * @template K + * @template V + * @template R + * @param iterable<K, V> $iterable + * @param callable(V, K, iterable<K, V>): R $transformer + * @return \Generator<K, R> + */ + public static function map(iterable $iterable, callable $transformer): \Generator + { + foreach ($iterable as $k => $v) { + yield $k => $transformer($v, $k, $iterable); + } + } + + + /** + * Iterator that transforms keys and values by calling $transformer. If it returns null, the element is skipped. + * @template K + * @template V + * @template ResV + * @template ResK + * @param iterable<K, V> $iterable + * @param callable(V, K, iterable<K, V>): ?array{ResV, ResK} $transformer + * @return \Generator<ResV, ResK> + */ + public static function mapWithKeys(iterable $iterable, callable $transformer): \Generator + { + foreach ($iterable as $k => $v) { + $pair = $transformer($v, $k, $iterable); + if ($pair) { + yield $pair[0] => $pair[1]; + } + } + } + + + /** + * Wraps around iterator and caches its keys and values during iteration. + * This allows the data to be re-iterated multiple times. + * @template K + * @template V + * @param iterable<K, V> $iterable + * @return \IteratorAggregate<K, V> + */ + public static function memoize(iterable $iterable): iterable + { + return new class (self::toIterator($iterable)) implements \IteratorAggregate { + public function __construct( + private \Iterator $iterator, + private array $cache = [], + ) { + } + + + public function getIterator(): \Generator + { + if (!$this->cache) { + $this->iterator->rewind(); + } + $i = 0; + while (true) { + if (isset($this->cache[$i])) { + [$k, $v] = $this->cache[$i]; + } elseif ($this->iterator->valid()) { + $k = $this->iterator->key(); + $v = $this->iterator->current(); + $this->iterator->next(); + $this->cache[$i] = [$k, $v]; + } else { + break; + } + yield $k => $v; + $i++; + } + } + }; + } + + + /** + * Creates an iterator from anything that is iterable. + * @template K + * @template V + * @param iterable<K, V> $iterable + * @return \Iterator<K, V> + */ + public static function toIterator(iterable $iterable): \Iterator + { + return match (true) { + $iterable instanceof \Iterator => $iterable, + $iterable instanceof \IteratorAggregate => self::toIterator($iterable->getIterator()), + is_array($iterable) => new \ArrayIterator($iterable), + }; + } +} diff --git a/vendor/nette/utils/src/Utils/Json.php b/vendor/nette/utils/src/Utils/Json.php new file mode 100644 index 00000000..b87917b2 --- /dev/null +++ b/vendor/nette/utils/src/Utils/Json.php @@ -0,0 +1,84 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + +use Nette; + + +/** + * JSON encoder and decoder. + */ +final class Json +{ + use Nette\StaticClass; + + /** @deprecated use Json::decode(..., forceArrays: true) */ + public const FORCE_ARRAY = JSON_OBJECT_AS_ARRAY; + + /** @deprecated use Json::encode(..., pretty: true) */ + public const PRETTY = JSON_PRETTY_PRINT; + + /** @deprecated use Json::encode(..., asciiSafe: true) */ + public const ESCAPE_UNICODE = 1 << 19; + + + /** + * Converts value to JSON format. Use $pretty for easier reading and clarity, $asciiSafe for ASCII output + * and $htmlSafe for HTML escaping, $forceObjects enforces the encoding of non-associateve arrays as objects. + * @throws JsonException + */ + public static function encode( + mixed $value, + bool|int $pretty = false, + bool $asciiSafe = false, + bool $htmlSafe = false, + bool $forceObjects = false, + ): string + { + if (is_int($pretty)) { // back compatibility + $flags = ($pretty & self::ESCAPE_UNICODE ? 0 : JSON_UNESCAPED_UNICODE) | ($pretty & ~self::ESCAPE_UNICODE); + } else { + $flags = ($asciiSafe ? 0 : JSON_UNESCAPED_UNICODE) + | ($pretty ? JSON_PRETTY_PRINT : 0) + | ($forceObjects ? JSON_FORCE_OBJECT : 0) + | ($htmlSafe ? JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_TAG : 0); + } + + $flags |= JSON_UNESCAPED_SLASHES + | (defined('JSON_PRESERVE_ZERO_FRACTION') ? JSON_PRESERVE_ZERO_FRACTION : 0); // since PHP 5.6.6 & PECL JSON-C 1.3.7 + + $json = json_encode($value, $flags); + if ($error = json_last_error()) { + throw new JsonException(json_last_error_msg(), $error); + } + + return $json; + } + + + /** + * Parses JSON to PHP value. The $forceArrays enforces the decoding of objects as arrays. + * @throws JsonException + */ + public static function decode(string $json, bool|int $forceArrays = false): mixed + { + $flags = is_int($forceArrays) // back compatibility + ? $forceArrays + : ($forceArrays ? JSON_OBJECT_AS_ARRAY : 0); + $flags |= JSON_BIGINT_AS_STRING; + + $value = json_decode($json, flags: $flags); + if ($error = json_last_error()) { + throw new JsonException(json_last_error_msg(), $error); + } + + return $value; + } +} diff --git a/vendor/nette/utils/src/Utils/ObjectHelpers.php b/vendor/nette/utils/src/Utils/ObjectHelpers.php new file mode 100644 index 00000000..f4bd55f2 --- /dev/null +++ b/vendor/nette/utils/src/Utils/ObjectHelpers.php @@ -0,0 +1,229 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + +use Nette; +use Nette\MemberAccessException; + + +/** + * Nette\SmartObject helpers. + * @internal + */ +final class ObjectHelpers +{ + use Nette\StaticClass; + + /** + * @return never + * @throws MemberAccessException + */ + public static function strictGet(string $class, string $name): void + { + $rc = new \ReflectionClass($class); + $hint = self::getSuggestion(array_merge( + array_filter($rc->getProperties(\ReflectionProperty::IS_PUBLIC), fn($p) => !$p->isStatic()), + self::parseFullDoc($rc, '~^[ \t*]*@property(?:-read)?[ \t]+(?:\S+[ \t]+)??\$(\w+)~m'), + ), $name); + throw new MemberAccessException("Cannot read an undeclared property $class::\$$name" . ($hint ? ", did you mean \$$hint?" : '.')); + } + + + /** + * @return never + * @throws MemberAccessException + */ + public static function strictSet(string $class, string $name): void + { + $rc = new \ReflectionClass($class); + $hint = self::getSuggestion(array_merge( + array_filter($rc->getProperties(\ReflectionProperty::IS_PUBLIC), fn($p) => !$p->isStatic()), + self::parseFullDoc($rc, '~^[ \t*]*@property(?:-write)?[ \t]+(?:\S+[ \t]+)??\$(\w+)~m'), + ), $name); + throw new MemberAccessException("Cannot write to an undeclared property $class::\$$name" . ($hint ? ", did you mean \$$hint?" : '.')); + } + + + /** + * @return never + * @throws MemberAccessException + */ + public static function strictCall(string $class, string $method, array $additionalMethods = []): void + { + $trace = debug_backtrace(0, 3); // suppose this method is called from __call() + $context = ($trace[1]['function'] ?? null) === '__call' + ? ($trace[2]['class'] ?? null) + : null; + + if ($context && is_a($class, $context, true) && method_exists($context, $method)) { // called parent::$method() + $class = get_parent_class($context); + } + + if (method_exists($class, $method)) { // insufficient visibility + $rm = new \ReflectionMethod($class, $method); + $visibility = $rm->isPrivate() + ? 'private ' + : ($rm->isProtected() ? 'protected ' : ''); + throw new MemberAccessException("Call to {$visibility}method $class::$method() from " . ($context ? "scope $context." : 'global scope.')); + + } else { + $hint = self::getSuggestion(array_merge( + get_class_methods($class), + self::parseFullDoc(new \ReflectionClass($class), '~^[ \t*]*@method[ \t]+(?:static[ \t]+)?(?:\S+[ \t]+)??(\w+)\(~m'), + $additionalMethods, + ), $method); + throw new MemberAccessException("Call to undefined method $class::$method()" . ($hint ? ", did you mean $hint()?" : '.')); + } + } + + + /** + * @return never + * @throws MemberAccessException + */ + public static function strictStaticCall(string $class, string $method): void + { + $trace = debug_backtrace(0, 3); // suppose this method is called from __callStatic() + $context = ($trace[1]['function'] ?? null) === '__callStatic' + ? ($trace[2]['class'] ?? null) + : null; + + if ($context && is_a($class, $context, true) && method_exists($context, $method)) { // called parent::$method() + $class = get_parent_class($context); + } + + if (method_exists($class, $method)) { // insufficient visibility + $rm = new \ReflectionMethod($class, $method); + $visibility = $rm->isPrivate() + ? 'private ' + : ($rm->isProtected() ? 'protected ' : ''); + throw new MemberAccessException("Call to {$visibility}method $class::$method() from " . ($context ? "scope $context." : 'global scope.')); + + } else { + $hint = self::getSuggestion( + array_filter((new \ReflectionClass($class))->getMethods(\ReflectionMethod::IS_PUBLIC), fn($m) => $m->isStatic()), + $method, + ); + throw new MemberAccessException("Call to undefined static method $class::$method()" . ($hint ? ", did you mean $hint()?" : '.')); + } + } + + + /** + * Returns array of magic properties defined by annotation @property. + * @return array of [name => bit mask] + * @internal + */ + public static function getMagicProperties(string $class): array + { + static $cache; + $props = &$cache[$class]; + if ($props !== null) { + return $props; + } + + $rc = new \ReflectionClass($class); + preg_match_all( + '~^ [ \t*]* @property(|-read|-write|-deprecated) [ \t]+ [^\s$]+ [ \t]+ \$ (\w+) ()~mx', + (string) $rc->getDocComment(), + $matches, + PREG_SET_ORDER, + ); + + $props = []; + foreach ($matches as [, $type, $name]) { + $uname = ucfirst($name); + $write = $type !== '-read' + && $rc->hasMethod($nm = 'set' . $uname) + && ($rm = $rc->getMethod($nm))->name === $nm && !$rm->isPrivate() && !$rm->isStatic(); + $read = $type !== '-write' + && ($rc->hasMethod($nm = 'get' . $uname) || $rc->hasMethod($nm = 'is' . $uname)) + && ($rm = $rc->getMethod($nm))->name === $nm && !$rm->isPrivate() && !$rm->isStatic(); + + if ($read || $write) { + $props[$name] = $read << 0 | ($nm[0] === 'g') << 1 | $rm->returnsReference() << 2 | $write << 3 | ($type === '-deprecated') << 4; + } + } + + foreach ($rc->getTraits() as $trait) { + $props += self::getMagicProperties($trait->name); + } + + if ($parent = get_parent_class($class)) { + $props += self::getMagicProperties($parent); + } + + return $props; + } + + + /** + * Finds the best suggestion (for 8-bit encoding). + * @param (\ReflectionFunctionAbstract|\ReflectionParameter|\ReflectionClass|\ReflectionProperty|string)[] $possibilities + * @internal + */ + public static function getSuggestion(array $possibilities, string $value): ?string + { + $norm = preg_replace($re = '#^(get|set|has|is|add)(?=[A-Z])#', '+', $value); + $best = null; + $min = (strlen($value) / 4 + 1) * 10 + .1; + foreach (array_unique($possibilities, SORT_REGULAR) as $item) { + $item = $item instanceof \Reflector ? $item->name : $item; + if ($item !== $value && ( + ($len = levenshtein($item, $value, 10, 11, 10)) < $min + || ($len = levenshtein(preg_replace($re, '*', $item), $norm, 10, 11, 10)) < $min + )) { + $min = $len; + $best = $item; + } + } + + return $best; + } + + + private static function parseFullDoc(\ReflectionClass $rc, string $pattern): array + { + do { + $doc[] = $rc->getDocComment(); + $traits = $rc->getTraits(); + while ($trait = array_pop($traits)) { + $doc[] = $trait->getDocComment(); + $traits += $trait->getTraits(); + } + } while ($rc = $rc->getParentClass()); + + return preg_match_all($pattern, implode('', $doc), $m) ? $m[1] : []; + } + + + /** + * Checks if the public non-static property exists. + * Returns 'event' if the property exists and has event like name + * @internal + */ + public static function hasProperty(string $class, string $name): bool|string + { + static $cache; + $prop = &$cache[$class][$name]; + if ($prop === null) { + $prop = false; + try { + $rp = new \ReflectionProperty($class, $name); + if ($rp->isPublic() && !$rp->isStatic()) { + $prop = $name >= 'onA' && $name < 'on_' ? 'event' : true; + } + } catch (\ReflectionException $e) { + } + } + + return $prop; + } +} diff --git a/vendor/nette/utils/src/Utils/Paginator.php b/vendor/nette/utils/src/Utils/Paginator.php new file mode 100644 index 00000000..aa4812c0 --- /dev/null +++ b/vendor/nette/utils/src/Utils/Paginator.php @@ -0,0 +1,245 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + +use Nette; + + +/** + * Paginating math. + * + * @property int $page + * @property-read int $firstPage + * @property-read int|null $lastPage + * @property-read int<0,max> $firstItemOnPage + * @property-read int<0,max> $lastItemOnPage + * @property int $base + * @property-read bool $first + * @property-read bool $last + * @property-read int<0,max>|null $pageCount + * @property positive-int $itemsPerPage + * @property int<0,max>|null $itemCount + * @property-read int<0,max> $offset + * @property-read int<0,max>|null $countdownOffset + * @property-read int<0,max> $length + */ +class Paginator +{ + use Nette\SmartObject; + + private int $base = 1; + + /** @var positive-int */ + private int $itemsPerPage = 1; + + private int $page = 1; + + /** @var int<0, max>|null */ + private ?int $itemCount = null; + + + /** + * Sets current page number. + */ + public function setPage(int $page): static + { + $this->page = $page; + return $this; + } + + + /** + * Returns current page number. + */ + public function getPage(): int + { + return $this->base + $this->getPageIndex(); + } + + + /** + * Returns first page number. + */ + public function getFirstPage(): int + { + return $this->base; + } + + + /** + * Returns last page number. + */ + public function getLastPage(): ?int + { + return $this->itemCount === null + ? null + : $this->base + max(0, $this->getPageCount() - 1); + } + + + /** + * Returns the sequence number of the first element on the page + * @return int<0, max> + */ + public function getFirstItemOnPage(): int + { + return $this->itemCount !== 0 + ? $this->offset + 1 + : 0; + } + + + /** + * Returns the sequence number of the last element on the page + * @return int<0, max> + */ + public function getLastItemOnPage(): int + { + return $this->offset + $this->length; + } + + + /** + * Sets first page (base) number. + */ + public function setBase(int $base): static + { + $this->base = $base; + return $this; + } + + + /** + * Returns first page (base) number. + */ + public function getBase(): int + { + return $this->base; + } + + + /** + * Returns zero-based page number. + * @return int<0, max> + */ + protected function getPageIndex(): int + { + $index = max(0, $this->page - $this->base); + return $this->itemCount === null + ? $index + : min($index, max(0, $this->getPageCount() - 1)); + } + + + /** + * Is the current page the first one? + */ + public function isFirst(): bool + { + return $this->getPageIndex() === 0; + } + + + /** + * Is the current page the last one? + */ + public function isLast(): bool + { + return $this->itemCount === null + ? false + : $this->getPageIndex() >= $this->getPageCount() - 1; + } + + + /** + * Returns the total number of pages. + * @return int<0, max>|null + */ + public function getPageCount(): ?int + { + return $this->itemCount === null + ? null + : (int) ceil($this->itemCount / $this->itemsPerPage); + } + + + /** + * Sets the number of items to display on a single page. + */ + public function setItemsPerPage(int $itemsPerPage): static + { + $this->itemsPerPage = max(1, $itemsPerPage); + return $this; + } + + + /** + * Returns the number of items to display on a single page. + * @return positive-int + */ + public function getItemsPerPage(): int + { + return $this->itemsPerPage; + } + + + /** + * Sets the total number of items. + */ + public function setItemCount(?int $itemCount = null): static + { + $this->itemCount = $itemCount === null ? null : max(0, $itemCount); + return $this; + } + + + /** + * Returns the total number of items. + * @return int<0, max>|null + */ + public function getItemCount(): ?int + { + return $this->itemCount; + } + + + /** + * Returns the absolute index of the first item on current page. + * @return int<0, max> + */ + public function getOffset(): int + { + return $this->getPageIndex() * $this->itemsPerPage; + } + + + /** + * Returns the absolute index of the first item on current page in countdown paging. + * @return int<0, max>|null + */ + public function getCountdownOffset(): ?int + { + return $this->itemCount === null + ? null + : max(0, $this->itemCount - ($this->getPageIndex() + 1) * $this->itemsPerPage); + } + + + /** + * Returns the number of items on current page. + * @return int<0, max> + */ + public function getLength(): int + { + return $this->itemCount === null + ? $this->itemsPerPage + : min($this->itemsPerPage, $this->itemCount - $this->getPageIndex() * $this->itemsPerPage); + } +} diff --git a/vendor/nette/utils/src/Utils/Random.php b/vendor/nette/utils/src/Utils/Random.php new file mode 100644 index 00000000..b14fbd55 --- /dev/null +++ b/vendor/nette/utils/src/Utils/Random.php @@ -0,0 +1,52 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + +use Nette; +use Random\Randomizer; + + +/** + * Secure random string generator. + */ +final class Random +{ + use Nette\StaticClass; + + /** + * Generates a random string of given length from characters specified in second argument. + * Supports intervals, such as `0-9` or `A-Z`. + */ + public static function generate(int $length = 10, string $charlist = '0-9a-z'): string + { + $charlist = preg_replace_callback( + '#.-.#', + fn(array $m): string => implode('', range($m[0][0], $m[0][2])), + $charlist, + ); + $charlist = count_chars($charlist, mode: 3); + $chLen = strlen($charlist); + + if ($length < 1) { + throw new Nette\InvalidArgumentException('Length must be greater than zero.'); + } elseif ($chLen < 2) { + throw new Nette\InvalidArgumentException('Character list must contain at least two chars.'); + } elseif (PHP_VERSION_ID >= 80300) { + return (new Randomizer)->getBytesFromString($charlist, $length); + } + + $res = ''; + for ($i = 0; $i < $length; $i++) { + $res .= $charlist[random_int(0, $chLen - 1)]; + } + + return $res; + } +} diff --git a/vendor/nette/utils/src/Utils/Reflection.php b/vendor/nette/utils/src/Utils/Reflection.php new file mode 100644 index 00000000..87889be3 --- /dev/null +++ b/vendor/nette/utils/src/Utils/Reflection.php @@ -0,0 +1,322 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + +use Nette; + + +/** + * PHP reflection helpers. + */ +final class Reflection +{ + use Nette\StaticClass; + + /** @deprecated use Nette\Utils\Validator::isBuiltinType() */ + public static function isBuiltinType(string $type): bool + { + return Validators::isBuiltinType($type); + } + + + /** @deprecated use Nette\Utils\Validator::isClassKeyword() */ + public static function isClassKeyword(string $name): bool + { + return Validators::isClassKeyword($name); + } + + + /** @deprecated use native ReflectionParameter::getDefaultValue() */ + public static function getParameterDefaultValue(\ReflectionParameter $param): mixed + { + if ($param->isDefaultValueConstant()) { + $const = $orig = $param->getDefaultValueConstantName(); + $pair = explode('::', $const); + if (isset($pair[1])) { + $pair[0] = Type::resolve($pair[0], $param); + try { + $rcc = new \ReflectionClassConstant($pair[0], $pair[1]); + } catch (\ReflectionException $e) { + $name = self::toString($param); + throw new \ReflectionException("Unable to resolve constant $orig used as default value of $name.", 0, $e); + } + + return $rcc->getValue(); + + } elseif (!defined($const)) { + $const = substr((string) strrchr($const, '\\'), 1); + if (!defined($const)) { + $name = self::toString($param); + throw new \ReflectionException("Unable to resolve constant $orig used as default value of $name."); + } + } + + return constant($const); + } + + return $param->getDefaultValue(); + } + + + /** + * Returns a reflection of a class or trait that contains a declaration of given property. Property can also be declared in the trait. + */ + public static function getPropertyDeclaringClass(\ReflectionProperty $prop): \ReflectionClass + { + foreach ($prop->getDeclaringClass()->getTraits() as $trait) { + if ($trait->hasProperty($prop->name) + // doc-comment guessing as workaround for insufficient PHP reflection + && $trait->getProperty($prop->name)->getDocComment() === $prop->getDocComment() + ) { + return self::getPropertyDeclaringClass($trait->getProperty($prop->name)); + } + } + + return $prop->getDeclaringClass(); + } + + + /** + * Returns a reflection of a method that contains a declaration of $method. + * Usually, each method is its own declaration, but the body of the method can also be in the trait and under a different name. + */ + public static function getMethodDeclaringMethod(\ReflectionMethod $method): \ReflectionMethod + { + // file & line guessing as workaround for insufficient PHP reflection + $decl = $method->getDeclaringClass(); + if ($decl->getFileName() === $method->getFileName() + && $decl->getStartLine() <= $method->getStartLine() + && $decl->getEndLine() >= $method->getEndLine() + ) { + return $method; + } + + $hash = [$method->getFileName(), $method->getStartLine(), $method->getEndLine()]; + if (($alias = $decl->getTraitAliases()[$method->name] ?? null) + && ($m = new \ReflectionMethod(...explode('::', $alias, 2))) + && $hash === [$m->getFileName(), $m->getStartLine(), $m->getEndLine()] + ) { + return self::getMethodDeclaringMethod($m); + } + + foreach ($decl->getTraits() as $trait) { + if ($trait->hasMethod($method->name) + && ($m = $trait->getMethod($method->name)) + && $hash === [$m->getFileName(), $m->getStartLine(), $m->getEndLine()] + ) { + return self::getMethodDeclaringMethod($m); + } + } + + return $method; + } + + + /** + * Finds out if reflection has access to PHPdoc comments. Comments may not be available due to the opcode cache. + */ + public static function areCommentsAvailable(): bool + { + static $res; + return $res ?? $res = (bool) (new \ReflectionMethod(self::class, __FUNCTION__))->getDocComment(); + } + + + public static function toString(\Reflector $ref): string + { + if ($ref instanceof \ReflectionClass) { + return $ref->name; + } elseif ($ref instanceof \ReflectionMethod) { + return $ref->getDeclaringClass()->name . '::' . $ref->name . '()'; + } elseif ($ref instanceof \ReflectionFunction) { + return PHP_VERSION_ID >= 80200 && $ref->isAnonymous() + ? '{closure}()' + : $ref->name . '()'; + } elseif ($ref instanceof \ReflectionProperty) { + return self::getPropertyDeclaringClass($ref)->name . '::$' . $ref->name; + } elseif ($ref instanceof \ReflectionParameter) { + return '$' . $ref->name . ' in ' . self::toString($ref->getDeclaringFunction()); + } else { + throw new Nette\InvalidArgumentException; + } + } + + + /** + * Expands the name of the class to full name in the given context of given class. + * Thus, it returns how the PHP parser would understand $name if it were written in the body of the class $context. + * @throws Nette\InvalidArgumentException + */ + public static function expandClassName(string $name, \ReflectionClass $context): string + { + $lower = strtolower($name); + if (empty($name)) { + throw new Nette\InvalidArgumentException('Class name must not be empty.'); + + } elseif (Validators::isBuiltinType($lower)) { + return $lower; + + } elseif ($lower === 'self' || $lower === 'static') { + return $context->name; + + } elseif ($lower === 'parent') { + return $context->getParentClass() + ? $context->getParentClass()->name + : 'parent'; + + } elseif ($name[0] === '\\') { // fully qualified name + return ltrim($name, '\\'); + } + + $uses = self::getUseStatements($context); + $parts = explode('\\', $name, 2); + if (isset($uses[$parts[0]])) { + $parts[0] = $uses[$parts[0]]; + return implode('\\', $parts); + + } elseif ($context->inNamespace()) { + return $context->getNamespaceName() . '\\' . $name; + + } else { + return $name; + } + } + + + /** @return array<string, class-string> of [alias => class] */ + public static function getUseStatements(\ReflectionClass $class): array + { + if ($class->isAnonymous()) { + throw new Nette\NotImplementedException('Anonymous classes are not supported.'); + } + + static $cache = []; + if (!isset($cache[$name = $class->name])) { + if ($class->isInternal()) { + $cache[$name] = []; + } else { + $code = file_get_contents($class->getFileName()); + $cache = self::parseUseStatements($code, $name) + $cache; + } + } + + return $cache[$name]; + } + + + /** + * Parses PHP code to [class => [alias => class, ...]] + */ + private static function parseUseStatements(string $code, ?string $forClass = null): array + { + try { + $tokens = \PhpToken::tokenize($code, TOKEN_PARSE); + } catch (\ParseError $e) { + trigger_error($e->getMessage(), E_USER_NOTICE); + $tokens = []; + } + + $namespace = $class = null; + $classLevel = $level = 0; + $res = $uses = []; + + $nameTokens = [T_STRING, T_NS_SEPARATOR, T_NAME_QUALIFIED, T_NAME_FULLY_QUALIFIED]; + + while ($token = current($tokens)) { + next($tokens); + switch ($token->id) { + case T_NAMESPACE: + $namespace = ltrim(self::fetch($tokens, $nameTokens) . '\\', '\\'); + $uses = []; + break; + + case T_CLASS: + case T_INTERFACE: + case T_TRAIT: + case PHP_VERSION_ID < 80100 + ? T_CLASS + : T_ENUM: + if ($name = self::fetch($tokens, T_STRING)) { + $class = $namespace . $name; + $classLevel = $level + 1; + $res[$class] = $uses; + if ($class === $forClass) { + return $res; + } + } + + break; + + case T_USE: + while (!$class && ($name = self::fetch($tokens, $nameTokens))) { + $name = ltrim($name, '\\'); + if (self::fetch($tokens, '{')) { + while ($suffix = self::fetch($tokens, $nameTokens)) { + if (self::fetch($tokens, T_AS)) { + $uses[self::fetch($tokens, T_STRING)] = $name . $suffix; + } else { + $tmp = explode('\\', $suffix); + $uses[end($tmp)] = $name . $suffix; + } + + if (!self::fetch($tokens, ',')) { + break; + } + } + } elseif (self::fetch($tokens, T_AS)) { + $uses[self::fetch($tokens, T_STRING)] = $name; + + } else { + $tmp = explode('\\', $name); + $uses[end($tmp)] = $name; + } + + if (!self::fetch($tokens, ',')) { + break; + } + } + + break; + + case T_CURLY_OPEN: + case T_DOLLAR_OPEN_CURLY_BRACES: + case ord('{'): + $level++; + break; + + case ord('}'): + if ($level === $classLevel) { + $class = $classLevel = 0; + } + + $level--; + } + } + + return $res; + } + + + private static function fetch(array &$tokens, string|int|array $take): ?string + { + $res = null; + while ($token = current($tokens)) { + if ($token->is($take)) { + $res .= $token->text; + } elseif (!$token->is([T_DOC_COMMENT, T_WHITESPACE, T_COMMENT])) { + break; + } + + next($tokens); + } + + return $res; + } +} diff --git a/vendor/nette/utils/src/Utils/ReflectionMethod.php b/vendor/nette/utils/src/Utils/ReflectionMethod.php new file mode 100644 index 00000000..b003fcbd --- /dev/null +++ b/vendor/nette/utils/src/Utils/ReflectionMethod.php @@ -0,0 +1,36 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + + +/** + * ReflectionMethod preserving the original class name. + * @internal + */ +final class ReflectionMethod extends \ReflectionMethod +{ + private \ReflectionClass $originalClass; + + + public function __construct(object|string $objectOrMethod, ?string $method = null) + { + if (is_string($objectOrMethod) && str_contains($objectOrMethod, '::')) { + [$objectOrMethod, $method] = explode('::', $objectOrMethod, 2); + } + parent::__construct($objectOrMethod, $method); + $this->originalClass = new \ReflectionClass($objectOrMethod); + } + + + public function getOriginalClass(): \ReflectionClass + { + return $this->originalClass; + } +} diff --git a/vendor/nette/utils/src/Utils/Strings.php b/vendor/nette/utils/src/Utils/Strings.php new file mode 100644 index 00000000..c0735659 --- /dev/null +++ b/vendor/nette/utils/src/Utils/Strings.php @@ -0,0 +1,728 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + +use JetBrains\PhpStorm\Language; +use Nette; +use function is_array, is_object, strlen; + + +/** + * String tools library. + */ +class Strings +{ + use Nette\StaticClass; + + public const TrimCharacters = " \t\n\r\0\x0B\u{A0}\u{2000}\u{2001}\u{2002}\u{2003}\u{2004}\u{2005}\u{2006}\u{2007}\u{2008}\u{2009}\u{200A}\u{200B}"; + + /** @deprecated use Strings::TrimCharacters */ + public const TRIM_CHARACTERS = self::TrimCharacters; + + + /** + * @deprecated use Nette\Utils\Validator::isUnicode() + */ + public static function checkEncoding(string $s): bool + { + return $s === self::fixEncoding($s); + } + + + /** + * Removes all invalid UTF-8 characters from a string. + */ + public static function fixEncoding(string $s): string + { + // removes xD800-xDFFF, x110000 and higher + return htmlspecialchars_decode(htmlspecialchars($s, ENT_NOQUOTES | ENT_IGNORE, 'UTF-8'), ENT_NOQUOTES); + } + + + /** + * Returns a specific character in UTF-8 from code point (number in range 0x0000..D7FF or 0xE000..10FFFF). + * @throws Nette\InvalidArgumentException if code point is not in valid range + */ + public static function chr(int $code): string + { + if ($code < 0 || ($code >= 0xD800 && $code <= 0xDFFF) || $code > 0x10FFFF) { + throw new Nette\InvalidArgumentException('Code point must be in range 0x0 to 0xD7FF or 0xE000 to 0x10FFFF.'); + } elseif (!extension_loaded('iconv')) { + throw new Nette\NotSupportedException(__METHOD__ . '() requires ICONV extension that is not loaded.'); + } + + return iconv('UTF-32BE', 'UTF-8//IGNORE', pack('N', $code)); + } + + + /** + * Returns a code point of specific character in UTF-8 (number in range 0x0000..D7FF or 0xE000..10FFFF). + */ + public static function ord(string $c): int + { + if (!extension_loaded('iconv')) { + throw new Nette\NotSupportedException(__METHOD__ . '() requires ICONV extension that is not loaded.'); + } + + $tmp = iconv('UTF-8', 'UTF-32BE//IGNORE', $c); + if (!$tmp) { + throw new Nette\InvalidArgumentException('Invalid UTF-8 character "' . ($c === '' ? '' : '\x' . strtoupper(bin2hex($c))) . '".'); + } + + return unpack('N', $tmp)[1]; + } + + + /** + * @deprecated use str_starts_with() + */ + public static function startsWith(string $haystack, string $needle): bool + { + return str_starts_with($haystack, $needle); + } + + + /** + * @deprecated use str_ends_with() + */ + public static function endsWith(string $haystack, string $needle): bool + { + return str_ends_with($haystack, $needle); + } + + + /** + * @deprecated use str_contains() + */ + public static function contains(string $haystack, string $needle): bool + { + return str_contains($haystack, $needle); + } + + + /** + * Returns a part of UTF-8 string specified by starting position and length. If start is negative, + * the returned string will start at the start'th character from the end of string. + */ + public static function substring(string $s, int $start, ?int $length = null): string + { + if (function_exists('mb_substr')) { + return mb_substr($s, $start, $length, 'UTF-8'); // MB is much faster + } elseif (!extension_loaded('iconv')) { + throw new Nette\NotSupportedException(__METHOD__ . '() requires extension ICONV or MBSTRING, neither is loaded.'); + } elseif ($length === null) { + $length = self::length($s); + } elseif ($start < 0 && $length < 0) { + $start += self::length($s); // unifies iconv_substr behavior with mb_substr + } + + return iconv_substr($s, $start, $length, 'UTF-8'); + } + + + /** + * Removes control characters, normalizes line breaks to `\n`, removes leading and trailing blank lines, + * trims end spaces on lines, normalizes UTF-8 to the normal form of NFC. + */ + public static function normalize(string $s): string + { + // convert to compressed normal form (NFC) + if (class_exists('Normalizer', false) && ($n = \Normalizer::normalize($s, \Normalizer::FORM_C)) !== false) { + $s = $n; + } + + $s = self::unixNewLines($s); + + // remove control characters; leave \t + \n + $s = self::pcre('preg_replace', ['#[\x00-\x08\x0B-\x1F\x7F-\x9F]+#u', '', $s]); + + // right trim + $s = self::pcre('preg_replace', ['#[\t ]+$#m', '', $s]); + + // leading and trailing blank lines + $s = trim($s, "\n"); + + return $s; + } + + + /** @deprecated use Strings::unixNewLines() */ + public static function normalizeNewLines(string $s): string + { + return self::unixNewLines($s); + } + + + /** + * Converts line endings to \n used on Unix-like systems. + * Line endings are: \n, \r, \r\n, U+2028 line separator, U+2029 paragraph separator. + */ + public static function unixNewLines(string $s): string + { + return preg_replace("~\r\n?|\u{2028}|\u{2029}~", "\n", $s); + } + + + /** + * Converts line endings to platform-specific, i.e. \r\n on Windows and \n elsewhere. + * Line endings are: \n, \r, \r\n, U+2028 line separator, U+2029 paragraph separator. + */ + public static function platformNewLines(string $s): string + { + return preg_replace("~\r\n?|\n|\u{2028}|\u{2029}~", PHP_EOL, $s); + } + + + /** + * Converts UTF-8 string to ASCII, ie removes diacritics etc. + */ + public static function toAscii(string $s): string + { + $iconv = defined('ICONV_IMPL') ? trim(ICONV_IMPL, '"\'') : null; + static $transliterator = null; + if ($transliterator === null) { + if (class_exists('Transliterator', false)) { + $transliterator = \Transliterator::create('Any-Latin; Latin-ASCII'); + } else { + trigger_error(__METHOD__ . "(): it is recommended to enable PHP extensions 'intl'.", E_USER_NOTICE); + $transliterator = false; + } + } + + // remove control characters and check UTF-8 validity + $s = self::pcre('preg_replace', ['#[^\x09\x0A\x0D\x20-\x7E\xA0-\x{2FF}\x{370}-\x{10FFFF}]#u', '', $s]); + + // transliteration (by Transliterator and iconv) is not optimal, replace some characters directly + $s = strtr($s, ["\u{201E}" => '"', "\u{201C}" => '"', "\u{201D}" => '"', "\u{201A}" => "'", "\u{2018}" => "'", "\u{2019}" => "'", "\u{B0}" => '^', "\u{42F}" => 'Ya', "\u{44F}" => 'ya', "\u{42E}" => 'Yu', "\u{44E}" => 'yu', "\u{c4}" => 'Ae', "\u{d6}" => 'Oe', "\u{dc}" => 'Ue', "\u{1e9e}" => 'Ss', "\u{e4}" => 'ae', "\u{f6}" => 'oe', "\u{fc}" => 'ue', "\u{df}" => 'ss']); // „ “ ” ‚ ‘ ’ ° Я я Ю ю Ä Ö Ü ẞ ä ö ü ß + if ($iconv !== 'libiconv') { + $s = strtr($s, ["\u{AE}" => '(R)', "\u{A9}" => '(c)', "\u{2026}" => '...', "\u{AB}" => '<<', "\u{BB}" => '>>', "\u{A3}" => 'lb', "\u{A5}" => 'yen', "\u{B2}" => '^2', "\u{B3}" => '^3', "\u{B5}" => 'u', "\u{B9}" => '^1', "\u{BA}" => 'o', "\u{BF}" => '?', "\u{2CA}" => "'", "\u{2CD}" => '_', "\u{2DD}" => '"', "\u{1FEF}" => '', "\u{20AC}" => 'EUR', "\u{2122}" => 'TM', "\u{212E}" => 'e', "\u{2190}" => '<-', "\u{2191}" => '^', "\u{2192}" => '->', "\u{2193}" => 'V', "\u{2194}" => '<->']); // ® © … « » £ ¥ ² ³ µ ¹ º ¿ ˊ ˍ ˝ ` € ™ ℮ ← ↑ → ↓ ↔ + } + + if ($transliterator) { + $s = $transliterator->transliterate($s); + // use iconv because The transliterator leaves some characters out of ASCII, eg → ʾ + if ($iconv === 'glibc') { + $s = strtr($s, '?', "\x01"); // temporarily hide ? to distinguish them from the garbage that iconv creates + $s = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $s); + $s = str_replace(['?', "\x01"], ['', '?'], $s); // remove garbage and restore ? characters + } elseif ($iconv === 'libiconv') { + $s = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $s); + } else { // null or 'unknown' (#216) + $s = self::pcre('preg_replace', ['#[^\x00-\x7F]++#', '', $s]); // remove non-ascii chars + } + } elseif ($iconv === 'glibc' || $iconv === 'libiconv') { + // temporarily hide these characters to distinguish them from the garbage that iconv creates + $s = strtr($s, '`\'"^~?', "\x01\x02\x03\x04\x05\x06"); + if ($iconv === 'glibc') { + // glibc implementation is very limited. transliterate into Windows-1250 and then into ASCII, so most Eastern European characters are preserved + $s = iconv('UTF-8', 'WINDOWS-1250//TRANSLIT//IGNORE', $s); + $s = strtr( + $s, + "\xa5\xa3\xbc\x8c\xa7\x8a\xaa\x8d\x8f\x8e\xaf\xb9\xb3\xbe\x9c\x9a\xba\x9d\x9f\x9e\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc\xfd\xfe\x96\xa0\x8b\x97\x9b\xa6\xad\xb7", + 'ALLSSSSTZZZallssstzzzRAAAALCCCEEEEIIDDNNOOOOxRUUUUYTsraaaalccceeeeiiddnnooooruuuuyt- <->|-.', + ); + $s = self::pcre('preg_replace', ['#[^\x00-\x7F]++#', '', $s]); + } else { + $s = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $s); + } + + // remove garbage that iconv creates during transliteration (eg Ý -> Y') + $s = str_replace(['`', "'", '"', '^', '~', '?'], '', $s); + // restore temporarily hidden characters + $s = strtr($s, "\x01\x02\x03\x04\x05\x06", '`\'"^~?'); + } else { + $s = self::pcre('preg_replace', ['#[^\x00-\x7F]++#', '', $s]); // remove non-ascii chars + } + + return $s; + } + + + /** + * Modifies the UTF-8 string to the form used in the URL, ie removes diacritics and replaces all characters + * except letters of the English alphabet and numbers with a hyphens. + */ + public static function webalize(string $s, ?string $charlist = null, bool $lower = true): string + { + $s = self::toAscii($s); + if ($lower) { + $s = strtolower($s); + } + + $s = self::pcre('preg_replace', ['#[^a-z0-9' . ($charlist !== null ? preg_quote($charlist, '#') : '') . ']+#i', '-', $s]); + $s = trim($s, '-'); + return $s; + } + + + /** + * Truncates a UTF-8 string to given maximal length, while trying not to split whole words. Only if the string is truncated, + * an ellipsis (or something else set with third argument) is appended to the string. + */ + public static function truncate(string $s, int $maxLen, string $append = "\u{2026}"): string + { + if (self::length($s) > $maxLen) { + $maxLen -= self::length($append); + if ($maxLen < 1) { + return $append; + + } elseif ($matches = self::match($s, '#^.{1,' . $maxLen . '}(?=[\s\x00-/:-@\[-`{-~])#us')) { + return $matches[0] . $append; + + } else { + return self::substring($s, 0, $maxLen) . $append; + } + } + + return $s; + } + + + /** + * Indents a multiline text from the left. Second argument sets how many indentation chars should be used, + * while the indent itself is the third argument (*tab* by default). + */ + public static function indent(string $s, int $level = 1, string $chars = "\t"): string + { + if ($level > 0) { + $s = self::replace($s, '#(?:^|[\r\n]+)(?=[^\r\n])#', '$0' . str_repeat($chars, $level)); + } + + return $s; + } + + + /** + * Converts all characters of UTF-8 string to lower case. + */ + public static function lower(string $s): string + { + return mb_strtolower($s, 'UTF-8'); + } + + + /** + * Converts the first character of a UTF-8 string to lower case and leaves the other characters unchanged. + */ + public static function firstLower(string $s): string + { + return self::lower(self::substring($s, 0, 1)) . self::substring($s, 1); + } + + + /** + * Converts all characters of a UTF-8 string to upper case. + */ + public static function upper(string $s): string + { + return mb_strtoupper($s, 'UTF-8'); + } + + + /** + * Converts the first character of a UTF-8 string to upper case and leaves the other characters unchanged. + */ + public static function firstUpper(string $s): string + { + return self::upper(self::substring($s, 0, 1)) . self::substring($s, 1); + } + + + /** + * Converts the first character of every word of a UTF-8 string to upper case and the others to lower case. + */ + public static function capitalize(string $s): string + { + return mb_convert_case($s, MB_CASE_TITLE, 'UTF-8'); + } + + + /** + * Compares two UTF-8 strings or their parts, without taking character case into account. If length is null, whole strings are compared, + * if it is negative, the corresponding number of characters from the end of the strings is compared, + * otherwise the appropriate number of characters from the beginning is compared. + */ + public static function compare(string $left, string $right, ?int $length = null): bool + { + if (class_exists('Normalizer', false)) { + $left = \Normalizer::normalize($left, \Normalizer::FORM_D); // form NFD is faster + $right = \Normalizer::normalize($right, \Normalizer::FORM_D); // form NFD is faster + } + + if ($length < 0) { + $left = self::substring($left, $length, -$length); + $right = self::substring($right, $length, -$length); + } elseif ($length !== null) { + $left = self::substring($left, 0, $length); + $right = self::substring($right, 0, $length); + } + + return self::lower($left) === self::lower($right); + } + + + /** + * Finds the common prefix of strings or returns empty string if the prefix was not found. + * @param string[] $strings + */ + public static function findPrefix(array $strings): string + { + $first = array_shift($strings); + for ($i = 0; $i < strlen($first); $i++) { + foreach ($strings as $s) { + if (!isset($s[$i]) || $first[$i] !== $s[$i]) { + while ($i && $first[$i - 1] >= "\x80" && $first[$i] >= "\x80" && $first[$i] < "\xC0") { + $i--; + } + + return substr($first, 0, $i); + } + } + } + + return $first; + } + + + /** + * Returns number of characters (not bytes) in UTF-8 string. + * That is the number of Unicode code points which may differ from the number of graphemes. + */ + public static function length(string $s): int + { + return match (true) { + extension_loaded('mbstring') => mb_strlen($s, 'UTF-8'), + extension_loaded('iconv') => iconv_strlen($s, 'UTF-8'), + default => strlen(@utf8_decode($s)), // deprecated + }; + } + + + /** + * Removes all left and right side spaces (or the characters passed as second argument) from a UTF-8 encoded string. + */ + public static function trim(string $s, string $charlist = self::TrimCharacters): string + { + $charlist = preg_quote($charlist, '#'); + return self::replace($s, '#^[' . $charlist . ']+|[' . $charlist . ']+$#Du', ''); + } + + + /** + * Pads a UTF-8 string to given length by prepending the $pad string to the beginning. + * @param non-empty-string $pad + */ + public static function padLeft(string $s, int $length, string $pad = ' '): string + { + $length = max(0, $length - self::length($s)); + $padLen = self::length($pad); + return str_repeat($pad, (int) ($length / $padLen)) . self::substring($pad, 0, $length % $padLen) . $s; + } + + + /** + * Pads UTF-8 string to given length by appending the $pad string to the end. + * @param non-empty-string $pad + */ + public static function padRight(string $s, int $length, string $pad = ' '): string + { + $length = max(0, $length - self::length($s)); + $padLen = self::length($pad); + return $s . str_repeat($pad, (int) ($length / $padLen)) . self::substring($pad, 0, $length % $padLen); + } + + + /** + * Reverses UTF-8 string. + */ + public static function reverse(string $s): string + { + if (!extension_loaded('iconv')) { + throw new Nette\NotSupportedException(__METHOD__ . '() requires ICONV extension that is not loaded.'); + } + + return iconv('UTF-32LE', 'UTF-8', strrev(iconv('UTF-8', 'UTF-32BE', $s))); + } + + + /** + * Returns part of $haystack before $nth occurence of $needle or returns null if the needle was not found. + * Negative value means searching from the end. + */ + public static function before(string $haystack, string $needle, int $nth = 1): ?string + { + $pos = self::pos($haystack, $needle, $nth); + return $pos === null + ? null + : substr($haystack, 0, $pos); + } + + + /** + * Returns part of $haystack after $nth occurence of $needle or returns null if the needle was not found. + * Negative value means searching from the end. + */ + public static function after(string $haystack, string $needle, int $nth = 1): ?string + { + $pos = self::pos($haystack, $needle, $nth); + return $pos === null + ? null + : substr($haystack, $pos + strlen($needle)); + } + + + /** + * Returns position in characters of $nth occurence of $needle in $haystack or null if the $needle was not found. + * Negative value of `$nth` means searching from the end. + */ + public static function indexOf(string $haystack, string $needle, int $nth = 1): ?int + { + $pos = self::pos($haystack, $needle, $nth); + return $pos === null + ? null + : self::length(substr($haystack, 0, $pos)); + } + + + /** + * Returns position in characters of $nth occurence of $needle in $haystack or null if the needle was not found. + */ + private static function pos(string $haystack, string $needle, int $nth = 1): ?int + { + if (!$nth) { + return null; + } elseif ($nth > 0) { + if ($needle === '') { + return 0; + } + + $pos = 0; + while (($pos = strpos($haystack, $needle, $pos)) !== false && --$nth) { + $pos++; + } + } else { + $len = strlen($haystack); + if ($needle === '') { + return $len; + } elseif ($len === 0) { + return null; + } + + $pos = $len - 1; + while (($pos = strrpos($haystack, $needle, $pos - $len)) !== false && ++$nth) { + $pos--; + } + } + + return Helpers::falseToNull($pos); + } + + + /** + * Divides the string into arrays according to the regular expression. Expressions in parentheses will be captured and returned as well. + */ + public static function split( + string $subject, + #[Language('RegExp')] + string $pattern, + bool|int $captureOffset = false, + bool $skipEmpty = false, + int $limit = -1, + bool $utf8 = false, + ): array + { + $flags = is_int($captureOffset) // back compatibility + ? $captureOffset + : ($captureOffset ? PREG_SPLIT_OFFSET_CAPTURE : 0) | ($skipEmpty ? PREG_SPLIT_NO_EMPTY : 0); + + $pattern .= $utf8 ? 'u' : ''; + $m = self::pcre('preg_split', [$pattern, $subject, $limit, $flags | PREG_SPLIT_DELIM_CAPTURE]); + return $utf8 && $captureOffset + ? self::bytesToChars($subject, [$m])[0] + : $m; + + } + + + /** + * Searches the string for the part matching the regular expression and returns + * an array with the found expression and individual subexpressions, or `null`. + */ + public static function match( + string $subject, + #[Language('RegExp')] + string $pattern, + bool|int $captureOffset = false, + int $offset = 0, + bool $unmatchedAsNull = false, + bool $utf8 = false, + ): ?array + { + $flags = is_int($captureOffset) // back compatibility + ? $captureOffset + : ($captureOffset ? PREG_OFFSET_CAPTURE : 0) | ($unmatchedAsNull ? PREG_UNMATCHED_AS_NULL : 0); + + if ($utf8) { + $offset = strlen(self::substring($subject, 0, $offset)); + $pattern .= 'u'; + } + + if ($offset > strlen($subject)) { + return null; + } elseif (!self::pcre('preg_match', [$pattern, $subject, &$m, $flags, $offset])) { + return null; + } elseif ($utf8 && $captureOffset) { + return self::bytesToChars($subject, [$m])[0]; + } else { + return $m; + } + } + + + /** + * Searches the string for all occurrences matching the regular expression and + * returns an array of arrays containing the found expression and each subexpression. + * @return ($lazy is true ? \Generator<int, array> : array[]) + */ + public static function matchAll( + string $subject, + #[Language('RegExp')] + string $pattern, + bool|int $captureOffset = false, + int $offset = 0, + bool $unmatchedAsNull = false, + bool $patternOrder = false, + bool $utf8 = false, + bool $lazy = false, + ): array|\Generator + { + if ($utf8) { + $offset = strlen(self::substring($subject, 0, $offset)); + $pattern .= 'u'; + } + + if ($lazy) { + $flags = PREG_OFFSET_CAPTURE | ($unmatchedAsNull ? PREG_UNMATCHED_AS_NULL : 0); + return (function () use ($utf8, $captureOffset, $flags, $subject, $pattern, $offset) { + $counter = 0; + while ( + $offset <= strlen($subject) - ($counter ? 1 : 0) + && self::pcre('preg_match', [$pattern, $subject, &$m, $flags, $offset]) + ) { + $offset = $m[0][1] + max(1, strlen($m[0][0])); + if (!$captureOffset) { + $m = array_map(fn($item) => $item[0], $m); + } elseif ($utf8) { + $m = self::bytesToChars($subject, [$m])[0]; + } + yield $counter++ => $m; + } + })(); + } + + if ($offset > strlen($subject)) { + return []; + } + + $flags = is_int($captureOffset) // back compatibility + ? $captureOffset + : ($captureOffset ? PREG_OFFSET_CAPTURE : 0) | ($unmatchedAsNull ? PREG_UNMATCHED_AS_NULL : 0) | ($patternOrder ? PREG_PATTERN_ORDER : 0); + + self::pcre('preg_match_all', [ + $pattern, $subject, &$m, + ($flags & PREG_PATTERN_ORDER) ? $flags : ($flags | PREG_SET_ORDER), + $offset, + ]); + return $utf8 && $captureOffset + ? self::bytesToChars($subject, $m) + : $m; + } + + + /** + * Replaces all occurrences matching regular expression $pattern which can be string or array in the form `pattern => replacement`. + */ + public static function replace( + string $subject, + #[Language('RegExp')] + string|array $pattern, + string|callable $replacement = '', + int $limit = -1, + bool $captureOffset = false, + bool $unmatchedAsNull = false, + bool $utf8 = false, + ): string + { + if (is_object($replacement) || is_array($replacement)) { + if (!is_callable($replacement, false, $textual)) { + throw new Nette\InvalidStateException("Callback '$textual' is not callable."); + } + + $flags = ($captureOffset ? PREG_OFFSET_CAPTURE : 0) | ($unmatchedAsNull ? PREG_UNMATCHED_AS_NULL : 0); + if ($utf8) { + $pattern .= 'u'; + if ($captureOffset) { + $replacement = fn($m) => $replacement(self::bytesToChars($subject, [$m])[0]); + } + } + + return self::pcre('preg_replace_callback', [$pattern, $replacement, $subject, $limit, 0, $flags]); + + } elseif (is_array($pattern) && is_string(key($pattern))) { + $replacement = array_values($pattern); + $pattern = array_keys($pattern); + } + + if ($utf8) { + $pattern = array_map(fn($item) => $item . 'u', (array) $pattern); + } + + return self::pcre('preg_replace', [$pattern, $replacement, $subject, $limit]); + } + + + private static function bytesToChars(string $s, array $groups): array + { + $lastBytes = $lastChars = 0; + foreach ($groups as &$matches) { + foreach ($matches as &$match) { + if ($match[1] > $lastBytes) { + $lastChars += self::length(substr($s, $lastBytes, $match[1] - $lastBytes)); + } elseif ($match[1] < $lastBytes) { + $lastChars -= self::length(substr($s, $match[1], $lastBytes - $match[1])); + } + + $lastBytes = $match[1]; + $match[1] = $lastChars; + } + } + + return $groups; + } + + + /** @internal */ + public static function pcre(string $func, array $args) + { + $res = Callback::invokeSafe($func, $args, function (string $message) use ($args): void { + // compile-time error, not detectable by preg_last_error + throw new RegexpException($message . ' in pattern: ' . implode(' or ', (array) $args[0])); + }); + + if (($code = preg_last_error()) // run-time error, but preg_last_error & return code are liars + && ($res === null || !in_array($func, ['preg_filter', 'preg_replace_callback', 'preg_replace'], true)) + ) { + throw new RegexpException(preg_last_error_msg() + . ' (pattern: ' . implode(' or ', (array) $args[0]) . ')', $code); + } + + return $res; + } +} diff --git a/vendor/nette/utils/src/Utils/Type.php b/vendor/nette/utils/src/Utils/Type.php new file mode 100644 index 00000000..7a178812 --- /dev/null +++ b/vendor/nette/utils/src/Utils/Type.php @@ -0,0 +1,267 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + +use Nette; + + +/** + * PHP type reflection. + */ +final class Type +{ + /** @var array<int, string|self> */ + private array $types; + private bool $simple; + private string $kind; // | & + + + /** + * Creates a Type object based on reflection. Resolves self, static and parent to the actual class name. + * If the subject has no type, it returns null. + */ + public static function fromReflection( + \ReflectionFunctionAbstract|\ReflectionParameter|\ReflectionProperty $reflection, + ): ?self + { + $type = $reflection instanceof \ReflectionFunctionAbstract + ? $reflection->getReturnType() ?? (PHP_VERSION_ID >= 80100 && $reflection instanceof \ReflectionMethod ? $reflection->getTentativeReturnType() : null) + : $reflection->getType(); + + return $type ? self::fromReflectionType($type, $reflection, asObject: true) : null; + } + + + private static function fromReflectionType(\ReflectionType $type, $of, bool $asObject): self|string + { + if ($type instanceof \ReflectionNamedType) { + $name = self::resolve($type->getName(), $of); + return $asObject + ? new self($type->allowsNull() && $name !== 'mixed' ? [$name, 'null'] : [$name]) + : $name; + + } elseif ($type instanceof \ReflectionUnionType || $type instanceof \ReflectionIntersectionType) { + return new self( + array_map(fn($t) => self::fromReflectionType($t, $of, asObject: false), $type->getTypes()), + $type instanceof \ReflectionUnionType ? '|' : '&', + ); + + } else { + throw new Nette\InvalidStateException('Unexpected type of ' . Reflection::toString($of)); + } + } + + + /** + * Creates the Type object according to the text notation. + */ + public static function fromString(string $type): self + { + if (!Validators::isTypeDeclaration($type)) { + throw new Nette\InvalidArgumentException("Invalid type '$type'."); + } + + if ($type[0] === '?') { + return new self([substr($type, 1), 'null']); + } + + $unions = []; + foreach (explode('|', $type) as $part) { + $part = explode('&', trim($part, '()')); + $unions[] = count($part) === 1 ? $part[0] : new self($part, '&'); + } + + return count($unions) === 1 && $unions[0] instanceof self + ? $unions[0] + : new self($unions); + } + + + /** + * Resolves 'self', 'static' and 'parent' to the actual class name. + */ + public static function resolve( + string $type, + \ReflectionFunctionAbstract|\ReflectionParameter|\ReflectionProperty $of, + ): string + { + $lower = strtolower($type); + if ($of instanceof \ReflectionFunction) { + return $type; + } elseif ($lower === 'self') { + return $of->getDeclaringClass()->name; + } elseif ($lower === 'static') { + return ($of instanceof ReflectionMethod ? $of->getOriginalClass() : $of->getDeclaringClass())->name; + } elseif ($lower === 'parent' && $of->getDeclaringClass()->getParentClass()) { + return $of->getDeclaringClass()->getParentClass()->name; + } else { + return $type; + } + } + + + private function __construct(array $types, string $kind = '|') + { + $o = array_search('null', $types, strict: true); + if ($o !== false) { // null as last + array_splice($types, $o, 1); + $types[] = 'null'; + } + + $this->types = $types; + $this->simple = is_string($types[0]) && ($types[1] ?? 'null') === 'null'; + $this->kind = count($types) > 1 ? $kind : ''; + } + + + public function __toString(): string + { + $multi = count($this->types) > 1; + if ($this->simple) { + return ($multi ? '?' : '') . $this->types[0]; + } + + $res = []; + foreach ($this->types as $type) { + $res[] = $type instanceof self && $multi ? "($type)" : $type; + } + return implode($this->kind, $res); + } + + + /** + * Returns the array of subtypes that make up the compound type as strings. + * @return array<int, string|string[]> + */ + public function getNames(): array + { + return array_map(fn($t) => $t instanceof self ? $t->getNames() : $t, $this->types); + } + + + /** + * Returns the array of subtypes that make up the compound type as Type objects: + * @return self[] + */ + public function getTypes(): array + { + return array_map(fn($t) => $t instanceof self ? $t : new self([$t]), $this->types); + } + + + /** + * Returns the type name for simple types, otherwise null. + */ + public function getSingleName(): ?string + { + return $this->simple + ? $this->types[0] + : null; + } + + + /** + * Returns true whether it is a union type. + */ + public function isUnion(): bool + { + return $this->kind === '|'; + } + + + /** + * Returns true whether it is an intersection type. + */ + public function isIntersection(): bool + { + return $this->kind === '&'; + } + + + /** + * Returns true whether it is a simple type. Single nullable types are also considered to be simple types. + */ + public function isSimple(): bool + { + return $this->simple; + } + + + /** @deprecated use isSimple() */ + public function isSingle(): bool + { + return $this->simple; + } + + + /** + * Returns true whether the type is both a simple and a PHP built-in type. + */ + public function isBuiltin(): bool + { + return $this->simple && Validators::isBuiltinType($this->types[0]); + } + + + /** + * Returns true whether the type is both a simple and a class name. + */ + public function isClass(): bool + { + return $this->simple && !Validators::isBuiltinType($this->types[0]); + } + + + /** + * Determines if type is special class name self/parent/static. + */ + public function isClassKeyword(): bool + { + return $this->simple && Validators::isClassKeyword($this->types[0]); + } + + + /** + * Verifies type compatibility. For example, it checks if a value of a certain type could be passed as a parameter. + */ + public function allows(string $subtype): bool + { + if ($this->types === ['mixed']) { + return true; + } + + $subtype = self::fromString($subtype); + return $subtype->isUnion() + ? Arrays::every($subtype->types, fn($t) => $this->allows2($t instanceof self ? $t->types : [$t])) + : $this->allows2($subtype->types); + } + + + private function allows2(array $subtypes): bool + { + return $this->isUnion() + ? Arrays::some($this->types, fn($t) => $this->allows3($t instanceof self ? $t->types : [$t], $subtypes)) + : $this->allows3($this->types, $subtypes); + } + + + private function allows3(array $types, array $subtypes): bool + { + return Arrays::every( + $types, + fn($type) => Arrays::some( + $subtypes, + fn($subtype) => Validators::isBuiltinType($type) + ? strcasecmp($type, $subtype) === 0 + : is_a($subtype, $type, allow_string: true) + ) + ); + } +} diff --git a/vendor/nette/utils/src/Utils/Validators.php b/vendor/nette/utils/src/Utils/Validators.php new file mode 100644 index 00000000..61ccf091 --- /dev/null +++ b/vendor/nette/utils/src/Utils/Validators.php @@ -0,0 +1,416 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + +use Nette; + + +/** + * Validation utilities. + */ +class Validators +{ + use Nette\StaticClass; + + private const BuiltinTypes = [ + 'string' => 1, 'int' => 1, 'float' => 1, 'bool' => 1, 'array' => 1, 'object' => 1, + 'callable' => 1, 'iterable' => 1, 'void' => 1, 'null' => 1, 'mixed' => 1, 'false' => 1, + 'never' => 1, 'true' => 1, + ]; + + /** @var array<string,?callable> */ + protected static $validators = [ + // PHP types + 'array' => 'is_array', + 'bool' => 'is_bool', + 'boolean' => 'is_bool', + 'float' => 'is_float', + 'int' => 'is_int', + 'integer' => 'is_int', + 'null' => 'is_null', + 'object' => 'is_object', + 'resource' => 'is_resource', + 'scalar' => 'is_scalar', + 'string' => 'is_string', + + // pseudo-types + 'callable' => [self::class, 'isCallable'], + 'iterable' => 'is_iterable', + 'list' => [Arrays::class, 'isList'], + 'mixed' => [self::class, 'isMixed'], + 'none' => [self::class, 'isNone'], + 'number' => [self::class, 'isNumber'], + 'numeric' => [self::class, 'isNumeric'], + 'numericint' => [self::class, 'isNumericInt'], + + // string patterns + 'alnum' => 'ctype_alnum', + 'alpha' => 'ctype_alpha', + 'digit' => 'ctype_digit', + 'lower' => 'ctype_lower', + 'pattern' => null, + 'space' => 'ctype_space', + 'unicode' => [self::class, 'isUnicode'], + 'upper' => 'ctype_upper', + 'xdigit' => 'ctype_xdigit', + + // syntax validation + 'email' => [self::class, 'isEmail'], + 'identifier' => [self::class, 'isPhpIdentifier'], + 'uri' => [self::class, 'isUri'], + 'url' => [self::class, 'isUrl'], + + // environment validation + 'class' => 'class_exists', + 'interface' => 'interface_exists', + 'directory' => 'is_dir', + 'file' => 'is_file', + 'type' => [self::class, 'isType'], + ]; + + /** @var array<string,callable> */ + protected static $counters = [ + 'string' => 'strlen', + 'unicode' => [Strings::class, 'length'], + 'array' => 'count', + 'list' => 'count', + 'alnum' => 'strlen', + 'alpha' => 'strlen', + 'digit' => 'strlen', + 'lower' => 'strlen', + 'space' => 'strlen', + 'upper' => 'strlen', + 'xdigit' => 'strlen', + ]; + + + /** + * Verifies that the value is of expected types separated by pipe. + * @throws AssertionException + */ + public static function assert(mixed $value, string $expected, string $label = 'variable'): void + { + if (!static::is($value, $expected)) { + $expected = str_replace(['|', ':'], [' or ', ' in range '], $expected); + $translate = ['boolean' => 'bool', 'integer' => 'int', 'double' => 'float', 'NULL' => 'null']; + $type = $translate[gettype($value)] ?? gettype($value); + if (is_int($value) || is_float($value) || (is_string($value) && strlen($value) < 40)) { + $type .= ' ' . var_export($value, return: true); + } elseif (is_object($value)) { + $type .= ' ' . $value::class; + } + + throw new AssertionException("The $label expects to be $expected, $type given."); + } + } + + + /** + * Verifies that element $key in array is of expected types separated by pipe. + * @param mixed[] $array + * @throws AssertionException + */ + public static function assertField( + array $array, + $key, + ?string $expected = null, + string $label = "item '%' in array", + ): void + { + if (!array_key_exists($key, $array)) { + throw new AssertionException('Missing ' . str_replace('%', $key, $label) . '.'); + + } elseif ($expected) { + static::assert($array[$key], $expected, str_replace('%', $key, $label)); + } + } + + + /** + * Verifies that the value is of expected types separated by pipe. + */ + public static function is(mixed $value, string $expected): bool + { + foreach (explode('|', $expected) as $item) { + if (str_ends_with($item, '[]')) { + if (is_iterable($value) && self::everyIs($value, substr($item, 0, -2))) { + return true; + } + + continue; + } elseif (str_starts_with($item, '?')) { + $item = substr($item, 1); + if ($value === null) { + return true; + } + } + + [$type] = $item = explode(':', $item, 2); + if (isset(static::$validators[$type])) { + try { + if (!static::$validators[$type]($value)) { + continue; + } + } catch (\TypeError $e) { + continue; + } + } elseif ($type === 'pattern') { + if (Strings::match($value, '|^' . ($item[1] ?? '') . '$|D')) { + return true; + } + + continue; + } elseif (!$value instanceof $type) { + continue; + } + + if (isset($item[1])) { + $length = $value; + if (isset(static::$counters[$type])) { + $length = static::$counters[$type]($value); + } + + $range = explode('..', $item[1]); + if (!isset($range[1])) { + $range[1] = $range[0]; + } + + if (($range[0] !== '' && $length < $range[0]) || ($range[1] !== '' && $length > $range[1])) { + continue; + } + } + + return true; + } + + return false; + } + + + /** + * Finds whether all values are of expected types separated by pipe. + * @param mixed[] $values + */ + public static function everyIs(iterable $values, string $expected): bool + { + foreach ($values as $value) { + if (!static::is($value, $expected)) { + return false; + } + } + + return true; + } + + + /** + * Checks if the value is an integer or a float. + * @return ($value is int|float ? true : false) + */ + public static function isNumber(mixed $value): bool + { + return is_int($value) || is_float($value); + } + + + /** + * Checks if the value is an integer or a integer written in a string. + * @return ($value is non-empty-string ? bool : ($value is int ? true : false)) + */ + public static function isNumericInt(mixed $value): bool + { + return is_int($value) || (is_string($value) && preg_match('#^[+-]?[0-9]+$#D', $value)); + } + + + /** + * Checks if the value is a number or a number written in a string. + * @return ($value is non-empty-string ? bool : ($value is int|float ? true : false)) + */ + public static function isNumeric(mixed $value): bool + { + return is_float($value) || is_int($value) || (is_string($value) && preg_match('#^[+-]?([0-9]++\.?[0-9]*|\.[0-9]+)$#D', $value)); + } + + + /** + * Checks if the value is a syntactically correct callback. + */ + public static function isCallable(mixed $value): bool + { + return $value && is_callable($value, syntax_only: true); + } + + + /** + * Checks if the value is a valid UTF-8 string. + */ + public static function isUnicode(mixed $value): bool + { + return is_string($value) && preg_match('##u', $value); + } + + + /** + * Checks if the value is 0, '', false or null. + * @return ($value is 0|''|false|null ? true : false) + */ + public static function isNone(mixed $value): bool + { + return $value == null; // intentionally == + } + + + /** @internal */ + public static function isMixed(): bool + { + return true; + } + + + /** + * Checks if a variable is a zero-based integer indexed array. + * @deprecated use Nette\Utils\Arrays::isList + * @return ($value is list ? true : false) + */ + public static function isList(mixed $value): bool + { + return Arrays::isList($value); + } + + + /** + * Checks if the value is in the given range [min, max], where the upper or lower limit can be omitted (null). + * Numbers, strings and DateTime objects can be compared. + */ + public static function isInRange(mixed $value, array $range): bool + { + if ($value === null || !(isset($range[0]) || isset($range[1]))) { + return false; + } + + $limit = $range[0] ?? $range[1]; + if (is_string($limit)) { + $value = (string) $value; + } elseif ($limit instanceof \DateTimeInterface) { + if (!$value instanceof \DateTimeInterface) { + return false; + } + } elseif (is_numeric($value)) { + $value *= 1; + } else { + return false; + } + + return (!isset($range[0]) || ($value >= $range[0])) && (!isset($range[1]) || ($value <= $range[1])); + } + + + /** + * Checks if the value is a valid email address. It does not verify that the domain actually exists, only the syntax is verified. + */ + public static function isEmail(string $value): bool + { + $atom = "[-a-z0-9!#$%&'*+/=?^_`{|}~]"; // RFC 5322 unquoted characters in local-part + $alpha = "a-z\x80-\xFF"; // superset of IDN + return (bool) preg_match(<<<XX + (^(?n) + ("([ !#-[\\]-~]*|\\\\[ -~])+"|$atom+(\\.$atom+)*) # quoted or unquoted + @ + ([0-9$alpha]([-0-9$alpha]{0,61}[0-9$alpha])?\\.)+ # domain - RFC 1034 + [$alpha]([-0-9$alpha]{0,17}[$alpha])? # top domain + $)Dix + XX, $value); + } + + + /** + * Checks if the value is a valid URL address. + */ + public static function isUrl(string $value): bool + { + $alpha = "a-z\x80-\xFF"; + return (bool) preg_match(<<<XX + (^(?n) + https?://( + (([-_0-9$alpha]+\\.)* # subdomain + [0-9$alpha]([-0-9$alpha]{0,61}[0-9$alpha])?\\.)? # domain + [$alpha]([-0-9$alpha]{0,17}[$alpha])? # top domain + |\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3} # IPv4 + |\\[[0-9a-f:]{3,39}\\] # IPv6 + )(:\\d{1,5})? # port + (/\\S*)? # path + (\\?\\S*)? # query + (\\#\\S*)? # fragment + $)Dix + XX, $value); + } + + + /** + * Checks if the value is a valid URI address, that is, actually a string beginning with a syntactically valid schema. + */ + public static function isUri(string $value): bool + { + return (bool) preg_match('#^[a-z\d+\.-]+:\S+$#Di', $value); + } + + + /** + * Checks whether the input is a class, interface or trait. + * @deprecated + */ + public static function isType(string $type): bool + { + return class_exists($type) || interface_exists($type) || trait_exists($type); + } + + + /** + * Checks whether the input is a valid PHP identifier. + */ + public static function isPhpIdentifier(string $value): bool + { + return preg_match('#^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$#D', $value) === 1; + } + + + /** + * Determines if type is PHP built-in type. Otherwise, it is the class name. + */ + public static function isBuiltinType(string $type): bool + { + return isset(self::BuiltinTypes[strtolower($type)]); + } + + + /** + * Determines if type is special class name self/parent/static. + */ + public static function isClassKeyword(string $name): bool + { + return (bool) preg_match('#^(self|parent|static)$#Di', $name); + } + + + /** + * Checks whether the given type declaration is syntactically valid. + */ + public static function isTypeDeclaration(string $type): bool + { + return (bool) preg_match(<<<'XX' + ~((?n) + \?? (?<type> \\? (?<name> [a-zA-Z_\x7f-\xff][\w\x7f-\xff]*) (\\ (?&name))* ) | + (?<intersection> (?&type) (& (?&type))+ ) | + (?<upart> (?&type) | \( (?&intersection) \) ) (\| (?&upart))+ + )$~xAD + XX, $type); + } +} diff --git a/vendor/nette/utils/src/Utils/exceptions.php b/vendor/nette/utils/src/Utils/exceptions.php new file mode 100644 index 00000000..af949ce4 --- /dev/null +++ b/vendor/nette/utils/src/Utils/exceptions.php @@ -0,0 +1,50 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + + +/** + * The exception that is thrown when an image error occurs. + */ +class ImageException extends \Exception +{ +} + + +/** + * The exception that indicates invalid image file. + */ +class UnknownImageFileException extends ImageException +{ +} + + +/** + * The exception that indicates error of JSON encoding/decoding. + */ +class JsonException extends \JsonException +{ +} + + +/** + * The exception that indicates error of the last Regexp execution. + */ +class RegexpException extends \Exception +{ +} + + +/** + * The exception that indicates assertion error. + */ +class AssertionException extends \Exception +{ +} diff --git a/vendor/nette/utils/src/compatibility.php b/vendor/nette/utils/src/compatibility.php new file mode 100644 index 00000000..9df54801 --- /dev/null +++ b/vendor/nette/utils/src/compatibility.php @@ -0,0 +1,32 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette\Utils; + +use Nette; + +if (false) { + /** @deprecated use Nette\HtmlStringable */ + interface IHtmlString extends Nette\HtmlStringable + { + } +} elseif (!interface_exists(IHtmlString::class)) { + class_alias(Nette\HtmlStringable::class, IHtmlString::class); +} + +namespace Nette\Localization; + +if (false) { + /** @deprecated use Nette\Localization\Translator */ + interface ITranslator extends Translator + { + } +} elseif (!interface_exists(ITranslator::class)) { + class_alias(Translator::class, ITranslator::class); +} diff --git a/vendor/nette/utils/src/exceptions.php b/vendor/nette/utils/src/exceptions.php new file mode 100644 index 00000000..bbda7ddc --- /dev/null +++ b/vendor/nette/utils/src/exceptions.php @@ -0,0 +1,109 @@ +<?php + +/** + * This file is part of the Nette Framework (https://nette.org) + * Copyright (c) 2004 David Grudl (https://davidgrudl.com) + */ + +declare(strict_types=1); + +namespace Nette; + + +/** + * The exception that is thrown when the value of an argument is + * outside the allowable range of values as defined by the invoked method. + */ +class ArgumentOutOfRangeException extends \InvalidArgumentException +{ +} + + +/** + * The exception that is thrown when a method call is invalid for the object's + * current state, method has been invoked at an illegal or inappropriate time. + */ +class InvalidStateException extends \RuntimeException +{ +} + + +/** + * The exception that is thrown when a requested method or operation is not implemented. + */ +class NotImplementedException extends \LogicException +{ +} + + +/** + * The exception that is thrown when an invoked method is not supported. For scenarios where + * it is sometimes possible to perform the requested operation, see InvalidStateException. + */ +class NotSupportedException extends \LogicException +{ +} + + +/** + * The exception that is thrown when a requested method or operation is deprecated. + */ +class DeprecatedException extends NotSupportedException +{ +} + + +/** + * The exception that is thrown when accessing a class member (property or method) fails. + */ +class MemberAccessException extends \Error +{ +} + + +/** + * The exception that is thrown when an I/O error occurs. + */ +class IOException extends \RuntimeException +{ +} + + +/** + * The exception that is thrown when accessing a file that does not exist on disk. + */ +class FileNotFoundException extends IOException +{ +} + + +/** + * The exception that is thrown when part of a file or directory cannot be found. + */ +class DirectoryNotFoundException extends IOException +{ +} + + +/** + * The exception that is thrown when an argument does not match with the expected value. + */ +class InvalidArgumentException extends \InvalidArgumentException +{ +} + + +/** + * The exception that is thrown when an illegal index was requested. + */ +class OutOfRangeException extends \OutOfRangeException +{ +} + + +/** + * The exception that is thrown when a value (typically returned by function) does not match with the expected value. + */ +class UnexpectedValueException extends \UnexpectedValueException +{ +} diff --git a/vendor/nikic/php-parser/LICENSE b/vendor/nikic/php-parser/LICENSE new file mode 100644 index 00000000..2e567183 --- /dev/null +++ b/vendor/nikic/php-parser/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2011, Nikita Popov +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/nikic/php-parser/README.md b/vendor/nikic/php-parser/README.md new file mode 100644 index 00000000..7555838e --- /dev/null +++ b/vendor/nikic/php-parser/README.md @@ -0,0 +1,233 @@ +PHP Parser +========== + +[![Coverage Status](https://coveralls.io/repos/github/nikic/PHP-Parser/badge.svg?branch=master)](https://coveralls.io/github/nikic/PHP-Parser?branch=master) + +This is a PHP parser written in PHP. Its purpose is to simplify static code analysis and +manipulation. + +[**Documentation for version 5.x**][doc_master] (current; for running on PHP >= 7.4; for parsing PHP 7.0 to PHP 8.3, with limited support for parsing PHP 5.x). + +[Documentation for version 4.x][doc_4_x] (supported; for running on PHP >= 7.0; for parsing PHP 5.2 to PHP 8.3). + +Features +-------- + +The main features provided by this library are: + + * Parsing PHP 7, and PHP 8 code into an abstract syntax tree (AST). + * Invalid code can be parsed into a partial AST. + * The AST contains accurate location information. + * Dumping the AST in human-readable form. + * Converting an AST back to PHP code. + * Formatting can be preserved for partially changed ASTs. + * Infrastructure to traverse and modify ASTs. + * Resolution of namespaced names. + * Evaluation of constant expressions. + * Builders to simplify AST construction for code generation. + * Converting an AST into JSON and back. + +Quick Start +----------- + +Install the library using [composer](https://getcomposer.org): + + php composer.phar require nikic/php-parser + +Parse some PHP code into an AST and dump the result in human-readable form: + +```php +<?php +use PhpParser\Error; +use PhpParser\NodeDumper; +use PhpParser\ParserFactory; + +$code = <<<'CODE' +<?php + +function test($foo) +{ + var_dump($foo); +} +CODE; + +$parser = (new ParserFactory())->createForNewestSupportedVersion(); +try { + $ast = $parser->parse($code); +} catch (Error $error) { + echo "Parse error: {$error->getMessage()}\n"; + return; +} + +$dumper = new NodeDumper; +echo $dumper->dump($ast) . "\n"; +``` + +This dumps an AST looking something like this: + +``` +array( + 0: Stmt_Function( + attrGroups: array( + ) + byRef: false + name: Identifier( + name: test + ) + params: array( + 0: Param( + attrGroups: array( + ) + flags: 0 + type: null + byRef: false + variadic: false + var: Expr_Variable( + name: foo + ) + default: null + ) + ) + returnType: null + stmts: array( + 0: Stmt_Expression( + expr: Expr_FuncCall( + name: Name( + name: var_dump + ) + args: array( + 0: Arg( + name: null + value: Expr_Variable( + name: foo + ) + byRef: false + unpack: false + ) + ) + ) + ) + ) + ) +) +``` + +Let's traverse the AST and perform some kind of modification. For example, drop all function bodies: + +```php +use PhpParser\Node; +use PhpParser\Node\Stmt\Function_; +use PhpParser\NodeTraverser; +use PhpParser\NodeVisitorAbstract; + +$traverser = new NodeTraverser(); +$traverser->addVisitor(new class extends NodeVisitorAbstract { + public function enterNode(Node $node) { + if ($node instanceof Function_) { + // Clean out the function body + $node->stmts = []; + } + } +}); + +$ast = $traverser->traverse($ast); +echo $dumper->dump($ast) . "\n"; +``` + +This gives us an AST where the `Function_::$stmts` are empty: + +``` +array( + 0: Stmt_Function( + attrGroups: array( + ) + byRef: false + name: Identifier( + name: test + ) + params: array( + 0: Param( + attrGroups: array( + ) + type: null + byRef: false + variadic: false + var: Expr_Variable( + name: foo + ) + default: null + ) + ) + returnType: null + stmts: array( + ) + ) +) +``` + +Finally, we can convert the new AST back to PHP code: + +```php +use PhpParser\PrettyPrinter; + +$prettyPrinter = new PrettyPrinter\Standard; +echo $prettyPrinter->prettyPrintFile($ast); +``` + +This gives us our original code, minus the `var_dump()` call inside the function: + +```php +<?php + +function test($foo) +{ +} +``` + +For a more comprehensive introduction, see the documentation. + +Documentation +------------- + + 1. [Introduction](doc/0_Introduction.markdown) + 2. [Usage of basic components](doc/2_Usage_of_basic_components.markdown) + +Component documentation: + + * [Walking the AST](doc/component/Walking_the_AST.markdown) + * Node visitors + * Modifying the AST from a visitor + * Short-circuiting traversals + * Interleaved visitors + * Simple node finding API + * Parent and sibling references + * [Name resolution](doc/component/Name_resolution.markdown) + * Name resolver options + * Name resolution context + * [Pretty printing](doc/component/Pretty_printing.markdown) + * Converting AST back to PHP code + * Customizing formatting + * Formatting-preserving code transformations + * [AST builders](doc/component/AST_builders.markdown) + * Fluent builders for AST nodes + * [Lexer](doc/component/Lexer.markdown) + * Emulation + * Tokens, positions and attributes + * [Error handling](doc/component/Error_handling.markdown) + * Column information for errors + * Error recovery (parsing of syntactically incorrect code) + * [Constant expression evaluation](doc/component/Constant_expression_evaluation.markdown) + * Evaluating constant/property/etc initializers + * Handling errors and unsupported expressions + * [JSON representation](doc/component/JSON_representation.markdown) + * JSON encoding and decoding of ASTs + * [Performance](doc/component/Performance.markdown) + * Disabling Xdebug + * Reusing objects + * Garbage collection impact + * [Frequently asked questions](doc/component/FAQ.markdown) + * Parent and sibling references + + [doc_3_x]: https://github.com/nikic/PHP-Parser/tree/3.x/doc + [doc_4_x]: https://github.com/nikic/PHP-Parser/tree/4.x/doc + [doc_master]: https://github.com/nikic/PHP-Parser/tree/master/doc diff --git a/vendor/nikic/php-parser/composer.json b/vendor/nikic/php-parser/composer.json new file mode 100644 index 00000000..b52f3ee5 --- /dev/null +++ b/vendor/nikic/php-parser/composer.json @@ -0,0 +1,43 @@ +{ + "name": "nikic/php-parser", + "type": "library", + "description": "A PHP parser written in PHP", + "keywords": [ + "php", + "parser" + ], + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Nikita Popov" + } + ], + "require": { + "php": ">=7.4", + "ext-tokenizer": "*", + "ext-json": "*", + "ext-ctype": "*" + }, + "require-dev": { + "phpunit/phpunit": "^9.0", + "ircmaxell/php-yacc": "^0.0.7" + }, + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "autoload-dev": { + "psr-4": { + "PhpParser\\": "test/PhpParser/" + } + }, + "bin": [ + "bin/php-parse" + ] +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder.php b/vendor/nikic/php-parser/lib/PhpParser/Builder.php new file mode 100644 index 00000000..d6aa124c --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder.php @@ -0,0 +1,12 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +interface Builder { + /** + * Returns the built node. + * + * @return Node The built node + */ + public function getNode(): Node; +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/ClassConst.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/ClassConst.php new file mode 100644 index 00000000..fa5dc10e --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/ClassConst.php @@ -0,0 +1,150 @@ +<?php + +declare(strict_types=1); + +namespace PhpParser\Builder; + +use PhpParser; +use PhpParser\BuilderHelpers; +use PhpParser\Modifiers; +use PhpParser\Node; +use PhpParser\Node\Const_; +use PhpParser\Node\Identifier; +use PhpParser\Node\Stmt; + +class ClassConst implements PhpParser\Builder { + protected int $flags = 0; + /** @var array<string, mixed> */ + protected array $attributes = []; + /** @var list<Const_> */ + protected array $constants = []; + + /** @var list<Node\AttributeGroup> */ + protected array $attributeGroups = []; + /** @var Identifier|Node\Name|Node\ComplexType|null */ + protected ?Node $type = null; + + /** + * Creates a class constant builder + * + * @param string|Identifier $name Name + * @param Node\Expr|bool|null|int|float|string|array $value Value + */ + public function __construct($name, $value) { + $this->constants = [new Const_($name, BuilderHelpers::normalizeValue($value))]; + } + + /** + * Add another constant to const group + * + * @param string|Identifier $name Name + * @param Node\Expr|bool|null|int|float|string|array $value Value + * + * @return $this The builder instance (for fluid interface) + */ + public function addConst($name, $value) { + $this->constants[] = new Const_($name, BuilderHelpers::normalizeValue($value)); + + return $this; + } + + /** + * Makes the constant public. + * + * @return $this The builder instance (for fluid interface) + */ + public function makePublic() { + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PUBLIC); + + return $this; + } + + /** + * Makes the constant protected. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeProtected() { + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PROTECTED); + + return $this; + } + + /** + * Makes the constant private. + * + * @return $this The builder instance (for fluid interface) + */ + public function makePrivate() { + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PRIVATE); + + return $this; + } + + /** + * Makes the constant final. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeFinal() { + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::FINAL); + + return $this; + } + + /** + * Sets doc comment for the constant. + * + * @param PhpParser\Comment\Doc|string $docComment Doc comment to set + * + * @return $this The builder instance (for fluid interface) + */ + public function setDocComment($docComment) { + $this->attributes = [ + 'comments' => [BuilderHelpers::normalizeDocComment($docComment)] + ]; + + return $this; + } + + /** + * Adds an attribute group. + * + * @param Node\Attribute|Node\AttributeGroup $attribute + * + * @return $this The builder instance (for fluid interface) + */ + public function addAttribute($attribute) { + $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute); + + return $this; + } + + /** + * Sets the constant type. + * + * @param string|Node\Name|Identifier|Node\ComplexType $type + * + * @return $this + */ + public function setType($type) { + $this->type = BuilderHelpers::normalizeType($type); + + return $this; + } + + /** + * Returns the built class node. + * + * @return Stmt\ClassConst The built constant node + */ + public function getNode(): PhpParser\Node { + return new Stmt\ClassConst( + $this->constants, + $this->flags, + $this->attributes, + $this->attributeGroups, + $this->type + ); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Class_.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Class_.php new file mode 100644 index 00000000..6f394315 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Class_.php @@ -0,0 +1,151 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Builder; + +use PhpParser; +use PhpParser\BuilderHelpers; +use PhpParser\Modifiers; +use PhpParser\Node; +use PhpParser\Node\Name; +use PhpParser\Node\Stmt; + +class Class_ extends Declaration { + protected string $name; + protected ?Name $extends = null; + /** @var list<Name> */ + protected array $implements = []; + protected int $flags = 0; + /** @var list<Stmt\TraitUse> */ + protected array $uses = []; + /** @var list<Stmt\ClassConst> */ + protected array $constants = []; + /** @var list<Stmt\Property> */ + protected array $properties = []; + /** @var list<Stmt\ClassMethod> */ + protected array $methods = []; + /** @var list<Node\AttributeGroup> */ + protected array $attributeGroups = []; + + /** + * Creates a class builder. + * + * @param string $name Name of the class + */ + public function __construct(string $name) { + $this->name = $name; + } + + /** + * Extends a class. + * + * @param Name|string $class Name of class to extend + * + * @return $this The builder instance (for fluid interface) + */ + public function extend($class) { + $this->extends = BuilderHelpers::normalizeName($class); + + return $this; + } + + /** + * Implements one or more interfaces. + * + * @param Name|string ...$interfaces Names of interfaces to implement + * + * @return $this The builder instance (for fluid interface) + */ + public function implement(...$interfaces) { + foreach ($interfaces as $interface) { + $this->implements[] = BuilderHelpers::normalizeName($interface); + } + + return $this; + } + + /** + * Makes the class abstract. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeAbstract() { + $this->flags = BuilderHelpers::addClassModifier($this->flags, Modifiers::ABSTRACT); + + return $this; + } + + /** + * Makes the class final. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeFinal() { + $this->flags = BuilderHelpers::addClassModifier($this->flags, Modifiers::FINAL); + + return $this; + } + + /** + * Makes the class readonly. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeReadonly() { + $this->flags = BuilderHelpers::addClassModifier($this->flags, Modifiers::READONLY); + + return $this; + } + + /** + * Adds a statement. + * + * @param Stmt|PhpParser\Builder $stmt The statement to add + * + * @return $this The builder instance (for fluid interface) + */ + public function addStmt($stmt) { + $stmt = BuilderHelpers::normalizeNode($stmt); + + if ($stmt instanceof Stmt\Property) { + $this->properties[] = $stmt; + } elseif ($stmt instanceof Stmt\ClassMethod) { + $this->methods[] = $stmt; + } elseif ($stmt instanceof Stmt\TraitUse) { + $this->uses[] = $stmt; + } elseif ($stmt instanceof Stmt\ClassConst) { + $this->constants[] = $stmt; + } else { + throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType())); + } + + return $this; + } + + /** + * Adds an attribute group. + * + * @param Node\Attribute|Node\AttributeGroup $attribute + * + * @return $this The builder instance (for fluid interface) + */ + public function addAttribute($attribute) { + $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute); + + return $this; + } + + /** + * Returns the built class node. + * + * @return Stmt\Class_ The built class node + */ + public function getNode(): PhpParser\Node { + return new Stmt\Class_($this->name, [ + 'flags' => $this->flags, + 'extends' => $this->extends, + 'implements' => $this->implements, + 'stmts' => array_merge($this->uses, $this->constants, $this->properties, $this->methods), + 'attrGroups' => $this->attributeGroups, + ], $this->attributes); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Declaration.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Declaration.php new file mode 100644 index 00000000..488b7213 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Declaration.php @@ -0,0 +1,50 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Builder; + +use PhpParser; +use PhpParser\BuilderHelpers; + +abstract class Declaration implements PhpParser\Builder { + /** @var array<string, mixed> */ + protected array $attributes = []; + + /** + * Adds a statement. + * + * @param PhpParser\Node\Stmt|PhpParser\Builder $stmt The statement to add + * + * @return $this The builder instance (for fluid interface) + */ + abstract public function addStmt($stmt); + + /** + * Adds multiple statements. + * + * @param (PhpParser\Node\Stmt|PhpParser\Builder)[] $stmts The statements to add + * + * @return $this The builder instance (for fluid interface) + */ + public function addStmts(array $stmts) { + foreach ($stmts as $stmt) { + $this->addStmt($stmt); + } + + return $this; + } + + /** + * Sets doc comment for the declaration. + * + * @param PhpParser\Comment\Doc|string $docComment Doc comment to set + * + * @return $this The builder instance (for fluid interface) + */ + public function setDocComment($docComment) { + $this->attributes['comments'] = [ + BuilderHelpers::normalizeDocComment($docComment) + ]; + + return $this; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php new file mode 100644 index 00000000..04058bf5 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php @@ -0,0 +1,87 @@ +<?php + +declare(strict_types=1); + +namespace PhpParser\Builder; + +use PhpParser; +use PhpParser\BuilderHelpers; +use PhpParser\Node; +use PhpParser\Node\Identifier; +use PhpParser\Node\Stmt; + +class EnumCase implements PhpParser\Builder { + /** @var Identifier|string */ + protected $name; + /** @var ?Node\Expr */ + protected ?Node\Expr $value = null; + /** @var array<string, mixed> */ + protected array $attributes = []; + + /** @var list<Node\AttributeGroup> */ + protected array $attributeGroups = []; + + /** + * Creates an enum case builder. + * + * @param string|Identifier $name Name + */ + public function __construct($name) { + $this->name = $name; + } + + /** + * Sets the value. + * + * @param Node\Expr|string|int $value + * + * @return $this + */ + public function setValue($value) { + $this->value = BuilderHelpers::normalizeValue($value); + + return $this; + } + + /** + * Sets doc comment for the constant. + * + * @param PhpParser\Comment\Doc|string $docComment Doc comment to set + * + * @return $this The builder instance (for fluid interface) + */ + public function setDocComment($docComment) { + $this->attributes = [ + 'comments' => [BuilderHelpers::normalizeDocComment($docComment)] + ]; + + return $this; + } + + /** + * Adds an attribute group. + * + * @param Node\Attribute|Node\AttributeGroup $attribute + * + * @return $this The builder instance (for fluid interface) + */ + public function addAttribute($attribute) { + $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute); + + return $this; + } + + /** + * Returns the built enum case node. + * + * @return Stmt\EnumCase The built constant node + */ + public function getNode(): PhpParser\Node { + return new Stmt\EnumCase( + $this->name, + $this->value, + $this->attributeGroups, + $this->attributes + ); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Enum_.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Enum_.php new file mode 100644 index 00000000..c00df03f --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Enum_.php @@ -0,0 +1,116 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Builder; + +use PhpParser; +use PhpParser\BuilderHelpers; +use PhpParser\Node; +use PhpParser\Node\Identifier; +use PhpParser\Node\Name; +use PhpParser\Node\Stmt; + +class Enum_ extends Declaration { + protected string $name; + protected ?Identifier $scalarType = null; + /** @var list<Name> */ + protected array $implements = []; + /** @var list<Stmt\TraitUse> */ + protected array $uses = []; + /** @var list<Stmt\EnumCase> */ + protected array $enumCases = []; + /** @var list<Stmt\ClassConst> */ + protected array $constants = []; + /** @var list<Stmt\ClassMethod> */ + protected array $methods = []; + /** @var list<Node\AttributeGroup> */ + protected array $attributeGroups = []; + + /** + * Creates an enum builder. + * + * @param string $name Name of the enum + */ + public function __construct(string $name) { + $this->name = $name; + } + + /** + * Sets the scalar type. + * + * @param string|Identifier $scalarType + * + * @return $this + */ + public function setScalarType($scalarType) { + $this->scalarType = BuilderHelpers::normalizeType($scalarType); + + return $this; + } + + /** + * Implements one or more interfaces. + * + * @param Name|string ...$interfaces Names of interfaces to implement + * + * @return $this The builder instance (for fluid interface) + */ + public function implement(...$interfaces) { + foreach ($interfaces as $interface) { + $this->implements[] = BuilderHelpers::normalizeName($interface); + } + + return $this; + } + + /** + * Adds a statement. + * + * @param Stmt|PhpParser\Builder $stmt The statement to add + * + * @return $this The builder instance (for fluid interface) + */ + public function addStmt($stmt) { + $stmt = BuilderHelpers::normalizeNode($stmt); + + if ($stmt instanceof Stmt\EnumCase) { + $this->enumCases[] = $stmt; + } elseif ($stmt instanceof Stmt\ClassMethod) { + $this->methods[] = $stmt; + } elseif ($stmt instanceof Stmt\TraitUse) { + $this->uses[] = $stmt; + } elseif ($stmt instanceof Stmt\ClassConst) { + $this->constants[] = $stmt; + } else { + throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType())); + } + + return $this; + } + + /** + * Adds an attribute group. + * + * @param Node\Attribute|Node\AttributeGroup $attribute + * + * @return $this The builder instance (for fluid interface) + */ + public function addAttribute($attribute) { + $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute); + + return $this; + } + + /** + * Returns the built class node. + * + * @return Stmt\Enum_ The built enum node + */ + public function getNode(): PhpParser\Node { + return new Stmt\Enum_($this->name, [ + 'scalarType' => $this->scalarType, + 'implements' => $this->implements, + 'stmts' => array_merge($this->uses, $this->enumCases, $this->constants, $this->methods), + 'attrGroups' => $this->attributeGroups, + ], $this->attributes); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php new file mode 100644 index 00000000..ff79cb6b --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php @@ -0,0 +1,73 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Builder; + +use PhpParser\BuilderHelpers; +use PhpParser\Node; + +abstract class FunctionLike extends Declaration { + protected bool $returnByRef = false; + /** @var Node\Param[] */ + protected array $params = []; + + /** @var Node\Identifier|Node\Name|Node\ComplexType|null */ + protected ?Node $returnType = null; + + /** + * Make the function return by reference. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeReturnByRef() { + $this->returnByRef = true; + + return $this; + } + + /** + * Adds a parameter. + * + * @param Node\Param|Param $param The parameter to add + * + * @return $this The builder instance (for fluid interface) + */ + public function addParam($param) { + $param = BuilderHelpers::normalizeNode($param); + + if (!$param instanceof Node\Param) { + throw new \LogicException(sprintf('Expected parameter node, got "%s"', $param->getType())); + } + + $this->params[] = $param; + + return $this; + } + + /** + * Adds multiple parameters. + * + * @param (Node\Param|Param)[] $params The parameters to add + * + * @return $this The builder instance (for fluid interface) + */ + public function addParams(array $params) { + foreach ($params as $param) { + $this->addParam($param); + } + + return $this; + } + + /** + * Sets the return type for PHP 7. + * + * @param string|Node\Name|Node\Identifier|Node\ComplexType $type + * + * @return $this The builder instance (for fluid interface) + */ + public function setReturnType($type) { + $this->returnType = BuilderHelpers::normalizeType($type); + + return $this; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Function_.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Function_.php new file mode 100644 index 00000000..48f5f693 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Function_.php @@ -0,0 +1,67 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Builder; + +use PhpParser; +use PhpParser\BuilderHelpers; +use PhpParser\Node; +use PhpParser\Node\Stmt; + +class Function_ extends FunctionLike { + protected string $name; + /** @var list<Stmt> */ + protected array $stmts = []; + + /** @var list<Node\AttributeGroup> */ + protected array $attributeGroups = []; + + /** + * Creates a function builder. + * + * @param string $name Name of the function + */ + public function __construct(string $name) { + $this->name = $name; + } + + /** + * Adds a statement. + * + * @param Node|PhpParser\Builder $stmt The statement to add + * + * @return $this The builder instance (for fluid interface) + */ + public function addStmt($stmt) { + $this->stmts[] = BuilderHelpers::normalizeStmt($stmt); + + return $this; + } + + /** + * Adds an attribute group. + * + * @param Node\Attribute|Node\AttributeGroup $attribute + * + * @return $this The builder instance (for fluid interface) + */ + public function addAttribute($attribute) { + $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute); + + return $this; + } + + /** + * Returns the built function node. + * + * @return Stmt\Function_ The built function node + */ + public function getNode(): Node { + return new Stmt\Function_($this->name, [ + 'byRef' => $this->returnByRef, + 'params' => $this->params, + 'returnType' => $this->returnType, + 'stmts' => $this->stmts, + 'attrGroups' => $this->attributeGroups, + ], $this->attributes); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Interface_.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Interface_.php new file mode 100644 index 00000000..13dd3f7f --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Interface_.php @@ -0,0 +1,94 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Builder; + +use PhpParser; +use PhpParser\BuilderHelpers; +use PhpParser\Node; +use PhpParser\Node\Name; +use PhpParser\Node\Stmt; + +class Interface_ extends Declaration { + protected string $name; + /** @var list<Name> */ + protected array $extends = []; + /** @var list<Stmt\ClassConst> */ + protected array $constants = []; + /** @var list<Stmt\ClassMethod> */ + protected array $methods = []; + /** @var list<Node\AttributeGroup> */ + protected array $attributeGroups = []; + + /** + * Creates an interface builder. + * + * @param string $name Name of the interface + */ + public function __construct(string $name) { + $this->name = $name; + } + + /** + * Extends one or more interfaces. + * + * @param Name|string ...$interfaces Names of interfaces to extend + * + * @return $this The builder instance (for fluid interface) + */ + public function extend(...$interfaces) { + foreach ($interfaces as $interface) { + $this->extends[] = BuilderHelpers::normalizeName($interface); + } + + return $this; + } + + /** + * Adds a statement. + * + * @param Stmt|PhpParser\Builder $stmt The statement to add + * + * @return $this The builder instance (for fluid interface) + */ + public function addStmt($stmt) { + $stmt = BuilderHelpers::normalizeNode($stmt); + + if ($stmt instanceof Stmt\ClassConst) { + $this->constants[] = $stmt; + } elseif ($stmt instanceof Stmt\ClassMethod) { + // we erase all statements in the body of an interface method + $stmt->stmts = null; + $this->methods[] = $stmt; + } else { + throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType())); + } + + return $this; + } + + /** + * Adds an attribute group. + * + * @param Node\Attribute|Node\AttributeGroup $attribute + * + * @return $this The builder instance (for fluid interface) + */ + public function addAttribute($attribute) { + $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute); + + return $this; + } + + /** + * Returns the built interface node. + * + * @return Stmt\Interface_ The built interface node + */ + public function getNode(): PhpParser\Node { + return new Stmt\Interface_($this->name, [ + 'extends' => $this->extends, + 'stmts' => array_merge($this->constants, $this->methods), + 'attrGroups' => $this->attributeGroups, + ], $this->attributes); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Method.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Method.php new file mode 100644 index 00000000..8358dbe3 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Method.php @@ -0,0 +1,147 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Builder; + +use PhpParser; +use PhpParser\BuilderHelpers; +use PhpParser\Modifiers; +use PhpParser\Node; +use PhpParser\Node\Stmt; + +class Method extends FunctionLike { + protected string $name; + + protected int $flags = 0; + + /** @var list<Stmt>|null */ + protected ?array $stmts = []; + + /** @var list<Node\AttributeGroup> */ + protected array $attributeGroups = []; + + /** + * Creates a method builder. + * + * @param string $name Name of the method + */ + public function __construct(string $name) { + $this->name = $name; + } + + /** + * Makes the method public. + * + * @return $this The builder instance (for fluid interface) + */ + public function makePublic() { + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PUBLIC); + + return $this; + } + + /** + * Makes the method protected. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeProtected() { + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PROTECTED); + + return $this; + } + + /** + * Makes the method private. + * + * @return $this The builder instance (for fluid interface) + */ + public function makePrivate() { + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PRIVATE); + + return $this; + } + + /** + * Makes the method static. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeStatic() { + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::STATIC); + + return $this; + } + + /** + * Makes the method abstract. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeAbstract() { + if (!empty($this->stmts)) { + throw new \LogicException('Cannot make method with statements abstract'); + } + + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::ABSTRACT); + $this->stmts = null; // abstract methods don't have statements + + return $this; + } + + /** + * Makes the method final. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeFinal() { + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::FINAL); + + return $this; + } + + /** + * Adds a statement. + * + * @param Node|PhpParser\Builder $stmt The statement to add + * + * @return $this The builder instance (for fluid interface) + */ + public function addStmt($stmt) { + if (null === $this->stmts) { + throw new \LogicException('Cannot add statements to an abstract method'); + } + + $this->stmts[] = BuilderHelpers::normalizeStmt($stmt); + + return $this; + } + + /** + * Adds an attribute group. + * + * @param Node\Attribute|Node\AttributeGroup $attribute + * + * @return $this The builder instance (for fluid interface) + */ + public function addAttribute($attribute) { + $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute); + + return $this; + } + + /** + * Returns the built method node. + * + * @return Stmt\ClassMethod The built method node + */ + public function getNode(): Node { + return new Stmt\ClassMethod($this->name, [ + 'flags' => $this->flags, + 'byRef' => $this->returnByRef, + 'params' => $this->params, + 'returnType' => $this->returnType, + 'stmts' => $this->stmts, + 'attrGroups' => $this->attributeGroups, + ], $this->attributes); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php new file mode 100644 index 00000000..80fe6f84 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php @@ -0,0 +1,45 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Builder; + +use PhpParser; +use PhpParser\BuilderHelpers; +use PhpParser\Node; +use PhpParser\Node\Stmt; + +class Namespace_ extends Declaration { + private ?Node\Name $name; + /** @var Stmt[] */ + private array $stmts = []; + + /** + * Creates a namespace builder. + * + * @param Node\Name|string|null $name Name of the namespace + */ + public function __construct($name) { + $this->name = null !== $name ? BuilderHelpers::normalizeName($name) : null; + } + + /** + * Adds a statement. + * + * @param Node|PhpParser\Builder $stmt The statement to add + * + * @return $this The builder instance (for fluid interface) + */ + public function addStmt($stmt) { + $this->stmts[] = BuilderHelpers::normalizeStmt($stmt); + + return $this; + } + + /** + * Returns the built node. + * + * @return Stmt\Namespace_ The built node + */ + public function getNode(): Node { + return new Stmt\Namespace_($this->name, $this->stmts, $this->attributes); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Param.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Param.php new file mode 100644 index 00000000..f439e876 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Param.php @@ -0,0 +1,149 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Builder; + +use PhpParser; +use PhpParser\BuilderHelpers; +use PhpParser\Modifiers; +use PhpParser\Node; + +class Param implements PhpParser\Builder { + protected string $name; + protected ?Node\Expr $default = null; + /** @var Node\Identifier|Node\Name|Node\ComplexType|null */ + protected ?Node $type = null; + protected bool $byRef = false; + protected int $flags = 0; + protected bool $variadic = false; + /** @var list<Node\AttributeGroup> */ + protected array $attributeGroups = []; + + /** + * Creates a parameter builder. + * + * @param string $name Name of the parameter + */ + public function __construct(string $name) { + $this->name = $name; + } + + /** + * Sets default value for the parameter. + * + * @param mixed $value Default value to use + * + * @return $this The builder instance (for fluid interface) + */ + public function setDefault($value) { + $this->default = BuilderHelpers::normalizeValue($value); + + return $this; + } + + /** + * Sets type for the parameter. + * + * @param string|Node\Name|Node\Identifier|Node\ComplexType $type Parameter type + * + * @return $this The builder instance (for fluid interface) + */ + public function setType($type) { + $this->type = BuilderHelpers::normalizeType($type); + if ($this->type == 'void') { + throw new \LogicException('Parameter type cannot be void'); + } + + return $this; + } + + /** + * Make the parameter accept the value by reference. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeByRef() { + $this->byRef = true; + + return $this; + } + + /** + * Make the parameter variadic + * + * @return $this The builder instance (for fluid interface) + */ + public function makeVariadic() { + $this->variadic = true; + + return $this; + } + + /** + * Makes the (promoted) parameter public. + * + * @return $this The builder instance (for fluid interface) + */ + public function makePublic() { + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PUBLIC); + + return $this; + } + + /** + * Makes the (promoted) parameter protected. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeProtected() { + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PROTECTED); + + return $this; + } + + /** + * Makes the (promoted) parameter private. + * + * @return $this The builder instance (for fluid interface) + */ + public function makePrivate() { + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PRIVATE); + + return $this; + } + + /** + * Makes the (promoted) parameter readonly. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeReadonly() { + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::READONLY); + + return $this; + } + + /** + * Adds an attribute group. + * + * @param Node\Attribute|Node\AttributeGroup $attribute + * + * @return $this The builder instance (for fluid interface) + */ + public function addAttribute($attribute) { + $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute); + + return $this; + } + + /** + * Returns the built parameter node. + * + * @return Node\Param The built parameter node + */ + public function getNode(): Node { + return new Node\Param( + new Node\Expr\Variable($this->name), + $this->default, $this->type, $this->byRef, $this->variadic, [], $this->flags, $this->attributeGroups + ); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Property.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Property.php new file mode 100644 index 00000000..3fc96d98 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Property.php @@ -0,0 +1,161 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Builder; + +use PhpParser; +use PhpParser\BuilderHelpers; +use PhpParser\Modifiers; +use PhpParser\Node; +use PhpParser\Node\Identifier; +use PhpParser\Node\Name; +use PhpParser\Node\Stmt; +use PhpParser\Node\ComplexType; + +class Property implements PhpParser\Builder { + protected string $name; + + protected int $flags = 0; + + protected ?Node\Expr $default = null; + /** @var array<string, mixed> */ + protected array $attributes = []; + /** @var null|Identifier|Name|ComplexType */ + protected ?Node $type = null; + /** @var list<Node\AttributeGroup> */ + protected array $attributeGroups = []; + + /** + * Creates a property builder. + * + * @param string $name Name of the property + */ + public function __construct(string $name) { + $this->name = $name; + } + + /** + * Makes the property public. + * + * @return $this The builder instance (for fluid interface) + */ + public function makePublic() { + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PUBLIC); + + return $this; + } + + /** + * Makes the property protected. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeProtected() { + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PROTECTED); + + return $this; + } + + /** + * Makes the property private. + * + * @return $this The builder instance (for fluid interface) + */ + public function makePrivate() { + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PRIVATE); + + return $this; + } + + /** + * Makes the property static. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeStatic() { + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::STATIC); + + return $this; + } + + /** + * Makes the property readonly. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeReadonly() { + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::READONLY); + + return $this; + } + + /** + * Sets default value for the property. + * + * @param mixed $value Default value to use + * + * @return $this The builder instance (for fluid interface) + */ + public function setDefault($value) { + $this->default = BuilderHelpers::normalizeValue($value); + + return $this; + } + + /** + * Sets doc comment for the property. + * + * @param PhpParser\Comment\Doc|string $docComment Doc comment to set + * + * @return $this The builder instance (for fluid interface) + */ + public function setDocComment($docComment) { + $this->attributes = [ + 'comments' => [BuilderHelpers::normalizeDocComment($docComment)] + ]; + + return $this; + } + + /** + * Sets the property type for PHP 7.4+. + * + * @param string|Name|Identifier|ComplexType $type + * + * @return $this + */ + public function setType($type) { + $this->type = BuilderHelpers::normalizeType($type); + + return $this; + } + + /** + * Adds an attribute group. + * + * @param Node\Attribute|Node\AttributeGroup $attribute + * + * @return $this The builder instance (for fluid interface) + */ + public function addAttribute($attribute) { + $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute); + + return $this; + } + + /** + * Returns the built class node. + * + * @return Stmt\Property The built property node + */ + public function getNode(): PhpParser\Node { + return new Stmt\Property( + $this->flags !== 0 ? $this->flags : Modifiers::PUBLIC, + [ + new Node\PropertyItem($this->name, $this->default) + ], + $this->attributes, + $this->type, + $this->attributeGroups + ); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUse.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUse.php new file mode 100644 index 00000000..cf21c821 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUse.php @@ -0,0 +1,65 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Builder; + +use PhpParser\Builder; +use PhpParser\BuilderHelpers; +use PhpParser\Node; +use PhpParser\Node\Stmt; + +class TraitUse implements Builder { + /** @var Node\Name[] */ + protected array $traits = []; + /** @var Stmt\TraitUseAdaptation[] */ + protected array $adaptations = []; + + /** + * Creates a trait use builder. + * + * @param Node\Name|string ...$traits Names of used traits + */ + public function __construct(...$traits) { + foreach ($traits as $trait) { + $this->and($trait); + } + } + + /** + * Adds used trait. + * + * @param Node\Name|string $trait Trait name + * + * @return $this The builder instance (for fluid interface) + */ + public function and($trait) { + $this->traits[] = BuilderHelpers::normalizeName($trait); + return $this; + } + + /** + * Adds trait adaptation. + * + * @param Stmt\TraitUseAdaptation|Builder\TraitUseAdaptation $adaptation Trait adaptation + * + * @return $this The builder instance (for fluid interface) + */ + public function with($adaptation) { + $adaptation = BuilderHelpers::normalizeNode($adaptation); + + if (!$adaptation instanceof Stmt\TraitUseAdaptation) { + throw new \LogicException('Adaptation must have type TraitUseAdaptation'); + } + + $this->adaptations[] = $adaptation; + return $this; + } + + /** + * Returns the built node. + * + * @return Node The built node + */ + public function getNode(): Node { + return new Stmt\TraitUse($this->traits, $this->adaptations); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUseAdaptation.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUseAdaptation.php new file mode 100644 index 00000000..fee09583 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUseAdaptation.php @@ -0,0 +1,145 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Builder; + +use PhpParser\Builder; +use PhpParser\BuilderHelpers; +use PhpParser\Modifiers; +use PhpParser\Node; +use PhpParser\Node\Stmt; + +class TraitUseAdaptation implements Builder { + private const TYPE_UNDEFINED = 0; + private const TYPE_ALIAS = 1; + private const TYPE_PRECEDENCE = 2; + + protected int $type; + protected ?Node\Name $trait; + protected Node\Identifier $method; + protected ?int $modifier = null; + protected ?Node\Identifier $alias = null; + /** @var Node\Name[] */ + protected array $insteadof = []; + + /** + * Creates a trait use adaptation builder. + * + * @param Node\Name|string|null $trait Name of adapted trait + * @param Node\Identifier|string $method Name of adapted method + */ + public function __construct($trait, $method) { + $this->type = self::TYPE_UNDEFINED; + + $this->trait = is_null($trait) ? null : BuilderHelpers::normalizeName($trait); + $this->method = BuilderHelpers::normalizeIdentifier($method); + } + + /** + * Sets alias of method. + * + * @param Node\Identifier|string $alias Alias for adapted method + * + * @return $this The builder instance (for fluid interface) + */ + public function as($alias) { + if ($this->type === self::TYPE_UNDEFINED) { + $this->type = self::TYPE_ALIAS; + } + + if ($this->type !== self::TYPE_ALIAS) { + throw new \LogicException('Cannot set alias for not alias adaptation buider'); + } + + $this->alias = BuilderHelpers::normalizeIdentifier($alias); + return $this; + } + + /** + * Sets adapted method public. + * + * @return $this The builder instance (for fluid interface) + */ + public function makePublic() { + $this->setModifier(Modifiers::PUBLIC); + return $this; + } + + /** + * Sets adapted method protected. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeProtected() { + $this->setModifier(Modifiers::PROTECTED); + return $this; + } + + /** + * Sets adapted method private. + * + * @return $this The builder instance (for fluid interface) + */ + public function makePrivate() { + $this->setModifier(Modifiers::PRIVATE); + return $this; + } + + /** + * Adds overwritten traits. + * + * @param Node\Name|string ...$traits Traits for overwrite + * + * @return $this The builder instance (for fluid interface) + */ + public function insteadof(...$traits) { + if ($this->type === self::TYPE_UNDEFINED) { + if (is_null($this->trait)) { + throw new \LogicException('Precedence adaptation must have trait'); + } + + $this->type = self::TYPE_PRECEDENCE; + } + + if ($this->type !== self::TYPE_PRECEDENCE) { + throw new \LogicException('Cannot add overwritten traits for not precedence adaptation buider'); + } + + foreach ($traits as $trait) { + $this->insteadof[] = BuilderHelpers::normalizeName($trait); + } + + return $this; + } + + protected function setModifier(int $modifier): void { + if ($this->type === self::TYPE_UNDEFINED) { + $this->type = self::TYPE_ALIAS; + } + + if ($this->type !== self::TYPE_ALIAS) { + throw new \LogicException('Cannot set access modifier for not alias adaptation buider'); + } + + if (is_null($this->modifier)) { + $this->modifier = $modifier; + } else { + throw new \LogicException('Multiple access type modifiers are not allowed'); + } + } + + /** + * Returns the built node. + * + * @return Node The built node + */ + public function getNode(): Node { + switch ($this->type) { + case self::TYPE_ALIAS: + return new Stmt\TraitUseAdaptation\Alias($this->trait, $this->method, $this->modifier, $this->alias); + case self::TYPE_PRECEDENCE: + return new Stmt\TraitUseAdaptation\Precedence($this->trait, $this->method, $this->insteadof); + default: + throw new \LogicException('Type of adaptation is not defined'); + } + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Trait_.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Trait_.php new file mode 100644 index 00000000..ffa1bd5c --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Trait_.php @@ -0,0 +1,83 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Builder; + +use PhpParser; +use PhpParser\BuilderHelpers; +use PhpParser\Node; +use PhpParser\Node\Stmt; + +class Trait_ extends Declaration { + protected string $name; + /** @var list<Stmt\TraitUse> */ + protected array $uses = []; + /** @var list<Stmt\ClassConst> */ + protected array $constants = []; + /** @var list<Stmt\Property> */ + protected array $properties = []; + /** @var list<Stmt\ClassMethod> */ + protected array $methods = []; + /** @var list<Node\AttributeGroup> */ + protected array $attributeGroups = []; + + /** + * Creates an interface builder. + * + * @param string $name Name of the interface + */ + public function __construct(string $name) { + $this->name = $name; + } + + /** + * Adds a statement. + * + * @param Stmt|PhpParser\Builder $stmt The statement to add + * + * @return $this The builder instance (for fluid interface) + */ + public function addStmt($stmt) { + $stmt = BuilderHelpers::normalizeNode($stmt); + + if ($stmt instanceof Stmt\Property) { + $this->properties[] = $stmt; + } elseif ($stmt instanceof Stmt\ClassMethod) { + $this->methods[] = $stmt; + } elseif ($stmt instanceof Stmt\TraitUse) { + $this->uses[] = $stmt; + } elseif ($stmt instanceof Stmt\ClassConst) { + $this->constants[] = $stmt; + } else { + throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType())); + } + + return $this; + } + + /** + * Adds an attribute group. + * + * @param Node\Attribute|Node\AttributeGroup $attribute + * + * @return $this The builder instance (for fluid interface) + */ + public function addAttribute($attribute) { + $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute); + + return $this; + } + + /** + * Returns the built trait node. + * + * @return Stmt\Trait_ The built interface node + */ + public function getNode(): PhpParser\Node { + return new Stmt\Trait_( + $this->name, [ + 'stmts' => array_merge($this->uses, $this->constants, $this->properties, $this->methods), + 'attrGroups' => $this->attributeGroups, + ], $this->attributes + ); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Use_.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Use_.php new file mode 100644 index 00000000..b82cf139 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Use_.php @@ -0,0 +1,49 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Builder; + +use PhpParser\Builder; +use PhpParser\BuilderHelpers; +use PhpParser\Node; +use PhpParser\Node\Stmt; + +class Use_ implements Builder { + protected Node\Name $name; + /** @var Stmt\Use_::TYPE_* */ + protected int $type; + protected ?string $alias = null; + + /** + * Creates a name use (alias) builder. + * + * @param Node\Name|string $name Name of the entity (namespace, class, function, constant) to alias + * @param Stmt\Use_::TYPE_* $type One of the Stmt\Use_::TYPE_* constants + */ + public function __construct($name, int $type) { + $this->name = BuilderHelpers::normalizeName($name); + $this->type = $type; + } + + /** + * Sets alias for used name. + * + * @param string $alias Alias to use (last component of full name by default) + * + * @return $this The builder instance (for fluid interface) + */ + public function as(string $alias) { + $this->alias = $alias; + return $this; + } + + /** + * Returns the built node. + * + * @return Stmt\Use_ The built node + */ + public function getNode(): Node { + return new Stmt\Use_([ + new Node\UseItem($this->name, $this->alias) + ], $this->type); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/BuilderFactory.php b/vendor/nikic/php-parser/lib/PhpParser/BuilderFactory.php new file mode 100644 index 00000000..b7efe5e9 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/BuilderFactory.php @@ -0,0 +1,375 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +use PhpParser\Node\Arg; +use PhpParser\Node\Expr; +use PhpParser\Node\Expr\BinaryOp\Concat; +use PhpParser\Node\Identifier; +use PhpParser\Node\Name; +use PhpParser\Node\Scalar\String_; +use PhpParser\Node\Stmt\Use_; + +class BuilderFactory { + /** + * Creates an attribute node. + * + * @param string|Name $name Name of the attribute + * @param array $args Attribute named arguments + */ + public function attribute($name, array $args = []): Node\Attribute { + return new Node\Attribute( + BuilderHelpers::normalizeName($name), + $this->args($args) + ); + } + + /** + * Creates a namespace builder. + * + * @param null|string|Node\Name $name Name of the namespace + * + * @return Builder\Namespace_ The created namespace builder + */ + public function namespace($name): Builder\Namespace_ { + return new Builder\Namespace_($name); + } + + /** + * Creates a class builder. + * + * @param string $name Name of the class + * + * @return Builder\Class_ The created class builder + */ + public function class(string $name): Builder\Class_ { + return new Builder\Class_($name); + } + + /** + * Creates an interface builder. + * + * @param string $name Name of the interface + * + * @return Builder\Interface_ The created interface builder + */ + public function interface(string $name): Builder\Interface_ { + return new Builder\Interface_($name); + } + + /** + * Creates a trait builder. + * + * @param string $name Name of the trait + * + * @return Builder\Trait_ The created trait builder + */ + public function trait(string $name): Builder\Trait_ { + return new Builder\Trait_($name); + } + + /** + * Creates an enum builder. + * + * @param string $name Name of the enum + * + * @return Builder\Enum_ The created enum builder + */ + public function enum(string $name): Builder\Enum_ { + return new Builder\Enum_($name); + } + + /** + * Creates a trait use builder. + * + * @param Node\Name|string ...$traits Trait names + * + * @return Builder\TraitUse The created trait use builder + */ + public function useTrait(...$traits): Builder\TraitUse { + return new Builder\TraitUse(...$traits); + } + + /** + * Creates a trait use adaptation builder. + * + * @param Node\Name|string|null $trait Trait name + * @param Node\Identifier|string $method Method name + * + * @return Builder\TraitUseAdaptation The created trait use adaptation builder + */ + public function traitUseAdaptation($trait, $method = null): Builder\TraitUseAdaptation { + if ($method === null) { + $method = $trait; + $trait = null; + } + + return new Builder\TraitUseAdaptation($trait, $method); + } + + /** + * Creates a method builder. + * + * @param string $name Name of the method + * + * @return Builder\Method The created method builder + */ + public function method(string $name): Builder\Method { + return new Builder\Method($name); + } + + /** + * Creates a parameter builder. + * + * @param string $name Name of the parameter + * + * @return Builder\Param The created parameter builder + */ + public function param(string $name): Builder\Param { + return new Builder\Param($name); + } + + /** + * Creates a property builder. + * + * @param string $name Name of the property + * + * @return Builder\Property The created property builder + */ + public function property(string $name): Builder\Property { + return new Builder\Property($name); + } + + /** + * Creates a function builder. + * + * @param string $name Name of the function + * + * @return Builder\Function_ The created function builder + */ + public function function(string $name): Builder\Function_ { + return new Builder\Function_($name); + } + + /** + * Creates a namespace/class use builder. + * + * @param Node\Name|string $name Name of the entity (namespace or class) to alias + * + * @return Builder\Use_ The created use builder + */ + public function use($name): Builder\Use_ { + return new Builder\Use_($name, Use_::TYPE_NORMAL); + } + + /** + * Creates a function use builder. + * + * @param Node\Name|string $name Name of the function to alias + * + * @return Builder\Use_ The created use function builder + */ + public function useFunction($name): Builder\Use_ { + return new Builder\Use_($name, Use_::TYPE_FUNCTION); + } + + /** + * Creates a constant use builder. + * + * @param Node\Name|string $name Name of the const to alias + * + * @return Builder\Use_ The created use const builder + */ + public function useConst($name): Builder\Use_ { + return new Builder\Use_($name, Use_::TYPE_CONSTANT); + } + + /** + * Creates a class constant builder. + * + * @param string|Identifier $name Name + * @param Node\Expr|bool|null|int|float|string|array $value Value + * + * @return Builder\ClassConst The created use const builder + */ + public function classConst($name, $value): Builder\ClassConst { + return new Builder\ClassConst($name, $value); + } + + /** + * Creates an enum case builder. + * + * @param string|Identifier $name Name + * + * @return Builder\EnumCase The created use const builder + */ + public function enumCase($name): Builder\EnumCase { + return new Builder\EnumCase($name); + } + + /** + * Creates node a for a literal value. + * + * @param Expr|bool|null|int|float|string|array $value $value + */ + public function val($value): Expr { + return BuilderHelpers::normalizeValue($value); + } + + /** + * Creates variable node. + * + * @param string|Expr $name Name + */ + public function var($name): Expr\Variable { + if (!\is_string($name) && !$name instanceof Expr) { + throw new \LogicException('Variable name must be string or Expr'); + } + + return new Expr\Variable($name); + } + + /** + * Normalizes an argument list. + * + * Creates Arg nodes for all arguments and converts literal values to expressions. + * + * @param array $args List of arguments to normalize + * + * @return list<Arg> + */ + public function args(array $args): array { + $normalizedArgs = []; + foreach ($args as $key => $arg) { + if (!($arg instanceof Arg)) { + $arg = new Arg(BuilderHelpers::normalizeValue($arg)); + } + if (\is_string($key)) { + $arg->name = BuilderHelpers::normalizeIdentifier($key); + } + $normalizedArgs[] = $arg; + } + return $normalizedArgs; + } + + /** + * Creates a function call node. + * + * @param string|Name|Expr $name Function name + * @param array $args Function arguments + */ + public function funcCall($name, array $args = []): Expr\FuncCall { + return new Expr\FuncCall( + BuilderHelpers::normalizeNameOrExpr($name), + $this->args($args) + ); + } + + /** + * Creates a method call node. + * + * @param Expr $var Variable the method is called on + * @param string|Identifier|Expr $name Method name + * @param array $args Method arguments + */ + public function methodCall(Expr $var, $name, array $args = []): Expr\MethodCall { + return new Expr\MethodCall( + $var, + BuilderHelpers::normalizeIdentifierOrExpr($name), + $this->args($args) + ); + } + + /** + * Creates a static method call node. + * + * @param string|Name|Expr $class Class name + * @param string|Identifier|Expr $name Method name + * @param array $args Method arguments + */ + public function staticCall($class, $name, array $args = []): Expr\StaticCall { + return new Expr\StaticCall( + BuilderHelpers::normalizeNameOrExpr($class), + BuilderHelpers::normalizeIdentifierOrExpr($name), + $this->args($args) + ); + } + + /** + * Creates an object creation node. + * + * @param string|Name|Expr $class Class name + * @param array $args Constructor arguments + */ + public function new($class, array $args = []): Expr\New_ { + return new Expr\New_( + BuilderHelpers::normalizeNameOrExpr($class), + $this->args($args) + ); + } + + /** + * Creates a constant fetch node. + * + * @param string|Name $name Constant name + */ + public function constFetch($name): Expr\ConstFetch { + return new Expr\ConstFetch(BuilderHelpers::normalizeName($name)); + } + + /** + * Creates a property fetch node. + * + * @param Expr $var Variable holding object + * @param string|Identifier|Expr $name Property name + */ + public function propertyFetch(Expr $var, $name): Expr\PropertyFetch { + return new Expr\PropertyFetch($var, BuilderHelpers::normalizeIdentifierOrExpr($name)); + } + + /** + * Creates a class constant fetch node. + * + * @param string|Name|Expr $class Class name + * @param string|Identifier|Expr $name Constant name + */ + public function classConstFetch($class, $name): Expr\ClassConstFetch { + return new Expr\ClassConstFetch( + BuilderHelpers::normalizeNameOrExpr($class), + BuilderHelpers::normalizeIdentifierOrExpr($name) + ); + } + + /** + * Creates nested Concat nodes from a list of expressions. + * + * @param Expr|string ...$exprs Expressions or literal strings + */ + public function concat(...$exprs): Concat { + $numExprs = count($exprs); + if ($numExprs < 2) { + throw new \LogicException('Expected at least two expressions'); + } + + $lastConcat = $this->normalizeStringExpr($exprs[0]); + for ($i = 1; $i < $numExprs; $i++) { + $lastConcat = new Concat($lastConcat, $this->normalizeStringExpr($exprs[$i])); + } + return $lastConcat; + } + + /** + * @param string|Expr $expr + */ + private function normalizeStringExpr($expr): Expr { + if ($expr instanceof Expr) { + return $expr; + } + + if (\is_string($expr)) { + return new String_($expr); + } + + throw new \LogicException('Expected string or Expr'); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/BuilderHelpers.php b/vendor/nikic/php-parser/lib/PhpParser/BuilderHelpers.php new file mode 100644 index 00000000..3e41b26f --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/BuilderHelpers.php @@ -0,0 +1,333 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +use PhpParser\Node\ComplexType; +use PhpParser\Node\Expr; +use PhpParser\Node\Identifier; +use PhpParser\Node\Name; +use PhpParser\Node\NullableType; +use PhpParser\Node\Scalar; +use PhpParser\Node\Stmt; + +/** + * This class defines helpers used in the implementation of builders. Don't use it directly. + * + * @internal + */ +final class BuilderHelpers { + /** + * Normalizes a node: Converts builder objects to nodes. + * + * @param Node|Builder $node The node to normalize + * + * @return Node The normalized node + */ + public static function normalizeNode($node): Node { + if ($node instanceof Builder) { + return $node->getNode(); + } + + if ($node instanceof Node) { + return $node; + } + + throw new \LogicException('Expected node or builder object'); + } + + /** + * Normalizes a node to a statement. + * + * Expressions are wrapped in a Stmt\Expression node. + * + * @param Node|Builder $node The node to normalize + * + * @return Stmt The normalized statement node + */ + public static function normalizeStmt($node): Stmt { + $node = self::normalizeNode($node); + if ($node instanceof Stmt) { + return $node; + } + + if ($node instanceof Expr) { + return new Stmt\Expression($node); + } + + throw new \LogicException('Expected statement or expression node'); + } + + /** + * Normalizes strings to Identifier. + * + * @param string|Identifier $name The identifier to normalize + * + * @return Identifier The normalized identifier + */ + public static function normalizeIdentifier($name): Identifier { + if ($name instanceof Identifier) { + return $name; + } + + if (\is_string($name)) { + return new Identifier($name); + } + + throw new \LogicException('Expected string or instance of Node\Identifier'); + } + + /** + * Normalizes strings to Identifier, also allowing expressions. + * + * @param string|Identifier|Expr $name The identifier to normalize + * + * @return Identifier|Expr The normalized identifier or expression + */ + public static function normalizeIdentifierOrExpr($name) { + if ($name instanceof Identifier || $name instanceof Expr) { + return $name; + } + + if (\is_string($name)) { + return new Identifier($name); + } + + throw new \LogicException('Expected string or instance of Node\Identifier or Node\Expr'); + } + + /** + * Normalizes a name: Converts string names to Name nodes. + * + * @param Name|string $name The name to normalize + * + * @return Name The normalized name + */ + public static function normalizeName($name): Name { + if ($name instanceof Name) { + return $name; + } + + if (is_string($name)) { + if (!$name) { + throw new \LogicException('Name cannot be empty'); + } + + if ($name[0] === '\\') { + return new Name\FullyQualified(substr($name, 1)); + } + + if (0 === strpos($name, 'namespace\\')) { + return new Name\Relative(substr($name, strlen('namespace\\'))); + } + + return new Name($name); + } + + throw new \LogicException('Name must be a string or an instance of Node\Name'); + } + + /** + * Normalizes a name: Converts string names to Name nodes, while also allowing expressions. + * + * @param Expr|Name|string $name The name to normalize + * + * @return Name|Expr The normalized name or expression + */ + public static function normalizeNameOrExpr($name) { + if ($name instanceof Expr) { + return $name; + } + + if (!is_string($name) && !($name instanceof Name)) { + throw new \LogicException( + 'Name must be a string or an instance of Node\Name or Node\Expr' + ); + } + + return self::normalizeName($name); + } + + /** + * Normalizes a type: Converts plain-text type names into proper AST representation. + * + * In particular, builtin types become Identifiers, custom types become Names and nullables + * are wrapped in NullableType nodes. + * + * @param string|Name|Identifier|ComplexType $type The type to normalize + * + * @return Name|Identifier|ComplexType The normalized type + */ + public static function normalizeType($type) { + if (!is_string($type)) { + if ( + !$type instanceof Name && !$type instanceof Identifier && + !$type instanceof ComplexType + ) { + throw new \LogicException( + 'Type must be a string, or an instance of Name, Identifier or ComplexType' + ); + } + return $type; + } + + $nullable = false; + if (strlen($type) > 0 && $type[0] === '?') { + $nullable = true; + $type = substr($type, 1); + } + + $builtinTypes = [ + 'array', + 'callable', + 'bool', + 'int', + 'float', + 'string', + 'iterable', + 'void', + 'object', + 'null', + 'false', + 'mixed', + 'never', + 'true', + ]; + + $lowerType = strtolower($type); + if (in_array($lowerType, $builtinTypes)) { + $type = new Identifier($lowerType); + } else { + $type = self::normalizeName($type); + } + + $notNullableTypes = [ + 'void', 'mixed', 'never', + ]; + if ($nullable && in_array((string) $type, $notNullableTypes)) { + throw new \LogicException(sprintf('%s type cannot be nullable', $type)); + } + + return $nullable ? new NullableType($type) : $type; + } + + /** + * Normalizes a value: Converts nulls, booleans, integers, + * floats, strings and arrays into their respective nodes + * + * @param Node\Expr|bool|null|int|float|string|array $value The value to normalize + * + * @return Expr The normalized value + */ + public static function normalizeValue($value): Expr { + if ($value instanceof Node\Expr) { + return $value; + } + + if (is_null($value)) { + return new Expr\ConstFetch( + new Name('null') + ); + } + + if (is_bool($value)) { + return new Expr\ConstFetch( + new Name($value ? 'true' : 'false') + ); + } + + if (is_int($value)) { + return new Scalar\Int_($value); + } + + if (is_float($value)) { + return new Scalar\Float_($value); + } + + if (is_string($value)) { + return new Scalar\String_($value); + } + + if (is_array($value)) { + $items = []; + $lastKey = -1; + foreach ($value as $itemKey => $itemValue) { + // for consecutive, numeric keys don't generate keys + if (null !== $lastKey && ++$lastKey === $itemKey) { + $items[] = new Node\ArrayItem( + self::normalizeValue($itemValue) + ); + } else { + $lastKey = null; + $items[] = new Node\ArrayItem( + self::normalizeValue($itemValue), + self::normalizeValue($itemKey) + ); + } + } + + return new Expr\Array_($items); + } + + throw new \LogicException('Invalid value'); + } + + /** + * Normalizes a doc comment: Converts plain strings to PhpParser\Comment\Doc. + * + * @param Comment\Doc|string $docComment The doc comment to normalize + * + * @return Comment\Doc The normalized doc comment + */ + public static function normalizeDocComment($docComment): Comment\Doc { + if ($docComment instanceof Comment\Doc) { + return $docComment; + } + + if (is_string($docComment)) { + return new Comment\Doc($docComment); + } + + throw new \LogicException('Doc comment must be a string or an instance of PhpParser\Comment\Doc'); + } + + /** + * Normalizes a attribute: Converts attribute to the Attribute Group if needed. + * + * @param Node\Attribute|Node\AttributeGroup $attribute + * + * @return Node\AttributeGroup The Attribute Group + */ + public static function normalizeAttribute($attribute): Node\AttributeGroup { + if ($attribute instanceof Node\AttributeGroup) { + return $attribute; + } + + if (!($attribute instanceof Node\Attribute)) { + throw new \LogicException('Attribute must be an instance of PhpParser\Node\Attribute or PhpParser\Node\AttributeGroup'); + } + + return new Node\AttributeGroup([$attribute]); + } + + /** + * Adds a modifier and returns new modifier bitmask. + * + * @param int $modifiers Existing modifiers + * @param int $modifier Modifier to set + * + * @return int New modifiers + */ + public static function addModifier(int $modifiers, int $modifier): int { + Modifiers::verifyModifier($modifiers, $modifier); + return $modifiers | $modifier; + } + + /** + * Adds a modifier and returns new modifier bitmask. + * @return int New modifiers + */ + public static function addClassModifier(int $existingModifiers, int $modifierToSet): int { + Modifiers::verifyClassModifier($existingModifiers, $modifierToSet); + return $existingModifiers | $modifierToSet; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Comment.php b/vendor/nikic/php-parser/lib/PhpParser/Comment.php new file mode 100644 index 00000000..01b341e4 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Comment.php @@ -0,0 +1,209 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +class Comment implements \JsonSerializable { + protected string $text; + protected int $startLine; + protected int $startFilePos; + protected int $startTokenPos; + protected int $endLine; + protected int $endFilePos; + protected int $endTokenPos; + + /** + * Constructs a comment node. + * + * @param string $text Comment text (including comment delimiters like /*) + * @param int $startLine Line number the comment started on + * @param int $startFilePos File offset the comment started on + * @param int $startTokenPos Token offset the comment started on + */ + public function __construct( + string $text, + int $startLine = -1, int $startFilePos = -1, int $startTokenPos = -1, + int $endLine = -1, int $endFilePos = -1, int $endTokenPos = -1 + ) { + $this->text = $text; + $this->startLine = $startLine; + $this->startFilePos = $startFilePos; + $this->startTokenPos = $startTokenPos; + $this->endLine = $endLine; + $this->endFilePos = $endFilePos; + $this->endTokenPos = $endTokenPos; + } + + /** + * Gets the comment text. + * + * @return string The comment text (including comment delimiters like /*) + */ + public function getText(): string { + return $this->text; + } + + /** + * Gets the line number the comment started on. + * + * @return int Line number (or -1 if not available) + * @phpstan-return -1|positive-int + */ + public function getStartLine(): int { + return $this->startLine; + } + + /** + * Gets the file offset the comment started on. + * + * @return int File offset (or -1 if not available) + */ + public function getStartFilePos(): int { + return $this->startFilePos; + } + + /** + * Gets the token offset the comment started on. + * + * @return int Token offset (or -1 if not available) + */ + public function getStartTokenPos(): int { + return $this->startTokenPos; + } + + /** + * Gets the line number the comment ends on. + * + * @return int Line number (or -1 if not available) + * @phpstan-return -1|positive-int + */ + public function getEndLine(): int { + return $this->endLine; + } + + /** + * Gets the file offset the comment ends on. + * + * @return int File offset (or -1 if not available) + */ + public function getEndFilePos(): int { + return $this->endFilePos; + } + + /** + * Gets the token offset the comment ends on. + * + * @return int Token offset (or -1 if not available) + */ + public function getEndTokenPos(): int { + return $this->endTokenPos; + } + + /** + * Gets the comment text. + * + * @return string The comment text (including comment delimiters like /*) + */ + public function __toString(): string { + return $this->text; + } + + /** + * Gets the reformatted comment text. + * + * "Reformatted" here means that we try to clean up the whitespace at the + * starts of the lines. This is necessary because we receive the comments + * without leading whitespace on the first line, but with leading whitespace + * on all subsequent lines. + * + * Additionally, this normalizes CRLF newlines to LF newlines. + */ + public function getReformattedText(): string { + $text = str_replace("\r\n", "\n", $this->text); + $newlinePos = strpos($text, "\n"); + if (false === $newlinePos) { + // Single line comments don't need further processing + return $text; + } + if (preg_match('(^.*(?:\n\s+\*.*)+$)', $text)) { + // Multi line comment of the type + // + // /* + // * Some text. + // * Some more text. + // */ + // + // is handled by replacing the whitespace sequences before the * by a single space + return preg_replace('(^\s+\*)m', ' *', $text); + } + if (preg_match('(^/\*\*?\s*\n)', $text) && preg_match('(\n(\s*)\*/$)', $text, $matches)) { + // Multi line comment of the type + // + // /* + // Some text. + // Some more text. + // */ + // + // is handled by removing the whitespace sequence on the line before the closing + // */ on all lines. So if the last line is " */", then " " is removed at the + // start of all lines. + return preg_replace('(^' . preg_quote($matches[1]) . ')m', '', $text); + } + if (preg_match('(^/\*\*?\s*(?!\s))', $text, $matches)) { + // Multi line comment of the type + // + // /* Some text. + // Some more text. + // Indented text. + // Even more text. */ + // + // is handled by removing the difference between the shortest whitespace prefix on all + // lines and the length of the "/* " opening sequence. + $prefixLen = $this->getShortestWhitespacePrefixLen(substr($text, $newlinePos + 1)); + $removeLen = $prefixLen - strlen($matches[0]); + return preg_replace('(^\s{' . $removeLen . '})m', '', $text); + } + + // No idea how to format this comment, so simply return as is + return $text; + } + + /** + * Get length of shortest whitespace prefix (at the start of a line). + * + * If there is a line with no prefix whitespace, 0 is a valid return value. + * + * @param string $str String to check + * @return int Length in characters. Tabs count as single characters. + */ + private function getShortestWhitespacePrefixLen(string $str): int { + $lines = explode("\n", $str); + $shortestPrefixLen = \PHP_INT_MAX; + foreach ($lines as $line) { + preg_match('(^\s*)', $line, $matches); + $prefixLen = strlen($matches[0]); + if ($prefixLen < $shortestPrefixLen) { + $shortestPrefixLen = $prefixLen; + } + } + return $shortestPrefixLen; + } + + /** + * @return array{nodeType:string, text:mixed, line:mixed, filePos:mixed} + */ + public function jsonSerialize(): array { + // Technically not a node, but we make it look like one anyway + $type = $this instanceof Comment\Doc ? 'Comment_Doc' : 'Comment'; + return [ + 'nodeType' => $type, + 'text' => $this->text, + // TODO: Rename these to include "start". + 'line' => $this->startLine, + 'filePos' => $this->startFilePos, + 'tokenPos' => $this->startTokenPos, + 'endLine' => $this->endLine, + 'endFilePos' => $this->endFilePos, + 'endTokenPos' => $this->endTokenPos, + ]; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Comment/Doc.php b/vendor/nikic/php-parser/lib/PhpParser/Comment/Doc.php new file mode 100644 index 00000000..bb3e9146 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Comment/Doc.php @@ -0,0 +1,6 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Comment; + +class Doc extends \PhpParser\Comment { +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/ConstExprEvaluationException.php b/vendor/nikic/php-parser/lib/PhpParser/ConstExprEvaluationException.php new file mode 100644 index 00000000..7964058a --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/ConstExprEvaluationException.php @@ -0,0 +1,6 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +class ConstExprEvaluationException extends \Exception { +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/ConstExprEvaluator.php b/vendor/nikic/php-parser/lib/PhpParser/ConstExprEvaluator.php new file mode 100644 index 00000000..73e59fc5 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/ConstExprEvaluator.php @@ -0,0 +1,234 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +use PhpParser\Node\Expr; +use PhpParser\Node\Scalar; + +use function array_merge; + +/** + * Evaluates constant expressions. + * + * This evaluator is able to evaluate all constant expressions (as defined by PHP), which can be + * evaluated without further context. If a subexpression is not of this type, a user-provided + * fallback evaluator is invoked. To support all constant expressions that are also supported by + * PHP (and not already handled by this class), the fallback evaluator must be able to handle the + * following node types: + * + * * All Scalar\MagicConst\* nodes. + * * Expr\ConstFetch nodes. Only null/false/true are already handled by this class. + * * Expr\ClassConstFetch nodes. + * + * The fallback evaluator should throw ConstExprEvaluationException for nodes it cannot evaluate. + * + * The evaluation is dependent on runtime configuration in two respects: Firstly, floating + * point to string conversions are affected by the precision ini setting. Secondly, they are also + * affected by the LC_NUMERIC locale. + */ +class ConstExprEvaluator { + /** @var callable|null */ + private $fallbackEvaluator; + + /** + * Create a constant expression evaluator. + * + * The provided fallback evaluator is invoked whenever a subexpression cannot be evaluated. See + * class doc comment for more information. + * + * @param callable|null $fallbackEvaluator To call if subexpression cannot be evaluated + */ + public function __construct(?callable $fallbackEvaluator = null) { + $this->fallbackEvaluator = $fallbackEvaluator ?? function (Expr $expr) { + throw new ConstExprEvaluationException( + "Expression of type {$expr->getType()} cannot be evaluated" + ); + }; + } + + /** + * Silently evaluates a constant expression into a PHP value. + * + * Thrown Errors, warnings or notices will be converted into a ConstExprEvaluationException. + * The original source of the exception is available through getPrevious(). + * + * If some part of the expression cannot be evaluated, the fallback evaluator passed to the + * constructor will be invoked. By default, if no fallback is provided, an exception of type + * ConstExprEvaluationException is thrown. + * + * See class doc comment for caveats and limitations. + * + * @param Expr $expr Constant expression to evaluate + * @return mixed Result of evaluation + * + * @throws ConstExprEvaluationException if the expression cannot be evaluated or an error occurred + */ + public function evaluateSilently(Expr $expr) { + set_error_handler(function ($num, $str, $file, $line) { + throw new \ErrorException($str, 0, $num, $file, $line); + }); + + try { + return $this->evaluate($expr); + } catch (\Throwable $e) { + if (!$e instanceof ConstExprEvaluationException) { + $e = new ConstExprEvaluationException( + "An error occurred during constant expression evaluation", 0, $e); + } + throw $e; + } finally { + restore_error_handler(); + } + } + + /** + * Directly evaluates a constant expression into a PHP value. + * + * May generate Error exceptions, warnings or notices. Use evaluateSilently() to convert these + * into a ConstExprEvaluationException. + * + * If some part of the expression cannot be evaluated, the fallback evaluator passed to the + * constructor will be invoked. By default, if no fallback is provided, an exception of type + * ConstExprEvaluationException is thrown. + * + * See class doc comment for caveats and limitations. + * + * @param Expr $expr Constant expression to evaluate + * @return mixed Result of evaluation + * + * @throws ConstExprEvaluationException if the expression cannot be evaluated + */ + public function evaluateDirectly(Expr $expr) { + return $this->evaluate($expr); + } + + /** @return mixed */ + private function evaluate(Expr $expr) { + if ($expr instanceof Scalar\Int_ + || $expr instanceof Scalar\Float_ + || $expr instanceof Scalar\String_ + ) { + return $expr->value; + } + + if ($expr instanceof Expr\Array_) { + return $this->evaluateArray($expr); + } + + // Unary operators + if ($expr instanceof Expr\UnaryPlus) { + return +$this->evaluate($expr->expr); + } + if ($expr instanceof Expr\UnaryMinus) { + return -$this->evaluate($expr->expr); + } + if ($expr instanceof Expr\BooleanNot) { + return !$this->evaluate($expr->expr); + } + if ($expr instanceof Expr\BitwiseNot) { + return ~$this->evaluate($expr->expr); + } + + if ($expr instanceof Expr\BinaryOp) { + return $this->evaluateBinaryOp($expr); + } + + if ($expr instanceof Expr\Ternary) { + return $this->evaluateTernary($expr); + } + + if ($expr instanceof Expr\ArrayDimFetch && null !== $expr->dim) { + return $this->evaluate($expr->var)[$this->evaluate($expr->dim)]; + } + + if ($expr instanceof Expr\ConstFetch) { + return $this->evaluateConstFetch($expr); + } + + return ($this->fallbackEvaluator)($expr); + } + + private function evaluateArray(Expr\Array_ $expr): array { + $array = []; + foreach ($expr->items as $item) { + if (null !== $item->key) { + $array[$this->evaluate($item->key)] = $this->evaluate($item->value); + } elseif ($item->unpack) { + $array = array_merge($array, $this->evaluate($item->value)); + } else { + $array[] = $this->evaluate($item->value); + } + } + return $array; + } + + /** @return mixed */ + private function evaluateTernary(Expr\Ternary $expr) { + if (null === $expr->if) { + return $this->evaluate($expr->cond) ?: $this->evaluate($expr->else); + } + + return $this->evaluate($expr->cond) + ? $this->evaluate($expr->if) + : $this->evaluate($expr->else); + } + + /** @return mixed */ + private function evaluateBinaryOp(Expr\BinaryOp $expr) { + if ($expr instanceof Expr\BinaryOp\Coalesce + && $expr->left instanceof Expr\ArrayDimFetch + ) { + // This needs to be special cased to respect BP_VAR_IS fetch semantics + return $this->evaluate($expr->left->var)[$this->evaluate($expr->left->dim)] + ?? $this->evaluate($expr->right); + } + + // The evaluate() calls are repeated in each branch, because some of the operators are + // short-circuiting and evaluating the RHS in advance may be illegal in that case + $l = $expr->left; + $r = $expr->right; + switch ($expr->getOperatorSigil()) { + case '&': return $this->evaluate($l) & $this->evaluate($r); + case '|': return $this->evaluate($l) | $this->evaluate($r); + case '^': return $this->evaluate($l) ^ $this->evaluate($r); + case '&&': return $this->evaluate($l) && $this->evaluate($r); + case '||': return $this->evaluate($l) || $this->evaluate($r); + case '??': return $this->evaluate($l) ?? $this->evaluate($r); + case '.': return $this->evaluate($l) . $this->evaluate($r); + case '/': return $this->evaluate($l) / $this->evaluate($r); + case '==': return $this->evaluate($l) == $this->evaluate($r); + case '>': return $this->evaluate($l) > $this->evaluate($r); + case '>=': return $this->evaluate($l) >= $this->evaluate($r); + case '===': return $this->evaluate($l) === $this->evaluate($r); + case 'and': return $this->evaluate($l) and $this->evaluate($r); + case 'or': return $this->evaluate($l) or $this->evaluate($r); + case 'xor': return $this->evaluate($l) xor $this->evaluate($r); + case '-': return $this->evaluate($l) - $this->evaluate($r); + case '%': return $this->evaluate($l) % $this->evaluate($r); + case '*': return $this->evaluate($l) * $this->evaluate($r); + case '!=': return $this->evaluate($l) != $this->evaluate($r); + case '!==': return $this->evaluate($l) !== $this->evaluate($r); + case '+': return $this->evaluate($l) + $this->evaluate($r); + case '**': return $this->evaluate($l) ** $this->evaluate($r); + case '<<': return $this->evaluate($l) << $this->evaluate($r); + case '>>': return $this->evaluate($l) >> $this->evaluate($r); + case '<': return $this->evaluate($l) < $this->evaluate($r); + case '<=': return $this->evaluate($l) <= $this->evaluate($r); + case '<=>': return $this->evaluate($l) <=> $this->evaluate($r); + } + + throw new \Exception('Should not happen'); + } + + /** @return mixed */ + private function evaluateConstFetch(Expr\ConstFetch $expr) { + $name = $expr->name->toLowerString(); + switch ($name) { + case 'null': return null; + case 'false': return false; + case 'true': return true; + } + + return ($this->fallbackEvaluator)($expr); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Error.php b/vendor/nikic/php-parser/lib/PhpParser/Error.php new file mode 100644 index 00000000..f81f0c42 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Error.php @@ -0,0 +1,173 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +class Error extends \RuntimeException { + protected string $rawMessage; + /** @var array<string, mixed> */ + protected array $attributes; + + /** + * Creates an Exception signifying a parse error. + * + * @param string $message Error message + * @param array<string, mixed> $attributes Attributes of node/token where error occurred + */ + public function __construct(string $message, array $attributes = []) { + $this->rawMessage = $message; + $this->attributes = $attributes; + $this->updateMessage(); + } + + /** + * Gets the error message + * + * @return string Error message + */ + public function getRawMessage(): string { + return $this->rawMessage; + } + + /** + * Gets the line the error starts in. + * + * @return int Error start line + * @phpstan-return -1|positive-int + */ + public function getStartLine(): int { + return $this->attributes['startLine'] ?? -1; + } + + /** + * Gets the line the error ends in. + * + * @return int Error end line + * @phpstan-return -1|positive-int + */ + public function getEndLine(): int { + return $this->attributes['endLine'] ?? -1; + } + + /** + * Gets the attributes of the node/token the error occurred at. + * + * @return array<string, mixed> + */ + public function getAttributes(): array { + return $this->attributes; + } + + /** + * Sets the attributes of the node/token the error occurred at. + * + * @param array<string, mixed> $attributes + */ + public function setAttributes(array $attributes): void { + $this->attributes = $attributes; + $this->updateMessage(); + } + + /** + * Sets the line of the PHP file the error occurred in. + * + * @param string $message Error message + */ + public function setRawMessage(string $message): void { + $this->rawMessage = $message; + $this->updateMessage(); + } + + /** + * Sets the line the error starts in. + * + * @param int $line Error start line + */ + public function setStartLine(int $line): void { + $this->attributes['startLine'] = $line; + $this->updateMessage(); + } + + /** + * Returns whether the error has start and end column information. + * + * For column information enable the startFilePos and endFilePos in the lexer options. + */ + public function hasColumnInfo(): bool { + return isset($this->attributes['startFilePos'], $this->attributes['endFilePos']); + } + + /** + * Gets the start column (1-based) into the line where the error started. + * + * @param string $code Source code of the file + */ + public function getStartColumn(string $code): int { + if (!$this->hasColumnInfo()) { + throw new \RuntimeException('Error does not have column information'); + } + + return $this->toColumn($code, $this->attributes['startFilePos']); + } + + /** + * Gets the end column (1-based) into the line where the error ended. + * + * @param string $code Source code of the file + */ + public function getEndColumn(string $code): int { + if (!$this->hasColumnInfo()) { + throw new \RuntimeException('Error does not have column information'); + } + + return $this->toColumn($code, $this->attributes['endFilePos']); + } + + /** + * Formats message including line and column information. + * + * @param string $code Source code associated with the error, for calculation of the columns + * + * @return string Formatted message + */ + public function getMessageWithColumnInfo(string $code): string { + return sprintf( + '%s from %d:%d to %d:%d', $this->getRawMessage(), + $this->getStartLine(), $this->getStartColumn($code), + $this->getEndLine(), $this->getEndColumn($code) + ); + } + + /** + * Converts a file offset into a column. + * + * @param string $code Source code that $pos indexes into + * @param int $pos 0-based position in $code + * + * @return int 1-based column (relative to start of line) + */ + private function toColumn(string $code, int $pos): int { + if ($pos > strlen($code)) { + throw new \RuntimeException('Invalid position information'); + } + + $lineStartPos = strrpos($code, "\n", $pos - strlen($code)); + if (false === $lineStartPos) { + $lineStartPos = -1; + } + + return $pos - $lineStartPos; + } + + /** + * Updates the exception message after a change to rawMessage or rawLine. + */ + protected function updateMessage(): void { + $this->message = $this->rawMessage; + + if (-1 === $this->getStartLine()) { + $this->message .= ' on unknown line'; + } else { + $this->message .= ' on line ' . $this->getStartLine(); + } + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler.php b/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler.php new file mode 100644 index 00000000..51ad730c --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler.php @@ -0,0 +1,12 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +interface ErrorHandler { + /** + * Handle an error generated during lexing, parsing or some other operation. + * + * @param Error $error The error that needs to be handled + */ + public function handleError(Error $error): void; +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Collecting.php b/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Collecting.php new file mode 100644 index 00000000..eee63492 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Collecting.php @@ -0,0 +1,43 @@ +<?php declare(strict_types=1); + +namespace PhpParser\ErrorHandler; + +use PhpParser\Error; +use PhpParser\ErrorHandler; + +/** + * Error handler that collects all errors into an array. + * + * This allows graceful handling of errors. + */ +class Collecting implements ErrorHandler { + /** @var Error[] Collected errors */ + private array $errors = []; + + public function handleError(Error $error): void { + $this->errors[] = $error; + } + + /** + * Get collected errors. + * + * @return Error[] + */ + public function getErrors(): array { + return $this->errors; + } + + /** + * Check whether there are any errors. + */ + public function hasErrors(): bool { + return !empty($this->errors); + } + + /** + * Reset/clear collected errors. + */ + public function clearErrors(): void { + $this->errors = []; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Throwing.php b/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Throwing.php new file mode 100644 index 00000000..dff33dd0 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Throwing.php @@ -0,0 +1,17 @@ +<?php declare(strict_types=1); + +namespace PhpParser\ErrorHandler; + +use PhpParser\Error; +use PhpParser\ErrorHandler; + +/** + * Error handler that handles all errors by throwing them. + * + * This is the default strategy used by all components. + */ +class Throwing implements ErrorHandler { + public function handleError(Error $error): void { + throw $error; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Internal/DiffElem.php b/vendor/nikic/php-parser/lib/PhpParser/Internal/DiffElem.php new file mode 100644 index 00000000..7433b5d3 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Internal/DiffElem.php @@ -0,0 +1,31 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Internal; + +/** + * @internal + */ +class DiffElem { + public const TYPE_KEEP = 0; + public const TYPE_REMOVE = 1; + public const TYPE_ADD = 2; + public const TYPE_REPLACE = 3; + + /** @var int One of the TYPE_* constants */ + public int $type; + /** @var mixed Is null for add operations */ + public $old; + /** @var mixed Is null for remove operations */ + public $new; + + /** + * @param int $type One of the TYPE_* constants + * @param mixed $old Is null for add operations + * @param mixed $new Is null for remove operations + */ + public function __construct(int $type, $old, $new) { + $this->type = $type; + $this->old = $old; + $this->new = $new; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Internal/Differ.php b/vendor/nikic/php-parser/lib/PhpParser/Internal/Differ.php new file mode 100644 index 00000000..253e1757 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Internal/Differ.php @@ -0,0 +1,178 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Internal; + +/** + * Implements the Myers diff algorithm. + * + * Myers, Eugene W. "An O (ND) difference algorithm and its variations." + * Algorithmica 1.1 (1986): 251-266. + * + * @template T + * @internal + */ +class Differ { + /** @var callable(T, T): bool */ + private $isEqual; + + /** + * Create differ over the given equality relation. + * + * @param callable(T, T): bool $isEqual Equality relation + */ + public function __construct(callable $isEqual) { + $this->isEqual = $isEqual; + } + + /** + * Calculate diff (edit script) from $old to $new. + * + * @param T[] $old Original array + * @param T[] $new New array + * + * @return DiffElem[] Diff (edit script) + */ + public function diff(array $old, array $new): array { + $old = \array_values($old); + $new = \array_values($new); + list($trace, $x, $y) = $this->calculateTrace($old, $new); + return $this->extractDiff($trace, $x, $y, $old, $new); + } + + /** + * Calculate diff, including "replace" operations. + * + * If a sequence of remove operations is followed by the same number of add operations, these + * will be coalesced into replace operations. + * + * @param T[] $old Original array + * @param T[] $new New array + * + * @return DiffElem[] Diff (edit script), including replace operations + */ + public function diffWithReplacements(array $old, array $new): array { + return $this->coalesceReplacements($this->diff($old, $new)); + } + + /** + * @param T[] $old + * @param T[] $new + * @return array{array<int, array<int, int>>, int, int} + */ + private function calculateTrace(array $old, array $new): array { + $n = \count($old); + $m = \count($new); + $max = $n + $m; + $v = [1 => 0]; + $trace = []; + for ($d = 0; $d <= $max; $d++) { + $trace[] = $v; + for ($k = -$d; $k <= $d; $k += 2) { + if ($k === -$d || ($k !== $d && $v[$k - 1] < $v[$k + 1])) { + $x = $v[$k + 1]; + } else { + $x = $v[$k - 1] + 1; + } + + $y = $x - $k; + while ($x < $n && $y < $m && ($this->isEqual)($old[$x], $new[$y])) { + $x++; + $y++; + } + + $v[$k] = $x; + if ($x >= $n && $y >= $m) { + return [$trace, $x, $y]; + } + } + } + throw new \Exception('Should not happen'); + } + + /** + * @param array<int, array<int, int>> $trace + * @param T[] $old + * @param T[] $new + * @return DiffElem[] + */ + private function extractDiff(array $trace, int $x, int $y, array $old, array $new): array { + $result = []; + for ($d = \count($trace) - 1; $d >= 0; $d--) { + $v = $trace[$d]; + $k = $x - $y; + + if ($k === -$d || ($k !== $d && $v[$k - 1] < $v[$k + 1])) { + $prevK = $k + 1; + } else { + $prevK = $k - 1; + } + + $prevX = $v[$prevK]; + $prevY = $prevX - $prevK; + + while ($x > $prevX && $y > $prevY) { + $result[] = new DiffElem(DiffElem::TYPE_KEEP, $old[$x - 1], $new[$y - 1]); + $x--; + $y--; + } + + if ($d === 0) { + break; + } + + while ($x > $prevX) { + $result[] = new DiffElem(DiffElem::TYPE_REMOVE, $old[$x - 1], null); + $x--; + } + + while ($y > $prevY) { + $result[] = new DiffElem(DiffElem::TYPE_ADD, null, $new[$y - 1]); + $y--; + } + } + return array_reverse($result); + } + + /** + * Coalesce equal-length sequences of remove+add into a replace operation. + * + * @param DiffElem[] $diff + * @return DiffElem[] + */ + private function coalesceReplacements(array $diff): array { + $newDiff = []; + $c = \count($diff); + for ($i = 0; $i < $c; $i++) { + $diffType = $diff[$i]->type; + if ($diffType !== DiffElem::TYPE_REMOVE) { + $newDiff[] = $diff[$i]; + continue; + } + + $j = $i; + while ($j < $c && $diff[$j]->type === DiffElem::TYPE_REMOVE) { + $j++; + } + + $k = $j; + while ($k < $c && $diff[$k]->type === DiffElem::TYPE_ADD) { + $k++; + } + + if ($j - $i === $k - $j) { + $len = $j - $i; + for ($n = 0; $n < $len; $n++) { + $newDiff[] = new DiffElem( + DiffElem::TYPE_REPLACE, $diff[$i + $n]->old, $diff[$j + $n]->new + ); + } + } else { + for (; $i < $k; $i++) { + $newDiff[] = $diff[$i]; + } + } + $i = $k - 1; + } + return $newDiff; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php b/vendor/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php new file mode 100644 index 00000000..b30a99a1 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php @@ -0,0 +1,71 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Internal; + +use PhpParser\Node; +use PhpParser\Node\Expr; + +/** + * This node is used internally by the format-preserving pretty printer to print anonymous classes. + * + * The normal anonymous class structure violates assumptions about the order of token offsets. + * Namely, the constructor arguments are part of the Expr\New_ node and follow the class node, even + * though they are actually interleaved with them. This special node type is used temporarily to + * restore a sane token offset order. + * + * @internal + */ +class PrintableNewAnonClassNode extends Expr { + /** @var Node\AttributeGroup[] PHP attribute groups */ + public array $attrGroups; + /** @var int Modifiers */ + public int $flags; + /** @var (Node\Arg|Node\VariadicPlaceholder)[] Arguments */ + public array $args; + /** @var null|Node\Name Name of extended class */ + public ?Node\Name $extends; + /** @var Node\Name[] Names of implemented interfaces */ + public array $implements; + /** @var Node\Stmt[] Statements */ + public array $stmts; + + /** + * @param Node\AttributeGroup[] $attrGroups PHP attribute groups + * @param (Node\Arg|Node\VariadicPlaceholder)[] $args Arguments + * @param Node\Name|null $extends Name of extended class + * @param Node\Name[] $implements Names of implemented interfaces + * @param Node\Stmt[] $stmts Statements + * @param array<string, mixed> $attributes Attributes + */ + public function __construct( + array $attrGroups, int $flags, array $args, ?Node\Name $extends, array $implements, + array $stmts, array $attributes + ) { + parent::__construct($attributes); + $this->attrGroups = $attrGroups; + $this->flags = $flags; + $this->args = $args; + $this->extends = $extends; + $this->implements = $implements; + $this->stmts = $stmts; + } + + public static function fromNewNode(Expr\New_ $newNode): self { + $class = $newNode->class; + assert($class instanceof Node\Stmt\Class_); + // We don't assert that $class->name is null here, to allow consumers to assign unique names + // to anonymous classes for their own purposes. We simplify ignore the name here. + return new self( + $class->attrGroups, $class->flags, $newNode->args, $class->extends, $class->implements, + $class->stmts, $newNode->getAttributes() + ); + } + + public function getType(): string { + return 'Expr_PrintableNewAnonClass'; + } + + public function getSubNodeNames(): array { + return ['attrGroups', 'flags', 'args', 'extends', 'implements', 'stmts']; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenPolyfill.php b/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenPolyfill.php new file mode 100644 index 00000000..36022d09 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenPolyfill.php @@ -0,0 +1,237 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Internal; + +if (\PHP_VERSION_ID >= 80000) { + class TokenPolyfill extends \PhpToken { + } + return; +} + +/** + * This is a polyfill for the PhpToken class introduced in PHP 8.0. We do not actually polyfill + * PhpToken, because composer might end up picking a different polyfill implementation, which does + * not meet our requirements. + * + * @internal + */ +class TokenPolyfill { + /** @var int The ID of the token. Either a T_* constant of a character code < 256. */ + public int $id; + /** @var string The textual content of the token. */ + public string $text; + /** @var int The 1-based starting line of the token (or -1 if unknown). */ + public int $line; + /** @var int The 0-based starting position of the token (or -1 if unknown). */ + public int $pos; + + /** @var array<int, bool> Tokens ignored by the PHP parser. */ + private const IGNORABLE_TOKENS = [ + \T_WHITESPACE => true, + \T_COMMENT => true, + \T_DOC_COMMENT => true, + \T_OPEN_TAG => true, + ]; + + /** @var array<int, bool> Tokens that may be part of a T_NAME_* identifier. */ + private static array $identifierTokens; + + /** + * Create a Token with the given ID and text, as well optional line and position information. + */ + final public function __construct(int $id, string $text, int $line = -1, int $pos = -1) { + $this->id = $id; + $this->text = $text; + $this->line = $line; + $this->pos = $pos; + } + + /** + * Get the name of the token. For single-char tokens this will be the token character. + * Otherwise it will be a T_* style name, or null if the token ID is unknown. + */ + public function getTokenName(): ?string { + if ($this->id < 256) { + return \chr($this->id); + } + + $name = token_name($this->id); + return $name === 'UNKNOWN' ? null : $name; + } + + /** + * Check whether the token is of the given kind. The kind may be either an integer that matches + * the token ID, a string that matches the token text, or an array of integers/strings. In the + * latter case, the function returns true if any of the kinds in the array match. + * + * @param int|string|(int|string)[] $kind + */ + public function is($kind): bool { + if (\is_int($kind)) { + return $this->id === $kind; + } + if (\is_string($kind)) { + return $this->text === $kind; + } + if (\is_array($kind)) { + foreach ($kind as $entry) { + if (\is_int($entry)) { + if ($this->id === $entry) { + return true; + } + } elseif (\is_string($entry)) { + if ($this->text === $entry) { + return true; + } + } else { + throw new \TypeError( + 'Argument #1 ($kind) must only have elements of type string|int, ' . + gettype($entry) . ' given'); + } + } + return false; + } + throw new \TypeError( + 'Argument #1 ($kind) must be of type string|int|array, ' .gettype($kind) . ' given'); + } + + /** + * Check whether this token would be ignored by the PHP parser. Returns true for T_WHITESPACE, + * T_COMMENT, T_DOC_COMMENT and T_OPEN_TAG, and false for everything else. + */ + public function isIgnorable(): bool { + return isset(self::IGNORABLE_TOKENS[$this->id]); + } + + /** + * Return the textual content of the token. + */ + public function __toString(): string { + return $this->text; + } + + /** + * Tokenize the given source code and return an array of tokens. + * + * This performs certain canonicalizations to match the PHP 8.0 token format: + * * Bad characters are represented using T_BAD_CHARACTER rather than omitted. + * * T_COMMENT does not include trailing newlines, instead the newline is part of a following + * T_WHITESPACE token. + * * Namespaced names are represented using T_NAME_* tokens. + * + * @return static[] + */ + public static function tokenize(string $code, int $flags = 0): array { + self::init(); + + $tokens = []; + $line = 1; + $pos = 0; + $origTokens = \token_get_all($code, $flags); + + $numTokens = \count($origTokens); + for ($i = 0; $i < $numTokens; $i++) { + $token = $origTokens[$i]; + if (\is_string($token)) { + if (\strlen($token) === 2) { + // b" and B" are tokenized as single-char tokens, even though they aren't. + $tokens[] = new static(\ord('"'), $token, $line, $pos); + $pos += 2; + } else { + $tokens[] = new static(\ord($token), $token, $line, $pos); + $pos++; + } + } else { + $id = $token[0]; + $text = $token[1]; + + // Emulate PHP 8.0 comment format, which does not include trailing whitespace anymore. + if ($id === \T_COMMENT && \substr($text, 0, 2) !== '/*' && + \preg_match('/(\r\n|\n|\r)$/D', $text, $matches) + ) { + $trailingNewline = $matches[0]; + $text = \substr($text, 0, -\strlen($trailingNewline)); + $tokens[] = new static($id, $text, $line, $pos); + $pos += \strlen($text); + + if ($i + 1 < $numTokens && $origTokens[$i + 1][0] === \T_WHITESPACE) { + // Move trailing newline into following T_WHITESPACE token, if it already exists. + $origTokens[$i + 1][1] = $trailingNewline . $origTokens[$i + 1][1]; + $origTokens[$i + 1][2]--; + } else { + // Otherwise, we need to create a new T_WHITESPACE token. + $tokens[] = new static(\T_WHITESPACE, $trailingNewline, $line, $pos); + $line++; + $pos += \strlen($trailingNewline); + } + continue; + } + + // Emulate PHP 8.0 T_NAME_* tokens, by combining sequences of T_NS_SEPARATOR and + // T_STRING into a single token. + if (($id === \T_NS_SEPARATOR || isset(self::$identifierTokens[$id]))) { + $newText = $text; + $lastWasSeparator = $id === \T_NS_SEPARATOR; + for ($j = $i + 1; $j < $numTokens; $j++) { + if ($lastWasSeparator) { + if (!isset(self::$identifierTokens[$origTokens[$j][0]])) { + break; + } + $lastWasSeparator = false; + } else { + if ($origTokens[$j][0] !== \T_NS_SEPARATOR) { + break; + } + $lastWasSeparator = true; + } + $newText .= $origTokens[$j][1]; + } + if ($lastWasSeparator) { + // Trailing separator is not part of the name. + $j--; + $newText = \substr($newText, 0, -1); + } + if ($j > $i + 1) { + if ($id === \T_NS_SEPARATOR) { + $id = \T_NAME_FULLY_QUALIFIED; + } elseif ($id === \T_NAMESPACE) { + $id = \T_NAME_RELATIVE; + } else { + $id = \T_NAME_QUALIFIED; + } + $tokens[] = new static($id, $newText, $line, $pos); + $pos += \strlen($newText); + $i = $j - 1; + continue; + } + } + + $tokens[] = new static($id, $text, $line, $pos); + $line += \substr_count($text, "\n"); + $pos += \strlen($text); + } + } + return $tokens; + } + + /** Initialize private static state needed by tokenize(). */ + private static function init(): void { + if (isset(self::$identifierTokens)) { + return; + } + + // Based on semi_reserved production. + self::$identifierTokens = \array_fill_keys([ + \T_STRING, + \T_STATIC, \T_ABSTRACT, \T_FINAL, \T_PRIVATE, \T_PROTECTED, \T_PUBLIC, \T_READONLY, + \T_INCLUDE, \T_INCLUDE_ONCE, \T_EVAL, \T_REQUIRE, \T_REQUIRE_ONCE, \T_LOGICAL_OR, \T_LOGICAL_XOR, \T_LOGICAL_AND, + \T_INSTANCEOF, \T_NEW, \T_CLONE, \T_EXIT, \T_IF, \T_ELSEIF, \T_ELSE, \T_ENDIF, \T_ECHO, \T_DO, \T_WHILE, + \T_ENDWHILE, \T_FOR, \T_ENDFOR, \T_FOREACH, \T_ENDFOREACH, \T_DECLARE, \T_ENDDECLARE, \T_AS, \T_TRY, \T_CATCH, + \T_FINALLY, \T_THROW, \T_USE, \T_INSTEADOF, \T_GLOBAL, \T_VAR, \T_UNSET, \T_ISSET, \T_EMPTY, \T_CONTINUE, \T_GOTO, + \T_FUNCTION, \T_CONST, \T_RETURN, \T_PRINT, \T_YIELD, \T_LIST, \T_SWITCH, \T_ENDSWITCH, \T_CASE, \T_DEFAULT, + \T_BREAK, \T_ARRAY, \T_CALLABLE, \T_EXTENDS, \T_IMPLEMENTS, \T_NAMESPACE, \T_TRAIT, \T_INTERFACE, \T_CLASS, + \T_CLASS_C, \T_TRAIT_C, \T_FUNC_C, \T_METHOD_C, \T_LINE, \T_FILE, \T_DIR, \T_NS_C, \T_HALT_COMPILER, \T_FN, + \T_MATCH, + ], true); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php b/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php new file mode 100644 index 00000000..c02844ac --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php @@ -0,0 +1,275 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Internal; + +use PhpParser\Token; + +/** + * Provides operations on token streams, for use by pretty printer. + * + * @internal + */ +class TokenStream { + /** @var Token[] Tokens (in PhpToken::tokenize() format) */ + private array $tokens; + /** @var int[] Map from position to indentation */ + private array $indentMap; + + /** + * Create token stream instance. + * + * @param Token[] $tokens Tokens in PhpToken::tokenize() format + */ + public function __construct(array $tokens) { + $this->tokens = $tokens; + $this->indentMap = $this->calcIndentMap(); + } + + /** + * Whether the given position is immediately surrounded by parenthesis. + * + * @param int $startPos Start position + * @param int $endPos End position + */ + public function haveParens(int $startPos, int $endPos): bool { + return $this->haveTokenImmediatelyBefore($startPos, '(') + && $this->haveTokenImmediatelyAfter($endPos, ')'); + } + + /** + * Whether the given position is immediately surrounded by braces. + * + * @param int $startPos Start position + * @param int $endPos End position + */ + public function haveBraces(int $startPos, int $endPos): bool { + return ($this->haveTokenImmediatelyBefore($startPos, '{') + || $this->haveTokenImmediatelyBefore($startPos, T_CURLY_OPEN)) + && $this->haveTokenImmediatelyAfter($endPos, '}'); + } + + /** + * Check whether the position is directly preceded by a certain token type. + * + * During this check whitespace and comments are skipped. + * + * @param int $pos Position before which the token should occur + * @param int|string $expectedTokenType Token to check for + * + * @return bool Whether the expected token was found + */ + public function haveTokenImmediatelyBefore(int $pos, $expectedTokenType): bool { + $tokens = $this->tokens; + $pos--; + for (; $pos >= 0; $pos--) { + $token = $tokens[$pos]; + if ($token->is($expectedTokenType)) { + return true; + } + if (!$token->isIgnorable()) { + break; + } + } + return false; + } + + /** + * Check whether the position is directly followed by a certain token type. + * + * During this check whitespace and comments are skipped. + * + * @param int $pos Position after which the token should occur + * @param int|string $expectedTokenType Token to check for + * + * @return bool Whether the expected token was found + */ + public function haveTokenImmediatelyAfter(int $pos, $expectedTokenType): bool { + $tokens = $this->tokens; + $pos++; + for ($c = \count($tokens); $pos < $c; $pos++) { + $token = $tokens[$pos]; + if ($token->is($expectedTokenType)) { + return true; + } + if (!$token->isIgnorable()) { + break; + } + } + return false; + } + + /** @param int|string|(int|string)[] $skipTokenType */ + public function skipLeft(int $pos, $skipTokenType): int { + $tokens = $this->tokens; + + $pos = $this->skipLeftWhitespace($pos); + if ($skipTokenType === \T_WHITESPACE) { + return $pos; + } + + if (!$tokens[$pos]->is($skipTokenType)) { + // Shouldn't happen. The skip token MUST be there + throw new \Exception('Encountered unexpected token'); + } + $pos--; + + return $this->skipLeftWhitespace($pos); + } + + /** @param int|string|(int|string)[] $skipTokenType */ + public function skipRight(int $pos, $skipTokenType): int { + $tokens = $this->tokens; + + $pos = $this->skipRightWhitespace($pos); + if ($skipTokenType === \T_WHITESPACE) { + return $pos; + } + + if (!$tokens[$pos]->is($skipTokenType)) { + // Shouldn't happen. The skip token MUST be there + throw new \Exception('Encountered unexpected token'); + } + $pos++; + + return $this->skipRightWhitespace($pos); + } + + /** + * Return first non-whitespace token position smaller or equal to passed position. + * + * @param int $pos Token position + * @return int Non-whitespace token position + */ + public function skipLeftWhitespace(int $pos): int { + $tokens = $this->tokens; + for (; $pos >= 0; $pos--) { + if (!$tokens[$pos]->isIgnorable()) { + break; + } + } + return $pos; + } + + /** + * Return first non-whitespace position greater or equal to passed position. + * + * @param int $pos Token position + * @return int Non-whitespace token position + */ + public function skipRightWhitespace(int $pos): int { + $tokens = $this->tokens; + for ($count = \count($tokens); $pos < $count; $pos++) { + if (!$tokens[$pos]->isIgnorable()) { + break; + } + } + return $pos; + } + + /** @param int|string|(int|string)[] $findTokenType */ + public function findRight(int $pos, $findTokenType): int { + $tokens = $this->tokens; + for ($count = \count($tokens); $pos < $count; $pos++) { + if ($tokens[$pos]->is($findTokenType)) { + return $pos; + } + } + return -1; + } + + /** + * Whether the given position range contains a certain token type. + * + * @param int $startPos Starting position (inclusive) + * @param int $endPos Ending position (exclusive) + * @param int|string $tokenType Token type to look for + * @return bool Whether the token occurs in the given range + */ + public function haveTokenInRange(int $startPos, int $endPos, $tokenType): bool { + $tokens = $this->tokens; + for ($pos = $startPos; $pos < $endPos; $pos++) { + if ($tokens[$pos]->is($tokenType)) { + return true; + } + } + return false; + } + + public function haveTagInRange(int $startPos, int $endPos): bool { + return $this->haveTokenInRange($startPos, $endPos, \T_OPEN_TAG) + || $this->haveTokenInRange($startPos, $endPos, \T_CLOSE_TAG); + } + + /** + * Get indentation before token position. + * + * @param int $pos Token position + * + * @return int Indentation depth (in spaces) + */ + public function getIndentationBefore(int $pos): int { + return $this->indentMap[$pos]; + } + + /** + * Get the code corresponding to a token offset range, optionally adjusted for indentation. + * + * @param int $from Token start position (inclusive) + * @param int $to Token end position (exclusive) + * @param int $indent By how much the code should be indented (can be negative as well) + * + * @return string Code corresponding to token range, adjusted for indentation + */ + public function getTokenCode(int $from, int $to, int $indent): string { + $tokens = $this->tokens; + $result = ''; + for ($pos = $from; $pos < $to; $pos++) { + $token = $tokens[$pos]; + $id = $token->id; + $text = $token->text; + if ($id === \T_CONSTANT_ENCAPSED_STRING || $id === \T_ENCAPSED_AND_WHITESPACE) { + $result .= $text; + } else { + // TODO Handle non-space indentation + if ($indent < 0) { + $result .= str_replace("\n" . str_repeat(" ", -$indent), "\n", $text); + } elseif ($indent > 0) { + $result .= str_replace("\n", "\n" . str_repeat(" ", $indent), $text); + } else { + $result .= $text; + } + } + } + return $result; + } + + /** + * Precalculate the indentation at every token position. + * + * @return int[] Token position to indentation map + */ + private function calcIndentMap(): array { + $indentMap = []; + $indent = 0; + foreach ($this->tokens as $i => $token) { + $indentMap[] = $indent; + + if ($token->id === \T_WHITESPACE) { + $content = $token->text; + $newlinePos = \strrpos($content, "\n"); + if (false !== $newlinePos) { + $indent = \strlen($content) - $newlinePos - 1; + } elseif ($i === 1 && $this->tokens[0]->id === \T_OPEN_TAG && + $this->tokens[0]->text[\strlen($this->tokens[0]->text) - 1] === "\n") { + // Special case: Newline at the end of opening tag followed by whitespace. + $indent = \strlen($content); + } + } + } + + // Add a sentinel for one past end of the file + $indentMap[] = $indent; + + return $indentMap; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/JsonDecoder.php b/vendor/nikic/php-parser/lib/PhpParser/JsonDecoder.php new file mode 100644 index 00000000..7be41426 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/JsonDecoder.php @@ -0,0 +1,108 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +class JsonDecoder { + /** @var \ReflectionClass<Node>[] Node type to reflection class map */ + private array $reflectionClassCache; + + /** @return mixed */ + public function decode(string $json) { + $value = json_decode($json, true); + if (json_last_error()) { + throw new \RuntimeException('JSON decoding error: ' . json_last_error_msg()); + } + + return $this->decodeRecursive($value); + } + + /** + * @param mixed $value + * @return mixed + */ + private function decodeRecursive($value) { + if (\is_array($value)) { + if (isset($value['nodeType'])) { + if ($value['nodeType'] === 'Comment' || $value['nodeType'] === 'Comment_Doc') { + return $this->decodeComment($value); + } + return $this->decodeNode($value); + } + return $this->decodeArray($value); + } + return $value; + } + + private function decodeArray(array $array): array { + $decodedArray = []; + foreach ($array as $key => $value) { + $decodedArray[$key] = $this->decodeRecursive($value); + } + return $decodedArray; + } + + private function decodeNode(array $value): Node { + $nodeType = $value['nodeType']; + if (!\is_string($nodeType)) { + throw new \RuntimeException('Node type must be a string'); + } + + $reflectionClass = $this->reflectionClassFromNodeType($nodeType); + $node = $reflectionClass->newInstanceWithoutConstructor(); + + if (isset($value['attributes'])) { + if (!\is_array($value['attributes'])) { + throw new \RuntimeException('Attributes must be an array'); + } + + $node->setAttributes($this->decodeArray($value['attributes'])); + } + + foreach ($value as $name => $subNode) { + if ($name === 'nodeType' || $name === 'attributes') { + continue; + } + + $node->$name = $this->decodeRecursive($subNode); + } + + return $node; + } + + private function decodeComment(array $value): Comment { + $className = $value['nodeType'] === 'Comment' ? Comment::class : Comment\Doc::class; + if (!isset($value['text'])) { + throw new \RuntimeException('Comment must have text'); + } + + return new $className( + $value['text'], + $value['line'] ?? -1, $value['filePos'] ?? -1, $value['tokenPos'] ?? -1, + $value['endLine'] ?? -1, $value['endFilePos'] ?? -1, $value['endTokenPos'] ?? -1 + ); + } + + /** @return \ReflectionClass<Node> */ + private function reflectionClassFromNodeType(string $nodeType): \ReflectionClass { + if (!isset($this->reflectionClassCache[$nodeType])) { + $className = $this->classNameFromNodeType($nodeType); + $this->reflectionClassCache[$nodeType] = new \ReflectionClass($className); + } + return $this->reflectionClassCache[$nodeType]; + } + + /** @return class-string<Node> */ + private function classNameFromNodeType(string $nodeType): string { + $className = 'PhpParser\\Node\\' . strtr($nodeType, '_', '\\'); + if (class_exists($className)) { + return $className; + } + + $className .= '_'; + if (class_exists($className)) { + return $className; + } + + throw new \RuntimeException("Unknown node type \"$nodeType\""); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer.php new file mode 100644 index 00000000..5e2ece96 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Lexer.php @@ -0,0 +1,116 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +require __DIR__ . '/compatibility_tokens.php'; + +class Lexer { + /** + * Tokenize the provided source code. + * + * The token array is in the same format as provided by the PhpToken::tokenize() method in + * PHP 8.0. The tokens are instances of PhpParser\Token, to abstract over a polyfill + * implementation in earlier PHP version. + * + * The token array is terminated by a sentinel token with token ID 0. + * The token array does not discard any tokens (i.e. whitespace and comments are included). + * The token position attributes are against this token array. + * + * @param string $code The source code to tokenize. + * @param ErrorHandler|null $errorHandler Error handler to use for lexing errors. Defaults to + * ErrorHandler\Throwing. + * @return Token[] Tokens + */ + public function tokenize(string $code, ?ErrorHandler $errorHandler = null): array { + if (null === $errorHandler) { + $errorHandler = new ErrorHandler\Throwing(); + } + + $scream = ini_set('xdebug.scream', '0'); + + $tokens = @Token::tokenize($code); + $this->postprocessTokens($tokens, $errorHandler); + + if (false !== $scream) { + ini_set('xdebug.scream', $scream); + } + + return $tokens; + } + + private function handleInvalidCharacter(Token $token, ErrorHandler $errorHandler): void { + $chr = $token->text; + if ($chr === "\0") { + // PHP cuts error message after null byte, so need special case + $errorMsg = 'Unexpected null byte'; + } else { + $errorMsg = sprintf( + 'Unexpected character "%s" (ASCII %d)', $chr, ord($chr) + ); + } + + $errorHandler->handleError(new Error($errorMsg, [ + 'startLine' => $token->line, + 'endLine' => $token->line, + 'startFilePos' => $token->pos, + 'endFilePos' => $token->pos, + ])); + } + + private function isUnterminatedComment(Token $token): bool { + return $token->is([\T_COMMENT, \T_DOC_COMMENT]) + && substr($token->text, 0, 2) === '/*' + && substr($token->text, -2) !== '*/'; + } + + /** + * @param list<Token> $tokens + */ + protected function postprocessTokens(array &$tokens, ErrorHandler $errorHandler): void { + // This function reports errors (bad characters and unterminated comments) in the token + // array, and performs certain canonicalizations: + // * Use PHP 8.1 T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG and + // T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG tokens used to disambiguate intersection types. + // * Add a sentinel token with ID 0. + + $numTokens = \count($tokens); + if ($numTokens === 0) { + // Empty input edge case: Just add the sentinel token. + $tokens[] = new Token(0, "\0", 1, 0); + return; + } + + for ($i = 0; $i < $numTokens; $i++) { + $token = $tokens[$i]; + if ($token->id === \T_BAD_CHARACTER) { + $this->handleInvalidCharacter($token, $errorHandler); + } + + if ($token->id === \ord('&')) { + $next = $i + 1; + while (isset($tokens[$next]) && $tokens[$next]->id === \T_WHITESPACE) { + $next++; + } + $followedByVarOrVarArg = isset($tokens[$next]) && + $tokens[$next]->is([\T_VARIABLE, \T_ELLIPSIS]); + $token->id = $followedByVarOrVarArg + ? \T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG + : \T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG; + } + } + + // Check for unterminated comment + $lastToken = $tokens[$numTokens - 1]; + if ($this->isUnterminatedComment($lastToken)) { + $errorHandler->handleError(new Error('Unterminated comment', [ + 'startLine' => $lastToken->line, + 'endLine' => $lastToken->getEndLine(), + 'startFilePos' => $lastToken->pos, + 'endFilePos' => $lastToken->getEndPos(), + ])); + } + + // Add sentinel token. + $tokens[] = new Token(0, "\0", $lastToken->getEndLine(), $lastToken->getEndPos()); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php new file mode 100644 index 00000000..934954cd --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php @@ -0,0 +1,226 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Lexer; + +use PhpParser\Error; +use PhpParser\ErrorHandler; +use PhpParser\Lexer; +use PhpParser\Lexer\TokenEmulator\AttributeEmulator; +use PhpParser\Lexer\TokenEmulator\EnumTokenEmulator; +use PhpParser\Lexer\TokenEmulator\CoaleseEqualTokenEmulator; +use PhpParser\Lexer\TokenEmulator\ExplicitOctalEmulator; +use PhpParser\Lexer\TokenEmulator\FlexibleDocStringEmulator; +use PhpParser\Lexer\TokenEmulator\FnTokenEmulator; +use PhpParser\Lexer\TokenEmulator\MatchTokenEmulator; +use PhpParser\Lexer\TokenEmulator\NullsafeTokenEmulator; +use PhpParser\Lexer\TokenEmulator\NumericLiteralSeparatorEmulator; +use PhpParser\Lexer\TokenEmulator\ReadonlyFunctionTokenEmulator; +use PhpParser\Lexer\TokenEmulator\ReadonlyTokenEmulator; +use PhpParser\Lexer\TokenEmulator\ReverseEmulator; +use PhpParser\Lexer\TokenEmulator\TokenEmulator; +use PhpParser\PhpVersion; +use PhpParser\Token; + +class Emulative extends Lexer { + /** @var array{int, string, string}[] Patches used to reverse changes introduced in the code */ + private array $patches = []; + + /** @var list<TokenEmulator> */ + private array $emulators = []; + + private PhpVersion $targetPhpVersion; + + private PhpVersion $hostPhpVersion; + + /** + * @param PhpVersion|null $phpVersion PHP version to emulate. Defaults to newest supported. + */ + public function __construct(?PhpVersion $phpVersion = null) { + $this->targetPhpVersion = $phpVersion ?? PhpVersion::getNewestSupported(); + $this->hostPhpVersion = PhpVersion::getHostVersion(); + + $emulators = [ + new MatchTokenEmulator(), + new NullsafeTokenEmulator(), + new AttributeEmulator(), + new EnumTokenEmulator(), + new ReadonlyTokenEmulator(), + new ExplicitOctalEmulator(), + new ReadonlyFunctionTokenEmulator(), + ]; + + // Collect emulators that are relevant for the PHP version we're running + // and the PHP version we're targeting for emulation. + foreach ($emulators as $emulator) { + $emulatorPhpVersion = $emulator->getPhpVersion(); + if ($this->isForwardEmulationNeeded($emulatorPhpVersion)) { + $this->emulators[] = $emulator; + } elseif ($this->isReverseEmulationNeeded($emulatorPhpVersion)) { + $this->emulators[] = new ReverseEmulator($emulator); + } + } + } + + public function tokenize(string $code, ?ErrorHandler $errorHandler = null): array { + $emulators = array_filter($this->emulators, function ($emulator) use ($code) { + return $emulator->isEmulationNeeded($code); + }); + + if (empty($emulators)) { + // Nothing to emulate, yay + return parent::tokenize($code, $errorHandler); + } + + if ($errorHandler === null) { + $errorHandler = new ErrorHandler\Throwing(); + } + + $this->patches = []; + foreach ($emulators as $emulator) { + $code = $emulator->preprocessCode($code, $this->patches); + } + + $collector = new ErrorHandler\Collecting(); + $tokens = parent::tokenize($code, $collector); + $this->sortPatches(); + $tokens = $this->fixupTokens($tokens); + + $errors = $collector->getErrors(); + if (!empty($errors)) { + $this->fixupErrors($errors); + foreach ($errors as $error) { + $errorHandler->handleError($error); + } + } + + foreach ($emulators as $emulator) { + $tokens = $emulator->emulate($code, $tokens); + } + + return $tokens; + } + + private function isForwardEmulationNeeded(PhpVersion $emulatorPhpVersion): bool { + return $this->hostPhpVersion->older($emulatorPhpVersion) + && $this->targetPhpVersion->newerOrEqual($emulatorPhpVersion); + } + + private function isReverseEmulationNeeded(PhpVersion $emulatorPhpVersion): bool { + return $this->hostPhpVersion->newerOrEqual($emulatorPhpVersion) + && $this->targetPhpVersion->older($emulatorPhpVersion); + } + + private function sortPatches(): void { + // Patches may be contributed by different emulators. + // Make sure they are sorted by increasing patch position. + usort($this->patches, function ($p1, $p2) { + return $p1[0] <=> $p2[0]; + }); + } + + /** + * @param list<Token> $tokens + * @return list<Token> + */ + private function fixupTokens(array $tokens): array { + if (\count($this->patches) === 0) { + return $tokens; + } + + // Load first patch + $patchIdx = 0; + list($patchPos, $patchType, $patchText) = $this->patches[$patchIdx]; + + // We use a manual loop over the tokens, because we modify the array on the fly + $posDelta = 0; + $lineDelta = 0; + for ($i = 0, $c = \count($tokens); $i < $c; $i++) { + $token = $tokens[$i]; + $pos = $token->pos; + $token->pos += $posDelta; + $token->line += $lineDelta; + $localPosDelta = 0; + $len = \strlen($token->text); + while ($patchPos >= $pos && $patchPos < $pos + $len) { + $patchTextLen = \strlen($patchText); + if ($patchType === 'remove') { + if ($patchPos === $pos && $patchTextLen === $len) { + // Remove token entirely + array_splice($tokens, $i, 1, []); + $i--; + $c--; + } else { + // Remove from token string + $token->text = substr_replace( + $token->text, '', $patchPos - $pos + $localPosDelta, $patchTextLen + ); + $localPosDelta -= $patchTextLen; + } + $lineDelta -= \substr_count($patchText, "\n"); + } elseif ($patchType === 'add') { + // Insert into the token string + $token->text = substr_replace( + $token->text, $patchText, $patchPos - $pos + $localPosDelta, 0 + ); + $localPosDelta += $patchTextLen; + $lineDelta += \substr_count($patchText, "\n"); + } elseif ($patchType === 'replace') { + // Replace inside the token string + $token->text = substr_replace( + $token->text, $patchText, $patchPos - $pos + $localPosDelta, $patchTextLen + ); + } else { + assert(false); + } + + // Fetch the next patch + $patchIdx++; + if ($patchIdx >= \count($this->patches)) { + // No more patches. However, we still need to adjust position. + $patchPos = \PHP_INT_MAX; + break; + } + + list($patchPos, $patchType, $patchText) = $this->patches[$patchIdx]; + } + + $posDelta += $localPosDelta; + } + return $tokens; + } + + /** + * Fixup line and position information in errors. + * + * @param Error[] $errors + */ + private function fixupErrors(array $errors): void { + foreach ($errors as $error) { + $attrs = $error->getAttributes(); + + $posDelta = 0; + $lineDelta = 0; + foreach ($this->patches as $patch) { + list($patchPos, $patchType, $patchText) = $patch; + if ($patchPos >= $attrs['startFilePos']) { + // No longer relevant + break; + } + + if ($patchType === 'add') { + $posDelta += strlen($patchText); + $lineDelta += substr_count($patchText, "\n"); + } elseif ($patchType === 'remove') { + $posDelta -= strlen($patchText); + $lineDelta -= substr_count($patchText, "\n"); + } + } + + $attrs['startFilePos'] += $posDelta; + $attrs['endFilePos'] += $posDelta; + $attrs['startLine'] += $lineDelta; + $attrs['endLine'] += $lineDelta; + $error->setAttributes($attrs); + } + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php new file mode 100644 index 00000000..2c12f33a --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php @@ -0,0 +1,49 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Lexer\TokenEmulator; + +use PhpParser\PhpVersion; +use PhpParser\Token; + +final class AttributeEmulator extends TokenEmulator { + public function getPhpVersion(): PhpVersion { + return PhpVersion::fromComponents(8, 0); + } + + public function isEmulationNeeded(string $code): bool { + return strpos($code, '#[') !== false; + } + + public function emulate(string $code, array $tokens): array { + // We need to manually iterate and manage a count because we'll change + // the tokens array on the way. + for ($i = 0, $c = count($tokens); $i < $c; ++$i) { + $token = $tokens[$i]; + if ($token->text === '#' && isset($tokens[$i + 1]) && $tokens[$i + 1]->text === '[') { + array_splice($tokens, $i, 2, [ + new Token(\T_ATTRIBUTE, '#[', $token->line, $token->pos), + ]); + $c--; + continue; + } + } + + return $tokens; + } + + public function reverseEmulate(string $code, array $tokens): array { + // TODO + return $tokens; + } + + public function preprocessCode(string $code, array &$patches): string { + $pos = 0; + while (false !== $pos = strpos($code, '#[', $pos)) { + // Replace #[ with %[ + $code[$pos] = '%'; + $patches[] = [$pos, 'replace', '#']; + $pos += 2; + } + return $code; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php new file mode 100644 index 00000000..5418f52c --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php @@ -0,0 +1,26 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Lexer\TokenEmulator; + +use PhpParser\PhpVersion; + +final class EnumTokenEmulator extends KeywordEmulator { + public function getPhpVersion(): PhpVersion { + return PhpVersion::fromComponents(8, 1); + } + + public function getKeywordString(): string { + return 'enum'; + } + + public function getKeywordToken(): int { + return \T_ENUM; + } + + protected function isKeywordContext(array $tokens, int $pos): bool { + return parent::isKeywordContext($tokens, $pos) + && isset($tokens[$pos + 2]) + && $tokens[$pos + 1]->id === \T_WHITESPACE + && $tokens[$pos + 2]->id === \T_STRING; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php new file mode 100644 index 00000000..9cadf420 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php @@ -0,0 +1,45 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Lexer\TokenEmulator; + +use PhpParser\PhpVersion; +use PhpParser\Token; + +class ExplicitOctalEmulator extends TokenEmulator { + public function getPhpVersion(): PhpVersion { + return PhpVersion::fromComponents(8, 1); + } + + public function isEmulationNeeded(string $code): bool { + return strpos($code, '0o') !== false || strpos($code, '0O') !== false; + } + + public function emulate(string $code, array $tokens): array { + for ($i = 0, $c = count($tokens); $i < $c; ++$i) { + $token = $tokens[$i]; + if ($token->id == \T_LNUMBER && $token->text === '0' && + isset($tokens[$i + 1]) && $tokens[$i + 1]->id == \T_STRING && + preg_match('/[oO][0-7]+(?:_[0-7]+)*/', $tokens[$i + 1]->text) + ) { + $tokenKind = $this->resolveIntegerOrFloatToken($tokens[$i + 1]->text); + array_splice($tokens, $i, 2, [ + new Token($tokenKind, '0' . $tokens[$i + 1]->text, $token->line, $token->pos), + ]); + $c--; + } + } + return $tokens; + } + + private function resolveIntegerOrFloatToken(string $str): int { + $str = substr($str, 1); + $str = str_replace('_', '', $str); + $num = octdec($str); + return is_float($num) ? \T_DNUMBER : \T_LNUMBER; + } + + public function reverseEmulate(string $code, array $tokens): array { + // Explicit octals were not legal code previously, don't bother. + return $tokens; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php new file mode 100644 index 00000000..9803f996 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php @@ -0,0 +1,56 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Lexer\TokenEmulator; + +use PhpParser\Token; + +abstract class KeywordEmulator extends TokenEmulator { + abstract public function getKeywordString(): string; + abstract public function getKeywordToken(): int; + + public function isEmulationNeeded(string $code): bool { + return strpos(strtolower($code), $this->getKeywordString()) !== false; + } + + /** @param Token[] $tokens */ + protected function isKeywordContext(array $tokens, int $pos): bool { + $previousNonSpaceToken = $this->getPreviousNonSpaceToken($tokens, $pos); + return $previousNonSpaceToken === null || $previousNonSpaceToken->id !== \T_OBJECT_OPERATOR; + } + + public function emulate(string $code, array $tokens): array { + $keywordString = $this->getKeywordString(); + foreach ($tokens as $i => $token) { + if ($token->id === T_STRING && strtolower($token->text) === $keywordString + && $this->isKeywordContext($tokens, $i)) { + $token->id = $this->getKeywordToken(); + } + } + + return $tokens; + } + + /** @param Token[] $tokens */ + private function getPreviousNonSpaceToken(array $tokens, int $start): ?Token { + for ($i = $start - 1; $i >= 0; --$i) { + if ($tokens[$i]->id === T_WHITESPACE) { + continue; + } + + return $tokens[$i]; + } + + return null; + } + + public function reverseEmulate(string $code, array $tokens): array { + $keywordToken = $this->getKeywordToken(); + foreach ($tokens as $token) { + if ($token->id === $keywordToken) { + $token->id = \T_STRING; + } + } + + return $tokens; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php new file mode 100644 index 00000000..0fa5fbc2 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php @@ -0,0 +1,19 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Lexer\TokenEmulator; + +use PhpParser\PhpVersion; + +final class MatchTokenEmulator extends KeywordEmulator { + public function getPhpVersion(): PhpVersion { + return PhpVersion::fromComponents(8, 0); + } + + public function getKeywordString(): string { + return 'match'; + } + + public function getKeywordToken(): int { + return \T_MATCH; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php new file mode 100644 index 00000000..cede96f0 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php @@ -0,0 +1,60 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Lexer\TokenEmulator; + +use PhpParser\PhpVersion; +use PhpParser\Token; + +final class NullsafeTokenEmulator extends TokenEmulator { + public function getPhpVersion(): PhpVersion { + return PhpVersion::fromComponents(8, 0); + } + + public function isEmulationNeeded(string $code): bool { + return strpos($code, '?->') !== false; + } + + public function emulate(string $code, array $tokens): array { + // We need to manually iterate and manage a count because we'll change + // the tokens array on the way + for ($i = 0, $c = count($tokens); $i < $c; ++$i) { + $token = $tokens[$i]; + if ($token->text === '?' && isset($tokens[$i + 1]) && $tokens[$i + 1]->id === \T_OBJECT_OPERATOR) { + array_splice($tokens, $i, 2, [ + new Token(\T_NULLSAFE_OBJECT_OPERATOR, '?->', $token->line, $token->pos), + ]); + $c--; + continue; + } + + // Handle ?-> inside encapsed string. + if ($token->id === \T_ENCAPSED_AND_WHITESPACE && isset($tokens[$i - 1]) + && $tokens[$i - 1]->id === \T_VARIABLE + && preg_match('/^\?->([a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*)/', $token->text, $matches) + ) { + $replacement = [ + new Token(\T_NULLSAFE_OBJECT_OPERATOR, '?->', $token->line, $token->pos), + new Token(\T_STRING, $matches[1], $token->line, $token->pos + 3), + ]; + $matchLen = \strlen($matches[0]); + if ($matchLen !== \strlen($token->text)) { + $replacement[] = new Token( + \T_ENCAPSED_AND_WHITESPACE, + \substr($token->text, $matchLen), + $token->line, $token->pos + $matchLen + ); + } + array_splice($tokens, $i, 1, $replacement); + $c += \count($replacement) - 1; + continue; + } + } + + return $tokens; + } + + public function reverseEmulate(string $code, array $tokens): array { + // ?-> was not valid code previously, don't bother. + return $tokens; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyFunctionTokenEmulator.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyFunctionTokenEmulator.php new file mode 100644 index 00000000..5990d7fa --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyFunctionTokenEmulator.php @@ -0,0 +1,31 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Lexer\TokenEmulator; + +use PhpParser\PhpVersion; + +/* + * In PHP 8.1, "readonly(" was special cased in the lexer in order to support functions with + * name readonly. In PHP 8.2, this may conflict with readonly properties having a DNF type. For + * this reason, PHP 8.2 instead treats this as T_READONLY and then handles it specially in the + * parser. This emulator only exists to handle this special case, which is skipped by the + * PHP 8.1 ReadonlyTokenEmulator. + */ +class ReadonlyFunctionTokenEmulator extends KeywordEmulator { + public function getKeywordString(): string { + return 'readonly'; + } + + public function getKeywordToken(): int { + return \T_READONLY; + } + + public function getPhpVersion(): PhpVersion { + return PhpVersion::fromComponents(8, 2); + } + + public function reverseEmulate(string $code, array $tokens): array { + // Don't bother + return $tokens; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php new file mode 100644 index 00000000..37240f79 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php @@ -0,0 +1,31 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Lexer\TokenEmulator; + +use PhpParser\PhpVersion; + +final class ReadonlyTokenEmulator extends KeywordEmulator { + public function getPhpVersion(): PhpVersion { + return PhpVersion::fromComponents(8, 1); + } + + public function getKeywordString(): string { + return 'readonly'; + } + + public function getKeywordToken(): int { + return \T_READONLY; + } + + protected function isKeywordContext(array $tokens, int $pos): bool { + if (!parent::isKeywordContext($tokens, $pos)) { + return false; + } + // Support "function readonly(" + return !(isset($tokens[$pos + 1]) && + ($tokens[$pos + 1]->text === '(' || + ($tokens[$pos + 1]->id === \T_WHITESPACE && + isset($tokens[$pos + 2]) && + $tokens[$pos + 2]->text === '('))); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php new file mode 100644 index 00000000..851b5c4a --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php @@ -0,0 +1,37 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Lexer\TokenEmulator; + +use PhpParser\PhpVersion; + +/** + * Reverses emulation direction of the inner emulator. + */ +final class ReverseEmulator extends TokenEmulator { + /** @var TokenEmulator Inner emulator */ + private TokenEmulator $emulator; + + public function __construct(TokenEmulator $emulator) { + $this->emulator = $emulator; + } + + public function getPhpVersion(): PhpVersion { + return $this->emulator->getPhpVersion(); + } + + public function isEmulationNeeded(string $code): bool { + return $this->emulator->isEmulationNeeded($code); + } + + public function emulate(string $code, array $tokens): array { + return $this->emulator->reverseEmulate($code, $tokens); + } + + public function reverseEmulate(string $code, array $tokens): array { + return $this->emulator->emulate($code, $tokens); + } + + public function preprocessCode(string $code, array &$patches): string { + return $code; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php new file mode 100644 index 00000000..fec2f19f --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php @@ -0,0 +1,30 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Lexer\TokenEmulator; + +use PhpParser\PhpVersion; +use PhpParser\Token; + +/** @internal */ +abstract class TokenEmulator { + abstract public function getPhpVersion(): PhpVersion; + + abstract public function isEmulationNeeded(string $code): bool; + + /** + * @param Token[] $tokens Original tokens + * @return Token[] Modified Tokens + */ + abstract public function emulate(string $code, array $tokens): array; + + /** + * @param Token[] $tokens Original tokens + * @return Token[] Modified Tokens + */ + abstract public function reverseEmulate(string $code, array $tokens): array; + + /** @param array{int, string, string}[] $patches */ + public function preprocessCode(string $code, array &$patches): string { + return $code; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Modifiers.php b/vendor/nikic/php-parser/lib/PhpParser/Modifiers.php new file mode 100644 index 00000000..b7120eea --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Modifiers.php @@ -0,0 +1,69 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +/** + * Modifiers used (as a bit mask) by various flags subnodes, for example on classes, functions, + * properties and constants. + */ +final class Modifiers { + public const PUBLIC = 1; + public const PROTECTED = 2; + public const PRIVATE = 4; + public const STATIC = 8; + public const ABSTRACT = 16; + public const FINAL = 32; + public const READONLY = 64; + + public const VISIBILITY_MASK = 1 | 2 | 4; + + /** + * @internal + */ + public static function verifyClassModifier(int $a, int $b): void { + if ($a & Modifiers::ABSTRACT && $b & Modifiers::ABSTRACT) { + throw new Error('Multiple abstract modifiers are not allowed'); + } + + if ($a & Modifiers::FINAL && $b & Modifiers::FINAL) { + throw new Error('Multiple final modifiers are not allowed'); + } + + if ($a & Modifiers::READONLY && $b & Modifiers::READONLY) { + throw new Error('Multiple readonly modifiers are not allowed'); + } + + if ($a & 48 && $b & 48) { + throw new Error('Cannot use the final modifier on an abstract class'); + } + } + + /** + * @internal + */ + public static function verifyModifier(int $a, int $b): void { + if ($a & Modifiers::VISIBILITY_MASK && $b & Modifiers::VISIBILITY_MASK) { + throw new Error('Multiple access type modifiers are not allowed'); + } + + if ($a & Modifiers::ABSTRACT && $b & Modifiers::ABSTRACT) { + throw new Error('Multiple abstract modifiers are not allowed'); + } + + if ($a & Modifiers::STATIC && $b & Modifiers::STATIC) { + throw new Error('Multiple static modifiers are not allowed'); + } + + if ($a & Modifiers::FINAL && $b & Modifiers::FINAL) { + throw new Error('Multiple final modifiers are not allowed'); + } + + if ($a & Modifiers::READONLY && $b & Modifiers::READONLY) { + throw new Error('Multiple readonly modifiers are not allowed'); + } + + if ($a & 48 && $b & 48) { + throw new Error('Cannot use the final modifier on an abstract class member'); + } + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/NameContext.php b/vendor/nikic/php-parser/lib/PhpParser/NameContext.php new file mode 100644 index 00000000..292df691 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/NameContext.php @@ -0,0 +1,284 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +use PhpParser\Node\Name; +use PhpParser\Node\Name\FullyQualified; +use PhpParser\Node\Stmt; + +class NameContext { + /** @var null|Name Current namespace */ + protected ?Name $namespace; + + /** @var Name[][] Map of format [aliasType => [aliasName => originalName]] */ + protected array $aliases = []; + + /** @var Name[][] Same as $aliases but preserving original case */ + protected array $origAliases = []; + + /** @var ErrorHandler Error handler */ + protected ErrorHandler $errorHandler; + + /** + * Create a name context. + * + * @param ErrorHandler $errorHandler Error handling used to report errors + */ + public function __construct(ErrorHandler $errorHandler) { + $this->errorHandler = $errorHandler; + } + + /** + * Start a new namespace. + * + * This also resets the alias table. + * + * @param Name|null $namespace Null is the global namespace + */ + public function startNamespace(?Name $namespace = null): void { + $this->namespace = $namespace; + $this->origAliases = $this->aliases = [ + Stmt\Use_::TYPE_NORMAL => [], + Stmt\Use_::TYPE_FUNCTION => [], + Stmt\Use_::TYPE_CONSTANT => [], + ]; + } + + /** + * Add an alias / import. + * + * @param Name $name Original name + * @param string $aliasName Aliased name + * @param Stmt\Use_::TYPE_* $type One of Stmt\Use_::TYPE_* + * @param array<string, mixed> $errorAttrs Attributes to use to report an error + */ + public function addAlias(Name $name, string $aliasName, int $type, array $errorAttrs = []): void { + // Constant names are case sensitive, everything else case insensitive + if ($type === Stmt\Use_::TYPE_CONSTANT) { + $aliasLookupName = $aliasName; + } else { + $aliasLookupName = strtolower($aliasName); + } + + if (isset($this->aliases[$type][$aliasLookupName])) { + $typeStringMap = [ + Stmt\Use_::TYPE_NORMAL => '', + Stmt\Use_::TYPE_FUNCTION => 'function ', + Stmt\Use_::TYPE_CONSTANT => 'const ', + ]; + + $this->errorHandler->handleError(new Error( + sprintf( + 'Cannot use %s%s as %s because the name is already in use', + $typeStringMap[$type], $name, $aliasName + ), + $errorAttrs + )); + return; + } + + $this->aliases[$type][$aliasLookupName] = $name; + $this->origAliases[$type][$aliasName] = $name; + } + + /** + * Get current namespace. + * + * @return null|Name Namespace (or null if global namespace) + */ + public function getNamespace(): ?Name { + return $this->namespace; + } + + /** + * Get resolved name. + * + * @param Name $name Name to resolve + * @param Stmt\Use_::TYPE_* $type One of Stmt\Use_::TYPE_{FUNCTION|CONSTANT} + * + * @return null|Name Resolved name, or null if static resolution is not possible + */ + public function getResolvedName(Name $name, int $type): ?Name { + // don't resolve special class names + if ($type === Stmt\Use_::TYPE_NORMAL && $name->isSpecialClassName()) { + if (!$name->isUnqualified()) { + $this->errorHandler->handleError(new Error( + sprintf("'\\%s' is an invalid class name", $name->toString()), + $name->getAttributes() + )); + } + return $name; + } + + // fully qualified names are already resolved + if ($name->isFullyQualified()) { + return $name; + } + + // Try to resolve aliases + if (null !== $resolvedName = $this->resolveAlias($name, $type)) { + return $resolvedName; + } + + if ($type !== Stmt\Use_::TYPE_NORMAL && $name->isUnqualified()) { + if (null === $this->namespace) { + // outside of a namespace unaliased unqualified is same as fully qualified + return new FullyQualified($name, $name->getAttributes()); + } + + // Cannot resolve statically + return null; + } + + // if no alias exists prepend current namespace + return FullyQualified::concat($this->namespace, $name, $name->getAttributes()); + } + + /** + * Get resolved class name. + * + * @param Name $name Class ame to resolve + * + * @return Name Resolved name + */ + public function getResolvedClassName(Name $name): Name { + return $this->getResolvedName($name, Stmt\Use_::TYPE_NORMAL); + } + + /** + * Get possible ways of writing a fully qualified name (e.g., by making use of aliases). + * + * @param string $name Fully-qualified name (without leading namespace separator) + * @param Stmt\Use_::TYPE_* $type One of Stmt\Use_::TYPE_* + * + * @return Name[] Possible representations of the name + */ + public function getPossibleNames(string $name, int $type): array { + $lcName = strtolower($name); + + if ($type === Stmt\Use_::TYPE_NORMAL) { + // self, parent and static must always be unqualified + if ($lcName === "self" || $lcName === "parent" || $lcName === "static") { + return [new Name($name)]; + } + } + + // Collect possible ways to write this name, starting with the fully-qualified name + $possibleNames = [new FullyQualified($name)]; + + if (null !== $nsRelativeName = $this->getNamespaceRelativeName($name, $lcName, $type)) { + // Make sure there is no alias that makes the normally namespace-relative name + // into something else + if (null === $this->resolveAlias($nsRelativeName, $type)) { + $possibleNames[] = $nsRelativeName; + } + } + + // Check for relevant namespace use statements + foreach ($this->origAliases[Stmt\Use_::TYPE_NORMAL] as $alias => $orig) { + $lcOrig = $orig->toLowerString(); + if (0 === strpos($lcName, $lcOrig . '\\')) { + $possibleNames[] = new Name($alias . substr($name, strlen($lcOrig))); + } + } + + // Check for relevant type-specific use statements + foreach ($this->origAliases[$type] as $alias => $orig) { + if ($type === Stmt\Use_::TYPE_CONSTANT) { + // Constants are are complicated-sensitive + $normalizedOrig = $this->normalizeConstName($orig->toString()); + if ($normalizedOrig === $this->normalizeConstName($name)) { + $possibleNames[] = new Name($alias); + } + } else { + // Everything else is case-insensitive + if ($orig->toLowerString() === $lcName) { + $possibleNames[] = new Name($alias); + } + } + } + + return $possibleNames; + } + + /** + * Get shortest representation of this fully-qualified name. + * + * @param string $name Fully-qualified name (without leading namespace separator) + * @param Stmt\Use_::TYPE_* $type One of Stmt\Use_::TYPE_* + * + * @return Name Shortest representation + */ + public function getShortName(string $name, int $type): Name { + $possibleNames = $this->getPossibleNames($name, $type); + + // Find shortest name + $shortestName = null; + $shortestLength = \INF; + foreach ($possibleNames as $possibleName) { + $length = strlen($possibleName->toCodeString()); + if ($length < $shortestLength) { + $shortestName = $possibleName; + $shortestLength = $length; + } + } + + return $shortestName; + } + + private function resolveAlias(Name $name, int $type): ?FullyQualified { + $firstPart = $name->getFirst(); + + if ($name->isQualified()) { + // resolve aliases for qualified names, always against class alias table + $checkName = strtolower($firstPart); + if (isset($this->aliases[Stmt\Use_::TYPE_NORMAL][$checkName])) { + $alias = $this->aliases[Stmt\Use_::TYPE_NORMAL][$checkName]; + return FullyQualified::concat($alias, $name->slice(1), $name->getAttributes()); + } + } elseif ($name->isUnqualified()) { + // constant aliases are case-sensitive, function aliases case-insensitive + $checkName = $type === Stmt\Use_::TYPE_CONSTANT ? $firstPart : strtolower($firstPart); + if (isset($this->aliases[$type][$checkName])) { + // resolve unqualified aliases + return new FullyQualified($this->aliases[$type][$checkName], $name->getAttributes()); + } + } + + // No applicable aliases + return null; + } + + private function getNamespaceRelativeName(string $name, string $lcName, int $type): ?Name { + if (null === $this->namespace) { + return new Name($name); + } + + if ($type === Stmt\Use_::TYPE_CONSTANT) { + // The constants true/false/null always resolve to the global symbols, even inside a + // namespace, so they may be used without qualification + if ($lcName === "true" || $lcName === "false" || $lcName === "null") { + return new Name($name); + } + } + + $namespacePrefix = strtolower($this->namespace . '\\'); + if (0 === strpos($lcName, $namespacePrefix)) { + return new Name(substr($name, strlen($namespacePrefix))); + } + + return null; + } + + private function normalizeConstName(string $name): string { + $nsSep = strrpos($name, '\\'); + if (false === $nsSep) { + return $name; + } + + // Constants have case-insensitive namespace and case-sensitive short-name + $ns = substr($name, 0, $nsSep); + $shortName = substr($name, $nsSep + 1); + return strtolower($ns) . '\\' . $shortName; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node.php b/vendor/nikic/php-parser/lib/PhpParser/Node.php new file mode 100644 index 00000000..fd2a9b72 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node.php @@ -0,0 +1,150 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +interface Node { + /** + * Gets the type of the node. + * + * @psalm-return non-empty-string + * @return string Type of the node + */ + public function getType(): string; + + /** + * Gets the names of the sub nodes. + * + * @return string[] Names of sub nodes + */ + public function getSubNodeNames(): array; + + /** + * Gets line the node started in (alias of getStartLine). + * + * @return int Start line (or -1 if not available) + * @phpstan-return -1|positive-int + * + * @deprecated Use getStartLine() instead + */ + public function getLine(): int; + + /** + * Gets line the node started in. + * + * Requires the 'startLine' attribute to be enabled in the lexer (enabled by default). + * + * @return int Start line (or -1 if not available) + * @phpstan-return -1|positive-int + */ + public function getStartLine(): int; + + /** + * Gets the line the node ended in. + * + * Requires the 'endLine' attribute to be enabled in the lexer (enabled by default). + * + * @return int End line (or -1 if not available) + * @phpstan-return -1|positive-int + */ + public function getEndLine(): int; + + /** + * Gets the token offset of the first token that is part of this node. + * + * The offset is an index into the array returned by Lexer::getTokens(). + * + * Requires the 'startTokenPos' attribute to be enabled in the lexer (DISABLED by default). + * + * @return int Token start position (or -1 if not available) + */ + public function getStartTokenPos(): int; + + /** + * Gets the token offset of the last token that is part of this node. + * + * The offset is an index into the array returned by Lexer::getTokens(). + * + * Requires the 'endTokenPos' attribute to be enabled in the lexer (DISABLED by default). + * + * @return int Token end position (or -1 if not available) + */ + public function getEndTokenPos(): int; + + /** + * Gets the file offset of the first character that is part of this node. + * + * Requires the 'startFilePos' attribute to be enabled in the lexer (DISABLED by default). + * + * @return int File start position (or -1 if not available) + */ + public function getStartFilePos(): int; + + /** + * Gets the file offset of the last character that is part of this node. + * + * Requires the 'endFilePos' attribute to be enabled in the lexer (DISABLED by default). + * + * @return int File end position (or -1 if not available) + */ + public function getEndFilePos(): int; + + /** + * Gets all comments directly preceding this node. + * + * The comments are also available through the "comments" attribute. + * + * @return Comment[] + */ + public function getComments(): array; + + /** + * Gets the doc comment of the node. + * + * @return null|Comment\Doc Doc comment object or null + */ + public function getDocComment(): ?Comment\Doc; + + /** + * Sets the doc comment of the node. + * + * This will either replace an existing doc comment or add it to the comments array. + * + * @param Comment\Doc $docComment Doc comment to set + */ + public function setDocComment(Comment\Doc $docComment): void; + + /** + * Sets an attribute on a node. + * + * @param mixed $value + */ + public function setAttribute(string $key, $value): void; + + /** + * Returns whether an attribute exists. + */ + public function hasAttribute(string $key): bool; + + /** + * Returns the value of an attribute. + * + * @param mixed $default + * + * @return mixed + */ + public function getAttribute(string $key, $default = null); + + /** + * Returns all the attributes of this node. + * + * @return array<string, mixed> + */ + public function getAttributes(): array; + + /** + * Replaces all the attributes of this node. + * + * @param array<string, mixed> $attributes + */ + public function setAttributes(array $attributes): void; +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Arg.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Arg.php new file mode 100644 index 00000000..6680efac --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Arg.php @@ -0,0 +1,44 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +use PhpParser\NodeAbstract; + +class Arg extends NodeAbstract { + /** @var Identifier|null Parameter name (for named parameters) */ + public ?Identifier $name; + /** @var Expr Value to pass */ + public Expr $value; + /** @var bool Whether to pass by ref */ + public bool $byRef; + /** @var bool Whether to unpack the argument */ + public bool $unpack; + + /** + * Constructs a function call argument node. + * + * @param Expr $value Value to pass + * @param bool $byRef Whether to pass by ref + * @param bool $unpack Whether to unpack the argument + * @param array<string, mixed> $attributes Additional attributes + * @param Identifier|null $name Parameter name (for named parameters) + */ + public function __construct( + Expr $value, bool $byRef = false, bool $unpack = false, array $attributes = [], + ?Identifier $name = null + ) { + $this->attributes = $attributes; + $this->name = $name; + $this->value = $value; + $this->byRef = $byRef; + $this->unpack = $unpack; + } + + public function getSubNodeNames(): array { + return ['name', 'value', 'byRef', 'unpack']; + } + + public function getType(): string { + return 'Arg'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/ArrayItem.php b/vendor/nikic/php-parser/lib/PhpParser/Node/ArrayItem.php new file mode 100644 index 00000000..fa1cff52 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/ArrayItem.php @@ -0,0 +1,43 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +use PhpParser\NodeAbstract; + +class ArrayItem extends NodeAbstract { + /** @var null|Expr Key */ + public ?Expr $key; + /** @var Expr Value */ + public Expr $value; + /** @var bool Whether to assign by reference */ + public bool $byRef; + /** @var bool Whether to unpack the argument */ + public bool $unpack; + + /** + * Constructs an array item node. + * + * @param Expr $value Value + * @param null|Expr $key Key + * @param bool $byRef Whether to assign by reference + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $value, ?Expr $key = null, bool $byRef = false, array $attributes = [], bool $unpack = false) { + $this->attributes = $attributes; + $this->key = $key; + $this->value = $value; + $this->byRef = $byRef; + $this->unpack = $unpack; + } + + public function getSubNodeNames(): array { + return ['key', 'value', 'byRef', 'unpack']; + } + + public function getType(): string { + return 'ArrayItem'; + } +} + +// @deprecated compatibility alias +class_alias(ArrayItem::class, Expr\ArrayItem::class); diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Attribute.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Attribute.php new file mode 100644 index 00000000..9d892436 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Attribute.php @@ -0,0 +1,33 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +use PhpParser\Node; +use PhpParser\NodeAbstract; + +class Attribute extends NodeAbstract { + /** @var Name Attribute name */ + public Name $name; + + /** @var list<Arg> Attribute arguments */ + public array $args; + + /** + * @param Node\Name $name Attribute name + * @param list<Arg> $args Attribute arguments + * @param array<string, mixed> $attributes Additional node attributes + */ + public function __construct(Name $name, array $args = [], array $attributes = []) { + $this->attributes = $attributes; + $this->name = $name; + $this->args = $args; + } + + public function getSubNodeNames(): array { + return ['name', 'args']; + } + + public function getType(): string { + return 'Attribute'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/AttributeGroup.php b/vendor/nikic/php-parser/lib/PhpParser/Node/AttributeGroup.php new file mode 100644 index 00000000..b9eb588d --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/AttributeGroup.php @@ -0,0 +1,27 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +use PhpParser\NodeAbstract; + +class AttributeGroup extends NodeAbstract { + /** @var Attribute[] Attributes */ + public array $attrs; + + /** + * @param Attribute[] $attrs PHP attributes + * @param array<string, mixed> $attributes Additional node attributes + */ + public function __construct(array $attrs, array $attributes = []) { + $this->attributes = $attributes; + $this->attrs = $attrs; + } + + public function getSubNodeNames(): array { + return ['attrs']; + } + + public function getType(): string { + return 'AttributeGroup'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/ClosureUse.php b/vendor/nikic/php-parser/lib/PhpParser/Node/ClosureUse.php new file mode 100644 index 00000000..e313280b --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/ClosureUse.php @@ -0,0 +1,36 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +use PhpParser\NodeAbstract; + +class ClosureUse extends NodeAbstract { + /** @var Expr\Variable Variable to use */ + public Expr\Variable $var; + /** @var bool Whether to use by reference */ + public bool $byRef; + + /** + * Constructs a closure use node. + * + * @param Expr\Variable $var Variable to use + * @param bool $byRef Whether to use by reference + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr\Variable $var, bool $byRef = false, array $attributes = []) { + $this->attributes = $attributes; + $this->var = $var; + $this->byRef = $byRef; + } + + public function getSubNodeNames(): array { + return ['var', 'byRef']; + } + + public function getType(): string { + return 'ClosureUse'; + } +} + +// @deprecated compatibility alias +class_alias(ClosureUse::class, Expr\ClosureUse::class); diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/ComplexType.php b/vendor/nikic/php-parser/lib/PhpParser/Node/ComplexType.php new file mode 100644 index 00000000..05a5e5ee --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/ComplexType.php @@ -0,0 +1,13 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +use PhpParser\NodeAbstract; + +/** + * This is a base class for complex types, including nullable types and union types. + * + * It does not provide any shared behavior and exists only for type-checking purposes. + */ +abstract class ComplexType extends NodeAbstract { +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Const_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Const_.php new file mode 100644 index 00000000..8b26ae86 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Const_.php @@ -0,0 +1,36 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +use PhpParser\NodeAbstract; + +class Const_ extends NodeAbstract { + /** @var Identifier Name */ + public Identifier $name; + /** @var Expr Value */ + public Expr $value; + + /** @var Name|null Namespaced name (if using NameResolver) */ + public ?Name $namespacedName; + + /** + * Constructs a const node for use in class const and const statements. + * + * @param string|Identifier $name Name + * @param Expr $value Value + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct($name, Expr $value, array $attributes = []) { + $this->attributes = $attributes; + $this->name = \is_string($name) ? new Identifier($name) : $name; + $this->value = $value; + } + + public function getSubNodeNames(): array { + return ['name', 'value']; + } + + public function getType(): string { + return 'Const'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/DeclareItem.php b/vendor/nikic/php-parser/lib/PhpParser/Node/DeclareItem.php new file mode 100644 index 00000000..55c1fe4f --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/DeclareItem.php @@ -0,0 +1,37 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +use PhpParser\Node; +use PhpParser\NodeAbstract; + +class DeclareItem extends NodeAbstract { + /** @var Node\Identifier Key */ + public Identifier $key; + /** @var Node\Expr Value */ + public Expr $value; + + /** + * Constructs a declare key=>value pair node. + * + * @param string|Node\Identifier $key Key + * @param Node\Expr $value Value + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct($key, Node\Expr $value, array $attributes = []) { + $this->attributes = $attributes; + $this->key = \is_string($key) ? new Node\Identifier($key) : $key; + $this->value = $value; + } + + public function getSubNodeNames(): array { + return ['key', 'value']; + } + + public function getType(): string { + return 'DeclareItem'; + } +} + +// @deprecated compatibility alias +class_alias(DeclareItem::class, Stmt\DeclareDeclare::class); diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr.php new file mode 100644 index 00000000..8b7dbb6c --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr.php @@ -0,0 +1,8 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +use PhpParser\NodeAbstract; + +abstract class Expr extends NodeAbstract { +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php new file mode 100644 index 00000000..24427bbc --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php @@ -0,0 +1,33 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +class ArrayDimFetch extends Expr { + /** @var Expr Variable */ + public Expr $var; + /** @var null|Expr Array index / dim */ + public ?Expr $dim; + + /** + * Constructs an array index fetch node. + * + * @param Expr $var Variable + * @param null|Expr $dim Array index / dim + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $var, ?Expr $dim = null, array $attributes = []) { + $this->attributes = $attributes; + $this->var = $var; + $this->dim = $dim; + } + + public function getSubNodeNames(): array { + return ['var', 'dim']; + } + + public function getType(): string { + return 'Expr_ArrayDimFetch'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php new file mode 100644 index 00000000..490ac937 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php @@ -0,0 +1,3 @@ +<?php declare(strict_types=1); + +require __DIR__ . '/../ArrayItem.php'; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php new file mode 100644 index 00000000..3c8c9c2f --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php @@ -0,0 +1,34 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\ArrayItem; +use PhpParser\Node\Expr; + +class Array_ extends Expr { + // For use in "kind" attribute + public const KIND_LONG = 1; // array() syntax + public const KIND_SHORT = 2; // [] syntax + + /** @var ArrayItem[] Items */ + public array $items; + + /** + * Constructs an array node. + * + * @param ArrayItem[] $items Items of the array + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $items = [], array $attributes = []) { + $this->attributes = $attributes; + $this->items = $items; + } + + public function getSubNodeNames(): array { + return ['items']; + } + + public function getType(): string { + return 'Expr_Array'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php new file mode 100644 index 00000000..0e98ce9f --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php @@ -0,0 +1,84 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node; +use PhpParser\Node\Expr; +use PhpParser\Node\FunctionLike; + +class ArrowFunction extends Expr implements FunctionLike { + /** @var bool Whether the closure is static */ + public bool $static; + + /** @var bool Whether to return by reference */ + public bool $byRef; + + /** @var Node\Param[] */ + public array $params = []; + + /** @var null|Node\Identifier|Node\Name|Node\ComplexType */ + public ?Node $returnType; + + /** @var Expr Expression body */ + public Expr $expr; + /** @var Node\AttributeGroup[] */ + public array $attrGroups; + + /** + * @param array{ + * expr: Expr, + * static?: bool, + * byRef?: bool, + * params?: Node\Param[], + * returnType?: null|Node\Identifier|Node\Name|Node\ComplexType, + * attrGroups?: Node\AttributeGroup[] + * } $subNodes Array of the following subnodes: + * 'expr' : Expression body + * 'static' => false : Whether the closure is static + * 'byRef' => false : Whether to return by reference + * 'params' => array() : Parameters + * 'returnType' => null : Return type + * 'attrGroups' => array() : PHP attribute groups + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $subNodes, array $attributes = []) { + $this->attributes = $attributes; + $this->static = $subNodes['static'] ?? false; + $this->byRef = $subNodes['byRef'] ?? false; + $this->params = $subNodes['params'] ?? []; + $this->returnType = $subNodes['returnType'] ?? null; + $this->expr = $subNodes['expr']; + $this->attrGroups = $subNodes['attrGroups'] ?? []; + } + + public function getSubNodeNames(): array { + return ['attrGroups', 'static', 'byRef', 'params', 'returnType', 'expr']; + } + + public function returnsByRef(): bool { + return $this->byRef; + } + + public function getParams(): array { + return $this->params; + } + + public function getReturnType() { + return $this->returnType; + } + + public function getAttrGroups(): array { + return $this->attrGroups; + } + + /** + * @return Node\Stmt\Return_[] + */ + public function getStmts(): array { + return [new Node\Stmt\Return_($this->expr)]; + } + + public function getType(): string { + return 'Expr_ArrowFunction'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php new file mode 100644 index 00000000..dcbf84dd --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php @@ -0,0 +1,33 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +class Assign extends Expr { + /** @var Expr Variable */ + public Expr $var; + /** @var Expr Expression */ + public Expr $expr; + + /** + * Constructs an assignment node. + * + * @param Expr $var Variable + * @param Expr $expr Expression + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $var, Expr $expr, array $attributes = []) { + $this->attributes = $attributes; + $this->var = $var; + $this->expr = $expr; + } + + public function getSubNodeNames(): array { + return ['var', 'expr']; + } + + public function getType(): string { + return 'Expr_Assign'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php new file mode 100644 index 00000000..5209a64b --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +abstract class AssignOp extends Expr { + /** @var Expr Variable */ + public Expr $var; + /** @var Expr Expression */ + public Expr $expr; + + /** + * Constructs a compound assignment operation node. + * + * @param Expr $var Variable + * @param Expr $expr Expression + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $var, Expr $expr, array $attributes = []) { + $this->attributes = $attributes; + $this->var = $var; + $this->expr = $expr; + } + + public function getSubNodeNames(): array { + return ['var', 'expr']; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php new file mode 100644 index 00000000..4f3623fb --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php @@ -0,0 +1,11 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\AssignOp; + +use PhpParser\Node\Expr\AssignOp; + +class BitwiseAnd extends AssignOp { + public function getType(): string { + return 'Expr_AssignOp_BitwiseAnd'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseOr.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseOr.php new file mode 100644 index 00000000..23efe107 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseOr.php @@ -0,0 +1,11 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\AssignOp; + +use PhpParser\Node\Expr\AssignOp; + +class BitwiseOr extends AssignOp { + public function getType(): string { + return 'Expr_AssignOp_BitwiseOr'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseXor.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseXor.php new file mode 100644 index 00000000..24be7303 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseXor.php @@ -0,0 +1,11 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\AssignOp; + +use PhpParser\Node\Expr\AssignOp; + +class BitwiseXor extends AssignOp { + public function getType(): string { + return 'Expr_AssignOp_BitwiseXor'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Coalesce.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Coalesce.php new file mode 100644 index 00000000..b78ea901 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Coalesce.php @@ -0,0 +1,11 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\AssignOp; + +use PhpParser\Node\Expr\AssignOp; + +class Coalesce extends AssignOp { + public function getType(): string { + return 'Expr_AssignOp_Coalesce'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Concat.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Concat.php new file mode 100644 index 00000000..f419e2ea --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Concat.php @@ -0,0 +1,11 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\AssignOp; + +use PhpParser\Node\Expr\AssignOp; + +class Concat extends AssignOp { + public function getType(): string { + return 'Expr_AssignOp_Concat'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Div.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Div.php new file mode 100644 index 00000000..98b04727 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Div.php @@ -0,0 +1,11 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\AssignOp; + +use PhpParser\Node\Expr\AssignOp; + +class Div extends AssignOp { + public function getType(): string { + return 'Expr_AssignOp_Div'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Minus.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Minus.php new file mode 100644 index 00000000..20765993 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Minus.php @@ -0,0 +1,11 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\AssignOp; + +use PhpParser\Node\Expr\AssignOp; + +class Minus extends AssignOp { + public function getType(): string { + return 'Expr_AssignOp_Minus'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mod.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mod.php new file mode 100644 index 00000000..526430e2 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mod.php @@ -0,0 +1,11 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\AssignOp; + +use PhpParser\Node\Expr\AssignOp; + +class Mod extends AssignOp { + public function getType(): string { + return 'Expr_AssignOp_Mod'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mul.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mul.php new file mode 100644 index 00000000..81241ac9 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mul.php @@ -0,0 +1,11 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\AssignOp; + +use PhpParser\Node\Expr\AssignOp; + +class Mul extends AssignOp { + public function getType(): string { + return 'Expr_AssignOp_Mul'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Plus.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Plus.php new file mode 100644 index 00000000..0bca8cc1 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Plus.php @@ -0,0 +1,11 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\AssignOp; + +use PhpParser\Node\Expr\AssignOp; + +class Plus extends AssignOp { + public function getType(): string { + return 'Expr_AssignOp_Plus'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Pow.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Pow.php new file mode 100644 index 00000000..4e3279c4 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Pow.php @@ -0,0 +1,11 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\AssignOp; + +use PhpParser\Node\Expr\AssignOp; + +class Pow extends AssignOp { + public function getType(): string { + return 'Expr_AssignOp_Pow'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftLeft.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftLeft.php new file mode 100644 index 00000000..7a5dd60c --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftLeft.php @@ -0,0 +1,11 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\AssignOp; + +use PhpParser\Node\Expr\AssignOp; + +class ShiftLeft extends AssignOp { + public function getType(): string { + return 'Expr_AssignOp_ShiftLeft'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftRight.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftRight.php new file mode 100644 index 00000000..4f270864 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftRight.php @@ -0,0 +1,11 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\AssignOp; + +use PhpParser\Node\Expr\AssignOp; + +class ShiftRight extends AssignOp { + public function getType(): string { + return 'Expr_AssignOp_ShiftRight'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignRef.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignRef.php new file mode 100644 index 00000000..9714650a --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignRef.php @@ -0,0 +1,33 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +class AssignRef extends Expr { + /** @var Expr Variable reference is assigned to */ + public Expr $var; + /** @var Expr Variable which is referenced */ + public Expr $expr; + + /** + * Constructs an assignment node. + * + * @param Expr $var Variable + * @param Expr $expr Expression + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $var, Expr $expr, array $attributes = []) { + $this->attributes = $attributes; + $this->var = $var; + $this->expr = $expr; + } + + public function getSubNodeNames(): array { + return ['var', 'expr']; + } + + public function getType(): string { + return 'Expr_AssignRef'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php new file mode 100644 index 00000000..1b92bd4f --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php @@ -0,0 +1,37 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +abstract class BinaryOp extends Expr { + /** @var Expr The left hand side expression */ + public Expr $left; + /** @var Expr The right hand side expression */ + public Expr $right; + + /** + * Constructs a binary operator node. + * + * @param Expr $left The left hand side expression + * @param Expr $right The right hand side expression + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $left, Expr $right, array $attributes = []) { + $this->attributes = $attributes; + $this->left = $left; + $this->right = $right; + } + + public function getSubNodeNames(): array { + return ['left', 'right']; + } + + /** + * Get the operator sigil for this binary operation. + * + * In the case there are multiple possible sigils for an operator, this method does not + * necessarily return the one used in the parsed code. + */ + abstract public function getOperatorSigil(): string; +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php new file mode 100644 index 00000000..5930c541 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class BitwiseAnd extends BinaryOp { + public function getOperatorSigil(): string { + return '&'; + } + + public function getType(): string { + return 'Expr_BinaryOp_BitwiseAnd'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseOr.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseOr.php new file mode 100644 index 00000000..adcefd0e --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseOr.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class BitwiseOr extends BinaryOp { + public function getOperatorSigil(): string { + return '|'; + } + + public function getType(): string { + return 'Expr_BinaryOp_BitwiseOr'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseXor.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseXor.php new file mode 100644 index 00000000..92bca609 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseXor.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class BitwiseXor extends BinaryOp { + public function getOperatorSigil(): string { + return '^'; + } + + public function getType(): string { + return 'Expr_BinaryOp_BitwiseXor'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanAnd.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanAnd.php new file mode 100644 index 00000000..82a6b5a2 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanAnd.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class BooleanAnd extends BinaryOp { + public function getOperatorSigil(): string { + return '&&'; + } + + public function getType(): string { + return 'Expr_BinaryOp_BooleanAnd'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanOr.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanOr.php new file mode 100644 index 00000000..739edafa --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanOr.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class BooleanOr extends BinaryOp { + public function getOperatorSigil(): string { + return '||'; + } + + public function getType(): string { + return 'Expr_BinaryOp_BooleanOr'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Coalesce.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Coalesce.php new file mode 100644 index 00000000..ab75a23e --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Coalesce.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class Coalesce extends BinaryOp { + public function getOperatorSigil(): string { + return '??'; + } + + public function getType(): string { + return 'Expr_BinaryOp_Coalesce'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Concat.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Concat.php new file mode 100644 index 00000000..a730f576 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Concat.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class Concat extends BinaryOp { + public function getOperatorSigil(): string { + return '.'; + } + + public function getType(): string { + return 'Expr_BinaryOp_Concat'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Div.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Div.php new file mode 100644 index 00000000..ba1f629d --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Div.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class Div extends BinaryOp { + public function getOperatorSigil(): string { + return '/'; + } + + public function getType(): string { + return 'Expr_BinaryOp_Div'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Equal.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Equal.php new file mode 100644 index 00000000..28bde812 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Equal.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class Equal extends BinaryOp { + public function getOperatorSigil(): string { + return '=='; + } + + public function getType(): string { + return 'Expr_BinaryOp_Equal'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Greater.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Greater.php new file mode 100644 index 00000000..6215c50b --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Greater.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class Greater extends BinaryOp { + public function getOperatorSigil(): string { + return '>'; + } + + public function getType(): string { + return 'Expr_BinaryOp_Greater'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php new file mode 100644 index 00000000..4d440b10 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class GreaterOrEqual extends BinaryOp { + public function getOperatorSigil(): string { + return '>='; + } + + public function getType(): string { + return 'Expr_BinaryOp_GreaterOrEqual'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Identical.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Identical.php new file mode 100644 index 00000000..e25d17cd --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Identical.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class Identical extends BinaryOp { + public function getOperatorSigil(): string { + return '==='; + } + + public function getType(): string { + return 'Expr_BinaryOp_Identical'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalAnd.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalAnd.php new file mode 100644 index 00000000..9b9ea1f6 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalAnd.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class LogicalAnd extends BinaryOp { + public function getOperatorSigil(): string { + return 'and'; + } + + public function getType(): string { + return 'Expr_BinaryOp_LogicalAnd'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalOr.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalOr.php new file mode 100644 index 00000000..a6235ee7 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalOr.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class LogicalOr extends BinaryOp { + public function getOperatorSigil(): string { + return 'or'; + } + + public function getType(): string { + return 'Expr_BinaryOp_LogicalOr'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalXor.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalXor.php new file mode 100644 index 00000000..7ff2fdb0 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalXor.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class LogicalXor extends BinaryOp { + public function getOperatorSigil(): string { + return 'xor'; + } + + public function getType(): string { + return 'Expr_BinaryOp_LogicalXor'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Minus.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Minus.php new file mode 100644 index 00000000..8924c55e --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Minus.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class Minus extends BinaryOp { + public function getOperatorSigil(): string { + return '-'; + } + + public function getType(): string { + return 'Expr_BinaryOp_Minus'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mod.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mod.php new file mode 100644 index 00000000..56619de1 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mod.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class Mod extends BinaryOp { + public function getOperatorSigil(): string { + return '%'; + } + + public function getType(): string { + return 'Expr_BinaryOp_Mod'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mul.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mul.php new file mode 100644 index 00000000..98745fbe --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mul.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class Mul extends BinaryOp { + public function getOperatorSigil(): string { + return '*'; + } + + public function getType(): string { + return 'Expr_BinaryOp_Mul'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotEqual.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotEqual.php new file mode 100644 index 00000000..72d03c45 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotEqual.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class NotEqual extends BinaryOp { + public function getOperatorSigil(): string { + return '!='; + } + + public function getType(): string { + return 'Expr_BinaryOp_NotEqual'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotIdentical.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotIdentical.php new file mode 100644 index 00000000..e9befd80 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotIdentical.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class NotIdentical extends BinaryOp { + public function getOperatorSigil(): string { + return '!=='; + } + + public function getType(): string { + return 'Expr_BinaryOp_NotIdentical'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Plus.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Plus.php new file mode 100644 index 00000000..fe34b84c --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Plus.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class Plus extends BinaryOp { + public function getOperatorSigil(): string { + return '+'; + } + + public function getType(): string { + return 'Expr_BinaryOp_Plus'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Pow.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Pow.php new file mode 100644 index 00000000..e4e641cb --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Pow.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class Pow extends BinaryOp { + public function getOperatorSigil(): string { + return '**'; + } + + public function getType(): string { + return 'Expr_BinaryOp_Pow'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftLeft.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftLeft.php new file mode 100644 index 00000000..22c6260f --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftLeft.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class ShiftLeft extends BinaryOp { + public function getOperatorSigil(): string { + return '<<'; + } + + public function getType(): string { + return 'Expr_BinaryOp_ShiftLeft'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftRight.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftRight.php new file mode 100644 index 00000000..cd42644a --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftRight.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class ShiftRight extends BinaryOp { + public function getOperatorSigil(): string { + return '>>'; + } + + public function getType(): string { + return 'Expr_BinaryOp_ShiftRight'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Smaller.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Smaller.php new file mode 100644 index 00000000..01e9b231 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Smaller.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class Smaller extends BinaryOp { + public function getOperatorSigil(): string { + return '<'; + } + + public function getType(): string { + return 'Expr_BinaryOp_Smaller'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.php new file mode 100644 index 00000000..2c88f383 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class SmallerOrEqual extends BinaryOp { + public function getOperatorSigil(): string { + return '<='; + } + + public function getType(): string { + return 'Expr_BinaryOp_SmallerOrEqual'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Spaceship.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Spaceship.php new file mode 100644 index 00000000..974ec7dd --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Spaceship.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\BinaryOp; + +use PhpParser\Node\Expr\BinaryOp; + +class Spaceship extends BinaryOp { + public function getOperatorSigil(): string { + return '<=>'; + } + + public function getType(): string { + return 'Expr_BinaryOp_Spaceship'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php new file mode 100644 index 00000000..b7175a7a --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +class BitwiseNot extends Expr { + /** @var Expr Expression */ + public Expr $expr; + + /** + * Constructs a bitwise not node. + * + * @param Expr $expr Expression + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $expr, array $attributes = []) { + $this->attributes = $attributes; + $this->expr = $expr; + } + + public function getSubNodeNames(): array { + return ['expr']; + } + + public function getType(): string { + return 'Expr_BitwiseNot'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php new file mode 100644 index 00000000..c66d2332 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +class BooleanNot extends Expr { + /** @var Expr Expression */ + public Expr $expr; + + /** + * Constructs a boolean not node. + * + * @param Expr $expr Expression + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $expr, array $attributes = []) { + $this->attributes = $attributes; + $this->expr = $expr; + } + + public function getSubNodeNames(): array { + return ['expr']; + } + + public function getType(): string { + return 'Expr_BooleanNot'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/CallLike.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/CallLike.php new file mode 100644 index 00000000..2af2245b --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/CallLike.php @@ -0,0 +1,35 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Arg; +use PhpParser\Node\Expr; +use PhpParser\Node\VariadicPlaceholder; + +abstract class CallLike extends Expr { + /** + * Return raw arguments, which may be actual Args, or VariadicPlaceholders for first-class + * callables. + * + * @return array<Arg|VariadicPlaceholder> + */ + abstract public function getRawArgs(): array; + + /** + * Returns whether this call expression is actually a first class callable. + */ + public function isFirstClassCallable(): bool { + $rawArgs = $this->getRawArgs(); + return count($rawArgs) === 1 && current($rawArgs) instanceof VariadicPlaceholder; + } + + /** + * Assert that this is not a first-class callable and return only ordinary Args. + * + * @return Arg[] + */ + public function getArgs(): array { + assert(!$this->isFirstClassCallable()); + return $this->getRawArgs(); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php new file mode 100644 index 00000000..c2751de4 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php @@ -0,0 +1,25 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +abstract class Cast extends Expr { + /** @var Expr Expression */ + public Expr $expr; + + /** + * Constructs a cast node. + * + * @param Expr $expr Expression + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $expr, array $attributes = []) { + $this->attributes = $attributes; + $this->expr = $expr; + } + + public function getSubNodeNames(): array { + return ['expr']; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Array_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Array_.php new file mode 100644 index 00000000..471cb824 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Array_.php @@ -0,0 +1,11 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\Cast; + +use PhpParser\Node\Expr\Cast; + +class Array_ extends Cast { + public function getType(): string { + return 'Expr_Cast_Array'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Bool_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Bool_.php new file mode 100644 index 00000000..3aed497c --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Bool_.php @@ -0,0 +1,11 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\Cast; + +use PhpParser\Node\Expr\Cast; + +class Bool_ extends Cast { + public function getType(): string { + return 'Expr_Cast_Bool'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Double.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Double.php new file mode 100644 index 00000000..e7f5cd9b --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Double.php @@ -0,0 +1,16 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\Cast; + +use PhpParser\Node\Expr\Cast; + +class Double extends Cast { + // For use in "kind" attribute + public const KIND_DOUBLE = 1; // "double" syntax + public const KIND_FLOAT = 2; // "float" syntax + public const KIND_REAL = 3; // "real" syntax + + public function getType(): string { + return 'Expr_Cast_Double'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Int_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Int_.php new file mode 100644 index 00000000..20744b9b --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Int_.php @@ -0,0 +1,11 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\Cast; + +use PhpParser\Node\Expr\Cast; + +class Int_ extends Cast { + public function getType(): string { + return 'Expr_Cast_Int'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Object_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Object_.php new file mode 100644 index 00000000..dffa9e54 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Object_.php @@ -0,0 +1,11 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\Cast; + +use PhpParser\Node\Expr\Cast; + +class Object_ extends Cast { + public function getType(): string { + return 'Expr_Cast_Object'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/String_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/String_.php new file mode 100644 index 00000000..c7605ab8 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/String_.php @@ -0,0 +1,11 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\Cast; + +use PhpParser\Node\Expr\Cast; + +class String_ extends Cast { + public function getType(): string { + return 'Expr_Cast_String'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Unset_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Unset_.php new file mode 100644 index 00000000..cb709a43 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Unset_.php @@ -0,0 +1,11 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr\Cast; + +use PhpParser\Node\Expr\Cast; + +class Unset_ extends Cast { + public function getType(): string { + return 'Expr_Cast_Unset'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php new file mode 100644 index 00000000..7fdd40e4 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php @@ -0,0 +1,36 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node; +use PhpParser\Node\Expr; +use PhpParser\Node\Identifier; +use PhpParser\Node\Name; + +class ClassConstFetch extends Expr { + /** @var Name|Expr Class name */ + public Node $class; + /** @var Identifier|Expr|Error Constant name */ + public Node $name; + + /** + * Constructs a class const fetch node. + * + * @param Name|Expr $class Class name + * @param string|Identifier|Expr|Error $name Constant name + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Node $class, $name, array $attributes = []) { + $this->attributes = $attributes; + $this->class = $class; + $this->name = \is_string($name) ? new Identifier($name) : $name; + } + + public function getSubNodeNames(): array { + return ['class', 'name']; + } + + public function getType(): string { + return 'Expr_ClassConstFetch'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php new file mode 100644 index 00000000..d85bc9ab --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +class Clone_ extends Expr { + /** @var Expr Expression */ + public Expr $expr; + + /** + * Constructs a clone node. + * + * @param Expr $expr Expression + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $expr, array $attributes = []) { + $this->attributes = $attributes; + $this->expr = $expr; + } + + public function getSubNodeNames(): array { + return ['expr']; + } + + public function getType(): string { + return 'Expr_Clone'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php new file mode 100644 index 00000000..0680446f --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php @@ -0,0 +1,86 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node; +use PhpParser\Node\ClosureUse; +use PhpParser\Node\Expr; +use PhpParser\Node\FunctionLike; + +class Closure extends Expr implements FunctionLike { + /** @var bool Whether the closure is static */ + public bool $static; + /** @var bool Whether to return by reference */ + public bool $byRef; + /** @var Node\Param[] Parameters */ + public array $params; + /** @var ClosureUse[] use()s */ + public array $uses; + /** @var null|Node\Identifier|Node\Name|Node\ComplexType Return type */ + public ?Node $returnType; + /** @var Node\Stmt[] Statements */ + public array $stmts; + /** @var Node\AttributeGroup[] PHP attribute groups */ + public array $attrGroups; + + /** + * Constructs a lambda function node. + * + * @param array{ + * static?: bool, + * byRef?: bool, + * params?: Node\Param[], + * uses?: ClosureUse[], + * returnType?: null|Node\Identifier|Node\Name|Node\ComplexType, + * stmts?: Node\Stmt[], + * attrGroups?: Node\AttributeGroup[], + * } $subNodes Array of the following optional subnodes: + * 'static' => false : Whether the closure is static + * 'byRef' => false : Whether to return by reference + * 'params' => array(): Parameters + * 'uses' => array(): use()s + * 'returnType' => null : Return type + * 'stmts' => array(): Statements + * 'attrGroups' => array(): PHP attributes groups + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $subNodes = [], array $attributes = []) { + $this->attributes = $attributes; + $this->static = $subNodes['static'] ?? false; + $this->byRef = $subNodes['byRef'] ?? false; + $this->params = $subNodes['params'] ?? []; + $this->uses = $subNodes['uses'] ?? []; + $this->returnType = $subNodes['returnType'] ?? null; + $this->stmts = $subNodes['stmts'] ?? []; + $this->attrGroups = $subNodes['attrGroups'] ?? []; + } + + public function getSubNodeNames(): array { + return ['attrGroups', 'static', 'byRef', 'params', 'uses', 'returnType', 'stmts']; + } + + public function returnsByRef(): bool { + return $this->byRef; + } + + public function getParams(): array { + return $this->params; + } + + public function getReturnType() { + return $this->returnType; + } + + /** @return Node\Stmt[] */ + public function getStmts(): array { + return $this->stmts; + } + + public function getAttrGroups(): array { + return $this->attrGroups; + } + + public function getType(): string { + return 'Expr_Closure'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php new file mode 100644 index 00000000..681ff317 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php @@ -0,0 +1,3 @@ +<?php declare(strict_types=1); + +require __DIR__ . '/../ClosureUse.php'; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php new file mode 100644 index 00000000..47191c5f --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php @@ -0,0 +1,30 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; +use PhpParser\Node\Name; + +class ConstFetch extends Expr { + /** @var Name Constant name */ + public Name $name; + + /** + * Constructs a const fetch node. + * + * @param Name $name Constant name + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Name $name, array $attributes = []) { + $this->attributes = $attributes; + $this->name = $name; + } + + public function getSubNodeNames(): array { + return ['name']; + } + + public function getType(): string { + return 'Expr_ConstFetch'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php new file mode 100644 index 00000000..d2f30506 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +class Empty_ extends Expr { + /** @var Expr Expression */ + public Expr $expr; + + /** + * Constructs an empty() node. + * + * @param Expr $expr Expression + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $expr, array $attributes = []) { + $this->attributes = $attributes; + $this->expr = $expr; + } + + public function getSubNodeNames(): array { + return ['expr']; + } + + public function getType(): string { + return 'Expr_Empty'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Error.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Error.php new file mode 100644 index 00000000..43010ac4 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Error.php @@ -0,0 +1,30 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +/** + * Error node used during parsing with error recovery. + * + * An error node may be placed at a position where an expression is required, but an error occurred. + * Error nodes will not be present if the parser is run in throwOnError mode (the default). + */ +class Error extends Expr { + /** + * Constructs an error node. + * + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $attributes = []) { + $this->attributes = $attributes; + } + + public function getSubNodeNames(): array { + return []; + } + + public function getType(): string { + return 'Expr_Error'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php new file mode 100644 index 00000000..32625a23 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +class ErrorSuppress extends Expr { + /** @var Expr Expression */ + public Expr $expr; + + /** + * Constructs an error suppress node. + * + * @param Expr $expr Expression + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $expr, array $attributes = []) { + $this->attributes = $attributes; + $this->expr = $expr; + } + + public function getSubNodeNames(): array { + return ['expr']; + } + + public function getType(): string { + return 'Expr_ErrorSuppress'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php new file mode 100644 index 00000000..5120b1b4 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +class Eval_ extends Expr { + /** @var Expr Expression */ + public Expr $expr; + + /** + * Constructs an eval() node. + * + * @param Expr $expr Expression + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $expr, array $attributes = []) { + $this->attributes = $attributes; + $this->expr = $expr; + } + + public function getSubNodeNames(): array { + return ['expr']; + } + + public function getType(): string { + return 'Expr_Eval'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php new file mode 100644 index 00000000..cf002466 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php @@ -0,0 +1,33 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +class Exit_ extends Expr { + /* For use in "kind" attribute */ + public const KIND_EXIT = 1; + public const KIND_DIE = 2; + + /** @var null|Expr Expression */ + public ?Expr $expr; + + /** + * Constructs an exit() node. + * + * @param null|Expr $expr Expression + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(?Expr $expr = null, array $attributes = []) { + $this->attributes = $attributes; + $this->expr = $expr; + } + + public function getSubNodeNames(): array { + return ['expr']; + } + + public function getType(): string { + return 'Expr_Exit'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php new file mode 100644 index 00000000..0b85840d --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php @@ -0,0 +1,38 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node; +use PhpParser\Node\Expr; + +class FuncCall extends CallLike { + /** @var Node\Name|Expr Function name */ + public Node $name; + /** @var array<Node\Arg|Node\VariadicPlaceholder> Arguments */ + public array $args; + + /** + * Constructs a function call node. + * + * @param Node\Name|Expr $name Function name + * @param array<Node\Arg|Node\VariadicPlaceholder> $args Arguments + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Node $name, array $args = [], array $attributes = []) { + $this->attributes = $attributes; + $this->name = $name; + $this->args = $args; + } + + public function getSubNodeNames(): array { + return ['name', 'args']; + } + + public function getType(): string { + return 'Expr_FuncCall'; + } + + public function getRawArgs(): array { + return $this->args; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php new file mode 100644 index 00000000..e1187b19 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php @@ -0,0 +1,38 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +class Include_ extends Expr { + public const TYPE_INCLUDE = 1; + public const TYPE_INCLUDE_ONCE = 2; + public const TYPE_REQUIRE = 3; + public const TYPE_REQUIRE_ONCE = 4; + + /** @var Expr Expression */ + public Expr $expr; + /** @var int Type of include */ + public int $type; + + /** + * Constructs an include node. + * + * @param Expr $expr Expression + * @param int $type Type of include + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $expr, int $type, array $attributes = []) { + $this->attributes = $attributes; + $this->expr = $expr; + $this->type = $type; + } + + public function getSubNodeNames(): array { + return ['expr', 'type']; + } + + public function getType(): string { + return 'Expr_Include'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php new file mode 100644 index 00000000..a2783cb3 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php @@ -0,0 +1,35 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node; +use PhpParser\Node\Expr; +use PhpParser\Node\Name; + +class Instanceof_ extends Expr { + /** @var Expr Expression */ + public Expr $expr; + /** @var Name|Expr Class name */ + public Node $class; + + /** + * Constructs an instanceof check node. + * + * @param Expr $expr Expression + * @param Name|Expr $class Class name + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $expr, Node $class, array $attributes = []) { + $this->attributes = $attributes; + $this->expr = $expr; + $this->class = $class; + } + + public function getSubNodeNames(): array { + return ['expr', 'class']; + } + + public function getType(): string { + return 'Expr_Instanceof'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php new file mode 100644 index 00000000..4f80fff7 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +class Isset_ extends Expr { + /** @var Expr[] Variables */ + public array $vars; + + /** + * Constructs an array node. + * + * @param Expr[] $vars Variables + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $vars, array $attributes = []) { + $this->attributes = $attributes; + $this->vars = $vars; + } + + public function getSubNodeNames(): array { + return ['vars']; + } + + public function getType(): string { + return 'Expr_Isset'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php new file mode 100644 index 00000000..496b7b38 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php @@ -0,0 +1,34 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\ArrayItem; +use PhpParser\Node\Expr; + +class List_ extends Expr { + // For use in "kind" attribute + public const KIND_LIST = 1; // list() syntax + public const KIND_ARRAY = 2; // [] syntax + + /** @var (ArrayItem|null)[] List of items to assign to */ + public array $items; + + /** + * Constructs a list() destructuring node. + * + * @param (ArrayItem|null)[] $items List of items to assign to + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $items, array $attributes = []) { + $this->attributes = $attributes; + $this->items = $items; + } + + public function getSubNodeNames(): array { + return ['items']; + } + + public function getType(): string { + return 'Expr_List'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Match_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Match_.php new file mode 100644 index 00000000..cd028a2d --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Match_.php @@ -0,0 +1,32 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node; +use PhpParser\Node\MatchArm; + +class Match_ extends Node\Expr { + /** @var Node\Expr Condition */ + public Node\Expr $cond; + /** @var MatchArm[] */ + public array $arms; + + /** + * @param Node\Expr $cond Condition + * @param MatchArm[] $arms + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Node\Expr $cond, array $arms = [], array $attributes = []) { + $this->attributes = $attributes; + $this->cond = $cond; + $this->arms = $arms; + } + + public function getSubNodeNames(): array { + return ['cond', 'arms']; + } + + public function getType(): string { + return 'Expr_Match'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php new file mode 100644 index 00000000..2703c75d --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php @@ -0,0 +1,45 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node; +use PhpParser\Node\Arg; +use PhpParser\Node\Expr; +use PhpParser\Node\Identifier; +use PhpParser\Node\VariadicPlaceholder; + +class MethodCall extends CallLike { + /** @var Expr Variable holding object */ + public Expr $var; + /** @var Identifier|Expr Method name */ + public Node $name; + /** @var array<Arg|VariadicPlaceholder> Arguments */ + public array $args; + + /** + * Constructs a function call node. + * + * @param Expr $var Variable holding object + * @param string|Identifier|Expr $name Method name + * @param array<Arg|VariadicPlaceholder> $args Arguments + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $var, $name, array $args = [], array $attributes = []) { + $this->attributes = $attributes; + $this->var = $var; + $this->name = \is_string($name) ? new Identifier($name) : $name; + $this->args = $args; + } + + public function getSubNodeNames(): array { + return ['var', 'name', 'args']; + } + + public function getType(): string { + return 'Expr_MethodCall'; + } + + public function getRawArgs(): array { + return $this->args; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php new file mode 100644 index 00000000..eedaaa1e --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php @@ -0,0 +1,40 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node; +use PhpParser\Node\Arg; +use PhpParser\Node\Expr; +use PhpParser\Node\VariadicPlaceholder; + +class New_ extends CallLike { + /** @var Node\Name|Expr|Node\Stmt\Class_ Class name */ + public Node $class; + /** @var array<Arg|VariadicPlaceholder> Arguments */ + public array $args; + + /** + * Constructs a function call node. + * + * @param Node\Name|Expr|Node\Stmt\Class_ $class Class name (or class node for anonymous classes) + * @param array<Arg|VariadicPlaceholder> $args Arguments + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Node $class, array $args = [], array $attributes = []) { + $this->attributes = $attributes; + $this->class = $class; + $this->args = $args; + } + + public function getSubNodeNames(): array { + return ['class', 'args']; + } + + public function getType(): string { + return 'Expr_New'; + } + + public function getRawArgs(): array { + return $this->args; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafeMethodCall.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafeMethodCall.php new file mode 100644 index 00000000..a151f715 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafeMethodCall.php @@ -0,0 +1,45 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node; +use PhpParser\Node\Arg; +use PhpParser\Node\Expr; +use PhpParser\Node\Identifier; +use PhpParser\Node\VariadicPlaceholder; + +class NullsafeMethodCall extends CallLike { + /** @var Expr Variable holding object */ + public Expr $var; + /** @var Identifier|Expr Method name */ + public Node $name; + /** @var array<Arg|VariadicPlaceholder> Arguments */ + public array $args; + + /** + * Constructs a nullsafe method call node. + * + * @param Expr $var Variable holding object + * @param string|Identifier|Expr $name Method name + * @param array<Arg|VariadicPlaceholder> $args Arguments + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $var, $name, array $args = [], array $attributes = []) { + $this->attributes = $attributes; + $this->var = $var; + $this->name = \is_string($name) ? new Identifier($name) : $name; + $this->args = $args; + } + + public function getSubNodeNames(): array { + return ['var', 'name', 'args']; + } + + public function getType(): string { + return 'Expr_NullsafeMethodCall'; + } + + public function getRawArgs(): array { + return $this->args; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafePropertyFetch.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafePropertyFetch.php new file mode 100644 index 00000000..6f73a16d --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafePropertyFetch.php @@ -0,0 +1,35 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node; +use PhpParser\Node\Expr; +use PhpParser\Node\Identifier; + +class NullsafePropertyFetch extends Expr { + /** @var Expr Variable holding object */ + public Expr $var; + /** @var Identifier|Expr Property name */ + public Node $name; + + /** + * Constructs a nullsafe property fetch node. + * + * @param Expr $var Variable holding object + * @param string|Identifier|Expr $name Property name + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $var, $name, array $attributes = []) { + $this->attributes = $attributes; + $this->var = $var; + $this->name = \is_string($name) ? new Identifier($name) : $name; + } + + public function getSubNodeNames(): array { + return ['var', 'name']; + } + + public function getType(): string { + return 'Expr_NullsafePropertyFetch'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php new file mode 100644 index 00000000..3dca8fdc --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +class PostDec extends Expr { + /** @var Expr Variable */ + public Expr $var; + + /** + * Constructs a post decrement node. + * + * @param Expr $var Variable + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $var, array $attributes = []) { + $this->attributes = $attributes; + $this->var = $var; + } + + public function getSubNodeNames(): array { + return ['var']; + } + + public function getType(): string { + return 'Expr_PostDec'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php new file mode 100644 index 00000000..bc990c30 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +class PostInc extends Expr { + /** @var Expr Variable */ + public Expr $var; + + /** + * Constructs a post increment node. + * + * @param Expr $var Variable + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $var, array $attributes = []) { + $this->attributes = $attributes; + $this->var = $var; + } + + public function getSubNodeNames(): array { + return ['var']; + } + + public function getType(): string { + return 'Expr_PostInc'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php new file mode 100644 index 00000000..2f168730 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +class PreDec extends Expr { + /** @var Expr Variable */ + public Expr $var; + + /** + * Constructs a pre decrement node. + * + * @param Expr $var Variable + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $var, array $attributes = []) { + $this->attributes = $attributes; + $this->var = $var; + } + + public function getSubNodeNames(): array { + return ['var']; + } + + public function getType(): string { + return 'Expr_PreDec'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php new file mode 100644 index 00000000..fd455f55 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +class PreInc extends Expr { + /** @var Expr Variable */ + public Expr $var; + + /** + * Constructs a pre increment node. + * + * @param Expr $var Variable + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $var, array $attributes = []) { + $this->attributes = $attributes; + $this->var = $var; + } + + public function getSubNodeNames(): array { + return ['var']; + } + + public function getType(): string { + return 'Expr_PreInc'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php new file mode 100644 index 00000000..60574760 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +class Print_ extends Expr { + /** @var Expr Expression */ + public Expr $expr; + + /** + * Constructs an print() node. + * + * @param Expr $expr Expression + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $expr, array $attributes = []) { + $this->attributes = $attributes; + $this->expr = $expr; + } + + public function getSubNodeNames(): array { + return ['expr']; + } + + public function getType(): string { + return 'Expr_Print'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php new file mode 100644 index 00000000..8c416a8c --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php @@ -0,0 +1,35 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node; +use PhpParser\Node\Expr; +use PhpParser\Node\Identifier; + +class PropertyFetch extends Expr { + /** @var Expr Variable holding object */ + public Expr $var; + /** @var Identifier|Expr Property name */ + public Node $name; + + /** + * Constructs a function call node. + * + * @param Expr $var Variable holding object + * @param string|Identifier|Expr $name Property name + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $var, $name, array $attributes = []) { + $this->attributes = $attributes; + $this->var = $var; + $this->name = \is_string($name) ? new Identifier($name) : $name; + } + + public function getSubNodeNames(): array { + return ['var', 'name']; + } + + public function getType(): string { + return 'Expr_PropertyFetch'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php new file mode 100644 index 00000000..e4003512 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php @@ -0,0 +1,30 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; +use PhpParser\Node\InterpolatedStringPart; + +class ShellExec extends Expr { + /** @var (Expr|InterpolatedStringPart)[] Interpolated string array */ + public array $parts; + + /** + * Constructs a shell exec (backtick) node. + * + * @param (Expr|InterpolatedStringPart)[] $parts Interpolated string array + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $parts, array $attributes = []) { + $this->attributes = $attributes; + $this->parts = $parts; + } + + public function getSubNodeNames(): array { + return ['parts']; + } + + public function getType(): string { + return 'Expr_ShellExec'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php new file mode 100644 index 00000000..707f34b6 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php @@ -0,0 +1,45 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node; +use PhpParser\Node\Arg; +use PhpParser\Node\Expr; +use PhpParser\Node\Identifier; +use PhpParser\Node\VariadicPlaceholder; + +class StaticCall extends CallLike { + /** @var Node\Name|Expr Class name */ + public Node $class; + /** @var Identifier|Expr Method name */ + public Node $name; + /** @var array<Arg|VariadicPlaceholder> Arguments */ + public array $args; + + /** + * Constructs a static method call node. + * + * @param Node\Name|Expr $class Class name + * @param string|Identifier|Expr $name Method name + * @param array<Arg|VariadicPlaceholder> $args Arguments + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Node $class, $name, array $args = [], array $attributes = []) { + $this->attributes = $attributes; + $this->class = $class; + $this->name = \is_string($name) ? new Identifier($name) : $name; + $this->args = $args; + } + + public function getSubNodeNames(): array { + return ['class', 'name', 'args']; + } + + public function getType(): string { + return 'Expr_StaticCall'; + } + + public function getRawArgs(): array { + return $this->args; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php new file mode 100644 index 00000000..4836a65b --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php @@ -0,0 +1,36 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node; +use PhpParser\Node\Expr; +use PhpParser\Node\Name; +use PhpParser\Node\VarLikeIdentifier; + +class StaticPropertyFetch extends Expr { + /** @var Name|Expr Class name */ + public Node $class; + /** @var VarLikeIdentifier|Expr Property name */ + public Node $name; + + /** + * Constructs a static property fetch node. + * + * @param Name|Expr $class Class name + * @param string|VarLikeIdentifier|Expr $name Property name + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Node $class, $name, array $attributes = []) { + $this->attributes = $attributes; + $this->class = $class; + $this->name = \is_string($name) ? new VarLikeIdentifier($name) : $name; + } + + public function getSubNodeNames(): array { + return ['class', 'name']; + } + + public function getType(): string { + return 'Expr_StaticPropertyFetch'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php new file mode 100644 index 00000000..d4837e64 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php @@ -0,0 +1,37 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +class Ternary extends Expr { + /** @var Expr Condition */ + public Expr $cond; + /** @var null|Expr Expression for true */ + public ?Expr $if; + /** @var Expr Expression for false */ + public Expr $else; + + /** + * Constructs a ternary operator node. + * + * @param Expr $cond Condition + * @param null|Expr $if Expression for true + * @param Expr $else Expression for false + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $cond, ?Expr $if, Expr $else, array $attributes = []) { + $this->attributes = $attributes; + $this->cond = $cond; + $this->if = $if; + $this->else = $else; + } + + public function getSubNodeNames(): array { + return ['cond', 'if', 'else']; + } + + public function getType(): string { + return 'Expr_Ternary'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Throw_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Throw_.php new file mode 100644 index 00000000..ee49f835 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Throw_.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node; + +class Throw_ extends Node\Expr { + /** @var Node\Expr Expression */ + public Node\Expr $expr; + + /** + * Constructs a throw expression node. + * + * @param Node\Expr $expr Expression + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Node\Expr $expr, array $attributes = []) { + $this->attributes = $attributes; + $this->expr = $expr; + } + + public function getSubNodeNames(): array { + return ['expr']; + } + + public function getType(): string { + return 'Expr_Throw'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php new file mode 100644 index 00000000..cd06f74b --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +class UnaryMinus extends Expr { + /** @var Expr Expression */ + public Expr $expr; + + /** + * Constructs a unary minus node. + * + * @param Expr $expr Expression + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $expr, array $attributes = []) { + $this->attributes = $attributes; + $this->expr = $expr; + } + + public function getSubNodeNames(): array { + return ['expr']; + } + + public function getType(): string { + return 'Expr_UnaryMinus'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php new file mode 100644 index 00000000..1b44f7b3 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +class UnaryPlus extends Expr { + /** @var Expr Expression */ + public Expr $expr; + + /** + * Constructs a unary plus node. + * + * @param Expr $expr Expression + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $expr, array $attributes = []) { + $this->attributes = $attributes; + $this->expr = $expr; + } + + public function getSubNodeNames(): array { + return ['expr']; + } + + public function getType(): string { + return 'Expr_UnaryPlus'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php new file mode 100644 index 00000000..bab74920 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +class Variable extends Expr { + /** @var string|Expr Name */ + public $name; + + /** + * Constructs a variable node. + * + * @param string|Expr $name Name + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct($name, array $attributes = []) { + $this->attributes = $attributes; + $this->name = $name; + } + + public function getSubNodeNames(): array { + return ['name']; + } + + public function getType(): string { + return 'Expr_Variable'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php new file mode 100644 index 00000000..5cff88f8 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +class YieldFrom extends Expr { + /** @var Expr Expression to yield from */ + public Expr $expr; + + /** + * Constructs an "yield from" node. + * + * @param Expr $expr Expression + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Expr $expr, array $attributes = []) { + $this->attributes = $attributes; + $this->expr = $expr; + } + + public function getSubNodeNames(): array { + return ['expr']; + } + + public function getType(): string { + return 'Expr_YieldFrom'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php new file mode 100644 index 00000000..bd81e69b --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php @@ -0,0 +1,33 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Expr; + +use PhpParser\Node\Expr; + +class Yield_ extends Expr { + /** @var null|Expr Key expression */ + public ?Expr $key; + /** @var null|Expr Value expression */ + public ?Expr $value; + + /** + * Constructs a yield expression node. + * + * @param null|Expr $value Value expression + * @param null|Expr $key Key expression + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(?Expr $value = null, ?Expr $key = null, array $attributes = []) { + $this->attributes = $attributes; + $this->key = $key; + $this->value = $value; + } + + public function getSubNodeNames(): array { + return ['key', 'value']; + } + + public function getType(): string { + return 'Expr_Yield'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php b/vendor/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php new file mode 100644 index 00000000..58f653a8 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php @@ -0,0 +1,40 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +use PhpParser\Node; + +interface FunctionLike extends Node { + /** + * Whether to return by reference + */ + public function returnsByRef(): bool; + + /** + * List of parameters + * + * @return Param[] + */ + public function getParams(): array; + + /** + * Get the declared return type or null + * + * @return null|Identifier|Name|ComplexType + */ + public function getReturnType(); + + /** + * The function body + * + * @return Stmt[]|null + */ + public function getStmts(): ?array; + + /** + * Get PHP attribute groups. + * + * @return AttributeGroup[] + */ + public function getAttrGroups(): array; +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Identifier.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Identifier.php new file mode 100644 index 00000000..01eebe5c --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Identifier.php @@ -0,0 +1,85 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +use PhpParser\NodeAbstract; + +/** + * Represents a non-namespaced name. Namespaced names are represented using Name nodes. + */ +class Identifier extends NodeAbstract { + /** + * @psalm-var non-empty-string + * @var string Identifier as string + */ + public string $name; + + /** @var array<string, bool> */ + private static array $specialClassNames = [ + 'self' => true, + 'parent' => true, + 'static' => true, + ]; + + /** + * Constructs an identifier node. + * + * @param string $name Identifier as string + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(string $name, array $attributes = []) { + if ($name === '') { + throw new \InvalidArgumentException('Identifier name cannot be empty'); + } + + $this->attributes = $attributes; + $this->name = $name; + } + + public function getSubNodeNames(): array { + return ['name']; + } + + /** + * Get identifier as string. + * + * @psalm-return non-empty-string + * @return string Identifier as string. + */ + public function toString(): string { + return $this->name; + } + + /** + * Get lowercased identifier as string. + * + * @psalm-return non-empty-string + * @return string Lowercased identifier as string + */ + public function toLowerString(): string { + return strtolower($this->name); + } + + /** + * Checks whether the identifier is a special class name (self, parent or static). + * + * @return bool Whether identifier is a special class name + */ + public function isSpecialClassName(): bool { + return isset(self::$specialClassNames[strtolower($this->name)]); + } + + /** + * Get identifier as string. + * + * @psalm-return non-empty-string + * @return string Identifier as string + */ + public function __toString(): string { + return $this->name; + } + + public function getType(): string { + return 'Identifier'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/InterpolatedStringPart.php b/vendor/nikic/php-parser/lib/PhpParser/Node/InterpolatedStringPart.php new file mode 100644 index 00000000..576dac46 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/InterpolatedStringPart.php @@ -0,0 +1,32 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +use PhpParser\NodeAbstract; + +class InterpolatedStringPart extends NodeAbstract { + /** @var string String value */ + public string $value; + + /** + * Constructs a node representing a string part of an interpolated string. + * + * @param string $value String value + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(string $value, array $attributes = []) { + $this->attributes = $attributes; + $this->value = $value; + } + + public function getSubNodeNames(): array { + return ['value']; + } + + public function getType(): string { + return 'InterpolatedStringPart'; + } +} + +// @deprecated compatibility alias +class_alias(InterpolatedStringPart::class, Scalar\EncapsedStringPart::class); diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/IntersectionType.php b/vendor/nikic/php-parser/lib/PhpParser/Node/IntersectionType.php new file mode 100644 index 00000000..3b39cf10 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/IntersectionType.php @@ -0,0 +1,27 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +class IntersectionType extends ComplexType { + /** @var (Identifier|Name)[] Types */ + public array $types; + + /** + * Constructs an intersection type. + * + * @param (Identifier|Name)[] $types Types + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $types, array $attributes = []) { + $this->attributes = $attributes; + $this->types = $types; + } + + public function getSubNodeNames(): array { + return ['types']; + } + + public function getType(): string { + return 'IntersectionType'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/MatchArm.php b/vendor/nikic/php-parser/lib/PhpParser/Node/MatchArm.php new file mode 100644 index 00000000..2927f029 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/MatchArm.php @@ -0,0 +1,30 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +use PhpParser\Node; +use PhpParser\NodeAbstract; + +class MatchArm extends NodeAbstract { + /** @var null|list<Node\Expr> */ + public ?array $conds; + /** @var Node\Expr */ + public Expr $body; + + /** + * @param null|list<Node\Expr> $conds + */ + public function __construct(?array $conds, Node\Expr $body, array $attributes = []) { + $this->conds = $conds; + $this->body = $body; + $this->attributes = $attributes; + } + + public function getSubNodeNames(): array { + return ['conds', 'body']; + } + + public function getType(): string { + return 'MatchArm'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Name.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Name.php new file mode 100644 index 00000000..aa2b90eb --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Name.php @@ -0,0 +1,278 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +use PhpParser\NodeAbstract; + +class Name extends NodeAbstract { + /** + * @psalm-var non-empty-string + * @var string Name as string + */ + public string $name; + + /** @var array<string, bool> */ + private static array $specialClassNames = [ + 'self' => true, + 'parent' => true, + 'static' => true, + ]; + + /** + * Constructs a name node. + * + * @param string|string[]|self $name Name as string, part array or Name instance (copy ctor) + * @param array<string, mixed> $attributes Additional attributes + */ + final public function __construct($name, array $attributes = []) { + $this->attributes = $attributes; + $this->name = self::prepareName($name); + } + + public function getSubNodeNames(): array { + return ['name']; + } + + /** + * Get parts of name (split by the namespace separator). + * + * @psalm-return non-empty-list<string> + * @return string[] Parts of name + */ + public function getParts(): array { + return \explode('\\', $this->name); + } + + /** + * Gets the first part of the name, i.e. everything before the first namespace separator. + * + * @return string First part of the name + */ + public function getFirst(): string { + if (false !== $pos = \strpos($this->name, '\\')) { + return \substr($this->name, 0, $pos); + } + return $this->name; + } + + /** + * Gets the last part of the name, i.e. everything after the last namespace separator. + * + * @return string Last part of the name + */ + public function getLast(): string { + if (false !== $pos = \strrpos($this->name, '\\')) { + return \substr($this->name, $pos + 1); + } + return $this->name; + } + + /** + * Checks whether the name is unqualified. (E.g. Name) + * + * @return bool Whether the name is unqualified + */ + public function isUnqualified(): bool { + return false === \strpos($this->name, '\\'); + } + + /** + * Checks whether the name is qualified. (E.g. Name\Name) + * + * @return bool Whether the name is qualified + */ + public function isQualified(): bool { + return false !== \strpos($this->name, '\\'); + } + + /** + * Checks whether the name is fully qualified. (E.g. \Name) + * + * @return bool Whether the name is fully qualified + */ + public function isFullyQualified(): bool { + return false; + } + + /** + * Checks whether the name is explicitly relative to the current namespace. (E.g. namespace\Name) + * + * @return bool Whether the name is relative + */ + public function isRelative(): bool { + return false; + } + + /** + * Returns a string representation of the name itself, without taking the name type into + * account (e.g., not including a leading backslash for fully qualified names). + * + * @psalm-return non-empty-string + * @return string String representation + */ + public function toString(): string { + return $this->name; + } + + /** + * Returns a string representation of the name as it would occur in code (e.g., including + * leading backslash for fully qualified names. + * + * @psalm-return non-empty-string + * @return string String representation + */ + public function toCodeString(): string { + return $this->toString(); + } + + /** + * Returns lowercased string representation of the name, without taking the name type into + * account (e.g., no leading backslash for fully qualified names). + * + * @psalm-return non-empty-string + * @return string Lowercased string representation + */ + public function toLowerString(): string { + return strtolower($this->name); + } + + /** + * Checks whether the identifier is a special class name (self, parent or static). + * + * @return bool Whether identifier is a special class name + */ + public function isSpecialClassName(): bool { + return isset(self::$specialClassNames[strtolower($this->name)]); + } + + /** + * Returns a string representation of the name by imploding the namespace parts with the + * namespace separator. + * + * @psalm-return non-empty-string + * @return string String representation + */ + public function __toString(): string { + return $this->name; + } + + /** + * Gets a slice of a name (similar to array_slice). + * + * This method returns a new instance of the same type as the original and with the same + * attributes. + * + * If the slice is empty, null is returned. The null value will be correctly handled in + * concatenations using concat(). + * + * Offset and length have the same meaning as in array_slice(). + * + * @param int $offset Offset to start the slice at (may be negative) + * @param int|null $length Length of the slice (may be negative) + * + * @return static|null Sliced name + */ + public function slice(int $offset, ?int $length = null) { + if ($offset === 1 && $length === null) { + // Short-circuit the common case. + if (false !== $pos = \strpos($this->name, '\\')) { + return new static(\substr($this->name, $pos + 1)); + } + return null; + } + + $parts = \explode('\\', $this->name); + $numParts = \count($parts); + + $realOffset = $offset < 0 ? $offset + $numParts : $offset; + if ($realOffset < 0 || $realOffset > $numParts) { + throw new \OutOfBoundsException(sprintf('Offset %d is out of bounds', $offset)); + } + + if (null === $length) { + $realLength = $numParts - $realOffset; + } else { + $realLength = $length < 0 ? $length + $numParts - $realOffset : $length; + if ($realLength < 0 || $realLength > $numParts - $realOffset) { + throw new \OutOfBoundsException(sprintf('Length %d is out of bounds', $length)); + } + } + + if ($realLength === 0) { + // Empty slice is represented as null + return null; + } + + return new static(array_slice($parts, $realOffset, $realLength), $this->attributes); + } + + /** + * Concatenate two names, yielding a new Name instance. + * + * The type of the generated instance depends on which class this method is called on, for + * example Name\FullyQualified::concat() will yield a Name\FullyQualified instance. + * + * If one of the arguments is null, a new instance of the other name will be returned. If both + * arguments are null, null will be returned. As such, writing + * Name::concat($namespace, $shortName) + * where $namespace is a Name node or null will work as expected. + * + * @param string|string[]|self|null $name1 The first name + * @param string|string[]|self|null $name2 The second name + * @param array<string, mixed> $attributes Attributes to assign to concatenated name + * + * @return static|null Concatenated name + */ + public static function concat($name1, $name2, array $attributes = []) { + if (null === $name1 && null === $name2) { + return null; + } + if (null === $name1) { + return new static($name2, $attributes); + } + if (null === $name2) { + return new static($name1, $attributes); + } else { + return new static( + self::prepareName($name1) . '\\' . self::prepareName($name2), $attributes + ); + } + } + + /** + * Prepares a (string, array or Name node) name for use in name changing methods by converting + * it to a string. + * + * @param string|string[]|self $name Name to prepare + * + * @psalm-return non-empty-string + * @return string Prepared name + */ + private static function prepareName($name): string { + if (\is_string($name)) { + if ('' === $name) { + throw new \InvalidArgumentException('Name cannot be empty'); + } + + return $name; + } + if (\is_array($name)) { + if (empty($name)) { + throw new \InvalidArgumentException('Name cannot be empty'); + } + + return implode('\\', $name); + } + if ($name instanceof self) { + return $name->name; + } + + throw new \InvalidArgumentException( + 'Expected string, array of parts or Name instance' + ); + } + + public function getType(): string { + return 'Name'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Name/FullyQualified.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Name/FullyQualified.php new file mode 100644 index 00000000..21183786 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Name/FullyQualified.php @@ -0,0 +1,49 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Name; + +class FullyQualified extends \PhpParser\Node\Name { + /** + * Checks whether the name is unqualified. (E.g. Name) + * + * @return bool Whether the name is unqualified + */ + public function isUnqualified(): bool { + return false; + } + + /** + * Checks whether the name is qualified. (E.g. Name\Name) + * + * @return bool Whether the name is qualified + */ + public function isQualified(): bool { + return false; + } + + /** + * Checks whether the name is fully qualified. (E.g. \Name) + * + * @return bool Whether the name is fully qualified + */ + public function isFullyQualified(): bool { + return true; + } + + /** + * Checks whether the name is explicitly relative to the current namespace. (E.g. namespace\Name) + * + * @return bool Whether the name is relative + */ + public function isRelative(): bool { + return false; + } + + public function toCodeString(): string { + return '\\' . $this->toString(); + } + + public function getType(): string { + return 'Name_FullyQualified'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Name/Relative.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Name/Relative.php new file mode 100644 index 00000000..0226a4e4 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Name/Relative.php @@ -0,0 +1,49 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Name; + +class Relative extends \PhpParser\Node\Name { + /** + * Checks whether the name is unqualified. (E.g. Name) + * + * @return bool Whether the name is unqualified + */ + public function isUnqualified(): bool { + return false; + } + + /** + * Checks whether the name is qualified. (E.g. Name\Name) + * + * @return bool Whether the name is qualified + */ + public function isQualified(): bool { + return false; + } + + /** + * Checks whether the name is fully qualified. (E.g. \Name) + * + * @return bool Whether the name is fully qualified + */ + public function isFullyQualified(): bool { + return false; + } + + /** + * Checks whether the name is explicitly relative to the current namespace. (E.g. namespace\Name) + * + * @return bool Whether the name is relative + */ + public function isRelative(): bool { + return true; + } + + public function toCodeString(): string { + return 'namespace\\' . $this->toString(); + } + + public function getType(): string { + return 'Name_Relative'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/NullableType.php b/vendor/nikic/php-parser/lib/PhpParser/Node/NullableType.php new file mode 100644 index 00000000..b99acd13 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/NullableType.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +use PhpParser\Node; + +class NullableType extends ComplexType { + /** @var Identifier|Name Type */ + public Node $type; + + /** + * Constructs a nullable type (wrapping another type). + * + * @param Identifier|Name $type Type + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Node $type, array $attributes = []) { + $this->attributes = $attributes; + $this->type = $type; + } + + public function getSubNodeNames(): array { + return ['type']; + } + + public function getType(): string { + return 'NullableType'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Param.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Param.php new file mode 100644 index 00000000..0e9ff0e2 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Param.php @@ -0,0 +1,84 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +use PhpParser\Modifiers; +use PhpParser\Node; +use PhpParser\NodeAbstract; + +class Param extends NodeAbstract { + /** @var null|Identifier|Name|ComplexType Type declaration */ + public ?Node $type; + /** @var bool Whether parameter is passed by reference */ + public bool $byRef; + /** @var bool Whether this is a variadic argument */ + public bool $variadic; + /** @var Expr\Variable|Expr\Error Parameter variable */ + public Expr $var; + /** @var null|Expr Default value */ + public ?Expr $default; + /** @var int Optional visibility flags */ + public int $flags; + /** @var AttributeGroup[] PHP attribute groups */ + public array $attrGroups; + + /** + * Constructs a parameter node. + * + * @param Expr\Variable|Expr\Error $var Parameter variable + * @param null|Expr $default Default value + * @param null|Identifier|Name|ComplexType $type Type declaration + * @param bool $byRef Whether is passed by reference + * @param bool $variadic Whether this is a variadic argument + * @param array<string, mixed> $attributes Additional attributes + * @param int $flags Optional visibility flags + * @param list<AttributeGroup> $attrGroups PHP attribute groups + */ + public function __construct( + Expr $var, ?Expr $default = null, ?Node $type = null, + bool $byRef = false, bool $variadic = false, + array $attributes = [], + int $flags = 0, + array $attrGroups = [] + ) { + $this->attributes = $attributes; + $this->type = $type; + $this->byRef = $byRef; + $this->variadic = $variadic; + $this->var = $var; + $this->default = $default; + $this->flags = $flags; + $this->attrGroups = $attrGroups; + } + + public function getSubNodeNames(): array { + return ['attrGroups', 'flags', 'type', 'byRef', 'variadic', 'var', 'default']; + } + + public function getType(): string { + return 'Param'; + } + + /** + * Whether this parameter uses constructor property promotion. + */ + public function isPromoted(): bool { + return $this->flags !== 0; + } + + public function isPublic(): bool { + return (bool) ($this->flags & Modifiers::PUBLIC); + } + + public function isProtected(): bool { + return (bool) ($this->flags & Modifiers::PROTECTED); + } + + public function isPrivate(): bool { + return (bool) ($this->flags & Modifiers::PRIVATE); + } + + public function isReadonly(): bool { + return (bool) ($this->flags & Modifiers::READONLY); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/PropertyItem.php b/vendor/nikic/php-parser/lib/PhpParser/Node/PropertyItem.php new file mode 100644 index 00000000..101611e6 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/PropertyItem.php @@ -0,0 +1,37 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +use PhpParser\Node; +use PhpParser\NodeAbstract; + +class PropertyItem extends NodeAbstract { + /** @var Node\VarLikeIdentifier Name */ + public VarLikeIdentifier $name; + /** @var null|Node\Expr Default */ + public ?Expr $default; + + /** + * Constructs a class property item node. + * + * @param string|Node\VarLikeIdentifier $name Name + * @param null|Node\Expr $default Default value + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct($name, ?Node\Expr $default = null, array $attributes = []) { + $this->attributes = $attributes; + $this->name = \is_string($name) ? new Node\VarLikeIdentifier($name) : $name; + $this->default = $default; + } + + public function getSubNodeNames(): array { + return ['name', 'default']; + } + + public function getType(): string { + return 'PropertyItem'; + } +} + +// @deprecated compatibility alias +class_alias(PropertyItem::class, Stmt\PropertyProperty::class); diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar.php new file mode 100644 index 00000000..3df25721 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar.php @@ -0,0 +1,6 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +abstract class Scalar extends Expr { +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php new file mode 100644 index 00000000..ad3937a5 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php @@ -0,0 +1,3 @@ +<?php declare(strict_types=1); + +require __DIR__ . '/Float_.php'; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php new file mode 100644 index 00000000..c5aaf5b4 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php @@ -0,0 +1,3 @@ +<?php declare(strict_types=1); + +require __DIR__ . '/InterpolatedString.php'; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php new file mode 100644 index 00000000..990e9801 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php @@ -0,0 +1,3 @@ +<?php declare(strict_types=1); + +require __DIR__ . '/../InterpolatedStringPart.php'; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Float_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Float_.php new file mode 100644 index 00000000..5af13192 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Float_.php @@ -0,0 +1,78 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Scalar; + +use PhpParser\Node\Scalar; + +class Float_ extends Scalar { + /** @var float Number value */ + public float $value; + + /** + * Constructs a float number scalar node. + * + * @param float $value Value of the number + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(float $value, array $attributes = []) { + $this->attributes = $attributes; + $this->value = $value; + } + + public function getSubNodeNames(): array { + return ['value']; + } + + /** + * @param mixed[] $attributes + */ + public static function fromString(string $str, array $attributes = []): Float_ { + $attributes['rawValue'] = $str; + $float = self::parse($str); + + return new Float_($float, $attributes); + } + + /** + * @internal + * + * Parses a DNUMBER token like PHP would. + * + * @param string $str A string number + * + * @return float The parsed number + */ + public static function parse(string $str): float { + $str = str_replace('_', '', $str); + + // Check whether this is one of the special integer notations. + if ('0' === $str[0]) { + // hex + if ('x' === $str[1] || 'X' === $str[1]) { + return hexdec($str); + } + + // bin + if ('b' === $str[1] || 'B' === $str[1]) { + return bindec($str); + } + + // oct, but only if the string does not contain any of '.eE'. + if (false === strpbrk($str, '.eE')) { + // substr($str, 0, strcspn($str, '89')) cuts the string at the first invalid digit + // (8 or 9) so that only the digits before that are used. + return octdec(substr($str, 0, strcspn($str, '89'))); + } + } + + // dec + return (float) $str; + } + + public function getType(): string { + return 'Scalar_Float'; + } +} + +// @deprecated compatibility alias +class_alias(Float_::class, DNumber::class); diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Int_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Int_.php new file mode 100644 index 00000000..bcc257a6 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Int_.php @@ -0,0 +1,82 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Scalar; + +use PhpParser\Error; +use PhpParser\Node\Scalar; + +class Int_ extends Scalar { + /* For use in "kind" attribute */ + public const KIND_BIN = 2; + public const KIND_OCT = 8; + public const KIND_DEC = 10; + public const KIND_HEX = 16; + + /** @var int Number value */ + public int $value; + + /** + * Constructs an integer number scalar node. + * + * @param int $value Value of the number + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(int $value, array $attributes = []) { + $this->attributes = $attributes; + $this->value = $value; + } + + public function getSubNodeNames(): array { + return ['value']; + } + + /** + * Constructs an Int node from a string number literal. + * + * @param string $str String number literal (decimal, octal, hex or binary) + * @param array<string, mixed> $attributes Additional attributes + * @param bool $allowInvalidOctal Whether to allow invalid octal numbers (PHP 5) + * + * @return Int_ The constructed LNumber, including kind attribute + */ + public static function fromString(string $str, array $attributes = [], bool $allowInvalidOctal = false): Int_ { + $attributes['rawValue'] = $str; + + $str = str_replace('_', '', $str); + + if ('0' !== $str[0] || '0' === $str) { + $attributes['kind'] = Int_::KIND_DEC; + return new Int_((int) $str, $attributes); + } + + if ('x' === $str[1] || 'X' === $str[1]) { + $attributes['kind'] = Int_::KIND_HEX; + return new Int_(hexdec($str), $attributes); + } + + if ('b' === $str[1] || 'B' === $str[1]) { + $attributes['kind'] = Int_::KIND_BIN; + return new Int_(bindec($str), $attributes); + } + + if (!$allowInvalidOctal && strpbrk($str, '89')) { + throw new Error('Invalid numeric literal', $attributes); + } + + // Strip optional explicit octal prefix. + if ('o' === $str[1] || 'O' === $str[1]) { + $str = substr($str, 2); + } + + // use intval instead of octdec to get proper cutting behavior with malformed numbers + $attributes['kind'] = Int_::KIND_OCT; + return new Int_(intval($str, 8), $attributes); + } + + public function getType(): string { + return 'Scalar_Int'; + } +} + +// @deprecated compatibility alias +class_alias(Int_::class, LNumber::class); diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/InterpolatedString.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/InterpolatedString.php new file mode 100644 index 00000000..9336dfe4 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/InterpolatedString.php @@ -0,0 +1,34 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Scalar; + +use PhpParser\Node\Expr; +use PhpParser\Node\InterpolatedStringPart; +use PhpParser\Node\Scalar; + +class InterpolatedString extends Scalar { + /** @var (Expr|InterpolatedStringPart)[] list of string parts */ + public array $parts; + + /** + * Constructs an interpolated string node. + * + * @param (Expr|InterpolatedStringPart)[] $parts Interpolated string parts + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $parts, array $attributes = []) { + $this->attributes = $attributes; + $this->parts = $parts; + } + + public function getSubNodeNames(): array { + return ['parts']; + } + + public function getType(): string { + return 'Scalar_InterpolatedString'; + } +} + +// @deprecated compatibility alias +class_alias(InterpolatedString::class, Encapsed::class); diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php new file mode 100644 index 00000000..cfe8c8c1 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php @@ -0,0 +1,3 @@ +<?php declare(strict_types=1); + +require __DIR__ . '/Int_.php'; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php new file mode 100644 index 00000000..1da9b391 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php @@ -0,0 +1,27 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Scalar; + +use PhpParser\Node\Scalar; + +abstract class MagicConst extends Scalar { + /** + * Constructs a magic constant node. + * + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $attributes = []) { + $this->attributes = $attributes; + } + + public function getSubNodeNames(): array { + return []; + } + + /** + * Get name of magic constant. + * + * @return string Name of magic constant + */ + abstract public function getName(): string; +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Class_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Class_.php new file mode 100644 index 00000000..732ed140 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Class_.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Scalar\MagicConst; + +use PhpParser\Node\Scalar\MagicConst; + +class Class_ extends MagicConst { + public function getName(): string { + return '__CLASS__'; + } + + public function getType(): string { + return 'Scalar_MagicConst_Class'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Dir.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Dir.php new file mode 100644 index 00000000..64daa713 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Dir.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Scalar\MagicConst; + +use PhpParser\Node\Scalar\MagicConst; + +class Dir extends MagicConst { + public function getName(): string { + return '__DIR__'; + } + + public function getType(): string { + return 'Scalar_MagicConst_Dir'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/File.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/File.php new file mode 100644 index 00000000..91041f0f --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/File.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Scalar\MagicConst; + +use PhpParser\Node\Scalar\MagicConst; + +class File extends MagicConst { + public function getName(): string { + return '__FILE__'; + } + + public function getType(): string { + return 'Scalar_MagicConst_File'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Function_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Function_.php new file mode 100644 index 00000000..c242d2d9 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Function_.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Scalar\MagicConst; + +use PhpParser\Node\Scalar\MagicConst; + +class Function_ extends MagicConst { + public function getName(): string { + return '__FUNCTION__'; + } + + public function getType(): string { + return 'Scalar_MagicConst_Function'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Line.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Line.php new file mode 100644 index 00000000..58d8ce39 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Line.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Scalar\MagicConst; + +use PhpParser\Node\Scalar\MagicConst; + +class Line extends MagicConst { + public function getName(): string { + return '__LINE__'; + } + + public function getType(): string { + return 'Scalar_MagicConst_Line'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Method.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Method.php new file mode 100644 index 00000000..47f341f1 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Method.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Scalar\MagicConst; + +use PhpParser\Node\Scalar\MagicConst; + +class Method extends MagicConst { + public function getName(): string { + return '__METHOD__'; + } + + public function getType(): string { + return 'Scalar_MagicConst_Method'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Namespace_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Namespace_.php new file mode 100644 index 00000000..e9f8c0ea --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Namespace_.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Scalar\MagicConst; + +use PhpParser\Node\Scalar\MagicConst; + +class Namespace_ extends MagicConst { + public function getName(): string { + return '__NAMESPACE__'; + } + + public function getType(): string { + return 'Scalar_MagicConst_Namespace'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Trait_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Trait_.php new file mode 100644 index 00000000..25f49731 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Trait_.php @@ -0,0 +1,15 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Scalar\MagicConst; + +use PhpParser\Node\Scalar\MagicConst; + +class Trait_ extends MagicConst { + public function getName(): string { + return '__TRAIT__'; + } + + public function getType(): string { + return 'Scalar_MagicConst_Trait'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/String_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/String_.php new file mode 100644 index 00000000..c965366d --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/String_.php @@ -0,0 +1,161 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Scalar; + +use PhpParser\Error; +use PhpParser\Node\Scalar; + +class String_ extends Scalar { + /* For use in "kind" attribute */ + public const KIND_SINGLE_QUOTED = 1; + public const KIND_DOUBLE_QUOTED = 2; + public const KIND_HEREDOC = 3; + public const KIND_NOWDOC = 4; + + /** @var string String value */ + public string $value; + + /** @var array<string, string> Escaped character to its decoded value */ + protected static array $replacements = [ + '\\' => '\\', + '$' => '$', + 'n' => "\n", + 'r' => "\r", + 't' => "\t", + 'f' => "\f", + 'v' => "\v", + 'e' => "\x1B", + ]; + + /** + * Constructs a string scalar node. + * + * @param string $value Value of the string + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(string $value, array $attributes = []) { + $this->attributes = $attributes; + $this->value = $value; + } + + public function getSubNodeNames(): array { + return ['value']; + } + + /** + * @param array<string, mixed> $attributes + * @param bool $parseUnicodeEscape Whether to parse PHP 7 \u escapes + */ + public static function fromString(string $str, array $attributes = [], bool $parseUnicodeEscape = true): self { + $attributes['kind'] = ($str[0] === "'" || ($str[1] === "'" && ($str[0] === 'b' || $str[0] === 'B'))) + ? Scalar\String_::KIND_SINGLE_QUOTED + : Scalar\String_::KIND_DOUBLE_QUOTED; + + $attributes['rawValue'] = $str; + + $string = self::parse($str, $parseUnicodeEscape); + + return new self($string, $attributes); + } + + /** + * @internal + * + * Parses a string token. + * + * @param string $str String token content + * @param bool $parseUnicodeEscape Whether to parse PHP 7 \u escapes + * + * @return string The parsed string + */ + public static function parse(string $str, bool $parseUnicodeEscape = true): string { + $bLength = 0; + if ('b' === $str[0] || 'B' === $str[0]) { + $bLength = 1; + } + + if ('\'' === $str[$bLength]) { + return str_replace( + ['\\\\', '\\\''], + ['\\', '\''], + substr($str, $bLength + 1, -1) + ); + } else { + return self::parseEscapeSequences( + substr($str, $bLength + 1, -1), '"', $parseUnicodeEscape + ); + } + } + + /** + * @internal + * + * Parses escape sequences in strings (all string types apart from single quoted). + * + * @param string $str String without quotes + * @param null|string $quote Quote type + * @param bool $parseUnicodeEscape Whether to parse PHP 7 \u escapes + * + * @return string String with escape sequences parsed + */ + public static function parseEscapeSequences(string $str, ?string $quote, bool $parseUnicodeEscape = true): string { + if (null !== $quote) { + $str = str_replace('\\' . $quote, $quote, $str); + } + + $extra = ''; + if ($parseUnicodeEscape) { + $extra = '|u\{([0-9a-fA-F]+)\}'; + } + + return preg_replace_callback( + '~\\\\([\\\\$nrtfve]|[xX][0-9a-fA-F]{1,2}|[0-7]{1,3}' . $extra . ')~', + function ($matches) { + $str = $matches[1]; + + if (isset(self::$replacements[$str])) { + return self::$replacements[$str]; + } + if ('x' === $str[0] || 'X' === $str[0]) { + return chr(hexdec(substr($str, 1))); + } + if ('u' === $str[0]) { + $dec = hexdec($matches[2]); + // If it overflowed to float, treat as INT_MAX, it will throw an error anyway. + return self::codePointToUtf8(\is_int($dec) ? $dec : \PHP_INT_MAX); + } else { + return chr(octdec($str)); + } + }, + $str + ); + } + + /** + * Converts a Unicode code point to its UTF-8 encoded representation. + * + * @param int $num Code point + * + * @return string UTF-8 representation of code point + */ + private static function codePointToUtf8(int $num): string { + if ($num <= 0x7F) { + return chr($num); + } + if ($num <= 0x7FF) { + return chr(($num >> 6) + 0xC0) . chr(($num & 0x3F) + 0x80); + } + if ($num <= 0xFFFF) { + return chr(($num >> 12) + 0xE0) . chr((($num >> 6) & 0x3F) + 0x80) . chr(($num & 0x3F) + 0x80); + } + if ($num <= 0x1FFFFF) { + return chr(($num >> 18) + 0xF0) . chr((($num >> 12) & 0x3F) + 0x80) + . chr((($num >> 6) & 0x3F) + 0x80) . chr(($num & 0x3F) + 0x80); + } + throw new Error('Invalid UTF-8 codepoint escape sequence: Codepoint too large'); + } + + public function getType(): string { + return 'Scalar_String'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/StaticVar.php b/vendor/nikic/php-parser/lib/PhpParser/Node/StaticVar.php new file mode 100644 index 00000000..517c0edd --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/StaticVar.php @@ -0,0 +1,39 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +use PhpParser\Node; +use PhpParser\NodeAbstract; + +class StaticVar extends NodeAbstract { + /** @var Expr\Variable Variable */ + public Expr\Variable $var; + /** @var null|Node\Expr Default value */ + public ?Expr $default; + + /** + * Constructs a static variable node. + * + * @param Expr\Variable $var Name + * @param null|Node\Expr $default Default value + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct( + Expr\Variable $var, ?Node\Expr $default = null, array $attributes = [] + ) { + $this->attributes = $attributes; + $this->var = $var; + $this->default = $default; + } + + public function getSubNodeNames(): array { + return ['var', 'default']; + } + + public function getType(): string { + return 'StaticVar'; + } +} + +// @deprecated compatibility alias +class_alias(StaticVar::class, Stmt\StaticVar::class); diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt.php new file mode 100644 index 00000000..481d31a9 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt.php @@ -0,0 +1,8 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +use PhpParser\NodeAbstract; + +abstract class Stmt extends NodeAbstract { +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Block.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Block.php new file mode 100644 index 00000000..073df208 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Block.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node\Stmt; + +class Block extends Stmt { + /** @var Stmt[] Statements */ + public array $stmts; + + /** + * A block of statements. + * + * @param Stmt[] $stmts Statements + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $stmts, array $attributes = []) { + $this->attributes = $attributes; + $this->stmts = $stmts; + } + + public function getType(): string { + return 'Stmt_Block'; + } + + public function getSubNodeNames(): array { + return ['stmts']; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Break_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Break_.php new file mode 100644 index 00000000..d2bcc5eb --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Break_.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +class Break_ extends Node\Stmt { + /** @var null|Node\Expr Number of loops to break */ + public ?Node\Expr $num; + + /** + * Constructs a break node. + * + * @param null|Node\Expr $num Number of loops to break + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(?Node\Expr $num = null, array $attributes = []) { + $this->attributes = $attributes; + $this->num = $num; + } + + public function getSubNodeNames(): array { + return ['num']; + } + + public function getType(): string { + return 'Stmt_Break'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php new file mode 100644 index 00000000..a06ca183 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php @@ -0,0 +1,33 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +class Case_ extends Node\Stmt { + /** @var null|Node\Expr Condition (null for default) */ + public ?Node\Expr $cond; + /** @var Node\Stmt[] Statements */ + public array $stmts; + + /** + * Constructs a case node. + * + * @param null|Node\Expr $cond Condition (null for default) + * @param Node\Stmt[] $stmts Statements + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(?Node\Expr $cond, array $stmts = [], array $attributes = []) { + $this->attributes = $attributes; + $this->cond = $cond; + $this->stmts = $stmts; + } + + public function getSubNodeNames(): array { + return ['cond', 'stmts']; + } + + public function getType(): string { + return 'Stmt_Case'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php new file mode 100644 index 00000000..e8d39c9c --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php @@ -0,0 +1,40 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; +use PhpParser\Node\Expr; + +class Catch_ extends Node\Stmt { + /** @var Node\Name[] Types of exceptions to catch */ + public array $types; + /** @var Expr\Variable|null Variable for exception */ + public ?Expr\Variable $var; + /** @var Node\Stmt[] Statements */ + public array $stmts; + + /** + * Constructs a catch node. + * + * @param Node\Name[] $types Types of exceptions to catch + * @param Expr\Variable|null $var Variable for exception + * @param Node\Stmt[] $stmts Statements + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct( + array $types, ?Expr\Variable $var = null, array $stmts = [], array $attributes = [] + ) { + $this->attributes = $attributes; + $this->types = $types; + $this->var = $var; + $this->stmts = $stmts; + } + + public function getSubNodeNames(): array { + return ['types', 'var', 'stmts']; + } + + public function getType(): string { + return 'Stmt_Catch'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php new file mode 100644 index 00000000..9bdce1f1 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php @@ -0,0 +1,77 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Modifiers; +use PhpParser\Node; + +class ClassConst extends Node\Stmt { + /** @var int Modifiers */ + public int $flags; + /** @var Node\Const_[] Constant declarations */ + public array $consts; + /** @var Node\AttributeGroup[] PHP attribute groups */ + public array $attrGroups; + /** @var Node\Identifier|Node\Name|Node\ComplexType|null Type declaration */ + public ?Node $type; + + /** + * Constructs a class const list node. + * + * @param Node\Const_[] $consts Constant declarations + * @param int $flags Modifiers + * @param array<string, mixed> $attributes Additional attributes + * @param list<Node\AttributeGroup> $attrGroups PHP attribute groups + * @param null|Node\Identifier|Node\Name|Node\ComplexType $type Type declaration + */ + public function __construct( + array $consts, + int $flags = 0, + array $attributes = [], + array $attrGroups = [], + ?Node $type = null + ) { + $this->attributes = $attributes; + $this->flags = $flags; + $this->consts = $consts; + $this->attrGroups = $attrGroups; + $this->type = $type; + } + + public function getSubNodeNames(): array { + return ['attrGroups', 'flags', 'type', 'consts']; + } + + /** + * Whether constant is explicitly or implicitly public. + */ + public function isPublic(): bool { + return ($this->flags & Modifiers::PUBLIC) !== 0 + || ($this->flags & Modifiers::VISIBILITY_MASK) === 0; + } + + /** + * Whether constant is protected. + */ + public function isProtected(): bool { + return (bool) ($this->flags & Modifiers::PROTECTED); + } + + /** + * Whether constant is private. + */ + public function isPrivate(): bool { + return (bool) ($this->flags & Modifiers::PRIVATE); + } + + /** + * Whether constant is final. + */ + public function isFinal(): bool { + return (bool) ($this->flags & Modifiers::FINAL); + } + + public function getType(): string { + return 'Stmt_ClassConst'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php new file mode 100644 index 00000000..fb9ba4f5 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php @@ -0,0 +1,109 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; +use PhpParser\Node\PropertyItem; + +abstract class ClassLike extends Node\Stmt { + /** @var Node\Identifier|null Name */ + public ?Node\Identifier $name; + /** @var Node\Stmt[] Statements */ + public array $stmts; + /** @var Node\AttributeGroup[] PHP attribute groups */ + public array $attrGroups; + + /** @var Node\Name|null Namespaced name (if using NameResolver) */ + public ?Node\Name $namespacedName; + + /** + * @return TraitUse[] + */ + public function getTraitUses(): array { + $traitUses = []; + foreach ($this->stmts as $stmt) { + if ($stmt instanceof TraitUse) { + $traitUses[] = $stmt; + } + } + return $traitUses; + } + + /** + * @return ClassConst[] + */ + public function getConstants(): array { + $constants = []; + foreach ($this->stmts as $stmt) { + if ($stmt instanceof ClassConst) { + $constants[] = $stmt; + } + } + return $constants; + } + + /** + * @return Property[] + */ + public function getProperties(): array { + $properties = []; + foreach ($this->stmts as $stmt) { + if ($stmt instanceof Property) { + $properties[] = $stmt; + } + } + return $properties; + } + + /** + * Gets property with the given name defined directly in this class/interface/trait. + * + * @param string $name Name of the property + * + * @return Property|null Property node or null if the property does not exist + */ + public function getProperty(string $name): ?Property { + foreach ($this->stmts as $stmt) { + if ($stmt instanceof Property) { + foreach ($stmt->props as $prop) { + if ($prop instanceof PropertyItem && $name === $prop->name->toString()) { + return $stmt; + } + } + } + } + return null; + } + + /** + * Gets all methods defined directly in this class/interface/trait + * + * @return ClassMethod[] + */ + public function getMethods(): array { + $methods = []; + foreach ($this->stmts as $stmt) { + if ($stmt instanceof ClassMethod) { + $methods[] = $stmt; + } + } + return $methods; + } + + /** + * Gets method with the given name defined directly in this class/interface/trait. + * + * @param string $name Name of the method (compared case-insensitively) + * + * @return ClassMethod|null Method node or null if the method does not exist + */ + public function getMethod(string $name): ?ClassMethod { + $lowerName = strtolower($name); + foreach ($this->stmts as $stmt) { + if ($stmt instanceof ClassMethod && $lowerName === $stmt->name->toLowerString()) { + return $stmt; + } + } + return null; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php new file mode 100644 index 00000000..59c0519e --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php @@ -0,0 +1,154 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Modifiers; +use PhpParser\Node; +use PhpParser\Node\FunctionLike; + +class ClassMethod extends Node\Stmt implements FunctionLike { + /** @var int Flags */ + public int $flags; + /** @var bool Whether to return by reference */ + public bool $byRef; + /** @var Node\Identifier Name */ + public Node\Identifier $name; + /** @var Node\Param[] Parameters */ + public array $params; + /** @var null|Node\Identifier|Node\Name|Node\ComplexType Return type */ + public ?Node $returnType; + /** @var Node\Stmt[]|null Statements */ + public ?array $stmts; + /** @var Node\AttributeGroup[] PHP attribute groups */ + public array $attrGroups; + + /** @var array<string, bool> */ + private static array $magicNames = [ + '__construct' => true, + '__destruct' => true, + '__call' => true, + '__callstatic' => true, + '__get' => true, + '__set' => true, + '__isset' => true, + '__unset' => true, + '__sleep' => true, + '__wakeup' => true, + '__tostring' => true, + '__set_state' => true, + '__clone' => true, + '__invoke' => true, + '__debuginfo' => true, + '__serialize' => true, + '__unserialize' => true, + ]; + + /** + * Constructs a class method node. + * + * @param string|Node\Identifier $name Name + * @param array{ + * flags?: int, + * byRef?: bool, + * params?: Node\Param[], + * returnType?: null|Node\Identifier|Node\Name|Node\ComplexType, + * stmts?: Node\Stmt[]|null, + * attrGroups?: Node\AttributeGroup[], + * } $subNodes Array of the following optional subnodes: + * 'flags => 0 : Flags + * 'byRef' => false : Whether to return by reference + * 'params' => array() : Parameters + * 'returnType' => null : Return type + * 'stmts' => array() : Statements + * 'attrGroups' => array() : PHP attribute groups + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct($name, array $subNodes = [], array $attributes = []) { + $this->attributes = $attributes; + $this->flags = $subNodes['flags'] ?? $subNodes['type'] ?? 0; + $this->byRef = $subNodes['byRef'] ?? false; + $this->name = \is_string($name) ? new Node\Identifier($name) : $name; + $this->params = $subNodes['params'] ?? []; + $this->returnType = $subNodes['returnType'] ?? null; + $this->stmts = array_key_exists('stmts', $subNodes) ? $subNodes['stmts'] : []; + $this->attrGroups = $subNodes['attrGroups'] ?? []; + } + + public function getSubNodeNames(): array { + return ['attrGroups', 'flags', 'byRef', 'name', 'params', 'returnType', 'stmts']; + } + + public function returnsByRef(): bool { + return $this->byRef; + } + + public function getParams(): array { + return $this->params; + } + + public function getReturnType() { + return $this->returnType; + } + + public function getStmts(): ?array { + return $this->stmts; + } + + public function getAttrGroups(): array { + return $this->attrGroups; + } + + /** + * Whether the method is explicitly or implicitly public. + */ + public function isPublic(): bool { + return ($this->flags & Modifiers::PUBLIC) !== 0 + || ($this->flags & Modifiers::VISIBILITY_MASK) === 0; + } + + /** + * Whether the method is protected. + */ + public function isProtected(): bool { + return (bool) ($this->flags & Modifiers::PROTECTED); + } + + /** + * Whether the method is private. + */ + public function isPrivate(): bool { + return (bool) ($this->flags & Modifiers::PRIVATE); + } + + /** + * Whether the method is abstract. + */ + public function isAbstract(): bool { + return (bool) ($this->flags & Modifiers::ABSTRACT); + } + + /** + * Whether the method is final. + */ + public function isFinal(): bool { + return (bool) ($this->flags & Modifiers::FINAL); + } + + /** + * Whether the method is static. + */ + public function isStatic(): bool { + return (bool) ($this->flags & Modifiers::STATIC); + } + + /** + * Whether the method is magic. + */ + public function isMagic(): bool { + return isset(self::$magicNames[$this->name->toLowerString()]); + } + + public function getType(): string { + return 'Stmt_ClassMethod'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php new file mode 100644 index 00000000..3f492b7b --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php @@ -0,0 +1,94 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Modifiers; +use PhpParser\Node; + +class Class_ extends ClassLike { + /** @deprecated Use Modifiers::PUBLIC instead */ + public const MODIFIER_PUBLIC = 1; + /** @deprecated Use Modifiers::PROTECTED instead */ + public const MODIFIER_PROTECTED = 2; + /** @deprecated Use Modifiers::PRIVATE instead */ + public const MODIFIER_PRIVATE = 4; + /** @deprecated Use Modifiers::STATIC instead */ + public const MODIFIER_STATIC = 8; + /** @deprecated Use Modifiers::ABSTRACT instead */ + public const MODIFIER_ABSTRACT = 16; + /** @deprecated Use Modifiers::FINAL instead */ + public const MODIFIER_FINAL = 32; + /** @deprecated Use Modifiers::READONLY instead */ + public const MODIFIER_READONLY = 64; + + /** @deprecated Use Modifiers::VISIBILITY_MASK instead */ + public const VISIBILITY_MODIFIER_MASK = 7; // 1 | 2 | 4 + + /** @var int Modifiers */ + public int $flags; + /** @var null|Node\Name Name of extended class */ + public ?Node\Name $extends; + /** @var Node\Name[] Names of implemented interfaces */ + public array $implements; + + /** + * Constructs a class node. + * + * @param string|Node\Identifier|null $name Name + * @param array{ + * flags?: int, + * extends?: Node\Name|null, + * implements?: Node\Name[], + * stmts?: Node\Stmt[], + * attrGroups?: Node\AttributeGroup[], + * } $subNodes Array of the following optional subnodes: + * 'flags' => 0 : Flags + * 'extends' => null : Name of extended class + * 'implements' => array(): Names of implemented interfaces + * 'stmts' => array(): Statements + * 'attrGroups' => array(): PHP attribute groups + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct($name, array $subNodes = [], array $attributes = []) { + $this->attributes = $attributes; + $this->flags = $subNodes['flags'] ?? $subNodes['type'] ?? 0; + $this->name = \is_string($name) ? new Node\Identifier($name) : $name; + $this->extends = $subNodes['extends'] ?? null; + $this->implements = $subNodes['implements'] ?? []; + $this->stmts = $subNodes['stmts'] ?? []; + $this->attrGroups = $subNodes['attrGroups'] ?? []; + } + + public function getSubNodeNames(): array { + return ['attrGroups', 'flags', 'name', 'extends', 'implements', 'stmts']; + } + + /** + * Whether the class is explicitly abstract. + */ + public function isAbstract(): bool { + return (bool) ($this->flags & Modifiers::ABSTRACT); + } + + /** + * Whether the class is final. + */ + public function isFinal(): bool { + return (bool) ($this->flags & Modifiers::FINAL); + } + + public function isReadonly(): bool { + return (bool) ($this->flags & Modifiers::READONLY); + } + + /** + * Whether the class is anonymous. + */ + public function isAnonymous(): bool { + return null === $this->name; + } + + public function getType(): string { + return 'Stmt_Class'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php new file mode 100644 index 00000000..f1165fd0 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +class Const_ extends Node\Stmt { + /** @var Node\Const_[] Constant declarations */ + public array $consts; + + /** + * Constructs a const list node. + * + * @param Node\Const_[] $consts Constant declarations + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $consts, array $attributes = []) { + $this->attributes = $attributes; + $this->consts = $consts; + } + + public function getSubNodeNames(): array { + return ['consts']; + } + + public function getType(): string { + return 'Stmt_Const'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php new file mode 100644 index 00000000..54e979dd --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +class Continue_ extends Node\Stmt { + /** @var null|Node\Expr Number of loops to continue */ + public ?Node\Expr $num; + + /** + * Constructs a continue node. + * + * @param null|Node\Expr $num Number of loops to continue + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(?Node\Expr $num = null, array $attributes = []) { + $this->attributes = $attributes; + $this->num = $num; + } + + public function getSubNodeNames(): array { + return ['num']; + } + + public function getType(): string { + return 'Stmt_Continue'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php new file mode 100644 index 00000000..cb9e8376 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php @@ -0,0 +1,3 @@ +<?php declare(strict_types=1); + +require __DIR__ . '/../DeclareItem.php'; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php new file mode 100644 index 00000000..3c0547bd --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php @@ -0,0 +1,34 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; +use PhpParser\Node\DeclareItem; + +class Declare_ extends Node\Stmt { + /** @var DeclareItem[] List of declares */ + public array $declares; + /** @var Node\Stmt[]|null Statements */ + public ?array $stmts; + + /** + * Constructs a declare node. + * + * @param DeclareItem[] $declares List of declares + * @param Node\Stmt[]|null $stmts Statements + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $declares, ?array $stmts = null, array $attributes = []) { + $this->attributes = $attributes; + $this->declares = $declares; + $this->stmts = $stmts; + } + + public function getSubNodeNames(): array { + return ['declares', 'stmts']; + } + + public function getType(): string { + return 'Stmt_Declare'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php new file mode 100644 index 00000000..61244428 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php @@ -0,0 +1,33 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +class Do_ extends Node\Stmt { + /** @var Node\Stmt[] Statements */ + public array $stmts; + /** @var Node\Expr Condition */ + public Node\Expr $cond; + + /** + * Constructs a do while node. + * + * @param Node\Expr $cond Condition + * @param Node\Stmt[] $stmts Statements + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Node\Expr $cond, array $stmts = [], array $attributes = []) { + $this->attributes = $attributes; + $this->cond = $cond; + $this->stmts = $stmts; + } + + public function getSubNodeNames(): array { + return ['stmts', 'cond']; + } + + public function getType(): string { + return 'Stmt_Do'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php new file mode 100644 index 00000000..4d424523 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +class Echo_ extends Node\Stmt { + /** @var Node\Expr[] Expressions */ + public array $exprs; + + /** + * Constructs an echo node. + * + * @param Node\Expr[] $exprs Expressions + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $exprs, array $attributes = []) { + $this->attributes = $attributes; + $this->exprs = $exprs; + } + + public function getSubNodeNames(): array { + return ['exprs']; + } + + public function getType(): string { + return 'Stmt_Echo'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php new file mode 100644 index 00000000..b26d59ce --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php @@ -0,0 +1,33 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +class ElseIf_ extends Node\Stmt { + /** @var Node\Expr Condition */ + public Node\Expr $cond; + /** @var Node\Stmt[] Statements */ + public array $stmts; + + /** + * Constructs an elseif node. + * + * @param Node\Expr $cond Condition + * @param Node\Stmt[] $stmts Statements + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Node\Expr $cond, array $stmts = [], array $attributes = []) { + $this->attributes = $attributes; + $this->cond = $cond; + $this->stmts = $stmts; + } + + public function getSubNodeNames(): array { + return ['cond', 'stmts']; + } + + public function getType(): string { + return 'Stmt_ElseIf'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php new file mode 100644 index 00000000..3d2b066e --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +class Else_ extends Node\Stmt { + /** @var Node\Stmt[] Statements */ + public array $stmts; + + /** + * Constructs an else node. + * + * @param Node\Stmt[] $stmts Statements + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $stmts = [], array $attributes = []) { + $this->attributes = $attributes; + $this->stmts = $stmts; + } + + public function getSubNodeNames(): array { + return ['stmts']; + } + + public function getType(): string { + return 'Stmt_Else'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/EnumCase.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/EnumCase.php new file mode 100644 index 00000000..c071a0af --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/EnumCase.php @@ -0,0 +1,36 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; +use PhpParser\Node\AttributeGroup; + +class EnumCase extends Node\Stmt { + /** @var Node\Identifier Enum case name */ + public Node\Identifier $name; + /** @var Node\Expr|null Enum case expression */ + public ?Node\Expr $expr; + /** @var Node\AttributeGroup[] PHP attribute groups */ + public array $attrGroups; + + /** + * @param string|Node\Identifier $name Enum case name + * @param Node\Expr|null $expr Enum case expression + * @param list<AttributeGroup> $attrGroups PHP attribute groups + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct($name, ?Node\Expr $expr = null, array $attrGroups = [], array $attributes = []) { + parent::__construct($attributes); + $this->name = \is_string($name) ? new Node\Identifier($name) : $name; + $this->expr = $expr; + $this->attrGroups = $attrGroups; + } + + public function getSubNodeNames(): array { + return ['attrGroups', 'name', 'expr']; + } + + public function getType(): string { + return 'Stmt_EnumCase'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Enum_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Enum_.php new file mode 100644 index 00000000..7eea6a69 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Enum_.php @@ -0,0 +1,44 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +class Enum_ extends ClassLike { + /** @var null|Node\Identifier Scalar Type */ + public ?Node $scalarType; + /** @var Node\Name[] Names of implemented interfaces */ + public array $implements; + + /** + * @param string|Node\Identifier|null $name Name + * @param array{ + * scalarType?: Node\Identifier|null, + * implements?: Node\Name[], + * stmts?: Node\Stmt[], + * attrGroups?: Node\AttributeGroup[], + * } $subNodes Array of the following optional subnodes: + * 'scalarType' => null : Scalar type + * 'implements' => array() : Names of implemented interfaces + * 'stmts' => array() : Statements + * 'attrGroups' => array() : PHP attribute groups + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct($name, array $subNodes = [], array $attributes = []) { + $this->name = \is_string($name) ? new Node\Identifier($name) : $name; + $this->scalarType = $subNodes['scalarType'] ?? null; + $this->implements = $subNodes['implements'] ?? []; + $this->stmts = $subNodes['stmts'] ?? []; + $this->attrGroups = $subNodes['attrGroups'] ?? []; + + parent::__construct($attributes); + } + + public function getSubNodeNames(): array { + return ['attrGroups', 'name', 'scalarType', 'implements', 'stmts']; + } + + public function getType(): string { + return 'Stmt_Enum'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Expression.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Expression.php new file mode 100644 index 00000000..89751fa2 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Expression.php @@ -0,0 +1,32 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +/** + * Represents statements of type "expr;" + */ +class Expression extends Node\Stmt { + /** @var Node\Expr Expression */ + public Node\Expr $expr; + + /** + * Constructs an expression statement. + * + * @param Node\Expr $expr Expression + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Node\Expr $expr, array $attributes = []) { + $this->attributes = $attributes; + $this->expr = $expr; + } + + public function getSubNodeNames(): array { + return ['expr']; + } + + public function getType(): string { + return 'Stmt_Expression'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Finally_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Finally_.php new file mode 100644 index 00000000..69ecf253 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Finally_.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +class Finally_ extends Node\Stmt { + /** @var Node\Stmt[] Statements */ + public array $stmts; + + /** + * Constructs a finally node. + * + * @param Node\Stmt[] $stmts Statements + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $stmts = [], array $attributes = []) { + $this->attributes = $attributes; + $this->stmts = $stmts; + } + + public function getSubNodeNames(): array { + return ['stmts']; + } + + public function getType(): string { + return 'Stmt_Finally'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php new file mode 100644 index 00000000..6f2fbb9e --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php @@ -0,0 +1,47 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +class For_ extends Node\Stmt { + /** @var Node\Expr[] Init expressions */ + public array $init; + /** @var Node\Expr[] Loop conditions */ + public array $cond; + /** @var Node\Expr[] Loop expressions */ + public array $loop; + /** @var Node\Stmt[] Statements */ + public array $stmts; + + /** + * Constructs a for loop node. + * + * @param array{ + * init?: Node\Expr[], + * cond?: Node\Expr[], + * loop?: Node\Expr[], + * stmts?: Node\Stmt[], + * } $subNodes Array of the following optional subnodes: + * 'init' => array(): Init expressions + * 'cond' => array(): Loop conditions + * 'loop' => array(): Loop expressions + * 'stmts' => array(): Statements + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $subNodes = [], array $attributes = []) { + $this->attributes = $attributes; + $this->init = $subNodes['init'] ?? []; + $this->cond = $subNodes['cond'] ?? []; + $this->loop = $subNodes['loop'] ?? []; + $this->stmts = $subNodes['stmts'] ?? []; + } + + public function getSubNodeNames(): array { + return ['init', 'cond', 'loop', 'stmts']; + } + + public function getType(): string { + return 'Stmt_For'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php new file mode 100644 index 00000000..c5d9a8b1 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php @@ -0,0 +1,50 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +class Foreach_ extends Node\Stmt { + /** @var Node\Expr Expression to iterate */ + public Node\Expr $expr; + /** @var null|Node\Expr Variable to assign key to */ + public ?Node\Expr $keyVar; + /** @var bool Whether to assign value by reference */ + public bool $byRef; + /** @var Node\Expr Variable to assign value to */ + public Node\Expr $valueVar; + /** @var Node\Stmt[] Statements */ + public array $stmts; + + /** + * Constructs a foreach node. + * + * @param Node\Expr $expr Expression to iterate + * @param Node\Expr $valueVar Variable to assign value to + * @param array{ + * keyVar?: Node\Expr|null, + * byRef?: bool, + * stmts?: Node\Stmt[], + * } $subNodes Array of the following optional subnodes: + * 'keyVar' => null : Variable to assign key to + * 'byRef' => false : Whether to assign value by reference + * 'stmts' => array(): Statements + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Node\Expr $expr, Node\Expr $valueVar, array $subNodes = [], array $attributes = []) { + $this->attributes = $attributes; + $this->expr = $expr; + $this->keyVar = $subNodes['keyVar'] ?? null; + $this->byRef = $subNodes['byRef'] ?? false; + $this->valueVar = $valueVar; + $this->stmts = $subNodes['stmts'] ?? []; + } + + public function getSubNodeNames(): array { + return ['expr', 'keyVar', 'byRef', 'valueVar', 'stmts']; + } + + public function getType(): string { + return 'Stmt_Foreach'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php new file mode 100644 index 00000000..2111bab7 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php @@ -0,0 +1,81 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; +use PhpParser\Node\FunctionLike; + +class Function_ extends Node\Stmt implements FunctionLike { + /** @var bool Whether function returns by reference */ + public bool $byRef; + /** @var Node\Identifier Name */ + public Node\Identifier $name; + /** @var Node\Param[] Parameters */ + public array $params; + /** @var null|Node\Identifier|Node\Name|Node\ComplexType Return type */ + public ?Node $returnType; + /** @var Node\Stmt[] Statements */ + public array $stmts; + /** @var Node\AttributeGroup[] PHP attribute groups */ + public array $attrGroups; + + /** @var Node\Name|null Namespaced name (if using NameResolver) */ + public ?Node\Name $namespacedName; + + /** + * Constructs a function node. + * + * @param string|Node\Identifier $name Name + * @param array{ + * byRef?: bool, + * params?: Node\Param[], + * returnType?: null|Node\Identifier|Node\Name|Node\ComplexType, + * stmts?: Node\Stmt[], + * attrGroups?: Node\AttributeGroup[], + * } $subNodes Array of the following optional subnodes: + * 'byRef' => false : Whether to return by reference + * 'params' => array(): Parameters + * 'returnType' => null : Return type + * 'stmts' => array(): Statements + * 'attrGroups' => array(): PHP attribute groups + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct($name, array $subNodes = [], array $attributes = []) { + $this->attributes = $attributes; + $this->byRef = $subNodes['byRef'] ?? false; + $this->name = \is_string($name) ? new Node\Identifier($name) : $name; + $this->params = $subNodes['params'] ?? []; + $this->returnType = $subNodes['returnType'] ?? null; + $this->stmts = $subNodes['stmts'] ?? []; + $this->attrGroups = $subNodes['attrGroups'] ?? []; + } + + public function getSubNodeNames(): array { + return ['attrGroups', 'byRef', 'name', 'params', 'returnType', 'stmts']; + } + + public function returnsByRef(): bool { + return $this->byRef; + } + + public function getParams(): array { + return $this->params; + } + + public function getReturnType() { + return $this->returnType; + } + + public function getAttrGroups(): array { + return $this->attrGroups; + } + + /** @return Node\Stmt[] */ + public function getStmts(): array { + return $this->stmts; + } + + public function getType(): string { + return 'Stmt_Function'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php new file mode 100644 index 00000000..d3ab12fc --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +class Global_ extends Node\Stmt { + /** @var Node\Expr[] Variables */ + public array $vars; + + /** + * Constructs a global variables list node. + * + * @param Node\Expr[] $vars Variables to unset + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $vars, array $attributes = []) { + $this->attributes = $attributes; + $this->vars = $vars; + } + + public function getSubNodeNames(): array { + return ['vars']; + } + + public function getType(): string { + return 'Stmt_Global'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php new file mode 100644 index 00000000..26a0d01e --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php @@ -0,0 +1,30 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node\Identifier; +use PhpParser\Node\Stmt; + +class Goto_ extends Stmt { + /** @var Identifier Name of label to jump to */ + public Identifier $name; + + /** + * Constructs a goto node. + * + * @param string|Identifier $name Name of label to jump to + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct($name, array $attributes = []) { + $this->attributes = $attributes; + $this->name = \is_string($name) ? new Identifier($name) : $name; + } + + public function getSubNodeNames(): array { + return ['name']; + } + + public function getType(): string { + return 'Stmt_Goto'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php new file mode 100644 index 00000000..0ec8e9d4 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php @@ -0,0 +1,41 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node\Name; +use PhpParser\Node\Stmt; +use PhpParser\Node\UseItem; + +class GroupUse extends Stmt { + /** + * @var Use_::TYPE_* Type of group use + */ + public int $type; + /** @var Name Prefix for uses */ + public Name $prefix; + /** @var UseItem[] Uses */ + public array $uses; + + /** + * Constructs a group use node. + * + * @param Name $prefix Prefix for uses + * @param UseItem[] $uses Uses + * @param Use_::TYPE_* $type Type of group use + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Name $prefix, array $uses, int $type = Use_::TYPE_NORMAL, array $attributes = []) { + $this->attributes = $attributes; + $this->type = $type; + $this->prefix = $prefix; + $this->uses = $uses; + } + + public function getSubNodeNames(): array { + return ['type', 'prefix', 'uses']; + } + + public function getType(): string { + return 'Stmt_GroupUse'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php new file mode 100644 index 00000000..665bacde --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node\Stmt; + +class HaltCompiler extends Stmt { + /** @var string Remaining text after halt compiler statement. */ + public string $remaining; + + /** + * Constructs a __halt_compiler node. + * + * @param string $remaining Remaining text after halt compiler statement. + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(string $remaining, array $attributes = []) { + $this->attributes = $attributes; + $this->remaining = $remaining; + } + + public function getSubNodeNames(): array { + return ['remaining']; + } + + public function getType(): string { + return 'Stmt_HaltCompiler'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php new file mode 100644 index 00000000..544390ff --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php @@ -0,0 +1,46 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +class If_ extends Node\Stmt { + /** @var Node\Expr Condition expression */ + public Node\Expr $cond; + /** @var Node\Stmt[] Statements */ + public array $stmts; + /** @var ElseIf_[] Elseif clauses */ + public array $elseifs; + /** @var null|Else_ Else clause */ + public ?Else_ $else; + + /** + * Constructs an if node. + * + * @param Node\Expr $cond Condition + * @param array{ + * stmts?: Node\Stmt[], + * elseifs?: ElseIf_[], + * else?: Else_|null, + * } $subNodes Array of the following optional subnodes: + * 'stmts' => array(): Statements + * 'elseifs' => array(): Elseif clauses + * 'else' => null : Else clause + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Node\Expr $cond, array $subNodes = [], array $attributes = []) { + $this->attributes = $attributes; + $this->cond = $cond; + $this->stmts = $subNodes['stmts'] ?? []; + $this->elseifs = $subNodes['elseifs'] ?? []; + $this->else = $subNodes['else'] ?? null; + } + + public function getSubNodeNames(): array { + return ['cond', 'stmts', 'elseifs', 'else']; + } + + public function getType(): string { + return 'Stmt_If'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php new file mode 100644 index 00000000..0515d020 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node\Stmt; + +class InlineHTML extends Stmt { + /** @var string String */ + public string $value; + + /** + * Constructs an inline HTML node. + * + * @param string $value String + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(string $value, array $attributes = []) { + $this->attributes = $attributes; + $this->value = $value; + } + + public function getSubNodeNames(): array { + return ['value']; + } + + public function getType(): string { + return 'Stmt_InlineHTML'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php new file mode 100644 index 00000000..9359064f --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php @@ -0,0 +1,40 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +class Interface_ extends ClassLike { + /** @var Node\Name[] Extended interfaces */ + public array $extends; + + /** + * Constructs a class node. + * + * @param string|Node\Identifier $name Name + * @param array{ + * extends?: Node\Name[], + * stmts?: Node\Stmt[], + * attrGroups?: Node\AttributeGroup[], + * } $subNodes Array of the following optional subnodes: + * 'extends' => array(): Name of extended interfaces + * 'stmts' => array(): Statements + * 'attrGroups' => array(): PHP attribute groups + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct($name, array $subNodes = [], array $attributes = []) { + $this->attributes = $attributes; + $this->name = \is_string($name) ? new Node\Identifier($name) : $name; + $this->extends = $subNodes['extends'] ?? []; + $this->stmts = $subNodes['stmts'] ?? []; + $this->attrGroups = $subNodes['attrGroups'] ?? []; + } + + public function getSubNodeNames(): array { + return ['attrGroups', 'name', 'extends', 'stmts']; + } + + public function getType(): string { + return 'Stmt_Interface'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php new file mode 100644 index 00000000..658468d2 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php @@ -0,0 +1,30 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node\Identifier; +use PhpParser\Node\Stmt; + +class Label extends Stmt { + /** @var Identifier Name */ + public Identifier $name; + + /** + * Constructs a label node. + * + * @param string|Identifier $name Name + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct($name, array $attributes = []) { + $this->attributes = $attributes; + $this->name = \is_string($name) ? new Identifier($name) : $name; + } + + public function getSubNodeNames(): array { + return ['name']; + } + + public function getType(): string { + return 'Stmt_Label'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php new file mode 100644 index 00000000..f5b59ad6 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php @@ -0,0 +1,37 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +class Namespace_ extends Node\Stmt { + /* For use in the "kind" attribute */ + public const KIND_SEMICOLON = 1; + public const KIND_BRACED = 2; + + /** @var null|Node\Name Name */ + public ?Node\Name $name; + /** @var Node\Stmt[] Statements */ + public $stmts; + + /** + * Constructs a namespace node. + * + * @param null|Node\Name $name Name + * @param null|Node\Stmt[] $stmts Statements + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(?Node\Name $name = null, ?array $stmts = [], array $attributes = []) { + $this->attributes = $attributes; + $this->name = $name; + $this->stmts = $stmts; + } + + public function getSubNodeNames(): array { + return ['name', 'stmts']; + } + + public function getType(): string { + return 'Stmt_Namespace'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php new file mode 100644 index 00000000..3acfa46f --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php @@ -0,0 +1,16 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +/** Nop/empty statement (;). */ +class Nop extends Node\Stmt { + public function getSubNodeNames(): array { + return []; + } + + public function getType(): string { + return 'Stmt_Nop'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Property.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Property.php new file mode 100644 index 00000000..872ea6b7 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Property.php @@ -0,0 +1,82 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Modifiers; +use PhpParser\Node; +use PhpParser\Node\ComplexType; +use PhpParser\Node\Identifier; +use PhpParser\Node\Name; +use PhpParser\Node\PropertyItem; + +class Property extends Node\Stmt { + /** @var int Modifiers */ + public int $flags; + /** @var PropertyItem[] Properties */ + public array $props; + /** @var null|Identifier|Name|ComplexType Type declaration */ + public ?Node $type; + /** @var Node\AttributeGroup[] PHP attribute groups */ + public array $attrGroups; + + /** + * Constructs a class property list node. + * + * @param int $flags Modifiers + * @param PropertyItem[] $props Properties + * @param array<string, mixed> $attributes Additional attributes + * @param null|Identifier|Name|ComplexType $type Type declaration + * @param Node\AttributeGroup[] $attrGroups PHP attribute groups + */ + public function __construct(int $flags, array $props, array $attributes = [], ?Node $type = null, array $attrGroups = []) { + $this->attributes = $attributes; + $this->flags = $flags; + $this->props = $props; + $this->type = $type; + $this->attrGroups = $attrGroups; + } + + public function getSubNodeNames(): array { + return ['attrGroups', 'flags', 'type', 'props']; + } + + /** + * Whether the property is explicitly or implicitly public. + */ + public function isPublic(): bool { + return ($this->flags & Modifiers::PUBLIC) !== 0 + || ($this->flags & Modifiers::VISIBILITY_MASK) === 0; + } + + /** + * Whether the property is protected. + */ + public function isProtected(): bool { + return (bool) ($this->flags & Modifiers::PROTECTED); + } + + /** + * Whether the property is private. + */ + public function isPrivate(): bool { + return (bool) ($this->flags & Modifiers::PRIVATE); + } + + /** + * Whether the property is static. + */ + public function isStatic(): bool { + return (bool) ($this->flags & Modifiers::STATIC); + } + + /** + * Whether the property is readonly. + */ + public function isReadonly(): bool { + return (bool) ($this->flags & Modifiers::READONLY); + } + + public function getType(): string { + return 'Stmt_Property'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php new file mode 100644 index 00000000..4a21a880 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php @@ -0,0 +1,3 @@ +<?php declare(strict_types=1); + +require __DIR__ . '/../PropertyItem.php'; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php new file mode 100644 index 00000000..9c44cca8 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +class Return_ extends Node\Stmt { + /** @var null|Node\Expr Expression */ + public ?Node\Expr $expr; + + /** + * Constructs a return node. + * + * @param null|Node\Expr $expr Expression + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(?Node\Expr $expr = null, array $attributes = []) { + $this->attributes = $attributes; + $this->expr = $expr; + } + + public function getSubNodeNames(): array { + return ['expr']; + } + + public function getType(): string { + return 'Stmt_Return'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php new file mode 100644 index 00000000..88452e7f --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php @@ -0,0 +1,3 @@ +<?php declare(strict_types=1); + +require __DIR__ . '/../StaticVar.php'; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php new file mode 100644 index 00000000..a84de106 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php @@ -0,0 +1,30 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node\StaticVar; +use PhpParser\Node\Stmt; + +class Static_ extends Stmt { + /** @var StaticVar[] Variable definitions */ + public array $vars; + + /** + * Constructs a static variables list node. + * + * @param StaticVar[] $vars Variable definitions + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $vars, array $attributes = []) { + $this->attributes = $attributes; + $this->vars = $vars; + } + + public function getSubNodeNames(): array { + return ['vars']; + } + + public function getType(): string { + return 'Stmt_Static'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php new file mode 100644 index 00000000..21e5efa5 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php @@ -0,0 +1,33 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +class Switch_ extends Node\Stmt { + /** @var Node\Expr Condition */ + public Node\Expr $cond; + /** @var Case_[] Case list */ + public array $cases; + + /** + * Constructs a case node. + * + * @param Node\Expr $cond Condition + * @param Case_[] $cases Case list + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Node\Expr $cond, array $cases, array $attributes = []) { + $this->attributes = $attributes; + $this->cond = $cond; + $this->cases = $cases; + } + + public function getSubNodeNames(): array { + return ['cond', 'cases']; + } + + public function getType(): string { + return 'Stmt_Switch'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php new file mode 100644 index 00000000..7705a570 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php @@ -0,0 +1,33 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +class TraitUse extends Node\Stmt { + /** @var Node\Name[] Traits */ + public array $traits; + /** @var TraitUseAdaptation[] Adaptations */ + public array $adaptations; + + /** + * Constructs a trait use node. + * + * @param Node\Name[] $traits Traits + * @param TraitUseAdaptation[] $adaptations Adaptations + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $traits, array $adaptations = [], array $attributes = []) { + $this->attributes = $attributes; + $this->traits = $traits; + $this->adaptations = $adaptations; + } + + public function getSubNodeNames(): array { + return ['traits', 'adaptations']; + } + + public function getType(): string { + return 'Stmt_TraitUse'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php new file mode 100644 index 00000000..987bc88e --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php @@ -0,0 +1,12 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +abstract class TraitUseAdaptation extends Node\Stmt { + /** @var Node\Name|null Trait name */ + public ?Node\Name $trait; + /** @var Node\Identifier Method name */ + public Node\Identifier $method; +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php new file mode 100644 index 00000000..449671e7 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php @@ -0,0 +1,37 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt\TraitUseAdaptation; + +use PhpParser\Node; + +class Alias extends Node\Stmt\TraitUseAdaptation { + /** @var null|int New modifier */ + public ?int $newModifier; + /** @var null|Node\Identifier New name */ + public ?Node\Identifier $newName; + + /** + * Constructs a trait use precedence adaptation node. + * + * @param null|Node\Name $trait Trait name + * @param string|Node\Identifier $method Method name + * @param null|int $newModifier New modifier + * @param null|string|Node\Identifier $newName New name + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(?Node\Name $trait, $method, ?int $newModifier, $newName, array $attributes = []) { + $this->attributes = $attributes; + $this->trait = $trait; + $this->method = \is_string($method) ? new Node\Identifier($method) : $method; + $this->newModifier = $newModifier; + $this->newName = \is_string($newName) ? new Node\Identifier($newName) : $newName; + } + + public function getSubNodeNames(): array { + return ['trait', 'method', 'newModifier', 'newName']; + } + + public function getType(): string { + return 'Stmt_TraitUseAdaptation_Alias'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php new file mode 100644 index 00000000..7bc40837 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php @@ -0,0 +1,33 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt\TraitUseAdaptation; + +use PhpParser\Node; + +class Precedence extends Node\Stmt\TraitUseAdaptation { + /** @var Node\Name[] Overwritten traits */ + public array $insteadof; + + /** + * Constructs a trait use precedence adaptation node. + * + * @param Node\Name $trait Trait name + * @param string|Node\Identifier $method Method name + * @param Node\Name[] $insteadof Overwritten traits + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Node\Name $trait, $method, array $insteadof, array $attributes = []) { + $this->attributes = $attributes; + $this->trait = $trait; + $this->method = \is_string($method) ? new Node\Identifier($method) : $method; + $this->insteadof = $insteadof; + } + + public function getSubNodeNames(): array { + return ['trait', 'method', 'insteadof']; + } + + public function getType(): string { + return 'Stmt_TraitUseAdaptation_Precedence'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php new file mode 100644 index 00000000..5f2b3307 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php @@ -0,0 +1,34 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +class Trait_ extends ClassLike { + /** + * Constructs a trait node. + * + * @param string|Node\Identifier $name Name + * @param array{ + * stmts?: Node\Stmt[], + * attrGroups?: Node\AttributeGroup[], + * } $subNodes Array of the following optional subnodes: + * 'stmts' => array(): Statements + * 'attrGroups' => array(): PHP attribute groups + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct($name, array $subNodes = [], array $attributes = []) { + $this->attributes = $attributes; + $this->name = \is_string($name) ? new Node\Identifier($name) : $name; + $this->stmts = $subNodes['stmts'] ?? []; + $this->attrGroups = $subNodes['attrGroups'] ?? []; + } + + public function getSubNodeNames(): array { + return ['attrGroups', 'name', 'stmts']; + } + + public function getType(): string { + return 'Stmt_Trait'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php new file mode 100644 index 00000000..6414c46c --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php @@ -0,0 +1,37 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +class TryCatch extends Node\Stmt { + /** @var Node\Stmt[] Statements */ + public array $stmts; + /** @var Catch_[] Catches */ + public array $catches; + /** @var null|Finally_ Optional finally node */ + public ?Finally_ $finally; + + /** + * Constructs a try catch node. + * + * @param Node\Stmt[] $stmts Statements + * @param Catch_[] $catches Catches + * @param null|Finally_ $finally Optional finally node + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $stmts, array $catches, ?Finally_ $finally = null, array $attributes = []) { + $this->attributes = $attributes; + $this->stmts = $stmts; + $this->catches = $catches; + $this->finally = $finally; + } + + public function getSubNodeNames(): array { + return ['stmts', 'catches', 'finally']; + } + + public function getType(): string { + return 'Stmt_TryCatch'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php new file mode 100644 index 00000000..c211beb0 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php @@ -0,0 +1,29 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +class Unset_ extends Node\Stmt { + /** @var Node\Expr[] Variables to unset */ + public array $vars; + + /** + * Constructs an unset node. + * + * @param Node\Expr[] $vars Variables to unset + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $vars, array $attributes = []) { + $this->attributes = $attributes; + $this->vars = $vars; + } + + public function getSubNodeNames(): array { + return ['vars']; + } + + public function getType(): string { + return 'Stmt_Unset'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php new file mode 100644 index 00000000..85830edc --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php @@ -0,0 +1,3 @@ +<?php declare(strict_types=1); + +require __DIR__ . '/../UseItem.php'; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php new file mode 100644 index 00000000..5b2d8648 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php @@ -0,0 +1,47 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node\Stmt; +use PhpParser\Node\UseItem; + +class Use_ extends Stmt { + /** + * Unknown type. Both Stmt\Use_ / Stmt\GroupUse and Stmt\UseUse have a $type property, one of them will always be + * TYPE_UNKNOWN while the other has one of the three other possible types. For normal use statements the type on the + * Stmt\UseUse is unknown. It's only the other way around for mixed group use declarations. + */ + public const TYPE_UNKNOWN = 0; + /** Class or namespace import */ + public const TYPE_NORMAL = 1; + /** Function import */ + public const TYPE_FUNCTION = 2; + /** Constant import */ + public const TYPE_CONSTANT = 3; + + /** @var self::TYPE_* Type of alias */ + public int $type; + /** @var UseItem[] Aliases */ + public array $uses; + + /** + * Constructs an alias (use) list node. + * + * @param UseItem[] $uses Aliases + * @param Stmt\Use_::TYPE_* $type Type of alias + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $uses, int $type = self::TYPE_NORMAL, array $attributes = []) { + $this->attributes = $attributes; + $this->type = $type; + $this->uses = $uses; + } + + public function getSubNodeNames(): array { + return ['type', 'uses']; + } + + public function getType(): string { + return 'Stmt_Use'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php new file mode 100644 index 00000000..2f7aed23 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php @@ -0,0 +1,33 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node\Stmt; + +use PhpParser\Node; + +class While_ extends Node\Stmt { + /** @var Node\Expr Condition */ + public Node\Expr $cond; + /** @var Node\Stmt[] Statements */ + public array $stmts; + + /** + * Constructs a while node. + * + * @param Node\Expr $cond Condition + * @param Node\Stmt[] $stmts Statements + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Node\Expr $cond, array $stmts = [], array $attributes = []) { + $this->attributes = $attributes; + $this->cond = $cond; + $this->stmts = $stmts; + } + + public function getSubNodeNames(): array { + return ['cond', 'stmts']; + } + + public function getType(): string { + return 'Stmt_While'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/UnionType.php b/vendor/nikic/php-parser/lib/PhpParser/Node/UnionType.php new file mode 100644 index 00000000..bad88d2b --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/UnionType.php @@ -0,0 +1,27 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +class UnionType extends ComplexType { + /** @var (Identifier|Name|IntersectionType)[] Types */ + public array $types; + + /** + * Constructs a union type. + * + * @param (Identifier|Name|IntersectionType)[] $types Types + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $types, array $attributes = []) { + $this->attributes = $attributes; + $this->types = $types; + } + + public function getSubNodeNames(): array { + return ['types']; + } + + public function getType(): string { + return 'UnionType'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/UseItem.php b/vendor/nikic/php-parser/lib/PhpParser/Node/UseItem.php new file mode 100644 index 00000000..a7d9fc44 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/UseItem.php @@ -0,0 +1,55 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +use PhpParser\Node; +use PhpParser\NodeAbstract; +use PhpParser\Node\Stmt\Use_; + +class UseItem extends NodeAbstract { + /** + * @var Use_::TYPE_* One of the Stmt\Use_::TYPE_* constants. Will only differ from TYPE_UNKNOWN for mixed group uses + */ + public int $type; + /** @var Node\Name Namespace, class, function or constant to alias */ + public Name $name; + /** @var Identifier|null Alias */ + public ?Identifier $alias; + + /** + * Constructs an alias (use) item node. + * + * @param Node\Name $name Namespace/Class to alias + * @param null|string|Identifier $alias Alias + * @param Use_::TYPE_* $type Type of the use element (for mixed group use only) + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(Node\Name $name, $alias = null, int $type = Use_::TYPE_UNKNOWN, array $attributes = []) { + $this->attributes = $attributes; + $this->type = $type; + $this->name = $name; + $this->alias = \is_string($alias) ? new Identifier($alias) : $alias; + } + + public function getSubNodeNames(): array { + return ['type', 'name', 'alias']; + } + + /** + * Get alias. If not explicitly given this is the last component of the used name. + */ + public function getAlias(): Identifier { + if (null !== $this->alias) { + return $this->alias; + } + + return new Identifier($this->name->getLast()); + } + + public function getType(): string { + return 'UseItem'; + } +} + +// @deprecated compatibility alias +class_alias(UseItem::class, Stmt\UseUse::class); diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/VarLikeIdentifier.php b/vendor/nikic/php-parser/lib/PhpParser/Node/VarLikeIdentifier.php new file mode 100644 index 00000000..9baa6fe0 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/VarLikeIdentifier.php @@ -0,0 +1,16 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +/** + * Represents a name that is written in source code with a leading dollar, + * but is not a proper variable. The leading dollar is not stored as part of the name. + * + * Examples: Names in property declarations are formatted as variables. Names in static property + * lookups are also formatted as variables. + */ +class VarLikeIdentifier extends Identifier { + public function getType(): string { + return 'VarLikeIdentifier'; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/VariadicPlaceholder.php b/vendor/nikic/php-parser/lib/PhpParser/Node/VariadicPlaceholder.php new file mode 100644 index 00000000..48c4f338 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/VariadicPlaceholder.php @@ -0,0 +1,27 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Node; + +use PhpParser\NodeAbstract; + +/** + * Represents the "..." in "foo(...)" of the first-class callable syntax. + */ +class VariadicPlaceholder extends NodeAbstract { + /** + * Create a variadic argument placeholder (first-class callable syntax). + * + * @param array<string, mixed> $attributes Additional attributes + */ + public function __construct(array $attributes = []) { + $this->attributes = $attributes; + } + + public function getType(): string { + return 'VariadicPlaceholder'; + } + + public function getSubNodeNames(): array { + return []; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php b/vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php new file mode 100644 index 00000000..a6a50aea --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php @@ -0,0 +1,181 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +abstract class NodeAbstract implements Node, \JsonSerializable { + /** @var array<string, mixed> Attributes */ + protected array $attributes; + + /** + * Creates a Node. + * + * @param array<string, mixed> $attributes Array of attributes + */ + public function __construct(array $attributes = []) { + $this->attributes = $attributes; + } + + /** + * Gets line the node started in (alias of getStartLine). + * + * @return int Start line (or -1 if not available) + * @phpstan-return -1|positive-int + */ + public function getLine(): int { + return $this->attributes['startLine'] ?? -1; + } + + /** + * Gets line the node started in. + * + * Requires the 'startLine' attribute to be enabled in the lexer (enabled by default). + * + * @return int Start line (or -1 if not available) + * @phpstan-return -1|positive-int + */ + public function getStartLine(): int { + return $this->attributes['startLine'] ?? -1; + } + + /** + * Gets the line the node ended in. + * + * Requires the 'endLine' attribute to be enabled in the lexer (enabled by default). + * + * @return int End line (or -1 if not available) + * @phpstan-return -1|positive-int + */ + public function getEndLine(): int { + return $this->attributes['endLine'] ?? -1; + } + + /** + * Gets the token offset of the first token that is part of this node. + * + * The offset is an index into the array returned by Lexer::getTokens(). + * + * Requires the 'startTokenPos' attribute to be enabled in the lexer (DISABLED by default). + * + * @return int Token start position (or -1 if not available) + */ + public function getStartTokenPos(): int { + return $this->attributes['startTokenPos'] ?? -1; + } + + /** + * Gets the token offset of the last token that is part of this node. + * + * The offset is an index into the array returned by Lexer::getTokens(). + * + * Requires the 'endTokenPos' attribute to be enabled in the lexer (DISABLED by default). + * + * @return int Token end position (or -1 if not available) + */ + public function getEndTokenPos(): int { + return $this->attributes['endTokenPos'] ?? -1; + } + + /** + * Gets the file offset of the first character that is part of this node. + * + * Requires the 'startFilePos' attribute to be enabled in the lexer (DISABLED by default). + * + * @return int File start position (or -1 if not available) + */ + public function getStartFilePos(): int { + return $this->attributes['startFilePos'] ?? -1; + } + + /** + * Gets the file offset of the last character that is part of this node. + * + * Requires the 'endFilePos' attribute to be enabled in the lexer (DISABLED by default). + * + * @return int File end position (or -1 if not available) + */ + public function getEndFilePos(): int { + return $this->attributes['endFilePos'] ?? -1; + } + + /** + * Gets all comments directly preceding this node. + * + * The comments are also available through the "comments" attribute. + * + * @return Comment[] + */ + public function getComments(): array { + return $this->attributes['comments'] ?? []; + } + + /** + * Gets the doc comment of the node. + * + * @return null|Comment\Doc Doc comment object or null + */ + public function getDocComment(): ?Comment\Doc { + $comments = $this->getComments(); + for ($i = count($comments) - 1; $i >= 0; $i--) { + $comment = $comments[$i]; + if ($comment instanceof Comment\Doc) { + return $comment; + } + } + + return null; + } + + /** + * Sets the doc comment of the node. + * + * This will either replace an existing doc comment or add it to the comments array. + * + * @param Comment\Doc $docComment Doc comment to set + */ + public function setDocComment(Comment\Doc $docComment): void { + $comments = $this->getComments(); + for ($i = count($comments) - 1; $i >= 0; $i--) { + if ($comments[$i] instanceof Comment\Doc) { + // Replace existing doc comment. + $comments[$i] = $docComment; + $this->setAttribute('comments', $comments); + return; + } + } + + // Append new doc comment. + $comments[] = $docComment; + $this->setAttribute('comments', $comments); + } + + public function setAttribute(string $key, $value): void { + $this->attributes[$key] = $value; + } + + public function hasAttribute(string $key): bool { + return array_key_exists($key, $this->attributes); + } + + public function getAttribute(string $key, $default = null) { + if (array_key_exists($key, $this->attributes)) { + return $this->attributes[$key]; + } + + return $default; + } + + public function getAttributes(): array { + return $this->attributes; + } + + public function setAttributes(array $attributes): void { + $this->attributes = $attributes; + } + + /** + * @return array<string, mixed> + */ + public function jsonSerialize(): array { + return ['nodeType' => $this->getType()] + get_object_vars($this); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeDumper.php b/vendor/nikic/php-parser/lib/PhpParser/NodeDumper.php new file mode 100644 index 00000000..a2535de7 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeDumper.php @@ -0,0 +1,290 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +use PhpParser\Node\Expr\Array_; +use PhpParser\Node\Expr\Include_; +use PhpParser\Node\Expr\List_; +use PhpParser\Node\Scalar\Int_; +use PhpParser\Node\Scalar\InterpolatedString; +use PhpParser\Node\Scalar\String_; +use PhpParser\Node\Stmt\GroupUse; +use PhpParser\Node\Stmt\Use_; +use PhpParser\Node\UseItem; + +class NodeDumper { + private bool $dumpComments; + private bool $dumpPositions; + private bool $dumpOtherAttributes; + private ?string $code; + private string $res; + private string $nl; + + private const IGNORE_ATTRIBUTES = [ + 'comments' => true, + 'startLine' => true, + 'endLine' => true, + 'startFilePos' => true, + 'endFilePos' => true, + 'startTokenPos' => true, + 'endTokenPos' => true, + ]; + + /** + * Constructs a NodeDumper. + * + * Supported options: + * * bool dumpComments: Whether comments should be dumped. + * * bool dumpPositions: Whether line/offset information should be dumped. To dump offset + * information, the code needs to be passed to dump(). + * * bool dumpOtherAttributes: Whether non-comment, non-position attributes should be dumped. + * + * @param array $options Options (see description) + */ + public function __construct(array $options = []) { + $this->dumpComments = !empty($options['dumpComments']); + $this->dumpPositions = !empty($options['dumpPositions']); + $this->dumpOtherAttributes = !empty($options['dumpOtherAttributes']); + } + + /** + * Dumps a node or array. + * + * @param array|Node $node Node or array to dump + * @param string|null $code Code corresponding to dumped AST. This only needs to be passed if + * the dumpPositions option is enabled and the dumping of node offsets + * is desired. + * + * @return string Dumped value + */ + public function dump($node, ?string $code = null): string { + $this->code = $code; + $this->res = ''; + $this->nl = "\n"; + $this->dumpRecursive($node, false); + return $this->res; + } + + /** @param mixed $node */ + protected function dumpRecursive($node, bool $indent = true): void { + if ($indent) { + $this->nl .= " "; + } + if ($node instanceof Node) { + $this->res .= $node->getType(); + if ($this->dumpPositions && null !== $p = $this->dumpPosition($node)) { + $this->res .= $p; + } + $this->res .= '('; + + foreach ($node->getSubNodeNames() as $key) { + $this->res .= "$this->nl " . $key . ': '; + + $value = $node->$key; + if (\is_int($value)) { + if ('flags' === $key || 'newModifier' === $key) { + $this->res .= $this->dumpFlags($value); + continue; + } + if ('type' === $key && $node instanceof Include_) { + $this->res .= $this->dumpIncludeType($value); + continue; + } + if ('type' === $key + && ($node instanceof Use_ || $node instanceof UseItem || $node instanceof GroupUse)) { + $this->res .= $this->dumpUseType($value); + continue; + } + } + $this->dumpRecursive($value); + } + + if ($this->dumpComments && $comments = $node->getComments()) { + $this->res .= "$this->nl comments: "; + $this->dumpRecursive($comments); + } + + if ($this->dumpOtherAttributes) { + foreach ($node->getAttributes() as $key => $value) { + if (isset(self::IGNORE_ATTRIBUTES[$key])) { + continue; + } + + $this->res .= "$this->nl $key: "; + if (\is_int($value)) { + if ('kind' === $key) { + if ($node instanceof Int_) { + $this->res .= $this->dumpIntKind($value); + continue; + } + if ($node instanceof String_ || $node instanceof InterpolatedString) { + $this->res .= $this->dumpStringKind($value); + continue; + } + if ($node instanceof Array_) { + $this->res .= $this->dumpArrayKind($value); + continue; + } + if ($node instanceof List_) { + $this->res .= $this->dumpListKind($value); + continue; + } + } + } + $this->dumpRecursive($value); + } + } + $this->res .= "$this->nl)"; + } elseif (\is_array($node)) { + $this->res .= 'array('; + foreach ($node as $key => $value) { + $this->res .= "$this->nl " . $key . ': '; + $this->dumpRecursive($value); + } + $this->res .= "$this->nl)"; + } elseif ($node instanceof Comment) { + $this->res .= \str_replace("\n", $this->nl, $node->getReformattedText()); + } elseif (\is_string($node)) { + $this->res .= \str_replace("\n", $this->nl, (string)$node); + } elseif (\is_int($node) || \is_float($node)) { + $this->res .= $node; + } elseif (null === $node) { + $this->res .= 'null'; + } elseif (false === $node) { + $this->res .= 'false'; + } elseif (true === $node) { + $this->res .= 'true'; + } else { + throw new \InvalidArgumentException('Can only dump nodes and arrays.'); + } + if ($indent) { + $this->nl = \substr($this->nl, 0, -4); + } + } + + protected function dumpFlags(int $flags): string { + $strs = []; + if ($flags & Modifiers::PUBLIC) { + $strs[] = 'PUBLIC'; + } + if ($flags & Modifiers::PROTECTED) { + $strs[] = 'PROTECTED'; + } + if ($flags & Modifiers::PRIVATE) { + $strs[] = 'PRIVATE'; + } + if ($flags & Modifiers::ABSTRACT) { + $strs[] = 'ABSTRACT'; + } + if ($flags & Modifiers::STATIC) { + $strs[] = 'STATIC'; + } + if ($flags & Modifiers::FINAL) { + $strs[] = 'FINAL'; + } + if ($flags & Modifiers::READONLY) { + $strs[] = 'READONLY'; + } + + if ($strs) { + return implode(' | ', $strs) . ' (' . $flags . ')'; + } else { + return (string) $flags; + } + } + + /** @param array<int, string> $map */ + private function dumpEnum(int $value, array $map): string { + if (!isset($map[$value])) { + return (string) $value; + } + return $map[$value] . ' (' . $value . ')'; + } + + private function dumpIncludeType(int $type): string { + return $this->dumpEnum($type, [ + Include_::TYPE_INCLUDE => 'TYPE_INCLUDE', + Include_::TYPE_INCLUDE_ONCE => 'TYPE_INCLUDE_ONCE', + Include_::TYPE_REQUIRE => 'TYPE_REQUIRE', + Include_::TYPE_REQUIRE_ONCE => 'TYPE_REQUIRE_ONCE', + ]); + } + + private function dumpUseType(int $type): string { + return $this->dumpEnum($type, [ + Use_::TYPE_UNKNOWN => 'TYPE_UNKNOWN', + Use_::TYPE_NORMAL => 'TYPE_NORMAL', + Use_::TYPE_FUNCTION => 'TYPE_FUNCTION', + Use_::TYPE_CONSTANT => 'TYPE_CONSTANT', + ]); + } + + private function dumpIntKind(int $kind): string { + return $this->dumpEnum($kind, [ + Int_::KIND_BIN => 'KIND_BIN', + Int_::KIND_OCT => 'KIND_OCT', + Int_::KIND_DEC => 'KIND_DEC', + Int_::KIND_HEX => 'KIND_HEX', + ]); + } + + private function dumpStringKind(int $kind): string { + return $this->dumpEnum($kind, [ + String_::KIND_SINGLE_QUOTED => 'KIND_SINGLE_QUOTED', + String_::KIND_DOUBLE_QUOTED => 'KIND_DOUBLE_QUOTED', + String_::KIND_HEREDOC => 'KIND_HEREDOC', + String_::KIND_NOWDOC => 'KIND_NOWDOC', + ]); + } + + private function dumpArrayKind(int $kind): string { + return $this->dumpEnum($kind, [ + Array_::KIND_LONG => 'KIND_LONG', + Array_::KIND_SHORT => 'KIND_SHORT', + ]); + } + + private function dumpListKind(int $kind): string { + return $this->dumpEnum($kind, [ + List_::KIND_LIST => 'KIND_LIST', + List_::KIND_ARRAY => 'KIND_ARRAY', + ]); + } + + /** + * Dump node position, if possible. + * + * @param Node $node Node for which to dump position + * + * @return string|null Dump of position, or null if position information not available + */ + protected function dumpPosition(Node $node): ?string { + if (!$node->hasAttribute('startLine') || !$node->hasAttribute('endLine')) { + return null; + } + + $start = $node->getStartLine(); + $end = $node->getEndLine(); + if ($node->hasAttribute('startFilePos') && $node->hasAttribute('endFilePos') + && null !== $this->code + ) { + $start .= ':' . $this->toColumn($this->code, $node->getStartFilePos()); + $end .= ':' . $this->toColumn($this->code, $node->getEndFilePos()); + } + return "[$start - $end]"; + } + + // Copied from Error class + private function toColumn(string $code, int $pos): int { + if ($pos > strlen($code)) { + throw new \RuntimeException('Invalid position information'); + } + + $lineStartPos = strrpos($code, "\n", $pos - strlen($code)); + if (false === $lineStartPos) { + $lineStartPos = -1; + } + + return $pos - $lineStartPos; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeFinder.php b/vendor/nikic/php-parser/lib/PhpParser/NodeFinder.php new file mode 100644 index 00000000..96c84526 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeFinder.php @@ -0,0 +1,90 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +use PhpParser\NodeVisitor\FindingVisitor; +use PhpParser\NodeVisitor\FirstFindingVisitor; + +class NodeFinder { + /** + * Find all nodes satisfying a filter callback. + * + * @param Node|Node[] $nodes Single node or array of nodes to search in + * @param callable $filter Filter callback: function(Node $node) : bool + * + * @return Node[] Found nodes satisfying the filter callback + */ + public function find($nodes, callable $filter): array { + if ($nodes === []) { + return []; + } + + if (!is_array($nodes)) { + $nodes = [$nodes]; + } + + $visitor = new FindingVisitor($filter); + + $traverser = new NodeTraverser($visitor); + $traverser->traverse($nodes); + + return $visitor->getFoundNodes(); + } + + /** + * Find all nodes that are instances of a certain class. + + * @template TNode as Node + * + * @param Node|Node[] $nodes Single node or array of nodes to search in + * @param class-string<TNode> $class Class name + * + * @return TNode[] Found nodes (all instances of $class) + */ + public function findInstanceOf($nodes, string $class): array { + return $this->find($nodes, function ($node) use ($class) { + return $node instanceof $class; + }); + } + + /** + * Find first node satisfying a filter callback. + * + * @param Node|Node[] $nodes Single node or array of nodes to search in + * @param callable $filter Filter callback: function(Node $node) : bool + * + * @return null|Node Found node (or null if none found) + */ + public function findFirst($nodes, callable $filter): ?Node { + if ($nodes === []) { + return null; + } + + if (!is_array($nodes)) { + $nodes = [$nodes]; + } + + $visitor = new FirstFindingVisitor($filter); + + $traverser = new NodeTraverser($visitor); + $traverser->traverse($nodes); + + return $visitor->getFoundNode(); + } + + /** + * Find first node that is an instance of a certain class. + * + * @template TNode as Node + * + * @param Node|Node[] $nodes Single node or array of nodes to search in + * @param class-string<TNode> $class Class name + * + * @return null|TNode Found node, which is an instance of $class (or null if none found) + */ + public function findFirstInstanceOf($nodes, string $class): ?Node { + return $this->findFirst($nodes, function ($node) use ($class) { + return $node instanceof $class; + }); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php b/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php new file mode 100644 index 00000000..f5b868a1 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php @@ -0,0 +1,278 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +class NodeTraverser implements NodeTraverserInterface { + /** + * @deprecated Use NodeVisitor::DONT_TRAVERSE_CHILDREN instead. + */ + public const DONT_TRAVERSE_CHILDREN = NodeVisitor::DONT_TRAVERSE_CHILDREN; + + /** + * @deprecated Use NodeVisitor::STOP_TRAVERSAL instead. + */ + public const STOP_TRAVERSAL = NodeVisitor::STOP_TRAVERSAL; + + /** + * @deprecated Use NodeVisitor::REMOVE_NODE instead. + */ + public const REMOVE_NODE = NodeVisitor::REMOVE_NODE; + + /** + * @deprecated Use NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN instead. + */ + public const DONT_TRAVERSE_CURRENT_AND_CHILDREN = NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + + /** @var list<NodeVisitor> Visitors */ + protected array $visitors = []; + + /** @var bool Whether traversal should be stopped */ + protected bool $stopTraversal; + + /** + * Create a traverser with the given visitors. + * + * @param NodeVisitor ...$visitors Node visitors + */ + public function __construct(NodeVisitor ...$visitors) { + $this->visitors = $visitors; + } + + /** + * Adds a visitor. + * + * @param NodeVisitor $visitor Visitor to add + */ + public function addVisitor(NodeVisitor $visitor): void { + $this->visitors[] = $visitor; + } + + /** + * Removes an added visitor. + */ + public function removeVisitor(NodeVisitor $visitor): void { + $index = array_search($visitor, $this->visitors); + if ($index !== false) { + array_splice($this->visitors, $index, 1, []); + } + } + + /** + * Traverses an array of nodes using the registered visitors. + * + * @param Node[] $nodes Array of nodes + * + * @return Node[] Traversed array of nodes + */ + public function traverse(array $nodes): array { + $this->stopTraversal = false; + + foreach ($this->visitors as $visitor) { + if (null !== $return = $visitor->beforeTraverse($nodes)) { + $nodes = $return; + } + } + + $nodes = $this->traverseArray($nodes); + + for ($i = \count($this->visitors) - 1; $i >= 0; --$i) { + $visitor = $this->visitors[$i]; + if (null !== $return = $visitor->afterTraverse($nodes)) { + $nodes = $return; + } + } + + return $nodes; + } + + /** + * Recursively traverse a node. + * + * @param Node $node Node to traverse. + */ + protected function traverseNode(Node $node): void { + foreach ($node->getSubNodeNames() as $name) { + $subNode = $node->$name; + + if (\is_array($subNode)) { + $node->$name = $this->traverseArray($subNode); + if ($this->stopTraversal) { + break; + } + } elseif ($subNode instanceof Node) { + $traverseChildren = true; + $visitorIndex = -1; + + foreach ($this->visitors as $visitorIndex => $visitor) { + $return = $visitor->enterNode($subNode); + if (null !== $return) { + if ($return instanceof Node) { + $this->ensureReplacementReasonable($subNode, $return); + $subNode = $node->$name = $return; + } elseif (NodeVisitor::DONT_TRAVERSE_CHILDREN === $return) { + $traverseChildren = false; + } elseif (NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN === $return) { + $traverseChildren = false; + break; + } elseif (NodeVisitor::STOP_TRAVERSAL === $return) { + $this->stopTraversal = true; + break 2; + } elseif (NodeVisitor::REPLACE_WITH_NULL === $return) { + $node->$name = null; + continue 2; + } else { + throw new \LogicException( + 'enterNode() returned invalid value of type ' . gettype($return) + ); + } + } + } + + if ($traverseChildren) { + $this->traverseNode($subNode); + if ($this->stopTraversal) { + break; + } + } + + for (; $visitorIndex >= 0; --$visitorIndex) { + $visitor = $this->visitors[$visitorIndex]; + $return = $visitor->leaveNode($subNode); + + if (null !== $return) { + if ($return instanceof Node) { + $this->ensureReplacementReasonable($subNode, $return); + $subNode = $node->$name = $return; + } elseif (NodeVisitor::STOP_TRAVERSAL === $return) { + $this->stopTraversal = true; + break 2; + } elseif (NodeVisitor::REPLACE_WITH_NULL === $return) { + $node->$name = null; + break; + } elseif (\is_array($return)) { + throw new \LogicException( + 'leaveNode() may only return an array ' . + 'if the parent structure is an array' + ); + } else { + throw new \LogicException( + 'leaveNode() returned invalid value of type ' . gettype($return) + ); + } + } + } + } + } + } + + /** + * Recursively traverse array (usually of nodes). + * + * @param array $nodes Array to traverse + * + * @return array Result of traversal (may be original array or changed one) + */ + protected function traverseArray(array $nodes): array { + $doNodes = []; + + foreach ($nodes as $i => $node) { + if ($node instanceof Node) { + $traverseChildren = true; + $visitorIndex = -1; + + foreach ($this->visitors as $visitorIndex => $visitor) { + $return = $visitor->enterNode($node); + if (null !== $return) { + if ($return instanceof Node) { + $this->ensureReplacementReasonable($node, $return); + $nodes[$i] = $node = $return; + } elseif (\is_array($return)) { + $doNodes[] = [$i, $return]; + continue 2; + } elseif (NodeVisitor::REMOVE_NODE === $return) { + $doNodes[] = [$i, []]; + continue 2; + } elseif (NodeVisitor::DONT_TRAVERSE_CHILDREN === $return) { + $traverseChildren = false; + } elseif (NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN === $return) { + $traverseChildren = false; + break; + } elseif (NodeVisitor::STOP_TRAVERSAL === $return) { + $this->stopTraversal = true; + break 2; + } elseif (NodeVisitor::REPLACE_WITH_NULL === $return) { + throw new \LogicException( + 'REPLACE_WITH_NULL can not be used if the parent structure is an array'); + } else { + throw new \LogicException( + 'enterNode() returned invalid value of type ' . gettype($return) + ); + } + } + } + + if ($traverseChildren) { + $this->traverseNode($node); + if ($this->stopTraversal) { + break; + } + } + + for (; $visitorIndex >= 0; --$visitorIndex) { + $visitor = $this->visitors[$visitorIndex]; + $return = $visitor->leaveNode($node); + + if (null !== $return) { + if ($return instanceof Node) { + $this->ensureReplacementReasonable($node, $return); + $nodes[$i] = $node = $return; + } elseif (\is_array($return)) { + $doNodes[] = [$i, $return]; + break; + } elseif (NodeVisitor::REMOVE_NODE === $return) { + $doNodes[] = [$i, []]; + break; + } elseif (NodeVisitor::STOP_TRAVERSAL === $return) { + $this->stopTraversal = true; + break 2; + } elseif (NodeVisitor::REPLACE_WITH_NULL === $return) { + throw new \LogicException( + 'REPLACE_WITH_NULL can not be used if the parent structure is an array'); + } else { + throw new \LogicException( + 'leaveNode() returned invalid value of type ' . gettype($return) + ); + } + } + } + } elseif (\is_array($node)) { + throw new \LogicException('Invalid node structure: Contains nested arrays'); + } + } + + if (!empty($doNodes)) { + while (list($i, $replace) = array_pop($doNodes)) { + array_splice($nodes, $i, 1, $replace); + } + } + + return $nodes; + } + + private function ensureReplacementReasonable(Node $old, Node $new): void { + if ($old instanceof Node\Stmt && $new instanceof Node\Expr) { + throw new \LogicException( + "Trying to replace statement ({$old->getType()}) " . + "with expression ({$new->getType()}). Are you missing a " . + "Stmt_Expression wrapper?" + ); + } + + if ($old instanceof Node\Expr && $new instanceof Node\Stmt) { + throw new \LogicException( + "Trying to replace expression ({$old->getType()}) " . + "with statement ({$new->getType()})" + ); + } + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php b/vendor/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php new file mode 100644 index 00000000..c3992b3d --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php @@ -0,0 +1,26 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +interface NodeTraverserInterface { + /** + * Adds a visitor. + * + * @param NodeVisitor $visitor Visitor to add + */ + public function addVisitor(NodeVisitor $visitor): void; + + /** + * Removes an added visitor. + */ + public function removeVisitor(NodeVisitor $visitor): void; + + /** + * Traverses an array of nodes using the registered visitors. + * + * @param Node[] $nodes Array of nodes + * + * @return Node[] Traversed array of nodes + */ + public function traverse(array $nodes): array; +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor.php b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor.php new file mode 100644 index 00000000..0ec4f7be --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor.php @@ -0,0 +1,124 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +interface NodeVisitor { + /** + * If NodeVisitor::enterNode() returns DONT_TRAVERSE_CHILDREN, child nodes + * of the current node will not be traversed for any visitors. + * + * For subsequent visitors enterNode() will still be called on the current + * node and leaveNode() will also be invoked for the current node. + */ + public const DONT_TRAVERSE_CHILDREN = 1; + + /** + * If NodeVisitor::enterNode() or NodeVisitor::leaveNode() returns + * STOP_TRAVERSAL, traversal is aborted. + * + * The afterTraverse() method will still be invoked. + */ + public const STOP_TRAVERSAL = 2; + + /** + * If NodeVisitor::leaveNode() returns REMOVE_NODE for a node that occurs + * in an array, it will be removed from the array. + * + * For subsequent visitors leaveNode() will still be invoked for the + * removed node. + */ + public const REMOVE_NODE = 3; + + /** + * If NodeVisitor::enterNode() returns DONT_TRAVERSE_CURRENT_AND_CHILDREN, child nodes + * of the current node will not be traversed for any visitors. + * + * For subsequent visitors enterNode() will not be called as well. + * leaveNode() will be invoked for visitors that has enterNode() method invoked. + */ + public const DONT_TRAVERSE_CURRENT_AND_CHILDREN = 4; + + /** + * If NodeVisitor::enterNode() or NodeVisitor::leaveNode() returns REPLACE_WITH_NULL, + * the node will be replaced with null. This is not a legal return value if the node is part + * of an array, rather than another node. + */ + public const REPLACE_WITH_NULL = 5; + + /** + * Called once before traversal. + * + * Return value semantics: + * * null: $nodes stays as-is + * * otherwise: $nodes is set to the return value + * + * @param Node[] $nodes Array of nodes + * + * @return null|Node[] Array of nodes + */ + public function beforeTraverse(array $nodes); + + /** + * Called when entering a node. + * + * Return value semantics: + * * null + * => $node stays as-is + * * array (of Nodes) + * => The return value is merged into the parent array (at the position of the $node) + * * NodeVisitor::REMOVE_NODE + * => $node is removed from the parent array + * * NodeVisitor::REPLACE_WITH_NULL + * => $node is replaced with null + * * NodeVisitor::DONT_TRAVERSE_CHILDREN + * => Children of $node are not traversed. $node stays as-is + * * NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN + * => Further visitors for the current node are skipped, and its children are not + * traversed. $node stays as-is. + * * NodeVisitor::STOP_TRAVERSAL + * => Traversal is aborted. $node stays as-is + * * otherwise + * => $node is set to the return value + * + * @param Node $node Node + * + * @return null|int|Node|Node[] Replacement node (or special return value) + */ + public function enterNode(Node $node); + + /** + * Called when leaving a node. + * + * Return value semantics: + * * null + * => $node stays as-is + * * NodeVisitor::REMOVE_NODE + * => $node is removed from the parent array + * * NodeVisitor::REPLACE_WITH_NULL + * => $node is replaced with null + * * NodeVisitor::STOP_TRAVERSAL + * => Traversal is aborted. $node stays as-is + * * array (of Nodes) + * => The return value is merged into the parent array (at the position of the $node) + * * otherwise + * => $node is set to the return value + * + * @param Node $node Node + * + * @return null|int|Node|Node[] Replacement node (or special return value) + */ + public function leaveNode(Node $node); + + /** + * Called once after traversal. + * + * Return value semantics: + * * null: $nodes stays as-is + * * otherwise: $nodes is set to the return value + * + * @param Node[] $nodes Array of nodes + * + * @return null|Node[] Array of nodes + */ + public function afterTraverse(array $nodes); +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/CloningVisitor.php b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/CloningVisitor.php new file mode 100644 index 00000000..cba92499 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/CloningVisitor.php @@ -0,0 +1,19 @@ +<?php declare(strict_types=1); + +namespace PhpParser\NodeVisitor; + +use PhpParser\Node; +use PhpParser\NodeVisitorAbstract; + +/** + * Visitor cloning all nodes and linking to the original nodes using an attribute. + * + * This visitor is required to perform format-preserving pretty prints. + */ +class CloningVisitor extends NodeVisitorAbstract { + public function enterNode(Node $origNode) { + $node = clone $origNode; + $node->setAttribute('origNode', $origNode); + return $node; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/CommentAnnotatingVisitor.php b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/CommentAnnotatingVisitor.php new file mode 100644 index 00000000..5e2aed31 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/CommentAnnotatingVisitor.php @@ -0,0 +1,82 @@ +<?php declare(strict_types=1); + +namespace PhpParser\NodeVisitor; + +use PhpParser\Comment; +use PhpParser\Node; +use PhpParser\NodeVisitorAbstract; +use PhpParser\Token; + +class CommentAnnotatingVisitor extends NodeVisitorAbstract { + /** @var int Last seen token start position */ + private int $pos = 0; + /** @var Token[] Token array */ + private array $tokens; + /** @var list<int> Token positions of comments */ + private array $commentPositions = []; + + /** + * Create a comment annotation visitor. + * + * @param Token[] $tokens Token array + */ + public function __construct(array $tokens) { + $this->tokens = $tokens; + + // Collect positions of comments. We use this to avoid traversing parts of the AST where + // there are no comments. + foreach ($tokens as $i => $token) { + if ($token->id === \T_COMMENT || $token->id === \T_DOC_COMMENT) { + $this->commentPositions[] = $i; + } + } + } + + public function enterNode(Node $node) { + $nextCommentPos = current($this->commentPositions); + if ($nextCommentPos === false) { + // No more comments. + return self::STOP_TRAVERSAL; + } + + $oldPos = $this->pos; + $this->pos = $pos = $node->getStartTokenPos(); + if ($nextCommentPos > $oldPos && $nextCommentPos < $pos) { + $comments = []; + while (--$pos >= $oldPos) { + $token = $this->tokens[$pos]; + if ($token->id === \T_DOC_COMMENT) { + $comments[] = new Comment\Doc( + $token->text, $token->line, $token->pos, $pos, + $token->getEndLine(), $token->getEndPos() - 1, $pos); + continue; + } + if ($token->id === \T_COMMENT) { + $comments[] = new Comment( + $token->text, $token->line, $token->pos, $pos, + $token->getEndLine(), $token->getEndPos() - 1, $pos); + continue; + } + if ($token->id !== \T_WHITESPACE) { + break; + } + } + if (!empty($comments)) { + $node->setAttribute('comments', array_reverse($comments)); + } + + do { + $nextCommentPos = next($this->commentPositions); + } while ($nextCommentPos !== false && $nextCommentPos < $this->pos); + } + + $endPos = $node->getEndTokenPos(); + if ($nextCommentPos > $endPos) { + // Skip children if there are no comments located inside this node. + $this->pos = $endPos; + return self::DONT_TRAVERSE_CHILDREN; + } + + return null; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php new file mode 100644 index 00000000..1f3f4bae --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php @@ -0,0 +1,47 @@ +<?php declare(strict_types=1); + +namespace PhpParser\NodeVisitor; + +use PhpParser\Node; +use PhpParser\NodeVisitorAbstract; + +/** + * This visitor can be used to find and collect all nodes satisfying some criterion determined by + * a filter callback. + */ +class FindingVisitor extends NodeVisitorAbstract { + /** @var callable Filter callback */ + protected $filterCallback; + /** @var Node[] Found nodes */ + protected array $foundNodes; + + public function __construct(callable $filterCallback) { + $this->filterCallback = $filterCallback; + } + + /** + * Get found nodes satisfying the filter callback. + * + * Nodes are returned in pre-order. + * + * @return Node[] Found nodes + */ + public function getFoundNodes(): array { + return $this->foundNodes; + } + + public function beforeTraverse(array $nodes): ?array { + $this->foundNodes = []; + + return null; + } + + public function enterNode(Node $node) { + $filterCallback = $this->filterCallback; + if ($filterCallback($node)) { + $this->foundNodes[] = $node; + } + + return null; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php new file mode 100644 index 00000000..05deed59 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php @@ -0,0 +1,49 @@ +<?php declare(strict_types=1); + +namespace PhpParser\NodeVisitor; + +use PhpParser\Node; +use PhpParser\NodeVisitor; +use PhpParser\NodeVisitorAbstract; + +/** + * This visitor can be used to find the first node satisfying some criterion determined by + * a filter callback. + */ +class FirstFindingVisitor extends NodeVisitorAbstract { + /** @var callable Filter callback */ + protected $filterCallback; + /** @var null|Node Found node */ + protected ?Node $foundNode; + + public function __construct(callable $filterCallback) { + $this->filterCallback = $filterCallback; + } + + /** + * Get found node satisfying the filter callback. + * + * Returns null if no node satisfies the filter callback. + * + * @return null|Node Found node (or null if not found) + */ + public function getFoundNode(): ?Node { + return $this->foundNode; + } + + public function beforeTraverse(array $nodes): ?array { + $this->foundNode = null; + + return null; + } + + public function enterNode(Node $node) { + $filterCallback = $this->filterCallback; + if ($filterCallback($node)) { + $this->foundNode = $node; + return NodeVisitor::STOP_TRAVERSAL; + } + + return null; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php new file mode 100644 index 00000000..ccd014eb --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php @@ -0,0 +1,262 @@ +<?php declare(strict_types=1); + +namespace PhpParser\NodeVisitor; + +use PhpParser\ErrorHandler; +use PhpParser\NameContext; +use PhpParser\Node; +use PhpParser\Node\Expr; +use PhpParser\Node\Name; +use PhpParser\Node\Name\FullyQualified; +use PhpParser\Node\Stmt; +use PhpParser\NodeVisitorAbstract; + +class NameResolver extends NodeVisitorAbstract { + /** @var NameContext Naming context */ + protected NameContext $nameContext; + + /** @var bool Whether to preserve original names */ + protected bool $preserveOriginalNames; + + /** @var bool Whether to replace resolved nodes in place, or to add resolvedNode attributes */ + protected bool $replaceNodes; + + /** + * Constructs a name resolution visitor. + * + * Options: + * * preserveOriginalNames (default false): An "originalName" attribute will be added to + * all name nodes that underwent resolution. + * * replaceNodes (default true): Resolved names are replaced in-place. Otherwise, a + * resolvedName attribute is added. (Names that cannot be statically resolved receive a + * namespacedName attribute, as usual.) + * + * @param ErrorHandler|null $errorHandler Error handler + * @param array{preserveOriginalNames?: bool, replaceNodes?: bool} $options Options + */ + public function __construct(?ErrorHandler $errorHandler = null, array $options = []) { + $this->nameContext = new NameContext($errorHandler ?? new ErrorHandler\Throwing()); + $this->preserveOriginalNames = $options['preserveOriginalNames'] ?? false; + $this->replaceNodes = $options['replaceNodes'] ?? true; + } + + /** + * Get name resolution context. + */ + public function getNameContext(): NameContext { + return $this->nameContext; + } + + public function beforeTraverse(array $nodes): ?array { + $this->nameContext->startNamespace(); + return null; + } + + public function enterNode(Node $node) { + if ($node instanceof Stmt\Namespace_) { + $this->nameContext->startNamespace($node->name); + } elseif ($node instanceof Stmt\Use_) { + foreach ($node->uses as $use) { + $this->addAlias($use, $node->type, null); + } + } elseif ($node instanceof Stmt\GroupUse) { + foreach ($node->uses as $use) { + $this->addAlias($use, $node->type, $node->prefix); + } + } elseif ($node instanceof Stmt\Class_) { + if (null !== $node->extends) { + $node->extends = $this->resolveClassName($node->extends); + } + + foreach ($node->implements as &$interface) { + $interface = $this->resolveClassName($interface); + } + + $this->resolveAttrGroups($node); + if (null !== $node->name) { + $this->addNamespacedName($node); + } else { + $node->namespacedName = null; + } + } elseif ($node instanceof Stmt\Interface_) { + foreach ($node->extends as &$interface) { + $interface = $this->resolveClassName($interface); + } + + $this->resolveAttrGroups($node); + $this->addNamespacedName($node); + } elseif ($node instanceof Stmt\Enum_) { + foreach ($node->implements as &$interface) { + $interface = $this->resolveClassName($interface); + } + + $this->resolveAttrGroups($node); + $this->addNamespacedName($node); + } elseif ($node instanceof Stmt\Trait_) { + $this->resolveAttrGroups($node); + $this->addNamespacedName($node); + } elseif ($node instanceof Stmt\Function_) { + $this->resolveSignature($node); + $this->resolveAttrGroups($node); + $this->addNamespacedName($node); + } elseif ($node instanceof Stmt\ClassMethod + || $node instanceof Expr\Closure + || $node instanceof Expr\ArrowFunction + ) { + $this->resolveSignature($node); + $this->resolveAttrGroups($node); + } elseif ($node instanceof Stmt\Property) { + if (null !== $node->type) { + $node->type = $this->resolveType($node->type); + } + $this->resolveAttrGroups($node); + } elseif ($node instanceof Stmt\Const_) { + foreach ($node->consts as $const) { + $this->addNamespacedName($const); + } + } elseif ($node instanceof Stmt\ClassConst) { + if (null !== $node->type) { + $node->type = $this->resolveType($node->type); + } + $this->resolveAttrGroups($node); + } elseif ($node instanceof Stmt\EnumCase) { + $this->resolveAttrGroups($node); + } elseif ($node instanceof Expr\StaticCall + || $node instanceof Expr\StaticPropertyFetch + || $node instanceof Expr\ClassConstFetch + || $node instanceof Expr\New_ + || $node instanceof Expr\Instanceof_ + ) { + if ($node->class instanceof Name) { + $node->class = $this->resolveClassName($node->class); + } + } elseif ($node instanceof Stmt\Catch_) { + foreach ($node->types as &$type) { + $type = $this->resolveClassName($type); + } + } elseif ($node instanceof Expr\FuncCall) { + if ($node->name instanceof Name) { + $node->name = $this->resolveName($node->name, Stmt\Use_::TYPE_FUNCTION); + } + } elseif ($node instanceof Expr\ConstFetch) { + $node->name = $this->resolveName($node->name, Stmt\Use_::TYPE_CONSTANT); + } elseif ($node instanceof Stmt\TraitUse) { + foreach ($node->traits as &$trait) { + $trait = $this->resolveClassName($trait); + } + + foreach ($node->adaptations as $adaptation) { + if (null !== $adaptation->trait) { + $adaptation->trait = $this->resolveClassName($adaptation->trait); + } + + if ($adaptation instanceof Stmt\TraitUseAdaptation\Precedence) { + foreach ($adaptation->insteadof as &$insteadof) { + $insteadof = $this->resolveClassName($insteadof); + } + } + } + } + + return null; + } + + /** @param Stmt\Use_::TYPE_* $type */ + private function addAlias(Node\UseItem $use, int $type, ?Name $prefix = null): void { + // Add prefix for group uses + $name = $prefix ? Name::concat($prefix, $use->name) : $use->name; + // Type is determined either by individual element or whole use declaration + $type |= $use->type; + + $this->nameContext->addAlias( + $name, (string) $use->getAlias(), $type, $use->getAttributes() + ); + } + + /** @param Stmt\Function_|Stmt\ClassMethod|Expr\Closure|Expr\ArrowFunction $node */ + private function resolveSignature($node): void { + foreach ($node->params as $param) { + $param->type = $this->resolveType($param->type); + $this->resolveAttrGroups($param); + } + $node->returnType = $this->resolveType($node->returnType); + } + + /** + * @template T of Node\Identifier|Name|Node\ComplexType|null + * @param T $node + * @return T + */ + private function resolveType(?Node $node): ?Node { + if ($node instanceof Name) { + return $this->resolveClassName($node); + } + if ($node instanceof Node\NullableType) { + $node->type = $this->resolveType($node->type); + return $node; + } + if ($node instanceof Node\UnionType || $node instanceof Node\IntersectionType) { + foreach ($node->types as &$type) { + $type = $this->resolveType($type); + } + return $node; + } + return $node; + } + + /** + * Resolve name, according to name resolver options. + * + * @param Name $name Function or constant name to resolve + * @param Stmt\Use_::TYPE_* $type One of Stmt\Use_::TYPE_* + * + * @return Name Resolved name, or original name with attribute + */ + protected function resolveName(Name $name, int $type): Name { + if (!$this->replaceNodes) { + $resolvedName = $this->nameContext->getResolvedName($name, $type); + if (null !== $resolvedName) { + $name->setAttribute('resolvedName', $resolvedName); + } else { + $name->setAttribute('namespacedName', FullyQualified::concat( + $this->nameContext->getNamespace(), $name, $name->getAttributes())); + } + return $name; + } + + if ($this->preserveOriginalNames) { + // Save the original name + $originalName = $name; + $name = clone $originalName; + $name->setAttribute('originalName', $originalName); + } + + $resolvedName = $this->nameContext->getResolvedName($name, $type); + if (null !== $resolvedName) { + return $resolvedName; + } + + // unqualified names inside a namespace cannot be resolved at compile-time + // add the namespaced version of the name as an attribute + $name->setAttribute('namespacedName', FullyQualified::concat( + $this->nameContext->getNamespace(), $name, $name->getAttributes())); + return $name; + } + + protected function resolveClassName(Name $name): Name { + return $this->resolveName($name, Stmt\Use_::TYPE_NORMAL); + } + + protected function addNamespacedName(Node $node): void { + $node->namespacedName = Name::concat( + $this->nameContext->getNamespace(), (string) $node->name); + } + + protected function resolveAttrGroups(Node $node): void { + foreach ($node->attrGroups as $attrGroup) { + foreach ($attrGroup->attrs as $attr) { + $attr->name = $this->resolveClassName($attr->name); + } + } + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php new file mode 100644 index 00000000..38fedfd5 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php @@ -0,0 +1,51 @@ +<?php declare(strict_types=1); + +namespace PhpParser\NodeVisitor; + +use PhpParser\Node; +use PhpParser\NodeVisitorAbstract; + +/** + * Visitor that connects a child node to its parent node + * as well as its sibling nodes. + * + * On the child node, the parent node can be accessed through + * <code>$node->getAttribute('parent')</code>, the previous + * node can be accessed through <code>$node->getAttribute('previous')</code>, + * and the next node can be accessed through <code>$node->getAttribute('next')</code>. + */ +final class NodeConnectingVisitor extends NodeVisitorAbstract { + /** + * @var Node[] + */ + private array $stack = []; + + /** + * @var ?Node + */ + private $previous; + + public function beforeTraverse(array $nodes) { + $this->stack = []; + $this->previous = null; + } + + public function enterNode(Node $node) { + if (!empty($this->stack)) { + $node->setAttribute('parent', $this->stack[count($this->stack) - 1]); + } + + if ($this->previous !== null && $this->previous->getAttribute('parent') === $node->getAttribute('parent')) { + $node->setAttribute('previous', $this->previous); + $this->previous->setAttribute('next', $node); + } + + $this->stack[] = $node; + } + + public function leaveNode(Node $node) { + $this->previous = $node; + + array_pop($this->stack); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php new file mode 100644 index 00000000..1e7e9e8b --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php @@ -0,0 +1,38 @@ +<?php declare(strict_types=1); + +namespace PhpParser\NodeVisitor; + +use PhpParser\Node; +use PhpParser\NodeVisitorAbstract; + +use function array_pop; +use function count; + +/** + * Visitor that connects a child node to its parent node. + * + * On the child node, the parent node can be accessed through + * <code>$node->getAttribute('parent')</code>. + */ +final class ParentConnectingVisitor extends NodeVisitorAbstract { + /** + * @var Node[] + */ + private array $stack = []; + + public function beforeTraverse(array $nodes) { + $this->stack = []; + } + + public function enterNode(Node $node) { + if (!empty($this->stack)) { + $node->setAttribute('parent', $this->stack[count($this->stack) - 1]); + } + + $this->stack[] = $node; + } + + public function leaveNode(Node $node) { + array_pop($this->stack); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php new file mode 100644 index 00000000..6fb15cca --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php @@ -0,0 +1,24 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +/** + * @codeCoverageIgnore + */ +abstract class NodeVisitorAbstract implements NodeVisitor { + public function beforeTraverse(array $nodes) { + return null; + } + + public function enterNode(Node $node) { + return null; + } + + public function leaveNode(Node $node) { + return null; + } + + public function afterTraverse(array $nodes) { + return null; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Parser.php b/vendor/nikic/php-parser/lib/PhpParser/Parser.php new file mode 100644 index 00000000..68954afe --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Parser.php @@ -0,0 +1,24 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +interface Parser { + /** + * Parses PHP code into a node tree. + * + * @param string $code The source code to parse + * @param ErrorHandler|null $errorHandler Error handler to use for lexer/parser errors, defaults + * to ErrorHandler\Throwing. + * + * @return Node\Stmt[]|null Array of statements (or null non-throwing error handler is used and + * the parser was unable to recover from an error). + */ + public function parse(string $code, ?ErrorHandler $errorHandler = null): ?array; + + /** + * Return tokens for the last parse. + * + * @return Token[] + */ + public function getTokens(): array; +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Parser/Php7.php b/vendor/nikic/php-parser/lib/PhpParser/Parser/Php7.php new file mode 100644 index 00000000..050f91e8 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Parser/Php7.php @@ -0,0 +1,2743 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Parser; + +use PhpParser\Error; +use PhpParser\Modifiers; +use PhpParser\Node; +use PhpParser\Node\Expr; +use PhpParser\Node\Name; +use PhpParser\Node\Scalar; +use PhpParser\Node\Stmt; + +/* This is an automatically GENERATED file, which should not be manually edited. + * Instead edit one of the following: + * * the grammar file grammar/php.y + * * the skeleton file grammar/parser.template + * * the preprocessing script grammar/rebuildParsers.php + */ +class Php7 extends \PhpParser\ParserAbstract +{ + public const YYERRTOK = 256; + public const T_THROW = 257; + public const T_INCLUDE = 258; + public const T_INCLUDE_ONCE = 259; + public const T_EVAL = 260; + public const T_REQUIRE = 261; + public const T_REQUIRE_ONCE = 262; + public const T_LOGICAL_OR = 263; + public const T_LOGICAL_XOR = 264; + public const T_LOGICAL_AND = 265; + public const T_PRINT = 266; + public const T_YIELD = 267; + public const T_DOUBLE_ARROW = 268; + public const T_YIELD_FROM = 269; + public const T_PLUS_EQUAL = 270; + public const T_MINUS_EQUAL = 271; + public const T_MUL_EQUAL = 272; + public const T_DIV_EQUAL = 273; + public const T_CONCAT_EQUAL = 274; + public const T_MOD_EQUAL = 275; + public const T_AND_EQUAL = 276; + public const T_OR_EQUAL = 277; + public const T_XOR_EQUAL = 278; + public const T_SL_EQUAL = 279; + public const T_SR_EQUAL = 280; + public const T_POW_EQUAL = 281; + public const T_COALESCE_EQUAL = 282; + public const T_COALESCE = 283; + public const T_BOOLEAN_OR = 284; + public const T_BOOLEAN_AND = 285; + public const T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG = 286; + public const T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG = 287; + public const T_IS_EQUAL = 288; + public const T_IS_NOT_EQUAL = 289; + public const T_IS_IDENTICAL = 290; + public const T_IS_NOT_IDENTICAL = 291; + public const T_SPACESHIP = 292; + public const T_IS_SMALLER_OR_EQUAL = 293; + public const T_IS_GREATER_OR_EQUAL = 294; + public const T_SL = 295; + public const T_SR = 296; + public const T_INSTANCEOF = 297; + public const T_INC = 298; + public const T_DEC = 299; + public const T_INT_CAST = 300; + public const T_DOUBLE_CAST = 301; + public const T_STRING_CAST = 302; + public const T_ARRAY_CAST = 303; + public const T_OBJECT_CAST = 304; + public const T_BOOL_CAST = 305; + public const T_UNSET_CAST = 306; + public const T_POW = 307; + public const T_NEW = 308; + public const T_CLONE = 309; + public const T_EXIT = 310; + public const T_IF = 311; + public const T_ELSEIF = 312; + public const T_ELSE = 313; + public const T_ENDIF = 314; + public const T_LNUMBER = 315; + public const T_DNUMBER = 316; + public const T_STRING = 317; + public const T_STRING_VARNAME = 318; + public const T_VARIABLE = 319; + public const T_NUM_STRING = 320; + public const T_INLINE_HTML = 321; + public const T_ENCAPSED_AND_WHITESPACE = 322; + public const T_CONSTANT_ENCAPSED_STRING = 323; + public const T_ECHO = 324; + public const T_DO = 325; + public const T_WHILE = 326; + public const T_ENDWHILE = 327; + public const T_FOR = 328; + public const T_ENDFOR = 329; + public const T_FOREACH = 330; + public const T_ENDFOREACH = 331; + public const T_DECLARE = 332; + public const T_ENDDECLARE = 333; + public const T_AS = 334; + public const T_SWITCH = 335; + public const T_MATCH = 336; + public const T_ENDSWITCH = 337; + public const T_CASE = 338; + public const T_DEFAULT = 339; + public const T_BREAK = 340; + public const T_CONTINUE = 341; + public const T_GOTO = 342; + public const T_FUNCTION = 343; + public const T_FN = 344; + public const T_CONST = 345; + public const T_RETURN = 346; + public const T_TRY = 347; + public const T_CATCH = 348; + public const T_FINALLY = 349; + public const T_USE = 350; + public const T_INSTEADOF = 351; + public const T_GLOBAL = 352; + public const T_STATIC = 353; + public const T_ABSTRACT = 354; + public const T_FINAL = 355; + public const T_PRIVATE = 356; + public const T_PROTECTED = 357; + public const T_PUBLIC = 358; + public const T_READONLY = 359; + public const T_VAR = 360; + public const T_UNSET = 361; + public const T_ISSET = 362; + public const T_EMPTY = 363; + public const T_HALT_COMPILER = 364; + public const T_CLASS = 365; + public const T_TRAIT = 366; + public const T_INTERFACE = 367; + public const T_ENUM = 368; + public const T_EXTENDS = 369; + public const T_IMPLEMENTS = 370; + public const T_OBJECT_OPERATOR = 371; + public const T_NULLSAFE_OBJECT_OPERATOR = 372; + public const T_LIST = 373; + public const T_ARRAY = 374; + public const T_CALLABLE = 375; + public const T_CLASS_C = 376; + public const T_TRAIT_C = 377; + public const T_METHOD_C = 378; + public const T_FUNC_C = 379; + public const T_LINE = 380; + public const T_FILE = 381; + public const T_START_HEREDOC = 382; + public const T_END_HEREDOC = 383; + public const T_DOLLAR_OPEN_CURLY_BRACES = 384; + public const T_CURLY_OPEN = 385; + public const T_PAAMAYIM_NEKUDOTAYIM = 386; + public const T_NAMESPACE = 387; + public const T_NS_C = 388; + public const T_DIR = 389; + public const T_NS_SEPARATOR = 390; + public const T_ELLIPSIS = 391; + public const T_NAME_FULLY_QUALIFIED = 392; + public const T_NAME_QUALIFIED = 393; + public const T_NAME_RELATIVE = 394; + public const T_ATTRIBUTE = 395; + + protected int $tokenToSymbolMapSize = 396; + protected int $actionTableSize = 1268; + protected int $gotoTableSize = 730; + + protected int $invalidSymbol = 168; + protected int $errorSymbol = 1; + protected int $defaultAction = -32766; + protected int $unexpectedTokenRule = 32767; + + protected int $YY2TBLSTATE = 437; + protected int $numNonLeafStates = 743; + + protected array $symbolToName = array( + "EOF", + "error", + "T_THROW", + "T_INCLUDE", + "T_INCLUDE_ONCE", + "T_EVAL", + "T_REQUIRE", + "T_REQUIRE_ONCE", + "','", + "T_LOGICAL_OR", + "T_LOGICAL_XOR", + "T_LOGICAL_AND", + "T_PRINT", + "T_YIELD", + "T_DOUBLE_ARROW", + "T_YIELD_FROM", + "'='", + "T_PLUS_EQUAL", + "T_MINUS_EQUAL", + "T_MUL_EQUAL", + "T_DIV_EQUAL", + "T_CONCAT_EQUAL", + "T_MOD_EQUAL", + "T_AND_EQUAL", + "T_OR_EQUAL", + "T_XOR_EQUAL", + "T_SL_EQUAL", + "T_SR_EQUAL", + "T_POW_EQUAL", + "T_COALESCE_EQUAL", + "'?'", + "':'", + "T_COALESCE", + "T_BOOLEAN_OR", + "T_BOOLEAN_AND", + "'|'", + "'^'", + "T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG", + "T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG", + "T_IS_EQUAL", + "T_IS_NOT_EQUAL", + "T_IS_IDENTICAL", + "T_IS_NOT_IDENTICAL", + "T_SPACESHIP", + "'<'", + "T_IS_SMALLER_OR_EQUAL", + "'>'", + "T_IS_GREATER_OR_EQUAL", + "T_SL", + "T_SR", + "'+'", + "'-'", + "'.'", + "'*'", + "'/'", + "'%'", + "'!'", + "T_INSTANCEOF", + "'~'", + "T_INC", + "T_DEC", + "T_INT_CAST", + "T_DOUBLE_CAST", + "T_STRING_CAST", + "T_ARRAY_CAST", + "T_OBJECT_CAST", + "T_BOOL_CAST", + "T_UNSET_CAST", + "'@'", + "T_POW", + "'['", + "T_NEW", + "T_CLONE", + "T_EXIT", + "T_IF", + "T_ELSEIF", + "T_ELSE", + "T_ENDIF", + "T_LNUMBER", + "T_DNUMBER", + "T_STRING", + "T_STRING_VARNAME", + "T_VARIABLE", + "T_NUM_STRING", + "T_INLINE_HTML", + "T_ENCAPSED_AND_WHITESPACE", + "T_CONSTANT_ENCAPSED_STRING", + "T_ECHO", + "T_DO", + "T_WHILE", + "T_ENDWHILE", + "T_FOR", + "T_ENDFOR", + "T_FOREACH", + "T_ENDFOREACH", + "T_DECLARE", + "T_ENDDECLARE", + "T_AS", + "T_SWITCH", + "T_MATCH", + "T_ENDSWITCH", + "T_CASE", + "T_DEFAULT", + "T_BREAK", + "T_CONTINUE", + "T_GOTO", + "T_FUNCTION", + "T_FN", + "T_CONST", + "T_RETURN", + "T_TRY", + "T_CATCH", + "T_FINALLY", + "T_USE", + "T_INSTEADOF", + "T_GLOBAL", + "T_STATIC", + "T_ABSTRACT", + "T_FINAL", + "T_PRIVATE", + "T_PROTECTED", + "T_PUBLIC", + "T_READONLY", + "T_VAR", + "T_UNSET", + "T_ISSET", + "T_EMPTY", + "T_HALT_COMPILER", + "T_CLASS", + "T_TRAIT", + "T_INTERFACE", + "T_ENUM", + "T_EXTENDS", + "T_IMPLEMENTS", + "T_OBJECT_OPERATOR", + "T_NULLSAFE_OBJECT_OPERATOR", + "T_LIST", + "T_ARRAY", + "T_CALLABLE", + "T_CLASS_C", + "T_TRAIT_C", + "T_METHOD_C", + "T_FUNC_C", + "T_LINE", + "T_FILE", + "T_START_HEREDOC", + "T_END_HEREDOC", + "T_DOLLAR_OPEN_CURLY_BRACES", + "T_CURLY_OPEN", + "T_PAAMAYIM_NEKUDOTAYIM", + "T_NAMESPACE", + "T_NS_C", + "T_DIR", + "T_NS_SEPARATOR", + "T_ELLIPSIS", + "T_NAME_FULLY_QUALIFIED", + "T_NAME_QUALIFIED", + "T_NAME_RELATIVE", + "T_ATTRIBUTE", + "';'", + "']'", + "'('", + "')'", + "'{'", + "'}'", + "'`'", + "'\"'", + "'$'" + ); + + protected array $tokenToSymbol = array( + 0, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 56, 166, 168, 167, 55, 168, 168, + 161, 162, 53, 50, 8, 51, 52, 54, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 31, 159, + 44, 16, 46, 30, 68, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 70, 168, 160, 36, 168, 165, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 163, 35, 164, 58, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 1, 2, 3, 4, + 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 32, 33, 34, 37, 38, 39, 40, + 41, 42, 43, 45, 47, 48, 49, 57, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 69, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, + 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + 153, 154, 155, 156, 157, 158 + ); + + protected array $action = array( + 133, 134, 135, 586, 136, 137, 0, 755, 756, 757, + 138, 38,-32766,-32766,-32766, 151,-32766,-32766,-32766,-32767, + -32767,-32767,-32767, 102, 103, 104, 105, 106, 1116, 1117, + 1118, 1115, 1114, 1113, 1119, 749, 748,-32766,-32766,-32766, + -32766,-32766,-32766,-32766,-32766,-32766,-32767,-32767,-32767,-32767, + -32767, 1252, 841,-32766, 1331, 758,-32766,-32766,-32766,-32766, + -599,-32766,-32766,-32766, 104, 105, 106, -599, 1315, 265, + 139, 406, 762, 763, 764, 765, 994,-32766, 431,-32766, + -32766, -16,-32766, 242, 1031, 819, 766, 767, 768, 769, + 770, 771, 772, 773, 774, 775, 795, 587, 796, 797, + 798, 799, 787, 788, 347, 348, 790, 791, 776, 777, + 778, 780, 781, 782, 358, 822, 823, 824, 825, 826, + 588, 783, 784, 589, 590,-32766, 807, 805, 806, 818, + 802, 803, 839, 830, 591, 592, 801, 593, 594, 595, + 596, 597, 598, 830, 461, 462, 463, 1040, 804, 599, + 600, 945, 140, 2, 133, 134, 135, 586, 136, 137, + 1064, 755, 756, 757, 138, 38, -328, -110, -110, 1335, + 291, 23, -110,-32766,-32766,-32766, 1334, 35, -110, 1116, + 1117, 1118, 1115, 1114, 1113, 1119, 616,-32766, 129, 749, + 748, 107, 108, 109,-32766, 275,-32766,-32766,-32766,-32766, + -32766,-32766,-32766, 832, 995, -194, 145, 110, 300, 758, + 840, 75,-32766,-32766,-32766, 1360, 142, 328, 1361, -599, + 328, -599, 253, 265, 139, 406, 762, 763, 764, 765, + 82, -272, 431,-32766, 328,-32766,-32766,-32766,-32766, 819, + 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, + 795, 587, 796, 797, 798, 799, 787, 788, 347, 348, + 790, 791, 776, 777, 778, 780, 781, 782, 358, 822, + 823, 824, 825, 826, 588, 783, 784, 589, 590, 834, + 807, 805, 806, 818, 802, 803, 716, 311, 591, 592, + 801, 593, 594, 595, 596, 597, 598, -78, 83, 84, + 85, -85, 804, 599, 600, 313, 149, 779, 750, 751, + 752, 753, 754, 729, 755, 756, 757, 792, 793, 37, + -328, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 325, 275, 485,-32766,-32766, + -32766, -58,-32766,-32766,-32766, 963, 964, 127, 110, -194, + 965, 341, 758,-32766,-32766,-32766, 959, -85, 292,-32766, + 1092,-32766,-32766,-32766,-32766,-32766, 759, 760, 761, 762, + 763, 764, 765, -193,-32766, 828,-32766,-32766,-32766, -367, + 431, -367, 819, 766, 767, 768, 769, 770, 771, 772, + 773, 774, 775, 795, 817, 796, 797, 798, 799, 787, + 788, 789, 816, 790, 791, 776, 777, 778, 780, 781, + 782, 821, 822, 823, 824, 825, 826, 827, 783, 784, + 785, 786, -552, 807, 805, 806, 818, 802, 803, 342, + 329, 794, 800, 801, 808, 809, 811, 810, 812, 813, + 1037, 866, 610, 867,-32766, 804, 815, 814, 50, 51, + 52, 516, 53, 54, 835, 1247, 1246, 1248, 55, 56, + -110, 57, 1040, 924, 1094, -110, 1040, -110, 292, 486, + 749, 748, 307, 384, 383, -110, -110, -110, -110, -110, + -110, -110, -110, 425, 924, 284, -552, -552, 372, 291, + 838, 924, 1252, 719, 470, 471, 58, 59,-32766,-32766, + 21, -550, 60, 560, 61, 247, 248, 62, 63, 64, + 65, 66, 67, 68, 69, -552, 28, 267, 70, 446, + 517, 720, 1108, -342, 1279, 1280, 518, -193, 839, 376, + 836, -548, 1277, 42, 25, 519, 391, 520, 241, 521, + 924, 522, 947, 1245, 523, 524, 914, 660, 26, 44, + 45, 447, 379, 378,-32766, 46, 525, 1027, 1026, 1025, + 1028, 370, 340, 442, 1285, -550, -550, 914, 1238, 947, + 527, 528, 529, 839, 914, 839, 1040, 443, 1350, 1243, + -550, 359, 531, 532, 444, 1266, 1267, 1268, 1269, 1263, + 1264, 299, -556, 445, -550, -548, -548, 1270, 1265, 291, + 1039, 1247, 1246, 1248, 300, 749, 748, 71, 364, 845, + -548, 323, 324, 328, -153, -153, -153, 152, 1247, 1246, + 1248, 926, -555, 914, -548, 714, 1063, 154,-32766, -153, + 1093, -153, 155, -153, 741, -153, 156, -596, 28, 268, + 36, 250, 926,-32766, -596, 377, 714, 679, 680, 926, + 839, 1273, 75, 714, 1277, 288, 963, 964, 328, -547, + 393, 526, 7, 1037, -57, 1040, 900, 959, -110, -110, + -110, 32, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 1040, 158, 382, 383, 866, + 1238, 867, 924, 749, 748, 1252, 33, 425, 926, 150, + 409, 924, 714, -153, 531, 532, -87, 1266, 1267, 1268, + 1269, 1263, 1264, 124, 1154, 1156, -84, -4, 924, 1270, + 1265, 125, 721, -547, -547, -546, 130, 749, 748, 73, + -32766, 724, 839, -78, 324, 328, 1245, 131, -547, 300, + -590, 1037, -590,-32766,-32766,-32766, 144,-32766, 159,-32766, + -554,-32766, -547, 160,-32766, 380, 381, 924, 161,-32766, + -32766,-32766, 162, 1040,-32766,-32766,-32766, 385, 386, 163, + 1245,-32766, 422, 651, 652, 914, 839,-32766,-32766,-32766, + -32766,-32766, -73,-32766, 914,-32766, 284, 731,-32766, -546, + -546, -72, 48,-32766,-32766,-32766, -596, -71, -596,-32766, + -32766, 914, -70, -69, -546,-32766, 422, -68, -67, -66, + 74, -110, -110, 141,-32766, -50, -110, 328, -546, -65, + -46, -18, -110, 377, 148, 438, 274, 285, 730, 733, + 298,-32766, 923, 147, 963, 964, 289, 290, -549, 526, + 914, -302, -298, 280, 530, 959, -110, -110, -110, 132, + 980, 281, 300, 941, 714, 75, 301, 302,-32766, 926, + 286, 328, 287, 714, 1245, 334, 293, 10, 294, 275, + 1362,-32766,-32766,-32766, 110,-32766, 926,-32766, 707,-32766, + 714, -4,-32766, 146, 830, 126, 689,-32766,-32766,-32766, + 705, 20,-32766,-32766,-32766, 924, 839, 682, 1245,-32766, + 422, 1123, -549, -549, 649,-32766,-32766,-32766,-32766,-32766, + 565,-32766, 661,-32766, 467, 926,-32766, -549,-32766, 714, + 666,-32766,-32766,-32766,-32766, 496, 667,-32766,-32766,-32766, + 1245, -549, 683,-32766, 422, 924, 571,-32766,-32766,-32766, + 838,-32766,-32766,-32766, 306,-32766, 735, 1278,-32766, 308, + 0, 960, 491,-32766,-32766,-32766,-32766, 0, 0,-32766, + -32766, 0, 1245, 578, 0,-32766, 422, -546, 305,-32766, + -32766,-32766, 312,-32766,-32766,-32766, 0,-32766, 914, 40, + -32766, 0, 0, 1284, 1286,-32766,-32766,-32766, -511, 0, + -501,-32766,-32766, 8, -250, -250, -250,-32766, 422, 614, + 377, 24, 49, 28, 267, 374,-32766, 943, 41, 300, + -275, 963, 964, 738, 739, 839, 526, 858, 914, 1277, + 905, 900, 959, -110, -110, -110, 1004, 981, 988, 978, + 989, -546, -546, 903, -249, -249, -249, 976, 28, 268, + 377, 1274, 288, 1097, 1100, 1101, -546, 1098, 1099, 1105, + 839, 963, 964, 926, 1277, 1238, 526, 714, -250, 850, + -546, 900, 959, -110, -110, -110, 303, 304, 1301, 1319, + 532, 1353, 1266, 1267, 1268, 1269, 1263, 1264, 654, -273, + -584, 375, -583, -582, 1270, 1265, -556, -555, -554, -553, + 1238, -495, 694, 926, 73, 128, 1, 714, -249, 324, + 328, 29, 30, 39, 43, 532, 47, 1266, 1267, 1268, + 1269, 1263, 1264, 72, 76, 77, 78, 79, 80, 1270, + 1265, 81, 143, 153,-32766, 157, 245, 330, 695, 73, + 1245, 359, 360, 361, 324, 328, 362,-32766,-32766,-32766, + 363,-32766, 364,-32766, 365,-32766, 366, 367,-32766, 696, + 697, 368, 369,-32766,-32766,-32766, 371, 439, 559,-32766, + -32766, -272, 13, 14, 15,-32766, 422, 1247, 1246, 1248, + 16, 18, 408, 284,-32766, 487, 488, 495, 498, 499, + 500, 501, 505, 506, 507, 514, 576, 700, 1256, 1194, + 1275, 1066, 1065, 1046, 1233, 1042, -277, -102, 12, 17, + 27, 297, 407, 607, 611, 640, 706, 1198, 1251, 1195, + 1332, 0, 34, 0, 322, 373, 715, 718, 722, 723, + 725, 726, 727, 728, 732, 717, 0, 901, 1357, 1359, + 861, 860, 869, 953, 996, 868, 1358, 952, 950, 951, + 954, 1226, 934, 944, 932, 986, 987, 638, 1356, 1313, + 1302, 1320, 1329, 0, 1211, 0, 0, 328 + ); + + protected array $actionCheck = array( + 2, 3, 4, 5, 6, 7, 0, 9, 10, 11, + 12, 13, 9, 10, 11, 14, 9, 10, 11, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 116, 117, + 118, 119, 120, 121, 122, 37, 38, 30, 116, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 1, 1, 9, 1, 57, 9, 10, 11, 137, + 1, 9, 10, 11, 50, 51, 52, 8, 1, 71, + 72, 73, 74, 75, 76, 77, 31, 30, 80, 32, + 33, 31, 30, 14, 1, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 116, 128, 129, 130, 131, + 132, 133, 82, 80, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 80, 129, 130, 131, 138, 150, 151, + 152, 1, 154, 8, 2, 3, 4, 5, 6, 7, + 162, 9, 10, 11, 12, 13, 8, 117, 118, 1, + 161, 8, 122, 9, 10, 11, 8, 8, 128, 116, + 117, 118, 119, 120, 121, 122, 51, 137, 8, 37, + 38, 53, 54, 55, 30, 57, 32, 33, 34, 35, + 36, 37, 38, 80, 159, 8, 8, 69, 158, 57, + 159, 161, 9, 10, 11, 80, 163, 167, 83, 160, + 167, 162, 8, 71, 72, 73, 74, 75, 76, 77, + 163, 162, 80, 30, 167, 32, 33, 34, 35, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 156, + 128, 129, 130, 131, 132, 133, 163, 8, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 16, 9, 10, + 11, 31, 150, 151, 152, 8, 154, 2, 3, 4, + 5, 6, 7, 163, 9, 10, 11, 12, 13, 30, + 162, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 8, 57, 31, 9, 10, + 11, 16, 9, 10, 11, 117, 118, 14, 69, 162, + 122, 8, 57, 9, 10, 11, 128, 97, 30, 30, + 1, 32, 33, 34, 35, 36, 71, 72, 73, 74, + 75, 76, 77, 8, 30, 80, 32, 33, 34, 106, + 80, 108, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 70, 128, 129, 130, 131, 132, 133, 8, + 70, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 116, 106, 1, 108, 116, 150, 151, 152, 2, 3, + 4, 5, 6, 7, 80, 155, 156, 157, 12, 13, + 101, 15, 138, 1, 164, 106, 138, 108, 30, 163, + 37, 38, 113, 106, 107, 116, 117, 118, 119, 120, + 121, 122, 123, 116, 1, 161, 134, 135, 8, 161, + 155, 1, 1, 31, 134, 135, 50, 51, 9, 10, + 101, 70, 56, 85, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 163, 70, 71, 72, 73, + 74, 31, 123, 164, 78, 79, 80, 162, 82, 8, + 156, 70, 86, 87, 88, 89, 8, 91, 97, 93, + 1, 95, 122, 80, 98, 99, 84, 75, 76, 103, + 104, 105, 106, 107, 116, 109, 110, 119, 120, 121, + 122, 115, 116, 8, 146, 134, 135, 84, 122, 122, + 124, 125, 126, 82, 84, 82, 138, 8, 85, 116, + 149, 161, 136, 137, 8, 139, 140, 141, 142, 143, + 144, 145, 161, 8, 163, 134, 135, 151, 152, 161, + 137, 155, 156, 157, 158, 37, 38, 161, 161, 8, + 149, 165, 166, 167, 75, 76, 77, 14, 155, 156, + 157, 159, 161, 84, 163, 163, 1, 14, 137, 90, + 159, 92, 14, 94, 163, 96, 14, 1, 70, 71, + 147, 148, 159, 116, 8, 106, 163, 75, 76, 159, + 82, 1, 161, 163, 86, 30, 117, 118, 167, 70, + 106, 122, 108, 116, 16, 138, 127, 128, 129, 130, + 131, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 138, 14, 106, 107, 106, + 122, 108, 1, 37, 38, 1, 14, 116, 159, 101, + 102, 1, 163, 164, 136, 137, 31, 139, 140, 141, + 142, 143, 144, 16, 59, 60, 31, 0, 1, 151, + 152, 16, 31, 134, 135, 70, 16, 37, 38, 161, + 74, 31, 82, 31, 166, 167, 80, 16, 149, 158, + 160, 116, 162, 87, 88, 89, 16, 91, 16, 93, + 161, 95, 163, 16, 98, 106, 107, 1, 16, 103, + 104, 105, 16, 138, 74, 109, 110, 106, 107, 16, + 80, 115, 116, 111, 112, 84, 82, 87, 88, 89, + 124, 91, 31, 93, 84, 95, 161, 31, 98, 134, + 135, 31, 70, 103, 104, 105, 160, 31, 162, 109, + 110, 84, 31, 31, 149, 115, 116, 31, 31, 31, + 154, 117, 118, 163, 124, 31, 122, 167, 163, 31, + 31, 31, 128, 106, 31, 108, 31, 31, 31, 31, + 113, 137, 31, 31, 117, 118, 37, 37, 70, 122, + 84, 35, 35, 35, 127, 128, 129, 130, 131, 31, + 159, 35, 158, 38, 163, 161, 134, 135, 74, 159, + 35, 167, 35, 163, 80, 35, 37, 150, 37, 57, + 83, 87, 88, 89, 69, 91, 159, 93, 92, 95, + 163, 164, 98, 70, 80, 163, 77, 103, 104, 105, + 80, 97, 74, 109, 110, 1, 82, 94, 80, 115, + 116, 82, 134, 135, 113, 87, 88, 89, 124, 91, + 89, 93, 90, 95, 97, 159, 98, 149, 85, 163, + 96, 103, 104, 105, 74, 97, 100, 109, 110, 137, + 80, 163, 100, 115, 116, 1, 153, 87, 88, 89, + 155, 91, 124, 93, 133, 95, 164, 166, 98, 114, + -1, 128, 102, 103, 104, 105, 74, -1, -1, 109, + 110, -1, 80, 81, -1, 115, 116, 70, 132, 87, + 88, 89, 132, 91, 124, 93, -1, 95, 84, 159, + 98, -1, -1, 146, 146, 103, 104, 105, 149, -1, + 149, 109, 110, 149, 100, 101, 102, 115, 116, 153, + 106, 149, 70, 70, 71, 149, 124, 154, 159, 158, + 162, 117, 118, 159, 159, 82, 122, 159, 84, 86, + 159, 127, 128, 129, 130, 131, 159, 159, 159, 159, + 159, 134, 135, 159, 100, 101, 102, 159, 70, 71, + 106, 160, 30, 159, 159, 159, 149, 159, 159, 159, + 82, 117, 118, 159, 86, 122, 122, 163, 164, 160, + 163, 127, 128, 129, 130, 131, 134, 135, 160, 160, + 137, 160, 139, 140, 141, 142, 143, 144, 160, 162, + 161, 149, 161, 161, 151, 152, 161, 161, 161, 161, + 122, 161, 80, 159, 161, 163, 161, 163, 164, 166, + 167, 161, 161, 161, 161, 137, 161, 139, 140, 141, + 142, 143, 144, 161, 161, 161, 161, 161, 161, 151, + 152, 161, 161, 161, 74, 161, 161, 161, 116, 161, + 80, 161, 161, 161, 166, 167, 161, 87, 88, 89, + 161, 91, 161, 93, 161, 95, 161, 161, 98, 137, + 138, 161, 161, 103, 104, 105, 161, 161, 161, 109, + 110, 162, 162, 162, 162, 115, 116, 155, 156, 157, + 162, 162, 162, 161, 124, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162, -1, 163, -1, 163, 163, 163, 163, 163, 163, + 163, 163, 163, 163, 163, 163, -1, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, -1, 165, -1, -1, 167 + ); + + protected array $actionBase = array( + 0, -2, 152, 549, 727, 904, 944, 1022, 660, 310, + 123, 899, 500, 710, 710, 766, 710, 472, 701, 820, + 63, 305, 305, 820, 305, 493, 493, 493, 666, 666, + 666, 666, 700, 700, 860, 860, 892, 828, 794, 1060, + 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, + 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, + 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, + 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, + 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, + 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, + 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, + 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, + 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, + 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, + 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, + 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, + 1060, 1060, 1060, 1060, 51, 45, 451, 692, 1049, 1055, + 1051, 1056, 1047, 1046, 1050, 1052, 1057, 1094, 1095, 812, + 1096, 1097, 1093, 1098, 1053, 928, 1048, 1054, 289, 289, + 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, + 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, + 289, 289, 289, 289, 289, 44, 343, 499, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 52, 52, + 52, 578, 578, 47, 354, 978, 943, 978, 978, 978, + 978, 978, 978, 978, 978, 203, 665, 339, 164, 164, + 7, 7, 7, 7, 7, 50, 369, 704, 704, -25, + -25, -25, -25, 448, 635, 501, 409, 283, 338, 591, + 334, 334, 14, 14, 557, 557, 9, 9, 557, 557, + 557, 537, 537, 537, 537, 441, 471, 599, 345, 428, + 802, 53, 53, 53, 53, 802, 802, 802, 802, 848, + 791, 802, 802, 802, 778, 907, 907, 942, 138, 138, + 138, 907, 593, 503, 503, 593, 238, 503, 67, 135, + -78, 833, 377, 590, -78, 362, 732, 646, 59, 795, + 659, 795, 1045, 430, 843, 843, 457, 799, 761, 900, + 1072, 1058, 836, 1091, 842, 1092, 15, 370, 712, 1044, + 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, + 1100, 443, 1045, 384, 1100, 1100, 1100, 443, 443, 443, + 443, 443, 443, 443, 443, 443, 443, 672, 384, 482, + 582, 384, 840, 443, 51, 851, 51, 51, 51, 51, + 51, 51, 51, 51, 51, 51, 800, 316, 51, 45, + 150, 150, 481, 83, 150, 150, 150, 150, 51, 51, + 51, 51, 659, 822, 793, 671, 856, 375, 822, 822, + 822, 270, 158, 69, 197, 816, 817, 564, 814, 814, + 829, 945, 814, 824, 814, 829, 955, 814, 814, 945, + 945, 861, 945, 180, 565, 353, 531, 579, 945, 279, + 814, 814, 814, 814, 850, 945, 586, 814, 214, 198, + 814, 814, 850, 846, 806, 145, 821, 945, 945, 945, + 850, 490, 821, 821, 821, 864, 865, 801, 805, 337, + 297, 611, 169, 825, 805, 805, 814, 538, 801, 805, + 801, 805, 863, 805, 805, 805, 801, 805, 824, 431, + 805, 742, 595, 163, 805, 6, 962, 963, 685, 964, + 952, 965, 1006, 966, 967, 1063, 940, 975, 953, 970, + 1007, 951, 950, 811, 707, 715, 854, 849, 938, 815, + 815, 815, 935, 936, 815, 815, 815, 815, 815, 815, + 815, 815, 707, 891, 866, 831, 981, 720, 731, 1034, + 847, 1073, 1099, 980, 1036, 971, 830, 740, 1019, 982, + 792, 1061, 985, 989, 1020, 1037, 868, 1038, 1074, 823, + 1075, 1076, 909, 993, 1064, 815, 962, 967, 695, 953, + 970, 951, 950, 798, 788, 786, 787, 782, 781, 770, + 776, 803, 1039, 932, 929, 918, 991, 937, 707, 919, + 1010, 1059, 1023, 1024, 1062, 827, 797, 921, 1077, 995, + 996, 1000, 1065, 1040, 1066, 859, 1011, 858, 1025, 838, + 1078, 1026, 1027, 1028, 1029, 1067, 1079, 1068, 931, 1069, + 871, 832, 927, 834, 1080, 1, 835, 837, 841, 1005, + 613, 976, 1070, 1081, 1082, 1030, 1031, 1032, 1083, 1084, + 972, 877, 1012, 813, 1018, 1009, 878, 879, 623, 839, + 1041, 818, 826, 810, 628, 632, 1085, 1086, 1087, 974, + 807, 819, 880, 881, 1042, 809, 1043, 1088, 682, 884, + 747, 1089, 1035, 752, 756, 281, 658, 335, 763, 796, + 1071, 862, 845, 804, 1001, 756, 808, 888, 1090, 894, + 895, 896, 1033, 898, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 456, 456, 456, 456, 456, 456, + 305, 305, 305, 305, 305, 456, 456, 456, 456, 456, + 456, 456, 305, 305, 0, 0, 305, 0, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 289, 289, 289, + 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, + 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, + 289, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 289, 289, + 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, + 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, + 289, 289, 289, 289, 473, 473, 289, 289, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 289, 0, + 289, 289, 289, 289, 289, 289, 289, 289, 473, 861, + 473, 473, 138, 138, 138, 138, 473, 473, 473, -88, + -88, 473, 238, 473, 473, 138, 138, 473, 473, 473, + 473, 473, 473, 473, 473, 473, 473, 473, 0, 0, + 0, 384, 503, 473, 824, 824, 824, 824, 473, 473, + 473, 473, 503, 503, 473, 473, 473, 0, 0, 0, + 0, 0, 0, 0, 0, 384, 0, 0, 384, 0, + 0, 824, 824, 473, 238, 861, 168, 473, 0, 0, + 0, 0, 384, 824, 384, 443, 814, 503, 503, 814, + 443, 443, 150, 51, 168, 608, 608, 608, 608, 0, + 0, 659, 861, 861, 861, 861, 861, 861, 861, 861, + 861, 861, 861, 824, 0, 861, 0, 824, 824, 824, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 824, 0, 0, 945, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 955, + 0, 0, 0, 0, 0, 0, 824, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 815, 827, 0, 827, + 0, 815, 815, 815, 0, 0, 0, 0, 839, 809 + ); + + protected array $actionDefault = array( + 3,32767, 102,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767, 100,32767,32767,32767,32767, 602, 602, + 602, 602,32767,32767, 254, 102,32767,32767, 470, 387, + 387, 387,32767,32767, 544, 544, 544, 544, 544, 544, + 32767,32767,32767,32767,32767,32767, 470,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767, 100, + 32767,32767,32767, 36, 7, 8, 10, 11, 49, 17, + 324,32767,32767,32767,32767, 102,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767, 595,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767, 474, 453, + 454, 456, 457, 386, 545, 601, 327, 598, 385, 145, + 339, 329, 242, 330, 258, 475, 259, 476, 479, 480, + 215, 287, 382, 149, 150, 417, 471, 419, 469, 473, + 418, 392, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 390, 391, 472, 450, 449, + 448,32767,32767, 415, 416,32767,32767,32767,32767,32767, + 32767,32767,32767, 102,32767, 420, 389, 423, 421, 422, + 439, 440, 437, 438, 441,32767,32767,32767,32767, 442, + 443, 444, 445, 316,32767,32767, 366, 364, 316, 111, + 32767,32767, 430, 431,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767, 487, 538, 447,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767, 102,32767, 100, 540, 412, 414, 507, 425, 426, + 424, 393,32767, 514,32767, 102,32767, 516,32767,32767, + 32767,32767,32767,32767,32767, 539,32767, 546, 546,32767, + 500, 100, 195,32767,32767, 515,32767, 195, 195,32767, + 32767,32767,32767,32767,32767,32767,32767, 609, 500, 110, + 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, + 32767, 195, 110,32767,32767,32767, 100, 195, 195, 195, + 195, 195, 195, 195, 195, 195, 195, 190,32767, 268, + 270, 102, 563, 195,32767, 519,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767, 512,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767, 500, 435, 138,32767, 138, 546, 427, 428, + 429, 502, 546, 546, 546, 312, 289,32767,32767,32767, + 32767, 517, 100, 100, 100, 100, 512,32767,32767,32767, + 32767, 111, 486, 99, 99, 99, 99, 99, 103, 101, + 32767,32767,32767,32767, 223,32767, 99,32767, 101, 101, + 32767,32767, 223, 225, 212, 101, 227,32767, 567, 568, + 223, 101, 227, 227, 227, 247, 247, 489, 318, 101, + 99, 101, 101, 197, 318, 318,32767, 101, 489, 318, + 489, 318, 199, 318, 318, 318, 489, 318,32767, 101, + 318, 214, 99, 99, 318,32767,32767,32767, 502,32767, + 32767,32767,32767,32767,32767,32767, 222,32767,32767,32767, + 32767,32767,32767,32767,32767, 533,32767, 551, 565, 433, + 434, 436, 550, 548, 458, 459, 460, 461, 462, 463, + 464, 466, 597,32767, 506,32767,32767,32767, 338,32767, + 607,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767, 608,32767, + 546,32767,32767,32767,32767, 432, 9, 74, 495, 42, + 43, 51, 57, 523, 524, 525, 526, 520, 521, 527, + 522,32767,32767, 528, 573,32767,32767, 547, 600,32767, + 32767,32767,32767,32767,32767, 138,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767, 533,32767, 136, + 32767,32767,32767,32767,32767,32767,32767,32767, 529,32767, + 32767,32767, 546,32767,32767,32767,32767, 314, 311,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767, 546,32767,32767,32767,32767, + 32767, 291,32767, 308,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 286,32767,32767, 381, 502, 294, 296, 297,32767,32767, + 32767,32767, 360,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767, 152, 152, 3, 3, 341, 152, + 152, 152, 341, 341, 152, 341, 341, 341, 152, 152, + 152, 152, 152, 152, 280, 185, 262, 265, 247, 247, + 152, 352, 152 + ); + + protected array $goto = array( + 196, 196, 1038, 1069, 701, 353, 433, 665, 856, 710, + 427, 321, 315, 316, 337, 580, 432, 338, 434, 642, + 658, 659, 857, 676, 677, 678, 979, 167, 167, 167, + 167, 221, 197, 193, 193, 177, 179, 216, 193, 193, + 193, 193, 193, 194, 194, 194, 194, 194, 194, 188, + 189, 190, 191, 192, 218, 216, 219, 539, 540, 423, + 541, 544, 545, 546, 547, 548, 549, 550, 551, 1140, + 168, 169, 170, 195, 171, 172, 173, 166, 174, 175, + 176, 178, 215, 217, 220, 238, 243, 244, 255, 257, + 258, 259, 260, 261, 262, 263, 264, 269, 270, 271, + 272, 282, 283, 318, 319, 320, 428, 429, 430, 585, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 180, 237, 181, 198, 199, + 200, 239, 188, 189, 190, 191, 192, 218, 1140, 201, + 182, 183, 184, 202, 198, 185, 240, 203, 201, 165, + 204, 205, 186, 206, 207, 208, 187, 209, 210, 211, + 212, 213, 214, 859, 421, 1041, 1041, 625, 662, 685, + 956, 251, 251, 1033, 1049, 1050, 279, 279, 279, 279, + 344, 831, 852, 627, 627, 890, 604, 1276, 1276, 1276, + 1276, 1276, 1276, 1276, 1276, 1276, 1276, 351, 249, 249, + 249, 249, 246, 252, 345, 344, 577, 864, 460, 913, + 908, 909, 922, 865, 910, 862, 911, 912, 863, 469, + 469, 916, 897, 855, 897, 897, 357, 917, 469, 918, + 1336, 1091, 1086, 1087, 1088, 852, 357, 357, 613, 628, + 631, 632, 633, 634, 655, 656, 657, 712, 396, 698, + 357, 357, 833, 1000, 357, 441, 1363, 354, 355, 872, + 1244, 698, 1244, 1244, 426, 698, 615, 558, 1038, 1038, + 1244, 357, 357, 1038, 884, 1038, 1038, 871, 575, 1038, + 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, + 1328, 1328, 1328, 1328, 1137, 1244, 356, 356, 356, 356, + 1244, 1244, 1244, 1244, 1111, 1112, 1244, 1244, 1244, 1220, + 948, 563, 556, 1221, 1224, 949, 1225, 1062, 554, 1307, + 554, 554, 482, 603, 1104, 930, 713, 465, 554, 931, + 484, 5, 946, 6, 1189, 946, 511, 704, 664, 1102, + 690, 343, 556, 563, 572, 573, 346, 583, 606, 620, + 621, 1044, 1043, 458, 852, 1047, 1048, 22, 973, 973, + 973, 973, 327, 310, 458, 967, 974, 1295, 1295, 440, + 558, 1295, 1295, 1295, 1295, 1295, 1295, 1295, 1295, 1295, + 1295, 1292, 1292, 837, 686, 1292, 1292, 1292, 1292, 1292, + 1292, 1292, 1292, 1292, 1292, 543, 543, 1323, 1324, 543, + 543, 543, 543, 543, 543, 543, 543, 543, 543, 542, + 542, 254, 254, 542, 670, 542, 542, 542, 542, 542, + 542, 542, 542, 339, 837, 962, 837, 557, 567, 581, + 618, 557, 849, 567, 877, 1237, 399, 464, 451, 451, + 451, 451, 405, 1318, 619, 1318, 1318, 1239, 874, 472, + 584, 473, 474, 1318, 1235, 1075, 882, 570, 1022, 1354, + 1355, 737, 641, 643, 740, 1079, 663, 479, 1321, 1322, + 687, 691, 1014, 699, 708, 1010, 503, 886, 504, 1330, + 1330, 1330, 1330, 1122, 510, 880, 984, 410, 411, 0, + 1346, 1346, 674, 1261, 675, 0, 414, 415, 416, 0, + 688, 1240, 1241, 417, 0, 0, 1314, 349, 1346, 0, + 847, 885, 873, 1074, 1078, 552, 552, 552, 552, 0, + 608, 0, 0, 982, 0, 1349, 1349, 0, 0, 1242, + 1304, 1305, 451, 451, 451, 451, 451, 451, 451, 451, + 451, 451, 451, 935, 1127, 451, 0, 972, 1077, 0, + 623, 0, 1316, 1316, 1077, 0, 1019, 0, 326, 276, + 326, 326, 0, 0, 876, 0, 668, 998, 435, 1120, + 889, 0, 870, 435, 398, 401, 564, 605, 609, 0, + 1003, 1045, 1045, 975, 1234, 736, 669, 1056, 1052, 1053, + 971, 412, 709, 555, 1012, 1007, 635, 637, 639, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1017, 1017 + ); + + protected array $gotoCheck = array( + 42, 42, 73, 127, 73, 97, 66, 66, 26, 9, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 86, 86, 27, 86, 86, 86, 49, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 15, 43, 89, 89, 56, 56, 89, + 89, 5, 5, 89, 89, 89, 23, 23, 23, 23, + 170, 6, 22, 108, 108, 45, 130, 108, 108, 108, + 108, 108, 108, 108, 108, 108, 108, 181, 5, 5, + 5, 5, 5, 5, 170, 170, 174, 15, 83, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 149, + 149, 15, 25, 25, 25, 25, 14, 65, 149, 65, + 183, 15, 15, 15, 15, 22, 14, 14, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 62, 7, + 14, 14, 7, 103, 14, 83, 14, 97, 97, 35, + 73, 7, 73, 73, 13, 7, 13, 14, 73, 73, + 73, 14, 14, 73, 35, 73, 73, 35, 104, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 9, 9, 9, 9, 150, 73, 24, 24, 24, 24, + 73, 73, 73, 73, 144, 144, 73, 73, 73, 79, + 79, 76, 76, 79, 79, 79, 79, 114, 19, 14, + 19, 19, 84, 8, 8, 73, 8, 151, 19, 73, + 84, 46, 9, 46, 151, 9, 8, 8, 64, 8, + 14, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 118, 118, 19, 22, 119, 119, 76, 19, 19, + 19, 19, 171, 171, 19, 19, 19, 172, 172, 113, + 14, 172, 172, 172, 172, 172, 172, 172, 172, 172, + 172, 173, 173, 12, 116, 173, 173, 173, 173, 173, + 173, 173, 173, 173, 173, 175, 175, 180, 180, 175, + 175, 175, 175, 175, 175, 175, 175, 175, 175, 158, + 158, 5, 5, 158, 120, 158, 158, 158, 158, 158, + 158, 158, 158, 29, 12, 92, 12, 9, 9, 2, + 2, 9, 18, 9, 39, 14, 9, 9, 23, 23, + 23, 23, 28, 130, 80, 130, 130, 20, 37, 9, + 9, 9, 9, 130, 162, 129, 9, 48, 110, 9, + 9, 48, 48, 48, 99, 132, 48, 178, 178, 178, + 48, 48, 48, 48, 48, 48, 155, 41, 155, 130, + 130, 130, 130, 147, 155, 9, 96, 82, 82, -1, + 184, 184, 82, 20, 82, -1, 82, 82, 82, -1, + 82, 20, 20, 82, -1, -1, 130, 82, 184, -1, + 20, 16, 16, 16, 16, 107, 107, 107, 107, -1, + 107, -1, -1, 16, -1, 184, 184, -1, -1, 20, + 20, 20, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 17, 17, 23, -1, 16, 130, -1, + 17, -1, 130, 130, 130, -1, 17, -1, 24, 24, + 24, 24, -1, -1, 17, -1, 17, 17, 117, 16, + 16, -1, 17, 117, 59, 59, 59, 59, 59, -1, + 50, 117, 117, 50, 17, 50, 117, 117, 117, 117, + 93, 93, 93, 50, 50, 50, 85, 85, 85, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 107, 107 + ); + + protected array $gotoBase = array( + 0, 0, -287, 0, 0, 170, 161, 242, 315, -11, + 0, 0, 85, -75, -73, -187, 57, 75, 121, 53, + 52, 0, -97, 173, 293, 219, 4, 18, 103, 125, + 0, 0, 0, 0, 0, -114, 0, 107, 0, 109, + 0, 35, -1, 145, 0, 162, -409, 0, -258, 8, + 568, 0, 0, 0, 0, 0, 127, 0, 0, 529, + 0, 0, 206, 0, 96, 213, -235, 0, 0, 0, + 0, 0, 0, -5, 0, 0, -36, 0, 0, -101, + 98, -122, -7, -71, -150, 114, -702, 0, 0, -115, + 0, 0, 94, 284, 0, 0, 42, -481, 0, 55, + 0, 0, 0, 218, 235, 0, 0, 487, -58, 0, + 86, 0, 0, 91, 43, 0, 100, 295, 71, 69, + 123, 0, 0, 0, 0, 0, 0, 1, 0, 79, + 178, 0, 22, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 28, 0, 0, 38, 0, 185, + 48, 59, 0, 0, 0, -22, 0, 0, 168, 0, + 0, 0, 83, 0, 0, 0, 0, 0, 0, 0, + -119, 39, 126, 140, 177, 154, 0, 0, 165, 0, + 23, 167, 0, 199, 181, 0, 0 + ); + + protected array $gotoDefault = array( + -32768, 515, 744, 4, 745, 939, 820, 829, 601, 533, + 711, 350, 629, 424, 1312, 915, 1126, 582, 848, 1253, + 1227, 459, 851, 332, 734, 927, 898, 899, 402, 388, + 394, 400, 653, 630, 497, 883, 455, 875, 489, 878, + 454, 887, 164, 420, 513, 891, 3, 894, 561, 925, + 977, 389, 902, 390, 681, 904, 566, 906, 907, 397, + 403, 404, 1131, 574, 626, 919, 256, 568, 920, 387, + 921, 929, 392, 395, 692, 468, 508, 502, 413, 1106, + 569, 612, 650, 448, 476, 624, 636, 622, 483, 436, + 418, 331, 961, 969, 490, 466, 983, 352, 991, 742, + 1139, 644, 492, 999, 645, 1006, 1009, 534, 535, 481, + 1021, 273, 1024, 493, 19, 671, 1035, 1036, 672, 646, + 1058, 647, 673, 648, 1060, 475, 602, 1068, 456, 1076, + 1300, 457, 1080, 266, 1083, 278, 419, 437, 1089, 1090, + 9, 1096, 702, 703, 11, 277, 512, 1121, 693, 453, + 1138, 452, 1208, 1210, 562, 494, 1228, 480, 295, 1231, + 684, 509, 1236, 449, 1303, 450, 536, 477, 317, 537, + 1347, 309, 335, 314, 553, 296, 336, 538, 478, 1309, + 1317, 333, 31, 1337, 1348, 579, 617 + ); + + protected array $ruleToNonTerminal = array( + 0, 1, 3, 3, 2, 5, 5, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, + 7, 7, 7, 7, 7, 8, 8, 9, 10, 11, + 11, 11, 12, 12, 13, 13, 14, 15, 15, 16, + 16, 17, 17, 18, 18, 21, 21, 22, 23, 23, + 24, 24, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 29, 29, 30, 30, 32, 34, 34, + 28, 36, 36, 33, 38, 38, 35, 35, 37, 37, + 39, 39, 31, 40, 40, 41, 43, 44, 44, 45, + 45, 46, 46, 48, 47, 47, 47, 47, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 25, 25, 50, 69, 69, 72, 72, 71, + 70, 70, 63, 75, 75, 76, 76, 77, 77, 78, + 78, 79, 79, 80, 80, 26, 26, 27, 27, 27, + 27, 27, 88, 88, 90, 90, 83, 83, 91, 91, + 92, 92, 92, 84, 84, 87, 87, 85, 85, 93, + 94, 94, 57, 57, 65, 65, 68, 68, 68, 67, + 95, 95, 96, 58, 58, 58, 58, 97, 97, 98, + 98, 99, 99, 100, 101, 101, 102, 102, 103, 103, + 55, 55, 51, 51, 105, 53, 53, 106, 52, 52, + 54, 54, 64, 64, 64, 64, 81, 81, 109, 109, + 111, 111, 112, 112, 112, 112, 110, 110, 110, 114, + 114, 114, 114, 89, 89, 117, 117, 117, 118, 118, + 115, 115, 119, 119, 121, 121, 122, 122, 116, 123, + 123, 120, 124, 124, 124, 124, 113, 113, 82, 82, + 82, 20, 20, 20, 126, 125, 125, 127, 127, 127, + 127, 60, 128, 128, 129, 61, 131, 131, 132, 132, + 133, 133, 86, 134, 134, 134, 134, 134, 134, 134, + 139, 139, 140, 140, 141, 141, 141, 141, 141, 142, + 143, 143, 138, 138, 135, 135, 137, 137, 145, 145, + 144, 144, 144, 144, 144, 144, 144, 136, 146, 146, + 148, 147, 147, 62, 104, 149, 149, 56, 56, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 156, 158, 158, 159, 150, 150, 155, + 155, 160, 161, 161, 162, 163, 164, 164, 164, 164, + 19, 19, 73, 73, 73, 73, 151, 151, 151, 151, + 166, 166, 152, 152, 154, 154, 154, 157, 157, 172, + 172, 172, 172, 172, 172, 172, 172, 172, 173, 173, + 173, 108, 175, 175, 175, 175, 153, 153, 153, 153, + 153, 153, 153, 153, 59, 59, 169, 169, 169, 169, + 169, 176, 176, 165, 165, 165, 165, 177, 177, 177, + 177, 177, 177, 74, 74, 66, 66, 66, 66, 130, + 130, 130, 130, 180, 179, 168, 168, 168, 168, 168, + 168, 168, 167, 167, 167, 178, 178, 178, 178, 107, + 174, 182, 182, 181, 181, 183, 183, 183, 183, 183, + 183, 183, 183, 171, 171, 171, 171, 170, 185, 184, + 184, 184, 184, 184, 184, 184, 184, 186, 186, 186, + 186 + ); + + protected array $ruleToLength = array( + 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, + 1, 0, 1, 1, 2, 1, 3, 4, 1, 2, + 0, 1, 1, 1, 1, 4, 3, 5, 4, 3, + 4, 2, 3, 1, 1, 7, 6, 2, 3, 1, + 2, 3, 1, 2, 3, 1, 1, 3, 1, 3, + 1, 2, 2, 3, 1, 3, 2, 3, 1, 3, + 3, 2, 0, 1, 1, 1, 1, 1, 3, 7, + 10, 5, 7, 9, 5, 3, 3, 3, 3, 3, + 3, 1, 2, 5, 7, 9, 6, 5, 6, 3, + 2, 1, 1, 1, 1, 0, 2, 1, 3, 8, + 0, 4, 2, 1, 3, 0, 1, 0, 1, 0, + 1, 3, 1, 1, 1, 8, 9, 7, 8, 7, + 6, 8, 0, 2, 0, 2, 1, 2, 1, 2, + 1, 1, 1, 0, 2, 0, 2, 0, 2, 2, + 1, 3, 1, 4, 1, 4, 1, 1, 4, 2, + 1, 3, 3, 3, 4, 4, 5, 0, 2, 4, + 3, 1, 1, 7, 0, 2, 1, 3, 3, 4, + 1, 4, 0, 2, 5, 0, 2, 6, 0, 2, + 0, 3, 1, 2, 1, 1, 2, 0, 1, 3, + 0, 2, 1, 1, 1, 1, 6, 8, 6, 1, + 2, 1, 1, 1, 1, 1, 1, 1, 1, 3, + 3, 3, 1, 3, 3, 3, 3, 3, 1, 3, + 3, 1, 1, 2, 1, 1, 0, 1, 0, 2, + 2, 2, 4, 3, 1, 1, 3, 1, 2, 2, + 3, 2, 3, 1, 1, 2, 3, 1, 1, 3, + 2, 0, 1, 5, 5, 6, 10, 3, 5, 1, + 1, 3, 0, 2, 4, 5, 4, 4, 4, 3, + 1, 1, 1, 1, 1, 1, 0, 1, 1, 2, + 1, 1, 1, 1, 1, 1, 1, 2, 1, 3, + 1, 1, 3, 2, 2, 3, 1, 0, 1, 1, + 3, 3, 3, 4, 4, 1, 1, 2, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, + 3, 4, 4, 2, 2, 4, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 1, 3, 2, + 1, 2, 4, 2, 2, 8, 9, 8, 9, 9, + 10, 9, 10, 8, 3, 2, 2, 1, 1, 0, + 4, 2, 1, 3, 2, 1, 2, 2, 2, 4, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, + 1, 1, 0, 3, 0, 1, 1, 0, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 5, + 3, 3, 4, 1, 1, 3, 1, 1, 1, 1, + 1, 3, 2, 3, 0, 1, 1, 3, 1, 1, + 1, 1, 1, 1, 3, 1, 1, 1, 4, 4, + 1, 4, 4, 0, 1, 1, 1, 3, 3, 1, + 4, 2, 2, 1, 3, 1, 4, 4, 3, 3, + 3, 3, 1, 3, 1, 1, 3, 1, 1, 4, + 1, 1, 1, 3, 1, 1, 2, 1, 3, 4, + 3, 2, 0, 2, 2, 1, 2, 1, 1, 1, + 4, 3, 3, 3, 3, 6, 3, 1, 1, 2, + 1 + ); + + protected function initReduceCallbacks(): void { + $this->reduceCallbacks = [ + 0 => null, + 1 => static function ($self, $stackPos) { + $self->semValue = $self->handleNamespaces($self->semStack[$stackPos-(1-1)]); + }, + 2 => static function ($self, $stackPos) { + if ($self->semStack[$stackPos-(2-2)] !== null) { $self->semStack[$stackPos-(2-1)][] = $self->semStack[$stackPos-(2-2)]; } $self->semValue = $self->semStack[$stackPos-(2-1)];; + }, + 3 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 4 => static function ($self, $stackPos) { + $nop = $self->maybeCreateZeroLengthNop($self->tokenPos);; + if ($nop !== null) { $self->semStack[$stackPos-(1-1)][] = $nop; } $self->semValue = $self->semStack[$stackPos-(1-1)]; + }, + 5 => null, + 6 => null, + 7 => null, + 8 => null, + 9 => null, + 10 => null, + 11 => null, + 12 => null, + 13 => null, + 14 => null, + 15 => null, + 16 => null, + 17 => null, + 18 => null, + 19 => null, + 20 => null, + 21 => null, + 22 => null, + 23 => null, + 24 => null, + 25 => null, + 26 => null, + 27 => null, + 28 => null, + 29 => null, + 30 => null, + 31 => null, + 32 => null, + 33 => null, + 34 => null, + 35 => null, + 36 => null, + 37 => null, + 38 => null, + 39 => null, + 40 => null, + 41 => null, + 42 => null, + 43 => null, + 44 => null, + 45 => null, + 46 => null, + 47 => null, + 48 => null, + 49 => null, + 50 => null, + 51 => null, + 52 => null, + 53 => null, + 54 => null, + 55 => null, + 56 => null, + 57 => null, + 58 => null, + 59 => null, + 60 => null, + 61 => null, + 62 => null, + 63 => null, + 64 => null, + 65 => null, + 66 => null, + 67 => null, + 68 => null, + 69 => null, + 70 => null, + 71 => null, + 72 => null, + 73 => null, + 74 => null, + 75 => null, + 76 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(1-1)]; if ($self->semValue === "<?=") $self->emitError(new Error('Cannot use "<?=" as an identifier', $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos]))); + }, + 77 => null, + 78 => null, + 79 => null, + 80 => null, + 81 => null, + 82 => null, + 83 => null, + 84 => null, + 85 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 86 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 87 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 88 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 89 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 90 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 91 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 92 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 93 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 94 => null, + 95 => static function ($self, $stackPos) { + $self->semValue = new Name(substr($self->semStack[$stackPos-(1-1)], 1), $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 96 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable(substr($self->semStack[$stackPos-(1-1)], 1), $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 97 => static function ($self, $stackPos) { + /* nothing */ + }, + 98 => static function ($self, $stackPos) { + /* nothing */ + }, + 99 => static function ($self, $stackPos) { + /* nothing */ + }, + 100 => static function ($self, $stackPos) { + $self->emitError(new Error('A trailing comma is not allowed here', $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos]))); + }, + 101 => null, + 102 => null, + 103 => static function ($self, $stackPos) { + $self->semValue = new Node\Attribute($self->semStack[$stackPos-(1-1)], [], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 104 => static function ($self, $stackPos) { + $self->semValue = new Node\Attribute($self->semStack[$stackPos-(2-1)], $self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 105 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 106 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 107 => static function ($self, $stackPos) { + $self->semValue = new Node\AttributeGroup($self->semStack[$stackPos-(4-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 108 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 109 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(2-1)][] = $self->semStack[$stackPos-(2-2)]; $self->semValue = $self->semStack[$stackPos-(2-1)]; + }, + 110 => static function ($self, $stackPos) { + $self->semValue = []; + }, + 111 => null, + 112 => null, + 113 => null, + 114 => null, + 115 => static function ($self, $stackPos) { + $self->semValue = new Stmt\HaltCompiler($self->handleHaltCompiler(), $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 116 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Namespace_($self->semStack[$stackPos-(3-2)], null, $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + $self->semValue->setAttribute('kind', Stmt\Namespace_::KIND_SEMICOLON); + $self->checkNamespace($self->semValue); + }, + 117 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Namespace_($self->semStack[$stackPos-(5-2)], $self->semStack[$stackPos-(5-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos])); + $self->semValue->setAttribute('kind', Stmt\Namespace_::KIND_BRACED); + $self->checkNamespace($self->semValue); + }, + 118 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Namespace_(null, $self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + $self->semValue->setAttribute('kind', Stmt\Namespace_::KIND_BRACED); + $self->checkNamespace($self->semValue); + }, + 119 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Use_($self->semStack[$stackPos-(3-2)], Stmt\Use_::TYPE_NORMAL, $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 120 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Use_($self->semStack[$stackPos-(4-3)], $self->semStack[$stackPos-(4-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 121 => null, + 122 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Const_($self->semStack[$stackPos-(3-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 123 => static function ($self, $stackPos) { + $self->semValue = Stmt\Use_::TYPE_FUNCTION; + }, + 124 => static function ($self, $stackPos) { + $self->semValue = Stmt\Use_::TYPE_CONSTANT; + }, + 125 => static function ($self, $stackPos) { + $self->semValue = new Stmt\GroupUse($self->semStack[$stackPos-(7-3)], $self->semStack[$stackPos-(7-6)], $self->semStack[$stackPos-(7-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(7-1)], $self->tokenEndStack[$stackPos])); + }, + 126 => static function ($self, $stackPos) { + $self->semValue = new Stmt\GroupUse($self->semStack[$stackPos-(6-2)], $self->semStack[$stackPos-(6-5)], Stmt\Use_::TYPE_UNKNOWN, $self->getAttributes($self->tokenStartStack[$stackPos-(6-1)], $self->tokenEndStack[$stackPos])); + }, + 127 => null, + 128 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 129 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 130 => null, + 131 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 132 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 133 => null, + 134 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 135 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 136 => static function ($self, $stackPos) { + $self->semValue = new Node\UseItem($self->semStack[$stackPos-(1-1)], null, Stmt\Use_::TYPE_UNKNOWN, $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); $self->checkUseUse($self->semValue, $stackPos-(1-1)); + }, + 137 => static function ($self, $stackPos) { + $self->semValue = new Node\UseItem($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], Stmt\Use_::TYPE_UNKNOWN, $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); $self->checkUseUse($self->semValue, $stackPos-(3-3)); + }, + 138 => static function ($self, $stackPos) { + $self->semValue = new Node\UseItem($self->semStack[$stackPos-(1-1)], null, Stmt\Use_::TYPE_UNKNOWN, $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); $self->checkUseUse($self->semValue, $stackPos-(1-1)); + }, + 139 => static function ($self, $stackPos) { + $self->semValue = new Node\UseItem($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], Stmt\Use_::TYPE_UNKNOWN, $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); $self->checkUseUse($self->semValue, $stackPos-(3-3)); + }, + 140 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(1-1)]; $self->semValue->type = Stmt\Use_::TYPE_NORMAL; + }, + 141 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(2-2)]; $self->semValue->type = $self->semStack[$stackPos-(2-1)]; + }, + 142 => null, + 143 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 144 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 145 => static function ($self, $stackPos) { + $self->semValue = new Node\Const_($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 146 => null, + 147 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 148 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 149 => static function ($self, $stackPos) { + $self->semValue = new Node\Const_(new Node\Identifier($self->semStack[$stackPos-(3-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos-(3-1)])), $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 150 => static function ($self, $stackPos) { + $self->semValue = new Node\Const_(new Node\Identifier($self->semStack[$stackPos-(3-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos-(3-1)])), $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 151 => static function ($self, $stackPos) { + if ($self->semStack[$stackPos-(2-2)] !== null) { $self->semStack[$stackPos-(2-1)][] = $self->semStack[$stackPos-(2-2)]; } $self->semValue = $self->semStack[$stackPos-(2-1)];; + }, + 152 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 153 => static function ($self, $stackPos) { + $nop = $self->maybeCreateZeroLengthNop($self->tokenPos);; + if ($nop !== null) { $self->semStack[$stackPos-(1-1)][] = $nop; } $self->semValue = $self->semStack[$stackPos-(1-1)]; + }, + 154 => null, + 155 => null, + 156 => null, + 157 => static function ($self, $stackPos) { + throw new Error('__HALT_COMPILER() can only be used from the outermost scope', $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 158 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Block($self->semStack[$stackPos-(3-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 159 => static function ($self, $stackPos) { + $self->semValue = new Stmt\If_($self->semStack[$stackPos-(7-3)], ['stmts' => $self->semStack[$stackPos-(7-5)], 'elseifs' => $self->semStack[$stackPos-(7-6)], 'else' => $self->semStack[$stackPos-(7-7)]], $self->getAttributes($self->tokenStartStack[$stackPos-(7-1)], $self->tokenEndStack[$stackPos])); + }, + 160 => static function ($self, $stackPos) { + $self->semValue = new Stmt\If_($self->semStack[$stackPos-(10-3)], ['stmts' => $self->semStack[$stackPos-(10-6)], 'elseifs' => $self->semStack[$stackPos-(10-7)], 'else' => $self->semStack[$stackPos-(10-8)]], $self->getAttributes($self->tokenStartStack[$stackPos-(10-1)], $self->tokenEndStack[$stackPos])); + }, + 161 => static function ($self, $stackPos) { + $self->semValue = new Stmt\While_($self->semStack[$stackPos-(5-3)], $self->semStack[$stackPos-(5-5)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos])); + }, + 162 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Do_($self->semStack[$stackPos-(7-5)], $self->semStack[$stackPos-(7-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(7-1)], $self->tokenEndStack[$stackPos])); + }, + 163 => static function ($self, $stackPos) { + $self->semValue = new Stmt\For_(['init' => $self->semStack[$stackPos-(9-3)], 'cond' => $self->semStack[$stackPos-(9-5)], 'loop' => $self->semStack[$stackPos-(9-7)], 'stmts' => $self->semStack[$stackPos-(9-9)]], $self->getAttributes($self->tokenStartStack[$stackPos-(9-1)], $self->tokenEndStack[$stackPos])); + }, + 164 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Switch_($self->semStack[$stackPos-(5-3)], $self->semStack[$stackPos-(5-5)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos])); + }, + 165 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Break_($self->semStack[$stackPos-(3-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 166 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Continue_($self->semStack[$stackPos-(3-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 167 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Return_($self->semStack[$stackPos-(3-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 168 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Global_($self->semStack[$stackPos-(3-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 169 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Static_($self->semStack[$stackPos-(3-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 170 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Echo_($self->semStack[$stackPos-(3-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 171 => static function ($self, $stackPos) { + + $self->semValue = new Stmt\InlineHTML($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + $self->semValue->setAttribute('hasLeadingNewline', $self->inlineHtmlHasLeadingNewline($stackPos-(1-1))); + + }, + 172 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Expression($self->semStack[$stackPos-(2-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 173 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Unset_($self->semStack[$stackPos-(5-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos])); + }, + 174 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Foreach_($self->semStack[$stackPos-(7-3)], $self->semStack[$stackPos-(7-5)][0], ['keyVar' => null, 'byRef' => $self->semStack[$stackPos-(7-5)][1], 'stmts' => $self->semStack[$stackPos-(7-7)]], $self->getAttributes($self->tokenStartStack[$stackPos-(7-1)], $self->tokenEndStack[$stackPos])); + }, + 175 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Foreach_($self->semStack[$stackPos-(9-3)], $self->semStack[$stackPos-(9-7)][0], ['keyVar' => $self->semStack[$stackPos-(9-5)], 'byRef' => $self->semStack[$stackPos-(9-7)][1], 'stmts' => $self->semStack[$stackPos-(9-9)]], $self->getAttributes($self->tokenStartStack[$stackPos-(9-1)], $self->tokenEndStack[$stackPos])); + }, + 176 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Foreach_($self->semStack[$stackPos-(6-3)], new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos-(6-4)], $self->tokenEndStack[$stackPos-(6-4)])), ['stmts' => $self->semStack[$stackPos-(6-6)]], $self->getAttributes($self->tokenStartStack[$stackPos-(6-1)], $self->tokenEndStack[$stackPos])); + }, + 177 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Declare_($self->semStack[$stackPos-(5-3)], $self->semStack[$stackPos-(5-5)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos])); + }, + 178 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TryCatch($self->semStack[$stackPos-(6-3)], $self->semStack[$stackPos-(6-5)], $self->semStack[$stackPos-(6-6)], $self->getAttributes($self->tokenStartStack[$stackPos-(6-1)], $self->tokenEndStack[$stackPos])); $self->checkTryCatch($self->semValue); + }, + 179 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Goto_($self->semStack[$stackPos-(3-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 180 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Label($self->semStack[$stackPos-(2-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 181 => static function ($self, $stackPos) { + $self->semValue = null; /* means: no statement */ + }, + 182 => null, + 183 => static function ($self, $stackPos) { + $self->semValue = $self->maybeCreateNop($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos]); + }, + 184 => static function ($self, $stackPos) { + if ($self->semStack[$stackPos-(1-1)] instanceof Stmt\Block) { $self->semValue = $self->semStack[$stackPos-(1-1)]->stmts; } else if ($self->semStack[$stackPos-(1-1)] === null) { $self->semValue = []; } else { $self->semValue = [$self->semStack[$stackPos-(1-1)]]; }; + }, + 185 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 186 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(2-1)][] = $self->semStack[$stackPos-(2-2)]; $self->semValue = $self->semStack[$stackPos-(2-1)]; + }, + 187 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 188 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 189 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Catch_($self->semStack[$stackPos-(8-3)], $self->semStack[$stackPos-(8-4)], $self->semStack[$stackPos-(8-7)], $self->getAttributes($self->tokenStartStack[$stackPos-(8-1)], $self->tokenEndStack[$stackPos])); + }, + 190 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 191 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Finally_($self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 192 => null, + 193 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 194 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 195 => static function ($self, $stackPos) { + $self->semValue = false; + }, + 196 => static function ($self, $stackPos) { + $self->semValue = true; + }, + 197 => static function ($self, $stackPos) { + $self->semValue = false; + }, + 198 => static function ($self, $stackPos) { + $self->semValue = true; + }, + 199 => static function ($self, $stackPos) { + $self->semValue = false; + }, + 200 => static function ($self, $stackPos) { + $self->semValue = true; + }, + 201 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 202 => static function ($self, $stackPos) { + $self->semValue = []; + }, + 203 => null, + 204 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 205 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Function_($self->semStack[$stackPos-(8-3)], ['byRef' => $self->semStack[$stackPos-(8-2)], 'params' => $self->semStack[$stackPos-(8-5)], 'returnType' => $self->semStack[$stackPos-(8-7)], 'stmts' => $self->semStack[$stackPos-(8-8)], 'attrGroups' => []], $self->getAttributes($self->tokenStartStack[$stackPos-(8-1)], $self->tokenEndStack[$stackPos])); + }, + 206 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Function_($self->semStack[$stackPos-(9-4)], ['byRef' => $self->semStack[$stackPos-(9-3)], 'params' => $self->semStack[$stackPos-(9-6)], 'returnType' => $self->semStack[$stackPos-(9-8)], 'stmts' => $self->semStack[$stackPos-(9-9)], 'attrGroups' => $self->semStack[$stackPos-(9-1)]], $self->getAttributes($self->tokenStartStack[$stackPos-(9-1)], $self->tokenEndStack[$stackPos])); + }, + 207 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Class_($self->semStack[$stackPos-(7-2)], ['type' => $self->semStack[$stackPos-(7-1)], 'extends' => $self->semStack[$stackPos-(7-3)], 'implements' => $self->semStack[$stackPos-(7-4)], 'stmts' => $self->semStack[$stackPos-(7-6)], 'attrGroups' => []], $self->getAttributes($self->tokenStartStack[$stackPos-(7-1)], $self->tokenEndStack[$stackPos])); + $self->checkClass($self->semValue, $stackPos-(7-2)); + }, + 208 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Class_($self->semStack[$stackPos-(8-3)], ['type' => $self->semStack[$stackPos-(8-2)], 'extends' => $self->semStack[$stackPos-(8-4)], 'implements' => $self->semStack[$stackPos-(8-5)], 'stmts' => $self->semStack[$stackPos-(8-7)], 'attrGroups' => $self->semStack[$stackPos-(8-1)]], $self->getAttributes($self->tokenStartStack[$stackPos-(8-1)], $self->tokenEndStack[$stackPos])); + $self->checkClass($self->semValue, $stackPos-(8-3)); + }, + 209 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Interface_($self->semStack[$stackPos-(7-3)], ['extends' => $self->semStack[$stackPos-(7-4)], 'stmts' => $self->semStack[$stackPos-(7-6)], 'attrGroups' => $self->semStack[$stackPos-(7-1)]], $self->getAttributes($self->tokenStartStack[$stackPos-(7-1)], $self->tokenEndStack[$stackPos])); + $self->checkInterface($self->semValue, $stackPos-(7-3)); + }, + 210 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Trait_($self->semStack[$stackPos-(6-3)], ['stmts' => $self->semStack[$stackPos-(6-5)], 'attrGroups' => $self->semStack[$stackPos-(6-1)]], $self->getAttributes($self->tokenStartStack[$stackPos-(6-1)], $self->tokenEndStack[$stackPos])); + }, + 211 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Enum_($self->semStack[$stackPos-(8-3)], ['scalarType' => $self->semStack[$stackPos-(8-4)], 'implements' => $self->semStack[$stackPos-(8-5)], 'stmts' => $self->semStack[$stackPos-(8-7)], 'attrGroups' => $self->semStack[$stackPos-(8-1)]], $self->getAttributes($self->tokenStartStack[$stackPos-(8-1)], $self->tokenEndStack[$stackPos])); + $self->checkEnum($self->semValue, $stackPos-(8-3)); + }, + 212 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 213 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(2-2)]; + }, + 214 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 215 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(2-2)]; + }, + 216 => static function ($self, $stackPos) { + $self->semValue = 0; + }, + 217 => null, + 218 => null, + 219 => static function ($self, $stackPos) { + $self->checkClassModifier($self->semStack[$stackPos-(2-1)], $self->semStack[$stackPos-(2-2)], $stackPos-(2-2)); $self->semValue = $self->semStack[$stackPos-(2-1)] | $self->semStack[$stackPos-(2-2)]; + }, + 220 => static function ($self, $stackPos) { + $self->semValue = Modifiers::ABSTRACT; + }, + 221 => static function ($self, $stackPos) { + $self->semValue = Modifiers::FINAL; + }, + 222 => static function ($self, $stackPos) { + $self->semValue = Modifiers::READONLY; + }, + 223 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 224 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(2-2)]; + }, + 225 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 226 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(2-2)]; + }, + 227 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 228 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(2-2)]; + }, + 229 => null, + 230 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 231 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 232 => null, + 233 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(4-2)]; + }, + 234 => null, + 235 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(4-2)]; + }, + 236 => static function ($self, $stackPos) { + if ($self->semStack[$stackPos-(1-1)] instanceof Stmt\Block) { $self->semValue = $self->semStack[$stackPos-(1-1)]->stmts; } else if ($self->semStack[$stackPos-(1-1)] === null) { $self->semValue = []; } else { $self->semValue = [$self->semStack[$stackPos-(1-1)]]; }; + }, + 237 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 238 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(4-2)]; + }, + 239 => null, + 240 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 241 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 242 => static function ($self, $stackPos) { + $self->semValue = new Node\DeclareItem($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 243 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 244 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(4-3)]; + }, + 245 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(4-2)]; + }, + 246 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(5-3)]; + }, + 247 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 248 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(2-1)][] = $self->semStack[$stackPos-(2-2)]; $self->semValue = $self->semStack[$stackPos-(2-1)]; + }, + 249 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Case_($self->semStack[$stackPos-(4-2)], $self->semStack[$stackPos-(4-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 250 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Case_(null, $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 251 => null, + 252 => null, + 253 => static function ($self, $stackPos) { + $self->semValue = new Expr\Match_($self->semStack[$stackPos-(7-3)], $self->semStack[$stackPos-(7-6)], $self->getAttributes($self->tokenStartStack[$stackPos-(7-1)], $self->tokenEndStack[$stackPos])); + }, + 254 => static function ($self, $stackPos) { + $self->semValue = []; + }, + 255 => null, + 256 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 257 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 258 => static function ($self, $stackPos) { + $self->semValue = new Node\MatchArm($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 259 => static function ($self, $stackPos) { + $self->semValue = new Node\MatchArm(null, $self->semStack[$stackPos-(4-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 260 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(1-1)]; + }, + 261 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(4-2)]; + }, + 262 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 263 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(2-1)][] = $self->semStack[$stackPos-(2-2)]; $self->semValue = $self->semStack[$stackPos-(2-1)]; + }, + 264 => static function ($self, $stackPos) { + $self->semValue = new Stmt\ElseIf_($self->semStack[$stackPos-(5-3)], $self->semStack[$stackPos-(5-5)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos])); + }, + 265 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 266 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(2-1)][] = $self->semStack[$stackPos-(2-2)]; $self->semValue = $self->semStack[$stackPos-(2-1)]; + }, + 267 => static function ($self, $stackPos) { + $self->semValue = new Stmt\ElseIf_($self->semStack[$stackPos-(6-3)], $self->semStack[$stackPos-(6-6)], $self->getAttributes($self->tokenStartStack[$stackPos-(6-1)], $self->tokenEndStack[$stackPos])); $self->fixupAlternativeElse($self->semValue); + }, + 268 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 269 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Else_($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 270 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 271 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Else_($self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); $self->fixupAlternativeElse($self->semValue); + }, + 272 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)], false); + }, + 273 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(2-2)], true); + }, + 274 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)], false); + }, + 275 => static function ($self, $stackPos) { + $self->semValue = array($self->fixupArrayDestructuring($self->semStack[$stackPos-(1-1)]), false); + }, + 276 => null, + 277 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 278 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 279 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 280 => static function ($self, $stackPos) { + $self->semValue = 0; + }, + 281 => static function ($self, $stackPos) { + $self->checkModifier($self->semStack[$stackPos-(2-1)], $self->semStack[$stackPos-(2-2)], $stackPos-(2-2)); $self->semValue = $self->semStack[$stackPos-(2-1)] | $self->semStack[$stackPos-(2-2)]; + }, + 282 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PUBLIC; + }, + 283 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PROTECTED; + }, + 284 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PRIVATE; + }, + 285 => static function ($self, $stackPos) { + $self->semValue = Modifiers::READONLY; + }, + 286 => static function ($self, $stackPos) { + $self->semValue = new Node\Param($self->semStack[$stackPos-(6-6)], null, $self->semStack[$stackPos-(6-3)], $self->semStack[$stackPos-(6-4)], $self->semStack[$stackPos-(6-5)], $self->getAttributes($self->tokenStartStack[$stackPos-(6-1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos-(6-2)], $self->semStack[$stackPos-(6-1)]); + $self->checkParam($self->semValue); + }, + 287 => static function ($self, $stackPos) { + $self->semValue = new Node\Param($self->semStack[$stackPos-(8-6)], $self->semStack[$stackPos-(8-8)], $self->semStack[$stackPos-(8-3)], $self->semStack[$stackPos-(8-4)], $self->semStack[$stackPos-(8-5)], $self->getAttributes($self->tokenStartStack[$stackPos-(8-1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos-(8-2)], $self->semStack[$stackPos-(8-1)]); + $self->checkParam($self->semValue); + }, + 288 => static function ($self, $stackPos) { + $self->semValue = new Node\Param(new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos-(6-1)], $self->tokenEndStack[$stackPos])), null, $self->semStack[$stackPos-(6-3)], $self->semStack[$stackPos-(6-4)], $self->semStack[$stackPos-(6-5)], $self->getAttributes($self->tokenStartStack[$stackPos-(6-1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos-(6-2)], $self->semStack[$stackPos-(6-1)]); + }, + 289 => null, + 290 => static function ($self, $stackPos) { + $self->semValue = new Node\NullableType($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 291 => static function ($self, $stackPos) { + $self->semValue = new Node\UnionType($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 292 => null, + 293 => null, + 294 => static function ($self, $stackPos) { + $self->semValue = new Node\Name('static', $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 295 => static function ($self, $stackPos) { + $self->semValue = $self->handleBuiltinTypes($self->semStack[$stackPos-(1-1)]); + }, + 296 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier('array', $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 297 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier('callable', $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 298 => null, + 299 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 300 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)]); + }, + 301 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 302 => null, + 303 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 304 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)]); + }, + 305 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 306 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)]); + }, + 307 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 308 => static function ($self, $stackPos) { + $self->semValue = new Node\IntersectionType($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 309 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)]); + }, + 310 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 311 => static function ($self, $stackPos) { + $self->semValue = new Node\IntersectionType($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 312 => null, + 313 => static function ($self, $stackPos) { + $self->semValue = new Node\NullableType($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 314 => static function ($self, $stackPos) { + $self->semValue = new Node\UnionType($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 315 => null, + 316 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 317 => null, + 318 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 319 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(2-2)]; + }, + 320 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 321 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 322 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(4-2)]; + }, + 323 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(3-2)]); + }, + 324 => static function ($self, $stackPos) { + $self->semValue = new Node\VariadicPlaceholder($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 325 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 326 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 327 => static function ($self, $stackPos) { + $self->semValue = new Node\Arg($self->semStack[$stackPos-(1-1)], false, false, $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 328 => static function ($self, $stackPos) { + $self->semValue = new Node\Arg($self->semStack[$stackPos-(2-2)], true, false, $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 329 => static function ($self, $stackPos) { + $self->semValue = new Node\Arg($self->semStack[$stackPos-(2-2)], false, true, $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 330 => static function ($self, $stackPos) { + $self->semValue = new Node\Arg($self->semStack[$stackPos-(3-3)], false, false, $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos-(3-1)]); + }, + 331 => null, + 332 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 333 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 334 => null, + 335 => null, + 336 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 337 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 338 => static function ($self, $stackPos) { + $self->semValue = new Node\StaticVar($self->semStack[$stackPos-(1-1)], null, $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 339 => static function ($self, $stackPos) { + $self->semValue = new Node\StaticVar($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 340 => static function ($self, $stackPos) { + if ($self->semStack[$stackPos-(2-2)] !== null) { $self->semStack[$stackPos-(2-1)][] = $self->semStack[$stackPos-(2-2)]; $self->semValue = $self->semStack[$stackPos-(2-1)]; } else { $self->semValue = $self->semStack[$stackPos-(2-1)]; } + }, + 341 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 342 => static function ($self, $stackPos) { + $nop = $self->maybeCreateZeroLengthNop($self->tokenPos);; + if ($nop !== null) { $self->semStack[$stackPos-(1-1)][] = $nop; } $self->semValue = $self->semStack[$stackPos-(1-1)]; + }, + 343 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Property($self->semStack[$stackPos-(5-2)], $self->semStack[$stackPos-(5-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos-(5-3)], $self->semStack[$stackPos-(5-1)]); + $self->checkProperty($self->semValue, $stackPos-(5-2)); + }, + 344 => static function ($self, $stackPos) { + $self->semValue = new Stmt\ClassConst($self->semStack[$stackPos-(5-4)], $self->semStack[$stackPos-(5-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos-(5-1)]); + $self->checkClassConst($self->semValue, $stackPos-(5-2)); + }, + 345 => static function ($self, $stackPos) { + $self->semValue = new Stmt\ClassConst($self->semStack[$stackPos-(6-5)], $self->semStack[$stackPos-(6-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(6-1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos-(6-1)], $self->semStack[$stackPos-(6-4)]); + $self->checkClassConst($self->semValue, $stackPos-(6-2)); + }, + 346 => static function ($self, $stackPos) { + $self->semValue = new Stmt\ClassMethod($self->semStack[$stackPos-(10-5)], ['type' => $self->semStack[$stackPos-(10-2)], 'byRef' => $self->semStack[$stackPos-(10-4)], 'params' => $self->semStack[$stackPos-(10-7)], 'returnType' => $self->semStack[$stackPos-(10-9)], 'stmts' => $self->semStack[$stackPos-(10-10)], 'attrGroups' => $self->semStack[$stackPos-(10-1)]], $self->getAttributes($self->tokenStartStack[$stackPos-(10-1)], $self->tokenEndStack[$stackPos])); + $self->checkClassMethod($self->semValue, $stackPos-(10-2)); + }, + 347 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TraitUse($self->semStack[$stackPos-(3-2)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 348 => static function ($self, $stackPos) { + $self->semValue = new Stmt\EnumCase($self->semStack[$stackPos-(5-3)], $self->semStack[$stackPos-(5-4)], $self->semStack[$stackPos-(5-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos])); + }, + 349 => static function ($self, $stackPos) { + $self->semValue = null; /* will be skipped */ + }, + 350 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 351 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 352 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 353 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(2-1)][] = $self->semStack[$stackPos-(2-2)]; $self->semValue = $self->semStack[$stackPos-(2-1)]; + }, + 354 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TraitUseAdaptation\Precedence($self->semStack[$stackPos-(4-1)][0], $self->semStack[$stackPos-(4-1)][1], $self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 355 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TraitUseAdaptation\Alias($self->semStack[$stackPos-(5-1)][0], $self->semStack[$stackPos-(5-1)][1], $self->semStack[$stackPos-(5-3)], $self->semStack[$stackPos-(5-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos])); + }, + 356 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TraitUseAdaptation\Alias($self->semStack[$stackPos-(4-1)][0], $self->semStack[$stackPos-(4-1)][1], $self->semStack[$stackPos-(4-3)], null, $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 357 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TraitUseAdaptation\Alias($self->semStack[$stackPos-(4-1)][0], $self->semStack[$stackPos-(4-1)][1], null, $self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 358 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TraitUseAdaptation\Alias($self->semStack[$stackPos-(4-1)][0], $self->semStack[$stackPos-(4-1)][1], null, $self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 359 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)]); + }, + 360 => null, + 361 => static function ($self, $stackPos) { + $self->semValue = array(null, $self->semStack[$stackPos-(1-1)]); + }, + 362 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 363 => null, + 364 => null, + 365 => static function ($self, $stackPos) { + $self->semValue = 0; + }, + 366 => static function ($self, $stackPos) { + $self->semValue = 0; + }, + 367 => null, + 368 => null, + 369 => static function ($self, $stackPos) { + $self->checkModifier($self->semStack[$stackPos-(2-1)], $self->semStack[$stackPos-(2-2)], $stackPos-(2-2)); $self->semValue = $self->semStack[$stackPos-(2-1)] | $self->semStack[$stackPos-(2-2)]; + }, + 370 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PUBLIC; + }, + 371 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PROTECTED; + }, + 372 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PRIVATE; + }, + 373 => static function ($self, $stackPos) { + $self->semValue = Modifiers::STATIC; + }, + 374 => static function ($self, $stackPos) { + $self->semValue = Modifiers::ABSTRACT; + }, + 375 => static function ($self, $stackPos) { + $self->semValue = Modifiers::FINAL; + }, + 376 => static function ($self, $stackPos) { + $self->semValue = Modifiers::READONLY; + }, + 377 => null, + 378 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 379 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 380 => static function ($self, $stackPos) { + $self->semValue = new Node\VarLikeIdentifier(substr($self->semStack[$stackPos-(1-1)], 1), $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 381 => static function ($self, $stackPos) { + $self->semValue = new Node\PropertyItem($self->semStack[$stackPos-(1-1)], null, $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 382 => static function ($self, $stackPos) { + $self->semValue = new Node\PropertyItem($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 383 => null, + 384 => null, + 385 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 386 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 387 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 388 => null, + 389 => null, + 390 => static function ($self, $stackPos) { + $self->semValue = new Expr\Assign($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 391 => static function ($self, $stackPos) { + $self->semValue = new Expr\Assign($self->fixupArrayDestructuring($self->semStack[$stackPos-(3-1)]), $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 392 => static function ($self, $stackPos) { + $self->semValue = new Expr\Assign($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 393 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignRef($self->semStack[$stackPos-(4-1)], $self->semStack[$stackPos-(4-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 394 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignRef($self->semStack[$stackPos-(4-1)], $self->semStack[$stackPos-(4-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + if (!$self->phpVersion->allowsAssignNewByReference()) { + $self->emitError(new Error('Cannot assign new by reference', $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos]))); + } + + }, + 395 => null, + 396 => null, + 397 => static function ($self, $stackPos) { + $self->semValue = new Expr\Clone_($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 398 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Plus($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 399 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Minus($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 400 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Mul($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 401 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Div($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 402 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Concat($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 403 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Mod($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 404 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\BitwiseAnd($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 405 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\BitwiseOr($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 406 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\BitwiseXor($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 407 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\ShiftLeft($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 408 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\ShiftRight($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 409 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Pow($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 410 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Coalesce($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 411 => static function ($self, $stackPos) { + $self->semValue = new Expr\PostInc($self->semStack[$stackPos-(2-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 412 => static function ($self, $stackPos) { + $self->semValue = new Expr\PreInc($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 413 => static function ($self, $stackPos) { + $self->semValue = new Expr\PostDec($self->semStack[$stackPos-(2-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 414 => static function ($self, $stackPos) { + $self->semValue = new Expr\PreDec($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 415 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\BooleanOr($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 416 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\BooleanAnd($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 417 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\LogicalOr($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 418 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\LogicalAnd($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 419 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\LogicalXor($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 420 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\BitwiseOr($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 421 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\BitwiseAnd($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 422 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\BitwiseAnd($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 423 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\BitwiseXor($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 424 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Concat($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 425 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Plus($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 426 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Minus($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 427 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Mul($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 428 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Div($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 429 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Mod($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 430 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\ShiftLeft($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 431 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\ShiftRight($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 432 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Pow($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 433 => static function ($self, $stackPos) { + $self->semValue = new Expr\UnaryPlus($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 434 => static function ($self, $stackPos) { + $self->semValue = new Expr\UnaryMinus($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 435 => static function ($self, $stackPos) { + $self->semValue = new Expr\BooleanNot($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 436 => static function ($self, $stackPos) { + $self->semValue = new Expr\BitwiseNot($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 437 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Identical($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 438 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\NotIdentical($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 439 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Equal($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 440 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\NotEqual($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 441 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Spaceship($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 442 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Smaller($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 443 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\SmallerOrEqual($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 444 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Greater($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 445 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\GreaterOrEqual($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 446 => static function ($self, $stackPos) { + $self->semValue = new Expr\Instanceof_($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 447 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 448 => static function ($self, $stackPos) { + $self->semValue = new Expr\Ternary($self->semStack[$stackPos-(5-1)], $self->semStack[$stackPos-(5-3)], $self->semStack[$stackPos-(5-5)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos])); + }, + 449 => static function ($self, $stackPos) { + $self->semValue = new Expr\Ternary($self->semStack[$stackPos-(4-1)], null, $self->semStack[$stackPos-(4-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 450 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Coalesce($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 451 => static function ($self, $stackPos) { + $self->semValue = new Expr\Isset_($self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 452 => static function ($self, $stackPos) { + $self->semValue = new Expr\Empty_($self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 453 => static function ($self, $stackPos) { + $self->semValue = new Expr\Include_($self->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE, $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 454 => static function ($self, $stackPos) { + $self->semValue = new Expr\Include_($self->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE_ONCE, $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 455 => static function ($self, $stackPos) { + $self->semValue = new Expr\Eval_($self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 456 => static function ($self, $stackPos) { + $self->semValue = new Expr\Include_($self->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE, $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 457 => static function ($self, $stackPos) { + $self->semValue = new Expr\Include_($self->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE_ONCE, $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 458 => static function ($self, $stackPos) { + $self->semValue = new Expr\Cast\Int_($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 459 => static function ($self, $stackPos) { + $attrs = $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos]); + $attrs['kind'] = $self->getFloatCastKind($self->semStack[$stackPos-(2-1)]); + $self->semValue = new Expr\Cast\Double($self->semStack[$stackPos-(2-2)], $attrs); + }, + 460 => static function ($self, $stackPos) { + $self->semValue = new Expr\Cast\String_($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 461 => static function ($self, $stackPos) { + $self->semValue = new Expr\Cast\Array_($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 462 => static function ($self, $stackPos) { + $self->semValue = new Expr\Cast\Object_($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 463 => static function ($self, $stackPos) { + $self->semValue = new Expr\Cast\Bool_($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 464 => static function ($self, $stackPos) { + $self->semValue = new Expr\Cast\Unset_($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 465 => static function ($self, $stackPos) { + $attrs = $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos]); + $attrs['kind'] = strtolower($self->semStack[$stackPos-(2-1)]) === 'exit' ? Expr\Exit_::KIND_EXIT : Expr\Exit_::KIND_DIE; + $self->semValue = new Expr\Exit_($self->semStack[$stackPos-(2-2)], $attrs); + }, + 466 => static function ($self, $stackPos) { + $self->semValue = new Expr\ErrorSuppress($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 467 => null, + 468 => static function ($self, $stackPos) { + $self->semValue = new Expr\ShellExec($self->semStack[$stackPos-(3-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 469 => static function ($self, $stackPos) { + $self->semValue = new Expr\Print_($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 470 => static function ($self, $stackPos) { + $self->semValue = new Expr\Yield_(null, null, $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 471 => static function ($self, $stackPos) { + $self->semValue = new Expr\Yield_($self->semStack[$stackPos-(2-2)], null, $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 472 => static function ($self, $stackPos) { + $self->semValue = new Expr\Yield_($self->semStack[$stackPos-(4-4)], $self->semStack[$stackPos-(4-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 473 => static function ($self, $stackPos) { + $self->semValue = new Expr\YieldFrom($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 474 => static function ($self, $stackPos) { + $self->semValue = new Expr\Throw_($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 475 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrowFunction(['static' => false, 'byRef' => $self->semStack[$stackPos-(8-2)], 'params' => $self->semStack[$stackPos-(8-4)], 'returnType' => $self->semStack[$stackPos-(8-6)], 'expr' => $self->semStack[$stackPos-(8-8)], 'attrGroups' => []], $self->getAttributes($self->tokenStartStack[$stackPos-(8-1)], $self->tokenEndStack[$stackPos])); + }, + 476 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrowFunction(['static' => true, 'byRef' => $self->semStack[$stackPos-(9-3)], 'params' => $self->semStack[$stackPos-(9-5)], 'returnType' => $self->semStack[$stackPos-(9-7)], 'expr' => $self->semStack[$stackPos-(9-9)], 'attrGroups' => []], $self->getAttributes($self->tokenStartStack[$stackPos-(9-1)], $self->tokenEndStack[$stackPos])); + }, + 477 => static function ($self, $stackPos) { + $self->semValue = new Expr\Closure(['static' => false, 'byRef' => $self->semStack[$stackPos-(8-2)], 'params' => $self->semStack[$stackPos-(8-4)], 'uses' => $self->semStack[$stackPos-(8-6)], 'returnType' => $self->semStack[$stackPos-(8-7)], 'stmts' => $self->semStack[$stackPos-(8-8)], 'attrGroups' => []], $self->getAttributes($self->tokenStartStack[$stackPos-(8-1)], $self->tokenEndStack[$stackPos])); + }, + 478 => static function ($self, $stackPos) { + $self->semValue = new Expr\Closure(['static' => true, 'byRef' => $self->semStack[$stackPos-(9-3)], 'params' => $self->semStack[$stackPos-(9-5)], 'uses' => $self->semStack[$stackPos-(9-7)], 'returnType' => $self->semStack[$stackPos-(9-8)], 'stmts' => $self->semStack[$stackPos-(9-9)], 'attrGroups' => []], $self->getAttributes($self->tokenStartStack[$stackPos-(9-1)], $self->tokenEndStack[$stackPos])); + }, + 479 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrowFunction(['static' => false, 'byRef' => $self->semStack[$stackPos-(9-3)], 'params' => $self->semStack[$stackPos-(9-5)], 'returnType' => $self->semStack[$stackPos-(9-7)], 'expr' => $self->semStack[$stackPos-(9-9)], 'attrGroups' => $self->semStack[$stackPos-(9-1)]], $self->getAttributes($self->tokenStartStack[$stackPos-(9-1)], $self->tokenEndStack[$stackPos])); + }, + 480 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrowFunction(['static' => true, 'byRef' => $self->semStack[$stackPos-(10-4)], 'params' => $self->semStack[$stackPos-(10-6)], 'returnType' => $self->semStack[$stackPos-(10-8)], 'expr' => $self->semStack[$stackPos-(10-10)], 'attrGroups' => $self->semStack[$stackPos-(10-1)]], $self->getAttributes($self->tokenStartStack[$stackPos-(10-1)], $self->tokenEndStack[$stackPos])); + }, + 481 => static function ($self, $stackPos) { + $self->semValue = new Expr\Closure(['static' => false, 'byRef' => $self->semStack[$stackPos-(9-3)], 'params' => $self->semStack[$stackPos-(9-5)], 'uses' => $self->semStack[$stackPos-(9-7)], 'returnType' => $self->semStack[$stackPos-(9-8)], 'stmts' => $self->semStack[$stackPos-(9-9)], 'attrGroups' => $self->semStack[$stackPos-(9-1)]], $self->getAttributes($self->tokenStartStack[$stackPos-(9-1)], $self->tokenEndStack[$stackPos])); + }, + 482 => static function ($self, $stackPos) { + $self->semValue = new Expr\Closure(['static' => true, 'byRef' => $self->semStack[$stackPos-(10-4)], 'params' => $self->semStack[$stackPos-(10-6)], 'uses' => $self->semStack[$stackPos-(10-8)], 'returnType' => $self->semStack[$stackPos-(10-9)], 'stmts' => $self->semStack[$stackPos-(10-10)], 'attrGroups' => $self->semStack[$stackPos-(10-1)]], $self->getAttributes($self->tokenStartStack[$stackPos-(10-1)], $self->tokenEndStack[$stackPos])); + }, + 483 => static function ($self, $stackPos) { + $self->semValue = array(new Stmt\Class_(null, ['type' => $self->semStack[$stackPos-(8-2)], 'extends' => $self->semStack[$stackPos-(8-4)], 'implements' => $self->semStack[$stackPos-(8-5)], 'stmts' => $self->semStack[$stackPos-(8-7)], 'attrGroups' => $self->semStack[$stackPos-(8-1)]], $self->getAttributes($self->tokenStartStack[$stackPos-(8-1)], $self->tokenEndStack[$stackPos])), $self->semStack[$stackPos-(8-3)]); + $self->checkClass($self->semValue[0], -1); + }, + 484 => static function ($self, $stackPos) { + $self->semValue = new Expr\New_($self->semStack[$stackPos-(3-2)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 485 => static function ($self, $stackPos) { + list($class, $ctorArgs) = $self->semStack[$stackPos-(2-2)]; $self->semValue = new Expr\New_($class, $ctorArgs, $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 486 => static function ($self, $stackPos) { + $self->semValue = new Expr\New_($self->semStack[$stackPos-(2-2)], [], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 487 => null, + 488 => null, + 489 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 490 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(4-3)]; + }, + 491 => null, + 492 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 493 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 494 => static function ($self, $stackPos) { + $self->semValue = new Node\ClosureUse($self->semStack[$stackPos-(2-2)], $self->semStack[$stackPos-(2-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 495 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 496 => static function ($self, $stackPos) { + $self->semValue = new Expr\FuncCall($self->semStack[$stackPos-(2-1)], $self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 497 => static function ($self, $stackPos) { + $self->semValue = new Expr\FuncCall($self->semStack[$stackPos-(2-1)], $self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 498 => static function ($self, $stackPos) { + $self->semValue = new Expr\FuncCall($self->semStack[$stackPos-(2-1)], $self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 499 => static function ($self, $stackPos) { + $self->semValue = new Expr\StaticCall($self->semStack[$stackPos-(4-1)], $self->semStack[$stackPos-(4-3)], $self->semStack[$stackPos-(4-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 500 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 501 => null, + 502 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 503 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 504 => static function ($self, $stackPos) { + $self->semValue = new Name\FullyQualified(substr($self->semStack[$stackPos-(1-1)], 1), $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 505 => static function ($self, $stackPos) { + $self->semValue = new Name\Relative(substr($self->semStack[$stackPos-(1-1)], 10), $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 506 => null, + 507 => null, + 508 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 509 => static function ($self, $stackPos) { + $self->semValue = new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); $self->errorState = 2; + }, + 510 => null, + 511 => null, + 512 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 513 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 514 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 515 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); foreach ($self->semValue as $s) { if ($s instanceof Node\InterpolatedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', $self->phpVersion->supportsUnicodeEscapes()); } }; + }, + 516 => static function ($self, $stackPos) { + foreach ($self->semStack[$stackPos-(1-1)] as $s) { if ($s instanceof Node\InterpolatedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', $self->phpVersion->supportsUnicodeEscapes()); } }; $self->semValue = $self->semStack[$stackPos-(1-1)]; + }, + 517 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 518 => null, + 519 => static function ($self, $stackPos) { + $self->semValue = new Expr\ConstFetch($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 520 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Line($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 521 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\File($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 522 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Dir($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 523 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Class_($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 524 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Trait_($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 525 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Method($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 526 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Function_($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 527 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Namespace_($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 528 => static function ($self, $stackPos) { + $self->semValue = new Expr\ClassConstFetch($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 529 => static function ($self, $stackPos) { + $self->semValue = new Expr\ClassConstFetch($self->semStack[$stackPos-(5-1)], $self->semStack[$stackPos-(5-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos])); + }, + 530 => static function ($self, $stackPos) { + $self->semValue = new Expr\ClassConstFetch($self->semStack[$stackPos-(3-1)], new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos-(3-3)], $self->tokenEndStack[$stackPos-(3-3)])), $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); $self->errorState = 2; + }, + 531 => static function ($self, $stackPos) { + $attrs = $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos]); $attrs['kind'] = Expr\Array_::KIND_SHORT; + $self->semValue = new Expr\Array_($self->semStack[$stackPos-(3-2)], $attrs); + }, + 532 => static function ($self, $stackPos) { + $attrs = $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos]); $attrs['kind'] = Expr\Array_::KIND_LONG; + $self->semValue = new Expr\Array_($self->semStack[$stackPos-(4-3)], $attrs); + $self->createdArrays->attach($self->semValue); + }, + 533 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(1-1)]; $self->createdArrays->attach($self->semValue); + }, + 534 => static function ($self, $stackPos) { + $self->semValue = Scalar\String_::fromString($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos]), $self->phpVersion->supportsUnicodeEscapes()); + }, + 535 => static function ($self, $stackPos) { + $attrs = $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos]); $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED; + foreach ($self->semStack[$stackPos-(3-2)] as $s) { if ($s instanceof Node\InterpolatedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '"', $self->phpVersion->supportsUnicodeEscapes()); } }; $self->semValue = new Scalar\InterpolatedString($self->semStack[$stackPos-(3-2)], $attrs); + }, + 536 => static function ($self, $stackPos) { + $self->semValue = $self->parseLNumber($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos]), $self->phpVersion->allowsInvalidOctals()); + }, + 537 => static function ($self, $stackPos) { + $self->semValue = Scalar\Float_::fromString($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 538 => null, + 539 => null, + 540 => null, + 541 => static function ($self, $stackPos) { + $self->semValue = $self->parseDocString($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-2)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos]), $self->getAttributes($self->tokenStartStack[$stackPos-(3-3)], $self->tokenEndStack[$stackPos-(3-3)]), true); + }, + 542 => static function ($self, $stackPos) { + $self->semValue = $self->parseDocString($self->semStack[$stackPos-(2-1)], '', $self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos]), $self->getAttributes($self->tokenStartStack[$stackPos-(2-2)], $self->tokenEndStack[$stackPos-(2-2)]), true); + }, + 543 => static function ($self, $stackPos) { + $self->semValue = $self->parseDocString($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-2)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos]), $self->getAttributes($self->tokenStartStack[$stackPos-(3-3)], $self->tokenEndStack[$stackPos-(3-3)]), true); + }, + 544 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 545 => null, + 546 => null, + 547 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 548 => null, + 549 => null, + 550 => null, + 551 => null, + 552 => null, + 553 => null, + 554 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 555 => null, + 556 => null, + 557 => null, + 558 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrayDimFetch($self->semStack[$stackPos-(4-1)], $self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 559 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrayDimFetch($self->semStack[$stackPos-(4-1)], $self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 560 => null, + 561 => static function ($self, $stackPos) { + $self->semValue = new Expr\MethodCall($self->semStack[$stackPos-(4-1)], $self->semStack[$stackPos-(4-3)], $self->semStack[$stackPos-(4-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 562 => static function ($self, $stackPos) { + $self->semValue = new Expr\NullsafeMethodCall($self->semStack[$stackPos-(4-1)], $self->semStack[$stackPos-(4-3)], $self->semStack[$stackPos-(4-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 563 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 564 => null, + 565 => null, + 566 => null, + 567 => static function ($self, $stackPos) { + $self->semValue = new Expr\PropertyFetch($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 568 => static function ($self, $stackPos) { + $self->semValue = new Expr\NullsafePropertyFetch($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 569 => null, + 570 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable($self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 571 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 572 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable(new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])), $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); $self->errorState = 2; + }, + 573 => static function ($self, $stackPos) { + $var = $self->semStack[$stackPos-(1-1)]->name; $self->semValue = \is_string($var) ? new Node\VarLikeIdentifier($var, $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])) : $var; + }, + 574 => static function ($self, $stackPos) { + $self->semValue = new Expr\StaticPropertyFetch($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 575 => null, + 576 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrayDimFetch($self->semStack[$stackPos-(4-1)], $self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 577 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrayDimFetch($self->semStack[$stackPos-(4-1)], $self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 578 => static function ($self, $stackPos) { + $self->semValue = new Expr\PropertyFetch($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 579 => static function ($self, $stackPos) { + $self->semValue = new Expr\NullsafePropertyFetch($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 580 => static function ($self, $stackPos) { + $self->semValue = new Expr\StaticPropertyFetch($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 581 => static function ($self, $stackPos) { + $self->semValue = new Expr\StaticPropertyFetch($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 582 => null, + 583 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 584 => null, + 585 => null, + 586 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 587 => null, + 588 => static function ($self, $stackPos) { + $self->semValue = new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); $self->errorState = 2; + }, + 589 => static function ($self, $stackPos) { + $self->semValue = new Expr\List_($self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); $self->semValue->setAttribute('kind', Expr\List_::KIND_LIST); + $self->postprocessList($self->semValue); + }, + 590 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(1-1)]; $end = count($self->semValue)-1; if ($self->semValue[$end]->value instanceof Expr\Error) array_pop($self->semValue); + }, + 591 => null, + 592 => static function ($self, $stackPos) { + /* do nothing -- prevent default action of $$=$self->semStack[$1]. See $551. */ + }, + 593 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 594 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 595 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos-(1-1)], null, false, $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 596 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos-(2-2)], null, true, $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 597 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos-(1-1)], null, false, $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 598 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos-(3-3)], $self->semStack[$stackPos-(3-1)], false, $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 599 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos-(4-4)], $self->semStack[$stackPos-(4-1)], true, $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 600 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos-(3-3)], $self->semStack[$stackPos-(3-1)], false, $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 601 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos-(2-2)], null, false, $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos]), true); + }, + 602 => static function ($self, $stackPos) { + /* Create an Error node now to remember the position. We'll later either report an error, + or convert this into a null element, depending on whether this is a creation or destructuring context. */ + $attrs = $self->createEmptyElemAttributes($self->tokenPos); + $self->semValue = new Node\ArrayItem(new Expr\Error($attrs), null, false, $attrs); + }, + 603 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(2-1)][] = $self->semStack[$stackPos-(2-2)]; $self->semValue = $self->semStack[$stackPos-(2-1)]; + }, + 604 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(2-1)][] = $self->semStack[$stackPos-(2-2)]; $self->semValue = $self->semStack[$stackPos-(2-1)]; + }, + 605 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 606 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(2-1)], $self->semStack[$stackPos-(2-2)]); + }, + 607 => static function ($self, $stackPos) { + $attrs = $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos]); $attrs['rawValue'] = $self->semStack[$stackPos-(1-1)]; $self->semValue = new Node\InterpolatedStringPart($self->semStack[$stackPos-(1-1)], $attrs); + }, + 608 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 609 => null, + 610 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrayDimFetch($self->semStack[$stackPos-(4-1)], $self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 611 => static function ($self, $stackPos) { + $self->semValue = new Expr\PropertyFetch($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 612 => static function ($self, $stackPos) { + $self->semValue = new Expr\NullsafePropertyFetch($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 613 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable($self->semStack[$stackPos-(3-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 614 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable($self->semStack[$stackPos-(3-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 615 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrayDimFetch($self->semStack[$stackPos-(6-2)], $self->semStack[$stackPos-(6-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(6-1)], $self->tokenEndStack[$stackPos])); + }, + 616 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 617 => static function ($self, $stackPos) { + $self->semValue = new Scalar\String_($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 618 => static function ($self, $stackPos) { + $self->semValue = $self->parseNumString($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 619 => static function ($self, $stackPos) { + $self->semValue = $self->parseNumString('-' . $self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 620 => null, + ]; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Parser/Php8.php b/vendor/nikic/php-parser/lib/PhpParser/Parser/Php8.php new file mode 100644 index 00000000..1317c543 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Parser/Php8.php @@ -0,0 +1,2737 @@ +<?php declare(strict_types=1); + +namespace PhpParser\Parser; + +use PhpParser\Error; +use PhpParser\Modifiers; +use PhpParser\Node; +use PhpParser\Node\Expr; +use PhpParser\Node\Name; +use PhpParser\Node\Scalar; +use PhpParser\Node\Stmt; + +/* This is an automatically GENERATED file, which should not be manually edited. + * Instead edit one of the following: + * * the grammar file grammar/php.y + * * the skeleton file grammar/parser.template + * * the preprocessing script grammar/rebuildParsers.php + */ +class Php8 extends \PhpParser\ParserAbstract +{ + public const YYERRTOK = 256; + public const T_THROW = 257; + public const T_INCLUDE = 258; + public const T_INCLUDE_ONCE = 259; + public const T_EVAL = 260; + public const T_REQUIRE = 261; + public const T_REQUIRE_ONCE = 262; + public const T_LOGICAL_OR = 263; + public const T_LOGICAL_XOR = 264; + public const T_LOGICAL_AND = 265; + public const T_PRINT = 266; + public const T_YIELD = 267; + public const T_DOUBLE_ARROW = 268; + public const T_YIELD_FROM = 269; + public const T_PLUS_EQUAL = 270; + public const T_MINUS_EQUAL = 271; + public const T_MUL_EQUAL = 272; + public const T_DIV_EQUAL = 273; + public const T_CONCAT_EQUAL = 274; + public const T_MOD_EQUAL = 275; + public const T_AND_EQUAL = 276; + public const T_OR_EQUAL = 277; + public const T_XOR_EQUAL = 278; + public const T_SL_EQUAL = 279; + public const T_SR_EQUAL = 280; + public const T_POW_EQUAL = 281; + public const T_COALESCE_EQUAL = 282; + public const T_COALESCE = 283; + public const T_BOOLEAN_OR = 284; + public const T_BOOLEAN_AND = 285; + public const T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG = 286; + public const T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG = 287; + public const T_IS_EQUAL = 288; + public const T_IS_NOT_EQUAL = 289; + public const T_IS_IDENTICAL = 290; + public const T_IS_NOT_IDENTICAL = 291; + public const T_SPACESHIP = 292; + public const T_IS_SMALLER_OR_EQUAL = 293; + public const T_IS_GREATER_OR_EQUAL = 294; + public const T_SL = 295; + public const T_SR = 296; + public const T_INSTANCEOF = 297; + public const T_INC = 298; + public const T_DEC = 299; + public const T_INT_CAST = 300; + public const T_DOUBLE_CAST = 301; + public const T_STRING_CAST = 302; + public const T_ARRAY_CAST = 303; + public const T_OBJECT_CAST = 304; + public const T_BOOL_CAST = 305; + public const T_UNSET_CAST = 306; + public const T_POW = 307; + public const T_NEW = 308; + public const T_CLONE = 309; + public const T_EXIT = 310; + public const T_IF = 311; + public const T_ELSEIF = 312; + public const T_ELSE = 313; + public const T_ENDIF = 314; + public const T_LNUMBER = 315; + public const T_DNUMBER = 316; + public const T_STRING = 317; + public const T_STRING_VARNAME = 318; + public const T_VARIABLE = 319; + public const T_NUM_STRING = 320; + public const T_INLINE_HTML = 321; + public const T_ENCAPSED_AND_WHITESPACE = 322; + public const T_CONSTANT_ENCAPSED_STRING = 323; + public const T_ECHO = 324; + public const T_DO = 325; + public const T_WHILE = 326; + public const T_ENDWHILE = 327; + public const T_FOR = 328; + public const T_ENDFOR = 329; + public const T_FOREACH = 330; + public const T_ENDFOREACH = 331; + public const T_DECLARE = 332; + public const T_ENDDECLARE = 333; + public const T_AS = 334; + public const T_SWITCH = 335; + public const T_MATCH = 336; + public const T_ENDSWITCH = 337; + public const T_CASE = 338; + public const T_DEFAULT = 339; + public const T_BREAK = 340; + public const T_CONTINUE = 341; + public const T_GOTO = 342; + public const T_FUNCTION = 343; + public const T_FN = 344; + public const T_CONST = 345; + public const T_RETURN = 346; + public const T_TRY = 347; + public const T_CATCH = 348; + public const T_FINALLY = 349; + public const T_USE = 350; + public const T_INSTEADOF = 351; + public const T_GLOBAL = 352; + public const T_STATIC = 353; + public const T_ABSTRACT = 354; + public const T_FINAL = 355; + public const T_PRIVATE = 356; + public const T_PROTECTED = 357; + public const T_PUBLIC = 358; + public const T_READONLY = 359; + public const T_VAR = 360; + public const T_UNSET = 361; + public const T_ISSET = 362; + public const T_EMPTY = 363; + public const T_HALT_COMPILER = 364; + public const T_CLASS = 365; + public const T_TRAIT = 366; + public const T_INTERFACE = 367; + public const T_ENUM = 368; + public const T_EXTENDS = 369; + public const T_IMPLEMENTS = 370; + public const T_OBJECT_OPERATOR = 371; + public const T_NULLSAFE_OBJECT_OPERATOR = 372; + public const T_LIST = 373; + public const T_ARRAY = 374; + public const T_CALLABLE = 375; + public const T_CLASS_C = 376; + public const T_TRAIT_C = 377; + public const T_METHOD_C = 378; + public const T_FUNC_C = 379; + public const T_LINE = 380; + public const T_FILE = 381; + public const T_START_HEREDOC = 382; + public const T_END_HEREDOC = 383; + public const T_DOLLAR_OPEN_CURLY_BRACES = 384; + public const T_CURLY_OPEN = 385; + public const T_PAAMAYIM_NEKUDOTAYIM = 386; + public const T_NAMESPACE = 387; + public const T_NS_C = 388; + public const T_DIR = 389; + public const T_NS_SEPARATOR = 390; + public const T_ELLIPSIS = 391; + public const T_NAME_FULLY_QUALIFIED = 392; + public const T_NAME_QUALIFIED = 393; + public const T_NAME_RELATIVE = 394; + public const T_ATTRIBUTE = 395; + + protected int $tokenToSymbolMapSize = 396; + protected int $actionTableSize = 1272; + protected int $gotoTableSize = 689; + + protected int $invalidSymbol = 168; + protected int $errorSymbol = 1; + protected int $defaultAction = -32766; + protected int $unexpectedTokenRule = 32767; + + protected int $YY2TBLSTATE = 437; + protected int $numNonLeafStates = 743; + + protected array $symbolToName = array( + "EOF", + "error", + "T_THROW", + "T_INCLUDE", + "T_INCLUDE_ONCE", + "T_EVAL", + "T_REQUIRE", + "T_REQUIRE_ONCE", + "','", + "T_LOGICAL_OR", + "T_LOGICAL_XOR", + "T_LOGICAL_AND", + "T_PRINT", + "T_YIELD", + "T_DOUBLE_ARROW", + "T_YIELD_FROM", + "'='", + "T_PLUS_EQUAL", + "T_MINUS_EQUAL", + "T_MUL_EQUAL", + "T_DIV_EQUAL", + "T_CONCAT_EQUAL", + "T_MOD_EQUAL", + "T_AND_EQUAL", + "T_OR_EQUAL", + "T_XOR_EQUAL", + "T_SL_EQUAL", + "T_SR_EQUAL", + "T_POW_EQUAL", + "T_COALESCE_EQUAL", + "'?'", + "':'", + "T_COALESCE", + "T_BOOLEAN_OR", + "T_BOOLEAN_AND", + "'|'", + "'^'", + "T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG", + "T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG", + "T_IS_EQUAL", + "T_IS_NOT_EQUAL", + "T_IS_IDENTICAL", + "T_IS_NOT_IDENTICAL", + "T_SPACESHIP", + "'<'", + "T_IS_SMALLER_OR_EQUAL", + "'>'", + "T_IS_GREATER_OR_EQUAL", + "'.'", + "T_SL", + "T_SR", + "'+'", + "'-'", + "'*'", + "'/'", + "'%'", + "'!'", + "T_INSTANCEOF", + "'~'", + "T_INC", + "T_DEC", + "T_INT_CAST", + "T_DOUBLE_CAST", + "T_STRING_CAST", + "T_ARRAY_CAST", + "T_OBJECT_CAST", + "T_BOOL_CAST", + "T_UNSET_CAST", + "'@'", + "T_POW", + "'['", + "T_NEW", + "T_CLONE", + "T_EXIT", + "T_IF", + "T_ELSEIF", + "T_ELSE", + "T_ENDIF", + "T_LNUMBER", + "T_DNUMBER", + "T_STRING", + "T_STRING_VARNAME", + "T_VARIABLE", + "T_NUM_STRING", + "T_INLINE_HTML", + "T_ENCAPSED_AND_WHITESPACE", + "T_CONSTANT_ENCAPSED_STRING", + "T_ECHO", + "T_DO", + "T_WHILE", + "T_ENDWHILE", + "T_FOR", + "T_ENDFOR", + "T_FOREACH", + "T_ENDFOREACH", + "T_DECLARE", + "T_ENDDECLARE", + "T_AS", + "T_SWITCH", + "T_MATCH", + "T_ENDSWITCH", + "T_CASE", + "T_DEFAULT", + "T_BREAK", + "T_CONTINUE", + "T_GOTO", + "T_FUNCTION", + "T_FN", + "T_CONST", + "T_RETURN", + "T_TRY", + "T_CATCH", + "T_FINALLY", + "T_USE", + "T_INSTEADOF", + "T_GLOBAL", + "T_STATIC", + "T_ABSTRACT", + "T_FINAL", + "T_PRIVATE", + "T_PROTECTED", + "T_PUBLIC", + "T_READONLY", + "T_VAR", + "T_UNSET", + "T_ISSET", + "T_EMPTY", + "T_HALT_COMPILER", + "T_CLASS", + "T_TRAIT", + "T_INTERFACE", + "T_ENUM", + "T_EXTENDS", + "T_IMPLEMENTS", + "T_OBJECT_OPERATOR", + "T_NULLSAFE_OBJECT_OPERATOR", + "T_LIST", + "T_ARRAY", + "T_CALLABLE", + "T_CLASS_C", + "T_TRAIT_C", + "T_METHOD_C", + "T_FUNC_C", + "T_LINE", + "T_FILE", + "T_START_HEREDOC", + "T_END_HEREDOC", + "T_DOLLAR_OPEN_CURLY_BRACES", + "T_CURLY_OPEN", + "T_PAAMAYIM_NEKUDOTAYIM", + "T_NAMESPACE", + "T_NS_C", + "T_DIR", + "T_NS_SEPARATOR", + "T_ELLIPSIS", + "T_NAME_FULLY_QUALIFIED", + "T_NAME_QUALIFIED", + "T_NAME_RELATIVE", + "T_ATTRIBUTE", + "';'", + "']'", + "'('", + "')'", + "'{'", + "'}'", + "'`'", + "'\"'", + "'$'" + ); + + protected array $tokenToSymbol = array( + 0, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 56, 166, 168, 167, 55, 168, 168, + 161, 162, 53, 51, 8, 52, 48, 54, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 31, 159, + 44, 16, 46, 30, 68, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 70, 168, 160, 36, 168, 165, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 163, 35, 164, 58, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 1, 2, 3, 4, + 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 32, 33, 34, 37, 38, 39, 40, + 41, 42, 43, 45, 47, 49, 50, 57, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 69, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, + 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + 153, 154, 155, 156, 157, 158 + ); + + protected array $action = array( + 133, 134, 135, 586, 136, 137, 0, 755, 756, 757, + 138, 38, 329,-32766,-32766,-32766,-32766,-32766,-32766, 841, + 830,-32767,-32767,-32767,-32767, 102, 103, 104, 1116, 1117, + 1118, 1115, 1114, 1113, 1119, 749, 748,-32766, 1031,-32766, + -32766,-32766,-32766,-32766,-32766,-32766,-32767,-32767,-32767,-32767, + -32767, 1252,-32766,-32766, 1331, 758, 1116, 1117, 1118, 1115, + 1114, 1113, 1119, 461, 462, 463, 2, 994, 1315, 265, + 139, 406, 762, 763, 764, 765, 470, 471, 431, 839, + 610, -16, 1350, 23, 293, 819, 766, 767, 768, 769, + 770, 771, 772, 773, 774, 775, 795, 587, 796, 797, + 798, 799, 787, 788, 347, 348, 790, 791, 776, 777, + 778, 780, 781, 782, 358, 822, 823, 824, 825, 826, + 588, 783, 784, 589, 590, 945, 807, 805, 806, 818, + 802, 803, 839, 830, 591, 592, 801, 593, 594, 595, + 596, 597, 598, -328, 36, 250, 35, -194, 804, 599, + 600, -193, 140, -85, 133, 134, 135, 586, 136, 137, + 1064, 755, 756, 757, 138, 38, 129, -110, -110, -590, + -32766, -590, -110,-32766,-32766,-32766, 241, 840, -110, 145, + 963, 964,-32766,-32766,-32766, 965, -599,-32766, 485, 749, + 748, 959, 1040, -599,-32766, 995,-32766,-32766,-32766,-32766, + -32766,-32766,-32766,-32766,-32766,-32766,-32766,-32766, 301, 758, + 835, 75,-32766,-32766,-32766, 292, 142, 328, 242, -85, + 328, 384, 383, 265, 139, 406, 762, 763, 764, 765, + 82, 425, 431,-32766, 328,-32766,-32766,-32766,-32766, 819, + 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, + 795, 587, 796, 797, 798, 799, 787, 788, 347, 348, + 790, 791, 776, 777, 778, 780, 781, 782, 358, 822, + 823, 824, 825, 826, 588, 783, 784, 589, 590, 253, + 807, 805, 806, 818, 802, 803, 836, 729, 591, 592, + 801, 593, 594, 595, 596, 597, 598, -328, 83, 84, + 85, -194, 804, 599, 600, -193, 149, 779, 750, 751, + 752, 753, 754, 151, 755, 756, 757, 792, 793, 37, + 486, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, -599, 275, -599,-32766,-32766, + -32766,-32766,-32766,-32766, 312, 1093, 127, 314, 110, 741, + 1335, 21, 758,-32766,-32766,-32766, -272, 1334,-32766,-32766, + 1092,-32766,-32766,-32766,-32766,-32766, 759, 760, 761, 762, + 763, 764, 765, 1108,-32766, 828,-32766,-32766, -550, 560, + 1040, 1273, 819, 766, 767, 768, 769, 770, 771, 772, + 773, 774, 775, 795, 817, 796, 797, 798, 799, 787, + 788, 789, 816, 790, 791, 776, 777, 778, 780, 781, + 782, 821, 822, 823, 824, 825, 826, 827, 783, 784, + 785, 786, 1037, 807, 805, 806, 818, 802, 803, 749, + 748, 794, 800, 801, 808, 809, 811, 810, 812, 813, + 1285, 325, -550, -550, 1040, 804, 815, 814, 50, 51, + 52, 516, 53, 54, 866, 341, 867, -550, 55, 56, + -110, 57, 839, 924, -367, -110, -367, -110, 293, -556, + 152, -550, 308, 103, 104, -110, -110, -110, -110, -110, + -110, -110, -110, 105, 106, 107, 108, 109, 947, 275, + 342, 924, 1252, 719,-32766,-32766,-32766, 58, 59, -549, + 372, 110, 60, 838, 61, 247, 248, 62, 63, 64, + 65, 66, 67, 68, 69,-32766, 28, 267, 70, 446, + 517, 720, 376, -342, 1279, 1280, 518, 359, 839, -548, + 391, -546, 1277, 42, 25, 519, 947, 520, 616, 521, + 924, 522, 442, 141, 523, 524, 914, 328, 443, 44, + 45, 447, 379, 378,-32766, 46, 525, 1027, 1026, 1025, + 1028, 370, 340, -549, -549, 444, 1360, 431, 1238, 1361, + 527, 528, 529, 839, 914, 364, 1040, 445, -549,-32766, + -32766,-32766, 531, 532, 845, 1266, 1267, 1268, 1269, 1263, + 1264, 300, -549, -548, -548, -546, -546, 1270, 1265, 292, + -32766, 1247, 1246, 1248, 301, 749, 748, 71, -548, -78, + -546, 323, 324, 328, -153, -153, -153, 393,-32766, 7, + -555, 926, -548, 914, -546, 714, 660, 26,-32766, -153, + 832, -153, 866, -153, 867, -153, 382, 383, 28, 268, + 1040, 154, 1247, 1246, 1248, 377, 425, 155, -596, 926, + 839, 1094, 75, 714, 1277, -596, 963, 964, 328, -547, + 156, 526, 158, 292, 1245, 33, 900, 959, -110, -110, + -110, 32, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 679, 680, -58, 301, -57, + 1238, 124, 924, 749, 748, 1252, 150, 409, 926, 125, + 1243, 924, 714, -153, 531, 532, 834, 1266, 1267, 1268, + 1269, 1263, 1264, 716, 1154, 1156, -87, -4, 924, 1270, + 1265, 1039, 721, -547, -547, -546, 130, 749, 748, 73, + -32766, 724, 131, -552, 324, 328, 1245, 144, -547, 1247, + 1246, 1248, 159,-32766,-32766,-32766, 1037,-32766, 160,-32766, + -554,-32766, -547, 161,-32766, 380, 381, 924, 162,-32766, + -32766,-32766, 163, 49,-32766,-32766,-32766, -84, 1040, -78, + 1245,-32766, 422, 48, 924, 914, 839,-32766,-32766,-32766, + -32766,-32766, -73,-32766, 914,-32766, -72, 731,-32766, -546, + -546, 283, -71,-32766,-32766,-32766, -70, -552, -552,-32766, + -32766, 914, 385, 386, -546,-32766, 422, -596, -69, -596, + 74, -110, -110, -68,-32766, -50, -110, -67, -546, 651, + 652, -66, -110, 377, -65, 438, -552, 304, 305, -46, + 299,-32766, -18, 148, 963, 964, 274, 302, 303, 526, + 914, 284, 375, 730, 530, 959, -110, -110, -110, 132, + 980, 733, 301, 923, 714, 75, 128, 914,-32766, 926, + 147, 328, -302, 714, 1245, -298, 126, 10, 1063, 281, + 282,-32766,-32766,-32766, 285,-32766, 926,-32766, 286,-32766, + 714, -4,-32766, 334, 288, 275, 289,-32766,-32766,-32766, + 294, 295,-32766,-32766,-32766, 924, 941, 287, 1245,-32766, + 422, 110, 689, 146, 830,-32766,-32766,-32766,-32766,-32766, + 565,-32766, 666,-32766, 1362, 926,-32766, 705, 839, 714, + 1123,-32766,-32766,-32766,-32766,-32766, 667,-32766,-32766, 309, + 1245, 661, 926,-32766, 422, 924, 714,-32766,-32766,-32766, + 682,-32766,-32766,-32766, 707,-32766, 306, 960,-32766, 313, + -32766, 683, 491,-32766,-32766,-32766,-32766, 20, 467,-32766, + -32766, 496, 1245, 578, 571,-32766, 422, 301, 649,-32766, + -32766,-32766, -511,-32766,-32766,-32766, 0,-32766, 914, 0, + -32766, 0, 0, 1037, 0,-32766,-32766,-32766, 1284, 307, + 1286,-32766,-32766, 0, -250, -250, -250,-32766, 422, 943, + 377, 0, 0, 28, 267, 1040,-32766, 0, -501, 0, + 614, 963, 964, 0, 8, 839, 526, 24, 914, 1277, + 374, 900, 959, -110, -110, -110, 1274, 838, 283, 40, + -584, 0, 41, 738, -249, -249, -249, 739, 28, 268, + 377, 850, 287, 858, 905, 1004, 981, 988, 978, 989, + 839, 963, 964, 926, 1277, 1238, 526, 714, -250, 903, + 976, 900, 959, -110, -110, -110, 1097, 1100, 1101, 1098, + 532, 1099, 1266, 1267, 1268, 1269, 1263, 1264, 1105, -583, + 1301, 1319, 1353, 654, 1270, 1265, -582, -556, -555, -554, + 1238, -553, 694, 926, 73, 34, -495, 714, -249, 324, + 328, 1, 29, 30, 39, 532, 43, 1266, 1267, 1268, + 1269, 1263, 1264, 47, 72, 76, 77, 78, 79, 1270, + 1265, 80, 81, 143,-32766, 153, 157, 245, 695, 73, + 1245, 330, 359, 360, 324, 328, 361,-32766,-32766,-32766, + 362,-32766, 363,-32766, 364,-32766, 365, 366,-32766, 696, + 697, 367, 368,-32766,-32766,-32766, 369, 371, 439,-32766, + -32766, 559, 322, -275, -273,-32766, 422, 1247, 1246, 1248, + -272, 13, 14, 283,-32766, 15, 16, 18, 408, 487, + 488, 495, 498, 499, 500, 501, 505, 506, 507, 514, + 576, 700, 1256, 1194, 1275, 1066, 1065, 1046, 1233, 1042, + -277, -102, 12, 17, 27, 298, 407, 607, 611, 640, + 706, 1198, 0, 1251, 1195, 1332, 0, 373, 715, 718, + 722, 723, 725, 726, 727, 728, 732, 717, 0, 735, + 901, 1357, 1359, 861, 860, 869, 953, 996, 868, 1358, + 952, 950, 951, 954, 1226, 934, 944, 932, 986, 987, + 638, 1356, 1313, 1302, 1320, 1329, 0, 1211, 0, 1278, + 0, 328 + ); + + protected array $actionCheck = array( + 2, 3, 4, 5, 6, 7, 0, 9, 10, 11, + 12, 13, 70, 9, 10, 11, 9, 10, 11, 1, + 80, 44, 45, 46, 47, 48, 49, 50, 116, 117, + 118, 119, 120, 121, 122, 37, 38, 30, 1, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 1, 9, 10, 1, 57, 116, 117, 118, 119, + 120, 121, 122, 129, 130, 131, 8, 31, 1, 71, + 72, 73, 74, 75, 76, 77, 134, 135, 80, 82, + 1, 31, 85, 8, 30, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 1, 128, 129, 130, 131, + 132, 133, 82, 80, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 8, 147, 148, 8, 8, 150, 151, + 152, 8, 154, 31, 2, 3, 4, 5, 6, 7, + 162, 9, 10, 11, 12, 13, 8, 117, 118, 160, + 116, 162, 122, 9, 10, 11, 97, 159, 128, 8, + 117, 118, 9, 10, 11, 122, 1, 137, 31, 37, + 38, 128, 138, 8, 30, 159, 32, 33, 34, 35, + 36, 37, 38, 30, 9, 32, 33, 34, 158, 57, + 80, 161, 9, 10, 11, 161, 163, 167, 14, 97, + 167, 106, 107, 71, 72, 73, 74, 75, 76, 77, + 163, 116, 80, 30, 167, 32, 33, 34, 35, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 8, + 128, 129, 130, 131, 132, 133, 156, 163, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 162, 9, 10, + 11, 162, 150, 151, 152, 162, 154, 2, 3, 4, + 5, 6, 7, 14, 9, 10, 11, 12, 13, 30, + 163, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 160, 57, 162, 9, 10, + 11, 9, 10, 11, 8, 159, 14, 8, 69, 163, + 1, 101, 57, 9, 10, 11, 162, 8, 116, 30, + 1, 32, 33, 34, 35, 36, 71, 72, 73, 74, + 75, 76, 77, 123, 30, 80, 32, 33, 70, 85, + 138, 1, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 116, 128, 129, 130, 131, 132, 133, 37, + 38, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 146, 8, 134, 135, 138, 150, 151, 152, 2, 3, + 4, 5, 6, 7, 106, 8, 108, 149, 12, 13, + 101, 15, 82, 1, 106, 106, 108, 108, 30, 161, + 14, 163, 113, 49, 50, 116, 117, 118, 119, 120, + 121, 122, 123, 51, 52, 53, 54, 55, 122, 57, + 8, 1, 1, 31, 9, 10, 11, 51, 52, 70, + 8, 69, 56, 155, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 30, 70, 71, 72, 73, + 74, 31, 8, 164, 78, 79, 80, 161, 82, 70, + 8, 70, 86, 87, 88, 89, 122, 91, 52, 93, + 1, 95, 8, 163, 98, 99, 84, 167, 8, 103, + 104, 105, 106, 107, 116, 109, 110, 119, 120, 121, + 122, 115, 116, 134, 135, 8, 80, 80, 122, 83, + 124, 125, 126, 82, 84, 161, 138, 8, 149, 116, + 51, 52, 136, 137, 8, 139, 140, 141, 142, 143, + 144, 145, 163, 134, 135, 134, 135, 151, 152, 161, + 137, 155, 156, 157, 158, 37, 38, 161, 149, 16, + 149, 165, 166, 167, 75, 76, 77, 106, 116, 108, + 161, 159, 163, 84, 163, 163, 75, 76, 137, 90, + 80, 92, 106, 94, 108, 96, 106, 107, 70, 71, + 138, 14, 155, 156, 157, 106, 116, 14, 1, 159, + 82, 164, 161, 163, 86, 8, 117, 118, 167, 70, + 14, 122, 14, 161, 80, 14, 127, 128, 129, 130, + 131, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 75, 76, 16, 158, 16, + 122, 16, 1, 37, 38, 1, 101, 102, 159, 16, + 116, 1, 163, 164, 136, 137, 156, 139, 140, 141, + 142, 143, 144, 163, 59, 60, 31, 0, 1, 151, + 152, 137, 31, 134, 135, 70, 16, 37, 38, 161, + 74, 31, 16, 70, 166, 167, 80, 16, 149, 155, + 156, 157, 16, 87, 88, 89, 116, 91, 16, 93, + 161, 95, 163, 16, 98, 106, 107, 1, 16, 103, + 104, 105, 16, 70, 74, 109, 110, 31, 138, 31, + 80, 115, 116, 70, 1, 84, 82, 87, 88, 89, + 124, 91, 31, 93, 84, 95, 31, 31, 98, 134, + 135, 161, 31, 103, 104, 105, 31, 134, 135, 109, + 110, 84, 106, 107, 149, 115, 116, 160, 31, 162, + 154, 117, 118, 31, 124, 31, 122, 31, 163, 111, + 112, 31, 128, 106, 31, 108, 163, 134, 135, 31, + 113, 137, 31, 31, 117, 118, 31, 134, 135, 122, + 84, 31, 149, 31, 127, 128, 129, 130, 131, 31, + 159, 31, 158, 31, 163, 161, 163, 84, 74, 159, + 31, 167, 35, 163, 80, 35, 163, 150, 1, 35, + 35, 87, 88, 89, 35, 91, 159, 93, 35, 95, + 163, 164, 98, 35, 37, 57, 37, 103, 104, 105, + 37, 37, 74, 109, 110, 1, 38, 30, 80, 115, + 116, 69, 77, 70, 80, 87, 88, 89, 124, 91, + 89, 93, 96, 95, 83, 159, 98, 80, 82, 163, + 82, 103, 104, 105, 74, 85, 100, 109, 110, 114, + 80, 90, 159, 115, 116, 1, 163, 87, 88, 89, + 94, 91, 124, 93, 92, 95, 132, 128, 98, 132, + 137, 100, 102, 103, 104, 105, 74, 97, 97, 109, + 110, 97, 80, 81, 153, 115, 116, 158, 113, 87, + 88, 89, 149, 91, 124, 93, -1, 95, 84, -1, + 98, -1, -1, 116, -1, 103, 104, 105, 146, 133, + 146, 109, 110, -1, 100, 101, 102, 115, 116, 154, + 106, -1, -1, 70, 71, 138, 124, -1, 149, -1, + 153, 117, 118, -1, 149, 82, 122, 149, 84, 86, + 149, 127, 128, 129, 130, 131, 160, 155, 161, 159, + 161, -1, 159, 159, 100, 101, 102, 159, 70, 71, + 106, 160, 30, 159, 159, 159, 159, 159, 159, 159, + 82, 117, 118, 159, 86, 122, 122, 163, 164, 159, + 159, 127, 128, 129, 130, 131, 159, 159, 159, 159, + 137, 159, 139, 140, 141, 142, 143, 144, 159, 161, + 160, 160, 160, 160, 151, 152, 161, 161, 161, 161, + 122, 161, 80, 159, 161, 163, 161, 163, 164, 166, + 167, 161, 161, 161, 161, 137, 161, 139, 140, 141, + 142, 143, 144, 161, 161, 161, 161, 161, 161, 151, + 152, 161, 161, 161, 74, 161, 161, 161, 116, 161, + 80, 161, 161, 161, 166, 167, 161, 87, 88, 89, + 161, 91, 161, 93, 161, 95, 161, 161, 98, 137, + 138, 161, 161, 103, 104, 105, 161, 161, 161, 109, + 110, 161, 163, 162, 162, 115, 116, 155, 156, 157, + 162, 162, 162, 161, 124, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, -1, 162, 162, 162, -1, 163, 163, 163, + 163, 163, 163, 163, 163, 163, 163, 163, -1, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 164, 164, 164, 164, -1, 165, -1, 166, + -1, 167 + ); + + protected array $actionBase = array( + 0, -2, 152, 549, 727, 904, 944, 1022, 390, 497, + 560, 922, 500, 710, 710, 766, 710, 472, 701, 847, + -60, 305, 305, 847, 305, 783, 783, 783, 666, 666, + 666, 666, 700, 700, 860, 860, 892, 828, 794, 1060, + 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, + 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, + 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, + 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, + 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, + 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, + 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, + 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, + 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, + 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, + 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, + 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, 1060, + 1060, 1060, 1060, 1060, 18, 36, 79, 661, 1053, 1059, + 1055, 1061, 1051, 1050, 1054, 1056, 1062, 1097, 1098, 839, + 1099, 1100, 1096, 1101, 1057, 933, 1052, 1058, 289, 289, + 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, + 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, + 289, 289, 289, 289, 289, 195, 342, 43, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 495, 495, + 495, 578, 578, 354, 173, 978, 943, 978, 978, 978, + 978, 978, 978, 978, 978, 203, 665, 339, 164, 164, + 7, 7, 7, 7, 7, 50, 369, 704, 704, -23, + -23, -23, -23, 448, 877, 501, 260, 368, 434, 54, + 540, 640, 640, 316, 316, 512, 512, 316, 316, 316, + 442, 442, 252, 252, 252, 252, 318, 469, 599, 358, + 304, 823, 53, 53, 53, 53, 823, 823, 823, 823, + 854, 1103, 823, 823, 823, 439, 471, 471, 703, 539, + 539, 471, 536, -3, -3, 536, 63, -3, 67, 496, + 473, 829, 115, 9, 473, 673, 713, 657, 185, 882, + 659, 882, 1049, 376, 850, 850, 424, 808, 761, 929, + 1074, 1063, 836, 1094, 861, 1095, -66, -58, 748, 1048, + 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + 1104, 402, 1049, 130, 1104, 1104, 1104, 402, 402, 402, + 402, 402, 402, 402, 402, 402, 402, 718, 130, 561, + 620, 130, 858, 402, 18, 869, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 811, 157, 18, 36, + 124, 124, 196, 37, 124, 124, 124, 124, 18, 18, + 18, 18, 659, 838, 821, 706, 867, 143, 838, 838, + 838, 122, 135, 204, 139, 837, 840, 521, 834, 834, + 848, 950, 834, 846, 834, 848, 962, 834, 834, 950, + 950, 819, 950, 158, 544, 457, 524, 550, 950, 346, + 834, 834, 834, 834, 827, 950, 567, 834, 271, 171, + 834, 834, 827, 824, 820, 58, 866, 950, 950, 950, + 827, 502, 866, 866, 866, 884, 888, 865, 815, 443, + 349, 586, 138, 868, 815, 815, 834, 532, 865, 815, + 865, 815, 855, 815, 815, 815, 865, 815, 846, 492, + 815, 736, 579, 75, 815, 6, 963, 964, 695, 965, + 953, 966, 1007, 967, 970, 1065, 945, 976, 955, 971, + 1010, 952, 951, 832, 685, 693, 875, 833, 940, 842, + 842, 842, 936, 937, 842, 842, 842, 842, 842, 842, + 842, 842, 685, 876, 881, 831, 982, 720, 726, 1038, + 852, 1076, 1102, 981, 1040, 972, 880, 731, 1025, 985, + 1075, 1009, 989, 991, 1026, 1041, 894, 1042, 1077, 843, + 1078, 1079, 891, 995, 1066, 842, 963, 970, 746, 955, + 971, 952, 951, 803, 800, 792, 796, 787, 775, 765, + 771, 812, 1043, 935, 879, 930, 993, 938, 685, 931, + 1019, 942, 1027, 1028, 1064, 871, 841, 932, 1080, 996, + 1000, 1001, 1067, 1044, 1068, 883, 1020, 1011, 1029, 874, + 1081, 1030, 1031, 1032, 1033, 1069, 1082, 1070, 928, 1071, + 895, 851, 1012, 826, 1083, 299, 849, 853, 864, 1006, + 466, 980, 1072, 1084, 1085, 1034, 1035, 1036, 1086, 1087, + 974, 896, 1023, 856, 1024, 1018, 897, 898, 637, 863, + 1045, 844, 845, 859, 643, 656, 1088, 1089, 1090, 975, + 822, 835, 899, 900, 1046, 857, 1047, 1091, 658, 910, + 742, 1092, 1039, 747, 752, 603, 683, 681, 756, 862, + 1073, 878, 825, 870, 1005, 752, 830, 911, 1093, 917, + 918, 919, 1037, 920, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 456, 456, 456, 456, 456, 456, + 305, 305, 305, 305, 305, 456, 456, 456, 456, 456, + 456, 456, 305, 305, 0, 0, 305, 0, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, + 456, 456, 456, 456, 456, 456, 456, 289, 289, 289, + 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, + 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, + 289, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 289, 289, + 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, + 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, + 289, 289, 289, 289, 594, 594, 289, 289, 594, 594, + 594, 594, 594, 594, 594, 594, 594, 594, 289, 0, + 289, 289, 289, 289, 289, 289, 289, 289, 594, 819, + 594, 594, 442, 442, 442, 442, 594, 594, 594, -88, + -88, 442, 594, 63, 594, 594, 594, 594, 594, 594, + 594, 594, 594, 0, 0, 594, 594, 594, 594, 0, + 0, 0, 130, -3, 594, 846, 846, 846, 846, 594, + 594, 594, 594, -3, -3, 594, 594, 594, 0, 0, + 0, 0, 442, 442, 0, 130, 0, 0, 130, 0, + 0, 846, 846, 594, 63, 819, 359, 594, 0, 0, + 0, 0, 130, 846, 130, 402, 834, -3, -3, 834, + 402, 402, 124, 18, 359, 605, 605, 605, 605, 0, + 0, 659, 819, 819, 819, 819, 819, 819, 819, 819, + 819, 819, 819, 846, 0, 819, 0, 846, 846, 846, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 846, 0, 0, 950, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 962, + 0, 0, 0, 0, 0, 0, 846, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 842, 871, 0, 871, + 0, 842, 842, 842, 0, 0, 0, 0, 863, 857 + ); + + protected array $actionDefault = array( + 3,32767, 102,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767, 100,32767,32767,32767,32767, 602, 602, + 602, 602,32767,32767, 254, 102,32767,32767, 470, 387, + 387, 387,32767,32767, 544, 544, 544, 544, 544, 544, + 32767,32767,32767,32767,32767,32767, 470,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767, 100, + 32767,32767,32767, 36, 7, 8, 10, 11, 49, 17, + 324,32767,32767,32767,32767, 102,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767, 595,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767, 474, 453, + 454, 456, 457, 386, 545, 601, 327, 598, 385, 145, + 339, 329, 242, 330, 258, 475, 259, 476, 479, 480, + 215, 287, 382, 149, 150, 417, 471, 419, 469, 473, + 418, 392, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 390, 391, 472, 450, 449, + 448,32767,32767, 415, 416,32767,32767,32767,32767,32767, + 32767,32767,32767, 102,32767, 420, 389, 423, 421, 422, + 439, 440, 437, 438, 441,32767,32767,32767,32767, 442, + 443, 444, 445, 316,32767,32767, 366, 364, 424, 316, + 111,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 430, 431,32767,32767,32767,32767, 487, 538, 447,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767, 102,32767, 100, 540, 412, 414, 507, 425, + 426, 393,32767, 514,32767, 102,32767, 516,32767,32767, + 32767,32767,32767,32767,32767, 539,32767, 546, 546,32767, + 500, 100, 195,32767,32767, 515,32767, 195, 195,32767, + 32767,32767,32767,32767,32767,32767,32767, 609, 500, 110, + 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, + 32767, 195, 110,32767,32767,32767, 100, 195, 195, 195, + 195, 195, 195, 195, 195, 195, 195, 190,32767, 268, + 270, 102, 563, 195,32767, 519,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767, 512,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767, 500, 435, 138,32767, 138, 546, 427, 428, + 429, 502, 546, 546, 546, 312, 289,32767,32767,32767, + 32767, 517, 100, 100, 100, 100, 512,32767,32767,32767, + 32767, 111, 486, 99, 99, 99, 99, 99, 103, 101, + 32767,32767,32767,32767, 223,32767, 99,32767, 101, 101, + 32767,32767, 223, 225, 212, 101, 227,32767, 567, 568, + 223, 101, 227, 227, 227, 247, 247, 489, 318, 101, + 99, 101, 101, 197, 318, 318,32767, 101, 489, 318, + 489, 318, 199, 318, 318, 318, 489, 318,32767, 101, + 318, 214, 99, 99, 318,32767,32767,32767, 502,32767, + 32767,32767,32767,32767,32767,32767, 222,32767,32767,32767, + 32767,32767,32767,32767,32767, 533,32767, 551, 565, 433, + 434, 436, 550, 548, 458, 459, 460, 461, 462, 463, + 464, 466, 597,32767, 506,32767,32767,32767, 338,32767, + 607,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767, 608,32767, + 546,32767,32767,32767,32767, 432, 9, 74, 495, 42, + 43, 51, 57, 523, 524, 525, 526, 520, 521, 527, + 522,32767,32767, 528, 573,32767,32767, 547, 600,32767, + 32767,32767,32767,32767,32767, 138,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767, 533,32767, 136, + 32767,32767,32767,32767,32767,32767,32767,32767, 529,32767, + 32767,32767, 546,32767,32767,32767,32767, 314, 311,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767, 546,32767,32767,32767,32767, + 32767, 291,32767, 308,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, + 286,32767,32767, 381, 502, 294, 296, 297,32767,32767, + 32767,32767, 360,32767,32767,32767,32767,32767,32767,32767, + 32767,32767,32767,32767, 152, 152, 3, 3, 341, 152, + 152, 152, 341, 341, 152, 341, 341, 341, 152, 152, + 152, 152, 152, 152, 280, 185, 262, 265, 247, 247, + 152, 352, 152 + ); + + protected array $goto = array( + 196, 196, 1038, 1069, 701, 353, 433, 665, 856, 710, + 427, 321, 316, 317, 337, 580, 432, 338, 434, 642, + 658, 659, 421, 676, 677, 678, 857, 167, 167, 167, + 167, 221, 197, 193, 193, 177, 179, 216, 193, 193, + 193, 193, 193, 194, 194, 194, 194, 194, 194, 188, + 189, 190, 191, 192, 218, 216, 219, 539, 540, 423, + 541, 544, 545, 546, 547, 548, 549, 550, 551, 1140, + 168, 169, 170, 195, 171, 172, 173, 166, 174, 175, + 176, 178, 215, 217, 220, 238, 243, 244, 255, 257, + 258, 259, 260, 261, 262, 263, 264, 269, 270, 271, + 272, 278, 290, 291, 319, 320, 428, 429, 430, 585, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 180, 237, 181, 198, 199, + 200, 239, 188, 189, 190, 191, 192, 218, 1140, 201, + 182, 183, 184, 202, 198, 185, 240, 203, 201, 165, + 204, 205, 186, 206, 207, 208, 187, 209, 210, 211, + 212, 213, 214, 859, 613, 628, 631, 632, 633, 634, + 655, 656, 657, 712, 460, 979, 280, 280, 280, 280, + 479, 1321, 1322, 627, 627, 831, 604, 1276, 1276, 1276, + 1276, 1276, 1276, 1276, 1276, 1276, 1276, 398, 401, 564, + 605, 609, 890, 552, 552, 552, 552, 864, 608, 913, + 908, 909, 922, 865, 910, 862, 911, 912, 863, 465, + 441, 916, 1041, 1041, 685, 956, 1189, 357, 1033, 1049, + 1050, 1091, 1086, 1087, 1088, 1295, 1295, 357, 357, 1295, + 1295, 1295, 1295, 1295, 1295, 1295, 1295, 1295, 1295, 698, + 357, 357, 833, 917, 357, 918, 1363, 354, 355, 577, + 1244, 698, 1244, 1244, 426, 698, 615, 558, 1038, 1038, + 1244, 357, 357, 5, 1038, 6, 1038, 1038, 1038, 1038, + 1038, 1038, 1038, 1038, 1038, 625, 662, 1038, 1038, 1038, + 1038, 1328, 1328, 1328, 1328, 351, 1244, 356, 356, 356, + 356, 1244, 1244, 1244, 1244, 1111, 1112, 1244, 1244, 1244, + 344, 563, 556, 897, 855, 897, 897, 1336, 554, 1307, + 554, 554, 482, 603, 1104, 930, 713, 1000, 554, 931, + 484, 396, 946, 345, 344, 946, 511, 704, 872, 1102, + 690, 343, 556, 563, 572, 573, 346, 583, 606, 620, + 621, 575, 852, 884, 458, 664, 871, 22, 1137, 973, + 973, 973, 973, 1044, 1043, 458, 967, 974, 1292, 1292, + 558, 1062, 1292, 1292, 1292, 1292, 1292, 1292, 1292, 1292, + 1292, 1292, 543, 543, 1047, 1048, 543, 543, 543, 543, + 543, 543, 543, 543, 543, 543, 570, 469, 469, 440, + 737, 641, 643, 670, 852, 663, 469, 327, 311, 687, + 691, 1014, 699, 708, 1010, 686, 1017, 1017, 1220, 948, + 1323, 1324, 1221, 1224, 949, 1225, 849, 557, 567, 581, + 618, 557, 339, 567, 877, 1237, 399, 464, 451, 451, + 451, 451, 405, 1318, 837, 1318, 1318, 251, 251, 472, + 584, 473, 474, 1318, 962, 1022, 882, 542, 542, 1354, + 1355, 542, 874, 542, 542, 542, 542, 542, 542, 542, + 542, 971, 412, 709, 249, 249, 249, 249, 246, 252, + 1330, 1330, 1330, 1330, 837, 880, 837, 410, 411, 635, + 637, 639, 674, 619, 675, 1075, 414, 415, 416, 1235, + 688, 740, 886, 417, 1079, 0, 1314, 349, 435, 984, + 885, 873, 1074, 1078, 435, 1122, 503, 0, 504, 1239, + 1045, 1045, 982, 852, 510, 0, 0, 669, 1056, 1052, + 1053, 0, 451, 451, 451, 451, 451, 451, 451, 451, + 451, 451, 451, 935, 1127, 451, 972, 0, 1077, 0, + 623, 0, 1316, 1316, 1077, 0, 1019, 0, 0, 326, + 276, 326, 326, 0, 876, 1261, 668, 998, 1120, 889, + 1346, 1346, 870, 1240, 1241, 1003, 0, 0, 975, 0, + 736, 0, 847, 0, 1234, 0, 0, 1346, 555, 1012, + 1007, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1242, 1304, 1305, 1349, 1349, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 254, 254 + ); + + protected array $gotoCheck = array( + 42, 42, 73, 127, 73, 97, 66, 66, 26, 9, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 86, 86, 43, 86, 86, 86, 27, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 15, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 83, 49, 23, 23, 23, 23, + 178, 178, 178, 108, 108, 6, 130, 108, 108, 108, + 108, 108, 108, 108, 108, 108, 108, 59, 59, 59, + 59, 59, 45, 107, 107, 107, 107, 15, 107, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 151, + 83, 15, 89, 89, 89, 89, 151, 14, 89, 89, + 89, 15, 15, 15, 15, 172, 172, 14, 14, 172, + 172, 172, 172, 172, 172, 172, 172, 172, 172, 7, + 14, 14, 7, 65, 14, 65, 14, 97, 97, 174, + 73, 7, 73, 73, 13, 7, 13, 14, 73, 73, + 73, 14, 14, 46, 73, 46, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 56, 56, 73, 73, 73, + 73, 9, 9, 9, 9, 181, 73, 24, 24, 24, + 24, 73, 73, 73, 73, 144, 144, 73, 73, 73, + 170, 76, 76, 25, 25, 25, 25, 183, 19, 14, + 19, 19, 84, 8, 8, 73, 8, 103, 19, 73, + 84, 62, 9, 170, 170, 9, 8, 8, 35, 8, + 14, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 104, 22, 35, 19, 64, 35, 76, 150, 19, + 19, 19, 19, 118, 118, 19, 19, 19, 173, 173, + 14, 114, 173, 173, 173, 173, 173, 173, 173, 173, + 173, 173, 175, 175, 119, 119, 175, 175, 175, 175, + 175, 175, 175, 175, 175, 175, 48, 149, 149, 113, + 48, 48, 48, 120, 22, 48, 149, 171, 171, 48, + 48, 48, 48, 48, 48, 116, 107, 107, 79, 79, + 180, 180, 79, 79, 79, 79, 18, 9, 9, 2, + 2, 9, 29, 9, 39, 14, 9, 9, 23, 23, + 23, 23, 28, 130, 12, 130, 130, 5, 5, 9, + 9, 9, 9, 130, 92, 110, 9, 158, 158, 9, + 9, 158, 37, 158, 158, 158, 158, 158, 158, 158, + 158, 93, 93, 93, 5, 5, 5, 5, 5, 5, + 130, 130, 130, 130, 12, 9, 12, 82, 82, 85, + 85, 85, 82, 80, 82, 129, 82, 82, 82, 162, + 82, 99, 41, 82, 132, -1, 130, 82, 117, 96, + 16, 16, 16, 16, 117, 147, 155, -1, 155, 20, + 117, 117, 16, 22, 155, -1, -1, 117, 117, 117, + 117, -1, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 17, 17, 23, 16, -1, 130, -1, + 17, -1, 130, 130, 130, -1, 17, -1, -1, 24, + 24, 24, 24, -1, 17, 20, 17, 17, 16, 16, + 184, 184, 17, 20, 20, 50, -1, -1, 50, -1, + 50, -1, 20, -1, 17, -1, -1, 184, 50, 50, + 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 20, 20, 20, 184, 184, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 5, 5 + ); + + protected array $gotoBase = array( + 0, 0, -287, 0, 0, 446, 165, 242, 315, -11, + 0, 0, 145, -75, -73, -187, 56, 75, 114, 53, + 124, 0, 72, 173, 294, 310, 4, 22, 103, 133, + 0, 0, 0, 0, 0, -35, 0, 121, 0, 109, + 0, 60, -1, 3, 0, 179, -467, 0, -319, 157, + 563, 0, 0, 0, 0, 0, 245, 0, 0, 152, + 0, 0, 289, 0, 113, 239, -235, 0, 0, 0, + 0, 0, 0, -5, 0, 0, -36, 0, 0, 8, + 147, -196, -7, -106, -150, 7, -702, 0, 0, -59, + 0, 0, 123, 164, 0, 0, 65, -481, 0, 92, + 0, 0, 0, 292, 308, 0, 0, 175, -58, 0, + 83, 0, 0, 120, 97, 0, 132, 235, 82, 99, + 111, 0, 0, 0, 0, 0, 0, 1, 0, 119, + 178, 0, 61, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 29, 0, 0, 70, 0, 363, + 112, -49, 0, 0, 0, 18, 0, 0, 216, 0, + 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, + 10, 84, -6, 127, 230, 141, 0, 0, -123, 0, + 46, 265, 0, 286, 260, 0, 0 + ); + + protected array $gotoDefault = array( + -32768, 515, 744, 4, 745, 939, 820, 829, 601, 533, + 711, 350, 629, 424, 1312, 915, 1126, 582, 848, 1253, + 1227, 459, 851, 332, 734, 927, 898, 899, 402, 388, + 394, 400, 653, 630, 497, 883, 455, 875, 489, 878, + 454, 887, 164, 420, 513, 891, 3, 894, 561, 925, + 977, 389, 902, 390, 681, 904, 566, 906, 907, 397, + 403, 404, 1131, 574, 626, 919, 256, 568, 920, 387, + 921, 929, 392, 395, 692, 468, 508, 502, 413, 1106, + 569, 612, 650, 448, 476, 624, 636, 622, 483, 436, + 418, 331, 961, 969, 490, 466, 983, 352, 991, 742, + 1139, 644, 492, 999, 645, 1006, 1009, 534, 535, 481, + 1021, 273, 1024, 493, 19, 671, 1035, 1036, 672, 646, + 1058, 647, 673, 648, 1060, 475, 602, 1068, 456, 1076, + 1300, 457, 1080, 266, 1083, 279, 419, 437, 1089, 1090, + 9, 1096, 702, 703, 11, 277, 512, 1121, 693, 453, + 1138, 452, 1208, 1210, 562, 494, 1228, 480, 296, 1231, + 684, 509, 1236, 449, 1303, 450, 536, 477, 318, 537, + 1347, 310, 335, 315, 553, 297, 336, 538, 478, 1309, + 1317, 333, 31, 1337, 1348, 579, 617 + ); + + protected array $ruleToNonTerminal = array( + 0, 1, 3, 3, 2, 5, 5, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, + 7, 7, 7, 7, 7, 8, 8, 9, 10, 11, + 11, 11, 12, 12, 13, 13, 14, 15, 15, 16, + 16, 17, 17, 18, 18, 21, 21, 22, 23, 23, + 24, 24, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 29, 29, 30, 30, 32, 34, 34, + 28, 36, 36, 33, 38, 38, 35, 35, 37, 37, + 39, 39, 31, 40, 40, 41, 43, 44, 44, 45, + 45, 46, 46, 48, 47, 47, 47, 47, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 25, 25, 50, 69, 69, 72, 72, 71, + 70, 70, 63, 75, 75, 76, 76, 77, 77, 78, + 78, 79, 79, 80, 80, 26, 26, 27, 27, 27, + 27, 27, 88, 88, 90, 90, 83, 83, 91, 91, + 92, 92, 92, 84, 84, 87, 87, 85, 85, 93, + 94, 94, 57, 57, 65, 65, 68, 68, 68, 67, + 95, 95, 96, 58, 58, 58, 58, 97, 97, 98, + 98, 99, 99, 100, 101, 101, 102, 102, 103, 103, + 55, 55, 51, 51, 105, 53, 53, 106, 52, 52, + 54, 54, 64, 64, 64, 64, 81, 81, 109, 109, + 111, 111, 112, 112, 112, 112, 110, 110, 110, 114, + 114, 114, 114, 89, 89, 117, 117, 117, 118, 118, + 115, 115, 119, 119, 121, 121, 122, 122, 116, 123, + 123, 120, 124, 124, 124, 124, 113, 113, 82, 82, + 82, 20, 20, 20, 126, 125, 125, 127, 127, 127, + 127, 60, 128, 128, 129, 61, 131, 131, 132, 132, + 133, 133, 86, 134, 134, 134, 134, 134, 134, 134, + 139, 139, 140, 140, 141, 141, 141, 141, 141, 142, + 143, 143, 138, 138, 135, 135, 137, 137, 145, 145, + 144, 144, 144, 144, 144, 144, 144, 136, 146, 146, + 148, 147, 147, 62, 104, 149, 149, 56, 56, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 156, 158, 158, 159, 150, 150, 155, + 155, 160, 161, 161, 162, 163, 164, 164, 164, 164, + 19, 19, 73, 73, 73, 73, 151, 151, 151, 151, + 166, 166, 152, 152, 154, 154, 154, 157, 157, 172, + 172, 172, 172, 172, 172, 172, 172, 172, 173, 173, + 173, 108, 175, 175, 175, 175, 153, 153, 153, 153, + 153, 153, 153, 153, 59, 59, 169, 169, 169, 169, + 169, 176, 176, 165, 165, 165, 165, 177, 177, 177, + 177, 177, 177, 74, 74, 66, 66, 66, 66, 130, + 130, 130, 130, 180, 179, 168, 168, 168, 168, 168, + 168, 168, 167, 167, 167, 178, 178, 178, 178, 107, + 174, 182, 182, 181, 181, 183, 183, 183, 183, 183, + 183, 183, 183, 171, 171, 171, 171, 170, 185, 184, + 184, 184, 184, 184, 184, 184, 184, 186, 186, 186, + 186 + ); + + protected array $ruleToLength = array( + 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, + 1, 0, 1, 1, 2, 1, 3, 4, 1, 2, + 0, 1, 1, 1, 1, 4, 3, 5, 4, 3, + 4, 2, 3, 1, 1, 7, 6, 2, 3, 1, + 2, 3, 1, 2, 3, 1, 1, 3, 1, 3, + 1, 2, 2, 3, 1, 3, 2, 3, 1, 3, + 3, 2, 0, 1, 1, 1, 1, 1, 3, 7, + 10, 5, 7, 9, 5, 3, 3, 3, 3, 3, + 3, 1, 2, 5, 7, 9, 6, 5, 6, 3, + 2, 1, 1, 1, 1, 0, 2, 1, 3, 8, + 0, 4, 2, 1, 3, 0, 1, 0, 1, 0, + 1, 3, 1, 1, 1, 8, 9, 7, 8, 7, + 6, 8, 0, 2, 0, 2, 1, 2, 1, 2, + 1, 1, 1, 0, 2, 0, 2, 0, 2, 2, + 1, 3, 1, 4, 1, 4, 1, 1, 4, 2, + 1, 3, 3, 3, 4, 4, 5, 0, 2, 4, + 3, 1, 1, 7, 0, 2, 1, 3, 3, 4, + 1, 4, 0, 2, 5, 0, 2, 6, 0, 2, + 0, 3, 1, 2, 1, 1, 2, 0, 1, 3, + 0, 2, 1, 1, 1, 1, 6, 8, 6, 1, + 2, 1, 1, 1, 1, 1, 1, 1, 1, 3, + 3, 3, 1, 3, 3, 3, 3, 3, 1, 3, + 3, 1, 1, 2, 1, 1, 0, 1, 0, 2, + 2, 2, 4, 3, 1, 1, 3, 1, 2, 2, + 3, 2, 3, 1, 1, 2, 3, 1, 1, 3, + 2, 0, 1, 5, 5, 6, 10, 3, 5, 1, + 1, 3, 0, 2, 4, 5, 4, 4, 4, 3, + 1, 1, 1, 1, 1, 1, 0, 1, 1, 2, + 1, 1, 1, 1, 1, 1, 1, 2, 1, 3, + 1, 1, 3, 2, 2, 3, 1, 0, 1, 1, + 3, 3, 3, 4, 4, 1, 1, 2, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, + 3, 4, 4, 2, 2, 4, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 1, 3, 2, + 1, 2, 4, 2, 2, 8, 9, 8, 9, 9, + 10, 9, 10, 8, 3, 2, 2, 1, 1, 0, + 4, 2, 1, 3, 2, 1, 2, 2, 2, 4, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, + 1, 1, 0, 3, 0, 1, 1, 0, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 5, + 3, 3, 4, 1, 1, 3, 1, 1, 1, 1, + 1, 3, 2, 3, 0, 1, 1, 3, 1, 1, + 1, 1, 1, 1, 3, 1, 1, 1, 4, 4, + 1, 4, 4, 0, 1, 1, 1, 3, 3, 1, + 4, 2, 2, 1, 3, 1, 4, 4, 3, 3, + 3, 3, 1, 3, 1, 1, 3, 1, 1, 4, + 1, 1, 1, 3, 1, 1, 2, 1, 3, 4, + 3, 2, 0, 2, 2, 1, 2, 1, 1, 1, + 4, 3, 3, 3, 3, 6, 3, 1, 1, 2, + 1 + ); + + protected function initReduceCallbacks(): void { + $this->reduceCallbacks = [ + 0 => null, + 1 => static function ($self, $stackPos) { + $self->semValue = $self->handleNamespaces($self->semStack[$stackPos-(1-1)]); + }, + 2 => static function ($self, $stackPos) { + if ($self->semStack[$stackPos-(2-2)] !== null) { $self->semStack[$stackPos-(2-1)][] = $self->semStack[$stackPos-(2-2)]; } $self->semValue = $self->semStack[$stackPos-(2-1)];; + }, + 3 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 4 => static function ($self, $stackPos) { + $nop = $self->maybeCreateZeroLengthNop($self->tokenPos);; + if ($nop !== null) { $self->semStack[$stackPos-(1-1)][] = $nop; } $self->semValue = $self->semStack[$stackPos-(1-1)]; + }, + 5 => null, + 6 => null, + 7 => null, + 8 => null, + 9 => null, + 10 => null, + 11 => null, + 12 => null, + 13 => null, + 14 => null, + 15 => null, + 16 => null, + 17 => null, + 18 => null, + 19 => null, + 20 => null, + 21 => null, + 22 => null, + 23 => null, + 24 => null, + 25 => null, + 26 => null, + 27 => null, + 28 => null, + 29 => null, + 30 => null, + 31 => null, + 32 => null, + 33 => null, + 34 => null, + 35 => null, + 36 => null, + 37 => null, + 38 => null, + 39 => null, + 40 => null, + 41 => null, + 42 => null, + 43 => null, + 44 => null, + 45 => null, + 46 => null, + 47 => null, + 48 => null, + 49 => null, + 50 => null, + 51 => null, + 52 => null, + 53 => null, + 54 => null, + 55 => null, + 56 => null, + 57 => null, + 58 => null, + 59 => null, + 60 => null, + 61 => null, + 62 => null, + 63 => null, + 64 => null, + 65 => null, + 66 => null, + 67 => null, + 68 => null, + 69 => null, + 70 => null, + 71 => null, + 72 => null, + 73 => null, + 74 => null, + 75 => null, + 76 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(1-1)]; if ($self->semValue === "<?=") $self->emitError(new Error('Cannot use "<?=" as an identifier', $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos]))); + }, + 77 => null, + 78 => null, + 79 => null, + 80 => null, + 81 => null, + 82 => null, + 83 => null, + 84 => null, + 85 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 86 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 87 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 88 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 89 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 90 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 91 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 92 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 93 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 94 => null, + 95 => static function ($self, $stackPos) { + $self->semValue = new Name(substr($self->semStack[$stackPos-(1-1)], 1), $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 96 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable(substr($self->semStack[$stackPos-(1-1)], 1), $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 97 => static function ($self, $stackPos) { + /* nothing */ + }, + 98 => static function ($self, $stackPos) { + /* nothing */ + }, + 99 => static function ($self, $stackPos) { + /* nothing */ + }, + 100 => static function ($self, $stackPos) { + $self->emitError(new Error('A trailing comma is not allowed here', $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos]))); + }, + 101 => null, + 102 => null, + 103 => static function ($self, $stackPos) { + $self->semValue = new Node\Attribute($self->semStack[$stackPos-(1-1)], [], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 104 => static function ($self, $stackPos) { + $self->semValue = new Node\Attribute($self->semStack[$stackPos-(2-1)], $self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 105 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 106 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 107 => static function ($self, $stackPos) { + $self->semValue = new Node\AttributeGroup($self->semStack[$stackPos-(4-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 108 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 109 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(2-1)][] = $self->semStack[$stackPos-(2-2)]; $self->semValue = $self->semStack[$stackPos-(2-1)]; + }, + 110 => static function ($self, $stackPos) { + $self->semValue = []; + }, + 111 => null, + 112 => null, + 113 => null, + 114 => null, + 115 => static function ($self, $stackPos) { + $self->semValue = new Stmt\HaltCompiler($self->handleHaltCompiler(), $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 116 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Namespace_($self->semStack[$stackPos-(3-2)], null, $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + $self->semValue->setAttribute('kind', Stmt\Namespace_::KIND_SEMICOLON); + $self->checkNamespace($self->semValue); + }, + 117 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Namespace_($self->semStack[$stackPos-(5-2)], $self->semStack[$stackPos-(5-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos])); + $self->semValue->setAttribute('kind', Stmt\Namespace_::KIND_BRACED); + $self->checkNamespace($self->semValue); + }, + 118 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Namespace_(null, $self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + $self->semValue->setAttribute('kind', Stmt\Namespace_::KIND_BRACED); + $self->checkNamespace($self->semValue); + }, + 119 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Use_($self->semStack[$stackPos-(3-2)], Stmt\Use_::TYPE_NORMAL, $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 120 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Use_($self->semStack[$stackPos-(4-3)], $self->semStack[$stackPos-(4-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 121 => null, + 122 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Const_($self->semStack[$stackPos-(3-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 123 => static function ($self, $stackPos) { + $self->semValue = Stmt\Use_::TYPE_FUNCTION; + }, + 124 => static function ($self, $stackPos) { + $self->semValue = Stmt\Use_::TYPE_CONSTANT; + }, + 125 => static function ($self, $stackPos) { + $self->semValue = new Stmt\GroupUse($self->semStack[$stackPos-(7-3)], $self->semStack[$stackPos-(7-6)], $self->semStack[$stackPos-(7-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(7-1)], $self->tokenEndStack[$stackPos])); + }, + 126 => static function ($self, $stackPos) { + $self->semValue = new Stmt\GroupUse($self->semStack[$stackPos-(6-2)], $self->semStack[$stackPos-(6-5)], Stmt\Use_::TYPE_UNKNOWN, $self->getAttributes($self->tokenStartStack[$stackPos-(6-1)], $self->tokenEndStack[$stackPos])); + }, + 127 => null, + 128 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 129 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 130 => null, + 131 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 132 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 133 => null, + 134 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 135 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 136 => static function ($self, $stackPos) { + $self->semValue = new Node\UseItem($self->semStack[$stackPos-(1-1)], null, Stmt\Use_::TYPE_UNKNOWN, $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); $self->checkUseUse($self->semValue, $stackPos-(1-1)); + }, + 137 => static function ($self, $stackPos) { + $self->semValue = new Node\UseItem($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], Stmt\Use_::TYPE_UNKNOWN, $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); $self->checkUseUse($self->semValue, $stackPos-(3-3)); + }, + 138 => static function ($self, $stackPos) { + $self->semValue = new Node\UseItem($self->semStack[$stackPos-(1-1)], null, Stmt\Use_::TYPE_UNKNOWN, $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); $self->checkUseUse($self->semValue, $stackPos-(1-1)); + }, + 139 => static function ($self, $stackPos) { + $self->semValue = new Node\UseItem($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], Stmt\Use_::TYPE_UNKNOWN, $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); $self->checkUseUse($self->semValue, $stackPos-(3-3)); + }, + 140 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(1-1)]; $self->semValue->type = Stmt\Use_::TYPE_NORMAL; + }, + 141 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(2-2)]; $self->semValue->type = $self->semStack[$stackPos-(2-1)]; + }, + 142 => null, + 143 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 144 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 145 => static function ($self, $stackPos) { + $self->semValue = new Node\Const_($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 146 => null, + 147 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 148 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 149 => static function ($self, $stackPos) { + $self->semValue = new Node\Const_(new Node\Identifier($self->semStack[$stackPos-(3-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos-(3-1)])), $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 150 => static function ($self, $stackPos) { + $self->semValue = new Node\Const_(new Node\Identifier($self->semStack[$stackPos-(3-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos-(3-1)])), $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 151 => static function ($self, $stackPos) { + if ($self->semStack[$stackPos-(2-2)] !== null) { $self->semStack[$stackPos-(2-1)][] = $self->semStack[$stackPos-(2-2)]; } $self->semValue = $self->semStack[$stackPos-(2-1)];; + }, + 152 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 153 => static function ($self, $stackPos) { + $nop = $self->maybeCreateZeroLengthNop($self->tokenPos);; + if ($nop !== null) { $self->semStack[$stackPos-(1-1)][] = $nop; } $self->semValue = $self->semStack[$stackPos-(1-1)]; + }, + 154 => null, + 155 => null, + 156 => null, + 157 => static function ($self, $stackPos) { + throw new Error('__HALT_COMPILER() can only be used from the outermost scope', $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 158 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Block($self->semStack[$stackPos-(3-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 159 => static function ($self, $stackPos) { + $self->semValue = new Stmt\If_($self->semStack[$stackPos-(7-3)], ['stmts' => $self->semStack[$stackPos-(7-5)], 'elseifs' => $self->semStack[$stackPos-(7-6)], 'else' => $self->semStack[$stackPos-(7-7)]], $self->getAttributes($self->tokenStartStack[$stackPos-(7-1)], $self->tokenEndStack[$stackPos])); + }, + 160 => static function ($self, $stackPos) { + $self->semValue = new Stmt\If_($self->semStack[$stackPos-(10-3)], ['stmts' => $self->semStack[$stackPos-(10-6)], 'elseifs' => $self->semStack[$stackPos-(10-7)], 'else' => $self->semStack[$stackPos-(10-8)]], $self->getAttributes($self->tokenStartStack[$stackPos-(10-1)], $self->tokenEndStack[$stackPos])); + }, + 161 => static function ($self, $stackPos) { + $self->semValue = new Stmt\While_($self->semStack[$stackPos-(5-3)], $self->semStack[$stackPos-(5-5)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos])); + }, + 162 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Do_($self->semStack[$stackPos-(7-5)], $self->semStack[$stackPos-(7-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(7-1)], $self->tokenEndStack[$stackPos])); + }, + 163 => static function ($self, $stackPos) { + $self->semValue = new Stmt\For_(['init' => $self->semStack[$stackPos-(9-3)], 'cond' => $self->semStack[$stackPos-(9-5)], 'loop' => $self->semStack[$stackPos-(9-7)], 'stmts' => $self->semStack[$stackPos-(9-9)]], $self->getAttributes($self->tokenStartStack[$stackPos-(9-1)], $self->tokenEndStack[$stackPos])); + }, + 164 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Switch_($self->semStack[$stackPos-(5-3)], $self->semStack[$stackPos-(5-5)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos])); + }, + 165 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Break_($self->semStack[$stackPos-(3-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 166 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Continue_($self->semStack[$stackPos-(3-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 167 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Return_($self->semStack[$stackPos-(3-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 168 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Global_($self->semStack[$stackPos-(3-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 169 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Static_($self->semStack[$stackPos-(3-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 170 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Echo_($self->semStack[$stackPos-(3-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 171 => static function ($self, $stackPos) { + + $self->semValue = new Stmt\InlineHTML($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + $self->semValue->setAttribute('hasLeadingNewline', $self->inlineHtmlHasLeadingNewline($stackPos-(1-1))); + + }, + 172 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Expression($self->semStack[$stackPos-(2-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 173 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Unset_($self->semStack[$stackPos-(5-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos])); + }, + 174 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Foreach_($self->semStack[$stackPos-(7-3)], $self->semStack[$stackPos-(7-5)][0], ['keyVar' => null, 'byRef' => $self->semStack[$stackPos-(7-5)][1], 'stmts' => $self->semStack[$stackPos-(7-7)]], $self->getAttributes($self->tokenStartStack[$stackPos-(7-1)], $self->tokenEndStack[$stackPos])); + }, + 175 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Foreach_($self->semStack[$stackPos-(9-3)], $self->semStack[$stackPos-(9-7)][0], ['keyVar' => $self->semStack[$stackPos-(9-5)], 'byRef' => $self->semStack[$stackPos-(9-7)][1], 'stmts' => $self->semStack[$stackPos-(9-9)]], $self->getAttributes($self->tokenStartStack[$stackPos-(9-1)], $self->tokenEndStack[$stackPos])); + }, + 176 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Foreach_($self->semStack[$stackPos-(6-3)], new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos-(6-4)], $self->tokenEndStack[$stackPos-(6-4)])), ['stmts' => $self->semStack[$stackPos-(6-6)]], $self->getAttributes($self->tokenStartStack[$stackPos-(6-1)], $self->tokenEndStack[$stackPos])); + }, + 177 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Declare_($self->semStack[$stackPos-(5-3)], $self->semStack[$stackPos-(5-5)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos])); + }, + 178 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TryCatch($self->semStack[$stackPos-(6-3)], $self->semStack[$stackPos-(6-5)], $self->semStack[$stackPos-(6-6)], $self->getAttributes($self->tokenStartStack[$stackPos-(6-1)], $self->tokenEndStack[$stackPos])); $self->checkTryCatch($self->semValue); + }, + 179 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Goto_($self->semStack[$stackPos-(3-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 180 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Label($self->semStack[$stackPos-(2-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 181 => static function ($self, $stackPos) { + $self->semValue = null; /* means: no statement */ + }, + 182 => null, + 183 => static function ($self, $stackPos) { + $self->semValue = $self->maybeCreateNop($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos]); + }, + 184 => static function ($self, $stackPos) { + if ($self->semStack[$stackPos-(1-1)] instanceof Stmt\Block) { $self->semValue = $self->semStack[$stackPos-(1-1)]->stmts; } else if ($self->semStack[$stackPos-(1-1)] === null) { $self->semValue = []; } else { $self->semValue = [$self->semStack[$stackPos-(1-1)]]; }; + }, + 185 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 186 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(2-1)][] = $self->semStack[$stackPos-(2-2)]; $self->semValue = $self->semStack[$stackPos-(2-1)]; + }, + 187 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 188 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 189 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Catch_($self->semStack[$stackPos-(8-3)], $self->semStack[$stackPos-(8-4)], $self->semStack[$stackPos-(8-7)], $self->getAttributes($self->tokenStartStack[$stackPos-(8-1)], $self->tokenEndStack[$stackPos])); + }, + 190 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 191 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Finally_($self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 192 => null, + 193 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 194 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 195 => static function ($self, $stackPos) { + $self->semValue = false; + }, + 196 => static function ($self, $stackPos) { + $self->semValue = true; + }, + 197 => static function ($self, $stackPos) { + $self->semValue = false; + }, + 198 => static function ($self, $stackPos) { + $self->semValue = true; + }, + 199 => static function ($self, $stackPos) { + $self->semValue = false; + }, + 200 => static function ($self, $stackPos) { + $self->semValue = true; + }, + 201 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 202 => static function ($self, $stackPos) { + $self->semValue = []; + }, + 203 => null, + 204 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 205 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Function_($self->semStack[$stackPos-(8-3)], ['byRef' => $self->semStack[$stackPos-(8-2)], 'params' => $self->semStack[$stackPos-(8-5)], 'returnType' => $self->semStack[$stackPos-(8-7)], 'stmts' => $self->semStack[$stackPos-(8-8)], 'attrGroups' => []], $self->getAttributes($self->tokenStartStack[$stackPos-(8-1)], $self->tokenEndStack[$stackPos])); + }, + 206 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Function_($self->semStack[$stackPos-(9-4)], ['byRef' => $self->semStack[$stackPos-(9-3)], 'params' => $self->semStack[$stackPos-(9-6)], 'returnType' => $self->semStack[$stackPos-(9-8)], 'stmts' => $self->semStack[$stackPos-(9-9)], 'attrGroups' => $self->semStack[$stackPos-(9-1)]], $self->getAttributes($self->tokenStartStack[$stackPos-(9-1)], $self->tokenEndStack[$stackPos])); + }, + 207 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Class_($self->semStack[$stackPos-(7-2)], ['type' => $self->semStack[$stackPos-(7-1)], 'extends' => $self->semStack[$stackPos-(7-3)], 'implements' => $self->semStack[$stackPos-(7-4)], 'stmts' => $self->semStack[$stackPos-(7-6)], 'attrGroups' => []], $self->getAttributes($self->tokenStartStack[$stackPos-(7-1)], $self->tokenEndStack[$stackPos])); + $self->checkClass($self->semValue, $stackPos-(7-2)); + }, + 208 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Class_($self->semStack[$stackPos-(8-3)], ['type' => $self->semStack[$stackPos-(8-2)], 'extends' => $self->semStack[$stackPos-(8-4)], 'implements' => $self->semStack[$stackPos-(8-5)], 'stmts' => $self->semStack[$stackPos-(8-7)], 'attrGroups' => $self->semStack[$stackPos-(8-1)]], $self->getAttributes($self->tokenStartStack[$stackPos-(8-1)], $self->tokenEndStack[$stackPos])); + $self->checkClass($self->semValue, $stackPos-(8-3)); + }, + 209 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Interface_($self->semStack[$stackPos-(7-3)], ['extends' => $self->semStack[$stackPos-(7-4)], 'stmts' => $self->semStack[$stackPos-(7-6)], 'attrGroups' => $self->semStack[$stackPos-(7-1)]], $self->getAttributes($self->tokenStartStack[$stackPos-(7-1)], $self->tokenEndStack[$stackPos])); + $self->checkInterface($self->semValue, $stackPos-(7-3)); + }, + 210 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Trait_($self->semStack[$stackPos-(6-3)], ['stmts' => $self->semStack[$stackPos-(6-5)], 'attrGroups' => $self->semStack[$stackPos-(6-1)]], $self->getAttributes($self->tokenStartStack[$stackPos-(6-1)], $self->tokenEndStack[$stackPos])); + }, + 211 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Enum_($self->semStack[$stackPos-(8-3)], ['scalarType' => $self->semStack[$stackPos-(8-4)], 'implements' => $self->semStack[$stackPos-(8-5)], 'stmts' => $self->semStack[$stackPos-(8-7)], 'attrGroups' => $self->semStack[$stackPos-(8-1)]], $self->getAttributes($self->tokenStartStack[$stackPos-(8-1)], $self->tokenEndStack[$stackPos])); + $self->checkEnum($self->semValue, $stackPos-(8-3)); + }, + 212 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 213 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(2-2)]; + }, + 214 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 215 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(2-2)]; + }, + 216 => static function ($self, $stackPos) { + $self->semValue = 0; + }, + 217 => null, + 218 => null, + 219 => static function ($self, $stackPos) { + $self->checkClassModifier($self->semStack[$stackPos-(2-1)], $self->semStack[$stackPos-(2-2)], $stackPos-(2-2)); $self->semValue = $self->semStack[$stackPos-(2-1)] | $self->semStack[$stackPos-(2-2)]; + }, + 220 => static function ($self, $stackPos) { + $self->semValue = Modifiers::ABSTRACT; + }, + 221 => static function ($self, $stackPos) { + $self->semValue = Modifiers::FINAL; + }, + 222 => static function ($self, $stackPos) { + $self->semValue = Modifiers::READONLY; + }, + 223 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 224 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(2-2)]; + }, + 225 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 226 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(2-2)]; + }, + 227 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 228 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(2-2)]; + }, + 229 => null, + 230 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 231 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 232 => null, + 233 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(4-2)]; + }, + 234 => null, + 235 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(4-2)]; + }, + 236 => static function ($self, $stackPos) { + if ($self->semStack[$stackPos-(1-1)] instanceof Stmt\Block) { $self->semValue = $self->semStack[$stackPos-(1-1)]->stmts; } else if ($self->semStack[$stackPos-(1-1)] === null) { $self->semValue = []; } else { $self->semValue = [$self->semStack[$stackPos-(1-1)]]; }; + }, + 237 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 238 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(4-2)]; + }, + 239 => null, + 240 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 241 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 242 => static function ($self, $stackPos) { + $self->semValue = new Node\DeclareItem($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 243 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 244 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(4-3)]; + }, + 245 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(4-2)]; + }, + 246 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(5-3)]; + }, + 247 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 248 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(2-1)][] = $self->semStack[$stackPos-(2-2)]; $self->semValue = $self->semStack[$stackPos-(2-1)]; + }, + 249 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Case_($self->semStack[$stackPos-(4-2)], $self->semStack[$stackPos-(4-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 250 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Case_(null, $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 251 => null, + 252 => null, + 253 => static function ($self, $stackPos) { + $self->semValue = new Expr\Match_($self->semStack[$stackPos-(7-3)], $self->semStack[$stackPos-(7-6)], $self->getAttributes($self->tokenStartStack[$stackPos-(7-1)], $self->tokenEndStack[$stackPos])); + }, + 254 => static function ($self, $stackPos) { + $self->semValue = []; + }, + 255 => null, + 256 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 257 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 258 => static function ($self, $stackPos) { + $self->semValue = new Node\MatchArm($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 259 => static function ($self, $stackPos) { + $self->semValue = new Node\MatchArm(null, $self->semStack[$stackPos-(4-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 260 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(1-1)]; + }, + 261 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(4-2)]; + }, + 262 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 263 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(2-1)][] = $self->semStack[$stackPos-(2-2)]; $self->semValue = $self->semStack[$stackPos-(2-1)]; + }, + 264 => static function ($self, $stackPos) { + $self->semValue = new Stmt\ElseIf_($self->semStack[$stackPos-(5-3)], $self->semStack[$stackPos-(5-5)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos])); + }, + 265 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 266 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(2-1)][] = $self->semStack[$stackPos-(2-2)]; $self->semValue = $self->semStack[$stackPos-(2-1)]; + }, + 267 => static function ($self, $stackPos) { + $self->semValue = new Stmt\ElseIf_($self->semStack[$stackPos-(6-3)], $self->semStack[$stackPos-(6-6)], $self->getAttributes($self->tokenStartStack[$stackPos-(6-1)], $self->tokenEndStack[$stackPos])); $self->fixupAlternativeElse($self->semValue); + }, + 268 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 269 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Else_($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 270 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 271 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Else_($self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); $self->fixupAlternativeElse($self->semValue); + }, + 272 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)], false); + }, + 273 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(2-2)], true); + }, + 274 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)], false); + }, + 275 => static function ($self, $stackPos) { + $self->semValue = array($self->fixupArrayDestructuring($self->semStack[$stackPos-(1-1)]), false); + }, + 276 => null, + 277 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 278 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 279 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 280 => static function ($self, $stackPos) { + $self->semValue = 0; + }, + 281 => static function ($self, $stackPos) { + $self->checkModifier($self->semStack[$stackPos-(2-1)], $self->semStack[$stackPos-(2-2)], $stackPos-(2-2)); $self->semValue = $self->semStack[$stackPos-(2-1)] | $self->semStack[$stackPos-(2-2)]; + }, + 282 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PUBLIC; + }, + 283 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PROTECTED; + }, + 284 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PRIVATE; + }, + 285 => static function ($self, $stackPos) { + $self->semValue = Modifiers::READONLY; + }, + 286 => static function ($self, $stackPos) { + $self->semValue = new Node\Param($self->semStack[$stackPos-(6-6)], null, $self->semStack[$stackPos-(6-3)], $self->semStack[$stackPos-(6-4)], $self->semStack[$stackPos-(6-5)], $self->getAttributes($self->tokenStartStack[$stackPos-(6-1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos-(6-2)], $self->semStack[$stackPos-(6-1)]); + $self->checkParam($self->semValue); + }, + 287 => static function ($self, $stackPos) { + $self->semValue = new Node\Param($self->semStack[$stackPos-(8-6)], $self->semStack[$stackPos-(8-8)], $self->semStack[$stackPos-(8-3)], $self->semStack[$stackPos-(8-4)], $self->semStack[$stackPos-(8-5)], $self->getAttributes($self->tokenStartStack[$stackPos-(8-1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos-(8-2)], $self->semStack[$stackPos-(8-1)]); + $self->checkParam($self->semValue); + }, + 288 => static function ($self, $stackPos) { + $self->semValue = new Node\Param(new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos-(6-1)], $self->tokenEndStack[$stackPos])), null, $self->semStack[$stackPos-(6-3)], $self->semStack[$stackPos-(6-4)], $self->semStack[$stackPos-(6-5)], $self->getAttributes($self->tokenStartStack[$stackPos-(6-1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos-(6-2)], $self->semStack[$stackPos-(6-1)]); + }, + 289 => null, + 290 => static function ($self, $stackPos) { + $self->semValue = new Node\NullableType($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 291 => static function ($self, $stackPos) { + $self->semValue = new Node\UnionType($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 292 => null, + 293 => null, + 294 => static function ($self, $stackPos) { + $self->semValue = new Node\Name('static', $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 295 => static function ($self, $stackPos) { + $self->semValue = $self->handleBuiltinTypes($self->semStack[$stackPos-(1-1)]); + }, + 296 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier('array', $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 297 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier('callable', $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 298 => null, + 299 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 300 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)]); + }, + 301 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 302 => null, + 303 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 304 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)]); + }, + 305 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 306 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)]); + }, + 307 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 308 => static function ($self, $stackPos) { + $self->semValue = new Node\IntersectionType($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 309 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)]); + }, + 310 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 311 => static function ($self, $stackPos) { + $self->semValue = new Node\IntersectionType($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 312 => null, + 313 => static function ($self, $stackPos) { + $self->semValue = new Node\NullableType($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 314 => static function ($self, $stackPos) { + $self->semValue = new Node\UnionType($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 315 => null, + 316 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 317 => null, + 318 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 319 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(2-2)]; + }, + 320 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 321 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 322 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(4-2)]; + }, + 323 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(3-2)]); + }, + 324 => static function ($self, $stackPos) { + $self->semValue = new Node\VariadicPlaceholder($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 325 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 326 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 327 => static function ($self, $stackPos) { + $self->semValue = new Node\Arg($self->semStack[$stackPos-(1-1)], false, false, $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 328 => static function ($self, $stackPos) { + $self->semValue = new Node\Arg($self->semStack[$stackPos-(2-2)], true, false, $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 329 => static function ($self, $stackPos) { + $self->semValue = new Node\Arg($self->semStack[$stackPos-(2-2)], false, true, $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 330 => static function ($self, $stackPos) { + $self->semValue = new Node\Arg($self->semStack[$stackPos-(3-3)], false, false, $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos-(3-1)]); + }, + 331 => null, + 332 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 333 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 334 => null, + 335 => null, + 336 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 337 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 338 => static function ($self, $stackPos) { + $self->semValue = new Node\StaticVar($self->semStack[$stackPos-(1-1)], null, $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 339 => static function ($self, $stackPos) { + $self->semValue = new Node\StaticVar($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 340 => static function ($self, $stackPos) { + if ($self->semStack[$stackPos-(2-2)] !== null) { $self->semStack[$stackPos-(2-1)][] = $self->semStack[$stackPos-(2-2)]; $self->semValue = $self->semStack[$stackPos-(2-1)]; } else { $self->semValue = $self->semStack[$stackPos-(2-1)]; } + }, + 341 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 342 => static function ($self, $stackPos) { + $nop = $self->maybeCreateZeroLengthNop($self->tokenPos);; + if ($nop !== null) { $self->semStack[$stackPos-(1-1)][] = $nop; } $self->semValue = $self->semStack[$stackPos-(1-1)]; + }, + 343 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Property($self->semStack[$stackPos-(5-2)], $self->semStack[$stackPos-(5-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos-(5-3)], $self->semStack[$stackPos-(5-1)]); + $self->checkProperty($self->semValue, $stackPos-(5-2)); + }, + 344 => static function ($self, $stackPos) { + $self->semValue = new Stmt\ClassConst($self->semStack[$stackPos-(5-4)], $self->semStack[$stackPos-(5-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos-(5-1)]); + $self->checkClassConst($self->semValue, $stackPos-(5-2)); + }, + 345 => static function ($self, $stackPos) { + $self->semValue = new Stmt\ClassConst($self->semStack[$stackPos-(6-5)], $self->semStack[$stackPos-(6-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(6-1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos-(6-1)], $self->semStack[$stackPos-(6-4)]); + $self->checkClassConst($self->semValue, $stackPos-(6-2)); + }, + 346 => static function ($self, $stackPos) { + $self->semValue = new Stmt\ClassMethod($self->semStack[$stackPos-(10-5)], ['type' => $self->semStack[$stackPos-(10-2)], 'byRef' => $self->semStack[$stackPos-(10-4)], 'params' => $self->semStack[$stackPos-(10-7)], 'returnType' => $self->semStack[$stackPos-(10-9)], 'stmts' => $self->semStack[$stackPos-(10-10)], 'attrGroups' => $self->semStack[$stackPos-(10-1)]], $self->getAttributes($self->tokenStartStack[$stackPos-(10-1)], $self->tokenEndStack[$stackPos])); + $self->checkClassMethod($self->semValue, $stackPos-(10-2)); + }, + 347 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TraitUse($self->semStack[$stackPos-(3-2)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 348 => static function ($self, $stackPos) { + $self->semValue = new Stmt\EnumCase($self->semStack[$stackPos-(5-3)], $self->semStack[$stackPos-(5-4)], $self->semStack[$stackPos-(5-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos])); + }, + 349 => static function ($self, $stackPos) { + $self->semValue = null; /* will be skipped */ + }, + 350 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 351 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 352 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 353 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(2-1)][] = $self->semStack[$stackPos-(2-2)]; $self->semValue = $self->semStack[$stackPos-(2-1)]; + }, + 354 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TraitUseAdaptation\Precedence($self->semStack[$stackPos-(4-1)][0], $self->semStack[$stackPos-(4-1)][1], $self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 355 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TraitUseAdaptation\Alias($self->semStack[$stackPos-(5-1)][0], $self->semStack[$stackPos-(5-1)][1], $self->semStack[$stackPos-(5-3)], $self->semStack[$stackPos-(5-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos])); + }, + 356 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TraitUseAdaptation\Alias($self->semStack[$stackPos-(4-1)][0], $self->semStack[$stackPos-(4-1)][1], $self->semStack[$stackPos-(4-3)], null, $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 357 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TraitUseAdaptation\Alias($self->semStack[$stackPos-(4-1)][0], $self->semStack[$stackPos-(4-1)][1], null, $self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 358 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TraitUseAdaptation\Alias($self->semStack[$stackPos-(4-1)][0], $self->semStack[$stackPos-(4-1)][1], null, $self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 359 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)]); + }, + 360 => null, + 361 => static function ($self, $stackPos) { + $self->semValue = array(null, $self->semStack[$stackPos-(1-1)]); + }, + 362 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 363 => null, + 364 => null, + 365 => static function ($self, $stackPos) { + $self->semValue = 0; + }, + 366 => static function ($self, $stackPos) { + $self->semValue = 0; + }, + 367 => null, + 368 => null, + 369 => static function ($self, $stackPos) { + $self->checkModifier($self->semStack[$stackPos-(2-1)], $self->semStack[$stackPos-(2-2)], $stackPos-(2-2)); $self->semValue = $self->semStack[$stackPos-(2-1)] | $self->semStack[$stackPos-(2-2)]; + }, + 370 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PUBLIC; + }, + 371 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PROTECTED; + }, + 372 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PRIVATE; + }, + 373 => static function ($self, $stackPos) { + $self->semValue = Modifiers::STATIC; + }, + 374 => static function ($self, $stackPos) { + $self->semValue = Modifiers::ABSTRACT; + }, + 375 => static function ($self, $stackPos) { + $self->semValue = Modifiers::FINAL; + }, + 376 => static function ($self, $stackPos) { + $self->semValue = Modifiers::READONLY; + }, + 377 => null, + 378 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 379 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 380 => static function ($self, $stackPos) { + $self->semValue = new Node\VarLikeIdentifier(substr($self->semStack[$stackPos-(1-1)], 1), $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 381 => static function ($self, $stackPos) { + $self->semValue = new Node\PropertyItem($self->semStack[$stackPos-(1-1)], null, $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 382 => static function ($self, $stackPos) { + $self->semValue = new Node\PropertyItem($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 383 => null, + 384 => null, + 385 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 386 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 387 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 388 => null, + 389 => null, + 390 => static function ($self, $stackPos) { + $self->semValue = new Expr\Assign($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 391 => static function ($self, $stackPos) { + $self->semValue = new Expr\Assign($self->fixupArrayDestructuring($self->semStack[$stackPos-(3-1)]), $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 392 => static function ($self, $stackPos) { + $self->semValue = new Expr\Assign($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 393 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignRef($self->semStack[$stackPos-(4-1)], $self->semStack[$stackPos-(4-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 394 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignRef($self->semStack[$stackPos-(4-1)], $self->semStack[$stackPos-(4-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + if (!$self->phpVersion->allowsAssignNewByReference()) { + $self->emitError(new Error('Cannot assign new by reference', $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos]))); + } + + }, + 395 => null, + 396 => null, + 397 => static function ($self, $stackPos) { + $self->semValue = new Expr\Clone_($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 398 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Plus($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 399 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Minus($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 400 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Mul($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 401 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Div($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 402 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Concat($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 403 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Mod($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 404 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\BitwiseAnd($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 405 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\BitwiseOr($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 406 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\BitwiseXor($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 407 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\ShiftLeft($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 408 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\ShiftRight($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 409 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Pow($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 410 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Coalesce($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 411 => static function ($self, $stackPos) { + $self->semValue = new Expr\PostInc($self->semStack[$stackPos-(2-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 412 => static function ($self, $stackPos) { + $self->semValue = new Expr\PreInc($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 413 => static function ($self, $stackPos) { + $self->semValue = new Expr\PostDec($self->semStack[$stackPos-(2-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 414 => static function ($self, $stackPos) { + $self->semValue = new Expr\PreDec($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 415 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\BooleanOr($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 416 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\BooleanAnd($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 417 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\LogicalOr($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 418 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\LogicalAnd($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 419 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\LogicalXor($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 420 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\BitwiseOr($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 421 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\BitwiseAnd($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 422 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\BitwiseAnd($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 423 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\BitwiseXor($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 424 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Concat($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 425 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Plus($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 426 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Minus($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 427 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Mul($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 428 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Div($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 429 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Mod($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 430 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\ShiftLeft($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 431 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\ShiftRight($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 432 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Pow($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 433 => static function ($self, $stackPos) { + $self->semValue = new Expr\UnaryPlus($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 434 => static function ($self, $stackPos) { + $self->semValue = new Expr\UnaryMinus($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 435 => static function ($self, $stackPos) { + $self->semValue = new Expr\BooleanNot($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 436 => static function ($self, $stackPos) { + $self->semValue = new Expr\BitwiseNot($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 437 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Identical($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 438 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\NotIdentical($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 439 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Equal($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 440 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\NotEqual($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 441 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Spaceship($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 442 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Smaller($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 443 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\SmallerOrEqual($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 444 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Greater($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 445 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\GreaterOrEqual($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 446 => static function ($self, $stackPos) { + $self->semValue = new Expr\Instanceof_($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 447 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 448 => static function ($self, $stackPos) { + $self->semValue = new Expr\Ternary($self->semStack[$stackPos-(5-1)], $self->semStack[$stackPos-(5-3)], $self->semStack[$stackPos-(5-5)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos])); + }, + 449 => static function ($self, $stackPos) { + $self->semValue = new Expr\Ternary($self->semStack[$stackPos-(4-1)], null, $self->semStack[$stackPos-(4-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 450 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Coalesce($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 451 => static function ($self, $stackPos) { + $self->semValue = new Expr\Isset_($self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 452 => static function ($self, $stackPos) { + $self->semValue = new Expr\Empty_($self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 453 => static function ($self, $stackPos) { + $self->semValue = new Expr\Include_($self->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE, $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 454 => static function ($self, $stackPos) { + $self->semValue = new Expr\Include_($self->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE_ONCE, $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 455 => static function ($self, $stackPos) { + $self->semValue = new Expr\Eval_($self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 456 => static function ($self, $stackPos) { + $self->semValue = new Expr\Include_($self->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE, $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 457 => static function ($self, $stackPos) { + $self->semValue = new Expr\Include_($self->semStack[$stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE_ONCE, $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 458 => static function ($self, $stackPos) { + $self->semValue = new Expr\Cast\Int_($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 459 => static function ($self, $stackPos) { + $attrs = $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos]); + $attrs['kind'] = $self->getFloatCastKind($self->semStack[$stackPos-(2-1)]); + $self->semValue = new Expr\Cast\Double($self->semStack[$stackPos-(2-2)], $attrs); + }, + 460 => static function ($self, $stackPos) { + $self->semValue = new Expr\Cast\String_($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 461 => static function ($self, $stackPos) { + $self->semValue = new Expr\Cast\Array_($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 462 => static function ($self, $stackPos) { + $self->semValue = new Expr\Cast\Object_($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 463 => static function ($self, $stackPos) { + $self->semValue = new Expr\Cast\Bool_($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 464 => static function ($self, $stackPos) { + $self->semValue = new Expr\Cast\Unset_($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 465 => static function ($self, $stackPos) { + $attrs = $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos]); + $attrs['kind'] = strtolower($self->semStack[$stackPos-(2-1)]) === 'exit' ? Expr\Exit_::KIND_EXIT : Expr\Exit_::KIND_DIE; + $self->semValue = new Expr\Exit_($self->semStack[$stackPos-(2-2)], $attrs); + }, + 466 => static function ($self, $stackPos) { + $self->semValue = new Expr\ErrorSuppress($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 467 => null, + 468 => static function ($self, $stackPos) { + $self->semValue = new Expr\ShellExec($self->semStack[$stackPos-(3-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 469 => static function ($self, $stackPos) { + $self->semValue = new Expr\Print_($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 470 => static function ($self, $stackPos) { + $self->semValue = new Expr\Yield_(null, null, $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 471 => static function ($self, $stackPos) { + $self->semValue = new Expr\Yield_($self->semStack[$stackPos-(2-2)], null, $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 472 => static function ($self, $stackPos) { + $self->semValue = new Expr\Yield_($self->semStack[$stackPos-(4-4)], $self->semStack[$stackPos-(4-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 473 => static function ($self, $stackPos) { + $self->semValue = new Expr\YieldFrom($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 474 => static function ($self, $stackPos) { + $self->semValue = new Expr\Throw_($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 475 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrowFunction(['static' => false, 'byRef' => $self->semStack[$stackPos-(8-2)], 'params' => $self->semStack[$stackPos-(8-4)], 'returnType' => $self->semStack[$stackPos-(8-6)], 'expr' => $self->semStack[$stackPos-(8-8)], 'attrGroups' => []], $self->getAttributes($self->tokenStartStack[$stackPos-(8-1)], $self->tokenEndStack[$stackPos])); + }, + 476 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrowFunction(['static' => true, 'byRef' => $self->semStack[$stackPos-(9-3)], 'params' => $self->semStack[$stackPos-(9-5)], 'returnType' => $self->semStack[$stackPos-(9-7)], 'expr' => $self->semStack[$stackPos-(9-9)], 'attrGroups' => []], $self->getAttributes($self->tokenStartStack[$stackPos-(9-1)], $self->tokenEndStack[$stackPos])); + }, + 477 => static function ($self, $stackPos) { + $self->semValue = new Expr\Closure(['static' => false, 'byRef' => $self->semStack[$stackPos-(8-2)], 'params' => $self->semStack[$stackPos-(8-4)], 'uses' => $self->semStack[$stackPos-(8-6)], 'returnType' => $self->semStack[$stackPos-(8-7)], 'stmts' => $self->semStack[$stackPos-(8-8)], 'attrGroups' => []], $self->getAttributes($self->tokenStartStack[$stackPos-(8-1)], $self->tokenEndStack[$stackPos])); + }, + 478 => static function ($self, $stackPos) { + $self->semValue = new Expr\Closure(['static' => true, 'byRef' => $self->semStack[$stackPos-(9-3)], 'params' => $self->semStack[$stackPos-(9-5)], 'uses' => $self->semStack[$stackPos-(9-7)], 'returnType' => $self->semStack[$stackPos-(9-8)], 'stmts' => $self->semStack[$stackPos-(9-9)], 'attrGroups' => []], $self->getAttributes($self->tokenStartStack[$stackPos-(9-1)], $self->tokenEndStack[$stackPos])); + }, + 479 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrowFunction(['static' => false, 'byRef' => $self->semStack[$stackPos-(9-3)], 'params' => $self->semStack[$stackPos-(9-5)], 'returnType' => $self->semStack[$stackPos-(9-7)], 'expr' => $self->semStack[$stackPos-(9-9)], 'attrGroups' => $self->semStack[$stackPos-(9-1)]], $self->getAttributes($self->tokenStartStack[$stackPos-(9-1)], $self->tokenEndStack[$stackPos])); + }, + 480 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrowFunction(['static' => true, 'byRef' => $self->semStack[$stackPos-(10-4)], 'params' => $self->semStack[$stackPos-(10-6)], 'returnType' => $self->semStack[$stackPos-(10-8)], 'expr' => $self->semStack[$stackPos-(10-10)], 'attrGroups' => $self->semStack[$stackPos-(10-1)]], $self->getAttributes($self->tokenStartStack[$stackPos-(10-1)], $self->tokenEndStack[$stackPos])); + }, + 481 => static function ($self, $stackPos) { + $self->semValue = new Expr\Closure(['static' => false, 'byRef' => $self->semStack[$stackPos-(9-3)], 'params' => $self->semStack[$stackPos-(9-5)], 'uses' => $self->semStack[$stackPos-(9-7)], 'returnType' => $self->semStack[$stackPos-(9-8)], 'stmts' => $self->semStack[$stackPos-(9-9)], 'attrGroups' => $self->semStack[$stackPos-(9-1)]], $self->getAttributes($self->tokenStartStack[$stackPos-(9-1)], $self->tokenEndStack[$stackPos])); + }, + 482 => static function ($self, $stackPos) { + $self->semValue = new Expr\Closure(['static' => true, 'byRef' => $self->semStack[$stackPos-(10-4)], 'params' => $self->semStack[$stackPos-(10-6)], 'uses' => $self->semStack[$stackPos-(10-8)], 'returnType' => $self->semStack[$stackPos-(10-9)], 'stmts' => $self->semStack[$stackPos-(10-10)], 'attrGroups' => $self->semStack[$stackPos-(10-1)]], $self->getAttributes($self->tokenStartStack[$stackPos-(10-1)], $self->tokenEndStack[$stackPos])); + }, + 483 => static function ($self, $stackPos) { + $self->semValue = array(new Stmt\Class_(null, ['type' => $self->semStack[$stackPos-(8-2)], 'extends' => $self->semStack[$stackPos-(8-4)], 'implements' => $self->semStack[$stackPos-(8-5)], 'stmts' => $self->semStack[$stackPos-(8-7)], 'attrGroups' => $self->semStack[$stackPos-(8-1)]], $self->getAttributes($self->tokenStartStack[$stackPos-(8-1)], $self->tokenEndStack[$stackPos])), $self->semStack[$stackPos-(8-3)]); + $self->checkClass($self->semValue[0], -1); + }, + 484 => static function ($self, $stackPos) { + $self->semValue = new Expr\New_($self->semStack[$stackPos-(3-2)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 485 => static function ($self, $stackPos) { + list($class, $ctorArgs) = $self->semStack[$stackPos-(2-2)]; $self->semValue = new Expr\New_($class, $ctorArgs, $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 486 => static function ($self, $stackPos) { + $self->semValue = new Expr\New_($self->semStack[$stackPos-(2-2)], [], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 487 => null, + 488 => null, + 489 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 490 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(4-3)]; + }, + 491 => null, + 492 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 493 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 494 => static function ($self, $stackPos) { + $self->semValue = new Node\ClosureUse($self->semStack[$stackPos-(2-2)], $self->semStack[$stackPos-(2-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 495 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 496 => static function ($self, $stackPos) { + $self->semValue = new Expr\FuncCall($self->semStack[$stackPos-(2-1)], $self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 497 => static function ($self, $stackPos) { + $self->semValue = new Expr\FuncCall($self->semStack[$stackPos-(2-1)], $self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 498 => static function ($self, $stackPos) { + $self->semValue = new Expr\FuncCall($self->semStack[$stackPos-(2-1)], $self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 499 => static function ($self, $stackPos) { + $self->semValue = new Expr\StaticCall($self->semStack[$stackPos-(4-1)], $self->semStack[$stackPos-(4-3)], $self->semStack[$stackPos-(4-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 500 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 501 => null, + 502 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 503 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 504 => static function ($self, $stackPos) { + $self->semValue = new Name\FullyQualified(substr($self->semStack[$stackPos-(1-1)], 1), $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 505 => static function ($self, $stackPos) { + $self->semValue = new Name\Relative(substr($self->semStack[$stackPos-(1-1)], 10), $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 506 => null, + 507 => null, + 508 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 509 => static function ($self, $stackPos) { + $self->semValue = new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); $self->errorState = 2; + }, + 510 => null, + 511 => null, + 512 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 513 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 514 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 515 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); foreach ($self->semValue as $s) { if ($s instanceof Node\InterpolatedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', $self->phpVersion->supportsUnicodeEscapes()); } }; + }, + 516 => static function ($self, $stackPos) { + foreach ($self->semStack[$stackPos-(1-1)] as $s) { if ($s instanceof Node\InterpolatedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', $self->phpVersion->supportsUnicodeEscapes()); } }; $self->semValue = $self->semStack[$stackPos-(1-1)]; + }, + 517 => static function ($self, $stackPos) { + $self->semValue = array(); + }, + 518 => null, + 519 => static function ($self, $stackPos) { + $self->semValue = new Expr\ConstFetch($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 520 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Line($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 521 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\File($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 522 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Dir($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 523 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Class_($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 524 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Trait_($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 525 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Method($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 526 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Function_($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 527 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Namespace_($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 528 => static function ($self, $stackPos) { + $self->semValue = new Expr\ClassConstFetch($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 529 => static function ($self, $stackPos) { + $self->semValue = new Expr\ClassConstFetch($self->semStack[$stackPos-(5-1)], $self->semStack[$stackPos-(5-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(5-1)], $self->tokenEndStack[$stackPos])); + }, + 530 => static function ($self, $stackPos) { + $self->semValue = new Expr\ClassConstFetch($self->semStack[$stackPos-(3-1)], new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos-(3-3)], $self->tokenEndStack[$stackPos-(3-3)])), $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); $self->errorState = 2; + }, + 531 => static function ($self, $stackPos) { + $attrs = $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos]); $attrs['kind'] = Expr\Array_::KIND_SHORT; + $self->semValue = new Expr\Array_($self->semStack[$stackPos-(3-2)], $attrs); + }, + 532 => static function ($self, $stackPos) { + $attrs = $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos]); $attrs['kind'] = Expr\Array_::KIND_LONG; + $self->semValue = new Expr\Array_($self->semStack[$stackPos-(4-3)], $attrs); + $self->createdArrays->attach($self->semValue); + }, + 533 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(1-1)]; $self->createdArrays->attach($self->semValue); + }, + 534 => static function ($self, $stackPos) { + $self->semValue = Scalar\String_::fromString($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos]), $self->phpVersion->supportsUnicodeEscapes()); + }, + 535 => static function ($self, $stackPos) { + $attrs = $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos]); $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED; + foreach ($self->semStack[$stackPos-(3-2)] as $s) { if ($s instanceof Node\InterpolatedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '"', $self->phpVersion->supportsUnicodeEscapes()); } }; $self->semValue = new Scalar\InterpolatedString($self->semStack[$stackPos-(3-2)], $attrs); + }, + 536 => static function ($self, $stackPos) { + $self->semValue = $self->parseLNumber($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos]), $self->phpVersion->allowsInvalidOctals()); + }, + 537 => static function ($self, $stackPos) { + $self->semValue = Scalar\Float_::fromString($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 538 => null, + 539 => null, + 540 => null, + 541 => static function ($self, $stackPos) { + $self->semValue = $self->parseDocString($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-2)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos]), $self->getAttributes($self->tokenStartStack[$stackPos-(3-3)], $self->tokenEndStack[$stackPos-(3-3)]), true); + }, + 542 => static function ($self, $stackPos) { + $self->semValue = $self->parseDocString($self->semStack[$stackPos-(2-1)], '', $self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos]), $self->getAttributes($self->tokenStartStack[$stackPos-(2-2)], $self->tokenEndStack[$stackPos-(2-2)]), true); + }, + 543 => static function ($self, $stackPos) { + $self->semValue = $self->parseDocString($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-2)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos]), $self->getAttributes($self->tokenStartStack[$stackPos-(3-3)], $self->tokenEndStack[$stackPos-(3-3)]), true); + }, + 544 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 545 => null, + 546 => null, + 547 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 548 => null, + 549 => null, + 550 => null, + 551 => null, + 552 => null, + 553 => null, + 554 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 555 => null, + 556 => null, + 557 => null, + 558 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrayDimFetch($self->semStack[$stackPos-(4-1)], $self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 559 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrayDimFetch($self->semStack[$stackPos-(4-1)], $self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 560 => null, + 561 => static function ($self, $stackPos) { + $self->semValue = new Expr\MethodCall($self->semStack[$stackPos-(4-1)], $self->semStack[$stackPos-(4-3)], $self->semStack[$stackPos-(4-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 562 => static function ($self, $stackPos) { + $self->semValue = new Expr\NullsafeMethodCall($self->semStack[$stackPos-(4-1)], $self->semStack[$stackPos-(4-3)], $self->semStack[$stackPos-(4-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 563 => static function ($self, $stackPos) { + $self->semValue = null; + }, + 564 => null, + 565 => null, + 566 => null, + 567 => static function ($self, $stackPos) { + $self->semValue = new Expr\PropertyFetch($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 568 => static function ($self, $stackPos) { + $self->semValue = new Expr\NullsafePropertyFetch($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 569 => null, + 570 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable($self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 571 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable($self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 572 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable(new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])), $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); $self->errorState = 2; + }, + 573 => static function ($self, $stackPos) { + $var = $self->semStack[$stackPos-(1-1)]->name; $self->semValue = \is_string($var) ? new Node\VarLikeIdentifier($var, $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])) : $var; + }, + 574 => static function ($self, $stackPos) { + $self->semValue = new Expr\StaticPropertyFetch($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 575 => null, + 576 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrayDimFetch($self->semStack[$stackPos-(4-1)], $self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 577 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrayDimFetch($self->semStack[$stackPos-(4-1)], $self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 578 => static function ($self, $stackPos) { + $self->semValue = new Expr\PropertyFetch($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 579 => static function ($self, $stackPos) { + $self->semValue = new Expr\NullsafePropertyFetch($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 580 => static function ($self, $stackPos) { + $self->semValue = new Expr\StaticPropertyFetch($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 581 => static function ($self, $stackPos) { + $self->semValue = new Expr\StaticPropertyFetch($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 582 => null, + 583 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 584 => null, + 585 => null, + 586 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 587 => null, + 588 => static function ($self, $stackPos) { + $self->semValue = new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); $self->errorState = 2; + }, + 589 => static function ($self, $stackPos) { + $self->semValue = new Expr\List_($self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); $self->semValue->setAttribute('kind', Expr\List_::KIND_LIST); + $self->postprocessList($self->semValue); + }, + 590 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(1-1)]; $end = count($self->semValue)-1; if ($self->semValue[$end]->value instanceof Expr\Error) array_pop($self->semValue); + }, + 591 => null, + 592 => static function ($self, $stackPos) { + /* do nothing -- prevent default action of $$=$self->semStack[$1]. See $551. */ + }, + 593 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(3-1)][] = $self->semStack[$stackPos-(3-3)]; $self->semValue = $self->semStack[$stackPos-(3-1)]; + }, + 594 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 595 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos-(1-1)], null, false, $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 596 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos-(2-2)], null, true, $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 597 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos-(1-1)], null, false, $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 598 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos-(3-3)], $self->semStack[$stackPos-(3-1)], false, $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 599 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos-(4-4)], $self->semStack[$stackPos-(4-1)], true, $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 600 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos-(3-3)], $self->semStack[$stackPos-(3-1)], false, $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 601 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos-(2-2)], null, false, $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos]), true); + }, + 602 => static function ($self, $stackPos) { + /* Create an Error node now to remember the position. We'll later either report an error, + or convert this into a null element, depending on whether this is a creation or destructuring context. */ + $attrs = $self->createEmptyElemAttributes($self->tokenPos); + $self->semValue = new Node\ArrayItem(new Expr\Error($attrs), null, false, $attrs); + }, + 603 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(2-1)][] = $self->semStack[$stackPos-(2-2)]; $self->semValue = $self->semStack[$stackPos-(2-1)]; + }, + 604 => static function ($self, $stackPos) { + $self->semStack[$stackPos-(2-1)][] = $self->semStack[$stackPos-(2-2)]; $self->semValue = $self->semStack[$stackPos-(2-1)]; + }, + 605 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(1-1)]); + }, + 606 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos-(2-1)], $self->semStack[$stackPos-(2-2)]); + }, + 607 => static function ($self, $stackPos) { + $attrs = $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos]); $attrs['rawValue'] = $self->semStack[$stackPos-(1-1)]; $self->semValue = new Node\InterpolatedStringPart($self->semStack[$stackPos-(1-1)], $attrs); + }, + 608 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 609 => null, + 610 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrayDimFetch($self->semStack[$stackPos-(4-1)], $self->semStack[$stackPos-(4-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(4-1)], $self->tokenEndStack[$stackPos])); + }, + 611 => static function ($self, $stackPos) { + $self->semValue = new Expr\PropertyFetch($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 612 => static function ($self, $stackPos) { + $self->semValue = new Expr\NullsafePropertyFetch($self->semStack[$stackPos-(3-1)], $self->semStack[$stackPos-(3-3)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 613 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable($self->semStack[$stackPos-(3-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 614 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable($self->semStack[$stackPos-(3-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(3-1)], $self->tokenEndStack[$stackPos])); + }, + 615 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrayDimFetch($self->semStack[$stackPos-(6-2)], $self->semStack[$stackPos-(6-4)], $self->getAttributes($self->tokenStartStack[$stackPos-(6-1)], $self->tokenEndStack[$stackPos])); + }, + 616 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos-(3-2)]; + }, + 617 => static function ($self, $stackPos) { + $self->semValue = new Scalar\String_($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 618 => static function ($self, $stackPos) { + $self->semValue = $self->parseNumString($self->semStack[$stackPos-(1-1)], $self->getAttributes($self->tokenStartStack[$stackPos-(1-1)], $self->tokenEndStack[$stackPos])); + }, + 619 => static function ($self, $stackPos) { + $self->semValue = $self->parseNumString('-' . $self->semStack[$stackPos-(2-2)], $self->getAttributes($self->tokenStartStack[$stackPos-(2-1)], $self->tokenEndStack[$stackPos])); + }, + 620 => null, + ]; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php b/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php new file mode 100644 index 00000000..42723313 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php @@ -0,0 +1,1241 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +/* + * This parser is based on a skeleton written by Moriyoshi Koizumi, which in + * turn is based on work by Masato Bito. + */ + +use PhpParser\Node\Expr; +use PhpParser\Node\Expr\Array_; +use PhpParser\Node\Expr\Cast\Double; +use PhpParser\Node\Identifier; +use PhpParser\Node\InterpolatedStringPart; +use PhpParser\Node\Name; +use PhpParser\Node\Param; +use PhpParser\Node\Scalar\InterpolatedString; +use PhpParser\Node\Scalar\Int_; +use PhpParser\Node\Scalar\String_; +use PhpParser\Node\Stmt; +use PhpParser\Node\Stmt\Class_; +use PhpParser\Node\Stmt\ClassConst; +use PhpParser\Node\Stmt\ClassMethod; +use PhpParser\Node\Stmt\Else_; +use PhpParser\Node\Stmt\ElseIf_; +use PhpParser\Node\Stmt\Enum_; +use PhpParser\Node\Stmt\Interface_; +use PhpParser\Node\Stmt\Namespace_; +use PhpParser\Node\Stmt\Nop; +use PhpParser\Node\Stmt\Property; +use PhpParser\Node\Stmt\TryCatch; +use PhpParser\Node\UseItem; +use PhpParser\NodeVisitor\CommentAnnotatingVisitor; + +abstract class ParserAbstract implements Parser { + private const SYMBOL_NONE = -1; + + /** @var Lexer Lexer that is used when parsing */ + protected Lexer $lexer; + /** @var PhpVersion PHP version to target on a best-effort basis */ + protected PhpVersion $phpVersion; + + /* + * The following members will be filled with generated parsing data: + */ + + /** @var int Size of $tokenToSymbol map */ + protected int $tokenToSymbolMapSize; + /** @var int Size of $action table */ + protected int $actionTableSize; + /** @var int Size of $goto table */ + protected int $gotoTableSize; + + /** @var int Symbol number signifying an invalid token */ + protected int $invalidSymbol; + /** @var int Symbol number of error recovery token */ + protected int $errorSymbol; + /** @var int Action number signifying default action */ + protected int $defaultAction; + /** @var int Rule number signifying that an unexpected token was encountered */ + protected int $unexpectedTokenRule; + + protected int $YY2TBLSTATE; + /** @var int Number of non-leaf states */ + protected int $numNonLeafStates; + + /** @var int[] Map of PHP token IDs to internal symbols */ + protected array $phpTokenToSymbol; + /** @var array<int, bool> Map of PHP token IDs to drop */ + protected array $dropTokens; + /** @var int[] Map of external symbols (static::T_*) to internal symbols */ + protected array $tokenToSymbol; + /** @var string[] Map of symbols to their names */ + protected array $symbolToName; + /** @var array<int, string> Names of the production rules (only necessary for debugging) */ + protected array $productions; + + /** @var int[] Map of states to a displacement into the $action table. The corresponding action for this + * state/symbol pair is $action[$actionBase[$state] + $symbol]. If $actionBase[$state] is 0, the + * action is defaulted, i.e. $actionDefault[$state] should be used instead. */ + protected array $actionBase; + /** @var int[] Table of actions. Indexed according to $actionBase comment. */ + protected array $action; + /** @var int[] Table indexed analogously to $action. If $actionCheck[$actionBase[$state] + $symbol] != $symbol + * then the action is defaulted, i.e. $actionDefault[$state] should be used instead. */ + protected array $actionCheck; + /** @var int[] Map of states to their default action */ + protected array $actionDefault; + /** @var callable[] Semantic action callbacks */ + protected array $reduceCallbacks; + + /** @var int[] Map of non-terminals to a displacement into the $goto table. The corresponding goto state for this + * non-terminal/state pair is $goto[$gotoBase[$nonTerminal] + $state] (unless defaulted) */ + protected array $gotoBase; + /** @var int[] Table of states to goto after reduction. Indexed according to $gotoBase comment. */ + protected array $goto; + /** @var int[] Table indexed analogously to $goto. If $gotoCheck[$gotoBase[$nonTerminal] + $state] != $nonTerminal + * then the goto state is defaulted, i.e. $gotoDefault[$nonTerminal] should be used. */ + protected array $gotoCheck; + /** @var int[] Map of non-terminals to the default state to goto after their reduction */ + protected array $gotoDefault; + + /** @var int[] Map of rules to the non-terminal on their left-hand side, i.e. the non-terminal to use for + * determining the state to goto after reduction. */ + protected array $ruleToNonTerminal; + /** @var int[] Map of rules to the length of their right-hand side, which is the number of elements that have to + * be popped from the stack(s) on reduction. */ + protected array $ruleToLength; + + /* + * The following members are part of the parser state: + */ + + /** @var mixed Temporary value containing the result of last semantic action (reduction) */ + protected $semValue; + /** @var mixed[] Semantic value stack (contains values of tokens and semantic action results) */ + protected array $semStack; + /** @var int[] Token start position stack */ + protected array $tokenStartStack; + /** @var int[] Token end position stack */ + protected array $tokenEndStack; + + /** @var ErrorHandler Error handler */ + protected ErrorHandler $errorHandler; + /** @var int Error state, used to avoid error floods */ + protected int $errorState; + + /** @var \SplObjectStorage<Array_, null>|null Array nodes created during parsing, for postprocessing of empty elements. */ + protected ?\SplObjectStorage $createdArrays; + + /** @var Token[] Tokens for the current parse */ + protected array $tokens; + /** @var int Current position in token array */ + protected int $tokenPos; + + /** + * Initialize $reduceCallbacks map. + */ + abstract protected function initReduceCallbacks(): void; + + /** + * Creates a parser instance. + * + * Options: + * * phpVersion: ?PhpVersion, + * + * @param Lexer $lexer A lexer + * @param PhpVersion $phpVersion PHP version to target, defaults to latest supported. This + * option is best-effort: Even if specified, parsing will generally assume the latest + * supported version and only adjust behavior in minor ways, for example by omitting + * errors in older versions and interpreting type hints as a name or identifier depending + * on version. + */ + public function __construct(Lexer $lexer, ?PhpVersion $phpVersion = null) { + $this->lexer = $lexer; + $this->phpVersion = $phpVersion ?? PhpVersion::getNewestSupported(); + + $this->initReduceCallbacks(); + $this->phpTokenToSymbol = $this->createTokenMap(); + $this->dropTokens = array_fill_keys( + [\T_WHITESPACE, \T_OPEN_TAG, \T_COMMENT, \T_DOC_COMMENT, \T_BAD_CHARACTER], true + ); + } + + /** + * Parses PHP code into a node tree. + * + * If a non-throwing error handler is used, the parser will continue parsing after an error + * occurred and attempt to build a partial AST. + * + * @param string $code The source code to parse + * @param ErrorHandler|null $errorHandler Error handler to use for lexer/parser errors, defaults + * to ErrorHandler\Throwing. + * + * @return Node\Stmt[]|null Array of statements (or null non-throwing error handler is used and + * the parser was unable to recover from an error). + */ + public function parse(string $code, ?ErrorHandler $errorHandler = null): ?array { + $this->errorHandler = $errorHandler ?: new ErrorHandler\Throwing(); + $this->createdArrays = new \SplObjectStorage(); + + $this->tokens = $this->lexer->tokenize($code, $this->errorHandler); + $result = $this->doParse(); + + // Report errors for any empty elements used inside arrays. This is delayed until after the main parse, + // because we don't know a priori whether a given array expression will be used in a destructuring context + // or not. + foreach ($this->createdArrays as $node) { + foreach ($node->items as $item) { + if ($item->value instanceof Expr\Error) { + $this->errorHandler->handleError( + new Error('Cannot use empty array elements in arrays', $item->getAttributes())); + } + } + } + + // Clear out some of the interior state, so we don't hold onto unnecessary + // memory between uses of the parser + $this->tokenStartStack = []; + $this->tokenEndStack = []; + $this->semStack = []; + $this->semValue = null; + $this->createdArrays = null; + + if ($result !== null) { + $traverser = new NodeTraverser(new CommentAnnotatingVisitor($this->tokens)); + $traverser->traverse($result); + } + + return $result; + } + + public function getTokens(): array { + return $this->tokens; + } + + /** @return Stmt[]|null */ + protected function doParse(): ?array { + // We start off with no lookahead-token + $symbol = self::SYMBOL_NONE; + $tokenValue = null; + $this->tokenPos = -1; + + // Keep stack of start and end attributes + $this->tokenStartStack = []; + $this->tokenEndStack = [0]; + + // Start off in the initial state and keep a stack of previous states + $state = 0; + $stateStack = [$state]; + + // Semantic value stack (contains values of tokens and semantic action results) + $this->semStack = []; + + // Current position in the stack(s) + $stackPos = 0; + + $this->errorState = 0; + + for (;;) { + //$this->traceNewState($state, $symbol); + + if ($this->actionBase[$state] === 0) { + $rule = $this->actionDefault[$state]; + } else { + if ($symbol === self::SYMBOL_NONE) { + do { + $token = $this->tokens[++$this->tokenPos]; + $tokenId = $token->id; + } while (isset($this->dropTokens[$tokenId])); + + // Map the lexer token id to the internally used symbols. + $tokenValue = $token->text; + if (!isset($this->phpTokenToSymbol[$tokenId])) { + throw new \RangeException(sprintf( + 'The lexer returned an invalid token (id=%d, value=%s)', + $tokenId, $tokenValue + )); + } + $symbol = $this->phpTokenToSymbol[$tokenId]; + + //$this->traceRead($symbol); + } + + $idx = $this->actionBase[$state] + $symbol; + if ((($idx >= 0 && $idx < $this->actionTableSize && $this->actionCheck[$idx] === $symbol) + || ($state < $this->YY2TBLSTATE + && ($idx = $this->actionBase[$state + $this->numNonLeafStates] + $symbol) >= 0 + && $idx < $this->actionTableSize && $this->actionCheck[$idx] === $symbol)) + && ($action = $this->action[$idx]) !== $this->defaultAction) { + /* + * >= numNonLeafStates: shift and reduce + * > 0: shift + * = 0: accept + * < 0: reduce + * = -YYUNEXPECTED: error + */ + if ($action > 0) { + /* shift */ + //$this->traceShift($symbol); + + ++$stackPos; + $stateStack[$stackPos] = $state = $action; + $this->semStack[$stackPos] = $tokenValue; + $this->tokenStartStack[$stackPos] = $this->tokenPos; + $this->tokenEndStack[$stackPos] = $this->tokenPos; + $symbol = self::SYMBOL_NONE; + + if ($this->errorState) { + --$this->errorState; + } + + if ($action < $this->numNonLeafStates) { + continue; + } + + /* $yyn >= numNonLeafStates means shift-and-reduce */ + $rule = $action - $this->numNonLeafStates; + } else { + $rule = -$action; + } + } else { + $rule = $this->actionDefault[$state]; + } + } + + for (;;) { + if ($rule === 0) { + /* accept */ + //$this->traceAccept(); + return $this->semValue; + } + if ($rule !== $this->unexpectedTokenRule) { + /* reduce */ + //$this->traceReduce($rule); + + $ruleLength = $this->ruleToLength[$rule]; + try { + $callback = $this->reduceCallbacks[$rule]; + if ($callback !== null) { + $callback($this, $stackPos); + } elseif ($ruleLength > 0) { + $this->semValue = $this->semStack[$stackPos - $ruleLength + 1]; + } + } catch (Error $e) { + if (-1 === $e->getStartLine()) { + $e->setStartLine($this->tokens[$this->tokenPos]->line); + } + + $this->emitError($e); + // Can't recover from this type of error + return null; + } + + /* Goto - shift nonterminal */ + $lastTokenEnd = $this->tokenEndStack[$stackPos]; + $stackPos -= $ruleLength; + $nonTerminal = $this->ruleToNonTerminal[$rule]; + $idx = $this->gotoBase[$nonTerminal] + $stateStack[$stackPos]; + if ($idx >= 0 && $idx < $this->gotoTableSize && $this->gotoCheck[$idx] === $nonTerminal) { + $state = $this->goto[$idx]; + } else { + $state = $this->gotoDefault[$nonTerminal]; + } + + ++$stackPos; + $stateStack[$stackPos] = $state; + $this->semStack[$stackPos] = $this->semValue; + $this->tokenEndStack[$stackPos] = $lastTokenEnd; + if ($ruleLength === 0) { + // Empty productions use the start attributes of the lookahead token. + $this->tokenStartStack[$stackPos] = $this->tokenPos; + } + } else { + /* error */ + switch ($this->errorState) { + case 0: + $msg = $this->getErrorMessage($symbol, $state); + $this->emitError(new Error($msg, $this->getAttributesForToken($this->tokenPos))); + // Break missing intentionally + // no break + case 1: + case 2: + $this->errorState = 3; + + // Pop until error-expecting state uncovered + while (!( + (($idx = $this->actionBase[$state] + $this->errorSymbol) >= 0 + && $idx < $this->actionTableSize && $this->actionCheck[$idx] === $this->errorSymbol) + || ($state < $this->YY2TBLSTATE + && ($idx = $this->actionBase[$state + $this->numNonLeafStates] + $this->errorSymbol) >= 0 + && $idx < $this->actionTableSize && $this->actionCheck[$idx] === $this->errorSymbol) + ) || ($action = $this->action[$idx]) === $this->defaultAction) { // Not totally sure about this + if ($stackPos <= 0) { + // Could not recover from error + return null; + } + $state = $stateStack[--$stackPos]; + //$this->tracePop($state); + } + + //$this->traceShift($this->errorSymbol); + ++$stackPos; + $stateStack[$stackPos] = $state = $action; + + // We treat the error symbol as being empty, so we reset the end attributes + // to the end attributes of the last non-error symbol + $this->tokenStartStack[$stackPos] = $this->tokenPos; + $this->tokenEndStack[$stackPos] = $this->tokenEndStack[$stackPos - 1]; + break; + + case 3: + if ($symbol === 0) { + // Reached EOF without recovering from error + return null; + } + + //$this->traceDiscard($symbol); + $symbol = self::SYMBOL_NONE; + break 2; + } + } + + if ($state < $this->numNonLeafStates) { + break; + } + + /* >= numNonLeafStates means shift-and-reduce */ + $rule = $state - $this->numNonLeafStates; + } + } + + throw new \RuntimeException('Reached end of parser loop'); + } + + protected function emitError(Error $error): void { + $this->errorHandler->handleError($error); + } + + /** + * Format error message including expected tokens. + * + * @param int $symbol Unexpected symbol + * @param int $state State at time of error + * + * @return string Formatted error message + */ + protected function getErrorMessage(int $symbol, int $state): string { + $expectedString = ''; + if ($expected = $this->getExpectedTokens($state)) { + $expectedString = ', expecting ' . implode(' or ', $expected); + } + + return 'Syntax error, unexpected ' . $this->symbolToName[$symbol] . $expectedString; + } + + /** + * Get limited number of expected tokens in given state. + * + * @param int $state State + * + * @return string[] Expected tokens. If too many, an empty array is returned. + */ + protected function getExpectedTokens(int $state): array { + $expected = []; + + $base = $this->actionBase[$state]; + foreach ($this->symbolToName as $symbol => $name) { + $idx = $base + $symbol; + if ($idx >= 0 && $idx < $this->actionTableSize && $this->actionCheck[$idx] === $symbol + || $state < $this->YY2TBLSTATE + && ($idx = $this->actionBase[$state + $this->numNonLeafStates] + $symbol) >= 0 + && $idx < $this->actionTableSize && $this->actionCheck[$idx] === $symbol + ) { + if ($this->action[$idx] !== $this->unexpectedTokenRule + && $this->action[$idx] !== $this->defaultAction + && $symbol !== $this->errorSymbol + ) { + if (count($expected) === 4) { + /* Too many expected tokens */ + return []; + } + + $expected[] = $name; + } + } + } + + return $expected; + } + + /** + * Get attributes for a node with the given start and end token positions. + * + * @param int $tokenStartPos Token position the node starts at + * @param int $tokenEndPos Token position the node ends at + * @return array<string, mixed> Attributes + */ + protected function getAttributes(int $tokenStartPos, int $tokenEndPos): array { + $startToken = $this->tokens[$tokenStartPos]; + $afterEndToken = $this->tokens[$tokenEndPos + 1]; + return [ + 'startLine' => $startToken->line, + 'startTokenPos' => $tokenStartPos, + 'startFilePos' => $startToken->pos, + 'endLine' => $afterEndToken->line, + 'endTokenPos' => $tokenEndPos, + 'endFilePos' => $afterEndToken->pos - 1, + ]; + } + + /** + * Get attributes for a single token at the given token position. + * + * @return array<string, mixed> Attributes + */ + protected function getAttributesForToken(int $tokenPos): array { + if ($tokenPos < \count($this->tokens) - 1) { + return $this->getAttributes($tokenPos, $tokenPos); + } + + // Get attributes for the sentinel token. + $token = $this->tokens[$tokenPos]; + return [ + 'startLine' => $token->line, + 'startTokenPos' => $tokenPos, + 'startFilePos' => $token->pos, + 'endLine' => $token->line, + 'endTokenPos' => $tokenPos, + 'endFilePos' => $token->pos, + ]; + } + + /* + * Tracing functions used for debugging the parser. + */ + + /* + protected function traceNewState($state, $symbol): void { + echo '% State ' . $state + . ', Lookahead ' . ($symbol == self::SYMBOL_NONE ? '--none--' : $this->symbolToName[$symbol]) . "\n"; + } + + protected function traceRead($symbol): void { + echo '% Reading ' . $this->symbolToName[$symbol] . "\n"; + } + + protected function traceShift($symbol): void { + echo '% Shift ' . $this->symbolToName[$symbol] . "\n"; + } + + protected function traceAccept(): void { + echo "% Accepted.\n"; + } + + protected function traceReduce($n): void { + echo '% Reduce by (' . $n . ') ' . $this->productions[$n] . "\n"; + } + + protected function tracePop($state): void { + echo '% Recovering, uncovered state ' . $state . "\n"; + } + + protected function traceDiscard($symbol): void { + echo '% Discard ' . $this->symbolToName[$symbol] . "\n"; + } + */ + + /* + * Helper functions invoked by semantic actions + */ + + /** + * Moves statements of semicolon-style namespaces into $ns->stmts and checks various error conditions. + * + * @param Node\Stmt[] $stmts + * @return Node\Stmt[] + */ + protected function handleNamespaces(array $stmts): array { + $hasErrored = false; + $style = $this->getNamespacingStyle($stmts); + if (null === $style) { + // not namespaced, nothing to do + return $stmts; + } + if ('brace' === $style) { + // For braced namespaces we only have to check that there are no invalid statements between the namespaces + $afterFirstNamespace = false; + foreach ($stmts as $stmt) { + if ($stmt instanceof Node\Stmt\Namespace_) { + $afterFirstNamespace = true; + } elseif (!$stmt instanceof Node\Stmt\HaltCompiler + && !$stmt instanceof Node\Stmt\Nop + && $afterFirstNamespace && !$hasErrored) { + $this->emitError(new Error( + 'No code may exist outside of namespace {}', $stmt->getAttributes())); + $hasErrored = true; // Avoid one error for every statement + } + } + return $stmts; + } else { + // For semicolon namespaces we have to move the statements after a namespace declaration into ->stmts + $resultStmts = []; + $targetStmts = &$resultStmts; + $lastNs = null; + foreach ($stmts as $stmt) { + if ($stmt instanceof Node\Stmt\Namespace_) { + if ($lastNs !== null) { + $this->fixupNamespaceAttributes($lastNs); + } + if ($stmt->stmts === null) { + $stmt->stmts = []; + $targetStmts = &$stmt->stmts; + $resultStmts[] = $stmt; + } else { + // This handles the invalid case of mixed style namespaces + $resultStmts[] = $stmt; + $targetStmts = &$resultStmts; + } + $lastNs = $stmt; + } elseif ($stmt instanceof Node\Stmt\HaltCompiler) { + // __halt_compiler() is not moved into the namespace + $resultStmts[] = $stmt; + } else { + $targetStmts[] = $stmt; + } + } + if ($lastNs !== null) { + $this->fixupNamespaceAttributes($lastNs); + } + return $resultStmts; + } + } + + private function fixupNamespaceAttributes(Node\Stmt\Namespace_ $stmt): void { + // We moved the statements into the namespace node, as such the end of the namespace node + // needs to be extended to the end of the statements. + if (empty($stmt->stmts)) { + return; + } + + // We only move the builtin end attributes here. This is the best we can do with the + // knowledge we have. + $endAttributes = ['endLine', 'endFilePos', 'endTokenPos']; + $lastStmt = $stmt->stmts[count($stmt->stmts) - 1]; + foreach ($endAttributes as $endAttribute) { + if ($lastStmt->hasAttribute($endAttribute)) { + $stmt->setAttribute($endAttribute, $lastStmt->getAttribute($endAttribute)); + } + } + } + + /** @return array<string, mixed> */ + private function getNamespaceErrorAttributes(Namespace_ $node): array { + $attrs = $node->getAttributes(); + // Adjust end attributes to only cover the "namespace" keyword, not the whole namespace. + if (isset($attrs['startLine'])) { + $attrs['endLine'] = $attrs['startLine']; + } + if (isset($attrs['startTokenPos'])) { + $attrs['endTokenPos'] = $attrs['startTokenPos']; + } + if (isset($attrs['startFilePos'])) { + $attrs['endFilePos'] = $attrs['startFilePos'] + \strlen('namespace') - 1; + } + return $attrs; + } + + /** + * Determine namespacing style (semicolon or brace) + * + * @param Node[] $stmts Top-level statements. + * + * @return null|string One of "semicolon", "brace" or null (no namespaces) + */ + private function getNamespacingStyle(array $stmts): ?string { + $style = null; + $hasNotAllowedStmts = false; + foreach ($stmts as $i => $stmt) { + if ($stmt instanceof Node\Stmt\Namespace_) { + $currentStyle = null === $stmt->stmts ? 'semicolon' : 'brace'; + if (null === $style) { + $style = $currentStyle; + if ($hasNotAllowedStmts) { + $this->emitError(new Error( + 'Namespace declaration statement has to be the very first statement in the script', + $this->getNamespaceErrorAttributes($stmt) + )); + } + } elseif ($style !== $currentStyle) { + $this->emitError(new Error( + 'Cannot mix bracketed namespace declarations with unbracketed namespace declarations', + $this->getNamespaceErrorAttributes($stmt) + )); + // Treat like semicolon style for namespace normalization + return 'semicolon'; + } + continue; + } + + /* declare(), __halt_compiler() and nops can be used before a namespace declaration */ + if ($stmt instanceof Node\Stmt\Declare_ + || $stmt instanceof Node\Stmt\HaltCompiler + || $stmt instanceof Node\Stmt\Nop) { + continue; + } + + /* There may be a hashbang line at the very start of the file */ + if ($i === 0 && $stmt instanceof Node\Stmt\InlineHTML && preg_match('/\A#!.*\r?\n\z/', $stmt->value)) { + continue; + } + + /* Everything else if forbidden before namespace declarations */ + $hasNotAllowedStmts = true; + } + return $style; + } + + /** @return Name|Identifier */ + protected function handleBuiltinTypes(Name $name) { + if (!$name->isUnqualified()) { + return $name; + } + + $lowerName = $name->toLowerString(); + if (!$this->phpVersion->supportsBuiltinType($lowerName)) { + return $name; + } + + return new Node\Identifier($lowerName, $name->getAttributes()); + } + + /** + * Get combined start and end attributes at a stack location + * + * @param int $stackPos Stack location + * + * @return array<string, mixed> Combined start and end attributes + */ + protected function getAttributesAt(int $stackPos): array { + return $this->getAttributes($this->tokenStartStack[$stackPos], $this->tokenEndStack[$stackPos]); + } + + protected function getFloatCastKind(string $cast): int { + $cast = strtolower($cast); + if (strpos($cast, 'float') !== false) { + return Double::KIND_FLOAT; + } + + if (strpos($cast, 'real') !== false) { + return Double::KIND_REAL; + } + + return Double::KIND_DOUBLE; + } + + /** @param array<string, mixed> $attributes */ + protected function parseLNumber(string $str, array $attributes, bool $allowInvalidOctal = false): Int_ { + try { + return Int_::fromString($str, $attributes, $allowInvalidOctal); + } catch (Error $error) { + $this->emitError($error); + // Use dummy value + return new Int_(0, $attributes); + } + } + + /** + * Parse a T_NUM_STRING token into either an integer or string node. + * + * @param string $str Number string + * @param array<string, mixed> $attributes Attributes + * + * @return Int_|String_ Integer or string node. + */ + protected function parseNumString(string $str, array $attributes) { + if (!preg_match('/^(?:0|-?[1-9][0-9]*)$/', $str)) { + return new String_($str, $attributes); + } + + $num = +$str; + if (!is_int($num)) { + return new String_($str, $attributes); + } + + return new Int_($num, $attributes); + } + + /** @param array<string, mixed> $attributes */ + protected function stripIndentation( + string $string, int $indentLen, string $indentChar, + bool $newlineAtStart, bool $newlineAtEnd, array $attributes + ): string { + if ($indentLen === 0) { + return $string; + } + + $start = $newlineAtStart ? '(?:(?<=\n)|\A)' : '(?<=\n)'; + $end = $newlineAtEnd ? '(?:(?=[\r\n])|\z)' : '(?=[\r\n])'; + $regex = '/' . $start . '([ \t]*)(' . $end . ')?/'; + return preg_replace_callback( + $regex, + function ($matches) use ($indentLen, $indentChar, $attributes) { + $prefix = substr($matches[1], 0, $indentLen); + if (false !== strpos($prefix, $indentChar === " " ? "\t" : " ")) { + $this->emitError(new Error( + 'Invalid indentation - tabs and spaces cannot be mixed', $attributes + )); + } elseif (strlen($prefix) < $indentLen && !isset($matches[2])) { + $this->emitError(new Error( + 'Invalid body indentation level ' . + '(expecting an indentation level of at least ' . $indentLen . ')', + $attributes + )); + } + return substr($matches[0], strlen($prefix)); + }, + $string + ); + } + + /** + * @param string|(Expr|InterpolatedStringPart)[] $contents + * @param array<string, mixed> $attributes + * @param array<string, mixed> $endTokenAttributes + */ + protected function parseDocString( + string $startToken, $contents, string $endToken, + array $attributes, array $endTokenAttributes, bool $parseUnicodeEscape + ): Expr { + $kind = strpos($startToken, "'") === false + ? String_::KIND_HEREDOC : String_::KIND_NOWDOC; + + $regex = '/\A[bB]?<<<[ \t]*[\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\'"]?(?:\r\n|\n|\r)\z/'; + $result = preg_match($regex, $startToken, $matches); + assert($result === 1); + $label = $matches[1]; + + $result = preg_match('/\A[ \t]*/', $endToken, $matches); + assert($result === 1); + $indentation = $matches[0]; + + $attributes['kind'] = $kind; + $attributes['docLabel'] = $label; + $attributes['docIndentation'] = $indentation; + + $indentHasSpaces = false !== strpos($indentation, " "); + $indentHasTabs = false !== strpos($indentation, "\t"); + if ($indentHasSpaces && $indentHasTabs) { + $this->emitError(new Error( + 'Invalid indentation - tabs and spaces cannot be mixed', + $endTokenAttributes + )); + + // Proceed processing as if this doc string is not indented + $indentation = ''; + } + + $indentLen = \strlen($indentation); + $indentChar = $indentHasSpaces ? " " : "\t"; + + if (\is_string($contents)) { + if ($contents === '') { + $attributes['rawValue'] = $contents; + return new String_('', $attributes); + } + + $contents = $this->stripIndentation( + $contents, $indentLen, $indentChar, true, true, $attributes + ); + $contents = preg_replace('~(\r\n|\n|\r)\z~', '', $contents); + $attributes['rawValue'] = $contents; + + if ($kind === String_::KIND_HEREDOC) { + $contents = String_::parseEscapeSequences($contents, null, $parseUnicodeEscape); + } + + return new String_($contents, $attributes); + } else { + assert(count($contents) > 0); + if (!$contents[0] instanceof Node\InterpolatedStringPart) { + // If there is no leading encapsed string part, pretend there is an empty one + $this->stripIndentation( + '', $indentLen, $indentChar, true, false, $contents[0]->getAttributes() + ); + } + + $newContents = []; + foreach ($contents as $i => $part) { + if ($part instanceof Node\InterpolatedStringPart) { + $isLast = $i === \count($contents) - 1; + $part->value = $this->stripIndentation( + $part->value, $indentLen, $indentChar, + $i === 0, $isLast, $part->getAttributes() + ); + if ($isLast) { + $part->value = preg_replace('~(\r\n|\n|\r)\z~', '', $part->value); + } + $part->setAttribute('rawValue', $part->value); + $part->value = String_::parseEscapeSequences($part->value, null, $parseUnicodeEscape); + if ('' === $part->value) { + continue; + } + } + $newContents[] = $part; + } + return new InterpolatedString($newContents, $attributes); + } + } + + protected function createCommentFromToken(Token $token, int $tokenPos): Comment { + assert($token->id === \T_COMMENT || $token->id == \T_DOC_COMMENT); + return \T_DOC_COMMENT === $token->id + ? new Comment\Doc($token->text, $token->line, $token->pos, $tokenPos, + $token->getEndLine(), $token->getEndPos() - 1, $tokenPos) + : new Comment($token->text, $token->line, $token->pos, $tokenPos, + $token->getEndLine(), $token->getEndPos() - 1, $tokenPos); + } + + /** + * Get last comment before the given token position, if any + */ + protected function getCommentBeforeToken(int $tokenPos): ?Comment { + while (--$tokenPos >= 0) { + $token = $this->tokens[$tokenPos]; + if (!isset($this->dropTokens[$token->id])) { + break; + } + + if ($token->id === \T_COMMENT || $token->id === \T_DOC_COMMENT) { + return $this->createCommentFromToken($token, $tokenPos); + } + } + return null; + } + + /** + * Create a zero-length nop to capture preceding comments, if any. + */ + protected function maybeCreateZeroLengthNop(int $tokenPos): ?Nop { + $comment = $this->getCommentBeforeToken($tokenPos); + if ($comment === null) { + return null; + } + + $commentEndLine = $comment->getEndLine(); + $commentEndFilePos = $comment->getEndFilePos(); + $commentEndTokenPos = $comment->getEndTokenPos(); + $attributes = [ + 'startLine' => $commentEndLine, + 'endLine' => $commentEndLine, + 'startFilePos' => $commentEndFilePos + 1, + 'endFilePos' => $commentEndFilePos, + 'startTokenPos' => $commentEndTokenPos + 1, + 'endTokenPos' => $commentEndTokenPos, + ]; + return new Nop($attributes); + } + + protected function maybeCreateNop(int $tokenStartPos, int $tokenEndPos): ?Nop { + if ($this->getCommentBeforeToken($tokenStartPos) === null) { + return null; + } + return new Nop($this->getAttributes($tokenStartPos, $tokenEndPos)); + } + + protected function handleHaltCompiler(): string { + // Prevent the lexer from returning any further tokens. + $nextToken = $this->tokens[$this->tokenPos + 1]; + $this->tokenPos = \count($this->tokens) - 2; + + // Return text after __halt_compiler. + return $nextToken->id === \T_INLINE_HTML ? $nextToken->text : ''; + } + + protected function inlineHtmlHasLeadingNewline(int $stackPos): bool { + $tokenPos = $this->tokenStartStack[$stackPos]; + $token = $this->tokens[$tokenPos]; + assert($token->id == \T_INLINE_HTML); + if ($tokenPos > 0) { + $prevToken = $this->tokens[$tokenPos - 1]; + assert($prevToken->id == \T_CLOSE_TAG); + return false !== strpos($prevToken->text, "\n") + || false !== strpos($prevToken->text, "\r"); + } + return true; + } + + /** + * @return array<string, mixed> + */ + protected function createEmptyElemAttributes(int $tokenPos): array { + return $this->getAttributesForToken($tokenPos); + } + + protected function fixupArrayDestructuring(Array_ $node): Expr\List_ { + $this->createdArrays->detach($node); + return new Expr\List_(array_map(function (Node\ArrayItem $item) { + if ($item->value instanceof Expr\Error) { + // We used Error as a placeholder for empty elements, which are legal for destructuring. + return null; + } + if ($item->value instanceof Array_) { + return new Node\ArrayItem( + $this->fixupArrayDestructuring($item->value), + $item->key, $item->byRef, $item->getAttributes()); + } + return $item; + }, $node->items), ['kind' => Expr\List_::KIND_ARRAY] + $node->getAttributes()); + } + + protected function postprocessList(Expr\List_ $node): void { + foreach ($node->items as $i => $item) { + if ($item->value instanceof Expr\Error) { + // We used Error as a placeholder for empty elements, which are legal for destructuring. + $node->items[$i] = null; + } + } + } + + /** @param ElseIf_|Else_ $node */ + protected function fixupAlternativeElse($node): void { + // Make sure a trailing nop statement carrying comments is part of the node. + $numStmts = \count($node->stmts); + if ($numStmts !== 0 && $node->stmts[$numStmts - 1] instanceof Nop) { + $nopAttrs = $node->stmts[$numStmts - 1]->getAttributes(); + if (isset($nopAttrs['endLine'])) { + $node->setAttribute('endLine', $nopAttrs['endLine']); + } + if (isset($nopAttrs['endFilePos'])) { + $node->setAttribute('endFilePos', $nopAttrs['endFilePos']); + } + if (isset($nopAttrs['endTokenPos'])) { + $node->setAttribute('endTokenPos', $nopAttrs['endTokenPos']); + } + } + } + + protected function checkClassModifier(int $a, int $b, int $modifierPos): void { + try { + Modifiers::verifyClassModifier($a, $b); + } catch (Error $error) { + $error->setAttributes($this->getAttributesAt($modifierPos)); + $this->emitError($error); + } + } + + protected function checkModifier(int $a, int $b, int $modifierPos): void { + // Jumping through some hoops here because verifyModifier() is also used elsewhere + try { + Modifiers::verifyModifier($a, $b); + } catch (Error $error) { + $error->setAttributes($this->getAttributesAt($modifierPos)); + $this->emitError($error); + } + } + + protected function checkParam(Param $node): void { + if ($node->variadic && null !== $node->default) { + $this->emitError(new Error( + 'Variadic parameter cannot have a default value', + $node->default->getAttributes() + )); + } + } + + protected function checkTryCatch(TryCatch $node): void { + if (empty($node->catches) && null === $node->finally) { + $this->emitError(new Error( + 'Cannot use try without catch or finally', $node->getAttributes() + )); + } + } + + protected function checkNamespace(Namespace_ $node): void { + if (null !== $node->stmts) { + foreach ($node->stmts as $stmt) { + if ($stmt instanceof Namespace_) { + $this->emitError(new Error( + 'Namespace declarations cannot be nested', $stmt->getAttributes() + )); + } + } + } + } + + private function checkClassName(?Identifier $name, int $namePos): void { + if (null !== $name && $name->isSpecialClassName()) { + $this->emitError(new Error( + sprintf('Cannot use \'%s\' as class name as it is reserved', $name), + $this->getAttributesAt($namePos) + )); + } + } + + /** @param Name[] $interfaces */ + private function checkImplementedInterfaces(array $interfaces): void { + foreach ($interfaces as $interface) { + if ($interface->isSpecialClassName()) { + $this->emitError(new Error( + sprintf('Cannot use \'%s\' as interface name as it is reserved', $interface), + $interface->getAttributes() + )); + } + } + } + + protected function checkClass(Class_ $node, int $namePos): void { + $this->checkClassName($node->name, $namePos); + + if ($node->extends && $node->extends->isSpecialClassName()) { + $this->emitError(new Error( + sprintf('Cannot use \'%s\' as class name as it is reserved', $node->extends), + $node->extends->getAttributes() + )); + } + + $this->checkImplementedInterfaces($node->implements); + } + + protected function checkInterface(Interface_ $node, int $namePos): void { + $this->checkClassName($node->name, $namePos); + $this->checkImplementedInterfaces($node->extends); + } + + protected function checkEnum(Enum_ $node, int $namePos): void { + $this->checkClassName($node->name, $namePos); + $this->checkImplementedInterfaces($node->implements); + } + + protected function checkClassMethod(ClassMethod $node, int $modifierPos): void { + if ($node->flags & Modifiers::STATIC) { + switch ($node->name->toLowerString()) { + case '__construct': + $this->emitError(new Error( + sprintf('Constructor %s() cannot be static', $node->name), + $this->getAttributesAt($modifierPos))); + break; + case '__destruct': + $this->emitError(new Error( + sprintf('Destructor %s() cannot be static', $node->name), + $this->getAttributesAt($modifierPos))); + break; + case '__clone': + $this->emitError(new Error( + sprintf('Clone method %s() cannot be static', $node->name), + $this->getAttributesAt($modifierPos))); + break; + } + } + + if ($node->flags & Modifiers::READONLY) { + $this->emitError(new Error( + sprintf('Method %s() cannot be readonly', $node->name), + $this->getAttributesAt($modifierPos))); + } + } + + protected function checkClassConst(ClassConst $node, int $modifierPos): void { + if ($node->flags & Modifiers::STATIC) { + $this->emitError(new Error( + "Cannot use 'static' as constant modifier", + $this->getAttributesAt($modifierPos))); + } + if ($node->flags & Modifiers::ABSTRACT) { + $this->emitError(new Error( + "Cannot use 'abstract' as constant modifier", + $this->getAttributesAt($modifierPos))); + } + if ($node->flags & Modifiers::READONLY) { + $this->emitError(new Error( + "Cannot use 'readonly' as constant modifier", + $this->getAttributesAt($modifierPos))); + } + } + + protected function checkProperty(Property $node, int $modifierPos): void { + if ($node->flags & Modifiers::ABSTRACT) { + $this->emitError(new Error('Properties cannot be declared abstract', + $this->getAttributesAt($modifierPos))); + } + + if ($node->flags & Modifiers::FINAL) { + $this->emitError(new Error('Properties cannot be declared final', + $this->getAttributesAt($modifierPos))); + } + } + + protected function checkUseUse(UseItem $node, int $namePos): void { + if ($node->alias && $node->alias->isSpecialClassName()) { + $this->emitError(new Error( + sprintf( + 'Cannot use %s as %s because \'%2$s\' is a special class name', + $node->name, $node->alias + ), + $this->getAttributesAt($namePos) + )); + } + } + + /** + * Creates the token map. + * + * The token map maps the PHP internal token identifiers + * to the identifiers used by the Parser. Additionally it + * maps T_OPEN_TAG_WITH_ECHO to T_ECHO and T_CLOSE_TAG to ';'. + * + * @return array<int, int> The token map + */ + protected function createTokenMap(): array { + $tokenMap = []; + + for ($i = 0; $i < 1000; ++$i) { + if ($i < 256) { + // Single-char tokens use an identity mapping. + $tokenMap[$i] = $i; + } elseif (\T_DOUBLE_COLON === $i) { + // T_DOUBLE_COLON is equivalent to T_PAAMAYIM_NEKUDOTAYIM + $tokenMap[$i] = static::T_PAAMAYIM_NEKUDOTAYIM; + } elseif (\T_OPEN_TAG_WITH_ECHO === $i) { + // T_OPEN_TAG_WITH_ECHO with dropped T_OPEN_TAG results in T_ECHO + $tokenMap[$i] = static::T_ECHO; + } elseif (\T_CLOSE_TAG === $i) { + // T_CLOSE_TAG is equivalent to ';' + $tokenMap[$i] = ord(';'); + } elseif ('UNKNOWN' !== $name = token_name($i)) { + if (defined($name = static::class . '::' . $name)) { + // Other tokens can be mapped directly + $tokenMap[$i] = constant($name); + } + } + } + + // Assign tokens for which we define compatibility constants, as token_name() does not know them. + $tokenMap[\T_FN] = static::T_FN; + $tokenMap[\T_COALESCE_EQUAL] = static::T_COALESCE_EQUAL; + $tokenMap[\T_NAME_QUALIFIED] = static::T_NAME_QUALIFIED; + $tokenMap[\T_NAME_FULLY_QUALIFIED] = static::T_NAME_FULLY_QUALIFIED; + $tokenMap[\T_NAME_RELATIVE] = static::T_NAME_RELATIVE; + $tokenMap[\T_MATCH] = static::T_MATCH; + $tokenMap[\T_NULLSAFE_OBJECT_OPERATOR] = static::T_NULLSAFE_OBJECT_OPERATOR; + $tokenMap[\T_ATTRIBUTE] = static::T_ATTRIBUTE; + $tokenMap[\T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG] = static::T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG; + $tokenMap[\T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG] = static::T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG; + $tokenMap[\T_ENUM] = static::T_ENUM; + $tokenMap[\T_READONLY] = static::T_READONLY; + + // We have create a map from PHP token IDs to external symbol IDs. + // Now map them to the internal symbol ID. + $fullTokenMap = []; + foreach ($tokenMap as $phpToken => $extSymbol) { + $intSymbol = $this->tokenToSymbol[$extSymbol]; + if ($intSymbol === $this->invalidSymbol) { + continue; + } + $fullTokenMap[$phpToken] = $intSymbol; + } + + return $fullTokenMap; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/ParserFactory.php b/vendor/nikic/php-parser/lib/PhpParser/ParserFactory.php new file mode 100644 index 00000000..3a7586ea --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/ParserFactory.php @@ -0,0 +1,42 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +use PhpParser\Parser\Php7; +use PhpParser\Parser\Php8; + +class ParserFactory { + /** + * Create a parser targeting the given version on a best-effort basis. The parser will generally + * accept code for the newest supported version, but will try to accommodate code that becomes + * invalid in newer versions or changes in interpretation. + */ + public function createForVersion(PhpVersion $version): Parser { + if ($version->isHostVersion()) { + $lexer = new Lexer(); + } else { + $lexer = new Lexer\Emulative($version); + } + if ($version->id >= 80000) { + return new Php8($lexer, $version); + } + return new Php7($lexer, $version); + } + + /** + * Create a parser targeting the newest version supported by this library. Code for older + * versions will be accepted if there have been no relevant backwards-compatibility breaks in + * PHP. + */ + public function createForNewestSupportedVersion(): Parser { + return $this->createForVersion(PhpVersion::getNewestSupported()); + } + + /** + * Create a parser targeting the host PHP version, that is the PHP version we're currently + * running on. This parser will not use any token emulation. + */ + public function createForHostVersion(): Parser { + return $this->createForVersion(PhpVersion::getHostVersion()); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/PhpVersion.php b/vendor/nikic/php-parser/lib/PhpParser/PhpVersion.php new file mode 100644 index 00000000..db85b1e5 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/PhpVersion.php @@ -0,0 +1,164 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +/** + * A PHP version, representing only the major and minor version components. + */ +class PhpVersion { + /** @var int Version ID in PHP_VERSION_ID format */ + public int $id; + + /** @var int[] Minimum versions for builtin types */ + private const BUILTIN_TYPE_VERSIONS = [ + 'array' => 50100, + 'callable' => 50400, + 'bool' => 70000, + 'int' => 70000, + 'float' => 70000, + 'string' => 70000, + 'iterable' => 70100, + 'void' => 70100, + 'object' => 70200, + 'null' => 80000, + 'false' => 80000, + 'mixed' => 80000, + 'never' => 80100, + 'true' => 80200, + ]; + + private function __construct(int $id) { + $this->id = $id; + } + + /** + * Create a PhpVersion object from major and minor version components. + */ + public static function fromComponents(int $major, int $minor): self { + return new self($major * 10000 + $minor * 100); + } + + /** + * Get the newest PHP version supported by this library. Support for this version may be partial, + * if it is still under development. + */ + public static function getNewestSupported(): self { + return self::fromComponents(8, 3); + } + + /** + * Get the host PHP version, that is the PHP version we're currently running on. + */ + public static function getHostVersion(): self { + return self::fromComponents(\PHP_MAJOR_VERSION, \PHP_MINOR_VERSION); + } + + /** + * Parse the version from a string like "8.1". + */ + public static function fromString(string $version): self { + if (!preg_match('/^(\d+)\.(\d+)/', $version, $matches)) { + throw new \LogicException("Invalid PHP version \"$version\""); + } + return self::fromComponents((int) $matches[1], (int) $matches[2]); + } + + /** + * Check whether two versions are the same. + */ + public function equals(PhpVersion $other): bool { + return $this->id === $other->id; + } + + /** + * Check whether this version is greater than or equal to the argument. + */ + public function newerOrEqual(PhpVersion $other): bool { + return $this->id >= $other->id; + } + + /** + * Check whether this version is older than the argument. + */ + public function older(PhpVersion $other): bool { + return $this->id < $other->id; + } + + /** + * Check whether this is the host PHP version. + */ + public function isHostVersion(): bool { + return $this->equals(self::getHostVersion()); + } + + /** + * Check whether this PHP version supports the given builtin type. Type name must be lowercase. + */ + public function supportsBuiltinType(string $type): bool { + $minVersion = self::BUILTIN_TYPE_VERSIONS[$type] ?? null; + return $minVersion !== null && $this->id >= $minVersion; + } + + /** + * Whether this version supports [] array literals. + */ + public function supportsShortArraySyntax(): bool { + return $this->id >= 50400; + } + + /** + * Whether this version supports [] for destructuring. + */ + public function supportsShortArrayDestructuring(): bool { + return $this->id >= 70100; + } + + /** + * Whether this version supports flexible heredoc/nowdoc. + */ + public function supportsFlexibleHeredoc(): bool { + return $this->id >= 70300; + } + + /** + * Whether this version supports trailing commas in parameter lists. + */ + public function supportsTrailingCommaInParamList(): bool { + return $this->id >= 80000; + } + + /** + * Whether this version allows "$var =& new Obj". + */ + public function allowsAssignNewByReference(): bool { + return $this->id < 70000; + } + + /** + * Whether this version allows invalid octals like "08". + */ + public function allowsInvalidOctals(): bool { + return $this->id < 70000; + } + + /** + * Whether this version allows DEL (\x7f) to occur in identifiers. + */ + public function allowsDelInIdentifiers(): bool { + return $this->id < 70100; + } + + /** + * Whether this version supports yield in expression context without parentheses. + */ + public function supportsYieldWithoutParentheses(): bool { + return $this->id >= 70000; + } + + /** + * Whether this version supports unicode escape sequences in strings. + */ + public function supportsUnicodeEscapes(): bool { + return $this->id >= 70000; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter.php b/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter.php new file mode 100644 index 00000000..892c686e --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter.php @@ -0,0 +1,51 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +use PhpParser\Node\Expr; + +interface PrettyPrinter { + /** + * Pretty prints an array of statements. + * + * @param Node[] $stmts Array of statements + * + * @return string Pretty printed statements + */ + public function prettyPrint(array $stmts): string; + + /** + * Pretty prints an expression. + * + * @param Expr $node Expression node + * + * @return string Pretty printed node + */ + public function prettyPrintExpr(Expr $node): string; + + /** + * Pretty prints a file of statements (includes the opening <?php tag if it is required). + * + * @param Node[] $stmts Array of statements + * + * @return string Pretty printed statements + */ + public function prettyPrintFile(array $stmts): string; + + /** + * Perform a format-preserving pretty print of an AST. + * + * The format preservation is best effort. For some changes to the AST the formatting will not + * be preserved (at least not locally). + * + * In order to use this method a number of prerequisites must be satisfied: + * * The startTokenPos and endTokenPos attributes in the lexer must be enabled. + * * The CloningVisitor must be run on the AST prior to modification. + * * The original tokens must be provided, using the getTokens() method on the lexer. + * + * @param Node[] $stmts Modified AST with links to original AST + * @param Node[] $origStmts Original AST with token offset information + * @param Token[] $origTokens Tokens of the original code + */ + public function printFormatPreserving(array $stmts, array $origStmts, array $origTokens): string; +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php b/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php new file mode 100644 index 00000000..6a0349c7 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php @@ -0,0 +1,1177 @@ +<?php declare(strict_types=1); + +namespace PhpParser\PrettyPrinter; + +use PhpParser\Node; +use PhpParser\Node\Expr; +use PhpParser\Node\Expr\AssignOp; +use PhpParser\Node\Expr\BinaryOp; +use PhpParser\Node\Expr\Cast; +use PhpParser\Node\Name; +use PhpParser\Node\Scalar; +use PhpParser\Node\Scalar\MagicConst; +use PhpParser\Node\Stmt; +use PhpParser\PrettyPrinterAbstract; + +class Standard extends PrettyPrinterAbstract { + // Special nodes + + protected function pParam(Node\Param $node): string { + return $this->pAttrGroups($node->attrGroups, true) + . $this->pModifiers($node->flags) + . ($node->type ? $this->p($node->type) . ' ' : '') + . ($node->byRef ? '&' : '') + . ($node->variadic ? '...' : '') + . $this->p($node->var) + . ($node->default ? ' = ' . $this->p($node->default) : ''); + } + + protected function pArg(Node\Arg $node): string { + return ($node->name ? $node->name->toString() . ': ' : '') + . ($node->byRef ? '&' : '') . ($node->unpack ? '...' : '') + . $this->p($node->value); + } + + protected function pVariadicPlaceholder(Node\VariadicPlaceholder $node): string { + return '...'; + } + + protected function pConst(Node\Const_ $node): string { + return $node->name . ' = ' . $this->p($node->value); + } + + protected function pNullableType(Node\NullableType $node): string { + return '?' . $this->p($node->type); + } + + protected function pUnionType(Node\UnionType $node): string { + $types = []; + foreach ($node->types as $typeNode) { + if ($typeNode instanceof Node\IntersectionType) { + $types[] = '('. $this->p($typeNode) . ')'; + continue; + } + $types[] = $this->p($typeNode); + } + return implode('|', $types); + } + + protected function pIntersectionType(Node\IntersectionType $node): string { + return $this->pImplode($node->types, '&'); + } + + protected function pIdentifier(Node\Identifier $node): string { + return $node->name; + } + + protected function pVarLikeIdentifier(Node\VarLikeIdentifier $node): string { + return '$' . $node->name; + } + + protected function pAttribute(Node\Attribute $node): string { + return $this->p($node->name) + . ($node->args ? '(' . $this->pCommaSeparated($node->args) . ')' : ''); + } + + protected function pAttributeGroup(Node\AttributeGroup $node): string { + return '#[' . $this->pCommaSeparated($node->attrs) . ']'; + } + + // Names + + protected function pName(Name $node): string { + return $node->name; + } + + protected function pName_FullyQualified(Name\FullyQualified $node): string { + return '\\' . $node->name; + } + + protected function pName_Relative(Name\Relative $node): string { + return 'namespace\\' . $node->name; + } + + // Magic Constants + + protected function pScalar_MagicConst_Class(MagicConst\Class_ $node): string { + return '__CLASS__'; + } + + protected function pScalar_MagicConst_Dir(MagicConst\Dir $node): string { + return '__DIR__'; + } + + protected function pScalar_MagicConst_File(MagicConst\File $node): string { + return '__FILE__'; + } + + protected function pScalar_MagicConst_Function(MagicConst\Function_ $node): string { + return '__FUNCTION__'; + } + + protected function pScalar_MagicConst_Line(MagicConst\Line $node): string { + return '__LINE__'; + } + + protected function pScalar_MagicConst_Method(MagicConst\Method $node): string { + return '__METHOD__'; + } + + protected function pScalar_MagicConst_Namespace(MagicConst\Namespace_ $node): string { + return '__NAMESPACE__'; + } + + protected function pScalar_MagicConst_Trait(MagicConst\Trait_ $node): string { + return '__TRAIT__'; + } + + // Scalars + + private function indentString(string $str): string { + return str_replace("\n", $this->nl, $str); + } + + protected function pScalar_String(Scalar\String_ $node): string { + $kind = $node->getAttribute('kind', Scalar\String_::KIND_SINGLE_QUOTED); + switch ($kind) { + case Scalar\String_::KIND_NOWDOC: + $label = $node->getAttribute('docLabel'); + if ($label && !$this->containsEndLabel($node->value, $label)) { + $shouldIdent = $this->phpVersion->supportsFlexibleHeredoc(); + $nl = $shouldIdent ? $this->nl : $this->newline; + if ($node->value === '') { + return "<<<'$label'$nl$label{$this->docStringEndToken}"; + } + + // Make sure trailing \r is not combined with following \n into CRLF. + if ($node->value[strlen($node->value) - 1] !== "\r") { + $value = $shouldIdent ? $this->indentString($node->value) : $node->value; + return "<<<'$label'$nl$value$nl$label{$this->docStringEndToken}"; + } + } + /* break missing intentionally */ + // no break + case Scalar\String_::KIND_SINGLE_QUOTED: + return $this->pSingleQuotedString($node->value); + case Scalar\String_::KIND_HEREDOC: + $label = $node->getAttribute('docLabel'); + $escaped = $this->escapeString($node->value, null); + if ($label && !$this->containsEndLabel($escaped, $label)) { + $nl = $this->phpVersion->supportsFlexibleHeredoc() ? $this->nl : $this->newline; + if ($escaped === '') { + return "<<<$label$nl$label{$this->docStringEndToken}"; + } + + return "<<<$label$nl$escaped$nl$label{$this->docStringEndToken}"; + } + /* break missing intentionally */ + // no break + case Scalar\String_::KIND_DOUBLE_QUOTED: + return '"' . $this->escapeString($node->value, '"') . '"'; + } + throw new \Exception('Invalid string kind'); + } + + protected function pScalar_InterpolatedString(Scalar\InterpolatedString $node): string { + if ($node->getAttribute('kind') === Scalar\String_::KIND_HEREDOC) { + $label = $node->getAttribute('docLabel'); + if ($label && !$this->encapsedContainsEndLabel($node->parts, $label)) { + $nl = $this->phpVersion->supportsFlexibleHeredoc() ? $this->nl : $this->newline; + if (count($node->parts) === 1 + && $node->parts[0] instanceof Node\InterpolatedStringPart + && $node->parts[0]->value === '' + ) { + return "<<<$label$nl$label{$this->docStringEndToken}"; + } + + return "<<<$label$nl" . $this->pEncapsList($node->parts, null) + . "$nl$label{$this->docStringEndToken}"; + } + } + return '"' . $this->pEncapsList($node->parts, '"') . '"'; + } + + protected function pScalar_Int(Scalar\Int_ $node): string { + if ($node->value === -\PHP_INT_MAX - 1) { + // PHP_INT_MIN cannot be represented as a literal, + // because the sign is not part of the literal + return '(-' . \PHP_INT_MAX . '-1)'; + } + + $kind = $node->getAttribute('kind', Scalar\Int_::KIND_DEC); + if (Scalar\Int_::KIND_DEC === $kind) { + return (string) $node->value; + } + + if ($node->value < 0) { + $sign = '-'; + $str = (string) -$node->value; + } else { + $sign = ''; + $str = (string) $node->value; + } + switch ($kind) { + case Scalar\Int_::KIND_BIN: + return $sign . '0b' . base_convert($str, 10, 2); + case Scalar\Int_::KIND_OCT: + return $sign . '0' . base_convert($str, 10, 8); + case Scalar\Int_::KIND_HEX: + return $sign . '0x' . base_convert($str, 10, 16); + } + throw new \Exception('Invalid number kind'); + } + + protected function pScalar_Float(Scalar\Float_ $node): string { + if (!is_finite($node->value)) { + if ($node->value === \INF) { + return '1.0E+1000'; + } + if ($node->value === -\INF) { + return '-1.0E+1000'; + } else { + return '\NAN'; + } + } + + // Try to find a short full-precision representation + $stringValue = sprintf('%.16G', $node->value); + if ($node->value !== (float) $stringValue) { + $stringValue = sprintf('%.17G', $node->value); + } + + // %G is locale dependent and there exists no locale-independent alternative. We don't want + // mess with switching locales here, so let's assume that a comma is the only non-standard + // decimal separator we may encounter... + $stringValue = str_replace(',', '.', $stringValue); + + // ensure that number is really printed as float + return preg_match('/^-?[0-9]+$/', $stringValue) ? $stringValue . '.0' : $stringValue; + } + + // Assignments + + protected function pExpr_Assign(Expr\Assign $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(Expr\Assign::class, $this->p($node->var) . ' = ', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_AssignRef(Expr\AssignRef $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(Expr\AssignRef::class, $this->p($node->var) . ' =& ', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_AssignOp_Plus(AssignOp\Plus $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(AssignOp\Plus::class, $this->p($node->var) . ' += ', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_AssignOp_Minus(AssignOp\Minus $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(AssignOp\Minus::class, $this->p($node->var) . ' -= ', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_AssignOp_Mul(AssignOp\Mul $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(AssignOp\Mul::class, $this->p($node->var) . ' *= ', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_AssignOp_Div(AssignOp\Div $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(AssignOp\Div::class, $this->p($node->var) . ' /= ', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_AssignOp_Concat(AssignOp\Concat $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(AssignOp\Concat::class, $this->p($node->var) . ' .= ', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_AssignOp_Mod(AssignOp\Mod $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(AssignOp\Mod::class, $this->p($node->var) . ' %= ', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_AssignOp_BitwiseAnd(AssignOp\BitwiseAnd $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(AssignOp\BitwiseAnd::class, $this->p($node->var) . ' &= ', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_AssignOp_BitwiseOr(AssignOp\BitwiseOr $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(AssignOp\BitwiseOr::class, $this->p($node->var) . ' |= ', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_AssignOp_BitwiseXor(AssignOp\BitwiseXor $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(AssignOp\BitwiseXor::class, $this->p($node->var) . ' ^= ', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_AssignOp_ShiftLeft(AssignOp\ShiftLeft $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(AssignOp\ShiftLeft::class, $this->p($node->var) . ' <<= ', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_AssignOp_ShiftRight(AssignOp\ShiftRight $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(AssignOp\ShiftRight::class, $this->p($node->var) . ' >>= ', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_AssignOp_Pow(AssignOp\Pow $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(AssignOp\Pow::class, $this->p($node->var) . ' **= ', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_AssignOp_Coalesce(AssignOp\Coalesce $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(AssignOp\Coalesce::class, $this->p($node->var) . ' ??= ', $node->expr, $precedence, $lhsPrecedence); + } + + // Binary expressions + + protected function pExpr_BinaryOp_Plus(BinaryOp\Plus $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\Plus::class, $node->left, ' + ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_Minus(BinaryOp\Minus $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\Minus::class, $node->left, ' - ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_Mul(BinaryOp\Mul $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\Mul::class, $node->left, ' * ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_Div(BinaryOp\Div $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\Div::class, $node->left, ' / ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_Concat(BinaryOp\Concat $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\Concat::class, $node->left, ' . ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_Mod(BinaryOp\Mod $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\Mod::class, $node->left, ' % ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_BooleanAnd(BinaryOp\BooleanAnd $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\BooleanAnd::class, $node->left, ' && ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_BooleanOr(BinaryOp\BooleanOr $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\BooleanOr::class, $node->left, ' || ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_BitwiseAnd(BinaryOp\BitwiseAnd $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\BitwiseAnd::class, $node->left, ' & ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_BitwiseOr(BinaryOp\BitwiseOr $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\BitwiseOr::class, $node->left, ' | ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_BitwiseXor(BinaryOp\BitwiseXor $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\BitwiseXor::class, $node->left, ' ^ ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_ShiftLeft(BinaryOp\ShiftLeft $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\ShiftLeft::class, $node->left, ' << ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_ShiftRight(BinaryOp\ShiftRight $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\ShiftRight::class, $node->left, ' >> ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_Pow(BinaryOp\Pow $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\Pow::class, $node->left, ' ** ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_LogicalAnd(BinaryOp\LogicalAnd $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\LogicalAnd::class, $node->left, ' and ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_LogicalOr(BinaryOp\LogicalOr $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\LogicalOr::class, $node->left, ' or ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_LogicalXor(BinaryOp\LogicalXor $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\LogicalXor::class, $node->left, ' xor ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_Equal(BinaryOp\Equal $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\Equal::class, $node->left, ' == ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_NotEqual(BinaryOp\NotEqual $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\NotEqual::class, $node->left, ' != ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_Identical(BinaryOp\Identical $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\Identical::class, $node->left, ' === ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_NotIdentical(BinaryOp\NotIdentical $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\NotIdentical::class, $node->left, ' !== ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_Spaceship(BinaryOp\Spaceship $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\Spaceship::class, $node->left, ' <=> ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_Greater(BinaryOp\Greater $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\Greater::class, $node->left, ' > ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_GreaterOrEqual(BinaryOp\GreaterOrEqual $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\GreaterOrEqual::class, $node->left, ' >= ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_Smaller(BinaryOp\Smaller $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\Smaller::class, $node->left, ' < ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_SmallerOrEqual(BinaryOp\SmallerOrEqual $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\SmallerOrEqual::class, $node->left, ' <= ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_BinaryOp_Coalesce(BinaryOp\Coalesce $node, int $precedence, int $lhsPrecedence): string { + return $this->pInfixOp(BinaryOp\Coalesce::class, $node->left, ' ?? ', $node->right, $precedence, $lhsPrecedence); + } + + protected function pExpr_Instanceof(Expr\Instanceof_ $node, int $precedence, int $lhsPrecedence): string { + return $this->pPostfixOp( + Expr\Instanceof_::class, $node->expr, + ' instanceof ' . $this->pNewOperand($node->class), + $precedence, $lhsPrecedence); + } + + // Unary expressions + + protected function pExpr_BooleanNot(Expr\BooleanNot $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(Expr\BooleanNot::class, '!', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_BitwiseNot(Expr\BitwiseNot $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(Expr\BitwiseNot::class, '~', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_UnaryMinus(Expr\UnaryMinus $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(Expr\UnaryMinus::class, '-', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_UnaryPlus(Expr\UnaryPlus $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(Expr\UnaryPlus::class, '+', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_PreInc(Expr\PreInc $node): string { + return '++' . $this->p($node->var); + } + + protected function pExpr_PreDec(Expr\PreDec $node): string { + return '--' . $this->p($node->var); + } + + protected function pExpr_PostInc(Expr\PostInc $node): string { + return $this->p($node->var) . '++'; + } + + protected function pExpr_PostDec(Expr\PostDec $node): string { + return $this->p($node->var) . '--'; + } + + protected function pExpr_ErrorSuppress(Expr\ErrorSuppress $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(Expr\ErrorSuppress::class, '@', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_YieldFrom(Expr\YieldFrom $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(Expr\YieldFrom::class, 'yield from ', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_Print(Expr\Print_ $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(Expr\Print_::class, 'print ', $node->expr, $precedence, $lhsPrecedence); + } + + // Casts + + protected function pExpr_Cast_Int(Cast\Int_ $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(Cast\Int_::class, '(int) ', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_Cast_Double(Cast\Double $node, int $precedence, int $lhsPrecedence): string { + $kind = $node->getAttribute('kind', Cast\Double::KIND_DOUBLE); + if ($kind === Cast\Double::KIND_DOUBLE) { + $cast = '(double)'; + } elseif ($kind === Cast\Double::KIND_FLOAT) { + $cast = '(float)'; + } else { + assert($kind === Cast\Double::KIND_REAL); + $cast = '(real)'; + } + return $this->pPrefixOp(Cast\Double::class, $cast . ' ', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_Cast_String(Cast\String_ $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(Cast\String_::class, '(string) ', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_Cast_Array(Cast\Array_ $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(Cast\Array_::class, '(array) ', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_Cast_Object(Cast\Object_ $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(Cast\Object_::class, '(object) ', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_Cast_Bool(Cast\Bool_ $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(Cast\Bool_::class, '(bool) ', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_Cast_Unset(Cast\Unset_ $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(Cast\Unset_::class, '(unset) ', $node->expr, $precedence, $lhsPrecedence); + } + + // Function calls and similar constructs + + protected function pExpr_FuncCall(Expr\FuncCall $node): string { + return $this->pCallLhs($node->name) + . '(' . $this->pMaybeMultiline($node->args) . ')'; + } + + protected function pExpr_MethodCall(Expr\MethodCall $node): string { + return $this->pDereferenceLhs($node->var) . '->' . $this->pObjectProperty($node->name) + . '(' . $this->pMaybeMultiline($node->args) . ')'; + } + + protected function pExpr_NullsafeMethodCall(Expr\NullsafeMethodCall $node): string { + return $this->pDereferenceLhs($node->var) . '?->' . $this->pObjectProperty($node->name) + . '(' . $this->pMaybeMultiline($node->args) . ')'; + } + + protected function pExpr_StaticCall(Expr\StaticCall $node): string { + return $this->pStaticDereferenceLhs($node->class) . '::' + . ($node->name instanceof Expr + ? ($node->name instanceof Expr\Variable + ? $this->p($node->name) + : '{' . $this->p($node->name) . '}') + : $node->name) + . '(' . $this->pMaybeMultiline($node->args) . ')'; + } + + protected function pExpr_Empty(Expr\Empty_ $node): string { + return 'empty(' . $this->p($node->expr) . ')'; + } + + protected function pExpr_Isset(Expr\Isset_ $node): string { + return 'isset(' . $this->pCommaSeparated($node->vars) . ')'; + } + + protected function pExpr_Eval(Expr\Eval_ $node): string { + return 'eval(' . $this->p($node->expr) . ')'; + } + + protected function pExpr_Include(Expr\Include_ $node, int $precedence, int $lhsPrecedence): string { + static $map = [ + Expr\Include_::TYPE_INCLUDE => 'include', + Expr\Include_::TYPE_INCLUDE_ONCE => 'include_once', + Expr\Include_::TYPE_REQUIRE => 'require', + Expr\Include_::TYPE_REQUIRE_ONCE => 'require_once', + ]; + + return $this->pPrefixOp(Expr\Include_::class, $map[$node->type] . ' ', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_List(Expr\List_ $node): string { + $syntax = $node->getAttribute('kind', + $this->phpVersion->supportsShortArrayDestructuring() ? Expr\List_::KIND_ARRAY : Expr\List_::KIND_LIST); + if ($syntax === Expr\List_::KIND_ARRAY) { + return '[' . $this->pMaybeMultiline($node->items, true) . ']'; + } else { + return 'list(' . $this->pMaybeMultiline($node->items, true) . ')'; + } + } + + // Other + + protected function pExpr_Error(Expr\Error $node): string { + throw new \LogicException('Cannot pretty-print AST with Error nodes'); + } + + protected function pExpr_Variable(Expr\Variable $node): string { + if ($node->name instanceof Expr) { + return '${' . $this->p($node->name) . '}'; + } else { + return '$' . $node->name; + } + } + + protected function pExpr_Array(Expr\Array_ $node): string { + $syntax = $node->getAttribute('kind', + $this->shortArraySyntax ? Expr\Array_::KIND_SHORT : Expr\Array_::KIND_LONG); + if ($syntax === Expr\Array_::KIND_SHORT) { + return '[' . $this->pMaybeMultiline($node->items, true) . ']'; + } else { + return 'array(' . $this->pMaybeMultiline($node->items, true) . ')'; + } + } + + protected function pKey(?Node $node): string { + if ($node === null) { + return ''; + } + + // => is not really an operator and does not typically participate in precedence resolution. + // However, there is an exception if yield expressions with keys are involved: + // [yield $a => $b] is interpreted as [(yield $a => $b)], so we need to ensure that + // [(yield $a) => $b] is printed with parentheses. We approximate this by lowering the LHS + // precedence to that of yield (which will also print unnecessary parentheses for rare low + // precedence unary operators like include). + $yieldPrecedence = $this->precedenceMap[Expr\Yield_::class][0]; + return $this->p($node, self::MAX_PRECEDENCE, $yieldPrecedence) . ' => '; + } + + protected function pArrayItem(Node\ArrayItem $node): string { + return $this->pKey($node->key) + . ($node->byRef ? '&' : '') + . ($node->unpack ? '...' : '') + . $this->p($node->value); + } + + protected function pExpr_ArrayDimFetch(Expr\ArrayDimFetch $node): string { + return $this->pDereferenceLhs($node->var) + . '[' . (null !== $node->dim ? $this->p($node->dim) : '') . ']'; + } + + protected function pExpr_ConstFetch(Expr\ConstFetch $node): string { + return $this->p($node->name); + } + + protected function pExpr_ClassConstFetch(Expr\ClassConstFetch $node): string { + return $this->pStaticDereferenceLhs($node->class) . '::' . $this->pObjectProperty($node->name); + } + + protected function pExpr_PropertyFetch(Expr\PropertyFetch $node): string { + return $this->pDereferenceLhs($node->var) . '->' . $this->pObjectProperty($node->name); + } + + protected function pExpr_NullsafePropertyFetch(Expr\NullsafePropertyFetch $node): string { + return $this->pDereferenceLhs($node->var) . '?->' . $this->pObjectProperty($node->name); + } + + protected function pExpr_StaticPropertyFetch(Expr\StaticPropertyFetch $node): string { + return $this->pStaticDereferenceLhs($node->class) . '::$' . $this->pObjectProperty($node->name); + } + + protected function pExpr_ShellExec(Expr\ShellExec $node): string { + return '`' . $this->pEncapsList($node->parts, '`') . '`'; + } + + protected function pExpr_Closure(Expr\Closure $node): string { + return $this->pAttrGroups($node->attrGroups, true) + . $this->pStatic($node->static) + . 'function ' . ($node->byRef ? '&' : '') + . '(' . $this->pMaybeMultiline($node->params, $this->phpVersion->supportsTrailingCommaInParamList()) . ')' + . (!empty($node->uses) ? ' use (' . $this->pCommaSeparated($node->uses) . ')' : '') + . (null !== $node->returnType ? ': ' . $this->p($node->returnType) : '') + . ' {' . $this->pStmts($node->stmts) . $this->nl . '}'; + } + + protected function pExpr_Match(Expr\Match_ $node): string { + return 'match (' . $this->p($node->cond) . ') {' + . $this->pCommaSeparatedMultiline($node->arms, true) + . $this->nl + . '}'; + } + + protected function pMatchArm(Node\MatchArm $node): string { + $result = ''; + if ($node->conds) { + for ($i = 0, $c = \count($node->conds); $i + 1 < $c; $i++) { + $result .= $this->p($node->conds[$i]) . ', '; + } + $result .= $this->pKey($node->conds[$i]); + } else { + $result = 'default => '; + } + return $result . $this->p($node->body); + } + + protected function pExpr_ArrowFunction(Expr\ArrowFunction $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp( + Expr\ArrowFunction::class, + $this->pAttrGroups($node->attrGroups, true) + . $this->pStatic($node->static) + . 'fn' . ($node->byRef ? '&' : '') + . '(' . $this->pMaybeMultiline($node->params, $this->phpVersion->supportsTrailingCommaInParamList()) . ')' + . (null !== $node->returnType ? ': ' . $this->p($node->returnType) : '') + . ' => ', + $node->expr, $precedence, $lhsPrecedence); + } + + protected function pClosureUse(Node\ClosureUse $node): string { + return ($node->byRef ? '&' : '') . $this->p($node->var); + } + + protected function pExpr_New(Expr\New_ $node): string { + if ($node->class instanceof Stmt\Class_) { + $args = $node->args ? '(' . $this->pMaybeMultiline($node->args) . ')' : ''; + return 'new ' . $this->pClassCommon($node->class, $args); + } + return 'new ' . $this->pNewOperand($node->class) + . '(' . $this->pMaybeMultiline($node->args) . ')'; + } + + protected function pExpr_Clone(Expr\Clone_ $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(Expr\Clone_::class, 'clone ', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_Ternary(Expr\Ternary $node, int $precedence, int $lhsPrecedence): string { + // a bit of cheating: we treat the ternary as a binary op where the ?...: part is the operator. + // this is okay because the part between ? and : never needs parentheses. + return $this->pInfixOp(Expr\Ternary::class, + $node->cond, ' ?' . (null !== $node->if ? ' ' . $this->p($node->if) . ' ' : '') . ': ', $node->else, + $precedence, $lhsPrecedence + ); + } + + protected function pExpr_Exit(Expr\Exit_ $node): string { + $kind = $node->getAttribute('kind', Expr\Exit_::KIND_DIE); + return ($kind === Expr\Exit_::KIND_EXIT ? 'exit' : 'die') + . (null !== $node->expr ? '(' . $this->p($node->expr) . ')' : ''); + } + + protected function pExpr_Throw(Expr\Throw_ $node, int $precedence, int $lhsPrecedence): string { + return $this->pPrefixOp(Expr\Throw_::class, 'throw ', $node->expr, $precedence, $lhsPrecedence); + } + + protected function pExpr_Yield(Expr\Yield_ $node, int $precedence, int $lhsPrecedence): string { + if ($node->value === null) { + $opPrecedence = $this->precedenceMap[Expr\Yield_::class][0]; + return $opPrecedence >= $lhsPrecedence ? '(yield)' : 'yield'; + } else { + if (!$this->phpVersion->supportsYieldWithoutParentheses()) { + return '(yield ' . $this->pKey($node->key) . $this->p($node->value) . ')'; + } + return $this->pPrefixOp( + Expr\Yield_::class, 'yield ' . $this->pKey($node->key), + $node->value, $precedence, $lhsPrecedence); + } + } + + // Declarations + + protected function pStmt_Namespace(Stmt\Namespace_ $node): string { + if ($this->canUseSemicolonNamespaces) { + return 'namespace ' . $this->p($node->name) . ';' + . $this->nl . $this->pStmts($node->stmts, false); + } else { + return 'namespace' . (null !== $node->name ? ' ' . $this->p($node->name) : '') + . ' {' . $this->pStmts($node->stmts) . $this->nl . '}'; + } + } + + protected function pStmt_Use(Stmt\Use_ $node): string { + return 'use ' . $this->pUseType($node->type) + . $this->pCommaSeparated($node->uses) . ';'; + } + + protected function pStmt_GroupUse(Stmt\GroupUse $node): string { + return 'use ' . $this->pUseType($node->type) . $this->pName($node->prefix) + . '\{' . $this->pCommaSeparated($node->uses) . '};'; + } + + protected function pUseItem(Node\UseItem $node): string { + return $this->pUseType($node->type) . $this->p($node->name) + . (null !== $node->alias ? ' as ' . $node->alias : ''); + } + + protected function pUseType(int $type): string { + return $type === Stmt\Use_::TYPE_FUNCTION ? 'function ' + : ($type === Stmt\Use_::TYPE_CONSTANT ? 'const ' : ''); + } + + protected function pStmt_Interface(Stmt\Interface_ $node): string { + return $this->pAttrGroups($node->attrGroups) + . 'interface ' . $node->name + . (!empty($node->extends) ? ' extends ' . $this->pCommaSeparated($node->extends) : '') + . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; + } + + protected function pStmt_Enum(Stmt\Enum_ $node): string { + return $this->pAttrGroups($node->attrGroups) + . 'enum ' . $node->name + . ($node->scalarType ? ' : ' . $this->p($node->scalarType) : '') + . (!empty($node->implements) ? ' implements ' . $this->pCommaSeparated($node->implements) : '') + . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; + } + + protected function pStmt_Class(Stmt\Class_ $node): string { + return $this->pClassCommon($node, ' ' . $node->name); + } + + protected function pStmt_Trait(Stmt\Trait_ $node): string { + return $this->pAttrGroups($node->attrGroups) + . 'trait ' . $node->name + . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; + } + + protected function pStmt_EnumCase(Stmt\EnumCase $node): string { + return $this->pAttrGroups($node->attrGroups) + . 'case ' . $node->name + . ($node->expr ? ' = ' . $this->p($node->expr) : '') + . ';'; + } + + protected function pStmt_TraitUse(Stmt\TraitUse $node): string { + return 'use ' . $this->pCommaSeparated($node->traits) + . (empty($node->adaptations) + ? ';' + : ' {' . $this->pStmts($node->adaptations) . $this->nl . '}'); + } + + protected function pStmt_TraitUseAdaptation_Precedence(Stmt\TraitUseAdaptation\Precedence $node): string { + return $this->p($node->trait) . '::' . $node->method + . ' insteadof ' . $this->pCommaSeparated($node->insteadof) . ';'; + } + + protected function pStmt_TraitUseAdaptation_Alias(Stmt\TraitUseAdaptation\Alias $node): string { + return (null !== $node->trait ? $this->p($node->trait) . '::' : '') + . $node->method . ' as' + . (null !== $node->newModifier ? ' ' . rtrim($this->pModifiers($node->newModifier), ' ') : '') + . (null !== $node->newName ? ' ' . $node->newName : '') + . ';'; + } + + protected function pStmt_Property(Stmt\Property $node): string { + return $this->pAttrGroups($node->attrGroups) + . (0 === $node->flags ? 'var ' : $this->pModifiers($node->flags)) + . ($node->type ? $this->p($node->type) . ' ' : '') + . $this->pCommaSeparated($node->props) . ';'; + } + + protected function pPropertyItem(Node\PropertyItem $node): string { + return '$' . $node->name + . (null !== $node->default ? ' = ' . $this->p($node->default) : ''); + } + + protected function pStmt_ClassMethod(Stmt\ClassMethod $node): string { + return $this->pAttrGroups($node->attrGroups) + . $this->pModifiers($node->flags) + . 'function ' . ($node->byRef ? '&' : '') . $node->name + . '(' . $this->pMaybeMultiline($node->params, $this->phpVersion->supportsTrailingCommaInParamList()) . ')' + . (null !== $node->returnType ? ': ' . $this->p($node->returnType) : '') + . (null !== $node->stmts + ? $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}' + : ';'); + } + + protected function pStmt_ClassConst(Stmt\ClassConst $node): string { + return $this->pAttrGroups($node->attrGroups) + . $this->pModifiers($node->flags) + . 'const ' + . (null !== $node->type ? $this->p($node->type) . ' ' : '') + . $this->pCommaSeparated($node->consts) . ';'; + } + + protected function pStmt_Function(Stmt\Function_ $node): string { + return $this->pAttrGroups($node->attrGroups) + . 'function ' . ($node->byRef ? '&' : '') . $node->name + . '(' . $this->pMaybeMultiline($node->params, $this->phpVersion->supportsTrailingCommaInParamList()) . ')' + . (null !== $node->returnType ? ': ' . $this->p($node->returnType) : '') + . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; + } + + protected function pStmt_Const(Stmt\Const_ $node): string { + return 'const ' . $this->pCommaSeparated($node->consts) . ';'; + } + + protected function pStmt_Declare(Stmt\Declare_ $node): string { + return 'declare (' . $this->pCommaSeparated($node->declares) . ')' + . (null !== $node->stmts ? ' {' . $this->pStmts($node->stmts) . $this->nl . '}' : ';'); + } + + protected function pDeclareItem(Node\DeclareItem $node): string { + return $node->key . '=' . $this->p($node->value); + } + + // Control flow + + protected function pStmt_If(Stmt\If_ $node): string { + return 'if (' . $this->p($node->cond) . ') {' + . $this->pStmts($node->stmts) . $this->nl . '}' + . ($node->elseifs ? ' ' . $this->pImplode($node->elseifs, ' ') : '') + . (null !== $node->else ? ' ' . $this->p($node->else) : ''); + } + + protected function pStmt_ElseIf(Stmt\ElseIf_ $node): string { + return 'elseif (' . $this->p($node->cond) . ') {' + . $this->pStmts($node->stmts) . $this->nl . '}'; + } + + protected function pStmt_Else(Stmt\Else_ $node): string { + if (\count($node->stmts) === 1 && $node->stmts[0] instanceof Stmt\If_) { + // Print as "else if" rather than "else { if }" + return 'else ' . $this->p($node->stmts[0]); + } + return 'else {' . $this->pStmts($node->stmts) . $this->nl . '}'; + } + + protected function pStmt_For(Stmt\For_ $node): string { + return 'for (' + . $this->pCommaSeparated($node->init) . ';' . (!empty($node->cond) ? ' ' : '') + . $this->pCommaSeparated($node->cond) . ';' . (!empty($node->loop) ? ' ' : '') + . $this->pCommaSeparated($node->loop) + . ') {' . $this->pStmts($node->stmts) . $this->nl . '}'; + } + + protected function pStmt_Foreach(Stmt\Foreach_ $node): string { + return 'foreach (' . $this->p($node->expr) . ' as ' + . (null !== $node->keyVar ? $this->p($node->keyVar) . ' => ' : '') + . ($node->byRef ? '&' : '') . $this->p($node->valueVar) . ') {' + . $this->pStmts($node->stmts) . $this->nl . '}'; + } + + protected function pStmt_While(Stmt\While_ $node): string { + return 'while (' . $this->p($node->cond) . ') {' + . $this->pStmts($node->stmts) . $this->nl . '}'; + } + + protected function pStmt_Do(Stmt\Do_ $node): string { + return 'do {' . $this->pStmts($node->stmts) . $this->nl + . '} while (' . $this->p($node->cond) . ');'; + } + + protected function pStmt_Switch(Stmt\Switch_ $node): string { + return 'switch (' . $this->p($node->cond) . ') {' + . $this->pStmts($node->cases) . $this->nl . '}'; + } + + protected function pStmt_Case(Stmt\Case_ $node): string { + return (null !== $node->cond ? 'case ' . $this->p($node->cond) : 'default') . ':' + . $this->pStmts($node->stmts); + } + + protected function pStmt_TryCatch(Stmt\TryCatch $node): string { + return 'try {' . $this->pStmts($node->stmts) . $this->nl . '}' + . ($node->catches ? ' ' . $this->pImplode($node->catches, ' ') : '') + . ($node->finally !== null ? ' ' . $this->p($node->finally) : ''); + } + + protected function pStmt_Catch(Stmt\Catch_ $node): string { + return 'catch (' . $this->pImplode($node->types, '|') + . ($node->var !== null ? ' ' . $this->p($node->var) : '') + . ') {' . $this->pStmts($node->stmts) . $this->nl . '}'; + } + + protected function pStmt_Finally(Stmt\Finally_ $node): string { + return 'finally {' . $this->pStmts($node->stmts) . $this->nl . '}'; + } + + protected function pStmt_Break(Stmt\Break_ $node): string { + return 'break' . ($node->num !== null ? ' ' . $this->p($node->num) : '') . ';'; + } + + protected function pStmt_Continue(Stmt\Continue_ $node): string { + return 'continue' . ($node->num !== null ? ' ' . $this->p($node->num) : '') . ';'; + } + + protected function pStmt_Return(Stmt\Return_ $node): string { + return 'return' . (null !== $node->expr ? ' ' . $this->p($node->expr) : '') . ';'; + } + + protected function pStmt_Label(Stmt\Label $node): string { + return $node->name . ':'; + } + + protected function pStmt_Goto(Stmt\Goto_ $node): string { + return 'goto ' . $node->name . ';'; + } + + // Other + + protected function pStmt_Expression(Stmt\Expression $node): string { + return $this->p($node->expr) . ';'; + } + + protected function pStmt_Echo(Stmt\Echo_ $node): string { + return 'echo ' . $this->pCommaSeparated($node->exprs) . ';'; + } + + protected function pStmt_Static(Stmt\Static_ $node): string { + return 'static ' . $this->pCommaSeparated($node->vars) . ';'; + } + + protected function pStmt_Global(Stmt\Global_ $node): string { + return 'global ' . $this->pCommaSeparated($node->vars) . ';'; + } + + protected function pStaticVar(Node\StaticVar $node): string { + return $this->p($node->var) + . (null !== $node->default ? ' = ' . $this->p($node->default) : ''); + } + + protected function pStmt_Unset(Stmt\Unset_ $node): string { + return 'unset(' . $this->pCommaSeparated($node->vars) . ');'; + } + + protected function pStmt_InlineHTML(Stmt\InlineHTML $node): string { + $newline = $node->getAttribute('hasLeadingNewline', true) ? $this->newline : ''; + return '?>' . $newline . $node->value . '<?php '; + } + + protected function pStmt_HaltCompiler(Stmt\HaltCompiler $node): string { + return '__halt_compiler();' . $node->remaining; + } + + protected function pStmt_Nop(Stmt\Nop $node): string { + return ''; + } + + protected function pStmt_Block(Stmt\Block $node): string { + return '{' . $this->pStmts($node->stmts) . $this->nl . '}'; + } + + // Helpers + + protected function pClassCommon(Stmt\Class_ $node, string $afterClassToken): string { + return $this->pAttrGroups($node->attrGroups, $node->name === null) + . $this->pModifiers($node->flags) + . 'class' . $afterClassToken + . (null !== $node->extends ? ' extends ' . $this->p($node->extends) : '') + . (!empty($node->implements) ? ' implements ' . $this->pCommaSeparated($node->implements) : '') + . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; + } + + protected function pObjectProperty(Node $node): string { + if ($node instanceof Expr) { + return '{' . $this->p($node) . '}'; + } else { + assert($node instanceof Node\Identifier); + return $node->name; + } + } + + /** @param (Expr|Node\InterpolatedStringPart)[] $encapsList */ + protected function pEncapsList(array $encapsList, ?string $quote): string { + $return = ''; + foreach ($encapsList as $element) { + if ($element instanceof Node\InterpolatedStringPart) { + $return .= $this->escapeString($element->value, $quote); + } else { + $return .= '{' . $this->p($element) . '}'; + } + } + + return $return; + } + + protected function pSingleQuotedString(string $string): string { + // It is idiomatic to only escape backslashes when necessary, i.e. when followed by ', \ or + // the end of the string ('Foo\Bar' instead of 'Foo\\Bar'). However, we also don't want to + // produce an odd number of backslashes, so '\\\\a' should not get rendered as '\\\a', even + // though that would be legal. + $regex = '/\'|\\\\(?=[\'\\\\]|$)|(?<=\\\\)\\\\/'; + return '\'' . preg_replace($regex, '\\\\$0', $string) . '\''; + } + + protected function escapeString(string $string, ?string $quote): string { + if (null === $quote) { + // For doc strings, don't escape newlines + $escaped = addcslashes($string, "\t\f\v$\\"); + // But do escape isolated \r. Combined with the terminating newline, it might get + // interpreted as \r\n and dropped from the string contents. + $escaped = preg_replace('/\r(?!\n)/', '\\r', $escaped); + if ($this->phpVersion->supportsFlexibleHeredoc()) { + $escaped = $this->indentString($escaped); + } + } else { + $escaped = addcslashes($string, "\n\r\t\f\v$" . $quote . "\\"); + } + + // Escape control characters and non-UTF-8 characters. + // Regex based on https://stackoverflow.com/a/11709412/385378. + $regex = '/( + [\x00-\x08\x0E-\x1F] # Control characters + | [\xC0-\xC1] # Invalid UTF-8 Bytes + | [\xF5-\xFF] # Invalid UTF-8 Bytes + | \xE0(?=[\x80-\x9F]) # Overlong encoding of prior code point + | \xF0(?=[\x80-\x8F]) # Overlong encoding of prior code point + | [\xC2-\xDF](?![\x80-\xBF]) # Invalid UTF-8 Sequence Start + | [\xE0-\xEF](?![\x80-\xBF]{2}) # Invalid UTF-8 Sequence Start + | [\xF0-\xF4](?![\x80-\xBF]{3}) # Invalid UTF-8 Sequence Start + | (?<=[\x00-\x7F\xF5-\xFF])[\x80-\xBF] # Invalid UTF-8 Sequence Middle + | (?<![\xC2-\xDF]|[\xE0-\xEF]|[\xE0-\xEF][\x80-\xBF]|[\xF0-\xF4]|[\xF0-\xF4][\x80-\xBF]|[\xF0-\xF4][\x80-\xBF]{2})[\x80-\xBF] # Overlong Sequence + | (?<=[\xE0-\xEF])[\x80-\xBF](?![\x80-\xBF]) # Short 3 byte sequence + | (?<=[\xF0-\xF4])[\x80-\xBF](?![\x80-\xBF]{2}) # Short 4 byte sequence + | (?<=[\xF0-\xF4][\x80-\xBF])[\x80-\xBF](?![\x80-\xBF]) # Short 4 byte sequence (2) + )/x'; + return preg_replace_callback($regex, function ($matches): string { + assert(strlen($matches[0]) === 1); + $hex = dechex(ord($matches[0])); + return '\\x' . str_pad($hex, 2, '0', \STR_PAD_LEFT); + }, $escaped); + } + + protected function containsEndLabel(string $string, string $label, bool $atStart = true): bool { + $start = $atStart ? '(?:^|[\r\n])[ \t]*' : '[\r\n][ \t]*'; + return false !== strpos($string, $label) + && preg_match('/' . $start . $label . '(?:$|[^_A-Za-z0-9\x80-\xff])/', $string); + } + + /** @param (Expr|Node\InterpolatedStringPart)[] $parts */ + protected function encapsedContainsEndLabel(array $parts, string $label): bool { + foreach ($parts as $i => $part) { + if ($part instanceof Node\InterpolatedStringPart + && $this->containsEndLabel($this->escapeString($part->value, null), $label, $i === 0) + ) { + return true; + } + } + return false; + } + + protected function pDereferenceLhs(Node $node): string { + if (!$this->dereferenceLhsRequiresParens($node)) { + return $this->p($node); + } else { + return '(' . $this->p($node) . ')'; + } + } + + protected function pStaticDereferenceLhs(Node $node): string { + if (!$this->staticDereferenceLhsRequiresParens($node)) { + return $this->p($node); + } else { + return '(' . $this->p($node) . ')'; + } + } + + protected function pCallLhs(Node $node): string { + if (!$this->callLhsRequiresParens($node)) { + return $this->p($node); + } else { + return '(' . $this->p($node) . ')'; + } + } + + protected function pNewOperand(Node $node): string { + if (!$this->newOperandRequiresParens($node)) { + return $this->p($node); + } else { + return '(' . $this->p($node) . ')'; + } + } + + /** + * @param Node[] $nodes + */ + protected function hasNodeWithComments(array $nodes): bool { + foreach ($nodes as $node) { + if ($node && $node->getComments()) { + return true; + } + } + return false; + } + + /** @param Node[] $nodes */ + protected function pMaybeMultiline(array $nodes, bool $trailingComma = false): string { + if (!$this->hasNodeWithComments($nodes)) { + return $this->pCommaSeparated($nodes); + } else { + return $this->pCommaSeparatedMultiline($nodes, $trailingComma) . $this->nl; + } + } + + /** @param Node\AttributeGroup[] $nodes */ + protected function pAttrGroups(array $nodes, bool $inline = false): string { + $result = ''; + $sep = $inline ? ' ' : $this->nl; + foreach ($nodes as $node) { + $result .= $this->p($node) . $sep; + } + + return $result; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php b/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php new file mode 100644 index 00000000..17f27a15 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php @@ -0,0 +1,1655 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +use PhpParser\Internal\DiffElem; +use PhpParser\Internal\Differ; +use PhpParser\Internal\PrintableNewAnonClassNode; +use PhpParser\Internal\TokenStream; +use PhpParser\Node\AttributeGroup; +use PhpParser\Node\Expr; +use PhpParser\Node\Expr\AssignOp; +use PhpParser\Node\Expr\BinaryOp; +use PhpParser\Node\Expr\Cast; +use PhpParser\Node\IntersectionType; +use PhpParser\Node\MatchArm; +use PhpParser\Node\Param; +use PhpParser\Node\Scalar; +use PhpParser\Node\Stmt; +use PhpParser\Node\UnionType; + +abstract class PrettyPrinterAbstract implements PrettyPrinter { + protected const FIXUP_PREC_LEFT = 0; // LHS operand affected by precedence + protected const FIXUP_PREC_RIGHT = 1; // RHS operand affected by precedence + protected const FIXUP_PREC_UNARY = 2; // Only operand affected by precedence + protected const FIXUP_CALL_LHS = 3; // LHS of call + protected const FIXUP_DEREF_LHS = 4; // LHS of dereferencing operation + protected const FIXUP_STATIC_DEREF_LHS = 5; // LHS of static dereferencing operation + protected const FIXUP_BRACED_NAME = 6; // Name operand that may require bracing + protected const FIXUP_VAR_BRACED_NAME = 7; // Name operand that may require ${} bracing + protected const FIXUP_ENCAPSED = 8; // Encapsed string part + protected const FIXUP_NEW = 9; // New/instanceof operand + + protected const MAX_PRECEDENCE = 1000; + + /** @var array<class-string, array{int, int, int}> */ + protected array $precedenceMap = [ + // [precedence, precedenceLHS, precedenceRHS] + // Where the latter two are the precedences to use for the LHS and RHS of a binary operator, + // where 1 is added to one of the sides depending on associativity. This information is not + // used for unary operators and set to -1. + Expr\Clone_::class => [-10, 0, 1], + BinaryOp\Pow::class => [ 0, 0, 1], + Expr\BitwiseNot::class => [ 10, -1, -1], + Expr\UnaryPlus::class => [ 10, -1, -1], + Expr\UnaryMinus::class => [ 10, -1, -1], + Cast\Int_::class => [ 10, -1, -1], + Cast\Double::class => [ 10, -1, -1], + Cast\String_::class => [ 10, -1, -1], + Cast\Array_::class => [ 10, -1, -1], + Cast\Object_::class => [ 10, -1, -1], + Cast\Bool_::class => [ 10, -1, -1], + Cast\Unset_::class => [ 10, -1, -1], + Expr\ErrorSuppress::class => [ 10, -1, -1], + Expr\Instanceof_::class => [ 20, -1, -1], + Expr\BooleanNot::class => [ 30, -1, -1], + BinaryOp\Mul::class => [ 40, 41, 40], + BinaryOp\Div::class => [ 40, 41, 40], + BinaryOp\Mod::class => [ 40, 41, 40], + BinaryOp\Plus::class => [ 50, 51, 50], + BinaryOp\Minus::class => [ 50, 51, 50], + BinaryOp\Concat::class => [ 50, 51, 50], + BinaryOp\ShiftLeft::class => [ 60, 61, 60], + BinaryOp\ShiftRight::class => [ 60, 61, 60], + BinaryOp\Smaller::class => [ 70, 70, 70], + BinaryOp\SmallerOrEqual::class => [ 70, 70, 70], + BinaryOp\Greater::class => [ 70, 70, 70], + BinaryOp\GreaterOrEqual::class => [ 70, 70, 70], + BinaryOp\Equal::class => [ 80, 80, 80], + BinaryOp\NotEqual::class => [ 80, 80, 80], + BinaryOp\Identical::class => [ 80, 80, 80], + BinaryOp\NotIdentical::class => [ 80, 80, 80], + BinaryOp\Spaceship::class => [ 80, 80, 80], + BinaryOp\BitwiseAnd::class => [ 90, 91, 90], + BinaryOp\BitwiseXor::class => [100, 101, 100], + BinaryOp\BitwiseOr::class => [110, 111, 110], + BinaryOp\BooleanAnd::class => [120, 121, 120], + BinaryOp\BooleanOr::class => [130, 131, 130], + BinaryOp\Coalesce::class => [140, 140, 141], + Expr\Ternary::class => [150, 150, 150], + Expr\Assign::class => [160, -1, -1], + Expr\AssignRef::class => [160, -1, -1], + AssignOp\Plus::class => [160, -1, -1], + AssignOp\Minus::class => [160, -1, -1], + AssignOp\Mul::class => [160, -1, -1], + AssignOp\Div::class => [160, -1, -1], + AssignOp\Concat::class => [160, -1, -1], + AssignOp\Mod::class => [160, -1, -1], + AssignOp\BitwiseAnd::class => [160, -1, -1], + AssignOp\BitwiseOr::class => [160, -1, -1], + AssignOp\BitwiseXor::class => [160, -1, -1], + AssignOp\ShiftLeft::class => [160, -1, -1], + AssignOp\ShiftRight::class => [160, -1, -1], + AssignOp\Pow::class => [160, -1, -1], + AssignOp\Coalesce::class => [160, -1, -1], + Expr\YieldFrom::class => [170, -1, -1], + Expr\Yield_::class => [175, -1, -1], + Expr\Print_::class => [180, -1, -1], + BinaryOp\LogicalAnd::class => [190, 191, 190], + BinaryOp\LogicalXor::class => [200, 201, 200], + BinaryOp\LogicalOr::class => [210, 211, 210], + Expr\Include_::class => [220, -1, -1], + Expr\ArrowFunction::class => [230, -1, -1], + Expr\Throw_::class => [240, -1, -1], + ]; + + /** @var int Current indentation level. */ + protected int $indentLevel; + /** @var string Newline style. Does not include current indentation. */ + protected string $newline; + /** @var string Newline including current indentation. */ + protected string $nl; + /** @var string|null Token placed at end of doc string to ensure it is followed by a newline. + * Null if flexible doc strings are used. */ + protected ?string $docStringEndToken; + /** @var bool Whether semicolon namespaces can be used (i.e. no global namespace is used) */ + protected bool $canUseSemicolonNamespaces; + /** @var bool Whether to use short array syntax if the node specifies no preference */ + protected bool $shortArraySyntax; + /** @var PhpVersion PHP version to target */ + protected PhpVersion $phpVersion; + + /** @var TokenStream|null Original tokens for use in format-preserving pretty print */ + protected ?TokenStream $origTokens; + /** @var Internal\Differ<Node> Differ for node lists */ + protected Differ $nodeListDiffer; + /** @var array<string, bool> Map determining whether a certain character is a label character */ + protected array $labelCharMap; + /** + * @var array<string, array<string, int>> Map from token classes and subnode names to FIXUP_* constants. + * This is used during format-preserving prints to place additional parens/braces if necessary. + */ + protected array $fixupMap; + /** + * @var array<string, array{left?: int|string, right?: int|string}> Map from "{$node->getType()}->{$subNode}" + * to ['left' => $l, 'right' => $r], where $l and $r specify the token type that needs to be stripped + * when removing this node. + */ + protected array $removalMap; + /** + * @var array<string, array{int|string|null, bool, string|null, string|null}> Map from + * "{$node->getType()}->{$subNode}" to [$find, $beforeToken, $extraLeft, $extraRight]. + * $find is an optional token after which the insertion occurs. $extraLeft/Right + * are optionally added before/after the main insertions. + */ + protected array $insertionMap; + /** + * @var array<string, string> Map From "{$class}->{$subNode}" to string that should be inserted + * between elements of this list subnode. + */ + protected array $listInsertionMap; + + /** + * @var array<string, array{int|string|null, string, string}> + */ + protected array $emptyListInsertionMap; + /** @var array<string, array{string, int}> Map from "{$class}->{$subNode}" to [$printFn, $token] + * where $printFn is the function to print the modifiers and $token is the token before which + * the modifiers should be reprinted. */ + protected array $modifierChangeMap; + + /** + * Creates a pretty printer instance using the given options. + * + * Supported options: + * * PhpVersion $phpVersion: The PHP version to target (default to PHP 7.4). This option + * controls compatibility of the generated code with older PHP + * versions in cases where a simple stylistic choice exists (e.g. + * array() vs []). It is safe to pretty-print an AST for a newer + * PHP version while specifying an older target (but the result will + * of course not be compatible with the older version in that case). + * * string $newline: The newline style to use. Should be "\n" (default) or "\r\n". + * * bool $shortArraySyntax: Whether to use [] instead of array() as the default array + * syntax, if the node does not specify a format. Defaults to whether + * the phpVersion support short array syntax. + * + * @param array{ + * phpVersion?: PhpVersion, newline?: string, shortArraySyntax?: bool + * } $options Dictionary of formatting options + */ + public function __construct(array $options = []) { + $this->phpVersion = $options['phpVersion'] ?? PhpVersion::fromComponents(7, 4); + + $this->newline = $options['newline'] ?? "\n"; + if ($this->newline !== "\n" && $this->newline != "\r\n") { + throw new \LogicException('Option "newline" must be one of "\n" or "\r\n"'); + } + + $this->shortArraySyntax = + $options['shortArraySyntax'] ?? $this->phpVersion->supportsShortArraySyntax(); + $this->docStringEndToken = + $this->phpVersion->supportsFlexibleHeredoc() ? null : '_DOC_STRING_END_' . mt_rand(); + } + + /** + * Reset pretty printing state. + */ + protected function resetState(): void { + $this->indentLevel = 0; + $this->nl = $this->newline; + $this->origTokens = null; + } + + /** + * Set indentation level + * + * @param int $level Level in number of spaces + */ + protected function setIndentLevel(int $level): void { + $this->indentLevel = $level; + $this->nl = $this->newline . \str_repeat(' ', $level); + } + + /** + * Increase indentation level. + */ + protected function indent(): void { + $this->indentLevel += 4; + $this->nl .= ' '; + } + + /** + * Decrease indentation level. + */ + protected function outdent(): void { + assert($this->indentLevel >= 4); + $this->indentLevel -= 4; + $this->nl = $this->newline . str_repeat(' ', $this->indentLevel); + } + + /** + * Pretty prints an array of statements. + * + * @param Node[] $stmts Array of statements + * + * @return string Pretty printed statements + */ + public function prettyPrint(array $stmts): string { + $this->resetState(); + $this->preprocessNodes($stmts); + + return ltrim($this->handleMagicTokens($this->pStmts($stmts, false))); + } + + /** + * Pretty prints an expression. + * + * @param Expr $node Expression node + * + * @return string Pretty printed node + */ + public function prettyPrintExpr(Expr $node): string { + $this->resetState(); + return $this->handleMagicTokens($this->p($node)); + } + + /** + * Pretty prints a file of statements (includes the opening <?php tag if it is required). + * + * @param Node[] $stmts Array of statements + * + * @return string Pretty printed statements + */ + public function prettyPrintFile(array $stmts): string { + if (!$stmts) { + return "<?php" . $this->newline . $this->newline; + } + + $p = "<?php" . $this->newline . $this->newline . $this->prettyPrint($stmts); + + if ($stmts[0] instanceof Stmt\InlineHTML) { + $p = preg_replace('/^<\?php\s+\?>\r?\n?/', '', $p); + } + if ($stmts[count($stmts) - 1] instanceof Stmt\InlineHTML) { + $p = preg_replace('/<\?php$/', '', rtrim($p)); + } + + return $p; + } + + /** + * Preprocesses the top-level nodes to initialize pretty printer state. + * + * @param Node[] $nodes Array of nodes + */ + protected function preprocessNodes(array $nodes): void { + /* We can use semicolon-namespaces unless there is a global namespace declaration */ + $this->canUseSemicolonNamespaces = true; + foreach ($nodes as $node) { + if ($node instanceof Stmt\Namespace_ && null === $node->name) { + $this->canUseSemicolonNamespaces = false; + break; + } + } + } + + /** + * Handles (and removes) doc-string-end tokens. + */ + protected function handleMagicTokens(string $str): string { + if ($this->docStringEndToken !== null) { + // Replace doc-string-end tokens with nothing or a newline + $str = str_replace( + $this->docStringEndToken . ';' . $this->newline, + ';' . $this->newline, + $str); + $str = str_replace($this->docStringEndToken, $this->newline, $str); + } + + return $str; + } + + /** + * Pretty prints an array of nodes (statements) and indents them optionally. + * + * @param Node[] $nodes Array of nodes + * @param bool $indent Whether to indent the printed nodes + * + * @return string Pretty printed statements + */ + protected function pStmts(array $nodes, bool $indent = true): string { + if ($indent) { + $this->indent(); + } + + $result = ''; + foreach ($nodes as $node) { + $comments = $node->getComments(); + if ($comments) { + $result .= $this->nl . $this->pComments($comments); + if ($node instanceof Stmt\Nop) { + continue; + } + } + + $result .= $this->nl . $this->p($node); + } + + if ($indent) { + $this->outdent(); + } + + return $result; + } + + /** + * Pretty-print an infix operation while taking precedence into account. + * + * @param string $class Node class of operator + * @param Node $leftNode Left-hand side node + * @param string $operatorString String representation of the operator + * @param Node $rightNode Right-hand side node + * @param int $precedence Precedence of parent operator + * @param int $lhsPrecedence Precedence for unary operator on LHS of binary operator + * + * @return string Pretty printed infix operation + */ + protected function pInfixOp( + string $class, Node $leftNode, string $operatorString, Node $rightNode, + int $precedence, int $lhsPrecedence + ): string { + list($opPrecedence, $newPrecedenceLHS, $newPrecedenceRHS) = $this->precedenceMap[$class]; + $prefix = ''; + $suffix = ''; + if ($opPrecedence >= $precedence) { + $prefix = '('; + $suffix = ')'; + $lhsPrecedence = self::MAX_PRECEDENCE; + } + return $prefix . $this->p($leftNode, $newPrecedenceLHS, $newPrecedenceLHS) + . $operatorString . $this->p($rightNode, $newPrecedenceRHS, $lhsPrecedence) . $suffix; + } + + /** + * Pretty-print a prefix operation while taking precedence into account. + * + * @param string $class Node class of operator + * @param string $operatorString String representation of the operator + * @param Node $node Node + * @param int $precedence Precedence of parent operator + * @param int $lhsPrecedence Precedence for unary operator on LHS of binary operator + * + * @return string Pretty printed prefix operation + */ + protected function pPrefixOp(string $class, string $operatorString, Node $node, int $precedence, int $lhsPrecedence): string { + $opPrecedence = $this->precedenceMap[$class][0]; + $prefix = ''; + $suffix = ''; + if ($opPrecedence >= $lhsPrecedence) { + $prefix = '('; + $suffix = ')'; + $lhsPrecedence = self::MAX_PRECEDENCE; + } + $printedArg = $this->p($node, $opPrecedence, $lhsPrecedence); + if (($operatorString === '+' && $printedArg[0] === '+') || + ($operatorString === '-' && $printedArg[0] === '-') + ) { + // Avoid printing +(+$a) as ++$a and similar. + $printedArg = '(' . $printedArg . ')'; + } + return $prefix . $operatorString . $printedArg . $suffix; + } + + /** + * Pretty-print a postfix operation while taking precedence into account. + * + * @param string $class Node class of operator + * @param string $operatorString String representation of the operator + * @param Node $node Node + * @param int $precedence Precedence of parent operator + * @param int $lhsPrecedence Precedence for unary operator on LHS of binary operator + * + * @return string Pretty printed postfix operation + */ + protected function pPostfixOp(string $class, Node $node, string $operatorString, int $precedence, int $lhsPrecedence): string { + $opPrecedence = $this->precedenceMap[$class][0]; + $prefix = ''; + $suffix = ''; + if ($opPrecedence >= $precedence) { + $prefix = '('; + $suffix = ')'; + $lhsPrecedence = self::MAX_PRECEDENCE; + } + if ($opPrecedence < $lhsPrecedence) { + $lhsPrecedence = $opPrecedence; + } + return $prefix . $this->p($node, $opPrecedence, $lhsPrecedence) . $operatorString . $suffix; + } + + /** + * Pretty prints an array of nodes and implodes the printed values. + * + * @param Node[] $nodes Array of Nodes to be printed + * @param string $glue Character to implode with + * + * @return string Imploded pretty printed nodes> $pre + */ + protected function pImplode(array $nodes, string $glue = ''): string { + $pNodes = []; + foreach ($nodes as $node) { + if (null === $node) { + $pNodes[] = ''; + } else { + $pNodes[] = $this->p($node); + } + } + + return implode($glue, $pNodes); + } + + /** + * Pretty prints an array of nodes and implodes the printed values with commas. + * + * @param Node[] $nodes Array of Nodes to be printed + * + * @return string Comma separated pretty printed nodes + */ + protected function pCommaSeparated(array $nodes): string { + return $this->pImplode($nodes, ', '); + } + + /** + * Pretty prints a comma-separated list of nodes in multiline style, including comments. + * + * The result includes a leading newline and one level of indentation (same as pStmts). + * + * @param Node[] $nodes Array of Nodes to be printed + * @param bool $trailingComma Whether to use a trailing comma + * + * @return string Comma separated pretty printed nodes in multiline style + */ + protected function pCommaSeparatedMultiline(array $nodes, bool $trailingComma): string { + $this->indent(); + + $result = ''; + $lastIdx = count($nodes) - 1; + foreach ($nodes as $idx => $node) { + if ($node !== null) { + $comments = $node->getComments(); + if ($comments) { + $result .= $this->nl . $this->pComments($comments); + } + + $result .= $this->nl . $this->p($node); + } else { + $result .= $this->nl; + } + if ($trailingComma || $idx !== $lastIdx) { + $result .= ','; + } + } + + $this->outdent(); + return $result; + } + + /** + * Prints reformatted text of the passed comments. + * + * @param Comment[] $comments List of comments + * + * @return string Reformatted text of comments + */ + protected function pComments(array $comments): string { + $formattedComments = []; + + foreach ($comments as $comment) { + $formattedComments[] = str_replace("\n", $this->nl, $comment->getReformattedText()); + } + + return implode($this->nl, $formattedComments); + } + + /** + * Perform a format-preserving pretty print of an AST. + * + * The format preservation is best effort. For some changes to the AST the formatting will not + * be preserved (at least not locally). + * + * In order to use this method a number of prerequisites must be satisfied: + * * The startTokenPos and endTokenPos attributes in the lexer must be enabled. + * * The CloningVisitor must be run on the AST prior to modification. + * * The original tokens must be provided, using the getTokens() method on the lexer. + * + * @param Node[] $stmts Modified AST with links to original AST + * @param Node[] $origStmts Original AST with token offset information + * @param Token[] $origTokens Tokens of the original code + */ + public function printFormatPreserving(array $stmts, array $origStmts, array $origTokens): string { + $this->initializeNodeListDiffer(); + $this->initializeLabelCharMap(); + $this->initializeFixupMap(); + $this->initializeRemovalMap(); + $this->initializeInsertionMap(); + $this->initializeListInsertionMap(); + $this->initializeEmptyListInsertionMap(); + $this->initializeModifierChangeMap(); + + $this->resetState(); + $this->origTokens = new TokenStream($origTokens); + + $this->preprocessNodes($stmts); + + $pos = 0; + $result = $this->pArray($stmts, $origStmts, $pos, 0, 'File', 'stmts', null); + if (null !== $result) { + $result .= $this->origTokens->getTokenCode($pos, count($origTokens) - 1, 0); + } else { + // Fallback + // TODO Add <?php properly + $result = "<?php" . $this->newline . $this->pStmts($stmts, false); + } + + return $this->handleMagicTokens($result); + } + + protected function pFallback(Node $node, int $precedence, int $lhsPrecedence): string { + return $this->{'p' . $node->getType()}($node, $precedence, $lhsPrecedence); + } + + /** + * Pretty prints a node. + * + * This method also handles formatting preservation for nodes. + * + * @param Node $node Node to be pretty printed + * @param int $precedence Precedence of parent operator + * @param int $lhsPrecedence Precedence for unary operator on LHS of binary operator + * @param bool $parentFormatPreserved Whether parent node has preserved formatting + * + * @return string Pretty printed node + */ + protected function p( + Node $node, int $precedence = self::MAX_PRECEDENCE, int $lhsPrecedence = self::MAX_PRECEDENCE, + bool $parentFormatPreserved = false + ): string { + // No orig tokens means this is a normal pretty print without preservation of formatting + if (!$this->origTokens) { + return $this->{'p' . $node->getType()}($node, $precedence, $lhsPrecedence); + } + + /** @var Node|null $origNode */ + $origNode = $node->getAttribute('origNode'); + if (null === $origNode) { + return $this->pFallback($node, $precedence, $lhsPrecedence); + } + + $class = \get_class($node); + \assert($class === \get_class($origNode)); + + $startPos = $origNode->getStartTokenPos(); + $endPos = $origNode->getEndTokenPos(); + \assert($startPos >= 0 && $endPos >= 0); + + $fallbackNode = $node; + if ($node instanceof Expr\New_ && $node->class instanceof Stmt\Class_) { + // Normalize node structure of anonymous classes + assert($origNode instanceof Expr\New_); + $node = PrintableNewAnonClassNode::fromNewNode($node); + $origNode = PrintableNewAnonClassNode::fromNewNode($origNode); + $class = PrintableNewAnonClassNode::class; + } + + // InlineHTML node does not contain closing and opening PHP tags. If the parent formatting + // is not preserved, then we need to use the fallback code to make sure the tags are + // printed. + if ($node instanceof Stmt\InlineHTML && !$parentFormatPreserved) { + return $this->pFallback($fallbackNode, $precedence, $lhsPrecedence); + } + + $indentAdjustment = $this->indentLevel - $this->origTokens->getIndentationBefore($startPos); + + $type = $node->getType(); + $fixupInfo = $this->fixupMap[$class] ?? null; + + $result = ''; + $pos = $startPos; + foreach ($node->getSubNodeNames() as $subNodeName) { + $subNode = $node->$subNodeName; + $origSubNode = $origNode->$subNodeName; + + if ((!$subNode instanceof Node && $subNode !== null) + || (!$origSubNode instanceof Node && $origSubNode !== null) + ) { + if ($subNode === $origSubNode) { + // Unchanged, can reuse old code + continue; + } + + if (is_array($subNode) && is_array($origSubNode)) { + // Array subnode changed, we might be able to reconstruct it + $listResult = $this->pArray( + $subNode, $origSubNode, $pos, $indentAdjustment, $class, $subNodeName, + $fixupInfo[$subNodeName] ?? null + ); + if (null === $listResult) { + return $this->pFallback($fallbackNode, $precedence, $lhsPrecedence); + } + + $result .= $listResult; + continue; + } + + // Check if this is a modifier change + $key = $class . '->' . $subNodeName; + if (!isset($this->modifierChangeMap[$key])) { + return $this->pFallback($fallbackNode, $precedence, $lhsPrecedence); + } + + [$printFn, $findToken] = $this->modifierChangeMap[$key]; + $result .= $this->$printFn($subNode); + $pos = $this->origTokens->findRight($pos, $findToken); + continue; + } + + $extraLeft = ''; + $extraRight = ''; + if ($origSubNode !== null) { + $subStartPos = $origSubNode->getStartTokenPos(); + $subEndPos = $origSubNode->getEndTokenPos(); + \assert($subStartPos >= 0 && $subEndPos >= 0); + } else { + if ($subNode === null) { + // Both null, nothing to do + continue; + } + + // A node has been inserted, check if we have insertion information for it + $key = $type . '->' . $subNodeName; + if (!isset($this->insertionMap[$key])) { + return $this->pFallback($fallbackNode, $precedence, $lhsPrecedence); + } + + list($findToken, $beforeToken, $extraLeft, $extraRight) = $this->insertionMap[$key]; + if (null !== $findToken) { + $subStartPos = $this->origTokens->findRight($pos, $findToken) + + (int) !$beforeToken; + } else { + $subStartPos = $pos; + } + + if (null === $extraLeft && null !== $extraRight) { + // If inserting on the right only, skipping whitespace looks better + $subStartPos = $this->origTokens->skipRightWhitespace($subStartPos); + } + $subEndPos = $subStartPos - 1; + } + + if (null === $subNode) { + // A node has been removed, check if we have removal information for it + $key = $type . '->' . $subNodeName; + if (!isset($this->removalMap[$key])) { + return $this->pFallback($fallbackNode, $precedence, $lhsPrecedence); + } + + // Adjust positions to account for additional tokens that must be skipped + $removalInfo = $this->removalMap[$key]; + if (isset($removalInfo['left'])) { + $subStartPos = $this->origTokens->skipLeft($subStartPos - 1, $removalInfo['left']) + 1; + } + if (isset($removalInfo['right'])) { + $subEndPos = $this->origTokens->skipRight($subEndPos + 1, $removalInfo['right']) - 1; + } + } + + $result .= $this->origTokens->getTokenCode($pos, $subStartPos, $indentAdjustment); + + if (null !== $subNode) { + $result .= $extraLeft; + + $origIndentLevel = $this->indentLevel; + $this->setIndentLevel($this->origTokens->getIndentationBefore($subStartPos) + $indentAdjustment); + + // If it's the same node that was previously in this position, it certainly doesn't + // need fixup. It's important to check this here, because our fixup checks are more + // conservative than strictly necessary. + if (isset($fixupInfo[$subNodeName]) + && $subNode->getAttribute('origNode') !== $origSubNode + ) { + $fixup = $fixupInfo[$subNodeName]; + $res = $this->pFixup($fixup, $subNode, $class, $subStartPos, $subEndPos); + } else { + $res = $this->p($subNode, self::MAX_PRECEDENCE, self::MAX_PRECEDENCE, true); + } + + $this->safeAppend($result, $res); + $this->setIndentLevel($origIndentLevel); + + $result .= $extraRight; + } + + $pos = $subEndPos + 1; + } + + $result .= $this->origTokens->getTokenCode($pos, $endPos + 1, $indentAdjustment); + return $result; + } + + /** + * Perform a format-preserving pretty print of an array. + * + * @param Node[] $nodes New nodes + * @param Node[] $origNodes Original nodes + * @param int $pos Current token position (updated by reference) + * @param int $indentAdjustment Adjustment for indentation + * @param string $parentNodeClass Class of the containing node. + * @param string $subNodeName Name of array subnode. + * @param null|int $fixup Fixup information for array item nodes + * + * @return null|string Result of pretty print or null if cannot preserve formatting + */ + protected function pArray( + array $nodes, array $origNodes, int &$pos, int $indentAdjustment, + string $parentNodeClass, string $subNodeName, ?int $fixup + ): ?string { + $diff = $this->nodeListDiffer->diffWithReplacements($origNodes, $nodes); + + $mapKey = $parentNodeClass . '->' . $subNodeName; + $insertStr = $this->listInsertionMap[$mapKey] ?? null; + $isStmtList = $subNodeName === 'stmts'; + + $beforeFirstKeepOrReplace = true; + $skipRemovedNode = false; + $delayedAdd = []; + $lastElemIndentLevel = $this->indentLevel; + + $insertNewline = false; + if ($insertStr === "\n") { + $insertStr = ''; + $insertNewline = true; + } + + if ($isStmtList && \count($origNodes) === 1 && \count($nodes) !== 1) { + $startPos = $origNodes[0]->getStartTokenPos(); + $endPos = $origNodes[0]->getEndTokenPos(); + \assert($startPos >= 0 && $endPos >= 0); + if (!$this->origTokens->haveBraces($startPos, $endPos)) { + // This was a single statement without braces, but either additional statements + // have been added, or the single statement has been removed. This requires the + // addition of braces. For now fall back. + // TODO: Try to preserve formatting + return null; + } + } + + $result = ''; + foreach ($diff as $i => $diffElem) { + $diffType = $diffElem->type; + /** @var Node|string|null $arrItem */ + $arrItem = $diffElem->new; + /** @var Node|string|null $origArrItem */ + $origArrItem = $diffElem->old; + + if ($diffType === DiffElem::TYPE_KEEP || $diffType === DiffElem::TYPE_REPLACE) { + $beforeFirstKeepOrReplace = false; + + if ($origArrItem === null || $arrItem === null) { + // We can only handle the case where both are null + if ($origArrItem === $arrItem) { + continue; + } + return null; + } + + if (!$arrItem instanceof Node || !$origArrItem instanceof Node) { + // We can only deal with nodes. This can occur for Names, which use string arrays. + return null; + } + + $itemStartPos = $origArrItem->getStartTokenPos(); + $itemEndPos = $origArrItem->getEndTokenPos(); + \assert($itemStartPos >= 0 && $itemEndPos >= 0 && $itemStartPos >= $pos); + + $origIndentLevel = $this->indentLevel; + $lastElemIndentLevel = $this->origTokens->getIndentationBefore($itemStartPos) + $indentAdjustment; + $this->setIndentLevel($lastElemIndentLevel); + + $comments = $arrItem->getComments(); + $origComments = $origArrItem->getComments(); + $commentStartPos = $origComments ? $origComments[0]->getStartTokenPos() : $itemStartPos; + \assert($commentStartPos >= 0); + + if ($commentStartPos < $pos) { + // Comments may be assigned to multiple nodes if they start at the same position. + // Make sure we don't try to print them multiple times. + $commentStartPos = $itemStartPos; + } + + if ($skipRemovedNode) { + if ($isStmtList && $this->origTokens->haveTagInRange($pos, $itemStartPos)) { + // We'd remove an opening/closing PHP tag. + // TODO: Preserve formatting. + $this->setIndentLevel($origIndentLevel); + return null; + } + } else { + $result .= $this->origTokens->getTokenCode( + $pos, $commentStartPos, $indentAdjustment); + } + + if (!empty($delayedAdd)) { + /** @var Node $delayedAddNode */ + foreach ($delayedAdd as $delayedAddNode) { + if ($insertNewline) { + $delayedAddComments = $delayedAddNode->getComments(); + if ($delayedAddComments) { + $result .= $this->pComments($delayedAddComments) . $this->nl; + } + } + + $this->safeAppend($result, $this->p($delayedAddNode, self::MAX_PRECEDENCE, self::MAX_PRECEDENCE, true)); + + if ($insertNewline) { + $result .= $insertStr . $this->nl; + } else { + $result .= $insertStr; + } + } + + $delayedAdd = []; + } + + if ($comments !== $origComments) { + if ($comments) { + $result .= $this->pComments($comments) . $this->nl; + } + } else { + $result .= $this->origTokens->getTokenCode( + $commentStartPos, $itemStartPos, $indentAdjustment); + } + + // If we had to remove anything, we have done so now. + $skipRemovedNode = false; + } elseif ($diffType === DiffElem::TYPE_ADD) { + if (null === $insertStr) { + // We don't have insertion information for this list type + return null; + } + + if (!$arrItem instanceof Node) { + // We only support list insertion of nodes. + return null; + } + + // We go multiline if the original code was multiline, + // or if it's an array item with a comment above it. + // Match always uses multiline formatting. + if ($insertStr === ', ' && + ($this->isMultiline($origNodes) || $arrItem->getComments() || + $parentNodeClass === Expr\Match_::class) + ) { + $insertStr = ','; + $insertNewline = true; + } + + if ($beforeFirstKeepOrReplace) { + // Will be inserted at the next "replace" or "keep" element + $delayedAdd[] = $arrItem; + continue; + } + + $itemStartPos = $pos; + $itemEndPos = $pos - 1; + + $origIndentLevel = $this->indentLevel; + $this->setIndentLevel($lastElemIndentLevel); + + if ($insertNewline) { + $result .= $insertStr . $this->nl; + $comments = $arrItem->getComments(); + if ($comments) { + $result .= $this->pComments($comments) . $this->nl; + } + } else { + $result .= $insertStr; + } + } elseif ($diffType === DiffElem::TYPE_REMOVE) { + if (!$origArrItem instanceof Node) { + // We only support removal for nodes + return null; + } + + $itemStartPos = $origArrItem->getStartTokenPos(); + $itemEndPos = $origArrItem->getEndTokenPos(); + \assert($itemStartPos >= 0 && $itemEndPos >= 0); + + // Consider comments part of the node. + $origComments = $origArrItem->getComments(); + if ($origComments) { + $itemStartPos = $origComments[0]->getStartTokenPos(); + } + + if ($i === 0) { + // If we're removing from the start, keep the tokens before the node and drop those after it, + // instead of the other way around. + $result .= $this->origTokens->getTokenCode( + $pos, $itemStartPos, $indentAdjustment); + $skipRemovedNode = true; + } else { + if ($isStmtList && $this->origTokens->haveTagInRange($pos, $itemStartPos)) { + // We'd remove an opening/closing PHP tag. + // TODO: Preserve formatting. + return null; + } + } + + $pos = $itemEndPos + 1; + continue; + } else { + throw new \Exception("Shouldn't happen"); + } + + if (null !== $fixup && $arrItem->getAttribute('origNode') !== $origArrItem) { + $res = $this->pFixup($fixup, $arrItem, null, $itemStartPos, $itemEndPos); + } else { + $res = $this->p($arrItem, self::MAX_PRECEDENCE, self::MAX_PRECEDENCE, true); + } + $this->safeAppend($result, $res); + + $this->setIndentLevel($origIndentLevel); + $pos = $itemEndPos + 1; + } + + if ($skipRemovedNode) { + // TODO: Support removing single node. + return null; + } + + if (!empty($delayedAdd)) { + if (!isset($this->emptyListInsertionMap[$mapKey])) { + return null; + } + + list($findToken, $extraLeft, $extraRight) = $this->emptyListInsertionMap[$mapKey]; + if (null !== $findToken) { + $insertPos = $this->origTokens->findRight($pos, $findToken) + 1; + $result .= $this->origTokens->getTokenCode($pos, $insertPos, $indentAdjustment); + $pos = $insertPos; + } + + $first = true; + $result .= $extraLeft; + foreach ($delayedAdd as $delayedAddNode) { + if (!$first) { + $result .= $insertStr; + if ($insertNewline) { + $result .= $this->nl; + } + } + $result .= $this->p($delayedAddNode, self::MAX_PRECEDENCE, self::MAX_PRECEDENCE, true); + $first = false; + } + $result .= $extraRight === "\n" ? $this->nl : $extraRight; + } + + return $result; + } + + /** + * Print node with fixups. + * + * Fixups here refer to the addition of extra parentheses, braces or other characters, that + * are required to preserve program semantics in a certain context (e.g. to maintain precedence + * or because only certain expressions are allowed in certain places). + * + * @param int $fixup Fixup type + * @param Node $subNode Subnode to print + * @param string|null $parentClass Class of parent node + * @param int $subStartPos Original start pos of subnode + * @param int $subEndPos Original end pos of subnode + * + * @return string Result of fixed-up print of subnode + */ + protected function pFixup(int $fixup, Node $subNode, ?string $parentClass, int $subStartPos, int $subEndPos): string { + switch ($fixup) { + case self::FIXUP_PREC_LEFT: + // We use a conservative approximation where lhsPrecedence == precedence. + if (!$this->origTokens->haveParens($subStartPos, $subEndPos)) { + $precedence = $this->precedenceMap[$parentClass][1]; + return $this->p($subNode, $precedence, $precedence); + } + break; + case self::FIXUP_PREC_RIGHT: + if (!$this->origTokens->haveParens($subStartPos, $subEndPos)) { + $precedence = $this->precedenceMap[$parentClass][2]; + return $this->p($subNode, $precedence, $precedence); + } + break; + case self::FIXUP_PREC_UNARY: + if (!$this->origTokens->haveParens($subStartPos, $subEndPos)) { + $precedence = $this->precedenceMap[$parentClass][0]; + return $this->p($subNode, $precedence, $precedence); + } + break; + case self::FIXUP_CALL_LHS: + if ($this->callLhsRequiresParens($subNode) + && !$this->origTokens->haveParens($subStartPos, $subEndPos) + ) { + return '(' . $this->p($subNode) . ')'; + } + break; + case self::FIXUP_DEREF_LHS: + if ($this->dereferenceLhsRequiresParens($subNode) + && !$this->origTokens->haveParens($subStartPos, $subEndPos) + ) { + return '(' . $this->p($subNode) . ')'; + } + break; + case self::FIXUP_STATIC_DEREF_LHS: + if ($this->staticDereferenceLhsRequiresParens($subNode) + && !$this->origTokens->haveParens($subStartPos, $subEndPos) + ) { + return '(' . $this->p($subNode) . ')'; + } + break; + case self::FIXUP_NEW: + if ($this->newOperandRequiresParens($subNode) + && !$this->origTokens->haveParens($subStartPos, $subEndPos)) { + return '(' . $this->p($subNode) . ')'; + } + break; + case self::FIXUP_BRACED_NAME: + case self::FIXUP_VAR_BRACED_NAME: + if ($subNode instanceof Expr + && !$this->origTokens->haveBraces($subStartPos, $subEndPos) + ) { + return ($fixup === self::FIXUP_VAR_BRACED_NAME ? '$' : '') + . '{' . $this->p($subNode) . '}'; + } + break; + case self::FIXUP_ENCAPSED: + if (!$subNode instanceof Node\InterpolatedStringPart + && !$this->origTokens->haveBraces($subStartPos, $subEndPos) + ) { + return '{' . $this->p($subNode) . '}'; + } + break; + default: + throw new \Exception('Cannot happen'); + } + + // Nothing special to do + return $this->p($subNode); + } + + /** + * Appends to a string, ensuring whitespace between label characters. + * + * Example: "echo" and "$x" result in "echo$x", but "echo" and "x" result in "echo x". + * Without safeAppend the result would be "echox", which does not preserve semantics. + */ + protected function safeAppend(string &$str, string $append): void { + if ($str === "") { + $str = $append; + return; + } + + if ($append === "") { + return; + } + + if (!$this->labelCharMap[$append[0]] + || !$this->labelCharMap[$str[\strlen($str) - 1]]) { + $str .= $append; + } else { + $str .= " " . $append; + } + } + + /** + * Determines whether the LHS of a call must be wrapped in parenthesis. + * + * @param Node $node LHS of a call + * + * @return bool Whether parentheses are required + */ + protected function callLhsRequiresParens(Node $node): bool { + return !($node instanceof Node\Name + || $node instanceof Expr\Variable + || $node instanceof Expr\ArrayDimFetch + || $node instanceof Expr\FuncCall + || $node instanceof Expr\MethodCall + || $node instanceof Expr\NullsafeMethodCall + || $node instanceof Expr\StaticCall + || $node instanceof Expr\Array_); + } + + /** + * Determines whether the LHS of an array/object operation must be wrapped in parentheses. + * + * @param Node $node LHS of dereferencing operation + * + * @return bool Whether parentheses are required + */ + protected function dereferenceLhsRequiresParens(Node $node): bool { + // A constant can occur on the LHS of an array/object deref, but not a static deref. + return $this->staticDereferenceLhsRequiresParens($node) + && !$node instanceof Expr\ConstFetch; + } + + /** + * Determines whether the LHS of a static operation must be wrapped in parentheses. + * + * @param Node $node LHS of dereferencing operation + * + * @return bool Whether parentheses are required + */ + protected function staticDereferenceLhsRequiresParens(Node $node): bool { + return !($node instanceof Expr\Variable + || $node instanceof Node\Name + || $node instanceof Expr\ArrayDimFetch + || $node instanceof Expr\PropertyFetch + || $node instanceof Expr\NullsafePropertyFetch + || $node instanceof Expr\StaticPropertyFetch + || $node instanceof Expr\FuncCall + || $node instanceof Expr\MethodCall + || $node instanceof Expr\NullsafeMethodCall + || $node instanceof Expr\StaticCall + || $node instanceof Expr\Array_ + || $node instanceof Scalar\String_ + || $node instanceof Expr\ClassConstFetch); + } + + /** + * Determines whether an expression used in "new" or "instanceof" requires parentheses. + * + * @param Node $node New or instanceof operand + * + * @return bool Whether parentheses are required + */ + protected function newOperandRequiresParens(Node $node): bool { + if ($node instanceof Node\Name || $node instanceof Expr\Variable) { + return false; + } + if ($node instanceof Expr\ArrayDimFetch || $node instanceof Expr\PropertyFetch || + $node instanceof Expr\NullsafePropertyFetch + ) { + return $this->newOperandRequiresParens($node->var); + } + if ($node instanceof Expr\StaticPropertyFetch) { + return $this->newOperandRequiresParens($node->class); + } + return true; + } + + /** + * Print modifiers, including trailing whitespace. + * + * @param int $modifiers Modifier mask to print + * + * @return string Printed modifiers + */ + protected function pModifiers(int $modifiers): string { + return ($modifiers & Modifiers::FINAL ? 'final ' : '') + . ($modifiers & Modifiers::ABSTRACT ? 'abstract ' : '') + . ($modifiers & Modifiers::PUBLIC ? 'public ' : '') + . ($modifiers & Modifiers::PROTECTED ? 'protected ' : '') + . ($modifiers & Modifiers::PRIVATE ? 'private ' : '') + . ($modifiers & Modifiers::STATIC ? 'static ' : '') + . ($modifiers & Modifiers::READONLY ? 'readonly ' : ''); + } + + protected function pStatic(bool $static): string { + return $static ? 'static ' : ''; + } + + /** + * Determine whether a list of nodes uses multiline formatting. + * + * @param (Node|null)[] $nodes Node list + * + * @return bool Whether multiline formatting is used + */ + protected function isMultiline(array $nodes): bool { + if (\count($nodes) < 2) { + return false; + } + + $pos = -1; + foreach ($nodes as $node) { + if (null === $node) { + continue; + } + + $endPos = $node->getEndTokenPos() + 1; + if ($pos >= 0) { + $text = $this->origTokens->getTokenCode($pos, $endPos, 0); + if (false === strpos($text, "\n")) { + // We require that a newline is present between *every* item. If the formatting + // is inconsistent, with only some items having newlines, we don't consider it + // as multiline + return false; + } + } + $pos = $endPos; + } + + return true; + } + + /** + * Lazily initializes label char map. + * + * The label char map determines whether a certain character may occur in a label. + */ + protected function initializeLabelCharMap(): void { + if (isset($this->labelCharMap)) { + return; + } + + $this->labelCharMap = []; + for ($i = 0; $i < 256; $i++) { + $chr = chr($i); + $this->labelCharMap[$chr] = $i >= 0x80 || ctype_alnum($chr); + } + + if ($this->phpVersion->allowsDelInIdentifiers()) { + $this->labelCharMap["\x7f"] = true; + } + } + + /** + * Lazily initializes node list differ. + * + * The node list differ is used to determine differences between two array subnodes. + */ + protected function initializeNodeListDiffer(): void { + if (isset($this->nodeListDiffer)) { + return; + } + + $this->nodeListDiffer = new Internal\Differ(function ($a, $b) { + if ($a instanceof Node && $b instanceof Node) { + return $a === $b->getAttribute('origNode'); + } + // Can happen for array destructuring + return $a === null && $b === null; + }); + } + + /** + * Lazily initializes fixup map. + * + * The fixup map is used to determine whether a certain subnode of a certain node may require + * some kind of "fixup" operation, e.g. the addition of parenthesis or braces. + */ + protected function initializeFixupMap(): void { + if (isset($this->fixupMap)) { + return; + } + + $this->fixupMap = [ + Expr\Instanceof_::class => [ + 'expr' => self::FIXUP_PREC_UNARY, + 'class' => self::FIXUP_NEW, + ], + Expr\Ternary::class => [ + 'cond' => self::FIXUP_PREC_LEFT, + 'else' => self::FIXUP_PREC_RIGHT, + ], + Expr\Yield_::class => ['value' => self::FIXUP_PREC_UNARY], + + Expr\FuncCall::class => ['name' => self::FIXUP_CALL_LHS], + Expr\StaticCall::class => ['class' => self::FIXUP_STATIC_DEREF_LHS], + Expr\ArrayDimFetch::class => ['var' => self::FIXUP_DEREF_LHS], + Expr\ClassConstFetch::class => [ + 'class' => self::FIXUP_STATIC_DEREF_LHS, + 'name' => self::FIXUP_BRACED_NAME, + ], + Expr\New_::class => ['class' => self::FIXUP_NEW], + Expr\MethodCall::class => [ + 'var' => self::FIXUP_DEREF_LHS, + 'name' => self::FIXUP_BRACED_NAME, + ], + Expr\NullsafeMethodCall::class => [ + 'var' => self::FIXUP_DEREF_LHS, + 'name' => self::FIXUP_BRACED_NAME, + ], + Expr\StaticPropertyFetch::class => [ + 'class' => self::FIXUP_STATIC_DEREF_LHS, + 'name' => self::FIXUP_VAR_BRACED_NAME, + ], + Expr\PropertyFetch::class => [ + 'var' => self::FIXUP_DEREF_LHS, + 'name' => self::FIXUP_BRACED_NAME, + ], + Expr\NullsafePropertyFetch::class => [ + 'var' => self::FIXUP_DEREF_LHS, + 'name' => self::FIXUP_BRACED_NAME, + ], + Scalar\InterpolatedString::class => [ + 'parts' => self::FIXUP_ENCAPSED, + ], + ]; + + $binaryOps = [ + BinaryOp\Pow::class, BinaryOp\Mul::class, BinaryOp\Div::class, BinaryOp\Mod::class, + BinaryOp\Plus::class, BinaryOp\Minus::class, BinaryOp\Concat::class, + BinaryOp\ShiftLeft::class, BinaryOp\ShiftRight::class, BinaryOp\Smaller::class, + BinaryOp\SmallerOrEqual::class, BinaryOp\Greater::class, BinaryOp\GreaterOrEqual::class, + BinaryOp\Equal::class, BinaryOp\NotEqual::class, BinaryOp\Identical::class, + BinaryOp\NotIdentical::class, BinaryOp\Spaceship::class, BinaryOp\BitwiseAnd::class, + BinaryOp\BitwiseXor::class, BinaryOp\BitwiseOr::class, BinaryOp\BooleanAnd::class, + BinaryOp\BooleanOr::class, BinaryOp\Coalesce::class, BinaryOp\LogicalAnd::class, + BinaryOp\LogicalXor::class, BinaryOp\LogicalOr::class, + ]; + foreach ($binaryOps as $binaryOp) { + $this->fixupMap[$binaryOp] = [ + 'left' => self::FIXUP_PREC_LEFT, + 'right' => self::FIXUP_PREC_RIGHT + ]; + } + + $prefixOps = [ + Expr\Clone_::class, Expr\BitwiseNot::class, Expr\BooleanNot::class, Expr\UnaryPlus::class, Expr\UnaryMinus::class, + Cast\Int_::class, Cast\Double::class, Cast\String_::class, Cast\Array_::class, + Cast\Object_::class, Cast\Bool_::class, Cast\Unset_::class, Expr\ErrorSuppress::class, + Expr\YieldFrom::class, Expr\Print_::class, Expr\Include_::class, + Expr\Assign::class, Expr\AssignRef::class, AssignOp\Plus::class, AssignOp\Minus::class, + AssignOp\Mul::class, AssignOp\Div::class, AssignOp\Concat::class, AssignOp\Mod::class, + AssignOp\BitwiseAnd::class, AssignOp\BitwiseOr::class, AssignOp\BitwiseXor::class, + AssignOp\ShiftLeft::class, AssignOp\ShiftRight::class, AssignOp\Pow::class, AssignOp\Coalesce::class, + Expr\ArrowFunction::class, Expr\Throw_::class, + ]; + foreach ($prefixOps as $prefixOp) { + $this->fixupMap[$prefixOp] = ['expr' => self::FIXUP_PREC_UNARY]; + } + } + + /** + * Lazily initializes the removal map. + * + * The removal map is used to determine which additional tokens should be removed when a + * certain node is replaced by null. + */ + protected function initializeRemovalMap(): void { + if (isset($this->removalMap)) { + return; + } + + $stripBoth = ['left' => \T_WHITESPACE, 'right' => \T_WHITESPACE]; + $stripLeft = ['left' => \T_WHITESPACE]; + $stripRight = ['right' => \T_WHITESPACE]; + $stripDoubleArrow = ['right' => \T_DOUBLE_ARROW]; + $stripColon = ['left' => ':']; + $stripEquals = ['left' => '=']; + $this->removalMap = [ + 'Expr_ArrayDimFetch->dim' => $stripBoth, + 'ArrayItem->key' => $stripDoubleArrow, + 'Expr_ArrowFunction->returnType' => $stripColon, + 'Expr_Closure->returnType' => $stripColon, + 'Expr_Exit->expr' => $stripBoth, + 'Expr_Ternary->if' => $stripBoth, + 'Expr_Yield->key' => $stripDoubleArrow, + 'Expr_Yield->value' => $stripBoth, + 'Param->type' => $stripRight, + 'Param->default' => $stripEquals, + 'Stmt_Break->num' => $stripBoth, + 'Stmt_Catch->var' => $stripLeft, + 'Stmt_ClassConst->type' => $stripRight, + 'Stmt_ClassMethod->returnType' => $stripColon, + 'Stmt_Class->extends' => ['left' => \T_EXTENDS], + 'Stmt_Enum->scalarType' => $stripColon, + 'Stmt_EnumCase->expr' => $stripEquals, + 'Expr_PrintableNewAnonClass->extends' => ['left' => \T_EXTENDS], + 'Stmt_Continue->num' => $stripBoth, + 'Stmt_Foreach->keyVar' => $stripDoubleArrow, + 'Stmt_Function->returnType' => $stripColon, + 'Stmt_If->else' => $stripLeft, + 'Stmt_Namespace->name' => $stripLeft, + 'Stmt_Property->type' => $stripRight, + 'PropertyItem->default' => $stripEquals, + 'Stmt_Return->expr' => $stripBoth, + 'Stmt_StaticVar->default' => $stripEquals, + 'Stmt_TraitUseAdaptation_Alias->newName' => $stripLeft, + 'Stmt_TryCatch->finally' => $stripLeft, + // 'Stmt_Case->cond': Replace with "default" + // 'Stmt_Class->name': Unclear what to do + // 'Stmt_Declare->stmts': Not a plain node + // 'Stmt_TraitUseAdaptation_Alias->newModifier': Not a plain node + ]; + } + + protected function initializeInsertionMap(): void { + if (isset($this->insertionMap)) { + return; + } + + // TODO: "yield" where both key and value are inserted doesn't work + // [$find, $beforeToken, $extraLeft, $extraRight] + $this->insertionMap = [ + 'Expr_ArrayDimFetch->dim' => ['[', false, null, null], + 'ArrayItem->key' => [null, false, null, ' => '], + 'Expr_ArrowFunction->returnType' => [')', false, ': ', null], + 'Expr_Closure->returnType' => [')', false, ': ', null], + 'Expr_Ternary->if' => ['?', false, ' ', ' '], + 'Expr_Yield->key' => [\T_YIELD, false, null, ' => '], + 'Expr_Yield->value' => [\T_YIELD, false, ' ', null], + 'Param->type' => [null, false, null, ' '], + 'Param->default' => [null, false, ' = ', null], + 'Stmt_Break->num' => [\T_BREAK, false, ' ', null], + 'Stmt_Catch->var' => [null, false, ' ', null], + 'Stmt_ClassMethod->returnType' => [')', false, ': ', null], + 'Stmt_ClassConst->type' => [\T_CONST, false, ' ', null], + 'Stmt_Class->extends' => [null, false, ' extends ', null], + 'Stmt_Enum->scalarType' => [null, false, ' : ', null], + 'Stmt_EnumCase->expr' => [null, false, ' = ', null], + 'Expr_PrintableNewAnonClass->extends' => [null, false, ' extends ', null], + 'Stmt_Continue->num' => [\T_CONTINUE, false, ' ', null], + 'Stmt_Foreach->keyVar' => [\T_AS, false, null, ' => '], + 'Stmt_Function->returnType' => [')', false, ': ', null], + 'Stmt_If->else' => [null, false, ' ', null], + 'Stmt_Namespace->name' => [\T_NAMESPACE, false, ' ', null], + 'Stmt_Property->type' => [\T_VARIABLE, true, null, ' '], + 'PropertyItem->default' => [null, false, ' = ', null], + 'Stmt_Return->expr' => [\T_RETURN, false, ' ', null], + 'Stmt_StaticVar->default' => [null, false, ' = ', null], + //'Stmt_TraitUseAdaptation_Alias->newName' => [T_AS, false, ' ', null], // TODO + 'Stmt_TryCatch->finally' => [null, false, ' ', null], + + // 'Expr_Exit->expr': Complicated due to optional () + // 'Stmt_Case->cond': Conversion from default to case + // 'Stmt_Class->name': Unclear + // 'Stmt_Declare->stmts': Not a proper node + // 'Stmt_TraitUseAdaptation_Alias->newModifier': Not a proper node + ]; + } + + protected function initializeListInsertionMap(): void { + if (isset($this->listInsertionMap)) { + return; + } + + $this->listInsertionMap = [ + // special + //'Expr_ShellExec->parts' => '', // TODO These need to be treated more carefully + //'Scalar_InterpolatedString->parts' => '', + Stmt\Catch_::class . '->types' => '|', + UnionType::class . '->types' => '|', + IntersectionType::class . '->types' => '&', + Stmt\If_::class . '->elseifs' => ' ', + Stmt\TryCatch::class . '->catches' => ' ', + + // comma-separated lists + Expr\Array_::class . '->items' => ', ', + Expr\ArrowFunction::class . '->params' => ', ', + Expr\Closure::class . '->params' => ', ', + Expr\Closure::class . '->uses' => ', ', + Expr\FuncCall::class . '->args' => ', ', + Expr\Isset_::class . '->vars' => ', ', + Expr\List_::class . '->items' => ', ', + Expr\MethodCall::class . '->args' => ', ', + Expr\NullsafeMethodCall::class . '->args' => ', ', + Expr\New_::class . '->args' => ', ', + PrintableNewAnonClassNode::class . '->args' => ', ', + Expr\StaticCall::class . '->args' => ', ', + Stmt\ClassConst::class . '->consts' => ', ', + Stmt\ClassMethod::class . '->params' => ', ', + Stmt\Class_::class . '->implements' => ', ', + Stmt\Enum_::class . '->implements' => ', ', + PrintableNewAnonClassNode::class . '->implements' => ', ', + Stmt\Const_::class . '->consts' => ', ', + Stmt\Declare_::class . '->declares' => ', ', + Stmt\Echo_::class . '->exprs' => ', ', + Stmt\For_::class . '->init' => ', ', + Stmt\For_::class . '->cond' => ', ', + Stmt\For_::class . '->loop' => ', ', + Stmt\Function_::class . '->params' => ', ', + Stmt\Global_::class . '->vars' => ', ', + Stmt\GroupUse::class . '->uses' => ', ', + Stmt\Interface_::class . '->extends' => ', ', + Expr\Match_::class . '->arms' => ', ', + Stmt\Property::class . '->props' => ', ', + Stmt\StaticVar::class . '->vars' => ', ', + Stmt\TraitUse::class . '->traits' => ', ', + Stmt\TraitUseAdaptation\Precedence::class . '->insteadof' => ', ', + Stmt\Unset_::class . '->vars' => ', ', + Stmt\UseUse::class . '->uses' => ', ', + MatchArm::class . '->conds' => ', ', + AttributeGroup::class . '->attrs' => ', ', + + // statement lists + Expr\Closure::class . '->stmts' => "\n", + Stmt\Case_::class . '->stmts' => "\n", + Stmt\Catch_::class . '->stmts' => "\n", + Stmt\Class_::class . '->stmts' => "\n", + Stmt\Enum_::class . '->stmts' => "\n", + PrintableNewAnonClassNode::class . '->stmts' => "\n", + Stmt\Interface_::class . '->stmts' => "\n", + Stmt\Trait_::class . '->stmts' => "\n", + Stmt\ClassMethod::class . '->stmts' => "\n", + Stmt\Declare_::class . '->stmts' => "\n", + Stmt\Do_::class . '->stmts' => "\n", + Stmt\ElseIf_::class . '->stmts' => "\n", + Stmt\Else_::class . '->stmts' => "\n", + Stmt\Finally_::class . '->stmts' => "\n", + Stmt\Foreach_::class . '->stmts' => "\n", + Stmt\For_::class . '->stmts' => "\n", + Stmt\Function_::class . '->stmts' => "\n", + Stmt\If_::class . '->stmts' => "\n", + Stmt\Namespace_::class . '->stmts' => "\n", + Stmt\Block::class . '->stmts' => "\n", + + // Attribute groups + Stmt\Class_::class . '->attrGroups' => "\n", + Stmt\Enum_::class . '->attrGroups' => "\n", + Stmt\EnumCase::class . '->attrGroups' => "\n", + Stmt\Interface_::class . '->attrGroups' => "\n", + Stmt\Trait_::class . '->attrGroups' => "\n", + Stmt\Function_::class . '->attrGroups' => "\n", + Stmt\ClassMethod::class . '->attrGroups' => "\n", + Stmt\ClassConst::class . '->attrGroups' => "\n", + Stmt\Property::class . '->attrGroups' => "\n", + PrintableNewAnonClassNode::class . '->attrGroups' => ' ', + Expr\Closure::class . '->attrGroups' => ' ', + Expr\ArrowFunction::class . '->attrGroups' => ' ', + Param::class . '->attrGroups' => ' ', + Stmt\Switch_::class . '->cases' => "\n", + Stmt\TraitUse::class . '->adaptations' => "\n", + Stmt\TryCatch::class . '->stmts' => "\n", + Stmt\While_::class . '->stmts' => "\n", + + // dummy for top-level context + 'File->stmts' => "\n", + ]; + } + + protected function initializeEmptyListInsertionMap(): void { + if (isset($this->emptyListInsertionMap)) { + return; + } + + // TODO Insertion into empty statement lists. + + // [$find, $extraLeft, $extraRight] + $this->emptyListInsertionMap = [ + Expr\ArrowFunction::class . '->params' => ['(', '', ''], + Expr\Closure::class . '->uses' => [')', ' use (', ')'], + Expr\Closure::class . '->params' => ['(', '', ''], + Expr\FuncCall::class . '->args' => ['(', '', ''], + Expr\MethodCall::class . '->args' => ['(', '', ''], + Expr\NullsafeMethodCall::class . '->args' => ['(', '', ''], + Expr\New_::class . '->args' => ['(', '', ''], + PrintableNewAnonClassNode::class . '->args' => ['(', '', ''], + PrintableNewAnonClassNode::class . '->implements' => [null, ' implements ', ''], + Expr\StaticCall::class . '->args' => ['(', '', ''], + Stmt\Class_::class . '->implements' => [null, ' implements ', ''], + Stmt\Enum_::class . '->implements' => [null, ' implements ', ''], + Stmt\ClassMethod::class . '->params' => ['(', '', ''], + Stmt\Interface_::class . '->extends' => [null, ' extends ', ''], + Stmt\Function_::class . '->params' => ['(', '', ''], + Stmt\Interface_::class . '->attrGroups' => [null, '', "\n"], + Stmt\Class_::class . '->attrGroups' => [null, '', "\n"], + Stmt\ClassConst::class . '->attrGroups' => [null, '', "\n"], + Stmt\ClassMethod::class . '->attrGroups' => [null, '', "\n"], + Stmt\Function_::class . '->attrGroups' => [null, '', "\n"], + Stmt\Property::class . '->attrGroups' => [null, '', "\n"], + Stmt\Trait_::class . '->attrGroups' => [null, '', "\n"], + Expr\ArrowFunction::class . '->attrGroups' => [null, '', ' '], + Expr\Closure::class . '->attrGroups' => [null, '', ' '], + PrintableNewAnonClassNode::class . '->attrGroups' => [\T_NEW, ' ', ''], + + /* These cannot be empty to start with: + * Expr_Isset->vars + * Stmt_Catch->types + * Stmt_Const->consts + * Stmt_ClassConst->consts + * Stmt_Declare->declares + * Stmt_Echo->exprs + * Stmt_Global->vars + * Stmt_GroupUse->uses + * Stmt_Property->props + * Stmt_StaticVar->vars + * Stmt_TraitUse->traits + * Stmt_TraitUseAdaptation_Precedence->insteadof + * Stmt_Unset->vars + * Stmt_Use->uses + * UnionType->types + */ + + /* TODO + * Stmt_If->elseifs + * Stmt_TryCatch->catches + * Expr_Array->items + * Expr_List->items + * Stmt_For->init + * Stmt_For->cond + * Stmt_For->loop + */ + ]; + } + + protected function initializeModifierChangeMap(): void { + if (isset($this->modifierChangeMap)) { + return; + } + + $this->modifierChangeMap = [ + Stmt\ClassConst::class . '->flags' => ['pModifiers', \T_CONST], + Stmt\ClassMethod::class . '->flags' => ['pModifiers', \T_FUNCTION], + Stmt\Class_::class . '->flags' => ['pModifiers', \T_CLASS], + Stmt\Property::class . '->flags' => ['pModifiers', \T_VARIABLE], + PrintableNewAnonClassNode::class . '->flags' => ['pModifiers', \T_CLASS], + Param::class . '->flags' => ['pModifiers', \T_VARIABLE], + Expr\Closure::class . '->static' => ['pStatic', \T_FUNCTION], + Expr\ArrowFunction::class . '->static' => ['pStatic', \T_FN], + //Stmt\TraitUseAdaptation\Alias::class . '->newModifier' => 0, // TODO + ]; + + // List of integer subnodes that are not modifiers: + // Expr_Include->type + // Stmt_GroupUse->type + // Stmt_Use->type + // UseItem->type + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Token.php b/vendor/nikic/php-parser/lib/PhpParser/Token.php new file mode 100644 index 00000000..6683310f --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Token.php @@ -0,0 +1,18 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +/** + * A PHP token. On PHP 8.0 this extends from PhpToken. + */ +class Token extends Internal\TokenPolyfill { + /** Get (exclusive) zero-based end position of the token. */ + public function getEndPos(): int { + return $this->pos + \strlen($this->text); + } + + /** Get 1-based end line number of the token. */ + public function getEndLine(): int { + return $this->line + \substr_count($this->text, "\n"); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/compatibility_tokens.php b/vendor/nikic/php-parser/lib/PhpParser/compatibility_tokens.php new file mode 100644 index 00000000..273271dd --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/compatibility_tokens.php @@ -0,0 +1,63 @@ +<?php declare(strict_types=1); + +namespace PhpParser; + +if (!\function_exists('PhpParser\defineCompatibilityTokens')) { + function defineCompatibilityTokens(): void { + $compatTokens = [ + // PHP 8.0 + 'T_NAME_QUALIFIED', + 'T_NAME_FULLY_QUALIFIED', + 'T_NAME_RELATIVE', + 'T_MATCH', + 'T_NULLSAFE_OBJECT_OPERATOR', + 'T_ATTRIBUTE', + // PHP 8.1 + 'T_ENUM', + 'T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG', + 'T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG', + 'T_READONLY', + ]; + + // PHP-Parser might be used together with another library that also emulates some or all + // of these tokens. Perform a sanity-check that all already defined tokens have been + // assigned a unique ID. + $usedTokenIds = []; + foreach ($compatTokens as $token) { + if (\defined($token)) { + $tokenId = \constant($token); + if (!\is_int($tokenId)) { + throw new \Error(sprintf( + 'Token %s has ID of type %s, should be int. ' . + 'You may be using a library with broken token emulation', + $token, \gettype($tokenId) + )); + } + $clashingToken = $usedTokenIds[$tokenId] ?? null; + if ($clashingToken !== null) { + throw new \Error(sprintf( + 'Token %s has same ID as token %s, ' . + 'you may be using a library with broken token emulation', + $token, $clashingToken + )); + } + $usedTokenIds[$tokenId] = $token; + } + } + + // Now define any tokens that have not yet been emulated. Try to assign IDs from -1 + // downwards, but skip any IDs that may already be in use. + $newTokenId = -1; + foreach ($compatTokens as $token) { + if (!\defined($token)) { + while (isset($usedTokenIds[$newTokenId])) { + $newTokenId--; + } + \define($token, $newTokenId); + $newTokenId--; + } + } + } + + defineCompatibilityTokens(); +} diff --git a/vendor/nunomaduro/collision/.temp/.gitkeep b/vendor/nunomaduro/collision/.temp/.gitkeep new file mode 100644 index 00000000..45adbb22 --- /dev/null +++ b/vendor/nunomaduro/collision/.temp/.gitkeep @@ -0,0 +1 @@ +.gitkeep \ No newline at end of file diff --git a/vendor/nunomaduro/collision/LICENSE.md b/vendor/nunomaduro/collision/LICENSE.md new file mode 100755 index 00000000..14b90ed4 --- /dev/null +++ b/vendor/nunomaduro/collision/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Nuno Maduro <enunomaduro@gmail.com> + +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/vendor/nunomaduro/collision/README.md b/vendor/nunomaduro/collision/README.md new file mode 100644 index 00000000..320e6973 --- /dev/null +++ b/vendor/nunomaduro/collision/README.md @@ -0,0 +1,67 @@ +<p align="center"> + <img src="https://raw.githubusercontent.com/nunomaduro/collision/v7.x/docs/logo.png" alt="Collision logo" width="480"> + <br> + <img src="https://raw.githubusercontent.com/nunomaduro/collision/v7.x/docs/example.png" alt="Collision code example" height="300"> +</p> + +<p align="center"> + <a href="https://github.com/nunomaduro/collision/actions"><img src="https://img.shields.io/github/actions/workflow/status/nunomaduro/collision/tests.yml?branch=v7.x&label=tests&style=round-square" alt="Build Status"></img></a> + <a href="https://scrutinizer-ci.com/g/nunomaduro/collision"><img src="https://img.shields.io/scrutinizer/g/nunomaduro/collision.svg" alt="Quality Score"></img></a> + <a href="https://packagist.org/packages/nunomaduro/collision"><img src="https://poser.pugx.org/nunomaduro/collision/d/total.svg" alt="Total Downloads"></a> + <a href="https://packagist.org/packages/nunomaduro/collision"><img src="https://poser.pugx.org/nunomaduro/collision/license.svg" alt="License"></a> +</p> + +--- + +Collision was created by, and is maintained by **[Nuno Maduro](https://github.com/nunomaduro)**, and is a package designed to give you beautiful error reporting when interacting with your app through the command line. + +* It's included on **[Laravel](https://laravel.com)**, the most popular free, open-source PHP framework in the world. +* Built on top of the **[Whoops](https://github.com/filp/whoops)** error handler. +* Supports [Laravel](https://github.com/laravel/laravel), [Symfony](https://symfony.com), [PHPUnit](https://github.com/sebastianbergmann/phpunit), and many other frameworks. + +## Installation & Usage + +> **Requires [PHP 8.1+](https://php.net/releases/)** + +Require Collision using [Composer](https://getcomposer.org): + +```bash +composer require nunomaduro/collision --dev +``` + +## Version Compatibility + + Laravel | Collision | PHPUnit | Pest +:---------|:----------|:----------|:---------- + 6.x | 3.x | | + 7.x | 4.x | | + 8.x | 5.x | | + 9.x | 6.x | | + 10.x | 6.x | 9.x | 1.x + 10.x | 7.x | 10.x | 2.x + +As an example, here is how to require Collision on Laravel 8.x: + +```bash +composer require nunomaduro/collision:^5.0 --dev +``` + +## No adapter + +You need to register the handler in your code: + +```php +(new \NunoMaduro\Collision\Provider)->register(); +``` + +## Contributing + +Thank you for considering to contribute to Collision. All the contribution guidelines are mentioned [here](CONTRIBUTING.md). + +You can have a look at the [CHANGELOG](CHANGELOG.md) for constant updates & detailed information about the changes. You can also follow the twitter account for latest announcements or just come say hi!: [@enunomaduro](https://twitter.com/enunomaduro) + +## License + +Collision is an open-sourced software licensed under the [MIT license](LICENSE.md). + +Logo by [Caneco](https://twitter.com/caneco). diff --git a/vendor/nunomaduro/collision/composer.json b/vendor/nunomaduro/collision/composer.json new file mode 100644 index 00000000..7bedd235 --- /dev/null +++ b/vendor/nunomaduro/collision/composer.json @@ -0,0 +1,91 @@ +{ + "name": "nunomaduro/collision", + "description": "Cli error handling for console/command-line PHP applications.", + "keywords": ["console", "command-line", "php", "cli", "error", "handling", "laravel-zero", "laravel", "artisan", "symfony"], + "license": "MIT", + "support": { + "issues": "https://github.com/nunomaduro/collision/issues", + "source": "https://github.com/nunomaduro/collision" + }, + "authors": [ + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "require": { + "php": "^8.1.0", + "filp/whoops": "^2.15.3", + "nunomaduro/termwind": "^1.15.1", + "symfony/console": "^6.3.4" + }, + "conflict": { + "laravel/framework": ">=11.0.0" + }, + "require-dev": { + "brianium/paratest": "^7.3.0", + "laravel/framework": "^10.28.0", + "laravel/pint": "^1.13.3", + "laravel/sail": "^1.25.0", + "laravel/sanctum": "^3.3.1", + "laravel/tinker": "^2.8.2", + "nunomaduro/larastan": "^2.6.4", + "orchestra/testbench-core": "^8.13.0", + "pestphp/pest": "^2.23.2", + "phpunit/phpunit": "^10.4.1", + "sebastian/environment": "^6.0.1", + "spatie/laravel-ignition": "^2.3.1" + }, + "autoload-dev": { + "psr-4": { + "Tests\\Printer\\": "tests/Printer", + "Tests\\Unit\\": "tests/Unit", + "Tests\\FakeProgram\\": "tests/FakeProgram", + "Tests\\": "tests/LaravelApp/tests", + "App\\": "tests/LaravelApp/app/" + } + }, + "minimum-stability": "dev", + "prefer-stable": true, + "autoload": { + "psr-4": { + "NunoMaduro\\Collision\\": "src/" + }, + "files": [ + "./src/Adapters/Phpunit/Autoload.php" + ] + }, + "config": { + "preferred-install": "dist", + "sort-packages": true, + "allow-plugins": { + "pestphp/pest-plugin": true + } + }, + "extra": { + "laravel": { + "providers": [ + "NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider" + ] + } + }, + "scripts": { + "lint": "pint -v", + "test:lint": "pint --test -v", + "test:types": "phpstan analyse --ansi", + "test:unit:phpunit": [ + "@putenv XDEBUG_MODE=coverage", + "phpunit --colors=always" + ], + "test:unit:pest": [ + "@putenv XDEBUG_MODE=coverage", + "pest --colors=always -v" + ], + "test": [ + "@test:lint", + "@test:types", + "@test:unit:phpunit", + "@test:unit:pest" + ] + } +} diff --git a/vendor/nunomaduro/collision/src/Adapters/Laravel/CollisionServiceProvider.php b/vendor/nunomaduro/collision/src/Adapters/Laravel/CollisionServiceProvider.php new file mode 100644 index 00000000..87c73bd2 --- /dev/null +++ b/vendor/nunomaduro/collision/src/Adapters/Laravel/CollisionServiceProvider.php @@ -0,0 +1,79 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision\Adapters\Laravel; + +use Illuminate\Contracts\Debug\ExceptionHandler as ExceptionHandlerContract; +use Illuminate\Support\ServiceProvider; +use NunoMaduro\Collision\Adapters\Laravel\Commands\TestCommand; +use NunoMaduro\Collision\Handler; +use NunoMaduro\Collision\Provider; +use NunoMaduro\Collision\SolutionsRepositories\NullSolutionsRepository; +use NunoMaduro\Collision\Writer; +use Spatie\Ignition\Contracts\SolutionProviderRepository; + +/** + * @internal + * + * @final + */ +class CollisionServiceProvider extends ServiceProvider +{ + /** + * {@inheritdoc} + */ + protected bool $defer = true; + + /** + * Boots application services. + */ + public function boot(): void + { + $this->commands([ + TestCommand::class, + ]); + } + + /** + * {@inheritdoc} + */ + public function register(): void + { + if ($this->app->runningInConsole() && ! $this->app->runningUnitTests()) { + $this->app->bind(Provider::class, function () { + if ($this->app->has(SolutionProviderRepository::class)) { + /** @var SolutionProviderRepository $solutionProviderRepository */ + $solutionProviderRepository = $this->app->get(SolutionProviderRepository::class); + + $solutionsRepository = new IgnitionSolutionsRepository($solutionProviderRepository); + } else { + $solutionsRepository = new NullSolutionsRepository(); + } + + $writer = new Writer($solutionsRepository); + $handler = new Handler($writer); + + return new Provider(null, $handler); + }); + + /** @var \Illuminate\Contracts\Debug\ExceptionHandler $appExceptionHandler */ + $appExceptionHandler = $this->app->make(ExceptionHandlerContract::class); + + $this->app->singleton( + ExceptionHandlerContract::class, + function ($app) use ($appExceptionHandler) { + return new ExceptionHandler($app, $appExceptionHandler); + } + ); + } + } + + /** + * {@inheritdoc} + */ + public function provides() + { + return [Provider::class]; + } +} diff --git a/vendor/nunomaduro/collision/src/Adapters/Laravel/Commands/TestCommand.php b/vendor/nunomaduro/collision/src/Adapters/Laravel/Commands/TestCommand.php new file mode 100644 index 00000000..1309714f --- /dev/null +++ b/vendor/nunomaduro/collision/src/Adapters/Laravel/Commands/TestCommand.php @@ -0,0 +1,398 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision\Adapters\Laravel\Commands; + +use Dotenv\Exception\InvalidPathException; +use Dotenv\Parser\Parser; +use Dotenv\Store\StoreBuilder; +use Illuminate\Console\Command; +use Illuminate\Support\Env; +use Illuminate\Support\Str; +use NunoMaduro\Collision\Adapters\Laravel\Exceptions\RequirementsException; +use NunoMaduro\Collision\Coverage; +use ParaTest\Options; +use PHPUnit\Runner\Version; +use RuntimeException; +use SebastianBergmann\Environment\Console; +use Symfony\Component\Console\Input\ArgvInput; +use Symfony\Component\Console\Input\InputDefinition; +use Symfony\Component\Process\Exception\ProcessSignaledException; +use Symfony\Component\Process\Process; + +/** + * @internal + * + * @final + */ +class TestCommand extends Command +{ + /** + * The name and signature of the console command. + * + * @var string + */ + protected $signature = 'test + {--without-tty : Disable output to TTY} + {--compact : Indicates whether the compact printer should be used} + {--coverage : Indicates whether code coverage information should be collected} + {--min= : Indicates the minimum threshold enforcement for code coverage} + {--p|parallel : Indicates if the tests should run in parallel} + {--profile : Lists top 10 slowest tests} + {--recreate-databases : Indicates if the test databases should be re-created} + {--drop-databases : Indicates if the test databases should be dropped} + {--without-databases : Indicates if database configuration should be performed} + '; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Run the application tests'; + + /** + * Create a new command instance. + * + * @return void + */ + public function __construct() + { + parent::__construct(); + + $this->ignoreValidationErrors(); + } + + /** + * Execute the console command. + * + * @return mixed + */ + public function handle() + { + $phpunitVersion = Version::id(); + + if ($phpunitVersion[0].$phpunitVersion[1] !== '10') { + throw new RequirementsException('Running Collision 7.x artisan test command requires at least PHPUnit 10.x.'); + } + + $laravelVersion = \Illuminate\Foundation\Application::VERSION; + + if ($laravelVersion[0].$laravelVersion[1] !== '10') { // @phpstan-ignore-line + throw new RequirementsException('Running Collision 7.x artisan test command requires at least Laravel 10.x.'); + } + + if ($this->option('coverage') && ! Coverage::isAvailable()) { + $this->output->writeln(sprintf( + "\n <fg=white;bg=red;options=bold> ERROR </> Code coverage driver not available.%s</>", + Coverage::usingXdebug() + ? " Did you set <href=https://xdebug.org/docs/code_coverage#mode>Xdebug's coverage mode</>?" + : ' Did you install <href=https://xdebug.org/>Xdebug</> or <href=https://github.com/krakjoe/pcov>PCOV</>?' + )); + + $this->newLine(); + + return 1; + } + + /** @var bool $usesParallel */ + $usesParallel = $this->option('parallel'); + + if ($usesParallel && ! $this->isParallelDependenciesInstalled()) { + throw new RequirementsException('Running Collision 7.x artisan test command in parallel requires at least ParaTest (brianium/paratest) 7.x.'); + } + + $options = array_slice($_SERVER['argv'], $this->option('without-tty') ? 3 : 2); + + $this->clearEnv(); + + $parallel = $this->option('parallel'); + + $process = (new Process(array_merge( + // Binary ... + $this->binary(), + // Arguments ... + $parallel ? $this->paratestArguments($options) : $this->phpunitArguments($options) + ), + null, + // Envs ... + $parallel ? $this->paratestEnvironmentVariables() : $this->phpunitEnvironmentVariables(), + ))->setTimeout(null); + + try { + $process->setTty(! $this->option('without-tty')); + } catch (RuntimeException $e) { + // $this->output->writeln('Warning: '.$e->getMessage()); + } + + $exitCode = 1; + + try { + $exitCode = $process->run(function ($type, $line) { + $this->output->write($line); + }); + } catch (ProcessSignaledException $e) { + if (extension_loaded('pcntl') && $e->getSignal() !== SIGINT) { + throw $e; + } + } + + if ($exitCode === 0 && $this->option('coverage')) { + if (! $this->usingPest() && $this->option('parallel')) { + $this->newLine(); + } + + $coverage = Coverage::report($this->output); + + $exitCode = (int) ($coverage < $this->option('min')); + + if ($exitCode === 1) { + $this->output->writeln(sprintf( + "\n <fg=white;bg=red;options=bold> FAIL </> Code coverage below expected:<fg=red;options=bold> %s %%</>. Minimum:<fg=white;options=bold> %s %%</>.", + number_format($coverage, 1), + number_format((float) $this->option('min'), 1) + )); + } + } + + return $exitCode; + } + + /** + * Get the PHP binary to execute. + * + * @return array + */ + protected function binary() + { + if ($this->usingPest()) { + $command = $this->option('parallel') ? ['vendor/pestphp/pest/bin/pest', '--parallel'] : ['vendor/pestphp/pest/bin/pest']; + } else { + $command = $this->option('parallel') ? ['vendor/brianium/paratest/bin/paratest'] : ['vendor/phpunit/phpunit/phpunit']; + } + + if ('phpdbg' === PHP_SAPI) { + return array_merge([PHP_BINARY, '-qrr'], $command); + } + + return array_merge([PHP_BINARY], $command); + } + + /** + * Gets the common arguments of PHPUnit and Pest. + * + * @return array + */ + protected function commonArguments() + { + $arguments = []; + + if ($this->option('coverage')) { + $arguments[] = '--coverage-php'; + $arguments[] = Coverage::getPath(); + } + + if ($this->option('ansi')) { + $arguments[] = '--colors=always'; + } elseif ($this->option('no-ansi')) { // @phpstan-ignore-line + $arguments[] = '--colors=never'; + } elseif ((new Console)->hasColorSupport()) { + $arguments[] = '--colors=always'; + } + + return $arguments; + } + + /** + * Determines if Pest is being used. + * + * @return bool + */ + protected function usingPest() + { + return function_exists('\Pest\\version'); + } + + /** + * Get the array of arguments for running PHPUnit. + * + * @param array $options + * @return array + */ + protected function phpunitArguments($options) + { + $options = array_merge(['--no-output'], $options); + + $options = array_values(array_filter($options, function ($option) { + return ! Str::startsWith($option, '--env=') + && $option != '-q' + && $option != '--quiet' + && $option != '--coverage' + && $option != '--compact' + && $option != '--profile' + && $option != '--ansi' + && $option != '--no-ansi' + && ! Str::startsWith($option, '--min'); + })); + + return array_merge($this->commonArguments(), ['--configuration='.$this->getConfigurationFile()], $options); + } + + /** + * Get the configuration file. + * + * @return string + */ + protected function getConfigurationFile() + { + if (! file_exists($file = base_path('phpunit.xml'))) { + $file = base_path('phpunit.xml.dist'); + } + + return $file; + } + + /** + * Get the array of arguments for running Paratest. + * + * @param array $options + * @return array + */ + protected function paratestArguments($options) + { + $options = array_values(array_filter($options, function ($option) { + return ! Str::startsWith($option, '--env=') + && $option != '--coverage' + && $option != '-q' + && $option != '--quiet' + && $option != '--ansi' + && $option != '--no-ansi' + && ! Str::startsWith($option, '--min') + && ! Str::startsWith($option, '-p') + && ! Str::startsWith($option, '--parallel') + && ! Str::startsWith($option, '--recreate-databases') + && ! Str::startsWith($option, '--drop-databases') + && ! Str::startsWith($option, '--without-databases'); + })); + + $options = array_merge($this->commonArguments(), [ + '--configuration='.$this->getConfigurationFile(), + "--runner=\Illuminate\Testing\ParallelRunner", + ], $options); + + $inputDefinition = new InputDefinition(); + Options::setInputDefinition($inputDefinition); + $input = new ArgvInput($options, $inputDefinition); + + /** @var non-empty-string $basePath */ + $basePath = base_path(); + + $paraTestOptions = Options::fromConsoleInput( + $input, + $basePath, + ); + + if (! $paraTestOptions->configuration->hasCoverageCacheDirectory()) { + $cacheDirectory = sys_get_temp_dir().DIRECTORY_SEPARATOR.'__laravel_test_cache_directory'; + $options[] = '--cache-directory'; + $options[] = $cacheDirectory; + } + + return $options; + } + + /** + * Get the array of environment variables for running PHPUnit. + * + * @return array + */ + protected function phpunitEnvironmentVariables() + { + $variables = [ + 'COLLISION_PRINTER' => 'DefaultPrinter', + ]; + + if ($this->option('compact')) { + $variables['COLLISION_PRINTER_COMPACT'] = 'true'; + } + + if ($this->option('profile')) { + $variables['COLLISION_PRINTER_PROFILE'] = 'true'; + } + + return $variables; + } + + /** + * Get the array of environment variables for running Paratest. + * + * @return array + */ + protected function paratestEnvironmentVariables() + { + return [ + 'LARAVEL_PARALLEL_TESTING' => 1, + 'LARAVEL_PARALLEL_TESTING_RECREATE_DATABASES' => $this->option('recreate-databases'), + 'LARAVEL_PARALLEL_TESTING_DROP_DATABASES' => $this->option('drop-databases'), + 'LARAVEL_PARALLEL_TESTING_WITHOUT_DATABASES' => $this->option('without-databases'), + ]; + } + + /** + * Clears any set Environment variables set by Laravel if the --env option is empty. + * + * @return void + */ + protected function clearEnv() + { + if (! $this->option('env')) { + $vars = self::getEnvironmentVariables( + $this->laravel->environmentPath(), + $this->laravel->environmentFile() + ); + + $repository = Env::getRepository(); + + foreach ($vars as $name) { + $repository->clear($name); + } + } + } + + /** + * @param string $path + * @param string $file + * @return array + */ + protected static function getEnvironmentVariables($path, $file) + { + try { + $content = StoreBuilder::createWithNoNames() + ->addPath($path) + ->addName($file) + ->make() + ->read(); + } catch (InvalidPathException $e) { + return []; + } + + $vars = []; + + foreach ((new Parser())->parse($content) as $entry) { + $vars[] = $entry->getName(); + } + + return $vars; + } + + /** + * Check if the parallel dependencies are installed. + * + * @return bool + */ + protected function isParallelDependenciesInstalled() + { + return class_exists(\ParaTest\ParaTestCommand::class); + } +} diff --git a/vendor/nunomaduro/collision/src/Adapters/Laravel/ExceptionHandler.php b/vendor/nunomaduro/collision/src/Adapters/Laravel/ExceptionHandler.php new file mode 100644 index 00000000..241f488f --- /dev/null +++ b/vendor/nunomaduro/collision/src/Adapters/Laravel/ExceptionHandler.php @@ -0,0 +1,121 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision\Adapters\Laravel; + +use Illuminate\Contracts\Container\Container; +use Illuminate\Contracts\Debug\ExceptionHandler as ExceptionHandlerContract; +use NunoMaduro\Collision\Provider; +use Symfony\Component\Console\Exception\ExceptionInterface as SymfonyConsoleExceptionInterface; +use Throwable; + +/** + * @internal + */ +final class ExceptionHandler implements ExceptionHandlerContract +{ + /** + * Holds an instance of the application exception handler. + * + * @var \Illuminate\Contracts\Debug\ExceptionHandler + */ + protected $appExceptionHandler; + + /** + * Holds an instance of the container. + * + * @var \Illuminate\Contracts\Container\Container + */ + protected $container; + + /** + * Creates a new instance of the ExceptionHandler. + */ + public function __construct(Container $container, ExceptionHandlerContract $appExceptionHandler) + { + $this->container = $container; + $this->appExceptionHandler = $appExceptionHandler; + } + + /** + * {@inheritdoc} + */ + public function report(Throwable $e) + { + $this->appExceptionHandler->report($e); + } + + /** + * {@inheritdoc} + */ + public function render($request, Throwable $e) + { + return $this->appExceptionHandler->render($request, $e); + } + + /** + * {@inheritdoc} + */ + public function renderForConsole($output, Throwable $e) + { + if ($e instanceof SymfonyConsoleExceptionInterface) { + $this->appExceptionHandler->renderForConsole($output, $e); + } else { + /** @var Provider $provider */ + $provider = $this->container->make(Provider::class); + + $handler = $provider->register() + ->getHandler() + ->setOutput($output); + + $handler->setInspector((new Inspector($e))); + + $handler->handle(); + } + } + + /** + * Determine if the exception should be reported. + * + * @return bool + */ + public function shouldReport(Throwable $e) + { + return $this->appExceptionHandler->shouldReport($e); + } + + /** + * Register a reportable callback. + * + * @return \Illuminate\Foundation\Exceptions\ReportableHandler + */ + public function reportable(callable $reportUsing) + { + return $this->appExceptionHandler->reportable($reportUsing); + } + + /** + * Register a renderable callback. + * + * @return $this + */ + public function renderable(callable $renderUsing) + { + $this->appExceptionHandler->renderable($renderUsing); + + return $this; + } + + /** + * Do not report duplicate exceptions. + * + * @return $this + */ + public function dontReportDuplicates() + { + $this->appExceptionHandler->dontReportDuplicates(); + + return $this; + } +} diff --git a/vendor/nunomaduro/collision/src/Adapters/Laravel/Exceptions/NotSupportedYetException.php b/vendor/nunomaduro/collision/src/Adapters/Laravel/Exceptions/NotSupportedYetException.php new file mode 100644 index 00000000..18989a19 --- /dev/null +++ b/vendor/nunomaduro/collision/src/Adapters/Laravel/Exceptions/NotSupportedYetException.php @@ -0,0 +1,16 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision\Adapters\Laravel\Exceptions; + +use NunoMaduro\Collision\Contracts\RenderlessEditor; +use NunoMaduro\Collision\Contracts\RenderlessTrace; +use RuntimeException; + +/** + * @internal + */ +final class NotSupportedYetException extends RuntimeException implements RenderlessEditor, RenderlessTrace +{ +} diff --git a/vendor/nunomaduro/collision/src/Adapters/Laravel/Exceptions/RequirementsException.php b/vendor/nunomaduro/collision/src/Adapters/Laravel/Exceptions/RequirementsException.php new file mode 100644 index 00000000..b13b9c29 --- /dev/null +++ b/vendor/nunomaduro/collision/src/Adapters/Laravel/Exceptions/RequirementsException.php @@ -0,0 +1,16 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision\Adapters\Laravel\Exceptions; + +use NunoMaduro\Collision\Contracts\RenderlessEditor; +use NunoMaduro\Collision\Contracts\RenderlessTrace; +use RuntimeException; + +/** + * @internal + */ +final class RequirementsException extends RuntimeException implements RenderlessEditor, RenderlessTrace +{ +} diff --git a/vendor/nunomaduro/collision/src/Adapters/Laravel/IgnitionSolutionsRepository.php b/vendor/nunomaduro/collision/src/Adapters/Laravel/IgnitionSolutionsRepository.php new file mode 100644 index 00000000..827134c9 --- /dev/null +++ b/vendor/nunomaduro/collision/src/Adapters/Laravel/IgnitionSolutionsRepository.php @@ -0,0 +1,38 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision\Adapters\Laravel; + +use NunoMaduro\Collision\Contracts\SolutionsRepository; +use Spatie\Ignition\Contracts\SolutionProviderRepository; +use Throwable; + +/** + * @internal + */ +final class IgnitionSolutionsRepository implements SolutionsRepository +{ + /** + * Holds an instance of ignition solutions provider repository. + * + * @var \Spatie\Ignition\Contracts\SolutionProviderRepository + */ + protected $solutionProviderRepository; + + /** + * IgnitionSolutionsRepository constructor. + */ + public function __construct(SolutionProviderRepository $solutionProviderRepository) + { + $this->solutionProviderRepository = $solutionProviderRepository; + } + + /** + * {@inheritdoc} + */ + public function getFromThrowable(Throwable $throwable): array + { + return $this->solutionProviderRepository->getSolutionsForThrowable($throwable); + } +} diff --git a/vendor/nunomaduro/collision/src/Adapters/Laravel/Inspector.php b/vendor/nunomaduro/collision/src/Adapters/Laravel/Inspector.php new file mode 100644 index 00000000..2654e46d --- /dev/null +++ b/vendor/nunomaduro/collision/src/Adapters/Laravel/Inspector.php @@ -0,0 +1,30 @@ +<?php + +declare(strict_types=1); + +/** + * This file is part of Collision. + * + * (c) Nuno Maduro <enunomaduro@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace NunoMaduro\Collision\Adapters\Laravel; + +use Whoops\Exception\Inspector as BaseInspector; + +/** + * @internal + */ +final class Inspector extends BaseInspector +{ + /** + * {@inheritdoc} + */ + protected function getTrace($e) + { + return $e->getTrace(); + } +} diff --git a/vendor/nunomaduro/collision/src/Adapters/Phpunit/Autoload.php b/vendor/nunomaduro/collision/src/Adapters/Phpunit/Autoload.php new file mode 100644 index 00000000..9c3ab9a8 --- /dev/null +++ b/vendor/nunomaduro/collision/src/Adapters/Phpunit/Autoload.php @@ -0,0 +1,12 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision\Adapters\Phpunit; + +use NunoMaduro\Collision\Adapters\Phpunit\Subscribers\EnsurePrinterIsRegisteredSubscriber; +use PHPUnit\Runner\Version; + +if (class_exists(Version::class) && (int) Version::series() >= 10) { + EnsurePrinterIsRegisteredSubscriber::register(); +} diff --git a/vendor/nunomaduro/collision/src/Adapters/Phpunit/ConfigureIO.php b/vendor/nunomaduro/collision/src/Adapters/Phpunit/ConfigureIO.php new file mode 100644 index 00000000..6ced9814 --- /dev/null +++ b/vendor/nunomaduro/collision/src/Adapters/Phpunit/ConfigureIO.php @@ -0,0 +1,40 @@ +<?php + +declare(strict_types=1); + +/** + * This file is part of Collision. + * + * (c) Nuno Maduro <enunomaduro@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace NunoMaduro\Collision\Adapters\Phpunit; + +use ReflectionObject; +use Symfony\Component\Console\Application; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\Output; + +/** + * @internal + */ +final class ConfigureIO +{ + /** + * Configures both given input and output with + * options from the environment. + * + * @throws \ReflectionException + */ + public static function of(InputInterface $input, Output $output): void + { + $application = new Application(); + $reflector = new ReflectionObject($application); + $method = $reflector->getMethod('configureIO'); + $method->setAccessible(true); + $method->invoke($application, $input, $output); + } +} diff --git a/vendor/nunomaduro/collision/src/Adapters/Phpunit/Printers/DefaultPrinter.php b/vendor/nunomaduro/collision/src/Adapters/Phpunit/Printers/DefaultPrinter.php new file mode 100644 index 00000000..0725e223 --- /dev/null +++ b/vendor/nunomaduro/collision/src/Adapters/Phpunit/Printers/DefaultPrinter.php @@ -0,0 +1,432 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision\Adapters\Phpunit\Printers; + +use NunoMaduro\Collision\Adapters\Phpunit\ConfigureIO; +use NunoMaduro\Collision\Adapters\Phpunit\State; +use NunoMaduro\Collision\Adapters\Phpunit\Style; +use NunoMaduro\Collision\Adapters\Phpunit\Support\ResultReflection; +use NunoMaduro\Collision\Adapters\Phpunit\TestResult; +use NunoMaduro\Collision\Exceptions\ShouldNotHappen; +use NunoMaduro\Collision\Exceptions\TestOutcome; +use Pest\Result; +use PHPUnit\Event\Code\TestMethod; +use PHPUnit\Event\Code\ThrowableBuilder; +use PHPUnit\Event\Test\BeforeFirstTestMethodErrored; +use PHPUnit\Event\Test\ConsideredRisky; +use PHPUnit\Event\Test\DeprecationTriggered; +use PHPUnit\Event\Test\Errored; +use PHPUnit\Event\Test\Failed; +use PHPUnit\Event\Test\Finished; +use PHPUnit\Event\Test\MarkedIncomplete; +use PHPUnit\Event\Test\NoticeTriggered; +use PHPUnit\Event\Test\Passed; +use PHPUnit\Event\Test\PhpDeprecationTriggered; +use PHPUnit\Event\Test\PhpNoticeTriggered; +use PHPUnit\Event\Test\PhpunitDeprecationTriggered; +use PHPUnit\Event\Test\PhpunitErrorTriggered; +use PHPUnit\Event\Test\PhpunitWarningTriggered; +use PHPUnit\Event\Test\PhpWarningTriggered; +use PHPUnit\Event\Test\PreparationStarted; +use PHPUnit\Event\Test\PrintedUnexpectedOutput; +use PHPUnit\Event\Test\Skipped; +use PHPUnit\Event\Test\WarningTriggered; +use PHPUnit\Event\TestRunner\DeprecationTriggered as TestRunnerDeprecationTriggered; +use PHPUnit\Event\TestRunner\ExecutionFinished; +use PHPUnit\Event\TestRunner\ExecutionStarted; +use PHPUnit\Event\TestRunner\WarningTriggered as TestRunnerWarningTriggered; +use PHPUnit\Framework\IncompleteTestError; +use PHPUnit\Framework\SkippedWithMessageException; +use PHPUnit\TestRunner\TestResult\Facade; +use PHPUnit\TextUI\Configuration\Registry; +use Symfony\Component\Console\Input\ArgvInput; +use Symfony\Component\Console\Output\ConsoleOutput; +use Symfony\Component\Console\Output\OutputInterface; +use Throwable; + +/** + * @internal + */ +final class DefaultPrinter +{ + /** + * The output instance. + */ + private ConsoleOutput $output; + + /** + * The state instance. + */ + private State $state; + + /** + * The style instance. + */ + private Style $style; + + /** + * If the printer should be compact. + */ + private static bool $compact = false; + + /** + * If the printer should profile. + */ + private static bool $profile = false; + + /** + * When profiling, holds a list of slow tests. + */ + private array $profileSlowTests = []; + + /** + * The test started at in microseconds. + */ + private float $testStartedAt = 0.0; + + /** + * If the printer should be verbose. + */ + private static bool $verbose = false; + + /** + * Creates a new Printer instance. + */ + public function __construct(bool $colors) + { + $this->output = new ConsoleOutput(OutputInterface::VERBOSITY_NORMAL, $colors); + + ConfigureIO::of(new ArgvInput(), $this->output); + + self::$verbose = $this->output->isVerbose(); + + $this->style = new Style($this->output); + + $this->state = new State(); + } + + /** + * If the printer instances should be compact. + */ + public static function compact(bool $value = null): bool + { + if (! is_null($value)) { + self::$compact = $value; + } + + return ! self::$verbose && self::$compact; + } + + /** + * If the printer instances should profile. + */ + public static function profile(bool $value = null): bool + { + if (! is_null($value)) { + self::$profile = $value; + } + + return self::$profile; + } + + /** + * Defines if the output should be decorated or not. + */ + public function setDecorated(bool $decorated): void + { + $this->output->setDecorated($decorated); + } + + /** + * Listen to the runner execution started event. + */ + public function testPrintedUnexpectedOutput(PrintedUnexpectedOutput $printedUnexpectedOutput): void + { + $this->output->write($printedUnexpectedOutput->output()); + } + + /** + * Listen to the runner execution started event. + */ + public function testRunnerExecutionStarted(ExecutionStarted $executionStarted): void + { + // .. + } + + /** + * Listen to the test finished event. + */ + public function testFinished(Finished $event): void + { + $duration = (hrtime(true) - $this->testStartedAt) / 1_000_000; + + $test = $event->test(); + + if (! $test instanceof TestMethod) { + throw new ShouldNotHappen(); + } + + if (! $this->state->existsInTestCase($event->test())) { + $this->state->add(TestResult::fromTestCase($event->test(), TestResult::PASS)); + } + + $result = $this->state->setDuration($test, $duration); + + if (self::$profile) { + $this->profileSlowTests[$event->test()->id()] = $result; + + // Sort the slow tests by time, and keep only 10 of them. + uasort($this->profileSlowTests, static function (TestResult $a, TestResult $b) { + return $b->duration <=> $a->duration; + }); + + $this->profileSlowTests = array_slice($this->profileSlowTests, 0, 10); + } + } + + /** + * Listen to the test prepared event. + */ + public function testPreparationStarted(PreparationStarted $event): void + { + $this->testStartedAt = hrtime(true); + + $test = $event->test(); + + if (! $test instanceof TestMethod) { + throw new ShouldNotHappen(); + } + + if ($this->state->testCaseHasChanged($test)) { + $this->style->writeCurrentTestCaseSummary($this->state); + + $this->state->moveTo($test); + } + } + + /** + * Listen to the test errored event. + */ + public function testBeforeFirstTestMethodErrored(BeforeFirstTestMethodErrored $event): void + { + $this->state->add(TestResult::fromBeforeFirstTestMethodErrored($event)); + } + + /** + * Listen to the test errored event. + */ + public function testErrored(Errored $event): void + { + $this->state->add(TestResult::fromTestCase($event->test(), TestResult::FAIL, $event->throwable())); + } + + /** + * Listen to the test failed event. + */ + public function testFailed(Failed $event): void + { + $throwable = $event->throwable(); + + $this->state->add(TestResult::fromTestCase($event->test(), TestResult::FAIL, $throwable)); + } + + /** + * Listen to the test marked incomplete event. + */ + public function testMarkedIncomplete(MarkedIncomplete $event): void + { + $this->state->add(TestResult::fromTestCase($event->test(), TestResult::INCOMPLETE, $event->throwable())); + } + + /** + * Listen to the test considered risky event. + */ + public function testConsideredRisky(ConsideredRisky $event): void + { + $throwable = ThrowableBuilder::from(new IncompleteTestError($event->message())); + + $this->state->add(TestResult::fromTestCase($event->test(), TestResult::RISKY, $throwable)); + } + + /** + * Listen to the test runner deprecation triggered. + */ + public function testRunnerDeprecationTriggered(TestRunnerDeprecationTriggered $event): void + { + $this->style->writeWarning($event->message()); + } + + /** + * Listen to the test runner warning triggered. + */ + public function testRunnerWarningTriggered(TestRunnerWarningTriggered $event): void + { + if (! str_starts_with($event->message(), 'No tests found in class')) { + $this->style->writeWarning($event->message()); + } + } + + /** + * Listen to the test runner warning triggered. + */ + public function testPhpDeprecationTriggered(PhpDeprecationTriggered $event): void + { + $throwable = ThrowableBuilder::from(new TestOutcome($event->message())); + + $this->state->add(TestResult::fromTestCase($event->test(), TestResult::DEPRECATED, $throwable)); + } + + /** + * Listen to the test runner notice triggered. + */ + public function testPhpNoticeTriggered(PhpNoticeTriggered $event): void + { + $throwable = ThrowableBuilder::from(new TestOutcome($event->message())); + + $this->state->add(TestResult::fromTestCase($event->test(), TestResult::NOTICE, $throwable)); + } + + /** + * Listen to the test php warning triggered event. + */ + public function testPhpWarningTriggered(PhpWarningTriggered $event): void + { + $throwable = ThrowableBuilder::from(new TestOutcome($event->message())); + + $this->state->add(TestResult::fromTestCase($event->test(), TestResult::WARN, $throwable)); + } + + /** + * Listen to the test runner warning triggered. + */ + public function testPhpunitWarningTriggered(PhpunitWarningTriggered $event): void + { + $throwable = ThrowableBuilder::from(new TestOutcome($event->message())); + + $this->state->add(TestResult::fromTestCase($event->test(), TestResult::WARN, $throwable)); + } + + /** + * Listen to the test deprecation triggered event. + */ + public function testDeprecationTriggered(DeprecationTriggered $event): void + { + $throwable = ThrowableBuilder::from(new TestOutcome($event->message())); + + $this->state->add(TestResult::fromTestCase($event->test(), TestResult::DEPRECATED, $throwable)); + } + + /** + * Listen to the test phpunit deprecation triggered event. + */ + public function testPhpunitDeprecationTriggered(PhpunitDeprecationTriggered $event): void + { + $throwable = ThrowableBuilder::from(new TestOutcome($event->message())); + + $this->state->add(TestResult::fromTestCase($event->test(), TestResult::DEPRECATED, $throwable)); + } + + /** + * Listen to the test phpunit error triggered event. + */ + public function testPhpunitErrorTriggered(PhpunitErrorTriggered $event): void + { + $throwable = ThrowableBuilder::from(new TestOutcome($event->message())); + + $this->state->add(TestResult::fromTestCase($event->test(), TestResult::FAIL, $throwable)); + } + + /** + * Listen to the test warning triggered event. + */ + public function testNoticeTriggered(NoticeTriggered $event): void + { + $throwable = ThrowableBuilder::from(new TestOutcome($event->message())); + + $this->state->add(TestResult::fromTestCase($event->test(), TestResult::NOTICE, $throwable)); + } + + /** + * Listen to the test warning triggered event. + */ + public function testWarningTriggered(WarningTriggered $event): void + { + $throwable = ThrowableBuilder::from(new TestOutcome($event->message())); + + $this->state->add(TestResult::fromTestCase($event->test(), TestResult::WARN, $throwable)); + } + + /** + * Listen to the test skipped event. + */ + public function testSkipped(Skipped $event): void + { + if ($event->message() === '__TODO__') { + $this->state->add(TestResult::fromTestCase($event->test(), TestResult::TODO)); + + return; + } + + $throwable = ThrowableBuilder::from(new SkippedWithMessageException($event->message())); + + $this->state->add(TestResult::fromTestCase($event->test(), TestResult::SKIPPED, $throwable)); + } + + /** + * Listen to the test finished event. + */ + public function testPassed(Passed $event): void + { + if (! $this->state->existsInTestCase($event->test())) { + $this->state->add(TestResult::fromTestCase($event->test(), TestResult::PASS)); + } + } + + /** + * Listen to the runner execution finished event. + */ + public function testRunnerExecutionFinished(ExecutionFinished $event): void + { + $result = Facade::result(); + + if (ResultReflection::numberOfTests(Facade::result()) === 0) { + $this->output->writeln([ + '', + ' <fg=white;options=bold;bg=blue> INFO </> No tests found.', + '', + ]); + + return; + } + + $this->style->writeCurrentTestCaseSummary($this->state); + + if (self::$compact) { + $this->output->writeln(['']); + } + + if (class_exists(Result::class)) { + $failed = Result::failed(Registry::get(), Facade::result()); + } else { + $failed = ! Facade::result()->wasSuccessful(); + } + + $this->style->writeErrorsSummary($this->state); + + $this->style->writeRecap($this->state, $event->telemetryInfo(), $result); + + if (! $failed && count($this->profileSlowTests) > 0) { + $this->style->writeSlowTests($this->profileSlowTests, $event->telemetryInfo()); + } + } + + /** + * Reports the given throwable. + */ + public function report(Throwable $throwable): void + { + $this->style->writeError(ThrowableBuilder::from($throwable)); + } +} diff --git a/vendor/nunomaduro/collision/src/Adapters/Phpunit/Printers/ReportablePrinter.php b/vendor/nunomaduro/collision/src/Adapters/Phpunit/Printers/ReportablePrinter.php new file mode 100644 index 00000000..6b24d281 --- /dev/null +++ b/vendor/nunomaduro/collision/src/Adapters/Phpunit/Printers/ReportablePrinter.php @@ -0,0 +1,37 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision\Adapters\Phpunit\Printers; + +use Throwable; + +/** + * @internal + * + * @mixin DefaultPrinter + */ +final class ReportablePrinter +{ + /** + * Creates a new Printer instance. + */ + public function __construct(private readonly DefaultPrinter $printer) + { + // .. + } + + /** + * Calls the original method, but reports any errors to the reporter. + */ + public function __call(string $name, array $arguments): mixed + { + try { + return $this->printer->$name(...$arguments); + } catch (Throwable $throwable) { + $this->printer->report($throwable); + } + + exit(1); + } +} diff --git a/vendor/nunomaduro/collision/src/Adapters/Phpunit/State.php b/vendor/nunomaduro/collision/src/Adapters/Phpunit/State.php new file mode 100644 index 00000000..a40efae9 --- /dev/null +++ b/vendor/nunomaduro/collision/src/Adapters/Phpunit/State.php @@ -0,0 +1,267 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision\Adapters\Phpunit; + +use NunoMaduro\Collision\Contracts\Adapters\Phpunit\HasPrintableTestCaseName; +use PHPUnit\Event\Code\Test; +use PHPUnit\Event\Code\TestMethod; + +/** + * @internal + */ +final class State +{ + /** + * The complete test suite tests. + * + * @var array<string, TestResult> + */ + public array $suiteTests = []; + + /** + * The current test case class. + */ + public ?string $testCaseName; + + /** + * The current test case tests. + * + * @var array<string, TestResult> + */ + public array $testCaseTests = []; + + /** + * The current test case tests. + * + * @var array<string, TestResult> + */ + public array $toBePrintedCaseTests = []; + + /** + * Header printed. + */ + public bool $headerPrinted = false; + + /** + * The state constructor. + */ + public function __construct() + { + $this->testCaseName = ''; + } + + /** + * Checks if the given test already contains a result. + */ + public function existsInTestCase(Test $test): bool + { + return isset($this->testCaseTests[$test->id()]); + } + + /** + * Adds the given test to the State. + */ + public function add(TestResult $test): void + { + $this->testCaseName = $test->testCaseName; + + $levels = array_flip([ + TestResult::PASS, + TestResult::RUNS, + TestResult::TODO, + TestResult::SKIPPED, + TestResult::WARN, + TestResult::NOTICE, + TestResult::DEPRECATED, + TestResult::RISKY, + TestResult::INCOMPLETE, + TestResult::FAIL, + ]); + + if (isset($this->testCaseTests[$test->id])) { + $existing = $this->testCaseTests[$test->id]; + + if ($levels[$existing->type] >= $levels[$test->type]) { + return; + } + } + + $this->testCaseTests[$test->id] = $test; + $this->toBePrintedCaseTests[$test->id] = $test; + + $this->suiteTests[$test->id] = $test; + } + + /** + * Sets the duration of the given test, and returns the test result. + */ + public function setDuration(Test $test, float $duration): TestResult + { + $result = $this->testCaseTests[$test->id()]; + + $result->setDuration($duration); + + return $result; + } + + /** + * Gets the test case title. + */ + public function getTestCaseTitle(): string + { + foreach ($this->testCaseTests as $test) { + if ($test->type === TestResult::FAIL) { + return 'FAIL'; + } + } + + foreach ($this->testCaseTests as $test) { + if ($test->type !== TestResult::PASS && $test->type !== TestResult::TODO && $test->type !== TestResult::DEPRECATED && $test->type !== TestResult::NOTICE) { + return 'WARN'; + } + } + + foreach ($this->testCaseTests as $test) { + if ($test->type === TestResult::NOTICE) { + return 'NOTI'; + } + } + + foreach ($this->testCaseTests as $test) { + if ($test->type === TestResult::DEPRECATED) { + return 'DEPR'; + } + } + + if ($this->todosCount() > 0 && (count($this->testCaseTests) === $this->todosCount())) { + return 'TODO'; + } + + return 'PASS'; + } + + /** + * Gets the number of tests that are todos. + */ + public function todosCount(): int + { + return count(array_values(array_filter($this->testCaseTests, function (TestResult $test): bool { + return $test->type === TestResult::TODO; + }))); + } + + /** + * Gets the test case title color. + */ + public function getTestCaseFontColor(): string + { + if ($this->getTestCaseTitleColor() === 'blue') { + return 'white'; + } + + return $this->getTestCaseTitle() === 'FAIL' ? 'default' : 'black'; + } + + /** + * Gets the test case title color. + */ + public function getTestCaseTitleColor(): string + { + foreach ($this->testCaseTests as $test) { + if ($test->type === TestResult::FAIL) { + return 'red'; + } + } + + foreach ($this->testCaseTests as $test) { + if ($test->type !== TestResult::PASS && $test->type !== TestResult::TODO && $test->type !== TestResult::DEPRECATED) { + return 'yellow'; + } + } + + foreach ($this->testCaseTests as $test) { + if ($test->type === TestResult::DEPRECATED) { + return 'yellow'; + } + } + + foreach ($this->testCaseTests as $test) { + if ($test->type === TestResult::TODO) { + return 'blue'; + } + } + + return 'green'; + } + + /** + * Returns the number of tests on the current test case. + */ + public function testCaseTestsCount(): int + { + return count($this->testCaseTests); + } + + /** + * Returns the number of tests on the complete test suite. + */ + public function testSuiteTestsCount(): int + { + return count($this->suiteTests); + } + + /** + * Checks if the given test case is different from the current one. + */ + public function testCaseHasChanged(TestMethod $test): bool + { + return self::getPrintableTestCaseName($test) !== $this->testCaseName; + } + + /** + * Moves the an new test case. + */ + public function moveTo(TestMethod $test): void + { + $this->testCaseName = self::getPrintableTestCaseName($test); + + $this->testCaseTests = []; + + $this->headerPrinted = false; + } + + /** + * Foreach test in the test case. + */ + public function eachTestCaseTests(callable $callback): void + { + foreach ($this->toBePrintedCaseTests as $test) { + $callback($test); + } + + $this->toBePrintedCaseTests = []; + } + + public function countTestsInTestSuiteBy(string $type): int + { + return count(array_filter($this->suiteTests, function (TestResult $testResult) use ($type) { + return $testResult->type === $type; + })); + } + + /** + * Returns the printable test case name from the given `TestCase`. + */ + public static function getPrintableTestCaseName(TestMethod $test): string + { + $className = explode('::', $test->id())[0]; + + if (is_subclass_of($className, HasPrintableTestCaseName::class)) { + return $className::getPrintableTestCaseName(); + } + + return $className; + } +} diff --git a/vendor/nunomaduro/collision/src/Adapters/Phpunit/Style.php b/vendor/nunomaduro/collision/src/Adapters/Phpunit/Style.php new file mode 100644 index 00000000..c78ca812 --- /dev/null +++ b/vendor/nunomaduro/collision/src/Adapters/Phpunit/Style.php @@ -0,0 +1,555 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision\Adapters\Phpunit; + +use Closure; +use NunoMaduro\Collision\Adapters\Phpunit\Printers\DefaultPrinter; +use NunoMaduro\Collision\Adapters\Phpunit\Support\ResultReflection; +use NunoMaduro\Collision\Exceptions\ShouldNotHappen; +use NunoMaduro\Collision\Exceptions\TestException; +use NunoMaduro\Collision\Exceptions\TestOutcome; +use NunoMaduro\Collision\Writer; +use Pest\Expectation; +use PHPUnit\Event\Code\Throwable; +use PHPUnit\Event\Telemetry\Info; +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\IncompleteTestError; +use PHPUnit\Framework\SkippedWithMessageException; +use PHPUnit\TestRunner\TestResult\TestResult as PHPUnitTestResult; +use PHPUnit\TextUI\Configuration\Registry; +use ReflectionClass; +use ReflectionFunction; +use Symfony\Component\Console\Output\ConsoleOutput; +use Symfony\Component\Console\Output\ConsoleOutputInterface; +use Termwind\Terminal; +use Whoops\Exception\Frame; +use Whoops\Exception\Inspector; + +use function Termwind\render; +use function Termwind\renderUsing; +use function Termwind\terminal; + +/** + * @internal + */ +final class Style +{ + private int $compactProcessed = 0; + + private int $compactSymbolsPerLine = 0; + + private readonly Terminal $terminal; + + private readonly ConsoleOutput $output; + + /** + * @var string[] + */ + private const TYPES = [TestResult::DEPRECATED, TestResult::FAIL, TestResult::WARN, TestResult::RISKY, TestResult::INCOMPLETE, TestResult::NOTICE, TestResult::TODO, TestResult::SKIPPED, TestResult::PASS]; + + /** + * Style constructor. + */ + public function __construct(ConsoleOutputInterface $output) + { + if (! $output instanceof ConsoleOutput) { + throw new ShouldNotHappen(); + } + + $this->terminal = terminal(); + $this->output = $output; + + $this->compactSymbolsPerLine = $this->terminal->width() - 4; + } + + /** + * Prints the content similar too:. + * + * ``` + * WARN Your XML configuration validates against a deprecated schema... + * ``` + */ + public function writeWarning(string $message): void + { + $this->output->writeln(['', ' <fg=black;bg=yellow;options=bold> WARN </> '.$message]); + } + + /** + * Prints the content similar too:. + * + * ``` + * WARN Your XML configuration validates against a deprecated schema... + * ``` + */ + public function writeThrowable(\Throwable $throwable): void + { + $this->output->writeln(['', ' <fg=white;bg=red;options=bold> ERROR </> '.$throwable->getMessage()]); + } + + /** + * Prints the content similar too:. + * + * ``` + * PASS Unit\ExampleTest + * ✓ basic test + * ``` + */ + public function writeCurrentTestCaseSummary(State $state): void + { + if ($state->testCaseTestsCount() === 0 || is_null($state->testCaseName)) { + return; + } + + if (! $state->headerPrinted && ! DefaultPrinter::compact()) { + $this->output->writeln($this->titleLineFrom( + $state->getTestCaseFontColor(), + $state->getTestCaseTitleColor(), + $state->getTestCaseTitle(), + $state->testCaseName, + $state->todosCount(), + )); + $state->headerPrinted = true; + } + + $state->eachTestCaseTests(function (TestResult $testResult): void { + if ($testResult->description !== '') { + if (DefaultPrinter::compact()) { + $this->writeCompactDescriptionLine($testResult); + } else { + $this->writeDescriptionLine($testResult); + } + } + }); + } + + /** + * Prints the content similar too:. + * + * ``` + * PASS Unit\ExampleTest + * ✓ basic test + * ``` + */ + public function writeErrorsSummary(State $state): void + { + $configuration = Registry::get(); + $failTypes = [ + TestResult::FAIL, + ]; + + if ($configuration->displayDetailsOnTestsThatTriggerNotices()) { + $failTypes[] = TestResult::NOTICE; + } + + if ($configuration->displayDetailsOnTestsThatTriggerDeprecations()) { + $failTypes[] = TestResult::DEPRECATED; + } + + if ($configuration->failOnWarning() || $configuration->displayDetailsOnTestsThatTriggerWarnings()) { + $failTypes[] = TestResult::WARN; + } + + if ($configuration->failOnRisky()) { + $failTypes[] = TestResult::RISKY; + } + + if ($configuration->failOnIncomplete() || $configuration->displayDetailsOnIncompleteTests()) { + $failTypes[] = TestResult::INCOMPLETE; + } + + if ($configuration->failOnSkipped() || $configuration->displayDetailsOnSkippedTests()) { + $failTypes[] = TestResult::SKIPPED; + } + + $failTypes = array_unique($failTypes); + + $errors = array_values(array_filter($state->suiteTests, fn (TestResult $testResult) => in_array( + $testResult->type, + $failTypes, + true + ))); + + array_map(function (TestResult $testResult): void { + if (! $testResult->throwable instanceof Throwable) { + throw new ShouldNotHappen(); + } + + renderUsing($this->output); + render(<<<'HTML' + <div class="mx-2 text-red"> + <hr/> + </div> + HTML + ); + + $testCaseName = $testResult->testCaseName; + $description = $testResult->description; + + /** @var class-string $throwableClassName */ + $throwableClassName = $testResult->throwable->className(); + + $throwableClassName = ! in_array($throwableClassName, [ + ExpectationFailedException::class, + IncompleteTestError::class, + SkippedWithMessageException::class, + TestOutcome::class, + ], true) ? sprintf('<span class="px-1 bg-red font-bold">%s</span>', (new ReflectionClass($throwableClassName))->getShortName()) + : ''; + + $truncateClasses = $this->output->isVerbose() ? '' : 'flex-1 truncate'; + + renderUsing($this->output); + render(sprintf(<<<'HTML' + <div class="flex justify-between mx-2"> + <span class="%s"> + <span class="px-1 bg-%s %s font-bold uppercase">%s</span> <span class="font-bold">%s</span><span class="text-gray mx-1">></span><span>%s</span> + </span> + <span class="ml-1"> + %s + </span> + </div> + HTML, $truncateClasses, $testResult->color === 'yellow' ? 'yellow-400' : $testResult->color, $testResult->color === 'yellow' ? 'text-black' : '', $testResult->type, $testCaseName, $description, $throwableClassName)); + + $this->writeError($testResult->throwable); + }, $errors); + } + + /** + * Writes the final recap. + */ + public function writeRecap(State $state, Info $telemetry, PHPUnitTestResult $result): void + { + $tests = []; + foreach (self::TYPES as $type) { + if (($countTests = $state->countTestsInTestSuiteBy($type)) !== 0) { + $color = TestResult::makeColor($type); + + if ($type === TestResult::WARN && $countTests < 2) { + $type = 'warning'; + } + + if ($type === TestResult::NOTICE && $countTests > 1) { + $type = 'notices'; + } + + if ($type === TestResult::TODO && $countTests > 1) { + $type = 'todos'; + } + + $tests[] = "<fg=$color;options=bold>$countTests $type</>"; + } + } + + $pending = ResultReflection::numberOfTests($result) - $result->numberOfTestsRun(); + if ($pending > 0) { + $tests[] = "\e[2m$pending pending\e[22m"; + } + + $timeElapsed = number_format($telemetry->durationSinceStart()->asFloat(), 2, '.', ''); + + $this->output->writeln(['']); + + if (! empty($tests)) { + $this->output->writeln([ + sprintf( + ' <fg=gray>Tests:</> <fg=default>%s</><fg=gray> (%s assertions)</>', + implode('<fg=gray>,</> ', $tests), + $result->numberOfAssertions() + ), + ]); + } + + $this->output->writeln([ + sprintf( + ' <fg=gray>Duration:</> <fg=default>%ss</>', + $timeElapsed + ), + ]); + + $this->output->writeln(''); + } + + /** + * @param array<int, TestResult> $slowTests + */ + public function writeSlowTests(array $slowTests, Info $telemetry): void + { + $this->output->writeln(' <fg=gray>Top 10 slowest tests:</>'); + + $timeElapsed = $telemetry->durationSinceStart()->asFloat(); + + foreach ($slowTests as $testResult) { + $seconds = number_format($testResult->duration / 1000, 2, '.', ''); + + $color = ($testResult->duration / 1000) > $timeElapsed * 0.25 ? 'red' : ($testResult->duration > $timeElapsed * 0.1 ? 'yellow' : 'gray'); + + renderUsing($this->output); + render(sprintf(<<<'HTML' + <div class="flex justify-between space-x-1 mx-2"> + <span class="flex-1"> + <span class="font-bold">%s</span><span class="text-gray mx-1">></span><span class="text-gray">%s</span> + </span> + <span class="ml-1 font-bold text-%s"> + %ss + </span> + </div> + HTML, $testResult->testCaseName, $testResult->description, $color, $seconds)); + } + + $timeElapsedInSlowTests = array_sum(array_map(fn (TestResult $testResult) => $testResult->duration / 1000, $slowTests)); + + $timeElapsedAsString = number_format($timeElapsed, 2, '.', ''); + $percentageInSlowTestsAsString = number_format($timeElapsedInSlowTests * 100 / $timeElapsed, 2, '.', ''); + $timeElapsedInSlowTestsAsString = number_format($timeElapsedInSlowTests, 2, '.', ''); + + renderUsing($this->output); + render(sprintf(<<<'HTML' + <div class="mx-2 mb-1 flex"> + <div class="text-gray"> + <hr/> + </div> + <div class="flex space-x-1 justify-between"> + <span> + </span> + <span> + <span class="text-gray">(%s%% of %ss)</span> + <span class="ml-1 font-bold">%ss</span> + </span> + </div> + </div> + HTML, $percentageInSlowTestsAsString, $timeElapsedAsString, $timeElapsedInSlowTestsAsString)); + } + + /** + * Displays the error using Collision's writer and terminates with exit code === 1. + */ + public function writeError(Throwable $throwable): void + { + $writer = (new Writer())->setOutput($this->output); + + $throwable = new TestException($throwable, $this->output->isVerbose()); + + $writer->showTitle(false); + + $writer->ignoreFilesIn([ + '/vendor\/nunomaduro\/collision/', + '/vendor\/bin\/pest/', + '/bin\/pest/', + '/vendor\/pestphp\/pest/', + '/vendor\/pestphp\/pest-plugin-arch/', + '/vendor\/phpspec\/prophecy-phpunit/', + '/vendor\/phpspec\/prophecy/', + '/vendor\/phpunit\/phpunit\/src/', + '/vendor\/mockery\/mockery/', + '/vendor\/laravel\/dusk/', + '/Illuminate\/Testing/', + '/Illuminate\/Foundation\/Testing/', + '/Illuminate\/Foundation\/Bootstrap\/HandleExceptions/', + '/vendor\/symfony\/framework-bundle\/Test/', + '/vendor\/symfony\/phpunit-bridge/', + '/vendor\/symfony\/dom-crawler/', + '/vendor\/symfony\/browser-kit/', + '/vendor\/symfony\/css-selector/', + '/vendor\/bin\/.phpunit/', + '/bin\/.phpunit/', + '/vendor\/bin\/simple-phpunit/', + '/bin\/phpunit/', + '/vendor\/coduo\/php-matcher\/src\/PHPUnit/', + '/vendor\/sulu\/sulu\/src\/Sulu\/Bundle\/TestBundle\/Testing/', + '/vendor\/webmozart\/assert/', + + $this->ignorePestPipes(...), + $this->ignorePestExtends(...), + $this->ignorePestInterceptors(...), + + ]); + + /** @var \Throwable $throwable */ + $inspector = new Inspector($throwable); + + $writer->write($inspector); + } + + /** + * Returns the title contents. + */ + private function titleLineFrom(string $fg, string $bg, string $title, string $testCaseName, int $todos): string + { + return sprintf( + "\n <fg=%s;bg=%s;options=bold> %s </><fg=default> %s</>%s", + $fg, + $bg, + $title, + $testCaseName, + $todos > 0 ? sprintf('<fg=gray> - %s todo%s</>', $todos, $todos > 1 ? 's' : '') : '', + ); + } + + /** + * Writes a description line. + */ + private function writeCompactDescriptionLine(TestResult $result): void + { + $symbolsOnCurrentLine = $this->compactProcessed % $this->compactSymbolsPerLine; + + if ($symbolsOnCurrentLine >= $this->terminal->width() - 4) { + $symbolsOnCurrentLine = 0; + } + + if ($symbolsOnCurrentLine === 0) { + $this->output->writeln(''); + $this->output->write(' '); + } + + $this->output->write(sprintf('<fg=%s;options=bold>%s</>', $result->compactColor, $result->compactIcon)); + + $this->compactProcessed++; + } + + /** + * Writes a description line. + */ + private function writeDescriptionLine(TestResult $result): void + { + if (! empty($warning = $result->warning)) { + if (! str_contains($warning, "\n")) { + $warning = sprintf( + ' → %s', + $warning + ); + } else { + $warningLines = explode("\n", $warning); + $warning = ''; + + foreach ($warningLines as $w) { + $warning .= sprintf( + "\n <fg=yellow;options=bold>⇂ %s</>", + trim($w) + ); + } + } + } + + $seconds = ''; + + if (($result->duration / 1000) > 0.0) { + $seconds = number_format($result->duration / 1000, 2, '.', ''); + $seconds = $seconds !== '0.00' ? sprintf('<span class="text-gray mr-2">%ss</span>', $seconds) : ''; + } + + if (isset($_SERVER['REBUILD_SNAPSHOTS']) || (isset($_SERVER['COLLISION_IGNORE_DURATION']) && $_SERVER['COLLISION_IGNORE_DURATION'] === 'true')) { + $seconds = ''; + } + + $truncateClasses = $this->output->isVerbose() ? '' : 'flex-1 truncate'; + + if ($warning !== '') { + $warning = sprintf('<span class="ml-1 text-yellow">%s</span>', $warning); + + if (! empty($result->warningSource)) { + $warning .= ' // '.$result->warningSource; + } + } + + $description = preg_replace('/`([^`]+)`/', '<span class="text-white">$1</span>', $result->description); + + renderUsing($this->output); + render(sprintf(<<<'HTML' + <div class="%s ml-2"> + <span class="%s text-gray"> + <span class="text-%s font-bold">%s</span><span class="ml-1 text-gray">%s</span>%s + </span>%s + </div> + HTML, $seconds === '' ? '' : 'flex space-x-1 justify-between', $truncateClasses, $result->color, $result->icon, $description, $warning, $seconds)); + } + + /** + * @param Frame $frame + */ + private function ignorePestPipes($frame): bool + { + if (class_exists(Expectation::class)) { + $reflection = new ReflectionClass(Expectation::class); + + /** @var array<string, array<Closure(Closure, mixed ...$arguments): void>> $expectationPipes */ + $expectationPipes = $reflection->getStaticPropertyValue('pipes', []); + + foreach ($expectationPipes as $pipes) { + foreach ($pipes as $pipeClosure) { + if ($this->isFrameInClosure($frame, $pipeClosure)) { + return true; + } + } + } + } + + return false; + } + + /** + * @param Frame $frame + */ + private function ignorePestExtends($frame): bool + { + if (class_exists(Expectation::class)) { + $reflection = new ReflectionClass(Expectation::class); + + /** @var array<string, Closure> $extends */ + $extends = $reflection->getStaticPropertyValue('extends', []); + + foreach ($extends as $extendClosure) { + if ($this->isFrameInClosure($frame, $extendClosure)) { + return true; + } + } + } + + return false; + } + + /** + * @param Frame $frame + */ + private function ignorePestInterceptors($frame): bool + { + if (class_exists(Expectation::class)) { + $reflection = new ReflectionClass(Expectation::class); + + /** @var array<string, array<Closure(Closure, mixed ...$arguments): void>> $expectationInterceptors */ + $expectationInterceptors = $reflection->getStaticPropertyValue('interceptors', []); + + foreach ($expectationInterceptors as $pipes) { + foreach ($pipes as $pipeClosure) { + if ($this->isFrameInClosure($frame, $pipeClosure)) { + return true; + } + } + } + } + + return false; + } + + /** + * @param Frame $frame + */ + private function isFrameInClosure($frame, Closure $closure): bool + { + $reflection = new ReflectionFunction($closure); + + $sanitizedPath = (string) str_replace('\\', '/', (string) $frame->getFile()); + + /** @phpstan-ignore-next-line */ + $sanitizedClosurePath = (string) str_replace('\\', '/', $reflection->getFileName()); + + if ($sanitizedPath === $sanitizedClosurePath) { + if ($reflection->getStartLine() <= $frame->getLine() && $frame->getLine() <= $reflection->getEndLine()) { + return true; + } + } + + return false; + } +} diff --git a/vendor/nunomaduro/collision/src/Adapters/Phpunit/Subscribers/EnsurePrinterIsRegisteredSubscriber.php b/vendor/nunomaduro/collision/src/Adapters/Phpunit/Subscribers/EnsurePrinterIsRegisteredSubscriber.php new file mode 100644 index 00000000..97adf303 --- /dev/null +++ b/vendor/nunomaduro/collision/src/Adapters/Phpunit/Subscribers/EnsurePrinterIsRegisteredSubscriber.php @@ -0,0 +1,310 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision\Adapters\Phpunit\Subscribers; + +use NunoMaduro\Collision\Adapters\Phpunit\Printers\DefaultPrinter; +use NunoMaduro\Collision\Adapters\Phpunit\Printers\ReportablePrinter; +use PHPUnit\Event\Application\Started; +use PHPUnit\Event\Application\StartedSubscriber; +use PHPUnit\Event\Facade; +use PHPUnit\Event\Test\BeforeFirstTestMethodErrored; +use PHPUnit\Event\Test\BeforeFirstTestMethodErroredSubscriber; +use PHPUnit\Event\Test\ConsideredRisky; +use PHPUnit\Event\Test\ConsideredRiskySubscriber; +use PHPUnit\Event\Test\DeprecationTriggered; +use PHPUnit\Event\Test\DeprecationTriggeredSubscriber; +use PHPUnit\Event\Test\Errored; +use PHPUnit\Event\Test\ErroredSubscriber; +use PHPUnit\Event\Test\Failed; +use PHPUnit\Event\Test\FailedSubscriber; +use PHPUnit\Event\Test\Finished; +use PHPUnit\Event\Test\FinishedSubscriber; +use PHPUnit\Event\Test\MarkedIncomplete; +use PHPUnit\Event\Test\MarkedIncompleteSubscriber; +use PHPUnit\Event\Test\NoticeTriggered; +use PHPUnit\Event\Test\NoticeTriggeredSubscriber; +use PHPUnit\Event\Test\Passed; +use PHPUnit\Event\Test\PassedSubscriber; +use PHPUnit\Event\Test\PhpDeprecationTriggered; +use PHPUnit\Event\Test\PhpDeprecationTriggeredSubscriber; +use PHPUnit\Event\Test\PhpNoticeTriggered; +use PHPUnit\Event\Test\PhpNoticeTriggeredSubscriber; +use PHPUnit\Event\Test\PhpunitDeprecationTriggered; +use PHPUnit\Event\Test\PhpunitDeprecationTriggeredSubscriber; +use PHPUnit\Event\Test\PhpunitErrorTriggered; +use PHPUnit\Event\Test\PhpunitErrorTriggeredSubscriber; +use PHPUnit\Event\Test\PhpunitWarningTriggered; +use PHPUnit\Event\Test\PhpunitWarningTriggeredSubscriber; +use PHPUnit\Event\Test\PhpWarningTriggered; +use PHPUnit\Event\Test\PhpWarningTriggeredSubscriber; +use PHPUnit\Event\Test\PreparationStarted; +use PHPUnit\Event\Test\PreparationStartedSubscriber; +use PHPUnit\Event\Test\PrintedUnexpectedOutput; +use PHPUnit\Event\Test\PrintedUnexpectedOutputSubscriber; +use PHPUnit\Event\Test\Skipped; +use PHPUnit\Event\Test\SkippedSubscriber; +use PHPUnit\Event\Test\WarningTriggered; +use PHPUnit\Event\Test\WarningTriggeredSubscriber; +use PHPUnit\Event\TestRunner\Configured; +use PHPUnit\Event\TestRunner\ConfiguredSubscriber; +use PHPUnit\Event\TestRunner\DeprecationTriggered as TestRunnerDeprecationTriggered; +use PHPUnit\Event\TestRunner\DeprecationTriggeredSubscriber as TestRunnerDeprecationTriggeredSubscriber; +use PHPUnit\Event\TestRunner\ExecutionFinished; +use PHPUnit\Event\TestRunner\ExecutionFinishedSubscriber; +use PHPUnit\Event\TestRunner\ExecutionStarted; +use PHPUnit\Event\TestRunner\ExecutionStartedSubscriber; +use PHPUnit\Event\TestRunner\WarningTriggered as TestRunnerWarningTriggered; +use PHPUnit\Event\TestRunner\WarningTriggeredSubscriber as TestRunnerWarningTriggeredSubscriber; +use PHPUnit\Runner\Version; + +if (class_exists(Version::class) && (int) Version::series() >= 10) { + /** + * @internal + */ + final class EnsurePrinterIsRegisteredSubscriber implements StartedSubscriber + { + /** + * If this subscriber has been registered on PHPUnit's facade. + */ + private static bool $registered = false; + + /** + * Runs the subscriber. + */ + public function notify(Started $event): void + { + $printer = new ReportablePrinter(new DefaultPrinter(true)); + + if (isset($_SERVER['COLLISION_PRINTER_COMPACT'])) { + DefaultPrinter::compact(true); + } + + if (isset($_SERVER['COLLISION_PRINTER_PROFILE'])) { + DefaultPrinter::profile(true); + } + + $subscribers = [ + // Configured + new class($printer) extends Subscriber implements ConfiguredSubscriber + { + public function notify(Configured $event): void + { + $this->printer()->setDecorated( + $event->configuration()->colors() + ); + } + }, + + // Test + new class($printer) extends Subscriber implements PrintedUnexpectedOutputSubscriber + { + public function notify(PrintedUnexpectedOutput $event): void + { + $this->printer()->testPrintedUnexpectedOutput($event); + } + }, + + // Test Runner + new class($printer) extends Subscriber implements ExecutionStartedSubscriber + { + public function notify(ExecutionStarted $event): void + { + $this->printer()->testRunnerExecutionStarted($event); + } + }, + + new class($printer) extends Subscriber implements ExecutionFinishedSubscriber + { + public function notify(ExecutionFinished $event): void + { + $this->printer()->testRunnerExecutionFinished($event); + } + }, + + // Test > Hook Methods + + new class($printer) extends Subscriber implements BeforeFirstTestMethodErroredSubscriber + { + public function notify(BeforeFirstTestMethodErrored $event): void + { + $this->printer()->testBeforeFirstTestMethodErrored($event); + } + }, + + // Test > Lifecycle ... + + new class($printer) extends Subscriber implements FinishedSubscriber + { + public function notify(Finished $event): void + { + $this->printer()->testFinished($event); + } + }, + + new class($printer) extends Subscriber implements PreparationStartedSubscriber + { + public function notify(PreparationStarted $event): void + { + $this->printer()->testPreparationStarted($event); + } + }, + + // Test > Issues ... + + new class($printer) extends Subscriber implements ConsideredRiskySubscriber + { + public function notify(ConsideredRisky $event): void + { + $this->printer()->testConsideredRisky($event); + } + }, + + new class($printer) extends Subscriber implements DeprecationTriggeredSubscriber + { + public function notify(DeprecationTriggered $event): void + { + $this->printer()->testDeprecationTriggered($event); + } + }, + + new class($printer) extends Subscriber implements TestRunnerDeprecationTriggeredSubscriber + { + public function notify(TestRunnerDeprecationTriggered $event): void + { + $this->printer()->testRunnerDeprecationTriggered($event); + } + }, + + new class($printer) extends Subscriber implements TestRunnerWarningTriggeredSubscriber + { + public function notify(TestRunnerWarningTriggered $event): void + { + $this->printer()->testRunnerWarningTriggered($event); + } + }, + + new class($printer) extends Subscriber implements PhpDeprecationTriggeredSubscriber + { + public function notify(PhpDeprecationTriggered $event): void + { + $this->printer()->testPhpDeprecationTriggered($event); + } + }, + + new class($printer) extends Subscriber implements PhpunitDeprecationTriggeredSubscriber + { + public function notify(PhpunitDeprecationTriggered $event): void + { + $this->printer()->testPhpunitDeprecationTriggered($event); + } + }, + + new class($printer) extends Subscriber implements PhpNoticeTriggeredSubscriber + { + public function notify(PhpNoticeTriggered $event): void + { + $this->printer()->testPhpNoticeTriggered($event); + } + }, + + new class($printer) extends Subscriber implements PhpWarningTriggeredSubscriber + { + public function notify(PhpWarningTriggered $event): void + { + $this->printer()->testPhpWarningTriggered($event); + } + }, + + new class($printer) extends Subscriber implements PhpunitWarningTriggeredSubscriber + { + public function notify(PhpunitWarningTriggered $event): void + { + $this->printer()->testPhpunitWarningTriggered($event); + } + }, + + new class($printer) extends Subscriber implements PhpunitErrorTriggeredSubscriber + { + public function notify(PhpunitErrorTriggered $event): void + { + $this->printer()->testPhpunitErrorTriggered($event); + } + }, + + // Test > Outcome ... + + new class($printer) extends Subscriber implements ErroredSubscriber + { + public function notify(Errored $event): void + { + $this->printer()->testErrored($event); + } + }, + new class($printer) extends Subscriber implements FailedSubscriber + { + public function notify(Failed $event): void + { + $this->printer()->testFailed($event); + } + }, + new class($printer) extends Subscriber implements MarkedIncompleteSubscriber + { + public function notify(MarkedIncomplete $event): void + { + $this->printer()->testMarkedIncomplete($event); + } + }, + + new class($printer) extends Subscriber implements NoticeTriggeredSubscriber + { + public function notify(NoticeTriggered $event): void + { + $this->printer()->testNoticeTriggered($event); + } + }, + + new class($printer) extends Subscriber implements PassedSubscriber + { + public function notify(Passed $event): void + { + $this->printer()->testPassed($event); + } + }, + new class($printer) extends Subscriber implements SkippedSubscriber + { + public function notify(Skipped $event): void + { + $this->printer()->testSkipped($event); + } + }, + + new class($printer) extends Subscriber implements WarningTriggeredSubscriber + { + public function notify(WarningTriggered $event): void + { + $this->printer()->testWarningTriggered($event); + } + }, + ]; + + Facade::instance()->registerSubscribers(...$subscribers); + } + + /** + * Registers the subscriber on PHPUnit's facade. + */ + public static function register(): void + { + $shouldRegister = self::$registered === false + && isset($_SERVER['COLLISION_PRINTER']); + + if ($shouldRegister) { + self::$registered = true; + + Facade::instance()->registerSubscriber(new self()); + } + } + } +} diff --git a/vendor/nunomaduro/collision/src/Adapters/Phpunit/Subscribers/Subscriber.php b/vendor/nunomaduro/collision/src/Adapters/Phpunit/Subscribers/Subscriber.php new file mode 100644 index 00000000..e5400dc1 --- /dev/null +++ b/vendor/nunomaduro/collision/src/Adapters/Phpunit/Subscribers/Subscriber.php @@ -0,0 +1,43 @@ +<?php + +declare(strict_types=1); + +/** + * This file is part of Collision. + * + * (c) Nuno Maduro <enunomaduro@gmail.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace NunoMaduro\Collision\Adapters\Phpunit\Subscribers; + +use NunoMaduro\Collision\Adapters\Phpunit\Printers\ReportablePrinter; + +/** + * @internal + */ +abstract class Subscriber +{ + /** + * The printer instance. + */ + private ReportablePrinter $printer; + + /** + * Creates a new subscriber. + */ + public function __construct(ReportablePrinter $printer) + { + $this->printer = $printer; + } + + /** + * Returns the printer instance. + */ + protected function printer(): ReportablePrinter + { + return $this->printer; + } +} diff --git a/vendor/nunomaduro/collision/src/Adapters/Phpunit/Support/ResultReflection.php b/vendor/nunomaduro/collision/src/Adapters/Phpunit/Support/ResultReflection.php new file mode 100644 index 00000000..4c8b9a0d --- /dev/null +++ b/vendor/nunomaduro/collision/src/Adapters/Phpunit/Support/ResultReflection.php @@ -0,0 +1,21 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision\Adapters\Phpunit\Support; + +use PHPUnit\TestRunner\TestResult\TestResult; + +/** + * @internal + */ +final class ResultReflection +{ + /** + * The number of processed tests. + */ + public static function numberOfTests(TestResult $testResult): int + { + return (fn () => $this->numberOfTests)->call($testResult); + } +} diff --git a/vendor/nunomaduro/collision/src/Adapters/Phpunit/TestResult.php b/vendor/nunomaduro/collision/src/Adapters/Phpunit/TestResult.php new file mode 100644 index 00000000..29060510 --- /dev/null +++ b/vendor/nunomaduro/collision/src/Adapters/Phpunit/TestResult.php @@ -0,0 +1,324 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision\Adapters\Phpunit; + +use NunoMaduro\Collision\Contracts\Adapters\Phpunit\HasPrintableTestCaseName; +use NunoMaduro\Collision\Exceptions\ShouldNotHappen; +use PHPUnit\Event\Code\Test; +use PHPUnit\Event\Code\TestMethod; +use PHPUnit\Event\Code\Throwable; +use PHPUnit\Event\Test\BeforeFirstTestMethodErrored; + +/** + * @internal + */ +final class TestResult +{ + public const FAIL = 'failed'; + + public const SKIPPED = 'skipped'; + + public const INCOMPLETE = 'incomplete'; + + public const TODO = 'todo'; + + public const RISKY = 'risky'; + + public const DEPRECATED = 'deprecated'; + + public const NOTICE = 'notice'; + + public const WARN = 'warnings'; + + public const RUNS = 'pending'; + + public const PASS = 'passed'; + + public string $id; + + public string $testCaseName; + + public string $description; + + public string $type; + + public string $compactIcon; + + public string $icon; + + public string $compactColor; + + public string $color; + + public float $duration; + + public ?Throwable $throwable; + + public string $warning = ''; + + public string $warningSource = ''; + + /** + * Creates a new TestResult instance. + */ + private function __construct(string $id, string $testCaseName, string $description, string $type, string $icon, string $compactIcon, string $color, string $compactColor, Throwable $throwable = null) + { + $this->id = $id; + $this->testCaseName = $testCaseName; + $this->description = $description; + $this->type = $type; + $this->icon = $icon; + $this->compactIcon = $compactIcon; + $this->color = $color; + $this->compactColor = $compactColor; + $this->throwable = $throwable; + + $this->duration = 0.0; + + $asWarning = $this->type === TestResult::WARN + || $this->type === TestResult::RISKY + || $this->type === TestResult::SKIPPED + || $this->type === TestResult::DEPRECATED + || $this->type === TestResult::NOTICE + || $this->type === TestResult::INCOMPLETE; + + if ($throwable instanceof Throwable && $asWarning) { + if (in_array($this->type, [TestResult::DEPRECATED, TestResult::NOTICE])) { + foreach (explode("\n", $throwable->stackTrace()) as $line) { + if (strpos($line, 'vendor/nunomaduro/collision') === false) { + $this->warningSource = str_replace(getcwd().'/', '', $line); + + break; + } + } + } + + $this->warning .= trim((string) preg_replace("/\r|\n/", ' ', $throwable->message())); + + // pest specific + $this->warning = str_replace('__pest_evaluable_', '', $this->warning); + $this->warning = str_replace('This test depends on "P\\', 'This test depends on "', $this->warning); + } + } + + /** + * Sets the telemetry information. + */ + public function setDuration(float $duration): void + { + $this->duration = $duration; + } + + /** + * Creates a new test from the given test case. + */ + public static function fromTestCase(Test $test, string $type, Throwable $throwable = null): self + { + if (! $test instanceof TestMethod) { + throw new ShouldNotHappen(); + } + + if (is_subclass_of($test->className(), HasPrintableTestCaseName::class)) { + $testCaseName = $test->className()::getPrintableTestCaseName(); + } else { + $testCaseName = $test->className(); + } + + $description = self::makeDescription($test); + + $icon = self::makeIcon($type); + + $compactIcon = self::makeCompactIcon($type); + + $color = self::makeColor($type); + + $compactColor = self::makeCompactColor($type); + + return new self($test->id(), $testCaseName, $description, $type, $icon, $compactIcon, $color, $compactColor, $throwable); + } + + /** + * Creates a new test from the given Pest Parallel Test Case. + */ + public static function fromPestParallelTestCase(Test $test, string $type, Throwable $throwable = null): self + { + if (! $test instanceof TestMethod) { + throw new ShouldNotHappen(); + } + + if (is_subclass_of($test->className(), HasPrintableTestCaseName::class)) { + $testCaseName = $test->className()::getPrintableTestCaseName(); + } else { + $testCaseName = $test->className(); + } + + if (is_subclass_of($test->className(), HasPrintableTestCaseName::class)) { + $description = $test->testDox()->prettifiedMethodName(); + } else { + $description = self::makeDescription($test); + } + + $icon = self::makeIcon($type); + + $compactIcon = self::makeCompactIcon($type); + + $color = self::makeColor($type); + + $compactColor = self::makeCompactColor($type); + + return new self($test->id(), $testCaseName, $description, $type, $icon, $compactIcon, $color, $compactColor, $throwable); + } + + /** + * Creates a new test from the given test case. + */ + public static function fromBeforeFirstTestMethodErrored(BeforeFirstTestMethodErrored $event): self + { + if (is_subclass_of($event->testClassName(), HasPrintableTestCaseName::class)) { + $testCaseName = $event->testClassName()::getPrintableTestCaseName(); + } else { + $testCaseName = $event->testClassName(); + } + + $description = ''; + + $icon = self::makeIcon(self::FAIL); + + $compactIcon = self::makeCompactIcon(self::FAIL); + + $color = self::makeColor(self::FAIL); + + $compactColor = self::makeCompactColor(self::FAIL); + + return new self($testCaseName, $testCaseName, $description, self::FAIL, $icon, $compactIcon, $color, $compactColor, $event->throwable()); + } + + /** + * Get the test case description. + */ + public static function makeDescription(TestMethod $test): string + { + if (is_subclass_of($test->className(), HasPrintableTestCaseName::class)) { + return $test->className()::getLatestPrintableTestCaseMethodName(); + } + + $name = $test->name(); + + // First, lets replace underscore by spaces. + $name = str_replace('_', ' ', $name); + + // Then, replace upper cases by spaces. + $name = (string) preg_replace('/([A-Z])/', ' $1', $name); + + // Finally, if it starts with `test`, we remove it. + $name = (string) preg_replace('/^test/', '', $name); + + // Removes spaces + $name = trim($name); + + // Lower case everything + $name = mb_strtolower($name); + + return $name; + } + + /** + * Get the test case icon. + */ + public static function makeIcon(string $type): string + { + switch ($type) { + case self::FAIL: + return '⨯'; + case self::SKIPPED: + return '-'; + case self::DEPRECATED: + case self::WARN: + case self::RISKY: + case self::NOTICE: + return '!'; + case self::INCOMPLETE: + return '…'; + case self::TODO: + return '↓'; + case self::RUNS: + return '•'; + default: + return '✓'; + } + } + + /** + * Get the test case compact icon. + */ + public static function makeCompactIcon(string $type): string + { + switch ($type) { + case self::FAIL: + return '⨯'; + case self::SKIPPED: + return 's'; + case self::DEPRECATED: + case self::NOTICE: + case self::WARN: + case self::RISKY: + return '!'; + case self::INCOMPLETE: + return 'i'; + case self::TODO: + return 't'; + case self::RUNS: + return '•'; + default: + return '.'; + } + } + + /** + * Get the test case compact color. + */ + public static function makeCompactColor(string $type): string + { + switch ($type) { + case self::FAIL: + return 'red'; + case self::DEPRECATED: + case self::NOTICE: + case self::SKIPPED: + case self::INCOMPLETE: + case self::RISKY: + case self::WARN: + case self::RUNS: + return 'yellow'; + case self::TODO: + return 'cyan'; + default: + return 'gray'; + } + } + + /** + * Get the test case color. + */ + public static function makeColor(string $type): string + { + switch ($type) { + case self::TODO: + return 'cyan'; + case self::FAIL: + return 'red'; + case self::DEPRECATED: + case self::NOTICE: + case self::SKIPPED: + case self::INCOMPLETE: + case self::RISKY: + case self::WARN: + case self::RUNS: + return 'yellow'; + default: + return 'green'; + } + } +} diff --git a/vendor/nunomaduro/collision/src/ArgumentFormatter.php b/vendor/nunomaduro/collision/src/ArgumentFormatter.php new file mode 100644 index 00000000..ceaf9b18 --- /dev/null +++ b/vendor/nunomaduro/collision/src/ArgumentFormatter.php @@ -0,0 +1,40 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision; + +/** + * @internal + * + * @see \Tests\Unit\ArgumentFormatterTest + */ +final class ArgumentFormatter +{ + private const MAX_STRING_LENGTH = 1000; + + public function format(array $arguments, bool $recursive = true): string + { + $result = []; + + foreach ($arguments as $argument) { + switch (true) { + case is_string($argument): + $result[] = '"'.(mb_strlen($argument) > self::MAX_STRING_LENGTH ? mb_substr($argument, 0, self::MAX_STRING_LENGTH).'...' : $argument).'"'; + break; + case is_array($argument): + $associative = array_keys($argument) !== range(0, count($argument) - 1); + if ($recursive && $associative && count($argument) <= 5) { + $result[] = '['.$this->format($argument, false).']'; + } + break; + case is_object($argument): + $class = get_class($argument); + $result[] = "Object($class)"; + break; + } + } + + return implode(', ', $result); + } +} diff --git a/vendor/nunomaduro/collision/src/ConsoleColor.php b/vendor/nunomaduro/collision/src/ConsoleColor.php new file mode 100644 index 00000000..c7736db0 --- /dev/null +++ b/vendor/nunomaduro/collision/src/ConsoleColor.php @@ -0,0 +1,236 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision; + +use InvalidArgumentException; +use NunoMaduro\Collision\Exceptions\InvalidStyleException; +use NunoMaduro\Collision\Exceptions\ShouldNotHappen; + +/** + * @internal + * + * @final + */ +class ConsoleColor +{ + public const FOREGROUND = 38; + + public const BACKGROUND = 48; + + public const COLOR256_REGEXP = '~^(bg_)?color_(\d{1,3})$~'; + + public const RESET_STYLE = 0; + + private bool $forceStyle = false; + + /** @var array */ + private const STYLES = [ + 'none' => null, + 'bold' => '1', + 'dark' => '2', + 'italic' => '3', + 'underline' => '4', + 'blink' => '5', + 'reverse' => '7', + 'concealed' => '8', + + 'default' => '39', + 'black' => '30', + 'red' => '31', + 'green' => '32', + 'yellow' => '33', + 'blue' => '34', + 'magenta' => '35', + 'cyan' => '36', + 'light_gray' => '37', + + 'dark_gray' => '90', + 'light_red' => '91', + 'light_green' => '92', + 'light_yellow' => '93', + 'light_blue' => '94', + 'light_magenta' => '95', + 'light_cyan' => '96', + 'white' => '97', + + 'bg_default' => '49', + 'bg_black' => '40', + 'bg_red' => '41', + 'bg_green' => '42', + 'bg_yellow' => '43', + 'bg_blue' => '44', + 'bg_magenta' => '45', + 'bg_cyan' => '46', + 'bg_light_gray' => '47', + + 'bg_dark_gray' => '100', + 'bg_light_red' => '101', + 'bg_light_green' => '102', + 'bg_light_yellow' => '103', + 'bg_light_blue' => '104', + 'bg_light_magenta' => '105', + 'bg_light_cyan' => '106', + 'bg_white' => '107', + ]; + + private array $themes = []; + + /** + * @throws InvalidStyleException + * @throws InvalidArgumentException + */ + public function apply(array|string $style, string $text): string + { + if (! $this->isStyleForced() && ! $this->isSupported()) { + return $text; + } + + if (is_string($style)) { + $style = [$style]; + } + if (! is_array($style)) { + throw new InvalidArgumentException('Style must be string or array.'); + } + + $sequences = []; + + foreach ($style as $s) { + if (isset($this->themes[$s])) { + $sequences = array_merge($sequences, $this->themeSequence($s)); + } elseif ($this->isValidStyle($s)) { + $sequences[] = $this->styleSequence($s); + } else { + throw new ShouldNotHappen(); + } + } + + $sequences = array_filter($sequences, function ($val) { + return $val !== null; + }); + + if (empty($sequences)) { + return $text; + } + + return $this->escSequence(implode(';', $sequences)).$text.$this->escSequence(self::RESET_STYLE); + } + + public function setForceStyle(bool $forceStyle): void + { + $this->forceStyle = $forceStyle; + } + + public function isStyleForced(): bool + { + return $this->forceStyle; + } + + public function setThemes(array $themes): void + { + $this->themes = []; + foreach ($themes as $name => $styles) { + $this->addTheme($name, $styles); + } + } + + public function addTheme(string $name, array|string $styles): void + { + if (is_string($styles)) { + $styles = [$styles]; + } + if (! is_array($styles)) { + throw new InvalidArgumentException('Style must be string or array.'); + } + + foreach ($styles as $style) { + if (! $this->isValidStyle($style)) { + throw new InvalidStyleException($style); + } + } + + $this->themes[$name] = $styles; + } + + public function getThemes(): array + { + return $this->themes; + } + + public function hasTheme(string $name): bool + { + return isset($this->themes[$name]); + } + + public function removeTheme(string $name): void + { + unset($this->themes[$name]); + } + + public function isSupported(): bool + { + // The COLLISION_FORCE_COLORS variable is for internal purposes only + if (getenv('COLLISION_FORCE_COLORS') !== false) { + return true; + } + + if (DIRECTORY_SEPARATOR === '\\') { + return getenv('ANSICON') !== false || getenv('ConEmuANSI') === 'ON'; + } + + return function_exists('posix_isatty') && @posix_isatty(STDOUT); + } + + public function are256ColorsSupported(): bool + { + if (DIRECTORY_SEPARATOR === '\\') { + return function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support(STDOUT); + } + + return strpos((string) getenv('TERM'), '256color') !== false; + } + + public function getPossibleStyles(): array + { + return array_keys(self::STYLES); + } + + private function themeSequence(string $name): array + { + $sequences = []; + foreach ($this->themes[$name] as $style) { + $sequences[] = $this->styleSequence($style); + } + + return $sequences; + } + + private function styleSequence(string $style): ?string + { + if (array_key_exists($style, self::STYLES)) { + return self::STYLES[$style]; + } + + if (! $this->are256ColorsSupported()) { + return null; + } + + preg_match(self::COLOR256_REGEXP, $style, $matches); + + $type = $matches[1] === 'bg_' ? self::BACKGROUND : self::FOREGROUND; + $value = $matches[2]; + + return "$type;5;$value"; + } + + private function isValidStyle(string $style): bool + { + return array_key_exists($style, self::STYLES) || preg_match(self::COLOR256_REGEXP, $style); + } + + private function escSequence(string|int $value): string + { + return "\033[{$value}m"; + } +} diff --git a/vendor/nunomaduro/collision/src/Contracts/Adapters/Phpunit/HasPrintableTestCaseName.php b/vendor/nunomaduro/collision/src/Contracts/Adapters/Phpunit/HasPrintableTestCaseName.php new file mode 100644 index 00000000..c3cc290b --- /dev/null +++ b/vendor/nunomaduro/collision/src/Contracts/Adapters/Phpunit/HasPrintableTestCaseName.php @@ -0,0 +1,26 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision\Contracts\Adapters\Phpunit; + +/** + * @internal + */ +interface HasPrintableTestCaseName +{ + /** + * The printable test case name. + */ + public static function getPrintableTestCaseName(): string; + + /** + * The printable test case method name. + */ + public function getPrintableTestCaseMethodName(): string; + + /** + * The "latest" printable test case method name. + */ + public static function getLatestPrintableTestCaseMethodName(): string; +} diff --git a/vendor/nunomaduro/collision/src/Contracts/RenderableOnCollisionEditor.php b/vendor/nunomaduro/collision/src/Contracts/RenderableOnCollisionEditor.php new file mode 100644 index 00000000..27e4865b --- /dev/null +++ b/vendor/nunomaduro/collision/src/Contracts/RenderableOnCollisionEditor.php @@ -0,0 +1,13 @@ +<?php + +namespace NunoMaduro\Collision\Contracts; + +use Whoops\Exception\Frame; + +interface RenderableOnCollisionEditor +{ + /** + * Returns the frame to be used on the Collision Editor. + */ + public function toCollisionEditor(): Frame; +} diff --git a/vendor/nunomaduro/collision/src/Contracts/RenderlessEditor.php b/vendor/nunomaduro/collision/src/Contracts/RenderlessEditor.php new file mode 100644 index 00000000..abc50df0 --- /dev/null +++ b/vendor/nunomaduro/collision/src/Contracts/RenderlessEditor.php @@ -0,0 +1,12 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision\Contracts; + +/** + * @internal + */ +interface RenderlessEditor +{ +} diff --git a/vendor/nunomaduro/collision/src/Contracts/RenderlessTrace.php b/vendor/nunomaduro/collision/src/Contracts/RenderlessTrace.php new file mode 100644 index 00000000..dc3e69f8 --- /dev/null +++ b/vendor/nunomaduro/collision/src/Contracts/RenderlessTrace.php @@ -0,0 +1,12 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision\Contracts; + +/** + * @internal + */ +interface RenderlessTrace +{ +} diff --git a/vendor/nunomaduro/collision/src/Contracts/SolutionsRepository.php b/vendor/nunomaduro/collision/src/Contracts/SolutionsRepository.php new file mode 100644 index 00000000..fa43731e --- /dev/null +++ b/vendor/nunomaduro/collision/src/Contracts/SolutionsRepository.php @@ -0,0 +1,21 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision\Contracts; + +use Spatie\Ignition\Contracts\Solution; +use Throwable; + +/** + * @internal + */ +interface SolutionsRepository +{ + /** + * Gets the solutions from the given `$throwable`. + * + * @return array<int, Solution> + */ + public function getFromThrowable(Throwable $throwable): array; +} diff --git a/vendor/nunomaduro/collision/src/Coverage.php b/vendor/nunomaduro/collision/src/Coverage.php new file mode 100644 index 00000000..9a9fe00a --- /dev/null +++ b/vendor/nunomaduro/collision/src/Coverage.php @@ -0,0 +1,202 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision; + +use SebastianBergmann\CodeCoverage\CodeCoverage; +use SebastianBergmann\CodeCoverage\Node\Directory; +use SebastianBergmann\CodeCoverage\Node\File; +use SebastianBergmann\Environment\Runtime; +use Symfony\Component\Console\Output\OutputInterface; + +use function Termwind\render; +use function Termwind\renderUsing; +use function Termwind\terminal; + +/** + * @internal + */ +final class Coverage +{ + /** + * Returns the coverage path. + */ + public static function getPath(): string + { + return implode(DIRECTORY_SEPARATOR, [ + dirname(__DIR__), + '.temp', + 'coverage', + ]); + } + + /** + * Runs true there is any code coverage driver available. + */ + public static function isAvailable(): bool + { + $runtime = new Runtime(); + + if (! $runtime->canCollectCodeCoverage()) { + return false; + } + + if ($runtime->hasPCOV() || $runtime->hasPHPDBGCodeCoverage()) { + return true; + } + + if (self::usingXdebug()) { + $mode = getenv('XDEBUG_MODE') ?: ini_get('xdebug.mode'); + + return $mode && in_array('coverage', explode(',', $mode), true); + } + + return true; + } + + /** + * If the user is using Xdebug. + */ + public static function usingXdebug(): bool + { + return (new Runtime())->hasXdebug(); + } + + /** + * Reports the code coverage report to the + * console and returns the result in float. + */ + public static function report(OutputInterface $output): float + { + if (! file_exists($reportPath = self::getPath())) { + if (self::usingXdebug()) { + $output->writeln( + " <fg=black;bg=yellow;options=bold> WARN </> Unable to get coverage using Xdebug. Did you set <href=https://xdebug.org/docs/code_coverage#mode>Xdebug's coverage mode</>?</>", + ); + + return 0.0; + } + + $output->writeln( + ' <fg=black;bg=yellow;options=bold> WARN </> No coverage driver detected.</> Did you install <href=https://xdebug.org/>Xdebug</> or <href=https://github.com/krakjoe/pcov>PCOV</>?', + ); + + return 0.0; + } + + /** @var CodeCoverage $codeCoverage */ + $codeCoverage = require $reportPath; + unlink($reportPath); + + $totalCoverage = $codeCoverage->getReport()->percentageOfExecutedLines(); + + /** @var Directory<File|Directory> $report */ + $report = $codeCoverage->getReport(); + + foreach ($report->getIterator() as $file) { + if (! $file instanceof File) { + continue; + } + $dirname = dirname($file->id()); + $basename = basename($file->id(), '.php'); + + $name = $dirname === '.' ? $basename : implode(DIRECTORY_SEPARATOR, [ + $dirname, + $basename, + ]); + + $percentage = $file->numberOfExecutableLines() === 0 + ? '100.0' + : number_format($file->percentageOfExecutedLines()->asFloat(), 1, '.', ''); + + $uncoveredLines = ''; + + $percentageOfExecutedLinesAsString = $file->percentageOfExecutedLines()->asString(); + + if (! in_array($percentageOfExecutedLinesAsString, ['0.00%', '100.00%', '100.0%', ''], true)) { + $uncoveredLines = trim(implode(', ', self::getMissingCoverage($file))); + $uncoveredLines = sprintf('<span>%s</span>', $uncoveredLines).' <span class="text-gray"> / </span>'; + } + + $color = $percentage === '100.0' ? 'green' : ($percentage === '0.0' ? 'red' : 'yellow'); + + $truncateAt = max(1, terminal()->width() - 12); + + renderUsing($output); + render(<<<HTML + <div class="flex mx-2"> + <span class="truncate-{$truncateAt}">{$name}</span> + <span class="flex-1 content-repeat-[.] text-gray mx-1"></span> + <span class="text-{$color}">$uncoveredLines {$percentage}%</span> + </div> + HTML); + } + + $totalCoverageAsString = $totalCoverage->asFloat() === 0.0 + ? '0.0' + : number_format($totalCoverage->asFloat(), 1, '.', ''); + + renderUsing($output); + render(<<<HTML + <div class="mx-2"> + <hr class="text-gray" /> + <div class="w-full text-right"> + <span class="ml-1 font-bold">Total: {$totalCoverageAsString} %</span> + </div> + </div> + HTML); + + return $totalCoverage->asFloat(); + } + + /** + * Generates an array of missing coverage on the following format:. + * + * ``` + * ['11', '20..25', '50', '60..80']; + * ``` + * + * @param File $file + * @return array<int, string> + */ + public static function getMissingCoverage($file): array + { + $shouldBeNewLine = true; + + $eachLine = function (array $array, array $tests, int $line) use (&$shouldBeNewLine): array { + if ($tests !== []) { + $shouldBeNewLine = true; + + return $array; + } + + if ($shouldBeNewLine) { + $array[] = (string) $line; + $shouldBeNewLine = false; + + return $array; + } + + $lastKey = count($array) - 1; + + if (array_key_exists($lastKey, $array) && str_contains((string) $array[$lastKey], '..')) { + [$from] = explode('..', (string) $array[$lastKey]); + $array[$lastKey] = $line > $from ? sprintf('%s..%s', $from, $line) : sprintf('%s..%s', $line, $from); + + return $array; + } + + $array[$lastKey] = sprintf('%s..%s', $array[$lastKey], $line); + + return $array; + }; + + $array = []; + foreach (array_filter($file->lineCoverageData(), 'is_array') as $line => $tests) { + $array = $eachLine($array, $tests, $line); + } + + return $array; + } +} diff --git a/vendor/nunomaduro/collision/src/Exceptions/InvalidStyleException.php b/vendor/nunomaduro/collision/src/Exceptions/InvalidStyleException.php new file mode 100644 index 00000000..4893e90b --- /dev/null +++ b/vendor/nunomaduro/collision/src/Exceptions/InvalidStyleException.php @@ -0,0 +1,15 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision\Exceptions; + +use RuntimeException; + +/** + * @internal + */ +final class InvalidStyleException extends RuntimeException +{ + // ... +} diff --git a/vendor/nunomaduro/collision/src/Exceptions/ShouldNotHappen.php b/vendor/nunomaduro/collision/src/Exceptions/ShouldNotHappen.php new file mode 100644 index 00000000..940a7fbc --- /dev/null +++ b/vendor/nunomaduro/collision/src/Exceptions/ShouldNotHappen.php @@ -0,0 +1,26 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision\Exceptions; + +use RuntimeException; + +/** + * @internal + */ +final class ShouldNotHappen extends RuntimeException +{ + /** + * @var string + */ + private const MESSAGE = 'This should not happen, please open an issue on collision repository: %s'; + + /** + * Creates a new Exception instance. + */ + public function __construct() + { + parent::__construct(sprintf(self::MESSAGE, 'https://github.com/nunomaduro/collision/issues/new')); + } +} diff --git a/vendor/nunomaduro/collision/src/Exceptions/TestException.php b/vendor/nunomaduro/collision/src/Exceptions/TestException.php new file mode 100644 index 00000000..def4b0cb --- /dev/null +++ b/vendor/nunomaduro/collision/src/Exceptions/TestException.php @@ -0,0 +1,193 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision\Exceptions; + +use PHPUnit\Event\Code\Throwable; +use PHPUnit\Framework\ExpectationFailedException; +use ReflectionClass; + +/** + * @internal + */ +final class TestException +{ + private const DIFF_SEPARATOR = '--- Expected'.PHP_EOL.'+++ Actual'.PHP_EOL.'@@ @@'.PHP_EOL; + + /** + * Creates a new Exception instance. + */ + public function __construct( + private readonly Throwable $throwable, + private readonly bool $isVerbose + ) { + // + } + + public function getThrowable(): Throwable + { + return $this->throwable; + } + + /** + * @return class-string + */ + public function getClassName(): string + { + return $this->throwable->className(); + } + + public function getMessage(): string + { + if ($this->throwable->className() === ExpectationFailedException::class) { + $message = $this->throwable->description(); + } else { + $message = $this->throwable->message(); + } + + $regexes = [ + 'To contain' => '/Failed asserting that \'(.*)\' contains "(.*)"\./s', + 'Not to contain' => '/Failed asserting that \'(.*)\' does not contain "(.*)"\./s', + ]; + + foreach ($regexes as $key => $pattern) { + preg_match($pattern, $message, $matches, PREG_OFFSET_CAPTURE, 0); + + if (count($matches) === 3) { + $message = $this->shortenMessage($matches, $key); + + break; + } + } + + // Diffs... + if (str_contains($message, self::DIFF_SEPARATOR)) { + $diff = ''; + $lines = explode(PHP_EOL, explode(self::DIFF_SEPARATOR, $message)[1]); + + foreach ($lines as $line) { + $diff .= $this->colorizeLine($line, str_starts_with($line, '-') ? 'red' : 'green').PHP_EOL; + } + + $message = str_replace(explode(self::DIFF_SEPARATOR, $message)[1], $diff, $message); + $message = str_replace(self::DIFF_SEPARATOR, '', $message); + } + + return $message; + } + + private function shortenMessage(array $matches, string $key): string + { + $actual = $matches[1][0]; + $expected = $matches[2][0]; + + $actualExploded = explode(PHP_EOL, $actual); + $expectedExploded = explode(PHP_EOL, $expected); + + if (($countActual = count($actualExploded)) > 4 && ! $this->isVerbose) { + $actualExploded = array_slice($actualExploded, 0, 3); + } + + if (($countExpected = count($expectedExploded)) > 4 && ! $this->isVerbose) { + $expectedExploded = array_slice($expectedExploded, 0, 3); + } + + $actualAsString = ''; + $expectedAsString = ''; + foreach ($actualExploded as $line) { + $actualAsString .= PHP_EOL.$this->colorizeLine($line, 'red'); + } + + foreach ($expectedExploded as $line) { + $expectedAsString .= PHP_EOL.$this->colorizeLine($line, 'green'); + } + + if ($countActual > 4 && ! $this->isVerbose) { + $actualAsString .= PHP_EOL.$this->colorizeLine(sprintf('... (%s more lines)', $countActual - 3), 'gray'); + } + + if ($countExpected > 4 && ! $this->isVerbose) { + $expectedAsString .= PHP_EOL.$this->colorizeLine(sprintf('... (%s more lines)', $countExpected - 3), 'gray'); + } + + return implode(PHP_EOL, [ + 'Expected: '.ltrim($actualAsString, PHP_EOL.' '), + '', + ' '.$key.': '.ltrim($expectedAsString, PHP_EOL.' '), + '', + ]); + } + + public function getCode(): int + { + return 0; + } + + /** + * @throws \ReflectionException + */ + public function getFile(): string + { + if (! isset($this->getTrace()[0])) { + return (string) (new ReflectionClass($this->getClassName()))->getFileName(); + } + + return $this->getTrace()[0]['file']; + } + + public function getLine(): int + { + if (! isset($this->getTrace()[0])) { + return 0; + } + + return (int) $this->getTrace()[0]['line']; + } + + public function getTrace(): array + { + $frames = explode("\n", $this->getTraceAsString()); + + $frames = array_filter($frames, fn ($trace) => $trace !== ''); + + return array_map(function ($trace) { + if (trim($trace) === '') { + return null; + } + + $parts = explode(':', $trace); + $line = array_pop($parts); + $file = implode(':', $parts); + + return [ + 'file' => $file, + 'line' => $line, + ]; + }, $frames); + } + + public function getTraceAsString(): string + { + return $this->throwable->stackTrace(); + } + + public function getPrevious(): ?self + { + if ($this->throwable->hasPrevious()) { + return new self($this->throwable->previous(), $this->isVerbose); + } + + return null; + } + + public function __toString() + { + return $this->getMessage(); + } + + private function colorizeLine(string $line, string $color): string + { + return sprintf(' <fg=%s>%s</>', $color, $line); + } +} diff --git a/vendor/nunomaduro/collision/src/Exceptions/TestOutcome.php b/vendor/nunomaduro/collision/src/Exceptions/TestOutcome.php new file mode 100644 index 00000000..01efcdc0 --- /dev/null +++ b/vendor/nunomaduro/collision/src/Exceptions/TestOutcome.php @@ -0,0 +1,15 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision\Exceptions; + +use PHPUnit\Framework\Exception; + +/** + * @internal + */ +final class TestOutcome extends Exception +{ + // ... +} diff --git a/vendor/nunomaduro/collision/src/Handler.php b/vendor/nunomaduro/collision/src/Handler.php new file mode 100644 index 00000000..705645d8 --- /dev/null +++ b/vendor/nunomaduro/collision/src/Handler.php @@ -0,0 +1,57 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision; + +use Symfony\Component\Console\Output\OutputInterface; +use Whoops\Handler\Handler as AbstractHandler; + +/** + * @internal + * + * @see \Tests\Unit\HandlerTest + */ +final class Handler extends AbstractHandler +{ + /** + * Holds an instance of the writer. + */ + private Writer $writer; + + /** + * Creates an instance of the Handler. + */ + public function __construct(Writer $writer = null) + { + $this->writer = $writer ?: new Writer(); + } + + /** + * {@inheritdoc} + */ + public function handle(): int + { + $this->writer->write($this->getInspector()); // @phpstan-ignore-line + + return self::QUIT; + } + + /** + * {@inheritdoc} + */ + public function setOutput(OutputInterface $output): self + { + $this->writer->setOutput($output); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getWriter(): Writer + { + return $this->writer; + } +} diff --git a/vendor/nunomaduro/collision/src/Highlighter.php b/vendor/nunomaduro/collision/src/Highlighter.php new file mode 100644 index 00000000..e6625753 --- /dev/null +++ b/vendor/nunomaduro/collision/src/Highlighter.php @@ -0,0 +1,289 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision; + +/** + * @internal + */ +final class Highlighter +{ + public const TOKEN_DEFAULT = 'token_default'; + + public const TOKEN_COMMENT = 'token_comment'; + + public const TOKEN_STRING = 'token_string'; + + public const TOKEN_HTML = 'token_html'; + + public const TOKEN_KEYWORD = 'token_keyword'; + + public const ACTUAL_LINE_MARK = 'actual_line_mark'; + + public const LINE_NUMBER = 'line_number'; + + private const ARROW_SYMBOL = '>'; + + private const DELIMITER = '|'; + + private const ARROW_SYMBOL_UTF8 = '➜'; + + private const DELIMITER_UTF8 = '▕'; // '▶'; + + private const LINE_NUMBER_DIVIDER = 'line_divider'; + + private const MARKED_LINE_NUMBER = 'marked_line'; + + private const WIDTH = 3; + + /** + * Holds the theme. + */ + private const THEME = [ + self::TOKEN_STRING => ['light_gray'], + self::TOKEN_COMMENT => ['dark_gray', 'italic'], + self::TOKEN_KEYWORD => ['magenta', 'bold'], + self::TOKEN_DEFAULT => ['default', 'bold'], + self::TOKEN_HTML => ['blue', 'bold'], + + self::ACTUAL_LINE_MARK => ['red', 'bold'], + self::LINE_NUMBER => ['dark_gray'], + self::MARKED_LINE_NUMBER => ['italic', 'bold'], + self::LINE_NUMBER_DIVIDER => ['dark_gray'], + ]; + + private ConsoleColor $color; + + private const DEFAULT_THEME = [ + self::TOKEN_STRING => 'red', + self::TOKEN_COMMENT => 'yellow', + self::TOKEN_KEYWORD => 'green', + self::TOKEN_DEFAULT => 'default', + self::TOKEN_HTML => 'cyan', + + self::ACTUAL_LINE_MARK => 'dark_gray', + self::LINE_NUMBER => 'dark_gray', + self::MARKED_LINE_NUMBER => 'dark_gray', + self::LINE_NUMBER_DIVIDER => 'dark_gray', + ]; + + private string $delimiter = self::DELIMITER_UTF8; + + private string $arrow = self::ARROW_SYMBOL_UTF8; + + private const NO_MARK = ' '; + + /** + * Creates an instance of the Highlighter. + */ + public function __construct(ConsoleColor $color = null, bool $UTF8 = true) + { + $this->color = $color ?: new ConsoleColor(); + + foreach (self::DEFAULT_THEME as $name => $styles) { + if (! $this->color->hasTheme($name)) { + $this->color->addTheme($name, $styles); + } + } + + foreach (self::THEME as $name => $styles) { + $this->color->addTheme($name, $styles); + } + if (! $UTF8) { + $this->delimiter = self::DELIMITER; + $this->arrow = self::ARROW_SYMBOL; + } + $this->delimiter .= ' '; + } + + /** + * Highlights the provided content. + */ + public function highlight(string $content, int $line): string + { + return rtrim($this->getCodeSnippet($content, $line, 4, 4)); + } + + /** + * Highlights the provided content. + */ + public function getCodeSnippet(string $source, int $lineNumber, int $linesBefore = 2, int $linesAfter = 2): string + { + $tokenLines = $this->getHighlightedLines($source); + + $offset = $lineNumber - $linesBefore - 1; + $offset = max($offset, 0); + $length = $linesAfter + $linesBefore + 1; + $tokenLines = array_slice($tokenLines, $offset, $length, $preserveKeys = true); + + $lines = $this->colorLines($tokenLines); + + return $this->lineNumbers($lines, $lineNumber); + } + + private function getHighlightedLines(string $source): array + { + $source = str_replace(["\r\n", "\r"], "\n", $source); + $tokens = $this->tokenize($source); + + return $this->splitToLines($tokens); + } + + private function tokenize(string $source): array + { + $tokens = token_get_all($source); + + $output = []; + $currentType = null; + $buffer = ''; + $newType = null; + + foreach ($tokens as $token) { + if (is_array($token)) { + switch ($token[0]) { + case T_WHITESPACE: + break; + + case T_OPEN_TAG: + case T_OPEN_TAG_WITH_ECHO: + case T_CLOSE_TAG: + case T_STRING: + case T_VARIABLE: + // Constants + case T_DIR: + case T_FILE: + case T_METHOD_C: + case T_DNUMBER: + case T_LNUMBER: + case T_NS_C: + case T_LINE: + case T_CLASS_C: + case T_FUNC_C: + case T_TRAIT_C: + $newType = self::TOKEN_DEFAULT; + break; + + case T_COMMENT: + case T_DOC_COMMENT: + $newType = self::TOKEN_COMMENT; + break; + + case T_ENCAPSED_AND_WHITESPACE: + case T_CONSTANT_ENCAPSED_STRING: + $newType = self::TOKEN_STRING; + break; + + case T_INLINE_HTML: + $newType = self::TOKEN_HTML; + break; + + default: + $newType = self::TOKEN_KEYWORD; + } + } else { + $newType = $token === '"' ? self::TOKEN_STRING : self::TOKEN_KEYWORD; + } + + if ($currentType === null) { + $currentType = $newType; + } + + if ($currentType !== $newType) { + $output[] = [$currentType, $buffer]; + $buffer = ''; + $currentType = $newType; + } + + $buffer .= is_array($token) ? $token[1] : $token; + } + + if (isset($newType)) { + $output[] = [$newType, $buffer]; + } + + return $output; + } + + private function splitToLines(array $tokens): array + { + $lines = []; + + $line = []; + foreach ($tokens as $token) { + foreach (explode("\n", $token[1]) as $count => $tokenLine) { + if ($count > 0) { + $lines[] = $line; + $line = []; + } + + if ($tokenLine === '') { + continue; + } + + $line[] = [$token[0], $tokenLine]; + } + } + + $lines[] = $line; + + return $lines; + } + + private function colorLines(array $tokenLines): array + { + $lines = []; + foreach ($tokenLines as $lineCount => $tokenLine) { + $line = ''; + foreach ($tokenLine as $token) { + [$tokenType, $tokenValue] = $token; + if ($this->color->hasTheme($tokenType)) { + $line .= $this->color->apply($tokenType, $tokenValue); + } else { + $line .= $tokenValue; + } + } + $lines[$lineCount] = $line; + } + + return $lines; + } + + private function lineNumbers(array $lines, int $markLine = null): string + { + $lineStrlen = strlen((string) ((int) array_key_last($lines) + 1)); + $lineStrlen = $lineStrlen < self::WIDTH ? self::WIDTH : $lineStrlen; + $snippet = ''; + $mark = ' '.$this->arrow.' '; + foreach ($lines as $i => $line) { + $coloredLineNumber = $this->coloredLineNumber(self::LINE_NUMBER, $i, $lineStrlen); + + if ($markLine !== null) { + $snippet .= + ($markLine === $i + 1 + ? $this->color->apply(self::ACTUAL_LINE_MARK, $mark) + : self::NO_MARK + ); + + $coloredLineNumber = + ($markLine === $i + 1 ? + $this->coloredLineNumber(self::MARKED_LINE_NUMBER, $i, $lineStrlen) : + $coloredLineNumber + ); + } + $snippet .= $coloredLineNumber; + + $snippet .= + $this->color->apply(self::LINE_NUMBER_DIVIDER, $this->delimiter); + + $snippet .= $line.PHP_EOL; + } + + return $snippet; + } + + private function coloredLineNumber(string $style, int $i, int $length): string + { + return $this->color->apply($style, str_pad((string) ($i + 1), $length, ' ', STR_PAD_LEFT)); + } +} diff --git a/vendor/nunomaduro/collision/src/Provider.php b/vendor/nunomaduro/collision/src/Provider.php new file mode 100644 index 00000000..18b60f73 --- /dev/null +++ b/vendor/nunomaduro/collision/src/Provider.php @@ -0,0 +1,54 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision; + +use Whoops\Run; +use Whoops\RunInterface; + +/** + * @internal + * + * @see \Tests\Unit\ProviderTest + */ +final class Provider +{ + /** + * Holds an instance of the Run. + */ + private RunInterface $run; + + /** + * Holds an instance of the handler. + */ + private Handler $handler; + + /** + * Creates a new instance of the Provider. + */ + public function __construct(RunInterface $run = null, Handler $handler = null) + { + $this->run = $run ?: new Run(); + $this->handler = $handler ?: new Handler(); + } + + /** + * Registers the current Handler as Error Handler. + */ + public function register(): self + { + $this->run->pushHandler($this->handler) + ->register(); + + return $this; + } + + /** + * Returns the handler. + */ + public function getHandler(): Handler + { + return $this->handler; + } +} diff --git a/vendor/nunomaduro/collision/src/SolutionsRepositories/NullSolutionsRepository.php b/vendor/nunomaduro/collision/src/SolutionsRepositories/NullSolutionsRepository.php new file mode 100644 index 00000000..3360997f --- /dev/null +++ b/vendor/nunomaduro/collision/src/SolutionsRepositories/NullSolutionsRepository.php @@ -0,0 +1,22 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision\SolutionsRepositories; + +use NunoMaduro\Collision\Contracts\SolutionsRepository; +use Throwable; + +/** + * @internal + */ +final class NullSolutionsRepository implements SolutionsRepository +{ + /** + * {@inheritdoc} + */ + public function getFromThrowable(Throwable $throwable): array + { + return []; + } +} diff --git a/vendor/nunomaduro/collision/src/Writer.php b/vendor/nunomaduro/collision/src/Writer.php new file mode 100644 index 00000000..50752472 --- /dev/null +++ b/vendor/nunomaduro/collision/src/Writer.php @@ -0,0 +1,352 @@ +<?php + +declare(strict_types=1); + +namespace NunoMaduro\Collision; + +use Closure; +use NunoMaduro\Collision\Contracts\RenderableOnCollisionEditor; +use NunoMaduro\Collision\Contracts\RenderlessEditor; +use NunoMaduro\Collision\Contracts\RenderlessTrace; +use NunoMaduro\Collision\Contracts\SolutionsRepository; +use NunoMaduro\Collision\Exceptions\TestException; +use NunoMaduro\Collision\SolutionsRepositories\NullSolutionsRepository; +use Symfony\Component\Console\Output\ConsoleOutput; +use Symfony\Component\Console\Output\OutputInterface; +use Throwable; +use Whoops\Exception\Frame; +use Whoops\Exception\Inspector; + +/** + * @internal + * + * @see \Tests\Unit\WriterTest + */ +final class Writer +{ + /** + * The number of frames if no verbosity is specified. + */ + public const VERBOSITY_NORMAL_FRAMES = 1; + + /** + * Holds an instance of the solutions repository. + */ + private SolutionsRepository $solutionsRepository; + + /** + * Holds an instance of the Output. + */ + private OutputInterface $output; + + /** + * Holds an instance of the Argument Formatter. + */ + private ArgumentFormatter $argumentFormatter; + + /** + * Holds an instance of the Highlighter. + */ + private Highlighter $highlighter; + + /** + * Ignores traces where the file string matches one + * of the provided regex expressions. + * + * @var array<int, string|Closure> + */ + private array $ignore = []; + + /** + * Declares whether or not the trace should appear. + */ + private bool $showTrace = true; + + /** + * Declares whether or not the title should appear. + */ + private bool $showTitle = true; + + /** + * Declares whether the editor should appear. + */ + private bool $showEditor = true; + + /** + * Creates an instance of the writer. + */ + public function __construct( + SolutionsRepository $solutionsRepository = null, + OutputInterface $output = null, + ArgumentFormatter $argumentFormatter = null, + Highlighter $highlighter = null + ) { + $this->solutionsRepository = $solutionsRepository ?: new NullSolutionsRepository(); + $this->output = $output ?: new ConsoleOutput(); + $this->argumentFormatter = $argumentFormatter ?: new ArgumentFormatter(); + $this->highlighter = $highlighter ?: new Highlighter(); + } + + public function write(Inspector $inspector): void + { + $this->renderTitleAndDescription($inspector); + + $frames = $this->getFrames($inspector); + + $exception = $inspector->getException(); + + if ($exception instanceof RenderableOnCollisionEditor) { + $editorFrame = $exception->toCollisionEditor(); + } else { + $editorFrame = array_shift($frames); + } + + if ($this->showEditor + && $editorFrame !== null + && ! $exception instanceof RenderlessEditor + ) { + $this->renderEditor($editorFrame); + } + + $this->renderSolution($inspector); + + if ($this->showTrace && ! empty($frames) && ! $exception instanceof RenderlessTrace) { + $this->renderTrace($frames); + } elseif (! $exception instanceof RenderlessEditor) { + $this->output->writeln(''); + } + } + + public function ignoreFilesIn(array $ignore): self + { + $this->ignore = $ignore; + + return $this; + } + + public function showTrace(bool $show): self + { + $this->showTrace = $show; + + return $this; + } + + public function showTitle(bool $show): self + { + $this->showTitle = $show; + + return $this; + } + + public function showEditor(bool $show): self + { + $this->showEditor = $show; + + return $this; + } + + public function setOutput(OutputInterface $output): self + { + $this->output = $output; + + return $this; + } + + public function getOutput(): OutputInterface + { + return $this->output; + } + + /** + * Returns pertinent frames. + * + * @return array<int, Frame> + */ + private function getFrames(Inspector $inspector): array + { + return $inspector->getFrames() + ->filter( + function ($frame) { + // If we are in verbose mode, we always + // display the full stack trace. + if ($this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { + return true; + } + + foreach ($this->ignore as $ignore) { + if (is_string($ignore)) { + // Ensure paths are linux-style (like the ones on $this->ignore) + $sanitizedPath = (string) str_replace('\\', '/', $frame->getFile()); + if (preg_match($ignore, $sanitizedPath)) { + return false; + } + } + + if ($ignore instanceof Closure) { + if ($ignore($frame)) { + return false; + } + } + } + + return true; + } + ) + ->getArray(); + } + + /** + * Renders the title of the exception. + */ + private function renderTitleAndDescription(Inspector $inspector): self + { + /** @var Throwable|TestException $exception */ + $exception = $inspector->getException(); + $message = rtrim($exception->getMessage()); + $class = $exception instanceof TestException + ? $exception->getClassName() + : $inspector->getExceptionName(); + + if ($this->showTitle) { + $this->render("<bg=red;options=bold> $class </>"); + $this->output->writeln(''); + } + + $this->output->writeln("<fg=default;options=bold> $message</>"); + + return $this; + } + + /** + * Renders the solution of the exception, if any. + */ + private function renderSolution(Inspector $inspector): self + { + $throwable = $inspector->getException(); + + $solutions = $throwable instanceof Throwable + ? $this->solutionsRepository->getFromThrowable($throwable) + : []; // @phpstan-ignore-line + + foreach ($solutions as $solution) { + /** @var \Spatie\Ignition\Contracts\Solution $solution */ + $title = $solution->getSolutionTitle(); + $description = $solution->getSolutionDescription(); + $links = $solution->getDocumentationLinks(); + + $description = trim((string) preg_replace("/\n/", "\n ", $description)); + + $this->render(sprintf( + '<fg=cyan;options=bold>i</> <fg=default;options=bold>%s</>: %s %s', + rtrim($title, '.'), + $description, + implode(', ', array_map(function (string $link) { + return sprintf("\n <fg=gray>%s</>", $link); + }, $links)) + )); + } + + return $this; + } + + /** + * Renders the editor containing the code that was the + * origin of the exception. + */ + private function renderEditor(Frame $frame): self + { + if ($frame->getFile() !== 'Unknown') { + $file = $this->getFileRelativePath((string) $frame->getFile()); + + // getLine() might return null so cast to int to get 0 instead + $line = (int) $frame->getLine(); + $this->render('at <fg=green>'.$file.'</>'.':<fg=green>'.$line.'</>'); + + $content = $this->highlighter->highlight((string) $frame->getFileContents(), (int) $frame->getLine()); + + $this->output->writeln($content); + } + + return $this; + } + + /** + * Renders the trace of the exception. + */ + private function renderTrace(array $frames): self + { + $vendorFrames = 0; + $userFrames = 0; + + if (! empty($frames)) { + $this->output->writeln(['']); + } + + foreach ($frames as $i => $frame) { + if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERBOSE && strpos($frame->getFile(), '/vendor/') !== false) { + $vendorFrames++; + + continue; + } + + if ($userFrames > self::VERBOSITY_NORMAL_FRAMES && $this->output->getVerbosity() < OutputInterface::VERBOSITY_VERBOSE) { + break; + } + + $userFrames++; + + $file = $this->getFileRelativePath($frame->getFile()); + $line = $frame->getLine(); + $class = empty($frame->getClass()) ? '' : $frame->getClass().'::'; + $function = $frame->getFunction(); + $args = $this->argumentFormatter->format($frame->getArgs()); + $pos = str_pad((string) ((int) $i + 1), 4, ' '); + + if ($vendorFrames > 0) { + $this->output->writeln( + sprintf(" \e[2m+%s vendor frames \e[22m", $vendorFrames) + ); + $vendorFrames = 0; + } + + $this->render("<fg=yellow>$pos</><fg=default;options=bold>$file</>:<fg=default;options=bold>$line</>", (bool) $class && $i > 0); + if ($class) { + $this->render("<fg=gray> $class$function($args)</>", false); + } + } + + if (! empty($frames)) { + $this->output->writeln(['']); + } + + return $this; + } + + /** + * Renders a message into the console. + */ + private function render(string $message, bool $break = true): self + { + if ($break) { + $this->output->writeln(''); + } + + $this->output->writeln(" $message"); + + return $this; + } + + /** + * Returns the relative path of the given file path. + */ + private function getFileRelativePath(string $filePath): string + { + $cwd = (string) getcwd(); + + if (! empty($cwd)) { + return str_replace("$cwd".DIRECTORY_SEPARATOR, '', $filePath); + } + + return $filePath; + } +} diff --git a/vendor/nunomaduro/termwind/LICENSE.md b/vendor/nunomaduro/termwind/LICENSE.md new file mode 100755 index 00000000..14b90ed4 --- /dev/null +++ b/vendor/nunomaduro/termwind/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Nuno Maduro <enunomaduro@gmail.com> + +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/vendor/nunomaduro/termwind/composer.json b/vendor/nunomaduro/termwind/composer.json new file mode 100644 index 00000000..6c4f59b6 --- /dev/null +++ b/vendor/nunomaduro/termwind/composer.json @@ -0,0 +1,69 @@ +{ + "name": "nunomaduro/termwind", + "description": "Its like Tailwind CSS, but for the console.", + "keywords": ["php", "cli", "package", "console", "css", "style"], + "license": "MIT", + "authors": [ + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "require": { + "php": "^8.0", + "ext-mbstring": "*", + "symfony/console": "^5.3.0|^6.0.0" + }, + "require-dev": { + "ergebnis/phpstan-rules": "^1.0.", + "illuminate/console": "^8.0|^9.0", + "illuminate/support": "^8.0|^9.0", + "laravel/pint": "^1.0.0", + "pestphp/pest": "^1.21.0", + "pestphp/pest-plugin-mock": "^1.0", + "phpstan/phpstan": "^1.4.6", + "phpstan/phpstan-strict-rules": "^1.1.0", + "symfony/var-dumper": "^5.2.7|^6.0.0", + "thecodingmachine/phpstan-strict-rules": "^1.0.0" + }, + "autoload": { + "psr-4": { + "Termwind\\": "src/" + }, + "files": [ + "src/Functions.php" + ] + }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests/" + } + }, + "minimum-stability": "dev", + "prefer-stable": true, + "config": { + "sort-packages": true, + "preferred-install": "dist", + "allow-plugins": { + "pestphp/pest-plugin": true + } + }, + "scripts": { + "lint": "pint -v", + "test:lint": "pint --test -v", + "test:types": "phpstan analyse --ansi", + "test:unit": "pest --colors=always", + "test": [ + "@test:lint", + "@test:types", + "@test:unit" + ] + }, + "extra": { + "laravel": { + "providers": [ + "Termwind\\Laravel\\TermwindServiceProvider" + ] + } + } +} diff --git a/vendor/nunomaduro/termwind/docker-compose.yml b/vendor/nunomaduro/termwind/docker-compose.yml new file mode 100644 index 00000000..693b0081 --- /dev/null +++ b/vendor/nunomaduro/termwind/docker-compose.yml @@ -0,0 +1,13 @@ +version: '3' + +services: + app: + image: termwind-docker + container_name: termwind-docker + stdin_open: true + tty: true + build: + context: . + dockerfile: docker/Dockerfile + volumes: + - .:/usr/src/app diff --git a/vendor/nunomaduro/termwind/playground.php b/vendor/nunomaduro/termwind/playground.php new file mode 100644 index 00000000..9e6b8100 --- /dev/null +++ b/vendor/nunomaduro/termwind/playground.php @@ -0,0 +1,14 @@ +<?php + +require_once __DIR__.'/vendor/autoload.php'; + +use function Termwind\render; + +render(<<<'HTML' + <div class="mx-2 my-1"> + <div class="flex space-x-1"> + <span class="flex-1 truncate">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sunt illo et nisi omnis porro at, mollitia harum quas esse, aperiam dolorem ab recusandae fugiat nesciunt doloribus rem eaque nostrum itaque.</span> + <span class="text-green">DONE</span> + </div> + </div> +HTML); diff --git a/vendor/nunomaduro/termwind/src/Actions/StyleToMethod.php b/vendor/nunomaduro/termwind/src/Actions/StyleToMethod.php new file mode 100644 index 00000000..6debb8fd --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Actions/StyleToMethod.php @@ -0,0 +1,154 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Actions; + +use Termwind\Exceptions\StyleNotFound; +use Termwind\Repositories\Styles as StyleRepository; +use Termwind\Terminal; +use Termwind\ValueObjects\Styles; + +/** + * @internal + */ +final class StyleToMethod +{ + /** + * Finds if there is any media query on the style class. + */ + private const MEDIA_QUERIES_REGEX = "/^(sm|md|lg|xl|2xl)\:(.*)/"; + + /** + * Defines the Media Query Breakpoints. + */ + public const MEDIA_QUERY_BREAKPOINTS = [ + 'sm' => 64, + 'md' => 76, + 'lg' => 102, + 'xl' => 128, + '2xl' => 153, + ]; + + /** + * Creates a new action instance. + */ + public function __construct( + private Styles $styles, + private string $style, + ) { + // .. + } + + /** + * Applies multiple styles to the given styles. + */ + public static function multiple(Styles $styles, string $stylesString): Styles + { + $stylesString = self::sortStyles(array_merge( + $styles->defaultStyles(), + array_filter((array) preg_split('/(?![^\[]*\])\s/', $stylesString)) + )); + + foreach ($stylesString as $style) { + $styles = (new self($styles, $style))->__invoke(); + } + + return $styles; + } + + /** + * Converts the given style to a method name. + * + * @return Styles + */ + public function __invoke(string|int ...$arguments): Styles + { + if (StyleRepository::has($this->style)) { + return StyleRepository::get($this->style)($this->styles, ...$arguments); + } + + $method = $this->applyMediaQuery($this->style); + + if ($method === '') { + return $this->styles; + } + + $method = array_filter( + (array) preg_split('/(?![^\[]*\])-/', $method), + fn ($item) => $item !== false + ); + + $method = array_slice($method, 0, count($method) - count($arguments)); + + $methodName = implode(' ', $method); + $methodName = ucwords($methodName); + $methodName = lcfirst($methodName); + $methodName = str_replace(' ', '', $methodName); + + if ($methodName === '') { + throw StyleNotFound::fromStyle($this->style); + } + + if (! method_exists($this->styles, $methodName)) { + $argument = array_pop($method); + + $arguments[] = is_numeric($argument) ? (int) $argument : (string) $argument; + + return $this->__invoke(...$arguments); + } + + return $this->styles + ->setStyle($this->style) + ->$methodName(...array_reverse($arguments)); + } + + /** + * Sorts all the styles based on the correct render order. + * + * @param string[] $styles + * @return string[] + */ + private static function sortStyles(array $styles): array + { + $keys = array_keys(self::MEDIA_QUERY_BREAKPOINTS); + + usort($styles, function ($a, $b) use ($keys) { + $existsA = (bool) preg_match(self::MEDIA_QUERIES_REGEX, $a, $matchesA); + $existsB = (bool) preg_match(self::MEDIA_QUERIES_REGEX, $b, $matchesB); + + if ($existsA && ! $existsB) { + return 1; + } + + if ($existsA && array_search($matchesA[1], $keys, true) > array_search($matchesB[1], $keys, true)) { + return 1; + } + + return -1; + }); + + return $styles; + } + + /** + * Applies the media query if exists. + */ + private function applyMediaQuery(string $method): string + { + $matches = []; + preg_match(self::MEDIA_QUERIES_REGEX, $method, $matches); + + if (count($matches) < 1) { + return $method; + } + + [, $size, $method] = $matches; + + if ((new Terminal)->width() >= self::MEDIA_QUERY_BREAKPOINTS[$size]) { + return $method; + } + + return ''; + } +} diff --git a/vendor/nunomaduro/termwind/src/Components/Anchor.php b/vendor/nunomaduro/termwind/src/Components/Anchor.php new file mode 100644 index 00000000..aa29fa20 --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Components/Anchor.php @@ -0,0 +1,9 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Components; + +final class Anchor extends Element +{ +} diff --git a/vendor/nunomaduro/termwind/src/Components/BreakLine.php b/vendor/nunomaduro/termwind/src/Components/BreakLine.php new file mode 100644 index 00000000..a979a715 --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Components/BreakLine.php @@ -0,0 +1,26 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Components; + +final class BreakLine extends Element +{ + /** + * Get the string representation of the element. + */ + public function toString(): string + { + $display = $this->styles->getProperties()['styles']['display'] ?? 'inline'; + + if ($display === 'hidden') { + return ''; + } + + if ($display === 'block') { + return parent::toString(); + } + + return parent::toString()."\r"; + } +} diff --git a/vendor/nunomaduro/termwind/src/Components/Dd.php b/vendor/nunomaduro/termwind/src/Components/Dd.php new file mode 100644 index 00000000..9f6cafed --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Components/Dd.php @@ -0,0 +1,10 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Components; + +final class Dd extends Element +{ + protected static array $defaultStyles = ['block', 'ml-4']; +} diff --git a/vendor/nunomaduro/termwind/src/Components/Div.php b/vendor/nunomaduro/termwind/src/Components/Div.php new file mode 100644 index 00000000..657d0ce0 --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Components/Div.php @@ -0,0 +1,10 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Components; + +final class Div extends Element +{ + protected static array $defaultStyles = ['block']; +} diff --git a/vendor/nunomaduro/termwind/src/Components/Dl.php b/vendor/nunomaduro/termwind/src/Components/Dl.php new file mode 100644 index 00000000..6594edab --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Components/Dl.php @@ -0,0 +1,10 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Components; + +final class Dl extends Element +{ + protected static array $defaultStyles = ['block']; +} diff --git a/vendor/nunomaduro/termwind/src/Components/Dt.php b/vendor/nunomaduro/termwind/src/Components/Dt.php new file mode 100644 index 00000000..42b29dac --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Components/Dt.php @@ -0,0 +1,10 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Components; + +final class Dt extends Element +{ + protected static array $defaultStyles = ['block', 'font-bold']; +} diff --git a/vendor/nunomaduro/termwind/src/Components/Element.php b/vendor/nunomaduro/termwind/src/Components/Element.php new file mode 100644 index 00000000..9ec8fbfc --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Components/Element.php @@ -0,0 +1,121 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Components; + +use Symfony\Component\Console\Output\OutputInterface; +use Termwind\Actions\StyleToMethod; +use Termwind\Html\InheritStyles; +use Termwind\ValueObjects\Styles; + +/** + * @internal + * + * @method Element inheritFromStyles(Styles $styles) + * @method Element fontBold() + * @method Element strong() + * @method Element italic() + * @method Element underline() + * @method Element lineThrough() + * @method int getLength() + * @method int getInnerWidth() + * @method array getProperties() + * @method Element href(string $href) + * @method bool hasStyle(string $style) + * @method Element addStyle(string $style) + */ +abstract class Element +{ + /** @var string[] */ + protected static array $defaultStyles = []; + + protected Styles $styles; + + /** + * Creates an element instance. + * + * @param array<int, Element|string>|string $content + */ + final public function __construct( + protected OutputInterface $output, + protected array|string $content, + Styles|null $styles = null + ) { + $this->styles = $styles ?? new Styles(defaultStyles: static::$defaultStyles); + $this->styles->setElement($this); + } + + /** + * Creates an element instance with the given styles. + * + * @param array<int, Element|string>|string $content + * @param array<string, mixed> $properties + */ + final public static function fromStyles(OutputInterface $output, array|string $content, string $styles = '', array $properties = []): static + { + $element = new static($output, $content); + if ($properties !== []) { + $element->styles->setProperties($properties); + } + + $elementStyles = StyleToMethod::multiple($element->styles, $styles); + + return new static($output, $content, $elementStyles); + } + + /** + * Get the string representation of the element. + */ + public function toString(): string + { + if (is_array($this->content)) { + $inheritance = new InheritStyles(); + $this->content = implode('', $inheritance($this->content, $this->styles)); + } + + return $this->styles->format($this->content); + } + + /** + * @param array<int, mixed> $arguments + */ + public function __call(string $name, array $arguments): mixed + { + if (method_exists($this->styles, $name)) { + $result = $this->styles->{$name}(...$arguments); + + if (str_starts_with($name, 'get') || str_starts_with($name, 'has')) { + return $result; + } + } + + return $this; + } + + /** + * Sets the content of the element. + * + * @param array<int, Element|string>|string $content + */ + final public function setContent(array|string $content): static + { + return new static($this->output, $content, $this->styles); + } + + /** + * Renders the string representation of the element on the output. + */ + final public function render(int $options): void + { + $this->output->writeln($this->toString(), $options); + } + + /** + * Get the string representation of the element. + */ + final public function __toString(): string + { + return $this->toString(); + } +} diff --git a/vendor/nunomaduro/termwind/src/Components/Hr.php b/vendor/nunomaduro/termwind/src/Components/Hr.php new file mode 100644 index 00000000..e7fcc0f1 --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Components/Hr.php @@ -0,0 +1,10 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Components; + +final class Hr extends Element +{ + protected static array $defaultStyles = ['block', 'border-t']; +} diff --git a/vendor/nunomaduro/termwind/src/Components/Li.php b/vendor/nunomaduro/termwind/src/Components/Li.php new file mode 100644 index 00000000..40b4a15a --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Components/Li.php @@ -0,0 +1,10 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Components; + +final class Li extends Element +{ + protected static array $defaultStyles = ['block']; +} diff --git a/vendor/nunomaduro/termwind/src/Components/Ol.php b/vendor/nunomaduro/termwind/src/Components/Ol.php new file mode 100644 index 00000000..37774e91 --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Components/Ol.php @@ -0,0 +1,10 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Components; + +final class Ol extends Element +{ + protected static array $defaultStyles = ['block', 'list-decimal']; +} diff --git a/vendor/nunomaduro/termwind/src/Components/Paragraph.php b/vendor/nunomaduro/termwind/src/Components/Paragraph.php new file mode 100644 index 00000000..5c39dbe2 --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Components/Paragraph.php @@ -0,0 +1,10 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Components; + +final class Paragraph extends Element +{ + protected static array $defaultStyles = ['block', 'my-1']; +} diff --git a/vendor/nunomaduro/termwind/src/Components/Raw.php b/vendor/nunomaduro/termwind/src/Components/Raw.php new file mode 100644 index 00000000..a69467f2 --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Components/Raw.php @@ -0,0 +1,19 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Components; + +/** + * @internal + */ +final class Raw extends Element +{ + /** + * Get the string representation of the element. + */ + public function toString(): string + { + return is_array($this->content) ? implode('', $this->content) : $this->content; + } +} diff --git a/vendor/nunomaduro/termwind/src/Components/Span.php b/vendor/nunomaduro/termwind/src/Components/Span.php new file mode 100644 index 00000000..9f50a636 --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Components/Span.php @@ -0,0 +1,10 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Components; + +final class Span extends Element +{ + // .. +} diff --git a/vendor/nunomaduro/termwind/src/Components/Ul.php b/vendor/nunomaduro/termwind/src/Components/Ul.php new file mode 100644 index 00000000..c2261105 --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Components/Ul.php @@ -0,0 +1,10 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Components; + +final class Ul extends Element +{ + protected static array $defaultStyles = ['block', 'list-disc']; +} diff --git a/vendor/nunomaduro/termwind/src/Enums/Color.php b/vendor/nunomaduro/termwind/src/Enums/Color.php new file mode 100644 index 00000000..ea920150 --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Enums/Color.php @@ -0,0 +1,482 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Enums; + +final class Color +{ + public const BLACK = 'black'; + + public const WHITE = 'white'; + + public const BRIGHTWHITE = 'bright-white'; + + public const SLATE_50 = '#f8fafc'; + + public const SLATE_100 = '#f1f5f9'; + + public const SLATE_200 = '#e2e8f0'; + + public const SLATE_300 = '#cbd5e1'; + + public const SLATE_400 = '#94a3b8'; + + public const SLATE_500 = '#64748b'; + + public const SLATE_600 = '#475569'; + + public const SLATE_700 = '#334155'; + + public const SLATE_800 = '#1e293b'; + + public const SLATE_900 = '#0f172a'; + + public const GRAY = 'gray'; + + public const GRAY_50 = '#f9fafb'; + + public const GRAY_100 = '#f3f4f6'; + + public const GRAY_200 = '#e5e7eb'; + + public const GRAY_300 = '#d1d5db'; + + public const GRAY_400 = '#9ca3af'; + + public const GRAY_500 = '#6b7280'; + + public const GRAY_600 = '#4b5563'; + + public const GRAY_700 = '#374151'; + + public const GRAY_800 = '#1f2937'; + + public const GRAY_900 = '#111827'; + + public const ZINC_50 = '#fafafa'; + + public const ZINC_100 = '#f4f4f5'; + + public const ZINC_200 = '#e4e4e7'; + + public const ZINC_300 = '#d4d4d8'; + + public const ZINC_400 = '#a1a1aa'; + + public const ZINC_500 = '#71717a'; + + public const ZINC_600 = '#52525b'; + + public const ZINC_700 = '#3f3f46'; + + public const ZINC_800 = '#27272a'; + + public const ZINC_900 = '#18181b'; + + public const NEUTRAL_50 = '#fafafa'; + + public const NEUTRAL_100 = '#f5f5f5'; + + public const NEUTRAL_200 = '#e5e5e5'; + + public const NEUTRAL_300 = '#d4d4d4'; + + public const NEUTRAL_400 = '#a3a3a3'; + + public const NEUTRAL_500 = '#737373'; + + public const NEUTRAL_600 = '#525252'; + + public const NEUTRAL_700 = '#404040'; + + public const NEUTRAL_800 = '#262626'; + + public const NEUTRAL_900 = '#171717'; + + public const STONE_50 = '#fafaf9'; + + public const STONE_100 = '#f5f5f4'; + + public const STONE_200 = '#e7e5e4'; + + public const STONE_300 = '#d6d3d1'; + + public const STONE_400 = '#a8a29e'; + + public const STONE_500 = '#78716c'; + + public const STONE_600 = '#57534e'; + + public const STONE_700 = '#44403c'; + + public const STONE_800 = '#292524'; + + public const STONE_900 = '#1c1917'; + + public const RED = 'red'; + + public const BRIGHTRED = 'bright-red'; + + public const RED_50 = '#fef2f2'; + + public const RED_100 = '#fee2e2'; + + public const RED_200 = '#fecaca'; + + public const RED_300 = '#fca5a5'; + + public const RED_400 = '#f87171'; + + public const RED_500 = '#ef4444'; + + public const RED_600 = '#dc2626'; + + public const RED_700 = '#b91c1c'; + + public const RED_800 = '#991b1b'; + + public const RED_900 = '#7f1d1d'; + + public const ORANGE = '#f97316'; + + public const ORANGE_50 = '#fff7ed'; + + public const ORANGE_100 = '#ffedd5'; + + public const ORANGE_200 = '#fed7aa'; + + public const ORANGE_300 = '#fdba74'; + + public const ORANGE_400 = '#fb923c'; + + public const ORANGE_500 = '#f97316'; + + public const ORANGE_600 = '#ea580c'; + + public const ORANGE_700 = '#c2410c'; + + public const ORANGE_800 = '#9a3412'; + + public const ORANGE_900 = '#7c2d12'; + + public const AMBER_50 = '#fffbeb'; + + public const AMBER_100 = '#fef3c7'; + + public const AMBER_200 = '#fde68a'; + + public const AMBER_300 = '#fcd34d'; + + public const AMBER_400 = '#fbbf24'; + + public const AMBER_500 = '#f59e0b'; + + public const AMBER_600 = '#d97706'; + + public const AMBER_700 = '#b45309'; + + public const AMBER_800 = '#92400e'; + + public const AMBER_900 = '#78350f'; + + public const YELLOW = 'yellow'; + + public const BRIGHTYELLOW = 'bright-yellow'; + + public const YELLOW_50 = '#fefce8'; + + public const YELLOW_100 = '#fef9c3'; + + public const YELLOW_200 = '#fef08a'; + + public const YELLOW_300 = '#fde047'; + + public const YELLOW_400 = '#facc15'; + + public const YELLOW_500 = '#eab308'; + + public const YELLOW_600 = '#ca8a04'; + + public const YELLOW_700 = '#a16207'; + + public const YELLOW_800 = '#854d0e'; + + public const YELLOW_900 = '#713f12'; + + public const LIME_50 = '#f7fee7'; + + public const LIME_100 = '#ecfccb'; + + public const LIME_200 = '#d9f99d'; + + public const LIME_300 = '#bef264'; + + public const LIME_400 = '#a3e635'; + + public const LIME_500 = '#84cc16'; + + public const LIME_600 = '#65a30d'; + + public const LIME_700 = '#4d7c0f'; + + public const LIME_800 = '#3f6212'; + + public const LIME_900 = '#365314'; + + public const GREEN = 'green'; + + public const BRIGHTGREEN = 'bright-green'; + + public const GREEN_50 = '#f0fdf4'; + + public const GREEN_100 = '#dcfce7'; + + public const GREEN_200 = '#bbf7d0'; + + public const GREEN_300 = '#86efac'; + + public const GREEN_400 = '#4ade80'; + + public const GREEN_500 = '#22c55e'; + + public const GREEN_600 = '#16a34a'; + + public const GREEN_700 = '#15803d'; + + public const GREEN_800 = '#166534'; + + public const GREEN_900 = '#14532d'; + + public const EMERALD_50 = '#ecfdf5'; + + public const EMERALD_100 = '#d1fae5'; + + public const EMERALD_200 = '#a7f3d0'; + + public const EMERALD_300 = '#6ee7b7'; + + public const EMERALD_400 = '#34d399'; + + public const EMERALD_500 = '#10b981'; + + public const EMERALD_600 = '#059669'; + + public const EMERALD_700 = '#047857'; + + public const EMERALD_800 = '#065f46'; + + public const EMERALD_900 = '#064e3b'; + + public const TEAL_50 = '#f0fdfa'; + + public const TEAL_100 = '#ccfbf1'; + + public const TEAL_200 = '#99f6e4'; + + public const TEAL_300 = '#5eead4'; + + public const TEAL_400 = '#2dd4bf'; + + public const TEAL_500 = '#14b8a6'; + + public const TEAL_600 = '#0d9488'; + + public const TEAL_700 = '#0f766e'; + + public const TEAL_800 = '#115e59'; + + public const TEAL_900 = '#134e4a'; + + public const CYAN = 'cyan'; + + public const BRIGHTCYAN = 'bright-cyan'; + + public const CYAN_50 = '#ecfeff'; + + public const CYAN_100 = '#cffafe'; + + public const CYAN_200 = '#a5f3fc'; + + public const CYAN_300 = '#67e8f9'; + + public const CYAN_400 = '#22d3ee'; + + public const CYAN_500 = '#06b6d4'; + + public const CYAN_600 = '#0891b2'; + + public const CYAN_700 = '#0e7490'; + + public const CYAN_800 = '#155e75'; + + public const CYAN_900 = '#164e63'; + + public const SKY_50 = '#f0f9ff'; + + public const SKY_100 = '#e0f2fe'; + + public const SKY_200 = '#bae6fd'; + + public const SKY_300 = '#7dd3fc'; + + public const SKY_400 = '#38bdf8'; + + public const SKY_500 = '#0ea5e9'; + + public const SKY_600 = '#0284c7'; + + public const SKY_700 = '#0369a1'; + + public const SKY_800 = '#075985'; + + public const SKY_900 = '#0c4a6e'; + + public const BLUE = 'blue'; + + public const BRIGHTBLUE = 'bright-blue'; + + public const BLUE_50 = '#eff6ff'; + + public const BLUE_100 = '#dbeafe'; + + public const BLUE_200 = '#bfdbfe'; + + public const BLUE_300 = '#93c5fd'; + + public const BLUE_400 = '#60a5fa'; + + public const BLUE_500 = '#3b82f6'; + + public const BLUE_600 = '#2563eb'; + + public const BLUE_700 = '#1d4ed8'; + + public const BLUE_800 = '#1e40af'; + + public const BLUE_900 = '#1e3a8a'; + + public const INDIGO_50 = '#eef2ff'; + + public const INDIGO_100 = '#e0e7ff'; + + public const INDIGO_200 = '#c7d2fe'; + + public const INDIGO_300 = '#a5b4fc'; + + public const INDIGO_400 = '#818cf8'; + + public const INDIGO_500 = '#6366f1'; + + public const INDIGO_600 = '#4f46e5'; + + public const INDIGO_700 = '#4338ca'; + + public const INDIGO_800 = '#3730a3'; + + public const INDIGO_900 = '#312e81'; + + public const VIOLET_50 = '#f5f3ff'; + + public const VIOLET_100 = '#ede9fe'; + + public const VIOLET_200 = '#ddd6fe'; + + public const VIOLET_300 = '#c4b5fd'; + + public const VIOLET_400 = '#a78bfa'; + + public const VIOLET_500 = '#8b5cf6'; + + public const VIOLET_600 = '#7c3aed'; + + public const VIOLET_700 = '#6d28d9'; + + public const VIOLET_800 = '#5b21b6'; + + public const VIOLET_900 = '#4c1d95'; + + public const PURPLE_50 = '#faf5ff'; + + public const PURPLE_100 = '#f3e8ff'; + + public const PURPLE_200 = '#e9d5ff'; + + public const PURPLE_300 = '#d8b4fe'; + + public const PURPLE_400 = '#c084fc'; + + public const PURPLE_500 = '#a855f7'; + + public const PURPLE_600 = '#9333ea'; + + public const PURPLE_700 = '#7e22ce'; + + public const PURPLE_800 = '#6b21a8'; + + public const PURPLE_900 = '#581c87'; + + public const FUCHSIA_50 = '#fdf4ff'; + + public const FUCHSIA_100 = '#fae8ff'; + + public const FUCHSIA_200 = '#f5d0fe'; + + public const FUCHSIA_300 = '#f0abfc'; + + public const FUCHSIA_400 = '#e879f9'; + + public const FUCHSIA_500 = '#d946ef'; + + public const FUCHSIA_600 = '#c026d3'; + + public const FUCHSIA_700 = '#a21caf'; + + public const FUCHSIA_800 = '#86198f'; + + public const FUCHSIA_900 = '#701a75'; + + public const PINK_50 = '#fdf2f8'; + + public const PINK_100 = '#fce7f3'; + + public const PINK_200 = '#fbcfe8'; + + public const PINK_300 = '#f9a8d4'; + + public const PINK_400 = '#f472b6'; + + public const PINK_500 = '#ec4899'; + + public const PINK_600 = '#db2777'; + + public const PINK_700 = '#be185d'; + + public const PINK_800 = '#9d174d'; + + public const PINK_900 = '#831843'; + + public const ROSE_50 = '#fff1f2'; + + public const ROSE_100 = '#ffe4e6'; + + public const ROSE_200 = '#fecdd3'; + + public const ROSE_300 = '#fda4af'; + + public const ROSE_400 = '#fb7185'; + + public const ROSE_500 = '#f43f5e'; + + public const ROSE_600 = '#e11d48'; + + public const ROSE_700 = '#be123c'; + + public const ROSE_800 = '#9f1239'; + + public const ROSE_900 = '#881337'; + + public const MAGENTA = 'magenta'; + + public const BRIGHTMAGENTA = 'bright-magenta'; +} diff --git a/vendor/nunomaduro/termwind/src/Exceptions/ColorNotFound.php b/vendor/nunomaduro/termwind/src/Exceptions/ColorNotFound.php new file mode 100644 index 00000000..0f753dd0 --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Exceptions/ColorNotFound.php @@ -0,0 +1,14 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Exceptions; + +use InvalidArgumentException; + +/** + * @internal + */ +final class ColorNotFound extends InvalidArgumentException +{ +} diff --git a/vendor/nunomaduro/termwind/src/Exceptions/InvalidChild.php b/vendor/nunomaduro/termwind/src/Exceptions/InvalidChild.php new file mode 100644 index 00000000..cb32e996 --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Exceptions/InvalidChild.php @@ -0,0 +1,14 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Exceptions; + +use InvalidArgumentException; + +/** + * @internal + */ +final class InvalidChild extends InvalidArgumentException +{ +} diff --git a/vendor/nunomaduro/termwind/src/Exceptions/InvalidColor.php b/vendor/nunomaduro/termwind/src/Exceptions/InvalidColor.php new file mode 100644 index 00000000..d45afa1f --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Exceptions/InvalidColor.php @@ -0,0 +1,14 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Exceptions; + +use InvalidArgumentException; + +/** + * @internal + */ +final class InvalidColor extends InvalidArgumentException +{ +} diff --git a/vendor/nunomaduro/termwind/src/Exceptions/InvalidStyle.php b/vendor/nunomaduro/termwind/src/Exceptions/InvalidStyle.php new file mode 100644 index 00000000..6bcc6dd7 --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Exceptions/InvalidStyle.php @@ -0,0 +1,14 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Exceptions; + +use InvalidArgumentException; + +/** + * @internal + */ +final class InvalidStyle extends InvalidArgumentException +{ +} diff --git a/vendor/nunomaduro/termwind/src/Exceptions/StyleNotFound.php b/vendor/nunomaduro/termwind/src/Exceptions/StyleNotFound.php new file mode 100644 index 00000000..e528ffdd --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Exceptions/StyleNotFound.php @@ -0,0 +1,29 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Exceptions; + +use InvalidArgumentException; + +/** + * @internal + */ +final class StyleNotFound extends InvalidArgumentException +{ + /** + * Creates a new style not found instance. + */ + private function __construct(string $message) + { + parent::__construct($message, 0, $this->getPrevious()); + } + + /** + * Creates a new style not found instance from the given style. + */ + public static function fromStyle(string $style): self + { + return new self(sprintf('Style [%s] not found.', $style)); + } +} diff --git a/vendor/nunomaduro/termwind/src/Functions.php b/vendor/nunomaduro/termwind/src/Functions.php new file mode 100644 index 00000000..7ce10393 --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Functions.php @@ -0,0 +1,65 @@ +<?php + +declare(strict_types=1); + +namespace Termwind; + +use Closure; +use Symfony\Component\Console\Output\OutputInterface; +use Termwind\Repositories\Styles as StyleRepository; +use Termwind\ValueObjects\Style; +use Termwind\ValueObjects\Styles; + +if (! function_exists('Termwind\renderUsing')) { + /** + * Sets the renderer implementation. + */ + function renderUsing(OutputInterface|null $renderer): void + { + Termwind::renderUsing($renderer); + } +} + +if (! function_exists('Termwind\style')) { + /** + * Creates a new style. + * + * @param (Closure(Styles $renderable, string|int ...$arguments): Styles)|null $callback + */ + function style(string $name, Closure $callback = null): Style + { + return StyleRepository::create($name, $callback); + } +} + +if (! function_exists('Termwind\render')) { + /** + * Render HTML to a string. + */ + function render(string $html, int $options = OutputInterface::OUTPUT_NORMAL): void + { + (new HtmlRenderer)->render($html, $options); + } +} + +if (! function_exists('Termwind\terminal')) { + /** + * Returns a Terminal instance. + */ + function terminal(): Terminal + { + return new Terminal; + } +} + +if (! function_exists('Termwind\ask')) { + /** + * Renders a prompt to the user. + * + * @param iterable<array-key, string>|null $autocomplete + */ + function ask(string $question, iterable $autocomplete = null): mixed + { + return (new Question)->ask($question, $autocomplete); + } +} diff --git a/vendor/nunomaduro/termwind/src/Helpers/QuestionHelper.php b/vendor/nunomaduro/termwind/src/Helpers/QuestionHelper.php new file mode 100644 index 00000000..e6bd7c5d --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Helpers/QuestionHelper.php @@ -0,0 +1,25 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Helpers; + +use Symfony\Component\Console\Formatter\OutputFormatter; +use Symfony\Component\Console\Helper\SymfonyQuestionHelper; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Question\Question; + +/** + * @internal + */ +final class QuestionHelper extends SymfonyQuestionHelper +{ + /** + * {@inheritdoc} + */ + protected function writePrompt(OutputInterface $output, Question $question): void + { + $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion()); + $output->write($text); + } +} diff --git a/vendor/nunomaduro/termwind/src/Html/CodeRenderer.php b/vendor/nunomaduro/termwind/src/Html/CodeRenderer.php new file mode 100644 index 00000000..6950cfdb --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Html/CodeRenderer.php @@ -0,0 +1,282 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Html; + +use Termwind\Components\Element; +use Termwind\Termwind; +use Termwind\ValueObjects\Node; + +/** + * @internal + */ +final class CodeRenderer +{ + public const TOKEN_DEFAULT = 'token_default'; + + public const TOKEN_COMMENT = 'token_comment'; + + public const TOKEN_STRING = 'token_string'; + + public const TOKEN_HTML = 'token_html'; + + public const TOKEN_KEYWORD = 'token_keyword'; + + public const ACTUAL_LINE_MARK = 'actual_line_mark'; + + public const LINE_NUMBER = 'line_number'; + + private const ARROW_SYMBOL_UTF8 = '➜'; + + private const DELIMITER_UTF8 = '▕ '; // '▶'; + + private const LINE_NUMBER_DIVIDER = 'line_divider'; + + private const MARKED_LINE_NUMBER = 'marked_line'; + + private const WIDTH = 3; + + /** + * Holds the theme. + * + * @var array<string, string> + */ + private const THEME = [ + self::TOKEN_STRING => 'text-gray', + self::TOKEN_COMMENT => 'text-gray italic', + self::TOKEN_KEYWORD => 'text-magenta strong', + self::TOKEN_DEFAULT => 'strong', + self::TOKEN_HTML => 'text-blue strong', + + self::ACTUAL_LINE_MARK => 'text-red strong', + self::LINE_NUMBER => 'text-gray', + self::MARKED_LINE_NUMBER => 'italic strong', + self::LINE_NUMBER_DIVIDER => 'text-gray', + ]; + + private string $delimiter = self::DELIMITER_UTF8; + + private string $arrow = self::ARROW_SYMBOL_UTF8; + + private const NO_MARK = ' '; + + /** + * Highlights HTML content from a given node and converts to the content element. + */ + public function toElement(Node $node): Element + { + $line = max((int) $node->getAttribute('line'), 0); + $startLine = max((int) $node->getAttribute('start-line'), 1); + + $html = $node->getHtml(); + $lines = explode("\n", $html); + $extraSpaces = $this->findExtraSpaces($lines); + + if ($extraSpaces !== '') { + $lines = array_map(static function (string $line) use ($extraSpaces): string { + return str_starts_with($line, $extraSpaces) ? substr($line, strlen($extraSpaces)) : $line; + }, $lines); + $html = implode("\n", $lines); + } + + $tokenLines = $this->getHighlightedLines(trim($html, "\n"), $startLine); + $lines = $this->colorLines($tokenLines); + $lines = $this->lineNumbers($lines, $line); + + return Termwind::div(trim($lines, "\n")); + } + + /** + * Finds extra spaces which should be removed from HTML. + * + * @param array<int, string> $lines + */ + private function findExtraSpaces(array $lines): string + { + foreach ($lines as $line) { + if ($line === '') { + continue; + } + + if (preg_replace('/\s+/', '', $line) === '') { + return $line; + } + } + + return ''; + } + + /** + * Returns content split into lines with numbers. + * + * @return array<int, array<int, array{0: string, 1: non-empty-string}>> + */ + private function getHighlightedLines(string $source, int $startLine): array + { + $source = str_replace(["\r\n", "\r"], "\n", $source); + $tokens = $this->tokenize($source); + + return $this->splitToLines($tokens, $startLine - 1); + } + + /** + * Splits content into tokens. + * + * @return array<int, array{0: string, 1: string}> + */ + private function tokenize(string $source): array + { + $tokens = token_get_all($source); + + $output = []; + $currentType = null; + $newType = self::TOKEN_KEYWORD; + $buffer = ''; + + foreach ($tokens as $token) { + if (is_array($token)) { + if ($token[0] !== T_WHITESPACE) { + $newType = match ($token[0]) { + T_OPEN_TAG, T_OPEN_TAG_WITH_ECHO, T_CLOSE_TAG, T_STRING, T_VARIABLE, + T_DIR, T_FILE, T_METHOD_C, T_DNUMBER, T_LNUMBER, T_NS_C, + T_LINE, T_CLASS_C, T_FUNC_C, T_TRAIT_C => self::TOKEN_DEFAULT, + T_COMMENT, T_DOC_COMMENT => self::TOKEN_COMMENT, + T_ENCAPSED_AND_WHITESPACE, T_CONSTANT_ENCAPSED_STRING => self::TOKEN_STRING, + T_INLINE_HTML => self::TOKEN_HTML, + default => self::TOKEN_KEYWORD + }; + } + } else { + $newType = $token === '"' ? self::TOKEN_STRING : self::TOKEN_KEYWORD; + } + + if ($currentType === null) { + $currentType = $newType; + } + + if ($currentType !== $newType) { + $output[] = [$currentType, $buffer]; + $buffer = ''; + $currentType = $newType; + } + + $buffer .= is_array($token) ? $token[1] : $token; + } + + $output[] = [$newType, $buffer]; + + return $output; + } + + /** + * Splits tokens into lines. + * + * @param array<int, array{0: string, 1: string}> $tokens + * @param int $startLine + * @return array<int, array<int, array{0: string, 1: non-empty-string}>> + */ + private function splitToLines(array $tokens, int $startLine): array + { + $lines = []; + + $line = []; + foreach ($tokens as $token) { + foreach (explode("\n", $token[1]) as $count => $tokenLine) { + if ($count > 0) { + $lines[$startLine++] = $line; + $line = []; + } + + if ($tokenLine === '') { + continue; + } + + $line[] = [$token[0], $tokenLine]; + } + } + + $lines[$startLine++] = $line; + + return $lines; + } + + /** + * Applies colors to tokens according to a color schema. + * + * @param array<int, array<int, array{0: string, 1: non-empty-string}>> $tokenLines + * @return array<int, string> + */ + private function colorLines(array $tokenLines): array + { + $lines = []; + + foreach ($tokenLines as $lineCount => $tokenLine) { + $line = ''; + foreach ($tokenLine as $token) { + [$tokenType, $tokenValue] = $token; + $line .= $this->styleToken($tokenType, $tokenValue); + } + + $lines[$lineCount] = $line; + } + + return $lines; + } + + /** + * Prepends line numbers into lines. + * + * @param array<int, string> $lines + * @param int $markLine + * @return string + */ + private function lineNumbers(array $lines, int $markLine): string + { + $lastLine = (int) array_key_last($lines); + $lineLength = strlen((string) ($lastLine + 1)); + $lineLength = $lineLength < self::WIDTH ? self::WIDTH : $lineLength; + + $snippet = ''; + $mark = ' '.$this->arrow.' '; + foreach ($lines as $i => $line) { + $coloredLineNumber = $this->coloredLineNumber(self::LINE_NUMBER, $i, $lineLength); + + if (0 !== $markLine) { + $snippet .= ($markLine === $i + 1 + ? $this->styleToken(self::ACTUAL_LINE_MARK, $mark) + : self::NO_MARK + ); + + $coloredLineNumber = ($markLine === $i + 1 ? + $this->coloredLineNumber(self::MARKED_LINE_NUMBER, $i, $lineLength) : + $coloredLineNumber + ); + } + + $snippet .= $coloredLineNumber; + $snippet .= $this->styleToken(self::LINE_NUMBER_DIVIDER, $this->delimiter); + $snippet .= $line.PHP_EOL; + } + + return $snippet; + } + + /** + * Formats line number and applies color according to a color schema. + */ + private function coloredLineNumber(string $token, int $lineNumber, int $length): string + { + return $this->styleToken( + $token, str_pad((string) ($lineNumber + 1), $length, ' ', STR_PAD_LEFT) + ); + } + + /** + * Formats string and applies color according to a color schema. + */ + private function styleToken(string $token, string $string): string + { + return (string) Termwind::span($string, self::THEME[$token]); + } +} diff --git a/vendor/nunomaduro/termwind/src/Html/InheritStyles.php b/vendor/nunomaduro/termwind/src/Html/InheritStyles.php new file mode 100644 index 00000000..953177ed --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Html/InheritStyles.php @@ -0,0 +1,218 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Html; + +use Termwind\Components\Element; +use Termwind\Termwind; +use Termwind\ValueObjects\Styles; + +/** + * @internal + */ +final class InheritStyles +{ + /** + * Applies styles from parent element to child elements. + * + * @param array<int, Element|string> $elements + * @return array<int, Element|string> + */ + public function __invoke(array $elements, Styles $styles): array + { + $elements = array_values($elements); + + foreach ($elements as &$element) { + if (is_string($element)) { + $element = Termwind::raw($element); + } + + $element->inheritFromStyles($styles); + } + + /** @var Element[] $elements */ + if (($styles->getProperties()['styles']['display'] ?? 'inline') === 'flex') { + $elements = $this->applyFlex($elements); + } + + return match ($styles->getProperties()['styles']['justifyContent'] ?? false) { + 'between' => $this->applyJustifyBetween($elements), + 'evenly' => $this->applyJustifyEvenly($elements), + 'around' => $this->applyJustifyAround($elements), + 'center' => $this->applyJustifyCenter($elements), + default => $elements, + }; + } + + /** + * Applies flex-1 to child elements with the class. + * + * @param array<int, Element> $elements + * @return array<int, Element> + */ + private function applyFlex(array $elements): array + { + [$totalWidth, $parentWidth] = $this->getWidthFromElements($elements); + + $width = max(0, array_reduce($elements, function ($carry, $element) { + return $carry += $element->hasStyle('flex-1') ? $element->getInnerWidth() : 0; + }, $parentWidth - $totalWidth)); + + $flexed = array_values(array_filter( + $elements, fn ($element) => $element->hasStyle('flex-1') + )); + + foreach ($flexed as $index => &$element) { + if ($width === 0 && ! ($element->getProperties()['styles']['contentRepeat'] ?? false)) { + continue; + } + + $float = $width / count($flexed); + $elementWidth = floor($float); + + if ($index === count($flexed) - 1) { + $elementWidth += ($float - floor($float)) * count($flexed); + } + + $element->addStyle("w-{$elementWidth}"); + } + + return $elements; + } + + /** + * Applies the space between the elements. + * + * @param array<int, Element> $elements + * @return array<int, Element|string> + */ + private function applyJustifyBetween(array $elements): array + { + if (count($elements) <= 1) { + return $elements; + } + + [$totalWidth, $parentWidth] = $this->getWidthFromElements($elements); + $space = ($parentWidth - $totalWidth) / (count($elements) - 1); + + if ($space < 1) { + return $elements; + } + + $arr = []; + + foreach ($elements as $index => &$element) { + if ($index !== 0) { + // Since there is no float pixel, on the last one it should round up... + $length = $index === count($elements) - 1 ? ceil($space) : floor($space); + $arr[] = str_repeat(' ', (int) $length); + } + + $arr[] = $element; + } + + return $arr; + } + + /** + * Applies the space between and around the elements. + * + * @param array<int, Element> $elements + * @return array<int, Element|string> + */ + private function applyJustifyEvenly(array $elements): array + { + [$totalWidth, $parentWidth] = $this->getWidthFromElements($elements); + $space = ($parentWidth - $totalWidth) / (count($elements) + 1); + + if ($space < 1) { + return $elements; + } + + $arr = []; + foreach ($elements as &$element) { + $arr[] = str_repeat(' ', (int) floor($space)); + $arr[] = $element; + } + + $decimals = ceil(($space - floor($space)) * (count($elements) + 1)); + $arr[] = str_repeat(' ', (int) (floor($space) + $decimals)); + + return $arr; + } + + /** + * Applies the space around the elements. + * + * @param array<int, Element> $elements + * @return array<int, Element|string> + */ + private function applyJustifyAround(array $elements): array + { + if (count($elements) === 0) { + return $elements; + } + + [$totalWidth, $parentWidth] = $this->getWidthFromElements($elements); + $space = ($parentWidth - $totalWidth) / count($elements); + + if ($space < 1) { + return $elements; + } + + $contentSize = $totalWidth; + $arr = []; + + foreach ($elements as $index => &$element) { + if ($index !== 0) { + $arr[] = str_repeat(' ', (int) ceil($space)); + $contentSize += ceil($space); + } + + $arr[] = $element; + } + + return [ + str_repeat(' ', (int) floor(($parentWidth - $contentSize) / 2)), + ...$arr, + str_repeat(' ', (int) ceil(($parentWidth - $contentSize) / 2)), + ]; + } + + /** + * Applies the space on before first element and after last element. + * + * @param array<int, Element> $elements + * @return array<int, Element|string> + */ + private function applyJustifyCenter(array $elements): array + { + [$totalWidth, $parentWidth] = $this->getWidthFromElements($elements); + $space = $parentWidth - $totalWidth; + + if ($space < 1) { + return $elements; + } + + return [ + str_repeat(' ', (int) floor($space / 2)), + ...$elements, + str_repeat(' ', (int) ceil($space / 2)), + ]; + } + + /** + * Gets the total width for the elements and their parent width. + * + * @param array<int, Element> $elements + * @return int[] + */ + private function getWidthFromElements(array $elements) + { + $totalWidth = (int) array_reduce($elements, fn ($carry, $element) => $carry += $element->getLength(), 0); + $parentWidth = Styles::getParentWidth($elements[0]->getProperties()['parentStyles'] ?? []); + + return [$totalWidth, $parentWidth]; + } +} diff --git a/vendor/nunomaduro/termwind/src/Html/PreRenderer.php b/vendor/nunomaduro/termwind/src/Html/PreRenderer.php new file mode 100644 index 00000000..e97048cb --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Html/PreRenderer.php @@ -0,0 +1,46 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Html; + +use Termwind\Components\Element; +use Termwind\Termwind; +use Termwind\ValueObjects\Node; + +/** + * @internal + */ +final class PreRenderer +{ + /** + * Gets HTML content from a given node and converts to the content element. + */ + public function toElement(Node $node): Element + { + $lines = explode("\n", $node->getHtml()); + if (reset($lines) === '') { + array_shift($lines); + } + + if (end($lines) === '') { + array_pop($lines); + } + + $maxStrLen = array_reduce( + $lines, + static fn (int $max, string $line) => ($max < strlen($line)) ? strlen($line) : $max, + 0 + ); + + $styles = $node->getClassAttribute(); + $html = array_map( + static fn (string $line) => (string) Termwind::div(str_pad($line, $maxStrLen + 3), $styles), + $lines + ); + + return Termwind::raw( + implode('', $html) + ); + } +} diff --git a/vendor/nunomaduro/termwind/src/Html/TableRenderer.php b/vendor/nunomaduro/termwind/src/Html/TableRenderer.php new file mode 100644 index 00000000..60b73d4e --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Html/TableRenderer.php @@ -0,0 +1,251 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Html; + +use Iterator; +use Symfony\Component\Console\Helper\Table; +use Symfony\Component\Console\Helper\TableCell; +use Symfony\Component\Console\Helper\TableCellStyle; +use Symfony\Component\Console\Helper\TableSeparator; +use Symfony\Component\Console\Output\BufferedOutput; +use Symfony\Component\Console\Output\OutputInterface; +use Termwind\Components\Element; +use Termwind\HtmlRenderer; +use Termwind\Termwind; +use Termwind\ValueObjects\Node; +use Termwind\ValueObjects\Styles; + +/** + * @internal + */ +final class TableRenderer +{ + /** + * Symfony table object uses for table generation. + */ + private Table $table; + + /** + * This object is used for accumulating output data from Symfony table object and return it as a string. + */ + private BufferedOutput $output; + + public function __construct() + { + $this->output = new BufferedOutput( + // Content should output as is, without changes + OutputInterface::VERBOSITY_NORMAL | OutputInterface::OUTPUT_RAW, + true + ); + + $this->table = new Table($this->output); + } + + /** + * Converts table output to the content element. + */ + public function toElement(Node $node): Element + { + $this->parseTable($node); + $this->table->render(); + + $content = preg_replace('/\n$/', '', $this->output->fetch()) ?? ''; + + return Termwind::div($content, '', [ + 'isFirstChild' => $node->isFirstChild(), + ]); + } + + /** + * Looks for thead, tfoot, tbody, tr elements in a given DOM and appends rows from them to the Symfony table object. + */ + private function parseTable(Node $node): void + { + $style = $node->getAttribute('style'); + if ($style !== '') { + $this->table->setStyle($style); + } + + foreach ($node->getChildNodes() as $child) { + match ($child->getName()) { + 'thead' => $this->parseHeader($child), + 'tfoot' => $this->parseFoot($child), + 'tbody' => $this->parseBody($child), + default => $this->parseRows($child) + }; + } + } + + /** + * Looks for table header title and tr elements in a given thead DOM node and adds them to the Symfony table object. + */ + private function parseHeader(Node $node): void + { + $title = $node->getAttribute('title'); + + if ($title !== '') { + $this->table->getStyle()->setHeaderTitleFormat( + $this->parseTitleStyle($node) + ); + $this->table->setHeaderTitle($title); + } + + foreach ($node->getChildNodes() as $child) { + if ($child->isName('tr')) { + foreach ($this->parseRow($child) as $row) { + if (! is_array($row)) { + continue; + } + $this->table->setHeaders($row); + } + } + } + } + + /** + * Looks for table footer and tr elements in a given tfoot DOM node and adds them to the Symfony table object. + */ + private function parseFoot(Node $node): void + { + $title = $node->getAttribute('title'); + + if ($title !== '') { + $this->table->getStyle()->setFooterTitleFormat( + $this->parseTitleStyle($node) + ); + $this->table->setFooterTitle($title); + } + + foreach ($node->getChildNodes() as $child) { + if ($child->isName('tr')) { + $rows = iterator_to_array($this->parseRow($child)); + if (count($rows) > 0) { + $this->table->addRow(new TableSeparator()); + $this->table->addRows($rows); + } + } + } + } + + /** + * Looks for tr elements in a given DOM node and adds them to the Symfony table object. + */ + private function parseBody(Node $node): void + { + foreach ($node->getChildNodes() as $child) { + if ($child->isName('tr')) { + $this->parseRows($child); + } + } + } + + /** + * Parses table tr elements. + */ + private function parseRows(Node $node): void + { + foreach ($this->parseRow($node) as $row) { + $this->table->addRow($row); + } + } + + /** + * Looks for th, td elements in a given DOM node and converts them to a table cells. + * + * @return Iterator<array<int, TableCell>|TableSeparator> + */ + private function parseRow(Node $node): Iterator + { + $row = []; + + foreach ($node->getChildNodes() as $child) { + if ($child->isName('th') || $child->isName('td')) { + $align = $child->getAttribute('align'); + + $class = $child->getClassAttribute(); + + if ($child->isName('th')) { + $class .= ' strong'; + } + + $text = (string) (new HtmlRenderer)->parse( + trim(preg_replace('/<br\s?+\/?>/', "\n", $child->getHtml()) ?? '') + ); + + if ((bool) preg_match(Styles::STYLING_REGEX, $text)) { + $class .= ' font-normal'; + } + + $row[] = new TableCell( + // I need only spaces after applying margin, padding and width except tags. + // There is no place for tags, they broke cell formatting. + (string) Termwind::span($text, $class), + [ + // Gets rowspan and colspan from tr and td tag attributes + 'colspan' => max((int) $child->getAttribute('colspan'), 1), + 'rowspan' => max((int) $child->getAttribute('rowspan'), 1), + + // There are background and foreground and options + 'style' => $this->parseCellStyle( + $class, + $align === '' ? TableCellStyle::DEFAULT_ALIGN : $align + ), + ] + ); + } + } + + if ($row !== []) { + yield $row; + } + + $border = (int) $node->getAttribute('border'); + for ($i = $border; $i--; $i > 0) { + yield new TableSeparator(); + } + } + + /** + * Parses tr, td tag class attribute and passes bg, fg and options to a table cell style. + */ + private function parseCellStyle(string $styles, string $align = TableCellStyle::DEFAULT_ALIGN): TableCellStyle + { + // I use this empty span for getting styles for bg, fg and options + // It will be a good idea to get properties without element object and then pass them to an element object + $element = Termwind::span('%s', $styles); + + $styles = []; + + $colors = $element->getProperties()['colors'] ?? []; + + foreach ($colors as $option => $content) { + if (in_array($option, ['fg', 'bg'], true)) { + $content = is_array($content) ? array_pop($content) : $content; + + $styles[] = "$option=$content"; + } + } + + // If there are no styles we don't need extra tags + if ($styles === []) { + $cellFormat = '%s'; + } else { + $cellFormat = '<'.implode(';', $styles).'>%s</>'; + } + + return new TableCellStyle([ + 'align' => $align, + 'cellFormat' => $cellFormat, + ]); + } + + /** + * Get styled representation of title. + */ + private function parseTitleStyle(Node $node): string + { + return (string) Termwind::span(' %s ', $node->getClassAttribute()); + } +} diff --git a/vendor/nunomaduro/termwind/src/HtmlRenderer.php b/vendor/nunomaduro/termwind/src/HtmlRenderer.php new file mode 100644 index 00000000..568c946a --- /dev/null +++ b/vendor/nunomaduro/termwind/src/HtmlRenderer.php @@ -0,0 +1,116 @@ +<?php + +declare(strict_types=1); + +namespace Termwind; + +use DOMDocument; +use DOMNode; +use Termwind\Html\CodeRenderer; +use Termwind\Html\PreRenderer; +use Termwind\Html\TableRenderer; +use Termwind\ValueObjects\Node; + +/** + * @internal + */ +final class HtmlRenderer +{ + /** + * Renders the given html. + */ + public function render(string $html, int $options): void + { + $this->parse($html)->render($options); + } + + /** + * Parses the given html. + */ + public function parse(string $html): Components\Element + { + $dom = new DOMDocument(); + + if (strip_tags($html) === $html) { + return Termwind::span($html); + } + + $html = '<?xml encoding="UTF-8">'.trim($html); + $dom->loadHTML($html, LIBXML_NOERROR | LIBXML_COMPACT | LIBXML_HTML_NODEFDTD | LIBXML_NOBLANKS | LIBXML_NOXMLDECL); + + /** @var DOMNode $body */ + $body = $dom->getElementsByTagName('body')->item(0); + $el = $this->convert(new Node($body)); + + // @codeCoverageIgnoreStart + return is_string($el) + ? Termwind::span($el) + : $el; + // @codeCoverageIgnoreEnd + } + + /** + * Convert a tree of DOM nodes to a tree of termwind elements. + */ + private function convert(Node $node): Components\Element|string + { + $children = []; + + if ($node->isName('table')) { + return (new TableRenderer)->toElement($node); + } elseif ($node->isName('code')) { + return (new CodeRenderer)->toElement($node); + } elseif ($node->isName('pre')) { + return (new PreRenderer)->toElement($node); + } + + foreach ($node->getChildNodes() as $child) { + $children[] = $this->convert($child); + } + + $children = array_filter($children, fn ($child) => $child !== ''); + + return $this->toElement($node, $children); + } + + /** + * Convert a given DOM node to it's termwind element equivalent. + * + * @param array<int, Components\Element|string> $children + */ + private function toElement(Node $node, array $children): Components\Element|string + { + if ($node->isText() || $node->isComment()) { + return (string) $node; + } + + /** @var array<string, mixed> $properties */ + $properties = [ + 'isFirstChild' => $node->isFirstChild(), + ]; + + $styles = $node->getClassAttribute(); + + return match ($node->getName()) { + 'body' => $children[0], // Pick only the first element from the body node + 'div' => Termwind::div($children, $styles, $properties), + 'p' => Termwind::paragraph($children, $styles, $properties), + 'ul' => Termwind::ul($children, $styles, $properties), + 'ol' => Termwind::ol($children, $styles, $properties), + 'li' => Termwind::li($children, $styles, $properties), + 'dl' => Termwind::dl($children, $styles, $properties), + 'dt' => Termwind::dt($children, $styles, $properties), + 'dd' => Termwind::dd($children, $styles, $properties), + 'span' => Termwind::span($children, $styles, $properties), + 'br' => Termwind::breakLine($styles, $properties), + 'strong' => Termwind::span($children, $styles, $properties)->strong(), + 'b' => Termwind::span($children, $styles, $properties)->fontBold(), + 'em', 'i' => Termwind::span($children, $styles, $properties)->italic(), + 'u' => Termwind::span($children, $styles, $properties)->underline(), + 's' => Termwind::span($children, $styles, $properties)->lineThrough(), + 'a' => Termwind::anchor($children, $styles, $properties)->href($node->getAttribute('href')), + 'hr' => Termwind::hr($styles, $properties), + default => Termwind::div($children, $styles, $properties), + }; + } +} diff --git a/vendor/nunomaduro/termwind/src/Laravel/TermwindServiceProvider.php b/vendor/nunomaduro/termwind/src/Laravel/TermwindServiceProvider.php new file mode 100644 index 00000000..d071ec02 --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Laravel/TermwindServiceProvider.php @@ -0,0 +1,22 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Laravel; + +use Illuminate\Console\OutputStyle; +use Illuminate\Support\ServiceProvider; +use Termwind\Termwind; + +final class TermwindServiceProvider extends ServiceProvider +{ + /** + * Sets the correct renderer to be used. + */ + public function register(): void + { + $this->app->resolving(OutputStyle::class, function ($style): void { + Termwind::renderUsing($style->getOutput()); + }); + } +} diff --git a/vendor/nunomaduro/termwind/src/Question.php b/vendor/nunomaduro/termwind/src/Question.php new file mode 100644 index 00000000..289f8667 --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Question.php @@ -0,0 +1,93 @@ +<?php + +declare(strict_types=1); + +namespace Termwind; + +use ReflectionClass; +use Symfony\Component\Console\Helper\SymfonyQuestionHelper; +use Symfony\Component\Console\Input\ArgvInput; +use Symfony\Component\Console\Input\StreamableInputInterface; +use Symfony\Component\Console\Question\Question as SymfonyQuestion; +use Symfony\Component\Console\Style\SymfonyStyle; +use Termwind\Helpers\QuestionHelper; + +/** + * @internal + */ +final class Question +{ + /** + * The streamable input to receive the input from the user. + */ + private static StreamableInputInterface|null $streamableInput; + + /** + * An instance of Symfony's question helper. + */ + private SymfonyQuestionHelper $helper; + + public function __construct(SymfonyQuestionHelper $helper = null) + { + $this->helper = $helper ?? new QuestionHelper(); + } + + /** + * Sets the streamable input implementation. + */ + public static function setStreamableInput(StreamableInputInterface|null $streamableInput): void + { + self::$streamableInput = $streamableInput ?? new ArgvInput(); + } + + /** + * Gets the streamable input implementation. + */ + public static function getStreamableInput(): StreamableInputInterface + { + return self::$streamableInput ??= new ArgvInput(); + } + + /** + * Renders a prompt to the user. + * + * @param iterable<array-key, string>|null $autocomplete + */ + public function ask(string $question, iterable $autocomplete = null): mixed + { + $html = (new HtmlRenderer)->parse($question)->toString(); + + $question = new SymfonyQuestion($html); + + if ($autocomplete !== null) { + $question->setAutocompleterValues($autocomplete); + } + + $output = Termwind::getRenderer(); + + if ($output instanceof SymfonyStyle) { + $property = (new ReflectionClass(SymfonyStyle::class)) + ->getProperty('questionHelper'); + + $property->setAccessible(true); + + $currentHelper = $property->isInitialized($output) + ? $property->getValue($output) + : new SymfonyQuestionHelper(); + + $property->setValue($output, new QuestionHelper); + + try { + return $output->askQuestion($question); + } finally { + $property->setValue($output, $currentHelper); + } + } + + return $this->helper->ask( + self::getStreamableInput(), + Termwind::getRenderer(), + $question, + ); + } +} diff --git a/vendor/nunomaduro/termwind/src/Repositories/Styles.php b/vendor/nunomaduro/termwind/src/Repositories/Styles.php new file mode 100644 index 00000000..6dbada5e --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Repositories/Styles.php @@ -0,0 +1,59 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\Repositories; + +use Closure; +use Termwind\ValueObjects\Style; +use Termwind\ValueObjects\Styles as StylesValueObject; + +/** + * @internal + */ +final class Styles +{ + /** + * @var array<string, Style> + */ + private static array $storage = []; + + /** + * Creates a new style from the given arguments. + * + * @param (Closure(StylesValueObject $element, string|int ...$arguments): StylesValueObject)|null $callback + * @return Style + */ + public static function create(string $name, Closure $callback = null): Style + { + self::$storage[$name] = $style = new Style( + $callback ?? static fn (StylesValueObject $styles) => $styles + ); + + return $style; + } + + /** + * Removes all existing styles. + */ + public static function flush(): void + { + self::$storage = []; + } + + /** + * Checks a style with the given name exists. + */ + public static function has(string $name): bool + { + return array_key_exists($name, self::$storage); + } + + /** + * Gets the style with the given name. + */ + public static function get(string $name): Style + { + return self::$storage[$name]; + } +} diff --git a/vendor/nunomaduro/termwind/src/Terminal.php b/vendor/nunomaduro/termwind/src/Terminal.php new file mode 100644 index 00000000..6b74885b --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Terminal.php @@ -0,0 +1,50 @@ +<?php + +declare(strict_types=1); + +namespace Termwind; + +use Symfony\Component\Console\Terminal as ConsoleTerminal; + +/** + * @internal + */ +final class Terminal +{ + /** + * An instance of Symfony's console terminal. + */ + private ConsoleTerminal $terminal; + + /** + * Creates a new terminal instance. + */ + public function __construct(ConsoleTerminal $terminal = null) + { + $this->terminal = $terminal ?? new ConsoleTerminal(); + } + + /** + * Gets the terminal width. + */ + public function width(): int + { + return $this->terminal->getWidth(); + } + + /** + * Gets the terminal height. + */ + public function height(): int + { + return $this->terminal->getHeight(); + } + + /** + * Clears the terminal screen. + */ + public function clear(): void + { + Termwind::getRenderer()->write("\ec"); + } +} diff --git a/vendor/nunomaduro/termwind/src/Termwind.php b/vendor/nunomaduro/termwind/src/Termwind.php new file mode 100644 index 00000000..0ce1b515 --- /dev/null +++ b/vendor/nunomaduro/termwind/src/Termwind.php @@ -0,0 +1,300 @@ +<?php + +declare(strict_types=1); + +namespace Termwind; + +use Closure; +use Symfony\Component\Console\Output\ConsoleOutput; +use Symfony\Component\Console\Output\OutputInterface; +use Termwind\Components\Element; +use Termwind\Exceptions\InvalidChild; + +/** + * @internal + */ +final class Termwind +{ + /** + * The implementation of the output. + */ + private static OutputInterface|null $renderer; + + /** + * Sets the renderer implementation. + */ + public static function renderUsing(OutputInterface|null $renderer): void + { + self::$renderer = $renderer ?? new ConsoleOutput(); + } + + /** + * Creates a div element instance. + * + * @param array<int, Element|string>|string $content + * @param array<string, mixed> $properties + */ + public static function div(array|string $content = '', string $styles = '', array $properties = []): Components\Div + { + $content = self::prepareElements($content, $styles); + + return Components\Div::fromStyles( + self::getRenderer(), $content, $styles, $properties + ); + } + + /** + * Creates a paragraph element instance. + * + * @param array<int, Element|string>|string $content + * @param array<string, mixed> $properties + */ + public static function paragraph(array|string $content = '', string $styles = '', array $properties = []): Components\Paragraph + { + $content = self::prepareElements($content, $styles); + + return Components\Paragraph::fromStyles( + self::getRenderer(), $content, $styles, $properties + ); + } + + /** + * Creates a span element instance with the given style. + * + * @param array<int, Element|string>|string $content + * @param array<string, mixed> $properties + */ + public static function span(array|string $content = '', string $styles = '', array $properties = []): Components\Span + { + $content = self::prepareElements($content, $styles); + + return Components\Span::fromStyles( + self::getRenderer(), $content, $styles, $properties + ); + } + + /** + * Creates an element instance with raw content. + * + * @param array<int, Element|string>|string $content + */ + public static function raw(array|string $content = ''): Components\Raw + { + return Components\Raw::fromStyles( + self::getRenderer(), $content + ); + } + + /** + * Creates an anchor element instance with the given style. + * + * @param array<int, Element|string>|string $content + * @param array<string, mixed> $properties + */ + public static function anchor(array|string $content = '', string $styles = '', array $properties = []): Components\Anchor + { + $content = self::prepareElements($content, $styles); + + return Components\Anchor::fromStyles( + self::getRenderer(), $content, $styles, $properties + ); + } + + /** + * Creates an unordered list instance. + * + * @param array<int, string|Element> $content + * @param array<string, mixed> $properties + */ + public static function ul(array $content = [], string $styles = '', array $properties = []): Components\Ul + { + $ul = Components\Ul::fromStyles( + self::getRenderer(), '', $styles, $properties + ); + + $content = self::prepareElements( + $content, + $styles, + static function ($li) use ($ul): string|Element { + if (is_string($li)) { + return $li; + } + + if (! $li instanceof Components\Li) { + throw new InvalidChild('Unordered lists only accept `li` as child'); + } + + return match (true) { + $li->hasStyle('list-none') => $li, + $ul->hasStyle('list-none') => $li->addStyle('list-none'), + $ul->hasStyle('list-square') => $li->addStyle('list-square'), + $ul->hasStyle('list-disc') => $li->addStyle('list-disc'), + default => $li->addStyle('list-none'), + }; + } + ); + + return $ul->setContent($content); + } + + /** + * Creates an ordered list instance. + * + * @param array<int, string|Element> $content + * @param array<string, mixed> $properties + */ + public static function ol(array $content = [], string $styles = '', array $properties = []): Components\Ol + { + $ol = Components\Ol::fromStyles( + self::getRenderer(), '', $styles, $properties + ); + + $index = 0; + + $content = self::prepareElements( + $content, + $styles, + static function ($li) use ($ol, &$index): string|Element { + if (is_string($li)) { + return $li; + } + + if (! $li instanceof Components\Li) { + throw new InvalidChild('Ordered lists only accept `li` as child'); + } + + return match (true) { + $li->hasStyle('list-none') => $li->addStyle('list-none'), + $ol->hasStyle('list-none') => $li->addStyle('list-none'), + $ol->hasStyle('list-decimal') => $li->addStyle('list-decimal-'.(++$index)), + default => $li->addStyle('list-none'), + }; + } + ); + + return $ol->setContent($content); + } + + /** + * Creates a list item instance. + * + * @param array<int, Element|string>|string $content + * @param array<string, mixed> $properties + */ + public static function li(array|string $content = '', string $styles = '', array $properties = []): Components\Li + { + $content = self::prepareElements($content, $styles); + + return Components\Li::fromStyles( + self::getRenderer(), $content, $styles, $properties + ); + } + + /** + * Creates a description list instance. + * + * @param array<int, string|Element> $content + * @param array<string, mixed> $properties + */ + public static function dl(array $content = [], string $styles = '', array $properties = []): Components\Dl + { + $content = self::prepareElements( + $content, + $styles, + static function ($element): string|Element { + if (is_string($element)) { + return $element; + } + + if (! $element instanceof Components\Dt && ! $element instanceof Components\Dd) { + throw new InvalidChild('Description lists only accept `dt` and `dd` as children'); + } + + return $element; + } + ); + + return Components\Dl::fromStyles( + self::getRenderer(), $content, $styles, $properties + ); + } + + /** + * Creates a description term instance. + * + * @param array<int, Element|string>|string $content + * @param array<string, mixed> $properties + */ + public static function dt(array|string $content = '', string $styles = '', array $properties = []): Components\Dt + { + $content = self::prepareElements($content, $styles); + + return Components\Dt::fromStyles( + self::getRenderer(), $content, $styles, $properties + ); + } + + /** + * Creates a description details instance. + * + * @param array<int, Element|string>|string $content + * @param array<string, mixed> $properties + */ + public static function dd(array|string $content = '', string $styles = '', array $properties = []): Components\Dd + { + $content = self::prepareElements($content, $styles); + + return Components\Dd::fromStyles( + self::getRenderer(), $content, $styles, $properties + ); + } + + /** + * Creates a horizontal rule instance. + * + * @param array<string, mixed> $properties + */ + public static function hr(string $styles = '', array $properties = []): Components\Hr + { + return Components\Hr::fromStyles( + self::getRenderer(), '', $styles, $properties + ); + } + + /** + * Creates an break line element instance. + * + * @param array<string, mixed> $properties + */ + public static function breakLine(string $styles = '', array $properties = []): Components\BreakLine + { + return Components\BreakLine::fromStyles( + self::getRenderer(), '', $styles, $properties + ); + } + + /** + * Gets the current renderer instance. + */ + public static function getRenderer(): OutputInterface + { + return self::$renderer ??= new ConsoleOutput(); + } + + /** + * Convert child elements to a string. + * + * @param array<int, string|Element>|string $elements + * @return array<int, string|Element> + */ + private static function prepareElements($elements, string $styles = '', Closure|null $callback = null): array + { + if ($callback === null) { + $callback = static fn ($element): string|Element => $element; + } + + $elements = is_array($elements) ? $elements : [$elements]; + + return array_map($callback, $elements); + } +} diff --git a/vendor/nunomaduro/termwind/src/ValueObjects/Node.php b/vendor/nunomaduro/termwind/src/ValueObjects/Node.php new file mode 100644 index 00000000..4f82a5d2 --- /dev/null +++ b/vendor/nunomaduro/termwind/src/ValueObjects/Node.php @@ -0,0 +1,205 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\ValueObjects; + +use Generator; + +/** + * @internal + */ +final class Node +{ + /** + * A value object with helper methods for working with DOM node. + */ + public function __construct(private \DOMNode $node) + { + } + + /** + * Gets the value of the node. + */ + public function getValue(): string + { + return $this->node->nodeValue ?? ''; + } + + /** + * Gets child nodes of the node. + * + * @return Generator<Node> + */ + public function getChildNodes(): Generator + { + foreach ($this->node->childNodes as $node) { + yield new static($node); + } + } + + /** + * Checks if the node is a text. + */ + public function isText(): bool + { + return $this->node instanceof \DOMText; + } + + /** + * Checks if the node is a comment. + */ + public function isComment(): bool + { + return $this->node instanceof \DOMComment; + } + + /** + * Compares the current node name with a given name. + */ + public function isName(string $name): bool + { + return $this->getName() === $name; + } + + /** + * Returns the current node type name. + */ + public function getName(): string + { + return $this->node->nodeName; + } + + /** + * Returns value of [class] attribute. + */ + public function getClassAttribute(): string + { + return $this->getAttribute('class'); + } + + /** + * Returns value of attribute with a given name. + */ + public function getAttribute(string $name): string + { + if ($this->node instanceof \DOMElement) { + return $this->node->getAttribute($name); + } + + return ''; + } + + /** + * Checks if the node is empty. + */ + public function isEmpty(): bool + { + return $this->isText() && preg_replace('/\s+/', '', $this->getValue()) === ''; + } + + /** + * Gets the previous sibling from the node. + */ + public function getPreviousSibling(): static|null + { + $node = $this->node; + + while ($node = $node->previousSibling) { + $node = new static($node); + + if ($node->isEmpty()) { + $node = $node->node; + + continue; + } + + if (! $node->isComment()) { + return $node; + } + + $node = $node->node; + } + + return is_null($node) ? null : new static($node); + } + + /** + * Gets the next sibling from the node. + */ + public function getNextSibling(): static|null + { + $node = $this->node; + + while ($node = $node->nextSibling) { + $node = new static($node); + + if ($node->isEmpty()) { + $node = $node->node; + + continue; + } + + if (! $node->isComment()) { + return $node; + } + + $node = $node->node; + } + + return is_null($node) ? null : new static($node); + } + + /** + * Checks if the node is the first child. + */ + public function isFirstChild(): bool + { + return is_null($this->getPreviousSibling()); + } + + /** + * Gets the inner HTML representation of the node including child nodes. + */ + public function getHtml(): string + { + $html = ''; + foreach ($this->node->childNodes as $child) { + if ($child->ownerDocument instanceof \DOMDocument) { + $html .= $child->ownerDocument->saveXML($child); + } + } + + return html_entity_decode($html); + } + + /** + * Converts the node to a string. + */ + public function __toString(): string + { + if ($this->isComment()) { + return ''; + } + + if ($this->getValue() === ' ') { + return ' '; + } + + if ($this->isEmpty()) { + return ''; + } + + $text = preg_replace('/\s+/', ' ', $this->getValue()) ?? ''; + + if (is_null($this->getPreviousSibling())) { + $text = ltrim($text); + } + + if (is_null($this->getNextSibling())) { + $text = rtrim($text); + } + + return $text; + } +} diff --git a/vendor/nunomaduro/termwind/src/ValueObjects/Style.php b/vendor/nunomaduro/termwind/src/ValueObjects/Style.php new file mode 100644 index 00000000..bc96e58a --- /dev/null +++ b/vendor/nunomaduro/termwind/src/ValueObjects/Style.php @@ -0,0 +1,70 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\ValueObjects; + +use Closure; +use Termwind\Actions\StyleToMethod; +use Termwind\Exceptions\InvalidColor; + +/** + * @internal + */ +final class Style +{ + /** + * Creates a new value object instance. + * + * @param Closure(Styles $styles, string|int ...$argument): Styles $callback + */ + public function __construct(private Closure $callback, private string $color = '') + { + // .. + } + + /** + * Apply the given set of styles to the styles. + */ + public function apply(string $styles): void + { + $callback = clone $this->callback; + + $this->callback = static function ( + Styles $formatter, + string|int ...$arguments + ) use ($callback, $styles): Styles { + $formatter = $callback($formatter, ...$arguments); + + return StyleToMethod::multiple($formatter, $styles); + }; + } + + /** + * Sets the color to the style. + */ + public function color(string $color): void + { + if (preg_match('/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/', $color) < 1) { + throw new InvalidColor(sprintf('The color %s is invalid.', $color)); + } + + $this->color = $color; + } + + /** + * Gets the color. + */ + public function getColor(): string + { + return $this->color; + } + + /** + * Styles the given formatter with this style. + */ + public function __invoke(Styles $styles, string|int ...$arguments): Styles + { + return ($this->callback)($styles, ...$arguments); + } +} diff --git a/vendor/nunomaduro/termwind/src/ValueObjects/Styles.php b/vendor/nunomaduro/termwind/src/ValueObjects/Styles.php new file mode 100644 index 00000000..04140cff --- /dev/null +++ b/vendor/nunomaduro/termwind/src/ValueObjects/Styles.php @@ -0,0 +1,1061 @@ +<?php + +declare(strict_types=1); + +namespace Termwind\ValueObjects; + +use Closure; +use Termwind\Actions\StyleToMethod; +use Termwind\Components\Element; +use Termwind\Components\Hr; +use Termwind\Components\Li; +use Termwind\Components\Ol; +use Termwind\Components\Ul; +use Termwind\Enums\Color; +use Termwind\Exceptions\ColorNotFound; +use Termwind\Exceptions\InvalidStyle; +use Termwind\Repositories\Styles as StyleRepository; +use function Termwind\terminal; + +/** + * @internal + */ +final class Styles +{ + /** + * Finds all the styling on a string. + */ + public const STYLING_REGEX = "/\<[\w=#\/\;,:.&,%?-]+\>|\\e\[\d+m/"; + + /** @var array<int, string> */ + private array $styles = []; + + private ?Element $element = null; + + /** + * Creates a Style formatter instance. + * + * @param array<string, mixed> $properties + * @param array<string, Closure(string, array<string, string|int>, array<string, int[]>): string> $textModifiers + * @param array<string, Closure(string, array<string, string|int>): string> $styleModifiers + * @param string[] $defaultStyles + */ + final public function __construct( + private array $properties = [ + 'colors' => [], + 'options' => [], + 'isFirstChild' => false, + ], + private array $textModifiers = [], + private array $styleModifiers = [], + private array $defaultStyles = [] + ) { + } + + /** + * @param Element $element + * @return $this + */ + public function setElement(Element $element): self + { + $this->element = $element; + + return $this; + } + + /** + * Gets default styles. + * + * @return string[] + */ + public function defaultStyles(): array + { + return $this->defaultStyles; + } + + /** + * Gets the element's style properties. + * + * @return array<string, mixed> + */ + final public function getProperties(): array + { + return $this->properties; + } + + /** + * Sets the element's style properties. + * + * @param array<string, mixed> $properties + */ + public function setProperties(array $properties): self + { + $this->properties = $properties; + + return $this; + } + + /** + * Sets the styles to the element. + */ + final public function setStyle(string $style): self + { + $this->styles = array_unique(array_merge($this->styles, [$style])); + + return $this; + } + + /** + * Checks if the element has the style. + */ + final public function hasStyle(string $style): bool + { + return in_array($style, $this->styles, true); + } + + /** + * Adds a style to the element. + */ + final public function addStyle(string $style): self + { + return StyleToMethod::multiple($this, $style); + } + + /** + * Inherit styles from given Styles object. + */ + final public function inheritFromStyles(self $styles): self + { + foreach (['ml', 'mr', 'pl', 'pr', 'width', 'minWidth', 'maxWidth', 'spaceY', 'spaceX'] as $style) { + $this->properties['parentStyles'][$style] = array_merge( + $this->properties['parentStyles'][$style] ?? [], + $styles->properties['parentStyles'][$style] ?? [] + ); + + $this->properties['parentStyles'][$style][] = $styles->properties['styles'][$style] ?? 0; + } + + $this->properties['parentStyles']['justifyContent'] = $styles->properties['styles']['justifyContent'] ?? false; + + foreach (['bg', 'fg'] as $colorType) { + $value = (array) ($this->properties['colors'][$colorType] ?? []); + $parentValue = (array) ($styles->properties['colors'][$colorType] ?? []); + + if ($value === [] && $parentValue !== []) { + $this->properties['colors'][$colorType] = $styles->properties['colors'][$colorType]; + } + } + + if (! is_null($this->properties['options']['bold'] ?? null) || + ! is_null($styles->properties['options']['bold'] ?? null)) { + $this->properties['options']['bold'] = $this->properties['options']['bold'] + ?? $styles->properties['options']['bold'] + ?? false; + } + + return $this; + } + + /** + * Adds a background color to the element. + */ + final public function bg(string $color, int $variant = 0): self + { + return $this->with(['colors' => [ + 'bg' => $this->getColorVariant($color, $variant), + ]]); + } + + /** + * Adds a bold style to the element. + */ + final public function fontBold(): self + { + return $this->with(['options' => [ + 'bold' => true, + ]]); + } + + /** + * Removes the bold style on the element. + */ + final public function fontNormal(): self + { + return $this->with(['options' => [ + 'bold' => false, + ]]); + } + + /** + * Adds a bold style to the element. + */ + final public function strong(): self + { + $this->styleModifiers[__METHOD__] = static fn ($text): string => sprintf("\e[1m%s\e[0m", $text); + + return $this; + } + + /** + * Adds an italic style to the element. + */ + final public function italic(): self + { + $this->styleModifiers[__METHOD__] = static fn ($text): string => sprintf("\e[3m%s\e[0m", $text); + + return $this; + } + + /** + * Adds an underline style. + */ + final public function underline(): self + { + $this->styleModifiers[__METHOD__] = static fn ($text): string => sprintf("\e[4m%s\e[0m", $text); + + return $this; + } + + /** + * Adds the given margin left to the element. + */ + final public function ml(int $margin): self + { + return $this->with(['styles' => [ + 'ml' => $margin, + ]]); + } + + /** + * Adds the given margin right to the element. + */ + final public function mr(int $margin): self + { + return $this->with(['styles' => [ + 'mr' => $margin, + ]]); + } + + /** + * Adds the given margin bottom to the element. + */ + final public function mb(int $margin): self + { + return $this->with(['styles' => [ + 'mb' => $margin, + ]]); + } + + /** + * Adds the given margin top to the element. + */ + final public function mt(int $margin): self + { + return $this->with(['styles' => [ + 'mt' => $margin, + ]]); + } + + /** + * Adds the given horizontal margin to the element. + */ + final public function mx(int $margin): self + { + return $this->with(['styles' => [ + 'ml' => $margin, + 'mr' => $margin, + ]]); + } + + /** + * Adds the given vertical margin to the element. + */ + final public function my(int $margin): self + { + return $this->with(['styles' => [ + 'mt' => $margin, + 'mb' => $margin, + ]]); + } + + /** + * Adds the given margin to the element. + */ + final public function m(int $margin): self + { + return $this->my($margin)->mx($margin); + } + + /** + * Adds the given padding left to the element. + */ + final public function pl(int $padding): static + { + return $this->with(['styles' => [ + 'pl' => $padding, + ]]); + } + + /** + * Adds the given padding right. + */ + final public function pr(int $padding): static + { + return $this->with(['styles' => [ + 'pr' => $padding, + ]]); + } + + /** + * Adds the given horizontal padding. + */ + final public function px(int $padding): self + { + return $this->pl($padding)->pr($padding); + } + + /** + * Adds the given padding top. + */ + final public function pt(int $padding): static + { + return $this->with(['styles' => [ + 'pt' => $padding, + ]]); + } + + /** + * Adds the given padding bottom. + */ + final public function pb(int $padding): static + { + return $this->with(['styles' => [ + 'pb' => $padding, + ]]); + } + + /** + * Adds the given vertical padding. + */ + final public function py(int $padding): self + { + return $this->pt($padding)->pb($padding); + } + + /** + * Adds the given padding. + */ + final public function p(int $padding): self + { + return $this->pt($padding)->pr($padding)->pb($padding)->pl($padding); + } + + /** + * Adds the given vertical margin to the childs, ignoring the first child. + */ + final public function spaceY(int $space): self + { + return $this->with(['styles' => [ + 'spaceY' => $space, + ]]); + } + + /** + * Adds the given horizontal margin to the childs, ignoring the first child. + */ + final public function spaceX(int $space): self + { + return $this->with(['styles' => [ + 'spaceX' => $space, + ]]); + } + + /** + * Adds a border on top of each element. + */ + final public function borderT(int $width = 1): self + { + if (! $this->element instanceof Hr) { + throw new InvalidStyle('`border-t` can only be used on an "hr" element.'); + } + + $this->styleModifiers[__METHOD__] = function ($text, $styles): string { + $length = $this->getLength($text); + if ($length < 1) { + $margins = (int) ($styles['ml'] ?? 0) + ($styles['mr'] ?? 0); + + return str_repeat('─', self::getParentWidth($this->properties['parentStyles'] ?? []) - $margins); + } + + return str_repeat('─', $length); + }; + + return $this; + } + + /** + * Adds a text alignment or color to the element. + */ + final public function text(string $value, int $variant = 0): self + { + if (in_array($value, ['left', 'right', 'center'], true)) { + return $this->with(['styles' => [ + 'text-align' => $value, + ]]); + } + + return $this->with(['colors' => [ + 'fg' => $this->getColorVariant($value, $variant), + ]]); + } + + /** + * Truncates the text of the element. + */ + final public function truncate(int $limit = 0, string $end = '…'): self + { + $this->textModifiers[__METHOD__] = function ($text, $styles) use ($limit, $end): string { + $width = $styles['width'] ?? 0; + + if (is_string($width)) { + $width = self::calcWidthFromFraction( + $width, + $styles, + $this->properties['parentStyles'] ?? [] + ); + } + + [, $paddingRight, , $paddingLeft] = $this->getPaddings(); + $width -= $paddingRight + $paddingLeft; + + $limit = $limit > 0 ? $limit : $width; + if ($limit === 0) { + return $text; + } + + $limit -= mb_strwidth($end, 'UTF-8'); + + if ($this->getLength($text) <= $limit) { + return $text; + } + + return rtrim(self::trimText($text, $limit).$end); + }; + + return $this; + } + + /** + * Forces the width of the element. + */ + final public function w(int|string $width): static + { + return $this->with(['styles' => [ + 'width' => $width, + ]]); + } + + /** + * Forces the element width to the full width of the terminal. + */ + final public function wFull(): static + { + return $this->w('1/1'); + } + + /** + * Removes the width set on the element. + */ + final public function wAuto(): static + { + return $this->with(['styles' => [ + 'width' => null, + ]]); + } + + /** + * Defines a minimum width of an element. + */ + final public function minW(int|string $width): static + { + return $this->with(['styles' => [ + 'minWidth' => $width, + ]]); + } + + /** + * Defines a maximum width of an element. + */ + final public function maxW(int|string $width): static + { + return $this->with(['styles' => [ + 'maxWidth' => $width, + ]]); + } + + /** + * Makes the element's content uppercase. + */ + final public function uppercase(): self + { + $this->textModifiers[__METHOD__] = static fn ($text): string => mb_strtoupper($text, 'UTF-8'); + + return $this; + } + + /** + * Makes the element's content lowercase. + */ + final public function lowercase(): self + { + $this->textModifiers[__METHOD__] = static fn ($text): string => mb_strtolower($text, 'UTF-8'); + + return $this; + } + + /** + * Makes the element's content capitalize. + */ + final public function capitalize(): self + { + $this->textModifiers[__METHOD__] = static fn ($text): string => mb_convert_case($text, MB_CASE_TITLE, 'UTF-8'); + + return $this; + } + + /** + * Makes the element's content in snakecase. + */ + final public function snakecase(): self + { + $this->textModifiers[__METHOD__] = static fn ($text): string => mb_strtolower( + (string) preg_replace(['/([a-z\d])([A-Z])/', '/([^_])([A-Z][a-z])/'], '$1_$2', $text), + 'UTF-8' + ); + + return $this; + } + + /** + * Makes the element's content with a line through. + */ + final public function lineThrough(): self + { + $this->styleModifiers[__METHOD__] = static fn ($text): string => sprintf("\e[9m%s\e[0m", $text); + + return $this; + } + + /** + * Makes the element's content invisible. + */ + final public function invisible(): self + { + $this->styleModifiers[__METHOD__] = static fn ($text): string => sprintf("\e[8m%s\e[0m", $text); + + return $this; + } + + /** + * Do not display element's content. + */ + final public function hidden(): self + { + return $this->with(['styles' => [ + 'display' => 'hidden', + ]]); + } + + /** + * Makes a line break before the element's content. + */ + final public function block(): self + { + return $this->with(['styles' => [ + 'display' => 'block', + ]]); + } + + /** + * Makes an element eligible to work with flex-1 element's style. + */ + final public function flex(): self + { + return $this->with(['styles' => [ + 'display' => 'flex', + ]]); + } + + /** + * Makes an element grow and shrink as needed, ignoring the initial size. + */ + final public function flex1(): self + { + return $this->with(['styles' => [ + 'flex-1' => true, + ]]); + } + + /** + * Justifies childs along the element with an equal amount of space between. + */ + final public function justifyBetween(): self + { + return $this->with(['styles' => [ + 'justifyContent' => 'between', + ]]); + } + + /** + * Justifies childs along the element with an equal amount of space between + * each item and half around. + */ + final public function justifyAround(): self + { + return $this->with(['styles' => [ + 'justifyContent' => 'around', + ]]); + } + + /** + * Justifies childs along the element with an equal amount of space around each item. + */ + final public function justifyEvenly(): self + { + return $this->with(['styles' => [ + 'justifyContent' => 'evenly', + ]]); + } + + /** + * Justifies childs along the center of the container’s main axis. + */ + final public function justifyCenter(): self + { + return $this->with(['styles' => [ + 'justifyContent' => 'center', + ]]); + } + + /** + * Repeats the string given until it fills all the content. + */ + final public function contentRepeat(string $string): self + { + $string = preg_replace("/\[?'?([^'|\]]+)'?\]?/", '$1', $string) ?? ''; + + $this->textModifiers[__METHOD__] = static fn (): string => str_repeat($string, (int) floor(terminal()->width() / mb_strlen($string, 'UTF-8'))); + + return $this->with(['styles' => [ + 'contentRepeat' => true, + ]]); + } + + /** + * Prepends text to the content. + */ + final public function prepend(string $string): self + { + $this->textModifiers[__METHOD__] = static fn ($text): string => $string.$text; + + return $this; + } + + /** + * Appends text to the content. + */ + final public function append(string $string): self + { + $this->textModifiers[__METHOD__] = static fn ($text): string => $text.$string; + + return $this; + } + + /** + * Prepends the list style type to the content. + */ + final public function list(string $type, int $index = 0): self + { + if (! $this->element instanceof Ul && ! $this->element instanceof Ol && ! $this->element instanceof Li) { + throw new InvalidStyle(sprintf( + 'Style list-none cannot be used with %s', + $this->element !== null ? $this->element::class : 'unknown element' + )); + } + + if (! $this->element instanceof Li) { + return $this; + } + + return match ($type) { + 'square' => $this->prepend('▪ '), + 'disc' => $this->prepend('• '), + 'decimal' => $this->prepend(sprintf('%d. ', $index)), + default => $this, + }; + } + + /** + * Adds the given properties to the element. + * + * @param array<string, mixed> $properties + */ + public function with(array $properties): self + { + $this->properties = array_replace_recursive($this->properties, $properties); + + return $this; + } + + /** + * Sets the href property to the element. + */ + final public function href(string $href): self + { + $href = str_replace('%', '%%', $href); + + return $this->with(['href' => array_filter([$href])]); + } + + /** + * Formats a given string. + */ + final public function format(string $content): string + { + foreach ($this->textModifiers as $modifier) { + $content = $modifier( + $content, + $this->properties['styles'] ?? [], + $this->properties['parentStyles'] ?? [] + ); + } + + $content = $this->applyWidth($content); + + foreach ($this->styleModifiers as $modifier) { + $content = $modifier($content, $this->properties['styles'] ?? []); + } + + return $this->applyStyling($content); + } + + /** + * Get the format string including required styles. + */ + private function getFormatString(): string + { + $styles = []; + + /** @var array<int, string> $href */ + $href = $this->properties['href'] ?? []; + if ($href !== []) { + $styles[] = sprintf('href=%s', array_pop($href)); + } + + $colors = $this->properties['colors'] ?? []; + + foreach ($colors as $option => $content) { + if (in_array($option, ['fg', 'bg'], true)) { + $content = is_array($content) ? array_pop($content) : $content; + + $styles[] = "$option=$content"; + } + } + + $options = $this->properties['options'] ?? []; + + if ($options !== []) { + $options = array_keys(array_filter( + $options, fn ($option) => $option === true + )); + $styles[] = count($options) > 0 + ? 'options='.implode(',', $options) + : 'options=,'; + } + + // If there are no styles we don't need extra tags + if ($styles === []) { + return '%s%s%s%s%s'; + } + + return '%s<'.implode(';', $styles).'>%s%s%s</>%s'; + } + + /** + * Get the margins applied to the element. + * + * @return array{0: int, 1: int, 2: int, 3: int} + */ + private function getMargins(): array + { + $isFirstChild = (bool) $this->properties['isFirstChild']; + + $spaceY = $this->properties['parentStyles']['spaceY'] ?? []; + $spaceY = ! $isFirstChild ? end($spaceY) : 0; + + $spaceX = $this->properties['parentStyles']['spaceX'] ?? []; + $spaceX = ! $isFirstChild ? end($spaceX) : 0; + + return [ + $spaceY > 0 ? $spaceY : $this->properties['styles']['mt'] ?? 0, + $this->properties['styles']['mr'] ?? 0, + $this->properties['styles']['mb'] ?? 0, + $spaceX > 0 ? $spaceX : $this->properties['styles']['ml'] ?? 0, + ]; + } + + /** + * Get the paddings applied to the element. + * + * @return array{0: int, 1: int, 2: int, 3: int} + */ + private function getPaddings(): array + { + return [ + $this->properties['styles']['pt'] ?? 0, + $this->properties['styles']['pr'] ?? 0, + $this->properties['styles']['pb'] ?? 0, + $this->properties['styles']['pl'] ?? 0, + ]; + } + + /** + * It applies the correct width for the content. + */ + private function applyWidth(string $content): string + { + $styles = $this->properties['styles'] ?? []; + $minWidth = $styles['minWidth'] ?? -1; + $width = max($styles['width'] ?? -1, $minWidth); + $maxWidth = $styles['maxWidth'] ?? 0; + + if ($width < 0) { + return $content; + } + + if ($width === 0) { + return ''; + } + + if (is_string($width)) { + $width = self::calcWidthFromFraction( + $width, + $styles, + $this->properties['parentStyles'] ?? [] + ); + } + + if ($maxWidth > 0) { + $width = min($styles['maxWidth'], $width); + } + + $width -= ($styles['pl'] ?? 0) + ($styles['pr'] ?? 0); + $length = $this->getLength($content); + + preg_match_all("/\n+/", $content, $matches); + + $width *= count($matches[0] ?? []) + 1; + $width += mb_strlen($matches[0][0] ?? '', 'UTF-8'); + + if ($length <= $width) { + $space = $width - $length; + + return match ($styles['text-align'] ?? '') { + 'right' => str_repeat(' ', $space).$content, + 'center' => str_repeat(' ', (int) floor($space / 2)).$content.str_repeat(' ', (int) ceil($space / 2)), + default => $content.str_repeat(' ', $space), + }; + } + + return self::trimText($content, $width); + } + + /** + * It applies the styling for the content. + */ + private function applyStyling(string $content): string + { + $display = $this->properties['styles']['display'] ?? 'inline'; + + if ($display === 'hidden') { + return ''; + } + + $isFirstChild = (bool) $this->properties['isFirstChild']; + + [$marginTop, $marginRight, $marginBottom, $marginLeft] = $this->getMargins(); + [$paddingTop, $paddingRight, $paddingBottom, $paddingLeft] = $this->getPaddings(); + + $content = (string) preg_replace('/\r[ \t]?/', "\n", + (string) preg_replace( + '/\n/', + str_repeat(' ', $marginRight + $paddingRight) + ."\n". + str_repeat(' ', $marginLeft + $paddingLeft), + $content) + ); + + $formatted = sprintf( + $this->getFormatString(), + str_repeat(' ', $marginLeft), + str_repeat(' ', $paddingLeft), + $content, + str_repeat(' ', $paddingRight), + str_repeat(' ', $marginRight), + ); + + $empty = str_replace( + $content, + str_repeat(' ', $this->getLength($content)), + $formatted + ); + + $items = []; + + if (in_array($display, ['block', 'flex'], true) && ! $isFirstChild) { + $items[] = "\n"; + } + + if ($marginTop > 0) { + $items[] = str_repeat("\n", $marginTop); + } + + if ($paddingTop > 0) { + $items[] = $empty."\n"; + } + + $items[] = $formatted; + + if ($paddingBottom > 0) { + $items[] = "\n".$empty; + } + + if ($marginBottom > 0) { + $items[] = str_repeat("\n", $marginBottom); + } + + return implode('', $items); + } + + /** + * Get the length of the text provided without the styling tags. + */ + public function getLength(string $text = null): int + { + return mb_strlen(preg_replace( + self::STYLING_REGEX, + '', + $text ?? $this->element?->toString() ?? '' + ) ?? '', 'UTF-8'); + } + + /** + * Get the length of the element without margins. + */ + public function getInnerWidth(): int + { + $innerLength = $this->getLength(); + [, $marginRight, , $marginLeft] = $this->getMargins(); + + return $innerLength - $marginLeft - $marginRight; + } + + /** + * Get the constant variant color from Color class. + */ + private function getColorVariant(string $color, int $variant): string + { + if ($variant > 0) { + $color .= '-'.$variant; + } + + if (StyleRepository::has($color)) { + return StyleRepository::get($color)->getColor(); + } + + $colorConstant = mb_strtoupper(str_replace('-', '_', $color), 'UTF-8'); + + if (! defined(Color::class."::$colorConstant")) { + throw new ColorNotFound($colorConstant); + } + + return constant(Color::class."::$colorConstant"); + } + + /** + * Calculates the width based on the fraction provided. + * + * @param array<string, int> $styles + * @param array<string, array<int, int|string>> $parentStyles + */ + private static function calcWidthFromFraction(string $fraction, array $styles, array $parentStyles): int + { + $width = self::getParentWidth($parentStyles); + + preg_match('/(\d+)\/(\d+)/', $fraction, $matches); + + if (count($matches) !== 3 || $matches[2] === '0') { + throw new InvalidStyle(sprintf('Style [%s] is invalid.', "w-$fraction")); + } + + /** @@phpstan-ignore-next-line */ + $width = (int) floor($width * $matches[1] / $matches[2]); + $width -= ($styles['ml'] ?? 0) + ($styles['mr'] ?? 0); + + return $width; + } + + /** + * Gets the width of the parent element. + * + * @param array<string, array<int|string>> $styles + */ + public static function getParentWidth(array $styles): int + { + $width = terminal()->width(); + foreach ($styles['width'] ?? [] as $index => $parentWidth) { + $minWidth = (int) $styles['minWidth'][$index]; + $maxWidth = (int) $styles['maxWidth'][$index]; + $margins = (int) $styles['ml'][$index] + (int) $styles['mr'][$index]; + + $parentWidth = max($parentWidth, $minWidth); + + if ($parentWidth < 1) { + $parentWidth = $width; + } elseif (is_int($parentWidth)) { + $parentWidth += $margins; + } + + preg_match('/(\d+)\/(\d+)/', (string) $parentWidth, $matches); + + $width = count($matches) !== 3 + ? (int) $parentWidth + : (int) floor($width * $matches[1] / $matches[2]); //@phpstan-ignore-line + + if ($maxWidth > 0) { + $width = min($maxWidth, $width); + } + + $width -= $margins; + $width -= (int) $styles['pl'][$index] + (int) $styles['pr'][$index]; + } + + return $width; + } + + /** + * It trims the text properly ignoring all escape codes and + * `<bg;fg;options>` tags. + */ + private static function trimText(string $text, int $width): string + { + preg_match_all(self::STYLING_REGEX, $text, $matches, PREG_OFFSET_CAPTURE); + $text = rtrim(mb_strimwidth(preg_replace(self::STYLING_REGEX, '', $text) ?? '', 0, $width, '', 'UTF-8')); + + foreach ($matches[0] ?? [] as [$part, $index]) { + $text = substr($text, 0, $index).$part.substr($text, $index, null); + } + + return $text; + } +} diff --git a/vendor/phar-io/manifest/.php-cs-fixer.dist.php b/vendor/phar-io/manifest/.php-cs-fixer.dist.php new file mode 100644 index 00000000..ca965141 --- /dev/null +++ b/vendor/phar-io/manifest/.php-cs-fixer.dist.php @@ -0,0 +1,223 @@ +<?php + +require __DIR__ . '/tools/php-cs-fixer.d/PhpdocSingleLineVarFixer.php'; + +$header = file_get_contents(__DIR__ . '/tools/php-cs-fixer.d/header.txt'); + +return (new PhpCsFixer\Config()) + ->registerCustomFixers([ + new \PharIo\CSFixer\PhpdocSingleLineVarFixer() + ]) + ->setRiskyAllowed(true) + ->setRules( + [ + 'PharIo/phpdoc_single_line_var_fixer' => true, + + 'align_multiline_comment' => true, + 'array_indentation' => true, + 'array_syntax' => ['syntax' => 'short'], + 'binary_operator_spaces' => [ + 'operators' => [ + '=' => 'align', + '=>' => 'align', + ], + ], + 'blank_line_after_namespace' => true, + 'blank_line_after_opening_tag' => false, + 'blank_line_before_statement' => [ + 'statements' => [ + 'break', + 'continue', + 'declare', + 'do', + 'for', + 'foreach', + 'if', + 'include', + 'include_once', + 'require', + 'require_once', + 'return', + 'switch', + 'throw', + 'try', + 'while', + 'yield', + ], + ], + 'braces' => [ + 'allow_single_line_closure' => false, + 'position_after_anonymous_constructs' => 'same', + 'position_after_control_structures' => 'same', + 'position_after_functions_and_oop_constructs' => 'same' + ], + 'cast_spaces' => ['space' => 'none'], + + // This fixer removes the blank line at class start, no way to disable that, so we disable the fixer :( + //'class_attributes_separation' => ['elements' => ['const', 'method', 'property']], + + 'combine_consecutive_issets' => true, + 'combine_consecutive_unsets' => true, + 'compact_nullable_typehint' => true, + 'concat_space' => ['spacing' => 'one'], + 'date_time_immutable' => true, + 'declare_equal_normalize' => ['space' => 'single'], + 'declare_strict_types' => true, + 'dir_constant' => true, + 'elseif' => true, + 'encoding' => true, + 'full_opening_tag' => true, + 'fully_qualified_strict_types' => true, + 'function_declaration' => [ + 'closure_function_spacing' => 'one' + ], + 'global_namespace_import' => [ + 'import_classes' => true, + 'import_constants' => true, + 'import_functions' => true, + ], + 'header_comment' => ['header' => $header, 'separate' => 'none'], + 'indentation_type' => true, + 'is_null' => true, + 'line_ending' => true, + 'list_syntax' => ['syntax' => 'short'], + 'logical_operators' => true, + 'lowercase_cast' => true, + 'constant_case' => ['case' => 'lower'], + 'lowercase_keywords' => true, + 'lowercase_static_reference' => true, + 'magic_constant_casing' => true, + 'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'], + 'modernize_types_casting' => true, + 'multiline_comment_opening_closing' => true, + 'multiline_whitespace_before_semicolons' => true, + 'new_with_braces' => false, + 'no_alias_functions' => true, + 'no_alternative_syntax' => true, + 'no_blank_lines_after_class_opening' => false, + 'no_blank_lines_after_phpdoc' => true, + 'no_blank_lines_before_namespace' => true, + 'no_closing_tag' => true, + 'no_empty_comment' => true, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_extra_blank_lines' => true, + 'no_homoglyph_names' => true, + 'no_leading_import_slash' => true, + 'no_leading_namespace_whitespace' => true, + 'no_mixed_echo_print' => ['use' => 'print'], + 'no_multiline_whitespace_around_double_arrow' => true, + 'no_null_property_initialization' => true, + 'no_php4_constructor' => true, + 'no_short_bool_cast' => true, + 'echo_tag_syntax' => ['format' => 'long'], + 'no_singleline_whitespace_before_semicolons' => true, + 'no_spaces_after_function_name' => true, + 'no_spaces_inside_parenthesis' => true, + 'no_superfluous_elseif' => true, + 'no_superfluous_phpdoc_tags' => true, + 'no_trailing_comma_in_list_call' => true, + 'no_trailing_comma_in_singleline_array' => true, + 'no_trailing_whitespace' => true, + 'no_trailing_whitespace_in_comment' => true, + 'no_unneeded_control_parentheses' => false, + 'no_unneeded_curly_braces' => false, + 'no_unneeded_final_method' => true, + 'no_unreachable_default_argument_value' => true, + 'no_unset_on_property' => true, + 'no_unused_imports' => true, + 'no_useless_else' => true, + 'no_useless_return' => true, + 'no_whitespace_before_comma_in_array' => true, + 'no_whitespace_in_blank_line' => true, + 'non_printable_character' => true, + 'normalize_index_brace' => true, + 'object_operator_without_whitespace' => true, + 'ordered_class_elements' => [ + 'order' => [ + 'use_trait', + 'constant_public', + 'constant_protected', + 'constant_private', + 'property_public_static', + 'property_protected_static', + 'property_private_static', + 'property_public', + 'property_protected', + 'property_private', + 'method_public_static', + 'construct', + 'destruct', + 'magic', + 'phpunit', + 'method_public', + 'method_protected', + 'method_private', + 'method_protected_static', + 'method_private_static', + ], + ], + 'ordered_imports' => [ + 'imports_order' => [ + PhpCsFixer\Fixer\Import\OrderedImportsFixer::IMPORT_TYPE_CLASS, + PhpCsFixer\Fixer\Import\OrderedImportsFixer::IMPORT_TYPE_CONST, + PhpCsFixer\Fixer\Import\OrderedImportsFixer::IMPORT_TYPE_FUNCTION, + ] + ], + 'phpdoc_add_missing_param_annotation' => true, + 'phpdoc_align' => true, + 'phpdoc_annotation_without_dot' => true, + 'phpdoc_indent' => true, + 'phpdoc_no_access' => true, + 'phpdoc_no_empty_return' => true, + 'phpdoc_no_package' => true, + 'phpdoc_order' => true, + 'phpdoc_return_self_reference' => true, + 'phpdoc_scalar' => true, + 'phpdoc_separation' => true, + 'phpdoc_single_line_var_spacing' => true, + 'phpdoc_to_comment' => true, + 'phpdoc_trim' => true, + 'phpdoc_trim_consecutive_blank_line_separation' => true, + 'phpdoc_types' => ['groups' => ['simple', 'meta']], + 'phpdoc_types_order' => true, + 'phpdoc_to_return_type' => true, + 'phpdoc_var_without_name' => true, + 'pow_to_exponentiation' => true, + 'protected_to_private' => true, + 'return_assignment' => true, + 'return_type_declaration' => ['space_before' => 'none'], + 'self_accessor' => false, + 'semicolon_after_instruction' => true, + 'set_type_to_cast' => true, + 'short_scalar_cast' => true, + 'simplified_null_return' => true, + 'single_blank_line_at_eof' => true, + 'single_import_per_statement' => true, + 'single_line_after_imports' => true, + 'single_quote' => true, + 'standardize_not_equals' => true, + 'ternary_to_null_coalescing' => true, + 'trailing_comma_in_multiline' => false, + 'trim_array_spaces' => true, + 'unary_operator_spaces' => true, + 'visibility_required' => [ + 'elements' => [ + 'const', + 'method', + 'property', + ], + ], + 'void_return' => true, + 'whitespace_after_comma_in_array' => true, + 'yoda_style' => false + ] + ) + ->setFinder( + PhpCsFixer\Finder::create() + ->files() + ->in(__DIR__ . '/build') + ->in(__DIR__ . '/src') + ->in(__DIR__ . '/tests') + ->notName('autoload.php') + ); diff --git a/vendor/phar-io/manifest/CHANGELOG.md b/vendor/phar-io/manifest/CHANGELOG.md new file mode 100644 index 00000000..f363b169 --- /dev/null +++ b/vendor/phar-io/manifest/CHANGELOG.md @@ -0,0 +1,45 @@ +# Changelog + +All notable changes to phar-io/manifest are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. + +## [2.0.4] - 03-03-2024 + +### Changed + +- Make `EMail` an optional attribute for author +- Stick with PHP 7.2 compatibilty +- Do not use implict nullable type (thanks @sebastianbergmann), this should make things work on PHP 8.4 + +## [2.0.3] - 20.07.2021 + +- Fixed PHP 7.2 / PHP 7.3 incompatibility introduced in previous release + +## [2.0.2] - 20.07.2021 + +- Fixed PHP 8.1 deprecation notice + +## [2.0.1] - 27.06.2020 + +This release now supports the use of PHP 7.2+ and ^8.0 + +## [2.0.0] - 10.05.2020 + +This release now requires PHP 7.2+ + +### Changed + +- Upgraded to phar-io/version 3.0 + - Version strings `v1.2.3` will now be converted to valid semantic version strings `1.2.3` + - Abreviated strings like `1.0` will get expaneded to `1.0.0` + +### Unreleased + +[Unreleased]: https://github.com/phar-io/manifest/compare/2.1.0...HEAD +[2.1.0]: https://github.com/phar-io/manifest/compare/2.0.3...2.1.0 +[2.0.3]: https://github.com/phar-io/manifest/compare/2.0.2...2.0.3 +[2.0.2]: https://github.com/phar-io/manifest/compare/2.0.1...2.0.2 +[2.0.1]: https://github.com/phar-io/manifest/compare/2.0.0...2.0.1 +[2.0.0]: https://github.com/phar-io/manifest/compare/1.0.1...2.0.0 +[1.0.3]: https://github.com/phar-io/manifest/compare/1.0.2...1.0.3 +[1.0.2]: https://github.com/phar-io/manifest/compare/1.0.1...1.0.2 +[1.0.1]: https://github.com/phar-io/manifest/compare/1.0.0...1.0.1 diff --git a/vendor/phar-io/manifest/LICENSE b/vendor/phar-io/manifest/LICENSE new file mode 100644 index 00000000..64690cf2 --- /dev/null +++ b/vendor/phar-io/manifest/LICENSE @@ -0,0 +1,31 @@ +Phar.io - Manifest + +Copyright (c) 2016-2019 Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>, and contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Arne Blankerts nor the names of contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT * NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + diff --git a/vendor/phar-io/manifest/README.md b/vendor/phar-io/manifest/README.md new file mode 100644 index 00000000..fae2c9a7 --- /dev/null +++ b/vendor/phar-io/manifest/README.md @@ -0,0 +1,178 @@ +# Manifest + +Component for reading [phar.io](https://phar.io/) manifest information from a [PHP Archive (PHAR)](http://php.net/phar). + +## Installation + +You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/): + + composer require phar-io/manifest + +If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency: + + composer require --dev phar-io/manifest + +## Usage Examples + +### Read from `manifest.xml` +```php +use PharIo\Manifest\ManifestLoader; +use PharIo\Manifest\ManifestSerializer; + +$manifest = ManifestLoader::fromFile('manifest.xml'); + +var_dump($manifest); + +echo (new ManifestSerializer)->serializeToString($manifest); +``` + +<details> + <summary>Output</summary> + +```shell +object(PharIo\Manifest\Manifest)#14 (6) { + ["name":"PharIo\Manifest\Manifest":private]=> + object(PharIo\Manifest\ApplicationName)#10 (1) { + ["name":"PharIo\Manifest\ApplicationName":private]=> + string(12) "some/library" + } + ["version":"PharIo\Manifest\Manifest":private]=> + object(PharIo\Version\Version)#12 (5) { + ["originalVersionString":"PharIo\Version\Version":private]=> + string(5) "1.0.0" + ["major":"PharIo\Version\Version":private]=> + object(PharIo\Version\VersionNumber)#13 (1) { + ["value":"PharIo\Version\VersionNumber":private]=> + int(1) + } + ["minor":"PharIo\Version\Version":private]=> + object(PharIo\Version\VersionNumber)#23 (1) { + ["value":"PharIo\Version\VersionNumber":private]=> + int(0) + } + ["patch":"PharIo\Version\Version":private]=> + object(PharIo\Version\VersionNumber)#22 (1) { + ["value":"PharIo\Version\VersionNumber":private]=> + int(0) + } + ["preReleaseSuffix":"PharIo\Version\Version":private]=> + NULL + } + ["type":"PharIo\Manifest\Manifest":private]=> + object(PharIo\Manifest\Library)#6 (0) { + } + ["copyrightInformation":"PharIo\Manifest\Manifest":private]=> + object(PharIo\Manifest\CopyrightInformation)#19 (2) { + ["authors":"PharIo\Manifest\CopyrightInformation":private]=> + object(PharIo\Manifest\AuthorCollection)#9 (1) { + ["authors":"PharIo\Manifest\AuthorCollection":private]=> + array(1) { + [0]=> + object(PharIo\Manifest\Author)#15 (2) { + ["name":"PharIo\Manifest\Author":private]=> + string(13) "Reiner Zufall" + ["email":"PharIo\Manifest\Author":private]=> + object(PharIo\Manifest\Email)#16 (1) { + ["email":"PharIo\Manifest\Email":private]=> + string(16) "reiner@zufall.de" + } + } + } + } + ["license":"PharIo\Manifest\CopyrightInformation":private]=> + object(PharIo\Manifest\License)#11 (2) { + ["name":"PharIo\Manifest\License":private]=> + string(12) "BSD-3-Clause" + ["url":"PharIo\Manifest\License":private]=> + object(PharIo\Manifest\Url)#18 (1) { + ["url":"PharIo\Manifest\Url":private]=> + string(26) "https://domain.tld/LICENSE" + } + } + } + ["requirements":"PharIo\Manifest\Manifest":private]=> + object(PharIo\Manifest\RequirementCollection)#17 (1) { + ["requirements":"PharIo\Manifest\RequirementCollection":private]=> + array(1) { + [0]=> + object(PharIo\Manifest\PhpVersionRequirement)#20 (1) { + ["versionConstraint":"PharIo\Manifest\PhpVersionRequirement":private]=> + object(PharIo\Version\SpecificMajorAndMinorVersionConstraint)#24 (3) { + ["originalValue":"PharIo\Version\AbstractVersionConstraint":private]=> + string(3) "7.0" + ["major":"PharIo\Version\SpecificMajorAndMinorVersionConstraint":private]=> + int(7) + ["minor":"PharIo\Version\SpecificMajorAndMinorVersionConstraint":private]=> + int(0) + } + } + } + } + ["bundledComponents":"PharIo\Manifest\Manifest":private]=> + object(PharIo\Manifest\BundledComponentCollection)#8 (1) { + ["bundledComponents":"PharIo\Manifest\BundledComponentCollection":private]=> + array(0) { + } + } +} +<?xml version="1.0" encoding="UTF-8"?> +<phar xmlns="https://phar.io/xml/manifest/1.0"> + <contains name="some/library" version="1.0.0" type="library"/> + <copyright> + <author name="Reiner Zufall" email="reiner@zufall.de"/> + <license type="BSD-3-Clause" url="https://domain.tld/LICENSE"/> + </copyright> + <requires> + <php version="7.0"/> + </requires> +</phar> +``` +</details> + +### Create via API +```php +$bundled = new \PharIo\Manifest\BundledComponentCollection(); +$bundled->add( + new \PharIo\Manifest\BundledComponent('vendor/packageA', new \PharIo\Version\Version('1.2.3-dev') + ) +); + +$manifest = new PharIo\Manifest\Manifest( + new \PharIo\Manifest\ApplicationName('vendor/package'), + new \PharIo\Version\Version('1.0.0'), + new \PharIo\Manifest\Library(), + new \PharIo\Manifest\CopyrightInformation( + new \PharIo\Manifest\AuthorCollection(), + new \PharIo\Manifest\License( + 'BSD-3-Clause', + new \PharIo\Manifest\Url('https://spdx.org/licenses/BSD-3-Clause.html') + ) + ), + new \PharIo\Manifest\RequirementCollection(), + $bundled +); + +echo (new ManifestSerializer)->serializeToString($manifest); +``` + +<details> + <summary>Output</summary> + +```xml +<?xml version="1.0" encoding="UTF-8"?> +<phar xmlns="https://phar.io/xml/manifest/1.0"> + <contains name="vendor/package" version="1.0.0" type="library"/> + <copyright> + <license type="BSD-3-Clause" url="https://spdx.org/licenses/BSD-3-Clause.html"/> + </copyright> + <requires> + <php version="*"/> + </requires> + <bundles> + <component name="vendor/packageA" version="1.2.3-dev"/> + </bundles> +</phar> +``` + +</details> + diff --git a/vendor/phar-io/manifest/composer.json b/vendor/phar-io/manifest/composer.json new file mode 100644 index 00000000..dc5fa458 --- /dev/null +++ b/vendor/phar-io/manifest/composer.json @@ -0,0 +1,43 @@ +{ + "name": "phar-io/manifest", + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "support": { + "issues": "https://github.com/phar-io/manifest/issues" + }, + "require": { + "php": "^7.2 || ^8.0", + "ext-dom": "*", + "ext-phar": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1" + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + } +} diff --git a/vendor/phar-io/manifest/manifest.xsd b/vendor/phar-io/manifest/manifest.xsd new file mode 100644 index 00000000..63e3f1cb --- /dev/null +++ b/vendor/phar-io/manifest/manifest.xsd @@ -0,0 +1,116 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="https://phar.io/xml/manifest/1.0" + xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns="https://phar.io/xml/manifest/1.0"> + + <xs:element name="phar"> + <xs:complexType> + <xs:sequence> + <xs:element ref="ns:contains" maxOccurs="1" /> + <xs:element ref="ns:copyright" maxOccurs="1" /> + <xs:element ref="ns:requires" maxOccurs="1" /> + <xs:element ref="ns:bundles" minOccurs="0" maxOccurs="1" /> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="contains"> + <xs:complexType> + <xs:simpleContent> + <xs:extension base="xs:string"> + <xs:attribute type="xs:string" use="required" name="name"/> + <xs:attribute type="xs:string" use="required" name="version"/> + <xs:attribute use="required" name="type"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:enumeration value="application"/> + <xs:enumeration value="extension"/> + <xs:enumeration value="library"/> + <xs:enumeration value="stub"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + </xs:element> + + <xs:element name="copyright"> + <xs:complexType> + <xs:sequence> + <xs:choice maxOccurs="unbounded"> + <xs:element ref="ns:author" minOccurs="1" maxOccurs="unbounded" /> + </xs:choice> + <xs:element ref="ns:license" minOccurs="1" maxOccurs="1" /> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="author"> + <xs:complexType> + <xs:simpleContent> + <xs:extension base="xs:string"> + <xs:attribute type="xs:string" use="required" name="name"/> + <xs:attribute type="xs:string" use="optional" name="email"/> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + </xs:element> + + <xs:element name="license"> + <xs:complexType> + <xs:simpleContent> + <xs:extension base="xs:string"> + <xs:attribute type="xs:string" use="required" name="type"/> + <xs:attribute type="xs:string" use="required" name="url"/> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + </xs:element> + + <xs:element name="requires"> + <xs:complexType> + <xs:sequence> + <xs:element ref="ns:php" /> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="php"> + <xs:complexType> + <xs:sequence> + <xs:element ref="ns:ext" maxOccurs="unbounded" minOccurs="0" /> + </xs:sequence> + <xs:attribute type="xs:string" use="required" name="version"/> + </xs:complexType> + </xs:element> + + <xs:element name="ext"> + <xs:complexType> + <xs:simpleContent> + <xs:extension base="xs:string"> + <xs:attribute type="xs:string" name="name" use="required" /> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + </xs:element> + + <xs:element name="bundles"> + <xs:complexType> + <xs:sequence> + <xs:element ref="ns:component" maxOccurs="unbounded" minOccurs="0" /> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="component"> + <xs:complexType> + <xs:simpleContent> + <xs:extension base="xs:string"> + <xs:attribute type="xs:string" name="name" use="required"/> + <xs:attribute type="xs:string" name="version" use="required"/> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + </xs:element> + +</xs:schema> diff --git a/vendor/phar-io/manifest/src/ManifestDocumentMapper.php b/vendor/phar-io/manifest/src/ManifestDocumentMapper.php new file mode 100644 index 00000000..3da6403f --- /dev/null +++ b/vendor/phar-io/manifest/src/ManifestDocumentMapper.php @@ -0,0 +1,151 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use PharIo\Version\Exception as VersionException; +use PharIo\Version\Version; +use PharIo\Version\VersionConstraintParser; +use Throwable; +use function sprintf; + +class ManifestDocumentMapper { + public function map(ManifestDocument $document): Manifest { + try { + $contains = $document->getContainsElement(); + $type = $this->mapType($contains); + $copyright = $this->mapCopyright($document->getCopyrightElement()); + $requirements = $this->mapRequirements($document->getRequiresElement()); + $bundledComponents = $this->mapBundledComponents($document); + + return new Manifest( + new ApplicationName($contains->getName()), + new Version($contains->getVersion()), + $type, + $copyright, + $requirements, + $bundledComponents + ); + } catch (Throwable $e) { + throw new ManifestDocumentMapperException($e->getMessage(), (int)$e->getCode(), $e); + } + } + + private function mapType(ContainsElement $contains): Type { + switch ($contains->getType()) { + case 'application': + return Type::application(); + case 'library': + return Type::library(); + case 'extension': + return $this->mapExtension($contains->getExtensionElement()); + } + + throw new ManifestDocumentMapperException( + sprintf('Unsupported type %s', $contains->getType()) + ); + } + + private function mapCopyright(CopyrightElement $copyright): CopyrightInformation { + $authors = new AuthorCollection(); + + foreach ($copyright->getAuthorElements() as $authorElement) { + $authors->add( + new Author( + $authorElement->getName(), + $authorElement->hasEMail() ? new Email($authorElement->getEmail()) : null + ) + ); + } + + $licenseElement = $copyright->getLicenseElement(); + $license = new License( + $licenseElement->getType(), + new Url($licenseElement->getUrl()) + ); + + return new CopyrightInformation( + $authors, + $license + ); + } + + private function mapRequirements(RequiresElement $requires): RequirementCollection { + $collection = new RequirementCollection(); + $phpElement = $requires->getPHPElement(); + $parser = new VersionConstraintParser; + + try { + $versionConstraint = $parser->parse($phpElement->getVersion()); + } catch (VersionException $e) { + throw new ManifestDocumentMapperException( + sprintf('Unsupported version constraint - %s', $e->getMessage()), + (int)$e->getCode(), + $e + ); + } + + $collection->add( + new PhpVersionRequirement( + $versionConstraint + ) + ); + + if (!$phpElement->hasExtElements()) { + return $collection; + } + + foreach ($phpElement->getExtElements() as $extElement) { + $collection->add( + new PhpExtensionRequirement($extElement->getName()) + ); + } + + return $collection; + } + + private function mapBundledComponents(ManifestDocument $document): BundledComponentCollection { + $collection = new BundledComponentCollection(); + + if (!$document->hasBundlesElement()) { + return $collection; + } + + foreach ($document->getBundlesElement()->getComponentElements() as $componentElement) { + $collection->add( + new BundledComponent( + $componentElement->getName(), + new Version( + $componentElement->getVersion() + ) + ) + ); + } + + return $collection; + } + + private function mapExtension(ExtensionElement $extension): Extension { + try { + $versionConstraint = (new VersionConstraintParser)->parse($extension->getCompatible()); + + return Type::extension( + new ApplicationName($extension->getFor()), + $versionConstraint + ); + } catch (VersionException $e) { + throw new ManifestDocumentMapperException( + sprintf('Unsupported version constraint - %s', $e->getMessage()), + (int)$e->getCode(), + $e + ); + } + } +} diff --git a/vendor/phar-io/manifest/src/ManifestLoader.php b/vendor/phar-io/manifest/src/ManifestLoader.php new file mode 100644 index 00000000..f467d2d3 --- /dev/null +++ b/vendor/phar-io/manifest/src/ManifestLoader.php @@ -0,0 +1,47 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use function sprintf; + +class ManifestLoader { + public static function fromFile(string $filename): Manifest { + try { + return (new ManifestDocumentMapper())->map( + ManifestDocument::fromFile($filename) + ); + } catch (Exception $e) { + throw new ManifestLoaderException( + sprintf('Loading %s failed.', $filename), + (int)$e->getCode(), + $e + ); + } + } + + public static function fromPhar(string $filename): Manifest { + return self::fromFile('phar://' . $filename . '/manifest.xml'); + } + + public static function fromString(string $manifest): Manifest { + try { + return (new ManifestDocumentMapper())->map( + ManifestDocument::fromString($manifest) + ); + } catch (Exception $e) { + throw new ManifestLoaderException( + 'Processing string failed', + (int)$e->getCode(), + $e + ); + } + } +} diff --git a/vendor/phar-io/manifest/src/ManifestSerializer.php b/vendor/phar-io/manifest/src/ManifestSerializer.php new file mode 100644 index 00000000..48b8efdd --- /dev/null +++ b/vendor/phar-io/manifest/src/ManifestSerializer.php @@ -0,0 +1,172 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use PharIo\Version\AnyVersionConstraint; +use PharIo\Version\Version; +use PharIo\Version\VersionConstraint; +use XMLWriter; +use function count; +use function file_put_contents; +use function str_repeat; + +/** @psalm-suppress MissingConstructor */ +class ManifestSerializer { + /** @var XMLWriter */ + private $xmlWriter; + + public function serializeToFile(Manifest $manifest, string $filename): void { + file_put_contents( + $filename, + $this->serializeToString($manifest) + ); + } + + public function serializeToString(Manifest $manifest): string { + $this->startDocument(); + + $this->addContains($manifest->getName(), $manifest->getVersion(), $manifest->getType()); + $this->addCopyright($manifest->getCopyrightInformation()); + $this->addRequirements($manifest->getRequirements()); + $this->addBundles($manifest->getBundledComponents()); + + return $this->finishDocument(); + } + + private function startDocument(): void { + $xmlWriter = new XMLWriter(); + $xmlWriter->openMemory(); + $xmlWriter->setIndent(true); + $xmlWriter->setIndentString(str_repeat(' ', 4)); + $xmlWriter->startDocument('1.0', 'UTF-8'); + $xmlWriter->startElement('phar'); + $xmlWriter->writeAttribute('xmlns', 'https://phar.io/xml/manifest/1.0'); + + $this->xmlWriter = $xmlWriter; + } + + private function finishDocument(): string { + $this->xmlWriter->endElement(); + $this->xmlWriter->endDocument(); + + return $this->xmlWriter->outputMemory(); + } + + private function addContains(ApplicationName $name, Version $version, Type $type): void { + $this->xmlWriter->startElement('contains'); + $this->xmlWriter->writeAttribute('name', $name->asString()); + $this->xmlWriter->writeAttribute('version', $version->getVersionString()); + + switch (true) { + case $type->isApplication(): { + $this->xmlWriter->writeAttribute('type', 'application'); + + break; + } + + case $type->isLibrary(): { + $this->xmlWriter->writeAttribute('type', 'library'); + + break; + } + + case $type->isExtension(): { + $this->xmlWriter->writeAttribute('type', 'extension'); + /* @var $type Extension */ + $this->addExtension( + $type->getApplicationName(), + $type->getVersionConstraint() + ); + + break; + } + + default: { + $this->xmlWriter->writeAttribute('type', 'custom'); + } + } + + $this->xmlWriter->endElement(); + } + + private function addCopyright(CopyrightInformation $copyrightInformation): void { + $this->xmlWriter->startElement('copyright'); + + foreach ($copyrightInformation->getAuthors() as $author) { + $this->xmlWriter->startElement('author'); + $this->xmlWriter->writeAttribute('name', $author->getName()); + $this->xmlWriter->writeAttribute('email', $author->getEmail()->asString()); + $this->xmlWriter->endElement(); + } + + $license = $copyrightInformation->getLicense(); + + $this->xmlWriter->startElement('license'); + $this->xmlWriter->writeAttribute('type', $license->getName()); + $this->xmlWriter->writeAttribute('url', $license->getUrl()->asString()); + $this->xmlWriter->endElement(); + + $this->xmlWriter->endElement(); + } + + private function addRequirements(RequirementCollection $requirementCollection): void { + $phpRequirement = new AnyVersionConstraint(); + $extensions = []; + + foreach ($requirementCollection as $requirement) { + if ($requirement instanceof PhpVersionRequirement) { + $phpRequirement = $requirement->getVersionConstraint(); + + continue; + } + + if ($requirement instanceof PhpExtensionRequirement) { + $extensions[] = $requirement->asString(); + } + } + + $this->xmlWriter->startElement('requires'); + $this->xmlWriter->startElement('php'); + $this->xmlWriter->writeAttribute('version', $phpRequirement->asString()); + + foreach ($extensions as $extension) { + $this->xmlWriter->startElement('ext'); + $this->xmlWriter->writeAttribute('name', $extension); + $this->xmlWriter->endElement(); + } + + $this->xmlWriter->endElement(); + $this->xmlWriter->endElement(); + } + + private function addBundles(BundledComponentCollection $bundledComponentCollection): void { + if (count($bundledComponentCollection) === 0) { + return; + } + $this->xmlWriter->startElement('bundles'); + + foreach ($bundledComponentCollection as $bundledComponent) { + $this->xmlWriter->startElement('component'); + $this->xmlWriter->writeAttribute('name', $bundledComponent->getName()); + $this->xmlWriter->writeAttribute('version', $bundledComponent->getVersion()->getVersionString()); + $this->xmlWriter->endElement(); + } + + $this->xmlWriter->endElement(); + } + + private function addExtension(ApplicationName $applicationName, VersionConstraint $versionConstraint): void { + $this->xmlWriter->startElement('extension'); + $this->xmlWriter->writeAttribute('for', $applicationName->asString()); + $this->xmlWriter->writeAttribute('compatible', $versionConstraint->asString()); + $this->xmlWriter->endElement(); + } +} diff --git a/vendor/phar-io/manifest/src/exceptions/ElementCollectionException.php b/vendor/phar-io/manifest/src/exceptions/ElementCollectionException.php new file mode 100644 index 00000000..7528afc8 --- /dev/null +++ b/vendor/phar-io/manifest/src/exceptions/ElementCollectionException.php @@ -0,0 +1,16 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use InvalidArgumentException; + +class ElementCollectionException extends InvalidArgumentException implements Exception { +} diff --git a/vendor/phar-io/manifest/src/exceptions/Exception.php b/vendor/phar-io/manifest/src/exceptions/Exception.php new file mode 100644 index 00000000..0c135d3c --- /dev/null +++ b/vendor/phar-io/manifest/src/exceptions/Exception.php @@ -0,0 +1,16 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use Throwable; + +interface Exception extends Throwable { +} diff --git a/vendor/phar-io/manifest/src/exceptions/InvalidApplicationNameException.php b/vendor/phar-io/manifest/src/exceptions/InvalidApplicationNameException.php new file mode 100644 index 00000000..ecfe5142 --- /dev/null +++ b/vendor/phar-io/manifest/src/exceptions/InvalidApplicationNameException.php @@ -0,0 +1,17 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use InvalidArgumentException; + +class InvalidApplicationNameException extends InvalidArgumentException implements Exception { + public const InvalidFormat = 2; +} diff --git a/vendor/phar-io/manifest/src/exceptions/InvalidEmailException.php b/vendor/phar-io/manifest/src/exceptions/InvalidEmailException.php new file mode 100644 index 00000000..24240551 --- /dev/null +++ b/vendor/phar-io/manifest/src/exceptions/InvalidEmailException.php @@ -0,0 +1,16 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use InvalidArgumentException; + +class InvalidEmailException extends InvalidArgumentException implements Exception { +} diff --git a/vendor/phar-io/manifest/src/exceptions/InvalidUrlException.php b/vendor/phar-io/manifest/src/exceptions/InvalidUrlException.php new file mode 100644 index 00000000..c8b192b1 --- /dev/null +++ b/vendor/phar-io/manifest/src/exceptions/InvalidUrlException.php @@ -0,0 +1,16 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use InvalidArgumentException; + +class InvalidUrlException extends InvalidArgumentException implements Exception { +} diff --git a/vendor/phar-io/manifest/src/exceptions/ManifestDocumentException.php b/vendor/phar-io/manifest/src/exceptions/ManifestDocumentException.php new file mode 100644 index 00000000..0a158e6e --- /dev/null +++ b/vendor/phar-io/manifest/src/exceptions/ManifestDocumentException.php @@ -0,0 +1,16 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use RuntimeException; + +class ManifestDocumentException extends RuntimeException implements Exception { +} diff --git a/vendor/phar-io/manifest/src/exceptions/ManifestDocumentLoadingException.php b/vendor/phar-io/manifest/src/exceptions/ManifestDocumentLoadingException.php new file mode 100644 index 00000000..816af120 --- /dev/null +++ b/vendor/phar-io/manifest/src/exceptions/ManifestDocumentLoadingException.php @@ -0,0 +1,47 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use LibXMLError; +use function sprintf; + +class ManifestDocumentLoadingException extends \Exception implements Exception { + /** @var LibXMLError[] */ + private $libxmlErrors; + + /** + * ManifestDocumentLoadingException constructor. + * + * @param LibXMLError[] $libxmlErrors + */ + public function __construct(array $libxmlErrors) { + $this->libxmlErrors = $libxmlErrors; + $first = $this->libxmlErrors[0]; + + parent::__construct( + sprintf( + '%s (Line: %d / Column: %d / File: %s)', + $first->message, + $first->line, + $first->column, + $first->file + ), + $first->code + ); + } + + /** + * @return LibXMLError[] + */ + public function getLibxmlErrors(): array { + return $this->libxmlErrors; + } +} diff --git a/vendor/phar-io/manifest/src/exceptions/ManifestDocumentMapperException.php b/vendor/phar-io/manifest/src/exceptions/ManifestDocumentMapperException.php new file mode 100644 index 00000000..0d1a5f5a --- /dev/null +++ b/vendor/phar-io/manifest/src/exceptions/ManifestDocumentMapperException.php @@ -0,0 +1,16 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use RuntimeException; + +class ManifestDocumentMapperException extends RuntimeException implements Exception { +} diff --git a/vendor/phar-io/manifest/src/exceptions/ManifestElementException.php b/vendor/phar-io/manifest/src/exceptions/ManifestElementException.php new file mode 100644 index 00000000..46f82e32 --- /dev/null +++ b/vendor/phar-io/manifest/src/exceptions/ManifestElementException.php @@ -0,0 +1,16 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use RuntimeException; + +class ManifestElementException extends RuntimeException implements Exception { +} diff --git a/vendor/phar-io/manifest/src/exceptions/ManifestLoaderException.php b/vendor/phar-io/manifest/src/exceptions/ManifestLoaderException.php new file mode 100644 index 00000000..d00ed190 --- /dev/null +++ b/vendor/phar-io/manifest/src/exceptions/ManifestLoaderException.php @@ -0,0 +1,14 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +class ManifestLoaderException extends \Exception implements Exception { +} diff --git a/vendor/phar-io/manifest/src/exceptions/NoEmailAddressException.php b/vendor/phar-io/manifest/src/exceptions/NoEmailAddressException.php new file mode 100644 index 00000000..27913126 --- /dev/null +++ b/vendor/phar-io/manifest/src/exceptions/NoEmailAddressException.php @@ -0,0 +1,16 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use InvalidArgumentException; + +class NoEmailAddressException extends InvalidArgumentException implements Exception { +} diff --git a/vendor/phar-io/manifest/src/values/Application.php b/vendor/phar-io/manifest/src/values/Application.php new file mode 100644 index 00000000..11a44d9c --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Application.php @@ -0,0 +1,17 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +class Application extends Type { + public function isApplication(): bool { + return true; + } +} diff --git a/vendor/phar-io/manifest/src/values/ApplicationName.php b/vendor/phar-io/manifest/src/values/ApplicationName.php new file mode 100644 index 00000000..1a0ad1e2 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/ApplicationName.php @@ -0,0 +1,41 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use function preg_match; +use function sprintf; + +class ApplicationName { + /** @var string */ + private $name; + + public function __construct(string $name) { + $this->ensureValidFormat($name); + $this->name = $name; + } + + public function asString(): string { + return $this->name; + } + + public function isEqual(ApplicationName $name): bool { + return $this->name === $name->name; + } + + private function ensureValidFormat(string $name): void { + if (!preg_match('#\w/\w#', $name)) { + throw new InvalidApplicationNameException( + sprintf('Format of name "%s" is not valid - expected: vendor/packagename', $name), + InvalidApplicationNameException::InvalidFormat + ); + } + } +} diff --git a/vendor/phar-io/manifest/src/values/Author.php b/vendor/phar-io/manifest/src/values/Author.php new file mode 100644 index 00000000..7b243aac --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Author.php @@ -0,0 +1,57 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use function sprintf; + +class Author { + /** @var string */ + private $name; + + /** @var null|Email */ + private $email; + + public function __construct(string $name, ?Email $email = null) { + $this->name = $name; + $this->email = $email; + } + + public function asString(): string { + if (!$this->hasEmail()) { + return $this->name; + } + + return sprintf( + '%s <%s>', + $this->name, + $this->email->asString() + ); + } + + public function getName(): string { + return $this->name; + } + + /** + * @psalm-assert-if-true Email $this->email + */ + public function hasEmail(): bool { + return $this->email !== null; + } + + public function getEmail(): Email { + if (!$this->hasEmail()) { + throw new NoEmailAddressException(); + } + + return $this->email; + } +} diff --git a/vendor/phar-io/manifest/src/values/AuthorCollection.php b/vendor/phar-io/manifest/src/values/AuthorCollection.php new file mode 100644 index 00000000..549876da --- /dev/null +++ b/vendor/phar-io/manifest/src/values/AuthorCollection.php @@ -0,0 +1,40 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use Countable; +use IteratorAggregate; +use function count; + +/** @template-implements IteratorAggregate<int,Author> */ +class AuthorCollection implements Countable, IteratorAggregate { + /** @var Author[] */ + private $authors = []; + + public function add(Author $author): void { + $this->authors[] = $author; + } + + /** + * @return Author[] + */ + public function getAuthors(): array { + return $this->authors; + } + + public function count(): int { + return count($this->authors); + } + + public function getIterator(): AuthorCollectionIterator { + return new AuthorCollectionIterator($this); + } +} diff --git a/vendor/phar-io/manifest/src/values/AuthorCollectionIterator.php b/vendor/phar-io/manifest/src/values/AuthorCollectionIterator.php new file mode 100644 index 00000000..36fee9f7 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/AuthorCollectionIterator.php @@ -0,0 +1,47 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use Iterator; +use function count; + +/** @template-implements Iterator<int,Author> */ +class AuthorCollectionIterator implements Iterator { + /** @var Author[] */ + private $authors; + + /** @var int */ + private $position = 0; + + public function __construct(AuthorCollection $authors) { + $this->authors = $authors->getAuthors(); + } + + public function rewind(): void { + $this->position = 0; + } + + public function valid(): bool { + return $this->position < count($this->authors); + } + + public function key(): int { + return $this->position; + } + + public function current(): Author { + return $this->authors[$this->position]; + } + + public function next(): void { + $this->position++; + } +} diff --git a/vendor/phar-io/manifest/src/values/BundledComponent.php b/vendor/phar-io/manifest/src/values/BundledComponent.php new file mode 100644 index 00000000..58170368 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/BundledComponent.php @@ -0,0 +1,34 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use PharIo\Version\Version; + +class BundledComponent { + /** @var string */ + private $name; + + /** @var Version */ + private $version; + + public function __construct(string $name, Version $version) { + $this->name = $name; + $this->version = $version; + } + + public function getName(): string { + return $this->name; + } + + public function getVersion(): Version { + return $this->version; + } +} diff --git a/vendor/phar-io/manifest/src/values/BundledComponentCollection.php b/vendor/phar-io/manifest/src/values/BundledComponentCollection.php new file mode 100644 index 00000000..28aaa06c --- /dev/null +++ b/vendor/phar-io/manifest/src/values/BundledComponentCollection.php @@ -0,0 +1,40 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use Countable; +use IteratorAggregate; +use function count; + +/** @template-implements IteratorAggregate<int,BundledComponent> */ +class BundledComponentCollection implements Countable, IteratorAggregate { + /** @var BundledComponent[] */ + private $bundledComponents = []; + + public function add(BundledComponent $bundledComponent): void { + $this->bundledComponents[] = $bundledComponent; + } + + /** + * @return BundledComponent[] + */ + public function getBundledComponents(): array { + return $this->bundledComponents; + } + + public function count(): int { + return count($this->bundledComponents); + } + + public function getIterator(): BundledComponentCollectionIterator { + return new BundledComponentCollectionIterator($this); + } +} diff --git a/vendor/phar-io/manifest/src/values/BundledComponentCollectionIterator.php b/vendor/phar-io/manifest/src/values/BundledComponentCollectionIterator.php new file mode 100644 index 00000000..5c72817d --- /dev/null +++ b/vendor/phar-io/manifest/src/values/BundledComponentCollectionIterator.php @@ -0,0 +1,47 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use Iterator; +use function count; + +/** @template-implements Iterator<int,BundledComponent> */ +class BundledComponentCollectionIterator implements Iterator { + /** @var BundledComponent[] */ + private $bundledComponents; + + /** @var int */ + private $position = 0; + + public function __construct(BundledComponentCollection $bundledComponents) { + $this->bundledComponents = $bundledComponents->getBundledComponents(); + } + + public function rewind(): void { + $this->position = 0; + } + + public function valid(): bool { + return $this->position < count($this->bundledComponents); + } + + public function key(): int { + return $this->position; + } + + public function current(): BundledComponent { + return $this->bundledComponents[$this->position]; + } + + public function next(): void { + $this->position++; + } +} diff --git a/vendor/phar-io/manifest/src/values/CopyrightInformation.php b/vendor/phar-io/manifest/src/values/CopyrightInformation.php new file mode 100644 index 00000000..b4468ed7 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/CopyrightInformation.php @@ -0,0 +1,32 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +class CopyrightInformation { + /** @var AuthorCollection */ + private $authors; + + /** @var License */ + private $license; + + public function __construct(AuthorCollection $authors, License $license) { + $this->authors = $authors; + $this->license = $license; + } + + public function getAuthors(): AuthorCollection { + return $this->authors; + } + + public function getLicense(): License { + return $this->license; + } +} diff --git a/vendor/phar-io/manifest/src/values/Email.php b/vendor/phar-io/manifest/src/values/Email.php new file mode 100644 index 00000000..dbaff84a --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Email.php @@ -0,0 +1,35 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use const FILTER_VALIDATE_EMAIL; +use function filter_var; + +class Email { + /** @var string */ + private $email; + + public function __construct(string $email) { + $this->ensureEmailIsValid($email); + + $this->email = $email; + } + + public function asString(): string { + return $this->email; + } + + private function ensureEmailIsValid(string $url): void { + if (filter_var($url, FILTER_VALIDATE_EMAIL) === false) { + throw new InvalidEmailException; + } + } +} diff --git a/vendor/phar-io/manifest/src/values/Extension.php b/vendor/phar-io/manifest/src/values/Extension.php new file mode 100644 index 00000000..abcd2f89 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Extension.php @@ -0,0 +1,47 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use PharIo\Version\Version; +use PharIo\Version\VersionConstraint; + +class Extension extends Type { + /** @var ApplicationName */ + private $application; + + /** @var VersionConstraint */ + private $versionConstraint; + + public function __construct(ApplicationName $application, VersionConstraint $versionConstraint) { + $this->application = $application; + $this->versionConstraint = $versionConstraint; + } + + public function getApplicationName(): ApplicationName { + return $this->application; + } + + public function getVersionConstraint(): VersionConstraint { + return $this->versionConstraint; + } + + public function isExtension(): bool { + return true; + } + + public function isExtensionFor(ApplicationName $name): bool { + return $this->application->isEqual($name); + } + + public function isCompatibleWith(ApplicationName $name, Version $version): bool { + return $this->isExtensionFor($name) && $this->versionConstraint->complies($version); + } +} diff --git a/vendor/phar-io/manifest/src/values/Library.php b/vendor/phar-io/manifest/src/values/Library.php new file mode 100644 index 00000000..97c292dc --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Library.php @@ -0,0 +1,17 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +class Library extends Type { + public function isLibrary(): bool { + return true; + } +} diff --git a/vendor/phar-io/manifest/src/values/License.php b/vendor/phar-io/manifest/src/values/License.php new file mode 100644 index 00000000..c2d94299 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/License.php @@ -0,0 +1,32 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +class License { + /** @var string */ + private $name; + + /** @var Url */ + private $url; + + public function __construct(string $name, Url $url) { + $this->name = $name; + $this->url = $url; + } + + public function getName(): string { + return $this->name; + } + + public function getUrl(): Url { + return $this->url; + } +} diff --git a/vendor/phar-io/manifest/src/values/Manifest.php b/vendor/phar-io/manifest/src/values/Manifest.php new file mode 100644 index 00000000..36466820 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Manifest.php @@ -0,0 +1,93 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use PharIo\Version\Version; + +class Manifest { + /** @var ApplicationName */ + private $name; + + /** @var Version */ + private $version; + + /** @var Type */ + private $type; + + /** @var CopyrightInformation */ + private $copyrightInformation; + + /** @var RequirementCollection */ + private $requirements; + + /** @var BundledComponentCollection */ + private $bundledComponents; + + public function __construct(ApplicationName $name, Version $version, Type $type, CopyrightInformation $copyrightInformation, RequirementCollection $requirements, BundledComponentCollection $bundledComponents) { + $this->name = $name; + $this->version = $version; + $this->type = $type; + $this->copyrightInformation = $copyrightInformation; + $this->requirements = $requirements; + $this->bundledComponents = $bundledComponents; + } + + public function getName(): ApplicationName { + return $this->name; + } + + public function getVersion(): Version { + return $this->version; + } + + public function getType(): Type { + return $this->type; + } + + public function getCopyrightInformation(): CopyrightInformation { + return $this->copyrightInformation; + } + + public function getRequirements(): RequirementCollection { + return $this->requirements; + } + + public function getBundledComponents(): BundledComponentCollection { + return $this->bundledComponents; + } + + public function isApplication(): bool { + return $this->type->isApplication(); + } + + public function isLibrary(): bool { + return $this->type->isLibrary(); + } + + public function isExtension(): bool { + return $this->type->isExtension(); + } + + public function isExtensionFor(ApplicationName $application, ?Version $version = null): bool { + if (!$this->isExtension()) { + return false; + } + + /** @var Extension $type */ + $type = $this->type; + + if ($version !== null) { + return $type->isCompatibleWith($application, $version); + } + + return $type->isExtensionFor($application); + } +} diff --git a/vendor/phar-io/manifest/src/values/PhpExtensionRequirement.php b/vendor/phar-io/manifest/src/values/PhpExtensionRequirement.php new file mode 100644 index 00000000..f81bd259 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/PhpExtensionRequirement.php @@ -0,0 +1,24 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +class PhpExtensionRequirement implements Requirement { + /** @var string */ + private $extension; + + public function __construct(string $extension) { + $this->extension = $extension; + } + + public function asString(): string { + return $this->extension; + } +} diff --git a/vendor/phar-io/manifest/src/values/PhpVersionRequirement.php b/vendor/phar-io/manifest/src/values/PhpVersionRequirement.php new file mode 100644 index 00000000..fb30c3b8 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/PhpVersionRequirement.php @@ -0,0 +1,26 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use PharIo\Version\VersionConstraint; + +class PhpVersionRequirement implements Requirement { + /** @var VersionConstraint */ + private $versionConstraint; + + public function __construct(VersionConstraint $versionConstraint) { + $this->versionConstraint = $versionConstraint; + } + + public function getVersionConstraint(): VersionConstraint { + return $this->versionConstraint; + } +} diff --git a/vendor/phar-io/manifest/src/values/Requirement.php b/vendor/phar-io/manifest/src/values/Requirement.php new file mode 100644 index 00000000..d4b46401 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Requirement.php @@ -0,0 +1,14 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +interface Requirement { +} diff --git a/vendor/phar-io/manifest/src/values/RequirementCollection.php b/vendor/phar-io/manifest/src/values/RequirementCollection.php new file mode 100644 index 00000000..e4fe2a11 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/RequirementCollection.php @@ -0,0 +1,40 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use Countable; +use IteratorAggregate; +use function count; + +/** @template-implements IteratorAggregate<int,Requirement> */ +class RequirementCollection implements Countable, IteratorAggregate { + /** @var Requirement[] */ + private $requirements = []; + + public function add(Requirement $requirement): void { + $this->requirements[] = $requirement; + } + + /** + * @return Requirement[] + */ + public function getRequirements(): array { + return $this->requirements; + } + + public function count(): int { + return count($this->requirements); + } + + public function getIterator(): RequirementCollectionIterator { + return new RequirementCollectionIterator($this); + } +} diff --git a/vendor/phar-io/manifest/src/values/RequirementCollectionIterator.php b/vendor/phar-io/manifest/src/values/RequirementCollectionIterator.php new file mode 100644 index 00000000..a587468c --- /dev/null +++ b/vendor/phar-io/manifest/src/values/RequirementCollectionIterator.php @@ -0,0 +1,47 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use Iterator; +use function count; + +/** @template-implements Iterator<int,Requirement> */ +class RequirementCollectionIterator implements Iterator { + /** @var Requirement[] */ + private $requirements; + + /** @var int */ + private $position = 0; + + public function __construct(RequirementCollection $requirements) { + $this->requirements = $requirements->getRequirements(); + } + + public function rewind(): void { + $this->position = 0; + } + + public function valid(): bool { + return $this->position < count($this->requirements); + } + + public function key(): int { + return $this->position; + } + + public function current(): Requirement { + return $this->requirements[$this->position]; + } + + public function next(): void { + $this->position++; + } +} diff --git a/vendor/phar-io/manifest/src/values/Type.php b/vendor/phar-io/manifest/src/values/Type.php new file mode 100644 index 00000000..231e7fd9 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Type.php @@ -0,0 +1,42 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use PharIo\Version\VersionConstraint; + +abstract class Type { + public static function application(): Application { + return new Application; + } + + public static function library(): Library { + return new Library; + } + + public static function extension(ApplicationName $application, VersionConstraint $versionConstraint): Extension { + return new Extension($application, $versionConstraint); + } + + /** @psalm-assert-if-true Application $this */ + public function isApplication(): bool { + return false; + } + + /** @psalm-assert-if-true Library $this */ + public function isLibrary(): bool { + return false; + } + + /** @psalm-assert-if-true Extension $this */ + public function isExtension(): bool { + return false; + } +} diff --git a/vendor/phar-io/manifest/src/values/Url.php b/vendor/phar-io/manifest/src/values/Url.php new file mode 100644 index 00000000..98061554 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Url.php @@ -0,0 +1,38 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use const FILTER_VALIDATE_URL; +use function filter_var; + +class Url { + /** @var string */ + private $url; + + public function __construct(string $url) { + $this->ensureUrlIsValid($url); + + $this->url = $url; + } + + public function asString(): string { + return $this->url; + } + + /** + * @throws InvalidUrlException + */ + private function ensureUrlIsValid(string $url): void { + if (filter_var($url, FILTER_VALIDATE_URL) === false) { + throw new InvalidUrlException; + } + } +} diff --git a/vendor/phar-io/manifest/src/xml/AuthorElement.php b/vendor/phar-io/manifest/src/xml/AuthorElement.php new file mode 100644 index 00000000..b33eb3ca --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/AuthorElement.php @@ -0,0 +1,25 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +class AuthorElement extends ManifestElement { + public function getName(): string { + return $this->getAttributeValue('name'); + } + + public function getEmail(): string { + return $this->getAttributeValue('email'); + } + + public function hasEMail(): bool { + return $this->hasAttribute('email'); + } +} diff --git a/vendor/phar-io/manifest/src/xml/AuthorElementCollection.php b/vendor/phar-io/manifest/src/xml/AuthorElementCollection.php new file mode 100644 index 00000000..0a2a2a38 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/AuthorElementCollection.php @@ -0,0 +1,19 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +class AuthorElementCollection extends ElementCollection { + public function current(): AuthorElement { + return new AuthorElement( + $this->getCurrentElement() + ); + } +} diff --git a/vendor/phar-io/manifest/src/xml/BundlesElement.php b/vendor/phar-io/manifest/src/xml/BundlesElement.php new file mode 100644 index 00000000..ef721a66 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/BundlesElement.php @@ -0,0 +1,19 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +class BundlesElement extends ManifestElement { + public function getComponentElements(): ComponentElementCollection { + return new ComponentElementCollection( + $this->getChildrenByName('component') + ); + } +} diff --git a/vendor/phar-io/manifest/src/xml/ComponentElement.php b/vendor/phar-io/manifest/src/xml/ComponentElement.php new file mode 100644 index 00000000..84373c47 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ComponentElement.php @@ -0,0 +1,21 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +class ComponentElement extends ManifestElement { + public function getName(): string { + return $this->getAttributeValue('name'); + } + + public function getVersion(): string { + return $this->getAttributeValue('version'); + } +} diff --git a/vendor/phar-io/manifest/src/xml/ComponentElementCollection.php b/vendor/phar-io/manifest/src/xml/ComponentElementCollection.php new file mode 100644 index 00000000..cd9ad5dd --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ComponentElementCollection.php @@ -0,0 +1,19 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +class ComponentElementCollection extends ElementCollection { + public function current(): ComponentElement { + return new ComponentElement( + $this->getCurrentElement() + ); + } +} diff --git a/vendor/phar-io/manifest/src/xml/ContainsElement.php b/vendor/phar-io/manifest/src/xml/ContainsElement.php new file mode 100644 index 00000000..55a9c605 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ContainsElement.php @@ -0,0 +1,31 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +class ContainsElement extends ManifestElement { + public function getName(): string { + return $this->getAttributeValue('name'); + } + + public function getVersion(): string { + return $this->getAttributeValue('version'); + } + + public function getType(): string { + return $this->getAttributeValue('type'); + } + + public function getExtensionElement(): ExtensionElement { + return new ExtensionElement( + $this->getChildByName('extension') + ); + } +} diff --git a/vendor/phar-io/manifest/src/xml/CopyrightElement.php b/vendor/phar-io/manifest/src/xml/CopyrightElement.php new file mode 100644 index 00000000..c11415a5 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/CopyrightElement.php @@ -0,0 +1,25 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +class CopyrightElement extends ManifestElement { + public function getAuthorElements(): AuthorElementCollection { + return new AuthorElementCollection( + $this->getChildrenByName('author') + ); + } + + public function getLicenseElement(): LicenseElement { + return new LicenseElement( + $this->getChildByName('license') + ); + } +} diff --git a/vendor/phar-io/manifest/src/xml/ElementCollection.php b/vendor/phar-io/manifest/src/xml/ElementCollection.php new file mode 100644 index 00000000..9e1de569 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ElementCollection.php @@ -0,0 +1,68 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use DOMElement; +use DOMNodeList; +use Iterator; +use ReturnTypeWillChange; +use function count; +use function get_class; +use function sprintf; + +/** @template-implements Iterator<int,DOMElement> */ +abstract class ElementCollection implements Iterator { + /** @var DOMElement[] */ + private $nodes = []; + + /** @var int */ + private $position; + + public function __construct(DOMNodeList $nodeList) { + $this->position = 0; + $this->importNodes($nodeList); + } + + #[ReturnTypeWillChange] + abstract public function current(); + + public function next(): void { + $this->position++; + } + + public function key(): int { + return $this->position; + } + + public function valid(): bool { + return $this->position < count($this->nodes); + } + + public function rewind(): void { + $this->position = 0; + } + + protected function getCurrentElement(): DOMElement { + return $this->nodes[$this->position]; + } + + private function importNodes(DOMNodeList $nodeList): void { + foreach ($nodeList as $node) { + if (!$node instanceof DOMElement) { + throw new ElementCollectionException( + sprintf('\DOMElement expected, got \%s', get_class($node)) + ); + } + + $this->nodes[] = $node; + } + } +} diff --git a/vendor/phar-io/manifest/src/xml/ExtElement.php b/vendor/phar-io/manifest/src/xml/ExtElement.php new file mode 100644 index 00000000..6a88a05d --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ExtElement.php @@ -0,0 +1,17 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +class ExtElement extends ManifestElement { + public function getName(): string { + return $this->getAttributeValue('name'); + } +} diff --git a/vendor/phar-io/manifest/src/xml/ExtElementCollection.php b/vendor/phar-io/manifest/src/xml/ExtElementCollection.php new file mode 100644 index 00000000..3eec9463 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ExtElementCollection.php @@ -0,0 +1,19 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +class ExtElementCollection extends ElementCollection { + public function current(): ExtElement { + return new ExtElement( + $this->getCurrentElement() + ); + } +} diff --git a/vendor/phar-io/manifest/src/xml/ExtensionElement.php b/vendor/phar-io/manifest/src/xml/ExtensionElement.php new file mode 100644 index 00000000..22016a01 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ExtensionElement.php @@ -0,0 +1,21 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +class ExtensionElement extends ManifestElement { + public function getFor(): string { + return $this->getAttributeValue('for'); + } + + public function getCompatible(): string { + return $this->getAttributeValue('compatible'); + } +} diff --git a/vendor/phar-io/manifest/src/xml/LicenseElement.php b/vendor/phar-io/manifest/src/xml/LicenseElement.php new file mode 100644 index 00000000..d9f4cb26 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/LicenseElement.php @@ -0,0 +1,21 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +class LicenseElement extends ManifestElement { + public function getType(): string { + return $this->getAttributeValue('type'); + } + + public function getUrl(): string { + return $this->getAttributeValue('url'); + } +} diff --git a/vendor/phar-io/manifest/src/xml/ManifestDocument.php b/vendor/phar-io/manifest/src/xml/ManifestDocument.php new file mode 100644 index 00000000..87458686 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ManifestDocument.php @@ -0,0 +1,115 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use DOMDocument; +use DOMElement; +use Throwable; +use function count; +use function file_get_contents; +use function is_file; +use function libxml_clear_errors; +use function libxml_get_errors; +use function libxml_use_internal_errors; +use function sprintf; + +class ManifestDocument { + public const XMLNS = 'https://phar.io/xml/manifest/1.0'; + + /** @var DOMDocument */ + private $dom; + + public static function fromFile(string $filename): ManifestDocument { + if (!is_file($filename)) { + throw new ManifestDocumentException( + sprintf('File "%s" not found', $filename) + ); + } + + return self::fromString( + file_get_contents($filename) + ); + } + + public static function fromString(string $xmlString): ManifestDocument { + $prev = libxml_use_internal_errors(true); + libxml_clear_errors(); + + try { + $dom = new DOMDocument(); + $dom->loadXML($xmlString); + $errors = libxml_get_errors(); + libxml_use_internal_errors($prev); + } catch (Throwable $t) { + throw new ManifestDocumentException($t->getMessage(), 0, $t); + } + + if (count($errors) !== 0) { + throw new ManifestDocumentLoadingException($errors); + } + + return new self($dom); + } + + private function __construct(DOMDocument $dom) { + $this->ensureCorrectDocumentType($dom); + + $this->dom = $dom; + } + + public function getContainsElement(): ContainsElement { + return new ContainsElement( + $this->fetchElementByName('contains') + ); + } + + public function getCopyrightElement(): CopyrightElement { + return new CopyrightElement( + $this->fetchElementByName('copyright') + ); + } + + public function getRequiresElement(): RequiresElement { + return new RequiresElement( + $this->fetchElementByName('requires') + ); + } + + public function hasBundlesElement(): bool { + return $this->dom->getElementsByTagNameNS(self::XMLNS, 'bundles')->length === 1; + } + + public function getBundlesElement(): BundlesElement { + return new BundlesElement( + $this->fetchElementByName('bundles') + ); + } + + private function ensureCorrectDocumentType(DOMDocument $dom): void { + $root = $dom->documentElement; + + if ($root->localName !== 'phar' || $root->namespaceURI !== self::XMLNS) { + throw new ManifestDocumentException('Not a phar.io manifest document'); + } + } + + private function fetchElementByName(string $elementName): DOMElement { + $element = $this->dom->getElementsByTagNameNS(self::XMLNS, $elementName)->item(0); + + if (!$element instanceof DOMElement) { + throw new ManifestDocumentException( + sprintf('Element %s missing', $elementName) + ); + } + + return $element; + } +} diff --git a/vendor/phar-io/manifest/src/xml/ManifestElement.php b/vendor/phar-io/manifest/src/xml/ManifestElement.php new file mode 100644 index 00000000..461ba0c9 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ManifestElement.php @@ -0,0 +1,72 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +use DOMElement; +use DOMNodeList; +use function sprintf; + +class ManifestElement { + public const XMLNS = 'https://phar.io/xml/manifest/1.0'; + + /** @var DOMElement */ + private $element; + + public function __construct(DOMElement $element) { + $this->element = $element; + } + + protected function getAttributeValue(string $name): string { + if (!$this->element->hasAttribute($name)) { + throw new ManifestElementException( + sprintf( + 'Attribute %s not set on element %s', + $name, + $this->element->localName + ) + ); + } + + return $this->element->getAttribute($name); + } + + protected function hasAttribute(string $name): bool { + return $this->element->hasAttribute($name); + } + + protected function getChildByName(string $elementName): DOMElement { + $element = $this->element->getElementsByTagNameNS(self::XMLNS, $elementName)->item(0); + + if (!$element instanceof DOMElement) { + throw new ManifestElementException( + sprintf('Element %s missing', $elementName) + ); + } + + return $element; + } + + protected function getChildrenByName(string $elementName): DOMNodeList { + $elementList = $this->element->getElementsByTagNameNS(self::XMLNS, $elementName); + + if ($elementList->length === 0) { + throw new ManifestElementException( + sprintf('Element(s) %s missing', $elementName) + ); + } + + return $elementList; + } + + protected function hasChild(string $elementName): bool { + return $this->element->getElementsByTagNameNS(self::XMLNS, $elementName)->length !== 0; + } +} diff --git a/vendor/phar-io/manifest/src/xml/PhpElement.php b/vendor/phar-io/manifest/src/xml/PhpElement.php new file mode 100644 index 00000000..9340c2e6 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/PhpElement.php @@ -0,0 +1,27 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +class PhpElement extends ManifestElement { + public function getVersion(): string { + return $this->getAttributeValue('version'); + } + + public function hasExtElements(): bool { + return $this->hasChild('ext'); + } + + public function getExtElements(): ExtElementCollection { + return new ExtElementCollection( + $this->getChildrenByName('ext') + ); + } +} diff --git a/vendor/phar-io/manifest/src/xml/RequiresElement.php b/vendor/phar-io/manifest/src/xml/RequiresElement.php new file mode 100644 index 00000000..73ba54ca --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/RequiresElement.php @@ -0,0 +1,19 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Manifest. + * + * Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ +namespace PharIo\Manifest; + +class RequiresElement extends ManifestElement { + public function getPHPElement(): PhpElement { + return new PhpElement( + $this->getChildByName('php') + ); + } +} diff --git a/vendor/phar-io/manifest/tools/php-cs-fixer.d/PhpdocSingleLineVarFixer.php b/vendor/phar-io/manifest/tools/php-cs-fixer.d/PhpdocSingleLineVarFixer.php new file mode 100644 index 00000000..ea5414e4 --- /dev/null +++ b/vendor/phar-io/manifest/tools/php-cs-fixer.d/PhpdocSingleLineVarFixer.php @@ -0,0 +1,72 @@ +<?php +namespace PharIo\CSFixer; + +use PhpCsFixer\Fixer\FixerInterface; +use PhpCsFixer\FixerDefinition\FixerDefinition; +use PhpCsFixer\Tokenizer\Tokens; +use PhpCsFixer\Tokenizer\Token; + +/** + * Main implementation taken from kubawerlos/php-cs-fixer-customere-fixers + * Copyright (c) 2018 Kuba Werłos + * + * Slightly modified to work without the gazillion of composer dependencies + * + * Original: + * https://github.com/kubawerlos/php-cs-fixer-custom-fixers/blob/master/src/Fixer/PhpdocSingleLineVarFixer.php + * + */ +class PhpdocSingleLineVarFixer implements FixerInterface { + + public function getDefinition(): FixerDefinition { + return new FixerDefinition( + '`@var` annotation must be in single line when is the only content.', + [new CodeSample('<?php + /** + * @var string + */ + ')] + ); + } + + public function isCandidate(Tokens $tokens): bool { + return $tokens->isTokenKindFound(T_DOC_COMMENT); + } + + public function isRisky(): bool { + return false; + } + + public function fix(\SplFileInfo $file, Tokens $tokens): void { + foreach($tokens as $index => $token) { + if (!$token->isGivenKind(T_DOC_COMMENT)) { + continue; + } + if (\stripos($token->getContent(), '@var') === false) { + continue; + } + + if (preg_match('#^/\*\*[\s\*]+(@var[^\r\n]+)[\s\*]*\*\/$#u', $token->getContent(), $matches) !== 1) { + continue; + } + $newContent = '/** ' . \rtrim($matches[1]) . ' */'; + if ($newContent === $token->getContent()) { + continue; + } + $tokens[$index] = new Token([T_DOC_COMMENT, $newContent]); + } + } + + public function getPriority(): int { + return 0; + } + + public function getName(): string { + return 'PharIo/phpdoc_single_line_var_fixer'; + } + + public function supports(\SplFileInfo $file): bool { + return true; + } + +} diff --git a/vendor/phar-io/manifest/tools/php-cs-fixer.d/header.txt b/vendor/phar-io/manifest/tools/php-cs-fixer.d/header.txt new file mode 100644 index 00000000..dc8c4ffc --- /dev/null +++ b/vendor/phar-io/manifest/tools/php-cs-fixer.d/header.txt @@ -0,0 +1,6 @@ +This file is part of PharIo\Manifest. + +Copyright (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> and contributors + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. diff --git a/vendor/phar-io/version/CHANGELOG.md b/vendor/phar-io/version/CHANGELOG.md new file mode 100644 index 00000000..4c0edfa7 --- /dev/null +++ b/vendor/phar-io/version/CHANGELOG.md @@ -0,0 +1,142 @@ +# Changelog + +All notable changes to phar-io/version are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. + +## [3.2.1] - 2022-02-21 + +### Fixed + +- Have ExactVersionConstraint honor build metadata (added in 3.2.0) + + +## [3.2.0] - 2022-02-21 + +### Added + +- Build metadata is now supported and considered for equality checks only + + +## [3.1.1] - 2022-02-07 + +### Fixed + +- [#28](https://github.com/phar-io/version/issues/28): `VersionConstraintParser` does not support logical OR represented by single pipe (|) (Thanks @llaville) + + +## [3.1.0] - 2021-02-23 + +### Changed + +- Internal Refactoring +- More scalar types + +### Added + +- [#24](https://github.com/phar-io/version/issues/24): `Version::getOriginalString()` added (Thanks @addshore) +- Version constraints using the caret operator (`^`) now honor pre-1.0 releases, e.g. `^0.3` translates to `0.3.*`) +- Various integration tests for version constraint processing + +### Fixed + +- [#23](https://github.com/phar-io/version/pull/23): Tilde operator without patch level + + + +## [3.0.4] - 14.12.2020 + +### Fixed + +- [#22](https://github.com/phar-io/version/pull/22): make dev suffix rank works for uppercase too + +## [3.0.3] - 30.11.2020 + +### Added + +- Comparator method `Version::equals()` added + + +## [3.0.2] - 27.06.2020 + +This release now supports PHP 7.2+ and PHP ^8.0. No other changes included. + + +## [3.0.1] - 09.05.2020 + +__Potential BC Break Notice:__ +`Version::getVersionString()` no longer returns `v` prefixes in case the "input" +string contained one. These are not part of the semver specs +(see https://semver.org/#is-v123-a-semantic-version) and get stripped out. +As of Version 3.1.0 `Version::getOriginalString()` can be used to still +retrieve it as given. + +### Changed + +- Internal Refactoring +- More scalar types + +### Fixed + +- Fixed Constraint processing Regression for ^1.2 and ~1.2 + + +## [3.0.0] - 05.05.2020 + +### Changed + +- Require PHP 7.2+ +- All code now uses strict mode +- Scalar types have been added as needed + +### Added + +- The technically invalid format using 'v' prefix ("v1.2.3") is now properly supported + + +## [2.0.1] - 08.07.2018 + +### Fixed + +- Versions without a pre-release suffix are now always considered greater +than versions with a pre-release suffix. Example: `3.0.0 > 3.0.0-alpha.1` + + +## [2.0.0] - 23.06.2018 + +Changes to public API: + +- `PreReleaseSuffix::construct()`: optional parameter `$number` removed +- `PreReleaseSuffix::isGreaterThan()`: introduced +- `Version::hasPreReleaseSuffix()`: introduced + +### Added + +- [#11](https://github.com/phar-io/version/issues/11): Added support for pre-release version suffixes. Supported values are: + - `dev` + - `beta` (also abbreviated form `b`) + - `rc` + - `alpha` (also abbreviated form `a`) + - `patch` (also abbreviated form `p`) + + All values can be followed by a number, e.g. `beta3`. + + When comparing versions, the pre-release suffix is taken into account. Example: +`1.5.0 > 1.5.0-beta1 > 1.5.0-alpha3 > 1.5.0-alpha2 > 1.5.0-dev11` + +### Changed + +- reorganized the source directories + +### Fixed + +- [#10](https://github.com/phar-io/version/issues/10): Version numbers containing +a numeric suffix as seen in Debian packages are now supported. + + +[3.1.0]: https://github.com/phar-io/version/compare/3.0.4...3.1.0 +[3.0.4]: https://github.com/phar-io/version/compare/3.0.3...3.0.4 +[3.0.3]: https://github.com/phar-io/version/compare/3.0.2...3.0.3 +[3.0.2]: https://github.com/phar-io/version/compare/3.0.1...3.0.2 +[3.0.1]: https://github.com/phar-io/version/compare/3.0.0...3.0.1 +[3.0.0]: https://github.com/phar-io/version/compare/2.0.1...3.0.0 +[2.0.1]: https://github.com/phar-io/version/compare/2.0.0...2.0.1 +[2.0.0]: https://github.com/phar-io/version/compare/1.0.1...2.0.0 diff --git a/vendor/phar-io/version/LICENSE b/vendor/phar-io/version/LICENSE new file mode 100644 index 00000000..ce32758a --- /dev/null +++ b/vendor/phar-io/version/LICENSE @@ -0,0 +1,29 @@ +Copyright (c) 2016-2017 Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de> and contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT * NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + diff --git a/vendor/phar-io/version/README.md b/vendor/phar-io/version/README.md new file mode 100644 index 00000000..76e6e985 --- /dev/null +++ b/vendor/phar-io/version/README.md @@ -0,0 +1,61 @@ +# Version + +Library for handling version information and constraints + +[![Build Status](https://travis-ci.org/phar-io/version.svg?branch=master)](https://travis-ci.org/phar-io/version) + +## Installation + +You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/): + + composer require phar-io/version + +If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency: + + composer require --dev phar-io/version + +## Version constraints + +A Version constraint describes a range of versions or a discrete version number. The format of version numbers follows the schema of [semantic versioning](http://semver.org): `<major>.<minor>.<patch>`. A constraint might contain an operator that describes the range. + +Beside the typical mathematical operators like `<=`, `>=`, there are two special operators: + +*Caret operator*: `^1.0` +can be written as `>=1.0.0 <2.0.0` and read as »every Version within major version `1`«. + +*Tilde operator*: `~1.0.0` +can be written as `>=1.0.0 <1.1.0` and read as »every version within minor version `1.1`. The behavior of tilde operator depends on whether a patch level version is provided or not. If no patch level is provided, tilde operator behaves like the caret operator: `~1.0` is identical to `^1.0`. + +## Usage examples + +Parsing version constraints and check discrete versions for compliance: + +```php + +use PharIo\Version\Version; +use PharIo\Version\VersionConstraintParser; + +$parser = new VersionConstraintParser(); +$caret_constraint = $parser->parse( '^7.0' ); + +$caret_constraint->complies( new Version( '7.0.17' ) ); // true +$caret_constraint->complies( new Version( '7.1.0' ) ); // true +$caret_constraint->complies( new Version( '6.4.34' ) ); // false + +$tilde_constraint = $parser->parse( '~1.1.0' ); + +$tilde_constraint->complies( new Version( '1.1.4' ) ); // true +$tilde_constraint->complies( new Version( '1.2.0' ) ); // false +``` + +As of version 2.0.0, pre-release labels are supported and taken into account when comparing versions: + +```php + +$leftVersion = new PharIo\Version\Version('3.0.0-alpha.1'); +$rightVersion = new PharIo\Version\Version('3.0.0-alpha.2'); + +$leftVersion->isGreaterThan($rightVersion); // false +$rightVersion->isGreaterThan($leftVersion); // true + +``` diff --git a/vendor/phar-io/version/composer.json b/vendor/phar-io/version/composer.json new file mode 100644 index 00000000..22687dcd --- /dev/null +++ b/vendor/phar-io/version/composer.json @@ -0,0 +1,34 @@ +{ + "name": "phar-io/version", + "description": "Library for handling version information and constraints", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "support": { + "issues": "https://github.com/phar-io/version/issues" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "autoload": { + "classmap": [ + "src/" + ] + } +} + diff --git a/vendor/phar-io/version/src/BuildMetaData.php b/vendor/phar-io/version/src/BuildMetaData.php new file mode 100644 index 00000000..d42f0363 --- /dev/null +++ b/vendor/phar-io/version/src/BuildMetaData.php @@ -0,0 +1,28 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Version. + * + * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +class BuildMetaData { + + /** @var string */ + private $value; + + public function __construct(string $value) { + $this->value = $value; + } + + public function asString(): string { + return $this->value; + } + + public function equals(BuildMetaData $other): bool { + return $this->asString() === $other->asString(); + } +} diff --git a/vendor/phar-io/version/src/PreReleaseSuffix.php b/vendor/phar-io/version/src/PreReleaseSuffix.php new file mode 100644 index 00000000..00563008 --- /dev/null +++ b/vendor/phar-io/version/src/PreReleaseSuffix.php @@ -0,0 +1,82 @@ +<?php declare(strict_types = 1); +namespace PharIo\Version; + +class PreReleaseSuffix { + private const valueScoreMap = [ + 'dev' => 0, + 'a' => 1, + 'alpha' => 1, + 'b' => 2, + 'beta' => 2, + 'rc' => 3, + 'p' => 4, + 'pl' => 4, + 'patch' => 4, + ]; + + /** @var string */ + private $value; + + /** @var int */ + private $valueScore; + + /** @var int */ + private $number = 0; + + /** @var string */ + private $full; + + /** + * @throws InvalidPreReleaseSuffixException + */ + public function __construct(string $value) { + $this->parseValue($value); + } + + public function asString(): string { + return $this->full; + } + + public function getValue(): string { + return $this->value; + } + + public function getNumber(): ?int { + return $this->number; + } + + public function isGreaterThan(PreReleaseSuffix $suffix): bool { + if ($this->valueScore > $suffix->valueScore) { + return true; + } + + if ($this->valueScore < $suffix->valueScore) { + return false; + } + + return $this->getNumber() > $suffix->getNumber(); + } + + private function mapValueToScore(string $value): int { + $value = \strtolower($value); + + return self::valueScoreMap[$value]; + } + + private function parseValue(string $value): void { + $regex = '/-?((dev|beta|b|rc|alpha|a|patch|p|pl)\.?(\d*)).*$/i'; + + if (\preg_match($regex, $value, $matches) !== 1) { + throw new InvalidPreReleaseSuffixException(\sprintf('Invalid label %s', $value)); + } + + $this->full = $matches[1]; + $this->value = $matches[2]; + + if ($matches[3] !== '') { + $this->number = (int)$matches[3]; + } + + $this->valueScore = $this->mapValueToScore($matches[2]); + } +} diff --git a/vendor/phar-io/version/src/Version.php b/vendor/phar-io/version/src/Version.php new file mode 100644 index 00000000..644af5ca --- /dev/null +++ b/vendor/phar-io/version/src/Version.php @@ -0,0 +1,208 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Version. + * + * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +class Version { + /** @var string */ + private $originalVersionString; + + /** @var VersionNumber */ + private $major; + + /** @var VersionNumber */ + private $minor; + + /** @var VersionNumber */ + private $patch; + + /** @var null|PreReleaseSuffix */ + private $preReleaseSuffix; + + /** @var null|BuildMetaData */ + private $buildMetadata; + + public function __construct(string $versionString) { + $this->ensureVersionStringIsValid($versionString); + $this->originalVersionString = $versionString; + } + + /** + * @throws NoPreReleaseSuffixException + */ + public function getPreReleaseSuffix(): PreReleaseSuffix { + if ($this->preReleaseSuffix === null) { + throw new NoPreReleaseSuffixException('No pre-release suffix set'); + } + + return $this->preReleaseSuffix; + } + + public function getOriginalString(): string { + return $this->originalVersionString; + } + + public function getVersionString(): string { + $str = \sprintf( + '%d.%d.%d', + $this->getMajor()->getValue() ?? 0, + $this->getMinor()->getValue() ?? 0, + $this->getPatch()->getValue() ?? 0 + ); + + if (!$this->hasPreReleaseSuffix()) { + return $str; + } + + return $str . '-' . $this->getPreReleaseSuffix()->asString(); + } + + public function hasPreReleaseSuffix(): bool { + return $this->preReleaseSuffix !== null; + } + + public function equals(Version $other): bool { + if ($this->getVersionString() !== $other->getVersionString()) { + return false; + } + + if ($this->hasBuildMetaData() !== $other->hasBuildMetaData()) { + return false; + } + + if ($this->hasBuildMetaData() && $other->hasBuildMetaData() && + !$this->getBuildMetaData()->equals($other->getBuildMetaData())) { + return false; + } + + return true; + } + + public function isGreaterThan(Version $version): bool { + if ($version->getMajor()->getValue() > $this->getMajor()->getValue()) { + return false; + } + + if ($version->getMajor()->getValue() < $this->getMajor()->getValue()) { + return true; + } + + if ($version->getMinor()->getValue() > $this->getMinor()->getValue()) { + return false; + } + + if ($version->getMinor()->getValue() < $this->getMinor()->getValue()) { + return true; + } + + if ($version->getPatch()->getValue() > $this->getPatch()->getValue()) { + return false; + } + + if ($version->getPatch()->getValue() < $this->getPatch()->getValue()) { + return true; + } + + if (!$version->hasPreReleaseSuffix() && !$this->hasPreReleaseSuffix()) { + return false; + } + + if ($version->hasPreReleaseSuffix() && !$this->hasPreReleaseSuffix()) { + return true; + } + + if (!$version->hasPreReleaseSuffix() && $this->hasPreReleaseSuffix()) { + return false; + } + + return $this->getPreReleaseSuffix()->isGreaterThan($version->getPreReleaseSuffix()); + } + + public function getMajor(): VersionNumber { + return $this->major; + } + + public function getMinor(): VersionNumber { + return $this->minor; + } + + public function getPatch(): VersionNumber { + return $this->patch; + } + + /** + * @psalm-assert-if-true BuildMetaData $this->buildMetadata + * @psalm-assert-if-true BuildMetaData $this->getBuildMetaData() + */ + public function hasBuildMetaData(): bool { + return $this->buildMetadata !== null; + } + + /** + * @throws NoBuildMetaDataException + */ + public function getBuildMetaData(): BuildMetaData { + if (!$this->hasBuildMetaData()) { + throw new NoBuildMetaDataException('No build metadata set'); + } + + return $this->buildMetadata; + } + + /** + * @param string[] $matches + * + * @throws InvalidPreReleaseSuffixException + */ + private function parseVersion(array $matches): void { + $this->major = new VersionNumber((int)$matches['Major']); + $this->minor = new VersionNumber((int)$matches['Minor']); + $this->patch = isset($matches['Patch']) ? new VersionNumber((int)$matches['Patch']) : new VersionNumber(0); + + if (isset($matches['PreReleaseSuffix']) && $matches['PreReleaseSuffix'] !== '') { + $this->preReleaseSuffix = new PreReleaseSuffix($matches['PreReleaseSuffix']); + } + + if (isset($matches['BuildMetadata'])) { + $this->buildMetadata = new BuildMetaData($matches['BuildMetadata']); + } + } + + /** + * @param string $version + * + * @throws InvalidVersionException + */ + private function ensureVersionStringIsValid($version): void { + $regex = '/^v? + (?P<Major>0|[1-9]\d*) + \\. + (?P<Minor>0|[1-9]\d*) + (\\. + (?P<Patch>0|[1-9]\d*) + )? + (?: + - + (?<PreReleaseSuffix>(?:(dev|beta|b|rc|alpha|a|patch|p|pl)\.?\d*)) + )? + (?: + \\+ + (?P<BuildMetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-@]+)*) + )? + $/xi'; + + if (\preg_match($regex, $version, $matches) !== 1) { + throw new InvalidVersionException( + \sprintf("Version string '%s' does not follow SemVer semantics", $version) + ); + } + + $this->parseVersion($matches); + } +} diff --git a/vendor/phar-io/version/src/VersionConstraintParser.php b/vendor/phar-io/version/src/VersionConstraintParser.php new file mode 100644 index 00000000..03d6a095 --- /dev/null +++ b/vendor/phar-io/version/src/VersionConstraintParser.php @@ -0,0 +1,115 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Version. + * + * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +class VersionConstraintParser { + /** + * @throws UnsupportedVersionConstraintException + */ + public function parse(string $value): VersionConstraint { + if (\strpos($value, '|') !== false) { + return $this->handleOrGroup($value); + } + + if (!\preg_match('/^[\^~*]?v?[\d.*]+(?:-.*)?$/i', $value)) { + throw new UnsupportedVersionConstraintException( + \sprintf('Version constraint %s is not supported.', $value) + ); + } + + switch ($value[0]) { + case '~': + return $this->handleTildeOperator($value); + case '^': + return $this->handleCaretOperator($value); + } + + $constraint = new VersionConstraintValue($value); + + if ($constraint->getMajor()->isAny()) { + return new AnyVersionConstraint(); + } + + if ($constraint->getMinor()->isAny()) { + return new SpecificMajorVersionConstraint( + $constraint->getVersionString(), + $constraint->getMajor()->getValue() ?? 0 + ); + } + + if ($constraint->getPatch()->isAny()) { + return new SpecificMajorAndMinorVersionConstraint( + $constraint->getVersionString(), + $constraint->getMajor()->getValue() ?? 0, + $constraint->getMinor()->getValue() ?? 0 + ); + } + + return new ExactVersionConstraint($constraint->getVersionString()); + } + + private function handleOrGroup(string $value): OrVersionConstraintGroup { + $constraints = []; + + foreach (\preg_split('{\s*\|\|?\s*}', \trim($value)) as $groupSegment) { + $constraints[] = $this->parse(\trim($groupSegment)); + } + + return new OrVersionConstraintGroup($value, $constraints); + } + + private function handleTildeOperator(string $value): AndVersionConstraintGroup { + $constraintValue = new VersionConstraintValue(\substr($value, 1)); + + if ($constraintValue->getPatch()->isAny()) { + return $this->handleCaretOperator($value); + } + + $constraints = [ + new GreaterThanOrEqualToVersionConstraint( + $value, + new Version(\substr($value, 1)) + ), + new SpecificMajorAndMinorVersionConstraint( + $value, + $constraintValue->getMajor()->getValue() ?? 0, + $constraintValue->getMinor()->getValue() ?? 0 + ) + ]; + + return new AndVersionConstraintGroup($value, $constraints); + } + + private function handleCaretOperator(string $value): AndVersionConstraintGroup { + $constraintValue = new VersionConstraintValue(\substr($value, 1)); + + $constraints = [ + new GreaterThanOrEqualToVersionConstraint($value, new Version(\substr($value, 1))) + ]; + + if ($constraintValue->getMajor()->getValue() === 0) { + $constraints[] = new SpecificMajorAndMinorVersionConstraint( + $value, + $constraintValue->getMajor()->getValue() ?? 0, + $constraintValue->getMinor()->getValue() ?? 0 + ); + } else { + $constraints[] = new SpecificMajorVersionConstraint( + $value, + $constraintValue->getMajor()->getValue() ?? 0 + ); + } + + return new AndVersionConstraintGroup( + $value, + $constraints + ); + } +} diff --git a/vendor/phar-io/version/src/VersionConstraintValue.php b/vendor/phar-io/version/src/VersionConstraintValue.php new file mode 100644 index 00000000..0762e7c0 --- /dev/null +++ b/vendor/phar-io/version/src/VersionConstraintValue.php @@ -0,0 +1,88 @@ +<?php declare(strict_types = 1); +namespace PharIo\Version; + +class VersionConstraintValue { + /** @var VersionNumber */ + private $major; + + /** @var VersionNumber */ + private $minor; + + /** @var VersionNumber */ + private $patch; + + /** @var string */ + private $label = ''; + + /** @var string */ + private $buildMetaData = ''; + + /** @var string */ + private $versionString = ''; + + public function __construct(string $versionString) { + $this->versionString = $versionString; + + $this->parseVersion($versionString); + } + + public function getLabel(): string { + return $this->label; + } + + public function getBuildMetaData(): string { + return $this->buildMetaData; + } + + public function getVersionString(): string { + return $this->versionString; + } + + public function getMajor(): VersionNumber { + return $this->major; + } + + public function getMinor(): VersionNumber { + return $this->minor; + } + + public function getPatch(): VersionNumber { + return $this->patch; + } + + private function parseVersion(string $versionString): void { + $this->extractBuildMetaData($versionString); + $this->extractLabel($versionString); + $this->stripPotentialVPrefix($versionString); + + $versionSegments = \explode('.', $versionString); + $this->major = new VersionNumber(\is_numeric($versionSegments[0]) ? (int)$versionSegments[0] : null); + + $minorValue = isset($versionSegments[1]) && \is_numeric($versionSegments[1]) ? (int)$versionSegments[1] : null; + $patchValue = isset($versionSegments[2]) && \is_numeric($versionSegments[2]) ? (int)$versionSegments[2] : null; + + $this->minor = new VersionNumber($minorValue); + $this->patch = new VersionNumber($patchValue); + } + + private function extractBuildMetaData(string &$versionString): void { + if (\preg_match('/\+(.*)/', $versionString, $matches) === 1) { + $this->buildMetaData = $matches[1]; + $versionString = \str_replace($matches[0], '', $versionString); + } + } + + private function extractLabel(string &$versionString): void { + if (\preg_match('/-(.*)/', $versionString, $matches) === 1) { + $this->label = $matches[1]; + $versionString = \str_replace($matches[0], '', $versionString); + } + } + + private function stripPotentialVPrefix(string &$versionString): void { + if ($versionString[0] !== 'v') { + return; + } + $versionString = \substr($versionString, 1); + } +} diff --git a/vendor/phar-io/version/src/VersionNumber.php b/vendor/phar-io/version/src/VersionNumber.php new file mode 100644 index 00000000..4833a9b0 --- /dev/null +++ b/vendor/phar-io/version/src/VersionNumber.php @@ -0,0 +1,28 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Version. + * + * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +class VersionNumber { + + /** @var ?int */ + private $value; + + public function __construct(?int $value) { + $this->value = $value; + } + + public function isAny(): bool { + return $this->value === null; + } + + public function getValue(): ?int { + return $this->value; + } +} diff --git a/vendor/phar-io/version/src/constraints/AbstractVersionConstraint.php b/vendor/phar-io/version/src/constraints/AbstractVersionConstraint.php new file mode 100644 index 00000000..66201a14 --- /dev/null +++ b/vendor/phar-io/version/src/constraints/AbstractVersionConstraint.php @@ -0,0 +1,23 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Version. + * + * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +abstract class AbstractVersionConstraint implements VersionConstraint { + /** @var string */ + private $originalValue; + + public function __construct(string $originalValue) { + $this->originalValue = $originalValue; + } + + public function asString(): string { + return $this->originalValue; + } +} diff --git a/vendor/phar-io/version/src/constraints/AndVersionConstraintGroup.php b/vendor/phar-io/version/src/constraints/AndVersionConstraintGroup.php new file mode 100644 index 00000000..5096f2fb --- /dev/null +++ b/vendor/phar-io/version/src/constraints/AndVersionConstraintGroup.php @@ -0,0 +1,34 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Version. + * + * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +class AndVersionConstraintGroup extends AbstractVersionConstraint { + /** @var VersionConstraint[] */ + private $constraints = []; + + /** + * @param VersionConstraint[] $constraints + */ + public function __construct(string $originalValue, array $constraints) { + parent::__construct($originalValue); + + $this->constraints = $constraints; + } + + public function complies(Version $version): bool { + foreach ($this->constraints as $constraint) { + if (!$constraint->complies($version)) { + return false; + } + } + + return true; + } +} diff --git a/vendor/phar-io/version/src/constraints/AnyVersionConstraint.php b/vendor/phar-io/version/src/constraints/AnyVersionConstraint.php new file mode 100644 index 00000000..1499f071 --- /dev/null +++ b/vendor/phar-io/version/src/constraints/AnyVersionConstraint.php @@ -0,0 +1,20 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Version. + * + * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +class AnyVersionConstraint implements VersionConstraint { + public function complies(Version $version): bool { + return true; + } + + public function asString(): string { + return '*'; + } +} diff --git a/vendor/phar-io/version/src/constraints/ExactVersionConstraint.php b/vendor/phar-io/version/src/constraints/ExactVersionConstraint.php new file mode 100644 index 00000000..1d675c9c --- /dev/null +++ b/vendor/phar-io/version/src/constraints/ExactVersionConstraint.php @@ -0,0 +1,22 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Version. + * + * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +class ExactVersionConstraint extends AbstractVersionConstraint { + public function complies(Version $version): bool { + $other = $version->getVersionString(); + + if ($version->hasBuildMetaData()) { + $other .= '+' . $version->getBuildMetaData()->asString(); + } + + return $this->asString() === $other; + } +} diff --git a/vendor/phar-io/version/src/constraints/GreaterThanOrEqualToVersionConstraint.php b/vendor/phar-io/version/src/constraints/GreaterThanOrEqualToVersionConstraint.php new file mode 100644 index 00000000..ec371723 --- /dev/null +++ b/vendor/phar-io/version/src/constraints/GreaterThanOrEqualToVersionConstraint.php @@ -0,0 +1,26 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Version. + * + * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +class GreaterThanOrEqualToVersionConstraint extends AbstractVersionConstraint { + /** @var Version */ + private $minimalVersion; + + public function __construct(string $originalValue, Version $minimalVersion) { + parent::__construct($originalValue); + + $this->minimalVersion = $minimalVersion; + } + + public function complies(Version $version): bool { + return $version->getVersionString() === $this->minimalVersion->getVersionString() + || $version->isGreaterThan($this->minimalVersion); + } +} diff --git a/vendor/phar-io/version/src/constraints/OrVersionConstraintGroup.php b/vendor/phar-io/version/src/constraints/OrVersionConstraintGroup.php new file mode 100644 index 00000000..59fd382f --- /dev/null +++ b/vendor/phar-io/version/src/constraints/OrVersionConstraintGroup.php @@ -0,0 +1,35 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Version. + * + * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +class OrVersionConstraintGroup extends AbstractVersionConstraint { + /** @var VersionConstraint[] */ + private $constraints = []; + + /** + * @param string $originalValue + * @param VersionConstraint[] $constraints + */ + public function __construct($originalValue, array $constraints) { + parent::__construct($originalValue); + + $this->constraints = $constraints; + } + + public function complies(Version $version): bool { + foreach ($this->constraints as $constraint) { + if ($constraint->complies($version)) { + return true; + } + } + + return false; + } +} diff --git a/vendor/phar-io/version/src/constraints/SpecificMajorAndMinorVersionConstraint.php b/vendor/phar-io/version/src/constraints/SpecificMajorAndMinorVersionConstraint.php new file mode 100644 index 00000000..302aa311 --- /dev/null +++ b/vendor/phar-io/version/src/constraints/SpecificMajorAndMinorVersionConstraint.php @@ -0,0 +1,33 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Version. + * + * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +class SpecificMajorAndMinorVersionConstraint extends AbstractVersionConstraint { + /** @var int */ + private $major; + + /** @var int */ + private $minor; + + public function __construct(string $originalValue, int $major, int $minor) { + parent::__construct($originalValue); + + $this->major = $major; + $this->minor = $minor; + } + + public function complies(Version $version): bool { + if ($version->getMajor()->getValue() !== $this->major) { + return false; + } + + return $version->getMinor()->getValue() === $this->minor; + } +} diff --git a/vendor/phar-io/version/src/constraints/SpecificMajorVersionConstraint.php b/vendor/phar-io/version/src/constraints/SpecificMajorVersionConstraint.php new file mode 100644 index 00000000..968b809c --- /dev/null +++ b/vendor/phar-io/version/src/constraints/SpecificMajorVersionConstraint.php @@ -0,0 +1,25 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Version. + * + * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +class SpecificMajorVersionConstraint extends AbstractVersionConstraint { + /** @var int */ + private $major; + + public function __construct(string $originalValue, int $major) { + parent::__construct($originalValue); + + $this->major = $major; + } + + public function complies(Version $version): bool { + return $version->getMajor()->getValue() === $this->major; + } +} diff --git a/vendor/phar-io/version/src/constraints/VersionConstraint.php b/vendor/phar-io/version/src/constraints/VersionConstraint.php new file mode 100644 index 00000000..e94f9e00 --- /dev/null +++ b/vendor/phar-io/version/src/constraints/VersionConstraint.php @@ -0,0 +1,16 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Version. + * + * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +interface VersionConstraint { + public function complies(Version $version): bool; + + public function asString(): string; +} diff --git a/vendor/phar-io/version/src/exceptions/Exception.php b/vendor/phar-io/version/src/exceptions/Exception.php new file mode 100644 index 00000000..3ea458f3 --- /dev/null +++ b/vendor/phar-io/version/src/exceptions/Exception.php @@ -0,0 +1,15 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Version. + * + * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +use Throwable; + +interface Exception extends Throwable { +} diff --git a/vendor/phar-io/version/src/exceptions/InvalidPreReleaseSuffixException.php b/vendor/phar-io/version/src/exceptions/InvalidPreReleaseSuffixException.php new file mode 100644 index 00000000..bc0b0c3e --- /dev/null +++ b/vendor/phar-io/version/src/exceptions/InvalidPreReleaseSuffixException.php @@ -0,0 +1,5 @@ +<?php declare(strict_types = 1); +namespace PharIo\Version; + +class InvalidPreReleaseSuffixException extends \Exception implements Exception { +} diff --git a/vendor/phar-io/version/src/exceptions/InvalidVersionException.php b/vendor/phar-io/version/src/exceptions/InvalidVersionException.php new file mode 100644 index 00000000..e9e93108 --- /dev/null +++ b/vendor/phar-io/version/src/exceptions/InvalidVersionException.php @@ -0,0 +1,5 @@ +<?php declare(strict_types = 1); +namespace PharIo\Version; + +class InvalidVersionException extends \InvalidArgumentException implements Exception { +} diff --git a/vendor/phar-io/version/src/exceptions/NoBuildMetaDataException.php b/vendor/phar-io/version/src/exceptions/NoBuildMetaDataException.php new file mode 100644 index 00000000..09e9bee0 --- /dev/null +++ b/vendor/phar-io/version/src/exceptions/NoBuildMetaDataException.php @@ -0,0 +1,5 @@ +<?php declare(strict_types = 1); +namespace PharIo\Version; + +class NoBuildMetaDataException extends \Exception implements Exception { +} diff --git a/vendor/phar-io/version/src/exceptions/NoPreReleaseSuffixException.php b/vendor/phar-io/version/src/exceptions/NoPreReleaseSuffixException.php new file mode 100644 index 00000000..aa0b20f7 --- /dev/null +++ b/vendor/phar-io/version/src/exceptions/NoPreReleaseSuffixException.php @@ -0,0 +1,5 @@ +<?php declare(strict_types = 1); +namespace PharIo\Version; + +class NoPreReleaseSuffixException extends \Exception implements Exception { +} diff --git a/vendor/phar-io/version/src/exceptions/UnsupportedVersionConstraintException.php b/vendor/phar-io/version/src/exceptions/UnsupportedVersionConstraintException.php new file mode 100644 index 00000000..6d98e825 --- /dev/null +++ b/vendor/phar-io/version/src/exceptions/UnsupportedVersionConstraintException.php @@ -0,0 +1,13 @@ +<?php declare(strict_types = 1); +/* + * This file is part of PharIo\Version. + * + * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +final class UnsupportedVersionConstraintException extends \RuntimeException implements Exception { +} diff --git a/vendor/php-stubs/wordpress-stubs/LICENSE b/vendor/php-stubs/wordpress-stubs/LICENSE new file mode 100644 index 00000000..84b563a5 --- /dev/null +++ b/vendor/php-stubs/wordpress-stubs/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Viktor Szépe + +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/vendor/php-stubs/wordpress-stubs/composer.json b/vendor/php-stubs/wordpress-stubs/composer.json new file mode 100644 index 00000000..54ce8dbb --- /dev/null +++ b/vendor/php-stubs/wordpress-stubs/composer.json @@ -0,0 +1,62 @@ +{ + "name": "php-stubs/wordpress-stubs", + "description": "WordPress function and class declaration stubs for static analysis.", + "license": "MIT", + "keywords": [ + "wordpress", + "static analysis", + "phpstan" + ], + "homepage": "https://github.com/php-stubs/wordpress-stubs", + "require-dev": { + "php": "^7.4 || ^8.0", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "nikic/php-parser": "^4.13", + "php-stubs/generator": "^0.8.3", + "phpdocumentor/reflection-docblock": "^5.4.1", + "phpstan/phpstan": "^1.10.49", + "phpunit/phpunit": "^9.5", + "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^1.0", + "wp-coding-standards/wpcs": "3.1.0 as 2.3.0" + }, + "suggest": { + "paragonie/sodium_compat": "Pure PHP implementation of libsodium", + "symfony/polyfill-php80": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "szepeviktor/phpstan-wordpress": "WordPress extensions for PHPStan" + }, + "minimum-stability": "stable", + "autoload-dev": { + "psr-4": { + "PhpStubs\\WordPress\\Core\\": "src/" + }, + "classmap": [ + "tests/" + ] + }, + "config": { + "allow-plugins": { + "php-stubs/generator": true, + "dealerdirect/phpcodesniffer-composer-installer": true + }, + "platform": { + "php": "7.4.30" + } + }, + "scripts": { + "post-install-cmd": "@composer --working-dir=source/ update --no-interaction", + "post-update-cmd": "@composer --working-dir=source/ update --no-interaction", + "cleanup": "git status --short --ignored | sed -n -e 's#^!! ##p' | xargs -r rm -vrf", + "test": [ + "@test:phpunit", + "@test:phpstan", + "@test:cs" + ], + "test:cs": "phpcs", + "test:cs:fix": "phpcbf", + "test:phpstan": "phpstan analyze", + "test:phpunit": "phpunit" + }, + "scripts-descriptions": { + "cleanup": "Remove all ignored files." + } +} diff --git a/vendor/php-stubs/wordpress-stubs/phpcs.xml.dist b/vendor/php-stubs/wordpress-stubs/phpcs.xml.dist new file mode 100644 index 00000000..749a2337 --- /dev/null +++ b/vendor/php-stubs/wordpress-stubs/phpcs.xml.dist @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<ruleset> + <file>finder.php</file> + <file>functionMap.php</file> + <file>src/</file> + <file>visitor.php</file> + + <rule ref="PSR12NeutronRuleset"> + <exclude name="Generic.Files.LineLength"/> + <exclude name="PEAR.Commenting.ClassComment"/> + <exclude name="PEAR.Commenting.FileComment"/> + </rule> + +</ruleset> diff --git a/vendor/php-stubs/wordpress-stubs/wordpress-stubs.php b/vendor/php-stubs/wordpress-stubs/wordpress-stubs.php new file mode 100644 index 00000000..31d3ff41 --- /dev/null +++ b/vendor/php-stubs/wordpress-stubs/wordpress-stubs.php @@ -0,0 +1,146128 @@ +<?php +/** + * Generated stub declarations for WordPress. + * @see https://wordpress.org + * @see https://github.com/php-stubs/wordpress-stubs + */ + +namespace { + /** + * Upgrader API: WP_Upgrader_Skin class + * + * @package WordPress + * @subpackage Upgrader + * @since 4.6.0 + */ + /** + * Generic Skin for the WordPress Upgrader classes. This skin is designed to be extended for specific purposes. + * + * @since 2.8.0 + * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader-skins.php. + */ + #[\AllowDynamicProperties] + class WP_Upgrader_Skin + { + /** + * Holds the upgrader data. + * + * @since 2.8.0 + * @var WP_Upgrader + */ + public $upgrader; + /** + * Whether header is done. + * + * @since 2.8.0 + * @var bool + */ + public $done_header = \false; + /** + * Whether footer is done. + * + * @since 2.8.0 + * @var bool + */ + public $done_footer = \false; + /** + * Holds the result of an upgrade. + * + * @since 2.8.0 + * @var string|bool|WP_Error + */ + public $result = \false; + /** + * Holds the options of an upgrade. + * + * @since 2.8.0 + * @var array + */ + public $options = array(); + /** + * Constructor. + * + * Sets up the generic skin for the WordPress Upgrader classes. + * + * @since 2.8.0 + * + * @param array $args Optional. The WordPress upgrader skin arguments to + * override default options. Default empty array. + */ + public function __construct($args = array()) + { + } + /** + * Sets the relationship between the skin being used and the upgrader. + * + * @since 2.8.0 + * + * @param WP_Upgrader $upgrader + */ + public function set_upgrader(&$upgrader) + { + } + /** + * Sets up the strings used in the update process. + * + * @since 3.0.0 + */ + public function add_strings() + { + } + /** + * Sets the result of an upgrade. + * + * @since 2.8.0 + * + * @param string|bool|WP_Error $result The result of an upgrade. + */ + public function set_result($result) + { + } + /** + * Displays a form to the user to request for their FTP/SSH details in order + * to connect to the filesystem. + * + * @since 2.8.0 + * @since 4.6.0 The `$context` parameter default changed from `false` to an empty string. + * + * @see request_filesystem_credentials() + * + * @param bool|WP_Error $error Optional. Whether the current request has failed to connect, + * or an error object. Default false. + * @param string $context Optional. Full path to the directory that is tested + * for being writable. Default empty. + * @param bool $allow_relaxed_file_ownership Optional. Whether to allow Group/World writable. Default false. + * @return bool True on success, false on failure. + */ + public function request_filesystem_credentials($error = \false, $context = '', $allow_relaxed_file_ownership = \false) + { + } + /** + * Displays the header before the update process. + * + * @since 2.8.0 + * @phpstan-return void + */ + public function header() + { + } + /** + * Displays the footer following the update process. + * + * @since 2.8.0 + * @phpstan-return void + */ + public function footer() + { + } + /** + * Displays an error message about the update. + * + * @since 2.8.0 + * + * @param string|WP_Error $errors Errors. + */ + public function error($errors) + { + } + /** + * Displays a message about the update. + * + * @since 2.8.0 + * @since 5.9.0 Renamed `$string` (a PHP reserved keyword) to `$feedback` for PHP 8 named parameter support. + * + * @param string $feedback Message data. + * @param mixed ...$args Optional text replacements. + * @phpstan-return void + */ + public function feedback($feedback, ...$args) + { + } + /** + * Performs an action before an update. + * + * @since 2.8.0 + */ + public function before() + { + } + /** + * Performs an action following an update. + * + * @since 2.8.0 + */ + public function after() + { + } + /** + * Outputs JavaScript that calls function to decrement the update counts. + * + * @since 3.9.0 + * + * @param string $type Type of update count to decrement. Likely values include 'plugin', + * 'theme', 'translation', etc. + * @phpstan-return void + */ + protected function decrement_update_count($type) + { + } + /** + * Displays the header before the bulk update process. + * + * @since 3.0.0 + */ + public function bulk_header() + { + } + /** + * Displays the footer following the bulk update process. + * + * @since 3.0.0 + */ + public function bulk_footer() + { + } + /** + * Hides the `process_failed` error message when updating by uploading a zip file. + * + * @since 5.5.0 + * + * @param WP_Error $wp_error WP_Error object. + * @return bool True if the error should be hidden, false otherwise. + */ + public function hide_process_failed($wp_error) + { + } + } + /** + * Upgrader API: Automatic_Upgrader_Skin class + * + * @package WordPress + * @subpackage Upgrader + * @since 4.6.0 + */ + /** + * Upgrader Skin for Automatic WordPress Upgrades. + * + * This skin is designed to be used when no output is intended, all output + * is captured and stored for the caller to process and log/email/discard. + * + * @since 3.7.0 + * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader-skins.php. + * + * @see Bulk_Upgrader_Skin + */ + class Automatic_Upgrader_Skin extends \WP_Upgrader_Skin + { + protected $messages = array(); + /** + * Determines whether the upgrader needs FTP/SSH details in order to connect + * to the filesystem. + * + * @since 3.7.0 + * @since 4.6.0 The `$context` parameter default changed from `false` to an empty string. + * + * @see request_filesystem_credentials() + * + * @param bool|WP_Error $error Optional. Whether the current request has failed to connect, + * or an error object. Default false. + * @param string $context Optional. Full path to the directory that is tested + * for being writable. Default empty. + * @param bool $allow_relaxed_file_ownership Optional. Whether to allow Group/World writable. Default false. + * @return bool True on success, false on failure. + */ + public function request_filesystem_credentials($error = \false, $context = '', $allow_relaxed_file_ownership = \false) + { + } + /** + * Retrieves the upgrade messages. + * + * @since 3.7.0 + * + * @return string[] Messages during an upgrade. + */ + public function get_upgrade_messages() + { + } + /** + * Stores a message about the upgrade. + * + * @since 3.7.0 + * @since 5.9.0 Renamed `$data` to `$feedback` for PHP 8 named parameter support. + * + * @param string|array|WP_Error $feedback Message data. + * @param mixed ...$args Optional text replacements. + * @phpstan-return void + */ + public function feedback($feedback, ...$args) + { + } + /** + * Creates a new output buffer. + * + * @since 3.7.0 + */ + public function header() + { + } + /** + * Retrieves the buffered content, deletes the buffer, and processes the output. + * + * @since 3.7.0 + */ + public function footer() + { + } + } + /** + * Upgrader API: Bulk_Upgrader_Skin class + * + * @package WordPress + * @subpackage Upgrader + * @since 4.6.0 + */ + /** + * Generic Bulk Upgrader Skin for WordPress Upgrades. + * + * @since 3.0.0 + * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader-skins.php. + * + * @see WP_Upgrader_Skin + */ + class Bulk_Upgrader_Skin extends \WP_Upgrader_Skin + { + /** + * Whether the bulk update process has started. + * + * @since 3.0.0 + * @var bool + */ + public $in_loop = \false; + /** + * Stores an error message about the update. + * + * @since 3.0.0 + * @var string|false + */ + public $error = \false; + /** + * Constructor. + * + * Sets up the generic skin for the Bulk Upgrader classes. + * + * @since 3.0.0 + * + * @param array $args + */ + public function __construct($args = array()) + { + } + /** + * Sets up the strings used in the update process. + * + * @since 3.0.0 + */ + public function add_strings() + { + } + /** + * Displays a message about the update. + * + * @since 3.0.0 + * @since 5.9.0 Renamed `$string` (a PHP reserved keyword) to `$feedback` for PHP 8 named parameter support. + * + * @param string $feedback Message data. + * @param mixed ...$args Optional text replacements. + * @phpstan-return void + */ + public function feedback($feedback, ...$args) + { + } + /** + * Displays the header before the update process. + * + * @since 3.0.0 + */ + public function header() + { + } + /** + * Displays the footer following the update process. + * + * @since 3.0.0 + */ + public function footer() + { + } + /** + * Displays an error message about the update. + * + * @since 3.0.0 + * @since 5.9.0 Renamed `$error` to `$errors` for PHP 8 named parameter support. + * + * @param string|WP_Error $errors Errors. + */ + public function error($errors) + { + } + /** + * Displays the header before the bulk update process. + * + * @since 3.0.0 + */ + public function bulk_header() + { + } + /** + * Displays the footer following the bulk update process. + * + * @since 3.0.0 + */ + public function bulk_footer() + { + } + /** + * Performs an action before a bulk update. + * + * @since 3.0.0 + * + * @param string $title + */ + public function before($title = '') + { + } + /** + * Performs an action following a bulk update. + * + * @since 3.0.0 + * + * @param string $title + */ + public function after($title = '') + { + } + /** + * Resets the properties used in the update process. + * + * @since 3.0.0 + */ + public function reset() + { + } + /** + * Flushes all output buffers. + * + * @since 3.0.0 + */ + public function flush_output() + { + } + } + /** + * Upgrader API: Bulk_Plugin_Upgrader_Skin class + * + * @package WordPress + * @subpackage Upgrader + * @since 4.6.0 + */ + /** + * Bulk Plugin Upgrader Skin for WordPress Plugin Upgrades. + * + * @since 3.0.0 + * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader-skins.php. + * + * @see Bulk_Upgrader_Skin + */ + class Bulk_Plugin_Upgrader_Skin extends \Bulk_Upgrader_Skin + { + /** + * Plugin info. + * + * The Plugin_Upgrader::bulk_upgrade() method will fill this in + * with info retrieved from the get_plugin_data() function. + * + * @since 3.0.0 + * @var array Plugin data. Values will be empty if not supplied by the plugin. + */ + public $plugin_info = array(); + /** + * Sets up the strings used in the update process. + * + * @since 3.0.0 + */ + public function add_strings() + { + } + /** + * Performs an action before a bulk plugin update. + * + * @since 3.0.0 + * + * @param string $title + */ + public function before($title = '') + { + } + /** + * Performs an action following a bulk plugin update. + * + * @since 3.0.0 + * + * @param string $title + */ + public function after($title = '') + { + } + /** + * Displays the footer following the bulk update process. + * + * @since 3.0.0 + */ + public function bulk_footer() + { + } + } + /** + * Upgrader API: Bulk_Plugin_Upgrader_Skin class + * + * @package WordPress + * @subpackage Upgrader + * @since 4.6.0 + */ + /** + * Bulk Theme Upgrader Skin for WordPress Theme Upgrades. + * + * @since 3.0.0 + * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader-skins.php. + * + * @see Bulk_Upgrader_Skin + */ + class Bulk_Theme_Upgrader_Skin extends \Bulk_Upgrader_Skin + { + /** + * Theme info. + * + * The Theme_Upgrader::bulk_upgrade() method will fill this in + * with info retrieved from the Theme_Upgrader::theme_info() method, + * which in turn calls the wp_get_theme() function. + * + * @since 3.0.0 + * @var WP_Theme|false The theme's info object, or false. + */ + public $theme_info = \false; + /** + * Sets up the strings used in the update process. + * + * @since 3.0.0 + */ + public function add_strings() + { + } + /** + * Performs an action before a bulk theme update. + * + * @since 3.0.0 + * + * @param string $title + */ + public function before($title = '') + { + } + /** + * Performs an action following a bulk theme update. + * + * @since 3.0.0 + * + * @param string $title + */ + public function after($title = '') + { + } + /** + * Displays the footer following the bulk update process. + * + * @since 3.0.0 + */ + public function bulk_footer() + { + } + } + /** + * Core class used for upgrading/installing a local set of files via + * the Filesystem Abstraction classes from a Zip file. + * + * @since 2.8.0 + */ + #[\AllowDynamicProperties] + class WP_Upgrader + { + /** + * The error/notification strings used to update the user on the progress. + * + * @since 2.8.0 + * @var array $strings + */ + public $strings = array(); + /** + * The upgrader skin being used. + * + * @since 2.8.0 + * @var Automatic_Upgrader_Skin|WP_Upgrader_Skin $skin + */ + public $skin = \null; + /** + * The result of the installation. + * + * This is set by WP_Upgrader::install_package(), only when the package is installed + * successfully. It will then be an array, unless a WP_Error is returned by the + * {@see 'upgrader_post_install'} filter. In that case, the WP_Error will be assigned to + * it. + * + * @since 2.8.0 + * + * @var array|WP_Error $result { + * @type string $source The full path to the source the files were installed from. + * @type string $source_files List of all the files in the source directory. + * @type string $destination The full path to the installation destination folder. + * @type string $destination_name The name of the destination folder, or empty if `$destination` + * and `$local_destination` are the same. + * @type string $local_destination The full local path to the destination folder. This is usually + * the same as `$destination`. + * @type string $remote_destination The full remote path to the destination folder + * (i.e., from `$wp_filesystem`). + * @type bool $clear_destination Whether the destination folder was cleared. + * } + * @phpstan-var \WP_Error|array{ + * source: string, + * source_files: string, + * destination: string, + * destination_name: string, + * local_destination: string, + * remote_destination: string, + * clear_destination: bool, + * } + */ + public $result = array(); + /** + * The total number of updates being performed. + * + * Set by the bulk update methods. + * + * @since 3.0.0 + * @var int $update_count + */ + public $update_count = 0; + /** + * The current update if multiple updates are being performed. + * + * Used by the bulk update methods, and incremented for each update. + * + * @since 3.0.0 + * @var int + */ + public $update_current = 0; + /** + * Construct the upgrader with a skin. + * + * @since 2.8.0 + * + * @param WP_Upgrader_Skin $skin The upgrader skin to use. Default is a WP_Upgrader_Skin + * instance. + */ + public function __construct($skin = \null) + { + } + /** + * Initializes the upgrader. + * + * This will set the relationship between the skin being used and this upgrader, + * and also add the generic strings to `WP_Upgrader::$strings`. + * + * Additionally, it will schedule a weekly task to clean up the temporary backup directory. + * + * @since 2.8.0 + * @since 6.3.0 Added the `schedule_temp_backup_cleanup()` task. + */ + public function init() + { + } + /** + * Schedules the cleanup of the temporary backup directory. + * + * @since 6.3.0 + */ + protected function schedule_temp_backup_cleanup() + { + } + /** + * Adds the generic strings to WP_Upgrader::$strings. + * + * @since 2.8.0 + */ + public function generic_strings() + { + } + /** + * Connects to the filesystem. + * + * @since 2.8.0 + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @param string[] $directories Optional. Array of directories. If any of these do + * not exist, a WP_Error object will be returned. + * Default empty array. + * @param bool $allow_relaxed_file_ownership Whether to allow relaxed file ownership. + * Default false. + * @return bool|WP_Error True if able to connect, false or a WP_Error otherwise. + */ + public function fs_connect($directories = array(), $allow_relaxed_file_ownership = \false) + { + } + /** + * Downloads a package. + * + * @since 2.8.0 + * @since 5.2.0 Added the `$check_signatures` parameter. + * @since 5.5.0 Added the `$hook_extra` parameter. + * + * @param string $package The URI of the package. If this is the full path to an + * existing local file, it will be returned untouched. + * @param bool $check_signatures Whether to validate file signatures. Default false. + * @param array $hook_extra Extra arguments to pass to the filter hooks. Default empty array. + * @return string|WP_Error The full path to the downloaded package file, or a WP_Error object. + */ + public function download_package($package, $check_signatures = \false, $hook_extra = array()) + { + } + /** + * Unpacks a compressed package file. + * + * @since 2.8.0 + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @param string $package Full path to the package file. + * @param bool $delete_package Optional. Whether to delete the package file after attempting + * to unpack it. Default true. + * @return string|WP_Error The path to the unpacked contents, or a WP_Error on failure. + */ + public function unpack_package($package, $delete_package = \true) + { + } + /** + * Flattens the results of WP_Filesystem_Base::dirlist() for iterating over. + * + * @since 4.9.0 + * @access protected + * + * @param array $nested_files Array of files as returned by WP_Filesystem_Base::dirlist(). + * @param string $path Relative path to prepend to child nodes. Optional. + * @return array A flattened array of the $nested_files specified. + */ + protected function flatten_dirlist($nested_files, $path = '') + { + } + /** + * Clears the directory where this item is going to be installed into. + * + * @since 4.3.0 + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @param string $remote_destination The location on the remote filesystem to be cleared. + * @return true|WP_Error True upon success, WP_Error on failure. + */ + public function clear_destination($remote_destination) + { + } + /** + * Install a package. + * + * Copies the contents of a package from a source directory, and installs them in + * a destination directory. Optionally removes the source. It can also optionally + * clear out the destination folder if it already exists. + * + * @since 2.8.0 + * @since 6.2.0 Use move_dir() instead of copy_dir() when possible. + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * @global array $wp_theme_directories + * + * @param array|string $args { + * Optional. Array or string of arguments for installing a package. Default empty array. + * + * @type string $source Required path to the package source. Default empty. + * @type string $destination Required path to a folder to install the package in. + * Default empty. + * @type bool $clear_destination Whether to delete any files already in the destination + * folder. Default false. + * @type bool $clear_working Whether to delete the files from the working directory + * after copying them to the destination. Default false. + * @type bool $abort_if_destination_exists Whether to abort the installation if + * the destination folder already exists. Default true. + * @type array $hook_extra Extra arguments to pass to the filter hooks called by + * WP_Upgrader::install_package(). Default empty array. + * } + * + * @return array|WP_Error The result (also stored in `WP_Upgrader::$result`), or a WP_Error on failure. + * @phpstan-param array{ + * source?: string, + * destination?: string, + * clear_destination?: bool, + * clear_working?: bool, + * abort_if_destination_exists?: bool, + * hook_extra?: array, + * } $args + */ + public function install_package($args = array()) + { + } + /** + * Runs an upgrade/installation. + * + * Attempts to download the package (if it is not a local file), unpack it, and + * install it in the destination folder. + * + * @since 2.8.0 + * + * @param array $options { + * Array or string of arguments for upgrading/installing a package. + * + * @type string $package The full path or URI of the package to install. + * Default empty. + * @type string $destination The full path to the destination folder. + * Default empty. + * @type bool $clear_destination Whether to delete any files already in the + * destination folder. Default false. + * @type bool $clear_working Whether to delete the files from the working + * directory after copying them to the destination. + * Default true. + * @type bool $abort_if_destination_exists Whether to abort the installation if the destination + * folder already exists. When true, `$clear_destination` + * should be false. Default true. + * @type bool $is_multi Whether this run is one of multiple upgrade/installation + * actions being performed in bulk. When true, the skin + * WP_Upgrader::header() and WP_Upgrader::footer() + * aren't called. Default false. + * @type array $hook_extra Extra arguments to pass to the filter hooks called by + * WP_Upgrader::run(). + * } + * @return array|false|WP_Error The result from self::install_package() on success, otherwise a WP_Error, + * or false if unable to connect to the filesystem. + * @phpstan-param array{ + * package?: string, + * destination?: string, + * clear_destination?: bool, + * clear_working?: bool, + * abort_if_destination_exists?: bool, + * is_multi?: bool, + * hook_extra?: array, + * } $options + */ + public function run($options) + { + } + /** + * Toggles maintenance mode for the site. + * + * Creates/deletes the maintenance file to enable/disable maintenance mode. + * + * @since 2.8.0 + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @param bool $enable True to enable maintenance mode, false to disable. + */ + public function maintenance_mode($enable = \false) + { + } + /** + * Creates a lock using WordPress options. + * + * @since 4.5.0 + * + * @global wpdb $wpdb The WordPress database abstraction object. + * + * @param string $lock_name The name of this unique lock. + * @param int $release_timeout Optional. The duration in seconds to respect an existing lock. + * Default: 1 hour. + * @return bool False if a lock couldn't be created or if the lock is still valid. True otherwise. + */ + public static function create_lock($lock_name, $release_timeout = \null) + { + } + /** + * Releases an upgrader lock. + * + * @since 4.5.0 + * + * @see WP_Upgrader::create_lock() + * + * @param string $lock_name The name of this unique lock. + * @return bool True if the lock was successfully released. False on failure. + */ + public static function release_lock($lock_name) + { + } + /** + * Moves the plugin or theme being updated into a temporary backup directory. + * + * @since 6.3.0 + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @param string[] $args { + * Array of data for the temporary backup. + * + * @type string $slug Plugin or theme slug. + * @type string $src Path to the root directory for plugins or themes. + * @type string $dir Destination subdirectory name. Accepts 'plugins' or 'themes'. + * } + * + * @return bool|WP_Error True on success, false on early exit, otherwise WP_Error. + * @phpstan-param array{ + * slug?: string, + * src?: string, + * dir?: string, + * } $args + */ + public function move_to_temp_backup_dir($args) + { + } + /** + * Restores the plugin or theme from temporary backup. + * + * @since 6.3.0 + * @since 6.6.0 Added the `$temp_backups` parameter. + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @param array[] $temp_backups { + * Optional. An array of temporary backups. + * + * @type array ...$0 { + * Information about the backup. + * + * @type string $dir The temporary backup location in the upgrade-temp-backup directory. + * @type string $slug The item's slug. + * @type string $src The directory where the original is stored. For example, `WP_PLUGIN_DIR`. + * } + * } + * @return bool|WP_Error True on success, false on early exit, otherwise WP_Error. + * @phpstan-param array<int|string, array{ + * dir: string, + * slug: string, + * src: string, + * }> $temp_backups + */ + public function restore_temp_backup(array $temp_backups = array()) + { + } + /** + * Deletes a temporary backup. + * + * @since 6.3.0 + * @since 6.6.0 Added the `$temp_backups` parameter. + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @param array[] $temp_backups { + * Optional. An array of temporary backups. + * + * @type array ...$0 { + * Information about the backup. + * + * @type string $dir The temporary backup location in the upgrade-temp-backup directory. + * @type string $slug The item's slug. + * @type string $src The directory where the original is stored. For example, `WP_PLUGIN_DIR`. + * } + * } + * @return bool|WP_Error True on success, false on early exit, otherwise WP_Error. + * @phpstan-param array<int|string, array{ + * dir: string, + * slug: string, + * src: string, + * }> $temp_backups + */ + public function delete_temp_backup(array $temp_backups = array()) + { + } + } + /** + * Upgrade API: Core_Upgrader class + * + * @package WordPress + * @subpackage Upgrader + * @since 4.6.0 + */ + /** + * Core class used for updating core. + * + * It allows for WordPress to upgrade itself in combination with + * the wp-admin/includes/update-core.php file. + * + * @since 2.8.0 + * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader.php. + * + * @see WP_Upgrader + */ + class Core_Upgrader extends \WP_Upgrader + { + /** + * Initializes the upgrade strings. + * + * @since 2.8.0 + */ + public function upgrade_strings() + { + } + /** + * Upgrades WordPress core. + * + * @since 2.8.0 + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * @global callable $_wp_filesystem_direct_method + * + * @param object $current Response object for whether WordPress is current. + * @param array $args { + * Optional. Arguments for upgrading WordPress core. Default empty array. + * + * @type bool $pre_check_md5 Whether to check the file checksums before + * attempting the upgrade. Default true. + * @type bool $attempt_rollback Whether to attempt to rollback the chances if + * there is a problem. Default false. + * @type bool $do_rollback Whether to perform this "upgrade" as a rollback. + * Default false. + * } + * @return string|false|WP_Error New WordPress version on success, false or WP_Error on failure. + * @phpstan-param array{ + * pre_check_md5?: bool, + * attempt_rollback?: bool, + * do_rollback?: bool, + * } $args + */ + public function upgrade($current, $args = array()) + { + } + /** + * Determines if this WordPress Core version should update to an offered version or not. + * + * @since 3.7.0 + * + * @param string $offered_ver The offered version, of the format x.y.z. + * @return bool True if we should update to the offered version, otherwise false. + */ + public static function should_update_to_version($offered_ver) + { + } + /** + * Compares the disk file checksums against the expected checksums. + * + * @since 3.7.0 + * + * @global string $wp_version The WordPress version string. + * @global string $wp_local_package Locale code of the package. + * + * @return bool True if the checksums match, otherwise false. + */ + public function check_files() + { + } + } + /** + * The custom background script. + * + * @package WordPress + * @subpackage Administration + */ + /** + * The custom background class. + * + * @since 3.0.0 + */ + #[\AllowDynamicProperties] + class Custom_Background + { + /** + * Callback for administration header. + * + * @var callable + * @since 3.0.0 + */ + public $admin_header_callback; + /** + * Callback for header div. + * + * @var callable + * @since 3.0.0 + */ + public $admin_image_div_callback; + /** + * Constructor - Registers administration header callback. + * + * @since 3.0.0 + * + * @param callable $admin_header_callback Optional. Administration header callback. + * Default empty string. + * @param callable $admin_image_div_callback Optional. Custom image div output callback. + * Default empty string. + */ + public function __construct($admin_header_callback = '', $admin_image_div_callback = '') + { + } + /** + * Sets up the hooks for the Custom Background admin page. + * + * @since 3.0.0 + * @phpstan-return void + */ + public function init() + { + } + /** + * Sets up the enqueue for the CSS & JavaScript files. + * + * @since 3.0.0 + */ + public function admin_load() + { + } + /** + * Executes custom background modification. + * + * @since 3.0.0 + * @phpstan-return void + */ + public function take_action() + { + } + /** + * Displays the custom background page. + * + * @since 3.0.0 + */ + public function admin_page() + { + } + /** + * Handles an Image upload for the background image. + * + * @since 3.0.0 + * @phpstan-return void + */ + public function handle_upload() + { + } + /** + * Handles Ajax request for adding custom background context to an attachment. + * + * Triggers when the user adds a new background image from the + * Media Manager. + * + * @since 4.1.0 + * @phpstan-return never + */ + public function ajax_background_add() + { + } + /** + * @since 3.4.0 + * @deprecated 3.5.0 + * + * @param array $form_fields + * @return array $form_fields + */ + public function attachment_fields_to_edit($form_fields) + { + } + /** + * @since 3.4.0 + * @deprecated 3.5.0 + * + * @param array $tabs + * @return array $tabs + */ + public function filter_upload_tabs($tabs) + { + } + /** + * @since 3.4.0 + * @deprecated 3.5.0 + * @phpstan-return never + */ + public function wp_set_background_image() + { + } + } + /** + * The custom header image script. + * + * @package WordPress + * @subpackage Administration + */ + /** + * The custom header image class. + * + * @since 2.1.0 + */ + #[\AllowDynamicProperties] + class Custom_Image_Header + { + /** + * Callback for administration header. + * + * @var callable + * @since 2.1.0 + */ + public $admin_header_callback; + /** + * Callback for header div. + * + * @var callable + * @since 3.0.0 + */ + public $admin_image_div_callback; + /** + * Holds default headers. + * + * @var array + * @since 3.0.0 + */ + public $default_headers = array(); + /** + * Constructor - Registers administration header callback. + * + * @since 2.1.0 + * + * @param callable $admin_header_callback Administration header callback. + * @param callable $admin_image_div_callback Optional. Custom image div output callback. + * Default empty string. + */ + public function __construct($admin_header_callback, $admin_image_div_callback = '') + { + } + /** + * Sets up the hooks for the Custom Header admin page. + * + * @since 2.1.0 + * @phpstan-return void + */ + public function init() + { + } + /** + * Adds contextual help. + * + * @since 3.0.0 + */ + public function help() + { + } + /** + * Gets the current step. + * + * @since 2.6.0 + * + * @return int Current step. + */ + public function step() + { + } + /** + * Sets up the enqueue for the JavaScript files. + * + * @since 2.1.0 + */ + public function js_includes() + { + } + /** + * Sets up the enqueue for the CSS files. + * + * @since 2.7.0 + */ + public function css_includes() + { + } + /** + * Executes custom header modification. + * + * @since 2.6.0 + * @phpstan-return void + */ + public function take_action() + { + } + /** + * Processes the default headers. + * + * @since 3.0.0 + * + * @global array $_wp_default_headers + * @phpstan-return void + */ + public function process_default_headers() + { + } + /** + * Displays UI for selecting one of several default headers. + * + * Shows the random image option if this theme has multiple header images. + * Random image option is on by default if no header has been set. + * + * @since 3.0.0 + * + * @param string $type The header type. One of 'default' (for the Uploaded Images control) + * or 'uploaded' (for the Uploaded Images control). + */ + public function show_header_selector($type = 'default') + { + } + /** + * Executes JavaScript depending on step. + * + * @since 2.1.0 + */ + public function js() + { + } + /** + * Displays JavaScript based on Step 1 and 3. + * + * @since 2.6.0 + */ + public function js_1() + { + } + /** + * Displays JavaScript based on Step 2. + * + * @since 2.6.0 + */ + public function js_2() + { + } + /** + * Displays first step of custom header image page. + * + * @since 2.1.0 + */ + public function step_1() + { + } + /** + * Displays second step of custom header image page. + * + * @since 2.1.0 + */ + public function step_2() + { + } + /** + * Uploads the file to be cropped in the second step. + * + * @since 3.4.0 + */ + public function step_2_manage_upload() + { + } + /** + * Displays third step of custom header image page. + * + * @since 2.1.0 + * @since 4.4.0 Switched to using wp_get_attachment_url() instead of the guid + * for retrieving the header image URL. + */ + public function step_3() + { + } + /** + * Displays last step of custom header image page. + * + * @since 2.1.0 + */ + public function finished() + { + } + /** + * Displays the page based on the current step. + * + * @since 2.1.0 + */ + public function admin_page() + { + } + /** + * Unused since 3.5.0. + * + * @since 3.4.0 + * + * @param array $form_fields + * @return array $form_fields + */ + public function attachment_fields_to_edit($form_fields) + { + } + /** + * Unused since 3.5.0. + * + * @since 3.4.0 + * + * @param array $tabs + * @return array $tabs + */ + public function filter_upload_tabs($tabs) + { + } + /** + * Chooses a header image, selected from existing uploaded and default headers, + * or provides an array of uploaded header data (either new, or from media library). + * + * @since 3.4.0 + * + * @param mixed $choice Which header image to select. Allows for values of 'random-default-image', + * for randomly cycling among the default images; 'random-uploaded-image', + * for randomly cycling among the uploaded images; the key of a default image + * registered for that theme; and the key of an image uploaded for that theme + * (the attachment ID of the image). Or an array of arguments: attachment_id, + * url, width, height. All are required. + * @phpstan-return void + */ + public final function set_header_image($choice) + { + } + /** + * Removes a header image. + * + * @since 3.4.0 + */ + public final function remove_header_image() + { + } + /** + * Resets a header image to the default image for the theme. + * + * This method does not do anything if the theme does not have a default header image. + * + * @since 3.4.0 + * @phpstan-return void + */ + public final function reset_header_image() + { + } + /** + * Calculates width and height based on what the currently selected theme supports. + * + * @since 3.9.0 + * + * @param array $dimensions + * @return array dst_height and dst_width of header image. + */ + public final function get_header_dimensions($dimensions) + { + } + /** + * Creates an attachment 'object'. + * + * @since 3.9.0 + * @deprecated 6.5.0 + * + * @param string $cropped Cropped image URL. + * @param int $parent_attachment_id Attachment ID of parent image. + * @return array An array with attachment object data. + */ + public final function create_attachment_object($cropped, $parent_attachment_id) + { + } + /** + * Inserts an attachment and its metadata. + * + * @since 3.9.0 + * + * @param array $attachment An array with attachment object data. + * @param string $cropped File path to cropped image. + * @return int Attachment ID. + */ + public final function insert_attachment($attachment, $cropped) + { + } + /** + * Gets attachment uploaded by Media Manager, crops it, then saves it as a + * new object. Returns JSON-encoded object details. + * + * @since 3.9.0 + * @phpstan-return never + */ + public function ajax_header_crop() + { + } + /** + * Given an attachment ID for a header image, updates its "last used" + * timestamp to now. + * + * Triggered when the user tries adds a new header image from the + * Media Manager, even if s/he doesn't save that change. + * + * @since 3.9.0 + * @phpstan-return never + */ + public function ajax_header_add() + { + } + /** + * Given an attachment ID for a header image, unsets it as a user-uploaded + * header image for the active theme. + * + * Triggered when the user clicks the overlay "X" button next to each image + * choice in the Customizer's Header tool. + * + * @since 3.9.0 + * @phpstan-return never + */ + public function ajax_header_remove() + { + } + /** + * Updates the last-used postmeta on a header image attachment after saving a new header image via the Customizer. + * + * @since 3.9.0 + * + * @param WP_Customize_Manager $wp_customize Customize manager. + * @phpstan-return void + */ + public function customize_set_last_used($wp_customize) + { + } + /** + * Gets the details of default header images if defined. + * + * @since 3.9.0 + * + * @return array Default header images. + */ + public function get_default_header_images() + { + } + /** + * Gets the previously uploaded header images. + * + * @since 3.9.0 + * + * @return array Uploaded header images. + */ + public function get_uploaded_header_images() + { + } + /** + * Gets the ID of a previous crop from the same base image. + * + * @since 4.9.0 + * + * @param array $attachment An array with a cropped attachment object data. + * @return int|false An attachment ID if one exists. False if none. + */ + public function get_previous_crop($attachment) + { + } + } + /** + * Upgrade API: File_Upload_Upgrader class + * + * @package WordPress + * @subpackage Upgrader + * @since 4.6.0 + */ + /** + * Core class used for handling file uploads. + * + * This class handles the upload process and passes it as if it's a local file + * to the Upgrade/Installer functions. + * + * @since 2.8.0 + * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader.php. + */ + #[\AllowDynamicProperties] + class File_Upload_Upgrader + { + /** + * The full path to the file package. + * + * @since 2.8.0 + * @var string $package + */ + public $package; + /** + * The name of the file. + * + * @since 2.8.0 + * @var string $filename + */ + public $filename; + /** + * The ID of the attachment post for this file. + * + * @since 3.3.0 + * @var int $id + */ + public $id = 0; + /** + * Construct the upgrader for a form. + * + * @since 2.8.0 + * + * @param string $form The name of the form the file was uploaded from. + * @param string $urlholder The name of the `GET` parameter that holds the filename. + */ + public function __construct($form, $urlholder) + { + } + /** + * Deletes the attachment/uploaded file. + * + * @since 3.2.2 + * + * @return bool Whether the cleanup was successful. + */ + public function cleanup() + { + } + } + /** + * PemFTP base class + * + */ + class ftp_base + { + /* Public variables */ + var $LocalEcho; + var $Verbose; + var $OS_local; + var $OS_remote; + /* Private variables */ + var $_lastaction; + var $_errors; + var $_type; + var $_umask; + var $_timeout; + var $_passive; + var $_host; + var $_fullhost; + var $_port; + var $_datahost; + var $_dataport; + var $_ftp_control_sock; + var $_ftp_data_sock; + var $_ftp_temp_sock; + var $_ftp_buff_size; + var $_login; + var $_password; + var $_connected; + var $_ready; + var $_code; + var $_message; + var $_can_restore; + var $_port_available; + var $_curtype; + var $_features; + var $_error_array; + var $AuthorizedTransferMode; + var $OS_FullName; + var $_eol_code; + var $AutoAsciiExt; + /* Constructor */ + function __construct($port_mode = \FALSE, $verb = \FALSE, $le = \FALSE) + { + } + function ftp_base($port_mode = \FALSE) + { + } + // <!-- --------------------------------------------------------------------------------------- --> + // <!-- Public functions --> + // <!-- --------------------------------------------------------------------------------------- --> + function parselisting($line) + { + } + function SendMSG($message = "", $crlf = \true) + { + } + function SetType($mode = \FTP_AUTOASCII) + { + } + function _settype($mode = \FTP_ASCII) + { + } + function Passive($pasv = \NULL) + { + } + function SetServer($host, $port = 21, $reconnect = \true) + { + } + function SetUmask($umask = 022) + { + } + function SetTimeout($timeout = 30) + { + } + function connect($server = \NULL) + { + } + function quit($force = \false) + { + } + function login($user = \NULL, $pass = \NULL) + { + } + function pwd() + { + } + function cdup() + { + } + function chdir($pathname) + { + } + function rmdir($pathname) + { + } + function mkdir($pathname) + { + } + function rename($from, $to) + { + } + function filesize($pathname) + { + } + function abort() + { + } + function mdtm($pathname) + { + } + function systype() + { + } + function delete($pathname) + { + } + function site($command, $fnction = "site") + { + } + function chmod($pathname, $mode) + { + } + function restore($from) + { + } + function features() + { + } + function rawlist($pathname = "", $arg = "") + { + } + function nlist($pathname = "", $arg = "") + { + } + function is_exists($pathname) + { + } + function file_exists($pathname) + { + } + function fget($fp, $remotefile, $rest = 0) + { + } + function get($remotefile, $localfile = \NULL, $rest = 0) + { + } + function fput($remotefile, $fp, $rest = 0) + { + } + function put($localfile, $remotefile = \NULL, $rest = 0) + { + } + function mput($local = ".", $remote = \NULL, $continious = \false) + { + } + function mget($remote, $local = ".", $continious = \false) + { + } + function mdel($remote, $continious = \false) + { + } + function mmkdir($dir, $mode = 0777) + { + } + function glob($pattern, $handle = \NULL) + { + } + function glob_pattern_match($pattern, $subject) + { + } + function glob_regexp($pattern, $subject) + { + } + function dirlist($remote) + { + } + // <!-- --------------------------------------------------------------------------------------- --> + // <!-- Private functions --> + // <!-- --------------------------------------------------------------------------------------- --> + function _checkCode() + { + } + function _list($arg = "", $cmd = "LIST", $fnction = "_list") + { + } + // <!-- --------------------------------------------------------------------------------------- --> + // <!-- Partie : gestion des erreurs --> + // <!-- --------------------------------------------------------------------------------------- --> + // Gnre une erreur pour traitement externe la classe + function PushError($fctname, $msg, $desc = \false) + { + } + // Rcupre une erreur externe + function PopError() + { + } + } + /** + * PemFTP - An Ftp implementation in pure PHP + * + * @package PemFTP + * @since 2.5.0 + * + * @version 1.0 + * @copyright Alexey Dotsenko + * @author Alexey Dotsenko + * @link https://www.phpclasses.org/package/1743-PHP-FTP-client-in-pure-PHP.html + * @license LGPL https://opensource.org/licenses/lgpl-license.html + */ + /** + * FTP implementation using fsockopen to connect. + * + * @package PemFTP + * @subpackage Pure + * @since 2.5.0 + * + * @version 1.0 + * @copyright Alexey Dotsenko + * @author Alexey Dotsenko + * @link https://www.phpclasses.org/package/1743-PHP-FTP-client-in-pure-PHP.html + * @license LGPL https://opensource.org/licenses/lgpl-license.html + */ + class ftp_pure extends \ftp_base + { + function __construct($verb = \FALSE, $le = \FALSE) + { + } + // <!-- --------------------------------------------------------------------------------------- --> + // <!-- Private functions --> + // <!-- --------------------------------------------------------------------------------------- --> + function _settimeout($sock) + { + } + function _connect($host, $port) + { + } + function _readmsg($fnction = "_readmsg") + { + } + function _exec($cmd, $fnction = "_exec") + { + } + function _data_prepare($mode = \FTP_ASCII) + { + } + function _data_read($mode = \FTP_ASCII, $fp = \NULL) + { + } + function _data_write($mode = \FTP_ASCII, $fp = \NULL) + { + } + function _data_write_block($mode, $block) + { + } + function _data_close() + { + } + function _quit($force = \FALSE) + { + } + } + /** + * PemFTP - An Ftp implementation in pure PHP + * + * @package PemFTP + * @since 2.5.0 + * + * @version 1.0 + * @copyright Alexey Dotsenko + * @author Alexey Dotsenko + * @link https://www.phpclasses.org/package/1743-PHP-FTP-client-in-pure-PHP.html + * @license LGPL https://opensource.org/licenses/lgpl-license.html + */ + /** + * Socket Based FTP implementation + * + * @package PemFTP + * @subpackage Socket + * @since 2.5.0 + * + * @version 1.0 + * @copyright Alexey Dotsenko + * @author Alexey Dotsenko + * @link https://www.phpclasses.org/package/1743-PHP-FTP-client-in-pure-PHP.html + * @license LGPL https://opensource.org/licenses/lgpl-license.html + */ + class ftp_sockets extends \ftp_base + { + function __construct($verb = \FALSE, $le = \FALSE) + { + } + // <!-- --------------------------------------------------------------------------------------- --> + // <!-- Private functions --> + // <!-- --------------------------------------------------------------------------------------- --> + function _settimeout($sock) + { + } + function _connect($host, $port) + { + } + function _readmsg($fnction = "_readmsg") + { + } + function _exec($cmd, $fnction = "_exec") + { + } + function _data_prepare($mode = \FTP_ASCII) + { + } + function _data_read($mode = \FTP_ASCII, $fp = \NULL) + { + } + function _data_write($mode = \FTP_ASCII, $fp = \NULL) + { + } + function _data_write_block($mode, $block) + { + } + function _data_close() + { + } + function _quit() + { + } + } + class ftp extends \ftp_sockets + { + } + /** + * Upgrader API: Language_Pack_Upgrader_Skin class + * + * @package WordPress + * @subpackage Upgrader + * @since 4.6.0 + */ + /** + * Translation Upgrader Skin for WordPress Translation Upgrades. + * + * @since 3.7.0 + * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader-skins.php. + * + * @see WP_Upgrader_Skin + */ + class Language_Pack_Upgrader_Skin extends \WP_Upgrader_Skin + { + public $language_update = \null; + public $done_header = \false; + public $done_footer = \false; + public $display_footer_actions = \true; + /** + * Constructor. + * + * Sets up the language pack upgrader skin. + * + * @since 3.7.0 + * + * @param array $args + */ + public function __construct($args = array()) + { + } + /** + * Performs an action before a language pack update. + * + * @since 3.7.0 + */ + public function before() + { + } + /** + * Displays an error message about the update. + * + * @since 3.7.0 + * @since 5.9.0 Renamed `$error` to `$errors` for PHP 8 named parameter support. + * + * @param string|WP_Error $errors Errors. + */ + public function error($errors) + { + } + /** + * Performs an action following a language pack update. + * + * @since 3.7.0 + */ + public function after() + { + } + /** + * Displays the footer following the bulk update process. + * + * @since 3.7.0 + */ + public function bulk_footer() + { + } + } + /** + * Upgrade API: Language_Pack_Upgrader class + * + * @package WordPress + * @subpackage Upgrader + * @since 4.6.0 + */ + /** + * Core class used for updating/installing language packs (translations) + * for plugins, themes, and core. + * + * @since 3.7.0 + * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader.php. + * + * @see WP_Upgrader + */ + class Language_Pack_Upgrader extends \WP_Upgrader + { + /** + * Result of the language pack upgrade. + * + * @since 3.7.0 + * @var array|WP_Error $result + * @see WP_Upgrader::$result + */ + public $result; + /** + * Whether a bulk upgrade/installation is being performed. + * + * @since 3.7.0 + * @var bool $bulk + */ + public $bulk = \true; + /** + * Asynchronously upgrades language packs after other upgrades have been made. + * + * Hooked to the {@see 'upgrader_process_complete'} action by default. + * + * @since 3.7.0 + * + * @param false|WP_Upgrader $upgrader Optional. WP_Upgrader instance or false. If `$upgrader` is + * a Language_Pack_Upgrader instance, the method will bail to + * avoid recursion. Otherwise unused. Default false. + * @phpstan-return void + */ + public static function async_upgrade($upgrader = \false) + { + } + /** + * Initializes the upgrade strings. + * + * @since 3.7.0 + */ + public function upgrade_strings() + { + } + /** + * Upgrades a language pack. + * + * @since 3.7.0 + * + * @param string|false $update Optional. Whether an update offer is available. Default false. + * @param array $args Optional. Other optional arguments, see + * Language_Pack_Upgrader::bulk_upgrade(). Default empty array. + * @return array|bool|WP_Error The result of the upgrade, or a WP_Error object instead. + * @phpstan-param array{ + * clear_update_cache?: bool, + * } $args See Language_Pack_Upgrader::bulk_upgrade() + */ + public function upgrade($update = \false, $args = array()) + { + } + /** + * Upgrades several language packs at once. + * + * @since 3.7.0 + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @param object[] $language_updates Optional. Array of language packs to update. See {@see wp_get_translation_updates()}. + * Default empty array. + * @param array $args { + * Other arguments for upgrading multiple language packs. Default empty array. + * + * @type bool $clear_update_cache Whether to clear the update cache when done. + * Default true. + * } + * @return array|bool|WP_Error Will return an array of results, or true if there are no updates, + * false or WP_Error for initial errors. + * @phpstan-param array{ + * clear_update_cache?: bool, + * } $args + */ + public function bulk_upgrade($language_updates = array(), $args = array()) + { + } + /** + * Checks that the package source contains .mo and .po files. + * + * Hooked to the {@see 'upgrader_source_selection'} filter by + * Language_Pack_Upgrader::bulk_upgrade(). + * + * @since 3.7.0 + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @param string|WP_Error $source The path to the downloaded package source. + * @param string $remote_source Remote file source location. + * @return string|WP_Error The source as passed, or a WP_Error object on failure. + */ + public function check_package($source, $remote_source) + { + } + /** + * Gets the name of an item being updated. + * + * @since 3.7.0 + * + * @param object $update The data for an update. + * @return string The name of the item being updated. + */ + public function get_name_for_update($update) + { + } + /** + * Clears existing translations where this item is going to be installed into. + * + * @since 5.1.0 + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @param string $remote_destination The location on the remote filesystem to be cleared. + * @return bool|WP_Error True upon success, WP_Error on failure. + */ + public function clear_destination($remote_destination) + { + } + } + /* For future use + define( 'PCLZIP_CB_PRE_LIST', 78005 ); + define( 'PCLZIP_CB_POST_LIST', 78006 ); + define( 'PCLZIP_CB_PRE_DELETE', 78007 ); + define( 'PCLZIP_CB_POST_DELETE', 78008 ); + */ + // -------------------------------------------------------------------------------- + // Class : PclZip + // Description : + // PclZip is the class that represent a Zip archive. + // The public methods allow the manipulation of the archive. + // Attributes : + // Attributes must not be accessed directly. + // Methods : + // PclZip() : Object creator + // create() : Creates the Zip archive + // listContent() : List the content of the Zip archive + // extract() : Extract the content of the archive + // properties() : List the properties of the archive + // -------------------------------------------------------------------------------- + class PclZip + { + // ----- Filename of the zip file + var $zipname = ''; + // ----- File descriptor of the zip file + var $zip_fd = 0; + // ----- Internal error handling + var $error_code = 1; + var $error_string = ''; + // ----- Current status of the magic_quotes_runtime + // This value store the php configuration for magic_quotes + // The class can then disable the magic_quotes and reset it after + var $magic_quotes_status; + // -------------------------------------------------------------------------------- + // Function : PclZip() + // Description : + // Creates a PclZip object and set the name of the associated Zip archive + // filename. + // Note that no real action is taken, if the archive does not exist it is not + // created. Use create() for that. + // -------------------------------------------------------------------------------- + function __construct($p_zipname) + { + } + public function PclZip($p_zipname) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : + // create($p_filelist, $p_add_dir="", $p_remove_dir="") + // create($p_filelist, $p_option, $p_option_value, ...) + // Description : + // This method supports two different synopsis. The first one is historical. + // This method creates a Zip Archive. The Zip file is created in the + // filesystem. The files and directories indicated in $p_filelist + // are added in the archive. See the parameters description for the + // supported format of $p_filelist. + // When a directory is in the list, the directory and its content is added + // in the archive. + // In this synopsis, the function takes an optional variable list of + // options. See below the supported options. + // Parameters : + // $p_filelist : An array containing file or directory names, or + // a string containing one filename or one directory name, or + // a string containing a list of filenames and/or directory + // names separated by spaces. + // $p_add_dir : A path to add before the real path of the archived file, + // in order to have it memorized in the archive. + // $p_remove_dir : A path to remove from the real path of the file to archive, + // in order to have a shorter path memorized in the archive. + // When $p_add_dir and $p_remove_dir are set, $p_remove_dir + // is removed first, before $p_add_dir is added. + // Options : + // PCLZIP_OPT_ADD_PATH : + // PCLZIP_OPT_REMOVE_PATH : + // PCLZIP_OPT_REMOVE_ALL_PATH : + // PCLZIP_OPT_COMMENT : + // PCLZIP_CB_PRE_ADD : + // PCLZIP_CB_POST_ADD : + // Return Values : + // 0 on failure, + // The list of the added files, with a status of the add action. + // (see PclZip::listContent() for list entry format) + // -------------------------------------------------------------------------------- + function create($p_filelist) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : + // add($p_filelist, $p_add_dir="", $p_remove_dir="") + // add($p_filelist, $p_option, $p_option_value, ...) + // Description : + // This method supports two synopsis. The first one is historical. + // This methods add the list of files in an existing archive. + // If a file with the same name already exists, it is added at the end of the + // archive, the first one is still present. + // If the archive does not exist, it is created. + // Parameters : + // $p_filelist : An array containing file or directory names, or + // a string containing one filename or one directory name, or + // a string containing a list of filenames and/or directory + // names separated by spaces. + // $p_add_dir : A path to add before the real path of the archived file, + // in order to have it memorized in the archive. + // $p_remove_dir : A path to remove from the real path of the file to archive, + // in order to have a shorter path memorized in the archive. + // When $p_add_dir and $p_remove_dir are set, $p_remove_dir + // is removed first, before $p_add_dir is added. + // Options : + // PCLZIP_OPT_ADD_PATH : + // PCLZIP_OPT_REMOVE_PATH : + // PCLZIP_OPT_REMOVE_ALL_PATH : + // PCLZIP_OPT_COMMENT : + // PCLZIP_OPT_ADD_COMMENT : + // PCLZIP_OPT_PREPEND_COMMENT : + // PCLZIP_CB_PRE_ADD : + // PCLZIP_CB_POST_ADD : + // Return Values : + // 0 on failure, + // The list of the added files, with a status of the add action. + // (see PclZip::listContent() for list entry format) + // -------------------------------------------------------------------------------- + function add($p_filelist) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : listContent() + // Description : + // This public method, gives the list of the files and directories, with their + // properties. + // The properties of each entries in the list are (used also in other functions) : + // filename : Name of the file. For a create or add action it is the filename + // given by the user. For an extract function it is the filename + // of the extracted file. + // stored_filename : Name of the file / directory stored in the archive. + // size : Size of the stored file. + // compressed_size : Size of the file's data compressed in the archive + // (without the headers overhead) + // mtime : Last known modification date of the file (UNIX timestamp) + // comment : Comment associated with the file + // folder : true | false + // index : index of the file in the archive + // status : status of the action (depending of the action) : + // Values are : + // ok : OK ! + // filtered : the file / dir is not extracted (filtered by user) + // already_a_directory : the file can not be extracted because a + // directory with the same name already exists + // write_protected : the file can not be extracted because a file + // with the same name already exists and is + // write protected + // newer_exist : the file was not extracted because a newer file exists + // path_creation_fail : the file is not extracted because the folder + // does not exist and can not be created + // write_error : the file was not extracted because there was an + // error while writing the file + // read_error : the file was not extracted because there was an error + // while reading the file + // invalid_header : the file was not extracted because of an archive + // format error (bad file header) + // Note that each time a method can continue operating when there + // is an action error on a file, the error is only logged in the file status. + // Return Values : + // 0 on an unrecoverable failure, + // The list of the files in the archive. + // -------------------------------------------------------------------------------- + function listContent() + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : + // extract($p_path="./", $p_remove_path="") + // extract([$p_option, $p_option_value, ...]) + // Description : + // This method supports two synopsis. The first one is historical. + // This method extract all the files / directories from the archive to the + // folder indicated in $p_path. + // If you want to ignore the 'root' part of path of the memorized files + // you can indicate this in the optional $p_remove_path parameter. + // By default, if a newer file with the same name already exists, the + // file is not extracted. + // + // If both PCLZIP_OPT_PATH and PCLZIP_OPT_ADD_PATH options + // are used, the path indicated in PCLZIP_OPT_ADD_PATH is append + // at the end of the path value of PCLZIP_OPT_PATH. + // Parameters : + // $p_path : Path where the files and directories are to be extracted + // $p_remove_path : First part ('root' part) of the memorized path + // (if any similar) to remove while extracting. + // Options : + // PCLZIP_OPT_PATH : + // PCLZIP_OPT_ADD_PATH : + // PCLZIP_OPT_REMOVE_PATH : + // PCLZIP_OPT_REMOVE_ALL_PATH : + // PCLZIP_CB_PRE_EXTRACT : + // PCLZIP_CB_POST_EXTRACT : + // Return Values : + // 0 or a negative value on failure, + // The list of the extracted files, with a status of the action. + // (see PclZip::listContent() for list entry format) + // -------------------------------------------------------------------------------- + function extract() + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : + // extractByIndex($p_index, $p_path="./", $p_remove_path="") + // extractByIndex($p_index, [$p_option, $p_option_value, ...]) + // Description : + // This method supports two synopsis. The first one is historical. + // This method is doing a partial extract of the archive. + // The extracted files or folders are identified by their index in the + // archive (from 0 to n). + // Note that if the index identify a folder, only the folder entry is + // extracted, not all the files included in the archive. + // Parameters : + // $p_index : A single index (integer) or a string of indexes of files to + // extract. The form of the string is "0,4-6,8-12" with only numbers + // and '-' for range or ',' to separate ranges. No spaces or ';' + // are allowed. + // $p_path : Path where the files and directories are to be extracted + // $p_remove_path : First part ('root' part) of the memorized path + // (if any similar) to remove while extracting. + // Options : + // PCLZIP_OPT_PATH : + // PCLZIP_OPT_ADD_PATH : + // PCLZIP_OPT_REMOVE_PATH : + // PCLZIP_OPT_REMOVE_ALL_PATH : + // PCLZIP_OPT_EXTRACT_AS_STRING : The files are extracted as strings and + // not as files. + // The resulting content is in a new field 'content' in the file + // structure. + // This option must be used alone (any other options are ignored). + // PCLZIP_CB_PRE_EXTRACT : + // PCLZIP_CB_POST_EXTRACT : + // Return Values : + // 0 on failure, + // The list of the extracted files, with a status of the action. + // (see PclZip::listContent() for list entry format) + // -------------------------------------------------------------------------------- + //function extractByIndex($p_index, options...) + function extractByIndex($p_index) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : + // delete([$p_option, $p_option_value, ...]) + // Description : + // This method removes files from the archive. + // If no parameters are given, then all the archive is emptied. + // Parameters : + // None or optional arguments. + // Options : + // PCLZIP_OPT_BY_INDEX : + // PCLZIP_OPT_BY_NAME : + // PCLZIP_OPT_BY_EREG : + // PCLZIP_OPT_BY_PREG : + // Return Values : + // 0 on failure, + // The list of the files which are still present in the archive. + // (see PclZip::listContent() for list entry format) + // -------------------------------------------------------------------------------- + function delete() + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : deleteByIndex() + // Description : + // ***** Deprecated ***** + // delete(PCLZIP_OPT_BY_INDEX, $p_index) should be preferred. + // -------------------------------------------------------------------------------- + function deleteByIndex($p_index) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : properties() + // Description : + // This method gives the properties of the archive. + // The properties are : + // nb : Number of files in the archive + // comment : Comment associated with the archive file + // status : not_exist, ok + // Parameters : + // None + // Return Values : + // 0 on failure, + // An array with the archive properties. + // -------------------------------------------------------------------------------- + function properties() + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : duplicate() + // Description : + // This method creates an archive by copying the content of an other one. If + // the archive already exist, it is replaced by the new one without any warning. + // Parameters : + // $p_archive : The filename of a valid archive, or + // a valid PclZip object. + // Return Values : + // 1 on success. + // 0 or a negative value on error (error code). + // -------------------------------------------------------------------------------- + function duplicate($p_archive) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : merge() + // Description : + // This method merge the $p_archive_to_add archive at the end of the current + // one ($this). + // If the archive ($this) does not exist, the merge becomes a duplicate. + // If the $p_archive_to_add archive does not exist, the merge is a success. + // Parameters : + // $p_archive_to_add : It can be directly the filename of a valid zip archive, + // or a PclZip object archive. + // Return Values : + // 1 on success, + // 0 or negative values on error (see below). + // -------------------------------------------------------------------------------- + function merge($p_archive_to_add) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : errorCode() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + function errorCode() + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : errorName() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + function errorName($p_with_code = \false) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : errorInfo() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + function errorInfo($p_full = \false) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // ***** UNDER THIS LINE ARE DEFINED PRIVATE INTERNAL FUNCTIONS ***** + // ***** ***** + // ***** THESES FUNCTIONS MUST NOT BE USED DIRECTLY ***** + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privCheckFormat() + // Description : + // This method check that the archive exists and is a valid zip archive. + // Several level of check exists. (future) + // Parameters : + // $p_level : Level of check. Default 0. + // 0 : Check the first bytes (magic codes) (default value)) + // 1 : 0 + Check the central directory (future) + // 2 : 1 + Check each file header (future) + // Return Values : + // true on success, + // false on error, the error code is set. + // -------------------------------------------------------------------------------- + function privCheckFormat($p_level = 0) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privParseOptions() + // Description : + // This internal methods reads the variable list of arguments ($p_options_list, + // $p_size) and generate an array with the options and values ($v_result_list). + // $v_requested_options contains the options that can be present and those that + // must be present. + // $v_requested_options is an array, with the option value as key, and 'optional', + // or 'mandatory' as value. + // Parameters : + // See above. + // Return Values : + // 1 on success. + // 0 on failure. + // -------------------------------------------------------------------------------- + function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options = \false) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privOptionDefaultThreshold() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privOptionDefaultThreshold(&$p_options) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privFileDescrParseAtt() + // Description : + // Parameters : + // Return Values : + // 1 on success. + // 0 on failure. + // -------------------------------------------------------------------------------- + function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options = \false) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privFileDescrExpand() + // Description : + // This method look for each item of the list to see if its a file, a folder + // or a string to be added as file. For any other type of files (link, other) + // just ignore the item. + // Then prepare the information that will be stored for that file. + // When its a folder, expand the folder with all the files that are in that + // folder (recursively). + // Parameters : + // Return Values : + // 1 on success. + // 0 on failure. + // -------------------------------------------------------------------------------- + function privFileDescrExpand(&$p_filedescr_list, &$p_options) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privCreate() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privCreate($p_filedescr_list, &$p_result_list, &$p_options) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privAdd() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privAdd($p_filedescr_list, &$p_result_list, &$p_options) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privOpenFd() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + function privOpenFd($p_mode) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privCloseFd() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + function privCloseFd() + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privAddList() + // Description : + // $p_add_dir and $p_remove_dir will give the ability to memorize a path which is + // different from the real path of the file. This is useful if you want to have PclTar + // running in any directory, and memorize relative path from an other directory. + // Parameters : + // $p_list : An array containing the file or directory names to add in the tar + // $p_result_list : list of added files with their properties (specially the status field) + // $p_add_dir : Path to add in the filename path archived + // $p_remove_dir : Path to remove in the filename path archived + // Return Values : + // -------------------------------------------------------------------------------- + // function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options) + function privAddList($p_filedescr_list, &$p_result_list, &$p_options) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privAddFileList() + // Description : + // Parameters : + // $p_filedescr_list : An array containing the file description + // or directory names to add in the zip + // $p_result_list : list of added files with their properties (specially the status field) + // Return Values : + // -------------------------------------------------------------------------------- + function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privAddFile() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privAddFile($p_filedescr, &$p_header, &$p_options) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privAddFileUsingTempFile() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privAddFileUsingTempFile($p_filedescr, &$p_header, &$p_options) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privCalculateStoredFilename() + // Description : + // Based on file descriptor properties and global options, this method + // calculate the filename that will be stored in the archive. + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privCalculateStoredFilename(&$p_filedescr, &$p_options) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privWriteFileHeader() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privWriteFileHeader(&$p_header) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privWriteCentralFileHeader() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privWriteCentralFileHeader(&$p_header) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privWriteCentralHeader() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privList() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privList(&$p_list) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privConvertHeader2FileInfo() + // Description : + // This function takes the file information from the central directory + // entries and extract the interesting parameters that will be given back. + // The resulting file infos are set in the array $p_info + // $p_info['filename'] : Filename with full path. Given by user (add), + // extracted in the filesystem (extract). + // $p_info['stored_filename'] : Stored filename in the archive. + // $p_info['size'] = Size of the file. + // $p_info['compressed_size'] = Compressed size of the file. + // $p_info['mtime'] = Last modification date of the file. + // $p_info['comment'] = Comment associated with the file. + // $p_info['folder'] = true/false : indicates if the entry is a folder or not. + // $p_info['status'] = status of the action on the file. + // $p_info['crc'] = CRC of the file content. + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privConvertHeader2FileInfo($p_header, &$p_info) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privExtractByRule() + // Description : + // Extract a file or directory depending of rules (by index, by name, ...) + // Parameters : + // $p_file_list : An array where will be placed the properties of each + // extracted file + // $p_path : Path to add while writing the extracted files + // $p_remove_path : Path to remove (from the file memorized path) while writing the + // extracted files. If the path does not match the file path, + // the file is extracted with its memorized path. + // $p_remove_path does not apply to 'list' mode. + // $p_path and $p_remove_path are commulative. + // Return Values : + // 1 on success,0 or less on error (see error code list) + // -------------------------------------------------------------------------------- + function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privExtractFile() + // Description : + // Parameters : + // Return Values : + // + // 1 : ... ? + // PCLZIP_ERR_USER_ABORTED(2) : User ask for extraction stop in callback + // -------------------------------------------------------------------------------- + function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privExtractFileUsingTempFile() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privExtractFileUsingTempFile(&$p_entry, &$p_options) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privExtractFileInOutput() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privExtractFileInOutput(&$p_entry, &$p_options) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privExtractFileAsString() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privExtractFileAsString(&$p_entry, &$p_string, &$p_options) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privReadFileHeader() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privReadFileHeader(&$p_header) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privReadCentralFileHeader() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privReadCentralFileHeader(&$p_header) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privCheckFileHeaders() + // Description : + // Parameters : + // Return Values : + // 1 on success, + // 0 on error; + // -------------------------------------------------------------------------------- + function privCheckFileHeaders(&$p_local_header, &$p_central_header) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privReadEndCentralDir() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privReadEndCentralDir(&$p_central_dir) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privDeleteByRule() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privDeleteByRule(&$p_result_list, &$p_options) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privDirCheck() + // Description : + // Check if a directory exists, if not it creates it and all the parents directory + // which may be useful. + // Parameters : + // $p_dir : Directory path to check. + // Return Values : + // 1 : OK + // -1 : Unable to create directory + // -------------------------------------------------------------------------------- + function privDirCheck($p_dir, $p_is_dir = \false) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privMerge() + // Description : + // If $p_archive_to_add does not exist, the function exit with a success result. + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privMerge(&$p_archive_to_add) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privDuplicate() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privDuplicate($p_archive_filename) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privErrorLog() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + function privErrorLog($p_error_code = 0, $p_error_string = '') + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privErrorReset() + // Description : + // Parameters : + // -------------------------------------------------------------------------------- + function privErrorReset() + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privDisableMagicQuotes() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privDisableMagicQuotes() + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : privSwapBackMagicQuotes() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function privSwapBackMagicQuotes() + { + } + // -------------------------------------------------------------------------------- + } + /** + * Upgrader API: Plugin_Installer_Skin class + * + * @package WordPress + * @subpackage Upgrader + * @since 4.6.0 + */ + /** + * Plugin Installer Skin for WordPress Plugin Installer. + * + * @since 2.8.0 + * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader-skins.php. + * + * @see WP_Upgrader_Skin + */ + class Plugin_Installer_Skin extends \WP_Upgrader_Skin + { + public $api; + public $type; + public $url; + public $overwrite; + /** + * Constructor. + * + * Sets up the plugin installer skin. + * + * @since 2.8.0 + * + * @param array $args + */ + public function __construct($args = array()) + { + } + /** + * Performs an action before installing a plugin. + * + * @since 2.8.0 + */ + public function before() + { + } + /** + * Hides the `process_failed` error when updating a plugin by uploading a zip file. + * + * @since 5.5.0 + * + * @param WP_Error $wp_error WP_Error object. + * @return bool True if the error should be hidden, false otherwise. + */ + public function hide_process_failed($wp_error) + { + } + /** + * Performs an action following a plugin install. + * + * @since 2.8.0 + * @phpstan-return void + */ + public function after() + { + } + } + /** + * Upgrader API: Plugin_Upgrader_Skin class + * + * @package WordPress + * @subpackage Upgrader + * @since 4.6.0 + */ + /** + * Plugin Upgrader Skin for WordPress Plugin Upgrades. + * + * @since 2.8.0 + * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader-skins.php. + * + * @see WP_Upgrader_Skin + */ + class Plugin_Upgrader_Skin extends \WP_Upgrader_Skin + { + /** + * Holds the plugin slug in the Plugin Directory. + * + * @since 2.8.0 + * + * @var string + */ + public $plugin = ''; + /** + * Whether the plugin is active. + * + * @since 2.8.0 + * + * @var bool + */ + public $plugin_active = \false; + /** + * Whether the plugin is active for the entire network. + * + * @since 2.8.0 + * + * @var bool + */ + public $plugin_network_active = \false; + /** + * Constructor. + * + * Sets up the plugin upgrader skin. + * + * @since 2.8.0 + * + * @param array $args Optional. The plugin upgrader skin arguments to + * override default options. Default empty array. + */ + public function __construct($args = array()) + { + } + /** + * Performs an action following a single plugin update. + * + * @since 2.8.0 + */ + public function after() + { + } + } + /** + * Upgrade API: Plugin_Upgrader class + * + * @package WordPress + * @subpackage Upgrader + * @since 4.6.0 + */ + /** + * Core class used for upgrading/installing plugins. + * + * It is designed to upgrade/install plugins from a local zip, remote zip URL, + * or uploaded zip file. + * + * @since 2.8.0 + * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader.php. + * + * @see WP_Upgrader + */ + class Plugin_Upgrader extends \WP_Upgrader + { + /** + * Plugin upgrade result. + * + * @since 2.8.0 + * @var array|WP_Error $result + * + * @see WP_Upgrader::$result + */ + public $result; + /** + * Whether a bulk upgrade/installation is being performed. + * + * @since 2.9.0 + * @var bool $bulk + */ + public $bulk = \false; + /** + * New plugin info. + * + * @since 5.5.0 + * @var array $new_plugin_data + * + * @see check_package() + */ + public $new_plugin_data = array(); + /** + * Initializes the upgrade strings. + * + * @since 2.8.0 + */ + public function upgrade_strings() + { + } + /** + * Initializes the installation strings. + * + * @since 2.8.0 + */ + public function install_strings() + { + } + /** + * Install a plugin package. + * + * @since 2.8.0 + * @since 3.7.0 The `$args` parameter was added, making clearing the plugin update cache optional. + * + * @param string $package The full local path or URI of the package. + * @param array $args { + * Optional. Other arguments for installing a plugin package. Default empty array. + * + * @type bool $clear_update_cache Whether to clear the plugin updates cache if successful. + * Default true. + * } + * @return bool|WP_Error True if the installation was successful, false or a WP_Error otherwise. + * @phpstan-param array{ + * clear_update_cache?: bool, + * } $args + */ + public function install($package, $args = array()) + { + } + /** + * Upgrades a plugin. + * + * @since 2.8.0 + * @since 3.7.0 The `$args` parameter was added, making clearing the plugin update cache optional. + * + * @param string $plugin Path to the plugin file relative to the plugins directory. + * @param array $args { + * Optional. Other arguments for upgrading a plugin package. Default empty array. + * + * @type bool $clear_update_cache Whether to clear the plugin updates cache if successful. + * Default true. + * } + * @return bool|WP_Error True if the upgrade was successful, false or a WP_Error object otherwise. + * @phpstan-param array{ + * clear_update_cache?: bool, + * } $args + */ + public function upgrade($plugin, $args = array()) + { + } + /** + * Upgrades several plugins at once. + * + * @since 2.8.0 + * @since 3.7.0 The `$args` parameter was added, making clearing the plugin update cache optional. + * + * @global string $wp_version The WordPress version string. + * + * @param string[] $plugins Array of paths to plugin files relative to the plugins directory. + * @param array $args { + * Optional. Other arguments for upgrading several plugins at once. + * + * @type bool $clear_update_cache Whether to clear the plugin updates cache if successful. Default true. + * } + * @return array|false An array of results indexed by plugin file, or false if unable to connect to the filesystem. + * @phpstan-param array{ + * clear_update_cache?: bool, + * } $args + */ + public function bulk_upgrade($plugins, $args = array()) + { + } + /** + * Checks that the source package contains a valid plugin. + * + * Hooked to the {@see 'upgrader_source_selection'} filter by Plugin_Upgrader::install(). + * + * @since 3.3.0 + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * @global string $wp_version The WordPress version string. + * + * @param string $source The path to the downloaded package source. + * @return string|WP_Error The source as passed, or a WP_Error object on failure. + */ + public function check_package($source) + { + } + /** + * Retrieves the path to the file that contains the plugin info. + * + * This isn't used internally in the class, but is called by the skins. + * + * @since 2.8.0 + * + * @return string|false The full path to the main plugin file, or false. + */ + public function plugin_info() + { + } + /** + * Deactivates a plugin before it is upgraded. + * + * Hooked to the {@see 'upgrader_pre_install'} filter by Plugin_Upgrader::upgrade(). + * + * @since 2.8.0 + * @since 4.1.0 Added a return value. + * + * @param bool|WP_Error $response The installation response before the installation has started. + * @param array $plugin Plugin package arguments. + * @return bool|WP_Error The original `$response` parameter or WP_Error. + */ + public function deactivate_plugin_before_upgrade($response, $plugin) + { + } + /** + * Turns on maintenance mode before attempting to background update an active plugin. + * + * Hooked to the {@see 'upgrader_pre_install'} filter by Plugin_Upgrader::upgrade(). + * + * @since 5.4.0 + * + * @param bool|WP_Error $response The installation response before the installation has started. + * @param array $plugin Plugin package arguments. + * @return bool|WP_Error The original `$response` parameter or WP_Error. + */ + public function active_before($response, $plugin) + { + } + /** + * Turns off maintenance mode after upgrading an active plugin. + * + * Hooked to the {@see 'upgrader_post_install'} filter by Plugin_Upgrader::upgrade(). + * + * @since 5.4.0 + * + * @param bool|WP_Error $response The installation response after the installation has finished. + * @param array $plugin Plugin package arguments. + * @return bool|WP_Error The original `$response` parameter or WP_Error. + */ + public function active_after($response, $plugin) + { + } + /** + * Deletes the old plugin during an upgrade. + * + * Hooked to the {@see 'upgrader_clear_destination'} filter by + * Plugin_Upgrader::upgrade() and Plugin_Upgrader::bulk_upgrade(). + * + * @since 2.8.0 + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @param bool|WP_Error $removed Whether the destination was cleared. + * True on success, WP_Error on failure. + * @param string $local_destination The local package destination. + * @param string $remote_destination The remote package destination. + * @param array $plugin Extra arguments passed to hooked filters. + * @return bool|WP_Error + */ + public function delete_old_plugin($removed, $local_destination, $remote_destination, $plugin) + { + } + } + /** + * Upgrader API: Theme_Installer_Skin class + * + * @package WordPress + * @subpackage Upgrader + * @since 4.6.0 + */ + /** + * Theme Installer Skin for the WordPress Theme Installer. + * + * @since 2.8.0 + * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader-skins.php. + * + * @see WP_Upgrader_Skin + */ + class Theme_Installer_Skin extends \WP_Upgrader_Skin + { + public $api; + public $type; + public $url; + public $overwrite; + /** + * Constructor. + * + * Sets up the theme installer skin. + * + * @since 2.8.0 + * + * @param array $args + */ + public function __construct($args = array()) + { + } + /** + * Performs an action before installing a theme. + * + * @since 2.8.0 + */ + public function before() + { + } + /** + * Hides the `process_failed` error when updating a theme by uploading a zip file. + * + * @since 5.5.0 + * + * @param WP_Error $wp_error WP_Error object. + * @return bool True if the error should be hidden, false otherwise. + */ + public function hide_process_failed($wp_error) + { + } + /** + * Performs an action following a single theme install. + * + * @since 2.8.0 + * @phpstan-return void + */ + public function after() + { + } + } + /** + * Upgrader API: Theme_Upgrader_Skin class + * + * @package WordPress + * @subpackage Upgrader + * @since 4.6.0 + */ + /** + * Theme Upgrader Skin for WordPress Theme Upgrades. + * + * @since 2.8.0 + * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader-skins.php. + * + * @see WP_Upgrader_Skin + */ + class Theme_Upgrader_Skin extends \WP_Upgrader_Skin + { + /** + * Holds the theme slug in the Theme Directory. + * + * @since 2.8.0 + * + * @var string + */ + public $theme = ''; + /** + * Constructor. + * + * Sets up the theme upgrader skin. + * + * @since 2.8.0 + * + * @param array $args Optional. The theme upgrader skin arguments to + * override default options. Default empty array. + */ + public function __construct($args = array()) + { + } + /** + * Performs an action following a single theme update. + * + * @since 2.8.0 + */ + public function after() + { + } + } + /** + * Upgrade API: Theme_Upgrader class + * + * @package WordPress + * @subpackage Upgrader + * @since 4.6.0 + */ + /** + * Core class used for upgrading/installing themes. + * + * It is designed to upgrade/install themes from a local zip, remote zip URL, + * or uploaded zip file. + * + * @since 2.8.0 + * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader.php. + * + * @see WP_Upgrader + */ + class Theme_Upgrader extends \WP_Upgrader + { + /** + * Result of the theme upgrade offer. + * + * @since 2.8.0 + * @var array|WP_Error $result + * @see WP_Upgrader::$result + */ + public $result; + /** + * Whether multiple themes are being upgraded/installed in bulk. + * + * @since 2.9.0 + * @var bool $bulk + */ + public $bulk = \false; + /** + * New theme info. + * + * @since 5.5.0 + * @var array $new_theme_data + * + * @see check_package() + */ + public $new_theme_data = array(); + /** + * Initializes the upgrade strings. + * + * @since 2.8.0 + */ + public function upgrade_strings() + { + } + /** + * Initializes the installation strings. + * + * @since 2.8.0 + */ + public function install_strings() + { + } + /** + * Checks if a child theme is being installed and its parent also needs to be installed. + * + * Hooked to the {@see 'upgrader_post_install'} filter by Theme_Upgrader::install(). + * + * @since 3.4.0 + * + * @param bool $install_result + * @param array $hook_extra + * @param array $child_result + * @return bool + */ + public function check_parent_theme_filter($install_result, $hook_extra, $child_result) + { + } + /** + * Don't display the activate and preview actions to the user. + * + * Hooked to the {@see 'install_theme_complete_actions'} filter by + * Theme_Upgrader::check_parent_theme_filter() when installing + * a child theme and installing the parent theme fails. + * + * @since 3.4.0 + * + * @param array $actions Preview actions. + * @return array + */ + public function hide_activate_preview_actions($actions) + { + } + /** + * Install a theme package. + * + * @since 2.8.0 + * @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional. + * + * @param string $package The full local path or URI of the package. + * @param array $args { + * Optional. Other arguments for installing a theme package. Default empty array. + * + * @type bool $clear_update_cache Whether to clear the updates cache if successful. + * Default true. + * } + * + * @return bool|WP_Error True if the installation was successful, false or a WP_Error object otherwise. + * @phpstan-param array{ + * clear_update_cache?: bool, + * } $args + */ + public function install($package, $args = array()) + { + } + /** + * Upgrades a theme. + * + * @since 2.8.0 + * @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional. + * + * @param string $theme The theme slug. + * @param array $args { + * Optional. Other arguments for upgrading a theme. Default empty array. + * + * @type bool $clear_update_cache Whether to clear the update cache if successful. + * Default true. + * } + * @return bool|WP_Error True if the upgrade was successful, false or a WP_Error object otherwise. + * @phpstan-param array{ + * clear_update_cache?: bool, + * } $args + */ + public function upgrade($theme, $args = array()) + { + } + /** + * Upgrades several themes at once. + * + * @since 3.0.0 + * @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional. + * + * @global string $wp_version The WordPress version string. + * + * @param string[] $themes Array of the theme slugs. + * @param array $args { + * Optional. Other arguments for upgrading several themes at once. Default empty array. + * + * @type bool $clear_update_cache Whether to clear the update cache if successful. + * Default true. + * } + * @return array[]|false An array of results, or false if unable to connect to the filesystem. + * @phpstan-param array{ + * clear_update_cache?: bool, + * } $args + */ + public function bulk_upgrade($themes, $args = array()) + { + } + /** + * Checks that the package source contains a valid theme. + * + * Hooked to the {@see 'upgrader_source_selection'} filter by Theme_Upgrader::install(). + * + * @since 3.3.0 + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * @global string $wp_version The WordPress version string. + * + * @param string $source The path to the downloaded package source. + * @return string|WP_Error The source as passed, or a WP_Error object on failure. + */ + public function check_package($source) + { + } + /** + * Turns on maintenance mode before attempting to upgrade the active theme. + * + * Hooked to the {@see 'upgrader_pre_install'} filter by Theme_Upgrader::upgrade() and + * Theme_Upgrader::bulk_upgrade(). + * + * @since 2.8.0 + * + * @param bool|WP_Error $response The installation response before the installation has started. + * @param array $theme Theme arguments. + * @return bool|WP_Error The original `$response` parameter or WP_Error. + */ + public function current_before($response, $theme) + { + } + /** + * Turns off maintenance mode after upgrading the active theme. + * + * Hooked to the {@see 'upgrader_post_install'} filter by Theme_Upgrader::upgrade() + * and Theme_Upgrader::bulk_upgrade(). + * + * @since 2.8.0 + * + * @param bool|WP_Error $response The installation response after the installation has finished. + * @param array $theme Theme arguments. + * @return bool|WP_Error The original `$response` parameter or WP_Error. + */ + public function current_after($response, $theme) + { + } + /** + * Deletes the old theme during an upgrade. + * + * Hooked to the {@see 'upgrader_clear_destination'} filter by Theme_Upgrader::upgrade() + * and Theme_Upgrader::bulk_upgrade(). + * + * @since 2.8.0 + * + * @global WP_Filesystem_Base $wp_filesystem Subclass + * + * @param bool $removed + * @param string $local_destination + * @param string $remote_destination + * @param array $theme + * @return bool + */ + public function delete_old_theme($removed, $local_destination, $remote_destination, $theme) + { + } + /** + * Gets the WP_Theme object for a theme. + * + * @since 2.8.0 + * @since 3.0.0 The `$theme` argument was added. + * + * @param string $theme The directory name of the theme. This is optional, and if not supplied, + * the directory name from the last result will be used. + * @return WP_Theme|false The theme's info object, or false `$theme` is not supplied + * and the last result isn't set. + */ + public function theme_info($theme = \null) + { + } + } + /** + * A class for displaying various tree-like structures. + * + * Extend the Walker class to use it, see examples below. Child classes + * do not need to implement all of the abstract methods in the class. The child + * only needs to implement the methods that are needed. + * + * @since 2.1.0 + * + * @package WordPress + * @abstract + */ + #[\AllowDynamicProperties] + class Walker + { + /** + * What the class handles. + * + * @since 2.1.0 + * @var string + */ + public $tree_type; + /** + * DB fields to use. + * + * @since 2.1.0 + * @var string[] + */ + public $db_fields; + /** + * Max number of pages walked by the paged walker. + * + * @since 2.7.0 + * @var int + */ + public $max_pages = 1; + /** + * Whether the current element has children or not. + * + * To be used in start_el(). + * + * @since 4.0.0 + * @var bool + */ + public $has_children; + /** + * Starts the list before the elements are added. + * + * The $args parameter holds additional values that may be used with the child + * class methods. This method is called at the start of the output list. + * + * @since 2.1.0 + * @abstract + * + * @param string $output Used to append additional content (passed by reference). + * @param int $depth Depth of the item. + * @param array $args An array of additional arguments. + */ + public function start_lvl(&$output, $depth = 0, $args = array()) + { + } + /** + * Ends the list of after the elements are added. + * + * The $args parameter holds additional values that may be used with the child + * class methods. This method finishes the list at the end of output of the elements. + * + * @since 2.1.0 + * @abstract + * + * @param string $output Used to append additional content (passed by reference). + * @param int $depth Depth of the item. + * @param array $args An array of additional arguments. + */ + public function end_lvl(&$output, $depth = 0, $args = array()) + { + } + /** + * Starts the element output. + * + * The $args parameter holds additional values that may be used with the child + * class methods. Also includes the element output. + * + * @since 2.1.0 + * @since 5.9.0 Renamed `$object` (a PHP reserved keyword) to `$data_object` for PHP 8 named parameter support. + * @abstract + * + * @param string $output Used to append additional content (passed by reference). + * @param object $data_object The data object. + * @param int $depth Depth of the item. + * @param array $args An array of additional arguments. + * @param int $current_object_id Optional. ID of the current item. Default 0. + */ + public function start_el(&$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0) + { + } + /** + * Ends the element output, if needed. + * + * The $args parameter holds additional values that may be used with the child class methods. + * + * @since 2.1.0 + * @since 5.9.0 Renamed `$object` (a PHP reserved keyword) to `$data_object` for PHP 8 named parameter support. + * @abstract + * + * @param string $output Used to append additional content (passed by reference). + * @param object $data_object The data object. + * @param int $depth Depth of the item. + * @param array $args An array of additional arguments. + */ + public function end_el(&$output, $data_object, $depth = 0, $args = array()) + { + } + /** + * Traverses elements to create list from elements. + * + * Display one element if the element doesn't have any children otherwise, + * display the element and its children. Will only traverse up to the max + * depth and no ignore elements under that depth. It is possible to set the + * max depth to include all depths, see walk() method. + * + * This method should not be called directly, use the walk() method instead. + * + * @since 2.5.0 + * + * @param object $element Data object. + * @param array $children_elements List of elements to continue traversing (passed by reference). + * @param int $max_depth Max depth to traverse. + * @param int $depth Depth of current element. + * @param array $args An array of arguments. + * @param string $output Used to append additional content (passed by reference). + * @phpstan-return void + */ + public function display_element($element, &$children_elements, $max_depth, $depth, $args, &$output) + { + } + /** + * Displays array of elements hierarchically. + * + * Does not assume any existing order of elements. + * + * $max_depth = -1 means flatly display every element. + * $max_depth = 0 means display all levels. + * $max_depth > 0 specifies the number of display levels. + * + * @since 2.1.0 + * @since 5.3.0 Formalized the existing `...$args` parameter by adding it + * to the function signature. + * + * @param array $elements An array of elements. + * @param int $max_depth The maximum hierarchical depth. + * @param mixed ...$args Optional additional arguments. + * @return string The hierarchical item output. + */ + public function walk($elements, $max_depth, ...$args) + { + } + /** + * Produces a page of nested elements. + * + * Given an array of hierarchical elements, the maximum depth, a specific page number, + * and number of elements per page, this function first determines all top level root elements + * belonging to that page, then lists them and all of their children in hierarchical order. + * + * $max_depth = 0 means display all levels. + * $max_depth > 0 specifies the number of display levels. + * + * @since 2.7.0 + * @since 5.3.0 Formalized the existing `...$args` parameter by adding it + * to the function signature. + * + * @param array $elements An array of elements. + * @param int $max_depth The maximum hierarchical depth. + * @param int $page_num The specific page number, beginning with 1. + * @param int $per_page Number of elements per page. + * @param mixed ...$args Optional additional arguments. + * @return string XHTML of the specified page of elements. + */ + public function paged_walk($elements, $max_depth, $page_num, $per_page, ...$args) + { + } + /** + * Calculates the total number of root elements. + * + * @since 2.7.0 + * + * @param array $elements Elements to list. + * @return int Number of root elements. + */ + public function get_number_of_root_elements($elements) + { + } + /** + * Unsets all the children for a given top level element. + * + * @since 2.7.0 + * + * @param object $element The top level element. + * @param array $children_elements The children elements. + * @phpstan-return void + */ + public function unset_children($element, &$children_elements) + { + } + } + /** + * Taxonomy API: Walker_Category_Checklist class + * + * @package WordPress + * @subpackage Administration + * @since 4.4.0 + */ + /** + * Core walker class to output an unordered list of category checkbox input elements. + * + * @since 2.5.1 + * + * @see Walker + * @see wp_category_checklist() + * @see wp_terms_checklist() + */ + class Walker_Category_Checklist extends \Walker + { + public $tree_type = 'category'; + public $db_fields = array('parent' => 'parent', 'id' => 'term_id'); + // TODO: Decouple this. + /** + * Starts the list before the elements are added. + * + * @see Walker:start_lvl() + * + * @since 2.5.1 + * + * @param string $output Used to append additional content (passed by reference). + * @param int $depth Depth of category. Used for tab indentation. + * @param array $args An array of arguments. See {@see wp_terms_checklist()}. + * @phpstan-param array{ + * descendants_and_self?: int, + * selected_cats?: int[], + * popular_cats?: int[], + * walker?: Walker, + * taxonomy?: string, + * checked_ontop?: bool, + * echo?: bool, + * } $args See wp_terms_checklist() + */ + public function start_lvl(&$output, $depth = 0, $args = array()) + { + } + /** + * Ends the list of after the elements are added. + * + * @see Walker::end_lvl() + * + * @since 2.5.1 + * + * @param string $output Used to append additional content (passed by reference). + * @param int $depth Depth of category. Used for tab indentation. + * @param array $args An array of arguments. See {@see wp_terms_checklist()}. + * @phpstan-param array{ + * descendants_and_self?: int, + * selected_cats?: int[], + * popular_cats?: int[], + * walker?: Walker, + * taxonomy?: string, + * checked_ontop?: bool, + * echo?: bool, + * } $args See wp_terms_checklist() + */ + public function end_lvl(&$output, $depth = 0, $args = array()) + { + } + /** + * Start the element output. + * + * @see Walker::start_el() + * + * @since 2.5.1 + * @since 5.9.0 Renamed `$category` to `$data_object` and `$id` to `$current_object_id` + * to match parent class for PHP 8 named parameter support. + * + * @param string $output Used to append additional content (passed by reference). + * @param WP_Term $data_object The current term object. + * @param int $depth Depth of the term in reference to parents. Default 0. + * @param array $args An array of arguments. See {@see wp_terms_checklist()}. + * @param int $current_object_id Optional. ID of the current term. Default 0. + * @phpstan-param array{ + * descendants_and_self?: int, + * selected_cats?: int[], + * popular_cats?: int[], + * walker?: Walker, + * taxonomy?: string, + * checked_ontop?: bool, + * echo?: bool, + * } $args See wp_terms_checklist() + */ + public function start_el(&$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0) + { + } + /** + * Ends the element output, if needed. + * + * @see Walker::end_el() + * + * @since 2.5.1 + * @since 5.9.0 Renamed `$category` to `$data_object` to match parent class for PHP 8 named parameter support. + * + * @param string $output Used to append additional content (passed by reference). + * @param WP_Term $data_object The current term object. + * @param int $depth Depth of the term in reference to parents. Default 0. + * @param array $args An array of arguments. See {@see wp_terms_checklist()}. + * @phpstan-param array{ + * descendants_and_self?: int, + * selected_cats?: int[], + * popular_cats?: int[], + * walker?: Walker, + * taxonomy?: string, + * checked_ontop?: bool, + * echo?: bool, + * } $args See wp_terms_checklist() + */ + public function end_el(&$output, $data_object, $depth = 0, $args = array()) + { + } + } + /** + * Nav Menu API: Walker_Nav_Menu class + * + * @package WordPress + * @subpackage Nav_Menus + * @since 4.6.0 + */ + /** + * Core class used to implement an HTML list of nav menu items. + * + * @since 3.0.0 + * + * @see Walker + */ + class Walker_Nav_Menu extends \Walker + { + /** + * What the class handles. + * + * @since 3.0.0 + * @var string + * + * @see Walker::$tree_type + */ + public $tree_type = array('post_type', 'taxonomy', 'custom'); + /** + * Database fields to use. + * + * @since 3.0.0 + * @todo Decouple this. + * @var string[] + * + * @see Walker::$db_fields + */ + public $db_fields = array('parent' => 'menu_item_parent', 'id' => 'db_id'); + /** + * Starts the list before the elements are added. + * + * @since 3.0.0 + * + * @see Walker::start_lvl() + * + * @param string $output Used to append additional content (passed by reference). + * @param int $depth Depth of menu item. Used for padding. + * @param stdClass $args An object of wp_nav_menu() arguments. + */ + public function start_lvl(&$output, $depth = 0, $args = \null) + { + } + /** + * Ends the list of after the elements are added. + * + * @since 3.0.0 + * + * @see Walker::end_lvl() + * + * @param string $output Used to append additional content (passed by reference). + * @param int $depth Depth of menu item. Used for padding. + * @param stdClass $args An object of wp_nav_menu() arguments. + */ + public function end_lvl(&$output, $depth = 0, $args = \null) + { + } + /** + * Starts the element output. + * + * @since 3.0.0 + * @since 4.4.0 The {@see 'nav_menu_item_args'} filter was added. + * @since 5.9.0 Renamed `$item` to `$data_object` and `$id` to `$current_object_id` + * to match parent class for PHP 8 named parameter support. + * + * @see Walker::start_el() + * + * @param string $output Used to append additional content (passed by reference). + * @param WP_Post $data_object Menu item data object. + * @param int $depth Depth of menu item. Used for padding. + * @param stdClass $args An object of wp_nav_menu() arguments. + * @param int $current_object_id Optional. ID of the current menu item. Default 0. + */ + public function start_el(&$output, $data_object, $depth = 0, $args = \null, $current_object_id = 0) + { + } + /** + * Ends the element output, if needed. + * + * @since 3.0.0 + * @since 5.9.0 Renamed `$item` to `$data_object` to match parent class for PHP 8 named parameter support. + * + * @see Walker::end_el() + * + * @param string $output Used to append additional content (passed by reference). + * @param WP_Post $data_object Menu item data object. Not used. + * @param int $depth Depth of page. Not Used. + * @param stdClass $args An object of wp_nav_menu() arguments. + */ + public function end_el(&$output, $data_object, $depth = 0, $args = \null) + { + } + /** + * Builds a string of HTML attributes from an array of key/value pairs. + * Empty values are ignored. + * + * @since 6.3.0 + * + * @param array $atts Optional. An array of HTML attribute key/value pairs. Default empty array. + * @return string A string of HTML attributes. + */ + protected function build_atts($atts = array()) + { + } + } + /** + * Navigation Menu API: Walker_Nav_Menu_Checklist class + * + * @package WordPress + * @subpackage Administration + * @since 4.4.0 + */ + /** + * Create HTML list of nav menu input items. + * + * @since 3.0.0 + * @uses Walker_Nav_Menu + */ + class Walker_Nav_Menu_Checklist extends \Walker_Nav_Menu + { + /** + * @param array|false $fields Database fields to use. + */ + public function __construct($fields = \false) + { + } + /** + * Starts the list before the elements are added. + * + * @see Walker_Nav_Menu::start_lvl() + * + * @since 3.0.0 + * + * @param string $output Used to append additional content (passed by reference). + * @param int $depth Depth of page. Used for padding. + * @param stdClass $args Not used. + */ + public function start_lvl(&$output, $depth = 0, $args = \null) + { + } + /** + * Ends the list of after the elements are added. + * + * @see Walker_Nav_Menu::end_lvl() + * + * @since 3.0.0 + * + * @param string $output Used to append additional content (passed by reference). + * @param int $depth Depth of page. Used for padding. + * @param stdClass $args Not used. + */ + public function end_lvl(&$output, $depth = 0, $args = \null) + { + } + /** + * Start the element output. + * + * @see Walker_Nav_Menu::start_el() + * + * @since 3.0.0 + * @since 5.9.0 Renamed `$item` to `$data_object` and `$id` to `$current_object_id` + * to match parent class for PHP 8 named parameter support. + * + * @global int $_nav_menu_placeholder + * @global int|string $nav_menu_selected_id + * + * @param string $output Used to append additional content (passed by reference). + * @param WP_Post $data_object Menu item data object. + * @param int $depth Depth of menu item. Used for padding. + * @param stdClass $args Not used. + * @param int $current_object_id Optional. ID of the current menu item. Default 0. + */ + public function start_el(&$output, $data_object, $depth = 0, $args = \null, $current_object_id = 0) + { + } + } + /** + * Navigation Menu API: Walker_Nav_Menu_Edit class + * + * @package WordPress + * @subpackage Administration + * @since 4.4.0 + */ + /** + * Create HTML list of nav menu input items. + * + * @since 3.0.0 + * + * @see Walker_Nav_Menu + */ + class Walker_Nav_Menu_Edit extends \Walker_Nav_Menu + { + /** + * Starts the list before the elements are added. + * + * @see Walker_Nav_Menu::start_lvl() + * + * @since 3.0.0 + * + * @param string $output Passed by reference. + * @param int $depth Depth of menu item. Used for padding. + * @param stdClass $args Not used. + */ + public function start_lvl(&$output, $depth = 0, $args = \null) + { + } + /** + * Ends the list of after the elements are added. + * + * @see Walker_Nav_Menu::end_lvl() + * + * @since 3.0.0 + * + * @param string $output Passed by reference. + * @param int $depth Depth of menu item. Used for padding. + * @param stdClass $args Not used. + */ + public function end_lvl(&$output, $depth = 0, $args = \null) + { + } + /** + * Start the element output. + * + * @see Walker_Nav_Menu::start_el() + * @since 3.0.0 + * @since 5.9.0 Renamed `$item` to `$data_object` and `$id` to `$current_object_id` + * to match parent class for PHP 8 named parameter support. + * + * @global int $_wp_nav_menu_max_depth + * + * @param string $output Used to append additional content (passed by reference). + * @param WP_Post $data_object Menu item data object. + * @param int $depth Depth of menu item. Used for padding. + * @param stdClass $args Not used. + * @param int $current_object_id Optional. ID of the current menu item. Default 0. + */ + public function start_el(&$output, $data_object, $depth = 0, $args = \null, $current_object_id = 0) + { + } + } + /** + * Upgrader API: WP_Ajax_Upgrader_Skin class + * + * @package WordPress + * @subpackage Upgrader + * @since 4.6.0 + */ + /** + * Upgrader Skin for Ajax WordPress upgrades. + * + * This skin is designed to be used for Ajax updates. + * + * @since 4.6.0 + * + * @see Automatic_Upgrader_Skin + */ + class WP_Ajax_Upgrader_Skin extends \Automatic_Upgrader_Skin + { + /** + * Plugin info. + * + * The Plugin_Upgrader::bulk_upgrade() method will fill this in + * with info retrieved from the get_plugin_data() function. + * + * @var array Plugin data. Values will be empty if not supplied by the plugin. + */ + public $plugin_info = array(); + /** + * Theme info. + * + * The Theme_Upgrader::bulk_upgrade() method will fill this in + * with info retrieved from the Theme_Upgrader::theme_info() method, + * which in turn calls the wp_get_theme() function. + * + * @var WP_Theme|false The theme's info object, or false. + */ + public $theme_info = \false; + /** + * Holds the WP_Error object. + * + * @since 4.6.0 + * + * @var null|WP_Error + */ + protected $errors = \null; + /** + * Constructor. + * + * Sets up the WordPress Ajax upgrader skin. + * + * @since 4.6.0 + * + * @see WP_Upgrader_Skin::__construct() + * + * @param array $args Optional. The WordPress Ajax upgrader skin arguments to + * override default options. See WP_Upgrader_Skin::__construct(). + * Default empty array. + */ + public function __construct($args = array()) + { + } + /** + * Retrieves the list of errors. + * + * @since 4.6.0 + * + * @return WP_Error Errors during an upgrade. + */ + public function get_errors() + { + } + /** + * Retrieves a string for error messages. + * + * @since 4.6.0 + * + * @return string Error messages during an upgrade. + */ + public function get_error_messages() + { + } + /** + * Stores an error message about the upgrade. + * + * @since 4.6.0 + * @since 5.3.0 Formalized the existing `...$args` parameter by adding it + * to the function signature. + * + * @param string|WP_Error $errors Errors. + * @param mixed ...$args Optional text replacements. + */ + public function error($errors, ...$args) + { + } + /** + * Stores a message about the upgrade. + * + * @since 4.6.0 + * @since 5.3.0 Formalized the existing `...$args` parameter by adding it + * to the function signature. + * @since 5.9.0 Renamed `$data` to `$feedback` for PHP 8 named parameter support. + * + * @param string|array|WP_Error $feedback Message data. + * @param mixed ...$args Optional text replacements. + */ + public function feedback($feedback, ...$args) + { + } + } + /** + * Administration API: WP_List_Table class + * + * @package WordPress + * @subpackage List_Table + * @since 3.1.0 + */ + /** + * Base class for displaying a list of items in an ajaxified HTML table. + * + * @since 3.1.0 + */ + #[\AllowDynamicProperties] + class WP_List_Table + { + /** + * The current list of items. + * + * @since 3.1.0 + * @var array + */ + public $items; + /** + * Various information about the current table. + * + * @since 3.1.0 + * @var array + */ + protected $_args; + /** + * Various information needed for displaying the pagination. + * + * @since 3.1.0 + * @var array + */ + protected $_pagination_args = array(); + /** + * The current screen. + * + * @since 3.1.0 + * @var WP_Screen + */ + protected $screen; + /** + * The view switcher modes. + * + * @since 4.1.0 + * @var array + */ + protected $modes = array(); + /** + * Stores the value returned by ->get_column_info(). + * + * @since 4.1.0 + * @var array + */ + protected $_column_headers; + /** + * {@internal Missing Summary} + * + * @var array + */ + protected $compat_fields = array('_args', '_pagination_args', 'screen', '_actions', '_pagination'); + /** + * {@internal Missing Summary} + * + * @var array + */ + protected $compat_methods = array('set_pagination_args', 'get_views', 'get_bulk_actions', 'bulk_actions', 'row_actions', 'months_dropdown', 'view_switcher', 'comments_bubble', 'get_items_per_page', 'pagination', 'get_sortable_columns', 'get_column_info', 'get_table_classes', 'display_tablenav', 'extra_tablenav', 'single_row_columns'); + /** + * Constructor. + * + * The child class should call this constructor from its own constructor to override + * the default $args. + * + * @since 3.1.0 + * + * @param array|string $args { + * Array or string of arguments. + * + * @type string $plural Plural value used for labels and the objects being listed. + * This affects things such as CSS class-names and nonces used + * in the list table, e.g. 'posts'. Default empty. + * @type string $singular Singular label for an object being listed, e.g. 'post'. + * Default empty + * @type bool $ajax Whether the list table supports Ajax. This includes loading + * and sorting data, for example. If true, the class will call + * the _js_vars() method in the footer to provide variables + * to any scripts handling Ajax events. Default false. + * @type string $screen String containing the hook name used to determine the current + * screen. If left null, the current screen will be automatically set. + * Default null. + * } + * @phpstan-param array{ + * plural?: string, + * singular?: string, + * ajax?: bool, + * screen?: string, + * } $args + */ + public function __construct($args = array()) + { + } + /** + * Makes private properties readable for backward compatibility. + * + * @since 4.0.0 + * @since 6.4.0 Getting a dynamic property is deprecated. + * + * @param string $name Property to get. + * @return mixed Property. + */ + public function __get($name) + { + } + /** + * Makes private properties settable for backward compatibility. + * + * @since 4.0.0 + * @since 6.4.0 Setting a dynamic property is deprecated. + * + * @param string $name Property to check if set. + * @param mixed $value Property value. + * @phpstan-return void + */ + public function __set($name, $value) + { + } + /** + * Makes private properties checkable for backward compatibility. + * + * @since 4.0.0 + * @since 6.4.0 Checking a dynamic property is deprecated. + * + * @param string $name Property to check if set. + * @return bool Whether the property is a back-compat property and it is set. + */ + public function __isset($name) + { + } + /** + * Makes private properties un-settable for backward compatibility. + * + * @since 4.0.0 + * @since 6.4.0 Unsetting a dynamic property is deprecated. + * + * @param string $name Property to unset. + * @phpstan-return void + */ + public function __unset($name) + { + } + /** + * Makes private/protected methods readable for backward compatibility. + * + * @since 4.0.0 + * + * @param string $name Method to call. + * @param array $arguments Arguments to pass when calling. + * @return mixed|bool Return value of the callback, false otherwise. + */ + public function __call($name, $arguments) + { + } + /** + * Checks the current user's permissions + * + * @since 3.1.0 + * @abstract + */ + public function ajax_user_can() + { + } + /** + * Prepares the list of items for displaying. + * + * @uses WP_List_Table::set_pagination_args() + * + * @since 3.1.0 + * @abstract + */ + public function prepare_items() + { + } + /** + * Sets all the necessary pagination arguments. + * + * @since 3.1.0 + * + * @param array|string $args Array or string of arguments with information about the pagination. + * @phpstan-param array{total_items?: int, total_pages?: int, per_page?: int} $args + * @phpstan-return void + */ + protected function set_pagination_args($args) + { + } + /** + * Access the pagination args. + * + * @since 3.1.0 + * + * @param string $key Pagination argument to retrieve. Common values include 'total_items', + * 'total_pages', 'per_page', or 'infinite_scroll'. + * @return int Number of items that correspond to the given pagination argument. + */ + public function get_pagination_arg($key) + { + } + /** + * Determines whether the table has items to display or not + * + * @since 3.1.0 + * + * @return bool + */ + public function has_items() + { + } + /** + * Message to be displayed when there are no items + * + * @since 3.1.0 + */ + public function no_items() + { + } + /** + * Displays the search box. + * + * @since 3.1.0 + * + * @param string $text The 'submit' button label. + * @param string $input_id ID attribute value for the search input field. + * @phpstan-return void + */ + public function search_box($text, $input_id) + { + } + /** + * Generates views links. + * + * @since 6.1.0 + * + * @param array $link_data { + * An array of link data. + * + * @type string $url The link URL. + * @type string $label The link label. + * @type bool $current Optional. Whether this is the currently selected view. + * } + * @return string[] An array of link markup. Keys match the `$link_data` input array. + * @phpstan-param array{ + * url?: string, + * label?: string, + * current?: bool, + * } $link_data + */ + protected function get_views_links($link_data = array()) + { + } + /** + * Gets the list of views available on this table. + * + * The format is an associative array: + * - `'id' => 'link'` + * + * @since 3.1.0 + * + * @return array + */ + protected function get_views() + { + } + /** + * Displays the list of views available on this table. + * + * @since 3.1.0 + * @phpstan-return void + */ + public function views() + { + } + /** + * Retrieves the list of bulk actions available for this table. + * + * The format is an associative array where each element represents either a top level option value and label, or + * an array representing an optgroup and its options. + * + * For a standard option, the array element key is the field value and the array element value is the field label. + * + * For an optgroup, the array element key is the label and the array element value is an associative array of + * options as above. + * + * Example: + * + * [ + * 'edit' => 'Edit', + * 'delete' => 'Delete', + * 'Change State' => [ + * 'feature' => 'Featured', + * 'sale' => 'On Sale', + * ] + * ] + * + * @since 3.1.0 + * @since 5.6.0 A bulk action can now contain an array of options in order to create an optgroup. + * + * @return array + */ + protected function get_bulk_actions() + { + } + /** + * Displays the bulk actions dropdown. + * + * @since 3.1.0 + * + * @param string $which The location of the bulk actions: Either 'top' or 'bottom'. + * This is designated as optional for backward compatibility. + * @phpstan-param 'top'|'bottom' $which + * @phpstan-return void + */ + protected function bulk_actions($which = '') + { + } + /** + * Gets the current action selected from the bulk actions dropdown. + * + * @since 3.1.0 + * + * @return string|false The action name. False if no action was selected. + */ + public function current_action() + { + } + /** + * Generates the required HTML for a list of row action links. + * + * @since 3.1.0 + * + * @param string[] $actions An array of action links. + * @param bool $always_visible Whether the actions should be always visible. + * @return string The HTML for the row actions. + */ + protected function row_actions($actions, $always_visible = \false) + { + } + /** + * Displays a dropdown for filtering items in the list table by month. + * + * @since 3.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * @global WP_Locale $wp_locale WordPress date and time locale object. + * + * @param string $post_type The post type. + * @phpstan-return void + */ + protected function months_dropdown($post_type) + { + } + /** + * Displays a view switcher. + * + * @since 3.1.0 + * + * @param string $current_mode + */ + protected function view_switcher($current_mode) + { + } + /** + * Displays a comment count bubble. + * + * @since 3.1.0 + * + * @param int $post_id The post ID. + * @param int $pending_comments Number of pending comments. + */ + protected function comments_bubble($post_id, $pending_comments) + { + } + /** + * Gets the current page number. + * + * @since 3.1.0 + * + * @return int + */ + public function get_pagenum() + { + } + /** + * Gets the number of items to display on a single page. + * + * @since 3.1.0 + * + * @param string $option User option name. + * @param int $default_value Optional. The number of items to display. Default 20. + * @return int + */ + protected function get_items_per_page($option, $default_value = 20) + { + } + /** + * Displays the pagination. + * + * @since 3.1.0 + * + * @param string $which The location of the pagination: Either 'top' or 'bottom'. + * @phpstan-param 'top'|'bottom' $which + * @phpstan-return void + */ + protected function pagination($which) + { + } + /** + * Gets a list of columns. + * + * The format is: + * - `'internal-name' => 'Title'` + * + * @since 3.1.0 + * @abstract + * + * @return array + */ + public function get_columns() + { + } + /** + * Gets a list of sortable columns. + * + * The format is: + * - `'internal-name' => 'orderby'` + * - `'internal-name' => array( 'orderby', bool, 'abbr', 'orderby-text', 'initially-sorted-column-order' )` - + * - `'internal-name' => array( 'orderby', 'asc' )` - The second element sets the initial sorting order. + * - `'internal-name' => array( 'orderby', true )` - The second element makes the initial order descending. + * + * In the second format, passing true as second parameter will make the initial + * sorting order be descending. Following parameters add a short column name to + * be used as 'abbr' attribute, a translatable string for the current sorting, + * and the initial order for the initial sorted column, 'asc' or 'desc' (default: false). + * + * @since 3.1.0 + * @since 6.3.0 Added 'abbr', 'orderby-text' and 'initially-sorted-column-order'. + * + * @return array + */ + protected function get_sortable_columns() + { + } + /** + * Gets the name of the default primary column. + * + * @since 4.3.0 + * + * @return string Name of the default primary column, in this case, an empty string. + */ + protected function get_default_primary_column_name() + { + } + /** + * Gets the name of the primary column. + * + * Public wrapper for WP_List_Table::get_default_primary_column_name(). + * + * @since 4.4.0 + * + * @return string Name of the default primary column. + */ + public function get_primary_column() + { + } + /** + * Gets the name of the primary column. + * + * @since 4.3.0 + * + * @return string The name of the primary column. + */ + protected function get_primary_column_name() + { + } + /** + * Gets a list of all, hidden, and sortable columns, with filter applied. + * + * @since 3.1.0 + * + * @return array + */ + protected function get_column_info() + { + } + /** + * Returns the number of visible columns. + * + * @since 3.1.0 + * + * @return int + */ + public function get_column_count() + { + } + /** + * Prints column headers, accounting for hidden and sortable columns. + * + * @since 3.1.0 + * + * @param bool $with_id Whether to set the ID attribute or not + */ + public function print_column_headers($with_id = \true) + { + } + /** + * Print a table description with information about current sorting and order. + * + * For the table initial view, information about initial orderby and order + * should be provided via get_sortable_columns(). + * + * @since 6.3.0 + * @access public + * @phpstan-return void + */ + public function print_table_description() + { + } + /** + * Displays the table. + * + * @since 3.1.0 + */ + public function display() + { + } + /** + * Gets a list of CSS classes for the WP_List_Table table tag. + * + * @since 3.1.0 + * + * @return string[] Array of CSS classes for the table tag. + */ + protected function get_table_classes() + { + } + /** + * Generates the table navigation above or below the table + * + * @since 3.1.0 + * @param string $which The location of the navigation: Either 'top' or 'bottom'. + * @phpstan-param 'top'|'bottom' $which + */ + protected function display_tablenav($which) + { + } + /** + * Displays extra controls between bulk actions and pagination. + * + * @since 3.1.0 + * + * @param string $which + */ + protected function extra_tablenav($which) + { + } + /** + * Generates the tbody element for the list table. + * + * @since 3.1.0 + */ + public function display_rows_or_placeholder() + { + } + /** + * Generates the table rows. + * + * @since 3.1.0 + */ + public function display_rows() + { + } + /** + * Generates content for a single row of the table. + * + * @since 3.1.0 + * + * @param object|array $item The current item + */ + public function single_row($item) + { + } + /** + * @param object|array $item + * @param string $column_name + */ + protected function column_default($item, $column_name) + { + } + /** + * @param object|array $item + */ + protected function column_cb($item) + { + } + /** + * Generates the columns for a single row of the table. + * + * @since 3.1.0 + * + * @param object|array $item The current item. + */ + protected function single_row_columns($item) + { + } + /** + * Generates and display row actions links for the list table. + * + * @since 4.3.0 + * + * @param object|array $item The item being acted upon. + * @param string $column_name Current column name. + * @param string $primary Primary column name. + * @return string The row actions HTML, or an empty string + * if the current column is not the primary column. + */ + protected function handle_row_actions($item, $column_name, $primary) + { + } + /** + * Handles an incoming ajax request (called from admin-ajax.php) + * + * @since 3.1.0 + * @phpstan-return never + */ + public function ajax_response() + { + } + /** + * Sends required variables to JavaScript land. + * + * @since 3.1.0 + */ + public function _js_vars() + { + } + } + /** + * List Table API: WP_Application_Passwords_List_Table class + * + * @package WordPress + * @subpackage Administration + * @since 5.6.0 + */ + /** + * Class for displaying the list of application password items. + * + * @since 5.6.0 + * + * @see WP_List_Table + */ + class WP_Application_Passwords_List_Table extends \WP_List_Table + { + /** + * Gets the list of columns. + * + * @since 5.6.0 + * + * @return string[] Array of column titles keyed by their column name. + */ + public function get_columns() + { + } + /** + * Prepares the list of items for displaying. + * + * @since 5.6.0 + * + * @global int $user_id User ID. + */ + public function prepare_items() + { + } + /** + * Handles the name column output. + * + * @since 5.6.0 + * + * @param array $item The current application password item. + */ + public function column_name($item) + { + } + /** + * Handles the created column output. + * + * @since 5.6.0 + * + * @param array $item The current application password item. + */ + public function column_created($item) + { + } + /** + * Handles the last used column output. + * + * @since 5.6.0 + * + * @param array $item The current application password item. + */ + public function column_last_used($item) + { + } + /** + * Handles the last ip column output. + * + * @since 5.6.0 + * + * @param array $item The current application password item. + */ + public function column_last_ip($item) + { + } + /** + * Handles the revoke column output. + * + * @since 5.6.0 + * + * @param array $item The current application password item. + */ + public function column_revoke($item) + { + } + /** + * Generates content for a single row of the table + * + * @since 5.6.0 + * + * @param array $item The current item. + * @param string $column_name The current column name. + */ + protected function column_default($item, $column_name) + { + } + /** + * Generates custom table navigation to prevent conflicting nonces. + * + * @since 5.6.0 + * + * @param string $which The location of the bulk actions: Either 'top' or 'bottom'. + * @phpstan-param 'top'|'bottom' $which + */ + protected function display_tablenav($which) + { + } + /** + * Generates content for a single row of the table. + * + * @since 5.6.0 + * + * @param array $item The current item. + */ + public function single_row($item) + { + } + /** + * Gets the name of the default primary column. + * + * @since 5.6.0 + * + * @return string Name of the default primary column, in this case, 'name'. + */ + protected function get_default_primary_column_name() + { + } + /** + * Prints the JavaScript template for the new row item. + * + * @since 5.6.0 + */ + public function print_js_template_row() + { + } + } + /** + * Upgrade API: WP_Automatic_Updater class + * + * @package WordPress + * @subpackage Upgrader + * @since 4.6.0 + */ + /** + * Core class used for handling automatic background updates. + * + * @since 3.7.0 + * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader.php. + */ + #[\AllowDynamicProperties] + class WP_Automatic_Updater + { + /** + * Tracks update results during processing. + * + * @var array + */ + protected $update_results = array(); + /** + * Determines whether the entire automatic updater is disabled. + * + * @since 3.7.0 + * + * @return bool True if the automatic updater is disabled, false otherwise. + */ + public function is_disabled() + { + } + /** + * Checks whether access to a given directory is allowed. + * + * This is used when detecting version control checkouts. Takes into account + * the PHP `open_basedir` restrictions, so that WordPress does not try to access + * directories it is not allowed to. + * + * @since 6.2.0 + * + * @param string $dir The directory to check. + * @return bool True if access to the directory is allowed, false otherwise. + */ + public function is_allowed_dir($dir) + { + } + /** + * Checks for version control checkouts. + * + * Checks for Subversion, Git, Mercurial, and Bazaar. It recursively looks up the + * filesystem to the top of the drive, erring on the side of detecting a VCS + * checkout somewhere. + * + * ABSPATH is always checked in addition to whatever `$context` is (which may be the + * wp-content directory, for example). The underlying assumption is that if you are + * using version control *anywhere*, then you should be making decisions for + * how things get updated. + * + * @since 3.7.0 + * + * @param string $context The filesystem path to check, in addition to ABSPATH. + * @return bool True if a VCS checkout was discovered at `$context` or ABSPATH, + * or anywhere higher. False otherwise. + */ + public function is_vcs_checkout($context) + { + } + /** + * Tests to see if we can and should update a specific item. + * + * @since 3.7.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $type The type of update being checked: 'core', 'theme', + * 'plugin', 'translation'. + * @param object $item The update offer. + * @param string $context The filesystem context (a path) against which filesystem + * access and status should be checked. + * @return bool True if the item should be updated, false otherwise. + */ + public function should_update($type, $item, $context) + { + } + /** + * Notifies an administrator of a core update. + * + * @since 3.7.0 + * + * @param object $item The update offer. + * @return bool True if the site administrator is notified of a core update, + * false otherwise. + */ + protected function send_core_update_notification_email($item) + { + } + /** + * Updates an item, if appropriate. + * + * @since 3.7.0 + * + * @param string $type The type of update being checked: 'core', 'theme', 'plugin', 'translation'. + * @param object $item The update offer. + * @return null|WP_Error + */ + public function update($type, $item) + { + } + /** + * Kicks off the background update process, looping through all pending updates. + * + * @since 3.7.0 + * @phpstan-return void + */ + public function run() + { + } + /** + * Checks whether to send an email and avoid processing future updates after + * attempting a core update. + * + * @since 3.7.0 + * + * @param object $update_result The result of the core update. Includes the update offer and result. + * @phpstan-return void + */ + protected function after_core_update($update_result) + { + } + /** + * Sends an email upon the completion or failure of a background core update. + * + * @since 3.7.0 + * + * @param string $type The type of email to send. Can be one of 'success', 'fail', 'manual', 'critical'. + * @param object $core_update The update offer that was attempted. + * @param mixed $result Optional. The result for the core update. Can be WP_Error. + * @phpstan-return void + */ + protected function send_email($type, $core_update, $result = \null) + { + } + /** + * Checks whether an email should be sent after attempting plugin or theme updates. + * + * @since 5.5.0 + * + * @param array $update_results The results of update tasks. + * @phpstan-return void + */ + protected function after_plugin_theme_update($update_results) + { + } + /** + * Sends an email upon the completion or failure of a plugin or theme background update. + * + * @since 5.5.0 + * + * @param string $type The type of email to send. Can be one of 'success', 'fail', 'mixed'. + * @param array $successful_updates A list of updates that succeeded. + * @param array $failed_updates A list of updates that failed. + * @phpstan-return void + */ + protected function send_plugin_theme_email($type, $successful_updates, $failed_updates) + { + } + /** + * Prepares and sends an email of a full log of background update results, useful for debugging and geekery. + * + * @since 3.7.0 + */ + protected function send_debug_email() + { + } + /** + * Performs a loopback request to check for potential fatal errors. + * + * Fatal errors cannot be detected unless maintenance mode is enabled. + * + * @since 6.6.0 + * + * @global int $upgrading The Unix timestamp marking when upgrading WordPress began. + * + * @return bool Whether a fatal error was detected. + */ + protected function has_fatal_error() + { + } + } + /** + * List Table API: WP_Comments_List_Table class + * + * @package WordPress + * @subpackage Administration + * @since 3.1.0 + */ + /** + * Core class used to implement displaying comments in a list table. + * + * @since 3.1.0 + * + * @see WP_List_Table + */ + class WP_Comments_List_Table extends \WP_List_Table + { + public $checkbox = \true; + public $pending_count = array(); + public $extra_items; + /** + * Constructor. + * + * @since 3.1.0 + * + * @see WP_List_Table::__construct() for more information on default arguments. + * + * @global int $post_id + * + * @param array $args An associative array of arguments. + */ + public function __construct($args = array()) + { + } + /** + * Adds avatars to comment author names. + * + * @since 3.1.0 + * + * @param string $name Comment author name. + * @param int $comment_id Comment ID. + * @return string Avatar with the user name. + */ + public function floated_admin_avatar($name, $comment_id) + { + } + /** + * @return bool + */ + public function ajax_user_can() + { + } + /** + * @global string $mode List table view mode. + * @global int $post_id + * @global string $comment_status + * @global string $comment_type + * @global string $search + */ + public function prepare_items() + { + } + /** + * @param string $comment_status + * @return int + */ + public function get_per_page($comment_status = 'all') + { + } + /** + * @global string $comment_status + */ + public function no_items() + { + } + /** + * @global int $post_id + * @global string $comment_status + * @global string $comment_type + */ + protected function get_views() + { + } + /** + * @global string $comment_status + * + * @return array + */ + protected function get_bulk_actions() + { + } + /** + * @global string $comment_status + * @global string $comment_type + * + * @param string $which + */ + protected function extra_tablenav($which) + { + } + /** + * @return string|false + */ + public function current_action() + { + } + /** + * @global int $post_id + * + * @return string[] Array of column titles keyed by their column name. + */ + public function get_columns() + { + } + /** + * Displays a comment type drop-down for filtering on the Comments list table. + * + * @since 5.5.0 + * @since 5.6.0 Renamed from `comment_status_dropdown()` to `comment_type_dropdown()`. + * + * @param string $comment_type The current comment type slug. + */ + protected function comment_type_dropdown($comment_type) + { + } + /** + * @return array + */ + protected function get_sortable_columns() + { + } + /** + * Gets the name of the default primary column. + * + * @since 4.3.0 + * + * @return string Name of the default primary column, in this case, 'comment'. + */ + protected function get_default_primary_column_name() + { + } + /** + * Displays the comments table. + * + * Overrides the parent display() method to render extra comments. + * + * @since 3.1.0 + */ + public function display() + { + } + /** + * @global WP_Post $post Global post object. + * @global WP_Comment $comment Global comment object. + * + * @param WP_Comment $item + */ + public function single_row($item) + { + } + /** + * Generates and displays row actions links. + * + * @since 4.3.0 + * @since 5.9.0 Renamed `$comment` to `$item` to match parent class for PHP 8 named parameter support. + * + * @global string $comment_status Status for the current listed comments. + * + * @param WP_Comment $item The comment object. + * @param string $column_name Current column name. + * @param string $primary Primary column name. + * @return string Row actions output for comments. An empty string + * if the current column is not the primary column, + * or if the current user cannot edit the comment. + */ + protected function handle_row_actions($item, $column_name, $primary) + { + } + /** + * @since 5.9.0 Renamed `$comment` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param WP_Comment $item The comment object. + */ + public function column_cb($item) + { + } + /** + * @param WP_Comment $comment The comment object. + */ + public function column_comment($comment) + { + } + /** + * @global string $comment_status + * + * @param WP_Comment $comment The comment object. + */ + public function column_author($comment) + { + } + /** + * @param WP_Comment $comment The comment object. + */ + public function column_date($comment) + { + } + /** + * @param WP_Comment $comment The comment object. + * @phpstan-return void + */ + public function column_response($comment) + { + } + /** + * @since 5.9.0 Renamed `$comment` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param WP_Comment $item The comment object. + * @param string $column_name The custom column's name. + */ + public function column_default($item, $column_name) + { + } + } + /** + * Administration: Community Events class. + * + * @package WordPress + * @subpackage Administration + * @since 4.8.0 + */ + /** + * Class WP_Community_Events. + * + * A client for api.wordpress.org/events. + * + * @since 4.8.0 + */ + #[\AllowDynamicProperties] + class WP_Community_Events + { + /** + * ID for a WordPress user account. + * + * @since 4.8.0 + * + * @var int + */ + protected $user_id = 0; + /** + * Stores location data for the user. + * + * @since 4.8.0 + * + * @var false|array + */ + protected $user_location = \false; + /** + * Constructor for WP_Community_Events. + * + * @since 4.8.0 + * + * @param int $user_id WP user ID. + * @param false|array $user_location { + * Stored location data for the user. false to pass no location. + * + * @type string $description The name of the location + * @type string $latitude The latitude in decimal degrees notation, without the degree + * symbol. e.g.: 47.615200. + * @type string $longitude The longitude in decimal degrees notation, without the degree + * symbol. e.g.: -122.341100. + * @type string $country The ISO 3166-1 alpha-2 country code. e.g.: BR + * } + * @phpstan-param false|array{ + * description?: string, + * latitude?: string, + * longitude?: string, + * country?: string, + * } $user_location + */ + public function __construct($user_id, $user_location = \false) + { + } + /** + * Gets data about events near a particular location. + * + * Cached events will be immediately returned if the `user_location` property + * is set for the current user, and cached events exist for that location. + * + * Otherwise, this method sends a request to the w.org Events API with location + * data. The API will send back a recognized location based on the data, along + * with nearby events. + * + * The browser's request for events is proxied with this method, rather + * than having the browser make the request directly to api.wordpress.org, + * because it allows results to be cached server-side and shared with other + * users and sites in the network. This makes the process more efficient, + * since increasing the number of visits that get cached data means users + * don't have to wait as often; if the user's browser made the request + * directly, it would also need to make a second request to WP in order to + * pass the data for caching. Having WP make the request also introduces + * the opportunity to anonymize the IP before sending it to w.org, which + * mitigates possible privacy concerns. + * + * @since 4.8.0 + * @since 5.5.2 Response no longer contains formatted date field. They're added + * in `wp.communityEvents.populateDynamicEventFields()` now. + * + * @param string $location_search Optional. City name to help determine the location. + * e.g., "Seattle". Default empty string. + * @param string $timezone Optional. Timezone to help determine the location. + * Default empty string. + * @return array|WP_Error A WP_Error on failure; an array with location and events on + * success. + */ + public function get_events($location_search = '', $timezone = '') + { + } + /** + * Builds an array of args to use in an HTTP request to the w.org Events API. + * + * @since 4.8.0 + * + * @param string $search Optional. City search string. Default empty string. + * @param string $timezone Optional. Timezone string. Default empty string. + * @return array The request args. + */ + protected function get_request_args($search = '', $timezone = '') + { + } + /** + * Determines the user's actual IP address and attempts to partially + * anonymize an IP address by converting it to a network ID. + * + * Geolocating the network ID usually returns a similar location as the + * actual IP, but provides some privacy for the user. + * + * $_SERVER['REMOTE_ADDR'] cannot be used in all cases, such as when the user + * is making their request through a proxy, or when the web server is behind + * a proxy. In those cases, $_SERVER['REMOTE_ADDR'] is set to the proxy address rather + * than the user's actual address. + * + * Modified from https://stackoverflow.com/a/2031935/450127, MIT license. + * Modified from https://github.com/geertw/php-ip-anonymizer, MIT license. + * + * SECURITY WARNING: This function is _NOT_ intended to be used in + * circumstances where the authenticity of the IP address matters. This does + * _NOT_ guarantee that the returned address is valid or accurate, and it can + * be easily spoofed. + * + * @since 4.8.0 + * + * @return string|false The anonymized address on success; the given address + * or false on failure. + */ + public static function get_unsafe_client_ip() + { + } + /** + * Test if two pairs of latitude/longitude coordinates match each other. + * + * @since 4.8.0 + * + * @param array $a The first pair, with indexes 'latitude' and 'longitude'. + * @param array $b The second pair, with indexes 'latitude' and 'longitude'. + * @return bool True if they match, false if they don't. + */ + protected function coordinates_match($a, $b) + { + } + /** + * Generates a transient key based on user location. + * + * This could be reduced to a one-liner in the calling functions, but it's + * intentionally a separate function because it's called from multiple + * functions, and having it abstracted keeps the logic consistent and DRY, + * which is less prone to errors. + * + * @since 4.8.0 + * + * @param array $location Should contain 'latitude' and 'longitude' indexes. + * @return string|false Transient key on success, false on failure. + */ + protected function get_events_transient_key($location) + { + } + /** + * Caches an array of events data from the Events API. + * + * @since 4.8.0 + * + * @param array $events Response body from the API request. + * @param int|false $expiration Optional. Amount of time to cache the events. Defaults to false. + * @return bool true if events were cached; false if not. + */ + protected function cache_events($events, $expiration = \false) + { + } + /** + * Gets cached events. + * + * @since 4.8.0 + * @since 5.5.2 Response no longer contains formatted date field. They're added + * in `wp.communityEvents.populateDynamicEventFields()` now. + * + * @return array|false An array containing `location` and `events` items + * on success, false on failure. + */ + public function get_cached_events() + { + } + /** + * Adds formatted date and time items for each event in an API response. + * + * This has to be called after the data is pulled from the cache, because + * the cached events are shared by all users. If it was called before storing + * the cache, then all users would see the events in the localized data/time + * of the user who triggered the cache refresh, rather than their own. + * + * @since 4.8.0 + * @deprecated 5.6.0 No longer used in core. + * + * @param array $response_body The response which contains the events. + * @return array The response with dates and times formatted. + */ + protected function format_event_data_time($response_body) + { + } + /** + * Prepares the event list for presentation. + * + * Discards expired events, and makes WordCamps "sticky." Attendees need more + * advanced notice about WordCamps than they do for meetups, so camps should + * appear in the list sooner. If a WordCamp is coming up, the API will "stick" + * it in the response, even if it wouldn't otherwise appear. When that happens, + * the event will be at the end of the list, and will need to be moved into a + * higher position, so that it doesn't get trimmed off. + * + * @since 4.8.0 + * @since 4.9.7 Stick a WordCamp to the final list. + * @since 5.5.2 Accepts and returns only the events, rather than an entire HTTP response. + * @since 6.0.0 Decode HTML entities from the event title. + * + * @param array $events The events that will be prepared. + * @return array The response body with events trimmed. + */ + protected function trim_events(array $events) + { + } + /** + * Logs responses to Events API requests. + * + * @since 4.8.0 + * @deprecated 4.9.0 Use a plugin instead. See #41217 for an example. + * + * @param string $message A description of what occurred. + * @param array $details Details that provide more context for the + * log entry. + * @phpstan-return void + */ + protected function maybe_log_events_response($message, $details) + { + } + } + /** + * Class for providing debug data based on a users WordPress environment. + * + * @package WordPress + * @subpackage Site_Health + * @since 5.2.0 + */ + #[\AllowDynamicProperties] + class WP_Debug_Data + { + /** + * Calls all core functions to check for updates. + * + * @since 5.2.0 + */ + public static function check_for_updates() + { + } + /** + * Static function for generating site debug data when required. + * + * @since 5.2.0 + * @since 5.3.0 Added database charset, database collation, + * and timezone information. + * @since 5.5.0 Added pretty permalinks support information. + * + * @throws ImagickException + * @global wpdb $wpdb WordPress database abstraction object. + * @global array $_wp_theme_features + * + * @return array The debug data for the site. + */ + public static function debug_data() + { + } + /** + * Returns the value of a MySQL system variable. + * + * @since 5.9.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $mysql_var Name of the MySQL system variable. + * @return string|null The variable value on success. Null if the variable does not exist. + */ + public static function get_mysql_var($mysql_var) + { + } + /** + * Formats the information gathered for debugging, in a manner suitable for copying to a forum or support ticket. + * + * @since 5.2.0 + * + * @param array $info_array Information gathered from the `WP_Debug_Data::debug_data()` function. + * @param string $data_type The data type to return, either 'info' or 'debug'. + * @return string The formatted data. + * @phpstan-param 'info'|'debug' $data_type + */ + public static function format($info_array, $data_type) + { + } + /** + * Fetches the total size of all the database tables for the active database user. + * + * @since 5.2.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return int The size of the database, in bytes. + */ + public static function get_database_size() + { + } + /** + * Fetches the sizes of the WordPress directories: `wordpress` (ABSPATH), `plugins`, `themes`, and `uploads`. + * Intended to supplement the array returned by `WP_Debug_Data::debug_data()`. + * + * @since 5.2.0 + * + * @return array The sizes of the directories, also the database size and total installation size. + */ + public static function get_sizes() + { + } + } + /** + * Base WordPress Filesystem + * + * @package WordPress + * @subpackage Filesystem + */ + /** + * Base WordPress Filesystem class which Filesystem implementations extend. + * + * @since 2.5.0 + */ + #[\AllowDynamicProperties] + class WP_Filesystem_Base + { + /** + * Whether to display debug data for the connection. + * + * @since 2.5.0 + * @var bool + */ + public $verbose = \false; + /** + * Cached list of local filepaths to mapped remote filepaths. + * + * @since 2.7.0 + * @var array + */ + public $cache = array(); + /** + * The Access method of the current connection, Set automatically. + * + * @since 2.5.0 + * @var string + */ + public $method = ''; + /** + * @var WP_Error + */ + public $errors = \null; + /** + */ + public $options = array(); + /** + * Returns the path on the remote filesystem of ABSPATH. + * + * @since 2.7.0 + * + * @return string The location of the remote path. + */ + public function abspath() + { + } + /** + * Returns the path on the remote filesystem of WP_CONTENT_DIR. + * + * @since 2.7.0 + * + * @return string The location of the remote path. + */ + public function wp_content_dir() + { + } + /** + * Returns the path on the remote filesystem of WP_PLUGIN_DIR. + * + * @since 2.7.0 + * + * @return string The location of the remote path. + */ + public function wp_plugins_dir() + { + } + /** + * Returns the path on the remote filesystem of the Themes Directory. + * + * @since 2.7.0 + * + * @param string|false $theme Optional. The theme stylesheet or template for the directory. + * Default false. + * @return string The location of the remote path. + */ + public function wp_themes_dir($theme = \false) + { + } + /** + * Returns the path on the remote filesystem of WP_LANG_DIR. + * + * @since 3.2.0 + * + * @return string The location of the remote path. + */ + public function wp_lang_dir() + { + } + /** + * Locates a folder on the remote filesystem. + * + * @since 2.5.0 + * @deprecated 2.7.0 use WP_Filesystem_Base::abspath() or WP_Filesystem_Base::wp_*_dir() instead. + * @see WP_Filesystem_Base::abspath() + * @see WP_Filesystem_Base::wp_content_dir() + * @see WP_Filesystem_Base::wp_plugins_dir() + * @see WP_Filesystem_Base::wp_themes_dir() + * @see WP_Filesystem_Base::wp_lang_dir() + * + * @param string $base Optional. The folder to start searching from. Default '.'. + * @param bool $verbose Optional. True to display debug information. Default false. + * @return string The location of the remote path. + */ + public function find_base_dir($base = '.', $verbose = \false) + { + } + /** + * Locates a folder on the remote filesystem. + * + * @since 2.5.0 + * @deprecated 2.7.0 use WP_Filesystem_Base::abspath() or WP_Filesystem_Base::wp_*_dir() methods instead. + * @see WP_Filesystem_Base::abspath() + * @see WP_Filesystem_Base::wp_content_dir() + * @see WP_Filesystem_Base::wp_plugins_dir() + * @see WP_Filesystem_Base::wp_themes_dir() + * @see WP_Filesystem_Base::wp_lang_dir() + * + * @param string $base Optional. The folder to start searching from. Default '.'. + * @param bool $verbose Optional. True to display debug information. Default false. + * @return string The location of the remote path. + */ + public function get_base_dir($base = '.', $verbose = \false) + { + } + /** + * Locates a folder on the remote filesystem. + * + * Assumes that on Windows systems, Stripping off the Drive + * letter is OK Sanitizes \\ to / in Windows filepaths. + * + * @since 2.7.0 + * + * @param string $folder the folder to locate. + * @return string|false The location of the remote path, false on failure. + */ + public function find_folder($folder) + { + } + /** + * Locates a folder on the remote filesystem. + * + * Expects Windows sanitized path. + * + * @since 2.7.0 + * + * @param string $folder The folder to locate. + * @param string $base The folder to start searching from. + * @param bool $loop If the function has recursed. Internal use only. + * @return string|false The location of the remote path, false to cease looping. + */ + public function search_for_folder($folder, $base = '.', $loop = \false) + { + } + /** + * Returns the *nix-style file permissions for a file. + * + * From the PHP documentation page for fileperms(). + * + * @link https://www.php.net/manual/en/function.fileperms.php + * + * @since 2.5.0 + * + * @param string $file String filename. + * @return string The *nix-style representation of permissions. + */ + public function gethchmod($file) + { + } + /** + * Gets the permissions of the specified file or filepath in their octal format. + * + * @since 2.5.0 + * + * @param string $file Path to the file. + * @return string Mode of the file (the last 3 digits). + */ + public function getchmod($file) + { + } + /** + * Converts *nix-style file permissions to an octal number. + * + * Converts '-rw-r--r--' to 0644 + * From "info at rvgate dot nl"'s comment on the PHP documentation for chmod() + * + * @link https://www.php.net/manual/en/function.chmod.php#49614 + * + * @since 2.5.0 + * + * @param string $mode string The *nix-style file permissions. + * @return string Octal representation of permissions. + */ + public function getnumchmodfromh($mode) + { + } + /** + * Determines if the string provided contains binary characters. + * + * @since 2.7.0 + * + * @param string $text String to test against. + * @return bool True if string is binary, false otherwise. + */ + public function is_binary($text) + { + } + /** + * Changes the owner of a file or directory. + * + * Default behavior is to do nothing, override this in your subclass, if desired. + * + * @since 2.5.0 + * + * @param string $file Path to the file or directory. + * @param string|int $owner A user name or number. + * @param bool $recursive Optional. If set to true, changes file owner recursively. + * Default false. + * @return bool True on success, false on failure. + */ + public function chown($file, $owner, $recursive = \false) + { + } + /** + * Connects filesystem. + * + * @since 2.5.0 + * @abstract + * + * @return bool True on success, false on failure (always true for WP_Filesystem_Direct). + */ + public function connect() + { + } + /** + * Reads entire file into a string. + * + * @since 2.5.0 + * @abstract + * + * @param string $file Name of the file to read. + * @return string|false Read data on success, false on failure. + */ + public function get_contents($file) + { + } + /** + * Reads entire file into an array. + * + * @since 2.5.0 + * @abstract + * + * @param string $file Path to the file. + * @return array|false File contents in an array on success, false on failure. + */ + public function get_contents_array($file) + { + } + /** + * Writes a string to a file. + * + * @since 2.5.0 + * @abstract + * + * @param string $file Remote path to the file where to write the data. + * @param string $contents The data to write. + * @param int|false $mode Optional. The file permissions as octal number, usually 0644. + * Default false. + * @return bool True on success, false on failure. + */ + public function put_contents($file, $contents, $mode = \false) + { + } + /** + * Gets the current working directory. + * + * @since 2.5.0 + * @abstract + * + * @return string|false The current working directory on success, false on failure. + */ + public function cwd() + { + } + /** + * Changes current directory. + * + * @since 2.5.0 + * @abstract + * + * @param string $dir The new current directory. + * @return bool True on success, false on failure. + */ + public function chdir($dir) + { + } + /** + * Changes the file group. + * + * @since 2.5.0 + * @abstract + * + * @param string $file Path to the file. + * @param string|int $group A group name or number. + * @param bool $recursive Optional. If set to true, changes file group recursively. + * Default false. + * @return bool True on success, false on failure. + */ + public function chgrp($file, $group, $recursive = \false) + { + } + /** + * Changes filesystem permissions. + * + * @since 2.5.0 + * @abstract + * + * @param string $file Path to the file. + * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, + * 0755 for directories. Default false. + * @param bool $recursive Optional. If set to true, changes file permissions recursively. + * Default false. + * @return bool True on success, false on failure. + */ + public function chmod($file, $mode = \false, $recursive = \false) + { + } + /** + * Gets the file owner. + * + * @since 2.5.0 + * @abstract + * + * @param string $file Path to the file. + * @return string|false Username of the owner on success, false on failure. + */ + public function owner($file) + { + } + /** + * Gets the file's group. + * + * @since 2.5.0 + * @abstract + * + * @param string $file Path to the file. + * @return string|false The group on success, false on failure. + */ + public function group($file) + { + } + /** + * Copies a file. + * + * @since 2.5.0 + * @abstract + * + * @param string $source Path to the source file. + * @param string $destination Path to the destination file. + * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. + * Default false. + * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, + * 0755 for dirs. Default false. + * @return bool True on success, false on failure. + */ + public function copy($source, $destination, $overwrite = \false, $mode = \false) + { + } + /** + * Moves a file. + * + * @since 2.5.0 + * @abstract + * + * @param string $source Path to the source file. + * @param string $destination Path to the destination file. + * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. + * Default false. + * @return bool True on success, false on failure. + */ + public function move($source, $destination, $overwrite = \false) + { + } + /** + * Deletes a file or directory. + * + * @since 2.5.0 + * @abstract + * + * @param string $file Path to the file or directory. + * @param bool $recursive Optional. If set to true, deletes files and folders recursively. + * Default false. + * @param string|false $type Type of resource. 'f' for file, 'd' for directory. + * Default false. + * @return bool True on success, false on failure. + */ + public function delete($file, $recursive = \false, $type = \false) + { + } + /** + * Checks if a file or directory exists. + * + * @since 2.5.0 + * @abstract + * + * @param string $path Path to file or directory. + * @return bool Whether $path exists or not. + */ + public function exists($path) + { + } + /** + * Checks if resource is a file. + * + * @since 2.5.0 + * @abstract + * + * @param string $file File path. + * @return bool Whether $file is a file. + */ + public function is_file($file) + { + } + /** + * Checks if resource is a directory. + * + * @since 2.5.0 + * @abstract + * + * @param string $path Directory path. + * @return bool Whether $path is a directory. + */ + public function is_dir($path) + { + } + /** + * Checks if a file is readable. + * + * @since 2.5.0 + * @abstract + * + * @param string $file Path to file. + * @return bool Whether $file is readable. + */ + public function is_readable($file) + { + } + /** + * Checks if a file or directory is writable. + * + * @since 2.5.0 + * @abstract + * + * @param string $path Path to file or directory. + * @return bool Whether $path is writable. + */ + public function is_writable($path) + { + } + /** + * Gets the file's last access time. + * + * @since 2.5.0 + * @abstract + * + * @param string $file Path to file. + * @return int|false Unix timestamp representing last access time, false on failure. + */ + public function atime($file) + { + } + /** + * Gets the file modification time. + * + * @since 2.5.0 + * @abstract + * + * @param string $file Path to file. + * @return int|false Unix timestamp representing modification time, false on failure. + */ + public function mtime($file) + { + } + /** + * Gets the file size (in bytes). + * + * @since 2.5.0 + * @abstract + * + * @param string $file Path to file. + * @return int|false Size of the file in bytes on success, false on failure. + */ + public function size($file) + { + } + /** + * Sets the access and modification times of a file. + * + * Note: If $file doesn't exist, it will be created. + * + * @since 2.5.0 + * @abstract + * + * @param string $file Path to file. + * @param int $time Optional. Modified time to set for file. + * Default 0. + * @param int $atime Optional. Access time to set for file. + * Default 0. + * @return bool True on success, false on failure. + */ + public function touch($file, $time = 0, $atime = 0) + { + } + /** + * Creates a directory. + * + * @since 2.5.0 + * @abstract + * + * @param string $path Path for new directory. + * @param int|false $chmod Optional. The permissions as octal number (or false to skip chmod). + * Default false. + * @param string|int|false $chown Optional. A user name or number (or false to skip chown). + * Default false. + * @param string|int|false $chgrp Optional. A group name or number (or false to skip chgrp). + * Default false. + * @return bool True on success, false on failure. + */ + public function mkdir($path, $chmod = \false, $chown = \false, $chgrp = \false) + { + } + /** + * Deletes a directory. + * + * @since 2.5.0 + * @abstract + * + * @param string $path Path to directory. + * @param bool $recursive Optional. Whether to recursively remove files/directories. + * Default false. + * @return bool True on success, false on failure. + */ + public function rmdir($path, $recursive = \false) + { + } + /** + * Gets details for files in a directory or a specific file. + * + * @since 2.5.0 + * @abstract + * + * @param string $path Path to directory or file. + * @param bool $include_hidden Optional. Whether to include details of hidden ("." prefixed) files. + * Default true. + * @param bool $recursive Optional. Whether to recursively include file details in nested directories. + * Default false. + * @return array|false { + * Array of arrays containing file information. False if unable to list directory contents. + * + * @type array ...$0 { + * Array of file information. Note that some elements may not be available on all filesystems. + * + * @type string $name Name of the file or directory. + * @type string $perms *nix representation of permissions. + * @type string $permsn Octal representation of permissions. + * @type int|string|false $number File number. May be a numeric string. False if not available. + * @type string|false $owner Owner name or ID, or false if not available. + * @type string|false $group File permissions group, or false if not available. + * @type int|string|false $size Size of file in bytes. May be a numeric string. + * False if not available. + * @type int|string|false $lastmodunix Last modified unix timestamp. May be a numeric string. + * False if not available. + * @type string|false $lastmod Last modified month (3 letters) and day (without leading 0), or + * false if not available. + * @type string|false $time Last modified time, or false if not available. + * @type string $type Type of resource. 'f' for file, 'd' for directory, 'l' for link. + * @type array|false $files If a directory and `$recursive` is true, contains another array of + * files. False if unable to list directory contents. + * } + * } + * @phpstan-return false|array<int|string, array{ + * name: string, + * perms: string, + * permsn: string, + * number: int|string|false, + * owner: string|false, + * group: string|false, + * size: int|string|false, + * lastmodunix: int|string|false, + * lastmod: string|false, + * time: string|false, + * type: string, + * files: array|false, + * }> + * @phpstan-return false|array<string, array{name: string, perms: string, permsn: string, owner: string|false, size: int|string|false, lastmodunix: int|string|false, lastmod: string|false, time: string|false, type: 'f'|'d'|'l', group: string|false, number: int|string|false, files?: array|false}> + */ + public function dirlist($path, $include_hidden = \true, $recursive = \false) + { + } + } + /** + * WordPress Direct Filesystem. + * + * @package WordPress + * @subpackage Filesystem + */ + /** + * WordPress Filesystem Class for direct PHP file and folder manipulation. + * + * @since 2.5.0 + * + * @see WP_Filesystem_Base + */ + class WP_Filesystem_Direct extends \WP_Filesystem_Base + { + /** + * Constructor. + * + * @since 2.5.0 + * + * @param mixed $arg Not used. + */ + public function __construct($arg) + { + } + /** + * Reads entire file into a string. + * + * @since 2.5.0 + * + * @param string $file Name of the file to read. + * @return string|false Read data on success, false on failure. + */ + public function get_contents($file) + { + } + /** + * Reads entire file into an array. + * + * @since 2.5.0 + * + * @param string $file Path to the file. + * @return array|false File contents in an array on success, false on failure. + */ + public function get_contents_array($file) + { + } + /** + * Writes a string to a file. + * + * @since 2.5.0 + * + * @param string $file Remote path to the file where to write the data. + * @param string $contents The data to write. + * @param int|false $mode Optional. The file permissions as octal number, usually 0644. + * Default false. + * @return bool True on success, false on failure. + */ + public function put_contents($file, $contents, $mode = \false) + { + } + /** + * Gets the current working directory. + * + * @since 2.5.0 + * + * @return string|false The current working directory on success, false on failure. + */ + public function cwd() + { + } + /** + * Changes current directory. + * + * @since 2.5.0 + * + * @param string $dir The new current directory. + * @return bool True on success, false on failure. + */ + public function chdir($dir) + { + } + /** + * Changes the file group. + * + * @since 2.5.0 + * + * @param string $file Path to the file. + * @param string|int $group A group name or number. + * @param bool $recursive Optional. If set to true, changes file group recursively. + * Default false. + * @return bool True on success, false on failure. + */ + public function chgrp($file, $group, $recursive = \false) + { + } + /** + * Changes filesystem permissions. + * + * @since 2.5.0 + * + * @param string $file Path to the file. + * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, + * 0755 for directories. Default false. + * @param bool $recursive Optional. If set to true, changes file permissions recursively. + * Default false. + * @return bool True on success, false on failure. + */ + public function chmod($file, $mode = \false, $recursive = \false) + { + } + /** + * Changes the owner of a file or directory. + * + * @since 2.5.0 + * + * @param string $file Path to the file or directory. + * @param string|int $owner A user name or number. + * @param bool $recursive Optional. If set to true, changes file owner recursively. + * Default false. + * @return bool True on success, false on failure. + */ + public function chown($file, $owner, $recursive = \false) + { + } + /** + * Gets the file owner. + * + * @since 2.5.0 + * + * @param string $file Path to the file. + * @return string|false Username of the owner on success, false on failure. + */ + public function owner($file) + { + } + /** + * Gets the permissions of the specified file or filepath in their octal format. + * + * FIXME does not handle errors in fileperms() + * + * @since 2.5.0 + * + * @param string $file Path to the file. + * @return string Mode of the file (the last 3 digits). + */ + public function getchmod($file) + { + } + /** + * Gets the file's group. + * + * @since 2.5.0 + * + * @param string $file Path to the file. + * @return string|false The group on success, false on failure. + */ + public function group($file) + { + } + /** + * Copies a file. + * + * @since 2.5.0 + * + * @param string $source Path to the source file. + * @param string $destination Path to the destination file. + * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. + * Default false. + * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, + * 0755 for dirs. Default false. + * @return bool True on success, false on failure. + */ + public function copy($source, $destination, $overwrite = \false, $mode = \false) + { + } + /** + * Moves a file or directory. + * + * After moving files or directories, OPcache will need to be invalidated. + * + * If moving a directory fails, `copy_dir()` can be used for a recursive copy. + * + * Use `move_dir()` for moving directories with OPcache invalidation and a + * fallback to `copy_dir()`. + * + * @since 2.5.0 + * + * @param string $source Path to the source file. + * @param string $destination Path to the destination file. + * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. + * Default false. + * @return bool True on success, false on failure. + */ + public function move($source, $destination, $overwrite = \false) + { + } + /** + * Deletes a file or directory. + * + * @since 2.5.0 + * + * @param string $file Path to the file or directory. + * @param bool $recursive Optional. If set to true, deletes files and folders recursively. + * Default false. + * @param string|false $type Type of resource. 'f' for file, 'd' for directory. + * Default false. + * @return bool True on success, false on failure. + */ + public function delete($file, $recursive = \false, $type = \false) + { + } + /** + * Checks if a file or directory exists. + * + * @since 2.5.0 + * + * @param string $path Path to file or directory. + * @return bool Whether $path exists or not. + */ + public function exists($path) + { + } + /** + * Checks if resource is a file. + * + * @since 2.5.0 + * + * @param string $file File path. + * @return bool Whether $file is a file. + */ + public function is_file($file) + { + } + /** + * Checks if resource is a directory. + * + * @since 2.5.0 + * + * @param string $path Directory path. + * @return bool Whether $path is a directory. + */ + public function is_dir($path) + { + } + /** + * Checks if a file is readable. + * + * @since 2.5.0 + * + * @param string $file Path to file. + * @return bool Whether $file is readable. + */ + public function is_readable($file) + { + } + /** + * Checks if a file or directory is writable. + * + * @since 2.5.0 + * + * @param string $path Path to file or directory. + * @return bool Whether $path is writable. + */ + public function is_writable($path) + { + } + /** + * Gets the file's last access time. + * + * @since 2.5.0 + * + * @param string $file Path to file. + * @return int|false Unix timestamp representing last access time, false on failure. + */ + public function atime($file) + { + } + /** + * Gets the file modification time. + * + * @since 2.5.0 + * + * @param string $file Path to file. + * @return int|false Unix timestamp representing modification time, false on failure. + */ + public function mtime($file) + { + } + /** + * Gets the file size (in bytes). + * + * @since 2.5.0 + * + * @param string $file Path to file. + * @return int|false Size of the file in bytes on success, false on failure. + */ + public function size($file) + { + } + /** + * Sets the access and modification times of a file. + * + * Note: If $file doesn't exist, it will be created. + * + * @since 2.5.0 + * + * @param string $file Path to file. + * @param int $time Optional. Modified time to set for file. + * Default 0. + * @param int $atime Optional. Access time to set for file. + * Default 0. + * @return bool True on success, false on failure. + */ + public function touch($file, $time = 0, $atime = 0) + { + } + /** + * Creates a directory. + * + * @since 2.5.0 + * + * @param string $path Path for new directory. + * @param int|false $chmod Optional. The permissions as octal number (or false to skip chmod). + * Default false. + * @param string|int|false $chown Optional. A user name or number (or false to skip chown). + * Default false. + * @param string|int|false $chgrp Optional. A group name or number (or false to skip chgrp). + * Default false. + * @return bool True on success, false on failure. + */ + public function mkdir($path, $chmod = \false, $chown = \false, $chgrp = \false) + { + } + /** + * Deletes a directory. + * + * @since 2.5.0 + * + * @param string $path Path to directory. + * @param bool $recursive Optional. Whether to recursively remove files/directories. + * Default false. + * @return bool True on success, false on failure. + */ + public function rmdir($path, $recursive = \false) + { + } + /** + * Gets details for files in a directory or a specific file. + * + * @since 2.5.0 + * + * @param string $path Path to directory or file. + * @param bool $include_hidden Optional. Whether to include details of hidden ("." prefixed) files. + * Default true. + * @param bool $recursive Optional. Whether to recursively include file details in nested directories. + * Default false. + * @return array|false { + * Array of arrays containing file information. False if unable to list directory contents. + * + * @type array ...$0 { + * Array of file information. Note that some elements may not be available on all filesystems. + * + * @type string $name Name of the file or directory. + * @type string $perms *nix representation of permissions. + * @type string $permsn Octal representation of permissions. + * @type false $number File number. Always false in this context. + * @type string|false $owner Owner name or ID, or false if not available. + * @type string|false $group File permissions group, or false if not available. + * @type int|string|false $size Size of file in bytes. May be a numeric string. + * False if not available. + * @type int|string|false $lastmodunix Last modified unix timestamp. May be a numeric string. + * False if not available. + * @type string|false $lastmod Last modified month (3 letters) and day (without leading 0), or + * false if not available. + * @type string|false $time Last modified time, or false if not available. + * @type string $type Type of resource. 'f' for file, 'd' for directory, 'l' for link. + * @type array|false $files If a directory and `$recursive` is true, contains another array of + * files. False if unable to list directory contents. + * } + * } + * @phpstan-return false|array<int|string, array{ + * name: string, + * perms: string, + * permsn: string, + * number: false, + * owner: string|false, + * group: string|false, + * size: int|string|false, + * lastmodunix: int|string|false, + * lastmod: string|false, + * time: string|false, + * type: string, + * files: array|false, + * }> + * @phpstan-return false|array<string, array{name: string, perms: string, permsn: string, owner: string|false, size: int|string|false, lastmodunix: int|string|false, lastmod: string|false, time: string|false, type: 'f'|'d'|'l', group: string|false, number: int|string|false, files?: array|false}> + */ + public function dirlist($path, $include_hidden = \true, $recursive = \false) + { + } + } + /** + * WordPress FTP Filesystem. + * + * @package WordPress + * @subpackage Filesystem + */ + /** + * WordPress Filesystem Class for implementing FTP. + * + * @since 2.5.0 + * + * @see WP_Filesystem_Base + */ + class WP_Filesystem_FTPext extends \WP_Filesystem_Base + { + /** + * @since 2.5.0 + * @var resource + */ + public $link; + /** + * Constructor. + * + * @since 2.5.0 + * + * @param array $opt + * @phpstan-return void + */ + public function __construct($opt = '') + { + } + /** + * Connects filesystem. + * + * @since 2.5.0 + * + * @return bool True on success, false on failure. + */ + public function connect() + { + } + /** + * Reads entire file into a string. + * + * @since 2.5.0 + * + * @param string $file Name of the file to read. + * @return string|false Read data on success, false if no temporary file could be opened, + * or if the file couldn't be retrieved. + */ + public function get_contents($file) + { + } + /** + * Reads entire file into an array. + * + * @since 2.5.0 + * + * @param string $file Path to the file. + * @return array|false File contents in an array on success, false on failure. + */ + public function get_contents_array($file) + { + } + /** + * Writes a string to a file. + * + * @since 2.5.0 + * + * @param string $file Remote path to the file where to write the data. + * @param string $contents The data to write. + * @param int|false $mode Optional. The file permissions as octal number, usually 0644. + * Default false. + * @return bool True on success, false on failure. + */ + public function put_contents($file, $contents, $mode = \false) + { + } + /** + * Gets the current working directory. + * + * @since 2.5.0 + * + * @return string|false The current working directory on success, false on failure. + */ + public function cwd() + { + } + /** + * Changes current directory. + * + * @since 2.5.0 + * + * @param string $dir The new current directory. + * @return bool True on success, false on failure. + */ + public function chdir($dir) + { + } + /** + * Changes filesystem permissions. + * + * @since 2.5.0 + * + * @param string $file Path to the file. + * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, + * 0755 for directories. Default false. + * @param bool $recursive Optional. If set to true, changes file permissions recursively. + * Default false. + * @return bool True on success, false on failure. + */ + public function chmod($file, $mode = \false, $recursive = \false) + { + } + /** + * Gets the file owner. + * + * @since 2.5.0 + * + * @param string $file Path to the file. + * @return string|false Username of the owner on success, false on failure. + */ + public function owner($file) + { + } + /** + * Gets the permissions of the specified file or filepath in their octal format. + * + * @since 2.5.0 + * + * @param string $file Path to the file. + * @return string Mode of the file (the last 3 digits). + */ + public function getchmod($file) + { + } + /** + * Gets the file's group. + * + * @since 2.5.0 + * + * @param string $file Path to the file. + * @return string|false The group on success, false on failure. + */ + public function group($file) + { + } + /** + * Copies a file. + * + * @since 2.5.0 + * + * @param string $source Path to the source file. + * @param string $destination Path to the destination file. + * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. + * Default false. + * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, + * 0755 for dirs. Default false. + * @return bool True on success, false on failure. + */ + public function copy($source, $destination, $overwrite = \false, $mode = \false) + { + } + /** + * Moves a file or directory. + * + * After moving files or directories, OPcache will need to be invalidated. + * + * If moving a directory fails, `copy_dir()` can be used for a recursive copy. + * + * Use `move_dir()` for moving directories with OPcache invalidation and a + * fallback to `copy_dir()`. + * + * @since 2.5.0 + * + * @param string $source Path to the source file or directory. + * @param string $destination Path to the destination file or directory. + * @param bool $overwrite Optional. Whether to overwrite the destination if it exists. + * Default false. + * @return bool True on success, false on failure. + */ + public function move($source, $destination, $overwrite = \false) + { + } + /** + * Deletes a file or directory. + * + * @since 2.5.0 + * + * @param string $file Path to the file or directory. + * @param bool $recursive Optional. If set to true, deletes files and folders recursively. + * Default false. + * @param string|false $type Type of resource. 'f' for file, 'd' for directory. + * Default false. + * @return bool True on success, false on failure. + */ + public function delete($file, $recursive = \false, $type = \false) + { + } + /** + * Checks if a file or directory exists. + * + * @since 2.5.0 + * @since 6.3.0 Returns false for an empty path. + * + * @param string $path Path to file or directory. + * @return bool Whether $path exists or not. + */ + public function exists($path) + { + } + /** + * Checks if resource is a file. + * + * @since 2.5.0 + * + * @param string $file File path. + * @return bool Whether $file is a file. + */ + public function is_file($file) + { + } + /** + * Checks if resource is a directory. + * + * @since 2.5.0 + * + * @param string $path Directory path. + * @return bool Whether $path is a directory. + */ + public function is_dir($path) + { + } + /** + * Checks if a file is readable. + * + * @since 2.5.0 + * + * @param string $file Path to file. + * @return bool Whether $file is readable. + */ + public function is_readable($file) + { + } + /** + * Checks if a file or directory is writable. + * + * @since 2.5.0 + * + * @param string $path Path to file or directory. + * @return bool Whether $path is writable. + */ + public function is_writable($path) + { + } + /** + * Gets the file's last access time. + * + * @since 2.5.0 + * + * @param string $file Path to file. + * @return int|false Unix timestamp representing last access time, false on failure. + */ + public function atime($file) + { + } + /** + * Gets the file modification time. + * + * @since 2.5.0 + * + * @param string $file Path to file. + * @return int|false Unix timestamp representing modification time, false on failure. + */ + public function mtime($file) + { + } + /** + * Gets the file size (in bytes). + * + * @since 2.5.0 + * + * @param string $file Path to file. + * @return int|false Size of the file in bytes on success, false on failure. + */ + public function size($file) + { + } + /** + * Sets the access and modification times of a file. + * + * Note: If $file doesn't exist, it will be created. + * + * @since 2.5.0 + * + * @param string $file Path to file. + * @param int $time Optional. Modified time to set for file. + * Default 0. + * @param int $atime Optional. Access time to set for file. + * Default 0. + * @return bool True on success, false on failure. + */ + public function touch($file, $time = 0, $atime = 0) + { + } + /** + * Creates a directory. + * + * @since 2.5.0 + * + * @param string $path Path for new directory. + * @param int|false $chmod Optional. The permissions as octal number (or false to skip chmod). + * Default false. + * @param string|int|false $chown Optional. A user name or number (or false to skip chown). + * Default false. + * @param string|int|false $chgrp Optional. A group name or number (or false to skip chgrp). + * Default false. + * @return bool True on success, false on failure. + */ + public function mkdir($path, $chmod = \false, $chown = \false, $chgrp = \false) + { + } + /** + * Deletes a directory. + * + * @since 2.5.0 + * + * @param string $path Path to directory. + * @param bool $recursive Optional. Whether to recursively remove files/directories. + * Default false. + * @return bool True on success, false on failure. + */ + public function rmdir($path, $recursive = \false) + { + } + /** + * @param string $line + * @return array { + * Array of file information. + * + * @type string $name Name of the file or directory. + * @type string $perms *nix representation of permissions. + * @type string $permsn Octal representation of permissions. + * @type string|false $number File number as a string, or false if not available. + * @type string|false $owner Owner name or ID, or false if not available. + * @type string|false $group File permissions group, or false if not available. + * @type string|false $size Size of file in bytes as a string, or false if not available. + * @type string|false $lastmodunix Last modified unix timestamp as a string, or false if not available. + * @type string|false $lastmod Last modified month (3 letters) and day (without leading 0), or + * false if not available. + * @type string|false $time Last modified time, or false if not available. + * @type string $type Type of resource. 'f' for file, 'd' for directory, 'l' for link. + * @type array|false $files If a directory and `$recursive` is true, contains another array of files. + * False if unable to list directory contents. + * } + * @phpstan-return array{ + * name: string, + * perms: string, + * permsn: string, + * number: string|false, + * owner: string|false, + * group: string|false, + * size: string|false, + * lastmodunix: string|false, + * lastmod: string|false, + * time: string|false, + * type: string, + * files: array|false, + * } + */ + public function parselisting($line) + { + } + /** + * Gets details for files in a directory or a specific file. + * + * @since 2.5.0 + * + * @param string $path Path to directory or file. + * @param bool $include_hidden Optional. Whether to include details of hidden ("." prefixed) files. + * Default true. + * @param bool $recursive Optional. Whether to recursively include file details in nested directories. + * Default false. + * @return array|false { + * Array of arrays containing file information. False if unable to list directory contents. + * + * @type array ...$0 { + * Array of file information. Note that some elements may not be available on all filesystems. + * + * @type string $name Name of the file or directory. + * @type string $perms *nix representation of permissions. + * @type string $permsn Octal representation of permissions. + * @type int|string|false $number File number. May be a numeric string. False if not available. + * @type string|false $owner Owner name or ID, or false if not available. + * @type string|false $group File permissions group, or false if not available. + * @type int|string|false $size Size of file in bytes. May be a numeric string. + * False if not available. + * @type int|string|false $lastmodunix Last modified unix timestamp. May be a numeric string. + * False if not available. + * @type string|false $lastmod Last modified month (3 letters) and day (without leading 0), or + * false if not available. + * @type string|false $time Last modified time, or false if not available. + * @type string $type Type of resource. 'f' for file, 'd' for directory, 'l' for link. + * @type array|false $files If a directory and `$recursive` is true, contains another array of + * files. False if unable to list directory contents. + * } + * } + * @phpstan-return false|array<int|string, array{ + * name: string, + * perms: string, + * permsn: string, + * number: int|string|false, + * owner: string|false, + * group: string|false, + * size: int|string|false, + * lastmodunix: int|string|false, + * lastmod: string|false, + * time: string|false, + * type: string, + * files: array|false, + * }> + * @phpstan-return false|array<string, array{name: string, perms: string, permsn: string, owner: string|false, size: int|string|false, lastmodunix: int|string|false, lastmod: string|false, time: string|false, type: 'f'|'d'|'l', group: string|false, number: int|string|false, files?: array|false}> + */ + public function dirlist($path = '.', $include_hidden = \true, $recursive = \false) + { + } + /** + * Destructor. + * + * @since 2.5.0 + */ + public function __destruct() + { + } + } + /** + * WordPress FTP Sockets Filesystem. + * + * @package WordPress + * @subpackage Filesystem + */ + /** + * WordPress Filesystem Class for implementing FTP Sockets. + * + * @since 2.5.0 + * + * @see WP_Filesystem_Base + */ + class WP_Filesystem_ftpsockets extends \WP_Filesystem_Base + { + /** + * @since 2.5.0 + * @var ftp + */ + public $ftp; + /** + * Constructor. + * + * @since 2.5.0 + * + * @param array $opt + * @phpstan-return void + */ + public function __construct($opt = '') + { + } + /** + * Connects filesystem. + * + * @since 2.5.0 + * + * @return bool True on success, false on failure. + */ + public function connect() + { + } + /** + * Reads entire file into a string. + * + * @since 2.5.0 + * + * @param string $file Name of the file to read. + * @return string|false Read data on success, false if no temporary file could be opened, + * or if the file couldn't be retrieved. + */ + public function get_contents($file) + { + } + /** + * Reads entire file into an array. + * + * @since 2.5.0 + * + * @param string $file Path to the file. + * @return array|false File contents in an array on success, false on failure. + */ + public function get_contents_array($file) + { + } + /** + * Writes a string to a file. + * + * @since 2.5.0 + * + * @param string $file Remote path to the file where to write the data. + * @param string $contents The data to write. + * @param int|false $mode Optional. The file permissions as octal number, usually 0644. + * Default false. + * @return bool True on success, false on failure. + */ + public function put_contents($file, $contents, $mode = \false) + { + } + /** + * Gets the current working directory. + * + * @since 2.5.0 + * + * @return string|false The current working directory on success, false on failure. + */ + public function cwd() + { + } + /** + * Changes current directory. + * + * @since 2.5.0 + * + * @param string $dir The new current directory. + * @return bool True on success, false on failure. + */ + public function chdir($dir) + { + } + /** + * Changes filesystem permissions. + * + * @since 2.5.0 + * + * @param string $file Path to the file. + * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, + * 0755 for directories. Default false. + * @param bool $recursive Optional. If set to true, changes file permissions recursively. + * Default false. + * @return bool True on success, false on failure. + */ + public function chmod($file, $mode = \false, $recursive = \false) + { + } + /** + * Gets the file owner. + * + * @since 2.5.0 + * + * @param string $file Path to the file. + * @return string|false Username of the owner on success, false on failure. + */ + public function owner($file) + { + } + /** + * Gets the permissions of the specified file or filepath in their octal format. + * + * @since 2.5.0 + * + * @param string $file Path to the file. + * @return string Mode of the file (the last 3 digits). + */ + public function getchmod($file) + { + } + /** + * Gets the file's group. + * + * @since 2.5.0 + * + * @param string $file Path to the file. + * @return string|false The group on success, false on failure. + */ + public function group($file) + { + } + /** + * Copies a file. + * + * @since 2.5.0 + * + * @param string $source Path to the source file. + * @param string $destination Path to the destination file. + * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. + * Default false. + * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, + * 0755 for dirs. Default false. + * @return bool True on success, false on failure. + */ + public function copy($source, $destination, $overwrite = \false, $mode = \false) + { + } + /** + * Moves a file or directory. + * + * After moving files or directories, OPcache will need to be invalidated. + * + * If moving a directory fails, `copy_dir()` can be used for a recursive copy. + * + * Use `move_dir()` for moving directories with OPcache invalidation and a + * fallback to `copy_dir()`. + * + * @since 2.5.0 + * + * @param string $source Path to the source file or directory. + * @param string $destination Path to the destination file or directory. + * @param bool $overwrite Optional. Whether to overwrite the destination if it exists. + * Default false. + * @return bool True on success, false on failure. + */ + public function move($source, $destination, $overwrite = \false) + { + } + /** + * Deletes a file or directory. + * + * @since 2.5.0 + * + * @param string $file Path to the file or directory. + * @param bool $recursive Optional. If set to true, deletes files and folders recursively. + * Default false. + * @param string|false $type Type of resource. 'f' for file, 'd' for directory. + * Default false. + * @return bool True on success, false on failure. + */ + public function delete($file, $recursive = \false, $type = \false) + { + } + /** + * Checks if a file or directory exists. + * + * @since 2.5.0 + * @since 6.3.0 Returns false for an empty path. + * + * @param string $path Path to file or directory. + * @return bool Whether $path exists or not. + */ + public function exists($path) + { + } + /** + * Checks if resource is a file. + * + * @since 2.5.0 + * + * @param string $file File path. + * @return bool Whether $file is a file. + */ + public function is_file($file) + { + } + /** + * Checks if resource is a directory. + * + * @since 2.5.0 + * + * @param string $path Directory path. + * @return bool Whether $path is a directory. + */ + public function is_dir($path) + { + } + /** + * Checks if a file is readable. + * + * @since 2.5.0 + * + * @param string $file Path to file. + * @return bool Whether $file is readable. + */ + public function is_readable($file) + { + } + /** + * Checks if a file or directory is writable. + * + * @since 2.5.0 + * + * @param string $path Path to file or directory. + * @return bool Whether $path is writable. + */ + public function is_writable($path) + { + } + /** + * Gets the file's last access time. + * + * @since 2.5.0 + * + * @param string $file Path to file. + * @return int|false Unix timestamp representing last access time, false on failure. + */ + public function atime($file) + { + } + /** + * Gets the file modification time. + * + * @since 2.5.0 + * + * @param string $file Path to file. + * @return int|false Unix timestamp representing modification time, false on failure. + */ + public function mtime($file) + { + } + /** + * Gets the file size (in bytes). + * + * @since 2.5.0 + * + * @param string $file Path to file. + * @return int|false Size of the file in bytes on success, false on failure. + */ + public function size($file) + { + } + /** + * Sets the access and modification times of a file. + * + * Note: If $file doesn't exist, it will be created. + * + * @since 2.5.0 + * + * @param string $file Path to file. + * @param int $time Optional. Modified time to set for file. + * Default 0. + * @param int $atime Optional. Access time to set for file. + * Default 0. + * @return bool True on success, false on failure. + */ + public function touch($file, $time = 0, $atime = 0) + { + } + /** + * Creates a directory. + * + * @since 2.5.0 + * + * @param string $path Path for new directory. + * @param int|false $chmod Optional. The permissions as octal number (or false to skip chmod). + * Default false. + * @param string|int|false $chown Optional. A user name or number (or false to skip chown). + * Default false. + * @param string|int|false $chgrp Optional. A group name or number (or false to skip chgrp). + * Default false. + * @return bool True on success, false on failure. + */ + public function mkdir($path, $chmod = \false, $chown = \false, $chgrp = \false) + { + } + /** + * Deletes a directory. + * + * @since 2.5.0 + * + * @param string $path Path to directory. + * @param bool $recursive Optional. Whether to recursively remove files/directories. + * Default false. + * @return bool True on success, false on failure. + */ + public function rmdir($path, $recursive = \false) + { + } + /** + * Gets details for files in a directory or a specific file. + * + * @since 2.5.0 + * + * @param string $path Path to directory or file. + * @param bool $include_hidden Optional. Whether to include details of hidden ("." prefixed) files. + * Default true. + * @param bool $recursive Optional. Whether to recursively include file details in nested directories. + * Default false. + * @return array|false { + * Array of arrays containing file information. False if unable to list directory contents. + * + * @type array ...$0 { + * Array of file information. Note that some elements may not be available on all filesystems. + * + * @type string $name Name of the file or directory. + * @type string $perms *nix representation of permissions. + * @type string $permsn Octal representation of permissions. + * @type int|string|false $number File number. May be a numeric string. False if not available. + * @type string|false $owner Owner name or ID, or false if not available. + * @type string|false $group File permissions group, or false if not available. + * @type int|string|false $size Size of file in bytes. May be a numeric string. + * False if not available. + * @type int|string|false $lastmodunix Last modified unix timestamp. May be a numeric string. + * False if not available. + * @type string|false $lastmod Last modified month (3 letters) and day (without leading 0), or + * false if not available. + * @type string|false $time Last modified time, or false if not available. + * @type string $type Type of resource. 'f' for file, 'd' for directory, 'l' for link. + * @type array|false $files If a directory and `$recursive` is true, contains another array of + * files. False if unable to list directory contents. + * } + * } + * @phpstan-return false|array<int|string, array{ + * name: string, + * perms: string, + * permsn: string, + * number: int|string|false, + * owner: string|false, + * group: string|false, + * size: int|string|false, + * lastmodunix: int|string|false, + * lastmod: string|false, + * time: string|false, + * type: string, + * files: array|false, + * }> + * @phpstan-return false|array<string, array{name: string, perms: string, permsn: string, owner: string|false, size: int|string|false, lastmodunix: int|string|false, lastmod: string|false, time: string|false, type: 'f'|'d'|'l', group: string|false, number: int|string|false, files?: array|false}> + */ + public function dirlist($path = '.', $include_hidden = \true, $recursive = \false) + { + } + /** + * Destructor. + * + * @since 2.5.0 + */ + public function __destruct() + { + } + } + /** + * WordPress Filesystem Class for implementing SSH2 + * + * To use this class you must follow these steps for PHP 5.2.6+ + * + * {@link http://kevin.vanzonneveld.net/techblog/article/make_ssh_connections_with_php/ - Installation Notes} + * + * Compile libssh2 (Note: Only 0.14 is officially working with PHP 5.2.6+ right now, But many users have found the latest versions work) + * + * cd /usr/src + * wget https://www.libssh2.org/download/libssh2-0.14.tar.gz + * tar -zxvf libssh2-0.14.tar.gz + * cd libssh2-0.14/ + * ./configure + * make all install + * + * Note: Do not leave the directory yet! + * + * Enter: pecl install -f ssh2 + * + * Copy the ssh.so file it creates to your PHP Module Directory. + * Open up your PHP.INI file and look for where extensions are placed. + * Add in your PHP.ini file: extension=ssh2.so + * + * Restart Apache! + * Check phpinfo() streams to confirm that: ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp exist. + * + * Note: As of WordPress 2.8, this utilizes the PHP5+ function `stream_get_contents()`. + * + * @since 2.7.0 + * + * @package WordPress + * @subpackage Filesystem + */ + class WP_Filesystem_SSH2 extends \WP_Filesystem_Base + { + /** + * @since 2.7.0 + * @var resource + */ + public $link = \false; + /** + * @since 2.7.0 + * @var resource + */ + public $sftp_link; + /** + * @since 2.7.0 + * @var bool + */ + public $keys = \false; + /** + * Constructor. + * + * @since 2.7.0 + * + * @param array $opt + * @phpstan-return void + */ + public function __construct($opt = '') + { + } + /** + * Connects filesystem. + * + * @since 2.7.0 + * + * @return bool True on success, false on failure. + */ + public function connect() + { + } + /** + * Gets the ssh2.sftp PHP stream wrapper path to open for the given file. + * + * This method also works around a PHP bug where the root directory (/) cannot + * be opened by PHP functions, causing a false failure. In order to work around + * this, the path is converted to /./ which is semantically the same as / + * See https://bugs.php.net/bug.php?id=64169 for more details. + * + * @since 4.4.0 + * + * @param string $path The File/Directory path on the remote server to return + * @return string The ssh2.sftp:// wrapped path to use. + */ + public function sftp_path($path) + { + } + /** + * @since 2.7.0 + * + * @param string $command + * @param bool $returnbool + * @return bool|string True on success, false on failure. String if the command was executed, `$returnbool` + * is false (default), and data from the resulting stream was retrieved. + */ + public function run_command($command, $returnbool = \false) + { + } + /** + * Reads entire file into a string. + * + * @since 2.7.0 + * + * @param string $file Name of the file to read. + * @return string|false Read data on success, false if no temporary file could be opened, + * or if the file couldn't be retrieved. + */ + public function get_contents($file) + { + } + /** + * Reads entire file into an array. + * + * @since 2.7.0 + * + * @param string $file Path to the file. + * @return array|false File contents in an array on success, false on failure. + */ + public function get_contents_array($file) + { + } + /** + * Writes a string to a file. + * + * @since 2.7.0 + * + * @param string $file Remote path to the file where to write the data. + * @param string $contents The data to write. + * @param int|false $mode Optional. The file permissions as octal number, usually 0644. + * Default false. + * @return bool True on success, false on failure. + */ + public function put_contents($file, $contents, $mode = \false) + { + } + /** + * Gets the current working directory. + * + * @since 2.7.0 + * + * @return string|false The current working directory on success, false on failure. + */ + public function cwd() + { + } + /** + * Changes current directory. + * + * @since 2.7.0 + * + * @param string $dir The new current directory. + * @return bool True on success, false on failure. + */ + public function chdir($dir) + { + } + /** + * Changes the file group. + * + * @since 2.7.0 + * + * @param string $file Path to the file. + * @param string|int $group A group name or number. + * @param bool $recursive Optional. If set to true, changes file group recursively. + * Default false. + * @return bool True on success, false on failure. + */ + public function chgrp($file, $group, $recursive = \false) + { + } + /** + * Changes filesystem permissions. + * + * @since 2.7.0 + * + * @param string $file Path to the file. + * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, + * 0755 for directories. Default false. + * @param bool $recursive Optional. If set to true, changes file permissions recursively. + * Default false. + * @return bool True on success, false on failure. + */ + public function chmod($file, $mode = \false, $recursive = \false) + { + } + /** + * Changes the owner of a file or directory. + * + * @since 2.7.0 + * + * @param string $file Path to the file or directory. + * @param string|int $owner A user name or number. + * @param bool $recursive Optional. If set to true, changes file owner recursively. + * Default false. + * @return bool True on success, false on failure. + */ + public function chown($file, $owner, $recursive = \false) + { + } + /** + * Gets the file owner. + * + * @since 2.7.0 + * + * @param string $file Path to the file. + * @return string|false Username of the owner on success, false on failure. + */ + public function owner($file) + { + } + /** + * Gets the permissions of the specified file or filepath in their octal format. + * + * @since 2.7.0 + * + * @param string $file Path to the file. + * @return string Mode of the file (the last 3 digits). + */ + public function getchmod($file) + { + } + /** + * Gets the file's group. + * + * @since 2.7.0 + * + * @param string $file Path to the file. + * @return string|false The group on success, false on failure. + */ + public function group($file) + { + } + /** + * Copies a file. + * + * @since 2.7.0 + * + * @param string $source Path to the source file. + * @param string $destination Path to the destination file. + * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. + * Default false. + * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, + * 0755 for dirs. Default false. + * @return bool True on success, false on failure. + */ + public function copy($source, $destination, $overwrite = \false, $mode = \false) + { + } + /** + * Moves a file or directory. + * + * After moving files or directories, OPcache will need to be invalidated. + * + * If moving a directory fails, `copy_dir()` can be used for a recursive copy. + * + * Use `move_dir()` for moving directories with OPcache invalidation and a + * fallback to `copy_dir()`. + * + * @since 2.7.0 + * + * @param string $source Path to the source file or directory. + * @param string $destination Path to the destination file or directory. + * @param bool $overwrite Optional. Whether to overwrite the destination if it exists. + * Default false. + * @return bool True on success, false on failure. + */ + public function move($source, $destination, $overwrite = \false) + { + } + /** + * Deletes a file or directory. + * + * @since 2.7.0 + * + * @param string $file Path to the file or directory. + * @param bool $recursive Optional. If set to true, deletes files and folders recursively. + * Default false. + * @param string|false $type Type of resource. 'f' for file, 'd' for directory. + * Default false. + * @return bool True on success, false on failure. + */ + public function delete($file, $recursive = \false, $type = \false) + { + } + /** + * Checks if a file or directory exists. + * + * @since 2.7.0 + * + * @param string $path Path to file or directory. + * @return bool Whether $path exists or not. + */ + public function exists($path) + { + } + /** + * Checks if resource is a file. + * + * @since 2.7.0 + * + * @param string $file File path. + * @return bool Whether $file is a file. + */ + public function is_file($file) + { + } + /** + * Checks if resource is a directory. + * + * @since 2.7.0 + * + * @param string $path Directory path. + * @return bool Whether $path is a directory. + */ + public function is_dir($path) + { + } + /** + * Checks if a file is readable. + * + * @since 2.7.0 + * + * @param string $file Path to file. + * @return bool Whether $file is readable. + */ + public function is_readable($file) + { + } + /** + * Checks if a file or directory is writable. + * + * @since 2.7.0 + * + * @param string $path Path to file or directory. + * @return bool Whether $path is writable. + */ + public function is_writable($path) + { + } + /** + * Gets the file's last access time. + * + * @since 2.7.0 + * + * @param string $file Path to file. + * @return int|false Unix timestamp representing last access time, false on failure. + */ + public function atime($file) + { + } + /** + * Gets the file modification time. + * + * @since 2.7.0 + * + * @param string $file Path to file. + * @return int|false Unix timestamp representing modification time, false on failure. + */ + public function mtime($file) + { + } + /** + * Gets the file size (in bytes). + * + * @since 2.7.0 + * + * @param string $file Path to file. + * @return int|false Size of the file in bytes on success, false on failure. + */ + public function size($file) + { + } + /** + * Sets the access and modification times of a file. + * + * Note: Not implemented. + * + * @since 2.7.0 + * + * @param string $file Path to file. + * @param int $time Optional. Modified time to set for file. + * Default 0. + * @param int $atime Optional. Access time to set for file. + * Default 0. + */ + public function touch($file, $time = 0, $atime = 0) + { + } + /** + * Creates a directory. + * + * @since 2.7.0 + * + * @param string $path Path for new directory. + * @param int|false $chmod Optional. The permissions as octal number (or false to skip chmod). + * Default false. + * @param string|int|false $chown Optional. A user name or number (or false to skip chown). + * Default false. + * @param string|int|false $chgrp Optional. A group name or number (or false to skip chgrp). + * Default false. + * @return bool True on success, false on failure. + */ + public function mkdir($path, $chmod = \false, $chown = \false, $chgrp = \false) + { + } + /** + * Deletes a directory. + * + * @since 2.7.0 + * + * @param string $path Path to directory. + * @param bool $recursive Optional. Whether to recursively remove files/directories. + * Default false. + * @return bool True on success, false on failure. + */ + public function rmdir($path, $recursive = \false) + { + } + /** + * Gets details for files in a directory or a specific file. + * + * @since 2.7.0 + * + * @param string $path Path to directory or file. + * @param bool $include_hidden Optional. Whether to include details of hidden ("." prefixed) files. + * Default true. + * @param bool $recursive Optional. Whether to recursively include file details in nested directories. + * Default false. + * @return array|false { + * Array of arrays containing file information. False if unable to list directory contents. + * + * @type array ...$0 { + * Array of file information. Note that some elements may not be available on all filesystems. + * + * @type string $name Name of the file or directory. + * @type string $perms *nix representation of permissions. + * @type string $permsn Octal representation of permissions. + * @type false $number File number. Always false in this context. + * @type string|false $owner Owner name or ID, or false if not available. + * @type string|false $group File permissions group, or false if not available. + * @type int|string|false $size Size of file in bytes. May be a numeric string. + * False if not available. + * @type int|string|false $lastmodunix Last modified unix timestamp. May be a numeric string. + * False if not available. + * @type string|false $lastmod Last modified month (3 letters) and day (without leading 0), or + * false if not available. + * @type string|false $time Last modified time, or false if not available. + * @type string $type Type of resource. 'f' for file, 'd' for directory, 'l' for link. + * @type array|false $files If a directory and `$recursive` is true, contains another array of + * files. False if unable to list directory contents. + * } + * } + * @phpstan-return false|array<int|string, array{ + * name: string, + * perms: string, + * permsn: string, + * number: false, + * owner: string|false, + * group: string|false, + * size: int|string|false, + * lastmodunix: int|string|false, + * lastmod: string|false, + * time: string|false, + * type: string, + * files: array|false, + * }> + * @phpstan-return false|array<string, array{name: string, perms: string, permsn: string, owner: string|false, size: int|string|false, lastmodunix: int|string|false, lastmod: string|false, time: string|false, type: 'f'|'d'|'l', group: string|false, number: int|string|false, files?: array|false}> + */ + public function dirlist($path, $include_hidden = \true, $recursive = \false) + { + } + } + /** + * WP_Importer base class + */ + #[\AllowDynamicProperties] + class WP_Importer + { + /** + * Class Constructor + */ + public function __construct() + { + } + /** + * Returns array with imported permalinks from WordPress database. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $importer_name + * @param string $blog_id + * @return array + */ + public function get_imported_posts($importer_name, $blog_id) + { + } + /** + * Returns count of imported permalinks from WordPress database. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $importer_name + * @param string $blog_id + * @return int + */ + public function count_imported_posts($importer_name, $blog_id) + { + } + /** + * Sets array with imported comments from WordPress database. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $blog_id + * @return array + */ + public function get_imported_comments($blog_id) + { + } + /** + * @param int $blog_id + * @return int|void + */ + public function set_blog($blog_id) + { + } + /** + * @param int $user_id + * @return int|void + */ + public function set_user($user_id) + { + } + /** + * Sorts by strlen, longest string first. + * + * @param string $a + * @param string $b + * @return int + */ + public function cmpr_strlen($a, $b) + { + } + /** + * Gets URL. + * + * @param string $url + * @param string $username + * @param string $password + * @param bool $head + * @return array + */ + public function get_page($url, $username = '', $password = '', $head = \false) + { + } + /** + * Bumps up the request timeout for http requests. + * + * @param int $val + * @return int + */ + public function bump_request_timeout($val) + { + } + /** + * Checks if user has exceeded disk quota. + * + * @return bool + */ + public function is_user_over_quota() + { + } + /** + * Replaces newlines, tabs, and multiple spaces with a single space. + * + * @param string $text + * @return string + */ + public function min_whitespace($text) + { + } + /** + * Resets global variables that grow out of control during imports. + * + * @since 3.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * @global int[] $wp_actions + */ + public function stop_the_insanity() + { + } + } + /** + * Administration API: WP_Internal_Pointers class + * + * @package WordPress + * @subpackage Administration + * @since 4.4.0 + */ + /** + * Core class used to implement an internal admin pointers API. + * + * @since 3.3.0 + */ + #[\AllowDynamicProperties] + final class WP_Internal_Pointers + { + /** + * Initializes the new feature pointers. + * + * @since 3.3.0 + * + * All pointers can be disabled using the following: + * remove_action( 'admin_enqueue_scripts', array( 'WP_Internal_Pointers', 'enqueue_scripts' ) ); + * + * Individual pointers (e.g. wp390_widgets) can be disabled using the following: + * + * function yourprefix_remove_pointers() { + * remove_action( + * 'admin_print_footer_scripts', + * array( 'WP_Internal_Pointers', 'pointer_wp390_widgets' ) + * ); + * } + * add_action( 'admin_enqueue_scripts', 'yourprefix_remove_pointers', 11 ); + * + * @param string $hook_suffix The current admin page. + * @phpstan-return void + */ + public static function enqueue_scripts($hook_suffix) + { + } + public static function pointer_wp330_toolbar() + { + } + public static function pointer_wp330_media_uploader() + { + } + public static function pointer_wp330_saving_widgets() + { + } + public static function pointer_wp340_customize_current_theme_link() + { + } + public static function pointer_wp340_choose_image_from_library() + { + } + public static function pointer_wp350_media() + { + } + public static function pointer_wp360_revisions() + { + } + public static function pointer_wp360_locks() + { + } + public static function pointer_wp390_widgets() + { + } + public static function pointer_wp410_dfw() + { + } + public static function pointer_wp496_privacy() + { + } + /** + * Prevents new users from seeing existing 'new feature' pointers. + * + * @since 3.3.0 + * + * @param int $user_id User ID. + */ + public static function dismiss_pointers_for_new_users($user_id) + { + } + } + /** + * List Table API: WP_Links_List_Table class + * + * @package WordPress + * @subpackage Administration + * @since 3.1.0 + */ + /** + * Core class used to implement displaying links in a list table. + * + * @since 3.1.0 + * + * @see WP_List_Table + */ + class WP_Links_List_Table extends \WP_List_Table + { + /** + * Constructor. + * + * @since 3.1.0 + * + * @see WP_List_Table::__construct() for more information on default arguments. + * + * @param array $args An associative array of arguments. + */ + public function __construct($args = array()) + { + } + /** + * @return bool + */ + public function ajax_user_can() + { + } + /** + * @global int $cat_id + * @global string $s + * @global string $orderby + * @global string $order + */ + public function prepare_items() + { + } + /** + */ + public function no_items() + { + } + /** + * @return array + */ + protected function get_bulk_actions() + { + } + /** + * @global int $cat_id + * @param string $which + * @phpstan-return void + */ + protected function extra_tablenav($which) + { + } + /** + * @return string[] Array of column titles keyed by their column name. + */ + public function get_columns() + { + } + /** + * @return array + */ + protected function get_sortable_columns() + { + } + /** + * Gets the name of the default primary column. + * + * @since 4.3.0 + * + * @return string Name of the default primary column, in this case, 'name'. + */ + protected function get_default_primary_column_name() + { + } + /** + * Handles the checkbox column output. + * + * @since 4.3.0 + * @since 5.9.0 Renamed `$link` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param object $item The current link object. + */ + public function column_cb($item) + { + } + /** + * Handles the link name column output. + * + * @since 4.3.0 + * + * @param object $link The current link object. + */ + public function column_name($link) + { + } + /** + * Handles the link URL column output. + * + * @since 4.3.0 + * + * @param object $link The current link object. + */ + public function column_url($link) + { + } + /** + * Handles the link categories column output. + * + * @since 4.3.0 + * + * @global int $cat_id + * + * @param object $link The current link object. + */ + public function column_categories($link) + { + } + /** + * Handles the link relation column output. + * + * @since 4.3.0 + * + * @param object $link The current link object. + */ + public function column_rel($link) + { + } + /** + * Handles the link visibility column output. + * + * @since 4.3.0 + * + * @param object $link The current link object. + */ + public function column_visible($link) + { + } + /** + * Handles the link rating column output. + * + * @since 4.3.0 + * + * @param object $link The current link object. + */ + public function column_rating($link) + { + } + /** + * Handles the default column output. + * + * @since 4.3.0 + * @since 5.9.0 Renamed `$link` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param object $item Link object. + * @param string $column_name Current column name. + */ + public function column_default($item, $column_name) + { + } + public function display_rows() + { + } + /** + * Generates and displays row action links. + * + * @since 4.3.0 + * @since 5.9.0 Renamed `$link` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param object $item Link being acted upon. + * @param string $column_name Current column name. + * @param string $primary Primary column name. + * @return string Row actions output for links, or an empty string + * if the current column is not the primary column. + */ + protected function handle_row_actions($item, $column_name, $primary) + { + } + } + /** + * Helper functions for displaying a list of items in an ajaxified HTML table. + * + * @package WordPress + * @subpackage List_Table + * @since 4.7.0 + */ + /** + * Helper class to be used only by back compat functions. + * + * @since 3.1.0 + */ + class _WP_List_Table_Compat extends \WP_List_Table + { + public $_screen; + public $_columns; + /** + * Constructor. + * + * @since 3.1.0 + * + * @param string|WP_Screen $screen The screen hook name or screen object. + * @param string[] $columns An array of columns with column IDs as the keys + * and translated column names as the values. + */ + public function __construct($screen, $columns = array()) + { + } + /** + * Gets a list of all, hidden, and sortable columns. + * + * @since 3.1.0 + * + * @return array + */ + protected function get_column_info() + { + } + /** + * Gets a list of columns. + * + * @since 3.1.0 + * + * @return array + */ + public function get_columns() + { + } + } + /** + * List Table API: WP_Media_List_Table class + * + * @package WordPress + * @subpackage Administration + * @since 3.1.0 + */ + /** + * Core class used to implement displaying media items in a list table. + * + * @since 3.1.0 + * + * @see WP_List_Table + */ + class WP_Media_List_Table extends \WP_List_Table + { + /** + * Holds the number of pending comments for each post. + * + * @since 4.4.0 + * @var array + */ + protected $comment_pending_count = array(); + /** + * Constructor. + * + * @since 3.1.0 + * + * @see WP_List_Table::__construct() for more information on default arguments. + * + * @param array $args An associative array of arguments. + */ + public function __construct($args = array()) + { + } + /** + * @return bool + */ + public function ajax_user_can() + { + } + /** + * @global string $mode List table view mode. + * @global WP_Query $wp_query WordPress Query object. + * @global array $post_mime_types + * @global array $avail_post_mime_types + */ + public function prepare_items() + { + } + /** + * @global array $post_mime_types + * @global array $avail_post_mime_types + * @return array + */ + protected function get_views() + { + } + /** + * @return array + */ + protected function get_bulk_actions() + { + } + /** + * @param string $which + * @phpstan-return void + */ + protected function extra_tablenav($which) + { + } + /** + * @return string + */ + public function current_action() + { + } + /** + * @return bool + */ + public function has_items() + { + } + /** + */ + public function no_items() + { + } + /** + * Overrides parent views to use the filter bar display. + * + * @global string $mode List table view mode. + */ + public function views() + { + } + /** + * @return string[] Array of column titles keyed by their column name. + */ + public function get_columns() + { + } + /** + * @return array + */ + protected function get_sortable_columns() + { + } + /** + * Handles the checkbox column output. + * + * @since 4.3.0 + * @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param WP_Post $item The current WP_Post object. + */ + public function column_cb($item) + { + } + /** + * Handles the title column output. + * + * @since 4.3.0 + * + * @param WP_Post $post The current WP_Post object. + */ + public function column_title($post) + { + } + /** + * Handles the author column output. + * + * @since 4.3.0 + * + * @param WP_Post $post The current WP_Post object. + */ + public function column_author($post) + { + } + /** + * Handles the description column output. + * + * @since 4.3.0 + * @deprecated 6.2.0 + * + * @param WP_Post $post The current WP_Post object. + */ + public function column_desc($post) + { + } + /** + * Handles the date column output. + * + * @since 4.3.0 + * + * @param WP_Post $post The current WP_Post object. + */ + public function column_date($post) + { + } + /** + * Handles the parent column output. + * + * @since 4.3.0 + * + * @param WP_Post $post The current WP_Post object. + */ + public function column_parent($post) + { + } + /** + * Handles the comments column output. + * + * @since 4.3.0 + * + * @param WP_Post $post The current WP_Post object. + */ + public function column_comments($post) + { + } + /** + * Handles output for the default column. + * + * @since 4.3.0 + * @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param WP_Post $item The current WP_Post object. + * @param string $column_name Current column name. + * @phpstan-return void + */ + public function column_default($item, $column_name) + { + } + /** + * @global WP_Post $post Global post object. + * @global WP_Query $wp_query WordPress Query object. + */ + public function display_rows() + { + } + /** + * Gets the name of the default primary column. + * + * @since 4.3.0 + * + * @return string Name of the default primary column, in this case, 'title'. + */ + protected function get_default_primary_column_name() + { + } + /** + * Generates and displays row action links. + * + * @since 4.3.0 + * @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param WP_Post $item Attachment being acted upon. + * @param string $column_name Current column name. + * @param string $primary Primary column name. + * @return string Row actions output for media attachments, or an empty string + * if the current column is not the primary column. + */ + protected function handle_row_actions($item, $column_name, $primary) + { + } + } + /** + * List Table API: WP_MS_Sites_List_Table class + * + * @package WordPress + * @subpackage Administration + * @since 3.1.0 + */ + /** + * Core class used to implement displaying sites in a list table for the network admin. + * + * @since 3.1.0 + * + * @see WP_List_Table + */ + class WP_MS_Sites_List_Table extends \WP_List_Table + { + /** + * Site status list. + * + * @since 4.3.0 + * @var array + */ + public $status_list; + /** + * Constructor. + * + * @since 3.1.0 + * + * @see WP_List_Table::__construct() for more information on default arguments. + * + * @param array $args An associative array of arguments. + */ + public function __construct($args = array()) + { + } + /** + * @return bool + */ + public function ajax_user_can() + { + } + /** + * Prepares the list of sites for display. + * + * @since 3.1.0 + * + * @global string $mode List table view mode. + * @global string $s + * @global wpdb $wpdb WordPress database abstraction object. + */ + public function prepare_items() + { + } + /** + */ + public function no_items() + { + } + /** + * Gets links to filter sites by status. + * + * @since 5.3.0 + * + * @return array + */ + protected function get_views() + { + } + /** + * @return array + */ + protected function get_bulk_actions() + { + } + /** + * @global string $mode List table view mode. + * + * @param string $which The location of the pagination nav markup: Either 'top' or 'bottom'. + * @phpstan-param 'top'|'bottom' $which + */ + protected function pagination($which) + { + } + /** + * Displays extra controls between bulk actions and pagination. + * + * @since 5.3.0 + * + * @param string $which The location of the extra table nav markup: Either 'top' or 'bottom'. + * @phpstan-param 'top'|'bottom' $which + */ + protected function extra_tablenav($which) + { + } + /** + * @return string[] Array of column titles keyed by their column name. + */ + public function get_columns() + { + } + /** + * @return array + */ + protected function get_sortable_columns() + { + } + /** + * Handles the checkbox column output. + * + * @since 4.3.0 + * @since 5.9.0 Renamed `$blog` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param array $item Current site. + */ + public function column_cb($item) + { + } + /** + * Handles the ID column output. + * + * @since 4.4.0 + * + * @param array $blog Current site. + */ + public function column_id($blog) + { + } + /** + * Handles the site name column output. + * + * @since 4.3.0 + * + * @global string $mode List table view mode. + * + * @param array $blog Current site. + */ + public function column_blogname($blog) + { + } + /** + * Handles the lastupdated column output. + * + * @since 4.3.0 + * + * @global string $mode List table view mode. + * + * @param array $blog Current site. + */ + public function column_lastupdated($blog) + { + } + /** + * Handles the registered column output. + * + * @since 4.3.0 + * + * @global string $mode List table view mode. + * + * @param array $blog Current site. + */ + public function column_registered($blog) + { + } + /** + * Handles the users column output. + * + * @since 4.3.0 + * + * @param array $blog Current site. + */ + public function column_users($blog) + { + } + /** + * Handles the plugins column output. + * + * @since 4.3.0 + * + * @param array $blog Current site. + */ + public function column_plugins($blog) + { + } + /** + * Handles output for the default column. + * + * @since 4.3.0 + * @since 5.9.0 Renamed `$blog` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param array $item Current site. + * @param string $column_name Current column name. + */ + public function column_default($item, $column_name) + { + } + /** + * @global string $mode List table view mode. + */ + public function display_rows() + { + } + /** + * Determines whether to output comma-separated site states. + * + * @since 5.3.0 + * + * @param array $site + */ + protected function site_states($site) + { + } + /** + * Gets the name of the default primary column. + * + * @since 4.3.0 + * + * @return string Name of the default primary column, in this case, 'blogname'. + */ + protected function get_default_primary_column_name() + { + } + /** + * Generates and displays row action links. + * + * @since 4.3.0 + * @since 5.9.0 Renamed `$blog` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param array $item Site being acted upon. + * @param string $column_name Current column name. + * @param string $primary Primary column name. + * @return string Row actions output for sites in Multisite, or an empty string + * if the current column is not the primary column. + */ + protected function handle_row_actions($item, $column_name, $primary) + { + } + } + /** + * List Table API: WP_MS_Themes_List_Table class + * + * @package WordPress + * @subpackage Administration + * @since 3.1.0 + */ + /** + * Core class used to implement displaying themes in a list table for the network admin. + * + * @since 3.1.0 + * + * @see WP_List_Table + */ + class WP_MS_Themes_List_Table extends \WP_List_Table + { + public $site_id; + public $is_site_themes; + /** + * Whether to show the auto-updates UI. + * + * @since 5.5.0 + * + * @var bool True if auto-updates UI is to be shown, false otherwise. + */ + protected $show_autoupdates = \true; + /** + * Constructor. + * + * @since 3.1.0 + * + * @see WP_List_Table::__construct() for more information on default arguments. + * + * @global string $status + * @global int $page + * + * @param array $args An associative array of arguments. + */ + public function __construct($args = array()) + { + } + /** + * @return array + */ + protected function get_table_classes() + { + } + /** + * @return bool + */ + public function ajax_user_can() + { + } + /** + * @global string $status + * @global array $totals + * @global int $page + * @global string $orderby + * @global string $order + * @global string $s + */ + public function prepare_items() + { + } + /** + * @param WP_Theme $theme + * @return bool + */ + public function _search_callback($theme) + { + } + // Not used by any core columns. + /** + * @global string $orderby + * @global string $order + * @param array $theme_a + * @param array $theme_b + * @return int + */ + public function _order_callback($theme_a, $theme_b) + { + } + /** + */ + public function no_items() + { + } + /** + * @return string[] Array of column titles keyed by their column name. + */ + public function get_columns() + { + } + /** + * @return array + */ + protected function get_sortable_columns() + { + } + /** + * Gets the name of the primary column. + * + * @since 4.3.0 + * + * @return string Unalterable name of the primary column name, in this case, 'name'. + */ + protected function get_primary_column_name() + { + } + /** + * @global array $totals + * @global string $status + * @return array + */ + protected function get_views() + { + } + /** + * @global string $status + * + * @return array + */ + protected function get_bulk_actions() + { + } + /** + */ + public function display_rows() + { + } + /** + * Handles the checkbox column output. + * + * @since 4.3.0 + * @since 5.9.0 Renamed `$theme` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param WP_Theme $item The current WP_Theme object. + */ + public function column_cb($item) + { + } + /** + * Handles the name column output. + * + * @since 4.3.0 + * + * @global string $status + * @global int $page + * @global string $s + * + * @param WP_Theme $theme The current WP_Theme object. + */ + public function column_name($theme) + { + } + /** + * Handles the description column output. + * + * @since 4.3.0 + * + * @global string $status + * @global array $totals + * + * @param WP_Theme $theme The current WP_Theme object. + */ + public function column_description($theme) + { + } + /** + * Handles the auto-updates column output. + * + * @since 5.5.0 + * + * @global string $status + * @global int $page + * + * @param WP_Theme $theme The current WP_Theme object. + */ + public function column_autoupdates($theme) + { + } + /** + * Handles default column output. + * + * @since 4.3.0 + * @since 5.9.0 Renamed `$theme` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param WP_Theme $item The current WP_Theme object. + * @param string $column_name The current column name. + */ + public function column_default($item, $column_name) + { + } + /** + * Handles the output for a single table row. + * + * @since 4.3.0 + * + * @param WP_Theme $item The current WP_Theme object. + */ + public function single_row_columns($item) + { + } + /** + * @global string $status + * @global array $totals + * + * @param WP_Theme $theme + */ + public function single_row($theme) + { + } + } + /** + * List Table API: WP_MS_Users_List_Table class + * + * @package WordPress + * @subpackage Administration + * @since 3.1.0 + */ + /** + * Core class used to implement displaying users in a list table for the network admin. + * + * @since 3.1.0 + * + * @see WP_List_Table + */ + class WP_MS_Users_List_Table extends \WP_List_Table + { + /** + * @return bool + */ + public function ajax_user_can() + { + } + /** + * @global string $mode List table view mode. + * @global string $usersearch + * @global string $role + */ + public function prepare_items() + { + } + /** + * @return array + */ + protected function get_bulk_actions() + { + } + /** + */ + public function no_items() + { + } + /** + * @global string $role + * @return array + */ + protected function get_views() + { + } + /** + * @global string $mode List table view mode. + * + * @param string $which + */ + protected function pagination($which) + { + } + /** + * @return string[] Array of column titles keyed by their column name. + */ + public function get_columns() + { + } + /** + * @return array + */ + protected function get_sortable_columns() + { + } + /** + * Handles the checkbox column output. + * + * @since 4.3.0 + * @since 5.9.0 Renamed `$user` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param WP_User $item The current WP_User object. + * @phpstan-return void + */ + public function column_cb($item) + { + } + /** + * Handles the ID column output. + * + * @since 4.4.0 + * + * @param WP_User $user The current WP_User object. + */ + public function column_id($user) + { + } + /** + * Handles the username column output. + * + * @since 4.3.0 + * + * @param WP_User $user The current WP_User object. + */ + public function column_username($user) + { + } + /** + * Handles the name column output. + * + * @since 4.3.0 + * + * @param WP_User $user The current WP_User object. + */ + public function column_name($user) + { + } + /** + * Handles the email column output. + * + * @since 4.3.0 + * + * @param WP_User $user The current WP_User object. + */ + public function column_email($user) + { + } + /** + * Handles the registered date column output. + * + * @since 4.3.0 + * + * @global string $mode List table view mode. + * + * @param WP_User $user The current WP_User object. + */ + public function column_registered($user) + { + } + /** + * @since 4.3.0 + * + * @param WP_User $user + * @param string $classes + * @param string $data + * @param string $primary + */ + protected function _column_blogs($user, $classes, $data, $primary) + { + } + /** + * Handles the sites column output. + * + * @since 4.3.0 + * + * @param WP_User $user The current WP_User object. + * @phpstan-return void + */ + public function column_blogs($user) + { + } + /** + * Handles the default column output. + * + * @since 4.3.0 + * @since 5.9.0 Renamed `$user` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param WP_User $item The current WP_User object. + * @param string $column_name The current column name. + */ + public function column_default($item, $column_name) + { + } + public function display_rows() + { + } + /** + * Gets the name of the default primary column. + * + * @since 4.3.0 + * + * @return string Name of the default primary column, in this case, 'username'. + */ + protected function get_default_primary_column_name() + { + } + /** + * Generates and displays row action links. + * + * @since 4.3.0 + * @since 5.9.0 Renamed `$user` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param WP_User $item User being acted upon. + * @param string $column_name Current column name. + * @param string $primary Primary column name. + * @return string Row actions output for users in Multisite, or an empty string + * if the current column is not the primary column. + */ + protected function handle_row_actions($item, $column_name, $primary) + { + } + } + /** + * List Table API: WP_Plugin_Install_List_Table class + * + * @package WordPress + * @subpackage Administration + * @since 3.1.0 + */ + /** + * Core class used to implement displaying plugins to install in a list table. + * + * @since 3.1.0 + * + * @see WP_List_Table + */ + class WP_Plugin_Install_List_Table extends \WP_List_Table + { + public $order = 'ASC'; + public $orderby = \null; + public $groups = array(); + /** + * @return bool + */ + public function ajax_user_can() + { + } + /** + * Returns the list of known plugins. + * + * Uses the transient data from the updates API to determine the known + * installed plugins. + * + * @since 4.9.0 + * @access protected + * + * @return array + */ + protected function get_installed_plugins() + { + } + /** + * Returns a list of slugs of installed plugins, if known. + * + * Uses the transient data from the updates API to determine the slugs of + * known installed plugins. This might be better elsewhere, perhaps even + * within get_plugins(). + * + * @since 4.0.0 + * + * @return array + */ + protected function get_installed_plugin_slugs() + { + } + /** + * @global array $tabs + * @global string $tab + * @global int $paged + * @global string $type + * @global string $term + * @phpstan-return void + */ + public function prepare_items() + { + } + /** + */ + public function no_items() + { + } + /** + * @global array $tabs + * @global string $tab + * + * @return array + */ + protected function get_views() + { + } + /** + * Overrides parent views so we can use the filter bar display. + */ + public function views() + { + } + /** + * Displays the plugin install table. + * + * Overrides the parent display() method to provide a different container. + * + * @since 4.0.0 + */ + public function display() + { + } + /** + * @global string $tab + * + * @param string $which + * @phpstan-return void + */ + protected function display_tablenav($which) + { + } + /** + * @return array + */ + protected function get_table_classes() + { + } + /** + * @return string[] Array of column titles keyed by their column name. + */ + public function get_columns() + { + } + public function display_rows() + { + } + /** + * Returns a notice containing a list of dependencies required by the plugin. + * + * @since 6.5.0 + * + * @param array $plugin_data An array of plugin data. See {@see plugins_api()} + * for the list of possible values. + * @return string A notice containing a list of dependencies required by the plugin, + * or an empty string if none is required. + * @phpstan-param object|array{ + * slug?: string, + * per_page?: int, + * page?: int, + * number?: int, + * search?: string, + * tag?: string, + * author?: string, + * user?: string, + * browse?: string, + * locale?: string, + * installed_plugins?: string, + * is_ssl?: bool, + * fields?: array{ + * short_description?: bool, + * description?: bool, + * sections?: bool, + * tested?: bool, + * requires?: bool, + * requires_php?: bool, + * rating?: bool, + * ratings?: bool, + * downloaded?: bool, + * downloadlink?: bool, + * last_updated?: bool, + * added?: bool, + * tags?: bool, + * compatibility?: bool, + * homepage?: bool, + * versions?: bool, + * donate_link?: bool, + * reviews?: bool, + * banners?: bool, + * icons?: bool, + * active_installs?: bool, + * group?: bool, + * contributors?: bool, + * }, + * } $plugin_data See plugins_api() + */ + protected function get_dependencies_notice($plugin_data) + { + } + /** + * Creates a 'More details' link for the plugin. + * + * @since 6.5.0 + * + * @param string $name The plugin's name. + * @param string $slug The plugin's slug. + * @return string The 'More details' link for the plugin. + */ + protected function get_more_details_link($name, $slug) + { + } + } + /** + * List Table API: WP_Plugins_List_Table class + * + * @package WordPress + * @subpackage Administration + * @since 3.1.0 + */ + /** + * Core class used to implement displaying installed plugins in a list table. + * + * @since 3.1.0 + * + * @see WP_List_Table + */ + class WP_Plugins_List_Table extends \WP_List_Table + { + /** + * Whether to show the auto-updates UI. + * + * @since 5.5.0 + * + * @var bool True if auto-updates UI is to be shown, false otherwise. + */ + protected $show_autoupdates = \true; + /** + * Constructor. + * + * @since 3.1.0 + * + * @see WP_List_Table::__construct() for more information on default arguments. + * + * @global string $status + * @global int $page + * + * @param array $args An associative array of arguments. + */ + public function __construct($args = array()) + { + } + /** + * @return array + */ + protected function get_table_classes() + { + } + /** + * @return bool + */ + public function ajax_user_can() + { + } + /** + * @global string $status + * @global array $plugins + * @global array $totals + * @global int $page + * @global string $orderby + * @global string $order + * @global string $s + */ + public function prepare_items() + { + } + /** + * @global string $s URL encoded search term. + * + * @param array $plugin + * @return bool + */ + public function _search_callback($plugin) + { + } + /** + * @global string $orderby + * @global string $order + * @param array $plugin_a + * @param array $plugin_b + * @return int + */ + public function _order_callback($plugin_a, $plugin_b) + { + } + /** + * @global array $plugins + */ + public function no_items() + { + } + /** + * Displays the search box. + * + * @since 4.6.0 + * + * @param string $text The 'submit' button label. + * @param string $input_id ID attribute value for the search input field. + * @phpstan-return void + */ + public function search_box($text, $input_id) + { + } + /** + * @global string $status + * + * @return string[] Array of column titles keyed by their column name. + */ + public function get_columns() + { + } + /** + * @return array + */ + protected function get_sortable_columns() + { + } + /** + * @global array $totals + * @global string $status + * @return array + */ + protected function get_views() + { + } + /** + * @global string $status + * @return array + */ + protected function get_bulk_actions() + { + } + /** + * @global string $status + * @param string $which + * @phpstan-return void + */ + public function bulk_actions($which = '') + { + } + /** + * @global string $status + * @param string $which + * @phpstan-return void + */ + protected function extra_tablenav($which) + { + } + /** + * @return string + */ + public function current_action() + { + } + /** + * @global string $status + * @phpstan-return void + */ + public function display_rows() + { + } + /** + * @global string $status + * @global int $page + * @global string $s + * @global array $totals + * + * @param array $item + */ + public function single_row($item) + { + } + /** + * Gets the name of the primary column for this specific list table. + * + * @since 4.3.0 + * + * @return string Unalterable name for the primary column, in this case, 'name'. + */ + protected function get_primary_column_name() + { + } + /** + * Prints a list of other plugins that depend on the plugin. + * + * @since 6.5.0 + * + * @param string $dependency The dependency's filepath, relative to the plugins directory. + * @phpstan-return void + */ + protected function add_dependents_to_dependency_plugin_row($dependency) + { + } + /** + * Prints a list of other plugins that the plugin depends on. + * + * @since 6.5.0 + * + * @param string $dependent The dependent plugin's filepath, relative to the plugins directory. + * @phpstan-return void + */ + protected function add_dependencies_to_dependent_plugin_row($dependent) + { + } + /** + * Returns a 'View details' like link for a dependency. + * + * @since 6.5.0 + * + * @param string $name The dependency's name. + * @param string $slug The dependency's slug. + * @return string A 'View details' link for the dependency. + */ + protected function get_dependency_view_details_link($name, $slug) + { + } + /** + * Returns a 'View details' link for the plugin. + * + * @since 6.5.0 + * + * @param string $name The plugin's name. + * @param string $slug The plugin's slug. + * @return string A 'View details' link for the plugin. + */ + protected function get_view_details_link($name, $slug) + { + } + } + /** + * List Table API: WP_Post_Comments_List_Table class + * + * @package WordPress + * @subpackage Administration + * @since 4.4.0 + */ + /** + * Core class used to implement displaying post comments in a list table. + * + * @since 3.1.0 + * + * @see WP_Comments_List_Table + */ + class WP_Post_Comments_List_Table extends \WP_Comments_List_Table + { + /** + * @return array + */ + protected function get_column_info() + { + } + /** + * @return array + */ + protected function get_table_classes() + { + } + /** + * @param bool $output_empty + */ + public function display($output_empty = \false) + { + } + /** + * @param bool $comment_status + * @return int + */ + public function get_per_page($comment_status = \false) + { + } + } + /** + * List Table API: WP_Posts_List_Table class + * + * @package WordPress + * @subpackage Administration + * @since 3.1.0 + */ + /** + * Core class used to implement displaying posts in a list table. + * + * @since 3.1.0 + * + * @see WP_List_Table + */ + class WP_Posts_List_Table extends \WP_List_Table + { + /** + * Whether the items should be displayed hierarchically or linearly. + * + * @since 3.1.0 + * @var bool + */ + protected $hierarchical_display; + /** + * Holds the number of pending comments for each post. + * + * @since 3.1.0 + * @var array + */ + protected $comment_pending_count; + /** + * Current level for output. + * + * @since 4.3.0 + * @var int + */ + protected $current_level = 0; + /** + * Constructor. + * + * @since 3.1.0 + * + * @see WP_List_Table::__construct() for more information on default arguments. + * + * @global WP_Post_Type $post_type_object Global post type object. + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array $args An associative array of arguments. + */ + public function __construct($args = array()) + { + } + /** + * Sets whether the table layout should be hierarchical or not. + * + * @since 4.2.0 + * + * @param bool $display Whether the table layout should be hierarchical. + */ + public function set_hierarchical_display($display) + { + } + /** + * @return bool + */ + public function ajax_user_can() + { + } + /** + * @global string $mode List table view mode. + * @global array $avail_post_stati + * @global WP_Query $wp_query WordPress Query object. + * @global int $per_page + */ + public function prepare_items() + { + } + /** + * @return bool + */ + public function has_items() + { + } + /** + */ + public function no_items() + { + } + /** + * Determines if the current view is the "All" view. + * + * @since 4.2.0 + * + * @return bool Whether the current view is the "All" view. + */ + protected function is_base_request() + { + } + /** + * Creates a link to edit.php with params. + * + * @since 4.4.0 + * + * @param string[] $args Associative array of URL parameters for the link. + * @param string $link_text Link text. + * @param string $css_class Optional. Class attribute. Default empty string. + * @return string The formatted link string. + */ + protected function get_edit_link($args, $link_text, $css_class = '') + { + } + /** + * @global array $locked_post_status This seems to be deprecated. + * @global array $avail_post_stati + * @return array + */ + protected function get_views() + { + } + /** + * @return array + */ + protected function get_bulk_actions() + { + } + /** + * Displays a categories drop-down for filtering on the Posts list table. + * + * @since 4.6.0 + * + * @global int $cat Currently selected category. + * + * @param string $post_type Post type slug. + * @phpstan-return void + */ + protected function categories_dropdown($post_type) + { + } + /** + * Displays a formats drop-down for filtering items. + * + * @since 5.2.0 + * @access protected + * + * @param string $post_type Post type slug. + * @phpstan-return void + */ + protected function formats_dropdown($post_type) + { + } + /** + * @param string $which + */ + protected function extra_tablenav($which) + { + } + /** + * @return string + */ + public function current_action() + { + } + /** + * @global string $mode List table view mode. + * + * @return array + */ + protected function get_table_classes() + { + } + /** + * @return string[] Array of column titles keyed by their column name. + */ + public function get_columns() + { + } + /** + * @return array + */ + protected function get_sortable_columns() + { + } + /** + * @global WP_Query $wp_query WordPress Query object. + * @global int $per_page + * @param array $posts + * @param int $level + */ + public function display_rows($posts = array(), $level = 0) + { + } + /** + * Handles the checkbox column output. + * + * @since 4.3.0 + * @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param WP_Post $item The current WP_Post object. + */ + public function column_cb($item) + { + } + /** + * @since 4.3.0 + * + * @param WP_Post $post + * @param string $classes + * @param string $data + * @param string $primary + */ + protected function _column_title($post, $classes, $data, $primary) + { + } + /** + * Handles the title column output. + * + * @since 4.3.0 + * + * @global string $mode List table view mode. + * + * @param WP_Post $post The current WP_Post object. + */ + public function column_title($post) + { + } + /** + * Handles the post date column output. + * + * @since 4.3.0 + * + * @global string $mode List table view mode. + * + * @param WP_Post $post The current WP_Post object. + */ + public function column_date($post) + { + } + /** + * Handles the comments column output. + * + * @since 4.3.0 + * + * @param WP_Post $post The current WP_Post object. + */ + public function column_comments($post) + { + } + /** + * Handles the post author column output. + * + * @since 4.3.0 + * + * @param WP_Post $post The current WP_Post object. + */ + public function column_author($post) + { + } + /** + * Handles the default column output. + * + * @since 4.3.0 + * @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param WP_Post $item The current WP_Post object. + * @param string $column_name The current column name. + * @phpstan-return void + */ + public function column_default($item, $column_name) + { + } + /** + * @global WP_Post $post Global post object. + * + * @param int|WP_Post $post + * @param int $level + */ + public function single_row($post, $level = 0) + { + } + /** + * Gets the name of the default primary column. + * + * @since 4.3.0 + * + * @return string Name of the default primary column, in this case, 'title'. + */ + protected function get_default_primary_column_name() + { + } + /** + * Generates and displays row action links. + * + * @since 4.3.0 + * @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param WP_Post $item Post being acted upon. + * @param string $column_name Current column name. + * @param string $primary Primary column name. + * @return string Row actions output for posts, or an empty string + * if the current column is not the primary column. + */ + protected function handle_row_actions($item, $column_name, $primary) + { + } + /** + * Outputs the hidden row displayed when inline editing + * + * @since 3.1.0 + * + * @global string $mode List table view mode. + */ + public function inline_edit() + { + } + } + /** + * List Table API: WP_Privacy_Requests_Table class + * + * @package WordPress + * @subpackage Administration + * @since 4.9.6 + */ + abstract class WP_Privacy_Requests_Table extends \WP_List_Table + { + /** + * Action name for the requests this table will work with. Classes + * which inherit from WP_Privacy_Requests_Table should define this. + * + * Example: 'export_personal_data'. + * + * @since 4.9.6 + * + * @var string $request_type Name of action. + */ + protected $request_type = 'INVALID'; + /** + * Post type to be used. + * + * @since 4.9.6 + * + * @var string $post_type The post type. + */ + protected $post_type = 'INVALID'; + /** + * Gets columns to show in the list table. + * + * @since 4.9.6 + * + * @return string[] Array of column titles keyed by their column name. + */ + public function get_columns() + { + } + /** + * Normalizes the admin URL to the current page (by request_type). + * + * @since 5.3.0 + * + * @return string URL to the current admin page. + */ + protected function get_admin_url() + { + } + /** + * Gets a list of sortable columns. + * + * @since 4.9.6 + * + * @return array Default sortable columns. + */ + protected function get_sortable_columns() + { + } + /** + * Returns the default primary column. + * + * @since 4.9.6 + * + * @return string Default primary column name. + */ + protected function get_default_primary_column_name() + { + } + /** + * Counts the number of requests for each status. + * + * @since 4.9.6 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return object Number of posts for each status. + */ + protected function get_request_counts() + { + } + /** + * Gets an associative array ( id => link ) with the list of views available on this table. + * + * @since 4.9.6 + * + * @return string[] An array of HTML links keyed by their view. + */ + protected function get_views() + { + } + /** + * Gets bulk actions. + * + * @since 4.9.6 + * + * @return array Array of bulk action labels keyed by their action. + */ + protected function get_bulk_actions() + { + } + /** + * Process bulk actions. + * + * @since 4.9.6 + * @since 5.6.0 Added support for the `complete` action. + * @phpstan-return void + */ + public function process_bulk_action() + { + } + /** + * Prepares items to output. + * + * @since 4.9.6 + * @since 5.1.0 Added support for column sorting. + */ + public function prepare_items() + { + } + /** + * Returns the markup for the Checkbox column. + * + * @since 4.9.6 + * + * @param WP_User_Request $item Item being shown. + * @return string Checkbox column markup. + */ + public function column_cb($item) + { + } + /** + * Status column. + * + * @since 4.9.6 + * + * @param WP_User_Request $item Item being shown. + * @return string Status column markup. + */ + public function column_status($item) + { + } + /** + * Converts a timestamp for display. + * + * @since 4.9.6 + * + * @param int $timestamp Event timestamp. + * @return string Human readable date. + */ + protected function get_timestamp_as_date($timestamp) + { + } + /** + * Handles the default column. + * + * @since 4.9.6 + * @since 5.7.0 Added `manage_{$this->screen->id}_custom_column` action. + * + * @param WP_User_Request $item Item being shown. + * @param string $column_name Name of column being shown. + */ + public function column_default($item, $column_name) + { + } + /** + * Returns the markup for the Created timestamp column. Overridden by children. + * + * @since 5.7.0 + * + * @param WP_User_Request $item Item being shown. + * @return string Human readable date. + */ + public function column_created_timestamp($item) + { + } + /** + * Actions column. Overridden by children. + * + * @since 4.9.6 + * + * @param WP_User_Request $item Item being shown. + * @return string Email column markup. + */ + public function column_email($item) + { + } + /** + * Returns the markup for the next steps column. Overridden by children. + * + * @since 4.9.6 + * + * @param WP_User_Request $item Item being shown. + */ + public function column_next_steps($item) + { + } + /** + * Generates content for a single row of the table, + * + * @since 4.9.6 + * + * @param WP_User_Request $item The current item. + */ + public function single_row($item) + { + } + /** + * Embeds scripts used to perform actions. Overridden by children. + * + * @since 4.9.6 + */ + public function embed_scripts() + { + } + } + /** + * WP_Privacy_Data_Export_Requests_Table class. + * + * @since 4.9.6 + */ + class WP_Privacy_Data_Export_Requests_List_Table extends \WP_Privacy_Requests_Table + { + /** + * Action name for the requests this table will work with. + * + * @since 4.9.6 + * + * @var string $request_type Name of action. + */ + protected $request_type = 'export_personal_data'; + /** + * Post type for the requests. + * + * @since 4.9.6 + * + * @var string $post_type The post type. + */ + protected $post_type = 'user_request'; + /** + * Actions column. + * + * @since 4.9.6 + * + * @param WP_User_Request $item Item being shown. + * @return string Email column markup. + */ + public function column_email($item) + { + } + /** + * Displays the next steps column. + * + * @since 4.9.6 + * + * @param WP_User_Request $item Item being shown. + */ + public function column_next_steps($item) + { + } + } + /** + * WP_Privacy_Data_Removal_Requests_List_Table class. + * + * @since 4.9.6 + */ + class WP_Privacy_Data_Removal_Requests_List_Table extends \WP_Privacy_Requests_Table + { + /** + * Action name for the requests this table will work with. + * + * @since 4.9.6 + * + * @var string $request_type Name of action. + */ + protected $request_type = 'remove_personal_data'; + /** + * Post type for the requests. + * + * @since 4.9.6 + * + * @var string $post_type The post type. + */ + protected $post_type = 'user_request'; + /** + * Outputs the Actions column. + * + * @since 4.9.6 + * + * @param WP_User_Request $item Item being shown. + * @return string Email column markup. + */ + public function column_email($item) + { + } + /** + * Outputs the Next steps column. + * + * @since 4.9.6 + * + * @param WP_User_Request $item Item being shown. + */ + public function column_next_steps($item) + { + } + } + /** + * WP_Privacy_Policy_Content class. + * + * @package WordPress + * @subpackage Administration + * @since 4.9.6 + */ + #[\AllowDynamicProperties] + final class WP_Privacy_Policy_Content + { + /** + * Adds content to the postbox shown when editing the privacy policy. + * + * Plugins and themes should suggest text for inclusion in the site's privacy policy. + * The suggested text should contain information about any functionality that affects user privacy, + * and will be shown in the Suggested Privacy Policy Content postbox. + * + * Intended for use from `wp_add_privacy_policy_content()`. + * + * @since 4.9.6 + * + * @param string $plugin_name The name of the plugin or theme that is suggesting content for the site's privacy policy. + * @param string $policy_text The suggested content for inclusion in the policy. + * @phpstan-return void + */ + public static function add($plugin_name, $policy_text) + { + } + /** + * Performs a quick check to determine whether any privacy info has changed. + * + * @since 4.9.6 + */ + public static function text_change_check() + { + } + /** + * Outputs a warning when some privacy info has changed. + * + * @since 4.9.6 + * @phpstan-return void + */ + public static function policy_text_changed_notice() + { + } + /** + * Updates the cached policy info when the policy page is updated. + * + * @since 4.9.6 + * @access private + * + * @param int $post_id The ID of the updated post. + * @phpstan-return void + */ + public static function _policy_page_updated($post_id) + { + } + /** + * Checks for updated, added or removed privacy policy information from plugins. + * + * Caches the current info in post_meta of the policy page. + * + * @since 4.9.6 + * + * @return array The privacy policy text/information added by core and plugins. + */ + public static function get_suggested_policy_text() + { + } + /** + * Adds a notice with a link to the guide when editing the privacy policy page. + * + * @since 4.9.6 + * @since 5.0.0 The `$post` parameter was made optional. + * + * @global WP_Post $post Global post object. + * + * @param WP_Post|null $post The currently edited post. Default null. + * @phpstan-return void + */ + public static function notice($post = \null) + { + } + /** + * Outputs the privacy policy guide together with content from the theme and plugins. + * + * @since 4.9.6 + */ + public static function privacy_policy_guide() + { + } + /** + * Returns the default suggested privacy policy content. + * + * @since 4.9.6 + * @since 5.0.0 Added the `$blocks` parameter. + * + * @param bool $description Whether to include the descriptions under the section headings. Default false. + * @param bool $blocks Whether to format the content for the block editor. Default true. + * @return string The default policy content. + */ + public static function get_default_content($description = \false, $blocks = \true) + { + } + /** + * Adds the suggested privacy policy text to the policy postbox. + * + * @since 4.9.6 + */ + public static function add_suggested_content() + { + } + } + /** + * Screen API: WP_Screen class + * + * @package WordPress + * @subpackage Administration + * @since 4.4.0 + */ + /** + * Core class used to implement an admin screen API. + * + * @since 3.3.0 + */ + #[\AllowDynamicProperties] + final class WP_Screen + { + /** + * Any action associated with the screen. + * + * 'add' for *-add.php and *-new.php screens. Empty otherwise. + * + * @since 3.3.0 + * @var string + */ + public $action; + /** + * The base type of the screen. + * + * This is typically the same as `$id` but with any post types and taxonomies stripped. + * For example, for an `$id` of 'edit-post' the base is 'edit'. + * + * @since 3.3.0 + * @var string + */ + public $base; + /** + * The unique ID of the screen. + * + * @since 3.3.0 + * @var string + */ + public $id; + /** + * Whether the screen is in the network admin. + * + * Deprecated. Use in_admin() instead. + * + * @since 3.3.0 + * @deprecated 3.5.0 + * @var bool + */ + public $is_network; + /** + * Whether the screen is in the user admin. + * + * Deprecated. Use in_admin() instead. + * + * @since 3.3.0 + * @deprecated 3.5.0 + * @var bool + */ + public $is_user; + /** + * The base menu parent. + * + * This is derived from `$parent_file` by removing the query string and any .php extension. + * `$parent_file` values of 'edit.php?post_type=page' and 'edit.php?post_type=post' + * have a `$parent_base` of 'edit'. + * + * @since 3.3.0 + * @var string|null + */ + public $parent_base; + /** + * The parent_file for the screen per the admin menu system. + * + * Some `$parent_file` values are 'edit.php?post_type=page', 'edit.php', and 'options-general.php'. + * + * @since 3.3.0 + * @var string|null + */ + public $parent_file; + /** + * The post type associated with the screen, if any. + * + * The 'edit.php?post_type=page' screen has a post type of 'page'. + * The 'edit-tags.php?taxonomy=$taxonomy&post_type=page' screen has a post type of 'page'. + * + * @since 3.3.0 + * @var string + */ + public $post_type; + /** + * The taxonomy associated with the screen, if any. + * + * The 'edit-tags.php?taxonomy=category' screen has a taxonomy of 'category'. + * + * @since 3.3.0 + * @var string + */ + public $taxonomy; + /** + * Whether the screen is using the block editor. + * + * @since 5.0.0 + * @var bool + */ + public $is_block_editor = \false; + /** + * Fetches a screen object. + * + * @since 3.3.0 + * + * @global string $hook_suffix + * + * @param string|WP_Screen $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen. + * Defaults to the current $hook_suffix global. + * @return WP_Screen Screen object. + */ + public static function get($hook_name = '') + { + } + /** + * Makes the screen object the current screen. + * + * @see set_current_screen() + * @since 3.3.0 + * + * @global WP_Screen $current_screen WordPress current screen object. + * @global string $typenow The post type of the current screen. + * @global string $taxnow The taxonomy of the current screen. + */ + public function set_current_screen() + { + } + /** + * Indicates whether the screen is in a particular admin. + * + * @since 3.5.0 + * + * @param string $admin The admin to check against (network | user | site). + * If empty any of the three admins will result in true. + * @return bool True if the screen is in the indicated admin, false otherwise. + */ + public function in_admin($admin = \null) + { + } + /** + * Sets or returns whether the block editor is loading on the current screen. + * + * @since 5.0.0 + * + * @param bool $set Optional. Sets whether the block editor is loading on the current screen or not. + * @return bool True if the block editor is being loaded, false otherwise. + */ + public function is_block_editor($set = \null) + { + } + /** + * Sets the old string-based contextual help for the screen for backward compatibility. + * + * @since 3.3.0 + * + * @param WP_Screen $screen A screen object. + * @param string $help Help text. + */ + public static function add_old_compat_help($screen, $help) + { + } + /** + * Sets the parent information for the screen. + * + * This is called in admin-header.php after the menu parent for the screen has been determined. + * + * @since 3.3.0 + * + * @param string $parent_file The parent file of the screen. Typically the $parent_file global. + */ + public function set_parentage($parent_file) + { + } + /** + * Adds an option for the screen. + * + * Call this in template files after admin.php is loaded and before admin-header.php is loaded + * to add screen options. + * + * @since 3.3.0 + * + * @param string $option Option ID. + * @param mixed $args Option-dependent arguments. + */ + public function add_option($option, $args = array()) + { + } + /** + * Removes an option from the screen. + * + * @since 3.8.0 + * + * @param string $option Option ID. + */ + public function remove_option($option) + { + } + /** + * Removes all options from the screen. + * + * @since 3.8.0 + */ + public function remove_options() + { + } + /** + * Gets the options registered for the screen. + * + * @since 3.8.0 + * + * @return array Options with arguments. + */ + public function get_options() + { + } + /** + * Gets the arguments for an option for the screen. + * + * @since 3.3.0 + * + * @param string $option Option name. + * @param string|false $key Optional. Specific array key for when the option is an array. + * Default false. + * @return string The option value if set, null otherwise. + */ + public function get_option($option, $key = \false) + { + } + /** + * Gets the help tabs registered for the screen. + * + * @since 3.4.0 + * @since 4.4.0 Help tabs are ordered by their priority. + * + * @return array Help tabs with arguments. + */ + public function get_help_tabs() + { + } + /** + * Gets the arguments for a help tab. + * + * @since 3.4.0 + * + * @param string $id Help Tab ID. + * @return array Help tab arguments. + */ + public function get_help_tab($id) + { + } + /** + * Adds a help tab to the contextual help for the screen. + * + * Call this on the `load-$pagenow` hook for the relevant screen, + * or fetch the `$current_screen` object, or use get_current_screen() + * and then call the method from the object. + * + * You may need to filter `$current_screen` using an if or switch statement + * to prevent new help tabs from being added to ALL admin screens. + * + * @since 3.3.0 + * @since 4.4.0 The `$priority` argument was added. + * + * @param array $args { + * Array of arguments used to display the help tab. + * + * @type string $title Title for the tab. Default false. + * @type string $id Tab ID. Must be HTML-safe and should be unique for this menu. + * It is NOT allowed to contain any empty spaces. Default false. + * @type string $content Optional. Help tab content in plain text or HTML. Default empty string. + * @type callable $callback Optional. A callback to generate the tab content. Default false. + * @type int $priority Optional. The priority of the tab, used for ordering. Default 10. + * } + * @phpstan-param array{ + * title?: string, + * id?: string, + * content?: string, + * callback?: callable, + * priority?: int, + * } $args + * @phpstan-return void + */ + public function add_help_tab($args) + { + } + /** + * Removes a help tab from the contextual help for the screen. + * + * @since 3.3.0 + * + * @param string $id The help tab ID. + */ + public function remove_help_tab($id) + { + } + /** + * Removes all help tabs from the contextual help for the screen. + * + * @since 3.3.0 + */ + public function remove_help_tabs() + { + } + /** + * Gets the content from a contextual help sidebar. + * + * @since 3.4.0 + * + * @return string Contents of the help sidebar. + */ + public function get_help_sidebar() + { + } + /** + * Adds a sidebar to the contextual help for the screen. + * + * Call this in template files after admin.php is loaded and before admin-header.php is loaded + * to add a sidebar to the contextual help. + * + * @since 3.3.0 + * + * @param string $content Sidebar content in plain text or HTML. + */ + public function set_help_sidebar($content) + { + } + /** + * Gets the number of layout columns the user has selected. + * + * The layout_columns option controls the max number and default number of + * columns. This method returns the number of columns within that range selected + * by the user via Screen Options. If no selection has been made, the default + * provisioned in layout_columns is returned. If the screen does not support + * selecting the number of layout columns, 0 is returned. + * + * @since 3.4.0 + * + * @return int Number of columns to display. + */ + public function get_columns() + { + } + /** + * Gets the accessible hidden headings and text used in the screen. + * + * @since 4.4.0 + * + * @see set_screen_reader_content() For more information on the array format. + * + * @return string[] An associative array of screen reader text strings. + */ + public function get_screen_reader_content() + { + } + /** + * Gets a screen reader text string. + * + * @since 4.4.0 + * + * @param string $key Screen reader text array named key. + * @return string Screen reader text string. + */ + public function get_screen_reader_text($key) + { + } + /** + * Adds accessible hidden headings and text for the screen. + * + * @since 4.4.0 + * + * @param array $content { + * An associative array of screen reader text strings. + * + * @type string $heading_views Screen reader text for the filter links heading. + * Default 'Filter items list'. + * @type string $heading_pagination Screen reader text for the pagination heading. + * Default 'Items list navigation'. + * @type string $heading_list Screen reader text for the items list heading. + * Default 'Items list'. + * } + * @phpstan-param array{ + * heading_views?: string, + * heading_pagination?: string, + * heading_list?: string, + * } $content + */ + public function set_screen_reader_content($content = array()) + { + } + /** + * Removes all the accessible hidden headings and text for the screen. + * + * @since 4.4.0 + */ + public function remove_screen_reader_content() + { + } + /** + * Renders the screen's help section. + * + * This will trigger the deprecated filters for backward compatibility. + * + * @since 3.3.0 + * + * @global string $screen_layout_columns + * @phpstan-return void + */ + public function render_screen_meta() + { + } + /** + * @global array $wp_meta_boxes Global meta box state. + * + * @return bool + */ + public function show_screen_options() + { + } + /** + * Renders the screen options tab. + * + * @since 3.3.0 + * + * @param array $options { + * Options for the tab. + * + * @type bool $wrap Whether the screen-options-wrap div will be included. Defaults to true. + * } + * @phpstan-param array{ + * wrap?: bool, + * } $options + */ + public function render_screen_options($options = array()) + { + } + /** + * Renders the meta boxes preferences. + * + * @since 4.4.0 + * + * @global array $wp_meta_boxes Global meta box state. + * @phpstan-return void + */ + public function render_meta_boxes_preferences() + { + } + /** + * Renders the list table columns preferences. + * + * @since 4.4.0 + * @phpstan-return void + */ + public function render_list_table_columns_preferences() + { + } + /** + * Renders the option for number of columns on the page. + * + * @since 3.3.0 + * @phpstan-return void + */ + public function render_screen_layout() + { + } + /** + * Renders the items per page option. + * + * @since 3.3.0 + * @phpstan-return void + */ + public function render_per_page_options() + { + } + /** + * Renders the list table view mode preferences. + * + * @since 4.4.0 + * + * @global string $mode List table view mode. + * @phpstan-return void + */ + public function render_view_mode() + { + } + /** + * Renders screen reader text. + * + * @since 4.4.0 + * + * @param string $key The screen reader text array named key. + * @param string $tag Optional. The HTML tag to wrap the screen reader text. Default h2. + * @phpstan-return void + */ + public function render_screen_reader_content($key = '', $tag = 'h2') + { + } + } + /** + * Class for testing automatic updates in the WordPress code. + * + * @package WordPress + * @subpackage Site_Health + * @since 5.2.0 + */ + #[\AllowDynamicProperties] + class WP_Site_Health_Auto_Updates + { + /** + * WP_Site_Health_Auto_Updates constructor. + * + * @since 5.2.0 + */ + public function __construct() + { + } + /** + * Runs tests to determine if auto-updates can run. + * + * @since 5.2.0 + * + * @return array The test results. + */ + public function run_tests() + { + } + /** + * Tests if auto-updates related constants are set correctly. + * + * @since 5.2.0 + * @since 5.5.1 The `$value` parameter can accept an array. + * + * @param string $constant The name of the constant to check. + * @param bool|string|array $value The value that the constant should be, if set, + * or an array of acceptable values. + * @return array The test results. + */ + public function test_constants($constant, $value) + { + } + /** + * Checks if updates are intercepted by a filter. + * + * @since 5.2.0 + * + * @return array The test results. + */ + public function test_wp_version_check_attached() + { + } + /** + * Checks if automatic updates are disabled by a filter. + * + * @since 5.2.0 + * + * @return array The test results. + */ + public function test_filters_automatic_updater_disabled() + { + } + /** + * Checks if automatic updates are disabled. + * + * @since 5.3.0 + * + * @return array|false The test results. False if auto-updates are enabled. + */ + public function test_wp_automatic_updates_disabled() + { + } + /** + * Checks if automatic updates have tried to run, but failed, previously. + * + * @since 5.2.0 + * + * @return array|false The test results. False if the auto-updates failed. + */ + public function test_if_failed_update() + { + } + /** + * Checks if WordPress is controlled by a VCS (Git, Subversion etc). + * + * @since 5.2.0 + * + * @return array The test results. + */ + public function test_vcs_abspath() + { + } + /** + * Checks if we can access files without providing credentials. + * + * @since 5.2.0 + * + * @return array The test results. + */ + public function test_check_wp_filesystem_method() + { + } + /** + * Checks if core files are writable by the web user/group. + * + * @since 5.2.0 + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @return array|false The test results. False if they're not writeable. + */ + public function test_all_files_writable() + { + } + /** + * Checks if the install is using a development branch and can use nightly packages. + * + * @since 5.2.0 + * + * @return array|false The test results. False if it isn't a development version. + */ + public function test_accepts_dev_updates() + { + } + /** + * Checks if the site supports automatic minor updates. + * + * @since 5.2.0 + * + * @return array The test results. + */ + public function test_accepts_minor_updates() + { + } + } + /** + * Class for looking up a site's health based on a user's WordPress environment. + * + * @package WordPress + * @subpackage Site_Health + * @since 5.2.0 + */ + #[\AllowDynamicProperties] + class WP_Site_Health + { + public $is_mariadb = \false; + public $php_memory_limit; + public $schedules; + public $crons; + public $last_missed_cron = \null; + public $last_late_cron = \null; + /** + * WP_Site_Health constructor. + * + * @since 5.2.0 + */ + public function __construct() + { + } + /** + * Outputs the content of a tab in the Site Health screen. + * + * @since 5.8.0 + * + * @param string $tab Slug of the current tab being displayed. + */ + public function show_site_health_tab($tab) + { + } + /** + * Returns an instance of the WP_Site_Health class, or create one if none exist yet. + * + * @since 5.4.0 + * + * @return WP_Site_Health|null + */ + public static function get_instance() + { + } + /** + * Enqueues the site health scripts. + * + * @since 5.2.0 + * @phpstan-return void + */ + public function enqueue_scripts() + { + } + /** + * Tests whether `wp_version_check` is blocked. + * + * It's possible to block updates with the `wp_version_check` filter, but this can't be checked + * during an Ajax call, as the filter is never introduced then. + * + * This filter overrides a standard page request if it's made by an admin through the Ajax call + * with the right query argument to check for this. + * + * @since 5.2.0 + * @phpstan-return void + */ + public function check_wp_version_check_exists() + { + } + /** + * Tests for WordPress version and outputs it. + * + * Gives various results depending on what kind of updates are available, if any, to encourage + * the user to install security updates as a priority. + * + * @since 5.2.0 + * + * @return array The test result. + */ + public function get_test_wordpress_version() + { + } + /** + * Tests if plugins are outdated, or unnecessary. + * + * The test checks if your plugins are up to date, and encourages you to remove any + * that are not in use. + * + * @since 5.2.0 + * + * @return array The test result. + */ + public function get_test_plugin_version() + { + } + /** + * Tests if themes are outdated, or unnecessary. + * + * Checks if your site has a default theme (to fall back on if there is a need), + * if your themes are up to date and, finally, encourages you to remove any themes + * that are not needed. + * + * @since 5.2.0 + * + * @return array The test results. + */ + public function get_test_theme_version() + { + } + /** + * Tests if the supplied PHP version is supported. + * + * @since 5.2.0 + * + * @return array The test results. + */ + public function get_test_php_version() + { + } + /** + * Tests if required PHP modules are installed on the host. + * + * This test builds on the recommendations made by the WordPress Hosting Team + * as seen at https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions + * + * @since 5.2.0 + * + * @return array + */ + public function get_test_php_extensions() + { + } + /** + * Tests if the PHP default timezone is set to UTC. + * + * @since 5.3.1 + * + * @return array The test results. + */ + public function get_test_php_default_timezone() + { + } + /** + * Tests if there's an active PHP session that can affect loopback requests. + * + * @since 5.5.0 + * + * @return array The test results. + */ + public function get_test_php_sessions() + { + } + /** + * Tests if the SQL server is up to date. + * + * @since 5.2.0 + * + * @return array The test results. + */ + public function get_test_sql_server() + { + } + /** + * Tests if the site can communicate with WordPress.org. + * + * @since 5.2.0 + * + * @return array The test results. + */ + public function get_test_dotorg_communication() + { + } + /** + * Tests if debug information is enabled. + * + * When WP_DEBUG is enabled, errors and information may be disclosed to site visitors, + * or logged to a publicly accessible file. + * + * Debugging is also frequently left enabled after looking for errors on a site, + * as site owners do not understand the implications of this. + * + * @since 5.2.0 + * + * @return array The test results. + */ + public function get_test_is_in_debug_mode() + { + } + /** + * Tests if the site is serving content over HTTPS. + * + * Many sites have varying degrees of HTTPS support, the most common of which is sites that have it + * enabled, but only if you visit the right site address. + * + * @since 5.2.0 + * @since 5.7.0 Updated to rely on {@see wp_is_using_https()} and {@see wp_is_https_supported()}. + * + * @return array The test results. + */ + public function get_test_https_status() + { + } + /** + * Checks if the HTTP API can handle SSL/TLS requests. + * + * @since 5.2.0 + * + * @return array The test result. + */ + public function get_test_ssl_support() + { + } + /** + * Tests if scheduled events run as intended. + * + * If scheduled events are not running, this may indicate something with WP_Cron is not working + * as intended, or that there are orphaned events hanging around from older code. + * + * @since 5.2.0 + * + * @return array The test results. + */ + public function get_test_scheduled_events() + { + } + /** + * Tests if WordPress can run automated background updates. + * + * Background updates in WordPress are primarily used for minor releases and security updates. + * It's important to either have these working, or be aware that they are intentionally disabled + * for whatever reason. + * + * @since 5.2.0 + * + * @return array The test results. + */ + public function get_test_background_updates() + { + } + /** + * Tests if plugin and theme auto-updates appear to be configured correctly. + * + * @since 5.5.0 + * + * @return array The test results. + */ + public function get_test_plugin_theme_auto_updates() + { + } + /** + * Tests available disk space for updates. + * + * @since 6.3.0 + * + * @return array The test results. + */ + public function get_test_available_updates_disk_space() + { + } + /** + * Tests if plugin and theme temporary backup directories are writable or can be created. + * + * @since 6.3.0 + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @return array The test results. + */ + public function get_test_update_temp_backup_writable() + { + } + /** + * Tests if loopbacks work as expected. + * + * A loopback is when WordPress queries itself, for example to start a new WP_Cron instance, + * or when editing a plugin or theme. This has shown itself to be a recurring issue, + * as code can very easily break this interaction. + * + * @since 5.2.0 + * + * @return array The test results. + */ + public function get_test_loopback_requests() + { + } + /** + * Tests if HTTP requests are blocked. + * + * It's possible to block all outgoing communication (with the possibility of allowing certain + * hosts) via the HTTP API. This may create problems for users as many features are running as + * services these days. + * + * @since 5.2.0 + * + * @return array The test results. + */ + public function get_test_http_requests() + { + } + /** + * Tests if the REST API is accessible. + * + * Various security measures may block the REST API from working, or it may have been disabled in general. + * This is required for the new block editor to work, so we explicitly test for this. + * + * @since 5.2.0 + * + * @return array The test results. + */ + public function get_test_rest_availability() + { + } + /** + * Tests if 'file_uploads' directive in PHP.ini is turned off. + * + * @since 5.5.0 + * + * @return array The test results. + */ + public function get_test_file_uploads() + { + } + /** + * Tests if the Authorization header has the expected values. + * + * @since 5.6.0 + * + * @return array + */ + public function get_test_authorization_header() + { + } + /** + * Tests if a full page cache is available. + * + * @since 6.1.0 + * + * @return array The test result. + */ + public function get_test_page_cache() + { + } + /** + * Tests if the site uses persistent object cache and recommends to use it if not. + * + * @since 6.1.0 + * + * @return array The test result. + */ + public function get_test_persistent_object_cache() + { + } + /** + * Calculates total amount of autoloaded data. + * + * @since 6.6.0 + * + * @return int Autoloaded data in bytes. + */ + public function get_autoloaded_options_size() + { + } + /** + * Tests the number of autoloaded options. + * + * @since 6.6.0 + * + * @return array The test results. + */ + public function get_test_autoloaded_options() + { + } + /** + * Returns a set of tests that belong to the site status page. + * + * Each site status test is defined here, they may be `direct` tests, that run on page load, or `async` tests + * which will run later down the line via JavaScript calls to improve page performance and hopefully also user + * experiences. + * + * @since 5.2.0 + * @since 5.6.0 Added support for `has_rest` and `permissions`. + * + * @return array The list of tests to run. + */ + public static function get_tests() + { + } + /** + * Adds a class to the body HTML tag. + * + * Filters the body class string for admin pages and adds our own class for easier styling. + * + * @since 5.2.0 + * + * @param string $body_class The body class string. + * @return string The modified body class string. + */ + public function admin_body_class($body_class) + { + } + /** + * Checks if any scheduled tasks have been missed. + * + * Returns a boolean value of `true` if a scheduled task has been missed and ends processing. + * + * If the list of crons is an instance of WP_Error, returns the instance instead of a boolean value. + * + * @since 5.2.0 + * + * @return bool|WP_Error True if a cron was missed, false if not. WP_Error if the cron is set to that. + */ + public function has_missed_cron() + { + } + /** + * Checks if any scheduled tasks are late. + * + * Returns a boolean value of `true` if a scheduled task is late and ends processing. + * + * If the list of crons is an instance of WP_Error, returns the instance instead of a boolean value. + * + * @since 5.3.0 + * + * @return bool|WP_Error True if a cron is late, false if not. WP_Error if the cron is set to that. + */ + public function has_late_cron() + { + } + /** + * Checks for potential issues with plugin and theme auto-updates. + * + * Though there is no way to 100% determine if plugin and theme auto-updates are configured + * correctly, a few educated guesses could be made to flag any conditions that would + * potentially cause unexpected behaviors. + * + * @since 5.5.0 + * + * @return object The test results. + */ + public function detect_plugin_theme_auto_update_issues() + { + } + /** + * Runs a loopback test on the site. + * + * Loopbacks are what WordPress uses to communicate with itself to start up WP_Cron, scheduled posts, + * make sure plugin or theme edits don't cause site failures and similar. + * + * @since 5.2.0 + * + * @return object The test results. + */ + public function can_perform_loopback() + { + } + /** + * Creates a weekly cron event, if one does not already exist. + * + * @since 5.4.0 + */ + public function maybe_create_scheduled_event() + { + } + /** + * Runs the scheduled event to check and update the latest site health status for the website. + * + * @since 5.4.0 + */ + public function wp_cron_scheduled_check() + { + } + /** + * Checks if the current environment type is set to 'development' or 'local'. + * + * @since 5.6.0 + * + * @return bool True if it is a development environment, false if not. + */ + public function is_development_environment() + { + } + /** + * Returns a list of headers and its verification callback to verify if page cache is enabled or not. + * + * Note: key is header name and value could be callable function to verify header value. + * Empty value mean existence of header detect page cache is enabled. + * + * @since 6.1.0 + * + * @return array List of client caching headers and their (optional) verification callbacks. + */ + public function get_page_cache_headers() + { + } + /** + * Determines whether to suggest using a persistent object cache. + * + * @since 6.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return bool Whether to suggest using a persistent object cache. + */ + public function should_suggest_persistent_object_cache() + { + } + } + /** + * Administration API: WP_Site_Icon class + * + * @package WordPress + * @subpackage Administration + * @since 4.3.0 + */ + /** + * Core class used to implement site icon functionality. + * + * @since 4.3.0 + */ + #[\AllowDynamicProperties] + class WP_Site_Icon + { + /** + * The minimum size of the site icon. + * + * @since 4.3.0 + * @var int + */ + public $min_size = 512; + /** + * The size to which to crop the image so that we can display it in the UI nicely. + * + * @since 4.3.0 + * @var int + */ + public $page_crop = 512; + /** + * List of site icon sizes. + * + * @since 4.3.0 + * @var int[] + */ + public $site_icon_sizes = array( + /* + * Square, medium sized tiles for IE11+. + * + * See https://msdn.microsoft.com/library/dn455106(v=vs.85).aspx + */ + 270, + /* + * App icon for Android/Chrome. + * + * @link https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android + * @link https://developer.chrome.com/multidevice/android/installtohomescreen + */ + 192, + /* + * App icons up to iPhone 6 Plus. + * + * See https://developer.apple.com/library/prerelease/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html + */ + 180, + // Our regular Favicon. + 32, + ); + /** + * Registers actions and filters. + * + * @since 4.3.0 + */ + public function __construct() + { + } + /** + * Creates an attachment 'object'. + * + * @since 4.3.0 + * @deprecated 6.5.0 + * + * @param string $cropped Cropped image URL. + * @param int $parent_attachment_id Attachment ID of parent image. + * @return array An array with attachment object data. + */ + public function create_attachment_object($cropped, $parent_attachment_id) + { + } + /** + * Inserts an attachment. + * + * @since 4.3.0 + * + * @param array $attachment An array with attachment object data. + * @param string $file File path of the attached image. + * @return int Attachment ID. + */ + public function insert_attachment($attachment, $file) + { + } + /** + * Adds additional sizes to be made when creating the site icon images. + * + * @since 4.3.0 + * + * @param array[] $sizes Array of arrays containing information for additional sizes. + * @return array[] Array of arrays containing additional image sizes. + */ + public function additional_sizes($sizes = array()) + { + } + /** + * Adds Site Icon sizes to the array of image sizes on demand. + * + * @since 4.3.0 + * + * @param string[] $sizes Array of image size names. + * @return string[] Array of image size names. + */ + public function intermediate_image_sizes($sizes = array()) + { + } + /** + * Deletes the Site Icon when the image file is deleted. + * + * @since 4.3.0 + * + * @param int $post_id Attachment ID. + */ + public function delete_attachment_data($post_id) + { + } + /** + * Adds custom image sizes when meta data for an image is requested, that happens to be used as Site Icon. + * + * @since 4.3.0 + * + * @param null|array|string $value The value get_metadata() should return a single metadata value, or an + * array of values. + * @param int $post_id Post ID. + * @param string $meta_key Meta key. + * @param bool $single Whether to return only the first value of the specified `$meta_key`. + * @return array|null|string The attachment metadata value, array of values, or null. + */ + public function get_post_metadata($value, $post_id, $meta_key, $single) + { + } + } + /** + * List Table API: WP_Terms_List_Table class + * + * @package WordPress + * @subpackage Administration + * @since 3.1.0 + */ + /** + * Core class used to implement displaying terms in a list table. + * + * @since 3.1.0 + * + * @see WP_List_Table + */ + class WP_Terms_List_Table extends \WP_List_Table + { + public $callback_args; + /** + * Constructor. + * + * @since 3.1.0 + * + * @see WP_List_Table::__construct() for more information on default arguments. + * + * @global string $post_type Global post type. + * @global string $taxonomy Global taxonomy. + * @global string $action + * @global object $tax + * + * @param array $args An associative array of arguments. + */ + public function __construct($args = array()) + { + } + /** + * @return bool + */ + public function ajax_user_can() + { + } + /** + */ + public function prepare_items() + { + } + /** + */ + public function no_items() + { + } + /** + * @return array + */ + protected function get_bulk_actions() + { + } + /** + * @return string + */ + public function current_action() + { + } + /** + * @return string[] Array of column titles keyed by their column name. + */ + public function get_columns() + { + } + /** + * @return array + */ + protected function get_sortable_columns() + { + } + /** + * @phpstan-return void + */ + public function display_rows_or_placeholder() + { + } + /** + * @global string $taxonomy Global taxonomy. + * + * @param WP_Term $tag Term object. + * @param int $level + */ + public function single_row($tag, $level = 0) + { + } + /** + * @since 5.9.0 Renamed `$tag` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param WP_Term $item Term object. + * @return string + */ + public function column_cb($item) + { + } + /** + * @param WP_Term $tag Term object. + * @return string + */ + public function column_name($tag) + { + } + /** + * Gets the name of the default primary column. + * + * @since 4.3.0 + * + * @return string Name of the default primary column, in this case, 'name'. + */ + protected function get_default_primary_column_name() + { + } + /** + * Generates and displays row action links. + * + * @since 4.3.0 + * @since 5.9.0 Renamed `$tag` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param WP_Term $item Tag being acted upon. + * @param string $column_name Current column name. + * @param string $primary Primary column name. + * @return string Row actions output for terms, or an empty string + * if the current column is not the primary column. + */ + protected function handle_row_actions($item, $column_name, $primary) + { + } + /** + * @param WP_Term $tag Term object. + * @return string + */ + public function column_description($tag) + { + } + /** + * @param WP_Term $tag Term object. + * @return string + */ + public function column_slug($tag) + { + } + /** + * @param WP_Term $tag Term object. + * @return string + */ + public function column_posts($tag) + { + } + /** + * @param WP_Term $tag Term object. + * @return string + */ + public function column_links($tag) + { + } + /** + * @since 5.9.0 Renamed `$tag` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param WP_Term $item Term object. + * @param string $column_name Name of the column. + * @return string + */ + public function column_default($item, $column_name) + { + } + /** + * Outputs the hidden row displayed when inline editing + * + * @since 3.1.0 + * @phpstan-return void + */ + public function inline_edit() + { + } + } + /** + * List Table API: WP_Themes_List_Table class + * + * @package WordPress + * @subpackage Administration + * @since 3.1.0 + */ + /** + * Core class used to implement displaying installed themes in a list table. + * + * @since 3.1.0 + * + * @see WP_List_Table + */ + class WP_Themes_List_Table extends \WP_List_Table + { + protected $search_terms = array(); + public $features = array(); + /** + * Constructor. + * + * @since 3.1.0 + * + * @see WP_List_Table::__construct() for more information on default arguments. + * + * @param array $args An associative array of arguments. + */ + public function __construct($args = array()) + { + } + /** + * @return bool + */ + public function ajax_user_can() + { + } + /** + */ + public function prepare_items() + { + } + /** + * @phpstan-return void + */ + public function no_items() + { + } + /** + * @param string $which + * @phpstan-return void + */ + public function tablenav($which = 'top') + { + } + /** + * Displays the themes table. + * + * Overrides the parent display() method to provide a different container. + * + * @since 3.1.0 + */ + public function display() + { + } + /** + * @return string[] Array of column titles keyed by their column name. + */ + public function get_columns() + { + } + /** + */ + public function display_rows_or_placeholder() + { + } + /** + */ + public function display_rows() + { + } + /** + * @param WP_Theme $theme + * @return bool + */ + public function search_theme($theme) + { + } + /** + * Send required variables to JavaScript land + * + * @since 3.4.0 + * + * @param array $extra_args + */ + public function _js_vars($extra_args = array()) + { + } + } + /** + * List Table API: WP_Theme_Install_List_Table class + * + * @package WordPress + * @subpackage Administration + * @since 3.1.0 + */ + /** + * Core class used to implement displaying themes to install in a list table. + * + * @since 3.1.0 + * + * @see WP_Themes_List_Table + */ + class WP_Theme_Install_List_Table extends \WP_Themes_List_Table + { + public $features = array(); + /** + * @return bool + */ + public function ajax_user_can() + { + } + /** + * @global array $tabs + * @global string $tab + * @global int $paged + * @global string $type + * @global array $theme_field_defaults + * @phpstan-return void + */ + public function prepare_items() + { + } + /** + */ + public function no_items() + { + } + /** + * @global array $tabs + * @global string $tab + * @return array + */ + protected function get_views() + { + } + /** + * Displays the theme install table. + * + * Overrides the parent display() method to provide a different container. + * + * @since 3.1.0 + */ + public function display() + { + } + /** + */ + public function display_rows() + { + } + /** + * Prints a theme from the WordPress.org API. + * + * @since 3.1.0 + * + * @global array $themes_allowedtags + * + * @param stdClass $theme { + * An object that contains theme data returned by the WordPress.org API. + * + * @type string $name Theme name, e.g. 'Twenty Twenty-One'. + * @type string $slug Theme slug, e.g. 'twentytwentyone'. + * @type string $version Theme version, e.g. '1.1'. + * @type string $author Theme author username, e.g. 'melchoyce'. + * @type string $preview_url Preview URL, e.g. 'https://2021.wordpress.net/'. + * @type string $screenshot_url Screenshot URL, e.g. 'https://wordpress.org/themes/twentytwentyone/'. + * @type float $rating Rating score. + * @type int $num_ratings The number of ratings. + * @type string $homepage Theme homepage, e.g. 'https://wordpress.org/themes/twentytwentyone/'. + * @type string $description Theme description. + * @type string $download_link Theme ZIP download URL. + * } + * @phpstan-param object{ + * name?: string, + * slug?: string, + * version?: string, + * author?: string, + * preview_url?: string, + * screenshot_url?: string, + * rating?: float, + * num_ratings?: int, + * homepage?: string, + * description?: string, + * download_link?: string, + * } $theme + * @phpstan-return void + */ + public function single_row($theme) + { + } + /** + * Prints the wrapper for the theme installer. + */ + public function theme_installer() + { + } + /** + * Prints the wrapper for the theme installer with a provided theme's data. + * Used to make the theme installer work for no-js. + * + * @param stdClass $theme A WordPress.org Theme API object. + */ + public function theme_installer_single($theme) + { + } + /** + * Prints the info for a theme (to be used in the theme installer modal). + * + * @global array $themes_allowedtags + * + * @param stdClass $theme A WordPress.org Theme API object. + * @phpstan-return void + */ + public function install_theme_info($theme) + { + } + /** + * Send required variables to JavaScript land + * + * @since 3.4.0 + * + * @global string $tab Current tab within Themes->Install screen + * @global string $type Type of search. + * + * @param array $extra_args Unused. + */ + public function _js_vars($extra_args = array()) + { + } + } + /** + * List Table API: WP_Users_List_Table class + * + * @package WordPress + * @subpackage Administration + * @since 3.1.0 + */ + /** + * Core class used to implement displaying users in a list table. + * + * @since 3.1.0 + * + * @see WP_List_Table + */ + class WP_Users_List_Table extends \WP_List_Table + { + /** + * Site ID to generate the Users list table for. + * + * @since 3.1.0 + * @var int + */ + public $site_id; + /** + * Whether or not the current Users list table is for Multisite. + * + * @since 3.1.0 + * @var bool + */ + public $is_site_users; + /** + * Constructor. + * + * @since 3.1.0 + * + * @see WP_List_Table::__construct() for more information on default arguments. + * + * @param array $args An associative array of arguments. + */ + public function __construct($args = array()) + { + } + /** + * Checks the current user's permissions. + * + * @since 3.1.0 + * + * @return bool + */ + public function ajax_user_can() + { + } + /** + * Prepares the users list for display. + * + * @since 3.1.0 + * + * @global string $role + * @global string $usersearch + */ + public function prepare_items() + { + } + /** + * Outputs 'no users' message. + * + * @since 3.1.0 + */ + public function no_items() + { + } + /** + * Returns an associative array listing all the views that can be used + * with this table. + * + * Provides a list of roles and user count for that role for easy + * filtering of the user table. + * + * @since 3.1.0 + * + * @global string $role + * + * @return string[] An array of HTML links keyed by their view. + */ + protected function get_views() + { + } + /** + * Retrieves an associative array of bulk actions available on this table. + * + * @since 3.1.0 + * + * @return array Array of bulk action labels keyed by their action. + */ + protected function get_bulk_actions() + { + } + /** + * Outputs the controls to allow user roles to be changed in bulk. + * + * @since 3.1.0 + * + * @param string $which Whether this is being invoked above ("top") + * or below the table ("bottom"). + */ + protected function extra_tablenav($which) + { + } + /** + * Captures the bulk action required, and return it. + * + * Overridden from the base class implementation to capture + * the role change drop-down. + * + * @since 3.1.0 + * + * @return string The bulk action required. + */ + public function current_action() + { + } + /** + * Gets a list of columns for the list table. + * + * @since 3.1.0 + * + * @return string[] Array of column titles keyed by their column name. + */ + public function get_columns() + { + } + /** + * Gets a list of sortable columns for the list table. + * + * @since 3.1.0 + * + * @return array Array of sortable columns. + */ + protected function get_sortable_columns() + { + } + /** + * Generates the list table rows. + * + * @since 3.1.0 + */ + public function display_rows() + { + } + /** + * Generates HTML for a single row on the users.php admin panel. + * + * @since 3.1.0 + * @since 4.2.0 The `$style` parameter was deprecated. + * @since 4.4.0 The `$role` parameter was deprecated. + * + * @param WP_User $user_object The current user object. + * @param string $style Deprecated. Not used. + * @param string $role Deprecated. Not used. + * @param int $numposts Optional. Post count to display for this user. Defaults + * to zero, as in, a new user has made zero posts. + * @return string Output for a single row. + */ + public function single_row($user_object, $style = '', $role = '', $numposts = 0) + { + } + /** + * Gets the name of the default primary column. + * + * @since 4.3.0 + * + * @return string Name of the default primary column, in this case, 'username'. + */ + protected function get_default_primary_column_name() + { + } + /** + * Returns an array of translated user role names for a given user object. + * + * @since 4.4.0 + * + * @param WP_User $user_object The WP_User object. + * @return string[] An array of user role names keyed by role. + */ + protected function get_role_list($user_object) + { + } + } + /** + * WordPress User Search class. + * + * @since 2.1.0 + * @deprecated 3.1.0 Use WP_User_Query + */ + class WP_User_Search + { + /** + * {@internal Missing Description}} + * + * @since 2.1.0 + * @access private + * @var mixed + */ + var $results; + /** + * {@internal Missing Description}} + * + * @since 2.1.0 + * @access private + * @var string + */ + var $search_term; + /** + * Page number. + * + * @since 2.1.0 + * @access private + * @var int + */ + var $page; + /** + * Role name that users have. + * + * @since 2.5.0 + * @access private + * @var string + */ + var $role; + /** + * Raw page number. + * + * @since 2.1.0 + * @access private + * @var int|bool + */ + var $raw_page; + /** + * Amount of users to display per page. + * + * @since 2.1.0 + * @access public + * @var int + */ + var $users_per_page = 50; + /** + * {@internal Missing Description}} + * + * @since 2.1.0 + * @access private + * @var int + */ + var $first_user; + /** + * {@internal Missing Description}} + * + * @since 2.1.0 + * @access private + * @var int + */ + var $last_user; + /** + * {@internal Missing Description}} + * + * @since 2.1.0 + * @access private + * @var string + */ + var $query_limit; + /** + * {@internal Missing Description}} + * + * @since 3.0.0 + * @access private + * @var string + */ + var $query_orderby; + /** + * {@internal Missing Description}} + * + * @since 3.0.0 + * @access private + * @var string + */ + var $query_from; + /** + * {@internal Missing Description}} + * + * @since 3.0.0 + * @access private + * @var string + */ + var $query_where; + /** + * {@internal Missing Description}} + * + * @since 2.1.0 + * @access private + * @var int + */ + var $total_users_for_query = 0; + /** + * {@internal Missing Description}} + * + * @since 2.1.0 + * @access private + * @var bool + */ + var $too_many_total_users = \false; + /** + * {@internal Missing Description}} + * + * @since 2.1.0 + * @access private + * @var WP_Error + */ + var $search_errors; + /** + * {@internal Missing Description}} + * + * @since 2.7.0 + * @access private + * @var string + */ + var $paging_text; + /** + * PHP5 Constructor - Sets up the object properties. + * + * @since 2.1.0 + * + * @param string $search_term Search terms string. + * @param int $page Optional. Page ID. + * @param string $role Role name. + * @return WP_User_Search + */ + function __construct($search_term = '', $page = '', $role = '') + { + } + /** + * PHP4 Constructor - Sets up the object properties. + * + * @since 2.1.0 + * + * @param string $search_term Search terms string. + * @param int $page Optional. Page ID. + * @param string $role Role name. + * @return WP_User_Search + */ + public function WP_User_Search($search_term = '', $page = '', $role = '') + { + } + /** + * Prepares the user search query (legacy). + * + * @since 2.1.0 + * @access public + * + * @global wpdb $wpdb WordPress database abstraction object. + */ + public function prepare_query() + { + } + /** + * Executes the user search query. + * + * @since 2.1.0 + * @access public + * + * @global wpdb $wpdb WordPress database abstraction object. + */ + public function query() + { + } + /** + * Prepares variables for use in templates. + * + * @since 2.1.0 + * @access public + */ + function prepare_vars_for_template_usage() + { + } + /** + * Handles paging for the user search query. + * + * @since 2.1.0 + * @access public + */ + public function do_paging() + { + } + /** + * Retrieves the user search query results. + * + * @since 2.1.0 + * @access public + * + * @return array + */ + public function get_results() + { + } + /** + * Displaying paging text. + * + * @see do_paging() Builds paging text. + * + * @since 2.1.0 + * @access public + */ + function page_links() + { + } + /** + * Whether paging is enabled. + * + * @see do_paging() Builds paging text. + * + * @since 2.1.0 + * @access public + * + * @return bool + */ + function results_are_paged() + { + } + /** + * Whether there are search terms. + * + * @since 2.1.0 + * @access public + * + * @return bool + */ + function is_search() + { + } + } + /** + * Previous class for list table for privacy data export requests. + * + * @since 4.9.6 + * @deprecated 5.3.0 + */ + class WP_Privacy_Data_Export_Requests_Table extends \WP_Privacy_Data_Export_Requests_List_Table + { + function __construct($args) + { + } + } + /** + * Previous class for list table for privacy data erasure requests. + * + * @since 4.9.6 + * @deprecated 5.3.0 + */ + class WP_Privacy_Data_Removal_Requests_Table extends \WP_Privacy_Data_Removal_Requests_List_Table + { + function __construct($args) + { + } + } + class getid3_lib + { + /** + * @param string $string + * @param bool $hex + * @param bool $spaces + * @param string|bool $htmlencoding + * + * @return string + */ + public static function PrintHexBytes($string, $hex = \true, $spaces = \true, $htmlencoding = 'UTF-8') + { + } + /** + * Truncates a floating-point number at the decimal point. + * + * @param float $floatnumber + * + * @return float|int returns int (if possible, otherwise float) + */ + public static function trunc($floatnumber) + { + } + /** + * @param int|null $variable + * @param int $increment + * + * @return bool + */ + public static function safe_inc(&$variable, $increment = 1) + { + } + /** + * @param int|float $floatnum + * + * @return int|float + */ + public static function CastAsInt($floatnum) + { + } + /** + * @param int $num + * + * @return bool + */ + public static function intValueSupported($num) + { + } + /** + * Perform a division, guarding against division by zero + * + * @param float|int $numerator + * @param float|int $denominator + * @param float|int $fallback + * @return float|int + */ + public static function SafeDiv($numerator, $denominator, $fallback = 0) + { + } + /** + * @param string $fraction + * + * @return float + */ + public static function DecimalizeFraction($fraction) + { + } + /** + * @param string $binarynumerator + * + * @return float + */ + public static function DecimalBinary2Float($binarynumerator) + { + } + /** + * @link http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html + * + * @param string $binarypointnumber + * @param int $maxbits + * + * @return array + */ + public static function NormalizeBinaryPoint($binarypointnumber, $maxbits = 52) + { + } + /** + * @link http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html + * + * @param float $floatvalue + * + * @return string + */ + public static function Float2BinaryDecimal($floatvalue) + { + } + /** + * @link http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee-expl.html + * + * @param float $floatvalue + * @param int $bits + * + * @return string|false + */ + public static function Float2String($floatvalue, $bits) + { + } + /** + * @param string $byteword + * + * @return float|false + */ + public static function LittleEndian2Float($byteword) + { + } + /** + * ANSI/IEEE Standard 754-1985, Standard for Binary Floating Point Arithmetic + * + * @link https://web.archive.org/web/20120325162206/http://www.psc.edu/general/software/packages/ieee/ieee.php + * @link http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee.html + * + * @param string $byteword + * + * @return float|false + */ + public static function BigEndian2Float($byteword) + { + } + /** + * @param string $byteword + * @param bool $synchsafe + * @param bool $signed + * + * @return int|float|false + * @throws Exception + */ + public static function BigEndian2Int($byteword, $synchsafe = \false, $signed = \false) + { + } + /** + * @param string $byteword + * @param bool $signed + * + * @return int|float|false + */ + public static function LittleEndian2Int($byteword, $signed = \false) + { + } + /** + * @param string $byteword + * + * @return string + */ + public static function LittleEndian2Bin($byteword) + { + } + /** + * @param string $byteword + * + * @return string + */ + public static function BigEndian2Bin($byteword) + { + } + /** + * @param int $number + * @param int $minbytes + * @param bool $synchsafe + * @param bool $signed + * + * @return string + * @throws Exception + */ + public static function BigEndian2String($number, $minbytes = 1, $synchsafe = \false, $signed = \false) + { + } + /** + * @param int $number + * + * @return string + */ + public static function Dec2Bin($number) + { + } + /** + * @param string $binstring + * @param bool $signed + * + * @return int|float + */ + public static function Bin2Dec($binstring, $signed = \false) + { + } + /** + * @param string $binstring + * + * @return string + */ + public static function Bin2String($binstring) + { + } + /** + * @param int $number + * @param int $minbytes + * @param bool $synchsafe + * + * @return string + */ + public static function LittleEndian2String($number, $minbytes = 1, $synchsafe = \false) + { + } + /** + * @param mixed $array1 + * @param mixed $array2 + * + * @return array|false + */ + public static function array_merge_clobber($array1, $array2) + { + } + /** + * @param mixed $array1 + * @param mixed $array2 + * + * @return array|false + */ + public static function array_merge_noclobber($array1, $array2) + { + } + /** + * @param mixed $array1 + * @param mixed $array2 + * + * @return array|false|null + */ + public static function flipped_array_merge_noclobber($array1, $array2) + { + } + /** + * @param array $theArray + * + * @return bool + */ + public static function ksort_recursive(&$theArray) + { + } + /** + * @param string $filename + * @param int $numextensions + * + * @return string + */ + public static function fileextension($filename, $numextensions = 1) + { + } + /** + * @param int $seconds + * + * @return string + */ + public static function PlaytimeString($seconds) + { + } + /** + * @param int $macdate + * + * @return int|float + */ + public static function DateMac2Unix($macdate) + { + } + /** + * @param string $rawdata + * + * @return float + */ + public static function FixedPoint8_8($rawdata) + { + } + /** + * @param string $rawdata + * + * @return float + */ + public static function FixedPoint16_16($rawdata) + { + } + /** + * @param string $rawdata + * + * @return float + */ + public static function FixedPoint2_30($rawdata) + { + } + /** + * @param string $ArrayPath + * @param string $Separator + * @param mixed $Value + * + * @return array + */ + public static function CreateDeepArray($ArrayPath, $Separator, $Value) + { + } + /** + * @param array $arraydata + * @param bool $returnkey + * + * @return int|false + */ + public static function array_max($arraydata, $returnkey = \false) + { + } + /** + * @param array $arraydata + * @param bool $returnkey + * + * @return int|false + */ + public static function array_min($arraydata, $returnkey = \false) + { + } + /** + * @param string $XMLstring + * + * @return array|false + */ + public static function XML2array($XMLstring) + { + } + /** + * @param SimpleXMLElement|array|mixed $XMLobject + * + * @return mixed + */ + public static function SimpleXMLelement2array($XMLobject) + { + } + /** + * Returns checksum for a file from starting position to absolute end position. + * + * @param string $file + * @param int $offset + * @param int $end + * @param string $algorithm + * + * @return string|false + * @throws getid3_exception + */ + public static function hash_data($file, $offset, $end, $algorithm) + { + } + /** + * @param string $filename_source + * @param string $filename_dest + * @param int $offset + * @param int $length + * + * @return bool + * @throws Exception + * + * @deprecated Unused, may be removed in future versions of getID3 + */ + public static function CopyFileParts($filename_source, $filename_dest, $offset, $length) + { + } + /** + * @param int $charval + * + * @return string + */ + public static function iconv_fallback_int_utf8($charval) + { + } + /** + * ISO-8859-1 => UTF-8 + * + * @param string $string + * @param bool $bom + * + * @return string + */ + public static function iconv_fallback_iso88591_utf8($string, $bom = \false) + { + } + /** + * ISO-8859-1 => UTF-16BE + * + * @param string $string + * @param bool $bom + * + * @return string + */ + public static function iconv_fallback_iso88591_utf16be($string, $bom = \false) + { + } + /** + * ISO-8859-1 => UTF-16LE + * + * @param string $string + * @param bool $bom + * + * @return string + */ + public static function iconv_fallback_iso88591_utf16le($string, $bom = \false) + { + } + /** + * ISO-8859-1 => UTF-16LE (BOM) + * + * @param string $string + * + * @return string + */ + public static function iconv_fallback_iso88591_utf16($string) + { + } + /** + * UTF-8 => ISO-8859-1 + * + * @param string $string + * + * @return string + */ + public static function iconv_fallback_utf8_iso88591($string) + { + } + /** + * UTF-8 => UTF-16BE + * + * @param string $string + * @param bool $bom + * + * @return string + */ + public static function iconv_fallback_utf8_utf16be($string, $bom = \false) + { + } + /** + * UTF-8 => UTF-16LE + * + * @param string $string + * @param bool $bom + * + * @return string + */ + public static function iconv_fallback_utf8_utf16le($string, $bom = \false) + { + } + /** + * UTF-8 => UTF-16LE (BOM) + * + * @param string $string + * + * @return string + */ + public static function iconv_fallback_utf8_utf16($string) + { + } + /** + * UTF-16BE => UTF-8 + * + * @param string $string + * + * @return string + */ + public static function iconv_fallback_utf16be_utf8($string) + { + } + /** + * UTF-16LE => UTF-8 + * + * @param string $string + * + * @return string + */ + public static function iconv_fallback_utf16le_utf8($string) + { + } + /** + * UTF-16BE => ISO-8859-1 + * + * @param string $string + * + * @return string + */ + public static function iconv_fallback_utf16be_iso88591($string) + { + } + /** + * UTF-16LE => ISO-8859-1 + * + * @param string $string + * + * @return string + */ + public static function iconv_fallback_utf16le_iso88591($string) + { + } + /** + * UTF-16 (BOM) => ISO-8859-1 + * + * @param string $string + * + * @return string + */ + public static function iconv_fallback_utf16_iso88591($string) + { + } + /** + * UTF-16 (BOM) => UTF-8 + * + * @param string $string + * + * @return string + */ + public static function iconv_fallback_utf16_utf8($string) + { + } + /** + * @param string $in_charset + * @param string $out_charset + * @param string $string + * + * @return string + * @throws Exception + */ + public static function iconv_fallback($in_charset, $out_charset, $string) + { + } + /** + * @param mixed $data + * @param string $charset + * + * @return mixed + */ + public static function recursiveMultiByteCharString2HTML($data, $charset = 'ISO-8859-1') + { + } + /** + * @param string|int|float $string + * @param string $charset + * + * @return string + */ + public static function MultiByteCharString2HTML($string, $charset = 'ISO-8859-1') + { + } + /** + * @param int $namecode + * + * @return string + */ + public static function RGADnameLookup($namecode) + { + } + /** + * @param int $originatorcode + * + * @return string + */ + public static function RGADoriginatorLookup($originatorcode) + { + } + /** + * @param int $rawadjustment + * @param int $signbit + * + * @return float + */ + public static function RGADadjustmentLookup($rawadjustment, $signbit) + { + } + /** + * @param int $namecode + * @param int $originatorcode + * @param int $replaygain + * + * @return string + */ + public static function RGADgainString($namecode, $originatorcode, $replaygain) + { + } + /** + * @param float $amplitude + * + * @return float + */ + public static function RGADamplitude2dB($amplitude) + { + } + /** + * @param string $imgData + * @param array $imageinfo + * + * @return array|false + */ + public static function GetDataImageSize($imgData, &$imageinfo = array()) + { + } + /** + * @param string $mime_type + * + * @return string + */ + public static function ImageExtFromMime($mime_type) + { + } + /** + * @param array $ThisFileInfo + * @param bool $option_tags_html default true (just as in the main getID3 class) + * + * @return bool + */ + public static function CopyTagsToComments(&$ThisFileInfo, $option_tags_html = \true) + { + } + /** + * @param string $key + * @param int $begin + * @param int $end + * @param string $file + * @param string $name + * + * @return string + */ + public static function EmbeddedLookup($key, $begin, $end, $file, $name) + { + } + /** + * @param string $filename + * @param string $sourcefile + * @param bool $DieOnFailure + * + * @return bool + * @throws Exception + */ + public static function IncludeDependency($filename, $sourcefile, $DieOnFailure = \false) + { + } + /** + * @param string $string + * + * @return string + */ + public static function trimNullByte($string) + { + } + /** + * @param string $path + * + * @return float|bool + */ + public static function getFileSizeSyscall($path) + { + } + /** + * @param string $filename + * + * @return string|false + */ + public static function truepath($filename) + { + } + /** + * Workaround for Bug #37268 (https://bugs.php.net/bug.php?id=37268) + * + * @param string $path A path. + * @param string $suffix If the name component ends in suffix this will also be cut off. + * + * @return string + */ + public static function mb_basename($path, $suffix = '') + { + } + } + // End: Defines + class getID3 + { + /* + * Settings + */ + /** + * CASE SENSITIVE! - i.e. (must be supported by iconv()). Examples: ISO-8859-1 UTF-8 UTF-16 UTF-16BE + * + * @var string + */ + public $encoding = 'UTF-8'; + /** + * Should always be 'ISO-8859-1', but some tags may be written in other encodings such as 'EUC-CN' or 'CP1252' + * + * @var string + */ + public $encoding_id3v1 = 'ISO-8859-1'; + /** + * ID3v1 should always be 'ISO-8859-1', but some tags may be written in other encodings such as 'Windows-1251' or 'KOI8-R'. If true attempt to detect these encodings, but may return incorrect values for some tags actually in ISO-8859-1 encoding + * + * @var bool + */ + public $encoding_id3v1_autodetect = \false; + /* + * Optional tag checks - disable for speed. + */ + /** + * Read and process ID3v1 tags + * + * @var bool + */ + public $option_tag_id3v1 = \true; + /** + * Read and process ID3v2 tags + * + * @var bool + */ + public $option_tag_id3v2 = \true; + /** + * Read and process Lyrics3 tags + * + * @var bool + */ + public $option_tag_lyrics3 = \true; + /** + * Read and process APE tags + * + * @var bool + */ + public $option_tag_apetag = \true; + /** + * Copy tags to root key 'tags' and encode to $this->encoding + * + * @var bool + */ + public $option_tags_process = \true; + /** + * Copy tags to root key 'tags_html' properly translated from various encodings to HTML entities + * + * @var bool + */ + public $option_tags_html = \true; + /* + * Optional tag/comment calculations + */ + /** + * Calculate additional info such as bitrate, channelmode etc + * + * @var bool + */ + public $option_extra_info = \true; + /* + * Optional handling of embedded attachments (e.g. images) + */ + /** + * Defaults to true (ATTACHMENTS_INLINE) for backward compatibility + * + * @var bool|string + */ + public $option_save_attachments = \true; + /* + * Optional calculations + */ + /** + * Get MD5 sum of data part - slow + * + * @var bool + */ + public $option_md5_data = \false; + /** + * Use MD5 of source file if available - only FLAC and OptimFROG + * + * @var bool + */ + public $option_md5_data_source = \false; + /** + * Get SHA1 sum of data part - slow + * + * @var bool + */ + public $option_sha1_data = \false; + /** + * Check whether file is larger than 2GB and thus not supported by 32-bit PHP (null: auto-detect based on + * PHP_INT_MAX) + * + * @var bool|null + */ + public $option_max_2gb_check; + /** + * Read buffer size in bytes + * + * @var int + */ + public $option_fread_buffer_size = 32768; + // module-specific options + /** archive.rar + * if true use PHP RarArchive extension, if false (non-extension parsing not yet written in getID3) + * + * @var bool + */ + public $options_archive_rar_use_php_rar_extension = \true; + /** archive.gzip + * Optional file list - disable for speed. + * Decode gzipped files, if possible, and parse recursively (.tar.gz for example). + * + * @var bool + */ + public $options_archive_gzip_parse_contents = \false; + /** audio.midi + * if false only parse most basic information, much faster for some files but may be inaccurate + * + * @var bool + */ + public $options_audio_midi_scanwholefile = \true; + /** audio.mp3 + * Forces getID3() to scan the file byte-by-byte and log all the valid audio frame headers - extremely slow, + * unrecommended, but may provide data from otherwise-unusable files. + * + * @var bool + */ + public $options_audio_mp3_allow_bruteforce = \false; + /** audio.mp3 + * number of frames to scan to determine if MPEG-audio sequence is valid + * Lower this number to 5-20 for faster scanning + * Increase this number to 50+ for most accurate detection of valid VBR/CBR mpeg-audio streams + * + * @var int + */ + public $options_audio_mp3_mp3_valid_check_frames = 50; + /** audio.wavpack + * Avoid scanning all frames (break after finding ID_RIFF_HEADER and ID_CONFIG_BLOCK, + * significantly faster for very large files but other data may be missed + * + * @var bool + */ + public $options_audio_wavpack_quick_parsing = \false; + /** audio-video.flv + * Break out of the loop if too many frames have been scanned; only scan this + * many if meta frame does not contain useful duration. + * + * @var int + */ + public $options_audiovideo_flv_max_frames = 100000; + /** audio-video.matroska + * If true, do not return information about CLUSTER chunks, since there's a lot of them + * and they're not usually useful [default: TRUE]. + * + * @var bool + */ + public $options_audiovideo_matroska_hide_clusters = \true; + /** audio-video.matroska + * True to parse the whole file, not only header [default: FALSE]. + * + * @var bool + */ + public $options_audiovideo_matroska_parse_whole_file = \false; + /** audio-video.quicktime + * return all parsed data from all atoms if true, otherwise just returned parsed metadata + * + * @var bool + */ + public $options_audiovideo_quicktime_ReturnAtomData = \false; + /** audio-video.quicktime + * return all parsed data from all atoms if true, otherwise just returned parsed metadata + * + * @var bool + */ + public $options_audiovideo_quicktime_ParseAllPossibleAtoms = \false; + /** audio-video.swf + * return all parsed tags if true, otherwise do not return tags not parsed by getID3 + * + * @var bool + */ + public $options_audiovideo_swf_ReturnAllTagData = \false; + /** graphic.bmp + * return BMP palette + * + * @var bool + */ + public $options_graphic_bmp_ExtractPalette = \false; + /** graphic.bmp + * return image data + * + * @var bool + */ + public $options_graphic_bmp_ExtractData = \false; + /** graphic.png + * If data chunk is larger than this do not read it completely (getID3 only needs the first + * few dozen bytes for parsing). + * + * @var int + */ + public $options_graphic_png_max_data_bytes = 10000000; + /** misc.pdf + * return full details of PDF Cross-Reference Table (XREF) + * + * @var bool + */ + public $options_misc_pdf_returnXREF = \false; + /** misc.torrent + * Assume all .torrent files are less than 1MB and just read entire thing into memory for easy processing. + * Override this value if you need to process files larger than 1MB + * + * @var int + */ + public $options_misc_torrent_max_torrent_filesize = 1048576; + // Public variables + /** + * Filename of file being analysed. + * + * @var string + */ + public $filename; + /** + * Filepointer to file being analysed. + * + * @var resource + */ + public $fp; + /** + * Result array. + * + * @var array + */ + public $info; + /** + * @var string + */ + public $tempdir = \GETID3_TEMP_DIR; + /** + * @var int + */ + public $memory_limit = 0; + /** + * @var string + */ + protected $startup_error = ''; + /** + * @var string + */ + protected $startup_warning = ''; + const VERSION = '1.9.23-202310190849'; + const FREAD_BUFFER_SIZE = 32768; + const ATTACHMENTS_NONE = \false; + const ATTACHMENTS_INLINE = \true; + /** + * @throws getid3_exception + * @phpstan-return void + */ + public function __construct() + { + } + /** + * @return string + */ + public function version() + { + } + /** + * @return int + */ + public function fread_buffer_size() + { + } + /** + * @param array $optArray + * + * @return bool + */ + public function setOption($optArray) + { + } + /** + * @param string $filename + * @param int $filesize + * @param resource $fp + * + * @return bool + * + * @throws getid3_exception + */ + public function openfile($filename, $filesize = \null, $fp = \null) + { + } + /** + * analyze file + * + * @param string $filename + * @param int $filesize + * @param string $original_filename + * @param resource $fp + * + * @return array + */ + public function analyze($filename, $filesize = \null, $original_filename = '', $fp = \null) + { + } + /** + * Error handling. + * + * @param string $message + * + * @return array + */ + public function error($message) + { + } + /** + * Warning handling. + * + * @param string $message + * + * @return bool + */ + public function warning($message) + { + } + /** + * Return array containing information about all supported formats. + * + * @return array + */ + public function GetFileFormatArray() + { + } + /** + * @param string $filedata + * @param string $filename + * + * @return mixed|false + */ + public function GetFileFormat(&$filedata, $filename = '') + { + } + /** + * Converts array to $encoding charset from $this->encoding. + * + * @param array $array + * @param string $encoding + * @phpstan-return void + */ + public function CharConvert(&$array, $encoding) + { + } + /** + * @return bool + */ + public function HandleAllTags() + { + } + /** + * Calls getid3_lib::CopyTagsToComments() but passes in the option_tags_html setting from this instance of getID3 + * + * @param array $ThisFileInfo + * + * @return bool + */ + public function CopyTagsToComments(&$ThisFileInfo) + { + } + /** + * @param string $algorithm + * + * @return array|bool + */ + public function getHashdata($algorithm) + { + } + public function ChannelsBitratePlaytimeCalculations() + { + } + /** + * @return bool + */ + public function CalculateCompressionRatioVideo() + { + } + /** + * @return bool + */ + public function CalculateCompressionRatioAudio() + { + } + /** + * @return bool + */ + public function CalculateReplayGain() + { + } + /** + * @return bool + */ + public function ProcessAudioStreams() + { + } + /** + * @return string|bool + */ + public function getid3_tempnam() + { + } + /** + * @param string $name + * + * @return bool + * + * @throws getid3_exception + */ + public function include_module($name) + { + } + /** + * @param string $filename + * + * @return bool + */ + public static function is_writable($filename) + { + } + } + abstract class getid3_handler + { + /** + * @var getID3 + */ + protected $getid3; + // pointer + /** + * Analyzing filepointer or string. + * + * @var bool + */ + protected $data_string_flag = \false; + /** + * String to analyze. + * + * @var string + */ + protected $data_string = ''; + /** + * Seek position in string. + * + * @var int + */ + protected $data_string_position = 0; + /** + * String length. + * + * @var int + */ + protected $data_string_length = 0; + /** + * getid3_handler constructor. + * + * @param getID3 $getid3 + * @param string $call_module + */ + public function __construct(\getID3 $getid3, $call_module = \null) + { + } + /** + * Analyze from file pointer. + * + * @return bool + */ + public abstract function Analyze(); + /** + * Analyze from string instead. + * + * @param string $string + */ + public function AnalyzeString($string) + { + } + /** + * @param string $string + */ + public function setStringMode($string) + { + } + /** + * @phpstan-impure + * + * @return int|bool + */ + protected function ftell() + { + } + /** + * @param int $bytes + * + * @phpstan-impure + * + * @return string|false + * + * @throws getid3_exception + */ + protected function fread($bytes) + { + } + /** + * @param int $bytes + * @param int $whence + * + * @phpstan-impure + * + * @return int + * + * @throws getid3_exception + */ + protected function fseek($bytes, $whence = \SEEK_SET) + { + } + /** + * @phpstan-impure + * + * @return string|false + * + * @throws getid3_exception + */ + protected function fgets() + { + } + /** + * @phpstan-impure + * + * @return bool + */ + protected function feof() + { + } + /** + * @param string $module + * + * @return bool + */ + protected final function isDependencyFor($module) + { + } + /** + * @param string $text + * + * @return bool + */ + protected function error($text) + { + } + /** + * @param string $text + * + * @return bool + */ + protected function warning($text) + { + } + /** + * @param string $text + */ + protected function notice($text) + { + } + /** + * @param string $name + * @param int $offset + * @param int $length + * @param string $image_mime + * + * @return string|null + * + * @throws Exception + * @throws getid3_exception + */ + public function saveAttachment($name, $offset, $length, $image_mime = \null) + { + } + } + class getid3_exception extends \Exception + { + public $message; + } + class getid3_asf extends \getid3_handler + { + protected static $ASFIndexParametersObjectIndexSpecifiersIndexTypes = array(1 => 'Nearest Past Data Packet', 2 => 'Nearest Past Media Object', 3 => 'Nearest Past Cleanpoint'); + protected static $ASFMediaObjectIndexParametersObjectIndexSpecifiersIndexTypes = array(1 => 'Nearest Past Data Packet', 2 => 'Nearest Past Media Object', 3 => 'Nearest Past Cleanpoint', 0xff => 'Frame Number Offset'); + protected static $ASFTimecodeIndexParametersObjectIndexSpecifiersIndexTypes = array(2 => 'Nearest Past Media Object', 3 => 'Nearest Past Cleanpoint'); + /** + * @param getID3 $getid3 + */ + public function __construct(\getID3 $getid3) + { + } + /** + * @return bool + */ + public function Analyze() + { + } + /** + * @param int $CodecListType + * + * @return string + */ + public static function codecListObjectTypeLookup($CodecListType) + { + } + /** + * @return array + */ + public static function KnownGUIDs() + { + } + /** + * @param string $GUIDstring + * + * @return string|false + */ + public static function GUIDname($GUIDstring) + { + } + /** + * @param int $id + * + * @return string + */ + public static function ASFIndexObjectIndexTypeLookup($id) + { + } + /** + * @param string $GUIDstring + * + * @return string + */ + public static function GUIDtoBytestring($GUIDstring) + { + } + /** + * @param string $Bytestring + * + * @return string + */ + public static function BytestringToGUID($Bytestring) + { + } + /** + * @param int $FILETIME + * @param bool $round + * + * @return float|int + */ + public static function FILETIMEtoUNIXtime($FILETIME, $round = \true) + { + } + /** + * @param int $WMpictureType + * + * @return string + */ + public static function WMpictureTypeLookup($WMpictureType) + { + } + /** + * @param string $asf_header_extension_object_data + * @param int $unhandled_sections + * + * @return array + */ + public function HeaderExtensionObjectDataParse(&$asf_header_extension_object_data, &$unhandled_sections) + { + } + /** + * @param int $id + * + * @return string + */ + public static function metadataLibraryObjectDataTypeLookup($id) + { + } + /** + * @param string $data + * + * @return array + */ + public function ASF_WMpicture(&$data) + { + } + /** + * Remove terminator 00 00 and convert UTF-16LE to Latin-1. + * + * @param string $string + * + * @return string + */ + public static function TrimConvert($string) + { + } + /** + * Remove terminator 00 00. + * + * @param string $string + * + * @return string + */ + public static function TrimTerm($string) + { + } + } + class getid3_flv extends \getid3_handler + { + const magic = 'FLV'; + /** + * Break out of the loop if too many frames have been scanned; only scan this + * many if meta frame does not contain useful duration. + * + * @var int + */ + public $max_frames = 100000; + /** + * @return bool + */ + public function Analyze() + { + } + /** + * @param int $id + * + * @return string|false + */ + public static function audioFormatLookup($id) + { + } + /** + * @param int $id + * + * @return int|false + */ + public static function audioRateLookup($id) + { + } + /** + * @param int $id + * + * @return int|false + */ + public static function audioBitDepthLookup($id) + { + } + /** + * @param int $id + * + * @return string|false + */ + public static function videoCodecLookup($id) + { + } + } + class AMFStream + { + /** + * @var string + */ + public $bytes; + /** + * @var int + */ + public $pos; + /** + * @param string $bytes + */ + public function __construct(&$bytes) + { + } + /** + * @return int + */ + public function readByte() + { + } + /** + * @return int + */ + public function readInt() + { + } + /** + * @return int + */ + public function readLong() + { + } + /** + * @return float|false + */ + public function readDouble() + { + } + /** + * @return string + */ + public function readUTF() + { + } + /** + * @return string + */ + public function readLongUTF() + { + } + /** + * @param int $length + * + * @return string + */ + public function read($length) + { + } + /** + * @return int + */ + public function peekByte() + { + } + /** + * @return int + */ + public function peekInt() + { + } + /** + * @return int + */ + public function peekLong() + { + } + /** + * @return float|false + */ + public function peekDouble() + { + } + /** + * @return string + */ + public function peekUTF() + { + } + /** + * @return string + */ + public function peekLongUTF() + { + } + } + class AMFReader + { + /** + * @var AMFStream + */ + public $stream; + /** + * @param AMFStream $stream + */ + public function __construct(\AMFStream $stream) + { + } + /** + * @return mixed + */ + public function readData() + { + } + /** + * @return float|false + */ + public function readDouble() + { + } + /** + * @return bool + */ + public function readBoolean() + { + } + /** + * @return string + */ + public function readString() + { + } + /** + * @return array + */ + public function readObject() + { + } + /** + * @return array + */ + public function readMixedArray() + { + } + /** + * @return array + */ + public function readArray() + { + } + /** + * @return float|false + */ + public function readDate() + { + } + /** + * @return string + */ + public function readLongString() + { + } + /** + * @return string + */ + public function readXML() + { + } + /** + * @return array + */ + public function readTypedObject() + { + } + } + class AVCSequenceParameterSetReader + { + /** + * @var string + */ + public $sps; + public $start = 0; + public $currentBytes = 0; + public $currentBits = 0; + /** + * @var int + */ + public $width; + /** + * @var int + */ + public $height; + /** + * @param string $sps + */ + public function __construct($sps) + { + } + public function readData() + { + } + /** + * @param int $bits + */ + public function skipBits($bits) + { + } + /** + * @return int + */ + public function getBit() + { + } + /** + * @param int $bits + * + * @return int + */ + public function getBits($bits) + { + } + /** + * @return int + */ + public function expGolombUe() + { + } + /** + * @return int + */ + public function expGolombSe() + { + } + /** + * @return int + */ + public function getWidth() + { + } + /** + * @return int + */ + public function getHeight() + { + } + } + // [FD] -- Relative position of the data that should be in position of the virtual block. + /** + * @tutorial http://www.matroska.org/technical/specs/index.html + * + * @todo Rewrite EBML parser to reduce it's size and honor default element values + * @todo After rewrite implement stream size calculation, that will provide additional useful info and enable AAC/FLAC audio bitrate detection + */ + class getid3_matroska extends \getid3_handler + { + /** + * If true, do not return information about CLUSTER chunks, since there's a lot of them + * and they're not usually useful [default: TRUE]. + * + * @var bool + */ + public $hide_clusters = \true; + /** + * True to parse the whole file, not only header [default: FALSE]. + * + * @var bool + */ + public $parse_whole_file = \false; + /** + * @return bool + */ + public function Analyze() + { + } + /** + * @param int $target_type + * + * @return string|int + */ + public static function TargetTypeValue($target_type) + { + } + /** + * @param int $lacingtype + * + * @return string|int + */ + public static function BlockLacingType($lacingtype) + { + } + /** + * @param string $codecid + * + * @return string + */ + public static function CodecIDtoCommonName($codecid) + { + } + /** + * @param int $value + * + * @return string + */ + public static function displayUnit($value) + { + } + } + // needed for ISO 639-2 language code lookup + class getid3_quicktime extends \getid3_handler + { + /** audio-video.quicktime + * return all parsed data from all atoms if true, otherwise just returned parsed metadata + * + * @var bool + */ + public $ReturnAtomData = \false; + /** audio-video.quicktime + * return all parsed data from all atoms if true, otherwise just returned parsed metadata + * + * @var bool + */ + public $ParseAllPossibleAtoms = \false; + /** + * @return bool + */ + public function Analyze() + { + } + /** + * @param string $atomname + * @param int $atomsize + * @param string $atom_data + * @param int $baseoffset + * @param array $atomHierarchy + * @param bool $ParseAllPossibleAtoms + * + * @return array|false + */ + public function QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) + { + } + /** + * @param string $atom_data + * @param int $baseoffset + * @param array $atomHierarchy + * @param bool $ParseAllPossibleAtoms + * + * @return array|false + */ + public function QuicktimeParseContainerAtom($atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) + { + } + /** + * @param string $data + * @param int $offset + * + * @return int + */ + public function quicktime_read_mp4_descr_length($data, &$offset) + { + } + /** + * @param int $languageid + * + * @return string + */ + public function QuicktimeLanguageLookup($languageid) + { + } + /** + * @param string $codecid + * + * @return string + */ + public function QuicktimeVideoCodecLookup($codecid) + { + } + /** + * @param string $codecid + * + * @return mixed|string + */ + public function QuicktimeAudioCodecLookup($codecid) + { + } + /** + * @param string $compressionid + * + * @return string + */ + public function QuicktimeDCOMLookup($compressionid) + { + } + /** + * @param int $colordepthid + * + * @return string + */ + public function QuicktimeColorNameLookup($colordepthid) + { + } + /** + * @param int $stik + * + * @return string + */ + public function QuicktimeSTIKLookup($stik) + { + } + /** + * @param int $audio_profile_id + * + * @return string + */ + public function QuicktimeIODSaudioProfileName($audio_profile_id) + { + } + /** + * @param int $video_profile_id + * + * @return string + */ + public function QuicktimeIODSvideoProfileName($video_profile_id) + { + } + /** + * @param int $rtng + * + * @return string + */ + public function QuicktimeContentRatingLookup($rtng) + { + } + /** + * @param int $akid + * + * @return string + */ + public function QuicktimeStoreAccountTypeLookup($akid) + { + } + /** + * @param int $sfid + * + * @return string + */ + public function QuicktimeStoreFrontCodeLookup($sfid) + { + } + /** + * @param string $keyname + * @param string|array $data + * @param string $boxname + * + * @return bool + */ + public function CopyToAppropriateCommentsSection($keyname, $data, $boxname = '') + { + } + /** + * @param string $lstring + * @param int $count + * + * @return string + */ + public function LociString($lstring, &$count) + { + } + /** + * @param string $nullterminatedstring + * + * @return string + */ + public function NoNullString($nullterminatedstring) + { + } + /** + * @param string $pascalstring + * + * @return string + */ + public function Pascal2String($pascalstring) + { + } + /** + * @param string $pascalstring + * + * @return string + */ + public function MaybePascal2String($pascalstring) + { + } + /** + * Helper functions for m4b audiobook chapters + * code by Steffen Hartmann 2015-Nov-08. + * + * @param array $info + * @param string $tag + * @param string $history + * @param array $result + */ + public function search_tag_by_key($info, $tag, $history, &$result) + { + } + /** + * @param array $info + * @param string $k + * @param string $v + * @param string $history + * @param array $result + */ + public function search_tag_by_pair($info, $k, $v, $history, &$result) + { + } + /** + * @param array $info + * + * @return array + */ + public function quicktime_time_to_sample_table($info) + { + } + /** + * @param array $info + * + * @return int + */ + public function quicktime_bookmark_time_scale($info) + { + } + /* + // END helper functions for m4b audiobook chapters + */ + } + class getid3_riff extends \getid3_handler + { + protected $container = 'riff'; + // default + /** + * @return bool + * + * @throws getid3_exception + */ + public function Analyze() + { + } + /** + * @param int $startoffset + * @param int $maxoffset + * + * @return array|false + * + * @throws Exception + * @throws getid3_exception + */ + public function ParseRIFFAMV($startoffset, $maxoffset) + { + } + /** + * @param int $startoffset + * @param int $maxoffset + * + * @return array|false + * @throws getid3_exception + */ + public function ParseRIFF($startoffset, $maxoffset) + { + } + /** + * @param string $RIFFdata + * + * @return bool + */ + public function ParseRIFFdata(&$RIFFdata) + { + } + /** + * @param array $RIFFinfoArray + * @param array $CommentsTargetArray + * + * @return bool + */ + public static function parseComments(&$RIFFinfoArray, &$CommentsTargetArray) + { + } + /** + * @param string $WaveFormatExData + * + * @return array + */ + public static function parseWAVEFORMATex($WaveFormatExData) + { + } + /** + * @param string $WavPackChunkData + * + * @return bool + */ + public function parseWavPackHeader($WavPackChunkData) + { + } + /** + * @param string $BITMAPINFOHEADER + * @param bool $littleEndian + * + * @return array + */ + public static function ParseBITMAPINFOHEADER($BITMAPINFOHEADER, $littleEndian = \true) + { + } + /** + * @param string $DIVXTAG + * @param bool $raw + * + * @return array + */ + public static function ParseDIVXTAG($DIVXTAG, $raw = \false) + { + } + /** + * @param string $tagshortname + * + * @return string + */ + public static function waveSNDMtagLookup($tagshortname) + { + } + /** + * @param int $wFormatTag + * + * @return string + */ + public static function wFormatTagLookup($wFormatTag) + { + } + /** + * @param string $fourcc + * + * @return string + */ + public static function fourccLookup($fourcc) + { + } + } + class getid3_ac3 extends \getid3_handler + { + const syncword = 0xb77; + /** + * @return bool + */ + public function Analyze() + { + } + /** + * @param int $fscod + * + * @return int|string|false + */ + public static function sampleRateCodeLookup($fscod) + { + } + /** + * @param int $fscod2 + * + * @return int|string|false + */ + public static function sampleRateCodeLookup2($fscod2) + { + } + /** + * @param int $bsmod + * @param int $acmod + * + * @return string|false + */ + public static function serviceTypeLookup($bsmod, $acmod) + { + } + /** + * @param int $acmod + * + * @return array|false + */ + public static function audioCodingModeLookup($acmod) + { + } + /** + * @param int $cmixlev + * + * @return int|float|string|false + */ + public static function centerMixLevelLookup($cmixlev) + { + } + /** + * @param int $surmixlev + * + * @return int|float|string|false + */ + public static function surroundMixLevelLookup($surmixlev) + { + } + /** + * @param int $dsurmod + * + * @return string|false + */ + public static function dolbySurroundModeLookup($dsurmod) + { + } + /** + * @param int $acmod + * @param bool $lfeon + * + * @return array + */ + public static function channelsEnabledLookup($acmod, $lfeon) + { + } + /** + * @param int $compre + * + * @return float|int + */ + public static function heavyCompression($compre) + { + } + /** + * @param int $roomtyp + * + * @return string|false + */ + public static function roomTypeLookup($roomtyp) + { + } + /** + * @param int $frmsizecod + * @param int $fscod + * + * @return int|false + */ + public static function frameSizeLookup($frmsizecod, $fscod) + { + } + /** + * @param int $frmsizecod + * + * @return int|false + */ + public static function bitrateLookup($frmsizecod) + { + } + /** + * @param int $numblkscod + * + * @return int|false + */ + public static function blocksPerSyncFrame($numblkscod) + { + } + } + /** + * @tutorial http://wiki.multimedia.cx/index.php?title=DTS + */ + class getid3_dts extends \getid3_handler + { + /** + * Default DTS syncword used in native .cpt or .dts formats. + */ + const syncword = "\xfe\x80\x01"; + /** + * Possible syncwords indicating bitstream encoding. + */ + public static $syncwords = array( + 0 => "\xfe\x80\x01", + // raw big-endian + 1 => "\xfe\x01\x80", + // raw little-endian + 2 => "\x1f\xff\xe8\x00", + // 14-bit big-endian + 3 => "\xff\x1f\x00\xe8", + ); + // 14-bit little-endian + /** + * @return bool + */ + public function Analyze() + { + } + /** + * @param int $index + * + * @return int|string|false + */ + public static function bitrateLookup($index) + { + } + /** + * @param int $index + * + * @return int|string|false + */ + public static function sampleRateLookup($index) + { + } + /** + * @param int $index + * + * @return int|false + */ + public static function bitPerSampleLookup($index) + { + } + /** + * @param int $index + * + * @return int|false + */ + public static function numChannelsLookup($index) + { + } + /** + * @param int $index + * + * @return string + */ + public static function channelArrangementLookup($index) + { + } + /** + * @param int $index + * @param int $version + * + * @return int|false + */ + public static function dialogNormalization($index, $version) + { + } + } + /** + * @tutorial http://flac.sourceforge.net/format.html + */ + class getid3_flac extends \getid3_handler + { + const syncword = 'fLaC'; + /** + * @return bool + */ + public function Analyze() + { + } + /** + * @return bool + */ + public function parseMETAdata() + { + } + /** + * @param string $BlockData + * + * @return array + */ + public static function parseSTREAMINFOdata($BlockData) + { + } + /** + * Parse METADATA_BLOCK_PICTURE flac structure and extract attachment + * External usage: audio.ogg + * + * @return bool + */ + public function parsePICTURE() + { + } + /** + * @param int $blocktype + * + * @return string + */ + public static function metaBlockTypeLookup($blocktype) + { + } + /** + * @param int $applicationid + * + * @return string + */ + public static function applicationIDLookup($applicationid) + { + } + /** + * @param int $type_id + * + * @return string + */ + public static function pictureTypeLookup($type_id) + { + } + } + class getid3_mp3 extends \getid3_handler + { + /** + * Forces getID3() to scan the file byte-by-byte and log all the valid audio frame headers - extremely slow, + * unrecommended, but may provide data from otherwise-unusable files. + * + * @var bool + */ + public $allow_bruteforce = \false; + /** + * number of frames to scan to determine if MPEG-audio sequence is valid + * Lower this number to 5-20 for faster scanning + * Increase this number to 50+ for most accurate detection of valid VBR/CBR mpeg-audio streams + * + * @var int + */ + public $mp3_valid_check_frames = 50; + /** + * @return bool + */ + public function Analyze() + { + } + /** + * @return string + */ + public function GuessEncoderOptions() + { + } + /** + * @param int $offset + * @param array $info + * @param bool $recursivesearch + * @param bool $ScanAsCBR + * @param bool $FastMPEGheaderScan + * + * @return bool + */ + public function decodeMPEGaudioHeader($offset, &$info, $recursivesearch = \true, $ScanAsCBR = \false, $FastMPEGheaderScan = \false) + { + } + /** + * @param int $offset + * @param int $nextframetestoffset + * @param bool $ScanAsCBR + * + * @return bool + */ + public function RecursiveFrameScanning(&$offset, &$nextframetestoffset, $ScanAsCBR) + { + } + /** + * @param int $offset + * @param bool $deepscan + * + * @return int|false + */ + public function FreeFormatFrameLength($offset, $deepscan = \false) + { + } + /** + * @return bool + */ + public function getOnlyMPEGaudioInfoBruteForce() + { + } + /** + * @param int $avdataoffset + * @param bool $BitrateHistogram + * + * @return bool + */ + public function getOnlyMPEGaudioInfo($avdataoffset, $BitrateHistogram = \false) + { + } + /** + * @return array + */ + public static function MPEGaudioVersionArray() + { + } + /** + * @return array + */ + public static function MPEGaudioLayerArray() + { + } + /** + * @return array + */ + public static function MPEGaudioBitrateArray() + { + } + /** + * @return array + */ + public static function MPEGaudioFrequencyArray() + { + } + /** + * @return array + */ + public static function MPEGaudioChannelModeArray() + { + } + /** + * @return array + */ + public static function MPEGaudioModeExtensionArray() + { + } + /** + * @return array + */ + public static function MPEGaudioEmphasisArray() + { + } + /** + * @param string $head4 + * @param bool $allowBitrate15 + * + * @return bool + */ + public static function MPEGaudioHeaderBytesValid($head4, $allowBitrate15 = \false) + { + } + /** + * @param array $rawarray + * @param bool $echoerrors + * @param bool $allowBitrate15 + * + * @return bool + */ + public static function MPEGaudioHeaderValid($rawarray, $echoerrors = \false, $allowBitrate15 = \false) + { + } + /** + * @param string $Header4Bytes + * + * @return array|false + */ + public static function MPEGaudioHeaderDecode($Header4Bytes) + { + } + /** + * @param int|string $bitrate + * @param string $version + * @param string $layer + * @param bool $padding + * @param int $samplerate + * + * @return int|false + */ + public static function MPEGaudioFrameLength(&$bitrate, &$version, &$layer, $padding, &$samplerate) + { + } + /** + * @param float|int $bit_rate + * + * @return int|float|string + */ + public static function ClosestStandardMP3Bitrate($bit_rate) + { + } + /** + * @param string $version + * @param string $channelmode + * + * @return int + */ + public static function XingVBRidOffset($version, $channelmode) + { + } + /** + * @param int $VBRmethodID + * + * @return string + */ + public static function LAMEvbrMethodLookup($VBRmethodID) + { + } + /** + * @param int $StereoModeID + * + * @return string + */ + public static function LAMEmiscStereoModeLookup($StereoModeID) + { + } + /** + * @param int $SourceSampleFrequencyID + * + * @return string + */ + public static function LAMEmiscSourceSampleFrequencyLookup($SourceSampleFrequencyID) + { + } + /** + * @param int $SurroundInfoID + * + * @return string + */ + public static function LAMEsurroundInfoLookup($SurroundInfoID) + { + } + /** + * @param array $LAMEtag + * + * @return string + */ + public static function LAMEpresetUsedLookup($LAMEtag) + { + } + } + class getid3_ogg extends \getid3_handler + { + /** + * @link http://xiph.org/vorbis/doc/Vorbis_I_spec.html + * + * @return bool + */ + public function Analyze() + { + } + /** + * @param string $filedata + * @param int $filedataoffset + * @param array $oggpageinfo + * + * @return bool + */ + public function ParseVorbisPageHeader(&$filedata, &$filedataoffset, &$oggpageinfo) + { + } + /** + * @link http://tools.ietf.org/html/draft-ietf-codec-oggopus-03 + * + * @param string $filedata + * @param int $filedataoffset + * @param array $oggpageinfo + * + * @return bool + */ + public function ParseOpusPageHeader(&$filedata, &$filedataoffset, &$oggpageinfo) + { + } + /** + * @return array|false + */ + public function ParseOggPageHeader() + { + } + /** + * @link http://xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-810005 + * + * @return bool + */ + public function ParseVorbisComments() + { + } + /** + * @param int $mode + * + * @return string|null + */ + public static function SpeexBandModeLookup($mode) + { + } + /** + * @param array $OggInfoArray + * @param int $SegmentNumber + * + * @return int + */ + public static function OggPageSegmentLength($OggInfoArray, $SegmentNumber = 1) + { + } + /** + * @param int $nominal_bitrate + * + * @return float + */ + public static function get_quality_from_nominal_bitrate($nominal_bitrate) + { + } + /** + * @param int $colorspace_id + * + * @return string|null + */ + public static function TheoraColorSpace($colorspace_id) + { + } + /** + * @param int $pixelformat_id + * + * @return string|null + */ + public static function TheoraPixelFormat($pixelformat_id) + { + } + } + class getid3_apetag extends \getid3_handler + { + /** + * true: return full data for all attachments; + * false: return no data for all attachments; + * integer: return data for attachments <= than this; + * string: save as file to this directory. + * + * @var int|bool|string + */ + public $inline_attachments = \true; + public $overrideendoffset = 0; + /** + * @return bool + */ + public function Analyze() + { + } + /** + * @param string $APEheaderFooterData + * + * @return array|false + */ + public function parseAPEheaderFooter($APEheaderFooterData) + { + } + /** + * @param int $rawflagint + * + * @return array + */ + public function parseAPEtagFlags($rawflagint) + { + } + /** + * @param int $contenttypeid + * + * @return string + */ + public function APEcontentTypeFlagLookup($contenttypeid) + { + } + /** + * @param string $itemkey + * + * @return bool + */ + public function APEtagItemIsUTF8Lookup($itemkey) + { + } + } + class getid3_id3v1 extends \getid3_handler + { + /** + * @return bool + */ + public function Analyze() + { + } + /** + * @param string $str + * + * @return string + */ + public static function cutfield($str) + { + } + /** + * @param bool $allowSCMPXextended + * + * @return string[] + */ + public static function ArrayOfGenres($allowSCMPXextended = \false) + { + } + /** + * @param string $genreid + * @param bool $allowSCMPXextended + * + * @return string|false + */ + public static function LookupGenreName($genreid, $allowSCMPXextended = \true) + { + } + /** + * @param string $genre + * @param bool $allowSCMPXextended + * + * @return string|false + */ + public static function LookupGenreID($genre, $allowSCMPXextended = \false) + { + } + /** + * @param string $OriginalGenre + * + * @return string|false + */ + public static function StandardiseID3v1GenreName($OriginalGenre) + { + } + /** + * @param string $title + * @param string $artist + * @param string $album + * @param string $year + * @param int $genreid + * @param string $comment + * @param int|string $track + * + * @return string + */ + public static function GenerateID3v1Tag($title, $artist, $album, $year, $genreid, $comment, $track = '') + { + } + } + class getid3_id3v2 extends \getid3_handler + { + public $StartingOffset = 0; + /** + * @return bool + */ + public function Analyze() + { + } + /** + * @param string $genrestring + * + * @return array + */ + public function ParseID3v2GenreString($genrestring) + { + } + /** + * @param array $parsedFrame + * + * @return bool + */ + public function ParseID3v2Frame(&$parsedFrame) + { + } + /** + * @param string $data + * + * @return string + */ + public function DeUnsynchronise($data) + { + } + /** + * @param int $index + * + * @return string + */ + public function LookupExtendedHeaderRestrictionsTagSizeLimits($index) + { + } + /** + * @param int $index + * + * @return string + */ + public function LookupExtendedHeaderRestrictionsTextEncodings($index) + { + } + /** + * @param int $index + * + * @return string + */ + public function LookupExtendedHeaderRestrictionsTextFieldSize($index) + { + } + /** + * @param int $index + * + * @return string + */ + public function LookupExtendedHeaderRestrictionsImageEncoding($index) + { + } + /** + * @param int $index + * + * @return string + */ + public function LookupExtendedHeaderRestrictionsImageSizeSize($index) + { + } + /** + * @param string $currencyid + * + * @return string + */ + public function LookupCurrencyUnits($currencyid) + { + } + /** + * @param string $currencyid + * + * @return string + */ + public function LookupCurrencyCountry($currencyid) + { + } + /** + * @param string $languagecode + * @param bool $casesensitive + * + * @return string + */ + public static function LanguageLookup($languagecode, $casesensitive = \false) + { + } + /** + * @param int $index + * + * @return string + */ + public static function ETCOEventLookup($index) + { + } + /** + * @param int $index + * + * @return string + */ + public static function SYTLContentTypeLookup($index) + { + } + /** + * @param int $index + * @param bool $returnarray + * + * @return array|string + */ + public static function APICPictureTypeLookup($index, $returnarray = \false) + { + } + /** + * @param int $index + * + * @return string + */ + public static function COMRReceivedAsLookup($index) + { + } + /** + * @param int $index + * + * @return string + */ + public static function RVA2ChannelTypeLookup($index) + { + } + /** + * @param string $framename + * + * @return string + */ + public static function FrameNameLongLookup($framename) + { + } + /** + * @param string $framename + * + * @return string + */ + public static function FrameNameShortLookup($framename) + { + } + /** + * @param string $encoding + * + * @return string + */ + public static function TextEncodingTerminatorLookup($encoding) + { + } + /** + * @param int $encoding + * + * @return string + */ + public static function TextEncodingNameLookup($encoding) + { + } + /** + * @param string $string + * @param string $terminator + * + * @return string + */ + public static function RemoveStringTerminator($string, $terminator) + { + } + /** + * @param string $string + * + * @return string + */ + public static function MakeUTF16emptyStringEmpty($string) + { + } + /** + * @param string $framename + * @param int $id3v2majorversion + * + * @return bool|int + */ + public static function IsValidID3v2FrameName($framename, $id3v2majorversion) + { + } + /** + * @param string $numberstring + * @param bool $allowdecimal + * @param bool $allownegative + * + * @return bool + */ + public static function IsANumber($numberstring, $allowdecimal = \false, $allownegative = \false) + { + } + /** + * @param string $datestamp + * + * @return bool + */ + public static function IsValidDateStampString($datestamp) + { + } + /** + * @param int $majorversion + * + * @return int + */ + public static function ID3v2HeaderLength($majorversion) + { + } + /** + * @param string $frame_name + * + * @return string|false + */ + public static function ID3v22iTunesBrokenFrameName($frame_name) + { + } + } + class getid3_lyrics3 extends \getid3_handler + { + /** + * @return bool + */ + public function Analyze() + { + } + /** + * @param int $endoffset + * @param int $version + * @param int $length + * + * @return bool + */ + public function getLyrics3Data($endoffset, $version, $length) + { + } + /** + * @param string $rawtimestamp + * + * @return int|false + */ + public function Lyrics3Timestamp2Seconds($rawtimestamp) + { + } + /** + * @param array $Lyrics3data + * + * @return bool + */ + public function Lyrics3LyricsTimestampParse(&$Lyrics3data) + { + } + /** + * @param string $char + * + * @return bool|null + */ + public function IntString2Bool($char) + { + } + } + /** + * IXR_Base64 + * + * @package IXR + * @since 1.5.0 + */ + class IXR_Base64 + { + var $data; + /** + * PHP5 constructor. + */ + function __construct($data) + { + } + /** + * PHP4 constructor. + */ + public function IXR_Base64($data) + { + } + function getXml() + { + } + } + /** + * IXR_Client + * + * @package IXR + * @since 1.5.0 + * + */ + class IXR_Client + { + var $server; + var $port; + var $path; + var $useragent; + var $response; + var $message = \false; + var $debug = \false; + var $timeout; + var $headers = array(); + // Storage place for an error message + var $error = \false; + /** + * PHP5 constructor. + */ + function __construct($server, $path = \false, $port = 80, $timeout = 15) + { + } + /** + * PHP4 constructor. + */ + public function IXR_Client($server, $path = \false, $port = 80, $timeout = 15) + { + } + /** + * @since 1.5.0 + * @since 5.5.0 Formalized the existing `...$args` parameter by adding it + * to the function signature. + * + * @return bool + */ + function query(...$args) + { + } + function getResponse() + { + } + function isError() + { + } + function getErrorCode() + { + } + function getErrorMessage() + { + } + } + /** + * IXR_ClientMulticall + * + * @package IXR + * @since 1.5.0 + */ + class IXR_ClientMulticall extends \IXR_Client + { + var $calls = array(); + /** + * PHP5 constructor. + */ + function __construct($server, $path = \false, $port = 80) + { + } + /** + * PHP4 constructor. + */ + public function IXR_ClientMulticall($server, $path = \false, $port = 80) + { + } + /** + * @since 1.5.0 + * @since 5.5.0 Formalized the existing `...$args` parameter by adding it + * to the function signature. + */ + function addCall(...$args) + { + } + /** + * @since 1.5.0 + * @since 5.5.0 Formalized the existing `...$args` parameter by adding it + * to the function signature. + * + * @return bool + */ + function query(...$args) + { + } + } + /** + * IXR_Date + * + * @package IXR + * @since 1.5.0 + */ + class IXR_Date + { + var $year; + var $month; + var $day; + var $hour; + var $minute; + var $second; + var $timezone; + /** + * PHP5 constructor. + */ + function __construct($time) + { + } + /** + * PHP4 constructor. + */ + public function IXR_Date($time) + { + } + function parseTimestamp($timestamp) + { + } + function parseIso($iso) + { + } + function getIso() + { + } + function getXml() + { + } + function getTimestamp() + { + } + } + /** + * IXR_Error + * + * @package IXR + * @since 1.5.0 + */ + class IXR_Error + { + var $code; + var $message; + /** + * PHP5 constructor. + */ + function __construct($code, $message) + { + } + /** + * PHP4 constructor. + */ + public function IXR_Error($code, $message) + { + } + function getXml() + { + } + } + /** + * IXR_Server + * + * @package IXR + * @since 1.5.0 + */ + class IXR_Server + { + var $data; + var $callbacks = array(); + var $message; + var $capabilities; + /** + * PHP5 constructor. + */ + function __construct($callbacks = \false, $data = \false, $wait = \false) + { + } + /** + * PHP4 constructor. + */ + public function IXR_Server($callbacks = \false, $data = \false, $wait = \false) + { + } + function serve($data = \false) + { + } + function call($methodname, $args) + { + } + function error($error, $message = \false) + { + } + function output($xml) + { + } + function hasMethod($method) + { + } + function setCapabilities() + { + } + function getCapabilities($args) + { + } + function setCallbacks() + { + } + function listMethods($args) + { + } + function multiCall($methodcalls) + { + } + } + /** + * IXR_IntrospectionServer + * + * @package IXR + * @since 1.5.0 + */ + class IXR_IntrospectionServer extends \IXR_Server + { + var $signatures; + var $help; + /** + * PHP5 constructor. + */ + function __construct() + { + } + /** + * PHP4 constructor. + */ + public function IXR_IntrospectionServer() + { + } + function addCallback($method, $callback, $args, $help) + { + } + function call($methodname, $args) + { + } + function methodSignature($method) + { + } + function methodHelp($method) + { + } + } + /** + * IXR_MESSAGE + * + * @package IXR + * @since 1.5.0 + * + */ + class IXR_Message + { + var $message = \false; + var $messageType = \false; + // methodCall / methodResponse / fault + var $faultCode = \false; + var $faultString = \false; + var $methodName = ''; + var $params = array(); + // Current variable stacks + var $_arraystructs = array(); + // The stack used to keep track of the current array/struct + var $_arraystructstypes = array(); + // Stack keeping track of if things are structs or array + var $_currentStructName = array(); + // A stack as well + var $_param; + var $_value; + var $_currentTag; + var $_currentTagContents; + // The XML parser + var $_parser; + /** + * PHP5 constructor. + */ + function __construct($message) + { + } + /** + * PHP4 constructor. + */ + public function IXR_Message($message) + { + } + function parse() + { + } + function tag_open($parser, $tag, $attr) + { + } + function cdata($parser, $cdata) + { + } + function tag_close($parser, $tag) + { + } + } + /** + * IXR_Request + * + * @package IXR + * @since 1.5.0 + */ + class IXR_Request + { + var $method; + var $args; + var $xml; + /** + * PHP5 constructor. + */ + function __construct($method, $args) + { + } + /** + * PHP4 constructor. + */ + public function IXR_Request($method, $args) + { + } + function getLength() + { + } + function getXml() + { + } + } + /** + * IXR_Value + * + * @package IXR + * @since 1.5.0 + */ + class IXR_Value + { + var $data; + var $type; + /** + * PHP5 constructor. + */ + function __construct($data, $type = \false) + { + } + /** + * PHP4 constructor. + */ + public function IXR_Value($data, $type = \false) + { + } + function calculateType() + { + } + function getXml() + { + } + /** + * Checks whether or not the supplied array is a struct or not + * + * @param array $array + * @return bool + */ + function isStruct($array) + { + } + } +} +namespace PHPMailer\PHPMailer { + /** + * PHPMailer exception handler. + * + * @author Marcus Bointon <phpmailer@synchromedia.co.uk> + */ + class Exception extends \Exception + { + /** + * Prettify error message output. + * + * @return string + */ + public function errorMessage() + { + } + } + /** + * PHPMailer - PHP email creation and transport class. + * + * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk> + * @author Jim Jagielski (jimjag) <jimjag@gmail.com> + * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net> + * @author Brent R. Matzelle (original founder) + */ + class PHPMailer + { + const CHARSET_ASCII = 'us-ascii'; + const CHARSET_ISO88591 = 'iso-8859-1'; + const CHARSET_UTF8 = 'utf-8'; + const CONTENT_TYPE_PLAINTEXT = 'text/plain'; + const CONTENT_TYPE_TEXT_CALENDAR = 'text/calendar'; + const CONTENT_TYPE_TEXT_HTML = 'text/html'; + const CONTENT_TYPE_MULTIPART_ALTERNATIVE = 'multipart/alternative'; + const CONTENT_TYPE_MULTIPART_MIXED = 'multipart/mixed'; + const CONTENT_TYPE_MULTIPART_RELATED = 'multipart/related'; + const ENCODING_7BIT = '7bit'; + const ENCODING_8BIT = '8bit'; + const ENCODING_BASE64 = 'base64'; + const ENCODING_BINARY = 'binary'; + const ENCODING_QUOTED_PRINTABLE = 'quoted-printable'; + const ENCRYPTION_STARTTLS = 'tls'; + const ENCRYPTION_SMTPS = 'ssl'; + const ICAL_METHOD_REQUEST = 'REQUEST'; + const ICAL_METHOD_PUBLISH = 'PUBLISH'; + const ICAL_METHOD_REPLY = 'REPLY'; + const ICAL_METHOD_ADD = 'ADD'; + const ICAL_METHOD_CANCEL = 'CANCEL'; + const ICAL_METHOD_REFRESH = 'REFRESH'; + const ICAL_METHOD_COUNTER = 'COUNTER'; + const ICAL_METHOD_DECLINECOUNTER = 'DECLINECOUNTER'; + /** + * Email priority. + * Options: null (default), 1 = High, 3 = Normal, 5 = low. + * When null, the header is not set at all. + * + * @var int|null + */ + public $Priority; + /** + * The character set of the message. + * + * @var string + */ + public $CharSet = self::CHARSET_ISO88591; + /** + * The MIME Content-type of the message. + * + * @var string + */ + public $ContentType = self::CONTENT_TYPE_PLAINTEXT; + /** + * The message encoding. + * Options: "8bit", "7bit", "binary", "base64", and "quoted-printable". + * + * @var string + */ + public $Encoding = self::ENCODING_8BIT; + /** + * Holds the most recent mailer error message. + * + * @var string + */ + public $ErrorInfo = ''; + /** + * The From email address for the message. + * + * @var string + */ + public $From = ''; + /** + * The From name of the message. + * + * @var string + */ + public $FromName = ''; + /** + * The envelope sender of the message. + * This will usually be turned into a Return-Path header by the receiver, + * and is the address that bounces will be sent to. + * If not empty, will be passed via `-f` to sendmail or as the 'MAIL FROM' value over SMTP. + * + * @var string + */ + public $Sender = ''; + /** + * The Subject of the message. + * + * @var string + */ + public $Subject = ''; + /** + * An HTML or plain text message body. + * If HTML then call isHTML(true). + * + * @var string + */ + public $Body = ''; + /** + * The plain-text message body. + * This body can be read by mail clients that do not have HTML email + * capability such as mutt & Eudora. + * Clients that can read HTML will view the normal Body. + * + * @var string + */ + public $AltBody = ''; + /** + * An iCal message part body. + * Only supported in simple alt or alt_inline message types + * To generate iCal event structures, use classes like EasyPeasyICS or iCalcreator. + * + * @see http://sprain.ch/blog/downloads/php-class-easypeasyics-create-ical-files-with-php/ + * @see http://kigkonsult.se/iCalcreator/ + * + * @var string + */ + public $Ical = ''; + /** + * Value-array of "method" in Contenttype header "text/calendar" + * + * @var string[] + */ + protected static $IcalMethods = [self::ICAL_METHOD_REQUEST, self::ICAL_METHOD_PUBLISH, self::ICAL_METHOD_REPLY, self::ICAL_METHOD_ADD, self::ICAL_METHOD_CANCEL, self::ICAL_METHOD_REFRESH, self::ICAL_METHOD_COUNTER, self::ICAL_METHOD_DECLINECOUNTER]; + /** + * The complete compiled MIME message body. + * + * @var string + */ + protected $MIMEBody = ''; + /** + * The complete compiled MIME message headers. + * + * @var string + */ + protected $MIMEHeader = ''; + /** + * Extra headers that createHeader() doesn't fold in. + * + * @var string + */ + protected $mailHeader = ''; + /** + * Word-wrap the message body to this number of chars. + * Set to 0 to not wrap. A useful value here is 78, for RFC2822 section 2.1.1 compliance. + * + * @see static::STD_LINE_LENGTH + * + * @var int + */ + public $WordWrap = 0; + /** + * Which method to use to send mail. + * Options: "mail", "sendmail", or "smtp". + * + * @var string + */ + public $Mailer = 'mail'; + /** + * The path to the sendmail program. + * + * @var string + */ + public $Sendmail = '/usr/sbin/sendmail'; + /** + * Whether mail() uses a fully sendmail-compatible MTA. + * One which supports sendmail's "-oi -f" options. + * + * @var bool + */ + public $UseSendmailOptions = true; + /** + * The email address that a reading confirmation should be sent to, also known as read receipt. + * + * @var string + */ + public $ConfirmReadingTo = ''; + /** + * The hostname to use in the Message-ID header and as default HELO string. + * If empty, PHPMailer attempts to find one with, in order, + * $_SERVER['SERVER_NAME'], gethostname(), php_uname('n'), or the value + * 'localhost.localdomain'. + * + * @see PHPMailer::$Helo + * + * @var string + */ + public $Hostname = ''; + /** + * An ID to be used in the Message-ID header. + * If empty, a unique id will be generated. + * You can set your own, but it must be in the format "<id@domain>", + * as defined in RFC5322 section 3.6.4 or it will be ignored. + * + * @see https://tools.ietf.org/html/rfc5322#section-3.6.4 + * + * @var string + */ + public $MessageID = ''; + /** + * The message Date to be used in the Date header. + * If empty, the current date will be added. + * + * @var string + */ + public $MessageDate = ''; + /** + * SMTP hosts. + * Either a single hostname or multiple semicolon-delimited hostnames. + * You can also specify a different port + * for each host by using this format: [hostname:port] + * (e.g. "smtp1.example.com:25;smtp2.example.com"). + * You can also specify encryption type, for example: + * (e.g. "tls://smtp1.example.com:587;ssl://smtp2.example.com:465"). + * Hosts will be tried in order. + * + * @var string + */ + public $Host = 'localhost'; + /** + * The default SMTP server port. + * + * @var int + */ + public $Port = 25; + /** + * The SMTP HELO/EHLO name used for the SMTP connection. + * Default is $Hostname. If $Hostname is empty, PHPMailer attempts to find + * one with the same method described above for $Hostname. + * + * @see PHPMailer::$Hostname + * + * @var string + */ + public $Helo = ''; + /** + * What kind of encryption to use on the SMTP connection. + * Options: '', static::ENCRYPTION_STARTTLS, or static::ENCRYPTION_SMTPS. + * + * @var string + */ + public $SMTPSecure = ''; + /** + * Whether to enable TLS encryption automatically if a server supports it, + * even if `SMTPSecure` is not set to 'tls'. + * Be aware that in PHP >= 5.6 this requires that the server's certificates are valid. + * + * @var bool + */ + public $SMTPAutoTLS = true; + /** + * Whether to use SMTP authentication. + * Uses the Username and Password properties. + * + * @see PHPMailer::$Username + * @see PHPMailer::$Password + * + * @var bool + */ + public $SMTPAuth = false; + /** + * Options array passed to stream_context_create when connecting via SMTP. + * + * @var array + */ + public $SMTPOptions = []; + /** + * SMTP username. + * + * @var string + */ + public $Username = ''; + /** + * SMTP password. + * + * @var string + */ + public $Password = ''; + /** + * SMTP authentication type. Options are CRAM-MD5, LOGIN, PLAIN, XOAUTH2. + * If not specified, the first one from that list that the server supports will be selected. + * + * @var string + */ + public $AuthType = ''; + /** + * SMTP SMTPXClient command attibutes + * + * @var array + */ + protected $SMTPXClient = []; + /** + * An implementation of the PHPMailer OAuthTokenProvider interface. + * + * @var OAuthTokenProvider + */ + protected $oauth; + /** + * The SMTP server timeout in seconds. + * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2. + * + * @var int + */ + public $Timeout = 300; + /** + * Comma separated list of DSN notifications + * 'NEVER' under no circumstances a DSN must be returned to the sender. + * If you use NEVER all other notifications will be ignored. + * 'SUCCESS' will notify you when your mail has arrived at its destination. + * 'FAILURE' will arrive if an error occurred during delivery. + * 'DELAY' will notify you if there is an unusual delay in delivery, but the actual + * delivery's outcome (success or failure) is not yet decided. + * + * @see https://tools.ietf.org/html/rfc3461 See section 4.1 for more information about NOTIFY + */ + public $dsn = ''; + /** + * SMTP class debug output mode. + * Debug output level. + * Options: + * @see SMTP::DEBUG_OFF: No output + * @see SMTP::DEBUG_CLIENT: Client messages + * @see SMTP::DEBUG_SERVER: Client and server messages + * @see SMTP::DEBUG_CONNECTION: As SERVER plus connection status + * @see SMTP::DEBUG_LOWLEVEL: Noisy, low-level data output, rarely needed + * + * @see SMTP::$do_debug + * + * @var int + */ + public $SMTPDebug = 0; + /** + * How to handle debug output. + * Options: + * * `echo` Output plain-text as-is, appropriate for CLI + * * `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output + * * `error_log` Output to error log as configured in php.ini + * By default PHPMailer will use `echo` if run from a `cli` or `cli-server` SAPI, `html` otherwise. + * Alternatively, you can provide a callable expecting two params: a message string and the debug level: + * + * ```php + * $mail->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";}; + * ``` + * + * Alternatively, you can pass in an instance of a PSR-3 compatible logger, though only `debug` + * level output is used: + * + * ```php + * $mail->Debugoutput = new myPsr3Logger; + * ``` + * + * @see SMTP::$Debugoutput + * + * @var string|callable|\Psr\Log\LoggerInterface + */ + public $Debugoutput = 'echo'; + /** + * Whether to keep the SMTP connection open after each message. + * If this is set to true then the connection will remain open after a send, + * and closing the connection will require an explicit call to smtpClose(). + * It's a good idea to use this if you are sending multiple messages as it reduces overhead. + * See the mailing list example for how to use it. + * + * @var bool + */ + public $SMTPKeepAlive = false; + /** + * Whether to split multiple to addresses into multiple messages + * or send them all in one message. + * Only supported in `mail` and `sendmail` transports, not in SMTP. + * + * @var bool + * + * @deprecated 6.0.0 PHPMailer isn't a mailing list manager! + */ + public $SingleTo = false; + /** + * Storage for addresses when SingleTo is enabled. + * + * @var array + */ + protected $SingleToArray = []; + /** + * Whether to generate VERP addresses on send. + * Only applicable when sending via SMTP. + * + * @see https://en.wikipedia.org/wiki/Variable_envelope_return_path + * @see http://www.postfix.org/VERP_README.html Postfix VERP info + * + * @var bool + */ + public $do_verp = false; + /** + * Whether to allow sending messages with an empty body. + * + * @var bool + */ + public $AllowEmpty = false; + /** + * DKIM selector. + * + * @var string + */ + public $DKIM_selector = ''; + /** + * DKIM Identity. + * Usually the email address used as the source of the email. + * + * @var string + */ + public $DKIM_identity = ''; + /** + * DKIM passphrase. + * Used if your key is encrypted. + * + * @var string + */ + public $DKIM_passphrase = ''; + /** + * DKIM signing domain name. + * + * @example 'example.com' + * + * @var string + */ + public $DKIM_domain = ''; + /** + * DKIM Copy header field values for diagnostic use. + * + * @var bool + */ + public $DKIM_copyHeaderFields = true; + /** + * DKIM Extra signing headers. + * + * @example ['List-Unsubscribe', 'List-Help'] + * + * @var array + */ + public $DKIM_extraHeaders = []; + /** + * DKIM private key file path. + * + * @var string + */ + public $DKIM_private = ''; + /** + * DKIM private key string. + * + * If set, takes precedence over `$DKIM_private`. + * + * @var string + */ + public $DKIM_private_string = ''; + /** + * Callback Action function name. + * + * The function that handles the result of the send email action. + * It is called out by send() for each email sent. + * + * Value can be any php callable: http://www.php.net/is_callable + * + * Parameters: + * bool $result result of the send action + * array $to email addresses of the recipients + * array $cc cc email addresses + * array $bcc bcc email addresses + * string $subject the subject + * string $body the email body + * string $from email address of sender + * string $extra extra information of possible use + * "smtp_transaction_id' => last smtp transaction id + * + * @var string + */ + public $action_function = ''; + /** + * What to put in the X-Mailer header. + * Options: An empty string for PHPMailer default, whitespace/null for none, or a string to use. + * + * @var string|null + */ + public $XMailer = ''; + /** + * Which validator to use by default when validating email addresses. + * May be a callable to inject your own validator, but there are several built-in validators. + * The default validator uses PHP's FILTER_VALIDATE_EMAIL filter_var option. + * + * @see PHPMailer::validateAddress() + * + * @var string|callable + */ + public static $validator = 'php'; + /** + * An instance of the SMTP sender class. + * + * @var SMTP + */ + protected $smtp; + /** + * The array of 'to' names and addresses. + * + * @var array + */ + protected $to = []; + /** + * The array of 'cc' names and addresses. + * + * @var array + */ + protected $cc = []; + /** + * The array of 'bcc' names and addresses. + * + * @var array + */ + protected $bcc = []; + /** + * The array of reply-to names and addresses. + * + * @var array + */ + protected $ReplyTo = []; + /** + * An array of all kinds of addresses. + * Includes all of $to, $cc, $bcc. + * + * @see PHPMailer::$to + * @see PHPMailer::$cc + * @see PHPMailer::$bcc + * + * @var array + */ + protected $all_recipients = []; + /** + * An array of names and addresses queued for validation. + * In send(), valid and non duplicate entries are moved to $all_recipients + * and one of $to, $cc, or $bcc. + * This array is used only for addresses with IDN. + * + * @see PHPMailer::$to + * @see PHPMailer::$cc + * @see PHPMailer::$bcc + * @see PHPMailer::$all_recipients + * + * @var array + */ + protected $RecipientsQueue = []; + /** + * An array of reply-to names and addresses queued for validation. + * In send(), valid and non duplicate entries are moved to $ReplyTo. + * This array is used only for addresses with IDN. + * + * @see PHPMailer::$ReplyTo + * + * @var array + */ + protected $ReplyToQueue = []; + /** + * The array of attachments. + * + * @var array + */ + protected $attachment = []; + /** + * The array of custom headers. + * + * @var array + */ + protected $CustomHeader = []; + /** + * The most recent Message-ID (including angular brackets). + * + * @var string + */ + protected $lastMessageID = ''; + /** + * The message's MIME type. + * + * @var string + */ + protected $message_type = ''; + /** + * The array of MIME boundary strings. + * + * @var array + */ + protected $boundary = []; + /** + * The array of available text strings for the current language. + * + * @var array + */ + protected $language = []; + /** + * The number of errors encountered. + * + * @var int + */ + protected $error_count = 0; + /** + * The S/MIME certificate file path. + * + * @var string + */ + protected $sign_cert_file = ''; + /** + * The S/MIME key file path. + * + * @var string + */ + protected $sign_key_file = ''; + /** + * The optional S/MIME extra certificates ("CA Chain") file path. + * + * @var string + */ + protected $sign_extracerts_file = ''; + /** + * The S/MIME password for the key. + * Used only if the key is encrypted. + * + * @var string + */ + protected $sign_key_pass = ''; + /** + * Whether to throw exceptions for errors. + * + * @var bool + */ + protected $exceptions = false; + /** + * Unique ID used for message ID and boundaries. + * + * @var string + */ + protected $uniqueid = ''; + /** + * The PHPMailer Version number. + * + * @var string + */ + const VERSION = '6.9.1'; + /** + * Error severity: message only, continue processing. + * + * @var int + */ + const STOP_MESSAGE = 0; + /** + * Error severity: message, likely ok to continue processing. + * + * @var int + */ + const STOP_CONTINUE = 1; + /** + * Error severity: message, plus full stop, critical error reached. + * + * @var int + */ + const STOP_CRITICAL = 2; + /** + * The SMTP standard CRLF line break. + * If you want to change line break format, change static::$LE, not this. + */ + const CRLF = "\r\n"; + /** + * "Folding White Space" a white space string used for line folding. + */ + const FWS = ' '; + /** + * SMTP RFC standard line ending; Carriage Return, Line Feed. + * + * @var string + */ + protected static $LE = self::CRLF; + /** + * The maximum line length supported by mail(). + * + * Background: mail() will sometimes corrupt messages + * with headers longer than 65 chars, see #818. + * + * @var int + */ + const MAIL_MAX_LINE_LENGTH = 63; + /** + * The maximum line length allowed by RFC 2822 section 2.1.1. + * + * @var int + */ + const MAX_LINE_LENGTH = 998; + /** + * The lower maximum line length allowed by RFC 2822 section 2.1.1. + * This length does NOT include the line break + * 76 means that lines will be 77 or 78 chars depending on whether + * the line break format is LF or CRLF; both are valid. + * + * @var int + */ + const STD_LINE_LENGTH = 76; + /** + * Constructor. + * + * @param bool $exceptions Should we throw external exceptions? + */ + public function __construct($exceptions = null) + { + } + /** + * Destructor. + */ + public function __destruct() + { + } + /** + * Output debugging info via a user-defined method. + * Only generates output if debug output is enabled. + * + * @see PHPMailer::$Debugoutput + * @see PHPMailer::$SMTPDebug + * + * @param string $str + * @phpstan-return void + */ + protected function edebug($str) + { + } + /** + * Sets message type to HTML or plain. + * + * @param bool $isHtml True for HTML mode + */ + public function isHTML($isHtml = true) + { + } + /** + * Send messages using SMTP. + */ + public function isSMTP() + { + } + /** + * Send messages using PHP's mail() function. + */ + public function isMail() + { + } + /** + * Send messages using $Sendmail. + */ + public function isSendmail() + { + } + /** + * Send messages using qmail. + */ + public function isQmail() + { + } + /** + * Add a "To" address. + * + * @param string $address The email address to send to + * @param string $name + * + * @throws Exception + * + * @return bool true on success, false if address already used or invalid in some way + */ + public function addAddress($address, $name = '') + { + } + /** + * Add a "CC" address. + * + * @param string $address The email address to send to + * @param string $name + * + * @throws Exception + * + * @return bool true on success, false if address already used or invalid in some way + */ + public function addCC($address, $name = '') + { + } + /** + * Add a "BCC" address. + * + * @param string $address The email address to send to + * @param string $name + * + * @throws Exception + * + * @return bool true on success, false if address already used or invalid in some way + */ + public function addBCC($address, $name = '') + { + } + /** + * Add a "Reply-To" address. + * + * @param string $address The email address to reply to + * @param string $name + * + * @throws Exception + * + * @return bool true on success, false if address already used or invalid in some way + */ + public function addReplyTo($address, $name = '') + { + } + /** + * Add an address to one of the recipient arrays or to the ReplyTo array. Because PHPMailer + * can't validate addresses with an IDN without knowing the PHPMailer::$CharSet (that can still + * be modified after calling this function), addition of such addresses is delayed until send(). + * Addresses that have been added already return false, but do not throw exceptions. + * + * @param string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo' + * @param string $address The email address + * @param string $name An optional username associated with the address + * + * @throws Exception + * + * @return bool true on success, false if address already used or invalid in some way + * @phpstan-param 'to'|'cc'|'bcc'|'ReplyTo' $kind + */ + protected function addOrEnqueueAnAddress($kind, $address, $name) + { + } + /** + * Set the boundaries to use for delimiting MIME parts. + * If you override this, ensure you set all 3 boundaries to unique values. + * The default boundaries include a "=_" sequence which cannot occur in quoted-printable bodies, + * as suggested by https://www.rfc-editor.org/rfc/rfc2045#section-6.7 + * + * @return void + */ + public function setBoundaries() + { + } + /** + * Add an address to one of the recipient arrays or to the ReplyTo array. + * Addresses that have been added already return false, but do not throw exceptions. + * + * @param string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo' + * @param string $address The email address to send, resp. to reply to + * @param string $name + * + * @throws Exception + * + * @return bool true on success, false if address already used or invalid in some way + * @phpstan-param 'to'|'cc'|'bcc'|'ReplyTo' $kind + */ + protected function addAnAddress($kind, $address, $name = '') + { + } + /** + * Parse and validate a string containing one or more RFC822-style comma-separated email addresses + * of the form "display name <address>" into an array of name/address pairs. + * Uses the imap_rfc822_parse_adrlist function if the IMAP extension is available. + * Note that quotes in the name part are removed. + * + * @see http://www.andrew.cmu.edu/user/agreen1/testing/mrbs/web/Mail/RFC822.php A more careful implementation + * + * @param string $addrstr The address list string + * @param bool $useimap Whether to use the IMAP extension to parse the list + * @param string $charset The charset to use when decoding the address list string. + * + * @return array + */ + public static function parseAddresses($addrstr, $useimap = true, $charset = self::CHARSET_ISO88591) + { + } + /** + * Set the From and FromName properties. + * + * @param string $address + * @param string $name + * @param bool $auto Whether to also set the Sender address, defaults to true + * + * @throws Exception + * + * @return bool + */ + public function setFrom($address, $name = '', $auto = true) + { + } + /** + * Return the Message-ID header of the last email. + * Technically this is the value from the last time the headers were created, + * but it's also the message ID of the last sent message except in + * pathological cases. + * + * @return string + */ + public function getLastMessageID() + { + } + /** + * Check that a string looks like an email address. + * Validation patterns supported: + * * `auto` Pick best pattern automatically; + * * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0; + * * `pcre` Use old PCRE implementation; + * * `php` Use PHP built-in FILTER_VALIDATE_EMAIL; + * * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements. + * * `noregex` Don't use a regex: super fast, really dumb. + * Alternatively you may pass in a callable to inject your own validator, for example: + * + * ```php + * PHPMailer::validateAddress('user@example.com', function($address) { + * return (strpos($address, '@') !== false); + * }); + * ``` + * + * You can also set the PHPMailer::$validator static to a callable, allowing built-in methods to use your validator. + * + * @param string $address The email address to check + * @param string|callable $patternselect Which pattern to use + * + * @return bool + */ + public static function validateAddress($address, $patternselect = null) + { + } + /** + * Tells whether IDNs (Internationalized Domain Names) are supported or not. This requires the + * `intl` and `mbstring` PHP extensions. + * + * @return bool `true` if required functions for IDN support are present + */ + public static function idnSupported() + { + } + /** + * Converts IDN in given email address to its ASCII form, also known as punycode, if possible. + * Important: Address must be passed in same encoding as currently set in PHPMailer::$CharSet. + * This function silently returns unmodified address if: + * - No conversion is necessary (i.e. domain name is not an IDN, or is already in ASCII form) + * - Conversion to punycode is impossible (e.g. required PHP functions are not available) + * or fails for any reason (e.g. domain contains characters not allowed in an IDN). + * + * @see PHPMailer::$CharSet + * + * @param string $address The email address to convert + * + * @return string The encoded address in ASCII form + */ + public function punyencodeAddress($address) + { + } + /** + * Create a message and send it. + * Uses the sending method specified by $Mailer. + * + * @throws Exception + * + * @return bool false on error - See the ErrorInfo property for details of the error + */ + public function send() + { + } + /** + * Prepare a message for sending. + * + * @throws Exception + * + * @return bool + */ + public function preSend() + { + } + /** + * Actually send a message via the selected mechanism. + * + * @throws Exception + * + * @return bool + */ + public function postSend() + { + } + /** + * Send mail using the $Sendmail program. + * + * @see PHPMailer::$Sendmail + * + * @param string $header The message headers + * @param string $body The message body + * + * @throws Exception + * + * @return bool + */ + protected function sendmailSend($header, $body) + { + } + /** + * Fix CVE-2016-10033 and CVE-2016-10045 by disallowing potentially unsafe shell characters. + * Note that escapeshellarg and escapeshellcmd are inadequate for our purposes, especially on Windows. + * + * @see https://github.com/PHPMailer/PHPMailer/issues/924 CVE-2016-10045 bug report + * + * @param string $string The string to be validated + * + * @return bool + */ + protected static function isShellSafe($string) + { + } + /** + * Check whether a file path is of a permitted type. + * Used to reject URLs and phar files from functions that access local file paths, + * such as addAttachment. + * + * @param string $path A relative or absolute path to a file + * + * @return bool + */ + protected static function isPermittedPath($path) + { + } + /** + * Check whether a file path is safe, accessible, and readable. + * + * @param string $path A relative or absolute path to a file + * + * @return bool + */ + protected static function fileIsAccessible($path) + { + } + /** + * Send mail using the PHP mail() function. + * + * @see http://www.php.net/manual/en/book.mail.php + * + * @param string $header The message headers + * @param string $body The message body + * + * @throws Exception + * + * @return bool + */ + protected function mailSend($header, $body) + { + } + /** + * Get an instance to use for SMTP operations. + * Override this function to load your own SMTP implementation, + * or set one with setSMTPInstance. + * + * @return SMTP + */ + public function getSMTPInstance() + { + } + /** + * Provide an instance to use for SMTP operations. + * + * @return SMTP + */ + public function setSMTPInstance(\PHPMailer\PHPMailer\SMTP $smtp) + { + } + /** + * Provide SMTP XCLIENT attributes + * + * @param string $name Attribute name + * @param ?string $value Attribute value + * + * @return bool + */ + public function setSMTPXclientAttribute($name, $value) + { + } + /** + * Get SMTP XCLIENT attributes + * + * @return array + */ + public function getSMTPXclientAttributes() + { + } + /** + * Send mail via SMTP. + * Returns false if there is a bad MAIL FROM, RCPT, or DATA input. + * + * @see PHPMailer::setSMTPInstance() to use a different class. + * + * @uses \PHPMailer\PHPMailer\SMTP + * + * @param string $header The message headers + * @param string $body The message body + * + * @throws Exception + * + * @return bool + */ + protected function smtpSend($header, $body) + { + } + /** + * Initiate a connection to an SMTP server. + * Returns false if the operation failed. + * + * @param array $options An array of options compatible with stream_context_create() + * + * @throws Exception + * + * @uses \PHPMailer\PHPMailer\SMTP + * + * @return bool + */ + public function smtpConnect($options = null) + { + } + /** + * Close the active SMTP session if one exists. + */ + public function smtpClose() + { + } + /** + * Set the language for error messages. + * The default language is English. + * + * @param string $langcode ISO 639-1 2-character language code (e.g. French is "fr") + * Optionally, the language code can be enhanced with a 4-character + * script annotation and/or a 2-character country annotation. + * @param string $lang_path Path to the language file directory, with trailing separator (slash) + * Do not set this from user input! + * + * @return bool Returns true if the requested language was loaded, false otherwise. + */ + public function setLanguage($langcode = 'en', $lang_path = '') + { + } + /** + * Get the array of strings for the current language. + * + * @return array + */ + public function getTranslations() + { + } + /** + * Create recipient headers. + * + * @param string $type + * @param array $addr An array of recipients, + * where each recipient is a 2-element indexed array with element 0 containing an address + * and element 1 containing a name, like: + * [['joe@example.com', 'Joe User'], ['zoe@example.com', 'Zoe User']] + * + * @return string + */ + public function addrAppend($type, $addr) + { + } + /** + * Format an address for use in a message header. + * + * @param array $addr A 2-element indexed array, element 0 containing an address, element 1 containing a name like + * ['joe@example.com', 'Joe User'] + * + * @return string + */ + public function addrFormat($addr) + { + } + /** + * Word-wrap message. + * For use with mailers that do not automatically perform wrapping + * and for quoted-printable encoded messages. + * Original written by philippe. + * + * @param string $message The message to wrap + * @param int $length The line length to wrap to + * @param bool $qp_mode Whether to run in Quoted-Printable mode + * + * @return string + */ + public function wrapText($message, $length, $qp_mode = false) + { + } + /** + * Find the last character boundary prior to $maxLength in a utf-8 + * quoted-printable encoded string. + * Original written by Colin Brown. + * + * @param string $encodedText utf-8 QP text + * @param int $maxLength Find the last character boundary prior to this length + * + * @return int + */ + public function utf8CharBoundary($encodedText, $maxLength) + { + } + /** + * Apply word wrapping to the message body. + * Wraps the message body to the number of chars set in the WordWrap property. + * You should only do this to plain-text bodies as wrapping HTML tags may break them. + * This is called automatically by createBody(), so you don't need to call it yourself. + * @phpstan-return void + */ + public function setWordWrap() + { + } + /** + * Assemble message headers. + * + * @return string The assembled headers + */ + public function createHeader() + { + } + /** + * Get the message MIME type headers. + * + * @return string + */ + public function getMailMIME() + { + } + /** + * Returns the whole MIME message. + * Includes complete headers and body. + * Only valid post preSend(). + * + * @see PHPMailer::preSend() + * + * @return string + */ + public function getSentMIMEMessage() + { + } + /** + * Create a unique ID to use for boundaries. + * + * @return string + */ + protected function generateId() + { + } + /** + * Assemble the message body. + * Returns an empty string on failure. + * + * @throws Exception + * + * @return string The assembled message body + */ + public function createBody() + { + } + /** + * Get the boundaries that this message will use + * @return array + */ + public function getBoundaries() + { + } + /** + * Return the start of a message boundary. + * + * @param string $boundary + * @param string $charSet + * @param string $contentType + * @param string $encoding + * + * @return string + */ + protected function getBoundary($boundary, $charSet, $contentType, $encoding) + { + } + /** + * Return the end of a message boundary. + * + * @param string $boundary + * + * @return string + */ + protected function endBoundary($boundary) + { + } + /** + * Set the message type. + * PHPMailer only supports some preset message types, not arbitrary MIME structures. + */ + protected function setMessageType() + { + } + /** + * Format a header line. + * + * @param string $name + * @param string|int $value + * + * @return string + */ + public function headerLine($name, $value) + { + } + /** + * Return a formatted mail line. + * + * @param string $value + * + * @return string + */ + public function textLine($value) + { + } + /** + * Add an attachment from a path on the filesystem. + * Never use a user-supplied path to a file! + * Returns false if the file could not be found or read. + * Explicitly *does not* support passing URLs; PHPMailer is not an HTTP client. + * If you need to do that, fetch the resource yourself and pass it in via a local file or string. + * + * @param string $path Path to the attachment + * @param string $name Overrides the attachment name + * @param string $encoding File encoding (see $Encoding) + * @param string $type MIME type, e.g. `image/jpeg`; determined automatically from $path if not specified + * @param string $disposition Disposition to use + * + * @throws Exception + * + * @return bool + */ + public function addAttachment($path, $name = '', $encoding = self::ENCODING_BASE64, $type = '', $disposition = 'attachment') + { + } + /** + * Return the array of attachments. + * + * @return array + */ + public function getAttachments() + { + } + /** + * Attach all file, string, and binary attachments to the message. + * Returns an empty string on failure. + * + * @param string $disposition_type + * @param string $boundary + * + * @throws Exception + * + * @return string + */ + protected function attachAll($disposition_type, $boundary) + { + } + /** + * Encode a file attachment in requested format. + * Returns an empty string on failure. + * + * @param string $path The full path to the file + * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' + * + * @return string + */ + protected function encodeFile($path, $encoding = self::ENCODING_BASE64) + { + } + /** + * Encode a string in requested format. + * Returns an empty string on failure. + * + * @param string $str The text to encode + * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' + * + * @throws Exception + * + * @return string + */ + public function encodeString($str, $encoding = self::ENCODING_BASE64) + { + } + /** + * Encode a header value (not including its label) optimally. + * Picks shortest of Q, B, or none. Result includes folding if needed. + * See RFC822 definitions for phrase, comment and text positions. + * + * @param string $str The header value to encode + * @param string $position What context the string will be used in + * + * @return string + */ + public function encodeHeader($str, $position = 'text') + { + } + /** + * Check if a string contains multi-byte characters. + * + * @param string $str multi-byte text to wrap encode + * + * @return bool + */ + public function hasMultiBytes($str) + { + } + /** + * Does a string contain any 8-bit chars (in any charset)? + * + * @param string $text + * + * @return bool + */ + public function has8bitChars($text) + { + } + /** + * Encode and wrap long multibyte strings for mail headers + * without breaking lines within a character. + * Adapted from a function by paravoid. + * + * @see http://www.php.net/manual/en/function.mb-encode-mimeheader.php#60283 + * + * @param string $str multi-byte text to wrap encode + * @param string $linebreak string to use as linefeed/end-of-line + * + * @return string + */ + public function base64EncodeWrapMB($str, $linebreak = null) + { + } + /** + * Encode a string in quoted-printable format. + * According to RFC2045 section 6.7. + * + * @param string $string The text to encode + * + * @return string + */ + public function encodeQP($string) + { + } + /** + * Encode a string using Q encoding. + * + * @see http://tools.ietf.org/html/rfc2047#section-4.2 + * + * @param string $str the text to encode + * @param string $position Where the text is going to be used, see the RFC for what that means + * + * @return string + */ + public function encodeQ($str, $position = 'text') + { + } + /** + * Add a string or binary attachment (non-filesystem). + * This method can be used to attach ascii or binary data, + * such as a BLOB record from a database. + * + * @param string $string String attachment data + * @param string $filename Name of the attachment + * @param string $encoding File encoding (see $Encoding) + * @param string $type File extension (MIME) type + * @param string $disposition Disposition to use + * + * @throws Exception + * + * @return bool True on successfully adding an attachment + */ + public function addStringAttachment($string, $filename, $encoding = self::ENCODING_BASE64, $type = '', $disposition = 'attachment') + { + } + /** + * Add an embedded (inline) attachment from a file. + * This can include images, sounds, and just about any other document type. + * These differ from 'regular' attachments in that they are intended to be + * displayed inline with the message, not just attached for download. + * This is used in HTML messages that embed the images + * the HTML refers to using the `$cid` value in `img` tags, for example `<img src="cid:mylogo">`. + * Never use a user-supplied path to a file! + * + * @param string $path Path to the attachment + * @param string $cid Content ID of the attachment; Use this to reference + * the content when using an embedded image in HTML + * @param string $name Overrides the attachment filename + * @param string $encoding File encoding (see $Encoding) defaults to `base64` + * @param string $type File MIME type (by default mapped from the `$path` filename's extension) + * @param string $disposition Disposition to use: `inline` (default) or `attachment` + * (unlikely you want this – {@see `addAttachment()`} instead) + * + * @return bool True on successfully adding an attachment + * @throws Exception + * + */ + public function addEmbeddedImage($path, $cid, $name = '', $encoding = self::ENCODING_BASE64, $type = '', $disposition = 'inline') + { + } + /** + * Add an embedded stringified attachment. + * This can include images, sounds, and just about any other document type. + * If your filename doesn't contain an extension, be sure to set the $type to an appropriate MIME type. + * + * @param string $string The attachment binary data + * @param string $cid Content ID of the attachment; Use this to reference + * the content when using an embedded image in HTML + * @param string $name A filename for the attachment. If this contains an extension, + * PHPMailer will attempt to set a MIME type for the attachment. + * For example 'file.jpg' would get an 'image/jpeg' MIME type. + * @param string $encoding File encoding (see $Encoding), defaults to 'base64' + * @param string $type MIME type - will be used in preference to any automatically derived type + * @param string $disposition Disposition to use + * + * @throws Exception + * + * @return bool True on successfully adding an attachment + */ + public function addStringEmbeddedImage($string, $cid, $name = '', $encoding = self::ENCODING_BASE64, $type = '', $disposition = 'inline') + { + } + /** + * Validate encodings. + * + * @param string $encoding + * + * @return bool + */ + protected function validateEncoding($encoding) + { + } + /** + * Check if an embedded attachment is present with this cid. + * + * @param string $cid + * + * @return bool + */ + protected function cidExists($cid) + { + } + /** + * Check if an inline attachment is present. + * + * @return bool + */ + public function inlineImageExists() + { + } + /** + * Check if an attachment (non-inline) is present. + * + * @return bool + */ + public function attachmentExists() + { + } + /** + * Check if this message has an alternative body set. + * + * @return bool + */ + public function alternativeExists() + { + } + /** + * Clear queued addresses of given kind. + * + * @param string $kind 'to', 'cc', or 'bcc' + */ + public function clearQueuedAddresses($kind) + { + } + /** + * Clear all To recipients. + */ + public function clearAddresses() + { + } + /** + * Clear all CC recipients. + */ + public function clearCCs() + { + } + /** + * Clear all BCC recipients. + */ + public function clearBCCs() + { + } + /** + * Clear all ReplyTo recipients. + */ + public function clearReplyTos() + { + } + /** + * Clear all recipient types. + */ + public function clearAllRecipients() + { + } + /** + * Clear all filesystem, string, and binary attachments. + */ + public function clearAttachments() + { + } + /** + * Clear all custom headers. + */ + public function clearCustomHeaders() + { + } + /** + * Clear a specific custom header by name or name and value. + * $name value can be overloaded to contain + * both header name and value (name:value). + * + * @param string $name Custom header name + * @param string|null $value Header value + * + * @return bool True if a header was replaced successfully + */ + public function clearCustomHeader($name, $value = null) + { + } + /** + * Replace a custom header. + * $name value can be overloaded to contain + * both header name and value (name:value). + * + * @param string $name Custom header name + * @param string|null $value Header value + * + * @return bool True if a header was replaced successfully + * @throws Exception + */ + public function replaceCustomHeader($name, $value = null) + { + } + /** + * Add an error message to the error container. + * + * @param string $msg + */ + protected function setError($msg) + { + } + /** + * Return an RFC 822 formatted date. + * + * @return string + */ + public static function rfcDate() + { + } + /** + * Get the server hostname. + * Returns 'localhost.localdomain' if unknown. + * + * @return string + */ + protected function serverHostname() + { + } + /** + * Validate whether a string contains a valid value to use as a hostname or IP address. + * IPv6 addresses must include [], e.g. `[::1]`, not just `::1`. + * + * @param string $host The host name or IP address to check + * + * @return bool + */ + public static function isValidHost($host) + { + } + /** + * Get an error message in the current language. + * + * @param string $key + * + * @return string + */ + protected function lang($key) + { + } + /** + * Check if an error occurred. + * + * @return bool True if an error did occur + */ + public function isError() + { + } + /** + * Add a custom header. + * $name value can be overloaded to contain + * both header name and value (name:value). + * + * @param string $name Custom header name + * @param string|null $value Header value + * + * @return bool True if a header was set successfully + * @throws Exception + */ + public function addCustomHeader($name, $value = null) + { + } + /** + * Returns all custom headers. + * + * @return array + */ + public function getCustomHeaders() + { + } + /** + * Create a message body from an HTML string. + * Automatically inlines images and creates a plain-text version by converting the HTML, + * overwriting any existing values in Body and AltBody. + * Do not source $message content from user input! + * $basedir is prepended when handling relative URLs, e.g. <img src="/images/a.png"> and must not be empty + * will look for an image file in $basedir/images/a.png and convert it to inline. + * If you don't provide a $basedir, relative paths will be left untouched (and thus probably break in email) + * Converts data-uri images into embedded attachments. + * If you don't want to apply these transformations to your HTML, just set Body and AltBody directly. + * + * @param string $message HTML message string + * @param string $basedir Absolute path to a base directory to prepend to relative paths to images + * @param bool|callable $advanced Whether to use the internal HTML to text converter + * or your own custom converter + * @return string The transformed message body + * + * @throws Exception + * + * @see PHPMailer::html2text() + */ + public function msgHTML($message, $basedir = '', $advanced = false) + { + } + /** + * Convert an HTML string into plain text. + * This is used by msgHTML(). + * Note - older versions of this function used a bundled advanced converter + * which was removed for license reasons in #232. + * Example usage: + * + * ```php + * //Use default conversion + * $plain = $mail->html2text($html); + * //Use your own custom converter + * $plain = $mail->html2text($html, function($html) { + * $converter = new MyHtml2text($html); + * return $converter->get_text(); + * }); + * ``` + * + * @param string $html The HTML text to convert + * @param bool|callable $advanced Any boolean value to use the internal converter, + * or provide your own callable for custom conversion. + * *Never* pass user-supplied data into this parameter + * + * @return string + */ + public function html2text($html, $advanced = false) + { + } + /** + * Get the MIME type for a file extension. + * + * @param string $ext File extension + * + * @return string MIME type of file + */ + public static function _mime_types($ext = '') + { + } + /** + * Map a file name to a MIME type. + * Defaults to 'application/octet-stream', i.e.. arbitrary binary data. + * + * @param string $filename A file name or full path, does not need to exist as a file + * + * @return string + */ + public static function filenameToType($filename) + { + } + /** + * Multi-byte-safe pathinfo replacement. + * Drop-in replacement for pathinfo(), but multibyte- and cross-platform-safe. + * + * @see http://www.php.net/manual/en/function.pathinfo.php#107461 + * + * @param string $path A filename or path, does not need to exist as a file + * @param int|string $options Either a PATHINFO_* constant, + * or a string name to return only the specified piece + * + * @return string|array + */ + public static function mb_pathinfo($path, $options = null) + { + } + /** + * Set or reset instance properties. + * You should avoid this function - it's more verbose, less efficient, more error-prone and + * harder to debug than setting properties directly. + * Usage Example: + * `$mail->set('SMTPSecure', static::ENCRYPTION_STARTTLS);` + * is the same as: + * `$mail->SMTPSecure = static::ENCRYPTION_STARTTLS;`. + * + * @param string $name The property name to set + * @param mixed $value The value to set the property to + * + * @return bool + */ + public function set($name, $value = '') + { + } + /** + * Strip newlines to prevent header injection. + * + * @param string $str + * + * @return string + */ + public function secureHeader($str) + { + } + /** + * Normalize line breaks in a string. + * Converts UNIX LF, Mac CR and Windows CRLF line breaks into a single line break format. + * Defaults to CRLF (for message bodies) and preserves consecutive breaks. + * + * @param string $text + * @param string $breaktype What kind of line break to use; defaults to static::$LE + * + * @return string + */ + public static function normalizeBreaks($text, $breaktype = null) + { + } + /** + * Remove trailing whitespace from a string. + * + * @param string $text + * + * @return string The text to remove whitespace from + */ + public static function stripTrailingWSP($text) + { + } + /** + * Strip trailing line breaks from a string. + * + * @param string $text + * + * @return string The text to remove breaks from + */ + public static function stripTrailingBreaks($text) + { + } + /** + * Return the current line break format string. + * + * @return string + */ + public static function getLE() + { + } + /** + * Set the line break format string, e.g. "\r\n". + * + * @param string $le + */ + protected static function setLE($le) + { + } + /** + * Set the public and private key files and password for S/MIME signing. + * + * @param string $cert_filename + * @param string $key_filename + * @param string $key_pass Password for private key + * @param string $extracerts_filename Optional path to chain certificate + */ + public function sign($cert_filename, $key_filename, $key_pass, $extracerts_filename = '') + { + } + /** + * Quoted-Printable-encode a DKIM header. + * + * @param string $txt + * + * @return string + */ + public function DKIM_QP($txt) + { + } + /** + * Generate a DKIM signature. + * + * @param string $signHeader + * + * @throws Exception + * + * @return string The DKIM signature value + */ + public function DKIM_Sign($signHeader) + { + } + /** + * Generate a DKIM canonicalization header. + * Uses the 'relaxed' algorithm from RFC6376 section 3.4.2. + * Canonicalized headers should *always* use CRLF, regardless of mailer setting. + * + * @see https://tools.ietf.org/html/rfc6376#section-3.4.2 + * + * @param string $signHeader Header + * + * @return string + */ + public function DKIM_HeaderC($signHeader) + { + } + /** + * Generate a DKIM canonicalization body. + * Uses the 'simple' algorithm from RFC6376 section 3.4.3. + * Canonicalized bodies should *always* use CRLF, regardless of mailer setting. + * + * @see https://tools.ietf.org/html/rfc6376#section-3.4.3 + * + * @param string $body Message Body + * + * @return string + */ + public function DKIM_BodyC($body) + { + } + /** + * Create the DKIM header and body in a new message header. + * + * @param string $headers_line Header lines + * @param string $subject Subject + * @param string $body Body + * + * @throws Exception + * + * @return string + */ + public function DKIM_Add($headers_line, $subject, $body) + { + } + /** + * Detect if a string contains a line longer than the maximum line length + * allowed by RFC 2822 section 2.1.1. + * + * @param string $str + * + * @return bool + */ + public static function hasLineLongerThanMax($str) + { + } + /** + * If a string contains any "special" characters, double-quote the name, + * and escape any double quotes with a backslash. + * + * @param string $str + * + * @return string + * + * @see RFC822 3.4.1 + */ + public static function quotedString($str) + { + } + /** + * Allows for public read access to 'to' property. + * Before the send() call, queued addresses (i.e. with IDN) are not yet included. + * + * @return array + */ + public function getToAddresses() + { + } + /** + * Allows for public read access to 'cc' property. + * Before the send() call, queued addresses (i.e. with IDN) are not yet included. + * + * @return array + */ + public function getCcAddresses() + { + } + /** + * Allows for public read access to 'bcc' property. + * Before the send() call, queued addresses (i.e. with IDN) are not yet included. + * + * @return array + */ + public function getBccAddresses() + { + } + /** + * Allows for public read access to 'ReplyTo' property. + * Before the send() call, queued addresses (i.e. with IDN) are not yet included. + * + * @return array + */ + public function getReplyToAddresses() + { + } + /** + * Allows for public read access to 'all_recipients' property. + * Before the send() call, queued addresses (i.e. with IDN) are not yet included. + * + * @return array + */ + public function getAllRecipientAddresses() + { + } + /** + * Perform a callback. + * + * @param bool $isSent + * @param array $to + * @param array $cc + * @param array $bcc + * @param string $subject + * @param string $body + * @param string $from + * @param array $extra + */ + protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body, $from, $extra) + { + } + /** + * Get the OAuthTokenProvider instance. + * + * @return OAuthTokenProvider + */ + public function getOAuth() + { + } + /** + * Set an OAuthTokenProvider instance. + */ + public function setOAuth(\PHPMailer\PHPMailer\OAuthTokenProvider $oauth) + { + } + } + /** + * PHPMailer RFC821 SMTP email transport class. + * Implements RFC 821 SMTP commands and provides some utility methods for sending mail to an SMTP server. + * + * @author Chris Ryan + * @author Marcus Bointon <phpmailer@synchromedia.co.uk> + */ + class SMTP + { + /** + * The PHPMailer SMTP version number. + * + * @var string + */ + const VERSION = '6.9.1'; + /** + * SMTP line break constant. + * + * @var string + */ + const LE = "\r\n"; + /** + * The SMTP port to use if one is not specified. + * + * @var int + */ + const DEFAULT_PORT = 25; + /** + * The SMTPs port to use if one is not specified. + * + * @var int + */ + const DEFAULT_SECURE_PORT = 465; + /** + * The maximum line length allowed by RFC 5321 section 4.5.3.1.6, + * *excluding* a trailing CRLF break. + * + * @see https://tools.ietf.org/html/rfc5321#section-4.5.3.1.6 + * + * @var int + */ + const MAX_LINE_LENGTH = 998; + /** + * The maximum line length allowed for replies in RFC 5321 section 4.5.3.1.5, + * *including* a trailing CRLF line break. + * + * @see https://tools.ietf.org/html/rfc5321#section-4.5.3.1.5 + * + * @var int + */ + const MAX_REPLY_LENGTH = 512; + /** + * Debug level for no output. + * + * @var int + */ + const DEBUG_OFF = 0; + /** + * Debug level to show client -> server messages. + * + * @var int + */ + const DEBUG_CLIENT = 1; + /** + * Debug level to show client -> server and server -> client messages. + * + * @var int + */ + const DEBUG_SERVER = 2; + /** + * Debug level to show connection status, client -> server and server -> client messages. + * + * @var int + */ + const DEBUG_CONNECTION = 3; + /** + * Debug level to show all messages. + * + * @var int + */ + const DEBUG_LOWLEVEL = 4; + /** + * Debug output level. + * Options: + * * self::DEBUG_OFF (`0`) No debug output, default + * * self::DEBUG_CLIENT (`1`) Client commands + * * self::DEBUG_SERVER (`2`) Client commands and server responses + * * self::DEBUG_CONNECTION (`3`) As DEBUG_SERVER plus connection status + * * self::DEBUG_LOWLEVEL (`4`) Low-level data output, all messages. + * + * @var int + */ + public $do_debug = self::DEBUG_OFF; + /** + * How to handle debug output. + * Options: + * * `echo` Output plain-text as-is, appropriate for CLI + * * `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output + * * `error_log` Output to error log as configured in php.ini + * Alternatively, you can provide a callable expecting two params: a message string and the debug level: + * + * ```php + * $smtp->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";}; + * ``` + * + * Alternatively, you can pass in an instance of a PSR-3 compatible logger, though only `debug` + * level output is used: + * + * ```php + * $mail->Debugoutput = new myPsr3Logger; + * ``` + * + * @var string|callable|\Psr\Log\LoggerInterface + */ + public $Debugoutput = 'echo'; + /** + * Whether to use VERP. + * + * @see http://en.wikipedia.org/wiki/Variable_envelope_return_path + * @see http://www.postfix.org/VERP_README.html Info on VERP + * + * @var bool + */ + public $do_verp = false; + /** + * The timeout value for connection, in seconds. + * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2. + * This needs to be quite high to function correctly with hosts using greetdelay as an anti-spam measure. + * + * @see http://tools.ietf.org/html/rfc2821#section-4.5.3.2 + * + * @var int + */ + public $Timeout = 300; + /** + * How long to wait for commands to complete, in seconds. + * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2. + * + * @var int + */ + public $Timelimit = 300; + /** + * Patterns to extract an SMTP transaction id from reply to a DATA command. + * The first capture group in each regex will be used as the ID. + * MS ESMTP returns the message ID, which may not be correct for internal tracking. + * + * @var string[] + */ + protected $smtp_transaction_id_patterns = ['exim' => '/[\\d]{3} OK id=(.*)/', 'sendmail' => '/[\\d]{3} 2.0.0 (.*) Message/', 'postfix' => '/[\\d]{3} 2.0.0 Ok: queued as (.*)/', 'Microsoft_ESMTP' => '/[0-9]{3} 2.[\\d].0 (.*)@(?:.*) Queued mail for delivery/', 'Amazon_SES' => '/[\\d]{3} Ok (.*)/', 'SendGrid' => '/[\\d]{3} Ok: queued as (.*)/', 'CampaignMonitor' => '/[\\d]{3} 2.0.0 OK:([a-zA-Z\\d]{48})/', 'Haraka' => '/[\\d]{3} Message Queued \\((.*)\\)/', 'ZoneMTA' => '/[\\d]{3} Message queued as (.*)/', 'Mailjet' => '/[\\d]{3} OK queued as (.*)/']; + /** + * Allowed SMTP XCLIENT attributes. + * Must be allowed by the SMTP server. EHLO response is not checked. + * + * @see https://www.postfix.org/XCLIENT_README.html + * + * @var array + */ + public static $xclient_allowed_attributes = ['NAME', 'ADDR', 'PORT', 'PROTO', 'HELO', 'LOGIN', 'DESTADDR', 'DESTPORT']; + /** + * The last transaction ID issued in response to a DATA command, + * if one was detected. + * + * @var string|bool|null + */ + protected $last_smtp_transaction_id; + /** + * The socket for the server connection. + * + * @var ?resource + */ + protected $smtp_conn; + /** + * Error information, if any, for the last SMTP command. + * + * @var array + */ + protected $error = ['error' => '', 'detail' => '', 'smtp_code' => '', 'smtp_code_ex' => '']; + /** + * The reply the server sent to us for HELO. + * If null, no HELO string has yet been received. + * + * @var string|null + */ + protected $helo_rply; + /** + * The set of SMTP extensions sent in reply to EHLO command. + * Indexes of the array are extension names. + * Value at index 'HELO' or 'EHLO' (according to command that was sent) + * represents the server name. In case of HELO it is the only element of the array. + * Other values can be boolean TRUE or an array containing extension options. + * If null, no HELO/EHLO string has yet been received. + * + * @var array|null + */ + protected $server_caps; + /** + * The most recent reply received from the server. + * + * @var string + */ + protected $last_reply = ''; + /** + * Output debugging info via a user-selected method. + * + * @param string $str Debug string to output + * @param int $level The debug level of this message; see DEBUG_* constants + * + * @see SMTP::$Debugoutput + * @see SMTP::$do_debug + * @phpstan-return void + */ + protected function edebug($str, $level = 0) + { + } + /** + * Connect to an SMTP server. + * + * @param string $host SMTP server IP or host name + * @param int $port The port number to connect to + * @param int $timeout How long to wait for the connection to open + * @param array $options An array of options for stream_context_create() + * + * @return bool + */ + public function connect($host, $port = null, $timeout = 30, $options = []) + { + } + /** + * Create connection to the SMTP server. + * + * @param string $host SMTP server IP or host name + * @param int $port The port number to connect to + * @param int $timeout How long to wait for the connection to open + * @param array $options An array of options for stream_context_create() + * + * @return false|resource + */ + protected function getSMTPConnection($host, $port = null, $timeout = 30, $options = []) + { + } + /** + * Initiate a TLS (encrypted) session. + * + * @return bool + */ + public function startTLS() + { + } + /** + * Perform SMTP authentication. + * Must be run after hello(). + * + * @see hello() + * + * @param string $username The user name + * @param string $password The password + * @param string $authtype The auth type (CRAM-MD5, PLAIN, LOGIN, XOAUTH2) + * @param OAuthTokenProvider $OAuth An optional OAuthTokenProvider instance for XOAUTH2 authentication + * + * @return bool True if successfully authenticated + */ + public function authenticate($username, $password, $authtype = null, $OAuth = null) + { + } + /** + * Calculate an MD5 HMAC hash. + * Works like hash_hmac('md5', $data, $key) + * in case that function is not available. + * + * @param string $data The data to hash + * @param string $key The key to hash with + * + * @return string + */ + protected function hmac($data, $key) + { + } + /** + * Check connection state. + * + * @return bool True if connected + */ + public function connected() + { + } + /** + * Close the socket and clean up the state of the class. + * Don't use this function without first trying to use QUIT. + * + * @see quit() + */ + public function close() + { + } + /** + * Send an SMTP DATA command. + * Issues a data command and sends the msg_data to the server, + * finalizing the mail transaction. $msg_data is the message + * that is to be sent with the headers. Each header needs to be + * on a single line followed by a <CRLF> with the message headers + * and the message body being separated by an additional <CRLF>. + * Implements RFC 821: DATA <CRLF>. + * + * @param string $msg_data Message data to send + * + * @return bool + */ + public function data($msg_data) + { + } + /** + * Send an SMTP HELO or EHLO command. + * Used to identify the sending server to the receiving server. + * This makes sure that client and server are in a known state. + * Implements RFC 821: HELO <SP> <domain> <CRLF> + * and RFC 2821 EHLO. + * + * @param string $host The host name or IP to connect to + * + * @return bool + */ + public function hello($host = '') + { + } + /** + * Send an SMTP HELO or EHLO command. + * Low-level implementation used by hello(). + * + * @param string $hello The HELO string + * @param string $host The hostname to say we are + * + * @return bool + * + * @see hello() + */ + protected function sendHello($hello, $host) + { + } + /** + * Parse a reply to HELO/EHLO command to discover server extensions. + * In case of HELO, the only parameter that can be discovered is a server name. + * + * @param string $type `HELO` or `EHLO` + */ + protected function parseHelloFields($type) + { + } + /** + * Send an SMTP MAIL command. + * Starts a mail transaction from the email address specified in + * $from. Returns true if successful or false otherwise. If True + * the mail transaction is started and then one or more recipient + * commands may be called followed by a data command. + * Implements RFC 821: MAIL <SP> FROM:<reverse-path> <CRLF>. + * + * @param string $from Source address of this message + * + * @return bool + */ + public function mail($from) + { + } + /** + * Send an SMTP QUIT command. + * Closes the socket if there is no error or the $close_on_error argument is true. + * Implements from RFC 821: QUIT <CRLF>. + * + * @param bool $close_on_error Should the connection close if an error occurs? + * + * @return bool + */ + public function quit($close_on_error = true) + { + } + /** + * Send an SMTP RCPT command. + * Sets the TO argument to $toaddr. + * Returns true if the recipient was accepted false if it was rejected. + * Implements from RFC 821: RCPT <SP> TO:<forward-path> <CRLF>. + * + * @param string $address The address the message is being sent to + * @param string $dsn Comma separated list of DSN notifications. NEVER, SUCCESS, FAILURE + * or DELAY. If you specify NEVER all other notifications are ignored. + * + * @return bool + */ + public function recipient($address, $dsn = '') + { + } + /** + * Send SMTP XCLIENT command to server and check its return code. + * + * @return bool True on success + */ + public function xclient(array $vars) + { + } + /** + * Send an SMTP RSET command. + * Abort any transaction that is currently in progress. + * Implements RFC 821: RSET <CRLF>. + * + * @return bool True on success + */ + public function reset() + { + } + /** + * Send a command to an SMTP server and check its return code. + * + * @param string $command The command name - not sent to the server + * @param string $commandstring The actual command to send + * @param int|array $expect One or more expected integer success codes + * + * @return bool True on success + */ + protected function sendCommand($command, $commandstring, $expect) + { + } + /** + * Send an SMTP SAML command. + * Starts a mail transaction from the email address specified in $from. + * Returns true if successful or false otherwise. If True + * the mail transaction is started and then one or more recipient + * commands may be called followed by a data command. This command + * will send the message to the users terminal if they are logged + * in and send them an email. + * Implements RFC 821: SAML <SP> FROM:<reverse-path> <CRLF>. + * + * @param string $from The address the message is from + * + * @return bool + */ + public function sendAndMail($from) + { + } + /** + * Send an SMTP VRFY command. + * + * @param string $name The name to verify + * + * @return bool + */ + public function verify($name) + { + } + /** + * Send an SMTP NOOP command. + * Used to keep keep-alives alive, doesn't actually do anything. + * + * @return bool + */ + public function noop() + { + } + /** + * Send an SMTP TURN command. + * This is an optional command for SMTP that this class does not support. + * This method is here to make the RFC821 Definition complete for this class + * and _may_ be implemented in future. + * Implements from RFC 821: TURN <CRLF>. + * + * @return bool + */ + public function turn() + { + } + /** + * Send raw data to the server. + * + * @param string $data The data to send + * @param string $command Optionally, the command this is part of, used only for controlling debug output + * + * @return int|bool The number of bytes sent to the server or false on error + */ + public function client_send($data, $command = '') + { + } + /** + * Get the latest error. + * + * @return array + */ + public function getError() + { + } + /** + * Get SMTP extensions available on the server. + * + * @return array|null + */ + public function getServerExtList() + { + } + /** + * Get metadata about the SMTP server from its HELO/EHLO response. + * The method works in three ways, dependent on argument value and current state: + * 1. HELO/EHLO has not been sent - returns null and populates $this->error. + * 2. HELO has been sent - + * $name == 'HELO': returns server name + * $name == 'EHLO': returns boolean false + * $name == any other string: returns null and populates $this->error + * 3. EHLO has been sent - + * $name == 'HELO'|'EHLO': returns the server name + * $name == any other string: if extension $name exists, returns True + * or its options (e.g. AUTH mechanisms supported). Otherwise returns False. + * + * @param string $name Name of SMTP extension or 'HELO'|'EHLO' + * + * @return string|bool|null + */ + public function getServerExt($name) + { + } + /** + * Get the last reply from the server. + * + * @return string + */ + public function getLastReply() + { + } + /** + * Read the SMTP server's response. + * Either before eof or socket timeout occurs on the operation. + * With SMTP we can tell if we have more lines to read if the + * 4th character is '-' symbol. If it is a space then we don't + * need to read anything else. + * + * @return string + */ + protected function get_lines() + { + } + /** + * Enable or disable VERP address generation. + * + * @param bool $enabled + */ + public function setVerp($enabled = false) + { + } + /** + * Get VERP address generation mode. + * + * @return bool + */ + public function getVerp() + { + } + /** + * Set error messages and codes. + * + * @param string $message The error message + * @param string $detail Further detail on the error + * @param string $smtp_code An associated SMTP error code + * @param string $smtp_code_ex Extended SMTP code + */ + protected function setError($message, $detail = '', $smtp_code = '', $smtp_code_ex = '') + { + } + /** + * Set debug output method. + * + * @param string|callable $method The name of the mechanism to use for debugging output, or a callable to handle it + */ + public function setDebugOutput($method = 'echo') + { + } + /** + * Get debug output method. + * + * @return string + */ + public function getDebugOutput() + { + } + /** + * Set debug output level. + * + * @param int $level + */ + public function setDebugLevel($level = 0) + { + } + /** + * Get debug output level. + * + * @return int + */ + public function getDebugLevel() + { + } + /** + * Set SMTP timeout. + * + * @param int $timeout The timeout duration in seconds + */ + public function setTimeout($timeout = 0) + { + } + /** + * Get SMTP timeout. + * + * @return int + */ + public function getTimeout() + { + } + /** + * Reports an error number and string. + * + * @param int $errno The error number returned by PHP + * @param string $errmsg The error message returned by PHP + * @param string $errfile The file the error occurred in + * @param int $errline The line number the error occurred on + */ + protected function errorHandler($errno, $errmsg, $errfile = '', $errline = 0) + { + } + /** + * Extract and return the ID of the last SMTP transaction based on + * a list of patterns provided in SMTP::$smtp_transaction_id_patterns. + * Relies on the host providing the ID in response to a DATA command. + * If no reply has been received yet, it will return null. + * If no pattern was matched, it will return false. + * + * @return bool|string|null + */ + protected function recordLastTransactionID() + { + } + /** + * Get the queue/transaction ID of the last SMTP transaction + * If no reply has been received yet, it will return null. + * If no pattern was matched, it will return false. + * + * @return bool|string|null + * + * @see recordLastTransactionID() + */ + public function getLastTransactionID() + { + } + } +} +namespace WpOrg\Requests { + /** + * Authentication provider interface + * + * Implement this interface to act as an authentication provider. + * + * Parameters should be passed via the constructor where possible, as this + * makes it much easier for users to use your provider. + * + * @see \WpOrg\Requests\Hooks + * + * @package Requests\Authentication + */ + interface Auth + { + /** + * Register hooks as needed + * + * This method is called in {@see \WpOrg\Requests\Requests::request()} when the user + * has set an instance as the 'auth' option. Use this callback to register all the + * hooks you'll need. + * + * @see \WpOrg\Requests\Hooks::register() + * @param \WpOrg\Requests\Hooks $hooks Hook system + */ + public function register(\WpOrg\Requests\Hooks $hooks); + } +} +namespace WpOrg\Requests\Auth { + /** + * Basic Authentication provider + * + * Provides a handler for Basic HTTP authentication via the Authorization + * header. + * + * @package Requests\Authentication + */ + class Basic implements \WpOrg\Requests\Auth + { + /** + * Username + * + * @var string + */ + public $user; + /** + * Password + * + * @var string + */ + public $pass; + /** + * Constructor + * + * @since 2.0 Throws an `InvalidArgument` exception. + * @since 2.0 Throws an `ArgumentCount` exception instead of the Requests base `Exception. + * + * @param array|null $args Array of user and password. Must have exactly two elements + * + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed argument is not an array or null. + * @throws \WpOrg\Requests\Exception\ArgumentCount On incorrect number of array elements (`authbasicbadargs`). + * @phpstan-return void + */ + public function __construct($args = null) + { + } + /** + * Register the necessary callbacks + * + * @see \WpOrg\Requests\Auth\Basic::curl_before_send() + * @see \WpOrg\Requests\Auth\Basic::fsockopen_header() + * @param \WpOrg\Requests\Hooks $hooks Hook system + */ + public function register(\WpOrg\Requests\Hooks $hooks) + { + } + /** + * Set cURL parameters before the data is sent + * + * @param resource|\CurlHandle $handle cURL handle + */ + public function curl_before_send(&$handle) + { + } + /** + * Add extra headers to the request before sending + * + * @param string $out HTTP header string + */ + public function fsockopen_header(&$out) + { + } + /** + * Get the authentication string (user:pass) + * + * @return string + */ + public function getAuthString() + { + } + } +} +namespace WpOrg\Requests { + /** + * Autoloader for Requests for PHP. + * + * This autoloader supports the PSR-4 based Requests 2.0.0 classes in a case-sensitive manner + * as the most common server OS-es are case-sensitive and the file names are in mixed case. + * + * For the PSR-0 Requests 1.x BC-layer, requested classes will be treated case-insensitively. + * + * @package Requests + */ + final class Autoload + { + /** + * Register the autoloader. + * + * Note: the autoloader is *prepended* in the autoload queue. + * This is done to ensure that the Requests 2.0 autoloader takes precedence + * over a potentially (dependency-registered) Requests 1.x autoloader. + * + * @internal This method contains a safeguard against the autoloader being + * registered multiple times. This safeguard uses a global constant to + * (hopefully/in most cases) still function correctly, even if the + * class would be renamed. + * + * @return void + */ + public static function register() + { + } + /** + * Autoloader. + * + * @param string $class_name Name of the class name to load. + * + * @return bool Whether a class was loaded or not. + */ + public static function load($class_name) + { + } + } + /** + * Capability interface declaring the known capabilities. + * + * This is used as the authoritative source for which capabilities can be queried. + * + * @package Requests\Utilities + */ + interface Capability + { + /** + * Support for SSL. + * + * @var string + */ + const SSL = 'ssl'; + /** + * Collection of all capabilities supported in Requests. + * + * Note: this does not automatically mean that the capability will be supported for your chosen transport! + * + * @var string[] + */ + const ALL = [self::SSL]; + } + /** + * Cookie storage object + * + * @package Requests\Cookies + */ + class Cookie + { + /** + * Cookie name. + * + * @var string + */ + public $name; + /** + * Cookie value. + * + * @var string + */ + public $value; + /** + * Cookie attributes + * + * Valid keys are `'path'`, `'domain'`, `'expires'`, `'max-age'`, `'secure'` and + * `'httponly'`. + * + * @var \WpOrg\Requests\Utility\CaseInsensitiveDictionary|array Array-like object + */ + public $attributes = []; + /** + * Cookie flags + * + * Valid keys are `'creation'`, `'last-access'`, `'persistent'` and `'host-only'`. + * + * @var array + */ + public $flags = []; + /** + * Reference time for relative calculations + * + * This is used in place of `time()` when calculating Max-Age expiration and + * checking time validity. + * + * @var int + */ + public $reference_time = 0; + /** + * Create a new cookie object + * + * @param string $name The name of the cookie. + * @param string $value The value for the cookie. + * @param array|\WpOrg\Requests\Utility\CaseInsensitiveDictionary $attributes Associative array of attribute data + * @param array $flags The flags for the cookie. + * Valid keys are `'creation'`, `'last-access'`, + * `'persistent'` and `'host-only'`. + * @param int|null $reference_time Reference time for relative calculations. + * + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $name argument is not a string. + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $value argument is not a string. + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $attributes argument is not an array or iterable object with array access. + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $flags argument is not an array. + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $reference_time argument is not an integer or null. + */ + public function __construct($name, $value, $attributes = [], $flags = [], $reference_time = null) + { + } + /** + * Get the cookie value + * + * Attributes and other data can be accessed via methods. + */ + public function __toString() + { + } + /** + * Check if a cookie is expired. + * + * Checks the age against $this->reference_time to determine if the cookie + * is expired. + * + * @return boolean True if expired, false if time is valid. + */ + public function is_expired() + { + } + /** + * Check if a cookie is valid for a given URI + * + * @param \WpOrg\Requests\Iri $uri URI to check + * @return boolean Whether the cookie is valid for the given URI + */ + public function uri_matches(\WpOrg\Requests\Iri $uri) + { + } + /** + * Check if a cookie is valid for a given domain + * + * @param string $domain Domain to check + * @return boolean Whether the cookie is valid for the given domain + */ + public function domain_matches($domain) + { + } + /** + * Check if a cookie is valid for a given path + * + * From the path-match check in RFC 6265 section 5.1.4 + * + * @param string $request_path Path to check + * @return boolean Whether the cookie is valid for the given path + */ + public function path_matches($request_path) + { + } + /** + * Normalize cookie and attributes + * + * @return boolean Whether the cookie was successfully normalized + */ + public function normalize() + { + } + /** + * Parse an individual cookie attribute + * + * Handles parsing individual attributes from the cookie values. + * + * @param string $name Attribute name + * @param string|int|bool $value Attribute value (string/integer value, or true if empty/flag) + * @return mixed Value if available, or null if the attribute value is invalid (and should be skipped) + */ + protected function normalize_attribute($name, $value) + { + } + /** + * Format a cookie for a Cookie header + * + * This is used when sending cookies to a server. + * + * @return string Cookie formatted for Cookie header + */ + public function format_for_header() + { + } + /** + * Format a cookie for a Set-Cookie header + * + * This is used when sending cookies to clients. This isn't really + * applicable to client-side usage, but might be handy for debugging. + * + * @return string Cookie formatted for Set-Cookie header + */ + public function format_for_set_cookie() + { + } + /** + * Parse a cookie string into a cookie object + * + * Based on Mozilla's parsing code in Firefox and related projects, which + * is an intentional deviation from RFC 2109 and RFC 2616. RFC 6265 + * specifies some of this handling, but not in a thorough manner. + * + * @param string $cookie_header Cookie header value (from a Set-Cookie header) + * @param string $name + * @param int|null $reference_time + * @return \WpOrg\Requests\Cookie Parsed cookie object + * + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $cookie_header argument is not a string. + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $name argument is not a string. + */ + public static function parse($cookie_header, $name = '', $reference_time = null) + { + } + /** + * Parse all Set-Cookie headers from request headers + * + * @param \WpOrg\Requests\Response\Headers $headers Headers to parse from + * @param \WpOrg\Requests\Iri|null $origin URI for comparing cookie origins + * @param int|null $time Reference time for expiration calculation + * @return array + * + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $origin argument is not null or an instance of the Iri class. + */ + public static function parse_from_headers(\WpOrg\Requests\Response\Headers $headers, $origin = null, $time = null) + { + } + } +} +namespace WpOrg\Requests\Cookie { + /** + * Cookie holder object + * + * @package Requests\Cookies + */ + class Jar implements \ArrayAccess, \IteratorAggregate + { + /** + * Actual item data + * + * @var array + */ + protected $cookies = []; + /** + * Create a new jar + * + * @param array $cookies Existing cookie values + * + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed argument is not an array. + */ + public function __construct($cookies = []) + { + } + /** + * Normalise cookie data into a \WpOrg\Requests\Cookie + * + * @param string|\WpOrg\Requests\Cookie $cookie Cookie header value, possibly pre-parsed (object). + * @param string $key Optional. The name for this cookie. + * @return \WpOrg\Requests\Cookie + */ + public function normalize_cookie($cookie, $key = '') + { + } + /** + * Check if the given item exists + * + * @param string $offset Item key + * @return boolean Does the item exist? + */ + #[\ReturnTypeWillChange] + public function offsetExists($offset) + { + } + /** + * Get the value for the item + * + * @param string $offset Item key + * @return string|null Item value (null if offsetExists is false) + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + } + /** + * Set the given item + * + * @param string $offset Item name + * @param string $value Item value + * + * @throws \WpOrg\Requests\Exception On attempting to use dictionary as list (`invalidset`) + */ + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value) + { + } + /** + * Unset the given header + * + * @param string $offset The key for the item to unset. + */ + #[\ReturnTypeWillChange] + public function offsetUnset($offset) + { + } + /** + * Get an iterator for the data + * + * @return \ArrayIterator + */ + #[\ReturnTypeWillChange] + public function getIterator() + { + } + /** + * Register the cookie handler with the request's hooking system + * + * @param \WpOrg\Requests\HookManager $hooks Hooking system + */ + public function register(\WpOrg\Requests\HookManager $hooks) + { + } + /** + * Add Cookie header to a request if we have any + * + * As per RFC 6265, cookies are separated by '; ' + * + * @param string $url + * @param array $headers + * @param array $data + * @param string $type + * @param array $options + */ + public function before_request($url, &$headers, &$data, &$type, &$options) + { + } + /** + * Parse all cookies from a response and attach them to the response + * + * @param \WpOrg\Requests\Response $response Response as received. + */ + public function before_redirect_check(\WpOrg\Requests\Response $response) + { + } + } +} +namespace WpOrg\Requests { + /** + * Exception for HTTP requests + * + * @package Requests\Exceptions + */ + class Exception extends \Exception + { + /** + * Type of exception + * + * @var string + */ + protected $type; + /** + * Data associated with the exception + * + * @var mixed + */ + protected $data; + /** + * Create a new exception + * + * @param string $message Exception message + * @param string $type Exception type + * @param mixed $data Associated data + * @param integer $code Exception numerical code, if applicable + */ + public function __construct($message, $type, $data = null, $code = 0) + { + } + /** + * Like {@see \Exception::getCode()}, but a string code. + * + * @codeCoverageIgnore + * @return string + */ + public function getType() + { + } + /** + * Gives any relevant data + * + * @codeCoverageIgnore + * @return mixed + */ + public function getData() + { + } + } +} +namespace WpOrg\Requests\Exception { + /** + * Exception for when an incorrect number of arguments are passed to a method. + * + * Typically, this exception is used when all arguments for a method are optional, + * but certain arguments need to be passed together, i.e. a method which can be called + * with no arguments or with two arguments, but not with one argument. + * + * Along the same lines, this exception is also used if a method expects an array + * with a certain number of elements and the provided number of elements does not comply. + * + * @package Requests\Exceptions + * @since 2.0.0 + */ + final class ArgumentCount extends \WpOrg\Requests\Exception + { + /** + * Create a new argument count exception with a standardized text. + * + * @param string $expected The argument count expected as a phrase. + * For example: `at least 2 arguments` or `exactly 1 argument`. + * @param int $received The actual argument count received. + * @param string $type Exception type. + * + * @return \WpOrg\Requests\Exception\ArgumentCount + */ + public static function create($expected, $received, $type) + { + } + } + /** + * Exception based on HTTP response + * + * @package Requests\Exceptions + */ + class Http extends \WpOrg\Requests\Exception + { + /** + * HTTP status code + * + * @var integer + */ + protected $code = 0; + /** + * Reason phrase + * + * @var string + */ + protected $reason = 'Unknown'; + /** + * Create a new exception + * + * There is no mechanism to pass in the status code, as this is set by the + * subclass used. Reason phrases can vary, however. + * + * @param string|null $reason Reason phrase + * @param mixed $data Associated data + */ + public function __construct($reason = null, $data = null) + { + } + /** + * Get the status message. + * + * @return string + */ + public function getReason() + { + } + /** + * Get the correct exception class for a given error code + * + * @param int|bool $code HTTP status code, or false if unavailable + * @return string Exception class name to use + */ + public static function get_class($code) + { + } + } +} +namespace WpOrg\Requests\Exception\Http { + /** + * Exception for 304 Not Modified responses + * + * @package Requests\Exceptions + */ + final class Status304 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 305 Use Proxy responses + * + * @package Requests\Exceptions + */ + final class Status305 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 306 Switch Proxy responses + * + * @package Requests\Exceptions + */ + final class Status306 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 400 Bad Request responses + * + * @package Requests\Exceptions + */ + final class Status400 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 401 Unauthorized responses + * + * @package Requests\Exceptions + */ + final class Status401 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 402 Payment Required responses + * + * @package Requests\Exceptions + */ + final class Status402 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 403 Forbidden responses + * + * @package Requests\Exceptions + */ + final class Status403 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 404 Not Found responses + * + * @package Requests\Exceptions + */ + final class Status404 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 405 Method Not Allowed responses + * + * @package Requests\Exceptions + */ + final class Status405 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 406 Not Acceptable responses + * + * @package Requests\Exceptions + */ + final class Status406 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 407 Proxy Authentication Required responses + * + * @package Requests\Exceptions + */ + final class Status407 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 408 Request Timeout responses + * + * @package Requests\Exceptions + */ + final class Status408 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 409 Conflict responses + * + * @package Requests\Exceptions + */ + final class Status409 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 410 Gone responses + * + * @package Requests\Exceptions + */ + final class Status410 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 411 Length Required responses + * + * @package Requests\Exceptions + */ + final class Status411 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 412 Precondition Failed responses + * + * @package Requests\Exceptions + */ + final class Status412 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 413 Request Entity Too Large responses + * + * @package Requests\Exceptions + */ + final class Status413 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 414 Request-URI Too Large responses + * + * @package Requests\Exceptions + */ + final class Status414 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 415 Unsupported Media Type responses + * + * @package Requests\Exceptions + */ + final class Status415 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 416 Requested Range Not Satisfiable responses + * + * @package Requests\Exceptions + */ + final class Status416 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 417 Expectation Failed responses + * + * @package Requests\Exceptions + */ + final class Status417 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 418 I'm A Teapot responses + * + * @link https://tools.ietf.org/html/rfc2324 + * + * @package Requests\Exceptions + */ + final class Status418 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 428 Precondition Required responses + * + * @link https://tools.ietf.org/html/rfc6585 + * + * @package Requests\Exceptions + */ + final class Status428 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 429 Too Many Requests responses + * + * @link https://tools.ietf.org/html/draft-nottingham-http-new-status-04 + * + * @package Requests\Exceptions + */ + final class Status429 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 431 Request Header Fields Too Large responses + * + * @link https://tools.ietf.org/html/rfc6585 + * + * @package Requests\Exceptions + */ + final class Status431 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 500 Internal Server Error responses + * + * @package Requests\Exceptions + */ + final class Status500 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 501 Not Implemented responses + * + * @package Requests\Exceptions + */ + final class Status501 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 502 Bad Gateway responses + * + * @package Requests\Exceptions + */ + final class Status502 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 503 Service Unavailable responses + * + * @package Requests\Exceptions + */ + final class Status503 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 504 Gateway Timeout responses + * + * @package Requests\Exceptions + */ + final class Status504 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 505 HTTP Version Not Supported responses + * + * @package Requests\Exceptions + */ + final class Status505 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for 511 Network Authentication Required responses + * + * @link https://tools.ietf.org/html/rfc6585 + * + * @package Requests\Exceptions + */ + final class Status511 extends \WpOrg\Requests\Exception\Http + { + } + /** + * Exception for unknown status responses + * + * @package Requests\Exceptions + */ + final class StatusUnknown extends \WpOrg\Requests\Exception\Http + { + /** + * Create a new exception + * + * If `$data` is an instance of {@see \WpOrg\Requests\Response}, uses the status + * code from it. Otherwise, sets as 0 + * + * @param string|null $reason Reason phrase + * @param mixed $data Associated data + */ + public function __construct($reason = null, $data = null) + { + } + } +} +namespace WpOrg\Requests\Exception { + /** + * Exception for an invalid argument passed. + * + * @package Requests\Exceptions + * @since 2.0.0 + */ + final class InvalidArgument extends \InvalidArgumentException + { + /** + * Create a new invalid argument exception with a standardized text. + * + * @param int $position The argument position in the function signature. 1-based. + * @param string $name The argument name in the function signature. + * @param string $expected The argument type expected as a string. + * @param string $received The actual argument type received. + * + * @return \WpOrg\Requests\Exception\InvalidArgument + */ + public static function create($position, $name, $expected, $received) + { + } + } + /** + * Transport Exception + * + * @package Requests\Exceptions + */ + class Transport extends \WpOrg\Requests\Exception + { + } +} +namespace WpOrg\Requests\Exception\Transport { + /** + * CURL Transport Exception. + * + * @package Requests\Exceptions + */ + final class Curl extends \WpOrg\Requests\Exception\Transport + { + const EASY = 'cURLEasy'; + const MULTI = 'cURLMulti'; + const SHARE = 'cURLShare'; + /** + * Create a new exception. + * + * @param string $message Exception message. + * @param string $type Exception type. + * @param mixed $data Associated data, if applicable. + * @param int $code Exception numerical code, if applicable. + */ + public function __construct($message, $type, $data = null, $code = 0) + { + } + /** + * Get the error message. + * + * @return string + */ + public function getReason() + { + } + } +} +namespace WpOrg\Requests { + /** + * Event dispatcher + * + * @package Requests\EventDispatcher + */ + interface HookManager + { + /** + * Register a callback for a hook + * + * @param string $hook Hook name + * @param callable $callback Function/method to call on event + * @param int $priority Priority number. <0 is executed earlier, >0 is executed later + */ + public function register($hook, $callback, $priority = 0); + /** + * Dispatch a message + * + * @param string $hook Hook name + * @param array $parameters Parameters to pass to callbacks + * @return boolean Successfulness + */ + public function dispatch($hook, $parameters = []); + } + /** + * Handles adding and dispatching events + * + * @package Requests\EventDispatcher + */ + class Hooks implements \WpOrg\Requests\HookManager + { + /** + * Registered callbacks for each hook + * + * @var array + */ + protected $hooks = []; + /** + * Register a callback for a hook + * + * @param string $hook Hook name + * @param callable $callback Function/method to call on event + * @param int $priority Priority number. <0 is executed earlier, >0 is executed later + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $hook argument is not a string. + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $callback argument is not callable. + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $priority argument is not an integer. + */ + public function register($hook, $callback, $priority = 0) + { + } + /** + * Dispatch a message + * + * @param string $hook Hook name + * @param array $parameters Parameters to pass to callbacks + * @return boolean Successfulness + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $hook argument is not a string. + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $parameters argument is not an array. + */ + public function dispatch($hook, $parameters = []) + { + } + public function __wakeup() + { + } + } + /** + * IDNA URL encoder + * + * Note: Not fully compliant, as nameprep does nothing yet. + * + * @package Requests\Utilities + * + * @link https://tools.ietf.org/html/rfc3490 IDNA specification + * @link https://tools.ietf.org/html/rfc3492 Punycode/Bootstrap specification + */ + class IdnaEncoder + { + /** + * ACE prefix used for IDNA + * + * @link https://tools.ietf.org/html/rfc3490#section-5 + * @var string + */ + const ACE_PREFIX = 'xn--'; + /** + * Maximum length of a IDNA URL in ASCII. + * + * @see \WpOrg\Requests\IdnaEncoder::to_ascii() + * + * @since 2.0.0 + * + * @var int + */ + const MAX_LENGTH = 64; + /**#@+ + * Bootstrap constant for Punycode + * + * @link https://tools.ietf.org/html/rfc3492#section-5 + * @var int + */ + const BOOTSTRAP_BASE = 36; + const BOOTSTRAP_TMIN = 1; + const BOOTSTRAP_TMAX = 26; + const BOOTSTRAP_SKEW = 38; + const BOOTSTRAP_DAMP = 700; + const BOOTSTRAP_INITIAL_BIAS = 72; + const BOOTSTRAP_INITIAL_N = 128; + /**#@-*/ + /** + * Encode a hostname using Punycode + * + * @param string|Stringable $hostname Hostname + * @return string Punycode-encoded hostname + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed argument is not a string or a stringable object. + */ + public static function encode($hostname) + { + } + /** + * Convert a UTF-8 text string to an ASCII string using Punycode + * + * @param string $text ASCII or UTF-8 string (max length 64 characters) + * @return string ASCII string + * + * @throws \WpOrg\Requests\Exception Provided string longer than 64 ASCII characters (`idna.provided_too_long`) + * @throws \WpOrg\Requests\Exception Prepared string longer than 64 ASCII characters (`idna.prepared_too_long`) + * @throws \WpOrg\Requests\Exception Provided string already begins with xn-- (`idna.provided_is_prefixed`) + * @throws \WpOrg\Requests\Exception Encoded string longer than 64 ASCII characters (`idna.encoded_too_long`) + */ + public static function to_ascii($text) + { + } + /** + * Check whether a given text string contains only ASCII characters + * + * @internal (Testing found regex was the fastest implementation) + * + * @param string $text Text to examine. + * @return bool Is the text string ASCII-only? + */ + protected static function is_ascii($text) + { + } + /** + * Prepare a text string for use as an IDNA name + * + * @todo Implement this based on RFC 3491 and the newer 5891 + * @param string $text Text to prepare. + * @return string Prepared string + */ + protected static function nameprep($text) + { + } + /** + * Convert a UTF-8 string to a UCS-4 codepoint array + * + * Based on \WpOrg\Requests\Iri::replace_invalid_with_pct_encoding() + * + * @param string $input Text to convert. + * @return array Unicode code points + * + * @throws \WpOrg\Requests\Exception Invalid UTF-8 codepoint (`idna.invalidcodepoint`) + */ + protected static function utf8_to_codepoints($input) + { + } + /** + * RFC3492-compliant encoder + * + * @internal Pseudo-code from Section 6.3 is commented with "#" next to relevant code + * + * @param string $input UTF-8 encoded string to encode + * @return string Punycode-encoded string + * + * @throws \WpOrg\Requests\Exception On character outside of the domain (never happens with Punycode) (`idna.character_outside_domain`) + */ + public static function punycode_encode($input) + { + } + /** + * Convert a digit to its respective character + * + * @link https://tools.ietf.org/html/rfc3492#section-5 + * + * @param int $digit Digit in the range 0-35 + * @return string Single character corresponding to digit + * + * @throws \WpOrg\Requests\Exception On invalid digit (`idna.invalid_digit`) + */ + protected static function digit_to_char($digit) + { + } + /** + * Adapt the bias + * + * @link https://tools.ietf.org/html/rfc3492#section-6.1 + * @param int $delta + * @param int $numpoints + * @param bool $firsttime + * @return int|float New bias + * + * function adapt(delta,numpoints,firsttime): + */ + protected static function adapt($delta, $numpoints, $firsttime) + { + } + } + /** + * Class to validate and to work with IPv6 addresses + * + * This was originally based on the PEAR class of the same name, but has been + * entirely rewritten. + * + * @package Requests\Utilities + */ + final class Ipv6 + { + /** + * Uncompresses an IPv6 address + * + * RFC 4291 allows you to compress consecutive zero pieces in an address to + * '::'. This method expects a valid IPv6 address and expands the '::' to + * the required number of zero pieces. + * + * Example: FF01::101 -> FF01:0:0:0:0:0:0:101 + * ::1 -> 0:0:0:0:0:0:0:1 + * + * @author Alexander Merz <alexander.merz@web.de> + * @author elfrink at introweb dot nl + * @author Josh Peck <jmp at joshpeck dot org> + * @copyright 2003-2005 The PHP Group + * @license https://opensource.org/licenses/bsd-license.php + * + * @param string|Stringable $ip An IPv6 address + * @return string The uncompressed IPv6 address + * + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed argument is not a string or a stringable object. + */ + public static function uncompress($ip) + { + } + /** + * Compresses an IPv6 address + * + * RFC 4291 allows you to compress consecutive zero pieces in an address to + * '::'. This method expects a valid IPv6 address and compresses consecutive + * zero pieces to '::'. + * + * Example: FF01:0:0:0:0:0:0:101 -> FF01::101 + * 0:0:0:0:0:0:0:1 -> ::1 + * + * @see \WpOrg\Requests\Ipv6::uncompress() + * + * @param string $ip An IPv6 address + * @return string The compressed IPv6 address + */ + public static function compress($ip) + { + } + /** + * Checks an IPv6 address + * + * Checks if the given IP is a valid IPv6 address + * + * @param string $ip An IPv6 address + * @return bool true if $ip is a valid IPv6 address + */ + public static function check_ipv6($ip) + { + } + } + /** + * IRI parser/serialiser/normaliser + * + * Copyright (c) 2007-2010, Geoffrey Sneddon and Steve Minutillo. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package Requests\Utilities + * @author Geoffrey Sneddon + * @author Steve Minutillo + * @copyright 2007-2009 Geoffrey Sneddon and Steve Minutillo + * @license https://opensource.org/licenses/bsd-license.php + * @link http://hg.gsnedders.com/iri/ + * + * @property string $iri IRI we're working with + * @property-read string $uri IRI in URI form, {@see \WpOrg\Requests\Iri::to_uri()} + * @property string $scheme Scheme part of the IRI + * @property string $authority Authority part, formatted for a URI (userinfo + host + port) + * @property string $iauthority Authority part of the IRI (userinfo + host + port) + * @property string $userinfo Userinfo part, formatted for a URI (after '://' and before '@') + * @property string $iuserinfo Userinfo part of the IRI (after '://' and before '@') + * @property string $host Host part, formatted for a URI + * @property string $ihost Host part of the IRI + * @property string $port Port part of the IRI (after ':') + * @property string $path Path part, formatted for a URI (after first '/') + * @property string $ipath Path part of the IRI (after first '/') + * @property string $query Query part, formatted for a URI (after '?') + * @property string $iquery Query part of the IRI (after '?') + * @property string $fragment Fragment, formatted for a URI (after '#') + * @property string $ifragment Fragment part of the IRI (after '#') + */ + class Iri + { + /** + * Scheme + * + * @var string|null + */ + protected $scheme = null; + /** + * User Information + * + * @var string|null + */ + protected $iuserinfo = null; + /** + * ihost + * + * @var string|null + */ + protected $ihost = null; + /** + * Port + * + * @var string|null + */ + protected $port = null; + /** + * ipath + * + * @var string + */ + protected $ipath = ''; + /** + * iquery + * + * @var string|null + */ + protected $iquery = null; + /** + * ifragment|null + * + * @var string + */ + protected $ifragment = null; + /** + * Normalization database + * + * Each key is the scheme, each value is an array with each key as the IRI + * part and value as the default value for that part. + * + * @var array + */ + protected $normalization = array('acap' => array('port' => \WpOrg\Requests\Port::ACAP), 'dict' => array('port' => \WpOrg\Requests\Port::DICT), 'file' => array('ihost' => 'localhost'), 'http' => array('port' => \WpOrg\Requests\Port::HTTP), 'https' => array('port' => \WpOrg\Requests\Port::HTTPS)); + /** + * Return the entire IRI when you try and read the object as a string + * + * @return string + */ + public function __toString() + { + } + /** + * Overload __set() to provide access via properties + * + * @param string $name Property name + * @param mixed $value Property value + */ + public function __set($name, $value) + { + } + /** + * Overload __get() to provide access via properties + * + * @param string $name Property name + * @return mixed + */ + public function __get($name) + { + } + /** + * Overload __isset() to provide access via properties + * + * @param string $name Property name + * @return bool + */ + public function __isset($name) + { + } + /** + * Overload __unset() to provide access via properties + * + * @param string $name Property name + */ + public function __unset($name) + { + } + /** + * Create a new IRI object, from a specified string + * + * @param string|Stringable|null $iri + * + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $iri argument is not a string, Stringable or null. + */ + public function __construct($iri = null) + { + } + /** + * Create a new IRI object by resolving a relative IRI + * + * Returns false if $base is not absolute, otherwise an IRI. + * + * @param \WpOrg\Requests\Iri|string $base (Absolute) Base IRI + * @param \WpOrg\Requests\Iri|string $relative Relative IRI + * @return \WpOrg\Requests\Iri|false + */ + public static function absolutize($base, $relative) + { + } + /** + * Parse an IRI into scheme/authority/path/query/fragment segments + * + * @param string $iri + * @return array + */ + protected function parse_iri($iri) + { + } + /** + * Remove dot segments from a path + * + * @param string $input + * @return string + */ + protected function remove_dot_segments($input) + { + } + /** + * Replace invalid character with percent encoding + * + * @param string $text Input string + * @param string $extra_chars Valid characters not in iunreserved or + * iprivate (this is ASCII-only) + * @param bool $iprivate Allow iprivate + * @return string + */ + protected function replace_invalid_with_pct_encoding($text, $extra_chars, $iprivate = false) + { + } + /** + * Callback function for preg_replace_callback. + * + * Removes sequences of percent encoded bytes that represent UTF-8 + * encoded characters in iunreserved + * + * @param array $regex_match PCRE match + * @return string Replacement + */ + protected function remove_iunreserved_percent_encoded($regex_match) + { + } + protected function scheme_normalization() + { + } + /** + * Check if the object represents a valid IRI. This needs to be done on each + * call as some things change depending on another part of the IRI. + * + * @return bool + */ + public function is_valid() + { + } + public function __wakeup() + { + } + /** + * Set the entire IRI. Returns true on success, false on failure (if there + * are any invalid characters). + * + * @param string $iri + * @return bool + */ + protected function set_iri($iri) + { + } + /** + * Set the scheme. Returns true on success, false on failure (if there are + * any invalid characters). + * + * @param string $scheme + * @return bool + */ + protected function set_scheme($scheme) + { + } + /** + * Set the authority. Returns true on success, false on failure (if there are + * any invalid characters). + * + * @param string $authority + * @return bool + */ + protected function set_authority($authority) + { + } + /** + * Set the iuserinfo. + * + * @param string $iuserinfo + * @return bool + */ + protected function set_userinfo($iuserinfo) + { + } + /** + * Set the ihost. Returns true on success, false on failure (if there are + * any invalid characters). + * + * @param string $ihost + * @return bool + */ + protected function set_host($ihost) + { + } + /** + * Set the port. Returns true on success, false on failure (if there are + * any invalid characters). + * + * @param string $port + * @return bool + */ + protected function set_port($port) + { + } + /** + * Set the ipath. + * + * @param string $ipath + * @return bool + */ + protected function set_path($ipath) + { + } + /** + * Set the iquery. + * + * @param string $iquery + * @return bool + */ + protected function set_query($iquery) + { + } + /** + * Set the ifragment. + * + * @param string $ifragment + * @return bool + */ + protected function set_fragment($ifragment) + { + } + /** + * Convert an IRI to a URI (or parts thereof) + * + * @param string|bool $iri IRI to convert (or false from {@see \WpOrg\Requests\Iri::get_iri()}) + * @return string|false URI if IRI is valid, false otherwise. + */ + protected function to_uri($iri) + { + } + /** + * Get the complete IRI + * + * @return string|false + */ + protected function get_iri() + { + } + /** + * Get the complete URI + * + * @return string + */ + protected function get_uri() + { + } + /** + * Get the complete iauthority + * + * @return string|null + */ + protected function get_iauthority() + { + } + /** + * Get the complete authority + * + * @return string + */ + protected function get_authority() + { + } + } + /** + * Find the correct port depending on the Request type. + * + * @package Requests\Utilities + * @since 2.0.0 + */ + final class Port + { + /** + * Port to use with Acap requests. + * + * @var int + */ + const ACAP = 674; + /** + * Port to use with Dictionary requests. + * + * @var int + */ + const DICT = 2628; + /** + * Port to use with HTTP requests. + * + * @var int + */ + const HTTP = 80; + /** + * Port to use with HTTP over SSL requests. + * + * @var int + */ + const HTTPS = 443; + /** + * Retrieve the port number to use. + * + * @param string $type Request type. + * The following requests types are supported: + * 'acap', 'dict', 'http' and 'https'. + * + * @return int + * + * @throws \WpOrg\Requests\Exception\InvalidArgument When a non-string input has been passed. + * @throws \WpOrg\Requests\Exception When a non-supported port is requested ('portnotsupported'). + * @phpstan-param 'acap'|'dict'|'http'|'https' $type + */ + public static function get($type) + { + } + } + /** + * Proxy connection interface + * + * Implement this interface to handle proxy settings and authentication + * + * Parameters should be passed via the constructor where possible, as this + * makes it much easier for users to use your provider. + * + * @see \WpOrg\Requests\Hooks + * + * @package Requests\Proxy + * @since 1.6 + */ + interface Proxy + { + /** + * Register hooks as needed + * + * This method is called in {@see \WpOrg\Requests\Requests::request()} when the user + * has set an instance as the 'auth' option. Use this callback to register all the + * hooks you'll need. + * + * @see \WpOrg\Requests\Hooks::register() + * @param \WpOrg\Requests\Hooks $hooks Hook system + */ + public function register(\WpOrg\Requests\Hooks $hooks); + } +} +namespace WpOrg\Requests\Proxy { + /** + * HTTP Proxy connection interface + * + * Provides a handler for connection via an HTTP proxy + * + * @package Requests\Proxy + * @since 1.6 + */ + final class Http implements \WpOrg\Requests\Proxy + { + /** + * Proxy host and port + * + * Notation: "host:port" (eg 127.0.0.1:8080 or someproxy.com:3128) + * + * @var string + */ + public $proxy; + /** + * Username + * + * @var string + */ + public $user; + /** + * Password + * + * @var string + */ + public $pass; + /** + * Do we need to authenticate? (ie username & password have been provided) + * + * @var boolean + */ + public $use_authentication; + /** + * Constructor + * + * @since 1.6 + * + * @param array|string|null $args Proxy as a string or an array of proxy, user and password. + * When passed as an array, must have exactly one (proxy) + * or three elements (proxy, user, password). + * + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed argument is not an array, a string or null. + * @throws \WpOrg\Requests\Exception\ArgumentCount On incorrect number of arguments (`proxyhttpbadargs`) + */ + public function __construct($args = null) + { + } + /** + * Register the necessary callbacks + * + * @since 1.6 + * @see \WpOrg\Requests\Proxy\Http::curl_before_send() + * @see \WpOrg\Requests\Proxy\Http::fsockopen_remote_socket() + * @see \WpOrg\Requests\Proxy\Http::fsockopen_remote_host_path() + * @see \WpOrg\Requests\Proxy\Http::fsockopen_header() + * @param \WpOrg\Requests\Hooks $hooks Hook system + */ + public function register(\WpOrg\Requests\Hooks $hooks) + { + } + /** + * Set cURL parameters before the data is sent + * + * @since 1.6 + * @param resource|\CurlHandle $handle cURL handle + */ + public function curl_before_send(&$handle) + { + } + /** + * Alter remote socket information before opening socket connection + * + * @since 1.6 + * @param string $remote_socket Socket connection string + */ + public function fsockopen_remote_socket(&$remote_socket) + { + } + /** + * Alter remote path before getting stream data + * + * @since 1.6 + * @param string $path Path to send in HTTP request string ("GET ...") + * @param string $url Full URL we're requesting + */ + public function fsockopen_remote_host_path(&$path, $url) + { + } + /** + * Add extra headers to the request before sending + * + * @since 1.6 + * @param string $out HTTP header string + */ + public function fsockopen_header(&$out) + { + } + /** + * Get the authentication string (user:pass) + * + * @since 1.6 + * @return string + */ + public function get_auth_string() + { + } + } +} +namespace WpOrg\Requests { + /** + * Requests for PHP + * + * Inspired by Requests for Python. + * + * Based on concepts from SimplePie_File, RequestCore and WP_Http. + * + * @package Requests + */ + class Requests + { + /** + * POST method + * + * @var string + */ + const POST = 'POST'; + /** + * PUT method + * + * @var string + */ + const PUT = 'PUT'; + /** + * GET method + * + * @var string + */ + const GET = 'GET'; + /** + * HEAD method + * + * @var string + */ + const HEAD = 'HEAD'; + /** + * DELETE method + * + * @var string + */ + const DELETE = 'DELETE'; + /** + * OPTIONS method + * + * @var string + */ + const OPTIONS = 'OPTIONS'; + /** + * TRACE method + * + * @var string + */ + const TRACE = 'TRACE'; + /** + * PATCH method + * + * @link https://tools.ietf.org/html/rfc5789 + * @var string + */ + const PATCH = 'PATCH'; + /** + * Default size of buffer size to read streams + * + * @var integer + */ + const BUFFER_SIZE = 1160; + /** + * Option defaults. + * + * @see \WpOrg\Requests\Requests::get_default_options() + * @see \WpOrg\Requests\Requests::request() for values returned by this method + * + * @since 2.0.0 + * + * @var array + */ + const OPTION_DEFAULTS = ['timeout' => 10, 'connect_timeout' => 10, 'useragent' => 'php-requests/' . self::VERSION, 'protocol_version' => 1.1, 'redirected' => 0, 'redirects' => 10, 'follow_redirects' => true, 'blocking' => true, 'type' => self::GET, 'filename' => false, 'auth' => false, 'proxy' => false, 'cookies' => false, 'max_bytes' => false, 'idn' => true, 'hooks' => null, 'transport' => null, 'verify' => null, 'verifyname' => true]; + /** + * Default supported Transport classes. + * + * @since 2.0.0 + * + * @var array + */ + const DEFAULT_TRANSPORTS = [\WpOrg\Requests\Transport\Curl::class => \WpOrg\Requests\Transport\Curl::class, \WpOrg\Requests\Transport\Fsockopen::class => \WpOrg\Requests\Transport\Fsockopen::class]; + /** + * Current version of Requests + * + * @var string + */ + const VERSION = '2.0.11'; + /** + * Selected transport name + * + * Use {@see \WpOrg\Requests\Requests::get_transport()} instead + * + * @var array + */ + public static $transport = []; + /** + * Registered transport classes + * + * @var array + */ + protected static $transports = []; + /** + * Default certificate path. + * + * @see \WpOrg\Requests\Requests::get_certificate_path() + * @see \WpOrg\Requests\Requests::set_certificate_path() + * + * @var string + */ + protected static $certificate_path = __DIR__ . '/../certificates/cacert.pem'; + /** + * Register a transport + * + * @param string $transport Transport class to add, must support the \WpOrg\Requests\Transport interface + */ + public static function add_transport($transport) + { + } + /** + * Get the fully qualified class name (FQCN) for a working transport. + * + * @param array<string, bool> $capabilities Optional. Associative array of capabilities to test against, i.e. `['<capability>' => true]`. + * @return string FQCN of the transport to use, or an empty string if no transport was + * found which provided the requested capabilities. + */ + protected static function get_transport_class(array $capabilities = []) + { + } + /** + * Get a working transport. + * + * @param array<string, bool> $capabilities Optional. Associative array of capabilities to test against, i.e. `['<capability>' => true]`. + * @return \WpOrg\Requests\Transport + * @throws \WpOrg\Requests\Exception If no valid transport is found (`notransport`). + */ + protected static function get_transport(array $capabilities = []) + { + } + /** + * Checks to see if we have a transport for the capabilities requested. + * + * Supported capabilities can be found in the {@see \WpOrg\Requests\Capability} + * interface as constants. + * + * Example usage: + * `Requests::has_capabilities([Capability::SSL => true])`. + * + * @param array<string, bool> $capabilities Optional. Associative array of capabilities to test against, i.e. `['<capability>' => true]`. + * @return bool Whether the transport has the requested capabilities. + */ + public static function has_capabilities(array $capabilities = []) + { + } + /**#@+ + * @see \WpOrg\Requests\Requests::request() + * @param string $url + * @param array $headers + * @param array $options + * @return \WpOrg\Requests\Response + */ + /** + * Send a GET request + */ + public static function get($url, $headers = [], $options = []) + { + } + /** + * Send a HEAD request + */ + public static function head($url, $headers = [], $options = []) + { + } + /** + * Send a DELETE request + */ + public static function delete($url, $headers = [], $options = []) + { + } + /** + * Send a TRACE request + */ + public static function trace($url, $headers = [], $options = []) + { + } + /**#@-*/ + /**#@+ + * @see \WpOrg\Requests\Requests::request() + * @param string $url + * @param array $headers + * @param array $data + * @param array $options + * @return \WpOrg\Requests\Response + */ + /** + * Send a POST request + */ + public static function post($url, $headers = [], $data = [], $options = []) + { + } + /** + * Send a PUT request + */ + public static function put($url, $headers = [], $data = [], $options = []) + { + } + /** + * Send an OPTIONS request + */ + public static function options($url, $headers = [], $data = [], $options = []) + { + } + /** + * Send a PATCH request + * + * Note: Unlike {@see \WpOrg\Requests\Requests::post()} and {@see \WpOrg\Requests\Requests::put()}, + * `$headers` is required, as the specification recommends that should send an ETag + * + * @link https://tools.ietf.org/html/rfc5789 + */ + public static function patch($url, $headers, $data = [], $options = []) + { + } + /**#@-*/ + /** + * Main interface for HTTP requests + * + * This method initiates a request and sends it via a transport before + * parsing. + * + * The `$options` parameter takes an associative array with the following + * options: + * + * - `timeout`: How long should we wait for a response? + * Note: for cURL, a minimum of 1 second applies, as DNS resolution + * operates at second-resolution only. + * (float, seconds with a millisecond precision, default: 10, example: 0.01) + * - `connect_timeout`: How long should we wait while trying to connect? + * (float, seconds with a millisecond precision, default: 10, example: 0.01) + * - `useragent`: Useragent to send to the server + * (string, default: php-requests/$version) + * - `follow_redirects`: Should we follow 3xx redirects? + * (boolean, default: true) + * - `redirects`: How many times should we redirect before erroring? + * (integer, default: 10) + * - `blocking`: Should we block processing on this request? + * (boolean, default: true) + * - `filename`: File to stream the body to instead. + * (string|boolean, default: false) + * - `auth`: Authentication handler or array of user/password details to use + * for Basic authentication + * (\WpOrg\Requests\Auth|array|boolean, default: false) + * - `proxy`: Proxy details to use for proxy by-passing and authentication + * (\WpOrg\Requests\Proxy|array|string|boolean, default: false) + * - `max_bytes`: Limit for the response body size. + * (integer|boolean, default: false) + * - `idn`: Enable IDN parsing + * (boolean, default: true) + * - `transport`: Custom transport. Either a class name, or a + * transport object. Defaults to the first working transport from + * {@see \WpOrg\Requests\Requests::getTransport()} + * (string|\WpOrg\Requests\Transport, default: {@see \WpOrg\Requests\Requests::getTransport()}) + * - `hooks`: Hooks handler. + * (\WpOrg\Requests\HookManager, default: new WpOrg\Requests\Hooks()) + * - `verify`: Should we verify SSL certificates? Allows passing in a custom + * certificate file as a string. (Using true uses the system-wide root + * certificate store instead, but this may have different behaviour + * across transports.) + * (string|boolean, default: certificates/cacert.pem) + * - `verifyname`: Should we verify the common name in the SSL certificate? + * (boolean, default: true) + * - `data_format`: How should we send the `$data` parameter? + * (string, one of 'query' or 'body', default: 'query' for + * HEAD/GET/DELETE, 'body' for POST/PUT/OPTIONS/PATCH) + * + * @param string|Stringable $url URL to request + * @param array $headers Extra headers to send with the request + * @param array|null $data Data to send either as a query string for GET/HEAD requests, or in the body for POST requests + * @param string $type HTTP request type (use Requests constants) + * @param array $options Options for the request (see description for more information) + * @return \WpOrg\Requests\Response + * + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $url argument is not a string or Stringable. + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $type argument is not a string. + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $options argument is not an array. + * @throws \WpOrg\Requests\Exception On invalid URLs (`nonhttp`) + */ + public static function request($url, $headers = [], $data = [], $type = self::GET, $options = []) + { + } + /** + * Send multiple HTTP requests simultaneously + * + * The `$requests` parameter takes an associative or indexed array of + * request fields. The key of each request can be used to match up the + * request with the returned data, or with the request passed into your + * `multiple.request.complete` callback. + * + * The request fields value is an associative array with the following keys: + * + * - `url`: Request URL Same as the `$url` parameter to + * {@see \WpOrg\Requests\Requests::request()} + * (string, required) + * - `headers`: Associative array of header fields. Same as the `$headers` + * parameter to {@see \WpOrg\Requests\Requests::request()} + * (array, default: `array()`) + * - `data`: Associative array of data fields or a string. Same as the + * `$data` parameter to {@see \WpOrg\Requests\Requests::request()} + * (array|string, default: `array()`) + * - `type`: HTTP request type (use \WpOrg\Requests\Requests constants). Same as the `$type` + * parameter to {@see \WpOrg\Requests\Requests::request()} + * (string, default: `\WpOrg\Requests\Requests::GET`) + * - `cookies`: Associative array of cookie name to value, or cookie jar. + * (array|\WpOrg\Requests\Cookie\Jar) + * + * If the `$options` parameter is specified, individual requests will + * inherit options from it. This can be used to use a single hooking system, + * or set all the types to `\WpOrg\Requests\Requests::POST`, for example. + * + * In addition, the `$options` parameter takes the following global options: + * + * - `complete`: A callback for when a request is complete. Takes two + * parameters, a \WpOrg\Requests\Response/\WpOrg\Requests\Exception reference, and the + * ID from the request array (Note: this can also be overridden on a + * per-request basis, although that's a little silly) + * (callback) + * + * @param array $requests Requests data (see description for more information) + * @param array $options Global and default options (see {@see \WpOrg\Requests\Requests::request()}) + * @return array Responses (either \WpOrg\Requests\Response or a \WpOrg\Requests\Exception object) + * + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $requests argument is not an array or iterable object with array access. + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $options argument is not an array. + */ + public static function request_multiple($requests, $options = []) + { + } + /** + * Get the default options + * + * @see \WpOrg\Requests\Requests::request() for values returned by this method + * @param boolean $multirequest Is this a multirequest? + * @return array Default option values + */ + protected static function get_default_options($multirequest = false) + { + } + /** + * Get default certificate path. + * + * @return string Default certificate path. + */ + public static function get_certificate_path() + { + } + /** + * Set default certificate path. + * + * @param string|Stringable|bool $path Certificate path, pointing to a PEM file. + * + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $url argument is not a string, Stringable or boolean. + */ + public static function set_certificate_path($path) + { + } + /** + * Set the default values + * + * The $options parameter is updated with the results. + * + * @param string $url URL to request + * @param array $headers Extra headers to send with the request + * @param array|null $data Data to send either as a query string for GET/HEAD requests, or in the body for POST requests + * @param string $type HTTP request type + * @param array $options Options for the request + * @return void + * + * @throws \WpOrg\Requests\Exception When the $url is not an http(s) URL. + */ + protected static function set_defaults(&$url, &$headers, &$data, &$type, &$options) + { + } + /** + * HTTP response parser + * + * @param string $headers Full response text including headers and body + * @param string $url Original request URL + * @param array $req_headers Original $headers array passed to {@link request()}, in case we need to follow redirects + * @param array $req_data Original $data array passed to {@link request()}, in case we need to follow redirects + * @param array $options Original $options array passed to {@link request()}, in case we need to follow redirects + * @return \WpOrg\Requests\Response + * + * @throws \WpOrg\Requests\Exception On missing head/body separator (`requests.no_crlf_separator`) + * @throws \WpOrg\Requests\Exception On missing head/body separator (`noversion`) + * @throws \WpOrg\Requests\Exception On missing head/body separator (`toomanyredirects`) + */ + protected static function parse_response($headers, $url, $req_headers, $req_data, $options) + { + } + /** + * Callback for `transport.internal.parse_response` + * + * Internal use only. Converts a raw HTTP response to a \WpOrg\Requests\Response + * while still executing a multiple request. + * + * `$response` is either set to a \WpOrg\Requests\Response instance, or a \WpOrg\Requests\Exception object + * + * @param string $response Full response text including headers and body (will be overwritten with Response instance) + * @param array $request Request data as passed into {@see \WpOrg\Requests\Requests::request_multiple()} + * @return void + */ + public static function parse_multiple(&$response, $request) + { + } + /** + * Decoded a chunked body as per RFC 2616 + * + * @link https://tools.ietf.org/html/rfc2616#section-3.6.1 + * @param string $data Chunked body + * @return string Decoded body + */ + protected static function decode_chunked($data) + { + } + // @codeCoverageIgnoreEnd + /** + * Convert a key => value array to a 'key: value' array for headers + * + * @param iterable $dictionary Dictionary of header values + * @return array List of headers + * + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed argument is not iterable. + */ + public static function flatten($dictionary) + { + } + /** + * Decompress an encoded body + * + * Implements gzip, compress and deflate. Guesses which it is by attempting + * to decode. + * + * @param string $data Compressed data in one of the above formats + * @return string Decompressed string + * + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed argument is not a string. + */ + public static function decompress($data) + { + } + /** + * Decompression of deflated string while staying compatible with the majority of servers. + * + * Certain Servers will return deflated data with headers which PHP's gzinflate() + * function cannot handle out of the box. The following function has been created from + * various snippets on the gzinflate() PHP documentation. + * + * Warning: Magic numbers within. Due to the potential different formats that the compressed + * data may be returned in, some "magic offsets" are needed to ensure proper decompression + * takes place. For a simple progmatic way to determine the magic offset in use, see: + * https://core.trac.wordpress.org/ticket/18273 + * + * @since 1.6.0 + * @link https://core.trac.wordpress.org/ticket/18273 + * @link https://www.php.net/gzinflate#70875 + * @link https://www.php.net/gzinflate#77336 + * + * @param string $gz_data String to decompress. + * @return string|bool False on failure. + * + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed argument is not a string. + */ + public static function compatible_gzinflate($gz_data) + { + } + } + /** + * HTTP response class + * + * Contains a response from \WpOrg\Requests\Requests::request() + * + * @package Requests + */ + class Response + { + /** + * Response body + * + * @var string + */ + public $body = ''; + /** + * Raw HTTP data from the transport + * + * @var string + */ + public $raw = ''; + /** + * Headers, as an associative array + * + * @var \WpOrg\Requests\Response\Headers Array-like object representing headers + */ + public $headers = []; + /** + * Status code, false if non-blocking + * + * @var integer|boolean + */ + public $status_code = false; + /** + * Protocol version, false if non-blocking + * + * @var float|boolean + */ + public $protocol_version = false; + /** + * Whether the request succeeded or not + * + * @var boolean + */ + public $success = false; + /** + * Number of redirects the request used + * + * @var integer + */ + public $redirects = 0; + /** + * URL requested + * + * @var string + */ + public $url = ''; + /** + * Previous requests (from redirects) + * + * @var array Array of \WpOrg\Requests\Response objects + */ + public $history = []; + /** + * Cookies from the request + * + * @var \WpOrg\Requests\Cookie\Jar Array-like object representing a cookie jar + */ + public $cookies = []; + /** + * Constructor + */ + public function __construct() + { + } + /** + * Is the response a redirect? + * + * @return boolean True if redirect (3xx status), false if not. + */ + public function is_redirect() + { + } + /** + * Throws an exception if the request was not successful + * + * @param boolean $allow_redirects Set to false to throw on a 3xx as well + * + * @throws \WpOrg\Requests\Exception If `$allow_redirects` is false, and code is 3xx (`response.no_redirects`) + * @throws \WpOrg\Requests\Exception\Http On non-successful status code. Exception class corresponds to "Status" + code (e.g. {@see \WpOrg\Requests\Exception\Http\Status404}) + */ + public function throw_for_status($allow_redirects = true) + { + } + /** + * JSON decode the response body. + * + * The method parameters are the same as those for the PHP native `json_decode()` function. + * + * @link https://php.net/json-decode + * + * @param bool|null $associative Optional. When `true`, JSON objects will be returned as associative arrays; + * When `false`, JSON objects will be returned as objects. + * When `null`, JSON objects will be returned as associative arrays + * or objects depending on whether `JSON_OBJECT_AS_ARRAY` is set in the flags. + * Defaults to `true` (in contrast to the PHP native default of `null`). + * @param int $depth Optional. Maximum nesting depth of the structure being decoded. + * Defaults to `512`. + * @param int $options Optional. Bitmask of JSON_BIGINT_AS_STRING, JSON_INVALID_UTF8_IGNORE, + * JSON_INVALID_UTF8_SUBSTITUTE, JSON_OBJECT_AS_ARRAY, JSON_THROW_ON_ERROR. + * Defaults to `0` (no options set). + * + * @return array + * + * @throws \WpOrg\Requests\Exception If `$this->body` is not valid json. + */ + public function decode_body($associative = true, $depth = 512, $options = 0) + { + } + } +} +namespace WpOrg\Requests\Utility { + /** + * Case-insensitive dictionary, suitable for HTTP headers + * + * @package Requests\Utilities + */ + class CaseInsensitiveDictionary implements \ArrayAccess, \IteratorAggregate + { + /** + * Actual item data + * + * @var array + */ + protected $data = []; + /** + * Creates a case insensitive dictionary. + * + * @param array $data Dictionary/map to convert to case-insensitive + */ + public function __construct(array $data = []) + { + } + /** + * Check if the given item exists + * + * @param string $offset Item key + * @return boolean Does the item exist? + */ + #[\ReturnTypeWillChange] + public function offsetExists($offset) + { + } + /** + * Get the value for the item + * + * @param string $offset Item key + * @return string|null Item value (null if the item key doesn't exist) + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + } + /** + * Set the given item + * + * @param string $offset Item name + * @param string $value Item value + * + * @throws \WpOrg\Requests\Exception On attempting to use dictionary as list (`invalidset`) + */ + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value) + { + } + /** + * Unset the given header + * + * @param string $offset The key for the item to unset. + */ + #[\ReturnTypeWillChange] + public function offsetUnset($offset) + { + } + /** + * Get an iterator for the data + * + * @return \ArrayIterator + */ + #[\ReturnTypeWillChange] + public function getIterator() + { + } + /** + * Get the headers as an array + * + * @return array Header data + */ + public function getAll() + { + } + } +} +namespace WpOrg\Requests\Response { + /** + * Case-insensitive dictionary, suitable for HTTP headers + * + * @package Requests + */ + class Headers extends \WpOrg\Requests\Utility\CaseInsensitiveDictionary + { + /** + * Get the given header + * + * Unlike {@see \WpOrg\Requests\Response\Headers::getValues()}, this returns a string. If there are + * multiple values, it concatenates them with a comma as per RFC2616. + * + * Avoid using this where commas may be used unquoted in values, such as + * Set-Cookie headers. + * + * @param string $offset Name of the header to retrieve. + * @return string|null Header value + */ + public function offsetGet($offset) + { + } + /** + * Set the given item + * + * @param string $offset Item name + * @param string $value Item value + * + * @throws \WpOrg\Requests\Exception On attempting to use dictionary as list (`invalidset`) + */ + public function offsetSet($offset, $value) + { + } + /** + * Get all values for a given header + * + * @param string $offset Name of the header to retrieve. + * @return array|null Header values + * + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed argument is not valid as an array key. + */ + public function getValues($offset) + { + } + /** + * Flattens a value into a string + * + * Converts an array into a string by imploding values with a comma, as per + * RFC2616's rules for folding headers. + * + * @param string|array $value Value to flatten + * @return string Flattened value + * + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed argument is not a string or an array. + */ + public function flatten($value) + { + } + /** + * Get an iterator for the data + * + * Converts the internally stored values to a comma-separated string if there is more + * than one value for a key. + * + * @return \ArrayIterator + */ + public function getIterator() + { + } + } +} +namespace WpOrg\Requests { + /** + * Session handler for persistent requests and default parameters + * + * Allows various options to be set as default values, and merges both the + * options and URL properties together. A base URL can be set for all requests, + * with all subrequests resolved from this. Base options can be set (including + * a shared cookie jar), then overridden for individual requests. + * + * @package Requests\SessionHandler + */ + class Session + { + /** + * Base URL for requests + * + * URLs will be made absolute using this as the base + * + * @var string|null + */ + public $url = null; + /** + * Base headers for requests + * + * @var array + */ + public $headers = []; + /** + * Base data for requests + * + * If both the base data and the per-request data are arrays, the data will + * be merged before sending the request. + * + * @var array + */ + public $data = []; + /** + * Base options for requests + * + * The base options are merged with the per-request data for each request. + * The only default option is a shared cookie jar between requests. + * + * Values here can also be set directly via properties on the Session + * object, e.g. `$session->useragent = 'X';` + * + * @var array + */ + public $options = []; + /** + * Create a new session + * + * @param string|Stringable|null $url Base URL for requests + * @param array $headers Default headers for requests + * @param array $data Default data for requests + * @param array $options Default options for requests + * + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $url argument is not a string, Stringable or null. + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $headers argument is not an array. + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $data argument is not an array. + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $options argument is not an array. + */ + public function __construct($url = null, $headers = [], $data = [], $options = []) + { + } + /** + * Get a property's value + * + * @param string $name Property name. + * @return mixed|null Property value, null if none found + */ + public function __get($name) + { + } + /** + * Set a property's value + * + * @param string $name Property name. + * @param mixed $value Property value + */ + public function __set($name, $value) + { + } + /** + * Remove a property's value + * + * @param string $name Property name. + */ + public function __isset($name) + { + } + /** + * Remove a property's value + * + * @param string $name Property name. + */ + public function __unset($name) + { + } + /**#@+ + * @see \WpOrg\Requests\Session::request() + * @param string $url + * @param array $headers + * @param array $options + * @return \WpOrg\Requests\Response + */ + /** + * Send a GET request + */ + public function get($url, $headers = [], $options = []) + { + } + /** + * Send a HEAD request + */ + public function head($url, $headers = [], $options = []) + { + } + /** + * Send a DELETE request + */ + public function delete($url, $headers = [], $options = []) + { + } + /**#@-*/ + /**#@+ + * @see \WpOrg\Requests\Session::request() + * @param string $url + * @param array $headers + * @param array $data + * @param array $options + * @return \WpOrg\Requests\Response + */ + /** + * Send a POST request + */ + public function post($url, $headers = [], $data = [], $options = []) + { + } + /** + * Send a PUT request + */ + public function put($url, $headers = [], $data = [], $options = []) + { + } + /** + * Send a PATCH request + * + * Note: Unlike {@see \WpOrg\Requests\Session::post()} and {@see \WpOrg\Requests\Session::put()}, + * `$headers` is required, as the specification recommends that should send an ETag + * + * @link https://tools.ietf.org/html/rfc5789 + */ + public function patch($url, $headers, $data = [], $options = []) + { + } + /**#@-*/ + /** + * Main interface for HTTP requests + * + * This method initiates a request and sends it via a transport before + * parsing. + * + * @see \WpOrg\Requests\Requests::request() + * + * @param string $url URL to request + * @param array $headers Extra headers to send with the request + * @param array|null $data Data to send either as a query string for GET/HEAD requests, or in the body for POST requests + * @param string $type HTTP request type (use \WpOrg\Requests\Requests constants) + * @param array $options Options for the request (see {@see \WpOrg\Requests\Requests::request()}) + * @return \WpOrg\Requests\Response + * + * @throws \WpOrg\Requests\Exception On invalid URLs (`nonhttp`) + */ + public function request($url, $headers = [], $data = [], $type = \WpOrg\Requests\Requests::GET, $options = []) + { + } + /** + * Send multiple HTTP requests simultaneously + * + * @see \WpOrg\Requests\Requests::request_multiple() + * + * @param array $requests Requests data (see {@see \WpOrg\Requests\Requests::request_multiple()}) + * @param array $options Global and default options (see {@see \WpOrg\Requests\Requests::request()}) + * @return array Responses (either \WpOrg\Requests\Response or a \WpOrg\Requests\Exception object) + * + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $requests argument is not an array or iterable object with array access. + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $options argument is not an array. + */ + public function request_multiple($requests, $options = []) + { + } + public function __wakeup() + { + } + /** + * Merge a request's data with the default data + * + * @param array $request Request data (same form as {@see \WpOrg\Requests\Session::request_multiple()}) + * @param boolean $merge_options Should we merge options as well? + * @return array Request data + */ + protected function merge_request($request, $merge_options = true) + { + } + } + /** + * SSL utilities for Requests + * + * Collection of utilities for working with and verifying SSL certificates. + * + * @package Requests\Utilities + */ + final class Ssl + { + /** + * Verify the certificate against common name and subject alternative names + * + * Unfortunately, PHP doesn't check the certificate against the alternative + * names, leading things like 'https://www.github.com/' to be invalid. + * + * @link https://tools.ietf.org/html/rfc2818#section-3.1 RFC2818, Section 3.1 + * + * @param string|Stringable $host Host name to verify against + * @param array $cert Certificate data from openssl_x509_parse() + * @return bool + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $host argument is not a string or a stringable object. + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $cert argument is not an array or array accessible. + */ + public static function verify_certificate($host, $cert) + { + } + /** + * Verify that a reference name is valid + * + * Verifies a dNSName for HTTPS usage, (almost) as per Firefox's rules: + * - Wildcards can only occur in a name with more than 3 components + * - Wildcards can only occur as the last character in the first + * component + * - Wildcards may be preceded by additional characters + * + * We modify these rules to be a bit stricter and only allow the wildcard + * character to be the full first component; that is, with the exclusion of + * the third rule. + * + * @param string|Stringable $reference Reference dNSName + * @return boolean Is the name valid? + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed argument is not a string or a stringable object. + */ + public static function verify_reference_name($reference) + { + } + /** + * Match a hostname against a dNSName reference + * + * @param string|Stringable $host Requested host + * @param string|Stringable $reference dNSName to match against + * @return boolean Does the domain match? + * @throws \WpOrg\Requests\Exception\InvalidArgument When either of the passed arguments is not a string or a stringable object. + */ + public static function match_domain($host, $reference) + { + } + } + /** + * Base HTTP transport + * + * @package Requests\Transport + */ + interface Transport + { + /** + * Perform a request + * + * @param string $url URL to request + * @param array $headers Associative array of request headers + * @param string|array $data Data to send either as the POST body, or as parameters in the URL for a GET/HEAD + * @param array $options Request options, see {@see \WpOrg\Requests\Requests::response()} for documentation + * @return string Raw HTTP result + */ + public function request($url, $headers = [], $data = [], $options = []); + /** + * Send multiple requests simultaneously + * + * @param array $requests Request data (array of 'url', 'headers', 'data', 'options') as per {@see \WpOrg\Requests\Transport::request()} + * @param array $options Global options, see {@see \WpOrg\Requests\Requests::response()} for documentation + * @return array Array of \WpOrg\Requests\Response objects (may contain \WpOrg\Requests\Exception or string responses as well) + */ + public function request_multiple($requests, $options); + /** + * Self-test whether the transport can be used. + * + * The available capabilities to test for can be found in {@see \WpOrg\Requests\Capability}. + * + * @param array<string, bool> $capabilities Optional. Associative array of capabilities to test against, i.e. `['<capability>' => true]`. + * @return bool Whether the transport can be used. + */ + public static function test($capabilities = []); + } +} +namespace WpOrg\Requests\Transport { + /** + * cURL HTTP transport + * + * @package Requests\Transport + */ + final class Curl implements \WpOrg\Requests\Transport + { + const CURL_7_10_5 = 0x70a05; + const CURL_7_16_2 = 0x71002; + /** + * Raw HTTP data + * + * @var string + */ + public $headers = ''; + /** + * Raw body data + * + * @var string + */ + public $response_data = ''; + /** + * Information on the current request + * + * @var array cURL information array, see {@link https://www.php.net/curl_getinfo} + */ + public $info; + /** + * cURL version number + * + * @var int + */ + public $version; + /** + * Constructor + */ + public function __construct() + { + } + /** + * Destructor + */ + public function __destruct() + { + } + /** + * Perform a request + * + * @param string|Stringable $url URL to request + * @param array $headers Associative array of request headers + * @param string|array $data Data to send either as the POST body, or as parameters in the URL for a GET/HEAD + * @param array $options Request options, see {@see \WpOrg\Requests\Requests::response()} for documentation + * @return string Raw HTTP result + * + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $url argument is not a string or Stringable. + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $headers argument is not an array. + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $data parameter is not an array or string. + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $options argument is not an array. + * @throws \WpOrg\Requests\Exception On a cURL error (`curlerror`) + */ + public function request($url, $headers = [], $data = [], $options = []) + { + } + /** + * Send multiple requests simultaneously + * + * @param array $requests Request data + * @param array $options Global options + * @return array Array of \WpOrg\Requests\Response objects (may contain \WpOrg\Requests\Exception or string responses as well) + * + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $requests argument is not an array or iterable object with array access. + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $options argument is not an array. + */ + public function request_multiple($requests, $options) + { + } + /** + * Get the cURL handle for use in a multi-request + * + * @param string $url URL to request + * @param array $headers Associative array of request headers + * @param string|array $data Data to send either as the POST body, or as parameters in the URL for a GET/HEAD + * @param array $options Request options, see {@see \WpOrg\Requests\Requests::response()} for documentation + * @return resource|\CurlHandle Subrequest's cURL handle + */ + public function &get_subrequest_handle($url, $headers, $data, $options) + { + } + /** + * Process a response + * + * @param string $response Response data from the body + * @param array $options Request options + * @return string|false HTTP response data including headers. False if non-blocking. + * @throws \WpOrg\Requests\Exception If the request resulted in a cURL error. + */ + public function process_response($response, $options) + { + } + /** + * Collect the headers as they are received + * + * @param resource|\CurlHandle $handle cURL handle + * @param string $headers Header string + * @return integer Length of provided header + */ + public function stream_headers($handle, $headers) + { + } + /** + * Collect data as it's received + * + * @since 1.6.1 + * + * @param resource|\CurlHandle $handle cURL handle + * @param string $data Body data + * @return integer Length of provided data + */ + public function stream_body($handle, $data) + { + } + /** + * Self-test whether the transport can be used. + * + * The available capabilities to test for can be found in {@see \WpOrg\Requests\Capability}. + * + * @codeCoverageIgnore + * @param array<string, bool> $capabilities Optional. Associative array of capabilities to test against, i.e. `['<capability>' => true]`. + * @return bool Whether the transport can be used. + */ + public static function test($capabilities = []) + { + } + } + /** + * fsockopen HTTP transport + * + * @package Requests\Transport + */ + final class Fsockopen implements \WpOrg\Requests\Transport + { + /** + * Second to microsecond conversion + * + * @var integer + */ + const SECOND_IN_MICROSECONDS = 1000000; + /** + * Raw HTTP data + * + * @var string + */ + public $headers = ''; + /** + * Stream metadata + * + * @var array Associative array of properties, see {@link https://www.php.net/stream_get_meta_data} + */ + public $info; + /** + * Perform a request + * + * @param string|Stringable $url URL to request + * @param array $headers Associative array of request headers + * @param string|array $data Data to send either as the POST body, or as parameters in the URL for a GET/HEAD + * @param array $options Request options, see {@see \WpOrg\Requests\Requests::response()} for documentation + * @return string Raw HTTP result + * + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $url argument is not a string or Stringable. + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $headers argument is not an array. + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $data parameter is not an array or string. + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $options argument is not an array. + * @throws \WpOrg\Requests\Exception On failure to connect to socket (`fsockopenerror`) + * @throws \WpOrg\Requests\Exception On socket timeout (`timeout`) + */ + public function request($url, $headers = [], $data = [], $options = []) + { + } + /** + * Send multiple requests simultaneously + * + * @param array $requests Request data (array of 'url', 'headers', 'data', 'options') as per {@see \WpOrg\Requests\Transport::request()} + * @param array $options Global options, see {@see \WpOrg\Requests\Requests::response()} for documentation + * @return array Array of \WpOrg\Requests\Response objects (may contain \WpOrg\Requests\Exception or string responses as well) + * + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $requests argument is not an array or iterable object with array access. + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $options argument is not an array. + */ + public function request_multiple($requests, $options) + { + } + /** + * Error handler for stream_socket_client() + * + * @param int $errno Error number (e.g. E_WARNING) + * @param string $errstr Error message + */ + public function connect_error_handler($errno, $errstr) + { + } + /** + * Verify the certificate against common name and subject alternative names + * + * Unfortunately, PHP doesn't check the certificate against the alternative + * names, leading things like 'https://www.github.com/' to be invalid. + * Instead + * + * @link https://tools.ietf.org/html/rfc2818#section-3.1 RFC2818, Section 3.1 + * + * @param string $host Host name to verify against + * @param resource $context Stream context + * @return bool + * + * @throws \WpOrg\Requests\Exception On failure to connect via TLS (`fsockopen.ssl.connect_error`) + * @throws \WpOrg\Requests\Exception On not obtaining a match for the host (`fsockopen.ssl.no_match`) + */ + public function verify_certificate_from_context($host, $context) + { + } + /** + * Self-test whether the transport can be used. + * + * The available capabilities to test for can be found in {@see \WpOrg\Requests\Capability}. + * + * @codeCoverageIgnore + * @param array<string, bool> $capabilities Optional. Associative array of capabilities to test against, i.e. `['<capability>' => true]`. + * @return bool Whether the transport can be used. + */ + public static function test($capabilities = []) + { + } + } +} +namespace WpOrg\Requests\Utility { + /** + * Iterator for arrays requiring filtered values + * + * @package Requests\Utilities + */ + final class FilteredIterator extends \ArrayIterator + { + /** + * Create a new iterator + * + * @param array $data The array or object to be iterated on. + * @param callable $callback Callback to be called on each value + * + * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $data argument is not iterable. + */ + public function __construct($data, $callback) + { + } + /** + * Prevent unserialization of the object for security reasons. + * + * @phpcs:disable PHPCompatibility.FunctionNameRestrictions.NewMagicMethods.__unserializeFound + * + * @param array $data Restored array of data originally serialized. + * + * @return void + */ + #[\ReturnTypeWillChange] + public function __unserialize($data) + { + } + // phpcs:enable + /** + * Perform reinitialization tasks. + * + * Prevents a callback from being injected during unserialization of an object. + * + * @return void + */ + public function __wakeup() + { + } + /** + * Get the current item's value after filtering + * + * @return string + */ + #[\ReturnTypeWillChange] + public function current() + { + } + /** + * Prevent creating a PHP value from a stored representation of the object for security reasons. + * + * @param string $data The serialized string. + * + * @return void + */ + #[\ReturnTypeWillChange] + public function unserialize($data) + { + } + } + /** + * Input validation utilities. + * + * @package Requests\Utilities + */ + final class InputValidator + { + /** + * Verify that a received input parameter is of type string or is "stringable". + * + * @param mixed $input Input parameter to verify. + * + * @return bool + */ + public static function is_string_or_stringable($input) + { + } + /** + * Verify whether a received input parameter is usable as an integer array key. + * + * @param mixed $input Input parameter to verify. + * + * @return bool + */ + public static function is_numeric_array_key($input) + { + } + /** + * Verify whether a received input parameter is "stringable". + * + * @param mixed $input Input parameter to verify. + * + * @return bool + */ + public static function is_stringable_object($input) + { + } + /** + * Verify whether a received input parameter is _accessible as if it were an array_. + * + * @param mixed $input Input parameter to verify. + * + * @return bool + */ + public static function has_array_access($input) + { + } + /** + * Verify whether a received input parameter is "iterable". + * + * @internal The PHP native `is_iterable()` function was only introduced in PHP 7.1 + * and this library still supports PHP 5.6. + * + * @param mixed $input Input parameter to verify. + * + * @return bool + */ + public static function is_iterable($input) + { + } + /** + * Verify whether a received input parameter is a Curl handle. + * + * The PHP Curl extension worked with resources prior to PHP 8.0 and with + * an instance of the `CurlHandle` class since PHP 8.0. + * {@link https://www.php.net/manual/en/migration80.incompatible.php#migration80.incompatible.resource2object} + * + * @param mixed $input Input parameter to verify. + * + * @return bool + */ + public static function is_curl_handle($input) + { + } + } +} +namespace { + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Manages all author-related data + * + * Used by {@see SimplePie_Item::get_author()} and {@see SimplePie::get_authors()} + * + * This class can be overloaded with {@see SimplePie::set_author_class()} + * + * @package SimplePie + * @subpackage API + */ + class SimplePie_Author + { + /** + * Author's name + * + * @var string + * @see get_name() + */ + var $name; + /** + * Author's link + * + * @var string + * @see get_link() + */ + var $link; + /** + * Author's email address + * + * @var string + * @see get_email() + */ + var $email; + /** + * Constructor, used to input the data + * + * @param string $name + * @param string $link + * @param string $email + */ + public function __construct($name = \null, $link = \null, $email = \null) + { + } + /** + * String-ified version + * + * @return string + */ + public function __toString() + { + } + /** + * Author's name + * + * @return string|null + */ + public function get_name() + { + } + /** + * Author's link + * + * @return string|null + */ + public function get_link() + { + } + /** + * Author's email address + * + * @return string|null + */ + public function get_email() + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Used to create cache objects + * + * This class can be overloaded with {@see SimplePie::set_cache_class()}, + * although the preferred way is to create your own handler + * via {@see register()} + * + * @package SimplePie + * @subpackage Caching + */ + class SimplePie_Cache + { + /** + * Cache handler classes + * + * These receive 3 parameters to their constructor, as documented in + * {@see register()} + * @var array + */ + protected static $handlers = array('mysql' => 'SimplePie_Cache_MySQL', 'memcache' => 'SimplePie_Cache_Memcache', 'memcached' => 'SimplePie_Cache_Memcached', 'redis' => 'SimplePie_Cache_Redis'); + /** + * Create a new SimplePie_Cache object + * + * @param string $location URL location (scheme is used to determine handler) + * @param string $filename Unique identifier for cache object + * @param string $extension 'spi' or 'spc' + * @return SimplePie_Cache_Base Type of object depends on scheme of `$location` + */ + public static function get_handler($location, $filename, $extension) + { + } + /** + * Create a new SimplePie_Cache object + * + * @deprecated Use {@see get_handler} instead + */ + public function create($location, $filename, $extension) + { + } + /** + * Register a handler + * + * @param string $type DSN type to register for + * @param string $class Name of handler class. Must implement SimplePie_Cache_Base + */ + public static function register($type, $class) + { + } + /** + * Parse a URL into an array + * + * @param string $url + * @return array + */ + public static function parse_URL($url) + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Base for cache objects + * + * Classes to be used with {@see SimplePie_Cache::register()} are expected + * to implement this interface. + * + * @package SimplePie + * @subpackage Caching + */ + interface SimplePie_Cache_Base + { + /** + * Feed cache type + * + * @var string + */ + const TYPE_FEED = 'spc'; + /** + * Image cache type + * + * @var string + */ + const TYPE_IMAGE = 'spi'; + /** + * Create a new cache object + * + * @param string $location Location string (from SimplePie::$cache_location) + * @param string $name Unique ID for the cache + * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data + */ + public function __construct($location, $name, $type); + /** + * Save data to the cache + * + * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property + * @return bool Successfulness + */ + public function save($data); + /** + * Retrieve the data saved to the cache + * + * @return array Data for SimplePie::$data + */ + public function load(); + /** + * Retrieve the last modified time for the cache + * + * @return int Timestamp + */ + public function mtime(); + /** + * Set the last modified time to the current time + * + * @return bool Success status + */ + public function touch(); + /** + * Remove the cache + * + * @return bool Success status + */ + public function unlink(); + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Base class for database-based caches + * + * @package SimplePie + * @subpackage Caching + */ + abstract class SimplePie_Cache_DB implements \SimplePie_Cache_Base + { + /** + * Helper for database conversion + * + * Converts a given {@see SimplePie} object into data to be stored + * + * @param SimplePie $data + * @return array First item is the serialized data for storage, second item is the unique ID for this item + */ + protected static function prepare_simplepie_object_for_cache($data) + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Caches data to the filesystem + * + * @package SimplePie + * @subpackage Caching + */ + class SimplePie_Cache_File implements \SimplePie_Cache_Base + { + /** + * Location string + * + * @see SimplePie::$cache_location + * @var string + */ + protected $location; + /** + * Filename + * + * @var string + */ + protected $filename; + /** + * File extension + * + * @var string + */ + protected $extension; + /** + * File path + * + * @var string + */ + protected $name; + /** + * Create a new cache object + * + * @param string $location Location string (from SimplePie::$cache_location) + * @param string $name Unique ID for the cache + * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data + */ + public function __construct($location, $name, $type) + { + } + /** + * Save data to the cache + * + * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property + * @return bool Successfulness + */ + public function save($data) + { + } + /** + * Retrieve the data saved to the cache + * + * @return array Data for SimplePie::$data + */ + public function load() + { + } + /** + * Retrieve the last modified time for the cache + * + * @return int Timestamp + */ + public function mtime() + { + } + /** + * Set the last modified time to the current time + * + * @return bool Success status + */ + public function touch() + { + } + /** + * Remove the cache + * + * @return bool Success status + */ + public function unlink() + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Caches data to memcache + * + * Registered for URLs with the "memcache" protocol + * + * For example, `memcache://localhost:11211/?timeout=3600&prefix=sp_` will + * connect to memcache on `localhost` on port 11211. All tables will be + * prefixed with `sp_` and data will expire after 3600 seconds + * + * @package SimplePie + * @subpackage Caching + * @uses Memcache + */ + class SimplePie_Cache_Memcache implements \SimplePie_Cache_Base + { + /** + * Memcache instance + * + * @var Memcache + */ + protected $cache; + /** + * Options + * + * @var array + */ + protected $options; + /** + * Cache name + * + * @var string + */ + protected $name; + /** + * Create a new cache object + * + * @param string $location Location string (from SimplePie::$cache_location) + * @param string $name Unique ID for the cache + * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data + */ + public function __construct($location, $name, $type) + { + } + /** + * Save data to the cache + * + * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property + * @return bool Successfulness + */ + public function save($data) + { + } + /** + * Retrieve the data saved to the cache + * + * @return array Data for SimplePie::$data + */ + public function load() + { + } + /** + * Retrieve the last modified time for the cache + * + * @return int Timestamp + */ + public function mtime() + { + } + /** + * Set the last modified time to the current time + * + * @return bool Success status + */ + public function touch() + { + } + /** + * Remove the cache + * + * @return bool Success status + */ + public function unlink() + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Caches data to memcached + * + * Registered for URLs with the "memcached" protocol + * + * For example, `memcached://localhost:11211/?timeout=3600&prefix=sp_` will + * connect to memcached on `localhost` on port 11211. All tables will be + * prefixed with `sp_` and data will expire after 3600 seconds + * + * @package SimplePie + * @subpackage Caching + * @author Paul L. McNeely + * @uses Memcached + */ + class SimplePie_Cache_Memcached implements \SimplePie_Cache_Base + { + /** + * Memcached instance + * @var Memcached + */ + protected $cache; + /** + * Options + * @var array + */ + protected $options; + /** + * Cache name + * @var string + */ + protected $name; + /** + * Create a new cache object + * @param string $location Location string (from SimplePie::$cache_location) + * @param string $name Unique ID for the cache + * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data + */ + public function __construct($location, $name, $type) + { + } + /** + * Save data to the cache + * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property + * @return bool Successfulness + */ + public function save($data) + { + } + /** + * Retrieve the data saved to the cache + * @return array Data for SimplePie::$data + */ + public function load() + { + } + /** + * Retrieve the last modified time for the cache + * @return int Timestamp + */ + public function mtime() + { + } + /** + * Set the last modified time to the current time + * @return bool Success status + */ + public function touch() + { + } + /** + * Remove the cache + * @return bool Success status + */ + public function unlink() + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Caches data to a MySQL database + * + * Registered for URLs with the "mysql" protocol + * + * For example, `mysql://root:password@localhost:3306/mydb?prefix=sp_` will + * connect to the `mydb` database on `localhost` on port 3306, with the user + * `root` and the password `password`. All tables will be prefixed with `sp_` + * + * @package SimplePie + * @subpackage Caching + */ + class SimplePie_Cache_MySQL extends \SimplePie_Cache_DB + { + /** + * PDO instance + * + * @var PDO + */ + protected $mysql; + /** + * Options + * + * @var array + */ + protected $options; + /** + * Cache ID + * + * @var string + */ + protected $id; + /** + * Create a new cache object + * + * @param string $location Location string (from SimplePie::$cache_location) + * @param string $name Unique ID for the cache + * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data + * @phpstan-return void + */ + public function __construct($location, $name, $type) + { + } + /** + * Save data to the cache + * + * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property + * @return bool Successfulness + */ + public function save($data) + { + } + /** + * Retrieve the data saved to the cache + * + * @return array Data for SimplePie::$data + */ + public function load() + { + } + /** + * Retrieve the last modified time for the cache + * + * @return int Timestamp + */ + public function mtime() + { + } + /** + * Set the last modified time to the current time + * + * @return bool Success status + */ + public function touch() + { + } + /** + * Remove the cache + * + * @return bool Success status + */ + public function unlink() + { + } + } + /** + * SimplePie Redis Cache Extension + * + * @package SimplePie + * @author Jan Kozak <galvani78@gmail.com> + * @link http://galvani.cz/ + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version 0.2.9 + */ + /** + * Caches data to redis + * + * Registered for URLs with the "redis" protocol + * + * For example, `redis://localhost:6379/?timeout=3600&prefix=sp_&dbIndex=0` will + * connect to redis on `localhost` on port 6379. All tables will be + * prefixed with `simple_primary-` and data will expire after 3600 seconds + * + * @package SimplePie + * @subpackage Caching + * @uses Redis + */ + class SimplePie_Cache_Redis implements \SimplePie_Cache_Base + { + /** + * Redis instance + * + * @var \Redis + */ + protected $cache; + /** + * Options + * + * @var array + */ + protected $options; + /** + * Cache name + * + * @var string + */ + protected $name; + /** + * Cache Data + * + * @var type + */ + protected $data; + /** + * Create a new cache object + * + * @param string $location Location string (from SimplePie::$cache_location) + * @param string $name Unique ID for the cache + * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data + */ + public function __construct($location, $name, $options = \null) + { + } + /** + * @param \Redis $cache + */ + public function setRedisClient(\Redis $cache) + { + } + /** + * Save data to the cache + * + * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property + * @return bool Successfulness + */ + public function save($data) + { + } + /** + * Retrieve the data saved to the cache + * + * @return array Data for SimplePie::$data + */ + public function load() + { + } + /** + * Retrieve the last modified time for the cache + * + * @return int Timestamp + */ + public function mtime() + { + } + /** + * Set the last modified time to the current time + * + * @return bool Success status + */ + public function touch() + { + } + /** + * Remove the cache + * + * @return bool Success status + */ + public function unlink() + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Handles `<media:text>` captions as defined in Media RSS. + * + * Used by {@see SimplePie_Enclosure::get_caption()} and {@see SimplePie_Enclosure::get_captions()} + * + * This class can be overloaded with {@see SimplePie::set_caption_class()} + * + * @package SimplePie + * @subpackage API + */ + class SimplePie_Caption + { + /** + * Content type + * + * @var string + * @see get_type() + */ + var $type; + /** + * Language + * + * @var string + * @see get_language() + */ + var $lang; + /** + * Start time + * + * @var string + * @see get_starttime() + */ + var $startTime; + /** + * End time + * + * @var string + * @see get_endtime() + */ + var $endTime; + /** + * Caption text + * + * @var string + * @see get_text() + */ + var $text; + /** + * Constructor, used to input the data + * + * For documentation on all the parameters, see the corresponding + * properties and their accessors + */ + public function __construct($type = \null, $lang = \null, $startTime = \null, $endTime = \null, $text = \null) + { + } + /** + * String-ified version + * + * @return string + */ + public function __toString() + { + } + /** + * Get the end time + * + * @return string|null Time in the format 'hh:mm:ss.SSS' + */ + public function get_endtime() + { + } + /** + * Get the language + * + * @link http://tools.ietf.org/html/rfc3066 + * @return string|null Language code as per RFC 3066 + */ + public function get_language() + { + } + /** + * Get the start time + * + * @return string|null Time in the format 'hh:mm:ss.SSS' + */ + public function get_starttime() + { + } + /** + * Get the text of the caption + * + * @return string|null + */ + public function get_text() + { + } + /** + * Get the content type (not MIME type) + * + * @return string|null Either 'text' or 'html' + */ + public function get_type() + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Manages all category-related data + * + * Used by {@see SimplePie_Item::get_category()} and {@see SimplePie_Item::get_categories()} + * + * This class can be overloaded with {@see SimplePie::set_category_class()} + * + * @package SimplePie + * @subpackage API + */ + class SimplePie_Category + { + /** + * Category identifier + * + * @var string|null + * @see get_term + */ + var $term; + /** + * Categorization scheme identifier + * + * @var string|null + * @see get_scheme() + */ + var $scheme; + /** + * Human readable label + * + * @var string|null + * @see get_label() + */ + var $label; + /** + * Category type + * + * category for <category> + * subject for <dc:subject> + * + * @var string|null + * @see get_type() + */ + var $type; + /** + * Constructor, used to input the data + * + * @param string|null $term + * @param string|null $scheme + * @param string|null $label + * @param string|null $type + */ + public function __construct($term = \null, $scheme = \null, $label = \null, $type = \null) + { + } + /** + * String-ified version + * + * @return string + */ + public function __toString() + { + } + /** + * Get the category identifier + * + * @return string|null + */ + public function get_term() + { + } + /** + * Get the categorization scheme identifier + * + * @return string|null + */ + public function get_scheme() + { + } + /** + * Get the human readable label + * + * @param bool $strict + * @return string|null + */ + public function get_label($strict = \false) + { + } + /** + * Get the category type + * + * @return string|null + */ + public function get_type() + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Content-type sniffing + * + * Based on the rules in http://tools.ietf.org/html/draft-abarth-mime-sniff-06 + * + * This is used since we can't always trust Content-Type headers, and is based + * upon the HTML5 parsing rules. + * + * + * This class can be overloaded with {@see SimplePie::set_content_type_sniffer_class()} + * + * @package SimplePie + * @subpackage HTTP + */ + class SimplePie_Content_Type_Sniffer + { + /** + * File object + * + * @var SimplePie_File + */ + var $file; + /** + * Create an instance of the class with the input file + * + * @param SimplePie_Content_Type_Sniffer $file Input file + */ + public function __construct($file) + { + } + /** + * Get the Content-Type of the specified file + * + * @return string Actual Content-Type + */ + public function get_type() + { + } + /** + * Sniff text or binary + * + * @return string Actual Content-Type + */ + public function text_or_binary() + { + } + /** + * Sniff unknown + * + * @return string Actual Content-Type + */ + public function unknown() + { + } + /** + * Sniff images + * + * @return string Actual Content-Type + */ + public function image() + { + } + /** + * Sniff HTML + * + * @return string Actual Content-Type + */ + public function feed_or_html() + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Manages `<media:copyright>` copyright tags as defined in Media RSS + * + * Used by {@see SimplePie_Enclosure::get_copyright()} + * + * This class can be overloaded with {@see SimplePie::set_copyright_class()} + * + * @package SimplePie + * @subpackage API + */ + class SimplePie_Copyright + { + /** + * Copyright URL + * + * @var string + * @see get_url() + */ + var $url; + /** + * Attribution + * + * @var string + * @see get_attribution() + */ + var $label; + /** + * Constructor, used to input the data + * + * For documentation on all the parameters, see the corresponding + * properties and their accessors + */ + public function __construct($url = \null, $label = \null) + { + } + /** + * String-ified version + * + * @return string + */ + public function __toString() + { + } + /** + * Get the copyright URL + * + * @return string|null URL to copyright information + */ + public function get_url() + { + } + /** + * Get the attribution text + * + * @return string|null + */ + public function get_attribution() + { + } + } + /** + * SimplePie + * + * @package SimplePie + * @subpackage API + */ + class SimplePie + { + /** + * @var array Raw data + * @access private + */ + public $data = array(); + /** + * @var mixed Error string + * @access private + */ + public $error; + /** + * @var int HTTP status code + * @see SimplePie::status_code() + * @access private + */ + public $status_code; + /** + * @var object Instance of SimplePie_Sanitize (or other class) + * @see SimplePie::set_sanitize_class() + * @access private + */ + public $sanitize; + /** + * @var string SimplePie Useragent + * @see SimplePie::set_useragent() + * @access private + */ + public $useragent = \SIMPLEPIE_USERAGENT; + /** + * @var string Feed URL + * @see SimplePie::set_feed_url() + * @access private + */ + public $feed_url; + /** + * @var string Original feed URL, or new feed URL iff HTTP 301 Moved Permanently + * @see SimplePie::subscribe_url() + * @access private + */ + public $permanent_url = \null; + /** + * @var object Instance of SimplePie_File to use as a feed + * @see SimplePie::set_file() + * @access private + */ + public $file; + /** + * @var string Raw feed data + * @see SimplePie::set_raw_data() + * @access private + */ + public $raw_data; + /** + * @var int Timeout for fetching remote files + * @see SimplePie::set_timeout() + * @access private + */ + public $timeout = 10; + /** + * @var array Custom curl options + * @see SimplePie::set_curl_options() + * @access private + */ + public $curl_options = array(); + /** + * @var bool Forces fsockopen() to be used for remote files instead + * of cURL, even if a new enough version is installed + * @see SimplePie::force_fsockopen() + * @access private + */ + public $force_fsockopen = \false; + /** + * @var bool Force the given data/URL to be treated as a feed no matter what + * it appears like + * @see SimplePie::force_feed() + * @access private + */ + public $force_feed = \false; + /** + * @var bool Enable/Disable Caching + * @see SimplePie::enable_cache() + * @access private + */ + public $cache = \true; + /** + * @var bool Force SimplePie to fallback to expired cache, if enabled, + * when feed is unavailable. + * @see SimplePie::force_cache_fallback() + * @access private + */ + public $force_cache_fallback = \false; + /** + * @var int Cache duration (in seconds) + * @see SimplePie::set_cache_duration() + * @access private + */ + public $cache_duration = 3600; + /** + * @var int Auto-discovery cache duration (in seconds) + * @see SimplePie::set_autodiscovery_cache_duration() + * @access private + */ + public $autodiscovery_cache_duration = 604800; + // 7 Days. + /** + * @var string Cache location (relative to executing script) + * @see SimplePie::set_cache_location() + * @access private + */ + public $cache_location = './cache'; + /** + * @var string Function that creates the cache filename + * @see SimplePie::set_cache_name_function() + * @access private + */ + public $cache_name_function = 'md5'; + /** + * @var bool Reorder feed by date descending + * @see SimplePie::enable_order_by_date() + * @access private + */ + public $order_by_date = \true; + /** + * @var mixed Force input encoding to be set to the follow value + * (false, or anything type-cast to false, disables this feature) + * @see SimplePie::set_input_encoding() + * @access private + */ + public $input_encoding = \false; + /** + * @var int Feed Autodiscovery Level + * @see SimplePie::set_autodiscovery_level() + * @access private + */ + public $autodiscovery = \SIMPLEPIE_LOCATOR_ALL; + /** + * Class registry object + * + * @var SimplePie_Registry + */ + public $registry; + /** + * @var int Maximum number of feeds to check with autodiscovery + * @see SimplePie::set_max_checked_feeds() + * @access private + */ + public $max_checked_feeds = 10; + /** + * @var array All the feeds found during the autodiscovery process + * @see SimplePie::get_all_discovered_feeds() + * @access private + */ + public $all_discovered_feeds = array(); + /** + * @var string Web-accessible path to the handler_image.php file. + * @see SimplePie::set_image_handler() + * @access private + */ + public $image_handler = ''; + /** + * @var array Stores the URLs when multiple feeds are being initialized. + * @see SimplePie::set_feed_url() + * @access private + */ + public $multifeed_url = array(); + /** + * @var array Stores SimplePie objects when multiple feeds initialized. + * @access private + */ + public $multifeed_objects = array(); + /** + * @var array Stores the get_object_vars() array for use with multifeeds. + * @see SimplePie::set_feed_url() + * @access private + */ + public $config_settings = \null; + /** + * @var integer Stores the number of items to return per-feed with multifeeds. + * @see SimplePie::set_item_limit() + * @access private + */ + public $item_limit = 0; + /** + * @var bool Stores if last-modified and/or etag headers were sent with the + * request when checking a feed. + */ + public $check_modified = \false; + /** + * @var array Stores the default attributes to be stripped by strip_attributes(). + * @see SimplePie::strip_attributes() + * @access private + */ + public $strip_attributes = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc'); + /** + * @var array Stores the default attributes to add to different tags by add_attributes(). + * @see SimplePie::add_attributes() + * @access private + */ + public $add_attributes = array('audio' => array('preload' => 'none'), 'iframe' => array('sandbox' => 'allow-scripts allow-same-origin'), 'video' => array('preload' => 'none')); + /** + * @var array Stores the default tags to be stripped by strip_htmltags(). + * @see SimplePie::strip_htmltags() + * @access private + */ + public $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style'); + /** + * @var bool Should we throw exceptions, or use the old-style error property? + * @access private + */ + public $enable_exceptions = \false; + /** + * The SimplePie class contains feed level data and options + * + * To use SimplePie, create the SimplePie object with no parameters. You can + * then set configuration options using the provided methods. After setting + * them, you must initialise the feed using $feed->init(). At that point the + * object's methods and properties will be available to you. + * + * Previously, it was possible to pass in the feed URL along with cache + * options directly into the constructor. This has been removed as of 1.3 as + * it caused a lot of confusion. + * + * @since 1.0 Preview Release + */ + public function __construct() + { + } + /** + * Used for converting object to a string + */ + public function __toString() + { + } + /** + * Remove items that link back to this before destroying this object + */ + public function __destruct() + { + } + /** + * Force the given data/URL to be treated as a feed + * + * This tells SimplePie to ignore the content-type provided by the server. + * Be careful when using this option, as it will also disable autodiscovery. + * + * @since 1.1 + * @param bool $enable Force the given data/URL to be treated as a feed + */ + public function force_feed($enable = \false) + { + } + /** + * Set the URL of the feed you want to parse + * + * This allows you to enter the URL of the feed you want to parse, or the + * website you want to try to use auto-discovery on. This takes priority + * over any set raw data. + * + * You can set multiple feeds to mash together by passing an array instead + * of a string for the $url. Remember that with each additional feed comes + * additional processing and resources. + * + * @since 1.0 Preview Release + * @see set_raw_data() + * @param string|array $url This is the URL (or array of URLs) that you want to parse. + */ + public function set_feed_url($url) + { + } + /** + * Set an instance of {@see SimplePie_File} to use as a feed + * + * @param SimplePie_File &$file + * @return bool True on success, false on failure + */ + public function set_file(&$file) + { + } + /** + * Set the raw XML data to parse + * + * Allows you to use a string of RSS/Atom data instead of a remote feed. + * + * If you have a feed available as a string in PHP, you can tell SimplePie + * to parse that data string instead of a remote feed. Any set feed URL + * takes precedence. + * + * @since 1.0 Beta 3 + * @param string $data RSS or Atom data as a string. + * @see set_feed_url() + */ + public function set_raw_data($data) + { + } + /** + * Set the default timeout for fetching remote feeds + * + * This allows you to change the maximum time the feed's server to respond + * and send the feed back. + * + * @since 1.0 Beta 3 + * @param int $timeout The maximum number of seconds to spend waiting to retrieve a feed. + */ + public function set_timeout($timeout = 10) + { + } + /** + * Set custom curl options + * + * This allows you to change default curl options + * + * @since 1.0 Beta 3 + * @param array $curl_options Curl options to add to default settings + */ + public function set_curl_options(array $curl_options = array()) + { + } + /** + * Force SimplePie to use fsockopen() instead of cURL + * + * @since 1.0 Beta 3 + * @param bool $enable Force fsockopen() to be used + */ + public function force_fsockopen($enable = \false) + { + } + /** + * Enable/disable caching in SimplePie. + * + * This option allows you to disable caching all-together in SimplePie. + * However, disabling the cache can lead to longer load times. + * + * @since 1.0 Preview Release + * @param bool $enable Enable caching + */ + public function enable_cache($enable = \true) + { + } + /** + * SimplePie to continue to fall back to expired cache, if enabled, when + * feed is unavailable. + * + * This tells SimplePie to ignore any file errors and fall back to cache + * instead. This only works if caching is enabled and cached content + * still exists. + * @param bool $enable Force use of cache on fail. + */ + public function force_cache_fallback($enable = \false) + { + } + /** + * Set the length of time (in seconds) that the contents of a feed will be + * cached + * + * @param int $seconds The feed content cache duration + */ + public function set_cache_duration($seconds = 3600) + { + } + /** + * Set the length of time (in seconds) that the autodiscovered feed URL will + * be cached + * + * @param int $seconds The autodiscovered feed URL cache duration. + */ + public function set_autodiscovery_cache_duration($seconds = 604800) + { + } + /** + * Set the file system location where the cached files should be stored + * + * @param string $location The file system location. + */ + public function set_cache_location($location = './cache') + { + } + /** + * Return the filename (i.e. hash, without path and without extension) of the file to cache a given URL. + * @param string $url The URL of the feed to be cached. + * @return string A filename (i.e. hash, without path and without extension). + */ + public function get_cache_filename($url) + { + } + /** + * Set whether feed items should be sorted into reverse chronological order + * + * @param bool $enable Sort as reverse chronological order. + */ + public function enable_order_by_date($enable = \true) + { + } + /** + * Set the character encoding used to parse the feed + * + * This overrides the encoding reported by the feed, however it will fall + * back to the normal encoding detection if the override fails + * + * @param string $encoding Character encoding + */ + public function set_input_encoding($encoding = \false) + { + } + /** + * Set how much feed autodiscovery to do + * + * @see SIMPLEPIE_LOCATOR_NONE + * @see SIMPLEPIE_LOCATOR_AUTODISCOVERY + * @see SIMPLEPIE_LOCATOR_LOCAL_EXTENSION + * @see SIMPLEPIE_LOCATOR_LOCAL_BODY + * @see SIMPLEPIE_LOCATOR_REMOTE_EXTENSION + * @see SIMPLEPIE_LOCATOR_REMOTE_BODY + * @see SIMPLEPIE_LOCATOR_ALL + * @param int $level Feed Autodiscovery Level (level can be a combination of the above constants, see bitwise OR operator) + */ + public function set_autodiscovery_level($level = \SIMPLEPIE_LOCATOR_ALL) + { + } + /** + * Get the class registry + * + * Use this to override SimplePie's default classes + * @see SimplePie_Registry + * @return SimplePie_Registry + */ + public function &get_registry() + { + } + /**#@+ + * Useful when you are overloading or extending SimplePie's default classes. + * + * @deprecated Use {@see get_registry()} instead + * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation + * @param string $class Name of custom class + * @return boolean True on success, false otherwise + */ + /** + * Set which class SimplePie uses for caching + */ + public function set_cache_class($class = 'SimplePie_Cache') + { + } + /** + * Set which class SimplePie uses for auto-discovery + */ + public function set_locator_class($class = 'SimplePie_Locator') + { + } + /** + * Set which class SimplePie uses for XML parsing + */ + public function set_parser_class($class = 'SimplePie_Parser') + { + } + /** + * Set which class SimplePie uses for remote file fetching + */ + public function set_file_class($class = 'SimplePie_File') + { + } + /** + * Set which class SimplePie uses for data sanitization + */ + public function set_sanitize_class($class = 'SimplePie_Sanitize') + { + } + /** + * Set which class SimplePie uses for handling feed items + */ + public function set_item_class($class = 'SimplePie_Item') + { + } + /** + * Set which class SimplePie uses for handling author data + */ + public function set_author_class($class = 'SimplePie_Author') + { + } + /** + * Set which class SimplePie uses for handling category data + */ + public function set_category_class($class = 'SimplePie_Category') + { + } + /** + * Set which class SimplePie uses for feed enclosures + */ + public function set_enclosure_class($class = 'SimplePie_Enclosure') + { + } + /** + * Set which class SimplePie uses for `<media:text>` captions + */ + public function set_caption_class($class = 'SimplePie_Caption') + { + } + /** + * Set which class SimplePie uses for `<media:copyright>` + */ + public function set_copyright_class($class = 'SimplePie_Copyright') + { + } + /** + * Set which class SimplePie uses for `<media:credit>` + */ + public function set_credit_class($class = 'SimplePie_Credit') + { + } + /** + * Set which class SimplePie uses for `<media:rating>` + */ + public function set_rating_class($class = 'SimplePie_Rating') + { + } + /** + * Set which class SimplePie uses for `<media:restriction>` + */ + public function set_restriction_class($class = 'SimplePie_Restriction') + { + } + /** + * Set which class SimplePie uses for content-type sniffing + */ + public function set_content_type_sniffer_class($class = 'SimplePie_Content_Type_Sniffer') + { + } + /** + * Set which class SimplePie uses item sources + */ + public function set_source_class($class = 'SimplePie_Source') + { + } + /**#@-*/ + /** + * Set the user agent string + * + * @param string $ua New user agent string. + */ + public function set_useragent($ua = \SIMPLEPIE_USERAGENT) + { + } + /** + * Set callback function to create cache filename with + * + * @param mixed $function Callback function + */ + public function set_cache_name_function($function = 'md5') + { + } + /** + * Set options to make SimplePie as fast as possible. + * + * Forgoes a substantial amount of data sanitization in favor of speed. + * This turns SimplePie into a less clever parser of feeds. + * + * @param bool $set Whether to set them or not. + */ + public function set_stupidly_fast($set = \false) + { + } + /** + * Set maximum number of feeds to check with autodiscovery + * + * @param int $max Maximum number of feeds to check + */ + public function set_max_checked_feeds($max = 10) + { + } + public function remove_div($enable = \true) + { + } + public function strip_htmltags($tags = '', $encode = \null) + { + } + public function encode_instead_of_strip($enable = \true) + { + } + public function strip_attributes($attribs = '') + { + } + public function add_attributes($attribs = '') + { + } + /** + * Set the output encoding + * + * Allows you to override SimplePie's output to match that of your webpage. + * This is useful for times when your webpages are not being served as + * UTF-8. This setting will be obeyed by {@see handle_content_type()}, and + * is similar to {@see set_input_encoding()}. + * + * It should be noted, however, that not all character encodings can support + * all characters. If your page is being served as ISO-8859-1 and you try + * to display a Japanese feed, you'll likely see garbled characters. + * Because of this, it is highly recommended to ensure that your webpages + * are served as UTF-8. + * + * The number of supported character encodings depends on whether your web + * host supports {@link http://php.net/mbstring mbstring}, + * {@link http://php.net/iconv iconv}, or both. See + * {@link http://simplepie.org/wiki/faq/Supported_Character_Encodings} for + * more information. + * + * @param string $encoding + */ + public function set_output_encoding($encoding = 'UTF-8') + { + } + public function strip_comments($strip = \false) + { + } + /** + * Set element/attribute key/value pairs of HTML attributes + * containing URLs that need to be resolved relative to the feed + * + * Defaults to |a|@href, |area|@href, |blockquote|@cite, |del|@cite, + * |form|@action, |img|@longdesc, |img|@src, |input|@src, |ins|@cite, + * |q|@cite + * + * @since 1.0 + * @param array|null $element_attribute Element/attribute key/value pairs, null for default + */ + public function set_url_replacements($element_attribute = \null) + { + } + /** + * Set the list of domains for which to force HTTPS. + * @see SimplePie_Sanitize::set_https_domains() + * @param array List of HTTPS domains. Example array('biz', 'example.com', 'example.org', 'www.example.net'). + */ + public function set_https_domains($domains = array()) + { + } + /** + * Set the handler to enable the display of cached images. + * + * @param string $page Web-accessible path to the handler_image.php file. + * @param string $qs The query string that the value should be passed to. + */ + public function set_image_handler($page = \false, $qs = 'i') + { + } + /** + * Set the limit for items returned per-feed with multifeeds + * + * @param integer $limit The maximum number of items to return. + */ + public function set_item_limit($limit = 0) + { + } + /** + * Enable throwing exceptions + * + * @param boolean $enable Should we throw exceptions, or use the old-style error property? + */ + public function enable_exceptions($enable = \true) + { + } + /** + * Initialize the feed object + * + * This is what makes everything happen. Period. This is where all of the + * configuration options get processed, feeds are fetched, cached, and + * parsed, and all of that other good stuff. + * + * @return boolean True if successful, false otherwise + */ + public function init() + { + } + /** + * Fetch the data via SimplePie_File + * + * If the data is already cached, attempt to fetch it from there instead + * @param SimplePie_Cache_Base|false $cache Cache handler, or false to not load from the cache + * @return array|true Returns true if the data was loaded from the cache, or an array of HTTP headers and sniffed type + */ + protected function fetch_data(&$cache) + { + } + /** + * Get the error message for the occurred error + * + * @return string|array Error message, or array of messages for multifeeds + */ + public function error() + { + } + /** + * Get the last HTTP status code + * + * @return int Status code + */ + public function status_code() + { + } + /** + * Get the raw XML + * + * This is the same as the old `$feed->enable_xml_dump(true)`, but returns + * the data instead of printing it. + * + * @return string|boolean Raw XML data, false if the cache is used + */ + public function get_raw_data() + { + } + /** + * Get the character encoding used for output + * + * @since Preview Release + * @return string + */ + public function get_encoding() + { + } + /** + * Send the Content-Type header with correct encoding + * + * This method ensures that the SimplePie-enabled page is being served with + * the correct {@link http://www.iana.org/assignments/media-types/ mime-type} + * and character encoding HTTP headers (character encoding determined by the + * {@see set_output_encoding} config option). + * + * This won't work properly if any content or whitespace has already been + * sent to the browser, because it relies on PHP's + * {@link http://php.net/header header()} function, and these are the + * circumstances under which the function works. + * + * Because it's setting these settings for the entire page (as is the nature + * of HTTP headers), this should only be used once per page (again, at the + * top). + * + * @param string $mime MIME type to serve the page as + */ + public function handle_content_type($mime = 'text/html') + { + } + /** + * Get the type of the feed + * + * This returns a SIMPLEPIE_TYPE_* constant, which can be tested against + * using {@link http://php.net/language.operators.bitwise bitwise operators} + * + * @since 0.8 (usage changed to using constants in 1.0) + * @see SIMPLEPIE_TYPE_NONE Unknown. + * @see SIMPLEPIE_TYPE_RSS_090 RSS 0.90. + * @see SIMPLEPIE_TYPE_RSS_091_NETSCAPE RSS 0.91 (Netscape). + * @see SIMPLEPIE_TYPE_RSS_091_USERLAND RSS 0.91 (Userland). + * @see SIMPLEPIE_TYPE_RSS_091 RSS 0.91. + * @see SIMPLEPIE_TYPE_RSS_092 RSS 0.92. + * @see SIMPLEPIE_TYPE_RSS_093 RSS 0.93. + * @see SIMPLEPIE_TYPE_RSS_094 RSS 0.94. + * @see SIMPLEPIE_TYPE_RSS_10 RSS 1.0. + * @see SIMPLEPIE_TYPE_RSS_20 RSS 2.0.x. + * @see SIMPLEPIE_TYPE_RSS_RDF RDF-based RSS. + * @see SIMPLEPIE_TYPE_RSS_SYNDICATION Non-RDF-based RSS (truly intended as syndication format). + * @see SIMPLEPIE_TYPE_RSS_ALL Any version of RSS. + * @see SIMPLEPIE_TYPE_ATOM_03 Atom 0.3. + * @see SIMPLEPIE_TYPE_ATOM_10 Atom 1.0. + * @see SIMPLEPIE_TYPE_ATOM_ALL Any version of Atom. + * @see SIMPLEPIE_TYPE_ALL Any known/supported feed type. + * @return int SIMPLEPIE_TYPE_* constant + */ + public function get_type() + { + } + /** + * Get the URL for the feed + * + * When the 'permanent' mode is enabled, returns the original feed URL, + * except in the case of an `HTTP 301 Moved Permanently` status response, + * in which case the location of the first redirection is returned. + * + * When the 'permanent' mode is disabled (default), + * may or may not be different from the URL passed to {@see set_feed_url()}, + * depending on whether auto-discovery was used, and whether there were + * any redirects along the way. + * + * @since Preview Release (previously called `get_feed_url()` since SimplePie 0.8.) + * @todo Support <itunes:new-feed-url> + * @todo Also, |atom:link|@rel=self + * @param bool $permanent Permanent mode to return only the original URL or the first redirection + * iff it is a 301 redirection + * @return string|null + */ + public function subscribe_url($permanent = \false) + { + } + /** + * Get data for an feed-level element + * + * This method allows you to get access to ANY element/attribute that is a + * sub-element of the opening feed tag. + * + * The return value is an indexed array of elements matching the given + * namespace and tag name. Each element has `attribs`, `data` and `child` + * subkeys. For `attribs` and `child`, these contain namespace subkeys. + * `attribs` then has one level of associative name => value data (where + * `value` is a string) after the namespace. `child` has tag-indexed keys + * after the namespace, each member of which is an indexed array matching + * this same format. + * + * For example: + * <pre> + * // This is probably a bad example because we already support + * // <media:content> natively, but it shows you how to parse through + * // the nodes. + * $group = $item->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'group'); + * $content = $group[0]['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content']; + * $file = $content[0]['attribs']['']['url']; + * echo $file; + * </pre> + * + * @since 1.0 + * @see http://simplepie.org/wiki/faq/supported_xml_namespaces + * @param string $namespace The URL of the XML namespace of the elements you're trying to access + * @param string $tag Tag name + * @return array + */ + public function get_feed_tags($namespace, $tag) + { + } + /** + * Get data for an channel-level element + * + * This method allows you to get access to ANY element/attribute in the + * channel/header section of the feed. + * + * See {@see SimplePie::get_feed_tags()} for a description of the return value + * + * @since 1.0 + * @see http://simplepie.org/wiki/faq/supported_xml_namespaces + * @param string $namespace The URL of the XML namespace of the elements you're trying to access + * @param string $tag Tag name + * @return array + */ + public function get_channel_tags($namespace, $tag) + { + } + /** + * Get data for an channel-level element + * + * This method allows you to get access to ANY element/attribute in the + * image/logo section of the feed. + * + * See {@see SimplePie::get_feed_tags()} for a description of the return value + * + * @since 1.0 + * @see http://simplepie.org/wiki/faq/supported_xml_namespaces + * @param string $namespace The URL of the XML namespace of the elements you're trying to access + * @param string $tag Tag name + * @return array + */ + public function get_image_tags($namespace, $tag) + { + } + /** + * Get the base URL value from the feed + * + * Uses `<xml:base>` if available, otherwise uses the first link in the + * feed, or failing that, the URL of the feed itself. + * + * @see get_link + * @see subscribe_url + * + * @param array $element + * @return string + */ + public function get_base($element = array()) + { + } + /** + * Sanitize feed data + * + * @access private + * @see SimplePie_Sanitize::sanitize() + * @param string $data Data to sanitize + * @param int $type One of the SIMPLEPIE_CONSTRUCT_* constants + * @param string $base Base URL to resolve URLs against + * @return string Sanitized data + */ + public function sanitize($data, $type, $base = '') + { + } + /** + * Get the title of the feed + * + * Uses `<atom:title>`, `<title>` or `<dc:title>` + * + * @since 1.0 (previously called `get_feed_title` since 0.8) + * @return string|null + */ + public function get_title() + { + } + /** + * Get a category for the feed + * + * @since Unknown + * @param int $key The category that you want to return. Remember that arrays begin with 0, not 1 + * @return SimplePie_Category|null + */ + public function get_category($key = 0) + { + } + /** + * Get all categories for the feed + * + * Uses `<atom:category>`, `<category>` or `<dc:subject>` + * + * @since Unknown + * @return array|null List of {@see SimplePie_Category} objects + */ + public function get_categories() + { + } + /** + * Get an author for the feed + * + * @since 1.1 + * @param int $key The author that you want to return. Remember that arrays begin with 0, not 1 + * @return SimplePie_Author|null + */ + public function get_author($key = 0) + { + } + /** + * Get all authors for the feed + * + * Uses `<atom:author>`, `<author>`, `<dc:creator>` or `<itunes:author>` + * + * @since 1.1 + * @return array|null List of {@see SimplePie_Author} objects + */ + public function get_authors() + { + } + /** + * Get a contributor for the feed + * + * @since 1.1 + * @param int $key The contrbutor that you want to return. Remember that arrays begin with 0, not 1 + * @return SimplePie_Author|null + */ + public function get_contributor($key = 0) + { + } + /** + * Get all contributors for the feed + * + * Uses `<atom:contributor>` + * + * @since 1.1 + * @return array|null List of {@see SimplePie_Author} objects + */ + public function get_contributors() + { + } + /** + * Get a single link for the feed + * + * @since 1.0 (previously called `get_feed_link` since Preview Release, `get_feed_permalink()` since 0.8) + * @param int $key The link that you want to return. Remember that arrays begin with 0, not 1 + * @param string $rel The relationship of the link to return + * @return string|null Link URL + */ + public function get_link($key = 0, $rel = 'alternate') + { + } + /** + * Get the permalink for the item + * + * Returns the first link available with a relationship of "alternate". + * Identical to {@see get_link()} with key 0 + * + * @see get_link + * @since 1.0 (previously called `get_feed_link` since Preview Release, `get_feed_permalink()` since 0.8) + * @internal Added for parity between the parent-level and the item/entry-level. + * @return string|null Link URL + */ + public function get_permalink() + { + } + /** + * Get all links for the feed + * + * Uses `<atom:link>` or `<link>` + * + * @since Beta 2 + * @param string $rel The relationship of links to return + * @return array|null Links found for the feed (strings) + */ + public function get_links($rel = 'alternate') + { + } + public function get_all_discovered_feeds() + { + } + /** + * Get the content for the item + * + * Uses `<atom:subtitle>`, `<atom:tagline>`, `<description>`, + * `<dc:description>`, `<itunes:summary>` or `<itunes:subtitle>` + * + * @since 1.0 (previously called `get_feed_description()` since 0.8) + * @return string|null + */ + public function get_description() + { + } + /** + * Get the copyright info for the feed + * + * Uses `<atom:rights>`, `<atom:copyright>` or `<dc:rights>` + * + * @since 1.0 (previously called `get_feed_copyright()` since 0.8) + * @return string|null + */ + public function get_copyright() + { + } + /** + * Get the language for the feed + * + * Uses `<language>`, `<dc:language>`, or @xml_lang + * + * @since 1.0 (previously called `get_feed_language()` since 0.8) + * @return string|null + */ + public function get_language() + { + } + /** + * Get the latitude coordinates for the item + * + * Compatible with the W3C WGS84 Basic Geo and GeoRSS specifications + * + * Uses `<geo:lat>` or `<georss:point>` + * + * @since 1.0 + * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo + * @link http://www.georss.org/ GeoRSS + * @return string|null + */ + public function get_latitude() + { + } + /** + * Get the longitude coordinates for the feed + * + * Compatible with the W3C WGS84 Basic Geo and GeoRSS specifications + * + * Uses `<geo:long>`, `<geo:lon>` or `<georss:point>` + * + * @since 1.0 + * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo + * @link http://www.georss.org/ GeoRSS + * @return string|null + */ + public function get_longitude() + { + } + /** + * Get the feed logo's title + * + * RSS 0.9.0, 1.0 and 2.0 feeds are allowed to have a "feed logo" title. + * + * Uses `<image><title>` or `<image><dc:title>` + * + * @return string|null + */ + public function get_image_title() + { + } + /** + * Get the feed logo's URL + * + * RSS 0.9.0, 2.0, Atom 1.0, and feeds with iTunes RSS tags are allowed to + * have a "feed logo" URL. This points directly to the image itself. + * + * Uses `<itunes:image>`, `<atom:logo>`, `<atom:icon>`, + * `<image><title>` or `<image><dc:title>` + * + * @return string|null + */ + public function get_image_url() + { + } + /** + * Get the feed logo's link + * + * RSS 0.9.0, 1.0 and 2.0 feeds are allowed to have a "feed logo" link. This + * points to a human-readable page that the image should link to. + * + * Uses `<itunes:image>`, `<atom:logo>`, `<atom:icon>`, + * `<image><title>` or `<image><dc:title>` + * + * @return string|null + */ + public function get_image_link() + { + } + /** + * Get the feed logo's link + * + * RSS 2.0 feeds are allowed to have a "feed logo" width. + * + * Uses `<image><width>` or defaults to 88.0 if no width is specified and + * the feed is an RSS 2.0 feed. + * + * @return int|float|null + */ + public function get_image_width() + { + } + /** + * Get the feed logo's height + * + * RSS 2.0 feeds are allowed to have a "feed logo" height. + * + * Uses `<image><height>` or defaults to 31.0 if no height is specified and + * the feed is an RSS 2.0 feed. + * + * @return int|float|null + */ + public function get_image_height() + { + } + /** + * Get the number of items in the feed + * + * This is well-suited for {@link http://php.net/for for()} loops with + * {@see get_item()} + * + * @param int $max Maximum value to return. 0 for no limit + * @return int Number of items in the feed + */ + public function get_item_quantity($max = 0) + { + } + /** + * Get a single item from the feed + * + * This is better suited for {@link http://php.net/for for()} loops, whereas + * {@see get_items()} is better suited for + * {@link http://php.net/foreach foreach()} loops. + * + * @see get_item_quantity() + * @since Beta 2 + * @param int $key The item that you want to return. Remember that arrays begin with 0, not 1 + * @return SimplePie_Item|null + */ + public function get_item($key = 0) + { + } + /** + * Get all items from the feed + * + * This is better suited for {@link http://php.net/for for()} loops, whereas + * {@see get_items()} is better suited for + * {@link http://php.net/foreach foreach()} loops. + * + * @see get_item_quantity + * @since Beta 2 + * @param int $start Index to start at + * @param int $end Number of items to return. 0 for all items after `$start` + * @return SimplePie_Item[]|null List of {@see SimplePie_Item} objects + */ + public function get_items($start = 0, $end = 0) + { + } + /** + * Set the favicon handler + * + * @deprecated Use your own favicon handling instead + */ + public function set_favicon_handler($page = \false, $qs = 'i') + { + } + /** + * Get the favicon for the current feed + * + * @deprecated Use your own favicon handling instead + */ + public function get_favicon() + { + } + /** + * Magic method handler + * + * @param string $method Method name + * @param array $args Arguments to the method + * @return mixed + */ + public function __call($method, $args) + { + } + /** + * Sorting callback for items + * + * @access private + * @param SimplePie $a + * @param SimplePie $b + * @return boolean + */ + public static function sort_items($a, $b) + { + } + /** + * Merge items from several feeds into one + * + * If you're merging multiple feeds together, they need to all have dates + * for the items or else SimplePie will refuse to sort them. + * + * @link http://simplepie.org/wiki/tutorial/sort_multiple_feeds_by_time_and_date#if_feeds_require_separate_per-feed_settings + * @param array $urls List of SimplePie feed objects to merge + * @param int $start Starting item + * @param int $end Number of items to return + * @param int $limit Maximum number of items per feed + * @return array + */ + public static function merge_items($urls, $start = 0, $end = 0, $limit = 0) + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * SimplePie class. + * + * Class for backward compatibility. + * + * @deprecated Use {@see SimplePie} directly + * @package SimplePie + * @subpackage API + */ + class SimplePie_Core extends \SimplePie + { + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Handles `<media:credit>` as defined in Media RSS + * + * Used by {@see SimplePie_Enclosure::get_credit()} and {@see SimplePie_Enclosure::get_credits()} + * + * This class can be overloaded with {@see SimplePie::set_credit_class()} + * + * @package SimplePie + * @subpackage API + */ + class SimplePie_Credit + { + /** + * Credited role + * + * @var string + * @see get_role() + */ + var $role; + /** + * Organizational scheme + * + * @var string + * @see get_scheme() + */ + var $scheme; + /** + * Credited name + * + * @var string + * @see get_name() + */ + var $name; + /** + * Constructor, used to input the data + * + * For documentation on all the parameters, see the corresponding + * properties and their accessors + */ + public function __construct($role = \null, $scheme = \null, $name = \null) + { + } + /** + * String-ified version + * + * @return string + */ + public function __toString() + { + } + /** + * Get the role of the person receiving credit + * + * @return string|null + */ + public function get_role() + { + } + /** + * Get the organizational scheme + * + * @return string|null + */ + public function get_scheme() + { + } + /** + * Get the credited person/entity's name + * + * @return string|null + */ + public function get_name() + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Decode HTML Entities + * + * This implements HTML5 as of revision 967 (2007-06-28) + * + * @deprecated Use DOMDocument instead! + * @package SimplePie + */ + class SimplePie_Decode_HTML_Entities + { + /** + * Data to be parsed + * + * @access private + * @var string + */ + var $data = ''; + /** + * Currently consumed bytes + * + * @access private + * @var string + */ + var $consumed = ''; + /** + * Position of the current byte being parsed + * + * @access private + * @var int + */ + var $position = 0; + /** + * Create an instance of the class with the input data + * + * @access public + * @param string $data Input data + */ + public function __construct($data) + { + } + /** + * Parse the input data + * + * @access public + * @return string Output data + */ + public function parse() + { + } + /** + * Consume the next byte + * + * @access private + * @return mixed The next byte, or false, if there is no more data + */ + public function consume() + { + } + /** + * Consume a range of characters + * + * @access private + * @param string $chars Characters to consume + * @return mixed A series of characters that match the range, or false + */ + public function consume_range($chars) + { + } + /** + * Unconsume one byte + * + * @access private + */ + public function unconsume() + { + } + /** + * Decode an entity + * + * @access private + */ + public function entity() + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Handles everything related to enclosures (including Media RSS and iTunes RSS) + * + * Used by {@see SimplePie_Item::get_enclosure()} and {@see SimplePie_Item::get_enclosures()} + * + * This class can be overloaded with {@see SimplePie::set_enclosure_class()} + * + * @package SimplePie + * @subpackage API + */ + class SimplePie_Enclosure + { + /** + * @var string + * @see get_bitrate() + */ + var $bitrate; + /** + * @var array + * @see get_captions() + */ + var $captions; + /** + * @var array + * @see get_categories() + */ + var $categories; + /** + * @var int + * @see get_channels() + */ + var $channels; + /** + * @var SimplePie_Copyright + * @see get_copyright() + */ + var $copyright; + /** + * @var array + * @see get_credits() + */ + var $credits; + /** + * @var string + * @see get_description() + */ + var $description; + /** + * @var int + * @see get_duration() + */ + var $duration; + /** + * @var string + * @see get_expression() + */ + var $expression; + /** + * @var string + * @see get_framerate() + */ + var $framerate; + /** + * @var string + * @see get_handler() + */ + var $handler; + /** + * @var array + * @see get_hashes() + */ + var $hashes; + /** + * @var string + * @see get_height() + */ + var $height; + /** + * @deprecated + * @var null + */ + var $javascript; + /** + * @var array + * @see get_keywords() + */ + var $keywords; + /** + * @var string + * @see get_language() + */ + var $lang; + /** + * @var string + * @see get_length() + */ + var $length; + /** + * @var string + * @see get_link() + */ + var $link; + /** + * @var string + * @see get_medium() + */ + var $medium; + /** + * @var string + * @see get_player() + */ + var $player; + /** + * @var array + * @see get_ratings() + */ + var $ratings; + /** + * @var array + * @see get_restrictions() + */ + var $restrictions; + /** + * @var string + * @see get_sampling_rate() + */ + var $samplingrate; + /** + * @var array + * @see get_thumbnails() + */ + var $thumbnails; + /** + * @var string + * @see get_title() + */ + var $title; + /** + * @var string + * @see get_type() + */ + var $type; + /** + * @var string + * @see get_width() + */ + var $width; + /** + * Constructor, used to input the data + * + * For documentation on all the parameters, see the corresponding + * properties and their accessors + * + * @uses idna_convert If available, this will convert an IDN + */ + public function __construct($link = \null, $type = \null, $length = \null, $javascript = \null, $bitrate = \null, $captions = \null, $categories = \null, $channels = \null, $copyright = \null, $credits = \null, $description = \null, $duration = \null, $expression = \null, $framerate = \null, $hashes = \null, $height = \null, $keywords = \null, $lang = \null, $medium = \null, $player = \null, $ratings = \null, $restrictions = \null, $samplingrate = \null, $thumbnails = \null, $title = \null, $width = \null) + { + } + /** + * String-ified version + * + * @return string + */ + public function __toString() + { + } + /** + * Get the bitrate + * + * @return string|null + */ + public function get_bitrate() + { + } + /** + * Get a single caption + * + * @param int $key + * @return SimplePie_Caption|null + */ + public function get_caption($key = 0) + { + } + /** + * Get all captions + * + * @return array|null Array of {@see SimplePie_Caption} objects + */ + public function get_captions() + { + } + /** + * Get a single category + * + * @param int $key + * @return SimplePie_Category|null + */ + public function get_category($key = 0) + { + } + /** + * Get all categories + * + * @return array|null Array of {@see SimplePie_Category} objects + */ + public function get_categories() + { + } + /** + * Get the number of audio channels + * + * @return int|null + */ + public function get_channels() + { + } + /** + * Get the copyright information + * + * @return SimplePie_Copyright|null + */ + public function get_copyright() + { + } + /** + * Get a single credit + * + * @param int $key + * @return SimplePie_Credit|null + */ + public function get_credit($key = 0) + { + } + /** + * Get all credits + * + * @return array|null Array of {@see SimplePie_Credit} objects + */ + public function get_credits() + { + } + /** + * Get the description of the enclosure + * + * @return string|null + */ + public function get_description() + { + } + /** + * Get the duration of the enclosure + * + * @param bool $convert Convert seconds into hh:mm:ss + * @return string|int|null 'hh:mm:ss' string if `$convert` was specified, otherwise integer (or null if none found) + */ + public function get_duration($convert = \false) + { + } + /** + * Get the expression + * + * @return string Probably one of 'sample', 'full', 'nonstop', 'clip'. Defaults to 'full' + */ + public function get_expression() + { + } + /** + * Get the file extension + * + * @return string|null + */ + public function get_extension() + { + } + /** + * Get the framerate (in frames-per-second) + * + * @return string|null + */ + public function get_framerate() + { + } + /** + * Get the preferred handler + * + * @return string|null One of 'flash', 'fmedia', 'quicktime', 'wmedia', 'mp3' + */ + public function get_handler() + { + } + /** + * Get a single hash + * + * @link http://www.rssboard.org/media-rss#media-hash + * @param int $key + * @return string|null Hash as per `media:hash`, prefixed with "$algo:" + */ + public function get_hash($key = 0) + { + } + /** + * Get all credits + * + * @return array|null Array of strings, see {@see get_hash()} + */ + public function get_hashes() + { + } + /** + * Get the height + * + * @return string|null + */ + public function get_height() + { + } + /** + * Get the language + * + * @link http://tools.ietf.org/html/rfc3066 + * @return string|null Language code as per RFC 3066 + */ + public function get_language() + { + } + /** + * Get a single keyword + * + * @param int $key + * @return string|null + */ + public function get_keyword($key = 0) + { + } + /** + * Get all keywords + * + * @return array|null Array of strings + */ + public function get_keywords() + { + } + /** + * Get length + * + * @return float Length in bytes + */ + public function get_length() + { + } + /** + * Get the URL + * + * @return string|null + */ + public function get_link() + { + } + /** + * Get the medium + * + * @link http://www.rssboard.org/media-rss#media-content + * @return string|null Should be one of 'image', 'audio', 'video', 'document', 'executable' + */ + public function get_medium() + { + } + /** + * Get the player URL + * + * Typically the same as {@see get_permalink()} + * @return string|null Player URL + */ + public function get_player() + { + } + /** + * Get a single rating + * + * @param int $key + * @return SimplePie_Rating|null + */ + public function get_rating($key = 0) + { + } + /** + * Get all ratings + * + * @return array|null Array of {@see SimplePie_Rating} objects + */ + public function get_ratings() + { + } + /** + * Get a single restriction + * + * @param int $key + * @return SimplePie_Restriction|null + */ + public function get_restriction($key = 0) + { + } + /** + * Get all restrictions + * + * @return array|null Array of {@see SimplePie_Restriction} objects + */ + public function get_restrictions() + { + } + /** + * Get the sampling rate (in kHz) + * + * @return string|null + */ + public function get_sampling_rate() + { + } + /** + * Get the file size (in MiB) + * + * @return float|null File size in mebibytes (1048 bytes) + */ + public function get_size() + { + } + /** + * Get a single thumbnail + * + * @param int $key + * @return string|null Thumbnail URL + */ + public function get_thumbnail($key = 0) + { + } + /** + * Get all thumbnails + * + * @return array|null Array of thumbnail URLs + */ + public function get_thumbnails() + { + } + /** + * Get the title + * + * @return string|null + */ + public function get_title() + { + } + /** + * Get mimetype of the enclosure + * + * @see get_real_type() + * @return string|null MIME type + */ + public function get_type() + { + } + /** + * Get the width + * + * @return string|null + */ + public function get_width() + { + } + /** + * Embed the enclosure using `<embed>` + * + * @deprecated Use the second parameter to {@see embed} instead + * + * @param array|string $options See first paramter to {@see embed} + * @return string HTML string to output + */ + public function native_embed($options = '') + { + } + /** + * Embed the enclosure using Javascript + * + * `$options` is an array or comma-separated key:value string, with the + * following properties: + * + * - `alt` (string): Alternate content for when an end-user does not have + * the appropriate handler installed or when a file type is + * unsupported. Can be any text or HTML. Defaults to blank. + * - `altclass` (string): If a file type is unsupported, the end-user will + * see the alt text (above) linked directly to the content. That link + * will have this value as its class name. Defaults to blank. + * - `audio` (string): This is an image that should be used as a + * placeholder for audio files before they're loaded (QuickTime-only). + * Can be any relative or absolute URL. Defaults to blank. + * - `bgcolor` (string): The background color for the media, if not + * already transparent. Defaults to `#ffffff`. + * - `height` (integer): The height of the embedded media. Accepts any + * numeric pixel value (such as `360`) or `auto`. Defaults to `auto`, + * and it is recommended that you use this default. + * - `loop` (boolean): Do you want the media to loop when it's done? + * Defaults to `false`. + * - `mediaplayer` (string): The location of the included + * `mediaplayer.swf` file. This allows for the playback of Flash Video + * (`.flv`) files, and is the default handler for non-Odeo MP3's. + * Defaults to blank. + * - `video` (string): This is an image that should be used as a + * placeholder for video files before they're loaded (QuickTime-only). + * Can be any relative or absolute URL. Defaults to blank. + * - `width` (integer): The width of the embedded media. Accepts any + * numeric pixel value (such as `480`) or `auto`. Defaults to `auto`, + * and it is recommended that you use this default. + * - `widescreen` (boolean): Is the enclosure widescreen or standard? + * This applies only to video enclosures, and will automatically resize + * the content appropriately. Defaults to `false`, implying 4:3 mode. + * + * Note: Non-widescreen (4:3) mode with `width` and `height` set to `auto` + * will default to 480x360 video resolution. Widescreen (16:9) mode with + * `width` and `height` set to `auto` will default to 480x270 video resolution. + * + * @todo If the dimensions for media:content are defined, use them when width/height are set to 'auto'. + * @param array|string $options Comma-separated key:value list, or array + * @param bool $native Use `<embed>` + * @return string HTML string to output + */ + public function embed($options = '', $native = \false) + { + } + /** + * Get the real media type + * + * Often, feeds lie to us, necessitating a bit of deeper inspection. This + * converts types to their canonical representations based on the file + * extension + * + * @see get_type() + * @param bool $find_handler Internal use only, use {@see get_handler()} instead + * @return string MIME type + */ + public function get_real_type($find_handler = \false) + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * General SimplePie exception class + * + * @package SimplePie + */ + class SimplePie_Exception extends \Exception + { + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Used for fetching remote files and reading local files + * + * Supports HTTP 1.0 via cURL or fsockopen, with spotty HTTP 1.1 support + * + * This class can be overloaded with {@see SimplePie::set_file_class()} + * + * @package SimplePie + * @subpackage HTTP + * @todo Move to properly supporting RFC2616 (HTTP/1.1) + */ + class SimplePie_File + { + var $url; + var $useragent; + var $success = \true; + var $headers = array(); + var $body; + var $status_code; + var $redirects = 0; + var $error; + var $method = \SIMPLEPIE_FILE_SOURCE_NONE; + var $permanent_url; + public function __construct($url, $timeout = 10, $redirects = 5, $headers = \null, $useragent = \null, $force_fsockopen = \false, $curl_options = array()) + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * HTTP Response Parser + * + * @package SimplePie + * @subpackage HTTP + */ + class SimplePie_HTTP_Parser + { + /** + * HTTP Version + * + * @var float + */ + public $http_version = 0.0; + /** + * Status code + * + * @var int + */ + public $status_code = 0; + /** + * Reason phrase + * + * @var string + */ + public $reason = ''; + /** + * Key/value pairs of the headers + * + * @var array + */ + public $headers = array(); + /** + * Body of the response + * + * @var string + */ + public $body = ''; + /** + * Current state of the state machine + * + * @var string + */ + protected $state = 'http_version'; + /** + * Input data + * + * @var string + */ + protected $data = ''; + /** + * Input data length (to avoid calling strlen() everytime this is needed) + * + * @var int + */ + protected $data_length = 0; + /** + * Current position of the pointer + * + * @var int + */ + protected $position = 0; + /** + * Name of the hedaer currently being parsed + * + * @var string + */ + protected $name = ''; + /** + * Value of the hedaer currently being parsed + * + * @var string + */ + protected $value = ''; + /** + * Create an instance of the class with the input data + * + * @param string $data Input data + */ + public function __construct($data) + { + } + /** + * Parse the input data + * + * @return bool true on success, false on failure + */ + public function parse() + { + } + /** + * Check whether there is data beyond the pointer + * + * @return bool true if there is further data, false if not + */ + protected function has_data() + { + } + /** + * See if the next character is LWS + * + * @return bool true if the next character is LWS, false if not + */ + protected function is_linear_whitespace() + { + } + /** + * Parse the HTTP version + */ + protected function http_version() + { + } + /** + * Parse the status code + */ + protected function status() + { + } + /** + * Parse the reason phrase + */ + protected function reason() + { + } + /** + * Deal with a new line, shifting data around as needed + */ + protected function new_line() + { + } + /** + * Parse a header name + */ + protected function name() + { + } + /** + * Parse LWS, replacing consecutive LWS characters with a single space + */ + protected function linear_whitespace() + { + } + /** + * See what state to move to while within non-quoted header values + */ + protected function value() + { + } + /** + * Parse a header value while outside quotes + */ + protected function value_char() + { + } + /** + * See what state to move to while within quoted header values + */ + protected function quote() + { + } + /** + * Parse a header value while within quotes + */ + protected function quote_char() + { + } + /** + * Parse an escaped character within quotes + */ + protected function quote_escaped() + { + } + /** + * Parse the body + */ + protected function body() + { + } + /** + * Parsed a "Transfer-Encoding: chunked" body + * @phpstan-return void + */ + protected function chunked() + { + } + /** + * Prepare headers (take care of proxies headers) + * + * @param string $headers Raw headers + * @param integer $count Redirection count. Default to 1. + * + * @return string + */ + public static function prepareHeaders($headers, $count = 1) + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * IRI parser/serialiser/normaliser + * + * @package SimplePie + * @subpackage HTTP + * @author Sam Sneddon + * @author Steve Minutillo + * @author Ryan McCue + * @copyright 2007-2012 Sam Sneddon, Steve Minutillo, Ryan McCue + * @license http://www.opensource.org/licenses/bsd-license.php + */ + class SimplePie_IRI + { + /** + * Scheme + * + * @var string + */ + protected $scheme = \null; + /** + * User Information + * + * @var string + */ + protected $iuserinfo = \null; + /** + * ihost + * + * @var string + */ + protected $ihost = \null; + /** + * Port + * + * @var string + */ + protected $port = \null; + /** + * ipath + * + * @var string + */ + protected $ipath = ''; + /** + * iquery + * + * @var string + */ + protected $iquery = \null; + /** + * ifragment + * + * @var string + */ + protected $ifragment = \null; + /** + * Normalization database + * + * Each key is the scheme, each value is an array with each key as the IRI + * part and value as the default value for that part. + */ + protected $normalization = array('acap' => array('port' => 674), 'dict' => array('port' => 2628), 'file' => array('ihost' => 'localhost'), 'http' => array('port' => 80, 'ipath' => '/'), 'https' => array('port' => 443, 'ipath' => '/')); + /** + * Return the entire IRI when you try and read the object as a string + * + * @return string + */ + public function __toString() + { + } + /** + * Overload __set() to provide access via properties + * + * @param string $name Property name + * @param mixed $value Property value + */ + public function __set($name, $value) + { + } + /** + * Overload __get() to provide access via properties + * + * @param string $name Property name + * @return mixed + */ + public function __get($name) + { + } + /** + * Overload __isset() to provide access via properties + * + * @param string $name Property name + * @return bool + */ + public function __isset($name) + { + } + /** + * Overload __unset() to provide access via properties + * + * @param string $name Property name + */ + public function __unset($name) + { + } + /** + * Create a new IRI object, from a specified string + * + * @param string $iri + */ + public function __construct($iri = \null) + { + } + /** + * Clean up + */ + public function __destruct() + { + } + /** + * Create a new IRI object by resolving a relative IRI + * + * Returns false if $base is not absolute, otherwise an IRI. + * + * @param IRI|string $base (Absolute) Base IRI + * @param IRI|string $relative Relative IRI + * @return IRI|false + */ + public static function absolutize($base, $relative) + { + } + /** + * Parse an IRI into scheme/authority/path/query/fragment segments + * + * @param string $iri + * @return array + */ + protected function parse_iri($iri) + { + } + /** + * Remove dot segments from a path + * + * @param string $input + * @return string + */ + protected function remove_dot_segments($input) + { + } + /** + * Replace invalid character with percent encoding + * + * @param string $string Input string + * @param string $extra_chars Valid characters not in iunreserved or + * iprivate (this is ASCII-only) + * @param bool $iprivate Allow iprivate + * @return string + */ + protected function replace_invalid_with_pct_encoding($string, $extra_chars, $iprivate = \false) + { + } + /** + * Callback function for preg_replace_callback. + * + * Removes sequences of percent encoded bytes that represent UTF-8 + * encoded characters in iunreserved + * + * @param array $match PCRE match + * @return string Replacement + */ + protected function remove_iunreserved_percent_encoded($match) + { + } + protected function scheme_normalization() + { + } + /** + * Check if the object represents a valid IRI. This needs to be done on each + * call as some things change depending on another part of the IRI. + * + * @return bool + */ + public function is_valid() + { + } + /** + * Set the entire IRI. Returns true on success, false on failure (if there + * are any invalid characters). + * + * @param string $iri + * @return bool + */ + public function set_iri($iri, $clear_cache = \false) + { + } + /** + * Set the scheme. Returns true on success, false on failure (if there are + * any invalid characters). + * + * @param string $scheme + * @return bool + */ + public function set_scheme($scheme) + { + } + /** + * Set the authority. Returns true on success, false on failure (if there are + * any invalid characters). + * + * @param string $authority + * @return bool + */ + public function set_authority($authority, $clear_cache = \false) + { + } + /** + * Set the iuserinfo. + * + * @param string $iuserinfo + * @return bool + */ + public function set_userinfo($iuserinfo) + { + } + /** + * Set the ihost. Returns true on success, false on failure (if there are + * any invalid characters). + * + * @param string $ihost + * @return bool + */ + public function set_host($ihost) + { + } + /** + * Set the port. Returns true on success, false on failure (if there are + * any invalid characters). + * + * @param string $port + * @return bool + */ + public function set_port($port) + { + } + /** + * Set the ipath. + * + * @param string $ipath + * @return bool + */ + public function set_path($ipath, $clear_cache = \false) + { + } + /** + * Set the iquery. + * + * @param string $iquery + * @return bool + */ + public function set_query($iquery) + { + } + /** + * Set the ifragment. + * + * @param string $ifragment + * @return bool + */ + public function set_fragment($ifragment) + { + } + /** + * Convert an IRI to a URI (or parts thereof) + * + * @return string + */ + public function to_uri($string) + { + } + /** + * Get the complete IRI + * + * @return string + */ + public function get_iri() + { + } + /** + * Get the complete URI + * + * @return string + */ + public function get_uri() + { + } + /** + * Get the complete iauthority + * + * @return string + */ + protected function get_iauthority() + { + } + /** + * Get the complete authority + * + * @return string + */ + protected function get_authority() + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Manages all item-related data + * + * Used by {@see SimplePie::get_item()} and {@see SimplePie::get_items()} + * + * This class can be overloaded with {@see SimplePie::set_item_class()} + * + * @package SimplePie + * @subpackage API + */ + class SimplePie_Item + { + /** + * Parent feed + * + * @access private + * @var SimplePie + */ + var $feed; + /** + * Raw data + * + * @access private + * @var array + */ + var $data = array(); + /** + * Registry object + * + * @see set_registry + * @var SimplePie_Registry + */ + protected $registry; + /** + * Create a new item object + * + * This is usually used by {@see SimplePie::get_items} and + * {@see SimplePie::get_item}. Avoid creating this manually. + * + * @param SimplePie $feed Parent feed + * @param array $data Raw data + */ + public function __construct($feed, $data) + { + } + /** + * Set the registry handler + * + * This is usually used by {@see SimplePie_Registry::create} + * + * @since 1.3 + * @param SimplePie_Registry $registry + */ + public function set_registry(\SimplePie_Registry $registry) + { + } + /** + * Get a string representation of the item + * + * @return string + */ + public function __toString() + { + } + /** + * Remove items that link back to this before destroying this object + */ + public function __destruct() + { + } + /** + * Get data for an item-level element + * + * This method allows you to get access to ANY element/attribute that is a + * sub-element of the item/entry tag. + * + * See {@see SimplePie::get_feed_tags()} for a description of the return value + * + * @since 1.0 + * @see http://simplepie.org/wiki/faq/supported_xml_namespaces + * @param string $namespace The URL of the XML namespace of the elements you're trying to access + * @param string $tag Tag name + * @return array + */ + public function get_item_tags($namespace, $tag) + { + } + /** + * Get the base URL value from the parent feed + * + * Uses `<xml:base>` + * + * @param array $element + * @return string + */ + public function get_base($element = array()) + { + } + /** + * Sanitize feed data + * + * @access private + * @see SimplePie::sanitize() + * @param string $data Data to sanitize + * @param int $type One of the SIMPLEPIE_CONSTRUCT_* constants + * @param string $base Base URL to resolve URLs against + * @return string Sanitized data + */ + public function sanitize($data, $type, $base = '') + { + } + /** + * Get the parent feed + * + * Note: this may not work as you think for multifeeds! + * + * @link http://simplepie.org/faq/typical_multifeed_gotchas#missing_data_from_feed + * @since 1.0 + * @return SimplePie + */ + public function get_feed() + { + } + /** + * Get the unique identifier for the item + * + * This is usually used when writing code to check for new items in a feed. + * + * Uses `<atom:id>`, `<guid>`, `<dc:identifier>` or the `about` attribute + * for RDF. If none of these are supplied (or `$hash` is true), creates an + * MD5 hash based on the permalink, title and content. + * + * @since Beta 2 + * @param boolean $hash Should we force using a hash instead of the supplied ID? + * @param string|false $fn User-supplied function to generate an hash + * @return string|null + */ + public function get_id($hash = \false, $fn = 'md5') + { + } + /** + * Get the title of the item + * + * Uses `<atom:title>`, `<title>` or `<dc:title>` + * + * @since Beta 2 (previously called `get_item_title` since 0.8) + * @return string|null + */ + public function get_title() + { + } + /** + * Get the content for the item + * + * Prefers summaries over full content , but will return full content if a + * summary does not exist. + * + * To prefer full content instead, use {@see get_content} + * + * Uses `<atom:summary>`, `<description>`, `<dc:description>` or + * `<itunes:subtitle>` + * + * @since 0.8 + * @param boolean $description_only Should we avoid falling back to the content? + * @return string|null + */ + public function get_description($description_only = \false) + { + } + /** + * Get the content for the item + * + * Prefers full content over summaries, but will return a summary if full + * content does not exist. + * + * To prefer summaries instead, use {@see get_description} + * + * Uses `<atom:content>` or `<content:encoded>` (RSS 1.0 Content Module) + * + * @since 1.0 + * @param boolean $content_only Should we avoid falling back to the description? + * @return string|null + */ + public function get_content($content_only = \false) + { + } + /** + * Get the media:thumbnail of the item + * + * Uses `<media:thumbnail>` + * + * + * @return array|null + */ + public function get_thumbnail() + { + } + /** + * Get a category for the item + * + * @since Beta 3 (previously called `get_categories()` since Beta 2) + * @param int $key The category that you want to return. Remember that arrays begin with 0, not 1 + * @return SimplePie_Category|null + */ + public function get_category($key = 0) + { + } + /** + * Get all categories for the item + * + * Uses `<atom:category>`, `<category>` or `<dc:subject>` + * + * @since Beta 3 + * @return SimplePie_Category[]|null List of {@see SimplePie_Category} objects + */ + public function get_categories() + { + } + /** + * Get an author for the item + * + * @since Beta 2 + * @param int $key The author that you want to return. Remember that arrays begin with 0, not 1 + * @return SimplePie_Author|null + */ + public function get_author($key = 0) + { + } + /** + * Get a contributor for the item + * + * @since 1.1 + * @param int $key The contrbutor that you want to return. Remember that arrays begin with 0, not 1 + * @return SimplePie_Author|null + */ + public function get_contributor($key = 0) + { + } + /** + * Get all contributors for the item + * + * Uses `<atom:contributor>` + * + * @since 1.1 + * @return SimplePie_Author[]|null List of {@see SimplePie_Author} objects + */ + public function get_contributors() + { + } + /** + * Get all authors for the item + * + * Uses `<atom:author>`, `<author>`, `<dc:creator>` or `<itunes:author>` + * + * @since Beta 2 + * @return SimplePie_Author[]|null List of {@see SimplePie_Author} objects + */ + public function get_authors() + { + } + /** + * Get the copyright info for the item + * + * Uses `<atom:rights>` or `<dc:rights>` + * + * @since 1.1 + * @return string + */ + public function get_copyright() + { + } + /** + * Get the posting date/time for the item + * + * Uses `<atom:published>`, `<atom:updated>`, `<atom:issued>`, + * `<atom:modified>`, `<pubDate>` or `<dc:date>` + * + * Note: obeys PHP's timezone setting. To get a UTC date/time, use + * {@see get_gmdate} + * + * @since Beta 2 (previously called `get_item_date` since 0.8) + * + * @param string $date_format Supports any PHP date format from {@see http://php.net/date} (empty for the raw data) + * @return int|string|null + */ + public function get_date($date_format = 'j F Y, g:i a') + { + } + /** + * Get the update date/time for the item + * + * Uses `<atom:updated>` + * + * Note: obeys PHP's timezone setting. To get a UTC date/time, use + * {@see get_gmdate} + * + * @param string $date_format Supports any PHP date format from {@see http://php.net/date} (empty for the raw data) + * @return int|string|null + */ + public function get_updated_date($date_format = 'j F Y, g:i a') + { + } + /** + * Get the localized posting date/time for the item + * + * Returns the date formatted in the localized language. To display in + * languages other than the server's default, you need to change the locale + * with {@link http://php.net/setlocale setlocale()}. The available + * localizations depend on which ones are installed on your web server. + * + * @since 1.0 + * + * @param string $date_format Supports any PHP date format from {@see http://php.net/strftime} (empty for the raw data) + * @return int|string|null + */ + public function get_local_date($date_format = '%c') + { + } + /** + * Get the posting date/time for the item (UTC time) + * + * @see get_date + * @param string $date_format Supports any PHP date format from {@see http://php.net/date} + * @return int|string|null + */ + public function get_gmdate($date_format = 'j F Y, g:i a') + { + } + /** + * Get the update date/time for the item (UTC time) + * + * @see get_updated_date + * @param string $date_format Supports any PHP date format from {@see http://php.net/date} + * @return int|string|null + */ + public function get_updated_gmdate($date_format = 'j F Y, g:i a') + { + } + /** + * Get the permalink for the item + * + * Returns the first link available with a relationship of "alternate". + * Identical to {@see get_link()} with key 0 + * + * @see get_link + * @since 0.8 + * @return string|null Permalink URL + */ + public function get_permalink() + { + } + /** + * Get a single link for the item + * + * @since Beta 3 + * @param int $key The link that you want to return. Remember that arrays begin with 0, not 1 + * @param string $rel The relationship of the link to return + * @return string|null Link URL + */ + public function get_link($key = 0, $rel = 'alternate') + { + } + /** + * Get all links for the item + * + * Uses `<atom:link>`, `<link>` or `<guid>` + * + * @since Beta 2 + * @param string $rel The relationship of links to return + * @return array|null Links found for the item (strings) + */ + public function get_links($rel = 'alternate') + { + } + /** + * Get an enclosure from the item + * + * Supports the <enclosure> RSS tag, as well as Media RSS and iTunes RSS. + * + * @since Beta 2 + * @todo Add ability to prefer one type of content over another (in a media group). + * @param int $key The enclosure that you want to return. Remember that arrays begin with 0, not 1 + * @return SimplePie_Enclosure|null + */ + public function get_enclosure($key = 0, $prefer = \null) + { + } + /** + * Get all available enclosures (podcasts, etc.) + * + * Supports the <enclosure> RSS tag, as well as Media RSS and iTunes RSS. + * + * At this point, we're pretty much assuming that all enclosures for an item + * are the same content. Anything else is too complicated to + * properly support. + * + * @since Beta 2 + * @todo Add support for end-user defined sorting of enclosures by type/handler (so we can prefer the faster-loading FLV over MP4). + * @todo If an element exists at a level, but its value is empty, we should fall back to the value from the parent (if it exists). + * @return SimplePie_Enclosure[]|null List of SimplePie_Enclosure items + */ + public function get_enclosures() + { + } + /** + * Get the latitude coordinates for the item + * + * Compatible with the W3C WGS84 Basic Geo and GeoRSS specifications + * + * Uses `<geo:lat>` or `<georss:point>` + * + * @since 1.0 + * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo + * @link http://www.georss.org/ GeoRSS + * @return string|null + */ + public function get_latitude() + { + } + /** + * Get the longitude coordinates for the item + * + * Compatible with the W3C WGS84 Basic Geo and GeoRSS specifications + * + * Uses `<geo:long>`, `<geo:lon>` or `<georss:point>` + * + * @since 1.0 + * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo + * @link http://www.georss.org/ GeoRSS + * @return string|null + */ + public function get_longitude() + { + } + /** + * Get the `<atom:source>` for the item + * + * @since 1.1 + * @return SimplePie_Source|null + */ + public function get_source() + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Used for feed auto-discovery + * + * + * This class can be overloaded with {@see SimplePie::set_locator_class()} + * + * @package SimplePie + */ + class SimplePie_Locator + { + var $useragent; + var $timeout; + var $file; + var $local = array(); + var $elsewhere = array(); + var $cached_entities = array(); + var $http_base; + var $base; + var $base_location = 0; + var $checked_feeds = 0; + var $max_checked_feeds = 10; + var $force_fsockopen = \false; + var $curl_options = array(); + var $dom; + protected $registry; + public function __construct(\SimplePie_File $file, $timeout = 10, $useragent = \null, $max_checked_feeds = 10, $force_fsockopen = \false, $curl_options = array()) + { + } + public function set_registry(\SimplePie_Registry $registry) + { + } + public function find($type = \SIMPLEPIE_LOCATOR_ALL, &$working = \null) + { + } + public function is_feed($file, $check_html = \false) + { + } + public function get_base() + { + } + public function autodiscovery() + { + } + protected function search_elements_by_tag($name, &$done, $feeds) + { + } + public function get_links() + { + } + public function get_rel_link($rel) + { + } + public function extension(&$array) + { + } + public function body(&$array) + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Miscellanous utilities + * + * @package SimplePie + */ + class SimplePie_Misc + { + public static function time_hms($seconds) + { + } + public static function absolutize_url($relative, $base) + { + } + /** + * Get a HTML/XML element from a HTML string + * + * @deprecated Use DOMDocument instead (parsing HTML with regex is bad!) + * @param string $realname Element name (including namespace prefix if applicable) + * @param string $string HTML document + * @return array + */ + public static function get_element($realname, $string) + { + } + public static function element_implode($element) + { + } + public static function error($message, $level, $file, $line) + { + } + public static function fix_protocol($url, $http = 1) + { + } + public static function array_merge_recursive($array1, $array2) + { + } + public static function parse_url($url) + { + } + public static function compress_parse_url($scheme = '', $authority = '', $path = '', $query = '', $fragment = '') + { + } + public static function normalize_url($url) + { + } + public static function percent_encoding_normalization($match) + { + } + /** + * Converts a Windows-1252 encoded string to a UTF-8 encoded string + * + * @static + * @param string $string Windows-1252 encoded string + * @return string UTF-8 encoded string + */ + public static function windows_1252_to_utf8($string) + { + } + /** + * Change a string from one encoding to another + * + * @param string $data Raw data in $input encoding + * @param string $input Encoding of $data + * @param string $output Encoding you want + * @return string|boolean False if we can't convert it + */ + public static function change_encoding($data, $input, $output) + { + } + protected static function change_encoding_mbstring($data, $input, $output) + { + } + protected static function change_encoding_iconv($data, $input, $output) + { + } + /** + * @param string $data + * @param string $input + * @param string $output + * @return string|false + */ + protected static function change_encoding_uconverter($data, $input, $output) + { + } + /** + * Normalize an encoding name + * + * This is automatically generated by create.php + * + * To generate it, run `php create.php` on the command line, and copy the + * output to replace this function. + * + * @param string $charset Character set to standardise + * @return string Standardised name + */ + public static function encoding($charset) + { + } + public static function get_curl_version() + { + } + /** + * Strip HTML comments + * + * @param string $data Data to strip comments from + * @return string Comment stripped string + */ + public static function strip_comments($data) + { + } + public static function parse_date($dt) + { + } + /** + * Decode HTML entities + * + * @deprecated Use DOMDocument instead + * @param string $data Input data + * @return string Output data + */ + public static function entities_decode($data) + { + } + /** + * Remove RFC822 comments + * + * @param string $data Data to strip comments from + * @return string Comment stripped string + */ + public static function uncomment_rfc822($string) + { + } + public static function parse_mime($mime) + { + } + public static function atom_03_construct_type($attribs) + { + } + public static function atom_10_construct_type($attribs) + { + } + public static function atom_10_content_construct_type($attribs) + { + } + public static function is_isegment_nz_nc($string) + { + } + public static function space_separated_tokens($string) + { + } + /** + * Converts a unicode codepoint to a UTF-8 character + * + * @static + * @param int $codepoint Unicode codepoint + * @return string UTF-8 character + */ + public static function codepoint_to_utf8($codepoint) + { + } + /** + * Similar to parse_str() + * + * Returns an associative array of name/value pairs, where the value is an + * array of values that have used the same name + * + * @static + * @param string $str The input string. + * @return array + */ + public static function parse_str($str) + { + } + /** + * Detect XML encoding, as per XML 1.0 Appendix F.1 + * + * @todo Add support for EBCDIC + * @param string $data XML data + * @param SimplePie_Registry $registry Class registry + * @return array Possible encodings + */ + public static function xml_encoding($data, $registry) + { + } + public static function output_javascript() + { + } + /** + * Get the SimplePie build timestamp + * + * Uses the git index if it exists, otherwise uses the modification time + * of the newest file. + */ + public static function get_build() + { + } + /** + * Format debugging information + */ + public static function debug(&$sp) + { + } + public static function silence_errors($num, $str) + { + } + /** + * Sanitize a URL by removing HTTP credentials. + * @param string $url the URL to sanitize. + * @return string the same URL without HTTP credentials. + */ + public static function url_remove_credentials($url) + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Class to validate and to work with IPv6 addresses. + * + * @package SimplePie + * @subpackage HTTP + * @copyright 2003-2005 The PHP Group + * @license http://www.opensource.org/licenses/bsd-license.php + * @link http://pear.php.net/package/Net_IPv6 + * @author Alexander Merz <alexander.merz@web.de> + * @author elfrink at introweb dot nl + * @author Josh Peck <jmp at joshpeck dot org> + * @author Sam Sneddon <geoffers@gmail.com> + */ + class SimplePie_Net_IPv6 + { + /** + * Uncompresses an IPv6 address + * + * RFC 4291 allows you to compress concecutive zero pieces in an address to + * '::'. This method expects a valid IPv6 address and expands the '::' to + * the required number of zero pieces. + * + * Example: FF01::101 -> FF01:0:0:0:0:0:0:101 + * ::1 -> 0:0:0:0:0:0:0:1 + * + * @author Alexander Merz <alexander.merz@web.de> + * @author elfrink at introweb dot nl + * @author Josh Peck <jmp at joshpeck dot org> + * @copyright 2003-2005 The PHP Group + * @license http://www.opensource.org/licenses/bsd-license.php + * @param string $ip An IPv6 address + * @return string The uncompressed IPv6 address + */ + public static function uncompress($ip) + { + } + /** + * Compresses an IPv6 address + * + * RFC 4291 allows you to compress concecutive zero pieces in an address to + * '::'. This method expects a valid IPv6 address and compresses consecutive + * zero pieces to '::'. + * + * Example: FF01:0:0:0:0:0:0:101 -> FF01::101 + * 0:0:0:0:0:0:0:1 -> ::1 + * + * @see uncompress() + * @param string $ip An IPv6 address + * @return string The compressed IPv6 address + */ + public static function compress($ip) + { + } + /** + * Checks an IPv6 address + * + * Checks if the given IP is a valid IPv6 address + * + * @param string $ip An IPv6 address + * @return bool true if $ip is a valid IPv6 address + */ + public static function check_ipv6($ip) + { + } + /** + * Checks if the given IP is a valid IPv6 address + * + * @codeCoverageIgnore + * @deprecated Use {@see SimplePie_Net_IPv6::check_ipv6()} instead + * @see check_ipv6 + * @param string $ip An IPv6 address + * @return bool true if $ip is a valid IPv6 address + */ + public static function checkIPv6($ip) + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Date Parser + * + * @package SimplePie + * @subpackage Parsing + */ + class SimplePie_Parse_Date + { + /** + * Input data + * + * @access protected + * @var string + */ + var $date; + /** + * List of days, calendar day name => ordinal day number in the week + * + * @access protected + * @var array + */ + var $day = array( + // English + 'mon' => 1, + 'monday' => 1, + 'tue' => 2, + 'tuesday' => 2, + 'wed' => 3, + 'wednesday' => 3, + 'thu' => 4, + 'thursday' => 4, + 'fri' => 5, + 'friday' => 5, + 'sat' => 6, + 'saturday' => 6, + 'sun' => 7, + 'sunday' => 7, + // Dutch + 'maandag' => 1, + 'dinsdag' => 2, + 'woensdag' => 3, + 'donderdag' => 4, + 'vrijdag' => 5, + 'zaterdag' => 6, + 'zondag' => 7, + // French + 'lundi' => 1, + 'mardi' => 2, + 'mercredi' => 3, + 'jeudi' => 4, + 'vendredi' => 5, + 'samedi' => 6, + 'dimanche' => 7, + // German + 'montag' => 1, + 'mo' => 1, + 'dienstag' => 2, + 'di' => 2, + 'mittwoch' => 3, + 'mi' => 3, + 'donnerstag' => 4, + 'do' => 4, + 'freitag' => 5, + 'fr' => 5, + 'samstag' => 6, + 'sa' => 6, + 'sonnabend' => 6, + // AFAIK no short form for sonnabend + 'so' => 7, + 'sonntag' => 7, + // Italian + 'lunedì' => 1, + 'martedì' => 2, + 'mercoledì' => 3, + 'giovedì' => 4, + 'venerdì' => 5, + 'sabato' => 6, + 'domenica' => 7, + // Spanish + 'lunes' => 1, + 'martes' => 2, + 'miércoles' => 3, + 'jueves' => 4, + 'viernes' => 5, + 'sábado' => 6, + 'domingo' => 7, + // Finnish + 'maanantai' => 1, + 'tiistai' => 2, + 'keskiviikko' => 3, + 'torstai' => 4, + 'perjantai' => 5, + 'lauantai' => 6, + 'sunnuntai' => 7, + // Hungarian + 'hétfő' => 1, + 'kedd' => 2, + 'szerda' => 3, + 'csütörtok' => 4, + 'péntek' => 5, + 'szombat' => 6, + 'vasárnap' => 7, + // Greek + 'Δευ' => 1, + 'Τρι' => 2, + 'Τετ' => 3, + 'Πεμ' => 4, + 'Παρ' => 5, + 'Σαβ' => 6, + 'Κυρ' => 7, + // Russian + 'Пн.' => 1, + 'Вт.' => 2, + 'Ср.' => 3, + 'Чт.' => 4, + 'Пт.' => 5, + 'Сб.' => 6, + 'Вс.' => 7, + ); + /** + * List of months, calendar month name => calendar month number + * + * @access protected + * @var array + */ + var $month = array( + // English + 'jan' => 1, + 'january' => 1, + 'feb' => 2, + 'february' => 2, + 'mar' => 3, + 'march' => 3, + 'apr' => 4, + 'april' => 4, + 'may' => 5, + // No long form of May + 'jun' => 6, + 'june' => 6, + 'jul' => 7, + 'july' => 7, + 'aug' => 8, + 'august' => 8, + 'sep' => 9, + 'september' => 9, + 'oct' => 10, + 'october' => 10, + 'nov' => 11, + 'november' => 11, + 'dec' => 12, + 'december' => 12, + // Dutch + 'januari' => 1, + 'februari' => 2, + 'maart' => 3, + 'april' => 4, + 'mei' => 5, + 'juni' => 6, + 'juli' => 7, + 'augustus' => 8, + 'september' => 9, + 'oktober' => 10, + 'november' => 11, + 'december' => 12, + // French + 'janvier' => 1, + 'février' => 2, + 'mars' => 3, + 'avril' => 4, + 'mai' => 5, + 'juin' => 6, + 'juillet' => 7, + 'août' => 8, + 'septembre' => 9, + 'octobre' => 10, + 'novembre' => 11, + 'décembre' => 12, + // German + 'januar' => 1, + 'jan' => 1, + 'februar' => 2, + 'feb' => 2, + 'märz' => 3, + 'mär' => 3, + 'april' => 4, + 'apr' => 4, + 'mai' => 5, + // no short form for may + 'juni' => 6, + 'jun' => 6, + 'juli' => 7, + 'jul' => 7, + 'august' => 8, + 'aug' => 8, + 'september' => 9, + 'sep' => 9, + 'oktober' => 10, + 'okt' => 10, + 'november' => 11, + 'nov' => 11, + 'dezember' => 12, + 'dez' => 12, + // Italian + 'gennaio' => 1, + 'febbraio' => 2, + 'marzo' => 3, + 'aprile' => 4, + 'maggio' => 5, + 'giugno' => 6, + 'luglio' => 7, + 'agosto' => 8, + 'settembre' => 9, + 'ottobre' => 10, + 'novembre' => 11, + 'dicembre' => 12, + // Spanish + 'enero' => 1, + 'febrero' => 2, + 'marzo' => 3, + 'abril' => 4, + 'mayo' => 5, + 'junio' => 6, + 'julio' => 7, + 'agosto' => 8, + 'septiembre' => 9, + 'setiembre' => 9, + 'octubre' => 10, + 'noviembre' => 11, + 'diciembre' => 12, + // Finnish + 'tammikuu' => 1, + 'helmikuu' => 2, + 'maaliskuu' => 3, + 'huhtikuu' => 4, + 'toukokuu' => 5, + 'kesäkuu' => 6, + 'heinäkuu' => 7, + 'elokuu' => 8, + 'suuskuu' => 9, + 'lokakuu' => 10, + 'marras' => 11, + 'joulukuu' => 12, + // Hungarian + 'január' => 1, + 'február' => 2, + 'március' => 3, + 'április' => 4, + 'május' => 5, + 'június' => 6, + 'július' => 7, + 'augusztus' => 8, + 'szeptember' => 9, + 'október' => 10, + 'november' => 11, + 'december' => 12, + // Greek + 'Ιαν' => 1, + 'Φεβ' => 2, + 'Μάώ' => 3, + 'Μαώ' => 3, + 'Απρ' => 4, + 'Μάι' => 5, + 'Μαϊ' => 5, + 'Μαι' => 5, + 'Ιούν' => 6, + 'Ιον' => 6, + 'Ιούλ' => 7, + 'Ιολ' => 7, + 'Αύγ' => 8, + 'Αυγ' => 8, + 'Σεπ' => 9, + 'Οκτ' => 10, + 'Νοέ' => 11, + 'Δεκ' => 12, + // Russian + 'Янв' => 1, + 'января' => 1, + 'Фев' => 2, + 'февраля' => 2, + 'Мар' => 3, + 'марта' => 3, + 'Апр' => 4, + 'апреля' => 4, + 'Май' => 5, + 'мая' => 5, + 'Июн' => 6, + 'июня' => 6, + 'Июл' => 7, + 'июля' => 7, + 'Авг' => 8, + 'августа' => 8, + 'Сен' => 9, + 'сентября' => 9, + 'Окт' => 10, + 'октября' => 10, + 'Ноя' => 11, + 'ноября' => 11, + 'Дек' => 12, + 'декабря' => 12, + ); + /** + * List of timezones, abbreviation => offset from UTC + * + * @access protected + * @var array + */ + var $timezone = array('ACDT' => 37800, 'ACIT' => 28800, 'ACST' => 34200, 'ACT' => -18000, 'ACWDT' => 35100, 'ACWST' => 31500, 'AEDT' => 39600, 'AEST' => 36000, 'AFT' => 16200, 'AKDT' => -28800, 'AKST' => -32400, 'AMDT' => 18000, 'AMT' => -14400, 'ANAST' => 46800, 'ANAT' => 43200, 'ART' => -10800, 'AZOST' => -3600, 'AZST' => 18000, 'AZT' => 14400, 'BIOT' => 21600, 'BIT' => -43200, 'BOT' => -14400, 'BRST' => -7200, 'BRT' => -10800, 'BST' => 3600, 'BTT' => 21600, 'CAST' => 18000, 'CAT' => 7200, 'CCT' => 23400, 'CDT' => -18000, 'CEDT' => 7200, 'CEST' => 7200, 'CET' => 3600, 'CGST' => -7200, 'CGT' => -10800, 'CHADT' => 49500, 'CHAST' => 45900, 'CIST' => -28800, 'CKT' => -36000, 'CLDT' => -10800, 'CLST' => -14400, 'COT' => -18000, 'CST' => -21600, 'CVT' => -3600, 'CXT' => 25200, 'DAVT' => 25200, 'DTAT' => 36000, 'EADT' => -18000, 'EAST' => -21600, 'EAT' => 10800, 'ECT' => -18000, 'EDT' => -14400, 'EEST' => 10800, 'EET' => 7200, 'EGT' => -3600, 'EKST' => 21600, 'EST' => -18000, 'FJT' => 43200, 'FKDT' => -10800, 'FKST' => -14400, 'FNT' => -7200, 'GALT' => -21600, 'GEDT' => 14400, 'GEST' => 10800, 'GFT' => -10800, 'GILT' => 43200, 'GIT' => -32400, 'GST' => 14400, 'GST' => -7200, 'GYT' => -14400, 'HAA' => -10800, 'HAC' => -18000, 'HADT' => -32400, 'HAE' => -14400, 'HAP' => -25200, 'HAR' => -21600, 'HAST' => -36000, 'HAT' => -9000, 'HAY' => -28800, 'HKST' => 28800, 'HMT' => 18000, 'HNA' => -14400, 'HNC' => -21600, 'HNE' => -18000, 'HNP' => -28800, 'HNR' => -25200, 'HNT' => -12600, 'HNY' => -32400, 'IRDT' => 16200, 'IRKST' => 32400, 'IRKT' => 28800, 'IRST' => 12600, 'JFDT' => -10800, 'JFST' => -14400, 'JST' => 32400, 'KGST' => 21600, 'KGT' => 18000, 'KOST' => 39600, 'KOVST' => 28800, 'KOVT' => 25200, 'KRAST' => 28800, 'KRAT' => 25200, 'KST' => 32400, 'LHDT' => 39600, 'LHST' => 37800, 'LINT' => 50400, 'LKT' => 21600, 'MAGST' => 43200, 'MAGT' => 39600, 'MAWT' => 21600, 'MDT' => -21600, 'MESZ' => 7200, 'MEZ' => 3600, 'MHT' => 43200, 'MIT' => -34200, 'MNST' => 32400, 'MSDT' => 14400, 'MSST' => 10800, 'MST' => -25200, 'MUT' => 14400, 'MVT' => 18000, 'MYT' => 28800, 'NCT' => 39600, 'NDT' => -9000, 'NFT' => 41400, 'NMIT' => 36000, 'NOVST' => 25200, 'NOVT' => 21600, 'NPT' => 20700, 'NRT' => 43200, 'NST' => -12600, 'NUT' => -39600, 'NZDT' => 46800, 'NZST' => 43200, 'OMSST' => 25200, 'OMST' => 21600, 'PDT' => -25200, 'PET' => -18000, 'PETST' => 46800, 'PETT' => 43200, 'PGT' => 36000, 'PHOT' => 46800, 'PHT' => 28800, 'PKT' => 18000, 'PMDT' => -7200, 'PMST' => -10800, 'PONT' => 39600, 'PST' => -28800, 'PWT' => 32400, 'PYST' => -10800, 'PYT' => -14400, 'RET' => 14400, 'ROTT' => -10800, 'SAMST' => 18000, 'SAMT' => 14400, 'SAST' => 7200, 'SBT' => 39600, 'SCDT' => 46800, 'SCST' => 43200, 'SCT' => 14400, 'SEST' => 3600, 'SGT' => 28800, 'SIT' => 28800, 'SRT' => -10800, 'SST' => -39600, 'SYST' => 10800, 'SYT' => 7200, 'TFT' => 18000, 'THAT' => -36000, 'TJT' => 18000, 'TKT' => -36000, 'TMT' => 18000, 'TOT' => 46800, 'TPT' => 32400, 'TRUT' => 36000, 'TVT' => 43200, 'TWT' => 28800, 'UYST' => -7200, 'UYT' => -10800, 'UZT' => 18000, 'VET' => -14400, 'VLAST' => 39600, 'VLAT' => 36000, 'VOST' => 21600, 'VUT' => 39600, 'WAST' => 7200, 'WAT' => 3600, 'WDT' => 32400, 'WEST' => 3600, 'WFT' => 43200, 'WIB' => 25200, 'WIT' => 32400, 'WITA' => 28800, 'WKST' => 18000, 'WST' => 28800, 'YAKST' => 36000, 'YAKT' => 32400, 'YAPT' => 36000, 'YEKST' => 21600, 'YEKT' => 18000); + /** + * Cached PCRE for SimplePie_Parse_Date::$day + * + * @access protected + * @var string + */ + var $day_pcre; + /** + * Cached PCRE for SimplePie_Parse_Date::$month + * + * @access protected + * @var string + */ + var $month_pcre; + /** + * Array of user-added callback methods + * + * @access private + * @var array + */ + var $built_in = array(); + /** + * Array of user-added callback methods + * + * @access private + * @var array + */ + var $user = array(); + /** + * Create new SimplePie_Parse_Date object, and set self::day_pcre, + * self::month_pcre, and self::built_in + * + * @access private + */ + public function __construct() + { + } + /** + * Get the object + * + * @access public + */ + public static function get() + { + } + /** + * Parse a date + * + * @final + * @access public + * @param string $date Date to parse + * @return int Timestamp corresponding to date string, or false on failure + */ + public function parse($date) + { + } + /** + * Add a callback method to parse a date + * + * @final + * @access public + * @param callback $callback + */ + public function add_callback($callback) + { + } + /** + * Parse a superset of W3C-DTF (allows hyphens and colons to be omitted, as + * well as allowing any of upper or lower case "T", horizontal tabs, or + * spaces to be used as the time separator (including more than one)) + * + * @access protected + * @return int Timestamp + */ + public function date_w3cdtf($date) + { + } + /** + * Remove RFC822 comments + * + * @access protected + * @param string $data Data to strip comments from + * @return string Comment stripped string + */ + public function remove_rfc2822_comments($string) + { + } + /** + * Parse RFC2822's date format + * + * @access protected + * @return int Timestamp + */ + public function date_rfc2822($date) + { + } + /** + * Parse RFC850's date format + * + * @access protected + * @return int Timestamp + */ + public function date_rfc850($date) + { + } + /** + * Parse C99's asctime()'s date format + * + * @access protected + * @return int Timestamp + */ + public function date_asctime($date) + { + } + /** + * Parse dates using strtotime() + * + * @access protected + * @return int Timestamp + */ + public function date_strtotime($date) + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Parses XML into something sane + * + * + * This class can be overloaded with {@see SimplePie::set_parser_class()} + * + * @package SimplePie + * @subpackage Parsing + */ + class SimplePie_Parser + { + var $error_code; + var $error_string; + var $current_line; + var $current_column; + var $current_byte; + var $separator = ' '; + var $namespace = array(''); + var $element = array(''); + var $xml_base = array(''); + var $xml_base_explicit = array(\false); + var $xml_lang = array(''); + var $data = array(); + var $datas = array(array()); + var $current_xhtml_construct = -1; + var $encoding; + protected $registry; + public function set_registry(\SimplePie_Registry $registry) + { + } + public function parse(&$data, $encoding, $url = '') + { + } + public function get_error_code() + { + } + public function get_error_string() + { + } + public function get_current_line() + { + } + public function get_current_column() + { + } + public function get_current_byte() + { + } + public function get_data() + { + } + public function tag_open($parser, $tag, $attributes) + { + } + public function cdata($parser, $cdata) + { + } + public function tag_close($parser, $tag) + { + } + public function split_ns($string) + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Handles `<media:rating>` or `<itunes:explicit>` tags as defined in Media RSS and iTunes RSS respectively + * + * Used by {@see SimplePie_Enclosure::get_rating()} and {@see SimplePie_Enclosure::get_ratings()} + * + * This class can be overloaded with {@see SimplePie::set_rating_class()} + * + * @package SimplePie + * @subpackage API + */ + class SimplePie_Rating + { + /** + * Rating scheme + * + * @var string + * @see get_scheme() + */ + var $scheme; + /** + * Rating value + * + * @var string + * @see get_value() + */ + var $value; + /** + * Constructor, used to input the data + * + * For documentation on all the parameters, see the corresponding + * properties and their accessors + */ + public function __construct($scheme = \null, $value = \null) + { + } + /** + * String-ified version + * + * @return string + */ + public function __toString() + { + } + /** + * Get the organizational scheme for the rating + * + * @return string|null + */ + public function get_scheme() + { + } + /** + * Get the value of the rating + * + * @return string|null + */ + public function get_value() + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Handles creating objects and calling methods + * + * Access this via {@see SimplePie::get_registry()} + * + * @package SimplePie + */ + class SimplePie_Registry + { + /** + * Default class mapping + * + * Overriding classes *must* subclass these. + * + * @var array + */ + protected $default = array('Cache' => 'SimplePie_Cache', 'Locator' => 'SimplePie_Locator', 'Parser' => 'SimplePie_Parser', 'File' => 'SimplePie_File', 'Sanitize' => 'SimplePie_Sanitize', 'Item' => 'SimplePie_Item', 'Author' => 'SimplePie_Author', 'Category' => 'SimplePie_Category', 'Enclosure' => 'SimplePie_Enclosure', 'Caption' => 'SimplePie_Caption', 'Copyright' => 'SimplePie_Copyright', 'Credit' => 'SimplePie_Credit', 'Rating' => 'SimplePie_Rating', 'Restriction' => 'SimplePie_Restriction', 'Content_Type_Sniffer' => 'SimplePie_Content_Type_Sniffer', 'Source' => 'SimplePie_Source', 'Misc' => 'SimplePie_Misc', 'XML_Declaration_Parser' => 'SimplePie_XML_Declaration_Parser', 'Parse_Date' => 'SimplePie_Parse_Date'); + /** + * Class mapping + * + * @see register() + * @var array + */ + protected $classes = array(); + /** + * Legacy classes + * + * @see register() + * @var array + */ + protected $legacy = array(); + /** + * Constructor + * + * No-op + */ + public function __construct() + { + } + /** + * Register a class + * + * @param string $type See {@see $default} for names + * @param string $class Class name, must subclass the corresponding default + * @param bool $legacy Whether to enable legacy support for this class + * @return bool Successfulness + */ + public function register($type, $class, $legacy = \false) + { + } + /** + * Get the class registered for a type + * + * Where possible, use {@see create()} or {@see call()} instead + * + * @param string $type + * @return string|null + */ + public function get_class($type) + { + } + /** + * Create a new instance of a given type + * + * @param string $type + * @param array $parameters Parameters to pass to the constructor + * @return object Instance of class + */ + public function &create($type, $parameters = array()) + { + } + /** + * Call a static method for a type + * + * @param string $type + * @param string $method + * @param array $parameters + * @return mixed + */ + public function &call($type, $method, $parameters = array()) + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Handles `<media:restriction>` as defined in Media RSS + * + * Used by {@see SimplePie_Enclosure::get_restriction()} and {@see SimplePie_Enclosure::get_restrictions()} + * + * This class can be overloaded with {@see SimplePie::set_restriction_class()} + * + * @package SimplePie + * @subpackage API + */ + class SimplePie_Restriction + { + /** + * Relationship ('allow'/'deny') + * + * @var string + * @see get_relationship() + */ + var $relationship; + /** + * Type of restriction + * + * @var string + * @see get_type() + */ + var $type; + /** + * Restricted values + * + * @var string + * @see get_value() + */ + var $value; + /** + * Constructor, used to input the data + * + * For documentation on all the parameters, see the corresponding + * properties and their accessors + */ + public function __construct($relationship = \null, $type = \null, $value = \null) + { + } + /** + * String-ified version + * + * @return string + */ + public function __toString() + { + } + /** + * Get the relationship + * + * @return string|null Either 'allow' or 'deny' + */ + public function get_relationship() + { + } + /** + * Get the type + * + * @return string|null + */ + public function get_type() + { + } + /** + * Get the list of restricted things + * + * @return string|null + */ + public function get_value() + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Used for data cleanup and post-processing + * + * + * This class can be overloaded with {@see SimplePie::set_sanitize_class()} + * + * @package SimplePie + * @todo Move to using an actual HTML parser (this will allow tags to be properly stripped, and to switch between HTML and XHTML), this will also make it easier to shorten a string while preserving HTML tags + */ + class SimplePie_Sanitize + { + // Private vars + var $base; + // Options + var $remove_div = \true; + var $image_handler = ''; + var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style'); + var $encode_instead_of_strip = \false; + var $strip_attributes = array('bgsound', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc'); + var $add_attributes = array('audio' => array('preload' => 'none'), 'iframe' => array('sandbox' => 'allow-scripts allow-same-origin'), 'video' => array('preload' => 'none')); + var $strip_comments = \false; + var $output_encoding = 'UTF-8'; + var $enable_cache = \true; + var $cache_location = './cache'; + var $cache_name_function = 'md5'; + var $timeout = 10; + var $useragent = ''; + var $force_fsockopen = \false; + var $replace_url_attributes = \null; + var $registry; + /** + * List of domains for which to force HTTPS. + * @see SimplePie_Sanitize::set_https_domains() + * Array is a tree split at DNS levels. Example: + * array('biz' => true, 'com' => array('example' => true), 'net' => array('example' => array('www' => true))) + */ + var $https_domains = array(); + public function __construct() + { + } + public function remove_div($enable = \true) + { + } + public function set_image_handler($page = \false) + { + } + public function set_registry(\SimplePie_Registry $registry) + { + } + public function pass_cache_data($enable_cache = \true, $cache_location = './cache', $cache_name_function = 'md5', $cache_class = 'SimplePie_Cache') + { + } + public function pass_file_data($file_class = 'SimplePie_File', $timeout = 10, $useragent = '', $force_fsockopen = \false) + { + } + public function strip_htmltags($tags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style')) + { + } + public function encode_instead_of_strip($encode = \false) + { + } + public function strip_attributes($attribs = array('bgsound', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc')) + { + } + public function add_attributes($attribs = array('audio' => array('preload' => 'none'), 'iframe' => array('sandbox' => 'allow-scripts allow-same-origin'), 'video' => array('preload' => 'none'))) + { + } + public function strip_comments($strip = \false) + { + } + public function set_output_encoding($encoding = 'UTF-8') + { + } + /** + * Set element/attribute key/value pairs of HTML attributes + * containing URLs that need to be resolved relative to the feed + * + * Defaults to |a|@href, |area|@href, |blockquote|@cite, |del|@cite, + * |form|@action, |img|@longdesc, |img|@src, |input|@src, |ins|@cite, + * |q|@cite + * + * @since 1.0 + * @param array|null $element_attribute Element/attribute key/value pairs, null for default + */ + public function set_url_replacements($element_attribute = \null) + { + } + /** + * Set the list of domains for which to force HTTPS. + * @see SimplePie_Misc::https_url() + * Example array('biz', 'example.com', 'example.org', 'www.example.net'); + */ + public function set_https_domains($domains) + { + } + /** + * Check if the domain is in the list of forced HTTPS. + */ + protected function is_https_domain($domain) + { + } + /** + * Force HTTPS for selected Web sites. + */ + public function https_url($url) + { + } + public function sanitize($data, $type, $base = '') + { + } + protected function preprocess($html, $type) + { + } + public function replace_urls($document, $tag, $attributes) + { + } + public function do_strip_htmltags($match) + { + } + protected function strip_tag($tag, $document, $xpath, $type) + { + } + protected function strip_attr($attrib, $xpath) + { + } + protected function add_attr($tag, $valuePairs, $document) + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Handles `<atom:source>` + * + * Used by {@see SimplePie_Item::get_source()} + * + * This class can be overloaded with {@see SimplePie::set_source_class()} + * + * @package SimplePie + * @subpackage API + */ + class SimplePie_Source + { + var $item; + var $data = array(); + protected $registry; + public function __construct($item, $data) + { + } + public function set_registry(\SimplePie_Registry $registry) + { + } + public function __toString() + { + } + public function get_source_tags($namespace, $tag) + { + } + public function get_base($element = array()) + { + } + public function sanitize($data, $type, $base = '') + { + } + public function get_item() + { + } + public function get_title() + { + } + public function get_category($key = 0) + { + } + public function get_categories() + { + } + public function get_author($key = 0) + { + } + public function get_authors() + { + } + public function get_contributor($key = 0) + { + } + public function get_contributors() + { + } + public function get_link($key = 0, $rel = 'alternate') + { + } + /** + * Added for parity between the parent-level and the item/entry-level. + */ + public function get_permalink() + { + } + public function get_links($rel = 'alternate') + { + } + public function get_description() + { + } + public function get_copyright() + { + } + public function get_language() + { + } + public function get_latitude() + { + } + public function get_longitude() + { + } + public function get_image_url() + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Parses the XML Declaration + * + * @package SimplePie + * @subpackage Parsing + */ + class SimplePie_XML_Declaration_Parser + { + /** + * XML Version + * + * @access public + * @var string + */ + var $version = '1.0'; + /** + * Encoding + * + * @access public + * @var string + */ + var $encoding = 'UTF-8'; + /** + * Standalone + * + * @access public + * @var bool + */ + var $standalone = \false; + /** + * Current state of the state machine + * + * @access private + * @var string + */ + var $state = 'before_version_name'; + /** + * Input data + * + * @access private + * @var string + */ + var $data = ''; + /** + * Input data length (to avoid calling strlen() everytime this is needed) + * + * @access private + * @var int + */ + var $data_length = 0; + /** + * Current position of the pointer + * + * @var int + * @access private + */ + var $position = 0; + /** + * Create an instance of the class with the input data + * + * @access public + * @param string $data Input data + */ + public function __construct($data) + { + } + /** + * Parse the input data + * + * @access public + * @return bool true on success, false on failure + */ + public function parse() + { + } + /** + * Check whether there is data beyond the pointer + * + * @access private + * @return bool true if there is further data, false if not + */ + public function has_data() + { + } + /** + * Advance past any whitespace + * + * @return int Number of whitespace characters passed + */ + public function skip_whitespace() + { + } + /** + * Read value + */ + public function get_value() + { + } + public function before_version_name() + { + } + public function version_name() + { + } + public function version_equals() + { + } + public function version_value() + { + } + public function encoding_name() + { + } + public function encoding_equals() + { + } + public function encoding_value() + { + } + public function standalone_name() + { + } + public function standalone_equals() + { + } + public function standalone_value() + { + } + } + /** + * SimplePie + * + * A PHP-Based RSS and Atom Feed Framework. + * Takes the hard work out of managing a complete RSS/Atom solution. + * + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * * Neither the name of the SimplePie Team nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @package SimplePie + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue + * @author Ryan Parman + * @author Sam Sneddon + * @author Ryan McCue + * @link http://simplepie.org/ SimplePie + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + */ + /** + * Decode 'gzip' encoded HTTP data + * + * @package SimplePie + * @subpackage HTTP + * @link http://www.gzip.org/format.txt + */ + class SimplePie_gzdecode + { + /** + * Compressed data + * + * @access private + * @var string + * @see gzdecode::$data + */ + var $compressed_data; + /** + * Size of compressed data + * + * @access private + * @var int + */ + var $compressed_size; + /** + * Minimum size of a valid gzip string + * + * @access private + * @var int + */ + var $min_compressed_size = 18; + /** + * Current position of pointer + * + * @access private + * @var int + */ + var $position = 0; + /** + * Flags (FLG) + * + * @access private + * @var int + */ + var $flags; + /** + * Uncompressed data + * + * @access public + * @see gzdecode::$compressed_data + * @var string + */ + var $data; + /** + * Modified time + * + * @access public + * @var int + */ + var $MTIME; + /** + * Extra Flags + * + * @access public + * @var int + */ + var $XFL; + /** + * Operating System + * + * @access public + * @var int + */ + var $OS; + /** + * Subfield ID 1 + * + * @access public + * @see gzdecode::$extra_field + * @see gzdecode::$SI2 + * @var string + */ + var $SI1; + /** + * Subfield ID 2 + * + * @access public + * @see gzdecode::$extra_field + * @see gzdecode::$SI1 + * @var string + */ + var $SI2; + /** + * Extra field content + * + * @access public + * @see gzdecode::$SI1 + * @see gzdecode::$SI2 + * @var string + */ + var $extra_field; + /** + * Original filename + * + * @access public + * @var string + */ + var $filename; + /** + * Human readable comment + * + * @access public + * @var string + */ + var $comment; + /** + * Don't allow anything to be set + * + * @param string $name + * @param mixed $value + */ + public function __set($name, $value) + { + } + /** + * Set the compressed string and related properties + * + * @param string $data + */ + public function __construct($data) + { + } + /** + * Decode the GZIP stream + * + * @return bool Successfulness + */ + public function parse() + { + } + } + /** + * General API for generating and formatting diffs - the differences between + * two sequences of strings. + * + * The original PHP version of this code was written by Geoffrey T. Dairiki + * <dairiki@dairiki.org>, and is used/adapted with his permission. + * + * Copyright 2004 Geoffrey T. Dairiki <dairiki@dairiki.org> + * Copyright 2004-2010 The Horde Project (http://www.horde.org/) + * + * See the enclosed file COPYING for license information (LGPL). If you did + * not receive this file, see https://opensource.org/license/lgpl-2-1/. + * + * @package Text_Diff + * @author Geoffrey T. Dairiki <dairiki@dairiki.org> + */ + class Text_Diff + { + /** + * Array of changes. + * + * @var array + */ + var $_edits; + /** + * Computes diffs between sequences of strings. + * + * @param string $engine Name of the diffing engine to use. 'auto' + * will automatically select the best. + * @param array $params Parameters to pass to the diffing engine. + * Normally an array of two arrays, each + * containing the lines from a file. + */ + function __construct($engine, $params) + { + } + /** + * PHP4 constructor. + */ + public function Text_Diff($engine, $params) + { + } + /** + * Returns the array of differences. + */ + function getDiff() + { + } + /** + * returns the number of new (added) lines in a given diff. + * + * @since Text_Diff 1.1.0 + * + * @return int The number of new lines + */ + function countAddedLines() + { + } + /** + * Returns the number of deleted (removed) lines in a given diff. + * + * @since Text_Diff 1.1.0 + * + * @return int The number of deleted lines + */ + function countDeletedLines() + { + } + /** + * Computes a reversed diff. + * + * Example: + * <code> + * $diff = new Text_Diff($lines1, $lines2); + * $rev = $diff->reverse(); + * </code> + * + * @return Text_Diff A Diff object representing the inverse of the + * original diff. Note that we purposely don't return a + * reference here, since this essentially is a clone() + * method. + */ + function reverse() + { + } + /** + * Checks for an empty diff. + * + * @return bool True if two sequences were identical. + */ + function isEmpty() + { + } + /** + * Computes the length of the Longest Common Subsequence (LCS). + * + * This is mostly for diagnostic purposes. + * + * @return int The length of the LCS. + */ + function lcs() + { + } + /** + * Gets the original set of lines. + * + * This reconstructs the $from_lines parameter passed to the constructor. + * + * @return array The original sequence of strings. + */ + function getOriginal() + { + } + /** + * Gets the final set of lines. + * + * This reconstructs the $to_lines parameter passed to the constructor. + * + * @return array The sequence of strings. + */ + function getFinal() + { + } + /** + * Removes trailing newlines from a line of text. This is meant to be used + * with array_walk(). + * + * @param string $line The line to trim. + * @param int $key The index of the line in the array. Not used. + */ + static function trimNewlines(&$line, $key) + { + } + /** + * Determines the location of the system temporary directory. + * + * @access protected + * + * @return string A directory name which can be used for temp files. + * Returns false if one could not be found. + */ + static function _getTempDir() + { + } + /** + * Checks a diff for validity. + * + * This is here only for debugging purposes. + */ + function _check($from_lines, $to_lines) + { + } + } + /** + * @package Text_Diff + * @author Geoffrey T. Dairiki <dairiki@dairiki.org> + */ + class Text_MappedDiff extends \Text_Diff + { + /** + * Computes a diff between sequences of strings. + * + * This can be used to compute things like case-insensitive diffs, or diffs + * which ignore changes in white-space. + * + * @param array $from_lines An array of strings. + * @param array $to_lines An array of strings. + * @param array $mapped_from_lines This array should have the same size + * number of elements as $from_lines. The + * elements in $mapped_from_lines and + * $mapped_to_lines are what is actually + * compared when computing the diff. + * @param array $mapped_to_lines This array should have the same number + * of elements as $to_lines. + */ + function __construct($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines) + { + } + /** + * PHP4 constructor. + */ + public function Text_MappedDiff($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines) + { + } + } + /** + * @package Text_Diff + * @author Geoffrey T. Dairiki <dairiki@dairiki.org> + * + * @access private + */ + class Text_Diff_Op + { + var $orig; + var $final; + function &reverse() + { + } + function norig() + { + } + function nfinal() + { + } + } + /** + * @package Text_Diff + * @author Geoffrey T. Dairiki <dairiki@dairiki.org> + * + * @access private + */ + class Text_Diff_Op_copy extends \Text_Diff_Op + { + /** + * PHP5 constructor. + */ + function __construct($orig, $final = \false) + { + } + /** + * PHP4 constructor. + */ + public function Text_Diff_Op_copy($orig, $final = \false) + { + } + function &reverse() + { + } + } + /** + * @package Text_Diff + * @author Geoffrey T. Dairiki <dairiki@dairiki.org> + * + * @access private + */ + class Text_Diff_Op_delete extends \Text_Diff_Op + { + /** + * PHP5 constructor. + */ + function __construct($lines) + { + } + /** + * PHP4 constructor. + */ + public function Text_Diff_Op_delete($lines) + { + } + function &reverse() + { + } + } + /** + * @package Text_Diff + * @author Geoffrey T. Dairiki <dairiki@dairiki.org> + * + * @access private + */ + class Text_Diff_Op_add extends \Text_Diff_Op + { + /** + * PHP5 constructor. + */ + function __construct($lines) + { + } + /** + * PHP4 constructor. + */ + public function Text_Diff_Op_add($lines) + { + } + function &reverse() + { + } + } + /** + * @package Text_Diff + * @author Geoffrey T. Dairiki <dairiki@dairiki.org> + * + * @access private + */ + class Text_Diff_Op_change extends \Text_Diff_Op + { + /** + * PHP5 constructor. + */ + function __construct($orig, $final) + { + } + /** + * PHP4 constructor. + */ + public function Text_Diff_Op_change($orig, $final) + { + } + function &reverse() + { + } + } + /** + * Class used internally by Text_Diff to actually compute the diffs. + * + * This class is implemented using native PHP code. + * + * The algorithm used here is mostly lifted from the perl module + * Algorithm::Diff (version 1.06) by Ned Konz, which is available at: + * https://cpan.metacpan.org/authors/id/N/NE/NEDKONZ/Algorithm-Diff-1.06.zip + * + * More ideas are taken from: http://www.ics.uci.edu/~eppstein/161/960229.html + * + * Some ideas (and a bit of code) are taken from analyze.c, of GNU + * diffutils-2.7, which can be found at: + * ftp://gnudist.gnu.org/pub/gnu/diffutils/diffutils-2.7.tar.gz + * + * Some ideas (subdivision by NCHUNKS > 2, and some optimizations) are from + * Geoffrey T. Dairiki <dairiki@dairiki.org>. The original PHP version of this + * code was written by him, and is used/adapted with his permission. + * + * Copyright 2004-2010 The Horde Project (http://www.horde.org/) + * + * See the enclosed file COPYING for license information (LGPL). If you did + * not receive this file, see https://opensource.org/license/lgpl-2-1/. + * + * @author Geoffrey T. Dairiki <dairiki@dairiki.org> + * @package Text_Diff + */ + class Text_Diff_Engine_native + { + public $xchanged; + public $ychanged; + public $xv; + public $yv; + public $xind; + public $yind; + public $seq; + public $in_seq; + public $lcs; + function diff($from_lines, $to_lines) + { + } + /** + * Divides the Largest Common Subsequence (LCS) of the sequences (XOFF, + * XLIM) and (YOFF, YLIM) into NCHUNKS approximately equally sized + * segments. + * + * Returns (LCS, PTS). LCS is the length of the LCS. PTS is an array of + * NCHUNKS+1 (X, Y) indexes giving the diving points between sub + * sequences. The first sub-sequence is contained in (X0, X1), (Y0, Y1), + * the second in (X1, X2), (Y1, Y2) and so on. Note that (X0, Y0) == + * (XOFF, YOFF) and (X[NCHUNKS], Y[NCHUNKS]) == (XLIM, YLIM). + * + * This function assumes that the first lines of the specified portions of + * the two files do not match, and likewise that the last lines do not + * match. The caller must trim matching lines from the beginning and end + * of the portions it is going to specify. + */ + function _diag($xoff, $xlim, $yoff, $ylim, $nchunks) + { + } + function _lcsPos($ypos) + { + } + /** + * Finds LCS of two sequences. + * + * The results are recorded in the vectors $this->{x,y}changed[], by + * storing a 1 in the element for each line that is an insertion or + * deletion (ie. is not in the LCS). + * + * The subsequence of file 0 is (XOFF, XLIM) and likewise for file 1. + * + * Note that XLIM, YLIM are exclusive bounds. All line numbers are + * origin-0 and discarded lines are not counted. + */ + function _compareseq($xoff, $xlim, $yoff, $ylim) + { + } + /** + * Adjusts inserts/deletes of identical lines to join changes as much as + * possible. + * + * We do something when a run of changed lines include a line at one end + * and has an excluded, identical line at the other. We are free to + * choose which identical line is included. `compareseq' usually chooses + * the one at the beginning, but usually it is cleaner to consider the + * following identical line to be the "change". + * + * This is extracted verbatim from analyze.c (GNU diffutils-2.7). + */ + function _shiftBoundaries($lines, &$changed, $other_changed) + { + } + } + /** + * Class used internally by Diff to actually compute the diffs. + * + * This class uses the Unix `diff` program via shell_exec to compute the + * differences between the two input arrays. + * + * Copyright 2007-2010 The Horde Project (http://www.horde.org/) + * + * See the enclosed file COPYING for license information (LGPL). If you did + * not receive this file, see https://opensource.org/license/lgpl-2-1/. + * + * @author Milian Wolff <mail@milianw.de> + * @package Text_Diff + * @since 0.3.0 + */ + class Text_Diff_Engine_shell + { + /** + * Path to the diff executable + * + * @var string + */ + var $_diffCommand = 'diff'; + /** + * Returns the array of differences. + * + * @param array $from_lines lines of text from old file + * @param array $to_lines lines of text from new file + * + * @return array all changes made (array with Text_Diff_Op_* objects) + */ + function diff($from_lines, $to_lines) + { + } + /** + * Get lines from either the old or new text + * + * @access private + * + * @param array $text_lines Either $from_lines or $to_lines (passed by reference). + * @param int $line_no Current line number (passed by reference). + * @param int $end Optional end line, when we want to chop more + * than one line. + * + * @return array The chopped lines + */ + function _getLines(&$text_lines, &$line_no, $end = \false) + { + } + } + /** + * Parses unified or context diffs output from eg. the diff utility. + * + * Example: + * <code> + * $patch = file_get_contents('example.patch'); + * $diff = new Text_Diff('string', array($patch)); + * $renderer = new Text_Diff_Renderer_inline(); + * echo $renderer->render($diff); + * </code> + * + * Copyright 2005 Örjan Persson <o@42mm.org> + * Copyright 2005-2010 The Horde Project (http://www.horde.org/) + * + * See the enclosed file COPYING for license information (LGPL). If you did + * not receive this file, see https://opensource.org/license/lgpl-2-1/. + * + * @author Örjan Persson <o@42mm.org> + * @package Text_Diff + * @since 0.2.0 + */ + class Text_Diff_Engine_string + { + /** + * Parses a unified or context diff. + * + * First param contains the whole diff and the second can be used to force + * a specific diff type. If the second parameter is 'autodetect', the + * diff will be examined to find out which type of diff this is. + * + * @param string $diff The diff content. + * @param string $mode The diff mode of the content in $diff. One of + * 'context', 'unified', or 'autodetect'. + * + * @return array List of all diff operations. + * @phpstan-param 'context'|'unified'|'autodetect' $mode + */ + function diff($diff, $mode = 'autodetect') + { + } + /** + * Parses an array containing the unified diff. + * + * @param array $diff Array of lines. + * + * @return array List of all diff operations. + */ + function parseUnifiedDiff($diff) + { + } + /** + * Parses an array containing the context diff. + * + * @param array $diff Array of lines. + * + * @return array List of all diff operations. + */ + function parseContextDiff(&$diff) + { + } + } + /** + * Class used internally by Diff to actually compute the diffs. + * + * This class uses the xdiff PECL package (http://pecl.php.net/package/xdiff) + * to compute the differences between the two input arrays. + * + * Copyright 2004-2010 The Horde Project (http://www.horde.org/) + * + * See the enclosed file COPYING for license information (LGPL). If you did + * not receive this file, see https://opensource.org/license/lgpl-2-1/. + * + * @author Jon Parise <jon@horde.org> + * @package Text_Diff + */ + class Text_Diff_Engine_xdiff + { + /** + */ + function diff($from_lines, $to_lines) + { + } + } + /** + * A class to render Diffs in different formats. + * + * This class renders the diff in classic diff format. It is intended that + * this class be customized via inheritance, to obtain fancier outputs. + * + * Copyright 2004-2010 The Horde Project (http://www.horde.org/) + * + * See the enclosed file COPYING for license information (LGPL). If you did + * not receive this file, see https://opensource.org/license/lgpl-2-1/. + * + * @package Text_Diff + */ + class Text_Diff_Renderer + { + /** + * Number of leading context "lines" to preserve. + * + * This should be left at zero for this class, but subclasses may want to + * set this to other values. + */ + var $_leading_context_lines = 0; + /** + * Number of trailing context "lines" to preserve. + * + * This should be left at zero for this class, but subclasses may want to + * set this to other values. + */ + var $_trailing_context_lines = 0; + /** + * Constructor. + */ + function __construct($params = array()) + { + } + /** + * PHP4 constructor. + */ + public function Text_Diff_Renderer($params = array()) + { + } + /** + * Get any renderer parameters. + * + * @return array All parameters of this renderer object. + */ + function getParams() + { + } + /** + * Renders a diff. + * + * @param Text_Diff $diff A Text_Diff object. + * + * @return string The formatted output. + */ + function render($diff) + { + } + function _block($xbeg, $xlen, $ybeg, $ylen, &$edits) + { + } + function _startDiff() + { + } + function _endDiff() + { + } + function _blockHeader($xbeg, $xlen, $ybeg, $ylen) + { + } + function _startBlock($header) + { + } + function _endBlock() + { + } + function _lines($lines, $prefix = ' ') + { + } + function _context($lines) + { + } + function _added($lines) + { + } + function _deleted($lines) + { + } + function _changed($orig, $final) + { + } + } + /** + * "Inline" diff renderer. + * + * This class renders diffs in the Wiki-style "inline" format. + * + * @author Ciprian Popovici + * @package Text_Diff + */ + class Text_Diff_Renderer_inline extends \Text_Diff_Renderer + { + /** + * Number of leading context "lines" to preserve. + * + * @var integer + */ + var $_leading_context_lines = 10000; + /** + * Number of trailing context "lines" to preserve. + * + * @var integer + */ + var $_trailing_context_lines = 10000; + /** + * Prefix for inserted text. + * + * @var string + */ + var $_ins_prefix = '<ins>'; + /** + * Suffix for inserted text. + * + * @var string + */ + var $_ins_suffix = '</ins>'; + /** + * Prefix for deleted text. + * + * @var string + */ + var $_del_prefix = '<del>'; + /** + * Suffix for deleted text. + * + * @var string + */ + var $_del_suffix = '</del>'; + /** + * Header for each change block. + * + * @var string + */ + var $_block_header = ''; + /** + * Whether to split down to character-level. + * + * @var boolean + */ + var $_split_characters = \false; + /** + * What are we currently splitting on? Used to recurse to show word-level + * or character-level changes. + * + * @var string + */ + var $_split_level = 'lines'; + function _blockHeader($xbeg, $xlen, $ybeg, $ylen) + { + } + function _startBlock($header) + { + } + function _lines($lines, $prefix = ' ', $encode = \true) + { + } + function _added($lines) + { + } + function _deleted($lines, $words = \false) + { + } + function _changed($orig, $final) + { + } + function _splitOnWords($string, $newlineEscape = "\n") + { + } + function _encode(&$string) + { + } + } + /** + * Atom Syndication Format PHP Library + * + * @package AtomLib + * @link http://code.google.com/p/phpatomlib/ + * + * @author Elias Torres <elias@torrez.us> + * @version 0.4 + * @since 2.3.0 + */ + /** + * Structure that store common Atom Feed Properties + * + * @package AtomLib + */ + class AtomFeed + { + /** + * Stores Links + * @var array + * @access public + */ + var $links = array(); + /** + * Stores Categories + * @var array + * @access public + */ + var $categories = array(); + /** + * Stores Entries + * + * @var array + * @access public + */ + var $entries = array(); + } + /** + * Structure that store Atom Entry Properties + * + * @package AtomLib + */ + class AtomEntry + { + /** + * Stores Links + * @var array + * @access public + */ + var $links = array(); + /** + * Stores Categories + * @var array + * @access public + */ + var $categories = array(); + } + /** + * AtomLib Atom Parser API + * + * @package AtomLib + */ + class AtomParser + { + var $NS = 'http://www.w3.org/2005/Atom'; + var $ATOM_CONTENT_ELEMENTS = array('content', 'summary', 'title', 'subtitle', 'rights'); + var $ATOM_SIMPLE_ELEMENTS = array('id', 'updated', 'published', 'draft'); + var $debug = \false; + var $depth = 0; + var $indent = 2; + var $in_content; + var $ns_contexts = array(); + var $ns_decls = array(); + var $content_ns_decls = array(); + var $content_ns_contexts = array(); + var $is_xhtml = \false; + var $is_html = \false; + var $is_text = \true; + var $skipped_div = \false; + var $FILE = "php://input"; + var $feed; + var $current; + /** + * PHP5 constructor. + */ + function __construct() + { + } + /** + * PHP4 constructor. + */ + public function AtomParser() + { + } + /** + * Map attributes to key="val" + * + * @param string $k Key + * @param string $v Value + * @return string + */ + public static function map_attrs($k, $v) + { + } + /** + * Map XML namespace to string. + * + * @param indexish $p XML Namespace element index + * @param array $n Two-element array pair. [ 0 => {namespace}, 1 => {url} ] + * @return string 'xmlns="{url}"' or 'xmlns:{namespace}="{url}"' + */ + public static function map_xmlns($p, $n) + { + } + function _p($msg) + { + } + function error_handler($log_level, $log_text, $error_file, $error_line) + { + } + function parse() + { + } + function start_element($parser, $name, $attrs) + { + } + function end_element($parser, $name) + { + } + function start_ns($parser, $prefix, $uri) + { + } + function end_ns($parser, $prefix) + { + } + function cdata($parser, $data) + { + } + function _default($parser, $data) + { + } + function ns_to_prefix($qname, $attr = \false) + { + } + function is_declared_content_ns($new_mapping) + { + } + function xml_escape($content) + { + } + } + /** + * Server-side rendering of the `core/navigation` block. + * + * @package WordPress + */ + /** + * Helper functions used to render the navigation block. + * + * @since 6.5.0 + */ + class WP_Navigation_Block_Renderer + { + /** + * Renders the navigation block. + * + * @since 6.5.0 + * + * @param array $attributes The block attributes. + * @param string $content The saved content. + * @param WP_Block $block The parsed block. + * @return string Returns the navigation block markup. + */ + public static function render($attributes, $content, $block) + { + } + } +} +namespace Avifinfo { + //------------------------------------------------------------------------------ + // Features are parsed into temporary property associations. + class Tile + { + // Tile item id <-> parent item id associations. + public $tile_item_id; + public $parent_item_id; + } + class Prop + { + // Property index <-> item id associations. + public $property_index; + public $item_id; + } + class Dim_Prop + { + // Property <-> features associations. + public $property_index; + public $width; + public $height; + } + class Chan_Prop + { + // Property <-> features associations. + public $property_index; + public $bit_depth; + public $num_channels; + } + class Features + { + public $has_primary_item = false; + // True if "pitm" was parsed. + public $has_alpha = false; + // True if an alpha "auxC" was parsed. + public $primary_item_id; + public $primary_item_features = array( + // Deduced from the data below. + 'width' => UNDEFINED, + // In number of pixels. + 'height' => UNDEFINED, + // Ignores mirror and rotation. + 'bit_depth' => UNDEFINED, + // Likely 8, 10 or 12 bits per channel per pixel. + 'num_channels' => UNDEFINED, + ); + public $tiles = array(); + // Tile[] + public $props = array(); + // Prop[] + public $dim_props = array(); + // Dim_Prop[] + public $chan_props = array(); + /** + * Finds the width, height, bit depth and number of channels of the primary item. + * + * @return Status FOUND on success or NOT_FOUND on failure. + */ + public function get_primary_item_features() + { + } + } + //------------------------------------------------------------------------------ + class Box + { + public $size; + // In bytes. + public $type; + // Four characters. + public $version; + // 0 or actual version if this is a full box. + public $flags; + // 0 or actual value if this is a full box. + public $content_size; + // 'size' minus the header size. + /** + * Reads the box header. + * + * @param stream $handle The resource the header will be parsed from. + * @param int $num_parsed_boxes The total number of parsed boxes. Prevents timeouts. + * @param int $num_remaining_bytes The number of bytes that should be available from the resource. + * @return Status FOUND on success or an error on failure. + */ + public function parse($handle, &$num_parsed_boxes, $num_remaining_bytes = MAX_SIZE) + { + } + } + //------------------------------------------------------------------------------ + class Parser + { + public $features; + function __construct($handle) + { + } + /** + * Parses a file stream. + * + * The file type is checked through the "ftyp" box. + * + * @return bool True if the input stream is an AVIF bitstream or false. + */ + public function parse_ftyp() + { + } + /** + * Parses a file stream. + * + * Features are extracted from the "meta" box. + * + * @return bool True if the main features of the primary item were parsed or false. + */ + public function parse_file() + { + } + } +} +namespace { + /** + * Portable PHP password hashing framework. + * @package phpass + * @since 2.5.0 + * @version 0.5 / WordPress + * @link https://www.openwall.com/phpass/ + */ + # + # Portable PHP password hashing framework. + # + # Version 0.5 / WordPress. + # + # Written by Solar Designer <solar at openwall.com> in 2004-2006 and placed in + # the public domain. Revised in subsequent years, still public domain. + # + # There's absolutely no warranty. + # + # The homepage URL for this framework is: + # + # http://www.openwall.com/phpass/ + # + # Please be sure to update the Version line if you edit this file in any way. + # It is suggested that you leave the main version number intact, but indicate + # your project name (after the slash) and add your own revision information. + # + # Please do not change the "private" password hashing method implemented in + # here, thereby making your hashes incompatible. However, if you must, please + # change the hash type identifier (the "$P$") to something different. + # + # Obviously, since this code is in the public domain, the above are not + # requirements (there can be none), but merely suggestions. + # + /** + * Portable PHP password hashing framework. + * + * @package phpass + * @version 0.5 / WordPress + * @link https://www.openwall.com/phpass/ + * @since 2.5.0 + */ + class PasswordHash + { + var $itoa64; + var $iteration_count_log2; + var $portable_hashes; + var $random_state; + function __construct($iteration_count_log2, $portable_hashes) + { + } + function PasswordHash($iteration_count_log2, $portable_hashes) + { + } + function get_random_bytes($count) + { + } + function encode64($input, $count) + { + } + function gensalt_private($input) + { + } + function crypt_private($password, $setting) + { + } + function gensalt_blowfish($input) + { + } + function HashPassword($password) + { + } + function CheckPassword($password, $stored_hash) + { + } + } + /** + * mail_fetch/setup.php + * + * Copyright (c) 1999-2011 CDI (cdi@thewebmasters.net) All Rights Reserved + * Modified by Philippe Mingo 2001-2009 mingo@rotedic.com + * An RFC 1939 compliant wrapper class for the POP3 protocol. + * + * Licensed under the GNU GPL. For full terms see the file COPYING. + * + * POP3 class + * + * @copyright 1999-2011 The SquirrelMail Project Team + * @license https://opensource.org/licenses/gpl-license.php GNU Public License + * @package plugins + * @subpackage mail_fetch + */ + class POP3 + { + var $ERROR = ''; + // Error string. + var $TIMEOUT = 60; + // Default timeout before giving up on a + // network operation. + var $COUNT = -1; + // Mailbox msg count + var $BUFFER = 512; + // Socket buffer for socket fgets() calls. + // Per RFC 1939 the returned line a POP3 + // server can send is 512 bytes. + var $FP = ''; + // The connection to the server's + // file descriptor + var $MAILSERVER = ''; + // Set this to hard code the server name + var $DEBUG = \FALSE; + // set to true to echo pop3 + // commands and responses to error_log + // this WILL log passwords! + var $BANNER = ''; + // Holds the banner returned by the + // pop server - used for apop() + var $ALLOWAPOP = \FALSE; + // Allow or disallow apop() + // This must be set to true + // manually + /** + * PHP5 constructor. + */ + function __construct($server = '', $timeout = '') + { + } + /** + * PHP4 constructor. + */ + public function POP3($server = '', $timeout = '') + { + } + function update_timer() + { + } + function connect($server, $port = 110) + { + } + function user($user = "") + { + } + function pass($pass = "") + { + } + function apop($login, $pass) + { + } + function login($login = "", $pass = "") + { + } + function top($msgNum, $numLines = "0") + { + } + function pop_list($msgNum = "") + { + } + function get($msgNum) + { + } + function last($type = "count") + { + } + function reset() + { + } + function send_cmd($cmd = "") + { + } + function quit() + { + } + function popstat() + { + } + function uidl($msgNum = "") + { + } + function delete($msgNum = "") + { + } + // ********************************************************* + // The following methods are internal to the class. + function is_ok($cmd = "") + { + } + function strip_clf($text = "") + { + } + function parse_banner($server_text) + { + } + } + /** + * Requests for PHP + * + * Inspired by Requests for Python. + * + * Based on concepts from SimplePie_File, RequestCore and WP_Http. + * + * @package Requests + * + * @deprecated 6.2.0 Use `WpOrg\Requests\Requests` instead for the actual functionality and + * use `WpOrg\Requests\Autoload` for the autoloading. + */ + class Requests extends \WpOrg\Requests\Requests + { + /** + * Deprecated autoloader for Requests. + * + * @deprecated 6.2.0 Use the `WpOrg\Requests\Autoload::load()` method instead. + * + * @codeCoverageIgnore + * + * @param string $class Class name to load + */ + public static function autoloader($class) + { + } + /** + * Register the built-in autoloader + * + * @deprecated 6.2.0 Include the `WpOrg\Requests\Autoload` class and + * call `WpOrg\Requests\Autoload::register()` instead. + * + * @codeCoverageIgnore + */ + public static function register_autoloader() + { + } + } + /** + * Taxonomy API: Walker_CategoryDropdown class + * + * @package WordPress + * @subpackage Template + * @since 4.4.0 + */ + /** + * Core class used to create an HTML dropdown list of Categories. + * + * @since 2.1.0 + * + * @see Walker + */ + class Walker_CategoryDropdown extends \Walker + { + /** + * What the class handles. + * + * @since 2.1.0 + * @var string + * + * @see Walker::$tree_type + */ + public $tree_type = 'category'; + /** + * Database fields to use. + * + * @since 2.1.0 + * @todo Decouple this + * @var string[] + * + * @see Walker::$db_fields + */ + public $db_fields = array('parent' => 'parent', 'id' => 'term_id'); + /** + * Starts the element output. + * + * @since 2.1.0 + * @since 5.9.0 Renamed `$category` to `$data_object` and `$id` to `$current_object_id` + * to match parent class for PHP 8 named parameter support. + * + * @see Walker::start_el() + * + * @param string $output Used to append additional content (passed by reference). + * @param WP_Term $data_object Category data object. + * @param int $depth Depth of category. Used for padding. + * @param array $args Uses 'selected', 'show_count', and 'value_field' keys, if they exist. + * See wp_dropdown_categories(). + * @param int $current_object_id Optional. ID of the current category. Default 0. + * @phpstan-param array{ + * show_option_all?: string, + * show_option_none?: string, + * option_none_value?: string, + * orderby?: string, + * pad_counts?: bool, + * show_count?: bool|int, + * echo?: bool|int, + * hierarchical?: bool|int, + * depth?: int, + * tab_index?: int, + * name?: string, + * id?: string, + * class?: string, + * selected?: int|string, + * value_field?: string, + * taxonomy?: string|array, + * hide_if_empty?: bool, + * required?: bool, + * walker?: Walker, + * aria_describedby?: string, + * } $args See wp_dropdown_categories() + */ + public function start_el(&$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0) + { + } + } + /** + * Taxonomy API: Walker_Category class + * + * @package WordPress + * @subpackage Template + * @since 4.4.0 + */ + /** + * Core class used to create an HTML list of categories. + * + * @since 2.1.0 + * + * @see Walker + */ + class Walker_Category extends \Walker + { + /** + * What the class handles. + * + * @since 2.1.0 + * @var string + * + * @see Walker::$tree_type + */ + public $tree_type = 'category'; + /** + * Database fields to use. + * + * @since 2.1.0 + * @var string[] + * + * @see Walker::$db_fields + * @todo Decouple this + */ + public $db_fields = array('parent' => 'parent', 'id' => 'term_id'); + /** + * Starts the list before the elements are added. + * + * @since 2.1.0 + * + * @see Walker::start_lvl() + * + * @param string $output Used to append additional content. Passed by reference. + * @param int $depth Optional. Depth of category. Used for tab indentation. Default 0. + * @param array $args Optional. An array of arguments. Will only append content if style argument + * value is 'list'. See wp_list_categories(). Default empty array. + * @phpstan-param array{ + * current_category?: int|int[], + * depth?: int, + * echo?: bool|int, + * exclude?: int[]|string, + * exclude_tree?: int[]|string, + * feed?: string, + * feed_image?: string, + * feed_type?: string, + * hide_title_if_empty?: bool, + * separator?: string, + * show_count?: bool|int, + * show_option_all?: string, + * show_option_none?: string, + * style?: string, + * taxonomy?: string, + * title_li?: string, + * use_desc_for_title?: bool|int, + * walker?: Walker, + * } $args See wp_list_categories() + * @phpstan-return void + */ + public function start_lvl(&$output, $depth = 0, $args = array()) + { + } + /** + * Ends the list of after the elements are added. + * + * @since 2.1.0 + * + * @see Walker::end_lvl() + * + * @param string $output Used to append additional content. Passed by reference. + * @param int $depth Optional. Depth of category. Used for tab indentation. Default 0. + * @param array $args Optional. An array of arguments. Will only append content if style argument + * value is 'list'. See wp_list_categories(). Default empty array. + * @phpstan-param array{ + * current_category?: int|int[], + * depth?: int, + * echo?: bool|int, + * exclude?: int[]|string, + * exclude_tree?: int[]|string, + * feed?: string, + * feed_image?: string, + * feed_type?: string, + * hide_title_if_empty?: bool, + * separator?: string, + * show_count?: bool|int, + * show_option_all?: string, + * show_option_none?: string, + * style?: string, + * taxonomy?: string, + * title_li?: string, + * use_desc_for_title?: bool|int, + * walker?: Walker, + * } $args See wp_list_categories() + * @phpstan-return void + */ + public function end_lvl(&$output, $depth = 0, $args = array()) + { + } + /** + * Starts the element output. + * + * @since 2.1.0 + * @since 5.9.0 Renamed `$category` to `$data_object` and `$id` to `$current_object_id` + * to match parent class for PHP 8 named parameter support. + * + * @see Walker::start_el() + * + * @param string $output Used to append additional content (passed by reference). + * @param WP_Term $data_object Category data object. + * @param int $depth Optional. Depth of category in reference to parents. Default 0. + * @param array $args Optional. An array of arguments. See wp_list_categories(). + * Default empty array. + * @param int $current_object_id Optional. ID of the current category. Default 0. + * @phpstan-param array{ + * current_category?: int|int[], + * depth?: int, + * echo?: bool|int, + * exclude?: int[]|string, + * exclude_tree?: int[]|string, + * feed?: string, + * feed_image?: string, + * feed_type?: string, + * hide_title_if_empty?: bool, + * separator?: string, + * show_count?: bool|int, + * show_option_all?: string, + * show_option_none?: string, + * style?: string, + * taxonomy?: string, + * title_li?: string, + * use_desc_for_title?: bool|int, + * walker?: Walker, + * } $args See wp_list_categories() + * @phpstan-return void + */ + public function start_el(&$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0) + { + } + /** + * Ends the element output, if needed. + * + * @since 2.1.0 + * @since 5.9.0 Renamed `$page` to `$data_object` to match parent class for PHP 8 named parameter support. + * + * @see Walker::end_el() + * + * @param string $output Used to append additional content (passed by reference). + * @param object $data_object Category data object. Not used. + * @param int $depth Optional. Depth of category. Not used. + * @param array $args Optional. An array of arguments. Only uses 'list' for whether should + * append to output. See wp_list_categories(). Default empty array. + * @phpstan-param array{ + * current_category?: int|int[], + * depth?: int, + * echo?: bool|int, + * exclude?: int[]|string, + * exclude_tree?: int[]|string, + * feed?: string, + * feed_image?: string, + * feed_type?: string, + * hide_title_if_empty?: bool, + * separator?: string, + * show_count?: bool|int, + * show_option_all?: string, + * show_option_none?: string, + * style?: string, + * taxonomy?: string, + * title_li?: string, + * use_desc_for_title?: bool|int, + * walker?: Walker, + * } $args See wp_list_categories() + * @phpstan-return void + */ + public function end_el(&$output, $data_object, $depth = 0, $args = array()) + { + } + } + /** + * Comment API: Walker_Comment class + * + * @package WordPress + * @subpackage Comments + * @since 4.4.0 + */ + /** + * Core walker class used to create an HTML list of comments. + * + * @since 2.7.0 + * + * @see Walker + */ + class Walker_Comment extends \Walker + { + /** + * What the class handles. + * + * @since 2.7.0 + * @var string + * + * @see Walker::$tree_type + */ + public $tree_type = 'comment'; + /** + * Database fields to use. + * + * @since 2.7.0 + * @var string[] + * + * @see Walker::$db_fields + * @todo Decouple this + */ + public $db_fields = array('parent' => 'comment_parent', 'id' => 'comment_ID'); + /** + * Starts the list before the elements are added. + * + * @since 2.7.0 + * + * @see Walker::start_lvl() + * @global int $comment_depth + * + * @param string $output Used to append additional content (passed by reference). + * @param int $depth Optional. Depth of the current comment. Default 0. + * @param array $args Optional. Uses 'style' argument for type of HTML list. Default empty array. + */ + public function start_lvl(&$output, $depth = 0, $args = array()) + { + } + /** + * Ends the list of items after the elements are added. + * + * @since 2.7.0 + * + * @see Walker::end_lvl() + * @global int $comment_depth + * + * @param string $output Used to append additional content (passed by reference). + * @param int $depth Optional. Depth of the current comment. Default 0. + * @param array $args Optional. Will only append content if style argument value is 'ol' or 'ul'. + * Default empty array. + */ + public function end_lvl(&$output, $depth = 0, $args = array()) + { + } + /** + * Traverses elements to create list from elements. + * + * This function is designed to enhance Walker::display_element() to + * display children of higher nesting levels than selected inline on + * the highest depth level displayed. This prevents them being orphaned + * at the end of the comment list. + * + * Example: max_depth = 2, with 5 levels of nested content. + * 1 + * 1.1 + * 1.1.1 + * 1.1.1.1 + * 1.1.1.1.1 + * 1.1.2 + * 1.1.2.1 + * 2 + * 2.2 + * + * @since 2.7.0 + * + * @see Walker::display_element() + * @see wp_list_comments() + * + * @param WP_Comment $element Comment data object. + * @param array $children_elements List of elements to continue traversing. Passed by reference. + * @param int $max_depth Max depth to traverse. + * @param int $depth Depth of the current element. + * @param array $args An array of arguments. + * @param string $output Used to append additional content. Passed by reference. + * @phpstan-return void + */ + public function display_element($element, &$children_elements, $max_depth, $depth, $args, &$output) + { + } + /** + * Starts the element output. + * + * @since 2.7.0 + * @since 5.9.0 Renamed `$comment` to `$data_object` and `$id` to `$current_object_id` + * to match parent class for PHP 8 named parameter support. + * + * @see Walker::start_el() + * @see wp_list_comments() + * @global int $comment_depth + * @global WP_Comment $comment Global comment object. + * + * @param string $output Used to append additional content. Passed by reference. + * @param WP_Comment $data_object Comment data object. + * @param int $depth Optional. Depth of the current comment in reference to parents. Default 0. + * @param array $args Optional. An array of arguments. Default empty array. + * @param int $current_object_id Optional. ID of the current comment. Default 0. + * @phpstan-return void + */ + public function start_el(&$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0) + { + } + /** + * Ends the element output, if needed. + * + * @since 2.7.0 + * @since 5.9.0 Renamed `$comment` to `$data_object` to match parent class for PHP 8 named parameter support. + * + * @see Walker::end_el() + * @see wp_list_comments() + * + * @param string $output Used to append additional content. Passed by reference. + * @param WP_Comment $data_object Comment data object. + * @param int $depth Optional. Depth of the current comment. Default 0. + * @param array $args Optional. An array of arguments. Default empty array. + * @phpstan-return void + */ + public function end_el(&$output, $data_object, $depth = 0, $args = array()) + { + } + /** + * Outputs a pingback comment. + * + * @since 3.6.0 + * + * @see wp_list_comments() + * + * @param WP_Comment $comment The comment object. + * @param int $depth Depth of the current comment. + * @param array $args An array of arguments. + */ + protected function ping($comment, $depth, $args) + { + } + /** + * Filters the comment text. + * + * Removes links from the pending comment's text if the commenter did not consent + * to the comment cookies. + * + * @since 5.4.2 + * + * @param string $comment_text Text of the current comment. + * @param WP_Comment|null $comment The comment object. Null if not found. + * @return string Filtered text of the current comment. + */ + public function filter_comment_text($comment_text, $comment) + { + } + /** + * Outputs a single comment. + * + * @since 3.6.0 + * + * @see wp_list_comments() + * + * @param WP_Comment $comment Comment to display. + * @param int $depth Depth of the current comment. + * @param array $args An array of arguments. + */ + protected function comment($comment, $depth, $args) + { + } + /** + * Outputs a comment in the HTML5 format. + * + * @since 3.6.0 + * + * @see wp_list_comments() + * + * @param WP_Comment $comment Comment to display. + * @param int $depth Depth of the current comment. + * @param array $args An array of arguments. + */ + protected function html5_comment($comment, $depth, $args) + { + } + } + /** + * Post API: Walker_PageDropdown class + * + * @package WordPress + * @subpackage Post + * @since 4.4.0 + */ + /** + * Core class used to create an HTML drop-down list of pages. + * + * @since 2.1.0 + * + * @see Walker + */ + class Walker_PageDropdown extends \Walker + { + /** + * What the class handles. + * + * @since 2.1.0 + * @var string + * + * @see Walker::$tree_type + */ + public $tree_type = 'page'; + /** + * Database fields to use. + * + * @since 2.1.0 + * @var string[] + * + * @see Walker::$db_fields + * @todo Decouple this + */ + public $db_fields = array('parent' => 'post_parent', 'id' => 'ID'); + /** + * Starts the element output. + * + * @since 2.1.0 + * @since 5.9.0 Renamed `$page` to `$data_object` and `$id` to `$current_object_id` + * to match parent class for PHP 8 named parameter support. + * + * @see Walker::start_el() + * + * @param string $output Used to append additional content. Passed by reference. + * @param WP_Post $data_object Page data object. + * @param int $depth Optional. Depth of page in reference to parent pages. + * Used for padding. Default 0. + * @param array $args Optional. Uses 'selected' argument for selected page to + * set selected HTML attribute for option element. Uses + * 'value_field' argument to fill "value" attribute. + * See wp_dropdown_pages(). Default empty array. + * @param int $current_object_id Optional. ID of the current page. Default 0. + * @phpstan-param array{ + * depth?: int, + * child_of?: int, + * selected?: int|string, + * echo?: bool|int, + * name?: string, + * id?: string, + * class?: string, + * show_option_none?: string, + * show_option_no_change?: string, + * option_none_value?: string, + * value_field?: string, + * } $args See wp_dropdown_pages() + */ + public function start_el(&$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0) + { + } + } + /** + * Post API: Walker_Page class + * + * @package WordPress + * @subpackage Template + * @since 4.4.0 + */ + /** + * Core walker class used to create an HTML list of pages. + * + * @since 2.1.0 + * + * @see Walker + */ + class Walker_Page extends \Walker + { + /** + * What the class handles. + * + * @since 2.1.0 + * @var string + * + * @see Walker::$tree_type + */ + public $tree_type = 'page'; + /** + * Database fields to use. + * + * @since 2.1.0 + * @var string[] + * + * @see Walker::$db_fields + * @todo Decouple this. + */ + public $db_fields = array('parent' => 'post_parent', 'id' => 'ID'); + /** + * Outputs the beginning of the current level in the tree before elements are output. + * + * @since 2.1.0 + * + * @see Walker::start_lvl() + * + * @param string $output Used to append additional content (passed by reference). + * @param int $depth Optional. Depth of page. Used for padding. Default 0. + * @param array $args Optional. Arguments for outputting the next level. + * Default empty array. + */ + public function start_lvl(&$output, $depth = 0, $args = array()) + { + } + /** + * Outputs the end of the current level in the tree after elements are output. + * + * @since 2.1.0 + * + * @see Walker::end_lvl() + * + * @param string $output Used to append additional content (passed by reference). + * @param int $depth Optional. Depth of page. Used for padding. Default 0. + * @param array $args Optional. Arguments for outputting the end of the current level. + * Default empty array. + */ + public function end_lvl(&$output, $depth = 0, $args = array()) + { + } + /** + * Outputs the beginning of the current element in the tree. + * + * @see Walker::start_el() + * @since 2.1.0 + * @since 5.9.0 Renamed `$page` to `$data_object` and `$current_page` to `$current_object_id` + * to match parent class for PHP 8 named parameter support. + * + * @param string $output Used to append additional content. Passed by reference. + * @param WP_Post $data_object Page data object. + * @param int $depth Optional. Depth of page. Used for padding. Default 0. + * @param array $args Optional. Array of arguments. Default empty array. + * @param int $current_object_id Optional. ID of the current page. Default 0. + */ + public function start_el(&$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0) + { + } + /** + * Outputs the end of the current element in the tree. + * + * @since 2.1.0 + * @since 5.9.0 Renamed `$page` to `$data_object` to match parent class for PHP 8 named parameter support. + * + * @see Walker::end_el() + * + * @param string $output Used to append additional content. Passed by reference. + * @param WP_Post $data_object Page data object. Not used. + * @param int $depth Optional. Depth of page. Default 0 (unused). + * @param array $args Optional. Array of arguments. Default empty array. + */ + public function end_el(&$output, $data_object, $depth = 0, $args = array()) + { + } + } + /** + * Toolbar API: WP_Admin_Bar class + * + * @package WordPress + * @subpackage Toolbar + * @since 3.1.0 + */ + /** + * Core class used to implement the Toolbar API. + * + * @since 3.1.0 + */ + #[\AllowDynamicProperties] + class WP_Admin_Bar + { + public $user; + /** + * Deprecated menu property. + * + * @since 3.1.0 + * @deprecated 3.3.0 Modify admin bar nodes with WP_Admin_Bar::get_node(), + * WP_Admin_Bar::add_node(), and WP_Admin_Bar::remove_node(). + * @var array + */ + public $menu = array(); + /** + * Initializes the admin bar. + * + * @since 3.1.0 + */ + public function initialize() + { + } + /** + * Adds a node (menu item) to the admin bar menu. + * + * @since 3.3.0 + * + * @param array $node The attributes that define the node. + */ + public function add_menu($node) + { + } + /** + * Removes a node from the admin bar. + * + * @since 3.1.0 + * + * @param string $id The menu slug to remove. + */ + public function remove_menu($id) + { + } + /** + * Adds a node to the menu. + * + * @since 3.1.0 + * @since 4.5.0 Added the ability to pass 'lang' and 'dir' meta data. + * @since 6.5.0 Added the ability to pass 'menu_title' for an ARIA menu name. + * + * @param array $args { + * Arguments for adding a node. + * + * @type string $id ID of the item. + * @type string $title Title of the node. + * @type string $parent Optional. ID of the parent node. + * @type string $href Optional. Link for the item. + * @type bool $group Optional. Whether or not the node is a group. Default false. + * @type array $meta Meta data including the following keys: 'html', 'class', 'rel', 'lang', 'dir', + * 'onclick', 'target', 'title', 'tabindex', 'menu_title'. Default empty. + * } + * @phpstan-param array{ + * id?: string, + * title?: string, + * parent?: string, + * href?: string, + * group?: bool, + * meta?: array, + * } $args + * @phpstan-return void + */ + public function add_node($args) + { + } + /** + * @since 3.3.0 + * + * @param array $args + */ + protected final function _set_node($args) + { + } + /** + * Gets a node. + * + * @since 3.3.0 + * + * @param string $id + * @return object|void Node. + */ + public final function get_node($id) + { + } + /** + * @since 3.3.0 + * + * @param string $id + * @return object|void + */ + protected final function _get_node($id) + { + } + /** + * @since 3.3.0 + * + * @return array|void + */ + public final function get_nodes() + { + } + /** + * @since 3.3.0 + * + * @return array|void + */ + protected final function _get_nodes() + { + } + /** + * Adds a group to a toolbar menu node. + * + * Groups can be used to organize toolbar items into distinct sections of a toolbar menu. + * + * @since 3.3.0 + * + * @param array $args { + * Array of arguments for adding a group. + * + * @type string $id ID of the item. + * @type string $parent Optional. ID of the parent node. Default 'root'. + * @type array $meta Meta data for the group including the following keys: + * 'class', 'onclick', 'target', and 'title'. + * } + * @phpstan-param array{ + * id?: string, + * parent?: string, + * meta?: array, + * } $args + */ + public final function add_group($args) + { + } + /** + * Remove a node. + * + * @since 3.1.0 + * + * @param string $id The ID of the item. + */ + public function remove_node($id) + { + } + /** + * @since 3.3.0 + * + * @param string $id + */ + protected final function _unset_node($id) + { + } + /** + * @since 3.1.0 + */ + public function render() + { + } + /** + * @since 3.3.0 + * + * @return object|void + */ + protected final function _bind() + { + } + /** + * @since 3.3.0 + * + * @param object $root + */ + protected final function _render($root) + { + } + /** + * @since 3.3.0 + * + * @param object $node + * @phpstan-return void + */ + protected final function _render_container($node) + { + } + /** + * @since 3.3.0 + * @since 6.5.0 Added `$menu_title` parameter to allow an ARIA menu name. + * + * @param object $node + * @param string|bool $menu_title The accessible name of this ARIA menu or false if not provided. + * @phpstan-return void + */ + protected final function _render_group($node, $menu_title = \false) + { + } + /** + * @since 3.3.0 + * + * @param object $node + * @phpstan-return void + */ + protected final function _render_item($node) + { + } + /** + * Renders toolbar items recursively. + * + * @since 3.1.0 + * @deprecated 3.3.0 Use WP_Admin_Bar::_render_item() or WP_Admin_bar::render() instead. + * @see WP_Admin_Bar::_render_item() + * @see WP_Admin_Bar::render() + * + * @param string $id Unused. + * @param object $node + */ + public function recursive_render($id, $node) + { + } + /** + * Adds menus to the admin bar. + * + * @since 3.1.0 + */ + public function add_menus() + { + } + } + /** + * Send XML response back to Ajax request. + * + * @package WordPress + * @since 2.1.0 + */ + #[\AllowDynamicProperties] + class WP_Ajax_Response + { + /** + * Store XML responses to send. + * + * @since 2.1.0 + * @var array + */ + public $responses = array(); + /** + * Constructor - Passes args to WP_Ajax_Response::add(). + * + * @since 2.1.0 + * + * @see WP_Ajax_Response::add() + * + * @param string|array $args Optional. Will be passed to add() method. + */ + public function __construct($args = '') + { + } + /** + * Appends data to an XML response based on given arguments. + * + * With `$args` defaults, extra data output would be: + * + * <response action='{$action}_$id'> + * <$what id='$id' position='$position'> + * <response_data><![CDATA[$data]]></response_data> + * </$what> + * </response> + * + * @since 2.1.0 + * + * @param string|array $args { + * Optional. An array or string of XML response arguments. + * + * @type string $what XML-RPC response type. Used as a child element of `<response>`. + * Default 'object' (`<object>`). + * @type string|false $action Value to use for the `action` attribute in `<response>`. Will be + * appended with `_$id` on output. If false, `$action` will default to + * the value of `$_POST['action']`. Default false. + * @type int|WP_Error $id The response ID, used as the response type `id` attribute. Also + * accepts a `WP_Error` object if the ID does not exist. Default 0. + * @type int|false $old_id The previous response ID. Used as the value for the response type + * `old_id` attribute. False hides the attribute. Default false. + * @type string $position Value of the response type `position` attribute. Accepts 1 (bottom), + * -1 (top), HTML ID (after), or -HTML ID (before). Default 1 (bottom). + * @type string|WP_Error $data The response content/message. Also accepts a WP_Error object if the + * ID does not exist. Default empty. + * @type array $supplemental An array of extra strings that will be output within a `<supplemental>` + * element as CDATA. Default empty array. + * } + * @return string XML response. + * @phpstan-param array{ + * what?: string, + * action?: string|false, + * id?: int|WP_Error, + * old_id?: int|false, + * position?: string, + * data?: string|WP_Error, + * supplemental?: array, + * } $args + */ + public function add($args = '') + { + } + /** + * Display XML formatted responses. + * + * Sets the content type header to text/xml. + * + * @since 2.1.0 + */ + public function send() + { + } + } + /** + * WP_Application_Passwords class + * + * @package WordPress + * @since 5.6.0 + */ + /** + * Class for displaying, modifying, and sanitizing application passwords. + * + * @package WordPress + */ + #[\AllowDynamicProperties] + class WP_Application_Passwords + { + /** + * The application passwords user meta key. + * + * @since 5.6.0 + * + * @var string + */ + const USERMETA_KEY_APPLICATION_PASSWORDS = '_application_passwords'; + /** + * The option name used to store whether application passwords are in use. + * + * @since 5.6.0 + * + * @var string + */ + const OPTION_KEY_IN_USE = 'using_application_passwords'; + /** + * The generated application password length. + * + * @since 5.6.0 + * + * @var int + */ + const PW_LENGTH = 24; + /** + * Checks if application passwords are being used by the site. + * + * This returns true if at least one application password has ever been created. + * + * @since 5.6.0 + * + * @return bool + */ + public static function is_in_use() + { + } + /** + * Creates a new application password. + * + * @since 5.6.0 + * @since 5.7.0 Returns WP_Error if application name already exists. + * + * @param int $user_id User ID. + * @param array $args { + * Arguments used to create the application password. + * + * @type string $name The name of the application password. + * @type string $app_id A UUID provided by the application to uniquely identify it. + * } + * @return array|WP_Error { + * Application password details, or a WP_Error instance if an error occurs. + * + * @type string $0 The unhashed generated application password. + * @type array $1 { + * The details about the created password. + * + * @type string $uuid The unique identifier for the application password. + * @type string $app_id A UUID provided by the application to uniquely identify it. + * @type string $name The name of the application password. + * @type string $password A one-way hash of the password. + * @type int $created Unix timestamp of when the password was created. + * @type null $last_used Null. + * @type null $last_ip Null. + * } + * } + * @phpstan-param array{ + * name?: string, + * app_id?: string, + * } $args + * @phpstan-return \WP_Error|array{ + * 0: string, + * 1: array{ + * uuid: string, + * app_id: string, + * name: string, + * password: string, + * created: int, + * last_used: null, + * last_ip: null, + * }, + * } + */ + public static function create_new_application_password($user_id, $args = array()) + { + } + /** + * Gets a user's application passwords. + * + * @since 5.6.0 + * + * @param int $user_id User ID. + * @return array { + * The list of app passwords. + * + * @type array ...$0 { + * @type string $uuid The unique identifier for the application password. + * @type string $app_id A UUID provided by the application to uniquely identify it. + * @type string $name The name of the application password. + * @type string $password A one-way hash of the password. + * @type int $created Unix timestamp of when the password was created. + * @type int|null $last_used The Unix timestamp of the GMT date the application password was last used. + * @type string|null $last_ip The IP address the application password was last used by. + * } + * } + * @phpstan-return array<int|string, array{ + * uuid: string, + * app_id: string, + * name: string, + * password: string, + * created: int, + * last_used: int|null, + * last_ip: string|null, + * }> + */ + public static function get_user_application_passwords($user_id) + { + } + /** + * Gets a user's application password with the given UUID. + * + * @since 5.6.0 + * + * @param int $user_id User ID. + * @param string $uuid The password's UUID. + * @return array|null The application password if found, null otherwise. + */ + public static function get_user_application_password($user_id, $uuid) + { + } + /** + * Checks if an application password with the given name exists for this user. + * + * @since 5.7.0 + * + * @param int $user_id User ID. + * @param string $name Application name. + * @return bool Whether the provided application name exists. + */ + public static function application_name_exists_for_user($user_id, $name) + { + } + /** + * Updates an application password. + * + * @since 5.6.0 + * + * @param int $user_id User ID. + * @param string $uuid The password's UUID. + * @param array $update Information about the application password to update. + * @return true|WP_Error True if successful, otherwise a WP_Error instance is returned on error. + */ + public static function update_application_password($user_id, $uuid, $update = array()) + { + } + /** + * Records that an application password has been used. + * + * @since 5.6.0 + * + * @param int $user_id User ID. + * @param string $uuid The password's UUID. + * @return true|WP_Error True if the usage was recorded, a WP_Error if an error occurs. + */ + public static function record_application_password_usage($user_id, $uuid) + { + } + /** + * Deletes an application password. + * + * @since 5.6.0 + * + * @param int $user_id User ID. + * @param string $uuid The password's UUID. + * @return true|WP_Error Whether the password was successfully found and deleted, a WP_Error otherwise. + */ + public static function delete_application_password($user_id, $uuid) + { + } + /** + * Deletes all application passwords for the given user. + * + * @since 5.6.0 + * + * @param int $user_id User ID. + * @return int|WP_Error The number of passwords that were deleted or a WP_Error on failure. + */ + public static function delete_all_application_passwords($user_id) + { + } + /** + * Sets a user's application passwords. + * + * @since 5.6.0 + * + * @param int $user_id User ID. + * @param array $passwords Application passwords. + * + * @return bool + */ + protected static function set_user_application_passwords($user_id, $passwords) + { + } + /** + * Sanitizes and then splits a password into smaller chunks. + * + * @since 5.6.0 + * + * @param string $raw_password The raw application password. + * @return string The chunked password. + */ + public static function chunk_password($raw_password) + { + } + } + /** + * Block Bindings API: WP_Block_Bindings_Registry class. + * + * Supports overriding content in blocks by connecting them to different sources. + * + * @package WordPress + * @subpackage Block Bindings + * @since 6.5.0 + */ + /** + * Core class used for interacting with block bindings sources. + * + * @since 6.5.0 + */ + final class WP_Block_Bindings_Registry + { + /** + * Registers a new block bindings source. + * + * This is a low-level method. For most use cases, it is recommended to use + * the `register_block_bindings_source()` function instead. + * + * @see register_block_bindings_source() + * + * Sources are used to override block's original attributes with a value + * coming from the source. Once a source is registered, it can be used by a + * block by setting its `metadata.bindings` attribute to a value that refers + * to the source. + * + * @since 6.5.0 + * + * @param string $source_name The name of the source. It must be a string containing a namespace prefix, i.e. + * `my-plugin/my-custom-source`. It must only contain lowercase alphanumeric + * characters, the forward slash `/` and dashes. + * @param array $source_properties { + * The array of arguments that are used to register a source. + * + * @type string $label The label of the source. + * @type callable $get_value_callback A callback executed when the source is processed during block rendering. + * The callback should have the following signature: + * + * `function( $source_args, $block_instance, $attribute_name ): mixed` + * - @param array $source_args Array containing source arguments + * used to look up the override value, + * i.e. {"key": "foo"}. + * - @param WP_Block $block_instance The block instance. + * - @param string $attribute_name The name of the target attribute. + * The callback has a mixed return type; it may return a string to override + * the block's original value, null, false to remove an attribute, etc. + * @type string[] $uses_context Optional. Array of values to add to block `uses_context` needed by the source. + * } + * @return WP_Block_Bindings_Source|false Source when the registration was successful, or `false` on failure. + * @phpstan-param array{ + * label?: string, + * get_value_callback?: callable, + * uses_context?: string[], + * } $source_properties + */ + public function register(string $source_name, array $source_properties) + { + } + /** + * Unregisters a block bindings source. + * + * @since 6.5.0 + * + * @param string $source_name Block bindings source name including namespace. + * @return WP_Block_Bindings_Source|false The unregistered block bindings source on success and `false` otherwise. + */ + public function unregister(string $source_name) + { + } + /** + * Retrieves the list of all registered block bindings sources. + * + * @since 6.5.0 + * + * @return WP_Block_Bindings_Source[] The array of registered sources. + */ + public function get_all_registered() + { + } + /** + * Retrieves a registered block bindings source. + * + * @since 6.5.0 + * + * @param string $source_name The name of the source. + * @return WP_Block_Bindings_Source|null The registered block bindings source, or `null` if it is not registered. + */ + public function get_registered(string $source_name) + { + } + /** + * Checks if a block bindings source is registered. + * + * @since 6.5.0 + * + * @param string $source_name The name of the source. + * @return bool `true` if the block bindings source is registered, `false` otherwise. + */ + public function is_registered($source_name) + { + } + /** + * Wakeup magic method. + * + * @since 6.5.0 + * @phpstan-return void + */ + public function __wakeup() + { + } + /** + * Utility method to retrieve the main instance of the class. + * + * The instance will be created if it does not exist yet. + * + * @since 6.5.0 + * + * @return WP_Block_Bindings_Registry The main instance. + */ + public static function get_instance() + { + } + } + /** + * Block Bindings API: WP_Block_Bindings_Source class. + * + * + * @package WordPress + * @subpackage Block Bindings + * @since 6.5.0 + */ + /** + * Class representing block bindings source. + * + * This class is designed for internal use by the Block Bindings registry. + * + * @since 6.5.0 + * @access private + * + * @see WP_Block_Bindings_Registry + */ + final class WP_Block_Bindings_Source + { + /** + * The name of the source. + * + * @since 6.5.0 + * @var string + */ + public $name; + /** + * The label of the source. + * + * @since 6.5.0 + * @var string + */ + public $label; + /** + * The context added to the blocks needed by the source. + * + * @since 6.5.0 + * @var string[]|null + */ + public $uses_context = \null; + /** + * Constructor. + * + * Do not use this constructor directly. Instead, use the + * `WP_Block_Bindings_Registry::register` method or the `register_block_bindings_source` function. + * + * @since 6.5.0 + * + * @param string $name The name of the source. + * @param array $source_properties The properties of the source. + */ + public function __construct(string $name, array $source_properties) + { + } + /** + * Retrieves the value from the source. + * + * @since 6.5.0 + * + * @param array $source_args Array containing source arguments used to look up the override value, i.e. {"key": "foo"}. + * @param WP_Block $block_instance The block instance. + * @param string $attribute_name The name of the target attribute. + * + * @return mixed The value of the source. + */ + public function get_value(array $source_args, $block_instance, string $attribute_name) + { + } + /** + * Wakeup magic method. + * + * @since 6.5.0 + */ + public function __wakeup() + { + } + } + /** + * Blocks API: WP_Block_Editor_Context class + * + * @package WordPress + * @since 5.8.0 + */ + /** + * Contains information about a block editor being rendered. + * + * @since 5.8.0 + */ + #[\AllowDynamicProperties] + final class WP_Block_Editor_Context + { + /** + * String that identifies the block editor being rendered. Can be one of: + * + * - `'core/edit-post'` - The post editor at `/wp-admin/edit.php`. + * - `'core/edit-widgets'` - The widgets editor at `/wp-admin/widgets.php`. + * - `'core/customize-widgets'` - The widgets editor at `/wp-admin/customize.php`. + * - `'core/edit-site'` - The site editor at `/wp-admin/site-editor.php`. + * + * Defaults to 'core/edit-post'. + * + * @since 6.0.0 + * + * @var string + */ + public $name = 'core/edit-post'; + /** + * The post being edited by the block editor. Optional. + * + * @since 5.8.0 + * + * @var WP_Post|null + */ + public $post = \null; + /** + * Constructor. + * + * Populates optional properties for a given block editor context. + * + * @since 5.8.0 + * + * @param array $settings The list of optional settings to expose in a given context. + */ + public function __construct(array $settings = array()) + { + } + } + /** + * Blocks API: WP_Block_List class + * + * @package WordPress + * @since 5.5.0 + */ + /** + * Class representing a list of block instances. + * + * @since 5.5.0 + * @phpstan-implements ArrayAccess<int, WP_Block> + */ + #[\AllowDynamicProperties] + class WP_Block_List implements \Iterator, \ArrayAccess, \Countable + { + /** + * Original array of parsed block data, or block instances. + * + * @since 5.5.0 + * @var array[]|WP_Block[] + * @access protected + */ + protected $blocks; + /** + * All available context of the current hierarchy. + * + * @since 5.5.0 + * @var array + * @access protected + */ + protected $available_context; + /** + * Block type registry to use in constructing block instances. + * + * @since 5.5.0 + * @var WP_Block_Type_Registry + * @access protected + */ + protected $registry; + /** + * Constructor. + * + * Populates object properties from the provided block instance argument. + * + * @since 5.5.0 + * + * @param array[]|WP_Block[] $blocks Array of parsed block data, or block instances. + * @param array $available_context Optional array of ancestry context values. + * @param WP_Block_Type_Registry $registry Optional block type registry. + */ + public function __construct($blocks, $available_context = array(), $registry = \null) + { + } + /** + * Returns true if a block exists by the specified block offset, or false + * otherwise. + * + * @since 5.5.0 + * + * @link https://www.php.net/manual/en/arrayaccess.offsetexists.php + * + * @param string $offset Offset of block to check for. + * @return bool Whether block exists. + * @phpstan-param int $offset + */ + #[\ReturnTypeWillChange] + public function offsetExists($offset) + { + } + /** + * Returns the value by the specified block offset. + * + * @since 5.5.0 + * + * @link https://www.php.net/manual/en/arrayaccess.offsetget.php + * + * @param string $offset Offset of block value to retrieve. + * @return mixed|null Block value if exists, or null. + * @phpstan-param int $offset + * @phpstan-return WP_Block|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + } + /** + * Assign a block value by the specified block offset. + * + * @since 5.5.0 + * + * @link https://www.php.net/manual/en/arrayaccess.offsetset.php + * + * @param string $offset Offset of block value to set. + * @param mixed $value Block value. + * @phpstan-param int|null $offset + * @phpstan-return void + */ + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value) + { + } + /** + * Unset a block. + * + * @since 5.5.0 + * + * @link https://www.php.net/manual/en/arrayaccess.offsetunset.php + * + * @param string $offset Offset of block value to unset. + * @phpstan-param int $offset + * @phpstan-return void + */ + #[\ReturnTypeWillChange] + public function offsetUnset($offset) + { + } + /** + * Rewinds back to the first element of the Iterator. + * + * @since 5.5.0 + * + * @link https://www.php.net/manual/en/iterator.rewind.php + */ + #[\ReturnTypeWillChange] + public function rewind() + { + } + /** + * Returns the current element of the block list. + * + * @since 5.5.0 + * + * @link https://www.php.net/manual/en/iterator.current.php + * + * @return mixed Current element. + */ + #[\ReturnTypeWillChange] + public function current() + { + } + /** + * Returns the key of the current element of the block list. + * + * @since 5.5.0 + * + * @link https://www.php.net/manual/en/iterator.key.php + * + * @return mixed Key of the current element. + */ + #[\ReturnTypeWillChange] + public function key() + { + } + /** + * Moves the current position of the block list to the next element. + * + * @since 5.5.0 + * + * @link https://www.php.net/manual/en/iterator.next.php + */ + #[\ReturnTypeWillChange] + public function next() + { + } + /** + * Checks if current position is valid. + * + * @since 5.5.0 + * + * @link https://www.php.net/manual/en/iterator.valid.php + */ + #[\ReturnTypeWillChange] + public function valid() + { + } + /** + * Returns the count of blocks in the list. + * + * @since 5.5.0 + * + * @link https://www.php.net/manual/en/countable.count.php + * + * @return int Block count. + */ + #[\ReturnTypeWillChange] + public function count() + { + } + } + /** + * Block Serialization Parser + * + * @package WordPress + */ + /** + * Class WP_Block_Parser_Block + * + * Holds the block structure in memory + * + * @since 5.0.0 + */ + class WP_Block_Parser_Block + { + /** + * Name of block + * + * @example "core/paragraph" + * + * @since 5.0.0 + * @var string + */ + public $blockName; + // phpcs:ignore WordPress.NamingConventions.ValidVariableName + /** + * Optional set of attributes from block comment delimiters + * + * @example null + * @example array( 'columns' => 3 ) + * + * @since 5.0.0 + * @var array|null + */ + public $attrs; + /** + * List of inner blocks (of this same class) + * + * @since 5.0.0 + * @var WP_Block_Parser_Block[] + */ + public $innerBlocks; + // phpcs:ignore WordPress.NamingConventions.ValidVariableName + /** + * Resultant HTML from inside block comment delimiters + * after removing inner blocks + * + * @example "...Just <!-- wp:test /--> testing..." -> "Just testing..." + * + * @since 5.0.0 + * @var string + */ + public $innerHTML; + // phpcs:ignore WordPress.NamingConventions.ValidVariableName + /** + * List of string fragments and null markers where inner blocks were found + * + * @example array( + * 'innerHTML' => 'BeforeInnerAfter', + * 'innerBlocks' => array( block, block ), + * 'innerContent' => array( 'Before', null, 'Inner', null, 'After' ), + * ) + * + * @since 4.2.0 + * @var array + */ + public $innerContent; + // phpcs:ignore WordPress.NamingConventions.ValidVariableName + /** + * Constructor. + * + * Will populate object properties from the provided arguments. + * + * @since 5.0.0 + * + * @param string $name Name of block. + * @param array $attrs Optional set of attributes from block comment delimiters. + * @param array $inner_blocks List of inner blocks (of this same class). + * @param string $inner_html Resultant HTML from inside block comment delimiters after removing inner blocks. + * @param array $inner_content List of string fragments and null markers where inner blocks were found. + */ + public function __construct($name, $attrs, $inner_blocks, $inner_html, $inner_content) + { + } + } + /** + * Block Serialization Parser + * + * @package WordPress + */ + /** + * Class WP_Block_Parser_Frame + * + * Holds partial blocks in memory while parsing + * + * @internal + * @since 5.0.0 + */ + class WP_Block_Parser_Frame + { + /** + * Full or partial block + * + * @since 5.0.0 + * @var WP_Block_Parser_Block + */ + public $block; + /** + * Byte offset into document for start of parse token + * + * @since 5.0.0 + * @var int + */ + public $token_start; + /** + * Byte length of entire parse token string + * + * @since 5.0.0 + * @var int + */ + public $token_length; + /** + * Byte offset into document for after parse token ends + * (used during reconstruction of stack into parse production) + * + * @since 5.0.0 + * @var int + */ + public $prev_offset; + /** + * Byte offset into document where leading HTML before token starts + * + * @since 5.0.0 + * @var int + */ + public $leading_html_start; + /** + * Constructor + * + * Will populate object properties from the provided arguments. + * + * @since 5.0.0 + * + * @param WP_Block_Parser_Block $block Full or partial block. + * @param int $token_start Byte offset into document for start of parse token. + * @param int $token_length Byte length of entire parse token string. + * @param int $prev_offset Byte offset into document for after parse token ends. + * @param int $leading_html_start Byte offset into document where leading HTML before token starts. + */ + public function __construct($block, $token_start, $token_length, $prev_offset = \null, $leading_html_start = \null) + { + } + } + /** + * Block Serialization Parser + * + * @package WordPress + */ + /** + * Class WP_Block_Parser + * + * Parses a document and constructs a list of parsed block objects + * + * @since 5.0.0 + * @since 4.0.0 returns arrays not objects, all attributes are arrays + */ + class WP_Block_Parser + { + /** + * Input document being parsed + * + * @example "Pre-text\n<!-- wp:paragraph -->This is inside a block!<!-- /wp:paragraph -->" + * + * @since 5.0.0 + * @var string + */ + public $document; + /** + * Tracks parsing progress through document + * + * @since 5.0.0 + * @var int + */ + public $offset; + /** + * List of parsed blocks + * + * @since 5.0.0 + * @var WP_Block_Parser_Block[] + */ + public $output; + /** + * Stack of partially-parsed structures in memory during parse + * + * @since 5.0.0 + * @var WP_Block_Parser_Frame[] + */ + public $stack; + /** + * Parses a document and returns a list of block structures + * + * When encountering an invalid parse will return a best-effort + * parse. In contrast to the specification parser this does not + * return an error on invalid inputs. + * + * @since 5.0.0 + * + * @param string $document Input document being parsed. + * @return array[] + */ + public function parse($document) + { + } + /** + * Processes the next token from the input document + * and returns whether to proceed eating more tokens + * + * This is the "next step" function that essentially + * takes a token as its input and decides what to do + * with that token before descending deeper into a + * nested block tree or continuing along the document + * or breaking out of a level of nesting. + * + * @internal + * @since 5.0.0 + * @return bool + */ + public function proceed() + { + } + /** + * Scans the document from where we last left off + * and finds the next valid token to parse if it exists + * + * Returns the type of the find: kind of find, block information, attributes + * + * @internal + * @since 5.0.0 + * @since 4.6.1 fixed a bug in attribute parsing which caused catastrophic backtracking on invalid block comments + * @return array + */ + public function next_token() + { + } + /** + * Returns a new block object for freeform HTML + * + * @internal + * @since 3.9.0 + * + * @param string $inner_html HTML content of block. + * @return WP_Block_Parser_Block freeform block object. + */ + public function freeform($inner_html) + { + } + /** + * Pushes a length of text from the input document + * to the output list as a freeform block. + * + * @internal + * @since 5.0.0 + * @param null $length how many bytes of document text to output. + * @phpstan-return void + */ + public function add_freeform($length = \null) + { + } + /** + * Given a block structure from memory pushes + * a new block to the output list. + * + * @internal + * @since 5.0.0 + * @param WP_Block_Parser_Block $block The block to add to the output. + * @param int $token_start Byte offset into the document where the first token for the block starts. + * @param int $token_length Byte length of entire block from start of opening token to end of closing token. + * @param int|null $last_offset Last byte offset into document if continuing form earlier output. + */ + public function add_inner_block(\WP_Block_Parser_Block $block, $token_start, $token_length, $last_offset = \null) + { + } + /** + * Pushes the top block from the parsing stack to the output list. + * + * @internal + * @since 5.0.0 + * @param int|null $end_offset byte offset into document for where we should stop sending text output as HTML. + */ + public function add_block_from_stack($end_offset = \null) + { + } + } + /** + * Blocks API: WP_Block_Pattern_Categories_Registry class + * + * @package WordPress + * @subpackage Blocks + * @since 5.5.0 + */ + /** + * Class used for interacting with block pattern categories. + */ + #[\AllowDynamicProperties] + final class WP_Block_Pattern_Categories_Registry + { + /** + * Registers a pattern category. + * + * @since 5.5.0 + * + * @param string $category_name Pattern category name including namespace. + * @param array $category_properties { + * List of properties for the block pattern category. + * + * @type string $label Required. A human-readable label for the pattern category. + * } + * @return bool True if the pattern was registered with success and false otherwise. + * @phpstan-param array{ + * label?: string, + * } $category_properties + */ + public function register($category_name, $category_properties) + { + } + /** + * Unregisters a pattern category. + * + * @since 5.5.0 + * + * @param string $category_name Pattern category name including namespace. + * @return bool True if the pattern was unregistered with success and false otherwise. + */ + public function unregister($category_name) + { + } + /** + * Retrieves an array containing the properties of a registered pattern category. + * + * @since 5.5.0 + * + * @param string $category_name Pattern category name including namespace. + * @return array Registered pattern properties. + */ + public function get_registered($category_name) + { + } + /** + * Retrieves all registered pattern categories. + * + * @since 5.5.0 + * + * @param bool $outside_init_only Return only categories registered outside the `init` action. + * @return array[] Array of arrays containing the registered pattern categories properties. + */ + public function get_all_registered($outside_init_only = \false) + { + } + /** + * Checks if a pattern category is registered. + * + * @since 5.5.0 + * + * @param string $category_name Pattern category name including namespace. + * @return bool True if the pattern category is registered, false otherwise. + */ + public function is_registered($category_name) + { + } + /** + * Utility method to retrieve the main instance of the class. + * + * The instance will be created if it does not exist yet. + * + * @since 5.5.0 + * + * @return WP_Block_Pattern_Categories_Registry The main instance. + */ + public static function get_instance() + { + } + } + /** + * Blocks API: WP_Block_Patterns_Registry class + * + * @package WordPress + * @subpackage Blocks + * @since 5.5.0 + */ + /** + * Class used for interacting with block patterns. + * + * @since 5.5.0 + */ + #[\AllowDynamicProperties] + final class WP_Block_Patterns_Registry + { + /** + * Registers a block pattern. + * + * @since 5.5.0 + * @since 5.8.0 Added support for the `blockTypes` property. + * @since 6.1.0 Added support for the `postTypes` property. + * @since 6.2.0 Added support for the `templateTypes` property. + * @since 6.5.0 Added support for the `filePath` property. + * + * @param string $pattern_name Block pattern name including namespace. + * @param array $pattern_properties { + * List of properties for the block pattern. + * + * @type string $title Required. A human-readable title for the pattern. + * @type string $content Optional. Block HTML markup for the pattern. + * If not provided, the content will be retrieved from the `filePath` if set. + * If both `content` and `filePath` are not set, the pattern will not be registered. + * @type string $description Optional. Visually hidden text used to describe the pattern + * in the inserter. A description is optional, but is strongly + * encouraged when the title does not fully describe what the + * pattern does. The description will help users discover the + * pattern while searching. + * @type int $viewportWidth Optional. The intended width of the pattern to allow for a scaled + * preview within the pattern inserter. + * @type bool $inserter Optional. Determines whether the pattern is visible in inserter. + * To hide a pattern so that it can only be inserted programmatically, + * set this to false. Default true. + * @type string[] $categories Optional. A list of registered pattern categories used to group + * block patterns. Block patterns can be shown on multiple categories. + * A category must be registered separately in order to be used here. + * @type string[] $keywords Optional. A list of aliases or keywords that help users discover + * the pattern while searching. + * @type string[] $blockTypes Optional. A list of block names including namespace that could use + * the block pattern in certain contexts (placeholder, transforms). + * The block pattern is available in the block editor inserter + * regardless of this list of block names. + * Certain blocks support further specificity besides the block name + * (e.g. for `core/template-part` you can specify areas + * like `core/template-part/header` or `core/template-part/footer`). + * @type string[] $postTypes Optional. An array of post types that the pattern is restricted + * to be used with. The pattern will only be available when editing one + * of the post types passed on the array. For all the other post types + * not part of the array the pattern is not available at all. + * @type string[] $templateTypes Optional. An array of template types where the pattern fits. + * @type string $filePath Optional. The full path to the file containing the block pattern content. + * } + * @return bool True if the pattern was registered with success and false otherwise. + * @phpstan-param array{ + * title?: string, + * content?: string, + * description?: string, + * viewportWidth?: int, + * inserter?: bool, + * categories?: string[], + * keywords?: string[], + * blockTypes?: string[], + * postTypes?: string[], + * templateTypes?: string[], + * filePath?: string, + * } $pattern_properties + */ + public function register($pattern_name, $pattern_properties) + { + } + /** + * Unregisters a block pattern. + * + * @since 5.5.0 + * + * @param string $pattern_name Block pattern name including namespace. + * @return bool True if the pattern was unregistered with success and false otherwise. + */ + public function unregister($pattern_name) + { + } + /** + * Retrieves an array containing the properties of a registered block pattern. + * + * @since 5.5.0 + * + * @param string $pattern_name Block pattern name including namespace. + * @return array Registered pattern properties. + */ + public function get_registered($pattern_name) + { + } + /** + * Retrieves all registered block patterns. + * + * @since 5.5.0 + * + * @param bool $outside_init_only Return only patterns registered outside the `init` action. + * @return array[] Array of arrays containing the registered block patterns properties, + * and per style. + */ + public function get_all_registered($outside_init_only = \false) + { + } + /** + * Checks if a block pattern is registered. + * + * @since 5.5.0 + * + * @param string $pattern_name Block pattern name including namespace. + * @return bool True if the pattern is registered, false otherwise. + */ + public function is_registered($pattern_name) + { + } + public function __wakeup() + { + } + /** + * Utility method to retrieve the main instance of the class. + * + * The instance will be created if it does not exist yet. + * + * @since 5.5.0 + * + * @return WP_Block_Patterns_Registry The main instance. + */ + public static function get_instance() + { + } + } + /** + * Blocks API: WP_Block_Styles_Registry class + * + * @package WordPress + * @subpackage Blocks + * @since 5.3.0 + */ + /** + * Class used for interacting with block styles. + * + * @since 5.3.0 + */ + #[\AllowDynamicProperties] + final class WP_Block_Styles_Registry + { + /** + * Registers a block style for the given block type. + * + * If the block styles are present in a standalone stylesheet, register it and pass + * its handle as the `style_handle` argument. If the block styles should be inline, + * use the `inline_style` argument. Usually, one of them would be used to pass CSS + * styles. However, you could also skip them and provide CSS styles in any stylesheet + * or with an inline tag. + * + * @since 5.3.0 + * @since 6.6.0 Added ability to register style across multiple block types along with theme.json-like style data. + * + * @link https://developer.wordpress.org/block-editor/reference-guides/block-api/block-styles/ + * + * @param string|string[] $block_name Block type name including namespace or array of namespaced block type names. + * @param array $style_properties { + * Array containing the properties of the style. + * + * @type string $name The identifier of the style used to compute a CSS class. + * @type string $label A human-readable label for the style. + * @type string $inline_style Inline CSS code that registers the CSS class required + * for the style. + * @type string $style_handle The handle to an already registered style that should be + * enqueued in places where block styles are needed. + * @type bool $is_default Whether this is the default style for the block type. + * @type array $style_data Theme.json-like object to generate CSS from. + * } + * @return bool True if the block style was registered with success and false otherwise. + * @phpstan-param array{ + * name?: string, + * label?: string, + * inline_style?: string, + * style_handle?: string, + * is_default?: bool, + * style_data?: array, + * } $style_properties + */ + public function register($block_name, $style_properties) + { + } + /** + * Unregisters a block style of the given block type. + * + * @since 5.3.0 + * + * @param string $block_name Block type name including namespace. + * @param string $block_style_name Block style name. + * @return bool True if the block style was unregistered with success and false otherwise. + */ + public function unregister($block_name, $block_style_name) + { + } + /** + * Retrieves the properties of a registered block style for the given block type. + * + * @since 5.3.0 + * + * @param string $block_name Block type name including namespace. + * @param string $block_style_name Block style name. + * @return array Registered block style properties. + */ + public function get_registered($block_name, $block_style_name) + { + } + /** + * Retrieves all registered block styles. + * + * @since 5.3.0 + * + * @return array[] Array of arrays containing the registered block styles properties grouped by block type. + */ + public function get_all_registered() + { + } + /** + * Retrieves registered block styles for a specific block type. + * + * @since 5.3.0 + * + * @param string $block_name Block type name including namespace. + * @return array[] Array whose keys are block style names and whose values are block style properties. + */ + public function get_registered_styles_for_block($block_name) + { + } + /** + * Checks if a block style is registered for the given block type. + * + * @since 5.3.0 + * + * @param string $block_name Block type name including namespace. + * @param string $block_style_name Block style name. + * @return bool True if the block style is registered, false otherwise. + */ + public function is_registered($block_name, $block_style_name) + { + } + /** + * Utility method to retrieve the main instance of the class. + * + * The instance will be created if it does not exist yet. + * + * @since 5.3.0 + * + * @return WP_Block_Styles_Registry The main instance. + */ + public static function get_instance() + { + } + } + /** + * Block support flags. + * + * @package WordPress + * + * @since 5.6.0 + */ + /** + * Class encapsulating and implementing Block Supports. + * + * @since 5.6.0 + * + * @access private + */ + #[\AllowDynamicProperties] + class WP_Block_Supports + { + /** + * Tracks the current block to be rendered. + * + * @since 5.6.0 + * @var array + */ + public static $block_to_render = \null; + /** + * Utility method to retrieve the main instance of the class. + * + * The instance will be created if it does not exist yet. + * + * @since 5.6.0 + * + * @return WP_Block_Supports The main instance. + */ + public static function get_instance() + { + } + /** + * Initializes the block supports. It registers the block supports block attributes. + * + * @since 5.6.0 + */ + public static function init() + { + } + /** + * Registers a block support. + * + * @since 5.6.0 + * + * @link https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/ + * + * @param string $block_support_name Block support name. + * @param array $block_support_config Array containing the properties of the block support. + */ + public function register($block_support_name, $block_support_config) + { + } + /** + * Generates an array of HTML attributes, such as classes, by applying to + * the given block all of the features that the block supports. + * + * @since 5.6.0 + * + * @return string[] Array of HTML attribute values keyed by their name. + */ + public function apply_block_supports() + { + } + } + /** + * Blocks API: WP_Block_Template class + * + * @package WordPress + * @since 5.8.0 + */ + /** + * Class representing a block template. + * + * @since 5.8.0 + */ + #[\AllowDynamicProperties] + class WP_Block_Template + { + /** + * Type: wp_template. + * + * @since 5.8.0 + * @var string + */ + public $type; + /** + * Theme. + * + * @since 5.8.0 + * @var string + */ + public $theme; + /** + * Template slug. + * + * @since 5.8.0 + * @var string + */ + public $slug; + /** + * ID. + * + * @since 5.8.0 + * @var string + */ + public $id; + /** + * Title. + * + * @since 5.8.0 + * @var string + */ + public $title = ''; + /** + * Content. + * + * @since 5.8.0 + * @var string + */ + public $content = ''; + /** + * Description. + * + * @since 5.8.0 + * @var string + */ + public $description = ''; + /** + * Source of the content. `theme` and `custom` is used for now. + * + * @since 5.8.0 + * @var string + */ + public $source = 'theme'; + /** + * Origin of the content when the content has been customized. + * When customized, origin takes on the value of source and source becomes + * 'custom'. + * + * @since 5.9.0 + * @var string|null + */ + public $origin; + /** + * Post ID. + * + * @since 5.8.0 + * @var int|null + */ + public $wp_id; + /** + * Template Status. + * + * @since 5.8.0 + * @var string + */ + public $status; + /** + * Whether a template is, or is based upon, an existing template file. + * + * @since 5.8.0 + * @var bool + */ + public $has_theme_file; + /** + * Whether a template is a custom template. + * + * @since 5.9.0 + * + * @var bool + */ + public $is_custom = \true; + /** + * Author. + * + * A value of 0 means no author. + * + * @since 5.9.0 + * @var int|null + */ + public $author; + /** + * Post types. + * + * @since 5.9.0 + * @var string[]|null + */ + public $post_types; + /** + * Area. + * + * @since 5.9.0 + * @var string|null + */ + public $area; + /** + * Modified. + * + * @since 6.3.0 + * @var string|null + */ + public $modified; + } + /** + * Blocks API: WP_Block_Type_Registry class + * + * @package WordPress + * @subpackage Blocks + * @since 5.0.0 + */ + /** + * Core class used for interacting with block types. + * + * @since 5.0.0 + */ + #[\AllowDynamicProperties] + final class WP_Block_Type_Registry + { + /** + * Registers a block type. + * + * @since 5.0.0 + * + * @see WP_Block_Type::__construct() + * + * @param string|WP_Block_Type $name Block type name including namespace, or alternatively + * a complete WP_Block_Type instance. In case a WP_Block_Type + * is provided, the $args parameter will be ignored. + * @param array $args Optional. Array of block type arguments. Accepts any public property + * of `WP_Block_Type`. See WP_Block_Type::__construct() for information + * on accepted arguments. Default empty array. + * @return WP_Block_Type|false The registered block type on success, or false on failure. + * @phpstan-param array{ + * api_version?: string, + * title?: string, + * category?: string|null, + * parent?: string[]|null, + * ancestor?: string[]|null, + * allowed_blocks?: string[]|null, + * icon?: string|null, + * description?: string, + * keywords?: string[], + * textdomain?: string|null, + * styles?: array[], + * variations?: array[], + * selectors?: array, + * supports?: array|null, + * example?: array|null, + * render_callback?: callable|null, + * variation_callback?: callable|null, + * attributes?: array|null, + * uses_context?: string[], + * provides_context?: string[]|null, + * block_hooks?: string[], + * editor_script_handles?: string[], + * script_handles?: string[], + * view_script_handles?: string[], + * editor_style_handles?: string[], + * style_handles?: string[], + * view_style_handles?: string[], + * } $args See WP_Block_Type::__construct() + */ + public function register($name, $args = array()) + { + } + /** + * Unregisters a block type. + * + * @since 5.0.0 + * + * @param string|WP_Block_Type $name Block type name including namespace, or alternatively + * a complete WP_Block_Type instance. + * @return WP_Block_Type|false The unregistered block type on success, or false on failure. + */ + public function unregister($name) + { + } + /** + * Retrieves a registered block type. + * + * @since 5.0.0 + * + * @param string $name Block type name including namespace. + * @return WP_Block_Type|null The registered block type, or null if it is not registered. + */ + public function get_registered($name) + { + } + /** + * Retrieves all registered block types. + * + * @since 5.0.0 + * + * @return WP_Block_Type[] Associative array of `$block_type_name => $block_type` pairs. + */ + public function get_all_registered() + { + } + /** + * Checks if a block type is registered. + * + * @since 5.0.0 + * + * @param string $name Block type name including namespace. + * @return bool True if the block type is registered, false otherwise. + */ + public function is_registered($name) + { + } + public function __wakeup() + { + } + /** + * Utility method to retrieve the main instance of the class. + * + * The instance will be created if it does not exist yet. + * + * @since 5.0.0 + * + * @return WP_Block_Type_Registry The main instance. + */ + public static function get_instance() + { + } + } + /** + * Blocks API: WP_Block_Type class + * + * @package WordPress + * @subpackage Blocks + * @since 5.0.0 + */ + /** + * Core class representing a block type. + * + * @since 5.0.0 + * + * @see register_block_type() + */ + #[\AllowDynamicProperties] + class WP_Block_Type + { + /** + * Block API version. + * + * @since 5.6.0 + * @var int + */ + public $api_version = 1; + /** + * Block type key. + * + * @since 5.0.0 + * @var string + */ + public $name; + /** + * Human-readable block type label. + * + * @since 5.5.0 + * @var string + */ + public $title = ''; + /** + * Block type category classification, used in search interfaces + * to arrange block types by category. + * + * @since 5.5.0 + * @var string|null + */ + public $category = \null; + /** + * Setting parent lets a block require that it is only available + * when nested within the specified blocks. + * + * @since 5.5.0 + * @var string[]|null + */ + public $parent = \null; + /** + * Setting ancestor makes a block available only inside the specified + * block types at any position of the ancestor's block subtree. + * + * @since 6.0.0 + * @var string[]|null + */ + public $ancestor = \null; + /** + * Limits which block types can be inserted as children of this block type. + * + * @since 6.5.0 + * @var string[]|null + */ + public $allowed_blocks = \null; + /** + * Block type icon. + * + * @since 5.5.0 + * @var string|null + */ + public $icon = \null; + /** + * A detailed block type description. + * + * @since 5.5.0 + * @var string + */ + public $description = ''; + /** + * Additional keywords to produce block type as result + * in search interfaces. + * + * @since 5.5.0 + * @var string[] + */ + public $keywords = array(); + /** + * The translation textdomain. + * + * @since 5.5.0 + * @var string|null + */ + public $textdomain = \null; + /** + * Alternative block styles. + * + * @since 5.5.0 + * @var array + */ + public $styles = array(); + /** + * Block variations callback. + * + * @since 6.5.0 + * @var callable|null + */ + public $variation_callback = \null; + /** + * Custom CSS selectors for theme.json style generation. + * + * @since 6.3.0 + * @var array + */ + public $selectors = array(); + /** + * Supported features. + * + * @since 5.5.0 + * @var array|null + */ + public $supports = \null; + /** + * Structured data for the block preview. + * + * @since 5.5.0 + * @var array|null + */ + public $example = \null; + /** + * Block type render callback. + * + * @since 5.0.0 + * @var callable + */ + public $render_callback = \null; + /** + * Block type attributes property schemas. + * + * @since 5.0.0 + * @var array|null + */ + public $attributes = \null; + /** + * Context provided by blocks of this type. + * + * @since 5.5.0 + * @var string[]|null + */ + public $provides_context = \null; + /** + * Block hooks for this block type. + * + * A block hook is specified by a block type and a relative position. + * The hooked block will be automatically inserted in the given position + * next to the "anchor" block whenever the latter is encountered. + * + * @since 6.4.0 + * @var string[] + */ + public $block_hooks = array(); + /** + * Block type editor only script handles. + * + * @since 6.1.0 + * @var string[] + */ + public $editor_script_handles = array(); + /** + * Block type front end and editor script handles. + * + * @since 6.1.0 + * @var string[] + */ + public $script_handles = array(); + /** + * Block type front end only script handles. + * + * @since 6.1.0 + * @var string[] + */ + public $view_script_handles = array(); + /** + * Block type front end only script module IDs. + * + * @since 6.5.0 + * @var string[] + */ + public $view_script_module_ids = array(); + /** + * Block type editor only style handles. + * + * @since 6.1.0 + * @var string[] + */ + public $editor_style_handles = array(); + /** + * Block type front end and editor style handles. + * + * @since 6.1.0 + * @var string[] + */ + public $style_handles = array(); + /** + * Block type front end only style handles. + * + * @since 6.5.0 + * @var string[] + */ + public $view_style_handles = array(); + /** + * Attributes supported by every block. + * + * @since 6.0.0 Added `lock`. + * @since 6.5.0 Added `metadata`. + * @var array + */ + const GLOBAL_ATTRIBUTES = array('lock' => array('type' => 'object'), 'metadata' => array('type' => 'object')); + /** + * Constructor. + * + * Will populate object properties from the provided arguments. + * + * @since 5.0.0 + * @since 5.5.0 Added the `title`, `category`, `parent`, `icon`, `description`, + * `keywords`, `textdomain`, `styles`, `supports`, `example`, + * `uses_context`, and `provides_context` properties. + * @since 5.6.0 Added the `api_version` property. + * @since 5.8.0 Added the `variations` property. + * @since 5.9.0 Added the `view_script` property. + * @since 6.0.0 Added the `ancestor` property. + * @since 6.1.0 Added the `editor_script_handles`, `script_handles`, `view_script_handles`, + * `editor_style_handles`, and `style_handles` properties. + * Deprecated the `editor_script`, `script`, `view_script`, `editor_style`, and `style` properties. + * @since 6.3.0 Added the `selectors` property. + * @since 6.4.0 Added the `block_hooks` property. + * @since 6.5.0 Added the `allowed_blocks`, `variation_callback`, and `view_style_handles` properties. + * + * @see register_block_type() + * + * @param string $block_type Block type name including namespace. + * @param array|string $args { + * Optional. Array or string of arguments for registering a block type. Any arguments may be defined, + * however the ones described below are supported by default. Default empty array. + * + * @type string $api_version Block API version. + * @type string $title Human-readable block type label. + * @type string|null $category Block type category classification, used in + * search interfaces to arrange block types by category. + * @type string[]|null $parent Setting parent lets a block require that it is only + * available when nested within the specified blocks. + * @type string[]|null $ancestor Setting ancestor makes a block available only inside the specified + * block types at any position of the ancestor's block subtree. + * @type string[]|null $allowed_blocks Limits which block types can be inserted as children of this block type. + * @type string|null $icon Block type icon. + * @type string $description A detailed block type description. + * @type string[] $keywords Additional keywords to produce block type as + * result in search interfaces. + * @type string|null $textdomain The translation textdomain. + * @type array[] $styles Alternative block styles. + * @type array[] $variations Block variations. + * @type array $selectors Custom CSS selectors for theme.json style generation. + * @type array|null $supports Supported features. + * @type array|null $example Structured data for the block preview. + * @type callable|null $render_callback Block type render callback. + * @type callable|null $variation_callback Block type variations callback. + * @type array|null $attributes Block type attributes property schemas. + * @type string[] $uses_context Context values inherited by blocks of this type. + * @type string[]|null $provides_context Context provided by blocks of this type. + * @type string[] $block_hooks Block hooks. + * @type string[] $editor_script_handles Block type editor only script handles. + * @type string[] $script_handles Block type front end and editor script handles. + * @type string[] $view_script_handles Block type front end only script handles. + * @type string[] $editor_style_handles Block type editor only style handles. + * @type string[] $style_handles Block type front end and editor style handles. + * @type string[] $view_style_handles Block type front end only style handles. + * } + * @phpstan-param array{ + * api_version?: string, + * title?: string, + * category?: string|null, + * parent?: string[]|null, + * ancestor?: string[]|null, + * allowed_blocks?: string[]|null, + * icon?: string|null, + * description?: string, + * keywords?: string[], + * textdomain?: string|null, + * styles?: array[], + * variations?: array[], + * selectors?: array, + * supports?: array|null, + * example?: array|null, + * render_callback?: callable|null, + * variation_callback?: callable|null, + * attributes?: array|null, + * uses_context?: string[], + * provides_context?: string[]|null, + * block_hooks?: string[], + * editor_script_handles?: string[], + * script_handles?: string[], + * view_script_handles?: string[], + * editor_style_handles?: string[], + * style_handles?: string[], + * view_style_handles?: string[], + * } $args + */ + public function __construct($block_type, $args = array()) + { + } + /** + * Proxies getting values for deprecated properties for script and style handles for backward compatibility. + * Gets the value for the corresponding new property if the first item in the array provided. + * + * @since 6.1.0 + * + * @param string $name Deprecated property name. + * + * @return string|string[]|null|void The value read from the new property if the first item in the array provided, + * null when value not found, or void when unknown property name provided. + */ + public function __get($name) + { + } + /** + * Proxies checking for deprecated properties for script and style handles for backward compatibility. + * Checks whether the corresponding new property has the first item in the array provided. + * + * @since 6.1.0 + * + * @param string $name Deprecated property name. + * + * @return bool Returns true when for the new property the first item in the array exists, + * or false otherwise. + */ + public function __isset($name) + { + } + /** + * Proxies setting values for deprecated properties for script and style handles for backward compatibility. + * Sets the value for the corresponding new property as the first item in the array. + * It also allows setting custom properties for backward compatibility. + * + * @since 6.1.0 + * + * @param string $name Property name. + * @param mixed $value Property value. + * @phpstan-return void + */ + public function __set($name, $value) + { + } + /** + * Renders the block type output for given attributes. + * + * @since 5.0.0 + * + * @param array $attributes Optional. Block attributes. Default empty array. + * @param string $content Optional. Block content. Default empty string. + * @return string Rendered block type output. + */ + public function render($attributes = array(), $content = '') + { + } + /** + * Returns true if the block type is dynamic, or false otherwise. A dynamic + * block is one which defers its rendering to occur on-demand at runtime. + * + * @since 5.0.0 + * + * @return bool Whether block type is dynamic. + */ + public function is_dynamic() + { + } + /** + * Validates attributes against the current block schema, populating + * defaulted and missing values. + * + * @since 5.0.0 + * + * @param array $attributes Original block attributes. + * @return array Prepared block attributes. + */ + public function prepare_attributes_for_render($attributes) + { + } + /** + * Sets block type properties. + * + * @since 5.0.0 + * + * @param array|string $args Array or string of arguments for registering a block type. + * See WP_Block_Type::__construct() for information on accepted arguments. + * @phpstan-param array{ + * api_version?: string, + * title?: string, + * category?: string|null, + * parent?: string[]|null, + * ancestor?: string[]|null, + * allowed_blocks?: string[]|null, + * icon?: string|null, + * description?: string, + * keywords?: string[], + * textdomain?: string|null, + * styles?: array[], + * variations?: array[], + * selectors?: array, + * supports?: array|null, + * example?: array|null, + * render_callback?: callable|null, + * variation_callback?: callable|null, + * attributes?: array|null, + * uses_context?: string[], + * provides_context?: string[]|null, + * block_hooks?: string[], + * editor_script_handles?: string[], + * script_handles?: string[], + * view_script_handles?: string[], + * editor_style_handles?: string[], + * style_handles?: string[], + * view_style_handles?: string[], + * } $args See WP_Block_Type::__construct() + */ + public function set_props($args) + { + } + /** + * Get all available block attributes including possible layout attribute from Columns block. + * + * @since 5.0.0 + * + * @return array Array of attributes. + */ + public function get_attributes() + { + } + /** + * Get block variations. + * + * @since 6.5.0 + * + * @return array[] + */ + public function get_variations() + { + } + /** + * Get block uses context. + * + * @since 6.5.0 + * + * @return string[] + */ + public function get_uses_context() + { + } + } + /** + * Blocks API: WP_Block class + * + * @package WordPress + * @since 5.5.0 + */ + /** + * Class representing a parsed instance of a block. + * + * @since 5.5.0 + * @property array $attributes + */ + #[\AllowDynamicProperties] + class WP_Block + { + /** + * Original parsed array representation of block. + * + * @since 5.5.0 + * @var array + */ + public $parsed_block; + /** + * Name of block. + * + * @example "core/paragraph" + * + * @since 5.5.0 + * @var string + */ + public $name; + /** + * Block type associated with the instance. + * + * @since 5.5.0 + * @var WP_Block_Type + */ + public $block_type; + /** + * Block context values. + * + * @since 5.5.0 + * @var array + */ + public $context = array(); + /** + * All available context of the current hierarchy. + * + * @since 5.5.0 + * @var array + * @access protected + */ + protected $available_context; + /** + * Block type registry. + * + * @since 5.9.0 + * @var WP_Block_Type_Registry + * @access protected + */ + protected $registry; + /** + * List of inner blocks (of this same class) + * + * @since 5.5.0 + * @var WP_Block_List + */ + public $inner_blocks = array(); + /** + * Resultant HTML from inside block comment delimiters after removing inner + * blocks. + * + * @example "...Just <!-- wp:test /--> testing..." -> "Just testing..." + * + * @since 5.5.0 + * @var string + */ + public $inner_html = ''; + /** + * List of string fragments and null markers where inner blocks were found + * + * @example array( + * 'inner_html' => 'BeforeInnerAfter', + * 'inner_blocks' => array( block, block ), + * 'inner_content' => array( 'Before', null, 'Inner', null, 'After' ), + * ) + * + * @since 5.5.0 + * @var array + */ + public $inner_content = array(); + /** + * Constructor. + * + * Populates object properties from the provided block instance argument. + * + * The given array of context values will not necessarily be available on + * the instance itself, but is treated as the full set of values provided by + * the block's ancestry. This is assigned to the private `available_context` + * property. Only values which are configured to consumed by the block via + * its registered type will be assigned to the block's `context` property. + * + * @since 5.5.0 + * + * @param array $block { + * A representative array of a single parsed block object. See WP_Block_Parser_Block. + * + * @type string $blockName Name of block. + * @type array $attrs Attributes from block comment delimiters. + * @type array $innerBlocks List of inner blocks. An array of arrays that + * have the same structure as this one. + * @type string $innerHTML HTML from inside block comment delimiters. + * @type array $innerContent List of string fragments and null markers where inner blocks were found. + * } + * @param array $available_context Optional array of ancestry context values. + * @param WP_Block_Type_Registry $registry Optional block type registry. + * @phpstan-param array{ + * blockName?: string, + * attrs?: array, + * innerBlocks?: array, + * innerHTML?: string, + * innerContent?: array, + * } $block + */ + public function __construct($block, $available_context = array(), $registry = \null) + { + } + /** + * Returns a value from an inaccessible property. + * + * This is used to lazily initialize the `attributes` property of a block, + * such that it is only prepared with default attributes at the time that + * the property is accessed. For all other inaccessible properties, a `null` + * value is returned. + * + * @since 5.5.0 + * + * @param string $name Property name. + * @return array|null Prepared attributes, or null. + */ + public function __get($name) + { + } + /** + * Generates the render output for the block. + * + * @since 5.5.0 + * @since 6.5.0 Added block bindings processing. + * + * @global WP_Post $post Global post object. + * + * @param array $options { + * Optional options object. + * + * @type bool $dynamic Defaults to 'true'. Optionally set to false to avoid using the block's render_callback. + * } + * @return string Rendered block output. + * @phpstan-param array{ + * dynamic?: bool, + * } $options + */ + public function render($options = array()) + { + } + } + /** + * WP_Classic_To_Block_Menu_Converter class + * + * @package WordPress + * @since 6.3.0 + */ + /** + * Converts a Classic Menu to Block Menu blocks. + * + * @since 6.3.0 + * @access public + */ + class WP_Classic_To_Block_Menu_Converter + { + /** + * Converts a Classic Menu to blocks. + * + * @since 6.3.0 + * + * @param WP_Term $menu The Menu term object of the menu to convert. + * @return string|WP_Error The serialized and normalized parsed blocks on success, + * an empty string when there are no menus to convert, + * or WP_Error on invalid menu. + */ + public static function convert($menu) + { + } + } + /** + * Comment API: WP_Comment_Query class + * + * @package WordPress + * @subpackage Comments + * @since 4.4.0 + */ + /** + * Core class used for querying comments. + * + * @since 3.1.0 + * + * @see WP_Comment_Query::__construct() for accepted arguments. + */ + #[\AllowDynamicProperties] + class WP_Comment_Query + { + /** + * SQL for database query. + * + * @since 4.0.1 + * @var string + */ + public $request; + /** + * Metadata query container + * + * @since 3.5.0 + * @var WP_Meta_Query A meta query instance. + */ + public $meta_query = \false; + /** + * Metadata query clauses. + * + * @since 4.4.0 + * @var array + */ + protected $meta_query_clauses; + /** + * SQL query clauses. + * + * @since 4.4.0 + * @var array + */ + protected $sql_clauses = array('select' => '', 'from' => '', 'where' => array(), 'groupby' => '', 'orderby' => '', 'limits' => ''); + /** + * SQL WHERE clause. + * + * Stored after the {@see 'comments_clauses'} filter is run on the compiled WHERE sub-clauses. + * + * @since 4.4.2 + * @var string + */ + protected $filtered_where_clause; + /** + * Date query container + * + * @since 3.7.0 + * @var WP_Date_Query A date query instance. + */ + public $date_query = \false; + /** + * Query vars set by the user. + * + * @since 3.1.0 + * @var array + */ + public $query_vars; + /** + * Default values for query vars. + * + * @since 4.2.0 + * @var array + */ + public $query_var_defaults; + /** + * List of comments located by the query. + * + * @since 4.0.0 + * @var int[]|WP_Comment[] + */ + public $comments; + /** + * The amount of found comments for the current query. + * + * @since 4.4.0 + * @var int + */ + public $found_comments = 0; + /** + * The number of pages. + * + * @since 4.4.0 + * @var int + */ + public $max_num_pages = 0; + /** + * Make private/protected methods readable for backward compatibility. + * + * @since 4.0.0 + * + * @param string $name Method to call. + * @param array $arguments Arguments to pass when calling. + * @return mixed|false Return value of the callback, false otherwise. + */ + public function __call($name, $arguments) + { + } + /** + * Constructor. + * + * Sets up the comment query, based on the query vars passed. + * + * @since 4.2.0 + * @since 4.4.0 `$parent__in` and `$parent__not_in` were added. + * @since 4.4.0 Order by `comment__in` was added. `$update_comment_meta_cache`, `$no_found_rows`, + * `$hierarchical`, and `$update_comment_post_cache` were added. + * @since 4.5.0 Introduced the `$author_url` argument. + * @since 4.6.0 Introduced the `$cache_domain` argument. + * @since 4.9.0 Introduced the `$paged` argument. + * @since 5.1.0 Introduced the `$meta_compare_key` argument. + * @since 5.3.0 Introduced the `$meta_type_key` argument. + * + * @param string|array $query { + * Optional. Array or query string of comment query parameters. Default empty. + * + * @type string $author_email Comment author email address. Default empty. + * @type string $author_url Comment author URL. Default empty. + * @type int[] $author__in Array of author IDs to include comments for. Default empty. + * @type int[] $author__not_in Array of author IDs to exclude comments for. Default empty. + * @type int[] $comment__in Array of comment IDs to include. Default empty. + * @type int[] $comment__not_in Array of comment IDs to exclude. Default empty. + * @type bool $count Whether to return a comment count (true) or array of + * comment objects (false). Default false. + * @type array $date_query Date query clauses to limit comments by. See WP_Date_Query. + * Default null. + * @type string $fields Comment fields to return. Accepts 'ids' for comment IDs + * only or empty for all fields. Default empty. + * @type array $include_unapproved Array of IDs or email addresses of users whose unapproved + * comments will be returned by the query regardless of + * `$status`. Default empty. + * @type int $karma Karma score to retrieve matching comments for. + * Default empty. + * @type string|string[] $meta_key Meta key or keys to filter by. + * @type string|string[] $meta_value Meta value or values to filter by. + * @type string $meta_compare MySQL operator used for comparing the meta value. + * See WP_Meta_Query::__construct() for accepted values and default value. + * @type string $meta_compare_key MySQL operator used for comparing the meta key. + * See WP_Meta_Query::__construct() for accepted values and default value. + * @type string $meta_type MySQL data type that the meta_value column will be CAST to for comparisons. + * See WP_Meta_Query::__construct() for accepted values and default value. + * @type string $meta_type_key MySQL data type that the meta_key column will be CAST to for comparisons. + * See WP_Meta_Query::__construct() for accepted values and default value. + * @type array $meta_query An associative array of WP_Meta_Query arguments. + * See WP_Meta_Query::__construct() for accepted values. + * @type int $number Maximum number of comments to retrieve. + * Default empty (no limit). + * @type int $paged When used with `$number`, defines the page of results to return. + * When used with `$offset`, `$offset` takes precedence. Default 1. + * @type int $offset Number of comments to offset the query. Used to build + * LIMIT clause. Default 0. + * @type bool $no_found_rows Whether to disable the `SQL_CALC_FOUND_ROWS` query. + * Default: true. + * @type string|array $orderby Comment status or array of statuses. To use 'meta_value' + * or 'meta_value_num', `$meta_key` must also be defined. + * To sort by a specific `$meta_query` clause, use that + * clause's array key. Accepts: + * - 'comment_agent' + * - 'comment_approved' + * - 'comment_author' + * - 'comment_author_email' + * - 'comment_author_IP' + * - 'comment_author_url' + * - 'comment_content' + * - 'comment_date' + * - 'comment_date_gmt' + * - 'comment_ID' + * - 'comment_karma' + * - 'comment_parent' + * - 'comment_post_ID' + * - 'comment_type' + * - 'user_id' + * - 'comment__in' + * - 'meta_value' + * - 'meta_value_num' + * - The value of `$meta_key` + * - The array keys of `$meta_query` + * - false, an empty array, or 'none' to disable `ORDER BY` clause. + * Default: 'comment_date_gmt'. + * @type string $order How to order retrieved comments. Accepts 'ASC', 'DESC'. + * Default: 'DESC'. + * @type int $parent Parent ID of comment to retrieve children of. + * Default empty. + * @type int[] $parent__in Array of parent IDs of comments to retrieve children for. + * Default empty. + * @type int[] $parent__not_in Array of parent IDs of comments *not* to retrieve + * children for. Default empty. + * @type int[] $post_author__in Array of author IDs to retrieve comments for. + * Default empty. + * @type int[] $post_author__not_in Array of author IDs *not* to retrieve comments for. + * Default empty. + * @type int $post_id Limit results to those affiliated with a given post ID. + * Default 0. + * @type int[] $post__in Array of post IDs to include affiliated comments for. + * Default empty. + * @type int[] $post__not_in Array of post IDs to exclude affiliated comments for. + * Default empty. + * @type int $post_author Post author ID to limit results by. Default empty. + * @type string|string[] $post_status Post status or array of post statuses to retrieve + * affiliated comments for. Pass 'any' to match any value. + * Default empty. + * @type string|string[] $post_type Post type or array of post types to retrieve affiliated + * comments for. Pass 'any' to match any value. Default empty. + * @type string $post_name Post name to retrieve affiliated comments for. + * Default empty. + * @type int $post_parent Post parent ID to retrieve affiliated comments for. + * Default empty. + * @type string $search Search term(s) to retrieve matching comments for. + * Default empty. + * @type string|array $status Comment statuses to limit results by. Accepts an array + * or space/comma-separated list of 'hold' (`comment_status=0`), + * 'approve' (`comment_status=1`), 'all', or a custom + * comment status. Default 'all'. + * @type string|string[] $type Include comments of a given type, or array of types. + * Accepts 'comment', 'pings' (includes 'pingback' and + * 'trackback'), or any custom type string. Default empty. + * @type string[] $type__in Include comments from a given array of comment types. + * Default empty. + * @type string[] $type__not_in Exclude comments from a given array of comment types. + * Default empty. + * @type int $user_id Include comments for a specific user ID. Default empty. + * @type bool|string $hierarchical Whether to include comment descendants in the results. + * - 'threaded' returns a tree, with each comment's children + * stored in a `children` property on the `WP_Comment` object. + * - 'flat' returns a flat array of found comments plus + * their children. + * - Boolean `false` leaves out descendants. + * The parameter is ignored (forced to `false`) when + * `$fields` is 'ids' or 'counts'. Accepts 'threaded', + * 'flat', or false. Default: false. + * @type string $cache_domain Unique cache key to be produced when this query is stored in + * an object cache. Default is 'core'. + * @type bool $update_comment_meta_cache Whether to prime the metadata cache for found comments. + * Default true. + * @type bool $update_comment_post_cache Whether to prime the cache for comment posts. + * Default false. + * } + * @phpstan-param array{ + * author_email?: string, + * author_url?: string, + * author__in?: int[], + * author__not_in?: int[], + * comment__in?: int[], + * comment__not_in?: int[], + * count?: bool, + * date_query?: array, + * fields?: string, + * include_unapproved?: array, + * karma?: int, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * number?: int, + * paged?: int, + * offset?: int, + * no_found_rows?: bool, + * orderby?: string|array, + * order?: string, + * parent?: int, + * parent__in?: int[], + * parent__not_in?: int[], + * post_author__in?: int[], + * post_author__not_in?: int[], + * post_id?: int, + * post__in?: int[], + * post__not_in?: int[], + * post_author?: int, + * post_status?: string|string[], + * post_type?: string|string[], + * post_name?: string, + * post_parent?: int, + * search?: string, + * status?: string|array, + * type?: string|string[], + * type__in?: string[], + * type__not_in?: string[], + * user_id?: int, + * hierarchical?: bool|string, + * cache_domain?: string, + * update_comment_meta_cache?: bool, + * update_comment_post_cache?: bool, + * } $query + */ + public function __construct($query = '') + { + } + /** + * Parse arguments passed to the comment query with default query parameters. + * + * @since 4.2.0 Extracted from WP_Comment_Query::query(). + * + * @param string|array $query WP_Comment_Query arguments. See WP_Comment_Query::__construct() for accepted arguments. + * @phpstan-param array{ + * author_email?: string, + * author_url?: string, + * author__in?: int[], + * author__not_in?: int[], + * comment__in?: int[], + * comment__not_in?: int[], + * count?: bool, + * date_query?: array, + * fields?: string, + * include_unapproved?: array, + * karma?: int, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * number?: int, + * paged?: int, + * offset?: int, + * no_found_rows?: bool, + * orderby?: string|array, + * order?: string, + * parent?: int, + * parent__in?: int[], + * parent__not_in?: int[], + * post_author__in?: int[], + * post_author__not_in?: int[], + * post_id?: int, + * post__in?: int[], + * post__not_in?: int[], + * post_author?: int, + * post_status?: string|string[], + * post_type?: string|string[], + * post_name?: string, + * post_parent?: int, + * search?: string, + * status?: string|array, + * type?: string|string[], + * type__in?: string[], + * type__not_in?: string[], + * user_id?: int, + * hierarchical?: bool|string, + * cache_domain?: string, + * update_comment_meta_cache?: bool, + * update_comment_post_cache?: bool, + * } $query See WP_Comment_Query::__construct() + */ + public function parse_query($query = '') + { + } + /** + * Sets up the WordPress query for retrieving comments. + * + * @since 3.1.0 + * @since 4.1.0 Introduced 'comment__in', 'comment__not_in', 'post_author__in', + * 'post_author__not_in', 'author__in', 'author__not_in', 'post__in', + * 'post__not_in', 'include_unapproved', 'type__in', and 'type__not_in' + * arguments to $query_vars. + * @since 4.2.0 Moved parsing to WP_Comment_Query::parse_query(). + * + * @param string|array $query Array or URL query string of parameters. + * @return array|int List of comments, or number of comments when 'count' is passed as a query var. + */ + public function query($query) + { + } + /** + * Get a list of comments matching the query vars. + * + * @since 4.2.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return int|int[]|WP_Comment[] List of comments or number of found comments if `$count` argument is true. + */ + public function get_comments() + { + } + /** + * Used internally to get a list of comment IDs matching the query vars. + * + * @since 4.4.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return int|array A single count of comment IDs if a count query. An array of comment IDs if a full query. + */ + protected function get_comment_ids() + { + } + /** + * Fetch descendants for located comments. + * + * Instead of calling `get_children()` separately on each child comment, we do a single set of queries to fetch + * the descendant trees for all matched top-level comments. + * + * @since 4.4.0 + * + * @param WP_Comment[] $comments Array of top-level comments whose descendants should be filled in. + * @return array + */ + protected function fill_descendants($comments) + { + } + /** + * Used internally to generate an SQL string for searching across multiple columns. + * + * @since 3.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $search Search string. + * @param string[] $columns Array of columns to search. + * @return string Search SQL. + */ + protected function get_search_sql($search, $columns) + { + } + /** + * Parse and sanitize 'orderby' keys passed to the comment query. + * + * @since 4.2.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $orderby Alias for the field to order by. + * @return string|false Value to used in the ORDER clause. False otherwise. + */ + protected function parse_orderby($orderby) + { + } + /** + * Parse an 'order' query variable and cast it to ASC or DESC as necessary. + * + * @since 4.2.0 + * + * @param string $order The 'order' query variable. + * @return string The sanitized 'order' query variable. + */ + protected function parse_order($order) + { + } + } + /** + * Comment API: WP_Comment class + * + * @package WordPress + * @subpackage Comments + * @since 4.4.0 + */ + /** + * Core class used to organize comments as instantiated objects with defined members. + * + * @since 4.4.0 + */ + #[\AllowDynamicProperties] + final class WP_Comment + { + /** + * Comment ID. + * + * A numeric string, for compatibility reasons. + * + * @since 4.4.0 + * @var string + */ + public $comment_ID; + /** + * ID of the post the comment is associated with. + * + * A numeric string, for compatibility reasons. + * + * @since 4.4.0 + * @var string + */ + public $comment_post_ID = 0; + /** + * Comment author name. + * + * @since 4.4.0 + * @var string + */ + public $comment_author = ''; + /** + * Comment author email address. + * + * @since 4.4.0 + * @var string + */ + public $comment_author_email = ''; + /** + * Comment author URL. + * + * @since 4.4.0 + * @var string + */ + public $comment_author_url = ''; + /** + * Comment author IP address (IPv4 format). + * + * @since 4.4.0 + * @var string + */ + public $comment_author_IP = ''; + /** + * Comment date in YYYY-MM-DD HH:MM:SS format. + * + * @since 4.4.0 + * @var string + */ + public $comment_date = '0000-00-00 00:00:00'; + /** + * Comment GMT date in YYYY-MM-DD HH::MM:SS format. + * + * @since 4.4.0 + * @var string + */ + public $comment_date_gmt = '0000-00-00 00:00:00'; + /** + * Comment content. + * + * @since 4.4.0 + * @var string + */ + public $comment_content; + /** + * Comment karma count. + * + * A numeric string, for compatibility reasons. + * + * @since 4.4.0 + * @var string + */ + public $comment_karma = 0; + /** + * Comment approval status. + * + * @since 4.4.0 + * @var string + */ + public $comment_approved = '1'; + /** + * Comment author HTTP user agent. + * + * @since 4.4.0 + * @var string + */ + public $comment_agent = ''; + /** + * Comment type. + * + * @since 4.4.0 + * @since 5.5.0 Default value changed to `comment`. + * @var string + */ + public $comment_type = 'comment'; + /** + * Parent comment ID. + * + * A numeric string, for compatibility reasons. + * + * @since 4.4.0 + * @var string + */ + public $comment_parent = 0; + /** + * Comment author ID. + * + * A numeric string, for compatibility reasons. + * + * @since 4.4.0 + * @var string + */ + public $user_id = 0; + /** + * Retrieves a WP_Comment instance. + * + * @since 4.4.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $id Comment ID. + * @return WP_Comment|false Comment object, otherwise false. + */ + public static function get_instance($id) + { + } + /** + * Constructor. + * + * Populates properties with object vars. + * + * @since 4.4.0 + * + * @param WP_Comment $comment Comment object. + */ + public function __construct($comment) + { + } + /** + * Converts object to array. + * + * @since 4.4.0 + * + * @return array Object as array. + */ + public function to_array() + { + } + /** + * Gets the children of a comment. + * + * @since 4.4.0 + * + * @param array $args { + * Array of arguments used to pass to get_comments() and determine format. + * + * @type string $format Return value format. 'tree' for a hierarchical tree, 'flat' for a flattened array. + * Default 'tree'. + * @type string $status Comment status to limit results by. Accepts 'hold' (`comment_status=0`), + * 'approve' (`comment_status=1`), 'all', or a custom comment status. + * Default 'all'. + * @type string $hierarchical Whether to include comment descendants in the results. + * 'threaded' returns a tree, with each comment's children + * stored in a `children` property on the `WP_Comment` object. + * 'flat' returns a flat array of found comments plus their children. + * Pass `false` to leave out descendants. + * The parameter is ignored (forced to `false`) when `$fields` is 'ids' or 'counts'. + * Accepts 'threaded', 'flat', or false. Default: 'threaded'. + * @type string|array $orderby Comment status or array of statuses. To use 'meta_value' + * or 'meta_value_num', `$meta_key` must also be defined. + * To sort by a specific `$meta_query` clause, use that + * clause's array key. Accepts 'comment_agent', + * 'comment_approved', 'comment_author', + * 'comment_author_email', 'comment_author_IP', + * 'comment_author_url', 'comment_content', 'comment_date', + * 'comment_date_gmt', 'comment_ID', 'comment_karma', + * 'comment_parent', 'comment_post_ID', 'comment_type', + * 'user_id', 'comment__in', 'meta_value', 'meta_value_num', + * the value of $meta_key, and the array keys of + * `$meta_query`. Also accepts false, an empty array, or + * 'none' to disable `ORDER BY` clause. + * } + * @return WP_Comment[] Array of `WP_Comment` objects. + * @phpstan-param array{ + * format?: string, + * status?: string, + * hierarchical?: string, + * orderby?: string|array, + * } $args + */ + public function get_children($args = array()) + { + } + /** + * Adds a child to the comment. + * + * Used by `WP_Comment_Query` when bulk-filling descendants. + * + * @since 4.4.0 + * + * @param WP_Comment $child Child comment. + */ + public function add_child(\WP_Comment $child) + { + } + /** + * Gets a child comment by ID. + * + * @since 4.4.0 + * + * @param int $child_id ID of the child. + * @return WP_Comment|false Returns the comment object if found, otherwise false. + */ + public function get_child($child_id) + { + } + /** + * Sets the 'populated_children' flag. + * + * This flag is important for ensuring that calling `get_children()` on a childless comment will not trigger + * unneeded database queries. + * + * @since 4.4.0 + * + * @param bool $set Whether the comment's children have already been populated. + */ + public function populated_children($set) + { + } + /** + * Determines whether a non-public property is set. + * + * If `$name` matches a post field, the comment post will be loaded and the post's value checked. + * + * @since 4.4.0 + * + * @param string $name Property name. + * @return bool + */ + public function __isset($name) + { + } + /** + * Magic getter. + * + * If `$name` matches a post field, the comment post will be loaded and the post's value returned. + * + * @since 4.4.0 + * + * @param string $name Property name. + * @return mixed + */ + public function __get($name) + { + } + } + /** + * WordPress Customize Control classes + * + * @package WordPress + * @subpackage Customize + * @since 3.4.0 + */ + /** + * Customize Control class. + * + * @since 3.4.0 + */ + #[\AllowDynamicProperties] + class WP_Customize_Control + { + /** + * Incremented with each new class instantiation, then stored in $instance_number. + * + * Used when sorting two instances whose priorities are equal. + * + * @since 4.1.0 + * @var int + */ + protected static $instance_count = 0; + /** + * Order in which this instance was created in relation to other instances. + * + * @since 4.1.0 + * @var int + */ + public $instance_number; + /** + * Customizer manager. + * + * @since 3.4.0 + * @var WP_Customize_Manager + */ + public $manager; + /** + * Control ID. + * + * @since 3.4.0 + * @var string + */ + public $id; + /** + * All settings tied to the control. + * + * @since 3.4.0 + * @var array + */ + public $settings; + /** + * The primary setting for the control (if there is one). + * + * @since 3.4.0 + * @var string|WP_Customize_Setting|null + */ + public $setting = 'default'; + /** + * Capability required to use this control. + * + * Normally this is empty and the capability is derived from the capabilities + * of the associated `$settings`. + * + * @since 4.5.0 + * @var string + */ + public $capability; + /** + * Order priority to load the control in Customizer. + * + * @since 3.4.0 + * @var int + */ + public $priority = 10; + /** + * Section the control belongs to. + * + * @since 3.4.0 + * @var string + */ + public $section = ''; + /** + * Label for the control. + * + * @since 3.4.0 + * @var string + */ + public $label = ''; + /** + * Description for the control. + * + * @since 4.0.0 + * @var string + */ + public $description = ''; + /** + * List of choices for 'radio' or 'select' type controls, where values are the keys, and labels are the values. + * + * @since 3.4.0 + * @var array + */ + public $choices = array(); + /** + * List of custom input attributes for control output, where attribute names are the keys and values are the values. + * + * Not used for 'checkbox', 'radio', 'select', 'textarea', or 'dropdown-pages' control types. + * + * @since 4.0.0 + * @var array + */ + public $input_attrs = array(); + /** + * Show UI for adding new content, currently only used for the dropdown-pages control. + * + * @since 4.7.0 + * @var bool + */ + public $allow_addition = \false; + /** + * @deprecated It is better to just call the json() method + * @since 3.4.0 + * @var array + */ + public $json = array(); + /** + * Control's Type. + * + * @since 3.4.0 + * @var string + */ + public $type = 'text'; + /** + * Callback. + * + * @since 4.0.0 + * + * @see WP_Customize_Control::active() + * + * @var callable Callback is called with one argument, the instance of + * WP_Customize_Control, and returns bool to indicate whether + * the control is active (such as it relates to the URL + * currently being previewed). + */ + public $active_callback = ''; + /** + * Constructor. + * + * Supplied `$args` override class property defaults. + * + * If `$args['settings']` is not defined, use the `$id` as the setting ID. + * + * @since 3.4.0 + * + * @param WP_Customize_Manager $manager Customizer bootstrap instance. + * @param string $id Control ID. + * @param array $args { + * Optional. Array of properties for the new Control object. Default empty array. + * + * @type int $instance_number Order in which this instance was created in relation + * to other instances. + * @type WP_Customize_Manager $manager Customizer bootstrap instance. + * @type string $id Control ID. + * @type array $settings All settings tied to the control. If undefined, `$id` will + * be used. + * @type string $setting The primary setting for the control (if there is one). + * Default 'default'. + * @type string $capability Capability required to use this control. Normally this is empty + * and the capability is derived from `$settings`. + * @type int $priority Order priority to load the control. Default 10. + * @type string $section Section the control belongs to. Default empty. + * @type string $label Label for the control. Default empty. + * @type string $description Description for the control. Default empty. + * @type array $choices List of choices for 'radio' or 'select' type controls, where + * values are the keys, and labels are the values. + * Default empty array. + * @type array $input_attrs List of custom input attributes for control output, where + * attribute names are the keys and values are the values. Not + * used for 'checkbox', 'radio', 'select', 'textarea', or + * 'dropdown-pages' control types. Default empty array. + * @type bool $allow_addition Show UI for adding new content, currently only used for the + * dropdown-pages control. Default false. + * @type array $json Deprecated. Use WP_Customize_Control::json() instead. + * @type string $type Control type. Core controls include 'text', 'checkbox', + * 'textarea', 'radio', 'select', and 'dropdown-pages'. Additional + * input types such as 'email', 'url', 'number', 'hidden', and + * 'date' are supported implicitly. Default 'text'. + * @type callable $active_callback Active callback. + * } + * @phpstan-param array{ + * instance_number?: int, + * manager?: WP_Customize_Manager, + * id?: string, + * settings?: array, + * setting?: string, + * capability?: string, + * priority?: int, + * section?: string, + * label?: string, + * description?: string, + * choices?: array, + * input_attrs?: array, + * allow_addition?: bool, + * json?: array, + * type?: string, + * active_callback?: callable, + * } $args + */ + public function __construct($manager, $id, $args = array()) + { + } + /** + * Enqueue control related scripts/styles. + * + * @since 3.4.0 + */ + public function enqueue() + { + } + /** + * Check whether control is active to current Customizer preview. + * + * @since 4.0.0 + * + * @return bool Whether the control is active to the current preview. + */ + public final function active() + { + } + /** + * Default callback used when invoking WP_Customize_Control::active(). + * + * Subclasses can override this with their specific logic, or they may + * provide an 'active_callback' argument to the constructor. + * + * @since 4.0.0 + * + * @return true Always true. + */ + public function active_callback() + { + } + /** + * Fetch a setting's value. + * Grabs the main setting by default. + * + * @since 3.4.0 + * + * @param string $setting_key + * @return mixed The requested setting's value, if the setting exists. + */ + public final function value($setting_key = 'default') + { + } + /** + * Refresh the parameters passed to the JavaScript via JSON. + * + * @since 3.4.0 + */ + public function to_json() + { + } + /** + * Get the data to export to the client via JSON. + * + * @since 4.1.0 + * + * @return array Array of parameters passed to the JavaScript. + */ + public function json() + { + } + /** + * Checks if the user can use this control. + * + * Returns false if the user cannot manipulate one of the associated settings, + * or if one of the associated settings does not exist. Also returns false if + * the associated section does not exist or if its capability check returns + * false. + * + * @since 3.4.0 + * + * @return bool False if theme doesn't support the control or user doesn't have the required permissions, otherwise true. + */ + public final function check_capabilities() + { + } + /** + * Get the control's content for insertion into the Customizer pane. + * + * @since 4.1.0 + * + * @return string Contents of the control. + */ + public final function get_content() + { + } + /** + * Check capabilities and render the control. + * + * @since 3.4.0 + * @uses WP_Customize_Control::render() + * @phpstan-return void + */ + public final function maybe_render() + { + } + /** + * Renders the control wrapper and calls $this->render_content() for the internals. + * + * @since 3.4.0 + */ + protected function render() + { + } + /** + * Get the data link attribute for a setting. + * + * @since 3.4.0 + * @since 4.9.0 Return a `data-customize-setting-key-link` attribute if a setting is not registered for the supplied setting key. + * + * @param string $setting_key + * @return string Data link parameter, a `data-customize-setting-link` attribute if the `$setting_key` refers to a pre-registered setting, + * and a `data-customize-setting-key-link` attribute if the setting is not yet registered. + */ + public function get_link($setting_key = 'default') + { + } + /** + * Render the data link attribute for the control's input element. + * + * @since 3.4.0 + * @uses WP_Customize_Control::get_link() + * + * @param string $setting_key + */ + public function link($setting_key = 'default') + { + } + /** + * Render the custom attributes for the control's input element. + * + * @since 4.0.0 + */ + public function input_attrs() + { + } + /** + * Render the control's content. + * + * Allows the content to be overridden without having to rewrite the wrapper in `$this::render()`. + * + * Supports basic input types `text`, `checkbox`, `textarea`, `radio`, `select` and `dropdown-pages`. + * Additional input types such as `email`, `url`, `number`, `hidden` and `date` are supported implicitly. + * + * Control content can alternately be rendered in JS. See WP_Customize_Control::print_template(). + * + * @since 3.4.0 + * @phpstan-return void + */ + protected function render_content() + { + } + /** + * Render the control's JS template. + * + * This function is only run for control types that have been registered with + * WP_Customize_Manager::register_control_type(). + * + * In the future, this will also print the template for the control's container + * element and be override-able. + * + * @since 4.1.0 + */ + public final function print_template() + { + } + /** + * An Underscore (JS) template for this control's content (but not its container). + * + * Class variables for this control class are available in the `data` JS object; + * export custom variables by overriding WP_Customize_Control::to_json(). + * + * @see WP_Customize_Control::print_template() + * + * @since 4.1.0 + */ + protected function content_template() + { + } + } + /** + * WordPress Customize Manager classes + * + * @package WordPress + * @subpackage Customize + * @since 3.4.0 + */ + /** + * Customize Manager class. + * + * Bootstraps the Customize experience on the server-side. + * + * Sets up the theme-switching process if a theme other than the active one is + * being previewed and customized. + * + * Serves as a factory for Customize Controls and Settings, and + * instantiates default Customize Controls and Settings. + * + * @since 3.4.0 + */ + #[\AllowDynamicProperties] + final class WP_Customize_Manager + { + /** + * Methods and properties dealing with managing widgets in the Customizer. + * + * @since 3.9.0 + * @var WP_Customize_Widgets + */ + public $widgets; + /** + * Methods and properties dealing with managing nav menus in the Customizer. + * + * @since 4.3.0 + * @var WP_Customize_Nav_Menus + */ + public $nav_menus; + /** + * Methods and properties dealing with selective refresh in the Customizer preview. + * + * @since 4.5.0 + * @var WP_Customize_Selective_Refresh + */ + public $selective_refresh; + /** + * Constructor. + * + * @since 3.4.0 + * @since 4.7.0 Added `$args` parameter. + * + * @param array $args { + * Args. + * + * @type null|string|false $changeset_uuid Changeset UUID, the `post_name` for the customize_changeset post containing the customized state. + * Defaults to `null` resulting in a UUID to be immediately generated. If `false` is provided, then + * then the changeset UUID will be determined during `after_setup_theme`: when the + * `customize_changeset_branching` filter returns false, then the default UUID will be that + * of the most recent `customize_changeset` post that has a status other than 'auto-draft', + * 'publish', or 'trash'. Otherwise, if changeset branching is enabled, then a random UUID will be used. + * @type string $theme Theme to be previewed (for theme switch). Defaults to customize_theme or theme query params. + * @type string $messenger_channel Messenger channel. Defaults to customize_messenger_channel query param. + * @type bool $settings_previewed If settings should be previewed. Defaults to true. + * @type bool $branching If changeset branching is allowed; otherwise, changesets are linear. Defaults to true. + * @type bool $autosaved If data from a changeset's autosaved revision should be loaded if it exists. Defaults to false. + * } + * @phpstan-param array{ + * changeset_uuid?: null|string|false, + * theme?: string, + * messenger_channel?: string, + * settings_previewed?: bool, + * branching?: bool, + * autosaved?: bool, + * } $args + */ + public function __construct($args = array()) + { + } + /** + * Returns true if it's an Ajax request. + * + * @since 3.4.0 + * @since 4.2.0 Added `$action` param. + * + * @param string|null $action Whether the supplied Ajax action is being run. + * @return bool True if it's an Ajax request, false otherwise. + */ + public function doing_ajax($action = \null) + { + } + /** + * Returns the Ajax wp_die() handler if it's a customized request. + * + * @since 3.4.0 + * @deprecated 4.7.0 + * + * @return callable Die handler. + */ + public function wp_die_handler() + { + } + /** + * Starts preview and customize theme. + * + * Check if customize query variable exist. Init filters to filter the active theme. + * + * @since 3.4.0 + * + * @global string $pagenow The filename of the current screen. + * @phpstan-return void + */ + public function setup_theme() + { + } + /** + * Establishes the loaded changeset. + * + * This method runs right at after_setup_theme and applies the 'customize_changeset_branching' filter to determine + * whether concurrent changesets are allowed. Then if the Customizer is not initialized with a `changeset_uuid` param, + * this method will determine which UUID should be used. If changeset branching is disabled, then the most saved + * changeset will be loaded by default. Otherwise, if there are no existing saved changesets or if changeset branching is + * enabled, then a new UUID will be generated. + * + * @since 4.9.0 + * + * @global string $pagenow The filename of the current screen. + */ + public function establish_loaded_changeset() + { + } + /** + * Callback to validate a theme once it is loaded + * + * @since 3.4.0 + */ + public function after_setup_theme() + { + } + /** + * If the theme to be previewed isn't the active theme, add filter callbacks + * to swap it out at runtime. + * + * @since 3.4.0 + * @phpstan-return void + */ + public function start_previewing_theme() + { + } + /** + * Stops previewing the selected theme. + * + * Removes filters to change the active theme. + * + * @since 3.4.0 + * @phpstan-return void + */ + public function stop_previewing_theme() + { + } + /** + * Gets whether settings are or will be previewed. + * + * @since 4.9.0 + * + * @see WP_Customize_Setting::preview() + * + * @return bool + */ + public function settings_previewed() + { + } + /** + * Gets whether data from a changeset's autosaved revision should be loaded if it exists. + * + * @since 4.9.0 + * + * @see WP_Customize_Manager::changeset_data() + * + * @return bool Is using autosaved changeset revision. + */ + public function autosaved() + { + } + /** + * Whether the changeset branching is allowed. + * + * @since 4.9.0 + * + * @see WP_Customize_Manager::establish_loaded_changeset() + * + * @return bool Is changeset branching. + */ + public function branching() + { + } + /** + * Gets the changeset UUID. + * + * @since 4.7.0 + * + * @see WP_Customize_Manager::establish_loaded_changeset() + * + * @return string UUID. + */ + public function changeset_uuid() + { + } + /** + * Gets the theme being customized. + * + * @since 3.4.0 + * + * @return WP_Theme + */ + public function theme() + { + } + /** + * Gets the registered settings. + * + * @since 3.4.0 + * + * @return array + */ + public function settings() + { + } + /** + * Gets the registered controls. + * + * @since 3.4.0 + * + * @return array + */ + public function controls() + { + } + /** + * Gets the registered containers. + * + * @since 4.0.0 + * + * @return array + */ + public function containers() + { + } + /** + * Gets the registered sections. + * + * @since 3.4.0 + * + * @return array + */ + public function sections() + { + } + /** + * Gets the registered panels. + * + * @since 4.0.0 + * + * @return array Panels. + */ + public function panels() + { + } + /** + * Checks if the current theme is active. + * + * @since 3.4.0 + * + * @return bool + */ + public function is_theme_active() + { + } + /** + * Registers styles/scripts and initialize the preview of each setting + * + * @since 3.4.0 + */ + public function wp_loaded() + { + } + /** + * Prevents Ajax requests from following redirects when previewing a theme + * by issuing a 200 response instead of a 30x. + * + * Instead, the JS will sniff out the location header. + * + * @since 3.4.0 + * @deprecated 4.7.0 + * + * @param int $status Status. + * @return int + */ + public function wp_redirect_status($status) + { + } + /** + * Finds the changeset post ID for a given changeset UUID. + * + * @since 4.7.0 + * + * @param string $uuid Changeset UUID. + * @return int|null Returns post ID on success and null on failure. + */ + public function find_changeset_post_id($uuid) + { + } + /** + * Gets the changeset post ID for the loaded changeset. + * + * @since 4.7.0 + * + * @return int|null Post ID on success or null if there is no post yet saved. + */ + public function changeset_post_id() + { + } + /** + * Gets changeset data. + * + * @since 4.7.0 + * @since 4.9.0 This will return the changeset's data with a user's autosave revision merged on top, if one exists and $autosaved is true. + * + * @return array Changeset data. + */ + public function changeset_data() + { + } + /** + * Imports theme starter content into the customized state. + * + * @since 4.7.0 + * + * @param array $starter_content Starter content. Defaults to `get_theme_starter_content()`. + * @phpstan-return void + */ + public function import_theme_starter_content($starter_content = array()) + { + } + /** + * Saves starter content changeset. + * + * @since 4.7.0 + * @phpstan-return void + */ + public function _save_starter_content_changeset() + { + } + /** + * Gets dirty pre-sanitized setting values in the current customized state. + * + * The returned array consists of a merge of three sources: + * 1. If the theme is not currently active, then the base array is any stashed + * theme mods that were modified previously but never published. + * 2. The values from the current changeset, if it exists. + * 3. If the user can customize, the values parsed from the incoming + * `$_POST['customized']` JSON data. + * 4. Any programmatically-set post values via `WP_Customize_Manager::set_post_value()`. + * + * The name "unsanitized_post_values" is a carry-over from when the customized + * state was exclusively sourced from `$_POST['customized']`. Nevertheless, + * the value returned will come from the current changeset post and from the + * incoming post data. + * + * @since 4.1.1 + * @since 4.7.0 Added `$args` parameter and merging with changeset values and stashed theme mods. + * + * @param array $args { + * Args. + * + * @type bool $exclude_changeset Whether the changeset values should also be excluded. Defaults to false. + * @type bool $exclude_post_data Whether the post input values should also be excluded. Defaults to false when lacking the customize capability. + * } + * @return array + * @phpstan-param array{ + * exclude_changeset?: bool, + * exclude_post_data?: bool, + * } $args + */ + public function unsanitized_post_values($args = array()) + { + } + /** + * Returns the sanitized value for a given setting from the current customized state. + * + * The name "post_value" is a carry-over from when the customized state was exclusively + * sourced from `$_POST['customized']`. Nevertheless, the value returned will come + * from the current changeset post and from the incoming post data. + * + * @since 3.4.0 + * @since 4.1.1 Introduced the `$default_value` parameter. + * @since 4.6.0 `$default_value` is now returned early when the setting post value is invalid. + * + * @see WP_REST_Server::dispatch() + * @see WP_REST_Request::sanitize_params() + * @see WP_REST_Request::has_valid_params() + * + * @param WP_Customize_Setting $setting A WP_Customize_Setting derived object. + * @param mixed $default_value Value returned if `$setting` has no post value (added in 4.2.0) + * or the post value is invalid (added in 4.6.0). + * @return string|mixed Sanitized value or the `$default_value` provided. + */ + public function post_value($setting, $default_value = \null) + { + } + /** + * Overrides a setting's value in the current customized state. + * + * The name "post_value" is a carry-over from when the customized state was + * exclusively sourced from `$_POST['customized']`. + * + * @since 4.2.0 + * + * @param string $setting_id ID for the WP_Customize_Setting instance. + * @param mixed $value Post value. + */ + public function set_post_value($setting_id, $value) + { + } + /** + * Prints JavaScript settings. + * + * @since 3.4.0 + * @phpstan-return void + */ + public function customize_preview_init() + { + } + /** + * Filters the X-Frame-Options and Content-Security-Policy headers to ensure frontend can load in customizer. + * + * @since 4.7.0 + * + * @param array $headers Headers. + * @return array Headers. + */ + public function filter_iframe_security_headers($headers) + { + } + /** + * Adds customize state query params to a given URL if preview is allowed. + * + * @since 4.7.0 + * + * @see wp_redirect() + * @see WP_Customize_Manager::get_allowed_url() + * + * @param string $url URL. + * @return string URL. + */ + public function add_state_query_params($url) + { + } + /** + * Prevents sending a 404 status when returning the response for the customize + * preview, since it causes the jQuery Ajax to fail. Send 200 instead. + * + * @since 4.0.0 + * @deprecated 4.7.0 + */ + public function customize_preview_override_404_status() + { + } + /** + * Prints base element for preview frame. + * + * @since 3.4.0 + * @deprecated 4.7.0 + */ + public function customize_preview_base() + { + } + /** + * Prints a workaround to handle HTML5 tags in IE < 9. + * + * @since 3.4.0 + * @deprecated 4.7.0 Customizer no longer supports IE8, so all supported browsers recognize HTML5. + */ + public function customize_preview_html5() + { + } + /** + * Prints CSS for loading indicators for the Customizer preview. + * + * @since 4.2.0 + */ + public function customize_preview_loading_style() + { + } + /** + * Removes customize_messenger_channel query parameter from the preview window when it is not in an iframe. + * + * This ensures that the admin bar will be shown. It also ensures that link navigation will + * work as expected since the parent frame is not being sent the URL to navigate to. + * + * @since 4.7.0 + * @phpstan-return void + */ + public function remove_frameless_preview_messenger_channel() + { + } + /** + * Prints JavaScript settings for preview frame. + * + * @since 3.4.0 + */ + public function customize_preview_settings() + { + } + /** + * Prints a signature so we can ensure the Customizer was properly executed. + * + * @since 3.4.0 + * @deprecated 4.7.0 + */ + public function customize_preview_signature() + { + } + /** + * Removes the signature in case we experience a case where the Customizer was not properly executed. + * + * @since 3.4.0 + * @deprecated 4.7.0 + * + * @param callable|null $callback Optional. Value passed through for {@see 'wp_die_handler'} filter. + * Default null. + * @return callable|null Value passed through for {@see 'wp_die_handler'} filter. + */ + public function remove_preview_signature($callback = \null) + { + } + /** + * Determines whether it is a theme preview or not. + * + * @since 3.4.0 + * + * @return bool True if it's a preview, false if not. + */ + public function is_preview() + { + } + /** + * Retrieves the template name of the previewed theme. + * + * @since 3.4.0 + * + * @return string Template name. + */ + public function get_template() + { + } + /** + * Retrieves the stylesheet name of the previewed theme. + * + * @since 3.4.0 + * + * @return string Stylesheet name. + */ + public function get_stylesheet() + { + } + /** + * Retrieves the template root of the previewed theme. + * + * @since 3.4.0 + * + * @return string Theme root. + */ + public function get_template_root() + { + } + /** + * Retrieves the stylesheet root of the previewed theme. + * + * @since 3.4.0 + * + * @return string Theme root. + */ + public function get_stylesheet_root() + { + } + /** + * Filters the active theme and return the name of the previewed theme. + * + * @since 3.4.0 + * + * @param mixed $current_theme {@internal Parameter is not used} + * @return string Theme name. + */ + public function current_theme($current_theme) + { + } + /** + * Validates setting values. + * + * Validation is skipped for unregistered settings or for values that are + * already null since they will be skipped anyway. Sanitization is applied + * to values that pass validation, and values that become null or `WP_Error` + * after sanitizing are marked invalid. + * + * @since 4.6.0 + * + * @see WP_REST_Request::has_valid_params() + * @see WP_Customize_Setting::validate() + * + * @param array $setting_values Mapping of setting IDs to values to validate and sanitize. + * @param array $options { + * Options. + * + * @type bool $validate_existence Whether a setting's existence will be checked. + * @type bool $validate_capability Whether the setting capability will be checked. + * } + * @return array Mapping of setting IDs to return value of validate method calls, either `true` or `WP_Error`. + * @phpstan-param array{ + * validate_existence?: bool, + * validate_capability?: bool, + * } $options + */ + public function validate_setting_values($setting_values, $options = array()) + { + } + /** + * Prepares setting validity for exporting to the client (JS). + * + * Converts `WP_Error` instance into array suitable for passing into the + * `wp.customize.Notification` JS model. + * + * @since 4.6.0 + * + * @param true|WP_Error $validity Setting validity. + * @return true|array If `$validity` was a WP_Error, the error codes will be array-mapped + * to their respective `message` and `data` to pass into the + * `wp.customize.Notification` JS model. + */ + public function prepare_setting_validity_for_js($validity) + { + } + /** + * Handles customize_save WP Ajax request to save/update a changeset. + * + * @since 3.4.0 + * @since 4.7.0 The semantics of this method have changed to update a changeset, optionally to also change the status and other attributes. + */ + public function save() + { + } + /** + * Saves the post for the loaded changeset. + * + * @since 4.7.0 + * + * @param array $args { + * Args for changeset post. + * + * @type array $data Optional additional changeset data. Values will be merged on top of any existing post values. + * @type string $status Post status. Optional. If supplied, the save will be transactional and a post revision will be allowed. + * @type string $title Post title. Optional. + * @type string $date_gmt Date in GMT. Optional. + * @type int $user_id ID for user who is saving the changeset. Optional, defaults to the current user ID. + * @type bool $starter_content Whether the data is starter content. If false (default), then $starter_content will be cleared for any $data being saved. + * @type bool $autosave Whether this is a request to create an autosave revision. + * } + * + * @return array|WP_Error Returns array on success and WP_Error with array data on error. + * @phpstan-param array{ + * data?: array, + * status?: string, + * title?: string, + * date_gmt?: string, + * user_id?: int, + * starter_content?: bool, + * autosave?: bool, + * } $args + */ + public function save_changeset_post($args = array()) + { + } + /** + * Preserves the initial JSON post_content passed to save into the post. + * + * This is needed to prevent KSES and other {@see 'content_save_pre'} filters + * from corrupting JSON data. + * + * Note that WP_Customize_Manager::validate_setting_values() have already + * run on the setting values being serialized as JSON into the post content + * so it is pre-sanitized. + * + * Also, the sanitization logic is re-run through the respective + * WP_Customize_Setting::sanitize() method when being read out of the + * changeset, via WP_Customize_Manager::post_value(), and this sanitized + * value will also be sent into WP_Customize_Setting::update() for + * persisting to the DB. + * + * Multiple users can collaborate on a single changeset, where one user may + * have the unfiltered_html capability but another may not. A user with + * unfiltered_html may add a script tag to some field which needs to be kept + * intact even when another user updates the changeset to modify another field + * when they do not have unfiltered_html. + * + * @since 5.4.1 + * + * @param array $data An array of slashed and processed post data. + * @param array $postarr An array of sanitized (and slashed) but otherwise unmodified post data. + * @param array $unsanitized_postarr An array of slashed yet *unsanitized* and unprocessed post data as originally passed to wp_insert_post(). + * @return array Filtered post data. + */ + public function preserve_insert_changeset_post_content($data, $postarr, $unsanitized_postarr) + { + } + /** + * Trashes or deletes a changeset post. + * + * The following re-formulates the logic from `wp_trash_post()` as done in + * `wp_publish_post()`. The reason for bypassing `wp_trash_post()` is that it + * will mutate the the `post_content` and the `post_name` when they should be + * untouched. + * + * @since 4.9.0 + * + * @see wp_trash_post() + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int|WP_Post $post The changeset post. + * @return mixed A WP_Post object for the trashed post or an empty value on failure. + */ + public function trash_changeset_post($post) + { + } + /** + * Handles request to trash a changeset. + * + * @since 4.9.0 + * @phpstan-return void + */ + public function handle_changeset_trash_request() + { + } + /** + * Re-maps 'edit_post' meta cap for a customize_changeset post to be the same as 'customize' maps. + * + * There is essentially a "meta meta" cap in play here, where 'edit_post' meta cap maps to + * the 'customize' meta cap which then maps to 'edit_theme_options'. This is currently + * required in core for `wp_create_post_autosave()` because it will call + * `_wp_translate_postdata()` which in turn will check if a user can 'edit_post', but the + * the caps for the customize_changeset post type are all mapping to the meta capability. + * This should be able to be removed once #40922 is addressed in core. + * + * @since 4.9.0 + * + * @link https://core.trac.wordpress.org/ticket/40922 + * @see WP_Customize_Manager::save_changeset_post() + * @see _wp_translate_postdata() + * + * @param string[] $caps Array of the user's capabilities. + * @param string $cap Capability name. + * @param int $user_id The user ID. + * @param array $args Adds the context to the cap. Typically the object ID. + * @return array Capabilities. + */ + public function grant_edit_post_capability_for_changeset($caps, $cap, $user_id, $args) + { + } + /** + * Marks the changeset post as being currently edited by the current user. + * + * @since 4.9.0 + * + * @param int $changeset_post_id Changeset post ID. + * @param bool $take_over Whether to take over the changeset. Default false. + */ + public function set_changeset_lock($changeset_post_id, $take_over = \false) + { + } + /** + * Refreshes changeset lock with the current time if current user edited the changeset before. + * + * @since 4.9.0 + * + * @param int $changeset_post_id Changeset post ID. + * @phpstan-return void + */ + public function refresh_changeset_lock($changeset_post_id) + { + } + /** + * Filters heartbeat settings for the Customizer. + * + * @since 4.9.0 + * + * @global string $pagenow The filename of the current screen. + * + * @param array $settings Current settings to filter. + * @return array Heartbeat settings. + */ + public function add_customize_screen_to_heartbeat_settings($settings) + { + } + /** + * Checks locked changeset with heartbeat API. + * + * @since 4.9.0 + * + * @param array $response The Heartbeat response. + * @param array $data The $_POST data sent. + * @param string $screen_id The screen id. + * @return array The Heartbeat response. + */ + public function check_changeset_lock_with_heartbeat($response, $data, $screen_id) + { + } + /** + * Removes changeset lock when take over request is sent via Ajax. + * + * @since 4.9.0 + * @phpstan-return never + */ + public function handle_override_changeset_lock_request() + { + } + /** + * Filters whether a changeset has changed to create a new revision. + * + * Note that this will not be called while a changeset post remains in auto-draft status. + * + * @since 4.7.0 + * + * @param bool $post_has_changed Whether the post has changed. + * @param WP_Post $latest_revision The latest revision post object. + * @param WP_Post $post The post object. + * @return bool Whether a revision should be made. + */ + public function _filter_revision_post_has_changed($post_has_changed, $latest_revision, $post) + { + } + /** + * Publishes the values of a changeset. + * + * This will publish the values contained in a changeset, even changesets that do not + * correspond to current manager instance. This is called by + * `_wp_customize_publish_changeset()` when a customize_changeset post is + * transitioned to the `publish` status. As such, this method should not be + * called directly and instead `wp_publish_post()` should be used. + * + * Please note that if the settings in the changeset are for a non-activated + * theme, the theme must first be switched to (via `switch_theme()`) before + * invoking this method. + * + * @since 4.7.0 + * + * @see _wp_customize_publish_changeset() + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $changeset_post_id ID for customize_changeset post. Defaults to the changeset for the current manager instance. + * @return true|WP_Error True or error info. + */ + public function _publish_changeset_values($changeset_post_id) + { + } + /** + * Refreshes nonces for the current preview. + * + * @since 4.2.0 + * @phpstan-return never + */ + public function refresh_nonces() + { + } + /** + * Deletes a given auto-draft changeset or the autosave revision for a given changeset or delete changeset lock. + * + * @since 4.9.0 + * @phpstan-return never + */ + public function handle_dismiss_autosave_or_lock_request() + { + } + /** + * Adds a customize setting. + * + * @since 3.4.0 + * @since 4.5.0 Return added WP_Customize_Setting instance. + * + * @see WP_Customize_Setting::__construct() + * @link https://developer.wordpress.org/themes/customize-api + * + * @param WP_Customize_Setting|string $id Customize Setting object, or ID. + * @param array $args Optional. Array of properties for the new Setting object. + * See WP_Customize_Setting::__construct() for information + * on accepted arguments. Default empty array. + * @return WP_Customize_Setting The instance of the setting that was added. + * @phpstan-param array{ + * type?: string, + * capability?: string, + * theme_supports?: string|string[], + * default?: string, + * transport?: string, + * validate_callback?: callable, + * sanitize_callback?: callable, + * sanitize_js_callback?: callable, + * dirty?: bool, + * } $args See WP_Customize_Setting::__construct() + */ + public function add_setting($id, $args = array()) + { + } + /** + * Registers any dynamically-created settings, such as those from $_POST['customized'] + * that have no corresponding setting created. + * + * This is a mechanism to "wake up" settings that have been dynamically created + * on the front end and have been sent to WordPress in `$_POST['customized']`. When WP + * loads, the dynamically-created settings then will get created and previewed + * even though they are not directly created statically with code. + * + * @since 4.2.0 + * + * @param array $setting_ids The setting IDs to add. + * @return array The WP_Customize_Setting objects added. + */ + public function add_dynamic_settings($setting_ids) + { + } + /** + * Retrieves a customize setting. + * + * @since 3.4.0 + * + * @param string $id Customize Setting ID. + * @return WP_Customize_Setting|void The setting, if set. + */ + public function get_setting($id) + { + } + /** + * Removes a customize setting. + * + * Note that removing the setting doesn't destroy the WP_Customize_Setting instance or remove its filters. + * + * @since 3.4.0 + * + * @param string $id Customize Setting ID. + */ + public function remove_setting($id) + { + } + /** + * Adds a customize panel. + * + * @since 4.0.0 + * @since 4.5.0 Return added WP_Customize_Panel instance. + * + * @see WP_Customize_Panel::__construct() + * + * @param WP_Customize_Panel|string $id Customize Panel object, or ID. + * @param array $args Optional. Array of properties for the new Panel object. + * See WP_Customize_Panel::__construct() for information + * on accepted arguments. Default empty array. + * @return WP_Customize_Panel The instance of the panel that was added. + * @phpstan-param array{ + * priority?: int, + * capability?: string, + * theme_supports?: mixed[], + * title?: string, + * description?: string, + * type?: string, + * active_callback?: callable, + * } $args See WP_Customize_Panel::__construct() + */ + public function add_panel($id, $args = array()) + { + } + /** + * Retrieves a customize panel. + * + * @since 4.0.0 + * + * @param string $id Panel ID to get. + * @return WP_Customize_Panel|void Requested panel instance, if set. + */ + public function get_panel($id) + { + } + /** + * Removes a customize panel. + * + * Note that removing the panel doesn't destroy the WP_Customize_Panel instance or remove its filters. + * + * @since 4.0.0 + * + * @param string $id Panel ID to remove. + */ + public function remove_panel($id) + { + } + /** + * Registers a customize panel type. + * + * Registered types are eligible to be rendered via JS and created dynamically. + * + * @since 4.3.0 + * + * @see WP_Customize_Panel + * + * @param string $panel Name of a custom panel which is a subclass of WP_Customize_Panel. + */ + public function register_panel_type($panel) + { + } + /** + * Renders JS templates for all registered panel types. + * + * @since 4.3.0 + */ + public function render_panel_templates() + { + } + /** + * Adds a customize section. + * + * @since 3.4.0 + * @since 4.5.0 Return added WP_Customize_Section instance. + * + * @see WP_Customize_Section::__construct() + * + * @param WP_Customize_Section|string $id Customize Section object, or ID. + * @param array $args Optional. Array of properties for the new Section object. + * See WP_Customize_Section::__construct() for information + * on accepted arguments. Default empty array. + * @return WP_Customize_Section The instance of the section that was added. + * @phpstan-param array{ + * priority?: int, + * panel?: string, + * capability?: string, + * theme_supports?: string|string[], + * title?: string, + * description?: string, + * type?: string, + * active_callback?: callable, + * description_hidden?: bool, + * } $args See WP_Customize_Section::__construct() + */ + public function add_section($id, $args = array()) + { + } + /** + * Retrieves a customize section. + * + * @since 3.4.0 + * + * @param string $id Section ID. + * @return WP_Customize_Section|void The section, if set. + */ + public function get_section($id) + { + } + /** + * Removes a customize section. + * + * Note that removing the section doesn't destroy the WP_Customize_Section instance or remove its filters. + * + * @since 3.4.0 + * + * @param string $id Section ID. + */ + public function remove_section($id) + { + } + /** + * Registers a customize section type. + * + * Registered types are eligible to be rendered via JS and created dynamically. + * + * @since 4.3.0 + * + * @see WP_Customize_Section + * + * @param string $section Name of a custom section which is a subclass of WP_Customize_Section. + */ + public function register_section_type($section) + { + } + /** + * Renders JS templates for all registered section types. + * + * @since 4.3.0 + */ + public function render_section_templates() + { + } + /** + * Adds a customize control. + * + * @since 3.4.0 + * @since 4.5.0 Return added WP_Customize_Control instance. + * + * @see WP_Customize_Control::__construct() + * + * @param WP_Customize_Control|string $id Customize Control object, or ID. + * @param array $args Optional. Array of properties for the new Control object. + * See WP_Customize_Control::__construct() for information + * on accepted arguments. Default empty array. + * @return WP_Customize_Control The instance of the control that was added. + * @phpstan-param array{ + * instance_number?: int, + * manager?: WP_Customize_Manager, + * id?: string, + * settings?: array, + * setting?: string, + * capability?: string, + * priority?: int, + * section?: string, + * label?: string, + * description?: string, + * choices?: array, + * input_attrs?: array, + * allow_addition?: bool, + * json?: array, + * type?: string, + * active_callback?: callable, + * } $args See WP_Customize_Control::__construct() + */ + public function add_control($id, $args = array()) + { + } + /** + * Retrieves a customize control. + * + * @since 3.4.0 + * + * @param string $id ID of the control. + * @return WP_Customize_Control|void The control object, if set. + */ + public function get_control($id) + { + } + /** + * Removes a customize control. + * + * Note that removing the control doesn't destroy the WP_Customize_Control instance or remove its filters. + * + * @since 3.4.0 + * + * @param string $id ID of the control. + */ + public function remove_control($id) + { + } + /** + * Registers a customize control type. + * + * Registered types are eligible to be rendered via JS and created dynamically. + * + * @since 4.1.0 + * + * @param string $control Name of a custom control which is a subclass of + * WP_Customize_Control. + */ + public function register_control_type($control) + { + } + /** + * Renders JS templates for all registered control types. + * + * @since 4.1.0 + */ + public function render_control_templates() + { + } + /** + * Prepares panels, sections, and controls. + * + * For each, check if required related components exist, + * whether the user has the necessary capabilities, + * and sort by priority. + * + * @since 3.4.0 + */ + public function prepare_controls() + { + } + /** + * Enqueues scripts for customize controls. + * + * @since 3.4.0 + */ + public function enqueue_control_scripts() + { + } + /** + * Determines whether the user agent is iOS. + * + * @since 4.4.0 + * + * @return bool Whether the user agent is iOS. + */ + public function is_ios() + { + } + /** + * Gets the template string for the Customizer pane document title. + * + * @since 4.4.0 + * + * @return string The template string for the document title. + */ + public function get_document_title_template() + { + } + /** + * Sets the initial URL to be previewed. + * + * URL is validated. + * + * @since 4.4.0 + * + * @param string $preview_url URL to be previewed. + */ + public function set_preview_url($preview_url) + { + } + /** + * Gets the initial URL to be previewed. + * + * @since 4.4.0 + * + * @return string URL being previewed. + */ + public function get_preview_url() + { + } + /** + * Determines whether the admin and the frontend are on different domains. + * + * @since 4.7.0 + * + * @return bool Whether cross-domain. + */ + public function is_cross_domain() + { + } + /** + * Gets URLs allowed to be previewed. + * + * If the front end and the admin are served from the same domain, load the + * preview over ssl if the Customizer is being loaded over ssl. This avoids + * insecure content warnings. This is not attempted if the admin and front end + * are on different domains to avoid the case where the front end doesn't have + * ssl certs. Domain mapping plugins can allow other urls in these conditions + * using the customize_allowed_urls filter. + * + * @since 4.7.0 + * + * @return array Allowed URLs. + */ + public function get_allowed_urls() + { + } + /** + * Gets messenger channel. + * + * @since 4.7.0 + * + * @return string Messenger channel. + */ + public function get_messenger_channel() + { + } + /** + * Sets URL to link the user to when closing the Customizer. + * + * URL is validated. + * + * @since 4.4.0 + * + * @param string $return_url URL for return link. + */ + public function set_return_url($return_url) + { + } + /** + * Gets URL to link the user to when closing the Customizer. + * + * @since 4.4.0 + * + * @global array $_registered_pages + * + * @return string URL for link to close Customizer. + */ + public function get_return_url() + { + } + /** + * Sets the autofocused constructs. + * + * @since 4.4.0 + * + * @param array $autofocus { + * Mapping of 'panel', 'section', 'control' to the ID which should be autofocused. + * + * @type string $control ID for control to be autofocused. + * @type string $section ID for section to be autofocused. + * @type string $panel ID for panel to be autofocused. + * } + * @phpstan-param array{ + * control?: string, + * section?: string, + * panel?: string, + * } $autofocus + */ + public function set_autofocus($autofocus) + { + } + /** + * Gets the autofocused constructs. + * + * @since 4.4.0 + * + * @return string[] { + * Mapping of 'panel', 'section', 'control' to the ID which should be autofocused. + * + * @type string $control ID for control to be autofocused. + * @type string $section ID for section to be autofocused. + * @type string $panel ID for panel to be autofocused. + * } + * @phpstan-return array{ + * control: string, + * section: string, + * panel: string, + * } + */ + public function get_autofocus() + { + } + /** + * Gets nonces for the Customizer. + * + * @since 4.5.0 + * + * @return array Nonces. + */ + public function get_nonces() + { + } + /** + * Prints JavaScript settings for parent window. + * + * @since 4.4.0 + */ + public function customize_pane_settings() + { + } + /** + * Returns a list of devices to allow previewing. + * + * @since 4.5.0 + * + * @return array List of devices with labels and default setting. + */ + public function get_previewable_devices() + { + } + /** + * Registers some default controls. + * + * @since 3.4.0 + */ + public function register_controls() + { + } + /** + * Returns whether there are published pages. + * + * Used as active callback for static front page section and controls. + * + * @since 4.7.0 + * + * @return bool Whether there are published (or to be published) pages. + */ + public function has_published_pages() + { + } + /** + * Adds settings from the POST data that were not added with code, e.g. dynamically-created settings for Widgets + * + * @since 4.2.0 + * + * @see add_dynamic_settings() + */ + public function register_dynamic_settings() + { + } + /** + * Loads themes into the theme browsing/installation UI. + * + * @since 4.9.0 + * @phpstan-return never + */ + public function handle_load_themes_request() + { + } + /** + * Callback for validating the header_textcolor value. + * + * Accepts 'blank', and otherwise uses sanitize_hex_color_no_hash(). + * Returns default text color if hex color is empty. + * + * @since 3.4.0 + * + * @param string $color + * @return mixed + */ + public function _sanitize_header_textcolor($color) + { + } + /** + * Callback for validating a background setting value. + * + * @since 4.7.0 + * + * @param string $value Repeat value. + * @param WP_Customize_Setting $setting Setting. + * @return string|WP_Error Background value or validation error. + */ + public function _sanitize_background_setting($value, $setting) + { + } + /** + * Exports header video settings to facilitate selective refresh. + * + * @since 4.7.0 + * + * @param array $response Response. + * @param WP_Customize_Selective_Refresh $selective_refresh Selective refresh component. + * @param array $partials Array of partials. + * @return array + */ + public function export_header_video_settings($response, $selective_refresh, $partials) + { + } + /** + * Callback for validating the header_video value. + * + * Ensures that the selected video is less than 8MB and provides an error message. + * + * @since 4.7.0 + * + * @param WP_Error $validity + * @param mixed $value + * @return mixed + */ + public function _validate_header_video($validity, $value) + { + } + /** + * Callback for validating the external_header_video value. + * + * Ensures that the provided URL is supported. + * + * @since 4.7.0 + * + * @param WP_Error $validity + * @param mixed $value + * @return mixed + */ + public function _validate_external_header_video($validity, $value) + { + } + /** + * Callback for sanitizing the external_header_video value. + * + * @since 4.7.1 + * + * @param string $value URL. + * @return string Sanitized URL. + */ + public function _sanitize_external_header_video($value) + { + } + /** + * Callback for rendering the custom logo, used in the custom_logo partial. + * + * This method exists because the partial object and context data are passed + * into a partial's render_callback so we cannot use get_custom_logo() as + * the render_callback directly since it expects a blog ID as the first + * argument. When WP no longer supports PHP 5.3, this method can be removed + * in favor of an anonymous function. + * + * @see WP_Customize_Manager::register_controls() + * + * @since 4.5.0 + * + * @return string Custom logo. + */ + public function _render_custom_logo_partial() + { + } + } + /** + * WordPress Customize Nav Menus classes + * + * @package WordPress + * @subpackage Customize + * @since 4.3.0 + */ + /** + * Customize Nav Menus class. + * + * Implements menu management in the Customizer. + * + * @since 4.3.0 + * + * @see WP_Customize_Manager + */ + #[\AllowDynamicProperties] + final class WP_Customize_Nav_Menus + { + /** + * WP_Customize_Manager instance. + * + * @since 4.3.0 + * @var WP_Customize_Manager + */ + public $manager; + /** + * Constructor. + * + * @since 4.3.0 + * + * @param WP_Customize_Manager $manager Customizer bootstrap instance. + * @phpstan-return void + */ + public function __construct($manager) + { + } + /** + * Adds a nonce for customizing menus. + * + * @since 4.5.0 + * + * @param string[] $nonces Array of nonces. + * @return string[] Modified array of nonces. + */ + public function filter_nonces($nonces) + { + } + /** + * Ajax handler for loading available menu items. + * + * @since 4.3.0 + * @phpstan-return never + */ + public function ajax_load_available_items() + { + } + /** + * Performs the post_type and taxonomy queries for loading available menu items. + * + * @since 4.3.0 + * + * @param string $object_type Optional. Accepts any custom object type and has built-in support for + * 'post_type' and 'taxonomy'. Default is 'post_type'. + * @param string $object_name Optional. Accepts any registered taxonomy or post type name. Default is 'page'. + * @param int $page Optional. The page number used to generate the query offset. Default is '0'. + * @return array|WP_Error An array of menu items on success, a WP_Error object on failure. + */ + public function load_available_items_query($object_type = 'post_type', $object_name = 'page', $page = 0) + { + } + /** + * Ajax handler for searching available menu items. + * + * @since 4.3.0 + */ + public function ajax_search_available_items() + { + } + /** + * Performs post queries for available-item searching. + * + * Based on WP_Editor::wp_link_query(). + * + * @since 4.3.0 + * + * @param array $args Optional. Accepts 'pagenum' and 's' (search) arguments. + * @return array Menu items. + */ + public function search_available_items_query($args = array()) + { + } + /** + * Enqueues scripts and styles for Customizer pane. + * + * @since 4.3.0 + */ + public function enqueue_scripts() + { + } + /** + * Filters a dynamic setting's constructor args. + * + * For a dynamic setting to be registered, this filter must be employed + * to override the default false value with an array of args to pass to + * the WP_Customize_Setting constructor. + * + * @since 4.3.0 + * + * @param false|array $setting_args The arguments to the WP_Customize_Setting constructor. + * @param string $setting_id ID for dynamic setting, usually coming from `$_POST['customized']`. + * @return array|false + */ + public function filter_dynamic_setting_args($setting_args, $setting_id) + { + } + /** + * Allows non-statically created settings to be constructed with custom WP_Customize_Setting subclass. + * + * @since 4.3.0 + * + * @param string $setting_class WP_Customize_Setting or a subclass. + * @param string $setting_id ID for dynamic setting, usually coming from `$_POST['customized']`. + * @param array $setting_args WP_Customize_Setting or a subclass. + * @return string + */ + public function filter_dynamic_setting_class($setting_class, $setting_id, $setting_args) + { + } + /** + * Adds the customizer settings and controls. + * + * @since 4.3.0 + */ + public function customize_register() + { + } + /** + * Gets the base10 intval. + * + * This is used as a setting's sanitize_callback; we can't use just plain + * intval because the second argument is not what intval() expects. + * + * @since 4.3.0 + * + * @param mixed $value Number to convert. + * @return int Integer. + */ + public function intval_base10($value) + { + } + /** + * Returns an array of all the available item types. + * + * @since 4.3.0 + * @since 4.7.0 Each array item now includes a `$type_label` in addition to `$title`, `$type`, and `$object`. + * + * @return array The available menu item types. + */ + public function available_item_types() + { + } + /** + * Adds a new `auto-draft` post. + * + * @since 4.7.0 + * + * @param array $postarr { + * Post array. Note that post_status is overridden to be `auto-draft`. + * + * @type string $post_title Post title. Required. + * @type string $post_type Post type. Required. + * @type string $post_name Post name. + * @type string $post_content Post content. + * } + * @return WP_Post|WP_Error Inserted auto-draft post object or error. + * @phpstan-param array{ + * post_title?: string, + * post_type?: string, + * post_name?: string, + * post_content?: string, + * } $postarr + */ + public function insert_auto_draft_post($postarr) + { + } + /** + * Ajax handler for adding a new auto-draft post. + * + * @since 4.7.0 + */ + public function ajax_insert_auto_draft_post() + { + } + /** + * Prints the JavaScript templates used to render Menu Customizer components. + * + * Templates are imported into the JS use wp.template. + * + * @since 4.3.0 + */ + public function print_templates() + { + } + /** + * Prints the HTML template used to render the add-menu-item frame. + * + * @since 4.3.0 + */ + public function available_items_template() + { + } + // + // Start functionality specific to partial-refresh of menu changes in Customizer preview. + // + /** + * Nav menu args used for each instance, keyed by the args HMAC. + * + * @since 4.3.0 + * @var array + */ + public $preview_nav_menu_instance_args = array(); + /** + * Filters arguments for dynamic nav_menu selective refresh partials. + * + * @since 4.5.0 + * + * @param array|false $partial_args Partial args. + * @param string $partial_id Partial ID. + * @return array Partial args. + */ + public function customize_dynamic_partial_args($partial_args, $partial_id) + { + } + /** + * Adds hooks for the Customizer preview. + * + * @since 4.3.0 + */ + public function customize_preview_init() + { + } + /** + * Makes the auto-draft status protected so that it can be queried. + * + * @since 4.7.0 + * + * @global stdClass[] $wp_post_statuses List of post statuses. + */ + public function make_auto_draft_status_previewable() + { + } + /** + * Sanitizes post IDs for posts created for nav menu items to be published. + * + * @since 4.7.0 + * + * @param array $value Post IDs. + * @return array Post IDs. + */ + public function sanitize_nav_menus_created_posts($value) + { + } + /** + * Publishes the auto-draft posts that were created for nav menu items. + * + * The post IDs will have been sanitized by already by + * `WP_Customize_Nav_Menu_Items::sanitize_nav_menus_created_posts()` to + * remove any post IDs for which the user cannot publish or for which the + * post is not an auto-draft. + * + * @since 4.7.0 + * + * @param WP_Customize_Setting $setting Customizer setting object. + */ + public function save_nav_menus_created_posts($setting) + { + } + /** + * Keeps track of the arguments that are being passed to wp_nav_menu(). + * + * @since 4.3.0 + * + * @see wp_nav_menu() + * @see WP_Customize_Widgets::filter_dynamic_sidebar_params() + * + * @param array $args An array containing wp_nav_menu() arguments. + * @return array Arguments. + */ + public function filter_wp_nav_menu_args($args) + { + } + /** + * Prepares wp_nav_menu() calls for partial refresh. + * + * Injects attributes into container element. + * + * @since 4.3.0 + * + * @see wp_nav_menu() + * + * @param string $nav_menu_content The HTML content for the navigation menu. + * @param object $args An object containing wp_nav_menu() arguments. + * @return string Nav menu HTML with selective refresh attributes added if partial can be refreshed. + */ + public function filter_wp_nav_menu($nav_menu_content, $args) + { + } + /** + * Hashes (hmac) the nav menu arguments to ensure they are not tampered with when + * submitted in the Ajax request. + * + * Note that the array is expected to be pre-sorted. + * + * @since 4.3.0 + * + * @param array $args The arguments to hash. + * @return string Hashed nav menu arguments. + */ + public function hash_nav_menu_args($args) + { + } + /** + * Enqueues scripts for the Customizer preview. + * + * @since 4.3.0 + */ + public function customize_preview_enqueue_deps() + { + } + /** + * Exports data from PHP to JS. + * + * @since 4.3.0 + */ + public function export_preview_data() + { + } + /** + * Exports any wp_nav_menu() calls during the rendering of any partials. + * + * @since 4.5.0 + * + * @param array $response Response. + * @return array Response. + */ + public function export_partial_rendered_nav_menu_instances($response) + { + } + /** + * Renders a specific menu via wp_nav_menu() using the supplied arguments. + * + * @since 4.3.0 + * + * @see wp_nav_menu() + * + * @param WP_Customize_Partial $partial Partial. + * @param array $nav_menu_args Nav menu args supplied as container context. + * @return string|false + */ + public function render_nav_menu_partial($partial, $nav_menu_args) + { + } + } + /** + * WordPress Customize Panel classes + * + * @package WordPress + * @subpackage Customize + * @since 4.0.0 + */ + /** + * Customize Panel class. + * + * A UI container for sections, managed by the WP_Customize_Manager. + * + * @since 4.0.0 + * + * @see WP_Customize_Manager + */ + #[\AllowDynamicProperties] + class WP_Customize_Panel + { + /** + * Incremented with each new class instantiation, then stored in $instance_number. + * + * Used when sorting two instances whose priorities are equal. + * + * @since 4.1.0 + * @var int + */ + protected static $instance_count = 0; + /** + * Order in which this instance was created in relation to other instances. + * + * @since 4.1.0 + * @var int + */ + public $instance_number; + /** + * WP_Customize_Manager instance. + * + * @since 4.0.0 + * @var WP_Customize_Manager + */ + public $manager; + /** + * Unique identifier. + * + * @since 4.0.0 + * @var string + */ + public $id; + /** + * Priority of the panel, defining the display order of panels and sections. + * + * @since 4.0.0 + * @var int + */ + public $priority = 160; + /** + * Capability required for the panel. + * + * @since 4.0.0 + * @var string + */ + public $capability = 'edit_theme_options'; + /** + * Theme features required to support the panel. + * + * @since 4.0.0 + * @var mixed[] + */ + public $theme_supports = ''; + /** + * Title of the panel to show in UI. + * + * @since 4.0.0 + * @var string + */ + public $title = ''; + /** + * Description to show in the UI. + * + * @since 4.0.0 + * @var string + */ + public $description = ''; + /** + * Auto-expand a section in a panel when the panel is expanded when the panel only has the one section. + * + * @since 4.7.4 + * @var bool + */ + public $auto_expand_sole_section = \false; + /** + * Customizer sections for this panel. + * + * @since 4.0.0 + * @var array + */ + public $sections; + /** + * Type of this panel. + * + * @since 4.1.0 + * @var string + */ + public $type = 'default'; + /** + * Active callback. + * + * @since 4.1.0 + * + * @see WP_Customize_Section::active() + * + * @var callable Callback is called with one argument, the instance of + * WP_Customize_Section, and returns bool to indicate whether + * the section is active (such as it relates to the URL currently + * being previewed). + */ + public $active_callback = ''; + /** + * Constructor. + * + * Any supplied $args override class property defaults. + * + * @since 4.0.0 + * + * @param WP_Customize_Manager $manager Customizer bootstrap instance. + * @param string $id A specific ID for the panel. + * @param array $args { + * Optional. Array of properties for the new Panel object. Default empty array. + * + * @type int $priority Priority of the panel, defining the display order + * of panels and sections. Default 160. + * @type string $capability Capability required for the panel. + * Default `edit_theme_options`. + * @type mixed[] $theme_supports Theme features required to support the panel. + * @type string $title Title of the panel to show in UI. + * @type string $description Description to show in the UI. + * @type string $type Type of the panel. + * @type callable $active_callback Active callback. + * } + * @phpstan-param array{ + * priority?: int, + * capability?: string, + * theme_supports?: mixed[], + * title?: string, + * description?: string, + * type?: string, + * active_callback?: callable, + * } $args + */ + public function __construct($manager, $id, $args = array()) + { + } + /** + * Check whether panel is active to current Customizer preview. + * + * @since 4.1.0 + * + * @return bool Whether the panel is active to the current preview. + */ + public final function active() + { + } + /** + * Default callback used when invoking WP_Customize_Panel::active(). + * + * Subclasses can override this with their specific logic, or they may + * provide an 'active_callback' argument to the constructor. + * + * @since 4.1.0 + * + * @return bool Always true. + */ + public function active_callback() + { + } + /** + * Gather the parameters passed to client JavaScript via JSON. + * + * @since 4.1.0 + * + * @return array The array to be exported to the client as JSON. + */ + public function json() + { + } + /** + * Checks required user capabilities and whether the theme has the + * feature support required by the panel. + * + * @since 4.0.0 + * @since 5.9.0 Method was marked non-final. + * + * @return bool False if theme doesn't support the panel or the user doesn't have the capability. + */ + public function check_capabilities() + { + } + /** + * Get the panel's content template for insertion into the Customizer pane. + * + * @since 4.1.0 + * + * @return string Content for the panel. + */ + public final function get_content() + { + } + /** + * Check capabilities and render the panel. + * + * @since 4.0.0 + * @phpstan-return void + */ + public final function maybe_render() + { + } + /** + * Render the panel container, and then its contents (via `this->render_content()`) in a subclass. + * + * Panel containers are now rendered in JS by default, see WP_Customize_Panel::print_template(). + * + * @since 4.0.0 + */ + protected function render() + { + } + /** + * Render the panel UI in a subclass. + * + * Panel contents are now rendered in JS by default, see WP_Customize_Panel::print_template(). + * + * @since 4.1.0 + */ + protected function render_content() + { + } + /** + * Render the panel's JS templates. + * + * This function is only run for panel types that have been registered with + * WP_Customize_Manager::register_panel_type(). + * + * @since 4.3.0 + * + * @see WP_Customize_Manager::register_panel_type() + */ + public function print_template() + { + } + /** + * An Underscore (JS) template for rendering this panel's container. + * + * Class variables for this panel class are available in the `data` JS object; + * export custom variables by overriding WP_Customize_Panel::json(). + * + * @see WP_Customize_Panel::print_template() + * + * @since 4.3.0 + */ + protected function render_template() + { + } + /** + * An Underscore (JS) template for this panel's content (but not its container). + * + * Class variables for this panel class are available in the `data` JS object; + * export custom variables by overriding WP_Customize_Panel::json(). + * + * @see WP_Customize_Panel::print_template() + * + * @since 4.3.0 + */ + protected function content_template() + { + } + } + /** + * WordPress Customize Section classes + * + * @package WordPress + * @subpackage Customize + * @since 3.4.0 + */ + /** + * Customize Section class. + * + * A UI container for controls, managed by the WP_Customize_Manager class. + * + * @since 3.4.0 + * + * @see WP_Customize_Manager + */ + #[\AllowDynamicProperties] + class WP_Customize_Section + { + /** + * Incremented with each new class instantiation, then stored in $instance_number. + * + * Used when sorting two instances whose priorities are equal. + * + * @since 4.1.0 + * @var int + */ + protected static $instance_count = 0; + /** + * Order in which this instance was created in relation to other instances. + * + * @since 4.1.0 + * @var int + */ + public $instance_number; + /** + * WP_Customize_Manager instance. + * + * @since 3.4.0 + * @var WP_Customize_Manager + */ + public $manager; + /** + * Unique identifier. + * + * @since 3.4.0 + * @var string + */ + public $id; + /** + * Priority of the section which informs load order of sections. + * + * @since 3.4.0 + * @var int + */ + public $priority = 160; + /** + * Panel in which to show the section, making it a sub-section. + * + * @since 4.0.0 + * @var string + */ + public $panel = ''; + /** + * Capability required for the section. + * + * @since 3.4.0 + * @var string + */ + public $capability = 'edit_theme_options'; + /** + * Theme features required to support the section. + * + * @since 3.4.0 + * @var string|string[] + */ + public $theme_supports = ''; + /** + * Title of the section to show in UI. + * + * @since 3.4.0 + * @var string + */ + public $title = ''; + /** + * Description to show in the UI. + * + * @since 3.4.0 + * @var string + */ + public $description = ''; + /** + * Customizer controls for this section. + * + * @since 3.4.0 + * @var array + */ + public $controls; + /** + * Type of this section. + * + * @since 4.1.0 + * @var string + */ + public $type = 'default'; + /** + * Active callback. + * + * @since 4.1.0 + * + * @see WP_Customize_Section::active() + * + * @var callable Callback is called with one argument, the instance of + * WP_Customize_Section, and returns bool to indicate whether + * the section is active (such as it relates to the URL currently + * being previewed). + */ + public $active_callback = ''; + /** + * Show the description or hide it behind the help icon. + * + * @since 4.7.0 + * + * @var bool Indicates whether the Section's description should be + * hidden behind a help icon ("?") in the Section header, + * similar to how help icons are displayed on Panels. + */ + public $description_hidden = \false; + /** + * Constructor. + * + * Any supplied $args override class property defaults. + * + * @since 3.4.0 + * + * @param WP_Customize_Manager $manager Customizer bootstrap instance. + * @param string $id A specific ID of the section. + * @param array $args { + * Optional. Array of properties for the new Section object. Default empty array. + * + * @type int $priority Priority of the section, defining the display order + * of panels and sections. Default 160. + * @type string $panel The panel this section belongs to (if any). + * Default empty. + * @type string $capability Capability required for the section. + * Default 'edit_theme_options' + * @type string|string[] $theme_supports Theme features required to support the section. + * @type string $title Title of the section to show in UI. + * @type string $description Description to show in the UI. + * @type string $type Type of the section. + * @type callable $active_callback Active callback. + * @type bool $description_hidden Hide the description behind a help icon, + * instead of inline above the first control. + * Default false. + * } + * @phpstan-param array{ + * priority?: int, + * panel?: string, + * capability?: string, + * theme_supports?: string|string[], + * title?: string, + * description?: string, + * type?: string, + * active_callback?: callable, + * description_hidden?: bool, + * } $args + */ + public function __construct($manager, $id, $args = array()) + { + } + /** + * Check whether section is active to current Customizer preview. + * + * @since 4.1.0 + * + * @return bool Whether the section is active to the current preview. + */ + public final function active() + { + } + /** + * Default callback used when invoking WP_Customize_Section::active(). + * + * Subclasses can override this with their specific logic, or they may provide + * an 'active_callback' argument to the constructor. + * + * @since 4.1.0 + * + * @return true Always true. + */ + public function active_callback() + { + } + /** + * Gather the parameters passed to client JavaScript via JSON. + * + * @since 4.1.0 + * + * @return array The array to be exported to the client as JSON. + */ + public function json() + { + } + /** + * Checks required user capabilities and whether the theme has the + * feature support required by the section. + * + * @since 3.4.0 + * + * @return bool False if theme doesn't support the section or user doesn't have the capability. + */ + public final function check_capabilities() + { + } + /** + * Get the section's content for insertion into the Customizer pane. + * + * @since 4.1.0 + * + * @return string Contents of the section. + */ + public final function get_content() + { + } + /** + * Check capabilities and render the section. + * + * @since 3.4.0 + * @phpstan-return void + */ + public final function maybe_render() + { + } + /** + * Render the section UI in a subclass. + * + * Sections are now rendered in JS by default, see WP_Customize_Section::print_template(). + * + * @since 3.4.0 + */ + protected function render() + { + } + /** + * Render the section's JS template. + * + * This function is only run for section types that have been registered with + * WP_Customize_Manager::register_section_type(). + * + * @since 4.3.0 + * + * @see WP_Customize_Manager::render_template() + */ + public function print_template() + { + } + /** + * An Underscore (JS) template for rendering this section. + * + * Class variables for this section class are available in the `data` JS object; + * export custom variables by overriding WP_Customize_Section::json(). + * + * @since 4.3.0 + * + * @see WP_Customize_Section::print_template() + */ + protected function render_template() + { + } + } + /** + * WordPress Customize Setting classes + * + * @package WordPress + * @subpackage Customize + * @since 3.4.0 + */ + /** + * Customize Setting class. + * + * Handles saving and sanitizing of settings. + * + * @since 3.4.0 + * + * @see WP_Customize_Manager + * @link https://developer.wordpress.org/themes/customize-api + */ + #[\AllowDynamicProperties] + class WP_Customize_Setting + { + /** + * Customizer bootstrap instance. + * + * @since 3.4.0 + * @var WP_Customize_Manager + */ + public $manager; + /** + * Unique string identifier for the setting. + * + * @since 3.4.0 + * @var string + */ + public $id; + /** + * Type of customize settings. + * + * @since 3.4.0 + * @var string + */ + public $type = 'theme_mod'; + /** + * Capability required to edit this setting. + * + * @since 3.4.0 + * @var string|array + */ + public $capability = 'edit_theme_options'; + /** + * Theme features required to support the setting. + * + * @since 3.4.0 + * @var string|string[] + */ + public $theme_supports = ''; + /** + * The default value for the setting. + * + * @since 3.4.0 + * @var string + */ + public $default = ''; + /** + * Options for rendering the live preview of changes in Customizer. + * + * Set this value to 'postMessage' to enable a custom JavaScript handler to render changes to this setting + * as opposed to reloading the whole page. + * + * @since 3.4.0 + * @var string + */ + public $transport = 'refresh'; + /** + * Server-side validation callback for the setting's value. + * + * @since 4.6.0 + * @var callable + */ + public $validate_callback = ''; + /** + * Callback to filter a Customize setting value in un-slashed form. + * + * @since 3.4.0 + * @var callable + */ + public $sanitize_callback = ''; + /** + * Callback to convert a Customize PHP setting value to a value that is JSON serializable. + * + * @since 3.4.0 + * @var callable + */ + public $sanitize_js_callback = ''; + /** + * Whether or not the setting is initially dirty when created. + * + * This is used to ensure that a setting will be sent from the pane to the + * preview when loading the Customizer. Normally a setting only is synced to + * the preview if it has been changed. This allows the setting to be sent + * from the start. + * + * @since 4.2.0 + * @var bool + */ + public $dirty = \false; + /** + * ID Data. + * + * @since 3.4.0 + * @var array + */ + protected $id_data = array(); + /** + * Whether or not preview() was called. + * + * @since 4.4.0 + * @var bool + */ + protected $is_previewed = \false; + /** + * Cache of multidimensional values to improve performance. + * + * @since 4.4.0 + * @var array + */ + protected static $aggregated_multidimensionals = array(); + /** + * Whether the multidimensional setting is aggregated. + * + * @since 4.4.0 + * @var bool + */ + protected $is_multidimensional_aggregated = \false; + /** + * Constructor. + * + * Any supplied $args override class property defaults. + * + * @since 3.4.0 + * + * @param WP_Customize_Manager $manager Customizer bootstrap instance. + * @param string $id A specific ID of the setting. + * Can be a theme mod or option name. + * @param array $args { + * Optional. Array of properties for the new Setting object. Default empty array. + * + * @type string $type Type of the setting. Default 'theme_mod'. + * @type string $capability Capability required for the setting. Default 'edit_theme_options' + * @type string|string[] $theme_supports Theme features required to support the panel. Default is none. + * @type string $default Default value for the setting. Default is empty string. + * @type string $transport Options for rendering the live preview of changes in Customizer. + * Using 'refresh' makes the change visible by reloading the whole preview. + * Using 'postMessage' allows a custom JavaScript to handle live changes. + * Default is 'refresh'. + * @type callable $validate_callback Server-side validation callback for the setting's value. + * @type callable $sanitize_callback Callback to filter a Customize setting value in un-slashed form. + * @type callable $sanitize_js_callback Callback to convert a Customize PHP setting value to a value that is + * JSON serializable. + * @type bool $dirty Whether or not the setting is initially dirty when created. + * } + * @phpstan-param array{ + * type?: string, + * capability?: string, + * theme_supports?: string|string[], + * default?: string, + * transport?: string, + * validate_callback?: callable, + * sanitize_callback?: callable, + * sanitize_js_callback?: callable, + * dirty?: bool, + * } $args + */ + public function __construct($manager, $id, $args = array()) + { + } + /** + * Get parsed ID data for multidimensional setting. + * + * @since 4.4.0 + * + * @return array { + * ID data for multidimensional setting. + * + * @type string $base ID base + * @type array $keys Keys for multidimensional array. + * } + * @phpstan-return array{ + * base: string, + * keys: array, + * } + */ + public final function id_data() + { + } + /** + * Set up the setting for aggregated multidimensional values. + * + * When a multidimensional setting gets aggregated, all of its preview and update + * calls get combined into one call, greatly improving performance. + * + * @since 4.4.0 + */ + protected function aggregate_multidimensional() + { + } + /** + * Reset `$aggregated_multidimensionals` static variable. + * + * This is intended only for use by unit tests. + * + * @since 4.5.0 + * @ignore + */ + public static function reset_aggregated_multidimensionals() + { + } + /** + * The ID for the current site when the preview() method was called. + * + * @since 4.2.0 + * @var int + */ + protected $_previewed_blog_id; + /** + * Return true if the current site is not the same as the previewed site. + * + * @since 4.2.0 + * + * @return bool If preview() has been called. + */ + public function is_current_blog_previewed() + { + } + /** + * Original non-previewed value stored by the preview method. + * + * @see WP_Customize_Setting::preview() + * @since 4.1.1 + * @var mixed + */ + protected $_original_value; + /** + * Add filters to supply the setting's value when accessed. + * + * If the setting already has a pre-existing value and there is no incoming + * post value for the setting, then this method will short-circuit since + * there is no change to preview. + * + * @since 3.4.0 + * @since 4.4.0 Added boolean return value. + * + * @return bool False when preview short-circuits due no change needing to be previewed. + */ + public function preview() + { + } + /** + * Clear out the previewed-applied flag for a multidimensional-aggregated value whenever its post value is updated. + * + * This ensures that the new value will get sanitized and used the next time + * that `WP_Customize_Setting::_multidimensional_preview_filter()` + * is called for this setting. + * + * @since 4.4.0 + * + * @see WP_Customize_Manager::set_post_value() + * @see WP_Customize_Setting::_multidimensional_preview_filter() + */ + public final function _clear_aggregated_multidimensional_preview_applied_flag() + { + } + /** + * Callback function to filter non-multidimensional theme mods and options. + * + * If switch_to_blog() was called after the preview() method, and the current + * site is now not the same site, then this method does a no-op and returns + * the original value. + * + * @since 3.4.0 + * + * @param mixed $original Old value. + * @return mixed New or old value. + */ + public function _preview_filter($original) + { + } + /** + * Callback function to filter multidimensional theme mods and options. + * + * For all multidimensional settings of a given type, the preview filter for + * the first setting previewed will be used to apply the values for the others. + * + * @since 4.4.0 + * + * @see WP_Customize_Setting::$aggregated_multidimensionals + * @param mixed $original Original root value. + * @return mixed New or old value. + */ + public final function _multidimensional_preview_filter($original) + { + } + /** + * Checks user capabilities and theme supports, and then saves + * the value of the setting. + * + * @since 3.4.0 + * + * @return void|false Void on success, false if cap check fails + * or value isn't set or is invalid. + */ + public final function save() + { + } + /** + * Fetch and sanitize the $_POST value for the setting. + * + * During a save request prior to save, post_value() provides the new value while value() does not. + * + * @since 3.4.0 + * + * @param mixed $default_value A default value which is used as a fallback. Default null. + * @return mixed The default value on failure, otherwise the sanitized and validated value. + */ + public final function post_value($default_value = \null) + { + } + /** + * Sanitize an input. + * + * @since 3.4.0 + * + * @param string|array $value The value to sanitize. + * @return string|array|null|WP_Error Sanitized value, or `null`/`WP_Error` if invalid. + */ + public function sanitize($value) + { + } + /** + * Validates an input. + * + * @since 4.6.0 + * + * @see WP_REST_Request::has_valid_params() + * + * @param mixed $value Value to validate. + * @return true|WP_Error True if the input was validated, otherwise WP_Error. + */ + public function validate($value) + { + } + /** + * Get the root value for a setting, especially for multidimensional ones. + * + * @since 4.4.0 + * + * @param mixed $default_value Value to return if root does not exist. + * @return mixed + */ + protected function get_root_value($default_value = \null) + { + } + /** + * Set the root value for a setting, especially for multidimensional ones. + * + * @since 4.4.0 + * + * @param mixed $value Value to set as root of multidimensional setting. + * @return bool Whether the multidimensional root was updated successfully. + */ + protected function set_root_value($value) + { + } + /** + * Save the value of the setting, using the related API. + * + * @since 3.4.0 + * + * @param mixed $value The value to update. + * @return bool The result of saving the value. + */ + protected function update($value) + { + } + /** + * Deprecated method. + * + * @since 3.4.0 + * @deprecated 4.4.0 Deprecated in favor of update() method. + */ + protected function _update_theme_mod() + { + } + /** + * Deprecated method. + * + * @since 3.4.0 + * @deprecated 4.4.0 Deprecated in favor of update() method. + */ + protected function _update_option() + { + } + /** + * Fetch the value of the setting. + * + * @since 3.4.0 + * + * @return mixed The value. + */ + public function value() + { + } + /** + * Sanitize the setting's value for use in JavaScript. + * + * @since 3.4.0 + * + * @return mixed The requested escaped value. + */ + public function js_value() + { + } + /** + * Retrieves the data to export to the client via JSON. + * + * @since 4.6.0 + * + * @return array Array of parameters passed to JavaScript. + */ + public function json() + { + } + /** + * Validate user capabilities whether the theme supports the setting. + * + * @since 3.4.0 + * + * @return bool False if theme doesn't support the setting or user can't change setting, otherwise true. + */ + public final function check_capabilities() + { + } + /** + * Multidimensional helper function. + * + * @since 3.4.0 + * + * @param array $root + * @param array $keys + * @param bool $create Default false. + * @return array|void Keys are 'root', 'node', and 'key'. + */ + protected final function multidimensional(&$root, $keys, $create = \false) + { + } + /** + * Will attempt to replace a specific value in a multidimensional array. + * + * @since 3.4.0 + * + * @param array $root + * @param array $keys + * @param mixed $value The value to update. + * @return mixed + */ + protected final function multidimensional_replace($root, $keys, $value) + { + } + /** + * Will attempt to fetch a specific value from a multidimensional array. + * + * @since 3.4.0 + * + * @param array $root + * @param array $keys + * @param mixed $default_value A default value which is used as a fallback. Default null. + * @return mixed The requested value or the default value. + */ + protected final function multidimensional_get($root, $keys, $default_value = \null) + { + } + /** + * Will attempt to check if a specific value in a multidimensional array is set. + * + * @since 3.4.0 + * + * @param array $root + * @param array $keys + * @return bool True if value is set, false if not. + */ + protected final function multidimensional_isset($root, $keys) + { + } + } + /** + * WordPress Customize Widgets classes + * + * @package WordPress + * @subpackage Customize + * @since 3.9.0 + */ + /** + * Customize Widgets class. + * + * Implements widget management in the Customizer. + * + * @since 3.9.0 + * + * @see WP_Customize_Manager + */ + #[\AllowDynamicProperties] + final class WP_Customize_Widgets + { + /** + * WP_Customize_Manager instance. + * + * @since 3.9.0 + * @var WP_Customize_Manager + */ + public $manager; + /** + * Initial loader. + * + * @since 3.9.0 + * + * @param WP_Customize_Manager $manager Customizer bootstrap instance. + * @phpstan-return void + */ + public function __construct($manager) + { + } + /** + * List whether each registered widget can be use selective refresh. + * + * If the theme does not support the customize-selective-refresh-widgets feature, + * then this will always return an empty array. + * + * @since 4.5.0 + * + * @global WP_Widget_Factory $wp_widget_factory + * + * @return array Mapping of id_base to support. If theme doesn't support + * selective refresh, an empty array is returned. + */ + public function get_selective_refreshable_widgets() + { + } + /** + * Determines if a widget supports selective refresh. + * + * @since 4.5.0 + * + * @param string $id_base Widget ID Base. + * @return bool Whether the widget can be selective refreshed. + */ + public function is_widget_selective_refreshable($id_base) + { + } + /** + * Inspects the incoming customized data for any widget settings, and dynamically adds + * them up-front so widgets will be initialized properly. + * + * @since 4.2.0 + */ + public function register_settings() + { + } + /** + * Determines the arguments for a dynamically-created setting. + * + * @since 4.2.0 + * + * @param false|array $args The arguments to the WP_Customize_Setting constructor. + * @param string $setting_id ID for dynamic setting, usually coming from `$_POST['customized']`. + * @return array|false Setting arguments, false otherwise. + */ + public function filter_customize_dynamic_setting_args($args, $setting_id) + { + } + /** + * Override sidebars_widgets for theme switch. + * + * When switching a theme via the Customizer, supply any previously-configured + * sidebars_widgets from the target theme as the initial sidebars_widgets + * setting. Also store the old theme's existing settings so that they can + * be passed along for storing in the sidebars_widgets theme_mod when the + * theme gets switched. + * + * @since 3.9.0 + * + * @global array $sidebars_widgets + * @global array $_wp_sidebars_widgets + * @phpstan-return void + */ + public function override_sidebars_widgets_for_theme_switch() + { + } + /** + * Filters old_sidebars_widgets_data Customizer setting. + * + * When switching themes, filter the Customizer setting old_sidebars_widgets_data + * to supply initial $sidebars_widgets before they were overridden by retrieve_widgets(). + * The value for old_sidebars_widgets_data gets set in the old theme's sidebars_widgets + * theme_mod. + * + * @since 3.9.0 + * + * @see WP_Customize_Widgets::handle_theme_switch() + * + * @param array $old_sidebars_widgets + * @return array + */ + public function filter_customize_value_old_sidebars_widgets_data($old_sidebars_widgets) + { + } + /** + * Filters sidebars_widgets option for theme switch. + * + * When switching themes, the retrieve_widgets() function is run when the Customizer initializes, + * and then the new sidebars_widgets here get supplied as the default value for the sidebars_widgets + * option. + * + * @since 3.9.0 + * + * @see WP_Customize_Widgets::handle_theme_switch() + * @global array $sidebars_widgets + * + * @param array $sidebars_widgets + * @return array + */ + public function filter_option_sidebars_widgets_for_theme_switch($sidebars_widgets) + { + } + /** + * Ensures all widgets get loaded into the Customizer. + * + * Note: these actions are also fired in wp_ajax_update_widget(). + * + * @since 3.9.0 + */ + public function customize_controls_init() + { + } + /** + * Ensures widgets are available for all types of previews. + * + * When in preview, hook to {@see 'customize_register'} for settings after WordPress is loaded + * so that all filters have been initialized (e.g. Widget Visibility). + * + * @since 3.9.0 + */ + public function schedule_customize_register() + { + } + /** + * Registers Customizer settings and controls for all sidebars and widgets. + * + * @since 3.9.0 + * + * @global array $wp_registered_widgets + * @global array $wp_registered_widget_controls + * @global array $wp_registered_sidebars + */ + public function customize_register() + { + } + /** + * Determines whether the widgets panel is active, based on whether there are sidebars registered. + * + * @since 4.4.0 + * + * @see WP_Customize_Panel::$active_callback + * + * @global array $wp_registered_sidebars + * @return bool Active. + */ + public function is_panel_active() + { + } + /** + * Converts a widget_id into its corresponding Customizer setting ID (option name). + * + * @since 3.9.0 + * + * @param string $widget_id Widget ID. + * @return string Maybe-parsed widget ID. + */ + public function get_setting_id($widget_id) + { + } + /** + * Determines whether the widget is considered "wide". + * + * Core widgets which may have controls wider than 250, but can still be shown + * in the narrow Customizer panel. The RSS and Text widgets in Core, for example, + * have widths of 400 and yet they still render fine in the Customizer panel. + * + * This method will return all Core widgets as being not wide, but this can be + * overridden with the {@see 'is_wide_widget_in_customizer'} filter. + * + * @since 3.9.0 + * + * @global array $wp_registered_widget_controls + * + * @param string $widget_id Widget ID. + * @return bool Whether or not the widget is a "wide" widget. + */ + public function is_wide_widget($widget_id) + { + } + /** + * Converts a widget ID into its id_base and number components. + * + * @since 3.9.0 + * + * @param string $widget_id Widget ID. + * @return array Array containing a widget's id_base and number components. + */ + public function parse_widget_id($widget_id) + { + } + /** + * Converts a widget setting ID (option path) to its id_base and number components. + * + * @since 3.9.0 + * + * @param string $setting_id Widget setting ID. + * @return array|WP_Error Array containing a widget's id_base and number components, + * or a WP_Error object. + */ + public function parse_widget_setting_id($setting_id) + { + } + /** + * Calls admin_print_styles-widgets.php and admin_print_styles hooks to + * allow custom styles from plugins. + * + * @since 3.9.0 + */ + public function print_styles() + { + } + /** + * Calls admin_print_scripts-widgets.php and admin_print_scripts hooks to + * allow custom scripts from plugins. + * + * @since 3.9.0 + */ + public function print_scripts() + { + } + /** + * Enqueues scripts and styles for Customizer panel and export data to JavaScript. + * + * @since 3.9.0 + * + * @global WP_Scripts $wp_scripts + * @global array $wp_registered_sidebars + * @global array $wp_registered_widgets + */ + public function enqueue_scripts() + { + } + /** + * Renders the widget form control templates into the DOM. + * + * @since 3.9.0 + */ + public function output_widget_control_templates() + { + } + /** + * Calls admin_print_footer_scripts and admin_print_scripts hooks to + * allow custom scripts from plugins. + * + * @since 3.9.0 + */ + public function print_footer_scripts() + { + } + /** + * Retrieves common arguments to supply when constructing a Customizer setting. + * + * @since 3.9.0 + * + * @param string $id Widget setting ID. + * @param array $overrides Array of setting overrides. + * @return array Possibly modified setting arguments. + */ + public function get_setting_args($id, $overrides = array()) + { + } + /** + * Ensures sidebar widget arrays only ever contain widget IDS. + * + * Used as the 'sanitize_callback' for each $sidebars_widgets setting. + * + * @since 3.9.0 + * + * @param string[] $widget_ids Array of widget IDs. + * @return string[] Array of sanitized widget IDs. + */ + public function sanitize_sidebar_widgets($widget_ids) + { + } + /** + * Builds up an index of all available widgets for use in Backbone models. + * + * @since 3.9.0 + * + * @global array $wp_registered_widgets + * @global array $wp_registered_widget_controls + * + * @see wp_list_widgets() + * + * @return array List of available widgets. + */ + public function get_available_widgets() + { + } + /** + * Retrieves the widget control markup. + * + * @since 3.9.0 + * + * @param array $args Widget control arguments. + * @return string Widget control form HTML markup. + */ + public function get_widget_control($args) + { + } + /** + * Retrieves the widget control markup parts. + * + * @since 4.4.0 + * + * @param array $args Widget control arguments. + * @return array { + * @type string $control Markup for widget control wrapping form. + * @type string $content The contents of the widget form itself. + * } + * @phpstan-return array{ + * control: string, + * content: string, + * } + */ + public function get_widget_control_parts($args) + { + } + /** + * Adds hooks for the Customizer preview. + * + * @since 3.9.0 + */ + public function customize_preview_init() + { + } + /** + * Refreshes the nonce for widget updates. + * + * @since 4.2.0 + * + * @param array $nonces Array of nonces. + * @return array Array of nonces. + */ + public function refresh_nonces($nonces) + { + } + /** + * Tells the script loader to load the scripts and styles of custom blocks + * if the widgets block editor is enabled. + * + * @since 5.8.0 + * + * @param bool $is_block_editor_screen Current decision about loading block assets. + * @return bool Filtered decision about loading block assets. + */ + public function should_load_block_editor_scripts_and_styles($is_block_editor_screen) + { + } + /** + * When previewing, ensures the proper previewing widgets are used. + * + * Because wp_get_sidebars_widgets() gets called early at {@see 'init' } (via + * wp_convert_widget_settings()) and can set global variable `$_wp_sidebars_widgets` + * to the value of `get_option( 'sidebars_widgets' )` before the Customizer preview + * filter is added, it has to be reset after the filter has been added. + * + * @since 3.9.0 + * + * @param array $sidebars_widgets List of widgets for the current sidebar. + * @return array + */ + public function preview_sidebars_widgets($sidebars_widgets) + { + } + /** + * Enqueues scripts for the Customizer preview. + * + * @since 3.9.0 + */ + public function customize_preview_enqueue() + { + } + /** + * Inserts default style for highlighted widget at early point so theme + * stylesheet can override. + * + * @since 3.9.0 + */ + public function print_preview_css() + { + } + /** + * Communicates the sidebars that appeared on the page at the very end of the page, + * and at the very end of the wp_footer, + * + * @since 3.9.0 + * + * @global array $wp_registered_sidebars + * @global array $wp_registered_widgets + */ + public function export_preview_data() + { + } + /** + * Tracks the widgets that were rendered. + * + * @since 3.9.0 + * + * @param array $widget Rendered widget to tally. + */ + public function tally_rendered_widgets($widget) + { + } + /** + * Determine if a widget is rendered on the page. + * + * @since 4.0.0 + * + * @param string $widget_id Widget ID to check. + * @return bool Whether the widget is rendered. + */ + public function is_widget_rendered($widget_id) + { + } + /** + * Determines if a sidebar is rendered on the page. + * + * @since 4.0.0 + * + * @param string $sidebar_id Sidebar ID to check. + * @return bool Whether the sidebar is rendered. + */ + public function is_sidebar_rendered($sidebar_id) + { + } + /** + * Tallies the sidebars rendered via is_active_sidebar(). + * + * Keep track of the times that is_active_sidebar() is called in the template, + * and assume that this means that the sidebar would be rendered on the template + * if there were widgets populating it. + * + * @since 3.9.0 + * + * @param bool $is_active Whether the sidebar is active. + * @param string $sidebar_id Sidebar ID. + * @return bool Whether the sidebar is active. + */ + public function tally_sidebars_via_is_active_sidebar_calls($is_active, $sidebar_id) + { + } + /** + * Tallies the sidebars rendered via dynamic_sidebar(). + * + * Keep track of the times that dynamic_sidebar() is called in the template, + * and assume this means the sidebar would be rendered on the template if + * there were widgets populating it. + * + * @since 3.9.0 + * + * @param bool $has_widgets Whether the current sidebar has widgets. + * @param string $sidebar_id Sidebar ID. + * @return bool Whether the current sidebar has widgets. + */ + public function tally_sidebars_via_dynamic_sidebar_calls($has_widgets, $sidebar_id) + { + } + /** + * Sanitizes a widget instance. + * + * Unserialize the JS-instance for storing in the options. It's important that this filter + * only get applied to an instance *once*. + * + * @since 3.9.0 + * @since 5.8.0 Added the `$id_base` parameter. + * + * @global WP_Widget_Factory $wp_widget_factory + * + * @param array $value Widget instance to sanitize. + * @param string $id_base Optional. Base of the ID of the widget being sanitized. Default null. + * @return array|void Sanitized widget instance. + */ + public function sanitize_widget_instance($value, $id_base = \null) + { + } + /** + * Converts a widget instance into JSON-representable format. + * + * @since 3.9.0 + * @since 5.8.0 Added the `$id_base` parameter. + * + * @global WP_Widget_Factory $wp_widget_factory + * + * @param array $value Widget instance to convert to JSON. + * @param string $id_base Optional. Base of the ID of the widget being sanitized. Default null. + * @return array JSON-converted widget instance. + */ + public function sanitize_widget_js_instance($value, $id_base = \null) + { + } + /** + * Strips out widget IDs for widgets which are no longer registered. + * + * One example where this might happen is when a plugin orphans a widget + * in a sidebar upon deactivation. + * + * @since 3.9.0 + * + * @global array $wp_registered_widgets + * + * @param array $widget_ids List of widget IDs. + * @return array Parsed list of widget IDs. + */ + public function sanitize_sidebar_widgets_js_instance($widget_ids) + { + } + /** + * Finds and invokes the widget update and control callbacks. + * + * Requires that `$_POST` be populated with the instance data. + * + * @since 3.9.0 + * + * @global array $wp_registered_widget_updates + * @global array $wp_registered_widget_controls + * + * @param string $widget_id Widget ID. + * @return array|WP_Error Array containing the updated widget information. + * A WP_Error object, otherwise. + */ + public function call_widget_update($widget_id) + { + } + /** + * Updates widget settings asynchronously. + * + * Allows the Customizer to update a widget using its form, but return the new + * instance info via Ajax instead of saving it to the options table. + * + * Most code here copied from wp_ajax_save_widget(). + * + * @since 3.9.0 + * + * @see wp_ajax_save_widget() + * @phpstan-return never + */ + public function wp_ajax_update_widget() + { + } + /* + * Selective Refresh Methods + */ + /** + * Filters arguments for dynamic widget partials. + * + * @since 4.5.0 + * + * @param array|false $partial_args Partial arguments. + * @param string $partial_id Partial ID. + * @return array (Maybe) modified partial arguments. + */ + public function customize_dynamic_partial_args($partial_args, $partial_id) + { + } + /** + * Adds hooks for selective refresh. + * + * @since 4.5.0 + * @phpstan-return void + */ + public function selective_refresh_init() + { + } + /** + * Inject selective refresh data attributes into widget container elements. + * + * @since 4.5.0 + * + * @param array $params { + * Dynamic sidebar params. + * + * @type array $args Sidebar args. + * @type array $widget_args Widget args. + * } + * @see WP_Customize_Nav_Menus::filter_wp_nav_menu_args() + * + * @return array Params. + * @phpstan-param array{ + * args?: array, + * widget_args?: array, + * } $params + */ + public function filter_dynamic_sidebar_params($params) + { + } + /** + * Ensures the HTML data-* attributes for selective refresh are allowed by kses. + * + * This is needed in case the `$before_widget` is run through wp_kses() when printed. + * + * @since 4.5.0 + * + * @param array $allowed_html Allowed HTML. + * @return array (Maybe) modified allowed HTML. + */ + public function filter_wp_kses_allowed_data_attributes($allowed_html) + { + } + /** + * Begins keeping track of the current sidebar being rendered. + * + * Insert marker before widgets are rendered in a dynamic sidebar. + * + * @since 4.5.0 + * + * @param int|string $index Index, name, or ID of the dynamic sidebar. + */ + public function start_dynamic_sidebar($index) + { + } + /** + * Finishes keeping track of the current sidebar being rendered. + * + * Inserts a marker after widgets are rendered in a dynamic sidebar. + * + * @since 4.5.0 + * + * @param int|string $index Index, name, or ID of the dynamic sidebar. + */ + public function end_dynamic_sidebar($index) + { + } + /** + * Filters sidebars_widgets to ensure the currently-rendered widget is the only widget in the current sidebar. + * + * @since 4.5.0 + * + * @param array $sidebars_widgets Sidebars widgets. + * @return array Filtered sidebars widgets. + */ + public function filter_sidebars_widgets_for_rendering_widget($sidebars_widgets) + { + } + /** + * Renders a specific widget using the supplied sidebar arguments. + * + * @since 4.5.0 + * + * @see dynamic_sidebar() + * + * @param WP_Customize_Partial $partial Partial. + * @param array $context { + * Sidebar args supplied as container context. + * + * @type string $sidebar_id ID for sidebar for widget to render into. + * @type int $sidebar_instance_number Disambiguating instance number. + * } + * @return string|false + * @phpstan-param array{ + * sidebar_id?: string, + * sidebar_instance_number?: int, + * } $context + */ + public function render_widget_partial($partial, $context) + { + } + /** + * Pre-filters captured option values before updating. + * + * @since 3.9.0 + * + * @param mixed $new_value The new option value. + * @param string $option_name Name of the option. + * @param mixed $old_value The old option value. + * @return mixed Filtered option value. + */ + public function capture_filter_pre_update_option($new_value, $option_name, $old_value) + { + } + /** + * Pre-filters captured option values before retrieving. + * + * @since 3.9.0 + * + * @param mixed $value Value to return instead of the option value. + * @return mixed Filtered option value. + */ + public function capture_filter_pre_get_option($value) + { + } + /** + * {@internal Missing Summary} + * + * See the {@see 'customize_dynamic_setting_args'} filter. + * + * @since 3.9.0 + * @deprecated 4.2.0 Deprecated in favor of the {@see 'customize_dynamic_setting_args'} filter. + */ + public function setup_widget_addition_previews() + { + } + /** + * {@internal Missing Summary} + * + * See the {@see 'customize_dynamic_setting_args'} filter. + * + * @since 3.9.0 + * @deprecated 4.2.0 Deprecated in favor of the {@see 'customize_dynamic_setting_args'} filter. + */ + public function prepreview_added_sidebars_widgets() + { + } + /** + * {@internal Missing Summary} + * + * See the {@see 'customize_dynamic_setting_args'} filter. + * + * @since 3.9.0 + * @deprecated 4.2.0 Deprecated in favor of the {@see 'customize_dynamic_setting_args'} filter. + */ + public function prepreview_added_widget_instance() + { + } + /** + * {@internal Missing Summary} + * + * See the {@see 'customize_dynamic_setting_args'} filter. + * + * @since 3.9.0 + * @deprecated 4.2.0 Deprecated in favor of the {@see 'customize_dynamic_setting_args'} filter. + */ + public function remove_prepreview_filters() + { + } + } + /** + * Class for generating SQL clauses that filter a primary query according to date. + * + * WP_Date_Query is a helper that allows primary query classes, such as WP_Query, to filter + * their results by date columns, by generating `WHERE` subclauses to be attached to the + * primary SQL query string. + * + * Attempting to filter by an invalid date value (eg month=13) will generate SQL that will + * return no results. In these cases, a _doing_it_wrong() error notice is also thrown. + * See WP_Date_Query::validate_date_values(). + * + * @link https://developer.wordpress.org/reference/classes/wp_query/ + * + * @since 3.7.0 + */ + #[\AllowDynamicProperties] + class WP_Date_Query + { + /** + * Array of date queries. + * + * See WP_Date_Query::__construct() for information on date query arguments. + * + * @since 3.7.0 + * @var array + */ + public $queries = array(); + /** + * The default relation between top-level queries. Can be either 'AND' or 'OR'. + * + * @since 3.7.0 + * @var string + */ + public $relation = 'AND'; + /** + * The column to query against. Can be changed via the query arguments. + * + * @since 3.7.0 + * @var string + */ + public $column = 'post_date'; + /** + * The value comparison operator. Can be changed via the query arguments. + * + * @since 3.7.0 + * @var string + */ + public $compare = '='; + /** + * Supported time-related parameter keys. + * + * @since 4.1.0 + * @var string[] + */ + public $time_keys = array('after', 'before', 'year', 'month', 'monthnum', 'week', 'w', 'dayofyear', 'day', 'dayofweek', 'dayofweek_iso', 'hour', 'minute', 'second'); + /** + * Constructor. + * + * Time-related parameters that normally require integer values ('year', 'month', 'week', 'dayofyear', 'day', + * 'dayofweek', 'dayofweek_iso', 'hour', 'minute', 'second') accept arrays of integers for some values of + * 'compare'. When 'compare' is 'IN' or 'NOT IN', arrays are accepted; when 'compare' is 'BETWEEN' or 'NOT + * BETWEEN', arrays of two valid values are required. See individual argument descriptions for accepted values. + * + * @since 3.7.0 + * @since 4.0.0 The $inclusive logic was updated to include all times within the date range. + * @since 4.1.0 Introduced 'dayofweek_iso' time type parameter. + * + * @param array $date_query { + * Array of date query clauses. + * + * @type array ...$0 { + * @type string $column Optional. The column to query against. If undefined, inherits the value of + * the `$default_column` parameter. See WP_Date_Query::validate_column() and + * the {@see 'date_query_valid_columns'} filter for the list of accepted values. + * Default 'post_date'. + * @type string $compare Optional. The comparison operator. Accepts '=', '!=', '>', '>=', '<', '<=', + * 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN'. Default '='. + * @type string $relation Optional. The boolean relationship between the date queries. Accepts 'OR' or 'AND'. + * Default 'OR'. + * @type array ...$0 { + * Optional. An array of first-order clause parameters, or another fully-formed date query. + * + * @type string|array $before { + * Optional. Date to retrieve posts before. Accepts `strtotime()`-compatible string, + * or array of 'year', 'month', 'day' values. + * + * @type string $year The four-digit year. Default empty. Accepts any four-digit year. + * @type string $month Optional when passing array.The month of the year. + * Default (string:empty)|(array:1). Accepts numbers 1-12. + * @type string $day Optional when passing array.The day of the month. + * Default (string:empty)|(array:1). Accepts numbers 1-31. + * } + * @type string|array $after { + * Optional. Date to retrieve posts after. Accepts `strtotime()`-compatible string, + * or array of 'year', 'month', 'day' values. + * + * @type string $year The four-digit year. Accepts any four-digit year. Default empty. + * @type string $month Optional when passing array. The month of the year. Accepts numbers 1-12. + * Default (string:empty)|(array:12). + * @type string $day Optional when passing array.The day of the month. Accepts numbers 1-31. + * Default (string:empty)|(array:last day of month). + * } + * @type string $column Optional. Used to add a clause comparing a column other than + * the column specified in the top-level `$column` parameter. + * See WP_Date_Query::validate_column() and + * the {@see 'date_query_valid_columns'} filter for the list + * of accepted values. Default is the value of top-level `$column`. + * @type string $compare Optional. The comparison operator. Accepts '=', '!=', '>', '>=', + * '<', '<=', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN'. 'IN', + * 'NOT IN', 'BETWEEN', and 'NOT BETWEEN'. Comparisons support + * arrays in some time-related parameters. Default '='. + * @type bool $inclusive Optional. Include results from dates specified in 'before' or + * 'after'. Default false. + * @type int|int[] $year Optional. The four-digit year number. Accepts any four-digit year + * or an array of years if `$compare` supports it. Default empty. + * @type int|int[] $month Optional. The two-digit month number. Accepts numbers 1-12 or an + * array of valid numbers if `$compare` supports it. Default empty. + * @type int|int[] $week Optional. The week number of the year. Accepts numbers 0-53 or an + * array of valid numbers if `$compare` supports it. Default empty. + * @type int|int[] $dayofyear Optional. The day number of the year. Accepts numbers 1-366 or an + * array of valid numbers if `$compare` supports it. + * @type int|int[] $day Optional. The day of the month. Accepts numbers 1-31 or an array + * of valid numbers if `$compare` supports it. Default empty. + * @type int|int[] $dayofweek Optional. The day number of the week. Accepts numbers 1-7 (1 is + * Sunday) or an array of valid numbers if `$compare` supports it. + * Default empty. + * @type int|int[] $dayofweek_iso Optional. The day number of the week (ISO). Accepts numbers 1-7 + * (1 is Monday) or an array of valid numbers if `$compare` supports it. + * Default empty. + * @type int|int[] $hour Optional. The hour of the day. Accepts numbers 0-23 or an array + * of valid numbers if `$compare` supports it. Default empty. + * @type int|int[] $minute Optional. The minute of the hour. Accepts numbers 0-59 or an array + * of valid numbers if `$compare` supports it. Default empty. + * @type int|int[] $second Optional. The second of the minute. Accepts numbers 0-59 or an + * array of valid numbers if `$compare` supports it. Default empty. + * } + * } + * } + * @param string $default_column Optional. Default column to query against. See WP_Date_Query::validate_column() + * and the {@see 'date_query_valid_columns'} filter for the list of accepted values. + * Default 'post_date'. + * @phpstan-return void + */ + public function __construct($date_query, $default_column = 'post_date') + { + } + /** + * Recursive-friendly query sanitizer. + * + * Ensures that each query-level clause has a 'relation' key, and that + * each first-order clause contains all the necessary keys from `$defaults`. + * + * @since 4.1.0 + * + * @param array $queries + * @param array $parent_query + * @return array Sanitized queries. + */ + public function sanitize_query($queries, $parent_query = \null) + { + } + /** + * Determines whether this is a first-order clause. + * + * Checks to see if the current clause has any time-related keys. + * If so, it's first-order. + * + * @since 4.1.0 + * + * @param array $query Query clause. + * @return bool True if this is a first-order clause. + */ + protected function is_first_order_clause($query) + { + } + /** + * Determines and validates what comparison operator to use. + * + * @since 3.7.0 + * + * @param array $query A date query or a date subquery. + * @return string The comparison operator. + */ + public function get_compare($query) + { + } + /** + * Validates the given date_query values and triggers errors if something is not valid. + * + * Note that date queries with invalid date ranges are allowed to + * continue (though of course no items will be found for impossible dates). + * This method only generates debug notices for these cases. + * + * @since 4.1.0 + * + * @param array $date_query The date_query array. + * @return bool True if all values in the query are valid, false if one or more fail. + */ + public function validate_date_values($date_query = array()) + { + } + /** + * Validates a column name parameter. + * + * Column names without a table prefix (like 'post_date') are checked against a list of + * allowed and known tables, and then, if found, have a table prefix (such as 'wp_posts.') + * prepended. Prefixed column names (such as 'wp_posts.post_date') bypass this allowed + * check, and are only sanitized to remove illegal characters. + * + * @since 3.7.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $column The user-supplied column name. + * @return string A validated column name value. + */ + public function validate_column($column) + { + } + /** + * Generates WHERE clause to be appended to a main query. + * + * @since 3.7.0 + * + * @return string MySQL WHERE clause. + */ + public function get_sql() + { + } + /** + * Generates SQL clauses to be appended to a main query. + * + * Called by the public WP_Date_Query::get_sql(), this method is abstracted + * out to maintain parity with the other Query classes. + * + * @since 4.1.0 + * + * @return string[] { + * Array containing JOIN and WHERE SQL clauses to append to the main query. + * + * @type string $join SQL fragment to append to the main JOIN clause. + * @type string $where SQL fragment to append to the main WHERE clause. + * } + * @phpstan-return array{ + * join: string, + * where: string, + * } + */ + protected function get_sql_clauses() + { + } + /** + * Generates SQL clauses for a single query array. + * + * If nested subqueries are found, this method recurses the tree to + * produce the properly nested SQL. + * + * @since 4.1.0 + * + * @param array $query Query to parse. + * @param int $depth Optional. Number of tree levels deep we currently are. + * Used to calculate indentation. Default 0. + * @return array { + * Array containing JOIN and WHERE SQL clauses to append to a single query array. + * + * @type string $join SQL fragment to append to the main JOIN clause. + * @type string $where SQL fragment to append to the main WHERE clause. + * } + * @phpstan-return array{ + * join: string, + * where: string, + * } + */ + protected function get_sql_for_query($query, $depth = 0) + { + } + /** + * Turns a single date clause into pieces for a WHERE clause. + * + * A wrapper for get_sql_for_clause(), included here for backward + * compatibility while retaining the naming convention across Query classes. + * + * @since 3.7.0 + * + * @param array $query Date query arguments. + * @return array { + * Array containing JOIN and WHERE SQL clauses to append to the main query. + * + * @type string[] $join Array of SQL fragments to append to the main JOIN clause. + * @type string[] $where Array of SQL fragments to append to the main WHERE clause. + * } + * @phpstan-return array{ + * join: string[], + * where: string[], + * } + */ + protected function get_sql_for_subquery($query) + { + } + /** + * Turns a first-order date query into SQL for a WHERE clause. + * + * @since 4.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array $query Date query clause. + * @param array $parent_query Parent query of the current date query. + * @return array { + * Array containing JOIN and WHERE SQL clauses to append to the main query. + * + * @type string[] $join Array of SQL fragments to append to the main JOIN clause. + * @type string[] $where Array of SQL fragments to append to the main WHERE clause. + * } + * @phpstan-return array{ + * join: string[], + * where: string[], + * } + */ + protected function get_sql_for_clause($query, $parent_query) + { + } + /** + * Builds and validates a value string based on the comparison operator. + * + * @since 3.7.0 + * + * @param string $compare The compare operator to use. + * @param string|array $value The value. + * @return string|false|int The value to be used in SQL or false on error. + */ + public function build_value($compare, $value) + { + } + /** + * Builds a MySQL format date/time based on some query parameters. + * + * You can pass an array of values (year, month, etc.) with missing parameter values being defaulted to + * either the maximum or minimum values (controlled by the $default_to parameter). Alternatively you can + * pass a string that will be passed to date_create(). + * + * @since 3.7.0 + * + * @param string|array $datetime An array of parameters or a strtotime() string. + * @param bool $default_to_max Whether to round up incomplete dates. Supported by values + * of $datetime that are arrays, or string values that are a + * subset of MySQL date format ('Y', 'Y-m', 'Y-m-d', 'Y-m-d H:i'). + * Default: false. + * @return string|false A MySQL format date/time or false on failure. + */ + public function build_mysql_datetime($datetime, $default_to_max = \false) + { + } + /** + * Builds a query string for comparing time values (hour, minute, second). + * + * If just hour, minute, or second is set than a normal comparison will be done. + * However if multiple values are passed, a pseudo-decimal time will be created + * in order to be able to accurately compare against. + * + * @since 3.7.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $column The column to query against. Needs to be pre-validated! + * @param string $compare The comparison operator. Needs to be pre-validated! + * @param int|null $hour Optional. An hour value (0-23). + * @param int|null $minute Optional. A minute value (0-59). + * @param int|null $second Optional. A second value (0-59). + * @return string|false A query part or false on failure. + */ + public function build_time_query($column, $compare, $hour = \null, $minute = \null, $second = \null) + { + } + /** + * Sanitizes a 'relation' operator. + * + * @since 6.0.3 + * + * @param string $relation Raw relation key from the query argument. + * @return string Sanitized relation. Either 'AND' or 'OR'. + * @phpstan-return 'AND'|'OR' + */ + public function sanitize_relation($relation) + { + } + } + /** + * Dependencies API: WP_Dependencies base class + * + * @since 2.6.0 + * + * @package WordPress + * @subpackage Dependencies + */ + /** + * Core base class extended to register items. + * + * @since 2.6.0 + * + * @see _WP_Dependency + */ + #[\AllowDynamicProperties] + class WP_Dependencies + { + /** + * An array of all registered dependencies keyed by handle. + * + * @since 2.6.8 + * + * @var _WP_Dependency[] + */ + public $registered = array(); + /** + * An array of handles of queued dependencies. + * + * @since 2.6.8 + * + * @var string[] + */ + public $queue = array(); + /** + * An array of handles of dependencies to queue. + * + * @since 2.6.0 + * + * @var string[] + */ + public $to_do = array(); + /** + * An array of handles of dependencies already queued. + * + * @since 2.6.0 + * + * @var string[] + */ + public $done = array(); + /** + * An array of additional arguments passed when a handle is registered. + * + * Arguments are appended to the item query string. + * + * @since 2.6.0 + * + * @var array + */ + public $args = array(); + /** + * An array of dependency groups to enqueue. + * + * Each entry is keyed by handle and represents the integer group level or boolean + * false if the handle has no group. + * + * @since 2.8.0 + * + * @var (int|false)[] + */ + public $groups = array(); + /** + * A handle group to enqueue. + * + * @since 2.8.0 + * + * @deprecated 4.5.0 + * @var int + */ + public $group = 0; + /** + * Processes the items and dependencies. + * + * Processes the items passed to it or the queue, and their dependencies. + * + * @since 2.6.0 + * @since 2.8.0 Added the `$group` parameter. + * + * @param string|string[]|false $handles Optional. Items to be processed: queue (false), + * single item (string), or multiple items (array of strings). + * Default false. + * @param int|false $group Optional. Group level: level (int), no group (false). + * @return string[] Array of handles of items that have been processed. + */ + public function do_items($handles = \false, $group = \false) + { + } + /** + * Processes a dependency. + * + * @since 2.6.0 + * @since 5.5.0 Added the `$group` parameter. + * + * @param string $handle Name of the item. Should be unique. + * @param int|false $group Optional. Group level: level (int), no group (false). + * Default false. + * @return bool True on success, false if not set. + */ + public function do_item($handle, $group = \false) + { + } + /** + * Determines dependencies. + * + * Recursively builds an array of items to process taking + * dependencies into account. Does NOT catch infinite loops. + * + * @since 2.1.0 + * @since 2.6.0 Moved from `WP_Scripts`. + * @since 2.8.0 Added the `$group` parameter. + * + * @param string|string[] $handles Item handle (string) or item handles (array of strings). + * @param bool $recursion Optional. Internal flag that function is calling itself. + * Default false. + * @param int|false $group Optional. Group level: level (int), no group (false). + * Default false. + * @return bool True on success, false on failure. + */ + public function all_deps($handles, $recursion = \false, $group = \false) + { + } + /** + * Register an item. + * + * Registers the item if no item of that name already exists. + * + * @since 2.1.0 + * @since 2.6.0 Moved from `WP_Scripts`. + * + * @param string $handle Name of the item. Should be unique. + * @param string|false $src Full URL of the item, or path of the item relative + * to the WordPress root directory. If source is set to false, + * the item is an alias of other items it depends on. + * @param string[] $deps Optional. An array of registered item handles this item depends on. + * Default empty array. + * @param string|bool|null $ver Optional. String specifying item version number, if it has one, + * which is added to the URL as a query string for cache busting purposes. + * If version is set to false, a version number is automatically added + * equal to current installed WordPress version. + * If set to null, no version is added. + * @param mixed $args Optional. Custom property of the item. NOT the class property $args. + * Examples: $media, $in_footer. + * @return bool Whether the item has been registered. True on success, false on failure. + */ + public function add($handle, $src, $deps = array(), $ver = \false, $args = \null) + { + } + /** + * Add extra item data. + * + * Adds data to a registered item. + * + * @since 2.6.0 + * + * @param string $handle Name of the item. Should be unique. + * @param string $key The data key. + * @param mixed $value The data value. + * @return bool True on success, false on failure. + */ + public function add_data($handle, $key, $value) + { + } + /** + * Get extra item data. + * + * Gets data associated with a registered item. + * + * @since 3.3.0 + * + * @param string $handle Name of the item. Should be unique. + * @param string $key The data key. + * @return mixed Extra item data (string), false otherwise. + */ + public function get_data($handle, $key) + { + } + /** + * Un-register an item or items. + * + * @since 2.1.0 + * @since 2.6.0 Moved from `WP_Scripts`. + * + * @param string|string[] $handles Item handle (string) or item handles (array of strings). + */ + public function remove($handles) + { + } + /** + * Queue an item or items. + * + * Decodes handles and arguments, then queues handles and stores + * arguments in the class property $args. For example in extending + * classes, $args is appended to the item url as a query string. + * Note $args is NOT the $args property of items in the $registered array. + * + * @since 2.1.0 + * @since 2.6.0 Moved from `WP_Scripts`. + * + * @param string|string[] $handles Item handle (string) or item handles (array of strings). + */ + public function enqueue($handles) + { + } + /** + * Dequeue an item or items. + * + * Decodes handles and arguments, then dequeues handles + * and removes arguments from the class property $args. + * + * @since 2.1.0 + * @since 2.6.0 Moved from `WP_Scripts`. + * + * @param string|string[] $handles Item handle (string) or item handles (array of strings). + */ + public function dequeue($handles) + { + } + /** + * Recursively search the passed dependency tree for a handle. + * + * @since 4.0.0 + * + * @param string[] $queue An array of queued _WP_Dependency handles. + * @param string $handle Name of the item. Should be unique. + * @return bool Whether the handle is found after recursively searching the dependency tree. + */ + protected function recurse_deps($queue, $handle) + { + } + /** + * Query the list for an item. + * + * @since 2.1.0 + * @since 2.6.0 Moved from `WP_Scripts`. + * + * @param string $handle Name of the item. Should be unique. + * @param string $status Optional. Status of the item to query. Default 'registered'. + * @return bool|_WP_Dependency Found, or object Item data. + */ + public function query($handle, $status = 'registered') + { + } + /** + * Set item group, unless already in a lower group. + * + * @since 2.8.0 + * + * @param string $handle Name of the item. Should be unique. + * @param bool $recursion Internal flag that calling function was called recursively. + * @param int|false $group Group level: level (int), no group (false). + * @return bool Not already in the group or a lower group. + */ + public function set_group($handle, $recursion, $group) + { + } + } + /** + * Dependencies API: _WP_Dependency class + * + * @since 4.7.0 + * + * @package WordPress + * @subpackage Dependencies + */ + /** + * Class _WP_Dependency + * + * Helper class to register a handle and associated data. + * + * @access private + * @since 2.6.0 + */ + #[\AllowDynamicProperties] + class _WP_Dependency + { + /** + * The handle name. + * + * @since 2.6.0 + * @var string + */ + public $handle; + /** + * The handle source. + * + * If source is set to false, the item is an alias of other items it depends on. + * + * @since 2.6.0 + * @var string|false + */ + public $src; + /** + * An array of handle dependencies. + * + * @since 2.6.0 + * @var string[] + */ + public $deps = array(); + /** + * The handle version. + * + * Used for cache-busting. + * + * @since 2.6.0 + * @var bool|string + */ + public $ver = \false; + /** + * Additional arguments for the handle. + * + * @since 2.6.0 + * @var array + */ + public $args = \null; + // Custom property, such as $in_footer or $media. + /** + * Extra data to supply to the handle. + * + * @since 2.6.0 + * @var array + */ + public $extra = array(); + /** + * Translation textdomain set for this dependency. + * + * @since 5.0.0 + * @var string + */ + public $textdomain; + /** + * Translation path set for this dependency. + * + * @since 5.0.0 + * @var string + */ + public $translations_path; + /** + * Setup dependencies. + * + * @since 2.6.0 + * @since 5.3.0 Formalized the existing `...$args` parameter by adding it + * to the function signature. + * + * @param mixed ...$args Dependency information. + */ + public function __construct(...$args) + { + } + /** + * Add handle data. + * + * @since 2.6.0 + * + * @param string $name The data key to add. + * @param mixed $data The data value to add. + * @return bool False if not scalar, true otherwise. + */ + public function add_data($name, $data) + { + } + /** + * Sets the translation domain for this dependency. + * + * @since 5.0.0 + * + * @param string $domain The translation textdomain. + * @param string $path Optional. The full file path to the directory containing translation files. + * @return bool False if $domain is not a string, true otherwise. + */ + public function set_translations($domain, $path = '') + { + } + } + /** + * WP_Duotone class + * + * Parts of this source were derived and modified from colord, + * released under the MIT license. + * + * https://github.com/omgovich/colord + * + * Copyright (c) 2020 Vlad Shilov omgovich@ya.ru + * + * 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. + * + * @package WordPress + * @since 6.3.0 + */ + /** + * Manages duotone block supports and global styles. + * + * @access private + */ + class WP_Duotone + { + /** + * Returns the prefixed id for the duotone filter for use as a CSS id. + * + * Exported for the deprecated function wp_get_duotone_filter_id(). + * + * @internal + * + * @since 6.3.0 + * @deprecated 6.3.0 + * + * @param array $preset Duotone preset value as seen in theme.json. + * @return string Duotone filter CSS id. + */ + public static function get_filter_id_from_preset($preset) + { + } + /** + * Gets the SVG for the duotone filter definition from a preset. + * + * Exported for the deprecated function wp_get_duotone_filter_property(). + * + * @internal + * + * @since 6.3.0 + * @deprecated 6.3.0 + * + * @param array $preset The duotone preset. + * @return string The SVG for the filter definition. + */ + public static function get_filter_svg_from_preset($preset) + { + } + /** + * Registers the style and colors block attributes for block types that support it. + * + * Block support is added with `supports.filter.duotone` in block.json. + * + * @since 6.3.0 + * + * @param WP_Block_Type $block_type Block Type. + */ + public static function register_duotone_support($block_type) + { + } + /** + * Render out the duotone CSS styles and SVG. + * + * The hooks self::set_global_style_block_names and self::set_global_styles_presets + * must be called before this function. + * + * @since 6.3.0 + * + * @param string $block_content Rendered block content. + * @param array $block Block object. + * @param WP_Block $wp_block The block instance. + * @return string Filtered block content. + */ + public static function render_duotone_support($block_content, $block, $wp_block) + { + } + /** + * Fixes the issue with our generated class name not being added to the block's outer container + * in classic themes due to gutenberg_restore_image_outer_container from layout block supports. + * + * @since 6.6.0 + * + * @param string $block_content Rendered block content. + * @return string Filtered block content. + */ + public static function restore_image_outer_container($block_content) + { + } + /** + * Appends the used block duotone filter declarations to the inline block supports CSS. + * + * Uses the declarations saved in earlier calls to self::enqueue_block_css. + * + * @since 6.3.0 + */ + public static function output_block_styles() + { + } + /** + * Appends the used global style duotone filter presets (CSS custom + * properties) to the inline global styles CSS. + * + * Uses the declarations saved in earlier calls to self::enqueue_global_styles_preset. + * + * @since 6.3.0 + */ + public static function output_global_styles() + { + } + /** + * Outputs all necessary SVG for duotone filters, CSS for classic themes. + * + * Uses the declarations saved in earlier calls to self::enqueue_global_styles_preset + * and self::enqueue_custom_filter. + * + * @since 6.3.0 + */ + public static function output_footer_assets() + { + } + /** + * Adds the duotone SVGs and CSS custom properties to the editor settings. + * + * This allows the properties to be pulled in by the EditorStyles component + * in JS and rendered in the post editor. + * + * @since 6.3.0 + * + * @param array $settings The block editor settings from the `block_editor_settings_all` filter. + * @return array The editor settings with duotone SVGs and CSS custom properties. + */ + public static function add_editor_settings($settings) + { + } + /** + * Migrates the experimental duotone support flag to the stabilized location. + * + * This moves `supports.color.__experimentalDuotone` to `supports.filter.duotone`. + * + * @since 6.3.0 + * + * @param array $settings Current block type settings. + * @param array $metadata Block metadata as read in via block.json. + * @return array Filtered block type settings. + */ + public static function migrate_experimental_duotone_support_flag($settings, $metadata) + { + } + /** + * Gets the CSS filter property value from a preset. + * + * Exported for the deprecated function wp_get_duotone_filter_id(). + * + * @internal + * + * @since 6.3.0 + * @deprecated 6.3.0 + * + * @param array $preset The duotone preset. + * @return string The CSS filter property value. + */ + public static function get_filter_css_property_value_from_preset($preset) + { + } + } + /** + * Facilitates adding of the WordPress editor as used on the Write and Edit screens. + * + * @package WordPress + * @since 3.3.0 + * + * Private, not included by default. See wp_editor() in wp-includes/general-template.php. + */ + #[\AllowDynamicProperties] + final class _WP_Editors + { + public static $mce_locale; + /** + * Parse default arguments for the editor instance. + * + * @since 3.3.0 + * + * @param string $editor_id HTML ID for the textarea and TinyMCE and Quicktags instances. + * Should not contain square brackets. + * @param array $settings { + * Array of editor arguments. + * + * @type bool $wpautop Whether to use wpautop(). Default true. + * @type bool $media_buttons Whether to show the Add Media/other media buttons. + * @type string $default_editor When both TinyMCE and Quicktags are used, set which + * editor is shown on page load. Default empty. + * @type bool $drag_drop_upload Whether to enable drag & drop on the editor uploading. Default false. + * Requires the media modal. + * @type string $textarea_name Give the textarea a unique name here. Square brackets + * can be used here. Default $editor_id. + * @type int $textarea_rows Number rows in the editor textarea. Default 20. + * @type string|int $tabindex Tabindex value to use. Default empty. + * @type string $tabfocus_elements The previous and next element ID to move the focus to + * when pressing the Tab key in TinyMCE. Default ':prev,:next'. + * @type string $editor_css Intended for extra styles for both Visual and Text editors. + * Should include `<style>` tags, and can use "scoped". Default empty. + * @type string $editor_class Extra classes to add to the editor textarea element. Default empty. + * @type bool $teeny Whether to output the minimal editor config. Examples include + * Press This and the Comment editor. Default false. + * @type bool $dfw Deprecated in 4.1. Unused. + * @type bool|array $tinymce Whether to load TinyMCE. Can be used to pass settings directly to + * TinyMCE using an array. Default true. + * @type bool|array $quicktags Whether to load Quicktags. Can be used to pass settings directly to + * Quicktags using an array. Default true. + * } + * @return array Parsed arguments array. + * @phpstan-param array{ + * wpautop?: bool, + * media_buttons?: bool, + * default_editor?: string, + * drag_drop_upload?: bool, + * textarea_name?: string, + * textarea_rows?: int, + * tabindex?: string|int, + * tabfocus_elements?: string, + * editor_css?: string, + * editor_class?: string, + * teeny?: bool, + * dfw?: bool, + * tinymce?: bool|array, + * quicktags?: bool|array, + * } $settings + */ + public static function parse_settings($editor_id, $settings) + { + } + /** + * Outputs the HTML for a single instance of the editor. + * + * @since 3.3.0 + * + * @global WP_Screen $current_screen WordPress current screen object. + * + * @param string $content Initial content for the editor. + * @param string $editor_id HTML ID for the textarea and TinyMCE and Quicktags instances. + * Should not contain square brackets. + * @param array $settings See _WP_Editors::parse_settings() for description. + * @phpstan-param array{ + * wpautop?: bool, + * media_buttons?: bool, + * default_editor?: string, + * drag_drop_upload?: bool, + * textarea_name?: string, + * textarea_rows?: int, + * tabindex?: string|int, + * tabfocus_elements?: string, + * editor_css?: string, + * editor_class?: string, + * teeny?: bool, + * dfw?: bool, + * tinymce?: bool|array, + * quicktags?: bool|array, + * } $settings See _WP_Editors::parse_settings() + */ + public static function editor($content, $editor_id, $settings = array()) + { + } + /** + * @since 3.3.0 + * + * @param string $editor_id Unique editor identifier, e.g. 'content'. + * @param array $set Array of editor arguments. + */ + public static function editor_settings($editor_id, $set) + { + } + /** + * @since 3.3.0 + * + * @param bool $default_scripts Optional. Whether default scripts should be enqueued. Default false. + */ + public static function enqueue_scripts($default_scripts = \false) + { + } + /** + * Enqueue all editor scripts. + * For use when the editor is going to be initialized after page load. + * + * @since 4.8.0 + * @phpstan-return void + */ + public static function enqueue_default_editor() + { + } + /** + * Print (output) all editor scripts and default settings. + * For use when the editor is going to be initialized after page load. + * + * @since 4.8.0 + */ + public static function print_default_editor_scripts() + { + } + /** + * Returns the TinyMCE locale. + * + * @since 4.8.0 + * + * @return string + */ + public static function get_mce_locale() + { + } + /** + * Returns the TinyMCE base URL. + * + * @since 4.8.0 + * + * @return string + */ + public static function get_baseurl() + { + } + /** + * Translates the default TinyMCE strings and returns them as JSON encoded object ready to be loaded with tinymce.addI18n(), + * or as JS snippet that should run after tinymce.js is loaded. + * + * @since 3.9.0 + * + * @param string $mce_locale The locale used for the editor. + * @param bool $json_only Optional. Whether to include the JavaScript calls to tinymce.addI18n() and + * tinymce.ScriptLoader.markDone(). Default false. + * @return string Translation object, JSON encoded. + */ + public static function wp_mce_translation($mce_locale = '', $json_only = \false) + { + } + /** + * Force uncompressed TinyMCE when a custom theme has been defined. + * + * The compressed TinyMCE file cannot deal with custom themes, so this makes + * sure that WordPress uses the uncompressed TinyMCE file if a theme is defined. + * Even if the website is running on a production environment. + * + * @since 5.0.0 + * @phpstan-return void + */ + public static function force_uncompressed_tinymce() + { + } + /** + * Print (output) the main TinyMCE scripts. + * + * @since 4.8.0 + * + * @global bool $concatenate_scripts + * @phpstan-return void + */ + public static function print_tinymce_scripts() + { + } + /** + * Print (output) the TinyMCE configuration and initialization scripts. + * + * @since 3.3.0 + * + * @global string $tinymce_version + */ + public static function editor_js() + { + } + /** + * Outputs the HTML for distraction-free writing mode. + * + * @since 3.2.0 + * @deprecated 4.3.0 + */ + public static function wp_fullscreen_html() + { + } + /** + * Performs post queries for internal linking. + * + * @since 3.1.0 + * + * @param array $args { + * Optional. Array of link query arguments. + * + * @type int $pagenum Page number. Default 1. + * @type string $s Search keywords. + * } + * @return array|false $results { + * An array of associative arrays of query results, false if there are none. + * + * @type array ...$0 { + * @type int $ID Post ID. + * @type string $title The trimmed, escaped post title. + * @type string $permalink Post permalink. + * @type string $info A 'Y/m/d'-formatted date for 'post' post type, + * the 'singular_name' post type label otherwise. + * } + * } + * @phpstan-param array{ + * pagenum?: int, + * s?: string, + * } $args + * @phpstan-return false|array<int|string, array{ + * ID: int, + * title: string, + * permalink: string, + * info: string, + * }> + */ + public static function wp_link_query($args = array()) + { + } + /** + * Dialog for internal linking. + * + * @since 3.1.0 + * @phpstan-return void + */ + public static function wp_link_dialog() + { + } + } + /** + * API for easily embedding rich media such as videos and images into content. + * + * @package WordPress + * @subpackage Embed + * @since 2.9.0 + */ + #[\AllowDynamicProperties] + class WP_Embed + { + public $handlers = array(); + public $post_ID; + public $usecache = \true; + public $linkifunknown = \true; + public $last_attr = array(); + public $last_url = ''; + /** + * When a URL cannot be embedded, return false instead of returning a link + * or the URL. + * + * Bypasses the {@see 'embed_maybe_make_link'} filter. + * + * @var bool + */ + public $return_false_on_fail = \false; + /** + * Constructor + */ + public function __construct() + { + } + /** + * Processes the [embed] shortcode. + * + * Since the [embed] shortcode needs to be run earlier than other shortcodes, + * this function removes all existing shortcodes, registers the [embed] shortcode, + * calls do_shortcode(), and then re-registers the old shortcodes. + * + * @global array $shortcode_tags + * + * @param string $content Content to parse. + * @return string Content with shortcode parsed. + */ + public function run_shortcode($content) + { + } + /** + * If a post/page was saved, then output JavaScript to make + * an Ajax request that will call WP_Embed::cache_oembed(). + * @phpstan-return void + */ + public function maybe_run_ajax_cache() + { + } + /** + * Registers an embed handler. + * + * Do not use this function directly, use wp_embed_register_handler() instead. + * + * This function should probably also only be used for sites that do not support oEmbed. + * + * @param string $id An internal ID/name for the handler. Needs to be unique. + * @param string $regex The regex that will be used to see if this handler should be used for a URL. + * @param callable $callback The callback function that will be called if the regex is matched. + * @param int $priority Optional. Used to specify the order in which the registered handlers will be tested. + * Lower numbers correspond with earlier testing, and handlers with the same priority are + * tested in the order in which they were added to the action. Default 10. + */ + public function register_handler($id, $regex, $callback, $priority = 10) + { + } + /** + * Unregisters a previously-registered embed handler. + * + * Do not use this function directly, use wp_embed_unregister_handler() instead. + * + * @param string $id The handler ID that should be removed. + * @param int $priority Optional. The priority of the handler to be removed (default: 10). + */ + public function unregister_handler($id, $priority = 10) + { + } + /** + * Returns embed HTML for a given URL from embed handlers. + * + * Attempts to convert a URL into embed HTML by checking the URL + * against the regex of the registered embed handlers. + * + * @since 5.5.0 + * + * @param array $attr { + * Shortcode attributes. Optional. + * + * @type int $width Width of the embed in pixels. + * @type int $height Height of the embed in pixels. + * } + * @param string $url The URL attempting to be embedded. + * @return string|false The embed HTML on success, false otherwise. + * @phpstan-param array{ + * width?: int, + * height?: int, + * } $attr + */ + public function get_embed_handler_html($attr, $url) + { + } + /** + * The do_shortcode() callback function. + * + * Attempts to convert a URL into embed HTML. Starts by checking the URL against the regex of + * the registered embed handlers. If none of the regex matches and it's enabled, then the URL + * will be given to the WP_oEmbed class. + * + * @param array $attr { + * Shortcode attributes. Optional. + * + * @type int $width Width of the embed in pixels. + * @type int $height Height of the embed in pixels. + * } + * @param string $url The URL attempting to be embedded. + * @return string|false The embed HTML on success, otherwise the original URL. + * `->maybe_make_link()` can return false on failure. + * @phpstan-param array{ + * width?: int, + * height?: int, + * } $attr + */ + public function shortcode($attr, $url = '') + { + } + /** + * Deletes all oEmbed caches. Unused by core as of 4.0.0. + * + * @param int $post_id Post ID to delete the caches for. + * @phpstan-return void + */ + public function delete_oembed_caches($post_id) + { + } + /** + * Triggers a caching of all oEmbed results. + * + * @param int $post_id Post ID to do the caching for. + * @phpstan-return void + */ + public function cache_oembed($post_id) + { + } + /** + * Passes any unlinked URLs that are on their own line to WP_Embed::shortcode() for potential embedding. + * + * @see WP_Embed::autoembed_callback() + * + * @param string $content The content to be searched. + * @return string Potentially modified $content. + */ + public function autoembed($content) + { + } + /** + * Callback function for WP_Embed::autoembed(). + * + * @param array $matches A regex match array. + * @return string The embed HTML on success, otherwise the original URL. + */ + public function autoembed_callback($matches) + { + } + /** + * Conditionally makes a hyperlink based on an internal class variable. + * + * @param string $url URL to potentially be linked. + * @return string|false Linked URL or the original URL. False if 'return_false_on_fail' is true. + */ + public function maybe_make_link($url) + { + } + /** + * Finds the oEmbed cache post ID for a given cache key. + * + * @since 4.9.0 + * + * @param string $cache_key oEmbed cache key. + * @return int|null Post ID on success, null on failure. + */ + public function find_oembed_post_id($cache_key) + { + } + } + /** + * WordPress Error API. + * + * @package WordPress + */ + /** + * WordPress Error class. + * + * Container for checking for WordPress errors and error messages. Return + * WP_Error and use is_wp_error() to check if this class is returned. Many + * core WordPress functions pass this class in the event of an error and + * if not handled properly will result in code errors. + * + * @since 2.1.0 + */ + #[\AllowDynamicProperties] + class WP_Error + { + /** + * Stores the list of errors. + * + * @since 2.1.0 + * @var array + */ + public $errors = array(); + /** + * Stores the most recently added data for each error code. + * + * @since 2.1.0 + * @var array + */ + public $error_data = array(); + /** + * Stores previously added data added for error codes, oldest-to-newest by code. + * + * @since 5.6.0 + * @var array[] + */ + protected $additional_data = array(); + /** + * Initializes the error. + * + * If `$code` is empty, the other parameters will be ignored. + * When `$code` is not empty, `$message` will be used even if + * it is empty. The `$data` parameter will be used only if it + * is not empty. + * + * Though the class is constructed with a single error code and + * message, multiple codes can be added using the `add()` method. + * + * @since 2.1.0 + * + * @param string|int $code Error code. + * @param string $message Error message. + * @param mixed $data Optional. Error data. Default empty string. + * @phpstan-return void + */ + public function __construct($code = '', $message = '', $data = '') + { + } + /** + * Retrieves all error codes. + * + * @since 2.1.0 + * + * @return array List of error codes, if available. + */ + public function get_error_codes() + { + } + /** + * Retrieves the first error code available. + * + * @since 2.1.0 + * + * @return string|int Empty string, if no error codes. + */ + public function get_error_code() + { + } + /** + * Retrieves all error messages, or the error messages for the given error code. + * + * @since 2.1.0 + * + * @param string|int $code Optional. Error code to retrieve the messages for. + * Default empty string. + * @return string[] Error strings on success, or empty array if there are none. + */ + public function get_error_messages($code = '') + { + } + /** + * Gets a single error message. + * + * This will get the first message available for the code. If no code is + * given then the first code available will be used. + * + * @since 2.1.0 + * + * @param string|int $code Optional. Error code to retrieve the message for. + * Default empty string. + * @return string The error message. + */ + public function get_error_message($code = '') + { + } + /** + * Retrieves the most recently added error data for an error code. + * + * @since 2.1.0 + * + * @param string|int $code Optional. Error code. Default empty string. + * @return mixed Error data, if it exists. + */ + public function get_error_data($code = '') + { + } + /** + * Verifies if the instance contains errors. + * + * @since 5.1.0 + * + * @return bool If the instance contains errors. + */ + public function has_errors() + { + } + /** + * Adds an error or appends an additional message to an existing error. + * + * @since 2.1.0 + * + * @param string|int $code Error code. + * @param string $message Error message. + * @param mixed $data Optional. Error data. Default empty string. + */ + public function add($code, $message, $data = '') + { + } + /** + * Adds data to an error with the given code. + * + * @since 2.1.0 + * @since 5.6.0 Errors can now contain more than one item of error data. {@see WP_Error::$additional_data}. + * + * @param mixed $data Error data. + * @param string|int $code Error code. + */ + public function add_data($data, $code = '') + { + } + /** + * Retrieves all error data for an error code in the order in which the data was added. + * + * @since 5.6.0 + * + * @param string|int $code Error code. + * @return mixed[] Array of error data, if it exists. + */ + public function get_all_error_data($code = '') + { + } + /** + * Removes the specified error. + * + * This function removes all error messages associated with the specified + * error code, along with any error data for that code. + * + * @since 4.1.0 + * + * @param string|int $code Error code. + */ + public function remove($code) + { + } + /** + * Merges the errors in the given error object into this one. + * + * @since 5.6.0 + * + * @param WP_Error $error Error object to merge. + */ + public function merge_from(\WP_Error $error) + { + } + /** + * Exports the errors in this object into the given one. + * + * @since 5.6.0 + * + * @param WP_Error $error Error object to export into. + */ + public function export_to(\WP_Error $error) + { + } + /** + * Copies errors from one WP_Error instance to another. + * + * @since 5.6.0 + * + * @param WP_Error $from The WP_Error to copy from. + * @param WP_Error $to The WP_Error to copy to. + */ + protected static function copy_errors(\WP_Error $from, \WP_Error $to) + { + } + } + /** + * Error Protection API: WP_Fatal_Error_Handler class + * + * @package WordPress + * @since 5.2.0 + */ + /** + * Core class used as the default shutdown handler for fatal errors. + * + * A drop-in 'fatal-error-handler.php' can be used to override the instance of this class and use a custom + * implementation for the fatal error handler that WordPress registers. The custom class should extend this class and + * can override its methods individually as necessary. The file must return the instance of the class that should be + * registered. + * + * @since 5.2.0 + */ + #[\AllowDynamicProperties] + class WP_Fatal_Error_Handler + { + /** + * Runs the shutdown handler. + * + * This method is registered via `register_shutdown_function()`. + * + * @since 5.2.0 + * + * @global WP_Locale $wp_locale WordPress date and time locale object. + * @phpstan-return void + */ + public function handle() + { + } + /** + * Detects the error causing the crash if it should be handled. + * + * @since 5.2.0 + * + * @return array|null Error information returned by `error_get_last()`, or null + * if none was recorded or the error should not be handled. + */ + protected function detect_error() + { + } + /** + * Determines whether we are dealing with an error that WordPress should handle + * in order to protect the admin backend against WSODs. + * + * @since 5.2.0 + * + * @param array $error Error information retrieved from `error_get_last()`. + * @return bool Whether WordPress should handle this error. + */ + protected function should_handle_error($error) + { + } + /** + * Displays the PHP error template and sends the HTTP status code, typically 500. + * + * A drop-in 'php-error.php' can be used as a custom template. This drop-in should control the HTTP status code and + * print the HTML markup indicating that a PHP error occurred. Note that this drop-in may potentially be executed + * very early in the WordPress bootstrap process, so any core functions used that are not part of + * `wp-includes/load.php` should be checked for before being called. + * + * If no such drop-in is available, this will call {@see WP_Fatal_Error_Handler::display_default_error_template()}. + * + * @since 5.2.0 + * @since 5.3.0 The `$handled` parameter was added. + * + * @param array $error Error information retrieved from `error_get_last()`. + * @param true|WP_Error $handled Whether Recovery Mode handled the fatal error. + * @phpstan-return void + */ + protected function display_error_template($error, $handled) + { + } + /** + * Displays the default PHP error template. + * + * This method is called conditionally if no 'php-error.php' drop-in is available. + * + * It calls {@see wp_die()} with a message indicating that the site is experiencing technical difficulties and a + * login link to the admin backend. The {@see 'wp_php_error_message'} and {@see 'wp_php_error_args'} filters can + * be used to modify these parameters. + * + * @since 5.2.0 + * @since 5.3.0 The `$handled` parameter was added. + * + * @param array $error Error information retrieved from `error_get_last()`. + * @param true|WP_Error $handled Whether Recovery Mode handled the fatal error. + */ + protected function display_default_error_template($error, $handled) + { + } + } + /** + * Feed API: WP_Feed_Cache_Transient class + * + * @package WordPress + * @subpackage Feed + * @since 4.7.0 + */ + /** + * Core class used to implement feed cache transients. + * + * @since 2.8.0 + */ + #[\AllowDynamicProperties] + class WP_Feed_Cache_Transient + { + /** + * Holds the transient name. + * + * @since 2.8.0 + * @var string + */ + public $name; + /** + * Holds the transient mod name. + * + * @since 2.8.0 + * @var string + */ + public $mod_name; + /** + * Holds the cache duration in seconds. + * + * Defaults to 43200 seconds (12 hours). + * + * @since 2.8.0 + * @var int + */ + public $lifetime = 43200; + /** + * Constructor. + * + * @since 2.8.0 + * @since 3.2.0 Updated to use a PHP5 constructor. + * + * @param string $location URL location (scheme is used to determine handler). + * @param string $filename Unique identifier for cache object. + * @param string $extension 'spi' or 'spc'. + */ + public function __construct($location, $filename, $extension) + { + } + /** + * Sets the transient. + * + * @since 2.8.0 + * + * @param SimplePie $data Data to save. + * @return true Always true. + */ + public function save($data) + { + } + /** + * Gets the transient. + * + * @since 2.8.0 + * + * @return mixed Transient value. + */ + public function load() + { + } + /** + * Gets mod transient. + * + * @since 2.8.0 + * + * @return mixed Transient value. + */ + public function mtime() + { + } + /** + * Sets mod transient. + * + * @since 2.8.0 + * + * @return bool False if value was not set and true if value was set. + */ + public function touch() + { + } + /** + * Deletes transients. + * + * @since 2.8.0 + * + * @return true Always true. + */ + public function unlink() + { + } + } + /** + * Core class used to implement a feed cache. + * + * @since 2.8.0 + */ + #[\AllowDynamicProperties] + class WP_Feed_Cache extends \SimplePie_Cache + { + /** + * Creates a new SimplePie_Cache object. + * + * @since 2.8.0 + * + * @param string $location URL location (scheme is used to determine handler). + * @param string $filename Unique identifier for cache object. + * @param string $extension 'spi' or 'spc'. + * @return WP_Feed_Cache_Transient Feed cache handler object that uses transients. + */ + public function create($location, $filename, $extension) + { + } + } + /** + * Plugin API: WP_Hook class + * + * @package WordPress + * @subpackage Plugin + * @since 4.7.0 + */ + /** + * Core class used to implement action and filter hook functionality. + * + * @since 4.7.0 + * + * @see Iterator + * @see ArrayAccess + */ + #[\AllowDynamicProperties] + final class WP_Hook implements \Iterator, \ArrayAccess + { + /** + * Hook callbacks. + * + * @since 4.7.0 + * @var array + */ + public $callbacks = array(); + /** + * Adds a callback function to a filter hook. + * + * @since 4.7.0 + * + * @param string $hook_name The name of the filter to add the callback to. + * @param callable $callback The callback to be run when the filter is applied. + * @param int $priority The order in which the functions associated with a particular filter + * are executed. Lower numbers correspond with earlier execution, + * and functions with the same priority are executed in the order + * in which they were added to the filter. + * @param int $accepted_args The number of arguments the function accepts. + */ + public function add_filter($hook_name, $callback, $priority, $accepted_args) + { + } + /** + * Removes a callback function from a filter hook. + * + * @since 4.7.0 + * + * @param string $hook_name The filter hook to which the function to be removed is hooked. + * @param callable|string|array $callback The callback to be removed from running when the filter is applied. + * This method can be called unconditionally to speculatively remove + * a callback that may or may not exist. + * @param int $priority The exact priority used when adding the original filter callback. + * @return bool Whether the callback existed before it was removed. + */ + public function remove_filter($hook_name, $callback, $priority) + { + } + /** + * Checks if a specific callback has been registered for this hook. + * + * When using the `$callback` argument, this function may return a non-boolean value + * that evaluates to false (e.g. 0), so use the `===` operator for testing the return value. + * + * @since 4.7.0 + * + * @param string $hook_name Optional. The name of the filter hook. Default empty. + * @param callable|string|array|false $callback Optional. The callback to check for. + * This method can be called unconditionally to speculatively check + * a callback that may or may not exist. Default false. + * @return bool|int If `$callback` is omitted, returns boolean for whether the hook has + * anything registered. When checking a specific function, the priority + * of that hook is returned, or false if the function is not attached. + */ + public function has_filter($hook_name = '', $callback = \false) + { + } + /** + * Checks if any callbacks have been registered for this hook. + * + * @since 4.7.0 + * + * @return bool True if callbacks have been registered for the current hook, otherwise false. + */ + public function has_filters() + { + } + /** + * Removes all callbacks from the current filter. + * + * @since 4.7.0 + * + * @param int|false $priority Optional. The priority number to remove. Default false. + * @phpstan-return void + */ + public function remove_all_filters($priority = \false) + { + } + /** + * Calls the callback functions that have been added to a filter hook. + * + * @since 4.7.0 + * + * @param mixed $value The value to filter. + * @param array $args Additional parameters to pass to the callback functions. + * This array is expected to include $value at index 0. + * @return mixed The filtered value after all hooked functions are applied to it. + */ + public function apply_filters($value, $args) + { + } + /** + * Calls the callback functions that have been added to an action hook. + * + * @since 4.7.0 + * + * @param array $args Parameters to pass to the callback functions. + */ + public function do_action($args) + { + } + /** + * Processes the functions hooked into the 'all' hook. + * + * @since 4.7.0 + * + * @param array $args Arguments to pass to the hook callbacks. Passed by reference. + */ + public function do_all_hook(&$args) + { + } + /** + * Return the current priority level of the currently running iteration of the hook. + * + * @since 4.7.0 + * + * @return int|false If the hook is running, return the current priority level. + * If it isn't running, return false. + */ + public function current_priority() + { + } + /** + * Normalizes filters set up before WordPress has initialized to WP_Hook objects. + * + * The `$filters` parameter should be an array keyed by hook name, with values + * containing either: + * + * - A `WP_Hook` instance + * - An array of callbacks keyed by their priorities + * + * Examples: + * + * $filters = array( + * 'wp_fatal_error_handler_enabled' => array( + * 10 => array( + * array( + * 'accepted_args' => 0, + * 'function' => function() { + * return false; + * }, + * ), + * ), + * ), + * ); + * + * @since 4.7.0 + * + * @param array $filters Filters to normalize. See documentation above for details. + * @return WP_Hook[] Array of normalized filters. + */ + public static function build_preinitialized_hooks($filters) + { + } + /** + * Determines whether an offset value exists. + * + * @since 4.7.0 + * + * @link https://www.php.net/manual/en/arrayaccess.offsetexists.php + * + * @param mixed $offset An offset to check for. + * @return bool True if the offset exists, false otherwise. + */ + #[\ReturnTypeWillChange] + public function offsetExists($offset) + { + } + /** + * Retrieves a value at a specified offset. + * + * @since 4.7.0 + * + * @link https://www.php.net/manual/en/arrayaccess.offsetget.php + * + * @param mixed $offset The offset to retrieve. + * @return mixed If set, the value at the specified offset, null otherwise. + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + } + /** + * Sets a value at a specified offset. + * + * @since 4.7.0 + * + * @link https://www.php.net/manual/en/arrayaccess.offsetset.php + * + * @param mixed $offset The offset to assign the value to. + * @param mixed $value The value to set. + */ + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value) + { + } + /** + * Unsets a specified offset. + * + * @since 4.7.0 + * + * @link https://www.php.net/manual/en/arrayaccess.offsetunset.php + * + * @param mixed $offset The offset to unset. + */ + #[\ReturnTypeWillChange] + public function offsetUnset($offset) + { + } + /** + * Returns the current element. + * + * @since 4.7.0 + * + * @link https://www.php.net/manual/en/iterator.current.php + * + * @return array Of callbacks at current priority. + */ + #[\ReturnTypeWillChange] + public function current() + { + } + /** + * Moves forward to the next element. + * + * @since 4.7.0 + * + * @link https://www.php.net/manual/en/iterator.next.php + * + * @return array Of callbacks at next priority. + */ + #[\ReturnTypeWillChange] + public function next() + { + } + /** + * Returns the key of the current element. + * + * @since 4.7.0 + * + * @link https://www.php.net/manual/en/iterator.key.php + * + * @return mixed Returns current priority on success, or NULL on failure + */ + #[\ReturnTypeWillChange] + public function key() + { + } + /** + * Checks if current position is valid. + * + * @since 4.7.0 + * + * @link https://www.php.net/manual/en/iterator.valid.php + * + * @return bool Whether the current position is valid. + */ + #[\ReturnTypeWillChange] + public function valid() + { + } + /** + * Rewinds the Iterator to the first element. + * + * @since 4.7.0 + * + * @link https://www.php.net/manual/en/iterator.rewind.php + */ + #[\ReturnTypeWillChange] + public function rewind() + { + } + } + /** + * HTTP API: WP_Http_Cookie class + * + * @package WordPress + * @subpackage HTTP + * @since 4.4.0 + */ + /** + * Core class used to encapsulate a single cookie object for internal use. + * + * Returned cookies are represented using this class, and when cookies are set, if they are not + * already a WP_Http_Cookie() object, then they are turned into one. + * + * @todo The WordPress convention is to use underscores instead of camelCase for function and method + * names. Need to switch to use underscores instead for the methods. + * + * @since 2.8.0 + */ + #[\AllowDynamicProperties] + class WP_Http_Cookie + { + /** + * Cookie name. + * + * @since 2.8.0 + * + * @var string + */ + public $name; + /** + * Cookie value. + * + * @since 2.8.0 + * + * @var string + */ + public $value; + /** + * When the cookie expires. Unix timestamp or formatted date. + * + * @since 2.8.0 + * + * @var string|int|null + */ + public $expires; + /** + * Cookie URL path. + * + * @since 2.8.0 + * + * @var string + */ + public $path; + /** + * Cookie Domain. + * + * @since 2.8.0 + * + * @var string + */ + public $domain; + /** + * Cookie port or comma-separated list of ports. + * + * @since 2.8.0 + * + * @var int|string + */ + public $port; + /** + * host-only flag. + * + * @since 5.2.0 + * + * @var bool + */ + public $host_only; + /** + * Sets up this cookie object. + * + * The parameter $data should be either an associative array containing the indices names below + * or a header string detailing it. + * + * @since 2.8.0 + * @since 5.2.0 Added `host_only` to the `$data` parameter. + * + * @param string|array $data { + * Raw cookie data as header string or data array. + * + * @type string $name Cookie name. + * @type mixed $value Value. Should NOT already be urlencoded. + * @type string|int|null $expires Optional. Unix timestamp or formatted date. Default null. + * @type string $path Optional. Path. Default '/'. + * @type string $domain Optional. Domain. Default host of parsed $requested_url. + * @type int|string $port Optional. Port or comma-separated list of ports. Default null. + * @type bool $host_only Optional. host-only storage flag. Default true. + * } + * @param string $requested_url The URL which the cookie was set on, used for default $domain + * and $port values. + * @phpstan-param array{ + * name?: string, + * value?: mixed, + * expires?: string|int|null, + * path?: string, + * domain?: string, + * port?: int|string, + * host_only?: bool, + * } $data + * @phpstan-return void + */ + public function __construct($data, $requested_url = '') + { + } + /** + * Confirms that it's OK to send this cookie to the URL checked against. + * + * Decision is based on RFC 2109/2965, so look there for details on validity. + * + * @since 2.8.0 + * + * @param string $url URL you intend to send this cookie to + * @return bool true if allowed, false otherwise. + */ + public function test($url) + { + } + /** + * Convert cookie name and value back to header string. + * + * @since 2.8.0 + * + * @return string Header encoded cookie name and value. + */ + public function getHeaderValue() + { + } + /** + * Retrieve cookie header for usage in the rest of the WordPress HTTP API. + * + * @since 2.8.0 + * + * @return string + */ + public function getFullHeader() + { + } + /** + * Retrieves cookie attributes. + * + * @since 4.6.0 + * + * @return array { + * List of attributes. + * + * @type string|int|null $expires When the cookie expires. Unix timestamp or formatted date. + * @type string $path Cookie URL path. + * @type string $domain Cookie domain. + * } + * @phpstan-return array{ + * expires: string|int|null, + * path: string, + * domain: string, + * } + */ + public function get_attributes() + { + } + } + /** + * HTTP API: WP_Http_Curl class + * + * @package WordPress + * @subpackage HTTP + * @since 4.4.0 + */ + /** + * Core class used to integrate Curl as an HTTP transport. + * + * HTTP request method uses Curl extension to retrieve the url. + * + * Requires the Curl extension to be installed. + * + * @since 2.7.0 + * @deprecated 6.4.0 Use WP_Http + * @see WP_Http + */ + #[\AllowDynamicProperties] + class WP_Http_Curl + { + /** + * Send a HTTP request to a URI using cURL extension. + * + * @since 2.7.0 + * + * @param string $url The request URL. + * @param string|array $args Optional. Override the defaults. + * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. A WP_Error instance upon error + */ + public function request($url, $args = array()) + { + } + /** + * Determines whether this class can be used for retrieving a URL. + * + * @since 2.7.0 + * + * @param array $args Optional. Array of request arguments. Default empty array. + * @return bool False means this class can not be used, true means it can. + */ + public static function test($args = array()) + { + } + } + /** + * HTTP API: WP_Http_Encoding class + * + * @package WordPress + * @subpackage HTTP + * @since 4.4.0 + */ + /** + * Core class used to implement deflate and gzip transfer encoding support for HTTP requests. + * + * Includes RFC 1950, RFC 1951, and RFC 1952. + * + * @since 2.8.0 + */ + #[\AllowDynamicProperties] + class WP_Http_Encoding + { + /** + * Compress raw string using the deflate format. + * + * Supports the RFC 1951 standard. + * + * @since 2.8.0 + * + * @param string $raw String to compress. + * @param int $level Optional. Compression level, 9 is highest. Default 9. + * @param string $supports Optional, not used. When implemented it will choose + * the right compression based on what the server supports. + * @return string|false Compressed string on success, false on failure. + */ + public static function compress($raw, $level = 9, $supports = \null) + { + } + /** + * Decompression of deflated string. + * + * Will attempt to decompress using the RFC 1950 standard, and if that fails + * then the RFC 1951 standard deflate will be attempted. Finally, the RFC + * 1952 standard gzip decode will be attempted. If all fail, then the + * original compressed string will be returned. + * + * @since 2.8.0 + * + * @param string $compressed String to decompress. + * @param int $length The optional length of the compressed data. + * @return string|false Decompressed string on success, false on failure. + */ + public static function decompress($compressed, $length = \null) + { + } + /** + * Decompression of deflated string while staying compatible with the majority of servers. + * + * Certain Servers will return deflated data with headers which PHP's gzinflate() + * function cannot handle out of the box. The following function has been created from + * various snippets on the gzinflate() PHP documentation. + * + * Warning: Magic numbers within. Due to the potential different formats that the compressed + * data may be returned in, some "magic offsets" are needed to ensure proper decompression + * takes place. For a simple pragmatic way to determine the magic offset in use, see: + * https://core.trac.wordpress.org/ticket/18273 + * + * @since 2.8.1 + * + * @link https://core.trac.wordpress.org/ticket/18273 + * @link https://www.php.net/manual/en/function.gzinflate.php#70875 + * @link https://www.php.net/manual/en/function.gzinflate.php#77336 + * + * @param string $gz_data String to decompress. + * @return string|false Decompressed string on success, false on failure. + */ + public static function compatible_gzinflate($gz_data) + { + } + /** + * What encoding types to accept and their priority values. + * + * @since 2.8.0 + * + * @param string $url + * @param array $args + * @return string Types of encoding to accept. + */ + public static function accept_encoding($url, $args) + { + } + /** + * What encoding the content used when it was compressed to send in the headers. + * + * @since 2.8.0 + * + * @return string Content-Encoding string to send in the header. + */ + public static function content_encoding() + { + } + /** + * Whether the content be decoded based on the headers. + * + * @since 2.8.0 + * + * @param array|string $headers All of the available headers. + * @return bool + */ + public static function should_decode($headers) + { + } + /** + * Whether decompression and compression are supported by the PHP version. + * + * Each function is tested instead of checking for the zlib extension, to + * ensure that the functions all exist in the PHP version and aren't + * disabled. + * + * @since 2.8.0 + * + * @return bool + */ + public static function is_available() + { + } + } + /** + * WP_HTTP_IXR_Client + * + * @package WordPress + * @since 3.1.0 + */ + #[\AllowDynamicProperties] + class WP_HTTP_IXR_Client extends \IXR_Client + { + public $scheme; + /** + * @var IXR_Error + */ + public $error; + /** + * @param string $server + * @param string|false $path + * @param int|false $port + * @param int $timeout + */ + public function __construct($server, $path = \false, $port = \false, $timeout = 15) + { + } + /** + * @since 3.1.0 + * @since 5.5.0 Formalized the existing `...$args` parameter by adding it + * to the function signature. + * + * @return bool + */ + public function query(...$args) + { + } + } + /** + * HTTP API: WP_HTTP_Proxy class + * + * @package WordPress + * @subpackage HTTP + * @since 4.4.0 + */ + /** + * Core class used to implement HTTP API proxy support. + * + * There are caveats to proxy support. It requires that defines be made in the wp-config.php file to + * enable proxy support. There are also a few filters that plugins can hook into for some of the + * constants. + * + * Please note that only BASIC authentication is supported by most transports. + * cURL MAY support more methods (such as NTLM authentication) depending on your environment. + * + * The constants are as follows: + * <ol> + * <li>WP_PROXY_HOST - Enable proxy support and host for connecting.</li> + * <li>WP_PROXY_PORT - Proxy port for connection. No default, must be defined.</li> + * <li>WP_PROXY_USERNAME - Proxy username, if it requires authentication.</li> + * <li>WP_PROXY_PASSWORD - Proxy password, if it requires authentication.</li> + * <li>WP_PROXY_BYPASS_HOSTS - Will prevent the hosts in this list from going through the proxy. + * You do not need to have localhost and the site host in this list, because they will not be passed + * through the proxy. The list should be presented in a comma separated list, wildcards using * are supported. Example: *.wordpress.org</li> + * </ol> + * + * An example can be as seen below. + * + * define('WP_PROXY_HOST', '192.168.84.101'); + * define('WP_PROXY_PORT', '8080'); + * define('WP_PROXY_BYPASS_HOSTS', 'localhost, www.example.com, *.wordpress.org'); + * + * @link https://core.trac.wordpress.org/ticket/4011 Proxy support ticket in WordPress. + * @link https://core.trac.wordpress.org/ticket/14636 Allow wildcard domains in WP_PROXY_BYPASS_HOSTS + * + * @since 2.8.0 + */ + #[\AllowDynamicProperties] + class WP_HTTP_Proxy + { + /** + * Whether proxy connection should be used. + * + * Constants which control this behavior: + * + * - `WP_PROXY_HOST` + * - `WP_PROXY_PORT` + * + * @since 2.8.0 + * + * @return bool + */ + public function is_enabled() + { + } + /** + * Whether authentication should be used. + * + * Constants which control this behavior: + * + * - `WP_PROXY_USERNAME` + * - `WP_PROXY_PASSWORD` + * + * @since 2.8.0 + * + * @return bool + */ + public function use_authentication() + { + } + /** + * Retrieve the host for the proxy server. + * + * @since 2.8.0 + * + * @return string + */ + public function host() + { + } + /** + * Retrieve the port for the proxy server. + * + * @since 2.8.0 + * + * @return string + */ + public function port() + { + } + /** + * Retrieve the username for proxy authentication. + * + * @since 2.8.0 + * + * @return string + */ + public function username() + { + } + /** + * Retrieve the password for proxy authentication. + * + * @since 2.8.0 + * + * @return string + */ + public function password() + { + } + /** + * Retrieve authentication string for proxy authentication. + * + * @since 2.8.0 + * + * @return string + */ + public function authentication() + { + } + /** + * Retrieve header string for proxy authentication. + * + * @since 2.8.0 + * + * @return string + */ + public function authentication_header() + { + } + /** + * Determines whether the request should be sent through a proxy. + * + * We want to keep localhost and the site URL from being sent through the proxy, because + * some proxies can not handle this. We also have the constant available for defining other + * hosts that won't be sent through the proxy. + * + * @since 2.8.0 + * + * @param string $uri URL of the request. + * @return bool Whether to send the request through the proxy. + */ + public function send_through_proxy($uri) + { + } + } + /** + * HTTP API: Requests hook bridge class + * + * @package WordPress + * @subpackage HTTP + * @since 4.7.0 + */ + /** + * Bridge to connect Requests internal hooks to WordPress actions. + * + * @since 4.7.0 + * + * @see WpOrg\Requests\Hooks + */ + #[\AllowDynamicProperties] + class WP_HTTP_Requests_Hooks extends \WpOrg\Requests\Hooks + { + /** + * Requested URL. + * + * @var string Requested URL. + */ + protected $url; + /** + * WordPress WP_HTTP request data. + * + * @var array Request data in WP_Http format. + */ + protected $request = array(); + /** + * Constructor. + * + * @param string $url URL to request. + * @param array $request Request data in WP_Http format. + */ + public function __construct($url, $request) + { + } + /** + * Dispatch a Requests hook to a native WordPress action. + * + * @param string $hook Hook name. + * @param array $parameters Parameters to pass to callbacks. + * @return bool True if hooks were run, false if nothing was hooked. + */ + public function dispatch($hook, $parameters = array()) + { + } + } + /** + * HTTP API: WP_HTTP_Response class + * + * @package WordPress + * @subpackage HTTP + * @since 4.4.0 + */ + /** + * Core class used to prepare HTTP responses. + * + * @since 4.4.0 + */ + #[\AllowDynamicProperties] + class WP_HTTP_Response + { + /** + * Response data. + * + * @since 4.4.0 + * @var mixed + */ + public $data; + /** + * Response headers. + * + * @since 4.4.0 + * @var array + */ + public $headers; + /** + * Response status. + * + * @since 4.4.0 + * @var int + */ + public $status; + /** + * Constructor. + * + * @since 4.4.0 + * + * @param mixed $data Response data. Default null. + * @param int $status Optional. HTTP status code. Default 200. + * @param array $headers Optional. HTTP header map. Default empty array. + */ + public function __construct($data = \null, $status = 200, $headers = array()) + { + } + /** + * Retrieves headers associated with the response. + * + * @since 4.4.0 + * + * @return array Map of header name to header value. + */ + public function get_headers() + { + } + /** + * Sets all header values. + * + * @since 4.4.0 + * + * @param array $headers Map of header name to header value. + */ + public function set_headers($headers) + { + } + /** + * Sets a single HTTP header. + * + * @since 4.4.0 + * + * @param string $key Header name. + * @param string $value Header value. + * @param bool $replace Optional. Whether to replace an existing header of the same name. + * Default true. + */ + public function header($key, $value, $replace = \true) + { + } + /** + * Retrieves the HTTP return code for the response. + * + * @since 4.4.0 + * + * @return int The 3-digit HTTP status code. + */ + public function get_status() + { + } + /** + * Sets the 3-digit HTTP status code. + * + * @since 4.4.0 + * + * @param int $code HTTP status. + */ + public function set_status($code) + { + } + /** + * Retrieves the response data. + * + * @since 4.4.0 + * + * @return mixed Response data. + */ + public function get_data() + { + } + /** + * Sets the response data. + * + * @since 4.4.0 + * + * @param mixed $data Response data. + */ + public function set_data($data) + { + } + /** + * Retrieves the response data for JSON serialization. + * + * It is expected that in most implementations, this will return the same as get_data(), + * however this may be different if you want to do custom JSON data handling. + * + * @since 4.4.0 + * + * @return mixed Any JSON-serializable value. + */ + public function jsonSerialize() + { + } + } + /** + * HTTP API: WP_HTTP_Requests_Response class + * + * @package WordPress + * @subpackage HTTP + * @since 4.6.0 + */ + /** + * Core wrapper object for a WpOrg\Requests\Response for standardization. + * + * @since 4.6.0 + * + * @see WP_HTTP_Response + */ + class WP_HTTP_Requests_Response extends \WP_HTTP_Response + { + /** + * Requests Response object. + * + * @since 4.6.0 + * @var \WpOrg\Requests\Response + */ + protected $response; + /** + * Filename the response was saved to. + * + * @since 4.6.0 + * @var string|null + */ + protected $filename; + /** + * Constructor. + * + * @since 4.6.0 + * + * @param \WpOrg\Requests\Response $response HTTP response. + * @param string $filename Optional. File name. Default empty. + */ + public function __construct(\WpOrg\Requests\Response $response, $filename = '') + { + } + /** + * Retrieves the response object for the request. + * + * @since 4.6.0 + * + * @return WpOrg\Requests\Response HTTP response. + */ + public function get_response_object() + { + } + /** + * Retrieves headers associated with the response. + * + * @since 4.6.0 + * + * @return \WpOrg\Requests\Utility\CaseInsensitiveDictionary Map of header name to header value. + */ + public function get_headers() + { + } + /** + * Sets all header values. + * + * @since 4.6.0 + * + * @param array $headers Map of header name to header value. + */ + public function set_headers($headers) + { + } + /** + * Sets a single HTTP header. + * + * @since 4.6.0 + * + * @param string $key Header name. + * @param string $value Header value. + * @param bool $replace Optional. Whether to replace an existing header of the same name. + * Default true. + */ + public function header($key, $value, $replace = \true) + { + } + /** + * Retrieves the HTTP return code for the response. + * + * @since 4.6.0 + * + * @return int The 3-digit HTTP status code. + */ + public function get_status() + { + } + /** + * Sets the 3-digit HTTP status code. + * + * @since 4.6.0 + * + * @param int $code HTTP status. + */ + public function set_status($code) + { + } + /** + * Retrieves the response data. + * + * @since 4.6.0 + * + * @return string Response data. + */ + public function get_data() + { + } + /** + * Sets the response data. + * + * @since 4.6.0 + * + * @param string $data Response data. + */ + public function set_data($data) + { + } + /** + * Retrieves cookies from the response. + * + * @since 4.6.0 + * + * @return WP_HTTP_Cookie[] List of cookie objects. + */ + public function get_cookies() + { + } + /** + * Converts the object to a WP_Http response array. + * + * @since 4.6.0 + * + * @return array WP_Http response array, per WP_Http::request(). + */ + public function to_array() + { + } + } + /** + * HTTP API: WP_Http_Streams class + * + * @package WordPress + * @subpackage HTTP + * @since 4.4.0 + */ + /** + * Core class used to integrate PHP Streams as an HTTP transport. + * + * @since 2.7.0 + * @since 3.7.0 Combined with the fsockopen transport and switched to `stream_socket_client()`. + * @deprecated 6.4.0 Use WP_Http + * @see WP_Http + */ + #[\AllowDynamicProperties] + class WP_Http_Streams + { + /** + * Send a HTTP request to a URI using PHP Streams. + * + * @see WP_Http::request() For default options descriptions. + * + * @since 2.7.0 + * @since 3.7.0 Combined with the fsockopen transport and switched to stream_socket_client(). + * + * @param string $url The request URL. + * @param string|array $args Optional. Override the defaults. + * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. A WP_Error instance upon error + */ + public function request($url, $args = array()) + { + } + /** + * Verifies the received SSL certificate against its Common Names and subjectAltName fields. + * + * PHP's SSL verifications only verify that it's a valid Certificate, it doesn't verify if + * the certificate is valid for the hostname which was requested. + * This function verifies the requested hostname against certificate's subjectAltName field, + * if that is empty, or contains no DNS entries, a fallback to the Common Name field is used. + * + * IP Address support is included if the request is being made to an IP address. + * + * @since 3.7.0 + * + * @param resource $stream The PHP Stream which the SSL request is being made over + * @param string $host The hostname being requested + * @return bool If the certificate presented in $stream is valid for $host + */ + public static function verify_ssl_certificate($stream, $host) + { + } + /** + * Determines whether this class can be used for retrieving a URL. + * + * @since 2.7.0 + * @since 3.7.0 Combined with the fsockopen transport and switched to stream_socket_client(). + * + * @param array $args Optional. Array of request arguments. Default empty array. + * @return bool False means this class can not be used, true means it can. + */ + public static function test($args = array()) + { + } + } + /** + * Deprecated HTTP Transport method which used fsockopen. + * + * This class is not used, and is included for backward compatibility only. + * All code should make use of WP_Http directly through its API. + * + * @see WP_HTTP::request + * + * @since 2.7.0 + * @deprecated 3.7.0 Please use WP_HTTP::request() directly + */ + class WP_HTTP_Fsockopen extends \WP_Http_Streams + { + // For backward compatibility for users who are using the class directly. + } + /** + * Core class used for managing HTTP transports and making HTTP requests. + * + * This class is used to consistently make outgoing HTTP requests easy for developers + * while still being compatible with the many PHP configurations under which + * WordPress runs. + * + * Debugging includes several actions, which pass different variables for debugging the HTTP API. + * + * @since 2.7.0 + */ + #[\AllowDynamicProperties] + class WP_Http + { + // Aliases for HTTP response codes. + const HTTP_CONTINUE = 100; + const SWITCHING_PROTOCOLS = 101; + const PROCESSING = 102; + const EARLY_HINTS = 103; + const OK = 200; + const CREATED = 201; + const ACCEPTED = 202; + const NON_AUTHORITATIVE_INFORMATION = 203; + const NO_CONTENT = 204; + const RESET_CONTENT = 205; + const PARTIAL_CONTENT = 206; + const MULTI_STATUS = 207; + const IM_USED = 226; + const MULTIPLE_CHOICES = 300; + const MOVED_PERMANENTLY = 301; + const FOUND = 302; + const SEE_OTHER = 303; + const NOT_MODIFIED = 304; + const USE_PROXY = 305; + const RESERVED = 306; + const TEMPORARY_REDIRECT = 307; + const PERMANENT_REDIRECT = 308; + const BAD_REQUEST = 400; + const UNAUTHORIZED = 401; + const PAYMENT_REQUIRED = 402; + const FORBIDDEN = 403; + const NOT_FOUND = 404; + const METHOD_NOT_ALLOWED = 405; + const NOT_ACCEPTABLE = 406; + const PROXY_AUTHENTICATION_REQUIRED = 407; + const REQUEST_TIMEOUT = 408; + const CONFLICT = 409; + const GONE = 410; + const LENGTH_REQUIRED = 411; + const PRECONDITION_FAILED = 412; + const REQUEST_ENTITY_TOO_LARGE = 413; + const REQUEST_URI_TOO_LONG = 414; + const UNSUPPORTED_MEDIA_TYPE = 415; + const REQUESTED_RANGE_NOT_SATISFIABLE = 416; + const EXPECTATION_FAILED = 417; + const IM_A_TEAPOT = 418; + const MISDIRECTED_REQUEST = 421; + const UNPROCESSABLE_ENTITY = 422; + const LOCKED = 423; + const FAILED_DEPENDENCY = 424; + const TOO_EARLY = 425; + const UPGRADE_REQUIRED = 426; + const PRECONDITION_REQUIRED = 428; + const TOO_MANY_REQUESTS = 429; + const REQUEST_HEADER_FIELDS_TOO_LARGE = 431; + const UNAVAILABLE_FOR_LEGAL_REASONS = 451; + const INTERNAL_SERVER_ERROR = 500; + const NOT_IMPLEMENTED = 501; + const BAD_GATEWAY = 502; + const SERVICE_UNAVAILABLE = 503; + const GATEWAY_TIMEOUT = 504; + const HTTP_VERSION_NOT_SUPPORTED = 505; + const VARIANT_ALSO_NEGOTIATES = 506; + const INSUFFICIENT_STORAGE = 507; + const NOT_EXTENDED = 510; + const NETWORK_AUTHENTICATION_REQUIRED = 511; + /** + * Send an HTTP request to a URI. + * + * Please note: The only URI that are supported in the HTTP Transport implementation + * are the HTTP and HTTPS protocols. + * + * @since 2.7.0 + * + * @param string $url The request URL. + * @param string|array $args { + * Optional. Array or string of HTTP request arguments. + * + * @type string $method Request method. Accepts 'GET', 'POST', 'HEAD', 'PUT', 'DELETE', + * 'TRACE', 'OPTIONS', or 'PATCH'. + * Some transports technically allow others, but should not be + * assumed. Default 'GET'. + * @type float $timeout How long the connection should stay open in seconds. Default 5. + * @type int $redirection Number of allowed redirects. Not supported by all transports. + * Default 5. + * @type string $httpversion Version of the HTTP protocol to use. Accepts '1.0' and '1.1'. + * Default '1.0'. + * @type string $user-agent User-agent value sent. + * Default 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ). + * @type bool $reject_unsafe_urls Whether to pass URLs through wp_http_validate_url(). + * Default false. + * @type bool $blocking Whether the calling code requires the result of the request. + * If set to false, the request will be sent to the remote server, + * and processing returned to the calling code immediately, the caller + * will know if the request succeeded or failed, but will not receive + * any response from the remote server. Default true. + * @type string|array $headers Array or string of headers to send with the request. + * Default empty array. + * @type array $cookies List of cookies to send with the request. Default empty array. + * @type string|array $body Body to send with the request. Default null. + * @type bool $compress Whether to compress the $body when sending the request. + * Default false. + * @type bool $decompress Whether to decompress a compressed response. If set to false and + * compressed content is returned in the response anyway, it will + * need to be separately decompressed. Default true. + * @type bool $sslverify Whether to verify SSL for the request. Default true. + * @type string $sslcertificates Absolute path to an SSL certificate .crt file. + * Default ABSPATH . WPINC . '/certificates/ca-bundle.crt'. + * @type bool $stream Whether to stream to a file. If set to true and no filename was + * given, it will be dropped it in the WP temp dir and its name will + * be set using the basename of the URL. Default false. + * @type string $filename Filename of the file to write to when streaming. $stream must be + * set to true. Default null. + * @type int $limit_response_size Size in bytes to limit the response to. Default null. + * + * } + * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. + * A WP_Error instance upon error. + * @phpstan-param array{ + * method?: string, + * timeout?: float, + * redirection?: int, + * httpversion?: string, + * user-agent?: string, + * reject_unsafe_urls?: bool, + * blocking?: bool, + * headers?: string|array, + * cookies?: array, + * body?: string|array, + * compress?: bool, + * decompress?: bool, + * sslverify?: bool, + * sslcertificates?: string, + * stream?: bool, + * filename?: string, + * limit_response_size?: int, + * } $args + * @phpstan-return array{headers: \WpOrg\Requests\Utility\CaseInsensitiveDictionary, body: string, response: array{code: int,message: string}, cookies: array<int, \WP_Http_Cookie>, filename: string|null, http_response: \WP_HTTP_Requests_Response}|\WP_Error + */ + public function request($url, $args = array()) + { + } + /** + * Normalizes cookies for using in Requests. + * + * @since 4.6.0 + * + * @param array $cookies Array of cookies to send with the request. + * @return WpOrg\Requests\Cookie\Jar Cookie holder object. + */ + public static function normalize_cookies($cookies) + { + } + /** + * Match redirect behavior to browser handling. + * + * Changes 302 redirects from POST to GET to match browser handling. Per + * RFC 7231, user agents can deviate from the strict reading of the + * specification for compatibility purposes. + * + * @since 4.6.0 + * + * @param string $location URL to redirect to. + * @param array $headers Headers for the redirect. + * @param string|array $data Body to send with the request. + * @param array $options Redirect request options. + * @param WpOrg\Requests\Response $original Response object. + */ + public static function browser_redirect_compatibility($location, $headers, $data, &$options, $original) + { + } + /** + * Validate redirected URLs. + * + * @since 4.7.5 + * + * @throws WpOrg\Requests\Exception On unsuccessful URL validation. + * @param string $location URL to redirect to. + */ + public static function validate_redirects($location) + { + } + /** + * Tests which transports are capable of supporting the request. + * + * @since 3.2.0 + * @deprecated 6.4.0 Use WpOrg\Requests\Requests::get_transport_class() + * @see WpOrg\Requests\Requests::get_transport_class() + * + * @param array $args Request arguments. + * @param string $url URL to request. + * @return string|false Class name for the first transport that claims to support the request. + * False if no transport claims to support the request. + */ + public function _get_first_available_transport($args, $url = \null) + { + } + /** + * Uses the POST HTTP method. + * + * Used for sending data that is expected to be in the body. + * + * @since 2.7.0 + * + * @param string $url The request URL. + * @param string|array $args Optional. Override the defaults. + * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. + * A WP_Error instance upon error. See WP_Http::response() for details. + * @phpstan-return array{headers: \WpOrg\Requests\Utility\CaseInsensitiveDictionary, body: string, response: array{code: int,message: string}, cookies: array<int, \WP_Http_Cookie>, filename: string|null, http_response: \WP_HTTP_Requests_Response}|\WP_Error + */ + public function post($url, $args = array()) + { + } + /** + * Uses the GET HTTP method. + * + * Used for sending data that is expected to be in the body. + * + * @since 2.7.0 + * + * @param string $url The request URL. + * @param string|array $args Optional. Override the defaults. + * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. + * A WP_Error instance upon error. See WP_Http::response() for details. + * @phpstan-return array{headers: \WpOrg\Requests\Utility\CaseInsensitiveDictionary, body: string, response: array{code: int,message: string}, cookies: array<int, \WP_Http_Cookie>, filename: string|null, http_response: \WP_HTTP_Requests_Response}|\WP_Error + */ + public function get($url, $args = array()) + { + } + /** + * Uses the HEAD HTTP method. + * + * Used for sending data that is expected to be in the body. + * + * @since 2.7.0 + * + * @param string $url The request URL. + * @param string|array $args Optional. Override the defaults. + * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. + * A WP_Error instance upon error. See WP_Http::response() for details. + * @phpstan-return array{headers: \WpOrg\Requests\Utility\CaseInsensitiveDictionary, body: string, response: array{code: int,message: string}, cookies: array<int, \WP_Http_Cookie>, filename: string|null, http_response: \WP_HTTP_Requests_Response}|\WP_Error + */ + public function head($url, $args = array()) + { + } + /** + * Parses the responses and splits the parts into headers and body. + * + * @since 2.7.0 + * + * @param string $response The full response string. + * @return array { + * Array with response headers and body. + * + * @type string $headers HTTP response headers. + * @type string $body HTTP response body. + * } + * @phpstan-return array{ + * headers: string, + * body: string, + * } + */ + public static function processResponse($response) + { + } + /** + * Transforms header string into an array. + * + * @since 2.7.0 + * + * @param string|array $headers The original headers. If a string is passed, it will be converted + * to an array. If an array is passed, then it is assumed to be + * raw header data with numeric keys with the headers as the values. + * No headers must be passed that were already processed. + * @param string $url Optional. The URL that was requested. Default empty. + * @return array { + * Processed string headers. If duplicate headers are encountered, + * then a numbered array is returned as the value of that header-key. + * + * @type array $response { + * @type int $code The response status code. Default 0. + * @type string $message The response message. Default empty. + * } + * @type array $newheaders The processed header data as a multidimensional array. + * @type WP_Http_Cookie[] $cookies If the original headers contain the 'Set-Cookie' key, + * an array containing `WP_Http_Cookie` objects is returned. + * } + * @phpstan-return array{ + * response: array{ + * code: int, + * message: string, + * }, + * newheaders: array, + * cookies: WP_Http_Cookie[], + * } + */ + public static function processHeaders($headers, $url = '') + { + } + /** + * Takes the arguments for a ::request() and checks for the cookie array. + * + * If it's found, then it upgrades any basic name => value pairs to WP_Http_Cookie instances, + * which are each parsed into strings and added to the Cookie: header (within the arguments array). + * Edits the array by reference. + * + * @since 2.8.0 + * + * @param array $r Full array of args passed into ::request() + */ + public static function buildCookieHeader(&$r) + { + } + /** + * Decodes chunk transfer-encoding, based off the HTTP 1.1 specification. + * + * Based off the HTTP http_encoding_dechunk function. + * + * @link https://tools.ietf.org/html/rfc2616#section-19.4.6 Process for chunked decoding. + * + * @since 2.7.0 + * + * @param string $body Body content. + * @return string Chunked decoded body on success or raw body on failure. + */ + public static function chunkTransferDecode($body) + { + } + /** + * Determines whether an HTTP API request to the given URL should be blocked. + * + * Those who are behind a proxy and want to prevent access to certain hosts may do so. This will + * prevent plugins from working and core functionality, if you don't include `api.wordpress.org`. + * + * You block external URL requests by defining `WP_HTTP_BLOCK_EXTERNAL` as true in your `wp-config.php` + * file and this will only allow localhost and your site to make requests. The constant + * `WP_ACCESSIBLE_HOSTS` will allow additional hosts to go through for requests. The format of the + * `WP_ACCESSIBLE_HOSTS` constant is a comma separated list of hostnames to allow, wildcard domains + * are supported, eg `*.wordpress.org` will allow for all subdomains of `wordpress.org` to be contacted. + * + * @since 2.8.0 + * + * @link https://core.trac.wordpress.org/ticket/8927 Allow preventing external requests. + * @link https://core.trac.wordpress.org/ticket/14636 Allow wildcard domains in WP_ACCESSIBLE_HOSTS + * + * @param string $uri URI of url. + * @return bool True to block, false to allow. + */ + public function block_request($uri) + { + } + /** + * Used as a wrapper for PHP's parse_url() function that handles edgecases in < PHP 5.4.7. + * + * @deprecated 4.4.0 Use wp_parse_url() + * @see wp_parse_url() + * + * @param string $url The URL to parse. + * @return bool|array False on failure; Array of URL components on success; + * See parse_url()'s return values. + */ + protected static function parse_url($url) + { + } + /** + * Converts a relative URL to an absolute URL relative to a given URL. + * + * If an Absolute URL is provided, no processing of that URL is done. + * + * @since 3.4.0 + * + * @param string $maybe_relative_path The URL which might be relative. + * @param string $url The URL which $maybe_relative_path is relative to. + * @return string An Absolute URL, in a failure condition where the URL cannot be parsed, the relative URL will be returned. + */ + public static function make_absolute_url($maybe_relative_path, $url) + { + } + /** + * Handles an HTTP redirect and follows it if appropriate. + * + * @since 3.7.0 + * + * @param string $url The URL which was requested. + * @param array $args The arguments which were used to make the request. + * @param array $response The response of the HTTP request. + * @return array|false|WP_Error An HTTP API response array if the redirect is successfully followed, + * false if no redirect is present, or a WP_Error object if there's an error. + */ + public static function handle_redirects($url, $args, $response) + { + } + /** + * Determines if a specified string represents an IP address or not. + * + * This function also detects the type of the IP address, returning either + * '4' or '6' to represent an IPv4 and IPv6 address respectively. + * This does not verify if the IP is a valid IP, only that it appears to be + * an IP address. + * + * @link http://home.deds.nl/~aeron/regex/ for IPv6 regex. + * + * @since 3.7.0 + * + * @param string $maybe_ip A suspected IP address. + * @return int|false Upon success, '4' or '6' to represent an IPv4 or IPv6 address, false upon failure. + */ + public static function is_ip_address($maybe_ip) + { + } + } + /** + * Base WordPress Image Editor + * + * @package WordPress + * @subpackage Image_Editor + */ + /** + * Base image editor class from which implementations extend + * + * @since 3.5.0 + */ + #[\AllowDynamicProperties] + abstract class WP_Image_Editor + { + protected $file = \null; + protected $size = \null; + protected $mime_type = \null; + protected $output_mime_type = \null; + protected $default_mime_type = 'image/jpeg'; + protected $quality = \false; + // Deprecated since 5.8.1. See get_default_quality() below. + protected $default_quality = 82; + /** + * Each instance handles a single file. + * + * @param string $file Path to the file to load. + */ + public function __construct($file) + { + } + /** + * Checks to see if current environment supports the editor chosen. + * Must be overridden in a subclass. + * + * @since 3.5.0 + * + * @abstract + * + * @param array $args + * @return bool + */ + public static function test($args = array()) + { + } + /** + * Checks to see if editor supports the mime-type specified. + * Must be overridden in a subclass. + * + * @since 3.5.0 + * + * @abstract + * + * @param string $mime_type + * @return bool + */ + public static function supports_mime_type($mime_type) + { + } + /** + * Loads image from $this->file into editor. + * + * @since 3.5.0 + * @abstract + * + * @return true|WP_Error True if loaded; WP_Error on failure. + */ + public abstract function load(); + /** + * Saves current image to file. + * + * @since 3.5.0 + * @since 6.0.0 The `$filesize` value was added to the returned array. + * @abstract + * + * @param string $destfilename Optional. Destination filename. Default null. + * @param string $mime_type Optional. The mime-type. Default null. + * @return array|WP_Error { + * Array on success or WP_Error if the file failed to save. + * + * @type string $path Path to the image file. + * @type string $file Name of the image file. + * @type int $width Image width. + * @type int $height Image height. + * @type string $mime-type The mime type of the image. + * @type int $filesize File size of the image. + * } + * @phpstan-return \WP_Error|array{ + * path: string, + * file: string, + * width: int, + * height: int, + * mime-type: string, + * filesize: int, + * } + */ + public abstract function save($destfilename = \null, $mime_type = \null); + /** + * Resizes current image. + * + * At minimum, either a height or width must be provided. + * If one of the two is set to null, the resize will + * maintain aspect ratio according to the provided dimension. + * + * @since 3.5.0 + * @abstract + * + * @param int|null $max_w Image width. + * @param int|null $max_h Image height. + * @param bool|array $crop { + * Optional. Image cropping behavior. If false, the image will be scaled (default). + * If true, image will be cropped to the specified dimensions using center positions. + * If an array, the image will be cropped using the array to specify the crop location: + * + * @type string $0 The x crop position. Accepts 'left' 'center', or 'right'. + * @type string $1 The y crop position. Accepts 'top', 'center', or 'bottom'. + * } + * @return true|WP_Error + * @phpstan-param bool|array{ + * 0: string, + * 1: string, + * } $crop + */ + public abstract function resize($max_w, $max_h, $crop = \false); + /** + * Resize multiple images from a single source. + * + * @since 3.5.0 + * @abstract + * + * @param array $sizes { + * An array of image size arrays. Default sizes are 'small', 'medium', 'large'. + * + * @type array ...$0 { + * @type int $width Image width. + * @type int $height Image height. + * @type bool|array $crop Optional. Whether to crop the image. Default false. + * } + * } + * @return array An array of resized images metadata by size. + * @phpstan-param array<int|string, array{ + * width: int, + * height: int, + * crop?: bool|array, + * }> $sizes + */ + public abstract function multi_resize($sizes); + /** + * Crops Image. + * + * @since 3.5.0 + * @abstract + * + * @param int $src_x The start x position to crop from. + * @param int $src_y The start y position to crop from. + * @param int $src_w The width to crop. + * @param int $src_h The height to crop. + * @param int $dst_w Optional. The destination width. + * @param int $dst_h Optional. The destination height. + * @param bool $src_abs Optional. If the source crop points are absolute. + * @return true|WP_Error + */ + public abstract function crop($src_x, $src_y, $src_w, $src_h, $dst_w = \null, $dst_h = \null, $src_abs = \false); + /** + * Rotates current image counter-clockwise by $angle. + * + * @since 3.5.0 + * @abstract + * + * @param float $angle + * @return true|WP_Error + */ + public abstract function rotate($angle); + /** + * Flips current image. + * + * @since 3.5.0 + * @abstract + * + * @param bool $horz Flip along Horizontal Axis + * @param bool $vert Flip along Vertical Axis + * @return true|WP_Error + */ + public abstract function flip($horz, $vert); + /** + * Streams current image to browser. + * + * @since 3.5.0 + * @abstract + * + * @param string $mime_type The mime type of the image. + * @return true|WP_Error True on success, WP_Error object on failure. + */ + public abstract function stream($mime_type = \null); + /** + * Gets dimensions of image. + * + * @since 3.5.0 + * + * @return int[] { + * Dimensions of the image. + * + * @type int $width The image width. + * @type int $height The image height. + * } + * @phpstan-return array{ + * width: int, + * height: int, + * } + */ + public function get_size() + { + } + /** + * Sets current image size. + * + * @since 3.5.0 + * + * @param int $width + * @param int $height + * @return true + */ + protected function update_size($width = \null, $height = \null) + { + } + /** + * Gets the Image Compression quality on a 1-100% scale. + * + * @since 4.0.0 + * + * @return int Compression Quality. Range: [1,100] + */ + public function get_quality() + { + } + /** + * Sets Image Compression quality on a 1-100% scale. + * + * @since 3.5.0 + * + * @param int $quality Compression Quality. Range: [1,100] + * @return true|WP_Error True if set successfully; WP_Error on failure. + */ + public function set_quality($quality = \null) + { + } + /** + * Returns the default compression quality setting for the mime type. + * + * @since 5.8.1 + * + * @param string $mime_type + * @return int The default quality setting for the mime type. + */ + protected function get_default_quality($mime_type) + { + } + /** + * Returns preferred mime-type and extension based on provided + * file's extension and mime, or current file's extension and mime. + * + * Will default to $this->default_mime_type if requested is not supported. + * + * Provides corrected filename only if filename is provided. + * + * @since 3.5.0 + * + * @param string $filename + * @param string $mime_type + * @return array { filename|null, extension, mime-type } + */ + protected function get_output_format($filename = \null, $mime_type = \null) + { + } + /** + * Builds an output filename based on current file, and adding proper suffix + * + * @since 3.5.0 + * + * @param string $suffix + * @param string $dest_path + * @param string $extension + * @return string filename + */ + public function generate_filename($suffix = \null, $dest_path = \null, $extension = \null) + { + } + /** + * Builds and returns proper suffix for file based on height and width. + * + * @since 3.5.0 + * + * @return string|false suffix + */ + public function get_suffix() + { + } + /** + * Check if a JPEG image has EXIF Orientation tag and rotate it if needed. + * + * @since 5.3.0 + * + * @return bool|WP_Error True if the image was rotated. False if not rotated (no EXIF data or the image doesn't need to be rotated). + * WP_Error if error while rotating. + */ + public function maybe_exif_rotate() + { + } + /** + * Either calls editor's save function or handles file as a stream. + * + * @since 3.5.0 + * + * @param string $filename + * @param callable $callback + * @param array $arguments + * @return bool + */ + protected function make_image($filename, $callback, $arguments) + { + } + /** + * Returns first matched mime-type from extension, + * as mapped from wp_get_mime_types() + * + * @since 3.5.0 + * + * @param string $extension + * @return string|false + */ + protected static function get_mime_type($extension = \null) + { + } + /** + * Returns first matched extension from Mime-type, + * as mapped from wp_get_mime_types() + * + * @since 3.5.0 + * + * @param string $mime_type + * @return string|false + */ + protected static function get_extension($mime_type = \null) + { + } + } + /** + * WordPress GD Image Editor + * + * @package WordPress + * @subpackage Image_Editor + */ + /** + * WordPress Image Editor Class for Image Manipulation through GD + * + * @since 3.5.0 + * + * @see WP_Image_Editor + */ + class WP_Image_Editor_GD extends \WP_Image_Editor + { + /** + * GD Resource. + * + * @var resource|GdImage + */ + protected $image; + public function __destruct() + { + } + /** + * Checks to see if current environment supports GD. + * + * @since 3.5.0 + * + * @param array $args + * @return bool + */ + public static function test($args = array()) + { + } + /** + * Checks to see if editor supports the mime-type specified. + * + * @since 3.5.0 + * + * @param string $mime_type + * @return bool + */ + public static function supports_mime_type($mime_type) + { + } + /** + * Loads image from $this->file into new GD Resource. + * + * @since 3.5.0 + * + * @return true|WP_Error True if loaded successfully; WP_Error on failure. + */ + public function load() + { + } + /** + * Sets or updates current image size. + * + * @since 3.5.0 + * + * @param int $width + * @param int $height + * @return true + */ + protected function update_size($width = \false, $height = \false) + { + } + /** + * Resizes current image. + * + * Wraps `::_resize()` which returns a GD resource or GdImage instance. + * + * At minimum, either a height or width must be provided. If one of the two is set + * to null, the resize will maintain aspect ratio according to the provided dimension. + * + * @since 3.5.0 + * + * @param int|null $max_w Image width. + * @param int|null $max_h Image height. + * @param bool|array $crop { + * Optional. Image cropping behavior. If false, the image will be scaled (default). + * If true, image will be cropped to the specified dimensions using center positions. + * If an array, the image will be cropped using the array to specify the crop location: + * + * @type string $0 The x crop position. Accepts 'left' 'center', or 'right'. + * @type string $1 The y crop position. Accepts 'top', 'center', or 'bottom'. + * } + * @return true|WP_Error + * @phpstan-param bool|array{ + * 0: string, + * 1: string, + * } $crop + */ + public function resize($max_w, $max_h, $crop = \false) + { + } + /** + * @param int $max_w + * @param int $max_h + * @param bool|array $crop { + * Optional. Image cropping behavior. If false, the image will be scaled (default). + * If true, image will be cropped to the specified dimensions using center positions. + * If an array, the image will be cropped using the array to specify the crop location: + * + * @type string $0 The x crop position. Accepts 'left' 'center', or 'right'. + * @type string $1 The y crop position. Accepts 'top', 'center', or 'bottom'. + * } + * @return resource|GdImage|WP_Error + * @phpstan-param bool|array{ + * 0: string, + * 1: string, + * } $crop + */ + protected function _resize($max_w, $max_h, $crop = \false) + { + } + /** + * Create multiple smaller images from a single source. + * + * Attempts to create all sub-sizes and returns the meta data at the end. This + * may result in the server running out of resources. When it fails there may be few + * "orphaned" images left over as the meta data is never returned and saved. + * + * As of 5.3.0 the preferred way to do this is with `make_subsize()`. It creates + * the new images one at a time and allows for the meta data to be saved after + * each new image is created. + * + * @since 3.5.0 + * + * @param array $sizes { + * An array of image size data arrays. + * + * Either a height or width must be provided. + * If one of the two is set to null, the resize will + * maintain aspect ratio according to the source image. + * + * @type array ...$0 { + * Array of height, width values, and whether to crop. + * + * @type int $width Image width. Optional if `$height` is specified. + * @type int $height Image height. Optional if `$width` is specified. + * @type bool|array $crop Optional. Whether to crop the image. Default false. + * } + * } + * @return array An array of resized images' metadata by size. + * @phpstan-param array<int|string, array{ + * width?: int, + * height?: int, + * crop?: bool|array, + * }> $sizes + */ + public function multi_resize($sizes) + { + } + /** + * Create an image sub-size and return the image meta data value for it. + * + * @since 5.3.0 + * + * @param array $size_data { + * Array of size data. + * + * @type int $width The maximum width in pixels. + * @type int $height The maximum height in pixels. + * @type bool|array $crop Whether to crop the image to exact dimensions. + * } + * @return array|WP_Error The image data array for inclusion in the `sizes` array in the image meta, + * WP_Error object on error. + * @phpstan-param array{ + * width?: int, + * height?: int, + * crop?: bool|array, + * } $size_data + */ + public function make_subsize($size_data) + { + } + /** + * Crops Image. + * + * @since 3.5.0 + * + * @param int $src_x The start x position to crop from. + * @param int $src_y The start y position to crop from. + * @param int $src_w The width to crop. + * @param int $src_h The height to crop. + * @param int $dst_w Optional. The destination width. + * @param int $dst_h Optional. The destination height. + * @param bool $src_abs Optional. If the source crop points are absolute. + * @return true|WP_Error + */ + public function crop($src_x, $src_y, $src_w, $src_h, $dst_w = \null, $dst_h = \null, $src_abs = \false) + { + } + /** + * Rotates current image counter-clockwise by $angle. + * Ported from image-edit.php + * + * @since 3.5.0 + * + * @param float $angle + * @return true|WP_Error + */ + public function rotate($angle) + { + } + /** + * Flips current image. + * + * @since 3.5.0 + * + * @param bool $horz Flip along Horizontal Axis. + * @param bool $vert Flip along Vertical Axis. + * @return true|WP_Error + */ + public function flip($horz, $vert) + { + } + /** + * Saves current in-memory image to file. + * + * @since 3.5.0 + * @since 5.9.0 Renamed `$filename` to `$destfilename` to match parent class + * for PHP 8 named parameter support. + * @since 6.0.0 The `$filesize` value was added to the returned array. + * + * @param string|null $destfilename Optional. Destination filename. Default null. + * @param string|null $mime_type Optional. The mime-type. Default null. + * @return array|WP_Error { + * Array on success or WP_Error if the file failed to save. + * + * @type string $path Path to the image file. + * @type string $file Name of the image file. + * @type int $width Image width. + * @type int $height Image height. + * @type string $mime-type The mime type of the image. + * @type int $filesize File size of the image. + * } + * @phpstan-return \WP_Error|array{ + * path: string, + * file: string, + * width: int, + * height: int, + * mime-type: string, + * filesize: int, + * } + */ + public function save($destfilename = \null, $mime_type = \null) + { + } + /** + * @since 3.5.0 + * @since 6.0.0 The `$filesize` value was added to the returned array. + * + * @param resource|GdImage $image + * @param string|null $filename + * @param string|null $mime_type + * @return array|WP_Error { + * Array on success or WP_Error if the file failed to save. + * + * @type string $path Path to the image file. + * @type string $file Name of the image file. + * @type int $width Image width. + * @type int $height Image height. + * @type string $mime-type The mime type of the image. + * @type int $filesize File size of the image. + * } + * @phpstan-return \WP_Error|array{ + * path: string, + * file: string, + * width: int, + * height: int, + * mime-type: string, + * filesize: int, + * } + */ + protected function _save($image, $filename = \null, $mime_type = \null) + { + } + /** + * Returns stream of current image. + * + * @since 3.5.0 + * + * @param string $mime_type The mime type of the image. + * @return bool True on success, false on failure. + */ + public function stream($mime_type = \null) + { + } + /** + * Either calls editor's save function or handles file as a stream. + * + * @since 3.5.0 + * + * @param string $filename + * @param callable $callback + * @param array $arguments + * @return bool + */ + protected function make_image($filename, $callback, $arguments) + { + } + } + /** + * WordPress Imagick Image Editor + * + * @package WordPress + * @subpackage Image_Editor + */ + /** + * WordPress Image Editor Class for Image Manipulation through Imagick PHP Module + * + * @since 3.5.0 + * + * @see WP_Image_Editor + */ + class WP_Image_Editor_Imagick extends \WP_Image_Editor + { + /** + * Imagick object. + * + * @var Imagick + */ + protected $image; + public function __destruct() + { + } + /** + * Checks to see if current environment supports Imagick. + * + * We require Imagick 2.2.0 or greater, based on whether the queryFormats() + * method can be called statically. + * + * @since 3.5.0 + * + * @param array $args + * @return bool + */ + public static function test($args = array()) + { + } + /** + * Checks to see if editor supports the mime-type specified. + * + * @since 3.5.0 + * + * @param string $mime_type + * @return bool + */ + public static function supports_mime_type($mime_type) + { + } + /** + * Loads image from $this->file into new Imagick Object. + * + * @since 3.5.0 + * + * @return true|WP_Error True if loaded; WP_Error on failure. + */ + public function load() + { + } + /** + * Sets Image Compression quality on a 1-100% scale. + * + * @since 3.5.0 + * + * @param int $quality Compression Quality. Range: [1,100] + * @return true|WP_Error True if set successfully; WP_Error on failure. + */ + public function set_quality($quality = \null) + { + } + /** + * Sets or updates current image size. + * + * @since 3.5.0 + * + * @param int $width + * @param int $height + * @return true|WP_Error + */ + protected function update_size($width = \null, $height = \null) + { + } + /** + * Sets Imagick time limit. + * + * Depending on configuration, Imagick processing may take time. + * + * Multiple problems exist if PHP times out before ImageMagick completed: + * 1. Temporary files aren't cleaned by ImageMagick garbage collection. + * 2. No clear error is provided. + * 3. The cause of such timeout can be hard to pinpoint. + * + * This function, which is expected to be run before heavy image routines, resolves + * point 1 above by aligning Imagick's timeout with PHP's timeout, assuming it is set. + * + * However seems it introduces more problems than it fixes, + * see https://core.trac.wordpress.org/ticket/58202. + * + * Note: + * - Imagick resource exhaustion does not issue catchable exceptions (yet). + * See https://github.com/Imagick/imagick/issues/333. + * - The resource limit is not saved/restored. It applies to subsequent + * image operations within the time of the HTTP request. + * + * @since 6.2.0 + * @since 6.3.0 This method was deprecated. + * + * @return int|null The new limit on success, null on failure. + */ + public static function set_imagick_time_limit() + { + } + /** + * Resizes current image. + * + * At minimum, either a height or width must be provided. + * If one of the two is set to null, the resize will + * maintain aspect ratio according to the provided dimension. + * + * @since 3.5.0 + * + * @param int|null $max_w Image width. + * @param int|null $max_h Image height. + * @param bool|array $crop { + * Optional. Image cropping behavior. If false, the image will be scaled (default). + * If true, image will be cropped to the specified dimensions using center positions. + * If an array, the image will be cropped using the array to specify the crop location: + * + * @type string $0 The x crop position. Accepts 'left' 'center', or 'right'. + * @type string $1 The y crop position. Accepts 'top', 'center', or 'bottom'. + * } + * @return true|WP_Error + * @phpstan-param bool|array{ + * 0: string, + * 1: string, + * } $crop + */ + public function resize($max_w, $max_h, $crop = \false) + { + } + /** + * Efficiently resize the current image + * + * This is a WordPress specific implementation of Imagick::thumbnailImage(), + * which resizes an image to given dimensions and removes any associated profiles. + * + * @since 4.5.0 + * + * @param int $dst_w The destination width. + * @param int $dst_h The destination height. + * @param string $filter_name Optional. The Imagick filter to use when resizing. Default 'FILTER_TRIANGLE'. + * @param bool $strip_meta Optional. Strip all profiles, excluding color profiles, from the image. Default true. + * @return void|WP_Error + */ + protected function thumbnail_image($dst_w, $dst_h, $filter_name = 'FILTER_TRIANGLE', $strip_meta = \true) + { + } + /** + * Create multiple smaller images from a single source. + * + * Attempts to create all sub-sizes and returns the meta data at the end. This + * may result in the server running out of resources. When it fails there may be few + * "orphaned" images left over as the meta data is never returned and saved. + * + * As of 5.3.0 the preferred way to do this is with `make_subsize()`. It creates + * the new images one at a time and allows for the meta data to be saved after + * each new image is created. + * + * @since 3.5.0 + * + * @param array $sizes { + * An array of image size data arrays. + * + * Either a height or width must be provided. + * If one of the two is set to null, the resize will + * maintain aspect ratio according to the provided dimension. + * + * @type array ...$0 { + * Array of height, width values, and whether to crop. + * + * @type int $width Image width. Optional if `$height` is specified. + * @type int $height Image height. Optional if `$width` is specified. + * @type bool|array $crop Optional. Whether to crop the image. Default false. + * } + * } + * @return array An array of resized images' metadata by size. + * @phpstan-param array<int|string, array{ + * width?: int, + * height?: int, + * crop?: bool|array, + * }> $sizes + */ + public function multi_resize($sizes) + { + } + /** + * Create an image sub-size and return the image meta data value for it. + * + * @since 5.3.0 + * + * @param array $size_data { + * Array of size data. + * + * @type int $width The maximum width in pixels. + * @type int $height The maximum height in pixels. + * @type bool|array $crop Whether to crop the image to exact dimensions. + * } + * @return array|WP_Error The image data array for inclusion in the `sizes` array in the image meta, + * WP_Error object on error. + * @phpstan-param array{ + * width?: int, + * height?: int, + * crop?: bool|array, + * } $size_data + */ + public function make_subsize($size_data) + { + } + /** + * Crops Image. + * + * @since 3.5.0 + * + * @param int $src_x The start x position to crop from. + * @param int $src_y The start y position to crop from. + * @param int $src_w The width to crop. + * @param int $src_h The height to crop. + * @param int $dst_w Optional. The destination width. + * @param int $dst_h Optional. The destination height. + * @param bool $src_abs Optional. If the source crop points are absolute. + * @return true|WP_Error + */ + public function crop($src_x, $src_y, $src_w, $src_h, $dst_w = \null, $dst_h = \null, $src_abs = \false) + { + } + /** + * Rotates current image counter-clockwise by $angle. + * + * @since 3.5.0 + * + * @param float $angle + * @return true|WP_Error + */ + public function rotate($angle) + { + } + /** + * Flips current image. + * + * @since 3.5.0 + * + * @param bool $horz Flip along Horizontal Axis + * @param bool $vert Flip along Vertical Axis + * @return true|WP_Error + */ + public function flip($horz, $vert) + { + } + /** + * Check if a JPEG image has EXIF Orientation tag and rotate it if needed. + * + * As ImageMagick copies the EXIF data to the flipped/rotated image, proceed only + * if EXIF Orientation can be reset afterwards. + * + * @since 5.3.0 + * + * @return bool|WP_Error True if the image was rotated. False if no EXIF data or if the image doesn't need rotation. + * WP_Error if error while rotating. + */ + public function maybe_exif_rotate() + { + } + /** + * Saves current image to file. + * + * @since 3.5.0 + * @since 6.0.0 The `$filesize` value was added to the returned array. + * + * @param string $destfilename Optional. Destination filename. Default null. + * @param string $mime_type Optional. The mime-type. Default null. + * @return array|WP_Error { + * Array on success or WP_Error if the file failed to save. + * + * @type string $path Path to the image file. + * @type string $file Name of the image file. + * @type int $width Image width. + * @type int $height Image height. + * @type string $mime-type The mime type of the image. + * @type int $filesize File size of the image. + * } + * @phpstan-return \WP_Error|array{ + * path: string, + * file: string, + * width: int, + * height: int, + * mime-type: string, + * filesize: int, + * } + */ + public function save($destfilename = \null, $mime_type = \null) + { + } + /** + * Removes PDF alpha after it's been read. + * + * @since 6.4.0 + */ + protected function remove_pdf_alpha_channel() + { + } + /** + * @since 3.5.0 + * @since 6.0.0 The `$filesize` value was added to the returned array. + * + * @param Imagick $image + * @param string $filename + * @param string $mime_type + * @return array|WP_Error { + * Array on success or WP_Error if the file failed to save. + * + * @type string $path Path to the image file. + * @type string $file Name of the image file. + * @type int $width Image width. + * @type int $height Image height. + * @type string $mime-type The mime type of the image. + * @type int $filesize File size of the image. + * } + * @phpstan-return \WP_Error|array{ + * path: string, + * file: string, + * width: int, + * height: int, + * mime-type: string, + * filesize: int, + * } + */ + protected function _save($image, $filename = \null, $mime_type = \null) + { + } + /** + * Streams current image to browser. + * + * @since 3.5.0 + * + * @param string $mime_type The mime type of the image. + * @return true|WP_Error True on success, WP_Error object on failure. + */ + public function stream($mime_type = \null) + { + } + /** + * Strips all image meta except color profiles from an image. + * + * @since 4.5.0 + * + * @return true|WP_Error True if stripping metadata was successful. WP_Error object on error. + */ + protected function strip_meta() + { + } + /** + * Sets up Imagick for PDF processing. + * Increases rendering DPI and only loads first page. + * + * @since 4.7.0 + * + * @return string|WP_Error File to load or WP_Error on failure. + */ + protected function pdf_setup() + { + } + /** + * Load the image produced by Ghostscript. + * + * Includes a workaround for a bug in Ghostscript 8.70 that prevents processing of some PDF files + * when `use-cropbox` is set. + * + * @since 5.6.0 + * + * @return true|WP_Error + */ + protected function pdf_load_source() + { + } + } + /** + * WordPress List utility class + * + * @package WordPress + * @since 4.7.0 + */ + /** + * List utility. + * + * Utility class to handle operations on an array of objects or arrays. + * + * @since 4.7.0 + */ + #[\AllowDynamicProperties] + class WP_List_Util + { + /** + * Constructor. + * + * Sets the input array. + * + * @since 4.7.0 + * + * @param array $input Array to perform operations on. + */ + public function __construct($input) + { + } + /** + * Returns the original input array. + * + * @since 4.7.0 + * + * @return array The input array. + */ + public function get_input() + { + } + /** + * Returns the output array. + * + * @since 4.7.0 + * + * @return array The output array. + */ + public function get_output() + { + } + /** + * Filters the list, based on a set of key => value arguments. + * + * Retrieves the objects from the list that match the given arguments. + * Key represents property name, and value represents property value. + * + * If an object has more properties than those specified in arguments, + * that will not disqualify it. When using the 'AND' operator, + * any missing properties will disqualify it. + * + * @since 4.7.0 + * + * @param array $args Optional. An array of key => value arguments to match + * against each object. Default empty array. + * @param string $operator Optional. The logical operation to perform. 'AND' means + * all elements from the array must match. 'OR' means only + * one element needs to match. 'NOT' means no elements may + * match. Default 'AND'. + * @return array Array of found values. + */ + public function filter($args = array(), $operator = 'AND') + { + } + /** + * Plucks a certain field out of each element in the input array. + * + * This has the same functionality and prototype of + * array_column() (PHP 5.5) but also supports objects. + * + * @since 4.7.0 + * + * @param int|string $field Field to fetch from the object or array. + * @param int|string $index_key Optional. Field from the element to use as keys for the new array. + * Default null. + * @return array Array of found values. If `$index_key` is set, an array of found values with keys + * corresponding to `$index_key`. If `$index_key` is null, array keys from the original + * `$list` will be preserved in the results. + */ + public function pluck($field, $index_key = \null) + { + } + /** + * Sorts the input array based on one or more orderby arguments. + * + * @since 4.7.0 + * + * @param string|array $orderby Optional. Either the field name to order by or an array + * of multiple orderby fields as `$orderby => $order`. + * Default empty array. + * @param string $order Optional. Either 'ASC' or 'DESC'. Only used if `$orderby` + * is a string. Default 'ASC'. + * @param bool $preserve_keys Optional. Whether to preserve keys. Default false. + * @return array The sorted array. + * @phpstan-param 'ASC'|'DESC' $order + */ + public function sort($orderby = array(), $order = 'ASC', $preserve_keys = \false) + { + } + } + /** + * Locale API: WP_Locale_Switcher class + * + * @package WordPress + * @subpackage i18n + * @since 4.7.0 + */ + /** + * Core class used for switching locales. + * + * @since 4.7.0 + */ + #[\AllowDynamicProperties] + class WP_Locale_Switcher + { + /** + * Constructor. + * + * Stores the original locale as well as a list of all available languages. + * + * @since 4.7.0 + */ + public function __construct() + { + } + /** + * Initializes the locale switcher. + * + * Hooks into the {@see 'locale'} and {@see 'determine_locale'} filters + * to change the locale on the fly. + * + * @since 4.7.0 + */ + public function init() + { + } + /** + * Switches the translations according to the given locale. + * + * @since 4.7.0 + * + * @param string $locale The locale to switch to. + * @param int|false $user_id Optional. User ID as context. Default false. + * @return bool True on success, false on failure. + */ + public function switch_to_locale($locale, $user_id = \false) + { + } + /** + * Switches the translations according to the given user's locale. + * + * @since 6.2.0 + * + * @param int $user_id User ID. + * @return bool True on success, false on failure. + */ + public function switch_to_user_locale($user_id) + { + } + /** + * Restores the translations according to the previous locale. + * + * @since 4.7.0 + * + * @return string|false Locale on success, false on failure. + */ + public function restore_previous_locale() + { + } + /** + * Restores the translations according to the original locale. + * + * @since 4.7.0 + * + * @return string|false Locale on success, false on failure. + */ + public function restore_current_locale() + { + } + /** + * Whether switch_to_locale() is in effect. + * + * @since 4.7.0 + * + * @return bool True if the locale has been switched, false otherwise. + */ + public function is_switched() + { + } + /** + * Returns the locale currently switched to. + * + * @since 6.2.0 + * + * @return string|false Locale if the locale has been switched, false otherwise. + */ + public function get_switched_locale() + { + } + /** + * Returns the user ID related to the currently switched locale. + * + * @since 6.2.0 + * + * @return int|false User ID if set and if the locale has been switched, false otherwise. + */ + public function get_switched_user_id() + { + } + /** + * Filters the locale of the WordPress installation. + * + * @since 4.7.0 + * + * @param string $locale The locale of the WordPress installation. + * @return string The locale currently being switched to. + */ + public function filter_locale($locale) + { + } + } + /** + * Locale API: WP_Locale class + * + * @package WordPress + * @subpackage i18n + * @since 4.6.0 + */ + /** + * Core class used to store translated data for a locale. + * + * @since 2.1.0 + * @since 4.6.0 Moved to its own file from wp-includes/locale.php. + */ + #[\AllowDynamicProperties] + class WP_Locale + { + /** + * Stores the translated strings for the full weekday names. + * + * @since 2.1.0 + * @since 6.2.0 Initialized to an empty array. + * @var string[] + */ + public $weekday = array(); + /** + * Stores the translated strings for the one character weekday names. + * + * There is a hack to make sure that Tuesday and Thursday, as well + * as Sunday and Saturday, don't conflict. See init() method for more. + * + * @see WP_Locale::init() for how to handle the hack. + * + * @since 2.1.0 + * @since 6.2.0 Initialized to an empty array. + * @var string[] + */ + public $weekday_initial = array(); + /** + * Stores the translated strings for the abbreviated weekday names. + * + * @since 2.1.0 + * @since 6.2.0 Initialized to an empty array. + * @var string[] + */ + public $weekday_abbrev = array(); + /** + * Stores the translated strings for the full month names. + * + * @since 2.1.0 + * @since 6.2.0 Initialized to an empty array. + * @var string[] + */ + public $month = array(); + /** + * Stores the translated strings for the month names in genitive case, if the locale specifies. + * + * @since 4.4.0 + * @since 6.2.0 Initialized to an empty array. + * @var string[] + */ + public $month_genitive = array(); + /** + * Stores the translated strings for the abbreviated month names. + * + * @since 2.1.0 + * @since 6.2.0 Initialized to an empty array. + * @var string[] + */ + public $month_abbrev = array(); + /** + * Stores the translated strings for 'am' and 'pm'. + * + * Also the capitalized versions. + * + * @since 2.1.0 + * @since 6.2.0 Initialized to an empty array. + * @var string[] + */ + public $meridiem = array(); + /** + * The text direction of the locale language. + * + * Default is left to right 'ltr'. + * + * @since 2.1.0 + * @var string + */ + public $text_direction = 'ltr'; + /** + * The thousands separator and decimal point values used for localizing numbers. + * + * @since 2.3.0 + * @since 6.2.0 Initialized to an empty array. + * @var array + */ + public $number_format = array(); + /** + * The separator string used for localizing list item separator. + * + * @since 6.0.0 + * @var string + */ + public $list_item_separator; + /** + * The word count type of the locale language. + * + * Default is 'words'. + * + * @since 6.2.0 + * @var string + */ + public $word_count_type; + /** + * Constructor which calls helper methods to set up object variables. + * + * @since 2.1.0 + */ + public function __construct() + { + } + /** + * Sets up the translated strings and object properties. + * + * The method creates the translatable strings for various + * calendar elements. Which allows for specifying locale + * specific calendar names and text direction. + * + * @since 2.1.0 + * + * @global string $text_direction + */ + public function init() + { + } + /** + * Retrieves the full translated weekday word. + * + * Week starts on translated Sunday and can be fetched + * by using 0 (zero). So the week starts with 0 (zero) + * and ends on Saturday with is fetched by using 6 (six). + * + * @since 2.1.0 + * + * @param int $weekday_number 0 for Sunday through 6 Saturday. + * @return string Full translated weekday. + */ + public function get_weekday($weekday_number) + { + } + /** + * Retrieves the translated weekday initial. + * + * The weekday initial is retrieved by the translated + * full weekday word. When translating the weekday initial + * pay attention to make sure that the starting letter does + * not conflict. + * + * @since 2.1.0 + * + * @param string $weekday_name Full translated weekday word. + * @return string Translated weekday initial. + */ + public function get_weekday_initial($weekday_name) + { + } + /** + * Retrieves the translated weekday abbreviation. + * + * The weekday abbreviation is retrieved by the translated + * full weekday word. + * + * @since 2.1.0 + * + * @param string $weekday_name Full translated weekday word. + * @return string Translated weekday abbreviation. + */ + public function get_weekday_abbrev($weekday_name) + { + } + /** + * Retrieves the full translated month by month number. + * + * The $month_number parameter has to be a string + * because it must have the '0' in front of any number + * that is less than 10. Starts from '01' and ends at + * '12'. + * + * You can use an integer instead and it will add the + * '0' before the numbers less than 10 for you. + * + * @since 2.1.0 + * + * @param string|int $month_number '01' through '12'. + * @return string Translated full month name. + */ + public function get_month($month_number) + { + } + /** + * Retrieves translated version of month abbreviation string. + * + * The $month_name parameter is expected to be the translated or + * translatable version of the month. + * + * @since 2.1.0 + * + * @param string $month_name Translated month to get abbreviated version. + * @return string Translated abbreviated month. + */ + public function get_month_abbrev($month_name) + { + } + /** + * Retrieves translated version of meridiem string. + * + * The $meridiem parameter is expected to not be translated. + * + * @since 2.1.0 + * + * @param string $meridiem Either 'am', 'pm', 'AM', or 'PM'. Not translated version. + * @return string Translated version + * @phpstan-param 'am'|'pm'|'AM'|'PM' $meridiem + */ + public function get_meridiem($meridiem) + { + } + /** + * Global variables are deprecated. + * + * For backward compatibility only. + * + * @since 2.1.0 + * @deprecated For backward compatibility only. + * + * @global array $weekday + * @global array $weekday_initial + * @global array $weekday_abbrev + * @global array $month + * @global array $month_abbrev + */ + public function register_globals() + { + } + /** + * Checks if current locale is RTL. + * + * @since 3.0.0 + * @return bool Whether locale is RTL. + */ + public function is_rtl() + { + } + /** + * Registers date/time format strings for general POT. + * + * Private, unused method to add some date/time formats translated + * on wp-admin/options-general.php to the general POT that would + * otherwise be added to the admin POT. + * + * @since 3.6.0 + */ + public function _strings_for_pot() + { + } + /** + * Retrieves the localized list item separator. + * + * @since 6.0.0 + * + * @return string Localized list item separator. + */ + public function get_list_item_separator() + { + } + /** + * Retrieves the localized word count type. + * + * @since 6.2.0 + * + * @return string Localized word count type. Possible values are `characters_excluding_spaces`, + * `characters_including_spaces`, or `words`. Defaults to `words`. + */ + public function get_word_count_type() + { + } + } + /** + * WP_MatchesMapRegex helper class + * + * @package WordPress + * @since 4.7.0 + */ + /** + * Helper class to remove the need to use eval to replace $matches[] in query strings. + * + * @since 2.9.0 + */ + #[\AllowDynamicProperties] + class WP_MatchesMapRegex + { + /** + * store for mapping result + * + * @var string + */ + public $output; + /** + * regexp pattern to match $matches[] references + * + * @var string + */ + public $_pattern = '(\\$matches\\[[1-9]+[0-9]*\\])'; + // Magic number. + /** + * constructor + * + * @param string $subject subject if regex + * @param array $matches data to use in map + */ + public function __construct($subject, $matches) + { + } + /** + * Substitute substring matches in subject. + * + * static helper function to ease use + * + * @param string $subject subject + * @param array $matches data used for substitution + * @return string + */ + public static function apply($subject, $matches) + { + } + /** + * preg_replace_callback hook + * + * @param array $matches preg_replace regexp matches + * @return string + */ + public function callback($matches) + { + } + } + /** + * Meta API: WP_Meta_Query class + * + * @package WordPress + * @subpackage Meta + * @since 4.4.0 + */ + /** + * Core class used to implement meta queries for the Meta API. + * + * Used for generating SQL clauses that filter a primary query according to metadata keys and values. + * + * WP_Meta_Query is a helper that allows primary query classes, such as WP_Query and WP_User_Query, + * + * to filter their results by object metadata, by generating `JOIN` and `WHERE` subclauses to be attached + * to the primary SQL query string. + * + * @since 3.2.0 + */ + #[\AllowDynamicProperties] + class WP_Meta_Query + { + /** + * Array of metadata queries. + * + * See WP_Meta_Query::__construct() for information on meta query arguments. + * + * @since 3.2.0 + * @var array + */ + public $queries = array(); + /** + * The relation between the queries. Can be one of 'AND' or 'OR'. + * + * @since 3.2.0 + * @var string + */ + public $relation; + /** + * Database table to query for the metadata. + * + * @since 4.1.0 + * @var string + */ + public $meta_table; + /** + * Column in meta_table that represents the ID of the object the metadata belongs to. + * + * @since 4.1.0 + * @var string + */ + public $meta_id_column; + /** + * Database table that where the metadata's objects are stored (eg $wpdb->users). + * + * @since 4.1.0 + * @var string + */ + public $primary_table; + /** + * Column in primary_table that represents the ID of the object. + * + * @since 4.1.0 + * @var string + */ + public $primary_id_column; + /** + * A flat list of table aliases used in JOIN clauses. + * + * @since 4.1.0 + * @var array + */ + protected $table_aliases = array(); + /** + * A flat list of clauses, keyed by clause 'name'. + * + * @since 4.2.0 + * @var array + */ + protected $clauses = array(); + /** + * Whether the query contains any OR relations. + * + * @since 4.3.0 + * @var bool + */ + protected $has_or_relation = \false; + /** + * Constructor. + * + * @since 3.2.0 + * @since 4.2.0 Introduced support for naming query clauses by associative array keys. + * @since 5.1.0 Introduced `$compare_key` clause parameter, which enables LIKE key matches. + * @since 5.3.0 Increased the number of operators available to `$compare_key`. Introduced `$type_key`, + * which enables the `$key` to be cast to a new data type for comparisons. + * + * @param array $meta_query { + * Array of meta query clauses. When first-order clauses or sub-clauses use strings as + * their array keys, they may be referenced in the 'orderby' parameter of the parent query. + * + * @type string $relation Optional. The MySQL keyword used to join the clauses of the query. + * Accepts 'AND' or 'OR'. Default 'AND'. + * @type array ...$0 { + * Optional. An array of first-order clause parameters, or another fully-formed meta query. + * + * @type string|string[] $key Meta key or keys to filter by. + * @type string $compare_key MySQL operator used for comparing the $key. Accepts: + * - '=' + * - '!=' + * - 'LIKE' + * - 'NOT LIKE' + * - 'IN' + * - 'NOT IN' + * - 'REGEXP' + * - 'NOT REGEXP' + * - 'RLIKE' + * - 'EXISTS' (alias of '=') + * - 'NOT EXISTS' (alias of '!=') + * Default is 'IN' when `$key` is an array, '=' otherwise. + * @type string $type_key MySQL data type that the meta_key column will be CAST to for + * comparisons. Accepts 'BINARY' for case-sensitive regular expression + * comparisons. Default is ''. + * @type string|string[] $value Meta value or values to filter by. + * @type string $compare MySQL operator used for comparing the $value. Accepts: + * - '=' + * - '!=' + * - '>' + * - '>=' + * - '<' + * - '<=' + * - 'LIKE' + * - 'NOT LIKE' + * - 'IN' + * - 'NOT IN' + * - 'BETWEEN' + * - 'NOT BETWEEN' + * - 'REGEXP' + * - 'NOT REGEXP' + * - 'RLIKE' + * - 'EXISTS' + * - 'NOT EXISTS' + * Default is 'IN' when `$value` is an array, '=' otherwise. + * @type string $type MySQL data type that the meta_value column will be CAST to for + * comparisons. Accepts: + * - 'NUMERIC' + * - 'BINARY' + * - 'CHAR' + * - 'DATE' + * - 'DATETIME' + * - 'DECIMAL' + * - 'SIGNED' + * - 'TIME' + * - 'UNSIGNED' + * Default is 'CHAR'. + * } + * } + * @phpstan-return void + */ + public function __construct($meta_query = \false) + { + } + /** + * Ensures the 'meta_query' argument passed to the class constructor is well-formed. + * + * Eliminates empty items and ensures that a 'relation' is set. + * + * @since 4.1.0 + * + * @param array $queries Array of query clauses. + * @return array Sanitized array of query clauses. + */ + public function sanitize_query($queries) + { + } + /** + * Determines whether a query clause is first-order. + * + * A first-order meta query clause is one that has either a 'key' or + * a 'value' array key. + * + * @since 4.1.0 + * + * @param array $query Meta query arguments. + * @return bool Whether the query clause is a first-order clause. + */ + protected function is_first_order_clause($query) + { + } + /** + * Constructs a meta query based on 'meta_*' query vars + * + * @since 3.2.0 + * + * @param array $qv The query variables. + */ + public function parse_query_vars($qv) + { + } + /** + * Returns the appropriate alias for the given meta type if applicable. + * + * @since 3.7.0 + * + * @param string $type MySQL type to cast meta_value. + * @return string MySQL type. + */ + public function get_cast_for_type($type = '') + { + } + /** + * Generates SQL clauses to be appended to a main query. + * + * @since 3.2.0 + * + * @param string $type Type of meta. Possible values include but are not limited + * to 'post', 'comment', 'blog', 'term', and 'user'. + * @param string $primary_table Database table where the object being filtered is stored (eg wp_users). + * @param string $primary_id_column ID column for the filtered object in $primary_table. + * @param object $context Optional. The main query object that corresponds to the type, for + * example a `WP_Query`, `WP_User_Query`, or `WP_Site_Query`. + * Default null. + * @return string[]|false { + * Array containing JOIN and WHERE SQL clauses to append to the main query, + * or false if no table exists for the requested meta type. + * + * @type string $join SQL fragment to append to the main JOIN clause. + * @type string $where SQL fragment to append to the main WHERE clause. + * } + * @phpstan-return false|array{ + * join: string, + * where: string, + * } + */ + public function get_sql($type, $primary_table, $primary_id_column, $context = \null) + { + } + /** + * Generates SQL clauses to be appended to a main query. + * + * Called by the public WP_Meta_Query::get_sql(), this method is abstracted + * out to maintain parity with the other Query classes. + * + * @since 4.1.0 + * + * @return string[] { + * Array containing JOIN and WHERE SQL clauses to append to the main query. + * + * @type string $join SQL fragment to append to the main JOIN clause. + * @type string $where SQL fragment to append to the main WHERE clause. + * } + * @phpstan-return array{ + * join: string, + * where: string, + * } + */ + protected function get_sql_clauses() + { + } + /** + * Generates SQL clauses for a single query array. + * + * If nested subqueries are found, this method recurses the tree to + * produce the properly nested SQL. + * + * @since 4.1.0 + * + * @param array $query Query to parse (passed by reference). + * @param int $depth Optional. Number of tree levels deep we currently are. + * Used to calculate indentation. Default 0. + * @return string[] { + * Array containing JOIN and WHERE SQL clauses to append to a single query array. + * + * @type string $join SQL fragment to append to the main JOIN clause. + * @type string $where SQL fragment to append to the main WHERE clause. + * } + * @phpstan-return array{ + * join: string, + * where: string, + * } + */ + protected function get_sql_for_query(&$query, $depth = 0) + { + } + /** + * Generates SQL JOIN and WHERE clauses for a first-order query clause. + * + * "First-order" means that it's an array with a 'key' or 'value'. + * + * @since 4.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array $clause Query clause (passed by reference). + * @param array $parent_query Parent query array. + * @param string $clause_key Optional. The array key used to name the clause in the original `$meta_query` + * parameters. If not provided, a key will be generated automatically. + * Default empty string. + * @return array { + * Array containing JOIN and WHERE SQL clauses to append to a first-order query. + * + * @type string[] $join Array of SQL fragments to append to the main JOIN clause. + * @type string[] $where Array of SQL fragments to append to the main WHERE clause. + * } + * @phpstan-return array{ + * join: string[], + * where: string[], + * } + */ + public function get_sql_for_clause(&$clause, $parent_query, $clause_key = '') + { + } + /** + * Gets a flattened list of sanitized meta clauses. + * + * This array should be used for clause lookup, as when the table alias and CAST type must be determined for + * a value of 'orderby' corresponding to a meta clause. + * + * @since 4.2.0 + * + * @return array Meta clauses. + */ + public function get_clauses() + { + } + /** + * Identifies an existing table alias that is compatible with the current + * query clause. + * + * We avoid unnecessary table joins by allowing each clause to look for + * an existing table alias that is compatible with the query that it + * needs to perform. + * + * An existing alias is compatible if (a) it is a sibling of `$clause` + * (ie, it's under the scope of the same relation), and (b) the combination + * of operator and relation between the clauses allows for a shared table join. + * In the case of WP_Meta_Query, this only applies to 'IN' clauses that are + * connected by the relation 'OR'. + * + * @since 4.1.0 + * + * @param array $clause Query clause. + * @param array $parent_query Parent query of $clause. + * @return string|false Table alias if found, otherwise false. + */ + protected function find_compatible_table_alias($clause, $parent_query) + { + } + /** + * Checks whether the current query has any OR relations. + * + * In some cases, the presence of an OR relation somewhere in the query will require + * the use of a `DISTINCT` or `GROUP BY` keyword in the `SELECT` clause. The current + * method can be used in these cases to determine whether such a clause is necessary. + * + * @since 4.3.0 + * + * @return bool True if the query contains any `OR` relations, otherwise false. + */ + public function has_or_relation() + { + } + } + /** + * Meta API: WP_Metadata_Lazyloader class + * + * @package WordPress + * @subpackage Meta + * @since 4.5.0 + */ + /** + * Core class used for lazy-loading object metadata. + * + * When loading many objects of a given type, such as posts in a WP_Query loop, it often makes + * sense to prime various metadata caches at the beginning of the loop. This means fetching all + * relevant metadata with a single database query, a technique that has the potential to improve + * performance dramatically in some cases. + * + * In cases where the given metadata may not even be used in the loop, we can improve performance + * even more by only priming the metadata cache for affected items the first time a piece of metadata + * is requested - ie, by lazy-loading it. So, for example, comment meta may not be loaded into the + * cache in the comments section of a post until the first time get_comment_meta() is called in the + * context of the comment loop. + * + * WP uses the WP_Metadata_Lazyloader class to queue objects for metadata cache priming. The class + * then detects the relevant get_*_meta() function call, and queries the metadata of all queued objects. + * + * Do not access this class directly. Use the wp_metadata_lazyloader() function. + * + * @since 4.5.0 + */ + #[\AllowDynamicProperties] + class WP_Metadata_Lazyloader + { + /** + * Pending objects queue. + * + * @since 4.5.0 + * @var array + */ + protected $pending_objects; + /** + * Settings for supported object types. + * + * @since 4.5.0 + * @var array + */ + protected $settings = array(); + /** + * Constructor. + * + * @since 4.5.0 + */ + public function __construct() + { + } + /** + * Adds objects to the metadata lazy-load queue. + * + * @since 4.5.0 + * + * @param string $object_type Type of object whose meta is to be lazy-loaded. Accepts 'term' or 'comment'. + * @param array $object_ids Array of object IDs. + * @return void|WP_Error WP_Error on failure. + * @phpstan-param 'term'|'comment' $object_type + */ + public function queue_objects($object_type, $object_ids) + { + } + /** + * Resets lazy-load queue for a given object type. + * + * @since 4.5.0 + * + * @param string $object_type Object type. Accepts 'comment' or 'term'. + * @return void|WP_Error WP_Error on failure. + * @phpstan-param 'comment'|'term' $object_type + */ + public function reset_queue($object_type) + { + } + /** + * Lazy-loads term meta for queued terms. + * + * This method is public so that it can be used as a filter callback. As a rule, there + * is no need to invoke it directly. + * + * @since 4.5.0 + * @deprecated 6.3.0 Use WP_Metadata_Lazyloader::lazyload_meta_callback() instead. + * + * @param mixed $check The `$check` param passed from the 'get_term_metadata' hook. + * @return mixed In order not to short-circuit `get_metadata()`. Generally, this is `null`, but it could be + * another value if filtered by a plugin. + */ + public function lazyload_term_meta($check) + { + } + /** + * Lazy-loads comment meta for queued comments. + * + * This method is public so that it can be used as a filter callback. As a rule, there is no need to invoke it + * directly, from either inside or outside the `WP_Query` object. + * + * @since 4.5.0 + * @deprecated 6.3.0 Use WP_Metadata_Lazyloader::lazyload_meta_callback() instead. + * + * @param mixed $check The `$check` param passed from the {@see 'get_comment_metadata'} hook. + * @return mixed The original value of `$check`, so as not to short-circuit `get_comment_metadata()`. + */ + public function lazyload_comment_meta($check) + { + } + /** + * Lazy-loads meta for queued objects. + * + * This method is public so that it can be used as a filter callback. As a rule, there + * is no need to invoke it directly. + * + * @since 6.3.0 + * + * @param mixed $check The `$check` param passed from the 'get_*_metadata' hook. + * @param int $object_id ID of the object metadata is for. + * @param string $meta_key Unused. + * @param bool $single Unused. + * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', + * or any other object type with an associated meta table. + * @return mixed In order not to short-circuit `get_metadata()`. Generally, this is `null`, but it could be + * another value if filtered by a plugin. + */ + public function lazyload_meta_callback($check, $object_id, $meta_key, $single, $meta_type) + { + } + } + /** + * WP_Navigation_Fallback class + * + * Manages fallback behavior for Navigation menus. + * + * @package WordPress + * @subpackage Navigation + * @since 6.3.0 + */ + /** + * Manages fallback behavior for Navigation menus. + * + * @access public + * @since 6.3.0 + */ + class WP_Navigation_Fallback + { + /** + * Updates the wp_navigation custom post type schema, in order to expose + * additional fields in the embeddable links of WP_REST_Navigation_Fallback_Controller. + * + * The Navigation Fallback endpoint may embed the full Navigation Menu object + * into the response as the `self` link. By default, the Posts Controller + * will only expose a limited subset of fields but the editor requires + * additional fields to be available in order to utilize the menu. + * + * Used with the `rest_wp_navigation_item_schema` hook. + * + * @since 6.4.0 + * + * @param array $schema The schema for the `wp_navigation` post. + * @return array The modified schema. + */ + public static function update_wp_navigation_post_schema($schema) + { + } + /** + * Gets (and/or creates) an appropriate fallback Navigation Menu. + * + * @since 6.3.0 + * + * @return WP_Post|null the fallback Navigation Post or null. + */ + public static function get_fallback() + { + } + } + /** + * Network API: WP_Network_Query class + * + * @package WordPress + * @subpackage Multisite + * @since 4.6.0 + */ + /** + * Core class used for querying networks. + * + * @since 4.6.0 + * + * @see WP_Network_Query::__construct() for accepted arguments. + */ + #[\AllowDynamicProperties] + class WP_Network_Query + { + /** + * SQL for database query. + * + * @since 4.6.0 + * @var string + */ + public $request; + /** + * SQL query clauses. + * + * @since 4.6.0 + * @var array + */ + protected $sql_clauses = array('select' => '', 'from' => '', 'where' => array(), 'groupby' => '', 'orderby' => '', 'limits' => ''); + /** + * Query vars set by the user. + * + * @since 4.6.0 + * @var array + */ + public $query_vars; + /** + * Default values for query vars. + * + * @since 4.6.0 + * @var array + */ + public $query_var_defaults; + /** + * List of networks located by the query. + * + * @since 4.6.0 + * @var array + */ + public $networks; + /** + * The amount of found networks for the current query. + * + * @since 4.6.0 + * @var int + */ + public $found_networks = 0; + /** + * The number of pages. + * + * @since 4.6.0 + * @var int + */ + public $max_num_pages = 0; + /** + * Constructor. + * + * Sets up the network query, based on the query vars passed. + * + * @since 4.6.0 + * + * @param string|array $query { + * Optional. Array or query string of network query parameters. Default empty. + * + * @type int[] $network__in Array of network IDs to include. Default empty. + * @type int[] $network__not_in Array of network IDs to exclude. Default empty. + * @type bool $count Whether to return a network count (true) or array of network objects. + * Default false. + * @type string $fields Network fields to return. Accepts 'ids' (returns an array of network IDs) + * or empty (returns an array of complete network objects). Default empty. + * @type int $number Maximum number of networks to retrieve. Default empty (no limit). + * @type int $offset Number of networks to offset the query. Used to build LIMIT clause. + * Default 0. + * @type bool $no_found_rows Whether to disable the `SQL_CALC_FOUND_ROWS` query. Default true. + * @type string|array $orderby Network status or array of statuses. Accepts 'id', 'domain', 'path', + * 'domain_length', 'path_length' and 'network__in'. Also accepts false, + * an empty array, or 'none' to disable `ORDER BY` clause. Default 'id'. + * @type string $order How to order retrieved networks. Accepts 'ASC', 'DESC'. Default 'ASC'. + * @type string $domain Limit results to those affiliated with a given domain. Default empty. + * @type string[] $domain__in Array of domains to include affiliated networks for. Default empty. + * @type string[] $domain__not_in Array of domains to exclude affiliated networks for. Default empty. + * @type string $path Limit results to those affiliated with a given path. Default empty. + * @type string[] $path__in Array of paths to include affiliated networks for. Default empty. + * @type string[] $path__not_in Array of paths to exclude affiliated networks for. Default empty. + * @type string $search Search term(s) to retrieve matching networks for. Default empty. + * @type bool $update_network_cache Whether to prime the cache for found networks. Default true. + * } + * @phpstan-param array{ + * network__in?: int[], + * network__not_in?: int[], + * count?: bool, + * fields?: string, + * number?: int, + * offset?: int, + * no_found_rows?: bool, + * orderby?: string|array, + * order?: string, + * domain?: string, + * domain__in?: string[], + * domain__not_in?: string[], + * path?: string, + * path__in?: string[], + * path__not_in?: string[], + * search?: string, + * update_network_cache?: bool, + * } $query + */ + public function __construct($query = '') + { + } + /** + * Parses arguments passed to the network query with default query parameters. + * + * @since 4.6.0 + * + * @param string|array $query WP_Network_Query arguments. See WP_Network_Query::__construct() for accepted arguments. + * @phpstan-param array{ + * network__in?: int[], + * network__not_in?: int[], + * count?: bool, + * fields?: string, + * number?: int, + * offset?: int, + * no_found_rows?: bool, + * orderby?: string|array, + * order?: string, + * domain?: string, + * domain__in?: string[], + * domain__not_in?: string[], + * path?: string, + * path__in?: string[], + * path__not_in?: string[], + * search?: string, + * update_network_cache?: bool, + * } $query See WP_Network_Query::__construct() + */ + public function parse_query($query = '') + { + } + /** + * Sets up the WordPress query for retrieving networks. + * + * @since 4.6.0 + * + * @param string|array $query Array or URL query string of parameters. + * @return array|int List of WP_Network objects, a list of network IDs when 'fields' is set to 'ids', + * or the number of networks when 'count' is passed as a query var. + */ + public function query($query) + { + } + /** + * Gets a list of networks matching the query vars. + * + * @since 4.6.0 + * + * @return array|int List of WP_Network objects, a list of network IDs when 'fields' is set to 'ids', + * or the number of networks when 'count' is passed as a query var. + */ + public function get_networks() + { + } + /** + * Used internally to get a list of network IDs matching the query vars. + * + * @since 4.6.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return int|array A single count of network IDs if a count query. An array of network IDs if a full query. + */ + protected function get_network_ids() + { + } + /** + * Used internally to generate an SQL string for searching across multiple columns. + * + * @since 4.6.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $search Search string. + * @param string[] $columns Array of columns to search. + * @return string Search SQL. + */ + protected function get_search_sql($search, $columns) + { + } + /** + * Parses and sanitizes 'orderby' keys passed to the network query. + * + * @since 4.6.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $orderby Alias for the field to order by. + * @return string|false Value to used in the ORDER clause. False otherwise. + */ + protected function parse_orderby($orderby) + { + } + /** + * Parses an 'order' query variable and cast it to 'ASC' or 'DESC' as necessary. + * + * @since 4.6.0 + * + * @param string $order The 'order' query variable. + * @return string The sanitized 'order' query variable. + */ + protected function parse_order($order) + { + } + } + /** + * Network API: WP_Network class + * + * @package WordPress + * @subpackage Multisite + * @since 4.4.0 + */ + /** + * Core class used for interacting with a multisite network. + * + * This class is used during load to populate the `$current_site` global and + * setup the current network. + * + * This class is most useful in WordPress multi-network installations where the + * ability to interact with any network of sites is required. + * + * @since 4.4.0 + * + * @property int $id + * @property int $site_id + */ + #[\AllowDynamicProperties] + class WP_Network + { + /** + * Domain of the network. + * + * @since 4.4.0 + * @var string + */ + public $domain = ''; + /** + * Path of the network. + * + * @since 4.4.0 + * @var string + */ + public $path = ''; + /** + * Domain used to set cookies for this network. + * + * @since 4.4.0 + * @var string + */ + public $cookie_domain = ''; + /** + * Name of this network. + * + * Named "site" vs. "network" for legacy reasons. + * + * @since 4.4.0 + * @var string + */ + public $site_name = ''; + /** + * Retrieves a network from the database by its ID. + * + * @since 4.4.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $network_id The ID of the network to retrieve. + * @return WP_Network|false The network's object if found. False if not. + */ + public static function get_instance($network_id) + { + } + /** + * Creates a new WP_Network object. + * + * Will populate object properties from the object provided and assign other + * default properties based on that information. + * + * @since 4.4.0 + * + * @param WP_Network|object $network A network object. + */ + public function __construct($network) + { + } + /** + * Getter. + * + * Allows current multisite naming conventions when getting properties. + * + * @since 4.6.0 + * + * @param string $key Property to get. + * @return mixed Value of the property. Null if not available. + */ + public function __get($key) + { + } + /** + * Isset-er. + * + * Allows current multisite naming conventions when checking for properties. + * + * @since 4.6.0 + * + * @param string $key Property to check if set. + * @return bool Whether the property is set. + */ + public function __isset($key) + { + } + /** + * Setter. + * + * Allows current multisite naming conventions while setting properties. + * + * @since 4.6.0 + * + * @param string $key Property to set. + * @param mixed $value Value to assign to the property. + */ + public function __set($key, $value) + { + } + /** + * Retrieves the closest matching network for a domain and path. + * + * This will not necessarily return an exact match for a domain and path. Instead, it + * breaks the domain and path into pieces that are then used to match the closest + * possibility from a query. + * + * The intent of this method is to match a network during bootstrap for a + * requested site address. + * + * @since 4.4.0 + * + * @param string $domain Domain to check. + * @param string $path Path to check. + * @param int|null $segments Path segments to use. Defaults to null, or the full path. + * @return WP_Network|false Network object if successful. False when no network is found. + */ + public static function get_by_path($domain = '', $path = '', $segments = \null) + { + } + } + /** + * Object Cache API: WP_Object_Cache class + * + * @package WordPress + * @subpackage Cache + * @since 5.4.0 + */ + /** + * Core class that implements an object cache. + * + * The WordPress Object Cache is used to save on trips to the database. The + * Object Cache stores all of the cache data to memory and makes the cache + * contents available by using a key, which is used to name and later retrieve + * the cache contents. + * + * The Object Cache can be replaced by other caching mechanisms by placing files + * in the wp-content folder which is looked at in wp-settings. If that file + * exists, then this file will not be included. + * + * @since 2.0.0 + */ + #[\AllowDynamicProperties] + class WP_Object_Cache + { + /** + * The amount of times the cache data was already stored in the cache. + * + * @since 2.5.0 + * @var int + */ + public $cache_hits = 0; + /** + * Amount of times the cache did not have the request in cache. + * + * @since 2.0.0 + * @var int + */ + public $cache_misses = 0; + /** + * List of global cache groups. + * + * @since 3.0.0 + * @var string[] + */ + protected $global_groups = array(); + /** + * Sets up object properties; PHP 5 style constructor. + * + * @since 2.0.8 + */ + public function __construct() + { + } + /** + * Makes private properties readable for backward compatibility. + * + * @since 4.0.0 + * + * @param string $name Property to get. + * @return mixed Property. + */ + public function __get($name) + { + } + /** + * Makes private properties settable for backward compatibility. + * + * @since 4.0.0 + * + * @param string $name Property to set. + * @param mixed $value Property value. + * @return mixed Newly-set property. + */ + public function __set($name, $value) + { + } + /** + * Makes private properties checkable for backward compatibility. + * + * @since 4.0.0 + * + * @param string $name Property to check if set. + * @return bool Whether the property is set. + */ + public function __isset($name) + { + } + /** + * Makes private properties un-settable for backward compatibility. + * + * @since 4.0.0 + * + * @param string $name Property to unset. + */ + public function __unset($name) + { + } + /** + * Serves as a utility function to determine whether a key is valid. + * + * @since 6.1.0 + * + * @param int|string $key Cache key to check for validity. + * @return bool Whether the key is valid. + */ + protected function is_valid_key($key) + { + } + /** + * Serves as a utility function to determine whether a key exists in the cache. + * + * @since 3.4.0 + * + * @param int|string $key Cache key to check for existence. + * @param string $group Cache group for the key existence check. + * @return bool Whether the key exists in the cache for the given group. + */ + protected function _exists($key, $group) + { + } + /** + * Adds data to the cache if it doesn't already exist. + * + * @since 2.0.0 + * + * @uses WP_Object_Cache::_exists() Checks to see if the cache already has data. + * @uses WP_Object_Cache::set() Sets the data after the checking the cache + * contents existence. + * + * @param int|string $key What to call the contents in the cache. + * @param mixed $data The contents to store in the cache. + * @param string $group Optional. Where to group the cache contents. Default 'default'. + * @param int $expire Optional. When to expire the cache contents, in seconds. + * Default 0 (no expiration). + * @return bool True on success, false if cache key and group already exist. + */ + public function add($key, $data, $group = 'default', $expire = 0) + { + } + /** + * Adds multiple values to the cache in one call. + * + * @since 6.0.0 + * + * @param array $data Array of keys and values to be added. + * @param string $group Optional. Where the cache contents are grouped. Default empty. + * @param int $expire Optional. When to expire the cache contents, in seconds. + * Default 0 (no expiration). + * @return bool[] Array of return values, grouped by key. Each value is either + * true on success, or false if cache key and group already exist. + */ + public function add_multiple(array $data, $group = '', $expire = 0) + { + } + /** + * Replaces the contents in the cache, if contents already exist. + * + * @since 2.0.0 + * + * @see WP_Object_Cache::set() + * + * @param int|string $key What to call the contents in the cache. + * @param mixed $data The contents to store in the cache. + * @param string $group Optional. Where to group the cache contents. Default 'default'. + * @param int $expire Optional. When to expire the cache contents, in seconds. + * Default 0 (no expiration). + * @return bool True if contents were replaced, false if original value does not exist. + */ + public function replace($key, $data, $group = 'default', $expire = 0) + { + } + /** + * Sets the data contents into the cache. + * + * The cache contents are grouped by the $group parameter followed by the + * $key. This allows for duplicate IDs in unique groups. Therefore, naming of + * the group should be used with care and should follow normal function + * naming guidelines outside of core WordPress usage. + * + * The $expire parameter is not used, because the cache will automatically + * expire for each time a page is accessed and PHP finishes. The method is + * more for cache plugins which use files. + * + * @since 2.0.0 + * @since 6.1.0 Returns false if cache key is invalid. + * + * @param int|string $key What to call the contents in the cache. + * @param mixed $data The contents to store in the cache. + * @param string $group Optional. Where to group the cache contents. Default 'default'. + * @param int $expire Optional. Not used. + * @return bool True if contents were set, false if key is invalid. + */ + public function set($key, $data, $group = 'default', $expire = 0) + { + } + /** + * Sets multiple values to the cache in one call. + * + * @since 6.0.0 + * + * @param array $data Array of key and value to be set. + * @param string $group Optional. Where the cache contents are grouped. Default empty. + * @param int $expire Optional. When to expire the cache contents, in seconds. + * Default 0 (no expiration). + * @return bool[] Array of return values, grouped by key. Each value is always true. + */ + public function set_multiple(array $data, $group = '', $expire = 0) + { + } + /** + * Retrieves the cache contents, if it exists. + * + * The contents will be first attempted to be retrieved by searching by the + * key in the cache group. If the cache is hit (success) then the contents + * are returned. + * + * On failure, the number of cache misses will be incremented. + * + * @since 2.0.0 + * + * @param int|string $key The key under which the cache contents are stored. + * @param string $group Optional. Where the cache contents are grouped. Default 'default'. + * @param bool $force Optional. Unused. Whether to force an update of the local cache + * from the persistent cache. Default false. + * @param bool $found Optional. Whether the key was found in the cache (passed by reference). + * Disambiguates a return of false, a storable value. Default null. + * @return mixed|false The cache contents on success, false on failure to retrieve contents. + */ + public function get($key, $group = 'default', $force = \false, &$found = \null) + { + } + /** + * Retrieves multiple values from the cache in one call. + * + * @since 5.5.0 + * + * @param array $keys Array of keys under which the cache contents are stored. + * @param string $group Optional. Where the cache contents are grouped. Default 'default'. + * @param bool $force Optional. Whether to force an update of the local cache + * from the persistent cache. Default false. + * @return array Array of return values, grouped by key. Each value is either + * the cache contents on success, or false on failure. + */ + public function get_multiple($keys, $group = 'default', $force = \false) + { + } + /** + * Removes the contents of the cache key in the group. + * + * If the cache key does not exist in the group, then nothing will happen. + * + * @since 2.0.0 + * + * @param int|string $key What the contents in the cache are called. + * @param string $group Optional. Where the cache contents are grouped. Default 'default'. + * @param bool $deprecated Optional. Unused. Default false. + * @return bool True on success, false if the contents were not deleted. + */ + public function delete($key, $group = 'default', $deprecated = \false) + { + } + /** + * Deletes multiple values from the cache in one call. + * + * @since 6.0.0 + * + * @param array $keys Array of keys to be deleted. + * @param string $group Optional. Where the cache contents are grouped. Default empty. + * @return bool[] Array of return values, grouped by key. Each value is either + * true on success, or false if the contents were not deleted. + */ + public function delete_multiple(array $keys, $group = '') + { + } + /** + * Increments numeric cache item's value. + * + * @since 3.3.0 + * + * @param int|string $key The cache key to increment. + * @param int $offset Optional. The amount by which to increment the item's value. + * Default 1. + * @param string $group Optional. The group the key is in. Default 'default'. + * @return int|false The item's new value on success, false on failure. + */ + public function incr($key, $offset = 1, $group = 'default') + { + } + /** + * Decrements numeric cache item's value. + * + * @since 3.3.0 + * + * @param int|string $key The cache key to decrement. + * @param int $offset Optional. The amount by which to decrement the item's value. + * Default 1. + * @param string $group Optional. The group the key is in. Default 'default'. + * @return int|false The item's new value on success, false on failure. + */ + public function decr($key, $offset = 1, $group = 'default') + { + } + /** + * Clears the object cache of all data. + * + * @since 2.0.0 + * + * @return true Always returns true. + */ + public function flush() + { + } + /** + * Removes all cache items in a group. + * + * @since 6.1.0 + * + * @param string $group Name of group to remove from cache. + * @return true Always returns true. + */ + public function flush_group($group) + { + } + /** + * Sets the list of global cache groups. + * + * @since 3.0.0 + * + * @param string|string[] $groups List of groups that are global. + */ + public function add_global_groups($groups) + { + } + /** + * Switches the internal blog ID. + * + * This changes the blog ID used to create keys in blog specific groups. + * + * @since 3.5.0 + * + * @param int $blog_id Blog ID. + */ + public function switch_to_blog($blog_id) + { + } + /** + * Resets cache keys. + * + * @since 3.0.0 + * + * @deprecated 3.5.0 Use WP_Object_Cache::switch_to_blog() + * @see switch_to_blog() + */ + public function reset() + { + } + /** + * Echoes the stats of the caching. + * + * Gives the cache hits, and cache misses. Also prints every cached group, + * key and the data. + * + * @since 2.0.0 + */ + public function stats() + { + } + } + /** + * WP_oEmbed_Controller class, used to provide an oEmbed endpoint. + * + * @package WordPress + * @subpackage Embeds + * @since 4.4.0 + */ + /** + * oEmbed API endpoint controller. + * + * Registers the REST API route and delivers the response data. + * The output format (XML or JSON) is handled by the REST API. + * + * @since 4.4.0 + */ + #[\AllowDynamicProperties] + final class WP_oEmbed_Controller + { + /** + * Register the oEmbed REST API route. + * + * @since 4.4.0 + */ + public function register_routes() + { + } + /** + * Callback for the embed API endpoint. + * + * Returns the JSON object for the post. + * + * @since 4.4.0 + * + * @param WP_REST_Request $request Full data about the request. + * @return array|WP_Error oEmbed response data or WP_Error on failure. + */ + public function get_item($request) + { + } + /** + * Checks if current user can make a proxy oEmbed request. + * + * @since 4.8.0 + * + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_proxy_item_permissions_check() + { + } + /** + * Callback for the proxy API endpoint. + * + * Returns the JSON object for the proxied item. + * + * @since 4.8.0 + * + * @see WP_oEmbed::get_html() + * @global WP_Embed $wp_embed WordPress Embed object. + * @global WP_Scripts $wp_scripts + * + * @param WP_REST_Request $request Full data about the request. + * @return object|WP_Error oEmbed response data or WP_Error on failure. + */ + public function get_proxy_item($request) + { + } + } + /** + * API for fetching the HTML to embed remote content based on a provided URL + * + * Used internally by the WP_Embed class, but is designed to be generic. + * + * @link https://developer.wordpress.org/advanced-administration/wordpress/oembed/ + * @link http://oembed.com/ + * + * @package WordPress + * @subpackage oEmbed + */ + /** + * Core class used to implement oEmbed functionality. + * + * @since 2.9.0 + */ + #[\AllowDynamicProperties] + class WP_oEmbed + { + /** + * A list of oEmbed providers. + * + * @since 2.9.0 + * @var array + */ + public $providers = array(); + /** + * A list of an early oEmbed providers. + * + * @since 4.0.0 + * @var array + */ + public static $early_providers = array(); + /** + * Constructor. + * + * @since 2.9.0 + */ + public function __construct() + { + } + /** + * Exposes private/protected methods for backward compatibility. + * + * @since 4.0.0 + * + * @param string $name Method to call. + * @param array $arguments Arguments to pass when calling. + * @return mixed|false Return value of the callback, false otherwise. + */ + public function __call($name, $arguments) + { + } + /** + * Takes a URL and returns the corresponding oEmbed provider's URL, if there is one. + * + * @since 4.0.0 + * + * @see WP_oEmbed::discover() + * + * @param string $url The URL to the content. + * @param string|array $args { + * Optional. Additional provider arguments. Default empty. + * + * @type bool $discover Optional. Determines whether to attempt to discover link tags + * at the given URL for an oEmbed provider when the provider URL + * is not found in the built-in providers list. Default true. + * } + * @return string|false The oEmbed provider URL on success, false on failure. + * @phpstan-param array{ + * discover?: bool, + * } $args + */ + public function get_provider($url, $args = '') + { + } + /** + * Adds an oEmbed provider. + * + * The provider is added just-in-time when wp_oembed_add_provider() is called before + * the {@see 'plugins_loaded'} hook. + * + * The just-in-time addition is for the benefit of the {@see 'oembed_providers'} filter. + * + * @since 4.0.0 + * + * @see wp_oembed_add_provider() + * + * @param string $format Format of URL that this provider can handle. You can use + * asterisks as wildcards. + * @param string $provider The URL to the oEmbed provider.. + * @param bool $regex Optional. Whether the $format parameter is in a regex format. + * Default false. + */ + public static function _add_provider_early($format, $provider, $regex = \false) + { + } + /** + * Removes an oEmbed provider. + * + * The provider is removed just-in-time when wp_oembed_remove_provider() is called before + * the {@see 'plugins_loaded'} hook. + * + * The just-in-time removal is for the benefit of the {@see 'oembed_providers'} filter. + * + * @since 4.0.0 + * + * @see wp_oembed_remove_provider() + * + * @param string $format The format of URL that this provider can handle. You can use + * asterisks as wildcards. + */ + public static function _remove_provider_early($format) + { + } + /** + * Takes a URL and attempts to return the oEmbed data. + * + * @see WP_oEmbed::fetch() + * + * @since 4.8.0 + * + * @param string $url The URL to the content that should be attempted to be embedded. + * @param string|array $args Optional. Additional arguments for retrieving embed HTML. + * See wp_oembed_get() for accepted arguments. Default empty. + * @return object|false The result in the form of an object on success, false on failure. + * @phpstan-param array{ + * width?: int|string, + * height?: int|string, + * discover?: bool, + * } $args See wp_oembed_get() + */ + public function get_data($url, $args = '') + { + } + /** + * The do-it-all function that takes a URL and attempts to return the HTML. + * + * @see WP_oEmbed::fetch() + * @see WP_oEmbed::data2html() + * + * @since 2.9.0 + * + * @param string $url The URL to the content that should be attempted to be embedded. + * @param string|array $args Optional. Additional arguments for retrieving embed HTML. + * See wp_oembed_get() for accepted arguments. Default empty. + * @return string|false The UNSANITIZED (and potentially unsafe) HTML that should be used to embed + * on success, false on failure. + * @phpstan-param array{ + * width?: int|string, + * height?: int|string, + * discover?: bool, + * } $args See wp_oembed_get() + */ + public function get_html($url, $args = '') + { + } + /** + * Attempts to discover link tags at the given URL for an oEmbed provider. + * + * @since 2.9.0 + * + * @param string $url The URL that should be inspected for discovery `<link>` tags. + * @return string|false The oEmbed provider URL on success, false on failure. + */ + public function discover($url) + { + } + /** + * Connects to an oEmbed provider and returns the result. + * + * @since 2.9.0 + * + * @param string $provider The URL to the oEmbed provider. + * @param string $url The URL to the content that is desired to be embedded. + * @param string|array $args Optional. Additional arguments for retrieving embed HTML. + * See wp_oembed_get() for accepted arguments. Default empty. + * @return object|false The result in the form of an object on success, false on failure. + * @phpstan-param array{ + * width?: int|string, + * height?: int|string, + * discover?: bool, + * } $args See wp_oembed_get() + */ + public function fetch($provider, $url, $args = '') + { + } + /** + * Converts a data object from WP_oEmbed::fetch() and returns the HTML. + * + * @since 2.9.0 + * + * @param object $data A data object result from an oEmbed provider. + * @param string $url The URL to the content that is desired to be embedded. + * @return string|false The HTML needed to embed on success, false on failure. + */ + public function data2html($data, $url) + { + } + /** + * Strips any new lines from the HTML. + * + * @since 2.9.0 as strip_scribd_newlines() + * @since 3.0.0 + * + * @param string $html Existing HTML. + * @param object $data Data object from WP_oEmbed::data2html() + * @param string $url The original URL passed to oEmbed. + * @return string Possibly modified $html + */ + public function _strip_newlines($html, $data, $url) + { + } + } + /** + * Error Protection API: WP_Paused_Extensions_Storage class + * + * @package WordPress + * @since 5.2.0 + */ + /** + * Core class used for storing paused extensions. + * + * @since 5.2.0 + */ + #[\AllowDynamicProperties] + class WP_Paused_Extensions_Storage + { + /** + * Type of extension. Used to key extension storage. Either 'plugin' or 'theme'. + * + * @since 5.2.0 + * @var string + */ + protected $type; + /** + * Constructor. + * + * @since 5.2.0 + * + * @param string $extension_type Extension type. Either 'plugin' or 'theme'. + * @phpstan-param 'plugin'|'theme' $extension_type + */ + public function __construct($extension_type) + { + } + /** + * Records an extension error. + * + * Only one error is stored per extension, with subsequent errors for the same extension overriding the + * previously stored error. + * + * @since 5.2.0 + * + * @param string $extension Plugin or theme directory name. + * @param array $error { + * Error information returned by `error_get_last()`. + * + * @type int $type The error type. + * @type string $file The name of the file in which the error occurred. + * @type int $line The line number in which the error occurred. + * @type string $message The error message. + * } + * @return bool True on success, false on failure. + * @phpstan-param array{ + * type?: int, + * file?: string, + * line?: int, + * message?: string, + * } $error + */ + public function set($extension, $error) + { + } + /** + * Forgets a previously recorded extension error. + * + * @since 5.2.0 + * + * @param string $extension Plugin or theme directory name. + * @return bool True on success, false on failure. + */ + public function delete($extension) + { + } + /** + * Gets the error for an extension, if paused. + * + * @since 5.2.0 + * + * @param string $extension Plugin or theme directory name. + * @return array|null Error that is stored, or null if the extension is not paused. + */ + public function get($extension) + { + } + /** + * Gets the paused extensions with their errors. + * + * @since 5.2.0 + * + * @return array { + * Associative array of errors keyed by extension slug. + * + * @type array ...$0 Error information returned by `error_get_last()`. + * } + * @phpstan-return array<int|string, array> + */ + public function get_all() + { + } + /** + * Remove all paused extensions. + * + * @since 5.2.0 + * + * @return bool + */ + public function delete_all() + { + } + /** + * Checks whether the underlying API to store paused extensions is loaded. + * + * @since 5.2.0 + * + * @return bool True if the API is loaded, false otherwise. + */ + protected function is_api_loaded() + { + } + /** + * Get the option name for storing paused extensions. + * + * @since 5.2.0 + * + * @return string + */ + protected function get_option_name() + { + } + } + /** + * WordPress Plugin Administration API: WP_Plugin_Dependencies class + * + * @package WordPress + * @subpackage Administration + * @since 6.5.0 + */ + /** + * Core class for installing plugin dependencies. + * + * It is designed to add plugin dependencies as designated in the + * `Requires Plugins` header to a new view in the plugins install page. + */ + class WP_Plugin_Dependencies + { + /** + * Holds 'get_plugins()'. + * + * @since 6.5.0 + * + * @var array + */ + protected static $plugins; + /** + * Holds plugin directory names to compare with cache. + * + * @since 6.5.0 + * + * @var array + */ + protected static $plugin_dirnames; + /** + * Holds sanitized plugin dependency slugs. + * + * Keyed on the dependent plugin's filepath, + * relative to the plugins directory. + * + * @since 6.5.0 + * + * @var array + */ + protected static $dependencies; + /** + * Holds an array of sanitized plugin dependency slugs. + * + * @since 6.5.0 + * + * @var array + */ + protected static $dependency_slugs; + /** + * Holds an array of dependent plugin slugs. + * + * Keyed on the dependent plugin's filepath, + * relative to the plugins directory. + * + * @since 6.5.0 + * + * @var array + */ + protected static $dependent_slugs; + /** + * Holds 'plugins_api()' data for plugin dependencies. + * + * @since 6.5.0 + * + * @var array + */ + protected static $dependency_api_data; + /** + * Holds plugin dependency filepaths, relative to the plugins directory. + * + * Keyed on the dependency's slug. + * + * @since 6.5.0 + * + * @var string[] + */ + protected static $dependency_filepaths; + /** + * An array of circular dependency pairings. + * + * @since 6.5.0 + * + * @var array[] + */ + protected static $circular_dependencies_pairs; + /** + * An array of circular dependency slugs. + * + * @since 6.5.0 + * + * @var string[] + */ + protected static $circular_dependencies_slugs; + /** + * Whether Plugin Dependencies have been initialized. + * + * @since 6.5.0 + * + * @var bool + */ + protected static $initialized = \false; + /** + * Initializes by fetching plugin header and plugin API data. + * + * @since 6.5.0 + */ + public static function initialize() + { + } + /** + * Determines whether the plugin has plugins that depend on it. + * + * @since 6.5.0 + * + * @param string $plugin_file The plugin's filepath, relative to the plugins directory. + * @return bool Whether the plugin has plugins that depend on it. + */ + public static function has_dependents($plugin_file) + { + } + /** + * Determines whether the plugin has plugin dependencies. + * + * @since 6.5.0 + * + * @param string $plugin_file The plugin's filepath, relative to the plugins directory. + * @return bool Whether a plugin has plugin dependencies. + */ + public static function has_dependencies($plugin_file) + { + } + /** + * Determines whether the plugin has active dependents. + * + * @since 6.5.0 + * + * @param string $plugin_file The plugin's filepath, relative to the plugins directory. + * @return bool Whether the plugin has active dependents. + */ + public static function has_active_dependents($plugin_file) + { + } + /** + * Gets filepaths of plugins that require the dependency. + * + * @since 6.5.0 + * + * @param string $slug The dependency's slug. + * @return array An array of dependent plugin filepaths, relative to the plugins directory. + */ + public static function get_dependents($slug) + { + } + /** + * Gets the slugs of plugins that the dependent requires. + * + * @since 6.5.0 + * + * @param string $plugin_file The dependent plugin's filepath, relative to the plugins directory. + * @return array An array of dependency plugin slugs. + */ + public static function get_dependencies($plugin_file) + { + } + /** + * Gets a dependent plugin's filepath. + * + * @since 6.5.0 + * + * @param string $slug The dependent plugin's slug. + * @return string|false The dependent plugin's filepath, relative to the plugins directory, + * or false if the plugin has no dependencies. + */ + public static function get_dependent_filepath($slug) + { + } + /** + * Determines whether the plugin has unmet dependencies. + * + * @since 6.5.0 + * + * @param string $plugin_file The plugin's filepath, relative to the plugins directory. + * @return bool Whether the plugin has unmet dependencies. + */ + public static function has_unmet_dependencies($plugin_file) + { + } + /** + * Determines whether the plugin has a circular dependency. + * + * @since 6.5.0 + * + * @param string $plugin_file The plugin's filepath, relative to the plugins directory. + * @return bool Whether the plugin has a circular dependency. + */ + public static function has_circular_dependency($plugin_file) + { + } + /** + * Gets the names of plugins that require the plugin. + * + * @since 6.5.0 + * + * @param string $plugin_file The plugin's filepath, relative to the plugins directory. + * @return array An array of dependent names. + */ + public static function get_dependent_names($plugin_file) + { + } + /** + * Gets the names of plugins required by the plugin. + * + * @since 6.5.0 + * + * @param string $plugin_file The dependent plugin's filepath, relative to the plugins directory. + * @return array An array of dependency names. + */ + public static function get_dependency_names($plugin_file) + { + } + /** + * Gets the filepath for a dependency, relative to the plugin's directory. + * + * @since 6.5.0 + * + * @param string $slug The dependency's slug. + * @return string|false If installed, the dependency's filepath relative to the plugins directory, otherwise false. + */ + public static function get_dependency_filepath($slug) + { + } + /** + * Returns API data for the dependency. + * + * @since 6.5.0 + * + * @param string $slug The dependency's slug. + * @return array|false The dependency's API data on success, otherwise false. + */ + public static function get_dependency_data($slug) + { + } + /** + * Displays an admin notice if dependencies are not installed. + * + * @since 6.5.0 + */ + public static function display_admin_notice_for_unmet_dependencies() + { + } + /** + * Displays an admin notice if circular dependencies are installed. + * + * @since 6.5.0 + */ + public static function display_admin_notice_for_circular_dependencies() + { + } + /** + * Checks plugin dependencies after a plugin is installed via AJAX. + * + * @since 6.5.0 + */ + public static function check_plugin_dependencies_during_ajax() + { + } + /** + * Gets data for installed plugins. + * + * @since 6.5.0 + * + * @return array An array of plugin data. + */ + protected static function get_plugins() + { + } + /** + * Reads and stores dependency slugs from a plugin's 'Requires Plugins' header. + * + * @since 6.5.0 + */ + protected static function read_dependencies_from_plugin_headers() + { + } + /** + * Sanitizes slugs. + * + * @since 6.5.0 + * + * @param string $slugs A comma-separated string of plugin dependency slugs. + * @return array An array of sanitized plugin dependency slugs. + */ + protected static function sanitize_dependency_slugs($slugs) + { + } + /** + * Gets the filepath of installed dependencies. + * If a dependency is not installed, the filepath defaults to false. + * + * @since 6.5.0 + * + * @return array An array of install dependencies filepaths, relative to the plugins directory. + */ + protected static function get_dependency_filepaths() + { + } + /** + * Retrieves and stores dependency plugin data from the WordPress.org Plugin API. + * + * @since 6.5.0 + * + * @global string $pagenow The filename of the current screen. + * + * @return array|void An array of dependency API data, or void on early exit. + */ + protected static function get_dependency_api_data() + { + } + /** + * Gets plugin directory names. + * + * @since 6.5.0 + * + * @return array An array of plugin directory names. + */ + protected static function get_plugin_dirnames() + { + } + /** + * Gets circular dependency data. + * + * @since 6.5.0 + * + * @return array[] An array of circular dependency pairings. + */ + protected static function get_circular_dependencies() + { + } + /** + * Checks for circular dependencies. + * + * @since 6.5.0 + * + * @param array $dependents Array of dependent plugins. + * @param array $dependencies Array of plugins dependencies. + * @return array A circular dependency pairing, or an empty array if none exists. + */ + protected static function check_for_circular_dependencies($dependents, $dependencies) + { + } + /** + * Converts a plugin filepath to a slug. + * + * @since 6.5.0 + * + * @param string $plugin_file The plugin's filepath, relative to the plugins directory. + * @return string The plugin's slug. + */ + protected static function convert_to_slug($plugin_file) + { + } + } + /** + * Post API: WP_Post_Type class + * + * @package WordPress + * @subpackage Post + * @since 4.6.0 + */ + /** + * Core class used for interacting with post types. + * + * @since 4.6.0 + * + * @see register_post_type() + */ + #[\AllowDynamicProperties] + final class WP_Post_Type + { + /** + * Post type key. + * + * @since 4.6.0 + * @var string $name + */ + public $name; + /** + * Name of the post type shown in the menu. Usually plural. + * + * @since 4.6.0 + * @var string $label + */ + public $label; + /** + * Labels object for this post type. + * + * If not set, post labels are inherited for non-hierarchical types + * and page labels for hierarchical ones. + * + * @see get_post_type_labels() + * + * @since 4.6.0 + * @var stdClass $labels + */ + public $labels; + /** + * A short descriptive summary of what the post type is. + * + * Default empty. + * + * @since 4.6.0 + * @var string $description + */ + public $description = ''; + /** + * Whether a post type is intended for use publicly either via the admin interface or by front-end users. + * + * While the default settings of $exclude_from_search, $publicly_queryable, $show_ui, and $show_in_nav_menus + * are inherited from public, each does not rely on this relationship and controls a very specific intention. + * + * Default false. + * + * @since 4.6.0 + * @var bool $public + */ + public $public = \false; + /** + * Whether the post type is hierarchical (e.g. page). + * + * Default false. + * + * @since 4.6.0 + * @var bool $hierarchical + */ + public $hierarchical = \false; + /** + * Whether to exclude posts with this post type from front end search + * results. + * + * Default is the opposite value of $public. + * + * @since 4.6.0 + * @var bool $exclude_from_search + */ + public $exclude_from_search = \null; + /** + * Whether queries can be performed on the front end for the post type as part of `parse_request()`. + * + * Endpoints would include: + * + * - `?post_type={post_type_key}` + * - `?{post_type_key}={single_post_slug}` + * - `?{post_type_query_var}={single_post_slug}` + * + * Default is the value of $public. + * + * @since 4.6.0 + * @var bool $publicly_queryable + */ + public $publicly_queryable = \null; + /** + * Whether to generate and allow a UI for managing this post type in the admin. + * + * Default is the value of $public. + * + * @since 4.6.0 + * @var bool $show_ui + */ + public $show_ui = \null; + /** + * Where to show the post type in the admin menu. + * + * To work, $show_ui must be true. If true, the post type is shown in its own top level menu. If false, no menu is + * shown. If a string of an existing top level menu ('tools.php' or 'edit.php?post_type=page', for example), the + * post type will be placed as a sub-menu of that. + * + * Default is the value of $show_ui. + * + * @since 4.6.0 + * @var bool|string $show_in_menu + */ + public $show_in_menu = \null; + /** + * Makes this post type available for selection in navigation menus. + * + * Default is the value $public. + * + * @since 4.6.0 + * @var bool $show_in_nav_menus + */ + public $show_in_nav_menus = \null; + /** + * Makes this post type available via the admin bar. + * + * Default is the value of $show_in_menu. + * + * @since 4.6.0 + * @var bool $show_in_admin_bar + */ + public $show_in_admin_bar = \null; + /** + * The position in the menu order the post type should appear. + * + * To work, $show_in_menu must be true. Default null (at the bottom). + * + * @since 4.6.0 + * @var int $menu_position + */ + public $menu_position = \null; + /** + * The URL or reference to the icon to be used for this menu. + * + * Pass a base64-encoded SVG using a data URI, which will be colored to match the color scheme. + * This should begin with 'data:image/svg+xml;base64,'. Pass the name of a Dashicons helper class + * to use a font icon, e.g. 'dashicons-chart-pie'. Pass 'none' to leave div.wp-menu-image empty + * so an icon can be added via CSS. + * + * Defaults to use the posts icon. + * + * @since 4.6.0 + * @var string $menu_icon + */ + public $menu_icon = \null; + /** + * The string to use to build the read, edit, and delete capabilities. + * + * May be passed as an array to allow for alternative plurals when using + * this argument as a base to construct the capabilities, e.g. + * array( 'story', 'stories' ). Default 'post'. + * + * @since 4.6.0 + * @var string $capability_type + */ + public $capability_type = 'post'; + /** + * Whether to use the internal default meta capability handling. + * + * Default false. + * + * @since 4.6.0 + * @var bool $map_meta_cap + */ + public $map_meta_cap = \false; + /** + * Provide a callback function that sets up the meta boxes for the edit form. + * + * Do `remove_meta_box()` and `add_meta_box()` calls in the callback. Default null. + * + * @since 4.6.0 + * @var callable $register_meta_box_cb + */ + public $register_meta_box_cb = \null; + /** + * An array of taxonomy identifiers that will be registered for the post type. + * + * Taxonomies can be registered later with `register_taxonomy()` or `register_taxonomy_for_object_type()`. + * + * Default empty array. + * + * @since 4.6.0 + * @var string[] $taxonomies + */ + public $taxonomies = array(); + /** + * Whether there should be post type archives, or if a string, the archive slug to use. + * + * Will generate the proper rewrite rules if $rewrite is enabled. Default false. + * + * @since 4.6.0 + * @var bool|string $has_archive + */ + public $has_archive = \false; + /** + * Sets the query_var key for this post type. + * + * Defaults to $post_type key. If false, a post type cannot be loaded at `?{query_var}={post_slug}`. + * If specified as a string, the query `?{query_var_string}={post_slug}` will be valid. + * + * @since 4.6.0 + * @var string|bool $query_var + */ + public $query_var; + /** + * Whether to allow this post type to be exported. + * + * Default true. + * + * @since 4.6.0 + * @var bool $can_export + */ + public $can_export = \true; + /** + * Whether to delete posts of this type when deleting a user. + * + * - If true, posts of this type belonging to the user will be moved to Trash when the user is deleted. + * - If false, posts of this type belonging to the user will *not* be trashed or deleted. + * - If not set (the default), posts are trashed if post type supports the 'author' feature. + * Otherwise posts are not trashed or deleted. + * + * Default null. + * + * @since 4.6.0 + * @var bool $delete_with_user + */ + public $delete_with_user = \null; + /** + * Array of blocks to use as the default initial state for an editor session. + * + * Each item should be an array containing block name and optional attributes. + * + * Default empty array. + * + * @link https://developer.wordpress.org/block-editor/developers/block-api/block-templates/ + * + * @since 5.0.0 + * @var array[] $template + */ + public $template = array(); + /** + * Whether the block template should be locked if $template is set. + * + * - If set to 'all', the user is unable to insert new blocks, move existing blocks + * and delete blocks. + * - If set to 'insert', the user is able to move existing blocks but is unable to insert + * new blocks and delete blocks. + * + * Default false. + * + * @link https://developer.wordpress.org/block-editor/developers/block-api/block-templates/ + * + * @since 5.0.0 + * @var string|false $template_lock + */ + public $template_lock = \false; + /** + * Whether this post type is a native or "built-in" post_type. + * + * Default false. + * + * @since 4.6.0 + * @var bool $_builtin + */ + public $_builtin = \false; + /** + * URL segment to use for edit link of this post type. + * + * Default 'post.php?post=%d'. + * + * @since 4.6.0 + * @var string $_edit_link + */ + public $_edit_link = 'post.php?post=%d'; + /** + * Post type capabilities. + * + * @since 4.6.0 + * @var stdClass $cap + */ + public $cap; + /** + * Triggers the handling of rewrites for this post type. + * + * Defaults to true, using $post_type as slug. + * + * @since 4.6.0 + * @var array|false $rewrite + */ + public $rewrite; + /** + * The features supported by the post type. + * + * @since 4.6.0 + * @var array|bool $supports + */ + public $supports; + /** + * Whether this post type should appear in the REST API. + * + * Default false. If true, standard endpoints will be registered with + * respect to $rest_base and $rest_controller_class. + * + * @since 4.7.4 + * @var bool $show_in_rest + */ + public $show_in_rest; + /** + * The base path for this post type's REST API endpoints. + * + * @since 4.7.4 + * @var string|bool $rest_base + */ + public $rest_base; + /** + * The namespace for this post type's REST API endpoints. + * + * @since 5.9.0 + * @var string|bool $rest_namespace + */ + public $rest_namespace; + /** + * The controller for this post type's REST API endpoints. + * + * Custom controllers must extend WP_REST_Controller. + * + * @since 4.7.4 + * @var string|bool $rest_controller_class + */ + public $rest_controller_class; + /** + * The controller instance for this post type's REST API endpoints. + * + * Lazily computed. Should be accessed using {@see WP_Post_Type::get_rest_controller()}. + * + * @since 5.3.0 + * @var WP_REST_Controller $rest_controller + */ + public $rest_controller; + /** + * The controller for this post type's revisions REST API endpoints. + * + * Custom controllers must extend WP_REST_Controller. + * + * @since 6.4.0 + * @var string|bool $revisions_rest_controller_class + */ + public $revisions_rest_controller_class; + /** + * The controller instance for this post type's revisions REST API endpoints. + * + * Lazily computed. Should be accessed using {@see WP_Post_Type::get_revisions_rest_controller()}. + * + * @since 6.4.0 + * @var WP_REST_Controller $revisions_rest_controller + */ + public $revisions_rest_controller; + /** + * The controller for this post type's autosave REST API endpoints. + * + * Custom controllers must extend WP_REST_Controller. + * + * @since 6.4.0 + * @var string|bool $autosave_rest_controller_class + */ + public $autosave_rest_controller_class; + /** + * The controller instance for this post type's autosave REST API endpoints. + * + * Lazily computed. Should be accessed using {@see WP_Post_Type::get_autosave_rest_controller()}. + * + * @since 6.4.0 + * @var WP_REST_Controller $autosave_rest_controller + */ + public $autosave_rest_controller; + /** + * A flag to register the post type REST API controller after its associated autosave / revisions controllers, instead of before. Registration order affects route matching priority. + * + * @since 6.4.0 + * @var bool $late_route_registration + */ + public $late_route_registration; + /** + * Constructor. + * + * See the register_post_type() function for accepted arguments for `$args`. + * + * Will populate object properties from the provided arguments and assign other + * default properties based on that information. + * + * @since 4.6.0 + * + * @see register_post_type() + * + * @param string $post_type Post type key. + * @param array|string $args Optional. Array or string of arguments for registering a post type. + * See register_post_type() for information on accepted arguments. + * Default empty array. + * @phpstan-param array{ + * label?: string, + * labels?: string[], + * description?: string, + * public?: bool, + * hierarchical?: bool, + * exclude_from_search?: bool, + * publicly_queryable?: bool, + * show_ui?: bool, + * show_in_menu?: bool|string, + * show_in_nav_menus?: bool, + * show_in_admin_bar?: bool, + * show_in_rest?: bool, + * rest_base?: string, + * rest_namespace?: string, + * rest_controller_class?: string, + * autosave_rest_controller_class?: string|bool, + * revisions_rest_controller_class?: string|bool, + * late_route_registration?: bool, + * menu_position?: int, + * menu_icon?: string, + * capability_type?: string|array, + * capabilities?: string[], + * map_meta_cap?: bool, + * supports?: array|false, + * register_meta_box_cb?: callable, + * taxonomies?: string[], + * has_archive?: bool|string, + * rewrite?: bool|array{ + * slug?: string, + * with_front?: bool, + * feeds?: bool, + * pages?: bool, + * ep_mask?: int, + * }, + * query_var?: string|bool, + * can_export?: bool, + * delete_with_user?: bool, + * template?: array, + * template_lock?: string|false, + * _builtin?: bool, + * _edit_link?: string, + * } $args See register_post_type() + */ + public function __construct($post_type, $args = array()) + { + } + /** + * Sets post type properties. + * + * See the register_post_type() function for accepted arguments for `$args`. + * + * @since 4.6.0 + * + * @param array|string $args Array or string of arguments for registering a post type. + */ + public function set_props($args) + { + } + /** + * Sets the features support for the post type. + * + * @since 4.6.0 + */ + public function add_supports() + { + } + /** + * Adds the necessary rewrite rules for the post type. + * + * @since 4.6.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * @global WP $wp Current WordPress environment instance. + */ + public function add_rewrite_rules() + { + } + /** + * Registers the post type meta box if a custom callback was specified. + * + * @since 4.6.0 + */ + public function register_meta_boxes() + { + } + /** + * Adds the future post hook action for the post type. + * + * @since 4.6.0 + */ + public function add_hooks() + { + } + /** + * Registers the taxonomies for the post type. + * + * @since 4.6.0 + */ + public function register_taxonomies() + { + } + /** + * Removes the features support for the post type. + * + * @since 4.6.0 + * + * @global array $_wp_post_type_features Post type features. + */ + public function remove_supports() + { + } + /** + * Removes any rewrite rules, permastructs, and rules for the post type. + * + * @since 4.6.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * @global WP $wp Current WordPress environment instance. + * @global array $post_type_meta_caps Used to remove meta capabilities. + */ + public function remove_rewrite_rules() + { + } + /** + * Unregisters the post type meta box if a custom callback was specified. + * + * @since 4.6.0 + */ + public function unregister_meta_boxes() + { + } + /** + * Removes the post type from all taxonomies. + * + * @since 4.6.0 + */ + public function unregister_taxonomies() + { + } + /** + * Removes the future post hook action for the post type. + * + * @since 4.6.0 + */ + public function remove_hooks() + { + } + /** + * Gets the REST API controller for this post type. + * + * Will only instantiate the controller class once per request. + * + * @since 5.3.0 + * + * @return WP_REST_Controller|null The controller instance, or null if the post type + * is set not to show in rest. + */ + public function get_rest_controller() + { + } + /** + * Gets the REST API revisions controller for this post type. + * + * Will only instantiate the controller class once per request. + * + * @since 6.4.0 + * + * @return WP_REST_Controller|null The controller instance, or null if the post type + * is set not to show in rest. + */ + public function get_revisions_rest_controller() + { + } + /** + * Gets the REST API autosave controller for this post type. + * + * Will only instantiate the controller class once per request. + * + * @since 6.4.0 + * + * @return WP_REST_Controller|null The controller instance, or null if the post type + * is set not to show in rest. + */ + public function get_autosave_rest_controller() + { + } + /** + * Returns the default labels for post types. + * + * @since 6.0.0 + * + * @return (string|null)[][] The default labels for post types. + */ + public static function get_default_labels() + { + } + /** + * Resets the cache for the default labels. + * + * @since 6.0.0 + */ + public static function reset_default_labels() + { + } + } + /** + * Post API: WP_Post class + * + * @package WordPress + * @subpackage Post + * @since 4.4.0 + */ + /** + * Core class used to implement the WP_Post object. + * + * @since 3.5.0 + * + * @property string $page_template + * + * @property-read int[] $ancestors + * @property-read int[] $post_category + * @property-read string[] $tags_input + */ + #[\AllowDynamicProperties] + final class WP_Post + { + /** + * Post ID. + * + * @since 3.5.0 + * @var int + */ + public $ID; + /** + * ID of post author. + * + * A numeric string, for compatibility reasons. + * + * @since 3.5.0 + * @var string + */ + public $post_author = 0; + /** + * The post's local publication time. + * + * @since 3.5.0 + * @var string + */ + public $post_date = '0000-00-00 00:00:00'; + /** + * The post's GMT publication time. + * + * @since 3.5.0 + * @var string + */ + public $post_date_gmt = '0000-00-00 00:00:00'; + /** + * The post's content. + * + * @since 3.5.0 + * @var string + */ + public $post_content = ''; + /** + * The post's title. + * + * @since 3.5.0 + * @var string + */ + public $post_title = ''; + /** + * The post's excerpt. + * + * @since 3.5.0 + * @var string + */ + public $post_excerpt = ''; + /** + * The post's status. + * + * @since 3.5.0 + * @var string + */ + public $post_status = 'publish'; + /** + * Whether comments are allowed. + * + * @since 3.5.0 + * @var string + */ + public $comment_status = 'open'; + /** + * Whether pings are allowed. + * + * @since 3.5.0 + * @var string + */ + public $ping_status = 'open'; + /** + * The post's password in plain text. + * + * @since 3.5.0 + * @var string + */ + public $post_password = ''; + /** + * The post's slug. + * + * @since 3.5.0 + * @var string + */ + public $post_name = ''; + /** + * URLs queued to be pinged. + * + * @since 3.5.0 + * @var string + */ + public $to_ping = ''; + /** + * URLs that have been pinged. + * + * @since 3.5.0 + * @var string + */ + public $pinged = ''; + /** + * The post's local modified time. + * + * @since 3.5.0 + * @var string + */ + public $post_modified = '0000-00-00 00:00:00'; + /** + * The post's GMT modified time. + * + * @since 3.5.0 + * @var string + */ + public $post_modified_gmt = '0000-00-00 00:00:00'; + /** + * A utility DB field for post content. + * + * @since 3.5.0 + * @var string + */ + public $post_content_filtered = ''; + /** + * ID of a post's parent post. + * + * @since 3.5.0 + * @var int + */ + public $post_parent = 0; + /** + * The unique identifier for a post, not necessarily a URL, used as the feed GUID. + * + * @since 3.5.0 + * @var string + */ + public $guid = ''; + /** + * A field used for ordering posts. + * + * @since 3.5.0 + * @var int + */ + public $menu_order = 0; + /** + * The post's type, like post or page. + * + * @since 3.5.0 + * @var string + */ + public $post_type = 'post'; + /** + * An attachment's mime type. + * + * @since 3.5.0 + * @var string + */ + public $post_mime_type = ''; + /** + * Cached comment count. + * + * A numeric string, for compatibility reasons. + * + * @since 3.5.0 + * @var string + */ + public $comment_count = 0; + /** + * Stores the post object's sanitization level. + * + * Does not correspond to a DB field. + * + * @since 3.5.0 + * @var string + */ + public $filter; + /** + * Retrieve WP_Post instance. + * + * @since 3.5.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $post_id Post ID. + * @return WP_Post|false Post object, false otherwise. + */ + public static function get_instance($post_id) + { + } + /** + * Constructor. + * + * @since 3.5.0 + * + * @param WP_Post|object $post Post object. + */ + public function __construct($post) + { + } + /** + * Isset-er. + * + * @since 3.5.0 + * + * @param string $key Property to check if set. + * @return bool + */ + public function __isset($key) + { + } + /** + * Getter. + * + * @since 3.5.0 + * + * @param string $key Key to get. + * @return mixed + */ + public function __get($key) + { + } + /** + * {@Missing Summary} + * + * @since 3.5.0 + * + * @param string $filter Filter. + * @return WP_Post + */ + public function filter($filter) + { + } + /** + * Convert object to array. + * + * @since 3.5.0 + * + * @return array Object as array. + */ + public function to_array() + { + } + } + /** + * Query API: WP_Query class + * + * @package WordPress + * @subpackage Query + * @since 4.7.0 + */ + /** + * The WordPress Query class. + * + * @link https://developer.wordpress.org/reference/classes/wp_query/ + * + * @since 1.5.0 + * @since 4.5.0 Removed the `$comments_popup` property. + */ + #[\AllowDynamicProperties] + class WP_Query + { + /** + * Query vars set by the user. + * + * @since 1.5.0 + * @var array + */ + public $query; + /** + * Query vars, after parsing. + * + * @since 1.5.0 + * @var array + */ + public $query_vars = array(); + /** + * Taxonomy query, as passed to get_tax_sql(). + * + * @since 3.1.0 + * @var WP_Tax_Query|null A taxonomy query instance. + */ + public $tax_query; + /** + * Metadata query container. + * + * @since 3.2.0 + * @var WP_Meta_Query A meta query instance. + */ + public $meta_query = \false; + /** + * Date query container. + * + * @since 3.7.0 + * @var WP_Date_Query A date query instance. + */ + public $date_query = \false; + /** + * Holds the data for a single object that is queried. + * + * Holds the contents of a post, page, category, attachment. + * + * @since 1.5.0 + * @var WP_Term|WP_Post_Type|WP_Post|WP_User|null + */ + public $queried_object; + /** + * The ID of the queried object. + * + * @since 1.5.0 + * @var int + */ + public $queried_object_id; + /** + * SQL for the database query. + * + * @since 2.0.1 + * @var string + */ + public $request; + /** + * Array of post objects or post IDs. + * + * @since 1.5.0 + * @var WP_Post[]|int[] + */ + public $posts; + /** + * The number of posts for the current query. + * + * @since 1.5.0 + * @var int + */ + public $post_count = 0; + /** + * Index of the current item in the loop. + * + * @since 1.5.0 + * @var int + */ + public $current_post = -1; + /** + * Whether the caller is before the loop. + * + * @since 6.3.0 + * @var bool + */ + public $before_loop = \true; + /** + * Whether the loop has started and the caller is in the loop. + * + * @since 2.0.0 + * @var bool + */ + public $in_the_loop = \false; + /** + * The current post. + * + * This property does not get populated when the `fields` argument is set to + * `ids` or `id=>parent`. + * + * @since 1.5.0 + * @var WP_Post|null + */ + public $post; + /** + * The list of comments for current post. + * + * @since 2.2.0 + * @var WP_Comment[] + */ + public $comments; + /** + * The number of comments for the posts. + * + * @since 2.2.0 + * @var int + */ + public $comment_count = 0; + /** + * The index of the comment in the comment loop. + * + * @since 2.2.0 + * @var int + */ + public $current_comment = -1; + /** + * Current comment object. + * + * @since 2.2.0 + * @var WP_Comment + */ + public $comment; + /** + * The number of found posts for the current query. + * + * If limit clause was not used, equals $post_count. + * + * @since 2.1.0 + * @var int + */ + public $found_posts = 0; + /** + * The number of pages. + * + * @since 2.1.0 + * @var int + */ + public $max_num_pages = 0; + /** + * The number of comment pages. + * + * @since 2.7.0 + * @var int + */ + public $max_num_comment_pages = 0; + /** + * Signifies whether the current query is for a single post. + * + * @since 1.5.0 + * @var bool + */ + public $is_single = \false; + /** + * Signifies whether the current query is for a preview. + * + * @since 2.0.0 + * @var bool + */ + public $is_preview = \false; + /** + * Signifies whether the current query is for a page. + * + * @since 1.5.0 + * @var bool + */ + public $is_page = \false; + /** + * Signifies whether the current query is for an archive. + * + * @since 1.5.0 + * @var bool + */ + public $is_archive = \false; + /** + * Signifies whether the current query is for a date archive. + * + * @since 1.5.0 + * @var bool + */ + public $is_date = \false; + /** + * Signifies whether the current query is for a year archive. + * + * @since 1.5.0 + * @var bool + */ + public $is_year = \false; + /** + * Signifies whether the current query is for a month archive. + * + * @since 1.5.0 + * @var bool + */ + public $is_month = \false; + /** + * Signifies whether the current query is for a day archive. + * + * @since 1.5.0 + * @var bool + */ + public $is_day = \false; + /** + * Signifies whether the current query is for a specific time. + * + * @since 1.5.0 + * @var bool + */ + public $is_time = \false; + /** + * Signifies whether the current query is for an author archive. + * + * @since 1.5.0 + * @var bool + */ + public $is_author = \false; + /** + * Signifies whether the current query is for a category archive. + * + * @since 1.5.0 + * @var bool + */ + public $is_category = \false; + /** + * Signifies whether the current query is for a tag archive. + * + * @since 2.3.0 + * @var bool + */ + public $is_tag = \false; + /** + * Signifies whether the current query is for a taxonomy archive. + * + * @since 2.5.0 + * @var bool + */ + public $is_tax = \false; + /** + * Signifies whether the current query is for a search. + * + * @since 1.5.0 + * @var bool + */ + public $is_search = \false; + /** + * Signifies whether the current query is for a feed. + * + * @since 1.5.0 + * @var bool + */ + public $is_feed = \false; + /** + * Signifies whether the current query is for a comment feed. + * + * @since 2.2.0 + * @var bool + */ + public $is_comment_feed = \false; + /** + * Signifies whether the current query is for trackback endpoint call. + * + * @since 1.5.0 + * @var bool + */ + public $is_trackback = \false; + /** + * Signifies whether the current query is for the site homepage. + * + * @since 1.5.0 + * @var bool + */ + public $is_home = \false; + /** + * Signifies whether the current query is for the Privacy Policy page. + * + * @since 5.2.0 + * @var bool + */ + public $is_privacy_policy = \false; + /** + * Signifies whether the current query couldn't find anything. + * + * @since 1.5.0 + * @var bool + */ + public $is_404 = \false; + /** + * Signifies whether the current query is for an embed. + * + * @since 4.4.0 + * @var bool + */ + public $is_embed = \false; + /** + * Signifies whether the current query is for a paged result and not for the first page. + * + * @since 1.5.0 + * @var bool + */ + public $is_paged = \false; + /** + * Signifies whether the current query is for an administrative interface page. + * + * @since 1.5.0 + * @var bool + */ + public $is_admin = \false; + /** + * Signifies whether the current query is for an attachment page. + * + * @since 2.0.0 + * @var bool + */ + public $is_attachment = \false; + /** + * Signifies whether the current query is for an existing single post of any post type + * (post, attachment, page, custom post types). + * + * @since 2.1.0 + * @var bool + */ + public $is_singular = \false; + /** + * Signifies whether the current query is for the robots.txt file. + * + * @since 2.1.0 + * @var bool + */ + public $is_robots = \false; + /** + * Signifies whether the current query is for the favicon.ico file. + * + * @since 5.4.0 + * @var bool + */ + public $is_favicon = \false; + /** + * Signifies whether the current query is for the page_for_posts page. + * + * Basically, the homepage if the option isn't set for the static homepage. + * + * @since 2.1.0 + * @var bool + */ + public $is_posts_page = \false; + /** + * Signifies whether the current query is for a post type archive. + * + * @since 3.1.0 + * @var bool + */ + public $is_post_type_archive = \false; + /** + * Set if post thumbnails are cached + * + * @since 3.2.0 + * @var bool + */ + public $thumbnails_cached = \false; + /** + * Controls whether an attachment query should include filenames or not. + * + * @since 6.0.3 + * @var bool + */ + protected $allow_query_attachment_by_filename = \false; + /** + * Initiates object properties and sets default values. + * + * @since 1.5.0 + */ + public function init() + { + } + /** + * Reparses the query vars. + * + * @since 1.5.0 + */ + public function parse_query_vars() + { + } + /** + * Fills in the query variables, which do not exist within the parameter. + * + * @since 2.1.0 + * @since 4.5.0 Removed the `comments_popup` public query variable. + * + * @param array $query_vars Defined query variables. + * @return array Complete query variables with undefined ones filled in empty. + */ + public function fill_query_vars($query_vars) + { + } + /** + * Parses a query string and sets query type booleans. + * + * @since 1.5.0 + * @since 4.2.0 Introduced the ability to order by specific clauses of a `$meta_query`, by passing the clause's + * array key to `$orderby`. + * @since 4.4.0 Introduced `$post_name__in` and `$title` parameters. `$s` was updated to support excluded + * search terms, by prepending a hyphen. + * @since 4.5.0 Removed the `$comments_popup` parameter. + * Introduced the `$comment_status` and `$ping_status` parameters. + * Introduced `RAND(x)` syntax for `$orderby`, which allows an integer seed value to random sorts. + * @since 4.6.0 Added 'post_name__in' support for `$orderby`. Introduced the `$lazy_load_term_meta` argument. + * @since 4.9.0 Introduced the `$comment_count` parameter. + * @since 5.1.0 Introduced the `$meta_compare_key` parameter. + * @since 5.3.0 Introduced the `$meta_type_key` parameter. + * @since 6.1.0 Introduced the `$update_menu_item_cache` parameter. + * @since 6.2.0 Introduced the `$search_columns` parameter. + * + * @param string|array $query { + * Optional. Array or string of Query parameters. + * + * @type int $attachment_id Attachment post ID. Used for 'attachment' post_type. + * @type int|string $author Author ID, or comma-separated list of IDs. + * @type string $author_name User 'user_nicename'. + * @type int[] $author__in An array of author IDs to query from. + * @type int[] $author__not_in An array of author IDs not to query from. + * @type bool $cache_results Whether to cache post information. Default true. + * @type int|string $cat Category ID or comma-separated list of IDs (this or any children). + * @type int[] $category__and An array of category IDs (AND in). + * @type int[] $category__in An array of category IDs (OR in, no children). + * @type int[] $category__not_in An array of category IDs (NOT in). + * @type string $category_name Use category slug (not name, this or any children). + * @type array|int $comment_count Filter results by comment count. Provide an integer to match + * comment count exactly. Provide an array with integer 'value' + * and 'compare' operator ('=', '!=', '>', '>=', '<', '<=' ) to + * compare against comment_count in a specific way. + * @type string $comment_status Comment status. + * @type int $comments_per_page The number of comments to return per page. + * Default 'comments_per_page' option. + * @type array $date_query An associative array of WP_Date_Query arguments. + * See WP_Date_Query::__construct(). + * @type int $day Day of the month. Default empty. Accepts numbers 1-31. + * @type bool $exact Whether to search by exact keyword. Default false. + * @type string $fields Post fields to query for. Accepts: + * - '' Returns an array of complete post objects (`WP_Post[]`). + * - 'ids' Returns an array of post IDs (`int[]`). + * - 'id=>parent' Returns an associative array of parent post IDs, + * keyed by post ID (`int[]`). + * Default ''. + * @type int $hour Hour of the day. Default empty. Accepts numbers 0-23. + * @type int|bool $ignore_sticky_posts Whether to ignore sticky posts or not. Setting this to false + * excludes stickies from 'post__in'. Accepts 1|true, 0|false. + * Default false. + * @type int $m Combination YearMonth. Accepts any four-digit year and month + * numbers 01-12. Default empty. + * @type string|string[] $meta_key Meta key or keys to filter by. + * @type string|string[] $meta_value Meta value or values to filter by. + * @type string $meta_compare MySQL operator used for comparing the meta value. + * See WP_Meta_Query::__construct() for accepted values and default value. + * @type string $meta_compare_key MySQL operator used for comparing the meta key. + * See WP_Meta_Query::__construct() for accepted values and default value. + * @type string $meta_type MySQL data type that the meta_value column will be CAST to for comparisons. + * See WP_Meta_Query::__construct() for accepted values and default value. + * @type string $meta_type_key MySQL data type that the meta_key column will be CAST to for comparisons. + * See WP_Meta_Query::__construct() for accepted values and default value. + * @type array $meta_query An associative array of WP_Meta_Query arguments. + * See WP_Meta_Query::__construct() for accepted values. + * @type int $menu_order The menu order of the posts. + * @type int $minute Minute of the hour. Default empty. Accepts numbers 0-59. + * @type int $monthnum The two-digit month. Default empty. Accepts numbers 1-12. + * @type string $name Post slug. + * @type bool $nopaging Show all posts (true) or paginate (false). Default false. + * @type bool $no_found_rows Whether to skip counting the total rows found. Enabling can improve + * performance. Default false. + * @type int $offset The number of posts to offset before retrieval. + * @type string $order Designates ascending or descending order of posts. Default 'DESC'. + * Accepts 'ASC', 'DESC'. + * @type string|array $orderby Sort retrieved posts by parameter. One or more options may be passed. + * To use 'meta_value', or 'meta_value_num', 'meta_key=keyname' must be + * also be defined. To sort by a specific `$meta_query` clause, use that + * clause's array key. Accepts: + * - 'none' + * - 'name' + * - 'author' + * - 'date' + * - 'title' + * - 'modified' + * - 'menu_order' + * - 'parent' + * - 'ID' + * - 'rand' + * - 'relevance' + * - 'RAND(x)' (where 'x' is an integer seed value) + * - 'comment_count' + * - 'meta_value' + * - 'meta_value_num' + * - 'post__in' + * - 'post_name__in' + * - 'post_parent__in' + * - The array keys of `$meta_query`. + * Default is 'date', except when a search is being performed, when + * the default is 'relevance'. + * @type int $p Post ID. + * @type int $page Show the number of posts that would show up on page X of a + * static front page. + * @type int $paged The number of the current page. + * @type int $page_id Page ID. + * @type string $pagename Page slug. + * @type string $perm Show posts if user has the appropriate capability. + * @type string $ping_status Ping status. + * @type int[] $post__in An array of post IDs to retrieve, sticky posts will be included. + * @type int[] $post__not_in An array of post IDs not to retrieve. Note: a string of comma- + * separated IDs will NOT work. + * @type string $post_mime_type The mime type of the post. Used for 'attachment' post_type. + * @type string[] $post_name__in An array of post slugs that results must match. + * @type int $post_parent Page ID to retrieve child pages for. Use 0 to only retrieve + * top-level pages. + * @type int[] $post_parent__in An array containing parent page IDs to query child pages from. + * @type int[] $post_parent__not_in An array containing parent page IDs not to query child pages from. + * @type string|string[] $post_type A post type slug (string) or array of post type slugs. + * Default 'any' if using 'tax_query'. + * @type string|string[] $post_status A post status (string) or array of post statuses. + * @type int $posts_per_page The number of posts to query for. Use -1 to request all posts. + * @type int $posts_per_archive_page The number of posts to query for by archive page. Overrides + * 'posts_per_page' when is_archive(), or is_search() are true. + * @type string $s Search keyword(s). Prepending a term with a hyphen will + * exclude posts matching that term. Eg, 'pillow -sofa' will + * return posts containing 'pillow' but not 'sofa'. The + * character used for exclusion can be modified using the + * the 'wp_query_search_exclusion_prefix' filter. + * @type string[] $search_columns Array of column names to be searched. Accepts 'post_title', + * 'post_excerpt' and 'post_content'. Default empty array. + * @type int $second Second of the minute. Default empty. Accepts numbers 0-59. + * @type bool $sentence Whether to search by phrase. Default false. + * @type bool $suppress_filters Whether to suppress filters. Default false. + * @type string $tag Tag slug. Comma-separated (either), Plus-separated (all). + * @type int[] $tag__and An array of tag IDs (AND in). + * @type int[] $tag__in An array of tag IDs (OR in). + * @type int[] $tag__not_in An array of tag IDs (NOT in). + * @type int $tag_id Tag id or comma-separated list of IDs. + * @type string[] $tag_slug__and An array of tag slugs (AND in). + * @type string[] $tag_slug__in An array of tag slugs (OR in). unless 'ignore_sticky_posts' is + * true. Note: a string of comma-separated IDs will NOT work. + * @type array $tax_query An associative array of WP_Tax_Query arguments. + * See WP_Tax_Query::__construct(). + * @type string $title Post title. + * @type bool $update_post_meta_cache Whether to update the post meta cache. Default true. + * @type bool $update_post_term_cache Whether to update the post term cache. Default true. + * @type bool $update_menu_item_cache Whether to update the menu item cache. Default false. + * @type bool $lazy_load_term_meta Whether to lazy-load term meta. Setting to false will + * disable cache priming for term meta, so that each + * get_term_meta() call will hit the database. + * Defaults to the value of `$update_post_term_cache`. + * @type int $w The week number of the year. Default empty. Accepts numbers 0-53. + * @type int $year The four-digit year. Default empty. Accepts any four-digit year. + * } + * @phpstan-param array{ + * attachment_id?: int, + * author?: int|string, + * author_name?: string, + * author__in?: int[], + * author__not_in?: int[], + * cache_results?: bool, + * cat?: int|string, + * category__and?: int[], + * category__in?: int[], + * category__not_in?: int[], + * category_name?: string, + * comment_count?: array|int, + * comment_status?: string, + * comments_per_page?: int, + * date_query?: array, + * day?: int, + * exact?: bool, + * fields?: string, + * hour?: int, + * ignore_sticky_posts?: int|bool, + * m?: int, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * menu_order?: int, + * minute?: int, + * monthnum?: int, + * name?: string, + * nopaging?: bool, + * no_found_rows?: bool, + * offset?: int, + * order?: string, + * orderby?: string|array, + * p?: int, + * page?: int, + * paged?: int, + * page_id?: int, + * pagename?: string, + * perm?: string, + * ping_status?: string, + * post__in?: int[], + * post__not_in?: int[], + * post_mime_type?: string, + * post_name__in?: string[], + * post_parent?: int, + * post_parent__in?: int[], + * post_parent__not_in?: int[], + * post_type?: string|string[], + * post_status?: string|string[], + * posts_per_page?: int, + * posts_per_archive_page?: int, + * s?: string, + * search_columns?: string[], + * second?: int, + * sentence?: bool, + * suppress_filters?: bool, + * tag?: string, + * tag__and?: int[], + * tag__in?: int[], + * tag__not_in?: int[], + * tag_id?: int, + * tag_slug__and?: string[], + * tag_slug__in?: string[], + * tax_query?: array, + * title?: string, + * update_post_meta_cache?: bool, + * update_post_term_cache?: bool, + * update_menu_item_cache?: bool, + * lazy_load_term_meta?: bool, + * w?: int, + * year?: int, + * } $query + */ + public function parse_query($query = '') + { + } + /** + * Parses various taxonomy related query vars. + * + * For BC, this method is not marked as protected. See [28987]. + * + * @since 3.1.0 + * + * @param array $q The query variables. Passed by reference. + */ + public function parse_tax_query(&$q) + { + } + /** + * Generates SQL for the WHERE clause based on passed search terms. + * + * @since 3.7.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array $q Query variables. + * @return string WHERE clause. + */ + protected function parse_search(&$q) + { + } + /** + * Checks if the terms are suitable for searching. + * + * Uses an array of stopwords (terms) that are excluded from the separate + * term matching when searching for posts. The list of English stopwords is + * the approximate search engines list, and is translatable. + * + * @since 3.7.0 + * + * @param string[] $terms Array of terms to check. + * @return string[] Terms that are not stopwords. + */ + protected function parse_search_terms($terms) + { + } + /** + * Retrieves stopwords used when parsing search terms. + * + * @since 3.7.0 + * + * @return string[] Stopwords. + */ + protected function get_search_stopwords() + { + } + /** + * Generates SQL for the ORDER BY condition based on passed search terms. + * + * @since 3.7.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array $q Query variables. + * @return string ORDER BY clause. + */ + protected function parse_search_order(&$q) + { + } + /** + * Converts the given orderby alias (if allowed) to a properly-prefixed value. + * + * @since 4.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $orderby Alias for the field to order by. + * @return string|false Table-prefixed value to used in the ORDER clause. False otherwise. + */ + protected function parse_orderby($orderby) + { + } + /** + * Parse an 'order' query variable and cast it to ASC or DESC as necessary. + * + * @since 4.0.0 + * + * @param string $order The 'order' query variable. + * @return string The sanitized 'order' query variable. + */ + protected function parse_order($order) + { + } + /** + * Sets the 404 property and saves whether query is feed. + * + * @since 2.0.0 + */ + public function set_404() + { + } + /** + * Retrieves the value of a query variable. + * + * @since 1.5.0 + * @since 3.9.0 The `$default_value` argument was introduced. + * + * @param string $query_var Query variable key. + * @param mixed $default_value Optional. Value to return if the query variable is not set. + * Default empty string. + * @return mixed Contents of the query variable. + */ + public function get($query_var, $default_value = '') + { + } + /** + * Sets the value of a query variable. + * + * @since 1.5.0 + * + * @param string $query_var Query variable key. + * @param mixed $value Query variable value. + */ + public function set($query_var, $value) + { + } + /** + * Retrieves an array of posts based on query variables. + * + * There are a few filters and actions that can be used to modify the post + * database query. + * + * @since 1.5.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return WP_Post[]|int[] Array of post objects or post IDs. + */ + public function get_posts() + { + } + /** + * Sets up the next post and iterate current post index. + * + * @since 1.5.0 + * + * @return WP_Post Next post. + */ + public function next_post() + { + } + /** + * Sets up the current post. + * + * Retrieves the next post, sets up the post, sets the 'in the loop' + * property to true. + * + * @since 1.5.0 + * + * @global WP_Post $post Global post object. + */ + public function the_post() + { + } + /** + * Determines whether there are more posts available in the loop. + * + * Calls the {@see 'loop_end'} action when the loop is complete. + * + * @since 1.5.0 + * + * @return bool True if posts are available, false if end of the loop. + * @phpstan-impure + */ + public function have_posts() + { + } + /** + * Rewinds the posts and resets post index. + * + * @since 1.5.0 + */ + public function rewind_posts() + { + } + /** + * Iterates current comment index and returns WP_Comment object. + * + * @since 2.2.0 + * + * @return WP_Comment Comment object. + */ + public function next_comment() + { + } + /** + * Sets up the current comment. + * + * @since 2.2.0 + * + * @global WP_Comment $comment Global comment object. + */ + public function the_comment() + { + } + /** + * Determines whether there are more comments available. + * + * Automatically rewinds comments when finished. + * + * @since 2.2.0 + * + * @return bool True if comments are available, false if no more comments. + */ + public function have_comments() + { + } + /** + * Rewinds the comments, resets the comment index and comment to first. + * + * @since 2.2.0 + */ + public function rewind_comments() + { + } + /** + * Sets up the WordPress query by parsing query string. + * + * @since 1.5.0 + * + * @see WP_Query::parse_query() for all available arguments. + * + * @param string|array $query URL query string or array of query arguments. + * @return WP_Post[]|int[] Array of post objects or post IDs. + */ + public function query($query) + { + } + /** + * Retrieves the currently queried object. + * + * If queried object is not set, then the queried object will be set from + * the category, tag, taxonomy, posts page, single post, page, or author + * query variable. After it is set up, it will be returned. + * + * @since 1.5.0 + * + * @return WP_Term|WP_Post_Type|WP_Post|WP_User|null The queried object. + */ + public function get_queried_object() + { + } + /** + * Retrieves the ID of the currently queried object. + * + * @since 1.5.0 + * + * @return int + */ + public function get_queried_object_id() + { + } + /** + * Constructor. + * + * Sets up the WordPress query, if parameter is not empty. + * + * @since 1.5.0 + * + * @see WP_Query::parse_query() for all available arguments. + * + * @param string|array $query URL query string or array of vars. + */ + public function __construct($query = '') + { + } + /** + * Makes private properties readable for backward compatibility. + * + * @since 4.0.0 + * + * @param string $name Property to get. + * @return mixed Property. + */ + public function __get($name) + { + } + /** + * Makes private properties checkable for backward compatibility. + * + * @since 4.0.0 + * + * @param string $name Property to check if set. + * @return bool Whether the property is set. + */ + public function __isset($name) + { + } + /** + * Makes private/protected methods readable for backward compatibility. + * + * @since 4.0.0 + * + * @param string $name Method to call. + * @param array $arguments Arguments to pass when calling. + * @return mixed|false Return value of the callback, false otherwise. + */ + public function __call($name, $arguments) + { + } + /** + * Determines whether the query is for an existing archive page. + * + * Archive pages include category, tag, author, date, custom post type, + * and custom taxonomy based archives. + * + * @since 3.1.0 + * + * @see WP_Query::is_category() + * @see WP_Query::is_tag() + * @see WP_Query::is_author() + * @see WP_Query::is_date() + * @see WP_Query::is_post_type_archive() + * @see WP_Query::is_tax() + * + * @return bool Whether the query is for an existing archive page. + */ + public function is_archive() + { + } + /** + * Determines whether the query is for an existing post type archive page. + * + * @since 3.1.0 + * + * @param string|string[] $post_types Optional. Post type or array of posts types + * to check against. Default empty. + * @return bool Whether the query is for an existing post type archive page. + */ + public function is_post_type_archive($post_types = '') + { + } + /** + * Determines whether the query is for an existing attachment page. + * + * @since 3.1.0 + * + * @param int|string|int[]|string[] $attachment Optional. Attachment ID, title, slug, or array of such + * to check against. Default empty. + * @return bool Whether the query is for an existing attachment page. + */ + public function is_attachment($attachment = '') + { + } + /** + * Determines whether the query is for an existing author archive page. + * + * If the $author parameter is specified, this function will additionally + * check if the query is for one of the authors specified. + * + * @since 3.1.0 + * + * @param int|string|int[]|string[] $author Optional. User ID, nickname, nicename, or array of such + * to check against. Default empty. + * @return bool Whether the query is for an existing author archive page. + */ + public function is_author($author = '') + { + } + /** + * Determines whether the query is for an existing category archive page. + * + * If the $category parameter is specified, this function will additionally + * check if the query is for one of the categories specified. + * + * @since 3.1.0 + * + * @param int|string|int[]|string[] $category Optional. Category ID, name, slug, or array of such + * to check against. Default empty. + * @return bool Whether the query is for an existing category archive page. + */ + public function is_category($category = '') + { + } + /** + * Determines whether the query is for an existing tag archive page. + * + * If the $tag parameter is specified, this function will additionally + * check if the query is for one of the tags specified. + * + * @since 3.1.0 + * + * @param int|string|int[]|string[] $tag Optional. Tag ID, name, slug, or array of such + * to check against. Default empty. + * @return bool Whether the query is for an existing tag archive page. + */ + public function is_tag($tag = '') + { + } + /** + * Determines whether the query is for an existing custom taxonomy archive page. + * + * If the $taxonomy parameter is specified, this function will additionally + * check if the query is for that specific $taxonomy. + * + * If the $term parameter is specified in addition to the $taxonomy parameter, + * this function will additionally check if the query is for one of the terms + * specified. + * + * @since 3.1.0 + * + * @global WP_Taxonomy[] $wp_taxonomies Registered taxonomies. + * + * @param string|string[] $taxonomy Optional. Taxonomy slug or slugs to check against. + * Default empty. + * @param int|string|int[]|string[] $term Optional. Term ID, name, slug, or array of such + * to check against. Default empty. + * @return bool Whether the query is for an existing custom taxonomy archive page. + * True for custom taxonomy archive pages, false for built-in taxonomies + * (category and tag archives). + */ + public function is_tax($taxonomy = '', $term = '') + { + } + /** + * Determines whether the current URL is within the comments popup window. + * + * @since 3.1.0 + * @deprecated 4.5.0 + * + * @return false Always returns false. + */ + public function is_comments_popup() + { + } + /** + * Determines whether the query is for an existing date archive. + * + * @since 3.1.0 + * + * @return bool Whether the query is for an existing date archive. + */ + public function is_date() + { + } + /** + * Determines whether the query is for an existing day archive. + * + * @since 3.1.0 + * + * @return bool Whether the query is for an existing day archive. + */ + public function is_day() + { + } + /** + * Determines whether the query is for a feed. + * + * @since 3.1.0 + * + * @param string|string[] $feeds Optional. Feed type or array of feed types + * to check against. Default empty. + * @return bool Whether the query is for a feed. + */ + public function is_feed($feeds = '') + { + } + /** + * Determines whether the query is for a comments feed. + * + * @since 3.1.0 + * + * @return bool Whether the query is for a comments feed. + */ + public function is_comment_feed() + { + } + /** + * Determines whether the query is for the front page of the site. + * + * This is for what is displayed at your site's main URL. + * + * Depends on the site's "Front page displays" Reading Settings 'show_on_front' and 'page_on_front'. + * + * If you set a static page for the front page of your site, this function will return + * true when viewing that page. + * + * Otherwise the same as {@see WP_Query::is_home()}. + * + * @since 3.1.0 + * + * @return bool Whether the query is for the front page of the site. + */ + public function is_front_page() + { + } + /** + * Determines whether the query is for the blog homepage. + * + * This is the page which shows the time based blog content of your site. + * + * Depends on the site's "Front page displays" Reading Settings 'show_on_front' and 'page_for_posts'. + * + * If you set a static page for the front page of your site, this function will return + * true only on the page you set as the "Posts page". + * + * @since 3.1.0 + * + * @see WP_Query::is_front_page() + * + * @return bool Whether the query is for the blog homepage. + */ + public function is_home() + { + } + /** + * Determines whether the query is for the Privacy Policy page. + * + * This is the page which shows the Privacy Policy content of your site. + * + * Depends on the site's "Change your Privacy Policy page" Privacy Settings 'wp_page_for_privacy_policy'. + * + * This function will return true only on the page you set as the "Privacy Policy page". + * + * @since 5.2.0 + * + * @return bool Whether the query is for the Privacy Policy page. + */ + public function is_privacy_policy() + { + } + /** + * Determines whether the query is for an existing month archive. + * + * @since 3.1.0 + * + * @return bool Whether the query is for an existing month archive. + */ + public function is_month() + { + } + /** + * Determines whether the query is for an existing single page. + * + * If the $page parameter is specified, this function will additionally + * check if the query is for one of the pages specified. + * + * @since 3.1.0 + * + * @see WP_Query::is_single() + * @see WP_Query::is_singular() + * + * @param int|string|int[]|string[] $page Optional. Page ID, title, slug, path, or array of such + * to check against. Default empty. + * @return bool Whether the query is for an existing single page. + */ + public function is_page($page = '') + { + } + /** + * Determines whether the query is for a paged result and not for the first page. + * + * @since 3.1.0 + * + * @return bool Whether the query is for a paged result. + */ + public function is_paged() + { + } + /** + * Determines whether the query is for a post or page preview. + * + * @since 3.1.0 + * + * @return bool Whether the query is for a post or page preview. + */ + public function is_preview() + { + } + /** + * Determines whether the query is for the robots.txt file. + * + * @since 3.1.0 + * + * @return bool Whether the query is for the robots.txt file. + */ + public function is_robots() + { + } + /** + * Determines whether the query is for the favicon.ico file. + * + * @since 5.4.0 + * + * @return bool Whether the query is for the favicon.ico file. + */ + public function is_favicon() + { + } + /** + * Determines whether the query is for a search. + * + * @since 3.1.0 + * + * @return bool Whether the query is for a search. + */ + public function is_search() + { + } + /** + * Determines whether the query is for an existing single post. + * + * Works for any post type excluding pages. + * + * If the $post parameter is specified, this function will additionally + * check if the query is for one of the Posts specified. + * + * @since 3.1.0 + * + * @see WP_Query::is_page() + * @see WP_Query::is_singular() + * + * @param int|string|int[]|string[] $post Optional. Post ID, title, slug, path, or array of such + * to check against. Default empty. + * @return bool Whether the query is for an existing single post. + */ + public function is_single($post = '') + { + } + /** + * Determines whether the query is for an existing single post of any post type + * (post, attachment, page, custom post types). + * + * If the $post_types parameter is specified, this function will additionally + * check if the query is for one of the Posts Types specified. + * + * @since 3.1.0 + * + * @see WP_Query::is_page() + * @see WP_Query::is_single() + * + * @param string|string[] $post_types Optional. Post type or array of post types + * to check against. Default empty. + * @return bool Whether the query is for an existing single post + * or any of the given post types. + */ + public function is_singular($post_types = '') + { + } + /** + * Determines whether the query is for a specific time. + * + * @since 3.1.0 + * + * @return bool Whether the query is for a specific time. + */ + public function is_time() + { + } + /** + * Determines whether the query is for a trackback endpoint call. + * + * @since 3.1.0 + * + * @return bool Whether the query is for a trackback endpoint call. + */ + public function is_trackback() + { + } + /** + * Determines whether the query is for an existing year archive. + * + * @since 3.1.0 + * + * @return bool Whether the query is for an existing year archive. + */ + public function is_year() + { + } + /** + * Determines whether the query is a 404 (returns no results). + * + * @since 3.1.0 + * + * @return bool Whether the query is a 404 error. + */ + public function is_404() + { + } + /** + * Determines whether the query is for an embedded post. + * + * @since 4.4.0 + * + * @return bool Whether the query is for an embedded post. + */ + public function is_embed() + { + } + /** + * Determines whether the query is the main query. + * + * @since 3.3.0 + * + * @global WP_Query $wp_the_query WordPress Query object. + * + * @return bool Whether the query is the main query. + */ + public function is_main_query() + { + } + /** + * Sets up global post data. + * + * @since 4.1.0 + * @since 4.4.0 Added the ability to pass a post ID to `$post`. + * + * @global int $id + * @global WP_User $authordata + * @global string $currentday + * @global string $currentmonth + * @global int $page + * @global array $pages + * @global int $multipage + * @global int $more + * @global int $numpages + * + * @param WP_Post|object|int $post WP_Post instance or Post ID/object. + * @return true True when finished. + */ + public function setup_postdata($post) + { + } + /** + * Generates post data. + * + * @since 5.2.0 + * + * @param WP_Post|object|int $post WP_Post instance or Post ID/object. + * @return array|false Elements of post or false on failure. + */ + public function generate_postdata($post) + { + } + /** + * Generates cache key. + * + * @since 6.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array $args Query arguments. + * @param string $sql SQL statement. + * @return string Cache key. + */ + protected function generate_cache_key(array $args, $sql) + { + } + /** + * After looping through a nested query, this function + * restores the $post global to the current post in this query. + * + * @since 3.7.0 + * + * @global WP_Post $post Global post object. + */ + public function reset_postdata() + { + } + /** + * Lazyloads term meta for posts in the loop. + * + * @since 4.4.0 + * @deprecated 4.5.0 See wp_queue_posts_for_term_meta_lazyload(). + * + * @param mixed $check + * @param int $term_id + * @return mixed + */ + public function lazyload_term_meta($check, $term_id) + { + } + /** + * Lazyloads comment meta for comments in the loop. + * + * @since 4.4.0 + * @deprecated 4.5.0 See wp_lazyload_comment_meta(). + * + * @param mixed $check + * @param int $comment_id + * @return mixed + */ + public function lazyload_comment_meta($check, $comment_id) + { + } + } + /** + * Error Protection API: WP_Recovery_Mode_Cookie_Service class + * + * @package WordPress + * @since 5.2.0 + */ + /** + * Core class used to set, validate, and clear cookies that identify a Recovery Mode session. + * + * @since 5.2.0 + */ + #[\AllowDynamicProperties] + final class WP_Recovery_Mode_Cookie_Service + { + /** + * Checks whether the recovery mode cookie is set. + * + * @since 5.2.0 + * + * @return bool True if the cookie is set, false otherwise. + */ + public function is_cookie_set() + { + } + /** + * Sets the recovery mode cookie. + * + * This must be immediately followed by exiting the request. + * + * @since 5.2.0 + */ + public function set_cookie() + { + } + /** + * Clears the recovery mode cookie. + * + * @since 5.2.0 + */ + public function clear_cookie() + { + } + /** + * Validates the recovery mode cookie. + * + * @since 5.2.0 + * + * @param string $cookie Optionally specify the cookie string. + * If omitted, it will be retrieved from the super global. + * @return true|WP_Error True on success, error object on failure. + */ + public function validate_cookie($cookie = '') + { + } + /** + * Gets the session identifier from the cookie. + * + * The cookie should be validated before calling this API. + * + * @since 5.2.0 + * + * @param string $cookie Optionally specify the cookie string. + * If omitted, it will be retrieved from the super global. + * @return string|WP_Error Session ID on success, or error object on failure. + */ + public function get_session_id_from_cookie($cookie = '') + { + } + } + /** + * Error Protection API: WP_Recovery_Mode_Email_Link class + * + * @package WordPress + * @since 5.2.0 + */ + /** + * Core class used to send an email with a link to begin Recovery Mode. + * + * @since 5.2.0 + */ + #[\AllowDynamicProperties] + final class WP_Recovery_Mode_Email_Service + { + const RATE_LIMIT_OPTION = 'recovery_mode_email_last_sent'; + /** + * WP_Recovery_Mode_Email_Service constructor. + * + * @since 5.2.0 + * + * @param WP_Recovery_Mode_Link_Service $link_service + */ + public function __construct(\WP_Recovery_Mode_Link_Service $link_service) + { + } + /** + * Sends the recovery mode email if the rate limit has not been sent. + * + * @since 5.2.0 + * + * @param int $rate_limit Number of seconds before another email can be sent. + * @param array $error Error details from `error_get_last()`. + * @param array $extension { + * The extension that caused the error. + * + * @type string $slug The extension slug. The plugin or theme's directory. + * @type string $type The extension type. Either 'plugin' or 'theme'. + * } + * @return true|WP_Error True if email sent, WP_Error otherwise. + * @phpstan-param array{ + * slug?: string, + * type?: string, + * } $extension + */ + public function maybe_send_recovery_mode_email($rate_limit, $error, $extension) + { + } + /** + * Clears the rate limit, allowing a new recovery mode email to be sent immediately. + * + * @since 5.2.0 + * + * @return bool True on success, false on failure. + */ + public function clear_rate_limit() + { + } + } + /** + * Error Protection API: WP_Recovery_Mode_Key_Service class + * + * @package WordPress + * @since 5.2.0 + */ + /** + * Core class used to generate and validate keys used to enter Recovery Mode. + * + * @since 5.2.0 + */ + #[\AllowDynamicProperties] + final class WP_Recovery_Mode_Key_Service + { + /** + * Creates a recovery mode token. + * + * @since 5.2.0 + * + * @return string A random string to identify its associated key in storage. + */ + public function generate_recovery_mode_token() + { + } + /** + * Creates a recovery mode key. + * + * @since 5.2.0 + * + * @global PasswordHash $wp_hasher Portable PHP password hashing framework instance. + * + * @param string $token A token generated by {@see generate_recovery_mode_token()}. + * @return string Recovery mode key. + */ + public function generate_and_store_recovery_mode_key($token) + { + } + /** + * Verifies if the recovery mode key is correct. + * + * Recovery mode keys can only be used once; the key will be consumed in the process. + * + * @since 5.2.0 + * + * @global PasswordHash $wp_hasher Portable PHP password hashing framework instance. + * + * @param string $token The token used when generating the given key. + * @param string $key The unhashed key. + * @param int $ttl Time in seconds for the key to be valid for. + * @return true|WP_Error True on success, error object on failure. + */ + public function validate_recovery_mode_key($token, $key, $ttl) + { + } + /** + * Removes expired recovery mode keys. + * + * @since 5.2.0 + * + * @param int $ttl Time in seconds for the keys to be valid for. + */ + public function clean_expired_keys($ttl) + { + } + } + /** + * Error Protection API: WP_Recovery_Mode_Link_Handler class + * + * @package WordPress + * @since 5.2.0 + */ + /** + * Core class used to generate and handle recovery mode links. + * + * @since 5.2.0 + */ + #[\AllowDynamicProperties] + class WP_Recovery_Mode_Link_Service + { + const LOGIN_ACTION_ENTER = 'enter_recovery_mode'; + const LOGIN_ACTION_ENTERED = 'entered_recovery_mode'; + /** + * WP_Recovery_Mode_Link_Service constructor. + * + * @since 5.2.0 + * + * @param WP_Recovery_Mode_Cookie_Service $cookie_service Service to handle setting the recovery mode cookie. + * @param WP_Recovery_Mode_Key_Service $key_service Service to handle generating recovery mode keys. + */ + public function __construct(\WP_Recovery_Mode_Cookie_Service $cookie_service, \WP_Recovery_Mode_Key_Service $key_service) + { + } + /** + * Generates a URL to begin recovery mode. + * + * Only one recovery mode URL can may be valid at the same time. + * + * @since 5.2.0 + * + * @return string Generated URL. + */ + public function generate_url() + { + } + /** + * Enters recovery mode when the user hits wp-login.php with a valid recovery mode link. + * + * @since 5.2.0 + * + * @global string $pagenow The filename of the current screen. + * + * @param int $ttl Number of seconds the link should be valid for. + * @phpstan-return void + */ + public function handle_begin_link($ttl) + { + } + } + /** + * Error Protection API: WP_Recovery_Mode class + * + * @package WordPress + * @since 5.2.0 + */ + /** + * Core class used to implement Recovery Mode. + * + * @since 5.2.0 + */ + #[\AllowDynamicProperties] + class WP_Recovery_Mode + { + const EXIT_ACTION = 'exit_recovery_mode'; + /** + * WP_Recovery_Mode constructor. + * + * @since 5.2.0 + */ + public function __construct() + { + } + /** + * Initialize recovery mode for the current request. + * + * @since 5.2.0 + * @phpstan-return void + */ + public function initialize() + { + } + /** + * Checks whether recovery mode is active. + * + * This will not change after recovery mode has been initialized. {@see WP_Recovery_Mode::run()}. + * + * @since 5.2.0 + * + * @return bool True if recovery mode is active, false otherwise. + */ + public function is_active() + { + } + /** + * Gets the recovery mode session ID. + * + * @since 5.2.0 + * + * @return string The session ID if recovery mode is active, empty string otherwise. + */ + public function get_session_id() + { + } + /** + * Checks whether recovery mode has been initialized. + * + * Recovery mode should not be used until this point. Initialization happens immediately before loading plugins. + * + * @since 5.2.0 + * + * @return bool + */ + public function is_initialized() + { + } + /** + * Handles a fatal error occurring. + * + * The calling API should immediately die() after calling this function. + * + * @since 5.2.0 + * + * @param array $error Error details from `error_get_last()`. + * @return true|WP_Error True if the error was handled and headers have already been sent. + * Or the request will exit to try and catch multiple errors at once. + * WP_Error if an error occurred preventing it from being handled. + */ + public function handle_error(array $error) + { + } + /** + * Ends the current recovery mode session. + * + * @since 5.2.0 + * + * @return bool True on success, false on failure. + */ + public function exit_recovery_mode() + { + } + /** + * Handles a request to exit Recovery Mode. + * + * @since 5.2.0 + * @phpstan-return void + */ + public function handle_exit_recovery_mode() + { + } + /** + * Cleans any recovery mode keys that have expired according to the link TTL. + * + * Executes on a daily cron schedule. + * + * @since 5.2.0 + */ + public function clean_expired_keys() + { + } + /** + * Handles checking for the recovery mode cookie and validating it. + * + * @since 5.2.0 + */ + protected function handle_cookie() + { + } + /** + * Gets the rate limit between sending new recovery mode email links. + * + * @since 5.2.0 + * + * @return int Rate limit in seconds. + */ + protected function get_email_rate_limit() + { + } + /** + * Gets the number of seconds the recovery mode link is valid for. + * + * @since 5.2.0 + * + * @return int Interval in seconds. + */ + protected function get_link_ttl() + { + } + /** + * Gets the extension that the error occurred in. + * + * @since 5.2.0 + * + * @global array $wp_theme_directories + * + * @param array $error Error details from `error_get_last()`. + * @return array|false { + * Extension details. + * + * @type string $slug The extension slug. This is the plugin or theme's directory. + * @type string $type The extension type. Either 'plugin' or 'theme'. + * } + * @phpstan-return false|array{ + * slug: string, + * type: string, + * } + */ + protected function get_extension_for_error($error) + { + } + /** + * Checks whether the given extension a network activated plugin. + * + * @since 5.2.0 + * + * @param array $extension Extension data. + * @return bool True if network plugin, false otherwise. + */ + protected function is_network_plugin($extension) + { + } + /** + * Stores the given error so that the extension causing it is paused. + * + * @since 5.2.0 + * + * @param array $error Error details from `error_get_last()`. + * @return bool True if the error was stored successfully, false otherwise. + */ + protected function store_error($error) + { + } + /** + * Redirects the current request to allow recovering multiple errors in one go. + * + * The redirection will only happen when on a protected endpoint. + * + * It must be ensured that this method is only called when an error actually occurred and will not occur on the + * next request again. Otherwise it will create a redirect loop. + * + * @since 5.2.0 + * @phpstan-return never + */ + protected function redirect_protected() + { + } + } + /** + * Rewrite API: WP_Rewrite class + * + * @package WordPress + * @subpackage Rewrite + * @since 1.5.0 + */ + /** + * Core class used to implement a rewrite component API. + * + * The WordPress Rewrite class writes the rewrite module rules to the .htaccess + * file. It also handles parsing the request to get the correct setup for the + * WordPress Query class. + * + * The Rewrite along with WP class function as a front controller for WordPress. + * You can add rules to trigger your page view and processing using this + * component. The full functionality of a front controller does not exist, + * meaning you can't define how the template files load based on the rewrite + * rules. + * + * @since 1.5.0 + */ + #[\AllowDynamicProperties] + class WP_Rewrite + { + /** + * Permalink structure for posts. + * + * @since 1.5.0 + * @var string + */ + public $permalink_structure; + /** + * Whether to add trailing slashes. + * + * @since 2.2.0 + * @var bool + */ + public $use_trailing_slashes; + /** + * Base for the author permalink structure (example.com/$author_base/authorname). + * + * @since 1.5.0 + * @var string + */ + public $author_base = 'author'; + /** + * Permalink structure for author archives. + * + * @since 1.5.0 + * @var string + */ + public $author_structure; + /** + * Permalink structure for date archives. + * + * @since 1.5.0 + * @var string + */ + public $date_structure; + /** + * Permalink structure for pages. + * + * @since 1.5.0 + * @var string + */ + public $page_structure; + /** + * Base of the search permalink structure (example.com/$search_base/query). + * + * @since 1.5.0 + * @var string + */ + public $search_base = 'search'; + /** + * Permalink structure for searches. + * + * @since 1.5.0 + * @var string + */ + public $search_structure; + /** + * Comments permalink base. + * + * @since 1.5.0 + * @var string + */ + public $comments_base = 'comments'; + /** + * Pagination permalink base. + * + * @since 3.1.0 + * @var string + */ + public $pagination_base = 'page'; + /** + * Comments pagination permalink base. + * + * @since 4.2.0 + * @var string + */ + public $comments_pagination_base = 'comment-page'; + /** + * Feed permalink base. + * + * @since 1.5.0 + * @var string + */ + public $feed_base = 'feed'; + /** + * Comments feed permalink structure. + * + * @since 1.5.0 + * @var string + */ + public $comment_feed_structure; + /** + * Feed request permalink structure. + * + * @since 1.5.0 + * @var string + */ + public $feed_structure; + /** + * The static portion of the post permalink structure. + * + * If the permalink structure is "/archive/%post_id%" then the front + * is "/archive/". If the permalink structure is "/%year%/%postname%/" + * then the front is "/". + * + * @since 1.5.0 + * @var string + * + * @see WP_Rewrite::init() + */ + public $front; + /** + * The prefix for all permalink structures. + * + * If PATHINFO/index permalinks are in use then the root is the value of + * `WP_Rewrite::$index` with a trailing slash appended. Otherwise the root + * will be empty. + * + * @since 1.5.0 + * @var string + * + * @see WP_Rewrite::init() + * @see WP_Rewrite::using_index_permalinks() + */ + public $root = ''; + /** + * The name of the index file which is the entry point to all requests. + * + * @since 1.5.0 + * @var string + */ + public $index = 'index.php'; + /** + * Variable name to use for regex matches in the rewritten query. + * + * @since 1.5.0 + * @var string + */ + public $matches = ''; + /** + * Rewrite rules to match against the request to find the redirect or query. + * + * @since 1.5.0 + * @var string[] + */ + public $rules; + /** + * Additional rules added external to the rewrite class. + * + * Those not generated by the class, see add_rewrite_rule(). + * + * @since 2.1.0 + * @var string[] + */ + public $extra_rules = array(); + /** + * Additional rules that belong at the beginning to match first. + * + * Those not generated by the class, see add_rewrite_rule(). + * + * @since 2.3.0 + * @var string[] + */ + public $extra_rules_top = array(); + /** + * Rules that don't redirect to WordPress' index.php. + * + * These rules are written to the mod_rewrite portion of the .htaccess, + * and are added by add_external_rule(). + * + * @since 2.1.0 + * @var string[] + */ + public $non_wp_rules = array(); + /** + * Extra permalink structures, e.g. categories, added by add_permastruct(). + * + * @since 2.1.0 + * @var array[] + */ + public $extra_permastructs = array(); + /** + * Endpoints (like /trackback/) added by add_rewrite_endpoint(). + * + * @since 2.1.0 + * @var array[] + */ + public $endpoints; + /** + * Whether to write every mod_rewrite rule for WordPress into the .htaccess file. + * + * This is off by default, turning it on might print a lot of rewrite rules + * to the .htaccess file. + * + * @since 2.0.0 + * @var bool + * + * @see WP_Rewrite::mod_rewrite_rules() + */ + public $use_verbose_rules = \false; + /** + * Could post permalinks be confused with those of pages? + * + * If the first rewrite tag in the post permalink structure is one that could + * also match a page name (e.g. %postname% or %author%) then this flag is + * set to true. Prior to WordPress 3.3 this flag indicated that every page + * would have a set of rules added to the top of the rewrite rules array. + * Now it tells WP::parse_request() to check if a URL matching the page + * permastruct is actually a page before accepting it. + * + * @since 2.5.0 + * @var bool + * + * @see WP_Rewrite::init() + */ + public $use_verbose_page_rules = \true; + /** + * Rewrite tags that can be used in permalink structures. + * + * These are translated into the regular expressions stored in + * `WP_Rewrite::$rewritereplace` and are rewritten to the query + * variables listed in WP_Rewrite::$queryreplace. + * + * Additional tags can be added with add_rewrite_tag(). + * + * @since 1.5.0 + * @var string[] + */ + public $rewritecode = array('%year%', '%monthnum%', '%day%', '%hour%', '%minute%', '%second%', '%postname%', '%post_id%', '%author%', '%pagename%', '%search%'); + /** + * Regular expressions to be substituted into rewrite rules in place + * of rewrite tags, see WP_Rewrite::$rewritecode. + * + * @since 1.5.0 + * @var string[] + */ + public $rewritereplace = array('([0-9]{4})', '([0-9]{1,2})', '([0-9]{1,2})', '([0-9]{1,2})', '([0-9]{1,2})', '([0-9]{1,2})', '([^/]+)', '([0-9]+)', '([^/]+)', '([^/]+?)', '(.+)'); + /** + * Query variables that rewrite tags map to, see WP_Rewrite::$rewritecode. + * + * @since 1.5.0 + * @var string[] + */ + public $queryreplace = array('year=', 'monthnum=', 'day=', 'hour=', 'minute=', 'second=', 'name=', 'p=', 'author_name=', 'pagename=', 's='); + /** + * Supported default feeds. + * + * @since 1.5.0 + * @var string[] + */ + public $feeds = array('feed', 'rdf', 'rss', 'rss2', 'atom'); + /** + * Determines whether permalinks are being used. + * + * This can be either rewrite module or permalink in the HTTP query string. + * + * @since 1.5.0 + * + * @return bool True, if permalinks are enabled. + */ + public function using_permalinks() + { + } + /** + * Determines whether permalinks are being used and rewrite module is not enabled. + * + * Means that permalink links are enabled and index.php is in the URL. + * + * @since 1.5.0 + * + * @return bool Whether permalink links are enabled and index.php is in the URL. + */ + public function using_index_permalinks() + { + } + /** + * Determines whether permalinks are being used and rewrite module is enabled. + * + * Using permalinks and index.php is not in the URL. + * + * @since 1.5.0 + * + * @return bool Whether permalink links are enabled and index.php is NOT in the URL. + */ + public function using_mod_rewrite_permalinks() + { + } + /** + * Indexes for matches for usage in preg_*() functions. + * + * The format of the string is, with empty matches property value, '$NUM'. + * The 'NUM' will be replaced with the value in the $number parameter. With + * the matches property not empty, the value of the returned string will + * contain that value of the matches property. The format then will be + * '$MATCHES[NUM]', with MATCHES as the value in the property and NUM the + * value of the $number parameter. + * + * @since 1.5.0 + * + * @param int $number Index number. + * @return string + */ + public function preg_index($number) + { + } + /** + * Retrieves all pages and attachments for pages URIs. + * + * The attachments are for those that have pages as parents and will be + * retrieved. + * + * @since 2.5.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return array Array of page URIs as first element and attachment URIs as second element. + */ + public function page_uri_index() + { + } + /** + * Retrieves all of the rewrite rules for pages. + * + * @since 1.5.0 + * + * @return string[] Page rewrite rules. + */ + public function page_rewrite_rules() + { + } + /** + * Retrieves date permalink structure, with year, month, and day. + * + * The permalink structure for the date, if not set already depends on the + * permalink structure. It can be one of three formats. The first is year, + * month, day; the second is day, month, year; and the last format is month, + * day, year. These are matched against the permalink structure for which + * one is used. If none matches, then the default will be used, which is + * year, month, day. + * + * Prevents post ID and date permalinks from overlapping. In the case of + * post_id, the date permalink will be prepended with front permalink with + * 'date/' before the actual permalink to form the complete date permalink + * structure. + * + * @since 1.5.0 + * + * @return string|false Date permalink structure on success, false on failure. + */ + public function get_date_permastruct() + { + } + /** + * Retrieves the year permalink structure without month and day. + * + * Gets the date permalink structure and strips out the month and day + * permalink structures. + * + * @since 1.5.0 + * + * @return string|false Year permalink structure on success, false on failure. + */ + public function get_year_permastruct() + { + } + /** + * Retrieves the month permalink structure without day and with year. + * + * Gets the date permalink structure and strips out the day permalink + * structures. Keeps the year permalink structure. + * + * @since 1.5.0 + * + * @return string|false Year/Month permalink structure on success, false on failure. + */ + public function get_month_permastruct() + { + } + /** + * Retrieves the day permalink structure with month and year. + * + * Keeps date permalink structure with all year, month, and day. + * + * @since 1.5.0 + * + * @return string|false Year/Month/Day permalink structure on success, false on failure. + */ + public function get_day_permastruct() + { + } + /** + * Retrieves the permalink structure for categories. + * + * If the category_base property has no value, then the category structure + * will have the front property value, followed by 'category', and finally + * '%category%'. If it does, then the root property will be used, along with + * the category_base property value. + * + * @since 1.5.0 + * + * @return string|false Category permalink structure on success, false on failure. + */ + public function get_category_permastruct() + { + } + /** + * Retrieves the permalink structure for tags. + * + * If the tag_base property has no value, then the tag structure will have + * the front property value, followed by 'tag', and finally '%tag%'. If it + * does, then the root property will be used, along with the tag_base + * property value. + * + * @since 2.3.0 + * + * @return string|false Tag permalink structure on success, false on failure. + */ + public function get_tag_permastruct() + { + } + /** + * Retrieves an extra permalink structure by name. + * + * @since 2.5.0 + * + * @param string $name Permalink structure name. + * @return string|false Permalink structure string on success, false on failure. + */ + public function get_extra_permastruct($name) + { + } + /** + * Retrieves the author permalink structure. + * + * The permalink structure is front property, author base, and finally + * '/%author%'. Will set the author_structure property and then return it + * without attempting to set the value again. + * + * @since 1.5.0 + * + * @return string|false Author permalink structure on success, false on failure. + */ + public function get_author_permastruct() + { + } + /** + * Retrieves the search permalink structure. + * + * The permalink structure is root property, search base, and finally + * '/%search%'. Will set the search_structure property and then return it + * without attempting to set the value again. + * + * @since 1.5.0 + * + * @return string|false Search permalink structure on success, false on failure. + */ + public function get_search_permastruct() + { + } + /** + * Retrieves the page permalink structure. + * + * The permalink structure is root property, and '%pagename%'. Will set the + * page_structure property and then return it without attempting to set the + * value again. + * + * @since 1.5.0 + * + * @return string|false Page permalink structure on success, false on failure. + */ + public function get_page_permastruct() + { + } + /** + * Retrieves the feed permalink structure. + * + * The permalink structure is root property, feed base, and finally + * '/%feed%'. Will set the feed_structure property and then return it + * without attempting to set the value again. + * + * @since 1.5.0 + * + * @return string|false Feed permalink structure on success, false on failure. + */ + public function get_feed_permastruct() + { + } + /** + * Retrieves the comment feed permalink structure. + * + * The permalink structure is root property, comment base property, feed + * base and finally '/%feed%'. Will set the comment_feed_structure property + * and then return it without attempting to set the value again. + * + * @since 1.5.0 + * + * @return string|false Comment feed permalink structure on success, false on failure. + */ + public function get_comment_feed_permastruct() + { + } + /** + * Adds or updates existing rewrite tags (e.g. %postname%). + * + * If the tag already exists, replace the existing pattern and query for + * that tag, otherwise add the new tag. + * + * @since 1.5.0 + * + * @see WP_Rewrite::$rewritecode + * @see WP_Rewrite::$rewritereplace + * @see WP_Rewrite::$queryreplace + * + * @param string $tag Name of the rewrite tag to add or update. + * @param string $regex Regular expression to substitute the tag for in rewrite rules. + * @param string $query String to append to the rewritten query. Must end in '='. + */ + public function add_rewrite_tag($tag, $regex, $query) + { + } + /** + * Removes an existing rewrite tag. + * + * @since 4.5.0 + * + * @see WP_Rewrite::$rewritecode + * @see WP_Rewrite::$rewritereplace + * @see WP_Rewrite::$queryreplace + * + * @param string $tag Name of the rewrite tag to remove. + */ + public function remove_rewrite_tag($tag) + { + } + /** + * Generates rewrite rules from a permalink structure. + * + * The main WP_Rewrite function for building the rewrite rule list. The + * contents of the function is a mix of black magic and regular expressions, + * so best just ignore the contents and move to the parameters. + * + * @since 1.5.0 + * + * @param string $permalink_structure The permalink structure. + * @param int $ep_mask Optional. Endpoint mask defining what endpoints are added to the structure. + * Accepts a mask of: + * - `EP_ALL` + * - `EP_NONE` + * - `EP_ALL_ARCHIVES` + * - `EP_ATTACHMENT` + * - `EP_AUTHORS` + * - `EP_CATEGORIES` + * - `EP_COMMENTS` + * - `EP_DATE` + * - `EP_DAY` + * - `EP_MONTH` + * - `EP_PAGES` + * - `EP_PERMALINK` + * - `EP_ROOT` + * - `EP_SEARCH` + * - `EP_TAGS` + * - `EP_YEAR` + * Default `EP_NONE`. + * @param bool $paged Optional. Whether archive pagination rules should be added for the structure. + * Default true. + * @param bool $feed Optional. Whether feed rewrite rules should be added for the structure. + * Default true. + * @param bool $forcomments Optional. Whether the feed rules should be a query for a comments feed. + * Default false. + * @param bool $walk_dirs Optional. Whether the 'directories' making up the structure should be walked + * over and rewrite rules built for each in-turn. Default true. + * @param bool $endpoints Optional. Whether endpoints should be applied to the generated rewrite rules. + * Default true. + * @return string[] Array of rewrite rules keyed by their regex pattern. + */ + public function generate_rewrite_rules($permalink_structure, $ep_mask = \EP_NONE, $paged = \true, $feed = \true, $forcomments = \false, $walk_dirs = \true, $endpoints = \true) + { + } + /** + * Generates rewrite rules with permalink structure and walking directory only. + * + * Shorten version of WP_Rewrite::generate_rewrite_rules() that allows for shorter + * list of parameters. See the method for longer description of what generating + * rewrite rules does. + * + * @since 1.5.0 + * + * @see WP_Rewrite::generate_rewrite_rules() See for long description and rest of parameters. + * + * @param string $permalink_structure The permalink structure to generate rules. + * @param bool $walk_dirs Optional. Whether to create list of directories to walk over. + * Default false. + * @return array An array of rewrite rules keyed by their regex pattern. + */ + public function generate_rewrite_rule($permalink_structure, $walk_dirs = \false) + { + } + /** + * Constructs rewrite matches and queries from permalink structure. + * + * Runs the action {@see 'generate_rewrite_rules'} with the parameter that is an + * reference to the current WP_Rewrite instance to further manipulate the + * permalink structures and rewrite rules. Runs the {@see 'rewrite_rules_array'} + * filter on the full rewrite rule array. + * + * There are two ways to manipulate the rewrite rules, one by hooking into + * the {@see 'generate_rewrite_rules'} action and gaining full control of the + * object or just manipulating the rewrite rule array before it is passed + * from the function. + * + * @since 1.5.0 + * + * @return string[] An associative array of matches and queries. + */ + public function rewrite_rules() + { + } + /** + * Retrieves the rewrite rules. + * + * The difference between this method and WP_Rewrite::rewrite_rules() is that + * this method stores the rewrite rules in the 'rewrite_rules' option and retrieves + * it. This prevents having to process all of the permalinks to get the rewrite rules + * in the form of caching. + * + * @since 1.5.0 + * + * @return string[] Array of rewrite rules keyed by their regex pattern. + */ + public function wp_rewrite_rules() + { + } + /** + * Retrieves mod_rewrite-formatted rewrite rules to write to .htaccess. + * + * Does not actually write to the .htaccess file, but creates the rules for + * the process that will. + * + * Will add the non_wp_rules property rules to the .htaccess file before + * the WordPress rewrite rules one. + * + * @since 1.5.0 + * + * @return string + */ + public function mod_rewrite_rules() + { + } + /** + * Retrieves IIS7 URL Rewrite formatted rewrite rules to write to web.config file. + * + * Does not actually write to the web.config file, but creates the rules for + * the process that will. + * + * @since 2.8.0 + * + * @param bool $add_parent_tags Optional. Whether to add parent tags to the rewrite rule sets. + * Default false. + * @return string IIS7 URL rewrite rule sets. + */ + public function iis7_url_rewrite_rules($add_parent_tags = \false) + { + } + /** + * Adds a rewrite rule that transforms a URL structure to a set of query vars. + * + * Any value in the $after parameter that isn't 'bottom' will result in the rule + * being placed at the top of the rewrite rules. + * + * @since 2.1.0 + * @since 4.4.0 Array support was added to the `$query` parameter. + * + * @param string $regex Regular expression to match request against. + * @param string|array $query The corresponding query vars for this rewrite rule. + * @param string $after Optional. Priority of the new rule. Accepts 'top' + * or 'bottom'. Default 'bottom'. + * @phpstan-param 'top'|'bottom' $after + */ + public function add_rule($regex, $query, $after = 'bottom') + { + } + /** + * Adds a rewrite rule that doesn't correspond to index.php. + * + * @since 2.1.0 + * + * @param string $regex Regular expression to match request against. + * @param string $query The corresponding query vars for this rewrite rule. + */ + public function add_external_rule($regex, $query) + { + } + /** + * Adds an endpoint, like /trackback/. + * + * @since 2.1.0 + * @since 3.9.0 $query_var parameter added. + * @since 4.3.0 Added support for skipping query var registration by passing `false` to `$query_var`. + * + * @see add_rewrite_endpoint() for full documentation. + * @global WP $wp Current WordPress environment instance. + * + * @param string $name Name of the endpoint. + * @param int $places Endpoint mask describing the places the endpoint should be added. + * Accepts a mask of: + * - `EP_ALL` + * - `EP_NONE` + * - `EP_ALL_ARCHIVES` + * - `EP_ATTACHMENT` + * - `EP_AUTHORS` + * - `EP_CATEGORIES` + * - `EP_COMMENTS` + * - `EP_DATE` + * - `EP_DAY` + * - `EP_MONTH` + * - `EP_PAGES` + * - `EP_PERMALINK` + * - `EP_ROOT` + * - `EP_SEARCH` + * - `EP_TAGS` + * - `EP_YEAR` + * @param string|bool $query_var Optional. Name of the corresponding query variable. Pass `false` to + * skip registering a query_var for this endpoint. Defaults to the + * value of `$name`. + */ + public function add_endpoint($name, $places, $query_var = \true) + { + } + /** + * Adds a new permalink structure. + * + * A permalink structure (permastruct) is an abstract definition of a set of rewrite rules; + * it is an easy way of expressing a set of regular expressions that rewrite to a set of + * query strings. The new permastruct is added to the WP_Rewrite::$extra_permastructs array. + * + * When the rewrite rules are built by WP_Rewrite::rewrite_rules(), all of these extra + * permastructs are passed to WP_Rewrite::generate_rewrite_rules() which transforms them + * into the regular expressions that many love to hate. + * + * The `$args` parameter gives you control over how WP_Rewrite::generate_rewrite_rules() + * works on the new permastruct. + * + * @since 2.5.0 + * + * @param string $name Name for permalink structure. + * @param string $struct Permalink structure (e.g. category/%category%) + * @param array $args { + * Optional. Arguments for building rewrite rules based on the permalink structure. + * Default empty array. + * + * @type bool $with_front Whether the structure should be prepended with `WP_Rewrite::$front`. + * Default true. + * @type int $ep_mask The endpoint mask defining which endpoints are added to the structure. + * Accepts a mask of: + * - `EP_ALL` + * - `EP_NONE` + * - `EP_ALL_ARCHIVES` + * - `EP_ATTACHMENT` + * - `EP_AUTHORS` + * - `EP_CATEGORIES` + * - `EP_COMMENTS` + * - `EP_DATE` + * - `EP_DAY` + * - `EP_MONTH` + * - `EP_PAGES` + * - `EP_PERMALINK` + * - `EP_ROOT` + * - `EP_SEARCH` + * - `EP_TAGS` + * - `EP_YEAR` + * Default `EP_NONE`. + * @type bool $paged Whether archive pagination rules should be added for the structure. + * Default true. + * @type bool $feed Whether feed rewrite rules should be added for the structure. Default true. + * @type bool $forcomments Whether the feed rules should be a query for a comments feed. Default false. + * @type bool $walk_dirs Whether the 'directories' making up the structure should be walked over + * and rewrite rules built for each in-turn. Default true. + * @type bool $endpoints Whether endpoints should be applied to the generated rules. Default true. + * } + * @phpstan-param array{ + * with_front?: bool, + * ep_mask?: int, + * paged?: bool, + * feed?: bool, + * forcomments?: bool, + * walk_dirs?: bool, + * endpoints?: bool, + * } $args + */ + public function add_permastruct($name, $struct, $args = array()) + { + } + /** + * Removes a permalink structure. + * + * @since 4.5.0 + * + * @param string $name Name for permalink structure. + */ + public function remove_permastruct($name) + { + } + /** + * Removes rewrite rules and then recreate rewrite rules. + * + * Calls WP_Rewrite::wp_rewrite_rules() after removing the 'rewrite_rules' option. + * If the function named 'save_mod_rewrite_rules' exists, it will be called. + * + * @since 2.0.1 + * + * @param bool $hard Whether to update .htaccess (hard flush) or just update rewrite_rules option (soft flush). Default is true (hard). + * @phpstan-return void + */ + public function flush_rules($hard = \true) + { + } + /** + * Sets up the object's properties. + * + * The 'use_verbose_page_rules' object property will be set to true if the + * permalink structure begins with one of the following: '%postname%', '%category%', + * '%tag%', or '%author%'. + * + * @since 1.5.0 + */ + public function init() + { + } + /** + * Sets the main permalink structure for the site. + * + * Will update the 'permalink_structure' option, if there is a difference + * between the current permalink structure and the parameter value. Calls + * WP_Rewrite::init() after the option is updated. + * + * Fires the {@see 'permalink_structure_changed'} action once the init call has + * processed passing the old and new values + * + * @since 1.5.0 + * + * @param string $permalink_structure Permalink structure. + */ + public function set_permalink_structure($permalink_structure) + { + } + /** + * Sets the category base for the category permalink. + * + * Will update the 'category_base' option, if there is a difference between + * the current category base and the parameter value. Calls WP_Rewrite::init() + * after the option is updated. + * + * @since 1.5.0 + * + * @param string $category_base Category permalink structure base. + */ + public function set_category_base($category_base) + { + } + /** + * Sets the tag base for the tag permalink. + * + * Will update the 'tag_base' option, if there is a difference between the + * current tag base and the parameter value. Calls WP_Rewrite::init() after + * the option is updated. + * + * @since 2.3.0 + * + * @param string $tag_base Tag permalink structure base. + */ + public function set_tag_base($tag_base) + { + } + /** + * Constructor - Calls init(), which runs setup. + * + * @since 1.5.0 + */ + public function __construct() + { + } + } + /** + * User API: WP_Role class + * + * @package WordPress + * @subpackage Users + * @since 4.4.0 + */ + /** + * Core class used to extend the user roles API. + * + * @since 2.0.0 + */ + #[\AllowDynamicProperties] + class WP_Role + { + /** + * Role name. + * + * @since 2.0.0 + * @var string + */ + public $name; + /** + * List of capabilities the role contains. + * + * @since 2.0.0 + * @var bool[] Array of key/value pairs where keys represent a capability name and boolean values + * represent whether the role has that capability. + */ + public $capabilities; + /** + * Constructor - Set up object properties. + * + * The list of capabilities must have the key as the name of the capability + * and the value a boolean of whether it is granted to the role. + * + * @since 2.0.0 + * + * @param string $role Role name. + * @param bool[] $capabilities Array of key/value pairs where keys represent a capability name and boolean values + * represent whether the role has that capability. + */ + public function __construct($role, $capabilities) + { + } + /** + * Assign role a capability. + * + * @since 2.0.0 + * + * @param string $cap Capability name. + * @param bool $grant Whether role has capability privilege. + */ + public function add_cap($cap, $grant = \true) + { + } + /** + * Removes a capability from a role. + * + * @since 2.0.0 + * + * @param string $cap Capability name. + */ + public function remove_cap($cap) + { + } + /** + * Determines whether the role has the given capability. + * + * @since 2.0.0 + * + * @param string $cap Capability name. + * @return bool Whether the role has the given capability. + */ + public function has_cap($cap) + { + } + } + /** + * User API: WP_Roles class + * + * @package WordPress + * @subpackage Users + * @since 4.4.0 + */ + /** + * Core class used to implement a user roles API. + * + * The role option is simple, the structure is organized by role name that store + * the name in value of the 'name' key. The capabilities are stored as an array + * in the value of the 'capability' key. + * + * array ( + * 'rolename' => array ( + * 'name' => 'rolename', + * 'capabilities' => array() + * ) + * ) + * + * @since 2.0.0 + */ + #[\AllowDynamicProperties] + class WP_Roles + { + /** + * List of roles and capabilities. + * + * @since 2.0.0 + * @var array[] + */ + public $roles; + /** + * List of the role objects. + * + * @since 2.0.0 + * @var WP_Role[] + */ + public $role_objects = array(); + /** + * List of role names. + * + * @since 2.0.0 + * @var string[] + */ + public $role_names = array(); + /** + * Option name for storing role list. + * + * @since 2.0.0 + * @var string + */ + public $role_key; + /** + * Whether to use the database for retrieval and storage. + * + * @since 2.1.0 + * @var bool + */ + public $use_db = \true; + /** + * The site ID the roles are initialized for. + * + * @since 4.9.0 + * @var int + */ + protected $site_id = 0; + /** + * Constructor. + * + * @since 2.0.0 + * @since 4.9.0 The `$site_id` argument was added. + * + * @global array $wp_user_roles Used to set the 'roles' property value. + * + * @param int $site_id Site ID to initialize roles for. Default is the current site. + */ + public function __construct($site_id = \null) + { + } + /** + * Makes private/protected methods readable for backward compatibility. + * + * @since 4.0.0 + * + * @param string $name Method to call. + * @param array $arguments Arguments to pass when calling. + * @return mixed|false Return value of the callback, false otherwise. + */ + public function __call($name, $arguments) + { + } + /** + * Sets up the object properties. + * + * The role key is set to the current prefix for the $wpdb object with + * 'user_roles' appended. If the $wp_user_roles global is set, then it will + * be used and the role option will not be updated or used. + * + * @since 2.1.0 + * @deprecated 4.9.0 Use WP_Roles::for_site() + */ + protected function _init() + { + } + /** + * Reinitializes the object. + * + * Recreates the role objects. This is typically called only by switch_to_blog() + * after switching wpdb to a new site ID. + * + * @since 3.5.0 + * @deprecated 4.7.0 Use WP_Roles::for_site() + */ + public function reinit() + { + } + /** + * Adds a role name with capabilities to the list. + * + * Updates the list of roles, if the role doesn't already exist. + * + * The capabilities are defined in the following format: `array( 'read' => true )`. + * To explicitly deny the role a capability, set the value for that capability to false. + * + * @since 2.0.0 + * + * @param string $role Role name. + * @param string $display_name Role display name. + * @param bool[] $capabilities Optional. List of capabilities keyed by the capability name, + * e.g. `array( 'edit_posts' => true, 'delete_posts' => false )`. + * Default empty array. + * @return WP_Role|void WP_Role object, if the role is added. + */ + public function add_role($role, $display_name, $capabilities = array()) + { + } + /** + * Removes a role by name. + * + * @since 2.0.0 + * + * @param string $role Role name. + * @phpstan-return void + */ + public function remove_role($role) + { + } + /** + * Adds a capability to role. + * + * @since 2.0.0 + * + * @param string $role Role name. + * @param string $cap Capability name. + * @param bool $grant Optional. Whether role is capable of performing capability. + * Default true. + * @phpstan-return void + */ + public function add_cap($role, $cap, $grant = \true) + { + } + /** + * Removes a capability from role. + * + * @since 2.0.0 + * + * @param string $role Role name. + * @param string $cap Capability name. + * @phpstan-return void + */ + public function remove_cap($role, $cap) + { + } + /** + * Retrieves a role object by name. + * + * @since 2.0.0 + * + * @param string $role Role name. + * @return WP_Role|null WP_Role object if found, null if the role does not exist. + */ + public function get_role($role) + { + } + /** + * Retrieves a list of role names. + * + * @since 2.0.0 + * + * @return string[] List of role names. + */ + public function get_names() + { + } + /** + * Determines whether a role name is currently in the list of available roles. + * + * @since 2.0.0 + * + * @param string $role Role name to look up. + * @return bool + */ + public function is_role($role) + { + } + /** + * Initializes all of the available roles. + * + * @since 4.9.0 + * @phpstan-return void + */ + public function init_roles() + { + } + /** + * Sets the site to operate on. Defaults to the current site. + * + * @since 4.9.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $site_id Site ID to initialize roles for. Default is the current site. + * @phpstan-return void + */ + public function for_site($site_id = \null) + { + } + /** + * Gets the ID of the site for which roles are currently initialized. + * + * @since 4.9.0 + * + * @return int Site ID. + */ + public function get_site_id() + { + } + /** + * Gets the available roles data. + * + * @since 4.9.0 + * + * @global array $wp_user_roles Used to set the 'roles' property value. + * + * @return array Roles array. + */ + protected function get_roles_data() + { + } + } + /** + * Script Modules API: WP_Script_Modules class. + * + * Native support for ES Modules and Import Maps. + * + * @package WordPress + * @subpackage Script Modules + */ + /** + * Core class used to register script modules. + * + * @since 6.5.0 + */ + class WP_Script_Modules + { + /** + * Registers the script module if no script module with that script module + * identifier has already been registered. + * + * @since 6.5.0 + * + * @param string $id The identifier of the script module. Should be unique. It will be used in the + * final import map. + * @param string $src Optional. Full URL of the script module, or path of the script module relative + * to the WordPress root directory. If it is provided and the script module has + * not been registered yet, it will be registered. + * @param array $deps { + * Optional. List of dependencies. + * + * @type string|array ...$0 { + * An array of script module identifiers of the dependencies of this script + * module. The dependencies can be strings or arrays. If they are arrays, + * they need an `id` key with the script module identifier, and can contain + * an `import` key with either `static` or `dynamic`. By default, + * dependencies that don't contain an `import` key are considered static. + * + * @type string $id The script module identifier. + * @type string $import Optional. Import type. May be either `static` or + * `dynamic`. Defaults to `static`. + * } + * } + * @param string|false|null $version Optional. String specifying the script module version number. Defaults to false. + * It is added to the URL as a query string for cache busting purposes. If $version + * is set to false, the version number is the currently installed WordPress version. + * If $version is set to null, no version is added. + * @phpstan-param array<int|string, array{ + * id: string, + * import?: string, + * }> $deps + */ + public function register(string $id, string $src, array $deps = array(), $version = \false) + { + } + /** + * Marks the script module to be enqueued in the page. + * + * If a src is provided and the script module has not been registered yet, it + * will be registered. + * + * @since 6.5.0 + * + * @param string $id The identifier of the script module. Should be unique. It will be used in the + * final import map. + * @param string $src Optional. Full URL of the script module, or path of the script module relative + * to the WordPress root directory. If it is provided and the script module has + * not been registered yet, it will be registered. + * @param array $deps { + * Optional. List of dependencies. + * + * @type string|array ...$0 { + * An array of script module identifiers of the dependencies of this script + * module. The dependencies can be strings or arrays. If they are arrays, + * they need an `id` key with the script module identifier, and can contain + * an `import` key with either `static` or `dynamic`. By default, + * dependencies that don't contain an `import` key are considered static. + * + * @type string $id The script module identifier. + * @type string $import Optional. Import type. May be either `static` or + * `dynamic`. Defaults to `static`. + * } + * } + * @param string|false|null $version Optional. String specifying the script module version number. Defaults to false. + * It is added to the URL as a query string for cache busting purposes. If $version + * is set to false, the version number is the currently installed WordPress version. + * If $version is set to null, no version is added. + * @phpstan-param array<int|string, array{ + * id: string, + * import?: string, + * }> $deps + */ + public function enqueue(string $id, string $src = '', array $deps = array(), $version = \false) + { + } + /** + * Unmarks the script module so it will no longer be enqueued in the page. + * + * @since 6.5.0 + * + * @param string $id The identifier of the script module. + */ + public function dequeue(string $id) + { + } + /** + * Removes a registered script module. + * + * @since 6.5.0 + * + * @param string $id The identifier of the script module. + */ + public function deregister(string $id) + { + } + /** + * Adds the hooks to print the import map, enqueued script modules and script + * module preloads. + * + * In classic themes, the script modules used by the blocks are not yet known + * when the `wp_head` actions is fired, so it needs to print everything in the + * footer. + * + * @since 6.5.0 + */ + public function add_hooks() + { + } + /** + * Prints the enqueued script modules using script tags with type="module" + * attributes. + * + * @since 6.5.0 + */ + public function print_enqueued_script_modules() + { + } + /** + * Prints the the static dependencies of the enqueued script modules using + * link tags with rel="modulepreload" attributes. + * + * If a script module is marked for enqueue, it will not be preloaded. + * + * @since 6.5.0 + */ + public function print_script_module_preloads() + { + } + /** + * Prints the import map using a script tag with a type="importmap" attribute. + * + * @since 6.5.0 + * + * @global WP_Scripts $wp_scripts The WP_Scripts object for printing the polyfill. + */ + public function print_import_map() + { + } + } + /** + * Dependencies API: WP_Scripts class + * + * @since 2.6.0 + * + * @package WordPress + * @subpackage Dependencies + */ + /** + * Core class used to register scripts. + * + * @since 2.1.0 + * + * @see WP_Dependencies + */ + class WP_Scripts extends \WP_Dependencies + { + /** + * Base URL for scripts. + * + * Full URL with trailing slash. + * + * @since 2.6.0 + * @var string + */ + public $base_url; + /** + * URL of the content directory. + * + * @since 2.8.0 + * @var string + */ + public $content_url; + /** + * Default version string for scripts. + * + * @since 2.6.0 + * @var string + */ + public $default_version; + /** + * Holds handles of scripts which are enqueued in footer. + * + * @since 2.8.0 + * @var array + */ + public $in_footer = array(); + /** + * Holds a list of script handles which will be concatenated. + * + * @since 2.8.0 + * @var string + */ + public $concat = ''; + /** + * Holds a string which contains script handles and their version. + * + * @since 2.8.0 + * @deprecated 3.4.0 + * @var string + */ + public $concat_version = ''; + /** + * Whether to perform concatenation. + * + * @since 2.8.0 + * @var bool + */ + public $do_concat = \false; + /** + * Holds HTML markup of scripts and additional data if concatenation + * is enabled. + * + * @since 2.8.0 + * @var string + */ + public $print_html = ''; + /** + * Holds inline code if concatenation is enabled. + * + * @since 2.8.0 + * @var string + */ + public $print_code = ''; + /** + * Holds a list of script handles which are not in the default directory + * if concatenation is enabled. + * + * Unused in core. + * + * @since 2.8.0 + * @var string + */ + public $ext_handles = ''; + /** + * Holds a string which contains handles and versions of scripts which + * are not in the default directory if concatenation is enabled. + * + * Unused in core. + * + * @since 2.8.0 + * @var string + */ + public $ext_version = ''; + /** + * List of default directories. + * + * @since 2.8.0 + * @var array + */ + public $default_dirs; + /** + * Constructor. + * + * @since 2.6.0 + */ + public function __construct() + { + } + /** + * Initialize the class. + * + * @since 3.4.0 + */ + public function init() + { + } + /** + * Prints scripts. + * + * Prints the scripts passed to it or the print queue. Also prints all necessary dependencies. + * + * @since 2.1.0 + * @since 2.8.0 Added the `$group` parameter. + * + * @param string|string[]|false $handles Optional. Scripts to be printed: queue (false), + * single script (string), or multiple scripts (array of strings). + * Default false. + * @param int|false $group Optional. Group level: level (int), no groups (false). + * Default false. + * @return string[] Handles of scripts that have been printed. + */ + public function print_scripts($handles = \false, $group = \false) + { + } + /** + * Prints extra scripts of a registered script. + * + * @since 2.1.0 + * @since 2.8.0 Added the `$display` parameter. + * @deprecated 3.3.0 + * + * @see print_extra_script() + * + * @param string $handle The script's registered handle. + * @param bool $display Optional. Whether to print the extra script + * instead of just returning it. Default true. + * @return bool|string|void Void if no data exists, extra scripts if `$display` is true, + * true otherwise. + */ + public function print_scripts_l10n($handle, $display = \true) + { + } + /** + * Prints extra scripts of a registered script. + * + * @since 3.3.0 + * + * @param string $handle The script's registered handle. + * @param bool $display Optional. Whether to print the extra script + * instead of just returning it. Default true. + * @return bool|string|void Void if no data exists, extra scripts if `$display` is true, + * true otherwise. + */ + public function print_extra_script($handle, $display = \true) + { + } + /** + * Processes a script dependency. + * + * @since 2.6.0 + * @since 2.8.0 Added the `$group` parameter. + * + * @see WP_Dependencies::do_item() + * + * @param string $handle The script's registered handle. + * @param int|false $group Optional. Group level: level (int), no groups (false). + * Default false. + * @return bool True on success, false on failure. + */ + public function do_item($handle, $group = \false) + { + } + /** + * Adds extra code to a registered script. + * + * @since 4.5.0 + * + * @param string $handle Name of the script to add the inline script to. + * Must be lowercase. + * @param string $data String containing the JavaScript to be added. + * @param string $position Optional. Whether to add the inline script + * before the handle or after. Default 'after'. + * @return bool True on success, false on failure. + */ + public function add_inline_script($handle, $data, $position = 'after') + { + } + /** + * Prints inline scripts registered for a specific handle. + * + * @since 4.5.0 + * @deprecated 6.3.0 Use methods get_inline_script_tag() or get_inline_script_data() instead. + * + * @param string $handle Name of the script to print inline scripts for. + * Must be lowercase. + * @param string $position Optional. Whether to add the inline script + * before the handle or after. Default 'after'. + * @param bool $display Optional. Whether to print the script tag + * instead of just returning the script data. Default true. + * @return string|false Script data on success, false otherwise. + */ + public function print_inline_script($handle, $position = 'after', $display = \true) + { + } + /** + * Gets data for inline scripts registered for a specific handle. + * + * @since 6.3.0 + * + * @param string $handle Name of the script to get data for. + * Must be lowercase. + * @param string $position Optional. Whether to add the inline script + * before the handle or after. Default 'after'. + * @return string Inline script, which may be empty string. + */ + public function get_inline_script_data($handle, $position = 'after') + { + } + /** + * Gets tags for inline scripts registered for a specific handle. + * + * @since 6.3.0 + * + * @param string $handle Name of the script to get associated inline script tag for. + * Must be lowercase. + * @param string $position Optional. Whether to get tag for inline + * scripts in the before or after position. Default 'after'. + * @return string Inline script, which may be empty string. + */ + public function get_inline_script_tag($handle, $position = 'after') + { + } + /** + * Localizes a script, only if the script has already been added. + * + * @since 2.1.0 + * + * @param string $handle Name of the script to attach data to. + * @param string $object_name Name of the variable that will contain the data. + * @param array $l10n Array of data to localize. + * @return bool True on success, false on failure. + */ + public function localize($handle, $object_name, $l10n) + { + } + /** + * Sets handle group. + * + * @since 2.8.0 + * + * @see WP_Dependencies::set_group() + * + * @param string $handle Name of the item. Should be unique. + * @param bool $recursion Internal flag that calling function was called recursively. + * @param int|false $group Optional. Group level: level (int), no groups (false). + * Default false. + * @return bool Not already in the group or a lower group. + */ + public function set_group($handle, $recursion, $group = \false) + { + } + /** + * Sets a translation textdomain. + * + * @since 5.0.0 + * @since 5.1.0 The `$domain` parameter was made optional. + * + * @param string $handle Name of the script to register a translation domain to. + * @param string $domain Optional. Text domain. Default 'default'. + * @param string $path Optional. The full file path to the directory containing translation files. + * @return bool True if the text domain was registered, false if not. + */ + public function set_translations($handle, $domain = 'default', $path = '') + { + } + /** + * Prints translations set for a specific handle. + * + * @since 5.0.0 + * + * @param string $handle Name of the script to add the inline script to. + * Must be lowercase. + * @param bool $display Optional. Whether to print the script + * instead of just returning it. Default true. + * @return string|false Script on success, false otherwise. + */ + public function print_translations($handle, $display = \true) + { + } + /** + * Determines script dependencies. + * + * @since 2.1.0 + * + * @see WP_Dependencies::all_deps() + * + * @param string|string[] $handles Item handle (string) or item handles (array of strings). + * @param bool $recursion Optional. Internal flag that function is calling itself. + * Default false. + * @param int|false $group Optional. Group level: level (int), no groups (false). + * Default false. + * @return bool True on success, false on failure. + */ + public function all_deps($handles, $recursion = \false, $group = \false) + { + } + /** + * Processes items and dependencies for the head group. + * + * @since 2.8.0 + * + * @see WP_Dependencies::do_items() + * + * @return string[] Handles of items that have been processed. + */ + public function do_head_items() + { + } + /** + * Processes items and dependencies for the footer group. + * + * @since 2.8.0 + * + * @see WP_Dependencies::do_items() + * + * @return string[] Handles of items that have been processed. + */ + public function do_footer_items() + { + } + /** + * Whether a handle's source is in a default directory. + * + * @since 2.8.0 + * + * @param string $src The source of the enqueued script. + * @return bool True if found, false if not. + */ + public function in_default_dir($src) + { + } + /** + * This overrides the add_data method from WP_Dependencies, to support normalizing of $args. + * + * @since 6.3.0 + * + * @param string $handle Name of the item. Should be unique. + * @param string $key The data key. + * @param mixed $value The data value. + * @return bool True on success, false on failure. + */ + public function add_data($handle, $key, $value) + { + } + /** + * Resets class properties. + * + * @since 2.8.0 + */ + public function reset() + { + } + } + /** + * Session API: WP_Session_Tokens class + * + * @package WordPress + * @subpackage Session + * @since 4.7.0 + */ + /** + * Abstract class for managing user session tokens. + * + * @since 4.0.0 + */ + #[\AllowDynamicProperties] + abstract class WP_Session_Tokens + { + /** + * User ID. + * + * @since 4.0.0 + * @var int User ID. + */ + protected $user_id; + /** + * Protected constructor. Use the `get_instance()` method to get the instance. + * + * @since 4.0.0 + * + * @param int $user_id User whose session to manage. + */ + protected function __construct($user_id) + { + } + /** + * Retrieves a session manager instance for a user. + * + * This method contains a {@see 'session_token_manager'} filter, allowing a plugin to swap out + * the session manager for a subclass of `WP_Session_Tokens`. + * + * @since 4.0.0 + * + * @param int $user_id User whose session to manage. + * @return WP_Session_Tokens The session object, which is by default an instance of + * the `WP_User_Meta_Session_Tokens` class. + */ + public static final function get_instance($user_id) + { + } + /** + * Retrieves a user's session for the given token. + * + * @since 4.0.0 + * + * @param string $token Session token. + * @return array|null The session, or null if it does not exist. + */ + public final function get($token) + { + } + /** + * Validates the given session token for authenticity and validity. + * + * Checks that the given token is present and hasn't expired. + * + * @since 4.0.0 + * + * @param string $token Token to verify. + * @return bool Whether the token is valid for the user. + */ + public final function verify($token) + { + } + /** + * Generates a session token and attaches session information to it. + * + * A session token is a long, random string. It is used in a cookie + * to link that cookie to an expiration time and to ensure the cookie + * becomes invalidated when the user logs out. + * + * This function generates a token and stores it with the associated + * expiration time (and potentially other session information via the + * {@see 'attach_session_information'} filter). + * + * @since 4.0.0 + * + * @param int $expiration Session expiration timestamp. + * @return string Session token. + */ + public final function create($expiration) + { + } + /** + * Updates the data for the session with the given token. + * + * @since 4.0.0 + * + * @param string $token Session token to update. + * @param array $session Session information. + */ + public final function update($token, $session) + { + } + /** + * Destroys the session with the given token. + * + * @since 4.0.0 + * + * @param string $token Session token to destroy. + */ + public final function destroy($token) + { + } + /** + * Destroys all sessions for this user except the one with the given token (presumably the one in use). + * + * @since 4.0.0 + * + * @param string $token_to_keep Session token to keep. + */ + public final function destroy_others($token_to_keep) + { + } + /** + * Determines whether a session is still valid, based on its expiration timestamp. + * + * @since 4.0.0 + * + * @param array $session Session to check. + * @return bool Whether session is valid. + */ + protected final function is_still_valid($session) + { + } + /** + * Destroys all sessions for a user. + * + * @since 4.0.0 + */ + public final function destroy_all() + { + } + /** + * Destroys all sessions for all users. + * + * @since 4.0.0 + */ + public static final function destroy_all_for_all_users() + { + } + /** + * Retrieves all sessions for a user. + * + * @since 4.0.0 + * + * @return array Sessions for a user. + */ + public final function get_all() + { + } + /** + * Retrieves all sessions of the user. + * + * @since 4.0.0 + * + * @return array Sessions of the user. + */ + protected abstract function get_sessions(); + /** + * Retrieves a session based on its verifier (token hash). + * + * @since 4.0.0 + * + * @param string $verifier Verifier for the session to retrieve. + * @return array|null The session, or null if it does not exist. + */ + protected abstract function get_session($verifier); + /** + * Updates a session based on its verifier (token hash). + * + * Omitting the second argument destroys the session. + * + * @since 4.0.0 + * + * @param string $verifier Verifier for the session to update. + * @param array $session Optional. Session. Omitting this argument destroys the session. + */ + protected abstract function update_session($verifier, $session = \null); + /** + * Destroys all sessions for this user, except the single session with the given verifier. + * + * @since 4.0.0 + * + * @param string $verifier Verifier of the session to keep. + */ + protected abstract function destroy_other_sessions($verifier); + /** + * Destroys all sessions for the user. + * + * @since 4.0.0 + */ + protected abstract function destroy_all_sessions(); + /** + * Destroys all sessions for all users. + * + * @since 4.0.0 + */ + public static function drop_sessions() + { + } + } + /** + * Feed API: WP_SimplePie_File class + * + * @package WordPress + * @subpackage Feed + * @since 4.7.0 + */ + /** + * Core class for fetching remote files and reading local files with SimplePie. + * + * This uses Core's HTTP API to make requests, which gives plugins the ability + * to hook into the process. + * + * @since 2.8.0 + */ + #[\AllowDynamicProperties] + class WP_SimplePie_File extends \SimplePie_File + { + /** + * Timeout. + * + * @var int How long the connection should stay open in seconds. + */ + public $timeout = 10; + /** + * Constructor. + * + * @since 2.8.0 + * @since 3.2.0 Updated to use a PHP5 constructor. + * @since 5.6.1 Multiple headers are concatenated into a comma-separated string, + * rather than remaining an array. + * + * @param string $url Remote file URL. + * @param int $timeout Optional. How long the connection should stay open in seconds. + * Default 10. + * @param int $redirects Optional. The number of allowed redirects. Default 5. + * @param string|array $headers Optional. Array or string of headers to send with the request. + * Default null. + * @param string $useragent Optional. User-agent value sent. Default null. + * @param bool $force_fsockopen Optional. Whether to force opening internet or unix domain socket + * connection or not. Default false. + */ + public function __construct($url, $timeout = 10, $redirects = 5, $headers = \null, $useragent = \null, $force_fsockopen = \false) + { + } + } + /** + * Feed API: WP_SimplePie_Sanitize_KSES class + * + * @package WordPress + * @subpackage Feed + * @since 4.7.0 + */ + /** + * Core class used to implement SimplePie feed sanitization. + * + * Extends the SimplePie_Sanitize class to use KSES, because + * we cannot universally count on DOMDocument being available. + * + * @since 3.5.0 + */ + #[\AllowDynamicProperties] + class WP_SimplePie_Sanitize_KSES extends \SimplePie_Sanitize + { + /** + * WordPress SimplePie sanitization using KSES. + * + * Sanitizes the incoming data, to ensure that it matches the type of data expected, using KSES. + * + * @since 3.5.0 + * + * @param mixed $data The data that needs to be sanitized. + * @param int $type The type of data that it's supposed to be. + * @param string $base Optional. The `xml:base` value to use when converting relative + * URLs to absolute ones. Default empty. + * @return mixed Sanitized data. + */ + public function sanitize($data, $type, $base = '') + { + } + } + /** + * Site API: WP_Site_Query class + * + * @package WordPress + * @subpackage Sites + * @since 4.6.0 + */ + /** + * Core class used for querying sites. + * + * @since 4.6.0 + * + * @see WP_Site_Query::__construct() for accepted arguments. + */ + #[\AllowDynamicProperties] + class WP_Site_Query + { + /** + * SQL for database query. + * + * @since 4.6.0 + * @var string + */ + public $request; + /** + * SQL query clauses. + * + * @since 4.6.0 + * @var array + */ + protected $sql_clauses = array('select' => '', 'from' => '', 'where' => array(), 'groupby' => '', 'orderby' => '', 'limits' => ''); + /** + * Metadata query container. + * + * @since 5.1.0 + * @var WP_Meta_Query + */ + public $meta_query = \false; + /** + * Metadata query clauses. + * + * @since 5.1.0 + * @var array + */ + protected $meta_query_clauses; + /** + * Date query container. + * + * @since 4.6.0 + * @var WP_Date_Query A date query instance. + */ + public $date_query = \false; + /** + * Query vars set by the user. + * + * @since 4.6.0 + * @var array + */ + public $query_vars; + /** + * Default values for query vars. + * + * @since 4.6.0 + * @var array + */ + public $query_var_defaults; + /** + * List of sites located by the query. + * + * @since 4.6.0 + * @var array + */ + public $sites; + /** + * The amount of found sites for the current query. + * + * @since 4.6.0 + * @var int + */ + public $found_sites = 0; + /** + * The number of pages. + * + * @since 4.6.0 + * @var int + */ + public $max_num_pages = 0; + /** + * Sets up the site query, based on the query vars passed. + * + * @since 4.6.0 + * @since 4.8.0 Introduced the 'lang_id', 'lang__in', and 'lang__not_in' parameters. + * @since 5.1.0 Introduced the 'update_site_meta_cache', 'meta_query', 'meta_key', + * 'meta_compare_key', 'meta_value', 'meta_type', and 'meta_compare' parameters. + * @since 5.3.0 Introduced the 'meta_type_key' parameter. + * + * @param string|array $query { + * Optional. Array or query string of site query parameters. Default empty. + * + * @type int[] $site__in Array of site IDs to include. Default empty. + * @type int[] $site__not_in Array of site IDs to exclude. Default empty. + * @type bool $count Whether to return a site count (true) or array of site objects. + * Default false. + * @type array $date_query Date query clauses to limit sites by. See WP_Date_Query. + * Default null. + * @type string $fields Site fields to return. Accepts 'ids' (returns an array of site IDs) + * or empty (returns an array of complete site objects). Default empty. + * @type int $ID A site ID to only return that site. Default empty. + * @type int $number Maximum number of sites to retrieve. Default 100. + * @type int $offset Number of sites to offset the query. Used to build LIMIT clause. + * Default 0. + * @type bool $no_found_rows Whether to disable the `SQL_CALC_FOUND_ROWS` query. Default true. + * @type string|array $orderby Site status or array of statuses. Accepts: + * - 'id' + * - 'domain' + * - 'path' + * - 'network_id' + * - 'last_updated' + * - 'registered' + * - 'domain_length' + * - 'path_length' + * - 'site__in' + * - 'network__in' + * - 'deleted' + * - 'mature' + * - 'spam' + * - 'archived' + * - 'public' + * - false, an empty array, or 'none' to disable `ORDER BY` clause. + * Default 'id'. + * @type string $order How to order retrieved sites. Accepts 'ASC', 'DESC'. Default 'ASC'. + * @type int $network_id Limit results to those affiliated with a given network ID. If 0, + * include all networks. Default 0. + * @type int[] $network__in Array of network IDs to include affiliated sites for. Default empty. + * @type int[] $network__not_in Array of network IDs to exclude affiliated sites for. Default empty. + * @type string $domain Limit results to those affiliated with a given domain. Default empty. + * @type string[] $domain__in Array of domains to include affiliated sites for. Default empty. + * @type string[] $domain__not_in Array of domains to exclude affiliated sites for. Default empty. + * @type string $path Limit results to those affiliated with a given path. Default empty. + * @type string[] $path__in Array of paths to include affiliated sites for. Default empty. + * @type string[] $path__not_in Array of paths to exclude affiliated sites for. Default empty. + * @type int $public Limit results to public sites. Accepts 1 or 0. Default empty. + * @type int $archived Limit results to archived sites. Accepts 1 or 0. Default empty. + * @type int $mature Limit results to mature sites. Accepts 1 or 0. Default empty. + * @type int $spam Limit results to spam sites. Accepts 1 or 0. Default empty. + * @type int $deleted Limit results to deleted sites. Accepts 1 or 0. Default empty. + * @type int $lang_id Limit results to a language ID. Default empty. + * @type string[] $lang__in Array of language IDs to include affiliated sites for. Default empty. + * @type string[] $lang__not_in Array of language IDs to exclude affiliated sites for. Default empty. + * @type string $search Search term(s) to retrieve matching sites for. Default empty. + * @type string[] $search_columns Array of column names to be searched. Accepts 'domain' and 'path'. + * Default empty array. + * @type bool $update_site_cache Whether to prime the cache for found sites. Default true. + * @type bool $update_site_meta_cache Whether to prime the metadata cache for found sites. Default true. + * @type string|string[] $meta_key Meta key or keys to filter by. + * @type string|string[] $meta_value Meta value or values to filter by. + * @type string $meta_compare MySQL operator used for comparing the meta value. + * See WP_Meta_Query::__construct() for accepted values and default value. + * @type string $meta_compare_key MySQL operator used for comparing the meta key. + * See WP_Meta_Query::__construct() for accepted values and default value. + * @type string $meta_type MySQL data type that the meta_value column will be CAST to for comparisons. + * See WP_Meta_Query::__construct() for accepted values and default value. + * @type string $meta_type_key MySQL data type that the meta_key column will be CAST to for comparisons. + * See WP_Meta_Query::__construct() for accepted values and default value. + * @type array $meta_query An associative array of WP_Meta_Query arguments. + * See WP_Meta_Query::__construct() for accepted values. + * } + * @phpstan-param array{ + * site__in?: int[], + * site__not_in?: int[], + * count?: bool, + * date_query?: array, + * fields?: string, + * ID?: int, + * number?: int, + * offset?: int, + * no_found_rows?: bool, + * orderby?: string|array, + * order?: string, + * network_id?: int, + * network__in?: int[], + * network__not_in?: int[], + * domain?: string, + * domain__in?: string[], + * domain__not_in?: string[], + * path?: string, + * path__in?: string[], + * path__not_in?: string[], + * public?: int, + * archived?: int, + * mature?: int, + * spam?: int, + * deleted?: int, + * lang_id?: int, + * lang__in?: string[], + * lang__not_in?: string[], + * search?: string, + * search_columns?: string[], + * update_site_cache?: bool, + * update_site_meta_cache?: bool, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * } $query + */ + public function __construct($query = '') + { + } + /** + * Parses arguments passed to the site query with default query parameters. + * + * @since 4.6.0 + * + * @see WP_Site_Query::__construct() + * + * @param string|array $query Array or string of WP_Site_Query arguments. See WP_Site_Query::__construct(). + * @phpstan-param array{ + * site__in?: int[], + * site__not_in?: int[], + * count?: bool, + * date_query?: array, + * fields?: string, + * ID?: int, + * number?: int, + * offset?: int, + * no_found_rows?: bool, + * orderby?: string|array, + * order?: string, + * network_id?: int, + * network__in?: int[], + * network__not_in?: int[], + * domain?: string, + * domain__in?: string[], + * domain__not_in?: string[], + * path?: string, + * path__in?: string[], + * path__not_in?: string[], + * public?: int, + * archived?: int, + * mature?: int, + * spam?: int, + * deleted?: int, + * lang_id?: int, + * lang__in?: string[], + * lang__not_in?: string[], + * search?: string, + * search_columns?: string[], + * update_site_cache?: bool, + * update_site_meta_cache?: bool, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * } $query See WP_Site_Query::__construct() + */ + public function parse_query($query = '') + { + } + /** + * Sets up the WordPress query for retrieving sites. + * + * @since 4.6.0 + * + * @param string|array $query Array or URL query string of parameters. + * @return array|int List of WP_Site objects, a list of site IDs when 'fields' is set to 'ids', + * or the number of sites when 'count' is passed as a query var. + */ + public function query($query) + { + } + /** + * Retrieves a list of sites matching the query vars. + * + * @since 4.6.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return array|int List of WP_Site objects, a list of site IDs when 'fields' is set to 'ids', + * or the number of sites when 'count' is passed as a query var. + */ + public function get_sites() + { + } + /** + * Used internally to get a list of site IDs matching the query vars. + * + * @since 4.6.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return int|array A single count of site IDs if a count query. An array of site IDs if a full query. + */ + protected function get_site_ids() + { + } + /** + * Used internally to generate an SQL string for searching across multiple columns. + * + * @since 4.6.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $search Search string. + * @param string[] $columns Array of columns to search. + * @return string Search SQL. + */ + protected function get_search_sql($search, $columns) + { + } + /** + * Parses and sanitizes 'orderby' keys passed to the site query. + * + * @since 4.6.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $orderby Alias for the field to order by. + * @return string|false Value to used in the ORDER clause. False otherwise. + */ + protected function parse_orderby($orderby) + { + } + /** + * Parses an 'order' query variable and cast it to 'ASC' or 'DESC' as necessary. + * + * @since 4.6.0 + * + * @param string $order The 'order' query variable. + * @return string The sanitized 'order' query variable. + */ + protected function parse_order($order) + { + } + } + /** + * Site API: WP_Site class + * + * @package WordPress + * @subpackage Multisite + * @since 4.5.0 + */ + /** + * Core class used for interacting with a multisite site. + * + * This class is used during load to populate the `$current_blog` global and + * setup the current site. + * + * @since 4.5.0 + * + * @property int $id + * @property int $network_id + * @property string $blogname + * @property string $siteurl + * @property int $post_count + * @property string $home + */ + #[\AllowDynamicProperties] + final class WP_Site + { + /** + * Site ID. + * + * Named "blog" vs. "site" for legacy reasons. + * + * A numeric string, for compatibility reasons. + * + * @since 4.5.0 + * @var string + */ + public $blog_id; + /** + * Domain of the site. + * + * @since 4.5.0 + * @var string + */ + public $domain = ''; + /** + * Path of the site. + * + * @since 4.5.0 + * @var string + */ + public $path = ''; + /** + * The ID of the site's parent network. + * + * Named "site" vs. "network" for legacy reasons. An individual site's "site" is + * its network. + * + * A numeric string, for compatibility reasons. + * + * @since 4.5.0 + * @var string + */ + public $site_id = '0'; + /** + * The date and time on which the site was created or registered. + * + * @since 4.5.0 + * @var string Date in MySQL's datetime format. + */ + public $registered = '0000-00-00 00:00:00'; + /** + * The date and time on which site settings were last updated. + * + * @since 4.5.0 + * @var string Date in MySQL's datetime format. + */ + public $last_updated = '0000-00-00 00:00:00'; + /** + * Whether the site should be treated as public. + * + * A numeric string, for compatibility reasons. + * + * @since 4.5.0 + * @var string + */ + public $public = '1'; + /** + * Whether the site should be treated as archived. + * + * A numeric string, for compatibility reasons. + * + * @since 4.5.0 + * @var string + */ + public $archived = '0'; + /** + * Whether the site should be treated as mature. + * + * Handling for this does not exist throughout WordPress core, but custom + * implementations exist that require the property to be present. + * + * A numeric string, for compatibility reasons. + * + * @since 4.5.0 + * @var string + */ + public $mature = '0'; + /** + * Whether the site should be treated as spam. + * + * A numeric string, for compatibility reasons. + * + * @since 4.5.0 + * @var string + */ + public $spam = '0'; + /** + * Whether the site should be treated as deleted. + * + * A numeric string, for compatibility reasons. + * + * @since 4.5.0 + * @var string + */ + public $deleted = '0'; + /** + * The language pack associated with this site. + * + * A numeric string, for compatibility reasons. + * + * @since 4.5.0 + * @var string + */ + public $lang_id = '0'; + /** + * Retrieves a site from the database by its ID. + * + * @since 4.5.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $site_id The ID of the site to retrieve. + * @return WP_Site|false The site's object if found. False if not. + */ + public static function get_instance($site_id) + { + } + /** + * Creates a new WP_Site object. + * + * Will populate object properties from the object provided and assign other + * default properties based on that information. + * + * @since 4.5.0 + * + * @param WP_Site|object $site A site object. + */ + public function __construct($site) + { + } + /** + * Converts an object to array. + * + * @since 4.6.0 + * + * @return array Object as array. + */ + public function to_array() + { + } + /** + * Getter. + * + * Allows current multisite naming conventions when getting properties. + * Allows access to extended site properties. + * + * @since 4.6.0 + * + * @param string $key Property to get. + * @return mixed Value of the property. Null if not available. + */ + public function __get($key) + { + } + /** + * Isset-er. + * + * Allows current multisite naming conventions when checking for properties. + * Checks for extended site properties. + * + * @since 4.6.0 + * + * @param string $key Property to check if set. + * @return bool Whether the property is set. + */ + public function __isset($key) + { + } + /** + * Setter. + * + * Allows current multisite naming conventions while setting properties. + * + * @since 4.6.0 + * + * @param string $key Property to set. + * @param mixed $value Value to assign to the property. + */ + public function __set($key, $value) + { + } + } + /** + * Dependencies API: WP_Styles class + * + * @since 2.6.0 + * + * @package WordPress + * @subpackage Dependencies + */ + /** + * Core class used to register styles. + * + * @since 2.6.0 + * + * @see WP_Dependencies + */ + class WP_Styles extends \WP_Dependencies + { + /** + * Base URL for styles. + * + * Full URL with trailing slash. + * + * @since 2.6.0 + * @var string + */ + public $base_url; + /** + * URL of the content directory. + * + * @since 2.8.0 + * @var string + */ + public $content_url; + /** + * Default version string for stylesheets. + * + * @since 2.6.0 + * @var string + */ + public $default_version; + /** + * The current text direction. + * + * @since 2.6.0 + * @var string + */ + public $text_direction = 'ltr'; + /** + * Holds a list of style handles which will be concatenated. + * + * @since 2.8.0 + * @var string + */ + public $concat = ''; + /** + * Holds a string which contains style handles and their version. + * + * @since 2.8.0 + * @deprecated 3.4.0 + * @var string + */ + public $concat_version = ''; + /** + * Whether to perform concatenation. + * + * @since 2.8.0 + * @var bool + */ + public $do_concat = \false; + /** + * Holds HTML markup of styles and additional data if concatenation + * is enabled. + * + * @since 2.8.0 + * @var string + */ + public $print_html = ''; + /** + * Holds inline styles if concatenation is enabled. + * + * @since 3.3.0 + * @var string + */ + public $print_code = ''; + /** + * List of default directories. + * + * @since 2.8.0 + * @var array + */ + public $default_dirs; + /** + * Constructor. + * + * @since 2.6.0 + */ + public function __construct() + { + } + /** + * Processes a style dependency. + * + * @since 2.6.0 + * @since 5.5.0 Added the `$group` parameter. + * + * @see WP_Dependencies::do_item() + * + * @param string $handle The style's registered handle. + * @param int|false $group Optional. Group level: level (int), no groups (false). + * Default false. + * @return bool True on success, false on failure. + */ + public function do_item($handle, $group = \false) + { + } + /** + * Adds extra CSS styles to a registered stylesheet. + * + * @since 3.3.0 + * + * @param string $handle The style's registered handle. + * @param string $code String containing the CSS styles to be added. + * @return bool True on success, false on failure. + */ + public function add_inline_style($handle, $code) + { + } + /** + * Prints extra CSS styles of a registered stylesheet. + * + * @since 3.3.0 + * + * @param string $handle The style's registered handle. + * @param bool $display Optional. Whether to print the inline style + * instead of just returning it. Default true. + * @return string|bool False if no data exists, inline styles if `$display` is true, + * true otherwise. + */ + public function print_inline_style($handle, $display = \true) + { + } + /** + * Determines style dependencies. + * + * @since 2.6.0 + * + * @see WP_Dependencies::all_deps() + * + * @param string|string[] $handles Item handle (string) or item handles (array of strings). + * @param bool $recursion Optional. Internal flag that function is calling itself. + * Default false. + * @param int|false $group Optional. Group level: level (int), no groups (false). + * Default false. + * @return bool True on success, false on failure. + */ + public function all_deps($handles, $recursion = \false, $group = \false) + { + } + /** + * Generates an enqueued style's fully-qualified URL. + * + * @since 2.6.0 + * + * @param string $src The source of the enqueued style. + * @param string $ver The version of the enqueued style. + * @param string $handle The style's registered handle. + * @return string Style's fully-qualified URL. + */ + public function _css_href($src, $ver, $handle) + { + } + /** + * Whether a handle's source is in a default directory. + * + * @since 2.8.0 + * + * @param string $src The source of the enqueued style. + * @return bool True if found, false if not. + */ + public function in_default_dir($src) + { + } + /** + * Processes items and dependencies for the footer group. + * + * HTML 5 allows styles in the body, grab late enqueued items and output them in the footer. + * + * @since 3.3.0 + * + * @see WP_Dependencies::do_items() + * + * @return string[] Handles of items that have been processed. + */ + public function do_footer_items() + { + } + /** + * Resets class properties. + * + * @since 3.3.0 + */ + public function reset() + { + } + } + /** + * Taxonomy API: WP_Tax_Query class + * + * @package WordPress + * @subpackage Taxonomy + * @since 4.4.0 + */ + /** + * Core class used to implement taxonomy queries for the Taxonomy API. + * + * Used for generating SQL clauses that filter a primary query according to object + * taxonomy terms. + * + * WP_Tax_Query is a helper that allows primary query classes, such as WP_Query, to filter + * their results by object metadata, by generating `JOIN` and `WHERE` subclauses to be + * attached to the primary SQL query string. + * + * @since 3.1.0 + */ + #[\AllowDynamicProperties] + class WP_Tax_Query + { + /** + * Array of taxonomy queries. + * + * See WP_Tax_Query::__construct() for information on tax query arguments. + * + * @since 3.1.0 + * @var array + */ + public $queries = array(); + /** + * The relation between the queries. Can be one of 'AND' or 'OR'. + * + * @since 3.1.0 + * @var string + */ + public $relation; + /** + * A flat list of table aliases used in the JOIN clauses. + * + * @since 4.1.0 + * @var array + */ + protected $table_aliases = array(); + /** + * Terms and taxonomies fetched by this query. + * + * We store this data in a flat array because they are referenced in a + * number of places by WP_Query. + * + * @since 4.1.0 + * @var array + */ + public $queried_terms = array(); + /** + * Database table that where the metadata's objects are stored (eg $wpdb->users). + * + * @since 4.1.0 + * @var string + */ + public $primary_table; + /** + * Column in 'primary_table' that represents the ID of the object. + * + * @since 4.1.0 + * @var string + */ + public $primary_id_column; + /** + * Constructor. + * + * @since 3.1.0 + * @since 4.1.0 Added support for `$operator` 'NOT EXISTS' and 'EXISTS' values. + * + * @param array $tax_query { + * Array of taxonomy query clauses. + * + * @type string $relation Optional. The MySQL keyword used to join + * the clauses of the query. Accepts 'AND', or 'OR'. Default 'AND'. + * @type array ...$0 { + * An array of first-order clause parameters, or another fully-formed tax query. + * + * @type string $taxonomy Taxonomy being queried. Optional when field=term_taxonomy_id. + * @type string|int|array $terms Term or terms to filter by. + * @type string $field Field to match $terms against. Accepts 'term_id', 'slug', + * 'name', or 'term_taxonomy_id'. Default: 'term_id'. + * @type string $operator MySQL operator to be used with $terms in the WHERE clause. + * Accepts 'AND', 'IN', 'NOT IN', 'EXISTS', 'NOT EXISTS'. + * Default: 'IN'. + * @type bool $include_children Optional. Whether to include child terms. + * Requires a $taxonomy. Default: true. + * } + * } + */ + public function __construct($tax_query) + { + } + /** + * Ensures the 'tax_query' argument passed to the class constructor is well-formed. + * + * Ensures that each query-level clause has a 'relation' key, and that + * each first-order clause contains all the necessary keys from `$defaults`. + * + * @since 4.1.0 + * + * @param array $queries Array of queries clauses. + * @return array Sanitized array of query clauses. + */ + public function sanitize_query($queries) + { + } + /** + * Sanitizes a 'relation' operator. + * + * @since 4.1.0 + * + * @param string $relation Raw relation key from the query argument. + * @return string Sanitized relation. Either 'AND' or 'OR'. + * @phpstan-return 'AND'|'OR' + */ + public function sanitize_relation($relation) + { + } + /** + * Determines whether a clause is first-order. + * + * A "first-order" clause is one that contains any of the first-order + * clause keys ('terms', 'taxonomy', 'include_children', 'field', + * 'operator'). An empty clause also counts as a first-order clause, + * for backward compatibility. Any clause that doesn't meet this is + * determined, by process of elimination, to be a higher-order query. + * + * @since 4.1.0 + * + * @param array $query Tax query arguments. + * @return bool Whether the query clause is a first-order clause. + */ + protected static function is_first_order_clause($query) + { + } + /** + * Generates SQL clauses to be appended to a main query. + * + * @since 3.1.0 + * + * @param string $primary_table Database table where the object being filtered is stored (eg wp_users). + * @param string $primary_id_column ID column for the filtered object in $primary_table. + * @return string[] { + * Array containing JOIN and WHERE SQL clauses to append to the main query. + * + * @type string $join SQL fragment to append to the main JOIN clause. + * @type string $where SQL fragment to append to the main WHERE clause. + * } + * @phpstan-return array{ + * join: string, + * where: string, + * } + */ + public function get_sql($primary_table, $primary_id_column) + { + } + /** + * Generates SQL clauses to be appended to a main query. + * + * Called by the public WP_Tax_Query::get_sql(), this method + * is abstracted out to maintain parity with the other Query classes. + * + * @since 4.1.0 + * + * @return string[] { + * Array containing JOIN and WHERE SQL clauses to append to the main query. + * + * @type string $join SQL fragment to append to the main JOIN clause. + * @type string $where SQL fragment to append to the main WHERE clause. + * } + * @phpstan-return array{ + * join: string, + * where: string, + * } + */ + protected function get_sql_clauses() + { + } + /** + * Generates SQL clauses for a single query array. + * + * If nested subqueries are found, this method recurses the tree to + * produce the properly nested SQL. + * + * @since 4.1.0 + * + * @param array $query Query to parse (passed by reference). + * @param int $depth Optional. Number of tree levels deep we currently are. + * Used to calculate indentation. Default 0. + * @return string[] { + * Array containing JOIN and WHERE SQL clauses to append to a single query array. + * + * @type string $join SQL fragment to append to the main JOIN clause. + * @type string $where SQL fragment to append to the main WHERE clause. + * } + * @phpstan-return array{ + * join: string, + * where: string, + * } + */ + protected function get_sql_for_query(&$query, $depth = 0) + { + } + /** + * Generates SQL JOIN and WHERE clauses for a "first-order" query clause. + * + * @since 4.1.0 + * + * @global wpdb $wpdb The WordPress database abstraction object. + * + * @param array $clause Query clause (passed by reference). + * @param array $parent_query Parent query array. + * @return array { + * Array containing JOIN and WHERE SQL clauses to append to a first-order query. + * + * @type string[] $join Array of SQL fragments to append to the main JOIN clause. + * @type string[] $where Array of SQL fragments to append to the main WHERE clause. + * } + * @phpstan-return array{ + * join: string[], + * where: string[], + * } + */ + public function get_sql_for_clause(&$clause, $parent_query) + { + } + /** + * Identifies an existing table alias that is compatible with the current query clause. + * + * We avoid unnecessary table joins by allowing each clause to look for + * an existing table alias that is compatible with the query that it + * needs to perform. + * + * An existing alias is compatible if (a) it is a sibling of `$clause` + * (ie, it's under the scope of the same relation), and (b) the combination + * of operator and relation between the clauses allows for a shared table + * join. In the case of WP_Tax_Query, this only applies to 'IN' + * clauses that are connected by the relation 'OR'. + * + * @since 4.1.0 + * + * @param array $clause Query clause. + * @param array $parent_query Parent query of $clause. + * @return string|false Table alias if found, otherwise false. + */ + protected function find_compatible_table_alias($clause, $parent_query) + { + } + /** + * Transforms a single query, from one field to another. + * + * Operates on the `$query` object by reference. In the case of error, + * `$query` is converted to a WP_Error object. + * + * @since 3.2.0 + * + * @param array $query The single query. Passed by reference. + * @param string $resulting_field The resulting field. Accepts 'slug', 'name', 'term_taxonomy_id', + * or 'term_id'. Default 'term_id'. + * @phpstan-param 'slug'|'name'|'term_taxonomy_id'|'term_id' $resulting_field + * @phpstan-return void + */ + public function transform_query(&$query, $resulting_field) + { + } + } + /** + * Taxonomy API: WP_Taxonomy class + * + * @package WordPress + * @subpackage Taxonomy + * @since 4.7.0 + */ + /** + * Core class used for interacting with taxonomies. + * + * @since 4.7.0 + */ + #[\AllowDynamicProperties] + final class WP_Taxonomy + { + /** + * Taxonomy key. + * + * @since 4.7.0 + * @var string + */ + public $name; + /** + * Name of the taxonomy shown in the menu. Usually plural. + * + * @since 4.7.0 + * @var string + */ + public $label; + /** + * Labels object for this taxonomy. + * + * If not set, tag labels are inherited for non-hierarchical types + * and category labels for hierarchical ones. + * + * @see get_taxonomy_labels() + * + * @since 4.7.0 + * @var stdClass + */ + public $labels; + /** + * A short descriptive summary of what the taxonomy is for. + * + * @since 4.7.0 + * @var string + */ + public $description = ''; + /** + * Whether a taxonomy is intended for use publicly either via the admin interface or by front-end users. + * + * @since 4.7.0 + * @var bool + */ + public $public = \true; + /** + * Whether the taxonomy is publicly queryable. + * + * @since 4.7.0 + * @var bool + */ + public $publicly_queryable = \true; + /** + * Whether the taxonomy is hierarchical. + * + * @since 4.7.0 + * @var bool + */ + public $hierarchical = \false; + /** + * Whether to generate and allow a UI for managing terms in this taxonomy in the admin. + * + * @since 4.7.0 + * @var bool + */ + public $show_ui = \true; + /** + * Whether to show the taxonomy in the admin menu. + * + * If true, the taxonomy is shown as a submenu of the object type menu. If false, no menu is shown. + * + * @since 4.7.0 + * @var bool + */ + public $show_in_menu = \true; + /** + * Whether the taxonomy is available for selection in navigation menus. + * + * @since 4.7.0 + * @var bool + */ + public $show_in_nav_menus = \true; + /** + * Whether to list the taxonomy in the tag cloud widget controls. + * + * @since 4.7.0 + * @var bool + */ + public $show_tagcloud = \true; + /** + * Whether to show the taxonomy in the quick/bulk edit panel. + * + * @since 4.7.0 + * @var bool + */ + public $show_in_quick_edit = \true; + /** + * Whether to display a column for the taxonomy on its post type listing screens. + * + * @since 4.7.0 + * @var bool + */ + public $show_admin_column = \false; + /** + * The callback function for the meta box display. + * + * @since 4.7.0 + * @var bool|callable + */ + public $meta_box_cb = \null; + /** + * The callback function for sanitizing taxonomy data saved from a meta box. + * + * @since 5.1.0 + * @var callable + */ + public $meta_box_sanitize_cb = \null; + /** + * An array of object types this taxonomy is registered for. + * + * @since 4.7.0 + * @var string[] + */ + public $object_type = \null; + /** + * Capabilities for this taxonomy. + * + * @since 4.7.0 + * @var stdClass + */ + public $cap; + /** + * Rewrites information for this taxonomy. + * + * @since 4.7.0 + * @var array|false + */ + public $rewrite; + /** + * Query var string for this taxonomy. + * + * @since 4.7.0 + * @var string|false + */ + public $query_var; + /** + * Function that will be called when the count is updated. + * + * @since 4.7.0 + * @var callable + */ + public $update_count_callback; + /** + * Whether this taxonomy should appear in the REST API. + * + * Default false. If true, standard endpoints will be registered with + * respect to $rest_base and $rest_controller_class. + * + * @since 4.7.4 + * @var bool $show_in_rest + */ + public $show_in_rest; + /** + * The base path for this taxonomy's REST API endpoints. + * + * @since 4.7.4 + * @var string|bool $rest_base + */ + public $rest_base; + /** + * The namespace for this taxonomy's REST API endpoints. + * + * @since 5.9.0 + * @var string|bool $rest_namespace + */ + public $rest_namespace; + /** + * The controller for this taxonomy's REST API endpoints. + * + * Custom controllers must extend WP_REST_Controller. + * + * @since 4.7.4 + * @var string|bool $rest_controller_class + */ + public $rest_controller_class; + /** + * The controller instance for this taxonomy's REST API endpoints. + * + * Lazily computed. Should be accessed using {@see WP_Taxonomy::get_rest_controller()}. + * + * @since 5.5.0 + * @var WP_REST_Controller $rest_controller + */ + public $rest_controller; + /** + * The default term name for this taxonomy. If you pass an array you have + * to set 'name' and optionally 'slug' and 'description'. + * + * @since 5.5.0 + * @var array|string + */ + public $default_term; + /** + * Whether terms in this taxonomy should be sorted in the order they are provided to `wp_set_object_terms()`. + * + * Use this in combination with `'orderby' => 'term_order'` when fetching terms. + * + * @since 2.5.0 + * @var bool|null + */ + public $sort = \null; + /** + * Array of arguments to automatically use inside `wp_get_object_terms()` for this taxonomy. + * + * @since 2.6.0 + * @var array|null + */ + public $args = \null; + /** + * Whether it is a built-in taxonomy. + * + * @since 4.7.0 + * @var bool + */ + public $_builtin; + /** + * Constructor. + * + * See the register_taxonomy() function for accepted arguments for `$args`. + * + * @since 4.7.0 + * + * @param string $taxonomy Taxonomy key, must not exceed 32 characters. + * @param array|string $object_type Name of the object type for the taxonomy object. + * @param array|string $args Optional. Array or query string of arguments for registering a taxonomy. + * See register_taxonomy() for information on accepted arguments. + * Default empty array. + * @phpstan-param array{ + * labels?: string[], + * description?: string, + * public?: bool, + * publicly_queryable?: bool, + * hierarchical?: bool, + * show_ui?: bool, + * show_in_menu?: bool, + * show_in_nav_menus?: bool, + * show_in_rest?: bool, + * rest_base?: string, + * rest_namespace?: string, + * rest_controller_class?: string, + * show_tagcloud?: bool, + * show_in_quick_edit?: bool, + * show_admin_column?: bool, + * meta_box_cb?: bool|callable, + * meta_box_sanitize_cb?: callable, + * capabilities?: array{ + * manage_terms?: string, + * edit_terms?: string, + * delete_terms?: string, + * assign_terms?: string, + * }, + * rewrite?: bool|array{ + * slug?: string, + * with_front?: bool, + * hierarchical?: bool, + * ep_mask?: int, + * }, + * query_var?: string|bool, + * update_count_callback?: callable, + * default_term?: string|array{ + * name?: string, + * slug?: string, + * description?: string, + * }, + * sort?: bool, + * args?: array, + * _builtin?: bool, + * } $args See register_taxonomy() + */ + public function __construct($taxonomy, $object_type, $args = array()) + { + } + /** + * Sets taxonomy properties. + * + * See the register_taxonomy() function for accepted arguments for `$args`. + * + * @since 4.7.0 + * + * @param string|string[] $object_type Name or array of names of the object types for the taxonomy. + * @param array|string $args Array or query string of arguments for registering a taxonomy. + */ + public function set_props($object_type, $args) + { + } + /** + * Adds the necessary rewrite rules for the taxonomy. + * + * @since 4.7.0 + * + * @global WP $wp Current WordPress environment instance. + */ + public function add_rewrite_rules() + { + } + /** + * Removes any rewrite rules, permastructs, and rules for the taxonomy. + * + * @since 4.7.0 + * + * @global WP $wp Current WordPress environment instance. + */ + public function remove_rewrite_rules() + { + } + /** + * Registers the ajax callback for the meta box. + * + * @since 4.7.0 + */ + public function add_hooks() + { + } + /** + * Removes the ajax callback for the meta box. + * + * @since 4.7.0 + */ + public function remove_hooks() + { + } + /** + * Gets the REST API controller for this taxonomy. + * + * Will only instantiate the controller class once per request. + * + * @since 5.5.0 + * + * @return WP_REST_Controller|null The controller instance, or null if the taxonomy + * is set not to show in rest. + */ + public function get_rest_controller() + { + } + /** + * Returns the default labels for taxonomies. + * + * @since 6.0.0 + * + * @return (string|null)[][] The default labels for taxonomies. + */ + public static function get_default_labels() + { + } + /** + * Resets the cache for the default labels. + * + * @since 6.0.0 + */ + public static function reset_default_labels() + { + } + } + /** + * Taxonomy API: WP_Term_Query class. + * + * @package WordPress + * @subpackage Taxonomy + * @since 4.6.0 + */ + /** + * Class used for querying terms. + * + * @since 4.6.0 + * + * @see WP_Term_Query::__construct() for accepted arguments. + */ + #[\AllowDynamicProperties] + class WP_Term_Query + { + /** + * SQL string used to perform database query. + * + * @since 4.6.0 + * @var string + */ + public $request; + /** + * Metadata query container. + * + * @since 4.6.0 + * @var WP_Meta_Query A meta query instance. + */ + public $meta_query = \false; + /** + * Metadata query clauses. + * + * @since 4.6.0 + * @var array + */ + protected $meta_query_clauses; + /** + * SQL query clauses. + * + * @since 4.6.0 + * @var array + */ + protected $sql_clauses = array('select' => '', 'from' => '', 'where' => array(), 'orderby' => '', 'limits' => ''); + /** + * Query vars set by the user. + * + * @since 4.6.0 + * @var array + */ + public $query_vars; + /** + * Default values for query vars. + * + * @since 4.6.0 + * @var array + */ + public $query_var_defaults; + /** + * List of terms located by the query. + * + * @since 4.6.0 + * @var array + */ + public $terms; + /** + * Constructor. + * + * Sets up the term query, based on the query vars passed. + * + * @since 4.6.0 + * @since 4.6.0 Introduced 'term_taxonomy_id' parameter. + * @since 4.7.0 Introduced 'object_ids' parameter. + * @since 4.9.0 Added 'slug__in' support for 'orderby'. + * @since 5.1.0 Introduced the 'meta_compare_key' parameter. + * @since 5.3.0 Introduced the 'meta_type_key' parameter. + * @since 6.4.0 Introduced the 'cache_results' parameter. + * + * @param string|array $query { + * Optional. Array or query string of term query parameters. Default empty. + * + * @type string|string[] $taxonomy Taxonomy name, or array of taxonomy names, to which results + * should be limited. + * @type int|int[] $object_ids Object ID, or array of object IDs. Results will be + * limited to terms associated with these objects. + * @type string $orderby Field(s) to order terms by. Accepts: + * - Term fields ('name', 'slug', 'term_group', 'term_id', 'id', + * 'description', 'parent', 'term_order'). Unless `$object_ids` + * is not empty, 'term_order' is treated the same as 'term_id'. + * - 'count' to use the number of objects associated with the term. + * - 'include' to match the 'order' of the `$include` param. + * - 'slug__in' to match the 'order' of the `$slug` param. + * - 'meta_value' + * - 'meta_value_num'. + * - The value of `$meta_key`. + * - The array keys of `$meta_query`. + * - 'none' to omit the ORDER BY clause. + * Default 'name'. + * @type string $order Whether to order terms in ascending or descending order. + * Accepts 'ASC' (ascending) or 'DESC' (descending). + * Default 'ASC'. + * @type bool|int $hide_empty Whether to hide terms not assigned to any posts. Accepts + * 1|true or 0|false. Default 1|true. + * @type int[]|string $include Array or comma/space-separated string of term IDs to include. + * Default empty array. + * @type int[]|string $exclude Array or comma/space-separated string of term IDs to exclude. + * If `$include` is non-empty, `$exclude` is ignored. + * Default empty array. + * @type int[]|string $exclude_tree Array or comma/space-separated string of term IDs to exclude + * along with all of their descendant terms. If `$include` is + * non-empty, `$exclude_tree` is ignored. Default empty array. + * @type int|string $number Maximum number of terms to return. Accepts ''|0 (all) or any + * positive number. Default ''|0 (all). Note that `$number` may + * not return accurate results when coupled with `$object_ids`. + * See #41796 for details. + * @type int $offset The number by which to offset the terms query. Default empty. + * @type string $fields Term fields to query for. Accepts: + * - 'all' Returns an array of complete term objects (`WP_Term[]`). + * - 'all_with_object_id' Returns an array of term objects + * with the 'object_id' param (`WP_Term[]`). Works only + * when the `$object_ids` parameter is populated. + * - 'ids' Returns an array of term IDs (`int[]`). + * - 'tt_ids' Returns an array of term taxonomy IDs (`int[]`). + * - 'names' Returns an array of term names (`string[]`). + * - 'slugs' Returns an array of term slugs (`string[]`). + * - 'count' Returns the number of matching terms (`int`). + * - 'id=>parent' Returns an associative array of parent term IDs, + * keyed by term ID (`int[]`). + * - 'id=>name' Returns an associative array of term names, + * keyed by term ID (`string[]`). + * - 'id=>slug' Returns an associative array of term slugs, + * keyed by term ID (`string[]`). + * Default 'all'. + * @type bool $count Whether to return a term count. If true, will take precedence + * over `$fields`. Default false. + * @type string|string[] $name Name or array of names to return term(s) for. + * Default empty. + * @type string|string[] $slug Slug or array of slugs to return term(s) for. + * Default empty. + * @type int|int[] $term_taxonomy_id Term taxonomy ID, or array of term taxonomy IDs, + * to match when querying terms. + * @type bool $hierarchical Whether to include terms that have non-empty descendants + * (even if `$hide_empty` is set to true). Default true. + * @type string $search Search criteria to match terms. Will be SQL-formatted with + * wildcards before and after. Default empty. + * @type string $name__like Retrieve terms with criteria by which a term is LIKE + * `$name__like`. Default empty. + * @type string $description__like Retrieve terms where the description is LIKE + * `$description__like`. Default empty. + * @type bool $pad_counts Whether to pad the quantity of a term's children in the + * quantity of each term's "count" object variable. + * Default false. + * @type string $get Whether to return terms regardless of ancestry or whether the + * terms are empty. Accepts 'all' or '' (disabled). + * Default ''. + * @type int $child_of Term ID to retrieve child terms of. If multiple taxonomies + * are passed, `$child_of` is ignored. Default 0. + * @type int $parent Parent term ID to retrieve direct-child terms of. + * Default empty. + * @type bool $childless True to limit results to terms that have no children. + * This parameter has no effect on non-hierarchical taxonomies. + * Default false. + * @type string $cache_domain Unique cache key to be produced when this query is stored in + * an object cache. Default 'core'. + * @type bool $cache_results Whether to cache term information. Default true. + * @type bool $update_term_meta_cache Whether to prime meta caches for matched terms. Default true. + * @type string|string[] $meta_key Meta key or keys to filter by. + * @type string|string[] $meta_value Meta value or values to filter by. + * @type string $meta_compare MySQL operator used for comparing the meta value. + * See WP_Meta_Query::__construct() for accepted values and default value. + * @type string $meta_compare_key MySQL operator used for comparing the meta key. + * See WP_Meta_Query::__construct() for accepted values and default value. + * @type string $meta_type MySQL data type that the meta_value column will be CAST to for comparisons. + * See WP_Meta_Query::__construct() for accepted values and default value. + * @type string $meta_type_key MySQL data type that the meta_key column will be CAST to for comparisons. + * See WP_Meta_Query::__construct() for accepted values and default value. + * @type array $meta_query An associative array of WP_Meta_Query arguments. + * See WP_Meta_Query::__construct() for accepted values. + * } + * @phpstan-param array{ + * taxonomy?: string|string[], + * object_ids?: int|int[], + * orderby?: string, + * order?: string, + * hide_empty?: bool|int, + * include?: int[]|string, + * exclude?: int[]|string, + * exclude_tree?: int[]|string, + * number?: int|string, + * offset?: int, + * fields?: string, + * count?: bool, + * name?: string|string[], + * slug?: string|string[], + * term_taxonomy_id?: int|int[], + * hierarchical?: bool, + * search?: string, + * name__like?: string, + * description__like?: string, + * pad_counts?: bool, + * get?: string, + * child_of?: int, + * parent?: int, + * childless?: bool, + * cache_domain?: string, + * cache_results?: bool, + * update_term_meta_cache?: bool, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * } $query + */ + public function __construct($query = '') + { + } + /** + * Parse arguments passed to the term query with default query parameters. + * + * @since 4.6.0 + * + * @param string|array $query WP_Term_Query arguments. See WP_Term_Query::__construct() for accepted arguments. + * @phpstan-param array{ + * taxonomy?: string|string[], + * object_ids?: int|int[], + * orderby?: string, + * order?: string, + * hide_empty?: bool|int, + * include?: int[]|string, + * exclude?: int[]|string, + * exclude_tree?: int[]|string, + * number?: int|string, + * offset?: int, + * fields?: string, + * count?: bool, + * name?: string|string[], + * slug?: string|string[], + * term_taxonomy_id?: int|int[], + * hierarchical?: bool, + * search?: string, + * name__like?: string, + * description__like?: string, + * pad_counts?: bool, + * get?: string, + * child_of?: int, + * parent?: int, + * childless?: bool, + * cache_domain?: string, + * cache_results?: bool, + * update_term_meta_cache?: bool, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * } $query See WP_Term_Query::__construct() + */ + public function parse_query($query = '') + { + } + /** + * Sets up the query and retrieves the results. + * + * The return type varies depending on the value passed to `$args['fields']`. See + * WP_Term_Query::get_terms() for details. + * + * @since 4.6.0 + * + * @param string|array $query Array or URL query string of parameters. + * @return WP_Term[]|int[]|string[]|string Array of terms, or number of terms as numeric string + * when 'count' is passed as a query var. + */ + public function query($query) + { + } + /** + * Retrieves the query results. + * + * The return type varies depending on the value passed to `$args['fields']`. + * + * The following will result in an array of `WP_Term` objects being returned: + * + * - 'all' + * - 'all_with_object_id' + * + * The following will result in a numeric string being returned: + * + * - 'count' + * + * The following will result in an array of text strings being returned: + * + * - 'id=>name' + * - 'id=>slug' + * - 'names' + * - 'slugs' + * + * The following will result in an array of numeric strings being returned: + * + * - 'id=>parent' + * + * The following will result in an array of integers being returned: + * + * - 'ids' + * - 'tt_ids' + * + * @since 4.6.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return WP_Term[]|int[]|string[]|string Array of terms, or number of terms as numeric string + * when 'count' is passed as a query var. + */ + public function get_terms() + { + } + /** + * Parse and sanitize 'orderby' keys passed to the term query. + * + * @since 4.6.0 + * + * @param string $orderby_raw Alias for the field to order by. + * @return string|false Value to used in the ORDER clause. False otherwise. + */ + protected function parse_orderby($orderby_raw) + { + } + /** + * Format response depending on field requested. + * + * @since 6.0.0 + * + * @param WP_Term[] $term_objects Array of term objects. + * @param string $_fields Field to format. + * + * @return WP_Term[]|int[]|string[] Array of terms / strings / ints depending on field requested. + */ + protected function format_terms($term_objects, $_fields) + { + } + /** + * Generate the ORDER BY clause for an 'orderby' param that is potentially related to a meta query. + * + * @since 4.6.0 + * + * @param string $orderby_raw Raw 'orderby' value passed to WP_Term_Query. + * @return string ORDER BY clause. + */ + protected function parse_orderby_meta($orderby_raw) + { + } + /** + * Parse an 'order' query variable and cast it to ASC or DESC as necessary. + * + * @since 4.6.0 + * + * @param string $order The 'order' query variable. + * @return string The sanitized 'order' query variable. + */ + protected function parse_order($order) + { + } + /** + * Used internally to generate a SQL string related to the 'search' parameter. + * + * @since 4.6.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $search Search string. + * @return string Search SQL. + */ + protected function get_search_sql($search) + { + } + /** + * Creates an array of term objects from an array of term IDs. + * + * Also discards invalid term objects. + * + * @since 4.9.8 + * + * @param Object[]|int[] $terms List of objects or term ids. + * @return WP_Term[] Array of `WP_Term` objects. + */ + protected function populate_terms($terms) + { + } + /** + * Generate cache key. + * + * @since 6.2.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array $args WP_Term_Query arguments. + * @param string $sql SQL statement. + * + * @return string Cache key. + */ + protected function generate_cache_key(array $args, $sql) + { + } + } + /** + * Taxonomy API: WP_Term class + * + * @package WordPress + * @subpackage Taxonomy + * @since 4.4.0 + */ + /** + * Core class used to implement the WP_Term object. + * + * @since 4.4.0 + * + * @property-read object $data Sanitized term data. + */ + #[\AllowDynamicProperties] + final class WP_Term + { + /** + * Term ID. + * + * @since 4.4.0 + * @var int + */ + public $term_id; + /** + * The term's name. + * + * @since 4.4.0 + * @var string + */ + public $name = ''; + /** + * The term's slug. + * + * @since 4.4.0 + * @var string + */ + public $slug = ''; + /** + * The term's term_group. + * + * @since 4.4.0 + * @var int + */ + public $term_group = ''; + /** + * Term Taxonomy ID. + * + * @since 4.4.0 + * @var int + */ + public $term_taxonomy_id = 0; + /** + * The term's taxonomy name. + * + * @since 4.4.0 + * @var string + */ + public $taxonomy = ''; + /** + * The term's description. + * + * @since 4.4.0 + * @var string + */ + public $description = ''; + /** + * ID of a term's parent term. + * + * @since 4.4.0 + * @var int + */ + public $parent = 0; + /** + * Cached object count for this term. + * + * @since 4.4.0 + * @var int + */ + public $count = 0; + /** + * Stores the term object's sanitization level. + * + * Does not correspond to a database field. + * + * @since 4.4.0 + * @var string + */ + public $filter = 'raw'; + /** + * Retrieve WP_Term instance. + * + * @since 4.4.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $term_id Term ID. + * @param string $taxonomy Optional. Limit matched terms to those matching `$taxonomy`. Only used for + * disambiguating potentially shared terms. + * @return WP_Term|WP_Error|false Term object, if found. WP_Error if `$term_id` is shared between taxonomies and + * there's insufficient data to distinguish which term is intended. + * False for other failures. + */ + public static function get_instance($term_id, $taxonomy = \null) + { + } + /** + * Constructor. + * + * @since 4.4.0 + * + * @param WP_Term|object $term Term object. + */ + public function __construct($term) + { + } + /** + * Sanitizes term fields, according to the filter type provided. + * + * @since 4.4.0 + * + * @param string $filter Filter context. Accepts 'edit', 'db', 'display', 'attribute', 'js', 'rss', or 'raw'. + * @phpstan-param 'edit'|'db'|'display'|'attribute'|'js'|'rss'|'raw' $filter + */ + public function filter($filter) + { + } + /** + * Converts an object to array. + * + * @since 4.4.0 + * + * @return array Object as array. + */ + public function to_array() + { + } + /** + * Getter. + * + * @since 4.4.0 + * + * @param string $key Property to get. + * @return mixed Property value. + */ + public function __get($key) + { + } + } + /** + * Diff API: WP_Text_Diff_Renderer_inline class + * + * @package WordPress + * @subpackage Diff + * @since 4.7.0 + */ + /** + * Better word splitting than the PEAR package provides. + * + * @since 2.6.0 + * @uses Text_Diff_Renderer_inline Extends + */ + #[\AllowDynamicProperties] + class WP_Text_Diff_Renderer_inline extends \Text_Diff_Renderer_inline + { + /** + * @ignore + * @since 2.6.0 + * + * @param string $string + * @param string $newlineEscape + * @return string + */ + public function _splitOnWords($string, $newlineEscape = "\n") + { + } + } + /** + * Diff API: WP_Text_Diff_Renderer_Table class + * + * @package WordPress + * @subpackage Diff + * @since 4.7.0 + */ + /** + * Table renderer to display the diff lines. + * + * @since 2.6.0 + * @uses Text_Diff_Renderer Extends + */ + #[\AllowDynamicProperties] + class WP_Text_Diff_Renderer_Table extends \Text_Diff_Renderer + { + /** + * @see Text_Diff_Renderer::_leading_context_lines + * @var int + * @since 2.6.0 + */ + public $_leading_context_lines = 10000; + /** + * @see Text_Diff_Renderer::_trailing_context_lines + * @var int + * @since 2.6.0 + */ + public $_trailing_context_lines = 10000; + /** + * Title of the item being compared. + * + * @since 6.4.0 Declared a previously dynamic property. + * @var string|null + */ + public $_title; + /** + * Title for the left column. + * + * @since 6.4.0 Declared a previously dynamic property. + * @var string|null + */ + public $_title_left; + /** + * Title for the right column. + * + * @since 6.4.0 Declared a previously dynamic property. + * @var string|null + */ + public $_title_right; + /** + * Threshold for when a diff should be saved or omitted. + * + * @var float + * @since 2.6.0 + */ + protected $_diff_threshold = 0.6; + /** + * Inline display helper object name. + * + * @var string + * @since 2.6.0 + */ + protected $inline_diff_renderer = 'WP_Text_Diff_Renderer_inline'; + /** + * Should we show the split view or not + * + * @var string + * @since 3.6.0 + */ + protected $_show_split_view = \true; + protected $compat_fields = array('_show_split_view', 'inline_diff_renderer', '_diff_threshold'); + /** + * Caches the output of count_chars() in compute_string_distance() + * + * @var array + * @since 5.0.0 + */ + protected $count_cache = array(); + /** + * Caches the difference calculation in compute_string_distance() + * + * @var array + * @since 5.0.0 + */ + protected $difference_cache = array(); + /** + * Constructor - Call parent constructor with params array. + * + * This will set class properties based on the key value pairs in the array. + * + * @since 2.6.0 + * + * @param array $params + */ + public function __construct($params = array()) + { + } + /** + * @ignore + * + * @param string $header + * @return string + */ + public function _startBlock($header) + { + } + /** + * @ignore + * + * @param array $lines + * @param string $prefix + */ + public function _lines($lines, $prefix = ' ') + { + } + /** + * @ignore + * + * @param string $line HTML-escape the value. + * @return string + */ + public function addedLine($line) + { + } + /** + * @ignore + * + * @param string $line HTML-escape the value. + * @return string + */ + public function deletedLine($line) + { + } + /** + * @ignore + * + * @param string $line HTML-escape the value. + * @return string + */ + public function contextLine($line) + { + } + /** + * @ignore + * + * @return string + */ + public function emptyLine() + { + } + /** + * @ignore + * + * @param array $lines + * @param bool $encode + * @return string + */ + public function _added($lines, $encode = \true) + { + } + /** + * @ignore + * + * @param array $lines + * @param bool $encode + * @return string + */ + public function _deleted($lines, $encode = \true) + { + } + /** + * @ignore + * + * @param array $lines + * @param bool $encode + * @return string + */ + public function _context($lines, $encode = \true) + { + } + /** + * Process changed lines to do word-by-word diffs for extra highlighting. + * + * (TRAC style) sometimes these lines can actually be deleted or added rows. + * We do additional processing to figure that out + * + * @since 2.6.0 + * + * @param array $orig + * @param array $final + * @return string + */ + public function _changed($orig, $final) + { + } + /** + * Takes changed blocks and matches which rows in orig turned into which rows in final. + * + * @since 2.6.0 + * + * @param array $orig Lines of the original version of the text. + * @param array $final Lines of the final version of the text. + * @return array { + * Array containing results of comparing the original text to the final text. + * + * @type array $orig_matches Associative array of original matches. Index == row + * number of `$orig`, value == corresponding row number + * of that same line in `$final` or 'x' if there is no + * corresponding row (indicating it is a deleted line). + * @type array $final_matches Associative array of final matches. Index == row + * number of `$final`, value == corresponding row number + * of that same line in `$orig` or 'x' if there is no + * corresponding row (indicating it is a new line). + * @type array $orig_rows Associative array of interleaved rows of `$orig` with + * blanks to keep matches aligned with side-by-side diff + * of `$final`. A value >= 0 corresponds to index of `$orig`. + * Value < 0 indicates a blank row. + * @type array $final_rows Associative array of interleaved rows of `$final` with + * blanks to keep matches aligned with side-by-side diff + * of `$orig`. A value >= 0 corresponds to index of `$final`. + * Value < 0 indicates a blank row. + * } + * @phpstan-return array{ + * orig_matches: array, + * final_matches: array, + * orig_rows: array, + * final_rows: array, + * } + */ + public function interleave_changed_lines($orig, $final) + { + } + /** + * Computes a number that is intended to reflect the "distance" between two strings. + * + * @since 2.6.0 + * + * @param string $string1 + * @param string $string2 + * @return int + */ + public function compute_string_distance($string1, $string2) + { + } + /** + * @ignore + * @since 2.6.0 + * + * @param int $a + * @param int $b + * @return int + */ + public function difference($a, $b) + { + } + /** + * Make private properties readable for backward compatibility. + * + * @since 4.0.0 + * @since 6.4.0 Getting a dynamic property is deprecated. + * + * @param string $name Property to get. + * @return mixed A declared property's value, else null. + */ + public function __get($name) + { + } + /** + * Make private properties settable for backward compatibility. + * + * @since 4.0.0 + * @since 6.4.0 Setting a dynamic property is deprecated. + * + * @param string $name Property to check if set. + * @param mixed $value Property value. + * @phpstan-return void + */ + public function __set($name, $value) + { + } + /** + * Make private properties checkable for backward compatibility. + * + * @since 4.0.0 + * @since 6.4.0 Checking a dynamic property is deprecated. + * + * @param string $name Property to check if set. + * @return bool Whether the property is set. + */ + public function __isset($name) + { + } + /** + * Make private properties un-settable for backward compatibility. + * + * @since 4.0.0 + * @since 6.4.0 Unsetting a dynamic property is deprecated. + * + * @param string $name Property to unset. + * @phpstan-return void + */ + public function __unset($name) + { + } + } + /** + * Locale API: WP_Textdomain_Registry class. + * + * This file uses rtrim() instead of untrailingslashit() and trailingslashit() + * to avoid formatting.php dependency. + * + * @package WordPress + * @subpackage i18n + * @since 6.1.0 + */ + /** + * Core class used for registering text domains. + * + * @since 6.1.0 + */ + #[\AllowDynamicProperties] + class WP_Textdomain_Registry + { + /** + * List of domains and all their language directory paths for each locale. + * + * @since 6.1.0 + * + * @var array + */ + protected $all = array(); + /** + * List of domains and their language directory path for the current (most recent) locale. + * + * @since 6.1.0 + * + * @var array + */ + protected $current = array(); + /** + * List of domains and their custom language directory paths. + * + * @see load_plugin_textdomain() + * @see load_theme_textdomain() + * + * @since 6.1.0 + * + * @var array + */ + protected $custom_paths = array(); + /** + * Holds a cached list of available .mo files to improve performance. + * + * @since 6.1.0 + * @since 6.5.0 This property is no longer used. + * + * @var array + * + * @deprecated + */ + protected $cached_mo_files = array(); + /** + * Holds a cached list of domains with translations to improve performance. + * + * @since 6.2.0 + * + * @var string[] + */ + protected $domains_with_translations = array(); + /** + * Initializes the registry. + * + * Hooks into the {@see 'upgrader_process_complete'} filter + * to invalidate MO files caches. + * + * @since 6.5.0 + */ + public function init() + { + } + /** + * Returns the languages directory path for a specific domain and locale. + * + * @since 6.1.0 + * + * @param string $domain Text domain. + * @param string $locale Locale. + * + * @return string|false Languages directory path or false if there is none available. + */ + public function get($domain, $locale) + { + } + /** + * Determines whether any MO file paths are available for the domain. + * + * This is the case if a path has been set for the current locale, + * or if there is no information stored yet, in which case + * {@see _load_textdomain_just_in_time()} will fetch the information first. + * + * @since 6.1.0 + * + * @param string $domain Text domain. + * @return bool Whether any MO file paths are available for the domain. + */ + public function has($domain) + { + } + /** + * Sets the language directory path for a specific domain and locale. + * + * Also sets the 'current' property for direct access + * to the path for the current (most recent) locale. + * + * @since 6.1.0 + * + * @param string $domain Text domain. + * @param string $locale Locale. + * @param string|false $path Language directory path or false if there is none available. + */ + public function set($domain, $locale, $path) + { + } + /** + * Sets the custom path to the plugin's/theme's languages directory. + * + * Used by {@see load_plugin_textdomain()} and {@see load_theme_textdomain()}. + * + * @since 6.1.0 + * + * @param string $domain Text domain. + * @param string $path Language directory path. + */ + public function set_custom_path($domain, $path) + { + } + /** + * Retrieves translation files from the specified path. + * + * Allows early retrieval through the {@see 'pre_get_mo_files_from_path'} filter to optimize + * performance, especially in directories with many files. + * + * @since 6.5.0 + * + * @param string $path The directory path to search for translation files. + * @return array Array of translation file paths. Can contain .mo and .l10n.php files. + */ + public function get_language_files_from_path($path) + { + } + /** + * Invalidate the cache for .mo files. + * + * This function deletes the cache entries related to .mo files when triggered + * by specific actions, such as the completion of an upgrade process. + * + * @since 6.5.0 + * + * @param WP_Upgrader $upgrader Unused. WP_Upgrader instance. In other contexts this might be a + * Theme_Upgrader, Plugin_Upgrader, Core_Upgrade, or Language_Pack_Upgrader instance. + * @param array $hook_extra { + * Array of bulk item update data. + * + * @type string $action Type of action. Default 'update'. + * @type string $type Type of update process. Accepts 'plugin', 'theme', 'translation', or 'core'. + * @type bool $bulk Whether the update process is a bulk update. Default true. + * @type array $plugins Array of the basename paths of the plugins' main files. + * @type array $themes The theme slugs. + * @type array $translations { + * Array of translations update data. + * + * @type string $language The locale the translation is for. + * @type string $type Type of translation. Accepts 'plugin', 'theme', or 'core'. + * @type string $slug Text domain the translation is for. The slug of a theme/plugin or + * 'default' for core translations. + * @type string $version The version of a theme, plugin, or core. + * } + * } + * @phpstan-param array{ + * action?: string, + * type?: string, + * bulk?: bool, + * plugins?: array, + * themes?: array, + * translations?: array{ + * language: string, + * type: string, + * slug: string, + * version: string, + * }, + * } $hook_extra + * @phpstan-return void + */ + public function invalidate_mo_files_cache($upgrader, $hook_extra) + { + } + } + /** + * WP_Theme_JSON_Data class + * + * @package WordPress + * @subpackage Theme + * @since 6.1.0 + */ + /** + * Class to provide access to update a theme.json structure. + */ + #[\AllowDynamicProperties] + class WP_Theme_JSON_Data + { + /** + * Constructor. + * + * @since 6.1.0 + * + * @link https://developer.wordpress.org/block-editor/reference-guides/theme-json-reference/ + * + * @param array $data Array following the theme.json specification. + * @param string $origin The origin of the data: default, theme, user. + */ + public function __construct($data = array('version' => \WP_Theme_JSON::LATEST_SCHEMA), $origin = 'theme') + { + } + /** + * Updates the theme.json with the the given data. + * + * @since 6.1.0 + * + * @param array $new_data Array following the theme.json specification. + * + * @return WP_Theme_JSON_Data The own instance with access to the modified data. + */ + public function update_with($new_data) + { + } + /** + * Returns an array containing the underlying data + * following the theme.json specification. + * + * @since 6.1.0 + * + * @return array + */ + public function get_data() + { + } + /** + * Returns theme JSON object. + * + * @since 6.6.0 + * + * @return WP_Theme_JSON The theme JSON structure stored in this data object. + */ + public function get_theme_json() + { + } + } + /** + * WP_Theme_JSON_Resolver class + * + * @package WordPress + * @subpackage Theme + * @since 5.8.0 + */ + /** + * Class that abstracts the processing of the different data sources + * for site-level config and offers an API to work with them. + * + * This class is for internal core usage and is not supposed to be used by extenders (plugins and/or themes). + * This is a low-level API that may need to do breaking changes. Please, + * use get_global_settings(), get_global_styles(), and get_global_stylesheet() instead. + * + * @access private + */ + #[\AllowDynamicProperties] + class WP_Theme_JSON_Resolver + { + /** + * Container for keep track of registered blocks. + * + * @since 6.1.0 + * @var array + */ + protected static $blocks_cache = array('core' => array(), 'blocks' => array(), 'theme' => array(), 'user' => array()); + /** + * Container for data coming from core. + * + * @since 5.8.0 + * @var WP_Theme_JSON + */ + protected static $core = \null; + /** + * Container for data coming from the blocks. + * + * @since 6.1.0 + * @var WP_Theme_JSON + */ + protected static $blocks = \null; + /** + * Container for data coming from the theme. + * + * @since 5.8.0 + * @var WP_Theme_JSON + */ + protected static $theme = \null; + /** + * Container for data coming from the user. + * + * @since 5.9.0 + * @var WP_Theme_JSON + */ + protected static $user = \null; + /** + * Stores the ID of the custom post type + * that holds the user data. + * + * @since 5.9.0 + * @var int + */ + protected static $user_custom_post_type_id = \null; + /** + * Container to keep loaded i18n schema for `theme.json`. + * + * @since 5.8.0 As `$theme_json_i18n`. + * @since 5.9.0 Renamed from `$theme_json_i18n` to `$i18n_schema`. + * @var array + */ + protected static $i18n_schema = \null; + /** + * `theme.json` file cache. + * + * @since 6.1.0 + * @var array + */ + protected static $theme_json_file_cache = array(); + /** + * Processes a file that adheres to the theme.json schema + * and returns an array with its contents, or a void array if none found. + * + * @since 5.8.0 + * @since 6.1.0 Added caching. + * + * @param string $file_path Path to file. Empty if no file. + * @return array Contents that adhere to the theme.json schema. + */ + protected static function read_json_file($file_path) + { + } + /** + * Returns a data structure used in theme.json translation. + * + * @since 5.8.0 + * @deprecated 5.9.0 + * + * @return array An array of theme.json fields that are translatable and the keys that are translatable. + */ + public static function get_fields_to_translate() + { + } + /** + * Given a theme.json structure modifies it in place to update certain values + * by its translated strings according to the language set by the user. + * + * @since 5.8.0 + * + * @param array $theme_json The theme.json to translate. + * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. + * Default 'default'. + * @return array Returns the modified $theme_json_structure. + */ + protected static function translate($theme_json, $domain = 'default') + { + } + /** + * Returns core's origin config. + * + * @since 5.8.0 + * + * @return WP_Theme_JSON Entity that holds core data. + */ + public static function get_core_data() + { + } + /** + * Checks whether the registered blocks were already processed for this origin. + * + * @since 6.1.0 + * + * @param string $origin Data source for which to cache the blocks. + * Valid values are 'core', 'blocks', 'theme', and 'user'. + * @return bool True on success, false otherwise. + * @phpstan-param 'core'|'blocks'|'theme'|'user' $origin + */ + protected static function has_same_registered_blocks($origin) + { + } + /** + * Returns the theme's data. + * + * Data from theme.json will be backfilled from existing + * theme supports, if any. Note that if the same data + * is present in theme.json and in theme supports, + * the theme.json takes precedence. + * + * @since 5.8.0 + * @since 5.9.0 Theme supports have been inlined and the `$theme_support_data` argument removed. + * @since 6.0.0 Added an `$options` parameter to allow the theme data to be returned without theme supports. + * @since 6.6.0 Add support for 'default-font-sizes' and 'default-spacing-sizes' theme supports. + * Added registration and merging of block style variations from partial theme.json files and the block styles registry. + * + * @param array $deprecated Deprecated. Not used. + * @param array $options { + * Options arguments. + * + * @type bool $with_supports Whether to include theme supports in the data. Default true. + * } + * @return WP_Theme_JSON Entity that holds theme data. + * @phpstan-param array{ + * with_supports?: bool, + * } $options + */ + public static function get_theme_data($deprecated = array(), $options = array()) + { + } + /** + * Gets the styles for blocks from the block.json file. + * + * @since 6.1.0 + * + * @return WP_Theme_JSON + */ + public static function get_block_data() + { + } + /** + * Returns the custom post type that contains the user's origin config + * for the active theme or an empty array if none are found. + * + * This can also create and return a new draft custom post type. + * + * @since 5.9.0 + * + * @param WP_Theme $theme The theme object. If empty, it + * defaults to the active theme. + * @param bool $create_post Optional. Whether a new custom post + * type should be created if none are + * found. Default false. + * @param array $post_status_filter Optional. Filter custom post type by + * post status. Default `array( 'publish' )`, + * so it only fetches published posts. + * @return array Custom Post Type for the user's origin config. + */ + public static function get_user_data_from_wp_global_styles($theme, $create_post = \false, $post_status_filter = array('publish')) + { + } + /** + * Returns the user's origin config. + * + * @since 5.9.0 + * @since 6.6.0 The 'isGlobalStylesUserThemeJSON' flag is left on the user data. + * Register the block style variations coming from the user data. + * + * @return WP_Theme_JSON Entity that holds styles for user data. + */ + public static function get_user_data() + { + } + /** + * Returns the data merged from multiple origins. + * + * There are four sources of data (origins) for a site: + * + * - default => WordPress + * - blocks => each one of the blocks provides data for itself + * - theme => the active theme + * - custom => data provided by the user + * + * The custom's has higher priority than the theme's, the theme's higher than blocks', + * and block's higher than default's. + * + * Unlike the getters + * {@link https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/get_core_data/ get_core_data}, + * {@link https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/get_theme_data/ get_theme_data}, + * and {@link https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/get_user_data/ get_user_data}, + * this method returns data after it has been merged with the previous origins. + * This means that if the same piece of data is declared in different origins + * (default, blocks, theme, custom), the last origin overrides the previous. + * + * For example, if the user has set a background color + * for the paragraph block, and the theme has done it as well, + * the user preference wins. + * + * @since 5.8.0 + * @since 5.9.0 Added user data, removed the `$settings` parameter, + * added the `$origin` parameter. + * @since 6.1.0 Added block data and generation of spacingSizes array. + * @since 6.2.0 Changed ' $origin' parameter values to 'default', 'blocks', 'theme' or 'custom'. + * + * @param string $origin Optional. To what level should we merge data: 'default', 'blocks', 'theme' or 'custom'. + * 'custom' is used as default value as well as fallback value if the origin is unknown. + * @return WP_Theme_JSON + * @phpstan-param 'default'|'blocks'|'theme'|'custom' $origin + */ + public static function get_merged_data($origin = 'custom') + { + } + /** + * Returns the ID of the custom post type + * that stores user data. + * + * @since 5.9.0 + * + * @return integer|null + */ + public static function get_user_global_styles_post_id() + { + } + /** + * Determines whether the active theme has a theme.json file. + * + * @since 5.8.0 + * @since 5.9.0 Added a check in the parent theme. + * @deprecated 6.2.0 Use wp_theme_has_theme_json() instead. + * + * @return bool + */ + public static function theme_has_support() + { + } + /** + * Builds the path to the given file and checks that it is readable. + * + * If it isn't, returns an empty string, otherwise returns the whole file path. + * + * @since 5.8.0 + * @since 5.9.0 Adapted to work with child themes, added the `$template` argument. + * + * @param string $file_name Name of the file. + * @param bool $template Optional. Use template theme directory. Default false. + * @return string The whole file path or empty if the file doesn't exist. + */ + protected static function get_file_path_from_theme($file_name, $template = \false) + { + } + /** + * Cleans the cached data so it can be recalculated. + * + * @since 5.8.0 + * @since 5.9.0 Added the `$user`, `$user_custom_post_type_id`, + * and `$i18n_schema` variables to reset. + * @since 6.1.0 Added the `$blocks` and `$blocks_cache` variables + * to reset. + */ + public static function clean_cached_data() + { + } + /** + * Returns the style variations defined by the theme. + * + * @since 6.0.0 + * @since 6.2.0 Returns parent theme variations if theme is a child. + * @since 6.6.0 Added configurable scope parameter to allow filtering + * theme.json partial files by the scope to which they + * can be applied e.g. theme vs block etc. + * Added basic caching for read theme.json partial files. + * + * @param string $scope The scope or type of style variation to retrieve e.g. theme, block etc. + * @return array + */ + public static function get_style_variations($scope = 'theme') + { + } + /** + * Resolves relative paths in theme.json styles to theme absolute paths + * and returns them in an array that can be embedded + * as the value of `_link` object in REST API responses. + * + * @since 6.6.0 + * + * @param WP_Theme_JSON $theme_json A theme json instance. + * @return array An array of resolved paths. + */ + public static function get_resolved_theme_uris($theme_json) + { + } + /** + * Resolves relative paths in theme.json styles to theme absolute paths + * and merges them with incoming theme JSON. + * + * @since 6.6.0 + * + * @param WP_Theme_JSON $theme_json A theme json instance. + * @return WP_Theme_JSON Theme merged with resolved paths, if any found. + */ + public static function resolve_theme_file_uris($theme_json) + { + } + } + /** + * WP_Theme_JSON_Schema class + * + * @package WordPress + * @subpackage Theme + * @since 5.9.0 + */ + /** + * Class that migrates a given theme.json structure to the latest schema. + * + * This class is for internal core usage and is not supposed to be used by extenders (plugins and/or themes). + * This is a low-level API that may need to do breaking changes. Please, + * use get_global_settings, get_global_styles, and get_global_stylesheet instead. + * + * @since 5.9.0 + * @access private + */ + #[\AllowDynamicProperties] + class WP_Theme_JSON_Schema + { + /** + * Maps old properties to their new location within the schema's settings. + * This will be applied at both the defaults and individual block levels. + */ + const V1_TO_V2_RENAMED_PATHS = array('border.customRadius' => 'border.radius', 'spacing.customMargin' => 'spacing.margin', 'spacing.customPadding' => 'spacing.padding', 'typography.customLineHeight' => 'typography.lineHeight'); + /** + * Function that migrates a given theme.json structure to the last version. + * + * @since 5.9.0 + * @since 6.6.0 Migrate up to v3 and add $origin parameter. + * + * @param array $theme_json The structure to migrate. + * @param string $origin Optional. What source of data this object represents. + * One of 'blocks', 'default', 'theme', or 'custom'. Default 'theme'. + * @return array The structure in the last version. + * @phpstan-param 'blocks'|'default'|'theme'|'custom' $origin + */ + public static function migrate($theme_json, $origin = 'theme') + { + } + } + /** + * WP_Theme_JSON class + * + * @package WordPress + * @subpackage Theme + * @since 5.8.0 + */ + /** + * Class that encapsulates the processing of structures that adhere to the theme.json spec. + * + * This class is for internal core usage and is not supposed to be used by extenders (plugins and/or themes). + * This is a low-level API that may need to do breaking changes. Please, + * use get_global_settings, get_global_styles, and get_global_stylesheet instead. + * + * @access private + */ + #[\AllowDynamicProperties] + class WP_Theme_JSON + { + /** + * Container of data in theme.json format. + * + * @since 5.8.0 + * @var array + */ + protected $theme_json = \null; + /** + * Holds block metadata extracted from block.json + * to be shared among all instances so we don't + * process it twice. + * + * @since 5.8.0 + * @since 6.1.0 Initialize as an empty array. + * @var array + */ + protected static $blocks_metadata = array(); + /** + * The CSS selector for the top-level preset settings. + * + * @since 6.6.0 + * @var string + */ + const ROOT_CSS_PROPERTIES_SELECTOR = ':root'; + /** + * The CSS selector for the top-level styles. + * + * @since 5.8.0 + * @var string + */ + const ROOT_BLOCK_SELECTOR = 'body'; + /** + * The sources of data this object can represent. + * + * @since 5.8.0 + * @since 6.1.0 Added 'blocks'. + * @var string[] + */ + const VALID_ORIGINS = array('default', 'blocks', 'theme', 'custom'); + /** + * Presets are a set of values that serve + * to bootstrap some styles: colors, font sizes, etc. + * + * They are a unkeyed array of values such as: + * + * array( + * array( + * 'slug' => 'unique-name-within-the-set', + * 'name' => 'Name for the UI', + * <value_key> => 'value' + * ), + * ) + * + * This contains the necessary metadata to process them: + * + * - path => Where to find the preset within the settings section. + * - prevent_override => Disables override of default presets by theme presets. + * The relationship between whether to override the defaults + * and whether the defaults are enabled is inverse: + * - If defaults are enabled => theme presets should not be overridden + * - If defaults are disabled => theme presets should be overridden + * For example, a theme sets defaultPalette to false, + * making the default palette hidden from the user. + * In that case, we want all the theme presets to be present, + * so they should override the defaults by setting this false. + * - use_default_names => whether to use the default names + * - value_key => the key that represents the value + * - value_func => optionally, instead of value_key, a function to generate + * the value that takes a preset as an argument + * (either value_key or value_func should be present) + * - css_vars => template string to use in generating the CSS Custom Property. + * Example output: "--wp--preset--duotone--blue: <value>" will generate as many CSS Custom Properties as presets defined + * substituting the $slug for the slug's value for each preset value. + * - classes => array containing a structure with the classes to + * generate for the presets, where for each array item + * the key is the class name and the value the property name. + * The "$slug" substring will be replaced by the slug of each preset. + * For example: + * 'classes' => array( + * '.has-$slug-color' => 'color', + * '.has-$slug-background-color' => 'background-color', + * '.has-$slug-border-color' => 'border-color', + * ) + * - properties => array of CSS properties to be used by kses to + * validate the content of each preset + * by means of the remove_insecure_properties method. + * + * @since 5.8.0 + * @since 5.9.0 Added the `color.duotone` and `typography.fontFamilies` presets, + * `use_default_names` preset key, and simplified the metadata structure. + * @since 6.0.0 Replaced `override` with `prevent_override` and updated the + * `prevent_override` value for `color.duotone` to use `color.defaultDuotone`. + * @since 6.2.0 Added 'shadow' presets. + * @since 6.3.0 Replaced value_func for duotone with `null`. Custom properties are handled by class-wp-duotone.php. + * @since 6.6.0 Added the `dimensions.aspectRatios` and `dimensions.defaultAspectRatios` presets. + * Updated the 'prevent_override' value for font size presets to use 'typography.defaultFontSizes' + * and spacing size presets to use `spacing.defaultSpacingSizes`. + * @var array + */ + const PRESETS_METADATA = array(array('path' => array('dimensions', 'aspectRatios'), 'prevent_override' => array('dimensions', 'defaultAspectRatios'), 'use_default_names' => \false, 'value_key' => 'ratio', 'css_vars' => '--wp--preset--aspect-ratio--$slug', 'classes' => array(), 'properties' => array('aspect-ratio')), array('path' => array('color', 'palette'), 'prevent_override' => array('color', 'defaultPalette'), 'use_default_names' => \false, 'value_key' => 'color', 'css_vars' => '--wp--preset--color--$slug', 'classes' => array('.has-$slug-color' => 'color', '.has-$slug-background-color' => 'background-color', '.has-$slug-border-color' => 'border-color'), 'properties' => array('color', 'background-color', 'border-color')), array('path' => array('color', 'gradients'), 'prevent_override' => array('color', 'defaultGradients'), 'use_default_names' => \false, 'value_key' => 'gradient', 'css_vars' => '--wp--preset--gradient--$slug', 'classes' => array('.has-$slug-gradient-background' => 'background'), 'properties' => array('background')), array( + 'path' => array('color', 'duotone'), + 'prevent_override' => array('color', 'defaultDuotone'), + 'use_default_names' => \false, + 'value_func' => \null, + // CSS Custom Properties for duotone are handled by block supports in class-wp-duotone.php. + 'css_vars' => \null, + 'classes' => array(), + 'properties' => array('filter'), + ), array('path' => array('typography', 'fontSizes'), 'prevent_override' => array('typography', 'defaultFontSizes'), 'use_default_names' => \true, 'value_func' => 'wp_get_typography_font_size_value', 'css_vars' => '--wp--preset--font-size--$slug', 'classes' => array('.has-$slug-font-size' => 'font-size'), 'properties' => array('font-size')), array('path' => array('typography', 'fontFamilies'), 'prevent_override' => \false, 'use_default_names' => \false, 'value_key' => 'fontFamily', 'css_vars' => '--wp--preset--font-family--$slug', 'classes' => array('.has-$slug-font-family' => 'font-family'), 'properties' => array('font-family')), array('path' => array('spacing', 'spacingSizes'), 'prevent_override' => array('spacing', 'defaultSpacingSizes'), 'use_default_names' => \true, 'value_key' => 'size', 'css_vars' => '--wp--preset--spacing--$slug', 'classes' => array(), 'properties' => array('padding', 'margin')), array('path' => array('shadow', 'presets'), 'prevent_override' => array('shadow', 'defaultPresets'), 'use_default_names' => \false, 'value_key' => 'shadow', 'css_vars' => '--wp--preset--shadow--$slug', 'classes' => array(), 'properties' => array('box-shadow'))); + /** + * Metadata for style properties. + * + * Each element is a direct mapping from the CSS property name to the + * path to the value in theme.json & block attributes. + * + * @since 5.8.0 + * @since 5.9.0 Added the `border-*`, `font-family`, `font-style`, `font-weight`, + * `letter-spacing`, `margin-*`, `padding-*`, `--wp--style--block-gap`, + * `text-decoration`, `text-transform`, and `filter` properties, + * simplified the metadata structure. + * @since 6.1.0 Added the `border-*-color`, `border-*-width`, `border-*-style`, + * `--wp--style--root--padding-*`, and `box-shadow` properties, + * removed the `--wp--style--block-gap` property. + * @since 6.2.0 Added `outline-*`, and `min-height` properties. + * @since 6.3.0 Added `column-count` property. + * @since 6.4.0 Added `writing-mode` property. + * @since 6.5.0 Added `aspect-ratio` property. + * @since 6.6.0 Added `background-[image|position|repeat|size]` properties. + * + * @var array + */ + const PROPERTIES_METADATA = array('aspect-ratio' => array('dimensions', 'aspectRatio'), 'background' => array('color', 'gradient'), 'background-color' => array('color', 'background'), 'background-image' => array('background', 'backgroundImage'), 'background-position' => array('background', 'backgroundPosition'), 'background-repeat' => array('background', 'backgroundRepeat'), 'background-size' => array('background', 'backgroundSize'), 'border-radius' => array('border', 'radius'), 'border-top-left-radius' => array('border', 'radius', 'topLeft'), 'border-top-right-radius' => array('border', 'radius', 'topRight'), 'border-bottom-left-radius' => array('border', 'radius', 'bottomLeft'), 'border-bottom-right-radius' => array('border', 'radius', 'bottomRight'), 'border-color' => array('border', 'color'), 'border-width' => array('border', 'width'), 'border-style' => array('border', 'style'), 'border-top-color' => array('border', 'top', 'color'), 'border-top-width' => array('border', 'top', 'width'), 'border-top-style' => array('border', 'top', 'style'), 'border-right-color' => array('border', 'right', 'color'), 'border-right-width' => array('border', 'right', 'width'), 'border-right-style' => array('border', 'right', 'style'), 'border-bottom-color' => array('border', 'bottom', 'color'), 'border-bottom-width' => array('border', 'bottom', 'width'), 'border-bottom-style' => array('border', 'bottom', 'style'), 'border-left-color' => array('border', 'left', 'color'), 'border-left-width' => array('border', 'left', 'width'), 'border-left-style' => array('border', 'left', 'style'), 'color' => array('color', 'text'), 'text-align' => array('typography', 'textAlign'), 'column-count' => array('typography', 'textColumns'), 'font-family' => array('typography', 'fontFamily'), 'font-size' => array('typography', 'fontSize'), 'font-style' => array('typography', 'fontStyle'), 'font-weight' => array('typography', 'fontWeight'), 'letter-spacing' => array('typography', 'letterSpacing'), 'line-height' => array('typography', 'lineHeight'), 'margin' => array('spacing', 'margin'), 'margin-top' => array('spacing', 'margin', 'top'), 'margin-right' => array('spacing', 'margin', 'right'), 'margin-bottom' => array('spacing', 'margin', 'bottom'), 'margin-left' => array('spacing', 'margin', 'left'), 'min-height' => array('dimensions', 'minHeight'), 'outline-color' => array('outline', 'color'), 'outline-offset' => array('outline', 'offset'), 'outline-style' => array('outline', 'style'), 'outline-width' => array('outline', 'width'), 'padding' => array('spacing', 'padding'), 'padding-top' => array('spacing', 'padding', 'top'), 'padding-right' => array('spacing', 'padding', 'right'), 'padding-bottom' => array('spacing', 'padding', 'bottom'), 'padding-left' => array('spacing', 'padding', 'left'), '--wp--style--root--padding' => array('spacing', 'padding'), '--wp--style--root--padding-top' => array('spacing', 'padding', 'top'), '--wp--style--root--padding-right' => array('spacing', 'padding', 'right'), '--wp--style--root--padding-bottom' => array('spacing', 'padding', 'bottom'), '--wp--style--root--padding-left' => array('spacing', 'padding', 'left'), 'text-decoration' => array('typography', 'textDecoration'), 'text-transform' => array('typography', 'textTransform'), 'filter' => array('filter', 'duotone'), 'box-shadow' => array('shadow'), 'writing-mode' => array('typography', 'writingMode')); + /** + * Indirect metadata for style properties that are not directly output. + * + * Each element maps from a CSS property name to an array of + * paths to the value in theme.json & block attributes. + * + * Indirect properties are not output directly by `compute_style_properties`, + * but are used elsewhere in the processing of global styles. The indirect + * property is used to validate whether a style value is allowed. + * + * @since 6.2.0 + * @since 6.6.0 Added background-image properties. + * + * @var array + */ + const INDIRECT_PROPERTIES_METADATA = array('gap' => array(array('spacing', 'blockGap')), 'column-gap' => array(array('spacing', 'blockGap', 'left')), 'row-gap' => array(array('spacing', 'blockGap', 'top')), 'max-width' => array(array('layout', 'contentSize'), array('layout', 'wideSize')), 'background-image' => array(array('background', 'backgroundImage', 'url'))); + /** + * Protected style properties. + * + * These style properties are only rendered if a setting enables it + * via a value other than `null`. + * + * Each element maps the style property to the corresponding theme.json + * setting key. + * + * @since 5.9.0 + */ + const PROTECTED_PROPERTIES = array('spacing.blockGap' => array('spacing', 'blockGap')); + /** + * The top-level keys a theme.json can have. + * + * @since 5.8.0 As `ALLOWED_TOP_LEVEL_KEYS`. + * @since 5.9.0 Renamed from `ALLOWED_TOP_LEVEL_KEYS` to `VALID_TOP_LEVEL_KEYS`, + * added the `customTemplates` and `templateParts` values. + * @since 6.3.0 Added the `description` value. + * @since 6.6.0 Added `blockTypes` to support block style variation theme.json partials. + * @var string[] + */ + const VALID_TOP_LEVEL_KEYS = array('blockTypes', 'customTemplates', 'description', 'patterns', 'settings', 'slug', 'styles', 'templateParts', 'title', 'version'); + /** + * The valid properties under the settings key. + * + * @since 5.8.0 As `ALLOWED_SETTINGS`. + * @since 5.9.0 Renamed from `ALLOWED_SETTINGS` to `VALID_SETTINGS`, + * added new properties for `border`, `color`, `spacing`, + * and `typography`, and renamed others according to the new schema. + * @since 6.0.0 Added `color.defaultDuotone`. + * @since 6.1.0 Added `layout.definitions` and `useRootPaddingAwareAlignments`. + * @since 6.2.0 Added `dimensions.minHeight`, 'shadow.presets', 'shadow.defaultPresets', + * `position.fixed` and `position.sticky`. + * @since 6.3.0 Added support for `typography.textColumns`, removed `layout.definitions`. + * @since 6.4.0 Added support for `layout.allowEditing`, `background.backgroundImage`, + * `typography.writingMode`, `lightbox.enabled` and `lightbox.allowEditing`. + * @since 6.5.0 Added support for `layout.allowCustomContentAndWideSize`, + * `background.backgroundSize` and `dimensions.aspectRatio`. + * @since 6.6.0 Added support for 'dimensions.aspectRatios', 'dimensions.defaultAspectRatios', + * 'typography.defaultFontSizes', and 'spacing.defaultSpacingSizes'. + * @var array + */ + const VALID_SETTINGS = array('appearanceTools' => \null, 'useRootPaddingAwareAlignments' => \null, 'background' => array('backgroundImage' => \null, 'backgroundSize' => \null), 'border' => array('color' => \null, 'radius' => \null, 'style' => \null, 'width' => \null), 'color' => array('background' => \null, 'custom' => \null, 'customDuotone' => \null, 'customGradient' => \null, 'defaultDuotone' => \null, 'defaultGradients' => \null, 'defaultPalette' => \null, 'duotone' => \null, 'gradients' => \null, 'link' => \null, 'heading' => \null, 'button' => \null, 'caption' => \null, 'palette' => \null, 'text' => \null), 'custom' => \null, 'dimensions' => array('aspectRatio' => \null, 'aspectRatios' => \null, 'defaultAspectRatios' => \null, 'minHeight' => \null), 'layout' => array('contentSize' => \null, 'wideSize' => \null, 'allowEditing' => \null, 'allowCustomContentAndWideSize' => \null), 'lightbox' => array('enabled' => \null, 'allowEditing' => \null), 'position' => array('fixed' => \null, 'sticky' => \null), 'spacing' => array('customSpacingSize' => \null, 'defaultSpacingSizes' => \null, 'spacingSizes' => \null, 'spacingScale' => \null, 'blockGap' => \null, 'margin' => \null, 'padding' => \null, 'units' => \null), 'shadow' => array('presets' => \null, 'defaultPresets' => \null), 'typography' => array('fluid' => \null, 'customFontSize' => \null, 'defaultFontSizes' => \null, 'dropCap' => \null, 'fontFamilies' => \null, 'fontSizes' => \null, 'fontStyle' => \null, 'fontWeight' => \null, 'letterSpacing' => \null, 'lineHeight' => \null, 'textAlign' => \null, 'textColumns' => \null, 'textDecoration' => \null, 'textTransform' => \null, 'writingMode' => \null)); + /* + * The valid properties for fontFamilies under settings key. + * + * @since 6.5.0 + * + * @var array + */ + const FONT_FAMILY_SCHEMA = array(array('fontFamily' => \null, 'name' => \null, 'slug' => \null, 'fontFace' => array(array('ascentOverride' => \null, 'descentOverride' => \null, 'fontDisplay' => \null, 'fontFamily' => \null, 'fontFeatureSettings' => \null, 'fontStyle' => \null, 'fontStretch' => \null, 'fontVariationSettings' => \null, 'fontWeight' => \null, 'lineGapOverride' => \null, 'sizeAdjust' => \null, 'src' => \null, 'unicodeRange' => \null)))); + /** + * The valid properties under the styles key. + * + * @since 5.8.0 As `ALLOWED_STYLES`. + * @since 5.9.0 Renamed from `ALLOWED_STYLES` to `VALID_STYLES`, + * added new properties for `border`, `filter`, `spacing`, + * and `typography`. + * @since 6.1.0 Added new side properties for `border`, + * added new property `shadow`, + * updated `blockGap` to be allowed at any level. + * @since 6.2.0 Added `outline`, and `minHeight` properties. + * @since 6.3.0 Added support for `typography.textColumns`. + * @since 6.5.0 Added support for `dimensions.aspectRatio`. + * @since 6.6.0 Added `background` sub properties to top-level only. + * + * @var array + */ + const VALID_STYLES = array('background' => array('backgroundImage' => 'top', 'backgroundPosition' => 'top', 'backgroundRepeat' => 'top', 'backgroundSize' => 'top'), 'border' => array('color' => \null, 'radius' => \null, 'style' => \null, 'width' => \null, 'top' => \null, 'right' => \null, 'bottom' => \null, 'left' => \null), 'color' => array('background' => \null, 'gradient' => \null, 'text' => \null), 'dimensions' => array('aspectRatio' => \null, 'minHeight' => \null), 'filter' => array('duotone' => \null), 'outline' => array('color' => \null, 'offset' => \null, 'style' => \null, 'width' => \null), 'shadow' => \null, 'spacing' => array('margin' => \null, 'padding' => \null, 'blockGap' => \null), 'typography' => array('fontFamily' => \null, 'fontSize' => \null, 'fontStyle' => \null, 'fontWeight' => \null, 'letterSpacing' => \null, 'lineHeight' => \null, 'textAlign' => \null, 'textColumns' => \null, 'textDecoration' => \null, 'textTransform' => \null, 'writingMode' => \null), 'css' => \null); + /** + * Defines which pseudo selectors are enabled for which elements. + * + * The order of the selectors should be: link, any-link, visited, hover, focus, active. + * This is to ensure the user action (hover, focus and active) styles have a higher + * specificity than the visited styles, which in turn have a higher specificity than + * the unvisited styles. + * + * See https://core.trac.wordpress.org/ticket/56928. + * Note: this will affect both top-level and block-level elements. + * + * @since 6.1.0 + * @since 6.2.0 Added support for ':link' and ':any-link'. + */ + const VALID_ELEMENT_PSEUDO_SELECTORS = array('link' => array(':link', ':any-link', ':visited', ':hover', ':focus', ':active'), 'button' => array(':link', ':any-link', ':visited', ':hover', ':focus', ':active')); + /** + * The valid elements that can be found under styles. + * + * @since 5.8.0 + * @since 6.1.0 Added `heading`, `button`, and `caption` elements. + * @var string[] + */ + const ELEMENTS = array( + 'link' => 'a:where(:not(.wp-element-button))', + // The `where` is needed to lower the specificity. + 'heading' => 'h1, h2, h3, h4, h5, h6', + 'h1' => 'h1', + 'h2' => 'h2', + 'h3' => 'h3', + 'h4' => 'h4', + 'h5' => 'h5', + 'h6' => 'h6', + // We have the .wp-block-button__link class so that this will target older buttons that have been serialized. + 'button' => '.wp-element-button, .wp-block-button__link', + // The block classes are necessary to target older content that won't use the new class names. + 'caption' => '.wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption', + 'cite' => 'cite', + ); + const __EXPERIMENTAL_ELEMENT_CLASS_NAMES = array('button' => 'wp-element-button', 'caption' => 'wp-element-caption'); + /** + * List of block support features that can have their related styles + * generated under their own feature level selector rather than the block's. + * + * @since 6.1.0 + * @var string[] + */ + const BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = array('__experimentalBorder' => 'border', 'color' => 'color', 'spacing' => 'spacing', 'typography' => 'typography'); + /** + * Return the input schema at the root and per origin. + * + * @since 6.5.0 + * + * @param array $schema The base schema. + * @return array The schema at the root and per origin. + * + * Example: + * schema_in_root_and_per_origin( + * array( + * 'fontFamily' => null, + * 'slug' => null, + * ) + * ) + * + * Returns: + * array( + * 'fontFamily' => null, + * 'slug' => null, + * 'default' => array( + * 'fontFamily' => null, + * 'slug' => null, + * ), + * 'blocks' => array( + * 'fontFamily' => null, + * 'slug' => null, + * ), + * 'theme' => array( + * 'fontFamily' => null, + * 'slug' => null, + * ), + * 'custom' => array( + * 'fontFamily' => null, + * 'slug' => null, + * ), + * ) + */ + protected static function schema_in_root_and_per_origin($schema) + { + } + /** + * Returns a class name by an element name. + * + * @since 6.1.0 + * + * @param string $element The name of the element. + * @return string The name of the class. + */ + public static function get_element_class_name($element) + { + } + /** + * Options that settings.appearanceTools enables. + * + * @since 6.0.0 + * @since 6.2.0 Added `dimensions.minHeight` and `position.sticky`. + * @since 6.4.0 Added `background.backgroundImage`. + * @since 6.5.0 Added `background.backgroundSize` and `dimensions.aspectRatio`. + * @var array + */ + const APPEARANCE_TOOLS_OPT_INS = array(array('background', 'backgroundImage'), array('background', 'backgroundSize'), array('border', 'color'), array('border', 'radius'), array('border', 'style'), array('border', 'width'), array('color', 'link'), array('color', 'heading'), array('color', 'button'), array('color', 'caption'), array('dimensions', 'aspectRatio'), array('dimensions', 'minHeight'), array('position', 'sticky'), array('spacing', 'blockGap'), array('spacing', 'margin'), array('spacing', 'padding'), array('typography', 'lineHeight')); + /** + * The latest version of the schema in use. + * + * @since 5.8.0 + * @since 5.9.0 Changed value from 1 to 2. + * @since 6.6.0 Changed value from 2 to 3. + * @var int + */ + const LATEST_SCHEMA = 3; + /** + * Constructor. + * + * @since 5.8.0 + * @since 6.6.0 Key spacingScale by origin, and Pre-generate the spacingSizes from spacingScale. + * Added unwrapping of shared block style variations into block type variations if registered. + * + * @param array $theme_json A structure that follows the theme.json schema. + * @param string $origin Optional. What source of data this object represents. + * One of 'blocks', 'default', 'theme', or 'custom'. Default 'theme'. + * @phpstan-param 'blocks'|'default'|'theme'|'custom' $origin + */ + public function __construct($theme_json = array('version' => self::LATEST_SCHEMA), $origin = 'theme') + { + } + /** + * Enables some opt-in settings if theme declared support. + * + * @since 5.9.0 + * + * @param array $theme_json A theme.json structure to modify. + * @return array The modified theme.json structure. + */ + protected static function maybe_opt_in_into_settings($theme_json) + { + } + /** + * Enables some settings. + * + * @since 5.9.0 + * + * @param array $context The context to which the settings belong. + */ + protected static function do_opt_in_into_settings(&$context) + { + } + /** + * Sanitizes the input according to the schemas. + * + * @since 5.8.0 + * @since 5.9.0 Added the `$valid_block_names` and `$valid_element_name` parameters. + * @since 6.3.0 Added the `$valid_variations` parameter. + * @since 6.6.0 Updated schema to allow extended block style variations. + * + * @param array $input Structure to sanitize. + * @param array $valid_block_names List of valid block names. + * @param array $valid_element_names List of valid element names. + * @param array $valid_variations List of valid variations per block. + * @return array The sanitized output. + */ + protected static function sanitize($input, $valid_block_names, $valid_element_names, $valid_variations) + { + } + /** + * Appends a sub-selector to an existing one. + * + * Given the compounded $selector "h1, h2, h3" + * and the $to_append selector ".some-class" the result will be + * "h1.some-class, h2.some-class, h3.some-class". + * + * @since 5.8.0 + * @since 6.1.0 Added append position. + * @since 6.3.0 Removed append position parameter. + * + * @param string $selector Original selector. + * @param string $to_append Selector to append. + * @return string The new selector. + */ + protected static function append_to_selector($selector, $to_append) + { + } + /** + * Prepends a sub-selector to an existing one. + * + * Given the compounded $selector "h1, h2, h3" + * and the $to_prepend selector ".some-class " the result will be + * ".some-class h1, .some-class h2, .some-class h3". + * + * @since 6.3.0 + * + * @param string $selector Original selector. + * @param string $to_prepend Selector to prepend. + * @return string The new selector. + */ + protected static function prepend_to_selector($selector, $to_prepend) + { + } + /** + * Returns the metadata for each block. + * + * Example: + * + * { + * 'core/paragraph': { + * 'selector': 'p', + * 'elements': { + * 'link' => 'link selector', + * 'etc' => 'element selector' + * } + * }, + * 'core/heading': { + * 'selector': 'h1', + * 'elements': {} + * }, + * 'core/image': { + * 'selector': '.wp-block-image', + * 'duotone': 'img', + * 'elements': {} + * } + * } + * + * @since 5.8.0 + * @since 5.9.0 Added `duotone` key with CSS selector. + * @since 6.1.0 Added `features` key with block support feature level selectors. + * @since 6.3.0 Refactored and stabilized selectors API. + * @since 6.6.0 Updated to include block style variations from the block styles registry. + * + * @return array Block metadata. + */ + protected static function get_blocks_metadata() + { + } + /** + * Given a tree, removes the keys that are not present in the schema. + * + * It is recursive and modifies the input in-place. + * + * @since 5.8.0 + * + * @param array $tree Input to process. + * @param array $schema Schema to adhere to. + * @return array The modified $tree. + */ + protected static function remove_keys_not_in_schema($tree, $schema) + { + } + /** + * Returns the existing settings for each block. + * + * Example: + * + * { + * 'root': { + * 'color': { + * 'custom': true + * } + * }, + * 'core/paragraph': { + * 'spacing': { + * 'customPadding': true + * } + * } + * } + * + * @since 5.8.0 + * + * @return array Settings per block. + */ + public function get_settings() + { + } + /** + * Returns the stylesheet that results of processing + * the theme.json structure this object represents. + * + * @since 5.8.0 + * @since 5.9.0 Removed the `$type` parameter, added the `$types` and `$origins` parameters. + * @since 6.3.0 Add fallback layout styles for Post Template when block gap support isn't available. + * @since 6.6.0 Added boolean `skip_root_layout_styles` and `include_block_style_variations` options + * to control styles output as desired. + * + * @param string[] $types Types of styles to load. Will load all by default. It accepts: + * - `variables`: only the CSS Custom Properties for presets & custom ones. + * - `styles`: only the styles section in theme.json. + * - `presets`: only the classes for the presets. + * @param string[] $origins A list of origins to include. By default it includes VALID_ORIGINS. + * @param array $options { + * Optional. An array of options for now used for internal purposes only (may change without notice). + * + * @type string $scope Makes sure all style are scoped to a given selector + * @type string $root_selector Overwrites and forces a given selector to be used on the root node + * @type bool $skip_root_layout_styles Omits root layout styles from the generated stylesheet. Default false. + * @type bool $include_block_style_variations Includes styles for block style variations in the generated stylesheet. Default false. + * } + * @return string The resulting stylesheet. + * @phpstan-param array{ + * scope?: string, + * root_selector?: string, + * skip_root_layout_styles?: bool, + * include_block_style_variations?: bool, + * } $options + */ + public function get_stylesheet($types = array('variables', 'styles', 'presets'), $origins = \null, $options = array()) + { + } + /** + * Processes the CSS, to apply nesting. + * + * @since 6.2.0 + * @since 6.6.0 Enforced 0-1-0 specificity for block custom CSS selectors. + * + * @param string $css The CSS to process. + * @param string $selector The selector to nest. + * @return string The processed CSS. + */ + protected function process_blocks_custom_css($css, $selector) + { + } + /** + * Returns the global styles custom CSS. + * + * @since 6.2.0 + * + * @return string The global styles custom CSS. + */ + public function get_custom_css() + { + } + /** + * Returns the page templates of the active theme. + * + * @since 5.9.0 + * + * @return array + */ + public function get_custom_templates() + { + } + /** + * Returns the template part data of active theme. + * + * @since 5.9.0 + * + * @return array + */ + public function get_template_parts() + { + } + /** + * Converts each style section into a list of rulesets + * containing the block styles to be appended to the stylesheet. + * + * See glossary at https://developer.mozilla.org/en-US/docs/Web/CSS/Syntax + * + * For each section this creates a new ruleset such as: + * + * block-selector { + * style-property-one: value; + * } + * + * @since 5.8.0 As `get_block_styles()`. + * @since 5.9.0 Renamed from `get_block_styles()` to `get_block_classes()` + * and no longer returns preset classes. + * Removed the `$setting_nodes` parameter. + * @since 6.1.0 Moved most internal logic to `get_styles_for_block()`. + * + * @param array $style_nodes Nodes with styles. + * @return string The new stylesheet. + */ + protected function get_block_classes($style_nodes) + { + } + /** + * Gets the CSS layout rules for a particular block from theme.json layout definitions. + * + * @since 6.1.0 + * @since 6.3.0 Reduced specificity for layout margin rules. + * @since 6.5.1 Only output rules referencing content and wide sizes when values exist. + * @since 6.5.3 Add types parameter to check if only base layout styles are needed. + * @since 6.6.0 Updated layout style specificity to be compatible with overall 0-1-0 specificity in global styles. + * + * @param array $block_metadata Metadata about the block to get styles for. + * @param array $types Optional. Types of styles to output. If empty, all styles will be output. + * @return string Layout styles for the block. + */ + protected function get_layout_styles($block_metadata, $types = array()) + { + } + /** + * Creates new rulesets as classes for each preset value such as: + * + * .has-value-color { + * color: value; + * } + * + * .has-value-background-color { + * background-color: value; + * } + * + * .has-value-font-size { + * font-size: value; + * } + * + * .has-value-gradient-background { + * background: value; + * } + * + * p.has-value-gradient-background { + * background: value; + * } + * + * @since 5.9.0 + * + * @param array $setting_nodes Nodes with settings. + * @param string[] $origins List of origins to process presets from. + * @return string The new stylesheet. + */ + protected function get_preset_classes($setting_nodes, $origins) + { + } + /** + * Converts each styles section into a list of rulesets + * to be appended to the stylesheet. + * These rulesets contain all the css variables (custom variables and preset variables). + * + * See glossary at https://developer.mozilla.org/en-US/docs/Web/CSS/Syntax + * + * For each section this creates a new ruleset such as: + * + * block-selector { + * --wp--preset--category--slug: value; + * --wp--custom--variable: value; + * } + * + * @since 5.8.0 + * @since 5.9.0 Added the `$origins` parameter. + * + * @param array $nodes Nodes with settings. + * @param string[] $origins List of origins to process. + * @return string The new stylesheet. + */ + protected function get_css_variables($nodes, $origins) + { + } + /** + * Given a selector and a declaration list, + * creates the corresponding ruleset. + * + * @since 5.8.0 + * + * @param string $selector CSS selector. + * @param array $declarations List of declarations. + * @return string The resulting CSS ruleset. + */ + protected static function to_ruleset($selector, $declarations) + { + } + /** + * Given a settings array, returns the generated rulesets + * for the preset classes. + * + * @since 5.8.0 + * @since 5.9.0 Added the `$origins` parameter. + * @since 6.6.0 Added check for root CSS properties selector. + * + * @param array $settings Settings to process. + * @param string $selector Selector wrapping the classes. + * @param string[] $origins List of origins to process. + * @return string The result of processing the presets. + */ + protected static function compute_preset_classes($settings, $selector, $origins) + { + } + /** + * Function that scopes a selector with another one. This works a bit like + * SCSS nesting except the `&` operator isn't supported. + * + * <code> + * $scope = '.a, .b .c'; + * $selector = '> .x, .y'; + * $merged = scope_selector( $scope, $selector ); + * // $merged is '.a > .x, .a .y, .b .c > .x, .b .c .y' + * </code> + * + * @since 5.9.0 + * @since 6.6.0 Added early return if missing scope or selector. + * + * @param string $scope Selector to scope to. + * @param string $selector Original selector. + * @return string Scoped selector. + */ + public static function scope_selector($scope, $selector) + { + } + /** + * Scopes the selectors for a given style node. + * + * This includes the primary selector, i.e. `$node['selector']`, as well as any custom + * selectors for features and subfeatures, e.g. `$node['selectors']['border']` etc. + * + * @since 6.6.0 + * + * @param string $scope Selector to scope to. + * @param array $node Style node with selectors to scope. + * @return array Node with updated selectors. + */ + protected static function scope_style_node_selectors($scope, $node) + { + } + /** + * Gets preset values keyed by slugs based on settings and metadata. + * + * <code> + * $settings = array( + * 'typography' => array( + * 'fontFamilies' => array( + * array( + * 'slug' => 'sansSerif', + * 'fontFamily' => '"Helvetica Neue", sans-serif', + * ), + * array( + * 'slug' => 'serif', + * 'colors' => 'Georgia, serif', + * ) + * ), + * ), + * ); + * $meta = array( + * 'path' => array( 'typography', 'fontFamilies' ), + * 'value_key' => 'fontFamily', + * ); + * $values_by_slug = get_settings_values_by_slug(); + * // $values_by_slug === array( + * // 'sans-serif' => '"Helvetica Neue", sans-serif', + * // 'serif' => 'Georgia, serif', + * // ); + * </code> + * + * @since 5.9.0 + * @since 6.6.0 Passing $settings to the callbacks defined in static::PRESETS_METADATA. + * + * @param array $settings Settings to process. + * @param array $preset_metadata One of the PRESETS_METADATA values. + * @param string[] $origins List of origins to process. + * @return array Array of presets where each key is a slug and each value is the preset value. + */ + protected static function get_settings_values_by_slug($settings, $preset_metadata, $origins) + { + } + /** + * Similar to get_settings_values_by_slug, but doesn't compute the value. + * + * @since 5.9.0 + * + * @param array $settings Settings to process. + * @param array $preset_metadata One of the PRESETS_METADATA values. + * @param string[] $origins List of origins to process. + * @return array Array of presets where the key and value are both the slug. + */ + protected static function get_settings_slugs($settings, $preset_metadata, $origins = \null) + { + } + /** + * Transforms a slug into a CSS Custom Property. + * + * @since 5.9.0 + * + * @param string $input String to replace. + * @param string $slug The slug value to use to generate the custom property. + * @return string The CSS Custom Property. Something along the lines of `--wp--preset--color--black`. + */ + protected static function replace_slug_in_string($input, $slug) + { + } + /** + * Given the block settings, extracts the CSS Custom Properties + * for the presets and adds them to the $declarations array + * following the format: + * + * array( + * 'name' => 'property_name', + * 'value' => 'property_value, + * ) + * + * @since 5.8.0 + * @since 5.9.0 Added the `$origins` parameter. + * + * @param array $settings Settings to process. + * @param string[] $origins List of origins to process. + * @return array The modified $declarations. + */ + protected static function compute_preset_vars($settings, $origins) + { + } + /** + * Given an array of settings, extracts the CSS Custom Properties + * for the custom values and adds them to the $declarations + * array following the format: + * + * array( + * 'name' => 'property_name', + * 'value' => 'property_value, + * ) + * + * @since 5.8.0 + * + * @param array $settings Settings to process. + * @return array The modified $declarations. + */ + protected static function compute_theme_vars($settings) + { + } + /** + * Given a tree, it creates a flattened one + * by merging the keys and binding the leaf values + * to the new keys. + * + * It also transforms camelCase names into kebab-case + * and substitutes '/' by '-'. + * + * This is thought to be useful to generate + * CSS Custom Properties from a tree, + * although there's nothing in the implementation + * of this function that requires that format. + * + * For example, assuming the given prefix is '--wp' + * and the token is '--', for this input tree: + * + * { + * 'some/property': 'value', + * 'nestedProperty': { + * 'sub-property': 'value' + * } + * } + * + * it'll return this output: + * + * { + * '--wp--some-property': 'value', + * '--wp--nested-property--sub-property': 'value' + * } + * + * @since 5.8.0 + * + * @param array $tree Input tree to process. + * @param string $prefix Optional. Prefix to prepend to each variable. Default empty string. + * @param string $token Optional. Token to use between levels. Default '--'. + * @return array The flattened tree. + */ + protected static function flatten_tree($tree, $prefix = '', $token = '--') + { + } + /** + * Given a styles array, it extracts the style properties + * and adds them to the $declarations array following the format: + * + * array( + * 'name' => 'property_name', + * 'value' => 'property_value, + * ) + * + * @since 5.8.0 + * @since 5.9.0 Added the `$settings` and `$properties` parameters. + * @since 6.1.0 Added `$theme_json`, `$selector`, and `$use_root_padding` parameters. + * @since 6.5.0 Output a `min-height: unset` rule when `aspect-ratio` is set. + * @since 6.6.0 Pass current theme JSON settings to wp_get_typography_font_size_value(), and process background properties. + * + * @param array $styles Styles to process. + * @param array $settings Theme settings. + * @param array $properties Properties metadata. + * @param array $theme_json Theme JSON array. + * @param string $selector The style block selector. + * @param boolean $use_root_padding Whether to add custom properties at root level. + * @return array Returns the modified $declarations. + */ + protected static function compute_style_properties($styles, $settings = array(), $properties = \null, $theme_json = \null, $selector = \null, $use_root_padding = \null) + { + } + /** + * Returns the style property for the given path. + * + * It also converts references to a path to the value + * stored at that location, e.g. + * { "ref": "style.color.background" } => "#fff". + * + * @since 5.8.0 + * @since 5.9.0 Added support for values of array type, which are returned as is. + * @since 6.1.0 Added the `$theme_json` parameter. + * @since 6.3.0 It no longer converts the internal format "var:preset|color|secondary" + * to the standard form "--wp--preset--color--secondary". + * This is already done by the sanitize method, + * so every property will be in the standard form. + * + * @param array $styles Styles subtree. + * @param array $path Which property to process. + * @param array $theme_json Theme JSON array. + * @return string|array Style property value. + */ + protected static function get_property_value($styles, $path, $theme_json = \null) + { + } + /** + * Builds metadata for the setting nodes, which returns in the form of: + * + * [ + * [ + * 'path' => ['path', 'to', 'some', 'node' ], + * 'selector' => 'CSS selector for some node' + * ], + * [ + * 'path' => [ 'path', 'to', 'other', 'node' ], + * 'selector' => 'CSS selector for other node' + * ], + * ] + * + * @since 5.8.0 + * + * @param array $theme_json The tree to extract setting nodes from. + * @param array $selectors List of selectors per block. + * @return array An array of setting nodes metadata. + */ + protected static function get_setting_nodes($theme_json, $selectors = array()) + { + } + /** + * Builds metadata for the style nodes, which returns in the form of: + * + * [ + * [ + * 'path' => [ 'path', 'to', 'some', 'node' ], + * 'selector' => 'CSS selector for some node', + * 'duotone' => 'CSS selector for duotone for some node' + * ], + * [ + * 'path' => ['path', 'to', 'other', 'node' ], + * 'selector' => 'CSS selector for other node', + * 'duotone' => null + * ], + * ] + * + * @since 5.8.0 + * @since 6.6.0 Added options array for modifying generated nodes. + * + * @param array $theme_json The tree to extract style nodes from. + * @param array $selectors List of selectors per block. + * @param array $options { + * Optional. An array of options for now used for internal purposes only (may change without notice). + * + * @type bool $include_block_style_variations Includes style nodes for block style variations. Default false. + * } + * @return array An array of style nodes metadata. + * @phpstan-param array{ + * include_block_style_variations?: bool, + * } $options + */ + protected static function get_style_nodes($theme_json, $selectors = array(), $options = array()) + { + } + /** + * A public helper to get the block nodes from a theme.json file. + * + * @since 6.1.0 + * + * @return array The block nodes in theme.json. + */ + public function get_styles_block_nodes() + { + } + /** + * Gets the CSS rules for a particular block from theme.json. + * + * @since 6.1.0 + * @since 6.6.0 Setting a min-height of HTML when root styles have a background gradient or image. + * Updated general global styles specificity to 0-1-0. + * Fixed custom CSS output in block style variations. + * + * @param array $block_metadata Metadata about the block to get styles for. + * + * @return string Styles for the block. + */ + public function get_styles_for_block($block_metadata) + { + } + /** + * Outputs the CSS for layout rules on the root. + * + * @since 6.1.0 + * @since 6.6.0 Use `ROOT_CSS_PROPERTIES_SELECTOR` for CSS custom properties and improved consistency of root padding rules. + * Updated specificity of body margin reset and first/last child selectors. + * + * @param string $selector The root node selector. + * @param array $block_metadata The metadata for the root block. + * @return string The additional root rules CSS. + */ + public function get_root_layout_rules($selector, $block_metadata) + { + } + /** + * For metadata values that can either be booleans or paths to booleans, gets the value. + * + * $data = array( + * 'color' => array( + * 'defaultPalette' => true + * ) + * ); + * + * static::get_metadata_boolean( $data, false ); + * // => false + * + * static::get_metadata_boolean( $data, array( 'color', 'defaultPalette' ) ); + * // => true + * + * @since 6.0.0 + * + * @param array $data The data to inspect. + * @param bool|array $path Boolean or path to a boolean. + * @param bool $default_value Default value if the referenced path is missing. + * Default false. + * @return bool Value of boolean metadata. + */ + protected static function get_metadata_boolean($data, $path, $default_value = \false) + { + } + /** + * Merges new incoming data. + * + * @since 5.8.0 + * @since 5.9.0 Duotone preset also has origins. + * + * @param WP_Theme_JSON $incoming Data to merge. + */ + public function merge($incoming) + { + } + /** + * Converts all filter (duotone) presets into SVGs. + * + * @since 5.9.1 + * + * @param array $origins List of origins to process. + * @return string SVG filters. + */ + public function get_svg_filters($origins) + { + } + /** + * Determines whether a presets should be overridden or not. + * + * @since 5.9.0 + * @deprecated 6.0.0 Use {@see 'get_metadata_boolean'} instead. + * + * @param array $theme_json The theme.json like structure to inspect. + * @param array $path Path to inspect. + * @param bool|array $override Data to compute whether to override the preset. + * @return bool + */ + protected static function should_override_preset($theme_json, $path, $override) + { + } + /** + * Returns the default slugs for all the presets in an associative array + * whose keys are the preset paths and the leaves is the list of slugs. + * + * For example: + * + * array( + * 'color' => array( + * 'palette' => array( 'slug-1', 'slug-2' ), + * 'gradients' => array( 'slug-3', 'slug-4' ), + * ), + * ) + * + * @since 5.9.0 + * + * @param array $data A theme.json like structure. + * @param array $node_path The path to inspect. It's 'settings' by default. + * @return array + */ + protected static function get_default_slugs($data, $node_path) + { + } + /** + * Gets a `default`'s preset name by a provided slug. + * + * @since 5.9.0 + * + * @param string $slug The slug we want to find a match from default presets. + * @param array $base_path The path to inspect. It's 'settings' by default. + * @return string|null + */ + protected function get_name_from_defaults($slug, $base_path) + { + } + /** + * Removes the preset values whose slug is equal to any of given slugs. + * + * @since 5.9.0 + * + * @param array $node The node with the presets to validate. + * @param array $slugs The slugs that should not be overridden. + * @return array The new node. + */ + protected static function filter_slugs($node, $slugs) + { + } + /** + * Removes insecure data from theme.json. + * + * @since 5.9.0 + * @since 6.3.2 Preserves global styles block variations when securing styles. + * @since 6.6.0 Updated to allow variation element styles and $origin parameter. + * + * @param array $theme_json Structure to sanitize. + * @param string $origin Optional. What source of data this object represents. + * One of 'blocks', 'default', 'theme', or 'custom'. Default 'theme'. + * @return array Sanitized structure. + * @phpstan-param 'blocks'|'default'|'theme'|'custom' $origin + */ + public static function remove_insecure_properties($theme_json, $origin = 'theme') + { + } + /** + * Processes a setting node and returns the same node + * without the insecure settings. + * + * @since 5.9.0 + * + * @param array $input Node to process. + * @return array + */ + protected static function remove_insecure_settings($input) + { + } + /** + * Processes a style node and returns the same node + * without the insecure styles. + * + * @since 5.9.0 + * + * @param array $input Node to process. + * @return array + */ + protected static function remove_insecure_styles($input) + { + } + /** + * Checks that a declaration provided by the user is safe. + * + * @since 5.9.0 + * + * @param string $property_name Property name in a CSS declaration, i.e. the `color` in `color: red`. + * @param string $property_value Value in a CSS declaration, i.e. the `red` in `color: red`. + * @return bool + */ + protected static function is_safe_css_declaration($property_name, $property_value) + { + } + /** + * Returns the raw data. + * + * @since 5.8.0 + * + * @return array Raw data. + */ + public function get_raw_data() + { + } + /** + * Transforms the given editor settings according the + * add_theme_support format to the theme.json format. + * + * @since 5.8.0 + * + * @param array $settings Existing editor settings. + * @return array Config that adheres to the theme.json schema. + */ + public static function get_from_editor_settings($settings) + { + } + /** + * Returns the current theme's wanted patterns(slugs) to be + * registered from Pattern Directory. + * + * @since 6.0.0 + * + * @return string[] + */ + public function get_patterns() + { + } + /** + * Returns a valid theme.json as provided by a theme. + * + * Unlike get_raw_data() this returns the presets flattened, as provided by a theme. + * This also uses appearanceTools instead of their opt-ins if all of them are true. + * + * @since 6.0.0 + * + * @return array + */ + public function get_data() + { + } + /** + * Sets the spacingSizes array based on the spacingScale values from theme.json. + * + * @since 6.1.0 + * @deprecated 6.6.0 No longer used as the spacingSizes are automatically + * generated in the constructor and merge methods instead + * of manually after instantiation. + * + * @return null|void + */ + public function set_spacing_sizes() + { + } + /** + * Returns the selectors metadata for a block. + * + * @since 6.3.0 + * + * @param object $block_type The block type. + * @param string $root_selector The block's root selector. + * + * @return array The custom selectors set by the block. + */ + protected static function get_block_selectors($block_type, $root_selector) + { + } + /** + * Generates all the element selectors for a block. + * + * @since 6.3.0 + * + * @param string $root_selector The block's root CSS selector. + * @return array The block's element selectors. + */ + protected static function get_block_element_selectors($root_selector) + { + } + /** + * Generates style declarations for a node's features e.g., color, border, + * typography etc. that have custom selectors in their related block's + * metadata. + * + * @since 6.3.0 + * + * @param object $metadata The related block metadata containing selectors. + * @param object $node A merged theme.json node for block or variation. + * + * @return array The style declarations for the node's features with custom + * selectors. + */ + protected function get_feature_declarations_for_node($metadata, &$node) + { + } + /** + * Resolves the values of CSS variables in the given styles. + * + * @since 6.3.0 + * @param WP_Theme_JSON $theme_json The theme json resolver. + * + * @return WP_Theme_JSON The $theme_json with resolved variables. + */ + public static function resolve_variables($theme_json) + { + } + /** + * Generates a selector for a block style variation. + * + * @since 6.5.0 + * + * @param string $variation_name Name of the block style variation. + * @param string $block_selector CSS selector for the block. + * @return string Block selector with block style variation selector added to it. + */ + protected static function get_block_style_variation_selector($variation_name, $block_selector) + { + } + /** + * Collects valid block style variations keyed by block type. + * + * @since 6.6.0 + * + * @return array Valid block style variations by block type. + */ + protected static function get_valid_block_style_variations() + { + } + } + /** + * WP_Theme Class + * + * @package WordPress + * @subpackage Theme + * @since 3.4.0 + * @phpstan-type ThemeKey 'Name'|'Version'|'Status'|'Title'|'Author'|'Author Name'|'Author URI'|'Description'|'Template'|'Stylesheet'|'Template Files'|'Stylesheet Files'|'Template Dir'|'Stylesheet Dir'|'Screenshot'|'Tags'|'Theme Root'|'Theme Root URI'|'Parent Theme' + */ + #[\AllowDynamicProperties] + final class WP_Theme implements \ArrayAccess + { + /** + * Whether the theme has been marked as updateable. + * + * @since 4.4.0 + * @var bool + * + * @see WP_MS_Themes_List_Table + */ + public $update = \false; + /** + * Constructor for WP_Theme. + * + * @since 3.4.0 + * + * @global array $wp_theme_directories + * + * @param string $theme_dir Directory of the theme within the theme_root. + * @param string $theme_root Theme root. + * @param WP_Theme|null $_child If this theme is a parent theme, the child may be passed for validation purposes. + * @phpstan-return void + */ + public function __construct($theme_dir, $theme_root, $_child = \null) + { + } + /** + * When converting the object to a string, the theme name is returned. + * + * @since 3.4.0 + * + * @return string Theme name, ready for display (translated) + */ + public function __toString() + { + } + /** + * __isset() magic method for properties formerly returned by current_theme_info() + * + * @since 3.4.0 + * + * @param string $offset Property to check if set. + * @return bool Whether the given property is set. + */ + public function __isset($offset) + { + } + /** + * __get() magic method for properties formerly returned by current_theme_info() + * + * @since 3.4.0 + * + * @param string $offset Property to get. + * @return mixed Property value. + */ + public function __get($offset) + { + } + /** + * Method to implement ArrayAccess for keys formerly returned by get_themes() + * + * @since 3.4.0 + * + * @param mixed $offset + * @param mixed $value + */ + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value) + { + } + /** + * Method to implement ArrayAccess for keys formerly returned by get_themes() + * + * @since 3.4.0 + * + * @param mixed $offset + */ + #[\ReturnTypeWillChange] + public function offsetUnset($offset) + { + } + /** + * Method to implement ArrayAccess for keys formerly returned by get_themes() + * + * @since 3.4.0 + * + * @param mixed $offset + * @return bool + * @phpstan-return ($offset is ThemeKey ? true : false) + */ + #[\ReturnTypeWillChange] + public function offsetExists($offset) + { + } + /** + * Method to implement ArrayAccess for keys formerly returned by get_themes(). + * + * Author, Author Name, Author URI, and Description did not previously return + * translated data. We are doing so now as it is safe to do. However, as + * Name and Title could have been used as the key for get_themes(), both remain + * untranslated for back compatibility. This means that ['Name'] is not ideal, + * and care should be taken to use `$theme::display( 'Name' )` to get a properly + * translated header. + * + * @since 3.4.0 + * + * @param mixed $offset + * @return mixed + * @phpstan-return ($offset is ThemeKey ? mixed : null) + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + } + /** + * Returns errors property. + * + * @since 3.4.0 + * + * @return WP_Error|false WP_Error if there are errors, or false. + */ + public function errors() + { + } + /** + * Determines whether the theme exists. + * + * A theme with errors exists. A theme with the error of 'theme_not_found', + * meaning that the theme's directory was not found, does not exist. + * + * @since 3.4.0 + * + * @return bool Whether the theme exists. + */ + public function exists() + { + } + /** + * Returns reference to the parent theme. + * + * @since 3.4.0 + * + * @return WP_Theme|false Parent theme, or false if the active theme is not a child theme. + */ + public function parent() + { + } + /** + * Perform reinitialization tasks. + * + * Prevents a callback from being injected during unserialization of an object. + */ + public function __wakeup() + { + } + /** + * Clears the cache for the theme. + * + * @since 3.4.0 + */ + public function cache_delete() + { + } + /** + * Gets a raw, unformatted theme header. + * + * The header is sanitized, but is not translated, and is not marked up for display. + * To get a theme header for display, use the display() method. + * + * Use the get_template() method, not the 'Template' header, for finding the template. + * The 'Template' header is only good for what was written in the style.css, while + * get_template() takes into account where WordPress actually located the theme and + * whether it is actually valid. + * + * @since 3.4.0 + * + * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags. + * @return string|array|false String or array (for Tags header) on success, false on failure. + * @phpstan-return ($header is 'Name'|'ThemeURI'|'Description'|'Author'|'AuthorURI'|'Version'|'Template'|'Status'|'Tags'|'TextDomain'|'DomainPath'|'RequiresWP'|'RequiresPHP'|'UpdateURI' ? ($header is 'Tags' ? string[] : string) : false) + */ + public function get($header) + { + } + /** + * Gets a theme header, formatted and translated for display. + * + * @since 3.4.0 + * + * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags. + * @param bool $markup Optional. Whether to mark up the header. Defaults to true. + * @param bool $translate Optional. Whether to translate the header. Defaults to true. + * @return string|array|false Processed header. An array for Tags if `$markup` is false, string otherwise. + * False on failure. + */ + public function display($header, $markup = \true, $translate = \true) + { + } + /** + * Returns the directory name of the theme's "stylesheet" files, inside the theme root. + * + * In the case of a child theme, this is directory name of the child theme. + * Otherwise, get_stylesheet() is the same as get_template(). + * + * @since 3.4.0 + * + * @return string Stylesheet + */ + public function get_stylesheet() + { + } + /** + * Returns the directory name of the theme's "template" files, inside the theme root. + * + * In the case of a child theme, this is the directory name of the parent theme. + * Otherwise, the get_template() is the same as get_stylesheet(). + * + * @since 3.4.0 + * + * @return string Template + */ + public function get_template() + { + } + /** + * Returns the absolute path to the directory of a theme's "stylesheet" files. + * + * In the case of a child theme, this is the absolute path to the directory + * of the child theme's files. + * + * @since 3.4.0 + * + * @return string Absolute path of the stylesheet directory. + */ + public function get_stylesheet_directory() + { + } + /** + * Returns the absolute path to the directory of a theme's "template" files. + * + * In the case of a child theme, this is the absolute path to the directory + * of the parent theme's files. + * + * @since 3.4.0 + * + * @return string Absolute path of the template directory. + */ + public function get_template_directory() + { + } + /** + * Returns the URL to the directory of a theme's "stylesheet" files. + * + * In the case of a child theme, this is the URL to the directory of the + * child theme's files. + * + * @since 3.4.0 + * + * @return string URL to the stylesheet directory. + */ + public function get_stylesheet_directory_uri() + { + } + /** + * Returns the URL to the directory of a theme's "template" files. + * + * In the case of a child theme, this is the URL to the directory of the + * parent theme's files. + * + * @since 3.4.0 + * + * @return string URL to the template directory. + */ + public function get_template_directory_uri() + { + } + /** + * Returns the absolute path to the directory of the theme root. + * + * This is typically the absolute path to wp-content/themes. + * + * @since 3.4.0 + * + * @return string Theme root. + */ + public function get_theme_root() + { + } + /** + * Returns the URL to the directory of the theme root. + * + * This is typically the absolute URL to wp-content/themes. This forms the basis + * for all other URLs returned by WP_Theme, so we pass it to the public function + * get_theme_root_uri() and allow it to run the {@see 'theme_root_uri'} filter. + * + * @since 3.4.0 + * + * @return string Theme root URI. + */ + public function get_theme_root_uri() + { + } + /** + * Returns the main screenshot file for the theme. + * + * The main screenshot is called screenshot.png. gif and jpg extensions are also allowed. + * + * Screenshots for a theme must be in the stylesheet directory. (In the case of child + * themes, parent theme screenshots are not inherited.) + * + * @since 3.4.0 + * + * @param string $uri Type of URL to return, either 'relative' or an absolute URI. Defaults to absolute URI. + * @return string|false Screenshot file. False if the theme does not have a screenshot. + */ + public function get_screenshot($uri = 'uri') + { + } + /** + * Returns files in the theme's directory. + * + * @since 3.4.0 + * + * @param string[]|string $type Optional. Array of extensions to find, string of a single extension, + * or null for all extensions. Default null. + * @param int $depth Optional. How deep to search for files. Defaults to a flat scan (0 depth). + * -1 depth is infinite. + * @param bool $search_parent Optional. Whether to return parent files. Default false. + * @return string[] Array of files, keyed by the path to the file relative to the theme's directory, with the values + * being absolute paths. + */ + public function get_files($type = \null, $depth = 0, $search_parent = \false) + { + } + /** + * Returns the theme's post templates. + * + * @since 4.7.0 + * @since 5.8.0 Include block templates. + * + * @return array[] Array of page template arrays, keyed by post type and filename, + * with the value of the translated header name. + */ + public function get_post_templates() + { + } + /** + * Returns the theme's post templates for a given post type. + * + * @since 3.4.0 + * @since 4.7.0 Added the `$post_type` parameter. + * + * @param WP_Post|null $post Optional. The post being edited, provided for context. + * @param string $post_type Optional. Post type to get the templates for. Default 'page'. + * If a post is provided, its post type is used. + * @return string[] Array of template header names keyed by the template file name. + */ + public function get_page_templates($post = \null, $post_type = 'page') + { + } + /** + * Loads the theme's textdomain. + * + * Translation files are not inherited from the parent theme. TODO: If this fails for the + * child theme, it should probably try to load the parent theme's translations. + * + * @since 3.4.0 + * + * @return bool True if the textdomain was successfully loaded or has already been loaded. + * False if no textdomain was specified in the file headers, or if the domain could not be loaded. + */ + public function load_textdomain() + { + } + /** + * Determines whether the theme is allowed (multisite only). + * + * @since 3.4.0 + * + * @param string $check Optional. Whether to check only the 'network'-wide settings, the 'site' + * settings, or 'both'. Defaults to 'both'. + * @param int $blog_id Optional. Ignored if only network-wide settings are checked. Defaults to current site. + * @return bool Whether the theme is allowed for the network. Returns true in single-site. + */ + public function is_allowed($check = 'both', $blog_id = \null) + { + } + /** + * Returns whether this theme is a block-based theme or not. + * + * @since 5.9.0 + * + * @return bool + */ + public function is_block_theme() + { + } + /** + * Retrieves the path of a file in the theme. + * + * Searches in the stylesheet directory before the template directory so themes + * which inherit from a parent theme can just override one file. + * + * @since 5.9.0 + * + * @param string $file Optional. File to search for in the stylesheet directory. + * @return string The path of the file. + */ + public function get_file_path($file = '') + { + } + /** + * Determines the latest WordPress default theme that is installed. + * + * This hits the filesystem. + * + * @since 4.4.0 + * + * @return WP_Theme|false Object, or false if no theme is installed, which would be bad. + */ + public static function get_core_default_theme() + { + } + /** + * Returns array of stylesheet names of themes allowed on the site or network. + * + * @since 3.4.0 + * + * @param int $blog_id Optional. ID of the site. Defaults to the current site. + * @return string[] Array of stylesheet names. + */ + public static function get_allowed($blog_id = \null) + { + } + /** + * Returns array of stylesheet names of themes allowed on the network. + * + * @since 3.4.0 + * + * @return string[] Array of stylesheet names. + */ + public static function get_allowed_on_network() + { + } + /** + * Returns array of stylesheet names of themes allowed on the site. + * + * @since 3.4.0 + * + * @param int $blog_id Optional. ID of the site. Defaults to the current site. + * @return string[] Array of stylesheet names. + */ + public static function get_allowed_on_site($blog_id = \null) + { + } + /** + * Returns the folder names of the block template directories. + * + * @since 6.4.0 + * + * @return string[] { + * Folder names used by block themes. + * + * @type string $wp_template Theme-relative directory name for block templates. + * @type string $wp_template_part Theme-relative directory name for block template parts. + * } + * @phpstan-return array{ + * wp_template: string, + * wp_template_part: string, + * } + */ + public function get_block_template_folders() + { + } + /** + * Gets block pattern data for a specified theme. + * Each pattern is defined as a PHP file and defines + * its metadata using plugin-style headers. The minimum required definition is: + * + * /** + * * Title: My Pattern + * * Slug: my-theme/my-pattern + * * + * + * The output of the PHP source corresponds to the content of the pattern, e.g.: + * + * <main><p><?php echo "Hello"; ?></p></main> + * + * If applicable, this will collect from both parent and child theme. + * + * Other settable fields include: + * + * - Description + * - Viewport Width + * - Inserter (yes/no) + * - Categories (comma-separated values) + * - Keywords (comma-separated values) + * - Block Types (comma-separated values) + * - Post Types (comma-separated values) + * - Template Types (comma-separated values) + * + * @since 6.4.0 + * + * @return array Block pattern data. + */ + public function get_block_patterns() + { + } + /** + * Clears block pattern cache. + * + * @since 6.4.0 + * @since 6.6.0 Uses transients to cache regardless of site environment. + */ + public function delete_pattern_cache() + { + } + /** + * Enables a theme for all sites on the current network. + * + * @since 4.6.0 + * + * @param string|string[] $stylesheets Stylesheet name or array of stylesheet names. + * @phpstan-return void + */ + public static function network_enable_theme($stylesheets) + { + } + /** + * Disables a theme for all sites on the current network. + * + * @since 4.6.0 + * + * @param string|string[] $stylesheets Stylesheet name or array of stylesheet names. + * @phpstan-return void + */ + public static function network_disable_theme($stylesheets) + { + } + /** + * Sorts themes by name. + * + * @since 3.4.0 + * + * @param WP_Theme[] $themes Array of theme objects to sort (passed by reference). + */ + public static function sort_by_name(&$themes) + { + } + } + /** + * Class for efficiently looking up and mapping string keys to string values, with limits. + * + * @package WordPress + * @since 6.6.0 + */ + /** + * WP_Token_Map class. + * + * Use this class in specific circumstances with a static set of lookup keys which map to + * a static set of transformed values. For example, this class is used to map HTML named + * character references to their equivalent UTF-8 values. + * + * This class works differently than code calling `in_array()` and other methods. It + * internalizes lookup logic and provides helper interfaces to optimize lookup and + * transformation. It provides a method for precomputing the lookup tables and storing + * them as PHP source code. + * + * All tokens and substitutions must be shorter than 256 bytes. + * + * Example: + * + * $smilies = WP_Token_Map::from_array( array( + * '8O' => '😯', + * ':(' => '🙁', + * ':)' => '🙂', + * ':?' => '😕', + * ) ); + * + * true === $smilies->contains( ':)' ); + * false === $smilies->contains( 'simile' ); + * + * '😕' === $smilies->read_token( 'Not sure :?.', 9, $length_of_smily_syntax ); + * 2 === $length_of_smily_syntax; + * + * ## Precomputing the Token Map. + * + * Creating the class involves some work sorting and organizing the tokens and their + * replacement values. In order to skip this, it's possible for the class to export + * its state and be used as actual PHP source code. + * + * Example: + * + * // Export with four spaces as the indent, only for the sake of this docblock. + * // The default indent is a tab character. + * $indent = ' '; + * echo $smilies->precomputed_php_source_table( $indent ); + * + * // Output, to be pasted into a PHP source file: + * WP_Token_Map::from_precomputed_table( + * array( + * "storage_version" => "6.6.0", + * "key_length" => 2, + * "groups" => "", + * "long_words" => array(), + * "small_words" => "8O\x00:)\x00:(\x00:?\x00", + * "small_mappings" => array( "😯", "🙂", "🙁", "😕" ) + * ) + * ); + * + * ## Large vs. small words. + * + * This class uses a short prefix called the "key" to optimize lookup of its tokens. + * This means that some tokens may be shorter than or equal in length to that key. + * Those words that are longer than the key are called "large" while those shorter + * than or equal to the key length are called "small." + * + * This separation of large and small words is incidental to the way this class + * optimizes lookup, and should be considered an internal implementation detail + * of the class. It may still be important to be aware of it, however. + * + * ## Determining Key Length. + * + * The choice of the size of the key length should be based on the data being stored in + * the token map. It should divide the data as evenly as possible, but should not create + * so many groups that a large fraction of the groups only contain a single token. + * + * For the HTML5 named character references, a key length of 2 was found to provide a + * sufficient spread and should be a good default for relatively large sets of tokens. + * + * However, for some data sets this might be too long. For example, a list of smilies + * may be too small for a key length of 2. Perhaps 1 would be more appropriate. It's + * best to experiment and determine empirically which values are appropriate. + * + * ## Generate Pre-Computed Source Code. + * + * Since the `WP_Token_Map` is designed for relatively static lookups, it can be + * advantageous to precompute the values and instantiate a table that has already + * sorted and grouped the tokens and built the lookup strings. + * + * This can be done with `WP_Token_Map::precomputed_php_source_table()`. + * + * Note that if there is a leading character that all tokens need, such as `&` for + * HTML named character references, it can be beneficial to exclude this from the + * token map. Instead, find occurrences of the leading character and then use the + * token map to see if the following characters complete the token. + * + * Example: + * + * $map = WP_Token_Map::from_array( array( 'simple_smile:' => '🙂', 'sob:' => '😭', 'soba:' => '🍜' ) ); + * echo $map->precomputed_php_source_table(); + * // Output + * WP_Token_Map::from_precomputed_table( + * array( + * "storage_version" => "6.6.0", + * "key_length" => 2, + * "groups" => "si\x00so\x00", + * "long_words" => array( + * // simple_smile:[🙂]. + * "\x0bmple_smile:\x04🙂", + * // soba:[🍜] sob:[😭]. + * "\x03ba:\x04🍜\x02b:\x04😭", + * ), + * "short_words" => "", + * "short_mappings" => array() + * } + * ); + * + * This precomputed value can be stored directly in source code and will skip the + * startup cost of generating the lookup strings. See `$html5_named_character_entities`. + * + * Note that any updates to the precomputed format should update the storage version + * constant. It would also be best to provide an update function to take older known + * versions and upgrade them in place when loading into `from_precomputed_table()`. + * + * ## Future Direction. + * + * It may be viable to dynamically increase the length limits such that there's no need to impose them. + * The limit appears because of the packing structure, which indicates how many bytes each segment of + * text in the lookup tables spans. If, however, care were taken to track the longest word length, then + * the packing structure could change its representation to allow for that. Each additional byte storing + * length, however, increases the memory overhead and lookup runtime. + * + * An alternative approach could be to borrow the UTF-8 variable-length encoding and store lengths of less + * than 127 as a single byte with the high bit unset, storing longer lengths as the combination of + * continuation bytes. + * + * Since it has not been shown during the development of this class that longer strings are required, this + * update is deferred until such a need is clear. + * + * @since 6.6.0 + */ + class WP_Token_Map + { + /** + * Denotes the version of the code which produces pre-computed source tables. + * + * This version will be used not only to verify pre-computed data, but also + * to upgrade pre-computed data from older versions. Choosing a name that + * corresponds to the WordPress release will help people identify where an + * old copy of data came from. + */ + const STORAGE_VERSION = '6.6.0-trunk'; + /** + * Maximum length for each key and each transformed value in the table (in bytes). + * + * @since 6.6.0 + */ + const MAX_LENGTH = 256; + /** + * Create a token map using an associative array of key/value pairs as the input. + * + * Example: + * + * $smilies = WP_Token_Map::from_array( array( + * '8O' => '😯', + * ':(' => '🙁', + * ':)' => '🙂', + * ':?' => '😕', + * ) ); + * + * @since 6.6.0 + * + * @param array $mappings The keys transform into the values, both are strings. + * @param int $key_length Determines the group key length. Leave at the default value + * of 2 unless there's an empirical reason to change it. + * + * @return WP_Token_Map|null Token map, unless unable to create it. + */ + public static function from_array($mappings, $key_length = 2) + { + } + /** + * Creates a token map from a pre-computed table. + * This skips the initialization cost of generating the table. + * + * This function should only be used to load data created with + * WP_Token_Map::precomputed_php_source_tag(). + * + * @since 6.6.0 + * + * @param array $state { + * Stores pre-computed state for directly loading into a Token Map. + * + * @type string $storage_version Which version of the code produced this state. + * @type int $key_length Group key length. + * @type string $groups Group lookup index. + * @type array $large_words Large word groups and packed strings. + * @type string $small_words Small words packed string. + * @type array $small_mappings Small word mappings. + * } + * + * @return WP_Token_Map Map with precomputed data loaded. + * @phpstan-param array{ + * storage_version?: string, + * key_length?: int, + * groups?: string, + * large_words?: array, + * small_words?: string, + * small_mappings?: array, + * } $state + */ + public static function from_precomputed_table($state) + { + } + /** + * Indicates if a given word is a lookup key in the map. + * + * Example: + * + * true === $smilies->contains( ':)' ); + * false === $smilies->contains( 'simile' ); + * + * @since 6.6.0 + * + * @param string $word Determine if this word is a lookup key in the map. + * @param string $case_sensitivity Optional. Pass 'ascii-case-insensitive' to ignore ASCII case when matching. Default 'case-sensitive'. + * @return bool Whether there's an entry for the given word in the map. + */ + public function contains($word, $case_sensitivity = 'case-sensitive') + { + } + /** + * If the text starting at a given offset is a lookup key in the map, + * return the corresponding transformation from the map, else `false`. + * + * This function returns the translated string, but accepts an optional + * parameter `$matched_token_byte_length`, which communicates how many + * bytes long the lookup key was, if it found one. This can be used to + * advance a cursor in calling code if a lookup key was found. + * + * Example: + * + * false === $smilies->read_token( 'Not sure :?.', 0, $token_byte_length ); + * '😕' === $smilies->read_token( 'Not sure :?.', 9, $token_byte_length ); + * 2 === $token_byte_length; + * + * Example: + * + * while ( $at < strlen( $input ) ) { + * $next_at = strpos( $input, ':', $at ); + * if ( false === $next_at ) { + * break; + * } + * + * $smily = $smilies->read_token( $input, $next_at, $token_byte_length ); + * if ( false === $next_at ) { + * ++$at; + * continue; + * } + * + * $prefix = substr( $input, $at, $next_at - $at ); + * $at += $token_byte_length; + * $output .= "{$prefix}{$smily}"; + * } + * + * @since 6.6.0 + * + * @param string $text String in which to search for a lookup key. + * @param int $offset Optional. How many bytes into the string where the lookup key ought to start. Default 0. + * @param ?int &$matched_token_byte_length Optional. Holds byte-length of found token matched, otherwise not set. Default null. + * @param string $case_sensitivity Optional. Pass 'ascii-case-insensitive' to ignore ASCII case when matching. Default 'case-sensitive'. + * @return string|null Mapped value of lookup key if found, otherwise `null`. + */ + public function read_token($text, $offset = 0, &$matched_token_byte_length = \null, $case_sensitivity = 'case-sensitive') + { + } + /** + * Exports the token map into an associate array of key/value pairs. + * + * Example: + * + * $smilies->to_array() === array( + * '8O' => '😯', + * ':(' => '🙁', + * ':)' => '🙂', + * ':?' => '😕', + * ); + * + * @return array The lookup key/substitution values as an associate array. + */ + public function to_array() + { + } + /** + * Export the token map for quick loading in PHP source code. + * + * This function has a specific purpose, to make loading of static token maps fast. + * It's used to ensure that the HTML character reference lookups add a minimal cost + * to initializing the PHP process. + * + * Example: + * + * echo $smilies->precomputed_php_source_table(); + * + * // Output. + * WP_Token_Map::from_precomputed_table( + * array( + * "storage_version" => "6.6.0", + * "key_length" => 2, + * "groups" => "", + * "long_words" => array(), + * "small_words" => "8O\x00:)\x00:(\x00:?\x00", + * "small_mappings" => array( "😯", "🙂", "🙁", "😕" ) + * ) + * ); + * + * @since 6.6.0 + * + * @param string $indent Optional. Use this string for indentation, or rely on the default horizontal tab character. Default "\t". + * @return string Value which can be pasted into a PHP source file for quick loading of table. + */ + public function precomputed_php_source_table($indent = "\t") + { + } + } + /** + * Session API: WP_User_Meta_Session_Tokens class + * + * @package WordPress + * @subpackage Session + * @since 4.7.0 + */ + /** + * Meta-based user sessions token manager. + * + * @since 4.0.0 + * + * @see WP_Session_Tokens + */ + class WP_User_Meta_Session_Tokens extends \WP_Session_Tokens + { + /** + * Retrieves all sessions of the user. + * + * @since 4.0.0 + * + * @return array Sessions of the user. + */ + protected function get_sessions() + { + } + /** + * Converts an expiration to an array of session information. + * + * @param mixed $session Session or expiration. + * @return array Session. + */ + protected function prepare_session($session) + { + } + /** + * Retrieves a session based on its verifier (token hash). + * + * @since 4.0.0 + * + * @param string $verifier Verifier for the session to retrieve. + * @return array|null The session, or null if it does not exist + */ + protected function get_session($verifier) + { + } + /** + * Updates a session based on its verifier (token hash). + * + * @since 4.0.0 + * + * @param string $verifier Verifier for the session to update. + * @param array $session Optional. Session. Omitting this argument destroys the session. + */ + protected function update_session($verifier, $session = \null) + { + } + /** + * Updates the user's sessions in the usermeta table. + * + * @since 4.0.0 + * + * @param array $sessions Sessions. + */ + protected function update_sessions($sessions) + { + } + /** + * Destroys all sessions for this user, except the single session with the given verifier. + * + * @since 4.0.0 + * + * @param string $verifier Verifier of the session to keep. + */ + protected function destroy_other_sessions($verifier) + { + } + /** + * Destroys all session tokens for the user. + * + * @since 4.0.0 + */ + protected function destroy_all_sessions() + { + } + /** + * Destroys all sessions for all users. + * + * @since 4.0.0 + */ + public static function drop_sessions() + { + } + } + /** + * User API: WP_User_Query class + * + * @package WordPress + * @subpackage Users + * @since 4.4.0 + */ + /** + * Core class used for querying users. + * + * @since 3.1.0 + * + * @see WP_User_Query::prepare_query() for information on accepted arguments. + */ + #[\AllowDynamicProperties] + class WP_User_Query + { + /** + * Query vars, after parsing + * + * @since 3.5.0 + * @var array + */ + public $query_vars = array(); + /** + * Metadata query container. + * + * @since 4.2.0 + * @var WP_Meta_Query + */ + public $meta_query = \false; + /** + * The SQL query used to fetch matching users. + * + * @since 4.4.0 + * @var string + */ + public $request; + // SQL clauses. + public $query_fields; + public $query_from; + public $query_where; + public $query_orderby; + public $query_limit; + /** + * Constructor. + * + * @since 3.1.0 + * + * @param null|string|array $query Optional. The query variables. + * See WP_User_Query::prepare_query() for information on accepted arguments. + * @phpstan-param array{ + * blog_id?: int, + * role?: string|string[], + * role__in?: string[], + * role__not_in?: string[], + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * capability?: string|string[], + * capability__in?: string[], + * capability__not_in?: string[], + * include?: int[], + * exclude?: int[], + * search?: string, + * search_columns?: string[], + * orderby?: string|array, + * order?: string, + * offset?: int, + * number?: int, + * paged?: int, + * count_total?: bool, + * fields?: string|string[], + * who?: string, + * has_published_posts?: bool|string[], + * nicename?: string, + * nicename__in?: string[], + * nicename__not_in?: string[], + * login?: string, + * login__in?: string[], + * login__not_in?: string[], + * cache_results?: bool, + * } $query See WP_User_Query::prepare_query() + */ + public function __construct($query = \null) + { + } + /** + * Fills in missing query variables with default values. + * + * @since 4.4.0 + * + * @param string|array $args Query vars, as passed to `WP_User_Query`. + * @return array Complete query variables with undefined ones filled in with defaults. + */ + public static function fill_query_vars($args) + { + } + /** + * Prepares the query variables. + * + * @since 3.1.0 + * @since 4.1.0 Added the ability to order by the `include` value. + * @since 4.2.0 Added 'meta_value_num' support for `$orderby` parameter. Added multi-dimensional array syntax + * for `$orderby` parameter. + * @since 4.3.0 Added 'has_published_posts' parameter. + * @since 4.4.0 Added 'paged', 'role__in', and 'role__not_in' parameters. The 'role' parameter was updated to + * permit an array or comma-separated list of values. The 'number' parameter was updated to support + * querying for all users with using -1. + * @since 4.7.0 Added 'nicename', 'nicename__in', 'nicename__not_in', 'login', 'login__in', + * and 'login__not_in' parameters. + * @since 5.1.0 Introduced the 'meta_compare_key' parameter. + * @since 5.3.0 Introduced the 'meta_type_key' parameter. + * @since 5.9.0 Added 'capability', 'capability__in', and 'capability__not_in' parameters. + * Deprecated the 'who' parameter. + * @since 6.3.0 Added 'cache_results' parameter. + * + * @global wpdb $wpdb WordPress database abstraction object. + * @global WP_Roles $wp_roles WordPress role management object. + * + * @param string|array $query { + * Optional. Array or string of query parameters. + * + * @type int $blog_id The site ID. Default is the current site. + * @type string|string[] $role An array or a comma-separated list of role names that users + * must match to be included in results. Note that this is + * an inclusive list: users must match *each* role. Default empty. + * @type string[] $role__in An array of role names. Matched users must have at least one + * of these roles. Default empty array. + * @type string[] $role__not_in An array of role names to exclude. Users matching one or more + * of these roles will not be included in results. Default empty array. + * @type string|string[] $meta_key Meta key or keys to filter by. + * @type string|string[] $meta_value Meta value or values to filter by. + * @type string $meta_compare MySQL operator used for comparing the meta value. + * See WP_Meta_Query::__construct() for accepted values and default value. + * @type string $meta_compare_key MySQL operator used for comparing the meta key. + * See WP_Meta_Query::__construct() for accepted values and default value. + * @type string $meta_type MySQL data type that the meta_value column will be CAST to for comparisons. + * See WP_Meta_Query::__construct() for accepted values and default value. + * @type string $meta_type_key MySQL data type that the meta_key column will be CAST to for comparisons. + * See WP_Meta_Query::__construct() for accepted values and default value. + * @type array $meta_query An associative array of WP_Meta_Query arguments. + * See WP_Meta_Query::__construct() for accepted values. + * @type string|string[] $capability An array or a comma-separated list of capability names that users + * must match to be included in results. Note that this is + * an inclusive list: users must match *each* capability. + * Does NOT work for capabilities not in the database or filtered + * via {@see 'map_meta_cap'}. Default empty. + * @type string[] $capability__in An array of capability names. Matched users must have at least one + * of these capabilities. + * Does NOT work for capabilities not in the database or filtered + * via {@see 'map_meta_cap'}. Default empty array. + * @type string[] $capability__not_in An array of capability names to exclude. Users matching one or more + * of these capabilities will not be included in results. + * Does NOT work for capabilities not in the database or filtered + * via {@see 'map_meta_cap'}. Default empty array. + * @type int[] $include An array of user IDs to include. Default empty array. + * @type int[] $exclude An array of user IDs to exclude. Default empty array. + * @type string $search Search keyword. Searches for possible string matches on columns. + * When `$search_columns` is left empty, it tries to determine which + * column to search in based on search string. Default empty. + * @type string[] $search_columns Array of column names to be searched. Accepts 'ID', 'user_login', + * 'user_email', 'user_url', 'user_nicename', 'display_name'. + * Default empty array. + * @type string|array $orderby Field(s) to sort the retrieved users by. May be a single value, + * an array of values, or a multi-dimensional array with fields as + * keys and orders ('ASC' or 'DESC') as values. Accepted values are: + * - 'ID' + * - 'display_name' (or 'name') + * - 'include' + * - 'user_login' (or 'login') + * - 'login__in' + * - 'user_nicename' (or 'nicename') + * - 'nicename__in' + * - 'user_email (or 'email') + * - 'user_url' (or 'url') + * - 'user_registered' (or 'registered') + * - 'post_count' + * - 'meta_value' + * - 'meta_value_num' + * - The value of `$meta_key` + * - An array key of `$meta_query` + * To use 'meta_value' or 'meta_value_num', `$meta_key` + * must be also be defined. Default 'user_login'. + * @type string $order Designates ascending or descending order of users. Order values + * passed as part of an `$orderby` array take precedence over this + * parameter. Accepts 'ASC', 'DESC'. Default 'ASC'. + * @type int $offset Number of users to offset in retrieved results. Can be used in + * conjunction with pagination. Default 0. + * @type int $number Number of users to limit the query for. Can be used in + * conjunction with pagination. Value -1 (all) is supported, but + * should be used with caution on larger sites. + * Default -1 (all users). + * @type int $paged When used with number, defines the page of results to return. + * Default 1. + * @type bool $count_total Whether to count the total number of users found. If pagination + * is not needed, setting this to false can improve performance. + * Default true. + * @type string|string[] $fields Which fields to return. Single or all fields (string), or array + * of fields. Accepts: + * - 'ID' + * - 'display_name' + * - 'user_login' + * - 'user_nicename' + * - 'user_email' + * - 'user_url' + * - 'user_registered' + * - 'user_pass' + * - 'user_activation_key' + * - 'user_status' + * - 'spam' (only available on multisite installs) + * - 'deleted' (only available on multisite installs) + * - 'all' for all fields and loads user meta. + * - 'all_with_meta' Deprecated. Use 'all'. + * Default 'all'. + * @type string $who Deprecated, use `$capability` instead. + * Type of users to query. Accepts 'authors'. + * Default empty (all users). + * @type bool|string[] $has_published_posts Pass an array of post types to filter results to users who have + * published posts in those post types. `true` is an alias for all + * public post types. + * @type string $nicename The user nicename. Default empty. + * @type string[] $nicename__in An array of nicenames to include. Users matching one of these + * nicenames will be included in results. Default empty array. + * @type string[] $nicename__not_in An array of nicenames to exclude. Users matching one of these + * nicenames will not be included in results. Default empty array. + * @type string $login The user login. Default empty. + * @type string[] $login__in An array of logins to include. Users matching one of these + * logins will be included in results. Default empty array. + * @type string[] $login__not_in An array of logins to exclude. Users matching one of these + * logins will not be included in results. Default empty array. + * @type bool $cache_results Whether to cache user information. Default true. + * } + * @phpstan-param array{ + * blog_id?: int, + * role?: string|string[], + * role__in?: string[], + * role__not_in?: string[], + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * capability?: string|string[], + * capability__in?: string[], + * capability__not_in?: string[], + * include?: int[], + * exclude?: int[], + * search?: string, + * search_columns?: string[], + * orderby?: string|array, + * order?: string, + * offset?: int, + * number?: int, + * paged?: int, + * count_total?: bool, + * fields?: string|string[], + * who?: string, + * has_published_posts?: bool|string[], + * nicename?: string, + * nicename__in?: string[], + * nicename__not_in?: string[], + * login?: string, + * login__in?: string[], + * login__not_in?: string[], + * cache_results?: bool, + * } $query + */ + public function prepare_query($query = array()) + { + } + /** + * Executes the query, with the current variables. + * + * @since 3.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * @phpstan-return void + */ + public function query() + { + } + /** + * Retrieves query variable. + * + * @since 3.5.0 + * + * @param string $query_var Query variable key. + * @return mixed + */ + public function get($query_var) + { + } + /** + * Sets query variable. + * + * @since 3.5.0 + * + * @param string $query_var Query variable key. + * @param mixed $value Query variable value. + */ + public function set($query_var, $value) + { + } + /** + * Used internally to generate an SQL string for searching across multiple columns. + * + * @since 3.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $search Search string. + * @param string[] $columns Array of columns to search. + * @param bool $wild Whether to allow wildcard searches. Default is false for Network Admin, true for single site. + * Single site allows leading and trailing wildcards, Network Admin only trailing. + * @return string + */ + protected function get_search_sql($search, $columns, $wild = \false) + { + } + /** + * Returns the list of users. + * + * @since 3.1.0 + * + * @return array Array of results. + */ + public function get_results() + { + } + /** + * Returns the total number of users for the current query. + * + * @since 3.1.0 + * + * @return int Number of total users. + */ + public function get_total() + { + } + /** + * Parses and sanitizes 'orderby' keys passed to the user query. + * + * @since 4.2.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $orderby Alias for the field to order by. + * @return string Value to used in the ORDER clause, if `$orderby` is valid. + */ + protected function parse_orderby($orderby) + { + } + /** + * Generate cache key. + * + * @since 6.3.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array $args Query arguments. + * @param string $sql SQL statement. + * @return string Cache key. + */ + protected function generate_cache_key(array $args, $sql) + { + } + /** + * Parses an 'order' query variable and casts it to ASC or DESC as necessary. + * + * @since 4.2.0 + * + * @param string $order The 'order' query variable. + * @return string The sanitized 'order' query variable. + */ + protected function parse_order($order) + { + } + /** + * Makes private properties readable for backward compatibility. + * + * @since 4.0.0 + * @since 6.4.0 Getting a dynamic property is deprecated. + * + * @param string $name Property to get. + * @return mixed Property. + */ + public function __get($name) + { + } + /** + * Makes private properties settable for backward compatibility. + * + * @since 4.0.0 + * @since 6.4.0 Setting a dynamic property is deprecated. + * + * @param string $name Property to check if set. + * @param mixed $value Property value. + * @phpstan-return void + */ + public function __set($name, $value) + { + } + /** + * Makes private properties checkable for backward compatibility. + * + * @since 4.0.0 + * @since 6.4.0 Checking a dynamic property is deprecated. + * + * @param string $name Property to check if set. + * @return bool Whether the property is set. + */ + public function __isset($name) + { + } + /** + * Makes private properties un-settable for backward compatibility. + * + * @since 4.0.0 + * @since 6.4.0 Unsetting a dynamic property is deprecated. + * + * @param string $name Property to unset. + * @phpstan-return void + */ + public function __unset($name) + { + } + /** + * Makes private/protected methods readable for backward compatibility. + * + * @since 4.0.0 + * + * @param string $name Method to call. + * @param array $arguments Arguments to pass when calling. + * @return mixed Return value of the callback, false otherwise. + */ + public function __call($name, $arguments) + { + } + } + /** + * WP_User_Request class. + * + * Represents user request data loaded from a WP_Post object. + * + * @since 4.9.6 + */ + #[\AllowDynamicProperties] + final class WP_User_Request + { + /** + * Request ID. + * + * @since 4.9.6 + * @var int + */ + public $ID = 0; + /** + * User ID. + * + * @since 4.9.6 + * @var int + */ + public $user_id = 0; + /** + * User email. + * + * @since 4.9.6 + * @var string + */ + public $email = ''; + /** + * Action name. + * + * @since 4.9.6 + * @var string + */ + public $action_name = ''; + /** + * Current status. + * + * @since 4.9.6 + * @var string + */ + public $status = ''; + /** + * Timestamp this request was created. + * + * @since 4.9.6 + * @var int|null + */ + public $created_timestamp = \null; + /** + * Timestamp this request was last modified. + * + * @since 4.9.6 + * @var int|null + */ + public $modified_timestamp = \null; + /** + * Timestamp this request was confirmed. + * + * @since 4.9.6 + * @var int|null + */ + public $confirmed_timestamp = \null; + /** + * Timestamp this request was completed. + * + * @since 4.9.6 + * @var int|null + */ + public $completed_timestamp = \null; + /** + * Misc data assigned to this request. + * + * @since 4.9.6 + * @var array + */ + public $request_data = array(); + /** + * Key used to confirm this request. + * + * @since 4.9.6 + * @var string + */ + public $confirm_key = ''; + /** + * Constructor. + * + * @since 4.9.6 + * + * @param WP_Post|object $post Post object. + */ + public function __construct($post) + { + } + } + /** + * User API: WP_User class + * + * @package WordPress + * @subpackage Users + * @since 4.4.0 + */ + /** + * Core class used to implement the WP_User object. + * + * @since 2.0.0 + * + * @property string $nickname + * @property string $description + * @property string $user_description + * @property string $first_name + * @property string $user_firstname + * @property string $last_name + * @property string $user_lastname + * @property string $user_login + * @property string $user_pass + * @property string $user_nicename + * @property string $user_email + * @property string $user_url + * @property string $user_registered + * @property string $user_activation_key + * @property string $user_status + * @property int $user_level + * @property string $display_name + * @property string $spam + * @property string $deleted + * @property string $locale + * @property string $rich_editing + * @property string $syntax_highlighting + * @property string $use_ssl + */ + #[\AllowDynamicProperties] + class WP_User + { + /** + * User data container. + * + * @since 2.0.0 + * @var stdClass + */ + public $data; + /** + * The user's ID. + * + * @since 2.1.0 + * @var int + */ + public $ID = 0; + /** + * Capabilities that the individual user has been granted outside of those inherited from their role. + * + * @since 2.0.0 + * @var bool[] Array of key/value pairs where keys represent a capability name + * and boolean values represent whether the user has that capability. + */ + public $caps = array(); + /** + * User metadata option name. + * + * @since 2.0.0 + * @var string + */ + public $cap_key; + /** + * The roles the user is part of. + * + * @since 2.0.0 + * @var string[] + */ + public $roles = array(); + /** + * All capabilities the user has, including individual and role based. + * + * @since 2.0.0 + * @var bool[] Array of key/value pairs where keys represent a capability name + * and boolean values represent whether the user has that capability. + */ + public $allcaps = array(); + /** + * The filter context applied to user data fields. + * + * @since 2.9.0 + * @var string + */ + public $filter = \null; + /** + * Constructor. + * + * Retrieves the userdata and passes it to WP_User::init(). + * + * @since 2.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int|string|stdClass|WP_User $id User's ID, a WP_User object, or a user object from the DB. + * @param string $name Optional. User's username + * @param int $site_id Optional Site ID, defaults to current site. + * @phpstan-return void + */ + public function __construct($id = 0, $name = '', $site_id = '') + { + } + /** + * Sets up object properties, including capabilities. + * + * @since 3.3.0 + * + * @param object $data User DB row object. + * @param int $site_id Optional. The site ID to initialize for. + */ + public function init($data, $site_id = '') + { + } + /** + * Returns only the main user fields. + * + * @since 3.3.0 + * @since 4.4.0 Added 'ID' as an alias of 'id' for the `$field` parameter. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $field The field to query against: Accepts 'id', 'ID', 'slug', 'email' or 'login'. + * @param string|int $value The field value. + * @return object|false Raw user object. + * @phpstan-param 'id'|'ID'|'slug'|'email'|'login' $field + */ + public static function get_data_by($field, $value) + { + } + /** + * Magic method for checking the existence of a certain custom field. + * + * @since 3.3.0 + * + * @param string $key User meta key to check if set. + * @return bool Whether the given user meta key is set. + */ + public function __isset($key) + { + } + /** + * Magic method for accessing custom fields. + * + * @since 3.3.0 + * + * @param string $key User meta key to retrieve. + * @return mixed Value of the given user meta key (if set). If `$key` is 'id', the user ID. + */ + public function __get($key) + { + } + /** + * Magic method for setting custom user fields. + * + * This method does not update custom fields in the database. It only stores + * the value on the WP_User instance. + * + * @since 3.3.0 + * + * @param string $key User meta key. + * @param mixed $value User meta value. + * @phpstan-return void + */ + public function __set($key, $value) + { + } + /** + * Magic method for unsetting a certain custom field. + * + * @since 4.4.0 + * + * @param string $key User meta key to unset. + */ + public function __unset($key) + { + } + /** + * Determines whether the user exists in the database. + * + * @since 3.4.0 + * + * @return bool True if user exists in the database, false if not. + */ + public function exists() + { + } + /** + * Retrieves the value of a property or meta key. + * + * Retrieves from the users and usermeta table. + * + * @since 3.3.0 + * + * @param string $key Property + * @return mixed + */ + public function get($key) + { + } + /** + * Determines whether a property or meta key is set. + * + * Consults the users and usermeta tables. + * + * @since 3.3.0 + * + * @param string $key Property. + * @return bool + */ + public function has_prop($key) + { + } + /** + * Returns an array representation. + * + * @since 3.5.0 + * + * @return array Array representation. + */ + public function to_array() + { + } + /** + * Makes private/protected methods readable for backward compatibility. + * + * @since 4.3.0 + * + * @param string $name Method to call. + * @param array $arguments Arguments to pass when calling. + * @return mixed|false Return value of the callback, false otherwise. + */ + public function __call($name, $arguments) + { + } + /** + * Sets up capability object properties. + * + * Will set the value for the 'cap_key' property to current database table + * prefix, followed by 'capabilities'. Will then check to see if the + * property matching the 'cap_key' exists and is an array. If so, it will be + * used. + * + * @since 2.1.0 + * @deprecated 4.9.0 Use WP_User::for_site() + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $cap_key Optional capability key + */ + protected function _init_caps($cap_key = '') + { + } + /** + * Retrieves all of the capabilities of the user's roles, and merges them with + * individual user capabilities. + * + * All of the capabilities of the user's roles are merged with the user's individual + * capabilities. This means that the user can be denied specific capabilities that + * their role might have, but the user is specifically denied. + * + * @since 2.0.0 + * + * @return bool[] Array of key/value pairs where keys represent a capability name + * and boolean values represent whether the user has that capability. + */ + public function get_role_caps() + { + } + /** + * Adds role to user. + * + * Updates the user's meta data option with capabilities and roles. + * + * @since 2.0.0 + * + * @param string $role Role name. + * @phpstan-return void + */ + public function add_role($role) + { + } + /** + * Removes role from user. + * + * @since 2.0.0 + * + * @param string $role Role name. + * @phpstan-return void + */ + public function remove_role($role) + { + } + /** + * Sets the role of the user. + * + * This will remove the previous roles of the user and assign the user the + * new one. You can set the role to an empty string and it will remove all + * of the roles from the user. + * + * @since 2.0.0 + * + * @param string $role Role name. + * @phpstan-return void + */ + public function set_role($role) + { + } + /** + * Chooses the maximum level the user has. + * + * Will compare the level from the $item parameter against the $max + * parameter. If the item is incorrect, then just the $max parameter value + * will be returned. + * + * Used to get the max level based on the capabilities the user has. This + * is also based on roles, so if the user is assigned the Administrator role + * then the capability 'level_10' will exist and the user will get that + * value. + * + * @since 2.0.0 + * + * @param int $max Max level of user. + * @param string $item Level capability name. + * @return int Max Level. + */ + public function level_reduction($max, $item) + { + } + /** + * Updates the maximum user level for the user. + * + * Updates the 'user_level' user metadata (includes prefix that is the + * database table prefix) with the maximum user level. Gets the value from + * the all of the capabilities that the user has. + * + * @since 2.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + */ + public function update_user_level_from_caps() + { + } + /** + * Adds capability and grant or deny access to capability. + * + * @since 2.0.0 + * + * @param string $cap Capability name. + * @param bool $grant Whether to grant capability to user. + */ + public function add_cap($cap, $grant = \true) + { + } + /** + * Removes capability from user. + * + * @since 2.0.0 + * + * @param string $cap Capability name. + * @phpstan-return void + */ + public function remove_cap($cap) + { + } + /** + * Removes all of the capabilities of the user. + * + * @since 2.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + */ + public function remove_all_caps() + { + } + /** + * Returns whether the user has the specified capability. + * + * This function also accepts an ID of an object to check against if the capability is a meta capability. Meta + * capabilities such as `edit_post` and `edit_user` are capabilities used by the `map_meta_cap()` function to + * map to primitive capabilities that a user or role has, such as `edit_posts` and `edit_others_posts`. + * + * Example usage: + * + * $user->has_cap( 'edit_posts' ); + * $user->has_cap( 'edit_post', $post->ID ); + * $user->has_cap( 'edit_post_meta', $post->ID, $meta_key ); + * + * While checking against a role in place of a capability is supported in part, this practice is discouraged as it + * may produce unreliable results. + * + * @since 2.0.0 + * @since 5.3.0 Formalized the existing and already documented `...$args` parameter + * by adding it to the function signature. + * + * @see map_meta_cap() + * + * @param string $cap Capability name. + * @param mixed ...$args Optional further parameters, typically starting with an object ID. + * @return bool Whether the user has the given capability, or, if an object ID is passed, whether the user has + * the given capability for that object. + */ + public function has_cap($cap, ...$args) + { + } + /** + * Converts numeric level to level capability name. + * + * Prepends 'level_' to level number. + * + * @since 2.0.0 + * + * @param int $level Level number, 1 to 10. + * @return string + */ + public function translate_level_to_cap($level) + { + } + /** + * Sets the site to operate on. Defaults to the current site. + * + * @since 3.0.0 + * @deprecated 4.9.0 Use WP_User::for_site() + * + * @param int $blog_id Optional. Site ID, defaults to current site. + */ + public function for_blog($blog_id = '') + { + } + /** + * Sets the site to operate on. Defaults to the current site. + * + * @since 4.9.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $site_id Site ID to initialize user capabilities for. Default is the current site. + */ + public function for_site($site_id = '') + { + } + /** + * Gets the ID of the site for which the user's capabilities are currently initialized. + * + * @since 4.9.0 + * + * @return int Site ID. + */ + public function get_site_id() + { + } + } + /** + * Widget API: WP_Widget_Factory class + * + * @package WordPress + * @subpackage Widgets + * @since 4.4.0 + */ + /** + * Singleton that registers and instantiates WP_Widget classes. + * + * @since 2.8.0 + * @since 4.4.0 Moved to its own file from wp-includes/widgets.php + */ + #[\AllowDynamicProperties] + class WP_Widget_Factory + { + /** + * Widgets array. + * + * @since 2.8.0 + * @var array + */ + public $widgets = array(); + /** + * PHP5 constructor. + * + * @since 4.3.0 + */ + public function __construct() + { + } + /** + * PHP4 constructor. + * + * @since 2.8.0 + * @deprecated 4.3.0 Use __construct() instead. + * + * @see WP_Widget_Factory::__construct() + */ + public function WP_Widget_Factory() + { + } + /** + * Registers a widget subclass. + * + * @since 2.8.0 + * @since 4.6.0 Updated the `$widget` parameter to also accept a WP_Widget instance object + * instead of simply a `WP_Widget` subclass name. + * + * @param string|WP_Widget $widget Either the name of a `WP_Widget` subclass or an instance of a `WP_Widget` subclass. + */ + public function register($widget) + { + } + /** + * Un-registers a widget subclass. + * + * @since 2.8.0 + * @since 4.6.0 Updated the `$widget` parameter to also accept a WP_Widget instance object + * instead of simply a `WP_Widget` subclass name. + * + * @param string|WP_Widget $widget Either the name of a `WP_Widget` subclass or an instance of a `WP_Widget` subclass. + */ + public function unregister($widget) + { + } + /** + * Serves as a utility method for adding widgets to the registered widgets global. + * + * @since 2.8.0 + * + * @global array $wp_registered_widgets + */ + public function _register_widgets() + { + } + /** + * Returns the registered WP_Widget object for the given widget type. + * + * @since 5.8.0 + * + * @param string $id_base Widget type ID. + * @return WP_Widget|null + */ + public function get_widget_object($id_base) + { + } + /** + * Returns the registered key for the given widget type. + * + * @since 5.8.0 + * + * @param string $id_base Widget type ID. + * @return string + */ + public function get_widget_key($id_base) + { + } + } + /** + * Widget API: WP_Widget base class + * + * @package WordPress + * @subpackage Widgets + * @since 4.4.0 + */ + /** + * Core base class extended to register widgets. + * + * This class must be extended for each widget, and WP_Widget::widget() must be overridden. + * + * If adding widget options, WP_Widget::update() and WP_Widget::form() should also be overridden. + * + * @since 2.8.0 + * @since 4.4.0 Moved to its own file from wp-includes/widgets.php + * @phpstan-template T of array<string, mixed> + */ + #[\AllowDynamicProperties] + class WP_Widget + { + /** + * Root ID for all widgets of this type. + * + * @since 2.8.0 + * @var mixed|string + */ + public $id_base; + /** + * Name for this widget type. + * + * @since 2.8.0 + * @var string + */ + public $name; + /** + * Option name for this widget type. + * + * @since 2.8.0 + * @var string + */ + public $option_name; + /** + * Alt option name for this widget type. + * + * @since 2.8.0 + * @var string + */ + public $alt_option_name; + /** + * Option array passed to wp_register_sidebar_widget(). + * + * @since 2.8.0 + * @var array + */ + public $widget_options; + /** + * Option array passed to wp_register_widget_control(). + * + * @since 2.8.0 + * @var array + */ + public $control_options; + /** + * Unique ID number of the current instance. + * + * @since 2.8.0 + * @var bool|int + */ + public $number = \false; + /** + * Unique ID string of the current instance (id_base-number). + * + * @since 2.8.0 + * @var bool|string + */ + public $id = \false; + /** + * Whether the widget data has been updated. + * + * Set to true when the data is updated after a POST submit - ensures it does + * not happen twice. + * + * @since 2.8.0 + * @var bool + */ + public $updated = \false; + // + // Member functions that must be overridden by subclasses. + // + /** + * Echoes the widget content. + * + * Subclasses should override this function to generate their widget code. + * + * @since 2.8.0 + * + * @param array $args Display arguments including 'before_title', 'after_title', + * 'before_widget', and 'after_widget'. + * @param array $instance The settings for the particular instance of the widget. + * @phpstan-param T $instance + * @phpstan-param array{name:string,id:string,description:string,class:string,before_widget:string,after_widget:string,before_title:string,after_title:string,before_sidebar:string,after_sidebar:string,show_in_rest:boolean,widget_id:string,widget_name:string} $args + */ + public function widget($args, $instance) + { + } + /** + * Updates a particular instance of a widget. + * + * This function should check that `$new_instance` is set correctly. The newly-calculated + * value of `$instance` should be returned. If false is returned, the instance won't be + * saved/updated. + * + * @since 2.8.0 + * + * @param array $new_instance New settings for this instance as input by the user via + * WP_Widget::form(). + * @param array $old_instance Old settings for this instance. + * @return array Settings to save or bool false to cancel saving. + * @phpstan-param T $new_instance + * @phpstan-param T $old_instance + */ + public function update($new_instance, $old_instance) + { + } + /** + * Outputs the settings update form. + * + * @since 2.8.0 + * + * @param array $instance Current settings. + * @return string Default return is 'noform'. + * @phpstan-param T $instance + */ + public function form($instance) + { + } + // Functions you'll need to call. + /** + * PHP5 constructor. + * + * @since 2.8.0 + * + * @param string $id_base Base ID for the widget, lowercase and unique. If left empty, + * a portion of the widget's PHP class name will be used. Has to be unique. + * @param string $name Name for the widget displayed on the configuration page. + * @param array $widget_options Optional. Widget options. See wp_register_sidebar_widget() for + * information on accepted arguments. Default empty array. + * @param array $control_options Optional. Widget control options. See wp_register_widget_control() for + * information on accepted arguments. Default empty array. + * @phpstan-param array{ + * classname?: string, + * description?: string, + * show_instance_in_rest?: bool, + * } $widget_options See wp_register_sidebar_widget() + * @phpstan-param array{ + * height?: int, + * width?: int, + * id_base?: int|string, + * } $control_options See wp_register_widget_control() + */ + public function __construct($id_base, $name, $widget_options = array(), $control_options = array()) + { + } + /** + * PHP4 constructor. + * + * @since 2.8.0 + * @deprecated 4.3.0 Use __construct() instead. + * + * @see WP_Widget::__construct() + * + * @param string $id_base Base ID for the widget, lowercase and unique. If left empty, + * a portion of the widget's PHP class name will be used. Has to be unique. + * @param string $name Name for the widget displayed on the configuration page. + * @param array $widget_options Optional. Widget options. See wp_register_sidebar_widget() for + * information on accepted arguments. Default empty array. + * @param array $control_options Optional. Widget control options. See wp_register_widget_control() for + * information on accepted arguments. Default empty array. + * @phpstan-param array{ + * classname?: string, + * description?: string, + * show_instance_in_rest?: bool, + * } $widget_options See wp_register_sidebar_widget() + * @phpstan-param array{ + * height?: int, + * width?: int, + * id_base?: int|string, + * } $control_options See wp_register_widget_control() + */ + public function WP_Widget($id_base, $name, $widget_options = array(), $control_options = array()) + { + } + /** + * Constructs name attributes for use in form() fields + * + * This function should be used in form() methods to create name attributes for fields + * to be saved by update() + * + * @since 2.8.0 + * @since 4.4.0 Array format field names are now accepted. + * + * @param string $field_name Field name. + * @return string Name attribute for `$field_name`. + */ + public function get_field_name($field_name) + { + } + /** + * Constructs id attributes for use in WP_Widget::form() fields. + * + * This function should be used in form() methods to create id attributes + * for fields to be saved by WP_Widget::update(). + * + * @since 2.8.0 + * @since 4.4.0 Array format field IDs are now accepted. + * + * @param string $field_name Field name. + * @return string ID attribute for `$field_name`. + */ + public function get_field_id($field_name) + { + } + /** + * Register all widget instances of this widget class. + * + * @since 2.8.0 + */ + public function _register() + { + } + /** + * Sets the internal order number for the widget instance. + * + * @since 2.8.0 + * + * @param int $number The unique order number of this widget instance compared to other + * instances of the same class. + */ + public function _set($number) + { + } + /** + * Retrieves the widget display callback. + * + * @since 2.8.0 + * + * @return callable Display callback. + */ + public function _get_display_callback() + { + } + /** + * Retrieves the widget update callback. + * + * @since 2.8.0 + * + * @return callable Update callback. + */ + public function _get_update_callback() + { + } + /** + * Retrieves the form callback. + * + * @since 2.8.0 + * + * @return callable Form callback. + */ + public function _get_form_callback() + { + } + /** + * Determines whether the current request is inside the Customizer preview. + * + * If true -- the current request is inside the Customizer preview, then + * the object cache gets suspended and widgets should check this to decide + * whether they should store anything persistently to the object cache, + * to transients, or anywhere else. + * + * @since 3.9.0 + * + * @global WP_Customize_Manager $wp_customize + * + * @return bool True if within the Customizer preview, false if not. + */ + public function is_preview() + { + } + /** + * Generates the actual widget content (Do NOT override). + * + * Finds the instance and calls WP_Widget::widget(). + * + * @since 2.8.0 + * + * @param array $args Display arguments. See WP_Widget::widget() for information + * on accepted arguments. + * @param int|array $widget_args { + * Optional. Internal order number of the widget instance, or array of multi-widget arguments. + * Default 1. + * + * @type int $number Number increment used for multiples of the same widget. + * } + * @phpstan-param int|array{ + * number?: int, + * } $widget_args + * @phpstan-return void + */ + public function display_callback($args, $widget_args = 1) + { + } + /** + * Handles changed settings (Do NOT override). + * + * @since 2.8.0 + * + * @global array $wp_registered_widgets + * + * @param int $deprecated Not used. + * @phpstan-return void + */ + public function update_callback($deprecated = 1) + { + } + /** + * Generates the widget control form (Do NOT override). + * + * @since 2.8.0 + * + * @param int|array $widget_args { + * Optional. Internal order number of the widget instance, or array of multi-widget arguments. + * Default 1. + * + * @type int $number Number increment used for multiples of the same widget. + * } + * @return string|null + * @phpstan-param int|array{ + * number?: int, + * } $widget_args + */ + public function form_callback($widget_args = 1) + { + } + /** + * Registers an instance of the widget class. + * + * @since 2.8.0 + * + * @param int $number Optional. The unique order number of this widget instance + * compared to other instances of the same class. Default -1. + */ + public function _register_one($number = -1) + { + } + /** + * Saves the settings for all instances of the widget class. + * + * @since 2.8.0 + * + * @param array $settings Multi-dimensional array of widget instance settings. + */ + public function save_settings($settings) + { + } + /** + * Retrieves the settings for all instances of the widget class. + * + * @since 2.8.0 + * + * @return array Multi-dimensional array of widget instance settings. + */ + public function get_settings() + { + } + } + /** + * XML-RPC protocol support for WordPress. + * + * @package WordPress + * @subpackage Publishing + */ + /** + * WordPress XMLRPC server implementation. + * + * Implements compatibility for Blogger API, MetaWeblog API, MovableType, and + * pingback. Additional WordPress API for managing comments, pages, posts, + * options, etc. + * + * As of WordPress 3.5.0, XML-RPC is enabled by default. It can be disabled + * via the {@see 'xmlrpc_enabled'} filter found in wp_xmlrpc_server::set_is_enabled(). + * + * @since 1.5.0 + * + * @see IXR_Server + */ + #[\AllowDynamicProperties] + class wp_xmlrpc_server extends \IXR_Server + { + /** + * Methods. + * + * @var array + */ + public $methods; + /** + * Blog options. + * + * @var array + */ + public $blog_options; + /** + * IXR_Error instance. + * + * @var IXR_Error + */ + public $error; + /** + * Flags that the user authentication has failed in this instance of wp_xmlrpc_server. + * + * @var bool + */ + protected $auth_failed = \false; + /** + * Registers all of the XMLRPC methods that XMLRPC server understands. + * + * Sets up server and method property. Passes XMLRPC methods through the + * {@see 'xmlrpc_methods'} filter to allow plugins to extend or replace + * XML-RPC methods. + * + * @since 1.5.0 + */ + public function __construct() + { + } + /** + * Makes private/protected methods readable for backward compatibility. + * + * @since 4.0.0 + * + * @param string $name Method to call. + * @param array $arguments Arguments to pass when calling. + * @return array|IXR_Error|false Return value of the callback, false otherwise. + */ + public function __call($name, $arguments) + { + } + /** + * Serves the XML-RPC request. + * + * @since 2.9.0 + */ + public function serve_request() + { + } + /** + * Tests XMLRPC API by saying, "Hello!" to client. + * + * @since 1.5.0 + * + * @return string Hello string response. + */ + public function sayHello() + { + } + /** + * Tests XMLRPC API by adding two numbers for client. + * + * @since 1.5.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 A number to add. + * @type int $1 A second number to add. + * } + * @return int Sum of the two given numbers. + * @phpstan-param array{ + * 0: int, + * 1: int, + * } $args + */ + public function addTwoNumbers($args) + { + } + /** + * Logs user in. + * + * @since 2.8.0 + * + * @param string $username User's username. + * @param string $password User's password. + * @return WP_User|false WP_User object if authentication passed, false otherwise. + */ + public function login($username, $password) + { + } + /** + * Checks user's credentials. Deprecated. + * + * @since 1.5.0 + * @deprecated 2.8.0 Use wp_xmlrpc_server::login() + * @see wp_xmlrpc_server::login() + * + * @param string $username User's username. + * @param string $password User's password. + * @return bool Whether authentication passed. + */ + public function login_pass_ok($username, $password) + { + } + /** + * Escapes string or array of strings for database. + * + * @since 1.5.2 + * + * @param string|array $data Escape single string or array of strings. + * @return string|void Returns with string is passed, alters by-reference + * when array is passed. + */ + public function escape(&$data) + { + } + /** + * Sends error response to client. + * + * Sends an XML error response to the client. If the endpoint is enabled + * an HTTP 200 response is always sent per the XML-RPC specification. + * + * @since 5.7.3 + * + * @param IXR_Error|string $error Error code or an error object. + * @param false $message Error message. Optional. + */ + public function error($error, $message = \false) + { + } + /** + * Retrieves custom fields for post. + * + * @since 2.5.0 + * + * @param int $post_id Post ID. + * @return array Custom fields, if exist. + */ + public function get_custom_fields($post_id) + { + } + /** + * Sets custom fields for post. + * + * @since 2.5.0 + * + * @param int $post_id Post ID. + * @param array $fields Custom fields. + */ + public function set_custom_fields($post_id, $fields) + { + } + /** + * Retrieves custom fields for a term. + * + * @since 4.9.0 + * + * @param int $term_id Term ID. + * @return array Array of custom fields, if they exist. + */ + public function get_term_custom_fields($term_id) + { + } + /** + * Sets custom fields for a term. + * + * @since 4.9.0 + * + * @param int $term_id Term ID. + * @param array $fields Custom fields. + */ + public function set_term_custom_fields($term_id, $fields) + { + } + /** + * Sets up blog options property. + * + * Passes property through {@see 'xmlrpc_blog_options'} filter. + * + * @since 2.6.0 + */ + public function initialise_blog_option_info() + { + } + /** + * Retrieves the blogs of the user. + * + * @since 2.6.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type string $0 Username. + * @type string $1 Password. + * } + * @return array|IXR_Error Array contains: + * - 'isAdmin' + * - 'isPrimary' - whether the blog is the user's primary blog + * - 'url' + * - 'blogid' + * - 'blogName' + * - 'xmlrpc' - url of xmlrpc endpoint + * @phpstan-param array{ + * 0: string, + * 1: string, + * } $args + */ + public function wp_getUsersBlogs($args) + { + } + /** + * Checks if the method received at least the minimum number of arguments. + * + * @since 3.4.0 + * + * @param array $args An array of arguments to check. + * @param int $count Minimum number of arguments. + * @return bool True if `$args` contains at least `$count` arguments, false otherwise. + */ + protected function minimum_args($args, $count) + { + } + /** + * Prepares taxonomy data for return in an XML-RPC object. + * + * @param WP_Taxonomy $taxonomy The unprepared taxonomy data. + * @param array $fields The subset of taxonomy fields to return. + * @return array The prepared taxonomy data. + */ + protected function _prepare_taxonomy($taxonomy, $fields) + { + } + /** + * Prepares term data for return in an XML-RPC object. + * + * @param array|object $term The unprepared term data. + * @return array The prepared term data. + */ + protected function _prepare_term($term) + { + } + /** + * Converts a WordPress date string to an IXR_Date object. + * + * @param string $date Date string to convert. + * @return IXR_Date IXR_Date object. + */ + protected function _convert_date($date) + { + } + /** + * Converts a WordPress GMT date string to an IXR_Date object. + * + * @param string $date_gmt WordPress GMT date string. + * @param string $date Date string. + * @return IXR_Date IXR_Date object. + */ + protected function _convert_date_gmt($date_gmt, $date) + { + } + /** + * Prepares post data for return in an XML-RPC object. + * + * @param array $post The unprepared post data. + * @param array $fields The subset of post type fields to return. + * @return array The prepared post data. + */ + protected function _prepare_post($post, $fields) + { + } + /** + * Prepares post data for return in an XML-RPC object. + * + * @since 3.4.0 + * @since 4.6.0 Converted the `$post_type` parameter to accept a WP_Post_Type object. + * + * @param WP_Post_Type $post_type Post type object. + * @param array $fields The subset of post fields to return. + * @return array The prepared post type data. + */ + protected function _prepare_post_type($post_type, $fields) + { + } + /** + * Prepares media item data for return in an XML-RPC object. + * + * @param WP_Post $media_item The unprepared media item data. + * @param string $thumbnail_size The image size to use for the thumbnail URL. + * @return array The prepared media item data. + */ + protected function _prepare_media_item($media_item, $thumbnail_size = 'thumbnail') + { + } + /** + * Prepares page data for return in an XML-RPC object. + * + * @param WP_Post $page The unprepared page data. + * @return array The prepared page data. + */ + protected function _prepare_page($page) + { + } + /** + * Prepares comment data for return in an XML-RPC object. + * + * @param WP_Comment $comment The unprepared comment data. + * @return array The prepared comment data. + */ + protected function _prepare_comment($comment) + { + } + /** + * Prepares user data for return in an XML-RPC object. + * + * @param WP_User $user The unprepared user object. + * @param array $fields The subset of user fields to return. + * @return array The prepared user data. + */ + protected function _prepare_user($user, $fields) + { + } + /** + * Creates a new post for any registered post type. + * + * @since 3.4.0 + * + * @link https://en.wikipedia.org/wiki/RSS_enclosure for information on RSS enclosures. + * + * @param array $args { + * Method arguments. Note: top-level arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type array $3 { + * Content struct for adding a new post. See wp_insert_post() for information on + * additional post fields + * + * @type string $post_type Post type. Default 'post'. + * @type string $post_status Post status. Default 'draft' + * @type string $post_title Post title. + * @type int $post_author Post author ID. + * @type string $post_excerpt Post excerpt. + * @type string $post_content Post content. + * @type string $post_date_gmt Post date in GMT. + * @type string $post_date Post date. + * @type string $post_password Post password (20-character limit). + * @type string $comment_status Post comment enabled status. Accepts 'open' or 'closed'. + * @type string $ping_status Post ping status. Accepts 'open' or 'closed'. + * @type bool $sticky Whether the post should be sticky. Automatically false if + * `$post_status` is 'private'. + * @type int $post_thumbnail ID of an image to use as the post thumbnail/featured image. + * @type array $custom_fields Array of meta key/value pairs to add to the post. + * @type array $terms Associative array with taxonomy names as keys and arrays + * of term IDs as values. + * @type array $terms_names Associative array with taxonomy names as keys and arrays + * of term names as values. + * @type array $enclosure { + * Array of feed enclosure data to add to post meta. + * + * @type string $url URL for the feed enclosure. + * @type int $length Size in bytes of the enclosure. + * @type string $type Mime-type for the enclosure. + * } + * } + * } + * @return int|IXR_Error Post ID on success, IXR_Error instance otherwise. + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: array{ + * post_type?: string, + * post_status?: string, + * post_title: string, + * post_author: int, + * post_excerpt: string, + * post_content: string, + * post_date_gmt: string, + * post_date: string, + * post_password: string, + * comment_status: string, + * ping_status: string, + * sticky: bool, + * post_thumbnail: int, + * custom_fields: array, + * terms: array, + * terms_names: array, + * enclosure: array{ + * url: string, + * length: int, + * type: string, + * }, + * }, + * } $args + */ + public function wp_newPost($args) + { + } + /** + * Helper method for wp_newPost() and wp_editPost(), containing shared logic. + * + * @since 3.4.0 + * + * @see wp_insert_post() + * + * @param WP_User $user The post author if post_author isn't set in $content_struct. + * @param array|IXR_Error $content_struct Post data to insert. + * @return IXR_Error|string + */ + protected function _insert_post($user, $content_struct) + { + } + /** + * Edits a post for any registered post type. + * + * The $content_struct parameter only needs to contain fields that + * should be changed. All other fields will retain their existing values. + * + * @since 3.4.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type int $3 Post ID. + * @type array $4 Extra content arguments. + * } + * @return true|IXR_Error True on success, IXR_Error on failure. + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: int, + * 4: array, + * } $args + */ + public function wp_editPost($args) + { + } + /** + * Deletes a post for any registered post type. + * + * @since 3.4.0 + * + * @see wp_delete_post() + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type int $3 Post ID. + * } + * @return true|IXR_Error True on success, IXR_Error instance on failure. + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: int, + * } $args + */ + public function wp_deletePost($args) + { + } + /** + * Retrieves a post. + * + * @since 3.4.0 + * + * The optional $fields parameter specifies what fields will be included + * in the response array. This should be a list of field names. 'post_id' will + * always be included in the response regardless of the value of $fields. + * + * Instead of, or in addition to, individual field names, conceptual group + * names can be used to specify multiple fields. The available conceptual + * groups are 'post' (all basic fields), 'taxonomies', 'custom_fields', + * and 'enclosure'. + * + * @see get_post() + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type int $3 Post ID. + * @type array $4 Optional. The subset of post type fields to return. + * } + * @return array|IXR_Error Array contains (based on $fields parameter): + * - 'post_id' + * - 'post_title' + * - 'post_date' + * - 'post_date_gmt' + * - 'post_modified' + * - 'post_modified_gmt' + * - 'post_status' + * - 'post_type' + * - 'post_name' + * - 'post_author' + * - 'post_password' + * - 'post_excerpt' + * - 'post_content' + * - 'link' + * - 'comment_status' + * - 'ping_status' + * - 'sticky' + * - 'custom_fields' + * - 'terms' + * - 'categories' + * - 'tags' + * - 'enclosure' + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: int, + * 4: array, + * } $args + */ + public function wp_getPost($args) + { + } + /** + * Retrieves posts. + * + * @since 3.4.0 + * + * @see wp_get_recent_posts() + * @see wp_getPost() for more on `$fields` + * @see get_posts() for more on `$filter` values + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type array $3 Optional. Modifies the query used to retrieve posts. Accepts 'post_type', + * 'post_status', 'number', 'offset', 'orderby', 's', and 'order'. + * Default empty array. + * @type array $4 Optional. The subset of post type fields to return in the response array. + * } + * @return array|IXR_Error Array containing a collection of posts. + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: array, + * 4: array, + * } $args + */ + public function wp_getPosts($args) + { + } + /** + * Creates a new term. + * + * @since 3.4.0 + * + * @see wp_insert_term() + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type array $3 Content struct for adding a new term. The struct must contain + * the term 'name' and 'taxonomy'. Optional accepted values include + * 'parent', 'description', and 'slug'. + * } + * @return int|IXR_Error The term ID on success, or an IXR_Error object on failure. + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: array, + * } $args + */ + public function wp_newTerm($args) + { + } + /** + * Edits a term. + * + * @since 3.4.0 + * + * @see wp_update_term() + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type int $3 Term ID. + * @type array $4 Content struct for editing a term. The struct must contain the + * term 'taxonomy'. Optional accepted values include 'name', 'parent', + * 'description', and 'slug'. + * } + * @return true|IXR_Error True on success, IXR_Error instance on failure. + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: int, + * 4: array, + * } $args + */ + public function wp_editTerm($args) + { + } + /** + * Deletes a term. + * + * @since 3.4.0 + * + * @see wp_delete_term() + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type string $3 Taxonomy name. + * @type int $4 Term ID. + * } + * @return true|IXR_Error True on success, IXR_Error instance on failure. + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: string, + * 4: int, + * } $args + */ + public function wp_deleteTerm($args) + { + } + /** + * Retrieves a term. + * + * @since 3.4.0 + * + * @see get_term() + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type string $3 Taxonomy name. + * @type int $4 Term ID. + * } + * @return array|IXR_Error IXR_Error on failure, array on success, containing: + * - 'term_id' + * - 'name' + * - 'slug' + * - 'term_group' + * - 'term_taxonomy_id' + * - 'taxonomy' + * - 'description' + * - 'parent' + * - 'count' + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: string, + * 4: int, + * } $args + */ + public function wp_getTerm($args) + { + } + /** + * Retrieves all terms for a taxonomy. + * + * @since 3.4.0 + * + * The optional $filter parameter modifies the query used to retrieve terms. + * Accepted keys are 'number', 'offset', 'orderby', 'order', 'hide_empty', and 'search'. + * + * @see get_terms() + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type string $3 Taxonomy name. + * @type array $4 Optional. Modifies the query used to retrieve posts. Accepts 'number', + * 'offset', 'orderby', 'order', 'hide_empty', and 'search'. Default empty array. + * } + * @return array|IXR_Error An associative array of terms data on success, IXR_Error instance otherwise. + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: string, + * 4: array, + * } $args + */ + public function wp_getTerms($args) + { + } + /** + * Retrieves a taxonomy. + * + * @since 3.4.0 + * + * @see get_taxonomy() + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type string $3 Taxonomy name. + * @type array $4 Optional. Array of taxonomy fields to limit to in the return. + * Accepts 'labels', 'cap', 'menu', and 'object_type'. + * Default empty array. + * } + * @return array|IXR_Error An array of taxonomy data on success, IXR_Error instance otherwise. + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: string, + * 4: array, + * } $args + */ + public function wp_getTaxonomy($args) + { + } + /** + * Retrieves all taxonomies. + * + * @since 3.4.0 + * + * @see get_taxonomies() + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type array $3 Optional. An array of arguments for retrieving taxonomies. + * @type array $4 Optional. The subset of taxonomy fields to return. + * } + * @return array|IXR_Error An associative array of taxonomy data with returned fields determined + * by `$fields`, or an IXR_Error instance on failure. + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: array, + * 4: array, + * } $args + */ + public function wp_getTaxonomies($args) + { + } + /** + * Retrieves a user. + * + * The optional $fields parameter specifies what fields will be included + * in the response array. This should be a list of field names. 'user_id' will + * always be included in the response regardless of the value of $fields. + * + * Instead of, or in addition to, individual field names, conceptual group + * names can be used to specify multiple fields. The available conceptual + * groups are 'basic' and 'all'. + * + * @uses get_userdata() + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type int $3 User ID. + * @type array $4 Optional. Array of fields to return. + * } + * @return array|IXR_Error Array contains (based on $fields parameter): + * - 'user_id' + * - 'username' + * - 'first_name' + * - 'last_name' + * - 'registered' + * - 'bio' + * - 'email' + * - 'nickname' + * - 'nicename' + * - 'url' + * - 'display_name' + * - 'roles' + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: int, + * 4: array, + * } $args + */ + public function wp_getUser($args) + { + } + /** + * Retrieves users. + * + * The optional $filter parameter modifies the query used to retrieve users. + * Accepted keys are 'number' (default: 50), 'offset' (default: 0), 'role', + * 'who', 'orderby', and 'order'. + * + * The optional $fields parameter specifies what fields will be included + * in the response array. + * + * @uses get_users() + * @see wp_getUser() for more on $fields and return values + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type array $3 Optional. Arguments for the user query. + * @type array $4 Optional. Fields to return. + * } + * @return array|IXR_Error users data + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: array, + * 4: array, + * } $args + */ + public function wp_getUsers($args) + { + } + /** + * Retrieves information about the requesting user. + * + * @uses get_userdata() + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username + * @type string $2 Password + * @type array $3 Optional. Fields to return. + * } + * @return array|IXR_Error (@see wp_getUser) + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: array, + * } $args + */ + public function wp_getProfile($args) + { + } + /** + * Edits user's profile. + * + * @uses wp_update_user() + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type array $3 Content struct. It can optionally contain: + * - 'first_name' + * - 'last_name' + * - 'website' + * - 'display_name' + * - 'nickname' + * - 'nicename' + * - 'bio' + * } + * @return true|IXR_Error True, on success. + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: array, + * } $args + */ + public function wp_editProfile($args) + { + } + /** + * Retrieves a page. + * + * @since 2.2.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type int $1 Page ID. + * @type string $2 Username. + * @type string $3 Password. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: int, + * 2: string, + * 3: string, + * } $args + */ + public function wp_getPage($args) + { + } + /** + * Retrieves Pages. + * + * @since 2.2.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type int $3 Optional. Number of pages. Default 10. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: int, + * } $args + */ + public function wp_getPages($args) + { + } + /** + * Creates a new page. + * + * @since 2.2.0 + * + * @see wp_xmlrpc_server::mw_newPost() + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type array $3 Content struct. + * } + * @return int|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: array, + * } $args + */ + public function wp_newPage($args) + { + } + /** + * Deletes a page. + * + * @since 2.2.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type int $3 Page ID. + * } + * @return true|IXR_Error True, if success. + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: int, + * } $args + */ + public function wp_deletePage($args) + { + } + /** + * Edits a page. + * + * @since 2.2.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type int $1 Page ID. + * @type string $2 Username. + * @type string $3 Password. + * @type string $4 Content. + * @type int $5 Publish flag. 0 for draft, 1 for publish. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: int, + * 2: string, + * 3: string, + * 4: string, + * 5: int, + * } $args + */ + public function wp_editPage($args) + { + } + /** + * Retrieves page list. + * + * @since 2.2.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * } $args + */ + public function wp_getPageList($args) + { + } + /** + * Retrieves authors list. + * + * @since 2.2.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * } $args + */ + public function wp_getAuthors($args) + { + } + /** + * Gets the list of all tags. + * + * @since 2.7.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * } $args + */ + public function wp_getTags($args) + { + } + /** + * Creates a new category. + * + * @since 2.2.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type array $3 Category. + * } + * @return int|IXR_Error Category ID. + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: array, + * } $args + */ + public function wp_newCategory($args) + { + } + /** + * Deletes a category. + * + * @since 2.5.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type int $3 Category ID. + * } + * @return bool|IXR_Error See wp_delete_term() for return info. + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: int, + * } $args + */ + public function wp_deleteCategory($args) + { + } + /** + * Retrieves category list. + * + * @since 2.2.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type array $3 Category + * @type int $4 Max number of results. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: array, + * 4: int, + * } $args + */ + public function wp_suggestCategories($args) + { + } + /** + * Retrieves a comment. + * + * @since 2.7.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type int $3 Comment ID. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: int, + * } $args + */ + public function wp_getComment($args) + { + } + /** + * Retrieves comments. + * + * Besides the common blog_id (unused), username, and password arguments, + * it takes a filter array as the last argument. + * + * Accepted 'filter' keys are 'status', 'post_id', 'offset', and 'number'. + * + * The defaults are as follows: + * - 'status' - Default is ''. Filter by status (e.g., 'approve', 'hold') + * - 'post_id' - Default is ''. The post where the comment is posted. + * Empty string shows all comments. + * - 'number' - Default is 10. Total number of media items to retrieve. + * - 'offset' - Default is 0. See WP_Query::query() for more. + * + * @since 2.7.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type array $3 Optional. Query arguments. + * } + * @return array|IXR_Error Array containing a collection of comments. + * See wp_xmlrpc_server::wp_getComment() for a description + * of each item contents. + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: array, + * } $args + */ + public function wp_getComments($args) + { + } + /** + * Deletes a comment. + * + * By default, the comment will be moved to the Trash instead of deleted. + * See wp_delete_comment() for more information on this behavior. + * + * @since 2.7.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type int $3 Comment ID. + * } + * @return bool|IXR_Error See wp_delete_comment(). + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: int, + * } $args + */ + public function wp_deleteComment($args) + { + } + /** + * Edits a comment. + * + * Besides the common blog_id (unused), username, and password arguments, + * it takes a comment_id integer and a content_struct array as the last argument. + * + * The allowed keys in the content_struct array are: + * - 'author' + * - 'author_url' + * - 'author_email' + * - 'content' + * - 'date_created_gmt' + * - 'status'. Common statuses are 'approve', 'hold', 'spam'. See get_comment_statuses() for more details. + * + * @since 2.7.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type int $3 Comment ID. + * @type array $4 Content structure. + * } + * @return true|IXR_Error True, on success. + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: int, + * 4: array, + * } $args + */ + public function wp_editComment($args) + { + } + /** + * Creates a new comment. + * + * @since 2.7.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type string|int $3 Post ID or URL. + * @type array $4 Content structure. + * } + * @return int|IXR_Error See wp_new_comment(). + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: string|int, + * 4: array, + * } $args + */ + public function wp_newComment($args) + { + } + /** + * Retrieves all of the comment status. + * + * @since 2.7.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * } $args + */ + public function wp_getCommentStatusList($args) + { + } + /** + * Retrieves comment counts. + * + * @since 2.5.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type int $3 Post ID. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: int, + * } $args + */ + public function wp_getCommentCount($args) + { + } + /** + * Retrieves post statuses. + * + * @since 2.5.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * } $args + */ + public function wp_getPostStatusList($args) + { + } + /** + * Retrieves page statuses. + * + * @since 2.5.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * } $args + */ + public function wp_getPageStatusList($args) + { + } + /** + * Retrieves page templates. + * + * @since 2.6.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * } $args + */ + public function wp_getPageTemplates($args) + { + } + /** + * Retrieves blog options. + * + * @since 2.6.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type array $3 Optional. Options. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: array, + * } $args + */ + public function wp_getOptions($args) + { + } + /** + * Retrieves blog options value from list. + * + * @since 2.6.0 + * + * @param array $options Options to retrieve. + * @return array + */ + public function _getOptions($options) + { + } + /** + * Updates blog options. + * + * @since 2.6.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type array $3 Options. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: array, + * } $args + */ + public function wp_setOptions($args) + { + } + /** + * Retrieves a media item by ID. + * + * @since 3.1.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type int $3 Attachment ID. + * } + * @return array|IXR_Error Associative array contains: + * - 'date_created_gmt' + * - 'parent' + * - 'link' + * - 'thumbnail' + * - 'title' + * - 'caption' + * - 'description' + * - 'metadata' + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: int, + * } $args + */ + public function wp_getMediaItem($args) + { + } + /** + * Retrieves a collection of media library items (or attachments). + * + * Besides the common blog_id (unused), username, and password arguments, + * it takes a filter array as the last argument. + * + * Accepted 'filter' keys are 'parent_id', 'mime_type', 'offset', and 'number'. + * + * The defaults are as follows: + * - 'number' - Default is 5. Total number of media items to retrieve. + * - 'offset' - Default is 0. See WP_Query::query() for more. + * - 'parent_id' - Default is ''. The post where the media item is attached. + * Empty string shows all media items. 0 shows unattached media items. + * - 'mime_type' - Default is ''. Filter by mime type (e.g., 'image/jpeg', 'application/pdf') + * + * @since 3.1.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type array $3 Optional. Query arguments. + * } + * @return array|IXR_Error Array containing a collection of media items. + * See wp_xmlrpc_server::wp_getMediaItem() for a description + * of each item contents. + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: array, + * } $args + */ + public function wp_getMediaLibrary($args) + { + } + /** + * Retrieves a list of post formats used by the site. + * + * @since 3.1.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * } + * @return array|IXR_Error List of post formats, otherwise IXR_Error object. + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * } $args + */ + public function wp_getPostFormats($args) + { + } + /** + * Retrieves a post type. + * + * @since 3.4.0 + * + * @see get_post_type_object() + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type string $3 Post type name. + * @type array $4 Optional. Fields to fetch. + * } + * @return array|IXR_Error Array contains: + * - 'labels' + * - 'description' + * - 'capability_type' + * - 'cap' + * - 'map_meta_cap' + * - 'hierarchical' + * - 'menu_position' + * - 'taxonomies' + * - 'supports' + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: string, + * 4: array, + * } $args + */ + public function wp_getPostType($args) + { + } + /** + * Retrieves post types. + * + * @since 3.4.0 + * + * @see get_post_types() + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type array $3 Optional. Query arguments. + * @type array $4 Optional. Fields to fetch. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: array, + * 4: array, + * } $args + */ + public function wp_getPostTypes($args) + { + } + /** + * Retrieves revisions for a specific post. + * + * @since 3.5.0 + * + * The optional $fields parameter specifies what fields will be included + * in the response array. + * + * @uses wp_get_post_revisions() + * @see wp_getPost() for more on $fields + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type int $3 Post ID. + * @type array $4 Optional. Fields to fetch. + * } + * @return array|IXR_Error Array containing a collection of posts. + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: int, + * 4: array, + * } $args + */ + public function wp_getRevisions($args) + { + } + /** + * Restores a post revision. + * + * @since 3.5.0 + * + * @uses wp_restore_post_revision() + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type int $3 Revision ID. + * } + * @return bool|IXR_Error false if there was an error restoring, true if success. + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: int, + * } $args + */ + public function wp_restoreRevision($args) + { + } + /* + * Blogger API functions. + * Specs on http://plant.blogger.com/api and https://groups.yahoo.com/group/bloggerDev/ + */ + /** + * Retrieves blogs that user owns. + * + * Will make more sense once we support multiple blogs. + * + * @since 1.5.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * } $args + */ + public function blogger_getUsersBlogs($args) + { + } + /** + * Private function for retrieving a users blogs for multisite setups. + * + * @since 3.0.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * } $args + */ + protected function _multisite_getUsersBlogs($args) + { + } + /** + * Retrieves user's data. + * + * Gives your client some info about you, so you don't have to. + * + * @since 1.5.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * } $args + */ + public function blogger_getUserInfo($args) + { + } + /** + * Retrieves a post. + * + * @since 1.5.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type int $1 Post ID. + * @type string $2 Username. + * @type string $3 Password. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: int, + * 2: string, + * 3: string, + * } $args + */ + public function blogger_getPost($args) + { + } + /** + * Retrieves the list of recent posts. + * + * @since 1.5.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type string $0 App key (unused). + * @type int $1 Blog ID (unused). + * @type string $2 Username. + * @type string $3 Password. + * @type int $4 Optional. Number of posts. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: string, + * 1: int, + * 2: string, + * 3: string, + * 4: int, + * } $args + */ + public function blogger_getRecentPosts($args) + { + } + /** + * Deprecated. + * + * @since 1.5.0 + * @deprecated 3.5.0 + * + * @param array $args Unused. + * @return IXR_Error Error object. + */ + public function blogger_getTemplate($args) + { + } + /** + * Deprecated. + * + * @since 1.5.0 + * @deprecated 3.5.0 + * + * @param array $args Unused. + * @return IXR_Error Error object. + */ + public function blogger_setTemplate($args) + { + } + /** + * Creates a new post. + * + * @since 1.5.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type string $0 App key (unused). + * @type int $1 Blog ID (unused). + * @type string $2 Username. + * @type string $3 Password. + * @type string $4 Content. + * @type int $5 Publish flag. 0 for draft, 1 for publish. + * } + * @return int|IXR_Error + * @phpstan-param array{ + * 0: string, + * 1: int, + * 2: string, + * 3: string, + * 4: string, + * 5: int, + * } $args + */ + public function blogger_newPost($args) + { + } + /** + * Edits a post. + * + * @since 1.5.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type int $1 Post ID. + * @type string $2 Username. + * @type string $3 Password. + * @type string $4 Content + * @type int $5 Publish flag. 0 for draft, 1 for publish. + * } + * @return true|IXR_Error true when done. + * @phpstan-param array{ + * 0: int, + * 1: int, + * 2: string, + * 3: string, + * 4: string, + * 5: int, + * } $args + */ + public function blogger_editPost($args) + { + } + /** + * Deletes a post. + * + * @since 1.5.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type int $1 Post ID. + * @type string $2 Username. + * @type string $3 Password. + * } + * @return true|IXR_Error True when post is deleted. + * @phpstan-param array{ + * 0: int, + * 1: int, + * 2: string, + * 3: string, + * } $args + */ + public function blogger_deletePost($args) + { + } + /* + * MetaWeblog API functions. + * Specs on wherever Dave Winer wants them to be. + */ + /** + * Creates a new post. + * + * The 'content_struct' argument must contain: + * - title + * - description + * - mt_excerpt + * - mt_text_more + * - mt_keywords + * - mt_tb_ping_urls + * - categories + * + * Also, it can optionally contain: + * - wp_slug + * - wp_password + * - wp_page_parent_id + * - wp_page_order + * - wp_author_id + * - post_status | page_status - can be 'draft', 'private', 'publish', or 'pending' + * - mt_allow_comments - can be 'open' or 'closed' + * - mt_allow_pings - can be 'open' or 'closed' + * - date_created_gmt + * - dateCreated + * - wp_post_thumbnail + * + * @since 1.5.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type array $3 Content structure. + * @type int $4 Optional. Publish flag. 0 for draft, 1 for publish. Default 0. + * } + * @return int|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: array, + * 4: int, + * } $args + */ + public function mw_newPost($args) + { + } + /** + * Adds an enclosure to a post if it's new. + * + * @since 2.8.0 + * + * @param int $post_id Post ID. + * @param array $enclosure Enclosure data. + */ + public function add_enclosure_if_new($post_id, $enclosure) + { + } + /** + * Attaches an upload to a post. + * + * @since 2.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $post_id Post ID. + * @param string $post_content Post Content for attachment. + */ + public function attach_uploads($post_id, $post_content) + { + } + /** + * Edits a post. + * + * @since 1.5.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Post ID. + * @type string $1 Username. + * @type string $2 Password. + * @type array $3 Content structure. + * @type int $4 Optional. Publish flag. 0 for draft, 1 for publish. Default 0. + * } + * @return true|IXR_Error True on success. + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: array, + * 4: int, + * } $args + */ + public function mw_editPost($args) + { + } + /** + * Retrieves a post. + * + * @since 1.5.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Post ID. + * @type string $1 Username. + * @type string $2 Password. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * } $args + */ + public function mw_getPost($args) + { + } + /** + * Retrieves list of recent posts. + * + * @since 1.5.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type int $3 Optional. Number of posts. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: int, + * } $args + */ + public function mw_getRecentPosts($args) + { + } + /** + * Retrieves the list of categories on a given blog. + * + * @since 1.5.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * } $args + */ + public function mw_getCategories($args) + { + } + /** + * Uploads a file, following your settings. + * + * Adapted from a patch by Johann Richard. + * + * @link http://mycvs.org/archives/2004/06/30/file-upload-to-wordpress-in-ecto/ + * + * @since 1.5.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type array $3 Data. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: array, + * } $args + */ + public function mw_newMediaObject($args) + { + } + /* + * MovableType API functions. + * Specs archive on http://web.archive.org/web/20050220091302/http://www.movabletype.org:80/docs/mtmanual_programmatic.html + */ + /** + * Retrieves the post titles of recent posts. + * + * @since 1.5.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * @type int $3 Optional. Number of posts. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: int, + * } $args + */ + public function mt_getRecentPostTitles($args) + { + } + /** + * Retrieves the list of all categories on a blog. + * + * @since 1.5.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Blog ID (unused). + * @type string $1 Username. + * @type string $2 Password. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * } $args + */ + public function mt_getCategoryList($args) + { + } + /** + * Retrieves post categories. + * + * @since 1.5.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Post ID. + * @type string $1 Username. + * @type string $2 Password. + * } + * @return array|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * } $args + */ + public function mt_getPostCategories($args) + { + } + /** + * Sets categories for a post. + * + * @since 1.5.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Post ID. + * @type string $1 Username. + * @type string $2 Password. + * @type array $3 Categories. + * } + * @return true|IXR_Error True on success. + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * 3: array, + * } $args + */ + public function mt_setPostCategories($args) + { + } + /** + * Retrieves an array of methods supported by this server. + * + * @since 1.5.0 + * + * @return array + */ + public function mt_supportedMethods() + { + } + /** + * Retrieves an empty array because we don't support per-post text filters. + * + * @since 1.5.0 + */ + public function mt_supportedTextFilters() + { + } + /** + * Retrieves trackbacks sent to a given post. + * + * @since 1.5.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $post_id + * @return array|IXR_Error + */ + public function mt_getTrackbackPings($post_id) + { + } + /** + * Sets a post's publish status to 'publish'. + * + * @since 1.5.0 + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type int $0 Post ID. + * @type string $1 Username. + * @type string $2 Password. + * } + * @return int|IXR_Error + * @phpstan-param array{ + * 0: int, + * 1: string, + * 2: string, + * } $args + */ + public function mt_publishPost($args) + { + } + /* + * Pingback functions. + * Specs on www.hixie.ch/specs/pingback/pingback + */ + /** + * Retrieves a pingback and registers it. + * + * @since 1.5.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array $args { + * Method arguments. Note: arguments must be ordered as documented. + * + * @type string $0 URL of page linked from. + * @type string $1 URL of page linked to. + * } + * @return string|IXR_Error + * @phpstan-param array{ + * 0: string, + * 1: string, + * } $args + */ + public function pingback_ping($args) + { + } + /** + * Retrieves an array of URLs that pingbacked the given URL. + * + * Specs on http://www.aquarionics.com/misc/archives/blogite/0198.html + * + * @since 1.5.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $url + * @return array|IXR_Error + */ + public function pingback_extensions_getPingbacks($url) + { + } + /** + * Sends a pingback error based on the given error code and message. + * + * @since 3.6.0 + * + * @param int $code Error code. + * @param string $message Error message. + * @return IXR_Error Error object. + */ + protected function pingback_error($code, $message) + { + } + } + /** + * WordPress environment setup class. + * + * @package WordPress + * @since 2.0.0 + */ + #[\AllowDynamicProperties] + class WP + { + /** + * Public query variables. + * + * Long list of public query variables. + * + * @since 2.0.0 + * @var string[] + */ + public $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'pagename', 'page_id', 'error', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots', 'favicon', 'taxonomy', 'term', 'cpage', 'post_type', 'embed'); + /** + * Private query variables. + * + * Long list of private query variables. + * + * @since 2.0.0 + * @var string[] + */ + public $private_query_vars = array('offset', 'posts_per_page', 'posts_per_archive_page', 'showposts', 'nopaging', 'post_type', 'post_status', 'category__in', 'category__not_in', 'category__and', 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'tag_id', 'post_mime_type', 'perm', 'comments_per_page', 'post__in', 'post__not_in', 'post_parent', 'post_parent__in', 'post_parent__not_in', 'title', 'fields'); + /** + * Extra query variables set by the user. + * + * @since 2.1.0 + * @var array + */ + public $extra_query_vars = array(); + /** + * Query variables for setting up the WordPress Query Loop. + * + * @since 2.0.0 + * @var array + */ + public $query_vars = array(); + /** + * String parsed to set the query variables. + * + * @since 2.0.0 + * @var string + */ + public $query_string = ''; + /** + * The request path, e.g. 2015/05/06. + * + * @since 2.0.0 + * @var string + */ + public $request = ''; + /** + * Rewrite rule the request matched. + * + * @since 2.0.0 + * @var string + */ + public $matched_rule = ''; + /** + * Rewrite query the request matched. + * + * @since 2.0.0 + * @var string + */ + public $matched_query = ''; + /** + * Whether already did the permalink. + * + * @since 2.0.0 + * @var bool + */ + public $did_permalink = \false; + /** + * Adds a query variable to the list of public query variables. + * + * @since 2.1.0 + * + * @param string $qv Query variable name. + */ + public function add_query_var($qv) + { + } + /** + * Removes a query variable from a list of public query variables. + * + * @since 4.5.0 + * + * @param string $name Query variable name. + */ + public function remove_query_var($name) + { + } + /** + * Sets the value of a query variable. + * + * @since 2.3.0 + * + * @param string $key Query variable name. + * @param mixed $value Query variable value. + */ + public function set_query_var($key, $value) + { + } + /** + * Parses the request to find the correct WordPress query. + * + * Sets up the query variables based on the request. There are also many + * filters and actions that can be used to further manipulate the result. + * + * @since 2.0.0 + * @since 6.0.0 A return value was added. + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param array|string $extra_query_vars Set the extra query variables. + * @return bool Whether the request was parsed. + */ + public function parse_request($extra_query_vars = '') + { + } + /** + * Sends additional HTTP headers for caching, content type, etc. + * + * Sets the Content-Type header. Sets the 'error' status (if passed) and optionally exits. + * If showing a feed, it will also send Last-Modified, ETag, and 304 status if needed. + * + * @since 2.0.0 + * @since 4.4.0 `X-Pingback` header is added conditionally for single posts that allow pings. + * @since 6.1.0 Runs after posts have been queried. + * + * @global WP_Query $wp_query WordPress Query object. + */ + public function send_headers() + { + } + /** + * Sets the query string property based off of the query variable property. + * + * The {@see 'query_string'} filter is deprecated, but still works. Plugins should + * use the {@see 'request'} filter instead. + * + * @since 2.0.0 + */ + public function build_query_string() + { + } + /** + * Set up the WordPress Globals. + * + * The query_vars property will be extracted to the GLOBALS. So care should + * be taken when naming global variables that might interfere with the + * WordPress environment. + * + * @since 2.0.0 + * + * @global WP_Query $wp_query WordPress Query object. + * @global string $query_string Query string for the loop. + * @global array $posts The found posts. + * @global WP_Post|null $post The current post, if available. + * @global string $request The SQL statement for the request. + * @global int $more Only set, if single page or post. + * @global int $single If single page or post. Only set, if single page or post. + * @global WP_User $authordata Only set, if author archive. + */ + public function register_globals() + { + } + /** + * Set up the current user. + * + * @since 2.0.0 + */ + public function init() + { + } + /** + * Set up the Loop based on the query variables. + * + * @since 2.0.0 + * + * @global WP_Query $wp_the_query WordPress Query object. + */ + public function query_posts() + { + } + /** + * Set the Headers for 404, if nothing is found for requested URL. + * + * Issue a 404 if a request doesn't match any posts and doesn't match any object + * (e.g. an existing-but-empty category, tag, author) and a 404 was not already issued, + * and if the request was not a search or the homepage. + * + * Otherwise, issue a 200. + * + * This sets headers after posts have been queried. handle_404() really means "handle status". + * By inspecting the result of querying posts, seemingly successful requests can be switched to + * a 404 so that canonical redirection logic can kick in. + * + * @since 2.0.0 + * + * @global WP_Query $wp_query WordPress Query object. + * @phpstan-return void + */ + public function handle_404() + { + } + /** + * Sets up all of the variables required by the WordPress environment. + * + * The action {@see 'wp'} has one parameter that references the WP object. It + * allows for accessing the properties and methods to further manipulate the + * object. + * + * @since 2.0.0 + * + * @param string|array $query_args Passed to parse_request(). + */ + public function main($query_args = '') + { + } + } + /** + * WordPress database access abstraction class. + * + * This class is used to interact with a database without needing to use raw SQL statements. + * By default, WordPress uses this class to instantiate the global $wpdb object, providing + * access to the WordPress database. + * + * It is possible to replace this class with your own by setting the $wpdb global variable + * in wp-content/db.php file to your class. The wpdb class will still be included, so you can + * extend it or simply use your own. + * + * @link https://developer.wordpress.org/reference/classes/wpdb/ + * + * @since 0.71 + */ + #[\AllowDynamicProperties] + class wpdb + { + /** + * Whether to show SQL/DB errors. + * + * Default is to show errors if both WP_DEBUG and WP_DEBUG_DISPLAY evaluate to true. + * + * @since 0.71 + * + * @var bool + */ + public $show_errors = \false; + /** + * Whether to suppress errors during the DB bootstrapping. Default false. + * + * @since 2.5.0 + * + * @var bool + */ + public $suppress_errors = \false; + /** + * The error encountered during the last query. + * + * @since 2.5.0 + * + * @var string + */ + public $last_error = ''; + /** + * The number of queries made. + * + * @since 1.2.0 + * + * @var int + */ + public $num_queries = 0; + /** + * Count of rows returned by the last query. + * + * @since 0.71 + * + * @var int + */ + public $num_rows = 0; + /** + * Count of rows affected by the last query. + * + * @since 0.71 + * + * @var int + */ + public $rows_affected = 0; + /** + * The ID generated for an AUTO_INCREMENT column by the last query (usually INSERT). + * + * @since 0.71 + * + * @var int + */ + public $insert_id = 0; + /** + * The last query made. + * + * @since 0.71 + * + * @var string + */ + public $last_query; + /** + * Results of the last query. + * + * @since 0.71 + * + * @var stdClass[]|null + */ + public $last_result; + /** + * Database query result. + * + * Possible values: + * + * - `mysqli_result` instance for successful SELECT, SHOW, DESCRIBE, or EXPLAIN queries + * - `true` for other query types that were successful + * - `null` if a query is yet to be made or if the result has since been flushed + * - `false` if the query returned an error + * + * @since 0.71 + * + * @var mysqli_result|bool|null + */ + protected $result; + /** + * Cached column info, for confidence checking data before inserting. + * + * @since 4.2.0 + * + * @var array + */ + protected $col_meta = array(); + /** + * Calculated character sets keyed by table name. + * + * @since 4.2.0 + * + * @var string[] + */ + protected $table_charset = array(); + /** + * Whether text fields in the current query need to be confidence checked. + * + * @since 4.2.0 + * + * @var bool + */ + protected $check_current_query = \true; + /** + * Saved info on the table column. + * + * @since 0.71 + * + * @var array + */ + protected $col_info; + /** + * Log of queries that were executed, for debugging purposes. + * + * @since 1.5.0 + * @since 2.5.0 The third element in each query log was added to record the calling functions. + * @since 5.1.0 The fourth element in each query log was added to record the start time. + * @since 5.3.0 The fifth element in each query log was added to record custom data. + * + * @var array[] { + * Array of arrays containing information about queries that were executed. + * + * @type array ...$0 { + * Data for each query. + * + * @type string $0 The query's SQL. + * @type float $1 Total time spent on the query, in seconds. + * @type string $2 Comma-separated list of the calling functions. + * @type float $3 Unix timestamp of the time at the start of the query. + * @type array $4 Custom query data. + * } + * } + * @phpstan-var array<int|string, array{ + * 0: string, + * 1: float, + * 2: string, + * 3: float, + * 4: array, + * }> + */ + public $queries; + /** + * The number of times to retry reconnecting before dying. Default 5. + * + * @since 3.9.0 + * + * @see wpdb::check_connection() + * @var int + */ + protected $reconnect_retries = 5; + /** + * WordPress table prefix. + * + * You can set this to have multiple WordPress installations in a single database. + * The second reason is for possible security precautions. + * + * @since 2.5.0 + * + * @var string + */ + public $prefix = ''; + /** + * WordPress base table prefix. + * + * @since 3.0.0 + * + * @var string + */ + public $base_prefix; + /** + * Whether the database queries are ready to start executing. + * + * @since 2.3.2 + * + * @var bool + */ + public $ready = \false; + /** + * Blog ID. + * + * @since 3.0.0 + * + * @var int + */ + public $blogid = 0; + /** + * Site ID. + * + * @since 3.0.0 + * + * @var int + */ + public $siteid = 0; + /** + * List of WordPress per-site tables. + * + * @since 2.5.0 + * + * @see wpdb::tables() + * @var string[] + */ + public $tables = array('posts', 'comments', 'links', 'options', 'postmeta', 'terms', 'term_taxonomy', 'term_relationships', 'termmeta', 'commentmeta'); + /** + * List of deprecated WordPress tables. + * + * 'categories', 'post2cat', and 'link2cat' were deprecated in 2.3.0, db version 5539. + * + * @since 2.9.0 + * + * @see wpdb::tables() + * @var string[] + */ + public $old_tables = array('categories', 'post2cat', 'link2cat'); + /** + * List of WordPress global tables. + * + * @since 3.0.0 + * + * @see wpdb::tables() + * @var string[] + */ + public $global_tables = array('users', 'usermeta'); + /** + * List of Multisite global tables. + * + * @since 3.0.0 + * + * @see wpdb::tables() + * @var string[] + */ + public $ms_global_tables = array('blogs', 'blogmeta', 'signups', 'site', 'sitemeta', 'registration_log'); + /** + * List of deprecated WordPress Multisite global tables. + * + * @since 6.1.0 + * + * @see wpdb::tables() + * @var string[] + */ + public $old_ms_global_tables = array('sitecategories'); + /** + * WordPress Comments table. + * + * @since 1.5.0 + * + * @var string + */ + public $comments; + /** + * WordPress Comment Metadata table. + * + * @since 2.9.0 + * + * @var string + */ + public $commentmeta; + /** + * WordPress Links table. + * + * @since 1.5.0 + * + * @var string + */ + public $links; + /** + * WordPress Options table. + * + * @since 1.5.0 + * + * @var string + */ + public $options; + /** + * WordPress Post Metadata table. + * + * @since 1.5.0 + * + * @var string + */ + public $postmeta; + /** + * WordPress Posts table. + * + * @since 1.5.0 + * + * @var string + */ + public $posts; + /** + * WordPress Terms table. + * + * @since 2.3.0 + * + * @var string + */ + public $terms; + /** + * WordPress Term Relationships table. + * + * @since 2.3.0 + * + * @var string + */ + public $term_relationships; + /** + * WordPress Term Taxonomy table. + * + * @since 2.3.0 + * + * @var string + */ + public $term_taxonomy; + /** + * WordPress Term Meta table. + * + * @since 4.4.0 + * + * @var string + */ + public $termmeta; + // + // Global and Multisite tables + // + /** + * WordPress User Metadata table. + * + * @since 2.3.0 + * + * @var string + */ + public $usermeta; + /** + * WordPress Users table. + * + * @since 1.5.0 + * + * @var string + */ + public $users; + /** + * Multisite Blogs table. + * + * @since 3.0.0 + * + * @var string + */ + public $blogs; + /** + * Multisite Blog Metadata table. + * + * @since 5.1.0 + * + * @var string + */ + public $blogmeta; + /** + * Multisite Registration Log table. + * + * @since 3.0.0 + * + * @var string + */ + public $registration_log; + /** + * Multisite Signups table. + * + * @since 3.0.0 + * + * @var string + */ + public $signups; + /** + * Multisite Sites table. + * + * @since 3.0.0 + * + * @var string + */ + public $site; + /** + * Multisite Sitewide Terms table. + * + * @since 3.0.0 + * + * @var string + */ + public $sitecategories; + /** + * Multisite Site Metadata table. + * + * @since 3.0.0 + * + * @var string + */ + public $sitemeta; + /** + * Format specifiers for DB columns. + * + * Columns not listed here default to %s. Initialized during WP load. + * Keys are column names, values are format types: 'ID' => '%d'. + * + * @since 2.8.0 + * + * @see wpdb::prepare() + * @see wpdb::insert() + * @see wpdb::update() + * @see wpdb::delete() + * @see wp_set_wpdb_vars() + * @var array + */ + public $field_types = array(); + /** + * Database table columns charset. + * + * @since 2.2.0 + * + * @var string + */ + public $charset; + /** + * Database table columns collate. + * + * @since 2.2.0 + * + * @var string + */ + public $collate; + /** + * Database Username. + * + * @since 2.9.0 + * + * @var string + */ + protected $dbuser; + /** + * Database Password. + * + * @since 3.1.0 + * + * @var string + */ + protected $dbpassword; + /** + * Database Name. + * + * @since 3.1.0 + * + * @var string + */ + protected $dbname; + /** + * Database Host. + * + * @since 3.1.0 + * + * @var string + */ + protected $dbhost; + /** + * Database handle. + * + * Possible values: + * + * - `mysqli` instance during normal operation + * - `null` if the connection is yet to be made or has been closed + * - `false` if the connection has failed + * + * @since 0.71 + * + * @var mysqli|false|null + */ + protected $dbh; + /** + * A textual description of the last query/get_row/get_var call. + * + * @since 3.0.0 + * + * @var string + */ + public $func_call; + /** + * Whether MySQL is used as the database engine. + * + * Set in wpdb::db_connect() to true, by default. This is used when checking + * against the required MySQL version for WordPress. Normally, a replacement + * database drop-in (db.php) will skip these checks, but setting this to true + * will force the checks to occur. + * + * @since 3.3.0 + * + * @var bool + */ + public $is_mysql = \null; + /** + * A list of incompatible SQL modes. + * + * @since 3.9.0 + * + * @var string[] + */ + protected $incompatible_modes = array('NO_ZERO_DATE', 'ONLY_FULL_GROUP_BY', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'TRADITIONAL', 'ANSI'); + /** + * Time when the last query was performed. + * + * Only set when `SAVEQUERIES` is defined and truthy. + * + * @since 1.5.0 + * + * @var float + */ + public $time_start = \null; + /** + * The last SQL error that was encountered. + * + * @since 2.5.0 + * + * @var WP_Error|string + */ + public $error = \null; + /** + * Connects to the database server and selects a database. + * + * Does the actual setting up + * of the class properties and connection to the database. + * + * @since 2.0.8 + * + * @link https://core.trac.wordpress.org/ticket/3354 + * + * @param string $dbuser Database user. + * @param string $dbpassword Database password. + * @param string $dbname Database name. + * @param string $dbhost Database host. + * @phpstan-return void + */ + public function __construct($dbuser, $dbpassword, $dbname, $dbhost) + { + } + /** + * Makes private properties readable for backward compatibility. + * + * @since 3.5.0 + * + * @param string $name The private member to get, and optionally process. + * @return mixed The private member. + */ + public function __get($name) + { + } + /** + * Makes private properties settable for backward compatibility. + * + * @since 3.5.0 + * + * @param string $name The private member to set. + * @param mixed $value The value to set. + * @phpstan-return void + */ + public function __set($name, $value) + { + } + /** + * Makes private properties check-able for backward compatibility. + * + * @since 3.5.0 + * + * @param string $name The private member to check. + * @return bool If the member is set or not. + */ + public function __isset($name) + { + } + /** + * Makes private properties un-settable for backward compatibility. + * + * @since 3.5.0 + * + * @param string $name The private member to unset + */ + public function __unset($name) + { + } + /** + * Sets $this->charset and $this->collate. + * + * @since 3.1.0 + */ + public function init_charset() + { + } + /** + * Determines the best charset and collation to use given a charset and collation. + * + * For example, when able, utf8mb4 should be used instead of utf8. + * + * @since 4.6.0 + * + * @param string $charset The character set to check. + * @param string $collate The collation to check. + * @return array { + * The most appropriate character set and collation to use. + * + * @type string $charset Character set. + * @type string $collate Collation. + * } + * @phpstan-return array{ + * charset: string, + * collate: string, + * } + */ + public function determine_charset($charset, $collate) + { + } + /** + * Sets the connection's character set. + * + * @since 3.1.0 + * + * @param mysqli $dbh The connection returned by `mysqli_connect()`. + * @param string $charset Optional. The character set. Default null. + * @param string $collate Optional. The collation. Default null. + */ + public function set_charset($dbh, $charset = \null, $collate = \null) + { + } + /** + * Changes the current SQL mode, and ensures its WordPress compatibility. + * + * If no modes are passed, it will ensure the current MySQL server modes are compatible. + * + * @since 3.9.0 + * + * @param array $modes Optional. A list of SQL modes to set. Default empty array. + * @phpstan-return void + */ + public function set_sql_mode($modes = array()) + { + } + /** + * Sets the table prefix for the WordPress tables. + * + * @since 2.5.0 + * + * @param string $prefix Alphanumeric name for the new prefix. + * @param bool $set_table_names Optional. Whether the table names, e.g. wpdb::$posts, + * should be updated or not. Default true. + * @return string|WP_Error Old prefix or WP_Error on error. + */ + public function set_prefix($prefix, $set_table_names = \true) + { + } + /** + * Sets blog ID. + * + * @since 3.0.0 + * + * @param int $blog_id + * @param int $network_id Optional. Network ID. Default 0. + * @return int Previous blog ID. + */ + public function set_blog_id($blog_id, $network_id = 0) + { + } + /** + * Gets blog prefix. + * + * @since 3.0.0 + * + * @param int $blog_id Optional. Blog ID to retrieve the table prefix for. + * Defaults to the current blog ID. + * @return string Blog prefix. + */ + public function get_blog_prefix($blog_id = \null) + { + } + /** + * Returns an array of WordPress tables. + * + * Also allows for the `CUSTOM_USER_TABLE` and `CUSTOM_USER_META_TABLE` to override the WordPress users + * and usermeta tables that would otherwise be determined by the prefix. + * + * The `$scope` argument can take one of the following: + * + * - 'all' - returns 'all' and 'global' tables. No old tables are returned. + * - 'blog' - returns the blog-level tables for the queried blog. + * - 'global' - returns the global tables for the installation, returning multisite tables only on multisite. + * - 'ms_global' - returns the multisite global tables, regardless if current installation is multisite. + * - 'old' - returns tables which are deprecated. + * + * @since 3.0.0 + * @since 6.1.0 `old` now includes deprecated multisite global tables only on multisite. + * + * @uses wpdb::$tables + * @uses wpdb::$old_tables + * @uses wpdb::$global_tables + * @uses wpdb::$ms_global_tables + * @uses wpdb::$old_ms_global_tables + * + * @param string $scope Optional. Possible values include 'all', 'global', 'ms_global', 'blog', + * or 'old' tables. Default 'all'. + * @param bool $prefix Optional. Whether to include table prefixes. If blog prefix is requested, + * then the custom users and usermeta tables will be mapped. Default true. + * @param int $blog_id Optional. The blog_id to prefix. Used only when prefix is requested. + * Defaults to `wpdb::$blogid`. + * @return string[] Table names. When a prefix is requested, the key is the unprefixed table name. + */ + public function tables($scope = 'all', $prefix = \true, $blog_id = 0) + { + } + /** + * Selects a database using the current or provided database connection. + * + * The database name will be changed based on the current database connection. + * On failure, the execution will bail and display a DB error. + * + * @since 0.71 + * + * @param string $db Database name. + * @param mysqli $dbh Optional. Database connection. + * Defaults to the current database handle. + */ + public function select($db, $dbh = \null) + { + } + /** + * Do not use, deprecated. + * + * Use esc_sql() or wpdb::prepare() instead. + * + * @since 2.8.0 + * @deprecated 3.6.0 Use wpdb::prepare() + * @see wpdb::prepare() + * @see esc_sql() + * + * @param string $data + * @return string + */ + public function _weak_escape($data) + { + } + /** + * Real escape using mysqli_real_escape_string(). + * + * @since 2.8.0 + * + * @see mysqli_real_escape_string() + * + * @param string $data String to escape. + * @return string Escaped string. + */ + public function _real_escape($data) + { + } + /** + * Escapes data. Works on arrays. + * + * @since 2.8.0 + * + * @uses wpdb::_real_escape() + * + * @param string|array $data Data to escape. + * @return string|array Escaped data, in the same type as supplied. + */ + public function _escape($data) + { + } + /** + * Do not use, deprecated. + * + * Use esc_sql() or wpdb::prepare() instead. + * + * @since 0.71 + * @deprecated 3.6.0 Use wpdb::prepare() + * @see wpdb::prepare() + * @see esc_sql() + * + * @param string|array $data Data to escape. + * @return string|array Escaped data, in the same type as supplied. + */ + public function escape($data) + { + } + /** + * Escapes content by reference for insertion into the database, for security. + * + * @uses wpdb::_real_escape() + * + * @since 2.3.0 + * + * @param string $data String to escape. + */ + public function escape_by_ref(&$data) + { + } + /** + * Quotes an identifier for a MySQL database, e.g. table/field names. + * + * @since 6.2.0 + * + * @param string $identifier Identifier to escape. + * @return string Escaped identifier. + */ + public function quote_identifier($identifier) + { + } + /** + * Prepares a SQL query for safe execution. + * + * Uses `sprintf()`-like syntax. The following placeholders can be used in the query string: + * + * - `%d` (integer) + * - `%f` (float) + * - `%s` (string) + * - `%i` (identifier, e.g. table/field names) + * + * All placeholders MUST be left unquoted in the query string. A corresponding argument + * MUST be passed for each placeholder. + * + * Note: There is one exception to the above: for compatibility with old behavior, + * numbered or formatted string placeholders (eg, `%1$s`, `%5s`) will not have quotes + * added by this function, so should be passed with appropriate quotes around them. + * + * Literal percentage signs (`%`) in the query string must be written as `%%`. Percentage wildcards + * (for example, to use in LIKE syntax) must be passed via a substitution argument containing + * the complete LIKE string, these cannot be inserted directly in the query string. + * Also see wpdb::esc_like(). + * + * Arguments may be passed as individual arguments to the method, or as a single array + * containing all arguments. A combination of the two is not supported. + * + * Examples: + * + * $wpdb->prepare( + * "SELECT * FROM `table` WHERE `column` = %s AND `field` = %d OR `other_field` LIKE %s", + * array( 'foo', 1337, '%bar' ) + * ); + * + * $wpdb->prepare( + * "SELECT DATE_FORMAT(`field`, '%%c') FROM `table` WHERE `column` = %s", + * 'foo' + * ); + * + * @since 2.3.0 + * @since 5.3.0 Formalized the existing and already documented `...$args` parameter + * by updating the function signature. The second parameter was changed + * from `$args` to `...$args`. + * @since 6.2.0 Added `%i` for identifiers, e.g. table or field names. + * Check support via `wpdb::has_cap( 'identifier_placeholders' )`. + * This preserves compatibility with `sprintf()`, as the C version uses + * `%d` and `$i` as a signed integer, whereas PHP only supports `%d`. + * + * @link https://www.php.net/sprintf Description of syntax. + * + * @param string $query Query statement with `sprintf()`-like placeholders. + * @param array|mixed $args The array of variables to substitute into the query's placeholders + * if being called with an array of arguments, or the first variable + * to substitute into the query's placeholders if being called with + * individual arguments. + * @param mixed ...$args Further variables to substitute into the query's placeholders + * if being called with individual arguments. + * @return string|void Sanitized query string, if there is a query to prepare. + * @phpstan-param literal-string $query + */ + public function prepare($query, ...$args) + { + } + /** + * First half of escaping for `LIKE` special characters `%` and `_` before preparing for SQL. + * + * Use this only before wpdb::prepare() or esc_sql(). Reversing the order is very bad for security. + * + * Example Prepared Statement: + * + * $wild = '%'; + * $find = 'only 43% of planets'; + * $like = $wild . $wpdb->esc_like( $find ) . $wild; + * $sql = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE post_content LIKE %s", $like ); + * + * Example Escape Chain: + * + * $sql = esc_sql( $wpdb->esc_like( $input ) ); + * + * @since 4.0.0 + * + * @param string $text The raw text to be escaped. The input typed by the user + * should have no extra or deleted slashes. + * @return string Text in the form of a LIKE phrase. The output is not SQL safe. + * Call wpdb::prepare() or wpdb::_real_escape() next. + */ + public function esc_like($text) + { + } + /** + * Prints SQL/DB error. + * + * @since 0.71 + * + * @global array $EZSQL_ERROR Stores error information of query and error string. + * + * @param string $str The error to display. + * @return void|false Void if the showing of errors is enabled, false if disabled. + */ + public function print_error($str = '') + { + } + /** + * Enables showing of database errors. + * + * This function should be used only to enable showing of errors. + * wpdb::hide_errors() should be used instead for hiding errors. + * + * @since 0.71 + * + * @see wpdb::hide_errors() + * + * @param bool $show Optional. Whether to show errors. Default true. + * @return bool Whether showing of errors was previously active. + */ + public function show_errors($show = \true) + { + } + /** + * Disables showing of database errors. + * + * By default database errors are not shown. + * + * @since 0.71 + * + * @see wpdb::show_errors() + * + * @return bool Whether showing of errors was previously active. + */ + public function hide_errors() + { + } + /** + * Enables or disables suppressing of database errors. + * + * By default database errors are suppressed. + * + * @since 2.5.0 + * + * @see wpdb::hide_errors() + * + * @param bool $suppress Optional. Whether to suppress errors. Default true. + * @return bool Whether suppressing of errors was previously active. + */ + public function suppress_errors($suppress = \true) + { + } + /** + * Kills cached query results. + * + * @since 0.71 + * @phpstan-return void + */ + public function flush() + { + } + /** + * Connects to and selects database. + * + * If `$allow_bail` is false, the lack of database connection will need to be handled manually. + * + * @since 3.0.0 + * @since 3.9.0 $allow_bail parameter added. + * + * @param bool $allow_bail Optional. Allows the function to bail. Default true. + * @return bool True with a successful connection, false on failure. + */ + public function db_connect($allow_bail = \true) + { + } + /** + * Parses the DB_HOST setting to interpret it for mysqli_real_connect(). + * + * mysqli_real_connect() doesn't support the host param including a port or socket + * like mysql_connect() does. This duplicates how mysql_connect() detects a port + * and/or socket file. + * + * @since 4.9.0 + * + * @param string $host The DB_HOST setting to parse. + * @return array|false { + * Array containing the host, the port, the socket and + * whether it is an IPv6 address, in that order. + * False if the host couldn't be parsed. + * + * @type string $0 Host name. + * @type string|null $1 Port. + * @type string|null $2 Socket. + * @type bool $3 Whether it is an IPv6 address. + * } + * @phpstan-return false|array{ + * 0: string, + * 1: string|null, + * 2: string|null, + * 3: bool, + * } + */ + public function parse_db_host($host) + { + } + /** + * Checks that the connection to the database is still up. If not, try to reconnect. + * + * If this function is unable to reconnect, it will forcibly die, or if called + * after the {@see 'template_redirect'} hook has been fired, return false instead. + * + * If `$allow_bail` is false, the lack of database connection will need to be handled manually. + * + * @since 3.9.0 + * + * @param bool $allow_bail Optional. Allows the function to bail. Default true. + * @return bool|void True if the connection is up. + */ + public function check_connection($allow_bail = \true) + { + } + /** + * Performs a database query, using current database connection. + * + * More information can be found on the documentation page. + * + * @since 0.71 + * + * @link https://developer.wordpress.org/reference/classes/wpdb/ + * + * @param string $query Database query. + * @return int|bool Boolean true for CREATE, ALTER, TRUNCATE and DROP queries. Number of rows + * affected/selected for all other queries. Boolean false on error. + */ + public function query($query) + { + } + /** + * Logs query data. + * + * @since 5.3.0 + * + * @param string $query The query's SQL. + * @param float $query_time Total time spent on the query, in seconds. + * @param string $query_callstack Comma-separated list of the calling functions. + * @param float $query_start Unix timestamp of the time at the start of the query. + * @param array $query_data Custom query data. + */ + public function log_query($query, $query_time, $query_callstack, $query_start, $query_data) + { + } + /** + * Generates and returns a placeholder escape string for use in queries returned by ::prepare(). + * + * @since 4.8.3 + * + * @return string String to escape placeholders. + */ + public function placeholder_escape() + { + } + /** + * Adds a placeholder escape string, to escape anything that resembles a printf() placeholder. + * + * @since 4.8.3 + * + * @param string $query The query to escape. + * @return string The query with the placeholder escape string inserted where necessary. + */ + public function add_placeholder_escape($query) + { + } + /** + * Removes the placeholder escape strings from a query. + * + * @since 4.8.3 + * + * @param string $query The query from which the placeholder will be removed. + * @return string The query with the placeholder removed. + */ + public function remove_placeholder_escape($query) + { + } + /** + * Inserts a row into the table. + * + * Examples: + * + * $wpdb->insert( + * 'table', + * array( + * 'column1' => 'foo', + * 'column2' => 'bar', + * ) + * ); + * $wpdb->insert( + * 'table', + * array( + * 'column1' => 'foo', + * 'column2' => 1337, + * ), + * array( + * '%s', + * '%d', + * ) + * ); + * + * @since 2.5.0 + * + * @see wpdb::prepare() + * @see wpdb::$field_types + * @see wp_set_wpdb_vars() + * + * @param string $table Table name. + * @param array $data Data to insert (in column => value pairs). + * Both `$data` columns and `$data` values should be "raw" (neither should be SQL escaped). + * Sending a null value will cause the column to be set to NULL - the corresponding + * format is ignored in this case. + * @param string[]|string $format Optional. An array of formats to be mapped to each of the value in `$data`. + * If string, that format will be used for all of the values in `$data`. + * A format is one of '%d', '%f', '%s' (integer, float, string). + * If omitted, all values in `$data` will be treated as strings unless otherwise + * specified in wpdb::$field_types. Default null. + * @return int|false The number of rows inserted, or false on error. + */ + public function insert($table, $data, $format = \null) + { + } + /** + * Replaces a row in the table or inserts it if it does not exist, based on a PRIMARY KEY or a UNIQUE index. + * + * A REPLACE works exactly like an INSERT, except that if an old row in the table has the same value as a new row + * for a PRIMARY KEY or a UNIQUE index, the old row is deleted before the new row is inserted. + * + * Examples: + * + * $wpdb->replace( + * 'table', + * array( + * 'ID' => 123, + * 'column1' => 'foo', + * 'column2' => 'bar', + * ) + * ); + * $wpdb->replace( + * 'table', + * array( + * 'ID' => 456, + * 'column1' => 'foo', + * 'column2' => 1337, + * ), + * array( + * '%d', + * '%s', + * '%d', + * ) + * ); + * + * @since 3.0.0 + * + * @see wpdb::prepare() + * @see wpdb::$field_types + * @see wp_set_wpdb_vars() + * + * @param string $table Table name. + * @param array $data Data to insert (in column => value pairs). + * Both `$data` columns and `$data` values should be "raw" (neither should be SQL escaped). + * A primary key or unique index is required to perform a replace operation. + * Sending a null value will cause the column to be set to NULL - the corresponding + * format is ignored in this case. + * @param string[]|string $format Optional. An array of formats to be mapped to each of the value in `$data`. + * If string, that format will be used for all of the values in `$data`. + * A format is one of '%d', '%f', '%s' (integer, float, string). + * If omitted, all values in `$data` will be treated as strings unless otherwise + * specified in wpdb::$field_types. Default null. + * @return int|false The number of rows affected, or false on error. + */ + public function replace($table, $data, $format = \null) + { + } + /** + * Helper function for insert and replace. + * + * Runs an insert or replace query based on `$type` argument. + * + * @since 3.0.0 + * + * @see wpdb::prepare() + * @see wpdb::$field_types + * @see wp_set_wpdb_vars() + * + * @param string $table Table name. + * @param array $data Data to insert (in column => value pairs). + * Both `$data` columns and `$data` values should be "raw" (neither should be SQL escaped). + * Sending a null value will cause the column to be set to NULL - the corresponding + * format is ignored in this case. + * @param string[]|string $format Optional. An array of formats to be mapped to each of the value in `$data`. + * If string, that format will be used for all of the values in `$data`. + * A format is one of '%d', '%f', '%s' (integer, float, string). + * If omitted, all values in `$data` will be treated as strings unless otherwise + * specified in wpdb::$field_types. Default null. + * @param string $type Optional. Type of operation. Either 'INSERT' or 'REPLACE'. + * Default 'INSERT'. + * @return int|false The number of rows affected, or false on error. + * @phpstan-param 'INSERT'|'REPLACE' $type + */ + public function _insert_replace_helper($table, $data, $format = \null, $type = 'INSERT') + { + } + /** + * Updates a row in the table. + * + * Examples: + * + * $wpdb->update( + * 'table', + * array( + * 'column1' => 'foo', + * 'column2' => 'bar', + * ), + * array( + * 'ID' => 1, + * ) + * ); + * $wpdb->update( + * 'table', + * array( + * 'column1' => 'foo', + * 'column2' => 1337, + * ), + * array( + * 'ID' => 1, + * ), + * array( + * '%s', + * '%d', + * ), + * array( + * '%d', + * ) + * ); + * + * @since 2.5.0 + * + * @see wpdb::prepare() + * @see wpdb::$field_types + * @see wp_set_wpdb_vars() + * + * @param string $table Table name. + * @param array $data Data to update (in column => value pairs). + * Both $data columns and $data values should be "raw" (neither should be SQL escaped). + * Sending a null value will cause the column to be set to NULL - the corresponding + * format is ignored in this case. + * @param array $where A named array of WHERE clauses (in column => value pairs). + * Multiple clauses will be joined with ANDs. + * Both $where columns and $where values should be "raw". + * Sending a null value will create an IS NULL comparison - the corresponding + * format will be ignored in this case. + * @param string[]|string $format Optional. An array of formats to be mapped to each of the values in $data. + * If string, that format will be used for all of the values in $data. + * A format is one of '%d', '%f', '%s' (integer, float, string). + * If omitted, all values in $data will be treated as strings unless otherwise + * specified in wpdb::$field_types. Default null. + * @param string[]|string $where_format Optional. An array of formats to be mapped to each of the values in $where. + * If string, that format will be used for all of the items in $where. + * A format is one of '%d', '%f', '%s' (integer, float, string). + * If omitted, all values in $where will be treated as strings unless otherwise + * specified in wpdb::$field_types. Default null. + * @return int|false The number of rows updated, or false on error. + */ + public function update($table, $data, $where, $format = \null, $where_format = \null) + { + } + /** + * Deletes a row in the table. + * + * Examples: + * + * $wpdb->delete( + * 'table', + * array( + * 'ID' => 1, + * ) + * ); + * $wpdb->delete( + * 'table', + * array( + * 'ID' => 1, + * ), + * array( + * '%d', + * ) + * ); + * + * @since 3.4.0 + * + * @see wpdb::prepare() + * @see wpdb::$field_types + * @see wp_set_wpdb_vars() + * + * @param string $table Table name. + * @param array $where A named array of WHERE clauses (in column => value pairs). + * Multiple clauses will be joined with ANDs. + * Both $where columns and $where values should be "raw". + * Sending a null value will create an IS NULL comparison - the corresponding + * format will be ignored in this case. + * @param string[]|string $where_format Optional. An array of formats to be mapped to each of the values in $where. + * If string, that format will be used for all of the items in $where. + * A format is one of '%d', '%f', '%s' (integer, float, string). + * If omitted, all values in $data will be treated as strings unless otherwise + * specified in wpdb::$field_types. Default null. + * @return int|false The number of rows deleted, or false on error. + */ + public function delete($table, $where, $where_format = \null) + { + } + /** + * Processes arrays of field/value pairs and field formats. + * + * This is a helper method for wpdb's CRUD methods, which take field/value pairs + * for inserts, updates, and where clauses. This method first pairs each value + * with a format. Then it determines the charset of that field, using that + * to determine if any invalid text would be stripped. If text is stripped, + * then field processing is rejected and the query fails. + * + * @since 4.2.0 + * + * @param string $table Table name. + * @param array $data Array of values keyed by their field names. + * @param string[]|string $format Formats or format to be mapped to the values in the data. + * @return array|false An array of fields that contain paired value and formats. + * False for invalid values. + */ + protected function process_fields($table, $data, $format) + { + } + /** + * Prepares arrays of value/format pairs as passed to wpdb CRUD methods. + * + * @since 4.2.0 + * + * @param array $data Array of values keyed by their field names. + * @param string[]|string $format Formats or format to be mapped to the values in the data. + * @return array { + * Array of values and formats keyed by their field names. + * + * @type mixed $value The value to be formatted. + * @type string $format The format to be mapped to the value. + * } + * @phpstan-return array{ + * value: mixed, + * format: string, + * } + */ + protected function process_field_formats($data, $format) + { + } + /** + * Adds field charsets to field/value/format arrays generated by wpdb::process_field_formats(). + * + * @since 4.2.0 + * + * @param array $data { + * Array of values and formats keyed by their field names, + * as it comes from the wpdb::process_field_formats() method. + * + * @type array ...$0 { + * Value and format for this field. + * + * @type mixed $value The value to be formatted. + * @type string $format The format to be mapped to the value. + * } + * } + * @param string $table Table name. + * @return array|false { + * The same array of data with additional 'charset' keys, or false if + * the charset for the table cannot be found. + * + * @type array ...$0 { + * Value, format, and charset for this field. + * + * @type mixed $value The value to be formatted. + * @type string $format The format to be mapped to the value. + * @type string|false $charset The charset to be used for the value. + * } + * } + * @phpstan-param array<int|string, array{ + * value: mixed, + * format: string, + * }> $data + * @phpstan-return false|array<int|string, array{ + * value: mixed, + * format: string, + * charset: string|false, + * }> + */ + protected function process_field_charsets($data, $table) + { + } + /** + * For string fields, records the maximum string length that field can safely save. + * + * @since 4.2.1 + * + * @param array $data { + * Array of values, formats, and charsets keyed by their field names, + * as it comes from the wpdb::process_field_charsets() method. + * + * @type array ...$0 { + * Value, format, and charset for this field. + * + * @type mixed $value The value to be formatted. + * @type string $format The format to be mapped to the value. + * @type string|false $charset The charset to be used for the value. + * } + * } + * @param string $table Table name. + * @return array|false { + * The same array of data with additional 'length' keys, or false if + * information for the table cannot be found. + * + * @type array ...$0 { + * Value, format, charset, and length for this field. + * + * @type mixed $value The value to be formatted. + * @type string $format The format to be mapped to the value. + * @type string|false $charset The charset to be used for the value. + * @type array|false $length { + * Information about the maximum length of the value. + * False if the column has no length. + * + * @type string $type One of 'byte' or 'char'. + * @type int $length The column length. + * } + * } + * } + * @phpstan-param array<int|string, array{ + * value: mixed, + * format: string, + * charset: string|false, + * }> $data + * @phpstan-return false|array<int|string, array{ + * value: mixed, + * format: string, + * charset: string|false, + * length: false|array{ + * type: string, + * length: int, + * }, + * }> + */ + protected function process_field_lengths($data, $table) + { + } + /** + * Retrieves one value from the database. + * + * Executes a SQL query and returns the value from the SQL result. + * If the SQL result contains more than one column and/or more than one row, + * the value in the column and row specified is returned. If $query is null, + * the value in the specified column and row from the previous SQL result is returned. + * + * @since 0.71 + * + * @param string|null $query Optional. SQL query. Defaults to null, use the result from the previous query. + * @param int $x Optional. Column of value to return. Indexed from 0. Default 0. + * @param int $y Optional. Row of value to return. Indexed from 0. Default 0. + * @return string|null Database query result (as string), or null on failure. + */ + public function get_var($query = \null, $x = 0, $y = 0) + { + } + /** + * Retrieves one row from the database. + * + * Executes a SQL query and returns the row from the SQL result. + * + * @since 0.71 + * + * @param string|null $query SQL query. + * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which + * correspond to an stdClass object, an associative array, or a numeric array, + * respectively. Default OBJECT. + * @param int $y Optional. Row to return. Indexed from 0. Default 0. + * @return array|object|null|void Database query result in format specified by $output or null on failure. + * @phpstan-param 'OBJECT'|'ARRAY_A'|'ARRAY_N' $output + * @phpstan-param 0|positive-int $y + * @phpstan-return null|void|($output is 'ARRAY_A' ? array<array-key, mixed> : ($output is 'ARRAY_N' ? list<mixed> : \stdClass)) + */ + public function get_row($query = \null, $output = \OBJECT, $y = 0) + { + } + /** + * Retrieves one column from the database. + * + * Executes a SQL query and returns the column from the SQL result. + * If the SQL result contains more than one column, the column specified is returned. + * If $query is null, the specified column from the previous SQL result is returned. + * + * @since 0.71 + * + * @param string|null $query Optional. SQL query. Defaults to previous query. + * @param int $x Optional. Column to return. Indexed from 0. Default 0. + * @return array Database query result. Array indexed from 0 by SQL result row number. + */ + public function get_col($query = \null, $x = 0) + { + } + /** + * Retrieves an entire SQL result set from the database (i.e., many rows). + * + * Executes a SQL query and returns the entire SQL result. + * + * @since 0.71 + * + * @param string $query SQL query. + * @param string $output Optional. Any of ARRAY_A | ARRAY_N | OBJECT | OBJECT_K constants. + * With one of the first three, return an array of rows indexed + * from 0 by SQL result row number. Each row is an associative array + * (column => value, ...), a numerically indexed array (0 => value, ...), + * or an object ( ->column = value ), respectively. With OBJECT_K, + * return an associative array of row objects keyed by the value + * of each row's first column's value. Duplicate keys are discarded. + * Default OBJECT. + * @return array|object|null Database query results. + * @phpstan-param 'OBJECT'|'OBJECT_K'|'ARRAY_A'|'ARRAY_N' $output + * @phpstan-return null|($output is 'ARRAY_A' ? list<array<array-key, mixed>> : ($output is 'ARRAY_N' ? list<array<int, mixed>> : ($output is 'OBJECT_K' ? array<array-key, \stdClass> : list<\stdClass>))) + */ + public function get_results($query = \null, $output = \OBJECT) + { + } + /** + * Retrieves the character set for the given table. + * + * @since 4.2.0 + * + * @param string $table Table name. + * @return string|WP_Error Table character set, WP_Error object if it couldn't be found. + */ + protected function get_table_charset($table) + { + } + /** + * Retrieves the character set for the given column. + * + * @since 4.2.0 + * + * @param string $table Table name. + * @param string $column Column name. + * @return string|false|WP_Error Column character set as a string. False if the column has + * no character set. WP_Error object if there was an error. + */ + public function get_col_charset($table, $column) + { + } + /** + * Retrieves the maximum string length allowed in a given column. + * + * The length may either be specified as a byte length or a character length. + * + * @since 4.2.1 + * + * @param string $table Table name. + * @param string $column Column name. + * @return array|false|WP_Error { + * Array of column length information, false if the column has no length (for + * example, numeric column), WP_Error object if there was an error. + * + * @type string $type One of 'byte' or 'char'. + * @type int $length The column length. + * } + * @phpstan-return false|\WP_Error|array{ + * type: string, + * length: int, + * } + */ + public function get_col_length($table, $column) + { + } + /** + * Checks if a string is ASCII. + * + * The negative regex is faster for non-ASCII strings, as it allows + * the search to finish as soon as it encounters a non-ASCII character. + * + * @since 4.2.0 + * + * @param string $input_string String to check. + * @return bool True if ASCII, false if not. + */ + protected function check_ascii($input_string) + { + } + /** + * Checks if the query is accessing a collation considered safe on the current version of MySQL. + * + * @since 4.2.0 + * + * @param string $query The query to check. + * @return bool True if the collation is safe, false if it isn't. + */ + protected function check_safe_collation($query) + { + } + /** + * Strips any invalid characters based on value/charset pairs. + * + * @since 4.2.0 + * + * @param array $data Array of value arrays. Each value array has the keys 'value', 'charset', and 'length'. + * An optional 'ascii' key can be set to false to avoid redundant ASCII checks. + * @return array|WP_Error The $data parameter, with invalid characters removed from each value. + * This works as a passthrough: any additional keys such as 'field' are + * retained in each value array. If we cannot remove invalid characters, + * a WP_Error object is returned. + */ + protected function strip_invalid_text($data) + { + } + /** + * Strips any invalid characters from the query. + * + * @since 4.2.0 + * + * @param string $query Query to convert. + * @return string|WP_Error The converted query, or a WP_Error object if the conversion fails. + */ + protected function strip_invalid_text_from_query($query) + { + } + /** + * Strips any invalid characters from the string for a given table and column. + * + * @since 4.2.0 + * + * @param string $table Table name. + * @param string $column Column name. + * @param string $value The text to check. + * @return string|WP_Error The converted string, or a WP_Error object if the conversion fails. + */ + public function strip_invalid_text_for_column($table, $column, $value) + { + } + /** + * Finds the first table name referenced in a query. + * + * @since 4.2.0 + * + * @param string $query The query to search. + * @return string|false The table name found, or false if a table couldn't be found. + */ + protected function get_table_from_query($query) + { + } + /** + * Loads the column metadata from the last query. + * + * @since 3.5.0 + * @phpstan-return void + */ + protected function load_col_info() + { + } + /** + * Retrieves column metadata from the last query. + * + * @since 0.71 + * + * @param string $info_type Optional. Possible values include 'name', 'table', 'def', 'max_length', + * 'not_null', 'primary_key', 'multiple_key', 'unique_key', 'numeric', + * 'blob', 'type', 'unsigned', 'zerofill'. Default 'name'. + * @param int $col_offset Optional. 0: col name. 1: which table the col's in. 2: col's max length. + * 3: if the col is numeric. 4: col's type. Default -1. + * @return mixed Column results. + */ + public function get_col_info($info_type = 'name', $col_offset = -1) + { + } + /** + * Starts the timer, for debugging purposes. + * + * @since 1.5.0 + * + * @return true + */ + public function timer_start() + { + } + /** + * Stops the debugging timer. + * + * @since 1.5.0 + * + * @return float Total time spent on the query, in seconds. + */ + public function timer_stop() + { + } + /** + * Wraps errors in a nice header and footer and dies. + * + * Will not die if wpdb::$show_errors is false. + * + * @since 1.5.0 + * + * @param string $message The error message. + * @param string $error_code Optional. A computer-readable string to identify the error. + * Default '500'. + * @return void|false Void if the showing of errors is enabled, false if disabled. + */ + public function bail($message, $error_code = '500') + { + } + /** + * Closes the current database connection. + * + * @since 4.5.0 + * + * @return bool True if the connection was successfully closed, + * false if it wasn't, or if the connection doesn't exist. + */ + public function close() + { + } + /** + * Determines whether MySQL database is at least the required minimum version. + * + * @since 2.5.0 + * + * @global string $wp_version The WordPress version string. + * @global string $required_mysql_version The required MySQL version string. + * @return void|WP_Error + */ + public function check_database_version() + { + } + /** + * Determines whether the database supports collation. + * + * Called when WordPress is generating the table scheme. + * + * Use `wpdb::has_cap( 'collation' )`. + * + * @since 2.5.0 + * @deprecated 3.5.0 Use wpdb::has_cap() + * + * @return bool True if collation is supported, false if not. + */ + public function supports_collation() + { + } + /** + * Retrieves the database character collate. + * + * @since 3.5.0 + * + * @return string The database character collate. + */ + public function get_charset_collate() + { + } + /** + * Determines whether the database or WPDB supports a particular feature. + * + * Capability sniffs for the database server and current version of WPDB. + * + * Database sniffs are based on the version of MySQL the site is using. + * + * WPDB sniffs are added as new features are introduced to allow theme and plugin + * developers to determine feature support. This is to account for drop-ins which may + * introduce feature support at a different time to WordPress. + * + * @since 2.7.0 + * @since 4.1.0 Added support for the 'utf8mb4' feature. + * @since 4.6.0 Added support for the 'utf8mb4_520' feature. + * @since 6.2.0 Added support for the 'identifier_placeholders' feature. + * @since 6.6.0 The `utf8mb4` feature now always returns true. + * + * @see wpdb::db_version() + * + * @param string $db_cap The feature to check for. Accepts 'collation', 'group_concat', + * 'subqueries', 'set_charset', 'utf8mb4', 'utf8mb4_520', + * or 'identifier_placeholders'. + * @return bool True when the database feature is supported, false otherwise. + * @phpstan-param 'collation'|'group_concat'|'subqueries'|'set_charset'|'utf8mb4'|'utf8mb4_520'|'identifier_placeholders' $db_cap + */ + public function has_cap($db_cap) + { + } + /** + * Retrieves a comma-separated list of the names of the functions that called wpdb. + * + * @since 2.5.0 + * + * @return string Comma-separated list of the calling functions. + */ + public function get_caller() + { + } + /** + * Retrieves the database server version. + * + * @since 2.7.0 + * + * @return string|null Version number on success, null on failure. + */ + public function db_version() + { + } + /** + * Returns the version of the MySQL server. + * + * @since 5.5.0 + * + * @return string Server version as a string. + */ + public function db_server_info() + { + } + } + /** + * Customize API: WP_Customize_Media_Control class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * Customize Media Control class. + * + * @since 4.2.0 + * + * @see WP_Customize_Control + */ + class WP_Customize_Media_Control extends \WP_Customize_Control + { + /** + * Control type. + * + * @since 4.2.0 + * @var string + */ + public $type = 'media'; + /** + * Media control mime type. + * + * @since 4.2.0 + * @var string + */ + public $mime_type = ''; + /** + * Button labels. + * + * @since 4.2.0 + * @var array + */ + public $button_labels = array(); + /** + * Constructor. + * + * @since 4.1.0 + * @since 4.2.0 Moved from WP_Customize_Upload_Control. + * + * @see WP_Customize_Control::__construct() + * + * @param WP_Customize_Manager $manager Customizer bootstrap instance. + * @param string $id Control ID. + * @param array $args Optional. Arguments to override class property defaults. + * See WP_Customize_Control::__construct() for information + * on accepted arguments. Default empty array. + * @phpstan-param array{ + * instance_number?: int, + * manager?: WP_Customize_Manager, + * id?: string, + * settings?: array, + * setting?: string, + * capability?: string, + * priority?: int, + * section?: string, + * label?: string, + * description?: string, + * choices?: array, + * input_attrs?: array, + * allow_addition?: bool, + * json?: array, + * type?: string, + * active_callback?: callable, + * } $args See WP_Customize_Control::__construct() + */ + public function __construct($manager, $id, $args = array()) + { + } + /** + * Enqueue control related scripts/styles. + * + * @since 3.4.0 + * @since 4.2.0 Moved from WP_Customize_Upload_Control. + */ + public function enqueue() + { + } + /** + * Refresh the parameters passed to the JavaScript via JSON. + * + * @since 3.4.0 + * @since 4.2.0 Moved from WP_Customize_Upload_Control. + * + * @see WP_Customize_Control::to_json() + */ + public function to_json() + { + } + /** + * Don't render any content for this control from PHP. + * + * @since 3.4.0 + * @since 4.2.0 Moved from WP_Customize_Upload_Control. + * + * @see WP_Customize_Media_Control::content_template() + */ + public function render_content() + { + } + /** + * Render a JS template for the content of the media control. + * + * @since 4.1.0 + * @since 4.2.0 Moved from WP_Customize_Upload_Control. + */ + public function content_template() + { + } + /** + * Get default button labels. + * + * Provides an array of the default button labels based on the mime type of the current control. + * + * @since 4.9.0 + * + * @return string[] An associative array of default button labels keyed by the button name. + */ + public function get_default_button_labels() + { + } + } + /** + * Customize API: WP_Customize_Upload_Control class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * Customize Upload Control Class. + * + * @since 3.4.0 + * + * @see WP_Customize_Media_Control + */ + class WP_Customize_Upload_Control extends \WP_Customize_Media_Control + { + /** + * Control type. + * + * @since 3.4.0 + * @var string + */ + public $type = 'upload'; + /** + * Media control mime type. + * + * @since 4.1.0 + * @var string + */ + public $mime_type = ''; + /** + * Button labels. + * + * @since 4.1.0 + * @var array + */ + public $button_labels = array(); + public $removed = ''; + // Unused. + public $context; + // Unused. + public $extensions = array(); + // Unused. + /** + * Refresh the parameters passed to the JavaScript via JSON. + * + * @since 3.4.0 + * + * @uses WP_Customize_Media_Control::to_json() + */ + public function to_json() + { + } + } + /** + * Customize API: WP_Customize_Image_Control class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * Customize Image Control class. + * + * @since 3.4.0 + * + * @see WP_Customize_Upload_Control + */ + class WP_Customize_Image_Control extends \WP_Customize_Upload_Control + { + /** + * Control type. + * + * @since 3.4.0 + * @var string + */ + public $type = 'image'; + /** + * Media control mime type. + * + * @since 4.1.0 + * @var string + */ + public $mime_type = 'image'; + /** + * @since 3.4.2 + * @deprecated 4.1.0 + */ + public function prepare_control() + { + } + /** + * @since 3.4.0 + * @deprecated 4.1.0 + * + * @param string $id + * @param string $label + * @param mixed $callback + */ + public function add_tab($id, $label, $callback) + { + } + /** + * @since 3.4.0 + * @deprecated 4.1.0 + * + * @param string $id + */ + public function remove_tab($id) + { + } + /** + * @since 3.4.0 + * @deprecated 4.1.0 + * + * @param string $url + * @param string $thumbnail_url + */ + public function print_tab_image($url, $thumbnail_url = \null) + { + } + } + /** + * Customize API: WP_Customize_Background_Image_Control class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * Customize Background Image Control class. + * + * @since 3.4.0 + * + * @see WP_Customize_Image_Control + */ + class WP_Customize_Background_Image_Control extends \WP_Customize_Image_Control + { + /** + * Customize control type. + * + * @since 4.1.0 + * @var string + */ + public $type = 'background'; + /** + * Constructor. + * + * @since 3.4.0 + * @uses WP_Customize_Image_Control::__construct() + * + * @param WP_Customize_Manager $manager Customizer bootstrap instance. + */ + public function __construct($manager) + { + } + /** + * Enqueue control related scripts/styles. + * + * @since 4.1.0 + */ + public function enqueue() + { + } + } + /** + * Customize API: WP_Customize_Background_Image_Setting class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * Customizer Background Image Setting class. + * + * @since 3.4.0 + * + * @see WP_Customize_Setting + */ + final class WP_Customize_Background_Image_Setting extends \WP_Customize_Setting + { + /** + * Unique string identifier for the setting. + * + * @since 3.4.0 + * @var string + */ + public $id = 'background_image_thumb'; + /** + * @since 3.4.0 + * + * @param mixed $value The value to update. Not used. + */ + public function update($value) + { + } + } + /** + * Customize API: WP_Customize_Background_Position_Control class + * + * @package WordPress + * @subpackage Customize + * @since 4.7.0 + */ + /** + * Customize Background Position Control class. + * + * @since 4.7.0 + * + * @see WP_Customize_Control + */ + class WP_Customize_Background_Position_Control extends \WP_Customize_Control + { + /** + * Type. + * + * @since 4.7.0 + * @var string + */ + public $type = 'background_position'; + /** + * Don't render the control content from PHP, as it's rendered via JS on load. + * + * @since 4.7.0 + */ + public function render_content() + { + } + /** + * Render a JS template for the content of the position control. + * + * @since 4.7.0 + */ + public function content_template() + { + } + } + /** + * Customize API: WP_Customize_Code_Editor_Control class + * + * @package WordPress + * @subpackage Customize + * @since 4.9.0 + */ + /** + * Customize Code Editor Control class. + * + * @since 4.9.0 + * + * @see WP_Customize_Control + */ + class WP_Customize_Code_Editor_Control extends \WP_Customize_Control + { + /** + * Customize control type. + * + * @since 4.9.0 + * @var string + */ + public $type = 'code_editor'; + /** + * Type of code that is being edited. + * + * @since 4.9.0 + * @var string + */ + public $code_type = ''; + /** + * Code editor settings. + * + * @see wp_enqueue_code_editor() + * @since 4.9.0 + * @var array|false + */ + public $editor_settings = array(); + /** + * Enqueue control related scripts/styles. + * + * @since 4.9.0 + */ + public function enqueue() + { + } + /** + * Refresh the parameters passed to the JavaScript via JSON. + * + * @since 4.9.0 + * + * @see WP_Customize_Control::json() + * + * @return array Array of parameters passed to the JavaScript. + */ + public function json() + { + } + /** + * Don't render the control content from PHP, as it's rendered via JS on load. + * + * @since 4.9.0 + */ + public function render_content() + { + } + /** + * Render a JS template for control display. + * + * @since 4.9.0 + */ + public function content_template() + { + } + } + /** + * Customize API: WP_Customize_Color_Control class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * Customize Color Control class. + * + * @since 3.4.0 + * + * @see WP_Customize_Control + */ + class WP_Customize_Color_Control extends \WP_Customize_Control + { + /** + * Type. + * + * @var string + */ + public $type = 'color'; + /** + * Statuses. + * + * @var array + */ + public $statuses; + /** + * Mode. + * + * @since 4.7.0 + * @var string + */ + public $mode = 'full'; + /** + * Constructor. + * + * @since 3.4.0 + * + * @see WP_Customize_Control::__construct() + * + * @param WP_Customize_Manager $manager Customizer bootstrap instance. + * @param string $id Control ID. + * @param array $args Optional. Arguments to override class property defaults. + * See WP_Customize_Control::__construct() for information + * on accepted arguments. Default empty array. + * @phpstan-param array{ + * instance_number?: int, + * manager?: WP_Customize_Manager, + * id?: string, + * settings?: array, + * setting?: string, + * capability?: string, + * priority?: int, + * section?: string, + * label?: string, + * description?: string, + * choices?: array, + * input_attrs?: array, + * allow_addition?: bool, + * json?: array, + * type?: string, + * active_callback?: callable, + * } $args See WP_Customize_Control::__construct() + */ + public function __construct($manager, $id, $args = array()) + { + } + /** + * Enqueue scripts/styles for the color picker. + * + * @since 3.4.0 + */ + public function enqueue() + { + } + /** + * Refresh the parameters passed to the JavaScript via JSON. + * + * @since 3.4.0 + * @uses WP_Customize_Control::to_json() + */ + public function to_json() + { + } + /** + * Don't render the control content from PHP, as it's rendered via JS on load. + * + * @since 3.4.0 + */ + public function render_content() + { + } + /** + * Render a JS template for the content of the color picker control. + * + * @since 4.1.0 + */ + public function content_template() + { + } + } + /** + * Customize API: WP_Customize_Cropped_Image_Control class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * Customize Cropped Image Control class. + * + * @since 4.3.0 + * + * @see WP_Customize_Image_Control + */ + class WP_Customize_Cropped_Image_Control extends \WP_Customize_Image_Control + { + /** + * Control type. + * + * @since 4.3.0 + * @var string + */ + public $type = 'cropped_image'; + /** + * Suggested width for cropped image. + * + * @since 4.3.0 + * @var int + */ + public $width = 150; + /** + * Suggested height for cropped image. + * + * @since 4.3.0 + * @var int + */ + public $height = 150; + /** + * Whether the width is flexible. + * + * @since 4.3.0 + * @var bool + */ + public $flex_width = \false; + /** + * Whether the height is flexible. + * + * @since 4.3.0 + * @var bool + */ + public $flex_height = \false; + /** + * Enqueue control related scripts/styles. + * + * @since 4.3.0 + */ + public function enqueue() + { + } + /** + * Refresh the parameters passed to the JavaScript via JSON. + * + * @since 4.3.0 + * + * @see WP_Customize_Control::to_json() + */ + public function to_json() + { + } + } + /** + * Customize API: WP_Customize_Custom_CSS_Setting class + * + * This handles validation, sanitization and saving of the value. + * + * @package WordPress + * @subpackage Customize + * @since 4.7.0 + */ + /** + * Custom Setting to handle WP Custom CSS. + * + * @since 4.7.0 + * + * @see WP_Customize_Setting + */ + final class WP_Customize_Custom_CSS_Setting extends \WP_Customize_Setting + { + /** + * The setting type. + * + * @since 4.7.0 + * @var string + */ + public $type = 'custom_css'; + /** + * Setting Transport + * + * @since 4.7.0 + * @var string + */ + public $transport = 'postMessage'; + /** + * Capability required to edit this setting. + * + * @since 4.7.0 + * @var string + */ + public $capability = 'edit_css'; + /** + * Stylesheet + * + * @since 4.7.0 + * @var string + */ + public $stylesheet = ''; + /** + * WP_Customize_Custom_CSS_Setting constructor. + * + * @since 4.7.0 + * + * @throws Exception If the setting ID does not match the pattern `custom_css[$stylesheet]`. + * + * @param WP_Customize_Manager $manager Customizer bootstrap instance. + * @param string $id A specific ID of the setting. + * Can be a theme mod or option name. + * @param array $args Setting arguments. + */ + public function __construct($manager, $id, $args = array()) + { + } + /** + * Add filter to preview post value. + * + * @since 4.7.9 + * + * @return bool False when preview short-circuits due no change needing to be previewed. + */ + public function preview() + { + } + /** + * Filters `wp_get_custom_css` for applying the customized value. + * + * This is used in the preview when `wp_get_custom_css()` is called for rendering the styles. + * + * @since 4.7.0 + * + * @see wp_get_custom_css() + * + * @param string $css Original CSS. + * @param string $stylesheet Current stylesheet. + * @return string CSS. + */ + public function filter_previewed_wp_get_custom_css($css, $stylesheet) + { + } + /** + * Fetch the value of the setting. Will return the previewed value when `preview()` is called. + * + * @since 4.7.0 + * + * @see WP_Customize_Setting::value() + * + * @return string + */ + public function value() + { + } + /** + * Validate a received value for being valid CSS. + * + * Checks for imbalanced braces, brackets, and comments. + * Notifications are rendered when the customizer state is saved. + * + * @since 4.7.0 + * @since 4.9.0 Checking for balanced characters has been moved client-side via linting in code editor. + * @since 5.9.0 Renamed `$css` to `$value` for PHP 8 named parameter support. + * + * @param string $value CSS to validate. + * @return true|WP_Error True if the input was validated, otherwise WP_Error. + */ + public function validate($value) + { + } + /** + * Store the CSS setting value in the custom_css custom post type for the stylesheet. + * + * @since 4.7.0 + * @since 5.9.0 Renamed `$css` to `$value` for PHP 8 named parameter support. + * + * @param string $value CSS to update. + * @return int|false The post ID or false if the value could not be saved. + */ + public function update($value) + { + } + } + /** + * Customize API: WP_Customize_Date_Time_Control class + * + * @package WordPress + * @subpackage Customize + * @since 4.9.0 + */ + /** + * Customize Date Time Control class. + * + * @since 4.9.0 + * + * @see WP_Customize_Control + */ + class WP_Customize_Date_Time_Control extends \WP_Customize_Control + { + /** + * Customize control type. + * + * @since 4.9.0 + * @var string + */ + public $type = 'date_time'; + /** + * Minimum Year. + * + * @since 4.9.0 + * @var int + */ + public $min_year = 1000; + /** + * Maximum Year. + * + * @since 4.9.0 + * @var int + */ + public $max_year = 9999; + /** + * Allow past date, if set to false user can only select future date. + * + * @since 4.9.0 + * @var bool + */ + public $allow_past_date = \true; + /** + * Whether hours, minutes, and meridian should be shown. + * + * @since 4.9.0 + * @var bool + */ + public $include_time = \true; + /** + * If set to false the control will appear in 24 hour format, + * the value will still be saved in Y-m-d H:i:s format. + * + * @since 4.9.0 + * @var bool + */ + public $twelve_hour_format = \true; + /** + * Don't render the control's content - it's rendered with a JS template. + * + * @since 4.9.0 + */ + public function render_content() + { + } + /** + * Export data to JS. + * + * @since 4.9.0 + * @return array + */ + public function json() + { + } + /** + * Renders a JS template for the content of date time control. + * + * @since 4.9.0 + */ + public function content_template() + { + } + /** + * Generate options for the month Select. + * + * Based on touch_time(). + * + * @since 4.9.0 + * + * @see touch_time() + * + * @global WP_Locale $wp_locale WordPress date and time locale object. + * + * @return array + */ + public function get_month_choices() + { + } + /** + * Get timezone info. + * + * @since 4.9.0 + * + * @return array { + * Timezone info. All properties are optional. + * + * @type string $abbr Timezone abbreviation. Examples: PST or CEST. + * @type string $description Human-readable timezone description as HTML. + * } + * @phpstan-return array{ + * abbr: string, + * description: string, + * } + */ + public function get_timezone_info() + { + } + /** + * Format GMT Offset. + * + * @since 4.9.0 + * + * @see wp_timezone_choice() + * + * @param float $offset Offset in hours. + * @return string Formatted offset. + */ + public function format_gmt_offset($offset) + { + } + } + /** + * Customize API: WP_Customize_Filter_Setting class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * A setting that is used to filter a value, but will not save the results. + * + * Results should be properly handled using another setting or callback. + * + * @since 3.4.0 + * + * @see WP_Customize_Setting + */ + class WP_Customize_Filter_Setting extends \WP_Customize_Setting + { + /** + * Saves the value of the setting, using the related API. + * + * @since 3.4.0 + * + * @param mixed $value The value to update. + */ + public function update($value) + { + } + } + /** + * Customize API: WP_Customize_Header_Image_Control class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * Customize Header Image Control class. + * + * @since 3.4.0 + * + * @see WP_Customize_Image_Control + */ + class WP_Customize_Header_Image_Control extends \WP_Customize_Image_Control + { + /** + * Customize control type. + * + * @since 4.2.0 + * @var string + */ + public $type = 'header'; + /** + * Uploaded header images. + * + * @since 3.9.0 + * @var string + */ + public $uploaded_headers; + /** + * Default header images. + * + * @since 3.9.0 + * @var string + */ + public $default_headers; + /** + * Constructor. + * + * @since 3.4.0 + * + * @param WP_Customize_Manager $manager Customizer bootstrap instance. + */ + public function __construct($manager) + { + } + /** + */ + public function enqueue() + { + } + /** + * @global Custom_Image_Header $custom_image_header + * @phpstan-return void + */ + public function prepare_control() + { + } + /** + */ + public function print_header_image_template() + { + } + /** + * @return string|void + */ + public function get_current_image_src() + { + } + /** + */ + public function render_content() + { + } + } + /** + * Customize API: WP_Customize_Header_Image_Setting class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * A setting that is used to filter a value, but will not save the results. + * + * Results should be properly handled using another setting or callback. + * + * @since 3.4.0 + * + * @see WP_Customize_Setting + */ + final class WP_Customize_Header_Image_Setting extends \WP_Customize_Setting + { + /** + * Unique string identifier for the setting. + * + * @since 3.4.0 + * @var string + */ + public $id = 'header_image_data'; + /** + * @since 3.4.0 + * + * @global Custom_Image_Header $custom_image_header + * + * @param mixed $value The value to update. + */ + public function update($value) + { + } + } + /** + * Customize API: WP_Customize_Nav_Menu_Auto_Add_Control class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * Customize control to represent the auto_add field for a given menu. + * + * @since 4.3.0 + * + * @see WP_Customize_Control + */ + class WP_Customize_Nav_Menu_Auto_Add_Control extends \WP_Customize_Control + { + /** + * Type of control, used by JS. + * + * @since 4.3.0 + * @var string + */ + public $type = 'nav_menu_auto_add'; + /** + * No-op since we're using JS template. + * + * @since 4.3.0 + */ + protected function render_content() + { + } + /** + * Render the Underscore template for this control. + * + * @since 4.3.0 + */ + protected function content_template() + { + } + } + /** + * Customize API: WP_Customize_Nav_Menu_Control class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * Customize Nav Menu Control Class. + * + * @since 4.3.0 + * + * @see WP_Customize_Control + */ + class WP_Customize_Nav_Menu_Control extends \WP_Customize_Control + { + /** + * Control type. + * + * @since 4.3.0 + * @var string + */ + public $type = 'nav_menu'; + /** + * Don't render the control's content - it uses a JS template instead. + * + * @since 4.3.0 + */ + public function render_content() + { + } + /** + * JS/Underscore template for the control UI. + * + * @since 4.3.0 + */ + public function content_template() + { + } + /** + * Return parameters for this control. + * + * @since 4.3.0 + * + * @return array Exported parameters. + */ + public function json() + { + } + } + /** + * Customize API: WP_Customize_Nav_Menu_Item_Control class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * Customize control to represent the name field for a given menu. + * + * @since 4.3.0 + * + * @see WP_Customize_Control + */ + class WP_Customize_Nav_Menu_Item_Control extends \WP_Customize_Control + { + /** + * Control type. + * + * @since 4.3.0 + * @var string + */ + public $type = 'nav_menu_item'; + /** + * The nav menu item setting. + * + * @since 4.3.0 + * @var WP_Customize_Nav_Menu_Item_Setting + */ + public $setting; + /** + * Constructor. + * + * @since 4.3.0 + * + * @see WP_Customize_Control::__construct() + * + * @param WP_Customize_Manager $manager Customizer bootstrap instance. + * @param string $id The control ID. + * @param array $args Optional. Arguments to override class property defaults. + * See WP_Customize_Control::__construct() for information + * on accepted arguments. Default empty array. + * @phpstan-param array{ + * instance_number?: int, + * manager?: WP_Customize_Manager, + * id?: string, + * settings?: array, + * setting?: string, + * capability?: string, + * priority?: int, + * section?: string, + * label?: string, + * description?: string, + * choices?: array, + * input_attrs?: array, + * allow_addition?: bool, + * json?: array, + * type?: string, + * active_callback?: callable, + * } $args See WP_Customize_Control::__construct() + */ + public function __construct($manager, $id, $args = array()) + { + } + /** + * Don't render the control's content - it's rendered with a JS template. + * + * @since 4.3.0 + */ + public function render_content() + { + } + /** + * JS/Underscore template for the control UI. + * + * @since 4.3.0 + */ + public function content_template() + { + } + /** + * Return parameters for this control. + * + * @since 4.3.0 + * + * @return array Exported parameters. + */ + public function json() + { + } + } + /** + * Customize API: WP_Customize_Nav_Menu_Item_Setting class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * Customize Setting to represent a nav_menu. + * + * Subclass of WP_Customize_Setting to represent a nav_menu taxonomy term, and + * the IDs for the nav_menu_items associated with the nav menu. + * + * @since 4.3.0 + * + * @see WP_Customize_Setting + */ + class WP_Customize_Nav_Menu_Item_Setting extends \WP_Customize_Setting + { + const ID_PATTERN = '/^nav_menu_item\\[(?P<id>-?\\d+)\\]$/'; + const POST_TYPE = 'nav_menu_item'; + const TYPE = 'nav_menu_item'; + /** + * Setting type. + * + * @since 4.3.0 + * @var string + */ + public $type = self::TYPE; + /** + * Default setting value. + * + * @since 4.3.0 + * @var array + * + * @see wp_setup_nav_menu_item() + */ + public $default = array( + // The $menu_item_data for wp_update_nav_menu_item(). + 'object_id' => 0, + 'object' => '', + // Taxonomy name. + 'menu_item_parent' => 0, + // A.K.A. menu-item-parent-id; note that post_parent is different, and not included. + 'position' => 0, + // A.K.A. menu_order. + 'type' => 'custom', + // Note that type_label is not included here. + 'title' => '', + 'url' => '', + 'target' => '', + 'attr_title' => '', + 'description' => '', + 'classes' => '', + 'xfn' => '', + 'status' => 'publish', + 'original_title' => '', + 'nav_menu_term_id' => 0, + // This will be supplied as the $menu_id arg for wp_update_nav_menu_item(). + '_invalid' => \false, + ); + /** + * Default transport. + * + * @since 4.3.0 + * @since 4.5.0 Default changed to 'refresh' + * @var string + */ + public $transport = 'refresh'; + /** + * The post ID represented by this setting instance. This is the db_id. + * + * A negative value represents a placeholder ID for a new menu not yet saved. + * + * @since 4.3.0 + * @var int + */ + public $post_id; + /** + * Storage of pre-setup menu item to prevent wasted calls to wp_setup_nav_menu_item(). + * + * @since 4.3.0 + * @var array|null + */ + protected $value; + /** + * Previous (placeholder) post ID used before creating a new menu item. + * + * This value will be exported to JS via the customize_save_response filter + * so that JavaScript can update the settings to refer to the newly-assigned + * post ID. This value is always negative to indicate it does not refer to + * a real post. + * + * @since 4.3.0 + * @var int + * + * @see WP_Customize_Nav_Menu_Item_Setting::update() + * @see WP_Customize_Nav_Menu_Item_Setting::amend_customize_save_response() + */ + public $previous_post_id; + /** + * When previewing or updating a menu item, this stores the previous nav_menu_term_id + * which ensures that we can apply the proper filters. + * + * @since 4.3.0 + * @var int + */ + public $original_nav_menu_term_id; + /** + * Whether or not update() was called. + * + * @since 4.3.0 + * @var bool + */ + protected $is_updated = \false; + /** + * Status for calling the update method, used in customize_save_response filter. + * + * See {@see 'customize_save_response'}. + * + * When status is inserted, the placeholder post ID is stored in $previous_post_id. + * When status is error, the error is stored in $update_error. + * + * @since 4.3.0 + * @var string updated|inserted|deleted|error + * + * @see WP_Customize_Nav_Menu_Item_Setting::update() + * @see WP_Customize_Nav_Menu_Item_Setting::amend_customize_save_response() + */ + public $update_status; + /** + * Any error object returned by wp_update_nav_menu_item() when setting is updated. + * + * @since 4.3.0 + * @var WP_Error + * + * @see WP_Customize_Nav_Menu_Item_Setting::update() + * @see WP_Customize_Nav_Menu_Item_Setting::amend_customize_save_response() + */ + public $update_error; + /** + * Constructor. + * + * Any supplied $args override class property defaults. + * + * @since 4.3.0 + * + * @throws Exception If $id is not valid for this setting type. + * + * @param WP_Customize_Manager $manager Customizer bootstrap instance. + * @param string $id A specific ID of the setting. + * Can be a theme mod or option name. + * @param array $args Optional. Setting arguments. + */ + public function __construct(\WP_Customize_Manager $manager, $id, array $args = array()) + { + } + /** + * Clear the cached value when this nav menu item is updated. + * + * @since 4.3.0 + * + * @param int $menu_id The term ID for the menu. + * @param int $menu_item_id The post ID for the menu item. + */ + public function flush_cached_value($menu_id, $menu_item_id) + { + } + /** + * Get the instance data for a given nav_menu_item setting. + * + * @since 4.3.0 + * + * @see wp_setup_nav_menu_item() + * + * @return array|false Instance data array, or false if the item is marked for deletion. + */ + public function value() + { + } + /** + * Get original title. + * + * @since 4.7.0 + * + * @param object $item Nav menu item. + * @return string The original title. + */ + protected function get_original_title($item) + { + } + /** + * Get type label. + * + * @since 4.7.0 + * + * @param object $item Nav menu item. + * @return string The type label. + */ + protected function get_type_label($item) + { + } + /** + * Ensure that the value is fully populated with the necessary properties. + * + * Translates some properties added by wp_setup_nav_menu_item() and removes others. + * + * @since 4.3.0 + * + * @see WP_Customize_Nav_Menu_Item_Setting::value() + * @phpstan-return void + */ + protected function populate_value() + { + } + /** + * Handle previewing the setting. + * + * @since 4.3.0 + * @since 4.4.0 Added boolean return value. + * + * @see WP_Customize_Manager::post_value() + * + * @return bool False if method short-circuited due to no-op. + */ + public function preview() + { + } + /** + * Filters the wp_get_nav_menu_items() result to supply the previewed menu items. + * + * @since 4.3.0 + * + * @see wp_get_nav_menu_items() + * + * @param WP_Post[] $items An array of menu item post objects. + * @param WP_Term $menu The menu object. + * @param array $args An array of arguments used to retrieve menu item objects. + * @return WP_Post[] Array of menu item objects. + */ + public function filter_wp_get_nav_menu_items($items, $menu, $args) + { + } + /** + * Re-apply the tail logic also applied on $items by wp_get_nav_menu_items(). + * + * @since 4.3.0 + * + * @see wp_get_nav_menu_items() + * + * @param WP_Post[] $items An array of menu item post objects. + * @param WP_Term $menu The menu object. + * @param array $args An array of arguments used to retrieve menu item objects. + * @return WP_Post[] Array of menu item objects. + */ + public static function sort_wp_get_nav_menu_items($items, $menu, $args) + { + } + /** + * Get the value emulated into a WP_Post and set up as a nav_menu_item. + * + * @since 4.3.0 + * + * @return WP_Post With wp_setup_nav_menu_item() applied. + */ + public function value_as_wp_post_nav_menu_item() + { + } + /** + * Sanitize an input. + * + * Note that parent::sanitize() erroneously does wp_unslash() on $value, but + * we remove that in this override. + * + * @since 4.3.0 + * @since 5.9.0 Renamed `$menu_item_value` to `$value` for PHP 8 named parameter support. + * + * @param array $value The menu item value to sanitize. + * @return array|false|null|WP_Error Null or WP_Error if an input isn't valid. False if it is marked for deletion. + * Otherwise the sanitized value. + */ + public function sanitize($value) + { + } + /** + * Creates/updates the nav_menu_item post for this setting. + * + * Any created menu items will have their assigned post IDs exported to the client + * via the {@see 'customize_save_response'} filter. Likewise, any errors will be + * exported to the client via the customize_save_response() filter. + * + * To delete a menu, the client can send false as the value. + * + * @since 4.3.0 + * + * @see wp_update_nav_menu_item() + * + * @param array|false $value The menu item array to update. If false, then the menu item will be deleted + * entirely. See WP_Customize_Nav_Menu_Item_Setting::$default for what the value + * should consist of. + * @return null|void + * @phpstan-return void + */ + protected function update($value) + { + } + /** + * Export data for the JS client. + * + * @since 4.3.0 + * + * @see WP_Customize_Nav_Menu_Item_Setting::update() + * + * @param array $data Additional information passed back to the 'saved' event on `wp.customize`. + * @return array Save response data. + */ + public function amend_customize_save_response($data) + { + } + } + /** + * Customize API: WP_Customize_Nav_Menu_Location_Control class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * Customize Menu Location Control Class. + * + * This custom control is only needed for JS. + * + * @since 4.3.0 + * + * @see WP_Customize_Control + */ + class WP_Customize_Nav_Menu_Location_Control extends \WP_Customize_Control + { + /** + * Control type. + * + * @since 4.3.0 + * @var string + */ + public $type = 'nav_menu_location'; + /** + * Location ID. + * + * @since 4.3.0 + * @var string + */ + public $location_id = ''; + /** + * Refresh the parameters passed to JavaScript via JSON. + * + * @since 4.3.0 + * + * @see WP_Customize_Control::to_json() + */ + public function to_json() + { + } + /** + * Render content just like a normal select control. + * + * @since 4.3.0 + * @since 4.9.0 Added a button to create menus. + * @phpstan-return void + */ + public function render_content() + { + } + } + /** + * Customize API: WP_Customize_Nav_Menu_Locations_Control class + * + * @package WordPress + * @subpackage Customize + * @since 4.9.0 + */ + /** + * Customize Nav Menu Locations Control Class. + * + * @since 4.9.0 + * + * @see WP_Customize_Control + */ + class WP_Customize_Nav_Menu_Locations_Control extends \WP_Customize_Control + { + /** + * Control type. + * + * @since 4.9.0 + * @var string + */ + public $type = 'nav_menu_locations'; + /** + * Don't render the control's content - it uses a JS template instead. + * + * @since 4.9.0 + */ + public function render_content() + { + } + /** + * JS/Underscore template for the control UI. + * + * @since 4.9.0 + */ + public function content_template() + { + } + } + /** + * Customize API: WP_Customize_Nav_Menu_Name_Control class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * Customize control to represent the name field for a given menu. + * + * @since 4.3.0 + * + * @see WP_Customize_Control + */ + class WP_Customize_Nav_Menu_Name_Control extends \WP_Customize_Control + { + /** + * Type of control, used by JS. + * + * @since 4.3.0 + * @var string + */ + public $type = 'nav_menu_name'; + /** + * No-op since we're using JS template. + * + * @since 4.3.0 + */ + protected function render_content() + { + } + /** + * Render the Underscore template for this control. + * + * @since 4.3.0 + */ + protected function content_template() + { + } + } + /** + * Customize API: WP_Customize_Nav_Menu_Section class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * Customize Menu Section Class + * + * Custom section only needed in JS. + * + * @since 4.3.0 + * + * @see WP_Customize_Section + */ + class WP_Customize_Nav_Menu_Section extends \WP_Customize_Section + { + /** + * Control type. + * + * @since 4.3.0 + * @var string + */ + public $type = 'nav_menu'; + /** + * Get section parameters for JS. + * + * @since 4.3.0 + * @return array Exported parameters. + */ + public function json() + { + } + } + /** + * Customize API: WP_Customize_Nav_Menu_Setting class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * Customize Setting to represent a nav_menu. + * + * Subclass of WP_Customize_Setting to represent a nav_menu taxonomy term, and + * the IDs for the nav_menu_items associated with the nav menu. + * + * @since 4.3.0 + * + * @see wp_get_nav_menu_object() + * @see WP_Customize_Setting + */ + class WP_Customize_Nav_Menu_Setting extends \WP_Customize_Setting + { + const ID_PATTERN = '/^nav_menu\\[(?P<id>-?\\d+)\\]$/'; + const TAXONOMY = 'nav_menu'; + const TYPE = 'nav_menu'; + /** + * Setting type. + * + * @since 4.3.0 + * @var string + */ + public $type = self::TYPE; + /** + * Default setting value. + * + * @since 4.3.0 + * @var array + * + * @see wp_get_nav_menu_object() + */ + public $default = array('name' => '', 'description' => '', 'parent' => 0, 'auto_add' => \false); + /** + * Default transport. + * + * @since 4.3.0 + * @var string + */ + public $transport = 'postMessage'; + /** + * The term ID represented by this setting instance. + * + * A negative value represents a placeholder ID for a new menu not yet saved. + * + * @since 4.3.0 + * @var int + */ + public $term_id; + /** + * Previous (placeholder) term ID used before creating a new menu. + * + * This value will be exported to JS via the {@see 'customize_save_response'} filter + * so that JavaScript can update the settings to refer to the newly-assigned + * term ID. This value is always negative to indicate it does not refer to + * a real term. + * + * @since 4.3.0 + * @var int + * + * @see WP_Customize_Nav_Menu_Setting::update() + * @see WP_Customize_Nav_Menu_Setting::amend_customize_save_response() + */ + public $previous_term_id; + /** + * Whether or not update() was called. + * + * @since 4.3.0 + * @var bool + */ + protected $is_updated = \false; + /** + * Status for calling the update method, used in customize_save_response filter. + * + * See {@see 'customize_save_response'}. + * + * When status is inserted, the placeholder term ID is stored in `$previous_term_id`. + * When status is error, the error is stored in `$update_error`. + * + * @since 4.3.0 + * @var string updated|inserted|deleted|error + * + * @see WP_Customize_Nav_Menu_Setting::update() + * @see WP_Customize_Nav_Menu_Setting::amend_customize_save_response() + */ + public $update_status; + /** + * Any error object returned by wp_update_nav_menu_object() when setting is updated. + * + * @since 4.3.0 + * @var WP_Error + * + * @see WP_Customize_Nav_Menu_Setting::update() + * @see WP_Customize_Nav_Menu_Setting::amend_customize_save_response() + */ + public $update_error; + /** + * Constructor. + * + * Any supplied $args override class property defaults. + * + * @since 4.3.0 + * + * @throws Exception If $id is not valid for this setting type. + * + * @param WP_Customize_Manager $manager Customizer bootstrap instance. + * @param string $id A specific ID of the setting. + * Can be a theme mod or option name. + * @param array $args Optional. Setting arguments. + */ + public function __construct(\WP_Customize_Manager $manager, $id, array $args = array()) + { + } + /** + * Get the instance data for a given widget setting. + * + * @since 4.3.0 + * + * @see wp_get_nav_menu_object() + * + * @return array Instance data. + */ + public function value() + { + } + /** + * Handle previewing the setting. + * + * @since 4.3.0 + * @since 4.4.0 Added boolean return value + * + * @see WP_Customize_Manager::post_value() + * + * @return bool False if method short-circuited due to no-op. + */ + public function preview() + { + } + /** + * Filters the wp_get_nav_menus() result to ensure the inserted menu object is included, and the deleted one is removed. + * + * @since 4.3.0 + * + * @see wp_get_nav_menus() + * + * @param WP_Term[] $menus An array of menu objects. + * @param array $args An array of arguments used to retrieve menu objects. + * @return WP_Term[] Array of menu objects. + */ + public function filter_wp_get_nav_menus($menus, $args) + { + } + /** + * Temporary non-closure passing of orderby value to function. + * + * @since 4.3.0 + * @var string + * + * @see WP_Customize_Nav_Menu_Setting::filter_wp_get_nav_menus() + * @see WP_Customize_Nav_Menu_Setting::_sort_menus_by_orderby() + */ + protected $_current_menus_sort_orderby; + /** + * Sort menu objects by the class-supplied orderby property. + * + * This is a workaround for a lack of closures. + * + * @since 4.3.0 + * @deprecated 4.7.0 Use wp_list_sort() + * + * @param object $menu1 + * @param object $menu2 + * @return int + * + * @see WP_Customize_Nav_Menu_Setting::filter_wp_get_nav_menus() + */ + protected function _sort_menus_by_orderby($menu1, $menu2) + { + } + /** + * Filters the wp_get_nav_menu_object() result to supply the previewed menu object. + * + * Requesting a nav_menu object by anything but ID is not supported. + * + * @since 4.3.0 + * + * @see wp_get_nav_menu_object() + * + * @param object|null $menu_obj Object returned by wp_get_nav_menu_object(). + * @param string $menu_id ID of the nav_menu term. Requests by slug or name will be ignored. + * @return object|null + */ + public function filter_wp_get_nav_menu_object($menu_obj, $menu_id) + { + } + /** + * Filters the nav_menu_options option to include this menu's auto_add preference. + * + * @since 4.3.0 + * + * @param array $nav_menu_options Nav menu options including auto_add. + * @return array (Maybe) modified nav menu options. + */ + public function filter_nav_menu_options($nav_menu_options) + { + } + /** + * Sanitize an input. + * + * Note that parent::sanitize() erroneously does wp_unslash() on $value, but + * we remove that in this override. + * + * @since 4.3.0 + * + * @param array $value The menu value to sanitize. + * @return array|false|null Null if an input isn't valid. False if it is marked for deletion. + * Otherwise the sanitized value. + */ + public function sanitize($value) + { + } + /** + * Storage for data to be sent back to client in customize_save_response filter. + * + * See {@see 'customize_save_response'}. + * + * @since 4.3.0 + * @var array + * + * @see WP_Customize_Nav_Menu_Setting::amend_customize_save_response() + */ + protected $_widget_nav_menu_updates = array(); + /** + * Create/update the nav_menu term for this setting. + * + * Any created menus will have their assigned term IDs exported to the client + * via the {@see 'customize_save_response'} filter. Likewise, any errors will be exported + * to the client via the customize_save_response() filter. + * + * To delete a menu, the client can send false as the value. + * + * @since 4.3.0 + * + * @see wp_update_nav_menu_object() + * + * @param array|false $value { + * The value to update. Note that slug cannot be updated via wp_update_nav_menu_object(). + * If false, then the menu will be deleted entirely. + * + * @type string $name The name of the menu to save. + * @type string $description The term description. Default empty string. + * @type int $parent The id of the parent term. Default 0. + * @type bool $auto_add Whether pages will auto_add to this menu. Default false. + * } + * @return null|void + * @phpstan-param false|array{ + * name?: string, + * description?: string, + * parent?: int, + * auto_add?: bool, + * } $value + * @phpstan-return void + */ + protected function update($value) + { + } + /** + * Updates a nav_menu_options array. + * + * @since 4.3.0 + * + * @see WP_Customize_Nav_Menu_Setting::filter_nav_menu_options() + * @see WP_Customize_Nav_Menu_Setting::update() + * + * @param array $nav_menu_options Array as returned by get_option( 'nav_menu_options' ). + * @param int $menu_id The term ID for the given menu. + * @param bool $auto_add Whether to auto-add or not. + * @return array (Maybe) modified nav_menu_options array. + */ + protected function filter_nav_menu_options_value($nav_menu_options, $menu_id, $auto_add) + { + } + /** + * Export data for the JS client. + * + * @since 4.3.0 + * + * @see WP_Customize_Nav_Menu_Setting::update() + * + * @param array $data Additional information passed back to the 'saved' event on `wp.customize`. + * @return array Export data. + */ + public function amend_customize_save_response($data) + { + } + } + /** + * Customize API: WP_Customize_Nav_Menus_Panel class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * Customize Nav Menus Panel Class + * + * Needed to add screen options. + * + * @since 4.3.0 + * + * @see WP_Customize_Panel + */ + class WP_Customize_Nav_Menus_Panel extends \WP_Customize_Panel + { + /** + * Control type. + * + * @since 4.3.0 + * @var string + */ + public $type = 'nav_menus'; + /** + * Render screen options for Menus. + * + * @since 4.3.0 + */ + public function render_screen_options() + { + } + /** + * Returns the advanced options for the nav menus page. + * + * Link title attribute added as it's a relatively advanced concept for new users. + * + * @since 4.3.0 + * @deprecated 4.5.0 Deprecated in favor of wp_nav_menu_manage_columns(). + */ + public function wp_nav_menu_manage_columns() + { + } + /** + * An Underscore (JS) template for this panel's content (but not its container). + * + * Class variables for this panel class are available in the `data` JS object; + * export custom variables by overriding WP_Customize_Panel::json(). + * + * @since 4.3.0 + * + * @see WP_Customize_Panel::print_template() + */ + protected function content_template() + { + } + } + /** + * Customize control class for new menus. + * + * @since 4.3.0 + * @deprecated 4.9.0 This class is no longer used as of the menu creation UX introduced in #40104. + * + * @see WP_Customize_Control + */ + class WP_Customize_New_Menu_Control extends \WP_Customize_Control + { + /** + * Control type. + * + * @since 4.3.0 + * @var string + */ + public $type = 'new_menu'; + /** + * Constructor. + * + * @since 4.9.0 + * @deprecated 4.9.0 + * + * @see WP_Customize_Control::__construct() + * + * @param WP_Customize_Manager $manager Customizer bootstrap instance. + * @param string $id The control ID. + * @param array $args Optional. Arguments to override class property defaults. + * See WP_Customize_Control::__construct() for information + * on accepted arguments. Default empty array. + * @phpstan-param array{ + * instance_number?: int, + * manager?: WP_Customize_Manager, + * id?: string, + * settings?: array, + * setting?: string, + * capability?: string, + * priority?: int, + * section?: string, + * label?: string, + * description?: string, + * choices?: array, + * input_attrs?: array, + * allow_addition?: bool, + * json?: array, + * type?: string, + * active_callback?: callable, + * } $args See WP_Customize_Control::__construct() + */ + public function __construct(\WP_Customize_Manager $manager, $id, array $args = array()) + { + } + /** + * Render the control's content. + * + * @since 4.3.0 + * @deprecated 4.9.0 + */ + public function render_content() + { + } + } + /** + * Customize Menu Section Class + * + * @since 4.3.0 + * @deprecated 4.9.0 This class is no longer used as of the menu creation UX introduced in #40104. + * + * @see WP_Customize_Section + */ + class WP_Customize_New_Menu_Section extends \WP_Customize_Section + { + /** + * Control type. + * + * @since 4.3.0 + * @var string + */ + public $type = 'new_menu'; + /** + * Constructor. + * + * Any supplied $args override class property defaults. + * + * @since 4.9.0 + * @deprecated 4.9.0 + * + * @param WP_Customize_Manager $manager Customizer bootstrap instance. + * @param string $id A specific ID of the section. + * @param array $args Section arguments. + */ + public function __construct(\WP_Customize_Manager $manager, $id, array $args = array()) + { + } + /** + * Render the section, and the controls that have been added to it. + * + * @since 4.3.0 + * @deprecated 4.9.0 + */ + protected function render() + { + } + } + /** + * Customize API: WP_Customize_Partial class + * + * @package WordPress + * @subpackage Customize + * @since 4.5.0 + */ + /** + * Core Customizer class for implementing selective refresh partials. + * + * Representation of a rendered region in the previewed page that gets + * selectively refreshed when an associated setting is changed. + * This class is analogous of WP_Customize_Control. + * + * @since 4.5.0 + */ + #[\AllowDynamicProperties] + class WP_Customize_Partial + { + /** + * Component. + * + * @since 4.5.0 + * @var WP_Customize_Selective_Refresh + */ + public $component; + /** + * Unique identifier for the partial. + * + * If the partial is used to display a single setting, this would generally + * be the same as the associated setting's ID. + * + * @since 4.5.0 + * @var string + */ + public $id; + /** + * Parsed ID. + * + * @since 4.5.0 + * @var array { + * @type string $base ID base. + * @type array $keys Keys for multidimensional. + * } + * @phpstan-var array{ + * base: string, + * keys: array, + * } + */ + protected $id_data = array(); + /** + * Type of this partial. + * + * @since 4.5.0 + * @var string + */ + public $type = 'default'; + /** + * The jQuery selector to find the container element for the partial. + * + * @since 4.5.0 + * @var string + */ + public $selector; + /** + * IDs for settings tied to the partial. + * + * @since 4.5.0 + * @var string[] + */ + public $settings; + /** + * The ID for the setting that this partial is primarily responsible for rendering. + * + * If not supplied, it will default to the ID of the first setting. + * + * @since 4.5.0 + * @var string + */ + public $primary_setting; + /** + * Capability required to edit this partial. + * + * Normally this is empty and the capability is derived from the capabilities + * of the associated `$settings`. + * + * @since 4.5.0 + * @var string + */ + public $capability; + /** + * Render callback. + * + * @since 4.5.0 + * + * @see WP_Customize_Partial::render() + * @var callable Callback is called with one argument, the instance of + * WP_Customize_Partial. The callback can either echo the + * partial or return the partial as a string, or return false if error. + */ + public $render_callback; + /** + * Whether the container element is included in the partial, or if only the contents are rendered. + * + * @since 4.5.0 + * @var bool + */ + public $container_inclusive = \false; + /** + * Whether to refresh the entire preview in case a partial cannot be refreshed. + * + * A partial render is considered a failure if the render_callback returns false. + * + * @since 4.5.0 + * @var bool + */ + public $fallback_refresh = \true; + /** + * Constructor. + * + * Supplied `$args` override class property defaults. + * + * If `$args['settings']` is not defined, use the $id as the setting ID. + * + * @since 4.5.0 + * + * @param WP_Customize_Selective_Refresh $component Customize Partial Refresh plugin instance. + * @param string $id Control ID. + * @param array $args { + * Optional. Array of properties for the new Partials object. Default empty array. + * + * @type string $type Type of the partial to be created. + * @type string $selector The jQuery selector to find the container element for the partial, that is, + * a partial's placement. + * @type string[] $settings IDs for settings tied to the partial. If undefined, `$id` will be used. + * @type string $primary_setting The ID for the setting that this partial is primarily responsible for + * rendering. If not supplied, it will default to the ID of the first setting. + * @type string $capability Capability required to edit this partial. + * Normally this is empty and the capability is derived from the capabilities + * of the associated `$settings`. + * @type callable $render_callback Render callback. + * Callback is called with one argument, the instance of WP_Customize_Partial. + * The callback can either echo the partial or return the partial as a string, + * or return false if error. + * @type bool $container_inclusive Whether the container element is included in the partial, or if only + * the contents are rendered. + * @type bool $fallback_refresh Whether to refresh the entire preview in case a partial cannot be refreshed. + * A partial render is considered a failure if the render_callback returns + * false. + * } + * @phpstan-param array{ + * type?: string, + * selector?: string, + * settings?: string[], + * primary_setting?: string, + * capability?: string, + * render_callback?: callable, + * container_inclusive?: bool, + * fallback_refresh?: bool, + * } $args + */ + public function __construct(\WP_Customize_Selective_Refresh $component, $id, $args = array()) + { + } + /** + * Retrieves parsed ID data for multidimensional setting. + * + * @since 4.5.0 + * + * @return array { + * ID data for multidimensional partial. + * + * @type string $base ID base. + * @type array $keys Keys for multidimensional array. + * } + * @phpstan-return array{ + * base: string, + * keys: array, + * } + */ + public final function id_data() + { + } + /** + * Renders the template partial involving the associated settings. + * + * @since 4.5.0 + * + * @param array $container_context Optional. Array of context data associated with the target container (placement). + * Default empty array. + * @return string|array|false The rendered partial as a string, raw data array (for client-side JS template), + * or false if no render applied. + */ + public final function render($container_context = array()) + { + } + /** + * Default callback used when invoking WP_Customize_Control::render(). + * + * Note that this method may echo the partial *or* return the partial as + * a string or array, but not both. Output buffering is performed when this + * is called. Subclasses can override this with their specific logic, or they + * may provide an 'render_callback' argument to the constructor. + * + * This method may return an HTML string for straight DOM injection, or it + * may return an array for supporting Partial JS subclasses to render by + * applying to client-side templating. + * + * @since 4.5.0 + * + * @param WP_Customize_Partial $partial Partial. + * @param array $context Context. + * @return string|array|false + */ + public function render_callback(\WP_Customize_Partial $partial, $context = array()) + { + } + /** + * Retrieves the data to export to the client via JSON. + * + * @since 4.5.0 + * + * @return array Array of parameters passed to the JavaScript. + */ + public function json() + { + } + /** + * Checks if the user can refresh this partial. + * + * Returns false if the user cannot manipulate one of the associated settings, + * or if one of the associated settings does not exist. + * + * @since 4.5.0 + * + * @return bool False if user can't edit one of the related settings, + * or if one of the associated settings does not exist. + */ + public final function check_capabilities() + { + } + } + /** + * Customize API: WP_Customize_Selective_Refresh class + * + * @package WordPress + * @subpackage Customize + * @since 4.5.0 + */ + /** + * Core Customizer class for implementing selective refresh. + * + * @since 4.5.0 + */ + #[\AllowDynamicProperties] + final class WP_Customize_Selective_Refresh + { + /** + * Query var used in requests to render partials. + * + * @since 4.5.0 + */ + const RENDER_QUERY_VAR = 'wp_customize_render_partials'; + /** + * Customize manager. + * + * @since 4.5.0 + * @var WP_Customize_Manager + */ + public $manager; + /** + * Plugin bootstrap for Partial Refresh functionality. + * + * @since 4.5.0 + * + * @param WP_Customize_Manager $manager Customizer bootstrap instance. + */ + public function __construct(\WP_Customize_Manager $manager) + { + } + /** + * Retrieves the registered partials. + * + * @since 4.5.0 + * + * @return array Partials. + */ + public function partials() + { + } + /** + * Adds a partial. + * + * @since 4.5.0 + * + * @see WP_Customize_Partial::__construct() + * + * @param WP_Customize_Partial|string $id Customize Partial object, or Partial ID. + * @param array $args Optional. Array of properties for the new Partials object. + * See WP_Customize_Partial::__construct() for information + * on accepted arguments. Default empty array. + * @return WP_Customize_Partial The instance of the partial that was added. + * @phpstan-param array{ + * type?: string, + * selector?: string, + * settings?: string[], + * primary_setting?: string, + * capability?: string, + * render_callback?: callable, + * container_inclusive?: bool, + * fallback_refresh?: bool, + * } $args See WP_Customize_Partial::__construct() + */ + public function add_partial($id, $args = array()) + { + } + /** + * Retrieves a partial. + * + * @since 4.5.0 + * + * @param string $id Customize Partial ID. + * @return WP_Customize_Partial|null The partial, if set. Otherwise null. + */ + public function get_partial($id) + { + } + /** + * Removes a partial. + * + * @since 4.5.0 + * + * @param string $id Customize Partial ID. + */ + public function remove_partial($id) + { + } + /** + * Initializes the Customizer preview. + * + * @since 4.5.0 + */ + public function init_preview() + { + } + /** + * Enqueues preview scripts. + * + * @since 4.5.0 + */ + public function enqueue_preview_scripts() + { + } + /** + * Exports data in preview after it has finished rendering so that partials can be added at runtime. + * + * @since 4.5.0 + */ + public function export_preview_data() + { + } + /** + * Registers dynamically-created partials. + * + * @since 4.5.0 + * + * @see WP_Customize_Manager::add_dynamic_settings() + * + * @param string[] $partial_ids Array of the partial IDs to add. + * @return WP_Customize_Partial[] Array of added WP_Customize_Partial instances. + */ + public function add_dynamic_partials($partial_ids) + { + } + /** + * Checks whether the request is for rendering partials. + * + * Note that this will not consider whether the request is authorized or valid, + * just that essentially the route is a match. + * + * @since 4.5.0 + * + * @return bool Whether the request is for rendering partials. + */ + public function is_render_partials_request() + { + } + /** + * Handles PHP errors triggered during rendering the partials. + * + * These errors will be relayed back to the client in the Ajax response. + * + * @since 4.5.0 + * + * @param int $errno Error number. + * @param string $errstr Error string. + * @param string $errfile Error file. + * @param int $errline Error line. + * @return true Always true. + */ + public function handle_error($errno, $errstr, $errfile = \null, $errline = \null) + { + } + /** + * Handles the Ajax request to return the rendered partials for the requested placements. + * + * @since 4.5.0 + * @phpstan-return void + */ + public function handle_render_partials_request() + { + } + } + /** + * Customize API: WP_Customize_Sidebar_Section class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * Customizer section representing widget area (sidebar). + * + * @since 4.1.0 + * + * @see WP_Customize_Section + */ + class WP_Customize_Sidebar_Section extends \WP_Customize_Section + { + /** + * Type of this section. + * + * @since 4.1.0 + * @var string + */ + public $type = 'sidebar'; + /** + * Unique identifier. + * + * @since 4.1.0 + * @var string + */ + public $sidebar_id; + /** + * Gather the parameters passed to client JavaScript via JSON. + * + * @since 4.1.0 + * + * @return array The array to be exported to the client as JSON. + */ + public function json() + { + } + /** + * Whether the current sidebar is rendered on the page. + * + * @since 4.1.0 + * + * @return bool Whether sidebar is rendered. + */ + public function active_callback() + { + } + } + /** + * Customize API: WP_Customize_Site_Icon_Control class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * Customize Site Icon control class. + * + * Used only for custom functionality in JavaScript. + * + * @since 4.3.0 + * + * @see WP_Customize_Cropped_Image_Control + */ + class WP_Customize_Site_Icon_Control extends \WP_Customize_Cropped_Image_Control + { + /** + * Control type. + * + * @since 4.3.0 + * @var string + */ + public $type = 'site_icon'; + /** + * Constructor. + * + * @since 4.3.0 + * + * @see WP_Customize_Control::__construct() + * + * @param WP_Customize_Manager $manager Customizer bootstrap instance. + * @param string $id Control ID. + * @param array $args Optional. Arguments to override class property defaults. + * See WP_Customize_Control::__construct() for information + * on accepted arguments. Default empty array. + * @phpstan-param array{ + * instance_number?: int, + * manager?: WP_Customize_Manager, + * id?: string, + * settings?: array, + * setting?: string, + * capability?: string, + * priority?: int, + * section?: string, + * label?: string, + * description?: string, + * choices?: array, + * input_attrs?: array, + * allow_addition?: bool, + * json?: array, + * type?: string, + * active_callback?: callable, + * } $args See WP_Customize_Control::__construct() + */ + public function __construct($manager, $id, $args = array()) + { + } + /** + * Renders a JS template for the content of the site icon control. + * + * @since 4.5.0 + */ + public function content_template() + { + } + } + /** + * Customize API: WP_Customize_Theme_Control class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * Customize Theme Control class. + * + * @since 4.2.0 + * + * @see WP_Customize_Control + */ + class WP_Customize_Theme_Control extends \WP_Customize_Control + { + /** + * Customize control type. + * + * @since 4.2.0 + * @var string + */ + public $type = 'theme'; + /** + * Theme object. + * + * @since 4.2.0 + * @var WP_Theme + */ + public $theme; + /** + * Refresh the parameters passed to the JavaScript via JSON. + * + * @since 4.2.0 + * + * @see WP_Customize_Control::to_json() + */ + public function to_json() + { + } + /** + * Don't render the control content from PHP, as it's rendered via JS on load. + * + * @since 4.2.0 + */ + public function render_content() + { + } + /** + * Render a JS template for theme display. + * + * @since 4.2.0 + */ + public function content_template() + { + } + } + /** + * Customize API: WP_Customize_Themes_Panel class + * + * @package WordPress + * @subpackage Customize + * @since 4.9.0 + */ + /** + * Customize Themes Panel Class + * + * @since 4.9.0 + * + * @see WP_Customize_Panel + */ + class WP_Customize_Themes_Panel extends \WP_Customize_Panel + { + /** + * Panel type. + * + * @since 4.9.0 + * @var string + */ + public $type = 'themes'; + /** + * An Underscore (JS) template for rendering this panel's container. + * + * The themes panel renders a custom panel heading with the active theme and a switch themes button. + * + * @see WP_Customize_Panel::print_template() + * + * @since 4.9.0 + */ + protected function render_template() + { + } + /** + * An Underscore (JS) template for this panel's content (but not its container). + * + * Class variables for this panel class are available in the `data` JS object; + * export custom variables by overriding WP_Customize_Panel::json(). + * + * @since 4.9.0 + * + * @see WP_Customize_Panel::print_template() + */ + protected function content_template() + { + } + } + /** + * Customize API: WP_Customize_Themes_Section class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * Customize Themes Section class. + * + * A UI container for theme controls, which are displayed within sections. + * + * @since 4.2.0 + * + * @see WP_Customize_Section + */ + class WP_Customize_Themes_Section extends \WP_Customize_Section + { + /** + * Section type. + * + * @since 4.2.0 + * @var string + */ + public $type = 'themes'; + /** + * Theme section action. + * + * Defines the type of themes to load (installed, wporg, etc.). + * + * @since 4.9.0 + * @var string + */ + public $action = ''; + /** + * Theme section filter type. + * + * Determines whether filters are applied to loaded (local) themes or by initiating a new remote query (remote). + * When filtering is local, the initial themes query is not paginated by default. + * + * @since 4.9.0 + * @var string + */ + public $filter_type = 'local'; + /** + * Gets section parameters for JS. + * + * @since 4.9.0 + * @return array Exported parameters. + */ + public function json() + { + } + /** + * Renders a themes section as a JS template. + * + * The template is only rendered by PHP once, so all actions are prepared at once on the server side. + * + * @since 4.9.0 + */ + protected function render_template() + { + } + /** + * Renders the filter bar portion of a themes section as a JS template. + * + * The template is only rendered by PHP once, so all actions are prepared at once on the server side. + * The filter bar container is rendered by {@see render_template()}. + * + * @since 4.9.0 + */ + protected function filter_bar_content_template() + { + } + /** + * Renders the filter drawer portion of a themes section as a JS template. + * + * The filter bar container is rendered by {@see render_template()}. + * + * @since 4.9.0 + */ + protected function filter_drawer_content_template() + { + } + } + /** + * Customize API: WP_Sidebar_Block_Editor_Control class. + * + * @package WordPress + * @subpackage Customize + * @since 5.8.0 + */ + /** + * Core class used to implement the widgets block editor control in the + * customizer. + * + * @since 5.8.0 + * + * @see WP_Customize_Control + */ + class WP_Sidebar_Block_Editor_Control extends \WP_Customize_Control + { + /** + * The control type. + * + * @since 5.8.0 + * + * @var string + */ + public $type = 'sidebar_block_editor'; + /** + * Render the widgets block editor container. + * + * @since 5.8.0 + */ + public function render_content() + { + } + } + /** + * Customize API: WP_Widget_Area_Customize_Control class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * Widget Area Customize Control class. + * + * @since 3.9.0 + * + * @see WP_Customize_Control + */ + class WP_Widget_Area_Customize_Control extends \WP_Customize_Control + { + /** + * Customize control type. + * + * @since 3.9.0 + * @var string + */ + public $type = 'sidebar_widgets'; + /** + * Sidebar ID. + * + * @since 3.9.0 + * @var int|string + */ + public $sidebar_id; + /** + * Refreshes the parameters passed to the JavaScript via JSON. + * + * @since 3.9.0 + */ + public function to_json() + { + } + /** + * Renders the control's content. + * + * @since 3.9.0 + */ + public function render_content() + { + } + } + /** + * Customize API: WP_Widget_Form_Customize_Control class + * + * @package WordPress + * @subpackage Customize + * @since 4.4.0 + */ + /** + * Widget Form Customize Control class. + * + * @since 3.9.0 + * + * @see WP_Customize_Control + */ + class WP_Widget_Form_Customize_Control extends \WP_Customize_Control + { + /** + * Customize control type. + * + * @since 3.9.0 + * @var string + */ + public $type = 'widget_form'; + /** + * Widget ID. + * + * @since 3.9.0 + * @var string + */ + public $widget_id; + /** + * Widget ID base. + * + * @since 3.9.0 + * @var string + */ + public $widget_id_base; + /** + * Sidebar ID. + * + * @since 3.9.0 + * @var string + */ + public $sidebar_id; + /** + * Widget status. + * + * @since 3.9.0 + * @var bool True if new, false otherwise. Default false. + */ + public $is_new = \false; + /** + * Widget width. + * + * @since 3.9.0 + * @var int + */ + public $width; + /** + * Widget height. + * + * @since 3.9.0 + * @var int + */ + public $height; + /** + * Widget mode. + * + * @since 3.9.0 + * @var bool True if wide, false otherwise. Default false. + */ + public $is_wide = \false; + /** + * Gather control params for exporting to JavaScript. + * + * @since 3.9.0 + * + * @global array $wp_registered_widgets + */ + public function to_json() + { + } + /** + * Override render_content to be no-op since content is exported via to_json for deferred embedding. + * + * @since 3.9.0 + */ + public function render_content() + { + } + /** + * Whether the current widget is rendered on the page. + * + * @since 4.0.0 + * + * @return bool Whether the widget is rendered. + */ + public function active_callback() + { + } + } + /** + * Font Collection class. + * + * This file contains the Font Collection class definition. + * + * @package WordPress + * @subpackage Fonts + * @since 6.5.0 + */ + /** + * Font Collection class. + * + * @since 6.5.0 + * + * @see wp_register_font_collection() + */ + final class WP_Font_Collection + { + /** + * The unique slug for the font collection. + * + * @since 6.5.0 + * @var string + */ + public $slug; + /** + * WP_Font_Collection constructor. + * + * @since 6.5.0 + * + * @param string $slug Font collection slug. May only contain alphanumeric characters, dashes, + * and underscores. See sanitize_title(). + * @param array $args Font collection data. See wp_register_font_collection() for information on accepted arguments. + * @phpstan-param array{ + * name?: string, + * description?: string, + * font_families?: array|string, + * categories?: array, + * } $args See wp_register_font_collection() + */ + public function __construct(string $slug, array $args) + { + } + /** + * Retrieves the font collection data. + * + * @since 6.5.0 + * + * @return array|WP_Error An array containing the font collection data, or a WP_Error on failure. + */ + public function get_data() + { + } + } + /** + * WP_Font_Face_Resolver class. + * + * @package WordPress + * @subpackage Fonts + * @since 6.4.0 + */ + /** + * The Font Face Resolver abstracts the processing of different data sources + * (such as theme.json) for processing within the Font Face. + * + * This class is for internal core usage and is not supposed to be used by + * extenders (plugins and/or themes). + * + * @access private + */ + class WP_Font_Face_Resolver + { + /** + * Gets fonts defined in theme.json. + * + * @since 6.4.0 + * + * @return array Returns the font-families, each with their font-face variations. + */ + public static function get_fonts_from_theme_json() + { + } + } + /** + * WP_Font_Face class. + * + * @package WordPress + * @subpackage Fonts + * @since 6.4.0 + */ + /** + * Font Face generates and prints `@font-face` styles for given fonts. + * + * @since 6.4.0 + */ + class WP_Font_Face + { + /** + * Creates and initializes an instance of WP_Font_Face. + * + * @since 6.4.0 + */ + public function __construct() + { + } + /** + * Generates and prints the `@font-face` styles for the given fonts. + * + * @since 6.4.0 + * + * @param array[][] $fonts Optional. The font-families and their font variations. + * See {@see wp_print_font_faces()} for the supported fields. + * Default empty array. + * @phpstan-param array[]<int|string, array{ + * ?: array<array-key, array{ + * font-family: string, + * src: string|string[], + * font-style?: string, + * font-weight?: string, + * font-display?: string, + * ascent-override?: string, + * descent-override?: string, + * font-stretch?: string, + * font-variant?: string, + * font-feature-settings?: string, + * font-variation-settings?: string, + * line-gap-override?: string, + * size-adjust?: string, + * unicode-range?: string, + * }>, + * }> $fonts See wp_print_font_faces() + * @phpstan-return void + */ + public function generate_and_print(array $fonts) + { + } + } + /** + * Font Library class. + * + * This file contains the Font Library class definition. + * + * @package WordPress + * @subpackage Fonts + * @since 6.5.0 + */ + /** + * Font Library class. + * + * @since 6.5.0 + */ + class WP_Font_Library + { + /** + * Register a new font collection. + * + * @since 6.5.0 + * + * @param string $slug Font collection slug. May only contain alphanumeric characters, dashes, + * and underscores. See sanitize_title(). + * @param array $args Font collection data. See wp_register_font_collection() for information on accepted arguments. + * @return WP_Font_Collection|WP_Error A font collection if it was registered successfully, + * or WP_Error object on failure. + * @phpstan-param array{ + * name?: string, + * description?: string, + * font_families?: array|string, + * categories?: array, + * } $args See wp_register_font_collection() + */ + public function register_font_collection(string $slug, array $args) + { + } + /** + * Unregisters a previously registered font collection. + * + * @since 6.5.0 + * + * @param string $slug Font collection slug. + * @return bool True if the font collection was unregistered successfully and false otherwise. + */ + public function unregister_font_collection(string $slug) + { + } + /** + * Gets all the font collections available. + * + * @since 6.5.0 + * + * @return array List of font collections. + */ + public function get_font_collections() + { + } + /** + * Gets a font collection. + * + * @since 6.5.0 + * + * @param string $slug Font collection slug. + * @return WP_Font_Collection|null Font collection object, or null if the font collection doesn't exist. + */ + public function get_font_collection(string $slug) + { + } + /** + * Utility method to retrieve the main instance of the class. + * + * The instance will be created if it does not exist yet. + * + * @since 6.5.0 + * + * @return WP_Font_Library The main instance. + */ + public static function get_instance() + { + } + } + /** + * Font Utils class. + * + * Provides utility functions for working with font families. + * + * @package WordPress + * @subpackage Fonts + * @since 6.5.0 + */ + /** + * A class of utilities for working with the Font Library. + * + * These utilities may change or be removed in the future and are intended for internal use only. + * + * @since 6.5.0 + * @access private + */ + class WP_Font_Utils + { + /** + * Sanitizes and formats font family names. + * + * - Applies `sanitize_text_field`. + * - Adds surrounding quotes to names containing any characters that are not alphabetic or dashes. + * + * It follows the recommendations from the CSS Fonts Module Level 4. + * @link https://www.w3.org/TR/css-fonts-4/#font-family-prop + * + * @since 6.5.0 + * @access private + * + * @see sanitize_text_field() + * + * @param string $font_family Font family name(s), comma-separated. + * @return string Sanitized and formatted font family name(s). + */ + public static function sanitize_font_family($font_family) + { + } + /** + * Generates a slug from font face properties, e.g. `open sans;normal;400;100%;U+0-10FFFF` + * + * Used for comparison with other font faces in the same family, to prevent duplicates + * that would both match according the CSS font matching spec. Uses only simple case-insensitive + * matching for fontFamily and unicodeRange, so does not handle overlapping font-family lists or + * unicode ranges. + * + * @since 6.5.0 + * @access private + * + * @link https://drafts.csswg.org/css-fonts/#font-style-matching + * + * @param array $settings { + * Font face settings. + * + * @type string $fontFamily Font family name. + * @type string $fontStyle Optional font style, defaults to 'normal'. + * @type string $fontWeight Optional font weight, defaults to 400. + * @type string $fontStretch Optional font stretch, defaults to '100%'. + * @type string $unicodeRange Optional unicode range, defaults to 'U+0-10FFFF'. + * } + * @return string Font face slug. + * @phpstan-param array{ + * fontFamily?: string, + * fontStyle?: string, + * fontWeight?: string, + * fontStretch?: string, + * unicodeRange?: string, + * } $settings + */ + public static function get_font_face_slug($settings) + { + } + /** + * Sanitizes a tree of data using a schema. + * + * The schema structure should mirror the data tree. Each value provided in the + * schema should be a callable that will be applied to sanitize the corresponding + * value in the data tree. Keys that are in the data tree, but not present in the + * schema, will be removed in the sanitized data. Nested arrays are traversed recursively. + * + * @since 6.5.0 + * + * @access private + * + * @param array $tree The data to sanitize. + * @param array $schema The schema used for sanitization. + * @return array The sanitized data. + */ + public static function sanitize_from_schema($tree, $schema) + { + } + /** + * Returns the expected mime-type values for font files, depending on PHP version. + * + * This is needed because font mime types vary by PHP version, so checking the PHP version + * is necessary until a list of valid mime-types for each file extension can be provided to + * the 'upload_mimes' filter. + * + * @since 6.5.0 + * + * @access private + * + * @return string[] A collection of mime types keyed by file extension. + */ + public static function get_allowed_font_mime_types() + { + } + } + /** + * HTML API: WP_HTML_Active_Formatting_Elements class + * + * @package WordPress + * @subpackage HTML-API + * @since 6.4.0 + */ + /** + * Core class used by the HTML processor during HTML parsing + * for managing the stack of active formatting elements. + * + * This class is designed for internal use by the HTML processor. + * + * > Initially, the list of active formatting elements is empty. + * > It is used to handle mis-nested formatting element tags. + * > + * > The list contains elements in the formatting category, and markers. + * > The markers are inserted when entering applet, object, marquee, + * > template, td, th, and caption elements, and are used to prevent + * > formatting from "leaking" into applet, object, marquee, template, + * > td, th, and caption elements. + * > + * > In addition, each element in the list of active formatting elements + * > is associated with the token for which it was created, so that + * > further elements can be created for that token if necessary. + * + * @since 6.4.0 + * + * @access private + * + * @see https://html.spec.whatwg.org/#list-of-active-formatting-elements + * @see WP_HTML_Processor + */ + class WP_HTML_Active_Formatting_Elements + { + /** + * Reports if a specific node is in the stack of active formatting elements. + * + * @since 6.4.0 + * + * @param WP_HTML_Token $token Look for this node in the stack. + * @return bool Whether the referenced node is in the stack of active formatting elements. + */ + public function contains_node($token) + { + } + /** + * Returns how many nodes are currently in the stack of active formatting elements. + * + * @since 6.4.0 + * + * @return int How many node are in the stack of active formatting elements. + */ + public function count() + { + } + /** + * Returns the node at the end of the stack of active formatting elements, + * if one exists. If the stack is empty, returns null. + * + * @since 6.4.0 + * + * @return WP_HTML_Token|null Last node in the stack of active formatting elements, if one exists, otherwise null. + */ + public function current_node() + { + } + /** + * Pushes a node onto the stack of active formatting elements. + * + * @since 6.4.0 + * + * @see https://html.spec.whatwg.org/#push-onto-the-list-of-active-formatting-elements + * + * @param WP_HTML_Token $token Push this node onto the stack. + */ + public function push($token) + { + } + /** + * Removes a node from the stack of active formatting elements. + * + * @since 6.4.0 + * + * @param WP_HTML_Token $token Remove this node from the stack, if it's there already. + * @return bool Whether the node was found and removed from the stack of active formatting elements. + */ + public function remove_node($token) + { + } + /** + * Steps through the stack of active formatting elements, starting with the + * top element (added first) and walking downwards to the one added last. + * + * This generator function is designed to be used inside a "foreach" loop. + * + * Example: + * + * $html = '<em><strong><a>We are here'; + * foreach ( $stack->walk_down() as $node ) { + * echo "{$node->node_name} -> "; + * } + * > EM -> STRONG -> A -> + * + * To start with the most-recently added element and walk towards the top, + * see WP_HTML_Active_Formatting_Elements::walk_up(). + * + * @since 6.4.0 + */ + public function walk_down() + { + } + /** + * Steps through the stack of active formatting elements, starting with the + * bottom element (added last) and walking upwards to the one added first. + * + * This generator function is designed to be used inside a "foreach" loop. + * + * Example: + * + * $html = '<em><strong><a>We are here'; + * foreach ( $stack->walk_up() as $node ) { + * echo "{$node->node_name} -> "; + * } + * > A -> STRONG -> EM -> + * + * To start with the first added element and walk towards the bottom, + * see WP_HTML_Active_Formatting_Elements::walk_down(). + * + * @since 6.4.0 + */ + public function walk_up() + { + } + } + /** + * HTML API: WP_HTML_Attribute_Token class + * + * @package WordPress + * @subpackage HTML-API + * @since 6.2.0 + */ + /** + * Core class used by the HTML tag processor as a data structure for the attribute token, + * allowing to drastically improve performance. + * + * This class is for internal usage of the WP_HTML_Tag_Processor class. + * + * @access private + * @since 6.2.0 + * @since 6.5.0 Replaced `end` with `length` to more closely match `substr()`. + * + * @see WP_HTML_Tag_Processor + */ + class WP_HTML_Attribute_Token + { + /** + * Attribute name. + * + * @since 6.2.0 + * + * @var string + */ + public $name; + /** + * Attribute value. + * + * @since 6.2.0 + * + * @var int + */ + public $value_starts_at; + /** + * How many bytes the value occupies in the input HTML. + * + * @since 6.2.0 + * + * @var int + */ + public $value_length; + /** + * The string offset where the attribute name starts. + * + * @since 6.2.0 + * + * @var int + */ + public $start; + /** + * Byte length of text spanning the attribute inside a tag. + * + * This span starts at the first character of the attribute name + * and it ends after one of three cases: + * + * - at the end of the attribute name for boolean attributes. + * - at the end of the value for unquoted attributes. + * - at the final single or double quote for quoted attributes. + * + * Example: + * + * <div class="post"> + * ------------ length is 12, including quotes + * + * <input type="checked" checked id="selector"> + * ------- length is 6 + * + * <a rel=noopener> + * ------------ length is 11 + * + * @since 6.5.0 Replaced `end` with `length` to more closely match `substr()`. + * + * @var int + */ + public $length; + /** + * Whether the attribute is a boolean attribute with value `true`. + * + * @since 6.2.0 + * + * @var bool + */ + public $is_true; + /** + * Constructor. + * + * @since 6.2.0 + * @since 6.5.0 Replaced `end` with `length` to more closely match `substr()`. + * + * @param string $name Attribute name. + * @param int $value_start Attribute value. + * @param int $value_length Number of bytes attribute value spans. + * @param int $start The string offset where the attribute name starts. + * @param int $length Byte length of the entire attribute name or name and value pair expression. + * @param bool $is_true Whether the attribute is a boolean attribute with true value. + */ + public function __construct($name, $value_start, $value_length, $start, $length, $is_true) + { + } + } + /** + * HTML API: WP_HTML_Decoder class + * + * Decodes spans of raw text found inside HTML content. + * + * @package WordPress + * @subpackage HTML-API + * @since 6.6.0 + */ + class WP_HTML_Decoder + { + /** + * Indicates if an attribute value starts with a given raw string value. + * + * Use this method to determine if an attribute value starts with a given string, regardless + * of how it might be encoded in HTML. For instance, `http:` could be represented as `http:` + * or as `http:` or as `http:` or as `http:`, or in many other ways. + * + * Example: + * + * $value = 'http://wordpress.org/'; + * true === WP_HTML_Decoder::attribute_starts_with( $value, 'http:', 'ascii-case-insensitive' ); + * false === WP_HTML_Decoder::attribute_starts_with( $value, 'https:', 'ascii-case-insensitive' ); + * + * @since 6.6.0 + * + * @param string $haystack String containing the raw non-decoded attribute value. + * @param string $search_text Does the attribute value start with this plain string. + * @param string $case_sensitivity Optional. Pass 'ascii-case-insensitive' to ignore ASCII case when matching. + * Default 'case-sensitive'. + * @return bool Whether the attribute value starts with the given string. + */ + public static function attribute_starts_with($haystack, $search_text, $case_sensitivity = 'case-sensitive') + { + } + /** + * Returns a string containing the decoded value of a given HTML text node. + * + * Text nodes appear in HTML DATA sections, which are the text segments inside + * and around tags, excepting SCRIPT and STYLE elements (and some others), + * whose inner text is not decoded. Use this function to read the decoded + * value of such a text span in an HTML document. + * + * Example: + * + * '“😄”' === WP_HTML_Decode::decode_text_node( '“😄”' ); + * + * @since 6.6.0 + * + * @param string $text Text containing raw and non-decoded text node to decode. + * @return string Decoded UTF-8 value of given text node. + */ + public static function decode_text_node($text) + { + } + /** + * Returns a string containing the decoded value of a given HTML attribute. + * + * Text found inside an HTML attribute has different parsing rules than for + * text found inside other markup, or DATA segments. Use this function to + * read the decoded value of an HTML string inside a quoted attribute. + * + * Example: + * + * '“😄”' === WP_HTML_Decode::decode_attribute( '“😄”' ); + * + * @since 6.6.0 + * + * @param string $text Text containing raw and non-decoded attribute value to decode. + * @return string Decoded UTF-8 value of given attribute value. + */ + public static function decode_attribute($text) + { + } + /** + * Decodes a span of HTML text, depending on the context in which it's found. + * + * This is a low-level method; prefer calling WP_HTML_Decoder::decode_attribute() or + * WP_HTML_Decoder::decode_text_node() instead. It's provided for cases where this + * may be difficult to do from calling code. + * + * Example: + * + * '©' = WP_HTML_Decoder::decode( 'data', '©' ); + * + * @since 6.6.0 + * + * @access private + * + * @param string $context `attribute` for decoding attribute values, `data` otherwise. + * @param string $text Text document containing span of text to decode. + * @return string Decoded UTF-8 string. + */ + public static function decode($context, $text) + { + } + /** + * Attempt to read a character reference at the given location in a given string, + * depending on the context in which it's found. + * + * If a character reference is found, this function will return the translated value + * that the reference maps to. It will then set `$match_byte_length` the + * number of bytes of input it read while consuming the character reference. This + * gives calling code the opportunity to advance its cursor when traversing a string + * and decoding. + * + * Example: + * + * null === WP_HTML_Decoder::read_character_reference( 'attribute', 'Ships…', 0 ); + * '…' === WP_HTML_Decoder::read_character_reference( 'attribute', 'Ships…', 5, $token_length ); + * 8 === $token_length; // `…` + * + * null === WP_HTML_Decoder::read_character_reference( 'attribute', '¬in', 0 ); + * '∉' === WP_HTML_Decoder::read_character_reference( 'attribute', '∉', 0, $token_length ); + * 7 === $token_length; // `∉` + * + * '¬' === WP_HTML_Decoder::read_character_reference( 'data', '¬in', 0, $token_length ); + * 4 === $token_length; // `¬` + * '∉' === WP_HTML_Decoder::read_character_reference( 'data', '∉', 0, $token_length ); + * 7 === $token_length; // `∉` + * + * @since 6.6.0 + * + * @param string $context `attribute` for decoding attribute values, `data` otherwise. + * @param string $text Text document containing span of text to decode. + * @param int $at Optional. Byte offset into text where span begins, defaults to the beginning (0). + * @param int &$match_byte_length Optional. Set to byte-length of character reference if provided and if a match + * is found, otherwise not set. Default null. + * @return string|false Decoded character reference in UTF-8 if found, otherwise `false`. + */ + public static function read_character_reference($context, $text, $at = 0, &$match_byte_length = \null) + { + } + /** + * Encode a code point number into the UTF-8 encoding. + * + * This encoder implements the UTF-8 encoding algorithm for converting + * a code point into a byte sequence. If it receives an invalid code + * point it will return the Unicode Replacement Character U+FFFD `�`. + * + * Example: + * + * '🅰' === WP_HTML_Decoder::code_point_to_utf8_bytes( 0x1f170 ); + * + * // Half of a surrogate pair is an invalid code point. + * '�' === WP_HTML_Decoder::code_point_to_utf8_bytes( 0xd83c ); + * + * @since 6.6.0 + * + * @see https://www.rfc-editor.org/rfc/rfc3629 For the UTF-8 standard. + * + * @param int $code_point Which code point to convert. + * @return string Converted code point, or `�` if invalid. + */ + public static function code_point_to_utf8_bytes($code_point) + { + } + } + /** + * HTML API: WP_HTML_Open_Elements class + * + * @package WordPress + * @subpackage HTML-API + * @since 6.4.0 + */ + /** + * Core class used by the HTML processor during HTML parsing + * for managing the stack of open elements. + * + * This class is designed for internal use by the HTML processor. + * + * > Initially, the stack of open elements is empty. The stack grows + * > downwards; the topmost node on the stack is the first one added + * > to the stack, and the bottommost node of the stack is the most + * > recently added node in the stack (notwithstanding when the stack + * > is manipulated in a random access fashion as part of the handling + * > for misnested tags). + * + * @since 6.4.0 + * + * @access private + * + * @see https://html.spec.whatwg.org/#stack-of-open-elements + * @see WP_HTML_Processor + */ + class WP_HTML_Open_Elements + { + /** + * Holds the stack of open element references. + * + * @since 6.4.0 + * + * @var WP_HTML_Token[] + */ + public $stack = array(); + /** + * Sets a pop handler that will be called when an item is popped off the stack of + * open elements. + * + * The function will be called with the pushed item as its argument. + * + * @since 6.6.0 + * + * @param Closure $handler The handler function. + */ + public function set_pop_handler(\Closure $handler) + { + } + /** + * Sets a push handler that will be called when an item is pushed onto the stack of + * open elements. + * + * The function will be called with the pushed item as its argument. + * + * @since 6.6.0 + * + * @param Closure $handler The handler function. + */ + public function set_push_handler(\Closure $handler) + { + } + /** + * Reports if a specific node is in the stack of open elements. + * + * @since 6.4.0 + * + * @param WP_HTML_Token $token Look for this node in the stack. + * @return bool Whether the referenced node is in the stack of open elements. + */ + public function contains_node($token) + { + } + /** + * Returns how many nodes are currently in the stack of open elements. + * + * @since 6.4.0 + * + * @return int How many node are in the stack of open elements. + */ + public function count() + { + } + /** + * Returns the node at the end of the stack of open elements, + * if one exists. If the stack is empty, returns null. + * + * @since 6.4.0 + * + * @return WP_HTML_Token|null Last node in the stack of open elements, if one exists, otherwise null. + */ + public function current_node() + { + } + /** + * Returns whether an element is in a specific scope. + * + * ## HTML Support + * + * This function skips checking for the termination list because there + * are no supported elements which appear in the termination list. + * + * @since 6.4.0 + * + * @see https://html.spec.whatwg.org/#has-an-element-in-the-specific-scope + * + * @param string $tag_name Name of tag check. + * @param string[] $termination_list List of elements that terminate the search. + * @return bool Whether the element was found in a specific scope. + */ + public function has_element_in_specific_scope($tag_name, $termination_list) + { + } + /** + * Returns whether a particular element is in scope. + * + * @since 6.4.0 + * + * @see https://html.spec.whatwg.org/#has-an-element-in-scope + * + * @param string $tag_name Name of tag to check. + * @return bool Whether given element is in scope. + */ + public function has_element_in_scope($tag_name) + { + } + /** + * Returns whether a particular element is in list item scope. + * + * @since 6.4.0 + * @since 6.5.0 Implemented: no longer throws on every invocation. + * + * @see https://html.spec.whatwg.org/#has-an-element-in-list-item-scope + * + * @param string $tag_name Name of tag to check. + * @return bool Whether given element is in scope. + */ + public function has_element_in_list_item_scope($tag_name) + { + } + /** + * Returns whether a particular element is in button scope. + * + * @since 6.4.0 + * + * @see https://html.spec.whatwg.org/#has-an-element-in-button-scope + * + * @param string $tag_name Name of tag to check. + * @return bool Whether given element is in scope. + */ + public function has_element_in_button_scope($tag_name) + { + } + /** + * Returns whether a particular element is in table scope. + * + * @since 6.4.0 + * + * @see https://html.spec.whatwg.org/#has-an-element-in-table-scope + * + * @throws WP_HTML_Unsupported_Exception Always until this function is implemented. + * + * @param string $tag_name Name of tag to check. + * @return bool Whether given element is in scope. + */ + public function has_element_in_table_scope($tag_name) + { + } + /** + * Returns whether a particular element is in select scope. + * + * @since 6.4.0 + * + * @see https://html.spec.whatwg.org/#has-an-element-in-select-scope + * + * @throws WP_HTML_Unsupported_Exception Always until this function is implemented. + * + * @param string $tag_name Name of tag to check. + * @return bool Whether given element is in scope. + */ + public function has_element_in_select_scope($tag_name) + { + } + /** + * Returns whether a P is in BUTTON scope. + * + * @since 6.4.0 + * + * @see https://html.spec.whatwg.org/#has-an-element-in-button-scope + * + * @return bool Whether a P is in BUTTON scope. + */ + public function has_p_in_button_scope() + { + } + /** + * Pops a node off of the stack of open elements. + * + * @since 6.4.0 + * + * @see https://html.spec.whatwg.org/#stack-of-open-elements + * + * @return bool Whether a node was popped off of the stack. + */ + public function pop() + { + } + /** + * Pops nodes off of the stack of open elements until one with the given tag name has been popped. + * + * @since 6.4.0 + * + * @see WP_HTML_Open_Elements::pop + * + * @param string $tag_name Name of tag that needs to be popped off of the stack of open elements. + * @return bool Whether a tag of the given name was found and popped off of the stack of open elements. + */ + public function pop_until($tag_name) + { + } + /** + * Pushes a node onto the stack of open elements. + * + * @since 6.4.0 + * + * @see https://html.spec.whatwg.org/#stack-of-open-elements + * + * @param WP_HTML_Token $stack_item Item to add onto stack. + */ + public function push($stack_item) + { + } + /** + * Removes a specific node from the stack of open elements. + * + * @since 6.4.0 + * + * @param WP_HTML_Token $token The node to remove from the stack of open elements. + * @return bool Whether the node was found and removed from the stack of open elements. + */ + public function remove_node($token) + { + } + /** + * Steps through the stack of open elements, starting with the top element + * (added first) and walking downwards to the one added last. + * + * This generator function is designed to be used inside a "foreach" loop. + * + * Example: + * + * $html = '<em><strong><a>We are here'; + * foreach ( $stack->walk_down() as $node ) { + * echo "{$node->node_name} -> "; + * } + * > EM -> STRONG -> A -> + * + * To start with the most-recently added element and walk towards the top, + * see WP_HTML_Open_Elements::walk_up(). + * + * @since 6.4.0 + */ + public function walk_down() + { + } + /** + * Steps through the stack of open elements, starting with the bottom element + * (added last) and walking upwards to the one added first. + * + * This generator function is designed to be used inside a "foreach" loop. + * + * Example: + * + * $html = '<em><strong><a>We are here'; + * foreach ( $stack->walk_up() as $node ) { + * echo "{$node->node_name} -> "; + * } + * > A -> STRONG -> EM -> + * + * To start with the first added element and walk towards the bottom, + * see WP_HTML_Open_Elements::walk_down(). + * + * @since 6.4.0 + * @since 6.5.0 Accepts $above_this_node to start traversal above a given node, if it exists. + * + * @param ?WP_HTML_Token $above_this_node Start traversing above this node, if provided and if the node exists. + */ + public function walk_up($above_this_node = \null) + { + } + /* + * Internal helpers. + */ + /** + * Updates internal flags after adding an element. + * + * Certain conditions (such as "has_p_in_button_scope") are maintained here as + * flags that are only modified when adding and removing elements. This allows + * the HTML Processor to quickly check for these conditions instead of iterating + * over the open stack elements upon each new tag it encounters. These flags, + * however, need to be maintained as items are added and removed from the stack. + * + * @since 6.4.0 + * + * @param WP_HTML_Token $item Element that was added to the stack of open elements. + */ + public function after_element_push($item) + { + } + /** + * Updates internal flags after removing an element. + * + * Certain conditions (such as "has_p_in_button_scope") are maintained here as + * flags that are only modified when adding and removing elements. This allows + * the HTML Processor to quickly check for these conditions instead of iterating + * over the open stack elements upon each new tag it encounters. These flags, + * however, need to be maintained as items are added and removed from the stack. + * + * @since 6.4.0 + * + * @param WP_HTML_Token $item Element that was removed from the stack of open elements. + */ + public function after_element_pop($item) + { + } + /** + * Wakeup magic method. + * + * @since 6.6.0 + */ + public function __wakeup() + { + } + } + /** + * HTML API: WP_HTML_Processor_State class + * + * @package WordPress + * @subpackage HTML-API + * @since 6.4.0 + */ + /** + * Core class used by the HTML processor during HTML parsing + * for managing the internal parsing state. + * + * This class is designed for internal use by the HTML processor. + * + * @since 6.4.0 + * + * @access private + * + * @see WP_HTML_Processor + */ + class WP_HTML_Processor_State + { + /* + * Insertion mode constants. + * + * These constants exist and are named to make it easier to + * discover and recognize the supported insertion modes in + * the parser. + * + * Out of all the possible insertion modes, only those + * supported by the parser are listed here. As support + * is added to the parser for more modes, add them here + * following the same naming and value pattern. + * + * @see https://html.spec.whatwg.org/#the-insertion-mode + */ + /** + * Initial insertion mode for full HTML parser. + * + * @since 6.4.0 + * + * @see https://html.spec.whatwg.org/#the-initial-insertion-mode + * @see WP_HTML_Processor_State::$insertion_mode + * + * @var string + */ + const INSERTION_MODE_INITIAL = 'insertion-mode-initial'; + /** + * In body insertion mode for full HTML parser. + * + * @since 6.4.0 + * + * @see https://html.spec.whatwg.org/#parsing-main-inbody + * @see WP_HTML_Processor_State::$insertion_mode + * + * @var string + */ + const INSERTION_MODE_IN_BODY = 'insertion-mode-in-body'; + /** + * Tracks open elements while scanning HTML. + * + * This property is initialized in the constructor and never null. + * + * @since 6.4.0 + * + * @see https://html.spec.whatwg.org/#stack-of-open-elements + * + * @var WP_HTML_Open_Elements + */ + public $stack_of_open_elements = \null; + /** + * Tracks open formatting elements, used to handle mis-nested formatting element tags. + * + * This property is initialized in the constructor and never null. + * + * @since 6.4.0 + * + * @see https://html.spec.whatwg.org/#list-of-active-formatting-elements + * + * @var WP_HTML_Active_Formatting_Elements + */ + public $active_formatting_elements = \null; + /** + * Refers to the currently-matched tag, if any. + * + * @since 6.4.0 + * + * @var WP_HTML_Token|null + */ + public $current_token = \null; + /** + * Tree construction insertion mode. + * + * @since 6.4.0 + * + * @see https://html.spec.whatwg.org/#insertion-mode + * + * @var string + */ + public $insertion_mode = self::INSERTION_MODE_INITIAL; + /** + * Context node initializing fragment parser, if created as a fragment parser. + * + * @since 6.4.0 + * + * @see https://html.spec.whatwg.org/#concept-frag-parse-context + * + * @var [string, array]|null + */ + public $context_node = \null; + /** + * The frameset-ok flag indicates if a `FRAMESET` element is allowed in the current state. + * + * > The frameset-ok flag is set to "ok" when the parser is created. It is set to "not ok" after certain tokens are seen. + * + * @since 6.4.0 + * + * @see https://html.spec.whatwg.org/#frameset-ok-flag + * + * @var bool + */ + public $frameset_ok = \true; + /** + * Constructor - creates a new and empty state value. + * + * @since 6.4.0 + * + * @see WP_HTML_Processor + */ + public function __construct() + { + } + } + /** + * HTML API: WP_HTML_Tag_Processor class + * + * Scans through an HTML document to find specific tags, then + * transforms those tags by adding, removing, or updating the + * values of the HTML attributes within that tag (opener). + * + * Does not fully parse HTML or _recurse_ into the HTML structure + * Instead this scans linearly through a document and only parses + * the HTML tag openers. + * + * ### Possible future direction for this module + * + * - Prune the whitespace when removing classes/attributes: e.g. "a b c" -> "c" not " c". + * This would increase the size of the changes for some operations but leave more + * natural-looking output HTML. + * + * @package WordPress + * @subpackage HTML-API + * @since 6.2.0 + */ + /** + * Core class used to modify attributes in an HTML document for tags matching a query. + * + * ## Usage + * + * Use of this class requires three steps: + * + * 1. Create a new class instance with your input HTML document. + * 2. Find the tag(s) you are looking for. + * 3. Request changes to the attributes in those tag(s). + * + * Example: + * + * $tags = new WP_HTML_Tag_Processor( $html ); + * if ( $tags->next_tag( 'option' ) ) { + * $tags->set_attribute( 'selected', true ); + * } + * + * ### Finding tags + * + * The `next_tag()` function moves the internal cursor through + * your input HTML document until it finds a tag meeting any of + * the supplied restrictions in the optional query argument. If + * no argument is provided then it will find the next HTML tag, + * regardless of what kind it is. + * + * If you want to _find whatever the next tag is_: + * + * $tags->next_tag(); + * + * | Goal | Query | + * |-----------------------------------------------------------|---------------------------------------------------------------------------------| + * | Find any tag. | `$tags->next_tag();` | + * | Find next image tag. | `$tags->next_tag( array( 'tag_name' => 'img' ) );` | + * | Find next image tag (without passing the array). | `$tags->next_tag( 'img' );` | + * | Find next tag containing the `fullwidth` CSS class. | `$tags->next_tag( array( 'class_name' => 'fullwidth' ) );` | + * | Find next image tag containing the `fullwidth` CSS class. | `$tags->next_tag( array( 'tag_name' => 'img', 'class_name' => 'fullwidth' ) );` | + * + * If a tag was found meeting your criteria then `next_tag()` + * will return `true` and you can proceed to modify it. If it + * returns `false`, however, it failed to find the tag and + * moved the cursor to the end of the file. + * + * Once the cursor reaches the end of the file the processor + * is done and if you want to reach an earlier tag you will + * need to recreate the processor and start over, as it's + * unable to back up or move in reverse. + * + * See the section on bookmarks for an exception to this + * no-backing-up rule. + * + * #### Custom queries + * + * Sometimes it's necessary to further inspect an HTML tag than + * the query syntax here permits. In these cases one may further + * inspect the search results using the read-only functions + * provided by the processor or external state or variables. + * + * Example: + * + * // Paint up to the first five DIV or SPAN tags marked with the "jazzy" style. + * $remaining_count = 5; + * while ( $remaining_count > 0 && $tags->next_tag() ) { + * if ( + * ( 'DIV' === $tags->get_tag() || 'SPAN' === $tags->get_tag() ) && + * 'jazzy' === $tags->get_attribute( 'data-style' ) + * ) { + * $tags->add_class( 'theme-style-everest-jazz' ); + * $remaining_count--; + * } + * } + * + * `get_attribute()` will return `null` if the attribute wasn't present + * on the tag when it was called. It may return `""` (the empty string) + * in cases where the attribute was present but its value was empty. + * For boolean attributes, those whose name is present but no value is + * given, it will return `true` (the only way to set `false` for an + * attribute is to remove it). + * + * #### When matching fails + * + * When `next_tag()` returns `false` it could mean different things: + * + * - The requested tag wasn't found in the input document. + * - The input document ended in the middle of an HTML syntax element. + * + * When a document ends in the middle of a syntax element it will pause + * the processor. This is to make it possible in the future to extend the + * input document and proceed - an important requirement for chunked + * streaming parsing of a document. + * + * Example: + * + * $processor = new WP_HTML_Tag_Processor( 'This <div is="a" partial="token' ); + * false === $processor->next_tag(); + * + * If a special element (see next section) is encountered but no closing tag + * is found it will count as an incomplete tag. The parser will pause as if + * the opening tag were incomplete. + * + * Example: + * + * $processor = new WP_HTML_Tag_Processor( '<style>// there could be more styling to come' ); + * false === $processor->next_tag(); + * + * $processor = new WP_HTML_Tag_Processor( '<style>// this is everything</style><div>' ); + * true === $processor->next_tag( 'DIV' ); + * + * #### Special elements + * + * Some HTML elements are handled in a special way; their start and end tags + * act like a void tag. These are special because their contents can't contain + * HTML markup. Everything inside these elements is handled in a special way + * and content that _appears_ like HTML tags inside of them isn't. There can + * be no nesting in these elements. + * + * In the following list, "raw text" means that all of the content in the HTML + * until the matching closing tag is treated verbatim without any replacements + * and without any parsing. + * + * - IFRAME allows no content but requires a closing tag. + * - NOEMBED (deprecated) content is raw text. + * - NOFRAMES (deprecated) content is raw text. + * - SCRIPT content is plaintext apart from legacy rules allowing `</script>` inside an HTML comment. + * - STYLE content is raw text. + * - TITLE content is plain text but character references are decoded. + * - TEXTAREA content is plain text but character references are decoded. + * - XMP (deprecated) content is raw text. + * + * ### Modifying HTML attributes for a found tag + * + * Once you've found the start of an opening tag you can modify + * any number of the attributes on that tag. You can set a new + * value for an attribute, remove the entire attribute, or do + * nothing and move on to the next opening tag. + * + * Example: + * + * if ( $tags->next_tag( array( 'class_name' => 'wp-group-block' ) ) ) { + * $tags->set_attribute( 'title', 'This groups the contained content.' ); + * $tags->remove_attribute( 'data-test-id' ); + * } + * + * If `set_attribute()` is called for an existing attribute it will + * overwrite the existing value. Similarly, calling `remove_attribute()` + * for a non-existing attribute has no effect on the document. Both + * of these methods are safe to call without knowing if a given attribute + * exists beforehand. + * + * ### Modifying CSS classes for a found tag + * + * The tag processor treats the `class` attribute as a special case. + * Because it's a common operation to add or remove CSS classes, this + * interface adds helper methods to make that easier. + * + * As with attribute values, adding or removing CSS classes is a safe + * operation that doesn't require checking if the attribute or class + * exists before making changes. If removing the only class then the + * entire `class` attribute will be removed. + * + * Example: + * + * // from `<span>Yippee!</span>` + * // to `<span class="is-active">Yippee!</span>` + * $tags->add_class( 'is-active' ); + * + * // from `<span class="excited">Yippee!</span>` + * // to `<span class="excited is-active">Yippee!</span>` + * $tags->add_class( 'is-active' ); + * + * // from `<span class="is-active heavy-accent">Yippee!</span>` + * // to `<span class="is-active heavy-accent">Yippee!</span>` + * $tags->add_class( 'is-active' ); + * + * // from `<input type="text" class="is-active rugby not-disabled" length="24">` + * // to `<input type="text" class="is-active not-disabled" length="24"> + * $tags->remove_class( 'rugby' ); + * + * // from `<input type="text" class="rugby" length="24">` + * // to `<input type="text" length="24"> + * $tags->remove_class( 'rugby' ); + * + * // from `<input type="text" length="24">` + * // to `<input type="text" length="24"> + * $tags->remove_class( 'rugby' ); + * + * When class changes are enqueued but a direct change to `class` is made via + * `set_attribute` then the changes to `set_attribute` (or `remove_attribute`) + * will take precedence over those made through `add_class` and `remove_class`. + * + * ### Bookmarks + * + * While scanning through the input HTMl document it's possible to set + * a named bookmark when a particular tag is found. Later on, after + * continuing to scan other tags, it's possible to `seek` to one of + * the set bookmarks and then proceed again from that point forward. + * + * Because bookmarks create processing overhead one should avoid + * creating too many of them. As a rule, create only bookmarks + * of known string literal names; avoid creating "mark_{$index}" + * and so on. It's fine from a performance standpoint to create a + * bookmark and update it frequently, such as within a loop. + * + * $total_todos = 0; + * while ( $p->next_tag( array( 'tag_name' => 'UL', 'class_name' => 'todo' ) ) ) { + * $p->set_bookmark( 'list-start' ); + * while ( $p->next_tag( array( 'tag_closers' => 'visit' ) ) ) { + * if ( 'UL' === $p->get_tag() && $p->is_tag_closer() ) { + * $p->set_bookmark( 'list-end' ); + * $p->seek( 'list-start' ); + * $p->set_attribute( 'data-contained-todos', (string) $total_todos ); + * $total_todos = 0; + * $p->seek( 'list-end' ); + * break; + * } + * + * if ( 'LI' === $p->get_tag() && ! $p->is_tag_closer() ) { + * $total_todos++; + * } + * } + * } + * + * ## Tokens and finer-grained processing. + * + * It's possible to scan through every lexical token in the + * HTML document using the `next_token()` function. This + * alternative form takes no argument and provides no built-in + * query syntax. + * + * Example: + * + * $title = '(untitled)'; + * $text = ''; + * while ( $processor->next_token() ) { + * switch ( $processor->get_token_name() ) { + * case '#text': + * $text .= $processor->get_modifiable_text(); + * break; + * + * case 'BR': + * $text .= "\n"; + * break; + * + * case 'TITLE': + * $title = $processor->get_modifiable_text(); + * break; + * } + * } + * return trim( "# {$title}\n\n{$text}" ); + * + * ### Tokens and _modifiable text_. + * + * #### Special "atomic" HTML elements. + * + * Not all HTML elements are able to contain other elements inside of them. + * For instance, the contents inside a TITLE element are plaintext (except + * that character references like & will be decoded). This means that + * if the string `<img>` appears inside a TITLE element, then it's not an + * image tag, but rather it's text describing an image tag. Likewise, the + * contents of a SCRIPT or STYLE element are handled entirely separately in + * a browser than the contents of other elements because they represent a + * different language than HTML. + * + * For these elements the Tag Processor treats the entire sequence as one, + * from the opening tag, including its contents, through its closing tag. + * This means that the it's not possible to match the closing tag for a + * SCRIPT element unless it's unexpected; the Tag Processor already matched + * it when it found the opening tag. + * + * The inner contents of these elements are that element's _modifiable text_. + * + * The special elements are: + * - `SCRIPT` whose contents are treated as raw plaintext but supports a legacy + * style of including JavaScript inside of HTML comments to avoid accidentally + * closing the SCRIPT from inside a JavaScript string. E.g. `console.log( '</script>' )`. + * - `TITLE` and `TEXTAREA` whose contents are treated as plaintext and then any + * character references are decoded. E.g. `1 < 2 < 3` becomes `1 < 2 < 3`. + * - `IFRAME`, `NOSCRIPT`, `NOEMBED`, `NOFRAME`, `STYLE` whose contents are treated as + * raw plaintext and left as-is. E.g. `1 < 2 < 3` remains `1 < 2 < 3`. + * + * #### Other tokens with modifiable text. + * + * There are also non-elements which are void/self-closing in nature and contain + * modifiable text that is part of that individual syntax token itself. + * + * - `#text` nodes, whose entire token _is_ the modifiable text. + * - HTML comments and tokens that become comments due to some syntax error. The + * text for these tokens is the portion of the comment inside of the syntax. + * E.g. for `<!-- comment -->` the text is `" comment "` (note the spaces are included). + * - `CDATA` sections, whose text is the content inside of the section itself. E.g. for + * `<![CDATA[some content]]>` the text is `"some content"` (with restrictions [1]). + * - "Funky comments," which are a special case of invalid closing tags whose name is + * invalid. The text for these nodes is the text that a browser would transform into + * an HTML comment when parsing. E.g. for `</%post_author>` the text is `%post_author`. + * - `DOCTYPE` declarations like `<DOCTYPE html>` which have no closing tag. + * - XML Processing instruction nodes like `<?wp __( "Like" ); ?>` (with restrictions [2]). + * - The empty end tag `</>` which is ignored in the browser and DOM. + * + * [1]: There are no CDATA sections in HTML. When encountering `<![CDATA[`, everything + * until the next `>` becomes a bogus HTML comment, meaning there can be no CDATA + * section in an HTML document containing `>`. The Tag Processor will first find + * all valid and bogus HTML comments, and then if the comment _would_ have been a + * CDATA section _were they to exist_, it will indicate this as the type of comment. + * + * [2]: XML allows a broader range of characters in a processing instruction's target name + * and disallows "xml" as a name, since it's special. The Tag Processor only recognizes + * target names with an ASCII-representable subset of characters. It also exhibits the + * same constraint as with CDATA sections, in that `>` cannot exist within the token + * since Processing Instructions do no exist within HTML and their syntax transforms + * into a bogus comment in the DOM. + * + * ## Design and limitations + * + * The Tag Processor is designed to linearly scan HTML documents and tokenize + * HTML tags and their attributes. It's designed to do this as efficiently as + * possible without compromising parsing integrity. Therefore it will be + * slower than some methods of modifying HTML, such as those incorporating + * over-simplified PCRE patterns, but will not introduce the defects and + * failures that those methods bring in, which lead to broken page renders + * and often to security vulnerabilities. On the other hand, it will be faster + * than full-blown HTML parsers such as DOMDocument and use considerably + * less memory. It requires a negligible memory overhead, enough to consider + * it a zero-overhead system. + * + * The performance characteristics are maintained by avoiding tree construction + * and semantic cleanups which are specified in HTML5. Because of this, for + * example, it's not possible for the Tag Processor to associate any given + * opening tag with its corresponding closing tag, or to return the inner markup + * inside an element. Systems may be built on top of the Tag Processor to do + * this, but the Tag Processor is and should be constrained so it can remain an + * efficient, low-level, and reliable HTML scanner. + * + * The Tag Processor's design incorporates a "garbage-in-garbage-out" philosophy. + * HTML5 specifies that certain invalid content be transformed into different forms + * for display, such as removing null bytes from an input document and replacing + * invalid characters with the Unicode replacement character `U+FFFD` (visually "�"). + * Where errors or transformations exist within the HTML5 specification, the Tag Processor + * leaves those invalid inputs untouched, passing them through to the final browser + * to handle. While this implies that certain operations will be non-spec-compliant, + * such as reading the value of an attribute with invalid content, it also preserves a + * simplicity and efficiency for handling those error cases. + * + * Most operations within the Tag Processor are designed to minimize the difference + * between an input and output document for any given change. For example, the + * `add_class` and `remove_class` methods preserve whitespace and the class ordering + * within the `class` attribute; and when encountering tags with duplicated attributes, + * the Tag Processor will leave those invalid duplicate attributes where they are but + * update the proper attribute which the browser will read for parsing its value. An + * exception to this rule is that all attribute updates store their values as + * double-quoted strings, meaning that attributes on input with single-quoted or + * unquoted values will appear in the output with double-quotes. + * + * ### Scripting Flag + * + * The Tag Processor parses HTML with the "scripting flag" disabled. This means + * that it doesn't run any scripts while parsing the page. In a browser with + * JavaScript enabled, for example, the script can change the parse of the + * document as it loads. On the server, however, evaluating JavaScript is not + * only impractical, but also unwanted. + * + * Practically this means that the Tag Processor will descend into NOSCRIPT + * elements and process its child tags. Were the scripting flag enabled, such + * as in a typical browser, the contents of NOSCRIPT are skipped entirely. + * + * This allows the HTML API to process the content that will be presented in + * a browser when scripting is disabled, but it offers a different view of a + * page than most browser sessions will experience. E.g. the tags inside the + * NOSCRIPT disappear. + * + * ### Text Encoding + * + * The Tag Processor assumes that the input HTML document is encoded with a + * text encoding compatible with 7-bit ASCII's '<', '>', '&', ';', '/', '=', + * "'", '"', 'a' - 'z', 'A' - 'Z', and the whitespace characters ' ', tab, + * carriage-return, newline, and form-feed. + * + * In practice, this includes almost every single-byte encoding as well as + * UTF-8. Notably, however, it does not include UTF-16. If providing input + * that's incompatible, then convert the encoding beforehand. + * + * @since 6.2.0 + * @since 6.2.1 Fix: Support for various invalid comments; attribute updates are case-insensitive. + * @since 6.3.2 Fix: Skip HTML-like content inside rawtext elements such as STYLE. + * @since 6.5.0 Pauses processor when input ends in an incomplete syntax token. + * Introduces "special" elements which act like void elements, e.g. TITLE, STYLE. + * Allows scanning through all tokens and processing modifiable text, where applicable. + */ + class WP_HTML_Tag_Processor + { + /** + * The maximum number of bookmarks allowed to exist at + * any given time. + * + * @since 6.2.0 + * @var int + * + * @see WP_HTML_Tag_Processor::set_bookmark() + */ + const MAX_BOOKMARKS = 10; + /** + * Maximum number of times seek() can be called. + * Prevents accidental infinite loops. + * + * @since 6.2.0 + * @var int + * + * @see WP_HTML_Tag_Processor::seek() + */ + const MAX_SEEK_OPS = 1000; + /** + * The HTML document to parse. + * + * @since 6.2.0 + * @var string + */ + protected $html; + /** + * Specifies mode of operation of the parser at any given time. + * + * | State | Meaning | + * | ----------------|----------------------------------------------------------------------| + * | *Ready* | The parser is ready to run. | + * | *Complete* | There is nothing left to parse. | + * | *Incomplete* | The HTML ended in the middle of a token; nothing more can be parsed. | + * | *Matched tag* | Found an HTML tag; it's possible to modify its attributes. | + * | *Text node* | Found a #text node; this is plaintext and modifiable. | + * | *CDATA node* | Found a CDATA section; this is modifiable. | + * | *Comment* | Found a comment or bogus comment; this is modifiable. | + * | *Presumptuous* | Found an empty tag closer: `</>`. | + * | *Funky comment* | Found a tag closer with an invalid tag name; this is modifiable. | + * + * @since 6.5.0 + * + * @see WP_HTML_Tag_Processor::STATE_READY + * @see WP_HTML_Tag_Processor::STATE_COMPLETE + * @see WP_HTML_Tag_Processor::STATE_INCOMPLETE_INPUT + * @see WP_HTML_Tag_Processor::STATE_MATCHED_TAG + * @see WP_HTML_Tag_Processor::STATE_TEXT_NODE + * @see WP_HTML_Tag_Processor::STATE_CDATA_NODE + * @see WP_HTML_Tag_Processor::STATE_COMMENT + * @see WP_HTML_Tag_Processor::STATE_DOCTYPE + * @see WP_HTML_Tag_Processor::STATE_PRESUMPTUOUS_TAG + * @see WP_HTML_Tag_Processor::STATE_FUNKY_COMMENT + * + * @var string + */ + protected $parser_state = self::STATE_READY; + /** + * What kind of syntax token became an HTML comment. + * + * Since there are many ways in which HTML syntax can create an HTML comment, + * this indicates which of those caused it. This allows the Tag Processor to + * represent more from the original input document than would appear in the DOM. + * + * @since 6.5.0 + * + * @var string|null + */ + protected $comment_type = \null; + /** + * Tracks a semantic location in the original HTML which + * shifts with updates as they are applied to the document. + * + * @since 6.2.0 + * @var WP_HTML_Span[] + */ + protected $bookmarks = array(); + const ADD_CLASS = \true; + const REMOVE_CLASS = \false; + const SKIP_CLASS = \null; + /** + * Lexical replacements to apply to input HTML document. + * + * "Lexical" in this class refers to the part of this class which + * operates on pure text _as text_ and not as HTML. There's a line + * between the public interface, with HTML-semantic methods like + * `set_attribute` and `add_class`, and an internal state that tracks + * text offsets in the input document. + * + * When higher-level HTML methods are called, those have to transform their + * operations (such as setting an attribute's value) into text diffing + * operations (such as replacing the sub-string from indices A to B with + * some given new string). These text-diffing operations are the lexical + * updates. + * + * As new higher-level methods are added they need to collapse their + * operations into these lower-level lexical updates since that's the + * Tag Processor's internal language of change. Any code which creates + * these lexical updates must ensure that they do not cross HTML syntax + * boundaries, however, so these should never be exposed outside of this + * class or any classes which intentionally expand its functionality. + * + * These are enqueued while editing the document instead of being immediately + * applied to avoid processing overhead, string allocations, and string + * copies when applying many updates to a single document. + * + * Example: + * + * // Replace an attribute stored with a new value, indices + * // sourced from the lazily-parsed HTML recognizer. + * $start = $attributes['src']->start; + * $length = $attributes['src']->length; + * $modifications[] = new WP_HTML_Text_Replacement( $start, $length, $new_value ); + * + * // Correspondingly, something like this will appear in this array. + * $lexical_updates = array( + * WP_HTML_Text_Replacement( 14, 28, 'https://my-site.my-domain/wp-content/uploads/2014/08/kittens.jpg' ) + * ); + * + * @since 6.2.0 + * @var WP_HTML_Text_Replacement[] + */ + protected $lexical_updates = array(); + /** + * Tracks and limits `seek()` calls to prevent accidental infinite loops. + * + * @since 6.2.0 + * @var int + * + * @see WP_HTML_Tag_Processor::seek() + */ + protected $seek_count = 0; + /** + * Constructor. + * + * @since 6.2.0 + * + * @param string $html HTML to process. + */ + public function __construct($html) + { + } + /** + * Finds the next tag matching the $query. + * + * @since 6.2.0 + * @since 6.5.0 No longer processes incomplete tokens at end of document; pauses the processor at start of token. + * + * @param array|string|null $query { + * Optional. Which tag name to find, having which class, etc. Default is to find any tag. + * + * @type string|null $tag_name Which tag to find, or `null` for "any tag." + * @type int|null $match_offset Find the Nth tag matching all search criteria. + * 1 for "first" tag, 3 for "third," etc. + * Defaults to first tag. + * @type string|null $class_name Tag must contain this whole class name to match. + * @type string|null $tag_closers "visit" or "skip": whether to stop on tag closers, e.g. </div>. + * } + * @return bool Whether a tag was matched. + * @phpstan-param null|array{ + * tag_name?: string|null, + * match_offset?: int|null, + * class_name?: string|null, + * tag_closers?: string|null, + * } $query + */ + public function next_tag($query = \null) + { + } + /** + * Finds the next token in the HTML document. + * + * An HTML document can be viewed as a stream of tokens, + * where tokens are things like HTML tags, HTML comments, + * text nodes, etc. This method finds the next token in + * the HTML document and returns whether it found one. + * + * If it starts parsing a token and reaches the end of the + * document then it will seek to the start of the last + * token and pause, returning `false` to indicate that it + * failed to find a complete token. + * + * Possible token types, based on the HTML specification: + * + * - an HTML tag, whether opening, closing, or void. + * - a text node - the plaintext inside tags. + * - an HTML comment. + * - a DOCTYPE declaration. + * - a processing instruction, e.g. `<?xml version="1.0" ?>`. + * + * The Tag Processor currently only supports the tag token. + * + * @since 6.5.0 + * + * @return bool Whether a token was parsed. + */ + public function next_token() + { + } + /** + * Whether the processor paused because the input HTML document ended + * in the middle of a syntax element, such as in the middle of a tag. + * + * Example: + * + * $processor = new WP_HTML_Tag_Processor( '<input type="text" value="Th' ); + * false === $processor->get_next_tag(); + * true === $processor->paused_at_incomplete_token(); + * + * @since 6.5.0 + * + * @return bool Whether the parse paused at the start of an incomplete token. + */ + public function paused_at_incomplete_token() + { + } + /** + * Generator for a foreach loop to step through each class name for the matched tag. + * + * This generator function is designed to be used inside a "foreach" loop. + * + * Example: + * + * $p = new WP_HTML_Tag_Processor( "<div class='free <egg<\tlang-en'>" ); + * $p->next_tag(); + * foreach ( $p->class_list() as $class_name ) { + * echo "{$class_name} "; + * } + * // Outputs: "free <egg> lang-en " + * + * @since 6.4.0 + * @phpstan-return void + */ + public function class_list() + { + } + /** + * Returns if a matched tag contains the given ASCII case-insensitive class name. + * + * @since 6.4.0 + * + * @param string $wanted_class Look for this CSS class name, ASCII case-insensitive. + * @return bool|null Whether the matched tag contains the given class name, or null if not matched. + */ + public function has_class($wanted_class) + { + } + /** + * Sets a bookmark in the HTML document. + * + * Bookmarks represent specific places or tokens in the HTML + * document, such as a tag opener or closer. When applying + * edits to a document, such as setting an attribute, the + * text offsets of that token may shift; the bookmark is + * kept updated with those shifts and remains stable unless + * the entire span of text in which the token sits is removed. + * + * Release bookmarks when they are no longer needed. + * + * Example: + * + * <main><h2>Surprising fact you may not know!</h2></main> + * ^ ^ + * \-|-- this `H2` opener bookmark tracks the token + * + * <main class="clickbait"><h2>Surprising fact you may no… + * ^ ^ + * \-|-- it shifts with edits + * + * Bookmarks provide the ability to seek to a previously-scanned + * place in the HTML document. This avoids the need to re-scan + * the entire document. + * + * Example: + * + * <ul><li>One</li><li>Two</li><li>Three</li></ul> + * ^^^^ + * want to note this last item + * + * $p = new WP_HTML_Tag_Processor( $html ); + * $in_list = false; + * while ( $p->next_tag( array( 'tag_closers' => $in_list ? 'visit' : 'skip' ) ) ) { + * if ( 'UL' === $p->get_tag() ) { + * if ( $p->is_tag_closer() ) { + * $in_list = false; + * $p->set_bookmark( 'resume' ); + * if ( $p->seek( 'last-li' ) ) { + * $p->add_class( 'last-li' ); + * } + * $p->seek( 'resume' ); + * $p->release_bookmark( 'last-li' ); + * $p->release_bookmark( 'resume' ); + * } else { + * $in_list = true; + * } + * } + * + * if ( 'LI' === $p->get_tag() ) { + * $p->set_bookmark( 'last-li' ); + * } + * } + * + * Bookmarks intentionally hide the internal string offsets + * to which they refer. They are maintained internally as + * updates are applied to the HTML document and therefore + * retain their "position" - the location to which they + * originally pointed. The inability to use bookmarks with + * functions like `substr` is therefore intentional to guard + * against accidentally breaking the HTML. + * + * Because bookmarks allocate memory and require processing + * for every applied update, they are limited and require + * a name. They should not be created with programmatically-made + * names, such as "li_{$index}" with some loop. As a general + * rule they should only be created with string-literal names + * like "start-of-section" or "last-paragraph". + * + * Bookmarks are a powerful tool to enable complicated behavior. + * Consider double-checking that you need this tool if you are + * reaching for it, as inappropriate use could lead to broken + * HTML structure or unwanted processing overhead. + * + * @since 6.2.0 + * + * @param string $name Identifies this particular bookmark. + * @return bool Whether the bookmark was successfully created. + */ + public function set_bookmark($name) + { + } + /** + * Removes a bookmark that is no longer needed. + * + * Releasing a bookmark frees up the small + * performance overhead it requires. + * + * @param string $name Name of the bookmark to remove. + * @return bool Whether the bookmark already existed before removal. + */ + public function release_bookmark($name) + { + } + /** + * Checks whether a bookmark with the given name exists. + * + * @since 6.3.0 + * + * @param string $bookmark_name Name to identify a bookmark that potentially exists. + * @return bool Whether that bookmark exists. + */ + public function has_bookmark($bookmark_name) + { + } + /** + * Move the internal cursor in the Tag Processor to a given bookmark's location. + * + * In order to prevent accidental infinite loops, there's a + * maximum limit on the number of times seek() can be called. + * + * @since 6.2.0 + * + * @param string $bookmark_name Jump to the place in the document identified by this bookmark name. + * @return bool Whether the internal cursor was successfully moved to the bookmark's location. + */ + public function seek($bookmark_name) + { + } + /** + * Returns the value of a requested attribute from a matched tag opener if that attribute exists. + * + * Example: + * + * $p = new WP_HTML_Tag_Processor( '<div enabled class="test" data-test-id="14">Test</div>' ); + * $p->next_tag( array( 'class_name' => 'test' ) ) === true; + * $p->get_attribute( 'data-test-id' ) === '14'; + * $p->get_attribute( 'enabled' ) === true; + * $p->get_attribute( 'aria-label' ) === null; + * + * $p->next_tag() === false; + * $p->get_attribute( 'class' ) === null; + * + * @since 6.2.0 + * + * @param string $name Name of attribute whose value is requested. + * @return string|true|null Value of attribute or `null` if not available. Boolean attributes return `true`. + */ + public function get_attribute($name) + { + } + /** + * Gets lowercase names of all attributes matching a given prefix in the current tag. + * + * Note that matching is case-insensitive. This is in accordance with the spec: + * + * > There must never be two or more attributes on + * > the same start tag whose names are an ASCII + * > case-insensitive match for each other. + * - HTML 5 spec + * + * Example: + * + * $p = new WP_HTML_Tag_Processor( '<div data-ENABLED class="test" DATA-test-id="14">Test</div>' ); + * $p->next_tag( array( 'class_name' => 'test' ) ) === true; + * $p->get_attribute_names_with_prefix( 'data-' ) === array( 'data-enabled', 'data-test-id' ); + * + * $p->next_tag() === false; + * $p->get_attribute_names_with_prefix( 'data-' ) === null; + * + * @since 6.2.0 + * + * @see https://html.spec.whatwg.org/multipage/syntax.html#attributes-2:ascii-case-insensitive + * + * @param string $prefix Prefix of requested attribute names. + * @return array|null List of attribute names, or `null` when no tag opener is matched. + */ + public function get_attribute_names_with_prefix($prefix) + { + } + /** + * Returns the uppercase name of the matched tag. + * + * Example: + * + * $p = new WP_HTML_Tag_Processor( '<div class="test">Test</div>' ); + * $p->next_tag() === true; + * $p->get_tag() === 'DIV'; + * + * $p->next_tag() === false; + * $p->get_tag() === null; + * + * @since 6.2.0 + * + * @return string|null Name of currently matched tag in input HTML, or `null` if none found. + */ + public function get_tag() + { + } + /** + * Indicates if the currently matched tag contains the self-closing flag. + * + * No HTML elements ought to have the self-closing flag and for those, the self-closing + * flag will be ignored. For void elements this is benign because they "self close" + * automatically. For non-void HTML elements though problems will appear if someone + * intends to use a self-closing element in place of that element with an empty body. + * For HTML foreign elements and custom elements the self-closing flag determines if + * they self-close or not. + * + * This function does not determine if a tag is self-closing, + * but only if the self-closing flag is present in the syntax. + * + * @since 6.3.0 + * + * @return bool Whether the currently matched tag contains the self-closing flag. + */ + public function has_self_closing_flag() + { + } + /** + * Indicates if the current tag token is a tag closer. + * + * Example: + * + * $p = new WP_HTML_Tag_Processor( '<div></div>' ); + * $p->next_tag( array( 'tag_name' => 'div', 'tag_closers' => 'visit' ) ); + * $p->is_tag_closer() === false; + * + * $p->next_tag( array( 'tag_name' => 'div', 'tag_closers' => 'visit' ) ); + * $p->is_tag_closer() === true; + * + * @since 6.2.0 + * + * @return bool Whether the current tag is a tag closer. + */ + public function is_tag_closer() + { + } + /** + * Indicates the kind of matched token, if any. + * + * This differs from `get_token_name()` in that it always + * returns a static string indicating the type, whereas + * `get_token_name()` may return values derived from the + * token itself, such as a tag name or processing + * instruction tag. + * + * Possible values: + * - `#tag` when matched on a tag. + * - `#text` when matched on a text node. + * - `#cdata-section` when matched on a CDATA node. + * - `#comment` when matched on a comment. + * - `#doctype` when matched on a DOCTYPE declaration. + * - `#presumptuous-tag` when matched on an empty tag closer. + * - `#funky-comment` when matched on a funky comment. + * + * @since 6.5.0 + * + * @return string|null What kind of token is matched, or null. + */ + public function get_token_type() + { + } + /** + * Returns the node name represented by the token. + * + * This matches the DOM API value `nodeName`. Some values + * are static, such as `#text` for a text node, while others + * are dynamically generated from the token itself. + * + * Dynamic names: + * - Uppercase tag name for tag matches. + * - `html` for DOCTYPE declarations. + * + * Note that if the Tag Processor is not matched on a token + * then this function will return `null`, either because it + * hasn't yet found a token or because it reached the end + * of the document without matching a token. + * + * @since 6.5.0 + * + * @return string|null Name of the matched token. + */ + public function get_token_name() + { + } + /** + * Indicates what kind of comment produced the comment node. + * + * Because there are different kinds of HTML syntax which produce + * comments, the Tag Processor tracks and exposes this as a type + * for the comment. Nominally only regular HTML comments exist as + * they are commonly known, but a number of unrelated syntax errors + * also produce comments. + * + * @see self::COMMENT_AS_ABRUPTLY_CLOSED_COMMENT + * @see self::COMMENT_AS_CDATA_LOOKALIKE + * @see self::COMMENT_AS_INVALID_HTML + * @see self::COMMENT_AS_HTML_COMMENT + * @see self::COMMENT_AS_PI_NODE_LOOKALIKE + * + * @since 6.5.0 + * + * @return string|null + */ + public function get_comment_type() + { + } + /** + * Returns the modifiable text for a matched token, or an empty string. + * + * Modifiable text is text content that may be read and changed without + * changing the HTML structure of the document around it. This includes + * the contents of `#text` nodes in the HTML as well as the inner + * contents of HTML comments, Processing Instructions, and others, even + * though these nodes aren't part of a parsed DOM tree. They also contain + * the contents of SCRIPT and STYLE tags, of TEXTAREA tags, and of any + * other section in an HTML document which cannot contain HTML markup (DATA). + * + * If a token has no modifiable text then an empty string is returned to + * avoid needless crashing or type errors. An empty string does not mean + * that a token has modifiable text, and a token with modifiable text may + * have an empty string (e.g. a comment with no contents). + * + * @since 6.5.0 + * + * @return string + */ + public function get_modifiable_text() + { + } + /** + * Updates or creates a new attribute on the currently matched tag with the passed value. + * + * For boolean attributes special handling is provided: + * - When `true` is passed as the value, then only the attribute name is added to the tag. + * - When `false` is passed, the attribute gets removed if it existed before. + * + * For string attributes, the value is escaped using the `esc_attr` function. + * + * @since 6.2.0 + * @since 6.2.1 Fix: Only create a single update for multiple calls with case-variant attribute names. + * + * @param string $name The attribute name to target. + * @param string|bool $value The new attribute value. + * @return bool Whether an attribute value was set. + */ + public function set_attribute($name, $value) + { + } + /** + * Remove an attribute from the currently-matched tag. + * + * @since 6.2.0 + * + * @param string $name The attribute name to remove. + * @return bool Whether an attribute was removed. + */ + public function remove_attribute($name) + { + } + /** + * Adds a new class name to the currently matched tag. + * + * @since 6.2.0 + * + * @param string $class_name The class name to add. + * @return bool Whether the class was set to be added. + */ + public function add_class($class_name) + { + } + /** + * Removes a class name from the currently matched tag. + * + * @since 6.2.0 + * + * @param string $class_name The class name to remove. + * @return bool Whether the class was set to be removed. + */ + public function remove_class($class_name) + { + } + /** + * Returns the string representation of the HTML Tag Processor. + * + * @since 6.2.0 + * + * @see WP_HTML_Tag_Processor::get_updated_html() + * + * @return string The processed HTML. + */ + public function __toString() + { + } + /** + * Returns the string representation of the HTML Tag Processor. + * + * @since 6.2.0 + * @since 6.2.1 Shifts the internal cursor corresponding to the applied updates. + * @since 6.4.0 No longer calls subclass method `next_tag()` after updating HTML. + * + * @return string The processed HTML. + */ + public function get_updated_html() + { + } + /** + * Parser Ready State. + * + * Indicates that the parser is ready to run and waiting for a state transition. + * It may not have started yet, or it may have just finished parsing a token and + * is ready to find the next one. + * + * @since 6.5.0 + * + * @access private + */ + const STATE_READY = 'STATE_READY'; + /** + * Parser Complete State. + * + * Indicates that the parser has reached the end of the document and there is + * nothing left to scan. It finished parsing the last token completely. + * + * @since 6.5.0 + * + * @access private + */ + const STATE_COMPLETE = 'STATE_COMPLETE'; + /** + * Parser Incomplete Input State. + * + * Indicates that the parser has reached the end of the document before finishing + * a token. It started parsing a token but there is a possibility that the input + * HTML document was truncated in the middle of a token. + * + * The parser is reset at the start of the incomplete token and has paused. There + * is nothing more than can be scanned unless provided a more complete document. + * + * @since 6.5.0 + * + * @access private + */ + const STATE_INCOMPLETE_INPUT = 'STATE_INCOMPLETE_INPUT'; + /** + * Parser Matched Tag State. + * + * Indicates that the parser has found an HTML tag and it's possible to get + * the tag name and read or modify its attributes (if it's not a closing tag). + * + * @since 6.5.0 + * + * @access private + */ + const STATE_MATCHED_TAG = 'STATE_MATCHED_TAG'; + /** + * Parser Text Node State. + * + * Indicates that the parser has found a text node and it's possible + * to read and modify that text. + * + * @since 6.5.0 + * + * @access private + */ + const STATE_TEXT_NODE = 'STATE_TEXT_NODE'; + /** + * Parser CDATA Node State. + * + * Indicates that the parser has found a CDATA node and it's possible + * to read and modify its modifiable text. Note that in HTML there are + * no CDATA nodes outside of foreign content (SVG and MathML). Outside + * of foreign content, they are treated as HTML comments. + * + * @since 6.5.0 + * + * @access private + */ + const STATE_CDATA_NODE = 'STATE_CDATA_NODE'; + /** + * Indicates that the parser has found an HTML comment and it's + * possible to read and modify its modifiable text. + * + * @since 6.5.0 + * + * @access private + */ + const STATE_COMMENT = 'STATE_COMMENT'; + /** + * Indicates that the parser has found a DOCTYPE node and it's + * possible to read and modify its modifiable text. + * + * @since 6.5.0 + * + * @access private + */ + const STATE_DOCTYPE = 'STATE_DOCTYPE'; + /** + * Indicates that the parser has found an empty tag closer `</>`. + * + * Note that in HTML there are no empty tag closers, and they + * are ignored. Nonetheless, the Tag Processor still + * recognizes them as they appear in the HTML stream. + * + * These were historically discussed as a "presumptuous tag + * closer," which would close the nearest open tag, but were + * dismissed in favor of explicitly-closing tags. + * + * @since 6.5.0 + * + * @access private + */ + const STATE_PRESUMPTUOUS_TAG = 'STATE_PRESUMPTUOUS_TAG'; + /** + * Indicates that the parser has found a "funky comment" + * and it's possible to read and modify its modifiable text. + * + * Example: + * + * </%url> + * </{"wp-bit":"query/post-author"}> + * </2> + * + * Funky comments are tag closers with invalid tag names. Note + * that in HTML these are turn into bogus comments. Nonetheless, + * the Tag Processor recognizes them in a stream of HTML and + * exposes them for inspection and modification. + * + * @since 6.5.0 + * + * @access private + */ + const STATE_FUNKY_COMMENT = 'STATE_WP_FUNKY'; + /** + * Indicates that a comment was created when encountering abruptly-closed HTML comment. + * + * Example: + * + * <!--> + * <!---> + * + * @since 6.5.0 + */ + const COMMENT_AS_ABRUPTLY_CLOSED_COMMENT = 'COMMENT_AS_ABRUPTLY_CLOSED_COMMENT'; + /** + * Indicates that a comment would be parsed as a CDATA node, + * were HTML to allow CDATA nodes outside of foreign content. + * + * Example: + * + * <![CDATA[This is a CDATA node.]]> + * + * This is an HTML comment, but it looks like a CDATA node. + * + * @since 6.5.0 + */ + const COMMENT_AS_CDATA_LOOKALIKE = 'COMMENT_AS_CDATA_LOOKALIKE'; + /** + * Indicates that a comment was created when encountering + * normative HTML comment syntax. + * + * Example: + * + * <!-- this is a comment --> + * + * @since 6.5.0 + */ + const COMMENT_AS_HTML_COMMENT = 'COMMENT_AS_HTML_COMMENT'; + /** + * Indicates that a comment would be parsed as a Processing + * Instruction node, were they to exist within HTML. + * + * Example: + * + * <?wp __( 'Like' ) ?> + * + * This is an HTML comment, but it looks like a CDATA node. + * + * @since 6.5.0 + */ + const COMMENT_AS_PI_NODE_LOOKALIKE = 'COMMENT_AS_PI_NODE_LOOKALIKE'; + /** + * Indicates that a comment was created when encountering invalid + * HTML input, a so-called "bogus comment." + * + * Example: + * + * <?nothing special> + * <!{nothing special}> + * + * @since 6.5.0 + */ + const COMMENT_AS_INVALID_HTML = 'COMMENT_AS_INVALID_HTML'; + } + /** + * HTML API: WP_HTML_Processor class + * + * @package WordPress + * @subpackage HTML-API + * @since 6.4.0 + */ + /** + * Core class used to safely parse and modify an HTML document. + * + * The HTML Processor class properly parses and modifies HTML5 documents. + * + * It supports a subset of the HTML5 specification, and when it encounters + * unsupported markup, it aborts early to avoid unintentionally breaking + * the document. The HTML Processor should never break an HTML document. + * + * While the `WP_HTML_Tag_Processor` is a valuable tool for modifying + * attributes on individual HTML tags, the HTML Processor is more capable + * and useful for the following operations: + * + * - Querying based on nested HTML structure. + * + * Eventually the HTML Processor will also support: + * - Wrapping a tag in surrounding HTML. + * - Unwrapping a tag by removing its parent. + * - Inserting and removing nodes. + * - Reading and changing inner content. + * - Navigating up or around HTML structure. + * + * ## Usage + * + * Use of this class requires three steps: + * + * 1. Call a static creator method with your input HTML document. + * 2. Find the location in the document you are looking for. + * 3. Request changes to the document at that location. + * + * Example: + * + * $processor = WP_HTML_Processor::create_fragment( $html ); + * if ( $processor->next_tag( array( 'breadcrumbs' => array( 'DIV', 'FIGURE', 'IMG' ) ) ) ) { + * $processor->add_class( 'responsive-image' ); + * } + * + * #### Breadcrumbs + * + * Breadcrumbs represent the stack of open elements from the root + * of the document or fragment down to the currently-matched node, + * if one is currently selected. Call WP_HTML_Processor::get_breadcrumbs() + * to inspect the breadcrumbs for a matched tag. + * + * Breadcrumbs can specify nested HTML structure and are equivalent + * to a CSS selector comprising tag names separated by the child + * combinator, such as "DIV > FIGURE > IMG". + * + * Since all elements find themselves inside a full HTML document + * when parsed, the return value from `get_breadcrumbs()` will always + * contain any implicit outermost elements. For example, when parsing + * with `create_fragment()` in the `BODY` context (the default), any + * tag in the given HTML document will contain `array( 'HTML', 'BODY', … )` + * in its breadcrumbs. + * + * Despite containing the implied outermost elements in their breadcrumbs, + * tags may be found with the shortest-matching breadcrumb query. That is, + * `array( 'IMG' )` matches all IMG elements and `array( 'P', 'IMG' )` + * matches all IMG elements directly inside a P element. To ensure that no + * partial matches erroneously match it's possible to specify in a query + * the full breadcrumb match all the way down from the root HTML element. + * + * Example: + * + * $html = '<figure><img><figcaption>A <em>lovely</em> day outside</figcaption></figure>'; + * // ----- Matches here. + * $processor->next_tag( array( 'breadcrumbs' => array( 'FIGURE', 'IMG' ) ) ); + * + * $html = '<figure><img><figcaption>A <em>lovely</em> day outside</figcaption></figure>'; + * // ---- Matches here. + * $processor->next_tag( array( 'breadcrumbs' => array( 'FIGURE', 'FIGCAPTION', 'EM' ) ) ); + * + * $html = '<div><img></div><img>'; + * // ----- Matches here, because IMG must be a direct child of the implicit BODY. + * $processor->next_tag( array( 'breadcrumbs' => array( 'BODY', 'IMG' ) ) ); + * + * ## HTML Support + * + * This class implements a small part of the HTML5 specification. + * It's designed to operate within its support and abort early whenever + * encountering circumstances it can't properly handle. This is + * the principle way in which this class remains as simple as possible + * without cutting corners and breaking compliance. + * + * ### Supported elements + * + * If any unsupported element appears in the HTML input the HTML Processor + * will abort early and stop all processing. This draconian measure ensures + * that the HTML Processor won't break any HTML it doesn't fully understand. + * + * The following list specifies the HTML tags that _are_ supported: + * + * - Containers: ADDRESS, BLOCKQUOTE, DETAILS, DIALOG, DIV, FOOTER, HEADER, MAIN, MENU, SPAN, SUMMARY. + * - Custom elements: All custom elements are supported. :) + * - Form elements: BUTTON, DATALIST, FIELDSET, INPUT, LABEL, LEGEND, METER, PROGRESS, SEARCH. + * - Formatting elements: B, BIG, CODE, EM, FONT, I, PRE, SMALL, STRIKE, STRONG, TT, U, WBR. + * - Heading elements: H1, H2, H3, H4, H5, H6, HGROUP. + * - Links: A. + * - Lists: DD, DL, DT, LI, OL, UL. + * - Media elements: AUDIO, CANVAS, EMBED, FIGCAPTION, FIGURE, IMG, MAP, PICTURE, SOURCE, TRACK, VIDEO. + * - Paragraph: BR, P. + * - Phrasing elements: ABBR, AREA, BDI, BDO, CITE, DATA, DEL, DFN, INS, MARK, OUTPUT, Q, SAMP, SUB, SUP, TIME, VAR. + * - Sectioning elements: ARTICLE, ASIDE, HR, NAV, SECTION. + * - Templating elements: SLOT. + * - Text decoration: RUBY. + * - Deprecated elements: ACRONYM, BLINK, CENTER, DIR, ISINDEX, KEYGEN, LISTING, MULTICOL, NEXTID, PARAM, SPACER. + * + * ### Supported markup + * + * Some kinds of non-normative HTML involve reconstruction of formatting elements and + * re-parenting of mis-nested elements. For example, a DIV tag found inside a TABLE + * may in fact belong _before_ the table in the DOM. If the HTML Processor encounters + * such a case it will stop processing. + * + * The following list specifies HTML markup that _is_ supported: + * + * - Markup involving only those tags listed above. + * - Fully-balanced and non-overlapping tags. + * - HTML with unexpected tag closers. + * - Some unbalanced or overlapping tags. + * - P tags after unclosed P tags. + * - BUTTON tags after unclosed BUTTON tags. + * - A tags after unclosed A tags that don't involve any active formatting elements. + * + * @since 6.4.0 + * + * @see WP_HTML_Tag_Processor + * @see https://html.spec.whatwg.org/ + */ + class WP_HTML_Processor extends \WP_HTML_Tag_Processor + { + /** + * The maximum number of bookmarks allowed to exist at any given time. + * + * HTML processing requires more bookmarks than basic tag processing, + * so this class constant from the Tag Processor is overwritten. + * + * @since 6.4.0 + * + * @var int + */ + const MAX_BOOKMARKS = 100; + /* + * Public Interface Functions + */ + /** + * Creates an HTML processor in the fragment parsing mode. + * + * Use this for cases where you are processing chunks of HTML that + * will be found within a bigger HTML document, such as rendered + * block output that exists within a post, `the_content` inside a + * rendered site layout. + * + * Fragment parsing occurs within a context, which is an HTML element + * that the document will eventually be placed in. It becomes important + * when special elements have different rules than others, such as inside + * a TEXTAREA or a TITLE tag where things that look like tags are text, + * or inside a SCRIPT tag where things that look like HTML syntax are JS. + * + * The context value should be a representation of the tag into which the + * HTML is found. For most cases this will be the body element. The HTML + * form is provided because a context element may have attributes that + * impact the parse, such as with a SCRIPT tag and its `type` attribute. + * + * ## Current HTML Support + * + * - The only supported context is `<body>`, which is the default value. + * - The only supported document encoding is `UTF-8`, which is the default value. + * + * @since 6.4.0 + * @since 6.6.0 Returns `static` instead of `self` so it can create subclass instances. + * + * @param string $html Input HTML fragment to process. + * @param string $context Context element for the fragment, must be default of `<body>`. + * @param string $encoding Text encoding of the document; must be default of 'UTF-8'. + * @return static|null The created processor if successful, otherwise null. + */ + public static function create_fragment($html, $context = '<body>', $encoding = 'UTF-8') + { + } + /** + * Constructor. + * + * Do not use this method. Use the static creator methods instead. + * + * @access private + * + * @since 6.4.0 + * + * @see WP_HTML_Processor::create_fragment() + * + * @param string $html HTML to process. + * @param string|null $use_the_static_create_methods_instead This constructor should not be called manually. + */ + public function __construct($html, $use_the_static_create_methods_instead = \null) + { + } + /** + * Returns the last error, if any. + * + * Various situations lead to parsing failure but this class will + * return `false` in all those cases. To determine why something + * failed it's possible to request the last error. This can be + * helpful to know to distinguish whether a given tag couldn't + * be found or if content in the document caused the processor + * to give up and abort processing. + * + * Example + * + * $processor = WP_HTML_Processor::create_fragment( '<template><strong><button><em><p><em>' ); + * false === $processor->next_tag(); + * WP_HTML_Processor::ERROR_UNSUPPORTED === $processor->get_last_error(); + * + * @since 6.4.0 + * + * @see self::ERROR_UNSUPPORTED + * @see self::ERROR_EXCEEDED_MAX_BOOKMARKS + * + * @return string|null The last error, if one exists, otherwise null. + */ + public function get_last_error() + { + } + /** + * Finds the next tag matching the $query. + * + * @todo Support matching the class name and tag name. + * + * @since 6.4.0 + * @since 6.6.0 Visits all tokens, including virtual ones. + * + * @throws Exception When unable to allocate a bookmark for the next token in the input HTML document. + * + * @param array|string|null $query { + * Optional. Which tag name to find, having which class, etc. Default is to find any tag. + * + * @type string|null $tag_name Which tag to find, or `null` for "any tag." + * @type string $tag_closers 'visit' to pause at tag closers, 'skip' or unset to only visit openers. + * @type int|null $match_offset Find the Nth tag matching all search criteria. + * 1 for "first" tag, 3 for "third," etc. + * Defaults to first tag. + * @type string|null $class_name Tag must contain this whole class name to match. + * @type string[] $breadcrumbs DOM sub-path at which element is found, e.g. `array( 'FIGURE', 'IMG' )`. + * May also contain the wildcard `*` which matches a single element, e.g. `array( 'SECTION', '*' )`. + * } + * @return bool Whether a tag was matched. + * @phpstan-param null|array{ + * tag_name?: string|null, + * tag_closers?: string, + * match_offset?: int|null, + * class_name?: string|null, + * breadcrumbs?: string[], + * } $query + */ + public function next_tag($query = \null) + { + } + /** + * Ensures internal accounting is maintained for HTML semantic rules while + * the underlying Tag Processor class is seeking to a bookmark. + * + * This doesn't currently have a way to represent non-tags and doesn't process + * semantic rules for text nodes. For access to the raw tokens consider using + * WP_HTML_Tag_Processor instead. + * + * @since 6.5.0 Added for internal support; do not use. + * + * @access private + * + * @return bool + */ + public function next_token() + { + } + /** + * Indicates if the current tag token is a tag closer. + * + * Example: + * + * $p = WP_HTML_Processor::create_fragment( '<div></div>' ); + * $p->next_tag( array( 'tag_name' => 'div', 'tag_closers' => 'visit' ) ); + * $p->is_tag_closer() === false; + * + * $p->next_tag( array( 'tag_name' => 'div', 'tag_closers' => 'visit' ) ); + * $p->is_tag_closer() === true; + * + * @since 6.6.0 Subclassed for HTML Processor. + * + * @return bool Whether the current tag is a tag closer. + */ + public function is_tag_closer() + { + } + /** + * Indicates if the currently-matched tag matches the given breadcrumbs. + * + * A "*" represents a single tag wildcard, where any tag matches, but not no tags. + * + * At some point this function _may_ support a `**` syntax for matching any number + * of unspecified tags in the breadcrumb stack. This has been intentionally left + * out, however, to keep this function simple and to avoid introducing backtracking, + * which could open up surprising performance breakdowns. + * + * Example: + * + * $processor = WP_HTML_Processor::create_fragment( '<div><span><figure><img></figure></span></div>' ); + * $processor->next_tag( 'img' ); + * true === $processor->matches_breadcrumbs( array( 'figure', 'img' ) ); + * true === $processor->matches_breadcrumbs( array( 'span', 'figure', 'img' ) ); + * false === $processor->matches_breadcrumbs( array( 'span', 'img' ) ); + * true === $processor->matches_breadcrumbs( array( 'span', '*', 'img' ) ); + * + * @since 6.4.0 + * + * @param string[] $breadcrumbs DOM sub-path at which element is found, e.g. `array( 'FIGURE', 'IMG' )`. + * May also contain the wildcard `*` which matches a single element, e.g. `array( 'SECTION', '*' )`. + * @return bool Whether the currently-matched tag is found at the given nested structure. + */ + public function matches_breadcrumbs($breadcrumbs) + { + } + /** + * Indicates if the currently-matched node expects a closing + * token, or if it will self-close on the next step. + * + * Most HTML elements expect a closer, such as a P element or + * a DIV element. Others, like an IMG element are void and don't + * have a closing tag. Special elements, such as SCRIPT and STYLE, + * are treated just like void tags. Text nodes and self-closing + * foreign content will also act just like a void tag, immediately + * closing as soon as the processor advances to the next token. + * + * @since 6.6.0 + * + * @todo When adding support for foreign content, ensure that + * this returns false for self-closing elements in the + * SVG and MathML namespace. + * + * @param ?WP_HTML_Token $node Node to examine instead of current node, if provided. + * @return bool Whether to expect a closer for the currently-matched node, + * or `null` if not matched on any token. + */ + public function expects_closer($node = \null) + { + } + /** + * Steps through the HTML document and stop at the next tag, if any. + * + * @since 6.4.0 + * + * @throws Exception When unable to allocate a bookmark for the next token in the input HTML document. + * + * @see self::PROCESS_NEXT_NODE + * @see self::REPROCESS_CURRENT_NODE + * + * @param string $node_to_process Whether to parse the next node or reprocess the current node. + * @return bool Whether a tag was matched. + */ + public function step($node_to_process = self::PROCESS_NEXT_NODE) + { + } + /** + * Computes the HTML breadcrumbs for the currently-matched node, if matched. + * + * Breadcrumbs start at the outermost parent and descend toward the matched element. + * They always include the entire path from the root HTML node to the matched element. + * + * @todo It could be more efficient to expose a generator-based version of this function + * to avoid creating the array copy on tag iteration. If this is done, it would likely + * be more useful to walk up the stack when yielding instead of starting at the top. + * + * Example + * + * $processor = WP_HTML_Processor::create_fragment( '<p><strong><em><img></em></strong></p>' ); + * $processor->next_tag( 'IMG' ); + * $processor->get_breadcrumbs() === array( 'HTML', 'BODY', 'P', 'STRONG', 'EM', 'IMG' ); + * + * @since 6.4.0 + * + * @return string[]|null Array of tag names representing path to matched node, if matched, otherwise NULL. + */ + public function get_breadcrumbs() + { + } + /** + * Returns the nesting depth of the current location in the document. + * + * Example: + * + * $processor = WP_HTML_Processor::create_fragment( '<div><p></p></div>' ); + * // The processor starts in the BODY context, meaning it has depth from the start: HTML > BODY. + * 2 === $processor->get_current_depth(); + * + * // Opening the DIV element increases the depth. + * $processor->next_token(); + * 3 === $processor->get_current_depth(); + * + * // Opening the P element increases the depth. + * $processor->next_token(); + * 4 === $processor->get_current_depth(); + * + * // The P element is closed during `next_token()` so the depth is decreased to reflect that. + * $processor->next_token(); + * 3 === $processor->get_current_depth(); + * + * @since 6.6.0 + * + * @return int Nesting-depth of current location in the document. + */ + public function get_current_depth() + { + } + /* + * HTML semantic overrides for Tag Processor + */ + /** + * Returns the uppercase name of the matched tag. + * + * The semantic rules for HTML specify that certain tags be reprocessed + * with a different tag name. Because of this, the tag name presented + * by the HTML Processor may differ from the one reported by the HTML + * Tag Processor, which doesn't apply these semantic rules. + * + * Example: + * + * $processor = new WP_HTML_Tag_Processor( '<div class="test">Test</div>' ); + * $processor->next_tag() === true; + * $processor->get_tag() === 'DIV'; + * + * $processor->next_tag() === false; + * $processor->get_tag() === null; + * + * @since 6.4.0 + * + * @return string|null Name of currently matched tag in input HTML, or `null` if none found. + */ + public function get_tag() + { + } + /** + * Indicates if the currently matched tag contains the self-closing flag. + * + * No HTML elements ought to have the self-closing flag and for those, the self-closing + * flag will be ignored. For void elements this is benign because they "self close" + * automatically. For non-void HTML elements though problems will appear if someone + * intends to use a self-closing element in place of that element with an empty body. + * For HTML foreign elements and custom elements the self-closing flag determines if + * they self-close or not. + * + * This function does not determine if a tag is self-closing, + * but only if the self-closing flag is present in the syntax. + * + * @since 6.6.0 Subclassed for the HTML Processor. + * + * @return bool Whether the currently matched tag contains the self-closing flag. + */ + public function has_self_closing_flag() + { + } + /** + * Returns the node name represented by the token. + * + * This matches the DOM API value `nodeName`. Some values + * are static, such as `#text` for a text node, while others + * are dynamically generated from the token itself. + * + * Dynamic names: + * - Uppercase tag name for tag matches. + * - `html` for DOCTYPE declarations. + * + * Note that if the Tag Processor is not matched on a token + * then this function will return `null`, either because it + * hasn't yet found a token or because it reached the end + * of the document without matching a token. + * + * @since 6.6.0 Subclassed for the HTML Processor. + * + * @return string|null Name of the matched token. + */ + public function get_token_name() + { + } + /** + * Indicates the kind of matched token, if any. + * + * This differs from `get_token_name()` in that it always + * returns a static string indicating the type, whereas + * `get_token_name()` may return values derived from the + * token itself, such as a tag name or processing + * instruction tag. + * + * Possible values: + * - `#tag` when matched on a tag. + * - `#text` when matched on a text node. + * - `#cdata-section` when matched on a CDATA node. + * - `#comment` when matched on a comment. + * - `#doctype` when matched on a DOCTYPE declaration. + * - `#presumptuous-tag` when matched on an empty tag closer. + * - `#funky-comment` when matched on a funky comment. + * + * @since 6.6.0 Subclassed for the HTML Processor. + * + * @return string|null What kind of token is matched, or null. + */ + public function get_token_type() + { + } + /** + * Returns the value of a requested attribute from a matched tag opener if that attribute exists. + * + * Example: + * + * $p = WP_HTML_Processor::create_fragment( '<div enabled class="test" data-test-id="14">Test</div>' ); + * $p->next_token() === true; + * $p->get_attribute( 'data-test-id' ) === '14'; + * $p->get_attribute( 'enabled' ) === true; + * $p->get_attribute( 'aria-label' ) === null; + * + * $p->next_tag() === false; + * $p->get_attribute( 'class' ) === null; + * + * @since 6.6.0 Subclassed for HTML Processor. + * + * @param string $name Name of attribute whose value is requested. + * @return string|true|null Value of attribute or `null` if not available. Boolean attributes return `true`. + */ + public function get_attribute($name) + { + } + /** + * Updates or creates a new attribute on the currently matched tag with the passed value. + * + * For boolean attributes special handling is provided: + * - When `true` is passed as the value, then only the attribute name is added to the tag. + * - When `false` is passed, the attribute gets removed if it existed before. + * + * For string attributes, the value is escaped using the `esc_attr` function. + * + * @since 6.6.0 Subclassed for the HTML Processor. + * + * @param string $name The attribute name to target. + * @param string|bool $value The new attribute value. + * @return bool Whether an attribute value was set. + */ + public function set_attribute($name, $value) + { + } + /** + * Remove an attribute from the currently-matched tag. + * + * @since 6.6.0 Subclassed for HTML Processor. + * + * @param string $name The attribute name to remove. + * @return bool Whether an attribute was removed. + */ + public function remove_attribute($name) + { + } + /** + * Gets lowercase names of all attributes matching a given prefix in the current tag. + * + * Note that matching is case-insensitive. This is in accordance with the spec: + * + * > There must never be two or more attributes on + * > the same start tag whose names are an ASCII + * > case-insensitive match for each other. + * - HTML 5 spec + * + * Example: + * + * $p = new WP_HTML_Tag_Processor( '<div data-ENABLED class="test" DATA-test-id="14">Test</div>' ); + * $p->next_tag( array( 'class_name' => 'test' ) ) === true; + * $p->get_attribute_names_with_prefix( 'data-' ) === array( 'data-enabled', 'data-test-id' ); + * + * $p->next_tag() === false; + * $p->get_attribute_names_with_prefix( 'data-' ) === null; + * + * @since 6.6.0 Subclassed for the HTML Processor. + * + * @see https://html.spec.whatwg.org/multipage/syntax.html#attributes-2:ascii-case-insensitive + * + * @param string $prefix Prefix of requested attribute names. + * @return array|null List of attribute names, or `null` when no tag opener is matched. + */ + public function get_attribute_names_with_prefix($prefix) + { + } + /** + * Adds a new class name to the currently matched tag. + * + * @since 6.6.0 Subclassed for the HTML Processor. + * + * @param string $class_name The class name to add. + * @return bool Whether the class was set to be added. + */ + public function add_class($class_name) + { + } + /** + * Removes a class name from the currently matched tag. + * + * @since 6.6.0 Subclassed for the HTML Processor. + * + * @param string $class_name The class name to remove. + * @return bool Whether the class was set to be removed. + */ + public function remove_class($class_name) + { + } + /** + * Returns if a matched tag contains the given ASCII case-insensitive class name. + * + * @since 6.6.0 Subclassed for the HTML Processor. + * + * @param string $wanted_class Look for this CSS class name, ASCII case-insensitive. + * @return bool|null Whether the matched tag contains the given class name, or null if not matched. + */ + public function has_class($wanted_class) + { + } + /** + * Generator for a foreach loop to step through each class name for the matched tag. + * + * This generator function is designed to be used inside a "foreach" loop. + * + * Example: + * + * $p = WP_HTML_Processor::create_fragment( "<div class='free <egg<\tlang-en'>" ); + * $p->next_tag(); + * foreach ( $p->class_list() as $class_name ) { + * echo "{$class_name} "; + * } + * // Outputs: "free <egg> lang-en " + * + * @since 6.6.0 Subclassed for the HTML Processor. + */ + public function class_list() + { + } + /** + * Returns the modifiable text for a matched token, or an empty string. + * + * Modifiable text is text content that may be read and changed without + * changing the HTML structure of the document around it. This includes + * the contents of `#text` nodes in the HTML as well as the inner + * contents of HTML comments, Processing Instructions, and others, even + * though these nodes aren't part of a parsed DOM tree. They also contain + * the contents of SCRIPT and STYLE tags, of TEXTAREA tags, and of any + * other section in an HTML document which cannot contain HTML markup (DATA). + * + * If a token has no modifiable text then an empty string is returned to + * avoid needless crashing or type errors. An empty string does not mean + * that a token has modifiable text, and a token with modifiable text may + * have an empty string (e.g. a comment with no contents). + * + * @since 6.6.0 Subclassed for the HTML Processor. + * + * @return string + */ + public function get_modifiable_text() + { + } + /** + * Indicates what kind of comment produced the comment node. + * + * Because there are different kinds of HTML syntax which produce + * comments, the Tag Processor tracks and exposes this as a type + * for the comment. Nominally only regular HTML comments exist as + * they are commonly known, but a number of unrelated syntax errors + * also produce comments. + * + * @see self::COMMENT_AS_ABRUPTLY_CLOSED_COMMENT + * @see self::COMMENT_AS_CDATA_LOOKALIKE + * @see self::COMMENT_AS_INVALID_HTML + * @see self::COMMENT_AS_HTML_COMMENT + * @see self::COMMENT_AS_PI_NODE_LOOKALIKE + * + * @since 6.6.0 Subclassed for the HTML Processor. + * + * @return string|null + */ + public function get_comment_type() + { + } + /** + * Removes a bookmark that is no longer needed. + * + * Releasing a bookmark frees up the small + * performance overhead it requires. + * + * @since 6.4.0 + * + * @param string $bookmark_name Name of the bookmark to remove. + * @return bool Whether the bookmark already existed before removal. + */ + public function release_bookmark($bookmark_name) + { + } + /** + * Moves the internal cursor in the HTML Processor to a given bookmark's location. + * + * Be careful! Seeking backwards to a previous location resets the parser to the + * start of the document and reparses the entire contents up until it finds the + * sought-after bookmarked location. + * + * In order to prevent accidental infinite loops, there's a + * maximum limit on the number of times seek() can be called. + * + * @throws Exception When unable to allocate a bookmark for the next token in the input HTML document. + * + * @since 6.4.0 + * + * @param string $bookmark_name Jump to the place in the document identified by this bookmark name. + * @return bool Whether the internal cursor was successfully moved to the bookmark's location. + */ + public function seek($bookmark_name) + { + } + /** + * Sets a bookmark in the HTML document. + * + * Bookmarks represent specific places or tokens in the HTML + * document, such as a tag opener or closer. When applying + * edits to a document, such as setting an attribute, the + * text offsets of that token may shift; the bookmark is + * kept updated with those shifts and remains stable unless + * the entire span of text in which the token sits is removed. + * + * Release bookmarks when they are no longer needed. + * + * Example: + * + * <main><h2>Surprising fact you may not know!</h2></main> + * ^ ^ + * \-|-- this `H2` opener bookmark tracks the token + * + * <main class="clickbait"><h2>Surprising fact you may no… + * ^ ^ + * \-|-- it shifts with edits + * + * Bookmarks provide the ability to seek to a previously-scanned + * place in the HTML document. This avoids the need to re-scan + * the entire document. + * + * Example: + * + * <ul><li>One</li><li>Two</li><li>Three</li></ul> + * ^^^^ + * want to note this last item + * + * $p = new WP_HTML_Tag_Processor( $html ); + * $in_list = false; + * while ( $p->next_tag( array( 'tag_closers' => $in_list ? 'visit' : 'skip' ) ) ) { + * if ( 'UL' === $p->get_tag() ) { + * if ( $p->is_tag_closer() ) { + * $in_list = false; + * $p->set_bookmark( 'resume' ); + * if ( $p->seek( 'last-li' ) ) { + * $p->add_class( 'last-li' ); + * } + * $p->seek( 'resume' ); + * $p->release_bookmark( 'last-li' ); + * $p->release_bookmark( 'resume' ); + * } else { + * $in_list = true; + * } + * } + * + * if ( 'LI' === $p->get_tag() ) { + * $p->set_bookmark( 'last-li' ); + * } + * } + * + * Bookmarks intentionally hide the internal string offsets + * to which they refer. They are maintained internally as + * updates are applied to the HTML document and therefore + * retain their "position" - the location to which they + * originally pointed. The inability to use bookmarks with + * functions like `substr` is therefore intentional to guard + * against accidentally breaking the HTML. + * + * Because bookmarks allocate memory and require processing + * for every applied update, they are limited and require + * a name. They should not be created with programmatically-made + * names, such as "li_{$index}" with some loop. As a general + * rule they should only be created with string-literal names + * like "start-of-section" or "last-paragraph". + * + * Bookmarks are a powerful tool to enable complicated behavior. + * Consider double-checking that you need this tool if you are + * reaching for it, as inappropriate use could lead to broken + * HTML structure or unwanted processing overhead. + * + * @since 6.4.0 + * + * @param string $bookmark_name Identifies this particular bookmark. + * @return bool Whether the bookmark was successfully created. + */ + public function set_bookmark($bookmark_name) + { + } + /** + * Checks whether a bookmark with the given name exists. + * + * @since 6.5.0 + * + * @param string $bookmark_name Name to identify a bookmark that potentially exists. + * @return bool Whether that bookmark exists. + */ + public function has_bookmark($bookmark_name) + { + } + /* + * HTML Specification Helpers + */ + /** + * Returns whether an element of a given name is in the HTML special category. + * + * @since 6.4.0 + * + * @see https://html.spec.whatwg.org/#special + * + * @param string $tag_name Name of element to check. + * @return bool Whether the element of the given name is in the special category. + */ + public static function is_special($tag_name) + { + } + /** + * Returns whether a given element is an HTML Void Element + * + * > area, base, br, col, embed, hr, img, input, link, meta, source, track, wbr + * + * @since 6.4.0 + * + * @see https://html.spec.whatwg.org/#void-elements + * + * @param string $tag_name Name of HTML tag to check. + * @return bool Whether the given tag is an HTML Void Element. + */ + public static function is_void($tag_name) + { + } + /* + * Constants that would pollute the top of the class if they were found there. + */ + /** + * Indicates that the next HTML token should be parsed and processed. + * + * @since 6.4.0 + * + * @var string + */ + const PROCESS_NEXT_NODE = 'process-next-node'; + /** + * Indicates that the current HTML token should be reprocessed in the newly-selected insertion mode. + * + * @since 6.4.0 + * + * @var string + */ + const REPROCESS_CURRENT_NODE = 'reprocess-current-node'; + /** + * Indicates that the current HTML token should be processed without advancing the parser. + * + * @since 6.5.0 + * + * @var string + */ + const PROCESS_CURRENT_NODE = 'process-current-node'; + /** + * Indicates that the parser encountered unsupported markup and has bailed. + * + * @since 6.4.0 + * + * @var string + */ + const ERROR_UNSUPPORTED = 'unsupported'; + /** + * Indicates that the parser encountered more HTML tokens than it + * was able to process and has bailed. + * + * @since 6.4.0 + * + * @var string + */ + const ERROR_EXCEEDED_MAX_BOOKMARKS = 'exceeded-max-bookmarks'; + /** + * Unlock code that must be passed into the constructor to create this class. + * + * This class extends the WP_HTML_Tag_Processor, which has a public class + * constructor. Therefore, it's not possible to have a private constructor here. + * + * This unlock code is used to ensure that anyone calling the constructor is + * doing so with a full understanding that it's intended to be a private API. + * + * @access private + */ + const CONSTRUCTOR_UNLOCK_CODE = 'Use WP_HTML_Processor::create_fragment() instead of calling the class constructor directly.'; + } + /** + * HTML API: WP_HTML_Span class + * + * @package WordPress + * @subpackage HTML-API + * @since 6.2.0 + */ + /** + * Core class used by the HTML tag processor to represent a textual span + * inside an HTML document. + * + * This is a two-tuple in disguise, used to avoid the memory overhead + * involved in using an array for the same purpose. + * + * This class is for internal usage of the WP_HTML_Tag_Processor class. + * + * @access private + * @since 6.2.0 + * @since 6.5.0 Replaced `end` with `length` to more closely align with `substr()`. + * + * @see WP_HTML_Tag_Processor + */ + class WP_HTML_Span + { + /** + * Byte offset into document where span begins. + * + * @since 6.2.0 + * + * @var int + */ + public $start; + /** + * Byte length of this span. + * + * @since 6.5.0 + * + * @var int + */ + public $length; + /** + * Constructor. + * + * @since 6.2.0 + * + * @param int $start Byte offset into document where replacement span begins. + * @param int $length Byte length of span. + */ + public function __construct($start, $length) + { + } + } + /** + * HTML API: WP_HTML_Stack_Event class + * + * @package WordPress + * @subpackage HTML-API + * @since 6.6.0 + */ + /** + * Core class used by the HTML Processor as a record for stack operations. + * + * This class is for internal usage of the WP_HTML_Processor class. + * + * @access private + * @since 6.6.0 + * + * @see WP_HTML_Processor + */ + class WP_HTML_Stack_Event + { + /** + * Refers to popping an element off of the stack of open elements. + * + * @since 6.6.0 + */ + const POP = 'pop'; + /** + * Refers to pushing an element onto the stack of open elements. + * + * @since 6.6.0 + */ + const PUSH = 'push'; + /** + * References the token associated with the stack push event, + * even if this is a pop event for that element. + * + * @since 6.6.0 + * + * @var WP_HTML_Token + */ + public $token; + /** + * Indicates which kind of stack operation this event represents. + * + * May be one of the class constants. + * + * @since 6.6.0 + * + * @see self::POP + * @see self::PUSH + * + * @var string + */ + public $operation; + /** + * Indicates if the stack element is a real or virtual node. + * + * @since 6.6.0 + * + * @var string + */ + public $provenance; + /** + * Constructor function. + * + * @since 6.6.0 + * + * @param WP_HTML_Token $token Token associated with stack event, always an opening token. + * @param string $operation One of self::PUSH or self::POP. + * @param string $provenance "virtual" or "real". + */ + public function __construct($token, $operation, $provenance) + { + } + } + /** + * HTML API: WP_HTML_Text_Replacement class + * + * @package WordPress + * @subpackage HTML-API + * @since 6.2.0 + */ + /** + * Core class used by the HTML tag processor as a data structure for replacing + * existing content from start to end, allowing to drastically improve performance. + * + * This class is for internal usage of the WP_HTML_Tag_Processor class. + * + * @access private + * @since 6.2.0 + * @since 6.5.0 Replace `end` with `length` to more closely match `substr()`. + * + * @see WP_HTML_Tag_Processor + */ + class WP_HTML_Text_Replacement + { + /** + * Byte offset into document where replacement span begins. + * + * @since 6.2.0 + * + * @var int + */ + public $start; + /** + * Byte length of span being replaced. + * + * @since 6.5.0 + * + * @var int + */ + public $length; + /** + * Span of text to insert in document to replace existing content from start to end. + * + * @since 6.2.0 + * + * @var string + */ + public $text; + /** + * Constructor. + * + * @since 6.2.0 + * + * @param int $start Byte offset into document where replacement span begins. + * @param int $length Byte length of span in document being replaced. + * @param string $text Span of text to insert in document to replace existing content from start to end. + */ + public function __construct($start, $length, $text) + { + } + } + /** + * HTML API: WP_HTML_Token class + * + * @package WordPress + * @subpackage HTML-API + * @since 6.4.0 + */ + /** + * Core class used by the HTML processor during HTML parsing + * for referring to tokens in the input HTML string. + * + * This class is designed for internal use by the HTML processor. + * + * @since 6.4.0 + * + * @access private + * + * @see WP_HTML_Processor + */ + class WP_HTML_Token + { + /** + * Name of bookmark corresponding to source of token in input HTML string. + * + * Having a bookmark name does not imply that the token still exists. It + * may be that the source token and underlying bookmark was wiped out by + * some modification to the source HTML. + * + * @since 6.4.0 + * + * @var string + */ + public $bookmark_name = \null; + /** + * Name of node; lowercase names such as "marker" are not HTML elements. + * + * For HTML elements/tags this value should come from WP_HTML_Processor::get_tag(). + * + * @since 6.4.0 + * + * @see WP_HTML_Processor::get_tag() + * + * @var string + */ + public $node_name = \null; + /** + * Whether node contains the self-closing flag. + * + * A node may have a self-closing flag when it shouldn't. This value + * only reports if the flag is present in the original HTML. + * + * @since 6.4.0 + * + * @see https://html.spec.whatwg.org/#self-closing-flag + * + * @var bool + */ + public $has_self_closing_flag = \false; + /** + * Called when token is garbage-collected or otherwise destroyed. + * + * @var callable|null + */ + public $on_destroy = \null; + /** + * Constructor - creates a reference to a token in some external HTML string. + * + * @since 6.4.0 + * + * @param string $bookmark_name Name of bookmark corresponding to location in HTML where token is found. + * @param string $node_name Name of node token represents; if uppercase, an HTML element; if lowercase, a special value like "marker". + * @param bool $has_self_closing_flag Whether the source token contains the self-closing flag, regardless of whether it's valid. + * @param callable $on_destroy Function to call when destroying token, useful for releasing the bookmark. + */ + public function __construct($bookmark_name, $node_name, $has_self_closing_flag, $on_destroy = \null) + { + } + /** + * Destructor. + * + * @since 6.4.0 + */ + public function __destruct() + { + } + /** + * Wakeup magic method. + * + * @since 6.4.2 + */ + public function __wakeup() + { + } + } + /** + * HTML API: WP_HTML_Unsupported_Exception class + * + * @package WordPress + * @subpackage HTML-API + * @since 6.4.0 + */ + /** + * Core class used by the HTML processor during HTML parsing + * for indicating that a given operation is unsupported. + * + * This class is designed for internal use by the HTML processor. + * + * The HTML API aims to operate in compliance with the HTML5 + * specification, but does not implement the full specification. + * In cases where it lacks support it should not cause breakage + * or unexpected behavior. In the cases where it recognizes that + * it cannot proceed, this class is used to abort from any + * operation and signify that the given HTML cannot be processed. + * + * @since 6.4.0 + * + * @access private + * + * @see WP_HTML_Processor + */ + class WP_HTML_Unsupported_Exception extends \Exception + { + } + /** + * Interactivity API: WP_Interactivity_API_Directives_Processor class. + * + * @package WordPress + * @subpackage Interactivity API + * @since 6.5.0 + */ + /** + * Class used to iterate over the tags of an HTML string and help process the + * directive attributes. + * + * @since 6.5.0 + * + * @access private + */ + final class WP_Interactivity_API_Directives_Processor extends \WP_HTML_Tag_Processor + { + /** + * List of tags whose closer tag is not visited by the WP_HTML_Tag_Processor. + * + * @since 6.5.0 + * @var string[] + */ + const TAGS_THAT_DONT_VISIT_CLOSER_TAG = array('SCRIPT', 'IFRAME', 'NOEMBED', 'NOFRAMES', 'STYLE', 'TEXTAREA', 'TITLE', 'XMP'); + /** + * Returns the content between two balanced template tags. + * + * It positions the cursor in the closer tag of the balanced template tag, + * if it exists. + * + * @since 6.5.0 + * + * @access private + * + * @return string|null The content between the current opener template tag and its matching closer tag or null if it + * doesn't find the matching closing tag or the current tag is not a template opener tag. + */ + public function get_content_between_balanced_template_tags() + { + } + /** + * Sets the content between two balanced tags. + * + * @since 6.5.0 + * + * @access private + * + * @param string $new_content The string to replace the content between the matching tags. + * @return bool Whether the content was successfully replaced. + */ + public function set_content_between_balanced_tags(string $new_content) : bool + { + } + /** + * Appends content after the closing tag of a template tag. + * + * It positions the cursor in the closer tag of the balanced template tag, + * if it exists. + * + * @access private + * + * @param string $new_content The string to append after the closing template tag. + * @return bool Whether the content was successfully appended. + */ + public function append_content_after_template_tag_closer(string $new_content) : bool + { + } + /** + * Skips processing the content between tags. + * + * It positions the cursor in the closer tag of the foreign element, if it + * exists. + * + * This function is intended to skip processing SVG and MathML inner content + * instead of bailing out the whole processing. + * + * @since 6.5.0 + * + * @access private + * + * @return bool Whether the foreign content was successfully skipped. + */ + public function skip_to_tag_closer() : bool + { + } + /** + * Finds the matching closing tag for an opening tag. + * + * When called while the processor is on an open tag, it traverses the HTML + * until it finds the matching closer tag, respecting any in-between content, + * including nested tags of the same name. Returns false when called on a + * closer tag, a tag that doesn't have a closer tag (void), a tag that + * doesn't visit the closer tag, or if no matching closing tag was found. + * + * @since 6.5.0 + * + * @access private + * + * @return bool Whether a matching closing tag was found. + */ + public function next_balanced_tag_closer_tag() : bool + { + } + /** + * Checks whether the current tag has and will visit its matching closer tag. + * + * @since 6.5.0 + * + * @access private + * + * @return bool Whether the current tag has a closer tag. + */ + public function has_and_visits_its_closer_tag() : bool + { + } + } + /** + * Interactivity API: WP_Interactivity_API class. + * + * @package WordPress + * @subpackage Interactivity API + * @since 6.5.0 + */ + /** + * Class used to process the Interactivity API on the server. + * + * @since 6.5.0 + */ + final class WP_Interactivity_API + { + /** + * Gets and/or sets the initial state of an Interactivity API store for a + * given namespace. + * + * If state for that store namespace already exists, it merges the new + * provided state with the existing one. + * + * When no namespace is specified, it returns the state defined for the + * current value in the internal namespace stack during a `process_directives` call. + * + * @since 6.5.0 + * @since 6.6.0 The `$store_namespace` param is optional. + * + * @param string $store_namespace Optional. The unique store namespace identifier. + * @param array $state Optional. The array that will be merged with the existing state for the specified + * store namespace. + * @return array The current state for the specified store namespace. This will be the updated state if a $state + * argument was provided. + */ + public function state(?string $store_namespace = \null, ?array $state = \null) : array + { + } + /** + * Gets and/or sets the configuration of the Interactivity API for a given + * store namespace. + * + * If configuration for that store namespace exists, it merges the new + * provided configuration with the existing one. + * + * @since 6.5.0 + * + * @param string $store_namespace The unique store namespace identifier. + * @param array $config Optional. The array that will be merged with the existing configuration for the + * specified store namespace. + * @return array The configuration for the specified store namespace. This will be the updated configuration if a + * $config argument was provided. + */ + public function config(string $store_namespace, array $config = array()) : array + { + } + /** + * Prints the serialized client-side interactivity data. + * + * Encodes the config and initial state into JSON and prints them inside a + * script tag of type "application/json". Once in the browser, the state will + * be parsed and used to hydrate the client-side interactivity stores and the + * configuration will be available using a `getConfig` utility. + * + * @since 6.5.0 + * @phpstan-return void + */ + public function print_client_interactivity_data() + { + } + /** + * Returns the latest value on the context stack with the passed namespace. + * + * When the namespace is omitted, it uses the current namespace on the + * namespace stack during a `process_directives` call. + * + * @since 6.6.0 + * + * @param string $store_namespace Optional. The unique store namespace identifier. + */ + public function get_context(?string $store_namespace = \null) : array + { + } + /** + * Registers the `@wordpress/interactivity` script modules. + * + * @since 6.5.0 + */ + public function register_script_modules() + { + } + /** + * Adds the necessary hooks for the Interactivity API. + * + * @since 6.5.0 + */ + public function add_hooks() + { + } + /** + * Processes the interactivity directives contained within the HTML content + * and updates the markup accordingly. + * + * @since 6.5.0 + * + * @param string $html The HTML content to process. + * @return string The processed HTML content. It returns the original content when the HTML contains unbalanced tags. + */ + public function process_directives(string $html) : string + { + } + /** + * Outputs the markup for the top loading indicator and the screen reader + * notifications during client-side navigations. + * + * This method prints a div element representing a loading bar visible during + * navigation, as well as an aria-live region that can be read by screen + * readers to announce navigation status. + * + * @since 6.5.0 + */ + public function print_router_loading_and_screen_reader_markup() + { + } + } + /** + * I18N: WP_Translation_Controller class. + * + * @package WordPress + * @subpackage I18N + * @since 6.5.0 + */ + /** + * Class WP_Translation_Controller. + * + * @since 6.5.0 + */ + final class WP_Translation_Controller + { + /** + * Utility method to retrieve the main instance of the class. + * + * The instance will be created if it does not exist yet. + * + * @since 6.5.0 + * + * @return WP_Translation_Controller + */ + public static function get_instance() : \WP_Translation_Controller + { + } + /** + * Returns the current locale. + * + * @since 6.5.0 + * + * @return string Locale. + */ + public function get_locale() : string + { + } + /** + * Sets the current locale. + * + * @since 6.5.0 + * + * @param string $locale Locale. + */ + public function set_locale(string $locale) + { + } + /** + * Loads a translation file for a given text domain. + * + * @since 6.5.0 + * + * @param string $translation_file Translation file. + * @param string $textdomain Optional. Text domain. Default 'default'. + * @param string $locale Optional. Locale. Default current locale. + * @return bool True on success, false otherwise. + */ + public function load_file(string $translation_file, string $textdomain = 'default', ?string $locale = \null) : bool + { + } + /** + * Unloads a translation file for a given text domain. + * + * @since 6.5.0 + * + * @param WP_Translation_File|string $file Translation file instance or file name. + * @param string $textdomain Optional. Text domain. Default 'default'. + * @param string $locale Optional. Locale. Defaults to all locales. + * @return bool True on success, false otherwise. + */ + public function unload_file($file, string $textdomain = 'default', ?string $locale = \null) : bool + { + } + /** + * Unloads all translation files for a given text domain. + * + * @since 6.5.0 + * + * @param string $textdomain Optional. Text domain. Default 'default'. + * @param string $locale Optional. Locale. Defaults to all locales. + * @return bool True on success, false otherwise. + */ + public function unload_textdomain(string $textdomain = 'default', ?string $locale = \null) : bool + { + } + /** + * Determines whether translations are loaded for a given text domain. + * + * @since 6.5.0 + * + * @param string $textdomain Optional. Text domain. Default 'default'. + * @param string $locale Optional. Locale. Default current locale. + * @return bool True if there are any loaded translations, false otherwise. + */ + public function is_textdomain_loaded(string $textdomain = 'default', ?string $locale = \null) : bool + { + } + /** + * Translates a singular string. + * + * @since 6.5.0 + * + * @param string $text Text to translate. + * @param string $context Optional. Context for the string. Default empty string. + * @param string $textdomain Optional. Text domain. Default 'default'. + * @param string $locale Optional. Locale. Default current locale. + * @return string|false Translation on success, false otherwise. + */ + public function translate(string $text, string $context = '', string $textdomain = 'default', ?string $locale = \null) + { + } + /** + * Translates plurals. + * + * Checks both singular+plural combinations as well as just singulars, + * in case the translation file does not store the plural. + * + * @since 6.5.0 + * + * @param array $plurals { + * Pair of singular and plural translations. + * + * @type string $0 Singular translation. + * @type string $1 Plural translation. + * } + * @param int $number Number of items. + * @param string $context Optional. Context for the string. Default empty string. + * @param string $textdomain Optional. Text domain. Default 'default'. + * @param string|null $locale Optional. Locale. Default current locale. + * @return string|false Translation on success, false otherwise. + * @phpstan-param array{ + * 0: string, + * 1: string, + * } $plurals + */ + public function translate_plural(array $plurals, int $number, string $context = '', string $textdomain = 'default', ?string $locale = \null) + { + } + /** + * Returns all existing headers for a given text domain. + * + * @since 6.5.0 + * + * @param string $textdomain Optional. Text domain. Default 'default'. + * @return array<string, string> Headers. + */ + public function get_headers(string $textdomain = 'default') : array + { + } + /** + * Returns all entries for a given text domain. + * + * @since 6.5.0 + * + * @param string $textdomain Optional. Text domain. Default 'default'. + * @return array<string, string> Entries. + */ + public function get_entries(string $textdomain = 'default') : array + { + } + } + /** + * I18N: WP_Translation_File class. + * + * @package WordPress + * @subpackage I18N + * @since 6.5.0 + */ + /** + * Class WP_Translation_File. + * + * @since 6.5.0 + */ + abstract class WP_Translation_File + { + /** + * List of headers. + * + * @since 6.5.0 + * @var array<string, string> + */ + protected $headers = array(); + /** + * Whether file has been parsed. + * + * @since 6.5.0 + * @var bool + */ + protected $parsed = \false; + /** + * Error information. + * + * @since 6.5.0 + * @var string|null Error message or null if no error. + */ + protected $error; + /** + * File name. + * + * @since 6.5.0 + * @var string + */ + protected $file = ''; + /** + * Translation entries. + * + * @since 6.5.0 + * @var array<string, string> + */ + protected $entries = array(); + /** + * Plural forms function. + * + * @since 6.5.0 + * @var callable|null Plural forms. + */ + protected $plural_forms = \null; + /** + * Constructor. + * + * @since 6.5.0 + * + * @param string $file File to load. + */ + protected function __construct(string $file) + { + } + /** + * Creates a new WP_Translation_File instance for a given file. + * + * @since 6.5.0 + * + * @param string $file File name. + * @param string|null $filetype Optional. File type. Default inferred from file name. + * @return false|WP_Translation_File + */ + public static function create(string $file, ?string $filetype = \null) + { + } + /** + * Creates a new WP_Translation_File instance for a given file. + * + * @since 6.5.0 + * + * @param string $file Source file name. + * @param string $filetype Desired target file type. + * @return string|false Transformed translation file contents on success, false otherwise. + */ + public static function transform(string $file, string $filetype) + { + } + /** + * Returns all headers. + * + * @since 6.5.0 + * + * @return array<string, string> Headers. + */ + public function headers() : array + { + } + /** + * Returns all entries. + * + * @since 6.5.0 + * + * @return array<string, string[]> Entries. + */ + public function entries() : array + { + } + /** + * Returns the current error information. + * + * @since 6.5.0 + * + * @return string|null Error message or null if no error. + */ + public function error() + { + } + /** + * Returns the file name. + * + * @since 6.5.0 + * + * @return string File name. + */ + public function get_file() : string + { + } + /** + * Translates a given string. + * + * @since 6.5.0 + * + * @param string $text String to translate. + * @return false|string Translation(s) on success, false otherwise. + */ + public function translate(string $text) + { + } + /** + * Returns the plural form for a given number. + * + * @since 6.5.0 + * + * @param int $number Count. + * @return int Plural form. + */ + public function get_plural_form(int $number) : int + { + } + /** + * Returns the plural forms expression as a tuple. + * + * @since 6.5.0 + * + * @param string $header Plural-Forms header string. + * @return string Plural forms expression. + */ + protected function get_plural_expression_from_header(string $header) : string + { + } + /** + * Makes a function, which will return the right translation index, according to the + * plural forms header. + * + * @since 6.5.0 + * + * @param string $expression Plural form expression. + * @return callable(int $num): int Plural forms function. + */ + protected function make_plural_form_function(string $expression) : callable + { + } + /** + * Imports translations from another file. + * + * @since 6.5.0 + * + * @param WP_Translation_File $source Source file. + * @return bool True on success, false otherwise. + */ + protected function import(\WP_Translation_File $source) : bool + { + } + /** + * Parses the file. + * + * @since 6.5.0 + */ + protected abstract function parse_file(); + /** + * Exports translation contents as a string. + * + * @since 6.5.0 + * + * @return string Translation file contents. + */ + public abstract function export(); + } + /** + * I18N: WP_Translation_File_MO class. + * + * @package WordPress + * @subpackage I18N + * @since 6.5.0 + */ + /** + * Class WP_Translation_File_MO. + * + * @since 6.5.0 + */ + class WP_Translation_File_MO extends \WP_Translation_File + { + /** + * Endian value. + * + * V for little endian, N for big endian, or false. + * + * Used for unpack(). + * + * @since 6.5.0 + * @var false|'V'|'N' + */ + protected $uint32 = \false; + /** + * The magic number of the GNU message catalog format. + * + * @since 6.5.0 + * @var int + */ + const MAGIC_MARKER = 0x950412de; + /** + * Detects endian and validates file. + * + * @since 6.5.0 + * + * @param string $header File contents. + * @return false|'V'|'N' V for little endian, N for big endian, or false on failure. + */ + protected function detect_endian_and_validate_file(string $header) + { + } + /** + * Parses the file. + * + * @since 6.5.0 + * + * @return bool True on success, false otherwise. + */ + protected function parse_file() : bool + { + } + /** + * Exports translation contents as a string. + * + * @since 6.5.0 + * + * @return string Translation file contents. + */ + public function export() : string + { + } + } + /** + * I18N: WP_Translation_File_PHP class. + * + * @package WordPress + * @subpackage I18N + * @since 6.5.0 + */ + /** + * Class WP_Translation_File_PHP. + * + * @since 6.5.0 + */ + class WP_Translation_File_PHP extends \WP_Translation_File + { + /** + * Parses the file. + * + * @since 6.5.0 + * @phpstan-return void + */ + protected function parse_file() + { + } + /** + * Exports translation contents as a string. + * + * @since 6.5.0 + * + * @return string Translation file contents. + */ + public function export() : string + { + } + } + /** + * I18N: WP_Translations class. + * + * @package WordPress + * @subpackage I18N + * @since 6.5.0 + */ + /** + * Class WP_Translations. + * + * @since 6.5.0 + * + * @property-read array<string, string> $headers + * @property-read array<string, string[]> $entries + */ + class WP_Translations + { + /** + * Text domain. + * + * @since 6.5.0 + * @var string + */ + protected $textdomain = 'default'; + /** + * Translation controller instance. + * + * @since 6.5.0 + * @var WP_Translation_Controller + */ + protected $controller; + /** + * Constructor. + * + * @since 6.5.0 + * + * @param WP_Translation_Controller $controller I18N controller. + * @param string $textdomain Optional. Text domain. Default 'default'. + */ + public function __construct(\WP_Translation_Controller $controller, string $textdomain = 'default') + { + } + /** + * Magic getter for backward compatibility. + * + * @since 6.5.0 + * + * @param string $name Property name. + * @return mixed + */ + public function __get(string $name) + { + } + /** + * Translates a plural string. + * + * @since 6.5.0 + * + * @param string|null $singular Singular string. + * @param string|null $plural Plural string. + * @param int|float $count Count. Should be an integer, but some plugins pass floats. + * @param string|null $context Context. + * @return string|null Translation if it exists, or the unchanged singular string. + */ + public function translate_plural($singular, $plural, $count = 1, $context = '') + { + } + /** + * Translates a singular string. + * + * @since 6.5.0 + * + * @param string|null $singular Singular string. + * @param string|null $context Context. + * @return string|null Translation if it exists, or the unchanged singular string + */ + public function translate($singular, $context = '') + { + } + } + class wp_atom_server + { + public function __call($name, $arguments) + { + } + public static function __callStatic($name, $arguments) + { + } + } + /** + * Translation_Entry class encapsulates a translatable string. + * + * @since 2.8.0 + */ + #[\AllowDynamicProperties] + class Translation_Entry + { + /** + * Whether the entry contains a string and its plural form, default is false. + * + * @var bool + */ + public $is_plural = \false; + public $context = \null; + public $singular = \null; + public $plural = \null; + public $translations = array(); + public $translator_comments = ''; + public $extracted_comments = ''; + public $references = array(); + public $flags = array(); + /** + * @param array $args { + * Arguments array, supports the following keys: + * + * @type string $singular The string to translate, if omitted an + * empty entry will be created. + * @type string $plural The plural form of the string, setting + * this will set `$is_plural` to true. + * @type array $translations Translations of the string and possibly + * its plural forms. + * @type string $context A string differentiating two equal strings + * used in different contexts. + * @type string $translator_comments Comments left by translators. + * @type string $extracted_comments Comments left by developers. + * @type array $references Places in the code this string is used, in + * relative_to_root_path/file.php:linenum form. + * @type array $flags Flags like php-format. + * } + * @phpstan-param array{ + * singular?: string, + * plural?: string, + * translations?: array, + * context?: string, + * translator_comments?: string, + * extracted_comments?: string, + * references?: array, + * flags?: array, + * } $args + * @phpstan-return void + */ + public function __construct($args = array()) + { + } + /** + * PHP4 constructor. + * + * @since 2.8.0 + * @deprecated 5.4.0 Use __construct() instead. + * + * @see Translation_Entry::__construct() + */ + public function Translation_Entry($args = array()) + { + } + /** + * Generates a unique key for this entry. + * + * @since 2.8.0 + * + * @return string|false The key or false if the entry is null. + */ + public function key() + { + } + /** + * Merges another translation entry with the current one. + * + * @since 2.8.0 + * + * @param Translation_Entry $other Other translation entry. + */ + public function merge_with(&$other) + { + } + } + /** + * Translations class. + * + * @since 2.8.0 + */ + #[\AllowDynamicProperties] + class Translations + { + /** + * List of translation entries. + * + * @since 2.8.0 + * + * @var Translation_Entry[] + */ + public $entries = array(); + /** + * List of translation headers. + * + * @since 2.8.0 + * + * @var array<string, string> + */ + public $headers = array(); + /** + * Adds an entry to the PO structure. + * + * @since 2.8.0 + * + * @param array|Translation_Entry $entry + * @return bool True on success, false if the entry doesn't have a key. + */ + public function add_entry($entry) + { + } + /** + * Adds or merges an entry to the PO structure. + * + * @since 2.8.0 + * + * @param array|Translation_Entry $entry + * @return bool True on success, false if the entry doesn't have a key. + */ + public function add_entry_or_merge($entry) + { + } + /** + * Sets $header PO header to $value + * + * If the header already exists, it will be overwritten + * + * TODO: this should be out of this class, it is gettext specific + * + * @since 2.8.0 + * + * @param string $header header name, without trailing : + * @param string $value header value, without trailing \n + */ + public function set_header($header, $value) + { + } + /** + * Sets translation headers. + * + * @since 2.8.0 + * + * @param array $headers Associative array of headers. + */ + public function set_headers($headers) + { + } + /** + * Returns a given translation header. + * + * @since 2.8.0 + * + * @param string $header + * @return string|false Header if it exists, false otherwise. + */ + public function get_header($header) + { + } + /** + * Returns a given translation entry. + * + * @since 2.8.0 + * + * @param Translation_Entry $entry Translation entry. + * @return Translation_Entry|false Translation entry if it exists, false otherwise. + */ + public function translate_entry(&$entry) + { + } + /** + * Translates a singular string. + * + * @since 2.8.0 + * + * @param string $singular + * @param string $context + * @return string + */ + public function translate($singular, $context = \null) + { + } + /** + * Given the number of items, returns the 0-based index of the plural form to use + * + * Here, in the base Translations class, the common logic for English is implemented: + * 0 if there is one element, 1 otherwise + * + * This function should be overridden by the subclasses. For example MO/PO can derive the logic + * from their headers. + * + * @since 2.8.0 + * + * @param int $count Number of items. + * @return int Plural form to use. + */ + public function select_plural_form($count) + { + } + /** + * Returns the plural forms count. + * + * @since 2.8.0 + * + * @return int Plural forms count. + */ + public function get_plural_forms_count() + { + } + /** + * Translates a plural string. + * + * @since 2.8.0 + * + * @param string $singular + * @param string $plural + * @param int $count + * @param string $context + * @return string + */ + public function translate_plural($singular, $plural, $count, $context = \null) + { + } + /** + * Merges other translations into the current one. + * + * @since 2.8.0 + * + * @param Translations $other Another Translation object, whose translations will be merged in this one (passed by reference). + */ + public function merge_with(&$other) + { + } + /** + * Merges originals with existing entries. + * + * @since 2.8.0 + * + * @param Translations $other + */ + public function merge_originals_with(&$other) + { + } + } + /** + * Gettext_Translations class. + * + * @since 2.8.0 + */ + class Gettext_Translations extends \Translations + { + /** + * Number of plural forms. + * + * @var int + * + * @since 2.8.0 + */ + public $_nplurals; + /** + * Callback to retrieve the plural form. + * + * @var callable + * + * @since 2.8.0 + */ + public $_gettext_select_plural_form; + /** + * The gettext implementation of select_plural_form. + * + * It lives in this class, because there are more than one descendant, which will use it and + * they can't share it effectively. + * + * @since 2.8.0 + * + * @param int $count Plural forms count. + * @return int Plural form to use. + */ + public function gettext_select_plural_form($count) + { + } + /** + * Returns the nplurals and plural forms expression from the Plural-Forms header. + * + * @since 2.8.0 + * + * @param string $header + * @return array{0: int, 1: string} + */ + public function nplurals_and_expression_from_header($header) + { + } + /** + * Makes a function, which will return the right translation index, according to the + * plural forms header. + * + * @since 2.8.0 + * + * @param int $nplurals + * @param string $expression + * @return callable + */ + public function make_plural_form_function($nplurals, $expression) + { + } + /** + * Adds parentheses to the inner parts of ternary operators in + * plural expressions, because PHP evaluates ternary operators from left to right + * + * @since 2.8.0 + * @deprecated 6.5.0 Use the Plural_Forms class instead. + * + * @see Plural_Forms + * + * @param string $expression the expression without parentheses + * @return string the expression with parentheses added + */ + public function parenthesize_plural_exression($expression) + { + } + /** + * Prepare translation headers. + * + * @since 2.8.0 + * + * @param string $translation + * @return array<string, string> Translation headers + */ + public function make_headers($translation) + { + } + /** + * Sets translation headers. + * + * @since 2.8.0 + * + * @param string $header + * @param string $value + */ + public function set_header($header, $value) + { + } + } + class MO extends \Gettext_Translations + { + /** + * Number of plural forms. + * + * @var int + */ + public $_nplurals = 2; + /** + * Returns the loaded MO file. + * + * @return string The loaded MO file. + */ + public function get_filename() + { + } + /** + * Fills up with the entries from MO file $filename + * + * @param string $filename MO file to load + * @return bool True if the import from file was successful, otherwise false. + */ + public function import_from_file($filename) + { + } + /** + * @param string $filename + * @return bool + */ + public function export_to_file($filename) + { + } + /** + * @return string|false + */ + public function export() + { + } + /** + * @param Translation_Entry $entry + * @return bool + */ + public function is_entry_good_for_export($entry) + { + } + /** + * @param resource $fh + * @return true + */ + public function export_to_file_handle($fh) + { + } + /** + * @param Translation_Entry $entry + * @return string + */ + public function export_original($entry) + { + } + /** + * @param Translation_Entry $entry + * @return string + */ + public function export_translations($entry) + { + } + /** + * @return string + */ + public function export_headers() + { + } + /** + * @param int $magic + * @return string|false + */ + public function get_byteorder($magic) + { + } + /** + * @param POMO_FileReader $reader + * @return bool True if the import was successful, otherwise false. + */ + public function import_from_reader($reader) + { + } + /** + * Build a Translation_Entry from original string and translation strings, + * found in a MO file + * + * @static + * @param string $original original string to translate from MO file. Might contain + * 0x04 as context separator or 0x00 as singular/plural separator + * @param string $translation translation string from MO file. Might contain + * 0x00 as a plural translations separator + * @return Translation_Entry Entry instance. + */ + public function &make_entry($original, $translation) + { + } + /** + * @param int $count + * @return string + */ + public function select_plural_form($count) + { + } + /** + * @return int + */ + public function get_plural_forms_count() + { + } + } + #[\AllowDynamicProperties] + class Plural_Forms + { + /** + * Operator characters. + * + * @since 4.9.0 + * @var string OP_CHARS Operator characters. + */ + const OP_CHARS = '|&><!=%?:'; + /** + * Valid number characters. + * + * @since 4.9.0 + * @var string NUM_CHARS Valid number characters. + */ + const NUM_CHARS = '0123456789'; + /** + * Operator precedence. + * + * Operator precedence from highest to lowest. Higher numbers indicate + * higher precedence, and are executed first. + * + * @see https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Operator_precedence + * + * @since 4.9.0 + * @var array $op_precedence Operator precedence from highest to lowest. + */ + protected static $op_precedence = array('%' => 6, '<' => 5, '<=' => 5, '>' => 5, '>=' => 5, '==' => 4, '!=' => 4, '&&' => 3, '||' => 2, '?:' => 1, '?' => 1, '(' => 0, ')' => 0); + /** + * Tokens generated from the string. + * + * @since 4.9.0 + * @var array $tokens List of tokens. + */ + protected $tokens = array(); + /** + * Cache for repeated calls to the function. + * + * @since 4.9.0 + * @var array $cache Map of $n => $result + */ + protected $cache = array(); + /** + * Constructor. + * + * @since 4.9.0 + * + * @param string $str Plural function (just the bit after `plural=` from Plural-Forms) + */ + public function __construct($str) + { + } + /** + * Parse a Plural-Forms string into tokens. + * + * Uses the shunting-yard algorithm to convert the string to Reverse Polish + * Notation tokens. + * + * @since 4.9.0 + * + * @throws Exception If there is a syntax or parsing error with the string. + * + * @param string $str String to parse. + */ + protected function parse($str) + { + } + /** + * Get the plural form for a number. + * + * Caches the value for repeated calls. + * + * @since 4.9.0 + * + * @param int $num Number to get plural form for. + * @return int Plural form value. + */ + public function get($num) + { + } + /** + * Execute the plural form function. + * + * @since 4.9.0 + * + * @throws Exception If the plural form value cannot be calculated. + * + * @param int $n Variable "n" to substitute. + * @return int Plural form value. + */ + public function execute($n) + { + } + } + class PO extends \Gettext_Translations + { + public $comments_before_headers = ''; + /** + * Exports headers to a PO entry + * + * @return string msgid/msgstr PO entry for this PO file headers, doesn't contain newline at the end + */ + public function export_headers() + { + } + /** + * Exports all entries to PO format + * + * @return string sequence of msgid/msgstr PO strings, doesn't contain a newline at the end + */ + public function export_entries() + { + } + /** + * Exports the whole PO file as a string + * + * @param bool $include_headers whether to include the headers in the export + * @return string ready for inclusion in PO file string for headers and all the entries + */ + public function export($include_headers = \true) + { + } + /** + * Same as {@link export}, but writes the result to a file + * + * @param string $filename Where to write the PO string. + * @param bool $include_headers Whether to include the headers in the export. + * @return bool true on success, false on error + */ + public function export_to_file($filename, $include_headers = \true) + { + } + /** + * Text to include as a comment before the start of the PO contents + * + * Doesn't need to include # in the beginning of lines, these are added automatically + * + * @param string $text Text to include as a comment. + */ + public function set_comment_before_headers($text) + { + } + /** + * Formats a string in PO-style + * + * @param string $input_string the string to format + * @return string the poified string + */ + public static function poify($input_string) + { + } + /** + * Gives back the original string from a PO-formatted string + * + * @param string $input_string PO-formatted string + * @return string unescaped string + */ + public static function unpoify($input_string) + { + } + /** + * Inserts $with in the beginning of every new line of $input_string and + * returns the modified string + * + * @param string $input_string prepend lines in this string + * @param string $with prepend lines with this string + */ + public static function prepend_each_line($input_string, $with) + { + } + /** + * Prepare a text as a comment -- wraps the lines and prepends # + * and a special character to each line + * + * @access private + * @param string $text the comment text + * @param string $char character to denote a special PO comment, + * like :, default is a space + */ + public static function comment_block($text, $char = ' ') + { + } + /** + * Builds a string from the entry for inclusion in PO file + * + * @param Translation_Entry $entry the entry to convert to po string. + * @return string|false PO-style formatted string for the entry or + * false if the entry is empty + */ + public static function export_entry($entry) + { + } + public static function match_begin_and_end_newlines($translation, $original) + { + } + /** + * @param string $filename + * @return bool + */ + public function import_from_file($filename) + { + } + /** + * Helper function for read_entry + * + * @param string $context + * @return bool + */ + protected static function is_final($context) + { + } + /** + * @param resource $f + * @param int $lineno + * @return null|false|array + */ + public function read_entry($f, $lineno = 0) + { + } + /** + * @param resource $f + * @param string $action + * @return bool + */ + public function read_line($f, $action = 'read') + { + } + /** + * @param Translation_Entry $entry + * @param string $po_comment_line + */ + public function add_comment_to_entry(&$entry, $po_comment_line) + { + } + /** + * @param string $s + * @return string + */ + public static function trim_quotes($s) + { + } + } + #[\AllowDynamicProperties] + class POMO_Reader + { + public $endian = 'little'; + public $_pos; + public $is_overloaded; + /** + * PHP5 constructor. + */ + public function __construct() + { + } + /** + * PHP4 constructor. + * + * @deprecated 5.4.0 Use __construct() instead. + * + * @see POMO_Reader::__construct() + */ + public function POMO_Reader() + { + } + /** + * Sets the endianness of the file. + * + * @param string $endian Set the endianness of the file. Accepts 'big', or 'little'. + * @phpstan-param 'big'|'little' $endian + */ + public function setEndian($endian) + { + } + /** + * Reads a 32bit Integer from the Stream + * + * @return mixed The integer, corresponding to the next 32 bits from + * the stream of false if there are not enough bytes or on error + */ + public function readint32() + { + } + /** + * Reads an array of 32-bit Integers from the Stream + * + * @param int $count How many elements should be read + * @return mixed Array of integers or false if there isn't + * enough data or on error + */ + public function readint32array($count) + { + } + /** + * @param string $input_string + * @param int $start + * @param int $length + * @return string + */ + public function substr($input_string, $start, $length) + { + } + /** + * @param string $input_string + * @return int + */ + public function strlen($input_string) + { + } + /** + * @param string $input_string + * @param int $chunk_size + * @return array + */ + public function str_split($input_string, $chunk_size) + { + } + /** + * @return int + */ + public function pos() + { + } + /** + * @return true + */ + public function is_resource() + { + } + /** + * @return true + */ + public function close() + { + } + } + class POMO_FileReader extends \POMO_Reader + { + /** + * File pointer resource. + * + * @var resource|false + */ + public $_f; + /** + * @param string $filename + */ + public function __construct($filename) + { + } + /** + * PHP4 constructor. + * + * @deprecated 5.4.0 Use __construct() instead. + * + * @see POMO_FileReader::__construct() + */ + public function POMO_FileReader($filename) + { + } + /** + * @param int $bytes + * @return string|false Returns read string, otherwise false. + */ + public function read($bytes) + { + } + /** + * @param int $pos + * @return bool + */ + public function seekto($pos) + { + } + /** + * @return bool + */ + public function is_resource() + { + } + /** + * @return bool + */ + public function feof() + { + } + /** + * @return bool + */ + public function close() + { + } + /** + * @return string + */ + public function read_all() + { + } + } + /** + * Provides file-like methods for manipulating a string instead + * of a physical file. + */ + class POMO_StringReader extends \POMO_Reader + { + public $_str = ''; + /** + * PHP5 constructor. + */ + public function __construct($str = '') + { + } + /** + * PHP4 constructor. + * + * @deprecated 5.4.0 Use __construct() instead. + * + * @see POMO_StringReader::__construct() + */ + public function POMO_StringReader($str = '') + { + } + /** + * @param string $bytes + * @return string + */ + public function read($bytes) + { + } + /** + * @param int $pos + * @return int + */ + public function seekto($pos) + { + } + /** + * @return int + */ + public function length() + { + } + /** + * @return string + */ + public function read_all() + { + } + } + /** + * Reads the contents of the file in the beginning. + */ + class POMO_CachedFileReader extends \POMO_StringReader + { + /** + * PHP5 constructor. + */ + public function __construct($filename) + { + } + /** + * PHP4 constructor. + * + * @deprecated 5.4.0 Use __construct() instead. + * + * @see POMO_CachedFileReader::__construct() + */ + public function POMO_CachedFileReader($filename) + { + } + } + /** + * Reads the contents of the file in the beginning. + */ + class POMO_CachedIntFileReader extends \POMO_CachedFileReader + { + /** + * PHP5 constructor. + */ + public function __construct($filename) + { + } + /** + * PHP4 constructor. + * + * @deprecated 5.4.0 Use __construct() instead. + * + * @see POMO_CachedIntFileReader::__construct() + */ + public function POMO_CachedIntFileReader($filename) + { + } + } + /** + * Provides the same interface as Translations, but doesn't do anything. + * + * @since 2.8.0 + */ + #[\AllowDynamicProperties] + class NOOP_Translations + { + /** + * List of translation entries. + * + * @since 2.8.0 + * + * @var Translation_Entry[] + */ + public $entries = array(); + /** + * List of translation headers. + * + * @since 2.8.0 + * + * @var array<string, string> + */ + public $headers = array(); + public function add_entry($entry) + { + } + /** + * Sets a translation header. + * + * @since 2.8.0 + * + * @param string $header + * @param string $value + */ + public function set_header($header, $value) + { + } + /** + * Sets translation headers. + * + * @since 2.8.0 + * + * @param array $headers + */ + public function set_headers($headers) + { + } + /** + * Returns a translation header. + * + * @since 2.8.0 + * + * @param string $header + * @return false + */ + public function get_header($header) + { + } + /** + * Returns a given translation entry. + * + * @since 2.8.0 + * + * @param Translation_Entry $entry + * @return false + */ + public function translate_entry(&$entry) + { + } + /** + * Translates a singular string. + * + * @since 2.8.0 + * + * @param string $singular + * @param string $context + */ + public function translate($singular, $context = \null) + { + } + /** + * Returns the plural form to use. + * + * @since 2.8.0 + * + * @param int $count + * @return int + */ + public function select_plural_form($count) + { + } + /** + * Returns the plural forms count. + * + * @since 2.8.0 + * + * @return int + */ + public function get_plural_forms_count() + { + } + /** + * Translates a plural string. + * + * @since 2.8.0 + * + * @param string $singular + * @param string $plural + * @param int $count + * @param string $context + * @return string + */ + public function translate_plural($singular, $plural, $count, $context = \null) + { + } + /** + * Merges other translations into the current one. + * + * @since 2.8.0 + * + * @param Translations $other + */ + public function merge_with(&$other) + { + } + } + /** + * REST API: WP_REST_Request class + * + * @package WordPress + * @subpackage REST_API + * @since 4.4.0 + */ + /** + * Core class used to implement a REST request object. + * + * Contains data from the request, to be passed to the callback. + * + * Note: This implements ArrayAccess, and acts as an array of parameters when + * used in that manner. It does not use ArrayObject (as we cannot rely on SPL), + * so be aware it may have non-array behavior in some cases. + * + * Note: When using features provided by ArrayAccess, be aware that WordPress deliberately + * does not distinguish between arguments of the same name for different request methods. + * For instance, in a request with `GET id=1` and `POST id=2`, `$request['id']` will equal + * 2 (`POST`) not 1 (`GET`). For more precision between request methods, use + * WP_REST_Request::get_body_params(), WP_REST_Request::get_url_params(), etc. + * + * @since 4.4.0 + * + * @link https://www.php.net/manual/en/class.arrayaccess.php + * @phpstan-template T of array + * @phpstan-implements ArrayAccess<key-of<T>, value-of<T>> + */ + #[\AllowDynamicProperties] + class WP_REST_Request implements \ArrayAccess + { + /** + * HTTP method. + * + * @since 4.4.0 + * @var string + */ + protected $method = ''; + /** + * Parameters passed to the request. + * + * These typically come from the `$_GET`, `$_POST` and `$_FILES` + * superglobals when being created from the global scope. + * + * @since 4.4.0 + * @var array Contains GET, POST and FILES keys mapping to arrays of data. + */ + protected $params; + /** + * HTTP headers for the request. + * + * @since 4.4.0 + * @var array Map of key to value. Key is always lowercase, as per HTTP specification. + */ + protected $headers = array(); + /** + * Body data. + * + * @since 4.4.0 + * @var string Binary data from the request. + */ + protected $body = \null; + /** + * Route matched for the request. + * + * @since 4.4.0 + * @var string + */ + protected $route; + /** + * Attributes (options) for the route that was matched. + * + * This is the options array used when the route was registered, typically + * containing the callback as well as the valid methods for the route. + * + * @since 4.4.0 + * @var array Attributes for the request. + */ + protected $attributes = array(); + /** + * Used to determine if the JSON data has been parsed yet. + * + * Allows lazy-parsing of JSON data where possible. + * + * @since 4.4.0 + * @var bool + */ + protected $parsed_json = \false; + /** + * Used to determine if the body data has been parsed yet. + * + * @since 4.4.0 + * @var bool + */ + protected $parsed_body = \false; + /** + * Constructor. + * + * @since 4.4.0 + * + * @param string $method Optional. Request method. Default empty. + * @param string $route Optional. Request route. Default empty. + * @param array $attributes Optional. Request attributes. Default empty array. + */ + public function __construct($method = '', $route = '', $attributes = array()) + { + } + /** + * Retrieves the HTTP method for the request. + * + * @since 4.4.0 + * + * @return string HTTP method. + */ + public function get_method() + { + } + /** + * Sets HTTP method for the request. + * + * @since 4.4.0 + * + * @param string $method HTTP method. + */ + public function set_method($method) + { + } + /** + * Retrieves all headers from the request. + * + * @since 4.4.0 + * + * @return array Map of key to value. Key is always lowercase, as per HTTP specification. + */ + public function get_headers() + { + } + /** + * Canonicalizes the header name. + * + * Ensures that header names are always treated the same regardless of + * source. Header names are always case insensitive. + * + * Note that we treat `-` (dashes) and `_` (underscores) as the same + * character, as per header parsing rules in both Apache and nginx. + * + * @link https://stackoverflow.com/q/18185366 + * @link https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/#missing-disappearing-http-headers + * @link https://nginx.org/en/docs/http/ngx_http_core_module.html#underscores_in_headers + * + * @since 4.4.0 + * + * @param string $key Header name. + * @return string Canonicalized name. + */ + public static function canonicalize_header_name($key) + { + } + /** + * Retrieves the given header from the request. + * + * If the header has multiple values, they will be concatenated with a comma + * as per the HTTP specification. Be aware that some non-compliant headers + * (notably cookie headers) cannot be joined this way. + * + * @since 4.4.0 + * + * @param string $key Header name, will be canonicalized to lowercase. + * @return string|null String value if set, null otherwise. + */ + public function get_header($key) + { + } + /** + * Retrieves header values from the request. + * + * @since 4.4.0 + * + * @param string $key Header name, will be canonicalized to lowercase. + * @return array|null List of string values if set, null otherwise. + */ + public function get_header_as_array($key) + { + } + /** + * Sets the header on request. + * + * @since 4.4.0 + * + * @param string $key Header name. + * @param string $value Header value, or list of values. + */ + public function set_header($key, $value) + { + } + /** + * Appends a header value for the given header. + * + * @since 4.4.0 + * + * @param string $key Header name. + * @param string $value Header value, or list of values. + */ + public function add_header($key, $value) + { + } + /** + * Removes all values for a header. + * + * @since 4.4.0 + * + * @param string $key Header name. + */ + public function remove_header($key) + { + } + /** + * Sets headers on the request. + * + * @since 4.4.0 + * + * @param array $headers Map of header name to value. + * @param bool $override If true, replace the request's headers. Otherwise, merge with existing. + */ + public function set_headers($headers, $override = \true) + { + } + /** + * Retrieves the Content-Type of the request. + * + * @since 4.4.0 + * + * @return array|null Map containing 'value' and 'parameters' keys + * or null when no valid Content-Type header was + * available. + */ + public function get_content_type() + { + } + /** + * Checks if the request has specified a JSON Content-Type. + * + * @since 5.6.0 + * + * @return bool True if the Content-Type header is JSON. + */ + public function is_json_content_type() + { + } + /** + * Retrieves the parameter priority order. + * + * Used when checking parameters in WP_REST_Request::get_param(). + * + * @since 4.4.0 + * + * @return string[] Array of types to check, in order of priority. + */ + protected function get_parameter_order() + { + } + /** + * Retrieves a parameter from the request. + * + * @since 4.4.0 + * + * @param string $key Parameter name. + * @return mixed|null Value if set, null otherwise. + * @phpstan-template TOffset of key-of<T> + * @phpstan-param TOffset $key + * @phpstan-return T[TOffset]|null + */ + public function get_param($key) + { + } + /** + * Checks if a parameter exists in the request. + * + * This allows distinguishing between an omitted parameter, + * and a parameter specifically set to null. + * + * @since 5.3.0 + * + * @param string $key Parameter name. + * @return bool True if a param exists for the given key. + * @phpstan-param key-of<T> $key + */ + public function has_param($key) + { + } + /** + * Sets a parameter on the request. + * + * If the given parameter key exists in any parameter type an update will take place, + * otherwise a new param will be created in the first parameter type (respecting + * get_parameter_order()). + * + * @since 4.4.0 + * + * @param string $key Parameter name. + * @param mixed $value Parameter value. + * @phpstan-template TOffset of key-of<T> + * @phpstan-param TOffset $key + * @phpstan-param T[TOffset] $value + * @phpstan-return void + */ + public function set_param($key, $value) + { + } + /** + * Retrieves merged parameters from the request. + * + * The equivalent of get_param(), but returns all parameters for the request. + * Handles merging all the available values into a single array. + * + * @since 4.4.0 + * + * @return array Map of key to value. + * @phpstan-return T + */ + public function get_params() + { + } + /** + * Retrieves parameters from the route itself. + * + * These are parsed from the URL using the regex. + * + * @since 4.4.0 + * + * @return array Parameter map of key to value. + */ + public function get_url_params() + { + } + /** + * Sets parameters from the route. + * + * Typically, this is set after parsing the URL. + * + * @since 4.4.0 + * + * @param array $params Parameter map of key to value. + */ + public function set_url_params($params) + { + } + /** + * Retrieves parameters from the query string. + * + * These are the parameters you'd typically find in `$_GET`. + * + * @since 4.4.0 + * + * @return array Parameter map of key to value + */ + public function get_query_params() + { + } + /** + * Sets parameters from the query string. + * + * Typically, this is set from `$_GET`. + * + * @since 4.4.0 + * + * @param array $params Parameter map of key to value. + */ + public function set_query_params($params) + { + } + /** + * Retrieves parameters from the body. + * + * These are the parameters you'd typically find in `$_POST`. + * + * @since 4.4.0 + * + * @return array Parameter map of key to value. + */ + public function get_body_params() + { + } + /** + * Sets parameters from the body. + * + * Typically, this is set from `$_POST`. + * + * @since 4.4.0 + * + * @param array $params Parameter map of key to value. + */ + public function set_body_params($params) + { + } + /** + * Retrieves multipart file parameters from the body. + * + * These are the parameters you'd typically find in `$_FILES`. + * + * @since 4.4.0 + * + * @return array Parameter map of key to value + */ + public function get_file_params() + { + } + /** + * Sets multipart file parameters from the body. + * + * Typically, this is set from `$_FILES`. + * + * @since 4.4.0 + * + * @param array $params Parameter map of key to value. + */ + public function set_file_params($params) + { + } + /** + * Retrieves the default parameters. + * + * These are the parameters set in the route registration. + * + * @since 4.4.0 + * + * @return array Parameter map of key to value + */ + public function get_default_params() + { + } + /** + * Sets default parameters. + * + * These are the parameters set in the route registration. + * + * @since 4.4.0 + * + * @param array $params Parameter map of key to value. + */ + public function set_default_params($params) + { + } + /** + * Retrieves the request body content. + * + * @since 4.4.0 + * + * @return string Binary data from the request body. + */ + public function get_body() + { + } + /** + * Sets body content. + * + * @since 4.4.0 + * + * @param string $data Binary data from the request body. + */ + public function set_body($data) + { + } + /** + * Retrieves the parameters from a JSON-formatted body. + * + * @since 4.4.0 + * + * @return array Parameter map of key to value. + */ + public function get_json_params() + { + } + /** + * Parses the JSON parameters. + * + * Avoids parsing the JSON data until we need to access it. + * + * @since 4.4.0 + * @since 4.7.0 Returns error instance if value cannot be decoded. + * @return true|WP_Error True if the JSON data was passed or no JSON data was provided, WP_Error if invalid JSON was passed. + */ + protected function parse_json_params() + { + } + /** + * Parses the request body parameters. + * + * Parses out URL-encoded bodies for request methods that aren't supported + * natively by PHP. In PHP 5.x, only POST has these parsed automatically. + * + * @since 4.4.0 + * @phpstan-return void + */ + protected function parse_body_params() + { + } + /** + * Retrieves the route that matched the request. + * + * @since 4.4.0 + * + * @return string Route matching regex. + */ + public function get_route() + { + } + /** + * Sets the route that matched the request. + * + * @since 4.4.0 + * + * @param string $route Route matching regex. + */ + public function set_route($route) + { + } + /** + * Retrieves the attributes for the request. + * + * These are the options for the route that was matched. + * + * @since 4.4.0 + * + * @return array Attributes for the request. + */ + public function get_attributes() + { + } + /** + * Sets the attributes for the request. + * + * @since 4.4.0 + * + * @param array $attributes Attributes for the request. + */ + public function set_attributes($attributes) + { + } + /** + * Sanitizes (where possible) the params on the request. + * + * This is primarily based off the sanitize_callback param on each registered + * argument. + * + * @since 4.4.0 + * + * @return true|WP_Error True if parameters were sanitized, WP_Error if an error occurred during sanitization. + */ + public function sanitize_params() + { + } + /** + * Checks whether this request is valid according to its attributes. + * + * @since 4.4.0 + * + * @return true|WP_Error True if there are no parameters to validate or if all pass validation, + * WP_Error if required parameters are missing. + */ + public function has_valid_params() + { + } + /** + * Checks if a parameter is set. + * + * @since 4.4.0 + * + * @param string $offset Parameter name. + * @return bool Whether the parameter is set. + * @phpstan-param key-of<T> $offset + */ + #[\ReturnTypeWillChange] + public function offsetExists($offset) + { + } + /** + * Retrieves a parameter from the request. + * + * @since 4.4.0 + * + * @param string $offset Parameter name. + * @return mixed|null Value if set, null otherwise. + * @phpstan-template TOffset of key-of<T> + * @phpstan-param TOffset $offset + * @phpstan-return T[TOffset]|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + } + /** + * Sets a parameter on the request. + * + * @since 4.4.0 + * + * @param string $offset Parameter name. + * @param mixed $value Parameter value. + * @phpstan-template TOffset of key-of<T> + * @phpstan-param TOffset $offset + * @phpstan-param T[TOffset] $value + * @phpstan-return void + */ + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value) + { + } + /** + * Removes a parameter from the request. + * + * @since 4.4.0 + * + * @param string $offset Parameter name. + * @phpstan-template TOffset of key-of<T> + * @phpstan-param TOffset $offset + * @phpstan-return void + */ + #[\ReturnTypeWillChange] + public function offsetUnset($offset) + { + } + /** + * Retrieves a WP_REST_Request object from a full URL. + * + * @since 4.5.0 + * + * @param string $url URL with protocol, domain, path and query args. + * @return WP_REST_Request|false WP_REST_Request object on success, false on failure. + */ + public static function from_url($url) + { + } + } + /** + * REST API: WP_REST_Response class + * + * @package WordPress + * @subpackage REST_API + * @since 4.4.0 + */ + /** + * Core class used to implement a REST response object. + * + * @since 4.4.0 + * + * @see WP_HTTP_Response + */ + class WP_REST_Response extends \WP_HTTP_Response + { + /** + * Links related to the response. + * + * @since 4.4.0 + * @var array + */ + protected $links = array(); + /** + * The route that was to create the response. + * + * @since 4.4.0 + * @var string + */ + protected $matched_route = ''; + /** + * The handler that was used to create the response. + * + * @since 4.4.0 + * @var null|array + */ + protected $matched_handler = \null; + /** + * Adds a link to the response. + * + * @internal The $rel parameter is first, as this looks nicer when sending multiple. + * + * @since 4.4.0 + * + * @link https://tools.ietf.org/html/rfc5988 + * @link https://www.iana.org/assignments/link-relations/link-relations.xml + * + * @param string $rel Link relation. Either an IANA registered type, + * or an absolute URL. + * @param string $href Target URI for the link. + * @param array $attributes Optional. Link parameters to send along with the URL. Default empty array. + */ + public function add_link($rel, $href, $attributes = array()) + { + } + /** + * Removes a link from the response. + * + * @since 4.4.0 + * + * @param string $rel Link relation. Either an IANA registered type, or an absolute URL. + * @param string $href Optional. Only remove links for the relation matching the given href. + * Default null. + * @phpstan-return void + */ + public function remove_link($rel, $href = \null) + { + } + /** + * Adds multiple links to the response. + * + * Link data should be an associative array with link relation as the key. + * The value can either be an associative array of link attributes + * (including `href` with the URL for the response), or a list of these + * associative arrays. + * + * @since 4.4.0 + * + * @param array $links Map of link relation to list of links. + */ + public function add_links($links) + { + } + /** + * Retrieves links for the response. + * + * @since 4.4.0 + * + * @return array List of links. + */ + public function get_links() + { + } + /** + * Sets a single link header. + * + * @internal The $rel parameter is first, as this looks nicer when sending multiple. + * + * @since 4.4.0 + * + * @link https://tools.ietf.org/html/rfc5988 + * @link https://www.iana.org/assignments/link-relations/link-relations.xml + * + * @param string $rel Link relation. Either an IANA registered type, or an absolute URL. + * @param string $link Target IRI for the link. + * @param array $other Optional. Other parameters to send, as an associative array. + * Default empty array. + */ + public function link_header($rel, $link, $other = array()) + { + } + /** + * Retrieves the route that was used. + * + * @since 4.4.0 + * + * @return string The matched route. + */ + public function get_matched_route() + { + } + /** + * Sets the route (regex for path) that caused the response. + * + * @since 4.4.0 + * + * @param string $route Route name. + */ + public function set_matched_route($route) + { + } + /** + * Retrieves the handler that was used to generate the response. + * + * @since 4.4.0 + * + * @return null|array The handler that was used to create the response. + */ + public function get_matched_handler() + { + } + /** + * Sets the handler that was responsible for generating the response. + * + * @since 4.4.0 + * + * @param array $handler The matched handler. + */ + public function set_matched_handler($handler) + { + } + /** + * Checks if the response is an error, i.e. >= 400 response code. + * + * @since 4.4.0 + * + * @return bool Whether the response is an error. + */ + public function is_error() + { + } + /** + * Retrieves a WP_Error object from the response. + * + * @since 4.4.0 + * + * @return WP_Error|null WP_Error or null on not an errored response. + */ + public function as_error() + { + } + /** + * Retrieves the CURIEs (compact URIs) used for relations. + * + * @since 4.5.0 + * + * @return array Compact URIs. + */ + public function get_curies() + { + } + } + /** + * REST API: WP_REST_Server class + * + * @package WordPress + * @subpackage REST_API + * @since 4.4.0 + */ + /** + * Core class used to implement the WordPress REST API server. + * + * @since 4.4.0 + */ + #[\AllowDynamicProperties] + class WP_REST_Server + { + /** + * Alias for GET transport method. + * + * @since 4.4.0 + * @var string + */ + const READABLE = 'GET'; + /** + * Alias for POST transport method. + * + * @since 4.4.0 + * @var string + */ + const CREATABLE = 'POST'; + /** + * Alias for POST, PUT, PATCH transport methods together. + * + * @since 4.4.0 + * @var string + */ + const EDITABLE = 'POST, PUT, PATCH'; + /** + * Alias for DELETE transport method. + * + * @since 4.4.0 + * @var string + */ + const DELETABLE = 'DELETE'; + /** + * Alias for GET, POST, PUT, PATCH & DELETE transport methods together. + * + * @since 4.4.0 + * @var string + */ + const ALLMETHODS = 'GET, POST, PUT, PATCH, DELETE'; + /** + * Namespaces registered to the server. + * + * @since 4.4.0 + * @var array + */ + protected $namespaces = array(); + /** + * Endpoints registered to the server. + * + * @since 4.4.0 + * @var array + */ + protected $endpoints = array(); + /** + * Options defined for the routes. + * + * @since 4.4.0 + * @var array + */ + protected $route_options = array(); + /** + * Caches embedded requests. + * + * @since 5.4.0 + * @var array + */ + protected $embed_cache = array(); + /** + * Stores request objects that are currently being handled. + * + * @since 6.5.0 + * @var array + */ + protected $dispatching_requests = array(); + /** + * Instantiates the REST server. + * + * @since 4.4.0 + */ + public function __construct() + { + } + /** + * Checks the authentication headers if supplied. + * + * @since 4.4.0 + * + * @return WP_Error|null|true WP_Error indicates unsuccessful login, null indicates successful + * or no authentication provided + */ + public function check_authentication() + { + } + /** + * Converts an error to a response object. + * + * This iterates over all error codes and messages to change it into a flat + * array. This enables simpler client behavior, as it is represented as a + * list in JSON rather than an object/map. + * + * @since 4.4.0 + * @since 5.7.0 Converted to a wrapper of {@see rest_convert_error_to_response()}. + * + * @param WP_Error $error WP_Error instance. + * @return WP_REST_Response List of associative arrays with code and message keys. + */ + protected function error_to_response($error) + { + } + /** + * Retrieves an appropriate error representation in JSON. + * + * Note: This should only be used in WP_REST_Server::serve_request(), as it + * cannot handle WP_Error internally. All callbacks and other internal methods + * should instead return a WP_Error with the data set to an array that includes + * a 'status' key, with the value being the HTTP status to send. + * + * @since 4.4.0 + * + * @param string $code WP_Error-style code. + * @param string $message Human-readable message. + * @param int $status Optional. HTTP status code to send. Default null. + * @return string JSON representation of the error + */ + protected function json_error($code, $message, $status = \null) + { + } + /** + * Gets the encoding options passed to {@see wp_json_encode}. + * + * @since 6.1.0 + * + * @param \WP_REST_Request $request The current request object. + * + * @return int The JSON encode options. + */ + protected function get_json_encode_options(\WP_REST_Request $request) + { + } + /** + * Handles serving a REST API request. + * + * Matches the current server URI to a route and runs the first matching + * callback then outputs a JSON representation of the returned value. + * + * @since 4.4.0 + * + * @see WP_REST_Server::dispatch() + * + * @global WP_User $current_user The currently authenticated user. + * + * @param string $path Optional. The request route. If not set, `$_SERVER['PATH_INFO']` will be used. + * Default null. + * @return null|false Null if not served and a HEAD request, false otherwise. + */ + public function serve_request($path = \null) + { + } + /** + * Converts a response to data to send. + * + * @since 4.4.0 + * @since 5.4.0 The `$embed` parameter can now contain a list of link relations to include. + * + * @param WP_REST_Response $response Response object. + * @param bool|string[] $embed Whether to embed all links, a filtered list of link relations, or no links. + * @return array { + * Data with sub-requests embedded. + * + * @type array $_links Links. + * @type array $_embedded Embedded objects. + * } + * @phpstan-return array{ + * _links: array, + * _embedded: array, + * } + */ + public function response_to_data($response, $embed) + { + } + /** + * Retrieves links from a response. + * + * Extracts the links from a response into a structured hash, suitable for + * direct output. + * + * @since 4.4.0 + * + * @param WP_REST_Response $response Response to extract links from. + * @return array Map of link relation to list of link hashes. + */ + public static function get_response_links($response) + { + } + /** + * Retrieves the CURIEs (compact URIs) used for relations. + * + * Extracts the links from a response into a structured hash, suitable for + * direct output. + * + * @since 4.5.0 + * + * @param WP_REST_Response $response Response to extract links from. + * @return array Map of link relation to list of link hashes. + */ + public static function get_compact_response_links($response) + { + } + /** + * Embeds the links from the data into the request. + * + * @since 4.4.0 + * @since 5.4.0 The `$embed` parameter can now contain a list of link relations to include. + * + * @param array $data Data from the request. + * @param bool|string[] $embed Whether to embed all links or a filtered list of link relations. + * @return array { + * Data with sub-requests embedded. + * + * @type array $_links Links. + * @type array $_embedded Embedded objects. + * } + * @phpstan-return array{ + * _links: array, + * _embedded: array, + * } + */ + protected function embed_links($data, $embed = \true) + { + } + /** + * Wraps the response in an envelope. + * + * The enveloping technique is used to work around browser/client + * compatibility issues. Essentially, it converts the full HTTP response to + * data instead. + * + * @since 4.4.0 + * @since 6.0.0 The `$embed` parameter can now contain a list of link relations to include. + * + * @param WP_REST_Response $response Response object. + * @param bool|string[] $embed Whether to embed all links, a filtered list of link relations, or no links. + * @return WP_REST_Response New response with wrapped data + */ + public function envelope_response($response, $embed) + { + } + /** + * Registers a route to the server. + * + * @since 4.4.0 + * + * @param string $route_namespace Namespace. + * @param string $route The REST route. + * @param array $route_args Route arguments. + * @param bool $override Optional. Whether the route should be overridden if it already exists. + * Default false. + */ + public function register_route($route_namespace, $route, $route_args, $override = \false) + { + } + /** + * Retrieves the route map. + * + * The route map is an associative array with path regexes as the keys. The + * value is an indexed array with the callback function/method as the first + * item, and a bitmask of HTTP methods as the second item (see the class + * constants). + * + * Each route can be mapped to more than one callback by using an array of + * the indexed arrays. This allows mapping e.g. GET requests to one callback + * and POST requests to another. + * + * Note that the path regexes (array keys) must have @ escaped, as this is + * used as the delimiter with preg_match() + * + * @since 4.4.0 + * @since 5.4.0 Added `$route_namespace` parameter. + * + * @param string $route_namespace Optionally, only return routes in the given namespace. + * @return array `'/path/regex' => array( $callback, $bitmask )` or + * `'/path/regex' => array( array( $callback, $bitmask ), ...)`. + */ + public function get_routes($route_namespace = '') + { + } + /** + * Retrieves namespaces registered on the server. + * + * @since 4.4.0 + * + * @return string[] List of registered namespaces. + */ + public function get_namespaces() + { + } + /** + * Retrieves specified options for a route. + * + * @since 4.4.0 + * + * @param string $route Route pattern to fetch options for. + * @return array|null Data as an associative array if found, or null if not found. + */ + public function get_route_options($route) + { + } + /** + * Matches the request to a callback and call it. + * + * @since 4.4.0 + * + * @param WP_REST_Request $request Request to attempt dispatching. + * @return WP_REST_Response Response returned by the callback. + */ + public function dispatch($request) + { + } + /** + * Returns whether the REST server is currently dispatching / responding to a request. + * + * This may be a standalone REST API request, or an internal request dispatched from within a regular page load. + * + * @since 6.5.0 + * + * @return bool Whether the REST server is currently handling a request. + */ + public function is_dispatching() + { + } + /** + * Matches a request object to its handler. + * + * @access private + * @since 5.6.0 + * + * @param WP_REST_Request $request The request object. + * @return array|WP_Error The route and request handler on success or a WP_Error instance if no handler was found. + */ + protected function match_request_to_handler($request) + { + } + /** + * Dispatches the request to the callback handler. + * + * @access private + * @since 5.6.0 + * + * @param WP_REST_Request $request The request object. + * @param string $route The matched route regex. + * @param array $handler The matched route handler. + * @param WP_Error|null $response The current error object if any. + * @return WP_REST_Response + */ + protected function respond_to_request($request, $route, $handler, $response) + { + } + /** + * Returns if an error occurred during most recent JSON encode/decode. + * + * Strings to be translated will be in format like + * "Encoding error: Maximum stack depth exceeded". + * + * @since 4.4.0 + * + * @return false|string Boolean false or string error message. + */ + protected function get_json_last_error() + { + } + /** + * Retrieves the site index. + * + * This endpoint describes the capabilities of the site. + * + * @since 4.4.0 + * + * @param array $request { + * Request. + * + * @type string $context Context. + * } + * @return WP_REST_Response The API root index data. + * @phpstan-param array{ + * context?: string, + * } $request + */ + public function get_index($request) + { + } + /** + * Adds a link to the active theme for users who have proper permissions. + * + * @since 5.7.0 + * + * @param WP_REST_Response $response REST API response. + */ + protected function add_active_theme_link_to_index(\WP_REST_Response $response) + { + } + /** + * Exposes the site logo through the WordPress REST API. + * + * This is used for fetching this information when user has no rights + * to update settings. + * + * @since 5.8.0 + * + * @param WP_REST_Response $response REST API response. + */ + protected function add_site_logo_to_index(\WP_REST_Response $response) + { + } + /** + * Exposes the site icon through the WordPress REST API. + * + * This is used for fetching this information when user has no rights + * to update settings. + * + * @since 5.9.0 + * + * @param WP_REST_Response $response REST API response. + */ + protected function add_site_icon_to_index(\WP_REST_Response $response) + { + } + /** + * Exposes an image through the WordPress REST API. + * This is used for fetching this information when user has no rights + * to update settings. + * + * @since 5.9.0 + * + * @param WP_REST_Response $response REST API response. + * @param int $image_id Image attachment ID. + * @param string $type Type of Image. + */ + protected function add_image_to_index(\WP_REST_Response $response, $image_id, $type) + { + } + /** + * Retrieves the index for a namespace. + * + * @since 4.4.0 + * + * @param WP_REST_Request $request REST request instance. + * @return WP_REST_Response|WP_Error WP_REST_Response instance if the index was found, + * WP_Error if the namespace isn't set. + */ + public function get_namespace_index($request) + { + } + /** + * Retrieves the publicly-visible data for routes. + * + * @since 4.4.0 + * + * @param array $routes Routes to get data for. + * @param string $context Optional. Context for data. Accepts 'view' or 'help'. Default 'view'. + * @return array[] Route data to expose in indexes, keyed by route. + * @phpstan-param 'view'|'help' $context + */ + public function get_data_for_routes($routes, $context = 'view') + { + } + /** + * Retrieves publicly-visible data for the route. + * + * @since 4.4.0 + * + * @param string $route Route to get data for. + * @param array $callbacks Callbacks to convert to data. + * @param string $context Optional. Context for the data. Accepts 'view' or 'help'. Default 'view'. + * @return array|null Data for the route, or null if no publicly-visible data. + * @phpstan-param 'view'|'help' $context + */ + public function get_data_for_route($route, $callbacks, $context = 'view') + { + } + /** + * Gets the maximum number of requests that can be included in a batch. + * + * @since 5.6.0 + * + * @return int The maximum requests. + */ + protected function get_max_batch_size() + { + } + /** + * Serves the batch/v1 request. + * + * @since 5.6.0 + * + * @param WP_REST_Request $batch_request The batch request object. + * @return WP_REST_Response The generated response object. + */ + public function serve_batch_request_v1(\WP_REST_Request $batch_request) + { + } + /** + * Sends an HTTP status code. + * + * @since 4.4.0 + * + * @param int $code HTTP status. + */ + protected function set_status($code) + { + } + /** + * Sends an HTTP header. + * + * @since 4.4.0 + * + * @param string $key Header key. + * @param string $value Header value. + */ + public function send_header($key, $value) + { + } + /** + * Sends multiple HTTP headers. + * + * @since 4.4.0 + * + * @param array $headers Map of header name to header value. + */ + public function send_headers($headers) + { + } + /** + * Removes an HTTP header from the current response. + * + * @since 4.8.0 + * + * @param string $key Header key. + */ + public function remove_header($key) + { + } + /** + * Retrieves the raw request entity (body). + * + * @since 4.4.0 + * + * @global string $HTTP_RAW_POST_DATA Raw post data. + * + * @return string Raw request data. + */ + public static function get_raw_data() + { + } + /** + * Extracts headers from a PHP-style $_SERVER array. + * + * @since 4.4.0 + * + * @param array $server Associative array similar to `$_SERVER`. + * @return array Headers extracted from the input. + */ + public function get_headers($server) + { + } + } + /** + * REST API: WP_REST_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 4.7.0 + */ + /** + * Core base controller for managing and interacting with REST API items. + * + * @since 4.7.0 + */ + #[\AllowDynamicProperties] + abstract class WP_REST_Controller + { + /** + * The namespace of this controller's route. + * + * @since 4.7.0 + * @var string + */ + protected $namespace; + /** + * The base of this controller's route. + * + * @since 4.7.0 + * @var string + */ + protected $rest_base; + /** + * Cached results of get_item_schema. + * + * @since 5.3.0 + * @var array + */ + protected $schema; + /** + * Registers the routes for the objects of the controller. + * + * @since 4.7.0 + * + * @see register_rest_route() + */ + public function register_routes() + { + } + /** + * Checks if a given request has access to get items. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_items_permissions_check($request) + { + } + /** + * Retrieves a collection of items. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_items($request) + { + } + /** + * Checks if a given request has access to get a specific item. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise. + */ + public function get_item_permissions_check($request) + { + } + /** + * Retrieves one item from the collection. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_item($request) + { + } + /** + * Checks if a given request has access to create items. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to create items, WP_Error object otherwise. + */ + public function create_item_permissions_check($request) + { + } + /** + * Creates one item from the collection. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function create_item($request) + { + } + /** + * Checks if a given request has access to update a specific item. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to update the item, WP_Error object otherwise. + */ + public function update_item_permissions_check($request) + { + } + /** + * Updates one item from the collection. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function update_item($request) + { + } + /** + * Checks if a given request has access to delete a specific item. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to delete the item, WP_Error object otherwise. + */ + public function delete_item_permissions_check($request) + { + } + /** + * Deletes one item from the collection. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function delete_item($request) + { + } + /** + * Prepares one item for create or update operation. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Request object. + * @return object|WP_Error The prepared item, or WP_Error object on failure. + */ + protected function prepare_item_for_database($request) + { + } + /** + * Prepares the item for the REST response. + * + * @since 4.7.0 + * + * @param mixed $item WordPress representation of the item. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Prepares a response for insertion into a collection. + * + * @since 4.7.0 + * + * @param WP_REST_Response $response Response object. + * @return array|mixed Response data, ready for insertion into collection data. + */ + public function prepare_response_for_collection($response) + { + } + /** + * Filters a response based on the context defined in the schema. + * + * @since 4.7.0 + * + * @param array $response_data Response data to filter. + * @param string $context Context defined in the schema. + * @return array Filtered response. + */ + public function filter_response_by_context($response_data, $context) + { + } + /** + * Retrieves the item's schema, conforming to JSON Schema. + * + * @since 4.7.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Retrieves the item's schema for display / public consumption purposes. + * + * @since 4.7.0 + * + * @return array Public item schema data. + */ + public function get_public_item_schema() + { + } + /** + * Retrieves the query params for the collections. + * + * @since 4.7.0 + * + * @return array Query parameters for the collection. + */ + public function get_collection_params() + { + } + /** + * Retrieves the magical context param. + * + * Ensures consistent descriptions between endpoints, and populates enum from schema. + * + * @since 4.7.0 + * + * @param array $args Optional. Additional arguments for context parameter. Default empty array. + * @return array Context parameter details. + */ + public function get_context_param($args = array()) + { + } + /** + * Adds the values from additional fields to a data object. + * + * @since 4.7.0 + * + * @param array $response_data Prepared response array. + * @param WP_REST_Request $request Full details about the request. + * @return array Modified data object with additional fields. + */ + protected function add_additional_fields_to_object($response_data, $request) + { + } + /** + * Updates the values of additional fields added to a data object. + * + * @since 4.7.0 + * + * @param object $data_object Data model like WP_Term or WP_Post. + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True on success, WP_Error object if a field cannot be updated. + */ + protected function update_additional_fields_for_object($data_object, $request) + { + } + /** + * Adds the schema from additional fields to a schema array. + * + * The type of object is inferred from the passed schema. + * + * @since 4.7.0 + * + * @param array $schema Schema array. + * @return array Modified Schema array. + */ + protected function add_additional_fields_schema($schema) + { + } + /** + * Retrieves all of the registered additional fields for a given object-type. + * + * @since 4.7.0 + * + * @global array $wp_rest_additional_fields Holds registered fields, organized by object type. + * + * @param string $object_type Optional. The object type. + * @return array Registered additional fields (if any), empty array if none or if the object type + * could not be inferred. + */ + protected function get_additional_fields($object_type = \null) + { + } + /** + * Retrieves the object type this controller is responsible for managing. + * + * @since 4.7.0 + * + * @return string Object type for the controller. + */ + protected function get_object_type() + { + } + /** + * Gets an array of fields to be included on the response. + * + * Included fields are based on item schema and `_fields=` request argument. + * + * @since 4.9.6 + * + * @param WP_REST_Request $request Full details about the request. + * @return string[] Fields to be included in the response. + */ + public function get_fields_for_response($request) + { + } + /** + * Retrieves an array of endpoint arguments from the item schema for the controller. + * + * @since 4.7.0 + * + * @param string $method Optional. HTTP method of the request. The arguments for `CREATABLE` requests are + * checked for required values and may fall-back to a given default, this is not done + * on `EDITABLE` requests. Default WP_REST_Server::CREATABLE. + * @return array Endpoint arguments. + */ + public function get_endpoint_args_for_item_schema($method = \WP_REST_Server::CREATABLE) + { + } + /** + * Sanitizes the slug value. + * + * @since 4.7.0 + * + * @internal We can't use sanitize_title() directly, as the second + * parameter is the fallback title, which would end up being set to the + * request object. + * + * @see https://github.com/WP-API/WP-API/issues/1585 + * + * @todo Remove this in favour of https://core.trac.wordpress.org/ticket/34659 + * + * @param string $slug Slug value passed in request. + * @return string Sanitized value for the slug. + */ + public function sanitize_slug($slug) + { + } + } + /** + * REST API: WP_REST_Application_Passwords_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 5.6.0 + */ + /** + * Core class to access a user's application passwords via the REST API. + * + * @since 5.6.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Application_Passwords_Controller extends \WP_REST_Controller + { + /** + * Application Passwords controller constructor. + * + * @since 5.6.0 + */ + public function __construct() + { + } + /** + * Registers the REST API routes for the application passwords controller. + * + * @since 5.6.0 + */ + public function register_routes() + { + } + /** + * Checks if a given request has access to get application passwords. + * + * @since 5.6.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_items_permissions_check($request) + { + } + /** + * Retrieves a collection of application passwords. + * + * @since 5.6.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_items($request) + { + } + /** + * Checks if a given request has access to get a specific application password. + * + * @since 5.6.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise. + */ + public function get_item_permissions_check($request) + { + } + /** + * Retrieves one application password from the collection. + * + * @since 5.6.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_item($request) + { + } + /** + * Checks if a given request has access to create application passwords. + * + * @since 5.6.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to create items, WP_Error object otherwise. + */ + public function create_item_permissions_check($request) + { + } + /** + * Creates an application password. + * + * @since 5.6.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function create_item($request) + { + } + /** + * Checks if a given request has access to update application passwords. + * + * @since 5.6.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to create items, WP_Error object otherwise. + */ + public function update_item_permissions_check($request) + { + } + /** + * Updates an application password. + * + * @since 5.6.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function update_item($request) + { + } + /** + * Checks if a given request has access to delete all application passwords for a user. + * + * @since 5.6.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to delete the item, WP_Error object otherwise. + */ + public function delete_items_permissions_check($request) + { + } + /** + * Deletes all application passwords for a user. + * + * @since 5.6.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function delete_items($request) + { + } + /** + * Checks if a given request has access to delete a specific application password for a user. + * + * @since 5.6.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to delete the item, WP_Error object otherwise. + */ + public function delete_item_permissions_check($request) + { + } + /** + * Deletes an application password for a user. + * + * @since 5.6.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function delete_item($request) + { + } + /** + * Checks if a given request has access to get the currently used application password for a user. + * + * @since 5.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise. + */ + public function get_current_item_permissions_check($request) + { + } + /** + * Retrieves the application password being currently used for authentication of a user. + * + * @since 5.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_current_item($request) + { + } + /** + * Performs a permissions check for the request. + * + * @since 5.6.0 + * @deprecated 5.7.0 Use `edit_user` directly or one of the specific meta capabilities introduced in 5.7.0. + * + * @param WP_REST_Request $request + * @return true|WP_Error + */ + protected function do_permissions_check($request) + { + } + /** + * Prepares an application password for a create or update operation. + * + * @since 5.6.0 + * + * @param WP_REST_Request $request Request object. + * @return object|WP_Error The prepared item, or WP_Error object on failure. + */ + protected function prepare_item_for_database($request) + { + } + /** + * Prepares the application password for the REST response. + * + * @since 5.6.0 + * + * @param array $item WordPress representation of the item. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Prepares links for the request. + * + * @since 5.6.0 + * + * @param WP_User $user The requested user. + * @param array $item The application password. + * @return array The list of links. + */ + protected function prepare_links(\WP_User $user, $item) + { + } + /** + * Gets the requested user. + * + * @since 5.6.0 + * + * @param WP_REST_Request $request The request object. + * @return WP_User|WP_Error The WordPress user associated with the request, or a WP_Error if none found. + */ + protected function get_user($request) + { + } + /** + * Gets the requested application password for a user. + * + * @since 5.6.0 + * + * @param WP_REST_Request $request The request object. + * @return array|WP_Error The application password details if found, a WP_Error otherwise. + */ + protected function get_application_password($request) + { + } + /** + * Retrieves the query params for the collections. + * + * @since 5.6.0 + * + * @return array Query parameters for the collection. + */ + public function get_collection_params() + { + } + /** + * Retrieves the application password's schema, conforming to JSON Schema. + * + * @since 5.6.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + } + /** + * REST API: WP_REST_Posts_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 4.7.0 + */ + /** + * Core class to access posts via the REST API. + * + * @since 4.7.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Posts_Controller extends \WP_REST_Controller + { + /** + * Post type. + * + * @since 4.7.0 + * @var string + */ + protected $post_type; + /** + * Instance of a post meta fields object. + * + * @since 4.7.0 + * @var WP_REST_Post_Meta_Fields + */ + protected $meta; + /** + * Passwordless post access permitted. + * + * @since 5.7.1 + * @var int[] + */ + protected $password_check_passed = array(); + /** + * Whether the controller supports batching. + * + * @since 5.9.0 + * @var array + */ + protected $allow_batch = array('v1' => \true); + /** + * Constructor. + * + * @since 4.7.0 + * + * @param string $post_type Post type. + */ + public function __construct($post_type) + { + } + /** + * Registers the routes for posts. + * + * @since 4.7.0 + * + * @see register_rest_route() + */ + public function register_routes() + { + } + /** + * Checks if a given request has access to read posts. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_items_permissions_check($request) + { + } + /** + * Overrides the result of the post password check for REST requested posts. + * + * Allow users to read the content of password protected posts if they have + * previously passed a permission check or if they have the `edit_post` capability + * for the post being checked. + * + * @since 5.7.1 + * + * @param bool $required Whether the post requires a password check. + * @param WP_Post $post The post been password checked. + * @return bool Result of password check taking in to account REST API considerations. + */ + public function check_password_required($required, $post) + { + } + /** + * Retrieves a collection of posts. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_items($request) + { + } + /** + * Gets the post, if the ID is valid. + * + * @since 4.7.2 + * + * @param int $id Supplied ID. + * @return WP_Post|WP_Error Post object if ID is valid, WP_Error otherwise. + */ + protected function get_post($id) + { + } + /** + * Checks if a given request has access to read a post. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return bool|WP_Error True if the request has read access for the item, WP_Error object or false otherwise. + */ + public function get_item_permissions_check($request) + { + } + /** + * Checks if the user can access password-protected content. + * + * This method determines whether we need to override the regular password + * check in core with a filter. + * + * @since 4.7.0 + * + * @param WP_Post $post Post to check against. + * @param WP_REST_Request $request Request data to check. + * @return bool True if the user can access password-protected content, otherwise false. + */ + public function can_access_password_content($post, $request) + { + } + /** + * Retrieves a single post. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_item($request) + { + } + /** + * Checks if a given request has access to create a post. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to create items, WP_Error object otherwise. + */ + public function create_item_permissions_check($request) + { + } + /** + * Creates a single post. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function create_item($request) + { + } + /** + * Checks if a given request has access to update a post. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to update the item, WP_Error object otherwise. + */ + public function update_item_permissions_check($request) + { + } + /** + * Updates a single post. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function update_item($request) + { + } + /** + * Checks if a given request has access to delete a post. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to delete the item, WP_Error object otherwise. + */ + public function delete_item_permissions_check($request) + { + } + /** + * Deletes a single post. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function delete_item($request) + { + } + /** + * Determines the allowed query_vars for a get_items() response and prepares + * them for WP_Query. + * + * @since 4.7.0 + * + * @param array $prepared_args Optional. Prepared WP_Query arguments. Default empty array. + * @param WP_REST_Request $request Optional. Full details about the request. + * @return array Items query arguments. + */ + protected function prepare_items_query($prepared_args = array(), $request = \null) + { + } + /** + * Checks the post_date_gmt or modified_gmt and prepare any post or + * modified date for single post output. + * + * @since 4.7.0 + * + * @param string $date_gmt GMT publication time. + * @param string|null $date Optional. Local publication time. Default null. + * @return string|null ISO8601/RFC3339 formatted datetime. + */ + protected function prepare_date_response($date_gmt, $date = \null) + { + } + /** + * Prepares a single post for create or update. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Request object. + * @return stdClass|WP_Error Post object or WP_Error. + */ + protected function prepare_item_for_database($request) + { + } + /** + * Checks whether the status is valid for the given post. + * + * Allows for sending an update request with the current status, even if that status would not be acceptable. + * + * @since 5.6.0 + * + * @param string $status The provided status. + * @param WP_REST_Request $request The request object. + * @param string $param The parameter name. + * @return true|WP_Error True if the status is valid, or WP_Error if not. + */ + public function check_status($status, $request, $param) + { + } + /** + * Determines validity and normalizes the given status parameter. + * + * @since 4.7.0 + * + * @param string $post_status Post status. + * @param WP_Post_Type $post_type Post type. + * @return string|WP_Error Post status or WP_Error if lacking the proper permission. + */ + protected function handle_status_param($post_status, $post_type) + { + } + /** + * Determines the featured media based on a request param. + * + * @since 4.7.0 + * + * @param int $featured_media Featured Media ID. + * @param int $post_id Post ID. + * @return bool|WP_Error Whether the post thumbnail was successfully deleted, otherwise WP_Error. + */ + protected function handle_featured_media($featured_media, $post_id) + { + } + /** + * Checks whether the template is valid for the given post. + * + * @since 4.9.0 + * + * @param string $template Page template filename. + * @param WP_REST_Request $request Request. + * @return true|WP_Error True if template is still valid or if the same as existing value, or a WP_Error if template not supported. + */ + public function check_template($template, $request) + { + } + /** + * Sets the template for a post. + * + * @since 4.7.0 + * @since 4.9.0 Added the `$validate` parameter. + * + * @param string $template Page template filename. + * @param int $post_id Post ID. + * @param bool $validate Whether to validate that the template selected is valid. + */ + public function handle_template($template, $post_id, $validate = \false) + { + } + /** + * Updates the post's terms from a REST request. + * + * @since 4.7.0 + * + * @param int $post_id The post ID to update the terms form. + * @param WP_REST_Request $request The request object with post and terms data. + * @return null|WP_Error WP_Error on an error assigning any of the terms, otherwise null. + */ + protected function handle_terms($post_id, $request) + { + } + /** + * Checks whether current user can assign all terms sent with the current request. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request The request object with post and terms data. + * @return bool Whether the current user can assign the provided terms. + */ + protected function check_assign_terms_permission($request) + { + } + /** + * Checks if a given post type can be viewed or managed. + * + * @since 4.7.0 + * + * @param WP_Post_Type|string $post_type Post type name or object. + * @return bool Whether the post type is allowed in REST. + */ + protected function check_is_post_type_allowed($post_type) + { + } + /** + * Checks if a post can be read. + * + * Correctly handles posts with the inherit status. + * + * @since 4.7.0 + * + * @param WP_Post $post Post object. + * @return bool Whether the post can be read. + */ + public function check_read_permission($post) + { + } + /** + * Checks if a post can be edited. + * + * @since 4.7.0 + * + * @param WP_Post $post Post object. + * @return bool Whether the post can be edited. + */ + protected function check_update_permission($post) + { + } + /** + * Checks if a post can be created. + * + * @since 4.7.0 + * + * @param WP_Post $post Post object. + * @return bool Whether the post can be created. + */ + protected function check_create_permission($post) + { + } + /** + * Checks if a post can be deleted. + * + * @since 4.7.0 + * + * @param WP_Post $post Post object. + * @return bool Whether the post can be deleted. + */ + protected function check_delete_permission($post) + { + } + /** + * Prepares a single post output for response. + * + * @since 4.7.0 + * @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support. + * + * @global WP_Post $post Global post object. + * + * @param WP_Post $item Post object. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response Response object. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Overwrites the default protected title format. + * + * By default, WordPress will show password protected posts with a title of + * "Protected: %s", as the REST API communicates the protected status of a post + * in a machine readable format, we remove the "Protected: " prefix. + * + * @since 4.7.0 + * + * @return string Protected title format. + */ + public function protected_title_format() + { + } + /** + * Prepares links for the request. + * + * @since 4.7.0 + * + * @param WP_Post $post Post object. + * @return array Links for the given post. + */ + protected function prepare_links($post) + { + } + /** + * Gets the link relations available for the post and current user. + * + * @since 4.9.8 + * + * @param WP_Post $post Post object. + * @param WP_REST_Request $request Request object. + * @return array List of link relations. + */ + protected function get_available_actions($post, $request) + { + } + /** + * Retrieves the post's schema, conforming to JSON Schema. + * + * @since 4.7.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Retrieves Link Description Objects that should be added to the Schema for the posts collection. + * + * @since 4.9.8 + * + * @return array + */ + protected function get_schema_links() + { + } + /** + * Retrieves the query params for the posts collection. + * + * @since 4.7.0 + * @since 5.4.0 The `tax_relation` query parameter was added. + * @since 5.7.0 The `modified_after` and `modified_before` query parameters were added. + * + * @return array Collection parameters. + */ + public function get_collection_params() + { + } + /** + * Sanitizes and validates the list of post statuses, including whether the + * user can query private statuses. + * + * @since 4.7.0 + * + * @param string|array $statuses One or more post statuses. + * @param WP_REST_Request $request Full details about the request. + * @param string $parameter Additional parameter to pass to validation. + * @return array|WP_Error A list of valid statuses, otherwise WP_Error object. + */ + public function sanitize_post_statuses($statuses, $request, $parameter) + { + } + } + /** + * REST API: WP_REST_Attachments_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 4.7.0 + */ + /** + * Core controller used to access attachments via the REST API. + * + * @since 4.7.0 + * + * @see WP_REST_Posts_Controller + */ + class WP_REST_Attachments_Controller extends \WP_REST_Posts_Controller + { + /** + * Whether the controller supports batching. + * + * @since 5.9.0 + * @var false + */ + protected $allow_batch = \false; + /** + * Registers the routes for attachments. + * + * @since 5.3.0 + * + * @see register_rest_route() + */ + public function register_routes() + { + } + /** + * Determines the allowed query_vars for a get_items() response and + * prepares for WP_Query. + * + * @since 4.7.0 + * + * @param array $prepared_args Optional. Array of prepared arguments. Default empty array. + * @param WP_REST_Request $request Optional. Request to prepare items for. + * @return array Array of query arguments. + */ + protected function prepare_items_query($prepared_args = array(), $request = \null) + { + } + /** + * Checks if a given request has access to create an attachment. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error Boolean true if the attachment may be created, or a WP_Error if not. + */ + public function create_item_permissions_check($request) + { + } + /** + * Creates a single attachment. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, WP_Error object on failure. + */ + public function create_item($request) + { + } + /** + * Inserts the attachment post in the database. Does not update the attachment meta. + * + * @since 5.3.0 + * + * @param WP_REST_Request $request + * @return array|WP_Error + */ + protected function insert_attachment($request) + { + } + /** + * Determines the featured media based on a request param. + * + * @since 6.5.0 + * + * @param int $featured_media Featured Media ID. + * @param int $post_id Post ID. + * @return bool|WP_Error Whether the post thumbnail was successfully deleted, otherwise WP_Error. + */ + protected function handle_featured_media($featured_media, $post_id) + { + } + /** + * Updates a single attachment. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, WP_Error object on failure. + */ + public function update_item($request) + { + } + /** + * Performs post processing on an attachment. + * + * @since 5.3.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, WP_Error object on failure. + */ + public function post_process_item($request) + { + } + /** + * Checks if a given request can perform post processing on an attachment. + * + * @since 5.3.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to update the item, WP_Error object otherwise. + */ + public function post_process_item_permissions_check($request) + { + } + /** + * Checks if a given request has access to editing media. + * + * @since 5.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function edit_media_item_permissions_check($request) + { + } + /** + * Applies edits to a media item and creates a new attachment record. + * + * @since 5.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, WP_Error object on failure. + */ + public function edit_media_item($request) + { + } + /** + * Prepares a single attachment for create or update. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Request object. + * @return stdClass|WP_Error Post object. + */ + protected function prepare_item_for_database($request) + { + } + /** + * Prepares a single attachment output for response. + * + * @since 4.7.0 + * @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param WP_Post $item Attachment object. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response Response object. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Retrieves the attachment's schema, conforming to JSON Schema. + * + * @since 4.7.0 + * + * @return array Item schema as an array. + */ + public function get_item_schema() + { + } + /** + * Handles an upload via raw POST data. + * + * @since 4.7.0 + * @since 6.6.0 Added the `$time` parameter. + * + * @param string $data Supplied file data. + * @param array $headers HTTP headers from the request. + * @param string|null $time Optional. Time formatted in 'yyyy/mm'. Default null. + * @return array|WP_Error Data from wp_handle_sideload(). + */ + protected function upload_from_data($data, $headers, $time = \null) + { + } + /** + * Parses filename from a Content-Disposition header value. + * + * As per RFC6266: + * + * content-disposition = "Content-Disposition" ":" + * disposition-type *( ";" disposition-parm ) + * + * disposition-type = "inline" | "attachment" | disp-ext-type + * ; case-insensitive + * disp-ext-type = token + * + * disposition-parm = filename-parm | disp-ext-parm + * + * filename-parm = "filename" "=" value + * | "filename*" "=" ext-value + * + * disp-ext-parm = token "=" value + * | ext-token "=" ext-value + * ext-token = <the characters in token, followed by "*"> + * + * @since 4.7.0 + * + * @link https://tools.ietf.org/html/rfc2388 + * @link https://tools.ietf.org/html/rfc6266 + * + * @param string[] $disposition_header List of Content-Disposition header values. + * @return string|null Filename if available, or null if not found. + */ + public static function get_filename_from_disposition($disposition_header) + { + } + /** + * Retrieves the query params for collections of attachments. + * + * @since 4.7.0 + * + * @return array Query parameters for the attachment collection as an array. + */ + public function get_collection_params() + { + } + /** + * Handles an upload via multipart/form-data ($_FILES). + * + * @since 4.7.0 + * @since 6.6.0 Added the `$time` parameter. + * + * @param array $files Data from the `$_FILES` superglobal. + * @param array $headers HTTP headers from the request. + * @param string|null $time Optional. Time formatted in 'yyyy/mm'. Default null. + * @return array|WP_Error Data from wp_handle_upload(). + */ + protected function upload_from_file($files, $headers, $time = \null) + { + } + /** + * Retrieves the supported media types. + * + * Media types are considered the MIME type category. + * + * @since 4.7.0 + * + * @return array Array of supported media types. + */ + protected function get_media_types() + { + } + /** + * Determine if uploaded file exceeds space quota on multisite. + * + * Replicates check_upload_size(). + * + * @since 4.9.8 + * + * @param array $file $_FILES array for a given file. + * @return true|WP_Error True if can upload, error for errors. + */ + protected function check_upload_size($file) + { + } + /** + * Gets the request args for the edit item route. + * + * @since 5.5.0 + * + * @return array + */ + protected function get_edit_media_item_args() + { + } + } + /** + * REST API: WP_REST_Revisions_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 4.7.0 + */ + /** + * Core class used to access revisions via the REST API. + * + * @since 4.7.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Revisions_Controller extends \WP_REST_Controller + { + /** + * Instance of a revision meta fields object. + * + * @since 6.4.0 + * @var WP_REST_Post_Meta_Fields + */ + protected $meta; + /** + * Constructor. + * + * @since 4.7.0 + * + * @param string $parent_post_type Post type of the parent. + */ + public function __construct($parent_post_type) + { + } + /** + * Registers the routes for revisions based on post types supporting revisions. + * + * @since 4.7.0 + * + * @see register_rest_route() + */ + public function register_routes() + { + } + /** + * Get the parent post, if the ID is valid. + * + * @since 4.7.2 + * + * @param int $parent_post_id Supplied ID. + * @return WP_Post|WP_Error Post object if ID is valid, WP_Error otherwise. + */ + protected function get_parent($parent_post_id) + { + } + /** + * Checks if a given request has access to get revisions. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_items_permissions_check($request) + { + } + /** + * Get the revision, if the ID is valid. + * + * @since 4.7.2 + * + * @param int $id Supplied ID. + * @return WP_Post|WP_Error Revision post object if ID is valid, WP_Error otherwise. + */ + protected function get_revision($id) + { + } + /** + * Gets a collection of revisions. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_items($request) + { + } + /** + * Checks if a given request has access to get a specific revision. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise. + */ + public function get_item_permissions_check($request) + { + } + /** + * Retrieves one revision from the collection. + * + * @since 4.7.0 + * @since 6.5.0 Added a condition to check that parent id matches revision parent id. + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_item($request) + { + } + /** + * Checks if a given request has access to delete a revision. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to delete the item, WP_Error object otherwise. + */ + public function delete_item_permissions_check($request) + { + } + /** + * Deletes a single revision. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function delete_item($request) + { + } + /** + * Determines the allowed query_vars for a get_items() response and prepares + * them for WP_Query. + * + * @since 5.0.0 + * + * @param array $prepared_args Optional. Prepared WP_Query arguments. Default empty array. + * @param WP_REST_Request $request Optional. Full details about the request. + * @return array Items query arguments. + */ + protected function prepare_items_query($prepared_args = array(), $request = \null) + { + } + /** + * Prepares the revision for the REST response. + * + * @since 4.7.0 + * @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support. + * + * @global WP_Post $post Global post object. + * + * @param WP_Post $item Post revision object. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response Response object. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Checks the post_date_gmt or modified_gmt and prepare any post or + * modified date for single post output. + * + * @since 4.7.0 + * + * @param string $date_gmt GMT publication time. + * @param string|null $date Optional. Local publication time. Default null. + * @return string|null ISO8601/RFC3339 formatted datetime, otherwise null. + */ + protected function prepare_date_response($date_gmt, $date = \null) + { + } + /** + * Retrieves the revision's schema, conforming to JSON Schema. + * + * @since 4.7.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Retrieves the query params for collections. + * + * @since 4.7.0 + * + * @return array Collection parameters. + */ + public function get_collection_params() + { + } + /** + * Checks the post excerpt and prepare it for single post output. + * + * @since 4.7.0 + * + * @param string $excerpt The post excerpt. + * @param WP_Post $post Post revision object. + * @return string Prepared excerpt or empty string. + */ + protected function prepare_excerpt_response($excerpt, $post) + { + } + } + /** + * REST API: WP_REST_Autosaves_Controller class. + * + * @package WordPress + * @subpackage REST_API + * @since 5.0.0 + */ + /** + * Core class used to access autosaves via the REST API. + * + * @since 5.0.0 + * + * @see WP_REST_Revisions_Controller + * @see WP_REST_Controller + */ + class WP_REST_Autosaves_Controller extends \WP_REST_Revisions_Controller + { + /** + * Constructor. + * + * @since 5.0.0 + * + * @param string $parent_post_type Post type of the parent. + */ + public function __construct($parent_post_type) + { + } + /** + * Registers the routes for autosaves. + * + * @since 5.0.0 + * + * @see register_rest_route() + */ + public function register_routes() + { + } + /** + * Get the parent post. + * + * @since 5.0.0 + * + * @param int $parent_id Supplied ID. + * @return WP_Post|WP_Error Post object if ID is valid, WP_Error otherwise. + */ + protected function get_parent($parent_id) + { + } + /** + * Checks if a given request has access to get autosaves. + * + * @since 5.0.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_items_permissions_check($request) + { + } + /** + * Checks if a given request has access to create an autosave revision. + * + * Autosave revisions inherit permissions from the parent post, + * check if the current user has permission to edit the post. + * + * @since 5.0.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to create the item, WP_Error object otherwise. + */ + public function create_item_permissions_check($request) + { + } + /** + * Creates, updates or deletes an autosave revision. + * + * @since 5.0.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function create_item($request) + { + } + /** + * Get the autosave, if the ID is valid. + * + * @since 5.0.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_Post|WP_Error Revision post object if ID is valid, WP_Error otherwise. + */ + public function get_item($request) + { + } + /** + * Gets a collection of autosaves using wp_get_post_autosave. + * + * Contains the user's autosave, for empty if it doesn't exist. + * + * @since 5.0.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_items($request) + { + } + /** + * Retrieves the autosave's schema, conforming to JSON Schema. + * + * @since 5.0.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Creates autosave for the specified post. + * + * From wp-admin/post.php. + * + * @since 5.0.0 + * @since 6.4.0 The `$meta` parameter was added. + * + * @param array $post_data Associative array containing the post data. + * @param array $meta Associative array containing the post meta data. + * @return mixed The autosave revision ID or WP_Error. + */ + public function create_post_autosave($post_data, array $meta = array()) + { + } + /** + * Prepares the revision for the REST response. + * + * @since 5.0.0 + * @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param WP_Post $item Post revision object. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response Response object. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Retrieves the query params for the autosaves collection. + * + * @since 5.0.0 + * + * @return array Collection parameters. + */ + public function get_collection_params() + { + } + } + /** + * REST API: WP_REST_Block_Directory_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 5.5.0 + */ + /** + * Controller which provides REST endpoint for the blocks. + * + * @since 5.5.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Block_Directory_Controller extends \WP_REST_Controller + { + /** + * Constructs the controller. + */ + public function __construct() + { + } + /** + * Registers the necessary REST API routes. + */ + public function register_routes() + { + } + /** + * Checks whether a given request has permission to install and activate plugins. + * + * @since 5.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has permission, WP_Error object otherwise. + */ + public function get_items_permissions_check($request) + { + } + /** + * Search and retrieve blocks metadata + * + * @since 5.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_items($request) + { + } + /** + * Parse block metadata for a block, and prepare it for an API response. + * + * @since 5.5.0 + * @since 5.9.0 Renamed `$plugin` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param array $item The plugin metadata. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Generates a list of links to include in the response for the plugin. + * + * @since 5.5.0 + * + * @param array $plugin The plugin data from WordPress.org. + * @return array + */ + protected function prepare_links($plugin) + { + } + /** + * Finds an installed plugin for the given slug. + * + * @since 5.5.0 + * + * @param string $slug The WordPress.org directory slug for a plugin. + * @return string The plugin file found matching it. + */ + protected function find_plugin_for_slug($slug) + { + } + /** + * Retrieves the theme's schema, conforming to JSON Schema. + * + * @since 5.5.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Retrieves the search params for the blocks collection. + * + * @since 5.5.0 + * + * @return array Collection parameters. + */ + public function get_collection_params() + { + } + } + /** + * REST API: WP_REST_Block_Pattern_Categories_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 6.0.0 + */ + /** + * Core class used to access block pattern categories via the REST API. + * + * @since 6.0.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Block_Pattern_Categories_Controller extends \WP_REST_Controller + { + /** + * Constructs the controller. + * + * @since 6.0.0 + */ + public function __construct() + { + } + /** + * Registers the routes for the objects of the controller. + * + * @since 6.0.0 + */ + public function register_routes() + { + } + /** + * Checks whether a given request has permission to read block patterns. + * + * @since 6.0.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_items_permissions_check($request) + { + } + /** + * Retrieves all block pattern categories. + * + * @since 6.0.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. + */ + public function get_items($request) + { + } + /** + * Prepare a raw block pattern category before it gets output in a REST API response. + * + * @since 6.0.0 + * + * @param array $item Raw category as registered, before any changes. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Retrieves the block pattern category schema, conforming to JSON Schema. + * + * @since 6.0.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + } + /** + * REST API: WP_REST_Block_Patterns_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 6.0.0 + */ + /** + * Core class used to access block patterns via the REST API. + * + * @since 6.0.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Block_Patterns_Controller extends \WP_REST_Controller + { + /** + * An array that maps old categories names to new ones. + * + * @since 6.2.0 + * @var array + */ + protected static $categories_migration = array('buttons' => 'call-to-action', 'columns' => 'text', 'query' => 'posts'); + /** + * Constructs the controller. + * + * @since 6.0.0 + */ + public function __construct() + { + } + /** + * Registers the routes for the objects of the controller. + * + * @since 6.0.0 + */ + public function register_routes() + { + } + /** + * Checks whether a given request has permission to read block patterns. + * + * @since 6.0.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_items_permissions_check($request) + { + } + /** + * Retrieves all block patterns. + * + * @since 6.0.0 + * @since 6.2.0 Added migration for old core pattern categories to the new ones. + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_items($request) + { + } + /** + * Migrates old core pattern categories to the new categories. + * + * Core pattern categories are revamped. Migration is needed to ensure + * backwards compatibility. + * + * @since 6.2.0 + * + * @param array $pattern Raw pattern as registered, before applying any changes. + * @return array Migrated pattern. + */ + protected function migrate_pattern_categories($pattern) + { + } + /** + * Prepare a raw block pattern before it gets output in a REST API response. + * + * @since 6.0.0 + * @since 6.3.0 Added `source` property. + * + * @param array $item Raw pattern as registered, before any changes. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Retrieves the block pattern schema, conforming to JSON Schema. + * + * @since 6.0.0 + * @since 6.3.0 Added `source` property. + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + } + /** + * Block Renderer REST API: WP_REST_Block_Renderer_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 5.0.0 + */ + /** + * Controller which provides REST endpoint for rendering a block. + * + * @since 5.0.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Block_Renderer_Controller extends \WP_REST_Controller + { + /** + * Constructs the controller. + * + * @since 5.0.0 + */ + public function __construct() + { + } + /** + * Registers the necessary REST API routes, one for each dynamic block. + * + * @since 5.0.0 + * + * @see register_rest_route() + */ + public function register_routes() + { + } + /** + * Checks if a given request has access to read blocks. + * + * @since 5.0.0 + * + * @global WP_Post $post Global post object. + * + * @param WP_REST_Request $request Request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_item_permissions_check($request) + { + } + /** + * Returns block output from block's registered render_callback. + * + * @since 5.0.0 + * + * @global WP_Post $post Global post object. + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_item($request) + { + } + /** + * Retrieves block's output schema, conforming to JSON Schema. + * + * @since 5.0.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + } + /** + * REST API: WP_REST_Block_Types_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 5.5.0 + */ + /** + * Core class used to access block types via the REST API. + * + * @since 5.5.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Block_Types_Controller extends \WP_REST_Controller + { + const NAME_PATTERN = '^[a-z][a-z0-9-]*/[a-z][a-z0-9-]*$'; + /** + * Instance of WP_Block_Type_Registry. + * + * @since 5.5.0 + * @var WP_Block_Type_Registry + */ + protected $block_registry; + /** + * Instance of WP_Block_Styles_Registry. + * + * @since 5.5.0 + * @var WP_Block_Styles_Registry + */ + protected $style_registry; + /** + * Constructor. + * + * @since 5.5.0 + */ + public function __construct() + { + } + /** + * Registers the routes for block types. + * + * @since 5.5.0 + * + * @see register_rest_route() + */ + public function register_routes() + { + } + /** + * Checks whether a given request has permission to read post block types. + * + * @since 5.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_items_permissions_check($request) + { + } + /** + * Retrieves all post block types, depending on user context. + * + * @since 5.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_items($request) + { + } + /** + * Checks if a given request has access to read a block type. + * + * @since 5.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise. + */ + public function get_item_permissions_check($request) + { + } + /** + * Checks whether a given block type should be visible. + * + * @since 5.5.0 + * + * @return true|WP_Error True if the block type is visible, WP_Error otherwise. + */ + protected function check_read_permission() + { + } + /** + * Get the block, if the name is valid. + * + * @since 5.5.0 + * + * @param string $name Block name. + * @return WP_Block_Type|WP_Error Block type object if name is valid, WP_Error otherwise. + */ + protected function get_block($name) + { + } + /** + * Retrieves a specific block type. + * + * @since 5.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_item($request) + { + } + /** + * Prepares a block type object for serialization. + * + * @since 5.5.0 + * @since 5.9.0 Renamed `$block_type` to `$item` to match parent class for PHP 8 named parameter support. + * @since 6.3.0 Added `selectors` field. + * @since 6.5.0 Added `view_script_module_ids` field. + * + * @param WP_Block_Type $item Block type data. + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response Block type data. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Prepares links for the request. + * + * @since 5.5.0 + * + * @param WP_Block_Type $block_type Block type data. + * @return array Links for the given block type. + */ + protected function prepare_links($block_type) + { + } + /** + * Retrieves the block type' schema, conforming to JSON Schema. + * + * @since 5.5.0 + * @since 6.3.0 Added `selectors` field. + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Retrieves the query params for collections. + * + * @since 5.5.0 + * + * @return array Collection parameters. + */ + public function get_collection_params() + { + } + } + /** + * Synced patterns REST API: WP_REST_Blocks_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 5.0.0 + */ + /** + * Controller which provides a REST endpoint for the editor to read, create, + * edit, and delete synced patterns (formerly called reusable blocks). + * Patterns are stored as posts with the wp_block post type. + * + * @since 5.0.0 + * + * @see WP_REST_Posts_Controller + * @see WP_REST_Controller + */ + class WP_REST_Blocks_Controller extends \WP_REST_Posts_Controller + { + /** + * Checks if a pattern can be read. + * + * @since 5.0.0 + * + * @param WP_Post $post Post object that backs the block. + * @return bool Whether the pattern can be read. + */ + public function check_read_permission($post) + { + } + /** + * Filters a response based on the context defined in the schema. + * + * @since 5.0.0 + * @since 6.3.0 Adds the `wp_pattern_sync_status` postmeta property to the top level of response. + * + * @param array $data Response data to filter. + * @param string $context Context defined in the schema. + * @return array Filtered response. + */ + public function filter_response_by_context($data, $context) + { + } + /** + * Retrieves the pattern's schema, conforming to JSON Schema. + * + * @since 5.0.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + } + /** + * REST API: WP_REST_Comments_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 4.7.0 + */ + /** + * Core controller used to access comments via the REST API. + * + * @since 4.7.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Comments_Controller extends \WP_REST_Controller + { + /** + * Instance of a comment meta fields object. + * + * @since 4.7.0 + * @var WP_REST_Comment_Meta_Fields + */ + protected $meta; + /** + * Constructor. + * + * @since 4.7.0 + */ + public function __construct() + { + } + /** + * Registers the routes for comments. + * + * @since 4.7.0 + * + * @see register_rest_route() + */ + public function register_routes() + { + } + /** + * Checks if a given request has access to read comments. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, error object otherwise. + */ + public function get_items_permissions_check($request) + { + } + /** + * Retrieves a list of comment items. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or error object on failure. + */ + public function get_items($request) + { + } + /** + * Get the comment, if the ID is valid. + * + * @since 4.7.2 + * + * @param int $id Supplied ID. + * @return WP_Comment|WP_Error Comment object if ID is valid, WP_Error otherwise. + */ + protected function get_comment($id) + { + } + /** + * Checks if a given request has access to read the comment. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access for the item, error object otherwise. + */ + public function get_item_permissions_check($request) + { + } + /** + * Retrieves a comment. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or error object on failure. + */ + public function get_item($request) + { + } + /** + * Checks if a given request has access to create a comment. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to create items, error object otherwise. + */ + public function create_item_permissions_check($request) + { + } + /** + * Creates a comment. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or error object on failure. + */ + public function create_item($request) + { + } + /** + * Checks if a given REST request has access to update a comment. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to update the item, error object otherwise. + */ + public function update_item_permissions_check($request) + { + } + /** + * Updates a comment. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or error object on failure. + */ + public function update_item($request) + { + } + /** + * Checks if a given request has access to delete a comment. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to delete the item, error object otherwise. + */ + public function delete_item_permissions_check($request) + { + } + /** + * Deletes a comment. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or error object on failure. + */ + public function delete_item($request) + { + } + /** + * Prepares a single comment output for response. + * + * @since 4.7.0 + * @since 5.9.0 Renamed `$comment` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param WP_Comment $item Comment object. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response Response object. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Prepares links for the request. + * + * @since 4.7.0 + * + * @param WP_Comment $comment Comment object. + * @return array Links for the given comment. + */ + protected function prepare_links($comment) + { + } + /** + * Prepends internal property prefix to query parameters to match our response fields. + * + * @since 4.7.0 + * + * @param string $query_param Query parameter. + * @return string The normalized query parameter. + */ + protected function normalize_query_param($query_param) + { + } + /** + * Checks comment_approved to set comment status for single comment output. + * + * @since 4.7.0 + * + * @param string|int $comment_approved comment status. + * @return string Comment status. + */ + protected function prepare_status_response($comment_approved) + { + } + /** + * Prepares a single comment to be inserted into the database. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Request object. + * @return array|WP_Error Prepared comment, otherwise WP_Error object. + */ + protected function prepare_item_for_database($request) + { + } + /** + * Retrieves the comment's schema, conforming to JSON Schema. + * + * @since 4.7.0 + * + * @return array + */ + public function get_item_schema() + { + } + /** + * Retrieves the query params for collections. + * + * @since 4.7.0 + * + * @return array Comments collection parameters. + */ + public function get_collection_params() + { + } + /** + * Sets the comment_status of a given comment object when creating or updating a comment. + * + * @since 4.7.0 + * + * @param string|int $new_status New comment status. + * @param int $comment_id Comment ID. + * @return bool Whether the status was changed. + */ + protected function handle_status_param($new_status, $comment_id) + { + } + /** + * Checks if the post can be read. + * + * Correctly handles posts with the inherit status. + * + * @since 4.7.0 + * + * @param WP_Post $post Post object. + * @param WP_REST_Request $request Request data to check. + * @return bool Whether post can be read. + */ + protected function check_read_post_permission($post, $request) + { + } + /** + * Checks if the comment can be read. + * + * @since 4.7.0 + * + * @param WP_Comment $comment Comment object. + * @param WP_REST_Request $request Request data to check. + * @return bool Whether the comment can be read. + */ + protected function check_read_permission($comment, $request) + { + } + /** + * Checks if a comment can be edited or deleted. + * + * @since 4.7.0 + * + * @param WP_Comment $comment Comment object. + * @return bool Whether the comment can be edited or deleted. + */ + protected function check_edit_permission($comment) + { + } + /** + * Checks a comment author email for validity. + * + * Accepts either a valid email address or empty string as a valid comment + * author email address. Setting the comment author email to an empty + * string is allowed when a comment is being updated. + * + * @since 4.7.0 + * + * @param string $value Author email value submitted. + * @param WP_REST_Request $request Full details about the request. + * @param string $param The parameter name. + * @return string|WP_Error The sanitized email address, if valid, + * otherwise an error. + */ + public function check_comment_author_email($value, $request, $param) + { + } + /** + * If empty comments are not allowed, checks if the provided comment content is not empty. + * + * @since 5.6.0 + * + * @param array $prepared_comment The prepared comment data. + * @return bool True if the content is allowed, false otherwise. + */ + protected function check_is_comment_content_allowed($prepared_comment) + { + } + } + /** + * REST API: WP_REST_Edit_Site_Export_Controller class + * + * @package WordPress + * @subpackage REST_API + */ + /** + * Controller which provides REST endpoint for exporting current templates + * and template parts. + * + * @since 5.9.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Edit_Site_Export_Controller extends \WP_REST_Controller + { + /** + * Constructor. + * + * @since 5.9.0 + */ + public function __construct() + { + } + /** + * Registers the site export route. + * + * @since 5.9.0 + */ + public function register_routes() + { + } + /** + * Checks whether a given request has permission to export. + * + * @since 5.9.0 + * + * @return WP_Error|true True if the request has access, or WP_Error object. + */ + public function permissions_check() + { + } + /** + * Output a ZIP file with an export of the current templates + * and template parts from the site editor, and close the connection. + * + * @since 5.9.0 + * + * @return WP_Error|void + */ + public function export() + { + } + } + /** + * Rest Font Collections Controller. + * + * This file contains the class for the REST API Font Collections Controller. + * + * @package WordPress + * @subpackage REST_API + * @since 6.5.0 + */ + /** + * Font Library Controller class. + * + * @since 6.5.0 + */ + class WP_REST_Font_Collections_Controller extends \WP_REST_Controller + { + /** + * Constructor. + * + * @since 6.5.0 + */ + public function __construct() + { + } + /** + * Registers the routes for the objects of the controller. + * + * @since 6.5.0 + */ + public function register_routes() + { + } + /** + * Gets the font collections available. + * + * @since 6.5.0 + * + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_items($request) + { + } + /** + * Gets a font collection. + * + * @since 6.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_item($request) + { + } + /** + * Prepare a single collection output for response. + * + * @since 6.5.0 + * + * @param WP_Font_Collection $item Font collection object. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Retrieves the font collection's schema, conforming to JSON Schema. + * + * @since 6.5.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Prepares links for the request. + * + * @since 6.5.0 + * + * @param WP_Font_Collection $collection Font collection data + * @return array Links for the given font collection. + */ + protected function prepare_links($collection) + { + } + /** + * Retrieves the search params for the font collections. + * + * @since 6.5.0 + * + * @return array Collection parameters. + */ + public function get_collection_params() + { + } + /** + * Checks whether the user has permissions to use the Fonts Collections. + * + * @since 6.5.0 + * + * @return true|WP_Error True if the request has write access for the item, WP_Error object otherwise. + */ + public function get_items_permissions_check($request) + { + } + } + /** + * REST API: WP_REST_Font_Faces_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 6.5.0 + */ + /** + * Class to access font faces through the REST API. + */ + class WP_REST_Font_Faces_Controller extends \WP_REST_Posts_Controller + { + /** + * The latest version of theme.json schema supported by the controller. + * + * @since 6.5.0 + * @var int + */ + const LATEST_THEME_JSON_VERSION_SUPPORTED = 3; + /** + * Whether the controller supports batching. + * + * @since 6.5.0 + * @var false + */ + protected $allow_batch = \false; + /** + * Registers the routes for posts. + * + * @since 6.5.0 + * + * @see register_rest_route() + */ + public function register_routes() + { + } + /** + * Checks if a given request has access to font faces. + * + * @since 6.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_items_permissions_check($request) + { + } + /** + * Checks if a given request has access to a font face. + * + * @since 6.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_item_permissions_check($request) + { + } + /** + * Validates settings when creating a font face. + * + * @since 6.5.0 + * + * @param string $value Encoded JSON string of font face settings. + * @param WP_REST_Request $request Request object. + * @return true|WP_Error True if the settings are valid, otherwise a WP_Error object. + */ + public function validate_create_font_face_settings($value, $request) + { + } + /** + * Sanitizes the font face settings when creating a font face. + * + * @since 6.5.0 + * + * @param string $value Encoded JSON string of font face settings. + * @return array Decoded and sanitized array of font face settings. + */ + public function sanitize_font_face_settings($value) + { + } + /** + * Retrieves a collection of font faces within the parent font family. + * + * @since 6.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_items($request) + { + } + /** + * Retrieves a single font face within the parent font family. + * + * @since 6.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_item($request) + { + } + /** + * Creates a font face for the parent font family. + * + * @since 6.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function create_item($request) + { + } + /** + * Deletes a single font face. + * + * @since 6.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function delete_item($request) + { + } + /** + * Prepares a single font face output for response. + * + * @since 6.5.0 + * + * @param WP_Post $item Post object. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response Response object. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Retrieves the post's schema, conforming to JSON Schema. + * + * @since 6.5.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Retrieves the item's schema for display / public consumption purposes. + * + * @since 6.5.0 + * + * @return array Public item schema data. + */ + public function get_public_item_schema() + { + } + /** + * Retrieves the query params for the font face collection. + * + * @since 6.5.0 + * + * @return array Collection parameters. + */ + public function get_collection_params() + { + } + /** + * Get the params used when creating a new font face. + * + * @since 6.5.0 + * + * @return array Font face create arguments. + */ + public function get_create_params() + { + } + /** + * Get the parent font family, if the ID is valid. + * + * @since 6.5.0 + * + * @param int $font_family_id Supplied ID. + * @return WP_Post|WP_Error Post object if ID is valid, WP_Error otherwise. + */ + protected function get_parent_font_family_post($font_family_id) + { + } + /** + * Prepares links for the request. + * + * @since 6.5.0 + * + * @param WP_Post $post Post object. + * @return array Links for the given post. + */ + protected function prepare_links($post) + { + } + /** + * Prepares a single font face post for creation. + * + * @since 6.5.0 + * + * @param WP_REST_Request $request Request object. + * @return stdClass Post object. + */ + protected function prepare_item_for_database($request) + { + } + /** + * Sanitizes a single src value for a font face. + * + * @since 6.5.0 + * + * @param string $value Font face src that is a URL or the key for a $_FILES array item. + * @return string Sanitized value. + */ + protected function sanitize_src($value) + { + } + /** + * Handles the upload of a font file using wp_handle_upload(). + * + * @since 6.5.0 + * + * @param array $file Single file item from $_FILES. + * @return array|WP_Error Array containing uploaded file attributes on success, or WP_Error object on failure. + */ + protected function handle_font_file_upload($file) + { + } + /** + * Handles file upload error. + * + * @since 6.5.0 + * + * @param array $file File upload data. + * @param string $message Error message from wp_handle_upload(). + * @return WP_Error WP_Error object. + */ + public function handle_font_file_upload_error($file, $message) + { + } + /** + * Returns relative path to an uploaded font file. + * + * The path is relative to the current fonts directory. + * + * @since 6.5.0 + * @access private + * + * @param string $path Full path to the file. + * @return string Relative path on success, unchanged path on failure. + */ + protected function relative_fonts_path($path) + { + } + /** + * Gets the font face's settings from the post. + * + * @since 6.5.0 + * + * @param WP_Post $post Font face post object. + * @return array Font face settings array. + */ + protected function get_settings_from_post($post) + { + } + } + /** + * REST API: WP_REST_Font_Families_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 6.5.0 + */ + /** + * Font Families Controller class. + * + * @since 6.5.0 + */ + class WP_REST_Font_Families_Controller extends \WP_REST_Posts_Controller + { + /** + * The latest version of theme.json schema supported by the controller. + * + * @since 6.5.0 + * @var int + */ + const LATEST_THEME_JSON_VERSION_SUPPORTED = 3; + /** + * Whether the controller supports batching. + * + * @since 6.5.0 + * @var false + */ + protected $allow_batch = \false; + /** + * Checks if a given request has access to font families. + * + * @since 6.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_items_permissions_check($request) + { + } + /** + * Checks if a given request has access to a font family. + * + * @since 6.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_item_permissions_check($request) + { + } + /** + * Validates settings when creating or updating a font family. + * + * @since 6.5.0 + * + * @param string $value Encoded JSON string of font family settings. + * @param WP_REST_Request $request Request object. + * @return true|WP_Error True if the settings are valid, otherwise a WP_Error object. + */ + public function validate_font_family_settings($value, $request) + { + } + /** + * Sanitizes the font family settings when creating or updating a font family. + * + * @since 6.5.0 + * + * @param string $value Encoded JSON string of font family settings. + * @return array Decoded array of font family settings. + */ + public function sanitize_font_family_settings($value) + { + } + /** + * Creates a single font family. + * + * @since 6.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function create_item($request) + { + } + /** + * Deletes a single font family. + * + * @since 6.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function delete_item($request) + { + } + /** + * Prepares a single font family output for response. + * + * @since 6.5.0 + * + * @param WP_Post $item Post object. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response Response object. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Retrieves the post's schema, conforming to JSON Schema. + * + * @since 6.5.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Retrieves the item's schema for display / public consumption purposes. + * + * @since 6.5.0 + * + * @return array Public item schema data. + */ + public function get_public_item_schema() + { + } + /** + * Retrieves the query params for the font family collection. + * + * @since 6.5.0 + * + * @return array Collection parameters. + */ + public function get_collection_params() + { + } + /** + * Get the arguments used when creating or updating a font family. + * + * @since 6.5.0 + * + * @return array Font family create/edit arguments. + */ + public function get_endpoint_args_for_item_schema($method = \WP_REST_Server::CREATABLE) + { + } + /** + * Get the child font face post IDs. + * + * @since 6.5.0 + * + * @param int $font_family_id Font family post ID. + * @return int[] Array of child font face post IDs. + */ + protected function get_font_face_ids($font_family_id) + { + } + /** + * Prepares font family links for the request. + * + * @since 6.5.0 + * + * @param WP_Post $post Post object. + * @return array Links for the given post. + */ + protected function prepare_links($post) + { + } + /** + * Prepares child font face links for the request. + * + * @param int $font_family_id Font family post ID. + * @return array Links for the child font face posts. + */ + protected function prepare_font_face_links($font_family_id) + { + } + /** + * Prepares a single font family post for create or update. + * + * @since 6.5.0 + * + * @param WP_REST_Request $request Request object. + * @return stdClass|WP_Error Post object or WP_Error. + */ + protected function prepare_item_for_database($request) + { + } + /** + * Gets the font family's settings from the post. + * + * @since 6.5.0 + * + * @param WP_Post $post Font family post object. + * @return array Font family settings array. + */ + protected function get_settings_from_post($post) + { + } + } + /** + * REST API: WP_REST_Global_Styles_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 5.9.0 + */ + /** + * Base Global Styles REST API Controller. + */ + class WP_REST_Global_Styles_Controller extends \WP_REST_Posts_Controller + { + /** + * Whether the controller supports batching. + * + * @since 6.6.0 + * @var array + */ + protected $allow_batch = array('v1' => \false); + /** + * Constructor. + * + * @since 6.6.0 + * + * @param string $post_type Post type. + */ + public function __construct($post_type = 'wp_global_styles') + { + } + /** + * Registers the controllers routes. + * + * @since 5.9.0 + */ + public function register_routes() + { + } + /** + * Sanitize the global styles ID or stylesheet to decode endpoint. + * For example, `wp/v2/global-styles/twentytwentytwo%200.4.0` + * would be decoded to `twentytwentytwo 0.4.0`. + * + * @since 5.9.0 + * + * @param string $id_or_stylesheet Global styles ID or stylesheet. + * @return string Sanitized global styles ID or stylesheet. + */ + public function _sanitize_global_styles_callback($id_or_stylesheet) + { + } + /** + * Get the post, if the ID is valid. + * + * @since 5.9.0 + * + * @param int $id Supplied ID. + * @return WP_Post|WP_Error Post object if ID is valid, WP_Error otherwise. + */ + protected function get_post($id) + { + } + /** + * Checks if a given request has access to read a single global style. + * + * @since 5.9.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_item_permissions_check($request) + { + } + /** + * Checks if a global style can be read. + * + * @since 5.9.0 + * + * @param WP_Post $post Post object. + * @return bool Whether the post can be read. + */ + public function check_read_permission($post) + { + } + /** + * Checks if a given request has access to write a single global styles config. + * + * @since 5.9.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has write access for the item, WP_Error object otherwise. + */ + public function update_item_permissions_check($request) + { + } + /** + * Prepares a single global styles config for update. + * + * @since 5.9.0 + * @since 6.2.0 Added validation of styles.css property. + * @since 6.6.0 Added registration of block style variations from theme.json sources (theme.json, user theme.json, partials). + * + * @param WP_REST_Request $request Request object. + * @return stdClass|WP_Error Prepared item on success. WP_Error on when the custom CSS is not valid. + */ + protected function prepare_item_for_database($request) + { + } + /** + * Prepare a global styles config output for response. + * + * @since 5.9.0 + * @since 6.6.0 Added custom relative theme file URIs to `_links`. + * + * @param WP_Post $post Global Styles post object. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response Response object. + */ + public function prepare_item_for_response($post, $request) + { + } + /** + * Prepares links for the request. + * + * @since 5.9.0 + * @since 6.3.0 Adds revisions count and rest URL href to version-history. + * + * @param integer $id ID. + * @return array Links for the given post. + */ + protected function prepare_links($id) + { + } + /** + * Get the link relations available for the post and current user. + * + * @since 5.9.0 + * @since 6.2.0 Added 'edit-css' action. + * @since 6.6.0 Added $post and $request parameters. + * + * @param WP_Post $post Post object. + * @param WP_REST_Request $request Request object. + * @return array List of link relations. + */ + protected function get_available_actions($post, $request) + { + } + /** + * Retrieves the query params for the global styles collection. + * + * @since 5.9.0 + * + * @return array Collection parameters. + */ + public function get_collection_params() + { + } + /** + * Retrieves the global styles type' schema, conforming to JSON Schema. + * + * @since 5.9.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Checks if a given request has access to read a single theme global styles config. + * + * @since 5.9.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise. + */ + public function get_theme_item_permissions_check($request) + { + } + /** + * Returns the given theme global styles config. + * + * @since 5.9.0 + * @since 6.6.0 Added custom relative theme file URIs to `_links`. + * + * @param WP_REST_Request $request The request instance. + * @return WP_REST_Response|WP_Error + */ + public function get_theme_item($request) + { + } + /** + * Checks if a given request has access to read a single theme global styles config. + * + * @since 6.0.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise. + */ + public function get_theme_items_permissions_check($request) + { + } + /** + * Returns the given theme global styles variations. + * + * @since 6.0.0 + * @since 6.2.0 Returns parent theme variations, if they exist. + * @since 6.6.0 Added custom relative theme file URIs to `_links` for each item. + * + * @param WP_REST_Request $request The request instance. + * + * @return WP_REST_Response|WP_Error + */ + public function get_theme_items($request) + { + } + /** + * Validate style.css as valid CSS. + * + * Currently just checks for invalid markup. + * + * @since 6.2.0 + * @since 6.4.0 Changed method visibility to protected. + * + * @param string $css CSS to validate. + * @return true|WP_Error True if the input was validated, otherwise WP_Error. + */ + protected function validate_custom_css($css) + { + } + } + /** + * REST API: WP_REST_Global_Styles_Revisions_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 6.3.0 + */ + /** + * Core class used to access global styles revisions via the REST API. + * + * @since 6.3.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Global_Styles_Revisions_Controller extends \WP_REST_Revisions_Controller + { + /** + * The base of the parent controller's route. + * + * @since 6.3.0 + * @var string + */ + protected $parent_base; + /** + * Parent post type. + * + * @since 6.6.0 + * @var string + */ + protected $parent_post_type; + /** + * Constructor. + * + * @since 6.3.0 + * @since 6.6.0 Extends class from WP_REST_Revisions_Controller. + * + * @param string $parent_post_type Post type of the parent. + */ + public function __construct($parent_post_type = 'wp_global_styles') + { + } + /** + * Registers the controller's routes. + * + * @since 6.3.0 + * @since 6.6.0 Added route to fetch individual global styles revisions. + */ + public function register_routes() + { + } + /** + * Returns decoded JSON from post content string, + * or a 404 if not found. + * + * @since 6.3.0 + * + * @param string $raw_json Encoded JSON from global styles custom post content. + * @return Array|WP_Error + */ + protected function get_decoded_global_styles_json($raw_json) + { + } + /** + * Returns paginated revisions of the given global styles config custom post type. + * + * The bulk of the body is taken from WP_REST_Revisions_Controller->get_items, + * but global styles does not require as many parameters. + * + * @since 6.3.0 + * + * @param WP_REST_Request $request The request instance. + * @return WP_REST_Response|WP_Error + */ + public function get_items($request) + { + } + /** + * Prepares the revision for the REST response. + * + * @since 6.3.0 + * @since 6.6.0 Added resolved URI links to the response. + * + * @param WP_Post $post Post revision object. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response|WP_Error Response object. + */ + public function prepare_item_for_response($post, $request) + { + } + /** + * Retrieves the revision's schema, conforming to JSON Schema. + * + * @since 6.3.0 + * @since 6.6.0 Merged parent and parent controller schema data. + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Retrieves the query params for collections. + * Removes params that are not supported by global styles revisions. + * + * @since 6.6.0 + * + * @return array Collection parameters. + */ + public function get_collection_params() + { + } + } + /** + * REST API: WP_REST_Menu_Items_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 5.9.0 + */ + /** + * Core class to access nav items via the REST API. + * + * @since 5.9.0 + * + * @see WP_REST_Posts_Controller + */ + class WP_REST_Menu_Items_Controller extends \WP_REST_Posts_Controller + { + /** + * Gets the nav menu item, if the ID is valid. + * + * @since 5.9.0 + * + * @param int $id Supplied ID. + * @return object|WP_Error Post object if ID is valid, WP_Error otherwise. + */ + protected function get_nav_menu_item($id) + { + } + /** + * Checks if a given request has access to read menu items. + * + * @since 5.9.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_items_permissions_check($request) + { + } + /** + * Checks if a given request has access to read a menu item if they have access to edit them. + * + * @since 5.9.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return bool|WP_Error True if the request has read access for the item, WP_Error object or false otherwise. + */ + public function get_item_permissions_check($request) + { + } + /** + * Checks whether the current user has read permission for the endpoint. + * + * This allows for any user that can `edit_theme_options` or edit any REST API available post type. + * + * @since 5.9.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise. + */ + protected function check_has_read_only_access($request) + { + } + /** + * Creates a single post. + * + * @since 5.9.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function create_item($request) + { + } + /** + * Updates a single nav menu item. + * + * @since 5.9.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function update_item($request) + { + } + /** + * Deletes a single menu item. + * + * @since 5.9.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error True on success, or WP_Error object on failure. + */ + public function delete_item($request) + { + } + /** + * Prepares a single post for create or update. + * + * @since 5.9.0 + * + * @param WP_REST_Request $request Request object. + * + * @return object|WP_Error + */ + protected function prepare_item_for_database($request) + { + } + /** + * Prepares a single post output for response. + * + * @since 5.9.0 + * + * @param WP_Post $item Post object. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response Response object. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Prepares links for the request. + * + * @since 5.9.0 + * + * @param WP_Post $post Post object. + * @return array Links for the given post. + */ + protected function prepare_links($post) + { + } + /** + * Retrieves Link Description Objects that should be added to the Schema for the posts collection. + * + * @since 5.9.0 + * + * @return array + */ + protected function get_schema_links() + { + } + /** + * Retrieves the term's schema, conforming to JSON Schema. + * + * @since 5.9.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Retrieves the query params for the posts collection. + * + * @since 5.9.0 + * + * @return array Collection parameters. + */ + public function get_collection_params() + { + } + /** + * Determines the allowed query_vars for a get_items() response and prepares + * them for WP_Query. + * + * @since 5.9.0 + * + * @param array $prepared_args Optional. Prepared WP_Query arguments. Default empty array. + * @param WP_REST_Request $request Optional. Full details about the request. + * @return array Items query arguments. + */ + protected function prepare_items_query($prepared_args = array(), $request = \null) + { + } + /** + * Gets the id of the menu that the given menu item belongs to. + * + * @since 5.9.0 + * + * @param int $menu_item_id Menu item id. + * @return int + */ + protected function get_menu_id($menu_item_id) + { + } + } + /** + * REST API: WP_REST_Menu_Locations_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 5.9.0 + */ + /** + * Core class used to access menu locations via the REST API. + * + * @since 5.9.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Menu_Locations_Controller extends \WP_REST_Controller + { + /** + * Menu Locations Constructor. + * + * @since 5.9.0 + */ + public function __construct() + { + } + /** + * Registers the routes for the objects of the controller. + * + * @since 5.9.0 + * + * @see register_rest_route() + */ + public function register_routes() + { + } + /** + * Checks whether a given request has permission to read menu locations. + * + * @since 5.9.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_Error|bool True if the request has read access, WP_Error object otherwise. + */ + public function get_items_permissions_check($request) + { + } + /** + * Retrieves all menu locations, depending on user context. + * + * @since 5.9.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. + */ + public function get_items($request) + { + } + /** + * Checks if a given request has access to read a menu location. + * + * @since 5.9.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise. + */ + public function get_item_permissions_check($request) + { + } + /** + * Retrieves a specific menu location. + * + * @since 5.9.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. + */ + public function get_item($request) + { + } + /** + * Prepares a menu location object for serialization. + * + * @since 5.9.0 + * + * @param stdClass $item Post status data. + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response Menu location data. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Prepares links for the request. + * + * @since 5.9.0 + * + * @param stdClass $location Menu location. + * @return array Links for the given menu location. + */ + protected function prepare_links($location) + { + } + /** + * Retrieves the menu location's schema, conforming to JSON Schema. + * + * @since 5.9.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Retrieves the query params for collections. + * + * @since 5.9.0 + * + * @return array Collection parameters. + */ + public function get_collection_params() + { + } + } + /** + * REST API: WP_REST_Terms_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 4.7.0 + */ + /** + * Core class used to managed terms associated with a taxonomy via the REST API. + * + * @since 4.7.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Terms_Controller extends \WP_REST_Controller + { + /** + * Taxonomy key. + * + * @since 4.7.0 + * @var string + */ + protected $taxonomy; + /** + * Instance of a term meta fields object. + * + * @since 4.7.0 + * @var WP_REST_Term_Meta_Fields + */ + protected $meta; + /** + * Column to have the terms be sorted by. + * + * @since 4.7.0 + * @var string + */ + protected $sort_column; + /** + * Number of terms that were found. + * + * @since 4.7.0 + * @var int + */ + protected $total_terms; + /** + * Whether the controller supports batching. + * + * @since 5.9.0 + * @var array + */ + protected $allow_batch = array('v1' => \true); + /** + * Constructor. + * + * @since 4.7.0 + * + * @param string $taxonomy Taxonomy key. + */ + public function __construct($taxonomy) + { + } + /** + * Registers the routes for terms. + * + * @since 4.7.0 + * + * @see register_rest_route() + */ + public function register_routes() + { + } + /** + * Checks if the terms for a post can be read. + * + * @since 6.0.3 + * + * @param WP_Post $post Post object. + * @param WP_REST_Request $request Full details about the request. + * @return bool Whether the terms for the post can be read. + */ + public function check_read_terms_permission_for_post($post, $request) + { + } + /** + * Checks if a request has access to read terms in the specified taxonomy. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return bool|WP_Error True if the request has read access, otherwise false or WP_Error object. + */ + public function get_items_permissions_check($request) + { + } + /** + * Retrieves terms associated with a taxonomy. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_items($request) + { + } + /** + * Get the term, if the ID is valid. + * + * @since 4.7.2 + * + * @param int $id Supplied ID. + * @return WP_Term|WP_Error Term object if ID is valid, WP_Error otherwise. + */ + protected function get_term($id) + { + } + /** + * Checks if a request has access to read or edit the specified term. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access for the item, otherwise WP_Error object. + */ + public function get_item_permissions_check($request) + { + } + /** + * Gets a single term from a taxonomy. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_item($request) + { + } + /** + * Checks if a request has access to create a term. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to create items, false or WP_Error object otherwise. + */ + public function create_item_permissions_check($request) + { + } + /** + * Creates a single term in a taxonomy. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function create_item($request) + { + } + /** + * Checks if a request has access to update the specified term. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to update the item, false or WP_Error object otherwise. + */ + public function update_item_permissions_check($request) + { + } + /** + * Updates a single term from a taxonomy. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function update_item($request) + { + } + /** + * Checks if a request has access to delete the specified term. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to delete the item, otherwise false or WP_Error object. + */ + public function delete_item_permissions_check($request) + { + } + /** + * Deletes a single term from a taxonomy. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function delete_item($request) + { + } + /** + * Prepares a single term for create or update. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Request object. + * @return object Term object. + */ + public function prepare_item_for_database($request) + { + } + /** + * Prepares a single term output for response. + * + * @since 4.7.0 + * + * @param WP_Term $item Term object. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response Response object. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Prepares links for the request. + * + * @since 4.7.0 + * + * @param WP_Term $term Term object. + * @return array Links for the given term. + */ + protected function prepare_links($term) + { + } + /** + * Retrieves the term's schema, conforming to JSON Schema. + * + * @since 4.7.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Retrieves the query params for collections. + * + * @since 4.7.0 + * + * @return array Collection parameters. + */ + public function get_collection_params() + { + } + /** + * Checks that the taxonomy is valid. + * + * @since 4.7.0 + * + * @param string $taxonomy Taxonomy to check. + * @return bool Whether the taxonomy is allowed for REST management. + */ + protected function check_is_taxonomy_allowed($taxonomy) + { + } + } + /** + * REST API: WP_REST_Menus_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 5.9.0 + */ + /** + * Core class used to managed menu terms associated via the REST API. + * + * @since 5.9.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Menus_Controller extends \WP_REST_Terms_Controller + { + /** + * Checks if a request has access to read menus. + * + * @since 5.9.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return bool|WP_Error True if the request has read access, otherwise false or WP_Error object. + */ + public function get_items_permissions_check($request) + { + } + /** + * Checks if a request has access to read or edit the specified menu. + * + * @since 5.9.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access for the item, otherwise WP_Error object. + */ + public function get_item_permissions_check($request) + { + } + /** + * Gets the term, if the ID is valid. + * + * @since 5.9.0 + * + * @param int $id Supplied ID. + * @return WP_Term|WP_Error Term object if ID is valid, WP_Error otherwise. + */ + protected function get_term($id) + { + } + /** + * Checks whether the current user has read permission for the endpoint. + * + * This allows for any user that can `edit_theme_options` or edit any REST API available post type. + * + * @since 5.9.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the current user has permission, WP_Error object otherwise. + */ + protected function check_has_read_only_access($request) + { + } + /** + * Prepares a single term output for response. + * + * @since 5.9.0 + * + * @param WP_Term $term Term object. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response Response object. + */ + public function prepare_item_for_response($term, $request) + { + } + /** + * Prepares links for the request. + * + * @since 5.9.0 + * + * @param WP_Term $term Term object. + * @return array Links for the given term. + */ + protected function prepare_links($term) + { + } + /** + * Prepares a single term for create or update. + * + * @since 5.9.0 + * + * @param WP_REST_Request $request Request object. + * @return object Prepared term data. + */ + public function prepare_item_for_database($request) + { + } + /** + * Creates a single term in a taxonomy. + * + * @since 5.9.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function create_item($request) + { + } + /** + * Updates a single term from a taxonomy. + * + * @since 5.9.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function update_item($request) + { + } + /** + * Deletes a single term from a taxonomy. + * + * @since 5.9.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function delete_item($request) + { + } + /** + * Returns the value of a menu's auto_add setting. + * + * @since 5.9.0 + * + * @param int $menu_id The menu id to query. + * @return bool The value of auto_add. + */ + protected function get_menu_auto_add($menu_id) + { + } + /** + * Updates the menu's auto add from a REST request. + * + * @since 5.9.0 + * + * @param int $menu_id The menu id to update. + * @param WP_REST_Request $request Full details about the request. + * @return bool True if the auto add setting was successfully updated. + */ + protected function handle_auto_add($menu_id, $request) + { + } + /** + * Returns the names of the locations assigned to the menu. + * + * @since 5.9.0 + * + * @param int $menu_id The menu id. + * @return string[] The locations assigned to the menu. + */ + protected function get_menu_locations($menu_id) + { + } + /** + * Updates the menu's locations from a REST request. + * + * @since 5.9.0 + * + * @param int $menu_id The menu id to update. + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True on success, a WP_Error on an error updating any of the locations. + */ + protected function handle_locations($menu_id, $request) + { + } + /** + * Retrieves the term's schema, conforming to JSON Schema. + * + * @since 5.9.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + } + /** + * WP_REST_Navigation_Fallback_Controller class + * + * REST Controller to create/fetch a fallback Navigation Menu. + * + * @package WordPress + * @subpackage REST_API + * @since 6.3.0 + */ + /** + * REST Controller to fetch a fallback Navigation Block Menu. If needed it creates one. + * + * @since 6.3.0 + */ + class WP_REST_Navigation_Fallback_Controller extends \WP_REST_Controller + { + /** + * Constructs the controller. + * + * @since 6.3.0 + */ + public function __construct() + { + } + /** + * Registers the controllers routes. + * + * @since 6.3.0 + */ + public function register_routes() + { + } + /** + * Checks if a given request has access to read fallbacks. + * + * @since 6.3.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_item_permissions_check($request) + { + } + /** + * Gets the most appropriate fallback Navigation Menu. + * + * @since 6.3.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_item($request) + { + } + /** + * Retrieves the fallbacks' schema, conforming to JSON Schema. + * + * @since 6.3.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Matches the post data to the schema we want. + * + * @since 6.3.0 + * + * @param WP_Post $item The wp_navigation Post object whose response is being prepared. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response $response The response data. + */ + public function prepare_item_for_response($item, $request) + { + } + } + /** + * Block Pattern Directory REST API: WP_REST_Pattern_Directory_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 5.8.0 + */ + /** + * Controller which provides REST endpoint for block patterns. + * + * This simply proxies the endpoint at http://api.wordpress.org/patterns/1.0/. That isn't necessary for + * functionality, but is desired for privacy. It prevents api.wordpress.org from knowing the user's IP address. + * + * @since 5.8.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Pattern_Directory_Controller extends \WP_REST_Controller + { + /** + * Constructs the controller. + * + * @since 5.8.0 + */ + public function __construct() + { + } + /** + * Registers the necessary REST API routes. + * + * @since 5.8.0 + */ + public function register_routes() + { + } + /** + * Checks whether a given request has permission to view the local block pattern directory. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has permission, WP_Error object otherwise. + */ + public function get_items_permissions_check($request) + { + } + /** + * Search and retrieve block patterns metadata + * + * @since 5.8.0 + * @since 6.0.0 Added 'slug' to request. + * @since 6.2.0 Added 'per_page', 'page', 'offset', 'order', and 'orderby' to request. + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_items($request) + { + } + /** + * Prepare a raw block pattern before it gets output in a REST API response. + * + * @since 5.8.0 + * @since 5.9.0 Renamed `$raw_pattern` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param object $item Raw pattern from api.wordpress.org, before any changes. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Retrieves the block pattern's schema, conforming to JSON Schema. + * + * @since 5.8.0 + * @since 6.2.0 Added `'block_types'` to schema. + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Retrieves the search parameters for the block pattern's collection. + * + * @since 5.8.0 + * @since 6.2.0 Added 'per_page', 'page', 'offset', 'order', and 'orderby' to request. + * + * @return array Collection parameters. + */ + public function get_collection_params() + { + } + /* + * Include a hash of the query args, so that different requests are stored in + * separate caches. + * + * MD5 is chosen for its speed, low-collision rate, universal availability, and to stay + * under the character limit for `_site_transient_timeout_{...}` keys. + * + * @link https://stackoverflow.com/questions/3665247/fastest-hash-for-non-cryptographic-uses + * + * @since 6.0.0 + * + * @param array $query_args Query arguments to generate a transient key from. + * @return string Transient key. + */ + protected function get_transient_key($query_args) + { + } + } + /** + * REST API: WP_REST_Plugins_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 5.5.0 + */ + /** + * Core class to access plugins via the REST API. + * + * @since 5.5.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Plugins_Controller extends \WP_REST_Controller + { + const PATTERN = '[^.\\/]+(?:\\/[^.\\/]+)?'; + /** + * Plugins controller constructor. + * + * @since 5.5.0 + */ + public function __construct() + { + } + /** + * Registers the routes for the plugins controller. + * + * @since 5.5.0 + */ + public function register_routes() + { + } + /** + * Checks if a given request has access to get plugins. + * + * @since 5.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_items_permissions_check($request) + { + } + /** + * Retrieves a collection of plugins. + * + * @since 5.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_items($request) + { + } + /** + * Checks if a given request has access to get a specific plugin. + * + * @since 5.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise. + */ + public function get_item_permissions_check($request) + { + } + /** + * Retrieves one plugin from the site. + * + * @since 5.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_item($request) + { + } + /** + * Checks if the given plugin can be viewed by the current user. + * + * On multisite, this hides non-active network only plugins if the user does not have permission + * to manage network plugins. + * + * @since 5.5.0 + * + * @param string $plugin The plugin file to check. + * @return true|WP_Error True if can read, a WP_Error instance otherwise. + */ + protected function check_read_permission($plugin) + { + } + /** + * Checks if a given request has access to upload plugins. + * + * @since 5.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to create items, WP_Error object otherwise. + */ + public function create_item_permissions_check($request) + { + } + /** + * Uploads a plugin and optionally activates it. + * + * @since 5.5.0 + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function create_item($request) + { + } + /** + * Checks if a given request has access to update a specific plugin. + * + * @since 5.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to update the item, WP_Error object otherwise. + */ + public function update_item_permissions_check($request) + { + } + /** + * Updates one plugin. + * + * @since 5.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function update_item($request) + { + } + /** + * Checks if a given request has access to delete a specific plugin. + * + * @since 5.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to delete the item, WP_Error object otherwise. + */ + public function delete_item_permissions_check($request) + { + } + /** + * Deletes one plugin from the site. + * + * @since 5.5.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function delete_item($request) + { + } + /** + * Prepares the plugin for the REST response. + * + * @since 5.5.0 + * + * @param array $item Unmarked up and untranslated plugin data from {@see get_plugin_data()}. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Prepares links for the request. + * + * @since 5.5.0 + * + * @param array $item The plugin item. + * @return array[] + */ + protected function prepare_links($item) + { + } + /** + * Gets the plugin header data for a plugin. + * + * @since 5.5.0 + * + * @param string $plugin The plugin file to get data for. + * @return array|WP_Error The plugin data, or a WP_Error if the plugin is not installed. + */ + protected function get_plugin_data($plugin) + { + } + /** + * Get's the activation status for a plugin. + * + * @since 5.5.0 + * + * @param string $plugin The plugin file to check. + * @return string Either 'network-active', 'active' or 'inactive'. + * @phpstan-return 'network-active'|'active'|'inactive' + */ + protected function get_plugin_status($plugin) + { + } + /** + * Handle updating a plugin's status. + * + * @since 5.5.0 + * + * @param string $plugin The plugin file to update. + * @param string $new_status The plugin's new status. + * @param string $current_status The plugin's current status. + * @return true|WP_Error + */ + protected function plugin_status_permission_check($plugin, $new_status, $current_status) + { + } + /** + * Handle updating a plugin's status. + * + * @since 5.5.0 + * + * @param string $plugin The plugin file to update. + * @param string $new_status The plugin's new status. + * @param string $current_status The plugin's current status. + * @return true|WP_Error + */ + protected function handle_plugin_status($plugin, $new_status, $current_status) + { + } + /** + * Checks that the "plugin" parameter is a valid path. + * + * @since 5.5.0 + * + * @param string $file The plugin file parameter. + * @return bool + */ + public function validate_plugin_param($file) + { + } + /** + * Sanitizes the "plugin" parameter to be a proper plugin file with ".php" appended. + * + * @since 5.5.0 + * + * @param string $file The plugin file parameter. + * @return string + */ + public function sanitize_plugin_param($file) + { + } + /** + * Checks if the plugin matches the requested parameters. + * + * @since 5.5.0 + * + * @param WP_REST_Request $request The request to require the plugin matches against. + * @param array $item The plugin item. + * @return bool + */ + protected function does_plugin_match_request($request, $item) + { + } + /** + * Checks if the plugin is installed. + * + * @since 5.5.0 + * + * @param string $plugin The plugin file. + * @return bool + */ + protected function is_plugin_installed($plugin) + { + } + /** + * Determine if the endpoints are available. + * + * Only the 'Direct' filesystem transport, and SSH/FTP when credentials are stored are supported at present. + * + * @since 5.5.0 + * + * @return true|WP_Error True if filesystem is available, WP_Error otherwise. + */ + protected function is_filesystem_available() + { + } + /** + * Retrieves the plugin's schema, conforming to JSON Schema. + * + * @since 5.5.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Retrieves the query params for the collections. + * + * @since 5.5.0 + * + * @return array Query parameters for the collection. + */ + public function get_collection_params() + { + } + } + /** + * REST API: WP_REST_Post_Statuses_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 4.7.0 + */ + /** + * Core class used to access post statuses via the REST API. + * + * @since 4.7.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Post_Statuses_Controller extends \WP_REST_Controller + { + /** + * Constructor. + * + * @since 4.7.0 + */ + public function __construct() + { + } + /** + * Registers the routes for post statuses. + * + * @since 4.7.0 + * + * @see register_rest_route() + */ + public function register_routes() + { + } + /** + * Checks whether a given request has permission to read post statuses. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_items_permissions_check($request) + { + } + /** + * Retrieves all post statuses, depending on user context. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_items($request) + { + } + /** + * Checks if a given request has access to read a post status. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise. + */ + public function get_item_permissions_check($request) + { + } + /** + * Checks whether a given post status should be visible. + * + * @since 4.7.0 + * + * @param object $status Post status. + * @return bool True if the post status is visible, otherwise false. + */ + protected function check_read_permission($status) + { + } + /** + * Retrieves a specific post status. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_item($request) + { + } + /** + * Prepares a post status object for serialization. + * + * @since 4.7.0 + * @since 5.9.0 Renamed `$status` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param stdClass $item Post status data. + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response Post status data. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Retrieves the post status' schema, conforming to JSON Schema. + * + * @since 4.7.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Retrieves the query params for collections. + * + * @since 4.7.0 + * + * @return array Collection parameters. + */ + public function get_collection_params() + { + } + } + /** + * REST API: WP_REST_Post_Types_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 4.7.0 + */ + /** + * Core class to access post types via the REST API. + * + * @since 4.7.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Post_Types_Controller extends \WP_REST_Controller + { + /** + * Constructor. + * + * @since 4.7.0 + */ + public function __construct() + { + } + /** + * Registers the routes for post types. + * + * @since 4.7.0 + * + * @see register_rest_route() + */ + public function register_routes() + { + } + /** + * Checks whether a given request has permission to read types. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_items_permissions_check($request) + { + } + /** + * Retrieves all public post types. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_items($request) + { + } + /** + * Retrieves a specific post type. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_item($request) + { + } + /** + * Prepares a post type object for serialization. + * + * @since 4.7.0 + * @since 5.9.0 Renamed `$post_type` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param WP_Post_Type $item Post type object. + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response Response object. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Prepares links for the request. + * + * @since 6.1.0 + * + * @param WP_Post_Type $post_type The post type. + * @return array Links for the given post type. + */ + protected function prepare_links($post_type) + { + } + /** + * Retrieves the post type's schema, conforming to JSON Schema. + * + * @since 4.7.0 + * @since 4.8.0 The `supports` property was added. + * @since 5.9.0 The `visibility` and `rest_namespace` properties were added. + * @since 6.1.0 The `icon` property was added. + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Retrieves the query params for collections. + * + * @since 4.7.0 + * + * @return array Collection parameters. + */ + public function get_collection_params() + { + } + } + /** + * REST API: WP_REST_Search_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 5.0.0 + */ + /** + * Core class to search through all WordPress content via the REST API. + * + * @since 5.0.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Search_Controller extends \WP_REST_Controller + { + /** + * ID property name. + */ + const PROP_ID = 'id'; + /** + * Title property name. + */ + const PROP_TITLE = 'title'; + /** + * URL property name. + */ + const PROP_URL = 'url'; + /** + * Type property name. + */ + const PROP_TYPE = 'type'; + /** + * Subtype property name. + */ + const PROP_SUBTYPE = 'subtype'; + /** + * Identifier for the 'any' type. + */ + const TYPE_ANY = 'any'; + /** + * Search handlers used by the controller. + * + * @since 5.0.0 + * @var WP_REST_Search_Handler[] + */ + protected $search_handlers = array(); + /** + * Constructor. + * + * @since 5.0.0 + * + * @param array $search_handlers List of search handlers to use in the controller. Each search + * handler instance must extend the `WP_REST_Search_Handler` class. + */ + public function __construct(array $search_handlers) + { + } + /** + * Registers the routes for the search controller. + * + * @since 5.0.0 + * + * @see register_rest_route() + */ + public function register_routes() + { + } + /** + * Checks if a given request has access to search content. + * + * @since 5.0.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has search access, WP_Error object otherwise. + */ + public function get_items_permission_check($request) + { + } + /** + * Retrieves a collection of search results. + * + * @since 5.0.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_items($request) + { + } + /** + * Prepares a single search result for response. + * + * @since 5.0.0 + * @since 5.6.0 The `$id` parameter can accept a string. + * @since 5.9.0 Renamed `$id` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param int|string $item ID of the item to prepare. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response Response object. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Retrieves the item schema, conforming to JSON Schema. + * + * @since 5.0.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Retrieves the query params for the search results collection. + * + * @since 5.0.0 + * + * @return array Collection parameters. + */ + public function get_collection_params() + { + } + /** + * Sanitizes the list of subtypes, to ensure only subtypes of the passed type are included. + * + * @since 5.0.0 + * + * @param string|array $subtypes One or more subtypes. + * @param WP_REST_Request $request Full details about the request. + * @param string $parameter Parameter name. + * @return string[]|WP_Error List of valid subtypes, or WP_Error object on failure. + */ + public function sanitize_subtypes($subtypes, $request, $parameter) + { + } + /** + * Gets the search handler to handle the current request. + * + * @since 5.0.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Search_Handler|WP_Error Search handler for the request type, or WP_Error object on failure. + */ + protected function get_search_handler($request) + { + } + } + /** + * REST API: WP_REST_Settings_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 4.7.0 + */ + /** + * Core class used to manage a site's settings via the REST API. + * + * @since 4.7.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Settings_Controller extends \WP_REST_Controller + { + /** + * Constructor. + * + * @since 4.7.0 + */ + public function __construct() + { + } + /** + * Registers the routes for the site's settings. + * + * @since 4.7.0 + * + * @see register_rest_route() + */ + public function register_routes() + { + } + /** + * Checks if a given request has access to read and manage settings. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return bool True if the request has read access for the item, otherwise false. + */ + public function get_item_permissions_check($request) + { + } + /** + * Retrieves the settings. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return array|WP_Error Array on success, or WP_Error object on failure. + */ + public function get_item($request) + { + } + /** + * Prepares a value for output based off a schema array. + * + * @since 4.7.0 + * + * @param mixed $value Value to prepare. + * @param array $schema Schema to match. + * @return mixed The prepared value. + */ + protected function prepare_value($value, $schema) + { + } + /** + * Updates settings for the settings object. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return array|WP_Error Array on success, or error object on failure. + */ + public function update_item($request) + { + } + /** + * Retrieves all of the registered options for the Settings API. + * + * @since 4.7.0 + * + * @return array Array of registered options. + */ + protected function get_registered_options() + { + } + /** + * Retrieves the site setting schema, conforming to JSON Schema. + * + * @since 4.7.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Custom sanitize callback used for all options to allow the use of 'null'. + * + * By default, the schema of settings will throw an error if a value is set to + * `null` as it's not a valid value for something like "type => string". We + * provide a wrapper sanitizer to allow the use of `null`. + * + * @since 4.7.0 + * + * @param mixed $value The value for the setting. + * @param WP_REST_Request $request The request object. + * @param string $param The parameter name. + * @return mixed|WP_Error + */ + public function sanitize_callback($value, $request, $param) + { + } + /** + * Recursively add additionalProperties = false to all objects in a schema + * if no additionalProperties setting is specified. + * + * This is needed to restrict properties of objects in settings values to only + * registered items, as the REST API will allow additional properties by + * default. + * + * @since 4.9.0 + * @deprecated 6.1.0 Use {@see rest_default_additional_properties_to_false()} instead. + * + * @param array $schema The schema array. + * @return array + */ + protected function set_additional_properties_to_false($schema) + { + } + } + /** + * REST API: WP_REST_Sidebars_Controller class + * + * Original code from {@link https://github.com/martin-pettersson/wp-rest-api-sidebars Martin Pettersson (martin_pettersson@outlook.com)}. + * + * @package WordPress + * @subpackage REST_API + * @since 5.8.0 + */ + /** + * Core class used to manage a site's sidebars. + * + * @since 5.8.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Sidebars_Controller extends \WP_REST_Controller + { + /** + * Tracks whether {@see retrieve_widgets()} has been called in the current request. + * + * @since 5.9.0 + * @var bool + */ + protected $widgets_retrieved = \false; + /** + * Sidebars controller constructor. + * + * @since 5.8.0 + */ + public function __construct() + { + } + /** + * Registers the controllers routes. + * + * @since 5.8.0 + */ + public function register_routes() + { + } + /** + * Checks if a given request has access to get sidebars. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_items_permissions_check($request) + { + } + /** + * Retrieves the list of sidebars (active or inactive). + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response Response object on success. + */ + public function get_items($request) + { + } + /** + * Checks if a given request has access to get a single sidebar. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_item_permissions_check($request) + { + } + /** + * Checks if a sidebar can be read publicly. + * + * @since 5.9.0 + * + * @param array $sidebar The registered sidebar configuration. + * @return bool Whether the side can be read. + */ + protected function check_read_permission($sidebar) + { + } + /** + * Retrieves one sidebar from the collection. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_item($request) + { + } + /** + * Checks if a given request has access to update sidebars. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function update_item_permissions_check($request) + { + } + /** + * Updates a sidebar. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response Response object on success, or WP_Error object on failure. + */ + public function update_item($request) + { + } + /** + * Checks if the user has permissions to make the request. + * + * @since 5.8.0 + * + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + protected function do_permissions_check() + { + } + /** + * Retrieves the registered sidebar with the given id. + * + * @since 5.8.0 + * + * @param string|int $id ID of the sidebar. + * @return array|null The discovered sidebar, or null if it is not registered. + */ + protected function get_sidebar($id) + { + } + /** + * Looks for "lost" widgets once per request. + * + * @since 5.9.0 + * + * @see retrieve_widgets() + */ + protected function retrieve_widgets() + { + } + /** + * Prepares a single sidebar output for response. + * + * @since 5.8.0 + * @since 5.9.0 Renamed `$raw_sidebar` to `$item` to match parent class for PHP 8 named parameter support. + * + * @global array $wp_registered_sidebars The registered sidebars. + * @global array $wp_registered_widgets The registered widgets. + * + * @param array $item Sidebar instance. + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response Prepared response object. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Prepares links for the sidebar. + * + * @since 5.8.0 + * + * @param array $sidebar Sidebar. + * @return array Links for the given widget. + */ + protected function prepare_links($sidebar) + { + } + /** + * Retrieves the block type' schema, conforming to JSON Schema. + * + * @since 5.8.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + } + /** + * REST API: WP_REST_Site_Health_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 5.6.0 + */ + /** + * Core class for interacting with Site Health tests. + * + * @since 5.6.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Site_Health_Controller extends \WP_REST_Controller + { + /** + * Site Health controller constructor. + * + * @since 5.6.0 + * + * @param WP_Site_Health $site_health An instance of the site health class. + */ + public function __construct($site_health) + { + } + /** + * Registers API routes. + * + * @since 5.6.0 + * @since 6.1.0 Adds page-cache async test. + * + * @see register_rest_route() + */ + public function register_routes() + { + } + /** + * Validates if the current user can request this REST endpoint. + * + * @since 5.6.0 + * + * @param string $check The endpoint check being ran. + * @return bool + */ + protected function validate_request_permission($check) + { + } + /** + * Checks if background updates work as expected. + * + * @since 5.6.0 + * + * @return array + */ + public function test_background_updates() + { + } + /** + * Checks that the site can reach the WordPress.org API. + * + * @since 5.6.0 + * + * @return array + */ + public function test_dotorg_communication() + { + } + /** + * Checks that loopbacks can be performed. + * + * @since 5.6.0 + * + * @return array + */ + public function test_loopback_requests() + { + } + /** + * Checks that the site's frontend can be accessed over HTTPS. + * + * @since 5.7.0 + * + * @return array + */ + public function test_https_status() + { + } + /** + * Checks that the authorization header is valid. + * + * @since 5.6.0 + * + * @return array + */ + public function test_authorization_header() + { + } + /** + * Checks that full page cache is active. + * + * @since 6.1.0 + * + * @return array The test result. + */ + public function test_page_cache() + { + } + /** + * Gets the current directory sizes for this install. + * + * @since 5.6.0 + * + * @return array|WP_Error + */ + public function get_directory_sizes() + { + } + /** + * Loads the admin textdomain for Site Health tests. + * + * The {@see WP_Site_Health} class is defined in WP-Admin, while the REST API operates in a front-end context. + * This means that the translations for Site Health won't be loaded by default in {@see load_default_textdomain()}. + * + * @since 5.6.0 + */ + protected function load_admin_textdomain() + { + } + /** + * Gets the schema for each site health test. + * + * @since 5.6.0 + * + * @return array The test schema. + */ + public function get_item_schema() + { + } + } + /** + * REST API: WP_REST_Taxonomies_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 4.7.0 + */ + /** + * Core class used to manage taxonomies via the REST API. + * + * @since 4.7.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Taxonomies_Controller extends \WP_REST_Controller + { + /** + * Constructor. + * + * @since 4.7.0 + */ + public function __construct() + { + } + /** + * Registers the routes for taxonomies. + * + * @since 4.7.0 + * + * @see register_rest_route() + */ + public function register_routes() + { + } + /** + * Checks whether a given request has permission to read taxonomies. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_items_permissions_check($request) + { + } + /** + * Retrieves all public taxonomies. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response Response object on success, or WP_Error object on failure. + */ + public function get_items($request) + { + } + /** + * Checks if a given request has access to a taxonomy. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access for the item, otherwise false or WP_Error object. + */ + public function get_item_permissions_check($request) + { + } + /** + * Retrieves a specific taxonomy. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_item($request) + { + } + /** + * Prepares a taxonomy object for serialization. + * + * @since 4.7.0 + * @since 5.9.0 Renamed `$taxonomy` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param WP_Taxonomy $item Taxonomy data. + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response Response object. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Prepares links for the request. + * + * @since 6.1.0 + * + * @param WP_Taxonomy $taxonomy The taxonomy. + * @return array Links for the given taxonomy. + */ + protected function prepare_links($taxonomy) + { + } + /** + * Retrieves the taxonomy's schema, conforming to JSON Schema. + * + * @since 4.7.0 + * @since 5.0.0 The `visibility` property was added. + * @since 5.9.0 The `rest_namespace` property was added. + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Retrieves the query params for collections. + * + * @since 4.7.0 + * + * @return array Collection parameters. + */ + public function get_collection_params() + { + } + } + /** + * REST API: WP_REST_Template_Autosaves_Controller class. + * + * @package WordPress + * @subpackage REST_API + * @since 6.4.0 + */ + /** + * Core class used to access template autosaves via the REST API. + * + * @since 6.4.0 + * + * @see WP_REST_Autosaves_Controller + */ + class WP_REST_Template_Autosaves_Controller extends \WP_REST_Autosaves_Controller + { + /** + * Constructor. + * + * @since 6.4.0 + * + * @param string $parent_post_type Post type of the parent. + */ + public function __construct($parent_post_type) + { + } + /** + * Registers the routes for autosaves. + * + * @since 6.4.0 + * + * @see register_rest_route() + */ + public function register_routes() + { + } + /** + * Prepares the item for the REST response. + * + * @since 6.4.0 + * + * @param WP_Post $item Post revision object. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response Response object. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Gets the autosave, if the ID is valid. + * + * @since 6.4.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_Post|WP_Error Autosave post object if ID is valid, WP_Error otherwise. + */ + public function get_item($request) + { + } + /** + * Get the parent post. + * + * @since 6.4.0 + * + * @param int $parent_id Supplied ID. + * @return WP_Post|WP_Error Post object if ID is valid, WP_Error otherwise. + */ + protected function get_parent($parent_id) + { + } + /** + * Prepares links for the request. + * + * @since 6.4.0 + * + * @param WP_Block_Template $template Template. + * @return array Links for the given post. + */ + protected function prepare_links($template) + { + } + /** + * Retrieves the autosave's schema, conforming to JSON Schema. + * + * @since 6.4.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + } + /** + * REST API: WP_REST_Template_Revisions_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 6.4.0 + */ + /** + * Core class used to access template revisions via the REST API. + * + * @since 6.4.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Template_Revisions_Controller extends \WP_REST_Revisions_Controller + { + /** + * Constructor. + * + * @since 6.4.0 + * + * @param string $parent_post_type Post type of the parent. + */ + public function __construct($parent_post_type) + { + } + /** + * Registers the routes for revisions based on post types supporting revisions. + * + * @since 6.4.0 + * + * @see register_rest_route() + */ + public function register_routes() + { + } + /** + * Gets the parent post, if the template ID is valid. + * + * @since 6.4.0 + * + * @param string $parent_template_id Supplied ID. + * @return WP_Post|WP_Error Post object if ID is valid, WP_Error otherwise. + */ + protected function get_parent($parent_template_id) + { + } + /** + * Prepares the item for the REST response. + * + * @since 6.4.0 + * + * @param WP_Post $item Post revision object. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response Response object. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Checks if a given request has access to delete a revision. + * + * @since 6.4.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to delete the item, WP_Error object otherwise. + */ + public function delete_item_permissions_check($request) + { + } + /** + * Prepares links for the request. + * + * @since 6.4.0 + * + * @param WP_Block_Template $template Template. + * @return array Links for the given post. + */ + protected function prepare_links($template) + { + } + /** + * Retrieves the item's schema, conforming to JSON Schema. + * + * @since 6.4.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + } + /** + * REST API: WP_REST_Templates_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 5.8.0 + */ + /** + * Base Templates REST API Controller. + * + * @since 5.8.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Templates_Controller extends \WP_REST_Controller + { + /** + * Post type. + * + * @since 5.8.0 + * @var string + */ + protected $post_type; + /** + * Constructor. + * + * @since 5.8.0 + * + * @param string $post_type Post type. + */ + public function __construct($post_type) + { + } + /** + * Registers the controllers routes. + * + * @since 5.8.0 + * @since 6.1.0 Endpoint for fallback template content. + */ + public function register_routes() + { + } + /** + * Returns the fallback template for the given slug. + * + * @since 6.1.0 + * @since 6.3.0 Ignore empty templates. + * + * @param WP_REST_Request $request The request instance. + * @return WP_REST_Response|WP_Error + */ + public function get_template_fallback($request) + { + } + /** + * Checks if the user has permissions to make the request. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + protected function permissions_check($request) + { + } + /** + * Requesting this endpoint for a template like 'twentytwentytwo//home' + * requires using a path like /wp/v2/templates/twentytwentytwo//home. There + * are special cases when WordPress routing corrects the name to contain + * only a single slash like 'twentytwentytwo/home'. + * + * This method doubles the last slash if it's not already doubled. It relies + * on the template ID format {theme_name}//{template_slug} and the fact that + * slugs cannot contain slashes. + * + * @since 5.9.0 + * @see https://core.trac.wordpress.org/ticket/54507 + * + * @param string $id Template ID. + * @return string Sanitized template ID. + */ + public function _sanitize_template_id($id) + { + } + /** + * Checks if a given request has access to read templates. + * + * @since 5.8.0 + * @since 6.6.0 Allow users with edit_posts capability to read templates. + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_items_permissions_check($request) + { + } + /** + * Returns a list of templates. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request The request instance. + * @return WP_REST_Response + */ + public function get_items($request) + { + } + /** + * Checks if a given request has access to read a single template. + * + * @since 5.8.0 + * @since 6.6.0 Allow users with edit_posts capability to read individual templates. + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise. + */ + public function get_item_permissions_check($request) + { + } + /** + * Returns the given template + * + * @since 5.8.0 + * + * @param WP_REST_Request $request The request instance. + * @return WP_REST_Response|WP_Error + */ + public function get_item($request) + { + } + /** + * Checks if a given request has access to write a single template. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has write access for the item, WP_Error object otherwise. + */ + public function update_item_permissions_check($request) + { + } + /** + * Updates a single template. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function update_item($request) + { + } + /** + * Checks if a given request has access to create a template. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to create items, WP_Error object otherwise. + */ + public function create_item_permissions_check($request) + { + } + /** + * Creates a single template. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function create_item($request) + { + } + /** + * Checks if a given request has access to delete a single template. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has delete access for the item, WP_Error object otherwise. + */ + public function delete_item_permissions_check($request) + { + } + /** + * Deletes a single template. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function delete_item($request) + { + } + /** + * Prepares a single template for create or update. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Request object. + * @return stdClass|WP_Error Changes to pass to wp_update_post. + */ + protected function prepare_item_for_database($request) + { + } + /** + * Prepare a single template output for response + * + * @since 5.8.0 + * @since 5.9.0 Renamed `$template` to `$item` to match parent class for PHP 8 named parameter support. + * @since 6.3.0 Added `modified` property to the response. + * + * @param WP_Block_Template $item Template instance. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response Response object. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Prepares links for the request. + * + * @since 5.8.0 + * + * @param integer $id ID. + * @return array Links for the given post. + */ + protected function prepare_links($id) + { + } + /** + * Get the link relations available for the post and current user. + * + * @since 5.8.0 + * + * @return string[] List of link relations. + */ + protected function get_available_actions() + { + } + /** + * Retrieves the query params for the posts collection. + * + * @since 5.8.0 + * @since 5.9.0 Added `'area'` and `'post_type'`. + * + * @return array Collection parameters. + */ + public function get_collection_params() + { + } + /** + * Retrieves the block type' schema, conforming to JSON Schema. + * + * @since 5.8.0 + * @since 5.9.0 Added `'area'`. + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + } + /** + * REST API: WP_REST_Themes_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 5.0.0 + */ + /** + * Core class used to manage themes via the REST API. + * + * @since 5.0.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Themes_Controller extends \WP_REST_Controller + { + /** + * Matches theme's directory: `/themes/<subdirectory>/<theme>/` or `/themes/<theme>/`. + * Excludes invalid directory name characters: `/:<>*?"|`. + */ + const PATTERN = '[^\\/:<>\\*\\?"\\|]+(?:\\/[^\\/:<>\\*\\?"\\|]+)?'; + /** + * Constructor. + * + * @since 5.0.0 + */ + public function __construct() + { + } + /** + * Registers the routes for themes. + * + * @since 5.0.0 + * + * @see register_rest_route() + */ + public function register_routes() + { + } + /** + * Sanitize the stylesheet to decode endpoint. + * + * @since 5.9.0 + * + * @param string $stylesheet The stylesheet name. + * @return string Sanitized stylesheet. + */ + public function _sanitize_stylesheet_callback($stylesheet) + { + } + /** + * Checks if a given request has access to read the theme. + * + * @since 5.0.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access for the item, otherwise WP_Error object. + */ + public function get_items_permissions_check($request) + { + } + /** + * Checks if a given request has access to read the theme. + * + * @since 5.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access for the item, otherwise WP_Error object. + */ + public function get_item_permissions_check($request) + { + } + /** + * Checks if a theme can be read. + * + * @since 5.7.0 + * + * @return true|WP_Error True if the theme can be read, WP_Error object otherwise. + */ + protected function check_read_active_theme_permission() + { + } + /** + * Retrieves a single theme. + * + * @since 5.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_item($request) + { + } + /** + * Retrieves a collection of themes. + * + * @since 5.0.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_items($request) + { + } + /** + * Prepares a single theme output for response. + * + * @since 5.0.0 + * @since 5.9.0 Renamed `$theme` to `$item` to match parent class for PHP 8 named parameter support. + * @since 6.6.0 Added `stylesheet_uri` and `template_uri` fields. + * + * @param WP_Theme $item Theme object. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response Response object. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Prepares links for the request. + * + * @since 5.7.0 + * + * @param WP_Theme $theme Theme data. + * @return array Links for the given block type. + */ + protected function prepare_links($theme) + { + } + /** + * Helper function to compare two themes. + * + * @since 5.7.0 + * + * @param WP_Theme $theme_a First theme to compare. + * @param WP_Theme $theme_b Second theme to compare. + * @return bool + */ + protected function is_same_theme($theme_a, $theme_b) + { + } + /** + * Prepares the theme support value for inclusion in the REST API response. + * + * @since 5.5.0 + * + * @param mixed $support The raw value from get_theme_support(). + * @param array $args The feature's registration args. + * @param string $feature The feature name. + * @param WP_REST_Request $request The request object. + * @return mixed The prepared support value. + */ + protected function prepare_theme_support($support, $args, $feature, $request) + { + } + /** + * Retrieves the theme's schema, conforming to JSON Schema. + * + * @since 5.0.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Retrieves the search params for the themes collection. + * + * @since 5.0.0 + * + * @return array Collection parameters. + */ + public function get_collection_params() + { + } + /** + * Sanitizes and validates the list of theme status. + * + * @since 5.0.0 + * @deprecated 5.7.0 + * + * @param string|array $statuses One or more theme statuses. + * @param WP_REST_Request $request Full details about the request. + * @param string $parameter Additional parameter to pass to validation. + * @return array|WP_Error A list of valid statuses, otherwise WP_Error object. + */ + public function sanitize_theme_status($statuses, $request, $parameter) + { + } + } + /** + * REST API: WP_REST_URL_Details_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 5.9.0 + */ + /** + * Controller which provides REST endpoint for retrieving information + * from a remote site's HTML response. + * + * @since 5.9.0 + * + * @see WP_REST_Controller + */ + class WP_REST_URL_Details_Controller extends \WP_REST_Controller + { + /** + * Constructs the controller. + * + * @since 5.9.0 + */ + public function __construct() + { + } + /** + * Registers the necessary REST API routes. + * + * @since 5.9.0 + */ + public function register_routes() + { + } + /** + * Retrieves the item's schema, conforming to JSON Schema. + * + * @since 5.9.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Retrieves the contents of the title tag from the HTML response. + * + * @since 5.9.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error The parsed details as a response object. WP_Error if there are errors. + */ + public function parse_url_details($request) + { + } + /** + * Checks whether a given request has permission to read remote URLs. + * + * @since 5.9.0 + * + * @return WP_Error|bool True if the request has permission, else WP_Error. + */ + public function permissions_check() + { + } + } + /** + * REST API: WP_REST_Users_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 4.7.0 + */ + /** + * Core class used to manage users via the REST API. + * + * @since 4.7.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Users_Controller extends \WP_REST_Controller + { + /** + * Instance of a user meta fields object. + * + * @since 4.7.0 + * @var WP_REST_User_Meta_Fields + */ + protected $meta; + /** + * Whether the controller supports batching. + * + * @since 6.6.0 + * @var array + */ + protected $allow_batch = array('v1' => \true); + /** + * Constructor. + * + * @since 4.7.0 + */ + public function __construct() + { + } + /** + * Registers the routes for users. + * + * @since 4.7.0 + * + * @see register_rest_route() + */ + public function register_routes() + { + } + /** + * Checks for a valid value for the reassign parameter when deleting users. + * + * The value can be an integer, 'false', false, or ''. + * + * @since 4.7.0 + * + * @param int|bool $value The value passed to the reassign parameter. + * @param WP_REST_Request $request Full details about the request. + * @param string $param The parameter that is being sanitized. + * @return int|bool|WP_Error + */ + public function check_reassign($value, $request, $param) + { + } + /** + * Permissions check for getting all users. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, otherwise WP_Error object. + */ + public function get_items_permissions_check($request) + { + } + /** + * Retrieves all users. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_items($request) + { + } + /** + * Get the user, if the ID is valid. + * + * @since 4.7.2 + * + * @param int $id Supplied ID. + * @return WP_User|WP_Error True if ID is valid, WP_Error otherwise. + */ + protected function get_user($id) + { + } + /** + * Checks if a given request has access to read a user. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access for the item, otherwise WP_Error object. + */ + public function get_item_permissions_check($request) + { + } + /** + * Retrieves a single user. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_item($request) + { + } + /** + * Retrieves the current user. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_current_item($request) + { + } + /** + * Checks if a given request has access create users. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to create items, WP_Error object otherwise. + */ + public function create_item_permissions_check($request) + { + } + /** + * Creates a single user. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function create_item($request) + { + } + /** + * Checks if a given request has access to update a user. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to update the item, WP_Error object otherwise. + */ + public function update_item_permissions_check($request) + { + } + /** + * Updates a single user. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function update_item($request) + { + } + /** + * Checks if a given request has access to update the current user. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to update the item, WP_Error object otherwise. + */ + public function update_current_item_permissions_check($request) + { + } + /** + * Updates the current user. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function update_current_item($request) + { + } + /** + * Checks if a given request has access delete a user. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to delete the item, WP_Error object otherwise. + */ + public function delete_item_permissions_check($request) + { + } + /** + * Deletes a single user. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function delete_item($request) + { + } + /** + * Checks if a given request has access to delete the current user. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has access to delete the item, WP_Error object otherwise. + */ + public function delete_current_item_permissions_check($request) + { + } + /** + * Deletes the current user. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function delete_current_item($request) + { + } + /** + * Prepares a single user output for response. + * + * @since 4.7.0 + * @since 5.9.0 Renamed `$user` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param WP_User $item User object. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response Response object. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Prepares links for the user request. + * + * @since 4.7.0 + * + * @param WP_User $user User object. + * @return array Links for the given user. + */ + protected function prepare_links($user) + { + } + /** + * Prepares a single user for creation or update. + * + * @since 4.7.0 + * + * @param WP_REST_Request $request Request object. + * @return object User object. + */ + protected function prepare_item_for_database($request) + { + } + /** + * Determines if the current user is allowed to make the desired roles change. + * + * @since 4.7.0 + * + * @global WP_Roles $wp_roles WordPress role management object. + * + * @param int $user_id User ID. + * @param array $roles New user roles. + * @return true|WP_Error True if the current user is allowed to make the role change, + * otherwise a WP_Error object. + */ + protected function check_role_update($user_id, $roles) + { + } + /** + * Check a username for the REST API. + * + * Performs a couple of checks like edit_user() in wp-admin/includes/user.php. + * + * @since 4.7.0 + * + * @param string $value The username submitted in the request. + * @param WP_REST_Request $request Full details about the request. + * @param string $param The parameter name. + * @return string|WP_Error The sanitized username, if valid, otherwise an error. + */ + public function check_username($value, $request, $param) + { + } + /** + * Check a user password for the REST API. + * + * Performs a couple of checks like edit_user() in wp-admin/includes/user.php. + * + * @since 4.7.0 + * + * @param string $value The password submitted in the request. + * @param WP_REST_Request $request Full details about the request. + * @param string $param The parameter name. + * @return string|WP_Error The sanitized password, if valid, otherwise an error. + */ + public function check_user_password($value, $request, $param) + { + } + /** + * Retrieves the user's schema, conforming to JSON Schema. + * + * @since 4.7.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * Retrieves the query params for collections. + * + * @since 4.7.0 + * + * @return array Collection parameters. + */ + public function get_collection_params() + { + } + } + /** + * REST API: WP_REST_Widget_Types_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 5.8.0 + */ + /** + * Core class to access widget types via the REST API. + * + * @since 5.8.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Widget_Types_Controller extends \WP_REST_Controller + { + /** + * Constructor. + * + * @since 5.8.0 + */ + public function __construct() + { + } + /** + * Registers the widget type routes. + * + * @since 5.8.0 + * + * @see register_rest_route() + */ + public function register_routes() + { + } + /** + * Checks whether a given request has permission to read widget types. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_items_permissions_check($request) + { + } + /** + * Retrieves the list of all widget types. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_items($request) + { + } + /** + * Checks if a given request has access to read a widget type. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise. + */ + public function get_item_permissions_check($request) + { + } + /** + * Checks whether the user can read widget types. + * + * @since 5.8.0 + * + * @return true|WP_Error True if the widget type is visible, WP_Error otherwise. + */ + protected function check_read_permission() + { + } + /** + * Gets the details about the requested widget. + * + * @since 5.8.0 + * + * @param string $id The widget type id. + * @return array|WP_Error The array of widget data if the name is valid, WP_Error otherwise. + */ + public function get_widget($id) + { + } + /** + * Normalize array of widgets. + * + * @since 5.8.0 + * + * @global WP_Widget_Factory $wp_widget_factory + * @global array $wp_registered_widgets The list of registered widgets. + * + * @return array Array of widgets. + */ + protected function get_widgets() + { + } + /** + * Retrieves a single widget type from the collection. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_item($request) + { + } + /** + * Prepares a widget type object for serialization. + * + * @since 5.8.0 + * @since 5.9.0 Renamed `$widget_type` to `$item` to match parent class for PHP 8 named parameter support. + * + * @param array $item Widget type data. + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response Widget type data. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Prepares links for the widget type. + * + * @since 5.8.0 + * + * @param array $widget_type Widget type data. + * @return array Links for the given widget type. + */ + protected function prepare_links($widget_type) + { + } + /** + * Retrieves the widget type's schema, conforming to JSON Schema. + * + * @since 5.8.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + /** + * An RPC-style endpoint which can be used by clients to turn user input in + * a widget admin form into an encoded instance object. + * + * Accepts: + * + * - id: A widget type ID. + * - instance: A widget's encoded instance object. Optional. + * - form_data: Form data from submitting a widget's admin form. Optional. + * + * Returns: + * - instance: The encoded instance object after updating the widget with + * the given form data. + * - form: The widget's admin form after updating the widget with the + * given form data. + * + * @since 5.8.0 + * + * @global WP_Widget_Factory $wp_widget_factory + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function encode_form_data($request) + { + } + /** + * Renders a single Legacy Widget and wraps it in a JSON-encodable array. + * + * @since 5.9.0 + * + * @param WP_REST_Request $request Full details about the request. + * + * @return array An array with rendered Legacy Widget HTML. + */ + public function render($request) + { + } + /** + * Retrieves the query params for collections. + * + * @since 5.8.0 + * + * @return array Collection parameters. + */ + public function get_collection_params() + { + } + } + /** + * REST API: WP_REST_Widgets_Controller class + * + * @package WordPress + * @subpackage REST_API + * @since 5.8.0 + */ + /** + * Core class to access widgets via the REST API. + * + * @since 5.8.0 + * + * @see WP_REST_Controller + */ + class WP_REST_Widgets_Controller extends \WP_REST_Controller + { + /** + * Tracks whether {@see retrieve_widgets()} has been called in the current request. + * + * @since 5.9.0 + * @var bool + */ + protected $widgets_retrieved = \false; + /** + * Whether the controller supports batching. + * + * @since 5.9.0 + * @var array + */ + protected $allow_batch = array('v1' => \true); + /** + * Widgets controller constructor. + * + * @since 5.8.0 + */ + public function __construct() + { + } + /** + * Registers the widget routes for the controller. + * + * @since 5.8.0 + */ + public function register_routes() + { + } + /** + * Checks if a given request has access to get widgets. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_items_permissions_check($request) + { + } + /** + * Retrieves a collection of widgets. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_items($request) + { + } + /** + * Checks if a given request has access to get a widget. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function get_item_permissions_check($request) + { + } + /** + * Checks if a sidebar can be read publicly. + * + * @since 5.9.0 + * + * @param string $sidebar_id The sidebar ID. + * @return bool Whether the sidebar can be read. + */ + protected function check_read_sidebar_permission($sidebar_id) + { + } + /** + * Gets an individual widget. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function get_item($request) + { + } + /** + * Checks if a given request has access to create widgets. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function create_item_permissions_check($request) + { + } + /** + * Creates a widget. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function create_item($request) + { + } + /** + * Checks if a given request has access to update widgets. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function update_item_permissions_check($request) + { + } + /** + * Updates an existing widget. + * + * @since 5.8.0 + * + * @global WP_Widget_Factory $wp_widget_factory + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function update_item($request) + { + } + /** + * Checks if a given request has access to delete widgets. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error True if the request has read access, WP_Error object otherwise. + */ + public function delete_item_permissions_check($request) + { + } + /** + * Deletes a widget. + * + * @since 5.8.0 + * + * @global WP_Widget_Factory $wp_widget_factory + * @global array $wp_registered_widget_updates The registered widget update functions. + * + * @param WP_REST_Request $request Full details about the request. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function delete_item($request) + { + } + /** + * Performs a permissions check for managing widgets. + * + * @since 5.8.0 + * + * @param WP_REST_Request $request Full details about the request. + * @return true|WP_Error + */ + protected function permissions_check($request) + { + } + /** + * Looks for "lost" widgets once per request. + * + * @since 5.9.0 + * + * @see retrieve_widgets() + */ + protected function retrieve_widgets() + { + } + /** + * Saves the widget in the request object. + * + * @since 5.8.0 + * + * @global WP_Widget_Factory $wp_widget_factory + * @global array $wp_registered_widget_updates The registered widget update functions. + * + * @param WP_REST_Request $request Full details about the request. + * @param string $sidebar_id ID of the sidebar the widget belongs to. + * @return string|WP_Error The saved widget ID. + */ + protected function save_widget($request, $sidebar_id) + { + } + /** + * Prepares the widget for the REST response. + * + * @since 5.8.0 + * + * @global WP_Widget_Factory $wp_widget_factory + * @global array $wp_registered_widgets The registered widgets. + * + * @param array $item An array containing a widget_id and sidebar_id. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. + */ + public function prepare_item_for_response($item, $request) + { + } + /** + * Prepares links for the widget. + * + * @since 5.8.0 + * + * @param array $prepared Widget. + * @return array Links for the given widget. + */ + protected function prepare_links($prepared) + { + } + /** + * Gets the list of collection params. + * + * @since 5.8.0 + * + * @return array[] + */ + public function get_collection_params() + { + } + /** + * Retrieves the widget's schema, conforming to JSON Schema. + * + * @since 5.8.0 + * + * @return array Item schema data. + */ + public function get_item_schema() + { + } + } + /** + * REST API: WP_REST_Meta_Fields class + * + * @package WordPress + * @subpackage REST_API + * @since 4.7.0 + */ + /** + * Core class to manage meta values for an object via the REST API. + * + * @since 4.7.0 + */ + #[\AllowDynamicProperties] + abstract class WP_REST_Meta_Fields + { + /** + * Retrieves the object meta type. + * + * @since 4.7.0 + * + * @return string One of 'post', 'comment', 'term', 'user', or anything + * else supported by `_get_meta_table()`. + */ + protected abstract function get_meta_type(); + /** + * Retrieves the object meta subtype. + * + * @since 4.9.8 + * + * @return string Subtype for the meta type, or empty string if no specific subtype. + */ + protected function get_meta_subtype() + { + } + /** + * Retrieves the object type for register_rest_field(). + * + * @since 4.7.0 + * + * @return string The REST field type, such as post type name, taxonomy name, 'comment', or `user`. + */ + protected abstract function get_rest_field_type(); + /** + * Registers the meta field. + * + * @since 4.7.0 + * @deprecated 5.6.0 + * + * @see register_rest_field() + */ + public function register_field() + { + } + /** + * Retrieves the meta field value. + * + * @since 4.7.0 + * + * @param int $object_id Object ID to fetch meta for. + * @param WP_REST_Request $request Full details about the request. + * @return array Array containing the meta values keyed by name. + */ + public function get_value($object_id, $request) + { + } + /** + * Prepares a meta value for a response. + * + * This is required because some native types cannot be stored correctly + * in the database, such as booleans. We need to cast back to the relevant + * type before passing back to JSON. + * + * @since 4.7.0 + * + * @param mixed $value Meta value to prepare. + * @param WP_REST_Request $request Current request object. + * @param array $args Options for the field. + * @return mixed Prepared value. + */ + protected function prepare_value_for_response($value, $request, $args) + { + } + /** + * Updates meta values. + * + * @since 4.7.0 + * + * @param array $meta Array of meta parsed from the request. + * @param int $object_id Object ID to fetch meta for. + * @return null|WP_Error Null on success, WP_Error object on failure. + */ + public function update_value($meta, $object_id) + { + } + /** + * Deletes a meta value for an object. + * + * @since 4.7.0 + * + * @param int $object_id Object ID the field belongs to. + * @param string $meta_key Key for the field. + * @param string $name Name for the field that is exposed in the REST API. + * @return true|WP_Error True if meta field is deleted, WP_Error otherwise. + */ + protected function delete_meta_value($object_id, $meta_key, $name) + { + } + /** + * Updates multiple meta values for an object. + * + * Alters the list of values in the database to match the list of provided values. + * + * @since 4.7.0 + * + * @param int $object_id Object ID to update. + * @param string $meta_key Key for the custom field. + * @param string $name Name for the field that is exposed in the REST API. + * @param array $values List of values to update to. + * @return true|WP_Error True if meta fields are updated, WP_Error otherwise. + */ + protected function update_multi_meta_value($object_id, $meta_key, $name, $values) + { + } + /** + * Updates a meta value for an object. + * + * @since 4.7.0 + * + * @param int $object_id Object ID to update. + * @param string $meta_key Key for the custom field. + * @param string $name Name for the field that is exposed in the REST API. + * @param mixed $value Updated value. + * @return true|WP_Error True if the meta field was updated, WP_Error otherwise. + */ + protected function update_meta_value($object_id, $meta_key, $name, $value) + { + } + /** + * Checks if the user provided value is equivalent to a stored value for the given meta key. + * + * @since 5.5.0 + * + * @param string $meta_key The meta key being checked. + * @param string $subtype The object subtype. + * @param mixed $stored_value The currently stored value retrieved from get_metadata(). + * @param mixed $user_value The value provided by the user. + * @return bool + */ + protected function is_meta_value_same_as_stored_value($meta_key, $subtype, $stored_value, $user_value) + { + } + /** + * Retrieves all the registered meta fields. + * + * @since 4.7.0 + * + * @return array Registered fields. + */ + protected function get_registered_fields() + { + } + /** + * Retrieves the object's meta schema, conforming to JSON Schema. + * + * @since 4.7.0 + * + * @return array Field schema data. + */ + public function get_field_schema() + { + } + /** + * Prepares a meta value for output. + * + * Default preparation for meta fields. Override by passing the + * `prepare_callback` in your `show_in_rest` options. + * + * @since 4.7.0 + * + * @param mixed $value Meta value from the database. + * @param WP_REST_Request $request Request object. + * @param array $args REST-specific options for the meta key. + * @return mixed Value prepared for output. If a non-JsonSerializable object, null. + */ + public static function prepare_value($value, $request, $args) + { + } + /** + * Check the 'meta' value of a request is an associative array. + * + * @since 4.7.0 + * + * @param mixed $value The meta value submitted in the request. + * @param WP_REST_Request $request Full details about the request. + * @param string $param The parameter name. + * @return array|false The meta array, if valid, false otherwise. + */ + public function check_meta_is_array($value, $request, $param) + { + } + /** + * Recursively add additionalProperties = false to all objects in a schema if no additionalProperties setting + * is specified. + * + * This is needed to restrict properties of objects in meta values to only + * registered items, as the REST API will allow additional properties by + * default. + * + * @since 5.3.0 + * @deprecated 5.6.0 Use rest_default_additional_properties_to_false() instead. + * + * @param array $schema The schema array. + * @return array + */ + protected function default_additional_properties_to_false($schema) + { + } + /** + * Gets the empty value for a schema type. + * + * @since 5.3.0 + * + * @param string $type The schema type. + * @return mixed + */ + protected static function get_empty_value_for_type($type) + { + } + } + /** + * REST API: WP_REST_Comment_Meta_Fields class + * + * @package WordPress + * @subpackage REST_API + * @since 4.7.0 + */ + /** + * Core class to manage comment meta via the REST API. + * + * @since 4.7.0 + * + * @see WP_REST_Meta_Fields + */ + class WP_REST_Comment_Meta_Fields extends \WP_REST_Meta_Fields + { + /** + * Retrieves the comment type for comment meta. + * + * @since 4.7.0 + * + * @return string The meta type. + */ + protected function get_meta_type() + { + } + /** + * Retrieves the comment meta subtype. + * + * @since 4.9.8 + * + * @return string 'comment' There are no subtypes. + */ + protected function get_meta_subtype() + { + } + /** + * Retrieves the type for register_rest_field() in the context of comments. + * + * @since 4.7.0 + * + * @return string The REST field type. + */ + public function get_rest_field_type() + { + } + } + /** + * REST API: WP_REST_Post_Meta_Fields class + * + * @package WordPress + * @subpackage REST_API + * @since 4.7.0 + */ + /** + * Core class used to manage meta values for posts via the REST API. + * + * @since 4.7.0 + * + * @see WP_REST_Meta_Fields + */ + class WP_REST_Post_Meta_Fields extends \WP_REST_Meta_Fields + { + /** + * Post type to register fields for. + * + * @since 4.7.0 + * @var string + */ + protected $post_type; + /** + * Constructor. + * + * @since 4.7.0 + * + * @param string $post_type Post type to register fields for. + */ + public function __construct($post_type) + { + } + /** + * Retrieves the post meta type. + * + * @since 4.7.0 + * + * @return string The meta type. + */ + protected function get_meta_type() + { + } + /** + * Retrieves the post meta subtype. + * + * @since 4.9.8 + * + * @return string Subtype for the meta type, or empty string if no specific subtype. + */ + protected function get_meta_subtype() + { + } + /** + * Retrieves the type for register_rest_field(). + * + * @since 4.7.0 + * + * @see register_rest_field() + * + * @return string The REST field type. + */ + public function get_rest_field_type() + { + } + } + /** + * REST API: WP_REST_Term_Meta_Fields class + * + * @package WordPress + * @subpackage REST_API + * @since 4.7.0 + */ + /** + * Core class used to manage meta values for terms via the REST API. + * + * @since 4.7.0 + * + * @see WP_REST_Meta_Fields + */ + class WP_REST_Term_Meta_Fields extends \WP_REST_Meta_Fields + { + /** + * Taxonomy to register fields for. + * + * @since 4.7.0 + * @var string + */ + protected $taxonomy; + /** + * Constructor. + * + * @since 4.7.0 + * + * @param string $taxonomy Taxonomy to register fields for. + */ + public function __construct($taxonomy) + { + } + /** + * Retrieves the term meta type. + * + * @since 4.7.0 + * + * @return string The meta type. + */ + protected function get_meta_type() + { + } + /** + * Retrieves the term meta subtype. + * + * @since 4.9.8 + * + * @return string Subtype for the meta type, or empty string if no specific subtype. + */ + protected function get_meta_subtype() + { + } + /** + * Retrieves the type for register_rest_field(). + * + * @since 4.7.0 + * + * @return string The REST field type. + */ + public function get_rest_field_type() + { + } + } + /** + * REST API: WP_REST_User_Meta_Fields class + * + * @package WordPress + * @subpackage REST_API + * @since 4.7.0 + */ + /** + * Core class used to manage meta values for users via the REST API. + * + * @since 4.7.0 + * + * @see WP_REST_Meta_Fields + */ + class WP_REST_User_Meta_Fields extends \WP_REST_Meta_Fields + { + /** + * Retrieves the user meta type. + * + * @since 4.7.0 + * + * @return string The user meta type. + */ + protected function get_meta_type() + { + } + /** + * Retrieves the user meta subtype. + * + * @since 4.9.8 + * + * @return string 'user' There are no subtypes. + */ + protected function get_meta_subtype() + { + } + /** + * Retrieves the type for register_rest_field(). + * + * @since 4.7.0 + * + * @return string The user REST field type. + */ + public function get_rest_field_type() + { + } + } + /** + * REST API: WP_REST_Search_Handler class + * + * @package WordPress + * @subpackage REST_API + * @since 5.0.0 + */ + /** + * Core base class representing a search handler for an object type in the REST API. + * + * @since 5.0.0 + */ + #[\AllowDynamicProperties] + abstract class WP_REST_Search_Handler + { + /** + * Field containing the IDs in the search result. + */ + const RESULT_IDS = 'ids'; + /** + * Field containing the total count in the search result. + */ + const RESULT_TOTAL = 'total'; + /** + * Object type managed by this search handler. + * + * @since 5.0.0 + * @var string + */ + protected $type = ''; + /** + * Object subtypes managed by this search handler. + * + * @since 5.0.0 + * @var string[] + */ + protected $subtypes = array(); + /** + * Gets the object type managed by this search handler. + * + * @since 5.0.0 + * + * @return string Object type identifier. + */ + public function get_type() + { + } + /** + * Gets the object subtypes managed by this search handler. + * + * @since 5.0.0 + * + * @return string[] Array of object subtype identifiers. + */ + public function get_subtypes() + { + } + /** + * Searches the object type content for a given search request. + * + * @since 5.0.0 + * + * @param WP_REST_Request $request Full REST request. + * @return array Associative array containing an `WP_REST_Search_Handler::RESULT_IDS` containing + * an array of found IDs and `WP_REST_Search_Handler::RESULT_TOTAL` containing the + * total count for the matching search results. + */ + public abstract function search_items(\WP_REST_Request $request); + /** + * Prepares the search result for a given ID. + * + * @since 5.0.0 + * @since 5.6.0 The `$id` parameter can accept a string. + * + * @param int|string $id Item ID. + * @param array $fields Fields to include for the item. + * @return array Associative array containing all fields for the item. + */ + public abstract function prepare_item($id, array $fields); + /** + * Prepares links for the search result of a given ID. + * + * @since 5.0.0 + * @since 5.6.0 The `$id` parameter can accept a string. + * + * @param int|string $id Item ID. + * @return array Links for the given item. + */ + public abstract function prepare_item_links($id); + } + /** + * REST API: WP_REST_Post_Format_Search_Handler class + * + * @package WordPress + * @subpackage REST_API + * @since 5.6.0 + */ + /** + * Core class representing a search handler for post formats in the REST API. + * + * @since 5.6.0 + * + * @see WP_REST_Search_Handler + */ + class WP_REST_Post_Format_Search_Handler extends \WP_REST_Search_Handler + { + /** + * Constructor. + * + * @since 5.6.0 + */ + public function __construct() + { + } + /** + * Searches the post formats for a given search request. + * + * @since 5.6.0 + * + * @param WP_REST_Request $request Full REST request. + * @return array { + * Associative array containing found IDs and total count for the matching search results. + * + * @type string[] $ids Array containing slugs for the matching post formats. + * @type int $total Total count for the matching search results. + * } + * @phpstan-return array{ + * ids: string[], + * total: int, + * } + */ + public function search_items(\WP_REST_Request $request) + { + } + /** + * Prepares the search result for a given post format. + * + * @since 5.6.0 + * + * @param string $id Item ID, the post format slug. + * @param array $fields Fields to include for the item. + * @return array { + * Associative array containing fields for the post format based on the `$fields` parameter. + * + * @type string $id Optional. Post format slug. + * @type string $title Optional. Post format name. + * @type string $url Optional. Post format permalink URL. + * @type string $type Optional. String 'post-format'. + *} + * @phpstan-return array{ + * id: string, + * title: string, + * url: string, + * type: string, + * } + */ + public function prepare_item($id, array $fields) + { + } + /** + * Prepares links for the search result. + * + * @since 5.6.0 + * + * @param string $id Item ID, the post format slug. + * @return array Links for the given item. + */ + public function prepare_item_links($id) + { + } + } + /** + * REST API: WP_REST_Post_Search_Handler class + * + * @package WordPress + * @subpackage REST_API + * @since 5.0.0 + */ + /** + * Core class representing a search handler for posts in the REST API. + * + * @since 5.0.0 + * + * @see WP_REST_Search_Handler + */ + class WP_REST_Post_Search_Handler extends \WP_REST_Search_Handler + { + /** + * Constructor. + * + * @since 5.0.0 + */ + public function __construct() + { + } + /** + * Searches posts for a given search request. + * + * @since 5.0.0 + * + * @param WP_REST_Request $request Full REST request. + * @return array { + * Associative array containing found IDs and total count for the matching search results. + * + * @type int[] $ids Array containing the matching post IDs. + * @type int $total Total count for the matching search results. + * } + * @phpstan-return array{ + * ids: int[], + * total: int, + * } + */ + public function search_items(\WP_REST_Request $request) + { + } + /** + * Prepares the search result for a given post ID. + * + * @since 5.0.0 + * + * @param int $id Post ID. + * @param array $fields Fields to include for the post. + * @return array { + * Associative array containing fields for the post based on the `$fields` parameter. + * + * @type int $id Optional. Post ID. + * @type string $title Optional. Post title. + * @type string $url Optional. Post permalink URL. + * @type string $type Optional. Post type. + * } + * @phpstan-return array{ + * id: int, + * title: string, + * url: string, + * type: string, + * } + */ + public function prepare_item($id, array $fields) + { + } + /** + * Prepares links for the search result of a given ID. + * + * @since 5.0.0 + * + * @param int $id Item ID. + * @return array Links for the given item. + */ + public function prepare_item_links($id) + { + } + /** + * Overwrites the default protected title format. + * + * By default, WordPress will show password protected posts with a title of + * "Protected: %s". As the REST API communicates the protected status of a post + * in a machine readable format, we remove the "Protected: " prefix. + * + * @since 5.0.0 + * + * @return string Protected title format. + */ + public function protected_title_format() + { + } + /** + * Attempts to detect the route to access a single item. + * + * @since 5.0.0 + * @deprecated 5.5.0 Use rest_get_route_for_post() + * @see rest_get_route_for_post() + * + * @param WP_Post $post Post object. + * @return string REST route relative to the REST base URI, or empty string if unknown. + */ + protected function detect_rest_item_route($post) + { + } + } + /** + * REST API: WP_REST_Term_Search_Handler class + * + * @package WordPress + * @subpackage REST_API + * @since 5.6.0 + */ + /** + * Core class representing a search handler for terms in the REST API. + * + * @since 5.6.0 + * + * @see WP_REST_Search_Handler + */ + class WP_REST_Term_Search_Handler extends \WP_REST_Search_Handler + { + /** + * Constructor. + * + * @since 5.6.0 + */ + public function __construct() + { + } + /** + * Searches terms for a given search request. + * + * @since 5.6.0 + * + * @param WP_REST_Request $request Full REST request. + * @return array { + * Associative array containing found IDs and total count for the matching search results. + * + * @type int[] $ids Found term IDs. + * @type string|int|WP_Error $total Numeric string containing the number of terms in that + * taxonomy, 0 if there are no results, or WP_Error if + * the requested taxonomy does not exist. + * } + * @phpstan-return array{ + * ids: int[], + * total: string|int|WP_Error, + * } + */ + public function search_items(\WP_REST_Request $request) + { + } + /** + * Prepares the search result for a given term ID. + * + * @since 5.6.0 + * + * @param int $id Term ID. + * @param array $fields Fields to include for the term. + * @return array { + * Associative array containing fields for the term based on the `$fields` parameter. + * + * @type int $id Optional. Term ID. + * @type string $title Optional. Term name. + * @type string $url Optional. Term permalink URL. + * @type string $type Optional. Term taxonomy name. + * } + * @phpstan-return array{ + * id: int, + * title: string, + * url: string, + * type: string, + * } + */ + public function prepare_item($id, array $fields) + { + } + /** + * Prepares links for the search result of a given ID. + * + * @since 5.6.0 + * + * @param int $id Item ID. + * @return array[] Array of link arrays for the given item. + */ + public function prepare_item_links($id) + { + } + } + /** + * Sitemaps: WP_Sitemaps_Index class. + * + * Generates the sitemap index. + * + * @package WordPress + * @subpackage Sitemaps + * @since 5.5.0 + */ + /** + * Class WP_Sitemaps_Index. + * Builds the sitemap index page that lists the links to all of the sitemaps. + * + * @since 5.5.0 + */ + #[\AllowDynamicProperties] + class WP_Sitemaps_Index + { + /** + * The main registry of supported sitemaps. + * + * @since 5.5.0 + * @var WP_Sitemaps_Registry + */ + protected $registry; + /** + * WP_Sitemaps_Index constructor. + * + * @since 5.5.0 + * + * @param WP_Sitemaps_Registry $registry Sitemap provider registry. + */ + public function __construct(\WP_Sitemaps_Registry $registry) + { + } + /** + * Gets a sitemap list for the index. + * + * @since 5.5.0 + * + * @return array[] Array of all sitemaps. + */ + public function get_sitemap_list() + { + } + /** + * Builds the URL for the sitemap index. + * + * @since 5.5.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @return string The sitemap index URL. + */ + public function get_index_url() + { + } + } + /** + * Sitemaps: WP_Sitemaps_Provider class + * + * This class is a base class for other sitemap providers to extend and contains shared functionality. + * + * @package WordPress + * @subpackage Sitemaps + * @since 5.5.0 + */ + /** + * Class WP_Sitemaps_Provider. + * + * @since 5.5.0 + */ + #[\AllowDynamicProperties] + abstract class WP_Sitemaps_Provider + { + /** + * Provider name. + * + * This will also be used as the public-facing name in URLs. + * + * @since 5.5.0 + * + * @var string + */ + protected $name = ''; + /** + * Object type name (e.g. 'post', 'term', 'user'). + * + * @since 5.5.0 + * + * @var string + */ + protected $object_type = ''; + /** + * Gets a URL list for a sitemap. + * + * @since 5.5.0 + * + * @param int $page_num Page of results. + * @param string $object_subtype Optional. Object subtype name. Default empty. + * @return array[] Array of URL information for a sitemap. + */ + public abstract function get_url_list($page_num, $object_subtype = ''); + /** + * Gets the max number of pages available for the object type. + * + * @since 5.5.0 + * + * @param string $object_subtype Optional. Object subtype. Default empty. + * @return int Total number of pages. + */ + public abstract function get_max_num_pages($object_subtype = ''); + /** + * Gets data about each sitemap type. + * + * @since 5.5.0 + * + * @return array[] Array of sitemap types including object subtype name and number of pages. + */ + public function get_sitemap_type_data() + { + } + /** + * Lists sitemap pages exposed by this provider. + * + * The returned data is used to populate the sitemap entries of the index. + * + * @since 5.5.0 + * + * @return array[] Array of sitemap entries. + */ + public function get_sitemap_entries() + { + } + /** + * Gets the URL of a sitemap entry. + * + * @since 5.5.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param string $name The name of the sitemap. + * @param int $page The page of the sitemap. + * @return string The composed URL for a sitemap entry. + */ + public function get_sitemap_url($name, $page) + { + } + /** + * Returns the list of supported object subtypes exposed by the provider. + * + * @since 5.5.0 + * + * @return array List of object subtypes objects keyed by their name. + */ + public function get_object_subtypes() + { + } + } + /** + * Sitemaps: WP_Sitemaps_Registry class + * + * Handles registering sitemap providers. + * + * @package WordPress + * @subpackage Sitemaps + * @since 5.5.0 + */ + /** + * Class WP_Sitemaps_Registry. + * + * @since 5.5.0 + */ + #[\AllowDynamicProperties] + class WP_Sitemaps_Registry + { + /** + * Adds a new sitemap provider. + * + * @since 5.5.0 + * + * @param string $name Name of the sitemap provider. + * @param WP_Sitemaps_Provider $provider Instance of a WP_Sitemaps_Provider. + * @return bool Whether the provider was added successfully. + */ + public function add_provider($name, \WP_Sitemaps_Provider $provider) + { + } + /** + * Returns a single registered sitemap provider. + * + * @since 5.5.0 + * + * @param string $name Sitemap provider name. + * @return WP_Sitemaps_Provider|null Sitemap provider if it exists, null otherwise. + */ + public function get_provider($name) + { + } + /** + * Returns all registered sitemap providers. + * + * @since 5.5.0 + * + * @return WP_Sitemaps_Provider[] Array of sitemap providers. + */ + public function get_providers() + { + } + } + /** + * Sitemaps: WP_Sitemaps_Renderer class + * + * Responsible for rendering Sitemaps data to XML in accordance with sitemap protocol. + * + * @package WordPress + * @subpackage Sitemaps + * @since 5.5.0 + */ + /** + * Class WP_Sitemaps_Renderer + * + * @since 5.5.0 + */ + #[\AllowDynamicProperties] + class WP_Sitemaps_Renderer + { + /** + * XSL stylesheet for styling a sitemap for web browsers. + * + * @since 5.5.0 + * + * @var string + */ + protected $stylesheet = ''; + /** + * XSL stylesheet for styling a sitemap for web browsers. + * + * @since 5.5.0 + * + * @var string + */ + protected $stylesheet_index = ''; + /** + * WP_Sitemaps_Renderer constructor. + * + * @since 5.5.0 + */ + public function __construct() + { + } + /** + * Gets the URL for the sitemap stylesheet. + * + * @since 5.5.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @return string The sitemap stylesheet URL. + */ + public function get_sitemap_stylesheet_url() + { + } + /** + * Gets the URL for the sitemap index stylesheet. + * + * @since 5.5.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @return string The sitemap index stylesheet URL. + */ + public function get_sitemap_index_stylesheet_url() + { + } + /** + * Renders a sitemap index. + * + * @since 5.5.0 + * + * @param array $sitemaps Array of sitemap URLs. + */ + public function render_index($sitemaps) + { + } + /** + * Gets XML for a sitemap index. + * + * @since 5.5.0 + * + * @param array $sitemaps Array of sitemap URLs. + * @return string|false A well-formed XML string for a sitemap index. False on error. + */ + public function get_sitemap_index_xml($sitemaps) + { + } + /** + * Renders a sitemap. + * + * @since 5.5.0 + * + * @param array $url_list Array of URLs for a sitemap. + */ + public function render_sitemap($url_list) + { + } + /** + * Gets XML for a sitemap. + * + * @since 5.5.0 + * + * @param array $url_list Array of URLs for a sitemap. + * @return string|false A well-formed XML string for a sitemap index. False on error. + */ + public function get_sitemap_xml($url_list) + { + } + } + /** + * Sitemaps: WP_Sitemaps_Stylesheet class + * + * This class provides the XSL stylesheets to style all sitemaps. + * + * @package WordPress + * @subpackage Sitemaps + * @since 5.5.0 + */ + /** + * Stylesheet provider class. + * + * @since 5.5.0 + */ + #[\AllowDynamicProperties] + class WP_Sitemaps_Stylesheet + { + /** + * Renders the XSL stylesheet depending on whether it's the sitemap index or not. + * + * @param string $type Stylesheet type. Either 'sitemap' or 'index'. + * @phpstan-param 'sitemap'|'index' $type + * @phpstan-return never + */ + public function render_stylesheet($type) + { + } + /** + * Returns the escaped XSL for all sitemaps, except index. + * + * @since 5.5.0 + */ + public function get_sitemap_stylesheet() + { + } + /** + * Returns the escaped XSL for the index sitemaps. + * + * @since 5.5.0 + */ + public function get_sitemap_index_stylesheet() + { + } + /** + * Gets the CSS to be included in sitemap XSL stylesheets. + * + * @since 5.5.0 + * + * @return string The CSS. + */ + public function get_stylesheet_css() + { + } + } + /** + * Sitemaps: WP_Sitemaps class + * + * This is the main class integrating all other classes. + * + * @package WordPress + * @subpackage Sitemaps + * @since 5.5.0 + */ + /** + * Class WP_Sitemaps. + * + * @since 5.5.0 + */ + #[\AllowDynamicProperties] + class WP_Sitemaps + { + /** + * The main index of supported sitemaps. + * + * @since 5.5.0 + * + * @var WP_Sitemaps_Index + */ + public $index; + /** + * The main registry of supported sitemaps. + * + * @since 5.5.0 + * + * @var WP_Sitemaps_Registry + */ + public $registry; + /** + * An instance of the renderer class. + * + * @since 5.5.0 + * + * @var WP_Sitemaps_Renderer + */ + public $renderer; + /** + * WP_Sitemaps constructor. + * + * @since 5.5.0 + */ + public function __construct() + { + } + /** + * Initiates all sitemap functionality. + * + * If sitemaps are disabled, only the rewrite rules will be registered + * by this method, in order to properly send 404s. + * + * @since 5.5.0 + * @phpstan-return void + */ + public function init() + { + } + /** + * Determines whether sitemaps are enabled or not. + * + * @since 5.5.0 + * + * @return bool Whether sitemaps are enabled. + */ + public function sitemaps_enabled() + { + } + /** + * Registers and sets up the functionality for all supported sitemaps. + * + * @since 5.5.0 + */ + public function register_sitemaps() + { + } + /** + * Registers sitemap rewrite tags and routing rules. + * + * @since 5.5.0 + */ + public function register_rewrites() + { + } + /** + * Renders sitemap templates based on rewrite rules. + * + * @since 5.5.0 + * + * @global WP_Query $wp_query WordPress Query object. + * @phpstan-return void + */ + public function render_sitemaps() + { + } + /** + * Redirects a URL to the wp-sitemap.xml + * + * @since 5.5.0 + * + * @param bool $bypass Pass-through of the pre_handle_404 filter value. + * @param WP_Query $query The WP_Query object. + * @return bool Bypass value. + */ + public function redirect_sitemapxml($bypass, $query) + { + } + /** + * Adds the sitemap index to robots.txt. + * + * @since 5.5.0 + * + * @param string $output robots.txt output. + * @param bool $is_public Whether the site is public. + * @return string The robots.txt output. + */ + public function add_robots($output, $is_public) + { + } + } + /** + * Sitemaps: WP_Sitemaps_Posts class + * + * Builds the sitemaps for the 'post' object type. + * + * @package WordPress + * @subpackage Sitemaps + * @since 5.5.0 + */ + /** + * Posts XML sitemap provider. + * + * @since 5.5.0 + */ + class WP_Sitemaps_Posts extends \WP_Sitemaps_Provider + { + /** + * WP_Sitemaps_Posts constructor. + * + * @since 5.5.0 + */ + public function __construct() + { + } + /** + * Returns the public post types, which excludes nav_items and similar types. + * Attachments are also excluded. This includes custom post types with public = true. + * + * @since 5.5.0 + * + * @return WP_Post_Type[] Array of registered post type objects keyed by their name. + */ + public function get_object_subtypes() + { + } + /** + * Gets a URL list for a post type sitemap. + * + * @since 5.5.0 + * @since 5.9.0 Renamed `$post_type` to `$object_subtype` to match parent class + * for PHP 8 named parameter support. + * + * @param int $page_num Page of results. + * @param string $object_subtype Optional. Post type name. Default empty. + * + * @return array[] Array of URL information for a sitemap. + */ + public function get_url_list($page_num, $object_subtype = '') + { + } + /** + * Gets the max number of pages available for the object type. + * + * @since 5.5.0 + * @since 5.9.0 Renamed `$post_type` to `$object_subtype` to match parent class + * for PHP 8 named parameter support. + * + * @param string $object_subtype Optional. Post type name. Default empty. + * @return int Total number of pages. + */ + public function get_max_num_pages($object_subtype = '') + { + } + /** + * Returns the query args for retrieving posts to list in the sitemap. + * + * @since 5.5.0 + * @since 6.1.0 Added `ignore_sticky_posts` default parameter. + * + * @param string $post_type Post type name. + * @return array Array of WP_Query arguments. + */ + protected function get_posts_query_args($post_type) + { + } + } + /** + * Sitemaps: WP_Sitemaps_Taxonomies class + * + * Builds the sitemaps for the 'taxonomy' object type. + * + * @package WordPress + * @subpackage Sitemaps + * @since 5.5.0 + */ + /** + * Taxonomies XML sitemap provider. + * + * @since 5.5.0 + */ + class WP_Sitemaps_Taxonomies extends \WP_Sitemaps_Provider + { + /** + * WP_Sitemaps_Taxonomies constructor. + * + * @since 5.5.0 + */ + public function __construct() + { + } + /** + * Returns all public, registered taxonomies. + * + * @since 5.5.0 + * + * @return WP_Taxonomy[] Array of registered taxonomy objects keyed by their name. + */ + public function get_object_subtypes() + { + } + /** + * Gets a URL list for a taxonomy sitemap. + * + * @since 5.5.0 + * @since 5.9.0 Renamed `$taxonomy` to `$object_subtype` to match parent class + * for PHP 8 named parameter support. + * + * @param int $page_num Page of results. + * @param string $object_subtype Optional. Taxonomy name. Default empty. + * @return array[] Array of URL information for a sitemap. + */ + public function get_url_list($page_num, $object_subtype = '') + { + } + /** + * Gets the max number of pages available for the object type. + * + * @since 5.5.0 + * @since 5.9.0 Renamed `$taxonomy` to `$object_subtype` to match parent class + * for PHP 8 named parameter support. + * + * @param string $object_subtype Optional. Taxonomy name. Default empty. + * @return int Total number of pages. + */ + public function get_max_num_pages($object_subtype = '') + { + } + /** + * Returns the query args for retrieving taxonomy terms to list in the sitemap. + * + * @since 5.5.0 + * + * @param string $taxonomy Taxonomy name. + * @return array Array of WP_Term_Query arguments. + */ + protected function get_taxonomies_query_args($taxonomy) + { + } + } + /** + * Sitemaps: WP_Sitemaps_Users class + * + * Builds the sitemaps for the 'user' object type. + * + * @package WordPress + * @subpackage Sitemaps + * @since 5.5.0 + */ + /** + * Users XML sitemap provider. + * + * @since 5.5.0 + */ + class WP_Sitemaps_Users extends \WP_Sitemaps_Provider + { + /** + * WP_Sitemaps_Users constructor. + * + * @since 5.5.0 + */ + public function __construct() + { + } + /** + * Gets a URL list for a user sitemap. + * + * @since 5.5.0 + * + * @param int $page_num Page of results. + * @param string $object_subtype Optional. Not applicable for Users but + * required for compatibility with the parent + * provider class. Default empty. + * @return array[] Array of URL information for a sitemap. + */ + public function get_url_list($page_num, $object_subtype = '') + { + } + /** + * Gets the max number of pages available for the object type. + * + * @since 5.5.0 + * + * @see WP_Sitemaps_Provider::max_num_pages + * + * @param string $object_subtype Optional. Not applicable for Users but + * required for compatibility with the parent + * provider class. Default empty. + * @return int Total page count. + */ + public function get_max_num_pages($object_subtype = '') + { + } + /** + * Returns the query args for retrieving users to list in the sitemap. + * + * @since 5.5.0 + * + * @return array Array of WP_User_Query arguments. + */ + protected function get_users_query_args() + { + } + } + /** + * Style Engine: WP_Style_Engine_CSS_Declarations class + * + * @package WordPress + * @subpackage StyleEngine + * @since 6.1.0 + */ + /** + * Core class used for style engine CSS declarations. + * + * Holds, sanitizes, processes, and prints CSS declarations for the style engine. + * + * @since 6.1.0 + */ + #[\AllowDynamicProperties] + class WP_Style_Engine_CSS_Declarations + { + /** + * An array of CSS declarations (property => value pairs). + * + * @since 6.1.0 + * + * @var string[] + */ + protected $declarations = array(); + /** + * Constructor for this object. + * + * If a `$declarations` array is passed, it will be used to populate + * the initial `$declarations` prop of the object by calling add_declarations(). + * + * @since 6.1.0 + * + * @param string[] $declarations Optional. An associative array of CSS definitions, + * e.g. `array( "$property" => "$value", "$property" => "$value" )`. + * Default empty array. + */ + public function __construct($declarations = array()) + { + } + /** + * Adds a single declaration. + * + * @since 6.1.0 + * + * @param string $property The CSS property. + * @param string $value The CSS value. + * @return WP_Style_Engine_CSS_Declarations Returns the object to allow chaining methods. + */ + public function add_declaration($property, $value) + { + } + /** + * Removes a single declaration. + * + * @since 6.1.0 + * + * @param string $property The CSS property. + * @return WP_Style_Engine_CSS_Declarations Returns the object to allow chaining methods. + */ + public function remove_declaration($property) + { + } + /** + * Adds multiple declarations. + * + * @since 6.1.0 + * + * @param string[] $declarations An array of declarations. + * @return WP_Style_Engine_CSS_Declarations Returns the object to allow chaining methods. + */ + public function add_declarations($declarations) + { + } + /** + * Removes multiple declarations. + * + * @since 6.1.0 + * + * @param string[] $properties Optional. An array of properties. Default empty array. + * @return WP_Style_Engine_CSS_Declarations Returns the object to allow chaining methods. + */ + public function remove_declarations($properties = array()) + { + } + /** + * Gets the declarations array. + * + * @since 6.1.0 + * + * @return string[] The declarations array. + */ + public function get_declarations() + { + } + /** + * Filters a CSS property + value pair. + * + * @since 6.1.0 + * + * @param string $property The CSS property. + * @param string $value The value to be filtered. + * @param string $spacer Optional. The spacer between the colon and the value. + * Default empty string. + * @return string The filtered declaration or an empty string. + */ + protected static function filter_declaration($property, $value, $spacer = '') + { + } + /** + * Filters and compiles the CSS declarations. + * + * @since 6.1.0 + * + * @param bool $should_prettify Optional. Whether to add spacing, new lines and indents. + * Default false. + * @param int $indent_count Optional. The number of tab indents to apply to the rule. + * Applies if `prettify` is `true`. Default 0. + * @return string The CSS declarations. + */ + public function get_declarations_string($should_prettify = \false, $indent_count = 0) + { + } + /** + * Sanitizes property names. + * + * @since 6.1.0 + * + * @param string $property The CSS property. + * @return string The sanitized property name. + */ + protected function sanitize_property($property) + { + } + } + /** + * Style Engine: WP_Style_Engine_CSS_Rule class + * + * @package WordPress + * @subpackage StyleEngine + * @since 6.1.0 + */ + /** + * Core class used for style engine CSS rules. + * + * Holds, sanitizes, processes, and prints CSS declarations for the style engine. + * + * @since 6.1.0 + */ + #[\AllowDynamicProperties] + class WP_Style_Engine_CSS_Rule + { + /** + * The selector. + * + * @since 6.1.0 + * @var string + */ + protected $selector; + /** + * The selector declarations. + * + * Contains a WP_Style_Engine_CSS_Declarations object. + * + * @since 6.1.0 + * @var WP_Style_Engine_CSS_Declarations + */ + protected $declarations; + /** + * A parent CSS selector in the case of nested CSS, or a CSS nested @rule, + * such as `@media (min-width: 80rem)` or `@layer module`. + * + * @since 6.6.0 + * @var string + */ + protected $rules_group; + /** + * Constructor. + * + * @since 6.1.0 + * @since 6.6.0 Added the `$rules_group` parameter. + * + * @param string $selector Optional. The CSS selector. Default empty string. + * @param string[]|WP_Style_Engine_CSS_Declarations $declarations Optional. An associative array of CSS definitions, + * e.g. `array( "$property" => "$value", "$property" => "$value" )`, + * or a WP_Style_Engine_CSS_Declarations object. + * Default empty array. + * @param string $rules_group A parent CSS selector in the case of nested CSS, or a CSS nested @rule, + * such as `@media (min-width: 80rem)` or `@layer module`. + */ + public function __construct($selector = '', $declarations = array(), $rules_group = '') + { + } + /** + * Sets the selector. + * + * @since 6.1.0 + * + * @param string $selector The CSS selector. + * @return WP_Style_Engine_CSS_Rule Returns the object to allow chaining of methods. + */ + public function set_selector($selector) + { + } + /** + * Sets the declarations. + * + * @since 6.1.0 + * + * @param string[]|WP_Style_Engine_CSS_Declarations $declarations An array of declarations (property => value pairs), + * or a WP_Style_Engine_CSS_Declarations object. + * @return WP_Style_Engine_CSS_Rule Returns the object to allow chaining of methods. + */ + public function add_declarations($declarations) + { + } + /** + * Sets the rules group. + * + * @since 6.6.0 + * + * @param string $rules_group A parent CSS selector in the case of nested CSS, or a CSS nested @rule, + * such as `@media (min-width: 80rem)` or `@layer module`. + * @return WP_Style_Engine_CSS_Rule Returns the object to allow chaining of methods. + */ + public function set_rules_group($rules_group) + { + } + /** + * Gets the rules group. + * + * @since 6.6.0 + * + * @return string + */ + public function get_rules_group() + { + } + /** + * Gets the declarations object. + * + * @since 6.1.0 + * + * @return WP_Style_Engine_CSS_Declarations The declarations object. + */ + public function get_declarations() + { + } + /** + * Gets the full selector. + * + * @since 6.1.0 + * + * @return string + */ + public function get_selector() + { + } + /** + * Gets the CSS. + * + * @since 6.1.0 + * @since 6.6.0 Added support for nested CSS with rules groups. + * + * @param bool $should_prettify Optional. Whether to add spacing, new lines and indents. + * Default false. + * @param int $indent_count Optional. The number of tab indents to apply to the rule. + * Applies if `prettify` is `true`. Default 0. + * @return string + */ + public function get_css($should_prettify = \false, $indent_count = 0) + { + } + } + /** + * Style Engine: WP_Style_Engine_CSS_Rules_Store class + * + * @package WordPress + * @subpackage StyleEngine + * @since 6.1.0 + */ + /** + * Core class used as a store for WP_Style_Engine_CSS_Rule objects. + * + * Holds, sanitizes, processes, and prints CSS declarations for the style engine. + * + * @since 6.1.0 + */ + #[\AllowDynamicProperties] + class WP_Style_Engine_CSS_Rules_Store + { + /** + * An array of named WP_Style_Engine_CSS_Rules_Store objects. + * + * @static + * + * @since 6.1.0 + * @var WP_Style_Engine_CSS_Rules_Store[] + */ + protected static $stores = array(); + /** + * The store name. + * + * @since 6.1.0 + * @var string + */ + protected $name = ''; + /** + * An array of CSS Rules objects assigned to the store. + * + * @since 6.1.0 + * @var WP_Style_Engine_CSS_Rule[] + */ + protected $rules = array(); + /** + * Gets an instance of the store. + * + * @since 6.1.0 + * + * @param string $store_name The name of the store. + * @return WP_Style_Engine_CSS_Rules_Store|void + */ + public static function get_store($store_name = 'default') + { + } + /** + * Gets an array of all available stores. + * + * @since 6.1.0 + * + * @return WP_Style_Engine_CSS_Rules_Store[] + */ + public static function get_stores() + { + } + /** + * Clears all stores from static::$stores. + * + * @since 6.1.0 + */ + public static function remove_all_stores() + { + } + /** + * Sets the store name. + * + * @since 6.1.0 + * + * @param string $name The store name. + */ + public function set_name($name) + { + } + /** + * Gets the store name. + * + * @since 6.1.0 + * + * @return string + */ + public function get_name() + { + } + /** + * Gets an array of all rules. + * + * @since 6.1.0 + * + * @return WP_Style_Engine_CSS_Rule[] + */ + public function get_all_rules() + { + } + /** + * Gets a WP_Style_Engine_CSS_Rule object by its selector. + * If the rule does not exist, it will be created. + * + * @since 6.1.0 + * @since 6.6.0 Added the $rules_group parameter. + * + * @param string $selector The CSS selector. + * @param string $rules_group A parent CSS selector in the case of nested CSS, or a CSS nested @rule, + * such as `@media (min-width: 80rem)` or `@layer module`. + * @return WP_Style_Engine_CSS_Rule|void Returns a WP_Style_Engine_CSS_Rule object, + * or void if the selector is empty. + */ + public function add_rule($selector, $rules_group = '') + { + } + /** + * Removes a selector from the store. + * + * @since 6.1.0 + * + * @param string $selector The CSS selector. + */ + public function remove_rule($selector) + { + } + } + /** + * Style Engine: WP_Style_Engine_Processor class + * + * @package WordPress + * @subpackage StyleEngine + * @since 6.1.0 + */ + /** + * Core class used to compile styles from stores or collection of CSS rules. + * + * @since 6.1.0 + */ + #[\AllowDynamicProperties] + class WP_Style_Engine_Processor + { + /** + * A collection of Style Engine Store objects. + * + * @since 6.1.0 + * @var WP_Style_Engine_CSS_Rules_Store[] + */ + protected $stores = array(); + /** + * The set of CSS rules that this processor will work on. + * + * @since 6.1.0 + * @var WP_Style_Engine_CSS_Rule[] + */ + protected $css_rules = array(); + /** + * Adds a store to the processor. + * + * @since 6.1.0 + * + * @param WP_Style_Engine_CSS_Rules_Store $store The store to add. + * @return WP_Style_Engine_Processor Returns the object to allow chaining methods. + */ + public function add_store($store) + { + } + /** + * Adds rules to be processed. + * + * @since 6.1.0 + * @since 6.6.0 Added support for rules_group. + * + * @param WP_Style_Engine_CSS_Rule|WP_Style_Engine_CSS_Rule[] $css_rules A single, or an array of, + * WP_Style_Engine_CSS_Rule objects + * from a store or otherwise. + * @return WP_Style_Engine_Processor Returns the object to allow chaining methods. + */ + public function add_rules($css_rules) + { + } + /** + * Gets the CSS rules as a string. + * + * @since 6.1.0 + * @since 6.4.0 The Optimization is no longer the default. + * + * @param array $options { + * Optional. An array of options. Default empty array. + * + * @type bool $optimize Whether to optimize the CSS output, e.g. combine rules. + * Default false. + * @type bool $prettify Whether to add new lines and indents to output. + * Defaults to whether the `SCRIPT_DEBUG` constant is defined. + * } + * @return string The computed CSS. + * @phpstan-param array{ + * optimize?: bool, + * prettify?: bool, + * } $options + */ + public function get_css($options = array()) + { + } + } + /** + * Style Engine: WP_Style_Engine class + * + * @package WordPress + * @subpackage StyleEngine + * @since 6.1.0 + */ + /** + * The main class integrating all other WP_Style_Engine_* classes. + * + * The Style Engine aims to provide a consistent API for rendering styling for blocks + * across both client-side and server-side applications. + * + * This class is final and should not be extended. + * + * This class is for internal Core usage and is not supposed to be used by extenders + * (plugins and/or themes). This is a low-level API that may need to do breaking changes. + * Please, use wp_style_engine_get_styles() instead. + * + * @access private + * @since 6.1.0 + * @since 6.3.0 Added support for text-columns. + * @since 6.4.0 Added support for background.backgroundImage. + * @since 6.5.0 Added support for background.backgroundPosition, + * background.backgroundRepeat and dimensions.aspectRatio. + */ + #[\AllowDynamicProperties] + final class WP_Style_Engine + { + /** + * Style definitions that contain the instructions to parse/output valid Gutenberg styles from a block's attributes. + * + * For every style definition, the following properties are valid: + * + * - classnames => (array) an array of classnames to be returned for block styles. The key is a classname or pattern. + * A value of `true` means the classname should be applied always. Otherwise, a valid CSS property (string) + * to match the incoming value, e.g., "color" to match var:preset|color|somePresetSlug. + * - css_vars => (array) an array of key value pairs used to generate CSS var values. + * The key should be the CSS property name that matches the second element of the preset string value, + * i.e., "color" in var:preset|color|somePresetSlug. The value is a CSS var pattern (e.g. `--wp--preset--color--$slug`), + * whose `$slug` fragment will be replaced with the preset slug, which is the third element of the preset string value, + * i.e., `somePresetSlug` in var:preset|color|somePresetSlug. + * - property_keys => (array) array of keys whose values represent a valid CSS property, e.g., "margin" or "border". + * - path => (array) a path that accesses the corresponding style value in the block style object. + * - value_func => (string) the name of a function to generate a CSS definition array for a particular style object. The output of this function should be `array( "$property" => "$value", ... )`. + * + * @since 6.1.0 + * @var array + */ + const BLOCK_STYLE_DEFINITIONS_METADATA = array('background' => array('backgroundImage' => array('property_keys' => array('default' => 'background-image'), 'value_func' => array(self::class, 'get_url_or_value_css_declaration'), 'path' => array('background', 'backgroundImage')), 'backgroundPosition' => array('property_keys' => array('default' => 'background-position'), 'path' => array('background', 'backgroundPosition')), 'backgroundRepeat' => array('property_keys' => array('default' => 'background-repeat'), 'path' => array('background', 'backgroundRepeat')), 'backgroundSize' => array('property_keys' => array('default' => 'background-size'), 'path' => array('background', 'backgroundSize'))), 'color' => array('text' => array('property_keys' => array('default' => 'color'), 'path' => array('color', 'text'), 'css_vars' => array('color' => '--wp--preset--color--$slug'), 'classnames' => array('has-text-color' => \true, 'has-$slug-color' => 'color')), 'background' => array('property_keys' => array('default' => 'background-color'), 'path' => array('color', 'background'), 'css_vars' => array('color' => '--wp--preset--color--$slug'), 'classnames' => array('has-background' => \true, 'has-$slug-background-color' => 'color')), 'gradient' => array('property_keys' => array('default' => 'background'), 'path' => array('color', 'gradient'), 'css_vars' => array('gradient' => '--wp--preset--gradient--$slug'), 'classnames' => array('has-background' => \true, 'has-$slug-gradient-background' => 'gradient'))), 'border' => array('color' => array('property_keys' => array('default' => 'border-color', 'individual' => 'border-%s-color'), 'path' => array('border', 'color'), 'classnames' => array('has-border-color' => \true, 'has-$slug-border-color' => 'color')), 'radius' => array('property_keys' => array('default' => 'border-radius', 'individual' => 'border-%s-radius'), 'path' => array('border', 'radius')), 'style' => array('property_keys' => array('default' => 'border-style', 'individual' => 'border-%s-style'), 'path' => array('border', 'style')), 'width' => array('property_keys' => array('default' => 'border-width', 'individual' => 'border-%s-width'), 'path' => array('border', 'width')), 'top' => array('value_func' => array(self::class, 'get_individual_property_css_declarations'), 'path' => array('border', 'top'), 'css_vars' => array('color' => '--wp--preset--color--$slug')), 'right' => array('value_func' => array(self::class, 'get_individual_property_css_declarations'), 'path' => array('border', 'right'), 'css_vars' => array('color' => '--wp--preset--color--$slug')), 'bottom' => array('value_func' => array(self::class, 'get_individual_property_css_declarations'), 'path' => array('border', 'bottom'), 'css_vars' => array('color' => '--wp--preset--color--$slug')), 'left' => array('value_func' => array(self::class, 'get_individual_property_css_declarations'), 'path' => array('border', 'left'), 'css_vars' => array('color' => '--wp--preset--color--$slug'))), 'shadow' => array('shadow' => array('property_keys' => array('default' => 'box-shadow'), 'path' => array('shadow'), 'css_vars' => array('shadow' => '--wp--preset--shadow--$slug'))), 'dimensions' => array('aspectRatio' => array('property_keys' => array('default' => 'aspect-ratio'), 'path' => array('dimensions', 'aspectRatio'), 'classnames' => array('has-aspect-ratio' => \true)), 'minHeight' => array('property_keys' => array('default' => 'min-height'), 'path' => array('dimensions', 'minHeight'), 'css_vars' => array('spacing' => '--wp--preset--spacing--$slug'))), 'spacing' => array('padding' => array('property_keys' => array('default' => 'padding', 'individual' => 'padding-%s'), 'path' => array('spacing', 'padding'), 'css_vars' => array('spacing' => '--wp--preset--spacing--$slug')), 'margin' => array('property_keys' => array('default' => 'margin', 'individual' => 'margin-%s'), 'path' => array('spacing', 'margin'), 'css_vars' => array('spacing' => '--wp--preset--spacing--$slug'))), 'typography' => array('fontSize' => array('property_keys' => array('default' => 'font-size'), 'path' => array('typography', 'fontSize'), 'css_vars' => array('font-size' => '--wp--preset--font-size--$slug'), 'classnames' => array('has-$slug-font-size' => 'font-size')), 'fontFamily' => array('property_keys' => array('default' => 'font-family'), 'css_vars' => array('font-family' => '--wp--preset--font-family--$slug'), 'path' => array('typography', 'fontFamily'), 'classnames' => array('has-$slug-font-family' => 'font-family')), 'fontStyle' => array('property_keys' => array('default' => 'font-style'), 'path' => array('typography', 'fontStyle')), 'fontWeight' => array('property_keys' => array('default' => 'font-weight'), 'path' => array('typography', 'fontWeight')), 'lineHeight' => array('property_keys' => array('default' => 'line-height'), 'path' => array('typography', 'lineHeight')), 'textColumns' => array('property_keys' => array('default' => 'column-count'), 'path' => array('typography', 'textColumns')), 'textDecoration' => array('property_keys' => array('default' => 'text-decoration'), 'path' => array('typography', 'textDecoration')), 'textTransform' => array('property_keys' => array('default' => 'text-transform'), 'path' => array('typography', 'textTransform')), 'letterSpacing' => array('property_keys' => array('default' => 'letter-spacing'), 'path' => array('typography', 'letterSpacing')))); + /** + * Stores a CSS rule using the provided CSS selector and CSS declarations. + * + * @since 6.1.0 + * @since 6.6.0 Added the `$rules_group` parameter. + * + * @param string $store_name A valid store key. + * @param string $css_selector When a selector is passed, the function will return + * a full CSS rule `$selector { ...rules }` + * otherwise a concatenated string of properties and values. + * @param string[] $css_declarations An associative array of CSS definitions, + * e.g. `array( "$property" => "$value", "$property" => "$value" )`. + * @param string $rules_group Optional. A parent CSS selector in the case of nested CSS, or a CSS nested @rule, + * such as `@media (min-width: 80rem)` or `@layer module`. + * @phpstan-return void + */ + public static function store_css_rule($store_name, $css_selector, $css_declarations, $rules_group = '') + { + } + /** + * Returns a store by store key. + * + * @since 6.1.0 + * + * @param string $store_name A store key. + * @return WP_Style_Engine_CSS_Rules_Store|null + */ + public static function get_store($store_name) + { + } + /** + * Returns classnames and CSS based on the values in a styles object. + * + * Return values are parsed based on the instructions in BLOCK_STYLE_DEFINITIONS_METADATA. + * + * @since 6.1.0 + * + * @param array $block_styles The style object. + * @param array $options { + * Optional. An array of options. Default empty array. + * + * @type bool $convert_vars_to_classnames Whether to skip converting incoming CSS var patterns, + * e.g. `var:preset|<PRESET_TYPE>|<PRESET_SLUG>`, + * to `var( --wp--preset--* )` values. Default false. + * @type string $selector Optional. When a selector is passed, + * the value of `$css` in the return value will comprise + * a full CSS rule `$selector { ...$css_declarations }`, + * otherwise, the value will be a concatenated string + * of CSS declarations. + * } + * @return array { + * @type string[] $classnames Array of class names. + * @type string[] $declarations An associative array of CSS definitions, + * e.g. `array( "$property" => "$value", "$property" => "$value" )`. + * } + * @phpstan-param array{ + * convert_vars_to_classnames?: bool, + * selector?: string, + * } $options + * @phpstan-return array{ + * classnames: string[], + * declarations: string[], + * } + */ + public static function parse_block_styles($block_styles, $options) + { + } + /** + * Returns compiled CSS from CSS declarations. + * + * @since 6.1.0 + * + * @param string[] $css_declarations An associative array of CSS definitions, + * e.g. `array( "$property" => "$value", "$property" => "$value" )`. + * @param string $css_selector When a selector is passed, the function will return + * a full CSS rule `$selector { ...rules }`, + * otherwise a concatenated string of properties and values. + * @return string A compiled CSS string. + */ + public static function compile_css($css_declarations, $css_selector) + { + } + /** + * Returns a compiled stylesheet from stored CSS rules. + * + * @since 6.1.0 + * + * @param WP_Style_Engine_CSS_Rule[] $css_rules An array of WP_Style_Engine_CSS_Rule objects + * from a store or otherwise. + * @param array $options { + * Optional. An array of options. Default empty array. + * + * @type string|null $context An identifier describing the origin of the style object, + * e.g. 'block-supports' or 'global-styles'. Default 'block-supports'. + * When set, the style engine will attempt to store the CSS rules. + * @type bool $optimize Whether to optimize the CSS output, e.g. combine rules. + * Default false. + * @type bool $prettify Whether to add new lines and indents to output. + * Defaults to whether the `SCRIPT_DEBUG` constant is defined. + * } + * @return string A compiled stylesheet from stored CSS rules. + * @phpstan-param array{ + * context?: string|null, + * optimize?: bool, + * prettify?: bool, + * } $options + */ + public static function compile_stylesheet_from_css_rules($css_rules, $options = array()) + { + } + } + /** + * Widget API: WP_Nav_Menu_Widget class + * + * @package WordPress + * @subpackage Widgets + * @since 4.4.0 + */ + /** + * Core class used to implement the Navigation Menu widget. + * + * @since 3.0.0 + * + * @see WP_Widget + */ + class WP_Nav_Menu_Widget extends \WP_Widget + { + /** + * Sets up a new Navigation Menu widget instance. + * + * @since 3.0.0 + */ + public function __construct() + { + } + /** + * Outputs the content for the current Navigation Menu widget instance. + * + * @since 3.0.0 + * + * @param array $args Display arguments including 'before_title', 'after_title', + * 'before_widget', and 'after_widget'. + * @param array $instance Settings for the current Navigation Menu widget instance. + * @phpstan-return void + */ + public function widget($args, $instance) + { + } + /** + * Handles updating settings for the current Navigation Menu widget instance. + * + * @since 3.0.0 + * + * @param array $new_instance New settings for this instance as input by the user via + * WP_Widget::form(). + * @param array $old_instance Old settings for this instance. + * @return array Updated settings to save. + */ + public function update($new_instance, $old_instance) + { + } + /** + * Outputs the settings form for the Navigation Menu widget. + * + * @since 3.0.0 + * + * @global WP_Customize_Manager $wp_customize + * + * @param array $instance Current settings. + */ + public function form($instance) + { + } + } + /** + * Widget API: WP_Widget_Archives class + * + * @package WordPress + * @subpackage Widgets + * @since 4.4.0 + */ + /** + * Core class used to implement the Archives widget. + * + * @since 2.8.0 + * + * @see WP_Widget + */ + class WP_Widget_Archives extends \WP_Widget + { + /** + * Sets up a new Archives widget instance. + * + * @since 2.8.0 + */ + public function __construct() + { + } + /** + * Outputs the content for the current Archives widget instance. + * + * @since 2.8.0 + * + * @param array $args Display arguments including 'before_title', 'after_title', + * 'before_widget', and 'after_widget'. + * @param array $instance Settings for the current Archives widget instance. + */ + public function widget($args, $instance) + { + } + /** + * Handles updating settings for the current Archives widget instance. + * + * @since 2.8.0 + * + * @param array $new_instance New settings for this instance as input by the user via + * WP_Widget_Archives::form(). + * @param array $old_instance Old settings for this instance. + * @return array Updated settings to save. + */ + public function update($new_instance, $old_instance) + { + } + /** + * Outputs the settings form for the Archives widget. + * + * @since 2.8.0 + * + * @param array $instance Current settings. + */ + public function form($instance) + { + } + } + /** + * Widget API: WP_Widget_Block class + * + * @package WordPress + * @subpackage Widgets + * @since 5.8.0 + */ + /** + * Core class used to implement a Block widget. + * + * @since 5.8.0 + * + * @see WP_Widget + */ + class WP_Widget_Block extends \WP_Widget + { + /** + * Default instance. + * + * @since 5.8.0 + * @var array + */ + protected $default_instance = array('content' => ''); + /** + * Sets up a new Block widget instance. + * + * @since 5.8.0 + */ + public function __construct() + { + } + /** + * Outputs the content for the current Block widget instance. + * + * @since 5.8.0 + * + * @param array $args Display arguments including 'before_title', 'after_title', + * 'before_widget', and 'after_widget'. + * @param array $instance Settings for the current Block widget instance. + */ + public function widget($args, $instance) + { + } + /** + * Handles updating settings for the current Block widget instance. + * + * @since 5.8.0 + * @param array $new_instance New settings for this instance as input by the user via + * WP_Widget::form(). + * @param array $old_instance Old settings for this instance. + * @return array Settings to save or bool false to cancel saving. + */ + public function update($new_instance, $old_instance) + { + } + /** + * Outputs the Block widget settings form. + * + * @since 5.8.0 + * + * @see WP_Widget_Custom_HTML::render_control_template_scripts() + * + * @param array $instance Current instance. + */ + public function form($instance) + { + } + /** + * Makes sure no block widget is considered to be wide. + * + * @since 5.8.0 + * + * @param bool $is_wide Whether the widget is considered wide. + * @param string $widget_id Widget ID. + * @return bool Updated `is_wide` value. + */ + public function set_is_wide_widget_in_customizer($is_wide, $widget_id) + { + } + } + /** + * Widget API: WP_Widget_Calendar class + * + * @package WordPress + * @subpackage Widgets + * @since 4.4.0 + */ + /** + * Core class used to implement the Calendar widget. + * + * @since 2.8.0 + * + * @see WP_Widget + */ + class WP_Widget_Calendar extends \WP_Widget + { + /** + * Sets up a new Calendar widget instance. + * + * @since 2.8.0 + */ + public function __construct() + { + } + /** + * Outputs the content for the current Calendar widget instance. + * + * @since 2.8.0 + * + * @param array $args Display arguments including 'before_title', 'after_title', + * 'before_widget', and 'after_widget'. + * @param array $instance The settings for the particular instance of the widget. + */ + public function widget($args, $instance) + { + } + /** + * Handles updating settings for the current Calendar widget instance. + * + * @since 2.8.0 + * + * @param array $new_instance New settings for this instance as input by the user via + * WP_Widget::form(). + * @param array $old_instance Old settings for this instance. + * @return array Updated settings to save. + */ + public function update($new_instance, $old_instance) + { + } + /** + * Outputs the settings form for the Calendar widget. + * + * @since 2.8.0 + * + * @param array $instance Current settings. + */ + public function form($instance) + { + } + } + /** + * Widget API: WP_Widget_Categories class + * + * @package WordPress + * @subpackage Widgets + * @since 4.4.0 + */ + /** + * Core class used to implement a Categories widget. + * + * @since 2.8.0 + * + * @see WP_Widget + */ + class WP_Widget_Categories extends \WP_Widget + { + /** + * Sets up a new Categories widget instance. + * + * @since 2.8.0 + */ + public function __construct() + { + } + /** + * Outputs the content for the current Categories widget instance. + * + * @since 2.8.0 + * @since 4.2.0 Creates a unique HTML ID for the `<select>` element + * if more than one instance is displayed on the page. + * + * @param array $args Display arguments including 'before_title', 'after_title', + * 'before_widget', and 'after_widget'. + * @param array $instance Settings for the current Categories widget instance. + */ + public function widget($args, $instance) + { + } + /** + * Handles updating settings for the current Categories widget instance. + * + * @since 2.8.0 + * + * @param array $new_instance New settings for this instance as input by the user via + * WP_Widget::form(). + * @param array $old_instance Old settings for this instance. + * @return array Updated settings to save. + */ + public function update($new_instance, $old_instance) + { + } + /** + * Outputs the settings form for the Categories widget. + * + * @since 2.8.0 + * + * @param array $instance Current settings. + */ + public function form($instance) + { + } + } + /** + * Widget API: WP_Widget_Custom_HTML class + * + * @package WordPress + * @subpackage Widgets + * @since 4.8.1 + */ + /** + * Core class used to implement a Custom HTML widget. + * + * @since 4.8.1 + * + * @see WP_Widget + */ + class WP_Widget_Custom_HTML extends \WP_Widget + { + /** + * Whether or not the widget has been registered yet. + * + * @since 4.9.0 + * @var bool + */ + protected $registered = \false; + /** + * Default instance. + * + * @since 4.8.1 + * @var array + */ + protected $default_instance = array('title' => '', 'content' => ''); + /** + * Sets up a new Custom HTML widget instance. + * + * @since 4.8.1 + */ + public function __construct() + { + } + /** + * Add hooks for enqueueing assets when registering all widget instances of this widget class. + * + * @since 4.9.0 + * + * @param int $number Optional. The unique order number of this widget instance + * compared to other instances of the same class. Default -1. + * @phpstan-return void + */ + public function _register_one($number = -1) + { + } + /** + * Filters gallery shortcode attributes. + * + * Prevents all of a site's attachments from being shown in a gallery displayed on a + * non-singular template where a $post context is not available. + * + * @since 4.9.0 + * + * @param array $attrs Attributes. + * @return array Attributes. + */ + public function _filter_gallery_shortcode_attrs($attrs) + { + } + /** + * Outputs the content for the current Custom HTML widget instance. + * + * @since 4.8.1 + * + * @global WP_Post $post Global post object. + * + * @param array $args Display arguments including 'before_title', 'after_title', + * 'before_widget', and 'after_widget'. + * @param array $instance Settings for the current Custom HTML widget instance. + */ + public function widget($args, $instance) + { + } + /** + * Handles updating settings for the current Custom HTML widget instance. + * + * @since 4.8.1 + * + * @param array $new_instance New settings for this instance as input by the user via + * WP_Widget::form(). + * @param array $old_instance Old settings for this instance. + * @return array Settings to save or bool false to cancel saving. + */ + public function update($new_instance, $old_instance) + { + } + /** + * Loads the required scripts and styles for the widget control. + * + * @since 4.9.0 + */ + public function enqueue_admin_scripts() + { + } + /** + * Outputs the Custom HTML widget settings form. + * + * @since 4.8.1 + * @since 4.9.0 The form contains only hidden sync inputs. For the control UI, see `WP_Widget_Custom_HTML::render_control_template_scripts()`. + * + * @see WP_Widget_Custom_HTML::render_control_template_scripts() + * + * @param array $instance Current instance. + */ + public function form($instance) + { + } + /** + * Render form template scripts. + * + * @since 4.9.0 + */ + public static function render_control_template_scripts() + { + } + /** + * Add help text to widgets admin screen. + * + * @since 4.9.0 + */ + public static function add_help_text() + { + } + } + /** + * Widget API: WP_Widget_Links class + * + * @package WordPress + * @subpackage Widgets + * @since 4.4.0 + */ + /** + * Core class used to implement a Links widget. + * + * @since 2.8.0 + * + * @see WP_Widget + */ + class WP_Widget_Links extends \WP_Widget + { + /** + * Sets up a new Links widget instance. + * + * @since 2.8.0 + */ + public function __construct() + { + } + /** + * Outputs the content for the current Links widget instance. + * + * @since 2.8.0 + * + * @param array $args Display arguments including 'before_title', 'after_title', + * 'before_widget', and 'after_widget'. + * @param array $instance Settings for the current Links widget instance. + */ + public function widget($args, $instance) + { + } + /** + * Handles updating settings for the current Links widget instance. + * + * @since 2.8.0 + * + * @param array $new_instance New settings for this instance as input by the user via + * WP_Widget::form(). + * @param array $old_instance Old settings for this instance. + * @return array Updated settings to save. + */ + public function update($new_instance, $old_instance) + { + } + /** + * Outputs the settings form for the Links widget. + * + * @since 2.8.0 + * + * @param array $instance Current settings. + */ + public function form($instance) + { + } + } + /** + * Widget API: WP_Media_Widget class + * + * @package WordPress + * @subpackage Widgets + * @since 4.8.0 + */ + /** + * Core class that implements a media widget. + * + * @since 4.8.0 + * + * @see WP_Widget + */ + abstract class WP_Widget_Media extends \WP_Widget + { + /** + * Translation labels. + * + * @since 4.8.0 + * @var array + */ + public $l10n = array('add_to_widget' => '', 'replace_media' => '', 'edit_media' => '', 'media_library_state_multi' => '', 'media_library_state_single' => '', 'missing_attachment' => '', 'no_media_selected' => '', 'add_media' => ''); + /** + * Whether or not the widget has been registered yet. + * + * @since 4.8.1 + * @var bool + */ + protected $registered = \false; + /** + * The default widget description. + * + * @since 6.0.0 + * @var string + */ + protected static $default_description = ''; + /** + * The default localized strings used by the widget. + * + * @since 6.0.0 + * @var string[] + */ + protected static $l10n_defaults = array(); + /** + * Constructor. + * + * @since 4.8.0 + * + * @param string $id_base Base ID for the widget, lowercase and unique. + * @param string $name Name for the widget displayed on the configuration page. + * @param array $widget_options Optional. Widget options. See wp_register_sidebar_widget() for + * information on accepted arguments. Default empty array. + * @param array $control_options Optional. Widget control options. See wp_register_widget_control() + * for information on accepted arguments. Default empty array. + * @phpstan-param array{ + * classname?: string, + * description?: string, + * show_instance_in_rest?: bool, + * } $widget_options See wp_register_sidebar_widget() + * @phpstan-param array{ + * height?: int, + * width?: int, + * id_base?: int|string, + * } $control_options See wp_register_widget_control() + */ + public function __construct($id_base, $name, $widget_options = array(), $control_options = array()) + { + } + /** + * Add hooks while registering all widget instances of this widget class. + * + * @since 4.8.0 + * + * @param int $number Optional. The unique order number of this widget instance + * compared to other instances of the same class. Default -1. + * @phpstan-return void + */ + public function _register_one($number = -1) + { + } + /** + * Get schema for properties of a widget instance (item). + * + * @since 4.8.0 + * + * @see WP_REST_Controller::get_item_schema() + * @see WP_REST_Controller::get_additional_fields() + * @link https://core.trac.wordpress.org/ticket/35574 + * + * @return array Schema for properties. + */ + public function get_instance_schema() + { + } + /** + * Determine if the supplied attachment is for a valid attachment post with the specified MIME type. + * + * @since 4.8.0 + * + * @param int|WP_Post $attachment Attachment post ID or object. + * @param string $mime_type MIME type. + * @return bool Is matching MIME type. + */ + public function is_attachment_with_mime_type($attachment, $mime_type) + { + } + /** + * Sanitize a token list string, such as used in HTML rel and class attributes. + * + * @since 4.8.0 + * + * @link http://w3c.github.io/html/infrastructure.html#space-separated-tokens + * @link https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList + * @param string|array $tokens List of tokens separated by spaces, or an array of tokens. + * @return string Sanitized token string list. + */ + public function sanitize_token_list($tokens) + { + } + /** + * Displays the widget on the front-end. + * + * @since 4.8.0 + * + * @see WP_Widget::widget() + * + * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget. + * @param array $instance Saved setting from the database. + * @phpstan-return void + */ + public function widget($args, $instance) + { + } + /** + * Sanitizes the widget form values as they are saved. + * + * @since 4.8.0 + * @since 5.9.0 Renamed `$instance` to `$old_instance` to match parent class + * for PHP 8 named parameter support. + * + * @see WP_Widget::update() + * @see WP_REST_Request::has_valid_params() + * @see WP_REST_Request::sanitize_params() + * + * @param array $new_instance Values just sent to be saved. + * @param array $old_instance Previously saved values from database. + * @return array Updated safe values to be saved. + */ + public function update($new_instance, $old_instance) + { + } + /** + * Render the media on the frontend. + * + * @since 4.8.0 + * + * @param array $instance Widget instance props. + */ + public abstract function render_media($instance); + /** + * Outputs the settings update form. + * + * Note that the widget UI itself is rendered with JavaScript via `MediaWidgetControl#render()`. + * + * @since 4.8.0 + * + * @see \WP_Widget_Media::render_control_template_scripts() Where the JS template is located. + * + * @param array $instance Current settings. + */ + public final function form($instance) + { + } + /** + * Filters the default media display states for items in the Media list table. + * + * @since 4.8.0 + * + * @param array $states An array of media states. + * @param WP_Post $post The current attachment object. + * @return array + */ + public function display_media_state($states, $post = \null) + { + } + /** + * Enqueue preview scripts. + * + * These scripts normally are enqueued just-in-time when a widget is rendered. + * In the customizer, however, widgets can be dynamically added and rendered via + * selective refresh, and so it is important to unconditionally enqueue them in + * case a widget does get added. + * + * @since 4.8.0 + */ + public function enqueue_preview_scripts() + { + } + /** + * Loads the required scripts and styles for the widget control. + * + * @since 4.8.0 + */ + public function enqueue_admin_scripts() + { + } + /** + * Render form template scripts. + * + * @since 4.8.0 + */ + public function render_control_template_scripts() + { + } + /** + * Resets the cache for the default labels. + * + * @since 6.0.0 + */ + public static function reset_default_labels() + { + } + /** + * Whether the widget has content to show. + * + * @since 4.8.0 + * + * @param array $instance Widget instance props. + * @return bool Whether widget has content. + */ + protected function has_content($instance) + { + } + /** + * Returns the default description of the widget. + * + * @since 6.0.0 + * + * @return string + */ + protected static function get_default_description() + { + } + /** + * Returns the default localized strings used by the widget. + * + * @since 6.0.0 + * + * @return (string|array)[] + */ + protected static function get_l10n_defaults() + { + } + } + /** + * Widget API: WP_Widget_Media_Audio class + * + * @package WordPress + * @subpackage Widgets + * @since 4.8.0 + */ + /** + * Core class that implements an audio widget. + * + * @since 4.8.0 + * + * @see WP_Widget_Media + * @see WP_Widget + */ + class WP_Widget_Media_Audio extends \WP_Widget_Media + { + /** + * Constructor. + * + * @since 4.8.0 + */ + public function __construct() + { + } + /** + * Get schema for properties of a widget instance (item). + * + * @since 4.8.0 + * + * @see WP_REST_Controller::get_item_schema() + * @see WP_REST_Controller::get_additional_fields() + * @link https://core.trac.wordpress.org/ticket/35574 + * + * @return array Schema for properties. + */ + public function get_instance_schema() + { + } + /** + * Render the media on the frontend. + * + * @since 4.8.0 + * + * @param array $instance Widget instance props. + */ + public function render_media($instance) + { + } + /** + * Enqueue preview scripts. + * + * These scripts normally are enqueued just-in-time when an audio shortcode is used. + * In the customizer, however, widgets can be dynamically added and rendered via + * selective refresh, and so it is important to unconditionally enqueue them in + * case a widget does get added. + * + * @since 4.8.0 + */ + public function enqueue_preview_scripts() + { + } + /** + * Loads the required media files for the media manager and scripts for media widgets. + * + * @since 4.8.0 + */ + public function enqueue_admin_scripts() + { + } + /** + * Render form template scripts. + * + * @since 4.8.0 + */ + public function render_control_template_scripts() + { + } + } + /** + * Widget API: WP_Widget_Media_Gallery class + * + * @package WordPress + * @subpackage Widgets + * @since 4.9.0 + */ + /** + * Core class that implements a gallery widget. + * + * @since 4.9.0 + * + * @see WP_Widget_Media + * @see WP_Widget + */ + class WP_Widget_Media_Gallery extends \WP_Widget_Media + { + /** + * Constructor. + * + * @since 4.9.0 + */ + public function __construct() + { + } + /** + * Get schema for properties of a widget instance (item). + * + * @since 4.9.0 + * + * @see WP_REST_Controller::get_item_schema() + * @see WP_REST_Controller::get_additional_fields() + * @link https://core.trac.wordpress.org/ticket/35574 + * + * @return array Schema for properties. + */ + public function get_instance_schema() + { + } + /** + * Render the media on the frontend. + * + * @since 4.9.0 + * + * @param array $instance Widget instance props. + */ + public function render_media($instance) + { + } + /** + * Loads the required media files for the media manager and scripts for media widgets. + * + * @since 4.9.0 + */ + public function enqueue_admin_scripts() + { + } + /** + * Render form template scripts. + * + * @since 4.9.0 + */ + public function render_control_template_scripts() + { + } + /** + * Whether the widget has content to show. + * + * @since 4.9.0 + * @access protected + * + * @param array $instance Widget instance props. + * @return bool Whether widget has content. + */ + protected function has_content($instance) + { + } + } + /** + * Widget API: WP_Widget_Media_Image class + * + * @package WordPress + * @subpackage Widgets + * @since 4.8.0 + */ + /** + * Core class that implements an image widget. + * + * @since 4.8.0 + * + * @see WP_Widget_Media + * @see WP_Widget + */ + class WP_Widget_Media_Image extends \WP_Widget_Media + { + /** + * Constructor. + * + * @since 4.8.0 + */ + public function __construct() + { + } + /** + * Get schema for properties of a widget instance (item). + * + * @since 4.8.0 + * + * @see WP_REST_Controller::get_item_schema() + * @see WP_REST_Controller::get_additional_fields() + * @link https://core.trac.wordpress.org/ticket/35574 + * + * @return array Schema for properties. + */ + public function get_instance_schema() + { + } + /** + * Render the media on the frontend. + * + * @since 4.8.0 + * + * @param array $instance Widget instance props. + * @phpstan-return void + */ + public function render_media($instance) + { + } + /** + * Loads the required media files for the media manager and scripts for media widgets. + * + * @since 4.8.0 + */ + public function enqueue_admin_scripts() + { + } + /** + * Render form template scripts. + * + * @since 4.8.0 + */ + public function render_control_template_scripts() + { + } + } + /** + * Widget API: WP_Widget_Media_Video class + * + * @package WordPress + * @subpackage Widgets + * @since 4.8.0 + */ + /** + * Core class that implements a video widget. + * + * @since 4.8.0 + * + * @see WP_Widget_Media + * @see WP_Widget + */ + class WP_Widget_Media_Video extends \WP_Widget_Media + { + /** + * Constructor. + * + * @since 4.8.0 + */ + public function __construct() + { + } + /** + * Get schema for properties of a widget instance (item). + * + * @since 4.8.0 + * + * @see WP_REST_Controller::get_item_schema() + * @see WP_REST_Controller::get_additional_fields() + * @link https://core.trac.wordpress.org/ticket/35574 + * + * @return array Schema for properties. + */ + public function get_instance_schema() + { + } + /** + * Render the media on the frontend. + * + * @since 4.8.0 + * + * @param array $instance Widget instance props. + * @phpstan-return void + */ + public function render_media($instance) + { + } + /** + * Inject max-width and remove height for videos too constrained to fit inside sidebars on frontend. + * + * @since 4.8.0 + * + * @param string $html Video shortcode HTML output. + * @return string HTML Output. + */ + public function inject_video_max_width_style($html) + { + } + /** + * Enqueue preview scripts. + * + * These scripts normally are enqueued just-in-time when a video shortcode is used. + * In the customizer, however, widgets can be dynamically added and rendered via + * selective refresh, and so it is important to unconditionally enqueue them in + * case a widget does get added. + * + * @since 4.8.0 + */ + public function enqueue_preview_scripts() + { + } + /** + * Loads the required scripts and styles for the widget control. + * + * @since 4.8.0 + */ + public function enqueue_admin_scripts() + { + } + /** + * Render form template scripts. + * + * @since 4.8.0 + */ + public function render_control_template_scripts() + { + } + } + /** + * Widget API: WP_Widget_Meta class + * + * @package WordPress + * @subpackage Widgets + * @since 4.4.0 + */ + /** + * Core class used to implement a Meta widget. + * + * Displays log in/out, RSS feed links, etc. + * + * @since 2.8.0 + * + * @see WP_Widget + */ + class WP_Widget_Meta extends \WP_Widget + { + /** + * Sets up a new Meta widget instance. + * + * @since 2.8.0 + */ + public function __construct() + { + } + /** + * Outputs the content for the current Meta widget instance. + * + * @since 2.8.0 + * + * @param array $args Display arguments including 'before_title', 'after_title', + * 'before_widget', and 'after_widget'. + * @param array $instance Settings for the current Meta widget instance. + */ + public function widget($args, $instance) + { + } + /** + * Handles updating settings for the current Meta widget instance. + * + * @since 2.8.0 + * + * @param array $new_instance New settings for this instance as input by the user via + * WP_Widget::form(). + * @param array $old_instance Old settings for this instance. + * @return array Updated settings to save. + */ + public function update($new_instance, $old_instance) + { + } + /** + * Outputs the settings form for the Meta widget. + * + * @since 2.8.0 + * + * @param array $instance Current settings. + */ + public function form($instance) + { + } + } + /** + * Widget API: WP_Widget_Pages class + * + * @package WordPress + * @subpackage Widgets + * @since 4.4.0 + */ + /** + * Core class used to implement a Pages widget. + * + * @since 2.8.0 + * + * @see WP_Widget + */ + class WP_Widget_Pages extends \WP_Widget + { + /** + * Sets up a new Pages widget instance. + * + * @since 2.8.0 + */ + public function __construct() + { + } + /** + * Outputs the content for the current Pages widget instance. + * + * @since 2.8.0 + * + * @param array $args Display arguments including 'before_title', 'after_title', + * 'before_widget', and 'after_widget'. + * @param array $instance Settings for the current Pages widget instance. + */ + public function widget($args, $instance) + { + } + /** + * Handles updating settings for the current Pages widget instance. + * + * @since 2.8.0 + * + * @param array $new_instance New settings for this instance as input by the user via + * WP_Widget::form(). + * @param array $old_instance Old settings for this instance. + * @return array Updated settings to save. + */ + public function update($new_instance, $old_instance) + { + } + /** + * Outputs the settings form for the Pages widget. + * + * @since 2.8.0 + * + * @param array $instance Current settings. + */ + public function form($instance) + { + } + } + /** + * Widget API: WP_Widget_Recent_Comments class + * + * @package WordPress + * @subpackage Widgets + * @since 4.4.0 + */ + /** + * Core class used to implement a Recent Comments widget. + * + * @since 2.8.0 + * + * @see WP_Widget + */ + class WP_Widget_Recent_Comments extends \WP_Widget + { + /** + * Sets up a new Recent Comments widget instance. + * + * @since 2.8.0 + */ + public function __construct() + { + } + /** + * Outputs the default styles for the Recent Comments widget. + * + * @since 2.8.0 + * @phpstan-return void + */ + public function recent_comments_style() + { + } + /** + * Outputs the content for the current Recent Comments widget instance. + * + * @since 2.8.0 + * @since 5.4.0 Creates a unique HTML ID for the `<ul>` element + * if more than one instance is displayed on the page. + * + * @param array $args Display arguments including 'before_title', 'after_title', + * 'before_widget', and 'after_widget'. + * @param array $instance Settings for the current Recent Comments widget instance. + */ + public function widget($args, $instance) + { + } + /** + * Handles updating settings for the current Recent Comments widget instance. + * + * @since 2.8.0 + * + * @param array $new_instance New settings for this instance as input by the user via + * WP_Widget::form(). + * @param array $old_instance Old settings for this instance. + * @return array Updated settings to save. + */ + public function update($new_instance, $old_instance) + { + } + /** + * Outputs the settings form for the Recent Comments widget. + * + * @since 2.8.0 + * + * @param array $instance Current settings. + */ + public function form($instance) + { + } + /** + * Flushes the Recent Comments widget cache. + * + * @since 2.8.0 + * + * @deprecated 4.4.0 Fragment caching was removed in favor of split queries. + */ + public function flush_widget_cache() + { + } + } + /** + * Widget API: WP_Widget_Recent_Posts class + * + * @package WordPress + * @subpackage Widgets + * @since 4.4.0 + */ + /** + * Core class used to implement a Recent Posts widget. + * + * @since 2.8.0 + * + * @see WP_Widget + */ + class WP_Widget_Recent_Posts extends \WP_Widget + { + /** + * Sets up a new Recent Posts widget instance. + * + * @since 2.8.0 + */ + public function __construct() + { + } + /** + * Outputs the content for the current Recent Posts widget instance. + * + * @since 2.8.0 + * + * @param array $args Display arguments including 'before_title', 'after_title', + * 'before_widget', and 'after_widget'. + * @param array $instance Settings for the current Recent Posts widget instance. + * @phpstan-return void + */ + public function widget($args, $instance) + { + } + /** + * Handles updating the settings for the current Recent Posts widget instance. + * + * @since 2.8.0 + * + * @param array $new_instance New settings for this instance as input by the user via + * WP_Widget::form(). + * @param array $old_instance Old settings for this instance. + * @return array Updated settings to save. + */ + public function update($new_instance, $old_instance) + { + } + /** + * Outputs the settings form for the Recent Posts widget. + * + * @since 2.8.0 + * + * @param array $instance Current settings. + */ + public function form($instance) + { + } + } + /** + * Widget API: WP_Widget_RSS class + * + * @package WordPress + * @subpackage Widgets + * @since 4.4.0 + */ + /** + * Core class used to implement a RSS widget. + * + * @since 2.8.0 + * + * @see WP_Widget + */ + class WP_Widget_RSS extends \WP_Widget + { + /** + * Sets up a new RSS widget instance. + * + * @since 2.8.0 + */ + public function __construct() + { + } + /** + * Outputs the content for the current RSS widget instance. + * + * @since 2.8.0 + * + * @param array $args Display arguments including 'before_title', 'after_title', + * 'before_widget', and 'after_widget'. + * @param array $instance Settings for the current RSS widget instance. + * @phpstan-return void + */ + public function widget($args, $instance) + { + } + /** + * Handles updating settings for the current RSS widget instance. + * + * @since 2.8.0 + * + * @param array $new_instance New settings for this instance as input by the user via + * WP_Widget::form(). + * @param array $old_instance Old settings for this instance. + * @return array Updated settings to save. + */ + public function update($new_instance, $old_instance) + { + } + /** + * Outputs the settings form for the RSS widget. + * + * @since 2.8.0 + * + * @param array $instance Current settings. + */ + public function form($instance) + { + } + } + /** + * Widget API: WP_Widget_Search class + * + * @package WordPress + * @subpackage Widgets + * @since 4.4.0 + */ + /** + * Core class used to implement a Search widget. + * + * @since 2.8.0 + * + * @see WP_Widget + */ + class WP_Widget_Search extends \WP_Widget + { + /** + * Sets up a new Search widget instance. + * + * @since 2.8.0 + */ + public function __construct() + { + } + /** + * Outputs the content for the current Search widget instance. + * + * @since 2.8.0 + * + * @param array $args Display arguments including 'before_title', 'after_title', + * 'before_widget', and 'after_widget'. + * @param array $instance Settings for the current Search widget instance. + */ + public function widget($args, $instance) + { + } + /** + * Outputs the settings form for the Search widget. + * + * @since 2.8.0 + * + * @param array $instance Current settings. + */ + public function form($instance) + { + } + /** + * Handles updating settings for the current Search widget instance. + * + * @since 2.8.0 + * + * @param array $new_instance New settings for this instance as input by the user via + * WP_Widget::form(). + * @param array $old_instance Old settings for this instance. + * @return array Updated settings. + */ + public function update($new_instance, $old_instance) + { + } + } + /** + * Widget API: WP_Widget_Tag_Cloud class + * + * @package WordPress + * @subpackage Widgets + * @since 4.4.0 + */ + /** + * Core class used to implement a Tag cloud widget. + * + * @since 2.8.0 + * + * @see WP_Widget + */ + class WP_Widget_Tag_Cloud extends \WP_Widget + { + /** + * Sets up a new Tag Cloud widget instance. + * + * @since 2.8.0 + */ + public function __construct() + { + } + /** + * Outputs the content for the current Tag Cloud widget instance. + * + * @since 2.8.0 + * + * @param array $args Display arguments including 'before_title', 'after_title', + * 'before_widget', and 'after_widget'. + * @param array $instance Settings for the current Tag Cloud widget instance. + * @phpstan-return void + */ + public function widget($args, $instance) + { + } + /** + * Handles updating settings for the current Tag Cloud widget instance. + * + * @since 2.8.0 + * + * @param array $new_instance New settings for this instance as input by the user via + * WP_Widget::form(). + * @param array $old_instance Old settings for this instance. + * @return array Settings to save or bool false to cancel saving. + */ + public function update($new_instance, $old_instance) + { + } + /** + * Outputs the Tag Cloud widget settings form. + * + * @since 2.8.0 + * + * @param array $instance Current settings. + */ + public function form($instance) + { + } + /** + * Retrieves the taxonomy for the current Tag cloud widget instance. + * + * @since 4.4.0 + * + * @param array $instance Current settings. + * @return string Name of the current taxonomy if set, otherwise 'post_tag'. + */ + public function _get_current_taxonomy($instance) + { + } + } + /** + * Widget API: WP_Widget_Text class + * + * @package WordPress + * @subpackage Widgets + * @since 4.4.0 + */ + /** + * Core class used to implement a Text widget. + * + * @since 2.8.0 + * + * @see WP_Widget + */ + class WP_Widget_Text extends \WP_Widget + { + /** + * Whether or not the widget has been registered yet. + * + * @since 4.8.1 + * @var bool + */ + protected $registered = \false; + /** + * Sets up a new Text widget instance. + * + * @since 2.8.0 + */ + public function __construct() + { + } + /** + * Adds hooks for enqueueing assets when registering all widget instances of this widget class. + * + * @param int $number Optional. The unique order number of this widget instance + * compared to other instances of the same class. Default -1. + * @phpstan-return void + */ + public function _register_one($number = -1) + { + } + /** + * Determines whether a given instance is legacy and should bypass using TinyMCE. + * + * @since 4.8.1 + * + * @param array $instance { + * Instance data. + * + * @type string $text Content. + * @type bool|string $filter Whether autop or content filters should apply. + * @type bool $legacy Whether widget is in legacy mode. + * } + * @return bool Whether Text widget instance contains legacy data. + * @phpstan-param array{ + * text?: string, + * filter?: bool|string, + * legacy?: bool, + * } $instance + */ + public function is_legacy_instance($instance) + { + } + /** + * Filters gallery shortcode attributes. + * + * Prevents all of a site's attachments from being shown in a gallery displayed on a + * non-singular template where a $post context is not available. + * + * @since 4.9.0 + * + * @param array $attrs Attributes. + * @return array Attributes. + */ + public function _filter_gallery_shortcode_attrs($attrs) + { + } + /** + * Outputs the content for the current Text widget instance. + * + * @since 2.8.0 + * + * @global WP_Post $post Global post object. + * + * @param array $args Display arguments including 'before_title', 'after_title', + * 'before_widget', and 'after_widget'. + * @param array $instance Settings for the current Text widget instance. + */ + public function widget($args, $instance) + { + } + /** + * Injects max-width and removes height for videos too constrained to fit inside sidebars on frontend. + * + * @since 4.9.0 + * + * @see WP_Widget_Media_Video::inject_video_max_width_style() + * + * @param array $matches Pattern matches from preg_replace_callback. + * @return string HTML Output. + */ + public function inject_video_max_width_style($matches) + { + } + /** + * Handles updating settings for the current Text widget instance. + * + * @since 2.8.0 + * + * @param array $new_instance New settings for this instance as input by the user via + * WP_Widget::form(). + * @param array $old_instance Old settings for this instance. + * @return array Settings to save or bool false to cancel saving. + */ + public function update($new_instance, $old_instance) + { + } + /** + * Enqueues preview scripts. + * + * These scripts normally are enqueued just-in-time when a playlist shortcode is used. + * However, in the customizer, a playlist shortcode may be used in a text widget and + * dynamically added via selective refresh, so it is important to unconditionally enqueue them. + * + * @since 4.9.3 + */ + public function enqueue_preview_scripts() + { + } + /** + * Loads the required scripts and styles for the widget control. + * + * @since 4.8.0 + */ + public function enqueue_admin_scripts() + { + } + /** + * Outputs the Text widget settings form. + * + * @since 2.8.0 + * @since 4.8.0 Form only contains hidden inputs which are synced with JS template. + * @since 4.8.1 Restored original form to be displayed when in legacy mode. + * + * @see WP_Widget_Text::render_control_template_scripts() + * @see _WP_Editors::editor() + * + * @param array $instance Current settings. + */ + public function form($instance) + { + } + /** + * Renders form template scripts. + * + * @since 4.8.0 + * @since 4.9.0 The method is now static. + */ + public static function render_control_template_scripts() + { + } + } +} +/** + * Copyright (c) 2021, Alliance for Open Media. All rights reserved + * + * This source code is subject to the terms of the BSD 2 Clause License and + * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License + * was not distributed with this source code in the LICENSE file, you can + * obtain it at www.aomedia.org/license/software. If the Alliance for Open + * Media Patent License 1.0 was not distributed with this source code in the + * PATENTS file, you can obtain it at www.aomedia.org/license/patent. + * + * Note: this class is from libavifinfo - https://aomedia.googlesource.com/libavifinfo/+/refs/heads/main/avifinfo.php at f509487. + * It is used as a fallback to parse AVIF files when the server doesn't support AVIF, + * primarily to identify the width and height of the image. + * + * Note PHP 8.2 added native support for AVIF, so this class can be removed when WordPress requires PHP 8.2. + */ +namespace Avifinfo { + // Value was not yet parsed. + /** + * Reads an unsigned integer with most significant bits first. + * + * @param binary string $input Must be at least $num_bytes-long. + * @param int $num_bytes Number of parsed bytes. + * @return int Value. + */ + function read_big_endian($input, $num_bytes) + { + } + /** + * Reads bytes and advances the stream position by the same count. + * + * @param stream $handle Bytes will be read from this resource. + * @param int $num_bytes Number of bytes read. Must be greater than 0. + * @return binary string|false The raw bytes or false on failure. + */ + function read($handle, $num_bytes) + { + } + /** + * Advances the stream position by the given offset. + * + * @param stream $handle Bytes will be skipped from this resource. + * @param int $num_bytes Number of skipped bytes. Can be 0. + * @return bool True on success or false on failure. + */ + // Skips 'num_bytes' from the 'stream'. 'num_bytes' can be zero. + function skip($handle, $num_bytes) + { + } +} +namespace { + /** + * Adds an action hook specific to this page. + * + * Fires on {@see 'wp_head'}. + * + * @since MU (3.0.0) + */ + function do_activate_header() + { + } + /** + * Loads styles specific to this page. + * + * @since MU (3.0.0) + */ + function wpmu_activate_stylesheet() + { + } + /** + * Display JavaScript on the page. + * + * @since 3.5.0 + */ + function export_add_js() + { + } + /** + * Creates the date options fields for exporting a given post type. + * + * @since 3.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * @global WP_Locale $wp_locale WordPress date and time locale object. + * + * @param string $post_type The post type. Default 'post'. + * @phpstan-return void + */ + function export_date_options($post_type = 'post') + { + } + /** + * Administration API: Core Ajax handlers + * + * @package WordPress + * @subpackage Administration + * @since 2.1.0 + */ + // + // No-privilege Ajax handlers. + // + /** + * Handles the Heartbeat API in the no-privilege context via AJAX . + * + * Runs when the user is not logged in. + * + * @since 3.6.0 + * @phpstan-return never + */ + function wp_ajax_nopriv_heartbeat() + { + } + // + // GET-based Ajax handlers. + // + /** + * Handles fetching a list table via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_fetch_list() + { + } + /** + * Handles tag search via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_ajax_tag_search() + { + } + /** + * Handles compression testing via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_wp_compression_test() + { + } + /** + * Handles image editor previews via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_imgedit_preview() + { + } + /** + * Handles oEmbed caching via AJAX. + * + * @since 3.1.0 + * + * @global WP_Embed $wp_embed WordPress Embed object. + * @phpstan-return never + */ + function wp_ajax_oembed_cache() + { + } + /** + * Handles user autocomplete via AJAX. + * + * @since 3.4.0 + * @phpstan-return never + */ + function wp_ajax_autocomplete_user() + { + } + /** + * Handles Ajax requests for community events + * + * @since 4.8.0 + */ + function wp_ajax_get_community_events() + { + } + /** + * Handles dashboard widgets via AJAX. + * + * @since 3.4.0 + * @phpstan-return never + */ + function wp_ajax_dashboard_widgets() + { + } + /** + * Handles Customizer preview logged-in status via AJAX. + * + * @since 3.4.0 + * @phpstan-return never + */ + function wp_ajax_logged_in() + { + } + // + // Ajax helpers. + // + /** + * Sends back current comment total and new page links if they need to be updated. + * + * Contrary to normal success Ajax response ("1"), die with time() on success. + * + * @since 2.7.0 + * @access private + * + * @param int $comment_id + * @param int $delta + */ + function _wp_ajax_delete_comment_response($comment_id, $delta = -1) + { + } + // + // POST-based Ajax handlers. + // + /** + * Handles adding a hierarchical term via AJAX. + * + * @since 3.1.0 + * @access private + */ + function _wp_ajax_add_hierarchical_term() + { + } + /** + * Handles deleting a comment via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_delete_comment() + { + } + /** + * Handles deleting a tag via AJAX. + * + * @since 3.1.0 + */ + function wp_ajax_delete_tag() + { + } + /** + * Handles deleting a link via AJAX. + * + * @since 3.1.0 + */ + function wp_ajax_delete_link() + { + } + /** + * Handles deleting meta via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_delete_meta() + { + } + /** + * Handles deleting a post via AJAX. + * + * @since 3.1.0 + * + * @param string $action Action to perform. + */ + function wp_ajax_delete_post($action) + { + } + /** + * Handles sending a post to the Trash via AJAX. + * + * @since 3.1.0 + * + * @param string $action Action to perform. + * @phpstan-return never + */ + function wp_ajax_trash_post($action) + { + } + /** + * Handles restoring a post from the Trash via AJAX. + * + * @since 3.1.0 + * + * @param string $action Action to perform. + */ + function wp_ajax_untrash_post($action) + { + } + /** + * Handles deleting a page via AJAX. + * + * @since 3.1.0 + * + * @param string $action Action to perform. + */ + function wp_ajax_delete_page($action) + { + } + /** + * Handles dimming a comment via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_dim_comment() + { + } + /** + * Handles adding a link category via AJAX. + * + * @since 3.1.0 + * + * @param string $action Action to perform. + */ + function wp_ajax_add_link_category($action) + { + } + /** + * Handles adding a tag via AJAX. + * + * @since 3.1.0 + */ + function wp_ajax_add_tag() + { + } + /** + * Handles getting a tagcloud via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_get_tagcloud() + { + } + /** + * Handles getting comments via AJAX. + * + * @since 3.1.0 + * + * @global int $post_id + * + * @param string $action Action to perform. + */ + function wp_ajax_get_comments($action) + { + } + /** + * Handles replying to a comment via AJAX. + * + * @since 3.1.0 + * + * @param string $action Action to perform. + */ + function wp_ajax_replyto_comment($action) + { + } + /** + * Handles editing a comment via AJAX. + * + * @since 3.1.0 + */ + function wp_ajax_edit_comment() + { + } + /** + * Handles adding a menu item via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_add_menu_item() + { + } + /** + * Handles adding meta via AJAX. + * + * @since 3.1.0 + */ + function wp_ajax_add_meta() + { + } + /** + * Handles adding a user via AJAX. + * + * @since 3.1.0 + * + * @param string $action Action to perform. + */ + function wp_ajax_add_user($action) + { + } + /** + * Handles closed post boxes via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_closed_postboxes() + { + } + /** + * Handles hidden columns via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_hidden_columns() + { + } + /** + * Handles updating whether to display the welcome panel via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_update_welcome_panel() + { + } + /** + * Handles for retrieving menu meta boxes via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_menu_get_metabox() + { + } + /** + * Handles internal linking via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_wp_link_ajax() + { + } + /** + * Handles saving menu locations via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_menu_locations_save() + { + } + /** + * Handles saving the meta box order via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_meta_box_order() + { + } + /** + * Handles menu quick searching via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_menu_quick_search() + { + } + /** + * Handles retrieving a permalink via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_get_permalink() + { + } + /** + * Handles retrieving a sample permalink via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_sample_permalink() + { + } + /** + * Handles Quick Edit saving a post from a list table via AJAX. + * + * @since 3.1.0 + * + * @global string $mode List table view mode. + * @phpstan-return never + */ + function wp_ajax_inline_save() + { + } + /** + * Handles Quick Edit saving for a term via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_inline_save_tax() + { + } + /** + * Handles querying posts for the Find Posts modal via AJAX. + * + * @see window.findPosts + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_find_posts() + { + } + /** + * Handles saving the widgets order via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_widgets_order() + { + } + /** + * Handles saving a widget via AJAX. + * + * @since 3.1.0 + * + * @global array $wp_registered_widgets + * @global array $wp_registered_widget_controls + * @global array $wp_registered_widget_updates + * @phpstan-return never + */ + function wp_ajax_save_widget() + { + } + /** + * Handles updating a widget via AJAX. + * + * @since 3.9.0 + * + * @global WP_Customize_Manager $wp_customize + */ + function wp_ajax_update_widget() + { + } + /** + * Handles removing inactive widgets via AJAX. + * + * @since 4.4.0 + * @phpstan-return never + */ + function wp_ajax_delete_inactive_widgets() + { + } + /** + * Handles creating missing image sub-sizes for just uploaded images via AJAX. + * + * @since 5.3.0 + * @phpstan-return never + */ + function wp_ajax_media_create_image_subsizes() + { + } + /** + * Handles uploading attachments via AJAX. + * + * @since 3.3.0 + * @phpstan-return never + */ + function wp_ajax_upload_attachment() + { + } + /** + * Handles image editing via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_image_editor() + { + } + /** + * Handles setting the featured image via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_set_post_thumbnail() + { + } + /** + * Handles retrieving HTML for the featured image via AJAX. + * + * @since 4.6.0 + * @phpstan-return never + */ + function wp_ajax_get_post_thumbnail_html() + { + } + /** + * Handles setting the featured image for an attachment via AJAX. + * + * @since 4.0.0 + * + * @see set_post_thumbnail() + * @phpstan-return never + */ + function wp_ajax_set_attachment_thumbnail() + { + } + /** + * Handles formatting a date via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_date_format() + { + } + /** + * Handles formatting a time via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_time_format() + { + } + /** + * Handles saving posts from the fullscreen editor via AJAX. + * + * @since 3.1.0 + * @deprecated 4.3.0 + * @phpstan-return never + */ + function wp_ajax_wp_fullscreen_save_post() + { + } + /** + * Handles removing a post lock via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_wp_remove_post_lock() + { + } + /** + * Handles dismissing a WordPress pointer via AJAX. + * + * @since 3.1.0 + * @phpstan-return never + */ + function wp_ajax_dismiss_wp_pointer() + { + } + /** + * Handles getting an attachment via AJAX. + * + * @since 3.5.0 + * @phpstan-return never + */ + function wp_ajax_get_attachment() + { + } + /** + * Handles querying attachments via AJAX. + * + * @since 3.5.0 + * @phpstan-return never + */ + function wp_ajax_query_attachments() + { + } + /** + * Handles updating attachment attributes via AJAX. + * + * @since 3.5.0 + * @phpstan-return never + */ + function wp_ajax_save_attachment() + { + } + /** + * Handles saving backward compatible attachment attributes via AJAX. + * + * @since 3.5.0 + * @phpstan-return never + */ + function wp_ajax_save_attachment_compat() + { + } + /** + * Handles saving the attachment order via AJAX. + * + * @since 3.5.0 + * @phpstan-return never + */ + function wp_ajax_save_attachment_order() + { + } + /** + * Handles sending an attachment to the editor via AJAX. + * + * Generates the HTML to send an attachment to the editor. + * Backward compatible with the {@see 'media_send_to_editor'} filter + * and the chain of filters that follow. + * + * @since 3.5.0 + * @phpstan-return never + */ + function wp_ajax_send_attachment_to_editor() + { + } + /** + * Handles sending a link to the editor via AJAX. + * + * Generates the HTML to send a non-image embed link to the editor. + * + * Backward compatible with the following filters: + * - file_send_to_editor_url + * - audio_send_to_editor_url + * - video_send_to_editor_url + * + * @since 3.5.0 + * + * @global WP_Post $post Global post object. + * @global WP_Embed $wp_embed WordPress Embed object. + * @phpstan-return never + */ + function wp_ajax_send_link_to_editor() + { + } + /** + * Handles the Heartbeat API via AJAX. + * + * Runs when the user is logged in. + * + * @since 3.6.0 + * @phpstan-return never + */ + function wp_ajax_heartbeat() + { + } + /** + * Handles getting revision diffs via AJAX. + * + * @since 3.6.0 + * @phpstan-return never + */ + function wp_ajax_get_revision_diffs() + { + } + /** + * Handles auto-saving the selected color scheme for + * a user's own profile via AJAX. + * + * @since 3.8.0 + * + * @global array $_wp_admin_css_colors + * @phpstan-return never + */ + function wp_ajax_save_user_color_scheme() + { + } + /** + * Handles getting themes from themes_api() via AJAX. + * + * @since 3.9.0 + * + * @global array $themes_allowedtags + * @global array $theme_field_defaults + * @phpstan-return never + */ + function wp_ajax_query_themes() + { + } + /** + * Applies [embed] Ajax handlers to a string. + * + * @since 4.0.0 + * + * @global WP_Post $post Global post object. + * @global WP_Embed $wp_embed WordPress Embed object. + * @global WP_Scripts $wp_scripts + * @global int $content_width + * @phpstan-return never + */ + function wp_ajax_parse_embed() + { + } + /** + * @since 4.0.0 + * + * @global WP_Post $post Global post object. + * @global WP_Scripts $wp_scripts + * @phpstan-return never + */ + function wp_ajax_parse_media_shortcode() + { + } + /** + * Handles destroying multiple open sessions for a user via AJAX. + * + * @since 4.1.0 + * @phpstan-return never + */ + function wp_ajax_destroy_sessions() + { + } + /** + * Handles cropping an image via AJAX. + * + * @since 4.3.0 + * @phpstan-return never + */ + function wp_ajax_crop_image() + { + } + /** + * Handles generating a password via AJAX. + * + * @since 4.4.0 + * @phpstan-return never + */ + function wp_ajax_generate_password() + { + } + /** + * Handles generating a password in the no-privilege context via AJAX. + * + * @since 5.7.0 + * @phpstan-return never + */ + function wp_ajax_nopriv_generate_password() + { + } + /** + * Handles saving the user's WordPress.org username via AJAX. + * + * @since 4.4.0 + * @phpstan-return never + */ + function wp_ajax_save_wporg_username() + { + } + /** + * Handles installing a theme via AJAX. + * + * @since 4.6.0 + * + * @see Theme_Upgrader + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * @phpstan-return never + */ + function wp_ajax_install_theme() + { + } + /** + * Handles updating a theme via AJAX. + * + * @since 4.6.0 + * + * @see Theme_Upgrader + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * @phpstan-return never + */ + function wp_ajax_update_theme() + { + } + /** + * Handles deleting a theme via AJAX. + * + * @since 4.6.0 + * + * @see delete_theme() + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * @phpstan-return never + */ + function wp_ajax_delete_theme() + { + } + /** + * Handles installing a plugin via AJAX. + * + * @since 4.6.0 + * + * @see Plugin_Upgrader + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * @phpstan-return never + */ + function wp_ajax_install_plugin() + { + } + /** + * Handles activating a plugin via AJAX. + * + * @since 6.5.0 + * @phpstan-return never + */ + function wp_ajax_activate_plugin() + { + } + /** + * Handles updating a plugin via AJAX. + * + * @since 4.2.0 + * + * @see Plugin_Upgrader + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * @phpstan-return never + */ + function wp_ajax_update_plugin() + { + } + /** + * Handles deleting a plugin via AJAX. + * + * @since 4.6.0 + * + * @see delete_plugins() + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * @phpstan-return never + */ + function wp_ajax_delete_plugin() + { + } + /** + * Handles searching plugins via AJAX. + * + * @since 4.6.0 + * + * @global string $s Search term. + * @phpstan-return never + */ + function wp_ajax_search_plugins() + { + } + /** + * Handles searching plugins to install via AJAX. + * + * @since 4.6.0 + * @phpstan-return never + */ + function wp_ajax_search_install_plugins() + { + } + /** + * Handles editing a theme or plugin file via AJAX. + * + * @since 4.9.0 + * + * @see wp_edit_theme_plugin_file() + */ + function wp_ajax_edit_theme_plugin_file() + { + } + /** + * Handles exporting a user's personal data via AJAX. + * + * @since 4.9.6 + * @phpstan-return never + */ + function wp_ajax_wp_privacy_export_personal_data() + { + } + /** + * Handles erasing personal data via AJAX. + * + * @since 4.9.6 + * @phpstan-return never + */ + function wp_ajax_wp_privacy_erase_personal_data() + { + } + /** + * Handles site health checks on server communication via AJAX. + * + * @since 5.2.0 + * @deprecated 5.6.0 Use WP_REST_Site_Health_Controller::test_dotorg_communication() + * @see WP_REST_Site_Health_Controller::test_dotorg_communication() + * @phpstan-return never + */ + function wp_ajax_health_check_dotorg_communication() + { + } + /** + * Handles site health checks on background updates via AJAX. + * + * @since 5.2.0 + * @deprecated 5.6.0 Use WP_REST_Site_Health_Controller::test_background_updates() + * @see WP_REST_Site_Health_Controller::test_background_updates() + * @phpstan-return never + */ + function wp_ajax_health_check_background_updates() + { + } + /** + * Handles site health checks on loopback requests via AJAX. + * + * @since 5.2.0 + * @deprecated 5.6.0 Use WP_REST_Site_Health_Controller::test_loopback_requests() + * @see WP_REST_Site_Health_Controller::test_loopback_requests() + * @phpstan-return never + */ + function wp_ajax_health_check_loopback_requests() + { + } + /** + * Handles site health check to update the result status via AJAX. + * + * @since 5.2.0 + * @phpstan-return never + */ + function wp_ajax_health_check_site_status_result() + { + } + /** + * Handles site health check to get directories and database sizes via AJAX. + * + * @since 5.2.0 + * @deprecated 5.6.0 Use WP_REST_Site_Health_Controller::get_directory_sizes() + * @see WP_REST_Site_Health_Controller::get_directory_sizes() + * @phpstan-return never + */ + function wp_ajax_health_check_get_sizes() + { + } + /** + * Handles renewing the REST API nonce via AJAX. + * + * @since 5.3.0 + * @phpstan-return never + */ + function wp_ajax_rest_nonce() + { + } + /** + * Handles enabling or disable plugin and theme auto-updates via AJAX. + * + * @since 5.5.0 + * @phpstan-return never + */ + function wp_ajax_toggle_auto_updates() + { + } + /** + * Handles sending a password reset link via AJAX. + * + * @since 5.7.0 + */ + function wp_ajax_send_password_reset() + { + } + /** + * WordPress Bookmark Administration API + * + * @package WordPress + * @subpackage Administration + */ + /** + * Adds a link using values provided in $_POST. + * + * @since 2.0.0 + * + * @return int|WP_Error Value 0 or WP_Error on failure. The link ID on success. + */ + function add_link() + { + } + /** + * Updates or inserts a link using values provided in $_POST. + * + * @since 2.0.0 + * + * @param int $link_id Optional. ID of the link to edit. Default 0. + * @return int|WP_Error Value 0 or WP_Error on failure. The link ID on success. + */ + function edit_link($link_id = 0) + { + } + /** + * Retrieves the default link for editing. + * + * @since 2.0.0 + * + * @return stdClass Default link object. + */ + function get_default_link_to_edit() + { + } + /** + * Deletes a specified link from the database. + * + * @since 2.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $link_id ID of the link to delete. + * @return true Always true. + */ + function wp_delete_link($link_id) + { + } + /** + * Retrieves the link category IDs associated with the link specified. + * + * @since 2.1.0 + * + * @param int $link_id Link ID to look up. + * @return int[] The IDs of the requested link's categories. + */ + function wp_get_link_cats($link_id = 0) + { + } + /** + * Retrieves link data based on its ID. + * + * @since 2.0.0 + * + * @param int|stdClass $link Link ID or object to retrieve. + * @return object Link object for editing. + */ + function get_link_to_edit($link) + { + } + /** + * Inserts a link into the database, or updates an existing link. + * + * Runs all the necessary sanitizing, provides default values if arguments are missing, + * and finally saves the link. + * + * @since 2.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array $linkdata { + * Elements that make up the link to insert. + * + * @type int $link_id Optional. The ID of the existing link if updating. + * @type string $link_url The URL the link points to. + * @type string $link_name The title of the link. + * @type string $link_image Optional. A URL of an image. + * @type string $link_target Optional. The target element for the anchor tag. + * @type string $link_description Optional. A short description of the link. + * @type string $link_visible Optional. 'Y' means visible, anything else means not. + * @type int $link_owner Optional. A user ID. + * @type int $link_rating Optional. A rating for the link. + * @type string $link_rel Optional. A relationship of the link to you. + * @type string $link_notes Optional. An extended description of or notes on the link. + * @type string $link_rss Optional. A URL of an associated RSS feed. + * @type int $link_category Optional. The term ID of the link category. + * If empty, uses default link category. + * } + * @param bool $wp_error Optional. Whether to return a WP_Error object on failure. Default false. + * @return int|WP_Error Value 0 or WP_Error on failure. The link ID on success. + * @phpstan-param array{ + * link_id?: int, + * link_url?: string, + * link_name?: string, + * link_image?: string, + * link_target?: string, + * link_description?: string, + * link_visible?: string, + * link_owner?: int, + * link_rating?: int, + * link_rel?: string, + * link_notes?: string, + * link_rss?: string, + * link_category?: int, + * } $linkdata + * @phpstan-return ($wp_error is false ? 0|positive-int : positive-int|\WP_Error) + */ + function wp_insert_link($linkdata, $wp_error = \false) + { + } + /** + * Updates link with the specified link categories. + * + * @since 2.1.0 + * + * @param int $link_id ID of the link to update. + * @param int[] $link_categories Array of link category IDs to add the link to. + */ + function wp_set_link_cats($link_id = 0, $link_categories = array()) + { + } + /** + * Updates a link in the database. + * + * @since 2.0.0 + * + * @param array $linkdata Link data to update. See wp_insert_link() for accepted arguments. + * @return int|WP_Error Value 0 or WP_Error on failure. The updated link ID on success. + * @phpstan-param array{ + * link_id?: int, + * link_url?: string, + * link_name?: string, + * link_image?: string, + * link_target?: string, + * link_description?: string, + * link_visible?: string, + * link_owner?: int, + * link_rating?: int, + * link_rel?: string, + * link_notes?: string, + * link_rss?: string, + * link_category?: int, + * } $linkdata See wp_insert_link() + */ + function wp_update_link($linkdata) + { + } + /** + * Outputs the 'disabled' message for the WordPress Link Manager. + * + * @since 3.5.0 + * @access private + * + * @global string $pagenow The filename of the current screen. + * @phpstan-return void + */ + function wp_link_manager_disabled_message() + { + } + // End of class + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : PclZipUtilPathReduction() + // Description : + // Parameters : + // Return Values : + // -------------------------------------------------------------------------------- + function PclZipUtilPathReduction($p_dir) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : PclZipUtilPathInclusion() + // Description : + // This function indicates if the path $p_path is under the $p_dir tree. Or, + // said in an other way, if the file or sub-dir $p_path is inside the dir + // $p_dir. + // The function indicates also if the path is exactly the same as the dir. + // This function supports path with duplicated '/' like '//', but does not + // support '.' or '..' statements. + // Parameters : + // Return Values : + // 0 if $p_path is not inside directory $p_dir + // 1 if $p_path is inside directory $p_dir + // 2 if $p_path is exactly the same as $p_dir + // -------------------------------------------------------------------------------- + function PclZipUtilPathInclusion($p_dir, $p_path) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : PclZipUtilCopyBlock() + // Description : + // Parameters : + // $p_mode : read/write compression mode + // 0 : src & dest normal + // 1 : src gzip, dest normal + // 2 : src normal, dest gzip + // 3 : src & dest gzip + // Return Values : + // -------------------------------------------------------------------------------- + function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode = 0) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : PclZipUtilRename() + // Description : + // This function tries to do a simple rename() function. If it fails, it + // tries to copy the $p_src file in a new $p_dest file and then unlink the + // first one. + // Parameters : + // $p_src : Old filename + // $p_dest : New filename + // Return Values : + // 1 on success, 0 on failure. + // -------------------------------------------------------------------------------- + function PclZipUtilRename($p_src, $p_dest) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : PclZipUtilOptionText() + // Description : + // Translate option value in text. Mainly for debug purpose. + // Parameters : + // $p_option : the option value. + // Return Values : + // The option text value. + // -------------------------------------------------------------------------------- + function PclZipUtilOptionText($p_option) + { + } + // -------------------------------------------------------------------------------- + // -------------------------------------------------------------------------------- + // Function : PclZipUtilTranslateWinPath() + // Description : + // Translate windows path by replacing '\' by '/' and optionally removing + // drive letter. + // Parameters : + // $p_path : path to translate. + // $p_remove_disk_letter : true | false + // Return Values : + // The path translated. + // -------------------------------------------------------------------------------- + function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter = \true) + { + } + /** + * Returns value of command line params. + * Exits when a required param is not set. + * + * @param string $param + * @param bool $required + * @return mixed + */ + function get_cli_args($param, $required = \false) + { + } + /** + * WordPress Comment Administration API. + * + * @package WordPress + * @subpackage Administration + * @since 2.3.0 + */ + /** + * Determines if a comment exists based on author and date. + * + * For best performance, use `$timezone = 'gmt'`, which queries a field that is properly indexed. The default value + * for `$timezone` is 'blog' for legacy reasons. + * + * @since 2.0.0 + * @since 4.4.0 Added the `$timezone` parameter. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $comment_author Author of the comment. + * @param string $comment_date Date of the comment. + * @param string $timezone Timezone. Accepts 'blog' or 'gmt'. Default 'blog'. + * @return string|null Comment post ID on success. + * @phpstan-param 'blog'|'gmt' $timezone + */ + function comment_exists($comment_author, $comment_date, $timezone = 'blog') + { + } + /** + * Updates a comment with values provided in $_POST. + * + * @since 2.0.0 + * @since 5.5.0 A return value was added. + * + * @return int|WP_Error The value 1 if the comment was updated, 0 if not updated. + * A WP_Error object on failure. + */ + function edit_comment() + { + } + /** + * Returns a WP_Comment object based on comment ID. + * + * @since 2.0.0 + * + * @param int $id ID of comment to retrieve. + * @return WP_Comment|false Comment if found. False on failure. + */ + function get_comment_to_edit($id) + { + } + /** + * Gets the number of pending comments on a post or posts. + * + * @since 2.3.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int|int[] $post_id Either a single Post ID or an array of Post IDs + * @return int|int[] Either a single Posts pending comments as an int or an array of ints keyed on the Post IDs + */ + function get_pending_comments_num($post_id) + { + } + /** + * Adds avatars to relevant places in admin. + * + * @since 2.5.0 + * + * @param string $name User name. + * @return string Avatar with the user name. + */ + function floated_admin_avatar($name) + { + } + /** + * Enqueues comment shortcuts jQuery script. + * + * @since 2.7.0 + */ + function enqueue_comment_hotkeys_js() + { + } + /** + * Displays error message at bottom of comments. + * + * @param string $msg Error Message. Assumed to contain HTML and be sanitized. + * @phpstan-return never + */ + function comment_footer_die($msg) + { + } + /** + * WordPress Credits Administration API. + * + * @package WordPress + * @subpackage Administration + * @since 4.4.0 + */ + /** + * Retrieves the contributor credits. + * + * @since 3.2.0 + * @since 5.6.0 Added the `$version` and `$locale` parameters. + * + * @param string $version WordPress version. Defaults to the current version. + * @param string $locale WordPress locale. Defaults to the current user's locale. + * @return array|false A list of all of the contributors, or false on error. + */ + function wp_credits($version = '', $locale = '') + { + } + /** + * Retrieves the link to a contributor's WordPress.org profile page. + * + * @access private + * @since 3.2.0 + * + * @param string $display_name The contributor's display name (passed by reference). + * @param string $username The contributor's username. + * @param string $profiles URL to the contributor's WordPress.org profile page. + */ + function _wp_credits_add_profile_link(&$display_name, $username, $profiles) + { + } + /** + * Retrieves the link to an external library used in WordPress. + * + * @access private + * @since 3.2.0 + * + * @param string $data External library data (passed by reference). + */ + function _wp_credits_build_object_link(&$data) + { + } + /** + * Displays the title for a given group of contributors. + * + * @since 5.3.0 + * + * @param array $group_data The current contributor group. + * @phpstan-return void + */ + function wp_credits_section_title($group_data = array()) + { + } + /** + * Displays a list of contributors for a given group. + * + * @since 5.3.0 + * + * @param array $credits The credits groups returned from the API. + * @param string $slug The current group to display. + * @phpstan-return void + */ + function wp_credits_section_list($credits = array(), $slug = '') + { + } + /** + * WordPress Dashboard Widget Administration Screen API + * + * @package WordPress + * @subpackage Administration + */ + /** + * Registers dashboard widgets. + * + * Handles POST data, sets up filters. + * + * @since 2.5.0 + * + * @global array $wp_registered_widgets + * @global array $wp_registered_widget_controls + * @global callable[] $wp_dashboard_control_callbacks + */ + function wp_dashboard_setup() + { + } + /** + * Adds a new dashboard widget. + * + * @since 2.7.0 + * @since 5.6.0 The `$context` and `$priority` parameters were added. + * + * @global callable[] $wp_dashboard_control_callbacks + * + * @param string $widget_id Widget ID (used in the 'id' attribute for the widget). + * @param string $widget_name Title of the widget. + * @param callable $callback Function that fills the widget with the desired content. + * The function should echo its output. + * @param callable $control_callback Optional. Function that outputs controls for the widget. Default null. + * @param array $callback_args Optional. Data that should be set as the $args property of the widget array + * (which is the second parameter passed to your callback). Default null. + * @param string $context Optional. The context within the screen where the box should display. + * Accepts 'normal', 'side', 'column3', or 'column4'. Default 'normal'. + * @param string $priority Optional. The priority within the context where the box should show. + * Accepts 'high', 'core', 'default', or 'low'. Default 'core'. + * @phpstan-param 'normal'|'side'|'column3'|'column4' $context + * @phpstan-param 'high'|'core'|'default'|'low' $priority + */ + function wp_add_dashboard_widget($widget_id, $widget_name, $callback, $control_callback = \null, $callback_args = \null, $context = 'normal', $priority = 'core') + { + } + /** + * Outputs controls for the current dashboard widget. + * + * @access private + * @since 2.7.0 + * + * @param mixed $dashboard + * @param array $meta_box + */ + function _wp_dashboard_control_callback($dashboard, $meta_box) + { + } + /** + * Displays the dashboard. + * + * @since 2.5.0 + */ + function wp_dashboard() + { + } + // + // Dashboard Widgets. + // + /** + * Dashboard widget that displays some basic stats about the site. + * + * Formerly 'Right Now'. A streamlined 'At a Glance' as of 3.8. + * + * @since 2.7.0 + */ + function wp_dashboard_right_now() + { + } + /** + * @since 3.1.0 + */ + function wp_network_dashboard_right_now() + { + } + /** + * Displays the Quick Draft widget. + * + * @since 3.8.0 + * + * @global int $post_ID + * + * @param string|false $error_msg Optional. Error message. Default false. + * @phpstan-return void + */ + function wp_dashboard_quick_press($error_msg = \false) + { + } + /** + * Show recent drafts of the user on the dashboard. + * + * @since 2.7.0 + * + * @param WP_Post[]|false $drafts Optional. Array of posts to display. Default false. + * @phpstan-return void + */ + function wp_dashboard_recent_drafts($drafts = \false) + { + } + /** + * Outputs a row for the Recent Comments widget. + * + * @access private + * @since 2.7.0 + * + * @global WP_Comment $comment Global comment object. + * + * @param WP_Comment $comment The current comment. + * @param bool $show_date Optional. Whether to display the date. + */ + function _wp_dashboard_recent_comments_row(&$comment, $show_date = \true) + { + } + /** + * Outputs the Activity widget. + * + * Callback function for {@see 'dashboard_activity'}. + * + * @since 3.8.0 + */ + function wp_dashboard_site_activity() + { + } + /** + * Generates Publishing Soon and Recently Published sections. + * + * @since 3.8.0 + * + * @param array $args { + * An array of query and display arguments. + * + * @type int $max Number of posts to display. + * @type string $status Post status. + * @type string $order Designates ascending ('ASC') or descending ('DESC') order. + * @type string $title Section title. + * @type string $id The container id. + * } + * @return bool False if no posts were found. True otherwise. + * @phpstan-param array{ + * max?: int, + * status?: string, + * order?: string, + * title?: string, + * id?: string, + * } $args + */ + function wp_dashboard_recent_posts($args) + { + } + /** + * Show Comments section. + * + * @since 3.8.0 + * + * @param int $total_items Optional. Number of comments to query. Default 5. + * @return bool False if no comments were found. True otherwise. + */ + function wp_dashboard_recent_comments($total_items = 5) + { + } + /** + * Display generic dashboard RSS widget feed. + * + * @since 2.5.0 + * + * @param string $widget_id + */ + function wp_dashboard_rss_output($widget_id) + { + } + /** + * Checks to see if all of the feed url in $check_urls are cached. + * + * If $check_urls is empty, look for the rss feed url found in the dashboard + * widget options of $widget_id. If cached, call $callback, a function that + * echoes out output for this widget. If not cache, echo a "Loading..." stub + * which is later replaced by Ajax call (see top of /wp-admin/index.php) + * + * @since 2.5.0 + * @since 5.3.0 Formalized the existing and already documented `...$args` parameter + * by adding it to the function signature. + * + * @param string $widget_id The widget ID. + * @param callable $callback The callback function used to display each feed. + * @param array $check_urls RSS feeds. + * @param mixed ...$args Optional additional parameters to pass to the callback function. + * @return bool True on success, false on failure. + */ + function wp_dashboard_cached_rss_widget($widget_id, $callback, $check_urls = array(), ...$args) + { + } + // + // Dashboard Widgets Controls. + // + /** + * Calls widget control callback. + * + * @since 2.5.0 + * + * @global callable[] $wp_dashboard_control_callbacks + * + * @param int|false $widget_control_id Optional. Registered widget ID. Default false. + */ + function wp_dashboard_trigger_widget_control($widget_control_id = \false) + { + } + /** + * Sets up the RSS dashboard widget control and $args to be used as input to wp_widget_rss_form(). + * + * Handles POST data from RSS-type widgets. + * + * @since 2.5.0 + * + * @param string $widget_id + * @param array $form_inputs + */ + function wp_dashboard_rss_control($widget_id, $form_inputs = array()) + { + } + /** + * Renders the Events and News dashboard widget. + * + * @since 4.8.0 + */ + function wp_dashboard_events_news() + { + } + /** + * Prints the markup for the Community Events section of the Events and News Dashboard widget. + * + * @since 4.8.0 + */ + function wp_print_community_events_markup() + { + } + /** + * Renders the events templates for the Event and News widget. + * + * @since 4.8.0 + */ + function wp_print_community_events_templates() + { + } + /** + * 'WordPress Events and News' dashboard widget. + * + * @since 2.7.0 + * @since 4.8.0 Removed popular plugins feed. + */ + function wp_dashboard_primary() + { + } + /** + * Displays the WordPress events and news feeds. + * + * @since 3.8.0 + * @since 4.8.0 Removed popular plugins feed. + * + * @param string $widget_id Widget ID. + * @param array $feeds Array of RSS feeds. + */ + function wp_dashboard_primary_output($widget_id, $feeds) + { + } + /** + * Displays file upload quota on dashboard. + * + * Runs on the {@see 'activity_box_end'} hook in wp_dashboard_right_now(). + * + * @since 3.0.0 + * + * @return true|void True if not multisite, user can't upload files, or the space check option is disabled. + */ + function wp_dashboard_quota() + { + } + /** + * Displays the browser update nag. + * + * @since 3.2.0 + * @since 5.8.0 Added a special message for Internet Explorer users. + * + * @global bool $is_IE + */ + function wp_dashboard_browser_nag() + { + } + /** + * Adds an additional class to the browser nag if the current version is insecure. + * + * @since 3.2.0 + * + * @param string[] $classes Array of meta box classes. + * @return string[] Modified array of meta box classes. + */ + function dashboard_browser_nag_class($classes) + { + } + /** + * Checks if the user needs a browser update. + * + * @since 3.2.0 + * + * @return array|false Array of browser data on success, false on failure. + */ + function wp_check_browser_version() + { + } + /** + * Displays the PHP update nag. + * + * @since 5.1.0 + * @phpstan-return void + */ + function wp_dashboard_php_nag() + { + } + /** + * Adds an additional class to the PHP nag if the current version is insecure. + * + * @since 5.1.0 + * + * @param string[] $classes Array of meta box classes. + * @return string[] Modified array of meta box classes. + */ + function dashboard_php_nag_class($classes) + { + } + /** + * Displays the Site Health Status widget. + * + * @since 5.4.0 + */ + function wp_dashboard_site_health() + { + } + /** + * Outputs empty dashboard widget to be populated by JS later. + * + * Usable by plugins. + * + * @since 2.5.0 + */ + function wp_dashboard_empty() + { + } + /** + * Displays a welcome panel to introduce users to WordPress. + * + * @since 3.3.0 + * @since 5.9.0 Send users to the Site Editor if the active theme is block-based. + */ + function wp_welcome_panel() + { + } + /** + * Deprecated admin functions from past WordPress versions. You shouldn't use these + * functions and look for the alternatives instead. The functions will be removed + * in a later version. + * + * @package WordPress + * @subpackage Deprecated + */ + /* + * Deprecated functions come here to die. + */ + /** + * @since 2.1.0 + * @deprecated 2.1.0 Use wp_editor() + * @see wp_editor() + */ + function tinymce_include() + { + } + /** + * Unused Admin function. + * + * @since 2.0.0 + * @deprecated 2.5.0 + * + */ + function documentation_link() + { + } + /** + * Calculates the new dimensions for a downsampled image. + * + * @since 2.0.0 + * @deprecated 3.0.0 Use wp_constrain_dimensions() + * @see wp_constrain_dimensions() + * + * @param int $width Current width of the image + * @param int $height Current height of the image + * @param int $wmax Maximum wanted width + * @param int $hmax Maximum wanted height + * @return array Shrunk dimensions (width, height). + */ + function wp_shrink_dimensions($width, $height, $wmax = 128, $hmax = 96) + { + } + /** + * Calculated the new dimensions for a downsampled image. + * + * @since 2.0.0 + * @deprecated 3.5.0 Use wp_constrain_dimensions() + * @see wp_constrain_dimensions() + * + * @param int $width Current width of the image + * @param int $height Current height of the image + * @return array Shrunk dimensions (width, height). + */ + function get_udims($width, $height) + { + } + /** + * Legacy function used to generate the categories checklist control. + * + * @since 0.71 + * @deprecated 2.6.0 Use wp_category_checklist() + * @see wp_category_checklist() + * + * @global int $post_ID + * + * @param int $default_category Unused. + * @param int $category_parent Unused. + * @param array $popular_ids Unused. + */ + function dropdown_categories($default_category = 0, $category_parent = 0, $popular_ids = array()) + { + } + /** + * Legacy function used to generate a link categories checklist control. + * + * @since 2.1.0 + * @deprecated 2.6.0 Use wp_link_category_checklist() + * @see wp_link_category_checklist() + * + * @global int $link_id + * + * @param int $default_link_category Unused. + */ + function dropdown_link_categories($default_link_category = 0) + { + } + /** + * Get the real filesystem path to a file to edit within the admin. + * + * @since 1.5.0 + * @deprecated 2.9.0 + * @uses WP_CONTENT_DIR Full filesystem path to the wp-content directory. + * + * @param string $file Filesystem path relative to the wp-content directory. + * @return string Full filesystem path to edit. + */ + function get_real_file_to_edit($file) + { + } + /** + * Legacy function used for generating a categories drop-down control. + * + * @since 1.2.0 + * @deprecated 3.0.0 Use wp_dropdown_categories() + * @see wp_dropdown_categories() + * + * @param int $current_cat Optional. ID of the current category. Default 0. + * @param int $current_parent Optional. Current parent category ID. Default 0. + * @param int $category_parent Optional. Parent ID to retrieve categories for. Default 0. + * @param int $level Optional. Number of levels deep to display. Default 0. + * @param array $categories Optional. Categories to include in the control. Default 0. + * @return void|false Void on success, false if no categories were found. + */ + function wp_dropdown_cats($current_cat = 0, $current_parent = 0, $category_parent = 0, $level = 0, $categories = 0) + { + } + /** + * Register a setting and its sanitization callback + * + * @since 2.7.0 + * @deprecated 3.0.0 Use register_setting() + * @see register_setting() + * + * @param string $option_group A settings group name. Should correspond to an allowed option key name. + * Default allowed option key names include 'general', 'discussion', 'media', + * 'reading', 'writing', and 'options'. + * @param string $option_name The name of an option to sanitize and save. + * @param callable $sanitize_callback Optional. A callback function that sanitizes the option's value. + */ + function add_option_update_handler($option_group, $option_name, $sanitize_callback = '') + { + } + /** + * Unregister a setting + * + * @since 2.7.0 + * @deprecated 3.0.0 Use unregister_setting() + * @see unregister_setting() + * + * @param string $option_group The settings group name used during registration. + * @param string $option_name The name of the option to unregister. + * @param callable $sanitize_callback Optional. Deprecated. + */ + function remove_option_update_handler($option_group, $option_name, $sanitize_callback = '') + { + } + /** + * Determines the language to use for CodePress syntax highlighting. + * + * @since 2.8.0 + * @deprecated 3.0.0 + * + * @param string $filename + */ + function codepress_get_lang($filename) + { + } + /** + * Adds JavaScript required to make CodePress work on the theme/plugin file editors. + * + * @since 2.8.0 + * @deprecated 3.0.0 + */ + function codepress_footer_js() + { + } + /** + * Determine whether to use CodePress. + * + * @since 2.8.0 + * @deprecated 3.0.0 + */ + function use_codepress() + { + } + /** + * Get all user IDs. + * + * @deprecated 3.1.0 Use get_users() + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return array List of user IDs. + */ + function get_author_user_ids() + { + } + /** + * Gets author users who can edit posts. + * + * @deprecated 3.1.0 Use get_users() + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $user_id User ID. + * @return array|false List of editable authors. False if no editable users. + */ + function get_editable_authors($user_id) + { + } + /** + * Gets the IDs of any users who can edit posts. + * + * @deprecated 3.1.0 Use get_users() + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $user_id User ID. + * @param bool $exclude_zeros Optional. Whether to exclude zeroes. Default true. + * @return array Array of editable user IDs, empty array otherwise. + */ + function get_editable_user_ids($user_id, $exclude_zeros = \true, $post_type = 'post') + { + } + /** + * Gets all users who are not authors. + * + * @deprecated 3.1.0 Use get_users() + * + * @global wpdb $wpdb WordPress database abstraction object. + */ + function get_nonauthor_user_ids() + { + } + /** + * Retrieves editable posts from other users. + * + * @since 2.3.0 + * @deprecated 3.1.0 Use get_posts() + * @see get_posts() + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $user_id User ID to not retrieve posts from. + * @param string $type Optional. Post type to retrieve. Accepts 'draft', 'pending' or 'any' (all). + * Default 'any'. + * @return array List of posts from others. + * @phpstan-param 'draft'|'pending'|'any' $type + */ + function get_others_unpublished_posts($user_id, $type = 'any') + { + } + /** + * Retrieve drafts from other users. + * + * @deprecated 3.1.0 Use get_posts() + * @see get_posts() + * + * @param int $user_id User ID. + * @return array List of drafts from other users. + */ + function get_others_drafts($user_id) + { + } + /** + * Retrieve pending review posts from other users. + * + * @deprecated 3.1.0 Use get_posts() + * @see get_posts() + * + * @param int $user_id User ID. + * @return array List of posts with pending review post type from other users. + */ + function get_others_pending($user_id) + { + } + /** + * Output the QuickPress dashboard widget. + * + * @since 3.0.0 + * @deprecated 3.2.0 Use wp_dashboard_quick_press() + * @see wp_dashboard_quick_press() + */ + function wp_dashboard_quick_press_output() + { + } + /** + * Outputs the TinyMCE editor. + * + * @since 2.7.0 + * @deprecated 3.3.0 Use wp_editor() + * @see wp_editor() + */ + function wp_tiny_mce($teeny = \false, $settings = \false) + { + } + /** + * Preloads TinyMCE dialogs. + * + * @deprecated 3.3.0 Use wp_editor() + * @see wp_editor() + */ + function wp_preload_dialogs() + { + } + /** + * Prints TinyMCE editor JS. + * + * @deprecated 3.3.0 Use wp_editor() + * @see wp_editor() + */ + function wp_print_editor_js() + { + } + /** + * Handles quicktags. + * + * @deprecated 3.3.0 Use wp_editor() + * @see wp_editor() + */ + function wp_quicktags() + { + } + /** + * Returns the screen layout options. + * + * @since 2.8.0 + * @deprecated 3.3.0 WP_Screen::render_screen_layout() + * @see WP_Screen::render_screen_layout() + */ + function screen_layout($screen) + { + } + /** + * Returns the screen's per-page options. + * + * @since 2.8.0 + * @deprecated 3.3.0 Use WP_Screen::render_per_page_options() + * @see WP_Screen::render_per_page_options() + */ + function screen_options($screen) + { + } + /** + * Renders the screen's help. + * + * @since 2.7.0 + * @deprecated 3.3.0 Use WP_Screen::render_screen_meta() + * @see WP_Screen::render_screen_meta() + */ + function screen_meta($screen) + { + } + /** + * Favorite actions were deprecated in version 3.2. Use the admin bar instead. + * + * @since 2.7.0 + * @deprecated 3.2.0 Use WP_Admin_Bar + * @see WP_Admin_Bar + */ + function favorite_actions() + { + } + /** + * Handles uploading an image. + * + * @deprecated 3.3.0 Use wp_media_upload_handler() + * @see wp_media_upload_handler() + * + * @return null|string + */ + function media_upload_image() + { + } + /** + * Handles uploading an audio file. + * + * @deprecated 3.3.0 Use wp_media_upload_handler() + * @see wp_media_upload_handler() + * + * @return null|string + */ + function media_upload_audio() + { + } + /** + * Handles uploading a video file. + * + * @deprecated 3.3.0 Use wp_media_upload_handler() + * @see wp_media_upload_handler() + * + * @return null|string + */ + function media_upload_video() + { + } + /** + * Handles uploading a generic file. + * + * @deprecated 3.3.0 Use wp_media_upload_handler() + * @see wp_media_upload_handler() + * + * @return null|string + */ + function media_upload_file() + { + } + /** + * Handles retrieving the insert-from-URL form for an image. + * + * @deprecated 3.3.0 Use wp_media_insert_url_form() + * @see wp_media_insert_url_form() + * + * @return string + */ + function type_url_form_image() + { + } + /** + * Handles retrieving the insert-from-URL form for an audio file. + * + * @deprecated 3.3.0 Use wp_media_insert_url_form() + * @see wp_media_insert_url_form() + * + * @return string + */ + function type_url_form_audio() + { + } + /** + * Handles retrieving the insert-from-URL form for a video file. + * + * @deprecated 3.3.0 Use wp_media_insert_url_form() + * @see wp_media_insert_url_form() + * + * @return string + */ + function type_url_form_video() + { + } + /** + * Handles retrieving the insert-from-URL form for a generic file. + * + * @deprecated 3.3.0 Use wp_media_insert_url_form() + * @see wp_media_insert_url_form() + * + * @return string + */ + function type_url_form_file() + { + } + /** + * Add contextual help text for a page. + * + * Creates an 'Overview' help tab. + * + * @since 2.7.0 + * @deprecated 3.3.0 Use WP_Screen::add_help_tab() + * @see WP_Screen::add_help_tab() + * + * @param string $screen The handle for the screen to add help to. This is usually + * the hook name returned by the `add_*_page()` functions. + * @param string $help The content of an 'Overview' help tab. + */ + function add_contextual_help($screen, $help) + { + } + /** + * Get the allowed themes for the current site. + * + * @since 3.0.0 + * @deprecated 3.4.0 Use wp_get_themes() + * @see wp_get_themes() + * + * @return WP_Theme[] Array of WP_Theme objects keyed by their name. + */ + function get_allowed_themes() + { + } + /** + * Retrieves a list of broken themes. + * + * @since 1.5.0 + * @deprecated 3.4.0 Use wp_get_themes() + * @see wp_get_themes() + * + * @return array + */ + function get_broken_themes() + { + } + /** + * Retrieves information on the current active theme. + * + * @since 2.0.0 + * @deprecated 3.4.0 Use wp_get_theme() + * @see wp_get_theme() + * + * @return WP_Theme + */ + function current_theme_info() + { + } + /** + * This was once used to display an 'Insert into Post' button. + * + * Now it is deprecated and stubbed. + * + * @deprecated 3.5.0 + */ + function _insert_into_post_button($type) + { + } + /** + * This was once used to display a media button. + * + * Now it is deprecated and stubbed. + * + * @deprecated 3.5.0 + */ + function _media_button($title, $icon, $type, $id) + { + } + /** + * Gets an existing post and format it for editing. + * + * @since 2.0.0 + * @deprecated 3.5.0 Use get_post() + * @see get_post() + * + * @param int $id + * @return WP_Post + */ + function get_post_to_edit($id) + { + } + /** + * Gets the default page information to use. + * + * @since 2.5.0 + * @deprecated 3.5.0 Use get_default_post_to_edit() + * @see get_default_post_to_edit() + * + * @return WP_Post Post object containing all the default post data as attributes + */ + function get_default_page_to_edit() + { + } + /** + * This was once used to create a thumbnail from an Image given a maximum side size. + * + * @since 1.2.0 + * @deprecated 3.5.0 Use image_resize() + * @see image_resize() + * + * @param mixed $file Filename of the original image, Or attachment ID. + * @param int $max_side Maximum length of a single side for the thumbnail. + * @param mixed $deprecated Never used. + * @return string Thumbnail path on success, Error string on failure. + */ + function wp_create_thumbnail($file, $max_side, $deprecated = '') + { + } + /** + * This was once used to display a meta box for the nav menu theme locations. + * + * Deprecated in favor of a 'Manage Locations' tab added to nav menus management screen. + * + * @since 3.0.0 + * @deprecated 3.6.0 + */ + function wp_nav_menu_locations_meta_box() + { + } + /** + * This was once used to kick-off the Core Updater. + * + * Deprecated in favor of instantiating a Core_Upgrader instance directly, + * and calling the 'upgrade' method. + * + * @since 2.7.0 + * @deprecated 3.7.0 Use Core_Upgrader + * @see Core_Upgrader + */ + function wp_update_core($current, $feedback = '') + { + } + /** + * This was once used to kick-off the Plugin Updater. + * + * Deprecated in favor of instantiating a Plugin_Upgrader instance directly, + * and calling the 'upgrade' method. + * Unused since 2.8.0. + * + * @since 2.5.0 + * @deprecated 3.7.0 Use Plugin_Upgrader + * @see Plugin_Upgrader + */ + function wp_update_plugin($plugin, $feedback = '') + { + } + /** + * This was once used to kick-off the Theme Updater. + * + * Deprecated in favor of instantiating a Theme_Upgrader instance directly, + * and calling the 'upgrade' method. + * Unused since 2.8.0. + * + * @since 2.7.0 + * @deprecated 3.7.0 Use Theme_Upgrader + * @see Theme_Upgrader + */ + function wp_update_theme($theme, $feedback = '') + { + } + /** + * This was once used to display attachment links. Now it is deprecated and stubbed. + * + * @since 2.0.0 + * @deprecated 3.7.0 + * + * @param int|bool $id + */ + function the_attachment_links($id = \false) + { + } + /** + * Displays a screen icon. + * + * @since 2.7.0 + * @deprecated 3.8.0 + */ + function screen_icon() + { + } + /** + * Retrieves the screen icon (no longer used in 3.8+). + * + * @since 3.2.0 + * @deprecated 3.8.0 + * + * @return string An HTML comment explaining that icons are no longer used. + */ + function get_screen_icon() + { + } + /** + * Deprecated dashboard widget controls. + * + * @since 2.5.0 + * @deprecated 3.8.0 + */ + function wp_dashboard_incoming_links_output() + { + } + /** + * Deprecated dashboard secondary output. + * + * @deprecated 3.8.0 + */ + function wp_dashboard_secondary_output() + { + } + /** + * Deprecated dashboard widget controls. + * + * @since 2.7.0 + * @deprecated 3.8.0 + */ + function wp_dashboard_incoming_links() + { + } + /** + * Deprecated dashboard incoming links control. + * + * @deprecated 3.8.0 + */ + function wp_dashboard_incoming_links_control() + { + } + /** + * Deprecated dashboard plugins control. + * + * @deprecated 3.8.0 + */ + function wp_dashboard_plugins() + { + } + /** + * Deprecated dashboard primary control. + * + * @deprecated 3.8.0 + */ + function wp_dashboard_primary_control() + { + } + /** + * Deprecated dashboard recent comments control. + * + * @deprecated 3.8.0 + */ + function wp_dashboard_recent_comments_control() + { + } + /** + * Deprecated dashboard secondary section. + * + * @deprecated 3.8.0 + */ + function wp_dashboard_secondary() + { + } + /** + * Deprecated dashboard secondary control. + * + * @deprecated 3.8.0 + */ + function wp_dashboard_secondary_control() + { + } + /** + * Display plugins text for the WordPress news widget. + * + * @since 2.5.0 + * @deprecated 4.8.0 + * + * @param string $rss The RSS feed URL. + * @param array $args Array of arguments for this RSS feed. + */ + function wp_dashboard_plugins_output($rss, $args = array()) + { + } + /** + * This was once used to move child posts to a new parent. + * + * @since 2.3.0 + * @deprecated 3.9.0 + * @access private + * + * @param int $old_ID + * @param int $new_ID + */ + function _relocate_children($old_ID, $new_ID) + { + } + /** + * Add a top-level menu page in the 'objects' section. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @since 2.7.0 + * + * @deprecated 4.5.0 Use add_menu_page() + * @see add_menu_page() + * @global int $_wp_last_object_menu + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected. + * @param string $menu_title The text to be used for the menu. + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). + * @param callable $callback Optional. The function to be called to output the content for this page. + * @param string $icon_url Optional. The URL to the icon to be used for this menu. + * @return string The resulting page's hook_suffix. + */ + function add_object_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $icon_url = '') + { + } + /** + * Add a top-level menu page in the 'utility' section. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @since 2.7.0 + * + * @deprecated 4.5.0 Use add_menu_page() + * @see add_menu_page() + * @global int $_wp_last_utility_menu + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected. + * @param string $menu_title The text to be used for the menu. + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). + * @param callable $callback Optional. The function to be called to output the content for this page. + * @param string $icon_url Optional. The URL to the icon to be used for this menu. + * @return string The resulting page's hook_suffix. + */ + function add_utility_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $icon_url = '') + { + } + /** + * Disables autocomplete on the 'post' form (Add/Edit Post screens) for WebKit browsers, + * as they disregard the autocomplete setting on the editor textarea. That can break the editor + * when the user navigates to it with the browser's Back button. See #28037 + * + * Replaced with wp_page_reload_on_back_button_js() that also fixes this problem. + * + * @since 4.0.0 + * @deprecated 4.6.0 + * + * @link https://core.trac.wordpress.org/ticket/35852 + * + * @global bool $is_safari + * @global bool $is_chrome + */ + function post_form_autocomplete_off() + { + } + /** + * Display JavaScript on the page. + * + * @since 3.5.0 + * @deprecated 4.9.0 + */ + function options_permalink_add_js() + { + } + /** + * Was used to add options for the privacy requests screens before they were separate files. + * + * @since 4.9.8 + * @access private + * @deprecated 5.3.0 + */ + function _wp_privacy_requests_screen_options() + { + } + /** + * Was used to filter input from media_upload_form_handler() and to assign a default + * post_title from the file name if none supplied. + * + * @since 2.5.0 + * @deprecated 6.0.0 + * + * @param array $post The WP_Post attachment object converted to an array. + * @param array $attachment An array of attachment metadata. + * @return array Attachment post object converted to an array. + */ + function image_attachment_fields_to_save($post, $attachment) + { + } + /** + * Generates the WXR export file for download. + * + * Default behavior is to export all content, however, note that post content will only + * be exported for post types with the `can_export` argument enabled. Any posts with the + * 'auto-draft' status will be skipped. + * + * @since 2.1.0 + * @since 5.7.0 Added the `post_modified` and `post_modified_gmt` fields to the export file. + * + * @global wpdb $wpdb WordPress database abstraction object. + * @global WP_Post $post Global post object. + * + * @param array $args { + * Optional. Arguments for generating the WXR export file for download. Default empty array. + * + * @type string $content Type of content to export. If set, only the post content of this post type + * will be exported. Accepts 'all', 'post', 'page', 'attachment', or a defined + * custom post. If an invalid custom post type is supplied, every post type for + * which `can_export` is enabled will be exported instead. If a valid custom post + * type is supplied but `can_export` is disabled, then 'posts' will be exported + * instead. When 'all' is supplied, only post types with `can_export` enabled will + * be exported. Default 'all'. + * @type string $author Author to export content for. Only used when `$content` is 'post', 'page', or + * 'attachment'. Accepts false (all) or a specific author ID. Default false (all). + * @type string $category Category (slug) to export content for. Used only when `$content` is 'post'. If + * set, only post content assigned to `$category` will be exported. Accepts false + * or a specific category slug. Default is false (all categories). + * @type string $start_date Start date to export content from. Expected date format is 'Y-m-d'. Used only + * when `$content` is 'post', 'page' or 'attachment'. Default false (since the + * beginning of time). + * @type string $end_date End date to export content to. Expected date format is 'Y-m-d'. Used only when + * `$content` is 'post', 'page' or 'attachment'. Default false (latest publish date). + * @type string $status Post status to export posts for. Used only when `$content` is 'post' or 'page'. + * Accepts false (all statuses except 'auto-draft'), or a specific status, i.e. + * 'publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', or + * 'trash'. Default false (all statuses except 'auto-draft'). + * } + * @phpstan-param array{ + * content?: string, + * author?: string, + * category?: string, + * start_date?: string, + * end_date?: string, + * status?: string, + * } $args + */ + function export_wp($args = array()) + { + } + /** + * Gets the description for standard WordPress theme files. + * + * @since 1.5.0 + * + * @global array $wp_file_descriptions Theme file descriptions. + * @global array $allowed_files List of allowed files. + * + * @param string $file Filesystem path or filename. + * @return string Description of file from $wp_file_descriptions or basename of $file if description doesn't exist. + * Appends 'Page Template' to basename of $file if the file is a page template. + */ + function get_file_description($file) + { + } + /** + * Gets the absolute filesystem path to the root of the WordPress installation. + * + * @since 1.5.0 + * + * @return string Full filesystem path to the root of the WordPress installation. + */ + function get_home_path() + { + } + /** + * Returns a listing of all files in the specified folder and all subdirectories up to 100 levels deep. + * + * The depth of the recursiveness can be controlled by the $levels param. + * + * @since 2.6.0 + * @since 4.9.0 Added the `$exclusions` parameter. + * @since 6.3.0 Added the `$include_hidden` parameter. + * + * @param string $folder Optional. Full path to folder. Default empty. + * @param int $levels Optional. Levels of folders to follow, Default 100 (PHP Loop limit). + * @param string[] $exclusions Optional. List of folders and files to skip. + * @param bool $include_hidden Optional. Whether to include details of hidden ("." prefixed) files. + * Default false. + * @return string[]|false Array of files on success, false on failure. + */ + function list_files($folder = '', $levels = 100, $exclusions = array(), $include_hidden = \false) + { + } + /** + * Gets the list of file extensions that are editable in plugins. + * + * @since 4.9.0 + * + * @param string $plugin Path to the plugin file relative to the plugins directory. + * @return string[] Array of editable file extensions. + */ + function wp_get_plugin_file_editable_extensions($plugin) + { + } + /** + * Gets the list of file extensions that are editable for a given theme. + * + * @since 4.9.0 + * + * @param WP_Theme $theme Theme object. + * @return string[] Array of editable file extensions. + */ + function wp_get_theme_file_editable_extensions($theme) + { + } + /** + * Prints file editor templates (for plugins and themes). + * + * @since 4.9.0 + */ + function wp_print_file_editor_templates() + { + } + /** + * Attempts to edit a file for a theme or plugin. + * + * When editing a PHP file, loopback requests will be made to the admin and the homepage + * to attempt to see if there is a fatal error introduced. If so, the PHP change will be + * reverted. + * + * @since 4.9.0 + * + * @param string[] $args { + * Args. Note that all of the arg values are already unslashed. They are, however, + * coming straight from `$_POST` and are not validated or sanitized in any way. + * + * @type string $file Relative path to file. + * @type string $plugin Path to the plugin file relative to the plugins directory. + * @type string $theme Theme being edited. + * @type string $newcontent New content for the file. + * @type string $nonce Nonce. + * } + * @return true|WP_Error True on success or `WP_Error` on failure. + * @phpstan-param array{ + * file?: string, + * plugin?: string, + * theme?: string, + * newcontent?: string, + * nonce?: string, + * } $args + */ + function wp_edit_theme_plugin_file($args) + { + } + /** + * Returns a filename of a temporary unique file. + * + * Please note that the calling function must delete or move the file. + * + * The filename is based off the passed parameter or defaults to the current unix timestamp, + * while the directory can either be passed as well, or by leaving it blank, default to a writable + * temporary directory. + * + * @since 2.6.0 + * + * @param string $filename Optional. Filename to base the Unique file off. Default empty. + * @param string $dir Optional. Directory to store the file in. Default empty. + * @return string A writable filename. + */ + function wp_tempnam($filename = '', $dir = '') + { + } + /** + * Makes sure that the file that was requested to be edited is allowed to be edited. + * + * Function will die if you are not allowed to edit the file. + * + * @since 1.5.0 + * + * @param string $file File the user is attempting to edit. + * @param string[] $allowed_files Optional. Array of allowed files to edit. + * `$file` must match an entry exactly. + * @return string|void Returns the file name on success, dies on failure. + */ + function validate_file_to_edit($file, $allowed_files = array()) + { + } + /** + * Handles PHP uploads in WordPress. + * + * Sanitizes file names, checks extensions for mime type, and moves the file + * to the appropriate directory within the uploads directory. + * + * @access private + * @since 4.0.0 + * + * @see wp_handle_upload_error + * + * @param array $file { + * Reference to a single element from `$_FILES`. Call the function once for each uploaded file. + * + * @type string $name The original name of the file on the client machine. + * @type string $type The mime type of the file, if the browser provided this information. + * @type string $tmp_name The temporary filename of the file in which the uploaded file was stored on the server. + * @type int $size The size, in bytes, of the uploaded file. + * @type int $error The error code associated with this file upload. + * } + * @param array|false $overrides { + * An array of override parameters for this file, or boolean false if none are provided. + * + * @type callable $upload_error_handler Function to call when there is an error during the upload process. + * See {@see wp_handle_upload_error()}. + * @type callable $unique_filename_callback Function to call when determining a unique file name for the file. + * See {@see wp_unique_filename()}. + * @type string[] $upload_error_strings The strings that describe the error indicated in + * `$_FILES[{form field}]['error']`. + * @type bool $test_form Whether to test that the `$_POST['action']` parameter is as expected. + * @type bool $test_size Whether to test that the file size is greater than zero bytes. + * @type bool $test_type Whether to test that the mime type of the file is as expected. + * @type string[] $mimes Array of allowed mime types keyed by their file extension regex. + * } + * @param string $time Time formatted in 'yyyy/mm'. + * @param string $action Expected value for `$_POST['action']`. + * @return array { + * On success, returns an associative array of file attributes. + * On failure, returns `$overrides['upload_error_handler']( &$file, $message )` + * or `array( 'error' => $message )`. + * + * @type string $file Filename of the newly-uploaded file. + * @type string $url URL of the newly-uploaded file. + * @type string $type Mime type of the newly-uploaded file. + * } + * @phpstan-param array{ + * name?: string, + * type?: string, + * tmp_name?: string, + * size?: int, + * error?: int, + * } $file + * @phpstan-param false|array{ + * upload_error_handler?: callable, + * unique_filename_callback?: callable, + * upload_error_strings?: string[], + * test_form?: bool, + * test_size?: bool, + * test_type?: bool, + * mimes?: string[], + * } $overrides + * @phpstan-return array{ + * file: string, + * url: string, + * type: string, + * } + */ + function _wp_handle_upload(&$file, $overrides, $time, $action) + { + } + /** + * Wrapper for _wp_handle_upload(). + * + * Passes the {@see 'wp_handle_upload'} action. + * + * @since 2.0.0 + * + * @see _wp_handle_upload() + * + * @param array $file Reference to a single element of `$_FILES`. + * Call the function once for each uploaded file. + * See _wp_handle_upload() for accepted values. + * @param array|false $overrides Optional. An associative array of names => values + * to override default variables. Default false. + * See _wp_handle_upload() for accepted values. + * @param string|null $time Optional. Time formatted in 'yyyy/mm'. Default null. + * @return array See _wp_handle_upload() for return value. + * @phpstan-param array{ + * name?: string, + * type?: string, + * tmp_name?: string, + * size?: int, + * error?: int, + * } $file See _wp_handle_upload() + * @phpstan-param false|array{ + * upload_error_handler?: callable, + * unique_filename_callback?: callable, + * upload_error_strings?: string[], + * test_form?: bool, + * test_size?: bool, + * test_type?: bool, + * mimes?: string[], + * } $overrides See _wp_handle_upload() + */ + function wp_handle_upload(&$file, $overrides = \false, $time = \null) + { + } + /** + * Wrapper for _wp_handle_upload(). + * + * Passes the {@see 'wp_handle_sideload'} action. + * + * @since 2.6.0 + * + * @see _wp_handle_upload() + * + * @param array $file Reference to a single element of `$_FILES`. + * Call the function once for each uploaded file. + * See _wp_handle_upload() for accepted values. + * @param array|false $overrides Optional. An associative array of names => values + * to override default variables. Default false. + * See _wp_handle_upload() for accepted values. + * @param string|null $time Optional. Time formatted in 'yyyy/mm'. Default null. + * @return array See _wp_handle_upload() for return value. + * @phpstan-param array{ + * name?: string, + * type?: string, + * tmp_name?: string, + * size?: int, + * error?: int, + * } $file See _wp_handle_upload() + * @phpstan-param false|array{ + * upload_error_handler?: callable, + * unique_filename_callback?: callable, + * upload_error_strings?: string[], + * test_form?: bool, + * test_size?: bool, + * test_type?: bool, + * mimes?: string[], + * } $overrides See _wp_handle_upload() + */ + function wp_handle_sideload(&$file, $overrides = \false, $time = \null) + { + } + /** + * Downloads a URL to a local temporary file using the WordPress HTTP API. + * + * Please note that the calling function must delete or move the file. + * + * @since 2.5.0 + * @since 5.2.0 Signature Verification with SoftFail was added. + * @since 5.9.0 Support for Content-Disposition filename was added. + * + * @param string $url The URL of the file to download. + * @param int $timeout The timeout for the request to download the file. + * Default 300 seconds. + * @param bool $signature_verification Whether to perform Signature Verification. + * Default false. + * @return string|WP_Error Filename on success, WP_Error on failure. + */ + function download_url($url, $timeout = 300, $signature_verification = \false) + { + } + /** + * Calculates and compares the MD5 of a file to its expected value. + * + * @since 3.7.0 + * + * @param string $filename The filename to check the MD5 of. + * @param string $expected_md5 The expected MD5 of the file, either a base64-encoded raw md5, + * or a hex-encoded md5. + * @return bool|WP_Error True on success, false when the MD5 format is unknown/unexpected, + * WP_Error on failure. + */ + function verify_file_md5($filename, $expected_md5) + { + } + /** + * Verifies the contents of a file against its ED25519 signature. + * + * @since 5.2.0 + * + * @param string $filename The file to validate. + * @param string|array $signatures A Signature provided for the file. + * @param string|false $filename_for_errors Optional. A friendly filename for errors. + * @return bool|WP_Error True on success, false if verification not attempted, + * or WP_Error describing an error condition. + */ + function verify_file_signature($filename, $signatures, $filename_for_errors = \false) + { + } + /** + * Retrieves the list of signing keys trusted by WordPress. + * + * @since 5.2.0 + * + * @return string[] Array of base64-encoded signing keys. + */ + function wp_trusted_keys() + { + } + /** + * Determines whether the given file is a valid ZIP file. + * + * This function does not test to ensure that a file exists. Non-existent files + * are not valid ZIPs, so those will also return false. + * + * @since 6.4.4 + * + * @param string $file Full path to the ZIP file. + * @return bool Whether the file is a valid ZIP file. + */ + function wp_zip_file_is_valid($file) + { + } + /** + * Unzips a specified ZIP file to a location on the filesystem via the WordPress + * Filesystem Abstraction. + * + * Assumes that WP_Filesystem() has already been called and set up. Does not extract + * a root-level __MACOSX directory, if present. + * + * Attempts to increase the PHP memory limit to 256M before uncompressing. However, + * the most memory required shouldn't be much larger than the archive itself. + * + * @since 2.5.0 + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @param string $file Full path and filename of ZIP archive. + * @param string $to Full path on the filesystem to extract archive to. + * @return true|WP_Error True on success, WP_Error on failure. + */ + function unzip_file($file, $to) + { + } + /** + * Attempts to unzip an archive using the ZipArchive class. + * + * This function should not be called directly, use `unzip_file()` instead. + * + * Assumes that WP_Filesystem() has already been called and set up. + * + * @since 3.0.0 + * @access private + * + * @see unzip_file() + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @param string $file Full path and filename of ZIP archive. + * @param string $to Full path on the filesystem to extract archive to. + * @param string[] $needed_dirs A partial list of required folders needed to be created. + * @return true|WP_Error True on success, WP_Error on failure. + */ + function _unzip_file_ziparchive($file, $to, $needed_dirs = array()) + { + } + /** + * Attempts to unzip an archive using the PclZip library. + * + * This function should not be called directly, use `unzip_file()` instead. + * + * Assumes that WP_Filesystem() has already been called and set up. + * + * @since 3.0.0 + * @access private + * + * @see unzip_file() + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @param string $file Full path and filename of ZIP archive. + * @param string $to Full path on the filesystem to extract archive to. + * @param string[] $needed_dirs A partial list of required folders needed to be created. + * @return true|WP_Error True on success, WP_Error on failure. + */ + function _unzip_file_pclzip($file, $to, $needed_dirs = array()) + { + } + /** + * Copies a directory from one location to another via the WordPress Filesystem + * Abstraction. + * + * Assumes that WP_Filesystem() has already been called and setup. + * + * @since 2.5.0 + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @param string $from Source directory. + * @param string $to Destination directory. + * @param string[] $skip_list An array of files/folders to skip copying. + * @return true|WP_Error True on success, WP_Error on failure. + */ + function copy_dir($from, $to, $skip_list = array()) + { + } + /** + * Moves a directory from one location to another. + * + * Recursively invalidates OPcache on success. + * + * If the renaming failed, falls back to copy_dir(). + * + * Assumes that WP_Filesystem() has already been called and setup. + * + * This function is not designed to merge directories, copy_dir() should be used instead. + * + * @since 6.2.0 + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @param string $from Source directory. + * @param string $to Destination directory. + * @param bool $overwrite Optional. Whether to overwrite the destination directory if it exists. + * Default false. + * @return true|WP_Error True on success, WP_Error on failure. + */ + function move_dir($from, $to, $overwrite = \false) + { + } + /** + * Initializes and connects the WordPress Filesystem Abstraction classes. + * + * This function will include the chosen transport and attempt connecting. + * + * Plugins may add extra transports, And force WordPress to use them by returning + * the filename via the {@see 'filesystem_method_file'} filter. + * + * @since 2.5.0 + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @param array|false $args Optional. Connection args, These are passed + * directly to the `WP_Filesystem_*()` classes. + * Default false. + * @param string|false $context Optional. Context for get_filesystem_method(). + * Default false. + * @param bool $allow_relaxed_file_ownership Optional. Whether to allow Group/World writable. + * Default false. + * @return bool|null True on success, false on failure, + * null if the filesystem method class file does not exist. + */ + function WP_Filesystem($args = \false, $context = \false, $allow_relaxed_file_ownership = \false) + { + } + /** + * Determines which method to use for reading, writing, modifying, or deleting + * files on the filesystem. + * + * The priority of the transports are: Direct, SSH2, FTP PHP Extension, FTP Sockets + * (Via Sockets class, or `fsockopen()`). Valid values for these are: 'direct', 'ssh2', + * 'ftpext' or 'ftpsockets'. + * + * The return value can be overridden by defining the `FS_METHOD` constant in `wp-config.php`, + * or filtering via {@see 'filesystem_method'}. + * + * @link https://developer.wordpress.org/advanced-administration/wordpress/wp-config/#wordpress-upgrade-constants + * + * Plugins may define a custom transport handler, See WP_Filesystem(). + * + * @since 2.5.0 + * + * @global callable $_wp_filesystem_direct_method + * + * @param array $args Optional. Connection details. Default empty array. + * @param string $context Optional. Full path to the directory that is tested + * for being writable. Default empty. + * @param bool $allow_relaxed_file_ownership Optional. Whether to allow Group/World writable. + * Default false. + * @return string The transport to use, see description for valid return values. + */ + function get_filesystem_method($args = array(), $context = '', $allow_relaxed_file_ownership = \false) + { + } + /** + * Displays a form to the user to request for their FTP/SSH details in order + * to connect to the filesystem. + * + * All chosen/entered details are saved, excluding the password. + * + * Hostnames may be in the form of hostname:portnumber (eg: wordpress.org:2467) + * to specify an alternate FTP/SSH port. + * + * Plugins may override this form by returning true|false via the {@see 'request_filesystem_credentials'} filter. + * + * @since 2.5.0 + * @since 4.6.0 The `$context` parameter default changed from `false` to an empty string. + * + * @global string $pagenow The filename of the current screen. + * + * @param string $form_post The URL to post the form to. + * @param string $type Optional. Chosen type of filesystem. Default empty. + * @param bool|WP_Error $error Optional. Whether the current request has failed + * to connect, or an error object. Default false. + * @param string $context Optional. Full path to the directory that is tested + * for being writable. Default empty. + * @param array $extra_fields Optional. Extra `POST` fields to be checked + * for inclusion in the post. Default null. + * @param bool $allow_relaxed_file_ownership Optional. Whether to allow Group/World writable. + * Default false. + * @return bool|array True if no filesystem credentials are required, + * false if they are required but have not been provided, + * array of credentials if they are required and have been provided. + */ + function request_filesystem_credentials($form_post, $type = '', $error = \false, $context = '', $extra_fields = \null, $allow_relaxed_file_ownership = \false) + { + } + /** + * Prints the filesystem credentials modal when needed. + * + * @since 4.2.0 + * @phpstan-return void + */ + function wp_print_request_filesystem_credentials_modal() + { + } + /** + * Attempts to clear the opcode cache for an individual PHP file. + * + * This function can be called safely without having to check the file extension + * or availability of the OPcache extension. + * + * Whether or not invalidation is possible is cached to improve performance. + * + * @since 5.5.0 + * + * @link https://www.php.net/manual/en/function.opcache-invalidate.php + * + * @param string $filepath Path to the file, including extension, for which the opcode cache is to be cleared. + * @param bool $force Invalidate even if the modification time is not newer than the file in cache. + * Default false. + * @return bool True if opcache was invalidated for `$filepath`, or there was nothing to invalidate. + * False if opcache invalidation is not available, or is disabled via filter. + */ + function wp_opcache_invalidate($filepath, $force = \false) + { + } + /** + * Attempts to clear the opcode cache for a directory of files. + * + * @since 6.2.0 + * + * @see wp_opcache_invalidate() + * @link https://www.php.net/manual/en/function.opcache-invalidate.php + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @param string $dir The path to the directory for which the opcode cache is to be cleared. + * @phpstan-return void + */ + function wp_opcache_invalidate_directory($dir) + { + } + /** + * WordPress Image Editor + * + * @package WordPress + * @subpackage Administration + */ + /** + * Loads the WP image-editing interface. + * + * @since 2.9.0 + * + * @param int $post_id Attachment post ID. + * @param false|object $msg Optional. Message to display for image editor updates or errors. + * Default false. + */ + function wp_image_editor($post_id, $msg = \false) + { + } + /** + * Streams image in WP_Image_Editor to browser. + * + * @since 2.9.0 + * + * @param WP_Image_Editor $image The image editor instance. + * @param string $mime_type The mime type of the image. + * @param int $attachment_id The image's attachment post ID. + * @return bool True on success, false on failure. + */ + function wp_stream_image($image, $mime_type, $attachment_id) + { + } + /** + * Saves image to file. + * + * @since 2.9.0 + * @since 3.5.0 The `$image` parameter expects a `WP_Image_Editor` instance. + * @since 6.0.0 The `$filesize` value was added to the returned array. + * + * @param string $filename Name of the file to be saved. + * @param WP_Image_Editor $image The image editor instance. + * @param string $mime_type The mime type of the image. + * @param int $post_id Attachment post ID. + * @return array|WP_Error|bool { + * Array on success or WP_Error if the file failed to save. + * When called with a deprecated value for the `$image` parameter, + * i.e. a non-`WP_Image_Editor` image resource or `GdImage` instance, + * the function will return true on success, false on failure. + * + * @type string $path Path to the image file. + * @type string $file Name of the image file. + * @type int $width Image width. + * @type int $height Image height. + * @type string $mime-type The mime type of the image. + * @type int $filesize File size of the image. + * } + * @phpstan-return \WP_Error|bool|array{ + * path: string, + * file: string, + * width: int, + * height: int, + * mime-type: string, + * filesize: int, + * } + */ + function wp_save_image_file($filename, $image, $mime_type, $post_id) + { + } + /** + * Image preview ratio. Internal use only. + * + * @since 2.9.0 + * + * @ignore + * @param int $w Image width in pixels. + * @param int $h Image height in pixels. + * @return float|int Image preview ratio. + */ + function _image_get_preview_ratio($w, $h) + { + } + /** + * Returns an image resource. Internal use only. + * + * @since 2.9.0 + * @deprecated 3.5.0 Use WP_Image_Editor::rotate() + * @see WP_Image_Editor::rotate() + * + * @ignore + * @param resource|GdImage $img Image resource. + * @param float|int $angle Image rotation angle, in degrees. + * @return resource|GdImage|false GD image resource or GdImage instance, false otherwise. + */ + function _rotate_image_resource($img, $angle) + { + } + /** + * Flips an image resource. Internal use only. + * + * @since 2.9.0 + * @deprecated 3.5.0 Use WP_Image_Editor::flip() + * @see WP_Image_Editor::flip() + * + * @ignore + * @param resource|GdImage $img Image resource or GdImage instance. + * @param bool $horz Whether to flip horizontally. + * @param bool $vert Whether to flip vertically. + * @return resource|GdImage (maybe) flipped image resource or GdImage instance. + */ + function _flip_image_resource($img, $horz, $vert) + { + } + /** + * Crops an image resource. Internal use only. + * + * @since 2.9.0 + * + * @ignore + * @param resource|GdImage $img Image resource or GdImage instance. + * @param float $x Source point x-coordinate. + * @param float $y Source point y-coordinate. + * @param float $w Source width. + * @param float $h Source height. + * @return resource|GdImage (maybe) cropped image resource or GdImage instance. + */ + function _crop_image_resource($img, $x, $y, $w, $h) + { + } + /** + * Performs group of changes on Editor specified. + * + * @since 2.9.0 + * + * @param WP_Image_Editor $image WP_Image_Editor instance. + * @param array $changes Array of change operations. + * @return WP_Image_Editor WP_Image_Editor instance with changes applied. + */ + function image_edit_apply_changes($image, $changes) + { + } + /** + * Streams image in post to browser, along with enqueued changes + * in `$_REQUEST['history']`. + * + * @since 2.9.0 + * + * @param int $post_id Attachment post ID. + * @return bool True on success, false on failure. + */ + function stream_preview_image($post_id) + { + } + /** + * Restores the metadata for a given attachment. + * + * @since 2.9.0 + * + * @param int $post_id Attachment post ID. + * @return stdClass Image restoration message object. + */ + function wp_restore_image($post_id) + { + } + /** + * Saves image to post, along with enqueued changes + * in `$_REQUEST['history']`. + * + * @since 2.9.0 + * + * @param int $post_id Attachment post ID. + * @return stdClass + */ + function wp_save_image($post_id) + { + } + /** + * File contains all the administration image manipulation functions. + * + * @package WordPress + * @subpackage Administration + */ + /** + * Crops an image to a given size. + * + * @since 2.1.0 + * + * @param string|int $src The source file or Attachment ID. + * @param int $src_x The start x position to crop from. + * @param int $src_y The start y position to crop from. + * @param int $src_w The width to crop. + * @param int $src_h The height to crop. + * @param int $dst_w The destination width. + * @param int $dst_h The destination height. + * @param bool|false $src_abs Optional. If the source crop points are absolute. + * @param string|false $dst_file Optional. The destination file to write to. + * @return string|WP_Error New filepath on success, WP_Error on failure. + */ + function wp_crop_image($src, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = \false, $dst_file = \false) + { + } + /** + * Compare the existing image sub-sizes (as saved in the attachment meta) + * to the currently registered image sub-sizes, and return the difference. + * + * Registered sub-sizes that are larger than the image are skipped. + * + * @since 5.3.0 + * + * @param int $attachment_id The image attachment post ID. + * @return array[] Associative array of arrays of image sub-size information for + * missing image sizes, keyed by image size name. + */ + function wp_get_missing_image_subsizes($attachment_id) + { + } + /** + * If any of the currently registered image sub-sizes are missing, + * create them and update the image meta data. + * + * @since 5.3.0 + * + * @param int $attachment_id The image attachment post ID. + * @return array|WP_Error The updated image meta data array or WP_Error object + * if both the image meta and the attached file are missing. + */ + function wp_update_image_subsizes($attachment_id) + { + } + /** + * Updates the attached file and image meta data when the original image was edited. + * + * @since 5.3.0 + * @since 6.0.0 The `$filesize` value was added to the returned array. + * @access private + * + * @param array $saved_data The data returned from WP_Image_Editor after successfully saving an image. + * @param string $original_file Path to the original file. + * @param array $image_meta The image meta data. + * @param int $attachment_id The attachment post ID. + * @return array The updated image meta data. + */ + function _wp_image_meta_replace_original($saved_data, $original_file, $image_meta, $attachment_id) + { + } + /** + * Creates image sub-sizes, adds the new data to the image meta `sizes` array, and updates the image metadata. + * + * Intended for use after an image is uploaded. Saves/updates the image metadata after each + * sub-size is created. If there was an error, it is added to the returned image metadata array. + * + * @since 5.3.0 + * + * @param string $file Full path to the image file. + * @param int $attachment_id Attachment ID to process. + * @return array The image attachment meta data. + */ + function wp_create_image_subsizes($file, $attachment_id) + { + } + /** + * Low-level function to create image sub-sizes. + * + * Updates the image meta after each sub-size is created. + * Errors are stored in the returned image metadata array. + * + * @since 5.3.0 + * @access private + * + * @param array $new_sizes Array defining what sizes to create. + * @param string $file Full path to the image file. + * @param array $image_meta The attachment meta data array. + * @param int $attachment_id Attachment ID to process. + * @return array The attachment meta data with updated `sizes` array. Includes an array of errors encountered while resizing. + */ + function _wp_make_subsizes($new_sizes, $file, $image_meta, $attachment_id) + { + } + /** + * Copy parent attachment properties to newly cropped image. + * + * @since 6.5.0 + * + * @param string $cropped Path to the cropped image file. + * @param int $parent_attachment_id Parent file Attachment ID. + * @param string $context Control calling the function. + * @return array Properties of attachment. + */ + function wp_copy_parent_attachment_properties($cropped, $parent_attachment_id, $context = '') + { + } + /** + * Generates attachment meta data and create image sub-sizes for images. + * + * @since 2.1.0 + * @since 6.0.0 The `$filesize` value was added to the returned array. + * + * @param int $attachment_id Attachment ID to process. + * @param string $file Filepath of the attached image. + * @return array Metadata for attachment. + */ + function wp_generate_attachment_metadata($attachment_id, $file) + { + } + /** + * Converts a fraction string to a decimal. + * + * @since 2.5.0 + * + * @param string $str Fraction string. + * @return int|float Returns calculated fraction or integer 0 on invalid input. + */ + function wp_exif_frac2dec($str) + { + } + /** + * Converts the exif date format to a unix timestamp. + * + * @since 2.5.0 + * + * @param string $str A date string expected to be in Exif format (Y:m:d H:i:s). + * @return int|false The unix timestamp, or false on failure. + */ + function wp_exif_date2ts($str) + { + } + /** + * Gets extended image metadata, exif or iptc as available. + * + * Retrieves the EXIF metadata aperture, credit, camera, caption, copyright, iso + * created_timestamp, focal_length, shutter_speed, and title. + * + * The IPTC metadata that is retrieved is APP13, credit, byline, created date + * and time, caption, copyright, and title. Also includes FNumber, Model, + * DateTimeDigitized, FocalLength, ISOSpeedRatings, and ExposureTime. + * + * @todo Try other exif libraries if available. + * @since 2.5.0 + * + * @param string $file + * @return array|false Image metadata array on success, false on failure. + */ + function wp_read_image_metadata($file) + { + } + /** + * Validates that file is an image. + * + * @since 2.5.0 + * + * @param string $path File path to test if valid image. + * @return bool True if valid image, false if not valid image. + */ + function file_is_valid_image($path) + { + } + /** + * Validates that file is suitable for displaying within a web page. + * + * @since 2.5.0 + * + * @param string $path File path to test. + * @return bool True if suitable, false if not suitable. + */ + function file_is_displayable_image($path) + { + } + /** + * Loads an image resource for editing. + * + * @since 2.9.0 + * + * @param int $attachment_id Attachment ID. + * @param string $mime_type Image mime type. + * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array + * of width and height values in pixels (in that order). Default 'full'. + * @return resource|GdImage|false The resulting image resource or GdImage instance on success, + * false on failure. + */ + function load_image_to_edit($attachment_id, $mime_type, $size = 'full') + { + } + /** + * Retrieves the path or URL of an attachment's attached file. + * + * If the attached file is not present on the local filesystem (usually due to replication plugins), + * then the URL of the file is returned if `allow_url_fopen` is supported. + * + * @since 3.4.0 + * @access private + * + * @param int $attachment_id Attachment ID. + * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array + * of width and height values in pixels (in that order). Default 'full'. + * @return string|false File path or URL on success, false on failure. + */ + function _load_image_to_edit_path($attachment_id, $size = 'full') + { + } + /** + * Copies an existing image file. + * + * @since 3.4.0 + * @access private + * + * @param int $attachment_id Attachment ID. + * @return string|false New file path on success, false on failure. + */ + function _copy_image_file($attachment_id) + { + } + /** + * WordPress Administration Importer API. + * + * @package WordPress + * @subpackage Administration + */ + /** + * Retrieves the list of importers. + * + * @since 2.0.0 + * + * @global array $wp_importers + * @return array + */ + function get_importers() + { + } + /** + * Sorts a multidimensional array by first member of each top level member. + * + * Used by uasort() as a callback, should not be used directly. + * + * @since 2.9.0 + * @access private + * + * @param array $a + * @param array $b + * @return int + */ + function _usort_by_first_member($a, $b) + { + } + /** + * Registers importer for WordPress. + * + * @since 2.0.0 + * + * @global array $wp_importers + * + * @param string $id Importer tag. Used to uniquely identify importer. + * @param string $name Importer name and title. + * @param string $description Importer description. + * @param callable $callback Callback to run. + * @return void|WP_Error Void on success. WP_Error when $callback is WP_Error. + */ + function register_importer($id, $name, $description, $callback) + { + } + /** + * Cleanup importer. + * + * Removes attachment based on ID. + * + * @since 2.0.0 + * + * @param string $id Importer ID. + */ + function wp_import_cleanup($id) + { + } + /** + * Handles importer uploading and adds attachment. + * + * @since 2.0.0 + * + * @return array Uploaded file's details on success, error message on failure. + */ + function wp_import_handle_upload() + { + } + /** + * Returns a list from WordPress.org of popular importer plugins. + * + * @since 3.5.0 + * + * @return array Importers with metadata for each. + */ + function wp_get_popular_importers() + { + } + /** + * Helper functions for displaying a list of items in an ajaxified HTML table. + * + * @package WordPress + * @subpackage List_Table + * @since 3.1.0 + */ + /** + * Fetches an instance of a WP_List_Table class. + * + * @since 3.1.0 + * + * @global string $hook_suffix + * + * @param string $class_name The type of the list table, which is the class name. + * @param array $args Optional. Arguments to pass to the class. Accepts 'screen'. + * @return WP_List_Table|false List table object on success, false if the class does not exist. + */ + function _get_list_table($class_name, $args = array()) + { + } + /** + * Register column headers for a particular screen. + * + * @see get_column_headers(), print_column_headers(), get_hidden_columns() + * + * @since 2.7.0 + * + * @param string $screen The handle for the screen to register column headers for. This is + * usually the hook name returned by the `add_*_page()` functions. + * @param string[] $columns An array of columns with column IDs as the keys and translated + * column names as the values. + */ + function register_column_headers($screen, $columns) + { + } + /** + * Prints column headers for a particular screen. + * + * @since 2.7.0 + * + * @param string|WP_Screen $screen The screen hook name or screen object. + * @param bool $with_id Whether to set the ID attribute or not. + */ + function print_column_headers($screen, $with_id = \true) + { + } + /** + * WordPress Administration Media API. + * + * @package WordPress + * @subpackage Administration + */ + /** + * Defines the default media upload tabs. + * + * @since 2.5.0 + * + * @return string[] Default tabs. + */ + function media_upload_tabs() + { + } + /** + * Adds the gallery tab back to the tabs array if post has image attachments. + * + * @since 2.5.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array $tabs + * @return array $tabs with gallery if post has image attachment + */ + function update_gallery_tab($tabs) + { + } + /** + * Outputs the legacy media upload tabs UI. + * + * @since 2.5.0 + * + * @global string $redir_tab + */ + function the_media_upload_tabs() + { + } + /** + * Retrieves the image HTML to send to the editor. + * + * @since 2.5.0 + * + * @param int $id Image attachment ID. + * @param string $caption Image caption. + * @param string $title Image title attribute. + * @param string $align Image CSS alignment property. + * @param string $url Optional. Image src URL. Default empty. + * @param bool|string $rel Optional. Value for rel attribute or whether to add a default value. Default false. + * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array of + * width and height values in pixels (in that order). Default 'medium'. + * @param string $alt Optional. Image alt attribute. Default empty. + * @return string The HTML output to insert into the editor. + */ + function get_image_send_to_editor($id, $caption, $title, $align, $url = '', $rel = \false, $size = 'medium', $alt = '') + { + } + /** + * Adds image shortcode with caption to editor. + * + * @since 2.6.0 + * + * @param string $html The image HTML markup to send. + * @param int $id Image attachment ID. + * @param string $caption Image caption. + * @param string $title Image title attribute (not used). + * @param string $align Image CSS alignment property. + * @param string $url Image source URL (not used). + * @param string $size Image size (not used). + * @param string $alt Image `alt` attribute (not used). + * @return string The image HTML markup with caption shortcode. + */ + function image_add_caption($html, $id, $caption, $title, $align, $url, $size, $alt = '') + { + } + /** + * Private preg_replace callback used in image_add_caption(). + * + * @access private + * @since 3.4.0 + * + * @param array $matches Single regex match. + * @return string Cleaned up HTML for caption. + */ + function _cleanup_image_add_caption($matches) + { + } + /** + * Adds image HTML to editor. + * + * @since 2.5.0 + * + * @param string $html + * @phpstan-return never + */ + function media_send_to_editor($html) + { + } + /** + * Saves a file submitted from a POST request and create an attachment post for it. + * + * @since 2.5.0 + * + * @param string $file_id Index of the `$_FILES` array that the file was sent. + * @param int $post_id The post ID of a post to attach the media item to. Required, but can + * be set to 0, creating a media item that has no relationship to a post. + * @param array $post_data Optional. Overwrite some of the attachment. + * @param array $overrides Optional. Override the wp_handle_upload() behavior. + * @return int|WP_Error ID of the attachment or a WP_Error object on failure. + */ + function media_handle_upload($file_id, $post_id, $post_data = array(), $overrides = array('test_form' => \false)) + { + } + /** + * Handles a side-loaded file in the same way as an uploaded file is handled by media_handle_upload(). + * + * @since 2.6.0 + * @since 5.3.0 The `$post_id` parameter was made optional. + * + * @param string[] $file_array Array that represents a `$_FILES` upload array. + * @param int $post_id Optional. The post ID the media is associated with. + * @param string $desc Optional. Description of the side-loaded file. Default null. + * @param array $post_data Optional. Post data to override. Default empty array. + * @return int|WP_Error The ID of the attachment or a WP_Error on failure. + */ + function media_handle_sideload($file_array, $post_id = 0, $desc = \null, $post_data = array()) + { + } + /** + * Outputs the iframe to display the media upload page. + * + * @since 2.5.0 + * @since 5.3.0 Formalized the existing and already documented `...$args` parameter + * by adding it to the function signature. + * + * @global string $body_id + * + * @param callable $content_func Function that outputs the content. + * @param mixed ...$args Optional additional parameters to pass to the callback function when it's called. + */ + function wp_iframe($content_func, ...$args) + { + } + /** + * Adds the media button to the editor. + * + * @since 2.5.0 + * + * @global int $post_ID + * + * @param string $editor_id + */ + function media_buttons($editor_id = 'content') + { + } + /** + * Retrieves the upload iframe source URL. + * + * @since 3.0.0 + * + * @global int $post_ID + * + * @param string $type Media type. + * @param int $post_id Post ID. + * @param string $tab Media upload tab. + * @return string Upload iframe source URL. + */ + function get_upload_iframe_src($type = \null, $post_id = \null, $tab = \null) + { + } + /** + * Handles form submissions for the legacy media uploader. + * + * @since 2.5.0 + * + * @return null|array|void Array of error messages keyed by attachment ID, null or void on success. + */ + function media_upload_form_handler() + { + } + /** + * Handles the process of uploading media. + * + * @since 2.5.0 + * + * @return null|string + */ + function wp_media_upload_handler() + { + } + /** + * Downloads an image from the specified URL, saves it as an attachment, and optionally attaches it to a post. + * + * @since 2.6.0 + * @since 4.2.0 Introduced the `$return_type` parameter. + * @since 4.8.0 Introduced the 'id' option for the `$return_type` parameter. + * @since 5.3.0 The `$post_id` parameter was made optional. + * @since 5.4.0 The original URL of the attachment is stored in the `_source_url` + * post meta value. + * @since 5.8.0 Added 'webp' to the default list of allowed file extensions. + * + * @param string $file The URL of the image to download. + * @param int $post_id Optional. The post ID the media is to be associated with. + * @param string $desc Optional. Description of the image. + * @param string $return_type Optional. Accepts 'html' (image tag html) or 'src' (URL), + * or 'id' (attachment ID). Default 'html'. + * @return string|int|WP_Error Populated HTML img tag, attachment ID, or attachment source + * on success, WP_Error object otherwise. + */ + function media_sideload_image($file, $post_id = 0, $desc = \null, $return_type = 'html') + { + } + /** + * Retrieves the legacy media uploader form in an iframe. + * + * @since 2.5.0 + * + * @return string|null + */ + function media_upload_gallery() + { + } + /** + * Retrieves the legacy media library form in an iframe. + * + * @since 2.5.0 + * + * @return string|null + */ + function media_upload_library() + { + } + /** + * Retrieves HTML for the image alignment radio buttons with the specified one checked. + * + * @since 2.7.0 + * + * @param WP_Post $post + * @param string $checked + * @return string + */ + function image_align_input_fields($post, $checked = '') + { + } + /** + * Retrieves HTML for the size radio buttons with the specified one checked. + * + * @since 2.7.0 + * + * @param WP_Post $post + * @param bool|string $check + * @return array + */ + function image_size_input_fields($post, $check = '') + { + } + /** + * Retrieves HTML for the Link URL buttons with the default link type as specified. + * + * @since 2.7.0 + * + * @param WP_Post $post + * @param string $url_type + * @return string + */ + function image_link_input_fields($post, $url_type = '') + { + } + /** + * Outputs a textarea element for inputting an attachment caption. + * + * @since 3.4.0 + * + * @param WP_Post $edit_post Attachment WP_Post object. + * @return string HTML markup for the textarea element. + */ + function wp_caption_input_textarea($edit_post) + { + } + /** + * Retrieves the image attachment fields to edit form fields. + * + * @since 2.5.0 + * + * @param array $form_fields + * @param object $post + * @return array + */ + function image_attachment_fields_to_edit($form_fields, $post) + { + } + /** + * Retrieves the single non-image attachment fields to edit form fields. + * + * @since 2.5.0 + * + * @param array $form_fields An array of attachment form fields. + * @param WP_Post $post The WP_Post attachment object. + * @return array Filtered attachment form fields. + */ + function media_single_attachment_fields_to_edit($form_fields, $post) + { + } + /** + * Retrieves the post non-image attachment fields to edit form fields. + * + * @since 2.8.0 + * + * @param array $form_fields An array of attachment form fields. + * @param WP_Post $post The WP_Post attachment object. + * @return array Filtered attachment form fields. + */ + function media_post_single_attachment_fields_to_edit($form_fields, $post) + { + } + /** + * Retrieves the media element HTML to send to the editor. + * + * @since 2.5.0 + * + * @param string $html + * @param int $attachment_id + * @param array $attachment + * @return string + */ + function image_media_send_to_editor($html, $attachment_id, $attachment) + { + } + /** + * Retrieves the attachment fields to edit form fields. + * + * @since 2.5.0 + * + * @param WP_Post $post + * @param array $errors + * @return array + */ + function get_attachment_fields_to_edit($post, $errors = \null) + { + } + /** + * Retrieves HTML for media items of post gallery. + * + * The HTML markup retrieved will be created for the progress of SWF Upload + * component. Will also create link for showing and hiding the form to modify + * the image attachment. + * + * @since 2.5.0 + * + * @global WP_Query $wp_the_query WordPress Query object. + * + * @param int $post_id Post ID. + * @param array $errors Errors for attachment, if any. + * @return string HTML content for media items of post gallery. + */ + function get_media_items($post_id, $errors) + { + } + /** + * Retrieves HTML form for modifying the image attachment. + * + * @since 2.5.0 + * + * @global string $redir_tab + * + * @param int $attachment_id Attachment ID for modification. + * @param string|array $args Optional. Override defaults. + * @return string HTML form for attachment. + */ + function get_media_item($attachment_id, $args = \null) + { + } + /** + * @since 3.5.0 + * + * @param int $attachment_id + * @param array $args + * @return array + */ + function get_compat_media_markup($attachment_id, $args = \null) + { + } + /** + * Outputs the legacy media upload header. + * + * @since 2.5.0 + */ + function media_upload_header() + { + } + /** + * Outputs the legacy media upload form. + * + * @since 2.5.0 + * + * @global string $type + * @global string $tab + * + * @param array $errors + * @phpstan-return void + */ + function media_upload_form($errors = \null) + { + } + /** + * Outputs the legacy media upload form for a given media type. + * + * @since 2.5.0 + * + * @param string $type + * @param array $errors + * @param int|WP_Error $id + */ + function media_upload_type_form($type = 'file', $errors = \null, $id = \null) + { + } + /** + * Outputs the legacy media upload form for external media. + * + * @since 2.7.0 + * + * @param string $type + * @param object $errors + * @param int $id + */ + function media_upload_type_url_form($type = \null, $errors = \null, $id = \null) + { + } + /** + * Adds gallery form to upload iframe. + * + * @since 2.5.0 + * + * @global string $redir_tab + * @global string $type + * @global string $tab + * + * @param array $errors + */ + function media_upload_gallery_form($errors) + { + } + /** + * Outputs the legacy media upload form for the media library. + * + * @since 2.5.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * @global WP_Query $wp_query WordPress Query object. + * @global WP_Locale $wp_locale WordPress date and time locale object. + * @global string $type + * @global string $tab + * @global array $post_mime_types + * + * @param array $errors + */ + function media_upload_library_form($errors) + { + } + /** + * Creates the form for external url. + * + * @since 2.7.0 + * + * @param string $default_view + * @return string HTML content of the form. + */ + function wp_media_insert_url_form($default_view = 'image') + { + } + /** + * Displays the multi-file uploader message. + * + * @since 2.6.0 + * + * @global int $post_ID + */ + function media_upload_flash_bypass() + { + } + /** + * Displays the browser's built-in uploader message. + * + * @since 2.6.0 + */ + function media_upload_html_bypass() + { + } + /** + * Used to display a "After a file has been uploaded..." help message. + * + * @since 3.3.0 + */ + function media_upload_text_after() + { + } + /** + * Displays the checkbox to scale images. + * + * @since 3.3.0 + */ + function media_upload_max_image_resize() + { + } + /** + * Displays the out of storage quota message in Multisite. + * + * @since 3.5.0 + */ + function multisite_over_quota_message() + { + } + /** + * Displays the image and editor in the post editor + * + * @since 3.5.0 + * + * @param WP_Post $post A post object. + */ + function edit_form_image_editor($post) + { + } + /** + * Displays non-editable attachment metadata in the publish meta box. + * + * @since 3.5.0 + */ + function attachment_submitbox_metadata() + { + } + /** + * Parses ID3v2, ID3v1, and getID3 comments to extract usable data. + * + * @since 3.6.0 + * + * @param array $metadata An existing array with data. + * @param array $data Data supplied by ID3 tags. + */ + function wp_add_id3_tag_data(&$metadata, $data) + { + } + /** + * Retrieves metadata from a video file's ID3 tags. + * + * @since 3.6.0 + * + * @param string $file Path to file. + * @return array|false Returns array of metadata, if found. + */ + function wp_read_video_metadata($file) + { + } + /** + * Retrieves metadata from an audio file's ID3 tags. + * + * @since 3.6.0 + * + * @param string $file Path to file. + * @return array|false Returns array of metadata, if found. + */ + function wp_read_audio_metadata($file) + { + } + /** + * Parses creation date from media metadata. + * + * The getID3 library doesn't have a standard method for getting creation dates, + * so the location of this data can vary based on the MIME type. + * + * @since 4.9.0 + * + * @link https://github.com/JamesHeinrich/getID3/blob/master/structure.txt + * + * @param array $metadata The metadata returned by getID3::analyze(). + * @return int|false A UNIX timestamp for the media's creation date if available + * or a boolean FALSE if a timestamp could not be determined. + */ + function wp_get_media_creation_timestamp($metadata) + { + } + /** + * Encapsulates the logic for Attach/Detach actions. + * + * @since 4.2.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $parent_id Attachment parent ID. + * @param string $action Optional. Attach/detach action. Accepts 'attach' or 'detach'. + * Default 'attach'. + * @phpstan-param 'attach'|'detach' $action + * @phpstan-return void + */ + function wp_media_attach_action($parent_id, $action = 'attach') + { + } + /** + * Adds a CSS class to a string. + * + * @since 2.7.0 + * + * @param string $class_to_add The CSS class to add. + * @param string $classes The string to add the CSS class to. + * @return string The string with the CSS class added. + */ + function add_cssclass($class_to_add, $classes) + { + } + /** + * Adds CSS classes for top-level administration menu items. + * + * The list of added classes includes `.menu-top-first` and `.menu-top-last`. + * + * @since 2.7.0 + * + * @param array $menu The array of administration menu items. + * @return array The array of administration menu items with the CSS classes added. + */ + function add_menu_classes($menu) + { + } + /** + * @global array $menu_order + * @global array $default_menu_order + * + * @param array $a + * @param array $b + * @return int + */ + function sort_menu($a, $b) + { + } + /** + * WordPress Administration Meta Boxes API. + * + * @package WordPress + * @subpackage Administration + */ + // + // Post-related Meta Boxes. + // + /** + * Displays post submit form fields. + * + * @since 2.7.0 + * + * @global string $action + * + * @param WP_Post $post Current post object. + * @param array $args { + * Array of arguments for building the post submit meta box. + * + * @type string $id Meta box 'id' attribute. + * @type string $title Meta box title. + * @type callable $callback Meta box display callback. + * @type array $args Extra meta box arguments. + * } + * @phpstan-param array{ + * id?: string, + * title?: string, + * callback?: callable, + * args?: array, + * } $args + */ + function post_submit_meta_box($post, $args = array()) + { + } + /** + * Displays attachment submit form fields. + * + * @since 3.5.0 + * + * @param WP_Post $post Current post object. + */ + function attachment_submit_meta_box($post) + { + } + /** + * Displays post format form elements. + * + * @since 3.1.0 + * + * @param WP_Post $post Current post object. + * @param array $box { + * Post formats meta box arguments. + * + * @type string $id Meta box 'id' attribute. + * @type string $title Meta box title. + * @type callable $callback Meta box display callback. + * @type array $args Extra meta box arguments. + * } + * @phpstan-param array{ + * id?: string, + * title?: string, + * callback?: callable, + * args?: array, + * } $box + */ + function post_format_meta_box($post, $box) + { + } + /** + * Displays post tags form fields. + * + * @since 2.6.0 + * + * @todo Create taxonomy-agnostic wrapper for this. + * + * @param WP_Post $post Current post object. + * @param array $box { + * Tags meta box arguments. + * + * @type string $id Meta box 'id' attribute. + * @type string $title Meta box title. + * @type callable $callback Meta box display callback. + * @type array $args { + * Extra meta box arguments. + * + * @type string $taxonomy Taxonomy. Default 'post_tag'. + * } + * } + * @phpstan-param array{ + * id?: string, + * title?: string, + * callback?: callable, + * args?: array{ + * taxonomy?: string, + * }, + * } $box + */ + function post_tags_meta_box($post, $box) + { + } + /** + * Displays post categories form fields. + * + * @since 2.6.0 + * + * @todo Create taxonomy-agnostic wrapper for this. + * + * @param WP_Post $post Current post object. + * @param array $box { + * Categories meta box arguments. + * + * @type string $id Meta box 'id' attribute. + * @type string $title Meta box title. + * @type callable $callback Meta box display callback. + * @type array $args { + * Extra meta box arguments. + * + * @type string $taxonomy Taxonomy. Default 'category'. + * } + * } + * @phpstan-param array{ + * id?: string, + * title?: string, + * callback?: callable, + * args?: array{ + * taxonomy?: string, + * }, + * } $box + */ + function post_categories_meta_box($post, $box) + { + } + /** + * Displays post excerpt form fields. + * + * @since 2.6.0 + * + * @param WP_Post $post Current post object. + */ + function post_excerpt_meta_box($post) + { + } + /** + * Displays trackback links form fields. + * + * @since 2.6.0 + * + * @param WP_Post $post Current post object. + */ + function post_trackback_meta_box($post) + { + } + /** + * Displays custom fields form fields. + * + * @since 2.6.0 + * + * @param WP_Post $post Current post object. + */ + function post_custom_meta_box($post) + { + } + /** + * Displays comments status form fields. + * + * @since 2.6.0 + * + * @param WP_Post $post Current post object. + */ + function post_comment_status_meta_box($post) + { + } + /** + * Displays comments for post table header + * + * @since 3.0.0 + * + * @param array $result Table header rows. + * @return array + */ + function post_comment_meta_box_thead($result) + { + } + /** + * Displays comments for post. + * + * @since 2.8.0 + * + * @param WP_Post $post Current post object. + */ + function post_comment_meta_box($post) + { + } + /** + * Displays slug form fields. + * + * @since 2.6.0 + * + * @param WP_Post $post Current post object. + */ + function post_slug_meta_box($post) + { + } + /** + * Displays form field with list of authors. + * + * @since 2.6.0 + * + * @global int $user_ID + * + * @param WP_Post $post Current post object. + */ + function post_author_meta_box($post) + { + } + /** + * Displays list of revisions. + * + * @since 2.6.0 + * + * @param WP_Post $post Current post object. + */ + function post_revisions_meta_box($post) + { + } + // + // Page-related Meta Boxes. + // + /** + * Displays page attributes form fields. + * + * @since 2.7.0 + * + * @param WP_Post $post Current post object. + */ + function page_attributes_meta_box($post) + { + } + // + // Link-related Meta Boxes. + // + /** + * Displays link create form fields. + * + * @since 2.7.0 + * + * @param object $link Current link object. + */ + function link_submit_meta_box($link) + { + } + /** + * Displays link categories form fields. + * + * @since 2.6.0 + * + * @param object $link Current link object. + */ + function link_categories_meta_box($link) + { + } + /** + * Displays form fields for changing link target. + * + * @since 2.6.0 + * + * @param object $link Current link object. + */ + function link_target_meta_box($link) + { + } + /** + * Displays 'checked' checkboxes attribute for XFN microformat options. + * + * @since 1.0.1 + * + * @global object $link Current link object. + * + * @param string $xfn_relationship XFN relationship category. Possible values are: + * 'friendship', 'physical', 'professional', + * 'geographical', 'family', 'romantic', 'identity'. + * @param string $xfn_value Optional. The XFN value to mark as checked + * if it matches the current link's relationship. + * Default empty string. + * @param mixed $deprecated Deprecated. Not used. + */ + function xfn_check($xfn_relationship, $xfn_value = '', $deprecated = '') + { + } + /** + * Displays XFN form fields. + * + * @since 2.6.0 + * + * @param object $link Current link object. + */ + function link_xfn_meta_box($link) + { + } + /** + * Displays advanced link options form fields. + * + * @since 2.6.0 + * + * @param object $link Current link object. + */ + function link_advanced_meta_box($link) + { + } + /** + * Displays post thumbnail meta box. + * + * @since 2.9.0 + * + * @param WP_Post $post Current post object. + */ + function post_thumbnail_meta_box($post) + { + } + /** + * Displays fields for ID3 data. + * + * @since 3.9.0 + * + * @param WP_Post $post Current post object. + */ + function attachment_id3_data_meta_box($post) + { + } + /** + * Registers the default post meta boxes, and runs the `do_meta_boxes` actions. + * + * @since 5.0.0 + * + * @param WP_Post $post The post object that these meta boxes are being generated for. + */ + function register_and_do_post_meta_boxes($post) + { + } + /** + * Misc WordPress Administration API. + * + * @package WordPress + * @subpackage Administration + */ + /** + * Returns whether the server is running Apache with the mod_rewrite module loaded. + * + * @since 2.0.0 + * + * @return bool Whether the server is running Apache with the mod_rewrite module loaded. + */ + function got_mod_rewrite() + { + } + /** + * Returns whether the server supports URL rewriting. + * + * Detects Apache's mod_rewrite, IIS 7.0+ permalink support, and nginx. + * + * @since 3.7.0 + * + * @global bool $is_nginx + * @global bool $is_caddy + * + * @return bool Whether the server supports URL rewriting. + */ + function got_url_rewrite() + { + } + /** + * Extracts strings from between the BEGIN and END markers in the .htaccess file. + * + * @since 1.5.0 + * + * @param string $filename Filename to extract the strings from. + * @param string $marker The marker to extract the strings from. + * @return string[] An array of strings from a file (.htaccess) from between BEGIN and END markers. + */ + function extract_from_markers($filename, $marker) + { + } + /** + * Inserts an array of strings into a file (.htaccess), placing it between + * BEGIN and END markers. + * + * Replaces existing marked info. Retains surrounding + * data. Creates file if none exists. + * + * @since 1.5.0 + * + * @param string $filename Filename to alter. + * @param string $marker The marker to alter. + * @param array|string $insertion The new content to insert. + * @return bool True on write success, false on failure. + */ + function insert_with_markers($filename, $marker, $insertion) + { + } + /** + * Updates the htaccess file with the current rules if it is writable. + * + * Always writes to the file if it exists and is writable to ensure that we + * blank out old rules. + * + * @since 1.5.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @return bool|null True on write success, false on failure. Null in multisite. + */ + function save_mod_rewrite_rules() + { + } + /** + * Updates the IIS web.config file with the current rules if it is writable. + * If the permalinks do not require rewrite rules then the rules are deleted from the web.config file. + * + * @since 2.8.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @return bool|null True on write success, false on failure. Null in multisite. + */ + function iis7_save_url_rewrite_rules() + { + } + /** + * Updates the "recently-edited" file for the plugin or theme file editor. + * + * @since 1.5.0 + * + * @param string $file + */ + function update_recently_edited($file) + { + } + /** + * Makes a tree structure for the theme file editor's file list. + * + * @since 4.9.0 + * @access private + * + * @param array $allowed_files List of theme file paths. + * @return array Tree structure for listing theme files. + */ + function wp_make_theme_file_tree($allowed_files) + { + } + /** + * Outputs the formatted file list for the theme file editor. + * + * @since 4.9.0 + * @access private + * + * @global string $relative_file Name of the file being edited relative to the + * theme directory. + * @global string $stylesheet The stylesheet name of the theme being edited. + * + * @param array|string $tree List of file/folder paths, or filename. + * @param int $level The aria-level for the current iteration. + * @param int $size The aria-setsize for the current iteration. + * @param int $index The aria-posinset for the current iteration. + */ + function wp_print_theme_file_tree($tree, $level = 2, $size = 1, $index = 1) + { + } + /** + * Makes a tree structure for the plugin file editor's file list. + * + * @since 4.9.0 + * @access private + * + * @param array $plugin_editable_files List of plugin file paths. + * @return array Tree structure for listing plugin files. + */ + function wp_make_plugin_file_tree($plugin_editable_files) + { + } + /** + * Outputs the formatted file list for the plugin file editor. + * + * @since 4.9.0 + * @access private + * + * @param array|string $tree List of file/folder paths, or filename. + * @param string $label Name of file or folder to print. + * @param int $level The aria-level for the current iteration. + * @param int $size The aria-setsize for the current iteration. + * @param int $index The aria-posinset for the current iteration. + */ + function wp_print_plugin_file_tree($tree, $label = '', $level = 2, $size = 1, $index = 1) + { + } + /** + * Flushes rewrite rules if `siteurl`, `home` or `page_on_front` changed. + * + * @since 2.1.0 + * + * @param string $old_value + * @param string $value + * @phpstan-return void + */ + function update_home_siteurl($old_value, $value) + { + } + /** + * Resets global variables based on `$_GET` and `$_POST`. + * + * This function resets global variables based on the names passed + * in the `$vars` array to the value of `$_POST[$var]` or `$_GET[$var]` or an + * empty string if neither is defined. + * + * @since 2.0.0 + * + * @param array $vars An array of globals to reset. + */ + function wp_reset_vars($vars) + { + } + /** + * Displays the given administration message. + * + * @since 2.1.0 + * + * @param string|WP_Error $message + */ + function show_message($message) + { + } + /** + * @since 2.8.0 + * + * @param string $content + * @return array + */ + function wp_doc_link_parse($content) + { + } + /** + * Saves option for number of rows when listing posts, pages, comments, etc. + * + * @since 2.8.0 + * @phpstan-return void + */ + function set_screen_options() + { + } + /** + * Checks if rewrite rule for WordPress already exists in the IIS 7+ configuration file. + * + * @since 2.8.0 + * + * @param string $filename The file path to the configuration file. + * @return bool + */ + function iis7_rewrite_rule_exists($filename) + { + } + /** + * Deletes WordPress rewrite rule from web.config file if it exists there. + * + * @since 2.8.0 + * + * @param string $filename Name of the configuration file. + * @return bool + */ + function iis7_delete_rewrite_rule($filename) + { + } + /** + * Adds WordPress rewrite rule to the IIS 7+ configuration file. + * + * @since 2.8.0 + * + * @param string $filename The file path to the configuration file. + * @param string $rewrite_rule The XML fragment with URL Rewrite rule. + * @return bool + */ + function iis7_add_rewrite_rule($filename, $rewrite_rule) + { + } + /** + * Saves the XML document into a file. + * + * @since 2.8.0 + * + * @param DOMDocument $doc + * @param string $filename + */ + function saveDomDocument($doc, $filename) + { + } + /** + * Displays the default admin color scheme picker (Used in user-edit.php). + * + * @since 3.0.0 + * + * @global array $_wp_admin_css_colors + * + * @param int $user_id User ID. + */ + function admin_color_scheme_picker($user_id) + { + } + /** + * + * @global array $_wp_admin_css_colors + */ + function wp_color_scheme_settings() + { + } + /** + * Displays the viewport meta in the admin. + * + * @since 5.5.0 + * @phpstan-return void + */ + function wp_admin_viewport_meta() + { + } + /** + * Adds viewport meta for mobile in Customizer. + * + * Hooked to the {@see 'admin_viewport_meta'} filter. + * + * @since 5.5.0 + * + * @param string $viewport_meta The viewport meta. + * @return string Filtered viewport meta. + */ + function _customizer_mobile_viewport_meta($viewport_meta) + { + } + /** + * Checks lock status for posts displayed on the Posts screen. + * + * @since 3.6.0 + * + * @param array $response The Heartbeat response. + * @param array $data The $_POST data sent. + * @param string $screen_id The screen ID. + * @return array The Heartbeat response. + */ + function wp_check_locked_posts($response, $data, $screen_id) + { + } + /** + * Checks lock status on the New/Edit Post screen and refresh the lock. + * + * @since 3.6.0 + * + * @param array $response The Heartbeat response. + * @param array $data The $_POST data sent. + * @param string $screen_id The screen ID. + * @return array The Heartbeat response. + */ + function wp_refresh_post_lock($response, $data, $screen_id) + { + } + /** + * Checks nonce expiration on the New/Edit Post screen and refresh if needed. + * + * @since 3.6.0 + * + * @param array $response The Heartbeat response. + * @param array $data The $_POST data sent. + * @param string $screen_id The screen ID. + * @return array The Heartbeat response. + */ + function wp_refresh_post_nonces($response, $data, $screen_id) + { + } + /** + * Refresh nonces used with meta boxes in the block editor. + * + * @since 6.1.0 + * + * @param array $response The Heartbeat response. + * @param array $data The $_POST data sent. + * @return array The Heartbeat response. + */ + function wp_refresh_metabox_loader_nonces($response, $data) + { + } + /** + * Adds the latest Heartbeat and REST API nonce to the Heartbeat response. + * + * @since 5.0.0 + * + * @param array $response The Heartbeat response. + * @return array The Heartbeat response. + */ + function wp_refresh_heartbeat_nonces($response) + { + } + /** + * Disables suspension of Heartbeat on the Add/Edit Post screens. + * + * @since 3.8.0 + * + * @global string $pagenow The filename of the current screen. + * + * @param array $settings An array of Heartbeat settings. + * @return array Filtered Heartbeat settings. + */ + function wp_heartbeat_set_suspension($settings) + { + } + /** + * Performs autosave with heartbeat. + * + * @since 3.9.0 + * + * @param array $response The Heartbeat response. + * @param array $data The $_POST data sent. + * @return array The Heartbeat response. + */ + function heartbeat_autosave($response, $data) + { + } + /** + * Removes single-use URL parameters and create canonical link based on new URL. + * + * Removes specific query string parameters from a URL, create the canonical link, + * put it in the admin header, and change the current URL to match. + * + * @since 4.2.0 + * @phpstan-return void + */ + function wp_admin_canonical_url() + { + } + /** + * Sends a referrer policy header so referrers are not sent externally from administration screens. + * + * @since 4.9.0 + */ + function wp_admin_headers() + { + } + /** + * Outputs JS that reloads the page if the user navigated to it with the Back or Forward button. + * + * Used on the Edit Post and Add New Post screens. Needed to ensure the page is not loaded from browser cache, + * so the post title and editor content are the last saved versions. Ideally this script should run first in the head. + * + * @since 4.6.0 + */ + function wp_page_reload_on_back_button_js() + { + } + /** + * Sends a confirmation request email when a change of site admin email address is attempted. + * + * The new site admin address will not become active until confirmed. + * + * @since 3.0.0 + * @since 4.9.0 This function was moved from wp-admin/includes/ms.php so it's no longer Multisite specific. + * + * @param string $old_value The old site admin email address. + * @param string $value The proposed new site admin email address. + * @phpstan-return void + */ + function update_option_new_admin_email($old_value, $value) + { + } + /** + * Appends '(Draft)' to draft page titles in the privacy page dropdown + * so that unpublished content is obvious. + * + * @since 4.9.8 + * @access private + * + * @param string $title Page title. + * @param WP_Post $page Page data object. + * @return string Page title. + */ + function _wp_privacy_settings_filter_draft_page_titles($title, $page) + { + } + /** + * Checks if the user needs to update PHP. + * + * @since 5.1.0 + * @since 5.1.1 Added the {@see 'wp_is_php_version_acceptable'} filter. + * + * @return array|false { + * Array of PHP version data. False on failure. + * + * @type string $recommended_version The PHP version recommended by WordPress. + * @type string $minimum_version The minimum required PHP version. + * @type bool $is_supported Whether the PHP version is actively supported. + * @type bool $is_secure Whether the PHP version receives security updates. + * @type bool $is_acceptable Whether the PHP version is still acceptable or warnings + * should be shown and an update recommended. + * } + * @phpstan-return false|array{ + * recommended_version: string, + * minimum_version: string, + * is_supported: bool, + * is_secure: bool, + * is_acceptable: bool, + * } + */ + function wp_check_php_version() + { + } + /** + * Multisite: Deprecated admin functions from past versions and WordPress MU + * + * These functions should not be used and will be removed in a later version. + * It is suggested to use for the alternatives instead when available. + * + * @package WordPress + * @subpackage Deprecated + * @since 3.0.0 + */ + /** + * Outputs the WPMU menu. + * + * @deprecated 3.0.0 + */ + function wpmu_menu() + { + } + /** + * Determines if the available space defined by the admin has been exceeded by the user. + * + * @deprecated 3.0.0 Use is_upload_space_available() + * @see is_upload_space_available() + */ + function wpmu_checkAvailableSpace() + { + } + /** + * WPMU options. + * + * @deprecated 3.0.0 + */ + function mu_options($options) + { + } + /** + * Deprecated functionality for activating a network-only plugin. + * + * @deprecated 3.0.0 Use activate_plugin() + * @see activate_plugin() + */ + function activate_sitewide_plugin() + { + } + /** + * Deprecated functionality for deactivating a network-only plugin. + * + * @deprecated 3.0.0 Use deactivate_plugin() + * @see deactivate_plugin() + */ + function deactivate_sitewide_plugin($plugin = \false) + { + } + /** + * Deprecated functionality for determining if the current plugin is network-only. + * + * @deprecated 3.0.0 Use is_network_only_plugin() + * @see is_network_only_plugin() + */ + function is_wpmu_sitewide_plugin($file) + { + } + /** + * Deprecated functionality for getting themes network-enabled themes. + * + * @deprecated 3.4.0 Use WP_Theme::get_allowed_on_network() + * @see WP_Theme::get_allowed_on_network() + */ + function get_site_allowed_themes() + { + } + /** + * Deprecated functionality for getting themes allowed on a specific site. + * + * @deprecated 3.4.0 Use WP_Theme::get_allowed_on_site() + * @see WP_Theme::get_allowed_on_site() + */ + function wpmu_get_blog_allowedthemes($blog_id = 0) + { + } + /** + * Deprecated functionality for determining whether a file is deprecated. + * + * @deprecated 3.5.0 + */ + function ms_deprecated_blogs_file() + { + } + /** + * Install global terms. + * + * @since 3.0.0 + * @since 6.1.0 This function no longer does anything. + * @deprecated 6.1.0 + */ + function install_global_terms() + { + } + /** + * Synchronizes category and post tag slugs when global terms are enabled. + * + * @since 3.0.0 + * @since 6.1.0 This function no longer does anything. + * @deprecated 6.1.0 + * + * @param WP_Term|array $term The term. + * @param string $taxonomy The taxonomy for `$term`. + * @return WP_Term|array Always returns `$term`. + */ + function sync_category_tag_slugs($term, $taxonomy) + { + } + /** + * Multisite administration functions. + * + * @package WordPress + * @subpackage Multisite + * @since 3.0.0 + */ + /** + * Determines whether uploaded file exceeds space quota. + * + * @since 3.0.0 + * + * @param array $file An element from the `$_FILES` array for a given file. + * @return array The `$_FILES` array element with 'error' key set if file exceeds quota. 'error' is empty otherwise. + */ + function check_upload_size($file) + { + } + /** + * Deletes a site. + * + * @since 3.0.0 + * @since 5.1.0 Use wp_delete_site() internally to delete the site row from the database. + * + * @param int $blog_id Site ID. + * @param bool $drop True if site's database tables should be dropped. Default false. + */ + function wpmu_delete_blog($blog_id, $drop = \false) + { + } + /** + * Deletes a user and all of their posts from the network. + * + * This function: + * + * - Deletes all posts (of all post types) authored by the user on all sites on the network + * - Deletes all links owned by the user on all sites on the network + * - Removes the user from all sites on the network + * - Deletes the user from the database + * + * @since 3.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $id The user ID. + * @return bool True if the user was deleted, false otherwise. + */ + function wpmu_delete_user($id) + { + } + /** + * Checks whether a site has used its allotted upload space. + * + * @since MU (3.0.0) + * + * @param bool $display_message Optional. If set to true and the quota is exceeded, + * a warning message is displayed. Default true. + * @return bool True if user is over upload space quota, otherwise false. + */ + function upload_is_user_over_quota($display_message = \true) + { + } + /** + * Displays the amount of disk space used by the current site. Not used in core. + * + * @since MU (3.0.0) + */ + function display_space_usage() + { + } + /** + * Gets the remaining upload space for this site. + * + * @since MU (3.0.0) + * + * @param int $size Current max size in bytes. + * @return int Max size in bytes. + */ + function fix_import_form_size($size) + { + } + /** + * Displays the site upload space quota setting form on the Edit Site Settings screen. + * + * @since 3.0.0 + * + * @param int $id The ID of the site to display the setting for. + */ + function upload_space_setting($id) + { + } + /** + * Cleans the user cache for a specific user. + * + * @since 3.0.0 + * + * @param int $id The user ID. + * @return int|false The ID of the refreshed user or false if the user does not exist. + */ + function refresh_user_details($id) + { + } + /** + * Returns the language for a language code. + * + * @since 3.0.0 + * + * @param string $code Optional. The two-letter language code. Default empty. + * @return string The language corresponding to $code if it exists. If it does not exist, + * then the first two letters of $code is returned. + */ + function format_code_lang($code = '') + { + } + /** + * Displays an access denied message when a user tries to view a site's dashboard they + * do not have access to. + * + * @since 3.2.0 + * @access private + * @phpstan-return void + */ + function _access_denied_splash() + { + } + /** + * Checks if the current user has permissions to import new users. + * + * @since 3.0.0 + * + * @param string $permission A permission to be checked. Currently not used. + * @return bool True if the user has proper permissions, false if they do not. + */ + function check_import_new_users($permission) + { + } + // See "import_allow_fetch_attachments" and "import_attachment_size_limit" filters too. + /** + * Generates and displays a drop-down of available languages. + * + * @since 3.0.0 + * + * @param string[] $lang_files Optional. An array of the language files. Default empty array. + * @param string $current Optional. The current language code. Default empty. + */ + function mu_dropdown_languages($lang_files = array(), $current = '') + { + } + /** + * Displays an admin notice to upgrade all sites after a core upgrade. + * + * @since 3.0.0 + * + * @global int $wp_db_version WordPress database version. + * @global string $pagenow The filename of the current screen. + * + * @return void|false Void on success. False if the current user is not a super admin. + */ + function site_admin_notice() + { + } + /** + * Avoids a collision between a site slug and a permalink slug. + * + * In a subdirectory installation this will make sure that a site and a post do not use the + * same subdirectory by checking for a site with the same name as a new post. + * + * @since 3.0.0 + * + * @param array $data An array of post data. + * @param array $postarr An array of posts. Not currently used. + * @return array The new array of post data after checking for collisions. + */ + function avoid_blog_page_permalink_collision($data, $postarr) + { + } + /** + * Handles the display of choosing a user's primary site. + * + * This displays the user's primary site and allows the user to choose + * which site is primary. + * + * @since 3.0.0 + */ + function choose_primary_blog() + { + } + /** + * Determines whether or not this network from this page can be edited. + * + * By default editing of network is restricted to the Network Admin for that `$network_id`. + * This function allows for this to be overridden. + * + * @since 3.1.0 + * + * @param int $network_id The network ID to check. + * @return bool True if network can be edited, false otherwise. + */ + function can_edit_network($network_id) + { + } + /** + * Prints thickbox image paths for Network Admin. + * + * @since 3.1.0 + * + * @access private + */ + function _thickbox_path_admin_subfolder() + { + } + /** + * @param array $users + * @return bool + */ + function confirm_delete_users($users) + { + } + /** + * Prints JavaScript in the header on the Network Settings screen. + * + * @since 4.1.0 + */ + function network_settings_add_js() + { + } + /** + * Outputs the HTML for a network's "Edit Site" tabular interface. + * + * @since 4.6.0 + * + * @global string $pagenow The filename of the current screen. + * + * @param array $args { + * Optional. Array or string of Query parameters. Default empty array. + * + * @type int $blog_id The site ID. Default is the current site. + * @type array $links The tabs to include with (label|url|cap) keys. + * @type string $selected The ID of the selected link. + * } + * @phpstan-param array{ + * blog_id?: int, + * links?: array, + * selected?: string, + * } $args + */ + function network_edit_site_nav($args = array()) + { + } + /** + * Returns the arguments for the help tab on the Edit Site screens. + * + * @since 4.9.0 + * + * @return array Help tab arguments. + */ + function get_site_screen_help_tab_args() + { + } + /** + * Returns the content for the help sidebar on the Edit Site screens. + * + * @since 4.9.0 + * + * @return string Help sidebar content. + */ + function get_site_screen_help_sidebar_content() + { + } + /** + * Prints the appropriate response to a menu quick search. + * + * @since 3.0.0 + * + * @param array $request The unsanitized request values. + * @phpstan-return void + */ + function _wp_ajax_menu_quick_search($request = array()) + { + } + /** + * Register nav menu meta boxes and advanced menu items. + * + * @since 3.0.0 + */ + function wp_nav_menu_setup() + { + } + /** + * Limit the amount of meta boxes to pages, posts, links, and categories for first time users. + * + * @since 3.0.0 + * + * @global array $wp_meta_boxes Global meta box state. + * @phpstan-return void + */ + function wp_initial_nav_menu_meta_boxes() + { + } + /** + * Creates meta boxes for any post type menu item.. + * + * @since 3.0.0 + * @phpstan-return void + */ + function wp_nav_menu_post_type_meta_boxes() + { + } + /** + * Creates meta boxes for any taxonomy menu item. + * + * @since 3.0.0 + * @phpstan-return void + */ + function wp_nav_menu_taxonomy_meta_boxes() + { + } + /** + * Check whether to disable the Menu Locations meta box submit button and inputs. + * + * @since 3.6.0 + * @since 5.3.1 The `$display` parameter was added. + * + * @global bool $one_theme_location_no_menus to determine if no menus exist + * + * @param int|string $nav_menu_selected_id ID, name, or slug of the currently selected menu. + * @param bool $display Whether to display or just return the string. + * @return string|false Disabled attribute if at least one menu exists, false if not. + */ + function wp_nav_menu_disabled_check($nav_menu_selected_id, $display = \true) + { + } + /** + * Displays a meta box for the custom links menu item. + * + * @since 3.0.0 + * + * @global int $_nav_menu_placeholder + * @global int|string $nav_menu_selected_id + */ + function wp_nav_menu_item_link_meta_box() + { + } + /** + * Displays a meta box for a post type menu item. + * + * @since 3.0.0 + * + * @global int $_nav_menu_placeholder + * @global int|string $nav_menu_selected_id + * + * @param string $data_object Not used. + * @param array $box { + * Post type menu item meta box arguments. + * + * @type string $id Meta box 'id' attribute. + * @type string $title Meta box title. + * @type callable $callback Meta box display callback. + * @type WP_Post_Type $args Extra meta box arguments (the post type object for this meta box). + * } + * @phpstan-param array{ + * id?: string, + * title?: string, + * callback?: callable, + * args?: WP_Post_Type, + * } $box + * @phpstan-return void + */ + function wp_nav_menu_item_post_type_meta_box($data_object, $box) + { + } + /** + * Displays a meta box for a taxonomy menu item. + * + * @since 3.0.0 + * + * @global int|string $nav_menu_selected_id + * + * @param string $data_object Not used. + * @param array $box { + * Taxonomy menu item meta box arguments. + * + * @type string $id Meta box 'id' attribute. + * @type string $title Meta box title. + * @type callable $callback Meta box display callback. + * @type object $args Extra meta box arguments (the taxonomy object for this meta box). + * } + * @phpstan-param array{ + * id?: string, + * title?: string, + * callback?: callable, + * args?: object, + * } $box + * @phpstan-return void + */ + function wp_nav_menu_item_taxonomy_meta_box($data_object, $box) + { + } + /** + * Save posted nav menu item data. + * + * @since 3.0.0 + * + * @param int $menu_id The menu ID for which to save this item. Value of 0 makes a draft, orphaned menu item. Default 0. + * @param array[] $menu_data The unsanitized POSTed menu item data. + * @return int[] The database IDs of the items saved + */ + function wp_save_nav_menu_items($menu_id = 0, $menu_data = array()) + { + } + /** + * Adds custom arguments to some of the meta box object types. + * + * @since 3.0.0 + * + * @access private + * + * @param object $data_object The post type or taxonomy meta-object. + * @return object The post type or taxonomy object. + */ + function _wp_nav_menu_meta_box_object($data_object = \null) + { + } + /** + * Returns the menu formatted to edit. + * + * @since 3.0.0 + * + * @param int $menu_id Optional. The ID of the menu to format. Default 0. + * @return string|WP_Error The menu formatted to edit or error object on failure. + */ + function wp_get_nav_menu_to_edit($menu_id = 0) + { + } + /** + * Returns the columns for the nav menus page. + * + * @since 3.0.0 + * + * @return string[] Array of column titles keyed by their column name. + */ + function wp_nav_menu_manage_columns() + { + } + /** + * Deletes orphaned draft menu items + * + * @access private + * @since 3.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + */ + function _wp_delete_orphaned_draft_menu_items() + { + } + /** + * Saves nav menu items. + * + * @since 3.6.0 + * + * @param int|string $nav_menu_selected_id ID, slug, or name of the currently-selected menu. + * @param string $nav_menu_selected_title Title of the currently-selected menu. + * @return string[] The menu updated messages. + */ + function wp_nav_menu_update_menu_items($nav_menu_selected_id, $nav_menu_selected_title) + { + } + /** + * If a JSON blob of navigation menu data is in POST data, expand it and inject + * it into `$_POST` to avoid PHP `max_input_vars` limitations. See #14134. + * + * @ignore + * @since 4.5.3 + * @access private + * @phpstan-return void + */ + function _wp_expand_nav_menu_post_data() + { + } + /** + * WordPress Network Administration API. + * + * @package WordPress + * @subpackage Administration + * @since 4.4.0 + */ + /** + * Check for an existing network. + * + * @since 3.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return string|false Base domain if network exists, otherwise false. + */ + function network_domain_check() + { + } + /** + * Allow subdomain installation + * + * @since 3.0.0 + * @return bool Whether subdomain installation is allowed + */ + function allow_subdomain_install() + { + } + /** + * Allow subdirectory installation. + * + * @since 3.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return bool Whether subdirectory installation is allowed + */ + function allow_subdirectory_install() + { + } + /** + * Get base domain of network. + * + * @since 3.0.0 + * @return string Base domain. + */ + function get_clean_basedomain() + { + } + /** + * Prints step 1 for Network installation process. + * + * @todo Realistically, step 1 should be a welcome screen explaining what a Network is and such. + * Navigating to Tools > Network should not be a sudden "Welcome to a new install process! + * Fill this out and click here." See also contextual help todo. + * + * @since 3.0.0 + * + * @global bool $is_apache + * + * @param false|WP_Error $errors Optional. Error object. Default false. + */ + function network_step1($errors = \false) + { + } + /** + * Prints step 2 for Network installation process. + * + * @since 3.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * @global bool $is_nginx Whether the server software is Nginx or something else. + * + * @param false|WP_Error $errors Optional. Error object. Default false. + */ + function network_step2($errors = \false) + { + } + /** + * WordPress Options Administration API. + * + * @package WordPress + * @subpackage Administration + * @since 4.4.0 + */ + /** + * Output JavaScript to toggle display of additional settings if avatars are disabled. + * + * @since 4.2.0 + */ + function options_discussion_add_js() + { + } + /** + * Display JavaScript on the page. + * + * @since 3.5.0 + */ + function options_general_add_js() + { + } + /** + * Display JavaScript on the page. + * + * @since 3.5.0 + */ + function options_reading_add_js() + { + } + /** + * Render the site charset setting. + * + * @since 3.5.0 + */ + function options_reading_blog_charset() + { + } + /** + * WordPress Plugin Install Administration API + * + * @package WordPress + * @subpackage Administration + */ + /** + * Retrieves plugin installer pages from the WordPress.org Plugins API. + * + * It is possible for a plugin to override the Plugin API result with three + * filters. Assume this is for plugins, which can extend on the Plugin Info to + * offer more choices. This is very powerful and must be used with care when + * overriding the filters. + * + * The first filter, {@see 'plugins_api_args'}, is for the args and gives the action + * as the second parameter. The hook for {@see 'plugins_api_args'} must ensure that + * an object is returned. + * + * The second filter, {@see 'plugins_api'}, allows a plugin to override the WordPress.org + * Plugin Installation API entirely. If `$action` is 'query_plugins' or 'plugin_information', + * an object MUST be passed. If `$action` is 'hot_tags' or 'hot_categories', an array MUST + * be passed. + * + * Finally, the third filter, {@see 'plugins_api_result'}, makes it possible to filter the + * response object or array, depending on the `$action` type. + * + * Supported arguments per action: + * + * | Argument Name | query_plugins | plugin_information | hot_tags | hot_categories | + * | -------------------- | :-----------: | :----------------: | :------: | :------------: | + * | `$slug` | No | Yes | No | No | + * | `$per_page` | Yes | No | No | No | + * | `$page` | Yes | No | No | No | + * | `$number` | No | No | Yes | Yes | + * | `$search` | Yes | No | No | No | + * | `$tag` | Yes | No | No | No | + * | `$author` | Yes | No | No | No | + * | `$user` | Yes | No | No | No | + * | `$browse` | Yes | No | No | No | + * | `$locale` | Yes | Yes | No | No | + * | `$installed_plugins` | Yes | No | No | No | + * | `$is_ssl` | Yes | Yes | No | No | + * | `$fields` | Yes | Yes | No | No | + * + * @since 2.7.0 + * + * @param string $action API action to perform: 'query_plugins', 'plugin_information', + * 'hot_tags' or 'hot_categories'. + * @param array|object $args { + * Optional. Array or object of arguments to serialize for the Plugin Info API. + * + * @type string $slug The plugin slug. Default empty. + * @type int $per_page Number of plugins per page. Default 24. + * @type int $page Number of current page. Default 1. + * @type int $number Number of tags or categories to be queried. + * @type string $search A search term. Default empty. + * @type string $tag Tag to filter plugins. Default empty. + * @type string $author Username of an plugin author to filter plugins. Default empty. + * @type string $user Username to query for their favorites. Default empty. + * @type string $browse Browse view: 'popular', 'new', 'beta', 'recommended'. + * @type string $locale Locale to provide context-sensitive results. Default is the value + * of get_locale(). + * @type string $installed_plugins Installed plugins to provide context-sensitive results. + * @type bool $is_ssl Whether links should be returned with https or not. Default false. + * @type array $fields { + * Array of fields which should or should not be returned. + * + * @type bool $short_description Whether to return the plugin short description. Default true. + * @type bool $description Whether to return the plugin full description. Default false. + * @type bool $sections Whether to return the plugin readme sections: description, installation, + * FAQ, screenshots, other notes, and changelog. Default false. + * @type bool $tested Whether to return the 'Compatible up to' value. Default true. + * @type bool $requires Whether to return the required WordPress version. Default true. + * @type bool $requires_php Whether to return the required PHP version. Default true. + * @type bool $rating Whether to return the rating in percent and total number of ratings. + * Default true. + * @type bool $ratings Whether to return the number of rating for each star (1-5). Default true. + * @type bool $downloaded Whether to return the download count. Default true. + * @type bool $downloadlink Whether to return the download link for the package. Default true. + * @type bool $last_updated Whether to return the date of the last update. Default true. + * @type bool $added Whether to return the date when the plugin was added to the wordpress.org + * repository. Default true. + * @type bool $tags Whether to return the assigned tags. Default true. + * @type bool $compatibility Whether to return the WordPress compatibility list. Default true. + * @type bool $homepage Whether to return the plugin homepage link. Default true. + * @type bool $versions Whether to return the list of all available versions. Default false. + * @type bool $donate_link Whether to return the donation link. Default true. + * @type bool $reviews Whether to return the plugin reviews. Default false. + * @type bool $banners Whether to return the banner images links. Default false. + * @type bool $icons Whether to return the icon links. Default false. + * @type bool $active_installs Whether to return the number of active installations. Default false. + * @type bool $group Whether to return the assigned group. Default false. + * @type bool $contributors Whether to return the list of contributors. Default false. + * } + * } + * @return object|array|WP_Error Response object or array on success, WP_Error on failure. See the + * {@link https://developer.wordpress.org/reference/functions/plugins_api/ function reference article} + * for more information on the make-up of possible return values depending on the value of `$action`. + * @phpstan-param 'query_plugins'|'plugin_information'|'hot_tags'|'hot_categories' $action + * @phpstan-param object|array{ + * slug?: string, + * per_page?: int, + * page?: int, + * number?: int, + * search?: string, + * tag?: string, + * author?: string, + * user?: string, + * browse?: string, + * locale?: string, + * installed_plugins?: string, + * is_ssl?: bool, + * fields?: array{ + * short_description?: bool, + * description?: bool, + * sections?: bool, + * tested?: bool, + * requires?: bool, + * requires_php?: bool, + * rating?: bool, + * ratings?: bool, + * downloaded?: bool, + * downloadlink?: bool, + * last_updated?: bool, + * added?: bool, + * tags?: bool, + * compatibility?: bool, + * homepage?: bool, + * versions?: bool, + * donate_link?: bool, + * reviews?: bool, + * banners?: bool, + * icons?: bool, + * active_installs?: bool, + * group?: bool, + * contributors?: bool, + * }, + * } $args + */ + function plugins_api($action, $args = array()) + { + } + /** + * Retrieves popular WordPress plugin tags. + * + * @since 2.7.0 + * + * @param array $args + * @return array|WP_Error + */ + function install_popular_tags($args = array()) + { + } + /** + * Displays the Featured tab of Add Plugins screen. + * + * @since 2.7.0 + */ + function install_dashboard() + { + } + /** + * Displays a search form for searching plugins. + * + * @since 2.7.0 + * @since 4.6.0 The `$type_selector` parameter was deprecated. + * + * @param bool $deprecated Not used. + */ + function install_search_form($deprecated = \true) + { + } + /** + * Displays a form to upload plugins from zip files. + * + * @since 2.8.0 + */ + function install_plugins_upload() + { + } + /** + * Shows a username form for the favorites page. + * + * @since 3.5.0 + */ + function install_plugins_favorites_form() + { + } + /** + * Displays plugin content based on plugin list. + * + * @since 2.7.0 + * + * @global WP_List_Table $wp_list_table + * @phpstan-return void + */ + function display_plugins_table() + { + } + /** + * Determines the status we can perform on a plugin. + * + * @since 3.0.0 + * + * @param array|object $api Data about the plugin retrieved from the API. + * @param bool $loop Optional. Disable further loops. Default false. + * @return array { + * Plugin installation status data. + * + * @type string $status Status of a plugin. Could be one of 'install', 'update_available', 'latest_installed' or 'newer_installed'. + * @type string $url Plugin installation URL. + * @type string $version The most recent version of the plugin. + * @type string $file Plugin filename relative to the plugins directory. + * } + * @phpstan-return array{ + * status: string, + * url: string, + * version: string, + * file: string, + * } + */ + function install_plugin_install_status($api, $loop = \false) + { + } + /** + * Displays plugin information in dialog box form. + * + * @since 2.7.0 + * + * @global string $tab + * @phpstan-return void + */ + function install_plugin_information() + { + } + /** + * Gets the markup for the plugin install action button. + * + * @since 6.5.0 + * + * @param string $name Plugin name. + * @param array|object $data { + * An array or object of plugin data. Can be retrieved from the API. + * + * @type string $slug The plugin slug. + * @type string[] $requires_plugins An array of plugin dependency slugs. + * @type string $version The plugin's version string. Used when getting the install status. + * } + * @param bool $compatible_php The result of a PHP compatibility check. + * @param bool $compatible_wp The result of a WP compatibility check. + * @return string The markup for the dependency row button. An empty string if the user does not have capabilities. + * @phpstan-param object|array{ + * slug?: string, + * requires_plugins?: string[], + * version?: string, + * } $data + */ + function wp_get_plugin_action_button($name, $data, $compatible_php, $compatible_wp) + { + } + /** + * WordPress Plugin Administration API + * + * @package WordPress + * @subpackage Administration + */ + /** + * Parses the plugin contents to retrieve plugin's metadata. + * + * All plugin headers must be on their own line. Plugin description must not have + * any newlines, otherwise only parts of the description will be displayed. + * The below is formatted for printing. + * + * /* + * Plugin Name: Name of the plugin. + * Plugin URI: The home page of the plugin. + * Description: Plugin description. + * Author: Plugin author's name. + * Author URI: Link to the author's website. + * Version: Plugin version. + * Text Domain: Optional. Unique identifier, should be same as the one used in + * load_plugin_textdomain(). + * Domain Path: Optional. Only useful if the translations are located in a + * folder above the plugin's base path. For example, if .mo files are + * located in the locale folder then Domain Path will be "/locale/" and + * must have the first slash. Defaults to the base folder the plugin is + * located in. + * Network: Optional. Specify "Network: true" to require that a plugin is activated + * across all sites in an installation. This will prevent a plugin from being + * activated on a single site when Multisite is enabled. + * Requires at least: Optional. Specify the minimum required WordPress version. + * Requires PHP: Optional. Specify the minimum required PHP version. + * * / # Remove the space to close comment. + * + * The first 8 KB of the file will be pulled in and if the plugin data is not + * within that first 8 KB, then the plugin author should correct their plugin + * and move the plugin data headers to the top. + * + * The plugin file is assumed to have permissions to allow for scripts to read + * the file. This is not checked however and the file is only opened for + * reading. + * + * @since 1.5.0 + * @since 5.3.0 Added support for `Requires at least` and `Requires PHP` headers. + * @since 5.8.0 Added support for `Update URI` header. + * @since 6.5.0 Added support for `Requires Plugins` header. + * + * @param string $plugin_file Absolute path to the main plugin file. + * @param bool $markup Optional. If the returned data should have HTML markup applied. + * Default true. + * @param bool $translate Optional. If the returned data should be translated. Default true. + * @return array { + * Plugin data. Values will be empty if not supplied by the plugin. + * + * @type string $Name Name of the plugin. Should be unique. + * @type string $PluginURI Plugin URI. + * @type string $Version Plugin version. + * @type string $Description Plugin description. + * @type string $Author Plugin author's name. + * @type string $AuthorURI Plugin author's website address (if set). + * @type string $TextDomain Plugin textdomain. + * @type string $DomainPath Plugin's relative directory path to .mo files. + * @type bool $Network Whether the plugin can only be activated network-wide. + * @type string $RequiresWP Minimum required version of WordPress. + * @type string $RequiresPHP Minimum required version of PHP. + * @type string $UpdateURI ID of the plugin for update purposes, should be a URI. + * @type string $RequiresPlugins Comma separated list of dot org plugin slugs. + * @type string $Title Title of the plugin and link to the plugin's site (if set). + * @type string $AuthorName Plugin author's name. + * } + * @phpstan-return array{ + * Name: string, + * PluginURI: string, + * Version: string, + * Description: string, + * Author: string, + * AuthorURI: string, + * TextDomain: string, + * DomainPath: string, + * Network: bool, + * RequiresWP: string, + * RequiresPHP: string, + * UpdateURI: string, + * RequiresPlugins: string, + * Title: string, + * AuthorName: string, + * } + */ + function get_plugin_data($plugin_file, $markup = \true, $translate = \true) + { + } + /** + * Sanitizes plugin data, optionally adds markup, optionally translates. + * + * @since 2.7.0 + * + * @see get_plugin_data() + * + * @access private + * + * @param string $plugin_file Path to the main plugin file. + * @param array $plugin_data An array of plugin data. See get_plugin_data(). + * @param bool $markup Optional. If the returned data should have HTML markup applied. + * Default true. + * @param bool $translate Optional. If the returned data should be translated. Default true. + * @return array Plugin data. Values will be empty if not supplied by the plugin. + * See get_plugin_data() for the list of possible values. + */ + function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup = \true, $translate = \true) + { + } + /** + * Gets a list of a plugin's files. + * + * @since 2.8.0 + * + * @param string $plugin Path to the plugin file relative to the plugins directory. + * @return string[] Array of file names relative to the plugin root. + */ + function get_plugin_files($plugin) + { + } + /** + * Checks the plugins directory and retrieve all plugin files with plugin data. + * + * WordPress only supports plugin files in the base plugins directory + * (wp-content/plugins) and in one directory above the plugins directory + * (wp-content/plugins/my-plugin). The file it looks for has the plugin data + * and must be found in those two locations. It is recommended to keep your + * plugin files in their own directories. + * + * The file with the plugin data is the file that will be included and therefore + * needs to have the main execution for the plugin. This does not mean + * everything must be contained in the file and it is recommended that the file + * be split for maintainability. Keep everything in one file for extreme + * optimization purposes. + * + * @since 1.5.0 + * + * @param string $plugin_folder Optional. Relative path to single plugin folder. + * @return array[] Array of arrays of plugin data, keyed by plugin file name. See get_plugin_data(). + */ + function get_plugins($plugin_folder = '') + { + } + /** + * Checks the mu-plugins directory and retrieve all mu-plugin files with any plugin data. + * + * WordPress only includes mu-plugin files in the base mu-plugins directory (wp-content/mu-plugins). + * + * @since 3.0.0 + * @return array[] Array of arrays of mu-plugin data, keyed by plugin file name. See get_plugin_data(). + */ + function get_mu_plugins() + { + } + /** + * Declares a callback to sort array by a 'Name' key. + * + * @since 3.1.0 + * + * @access private + * + * @param array $a array with 'Name' key. + * @param array $b array with 'Name' key. + * @return int Return 0 or 1 based on two string comparison. + */ + function _sort_uname_callback($a, $b) + { + } + /** + * Checks the wp-content directory and retrieve all drop-ins with any plugin data. + * + * @since 3.0.0 + * @return array[] Array of arrays of dropin plugin data, keyed by plugin file name. See get_plugin_data(). + */ + function get_dropins() + { + } + /** + * Returns drop-in plugins that WordPress uses. + * + * Includes Multisite drop-ins only when is_multisite() + * + * @since 3.0.0 + * + * @return array[] { + * Key is file name. The value is an array of data about the drop-in. + * + * @type array ...$0 { + * Data about the drop-in. + * + * @type string $0 The purpose of the drop-in. + * @type string|true $1 Name of the constant that must be true for the drop-in + * to be used, or true if no constant is required. + * } + * } + * @phpstan-return array<int|string, array{ + * 0: string, + * 1: string|true, + * }> + */ + function _get_dropins() + { + } + /** + * Determines whether a plugin is active. + * + * Only plugins installed in the plugins/ folder can be active. + * + * Plugins in the mu-plugins/ folder can't be "activated," so this function will + * return false for those plugins. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 2.5.0 + * + * @param string $plugin Path to the plugin file relative to the plugins directory. + * @return bool True, if in the active plugins list. False, not in the list. + */ + function is_plugin_active($plugin) + { + } + /** + * Determines whether the plugin is inactive. + * + * Reverse of is_plugin_active(). Used as a callback. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 3.1.0 + * + * @see is_plugin_active() + * + * @param string $plugin Path to the plugin file relative to the plugins directory. + * @return bool True if inactive. False if active. + */ + function is_plugin_inactive($plugin) + { + } + /** + * Determines whether the plugin is active for the entire network. + * + * Only plugins installed in the plugins/ folder can be active. + * + * Plugins in the mu-plugins/ folder can't be "activated," so this function will + * return false for those plugins. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 3.0.0 + * + * @param string $plugin Path to the plugin file relative to the plugins directory. + * @return bool True if active for the network, otherwise false. + */ + function is_plugin_active_for_network($plugin) + { + } + /** + * Checks for "Network: true" in the plugin header to see if this should + * be activated only as a network wide plugin. The plugin would also work + * when Multisite is not enabled. + * + * Checks for "Site Wide Only: true" for backward compatibility. + * + * @since 3.0.0 + * + * @param string $plugin Path to the plugin file relative to the plugins directory. + * @return bool True if plugin is network only, false otherwise. + */ + function is_network_only_plugin($plugin) + { + } + /** + * Attempts activation of plugin in a "sandbox" and redirects on success. + * + * A plugin that is already activated will not attempt to be activated again. + * + * The way it works is by setting the redirection to the error before trying to + * include the plugin file. If the plugin fails, then the redirection will not + * be overwritten with the success message. Also, the options will not be + * updated and the activation hook will not be called on plugin error. + * + * It should be noted that in no way the below code will actually prevent errors + * within the file. The code should not be used elsewhere to replicate the + * "sandbox", which uses redirection to work. + * {@source 13 1} + * + * If any errors are found or text is outputted, then it will be captured to + * ensure that the success redirection will update the error redirection. + * + * @since 2.5.0 + * @since 5.2.0 Test for WordPress version and PHP version compatibility. + * + * @param string $plugin Path to the plugin file relative to the plugins directory. + * @param string $redirect Optional. URL to redirect to. + * @param bool $network_wide Optional. Whether to enable the plugin for all sites in the network + * or just the current site. Multisite only. Default false. + * @param bool $silent Optional. Whether to prevent calling activation hooks. Default false. + * @return null|WP_Error Null on success, WP_Error on invalid file. + */ + function activate_plugin($plugin, $redirect = '', $network_wide = \false, $silent = \false) + { + } + /** + * Deactivates a single plugin or multiple plugins. + * + * The deactivation hook is disabled by the plugin upgrader by using the $silent + * parameter. + * + * @since 2.5.0 + * + * @param string|string[] $plugins Single plugin or list of plugins to deactivate. + * @param bool $silent Prevent calling deactivation hooks. Default false. + * @param bool|null $network_wide Whether to deactivate the plugin for all sites in the network. + * A value of null will deactivate plugins for both the network + * and the current site. Multisite only. Default null. + */ + function deactivate_plugins($plugins, $silent = \false, $network_wide = \null) + { + } + /** + * Activates multiple plugins. + * + * When WP_Error is returned, it does not mean that one of the plugins had + * errors. It means that one or more of the plugin file paths were invalid. + * + * The execution will be halted as soon as one of the plugins has an error. + * + * @since 2.6.0 + * + * @param string|string[] $plugins Single plugin or list of plugins to activate. + * @param string $redirect Redirect to page after successful activation. + * @param bool $network_wide Whether to enable the plugin for all sites in the network. + * Default false. + * @param bool $silent Prevent calling activation hooks. Default false. + * @return true|WP_Error True when finished or WP_Error if there were errors during a plugin activation. + */ + function activate_plugins($plugins, $redirect = '', $network_wide = \false, $silent = \false) + { + } + /** + * Removes directory and files of a plugin for a list of plugins. + * + * @since 2.6.0 + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @param string[] $plugins List of plugin paths to delete, relative to the plugins directory. + * @param string $deprecated Not used. + * @return bool|null|WP_Error True on success, false if `$plugins` is empty, `WP_Error` on failure. + * `null` if filesystem credentials are required to proceed. + */ + function delete_plugins($plugins, $deprecated = '') + { + } + /** + * Validates active plugins. + * + * Validate all active plugins, deactivates invalid and + * returns an array of deactivated ones. + * + * @since 2.5.0 + * @return WP_Error[] Array of plugin errors keyed by plugin file name. + */ + function validate_active_plugins() + { + } + /** + * Validates the plugin path. + * + * Checks that the main plugin file exists and is a valid plugin. See validate_file(). + * + * @since 2.5.0 + * + * @param string $plugin Path to the plugin file relative to the plugins directory. + * @return int|WP_Error 0 on success, WP_Error on failure. + */ + function validate_plugin($plugin) + { + } + /** + * Validates the plugin requirements for WordPress version and PHP version. + * + * Uses the information from `Requires at least`, `Requires PHP` and `Requires Plugins` headers + * defined in the plugin's main PHP file. + * + * @since 5.2.0 + * @since 5.3.0 Added support for reading the headers from the plugin's + * main PHP file, with `readme.txt` as a fallback. + * @since 5.8.0 Removed support for using `readme.txt` as a fallback. + * @since 6.5.0 Added support for the 'Requires Plugins' header. + * + * @param string $plugin Path to the plugin file relative to the plugins directory. + * @return true|WP_Error True if requirements are met, WP_Error on failure. + */ + function validate_plugin_requirements($plugin) + { + } + /** + * Determines whether the plugin can be uninstalled. + * + * @since 2.7.0 + * + * @param string $plugin Path to the plugin file relative to the plugins directory. + * @return bool Whether plugin can be uninstalled. + */ + function is_uninstallable_plugin($plugin) + { + } + /** + * Uninstalls a single plugin. + * + * Calls the uninstall hook, if it is available. + * + * @since 2.7.0 + * + * @param string $plugin Path to the plugin file relative to the plugins directory. + * @return true|void True if a plugin's uninstall.php file has been found and included. + * Void otherwise. + */ + function uninstall_plugin($plugin) + { + } + // + // Menu. + // + /** + * Adds a top-level menu page. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @since 1.5.0 + * + * @global array $menu + * @global array $admin_page_hooks + * @global array $_registered_pages + * @global array $_parent_pages + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected. + * @param string $menu_title The text to be used for the menu. + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by. Should be unique for this menu page and only + * include lowercase alphanumeric, dashes, and underscores characters to be compatible + * with sanitize_key(). + * @param callable $callback Optional. The function to be called to output the content for this page. + * @param string $icon_url Optional. The URL to the icon to be used for this menu. + * * Pass a base64-encoded SVG using a data URI, which will be colored to match + * the color scheme. This should begin with 'data:image/svg+xml;base64,'. + * * Pass the name of a Dashicons helper class to use a font icon, + * e.g. 'dashicons-chart-pie'. + * * Pass 'none' to leave div.wp-menu-image empty so an icon can be added via CSS. + * @param int|float $position Optional. The position in the menu order this item should appear. + * @return string The resulting page's hook_suffix. + */ + function add_menu_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $icon_url = '', $position = \null) + { + } + /** + * Adds a submenu page. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @since 1.5.0 + * @since 5.3.0 Added the `$position` parameter. + * + * @global array $submenu + * @global array $menu + * @global array $_wp_real_parent_file + * @global bool $_wp_submenu_nopriv + * @global array $_registered_pages + * @global array $_parent_pages + * + * @param string $parent_slug The slug name for the parent menu (or the file name of a standard + * WordPress admin page). + * @param string $page_title The text to be displayed in the title tags of the page when the menu + * is selected. + * @param string $menu_title The text to be used for the menu. + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by. Should be unique for this menu + * and only include lowercase alphanumeric, dashes, and underscores characters + * to be compatible with sanitize_key(). + * @param callable $callback Optional. The function to be called to output the content for this page. + * @param int|float $position Optional. The position in the menu order this item should appear. + * @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required. + * @phpstan-param ''|callable $callback + */ + function add_submenu_page($parent_slug, $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \null) + { + } + /** + * Adds a submenu page to the Tools main menu. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @since 1.5.0 + * @since 5.3.0 Added the `$position` parameter. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected. + * @param string $menu_title The text to be used for the menu. + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). + * @param callable $callback Optional. The function to be called to output the content for this page. + * @param int $position Optional. The position in the menu order this item should appear. + * @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required. + */ + function add_management_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \null) + { + } + /** + * Adds a submenu page to the Settings main menu. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @since 1.5.0 + * @since 5.3.0 Added the `$position` parameter. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected. + * @param string $menu_title The text to be used for the menu. + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). + * @param callable $callback Optional. The function to be called to output the content for this page. + * @param int $position Optional. The position in the menu order this item should appear. + * @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required. + */ + function add_options_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \null) + { + } + /** + * Adds a submenu page to the Appearance main menu. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @since 2.0.0 + * @since 5.3.0 Added the `$position` parameter. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected. + * @param string $menu_title The text to be used for the menu. + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). + * @param callable $callback Optional. The function to be called to output the content for this page. + * @param int $position Optional. The position in the menu order this item should appear. + * @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required. + */ + function add_theme_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \null) + { + } + /** + * Adds a submenu page to the Plugins main menu. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @since 3.0.0 + * @since 5.3.0 Added the `$position` parameter. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected. + * @param string $menu_title The text to be used for the menu. + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). + * @param callable $callback Optional. The function to be called to output the content for this page. + * @param int $position Optional. The position in the menu order this item should appear. + * @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required. + */ + function add_plugins_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \null) + { + } + /** + * Adds a submenu page to the Users/Profile main menu. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @since 2.1.3 + * @since 5.3.0 Added the `$position` parameter. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected. + * @param string $menu_title The text to be used for the menu. + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). + * @param callable $callback Optional. The function to be called to output the content for this page. + * @param int $position Optional. The position in the menu order this item should appear. + * @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required. + */ + function add_users_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \null) + { + } + /** + * Adds a submenu page to the Dashboard main menu. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @since 2.7.0 + * @since 5.3.0 Added the `$position` parameter. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected. + * @param string $menu_title The text to be used for the menu. + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). + * @param callable $callback Optional. The function to be called to output the content for this page. + * @param int $position Optional. The position in the menu order this item should appear. + * @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required. + */ + function add_dashboard_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \null) + { + } + /** + * Adds a submenu page to the Posts main menu. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @since 2.7.0 + * @since 5.3.0 Added the `$position` parameter. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected. + * @param string $menu_title The text to be used for the menu. + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). + * @param callable $callback Optional. The function to be called to output the content for this page. + * @param int $position Optional. The position in the menu order this item should appear. + * @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required. + */ + function add_posts_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \null) + { + } + /** + * Adds a submenu page to the Media main menu. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @since 2.7.0 + * @since 5.3.0 Added the `$position` parameter. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected. + * @param string $menu_title The text to be used for the menu. + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). + * @param callable $callback Optional. The function to be called to output the content for this page. + * @param int $position Optional. The position in the menu order this item should appear. + * @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required. + */ + function add_media_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \null) + { + } + /** + * Adds a submenu page to the Links main menu. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @since 2.7.0 + * @since 5.3.0 Added the `$position` parameter. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected. + * @param string $menu_title The text to be used for the menu. + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). + * @param callable $callback Optional. The function to be called to output the content for this page. + * @param int $position Optional. The position in the menu order this item should appear. + * @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required. + */ + function add_links_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \null) + { + } + /** + * Adds a submenu page to the Pages main menu. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @since 2.7.0 + * @since 5.3.0 Added the `$position` parameter. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected. + * @param string $menu_title The text to be used for the menu. + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). + * @param callable $callback Optional. The function to be called to output the content for this page. + * @param int $position Optional. The position in the menu order this item should appear. + * @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required. + */ + function add_pages_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \null) + { + } + /** + * Adds a submenu page to the Comments main menu. + * + * This function takes a capability which will be used to determine whether + * or not a page is included in the menu. + * + * The function which is hooked in to handle the output of the page must check + * that the user has the required capability as well. + * + * @since 2.7.0 + * @since 5.3.0 Added the `$position` parameter. + * + * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected. + * @param string $menu_title The text to be used for the menu. + * @param string $capability The capability required for this menu to be displayed to the user. + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). + * @param callable $callback Optional. The function to be called to output the content for this page. + * @param int $position Optional. The position in the menu order this item should appear. + * @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required. + */ + function add_comments_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = \null) + { + } + /** + * Removes a top-level admin menu. + * + * Example usage: + * + * - `remove_menu_page( 'tools.php' )` + * - `remove_menu_page( 'plugin_menu_slug' )` + * + * @since 3.1.0 + * + * @global array $menu + * + * @param string $menu_slug The slug of the menu. + * @return array|false The removed menu on success, false if not found. + */ + function remove_menu_page($menu_slug) + { + } + /** + * Removes an admin submenu. + * + * Example usage: + * + * - `remove_submenu_page( 'themes.php', 'nav-menus.php' )` + * - `remove_submenu_page( 'tools.php', 'plugin_submenu_slug' )` + * - `remove_submenu_page( 'plugin_menu_slug', 'plugin_submenu_slug' )` + * + * @since 3.1.0 + * + * @global array $submenu + * + * @param string $menu_slug The slug for the parent menu. + * @param string $submenu_slug The slug of the submenu. + * @return array|false The removed submenu on success, false if not found. + */ + function remove_submenu_page($menu_slug, $submenu_slug) + { + } + /** + * Gets the URL to access a particular menu page based on the slug it was registered with. + * + * If the slug hasn't been registered properly, no URL will be returned. + * + * @since 3.0.0 + * + * @global array $_parent_pages + * + * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). + * @param bool $display Optional. Whether or not to display the URL. Default true. + * @return string The menu page URL. + */ + function menu_page_url($menu_slug, $display = \true) + { + } + // + // Pluggable Menu Support -- Private. + // + /** + * Gets the parent file of the current admin page. + * + * @since 1.5.0 + * + * @global string $parent_file + * @global array $menu + * @global array $submenu + * @global string $pagenow The filename of the current screen. + * @global string $typenow The post type of the current screen. + * @global string $plugin_page + * @global array $_wp_real_parent_file + * @global array $_wp_menu_nopriv + * @global array $_wp_submenu_nopriv + * + * @param string $parent_page Optional. The slug name for the parent menu (or the file name + * of a standard WordPress admin page). Default empty string. + * @return string The parent file of the current admin page. + */ + function get_admin_page_parent($parent_page = '') + { + } + /** + * Gets the title of the current admin page. + * + * @since 1.5.0 + * + * @global string $title The title of the current screen. + * @global array $menu + * @global array $submenu + * @global string $pagenow The filename of the current screen. + * @global string $typenow The post type of the current screen. + * @global string $plugin_page + * + * @return string The title of the current admin page. + */ + function get_admin_page_title() + { + } + /** + * Gets the hook attached to the administrative page of a plugin. + * + * @since 1.5.0 + * + * @param string $plugin_page The slug name of the plugin page. + * @param string $parent_page The slug name for the parent menu (or the file name of a standard + * WordPress admin page). + * @return string|null Hook attached to the plugin page, null otherwise. + */ + function get_plugin_page_hook($plugin_page, $parent_page) + { + } + /** + * Gets the hook name for the administrative page of a plugin. + * + * @since 1.5.0 + * + * @global array $admin_page_hooks + * + * @param string $plugin_page The slug name of the plugin page. + * @param string $parent_page The slug name for the parent menu (or the file name of a standard + * WordPress admin page). + * @return string Hook name for the plugin page. + */ + function get_plugin_page_hookname($plugin_page, $parent_page) + { + } + /** + * Determines whether the current user can access the current admin page. + * + * @since 1.5.0 + * + * @global string $pagenow The filename of the current screen. + * @global array $menu + * @global array $submenu + * @global array $_wp_menu_nopriv + * @global array $_wp_submenu_nopriv + * @global string $plugin_page + * @global array $_registered_pages + * + * @return bool True if the current user can access the admin page, false otherwise. + */ + function user_can_access_admin_page() + { + } + /* Allowed list functions */ + /** + * Refreshes the value of the allowed options list available via the 'allowed_options' hook. + * + * See the {@see 'allowed_options'} filter. + * + * @since 2.7.0 + * @since 5.5.0 `$new_whitelist_options` was renamed to `$new_allowed_options`. + * Please consider writing more inclusive code. + * + * @global array $new_allowed_options + * + * @param array $options + * @return array + */ + function option_update_filter($options) + { + } + /** + * Adds an array of options to the list of allowed options. + * + * @since 5.5.0 + * + * @global array $allowed_options + * + * @param array $new_options + * @param string|array $options + * @return array + */ + function add_allowed_options($new_options, $options = '') + { + } + /** + * Removes a list of options from the allowed options list. + * + * @since 5.5.0 + * + * @global array $allowed_options + * + * @param array $del_options + * @param string|array $options + * @return array + */ + function remove_allowed_options($del_options, $options = '') + { + } + /** + * Outputs nonce, action, and option_page fields for a settings page. + * + * @since 2.7.0 + * + * @param string $option_group A settings group name. This should match the group name + * used in register_setting(). + */ + function settings_fields($option_group) + { + } + /** + * Clears the plugins cache used by get_plugins() and by default, the plugin updates cache. + * + * @since 3.7.0 + * + * @param bool $clear_update_cache Whether to clear the plugin updates cache. Default true. + */ + function wp_clean_plugins_cache($clear_update_cache = \true) + { + } + /** + * Loads a given plugin attempt to generate errors. + * + * @since 3.0.0 + * @since 4.4.0 Function was moved into the `wp-admin/includes/plugin.php` file. + * + * @param string $plugin Path to the plugin file relative to the plugins directory. + */ + function plugin_sandbox_scrape($plugin) + { + } + /** + * Declares a helper function for adding content to the Privacy Policy Guide. + * + * Plugins and themes should suggest text for inclusion in the site's privacy policy. + * The suggested text should contain information about any functionality that affects user privacy, + * and will be shown on the Privacy Policy Guide screen. + * + * A plugin or theme can use this function multiple times as long as it will help to better present + * the suggested policy content. For example modular plugins such as WooCommerse or Jetpack + * can add or remove suggested content depending on the modules/extensions that are enabled. + * For more information see the Plugin Handbook: + * https://developer.wordpress.org/plugins/privacy/suggesting-text-for-the-site-privacy-policy/. + * + * The HTML contents of the `$policy_text` supports use of a specialized `.privacy-policy-tutorial` + * CSS class which can be used to provide supplemental information. Any content contained within + * HTML elements that have the `.privacy-policy-tutorial` CSS class applied will be omitted + * from the clipboard when the section content is copied. + * + * Intended for use with the `'admin_init'` action. + * + * @since 4.9.6 + * + * @param string $plugin_name The name of the plugin or theme that is suggesting content + * for the site's privacy policy. + * @param string $policy_text The suggested content for inclusion in the policy. + * @phpstan-return void + */ + function wp_add_privacy_policy_content($plugin_name, $policy_text) + { + } + /** + * Determines whether a plugin is technically active but was paused while + * loading. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 5.2.0 + * + * @global WP_Paused_Extensions_Storage $_paused_plugins + * + * @param string $plugin Path to the plugin file relative to the plugins directory. + * @return bool True, if in the list of paused plugins. False, if not in the list. + */ + function is_plugin_paused($plugin) + { + } + /** + * Gets the error that was recorded for a paused plugin. + * + * @since 5.2.0 + * + * @global WP_Paused_Extensions_Storage $_paused_plugins + * + * @param string $plugin Path to the plugin file relative to the plugins directory. + * @return array|false Array of error information as returned by `error_get_last()`, + * or false if none was recorded. + */ + function wp_get_plugin_error($plugin) + { + } + /** + * Tries to resume a single plugin. + * + * If a redirect was provided, we first ensure the plugin does not throw fatal + * errors anymore. + * + * The way it works is by setting the redirection to the error before trying to + * include the plugin file. If the plugin fails, then the redirection will not + * be overwritten with the success message and the plugin will not be resumed. + * + * @since 5.2.0 + * + * @param string $plugin Single plugin to resume. + * @param string $redirect Optional. URL to redirect to. Default empty string. + * @return true|WP_Error True on success, false if `$plugin` was not paused, + * `WP_Error` on failure. + */ + function resume_plugin($plugin, $redirect = '') + { + } + /** + * Renders an admin notice in case some plugins have been paused due to errors. + * + * @since 5.2.0 + * + * @global string $pagenow The filename of the current screen. + * @global WP_Paused_Extensions_Storage $_paused_plugins + * @phpstan-return void + */ + function paused_plugins_notice() + { + } + /** + * Renders an admin notice when a plugin was deactivated during an update. + * + * Displays an admin notice in case a plugin has been deactivated during an + * upgrade due to incompatibility with the current version of WordPress. + * + * @since 5.8.0 + * @access private + * + * @global string $pagenow The filename of the current screen. + * @global string $wp_version The WordPress version string. + * @phpstan-return void + */ + function deactivated_plugins_notice() + { + } + /** + * WordPress Post Administration API. + * + * @package WordPress + * @subpackage Administration + */ + /** + * Renames `$_POST` data from form names to DB post columns. + * + * Manipulates `$_POST` directly. + * + * @since 2.6.0 + * + * @param bool $update Whether the post already exists. + * @param array|null $post_data Optional. The array of post data to process. + * Defaults to the `$_POST` superglobal. + * @return array|WP_Error Array of post data on success, WP_Error on failure. + */ + function _wp_translate_postdata($update = \false, $post_data = \null) + { + } + /** + * Returns only allowed post data fields. + * + * @since 5.0.1 + * + * @param array|WP_Error|null $post_data The array of post data to process, or an error object. + * Defaults to the `$_POST` superglobal. + * @return array|WP_Error Array of post data on success, WP_Error on failure. + */ + function _wp_get_allowed_postdata($post_data = \null) + { + } + /** + * Updates an existing post with values provided in `$_POST`. + * + * If post data is passed as an argument, it is treated as an array of data + * keyed appropriately for turning into a post object. + * + * If post data is not passed, the `$_POST` global variable is used instead. + * + * @since 1.5.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array|null $post_data Optional. The array of post data to process. + * Defaults to the `$_POST` superglobal. + * @return int Post ID. + */ + function edit_post($post_data = \null) + { + } + /** + * Processes the post data for the bulk editing of posts. + * + * Updates all bulk edited posts/pages, adding (but not removing) tags and + * categories. Skips pages when they would be their own parent or child. + * + * @since 2.7.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array|null $post_data Optional. The array of post data to process. + * Defaults to the `$_POST` superglobal. + * @return array + */ + function bulk_edit_posts($post_data = \null) + { + } + /** + * Returns default post information to use when populating the "Write Post" form. + * + * @since 2.0.0 + * + * @param string $post_type Optional. A post type string. Default 'post'. + * @param bool $create_in_db Optional. Whether to insert the post into database. Default false. + * @return WP_Post Post object containing all the default post data as attributes + */ + function get_default_post_to_edit($post_type = 'post', $create_in_db = \false) + { + } + /** + * Determines if a post exists based on title, content, date and type. + * + * @since 2.0.0 + * @since 5.2.0 Added the `$type` parameter. + * @since 5.8.0 Added the `$status` parameter. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $title Post title. + * @param string $content Optional. Post content. + * @param string $date Optional. Post date. + * @param string $type Optional. Post type. + * @param string $status Optional. Post status. + * @return int Post ID if post exists, 0 otherwise. + */ + function post_exists($title, $content = '', $date = '', $type = '', $status = '') + { + } + /** + * Creates a new post from the "Write Post" form using `$_POST` information. + * + * @since 2.1.0 + * + * @global WP_User $current_user + * + * @return int|WP_Error Post ID on success, WP_Error on failure. + */ + function wp_write_post() + { + } + /** + * Calls wp_write_post() and handles the errors. + * + * @since 2.0.0 + * + * @return int|void Post ID on success, void on failure. + */ + function write_post() + { + } + // + // Post Meta. + // + /** + * Adds post meta data defined in the `$_POST` superglobal for a post with given ID. + * + * @since 1.2.0 + * + * @param int $post_id + * @return int|bool + */ + function add_meta($post_id) + { + } + /** + * Deletes post meta data by meta ID. + * + * @since 1.2.0 + * + * @param int $mid + * @return bool + */ + function delete_meta($mid) + { + } + /** + * Returns a list of previously defined keys. + * + * @since 1.2.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return string[] Array of meta key names. + */ + function get_meta_keys() + { + } + /** + * Returns post meta data by meta ID. + * + * @since 2.1.0 + * + * @param int $mid + * @return object|bool + */ + function get_post_meta_by_id($mid) + { + } + /** + * Returns meta data for the given post ID. + * + * @since 1.2.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $post_id A post ID. + * @return array[] { + * Array of meta data arrays for the given post ID. + * + * @type array ...$0 { + * Associative array of meta data. + * + * @type string $meta_key Meta key. + * @type mixed $meta_value Meta value. + * @type string $meta_id Meta ID as a numeric string. + * @type string $post_id Post ID as a numeric string. + * } + * } + * @phpstan-return array<int|string, array{ + * meta_key: string, + * meta_value: mixed, + * meta_id: string, + * post_id: string, + * }> + */ + function has_meta($post_id) + { + } + /** + * Updates post meta data by meta ID. + * + * @since 1.2.0 + * + * @param int $meta_id Meta ID. + * @param string $meta_key Meta key. Expect slashed. + * @param string $meta_value Meta value. Expect slashed. + * @return bool + */ + function update_meta($meta_id, $meta_key, $meta_value) + { + } + // + // Private. + // + /** + * Replaces hrefs of attachment anchors with up-to-date permalinks. + * + * @since 2.3.0 + * @access private + * + * @param int|WP_Post $post Post ID or post object. + * @return void|int|WP_Error Void if nothing fixed. 0 or WP_Error on update failure. The post ID on update success. + */ + function _fix_attachment_links($post) + { + } + /** + * Returns all the possible statuses for a post type. + * + * @since 2.5.0 + * + * @param string $type The post_type you want the statuses for. Default 'post'. + * @return string[] An array of all the statuses for the supplied post type. + */ + function get_available_post_statuses($type = 'post') + { + } + /** + * Runs the query to fetch the posts for listing on the edit posts page. + * + * @since 2.5.0 + * + * @param array|false $q Optional. Array of query variables to use to build the query. + * Defaults to the `$_GET` superglobal. + * @return array + */ + function wp_edit_posts_query($q = \false) + { + } + /** + * Returns the query variables for the current attachments request. + * + * @since 4.2.0 + * + * @param array|false $q Optional. Array of query variables to use to build the query. + * Defaults to the `$_GET` superglobal. + * @return array The parsed query vars. + */ + function wp_edit_attachments_query_vars($q = \false) + { + } + /** + * Executes a query for attachments. An array of WP_Query arguments + * can be passed in, which will override the arguments set by this function. + * + * @since 2.5.0 + * + * @param array|false $q Optional. Array of query variables to use to build the query. + * Defaults to the `$_GET` superglobal. + * @return array + */ + function wp_edit_attachments_query($q = \false) + { + } + /** + * Returns the list of classes to be used by a meta box. + * + * @since 2.5.0 + * + * @param string $box_id Meta box ID (used in the 'id' attribute for the meta box). + * @param string $screen_id The screen on which the meta box is shown. + * @return string Space-separated string of class names. + */ + function postbox_classes($box_id, $screen_id) + { + } + /** + * Returns a sample permalink based on the post name. + * + * @since 2.5.0 + * + * @param int|WP_Post $post Post ID or post object. + * @param string|null $title Optional. Title to override the post's current title + * when generating the post name. Default null. + * @param string|null $name Optional. Name to override the post name. Default null. + * @return array { + * Array containing the sample permalink with placeholder for the post name, and the post name. + * + * @type string $0 The permalink with placeholder for the post name. + * @type string $1 The post name. + * } + * @phpstan-return array{ + * 0: string, + * 1: string, + * } + */ + function get_sample_permalink($post, $title = \null, $name = \null) + { + } + /** + * Returns the HTML of the sample permalink slug editor. + * + * @since 2.5.0 + * + * @param int|WP_Post $post Post ID or post object. + * @param string|null $new_title Optional. New title. Default null. + * @param string|null $new_slug Optional. New slug. Default null. + * @return string The HTML of the sample permalink slug editor. + */ + function get_sample_permalink_html($post, $new_title = \null, $new_slug = \null) + { + } + /** + * Returns HTML for the post thumbnail meta box. + * + * @since 2.9.0 + * + * @param int|null $thumbnail_id Optional. Thumbnail attachment ID. Default null. + * @param int|WP_Post|null $post Optional. The post ID or object associated + * with the thumbnail. Defaults to global $post. + * @return string The post thumbnail HTML. + */ + function _wp_post_thumbnail_html($thumbnail_id = \null, $post = \null) + { + } + /** + * Determines whether the post is currently being edited by another user. + * + * @since 2.5.0 + * + * @param int|WP_Post $post ID or object of the post to check for editing. + * @return int|false ID of the user with lock. False if the post does not exist, post is not locked, + * the user with lock does not exist, or the post is locked by current user. + */ + function wp_check_post_lock($post) + { + } + /** + * Marks the post as currently being edited by the current user. + * + * @since 2.5.0 + * + * @param int|WP_Post $post ID or object of the post being edited. + * @return array|false { + * Array of the lock time and user ID. False if the post does not exist, or there + * is no current user. + * + * @type int $0 The current time as a Unix timestamp. + * @type int $1 The ID of the current user. + * } + * @phpstan-return false|array{ + * 0: int, + * 1: int, + * } + */ + function wp_set_post_lock($post) + { + } + /** + * Outputs the HTML for the notice to say that someone else is editing or has taken over editing of this post. + * + * @since 2.8.5 + * @phpstan-return void + */ + function _admin_notice_post_locked() + { + } + /** + * Creates autosave data for the specified post from `$_POST` data. + * + * @since 2.6.0 + * + * @param array|int $post_data Associative array containing the post data, or integer post ID. + * If a numeric post ID is provided, will use the `$_POST` superglobal. + * @return int|WP_Error The autosave revision ID. WP_Error or 0 on error. + */ + function wp_create_post_autosave($post_data) + { + } + /** + * Autosave the revisioned meta fields. + * + * Iterates through the revisioned meta fields and checks each to see if they are set, + * and have a changed value. If so, the meta value is saved and attached to the autosave. + * + * @since 6.4.0 + * + * @param array $new_autosave The new post data being autosaved. + */ + function wp_autosave_post_revisioned_meta_fields($new_autosave) + { + } + /** + * Saves a draft or manually autosaves for the purpose of showing a post preview. + * + * @since 2.7.0 + * + * @return string URL to redirect to show the preview. + */ + function post_preview() + { + } + /** + * Saves a post submitted with XHR. + * + * Intended for use with heartbeat and autosave.js + * + * @since 3.9.0 + * + * @param array $post_data Associative array of the submitted post data. + * @return mixed The value 0 or WP_Error on failure. The saved post ID on success. + * The ID can be the draft post_id or the autosave revision post_id. + */ + function wp_autosave($post_data) + { + } + /** + * Redirects to previous page. + * + * @since 2.7.0 + * + * @param int $post_id Optional. Post ID. + * @phpstan-return never + */ + function redirect_post($post_id = '') + { + } + /** + * Sanitizes POST values from a checkbox taxonomy metabox. + * + * @since 5.1.0 + * + * @param string $taxonomy The taxonomy name. + * @param array $terms Raw term data from the 'tax_input' field. + * @return int[] Array of sanitized term IDs. + */ + function taxonomy_meta_box_sanitize_cb_checkboxes($taxonomy, $terms) + { + } + /** + * Sanitizes POST values from an input taxonomy metabox. + * + * @since 5.1.0 + * + * @param string $taxonomy The taxonomy name. + * @param array|string $terms Raw term data from the 'tax_input' field. + * @return array + */ + function taxonomy_meta_box_sanitize_cb_input($taxonomy, $terms) + { + } + /** + * Prepares server-registered blocks for the block editor. + * + * Returns an associative array of registered block data keyed by block name. Data includes properties + * of a block relevant for client registration. + * + * @since 5.0.0 + * @since 6.3.0 Added `selectors` field. + * @since 6.4.0 Added `block_hooks` field. + * + * @return array An associative array of registered block data. + */ + function get_block_editor_server_block_settings() + { + } + /** + * Renders the meta boxes forms. + * + * @since 5.0.0 + * + * @global WP_Post $post Global post object. + * @global WP_Screen $current_screen WordPress current screen object. + * @global array $wp_meta_boxes Global meta box state. + */ + function the_block_editor_meta_boxes() + { + } + /** + * Renders the hidden form required for the meta boxes form. + * + * @since 5.0.0 + * + * @param WP_Post $post Current post object. + */ + function the_block_editor_meta_box_post_form_hidden_fields($post) + { + } + /** + * Disables block editor for wp_navigation type posts so they can be managed via the UI. + * + * @since 5.9.0 + * @access private + * + * @param bool $value Whether the CPT supports block editor or not. + * @param string $post_type Post type. + * @return bool Whether the block editor should be disabled or not. + */ + function _disable_block_editor_for_navigation_post_type($value, $post_type) + { + } + /** + * This callback disables the content editor for wp_navigation type posts. + * Content editor cannot handle wp_navigation type posts correctly. + * We cannot disable the "editor" feature in the wp_navigation's CPT definition + * because it disables the ability to save navigation blocks via REST API. + * + * @since 5.9.0 + * @access private + * + * @param WP_Post $post An instance of WP_Post class. + * @phpstan-return void + */ + function _disable_content_editor_for_navigation_post_type($post) + { + } + /** + * This callback enables content editor for wp_navigation type posts. + * We need to enable it back because we disable it to hide + * the content editor for wp_navigation type posts. + * + * @since 5.9.0 + * @access private + * + * @see _disable_content_editor_for_navigation_post_type + * + * @param WP_Post $post An instance of WP_Post class. + * @phpstan-return void + */ + function _enable_content_editor_for_navigation_post_type($post) + { + } + /** + * WordPress Administration Privacy Tools API. + * + * @package WordPress + * @subpackage Administration + */ + /** + * Resend an existing request and return the result. + * + * @since 4.9.6 + * @access private + * + * @param int $request_id Request ID. + * @return true|WP_Error Returns true if sending the email was successful, or a WP_Error object. + */ + function _wp_privacy_resend_request($request_id) + { + } + /** + * Marks a request as completed by the admin and logs the current timestamp. + * + * @since 4.9.6 + * @access private + * + * @param int $request_id Request ID. + * @return int|WP_Error Request ID on success, or a WP_Error on failure. + */ + function _wp_privacy_completed_request($request_id) + { + } + /** + * Handle list table actions. + * + * @since 4.9.6 + * @access private + */ + function _wp_personal_data_handle_actions() + { + } + /** + * Cleans up failed and expired requests before displaying the list table. + * + * @since 4.9.6 + * @access private + */ + function _wp_personal_data_cleanup_requests() + { + } + /** + * Generate a single group for the personal data export report. + * + * @since 4.9.6 + * @since 5.4.0 Added the `$group_id` and `$groups_count` parameters. + * + * @param array $group_data { + * The group data to render. + * + * @type string $group_label The user-facing heading for the group, e.g. 'Comments'. + * @type array $items { + * An array of group items. + * + * @type array $group_item_data { + * An array of name-value pairs for the item. + * + * @type string $name The user-facing name of an item name-value pair, e.g. 'IP Address'. + * @type string $value The user-facing value of an item data pair, e.g. '50.60.70.0'. + * } + * } + * } + * @param string $group_id The group identifier. + * @param int $groups_count The number of all groups + * @return string The HTML for this group and its items. + * @phpstan-param array{ + * group_label?: string, + * items?: array{ + * group_item_data: array{ + * name: string, + * value: string, + * }, + * }, + * } $group_data + */ + function wp_privacy_generate_personal_data_export_group_html($group_data, $group_id = '', $groups_count = 1) + { + } + /** + * Generate the personal data export file. + * + * @since 4.9.6 + * + * @param int $request_id The export request ID. + */ + function wp_privacy_generate_personal_data_export_file($request_id) + { + } + /** + * Send an email to the user with a link to the personal data export file + * + * @since 4.9.6 + * + * @param int $request_id The request ID for this personal data export. + * @return true|WP_Error True on success or `WP_Error` on failure. + */ + function wp_privacy_send_personal_data_export_email($request_id) + { + } + /** + * Intercept personal data exporter page Ajax responses in order to assemble the personal data export file. + * + * @since 4.9.6 + * + * @see 'wp_privacy_personal_data_export_page' + * + * @param array $response The response from the personal data exporter for the given page. + * @param int $exporter_index The index of the personal data exporter. Begins at 1. + * @param string $email_address The email address of the user whose personal data this is. + * @param int $page The page of personal data for this exporter. Begins at 1. + * @param int $request_id The request ID for this personal data export. + * @param bool $send_as_email Whether the final results of the export should be emailed to the user. + * @param string $exporter_key The slug (key) of the exporter. + * @return array The filtered response. + */ + function wp_privacy_process_personal_data_export_page($response, $exporter_index, $email_address, $page, $request_id, $send_as_email, $exporter_key) + { + } + /** + * Mark erasure requests as completed after processing is finished. + * + * This intercepts the Ajax responses to personal data eraser page requests, and + * monitors the status of a request. Once all of the processing has finished, the + * request is marked as completed. + * + * @since 4.9.6 + * + * @see 'wp_privacy_personal_data_erasure_page' + * + * @param array $response The response from the personal data eraser for + * the given page. + * @param int $eraser_index The index of the personal data eraser. Begins + * at 1. + * @param string $email_address The email address of the user whose personal + * data this is. + * @param int $page The page of personal data for this eraser. + * Begins at 1. + * @param int $request_id The request ID for this personal data erasure. + * @return array The filtered response. + */ + function wp_privacy_process_personal_data_erasure_page($response, $eraser_index, $email_address, $page, $request_id) + { + } + /** + * WordPress Administration Revisions API + * + * @package WordPress + * @subpackage Administration + * @since 3.6.0 + */ + /** + * Get the revision UI diff. + * + * @since 3.6.0 + * + * @param WP_Post|int $post The post object or post ID. + * @param int $compare_from The revision ID to compare from. + * @param int $compare_to The revision ID to come to. + * @return array|false Associative array of a post's revisioned fields and their diffs. + * Or, false on failure. + */ + function wp_get_revision_ui_diff($post, $compare_from, $compare_to) + { + } + /** + * Prepare revisions for JavaScript. + * + * @since 3.6.0 + * + * @param WP_Post|int $post The post object or post ID. + * @param int $selected_revision_id The selected revision ID. + * @param int $from Optional. The revision ID to compare from. + * @return array An associative array of revision data and related settings. + */ + function wp_prepare_revisions_for_js($post, $selected_revision_id, $from = \null) + { + } + /** + * Print JavaScript templates required for the revisions experience. + * + * @since 4.1.0 + * + * @global WP_Post $post Global post object. + */ + function wp_print_revision_templates() + { + } + /** + * Retrieve the SQL for creating database tables. + * + * @since 3.3.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $scope Optional. The tables for which to retrieve SQL. Can be all, global, ms_global, or blog tables. Defaults to all. + * @param int $blog_id Optional. The site ID for which to retrieve SQL. Default is the current site ID. + * @return string The SQL needed to create the requested tables. + */ + function wp_get_db_schema($scope = 'all', $blog_id = \null) + { + } + /** + * Create WordPress options and set the default values. + * + * @since 1.5.0 + * @since 5.1.0 The $options parameter has been added. + * + * @global wpdb $wpdb WordPress database abstraction object. + * @global int $wp_db_version WordPress database version. + * @global int $wp_current_db_version The old (current) database version. + * + * @param array $options Optional. Custom option $key => $value pairs to use. Default empty array. + */ + function populate_options(array $options = array()) + { + } + /** + * Execute WordPress role creation for the various WordPress versions. + * + * @since 2.0.0 + */ + function populate_roles() + { + } + /** + * Create the roles for WordPress 2.0 + * + * @since 2.0.0 + */ + function populate_roles_160() + { + } + /** + * Create and modify WordPress roles for WordPress 2.1. + * + * @since 2.1.0 + */ + function populate_roles_210() + { + } + /** + * Create and modify WordPress roles for WordPress 2.3. + * + * @since 2.3.0 + */ + function populate_roles_230() + { + } + /** + * Create and modify WordPress roles for WordPress 2.5. + * + * @since 2.5.0 + */ + function populate_roles_250() + { + } + /** + * Create and modify WordPress roles for WordPress 2.6. + * + * @since 2.6.0 + */ + function populate_roles_260() + { + } + /** + * Create and modify WordPress roles for WordPress 2.7. + * + * @since 2.7.0 + */ + function populate_roles_270() + { + } + /** + * Create and modify WordPress roles for WordPress 2.8. + * + * @since 2.8.0 + */ + function populate_roles_280() + { + } + /** + * Create and modify WordPress roles for WordPress 3.0. + * + * @since 3.0.0 + */ + function populate_roles_300() + { + } + /** + * Install Network. + * + * @since 3.0.0 + */ + function install_network() + { + } + /** + * Populate network settings. + * + * @since 3.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * @global object $current_site + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param int $network_id ID of network to populate. + * @param string $domain The domain name for the network. Example: "example.com". + * @param string $email Email address for the network administrator. + * @param string $site_name The name of the network. + * @param string $path Optional. The path to append to the network's domain name. Default '/'. + * @param bool $subdomain_install Optional. Whether the network is a subdomain installation or a subdirectory installation. + * Default false, meaning the network is a subdirectory installation. + * @return true|WP_Error True on success, or WP_Error on warning (with the installation otherwise successful, + * so the error code must be checked) or failure. + */ + function populate_network($network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = \false) + { + } + /** + * Creates WordPress network meta and sets the default values. + * + * @since 5.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * @global int $wp_db_version WordPress database version. + * + * @param int $network_id Network ID to populate meta for. + * @param array $meta Optional. Custom meta $key => $value pairs to use. Default empty array. + */ + function populate_network_meta($network_id, array $meta = array()) + { + } + /** + * Creates WordPress site meta and sets the default values. + * + * @since 5.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $site_id Site ID to populate meta for. + * @param array $meta Optional. Custom meta $key => $value pairs to use. Default empty array. + * @phpstan-return void + */ + function populate_site_meta($site_id, array $meta = array()) + { + } + /** + * WordPress Administration Screen API. + * + * @package WordPress + * @subpackage Administration + */ + /** + * Get the column headers for a screen + * + * @since 2.7.0 + * + * @param string|WP_Screen $screen The screen you want the headers for + * @return string[] The column header labels keyed by column ID. + */ + function get_column_headers($screen) + { + } + /** + * Get a list of hidden columns. + * + * @since 2.7.0 + * + * @param string|WP_Screen $screen The screen you want the hidden columns for + * @return string[] Array of IDs of hidden columns. + */ + function get_hidden_columns($screen) + { + } + /** + * Prints the meta box preferences for screen meta. + * + * @since 2.7.0 + * + * @global array $wp_meta_boxes Global meta box state. + * + * @param WP_Screen $screen + * @phpstan-return void + */ + function meta_box_prefs($screen) + { + } + /** + * Gets an array of IDs of hidden meta boxes. + * + * @since 2.7.0 + * + * @param string|WP_Screen $screen Screen identifier + * @return string[] IDs of hidden meta boxes. + */ + function get_hidden_meta_boxes($screen) + { + } + /** + * Register and configure an admin screen option + * + * @since 3.1.0 + * + * @param string $option An option name. + * @param mixed $args Option-dependent arguments. + * @phpstan-return void + */ + function add_screen_option($option, $args = array()) + { + } + /** + * Get the current screen object + * + * @since 3.1.0 + * + * @global WP_Screen $current_screen WordPress current screen object. + * + * @return WP_Screen|null Current screen object or null when screen not defined. + */ + function get_current_screen() + { + } + /** + * Set the current screen object + * + * @since 3.0.0 + * + * @param string|WP_Screen $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen, + * or an existing screen object. + */ + function set_current_screen($hook_name = '') + { + } + /** + * WordPress Taxonomy Administration API. + * + * @package WordPress + * @subpackage Administration + */ + // + // Category. + // + /** + * Checks whether a category exists. + * + * @since 2.0.0 + * + * @see term_exists() + * + * @param int|string $cat_name Category name. + * @param int $category_parent Optional. ID of parent category. + * @return string|null Returns the category ID as a numeric string if the pairing exists, null if not. + */ + function category_exists($cat_name, $category_parent = \null) + { + } + /** + * Gets category object for given ID and 'edit' filter context. + * + * @since 2.0.0 + * + * @param int $id + * @return object + */ + function get_category_to_edit($id) + { + } + /** + * Adds a new category to the database if it does not already exist. + * + * @since 2.0.0 + * + * @param int|string $cat_name Category name. + * @param int $category_parent Optional. ID of parent category. + * @return int|WP_Error + */ + function wp_create_category($cat_name, $category_parent = 0) + { + } + /** + * Creates categories for the given post. + * + * @since 2.0.0 + * + * @param string[] $categories Array of category names to create. + * @param int $post_id Optional. The post ID. Default empty. + * @return int[] Array of IDs of categories assigned to the given post. + */ + function wp_create_categories($categories, $post_id = '') + { + } + /** + * Updates an existing Category or creates a new Category. + * + * @since 2.0.0 + * @since 2.5.0 $wp_error parameter was added. + * @since 3.0.0 The 'taxonomy' argument was added. + * + * @param array $catarr { + * Array of arguments for inserting a new category. + * + * @type int $cat_ID Category ID. A non-zero value updates an existing category. + * Default 0. + * @type string $taxonomy Taxonomy slug. Default 'category'. + * @type string $cat_name Category name. Default empty. + * @type string $category_description Category description. Default empty. + * @type string $category_nicename Category nice (display) name. Default empty. + * @type int|string $category_parent Category parent ID. Default empty. + * } + * @param bool $wp_error Optional. Default false. + * @return int|WP_Error The ID number of the new or updated Category on success. Zero or a WP_Error on failure, + * depending on param `$wp_error`. + * @phpstan-param array{ + * cat_ID?: int, + * taxonomy?: string, + * cat_name?: string, + * category_description?: string, + * category_nicename?: string, + * category_parent?: int|string, + * } $catarr + * @phpstan-return ($wp_error is false ? 0|positive-int : positive-int|\WP_Error) + */ + function wp_insert_category($catarr, $wp_error = \false) + { + } + /** + * Aliases wp_insert_category() with minimal args. + * + * If you want to update only some fields of an existing category, call this + * function with only the new values set inside $catarr. + * + * @since 2.0.0 + * + * @param array $catarr The 'cat_ID' value is required. All other keys are optional. + * @return int|false The ID number of the new or updated Category on success. Zero or FALSE on failure. + */ + function wp_update_category($catarr) + { + } + // + // Tags. + // + /** + * Checks whether a post tag with a given name exists. + * + * @since 2.3.0 + * + * @param int|string $tag_name + * @return mixed Returns null if the term does not exist. + * Returns an array of the term ID and the term taxonomy ID if the pairing exists. + * Returns 0 if term ID 0 is passed to the function. + * @phpstan-return ($tag_name is 0 ? 0 : ($tag_name is '' ? null : array{term_id: string, term_taxonomy_id: string}|null)) + */ + function tag_exists($tag_name) + { + } + /** + * Adds a new tag to the database if it does not already exist. + * + * @since 2.3.0 + * + * @param int|string $tag_name + * @return array|WP_Error + */ + function wp_create_tag($tag_name) + { + } + /** + * Gets comma-separated list of tags available to edit. + * + * @since 2.3.0 + * + * @param int $post_id + * @param string $taxonomy Optional. The taxonomy for which to retrieve terms. Default 'post_tag'. + * @return string|false|WP_Error + */ + function get_tags_to_edit($post_id, $taxonomy = 'post_tag') + { + } + /** + * Gets comma-separated list of terms available to edit for the given post ID. + * + * @since 2.8.0 + * + * @param int $post_id + * @param string $taxonomy Optional. The taxonomy for which to retrieve terms. Default 'post_tag'. + * @return string|false|WP_Error + */ + function get_terms_to_edit($post_id, $taxonomy = 'post_tag') + { + } + /** + * Adds a new term to the database if it does not already exist. + * + * @since 2.8.0 + * + * @param string $tag_name The term name. + * @param string $taxonomy Optional. The taxonomy within which to create the term. Default 'post_tag'. + * @return array|WP_Error + */ + function wp_create_term($tag_name, $taxonomy = 'post_tag') + { + } + // + // Category Checklists. + // + /** + * Outputs an unordered list of checkbox input elements labeled with category names. + * + * @since 2.5.1 + * + * @see wp_terms_checklist() + * + * @param int $post_id Optional. Post to generate a categories checklist for. Default 0. + * $selected_cats must not be an array. Default 0. + * @param int $descendants_and_self Optional. ID of the category to output along with its descendants. + * Default 0. + * @param int[]|false $selected_cats Optional. Array of category IDs to mark as checked. Default false. + * @param int[]|false $popular_cats Optional. Array of category IDs to receive the "popular-category" class. + * Default false. + * @param Walker $walker Optional. Walker object to use to build the output. + * Default is a Walker_Category_Checklist instance. + * @param bool $checked_ontop Optional. Whether to move checked items out of the hierarchy and to + * the top of the list. Default true. + */ + function wp_category_checklist($post_id = 0, $descendants_and_self = 0, $selected_cats = \false, $popular_cats = \false, $walker = \null, $checked_ontop = \true) + { + } + /** + * Outputs an unordered list of checkbox input elements labelled with term names. + * + * Taxonomy-independent version of wp_category_checklist(). + * + * @since 3.0.0 + * @since 4.4.0 Introduced the `$echo` argument. + * + * @param int $post_id Optional. Post ID. Default 0. + * @param array|string $args { + * Optional. Array or string of arguments for generating a terms checklist. Default empty array. + * + * @type int $descendants_and_self ID of the category to output along with its descendants. + * Default 0. + * @type int[] $selected_cats Array of category IDs to mark as checked. Default false. + * @type int[] $popular_cats Array of category IDs to receive the "popular-category" class. + * Default false. + * @type Walker $walker Walker object to use to build the output. Default empty which + * results in a Walker_Category_Checklist instance being used. + * @type string $taxonomy Taxonomy to generate the checklist for. Default 'category'. + * @type bool $checked_ontop Whether to move checked items out of the hierarchy and to + * the top of the list. Default true. + * @type bool $echo Whether to echo the generated markup. False to return the markup instead + * of echoing it. Default true. + * } + * @return string HTML list of input elements. + * @phpstan-param array{ + * descendants_and_self?: int, + * selected_cats?: int[], + * popular_cats?: int[], + * walker?: Walker, + * taxonomy?: string, + * checked_ontop?: bool, + * echo?: bool, + * } $args + */ + function wp_terms_checklist($post_id = 0, $args = array()) + { + } + /** + * Retrieves a list of the most popular terms from the specified taxonomy. + * + * If the `$display` argument is true then the elements for a list of checkbox + * `<input>` elements labelled with the names of the selected terms is output. + * If the `$post_ID` global is not empty then the terms associated with that + * post will be marked as checked. + * + * @since 2.5.0 + * + * @param string $taxonomy Taxonomy to retrieve terms from. + * @param int $default_term Optional. Not used. + * @param int $number Optional. Number of terms to retrieve. Default 10. + * @param bool $display Optional. Whether to display the list as well. Default true. + * @return int[] Array of popular term IDs. + */ + function wp_popular_terms_checklist($taxonomy, $default_term = 0, $number = 10, $display = \true) + { + } + /** + * Outputs a link category checklist element. + * + * @since 2.5.1 + * + * @param int $link_id Optional. The link ID. Default 0. + * @phpstan-return void + */ + function wp_link_category_checklist($link_id = 0) + { + } + /** + * Adds hidden fields with the data for use in the inline editor for posts and pages. + * + * @since 2.7.0 + * + * @param WP_Post $post Post object. + * @phpstan-return void + */ + function get_inline_data($post) + { + } + /** + * Outputs the in-line comment reply-to form in the Comments list table. + * + * @since 2.7.0 + * + * @global WP_List_Table $wp_list_table + * + * @param int $position Optional. The value of the 'position' input field. Default 1. + * @param bool $checkbox Optional. The value of the 'checkbox' input field. Default false. + * @param string $mode Optional. If set to 'single', will use WP_Post_Comments_List_Table, + * otherwise WP_Comments_List_Table. Default 'single'. + * @param bool $table_row Optional. Whether to use a table instead of a div element. Default true. + * @phpstan-return void + */ + function wp_comment_reply($position = 1, $checkbox = \false, $mode = 'single', $table_row = \true) + { + } + /** + * Outputs 'undo move to Trash' text for comments. + * + * @since 2.9.0 + */ + function wp_comment_trashnotice() + { + } + /** + * Outputs a post's public meta data in the Custom Fields meta box. + * + * @since 1.2.0 + * + * @param array[] $meta An array of meta data arrays keyed on 'meta_key' and 'meta_value'. + * @phpstan-return void + */ + function list_meta($meta) + { + } + /** + * Outputs a single row of public meta data in the Custom Fields meta box. + * + * @since 2.5.0 + * + * @param array $entry An array of meta data keyed on 'meta_key' and 'meta_value'. + * @param int $count Reference to the row number. + * @return string A single row of public meta data. + */ + function _list_meta_row($entry, &$count) + { + } + /** + * Prints the form in the Custom Fields meta box. + * + * @since 1.2.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param WP_Post $post Optional. The post being edited. + */ + function meta_form($post = \null) + { + } + /** + * Prints out HTML form date elements for editing post or comment publish date. + * + * @since 0.71 + * @since 4.4.0 Converted to use get_comment() instead of the global `$comment`. + * + * @global WP_Locale $wp_locale WordPress date and time locale object. + * + * @param int|bool $edit Accepts 1|true for editing the date, 0|false for adding the date. + * @param int|bool $for_post Accepts 1|true for applying the date to a post, 0|false for a comment. + * @param int $tab_index The tabindex attribute to add. Default 0. + * @param int|bool $multi Optional. Whether the additional fields and buttons should be added. + * Default 0|false. + * @phpstan-return void + */ + function touch_time($edit = 1, $for_post = 1, $tab_index = 0, $multi = 0) + { + } + /** + * Prints out option HTML elements for the page templates drop-down. + * + * @since 1.5.0 + * @since 4.7.0 Added the `$post_type` parameter. + * + * @param string $default_template Optional. The template file name. Default empty. + * @param string $post_type Optional. Post type to get templates for. Default 'page'. + */ + function page_template_dropdown($default_template = '', $post_type = 'page') + { + } + /** + * Prints out option HTML elements for the page parents drop-down. + * + * @since 1.5.0 + * @since 4.4.0 `$post` argument was added. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $default_page Optional. The default page ID to be pre-selected. Default 0. + * @param int $parent_page Optional. The parent page ID. Default 0. + * @param int $level Optional. Page depth level. Default 0. + * @param int|WP_Post $post Post ID or WP_Post object. + * @return void|false Void on success, false if the page has no children. + */ + function parent_dropdown($default_page = 0, $parent_page = 0, $level = 0, $post = \null) + { + } + /** + * Prints out option HTML elements for role selectors. + * + * @since 2.1.0 + * + * @param string $selected Slug for the role that should be already selected. + */ + function wp_dropdown_roles($selected = '') + { + } + /** + * Outputs the form used by the importers to accept the data to be imported. + * + * @since 2.0.0 + * + * @param string $action The action attribute for the form. + */ + function wp_import_upload_form($action) + { + } + /** + * Adds a meta box to one or more screens. + * + * @since 2.5.0 + * @since 4.4.0 The `$screen` parameter now accepts an array of screen IDs. + * + * @global array $wp_meta_boxes Global meta box state. + * + * @param string $id Meta box ID (used in the 'id' attribute for the meta box). + * @param string $title Title of the meta box. + * @param callable $callback Function that fills the box with the desired content. + * The function should echo its output. + * @param string|array|WP_Screen $screen Optional. The screen or screens on which to show the box + * (such as a post type, 'link', or 'comment'). Accepts a single + * screen ID, WP_Screen object, or array of screen IDs. Default + * is the current screen. If you have used add_menu_page() or + * add_submenu_page() to create a new screen (and hence screen_id), + * make sure your menu slug conforms to the limits of sanitize_key() + * otherwise the 'screen' menu may not correctly render on your page. + * @param string $context Optional. The context within the screen where the box + * should display. Available contexts vary from screen to + * screen. Post edit screen contexts include 'normal', 'side', + * and 'advanced'. Comments screen contexts include 'normal' + * and 'side'. Menus meta boxes (accordion sections) all use + * the 'side' context. Global default is 'advanced'. + * @param string $priority Optional. The priority within the context where the box should show. + * Accepts 'high', 'core', 'default', or 'low'. Default 'default'. + * @param array $callback_args Optional. Data that should be set as the $args property + * of the box array (which is the second parameter passed + * to your callback). Default null. + * @phpstan-param 'high'|'core'|'default'|'low' $priority + * @phpstan-return void + */ + function add_meta_box($id, $title, $callback, $screen = \null, $context = 'advanced', $priority = 'default', $callback_args = \null) + { + } + /** + * Renders a "fake" meta box with an information message, + * shown on the block editor, when an incompatible meta box is found. + * + * @since 5.0.0 + * + * @param mixed $data_object The data object being rendered on this screen. + * @param array $box { + * Custom formats meta box arguments. + * + * @type string $id Meta box 'id' attribute. + * @type string $title Meta box title. + * @type callable $old_callback The original callback for this meta box. + * @type array $args Extra meta box arguments. + * } + * @phpstan-param array{ + * id?: string, + * title?: string, + * old_callback?: callable, + * args?: array, + * } $box + */ + function do_block_editor_incompatible_meta_box($data_object, $box) + { + } + /** + * Internal helper function to find the plugin from a meta box callback. + * + * @since 5.0.0 + * + * @access private + * + * @param callable $callback The callback function to check. + * @return array|null The plugin that the callback belongs to, or null if it doesn't belong to a plugin. + */ + function _get_plugin_from_callback($callback) + { + } + /** + * Meta-Box template function. + * + * @since 2.5.0 + * + * @global array $wp_meta_boxes Global meta box state. + * + * @param string|WP_Screen $screen The screen identifier. If you have used add_menu_page() or + * add_submenu_page() to create a new screen (and hence screen_id) + * make sure your menu slug conforms to the limits of sanitize_key() + * otherwise the 'screen' menu may not correctly render on your page. + * @param string $context The screen context for which to display meta boxes. + * @param mixed $data_object Gets passed to the meta box callback function as the first parameter. + * Often this is the object that's the focus of the current screen, + * for example a `WP_Post` or `WP_Comment` object. + * @return int Number of meta_boxes. + */ + function do_meta_boxes($screen, $context, $data_object) + { + } + /** + * Removes a meta box from one or more screens. + * + * @since 2.6.0 + * @since 4.4.0 The `$screen` parameter now accepts an array of screen IDs. + * + * @global array $wp_meta_boxes Global meta box state. + * + * @param string $id Meta box ID (used in the 'id' attribute for the meta box). + * @param string|array|WP_Screen $screen The screen or screens on which the meta box is shown (such as a + * post type, 'link', or 'comment'). Accepts a single screen ID, + * WP_Screen object, or array of screen IDs. + * @param string $context The context within the screen where the box is set to display. + * Contexts vary from screen to screen. Post edit screen contexts + * include 'normal', 'side', and 'advanced'. Comments screen contexts + * include 'normal' and 'side'. Menus meta boxes (accordion sections) + * all use the 'side' context. + * @phpstan-return void + */ + function remove_meta_box($id, $screen, $context) + { + } + /** + * Meta Box Accordion Template Function. + * + * Largely made up of abstracted code from do_meta_boxes(), this + * function serves to build meta boxes as list items for display as + * a collapsible accordion. + * + * @since 3.6.0 + * + * @uses global $wp_meta_boxes Used to retrieve registered meta boxes. + * + * @param string|object $screen The screen identifier. + * @param string $context The screen context for which to display accordion sections. + * @param mixed $data_object Gets passed to the section callback function as the first parameter. + * @return int Number of meta boxes as accordion sections. + */ + function do_accordion_sections($screen, $context, $data_object) + { + } + /** + * Adds a new section to a settings page. + * + * Part of the Settings API. Use this to define new settings sections for an admin page. + * Show settings sections in your admin page callback function with do_settings_sections(). + * Add settings fields to your section with add_settings_field(). + * + * The $callback argument should be the name of a function that echoes out any + * content you want to show at the top of the settings section before the actual + * fields. It can output nothing if you want. + * + * @since 2.7.0 + * @since 6.1.0 Added an `$args` parameter for the section's HTML wrapper and class name. + * + * @global array $wp_settings_sections Storage array of all settings sections added to admin pages. + * + * @param string $id Slug-name to identify the section. Used in the 'id' attribute of tags. + * @param string $title Formatted title of the section. Shown as the heading for the section. + * @param callable $callback Function that echos out any content at the top of the section (between heading and fields). + * @param string $page The slug-name of the settings page on which to show the section. Built-in pages include + * 'general', 'reading', 'writing', 'discussion', 'media', etc. Create your own using + * add_options_page(); + * @param array $args { + * Arguments used to create the settings section. + * + * @type string $before_section HTML content to prepend to the section's HTML output. + * Receives the section's class name as `%s`. Default empty. + * @type string $after_section HTML content to append to the section's HTML output. Default empty. + * @type string $section_class The class name to use for the section. Default empty. + * } + * @phpstan-param array{ + * before_section?: string, + * after_section?: string, + * section_class?: string, + * } $args + */ + function add_settings_section($id, $title, $callback, $page, $args = array()) + { + } + /** + * Adds a new field to a section of a settings page. + * + * Part of the Settings API. Use this to define a settings field that will show + * as part of a settings section inside a settings page. The fields are shown using + * do_settings_fields() in do_settings_sections(). + * + * The $callback argument should be the name of a function that echoes out the + * HTML input tags for this setting field. Use get_option() to retrieve existing + * values to show. + * + * @since 2.7.0 + * @since 4.2.0 The `$class` argument was added. + * + * @global array $wp_settings_fields Storage array of settings fields and info about their pages/sections. + * + * @param string $id Slug-name to identify the field. Used in the 'id' attribute of tags. + * @param string $title Formatted title of the field. Shown as the label for the field + * during output. + * @param callable $callback Function that fills the field with the desired form inputs. The + * function should echo its output. + * @param string $page The slug-name of the settings page on which to show the section + * (general, reading, writing, ...). + * @param string $section Optional. The slug-name of the section of the settings page + * in which to show the box. Default 'default'. + * @param array $args { + * Optional. Extra arguments that get passed to the callback function. + * + * @type string $label_for When supplied, the setting title will be wrapped + * in a `<label>` element, its `for` attribute populated + * with this value. + * @type string $class CSS Class to be added to the `<tr>` element when the + * field is output. + * } + * @phpstan-param array{ + * label_for?: string, + * class?: string, + * } $args + */ + function add_settings_field($id, $title, $callback, $page, $section = 'default', $args = array()) + { + } + /** + * Prints out all settings sections added to a particular settings page. + * + * Part of the Settings API. Use this in a settings page callback function + * to output all the sections and fields that were added to that $page with + * add_settings_section() and add_settings_field() + * + * @global array $wp_settings_sections Storage array of all settings sections added to admin pages. + * @global array $wp_settings_fields Storage array of settings fields and info about their pages/sections. + * @since 2.7.0 + * + * @param string $page The slug name of the page whose settings sections you want to output. + * @phpstan-return void + */ + function do_settings_sections($page) + { + } + /** + * Prints out the settings fields for a particular settings section. + * + * Part of the Settings API. Use this in a settings page to output + * a specific section. Should normally be called by do_settings_sections() + * rather than directly. + * + * @global array $wp_settings_fields Storage array of settings fields and their pages/sections. + * + * @since 2.7.0 + * + * @param string $page Slug title of the admin page whose settings fields you want to show. + * @param string $section Slug title of the settings section whose fields you want to show. + * @phpstan-return void + */ + function do_settings_fields($page, $section) + { + } + /** + * Registers a settings error to be displayed to the user. + * + * Part of the Settings API. Use this to show messages to users about settings validation + * problems, missing settings or anything else. + * + * Settings errors should be added inside the $sanitize_callback function defined in + * register_setting() for a given setting to give feedback about the submission. + * + * By default messages will show immediately after the submission that generated the error. + * Additional calls to settings_errors() can be used to show errors even when the settings + * page is first accessed. + * + * @since 3.0.0 + * @since 5.3.0 Added `warning` and `info` as possible values for `$type`. + * + * @global array[] $wp_settings_errors Storage array of errors registered during this pageload + * + * @param string $setting Slug title of the setting to which this error applies. + * @param string $code Slug-name to identify the error. Used as part of 'id' attribute in HTML output. + * @param string $message The formatted message text to display to the user (will be shown inside styled + * `<div>` and `<p>` tags). + * @param string $type Optional. Message type, controls HTML class. Possible values include 'error', + * 'success', 'warning', 'info'. Default 'error'. + */ + function add_settings_error($setting, $code, $message, $type = 'error') + { + } + /** + * Fetches settings errors registered by add_settings_error(). + * + * Checks the $wp_settings_errors array for any errors declared during the current + * pageload and returns them. + * + * If changes were just submitted ($_GET['settings-updated']) and settings errors were saved + * to the 'settings_errors' transient then those errors will be returned instead. This + * is used to pass errors back across pageloads. + * + * Use the $sanitize argument to manually re-sanitize the option before returning errors. + * This is useful if you have errors or notices you want to show even when the user + * hasn't submitted data (i.e. when they first load an options page, or in the {@see 'admin_notices'} + * action hook). + * + * @since 3.0.0 + * + * @global array[] $wp_settings_errors Storage array of errors registered during this pageload + * + * @param string $setting Optional. Slug title of a specific setting whose errors you want. + * @param bool $sanitize Optional. Whether to re-sanitize the setting value before returning errors. + * @return array[] { + * Array of settings error arrays. + * + * @type array ...$0 { + * Associative array of setting error data. + * + * @type string $setting Slug title of the setting to which this error applies. + * @type string $code Slug-name to identify the error. Used as part of 'id' attribute in HTML output. + * @type string $message The formatted message text to display to the user (will be shown inside styled + * `<div>` and `<p>` tags). + * @type string $type Optional. Message type, controls HTML class. Possible values include 'error', + * 'success', 'warning', 'info'. Default 'error'. + * } + * } + * @phpstan-return array<int|string, array{ + * setting: string, + * code: string, + * message: string, + * type: string, + * }> + */ + function get_settings_errors($setting = '', $sanitize = \false) + { + } + /** + * Displays settings errors registered by add_settings_error(). + * + * Part of the Settings API. Outputs a div for each error retrieved by + * get_settings_errors(). + * + * This is called automatically after a settings page based on the + * Settings API is submitted. Errors should be added during the validation + * callback function for a setting defined in register_setting(). + * + * The $sanitize option is passed into get_settings_errors() and will + * re-run the setting sanitization + * on its current value. + * + * The $hide_on_update option will cause errors to only show when the settings + * page is first loaded. if the user has already saved new values it will be + * hidden to avoid repeating messages already shown in the default error + * reporting after submission. This is useful to show general errors like + * missing settings when the user arrives at the settings page. + * + * @since 3.0.0 + * @since 5.3.0 Legacy `error` and `updated` CSS classes are mapped to + * `notice-error` and `notice-success`. + * + * @param string $setting Optional slug title of a specific setting whose errors you want. + * @param bool $sanitize Whether to re-sanitize the setting value before returning errors. + * @param bool $hide_on_update If set to true errors will not be shown if the settings page has + * already been submitted. + * @phpstan-return void + */ + function settings_errors($setting = '', $sanitize = \false, $hide_on_update = \false) + { + } + /** + * Outputs the modal window used for attaching media to posts or pages in the media-listing screen. + * + * @since 2.7.0 + * + * @param string $found_action Optional. The value of the 'found_action' input field. Default empty string. + */ + function find_posts_div($found_action = '') + { + } + /** + * Displays the post password. + * + * The password is passed through esc_attr() to ensure that it is safe for placing in an HTML attribute. + * + * @since 2.7.0 + */ + function the_post_password() + { + } + /** + * Gets the post title. + * + * The post title is fetched and if it is blank then a default string is + * returned. + * + * @since 2.7.0 + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. + * @return string The post title if set. + */ + function _draft_or_post_title($post = 0) + { + } + /** + * Displays the search query. + * + * A simple wrapper to display the "s" parameter in a `GET` URI. This function + * should only be used when the_search_query() cannot. + * + * @since 2.7.0 + */ + function _admin_search_query() + { + } + /** + * Generic Iframe header for use with Thickbox. + * + * @since 2.7.0 + * + * @global string $hook_suffix + * @global string $admin_body_class + * @global string $body_id + * @global WP_Locale $wp_locale WordPress date and time locale object. + * + * @param string $title Optional. Title of the Iframe page. Default empty. + * @param bool $deprecated Not used. + */ + function iframe_header($title = '', $deprecated = \false) + { + } + /** + * Generic Iframe footer for use with Thickbox. + * + * @since 2.7.0 + */ + function iframe_footer() + { + } + /** + * Echoes or returns the post states as HTML. + * + * @since 2.7.0 + * @since 5.3.0 Added the `$display` parameter and a return value. + * + * @see get_post_states() + * + * @param WP_Post $post The post to retrieve states for. + * @param bool $display Optional. Whether to display the post states as an HTML string. + * Default true. + * @return string Post states string. + */ + function _post_states($post, $display = \true) + { + } + /** + * Retrieves an array of post states from a post. + * + * @since 5.3.0 + * + * @param WP_Post $post The post to retrieve states for. + * @return string[] Array of post state labels keyed by their state. + */ + function get_post_states($post) + { + } + /** + * Outputs the attachment media states as HTML. + * + * @since 3.2.0 + * @since 5.6.0 Added the `$display` parameter and a return value. + * + * @param WP_Post $post The attachment post to retrieve states for. + * @param bool $display Optional. Whether to display the post states as an HTML string. + * Default true. + * @return string Media states string. + */ + function _media_states($post, $display = \true) + { + } + /** + * Retrieves an array of media states from an attachment. + * + * @since 5.6.0 + * + * @param WP_Post $post The attachment to retrieve states for. + * @return string[] Array of media state labels keyed by their state. + */ + function get_media_states($post) + { + } + /** + * Tests support for compressing JavaScript from PHP. + * + * Outputs JavaScript that tests if compression from PHP works as expected + * and sets an option with the result. Has no effect when the current user + * is not an administrator. To run the test again the option 'can_compress_scripts' + * has to be deleted. + * + * @since 2.8.0 + */ + function compression_test() + { + } + /** + * Echoes a submit button, with provided text and appropriate class(es). + * + * @since 3.1.0 + * + * @see get_submit_button() + * + * @param string $text Optional. The text of the button. Defaults to 'Save Changes'. + * @param string $type Optional. The type and CSS class(es) of the button. Core values + * include 'primary', 'small', and 'large'. Default 'primary'. + * @param string $name Optional. The HTML name of the submit button. If no `id` attribute + * is given in the `$other_attributes` parameter, `$name` will be used + * as the button's `id`. Default 'submit'. + * @param bool $wrap Optional. True if the output button should be wrapped in a paragraph tag, + * false otherwise. Default true. + * @param array|string $other_attributes Optional. Other attributes that should be output with the button, + * mapping attributes to their values, e.g. `array( 'id' => 'search-submit' )`. + * These key/value attribute pairs will be output as `attribute="value"`, + * where attribute is the key. Attributes can also be provided as a string, + * e.g. `id="search-submit"`, though the array format is generally preferred. + * Default empty string. + */ + function submit_button($text = '', $type = 'primary', $name = 'submit', $wrap = \true, $other_attributes = '') + { + } + /** + * Returns a submit button, with provided text and appropriate class. + * + * @since 3.1.0 + * + * @param string $text Optional. The text of the button. Defaults to 'Save Changes'. + * @param string $type Optional. The type and CSS class(es) of the button. Core values + * include 'primary', 'small', and 'large'. Default 'primary large'. + * @param string $name Optional. The HTML name of the submit button. If no `id` attribute + * is given in the `$other_attributes` parameter, `$name` will be used + * as the button's `id`. Default 'submit'. + * @param bool $wrap Optional. True if the output button should be wrapped in a paragraph tag, + * false otherwise. Default true. + * @param array|string $other_attributes Optional. Other attributes that should be output with the button, + * mapping attributes to their values, e.g. `array( 'id' => 'search-submit' )`. + * These key/value attribute pairs will be output as `attribute="value"`, + * where attribute is the key. Attributes can also be provided as a string, + * e.g. `id="search-submit"`, though the array format is generally preferred. + * Default empty string. + * @return string Submit button HTML. + */ + function get_submit_button($text = '', $type = 'primary large', $name = 'submit', $wrap = \true, $other_attributes = '') + { + } + /** + * Prints out the beginning of the admin HTML header. + * + * @global bool $is_IE + */ + function _wp_admin_html_begin() + { + } + /** + * Converts a screen string to a screen object. + * + * @since 3.0.0 + * + * @param string $hook_name The hook name (also known as the hook suffix) used to determine the screen. + * @return WP_Screen Screen object. + */ + function convert_to_screen($hook_name) + { + } + /** + * Outputs the HTML for restoring the post data from DOM storage + * + * @since 3.6.0 + * @access private + */ + function _local_storage_notice() + { + } + /** + * Outputs a HTML element with a star rating for a given rating. + * + * Outputs a HTML element with the star rating exposed on a 0..5 scale in + * half star increments (ie. 1, 1.5, 2 stars). Optionally, if specified, the + * number of ratings may also be displayed by passing the $number parameter. + * + * @since 3.8.0 + * @since 4.4.0 Introduced the `echo` parameter. + * + * @param array $args { + * Optional. Array of star ratings arguments. + * + * @type int|float $rating The rating to display, expressed in either a 0.5 rating increment, + * or percentage. Default 0. + * @type string $type Format that the $rating is in. Valid values are 'rating' (default), + * or, 'percent'. Default 'rating'. + * @type int $number The number of ratings that makes up this rating. Default 0. + * @type bool $echo Whether to echo the generated markup. False to return the markup instead + * of echoing it. Default true. + * } + * @return string Star rating HTML. + * @phpstan-param array{ + * rating?: int|float, + * type?: string, + * number?: int, + * echo?: bool, + * } $args + */ + function wp_star_rating($args = array()) + { + } + /** + * Outputs a notice when editing the page for posts (internal use only). + * + * @ignore + * @since 4.2.0 + */ + function _wp_posts_page_notice() + { + } + /** + * Outputs a notice when editing the page for posts in the block editor (internal use only). + * + * @ignore + * @since 5.8.0 + */ + function _wp_block_editor_posts_page_notice() + { + } + /** + * Retrieves the list of WordPress theme features (aka theme tags). + * + * @since 2.8.0 + * + * @deprecated 3.1.0 Use get_theme_feature_list() instead. + * + * @return array + */ + function install_themes_feature_list() + { + } + /** + * Displays search form for searching themes. + * + * @since 2.8.0 + * + * @param bool $type_selector + */ + function install_theme_search_form($type_selector = \true) + { + } + /** + * Displays tags filter for themes. + * + * @since 2.8.0 + */ + function install_themes_dashboard() + { + } + /** + * Displays a form to upload themes from zip files. + * + * @since 2.8.0 + */ + function install_themes_upload() + { + } + /** + * Prints a theme on the Install Themes pages. + * + * @deprecated 3.4.0 + * + * @global WP_Theme_Install_List_Table $wp_list_table + * + * @param object $theme + */ + function display_theme($theme) + { + } + /** + * Displays theme content based on theme list. + * + * @since 2.8.0 + * + * @global WP_Theme_Install_List_Table $wp_list_table + */ + function display_themes() + { + } + /** + * Displays theme information in dialog box form. + * + * @since 2.8.0 + * + * @global WP_Theme_Install_List_Table $wp_list_table + * @phpstan-return never + */ + function install_theme_information() + { + } + /** + * WordPress Theme Administration API + * + * @package WordPress + * @subpackage Administration + */ + /** + * Removes a theme. + * + * @since 2.8.0 + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @param string $stylesheet Stylesheet of the theme to delete. + * @param string $redirect Redirect to page when complete. + * @return bool|null|WP_Error True on success, false if `$stylesheet` is empty, WP_Error on failure. + * Null if filesystem credentials are required to proceed. + */ + function delete_theme($stylesheet, $redirect = '') + { + } + /** + * Gets the page templates available in this theme. + * + * @since 1.5.0 + * @since 4.7.0 Added the `$post_type` parameter. + * + * @param WP_Post|null $post Optional. The post being edited, provided for context. + * @param string $post_type Optional. Post type to get the templates for. Default 'page'. + * @return string[] Array of template file names keyed by the template header name. + */ + function get_page_templates($post = \null, $post_type = 'page') + { + } + /** + * Tidies a filename for url display by the theme file editor. + * + * @since 2.9.0 + * @access private + * + * @param string $fullpath Full path to the theme file + * @param string $containingfolder Path of the theme parent folder + * @return string + */ + function _get_template_edit_filename($fullpath, $containingfolder) + { + } + /** + * Check if there is an update for a theme available. + * + * Will display link, if there is an update available. + * + * @since 2.7.0 + * + * @see get_theme_update_available() + * + * @param WP_Theme $theme Theme data object. + */ + function theme_update_available($theme) + { + } + /** + * Retrieves the update link if there is a theme update available. + * + * Will return a link if there is an update available. + * + * @since 3.8.0 + * + * @param WP_Theme $theme WP_Theme object. + * @return string|false HTML for the update link, or false if invalid info was passed. + */ + function get_theme_update_available($theme) + { + } + /** + * Retrieves list of WordPress theme features (aka theme tags). + * + * @since 3.1.0 + * @since 3.2.0 Added 'Gray' color and 'Featured Image Header', 'Featured Images', + * 'Full Width Template', and 'Post Formats' features. + * @since 3.5.0 Added 'Flexible Header' feature. + * @since 3.8.0 Renamed 'Width' filter to 'Layout'. + * @since 3.8.0 Renamed 'Fixed Width' and 'Flexible Width' options + * to 'Fixed Layout' and 'Fluid Layout'. + * @since 3.8.0 Added 'Accessibility Ready' feature and 'Responsive Layout' option. + * @since 3.9.0 Combined 'Layout' and 'Columns' filters. + * @since 4.6.0 Removed 'Colors' filter. + * @since 4.6.0 Added 'Grid Layout' option. + * Removed 'Fixed Layout', 'Fluid Layout', and 'Responsive Layout' options. + * @since 4.6.0 Added 'Custom Logo' and 'Footer Widgets' features. + * Removed 'Blavatar' feature. + * @since 4.6.0 Added 'Blog', 'E-Commerce', 'Education', 'Entertainment', 'Food & Drink', + * 'Holiday', 'News', 'Photography', and 'Portfolio' subjects. + * Removed 'Photoblogging' and 'Seasonal' subjects. + * @since 4.9.0 Reordered the filters from 'Layout', 'Features', 'Subject' + * to 'Subject', 'Features', 'Layout'. + * @since 4.9.0 Removed 'BuddyPress', 'Custom Menu', 'Flexible Header', + * 'Front Page Posting', 'Microformats', 'RTL Language Support', + * 'Threaded Comments', and 'Translation Ready' features. + * @since 5.5.0 Added 'Block Editor Patterns', 'Block Editor Styles', + * and 'Full Site Editing' features. + * @since 5.5.0 Added 'Wide Blocks' layout option. + * @since 5.8.1 Added 'Template Editing' feature. + * @since 6.1.1 Replaced 'Full Site Editing' feature name with 'Site Editor'. + * @since 6.2.0 Added 'Style Variations' feature. + * + * @param bool $api Optional. Whether try to fetch tags from the WordPress.org API. Defaults to true. + * @return array Array of features keyed by category with translations keyed by slug. + */ + function get_theme_feature_list($api = \true) + { + } + /** + * Retrieves theme installer pages from the WordPress.org Themes API. + * + * It is possible for a theme to override the Themes API result with three + * filters. Assume this is for themes, which can extend on the Theme Info to + * offer more choices. This is very powerful and must be used with care, when + * overriding the filters. + * + * The first filter, {@see 'themes_api_args'}, is for the args and gives the action + * as the second parameter. The hook for {@see 'themes_api_args'} must ensure that + * an object is returned. + * + * The second filter, {@see 'themes_api'}, allows a plugin to override the WordPress.org + * Theme API entirely. If `$action` is 'query_themes', 'theme_information', or 'feature_list', + * an object MUST be passed. If `$action` is 'hot_tags', an array should be passed. + * + * Finally, the third filter, {@see 'themes_api_result'}, makes it possible to filter the + * response object or array, depending on the `$action` type. + * + * Supported arguments per action: + * + * | Argument Name | 'query_themes' | 'theme_information' | 'hot_tags' | 'feature_list' | + * | -------------------| :------------: | :-----------------: | :--------: | :--------------: | + * | `$slug` | No | Yes | No | No | + * | `$per_page` | Yes | No | No | No | + * | `$page` | Yes | No | No | No | + * | `$number` | No | No | Yes | No | + * | `$search` | Yes | No | No | No | + * | `$tag` | Yes | No | No | No | + * | `$author` | Yes | No | No | No | + * | `$user` | Yes | No | No | No | + * | `$browse` | Yes | No | No | No | + * | `$locale` | Yes | Yes | No | No | + * | `$fields` | Yes | Yes | No | No | + * + * @since 2.8.0 + * + * @param string $action API action to perform: Accepts 'query_themes', 'theme_information', + * 'hot_tags' or 'feature_list'. + * @param array|object $args { + * Optional. Array or object of arguments to serialize for the Themes API. Default empty array. + * + * @type string $slug The theme slug. Default empty. + * @type int $per_page Number of themes per page. Default 24. + * @type int $page Number of current page. Default 1. + * @type int $number Number of tags to be queried. + * @type string $search A search term. Default empty. + * @type string $tag Tag to filter themes. Default empty. + * @type string $author Username of an author to filter themes. Default empty. + * @type string $user Username to query for their favorites. Default empty. + * @type string $browse Browse view: 'featured', 'popular', 'updated', 'favorites'. + * @type string $locale Locale to provide context-sensitive results. Default is the value of get_locale(). + * @type array $fields { + * Array of fields which should or should not be returned. + * + * @type bool $description Whether to return the theme full description. Default false. + * @type bool $sections Whether to return the theme readme sections: description, installation, + * FAQ, screenshots, other notes, and changelog. Default false. + * @type bool $rating Whether to return the rating in percent and total number of ratings. + * Default false. + * @type bool $ratings Whether to return the number of rating for each star (1-5). Default false. + * @type bool $downloaded Whether to return the download count. Default false. + * @type bool $downloadlink Whether to return the download link for the package. Default false. + * @type bool $last_updated Whether to return the date of the last update. Default false. + * @type bool $tags Whether to return the assigned tags. Default false. + * @type bool $homepage Whether to return the theme homepage link. Default false. + * @type bool $screenshots Whether to return the screenshots. Default false. + * @type int $screenshot_count Number of screenshots to return. Default 1. + * @type bool $screenshot_url Whether to return the URL of the first screenshot. Default false. + * @type bool $photon_screenshots Whether to return the screenshots via Photon. Default false. + * @type bool $template Whether to return the slug of the parent theme. Default false. + * @type bool $parent Whether to return the slug, name and homepage of the parent theme. Default false. + * @type bool $versions Whether to return the list of all available versions. Default false. + * @type bool $theme_url Whether to return theme's URL. Default false. + * @type bool $extended_author Whether to return nicename or nicename and display name. Default false. + * } + * } + * @return object|array|WP_Error Response object or array on success, WP_Error on failure. See the + * {@link https://developer.wordpress.org/reference/functions/themes_api/ function reference article} + * for more information on the make-up of possible return objects depending on the value of `$action`. + * @phpstan-param 'query_themes'|'theme_information'|'hot_tags'|'feature_list' $action + * @phpstan-param object|array{ + * slug?: string, + * per_page?: int, + * page?: int, + * number?: int, + * search?: string, + * tag?: string, + * author?: string, + * user?: string, + * browse?: string, + * locale?: string, + * fields?: array{ + * description?: bool, + * sections?: bool, + * rating?: bool, + * ratings?: bool, + * downloaded?: bool, + * downloadlink?: bool, + * last_updated?: bool, + * tags?: bool, + * homepage?: bool, + * screenshots?: bool, + * screenshot_count?: int, + * screenshot_url?: bool, + * photon_screenshots?: bool, + * template?: bool, + * parent?: bool, + * versions?: bool, + * theme_url?: bool, + * extended_author?: bool, + * }, + * } $args + */ + function themes_api($action, $args = array()) + { + } + /** + * Prepares themes for JavaScript. + * + * @since 3.8.0 + * + * @param WP_Theme[] $themes Optional. Array of theme objects to prepare. + * Defaults to all allowed themes. + * + * @return array An associative array of theme data, sorted by name. + */ + function wp_prepare_themes_for_js($themes = \null) + { + } + /** + * Prints JS templates for the theme-browsing UI in the Customizer. + * + * @since 4.2.0 + */ + function customize_themes_print_templates() + { + } + /** + * Determines whether a theme is technically active but was paused while + * loading. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 5.2.0 + * + * @global WP_Paused_Extensions_Storage $_paused_themes + * + * @param string $theme Path to the theme directory relative to the themes directory. + * @return bool True, if in the list of paused themes. False, not in the list. + */ + function is_theme_paused($theme) + { + } + /** + * Gets the error that was recorded for a paused theme. + * + * @since 5.2.0 + * + * @global WP_Paused_Extensions_Storage $_paused_themes + * + * @param string $theme Path to the theme directory relative to the themes + * directory. + * @return array|false Array of error information as it was returned by + * `error_get_last()`, or false if none was recorded. + */ + function wp_get_theme_error($theme) + { + } + /** + * Tries to resume a single theme. + * + * If a redirect was provided and a functions.php file was found, we first ensure that + * functions.php file does not throw fatal errors anymore. + * + * The way it works is by setting the redirection to the error before trying to + * include the file. If the theme fails, then the redirection will not be overwritten + * with the success message and the theme will not be resumed. + * + * @since 5.2.0 + * + * @global string $wp_stylesheet_path Path to current theme's stylesheet directory. + * @global string $wp_template_path Path to current theme's template directory. + * + * @param string $theme Single theme to resume. + * @param string $redirect Optional. URL to redirect to. Default empty string. + * @return bool|WP_Error True on success, false if `$theme` was not paused, + * `WP_Error` on failure. + */ + function resume_theme($theme, $redirect = '') + { + } + /** + * Renders an admin notice in case some themes have been paused due to errors. + * + * @since 5.2.0 + * + * @global string $pagenow The filename of the current screen. + * @global WP_Paused_Extensions_Storage $_paused_themes + * @phpstan-return void + */ + function paused_themes_notice() + { + } + /** + * WordPress Translation Installation Administration API + * + * @package WordPress + * @subpackage Administration + */ + /** + * Retrieve translations from WordPress Translation API. + * + * @since 4.0.0 + * + * @param string $type Type of translations. Accepts 'plugins', 'themes', 'core'. + * @param array|object $args Translation API arguments. Optional. + * @return array|WP_Error On success an associative array of translations, WP_Error on failure. + */ + function translations_api($type, $args = \null) + { + } + /** + * Get available translations from the WordPress.org API. + * + * @since 4.0.0 + * + * @see translations_api() + * + * @return array[] Array of translations, each an array of data, keyed by the language. If the API response results + * in an error, an empty array will be returned. + */ + function wp_get_available_translations() + { + } + /** + * Output the select form for the language selection on the installation screen. + * + * @since 4.0.0 + * + * @global string $wp_local_package Locale code of the package. + * + * @param array[] $languages Array of available languages (populated via the Translation API). + */ + function wp_install_language_form($languages) + { + } + /** + * Download a language pack. + * + * @since 4.0.0 + * + * @see wp_get_available_translations() + * + * @param string $download Language code to download. + * @return string|false Returns the language code if successfully downloaded + * (or already installed), or false on failure. + */ + function wp_download_language_pack($download) + { + } + /** + * Check if WordPress has access to the filesystem without asking for + * credentials. + * + * @since 4.0.0 + * + * @return bool Returns true on success, false on failure. + */ + function wp_can_install_language_pack() + { + } + /** + * Upgrades the core of WordPress. + * + * This will create a .maintenance file at the base of the WordPress directory + * to ensure that people can not access the website, when the files are being + * copied to their locations. + * + * The files in the `$_old_files` list will be removed and the new files + * copied from the zip file after the database is upgraded. + * + * The files in the `$_new_bundled_files` list will be added to the installation + * if the version is greater than or equal to the old version being upgraded. + * + * The steps for the upgrader for after the new release is downloaded and + * unzipped is: + * 1. Test unzipped location for select files to ensure that unzipped worked. + * 2. Create the .maintenance file in current WordPress base. + * 3. Copy new WordPress directory over old WordPress files. + * 4. Upgrade WordPress to new version. + * 4.1. Copy all files/folders other than wp-content + * 4.2. Copy any language files to WP_LANG_DIR (which may differ from WP_CONTENT_DIR + * 4.3. Copy any new bundled themes/plugins to their respective locations + * 5. Delete new WordPress directory path. + * 6. Delete .maintenance file. + * 7. Remove old files. + * 8. Delete 'update_core' option. + * + * There are several areas of failure. For instance if PHP times out before step + * 6, then you will not be able to access any portion of your site. Also, since + * the upgrade will not continue where it left off, you will not be able to + * automatically remove old files and remove the 'update_core' option. This + * isn't that bad. + * + * If the copy of the new WordPress over the old fails, then the worse is that + * the new WordPress directory will remain. + * + * If it is assumed that every file will be copied over, including plugins and + * themes, then if you edit the default theme, you should rename it, so that + * your changes remain. + * + * @since 2.7.0 + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * @global array $_old_files + * @global array $_old_requests_files + * @global array $_new_bundled_files + * @global wpdb $wpdb WordPress database abstraction object. + * @global string $wp_version + * @global string $required_php_version + * @global string $required_mysql_version + * + * @param string $from New release unzipped path. + * @param string $to Path to old WordPress installation. + * @return string|WP_Error New WordPress version on success, WP_Error on failure. + */ + function update_core($from, $to) + { + } + /** + * Preloads old Requests classes and interfaces. + * + * This function preloads the old Requests code into memory before the + * upgrade process deletes the files. Why? Requests code is loaded into + * memory via an autoloader, meaning when a class or interface is needed + * If a request is in process, Requests could attempt to access code. If + * the file is not there, a fatal error could occur. If the file was + * replaced, the new code is not compatible with the old, resulting in + * a fatal error. Preloading ensures the code is in memory before the + * code is updated. + * + * @since 6.2.0 + * + * @global array $_old_requests_files Requests files to be preloaded. + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * @global string $wp_version The WordPress version string. + * + * @param string $to Path to old WordPress installation. + * @phpstan-return void + */ + function _preload_old_requests_classes_and_interfaces($to) + { + } + /** + * Redirect to the About WordPress page after a successful upgrade. + * + * This function is only needed when the existing installation is older than 3.4.0. + * + * @since 3.3.0 + * + * @global string $wp_version The WordPress version string. + * @global string $pagenow The filename of the current screen. + * @global string $action + * + * @param string $new_version + * @phpstan-return void + */ + function _redirect_to_about_wordpress($new_version) + { + } + /** + * Cleans up Genericons example files. + * + * @since 4.2.2 + * + * @global array $wp_theme_directories + * @global WP_Filesystem_Base $wp_filesystem + */ + function _upgrade_422_remove_genericons() + { + } + /** + * Recursively find Genericons example files in a given folder. + * + * @ignore + * @since 4.2.2 + * + * @param string $directory Directory path. Expects trailingslashed. + * @return array + */ + function _upgrade_422_find_genericons_files_in_folder($directory) + { + } + /** + * @ignore + * @since 4.4.0 + */ + function _upgrade_440_force_deactivate_incompatible_plugins() + { + } + /** + * @access private + * @ignore + * @since 5.8.0 + * @since 5.9.0 The minimum compatible version of Gutenberg is 11.9. + * @since 6.1.1 The minimum compatible version of Gutenberg is 14.1. + * @since 6.4.0 The minimum compatible version of Gutenberg is 16.5. + * @since 6.5.0 The minimum compatible version of Gutenberg is 17.6. + */ + function _upgrade_core_deactivate_incompatible_plugins() + { + } + /** + * WordPress Administration Update API + * + * @package WordPress + * @subpackage Administration + */ + /** + * Selects the first update version from the update_core option. + * + * @since 2.7.0 + * + * @return object|array|false The response from the API on success, false on failure. + */ + function get_preferred_from_update_core() + { + } + /** + * Gets available core updates. + * + * @since 2.7.0 + * + * @param array $options Set $options['dismissed'] to true to show dismissed upgrades too, + * set $options['available'] to false to skip not-dismissed updates. + * @return array|false Array of the update objects on success, false on failure. + */ + function get_core_updates($options = array()) + { + } + /** + * Gets the best available (and enabled) Auto-Update for WordPress core. + * + * If there's 1.2.3 and 1.3 on offer, it'll choose 1.3 if the installation allows it, else, 1.2.3. + * + * @since 3.7.0 + * + * @return object|false The core update offering on success, false on failure. + */ + function find_core_auto_update() + { + } + /** + * Gets and caches the checksums for the given version of WordPress. + * + * @since 3.7.0 + * + * @param string $version Version string to query. + * @param string $locale Locale to query. + * @return array|false An array of checksums on success, false on failure. + */ + function get_core_checksums($version, $locale) + { + } + /** + * Dismisses core update. + * + * @since 2.7.0 + * + * @param object $update + * @return bool + */ + function dismiss_core_update($update) + { + } + /** + * Undismisses core update. + * + * @since 2.7.0 + * + * @param string $version + * @param string $locale + * @return bool + */ + function undismiss_core_update($version, $locale) + { + } + /** + * Finds the available update for WordPress core. + * + * @since 2.7.0 + * + * @param string $version Version string to find the update for. + * @param string $locale Locale to find the update for. + * @return object|false The core update offering on success, false on failure. + */ + function find_core_update($version, $locale) + { + } + /** + * Returns core update footer message. + * + * @since 2.3.0 + * + * @param string $msg + * @return string + */ + function core_update_footer($msg = '') + { + } + /** + * Returns core update notification message. + * + * @since 2.3.0 + * + * @global string $pagenow The filename of the current screen. + * @return void|false + */ + function update_nag() + { + } + /** + * Displays WordPress version and active theme in the 'At a Glance' dashboard widget. + * + * @since 2.5.0 + */ + function update_right_now_message() + { + } + /** + * Retrieves plugins with updates available. + * + * @since 2.9.0 + * + * @return array + */ + function get_plugin_updates() + { + } + /** + * Adds a callback to display update information for plugins with updates available. + * + * @since 2.9.0 + * @phpstan-return void + */ + function wp_plugin_update_rows() + { + } + /** + * Displays update information for a plugin. + * + * @since 2.3.0 + * + * @param string $file Plugin basename. + * @param array $plugin_data Plugin information. + * @return void|false + */ + function wp_plugin_update_row($file, $plugin_data) + { + } + /** + * Retrieves themes with updates available. + * + * @since 2.9.0 + * + * @return array + */ + function get_theme_updates() + { + } + /** + * Adds a callback to display update information for themes with updates available. + * + * @since 3.1.0 + * @phpstan-return void + */ + function wp_theme_update_rows() + { + } + /** + * Displays update information for a theme. + * + * @since 3.1.0 + * + * @param string $theme_key Theme stylesheet. + * @param WP_Theme $theme Theme object. + * @return void|false + */ + function wp_theme_update_row($theme_key, $theme) + { + } + /** + * Displays maintenance nag HTML message. + * + * @since 2.7.0 + * + * @global int $upgrading + * + * @return void|false + */ + function maintenance_nag() + { + } + /** + * Prints the JavaScript templates for update admin notices. + * + * @since 4.6.0 + * + * Template takes one argument with four values: + * + * param {object} data { + * Arguments for admin notice. + * + * @type string id ID of the notice. + * @type string className Class names for the notice. + * @type string message The notice's message. + * @type string type The type of update the notice is for. Either 'plugin' or 'theme'. + * } + */ + function wp_print_admin_notice_templates() + { + } + /** + * Prints the JavaScript templates for update and deletion rows in list tables. + * + * @since 4.6.0 + * + * The update template takes one argument with four values: + * + * param {object} data { + * Arguments for the update row + * + * @type string slug Plugin slug. + * @type string plugin Plugin base name. + * @type string colspan The number of table columns this row spans. + * @type string content The row content. + * } + * + * The delete template takes one argument with four values: + * + * param {object} data { + * Arguments for the update row + * + * @type string slug Plugin slug. + * @type string plugin Plugin base name. + * @type string name Plugin name. + * @type string colspan The number of table columns this row spans. + * } + */ + function wp_print_update_row_templates() + { + } + /** + * Displays a notice when the user is in recovery mode. + * + * @since 5.2.0 + * @phpstan-return void + */ + function wp_recovery_mode_nag() + { + } + /** + * Checks whether auto-updates are enabled. + * + * @since 5.5.0 + * + * @param string $type The type of update being checked: Either 'theme' or 'plugin'. + * @return bool True if auto-updates are enabled for `$type`, false otherwise. + * @phpstan-param 'theme'|'plugin' $type + */ + function wp_is_auto_update_enabled_for_type($type) + { + } + /** + * Checks whether auto-updates are forced for an item. + * + * @since 5.6.0 + * + * @param string $type The type of update being checked: Either 'theme' or 'plugin'. + * @param bool|null $update Whether to update. The value of null is internally used + * to detect whether nothing has hooked into this filter. + * @param object $item The update offer. + * @return bool True if auto-updates are forced for `$item`, false otherwise. + * @phpstan-param 'theme'|'plugin' $type + */ + function wp_is_auto_update_forced_for_item($type, $update, $item) + { + } + /** + * Determines the appropriate auto-update message to be displayed. + * + * @since 5.5.0 + * + * @return string The update message to be shown. + */ + function wp_get_auto_update_message() + { + } + /** + * Installs the site. + * + * Runs the required functions to set up and populate the database, + * including primary admin user and initial options. + * + * @since 2.1.0 + * + * @param string $blog_title Site title. + * @param string $user_name User's username. + * @param string $user_email User's email. + * @param bool $is_public Whether the site is public. + * @param string $deprecated Optional. Not used. + * @param string $user_password Optional. User's chosen password. Default empty (random password). + * @param string $language Optional. Language chosen. Default empty. + * @return array { + * Data for the newly installed site. + * + * @type string $url The URL of the site. + * @type int $user_id The ID of the site owner. + * @type string $password The password of the site owner, if their user account didn't already exist. + * @type string $password_message The explanatory message regarding the password. + * } + * @phpstan-return array{ + * url: string, + * user_id: int, + * password: string, + * password_message: string, + * } + */ + function wp_install($blog_title, $user_name, $user_email, $is_public, $deprecated = '', $user_password = '', $language = '') + { + } + /** + * Creates the initial content for a newly-installed site. + * + * Adds the default "Uncategorized" category, the first post (with comment), + * first page, and default widgets for default theme for the current version. + * + * @since 2.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * @global string $table_prefix The database table prefix. + * + * @param int $user_id User ID. + */ + function wp_install_defaults($user_id) + { + } + /** + * Maybe enable pretty permalinks on installation. + * + * If after enabling pretty permalinks don't work, fallback to query-string permalinks. + * + * @since 4.2.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @return bool Whether pretty permalinks are enabled. False otherwise. + */ + function wp_install_maybe_enable_pretty_permalinks() + { + } + /** + * Notifies the site admin that the installation of WordPress is complete. + * + * Sends an email to the new administrator that the installation is complete + * and provides them with a record of their login credentials. + * + * @since 2.1.0 + * + * @param string $blog_title Site title. + * @param string $blog_url Site URL. + * @param int $user_id Administrator's user ID. + * @param string $password Administrator's password. Note that a placeholder message is + * usually passed instead of the actual password. + */ + function wp_new_blog_notification($blog_title, $blog_url, $user_id, $password) + { + } + /** + * Runs WordPress Upgrade functions. + * + * Upgrades the database if needed during a site update. + * + * @since 2.1.0 + * + * @global int $wp_current_db_version The old (current) database version. + * @global int $wp_db_version The new database version. + * @phpstan-return void + */ + function wp_upgrade() + { + } + /** + * Functions to be called in installation and upgrade scripts. + * + * Contains conditional checks to determine which upgrade scripts to run, + * based on database version and WP version being updated-to. + * + * @ignore + * @since 1.0.1 + * + * @global int $wp_current_db_version The old (current) database version. + * @global int $wp_db_version The new database version. + * @phpstan-return void + */ + function upgrade_all() + { + } + /** + * Execute changes made in WordPress 1.0. + * + * @ignore + * @since 1.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + */ + function upgrade_100() + { + } + /** + * Execute changes made in WordPress 1.0.1. + * + * @ignore + * @since 1.0.1 + * + * @global wpdb $wpdb WordPress database abstraction object. + */ + function upgrade_101() + { + } + /** + * Execute changes made in WordPress 1.2. + * + * @ignore + * @since 1.2.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + */ + function upgrade_110() + { + } + /** + * Execute changes made in WordPress 1.5. + * + * @ignore + * @since 1.5.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + */ + function upgrade_130() + { + } + /** + * Execute changes made in WordPress 2.0. + * + * @ignore + * @since 2.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * @global int $wp_current_db_version The old (current) database version. + */ + function upgrade_160() + { + } + /** + * Execute changes made in WordPress 2.1. + * + * @ignore + * @since 2.1.0 + * + * @global int $wp_current_db_version The old (current) database version. + * @global wpdb $wpdb WordPress database abstraction object. + */ + function upgrade_210() + { + } + /** + * Execute changes made in WordPress 2.3. + * + * @ignore + * @since 2.3.0 + * + * @global int $wp_current_db_version The old (current) database version. + * @global wpdb $wpdb WordPress database abstraction object. + */ + function upgrade_230() + { + } + /** + * Remove old options from the database. + * + * @ignore + * @since 2.3.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + */ + function upgrade_230_options_table() + { + } + /** + * Remove old categories, link2cat, and post2cat database tables. + * + * @ignore + * @since 2.3.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + */ + function upgrade_230_old_tables() + { + } + /** + * Upgrade old slugs made in version 2.2. + * + * @ignore + * @since 2.2.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + */ + function upgrade_old_slugs() + { + } + /** + * Execute changes made in WordPress 2.5.0. + * + * @ignore + * @since 2.5.0 + * + * @global int $wp_current_db_version The old (current) database version. + */ + function upgrade_250() + { + } + /** + * Execute changes made in WordPress 2.5.2. + * + * @ignore + * @since 2.5.2 + * + * @global wpdb $wpdb WordPress database abstraction object. + */ + function upgrade_252() + { + } + /** + * Execute changes made in WordPress 2.6. + * + * @ignore + * @since 2.6.0 + * + * @global int $wp_current_db_version The old (current) database version. + */ + function upgrade_260() + { + } + /** + * Execute changes made in WordPress 2.7. + * + * @ignore + * @since 2.7.0 + * + * @global int $wp_current_db_version The old (current) database version. + * @global wpdb $wpdb WordPress database abstraction object. + */ + function upgrade_270() + { + } + /** + * Execute changes made in WordPress 2.8. + * + * @ignore + * @since 2.8.0 + * + * @global int $wp_current_db_version The old (current) database version. + * @global wpdb $wpdb WordPress database abstraction object. + */ + function upgrade_280() + { + } + /** + * Execute changes made in WordPress 2.9. + * + * @ignore + * @since 2.9.0 + * + * @global int $wp_current_db_version The old (current) database version. + */ + function upgrade_290() + { + } + /** + * Execute changes made in WordPress 3.0. + * + * @ignore + * @since 3.0.0 + * + * @global int $wp_current_db_version The old (current) database version. + * @global wpdb $wpdb WordPress database abstraction object. + */ + function upgrade_300() + { + } + /** + * Execute changes made in WordPress 3.3. + * + * @ignore + * @since 3.3.0 + * + * @global int $wp_current_db_version The old (current) database version. + * @global wpdb $wpdb WordPress database abstraction object. + * @global array $wp_registered_widgets + * @global array $sidebars_widgets + * @phpstan-return void + */ + function upgrade_330() + { + } + /** + * Execute changes made in WordPress 3.4. + * + * @ignore + * @since 3.4.0 + * + * @global int $wp_current_db_version The old (current) database version. + * @global wpdb $wpdb WordPress database abstraction object. + */ + function upgrade_340() + { + } + /** + * Execute changes made in WordPress 3.5. + * + * @ignore + * @since 3.5.0 + * + * @global int $wp_current_db_version The old (current) database version. + * @global wpdb $wpdb WordPress database abstraction object. + */ + function upgrade_350() + { + } + /** + * Execute changes made in WordPress 3.7. + * + * @ignore + * @since 3.7.0 + * + * @global int $wp_current_db_version The old (current) database version. + */ + function upgrade_370() + { + } + /** + * Execute changes made in WordPress 3.7.2. + * + * @ignore + * @since 3.7.2 + * + * @global int $wp_current_db_version The old (current) database version. + */ + function upgrade_372() + { + } + /** + * Execute changes made in WordPress 3.8.0. + * + * @ignore + * @since 3.8.0 + * + * @global int $wp_current_db_version The old (current) database version. + */ + function upgrade_380() + { + } + /** + * Execute changes made in WordPress 4.0.0. + * + * @ignore + * @since 4.0.0 + * + * @global int $wp_current_db_version The old (current) database version. + */ + function upgrade_400() + { + } + /** + * Execute changes made in WordPress 4.2.0. + * + * @ignore + * @since 4.2.0 + */ + function upgrade_420() + { + } + /** + * Executes changes made in WordPress 4.3.0. + * + * @ignore + * @since 4.3.0 + * + * @global int $wp_current_db_version The old (current) database version. + * @global wpdb $wpdb WordPress database abstraction object. + */ + function upgrade_430() + { + } + /** + * Executes comments changes made in WordPress 4.3.0. + * + * @ignore + * @since 4.3.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * @phpstan-return void + */ + function upgrade_430_fix_comments() + { + } + /** + * Executes changes made in WordPress 4.3.1. + * + * @ignore + * @since 4.3.1 + */ + function upgrade_431() + { + } + /** + * Executes changes made in WordPress 4.4.0. + * + * @ignore + * @since 4.4.0 + * + * @global int $wp_current_db_version The old (current) database version. + * @global wpdb $wpdb WordPress database abstraction object. + */ + function upgrade_440() + { + } + /** + * Executes changes made in WordPress 4.5.0. + * + * @ignore + * @since 4.5.0 + * + * @global int $wp_current_db_version The old (current) database version. + * @global wpdb $wpdb WordPress database abstraction object. + */ + function upgrade_450() + { + } + /** + * Executes changes made in WordPress 4.6.0. + * + * @ignore + * @since 4.6.0 + * + * @global int $wp_current_db_version The old (current) database version. + */ + function upgrade_460() + { + } + /** + * Executes changes made in WordPress 5.0.0. + * + * @ignore + * @since 5.0.0 + * @deprecated 5.1.0 + */ + function upgrade_500() + { + } + /** + * Executes changes made in WordPress 5.1.0. + * + * @ignore + * @since 5.1.0 + */ + function upgrade_510() + { + } + /** + * Executes changes made in WordPress 5.3.0. + * + * @ignore + * @since 5.3.0 + */ + function upgrade_530() + { + } + /** + * Executes changes made in WordPress 5.5.0. + * + * @ignore + * @since 5.5.0 + * + * @global int $wp_current_db_version The old (current) database version. + */ + function upgrade_550() + { + } + /** + * Executes changes made in WordPress 5.6.0. + * + * @ignore + * @since 5.6.0 + * + * @global int $wp_current_db_version The old (current) database version. + * @global wpdb $wpdb WordPress database abstraction object. + */ + function upgrade_560() + { + } + /** + * Executes changes made in WordPress 5.9.0. + * + * @ignore + * @since 5.9.0 + * + * @global int $wp_current_db_version The old (current) database version. + */ + function upgrade_590() + { + } + /** + * Executes changes made in WordPress 6.0.0. + * + * @ignore + * @since 6.0.0 + * + * @global int $wp_current_db_version The old (current) database version. + */ + function upgrade_600() + { + } + /** + * Executes changes made in WordPress 6.3.0. + * + * @ignore + * @since 6.3.0 + * + * @global int $wp_current_db_version The old (current) database version. + */ + function upgrade_630() + { + } + /** + * Executes changes made in WordPress 6.4.0. + * + * @ignore + * @since 6.4.0 + * + * @global int $wp_current_db_version The old (current) database version. + */ + function upgrade_640() + { + } + /** + * Executes changes made in WordPress 6.5.0. + * + * @ignore + * @since 6.5.0 + * + * @global int $wp_current_db_version The old (current) database version. + * @global wpdb $wpdb WordPress database abstraction object. + */ + function upgrade_650() + { + } + /** + * Executes network-level upgrade routines. + * + * @since 3.0.0 + * + * @global int $wp_current_db_version The old (current) database version. + * @global wpdb $wpdb WordPress database abstraction object. + */ + function upgrade_network() + { + } + // + // General functions we use to actually do stuff. + // + /** + * Creates a table in the database, if it doesn't already exist. + * + * This method checks for an existing database table and creates a new one if it's not + * already present. It doesn't rely on MySQL's "IF NOT EXISTS" statement, but chooses + * to query all tables first and then run the SQL statement creating the table. + * + * @since 1.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $table_name Database table name. + * @param string $create_ddl SQL statement to create table. + * @return bool True on success or if the table already exists. False on failure. + */ + function maybe_create_table($table_name, $create_ddl) + { + } + /** + * Drops a specified index from a table. + * + * @since 1.0.1 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $table Database table name. + * @param string $index Index name to drop. + * @return true True, when finished. + */ + function drop_index($table, $index) + { + } + /** + * Adds an index to a specified table. + * + * @since 1.0.1 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $table Database table name. + * @param string $index Database table index column. + * @return true True, when done with execution. + */ + function add_clean_index($table, $index) + { + } + /** + * Adds column to a database table, if it doesn't already exist. + * + * @since 1.3.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $table_name Database table name. + * @param string $column_name Table column name. + * @param string $create_ddl SQL statement to add column. + * @return bool True on success or if the column already exists. False on failure. + */ + function maybe_add_column($table_name, $column_name, $create_ddl) + { + } + /** + * If a table only contains utf8 or utf8mb4 columns, convert it to utf8mb4. + * + * @since 4.2.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $table The table to convert. + * @return bool True if the table was converted, false if it wasn't. + */ + function maybe_convert_table_to_utf8mb4($table) + { + } + /** + * Retrieve all options as it was for 1.2. + * + * @since 1.2.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return stdClass List of options. + */ + function get_alloptions_110() + { + } + /** + * Utility version of get_option that is private to installation/upgrade. + * + * @ignore + * @since 1.5.1 + * @access private + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $setting Option name. + * @return mixed + */ + function __get_option($setting) + { + } + /** + * Filters for content to remove unnecessary slashes. + * + * @since 1.5.0 + * + * @param string $content The content to modify. + * @return string The de-slashed content. + */ + function deslash($content) + { + } + /** + * Modifies the database based on specified SQL statements. + * + * Useful for creating new tables and updating existing tables to a new structure. + * + * @since 1.5.0 + * @since 6.1.0 Ignores display width for integer data types on MySQL 8.0.17 or later, + * to match MySQL behavior. Note: This does not affect MariaDB. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string[]|string $queries Optional. The query to run. Can be multiple queries + * in an array, or a string of queries separated by + * semicolons. Default empty string. + * @param bool $execute Optional. Whether or not to execute the query right away. + * Default true. + * @return array Strings containing the results of the various update queries. + */ + function dbDelta($queries = '', $execute = \true) + { + } + /** + * Updates the database tables to a new schema. + * + * By default, updates all the tables to use the latest defined schema, but can also + * be used to update a specific set of tables in wp_get_db_schema(). + * + * @since 1.5.0 + * + * @uses dbDelta + * + * @param string $tables Optional. Which set of tables to update. Default is 'all'. + */ + function make_db_current($tables = 'all') + { + } + /** + * Updates the database tables to a new schema, but without displaying results. + * + * By default, updates all the tables to use the latest defined schema, but can + * also be used to update a specific set of tables in wp_get_db_schema(). + * + * @since 1.5.0 + * + * @see make_db_current() + * + * @param string $tables Optional. Which set of tables to update. Default is 'all'. + */ + function make_db_current_silent($tables = 'all') + { + } + /** + * Creates a site theme from an existing theme. + * + * {@internal Missing Long Description}} + * + * @since 1.5.0 + * + * @param string $theme_name The name of the theme. + * @param string $template The directory name of the theme. + * @return bool + */ + function make_site_theme_from_oldschool($theme_name, $template) + { + } + /** + * Creates a site theme from the default theme. + * + * {@internal Missing Long Description}} + * + * @since 1.5.0 + * + * @param string $theme_name The name of the theme. + * @param string $template The directory name of the theme. + * @return void|false + */ + function make_site_theme_from_default($theme_name, $template) + { + } + /** + * Creates a site theme. + * + * {@internal Missing Long Description}} + * + * @since 1.5.0 + * + * @return string|false + */ + function make_site_theme() + { + } + /** + * Translate user level to user role name. + * + * @since 2.0.0 + * + * @param int $level User level. + * @return string User role name. + */ + function translate_level_to_role($level) + { + } + /** + * Checks the version of the installed MySQL binary. + * + * @since 2.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + */ + function wp_check_mysql_version() + { + } + /** + * Disables the Automattic widgets plugin, which was merged into core. + * + * @since 2.2.0 + */ + function maybe_disable_automattic_widgets() + { + } + /** + * Disables the Link Manager on upgrade if, at the time of upgrade, no links exist in the DB. + * + * @since 3.5.0 + * + * @global int $wp_current_db_version The old (current) database version. + * @global wpdb $wpdb WordPress database abstraction object. + */ + function maybe_disable_link_manager() + { + } + /** + * Runs before the schema is upgraded. + * + * @since 2.9.0 + * + * @global int $wp_current_db_version The old (current) database version. + * @global wpdb $wpdb WordPress database abstraction object. + */ + function pre_schema_upgrade() + { + } + /** + * Determine if global tables should be upgraded. + * + * This function performs a series of checks to ensure the environment allows + * for the safe upgrading of global WordPress database tables. It is necessary + * because global tables will commonly grow to millions of rows on large + * installations, and the ability to control their upgrade routines can be + * critical to the operation of large networks. + * + * In a future iteration, this function may use `wp_is_large_network()` to more- + * intelligently prevent global table upgrades. Until then, we make sure + * WordPress is on the main site of the main network, to avoid running queries + * more than once in multi-site or multi-network environments. + * + * @since 4.3.0 + * + * @return bool Whether to run the upgrade routines on global tables. + */ + function wp_should_upgrade_global_tables() + { + } + /** + * WordPress user administration API. + * + * @package WordPress + * @subpackage Administration + */ + /** + * Creates a new user from the "Users" form using $_POST information. + * + * @since 2.0.0 + * + * @return int|WP_Error WP_Error or User ID. + */ + function add_user() + { + } + /** + * Edit user settings based on contents of $_POST + * + * Used on user-edit.php and profile.php to manage and process user options, passwords etc. + * + * @since 2.0.0 + * + * @param int $user_id Optional. User ID. + * @return int|WP_Error User ID of the updated user or WP_Error on failure. + */ + function edit_user($user_id = 0) + { + } + /** + * Fetch a filtered list of user roles that the current user is + * allowed to edit. + * + * Simple function whose main purpose is to allow filtering of the + * list of roles in the $wp_roles object so that plugins can remove + * inappropriate ones depending on the situation or user making edits. + * Specifically because without filtering anyone with the edit_users + * capability can edit others to be administrators, even if they are + * only editors or authors. This filter allows admins to delegate + * user management. + * + * @since 2.8.0 + * + * @return array[] Array of arrays containing role information. + */ + function get_editable_roles() + { + } + /** + * Retrieve user data and filter it. + * + * @since 2.0.5 + * + * @param int $user_id User ID. + * @return WP_User|false WP_User object on success, false on failure. + */ + function get_user_to_edit($user_id) + { + } + /** + * Retrieve the user's drafts. + * + * @since 2.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $user_id User ID. + * @return array + */ + function get_users_drafts($user_id) + { + } + /** + * Delete user and optionally reassign posts and links to another user. + * + * Note that on a Multisite installation the user only gets removed from the site + * and does not get deleted from the database. + * + * If the `$reassign` parameter is not assigned to a user ID, then all posts will + * be deleted of that user. The action {@see 'delete_user'} that is passed the user ID + * being deleted will be run after the posts are either reassigned or deleted. + * The user meta will also be deleted that are for that user ID. + * + * @since 2.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $id User ID. + * @param int $reassign Optional. Reassign posts and links to new User ID. + * @return bool True when finished. + */ + function wp_delete_user($id, $reassign = \null) + { + } + /** + * Remove all capabilities from user. + * + * @since 2.1.0 + * + * @param int $id User ID. + */ + function wp_revoke_user($id) + { + } + /** + * @since 2.8.0 + * + * @global int $user_ID + * + * @param false $errors Deprecated. + * @phpstan-return void + */ + function default_password_nag_handler($errors = \false) + { + } + /** + * @since 2.8.0 + * + * @param int $user_ID + * @param WP_User $old_data + * @phpstan-return void + */ + function default_password_nag_edit_user($user_ID, $old_data) + { + } + /** + * @since 2.8.0 + * + * @global string $pagenow The filename of the current screen. + * @phpstan-return void + */ + function default_password_nag() + { + } + /** + * @since 3.5.0 + * @access private + */ + function delete_users_add_js() + { + } + /** + * Optional SSL preference that can be turned on by hooking to the 'personal_options' action. + * + * See the {@see 'personal_options'} action. + * + * @since 2.7.0 + * + * @param WP_User $user User data object. + */ + function use_ssl_preference($user) + { + } + /** + * @since MU (3.0.0) + * + * @param string $text + * @return string + */ + function admin_created_user_email($text) + { + } + /** + * Checks if the Authorize Application Password request is valid. + * + * @since 5.6.0 + * @since 6.2.0 Allow insecure HTTP connections for the local environment. + * @since 6.3.2 Validates the success and reject URLs to prevent `javascript` pseudo protocol from being executed. + * + * @param array $request { + * The array of request data. All arguments are optional and may be empty. + * + * @type string $app_name The suggested name of the application. + * @type string $app_id A UUID provided by the application to uniquely identify it. + * @type string $success_url The URL the user will be redirected to after approving the application. + * @type string $reject_url The URL the user will be redirected to after rejecting the application. + * } + * @param WP_User $user The user authorizing the application. + * @return true|WP_Error True if the request is valid, a WP_Error object contains errors if not. + * @phpstan-param array{ + * app_name?: string, + * app_id?: string, + * success_url?: string, + * reject_url?: string, + * } $request + */ + function wp_is_authorize_application_password_request_valid($request, $user) + { + } + /** + * Validates the redirect URL protocol scheme. The protocol can be anything except `http` and `javascript`. + * + * @since 6.3.2 + * + * @param string $url The redirect URL to be validated. + * @return true|WP_Error True if the redirect URL is valid, a WP_Error object otherwise. + */ + function wp_is_authorize_application_redirect_url_valid($url) + { + } + /** + * WordPress Widgets Administration API + * + * @package WordPress + * @subpackage Administration + */ + /** + * Display list of the available widgets. + * + * @since 2.5.0 + * + * @global array $wp_registered_widgets + * @global array $wp_registered_widget_controls + */ + function wp_list_widgets() + { + } + /** + * Callback to sort array by a 'name' key. + * + * @since 3.1.0 + * @access private + * + * @param array $a First array. + * @param array $b Second array. + * @return int + */ + function _sort_name_callback($a, $b) + { + } + /** + * Show the widgets and their settings for a sidebar. + * Used in the admin widget config screen. + * + * @since 2.5.0 + * + * @param string $sidebar Sidebar ID. + * @param string $sidebar_name Optional. Sidebar name. Default empty. + */ + function wp_list_widget_controls($sidebar, $sidebar_name = '') + { + } + /** + * Retrieves the widget control arguments. + * + * @since 2.5.0 + * + * @global array $wp_registered_widgets + * + * @param array $params + * @return array + */ + function wp_list_widget_controls_dynamic_sidebar($params) + { + } + /** + * @global array $wp_registered_widgets + * + * @param string $id_base + * @return int + */ + function next_widget_id_number($id_base) + { + } + /** + * Meta widget used to display the control form for a widget. + * + * Called from dynamic_sidebar(). + * + * @since 2.5.0 + * + * @global array $wp_registered_widgets + * @global array $wp_registered_widget_controls + * @global array $sidebars_widgets + * + * @param array $sidebar_args + * @return array + */ + function wp_widget_control($sidebar_args) + { + } + /** + * @param string $classes + * @return string + */ + function wp_widgets_access_body_class($classes) + { + } + /** + * Display installation header. + * + * @since 2.5.0 + * + * @param string $body_classes + */ + function display_header($body_classes = '') + { + } + // End display_header(). + /** + * Displays installer setup form. + * + * @since 2.8.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string|null $error + */ + function display_setup_form($error = \null) + { + } + /** + * Starts a new XML tag. + * + * Callback function for xml_set_element_handler(). + * + * @since 0.71 + * @access private + * + * @global array $names + * @global array $urls + * @global array $targets + * @global array $descriptions + * @global array $feeds + * + * @param resource $parser XML Parser resource. + * @param string $tag_name XML element name. + * @param array $attrs XML element attributes. + */ + function startElement($parser, $tag_name, $attrs) + { + } + /** + * Ends a new XML tag. + * + * Callback function for xml_set_element_handler(). + * + * @since 0.71 + * @access private + * + * @param resource $parser XML Parser resource. + * @param string $tag_name XML tag name. + */ + function endElement($parser, $tag_name) + { + } + /** + * Display menu. + * + * @access private + * @since 2.7.0 + * + * @global string $self + * @global string $parent_file + * @global string $submenu_file + * @global string $plugin_page + * @global string $typenow The post type of the current screen. + * + * @param array $menu + * @param array $submenu + * @param bool $submenu_as_parent + */ + function _wp_menu_output($menu, $submenu, $submenu_as_parent = \true) + { + } + /** + * Adds the 'Theme File Editor' menu item to the bottom of the Appearance (non-block themes) + * or Tools (block themes) menu. + * + * @access private + * @since 3.0.0 + * @since 5.9.0 Renamed 'Theme Editor' to 'Theme File Editor'. + * Relocates to Tools for block themes. + */ + function _add_themes_utility_last() + { + } + /** + * Adds the 'Plugin File Editor' menu item after the 'Themes File Editor' in Tools + * for block themes. + * + * @access private + * @since 5.9.0 + * @phpstan-return void + */ + function _add_plugin_file_editor_to_tools() + { + } + /** + * @global int $_wp_nav_menu_max_depth + * + * @param string $classes + * @return string + */ + function wp_nav_menu_max_depth($classes) + { + } + function wp_load_press_this() + { + } + /** + * Display setup wp-config.php file header. + * + * @ignore + * @since 2.3.0 + * + * @param string|string[] $body_classes Class attribute values for the body tag. + */ + function setup_config_display_header($body_classes = array()) + { + } + /** + * Returns the JavaScript template used to display the auto-update setting for a theme. + * + * @since 5.5.0 + * + * @return string The template for displaying the auto-update setting link. + */ + function wp_theme_auto_update_setting_template() + { + } + /** + * Lists available core updates. + * + * @since 2.7.0 + * + * @global string $wp_local_package Locale code of the package. + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param object $update + */ + function list_core_update($update) + { + } + /** + * Display dismissed updates. + * + * @since 2.7.0 + */ + function dismissed_updates() + { + } + /** + * Display upgrade WordPress for downloading latest or upgrading automatically form. + * + * @since 2.7.0 + */ + function core_upgrade_preamble() + { + } + /** + * Display WordPress auto-updates settings. + * + * @since 5.6.0 + */ + function core_auto_updates_settings() + { + } + /** + * Display the upgrade plugins form. + * + * @since 2.9.0 + * @phpstan-return void + */ + function list_plugin_updates() + { + } + /** + * Display the upgrade themes form. + * + * @since 2.9.0 + * @phpstan-return void + */ + function list_theme_updates() + { + } + /** + * Display the update translations form. + * + * @since 3.7.0 + * @phpstan-return void + */ + function list_translation_updates() + { + } + /** + * Upgrades WordPress core display. + * + * @since 2.7.0 + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @param bool $reinstall + * @phpstan-return void + */ + function do_core_upgrade($reinstall = \false) + { + } + /** + * Dismiss a core update. + * + * @since 2.7.0 + * @phpstan-return void + */ + function do_dismiss_core_update() + { + } + /** + * Undismiss a core update. + * + * @since 2.7.0 + * @phpstan-return void + */ + function do_undismiss_core_update() + { + } + /** + * Retrieves the cron lock. + * + * Returns the uncached `doing_cron` transient. + * + * @ignore + * @since 3.3.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return string|int|false Value of the `doing_cron` transient, 0|false otherwise. + */ + function _get_cron_lock() + { + } + /** + * Toolbar API: Top-level Toolbar functionality + * + * @package WordPress + * @subpackage Toolbar + * @since 3.1.0 + */ + /** + * Instantiates the admin bar object and set it up as a global for access elsewhere. + * + * UNHOOKING THIS FUNCTION WILL NOT PROPERLY REMOVE THE ADMIN BAR. + * For that, use show_admin_bar(false) or the {@see 'show_admin_bar'} filter. + * + * @since 3.1.0 + * @access private + * + * @global WP_Admin_Bar $wp_admin_bar + * + * @return bool Whether the admin bar was successfully initialized. + */ + function _wp_admin_bar_init() + { + } + /** + * Renders the admin bar to the page based on the $wp_admin_bar->menu member var. + * + * This is called very early on the {@see 'wp_body_open'} action so that it will render + * before anything else being added to the page body. + * + * For backward compatibility with themes not using the 'wp_body_open' action, + * the function is also called late on {@see 'wp_footer'}. + * + * It includes the {@see 'admin_bar_menu'} action which should be used to hook in and + * add new menus to the admin bar. That way you can be sure that you are adding at most + * optimal point, right before the admin bar is rendered. This also gives you access to + * the `$post` global, among others. + * + * @since 3.1.0 + * @since 5.4.0 Called on 'wp_body_open' action first, with 'wp_footer' as a fallback. + * + * @global WP_Admin_Bar $wp_admin_bar + * @phpstan-return void + */ + function wp_admin_bar_render() + { + } + /** + * Adds the WordPress logo menu. + * + * @since 3.3.0 + * + * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. + */ + function wp_admin_bar_wp_menu($wp_admin_bar) + { + } + /** + * Adds the sidebar toggle button. + * + * @since 3.8.0 + * + * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. + */ + function wp_admin_bar_sidebar_toggle($wp_admin_bar) + { + } + /** + * Adds the "My Account" item. + * + * @since 3.3.0 + * + * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. + * @phpstan-return void + */ + function wp_admin_bar_my_account_item($wp_admin_bar) + { + } + /** + * Adds the "My Account" submenu items. + * + * @since 3.1.0 + * + * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. + * @phpstan-return void + */ + function wp_admin_bar_my_account_menu($wp_admin_bar) + { + } + /** + * Adds the "Site Name" menu. + * + * @since 3.3.0 + * + * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. + * @phpstan-return void + */ + function wp_admin_bar_site_menu($wp_admin_bar) + { + } + /** + * Adds the "Edit site" link to the Toolbar. + * + * @since 5.9.0 + * @since 6.3.0 Added `$_wp_current_template_id` global for editing of current template directly from the admin bar. + * @since 6.6.0 Added the `canvas` query arg to the Site Editor link. + * + * @global string $_wp_current_template_id + * + * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. + * @phpstan-return void + */ + function wp_admin_bar_edit_site_menu($wp_admin_bar) + { + } + /** + * Adds the "Customize" link to the Toolbar. + * + * @since 4.3.0 + * + * @global WP_Customize_Manager $wp_customize + * + * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. + * @phpstan-return void + */ + function wp_admin_bar_customize_menu($wp_admin_bar) + { + } + /** + * Adds the "My Sites/[Site Name]" menu and all submenus. + * + * @since 3.1.0 + * + * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. + * @phpstan-return void + */ + function wp_admin_bar_my_sites_menu($wp_admin_bar) + { + } + /** + * Provides a shortlink. + * + * @since 3.1.0 + * + * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. + * @phpstan-return void + */ + function wp_admin_bar_shortlink_menu($wp_admin_bar) + { + } + /** + * Provides an edit link for posts and terms. + * + * @since 3.1.0 + * @since 5.5.0 Added a "View Post" link on Comments screen for a single post. + * + * @global WP_Term $tag + * @global WP_Query $wp_the_query WordPress Query object. + * @global int $user_id The ID of the user being edited. Not to be confused with the + * global $user_ID, which contains the ID of the current user. + * @global int $post_id The ID of the post when editing comments for a single post. + * + * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. + * @phpstan-return void + */ + function wp_admin_bar_edit_menu($wp_admin_bar) + { + } + /** + * Adds "Add New" menu. + * + * @since 3.1.0 + * @since 6.5.0 Added a New Site link for network installations. + * + * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. + * @phpstan-return void + */ + function wp_admin_bar_new_content_menu($wp_admin_bar) + { + } + /** + * Adds edit comments link with awaiting moderation count bubble. + * + * @since 3.1.0 + * + * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. + * @phpstan-return void + */ + function wp_admin_bar_comments_menu($wp_admin_bar) + { + } + /** + * Adds appearance submenu items to the "Site Name" menu. + * + * @since 3.1.0 + * + * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. + * @phpstan-return void + */ + function wp_admin_bar_appearance_menu($wp_admin_bar) + { + } + /** + * Provides an update link if theme/plugin/core updates are available. + * + * @since 3.1.0 + * + * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. + * @phpstan-return void + */ + function wp_admin_bar_updates_menu($wp_admin_bar) + { + } + /** + * Adds search form. + * + * @since 3.3.0 + * + * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. + * @phpstan-return void + */ + function wp_admin_bar_search_menu($wp_admin_bar) + { + } + /** + * Adds a link to exit recovery mode when Recovery Mode is active. + * + * @since 5.2.0 + * + * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. + * @phpstan-return void + */ + function wp_admin_bar_recovery_mode_menu($wp_admin_bar) + { + } + /** + * Adds secondary menus. + * + * @since 3.3.0 + * + * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. + */ + function wp_admin_bar_add_secondary_groups($wp_admin_bar) + { + } + /** + * Enqueues inline style to hide the admin bar when printing. + * + * @since 6.4.0 + * @phpstan-return void + */ + function wp_enqueue_admin_bar_header_styles() + { + } + /** + * Enqueues inline bump styles to make room for the admin bar. + * + * @since 6.4.0 + * @phpstan-return void + */ + function wp_enqueue_admin_bar_bump_styles() + { + } + /** + * Sets the display status of the admin bar. + * + * This can be called immediately upon plugin load. It does not need to be called + * from a function hooked to the {@see 'init'} action. + * + * @since 3.1.0 + * + * @global bool $show_admin_bar + * + * @param bool $show Whether to allow the admin bar to show. + */ + function show_admin_bar($show) + { + } + /** + * Determines whether the admin bar should be showing. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 3.1.0 + * + * @global bool $show_admin_bar + * @global string $pagenow The filename of the current screen. + * + * @return bool Whether the admin bar should be showing. + */ + function is_admin_bar_showing() + { + } + /** + * Retrieves the admin bar display preference of a user. + * + * @since 3.1.0 + * @access private + * + * @param string $context Context of this preference check. Defaults to 'front'. The 'admin' + * preference is no longer used. + * @param int $user Optional. ID of the user to check, defaults to 0 for current user. + * @return bool Whether the admin bar should be showing for this user. + */ + function _get_admin_bar_pref($context = 'front', $user = 0) + { + } + /** + * Author Template functions for use in themes. + * + * These functions must be used within the WordPress Loop. + * + * @link https://codex.wordpress.org/Author_Templates + * + * @package WordPress + * @subpackage Template + */ + /** + * Retrieves the author of the current post. + * + * @since 1.5.0 + * @since 6.3.0 Returns an empty string if the author's display name is unknown. + * + * @global WP_User $authordata The current author's data. + * + * @param string $deprecated Deprecated. + * @return string The author's display name, empty string if unknown. + */ + function get_the_author($deprecated = '') + { + } + /** + * Displays the name of the author of the current post. + * + * The behavior of this function is based off of old functionality predating + * get_the_author(). This function is not deprecated, but is designed to echo + * the value from get_the_author() and as an result of any old theme that might + * still use the old behavior will also pass the value from get_the_author(). + * + * The normal, expected behavior of this function is to echo the author and not + * return it. However, backward compatibility has to be maintained. + * + * @since 0.71 + * + * @see get_the_author() + * @link https://developer.wordpress.org/reference/functions/the_author/ + * + * @param string $deprecated Deprecated. + * @param bool $deprecated_echo Deprecated. Use get_the_author(). Echo the string or return it. + * @return string The author's display name, from get_the_author(). + */ + function the_author($deprecated = '', $deprecated_echo = \true) + { + } + /** + * Retrieves the author who last edited the current post. + * + * @since 2.8.0 + * + * @return string|void The author's display name, empty string if unknown. + */ + function get_the_modified_author() + { + } + /** + * Displays the name of the author who last edited the current post, + * if the author's ID is available. + * + * @since 2.8.0 + * + * @see get_the_author() + */ + function the_modified_author() + { + } + /** + * Retrieves the requested data of the author of the current post. + * + * Valid values for the `$field` parameter include: + * + * - admin_color + * - aim + * - comment_shortcuts + * - description + * - display_name + * - first_name + * - ID + * - jabber + * - last_name + * - nickname + * - plugins_last_view + * - plugins_per_page + * - rich_editing + * - syntax_highlighting + * - user_activation_key + * - user_description + * - user_email + * - user_firstname + * - user_lastname + * - user_level + * - user_login + * - user_nicename + * - user_pass + * - user_registered + * - user_status + * - user_url + * - yim + * + * @since 2.8.0 + * + * @global WP_User $authordata The current author's data. + * + * @param string $field Optional. The user field to retrieve. Default empty. + * @param int|false $user_id Optional. User ID. Defaults to the current post author. + * @return string The author's field from the current author's DB object, otherwise an empty string. + */ + function get_the_author_meta($field = '', $user_id = \false) + { + } + /** + * Outputs the field from the user's DB object. Defaults to current post's author. + * + * @since 2.8.0 + * + * @param string $field Selects the field of the users record. See get_the_author_meta() + * for the list of possible fields. + * @param int|false $user_id Optional. User ID. Defaults to the current post author. + * + * @see get_the_author_meta() + */ + function the_author_meta($field = '', $user_id = \false) + { + } + /** + * Retrieves either author's link or author's name. + * + * If the author has a home page set, return an HTML link, otherwise just return + * the author's name. + * + * @since 3.0.0 + * + * @global WP_User $authordata The current author's data. + * + * @return string An HTML link if the author's URL exists in user meta, + * otherwise the result of get_the_author(). + */ + function get_the_author_link() + { + } + /** + * Displays either author's link or author's name. + * + * If the author has a home page set, echo an HTML link, otherwise just echo the + * author's name. + * + * @link https://developer.wordpress.org/reference/functions/the_author_link/ + * + * @since 2.1.0 + */ + function the_author_link() + { + } + /** + * Retrieves the number of posts by the author of the current post. + * + * @since 1.5.0 + * + * @return int The number of posts by the author. + */ + function get_the_author_posts() + { + } + /** + * Displays the number of posts by the author of the current post. + * + * @link https://developer.wordpress.org/reference/functions/the_author_posts/ + * @since 0.71 + */ + function the_author_posts() + { + } + /** + * Retrieves an HTML link to the author page of the current post's author. + * + * Returns an HTML-formatted link using get_author_posts_url(). + * + * @since 4.4.0 + * + * @global WP_User $authordata The current author's data. + * + * @return string An HTML link to the author page, or an empty string if $authordata is not set. + */ + function get_the_author_posts_link() + { + } + /** + * Displays an HTML link to the author page of the current post's author. + * + * @since 1.2.0 + * @since 4.4.0 Converted into a wrapper for get_the_author_posts_link() + * + * @param string $deprecated Unused. + */ + function the_author_posts_link($deprecated = '') + { + } + /** + * Retrieves the URL to the author page for the user with the ID provided. + * + * @since 2.1.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param int $author_id Author ID. + * @param string $author_nicename Optional. The author's nicename (slug). Default empty. + * @return string The URL to the author's page. + */ + function get_author_posts_url($author_id, $author_nicename = '') + { + } + /** + * Lists all the authors of the site, with several options available. + * + * @link https://developer.wordpress.org/reference/functions/wp_list_authors/ + * + * @since 1.2.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string|array $args { + * Optional. Array or string of default arguments. + * + * @type string $orderby How to sort the authors. Accepts 'nicename', 'email', 'url', 'registered', + * 'user_nicename', 'user_email', 'user_url', 'user_registered', 'name', + * 'display_name', 'post_count', 'ID', 'meta_value', 'user_login'. Default 'name'. + * @type string $order Sorting direction for $orderby. Accepts 'ASC', 'DESC'. Default 'ASC'. + * @type int $number Maximum authors to return or display. Default empty (all authors). + * @type bool $optioncount Show the count in parenthesis next to the author's name. Default false. + * @type bool $exclude_admin Whether to exclude the 'admin' account, if it exists. Default true. + * @type bool $show_fullname Whether to show the author's full name. Default false. + * @type bool $hide_empty Whether to hide any authors with no posts. Default true. + * @type string $feed If not empty, show a link to the author's feed and use this text as the alt + * parameter of the link. Default empty. + * @type string $feed_image If not empty, show a link to the author's feed and use this image URL as + * clickable anchor. Default empty. + * @type string $feed_type The feed type to link to. Possible values include 'rss2', 'atom'. + * Default is the value of get_default_feed(). + * @type bool $echo Whether to output the result or instead return it. Default true. + * @type string $style If 'list', each author is wrapped in an `<li>` element, otherwise the authors + * will be separated by commas. + * @type bool $html Whether to list the items in HTML form or plaintext. Default true. + * @type int[]|string $exclude Array or comma/space-separated list of author IDs to exclude. Default empty. + * @type int[]|string $include Array or comma/space-separated list of author IDs to include. Default empty. + * } + * @return void|string Void if 'echo' argument is true, list of authors if 'echo' is false. + * @phpstan-param array{ + * orderby?: string, + * order?: string, + * number?: int, + * optioncount?: bool, + * exclude_admin?: bool, + * show_fullname?: bool, + * hide_empty?: bool, + * feed?: string, + * feed_image?: string, + * feed_type?: string, + * echo?: bool, + * style?: string, + * html?: bool, + * exclude?: int[]|string, + * include?: int[]|string, + * } $args + */ + function wp_list_authors($args = '') + { + } + /** + * Determines whether this site has more than one author. + * + * Checks to see if more than one author has published posts. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 3.2.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return bool Whether or not we have more than one author + */ + function is_multi_author() + { + } + /** + * Helper function to clear the cache for number of authors. + * + * @since 3.2.0 + * @access private + */ + function __clear_multi_author_cache() + { + } + /** + * Block Bindings API + * + * Contains functions for managing block bindings in WordPress. + * + * @package WordPress + * @subpackage Block Bindings + * @since 6.5.0 + */ + /** + * Registers a new block bindings source. + * + * Registering a source consists of defining a **name** for that source and a callback function specifying + * how to get a value from that source and pass it to a block attribute. + * + * Once a source is registered, any block that supports the Block Bindings API can use a value + * from that source by setting its `metadata.bindings` attribute to a value that refers to the source. + * + * Note that `register_block_bindings_source()` should be called from a handler attached to the `init` hook. + * + * + * ## Example + * + * ### Registering a source + * + * First, you need to define a function that will be used to get the value from the source. + * + * function my_plugin_get_custom_source_value( array $source_args, $block_instance, string $attribute_name ) { + * // Your custom logic to get the value from the source. + * // For example, you can use the `$source_args` to look up a value in a custom table or get it from an external API. + * $value = $source_args['key']; + * + * return "The value passed to the block is: $value" + * } + * + * The `$source_args` will contain the arguments passed to the source in the block's + * `metadata.bindings` attribute. See the example in the "Usage in a block" section below. + * + * function my_plugin_register_block_bindings_sources() { + * register_block_bindings_source( 'my-plugin/my-custom-source', array( + * 'label' => __( 'My Custom Source', 'my-plugin' ), + * 'get_value_callback' => 'my_plugin_get_custom_source_value', + * ) ); + * } + * add_action( 'init', 'my_plugin_register_block_bindings_sources' ); + * + * ### Usage in a block + * + * In a block's `metadata.bindings` attribute, you can specify the source and + * its arguments. Such a block will use the source to override the block + * attribute's value. For example: + * + * <!-- wp:paragraph { + * "metadata": { + * "bindings": { + * "content": { + * "source": "my-plugin/my-custom-source", + * "args": { + * "key": "you can pass any custom arguments here" + * } + * } + * } + * } + * } --> + * <p>Fallback text that gets replaced.</p> + * <!-- /wp:paragraph --> + * + * @since 6.5.0 + * + * @param string $source_name The name of the source. It must be a string containing a namespace prefix, i.e. + * `my-plugin/my-custom-source`. It must only contain lowercase alphanumeric + * characters, the forward slash `/` and dashes. + * @param array $source_properties { + * The array of arguments that are used to register a source. + * + * @type string $label The label of the source. + * @type callable $get_value_callback A callback executed when the source is processed during block rendering. + * The callback should have the following signature: + * + * `function( $source_args, $block_instance, $attribute_name ): mixed` + * - @param array $source_args Array containing source arguments + * used to look up the override value, + * i.e. {"key": "foo"}. + * - @param WP_Block $block_instance The block instance. + * - @param string $attribute_name The name of an attribute. + * The callback has a mixed return type; it may return a string to override + * the block's original value, null, false to remove an attribute, etc. + * @type string[] $uses_context Optional. Array of values to add to block `uses_context` needed by the source. + * } + * @return WP_Block_Bindings_Source|false Source when the registration was successful, or `false` on failure. + * @phpstan-param array{ + * label?: string, + * get_value_callback?: callable, + * uses_context?: string[], + * } $source_properties + */ + function register_block_bindings_source(string $source_name, array $source_properties) + { + } + /** + * Unregisters a block bindings source. + * + * @since 6.5.0 + * + * @param string $source_name Block bindings source name including namespace. + * @return WP_Block_Bindings_Source|false The unregistered block bindings source on success and `false` otherwise. + */ + function unregister_block_bindings_source(string $source_name) + { + } + /** + * Retrieves the list of all registered block bindings sources. + * + * @since 6.5.0 + * + * @return WP_Block_Bindings_Source[] The array of registered block bindings sources. + */ + function get_all_registered_block_bindings_sources() + { + } + /** + * Retrieves a registered block bindings source. + * + * @since 6.5.0 + * + * @param string $source_name The name of the source. + * @return WP_Block_Bindings_Source|null The registered block bindings source, or `null` if it is not registered. + */ + function get_block_bindings_source(string $source_name) + { + } + /** + * Pattern Overrides source for the Block Bindings. + * + * @since 6.5.0 + * @package WordPress + * @subpackage Block Bindings + */ + /** + * Gets value for the Pattern Overrides source. + * + * @since 6.5.0 + * @access private + * + * @param array $source_args Array containing source arguments used to look up the override value. + * Example: array( "key" => "foo" ). + * @param WP_Block $block_instance The block instance. + * @param string $attribute_name The name of the target attribute. + * @return mixed The value computed for the source. + */ + function _block_bindings_pattern_overrides_get_value(array $source_args, $block_instance, string $attribute_name) + { + } + /** + * Registers Pattern Overrides source in the Block Bindings registry. + * + * @since 6.5.0 + * @access private + */ + function _register_block_bindings_pattern_overrides_source() + { + } + /** + * Post Meta source for the block bindings. + * + * @since 6.5.0 + * @package WordPress + * @subpackage Block Bindings + */ + /** + * Gets value for Post Meta source. + * + * @since 6.5.0 + * @access private + * + * @param array $source_args Array containing source arguments used to look up the override value. + * Example: array( "key" => "foo" ). + * @param WP_Block $block_instance The block instance. + * @return mixed The value computed for the source. + */ + function _block_bindings_post_meta_get_value(array $source_args, $block_instance) + { + } + /** + * Registers Post Meta source in the block bindings registry. + * + * @since 6.5.0 + * @access private + */ + function _register_block_bindings_post_meta_source() + { + } + /** + * Block Editor API. + * + * @package WordPress + * @subpackage Editor + * @since 5.8.0 + */ + /** + * Returns the list of default categories for block types. + * + * @since 5.8.0 + * @since 6.3.0 Reusable Blocks renamed to Patterns. + * + * @return array[] Array of categories for block types. + */ + function get_default_block_categories() + { + } + /** + * Returns all the categories for block types that will be shown in the block editor. + * + * @since 5.0.0 + * @since 5.8.0 It is possible to pass the block editor context as param. + * + * @param WP_Post|WP_Block_Editor_Context $post_or_block_editor_context The current post object or + * the block editor context. + * + * @return array[] Array of categories for block types. + */ + function get_block_categories($post_or_block_editor_context) + { + } + /** + * Gets the list of allowed block types to use in the block editor. + * + * @since 5.8.0 + * + * @param WP_Block_Editor_Context $block_editor_context The current block editor context. + * + * @return bool|string[] Array of block type slugs, or boolean to enable/disable all. + */ + function get_allowed_block_types($block_editor_context) + { + } + /** + * Returns the default block editor settings. + * + * @since 5.8.0 + * + * @return array The default block editor settings. + */ + function get_default_block_editor_settings() + { + } + /** + * Returns the block editor settings needed to use the Legacy Widget block which + * is not registered by default. + * + * @since 5.8.0 + * + * @return array Settings to be used with get_block_editor_settings(). + */ + function get_legacy_widget_block_editor_settings() + { + } + /** + * Collect the block editor assets that need to be loaded into the editor's iframe. + * + * @since 6.0.0 + * @access private + * + * @global WP_Styles $wp_styles The WP_Styles current instance. + * @global WP_Scripts $wp_scripts The WP_Scripts current instance. + * + * @return array { + * The block editor assets. + * + * @type string|false $styles String containing the HTML for styles. + * @type string|false $scripts String containing the HTML for scripts. + * } + * @phpstan-return array{ + * styles: string|false, + * scripts: string|false, + * } + */ + function _wp_get_iframed_editor_assets() + { + } + /** + * Finds the first occurrence of a specific block in an array of blocks. + * + * @since 6.3.0 + * + * @param array $blocks Array of blocks. + * @param string $block_name Name of the block to find. + * @return array Found block, or empty array if none found. + */ + function wp_get_first_block($blocks, $block_name) + { + } + /** + * Retrieves Post Content block attributes from the current post template. + * + * @since 6.3.0 + * @since 6.4.0 Return null if there is no post content block. + * @access private + * + * @global int $post_ID + * + * @return array|null Post Content block attributes array or null if Post Content block doesn't exist. + */ + function wp_get_post_content_block_attributes() + { + } + /** + * Returns the contextualized block editor settings for a selected editor context. + * + * @since 5.8.0 + * + * @param array $custom_settings Custom settings to use with the given editor type. + * @param WP_Block_Editor_Context $block_editor_context The current block editor context. + * + * @return array The contextualized block editor settings. + */ + function get_block_editor_settings(array $custom_settings, $block_editor_context) + { + } + /** + * Preloads common data used with the block editor by specifying an array of + * REST API paths that will be preloaded for a given block editor context. + * + * @since 5.8.0 + * + * @global WP_Post $post Global post object. + * @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts. + * @global WP_Styles $wp_styles The WP_Styles object for printing styles. + * + * @param (string|string[])[] $preload_paths List of paths to preload. + * @param WP_Block_Editor_Context $block_editor_context The current block editor context. + * @phpstan-return void + */ + function block_editor_rest_api_preload(array $preload_paths, $block_editor_context) + { + } + /** + * Creates an array of theme styles to load into the block editor. + * + * @since 5.8.0 + * + * @global array $editor_styles + * + * @return array An array of theme styles for the block editor. + */ + function get_block_editor_theme_styles() + { + } + /** + * Returns the classic theme supports settings for block editor. + * + * @since 6.2.0 + * @since 6.6.0 Add support for 'editor-spacing-sizes' theme support. + * + * @return array The classic theme supports settings. + */ + function get_classic_theme_supports_block_editor_settings() + { + } + /** + * Registers the core block patterns and categories. + * + * @since 5.5.0 + * @since 6.3.0 Added source to core block patterns. + * @access private + */ + function _register_core_block_patterns_and_categories() + { + } + /** + * Normalize the pattern properties to camelCase. + * + * The API's format is snake_case, `register_block_pattern()` expects camelCase. + * + * @since 6.2.0 + * @access private + * + * @param array $pattern Pattern as returned from the Pattern Directory API. + * @return array Normalized pattern. + */ + function wp_normalize_remote_block_pattern($pattern) + { + } + /** + * Register Core's official patterns from wordpress.org/patterns. + * + * @since 5.8.0 + * @since 5.9.0 The $current_screen argument was removed. + * @since 6.2.0 Normalize the pattern from the API (snake_case) to the + * format expected by `register_block_pattern` (camelCase). + * @since 6.3.0 Add 'pattern-directory/core' to the pattern's 'source'. + * + * @param WP_Screen $deprecated Unused. Formerly the screen that the current request was triggered from. + * @phpstan-return void + */ + function _load_remote_block_patterns($deprecated = \null) + { + } + /** + * Register `Featured` (category) patterns from wordpress.org/patterns. + * + * @since 5.9.0 + * @since 6.2.0 Normalized the pattern from the API (snake_case) to the + * format expected by `register_block_pattern()` (camelCase). + * @since 6.3.0 Add 'pattern-directory/featured' to the pattern's 'source'. + * @phpstan-return void + */ + function _load_remote_featured_patterns() + { + } + /** + * Registers patterns from Pattern Directory provided by a theme's + * `theme.json` file. + * + * @since 6.0.0 + * @since 6.2.0 Normalized the pattern from the API (snake_case) to the + * format expected by `register_block_pattern()` (camelCase). + * @since 6.3.0 Add 'pattern-directory/theme' to the pattern's 'source'. + * @access private + * @phpstan-return void + */ + function _register_remote_theme_patterns() + { + } + /** + * Register any patterns that the active theme may provide under its + * `./patterns/` directory. + * + * @since 6.0.0 + * @since 6.1.0 The `postTypes` property was added. + * @since 6.2.0 The `templateTypes` property was added. + * @since 6.4.0 Uses the `WP_Theme::get_block_patterns` method. + * @access private + * @phpstan-return void + */ + function _register_theme_block_patterns() + { + } + /** + * Align block support flag. + * + * @package WordPress + * @since 5.6.0 + */ + /** + * Registers the align block attribute for block types that support it. + * + * @since 5.6.0 + * @access private + * + * @param WP_Block_Type $block_type Block Type. + */ + function wp_register_alignment_support($block_type) + { + } + /** + * Adds CSS classes for block alignment to the incoming attributes array. + * This will be applied to the block markup in the front-end. + * + * @since 5.6.0 + * @access private + * + * @param WP_Block_Type $block_type Block Type. + * @param array $block_attributes Block attributes. + * @return array Block alignment CSS classes and inline styles. + */ + function wp_apply_alignment_support($block_type, $block_attributes) + { + } + /** + * Background block support flag. + * + * @package WordPress + * @since 6.4.0 + */ + /** + * Registers the style block attribute for block types that support it. + * + * @since 6.4.0 + * @access private + * + * @param WP_Block_Type $block_type Block Type. + * @phpstan-return void + */ + function wp_register_background_support($block_type) + { + } + /** + * Renders the background styles to the block wrapper. + * This block support uses the `render_block` hook to ensure that + * it is also applied to non-server-rendered blocks. + * + * @since 6.4.0 + * @since 6.5.0 Added support for `backgroundPosition` and `backgroundRepeat` output. + * @since 6.6.0 Removed requirement for `backgroundImage.source`. A file/url is the default. + * + * @access private + * + * @param string $block_content Rendered block content. + * @param array $block Block object. + * @return string Filtered block content. + */ + function wp_render_background_support($block_content, $block) + { + } + /** + * Block support to enable per-section styling of block types via + * block style variations. + * + * @package WordPress + * @since 6.6.0 + */ + /** + * Generate block style variation instance name. + * + * @since 6.6.0 + * @access private + * + * @param array $block Block object. + * @param string $variation Slug for the block style variation. + * + * @return string The unique variation name. + */ + function wp_create_block_style_variation_instance_name($block, $variation) + { + } + /** + * Determines the block style variation names within a CSS class string. + * + * @since 6.6.0 + * + * @param string $class_string CSS class string to look for a variation in. + * + * @return array|null The block style variation name if found. + */ + function wp_get_block_style_variation_name_from_class($class_string) + { + } + /** + * Recursively resolves any `ref` values within a block style variation's data. + * + * @since 6.6.0 + * @access private + * + * @param array $variation_data Reference to the variation data being processed. + * @param array $theme_json Theme.json data to retrieve referenced values from. + */ + function wp_resolve_block_style_variation_ref_values(&$variation_data, $theme_json) + { + } + /** + * Render the block style variation's styles. + * + * In the case of nested blocks with variations applied, we want the parent + * variation's styles to be rendered before their descendants. This solves the + * issue of a block type being styled in both the parent and descendant: we want + * the descendant style to take priority, and this is done by loading it after, + * in the DOM order. This is why the variation stylesheet generation is in a + * different filter. + * + * @since 6.6.0 + * @access private + * + * @param array $parsed_block The parsed block. + * + * @return array The parsed block with block style variation classname added. + */ + function wp_render_block_style_variation_support_styles($parsed_block) + { + } + /** + * Ensure the variation block support class name generated and added to + * block attributes in the `render_block_data` filter gets applied to the + * block's markup. + * + * @see wp_render_block_style_variation_support_styles + * + * @since 6.6.0 + * @access private + * + * @param string $block_content Rendered block content. + * @param array $block Block object. + * + * @return string Filtered block content. + */ + function wp_render_block_style_variation_class_name($block_content, $block) + { + } + /** + * Enqueues styles for block style variations. + * + * @since 6.6.0 + * @access private + */ + function wp_enqueue_block_style_variation_styles() + { + } + /** + * Registers block style variations read in from theme.json partials. + * + * @since 6.6.0 + * @access private + * + * @param array $variations Shared block style variations. + * @phpstan-return void + */ + function wp_register_block_style_variations_from_theme_json_partials($variations) + { + } + /** + * Border block support flag. + * + * @package WordPress + * @since 5.8.0 + */ + /** + * Registers the style attribute used by the border feature if needed for block + * types that support borders. + * + * @since 5.8.0 + * @since 6.1.0 Improved conditional blocks optimization. + * @access private + * + * @param WP_Block_Type $block_type Block Type. + */ + function wp_register_border_support($block_type) + { + } + /** + * Adds CSS classes and inline styles for border styles to the incoming + * attributes array. This will be applied to the block markup in the front-end. + * + * @since 5.8.0 + * @since 6.1.0 Implemented the style engine to generate CSS and classnames. + * @access private + * + * @param WP_Block_Type $block_type Block type. + * @param array $block_attributes Block attributes. + * @return array Border CSS classes and inline styles. + */ + function wp_apply_border_support($block_type, $block_attributes) + { + } + /** + * Checks whether the current block type supports the border feature requested. + * + * If the `__experimentalBorder` support flag is a boolean `true` all border + * support features are available. Otherwise, the specific feature's support + * flag nested under `experimentalBorder` must be enabled for the feature + * to be opted into. + * + * @since 5.8.0 + * @access private + * + * @param WP_Block_Type $block_type Block type to check for support. + * @param string $feature Name of the feature to check support for. + * @param mixed $default_value Fallback value for feature support, defaults to false. + * @return bool Whether the feature is supported. + */ + function wp_has_border_feature_support($block_type, $feature, $default_value = \false) + { + } + /** + * Colors block support flag. + * + * @package WordPress + * @since 5.6.0 + */ + /** + * Registers the style and colors block attributes for block types that support it. + * + * @since 5.6.0 + * @since 6.1.0 Improved $color_support assignment optimization. + * @access private + * + * @param WP_Block_Type $block_type Block Type. + */ + function wp_register_colors_support($block_type) + { + } + /** + * Adds CSS classes and inline styles for colors to the incoming attributes array. + * This will be applied to the block markup in the front-end. + * + * @since 5.6.0 + * @since 6.1.0 Implemented the style engine to generate CSS and classnames. + * @access private + * + * @param WP_Block_Type $block_type Block type. + * @param array $block_attributes Block attributes. + * + * @return array Colors CSS classes and inline styles. + */ + function wp_apply_colors_support($block_type, $block_attributes) + { + } + /** + * Custom classname block support flag. + * + * @package WordPress + * @since 5.6.0 + */ + /** + * Registers the custom classname block attribute for block types that support it. + * + * @since 5.6.0 + * @access private + * + * @param WP_Block_Type $block_type Block Type. + */ + function wp_register_custom_classname_support($block_type) + { + } + /** + * Adds the custom classnames to the output. + * + * @since 5.6.0 + * @access private + * + * @param WP_Block_Type $block_type Block Type. + * @param array $block_attributes Block attributes. + * + * @return array Block CSS classes and inline styles. + */ + function wp_apply_custom_classname_support($block_type, $block_attributes) + { + } + /** + * Dimensions block support flag. + * + * This does not include the `spacing` block support even though that visually + * appears under the "Dimensions" panel in the editor. It remains in its + * original `spacing.php` file for compatibility with core. + * + * @package WordPress + * @since 5.9.0 + */ + /** + * Registers the style block attribute for block types that support it. + * + * @since 5.9.0 + * @access private + * + * @param WP_Block_Type $block_type Block Type. + * @phpstan-return void + */ + function wp_register_dimensions_support($block_type) + { + } + /** + * Adds CSS classes for block dimensions to the incoming attributes array. + * This will be applied to the block markup in the front-end. + * + * @since 5.9.0 + * @since 6.2.0 Added `minHeight` support. + * @access private + * + * @param WP_Block_Type $block_type Block Type. + * @param array $block_attributes Block attributes. + * @return array Block dimensions CSS classes and inline styles. + */ + function wp_apply_dimensions_support($block_type, $block_attributes) + { + } + /** + * Renders server-side dimensions styles to the block wrapper. + * This block support uses the `render_block` hook to ensure that + * it is also applied to non-server-rendered blocks. + * + * @since 6.5.0 + * @access private + * + * @param string $block_content Rendered block content. + * @param array $block Block object. + * @return string Filtered block content. + */ + function wp_render_dimensions_support($block_content, $block) + { + } + /** + * Elements styles block support. + * + * @package WordPress + * @since 5.8.0 + */ + /** + * Gets the elements class names. + * + * @since 6.0.0 + * @access private + * + * @param array $block Block object. + * @return string The unique class name. + */ + function wp_get_elements_class_name($block) + { + } + /** + * Determines whether an elements class name should be added to the block. + * + * @since 6.6.0 + * @access private + * + * @param array $block Block object. + * @param array $options Per element type options e.g. whether to skip serialization. + * @return boolean Whether the block needs an elements class name. + */ + function wp_should_add_elements_class_name($block, $options) + { + } + /** + * Render the elements stylesheet and adds elements class name to block as required. + * + * In the case of nested blocks we want the parent element styles to be rendered before their descendants. + * This solves the issue of an element (e.g.: link color) being styled in both the parent and a descendant: + * we want the descendant style to take priority, and this is done by loading it after, in DOM order. + * + * @since 6.0.0 + * @since 6.1.0 Implemented the style engine to generate CSS and classnames. + * @since 6.6.0 Element block support class and styles are generated via the `render_block_data` filter instead of `pre_render_block`. + * @access private + * + * @param array $parsed_block The parsed block. + * @return array The same parsed block with elements classname added if appropriate. + */ + function wp_render_elements_support_styles($parsed_block) + { + } + /** + * Ensure the elements block support class name generated, and added to + * block attributes, in the `render_block_data` filter gets applied to the + * block's markup. + * + * @see wp_render_elements_support_styles + * @since 6.6.0 + * + * @param string $block_content Rendered block content. + * @param array $block Block object. + * @return string Filtered block content. + */ + function wp_render_elements_class_name($block_content, $block) + { + } + /** + * Generated classname block support flag. + * + * @package WordPress + * @since 5.6.0 + */ + /** + * Gets the generated classname from a given block name. + * + * @since 5.6.0 + * + * @access private + * + * @param string $block_name Block Name. + * @return string Generated classname. + */ + function wp_get_block_default_classname($block_name) + { + } + /** + * Adds the generated classnames to the output. + * + * @since 5.6.0 + * + * @access private + * + * @param WP_Block_Type $block_type Block Type. + * @return array Block CSS classes and inline styles. + */ + function wp_apply_generated_classname_support($block_type) + { + } + /** + * Layout block support flag. + * + * @package WordPress + * @since 5.8.0 + */ + /** + * Returns layout definitions, keyed by layout type. + * + * Provides a common definition of slugs, classnames, base styles, and spacing styles for each layout type. + * When making changes or additions to layout definitions, the corresponding JavaScript definitions should + * also be updated. + * + * @since 6.3.0 + * @since 6.6.0 Updated specificity for compatibility with 0-1-0 global styles specificity. + * @access private + * + * @return array[] Layout definitions. + */ + function wp_get_layout_definitions() + { + } + /** + * Registers the layout block attribute for block types that support it. + * + * @since 5.8.0 + * @since 6.3.0 Check for layout support via the `layout` key with fallback to `__experimentalLayout`. + * @access private + * + * @param WP_Block_Type $block_type Block Type. + */ + function wp_register_layout_support($block_type) + { + } + /** + * Generates the CSS corresponding to the provided layout. + * + * @since 5.9.0 + * @since 6.1.0 Added `$block_spacing` param, use style engine to enqueue styles. + * @since 6.3.0 Added grid layout type. + * @since 6.6.0 Removed duplicated selector from layout styles. + * Enabled negative margins for alignfull children of blocks with custom padding. + * @access private + * + * @param string $selector CSS selector. + * @param array $layout Layout object. The one that is passed has already checked + * the existence of default block layout. + * @param bool $has_block_gap_support Optional. Whether the theme has support for the block gap. Default false. + * @param string|string[]|null $gap_value Optional. The block gap value to apply. Default null. + * @param bool $should_skip_gap_serialization Optional. Whether to skip applying the user-defined value set in the editor. Default false. + * @param string $fallback_gap_value Optional. The block gap value to apply. Default '0.5em'. + * @param array|null $block_spacing Optional. Custom spacing set on the block. Default null. + * @return string CSS styles on success. Else, empty string. + */ + function wp_get_layout_style($selector, $layout, $has_block_gap_support = \false, $gap_value = \null, $should_skip_gap_serialization = \false, $fallback_gap_value = '0.5em', $block_spacing = \null) + { + } + /** + * Renders the layout config to the block wrapper. + * + * @since 5.8.0 + * @since 6.3.0 Adds compound class to layout wrapper for global spacing styles. + * @since 6.3.0 Check for layout support via the `layout` key with fallback to `__experimentalLayout`. + * @since 6.6.0 Removed duplicate container class from layout styles. + * @access private + * + * @param string $block_content Rendered block content. + * @param array $block Block object. + * @return string Filtered block content. + */ + function wp_render_layout_support_flag($block_content, $block) + { + } + /** + * Check if the parent block exists and if it has a layout attribute. + * If it does, add the parent layout to the parsed block + * + * @since 6.6.0 + * @access private + * + * @param array $parsed_block The parsed block. + * @param array $source_block The source block. + * @param WP_Block $parent_block The parent block. + * @return array The parsed block with parent layout attribute if it exists. + */ + function wp_add_parent_layout_to_parsed_block($parsed_block, $source_block, $parent_block) + { + } + /** + * For themes without theme.json file, make sure + * to restore the inner div for the group block + * to avoid breaking styles relying on that div. + * + * @since 5.8.0 + * @access private + * + * @param string $block_content Rendered block content. + * @param array $block Block object. + * @return string Filtered block content. + */ + function wp_restore_group_inner_container($block_content, $block) + { + } + /** + * For themes without theme.json file, make sure + * to restore the outer div for the aligned image block + * to avoid breaking styles relying on that div. + * + * @since 6.0.0 + * @access private + * + * @param string $block_content Rendered block content. + * @param array $block Block object. + * @return string Filtered block content. + */ + function wp_restore_image_outer_container($block_content, $block) + { + } + /** + * Position block support flag. + * + * @package WordPress + * @since 6.2.0 + */ + /** + * Registers the style block attribute for block types that support it. + * + * @since 6.2.0 + * @access private + * + * @param WP_Block_Type $block_type Block Type. + */ + function wp_register_position_support($block_type) + { + } + /** + * Renders position styles to the block wrapper. + * + * @since 6.2.0 + * @access private + * + * @param string $block_content Rendered block content. + * @param array $block Block object. + * @return string Filtered block content. + */ + function wp_render_position_support($block_content, $block) + { + } + /** + * Block level presets support. + * + * @package WordPress + * @since 6.2.0 + */ + /** + * Get the class name used on block level presets. + * + * @internal + * + * @since 6.2.0 + * @access private + * + * @param array $block Block object. + * @return string The unique class name. + */ + function _wp_get_presets_class_name($block) + { + } + /** + * Update the block content with block level presets class name. + * + * @internal + * + * @since 6.2.0 + * @access private + * + * @param string $block_content Rendered block content. + * @param array $block Block object. + * @return string Filtered block content. + */ + function _wp_add_block_level_presets_class($block_content, $block) + { + } + /** + * Render the block level presets stylesheet. + * + * @internal + * + * @since 6.2.0 + * @since 6.3.0 Updated preset styles to use Selectors API. + * @access private + * + * @param string|null $pre_render The pre-rendered content. Default null. + * @param array $block The block being rendered. + * + * @return null + */ + function _wp_add_block_level_preset_styles($pre_render, $block) + { + } + /** + * Shadow block support flag. + * + * @package WordPress + * @since 6.3.0 + */ + /** + * Registers the style and shadow block attributes for block types that support it. + * + * @since 6.3.0 + * @access private + * + * @param WP_Block_Type $block_type Block Type. + * @phpstan-return void + */ + function wp_register_shadow_support($block_type) + { + } + /** + * Add CSS classes and inline styles for shadow features to the incoming attributes array. + * This will be applied to the block markup in the front-end. + * + * @since 6.3.0 + * @since 6.6.0 Return early if __experimentalSkipSerialization is true. + * @access private + * + * @param WP_Block_Type $block_type Block type. + * @param array $block_attributes Block attributes. + * @return array Shadow CSS classes and inline styles. + */ + function wp_apply_shadow_support($block_type, $block_attributes) + { + } + /** + * Spacing block support flag. + * + * For backwards compatibility, this remains separate to the dimensions.php + * block support despite both belonging under a single panel in the editor. + * + * @package WordPress + * @since 5.8.0 + */ + /** + * Registers the style block attribute for block types that support it. + * + * @since 5.8.0 + * @access private + * + * @param WP_Block_Type $block_type Block Type. + */ + function wp_register_spacing_support($block_type) + { + } + /** + * Adds CSS classes for block spacing to the incoming attributes array. + * This will be applied to the block markup in the front-end. + * + * @since 5.8.0 + * @since 6.1.0 Implemented the style engine to generate CSS and classnames. + * @access private + * + * @param WP_Block_Type $block_type Block Type. + * @param array $block_attributes Block attributes. + * @return array Block spacing CSS classes and inline styles. + */ + function wp_apply_spacing_support($block_type, $block_attributes) + { + } + /** + * Typography block support flag. + * + * @package WordPress + * @since 5.6.0 + */ + /** + * Registers the style and typography block attributes for block types that support it. + * + * @since 5.6.0 + * @since 6.3.0 Added support for text-columns. + * @access private + * + * @param WP_Block_Type $block_type Block Type. + * @phpstan-return void + */ + function wp_register_typography_support($block_type) + { + } + /** + * Adds CSS classes and inline styles for typography features such as font sizes + * to the incoming attributes array. This will be applied to the block markup in + * the front-end. + * + * @since 5.6.0 + * @since 6.1.0 Used the style engine to generate CSS and classnames. + * @since 6.3.0 Added support for text-columns. + * @access private + * + * @param WP_Block_Type $block_type Block type. + * @param array $block_attributes Block attributes. + * @return array Typography CSS classes and inline styles. + */ + function wp_apply_typography_support($block_type, $block_attributes) + { + } + /** + * Generates an inline style value for a typography feature e.g. text decoration, + * text transform, and font style. + * + * Note: This function is for backwards compatibility. + * * It is necessary to parse older blocks whose typography styles contain presets. + * * It mostly replaces the deprecated `wp_typography_get_css_variable_inline_style()`, + * but skips compiling a CSS declaration as the style engine takes over this role. + * @link https://github.com/wordpress/gutenberg/pull/27555 + * + * @since 6.1.0 + * + * @param string $style_value A raw style value for a single typography feature from a block's style attribute. + * @param string $css_property Slug for the CSS property the inline style sets. + * @return string A CSS inline style value. + */ + function wp_typography_get_preset_inline_style_value($style_value, $css_property) + { + } + /** + * Renders typography styles/content to the block wrapper. + * + * @since 6.1.0 + * + * @param string $block_content Rendered block content. + * @param array $block Block object. + * @return string Filtered block content. + */ + function wp_render_typography_support($block_content, $block) + { + } + /** + * Checks a string for a unit and value and returns an array + * consisting of `'value'` and `'unit'`, e.g. array( '42', 'rem' ). + * + * @since 6.1.0 + * + * @param string|int|float $raw_value Raw size value from theme.json. + * @param array $options { + * Optional. An associative array of options. Default is empty array. + * + * @type string $coerce_to Coerce the value to rem or px. Default `'rem'`. + * @type int $root_size_value Value of root font size for rem|em <-> px conversion. Default `16`. + * @type string[] $acceptable_units An array of font size units. Default `array( 'rem', 'px', 'em' )`; + * } + * @return array|null An array consisting of `'value'` and `'unit'` properties on success. + * `null` on failure. + * @phpstan-param array{ + * coerce_to?: string, + * root_size_value?: int, + * acceptable_units?: string[], + * } $options + */ + function wp_get_typography_value_and_unit($raw_value, $options = array()) + { + } + /** + * Internal implementation of CSS clamp() based on available min/max viewport + * width and min/max font sizes. + * + * @since 6.1.0 + * @since 6.3.0 Checks for unsupported min/max viewport values that cause invalid clamp values. + * @since 6.5.0 Returns early when min and max viewport subtraction is zero to avoid division by zero. + * @access private + * + * @param array $args { + * Optional. An associative array of values to calculate a fluid formula + * for font size. Default is empty array. + * + * @type string $maximum_viewport_width Maximum size up to which type will have fluidity. + * @type string $minimum_viewport_width Minimum viewport size from which type will have fluidity. + * @type string $maximum_font_size Maximum font size for any clamp() calculation. + * @type string $minimum_font_size Minimum font size for any clamp() calculation. + * @type int $scale_factor A scale factor to determine how fast a font scales within boundaries. + * } + * @return string|null A font-size value using clamp() on success, otherwise null. + * @phpstan-param array{ + * maximum_viewport_width?: string, + * minimum_viewport_width?: string, + * maximum_font_size?: string, + * minimum_font_size?: string, + * scale_factor?: int, + * } $args + */ + function wp_get_computed_fluid_typography_value($args = array()) + { + } + /** + * Returns a font-size value based on a given font-size preset. + * Takes into account fluid typography parameters and attempts to return a CSS + * formula depending on available, valid values. + * + * @since 6.1.0 + * @since 6.1.1 Adjusted rules for min and max font sizes. + * @since 6.2.0 Added 'settings.typography.fluid.minFontSize' support. + * @since 6.3.0 Using layout.wideSize as max viewport width, and logarithmic scale factor to calculate minimum font scale. + * @since 6.4.0 Added configurable min and max viewport width values to the typography.fluid theme.json schema. + * @since 6.6.0 Deprecated bool argument $should_use_fluid_typography. + * + * @param array $preset { + * Required. fontSizes preset value as seen in theme.json. + * + * @type string $name Name of the font size preset. + * @type string $slug Kebab-case, unique identifier for the font size preset. + * @type string|int|float $size CSS font-size value, including units if applicable. + * } + * @param bool|array $settings Optional Theme JSON settings array that overrides any global theme settings. + * Default is false. + * @return string|null Font-size value or null if a size is not passed in $preset. + * @phpstan-param array{ + * name?: string, + * slug?: string, + * size?: string|int|float, + * } $preset + */ + function wp_get_typography_font_size_value($preset, $settings = array()) + { + } + /** + * Block support utility functions. + * + * @package WordPress + * @subpackage Block Supports + * @since 6.0.0 + */ + /** + * Checks whether serialization of the current block's supported properties + * should occur. + * + * @since 6.0.0 + * @access private + * + * @param WP_Block_Type $block_type Block type. + * @param string $feature_set Name of block support feature set.. + * @param string $feature Optional name of individual feature to check. + * + * @return bool Whether to serialize block support styles & classes. + */ + function wp_should_skip_block_supports_serialization($block_type, $feature_set, $feature = \null) + { + } + /** + * For backward compatibility reasons, + * block themes might be using block-templates or block-template-parts, + * this function ensures we fallback to these folders properly. + * + * @since 5.9.0 + * + * @param string $theme_stylesheet The stylesheet. Default is to leverage the main theme root. + * + * @return string[] { + * Folder names used by block themes. + * + * @type string $wp_template Theme-relative directory name for block templates. + * @type string $wp_template_part Theme-relative directory name for block template parts. + * } + * @phpstan-return array{ + * wp_template: string, + * wp_template_part: string, + * } + */ + function get_block_theme_folders($theme_stylesheet = \null) + { + } + /** + * Returns a filtered list of allowed area values for template parts. + * + * @since 5.9.0 + * + * @return array[] { + * The allowed template part area values. + * + * @type array ...$0 { + * Data for the allowed template part area. + * + * @type string $area Template part area name. + * @type string $label Template part area label. + * @type string $description Template part area description. + * @type string $icon Template part area icon. + * @type string $area_tag Template part area tag. + * } + * } + * @phpstan-return array<int|string, array{ + * area: string, + * label: string, + * description: string, + * icon: string, + * area_tag: string, + * }> + */ + function get_allowed_block_template_part_areas() + { + } + /** + * Returns a filtered list of default template types, containing their + * localized titles and descriptions. + * + * @since 5.9.0 + * + * @return array[] { + * The default template types. + * + * @type array ...$0 { + * Data for the template type. + * + * @type string $title Template type title. + * @type string $description Template type description. + * } + * } + * @phpstan-return array<int|string, array{ + * title: string, + * description: string, + * }> + */ + function get_default_block_template_types() + { + } + /** + * Checks whether the input 'area' is a supported value. + * Returns the input if supported, otherwise returns the 'uncategorized' value. + * + * @since 5.9.0 + * @access private + * + * @param string $type Template part area name. + * @return string Input if supported, else the uncategorized value. + */ + function _filter_block_template_part_area($type) + { + } + /** + * Finds all nested template part file paths in a theme's directory. + * + * @since 5.9.0 + * @access private + * + * @param string $base_directory The theme's file path. + * @return string[] A list of paths to all template part files. + */ + function _get_block_templates_paths($base_directory) + { + } + /** + * Retrieves the template file from the theme for a given slug. + * + * @since 5.9.0 + * @access private + * + * @param string $template_type Template type. Either 'wp_template' or 'wp_template_part'. + * @param string $slug Template slug. + * @return array|null { + * Array with template metadata if $template_type is one of 'wp_template' or 'wp_template_part', + * null otherwise. + * + * @type string $slug Template slug. + * @type string $path Template file path. + * @type string $theme Theme slug. + * @type string $type Template type. + * @type string $area Template area. Only for 'wp_template_part'. + * @type string $title Optional. Template title. + * @type string[] $postTypes Optional. List of post types that the template supports. Only for 'wp_template'. + * } + * @phpstan-param 'wp_template'|'wp_template_part' $template_type + * @phpstan-return null|array{ + * slug: string, + * path: string, + * theme: string, + * type: string, + * area: string, + * title: string, + * postTypes: string[], + * } + */ + function _get_block_template_file($template_type, $slug) + { + } + /** + * Retrieves the template files from the theme. + * + * @since 5.9.0 + * @since 6.3.0 Added the `$query` parameter. + * @access private + * + * @param string $template_type Template type. Either 'wp_template' or 'wp_template_part'. + * @param array $query { + * Arguments to retrieve templates. Optional, empty by default. + * + * @type string[] $slug__in List of slugs to include. + * @type string[] $slug__not_in List of slugs to skip. + * @type string $area A 'wp_template_part_area' taxonomy value to filter by (for 'wp_template_part' template type only). + * @type string $post_type Post type to get the templates for. + * } + * + * @return array Template + * @phpstan-param 'wp_template'|'wp_template_part' $template_type + * @phpstan-param array{ + * slug__in?: string[], + * slug__not_in?: string[], + * area?: string, + * post_type?: string, + * } $query + */ + function _get_block_templates_files($template_type, $query = array()) + { + } + /** + * Attempts to add custom template information to the template item. + * + * @since 5.9.0 + * @access private + * + * @param array $template_item Template to add information to (requires 'slug' field). + * @return array Template item. + */ + function _add_block_template_info($template_item) + { + } + /** + * Attempts to add the template part's area information to the input template. + * + * @since 5.9.0 + * @access private + * + * @param array $template_info Template to add information to (requires 'type' and 'slug' fields). + * @return array Template info. + */ + function _add_block_template_part_area_info($template_info) + { + } + /** + * Returns an array containing the references of + * the passed blocks and their inner blocks. + * + * @since 5.9.0 + * @access private + * + * @param array $blocks array of blocks. + * @return array block references to the passed blocks and their inner blocks. + */ + function _flatten_blocks(&$blocks) + { + } + /** + * Injects the active theme's stylesheet as a `theme` attribute + * into a given template part block. + * + * @since 6.4.0 + * @access private + * + * @param array $block a parsed block. + */ + function _inject_theme_attribute_in_template_part_block(&$block) + { + } + /** + * Removes the `theme` attribute from a given template part block. + * + * @since 6.4.0 + * @access private + * + * @param array $block a parsed block. + */ + function _remove_theme_attribute_from_template_part_block(&$block) + { + } + /** + * Builds a unified template object based on a theme file. + * + * @since 5.9.0 + * @since 6.3.0 Added `modified` property to template objects. + * @access private + * + * @param array $template_file Theme file. + * @param string $template_type Template type. Either 'wp_template' or 'wp_template_part'. + * @return WP_Block_Template Template. + * @phpstan-param 'wp_template'|'wp_template_part' $template_type + */ + function _build_block_template_result_from_file($template_file, $template_type) + { + } + /** + * Builds the title and description of a post-specific template based on the underlying referenced post. + * + * Mutates the underlying template object. + * + * @since 6.1.0 + * @access private + * + * @param string $post_type Post type, e.g. page, post, product. + * @param string $slug Slug of the post, e.g. a-story-about-shoes. + * @param WP_Block_Template $template Template to mutate adding the description and title computed. + * @return bool Returns true if the referenced post was found and false otherwise. + */ + function _wp_build_title_and_description_for_single_post_type_block_template($post_type, $slug, \WP_Block_Template $template) + { + } + /** + * Builds the title and description of a taxonomy-specific template based on the underlying entity referenced. + * + * Mutates the underlying template object. + * + * @since 6.1.0 + * @access private + * + * @param string $taxonomy Identifier of the taxonomy, e.g. category. + * @param string $slug Slug of the term, e.g. shoes. + * @param WP_Block_Template $template Template to mutate adding the description and title computed. + * @return bool True if the term referenced was found and false otherwise. + */ + function _wp_build_title_and_description_for_taxonomy_block_template($taxonomy, $slug, \WP_Block_Template $template) + { + } + /** + * Builds a block template object from a post object. + * + * This is a helper function that creates a block template object from a given post object. + * It is self-sufficient in that it only uses information passed as arguments; it does not + * query the database for additional information. + * + * @since 6.5.3 + * @access private + * + * @param WP_Post $post Template post. + * @param array $terms Additional terms to inform the template object. + * @param array $meta Additional meta fields to inform the template object. + * @return WP_Block_Template|WP_Error Template or error object. + */ + function _build_block_template_object_from_post_object($post, $terms = array(), $meta = array()) + { + } + /** + * Builds a unified template object based a post Object. + * + * @since 5.9.0 + * @since 6.3.0 Added `modified` property to template objects. + * @since 6.4.0 Added support for a revision post to be passed to this function. + * @access private + * + * @param WP_Post $post Template post. + * @return WP_Block_Template|WP_Error Template or error object. + */ + function _build_block_template_result_from_post($post) + { + } + /** + * Retrieves a list of unified template objects based on a query. + * + * @since 5.8.0 + * + * @param array $query { + * Optional. Arguments to retrieve templates. + * + * @type string[] $slug__in List of slugs to include. + * @type int $wp_id Post ID of customized template. + * @type string $area A 'wp_template_part_area' taxonomy value to filter by (for 'wp_template_part' template type only). + * @type string $post_type Post type to get the templates for. + * } + * @param string $template_type Template type. Either 'wp_template' or 'wp_template_part'. + * @return WP_Block_Template[] Array of block templates. + * @phpstan-param array{ + * slug__in?: string[], + * wp_id?: int, + * area?: string, + * post_type?: string, + * } $query + * @phpstan-param 'wp_template'|'wp_template_part' $template_type + */ + function get_block_templates($query = array(), $template_type = 'wp_template') + { + } + /** + * Retrieves a single unified template object using its id. + * + * @since 5.8.0 + * + * @param string $id Template unique identifier (example: 'theme_slug//template_slug'). + * @param string $template_type Optional. Template type. Either 'wp_template' or 'wp_template_part'. + * Default 'wp_template'. + * @return WP_Block_Template|null Template. + * @phpstan-param 'wp_template'|'wp_template_part' $template_type + */ + function get_block_template($id, $template_type = 'wp_template') + { + } + /** + * Retrieves a unified template object based on a theme file. + * + * This is a fallback of get_block_template(), used when no templates are found in the database. + * + * @since 5.9.0 + * + * @param string $id Template unique identifier (example: 'theme_slug//template_slug'). + * @param string $template_type Optional. Template type. Either 'wp_template' or 'wp_template_part'. + * Default 'wp_template'. + * @return WP_Block_Template|null The found block template, or null if there isn't one. + * @phpstan-param 'wp_template'|'wp_template_part' $template_type + */ + function get_block_file_template($id, $template_type = 'wp_template') + { + } + /** + * Prints a block template part. + * + * @since 5.9.0 + * + * @param string $part The block template part to print, for example 'header' or 'footer'. + * @phpstan-return void + */ + function block_template_part($part) + { + } + /** + * Prints the header block template part. + * + * @since 5.9.0 + */ + function block_header_area() + { + } + /** + * Prints the footer block template part. + * + * @since 5.9.0 + */ + function block_footer_area() + { + } + /** + * Determines whether a theme directory should be ignored during export. + * + * @since 6.0.0 + * + * @param string $path The path of the file in the theme. + * @return bool Whether this file is in an ignored directory. + */ + function wp_is_theme_directory_ignored($path) + { + } + /** + * Creates an export of the current templates and + * template parts from the site editor at the + * specified path in a ZIP file. + * + * @since 5.9.0 + * @since 6.0.0 Adds the whole theme to the export archive. + * + * @global string $wp_version The WordPress version string. + * + * @return WP_Error|string Path of the ZIP file or error on failure. + */ + function wp_generate_block_templates_export_file() + { + } + /** + * Gets the template hierarchy for the given template slug to be created. + * + * Note: Always add `index` as the last fallback template. + * + * @since 6.1.0 + * + * @param string $slug The template slug to be created. + * @param bool $is_custom Optional. Indicates if a template is custom or + * part of the template hierarchy. Default false. + * @param string $template_prefix Optional. The template prefix for the created template. + * Used to extract the main template type, e.g. + * in `taxonomy-books` the `taxonomy` is extracted. + * Default empty string. + * @return string[] The template hierarchy. + */ + function get_template_hierarchy($slug, $is_custom = \false, $template_prefix = '') + { + } + /** + * Inject ignoredHookedBlocks metadata attributes into a template or template part. + * + * Given an object that represents a `wp_template` or `wp_template_part` post object + * prepared for inserting or updating the database, locate all blocks that have + * hooked blocks, and inject a `metadata.ignoredHookedBlocks` attribute into the anchor + * blocks to reflect the latter. + * + * @since 6.5.0 + * @access private + * + * @param stdClass $changes An object representing a template or template part + * prepared for inserting or updating the database. + * @param WP_REST_Request $deprecated Deprecated. Not used. + * @return stdClass|WP_Error The updated object representing a template or template part. + */ + function inject_ignored_hooked_blocks_metadata_attributes($changes, $deprecated = \null) + { + } + /** + * Block template loader functions. + * + * @package WordPress + */ + /** + * Adds necessary hooks to resolve '_wp-find-template' requests. + * + * @access private + * @since 5.9.0 + */ + function _add_template_loader_filters() + { + } + /** + * Finds a block template with equal or higher specificity than a given PHP template file. + * + * Internally, this communicates the block content that needs to be used by the template canvas through a global variable. + * + * @since 5.8.0 + * @since 6.3.0 Added `$_wp_current_template_id` global for editing of current template directly from the admin bar. + * + * @global string $_wp_current_template_content + * @global string $_wp_current_template_id + * + * @param string $template Path to the template. See locate_template(). + * @param string $type Sanitized filename without extension. + * @param string[] $templates A list of template candidates, in descending order of priority. + * @return string The path to the Site Editor template canvas file, or the fallback PHP template. + */ + function locate_block_template($template, $type, array $templates) + { + } + /** + * Returns the correct 'wp_template' to render for the request template type. + * + * @access private + * @since 5.8.0 + * @since 5.9.0 Added the `$fallback_template` parameter. + * + * @param string $template_type The current template type. + * @param string[] $template_hierarchy The current template hierarchy, ordered by priority. + * @param string $fallback_template A PHP fallback template to use if no matching block template is found. + * @return WP_Block_Template|null template A template object, or null if none could be found. + */ + function resolve_block_template($template_type, $template_hierarchy, $fallback_template) + { + } + /** + * Displays title tag with content, regardless of whether theme has title-tag support. + * + * @access private + * @since 5.8.0 + * + * @see _wp_render_title_tag() + */ + function _block_template_render_title_tag() + { + } + /** + * Returns the markup for the current template. + * + * @access private + * @since 5.8.0 + * + * @global string $_wp_current_template_id + * @global string $_wp_current_template_content + * @global WP_Embed $wp_embed WordPress Embed object. + * @global WP_Query $wp_query WordPress Query object. + * + * @return string Block template markup. + */ + function get_the_block_template_html() + { + } + /** + * Renders a 'viewport' meta tag. + * + * This is hooked into {@see 'wp_head'} to decouple its output from the default template canvas. + * + * @access private + * @since 5.8.0 + */ + function _block_template_viewport_meta_tag() + { + } + /** + * Strips .php or .html suffix from template file names. + * + * @access private + * @since 5.8.0 + * + * @param string $template_file Template file name. + * @return string Template file name without extension. + */ + function _strip_template_file_suffix($template_file) + { + } + /** + * Removes post details from block context when rendering a block template. + * + * @access private + * @since 5.8.0 + * + * @param array $context Default context. + * + * @return array Filtered context. + */ + function _block_template_render_without_post_block_context($context) + { + } + /** + * Sets the current WP_Query to return auto-draft posts. + * + * The auto-draft status indicates a new post, so allow the the WP_Query instance to + * return an auto-draft post for template resolution when editing a new post. + * + * @access private + * @since 5.9.0 + * + * @param WP_Query $wp_query Current WP_Query instance, passed by reference. + * @phpstan-return void + */ + function _resolve_template_for_new_post($wp_query) + { + } + /** + * Functions related to registering and parsing blocks. + * + * @package WordPress + * @subpackage Blocks + * @since 5.0.0 + */ + /** + * Removes the block asset's path prefix if provided. + * + * @since 5.5.0 + * + * @param string $asset_handle_or_path Asset handle or prefixed path. + * @return string Path without the prefix or the original value. + */ + function remove_block_asset_path_prefix($asset_handle_or_path) + { + } + /** + * Generates the name for an asset based on the name of the block + * and the field name provided. + * + * @since 5.5.0 + * @since 6.1.0 Added `$index` parameter. + * @since 6.5.0 Added support for `viewScriptModule` field. + * + * @param string $block_name Name of the block. + * @param string $field_name Name of the metadata field. + * @param int $index Optional. Index of the asset when multiple items passed. + * Default 0. + * @return string Generated asset name for the block's field. + */ + function generate_block_asset_handle($block_name, $field_name, $index = 0) + { + } + /** + * Gets the URL to a block asset. + * + * @since 6.4.0 + * + * @param string $path A normalized path to a block asset. + * @return string|false The URL to the block asset or false on failure. + */ + function get_block_asset_url($path) + { + } + /** + * Finds a script module ID for the selected block metadata field. It detects + * when a path to file was provided and optionally finds a corresponding asset + * file with details necessary to register the script module under with an + * automatically generated module ID. It returns unprocessed script module + * ID otherwise. + * + * @since 6.5.0 + * + * @param array $metadata Block metadata. + * @param string $field_name Field name to pick from metadata. + * @param int $index Optional. Index of the script module ID to register when multiple + * items passed. Default 0. + * @return string|false Script module ID or false on failure. + */ + function register_block_script_module_id($metadata, $field_name, $index = 0) + { + } + /** + * Finds a script handle for the selected block metadata field. It detects + * when a path to file was provided and optionally finds a corresponding asset + * file with details necessary to register the script under automatically + * generated handle name. It returns unprocessed script handle otherwise. + * + * @since 5.5.0 + * @since 6.1.0 Added `$index` parameter. + * @since 6.5.0 The asset file is optional. Added script handle support in the asset file. + * + * @param array $metadata Block metadata. + * @param string $field_name Field name to pick from metadata. + * @param int $index Optional. Index of the script to register when multiple items passed. + * Default 0. + * @return string|false Script handle provided directly or created through + * script's registration, or false on failure. + */ + function register_block_script_handle($metadata, $field_name, $index = 0) + { + } + /** + * Finds a style handle for the block metadata field. It detects when a path + * to file was provided and registers the style under automatically + * generated handle name. It returns unprocessed style handle otherwise. + * + * @since 5.5.0 + * @since 6.1.0 Added `$index` parameter. + * + * @param array $metadata Block metadata. + * @param string $field_name Field name to pick from metadata. + * @param int $index Optional. Index of the style to register when multiple items passed. + * Default 0. + * @return string|false Style handle provided directly or created through + * style's registration, or false on failure. + */ + function register_block_style_handle($metadata, $field_name, $index = 0) + { + } + /** + * Gets i18n schema for block's metadata read from `block.json` file. + * + * @since 5.9.0 + * + * @return object The schema for block's metadata. + */ + function get_block_metadata_i18n_schema() + { + } + /** + * Registers a block type from the metadata stored in the `block.json` file. + * + * @since 5.5.0 + * @since 5.7.0 Added support for `textdomain` field and i18n handling for all translatable fields. + * @since 5.9.0 Added support for `variations` and `viewScript` fields. + * @since 6.1.0 Added support for `render` field. + * @since 6.3.0 Added `selectors` field. + * @since 6.4.0 Added support for `blockHooks` field. + * @since 6.5.0 Added support for `allowedBlocks`, `viewScriptModule`, and `viewStyle` fields. + * + * @param string $file_or_folder Path to the JSON file with metadata definition for + * the block or path to the folder where the `block.json` file is located. + * If providing the path to a JSON file, the filename must end with `block.json`. + * @param array $args Optional. Array of block type arguments. Accepts any public property + * of `WP_Block_Type`. See WP_Block_Type::__construct() for information + * on accepted arguments. Default empty array. + * @return WP_Block_Type|false The registered block type on success, or false on failure. + * @phpstan-param array{ + * api_version?: string, + * title?: string, + * category?: string|null, + * parent?: string[]|null, + * ancestor?: string[]|null, + * allowed_blocks?: string[]|null, + * icon?: string|null, + * description?: string, + * keywords?: string[], + * textdomain?: string|null, + * styles?: array[], + * variations?: array[], + * selectors?: array, + * supports?: array|null, + * example?: array|null, + * render_callback?: callable|null, + * variation_callback?: callable|null, + * attributes?: array|null, + * uses_context?: string[], + * provides_context?: string[]|null, + * block_hooks?: string[], + * editor_script_handles?: string[], + * script_handles?: string[], + * view_script_handles?: string[], + * editor_style_handles?: string[], + * style_handles?: string[], + * view_style_handles?: string[], + * } $args See WP_Block_Type::__construct() + */ + function register_block_type_from_metadata($file_or_folder, $args = array()) + { + } + /** + * Registers a block type. The recommended way is to register a block type using + * the metadata stored in the `block.json` file. + * + * @since 5.0.0 + * @since 5.8.0 First parameter now accepts a path to the `block.json` file. + * + * @param string|WP_Block_Type $block_type Block type name including namespace, or alternatively + * a path to the JSON file with metadata definition for the block, + * or a path to the folder where the `block.json` file is located, + * or a complete WP_Block_Type instance. + * In case a WP_Block_Type is provided, the $args parameter will be ignored. + * @param array $args Optional. Array of block type arguments. Accepts any public property + * of `WP_Block_Type`. See WP_Block_Type::__construct() for information + * on accepted arguments. Default empty array. + * + * @return WP_Block_Type|false The registered block type on success, or false on failure. + * @phpstan-param array{ + * api_version?: string, + * title?: string, + * category?: string|null, + * parent?: string[]|null, + * ancestor?: string[]|null, + * allowed_blocks?: string[]|null, + * icon?: string|null, + * description?: string, + * keywords?: string[], + * textdomain?: string|null, + * styles?: array[], + * variations?: array[], + * selectors?: array, + * supports?: array|null, + * example?: array|null, + * render_callback?: callable|null, + * variation_callback?: callable|null, + * attributes?: array|null, + * uses_context?: string[], + * provides_context?: string[]|null, + * block_hooks?: string[], + * editor_script_handles?: string[], + * script_handles?: string[], + * view_script_handles?: string[], + * editor_style_handles?: string[], + * style_handles?: string[], + * view_style_handles?: string[], + * } $args See WP_Block_Type::__construct() + */ + function register_block_type($block_type, $args = array()) + { + } + /** + * Unregisters a block type. + * + * @since 5.0.0 + * + * @param string|WP_Block_Type $name Block type name including namespace, or alternatively + * a complete WP_Block_Type instance. + * @return WP_Block_Type|false The unregistered block type on success, or false on failure. + */ + function unregister_block_type($name) + { + } + /** + * Determines whether a post or content string has blocks. + * + * This test optimizes for performance rather than strict accuracy, detecting + * the pattern of a block but not validating its structure. For strict accuracy, + * you should use the block parser on post content. + * + * @since 5.0.0 + * + * @see parse_blocks() + * + * @param int|string|WP_Post|null $post Optional. Post content, post ID, or post object. + * Defaults to global $post. + * @return bool Whether the post has blocks. + */ + function has_blocks($post = \null) + { + } + /** + * Determines whether a $post or a string contains a specific block type. + * + * This test optimizes for performance rather than strict accuracy, detecting + * whether the block type exists but not validating its structure and not checking + * synced patterns (formerly called reusable blocks). For strict accuracy, + * you should use the block parser on post content. + * + * @since 5.0.0 + * + * @see parse_blocks() + * + * @param string $block_name Full block type to look for. + * @param int|string|WP_Post|null $post Optional. Post content, post ID, or post object. + * Defaults to global $post. + * @return bool Whether the post content contains the specified block. + */ + function has_block($block_name, $post = \null) + { + } + /** + * Returns an array of the names of all registered dynamic block types. + * + * @since 5.0.0 + * + * @return string[] Array of dynamic block names. + */ + function get_dynamic_block_names() + { + } + /** + * Retrieves block types hooked into the given block, grouped by anchor block type and the relative position. + * + * @since 6.4.0 + * + * @return array[] Array of block types grouped by anchor block type and the relative position. + */ + function get_hooked_blocks() + { + } + /** + * Returns the markup for blocks hooked to the given anchor block in a specific relative position. + * + * @since 6.5.0 + * @access private + * + * @param array $parsed_anchor_block The anchor block, in parsed block array format. + * @param string $relative_position The relative position of the hooked blocks. + * Can be one of 'before', 'after', 'first_child', or 'last_child'. + * @param array $hooked_blocks An array of hooked block types, grouped by anchor block and relative position. + * @param WP_Block_Template|WP_Post|array $context The block template, template part, or pattern that the anchor block belongs to. + * @return string + * @phpstan-param 'before'|'after'|'first_child'|'last_child' $relative_position + */ + function insert_hooked_blocks(&$parsed_anchor_block, $relative_position, $hooked_blocks, $context) + { + } + /** + * Adds a list of hooked block types to an anchor block's ignored hooked block types. + * + * This function is meant for internal use only. + * + * @since 6.5.0 + * @access private + * + * @param array $parsed_anchor_block The anchor block, in parsed block array format. + * @param string $relative_position The relative position of the hooked blocks. + * Can be one of 'before', 'after', 'first_child', or 'last_child'. + * @param array $hooked_blocks An array of hooked block types, grouped by anchor block and relative position. + * @param WP_Block_Template|WP_Post|array $context The block template, template part, or pattern that the anchor block belongs to. + * @return string Empty string. + * @phpstan-param 'before'|'after'|'first_child'|'last_child' $relative_position + */ + function set_ignored_hooked_blocks_metadata(&$parsed_anchor_block, $relative_position, $hooked_blocks, $context) + { + } + /** + * Runs the hooked blocks algorithm on the given content. + * + * @since 6.6.0 + * @access private + * + * @param string $content Serialized content. + * @param WP_Block_Template|WP_Post|array $context A block template, template part, `wp_navigation` post object, + * or pattern that the blocks belong to. + * @param callable $callback A function that will be called for each block to generate + * the markup for a given list of blocks that are hooked to it. + * Default: 'insert_hooked_blocks'. + * @return string The serialized markup. + */ + function apply_block_hooks_to_content($content, $context, $callback = 'insert_hooked_blocks') + { + } + /** + * Accepts the serialized markup of a block and its inner blocks, and returns serialized markup of the inner blocks. + * + * @since 6.6.0 + * @access private + * + * @param string $serialized_block The serialized markup of a block and its inner blocks. + * @return string The serialized markup of the inner blocks. + */ + function remove_serialized_parent_block($serialized_block) + { + } + /** + * Updates the wp_postmeta with the list of ignored hooked blocks where the inner blocks are stored as post content. + * Currently only supports `wp_navigation` post types. + * + * @since 6.6.0 + * @access private + * + * @param stdClass $post Post object. + * @return stdClass The updated post object. + */ + function update_ignored_hooked_blocks_postmeta($post) + { + } + /** + * Returns the markup for blocks hooked to the given anchor block in a specific relative position and then + * adds a list of hooked block types to an anchor block's ignored hooked block types. + * + * This function is meant for internal use only. + * + * @since 6.6.0 + * @access private + * + * @param array $parsed_anchor_block The anchor block, in parsed block array format. + * @param string $relative_position The relative position of the hooked blocks. + * Can be one of 'before', 'after', 'first_child', or 'last_child'. + * @param array $hooked_blocks An array of hooked block types, grouped by anchor block and relative position. + * @param WP_Block_Template|WP_Post|array $context The block template, template part, or pattern that the anchor block belongs to. + * @return string + * @phpstan-param 'before'|'after'|'first_child'|'last_child' $relative_position + */ + function insert_hooked_blocks_and_set_ignored_hooked_blocks_metadata(&$parsed_anchor_block, $relative_position, $hooked_blocks, $context) + { + } + /** + * Hooks into the REST API response for the core/navigation block and adds the first and last inner blocks. + * + * @since 6.6.0 + * + * @param WP_REST_Response $response The response object. + * @param WP_Post $post Post object. + * @return WP_REST_Response The response object. + */ + function insert_hooked_blocks_into_rest_response($response, $post) + { + } + /** + * Returns a function that injects the theme attribute into, and hooked blocks before, a given block. + * + * The returned function can be used as `$pre_callback` argument to `traverse_and_serialize_block(s)`, + * where it will inject the `theme` attribute into all Template Part blocks, and prepend the markup for + * any blocks hooked `before` the given block and as its parent's `first_child`, respectively. + * + * This function is meant for internal use only. + * + * @since 6.4.0 + * @since 6.5.0 Added $callback argument. + * @access private + * + * @param array $hooked_blocks An array of blocks hooked to another given block. + * @param WP_Block_Template|WP_Post|array $context A block template, template part, `wp_navigation` post object, + * or pattern that the blocks belong to. + * @param callable $callback A function that will be called for each block to generate + * the markup for a given list of blocks that are hooked to it. + * Default: 'insert_hooked_blocks'. + * @return callable A function that returns the serialized markup for the given block, + * including the markup for any hooked blocks before it. + */ + function make_before_block_visitor($hooked_blocks, $context, $callback = 'insert_hooked_blocks') + { + } + /** + * Returns a function that injects the hooked blocks after a given block. + * + * The returned function can be used as `$post_callback` argument to `traverse_and_serialize_block(s)`, + * where it will append the markup for any blocks hooked `after` the given block and as its parent's + * `last_child`, respectively. + * + * This function is meant for internal use only. + * + * @since 6.4.0 + * @since 6.5.0 Added $callback argument. + * @access private + * + * @param array $hooked_blocks An array of blocks hooked to another block. + * @param WP_Block_Template|WP_Post|array $context A block template, template part, `wp_navigation` post object, + * or pattern that the blocks belong to. + * @param callable $callback A function that will be called for each block to generate + * the markup for a given list of blocks that are hooked to it. + * Default: 'insert_hooked_blocks'. + * @return callable A function that returns the serialized markup for the given block, + * including the markup for any hooked blocks after it. + */ + function make_after_block_visitor($hooked_blocks, $context, $callback = 'insert_hooked_blocks') + { + } + /** + * Given an array of attributes, returns a string in the serialized attributes + * format prepared for post content. + * + * The serialized result is a JSON-encoded string, with unicode escape sequence + * substitution for characters which might otherwise interfere with embedding + * the result in an HTML comment. + * + * This function must produce output that remains in sync with the output of + * the serializeAttributes JavaScript function in the block editor in order + * to ensure consistent operation between PHP and JavaScript. + * + * @since 5.3.1 + * + * @param array $block_attributes Attributes object. + * @return string Serialized attributes. + */ + function serialize_block_attributes($block_attributes) + { + } + /** + * Returns the block name to use for serialization. This will remove the default + * "core/" namespace from a block name. + * + * @since 5.3.1 + * + * @param string|null $block_name Optional. Original block name. Null if the block name is unknown, + * e.g. Classic blocks have their name set to null. Default null. + * @return string Block name to use for serialization. + */ + function strip_core_block_namespace($block_name = \null) + { + } + /** + * Returns the content of a block, including comment delimiters. + * + * @since 5.3.1 + * + * @param string|null $block_name Block name. Null if the block name is unknown, + * e.g. Classic blocks have their name set to null. + * @param array $block_attributes Block attributes. + * @param string $block_content Block save content. + * @return string Comment-delimited block content. + */ + function get_comment_delimited_block_content($block_name, $block_attributes, $block_content) + { + } + /** + * Returns the content of a block, including comment delimiters, serializing all + * attributes from the given parsed block. + * + * This should be used when preparing a block to be saved to post content. + * Prefer `render_block` when preparing a block for display. Unlike + * `render_block`, this does not evaluate a block's `render_callback`, and will + * instead preserve the markup as parsed. + * + * @since 5.3.1 + * + * @param array $block { + * A representative array of a single parsed block object. See WP_Block_Parser_Block. + * + * @type string $blockName Name of block. + * @type array $attrs Attributes from block comment delimiters. + * @type array[] $innerBlocks List of inner blocks. An array of arrays that + * have the same structure as this one. + * @type string $innerHTML HTML from inside block comment delimiters. + * @type array $innerContent List of string fragments and null markers where + * inner blocks were found. + * } + * @return string String of rendered HTML. + * @phpstan-param array{ + * blockName?: string, + * attrs?: array, + * innerBlocks?: array[], + * innerHTML?: string, + * innerContent?: array, + * } $block + */ + function serialize_block($block) + { + } + /** + * Returns a joined string of the aggregate serialization of the given + * parsed blocks. + * + * @since 5.3.1 + * + * @param array[] $blocks { + * Array of block structures. + * + * @type array ...$0 { + * A representative array of a single parsed block object. See WP_Block_Parser_Block. + * + * @type string $blockName Name of block. + * @type array $attrs Attributes from block comment delimiters. + * @type array[] $innerBlocks List of inner blocks. An array of arrays that + * have the same structure as this one. + * @type string $innerHTML HTML from inside block comment delimiters. + * @type array $innerContent List of string fragments and null markers where + * inner blocks were found. + * } + * } + * @return string String of rendered HTML. + * @phpstan-param array<int|string, array{ + * blockName: string, + * attrs: array, + * innerBlocks: array[], + * innerHTML: string, + * innerContent: array, + * }> $blocks + */ + function serialize_blocks($blocks) + { + } + /** + * Traverses a parsed block tree and applies callbacks before and after serializing it. + * + * Recursively traverses the block and its inner blocks and applies the two callbacks provided as + * arguments, the first one before serializing the block, and the second one after serializing it. + * If either callback returns a string value, it will be prepended and appended to the serialized + * block markup, respectively. + * + * The callbacks will receive a reference to the current block as their first argument, so that they + * can also modify it, and the current block's parent block as second argument. Finally, the + * `$pre_callback` receives the previous block, whereas the `$post_callback` receives + * the next block as third argument. + * + * Serialized blocks are returned including comment delimiters, and with all attributes serialized. + * + * This function should be used when there is a need to modify the saved block, or to inject markup + * into the return value. Prefer `serialize_block` when preparing a block to be saved to post content. + * + * This function is meant for internal use only. + * + * @since 6.4.0 + * @access private + * + * @see serialize_block() + * + * @param array $block A representative array of a single parsed block object. See WP_Block_Parser_Block. + * @param callable $pre_callback Callback to run on each block in the tree before it is traversed and serialized. + * It is called with the following arguments: &$block, $parent_block, $previous_block. + * Its string return value will be prepended to the serialized block markup. + * @param callable $post_callback Callback to run on each block in the tree after it is traversed and serialized. + * It is called with the following arguments: &$block, $parent_block, $next_block. + * Its string return value will be appended to the serialized block markup. + * @return string Serialized block markup. + */ + function traverse_and_serialize_block($block, $pre_callback = \null, $post_callback = \null) + { + } + /** + * Replaces patterns in a block tree with their content. + * + * @since 6.6.0 + * + * @param array $blocks An array blocks. + * + * @return array An array of blocks with patterns replaced by their content. + */ + function resolve_pattern_blocks($blocks) + { + } + /** + * Given an array of parsed block trees, applies callbacks before and after serializing them and + * returns their concatenated output. + * + * Recursively traverses the blocks and their inner blocks and applies the two callbacks provided as + * arguments, the first one before serializing a block, and the second one after serializing. + * If either callback returns a string value, it will be prepended and appended to the serialized + * block markup, respectively. + * + * The callbacks will receive a reference to the current block as their first argument, so that they + * can also modify it, and the current block's parent block as second argument. Finally, the + * `$pre_callback` receives the previous block, whereas the `$post_callback` receives + * the next block as third argument. + * + * Serialized blocks are returned including comment delimiters, and with all attributes serialized. + * + * This function should be used when there is a need to modify the saved blocks, or to inject markup + * into the return value. Prefer `serialize_blocks` when preparing blocks to be saved to post content. + * + * This function is meant for internal use only. + * + * @since 6.4.0 + * @access private + * + * @see serialize_blocks() + * + * @param array[] $blocks An array of parsed blocks. See WP_Block_Parser_Block. + * @param callable $pre_callback Callback to run on each block in the tree before it is traversed and serialized. + * It is called with the following arguments: &$block, $parent_block, $previous_block. + * Its string return value will be prepended to the serialized block markup. + * @param callable $post_callback Callback to run on each block in the tree after it is traversed and serialized. + * It is called with the following arguments: &$block, $parent_block, $next_block. + * Its string return value will be appended to the serialized block markup. + * @return string Serialized block markup. + */ + function traverse_and_serialize_blocks($blocks, $pre_callback = \null, $post_callback = \null) + { + } + /** + * Filters and sanitizes block content to remove non-allowable HTML + * from parsed block attribute values. + * + * @since 5.3.1 + * + * @param string $text Text that may contain block content. + * @param array[]|string $allowed_html Optional. An array of allowed HTML elements and attributes, + * or a context name such as 'post'. See wp_kses_allowed_html() + * for the list of accepted context names. Default 'post'. + * @param string[] $allowed_protocols Optional. Array of allowed URL protocols. + * Defaults to the result of wp_allowed_protocols(). + * @return string The filtered and sanitized content result. + */ + function filter_block_content($text, $allowed_html = 'post', $allowed_protocols = array()) + { + } + /** + * Callback used for regular expression replacement in filter_block_content(). + * + * @since 6.2.1 + * @access private + * + * @param array $matches Array of preg_replace_callback matches. + * @return string Replacement string. + */ + function _filter_block_content_callback($matches) + { + } + /** + * Filters and sanitizes a parsed block to remove non-allowable HTML + * from block attribute values. + * + * @since 5.3.1 + * + * @param WP_Block_Parser_Block $block The parsed block object. + * @param array[]|string $allowed_html An array of allowed HTML elements and attributes, + * or a context name such as 'post'. See wp_kses_allowed_html() + * for the list of accepted context names. + * @param string[] $allowed_protocols Optional. Array of allowed URL protocols. + * Defaults to the result of wp_allowed_protocols(). + * @return array The filtered and sanitized block object result. + */ + function filter_block_kses($block, $allowed_html, $allowed_protocols = array()) + { + } + /** + * Filters and sanitizes a parsed block attribute value to remove + * non-allowable HTML. + * + * @since 5.3.1 + * @since 6.5.5 Added the `$block_context` parameter. + * + * @param string[]|string $value The attribute value to filter. + * @param array[]|string $allowed_html An array of allowed HTML elements and attributes, + * or a context name such as 'post'. See wp_kses_allowed_html() + * for the list of accepted context names. + * @param string[] $allowed_protocols Optional. Array of allowed URL protocols. + * Defaults to the result of wp_allowed_protocols(). + * @param array $block_context Optional. The block the attribute belongs to, in parsed block array format. + * @return string[]|string The filtered and sanitized result. + */ + function filter_block_kses_value($value, $allowed_html, $allowed_protocols = array(), $block_context = \null) + { + } + /** + * Sanitizes the value of the Template Part block's `tagName` attribute. + * + * @since 6.5.5 + * + * @param string $attribute_value The attribute value to filter. + * @param string $attribute_name The attribute name. + * @param array[]|string $allowed_html An array of allowed HTML elements and attributes, + * or a context name such as 'post'. See wp_kses_allowed_html() + * for the list of accepted context names. + * @return string The sanitized attribute value. + */ + function filter_block_core_template_part_attributes($attribute_value, $attribute_name, $allowed_html) + { + } + /** + * Parses blocks out of a content string, and renders those appropriate for the excerpt. + * + * As the excerpt should be a small string of text relevant to the full post content, + * this function renders the blocks that are most likely to contain such text. + * + * @since 5.0.0 + * + * @param string $content The content to parse. + * @return string The parsed and filtered content. + */ + function excerpt_remove_blocks($content) + { + } + /** + * Parses footnotes markup out of a content string, + * and renders those appropriate for the excerpt. + * + * @since 6.3.0 + * + * @param string $content The content to parse. + * @return string The parsed and filtered content. + */ + function excerpt_remove_footnotes($content) + { + } + /** + * Renders inner blocks from the allowed wrapper blocks + * for generating an excerpt. + * + * @since 5.8.0 + * @access private + * + * @param array $parsed_block The parsed block. + * @param array $allowed_blocks The list of allowed inner blocks. + * @return string The rendered inner blocks. + */ + function _excerpt_render_inner_blocks($parsed_block, $allowed_blocks) + { + } + /** + * Renders a single block into a HTML string. + * + * @since 5.0.0 + * + * @global WP_Post $post The post to edit. + * + * @param array $parsed_block { + * A representative array of the block being rendered. See WP_Block_Parser_Block. + * + * @type string $blockName Name of block. + * @type array $attrs Attributes from block comment delimiters. + * @type array[] $innerBlocks List of inner blocks. An array of arrays that + * have the same structure as this one. + * @type string $innerHTML HTML from inside block comment delimiters. + * @type array $innerContent List of string fragments and null markers where + * inner blocks were found. + * } + * @return string String of rendered HTML. + * @phpstan-param array{ + * blockName?: string, + * attrs?: array, + * innerBlocks?: array[], + * innerHTML?: string, + * innerContent?: array, + * } $parsed_block + */ + function render_block($parsed_block) + { + } + /** + * Parses blocks out of a content string. + * + * @since 5.0.0 + * + * @param string $content Post content. + * @return array[] { + * Array of block structures. + * + * @type array ...$0 { + * A representative array of a single parsed block object. See WP_Block_Parser_Block. + * + * @type string $blockName Name of block. + * @type array $attrs Attributes from block comment delimiters. + * @type array[] $innerBlocks List of inner blocks. An array of arrays that + * have the same structure as this one. + * @type string $innerHTML HTML from inside block comment delimiters. + * @type array $innerContent List of string fragments and null markers where + * inner blocks were found. + * } + * } + * @phpstan-return array<int|string, array{ + * blockName: string, + * attrs: array, + * innerBlocks: array[], + * innerHTML: string, + * innerContent: array, + * }> + */ + function parse_blocks($content) + { + } + /** + * Parses dynamic blocks out of `post_content` and re-renders them. + * + * @since 5.0.0 + * + * @param string $content Post content. + * @return string Updated post content. + */ + function do_blocks($content) + { + } + /** + * If do_blocks() needs to remove wpautop() from the `the_content` filter, this re-adds it afterwards, + * for subsequent `the_content` usage. + * + * @since 5.0.0 + * @access private + * + * @param string $content The post content running through this filter. + * @return string The unmodified content. + */ + function _restore_wpautop_hook($content) + { + } + /** + * Returns the current version of the block format that the content string is using. + * + * If the string doesn't contain blocks, it returns 0. + * + * @since 5.0.0 + * + * @param string $content Content to test. + * @return int The block format version is 1 if the content contains one or more blocks, 0 otherwise. + */ + function block_version($content) + { + } + /** + * Registers a new block style. + * + * @since 5.3.0 + * @since 6.6.0 Added support for registering styles for multiple block types. + * + * @link https://developer.wordpress.org/block-editor/reference-guides/block-api/block-styles/ + * + * @param string|string[] $block_name Block type name including namespace or array of namespaced block type names. + * @param array $style_properties Array containing the properties of the style name, label, + * style_handle (name of the stylesheet to be enqueued), + * inline_style (string containing the CSS to be added), + * style_data (theme.json-like array to generate CSS from). + * See WP_Block_Styles_Registry::register(). + * @return bool True if the block style was registered with success and false otherwise. + * @phpstan-param array{ + * name?: string, + * label?: string, + * inline_style?: string, + * style_handle?: string, + * is_default?: bool, + * style_data?: array, + * } $style_properties See WP_Block_Styles_Registry::register() + */ + function register_block_style($block_name, $style_properties) + { + } + /** + * Unregisters a block style. + * + * @since 5.3.0 + * + * @param string $block_name Block type name including namespace. + * @param string $block_style_name Block style name. + * @return bool True if the block style was unregistered with success and false otherwise. + */ + function unregister_block_style($block_name, $block_style_name) + { + } + /** + * Checks whether the current block type supports the feature requested. + * + * @since 5.8.0 + * @since 6.4.0 The `$feature` parameter now supports a string. + * + * @param WP_Block_Type $block_type Block type to check for support. + * @param string|array $feature Feature slug, or path to a specific feature to check support for. + * @param mixed $default_value Optional. Fallback value for feature support. Default false. + * @return bool Whether the feature is supported. + */ + function block_has_support($block_type, $feature, $default_value = \false) + { + } + /** + * Converts typography keys declared under `supports.*` to `supports.typography.*`. + * + * Displays a `_doing_it_wrong()` notice when a block using the older format is detected. + * + * @since 5.8.0 + * + * @param array $metadata Metadata for registering a block type. + * @return array Filtered metadata for registering a block type. + */ + function wp_migrate_old_typography_shape($metadata) + { + } + /** + * Helper function that constructs a WP_Query args array from + * a `Query` block properties. + * + * It's used in Query Loop, Query Pagination Numbers and Query Pagination Next blocks. + * + * @since 5.8.0 + * @since 6.1.0 Added `query_loop_block_query_vars` filter and `parents` support in query. + * + * @param WP_Block $block Block instance. + * @param int $page Current query's page. + * + * @return array Returns the constructed WP_Query arguments. + */ + function build_query_vars_from_query_block($block, $page) + { + } + /** + * Helper function that returns the proper pagination arrow HTML for + * `QueryPaginationNext` and `QueryPaginationPrevious` blocks based + * on the provided `paginationArrow` from `QueryPagination` context. + * + * It's used in QueryPaginationNext and QueryPaginationPrevious blocks. + * + * @since 5.9.0 + * + * @param WP_Block $block Block instance. + * @param bool $is_next Flag for handling `next/previous` blocks. + * @return string|null The pagination arrow HTML or null if there is none. + */ + function get_query_pagination_arrow($block, $is_next) + { + } + /** + * Helper function that constructs a comment query vars array from the passed + * block properties. + * + * It's used with the Comment Query Loop inner blocks. + * + * @since 6.0.0 + * + * @param WP_Block $block Block instance. + * @return array Returns the comment query parameters to use with the + * WP_Comment_Query constructor. + */ + function build_comment_query_vars_from_block($block) + { + } + /** + * Helper function that returns the proper pagination arrow HTML for + * `CommentsPaginationNext` and `CommentsPaginationPrevious` blocks based on the + * provided `paginationArrow` from `CommentsPagination` context. + * + * It's used in CommentsPaginationNext and CommentsPaginationPrevious blocks. + * + * @since 6.0.0 + * + * @param WP_Block $block Block instance. + * @param string $pagination_type Optional. Type of the arrow we will be rendering. + * Accepts 'next' or 'previous'. Default 'next'. + * @return string|null The pagination arrow HTML or null if there is none. + * @phpstan-param 'next'|'previous' $pagination_type + */ + function get_comments_pagination_arrow($block, $pagination_type = 'next') + { + } + /** + * Strips all HTML from the content of footnotes, and sanitizes the ID. + * + * This function expects slashed data on the footnotes content. + * + * @access private + * @since 6.3.2 + * + * @param string $footnotes JSON-encoded string of an array containing the content and ID of each footnote. + * @return string Filtered content without any HTML on the footnote content and with the sanitized ID. + */ + function _wp_filter_post_meta_footnotes($footnotes) + { + } + /** + * Adds the filters for footnotes meta field. + * + * @access private + * @since 6.3.2 + */ + function _wp_footnotes_kses_init_filters() + { + } + /** + * Removes the filters for footnotes meta field. + * + * @access private + * @since 6.3.2 + */ + function _wp_footnotes_remove_filters() + { + } + /** + * Registers the filter of footnotes meta field if the user does not have `unfiltered_html` capability. + * + * @access private + * @since 6.3.2 + */ + function _wp_footnotes_kses_init() + { + } + /** + * Initializes the filters for footnotes meta field when imported data should be filtered. + * + * This filter is the last one being executed on {@see 'force_filtered_html_on_import'}. + * If the input of the filter is true, it means we are in an import situation and should + * enable kses, independently of the user capabilities. So in that case we call + * _wp_footnotes_kses_init_filters(). + * + * @access private + * @since 6.3.2 + * + * @param string $arg Input argument of the filter. + * @return string Input argument of the filter. + */ + function _wp_footnotes_force_filtered_html_on_import_filter($arg) + { + } + /** + * Server-side rendering of the `core/archives` block. + * + * @package WordPress + */ + /** + * Renders the `core/archives` block on server. + * + * @since 5.0.0 + * + * @see WP_Widget_Archives + * + * @param array $attributes The block attributes. + * + * @return string Returns the post content with archives added. + */ + function render_block_core_archives($attributes) + { + } + /** + * Register archives block. + * + * @since 5.0.0 + */ + function register_block_core_archives() + { + } + /** + * Server-side rendering of the `core/avatar` block. + * + * @package WordPress + */ + /** + * Renders the `core/avatar` block on the server. + * + * @since 6.0.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * @return string Return the avatar. + */ + function render_block_core_avatar($attributes, $content, $block) + { + } + /** + * Generates class names and styles to apply the border support styles for + * the Avatar block. + * + * @since 6.3.0 + * + * @param array $attributes The block attributes. + * @return array The border-related classnames and styles for the block. + */ + function get_block_core_avatar_border_attributes($attributes) + { + } + /** + * Registers the `core/avatar` block on the server. + * + * @since 6.0.0 + */ + function register_block_core_avatar() + { + } + /** + * Server-side rendering of the `core/block` block. + * + * @package WordPress + */ + /** + * Renders the `core/block` block on server. + * + * @since 5.0.0 + * + * @global WP_Embed $wp_embed + * + * @param array $attributes The block attributes. + * + * @return string Rendered HTML of the referenced block. + */ + function render_block_core_block($attributes) + { + } + /** + * Registers the `core/block` block. + * + * @since 5.3.0 + */ + function register_block_core_block() + { + } + /** + * Server-side rendering of the `core/button` block. + * + * @package WordPress + */ + /** + * Renders the `core/button` block on the server, + * + * @since 6.6.0 + * + * @param array $attributes The block attributes. + * @param string $content The block content. + * @param WP_Block $block The block object. + * + * @return string The block content. + */ + function render_block_core_button($attributes, $content) + { + } + /** + * Registers the `core/button` block on server. + * + * @since 6.6.0 + */ + function register_block_core_button() + { + } + /** + * Server-side rendering of the `core/calendar` block. + * + * @package WordPress + */ + /** + * Renders the `core/calendar` block on server. + * + * @since 5.2.0 + * + * @global int $monthnum. + * @global int $year. + * + * @param array $attributes The block attributes. + * + * @return string Returns the block content. + */ + function render_block_core_calendar($attributes) + { + } + /** + * Registers the `core/calendar` block on server. + * + * @since 5.2.0 + */ + function register_block_core_calendar() + { + } + /** + * Returns whether or not there are any published posts. + * + * Used to hide the calendar block when there are no published posts. + * This compensates for a known Core bug: https://core.trac.wordpress.org/ticket/12016 + * + * @since 5.9.0 + * + * @return bool Has any published posts or not. + */ + function block_core_calendar_has_published_posts() + { + } + /** + * Queries the database for any published post and saves + * a flag whether any published post exists or not. + * + * @since 5.9.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return bool Has any published posts or not. + */ + function block_core_calendar_update_has_published_posts() + { + } + /** + * Handler for updating the has published posts flag when a post is deleted. + * + * @since 5.9.0 + * + * @param int $post_id Deleted post ID. + * @phpstan-return void + */ + function block_core_calendar_update_has_published_post_on_delete($post_id) + { + } + /** + * Handler for updating the has published posts flag when a post status changes. + * + * @since 5.9.0 + * + * @param string $new_status The status the post is changing to. + * @param string $old_status The status the post is changing from. + * @param WP_Post $post Post object. + * @phpstan-return void + */ + function block_core_calendar_update_has_published_post_on_transition_post_status($new_status, $old_status, $post) + { + } + /** + * Server-side rendering of the `core/categories` block. + * + * @package WordPress + */ + /** + * Renders the `core/categories` block on server. + * + * @since 5.0.0 + * + * @param array $attributes The block attributes. + * + * @return string Returns the categories list/dropdown markup. + */ + function render_block_core_categories($attributes) + { + } + /** + * Generates the inline script for a categories dropdown field. + * + * @since 5.0.0 + * + * @param string $dropdown_id ID of the dropdown field. + * + * @return string Returns the dropdown onChange redirection script. + */ + function build_dropdown_script_block_core_categories($dropdown_id) + { + } + /** + * Registers the `core/categories` block on server. + * + * @since 5.0.0 + */ + function register_block_core_categories() + { + } + /** + * Server-side rendering of the `core/comment-author-name` block. + * + * @package WordPress + */ + /** + * Renders the `core/comment-author-name` block on the server. + * + * @since 6.0.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * @return string Return the post comment's author. + */ + function render_block_core_comment_author_name($attributes, $content, $block) + { + } + /** + * Registers the `core/comment-author-name` block on the server. + * + * @since 6.0.0 + */ + function register_block_core_comment_author_name() + { + } + /** + * Server-side rendering of the `core/comment-content` block. + * + * @package WordPress + */ + /** + * Renders the `core/comment-content` block on the server. + * + * @since 6.0.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * @return string Return the post comment's content. + */ + function render_block_core_comment_content($attributes, $content, $block) + { + } + /** + * Registers the `core/comment-content` block on the server. + * + * @since 6.0.0 + */ + function register_block_core_comment_content() + { + } + /** + * Server-side rendering of the `core/comment-date` block. + * + * @package WordPress + */ + /** + * Renders the `core/comment-date` block on the server. + * + * @since 6.0.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * @return string Return the post comment's date. + */ + function render_block_core_comment_date($attributes, $content, $block) + { + } + /** + * Registers the `core/comment-date` block on the server. + * + * @since 6.0.0 + */ + function register_block_core_comment_date() + { + } + /** + * Server-side rendering of the `core/comment-edit-link` block. + * + * @package WordPress + */ + /** + * Renders the `core/comment-edit-link` block on the server. + * + * @since 6.0.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * + * @return string Return the post comment's date. + */ + function render_block_core_comment_edit_link($attributes, $content, $block) + { + } + /** + * Registers the `core/comment-edit-link` block on the server. + * + * @since 6.0.0 + */ + function register_block_core_comment_edit_link() + { + } + /** + * Server-side rendering of the `core/comment-reply-link` block. + * + * @package WordPress + */ + /** + * Renders the `core/comment-reply-link` block on the server. + * + * @since 6.0.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * @return string Return the post comment's reply link. + */ + function render_block_core_comment_reply_link($attributes, $content, $block) + { + } + /** + * Registers the `core/comment-reply-link` block on the server. + * + * @since 6.0.0 + */ + function register_block_core_comment_reply_link() + { + } + /** + * Server-side rendering of the `core/comment-template` block. + * + * @package WordPress + */ + /** + * Function that recursively renders a list of nested comments. + * + * @since 6.3.0 Changed render_block_context priority to `1`. + * + * @global int $comment_depth + * + * @param WP_Comment[] $comments The array of comments. + * @param WP_Block $block Block instance. + * @return string + */ + function block_core_comment_template_render_comments($comments, $block) + { + } + /** + * Renders the `core/comment-template` block on the server. + * + * @since 6.0.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * + * @return string Returns the HTML representing the comments using the layout + * defined by the block's inner blocks. + */ + function render_block_core_comment_template($attributes, $content, $block) + { + } + /** + * Registers the `core/comment-template` block on the server. + * + * @since 6.0.0 + */ + function register_block_core_comment_template() + { + } + /** + * Server-side rendering of the `core/comments-pagination-next` block. + * + * @package WordPress + */ + /** + * Renders the `core/comments-pagination-next` block on the server. + * + * @since 6.0.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * + * @return string Returns the next comments link for the query pagination. + */ + function render_block_core_comments_pagination_next($attributes, $content, $block) + { + } + /** + * Registers the `core/comments-pagination-next` block on the server. + * + * @since 6.0.0 + */ + function register_block_core_comments_pagination_next() + { + } + /** + * Server-side rendering of the `core/comments-pagination-numbers` block. + * + * @package WordPress + */ + /** + * Renders the `core/comments-pagination-numbers` block on the server. + * + * @since 6.0.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * + * @return string Returns the pagination numbers for the comments. + */ + function render_block_core_comments_pagination_numbers($attributes, $content, $block) + { + } + /** + * Registers the `core/comments-pagination-numbers` block on the server. + * + * @since 6.0.0 + */ + function register_block_core_comments_pagination_numbers() + { + } + /** + * Server-side rendering of the `core/comments-pagination-previous` block. + * + * @package WordPress + */ + /** + * Renders the `core/comments-pagination-previous` block on the server. + * + * @since 6.0.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * + * @return string Returns the previous posts link for the comments pagination. + */ + function render_block_core_comments_pagination_previous($attributes, $content, $block) + { + } + /** + * Registers the `core/comments-pagination-previous` block on the server. + * + * @since 6.0.0 + */ + function register_block_core_comments_pagination_previous() + { + } + /** + * Server-side rendering of the `core/comments-pagination` block. + * + * @package WordPress + */ + /** + * Renders the `core/comments-pagination` block on the server. + * + * @since 6.0.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * + * @return string Returns the wrapper for the Comments pagination. + */ + function render_block_core_comments_pagination($attributes, $content) + { + } + /** + * Registers the `core/comments-pagination` block on the server. + * + * @since 6.0.0 + */ + function register_block_core_comments_pagination() + { + } + /** + * Server-side rendering of the `core/comments-title` block. + * + * @package WordPress + */ + /** + * Renders the `core/comments-title` block on the server. + * + * @since 6.0.0 + * + * @param array $attributes Block attributes. + * + * @return string Return the post comments title. + */ + function render_block_core_comments_title($attributes) + { + } + /** + * Registers the `core/comments-title` block on the server. + * + * @since 6.0.0 + */ + function register_block_core_comments_title() + { + } + /** + * Server-side rendering of the `core/comments` block. + * + * @package WordPress + */ + /** + * Renders the `core/comments` block on the server. + * + * This render callback is mainly for rendering a dynamic, legacy version of + * this block (the old `core/post-comments`). It uses the `comments_template()` + * function to generate the output, in the same way as classic PHP themes. + * + * As this callback will always run during SSR, first we need to check whether + * the block is in legacy mode. If not, the HTML generated in the editor is + * returned instead. + * + * @since 6.1.0 + * + * @global WP_Post $post Global post object. + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * @return string Returns the filtered post comments for the current post wrapped inside "p" tags. + */ + function render_block_core_comments($attributes, $content, $block) + { + } + /** + * Registers the `core/comments` block on the server. + * + * @since 6.1.0 + */ + function register_block_core_comments() + { + } + /** + * Use the button block classes for the form-submit button. + * + * @since 6.1.0 + * + * @param array $fields The default comment form arguments. + * + * @return array Returns the modified fields. + */ + function comments_block_form_defaults($fields) + { + } + /** + * Enqueues styles from the legacy `core/post-comments` block. These styles are + * required only by the block's fallback. + * + * @since 6.1.0 + * + * @param string $block_name Name of the new block type. + */ + function enqueue_legacy_post_comments_block_styles($block_name) + { + } + /** + * Ensures backwards compatibility for any users running the Gutenberg plugin + * who have used Post Comments before it was merged into Comments Query Loop. + * + * The same approach was followed when core/query-loop was renamed to + * core/post-template. + * + * @since 6.1.0 + * + * @see https://github.com/WordPress/gutenberg/pull/41807 + * @see https://github.com/WordPress/gutenberg/pull/32514 + */ + function register_legacy_post_comments_block() + { + } + /** + * Server-side rendering of the `core/cover` block. + * + * @package WordPress + */ + /** + * Renders the `core/cover` block on server. + * + * @since 6.0.0 + * + * @param array $attributes The block attributes. + * @param string $content The block rendered content. + * + * @return string Returns the cover block markup, if useFeaturedImage is true. + */ + function render_block_core_cover($attributes, $content) + { + } + /** + * Registers the `core/cover` block renderer on server. + * + * @since 6.0.0 + */ + function register_block_core_cover() + { + } + /** + * Server-side rendering of the `core/file` block. + * + * @package WordPress + */ + /** + * When the `core/file` block is rendering, check if we need to enqueue the `wp-block-file-view` script. + * + * @since 5.8.0 + * + * @param array $attributes The block attributes. + * @param string $content The block content. + * @param WP_Block $block The parsed block. + * + * @return string Returns the block content. + */ + function render_block_core_file($attributes, $content) + { + } + /** + * Registers the `core/file` block on server. + * + * @since 5.8.0 + */ + function register_block_core_file() + { + } + /** + * Server-side rendering of the `core/footnotes` block. + * + * @package WordPress + */ + /** + * Renders the `core/footnotes` block on the server. + * + * @since 6.3.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * + * @return string Returns the HTML representing the footnotes. + */ + function render_block_core_footnotes($attributes, $content, $block) + { + } + /** + * Registers the `core/footnotes` block on the server. + * + * @since 6.3.0 + */ + function register_block_core_footnotes() + { + } + /** + * Registers the footnotes meta field required for footnotes to work. + * + * @since 6.5.0 + */ + function register_block_core_footnotes_post_meta() + { + } + /** + * Adds the footnotes field to the revisions display. + * + * @since 6.3.0 + * + * @param array $fields The revision fields. + * @return array The revision fields. + */ + function wp_add_footnotes_to_revision($fields) + { + } + /** + * Gets the footnotes field from the revision for the revisions screen. + * + * @since 6.3.0 + * + * @param string $revision_field The field value, but $revision->$field + * (footnotes) does not exist. + * @param string $field The field name, in this case "footnotes". + * @param object $revision The revision object to compare against. + * @return string The field value. + */ + function wp_get_footnotes_from_revision($revision_field, $field, $revision) + { + } + /** + * Server-side rendering of the `core/gallery` block. + * + * @package WordPress + */ + /** + * Handles backwards compatibility for Gallery Blocks, + * whose images feature a `data-id` attribute. + * + * Now that the Gallery Block contains inner Image Blocks, + * we add a custom `data-id` attribute before rendering the gallery + * so that the Image Block can pick it up in its render_callback. + * + * @since 5.9.0 + * + * @param array $parsed_block The block being rendered. + * @return array The migrated block object. + */ + function block_core_gallery_data_id_backcompatibility($parsed_block) + { + } + /** + * Renders the `core/gallery` block on the server. + * + * @since 6.0.0 + * + * @param array $attributes Attributes of the block being rendered. + * @param string $content Content of the block being rendered. + * @return string The content of the block being rendered. + */ + function block_core_gallery_render($attributes, $content) + { + } + /** + * Registers the `core/gallery` block on server. + * + * @since 5.9.0 + */ + function register_block_core_gallery() + { + } + /** + * Appending the wp-block-heading to before rendering the stored `core/heading` block contents. + * + * @package WordPress + */ + /** + * Adds a wp-block-heading class to the heading block content. + * + * For example, the following block content: + * <h2 class="align-left">Hello World</h2> + * + * Would be transformed to: + * <h2 class="align-left wp-block-heading">Hello World</h2> + * + * @since 6.2.0 + * + * @param array $attributes Attributes of the block being rendered. + * @param string $content Content of the block being rendered. + * + * @return string The content of the block being rendered. + */ + function block_core_heading_render($attributes, $content) + { + } + /** + * Registers the `core/heading` block on server. + * + * @since 6.2.0 + */ + function register_block_core_heading() + { + } + /** + * Server-side rendering of the `core/home-link` block. + * + * @package WordPress + */ + /** + * Build an array with CSS classes and inline styles defining the colors + * which will be applied to the home link markup in the front-end. + * + * @since 6.0.0 + * + * @param array $context home link block context. + * @return array Colors CSS classes and inline styles. + */ + function block_core_home_link_build_css_colors($context) + { + } + /** + * Build an array with CSS classes and inline styles defining the font sizes + * which will be applied to the home link markup in the front-end. + * + * @since 6.0.0 + * + * @param array $context Home link block context. + * @return array Font size CSS classes and inline styles. + */ + function block_core_home_link_build_css_font_sizes($context) + { + } + /** + * Builds an array with classes and style for the li wrapper + * + * @since 6.0.0 + * + * @param array $context Home link block context. + * @return string The li wrapper attributes. + */ + function block_core_home_link_build_li_wrapper_attributes($context) + { + } + /** + * Renders the `core/home-link` block. + * + * @since 6.0.0 + * + * @param array $attributes The block attributes. + * @param string $content The saved content. + * @param WP_Block $block The parsed block. + * + * @return string Returns the post content with the home url added. + */ + function render_block_core_home_link($attributes, $content, $block) + { + } + /** + * Register the home block + * + * @since 6.0.0 + * + * @uses render_block_core_home_link() + * @throws WP_Error An WP_Error exception parsing the block definition. + */ + function register_block_core_home_link() + { + } + /** + * Server-side rendering of the `core/image` block. + * + * @package WordPress + */ + /** + * Renders the `core/image` block on the server, + * adding a data-id attribute to the element if core/gallery has added on pre-render. + * + * @since 5.9.0 + * + * @param array $attributes The block attributes. + * @param string $content The block content. + * @param WP_Block $block The block object. + * + * @return string The block content with the data-id attribute added. + */ + function render_block_core_image($attributes, $content, $block) + { + } + /** + * Adds the lightboxEnabled flag to the block data. + * + * This is used to determine whether the lightbox should be rendered or not. + * + * @since 6.4.0 + * + * @param array $block Block data. + * + * @return array Filtered block data. + */ + function block_core_image_get_lightbox_settings($block) + { + } + /** + * Adds the directives and layout needed for the lightbox behavior. + * + * @since 6.4.0 + * + * @param string $block_content Rendered block content. + * @param array $block Block object. + * + * @return string Filtered block content. + */ + function block_core_image_render_lightbox($block_content, $block) + { + } + /** + * @since 6.5.0 + */ + function block_core_image_print_lightbox_overlay() + { + } + /** + * Registers the `core/image` block on server. + * + * @since 5.9.0 + */ + function register_block_core_image() + { + } + /** + * Registers core block style handles. + * + * While {@see register_block_style_handle()} is typically used for that, the way it is + * implemented is inefficient for core block styles. Registering those style handles here + * avoids unnecessary logic and filesystem lookups in the other function. + * + * @since 6.3.0 + * + * @global string $wp_version The WordPress version string. + */ + function register_core_block_style_handles() + { + } + /** + * Registers core block types using metadata files. + * Dynamic core blocks are registered separately. + * + * @since 5.5.0 + */ + function register_core_block_types_from_metadata() + { + } + /** + * Server-side rendering of the `core/latest-comments` block. + * + * @package WordPress + */ + /** + * Get the post title. + * + * The post title is fetched and if it is blank then a default string is + * returned. + * + * Copied from `wp-admin/includes/template.php`, but we can't include that + * file because: + * + * 1. It causes bugs with test fixture generation and strange Docker 255 error + * codes. + * 2. It's in the admin; ideally we *shouldn't* be including files from the + * admin for a block's output. It's a very small/simple function as well, + * so duplicating it isn't too terrible. + * + * @since 3.3.0 + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. + * @return string The post title if set; "(no title)" if no title is set. + */ + function wp_latest_comments_draft_or_post_title($post = 0) + { + } + /** + * Renders the `core/latest-comments` block on server. + * + * @since 5.1.0 + * + * @param array $attributes The block attributes. + * + * @return string Returns the post content with latest comments added. + */ + function render_block_core_latest_comments($attributes = array()) + { + } + /** + * Registers the `core/latest-comments` block. + * + * @since 5.3.0 + */ + function register_block_core_latest_comments() + { + } + /** + * Callback for the excerpt_length filter used by + * the Latest Posts block at render time. + * + * @since 5.4.0 + * + * @return int Returns the global $block_core_latest_posts_excerpt_length variable + * to allow the excerpt_length filter respect the Latest Block setting. + */ + function block_core_latest_posts_get_excerpt_length() + { + } + /** + * Renders the `core/latest-posts` block on server. + * + * @since 5.0.0 + * + * @param array $attributes The block attributes. + * + * @return string Returns the post content with latest posts added. + */ + function render_block_core_latest_posts($attributes) + { + } + /** + * Registers the `core/latest-posts` block on server. + * + * @since 5.0.0 + */ + function register_block_core_latest_posts() + { + } + /** + * Handles outdated versions of the `core/latest-posts` block by converting + * attribute `categories` from a numeric string to an array with key `id`. + * + * This is done to accommodate the changes introduced in #20781 that sought to + * add support for multiple categories to the block. However, given that this + * block is dynamic, the usual provisions for block migration are insufficient, + * as they only act when a block is loaded in the editor. + * + * TODO: Remove when and if the bottom client-side deprecation for this block + * is removed. + * + * @since 5.5.0 + * + * @param array $block A single parsed block object. + * + * @return array The migrated block object. + */ + function block_core_latest_posts_migrate_categories($block) + { + } + /** + * Server-side rendering of the `core/legacy-widget` block. + * + * @package WordPress + */ + /** + * Renders the 'core/legacy-widget' block. + * + * @since 5.8.0 + * + * @global int $wp_widget_factory. + * + * @param array $attributes The block attributes. + * + * @return string Rendered block. + */ + function render_block_core_legacy_widget($attributes) + { + } + /** + * Registers the 'core/legacy-widget' block. + * + * @since 5.8.0 + */ + function register_block_core_legacy_widget() + { + } + /** + * Intercepts any request with legacy-widget-preview in the query param and, if + * set, renders a page containing a preview of the requested Legacy Widget + * block. + * + * @since 5.8.0 + * @phpstan-return void + */ + function handle_legacy_widget_preview_iframe() + { + } + /** + * Adds the wp-block-list class to the rendered list block. + * + * @package WordPress + */ + /** + * Adds the wp-block-list class to the rendered list block. + * Ensures that pre-existing list blocks use the class name on the front. + * For example, <ol> is transformed to <ol class="wp-block-list">. + * + * @since 6.6.0 + * + * @see https://github.com/WordPress/gutenberg/issues/12420 + * + * @param array $attributes Attributes of the block being rendered. + * @param string $content Content of the block being rendered. + * + * @return string The content of the block being rendered. + */ + function block_core_list_render($attributes, $content) + { + } + /** + * Registers the `core/list` block on server. + * + * @since 6.6.0 + */ + function register_block_core_list() + { + } + /** + * Server-side rendering of the `core/loginout` block. + * + * @package WordPress + */ + /** + * Renders the `core/loginout` block on server. + * + * @since 5.8.0 + * + * @param array $attributes The block attributes. + * + * @return string Returns the login-out link or form. + */ + function render_block_core_loginout($attributes) + { + } + /** + * Registers the `core/loginout` block on server. + * + * @since 5.8.0 + */ + function register_block_core_loginout() + { + } + /** + * Server-side rendering of the `core/media-text` block. + * + * @package WordPress + */ + /** + * Renders the `core/media-text` block on server. + * + * @since 6.6.0 + * + * @param array $attributes The block attributes. + * @param string $content The block rendered content. + * + * @return string Returns the Media & Text block markup, if useFeaturedImage is true. + */ + function render_block_core_media_text($attributes, $content) + { + } + /** + * Registers the `core/media-text` block renderer on server. + * + * @since 6.6.0 + */ + function register_block_core_media_text() + { + } + /** + * Server-side registering and rendering of the `core/navigation-link` block. + * + * @package WordPress + */ + /** + * Build an array with CSS classes and inline styles defining the colors + * which will be applied to the navigation markup in the front-end. + * + * @since 5.9.0 + * + * @param array $context Navigation block context. + * @param array $attributes Block attributes. + * @param bool $is_sub_menu Whether the link is part of a sub-menu. + * @return array Colors CSS classes and inline styles. + */ + function block_core_navigation_link_build_css_colors($context, $attributes, $is_sub_menu = \false) + { + } + /** + * Build an array with CSS classes and inline styles defining the font sizes + * which will be applied to the navigation markup in the front-end. + * + * @since 5.9.0 + * + * @param array $context Navigation block context. + * @return array Font size CSS classes and inline styles. + */ + function block_core_navigation_link_build_css_font_sizes($context) + { + } + /** + * Returns the top-level submenu SVG chevron icon. + * + * @since 5.9.0 + * + * @return string + */ + function block_core_navigation_link_render_submenu_icon() + { + } + /** + * Decodes a url if it's encoded, returning the same url if not. + * + * @since 6.2.0 + * + * @param string $url The url to decode. + * + * @return string $url Returns the decoded url. + */ + function block_core_navigation_link_maybe_urldecode($url) + { + } + /** + * Renders the `core/navigation-link` block. + * + * @since 5.9.0 + * + * @param array $attributes The block attributes. + * @param string $content The saved content. + * @param WP_Block $block The parsed block. + * + * @return string Returns the post content with the legacy widget added. + */ + function render_block_core_navigation_link($attributes, $content, $block) + { + } + /** + * Returns a navigation link variation + * + * @since 5.9.0 + * + * @param WP_Taxonomy|WP_Post_Type $entity post type or taxonomy entity. + * @param string $kind string of value 'taxonomy' or 'post-type'. + * + * @return array + */ + function build_variation_for_navigation_link($entity, $kind) + { + } + /** + * Filters the registered variations for a block type. + * Returns the dynamically built variations for all post-types and taxonomies. + * + * @since 6.5.0 + * + * @param array $variations Array of registered variations for a block type. + * @param WP_Block_Type $block_type The full block type object. + */ + function block_core_navigation_link_filter_variations($variations, $block_type) + { + } + /** + * Returns an array of variations for the navigation link block. + * + * @since 6.5.0 + * + * @return array + */ + function block_core_navigation_link_build_variations() + { + } + /** + * Registers the navigation link block. + * + * @since 5.9.0 + * + * @uses render_block_core_navigation_link() + * @throws WP_Error An WP_Error exception parsing the block definition. + */ + function register_block_core_navigation_link() + { + } + /** + * Server-side rendering of the `core/navigation-submenu` block. + * + * @package WordPress + */ + /** + * Build an array with CSS classes and inline styles defining the font sizes + * which will be applied to the navigation markup in the front-end. + * + * @since 5.9.0 + * + * @param array $context Navigation block context. + * @return array Font size CSS classes and inline styles. + */ + function block_core_navigation_submenu_build_css_font_sizes($context) + { + } + /** + * Returns the top-level submenu SVG chevron icon. + * + * @since 5.9.0 + * + * @return string + */ + function block_core_navigation_submenu_render_submenu_icon() + { + } + /** + * Renders the `core/navigation-submenu` block. + * + * @since 5.9.0 + * + * @param array $attributes The block attributes. + * @param string $content The saved content. + * @param WP_Block $block The parsed block. + * + * @return string Returns the post content with the legacy widget added. + */ + function render_block_core_navigation_submenu($attributes, $content, $block) + { + } + /** + * Register the navigation submenu block. + * + * @since 5.9.0 + * + * @uses render_block_core_navigation_submenu() + * @throws WP_Error An WP_Error exception parsing the block definition. + */ + function register_block_core_navigation_submenu() + { + } + /** + * Returns the menu items for a WordPress menu location. + * + * @since 5.9.0 + * + * @param string $location The menu location. + * @return array Menu items for the location. + */ + function block_core_navigation_get_menu_items_at_location($location) + { + } + /** + * Sorts a standard array of menu items into a nested structure keyed by the + * id of the parent menu. + * + * @since 5.9.0 + * + * @param array $menu_items Menu items to sort. + * @return array An array keyed by the id of the parent menu where each element + * is an array of menu items that belong to that parent. + */ + function block_core_navigation_sort_menu_items_by_parent_id($menu_items) + { + } + /** + * Gets the inner blocks for the navigation block from the unstable location attribute. + * + * @since 6.5.0 + * + * @param array $attributes The block attributes. + * @return WP_Block_List Returns the inner blocks for the navigation block. + */ + function block_core_navigation_get_inner_blocks_from_unstable_location($attributes) + { + } + /** + * Add Interactivity API directives to the navigation-submenu and page-list + * blocks markup using the Tag Processor. + * + * @since 6.3.0 + * + * @param WP_HTML_Tag_Processor $tags Markup of the navigation block. + * @param array $block_attributes Block attributes. + * + * @return string Submenu markup with the directives injected. + */ + function block_core_navigation_add_directives_to_submenu($tags, $block_attributes) + { + } + /** + * Build an array with CSS classes and inline styles defining the colors + * which will be applied to the navigation markup in the front-end. + * + * @since 5.9.0 + * + * @param array $attributes Navigation block attributes. + * + * @return array Colors CSS classes and inline styles. + */ + function block_core_navigation_build_css_colors($attributes) + { + } + /** + * Build an array with CSS classes and inline styles defining the font sizes + * which will be applied to the navigation markup in the front-end. + * + * @since 5.9.0 + * + * @param array $attributes Navigation block attributes. + * + * @return array Font size CSS classes and inline styles. + */ + function block_core_navigation_build_css_font_sizes($attributes) + { + } + /** + * Returns the top-level submenu SVG chevron icon. + * + * @since 5.9.0 + * + * @return string + */ + function block_core_navigation_render_submenu_icon() + { + } + /** + * Filter out empty "null" blocks from the block list. + * 'parse_blocks' includes a null block with '\n\n' as the content when + * it encounters whitespace. This is not a bug but rather how the parser + * is designed. + * + * @since 5.9.0 + * + * @param array $parsed_blocks the parsed blocks to be normalized. + * @return array the normalized parsed blocks. + */ + function block_core_navigation_filter_out_empty_blocks($parsed_blocks) + { + } + /** + * Returns true if the navigation block contains a nested navigation block. + * + * @since 6.2.0 + * + * @param WP_Block_List $inner_blocks Inner block instance to be normalized. + * @return bool true if the navigation block contains a nested navigation block. + */ + function block_core_navigation_block_contains_core_navigation($inner_blocks) + { + } + /** + * Retrieves the appropriate fallback to be used on the front of the + * site when there is no menu assigned to the Nav block. + * + * This aims to mirror how the fallback mechanic for wp_nav_menu works. + * See https://developer.wordpress.org/reference/functions/wp_nav_menu/#more-information. + * + * @since 5.9.0 + * + * @return array the array of blocks to be used as a fallback. + */ + function block_core_navigation_get_fallback_blocks() + { + } + /** + * Iterate through all inner blocks recursively and get navigation link block's post IDs. + * + * @since 6.0.0 + * + * @param WP_Block_List $inner_blocks Block list class instance. + * + * @return array Array of post IDs. + */ + function block_core_navigation_get_post_ids($inner_blocks) + { + } + /** + * Get post IDs from a navigation link block instance. + * + * @since 6.0.0 + * + * @param WP_Block $block Instance of a block. + * + * @return array Array of post IDs. + */ + function block_core_navigation_from_block_get_post_ids($block) + { + } + /** + * Renders the `core/navigation` block on server. + * + * @since 5.9.0 + * + * @param array $attributes The block attributes. + * @param string $content The saved content. + * @param WP_Block $block The parsed block. + * + * @return string Returns the navigation block markup. + */ + function render_block_core_navigation($attributes, $content, $block) + { + } + /** + * Register the navigation block. + * + * @since 5.9.0 + * + * @uses render_block_core_navigation() + * @throws WP_Error An WP_Error exception parsing the block definition. + */ + function register_block_core_navigation() + { + } + /** + * Filter that changes the parsed attribute values of navigation blocks contain typographic presets to contain the values directly. + * + * @since 5.9.0 + * + * @param array $parsed_block The block being rendered. + * + * @return array The block being rendered without typographic presets. + */ + function block_core_navigation_typographic_presets_backcompatibility($parsed_block) + { + } + /** + * Turns menu item data into a nested array of parsed blocks + * + * @since 5.9.0 + * + * @deprecated 6.3.0 Use WP_Navigation_Fallback::parse_blocks_from_menu_items() instead. + * + * @param array $menu_items An array of menu items that represent + * an individual level of a menu. + * @param array $menu_items_by_parent_id An array keyed by the id of the + * parent menu where each element is an + * array of menu items that belong to + * that parent. + * @return array An array of parsed block data. + */ + function block_core_navigation_parse_blocks_from_menu_items($menu_items, $menu_items_by_parent_id) + { + } + /** + * Get the classic navigation menu to use as a fallback. + * + * @since 6.2.0 + * + * @deprecated 6.3.0 Use WP_Navigation_Fallback::get_classic_menu_fallback() instead. + * + * @return object WP_Term The classic navigation. + */ + function block_core_navigation_get_classic_menu_fallback() + { + } + /** + * Converts a classic navigation to blocks. + * + * @since 6.2.0 + * + * @deprecated 6.3.0 Use WP_Navigation_Fallback::get_classic_menu_fallback_blocks() instead. + * + * @param object $classic_nav_menu WP_Term The classic navigation object to convert. + * @return array the normalized parsed blocks. + */ + function block_core_navigation_get_classic_menu_fallback_blocks($classic_nav_menu) + { + } + /** + * If there's a classic menu then use it as a fallback. + * + * @since 6.2.0 + * + * @deprecated 6.3.0 Use WP_Navigation_Fallback::create_classic_menu_fallback() instead. + * + * @return array the normalized parsed blocks. + */ + function block_core_navigation_maybe_use_classic_menu_fallback() + { + } + /** + * Finds the most recently published `wp_navigation` Post. + * + * @since 6.1.0 + * + * @deprecated 6.3.0 Use WP_Navigation_Fallback::get_most_recently_published_navigation() instead. + * + * @return WP_Post|null the first non-empty Navigation or null. + */ + function block_core_navigation_get_most_recently_published_navigation() + { + } + /** + * Accepts the serialized markup of a block and its inner blocks, and returns serialized markup of the inner blocks. + * + * @since 6.5.0 + * + * @param string $serialized_block The serialized markup of a block and its inner blocks. + * @return string + */ + function block_core_navigation_remove_serialized_parent_block($serialized_block) + { + } + /** + * Mock a parsed block for the Navigation block given its inner blocks and the `wp_navigation` post object. + * The `wp_navigation` post's `_wp_ignored_hooked_blocks` meta is queried to add the `metadata.ignoredHookedBlocks` attribute. + * + * @since 6.5.0 + * + * @param array $inner_blocks Parsed inner blocks of a Navigation block. + * @param WP_Post $post `wp_navigation` post object corresponding to the block. + * + * @return array the normalized parsed blocks. + */ + function block_core_navigation_mock_parsed_block($inner_blocks, $post) + { + } + /** + * Insert hooked blocks into a Navigation block. + * + * Given a Navigation block's inner blocks and its corresponding `wp_navigation` post object, + * this function inserts hooked blocks into it, and returns the serialized inner blocks in a + * mock Navigation block wrapper. + * + * If there are any hooked blocks that need to be inserted as the Navigation block's first or last + * children, the `wp_navigation` post's `_wp_ignored_hooked_blocks` meta is checked to see if any + * of those hooked blocks should be exempted from insertion. + * + * @since 6.5.0 + * + * @param array $inner_blocks Parsed inner blocks of a Navigation block. + * @param WP_Post $post `wp_navigation` post object corresponding to the block. + * @return string Serialized inner blocks in mock Navigation block wrapper, with hooked blocks inserted, if any. + */ + function block_core_navigation_insert_hooked_blocks($inner_blocks, $post) + { + } + /** + * Insert ignoredHookedBlocks meta into the Navigation block and its inner blocks. + * + * Given a Navigation block's inner blocks and its corresponding `wp_navigation` post object, + * this function inserts ignoredHookedBlocks meta into it, and returns the serialized inner blocks in a + * mock Navigation block wrapper. + * + * @since 6.5.0 + * + * @param array $inner_blocks Parsed inner blocks of a Navigation block. + * @param WP_Post $post `wp_navigation` post object corresponding to the block. + * @return string Serialized inner blocks in mock Navigation block wrapper, with hooked blocks inserted, if any. + */ + function block_core_navigation_set_ignored_hooked_blocks_metadata($inner_blocks, $post) + { + } + /** + * Updates the post meta with the list of ignored hooked blocks when the navigation is created or updated via the REST API. + * + * @access private + * @since 6.5.0 + * + * @param stdClass $post Post object. + * @return stdClass The updated post object. + */ + function block_core_navigation_update_ignore_hooked_blocks_meta($post) + { + } + /** + * Hooks into the REST API response for the core/navigation block and adds the first and last inner blocks. + * + * @since 6.5.0 + * + * @param WP_REST_Response $response The response object. + * @param WP_Post $post Post object. + * @return WP_REST_Response The response object. + */ + function block_core_navigation_insert_hooked_blocks_into_rest_response($response, $post) + { + } + /** + * Server-side rendering of the `core/page-list-item` block. + * + * @package WordPress + */ + /** + * Registers the `core/page-list-item` block on server. + * + * @since 6.3.0 + */ + function register_block_core_page_list_item() + { + } + /** + * Server-side rendering of the `core/pages` block. + * + * @package WordPress + */ + /** + * Build an array with CSS classes and inline styles defining the colors + * which will be applied to the pages markup in the front-end when it is a descendant of navigation. + * + * @since 5.8.0 + * + * @param array $attributes Block attributes. + * @param array $context Navigation block context. + * @return array Colors CSS classes and inline styles. + */ + function block_core_page_list_build_css_colors($attributes, $context) + { + } + /** + * Build an array with CSS classes and inline styles defining the font sizes + * which will be applied to the pages markup in the front-end when it is a descendant of navigation. + * + * @since 5.8.0 + * + * @param array $context Navigation block context. + * @return array Font size CSS classes and inline styles. + */ + function block_core_page_list_build_css_font_sizes($context) + { + } + /** + * Outputs Page list markup from an array of pages with nested children. + * + * @since 5.8.0 + * + * @param boolean $open_submenus_on_click Whether to open submenus on click instead of hover. + * @param boolean $show_submenu_icons Whether to show submenu indicator icons. + * @param boolean $is_navigation_child If block is a child of Navigation block. + * @param array $nested_pages The array of nested pages. + * @param boolean $is_nested Whether the submenu is nested or not. + * @param array $active_page_ancestor_ids An array of ancestor ids for active page. + * @param array $colors Color information for overlay styles. + * @param integer $depth The nesting depth. + * + * @return string List markup. + */ + function block_core_page_list_render_nested_page_list($open_submenus_on_click, $show_submenu_icons, $is_navigation_child, $nested_pages, $is_nested, $active_page_ancestor_ids = array(), $colors = array(), $depth = 0) + { + } + /** + * Outputs nested array of pages + * + * @since 5.8.0 + * + * @param array $current_level The level being iterated through. + * @param array $children The children grouped by parent post ID. + * + * @return array The nested array of pages. + */ + function block_core_page_list_nest_pages($current_level, $children) + { + } + /** + * Renders the `core/page-list` block on server. + * + * @since 5.8.0 + * + * @param array $attributes The block attributes. + * @param string $content The saved content. + * @param WP_Block $block The parsed block. + * + * @return string Returns the page list markup. + */ + function render_block_core_page_list($attributes, $content, $block) + { + } + /** + * Registers the `core/pages` block on server. + * + * @since 5.8.0 + */ + function register_block_core_page_list() + { + } + /** + * Server-side rendering of the `core/pattern` block. + * + * @package WordPress + */ + /** + * Registers the `core/pattern` block on the server. + * + * @since 5.9.0 + */ + function register_block_core_pattern() + { + } + /** + * Renders the `core/pattern` block on the server. + * + * @since 6.3.0 Backwards compatibility: blocks with no `syncStatus` attribute do not receive block wrapper. + * + * @global WP_Embed $wp_embed Used to process embedded content within patterns + * + * @param array $attributes Block attributes. + * + * @return string Returns the output of the pattern. + */ + function render_block_core_pattern($attributes) + { + } + /** + * Server-side rendering of the `core/post-author-biography` block. + * + * @package WordPress + */ + /** + * Renders the `core/post-author-biography` block on the server. + * + * @since 6.0.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * @return string Returns the rendered post author biography block. + */ + function render_block_core_post_author_biography($attributes, $content, $block) + { + } + /** + * Registers the `core/post-author-biography` block on the server. + * + * @since 6.0.0 + */ + function register_block_core_post_author_biography() + { + } + /** + * Server-side rendering of the `core/post-author-name` block. + * + * @package WordPress + */ + /** + * Renders the `core/post-author-name` block on the server. + * + * @since 6.2.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * @return string Returns the rendered post author name block. + */ + function render_block_core_post_author_name($attributes, $content, $block) + { + } + /** + * Registers the `core/post-author-name` block on the server. + * + * @since 6.2.0 + */ + function register_block_core_post_author_name() + { + } + /** + * Server-side rendering of the `core/post-author` block. + * + * @package WordPress + */ + /** + * Renders the `core/post-author` block on the server. + * + * @since 5.9.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * @return string Returns the rendered author block. + */ + function render_block_core_post_author($attributes, $content, $block) + { + } + /** + * Registers the `core/post-author` block on the server. + * + * @since 5.9.0 + */ + function register_block_core_post_author() + { + } + /** + * Server-side rendering of the `core/post-comments-form` block. + * + * @package WordPress + */ + /** + * Renders the `core/post-comments-form` block on the server. + * + * @since 6.0.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * @return string Returns the filtered post comments form for the current post. + */ + function render_block_core_post_comments_form($attributes, $content, $block) + { + } + /** + * Registers the `core/post-comments-form` block on the server. + * + * @since 6.0.0 + */ + function register_block_core_post_comments_form() + { + } + /** + * Use the button block classes for the form-submit button. + * + * @since 6.0.0 + * + * @param array $fields The default comment form arguments. + * + * @return array Returns the modified fields. + */ + function post_comments_form_block_form_defaults($fields) + { + } + /** + * Server-side rendering of the `core/post-content` block. + * + * @package WordPress + */ + /** + * Renders the `core/post-content` block on the server. + * + * @since 5.8.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * @return string Returns the filtered post content of the current post. + */ + function render_block_core_post_content($attributes, $content, $block) + { + } + /** + * Registers the `core/post-content` block on the server. + * + * @since 5.8.0 + */ + function register_block_core_post_content() + { + } + /** + * Server-side rendering of the `core/post-date` block. + * + * @package WordPress + */ + /** + * Renders the `core/post-date` block on the server. + * + * @since 5.8.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * @return string Returns the filtered post date for the current post wrapped inside "time" tags. + */ + function render_block_core_post_date($attributes, $content, $block) + { + } + /** + * Registers the `core/post-date` block on the server. + * + * @since 5.8.0 + */ + function register_block_core_post_date() + { + } + /** + * Server-side rendering of the `core/post-excerpt` block. + * + * @package WordPress + */ + /** + * Renders the `core/post-excerpt` block on the server. + * + * @since 5.8.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * @return string Returns the filtered post excerpt for the current post wrapped inside "p" tags. + */ + function render_block_core_post_excerpt($attributes, $content, $block) + { + } + /** + * Registers the `core/post-excerpt` block on the server. + * + * @since 5.8.0 + */ + function register_block_core_post_excerpt() + { + } + /** + * Server-side rendering of the `core/post-featured-image` block. + * + * @package WordPress + */ + /** + * Renders the `core/post-featured-image` block on the server. + * + * @since 5.8.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * @return string Returns the featured image for the current post. + */ + function render_block_core_post_featured_image($attributes, $content, $block) + { + } + /** + * Generate markup for the HTML element that will be used for the overlay. + * + * @since 6.1.0 + * + * @param array $attributes Block attributes. + * + * @return string HTML markup in string format. + */ + function get_block_core_post_featured_image_overlay_element_markup($attributes) + { + } + /** + * Generates class names and styles to apply the border support styles for + * the Post Featured Image block. + * + * @since 6.1.0 + * + * @param array $attributes The block attributes. + * @return array The border-related classnames and styles for the block. + */ + function get_block_core_post_featured_image_border_attributes($attributes) + { + } + /** + * Registers the `core/post-featured-image` block on the server. + * + * @since 5.8.0 + */ + function register_block_core_post_featured_image() + { + } + /** + * Server-side rendering of the `core/post-navigation-link` block. + * + * @package WordPress + */ + /** + * Renders the `core/post-navigation-link` block on the server. + * + * @since 5.9.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * + * @return string Returns the next or previous post link that is adjacent to the current post. + */ + function render_block_core_post_navigation_link($attributes, $content) + { + } + /** + * Registers the `core/post-navigation-link` block on the server. + * + * @since 5.9.0 + */ + function register_block_core_post_navigation_link() + { + } + /** + * Server-side rendering of the `core/post-template` block. + * + * @package WordPress + */ + /** + * Determines whether a block list contains a block that uses the featured image. + * + * @since 6.0.0 + * + * @param WP_Block_List $inner_blocks Inner block instance. + * + * @return bool Whether the block list contains a block that uses the featured image. + */ + function block_core_post_template_uses_featured_image($inner_blocks) + { + } + /** + * Renders the `core/post-template` block on the server. + * + * @since 6.3.0 Changed render_block_context priority to `1`. + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * + * @return string Returns the output of the query, structured using the layout defined by the block's inner blocks. + */ + function render_block_core_post_template($attributes, $content, $block) + { + } + /** + * Registers the `core/post-template` block on the server. + * + * @since 5.8.0 + */ + function register_block_core_post_template() + { + } + /** + * Server-side rendering of the `core/post-terms` block. + * + * @package WordPress + */ + /** + * Renders the `core/post-terms` block on the server. + * + * @since 5.8.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * @return string Returns the filtered post terms for the current post wrapped inside "a" tags. + */ + function render_block_core_post_terms($attributes, $content, $block) + { + } + /** + * Returns the available variations for the `core/post-terms` block. + * + * @since 6.5.0 + * + * @return array The available variations for the block. + */ + function block_core_post_terms_build_variations() + { + } + /** + * Registers the `core/post-terms` block on the server. + * + * @since 5.8.0 + */ + function register_block_core_post_terms() + { + } + /** + * Server-side rendering of the `core/post-title` block. + * + * @package WordPress + */ + /** + * Renders the `core/post-title` block on the server. + * + * @since 6.3.0 Omitting the $post argument from the `get_the_title`. + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * + * @return string Returns the filtered post title for the current post wrapped inside "h1" tags. + */ + function render_block_core_post_title($attributes, $content, $block) + { + } + /** + * Registers the `core/post-title` block on the server. + * + * @since 5.8.0 + */ + function register_block_core_post_title() + { + } + /** + * Server-side rendering of the `core/query-no-results` block. + * + * @package WordPress + */ + /** + * Renders the `core/query-no-results` block on the server. + * + * @since 6.0.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * + * @return string Returns the wrapper for the no results block. + */ + function render_block_core_query_no_results($attributes, $content, $block) + { + } + /** + * Registers the `core/query-no-results` block on the server. + * + * @since 6.0.0 + */ + function register_block_core_query_no_results() + { + } + /** + * Server-side rendering of the `core/query-pagination-next` block. + * + * @package WordPress + */ + /** + * Renders the `core/query-pagination-next` block on the server. + * + * @since 5.8.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * + * @return string Returns the next posts link for the query pagination. + */ + function render_block_core_query_pagination_next($attributes, $content, $block) + { + } + /** + * Registers the `core/query-pagination-next` block on the server. + * + * @since 5.8.0 + */ + function register_block_core_query_pagination_next() + { + } + /** + * Server-side rendering of the `core/query-pagination-numbers` block. + * + * @package WordPress + */ + /** + * Renders the `core/query-pagination-numbers` block on the server. + * + * @since 5.8.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * + * @return string Returns the pagination numbers for the Query. + */ + function render_block_core_query_pagination_numbers($attributes, $content, $block) + { + } + /** + * Registers the `core/query-pagination-numbers` block on the server. + * + * @since 5.8.0 + */ + function register_block_core_query_pagination_numbers() + { + } + /** + * Server-side rendering of the `core/query-pagination-previous` block. + * + * @package WordPress + */ + /** + * Renders the `core/query-pagination-previous` block on the server. + * + * @since 5.8.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * + * @return string Returns the previous posts link for the query. + */ + function render_block_core_query_pagination_previous($attributes, $content, $block) + { + } + /** + * Registers the `core/query-pagination-previous` block on the server. + * + * @since 5.8.0 + */ + function register_block_core_query_pagination_previous() + { + } + /** + * Server-side rendering of the `core/query-pagination` block. + * + * @package WordPress + */ + /** + * Renders the `core/query-pagination` block on the server. + * + * @since 5.9.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * + * @return string Returns the wrapper for the Query pagination. + */ + function render_block_core_query_pagination($attributes, $content) + { + } + /** + * Registers the `core/query-pagination` block on the server. + * + * @since 5.8.0 + */ + function register_block_core_query_pagination() + { + } + /** + * Server-side rendering of the `core/query-title` block. + * + * @package WordPress + */ + /** + * Renders the `core/query-title` block on the server. + * For now it only supports Archive title, + * using queried object information + * + * @since 5.8.0 + * + * @param array $attributes Block attributes. + * + * @return string Returns the query title based on the queried object. + */ + function render_block_core_query_title($attributes) + { + } + /** + * Registers the `core/query-title` block on the server. + * + * @since 5.8.0 + */ + function register_block_core_query_title() + { + } + /** + * Server-side rendering of the `core/query` block. + * + * @package WordPress + */ + /** + * Modifies the static `core/query` block on the server. + * + * @since 6.4.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block The block instance. + * + * @return string Returns the modified output of the query block. + */ + function render_block_core_query($attributes, $content, $block) + { + } + /** + * Registers the `core/query` block on the server. + * + * @since 5.8.0 + */ + function register_block_core_query() + { + } + /** + * Traverse the tree of blocks looking for any plugin block (i.e., a block from + * an installed plugin) inside a Query block with the enhanced pagination + * enabled. If at least one is found, the enhanced pagination is effectively + * disabled to prevent any potential incompatibilities. + * + * @since 6.4.0 + * + * @param array $parsed_block The block being rendered. + * @return string Returns the parsed block, unmodified. + */ + function block_core_query_disable_enhanced_pagination($parsed_block) + { + } + /** + * Server-side rendering of the `core/read-more` block. + * + * @package WordPress + */ + /** + * Renders the `core/read-more` block on the server. + * + * @since 6.0.0 + * + * @param array $attributes Block attributes. + * @param string $content Block default content. + * @param WP_Block $block Block instance. + * @return string Returns the post link. + */ + function render_block_core_read_more($attributes, $content, $block) + { + } + /** + * Registers the `core/read-more` block on the server. + * + * @since 6.0.0 + */ + function register_block_core_read_more() + { + } + /** + * Server-side rendering of the `core/rss` block. + * + * @package WordPress + */ + /** + * Renders the `core/rss` block on server. + * + * @since 5.2.0 + * + * @param array $attributes The block attributes. + * + * @return string Returns the block content with received rss items. + */ + function render_block_core_rss($attributes) + { + } + /** + * Registers the `core/rss` block on server. + * + * @since 5.2.0 + */ + function register_block_core_rss() + { + } + /** + * Server-side rendering of the `core/search` block. + * + * @package WordPress + */ + /** + * Dynamically renders the `core/search` block. + * + * @since 6.3.0 Using block.json `viewScript` to register script, and update `view_script_handles()` only when needed. + * + * @param array $attributes The block attributes. + * @param string $content The saved content. + * @param WP_Block $block The parsed block. + * + * @return string The search block markup. + */ + function render_block_core_search($attributes) + { + } + /** + * Registers the `core/search` block on the server. + * + * @since 5.2.0 + */ + function register_block_core_search() + { + } + /** + * Builds the correct top level classnames for the 'core/search' block. + * + * @since 5.6.0 + * + * @param array $attributes The block attributes. + * + * @return string The classnames used in the block. + */ + function classnames_for_block_core_search($attributes) + { + } + /** + * This generates a CSS rule for the given border property and side if provided. + * Based on whether the Search block is configured to display the button inside + * or not, the generated rule is injected into the appropriate collection of + * styles for later application in the block's markup. + * + * @since 6.1.0 + * + * @param array $attributes The block attributes. + * @param string $property Border property to generate rule for e.g. width or color. + * @param string $side Optional side border. The dictates the value retrieved and final CSS property. + * @param array $wrapper_styles Current collection of wrapper styles. + * @param array $button_styles Current collection of button styles. + * @param array $input_styles Current collection of input styles. + * @phpstan-return void + */ + function apply_block_core_search_border_style($attributes, $property, $side, &$wrapper_styles, &$button_styles, &$input_styles) + { + } + /** + * This adds CSS rules for a given border property e.g. width or color. It + * injects rules into the provided wrapper, button and input style arrays for + * uniform "flat" borders or those with individual sides configured. + * + * @since 6.1.0 + * + * @param array $attributes The block attributes. + * @param string $property Border property to generate rule for e.g. width or color. + * @param array $wrapper_styles Current collection of wrapper styles. + * @param array $button_styles Current collection of button styles. + * @param array $input_styles Current collection of input styles. + */ + function apply_block_core_search_border_styles($attributes, $property, &$wrapper_styles, &$button_styles, &$input_styles) + { + } + /** + * Builds an array of inline styles for the search block. + * + * The result will contain one entry for shared styles such as those for the + * inner input or button and a second for the inner wrapper should the block + * be positioning the button "inside". + * + * @since 5.8.0 + * + * @param array $attributes The block attributes. + * + * @return array Style HTML attribute. + */ + function styles_for_block_core_search($attributes) + { + } + /** + * Returns typography classnames depending on whether there are named font sizes/families. + * + * @since 6.1.0 + * + * @param array $attributes The block attributes. + * + * @return string The typography color classnames to be applied to the block elements. + */ + function get_typography_classes_for_block_core_search($attributes) + { + } + /** + * Returns typography styles to be included in an HTML style tag. + * This excludes text-decoration, which is applied only to the label and button elements of the search block. + * + * @since 6.1.0 + * + * @param array $attributes The block attributes. + * + * @return string A string of typography CSS declarations. + */ + function get_typography_styles_for_block_core_search($attributes) + { + } + /** + * Returns border color classnames depending on whether there are named or custom border colors. + * + * @since 5.9.0 + * + * @param array $attributes The block attributes. + * + * @return string The border color classnames to be applied to the block elements. + */ + function get_border_color_classes_for_block_core_search($attributes) + { + } + /** + * Returns color classnames depending on whether there are named or custom text and background colors. + * + * @since 5.9.0 + * + * @param array $attributes The block attributes. + * + * @return string The color classnames to be applied to the block elements. + */ + function get_color_classes_for_block_core_search($attributes) + { + } + /** + * Server-side rendering of the `core/shortcode` block. + * + * @package WordPress + */ + /** + * Performs wpautop() on the shortcode block content. + * + * @since 5.0.0 + * + * @param array $attributes The block attributes. + * @param string $content The block content. + * + * @return string Returns the block content. + */ + function render_block_core_shortcode($attributes, $content) + { + } + /** + * Registers the `core/shortcode` block on server. + * + * @since 5.0.0 + */ + function register_block_core_shortcode() + { + } + /** + * Server-side rendering of the `core/site-logo` block. + * + * @package WordPress + */ + /** + * Renders the `core/site-logo` block on the server. + * + * @since 5.8.0 + * + * @param array $attributes The block attributes. + * + * @return string The render. + */ + function render_block_core_site_logo($attributes) + { + } + /** + * Register a core site setting for a site logo + * + * @since 5.8.0 + */ + function register_block_core_site_logo_setting() + { + } + /** + * Register a core site setting for a site icon + * + * @since 5.9.0 + */ + function register_block_core_site_icon_setting() + { + } + /** + * Registers the `core/site-logo` block on the server. + * + * @since 5.8.0 + */ + function register_block_core_site_logo() + { + } + /** + * Overrides the custom logo with a site logo, if the option is set. + * + * @since 5.8.0 + * + * @param string $custom_logo The custom logo set by a theme. + * + * @return string The site logo if set. + */ + function _override_custom_logo_theme_mod($custom_logo) + { + } + /** + * Updates the site_logo option when the custom_logo theme-mod gets updated. + * + * @since 5.8.0 + * + * @param mixed $value Attachment ID of the custom logo or an empty value. + * @return mixed + */ + function _sync_custom_logo_to_site_logo($value) + { + } + /** + * Deletes the site_logo when the custom_logo theme mod is removed. + * + * @since 5.8.0 + * + * @param array $old_value Previous theme mod settings. + * @param array $value Updated theme mod settings. + * @phpstan-return void + */ + function _delete_site_logo_on_remove_custom_logo($old_value, $value) + { + } + /** + * Deletes the site logo when all theme mods are being removed. + * + * @since 5.8.0 + * @phpstan-return void + */ + function _delete_site_logo_on_remove_theme_mods() + { + } + /** + * Hooks `_delete_site_logo_on_remove_custom_logo` in `update_option_theme_mods_$theme`. + * Hooks `_delete_site_logo_on_remove_theme_mods` in `delete_option_theme_mods_$theme`. + * + * Runs on `setup_theme` to account for dynamically-switched themes in the Customizer. + * + * @since 5.8.0 + */ + function _delete_site_logo_on_remove_custom_logo_on_setup_theme() + { + } + /** + * Removes the custom_logo theme-mod when the site_logo option gets deleted. + * + * @since 5.9.0 + */ + function _delete_custom_logo_on_remove_site_logo() + { + } + /** + * Server-side rendering of the `core/site-tagline` block. + * + * @package WordPress + */ + /** + * Renders the `core/site-tagline` block on the server. + * + * @since 5.8.0 + * + * @param array $attributes The block attributes. + * + * @return string The render. + */ + function render_block_core_site_tagline($attributes) + { + } + /** + * Registers the `core/site-tagline` block on the server. + * + * @since 5.8.0 + */ + function register_block_core_site_tagline() + { + } + /** + * Server-side rendering of the `core/site-title` block. + * + * @package WordPress + */ + /** + * Renders the `core/site-title` block on the server. + * + * @since 5.8.0 + * + * @param array $attributes The block attributes. + * + * @return string The render. + */ + function render_block_core_site_title($attributes) + { + } + /** + * Registers the `core/site-title` block on the server. + * + * @since 5.8.0 + */ + function register_block_core_site_title() + { + } + /** + * Server-side rendering of the `core/social-link` blocks. + * + * @package WordPress + */ + /** + * Renders the `core/social-link` block on server. + * + * @since 5.4.0 + * + * @param Array $attributes The block attributes. + * @param String $content InnerBlocks content of the Block. + * @param WP_Block $block Block object. + * + * @return string Rendered HTML of the referenced block. + */ + function render_block_core_social_link($attributes, $content, $block) + { + } + /** + * Registers the `core/social-link` blocks. + * + * @since 5.4.0 + */ + function register_block_core_social_link() + { + } + /** + * Returns the SVG for social link. + * + * @since 5.4.0 + * + * @param string $service The service icon. + * + * @return string SVG Element for service icon. + */ + function block_core_social_link_get_icon($service) + { + } + /** + * Returns the brand name for social link. + * + * @since 5.4.0 + * + * @param string $service The service icon. + * + * @return string Brand label. + */ + function block_core_social_link_get_name($service) + { + } + /** + * Returns the SVG for social link. + * + * @since 5.4.0 + * + * @param string $service The service slug to extract data from. + * @param string $field The field ('name', 'icon', etc) to extract for a service. + * + * @return array|string + */ + function block_core_social_link_services($service = '', $field = '') + { + } + /** + * Returns CSS styles for icon and icon background colors. + * + * @since 5.7.0 + * + * @param array $context Block context passed to Social Link. + * + * @return string Inline CSS styles for link's icon and background colors. + */ + function block_core_social_link_get_color_styles($context) + { + } + /** + * Returns CSS classes for icon and icon background colors. + * + * @since 6.3.0 + * + * @param array $context Block context passed to Social Sharing Link. + * + * @return string CSS classes for link's icon and background colors. + */ + function block_core_social_link_get_color_classes($context) + { + } + /** + * Server-side rendering of the `core/tag-cloud` block. + * + * @package WordPress + */ + /** + * Renders the `core/tag-cloud` block on server. + * + * @since 5.2.0 + * + * @param array $attributes The block attributes. + * + * @return string Returns the tag cloud for selected taxonomy. + */ + function render_block_core_tag_cloud($attributes) + { + } + /** + * Registers the `core/tag-cloud` block on server. + * + * @since 5.2.0 + */ + function register_block_core_tag_cloud() + { + } + /** + * Server-side rendering of the `core/template-part` block. + * + * @package WordPress + */ + /** + * Renders the `core/template-part` block on the server. + * + * @since 5.9.0 + * + * @global WP_Embed $wp_embed WordPress Embed object. + * + * @param array $attributes The block attributes. + * + * @return string The render. + */ + function render_block_core_template_part($attributes) + { + } + /** + * Returns an array of area variation objects for the template part block. + * + * @since 6.1.0 + * + * @param array $instance_variations The variations for instances. + * + * @return array Array containing the block variation objects. + */ + function build_template_part_block_area_variations($instance_variations) + { + } + /** + * Returns an array of instance variation objects for the template part block + * + * @since 6.1.0 + * + * @return array Array containing the block variation objects. + */ + function build_template_part_block_instance_variations() + { + } + /** + * Returns an array of all template part block variations. + * + * @since 5.9.0 + * + * @return array Array containing the block variation objects. + */ + function build_template_part_block_variations() + { + } + /** + * Registers the `core/template-part` block on the server. + * + * @since 5.9.0 + */ + function register_block_core_template_part() + { + } + /** + * Server-side rendering of the `core/term-description` block. + * + * @package WordPress + */ + /** + * Renders the `core/term-description` block on the server. + * + * @since 5.9.0 + * + * @param array $attributes Block attributes. + * + * @return string Returns the description of the current taxonomy term, if available + */ + function render_block_core_term_description($attributes) + { + } + /** + * Registers the `core/term-description` block on the server. + * + * @since 5.9.0 + */ + function register_block_core_term_description() + { + } + /** + * Server-side rendering of the `core/widget-group` block. + * + * @package WordPress + */ + /** + * Renders the 'core/widget-group' block. + * + * @since 5.9.0 + * + * @global array $wp_registered_sidebars + * @global int|string $_sidebar_being_rendered + * + * @param array $attributes The block attributes. + * @param string $content The block content. + * @param WP_Block $block The block. + * + * @return string Rendered block. + */ + function render_block_core_widget_group($attributes, $content, $block) + { + } + /** + * Registers the 'core/widget-group' block. + * + * @since 5.9.0 + */ + function register_block_core_widget_group() + { + } + /** + * Make a note of the sidebar being rendered before WordPress starts rendering + * it. This lets us get to the current sidebar in + * render_block_core_widget_group(). + * + * @since 5.9.0 + * + * @global int|string $_sidebar_being_rendered + * + * @param int|string $index Index, name, or ID of the dynamic sidebar. + */ + function note_sidebar_being_rendered($index) + { + } + /** + * Clear whatever we set in note_sidebar_being_rendered() after WordPress + * finishes rendering a sidebar. + * + * @since 5.9.0 + * + * @global int|string $_sidebar_being_rendered + */ + function discard_sidebar_being_rendered() + { + } + /** + * Bookmark Template Functions for usage in Themes. + * + * @package WordPress + * @subpackage Template + */ + /** + * The formatted output of a list of bookmarks. + * + * The $bookmarks array must contain bookmark objects and will be iterated over + * to retrieve the bookmark to be used in the output. + * + * The output is formatted as HTML with no way to change that format. However, + * what is between, before, and after can be changed. The link itself will be + * HTML. + * + * This function is used internally by wp_list_bookmarks() and should not be + * used by themes. + * + * @since 2.1.0 + * @access private + * + * @param array $bookmarks List of bookmarks to traverse. + * @param string|array $args { + * Optional. Bookmarks arguments. + * + * @type int|bool $show_updated Whether to show the time the bookmark was last updated. + * Accepts 1|true or 0|false. Default 0|false. + * @type int|bool $show_description Whether to show the bookmark description. Accepts 1|true, + * Accepts 1|true or 0|false. Default 0|false. + * @type int|bool $show_images Whether to show the link image if available. Accepts 1|true + * or 0|false. Default 1|true. + * @type int|bool $show_name Whether to show link name if available. Accepts 1|true or + * 0|false. Default 0|false. + * @type string $before The HTML or text to prepend to each bookmark. Default `<li>`. + * @type string $after The HTML or text to append to each bookmark. Default `</li>`. + * @type string $link_before The HTML or text to prepend to each bookmark inside the anchor + * tags. Default empty. + * @type string $link_after The HTML or text to append to each bookmark inside the anchor + * tags. Default empty. + * @type string $between The string for use in between the link, description, and image. + * Default "\n". + * @type int|bool $show_rating Whether to show the link rating. Accepts 1|true or 0|false. + * Default 0|false. + * + * } + * @return string Formatted output in HTML + * @phpstan-param array{ + * show_updated?: int|bool, + * show_description?: int|bool, + * show_images?: int|bool, + * show_name?: int|bool, + * before?: string, + * after?: string, + * link_before?: string, + * link_after?: string, + * between?: string, + * show_rating?: int|bool, + * } $args + */ + function _walk_bookmarks($bookmarks, $args = '') + { + } + /** + * Retrieves or echoes all of the bookmarks. + * + * List of default arguments are as follows: + * + * These options define how the Category name will appear before the category + * links are displayed, if 'categorize' is 1. If 'categorize' is 0, then it will + * display for only the 'title_li' string and only if 'title_li' is not empty. + * + * @since 2.1.0 + * + * @see _walk_bookmarks() + * + * @param string|array $args { + * Optional. String or array of arguments to list bookmarks. + * + * @type string $orderby How to order the links by. Accepts post fields. Default 'name'. + * @type string $order Whether to order bookmarks in ascending or descending order. + * Accepts 'ASC' (ascending) or 'DESC' (descending). Default 'ASC'. + * @type int $limit Amount of bookmarks to display. Accepts 1+ or -1 for all. + * Default -1. + * @type string $category Comma-separated list of category IDs to include links from. + * Default empty. + * @type string $category_name Category to retrieve links for by name. Default empty. + * @type int|bool $hide_invisible Whether to show or hide links marked as 'invisible'. Accepts + * 1|true or 0|false. Default 1|true. + * @type int|bool $show_updated Whether to display the time the bookmark was last updated. + * Accepts 1|true or 0|false. Default 0|false. + * @type int|bool $echo Whether to echo or return the formatted bookmarks. Accepts + * 1|true (echo) or 0|false (return). Default 1|true. + * @type int|bool $categorize Whether to show links listed by category or in a single column. + * Accepts 1|true (by category) or 0|false (one column). Default 1|true. + * @type int|bool $show_description Whether to show the bookmark descriptions. Accepts 1|true or 0|false. + * Default 0|false. + * @type string $title_li What to show before the links appear. Default 'Bookmarks'. + * @type string $title_before The HTML or text to prepend to the $title_li string. Default '<h2>'. + * @type string $title_after The HTML or text to append to the $title_li string. Default '</h2>'. + * @type string|array $class The CSS class or an array of classes to use for the $title_li. + * Default 'linkcat'. + * @type string $category_before The HTML or text to prepend to $title_before if $categorize is true. + * String must contain '%id' and '%class' to inherit the category ID and + * the $class argument used for formatting in themes. + * Default '<li id="%id" class="%class">'. + * @type string $category_after The HTML or text to append to $title_after if $categorize is true. + * Default '</li>'. + * @type string $category_orderby How to order the bookmark category based on term scheme if $categorize + * is true. Default 'name'. + * @type string $category_order Whether to order categories in ascending or descending order if + * $categorize is true. Accepts 'ASC' (ascending) or 'DESC' (descending). + * Default 'ASC'. + * } + * @return void|string Void if 'echo' argument is true, HTML list of bookmarks if 'echo' is false. + * @phpstan-param array{ + * orderby?: string, + * order?: string, + * limit?: int, + * category?: string, + * category_name?: string, + * hide_invisible?: int|bool, + * show_updated?: int|bool, + * echo?: int|bool, + * categorize?: int|bool, + * show_description?: int|bool, + * title_li?: string, + * title_before?: string, + * title_after?: string, + * class?: string|array, + * category_before?: string, + * category_after?: string, + * category_orderby?: string, + * category_order?: string, + * } $args + */ + function wp_list_bookmarks($args = '') + { + } + /** + * Link/Bookmark API + * + * @package WordPress + * @subpackage Bookmark + */ + /** + * Retrieves bookmark data. + * + * @since 2.1.0 + * + * @global object $link Current link object. + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int|stdClass $bookmark + * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which + * correspond to an stdClass object, an associative array, or a numeric array, + * respectively. Default OBJECT. + * @param string $filter Optional. How to sanitize bookmark fields. Default 'raw'. + * @return array|object|null Type returned depends on $output value. + * @phpstan-param 'OBJECT'|'ARRAY_A'|'ARRAY_N' $output + * @phpstan-return null|($output is 'ARRAY_A' ? array<string, mixed> : ($output is 'ARRAY_N' ? array<int, mixed> : \stdClass)) + */ + function get_bookmark($bookmark, $output = \OBJECT, $filter = 'raw') + { + } + /** + * Retrieves single bookmark data item or field. + * + * @since 2.3.0 + * + * @param string $field The name of the data field to return. + * @param int $bookmark The bookmark ID to get field. + * @param string $context Optional. The context of how the field will be used. Default 'display'. + * @return string|WP_Error + */ + function get_bookmark_field($field, $bookmark, $context = 'display') + { + } + /** + * Retrieves the list of bookmarks. + * + * Attempts to retrieve from the cache first based on MD5 hash of arguments. If + * that fails, then the query will be built from the arguments and executed. The + * results will be stored to the cache. + * + * @since 2.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string|array $args { + * Optional. String or array of arguments to retrieve bookmarks. + * + * @type string $orderby How to order the links by. Accepts 'id', 'link_id', 'name', 'link_name', + * 'url', 'link_url', 'visible', 'link_visible', 'rating', 'link_rating', + * 'owner', 'link_owner', 'updated', 'link_updated', 'notes', 'link_notes', + * 'description', 'link_description', 'length' and 'rand'. + * When `$orderby` is 'length', orders by the character length of + * 'link_name'. Default 'name'. + * @type string $order Whether to order bookmarks in ascending or descending order. + * Accepts 'ASC' (ascending) or 'DESC' (descending). Default 'ASC'. + * @type int $limit Amount of bookmarks to display. Accepts any positive number or + * -1 for all. Default -1. + * @type string $category Comma-separated list of category IDs to include links from. + * Default empty. + * @type string $category_name Category to retrieve links for by name. Default empty. + * @type int|bool $hide_invisible Whether to show or hide links marked as 'invisible'. Accepts + * 1|true or 0|false. Default 1|true. + * @type int|bool $show_updated Whether to display the time the bookmark was last updated. + * Accepts 1|true or 0|false. Default 0|false. + * @type string $include Comma-separated list of bookmark IDs to include. Default empty. + * @type string $exclude Comma-separated list of bookmark IDs to exclude. Default empty. + * @type string $search Search terms. Will be SQL-formatted with wildcards before and after + * and searched in 'link_url', 'link_name' and 'link_description'. + * Default empty. + * } + * @return object[] List of bookmark row objects. + * @phpstan-param array{ + * orderby?: string, + * order?: string, + * limit?: int, + * category?: string, + * category_name?: string, + * hide_invisible?: int|bool, + * show_updated?: int|bool, + * include?: string, + * exclude?: string, + * search?: string, + * } $args + */ + function get_bookmarks($args = '') + { + } + /** + * Sanitizes all bookmark fields. + * + * @since 2.3.0 + * + * @param stdClass|array $bookmark Bookmark row. + * @param string $context Optional. How to filter the fields. Default 'display'. + * @return stdClass|array Same type as $bookmark but with fields sanitized. + */ + function sanitize_bookmark($bookmark, $context = 'display') + { + } + /** + * Sanitizes a bookmark field. + * + * Sanitizes the bookmark fields based on what the field name is. If the field + * has a strict value set, then it will be tested for that, else a more generic + * filtering is applied. After the more strict filter is applied, if the `$context` + * is 'raw' then the value is immediately return. + * + * Hooks exist for the more generic cases. With the 'edit' context, the {@see 'edit_$field'} + * filter will be called and passed the `$value` and `$bookmark_id` respectively. + * + * With the 'db' context, the {@see 'pre_$field'} filter is called and passed the value. + * The 'display' context is the final context and has the `$field` has the filter name + * and is passed the `$value`, `$bookmark_id`, and `$context`, respectively. + * + * @since 2.3.0 + * + * @param string $field The bookmark field. + * @param mixed $value The bookmark field value. + * @param int $bookmark_id Bookmark ID. + * @param string $context How to filter the field value. Accepts 'raw', 'edit', 'db', + * 'display', 'attribute', or 'js'. Default 'display'. + * @return mixed The filtered value. + * @phpstan-param 'raw'|'edit'|'db'|'display'|'attribute'|'js' $context + */ + function sanitize_bookmark_field($field, $value, $bookmark_id, $context) + { + } + /** + * Deletes the bookmark cache. + * + * @since 2.7.0 + * + * @param int $bookmark_id Bookmark ID. + */ + function clean_bookmark_cache($bookmark_id) + { + } + /** + * Sets up Object Cache Global and assigns it. + * + * @since 2.0.0 + * + * @global WP_Object_Cache $wp_object_cache + */ + function wp_cache_init() + { + } + /** + * Adds data to the cache, if the cache key doesn't already exist. + * + * @since 2.0.0 + * + * @see WP_Object_Cache::add() + * @global WP_Object_Cache $wp_object_cache Object cache global instance. + * + * @param int|string $key The cache key to use for retrieval later. + * @param mixed $data The data to add to the cache. + * @param string $group Optional. The group to add the cache to. Enables the same key + * to be used across groups. Default empty. + * @param int $expire Optional. When the cache data should expire, in seconds. + * Default 0 (no expiration). + * @return bool True on success, false if cache key and group already exist. + */ + function wp_cache_add($key, $data, $group = '', $expire = 0) + { + } + /** + * Adds multiple values to the cache in one call. + * + * @since 6.0.0 + * + * @see WP_Object_Cache::add_multiple() + * @global WP_Object_Cache $wp_object_cache Object cache global instance. + * + * @param array $data Array of keys and values to be set. + * @param string $group Optional. Where the cache contents are grouped. Default empty. + * @param int $expire Optional. When to expire the cache contents, in seconds. + * Default 0 (no expiration). + * @return bool[] Array of return values, grouped by key. Each value is either + * true on success, or false if cache key and group already exist. + */ + function wp_cache_add_multiple(array $data, $group = '', $expire = 0) + { + } + /** + * Replaces the contents of the cache with new data. + * + * @since 2.0.0 + * + * @see WP_Object_Cache::replace() + * @global WP_Object_Cache $wp_object_cache Object cache global instance. + * + * @param int|string $key The key for the cache data that should be replaced. + * @param mixed $data The new data to store in the cache. + * @param string $group Optional. The group for the cache data that should be replaced. + * Default empty. + * @param int $expire Optional. When to expire the cache contents, in seconds. + * Default 0 (no expiration). + * @return bool True if contents were replaced, false if original value does not exist. + */ + function wp_cache_replace($key, $data, $group = '', $expire = 0) + { + } + /** + * Saves the data to the cache. + * + * Differs from wp_cache_add() and wp_cache_replace() in that it will always write data. + * + * @since 2.0.0 + * + * @see WP_Object_Cache::set() + * @global WP_Object_Cache $wp_object_cache Object cache global instance. + * + * @param int|string $key The cache key to use for retrieval later. + * @param mixed $data The contents to store in the cache. + * @param string $group Optional. Where to group the cache contents. Enables the same key + * to be used across groups. Default empty. + * @param int $expire Optional. When to expire the cache contents, in seconds. + * Default 0 (no expiration). + * @return bool True on success, false on failure. + */ + function wp_cache_set($key, $data, $group = '', $expire = 0) + { + } + /** + * Sets multiple values to the cache in one call. + * + * @since 6.0.0 + * + * @see WP_Object_Cache::set_multiple() + * @global WP_Object_Cache $wp_object_cache Object cache global instance. + * + * @param array $data Array of keys and values to be set. + * @param string $group Optional. Where the cache contents are grouped. Default empty. + * @param int $expire Optional. When to expire the cache contents, in seconds. + * Default 0 (no expiration). + * @return bool[] Array of return values, grouped by key. Each value is either + * true on success, or false on failure. + */ + function wp_cache_set_multiple(array $data, $group = '', $expire = 0) + { + } + /** + * Retrieves the cache contents from the cache by key and group. + * + * @since 2.0.0 + * + * @see WP_Object_Cache::get() + * @global WP_Object_Cache $wp_object_cache Object cache global instance. + * + * @param int|string $key The key under which the cache contents are stored. + * @param string $group Optional. Where the cache contents are grouped. Default empty. + * @param bool $force Optional. Whether to force an update of the local cache + * from the persistent cache. Default false. + * @param bool $found Optional. Whether the key was found in the cache (passed by reference). + * Disambiguates a return of false, a storable value. Default null. + * @return mixed|false The cache contents on success, false on failure to retrieve contents. + */ + function wp_cache_get($key, $group = '', $force = \false, &$found = \null) + { + } + /** + * Retrieves multiple values from the cache in one call. + * + * @since 5.5.0 + * + * @see WP_Object_Cache::get_multiple() + * @global WP_Object_Cache $wp_object_cache Object cache global instance. + * + * @param array $keys Array of keys under which the cache contents are stored. + * @param string $group Optional. Where the cache contents are grouped. Default empty. + * @param bool $force Optional. Whether to force an update of the local cache + * from the persistent cache. Default false. + * @return array Array of return values, grouped by key. Each value is either + * the cache contents on success, or false on failure. + */ + function wp_cache_get_multiple($keys, $group = '', $force = \false) + { + } + /** + * Removes the cache contents matching key and group. + * + * @since 2.0.0 + * + * @see WP_Object_Cache::delete() + * @global WP_Object_Cache $wp_object_cache Object cache global instance. + * + * @param int|string $key What the contents in the cache are called. + * @param string $group Optional. Where the cache contents are grouped. Default empty. + * @return bool True on successful removal, false on failure. + */ + function wp_cache_delete($key, $group = '') + { + } + /** + * Deletes multiple values from the cache in one call. + * + * @since 6.0.0 + * + * @see WP_Object_Cache::delete_multiple() + * @global WP_Object_Cache $wp_object_cache Object cache global instance. + * + * @param array $keys Array of keys under which the cache to deleted. + * @param string $group Optional. Where the cache contents are grouped. Default empty. + * @return bool[] Array of return values, grouped by key. Each value is either + * true on success, or false if the contents were not deleted. + */ + function wp_cache_delete_multiple(array $keys, $group = '') + { + } + /** + * Increments numeric cache item's value. + * + * @since 3.3.0 + * + * @see WP_Object_Cache::incr() + * @global WP_Object_Cache $wp_object_cache Object cache global instance. + * + * @param int|string $key The key for the cache contents that should be incremented. + * @param int $offset Optional. The amount by which to increment the item's value. + * Default 1. + * @param string $group Optional. The group the key is in. Default empty. + * @return int|false The item's new value on success, false on failure. + */ + function wp_cache_incr($key, $offset = 1, $group = '') + { + } + /** + * Decrements numeric cache item's value. + * + * @since 3.3.0 + * + * @see WP_Object_Cache::decr() + * @global WP_Object_Cache $wp_object_cache Object cache global instance. + * + * @param int|string $key The cache key to decrement. + * @param int $offset Optional. The amount by which to decrement the item's value. + * Default 1. + * @param string $group Optional. The group the key is in. Default empty. + * @return int|false The item's new value on success, false on failure. + */ + function wp_cache_decr($key, $offset = 1, $group = '') + { + } + /** + * Removes all cache items. + * + * @since 2.0.0 + * + * @see WP_Object_Cache::flush() + * @global WP_Object_Cache $wp_object_cache Object cache global instance. + * + * @return bool True on success, false on failure. + */ + function wp_cache_flush() + { + } + /** + * Removes all cache items from the in-memory runtime cache. + * + * @since 6.0.0 + * + * @see WP_Object_Cache::flush() + * + * @return bool True on success, false on failure. + */ + function wp_cache_flush_runtime() + { + } + /** + * Removes all cache items in a group, if the object cache implementation supports it. + * + * Before calling this function, always check for group flushing support using the + * `wp_cache_supports( 'flush_group' )` function. + * + * @since 6.1.0 + * + * @see WP_Object_Cache::flush_group() + * @global WP_Object_Cache $wp_object_cache Object cache global instance. + * + * @param string $group Name of group to remove from cache. + * @return bool True if group was flushed, false otherwise. + */ + function wp_cache_flush_group($group) + { + } + /** + * Determines whether the object cache implementation supports a particular feature. + * + * @since 6.1.0 + * + * @param string $feature Name of the feature to check for. Possible values include: + * 'add_multiple', 'set_multiple', 'get_multiple', 'delete_multiple', + * 'flush_runtime', 'flush_group'. + * @return bool True if the feature is supported, false otherwise. + */ + function wp_cache_supports($feature) + { + } + /** + * Closes the cache. + * + * This function has ceased to do anything since WordPress 2.5. The + * functionality was removed along with the rest of the persistent cache. + * + * This does not mean that plugins can't implement this function when they need + * to make sure that the cache is cleaned up after WordPress no longer needs it. + * + * @since 2.0.0 + * + * @return true Always returns true. + */ + function wp_cache_close() + { + } + /** + * Adds a group or set of groups to the list of global groups. + * + * @since 2.6.0 + * + * @see WP_Object_Cache::add_global_groups() + * @global WP_Object_Cache $wp_object_cache Object cache global instance. + * + * @param string|string[] $groups A group or an array of groups to add. + */ + function wp_cache_add_global_groups($groups) + { + } + /** + * Adds a group or set of groups to the list of non-persistent groups. + * + * @since 2.6.0 + * + * @param string|string[] $groups A group or an array of groups to add. + */ + function wp_cache_add_non_persistent_groups($groups) + { + } + /** + * Switches the internal blog ID. + * + * This changes the blog id used to create keys in blog specific groups. + * + * @since 3.5.0 + * + * @see WP_Object_Cache::switch_to_blog() + * @global WP_Object_Cache $wp_object_cache Object cache global instance. + * + * @param int $blog_id Site ID. + */ + function wp_cache_switch_to_blog($blog_id) + { + } + /** + * Resets internal cache keys and structures. + * + * If the cache back end uses global blog or site IDs as part of its cache keys, + * this function instructs the back end to reset those keys and perform any cleanup + * since blog or site IDs have changed since cache init. + * + * This function is deprecated. Use wp_cache_switch_to_blog() instead of this + * function when preparing the cache for a blog switch. For clearing the cache + * during unit tests, consider using wp_cache_init(). wp_cache_init() is not + * recommended outside of unit tests as the performance penalty for using it is high. + * + * @since 3.0.0 + * @deprecated 3.5.0 Use wp_cache_switch_to_blog() + * @see WP_Object_Cache::reset() + * + * @global WP_Object_Cache $wp_object_cache Object cache global instance. + */ + function wp_cache_reset() + { + } + /** + * Canonical API to handle WordPress Redirecting + * + * Based on "Permalink Redirect" from Scott Yang and "Enforce www. Preference" + * by Mark Jaquith + * + * @package WordPress + * @since 2.3.0 + */ + /** + * Redirects incoming links to the proper URL based on the site url. + * + * Search engines consider www.somedomain.com and somedomain.com to be two + * different URLs when they both go to the same location. This SEO enhancement + * prevents penalty for duplicate content by redirecting all incoming links to + * one or the other. + * + * Prevents redirection for feeds, trackbacks, searches, and + * admin URLs. Does not redirect on non-pretty-permalink-supporting IIS 7+, + * page/post previews, WP admin, Trackbacks, robots.txt, favicon.ico, searches, + * or on POST requests. + * + * Will also attempt to find the correct link when a user enters a URL that does + * not exist based on exact WordPress query. Will instead try to parse the URL + * or query in an attempt to figure the correct page to go to. + * + * @since 2.3.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * @global bool $is_IIS + * @global WP_Query $wp_query WordPress Query object. + * @global wpdb $wpdb WordPress database abstraction object. + * @global WP $wp Current WordPress environment instance. + * + * @param string $requested_url Optional. The URL that was requested, used to + * figure if redirect is needed. + * @param bool $do_redirect Optional. Redirect to the new URL. + * @return string|void The string of the URL, if redirect needed. + */ + function redirect_canonical($requested_url = \null, $do_redirect = \true) + { + } + /** + * Removes arguments from a query string if they are not present in a URL + * DO NOT use this in plugin code. + * + * @since 3.4.0 + * @access private + * + * @param string $query_string + * @param array $args_to_check + * @param string $url + * @return string The altered query string + */ + function _remove_qs_args_if_not_in_url($query_string, array $args_to_check, $url) + { + } + /** + * Strips the #fragment from a URL, if one is present. + * + * @since 4.4.0 + * + * @param string $url The URL to strip. + * @return string The altered URL. + */ + function strip_fragment_from_url($url) + { + } + /** + * Attempts to guess the correct URL for a 404 request based on query vars. + * + * @since 2.3.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return string|false The correct URL if one is found. False on failure. + */ + function redirect_guess_404_permalink() + { + } + /** + * Redirects a variety of shorthand URLs to the admin. + * + * If a user visits example.com/admin, they'll be redirected to /wp-admin. + * Visiting /login redirects to /wp-login.php, and so on. + * + * @since 3.4.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * @phpstan-return void + */ + function wp_redirect_admin_locations() + { + } + /** + * Core User Role & Capabilities API + * + * @package WordPress + * @subpackage Users + */ + /** + * Maps a capability to the primitive capabilities required of the given user to + * satisfy the capability being checked. + * + * This function also accepts an ID of an object to map against if the capability is a meta capability. Meta + * capabilities such as `edit_post` and `edit_user` are capabilities used by this function to map to primitive + * capabilities that a user or role requires, such as `edit_posts` and `edit_others_posts`. + * + * Example usage: + * + * map_meta_cap( 'edit_posts', $user->ID ); + * map_meta_cap( 'edit_post', $user->ID, $post->ID ); + * map_meta_cap( 'edit_post_meta', $user->ID, $post->ID, $meta_key ); + * + * This function does not check whether the user has the required capabilities, + * it just returns what the required capabilities are. + * + * @since 2.0.0 + * @since 4.9.6 Added the `export_others_personal_data`, `erase_others_personal_data`, + * and `manage_privacy_options` capabilities. + * @since 5.1.0 Added the `update_php` capability. + * @since 5.2.0 Added the `resume_plugin` and `resume_theme` capabilities. + * @since 5.3.0 Formalized the existing and already documented `...$args` parameter + * by adding it to the function signature. + * @since 5.7.0 Added the `create_app_password`, `list_app_passwords`, `read_app_password`, + * `edit_app_password`, `delete_app_passwords`, `delete_app_password`, + * and `update_https` capabilities. + * + * @global array $post_type_meta_caps Used to get post type meta capabilities. + * + * @param string $cap Capability being checked. + * @param int $user_id User ID. + * @param mixed ...$args Optional further parameters, typically starting with an object ID. + * @return string[] Primitive capabilities required of the user. + */ + function map_meta_cap($cap, $user_id, ...$args) + { + } + /** + * Returns whether the current user has the specified capability. + * + * This function also accepts an ID of an object to check against if the capability is a meta capability. Meta + * capabilities such as `edit_post` and `edit_user` are capabilities used by the `map_meta_cap()` function to + * map to primitive capabilities that a user or role has, such as `edit_posts` and `edit_others_posts`. + * + * Example usage: + * + * current_user_can( 'edit_posts' ); + * current_user_can( 'edit_post', $post->ID ); + * current_user_can( 'edit_post_meta', $post->ID, $meta_key ); + * + * While checking against particular roles in place of a capability is supported + * in part, this practice is discouraged as it may produce unreliable results. + * + * Note: Will always return true if the current user is a super admin, unless specifically denied. + * + * @since 2.0.0 + * @since 5.3.0 Formalized the existing and already documented `...$args` parameter + * by adding it to the function signature. + * @since 5.8.0 Converted to wrapper for the user_can() function. + * + * @see WP_User::has_cap() + * @see map_meta_cap() + * + * @param string $capability Capability name. + * @param mixed ...$args Optional further parameters, typically starting with an object ID. + * @return bool Whether the current user has the given capability. If `$capability` is a meta cap and `$object_id` is + * passed, whether the current user has the given meta capability for the given object. + */ + function current_user_can($capability, ...$args) + { + } + /** + * Returns whether the current user has the specified capability for a given site. + * + * This function also accepts an ID of an object to check against if the capability is a meta capability. Meta + * capabilities such as `edit_post` and `edit_user` are capabilities used by the `map_meta_cap()` function to + * map to primitive capabilities that a user or role has, such as `edit_posts` and `edit_others_posts`. + * + * Example usage: + * + * current_user_can_for_blog( $blog_id, 'edit_posts' ); + * current_user_can_for_blog( $blog_id, 'edit_post', $post->ID ); + * current_user_can_for_blog( $blog_id, 'edit_post_meta', $post->ID, $meta_key ); + * + * @since 3.0.0 + * @since 5.3.0 Formalized the existing and already documented `...$args` parameter + * by adding it to the function signature. + * @since 5.8.0 Wraps current_user_can() after switching to blog. + * + * @param int $blog_id Site ID. + * @param string $capability Capability name. + * @param mixed ...$args Optional further parameters, typically starting with an object ID. + * @return bool Whether the user has the given capability. + */ + function current_user_can_for_blog($blog_id, $capability, ...$args) + { + } + /** + * Returns whether the author of the supplied post has the specified capability. + * + * This function also accepts an ID of an object to check against if the capability is a meta capability. Meta + * capabilities such as `edit_post` and `edit_user` are capabilities used by the `map_meta_cap()` function to + * map to primitive capabilities that a user or role has, such as `edit_posts` and `edit_others_posts`. + * + * Example usage: + * + * author_can( $post, 'edit_posts' ); + * author_can( $post, 'edit_post', $post->ID ); + * author_can( $post, 'edit_post_meta', $post->ID, $meta_key ); + * + * @since 2.9.0 + * @since 5.3.0 Formalized the existing and already documented `...$args` parameter + * by adding it to the function signature. + * + * @param int|WP_Post $post Post ID or post object. + * @param string $capability Capability name. + * @param mixed ...$args Optional further parameters, typically starting with an object ID. + * @return bool Whether the post author has the given capability. + */ + function author_can($post, $capability, ...$args) + { + } + /** + * Returns whether a particular user has the specified capability. + * + * This function also accepts an ID of an object to check against if the capability is a meta capability. Meta + * capabilities such as `edit_post` and `edit_user` are capabilities used by the `map_meta_cap()` function to + * map to primitive capabilities that a user or role has, such as `edit_posts` and `edit_others_posts`. + * + * Example usage: + * + * user_can( $user->ID, 'edit_posts' ); + * user_can( $user->ID, 'edit_post', $post->ID ); + * user_can( $user->ID, 'edit_post_meta', $post->ID, $meta_key ); + * + * @since 3.1.0 + * @since 5.3.0 Formalized the existing and already documented `...$args` parameter + * by adding it to the function signature. + * + * @param int|WP_User $user User ID or object. + * @param string $capability Capability name. + * @param mixed ...$args Optional further parameters, typically starting with an object ID. + * @return bool Whether the user has the given capability. + */ + function user_can($user, $capability, ...$args) + { + } + /** + * Retrieves the global WP_Roles instance and instantiates it if necessary. + * + * @since 4.3.0 + * + * @global WP_Roles $wp_roles WordPress role management object. + * + * @return WP_Roles WP_Roles global instance if not already instantiated. + */ + function wp_roles() + { + } + /** + * Retrieves role object. + * + * @since 2.0.0 + * + * @param string $role Role name. + * @return WP_Role|null WP_Role object if found, null if the role does not exist. + */ + function get_role($role) + { + } + /** + * Adds a role, if it does not exist. + * + * @since 2.0.0 + * + * @param string $role Role name. + * @param string $display_name Display name for role. + * @param bool[] $capabilities List of capabilities keyed by the capability name, + * e.g. array( 'edit_posts' => true, 'delete_posts' => false ). + * @return WP_Role|void WP_Role object, if the role is added. + */ + function add_role($role, $display_name, $capabilities = array()) + { + } + /** + * Removes a role, if it exists. + * + * @since 2.0.0 + * + * @param string $role Role name. + */ + function remove_role($role) + { + } + /** + * Retrieves a list of super admins. + * + * @since 3.0.0 + * + * @global array $super_admins + * + * @return string[] List of super admin logins. + */ + function get_super_admins() + { + } + /** + * Determines whether user is a site admin. + * + * @since 3.0.0 + * + * @param int|false $user_id Optional. The ID of a user. Defaults to false, to check the current user. + * @return bool Whether the user is a site admin. + */ + function is_super_admin($user_id = \false) + { + } + /** + * Grants Super Admin privileges. + * + * @since 3.0.0 + * + * @global array $super_admins + * + * @param int $user_id ID of the user to be granted Super Admin privileges. + * @return bool True on success, false on failure. This can fail when the user is + * already a super admin or when the `$super_admins` global is defined. + */ + function grant_super_admin($user_id) + { + } + /** + * Revokes Super Admin privileges. + * + * @since 3.0.0 + * + * @global array $super_admins + * + * @param int $user_id ID of the user Super Admin privileges to be revoked from. + * @return bool True on success, false on failure. This can fail when the user's email + * is the network admin email or when the `$super_admins` global is defined. + */ + function revoke_super_admin($user_id) + { + } + /** + * Filters the user capabilities to grant the 'install_languages' capability as necessary. + * + * A user must have at least one out of the 'update_core', 'install_plugins', and + * 'install_themes' capabilities to qualify for 'install_languages'. + * + * @since 4.9.0 + * + * @param bool[] $allcaps An array of all the user's capabilities. + * @return bool[] Filtered array of the user's capabilities. + */ + function wp_maybe_grant_install_languages_cap($allcaps) + { + } + /** + * Filters the user capabilities to grant the 'resume_plugins' and 'resume_themes' capabilities as necessary. + * + * @since 5.2.0 + * + * @param bool[] $allcaps An array of all the user's capabilities. + * @return bool[] Filtered array of the user's capabilities. + */ + function wp_maybe_grant_resume_extensions_caps($allcaps) + { + } + /** + * Filters the user capabilities to grant the 'view_site_health_checks' capabilities as necessary. + * + * @since 5.2.2 + * + * @param bool[] $allcaps An array of all the user's capabilities. + * @param string[] $caps Required primitive capabilities for the requested capability. + * @param array $args { + * Arguments that accompany the requested capability check. + * + * @type string $0 Requested capability. + * @type int $1 Concerned user ID. + * @type mixed ...$2 Optional second and further parameters, typically object ID. + * } + * @param WP_User $user The user object. + * @return bool[] Filtered array of the user's capabilities. + */ + function wp_maybe_grant_site_health_caps($allcaps, $caps, $args, $user) + { + } + /** + * Taxonomy API: Core category-specific template tags + * + * @package WordPress + * @subpackage Template + * @since 1.2.0 + */ + /** + * Retrieves category link URL. + * + * @since 1.0.0 + * + * @see get_term_link() + * + * @param int|object $category Category ID or object. + * @return string Link on success, empty string if category does not exist. + */ + function get_category_link($category) + { + } + /** + * Retrieves category parents with separator. + * + * @since 1.2.0 + * @since 4.8.0 The `$visited` parameter was deprecated and renamed to `$deprecated`. + * + * @param int $category_id Category ID. + * @param bool $link Optional. Whether to format with link. Default false. + * @param string $separator Optional. How to separate categories. Default '/'. + * @param bool $nicename Optional. Whether to use nice name for display. Default false. + * @param array $deprecated Not used. + * @return string|WP_Error A list of category parents on success, WP_Error on failure. + */ + function get_category_parents($category_id, $link = \false, $separator = '/', $nicename = \false, $deprecated = array()) + { + } + /** + * Retrieves post categories. + * + * This tag may be used outside The Loop by passing a post ID as the parameter. + * + * Note: This function only returns results from the default "category" taxonomy. + * For custom taxonomies use get_the_terms(). + * + * @since 0.71 + * + * @param int $post_id Optional. The post ID. Defaults to current post ID. + * @return WP_Term[] Array of WP_Term objects, one for each category assigned to the post. + */ + function get_the_category($post_id = \false) + { + } + /** + * Retrieves category name based on category ID. + * + * @since 0.71 + * + * @param int $cat_id Category ID. + * @return string|WP_Error Category name on success, WP_Error on failure. + */ + function get_the_category_by_ID($cat_id) + { + } + /** + * Retrieves category list for a post in either HTML list or custom format. + * + * Generally used for quick, delimited (e.g. comma-separated) lists of categories, + * as part of a post entry meta. + * + * For a more powerful, list-based function, see wp_list_categories(). + * + * @since 1.5.1 + * + * @see wp_list_categories() + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param string $separator Optional. Separator between the categories. By default, the links are placed + * in an unordered list. An empty string will result in the default behavior. + * @param string $parents Optional. How to display the parents. Accepts 'multiple', 'single', or empty. + * Default empty string. + * @param int $post_id Optional. ID of the post to retrieve categories for. Defaults to the current post. + * @return string Category list for a post. + */ + function get_the_category_list($separator = '', $parents = '', $post_id = \false) + { + } + /** + * Checks if the current post is within any of the given categories. + * + * The given categories are checked against the post's categories' term_ids, names and slugs. + * Categories given as integers will only be checked against the post's categories' term_ids. + * + * Prior to v2.5 of WordPress, category names were not supported. + * Prior to v2.7, category slugs were not supported. + * Prior to v2.7, only one category could be compared: in_category( $single_category ). + * Prior to v2.7, this function could only be used in the WordPress Loop. + * As of 2.7, the function can be used anywhere if it is provided a post ID or post object. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 1.2.0 + * @since 2.7.0 The `$post` parameter was added. + * + * @param int|string|int[]|string[] $category Category ID, name, slug, or array of such + * to check against. + * @param int|WP_Post $post Optional. Post to check. Defaults to the current post. + * @return bool True if the current post is in any of the given categories. + */ + function in_category($category, $post = \null) + { + } + /** + * Displays category list for a post in either HTML list or custom format. + * + * @since 0.71 + * + * @param string $separator Optional. Separator between the categories. By default, the links are placed + * in an unordered list. An empty string will result in the default behavior. + * @param string $parents Optional. How to display the parents. Accepts 'multiple', 'single', or empty. + * Default empty string. + * @param int $post_id Optional. ID of the post to retrieve categories for. Defaults to the current post. + */ + function the_category($separator = '', $parents = '', $post_id = \false) + { + } + /** + * Retrieves category description. + * + * @since 1.0.0 + * + * @param int $category Optional. Category ID. Defaults to the current category ID. + * @return string Category description, if available. + */ + function category_description($category = 0) + { + } + /** + * Displays or retrieves the HTML dropdown list of categories. + * + * The 'hierarchical' argument, which is disabled by default, will override the + * depth argument, unless it is true. When the argument is false, it will + * display all of the categories. When it is enabled it will use the value in + * the 'depth' argument. + * + * @since 2.1.0 + * @since 4.2.0 Introduced the `value_field` argument. + * @since 4.6.0 Introduced the `required` argument. + * @since 6.1.0 Introduced the `aria_describedby` argument. + * + * @param array|string $args { + * Optional. Array or string of arguments to generate a categories drop-down element. See WP_Term_Query::__construct() + * for information on additional accepted arguments. + * + * @type string $show_option_all Text to display for showing all categories. Default empty. + * @type string $show_option_none Text to display for showing no categories. Default empty. + * @type string $option_none_value Value to use when no category is selected. Default empty. + * @type string $orderby Which column to use for ordering categories. See get_terms() for a list + * of accepted values. Default 'id' (term_id). + * @type bool $pad_counts See get_terms() for an argument description. Default false. + * @type bool|int $show_count Whether to include post counts. Accepts 0, 1, or their bool equivalents. + * Default 0. + * @type bool|int $echo Whether to echo or return the generated markup. Accepts 0, 1, or their + * bool equivalents. Default 1. + * @type bool|int $hierarchical Whether to traverse the taxonomy hierarchy. Accepts 0, 1, or their bool + * equivalents. Default 0. + * @type int $depth Maximum depth. Default 0. + * @type int $tab_index Tab index for the select element. Default 0 (no tabindex). + * @type string $name Value for the 'name' attribute of the select element. Default 'cat'. + * @type string $id Value for the 'id' attribute of the select element. Defaults to the value + * of `$name`. + * @type string $class Value for the 'class' attribute of the select element. Default 'postform'. + * @type int|string $selected Value of the option that should be selected. Default 0. + * @type string $value_field Term field that should be used to populate the 'value' attribute + * of the option elements. Accepts any valid term field: 'term_id', 'name', + * 'slug', 'term_group', 'term_taxonomy_id', 'taxonomy', 'description', + * 'parent', 'count'. Default 'term_id'. + * @type string|array $taxonomy Name of the taxonomy or taxonomies to retrieve. Default 'category'. + * @type bool $hide_if_empty True to skip generating markup if no categories are found. + * Default false (create select element even if no categories are found). + * @type bool $required Whether the `<select>` element should have the HTML5 'required' attribute. + * Default false. + * @type Walker $walker Walker object to use to build the output. Default empty which results in a + * Walker_CategoryDropdown instance being used. + * @type string $aria_describedby The 'id' of an element that contains descriptive text for the select. + * Default empty string. + * } + * @return string HTML dropdown list of categories. + * @phpstan-param array{ + * show_option_all?: string, + * show_option_none?: string, + * option_none_value?: string, + * orderby?: string, + * pad_counts?: bool, + * show_count?: bool|int, + * echo?: bool|int, + * hierarchical?: bool|int, + * depth?: int, + * tab_index?: int, + * name?: string, + * id?: string, + * class?: string, + * selected?: int|string, + * value_field?: string, + * taxonomy?: string|array, + * hide_if_empty?: bool, + * required?: bool, + * walker?: Walker, + * aria_describedby?: string, + * taxonomy?: string|string[], + * object_ids?: int|int[], + * orderby?: string, + * order?: string, + * hide_empty?: bool|int, + * include?: int[]|string, + * exclude?: int[]|string, + * exclude_tree?: int[]|string, + * number?: int|string, + * offset?: int, + * fields?: string, + * count?: bool, + * name?: string|string[], + * slug?: string|string[], + * term_taxonomy_id?: int|int[], + * hierarchical?: bool, + * search?: string, + * name__like?: string, + * description__like?: string, + * pad_counts?: bool, + * get?: string, + * child_of?: int, + * parent?: int, + * childless?: bool, + * cache_domain?: string, + * cache_results?: bool, + * update_term_meta_cache?: bool, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * } $args + */ + function wp_dropdown_categories($args = '') + { + } + /** + * Displays or retrieves the HTML list of categories. + * + * @since 2.1.0 + * @since 4.4.0 Introduced the `hide_title_if_empty` and `separator` arguments. + * @since 4.4.0 The `current_category` argument was modified to optionally accept an array of values. + * @since 6.1.0 Default value of the 'use_desc_for_title' argument was changed from 1 to 0. + * + * @param array|string $args { + * Array of optional arguments. See get_categories(), get_terms(), and WP_Term_Query::__construct() + * for information on additional accepted arguments. + * + * @type int|int[] $current_category ID of category, or array of IDs of categories, that should get the + * 'current-cat' class. Default 0. + * @type int $depth Category depth. Used for tab indentation. Default 0. + * @type bool|int $echo Whether to echo or return the generated markup. Accepts 0, 1, or their + * bool equivalents. Default 1. + * @type int[]|string $exclude Array or comma/space-separated string of term IDs to exclude. + * If `$hierarchical` is true, descendants of `$exclude` terms will also + * be excluded; see `$exclude_tree`. See get_terms(). + * Default empty string. + * @type int[]|string $exclude_tree Array or comma/space-separated string of term IDs to exclude, along + * with their descendants. See get_terms(). Default empty string. + * @type string $feed Text to use for the feed link. Default 'Feed for all posts filed + * under [cat name]'. + * @type string $feed_image URL of an image to use for the feed link. Default empty string. + * @type string $feed_type Feed type. Used to build feed link. See get_term_feed_link(). + * Default empty string (default feed). + * @type bool $hide_title_if_empty Whether to hide the `$title_li` element if there are no terms in + * the list. Default false (title will always be shown). + * @type string $separator Separator between links. Default '<br />'. + * @type bool|int $show_count Whether to include post counts. Accepts 0, 1, or their bool equivalents. + * Default 0. + * @type string $show_option_all Text to display for showing all categories. Default empty string. + * @type string $show_option_none Text to display for the 'no categories' option. + * Default 'No categories'. + * @type string $style The style used to display the categories list. If 'list', categories + * will be output as an unordered list. If left empty or another value, + * categories will be output separated by `<br>` tags. Default 'list'. + * @type string $taxonomy Name of the taxonomy to retrieve. Default 'category'. + * @type string $title_li Text to use for the list title `<li>` element. Pass an empty string + * to disable. Default 'Categories'. + * @type bool|int $use_desc_for_title Whether to use the category description as the title attribute. + * Accepts 0, 1, or their bool equivalents. Default 0. + * @type Walker $walker Walker object to use to build the output. Default empty which results + * in a Walker_Category instance being used. + * } + * @return void|string|false Void if 'echo' argument is true, HTML list of categories if 'echo' is false. + * False if the taxonomy does not exist. + * @phpstan-param array{ + * current_category?: int|int[], + * depth?: int, + * echo?: bool|int, + * exclude?: int[]|string, + * exclude_tree?: int[]|string, + * feed?: string, + * feed_image?: string, + * feed_type?: string, + * hide_title_if_empty?: bool, + * separator?: string, + * show_count?: bool|int, + * show_option_all?: string, + * show_option_none?: string, + * style?: string, + * taxonomy?: string, + * title_li?: string, + * use_desc_for_title?: bool|int, + * walker?: Walker, + * taxonomy?: string, + * } $args + */ + function wp_list_categories($args = '') + { + } + /** + * Displays a tag cloud. + * + * Outputs a list of tags in what is called a 'tag cloud', where the size of each tag + * is determined by how many times that particular tag has been assigned to posts. + * + * @since 2.3.0 + * @since 2.8.0 Added the `taxonomy` argument. + * @since 4.8.0 Added the `show_count` argument. + * + * @param array|string $args { + * Optional. Array or string of arguments for displaying a tag cloud. See wp_generate_tag_cloud() + * and get_terms() for the full lists of arguments that can be passed in `$args`. + * + * @type int $number The number of tags to display. Accepts any positive integer + * or zero to return all. Default 45. + * @type string $link Whether to display term editing links or term permalinks. + * Accepts 'edit' and 'view'. Default 'view'. + * @type string $post_type The post type. Used to highlight the proper post type menu + * on the linked edit page. Defaults to the first post type + * associated with the taxonomy. + * @type bool $echo Whether or not to echo the return value. Default true. + * } + * @return void|string|string[] Void if 'echo' argument is true, or on failure. Otherwise, tag cloud + * as a string or an array, depending on 'format' argument. + * @phpstan-param array{ + * number?: int, + * link?: string, + * post_type?: string, + * echo?: bool, + * smallest?: int, + * largest?: int, + * unit?: string, + * number?: int, + * format?: string, + * separator?: string, + * orderby?: string, + * order?: string, + * filter?: int|bool, + * topic_count_text?: array, + * topic_count_text_callback?: callable, + * topic_count_scale_callback?: callable, + * show_count?: bool|int, + * } $args + */ + function wp_tag_cloud($args = '') + { + } + /** + * Default topic count scaling for tag links. + * + * @since 2.9.0 + * + * @param int $count Number of posts with that tag. + * @return int Scaled count. + */ + function default_topic_count_scale($count) + { + } + /** + * Generates a tag cloud (heatmap) from provided data. + * + * @todo Complete functionality. + * @since 2.3.0 + * @since 4.8.0 Added the `show_count` argument. + * + * @param WP_Term[] $tags Array of WP_Term objects to generate the tag cloud for. + * @param string|array $args { + * Optional. Array or string of arguments for generating a tag cloud. + * + * @type int $smallest Smallest font size used to display tags. Paired + * with the value of `$unit`, to determine CSS text + * size unit. Default 8 (pt). + * @type int $largest Largest font size used to display tags. Paired + * with the value of `$unit`, to determine CSS text + * size unit. Default 22 (pt). + * @type string $unit CSS text size unit to use with the `$smallest` + * and `$largest` values. Accepts any valid CSS text + * size unit. Default 'pt'. + * @type int $number The number of tags to return. Accepts any + * positive integer or zero to return all. + * Default 0. + * @type string $format Format to display the tag cloud in. Accepts 'flat' + * (tags separated with spaces), 'list' (tags displayed + * in an unordered list), or 'array' (returns an array). + * Default 'flat'. + * @type string $separator HTML or text to separate the tags. Default "\n" (newline). + * @type string $orderby Value to order tags by. Accepts 'name' or 'count'. + * Default 'name'. The {@see 'tag_cloud_sort'} filter + * can also affect how tags are sorted. + * @type string $order How to order the tags. Accepts 'ASC' (ascending), + * 'DESC' (descending), or 'RAND' (random). Default 'ASC'. + * @type int|bool $filter Whether to enable filtering of the final output + * via {@see 'wp_generate_tag_cloud'}. Default 1. + * @type array $topic_count_text Nooped plural text from _n_noop() to supply to + * tag counts. Default null. + * @type callable $topic_count_text_callback Callback used to generate nooped plural text for + * tag counts based on the count. Default null. + * @type callable $topic_count_scale_callback Callback used to determine the tag count scaling + * value. Default default_topic_count_scale(). + * @type bool|int $show_count Whether to display the tag counts. Default 0. Accepts + * 0, 1, or their bool equivalents. + * } + * @return string|string[] Tag cloud as a string or an array, depending on 'format' argument. + * @phpstan-param array{ + * smallest?: int, + * largest?: int, + * unit?: string, + * number?: int, + * format?: string, + * separator?: string, + * orderby?: string, + * order?: string, + * filter?: int|bool, + * topic_count_text?: array, + * topic_count_text_callback?: callable, + * topic_count_scale_callback?: callable, + * show_count?: bool|int, + * } $args + */ + function wp_generate_tag_cloud($tags, $args = '') + { + } + /** + * Serves as a callback for comparing objects based on name. + * + * Used with `uasort()`. + * + * @since 3.1.0 + * @access private + * + * @param object $a The first object to compare. + * @param object $b The second object to compare. + * @return int Negative number if `$a->name` is less than `$b->name`, zero if they are equal, + * or greater than zero if `$a->name` is greater than `$b->name`. + */ + function _wp_object_name_sort_cb($a, $b) + { + } + /** + * Serves as a callback for comparing objects based on count. + * + * Used with `uasort()`. + * + * @since 3.1.0 + * @access private + * + * @param object $a The first object to compare. + * @param object $b The second object to compare. + * @return int Negative number if `$a->count` is less than `$b->count`, zero if they are equal, + * or greater than zero if `$a->count` is greater than `$b->count`. + */ + function _wp_object_count_sort_cb($a, $b) + { + } + // + // Helper functions. + // + /** + * Retrieves HTML list content for category list. + * + * @since 2.1.0 + * @since 5.3.0 Formalized the existing `...$args` parameter by adding it + * to the function signature. + * + * @uses Walker_Category to create HTML list content. + * @see Walker::walk() for parameters and return description. + * + * @param mixed ...$args Elements array, maximum hierarchical depth and optional additional arguments. + * @return string + */ + function walk_category_tree(...$args) + { + } + /** + * Retrieves HTML dropdown (select) content for category list. + * + * @since 2.1.0 + * @since 5.3.0 Formalized the existing `...$args` parameter by adding it + * to the function signature. + * + * @uses Walker_CategoryDropdown to create HTML dropdown content. + * @see Walker::walk() for parameters and return description. + * + * @param mixed ...$args Elements array, maximum hierarchical depth and optional additional arguments. + * @return string + */ + function walk_category_dropdown_tree(...$args) + { + } + // + // Tags. + // + /** + * Retrieves the link to the tag. + * + * @since 2.3.0 + * + * @see get_term_link() + * + * @param int|object $tag Tag ID or object. + * @return string Link on success, empty string if tag does not exist. + */ + function get_tag_link($tag) + { + } + /** + * Retrieves the tags for a post. + * + * @since 2.3.0 + * + * @param int|WP_Post $post Post ID or object. + * @return WP_Term[]|false|WP_Error Array of WP_Term objects on success, false if there are no terms + * or the post does not exist, WP_Error on failure. + */ + function get_the_tags($post = 0) + { + } + /** + * Retrieves the tags for a post formatted as a string. + * + * @since 2.3.0 + * + * @param string $before Optional. String to use before the tags. Default empty. + * @param string $sep Optional. String to use between the tags. Default empty. + * @param string $after Optional. String to use after the tags. Default empty. + * @param int $post_id Optional. Post ID. Defaults to the current post ID. + * @return string|false|WP_Error A list of tags on success, false if there are no terms, + * WP_Error on failure. + */ + function get_the_tag_list($before = '', $sep = '', $after = '', $post_id = 0) + { + } + /** + * Displays the tags for a post. + * + * @since 2.3.0 + * + * @param string $before Optional. String to use before the tags. Defaults to 'Tags:'. + * @param string $sep Optional. String to use between the tags. Default ', '. + * @param string $after Optional. String to use after the tags. Default empty. + */ + function the_tags($before = \null, $sep = ', ', $after = '') + { + } + /** + * Retrieves tag description. + * + * @since 2.8.0 + * + * @param int $tag Optional. Tag ID. Defaults to the current tag ID. + * @return string Tag description, if available. + */ + function tag_description($tag = 0) + { + } + /** + * Retrieves term description. + * + * @since 2.8.0 + * @since 4.9.2 The `$taxonomy` parameter was deprecated. + * + * @param int $term Optional. Term ID. Defaults to the current term ID. + * @param null $deprecated Deprecated. Not used. + * @return string Term description, if available. + */ + function term_description($term = 0, $deprecated = \null) + { + } + /** + * Retrieves the terms of the taxonomy that are attached to the post. + * + * @since 2.5.0 + * + * @param int|WP_Post $post Post ID or object. + * @param string $taxonomy Taxonomy name. + * @return WP_Term[]|false|WP_Error Array of WP_Term objects on success, false if there are no terms + * or the post does not exist, WP_Error on failure. + */ + function get_the_terms($post, $taxonomy) + { + } + /** + * Retrieves a post's terms as a list with specified format. + * + * Terms are linked to their respective term listing pages. + * + * @since 2.5.0 + * + * @param int $post_id Post ID. + * @param string $taxonomy Taxonomy name. + * @param string $before Optional. String to use before the terms. Default empty. + * @param string $sep Optional. String to use between the terms. Default empty. + * @param string $after Optional. String to use after the terms. Default empty. + * @return string|false|WP_Error A list of terms on success, false if there are no terms, + * WP_Error on failure. + */ + function get_the_term_list($post_id, $taxonomy, $before = '', $sep = '', $after = '') + { + } + /** + * Retrieves term parents with separator. + * + * @since 4.8.0 + * + * @param int $term_id Term ID. + * @param string $taxonomy Taxonomy name. + * @param string|array $args { + * Array of optional arguments. + * + * @type string $format Use term names or slugs for display. Accepts 'name' or 'slug'. + * Default 'name'. + * @type string $separator Separator for between the terms. Default '/'. + * @type bool $link Whether to format as a link. Default true. + * @type bool $inclusive Include the term to get the parents for. Default true. + * } + * @return string|WP_Error A list of term parents on success, WP_Error or empty string on failure. + * @phpstan-param array{ + * format?: string, + * separator?: string, + * link?: bool, + * inclusive?: bool, + * } $args + */ + function get_term_parents_list($term_id, $taxonomy, $args = array()) + { + } + /** + * Displays the terms for a post in a list. + * + * @since 2.5.0 + * + * @param int $post_id Post ID. + * @param string $taxonomy Taxonomy name. + * @param string $before Optional. String to use before the terms. Default empty. + * @param string $sep Optional. String to use between the terms. Default ', '. + * @param string $after Optional. String to use after the terms. Default empty. + * @return void|false Void on success, false on failure. + */ + function the_terms($post_id, $taxonomy, $before = '', $sep = ', ', $after = '') + { + } + /** + * Checks if the current post has any of given category. + * + * The given categories are checked against the post's categories' term_ids, names and slugs. + * Categories given as integers will only be checked against the post's categories' term_ids. + * + * If no categories are given, determines if post has any categories. + * + * @since 3.1.0 + * + * @param string|int|array $category Optional. The category name/term_id/slug, + * or an array of them to check for. Default empty. + * @param int|WP_Post $post Optional. Post to check. Defaults to the current post. + * @return bool True if the current post has any of the given categories + * (or any category, if no category specified). False otherwise. + */ + function has_category($category = '', $post = \null) + { + } + /** + * Checks if the current post has any of given tags. + * + * The given tags are checked against the post's tags' term_ids, names and slugs. + * Tags given as integers will only be checked against the post's tags' term_ids. + * + * If no tags are given, determines if post has any tags. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 2.6.0 + * @since 2.7.0 Tags given as integers are only checked against + * the post's tags' term_ids, not names or slugs. + * @since 2.7.0 Can be used outside of the WordPress Loop if `$post` is provided. + * + * @param string|int|array $tag Optional. The tag name/term_id/slug, + * or an array of them to check for. Default empty. + * @param int|WP_Post $post Optional. Post to check. Defaults to the current post. + * @return bool True if the current post has any of the given tags + * (or any tag, if no tag specified). False otherwise. + */ + function has_tag($tag = '', $post = \null) + { + } + /** + * Checks if the current post has any of given terms. + * + * The given terms are checked against the post's terms' term_ids, names and slugs. + * Terms given as integers will only be checked against the post's terms' term_ids. + * + * If no terms are given, determines if post has any terms. + * + * @since 3.1.0 + * + * @param string|int|array $term Optional. The term name/term_id/slug, + * or an array of them to check for. Default empty. + * @param string $taxonomy Optional. Taxonomy name. Default empty. + * @param int|WP_Post $post Optional. Post to check. Defaults to the current post. + * @return bool True if the current post has any of the given terms + * (or any term, if no term specified). False otherwise. + */ + function has_term($term = '', $taxonomy = '', $post = \null) + { + } + /** + * Taxonomy API: Core category-specific functionality + * + * @package WordPress + * @subpackage Taxonomy + */ + /** + * Retrieves a list of category objects. + * + * If you set the 'taxonomy' argument to 'link_category', the link categories + * will be returned instead. + * + * @since 2.1.0 + * + * @see get_terms() Type of arguments that can be changed. + * + * @param string|array $args { + * Optional. Arguments to retrieve categories. See get_terms() for additional options. + * + * @type string $taxonomy Taxonomy to retrieve terms for. Default 'category'. + * } + * @return array List of category objects. + * @phpstan-param array{ + * taxonomy?: string, + * } $args + */ + function get_categories($args = '') + { + } + /** + * Retrieves category data given a category ID or category object. + * + * If you pass the $category parameter an object, which is assumed to be the + * category row object retrieved the database. It will cache the category data. + * + * If you pass $category an integer of the category ID, then that category will + * be retrieved from the database, if it isn't already cached, and pass it back. + * + * If you look at get_term(), then both types will be passed through several + * filters and finally sanitized based on the $filter parameter value. + * + * @since 1.5.1 + * + * @param int|object $category Category ID or category row object. + * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which + * correspond to a WP_Term object, an associative array, or a numeric array, + * respectively. Default OBJECT. + * @param string $filter Optional. How to sanitize category fields. Default 'raw'. + * @return object|array|WP_Error|null Category data in type defined by $output parameter. + * WP_Error if $category is empty, null if it does not exist. + * @phpstan-param 'OBJECT'|'ARRAY_A'|'ARRAY_N' $output + * @phpstan-return ($category is object ? array<array-key, mixed>|\WP_Term : array<array-key, mixed>|\WP_Term|\WP_Error|null) & ($output is 'ARRAY_A' ? array<string, mixed>|\WP_Error|null : ($output is 'ARRAY_N' ? array<int, mixed>|\WP_Error|null : \WP_Term|\WP_Error|null)) + */ + function get_category($category, $output = \OBJECT, $filter = 'raw') + { + } + /** + * Retrieves a category based on URL containing the category slug. + * + * Breaks the $category_path parameter up to get the category slug. + * + * Tries to find the child path and will return it. If it doesn't find a + * match, then it will return the first category matching slug, if $full_match, + * is set to false. If it does not, then it will return null. + * + * It is also possible that it will return a WP_Error object on failure. Check + * for it when using this function. + * + * @since 2.1.0 + * + * @param string $category_path URL containing category slugs. + * @param bool $full_match Optional. Whether full path should be matched. + * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which + * correspond to a WP_Term object, an associative array, or a numeric array, + * respectively. Default OBJECT. + * @return WP_Term|array|WP_Error|null Type is based on $output value. + * @phpstan-param 'OBJECT'|'ARRAY_A'|'ARRAY_N' $output + * @phpstan-return ($output is 'ARRAY_A' ? array<string, mixed>|\WP_Error|null : ($output is 'ARRAY_N' ? array<int, mixed>|\WP_Error|null : \WP_Term|\WP_Error|null)) + */ + function get_category_by_path($category_path, $full_match = \true, $output = \OBJECT) + { + } + /** + * Retrieves a category object by category slug. + * + * @since 2.3.0 + * + * @param string $slug The category slug. + * @return object|false Category data object on success, false if not found. + */ + function get_category_by_slug($slug) + { + } + /** + * Retrieves the ID of a category from its name. + * + * @since 1.0.0 + * + * @param string $cat_name Category name. + * @return int Category ID on success, 0 if the category doesn't exist. + */ + function get_cat_ID($cat_name) + { + } + /** + * Retrieves the name of a category from its ID. + * + * @since 1.0.0 + * + * @param int $cat_id Category ID. + * @return string Category name, or an empty string if the category doesn't exist. + */ + function get_cat_name($cat_id) + { + } + /** + * Checks if a category is an ancestor of another category. + * + * You can use either an ID or the category object for both parameters. + * If you use an integer, the category will be retrieved. + * + * @since 2.1.0 + * + * @param int|object $cat1 ID or object to check if this is the parent category. + * @param int|object $cat2 The child category. + * @return bool Whether $cat2 is child of $cat1. + */ + function cat_is_ancestor_of($cat1, $cat2) + { + } + /** + * Sanitizes category data based on context. + * + * @since 2.3.0 + * + * @param object|array $category Category data. + * @param string $context Optional. Default 'display'. + * @return object|array Same type as $category with sanitized data for safe use. + * @phpstan-template T of array|object + * @phpstan-param T $category + * @phpstan-return T + */ + function sanitize_category($category, $context = 'display') + { + } + /** + * Sanitizes data in single category key field. + * + * @since 2.3.0 + * + * @param string $field Category key to sanitize. + * @param mixed $value Category value to sanitize. + * @param int $cat_id Category ID. + * @param string $context What filter to use, 'raw', 'display', etc. + * @return mixed Value after $value has been sanitized. + */ + function sanitize_category_field($field, $value, $cat_id, $context) + { + } + /* Tags */ + /** + * Retrieves all post tags. + * + * @since 2.3.0 + * + * @param string|array $args { + * Optional. Arguments to retrieve tags. See get_terms() for additional options. + * + * @type string $taxonomy Taxonomy to retrieve terms for. Default 'post_tag'. + * } + * @return WP_Term[]|int|WP_Error Array of 'post_tag' term objects, a count thereof, + * or WP_Error if any of the taxonomies do not exist. + * @phpstan-param array{ + * taxonomy?: string, + * } $args + */ + function get_tags($args = '') + { + } + /** + * Retrieves a post tag by tag ID or tag object. + * + * If you pass the $tag parameter an object, which is assumed to be the tag row + * object retrieved from the database, it will cache the tag data. + * + * If you pass $tag an integer of the tag ID, then that tag will be retrieved + * from the database, if it isn't already cached, and passed back. + * + * If you look at get_term(), both types will be passed through several filters + * and finally sanitized based on the $filter parameter value. + * + * @since 2.3.0 + * + * @param int|WP_Term|object $tag A tag ID or object. + * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which + * correspond to a WP_Term object, an associative array, or a numeric array, + * respectively. Default OBJECT. + * @param string $filter Optional. How to sanitize tag fields. Default 'raw'. + * @return WP_Term|array|WP_Error|null Tag data in type defined by $output parameter. + * WP_Error if $tag is empty, null if it does not exist. + */ + function get_tag($tag, $output = \OBJECT, $filter = 'raw') + { + } + /* Cache */ + /** + * Removes the category cache data based on ID. + * + * @since 2.1.0 + * + * @param int $id Category ID + */ + function clean_category_cache($id) + { + } + /** + * Updates category structure to old pre-2.3 from new taxonomy structure. + * + * This function was added for the taxonomy support to update the new category + * structure with the old category one. This will maintain compatibility with + * plugins and themes which depend on the old key or property names. + * + * The parameter should only be passed a variable and not create the array or + * object inline to the parameter. The reason for this is that parameter is + * passed by reference and PHP will fail unless it has the variable. + * + * There is no return value, because everything is updated on the variable you + * pass to it. This is one of the features with using pass by reference in PHP. + * + * @since 2.3.0 + * @since 4.4.0 The `$category` parameter now also accepts a WP_Term object. + * @access private + * + * @param array|object|WP_Term $category Category row object or array. + */ + function _make_cat_compat(&$category) + { + } + /** + * WordPress autoloader for SimplePie. + * + * @since 3.5.0 + * + * @param string $class Class name. + * @phpstan-return void + */ + function wp_simplepie_autoload($class) + { + } + /** + * Registers a new pattern category. + * + * @since 5.5.0 + * + * @param string $category_name Pattern category name including namespace. + * @param array $category_properties List of properties for the block pattern. + * See WP_Block_Pattern_Categories_Registry::register() for + * accepted arguments. + * @return bool True if the pattern category was registered with success and false otherwise. + * @phpstan-param array{ + * label?: string, + * } $category_properties See WP_Block_Pattern_Categories_Registry::register() + */ + function register_block_pattern_category($category_name, $category_properties) + { + } + /** + * Unregisters a pattern category. + * + * @since 5.5.0 + * + * @param string $category_name Pattern category name including namespace. + * @return bool True if the pattern category was unregistered with success and false otherwise. + */ + function unregister_block_pattern_category($category_name) + { + } + /** + * Registers a new block pattern. + * + * @since 5.5.0 + * + * @param string $pattern_name Block pattern name including namespace. + * @param array $pattern_properties List of properties for the block pattern. + * See WP_Block_Patterns_Registry::register() for accepted arguments. + * @return bool True if the pattern was registered with success and false otherwise. + * @phpstan-param array{ + * title?: string, + * content?: string, + * description?: string, + * viewportWidth?: int, + * inserter?: bool, + * categories?: string[], + * keywords?: string[], + * blockTypes?: string[], + * postTypes?: string[], + * templateTypes?: string[], + * filePath?: string, + * } $pattern_properties See WP_Block_Patterns_Registry::register() + */ + function register_block_pattern($pattern_name, $pattern_properties) + { + } + /** + * Unregisters a block pattern. + * + * @since 5.5.0 + * + * @param string $pattern_name Block pattern name including namespace. + * @return bool True if the pattern was unregistered with success and false otherwise. + */ + function unregister_block_pattern($pattern_name) + { + } + /** + * Generates a string of attributes by applying to the current block being + * rendered all of the features that the block supports. + * + * @since 5.6.0 + * + * @param string[] $extra_attributes Optional. Array of extra attributes to render on the block wrapper. + * @return string String of HTML attributes. + */ + function get_block_wrapper_attributes($extra_attributes = array()) + { + } + /** + * Comment template functions + * + * These functions are meant to live inside of the WordPress loop. + * + * @package WordPress + * @subpackage Template + */ + /** + * Retrieves the author of the current comment. + * + * If the comment has an empty comment_author field, then 'Anonymous' person is + * assumed. + * + * @since 1.5.0 + * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. + * + * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to retrieve the author. + * Default current comment. + * @return string The comment author + */ + function get_comment_author($comment_id = 0) + { + } + /** + * Displays the author of the current comment. + * + * @since 0.71 + * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. + * + * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to print the author. + * Default current comment. + */ + function comment_author($comment_id = 0) + { + } + /** + * Retrieves the email of the author of the current comment. + * + * @since 1.5.0 + * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. + * + * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to get the author's email. + * Default current comment. + * @return string The current comment author's email + */ + function get_comment_author_email($comment_id = 0) + { + } + /** + * Displays the email of the author of the current global $comment. + * + * Care should be taken to protect the email address and assure that email + * harvesters do not capture your commenter's email address. Most assume that + * their email address will not appear in raw form on the site. Doing so will + * enable anyone, including those that people don't want to get the email + * address and use it for their own means good and bad. + * + * @since 0.71 + * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. + * + * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to print the author's email. + * Default current comment. + */ + function comment_author_email($comment_id = 0) + { + } + /** + * Displays the HTML email link to the author of the current comment. + * + * Care should be taken to protect the email address and assure that email + * harvesters do not capture your commenter's email address. Most assume that + * their email address will not appear in raw form on the site. Doing so will + * enable anyone, including those that people don't want to get the email + * address and use it for their own means good and bad. + * + * @since 0.71 + * @since 4.6.0 Added the `$comment` parameter. + * + * @param string $link_text Optional. Text to display instead of the comment author's email address. + * Default empty. + * @param string $before Optional. Text or HTML to display before the email link. Default empty. + * @param string $after Optional. Text or HTML to display after the email link. Default empty. + * @param int|WP_Comment $comment Optional. Comment ID or WP_Comment object. Default is the current comment. + */ + function comment_author_email_link($link_text = '', $before = '', $after = '', $comment = \null) + { + } + /** + * Returns the HTML email link to the author of the current comment. + * + * Care should be taken to protect the email address and assure that email + * harvesters do not capture your commenter's email address. Most assume that + * their email address will not appear in raw form on the site. Doing so will + * enable anyone, including those that people don't want to get the email + * address and use it for their own means good and bad. + * + * @since 2.7.0 + * @since 4.6.0 Added the `$comment` parameter. + * + * @param string $link_text Optional. Text to display instead of the comment author's email address. + * Default empty. + * @param string $before Optional. Text or HTML to display before the email link. Default empty. + * @param string $after Optional. Text or HTML to display after the email link. Default empty. + * @param int|WP_Comment $comment Optional. Comment ID or WP_Comment object. Default is the current comment. + * @return string HTML markup for the comment author email link. By default, the email address is obfuscated + * via the {@see 'comment_email'} filter with antispambot(). + */ + function get_comment_author_email_link($link_text = '', $before = '', $after = '', $comment = \null) + { + } + /** + * Retrieves the HTML link to the URL of the author of the current comment. + * + * Both get_comment_author_url() and get_comment_author() rely on get_comment(), + * which falls back to the global comment variable if the $comment_id argument is empty. + * + * @since 1.5.0 + * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. + * + * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to get the author's link. + * Default current comment. + * @return string The comment author name or HTML link for author's URL. + */ + function get_comment_author_link($comment_id = 0) + { + } + /** + * Displays the HTML link to the URL of the author of the current comment. + * + * @since 0.71 + * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. + * + * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to print the author's link. + * Default current comment. + */ + function comment_author_link($comment_id = 0) + { + } + /** + * Retrieves the IP address of the author of the current comment. + * + * @since 1.5.0 + * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. + * + * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to get the author's IP address. + * Default current comment. + * @return string Comment author's IP address, or an empty string if it's not available. + */ + function get_comment_author_IP($comment_id = 0) + { + } + /** + * Displays the IP address of the author of the current comment. + * + * @since 0.71 + * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. + * + * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to print the author's IP address. + * Default current comment. + */ + function comment_author_IP($comment_id = 0) + { + } + /** + * Retrieves the URL of the author of the current comment, not linked. + * + * @since 1.5.0 + * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. + * + * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to get the author's URL. + * Default current comment. + * @return string Comment author URL, if provided, an empty string otherwise. + */ + function get_comment_author_url($comment_id = 0) + { + } + /** + * Displays the URL of the author of the current comment, not linked. + * + * @since 0.71 + * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. + * + * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to print the author's URL. + * Default current comment. + */ + function comment_author_url($comment_id = 0) + { + } + /** + * Retrieves the HTML link of the URL of the author of the current comment. + * + * $link_text parameter is only used if the URL does not exist for the comment + * author. If the URL does exist then the URL will be used and the $link_text + * will be ignored. + * + * Encapsulate the HTML link between the $before and $after. So it will appear + * in the order of $before, link, and finally $after. + * + * @since 1.5.0 + * @since 4.6.0 Added the `$comment` parameter. + * + * @param string $link_text Optional. The text to display instead of the comment + * author's email address. Default empty. + * @param string $before Optional. The text or HTML to display before the email link. + * Default empty. + * @param string $after Optional. The text or HTML to display after the email link. + * Default empty. + * @param int|WP_Comment $comment Optional. Comment ID or WP_Comment object. + * Default is the current comment. + * @return string The HTML link between the $before and $after parameters. + */ + function get_comment_author_url_link($link_text = '', $before = '', $after = '', $comment = 0) + { + } + /** + * Displays the HTML link of the URL of the author of the current comment. + * + * @since 0.71 + * @since 4.6.0 Added the `$comment` parameter. + * + * @param string $link_text Optional. Text to display instead of the comment author's + * email address. Default empty. + * @param string $before Optional. Text or HTML to display before the email link. + * Default empty. + * @param string $after Optional. Text or HTML to display after the email link. + * Default empty. + * @param int|WP_Comment $comment Optional. Comment ID or WP_Comment object. + * Default is the current comment. + */ + function comment_author_url_link($link_text = '', $before = '', $after = '', $comment = 0) + { + } + /** + * Generates semantic classes for each comment element. + * + * @since 2.7.0 + * @since 4.4.0 Added the ability for `$comment` to also accept a WP_Comment object. + * + * @param string|string[] $css_class Optional. One or more classes to add to the class list. + * Default empty. + * @param int|WP_Comment $comment Optional. Comment ID or WP_Comment object. Default current comment. + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post. + * @param bool $display Optional. Whether to print or return the output. + * Default true. + * @return void|string Void if `$display` argument is true, comment classes if `$display` is false. + * @phpstan-return ($display is true ? void : string) + */ + function comment_class($css_class = '', $comment = \null, $post = \null, $display = \true) + { + } + /** + * Returns the classes for the comment div as an array. + * + * @since 2.7.0 + * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. + * + * @global int $comment_alt + * @global int $comment_depth + * @global int $comment_thread_alt + * + * @param string|string[] $css_class Optional. One or more classes to add to the class list. + * Default empty. + * @param int|WP_Comment $comment_id Optional. Comment ID or WP_Comment object. Default current comment. + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post. + * @return string[] An array of classes. + */ + function get_comment_class($css_class = '', $comment_id = \null, $post = \null) + { + } + /** + * Retrieves the comment date of the current comment. + * + * @since 1.5.0 + * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. + * + * @param string $format Optional. PHP date format. Defaults to the 'date_format' option. + * @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to get the date. + * Default current comment. + * @return string The comment's date. + */ + function get_comment_date($format = '', $comment_id = 0) + { + } + /** + * Displays the comment date of the current comment. + * + * @since 0.71 + * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. + * + * @param string $format Optional. PHP date format. Defaults to the 'date_format' option. + * @param int|WP_Comment $comment_id WP_Comment or ID of the comment for which to print the date. + * Default current comment. + */ + function comment_date($format = '', $comment_id = 0) + { + } + /** + * Retrieves the excerpt of the given comment. + * + * Returns a maximum of 20 words with an ellipsis appended if necessary. + * + * @since 1.5.0 + * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. + * + * @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to get the excerpt. + * Default current comment. + * @return string The possibly truncated comment excerpt. + */ + function get_comment_excerpt($comment_id = 0) + { + } + /** + * Displays the excerpt of the current comment. + * + * @since 1.2.0 + * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. + * + * @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to print the excerpt. + * Default current comment. + */ + function comment_excerpt($comment_id = 0) + { + } + /** + * Retrieves the comment ID of the current comment. + * + * @since 1.5.0 + * + * @return string The comment ID as a numeric string. + */ + function get_comment_ID() + { + } + /** + * Displays the comment ID of the current comment. + * + * @since 0.71 + */ + function comment_ID() + { + } + /** + * Retrieves the link to a given comment. + * + * @since 1.5.0 + * @since 4.4.0 Added the ability for `$comment` to also accept a WP_Comment object. Added `$cpage` argument. + * + * @see get_page_of_comment() + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * @global bool $in_comment_loop + * + * @param WP_Comment|int|null $comment Optional. Comment to retrieve. Default current comment. + * @param array $args { + * An array of optional arguments to override the defaults. + * + * @type string $type Passed to get_page_of_comment(). + * @type int $page Current page of comments, for calculating comment pagination. + * @type int $per_page Per-page value for comment pagination. + * @type int $max_depth Passed to get_page_of_comment(). + * @type int|string $cpage Value to use for the comment's "comment-page" or "cpage" value. + * If provided, this value overrides any value calculated from `$page` + * and `$per_page`. + * } + * @return string The permalink to the given comment. + * @phpstan-param array{ + * type?: string, + * page?: int, + * per_page?: int, + * max_depth?: int, + * cpage?: int|string, + * } $args + */ + function get_comment_link($comment = \null, $args = array()) + { + } + /** + * Retrieves the link to the current post comments. + * + * @since 1.5.0 + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. + * @return string The link to the comments. + */ + function get_comments_link($post = 0) + { + } + /** + * Displays the link to the current post comments. + * + * @since 0.71 + * + * @param string $deprecated Not Used. + * @param string $deprecated_2 Not Used. + */ + function comments_link($deprecated = '', $deprecated_2 = '') + { + } + /** + * Retrieves the amount of comments a post has. + * + * @since 1.5.0 + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is the global `$post`. + * @return string|int If the post exists, a numeric string representing the number of comments + * the post has, otherwise 0. + */ + function get_comments_number($post = 0) + { + } + /** + * Displays the language string for the number of comments the current post has. + * + * @since 0.71 + * @since 5.4.0 The `$deprecated` parameter was changed to `$post`. + * + * @param string|false $zero Optional. Text for no comments. Default false. + * @param string|false $one Optional. Text for one comment. Default false. + * @param string|false $more Optional. Text for more than one comment. Default false. + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is the global `$post`. + */ + function comments_number($zero = \false, $one = \false, $more = \false, $post = 0) + { + } + /** + * Displays the language string for the number of comments the current post has. + * + * @since 4.0.0 + * @since 5.4.0 Added the `$post` parameter to allow using the function outside of the loop. + * + * @param string $zero Optional. Text for no comments. Default false. + * @param string $one Optional. Text for one comment. Default false. + * @param string $more Optional. Text for more than one comment. Default false. + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is the global `$post`. + * @return string Language string for the number of comments a post has. + */ + function get_comments_number_text($zero = \false, $one = \false, $more = \false, $post = 0) + { + } + /** + * Retrieves the text of the current comment. + * + * @since 1.5.0 + * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. + * @since 5.4.0 Added 'In reply to %s.' prefix to child comments in comments feed. + * + * @see Walker_Comment::comment() + * + * @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to get the text. + * Default current comment. + * @param array $args Optional. An array of arguments. Default empty array. + * @return string The comment content. + */ + function get_comment_text($comment_id = 0, $args = array()) + { + } + /** + * Displays the text of the current comment. + * + * @since 0.71 + * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. + * + * @see Walker_Comment::comment() + * + * @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to print the text. + * Default current comment. + * @param array $args Optional. An array of arguments. Default empty array. + */ + function comment_text($comment_id = 0, $args = array()) + { + } + /** + * Retrieves the comment time of the current comment. + * + * @since 1.5.0 + * @since 6.2.0 Added the `$comment_id` parameter. + * + * @param string $format Optional. PHP date format. Defaults to the 'time_format' option. + * @param bool $gmt Optional. Whether to use the GMT date. Default false. + * @param bool $translate Optional. Whether to translate the time (for use in feeds). + * Default true. + * @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to get the time. + * Default current comment. + * @return string The formatted time. + */ + function get_comment_time($format = '', $gmt = \false, $translate = \true, $comment_id = 0) + { + } + /** + * Displays the comment time of the current comment. + * + * @since 0.71 + * @since 6.2.0 Added the `$comment_id` parameter. + * + * @param string $format Optional. PHP time format. Defaults to the 'time_format' option. + * @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to print the time. + * Default current comment. + */ + function comment_time($format = '', $comment_id = 0) + { + } + /** + * Retrieves the comment type of the current comment. + * + * @since 1.5.0 + * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. + * + * @param int|WP_Comment $comment_id Optional. WP_Comment or ID of the comment for which to get the type. + * Default current comment. + * @return string The comment type. + */ + function get_comment_type($comment_id = 0) + { + } + /** + * Displays the comment type of the current comment. + * + * @since 0.71 + * + * @param string|false $commenttxt Optional. String to display for comment type. Default false. + * @param string|false $trackbacktxt Optional. String to display for trackback type. Default false. + * @param string|false $pingbacktxt Optional. String to display for pingback type. Default false. + */ + function comment_type($commenttxt = \false, $trackbacktxt = \false, $pingbacktxt = \false) + { + } + /** + * Retrieves the current post's trackback URL. + * + * There is a check to see if permalink's have been enabled and if so, will + * retrieve the pretty path. If permalinks weren't enabled, the ID of the + * current post is used and appended to the correct page to go to. + * + * @since 1.5.0 + * + * @return string The trackback URL after being filtered. + */ + function get_trackback_url() + { + } + /** + * Displays the current post's trackback URL. + * + * @since 0.71 + * + * @param bool $deprecated_echo Not used. + * @return void|string Should only be used to echo the trackback URL, use get_trackback_url() + * for the result instead. + */ + function trackback_url($deprecated_echo = \true) + { + } + /** + * Generates and displays the RDF for the trackback information of current post. + * + * Deprecated in 3.0.0, and restored in 3.0.1. + * + * @since 0.71 + * + * @param int|string $deprecated Not used (Was $timezone = 0). + * @phpstan-return void + */ + function trackback_rdf($deprecated = '') + { + } + /** + * Determines whether the current post is open for comments. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 1.5.0 + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post. + * @return bool True if the comments are open. + */ + function comments_open($post = \null) + { + } + /** + * Determines whether the current post is open for pings. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 1.5.0 + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post. + * @return bool True if pings are accepted + */ + function pings_open($post = \null) + { + } + /** + * Displays form token for unfiltered comments. + * + * Will only display nonce token if the current user has permissions for + * unfiltered html. Won't display the token for other users. + * + * The function was backported to 2.0.10 and was added to versions 2.1.3 and + * above. Does not exist in versions prior to 2.0.10 in the 2.0 branch and in + * the 2.1 branch, prior to 2.1.3. Technically added in 2.2.0. + * + * Backported to 2.0.10. + * + * @since 2.1.3 + */ + function wp_comment_form_unfiltered_html_nonce() + { + } + /** + * Loads the comment template specified in $file. + * + * Will not display the comments template if not on single post or page, or if + * the post does not have comments. + * + * Uses the WordPress database object to query for the comments. The comments + * are passed through the {@see 'comments_array'} filter hook with the list of comments + * and the post ID respectively. + * + * The `$file` path is passed through a filter hook called {@see 'comments_template'}, + * which includes the template directory and $file combined. Tries the $filtered path + * first and if it fails it will require the default comment template from the + * default theme. If either does not exist, then the WordPress process will be + * halted. It is advised for that reason, that the default theme is not deleted. + * + * Will not try to get the comments if the post has none. + * + * @since 1.5.0 + * + * @global WP_Query $wp_query WordPress Query object. + * @global WP_Post $post Global post object. + * @global wpdb $wpdb WordPress database abstraction object. + * @global int $id + * @global WP_Comment $comment Global comment object. + * @global string $user_login + * @global string $user_identity + * @global bool $overridden_cpage + * @global bool $withcomments + * @global string $wp_stylesheet_path Path to current theme's stylesheet directory. + * @global string $wp_template_path Path to current theme's template directory. + * + * @param string $file Optional. The file to load. Default '/comments.php'. + * @param bool $separate_comments Optional. Whether to separate the comments by comment type. + * Default false. + * @phpstan-return void + */ + function comments_template($file = '/comments.php', $separate_comments = \false) + { + } + /** + * Displays the link to the comments for the current post ID. + * + * @since 0.71 + * + * @param false|string $zero Optional. String to display when no comments. Default false. + * @param false|string $one Optional. String to display when only one comment is available. Default false. + * @param false|string $more Optional. String to display when there are more than one comment. Default false. + * @param string $css_class Optional. CSS class to use for comments. Default empty. + * @param false|string $none Optional. String to display when comments have been turned off. Default false. + * @phpstan-return void + */ + function comments_popup_link($zero = \false, $one = \false, $more = \false, $css_class = '', $none = \false) + { + } + /** + * Retrieves HTML content for reply to comment link. + * + * @since 2.7.0 + * @since 4.4.0 Added the ability for `$comment` to also accept a WP_Comment object. + * + * @param array $args { + * Optional. Override default arguments. + * + * @type string $add_below The first part of the selector used to identify the comment to respond below. + * The resulting value is passed as the first parameter to addComment.moveForm(), + * concatenated as $add_below-$comment->comment_ID. Default 'comment'. + * @type string $respond_id The selector identifying the responding comment. Passed as the third parameter + * to addComment.moveForm(), and appended to the link URL as a hash value. + * Default 'respond'. + * @type string $reply_text The text of the Reply link. Default 'Reply'. + * @type string $login_text The text of the link to reply if logged out. Default 'Log in to Reply'. + * @type int $max_depth The max depth of the comment tree. Default 0. + * @type int $depth The depth of the new comment. Must be greater than 0 and less than the value + * of the 'thread_comments_depth' option set in Settings > Discussion. Default 0. + * @type string $before The text or HTML to add before the reply link. Default empty. + * @type string $after The text or HTML to add after the reply link. Default empty. + * } + * @param int|WP_Comment $comment Optional. Comment being replied to. Default current comment. + * @param int|WP_Post $post Optional. Post ID or WP_Post object the comment is going to be displayed on. + * Default current post. + * @return string|false|null Link to show comment form, if successful. False, if comments are closed. + * @phpstan-param array{ + * add_below?: string, + * respond_id?: string, + * reply_text?: string, + * login_text?: string, + * max_depth?: int, + * depth?: int, + * before?: string, + * after?: string, + * } $args + */ + function get_comment_reply_link($args = array(), $comment = \null, $post = \null) + { + } + /** + * Displays the HTML content for reply to comment link. + * + * @since 2.7.0 + * + * @see get_comment_reply_link() + * + * @param array $args Optional. Override default options. Default empty array. + * @param int|WP_Comment $comment Optional. Comment being replied to. Default current comment. + * @param int|WP_Post $post Optional. Post ID or WP_Post object the comment is going to be displayed on. + * Default current post. + */ + function comment_reply_link($args = array(), $comment = \null, $post = \null) + { + } + /** + * Retrieves HTML content for reply to post link. + * + * @since 2.7.0 + * + * @param array $args { + * Optional. Override default arguments. + * + * @type string $add_below The first part of the selector used to identify the comment to respond below. + * The resulting value is passed as the first parameter to addComment.moveForm(), + * concatenated as $add_below-$comment->comment_ID. Default is 'post'. + * @type string $respond_id The selector identifying the responding comment. Passed as the third parameter + * to addComment.moveForm(), and appended to the link URL as a hash value. + * Default 'respond'. + * @type string $reply_text Text of the Reply link. Default is 'Leave a Comment'. + * @type string $login_text Text of the link to reply if logged out. Default is 'Log in to leave a Comment'. + * @type string $before Text or HTML to add before the reply link. Default empty. + * @type string $after Text or HTML to add after the reply link. Default empty. + * } + * @param int|WP_Post $post Optional. Post ID or WP_Post object the comment is going to be displayed on. + * Default current post. + * @return string|false|null Link to show comment form, if successful. False, if comments are closed. + * @phpstan-param array{ + * add_below?: string, + * respond_id?: string, + * reply_text?: string, + * login_text?: string, + * before?: string, + * after?: string, + * } $args + */ + function get_post_reply_link($args = array(), $post = \null) + { + } + /** + * Displays the HTML content for reply to post link. + * + * @since 2.7.0 + * + * @see get_post_reply_link() + * + * @param array $args Optional. Override default options. Default empty array. + * @param int|WP_Post $post Optional. Post ID or WP_Post object the comment is going to be displayed on. + * Default current post. + */ + function post_reply_link($args = array(), $post = \null) + { + } + /** + * Retrieves HTML content for cancel comment reply link. + * + * @since 2.7.0 + * @since 6.2.0 Added the `$post` parameter. + * + * @param string $link_text Optional. Text to display for cancel reply link. If empty, + * defaults to 'Click here to cancel reply'. Default empty. + * @param int|WP_Post|null $post Optional. The post the comment thread is being + * displayed for. Defaults to the current global post. + * @return string + */ + function get_cancel_comment_reply_link($link_text = '', $post = \null) + { + } + /** + * Displays HTML content for cancel comment reply link. + * + * @since 2.7.0 + * + * @param string $link_text Optional. Text to display for cancel reply link. If empty, + * defaults to 'Click here to cancel reply'. Default empty. + */ + function cancel_comment_reply_link($link_text = '') + { + } + /** + * Retrieves hidden input HTML for replying to comments. + * + * @since 3.0.0 + * @since 6.2.0 Renamed `$post_id` to `$post` and added WP_Post support. + * + * @param int|WP_Post|null $post Optional. The post the comment is being displayed for. + * Defaults to the current global post. + * @return string Hidden input HTML for replying to comments. + */ + function get_comment_id_fields($post = \null) + { + } + /** + * Outputs hidden input HTML for replying to comments. + * + * Adds two hidden inputs to the comment form to identify the `comment_post_ID` + * and `comment_parent` values for threaded comments. + * + * This tag must be within the `<form>` section of the `comments.php` template. + * + * @since 2.7.0 + * @since 6.2.0 Renamed `$post_id` to `$post` and added WP_Post support. + * + * @see get_comment_id_fields() + * + * @param int|WP_Post|null $post Optional. The post the comment is being displayed for. + * Defaults to the current global post. + */ + function comment_id_fields($post = \null) + { + } + /** + * Displays text based on comment reply status. + * + * Only affects users with JavaScript disabled. + * + * @internal The $comment global must be present to allow template tags access to the current + * comment. See https://core.trac.wordpress.org/changeset/36512. + * + * @since 2.7.0 + * @since 6.2.0 Added the `$post` parameter. + * + * @global WP_Comment $comment Global comment object. + * + * @param string|false $no_reply_text Optional. Text to display when not replying to a comment. + * Default false. + * @param string|false $reply_text Optional. Text to display when replying to a comment. + * Default false. Accepts "%s" for the author of the comment + * being replied to. + * @param bool $link_to_parent Optional. Boolean to control making the author's name a link + * to their comment. Default true. + * @param int|WP_Post|null $post Optional. The post that the comment form is being displayed for. + * Defaults to the current global post. + * @phpstan-return void + */ + function comment_form_title($no_reply_text = \false, $reply_text = \false, $link_to_parent = \true, $post = \null) + { + } + /** + * Gets the comment's reply to ID from the $_GET['replytocom']. + * + * @since 6.2.0 + * + * @access private + * + * @param int|WP_Post $post The post the comment is being displayed for. + * Defaults to the current global post. + * @return int Comment's reply to ID. + */ + function _get_comment_reply_id($post = \null) + { + } + /** + * Displays a list of comments. + * + * Used in the comments.php template to list comments for a particular post. + * + * @since 2.7.0 + * + * @see WP_Query::$comments + * + * @global WP_Query $wp_query WordPress Query object. + * @global int $comment_alt + * @global int $comment_depth + * @global int $comment_thread_alt + * @global bool $overridden_cpage + * @global bool $in_comment_loop + * + * @param string|array $args { + * Optional. Formatting options. + * + * @type object $walker Instance of a Walker class to list comments. Default null. + * @type int $max_depth The maximum comments depth. Default empty. + * @type string $style The style of list ordering. Accepts 'ul', 'ol', or 'div'. + * 'div' will result in no additional list markup. Default 'ul'. + * @type callable $callback Callback function to use. Default null. + * @type callable $end-callback Callback function to use at the end. Default null. + * @type string $type Type of comments to list. Accepts 'all', 'comment', + * 'pingback', 'trackback', 'pings'. Default 'all'. + * @type int $page Page ID to list comments for. Default empty. + * @type int $per_page Number of comments to list per page. Default empty. + * @type int $avatar_size Height and width dimensions of the avatar size. Default 32. + * @type bool $reverse_top_level Ordering of the listed comments. If true, will display + * newest comments first. Default null. + * @type bool $reverse_children Whether to reverse child comments in the list. Default null. + * @type string $format How to format the comments list. Accepts 'html5', 'xhtml'. + * Default 'html5' if the theme supports it. + * @type bool $short_ping Whether to output short pings. Default false. + * @type bool $echo Whether to echo the output or return it. Default true. + * } + * @param WP_Comment[] $comments Optional. Array of WP_Comment objects. Default null. + * @return void|string Void if 'echo' argument is true, or no comments to list. + * Otherwise, HTML list of comments. + * @phpstan-param array{ + * walker?: object, + * max_depth?: int, + * style?: string, + * callback?: callable, + * end-callback?: callable, + * type?: string, + * page?: int, + * per_page?: int, + * avatar_size?: int, + * reverse_top_level?: bool, + * reverse_children?: bool, + * format?: string, + * short_ping?: bool, + * echo?: bool, + * } $args + */ + function wp_list_comments($args = array(), $comments = \null) + { + } + /** + * Outputs a complete commenting form for use within a template. + * + * Most strings and form fields may be controlled through the `$args` array passed + * into the function, while you may also choose to use the {@see 'comment_form_default_fields'} + * filter to modify the array of default fields if you'd just like to add a new + * one or remove a single field. All fields are also individually passed through + * a filter of the {@see 'comment_form_field_$name'} where `$name` is the key used + * in the array of fields. + * + * @since 3.0.0 + * @since 4.1.0 Introduced the 'class_submit' argument. + * @since 4.2.0 Introduced the 'submit_button' and 'submit_fields' arguments. + * @since 4.4.0 Introduced the 'class_form', 'title_reply_before', 'title_reply_after', + * 'cancel_reply_before', and 'cancel_reply_after' arguments. + * @since 4.5.0 The 'author', 'email', and 'url' form fields are limited to 245, 100, + * and 200 characters, respectively. + * @since 4.6.0 Introduced the 'action' argument. + * @since 4.9.6 Introduced the 'cookies' default comment field. + * @since 5.5.0 Introduced the 'class_container' argument. + * + * @param array $args { + * Optional. Default arguments and form fields to override. + * + * @type array $fields { + * Default comment fields, filterable by default via the {@see 'comment_form_default_fields'} hook. + * + * @type string $author Comment author field HTML. + * @type string $email Comment author email field HTML. + * @type string $url Comment author URL field HTML. + * @type string $cookies Comment cookie opt-in field HTML. + * } + * @type string $comment_field The comment textarea field HTML. + * @type string $must_log_in HTML element for a 'must be logged in to comment' message. + * @type string $logged_in_as The HTML for the 'logged in as [user]' message, the Edit profile link, + * and the Log out link. + * @type string $comment_notes_before HTML element for a message displayed before the comment fields + * if the user is not logged in. + * Default 'Your email address will not be published.'. + * @type string $comment_notes_after HTML element for a message displayed after the textarea field. + * @type string $action The comment form element action attribute. Default '/wp-comments-post.php'. + * @type string $id_form The comment form element id attribute. Default 'commentform'. + * @type string $id_submit The comment submit element id attribute. Default 'submit'. + * @type string $class_container The comment form container class attribute. Default 'comment-respond'. + * @type string $class_form The comment form element class attribute. Default 'comment-form'. + * @type string $class_submit The comment submit element class attribute. Default 'submit'. + * @type string $name_submit The comment submit element name attribute. Default 'submit'. + * @type string $title_reply The translatable 'reply' button label. Default 'Leave a Reply'. + * @type string $title_reply_to The translatable 'reply-to' button label. Default 'Leave a Reply to %s', + * where %s is the author of the comment being replied to. + * @type string $title_reply_before HTML displayed before the comment form title. + * Default: '<h3 id="reply-title" class="comment-reply-title">'. + * @type string $title_reply_after HTML displayed after the comment form title. + * Default: '</h3>'. + * @type string $cancel_reply_before HTML displayed before the cancel reply link. + * @type string $cancel_reply_after HTML displayed after the cancel reply link. + * @type string $cancel_reply_link The translatable 'cancel reply' button label. Default 'Cancel reply'. + * @type string $label_submit The translatable 'submit' button label. Default 'Post a comment'. + * @type string $submit_button HTML format for the Submit button. + * Default: '<input name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s" />'. + * @type string $submit_field HTML format for the markup surrounding the Submit button and comment hidden + * fields. Default: '<p class="form-submit">%1$s %2$s</p>', where %1$s is the + * submit button markup and %2$s is the comment hidden fields. + * @type string $format The comment form format. Default 'xhtml'. Accepts 'xhtml', 'html5'. + * } + * @param int|WP_Post $post Optional. Post ID or WP_Post object to generate the form for. Default current post. + * @phpstan-param array{ + * fields?: array{ + * author: string, + * email: string, + * url: string, + * cookies: string, + * }, + * comment_field?: string, + * must_log_in?: string, + * logged_in_as?: string, + * comment_notes_before?: string, + * comment_notes_after?: string, + * action?: string, + * id_form?: string, + * id_submit?: string, + * class_container?: string, + * class_form?: string, + * class_submit?: string, + * name_submit?: string, + * title_reply?: string, + * title_reply_to?: string, + * title_reply_before?: string, + * title_reply_after?: string, + * cancel_reply_before?: string, + * cancel_reply_after?: string, + * cancel_reply_link?: string, + * label_submit?: string, + * submit_button?: string, + * submit_field?: string, + * format?: string, + * } $args + * @phpstan-return void + */ + function comment_form($args = array(), $post = \null) + { + } + /** + * Core Comment API + * + * @package WordPress + * @subpackage Comment + */ + /** + * Checks whether a comment passes internal checks to be allowed to add. + * + * If manual comment moderation is set in the administration, then all checks, + * regardless of their type and substance, will fail and the function will + * return false. + * + * If the number of links exceeds the amount in the administration, then the + * check fails. If any of the parameter contents contain any disallowed words, + * then the check fails. + * + * If the comment author was approved before, then the comment is automatically + * approved. + * + * If all checks pass, the function will return true. + * + * @since 1.2.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $author Comment author name. + * @param string $email Comment author email. + * @param string $url Comment author URL. + * @param string $comment Content of the comment. + * @param string $user_ip Comment author IP address. + * @param string $user_agent Comment author User-Agent. + * @param string $comment_type Comment type, either user-submitted comment, + * trackback, or pingback. + * @return bool If all checks pass, true, otherwise false. + */ + function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $comment_type) + { + } + /** + * Retrieves the approved comments for a post. + * + * @since 2.0.0 + * @since 4.1.0 Refactored to leverage WP_Comment_Query over a direct query. + * + * @param int $post_id The ID of the post. + * @param array $args { + * Optional. See WP_Comment_Query::__construct() for information on accepted arguments. + * + * @type int $status Comment status to limit results by. Defaults to approved comments. + * @type int $post_id Limit results to those affiliated with a given post ID. + * @type string $order How to order retrieved comments. Default 'ASC'. + * } + * @return WP_Comment[]|int[]|int The approved comments, or number of comments if `$count` + * argument is true. + * @phpstan-param array{ + * status?: int, + * post_id?: int, + * order?: string, + * author_email?: string, + * author_url?: string, + * author__in?: int[], + * author__not_in?: int[], + * comment__in?: int[], + * comment__not_in?: int[], + * count?: bool, + * date_query?: array, + * fields?: string, + * include_unapproved?: array, + * karma?: int, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * number?: int, + * paged?: int, + * offset?: int, + * no_found_rows?: bool, + * orderby?: string|array, + * order?: string, + * parent?: int, + * parent__in?: int[], + * parent__not_in?: int[], + * post_author__in?: int[], + * post_author__not_in?: int[], + * post_id?: int, + * post__in?: int[], + * post__not_in?: int[], + * post_author?: int, + * post_status?: string|string[], + * post_type?: string|string[], + * post_name?: string, + * post_parent?: int, + * search?: string, + * status?: string|array, + * type?: string|string[], + * type__in?: string[], + * type__not_in?: string[], + * user_id?: int, + * hierarchical?: bool|string, + * cache_domain?: string, + * update_comment_meta_cache?: bool, + * update_comment_post_cache?: bool, + * } $args + */ + function get_approved_comments($post_id, $args = array()) + { + } + /** + * Retrieves comment data given a comment ID or comment object. + * + * If an object is passed then the comment data will be cached and then returned + * after being passed through a filter. If the comment is empty, then the global + * comment variable will be used, if it is set. + * + * @since 2.0.0 + * + * @global WP_Comment $comment Global comment object. + * + * @param WP_Comment|string|int $comment Comment to retrieve. + * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which + * correspond to a WP_Comment object, an associative array, or a numeric array, + * respectively. Default OBJECT. + * @return WP_Comment|array|null Depends on $output value. + * @phpstan-param 'OBJECT'|'ARRAY_A'|'ARRAY_N' $output + * @phpstan-return ($comment is \WP_Comment ? array<array-key, mixed>|\WP_Comment : array<array-key, mixed>|\WP_Comment|null) & ($output is 'ARRAY_A' ? array<string, mixed>|null : ($output is 'ARRAY_N' ? array<int, mixed>|null : \WP_Comment|null)) + */ + function get_comment($comment = \null, $output = \OBJECT) + { + } + /** + * Retrieves a list of comments. + * + * The comment list can be for the blog as a whole or for an individual post. + * + * @since 2.7.0 + * + * @param string|array $args Optional. Array or string of arguments. See WP_Comment_Query::__construct() + * for information on accepted arguments. Default empty string. + * @return WP_Comment[]|int[]|int List of comments or number of found comments if `$count` argument is true. + * @phpstan-param array{ + * author_email?: string, + * author_url?: string, + * author__in?: int[], + * author__not_in?: int[], + * comment__in?: int[], + * comment__not_in?: int[], + * count?: bool, + * date_query?: array, + * fields?: string, + * include_unapproved?: array, + * karma?: int, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * number?: int, + * paged?: int, + * offset?: int, + * no_found_rows?: bool, + * orderby?: string|array, + * order?: string, + * parent?: int, + * parent__in?: int[], + * parent__not_in?: int[], + * post_author__in?: int[], + * post_author__not_in?: int[], + * post_id?: int, + * post__in?: int[], + * post__not_in?: int[], + * post_author?: int, + * post_status?: string|string[], + * post_type?: string|string[], + * post_name?: string, + * post_parent?: int, + * search?: string, + * status?: string|array, + * type?: string|string[], + * type__in?: string[], + * type__not_in?: string[], + * user_id?: int, + * hierarchical?: bool|string, + * cache_domain?: string, + * update_comment_meta_cache?: bool, + * update_comment_post_cache?: bool, + * } $args See WP_Comment_Query::__construct() + */ + function get_comments($args = '') + { + } + /** + * Retrieves all of the WordPress supported comment statuses. + * + * Comments have a limited set of valid status values, this provides the comment + * status values and descriptions. + * + * @since 2.7.0 + * + * @return string[] List of comment status labels keyed by status. + */ + function get_comment_statuses() + { + } + /** + * Gets the default comment status for a post type. + * + * @since 4.3.0 + * + * @param string $post_type Optional. Post type. Default 'post'. + * @param string $comment_type Optional. Comment type. Default 'comment'. + * @return string Either 'open' or 'closed'. + * @phpstan-return 'open'|'closed' + */ + function get_default_comment_status($post_type = 'post', $comment_type = 'comment') + { + } + /** + * Retrieves the date the last comment was modified. + * + * @since 1.5.0 + * @since 4.7.0 Replaced caching the modified date in a local static variable + * with the Object Cache API. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $timezone Which timezone to use in reference to 'gmt', 'blog', or 'server' locations. + * @return string|false Last comment modified date on success, false on failure. + */ + function get_lastcommentmodified($timezone = 'server') + { + } + /** + * Retrieves the total comment counts for the whole site or a single post. + * + * @since 2.0.0 + * + * @param int $post_id Optional. Restrict the comment counts to the given post. Default 0, which indicates that + * comment counts for the whole site will be retrieved. + * @return int[] { + * The number of comments keyed by their status. + * + * @type int $approved The number of approved comments. + * @type int $awaiting_moderation The number of comments awaiting moderation (a.k.a. pending). + * @type int $spam The number of spam comments. + * @type int $trash The number of trashed comments. + * @type int $post-trashed The number of comments for posts that are in the trash. + * @type int $total_comments The total number of non-trashed comments, including spam. + * @type int $all The total number of pending or approved comments. + * } + * @phpstan-return array{ + * approved: int, + * awaiting_moderation: int, + * spam: int, + * trash: int, + * post-trashed: int, + * total_comments: int, + * all: int, + * } + */ + function get_comment_count($post_id = 0) + { + } + // + // Comment meta functions. + // + /** + * Adds meta data field to a comment. + * + * @since 2.9.0 + * + * @link https://developer.wordpress.org/reference/functions/add_comment_meta/ + * + * @param int $comment_id Comment ID. + * @param string $meta_key Metadata name. + * @param mixed $meta_value Metadata value. Must be serializable if non-scalar. + * @param bool $unique Optional. Whether the same key should not be added. + * Default false. + * @return int|false Meta ID on success, false on failure. + */ + function add_comment_meta($comment_id, $meta_key, $meta_value, $unique = \false) + { + } + /** + * Removes metadata matching criteria from a comment. + * + * You can match based on the key, or key and value. Removing based on key and + * value, will keep from removing duplicate metadata with the same key. It also + * allows removing all metadata matching key, if needed. + * + * @since 2.9.0 + * + * @link https://developer.wordpress.org/reference/functions/delete_comment_meta/ + * + * @param int $comment_id Comment ID. + * @param string $meta_key Metadata name. + * @param mixed $meta_value Optional. Metadata value. If provided, + * rows will only be removed that match the value. + * Must be serializable if non-scalar. Default empty string. + * @return bool True on success, false on failure. + */ + function delete_comment_meta($comment_id, $meta_key, $meta_value = '') + { + } + /** + * Retrieves comment meta field for a comment. + * + * @since 2.9.0 + * + * @link https://developer.wordpress.org/reference/functions/get_comment_meta/ + * + * @param int $comment_id Comment ID. + * @param string $key Optional. The meta key to retrieve. By default, + * returns data for all keys. Default empty string. + * @param bool $single Optional. Whether to return a single value. + * This parameter has no effect if `$key` is not specified. + * Default false. + * @return mixed An array of values if `$single` is false. + * The value of meta data field if `$single` is true. + * False for an invalid `$comment_id` (non-numeric, zero, or negative value). + * An empty string if a valid but non-existing comment ID is passed. + */ + function get_comment_meta($comment_id, $key = '', $single = \false) + { + } + /** + * Queue comment meta for lazy-loading. + * + * @since 6.3.0 + * + * @param array $comment_ids List of comment IDs. + * @phpstan-return void + */ + function wp_lazyload_comment_meta(array $comment_ids) + { + } + /** + * Updates comment meta field based on comment ID. + * + * Use the $prev_value parameter to differentiate between meta fields with the + * same key and comment ID. + * + * If the meta field for the comment does not exist, it will be added. + * + * @since 2.9.0 + * + * @link https://developer.wordpress.org/reference/functions/update_comment_meta/ + * + * @param int $comment_id Comment ID. + * @param string $meta_key Metadata key. + * @param mixed $meta_value Metadata value. Must be serializable if non-scalar. + * @param mixed $prev_value Optional. Previous value to check before updating. + * If specified, only update existing metadata entries with + * this value. Otherwise, update all entries. Default empty string. + * @return int|bool Meta ID if the key didn't exist, true on successful update, + * false on failure or if the value passed to the function + * is the same as the one that is already in the database. + */ + function update_comment_meta($comment_id, $meta_key, $meta_value, $prev_value = '') + { + } + /** + * Sets the cookies used to store an unauthenticated commentator's identity. Typically used + * to recall previous comments by this commentator that are still held in moderation. + * + * @since 3.4.0 + * @since 4.9.6 The `$cookies_consent` parameter was added. + * + * @param WP_Comment $comment Comment object. + * @param WP_User $user Comment author's user object. The user may not exist. + * @param bool $cookies_consent Optional. Comment author's consent to store cookies. Default true. + * @phpstan-return void + */ + function wp_set_comment_cookies($comment, $user, $cookies_consent = \true) + { + } + /** + * Sanitizes the cookies sent to the user already. + * + * Will only do anything if the cookies have already been created for the user. + * Mostly used after cookies had been sent to use elsewhere. + * + * @since 2.0.4 + */ + function sanitize_comment_cookies() + { + } + /** + * Validates whether this comment is allowed to be made. + * + * @since 2.0.0 + * @since 4.7.0 The `$avoid_die` parameter was added, allowing the function + * to return a WP_Error object instead of dying. + * @since 5.5.0 The `$avoid_die` parameter was renamed to `$wp_error`. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array $commentdata Contains information on the comment. + * @param bool $wp_error When true, a disallowed comment will result in the function + * returning a WP_Error object, rather than executing wp_die(). + * Default false. + * @return int|string|WP_Error Allowed comments return the approval status (0|1|'spam'|'trash'). + * If `$wp_error` is true, disallowed comments return a WP_Error. + */ + function wp_allow_comment($commentdata, $wp_error = \false) + { + } + /** + * Hooks WP's native database-based comment-flood check. + * + * This wrapper maintains backward compatibility with plugins that expect to + * be able to unhook the legacy check_comment_flood_db() function from + * 'check_comment_flood' using remove_action(). + * + * @since 2.3.0 + * @since 4.7.0 Converted to be an add_filter() wrapper. + */ + function check_comment_flood_db() + { + } + /** + * Checks whether comment flooding is occurring. + * + * Won't run, if current user can manage options, so to not block + * administrators. + * + * @since 4.7.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param bool $is_flood Is a comment flooding occurring? + * @param string $ip Comment author's IP address. + * @param string $email Comment author's email address. + * @param string $date MySQL time string. + * @param bool $avoid_die When true, a disallowed comment will result in the function + * returning without executing wp_die() or die(). Default false. + * @return bool Whether comment flooding is occurring. + */ + function wp_check_comment_flood($is_flood, $ip, $email, $date, $avoid_die = \false) + { + } + /** + * Separates an array of comments into an array keyed by comment_type. + * + * @since 2.7.0 + * + * @param WP_Comment[] $comments Array of comments + * @return WP_Comment[] Array of comments keyed by comment_type. + */ + function separate_comments(&$comments) + { + } + /** + * Calculates the total number of comment pages. + * + * @since 2.7.0 + * + * @uses Walker_Comment + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param WP_Comment[] $comments Optional. Array of WP_Comment objects. Defaults to `$wp_query->comments`. + * @param int $per_page Optional. Comments per page. Defaults to the value of `comments_per_page` + * query var, option of the same name, or 1 (in that order). + * @param bool $threaded Optional. Control over flat or threaded comments. Defaults to the value + * of `thread_comments` option. + * @return int Number of comment pages. + */ + function get_comment_pages_count($comments = \null, $per_page = \null, $threaded = \null) + { + } + /** + * Calculates what page number a comment will appear on for comment paging. + * + * @since 2.7.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $comment_id Comment ID. + * @param array $args { + * Array of optional arguments. + * + * @type string $type Limit paginated comments to those matching a given type. + * Accepts 'comment', 'trackback', 'pingback', 'pings' + * (trackbacks and pingbacks), or 'all'. Default 'all'. + * @type int $per_page Per-page count to use when calculating pagination. + * Defaults to the value of the 'comments_per_page' option. + * @type int|string $max_depth If greater than 1, comment page will be determined + * for the top-level parent `$comment_id`. + * Defaults to the value of the 'thread_comments_depth' option. + * } + * @return int|null Comment page number or null on error. + * @phpstan-param array{ + * type?: string, + * per_page?: int, + * max_depth?: int|string, + * } $args + */ + function get_page_of_comment($comment_id, $args = array()) + { + } + /** + * Retrieves the maximum character lengths for the comment form fields. + * + * @since 4.5.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return int[] Array of maximum lengths keyed by field name. + */ + function wp_get_comment_fields_max_lengths() + { + } + /** + * Compares the lengths of comment data against the maximum character limits. + * + * @since 4.7.0 + * + * @param array $comment_data Array of arguments for inserting a comment. + * @return WP_Error|true WP_Error when a comment field exceeds the limit, + * otherwise true. + */ + function wp_check_comment_data_max_lengths($comment_data) + { + } + /** + * Checks if a comment contains disallowed characters or words. + * + * @since 5.5.0 + * + * @param string $author The author of the comment + * @param string $email The email of the comment + * @param string $url The url used in the comment + * @param string $comment The comment content + * @param string $user_ip The comment author's IP address + * @param string $user_agent The author's browser user agent + * @return bool True if comment contains disallowed content, false if comment does not + */ + function wp_check_comment_disallowed_list($author, $email, $url, $comment, $user_ip, $user_agent) + { + } + /** + * Retrieves the total comment counts for the whole site or a single post. + * + * The comment stats are cached and then retrieved, if they already exist in the + * cache. + * + * @see get_comment_count() Which handles fetching the live comment counts. + * + * @since 2.5.0 + * + * @param int $post_id Optional. Restrict the comment counts to the given post. Default 0, which indicates that + * comment counts for the whole site will be retrieved. + * @return stdClass { + * The number of comments keyed by their status. + * + * @type int $approved The number of approved comments. + * @type int $moderated The number of comments awaiting moderation (a.k.a. pending). + * @type int $spam The number of spam comments. + * @type int $trash The number of trashed comments. + * @type int $post-trashed The number of comments for posts that are in the trash. + * @type int $total_comments The total number of non-trashed comments, including spam. + * @type int $all The total number of pending or approved comments. + * } + * @phpstan-return object{ + * approved: int, + * moderated: int, + * spam: int, + * trash: int, + * post-trashed: int, + * total_comments: int, + * all: int, + * } + */ + function wp_count_comments($post_id = 0) + { + } + /** + * Trashes or deletes a comment. + * + * The comment is moved to Trash instead of permanently deleted unless Trash is + * disabled, item is already in the Trash, or $force_delete is true. + * + * The post comment count will be updated if the comment was approved and has a + * post ID available. + * + * @since 2.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int|WP_Comment $comment_id Comment ID or WP_Comment object. + * @param bool $force_delete Whether to bypass Trash and force deletion. Default false. + * @return bool True on success, false on failure. + */ + function wp_delete_comment($comment_id, $force_delete = \false) + { + } + /** + * Moves a comment to the Trash + * + * If Trash is disabled, comment is permanently deleted. + * + * @since 2.9.0 + * + * @param int|WP_Comment $comment_id Comment ID or WP_Comment object. + * @return bool True on success, false on failure. + */ + function wp_trash_comment($comment_id) + { + } + /** + * Removes a comment from the Trash + * + * @since 2.9.0 + * + * @param int|WP_Comment $comment_id Comment ID or WP_Comment object. + * @return bool True on success, false on failure. + */ + function wp_untrash_comment($comment_id) + { + } + /** + * Marks a comment as Spam. + * + * @since 2.9.0 + * + * @param int|WP_Comment $comment_id Comment ID or WP_Comment object. + * @return bool True on success, false on failure. + */ + function wp_spam_comment($comment_id) + { + } + /** + * Removes a comment from the Spam. + * + * @since 2.9.0 + * + * @param int|WP_Comment $comment_id Comment ID or WP_Comment object. + * @return bool True on success, false on failure. + */ + function wp_unspam_comment($comment_id) + { + } + /** + * Retrieves the status of a comment by comment ID. + * + * @since 1.0.0 + * + * @param int|WP_Comment $comment_id Comment ID or WP_Comment object + * @return string|false Status might be 'trash', 'approved', 'unapproved', 'spam'. False on failure. + */ + function wp_get_comment_status($comment_id) + { + } + /** + * Calls hooks for when a comment status transition occurs. + * + * Calls hooks for comment status transitions. If the new comment status is not the same + * as the previous comment status, then two hooks will be ran, the first is + * {@see 'transition_comment_status'} with new status, old status, and comment data. + * The next action called is {@see 'comment_$old_status_to_$new_status'}. It has + * the comment data. + * + * The final action will run whether or not the comment statuses are the same. + * The action is named {@see 'comment_$new_status_$comment->comment_type'}. + * + * @since 2.7.0 + * + * @param string $new_status New comment status. + * @param string $old_status Previous comment status. + * @param WP_Comment $comment Comment object. + */ + function wp_transition_comment_status($new_status, $old_status, $comment) + { + } + /** + * Clears the lastcommentmodified cached value when a comment status is changed. + * + * Deletes the lastcommentmodified cache key when a comment enters or leaves + * 'approved' status. + * + * @since 4.7.0 + * @access private + * + * @param string $new_status The new comment status. + * @param string $old_status The old comment status. + */ + function _clear_modified_cache_on_transition_comment_status($new_status, $old_status) + { + } + /** + * Gets current commenter's name, email, and URL. + * + * Expects cookies content to already be sanitized. User of this function might + * wish to recheck the returned array for validity. + * + * @see sanitize_comment_cookies() Use to sanitize cookies + * + * @since 2.0.4 + * + * @return array { + * An array of current commenter variables. + * + * @type string $comment_author The name of the current commenter, or an empty string. + * @type string $comment_author_email The email address of the current commenter, or an empty string. + * @type string $comment_author_url The URL address of the current commenter, or an empty string. + * } + * @phpstan-return array{ + * comment_author: string, + * comment_author_email: string, + * comment_author_url: string, + * } + */ + function wp_get_current_commenter() + { + } + /** + * Gets unapproved comment author's email. + * + * Used to allow the commenter to see their pending comment. + * + * @since 5.1.0 + * @since 5.7.0 The window within which the author email for an unapproved comment + * can be retrieved was extended to 10 minutes. + * + * @return string The unapproved comment author's email (when supplied). + */ + function wp_get_unapproved_comment_author_email() + { + } + /** + * Inserts a comment into the database. + * + * @since 2.0.0 + * @since 4.4.0 Introduced the `$comment_meta` argument. + * @since 5.5.0 Default value for `$comment_type` argument changed to `comment`. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array $commentdata { + * Array of arguments for inserting a new comment. + * + * @type string $comment_agent The HTTP user agent of the `$comment_author` when + * the comment was submitted. Default empty. + * @type int|string $comment_approved Whether the comment has been approved. Default 1. + * @type string $comment_author The name of the author of the comment. Default empty. + * @type string $comment_author_email The email address of the `$comment_author`. Default empty. + * @type string $comment_author_IP The IP address of the `$comment_author`. Default empty. + * @type string $comment_author_url The URL address of the `$comment_author`. Default empty. + * @type string $comment_content The content of the comment. Default empty. + * @type string $comment_date The date the comment was submitted. To set the date + * manually, `$comment_date_gmt` must also be specified. + * Default is the current time. + * @type string $comment_date_gmt The date the comment was submitted in the GMT timezone. + * Default is `$comment_date` in the site's GMT timezone. + * @type int $comment_karma The karma of the comment. Default 0. + * @type int $comment_parent ID of this comment's parent, if any. Default 0. + * @type int $comment_post_ID ID of the post that relates to the comment, if any. + * Default 0. + * @type string $comment_type Comment type. Default 'comment'. + * @type array $comment_meta Optional. Array of key/value pairs to be stored in commentmeta for the + * new comment. + * @type int $user_id ID of the user who submitted the comment. Default 0. + * } + * @return int|false The new comment's ID on success, false on failure. + * @phpstan-param array{ + * comment_agent?: string, + * comment_approved?: int|string, + * comment_author?: string, + * comment_author_email?: string, + * comment_author_IP?: string, + * comment_author_url?: string, + * comment_content?: string, + * comment_date?: string, + * comment_date_gmt?: string, + * comment_karma?: int, + * comment_parent?: int, + * comment_post_ID?: int, + * comment_type?: string, + * comment_meta?: array, + * user_id?: int, + * } $commentdata + */ + function wp_insert_comment($commentdata) + { + } + /** + * Filters and sanitizes comment data. + * + * Sets the comment data 'filtered' field to true when finished. This can be + * checked as to whether the comment should be filtered and to keep from + * filtering the same comment more than once. + * + * @since 2.0.0 + * + * @param array $commentdata Contains information on the comment. + * @return array Parsed comment information. + */ + function wp_filter_comment($commentdata) + { + } + /** + * Determines whether a comment should be blocked because of comment flood. + * + * @since 2.1.0 + * + * @param bool $block Whether plugin has already blocked comment. + * @param int $time_lastcomment Timestamp for last comment. + * @param int $time_newcomment Timestamp for new comment. + * @return bool Whether comment should be blocked. + */ + function wp_throttle_comment_flood($block, $time_lastcomment, $time_newcomment) + { + } + /** + * Adds a new comment to the database. + * + * Filters new comment to ensure that the fields are sanitized and valid before + * inserting comment into database. Calls {@see 'comment_post'} action with comment ID + * and whether comment is approved by WordPress. Also has {@see 'preprocess_comment'} + * filter for processing the comment data before the function handles it. + * + * We use `REMOTE_ADDR` here directly. If you are behind a proxy, you should ensure + * that it is properly set, such as in wp-config.php, for your environment. + * + * See {@link https://core.trac.wordpress.org/ticket/9235} + * + * @since 1.5.0 + * @since 4.3.0 Introduced the `comment_agent` and `comment_author_IP` arguments. + * @since 4.7.0 The `$avoid_die` parameter was added, allowing the function + * to return a WP_Error object instead of dying. + * @since 5.5.0 The `$avoid_die` parameter was renamed to `$wp_error`. + * @since 5.5.0 Introduced the `comment_type` argument. + * + * @see wp_insert_comment() + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array $commentdata { + * Comment data. + * + * @type string $comment_author The name of the comment author. + * @type string $comment_author_email The comment author email address. + * @type string $comment_author_url The comment author URL. + * @type string $comment_content The content of the comment. + * @type string $comment_date The date the comment was submitted. Default is the current time. + * @type string $comment_date_gmt The date the comment was submitted in the GMT timezone. + * Default is `$comment_date` in the GMT timezone. + * @type string $comment_type Comment type. Default 'comment'. + * @type int $comment_parent The ID of this comment's parent, if any. Default 0. + * @type int $comment_post_ID The ID of the post that relates to the comment. + * @type int $user_id The ID of the user who submitted the comment. Default 0. + * @type int $user_ID Kept for backward-compatibility. Use `$user_id` instead. + * @type string $comment_agent Comment author user agent. Default is the value of 'HTTP_USER_AGENT' + * in the `$_SERVER` superglobal sent in the original request. + * @type string $comment_author_IP Comment author IP address in IPv4 format. Default is the value of + * 'REMOTE_ADDR' in the `$_SERVER` superglobal sent in the original request. + * } + * @param bool $wp_error Should errors be returned as WP_Error objects instead of + * executing wp_die()? Default false. + * @return int|false|WP_Error The ID of the comment on success, false or WP_Error on failure. + * @phpstan-param array{ + * comment_author?: string, + * comment_author_email?: string, + * comment_author_url?: string, + * comment_content?: string, + * comment_date?: string, + * comment_date_gmt?: string, + * comment_type?: string, + * comment_parent?: int, + * comment_post_ID?: int, + * user_id?: int, + * user_ID?: int, + * comment_agent?: string, + * comment_author_IP?: string, + * } $commentdata + */ + function wp_new_comment($commentdata, $wp_error = \false) + { + } + /** + * Sends a comment moderation notification to the comment moderator. + * + * @since 4.4.0 + * + * @param int $comment_id ID of the comment. + * @return bool True on success, false on failure. + */ + function wp_new_comment_notify_moderator($comment_id) + { + } + /** + * Sends a notification of a new comment to the post author. + * + * @since 4.4.0 + * + * Uses the {@see 'notify_post_author'} filter to determine whether the post author + * should be notified when a new comment is added, overriding site setting. + * + * @param int $comment_id Comment ID. + * @return bool True on success, false on failure. + */ + function wp_new_comment_notify_postauthor($comment_id) + { + } + /** + * Sets the status of a comment. + * + * The {@see 'wp_set_comment_status'} action is called after the comment is handled. + * If the comment status is not in the list, then false is returned. + * + * @since 1.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int|WP_Comment $comment_id Comment ID or WP_Comment object. + * @param string $comment_status New comment status, either 'hold', 'approve', 'spam', or 'trash'. + * @param bool $wp_error Whether to return a WP_Error object if there is a failure. Default false. + * @return bool|WP_Error True on success, false or WP_Error on failure. + * @phpstan-param 'hold'|'approve'|'spam'|'trash' $comment_status + * @phpstan-return ($wp_error is false ? bool : true|\WP_Error) + */ + function wp_set_comment_status($comment_id, $comment_status, $wp_error = \false) + { + } + /** + * Updates an existing comment in the database. + * + * Filters the comment and makes sure certain fields are valid before updating. + * + * @since 2.0.0 + * @since 4.9.0 Add updating comment meta during comment update. + * @since 5.5.0 The `$wp_error` parameter was added. + * @since 5.5.0 The return values for an invalid comment or post ID + * were changed to false instead of 0. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array $commentarr Contains information on the comment. + * @param bool $wp_error Optional. Whether to return a WP_Error on failure. Default false. + * @return int|false|WP_Error The value 1 if the comment was updated, 0 if not updated. + * False or a WP_Error object on failure. + * @phpstan-return ($wp_error is false ? 0|1|false : 0|1|\WP_Error) + */ + function wp_update_comment($commentarr, $wp_error = \false) + { + } + /** + * Determines whether to defer comment counting. + * + * When setting $defer to true, all post comment counts will not be updated + * until $defer is set to false. When $defer is set to false, then all + * previously deferred updated post comment counts will then be automatically + * updated without having to call wp_update_comment_count() after. + * + * @since 2.5.0 + * + * @param bool $defer + * @return bool + */ + function wp_defer_comment_counting($defer = \null) + { + } + /** + * Updates the comment count for post(s). + * + * When $do_deferred is false (is by default) and the comments have been set to + * be deferred, the post_id will be added to a queue, which will be updated at a + * later date and only updated once per post ID. + * + * If the comments have not be set up to be deferred, then the post will be + * updated. When $do_deferred is set to true, then all previous deferred post + * IDs will be updated along with the current $post_id. + * + * @since 2.1.0 + * + * @see wp_update_comment_count_now() For what could cause a false return value + * + * @param int|null $post_id Post ID. + * @param bool $do_deferred Optional. Whether to process previously deferred + * post comment counts. Default false. + * @return bool|void True on success, false on failure or if post with ID does + * not exist. + */ + function wp_update_comment_count($post_id, $do_deferred = \false) + { + } + /** + * Updates the comment count for the post. + * + * @since 2.5.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $post_id Post ID + * @return bool True on success, false if the post does not exist. + */ + function wp_update_comment_count_now($post_id) + { + } + // + // Ping and trackback functions. + // + /** + * Finds a pingback server URI based on the given URL. + * + * Checks the HTML for the rel="pingback" link and X-Pingback headers. It does + * a check for the X-Pingback headers first and returns that, if available. + * The check for the rel="pingback" has more overhead than just the header. + * + * @since 1.5.0 + * + * @param string $url URL to ping. + * @param string $deprecated Not Used. + * @return string|false String containing URI on success, false on failure. + */ + function discover_pingback_server_uri($url, $deprecated = '') + { + } + /** + * Performs all pingbacks, enclosures, trackbacks, and sends to pingback services. + * + * @since 2.1.0 + * @since 5.6.0 Introduced `do_all_pings` action hook for individual services. + */ + function do_all_pings() + { + } + /** + * Performs all pingbacks. + * + * @since 5.6.0 + */ + function do_all_pingbacks() + { + } + /** + * Performs all enclosures. + * + * @since 5.6.0 + */ + function do_all_enclosures() + { + } + /** + * Performs all trackbacks. + * + * @since 5.6.0 + */ + function do_all_trackbacks() + { + } + /** + * Performs trackbacks. + * + * @since 1.5.0 + * @since 4.7.0 `$post` can be a WP_Post object. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int|WP_Post $post Post ID or object to do trackbacks on. + * @return void|false Returns false on failure. + */ + function do_trackbacks($post) + { + } + /** + * Sends pings to all of the ping site services. + * + * @since 1.2.0 + * + * @param int $post_id Post ID. + * @return int Same post ID as provided. + */ + function generic_ping($post_id = 0) + { + } + /** + * Pings back the links found in a post. + * + * @since 0.71 + * @since 4.7.0 `$post` can be a WP_Post object. + * + * @param string $content Post content to check for links. If empty will retrieve from post. + * @param int|WP_Post $post Post ID or object. + * @phpstan-return void + */ + function pingback($content, $post) + { + } + /** + * Checks whether blog is public before returning sites. + * + * @since 2.1.0 + * + * @param mixed $sites Will return if blog is public, will not return if not public. + * @return mixed Empty string if blog is not public, returns $sites, if site is public. + */ + function privacy_ping_filter($sites) + { + } + /** + * Sends a Trackback. + * + * Updates database when sending trackback to prevent duplicates. + * + * @since 0.71 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $trackback_url URL to send trackbacks. + * @param string $title Title of post. + * @param string $excerpt Excerpt of post. + * @param int $post_id Post ID. + * @return int|false|void Database query from update. + */ + function trackback($trackback_url, $title, $excerpt, $post_id) + { + } + /** + * Sends a pingback. + * + * @since 1.2.0 + * + * @param string $server Host of blog to connect to. + * @param string $path Path to send the ping. + */ + function weblog_ping($server = '', $path = '') + { + } + /** + * Default filter attached to pingback_ping_source_uri to validate the pingback's Source URI. + * + * @since 3.5.1 + * + * @see wp_http_validate_url() + * + * @param string $source_uri + * @return string + */ + function pingback_ping_source_uri($source_uri) + { + } + /** + * Default filter attached to xmlrpc_pingback_error. + * + * Returns a generic pingback error code unless the error code is 48, + * which reports that the pingback is already registered. + * + * @since 3.5.1 + * + * @link https://www.hixie.ch/specs/pingback/pingback#TOC3 + * + * @param IXR_Error $ixr_error + * @return IXR_Error + */ + function xmlrpc_pingback_error($ixr_error) + { + } + // + // Cache. + // + /** + * Removes a comment from the object cache. + * + * @since 2.3.0 + * + * @param int|array $ids Comment ID or an array of comment IDs to remove from cache. + */ + function clean_comment_cache($ids) + { + } + /** + * Updates the comment cache of given comments. + * + * Will add the comments in $comments to the cache. If comment ID already exists + * in the comment cache then it will not be updated. The comment is added to the + * cache using the comment group with the key using the ID of the comments. + * + * @since 2.3.0 + * @since 4.4.0 Introduced the `$update_meta_cache` parameter. + * + * @param WP_Comment[] $comments Array of comment objects + * @param bool $update_meta_cache Whether to update commentmeta cache. Default true. + */ + function update_comment_cache($comments, $update_meta_cache = \true) + { + } + /** + * Adds any comments from the given IDs to the cache that do not already exist in cache. + * + * @since 4.4.0 + * @since 6.1.0 This function is no longer marked as "private". + * @since 6.3.0 Use wp_lazyload_comment_meta() for lazy-loading of comment meta. + * + * @see update_comment_cache() + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int[] $comment_ids Array of comment IDs. + * @param bool $update_meta_cache Optional. Whether to update the meta cache. Default true. + */ + function _prime_comment_caches($comment_ids, $update_meta_cache = \true) + { + } + // + // Internal. + // + /** + * Closes comments on old posts on the fly, without any extra DB queries. Hooked to the_posts. + * + * @since 2.7.0 + * @access private + * + * @param WP_Post $posts Post data object. + * @param WP_Query $query Query object. + * @return array + */ + function _close_comments_for_old_posts($posts, $query) + { + } + /** + * Closes comments on an old post. Hooked to comments_open and pings_open. + * + * @since 2.7.0 + * @access private + * + * @param bool $open Comments open or closed. + * @param int $post_id Post ID. + * @return bool $open + */ + function _close_comments_for_old_post($open, $post_id) + { + } + /** + * Handles the submission of a comment, usually posted to wp-comments-post.php via a comment form. + * + * This function expects unslashed data, as opposed to functions such as `wp_new_comment()` which + * expect slashed data. + * + * @since 4.4.0 + * + * @param array $comment_data { + * Comment data. + * + * @type string|int $comment_post_ID The ID of the post that relates to the comment. + * @type string $author The name of the comment author. + * @type string $email The comment author email address. + * @type string $url The comment author URL. + * @type string $comment The content of the comment. + * @type string|int $comment_parent The ID of this comment's parent, if any. Default 0. + * @type string $_wp_unfiltered_html_comment The nonce value for allowing unfiltered HTML. + * } + * @return WP_Comment|WP_Error A WP_Comment object on success, a WP_Error object on failure. + * @phpstan-param array{ + * comment_post_ID?: string|int, + * author?: string, + * email?: string, + * url?: string, + * comment?: string, + * comment_parent?: string|int, + * _wp_unfiltered_html_comment?: string, + * } $comment_data + */ + function wp_handle_comment_submission($comment_data) + { + } + /** + * Registers the personal data exporter for comments. + * + * @since 4.9.6 + * + * @param array[] $exporters An array of personal data exporters. + * @return array[] An array of personal data exporters. + */ + function wp_register_comment_personal_data_exporter($exporters) + { + } + /** + * Finds and exports personal data associated with an email address from the comments table. + * + * @since 4.9.6 + * + * @param string $email_address The comment author email address. + * @param int $page Comment page number. + * @return array { + * An array of personal data. + * + * @type array[] $data An array of personal data arrays. + * @type bool $done Whether the exporter is finished. + * } + * @phpstan-return array{ + * data: array[], + * done: bool, + * } + */ + function wp_comments_personal_data_exporter($email_address, $page = 1) + { + } + /** + * Registers the personal data eraser for comments. + * + * @since 4.9.6 + * + * @param array $erasers An array of personal data erasers. + * @return array An array of personal data erasers. + */ + function wp_register_comment_personal_data_eraser($erasers) + { + } + /** + * Erases personal data associated with an email address from the comments table. + * + * @since 4.9.6 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $email_address The comment author email address. + * @param int $page Comment page number. + * @return array { + * Data removal results. + * + * @type bool $items_removed Whether items were actually removed. + * @type bool $items_retained Whether items were retained. + * @type string[] $messages An array of messages to add to the personal data export file. + * @type bool $done Whether the eraser is finished. + * } + * @phpstan-return array{ + * items_removed: bool, + * items_retained: bool, + * messages: string[], + * done: bool, + * } + */ + function wp_comments_personal_data_eraser($email_address, $page = 1) + { + } + /** + * Sets the last changed time for the 'comment' cache group. + * + * @since 5.0.0 + */ + function wp_cache_set_comments_last_changed() + { + } + /** + * Updates the comment type for a batch of comments. + * + * @since 5.5.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * @phpstan-return void + */ + function _wp_batch_update_comment_type() + { + } + /** + * In order to avoid the _wp_batch_update_comment_type() job being accidentally removed, + * check that it's still scheduled while we haven't finished updating comment types. + * + * @ignore + * @since 5.5.0 + */ + function _wp_check_for_scheduled_update_comment_type() + { + } + /** + * WordPress Cron API + * + * @package WordPress + */ + /** + * Schedules an event to run only once. + * + * Schedules a hook which will be triggered by WordPress at the specified UTC time. + * The action will trigger when someone visits your WordPress site if the scheduled + * time has passed. + * + * Note that scheduling an event to occur within 10 minutes of an existing event + * with the same action hook will be ignored unless you pass unique `$args` values + * for each scheduled event. + * + * Use wp_next_scheduled() to prevent duplicate events. + * + * Use wp_schedule_event() to schedule a recurring event. + * + * @since 2.1.0 + * @since 5.1.0 Return value modified to boolean indicating success or failure, + * {@see 'pre_schedule_event'} filter added to short-circuit the function. + * @since 5.7.0 The `$wp_error` parameter was added. + * + * @link https://developer.wordpress.org/reference/functions/wp_schedule_single_event/ + * + * @param int $timestamp Unix timestamp (UTC) for when to next run the event. + * @param string $hook Action hook to execute when the event is run. + * @param array $args Optional. Array containing arguments to pass to the + * hook's callback function. Each value in the array + * is passed to the callback as an individual parameter. + * The array keys are ignored. Default empty array. + * @param bool $wp_error Optional. Whether to return a WP_Error on failure. Default false. + * @return bool|WP_Error True if event successfully scheduled. False or WP_Error on failure. + * @phpstan-param list<mixed> $args + * @phpstan-return ($wp_error is false ? bool : true|\WP_Error) + */ + function wp_schedule_single_event($timestamp, $hook, $args = array(), $wp_error = \false) + { + } + /** + * Schedules a recurring event. + * + * Schedules a hook which will be triggered by WordPress at the specified interval. + * The action will trigger when someone visits your WordPress site if the scheduled + * time has passed. + * + * Valid values for the recurrence are 'hourly', 'twicedaily', 'daily', and 'weekly'. + * These can be extended using the {@see 'cron_schedules'} filter in wp_get_schedules(). + * + * Use wp_next_scheduled() to prevent duplicate events. + * + * Use wp_schedule_single_event() to schedule a non-recurring event. + * + * @since 2.1.0 + * @since 5.1.0 Return value modified to boolean indicating success or failure, + * {@see 'pre_schedule_event'} filter added to short-circuit the function. + * @since 5.7.0 The `$wp_error` parameter was added. + * + * @link https://developer.wordpress.org/reference/functions/wp_schedule_event/ + * + * @param int $timestamp Unix timestamp (UTC) for when to next run the event. + * @param string $recurrence How often the event should subsequently recur. + * See wp_get_schedules() for accepted values. + * @param string $hook Action hook to execute when the event is run. + * @param array $args Optional. Array containing arguments to pass to the + * hook's callback function. Each value in the array + * is passed to the callback as an individual parameter. + * The array keys are ignored. Default empty array. + * @param bool $wp_error Optional. Whether to return a WP_Error on failure. Default false. + * @return bool|WP_Error True if event successfully scheduled. False or WP_Error on failure. + * @phpstan-param list<mixed> $args + * @phpstan-return ($wp_error is false ? bool : true|\WP_Error) + */ + function wp_schedule_event($timestamp, $recurrence, $hook, $args = array(), $wp_error = \false) + { + } + /** + * Reschedules a recurring event. + * + * Mainly for internal use, this takes the UTC timestamp of a previously run + * recurring event and reschedules it for its next run. + * + * To change upcoming scheduled events, use wp_schedule_event() to + * change the recurrence frequency. + * + * @since 2.1.0 + * @since 5.1.0 Return value modified to boolean indicating success or failure, + * {@see 'pre_reschedule_event'} filter added to short-circuit the function. + * @since 5.7.0 The `$wp_error` parameter was added. + * + * @param int $timestamp Unix timestamp (UTC) for when the event was scheduled. + * @param string $recurrence How often the event should subsequently recur. + * See wp_get_schedules() for accepted values. + * @param string $hook Action hook to execute when the event is run. + * @param array $args Optional. Array containing arguments to pass to the + * hook's callback function. Each value in the array + * is passed to the callback as an individual parameter. + * The array keys are ignored. Default empty array. + * @param bool $wp_error Optional. Whether to return a WP_Error on failure. Default false. + * @return bool|WP_Error True if event successfully rescheduled. False or WP_Error on failure. + * @phpstan-param list<mixed> $args + * @phpstan-return ($wp_error is false ? bool : true|\WP_Error) + */ + function wp_reschedule_event($timestamp, $recurrence, $hook, $args = array(), $wp_error = \false) + { + } + /** + * Unschedules a previously scheduled event. + * + * The `$timestamp` and `$hook` parameters are required so that the event can be + * identified. + * + * @since 2.1.0 + * @since 5.1.0 Return value modified to boolean indicating success or failure, + * {@see 'pre_unschedule_event'} filter added to short-circuit the function. + * @since 5.7.0 The `$wp_error` parameter was added. + * + * @param int $timestamp Unix timestamp (UTC) of the event. + * @param string $hook Action hook of the event. + * @param array $args Optional. Array containing each separate argument to pass to the hook's callback function. + * Although not passed to a callback, these arguments are used to uniquely identify the + * event, so they should be the same as those used when originally scheduling the event. + * Default empty array. + * @param bool $wp_error Optional. Whether to return a WP_Error on failure. Default false. + * @return bool|WP_Error True if event successfully unscheduled. False or WP_Error on failure. + * @phpstan-param list<mixed> $args + * @phpstan-return ($wp_error is false ? bool : true|\WP_Error) + */ + function wp_unschedule_event($timestamp, $hook, $args = array(), $wp_error = \false) + { + } + /** + * Unschedules all events attached to the hook with the specified arguments. + * + * Warning: This function may return boolean false, but may also return a non-boolean + * value which evaluates to false. For information about casting to booleans see the + * {@link https://www.php.net/manual/en/language.types.boolean.php PHP documentation}. Use + * the `===` operator for testing the return value of this function. + * + * @since 2.1.0 + * @since 5.1.0 Return value modified to indicate success or failure, + * {@see 'pre_clear_scheduled_hook'} filter added to short-circuit the function. + * @since 5.7.0 The `$wp_error` parameter was added. + * + * @param string $hook Action hook, the execution of which will be unscheduled. + * @param array $args Optional. Array containing each separate argument to pass to the hook's callback function. + * Although not passed to a callback, these arguments are used to uniquely identify the + * event, so they should be the same as those used when originally scheduling the event. + * Default empty array. + * @param bool $wp_error Optional. Whether to return a WP_Error on failure. Default false. + * @return int|false|WP_Error On success an integer indicating number of events unscheduled (0 indicates no + * events were registered with the hook and arguments combination), false or WP_Error + * if unscheduling one or more events fail. + * @phpstan-param list<mixed> $args + * @phpstan-return (0|positive-int|($wp_error is false ? false : \WP_Error)) + */ + function wp_clear_scheduled_hook($hook, $args = array(), $wp_error = \false) + { + } + /** + * Unschedules all events attached to the hook. + * + * Can be useful for plugins when deactivating to clean up the cron queue. + * + * Warning: This function may return boolean false, but may also return a non-boolean + * value which evaluates to false. For information about casting to booleans see the + * {@link https://www.php.net/manual/en/language.types.boolean.php PHP documentation}. Use + * the `===` operator for testing the return value of this function. + * + * @since 4.9.0 + * @since 5.1.0 Return value added to indicate success or failure. + * @since 5.7.0 The `$wp_error` parameter was added. + * + * @param string $hook Action hook, the execution of which will be unscheduled. + * @param bool $wp_error Optional. Whether to return a WP_Error on failure. Default false. + * @return int|false|WP_Error On success an integer indicating number of events unscheduled (0 indicates no + * events were registered on the hook), false or WP_Error if unscheduling fails. + * @phpstan-return ($wp_error is false ? 0|positive-int|false : 0|positive-int|\WP_Error) + */ + function wp_unschedule_hook($hook, $wp_error = \false) + { + } + /** + * Retrieves a scheduled event. + * + * Retrieves the full event object for a given event, if no timestamp is specified the next + * scheduled event is returned. + * + * @since 5.1.0 + * + * @param string $hook Action hook of the event. + * @param array $args Optional. Array containing each separate argument to pass to the hook's callback function. + * Although not passed to a callback, these arguments are used to uniquely identify the + * event, so they should be the same as those used when originally scheduling the event. + * Default empty array. + * @param int|null $timestamp Optional. Unix timestamp (UTC) of the event. If not specified, the next scheduled event + * is returned. Default null. + * @return object|false { + * The event object. False if the event does not exist. + * + * @type string $hook Action hook to execute when the event is run. + * @type int $timestamp Unix timestamp (UTC) for when to next run the event. + * @type string|false $schedule How often the event should subsequently recur. + * @type array $args Array containing each separate argument to pass to the hook's callback function. + * @type int $interval Optional. The interval time in seconds for the schedule. Only present for recurring events. + * } + * @phpstan-return false|object{ + * hook: string, + * timestamp: int, + * schedule: string|false, + * args: array, + * interval: int, + * } + * @phpstan-param list<mixed> $args + */ + function wp_get_scheduled_event($hook, $args = array(), $timestamp = \null) + { + } + /** + * Retrieves the next timestamp for an event. + * + * @since 2.1.0 + * + * @param string $hook Action hook of the event. + * @param array $args Optional. Array containing each separate argument to pass to the hook's callback function. + * Although not passed to a callback, these arguments are used to uniquely identify the + * event, so they should be the same as those used when originally scheduling the event. + * Default empty array. + * @return int|false The Unix timestamp of the next time the event will occur. False if the event doesn't exist. + * @phpstan-param list<mixed> $args + */ + function wp_next_scheduled($hook, $args = array()) + { + } + /** + * Sends a request to run cron through HTTP request that doesn't halt page loading. + * + * @since 2.1.0 + * @since 5.1.0 Return values added. + * + * @param int $gmt_time Optional. Unix timestamp (UTC). Default 0 (current time is used). + * @return bool True if spawned, false if no events spawned. + */ + function spawn_cron($gmt_time = 0) + { + } + /** + * Registers _wp_cron() to run on the {@see 'wp_loaded'} action. + * + * If the {@see 'wp_loaded'} action has already fired, this function calls + * _wp_cron() directly. + * + * Warning: This function may return Boolean FALSE, but may also return a non-Boolean + * value which evaluates to FALSE. For information about casting to booleans see the + * {@link https://www.php.net/manual/en/language.types.boolean.php PHP documentation}. Use + * the `===` operator for testing the return value of this function. + * + * @since 2.1.0 + * @since 5.1.0 Return value added to indicate success or failure. + * @since 5.7.0 Functionality moved to _wp_cron() to which this becomes a wrapper. + * + * @return false|int|void On success an integer indicating number of events spawned (0 indicates no + * events needed to be spawned), false if spawning fails for one or more events or + * void if the function registered _wp_cron() to run on the action. + */ + function wp_cron() + { + } + /** + * Runs scheduled callbacks or spawns cron for all scheduled events. + * + * Warning: This function may return Boolean FALSE, but may also return a non-Boolean + * value which evaluates to FALSE. For information about casting to booleans see the + * {@link https://www.php.net/manual/en/language.types.boolean.php PHP documentation}. Use + * the `===` operator for testing the return value of this function. + * + * @since 5.7.0 + * @access private + * + * @return int|false On success an integer indicating number of events spawned (0 indicates no + * events needed to be spawned), false if spawning fails for one or more events. + */ + function _wp_cron() + { + } + /** + * Retrieves supported event recurrence schedules. + * + * The default supported recurrences are 'hourly', 'twicedaily', 'daily', and 'weekly'. + * A plugin may add more by hooking into the {@see 'cron_schedules'} filter. + * The filter accepts an array of arrays. The outer array has a key that is the name + * of the schedule, for example 'monthly'. The value is an array with two keys, + * one is 'interval' and the other is 'display'. + * + * The 'interval' is a number in seconds of when the cron job should run. + * So for 'hourly' the time is `HOUR_IN_SECONDS` (`60 * 60` or `3600`). For 'monthly', + * the value would be `MONTH_IN_SECONDS` (`30 * 24 * 60 * 60` or `2592000`). + * + * The 'display' is the description. For the 'monthly' key, the 'display' + * would be `__( 'Once Monthly' )`. + * + * For your plugin, you will be passed an array. You can add your + * schedule by doing the following: + * + * // Filter parameter variable name is 'array'. + * $array['monthly'] = array( + * 'interval' => MONTH_IN_SECONDS, + * 'display' => __( 'Once Monthly' ) + * ); + * + * @since 2.1.0 + * @since 5.4.0 The 'weekly' schedule was added. + * + * @return array { + * The array of cron schedules keyed by the schedule name. + * + * @type array ...$0 { + * Cron schedule information. + * + * @type int $interval The schedule interval in seconds. + * @type string $display The schedule display name. + * } + * } + * @phpstan-return array<int|string, array{ + * interval: int, + * display: string, + * }> + */ + function wp_get_schedules() + { + } + /** + * Retrieves the name of the recurrence schedule for an event. + * + * @see wp_get_schedules() for available schedules. + * + * @since 2.1.0 + * @since 5.1.0 {@see 'get_schedule'} filter added. + * + * @param string $hook Action hook to identify the event. + * @param array $args Optional. Arguments passed to the event's callback function. + * Default empty array. + * @return string|false Schedule name on success, false if no schedule. + * @phpstan-param list<mixed> $args + */ + function wp_get_schedule($hook, $args = array()) + { + } + /** + * Retrieves cron jobs ready to be run. + * + * Returns the results of _get_cron_array() limited to events ready to be run, + * ie, with a timestamp in the past. + * + * @since 5.1.0 + * + * @return array[] Array of cron job arrays ready to be run. + */ + function wp_get_ready_cron_jobs() + { + } + // + // Private functions. + // + /** + * Retrieves cron info array option. + * + * @since 2.1.0 + * @since 6.1.0 Return type modified to consistently return an array. + * @access private + * + * @return array[] Array of cron events. + */ + function _get_cron_array() + { + } + /** + * Updates the cron option with the new cron array. + * + * @since 2.1.0 + * @since 5.1.0 Return value modified to outcome of update_option(). + * @since 5.7.0 The `$wp_error` parameter was added. + * + * @access private + * + * @param array[] $cron Array of cron info arrays from _get_cron_array(). + * @param bool $wp_error Optional. Whether to return a WP_Error on failure. Default false. + * @return bool|WP_Error True if cron array updated. False or WP_Error on failure. + */ + function _set_cron_array($cron, $wp_error = \false) + { + } + /** + * Upgrades a cron info array. + * + * This function upgrades the cron info array to version 2. + * + * @since 2.1.0 + * @access private + * + * @param array $cron Cron info array from _get_cron_array(). + * @return array An upgraded cron info array. + */ + function _upgrade_cron_array($cron) + { + } + /** + * Defines constants and global variables that can be overridden, generally in wp-config.php. + * + * @package WordPress + */ + /** + * Defines initial WordPress constants. + * + * @see wp_debug_mode() + * + * @since 3.0.0 + * + * @global int $blog_id The current site ID. + * @global string $wp_version The WordPress version string. + */ + function wp_initial_constants() + { + } + /** + * Defines plugin directory WordPress constants. + * + * Defines must-use plugin directory constants, which may be overridden in the sunrise.php drop-in. + * + * @since 3.0.0 + */ + function wp_plugin_directory_constants() + { + } + /** + * Defines cookie-related WordPress constants. + * + * Defines constants after multisite is loaded. + * + * @since 3.0.0 + */ + function wp_cookie_constants() + { + } + /** + * Defines SSL-related WordPress constants. + * + * @since 3.0.0 + */ + function wp_ssl_constants() + { + } + /** + * Defines functionality-related WordPress constants. + * + * @since 3.0.0 + */ + function wp_functionality_constants() + { + } + /** + * Defines templating-related WordPress constants. + * + * @since 3.0.0 + */ + function wp_templating_constants() + { + } + /** + * Deprecated functions from past WordPress versions. You shouldn't use these + * functions and look for the alternatives instead. The functions will be + * removed in a later version. + * + * @package WordPress + * @subpackage Deprecated + */ + /* + * Deprecated functions come here to die. + */ + /** + * Retrieves all post data for a given post. + * + * @since 0.71 + * @deprecated 1.5.1 Use get_post() + * @see get_post() + * + * @param int $postid Post ID. + * @return array Post data. + */ + function get_postdata($postid) + { + } + /** + * Sets up the WordPress Loop. + * + * Use The Loop instead. + * + * @link https://developer.wordpress.org/themes/basics/the-loop/ + * + * @since 1.0.1 + * @deprecated 1.5.0 + * + * @global WP_Query $wp_query WordPress Query object. + */ + function start_wp() + { + } + /** + * Returns or prints a category ID. + * + * @since 0.71 + * @deprecated 0.71 Use get_the_category() + * @see get_the_category() + * + * @param bool $display Optional. Whether to display the output. Default true. + * @return int Category ID. + */ + function the_category_ID($display = \true) + { + } + /** + * Prints a category with optional text before and after. + * + * @since 0.71 + * @deprecated 0.71 Use get_the_category_by_ID() + * @see get_the_category_by_ID() + * + * @param string $before Optional. Text to display before the category. Default empty. + * @param string $after Optional. Text to display after the category. Default empty. + */ + function the_category_head($before = '', $after = '') + { + } + /** + * Prints a link to the previous post. + * + * @since 1.5.0 + * @deprecated 2.0.0 Use previous_post_link() + * @see previous_post_link() + * + * @param string $format + * @param string $previous + * @param string $title + * @param string $in_same_cat + * @param int $limitprev + * @param string $excluded_categories + * @phpstan-return void + */ + function previous_post($format = '%', $previous = 'previous post: ', $title = 'yes', $in_same_cat = 'no', $limitprev = 1, $excluded_categories = '') + { + } + /** + * Prints link to the next post. + * + * @since 0.71 + * @deprecated 2.0.0 Use next_post_link() + * @see next_post_link() + * + * @param string $format + * @param string $next + * @param string $title + * @param string $in_same_cat + * @param int $limitnext + * @param string $excluded_categories + * @phpstan-return void + */ + function next_post($format = '%', $next = 'next post: ', $title = 'yes', $in_same_cat = 'no', $limitnext = 1, $excluded_categories = '') + { + } + /** + * Whether user can create a post. + * + * @since 1.5.0 + * @deprecated 2.0.0 Use current_user_can() + * @see current_user_can() + * + * @param int $user_id + * @param int $blog_id Not Used + * @param int $category_id Not Used + * @return bool + */ + function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') + { + } + /** + * Whether user can create a post. + * + * @since 1.5.0 + * @deprecated 2.0.0 Use current_user_can() + * @see current_user_can() + * + * @param int $user_id + * @param int $blog_id Not Used + * @param int $category_id Not Used + * @return bool + */ + function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') + { + } + /** + * Whether user can edit a post. + * + * @since 1.5.0 + * @deprecated 2.0.0 Use current_user_can() + * @see current_user_can() + * + * @param int $user_id + * @param int $post_id + * @param int $blog_id Not Used + * @return bool + */ + function user_can_edit_post($user_id, $post_id, $blog_id = 1) + { + } + /** + * Whether user can delete a post. + * + * @since 1.5.0 + * @deprecated 2.0.0 Use current_user_can() + * @see current_user_can() + * + * @param int $user_id + * @param int $post_id + * @param int $blog_id Not Used + * @return bool + */ + function user_can_delete_post($user_id, $post_id, $blog_id = 1) + { + } + /** + * Whether user can set new posts' dates. + * + * @since 1.5.0 + * @deprecated 2.0.0 Use current_user_can() + * @see current_user_can() + * + * @param int $user_id + * @param int $blog_id Not Used + * @param int $category_id Not Used + * @return bool + */ + function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') + { + } + /** + * Whether user can delete a post. + * + * @since 1.5.0 + * @deprecated 2.0.0 Use current_user_can() + * @see current_user_can() + * + * @param int $user_id + * @param int $post_id + * @param int $blog_id Not Used + * @return bool returns true if $user_id can edit $post_id's date + */ + function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) + { + } + /** + * Whether user can delete a post. + * + * @since 1.5.0 + * @deprecated 2.0.0 Use current_user_can() + * @see current_user_can() + * + * @param int $user_id + * @param int $post_id + * @param int $blog_id Not Used + * @return bool returns true if $user_id can edit $post_id's comments + */ + function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) + { + } + /** + * Whether user can delete a post. + * + * @since 1.5.0 + * @deprecated 2.0.0 Use current_user_can() + * @see current_user_can() + * + * @param int $user_id + * @param int $post_id + * @param int $blog_id Not Used + * @return bool returns true if $user_id can delete $post_id's comments + */ + function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) + { + } + /** + * Can user can edit other user. + * + * @since 1.5.0 + * @deprecated 2.0.0 Use current_user_can() + * @see current_user_can() + * + * @param int $user_id + * @param int $other_user + * @return bool + */ + function user_can_edit_user($user_id, $other_user) + { + } + /** + * Gets the links associated with category $cat_name. + * + * @since 0.71 + * @deprecated 2.1.0 Use get_bookmarks() + * @see get_bookmarks() + * + * @param string $cat_name Optional. The category name to use. If no match is found, uses all. + * Default 'noname'. + * @param string $before Optional. The HTML to output before the link. Default empty. + * @param string $after Optional. The HTML to output after the link. Default '<br />'. + * @param string $between Optional. The HTML to output between the link/image and its description. + * Not used if no image or $show_images is true. Default ' '. + * @param bool $show_images Optional. Whether to show images (if defined). Default true. + * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', + * 'description', 'rating', or 'owner'. Default 'id'. + * If you start the name with an underscore, the order will be reversed. + * Specifying 'rand' as the order will return links in a random order. + * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined. + * Default true. + * @param bool $show_rating Optional. Show rating stars/chars. Default false. + * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. + * Default -1. + * @param int $show_updated Optional. Whether to show last updated timestamp. Default 0. + */ + function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = \true, $orderby = 'id', $show_description = \true, $show_rating = \false, $limit = -1, $show_updated = 0) + { + } + /** + * Gets the links associated with the named category. + * + * @since 1.0.1 + * @deprecated 2.1.0 Use wp_list_bookmarks() + * @see wp_list_bookmarks() + * + * @param string $category The category to use. + * @param string $args + * @return string|null + */ + function wp_get_linksbyname($category, $args = '') + { + } + /** + * Gets an array of link objects associated with category $cat_name. + * + * $links = get_linkobjectsbyname( 'fred' ); + * foreach ( $links as $link ) { + * echo '<li>' . $link->link_name . '</li>'; + * } + * + * @since 1.0.1 + * @deprecated 2.1.0 Use get_bookmarks() + * @see get_bookmarks() + * + * @param string $cat_name Optional. The category name to use. If no match is found, uses all. + * Default 'noname'. + * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', + * 'description', 'rating', or 'owner'. Default 'name'. + * If you start the name with an underscore, the order will be reversed. + * Specifying 'rand' as the order will return links in a random order. + * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. + * Default -1. + * @return array + */ + function get_linkobjectsbyname($cat_name = "noname", $orderby = 'name', $limit = -1) + { + } + /** + * Gets an array of link objects associated with category n. + * + * Usage: + * + * $links = get_linkobjects(1); + * if ($links) { + * foreach ($links as $link) { + * echo '<li>'.$link->link_name.'<br />'.$link->link_description.'</li>'; + * } + * } + * + * Fields are: + * + * - link_id + * - link_url + * - link_name + * - link_image + * - link_target + * - link_category + * - link_description + * - link_visible + * - link_owner + * - link_rating + * - link_updated + * - link_rel + * - link_notes + * + * @since 1.0.1 + * @deprecated 2.1.0 Use get_bookmarks() + * @see get_bookmarks() + * + * @param int $category Optional. The category to use. If no category supplied, uses all. + * Default 0. + * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', + * 'description', 'rating', or 'owner'. Default 'name'. + * If you start the name with an underscore, the order will be reversed. + * Specifying 'rand' as the order will return links in a random order. + * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. + * Default 0. + * @return array + */ + function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) + { + } + /** + * Gets the links associated with category 'cat_name' and display rating stars/chars. + * + * @since 0.71 + * @deprecated 2.1.0 Use get_bookmarks() + * @see get_bookmarks() + * + * @param string $cat_name Optional. The category name to use. If no match is found, uses all. + * Default 'noname'. + * @param string $before Optional. The HTML to output before the link. Default empty. + * @param string $after Optional. The HTML to output after the link. Default '<br />'. + * @param string $between Optional. The HTML to output between the link/image and its description. + * Not used if no image or $show_images is true. Default ' '. + * @param bool $show_images Optional. Whether to show images (if defined). Default true. + * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', + * 'description', 'rating', or 'owner'. Default 'id'. + * If you start the name with an underscore, the order will be reversed. + * Specifying 'rand' as the order will return links in a random order. + * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined. + * Default true. + * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. + * Default -1. + * @param int $show_updated Optional. Whether to show last updated timestamp. Default 0. + */ + function get_linksbyname_withrating($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = \true, $orderby = 'id', $show_description = \true, $limit = -1, $show_updated = 0) + { + } + /** + * Gets the links associated with category n and display rating stars/chars. + * + * @since 0.71 + * @deprecated 2.1.0 Use get_bookmarks() + * @see get_bookmarks() + * + * @param int $category Optional. The category to use. If no category supplied, uses all. + * Default 0. + * @param string $before Optional. The HTML to output before the link. Default empty. + * @param string $after Optional. The HTML to output after the link. Default '<br />'. + * @param string $between Optional. The HTML to output between the link/image and its description. + * Not used if no image or $show_images is true. Default ' '. + * @param bool $show_images Optional. Whether to show images (if defined). Default true. + * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', + * 'description', 'rating', or 'owner'. Default 'id'. + * If you start the name with an underscore, the order will be reversed. + * Specifying 'rand' as the order will return links in a random order. + * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined. + * Default true. + * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. + * Default -1. + * @param int $show_updated Optional. Whether to show last updated timestamp. Default 0. + */ + function get_links_withrating($category = -1, $before = '', $after = '<br />', $between = " ", $show_images = \true, $orderby = 'id', $show_description = \true, $limit = -1, $show_updated = 0) + { + } + /** + * Gets the auto_toggle setting. + * + * @since 0.71 + * @deprecated 2.1.0 + * + * @param int $id The category to get. If no category supplied uses 0 + * @return int Only returns 0. + */ + function get_autotoggle($id = 0) + { + } + /** + * Lists categories. + * + * @since 0.71 + * @deprecated 2.1.0 Use wp_list_categories() + * @see wp_list_categories() + * + * @param int $optionall + * @param string $all + * @param string $sort_column + * @param string $sort_order + * @param string $file + * @param bool $list + * @param int $optiondates + * @param int $optioncount + * @param int $hide_empty + * @param int $use_desc_for_title + * @param bool $children + * @param int $child_of + * @param int $categories + * @param int $recurse + * @param string $feed + * @param string $feed_image + * @param string $exclude + * @param bool $hierarchical + * @return null|false + */ + function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = \true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children = \false, $child_of = 0, $categories = 0, $recurse = 0, $feed = '', $feed_image = '', $exclude = '', $hierarchical = \false) + { + } + /** + * Lists categories. + * + * @since 1.2.0 + * @deprecated 2.1.0 Use wp_list_categories() + * @see wp_list_categories() + * + * @param string|array $args + * @return null|string|false + */ + function wp_list_cats($args = '') + { + } + /** + * Deprecated method for generating a drop-down of categories. + * + * @since 0.71 + * @deprecated 2.1.0 Use wp_dropdown_categories() + * @see wp_dropdown_categories() + * + * @param int $optionall + * @param string $all + * @param string $orderby + * @param string $order + * @param int $show_last_update + * @param int $show_count + * @param int $hide_empty + * @param bool $optionnone + * @param int $selected + * @param int $exclude + * @return string + */ + function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc', $show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = \false, $selected = 0, $exclude = 0) + { + } + /** + * Lists authors. + * + * @since 1.2.0 + * @deprecated 2.1.0 Use wp_list_authors() + * @see wp_list_authors() + * + * @param bool $optioncount + * @param bool $exclude_admin + * @param bool $show_fullname + * @param bool $hide_empty + * @param string $feed + * @param string $feed_image + * @return null|string + */ + function list_authors($optioncount = \false, $exclude_admin = \true, $show_fullname = \false, $hide_empty = \true, $feed = '', $feed_image = '') + { + } + /** + * Retrieves a list of post categories. + * + * @since 1.0.1 + * @deprecated 2.1.0 Use wp_get_post_categories() + * @see wp_get_post_categories() + * + * @param int $blogid Not Used + * @param int $post_id + * @return array + */ + function wp_get_post_cats($blogid = '1', $post_id = 0) + { + } + /** + * Sets the categories that the post ID belongs to. + * + * @since 1.0.1 + * @deprecated 2.1.0 + * @deprecated Use wp_set_post_categories() + * @see wp_set_post_categories() + * + * @param int $blogid Not used + * @param int $post_id + * @param array $post_categories + * @return bool|mixed + */ + function wp_set_post_cats($blogid = '1', $post_id = 0, $post_categories = array()) + { + } + /** + * Retrieves a list of archives. + * + * @since 0.71 + * @deprecated 2.1.0 Use wp_get_archives() + * @see wp_get_archives() + * + * @param string $type + * @param string $limit + * @param string $format + * @param string $before + * @param string $after + * @param bool $show_post_count + * @return string|null + */ + function get_archives($type = '', $limit = '', $format = 'html', $before = '', $after = '', $show_post_count = \false) + { + } + /** + * Returns or Prints link to the author's posts. + * + * @since 1.2.0 + * @deprecated 2.1.0 Use get_author_posts_url() + * @see get_author_posts_url() + * + * @param bool $display + * @param int $author_id + * @param string $author_nicename Optional. + * @return string|null + */ + function get_author_link($display, $author_id, $author_nicename = '') + { + } + /** + * Print list of pages based on arguments. + * + * @since 0.71 + * @deprecated 2.1.0 Use wp_link_pages() + * @see wp_link_pages() + * + * @param string $before + * @param string $after + * @param string $next_or_number + * @param string $nextpagelink + * @param string $previouspagelink + * @param string $pagelink + * @param string $more_file + * @return string + */ + function link_pages($before = '<br />', $after = '<br />', $next_or_number = 'number', $nextpagelink = 'next page', $previouspagelink = 'previous page', $pagelink = '%', $more_file = '') + { + } + /** + * Get value based on option. + * + * @since 0.71 + * @deprecated 2.1.0 Use get_option() + * @see get_option() + * + * @param string $option + * @return string + */ + function get_settings($option) + { + } + /** + * Print the permalink of the current post in the loop. + * + * @since 0.71 + * @deprecated 1.2.0 Use the_permalink() + * @see the_permalink() + */ + function permalink_link() + { + } + /** + * Print the permalink to the RSS feed. + * + * @since 0.71 + * @deprecated 2.3.0 Use the_permalink_rss() + * @see the_permalink_rss() + * + * @param string $deprecated + */ + function permalink_single_rss($deprecated = '') + { + } + /** + * Gets the links associated with category. + * + * @since 1.0.1 + * @deprecated 2.1.0 Use wp_list_bookmarks() + * @see wp_list_bookmarks() + * + * @param string $args a query string + * @return null|string + */ + function wp_get_links($args = '') + { + } + /** + * Gets the links associated with category by ID. + * + * @since 0.71 + * @deprecated 2.1.0 Use get_bookmarks() + * @see get_bookmarks() + * + * @param int $category Optional. The category to use. If no category supplied uses all. + * Default 0. + * @param string $before Optional. The HTML to output before the link. Default empty. + * @param string $after Optional. The HTML to output after the link. Default '<br />'. + * @param string $between Optional. The HTML to output between the link/image and its description. + * Not used if no image or $show_images is true. Default ' '. + * @param bool $show_images Optional. Whether to show images (if defined). Default true. + * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', + * 'description', 'rating', or 'owner'. Default 'name'. + * If you start the name with an underscore, the order will be reversed. + * Specifying 'rand' as the order will return links in a random order. + * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined. + * Default true. + * @param bool $show_rating Optional. Show rating stars/chars. Default false. + * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. + * Default -1. + * @param int $show_updated Optional. Whether to show last updated timestamp. Default 1. + * @param bool $display Whether to display the results, or return them instead. + * @return null|string + */ + function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = \true, $orderby = 'name', $show_description = \true, $show_rating = \false, $limit = -1, $show_updated = 1, $display = \true) + { + } + /** + * Output entire list of links by category. + * + * Output a list of all links, listed by category, using the settings in + * $wpdb->linkcategories and output it as a nested HTML unordered list. + * + * @since 1.0.1 + * @deprecated 2.1.0 Use wp_list_bookmarks() + * @see wp_list_bookmarks() + * + * @param string $order Sort link categories by 'name' or 'id' + */ + function get_links_list($order = 'name') + { + } + /** + * Show the link to the links popup and the number of links. + * + * @since 0.71 + * @deprecated 2.1.0 + * + * @param string $text the text of the link + * @param int $width the width of the popup window + * @param int $height the height of the popup window + * @param string $file the page to open in the popup window + * @param bool $count the number of links in the db + */ + function links_popup_script($text = 'Links', $width = 400, $height = 400, $file = 'links.all.php', $count = \true) + { + } + /** + * Legacy function that retrieved the value of a link's link_rating field. + * + * @since 1.0.1 + * @deprecated 2.1.0 Use sanitize_bookmark_field() + * @see sanitize_bookmark_field() + * + * @param object $link Link object. + * @return mixed Value of the 'link_rating' field, false otherwise. + */ + function get_linkrating($link) + { + } + /** + * Gets the name of category by ID. + * + * @since 0.71 + * @deprecated 2.1.0 Use get_category() + * @see get_category() + * + * @param int $id The category to get. If no category supplied uses 0 + * @return string + */ + function get_linkcatname($id = 0) + { + } + /** + * Print RSS comment feed link. + * + * @since 1.0.1 + * @deprecated 2.5.0 Use post_comments_feed_link() + * @see post_comments_feed_link() + * + * @param string $link_text + */ + function comments_rss_link($link_text = 'Comments RSS') + { + } + /** + * Print/Return link to category RSS2 feed. + * + * @since 1.2.0 + * @deprecated 2.5.0 Use get_category_feed_link() + * @see get_category_feed_link() + * + * @param bool $display + * @param int $cat_id + * @return string + */ + function get_category_rss_link($display = \false, $cat_id = 1) + { + } + /** + * Print/Return link to author RSS feed. + * + * @since 1.2.0 + * @deprecated 2.5.0 Use get_author_feed_link() + * @see get_author_feed_link() + * + * @param bool $display + * @param int $author_id + * @return string + */ + function get_author_rss_link($display = \false, $author_id = 1) + { + } + /** + * Return link to the post RSS feed. + * + * @since 1.5.0 + * @deprecated 2.2.0 Use get_post_comments_feed_link() + * @see get_post_comments_feed_link() + * + * @return string + */ + function comments_rss() + { + } + /** + * An alias of wp_create_user(). + * + * @since 2.0.0 + * @deprecated 2.0.0 Use wp_create_user() + * @see wp_create_user() + * + * @param string $username The user's username. + * @param string $password The user's password. + * @param string $email The user's email. + * @return int The new user's ID. + */ + function create_user($username, $password, $email) + { + } + /** + * Unused function. + * + * @deprecated 2.5.0 + */ + function gzip_compression() + { + } + /** + * Retrieve an array of comment data about comment $comment_id. + * + * @since 0.71 + * @deprecated 2.7.0 Use get_comment() + * @see get_comment() + * + * @param int $comment_id The ID of the comment + * @param int $no_cache Whether to use the cache (cast to bool) + * @param bool $include_unapproved Whether to include unapproved comments + * @return array The comment data + */ + function get_commentdata($comment_id, $no_cache = 0, $include_unapproved = \false) + { + } + /** + * Retrieve the category name by the category ID. + * + * @since 0.71 + * @deprecated 2.8.0 Use get_cat_name() + * @see get_cat_name() + * + * @param int $cat_id Category ID + * @return string category name + */ + function get_catname($cat_id) + { + } + /** + * Retrieve category children list separated before and after the term IDs. + * + * @since 1.2.0 + * @deprecated 2.8.0 Use get_term_children() + * @see get_term_children() + * + * @param int $id Category ID to retrieve children. + * @param string $before Optional. Prepend before category term ID. Default '/'. + * @param string $after Optional. Append after category term ID. Default empty string. + * @param array $visited Optional. Category Term IDs that have already been added. + * Default empty array. + * @return string + */ + function get_category_children($id, $before = '/', $after = '', $visited = array()) + { + } + /** + * Retrieves all category IDs. + * + * @since 2.0.0 + * @deprecated 4.0.0 Use get_terms() + * @see get_terms() + * + * @link https://developer.wordpress.org/reference/functions/get_all_category_ids/ + * + * @return int[] List of all of the category IDs. + */ + function get_all_category_ids() + { + } + /** + * Retrieve the description of the author of the current post. + * + * @since 1.5.0 + * @deprecated 2.8.0 Use get_the_author_meta() + * @see get_the_author_meta() + * + * @return string The author's description. + */ + function get_the_author_description() + { + } + /** + * Display the description of the author of the current post. + * + * @since 1.0.0 + * @deprecated 2.8.0 Use the_author_meta() + * @see the_author_meta() + */ + function the_author_description() + { + } + /** + * Retrieve the login name of the author of the current post. + * + * @since 1.5.0 + * @deprecated 2.8.0 Use get_the_author_meta() + * @see get_the_author_meta() + * + * @return string The author's login name (username). + */ + function get_the_author_login() + { + } + /** + * Display the login name of the author of the current post. + * + * @since 0.71 + * @deprecated 2.8.0 Use the_author_meta() + * @see the_author_meta() + */ + function the_author_login() + { + } + /** + * Retrieve the first name of the author of the current post. + * + * @since 1.5.0 + * @deprecated 2.8.0 Use get_the_author_meta() + * @see get_the_author_meta() + * + * @return string The author's first name. + */ + function get_the_author_firstname() + { + } + /** + * Display the first name of the author of the current post. + * + * @since 0.71 + * @deprecated 2.8.0 Use the_author_meta() + * @see the_author_meta() + */ + function the_author_firstname() + { + } + /** + * Retrieve the last name of the author of the current post. + * + * @since 1.5.0 + * @deprecated 2.8.0 Use get_the_author_meta() + * @see get_the_author_meta() + * + * @return string The author's last name. + */ + function get_the_author_lastname() + { + } + /** + * Display the last name of the author of the current post. + * + * @since 0.71 + * @deprecated 2.8.0 Use the_author_meta() + * @see the_author_meta() + */ + function the_author_lastname() + { + } + /** + * Retrieve the nickname of the author of the current post. + * + * @since 1.5.0 + * @deprecated 2.8.0 Use get_the_author_meta() + * @see get_the_author_meta() + * + * @return string The author's nickname. + */ + function get_the_author_nickname() + { + } + /** + * Display the nickname of the author of the current post. + * + * @since 0.71 + * @deprecated 2.8.0 Use the_author_meta() + * @see the_author_meta() + */ + function the_author_nickname() + { + } + /** + * Retrieve the email of the author of the current post. + * + * @since 1.5.0 + * @deprecated 2.8.0 Use get_the_author_meta() + * @see get_the_author_meta() + * + * @return string The author's username. + */ + function get_the_author_email() + { + } + /** + * Display the email of the author of the current post. + * + * @since 0.71 + * @deprecated 2.8.0 Use the_author_meta() + * @see the_author_meta() + */ + function the_author_email() + { + } + /** + * Retrieve the ICQ number of the author of the current post. + * + * @since 1.5.0 + * @deprecated 2.8.0 Use get_the_author_meta() + * @see get_the_author_meta() + * + * @return string The author's ICQ number. + */ + function get_the_author_icq() + { + } + /** + * Display the ICQ number of the author of the current post. + * + * @since 0.71 + * @deprecated 2.8.0 Use the_author_meta() + * @see the_author_meta() + */ + function the_author_icq() + { + } + /** + * Retrieve the Yahoo! IM name of the author of the current post. + * + * @since 1.5.0 + * @deprecated 2.8.0 Use get_the_author_meta() + * @see get_the_author_meta() + * + * @return string The author's Yahoo! IM name. + */ + function get_the_author_yim() + { + } + /** + * Display the Yahoo! IM name of the author of the current post. + * + * @since 0.71 + * @deprecated 2.8.0 Use the_author_meta() + * @see the_author_meta() + */ + function the_author_yim() + { + } + /** + * Retrieve the MSN address of the author of the current post. + * + * @since 1.5.0 + * @deprecated 2.8.0 Use get_the_author_meta() + * @see get_the_author_meta() + * + * @return string The author's MSN address. + */ + function get_the_author_msn() + { + } + /** + * Display the MSN address of the author of the current post. + * + * @since 0.71 + * @deprecated 2.8.0 Use the_author_meta() + * @see the_author_meta() + */ + function the_author_msn() + { + } + /** + * Retrieve the AIM address of the author of the current post. + * + * @since 1.5.0 + * @deprecated 2.8.0 Use get_the_author_meta() + * @see get_the_author_meta() + * + * @return string The author's AIM address. + */ + function get_the_author_aim() + { + } + /** + * Display the AIM address of the author of the current post. + * + * @since 0.71 + * @deprecated 2.8.0 Use the_author_meta('aim') + * @see the_author_meta() + */ + function the_author_aim() + { + } + /** + * Retrieve the specified author's preferred display name. + * + * @since 1.0.0 + * @deprecated 2.8.0 Use get_the_author_meta() + * @see get_the_author_meta() + * + * @param int $auth_id The ID of the author. + * @return string The author's display name. + */ + function get_author_name($auth_id = \false) + { + } + /** + * Retrieve the URL to the home page of the author of the current post. + * + * @since 1.5.0 + * @deprecated 2.8.0 Use get_the_author_meta() + * @see get_the_author_meta() + * + * @return string The URL to the author's page. + */ + function get_the_author_url() + { + } + /** + * Display the URL to the home page of the author of the current post. + * + * @since 0.71 + * @deprecated 2.8.0 Use the_author_meta() + * @see the_author_meta() + */ + function the_author_url() + { + } + /** + * Retrieve the ID of the author of the current post. + * + * @since 1.5.0 + * @deprecated 2.8.0 Use get_the_author_meta() + * @see get_the_author_meta() + * + * @return string|int The author's ID. + */ + function get_the_author_ID() + { + } + /** + * Display the ID of the author of the current post. + * + * @since 0.71 + * @deprecated 2.8.0 Use the_author_meta() + * @see the_author_meta() + */ + function the_author_ID() + { + } + /** + * Display the post content for the feed. + * + * For encoding the HTML or the $encode_html parameter, there are three possible values: + * - '0' will make urls footnotes and use make_url_footnote(). + * - '1' will encode special characters and automatically display all of the content. + * - '2' will strip all HTML tags from the content. + * + * Also note that you cannot set the amount of words and not set the HTML encoding. + * If that is the case, then the HTML encoding will default to 2, which will strip + * all HTML tags. + * + * To restrict the amount of words of the content, you can use the cut parameter. + * If the content is less than the amount, then there won't be any dots added to the end. + * If there is content left over, then dots will be added and the rest of the content + * will be removed. + * + * @since 0.71 + * + * @deprecated 2.9.0 Use the_content_feed() + * @see the_content_feed() + * + * @param string $more_link_text Optional. Text to display when more content is available + * but not displayed. Default '(more...)'. + * @param int $stripteaser Optional. Default 0. + * @param string $more_file Optional. + * @param int $cut Optional. Amount of words to keep for the content. + * @param int $encode_html Optional. How to encode the content. + */ + function the_content_rss($more_link_text = '(more...)', $stripteaser = 0, $more_file = '', $cut = 0, $encode_html = 0) + { + } + /** + * Strip HTML and put links at the bottom of stripped content. + * + * Searches for all of the links, strips them out of the content, and places + * them at the bottom of the content with numbers. + * + * @since 0.71 + * @deprecated 2.9.0 + * + * @param string $content Content to get links. + * @return string HTML stripped out of content with links at the bottom. + */ + function make_url_footnote($content) + { + } + /** + * Retrieve translated string with vertical bar context + * + * Quite a few times, there will be collisions with similar translatable text + * found in more than two places but with different translated context. + * + * In order to use the separate contexts, the _c() function is used and the + * translatable string uses a pipe ('|') which has the context the string is in. + * + * When the translated string is returned, it is everything before the pipe, not + * including the pipe character. If there is no pipe in the translated text then + * everything is returned. + * + * @since 2.2.0 + * @deprecated 2.9.0 Use _x() + * @see _x() + * + * @param string $text Text to translate. + * @param string $domain Optional. Domain to retrieve the translated text. + * @return string Translated context string without pipe. + */ + function _c($text, $domain = 'default') + { + } + /** + * Translates $text like translate(), but assumes that the text + * contains a context after its last vertical bar. + * + * @since 2.5.0 + * @deprecated 3.0.0 Use _x() + * @see _x() + * + * @param string $text Text to translate. + * @param string $domain Domain to retrieve the translated text. + * @return string Translated text. + */ + function translate_with_context($text, $domain = 'default') + { + } + /** + * Legacy version of _n(), which supports contexts. + * + * Strips everything from the translation after the last bar. + * + * @since 2.7.0 + * @deprecated 3.0.0 Use _nx() + * @see _nx() + * + * @param string $single The text to be used if the number is singular. + * @param string $plural The text to be used if the number is plural. + * @param int $number The number to compare against to use either the singular or plural form. + * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. + * Default 'default'. + * @return string The translated singular or plural form. + */ + function _nc($single, $plural, $number, $domain = 'default') + { + } + /** + * Retrieve the plural or single form based on the amount. + * + * @since 1.2.0 + * @deprecated 2.8.0 Use _n() + * @see _n() + */ + function __ngettext(...$args) + { + } + /** + * Register plural strings in POT file, but don't translate them. + * + * @since 2.5.0 + * @deprecated 2.8.0 Use _n_noop() + * @see _n_noop() + */ + function __ngettext_noop(...$args) + { + } + /** + * Retrieve all autoload options, or all options if no autoloaded ones exist. + * + * @since 1.0.0 + * @deprecated 3.0.0 Use wp_load_alloptions()) + * @see wp_load_alloptions() + * + * @return array List of all options. + */ + function get_alloptions() + { + } + /** + * Retrieve HTML content of attachment image with link. + * + * @since 2.0.0 + * @deprecated 2.5.0 Use wp_get_attachment_link() + * @see wp_get_attachment_link() + * + * @param int $id Optional. Post ID. + * @param bool $fullsize Optional. Whether to use full size image. Default false. + * @param array $max_dims Optional. Max image dimensions. + * @param bool $permalink Optional. Whether to include permalink to image. Default false. + * @return string + */ + function get_the_attachment_link($id = 0, $fullsize = \false, $max_dims = \false, $permalink = \false) + { + } + /** + * Retrieve icon URL and Path. + * + * @since 2.1.0 + * @deprecated 2.5.0 Use wp_get_attachment_image_src() + * @see wp_get_attachment_image_src() + * + * @param int $id Optional. Post ID. + * @param bool $fullsize Optional. Whether to have full image. Default false. + * @return array Icon URL and full path to file, respectively. + */ + function get_attachment_icon_src($id = 0, $fullsize = \false) + { + } + /** + * Retrieve HTML content of icon attachment image element. + * + * @since 2.0.0 + * @deprecated 2.5.0 Use wp_get_attachment_image() + * @see wp_get_attachment_image() + * + * @param int $id Optional. Post ID. + * @param bool $fullsize Optional. Whether to have full size image. Default false. + * @param array $max_dims Optional. Dimensions of image. + * @return string|false HTML content. + */ + function get_attachment_icon($id = 0, $fullsize = \false, $max_dims = \false) + { + } + /** + * Retrieve HTML content of image element. + * + * @since 2.0.0 + * @deprecated 2.5.0 Use wp_get_attachment_image() + * @see wp_get_attachment_image() + * + * @param int $id Optional. Post ID. + * @param bool $fullsize Optional. Whether to have full size image. Default false. + * @param array $max_dims Optional. Dimensions of image. + * @return string|false + */ + function get_attachment_innerHTML($id = 0, $fullsize = \false, $max_dims = \false) + { + } + /** + * Retrieves bookmark data based on ID. + * + * @since 2.0.0 + * @deprecated 2.1.0 Use get_bookmark() + * @see get_bookmark() + * + * @param int $bookmark_id ID of link + * @param string $output Optional. Type of output. Accepts OBJECT, ARRAY_N, or ARRAY_A. + * Default OBJECT. + * @param string $filter Optional. How to filter the link for output. Accepts 'raw', 'edit', + * 'attribute', 'js', 'db', or 'display'. Default 'raw'. + * @return object|array Bookmark object or array, depending on the type specified by `$output`. + * @phpstan-param 'raw'|'edit'|'attribute'|'js'|'db'|'display' $filter + */ + function get_link($bookmark_id, $output = \OBJECT, $filter = 'raw') + { + } + /** + * Checks and cleans a URL. + * + * A number of characters are removed from the URL. If the URL is for displaying + * (the default behavior) ampersands are also replaced. The 'clean_url' filter + * is applied to the returned cleaned URL. + * + * @since 1.2.0 + * @deprecated 3.0.0 Use esc_url() + * @see esc_url() + * + * @param string $url The URL to be cleaned. + * @param array $protocols Optional. An array of acceptable protocols. + * @param string $context Optional. How the URL will be used. Default is 'display'. + * @return string The cleaned $url after the {@see 'clean_url'} filter is applied. + */ + function clean_url($url, $protocols = \null, $context = 'display') + { + } + /** + * Escape single quotes, specialchar double quotes, and fix line endings. + * + * The filter {@see 'js_escape'} is also applied by esc_js(). + * + * @since 2.0.4 + * @deprecated 2.8.0 Use esc_js() + * @see esc_js() + * + * @param string $text The text to be escaped. + * @return string Escaped text. + */ + function js_escape($text) + { + } + /** + * Legacy escaping for HTML blocks. + * + * @deprecated 2.8.0 Use esc_html() + * @see esc_html() + * + * @param string $text Text to escape. + * @param string $quote_style Unused. + * @param false|string $charset Unused. + * @param false $double_encode Whether to double encode. Unused. + * @return string Escaped `$text`. + */ + function wp_specialchars($text, $quote_style = \ENT_NOQUOTES, $charset = \false, $double_encode = \false) + { + } + /** + * Escaping for HTML attributes. + * + * @since 2.0.6 + * @deprecated 2.8.0 Use esc_attr() + * @see esc_attr() + * + * @param string $text + * @return string + */ + function attribute_escape($text) + { + } + /** + * Register widget for sidebar with backward compatibility. + * + * Allows $name to be an array that accepts either three elements to grab the + * first element and the third for the name or just uses the first element of + * the array for the name. + * + * Passes to wp_register_sidebar_widget() after argument list and backward + * compatibility is complete. + * + * @since 2.2.0 + * @deprecated 2.8.0 Use wp_register_sidebar_widget() + * @see wp_register_sidebar_widget() + * + * @param string|int $name Widget ID. + * @param callable $output_callback Run when widget is called. + * @param string $classname Optional. Classname widget option. Default empty. + * @param mixed ...$params Widget parameters. + */ + function register_sidebar_widget($name, $output_callback, $classname = '', ...$params) + { + } + /** + * Serves as an alias of wp_unregister_sidebar_widget(). + * + * @since 2.2.0 + * @deprecated 2.8.0 Use wp_unregister_sidebar_widget() + * @see wp_unregister_sidebar_widget() + * + * @param int|string $id Widget ID. + */ + function unregister_sidebar_widget($id) + { + } + /** + * Registers widget control callback for customizing options. + * + * Allows $name to be an array that accepts either three elements to grab the + * first element and the third for the name or just uses the first element of + * the array for the name. + * + * Passes to wp_register_widget_control() after the argument list has + * been compiled. + * + * @since 2.2.0 + * @deprecated 2.8.0 Use wp_register_widget_control() + * @see wp_register_widget_control() + * + * @param int|string $name Sidebar ID. + * @param callable $control_callback Widget control callback to display and process form. + * @param int $width Widget width. + * @param int $height Widget height. + * @param mixed ...$params Widget parameters. + */ + function register_widget_control($name, $control_callback, $width = '', $height = '', ...$params) + { + } + /** + * Alias of wp_unregister_widget_control(). + * + * @since 2.2.0 + * @deprecated 2.8.0 Use wp_unregister_widget_control() + * @see wp_unregister_widget_control() + * + * @param int|string $id Widget ID. + */ + function unregister_widget_control($id) + { + } + /** + * Remove user meta data. + * + * @since 2.0.0 + * @deprecated 3.0.0 Use delete_user_meta() + * @see delete_user_meta() + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $user_id User ID. + * @param string $meta_key Metadata key. + * @param mixed $meta_value Optional. Metadata value. Default empty. + * @return bool True deletion completed and false if user_id is not a number. + */ + function delete_usermeta($user_id, $meta_key, $meta_value = '') + { + } + /** + * Retrieve user metadata. + * + * If $user_id is not a number, then the function will fail over with a 'false' + * boolean return value. Other returned values depend on whether there is only + * one item to be returned, which be that single item type. If there is more + * than one metadata value, then it will be list of metadata values. + * + * @since 2.0.0 + * @deprecated 3.0.0 Use get_user_meta() + * @see get_user_meta() + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $user_id User ID + * @param string $meta_key Optional. Metadata key. Default empty. + * @return mixed + */ + function get_usermeta($user_id, $meta_key = '') + { + } + /** + * Update metadata of user. + * + * There is no need to serialize values, they will be serialized if it is + * needed. The metadata key can only be a string with underscores. All else will + * be removed. + * + * Will remove the metadata, if the meta value is empty. + * + * @since 2.0.0 + * @deprecated 3.0.0 Use update_user_meta() + * @see update_user_meta() + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $user_id User ID + * @param string $meta_key Metadata key. + * @param mixed $meta_value Metadata value. + * @return bool True on successful update, false on failure. + */ + function update_usermeta($user_id, $meta_key, $meta_value) + { + } + /** + * Get users for the site. + * + * For setups that use the multisite feature. Can be used outside of the + * multisite feature. + * + * @since 2.2.0 + * @deprecated 3.1.0 Use get_users() + * @see get_users() + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $id Site ID. + * @return array List of users that are part of that site ID + */ + function get_users_of_blog($id = '') + { + } + /** + * Enable/disable automatic general feed link outputting. + * + * @since 2.8.0 + * @deprecated 3.0.0 Use add_theme_support() + * @see add_theme_support() + * + * @param bool $add Optional. Add or remove links. Default true. + */ + function automatic_feed_links($add = \true) + { + } + /** + * Retrieve user data based on field. + * + * @since 1.5.0 + * @deprecated 3.0.0 Use get_the_author_meta() + * @see get_the_author_meta() + * + * @param string $field User meta field. + * @param false|int $user Optional. User ID to retrieve the field for. Default false (current user). + * @return string The author's field from the current author's DB object. + */ + function get_profile($field, $user = \false) + { + } + /** + * Retrieves the number of posts a user has written. + * + * @since 0.71 + * @deprecated 3.0.0 Use count_user_posts() + * @see count_user_posts() + * + * @param int $userid User to count posts for. + * @return int Number of posts the given user has written. + */ + function get_usernumposts($userid) + { + } + /** + * Callback used to change %uXXXX to &#YYY; syntax + * + * @since 2.8.0 + * @access private + * @deprecated 3.0.0 + * + * @param array $matches Single Match + * @return string An HTML entity + */ + function funky_javascript_callback($matches) + { + } + /** + * Fixes JavaScript bugs in browsers. + * + * Converts unicode characters to HTML numbered entities. + * + * @since 1.5.0 + * @deprecated 3.0.0 + * + * @global $is_macIE + * @global $is_winIE + * + * @param string $text Text to be made safe. + * @return string Fixed text. + */ + function funky_javascript_fix($text) + { + } + /** + * Checks that the taxonomy name exists. + * + * @since 2.3.0 + * @deprecated 3.0.0 Use taxonomy_exists() + * @see taxonomy_exists() + * + * @param string $taxonomy Name of taxonomy object + * @return bool Whether the taxonomy exists. + */ + function is_taxonomy($taxonomy) + { + } + /** + * Check if Term exists. + * + * @since 2.3.0 + * @deprecated 3.0.0 Use term_exists() + * @see term_exists() + * + * @param int|string $term The term to check + * @param string $taxonomy The taxonomy name to use + * @param int $parent ID of parent term under which to confine the exists search. + * @return mixed Get the term ID or term object, if exists. + * @phpstan-return ($term is 0 ? 0 : ($term is '' ? null : ($taxonomy is '' ? string|null : array{term_id: string, term_taxonomy_id: string}|null))) + */ + function is_term($term, $taxonomy = '', $parent = 0) + { + } + /** + * Determines whether the current admin page is generated by a plugin. + * + * Use global $plugin_page and/or get_plugin_page_hookname() hooks. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 1.5.0 + * @deprecated 3.1.0 + * + * @global $plugin_page + * + * @return bool + */ + function is_plugin_page() + { + } + /** + * Update the categories cache. + * + * This function does not appear to be used anymore or does not appear to be + * needed. It might be a legacy function left over from when there was a need + * for updating the category cache. + * + * @since 1.5.0 + * @deprecated 3.1.0 + * + * @return bool Always return True + */ + function update_category_cache() + { + } + /** + * Check for PHP timezone support + * + * @since 2.9.0 + * @deprecated 3.2.0 + * + * @return bool + */ + function wp_timezone_supported() + { + } + /** + * Displays an editor: TinyMCE, HTML, or both. + * + * @since 2.1.0 + * @deprecated 3.3.0 Use wp_editor() + * @see wp_editor() + * + * @param string $content Textarea content. + * @param string $id Optional. HTML ID attribute value. Default 'content'. + * @param string $prev_id Optional. Unused. + * @param bool $media_buttons Optional. Whether to display media buttons. Default true. + * @param int $tab_index Optional. Unused. + * @param bool $extended Optional. Unused. + */ + function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = \true, $tab_index = 2, $extended = \true) + { + } + /** + * Perform the query to get the $metavalues array(s) needed by _fill_user and _fill_many_users + * + * @since 3.0.0 + * @deprecated 3.3.0 + * + * @param array $ids User ID numbers list. + * @return array of arrays. The array is indexed by user_id, containing $metavalues object arrays. + */ + function get_user_metavalues($ids) + { + } + /** + * Sanitize every user field. + * + * If the context is 'raw', then the user object or array will get minimal sanitization of the int fields. + * + * @since 2.3.0 + * @deprecated 3.3.0 + * + * @param object|array $user The user object or array. + * @param string $context Optional. How to sanitize user fields. Default 'display'. + * @return object|array The now sanitized user object or array (will be the same type as $user). + */ + function sanitize_user_object($user, $context = 'display') + { + } + /** + * Get boundary post relational link. + * + * Can either be start or end post relational link. + * + * @since 2.8.0 + * @deprecated 3.3.0 + * + * @param string $title Optional. Link title format. Default '%title'. + * @param bool $in_same_cat Optional. Whether link should be in a same category. + * Default false. + * @param string $excluded_categories Optional. Excluded categories IDs. Default empty. + * @param bool $start Optional. Whether to display link to first or last post. + * Default true. + * @return string + */ + function get_boundary_post_rel_link($title = '%title', $in_same_cat = \false, $excluded_categories = '', $start = \true) + { + } + /** + * Display relational link for the first post. + * + * @since 2.8.0 + * @deprecated 3.3.0 + * + * @param string $title Optional. Link title format. + * @param bool $in_same_cat Optional. Whether link should be in a same category. + * @param string $excluded_categories Optional. Excluded categories IDs. + */ + function start_post_rel_link($title = '%title', $in_same_cat = \false, $excluded_categories = '') + { + } + /** + * Get site index relational link. + * + * @since 2.8.0 + * @deprecated 3.3.0 + * + * @return string + */ + function get_index_rel_link() + { + } + /** + * Display relational link for the site index. + * + * @since 2.8.0 + * @deprecated 3.3.0 + */ + function index_rel_link() + { + } + /** + * Get parent post relational link. + * + * @since 2.8.0 + * @deprecated 3.3.0 + * + * @global WP_Post $post Global post object. + * + * @param string $title Optional. Link title format. Default '%title'. + * @return string + */ + function get_parent_post_rel_link($title = '%title') + { + } + /** + * Display relational link for parent item + * + * @since 2.8.0 + * @deprecated 3.3.0 + * + * @param string $title Optional. Link title format. Default '%title'. + */ + function parent_post_rel_link($title = '%title') + { + } + /** + * Add the "Dashboard"/"Visit Site" menu. + * + * @since 3.2.0 + * @deprecated 3.3.0 + * + * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance. + */ + function wp_admin_bar_dashboard_view_site_menu($wp_admin_bar) + { + } + /** + * Checks if the current user belong to a given site. + * + * @since MU (3.0.0) + * @deprecated 3.3.0 Use is_user_member_of_blog() + * @see is_user_member_of_blog() + * + * @param int $blog_id Site ID + * @return bool True if the current users belong to $blog_id, false if not. + */ + function is_blog_user($blog_id = 0) + { + } + /** + * Open the file handle for debugging. + * + * @since 0.71 + * @deprecated 3.4.0 Use error_log() + * @see error_log() + * + * @link https://www.php.net/manual/en/function.error-log.php + * + * @param string $filename File name. + * @param string $mode Type of access you required to the stream. + * @return false Always false. + */ + function debug_fopen($filename, $mode) + { + } + /** + * Write contents to the file used for debugging. + * + * @since 0.71 + * @deprecated 3.4.0 Use error_log() + * @see error_log() + * + * @link https://www.php.net/manual/en/function.error-log.php + * + * @param mixed $fp Unused. + * @param string $message Message to log. + */ + function debug_fwrite($fp, $message) + { + } + /** + * Close the debugging file handle. + * + * @since 0.71 + * @deprecated 3.4.0 Use error_log() + * @see error_log() + * + * @link https://www.php.net/manual/en/function.error-log.php + * + * @param mixed $fp Unused. + */ + function debug_fclose($fp) + { + } + /** + * Retrieve list of themes with theme data in theme directory. + * + * The theme is broken, if it doesn't have a parent theme and is missing either + * style.css and, or index.php. If the theme has a parent theme then it is + * broken, if it is missing style.css; index.php is optional. + * + * @since 1.5.0 + * @deprecated 3.4.0 Use wp_get_themes() + * @see wp_get_themes() + * + * @return array Theme list with theme data. + */ + function get_themes() + { + } + /** + * Retrieve theme data. + * + * @since 1.5.0 + * @deprecated 3.4.0 Use wp_get_theme() + * @see wp_get_theme() + * + * @param string $theme Theme name. + * @return array|null Null, if theme name does not exist. Theme data, if exists. + */ + function get_theme($theme) + { + } + /** + * Retrieve current theme name. + * + * @since 1.5.0 + * @deprecated 3.4.0 Use wp_get_theme() + * @see wp_get_theme() + * + * @return string + */ + function get_current_theme() + { + } + /** + * Accepts matches array from preg_replace_callback in wpautop() or a string. + * + * Ensures that the contents of a `<pre>...</pre>` HTML block are not + * converted into paragraphs or line breaks. + * + * @since 1.2.0 + * @deprecated 3.4.0 + * + * @param array|string $matches The array or string + * @return string The pre block without paragraph/line break conversion. + */ + function clean_pre($matches) + { + } + /** + * Add callbacks for image header display. + * + * @since 2.1.0 + * @deprecated 3.4.0 Use add_theme_support() + * @see add_theme_support() + * + * @param callable $wp_head_callback Call on the {@see 'wp_head'} action. + * @param callable $admin_head_callback Call on custom header administration screen. + * @param callable $admin_preview_callback Output a custom header image div on the custom header administration screen. Optional. + */ + function add_custom_image_header($wp_head_callback, $admin_head_callback, $admin_preview_callback = '') + { + } + /** + * Remove image header support. + * + * @since 3.1.0 + * @deprecated 3.4.0 Use remove_theme_support() + * @see remove_theme_support() + * + * @return null|bool Whether support was removed. + */ + function remove_custom_image_header() + { + } + /** + * Add callbacks for background image display. + * + * @since 3.0.0 + * @deprecated 3.4.0 Use add_theme_support() + * @see add_theme_support() + * + * @param callable $wp_head_callback Call on the {@see 'wp_head'} action. + * @param callable $admin_head_callback Call on custom background administration screen. + * @param callable $admin_preview_callback Output a custom background image div on the custom background administration screen. Optional. + */ + function add_custom_background($wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '') + { + } + /** + * Remove custom background support. + * + * @since 3.1.0 + * @deprecated 3.4.0 Use add_custom_background() + * @see add_custom_background() + * + * @return null|bool Whether support was removed. + */ + function remove_custom_background() + { + } + /** + * Retrieve theme data from parsed theme file. + * + * @since 1.5.0 + * @deprecated 3.4.0 Use wp_get_theme() + * @see wp_get_theme() + * + * @param string $theme_file Theme file path. + * @return array Theme data. + */ + function get_theme_data($theme_file) + { + } + /** + * Alias of update_post_cache(). + * + * @see update_post_cache() Posts and pages are the same, alias is intentional + * + * @since 1.5.1 + * @deprecated 3.4.0 Use update_post_cache() + * @see update_post_cache() + * + * @param array $pages list of page objects + */ + function update_page_cache(&$pages) + { + } + /** + * Will clean the page in the cache. + * + * Clean (read: delete) page from cache that matches $id. Will also clean cache + * associated with 'all_page_ids' and 'get_pages'. + * + * @since 2.0.0 + * @deprecated 3.4.0 Use clean_post_cache + * @see clean_post_cache() + * + * @param int $id Page ID to clean + */ + function clean_page_cache($id) + { + } + /** + * Retrieve nonce action "Are you sure" message. + * + * Deprecated in 3.4.1 and 3.5.0. Backported to 3.3.3. + * + * @since 2.0.4 + * @deprecated 3.4.1 Use wp_nonce_ays() + * @see wp_nonce_ays() + * + * @param string $action Nonce action. + * @return string Are you sure message. + */ + function wp_explain_nonce($action) + { + } + /** + * Display "sticky" CSS class, if a post is sticky. + * + * @since 2.7.0 + * @deprecated 3.5.0 Use post_class() + * @see post_class() + * + * @param int $post_id An optional post ID. + */ + function sticky_class($post_id = \null) + { + } + /** + * Retrieve post ancestors. + * + * This is no longer needed as WP_Post lazy-loads the ancestors + * property with get_post_ancestors(). + * + * @since 2.3.4 + * @deprecated 3.5.0 Use get_post_ancestors() + * @see get_post_ancestors() + * + * @param WP_Post $post Post object, passed by reference (unused). + */ + function _get_post_ancestors(&$post) + { + } + /** + * Load an image from a string, if PHP supports it. + * + * @since 2.1.0 + * @deprecated 3.5.0 Use wp_get_image_editor() + * @see wp_get_image_editor() + * + * @param string $file Filename of the image to load. + * @return resource|GdImage|string The resulting image resource or GdImage instance on success, + * error string on failure. + */ + function wp_load_image($file) + { + } + /** + * Scale down an image to fit a particular size and save a new copy of the image. + * + * The PNG transparency will be preserved using the function, as well as the + * image type. If the file going in is PNG, then the resized image is going to + * be PNG. The only supported image types are PNG, GIF, and JPEG. + * + * Some functionality requires API to exist, so some PHP version may lose out + * support. This is not the fault of WordPress (where functionality is + * downgraded, not actual defects), but of your PHP version. + * + * @since 2.5.0 + * @deprecated 3.5.0 Use wp_get_image_editor() + * @see wp_get_image_editor() + * + * @param string $file Image file path. + * @param int $max_w Maximum width to resize to. + * @param int $max_h Maximum height to resize to. + * @param bool $crop Optional. Whether to crop image or resize. Default false. + * @param string $suffix Optional. File suffix. Default null. + * @param string $dest_path Optional. New image file path. Default null. + * @param int $jpeg_quality Optional. Image quality percentage. Default 90. + * @return mixed WP_Error on failure. String with new destination path. + */ + function image_resize($file, $max_w, $max_h, $crop = \false, $suffix = \null, $dest_path = \null, $jpeg_quality = 90) + { + } + /** + * Retrieve a single post, based on post ID. + * + * Has categories in 'post_category' property or key. Has tags in 'tags_input' + * property or key. + * + * @since 1.0.0 + * @deprecated 3.5.0 Use get_post() + * @see get_post() + * + * @param int $postid Post ID. + * @param string $mode How to return result, either OBJECT, ARRAY_N, or ARRAY_A. + * @return WP_Post|null Post object or array holding post contents and information + */ + function wp_get_single_post($postid = 0, $mode = \OBJECT) + { + } + /** + * Check that the user login name and password is correct. + * + * @since 0.71 + * @deprecated 3.5.0 Use wp_authenticate() + * @see wp_authenticate() + * + * @param string $user_login User name. + * @param string $user_pass User password. + * @return bool False if does not authenticate, true if username and password authenticates. + */ + function user_pass_ok($user_login, $user_pass) + { + } + /** + * Callback formerly fired on the save_post hook. No longer needed. + * + * @since 2.3.0 + * @deprecated 3.5.0 + */ + function _save_post_hook() + { + } + /** + * Check if the installed version of GD supports particular image type + * + * @since 2.9.0 + * @deprecated 3.5.0 Use wp_image_editor_supports() + * @see wp_image_editor_supports() + * + * @param string $mime_type + * @return bool + */ + function gd_edit_image_support($mime_type) + { + } + /** + * Converts an integer byte value to a shorthand byte value. + * + * @since 2.3.0 + * @deprecated 3.6.0 Use size_format() + * @see size_format() + * + * @param int $bytes An integer byte value. + * @return string A shorthand byte value. + */ + function wp_convert_bytes_to_hr($bytes) + { + } + /** + * Formerly used internally to tidy up the search terms. + * + * @since 2.9.0 + * @access private + * @deprecated 3.7.0 + * + * @param string $t Search terms to "tidy", e.g. trim. + * @return string Trimmed search terms. + */ + function _search_terms_tidy($t) + { + } + /** + * Determine if TinyMCE is available. + * + * Checks to see if the user has deleted the tinymce files to slim down + * their WordPress installation. + * + * @since 2.1.0 + * @deprecated 3.9.0 + * + * @return bool Whether TinyMCE exists. + */ + function rich_edit_exists() + { + } + /** + * Old callback for tag link tooltips. + * + * @since 2.7.0 + * @access private + * @deprecated 3.9.0 + * + * @param int $count Number of topics. + * @return int Number of topics. + */ + function default_topic_count_text($count) + { + } + /** + * Formerly used to escape strings before inserting into the DB. + * + * Has not performed this function for many, many years. Use wpdb::prepare() instead. + * + * @since 0.71 + * @deprecated 3.9.0 + * + * @param string $content The text to format. + * @return string The very same text. + */ + function format_to_post($content) + { + } + /** + * Formerly used to escape strings before searching the DB. It was poorly documented and never worked as described. + * + * @since 2.5.0 + * @deprecated 4.0.0 Use wpdb::esc_like() + * @see wpdb::esc_like() + * + * @param string $text The text to be escaped. + * @return string text, safe for inclusion in LIKE query. + */ + function like_escape($text) + { + } + /** + * Determines if the URL can be accessed over SSL. + * + * Determines if the URL can be accessed over SSL by using the WordPress HTTP API to access + * the URL using https as the scheme. + * + * @since 2.5.0 + * @deprecated 4.0.0 + * + * @param string $url The URL to test. + * @return bool Whether SSL access is available. + */ + function url_is_accessable_via_ssl($url) + { + } + /** + * Start preview theme output buffer. + * + * Will only perform task if the user has permissions and template and preview + * query variables exist. + * + * @since 2.6.0 + * @deprecated 4.3.0 + */ + function preview_theme() + { + } + /** + * Private function to modify the current template when previewing a theme + * + * @since 2.9.0 + * @deprecated 4.3.0 + * @access private + * + * @return string + */ + function _preview_theme_template_filter() + { + } + /** + * Private function to modify the current stylesheet when previewing a theme + * + * @since 2.9.0 + * @deprecated 4.3.0 + * @access private + * + * @return string + */ + function _preview_theme_stylesheet_filter() + { + } + /** + * Callback function for ob_start() to capture all links in the theme. + * + * @since 2.6.0 + * @deprecated 4.3.0 + * @access private + * + * @param string $content + * @return string + */ + function preview_theme_ob_filter($content) + { + } + /** + * Manipulates preview theme links in order to control and maintain location. + * + * Callback function for preg_replace_callback() to accept and filter matches. + * + * @since 2.6.0 + * @deprecated 4.3.0 + * @access private + * + * @param array $matches + * @return string + */ + function preview_theme_ob_filter_callback($matches) + { + } + /** + * Formats text for the rich text editor. + * + * The {@see 'richedit_pre'} filter is applied here. If `$text` is empty the filter will + * be applied to an empty string. + * + * @since 2.0.0 + * @deprecated 4.3.0 Use format_for_editor() + * @see format_for_editor() + * + * @param string $text The text to be formatted. + * @return string The formatted text after filter is applied. + */ + function wp_richedit_pre($text) + { + } + /** + * Formats text for the HTML editor. + * + * Unless $output is empty it will pass through htmlspecialchars before the + * {@see 'htmledit_pre'} filter is applied. + * + * @since 2.5.0 + * @deprecated 4.3.0 Use format_for_editor() + * @see format_for_editor() + * + * @param string $output The text to be formatted. + * @return string Formatted text after filter applied. + */ + function wp_htmledit_pre($output) + { + } + /** + * Retrieve permalink from post ID. + * + * @since 1.0.0 + * @deprecated 4.4.0 Use get_permalink() + * @see get_permalink() + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. + * @return string|false + */ + function post_permalink($post = 0) + { + } + /** + * Perform a HTTP HEAD or GET request. + * + * If $file_path is a writable filename, this will do a GET request and write + * the file to that path. + * + * @since 2.5.0 + * @deprecated 4.4.0 Use WP_Http + * @see WP_Http + * + * @param string $url URL to fetch. + * @param string|bool $file_path Optional. File path to write request to. Default false. + * @param int $red Optional. The number of Redirects followed, Upon 5 being hit, + * returns false. Default 1. + * @return \WpOrg\Requests\Utility\CaseInsensitiveDictionary|false Headers on success, false on failure. + */ + function wp_get_http($url, $file_path = \false, $red = 1) + { + } + /** + * Whether SSL login should be forced. + * + * @since 2.6.0 + * @deprecated 4.4.0 Use force_ssl_admin() + * @see force_ssl_admin() + * + * @param string|bool $force Optional Whether to force SSL login. Default null. + * @return bool True if forced, false if not forced. + */ + function force_ssl_login($force = \null) + { + } + /** + * Retrieve path of comment popup template in current or parent template. + * + * @since 1.5.0 + * @deprecated 4.5.0 + * + * @return string Full path to comments popup template file. + */ + function get_comments_popup_template() + { + } + /** + * Determines whether the current URL is within the comments popup window. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 1.5.0 + * @deprecated 4.5.0 + * + * @return false Always returns false. + */ + function is_comments_popup() + { + } + /** + * Display the JS popup script to show a comment. + * + * @since 0.71 + * @deprecated 4.5.0 + */ + function comments_popup_script() + { + } + /** + * Adds element attributes to open links in new tabs. + * + * @since 0.71 + * @deprecated 4.5.0 + * + * @param string $text Content to replace links to open in a new tab. + * @return string Content that has filtered links. + */ + function popuplinks($text) + { + } + /** + * The Google Video embed handler callback. + * + * Deprecated function that previously assisted in turning Google Video URLs + * into embeds but that service has since been shut down. + * + * @since 2.9.0 + * @deprecated 4.6.0 + * + * @return string An empty string. + */ + function wp_embed_handler_googlevideo($matches, $attr, $url, $rawattr) + { + } + /** + * Retrieve path of paged template in current or parent template. + * + * @since 1.5.0 + * @deprecated 4.7.0 The paged.php template is no longer part of the theme template hierarchy. + * + * @return string Full path to paged template file. + */ + function get_paged_template() + { + } + /** + * Removes the HTML JavaScript entities found in early versions of Netscape 4. + * + * Previously, this function was pulled in from the original + * import of kses and removed a specific vulnerability only + * existent in early version of Netscape 4. However, this + * vulnerability never affected any other browsers and can + * be considered safe for the modern web. + * + * The regular expression which sanitized this vulnerability + * has been removed in consideration of the performance and + * energy demands it placed, now merely passing through its + * input to the return. + * + * @since 1.0.0 + * @deprecated 4.7.0 Officially dropped security support for Netscape 4. + * + * @param string $content + * @return string + */ + function wp_kses_js_entities($content) + { + } + /** + * Sort categories by ID. + * + * Used by usort() as a callback, should not be used directly. Can actually be + * used to sort any term object. + * + * @since 2.3.0 + * @deprecated 4.7.0 Use wp_list_sort() + * @access private + * + * @param object $a + * @param object $b + * @return int + */ + function _usort_terms_by_ID($a, $b) + { + } + /** + * Sort categories by name. + * + * Used by usort() as a callback, should not be used directly. Can actually be + * used to sort any term object. + * + * @since 2.3.0 + * @deprecated 4.7.0 Use wp_list_sort() + * @access private + * + * @param object $a + * @param object $b + * @return int + */ + function _usort_terms_by_name($a, $b) + { + } + /** + * Sort menu items by the desired key. + * + * @since 3.0.0 + * @deprecated 4.7.0 Use wp_list_sort() + * @access private + * + * @global string $_menu_item_sort_prop + * + * @param object $a The first object to compare + * @param object $b The second object to compare + * @return int -1, 0, or 1 if $a is considered to be respectively less than, equal to, or greater than $b. + */ + function _sort_nav_menu_items($a, $b) + { + } + /** + * Retrieves the Press This bookmarklet link. + * + * @since 2.6.0 + * @deprecated 4.9.0 + * @return string + */ + function get_shortcut_link() + { + } + /** + * Ajax handler for saving a post from Press This. + * + * @since 4.2.0 + * @deprecated 4.9.0 + */ + function wp_ajax_press_this_save_post() + { + } + /** + * Ajax handler for creating new category from Press This. + * + * @since 4.2.0 + * @deprecated 4.9.0 + */ + function wp_ajax_press_this_add_category() + { + } + /** + * Return the user request object for the specified request ID. + * + * @since 4.9.6 + * @deprecated 5.4.0 Use wp_get_user_request() + * @see wp_get_user_request() + * + * @param int $request_id The ID of the user request. + * @return WP_User_Request|false + */ + function wp_get_user_request_data($request_id) + { + } + /** + * Filters 'img' elements in post content to add 'srcset' and 'sizes' attributes. + * + * @since 4.4.0 + * @deprecated 5.5.0 + * + * @see wp_image_add_srcset_and_sizes() + * + * @param string $content The raw post content to be filtered. + * @return string Converted content with 'srcset' and 'sizes' attributes added to images. + */ + function wp_make_content_images_responsive($content) + { + } + /** + * Turn register globals off. + * + * @since 2.1.0 + * @access private + * @deprecated 5.5.0 + */ + function wp_unregister_GLOBALS() + { + } + /** + * Does comment contain disallowed characters or words. + * + * @since 1.5.0 + * @deprecated 5.5.0 Use wp_check_comment_disallowed_list() instead. + * Please consider writing more inclusive code. + * + * @param string $author The author of the comment + * @param string $email The email of the comment + * @param string $url The url used in the comment + * @param string $comment The comment content + * @param string $user_ip The comment author's IP address + * @param string $user_agent The author's browser user agent + * @return bool True if comment contains disallowed content, false if comment does not + */ + function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) + { + } + /** + * Filters out `register_meta()` args based on an allowed list. + * + * `register_meta()` args may change over time, so requiring the allowed list + * to be explicitly turned off is a warranty seal of sorts. + * + * @access private + * @since 4.6.0 + * @deprecated 5.5.0 Use _wp_register_meta_args_allowed_list() instead. + * Please consider writing more inclusive code. + * + * @param array $args Arguments from `register_meta()`. + * @param array $default_args Default arguments for `register_meta()`. + * @return array Filtered arguments. + */ + function _wp_register_meta_args_whitelist($args, $default_args) + { + } + /** + * Adds an array of options to the list of allowed options. + * + * @since 2.7.0 + * @deprecated 5.5.0 Use add_allowed_options() instead. + * Please consider writing more inclusive code. + * + * @param array $new_options + * @param string|array $options + * @return array + */ + function add_option_whitelist($new_options, $options = '') + { + } + /** + * Removes a list of options from the allowed options list. + * + * @since 2.7.0 + * @deprecated 5.5.0 Use remove_allowed_options() instead. + * Please consider writing more inclusive code. + * + * @param array $del_options + * @param string|array $options + * @return array + */ + function remove_option_whitelist($del_options, $options = '') + { + } + /** + * Adds slashes to only string values in an array of values. + * + * This should be used when preparing data for core APIs that expect slashed data. + * This should not be used to escape data going directly into an SQL query. + * + * @since 5.3.0 + * @deprecated 5.6.0 Use wp_slash() + * + * @see wp_slash() + * + * @param mixed $value Scalar or array of scalars. + * @return mixed Slashes $value + */ + function wp_slash_strings_only($value) + { + } + /** + * Adds slashes only if the provided value is a string. + * + * @since 5.3.0 + * @deprecated 5.6.0 + * + * @see wp_slash() + * + * @param mixed $value + * @return mixed + */ + function addslashes_strings_only($value) + { + } + /** + * Displays a `noindex` meta tag if required by the blog configuration. + * + * If a blog is marked as not being public then the `noindex` meta tag will be + * output to tell web robots not to index the page content. + * + * Typical usage is as a {@see 'wp_head'} callback: + * + * add_action( 'wp_head', 'noindex' ); + * + * @see wp_no_robots() + * + * @since 2.1.0 + * @deprecated 5.7.0 Use wp_robots_noindex() instead on 'wp_robots' filter. + */ + function noindex() + { + } + /** + * Display a `noindex` meta tag. + * + * Outputs a `noindex` meta tag that tells web robots not to index the page content. + * + * Typical usage is as a {@see 'wp_head'} callback: + * + * add_action( 'wp_head', 'wp_no_robots' ); + * + * @since 3.3.0 + * @since 5.3.0 Echo `noindex,nofollow` if search engine visibility is discouraged. + * @deprecated 5.7.0 Use wp_robots_no_robots() instead on 'wp_robots' filter. + * @phpstan-return void + */ + function wp_no_robots() + { + } + /** + * Display a `noindex,noarchive` meta tag and referrer `strict-origin-when-cross-origin` meta tag. + * + * Outputs a `noindex,noarchive` meta tag that tells web robots not to index or cache the page content. + * Outputs a referrer `strict-origin-when-cross-origin` meta tag that tells the browser not to send + * the full URL as a referrer to other sites when cross-origin assets are loaded. + * + * Typical usage is as a {@see 'wp_head'} callback: + * + * add_action( 'wp_head', 'wp_sensitive_page_meta' ); + * + * @since 5.0.1 + * @deprecated 5.7.0 Use wp_robots_sensitive_page() instead on 'wp_robots' filter + * and wp_strict_cross_origin_referrer() on 'wp_head' action. + * + * @see wp_robots_sensitive_page() + */ + function wp_sensitive_page_meta() + { + } + /** + * Render inner blocks from the `core/columns` block for generating an excerpt. + * + * @since 5.2.0 + * @access private + * @deprecated 5.8.0 Use _excerpt_render_inner_blocks() introduced in 5.8.0. + * + * @see _excerpt_render_inner_blocks() + * + * @param array $columns The parsed columns block. + * @param array $allowed_blocks The list of allowed inner blocks. + * @return string The rendered inner blocks. + */ + function _excerpt_render_inner_columns_blocks($columns, $allowed_blocks) + { + } + /** + * Renders the duotone filter SVG and returns the CSS filter property to + * reference the rendered SVG. + * + * @since 5.9.0 + * @deprecated 5.9.1 Use wp_get_duotone_filter_property() introduced in 5.9.1. + * + * @see wp_get_duotone_filter_property() + * + * @param array $preset Duotone preset value as seen in theme.json. + * @return string Duotone CSS filter property. + */ + function wp_render_duotone_filter_preset($preset) + { + } + /** + * Checks whether serialization of the current block's border properties should occur. + * + * @since 5.8.0 + * @access private + * @deprecated 6.0.0 Use wp_should_skip_block_supports_serialization() introduced in 6.0.0. + * + * @see wp_should_skip_block_supports_serialization() + * + * @param WP_Block_Type $block_type Block type. + * @return bool Whether serialization of the current block's border properties + * should occur. + */ + function wp_skip_border_serialization($block_type) + { + } + /** + * Checks whether serialization of the current block's dimensions properties should occur. + * + * @since 5.9.0 + * @access private + * @deprecated 6.0.0 Use wp_should_skip_block_supports_serialization() introduced in 6.0.0. + * + * @see wp_should_skip_block_supports_serialization() + * + * @param WP_Block_type $block_type Block type. + * @return bool Whether to serialize spacing support styles & classes. + */ + function wp_skip_dimensions_serialization($block_type) + { + } + /** + * Checks whether serialization of the current block's spacing properties should occur. + * + * @since 5.9.0 + * @access private + * @deprecated 6.0.0 Use wp_should_skip_block_supports_serialization() introduced in 6.0.0. + * + * @see wp_should_skip_block_supports_serialization() + * + * @param WP_Block_Type $block_type Block type. + * @return bool Whether to serialize spacing support styles & classes. + */ + function wp_skip_spacing_serialization($block_type) + { + } + /** + * Inject the block editor assets that need to be loaded into the editor's iframe as an inline script. + * + * @since 5.8.0 + * @deprecated 6.0.0 + */ + function wp_add_iframed_editor_assets_html() + { + } + /** + * Retrieves thumbnail for an attachment. + * Note that this works only for the (very) old image metadata style where 'thumb' was set, + * and the 'sizes' array did not exist. This function returns false for the newer image metadata style + * despite that 'thumbnail' is present in the 'sizes' array. + * + * @since 2.1.0 + * @deprecated 6.1.0 + * + * @param int $post_id Optional. Attachment ID. Default is the ID of the global `$post`. + * @return string|false Thumbnail file path on success, false on failure. + */ + function wp_get_attachment_thumb_file($post_id = 0) + { + } + /** + * Gets the path to a translation file for loading a textdomain just in time. + * + * Caches the retrieved results internally. + * + * @since 4.7.0 + * @deprecated 6.1.0 + * @access private + * + * @see _load_textdomain_just_in_time() + * + * @param string $domain Text domain. Unique identifier for retrieving translated strings. + * @param bool $reset Whether to reset the internal cache. Used by the switch to locale functionality. + * @return string|false The path to the translation file or false if no translation file was found. + */ + function _get_path_to_translation($domain, $reset = \false) + { + } + /** + * Gets the path to a translation file in the languages directory for the current locale. + * + * Holds a cached list of available .mo files to improve performance. + * + * @since 4.7.0 + * @deprecated 6.1.0 + * @access private + * + * @see _get_path_to_translation() + * + * @param string $domain Text domain. Unique identifier for retrieving translated strings. + * @return string|false The path to the translation file or false if no translation file was found. + */ + function _get_path_to_translation_from_lang_dir($domain) + { + } + /** + * Allows multiple block styles. + * + * @since 5.9.0 + * @deprecated 6.1.0 + * + * @param array $metadata Metadata for registering a block type. + * @return array Metadata for registering a block type. + */ + function _wp_multiple_block_styles($metadata) + { + } + /** + * Generates an inline style for a typography feature e.g. text decoration, + * text transform, and font style. + * + * @since 5.8.0 + * @access private + * @deprecated 6.1.0 Use wp_style_engine_get_styles() introduced in 6.1.0. + * + * @see wp_style_engine_get_styles() + * + * @param array $attributes Block's attributes. + * @param string $feature Key for the feature within the typography styles. + * @param string $css_property Slug for the CSS property the inline style sets. + * @return string CSS inline style. + */ + function wp_typography_get_css_variable_inline_style($attributes, $feature, $css_property) + { + } + /** + * Determines whether global terms are enabled. + * + * @since 3.0.0 + * @since 6.1.0 This function now always returns false. + * @deprecated 6.1.0 + * + * @return bool Always returns false. + */ + function global_terms_enabled() + { + } + /** + * Filter the SQL clauses of an attachment query to include filenames. + * + * @since 4.7.0 + * @deprecated 6.0.3 + * @access private + * + * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY, + * DISTINCT, fields (SELECT), and LIMITS clauses. + * @return array The unmodified clauses. + */ + function _filter_query_attachment_filenames($clauses) + { + } + /** + * Retrieves a page given its title. + * + * If more than one post uses the same title, the post with the smallest ID will be returned. + * Be careful: in case of more than one post having the same title, it will check the oldest + * publication date, not the smallest ID. + * + * Because this function uses the MySQL '=' comparison, $page_title will usually be matched + * as case-insensitive with default collation. + * + * @since 2.1.0 + * @since 3.0.0 The `$post_type` parameter was added. + * @deprecated 6.2.0 Use WP_Query. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $page_title Page title. + * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which + * correspond to a WP_Post object, an associative array, or a numeric array, + * respectively. Default OBJECT. + * @param string|array $post_type Optional. Post type or array of post types. Default 'page'. + * @return WP_Post|array|null WP_Post (or array) on success, or null on failure. + */ + function get_page_by_title($page_title, $output = \OBJECT, $post_type = 'page') + { + } + /** + * Returns the correct template for the site's home page. + * + * @access private + * @since 6.0.0 + * @deprecated 6.2.0 Site Editor's server-side redirect for missing postType and postId + * query args is removed. Thus, this function is no longer used. + * + * @return array|null A template object, or null if none could be found. + */ + function _resolve_home_block_template() + { + } + /** + * Displays the link to the Windows Live Writer manifest file. + * + * @link https://msdn.microsoft.com/en-us/library/bb463265.aspx + * @since 2.3.1 + * @deprecated 6.3.0 WLW manifest is no longer in use and no longer included in core, + * so the output from this function is removed. + */ + function wlwmanifest_link() + { + } + /** + * Queues comments for metadata lazy-loading. + * + * @since 4.5.0 + * @deprecated 6.3.0 Use wp_lazyload_comment_meta() instead. + * + * @param WP_Comment[] $comments Array of comment objects. + */ + function wp_queue_comments_for_comment_meta_lazyload($comments) + { + } + /** + * Gets the default value to use for a `loading` attribute on an element. + * + * This function should only be called for a tag and context if lazy-loading is generally enabled. + * + * The function usually returns 'lazy', but uses certain heuristics to guess whether the current element is likely to + * appear above the fold, in which case it returns a boolean `false`, which will lead to the `loading` attribute being + * omitted on the element. The purpose of this refinement is to avoid lazy-loading elements that are within the initial + * viewport, which can have a negative performance impact. + * + * Under the hood, the function uses {@see wp_increase_content_media_count()} every time it is called for an element + * within the main content. If the element is the very first content element, the `loading` attribute will be omitted. + * This default threshold of 3 content elements to omit the `loading` attribute for can be customized using the + * {@see 'wp_omit_loading_attr_threshold'} filter. + * + * @since 5.9.0 + * @deprecated 6.3.0 Use wp_get_loading_optimization_attributes() instead. + * @see wp_get_loading_optimization_attributes() + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param string $context Context for the element for which the `loading` attribute value is requested. + * @return string|bool The default `loading` attribute value. Either 'lazy', 'eager', or a boolean `false`, to indicate + * that the `loading` attribute should be skipped. + */ + function wp_get_loading_attr_default($context) + { + } + /** + * Adds `loading` attribute to an `img` HTML tag. + * + * @since 5.5.0 + * @deprecated 6.3.0 Use wp_img_tag_add_loading_optimization_attrs() instead. + * @see wp_img_tag_add_loading_optimization_attrs() + * + * @param string $image The HTML `img` tag where the attribute should be added. + * @param string $context Additional context to pass to the filters. + * @return string Converted `img` tag with `loading` attribute added. + */ + function wp_img_tag_add_loading_attr($image, $context) + { + } + /** + * Takes input from [0, n] and returns it as [0, 1]. + * + * Direct port of TinyColor's function, lightly simplified to maintain + * consistency with TinyColor. + * + * @link https://github.com/bgrins/TinyColor + * + * @since 5.8.0 + * @deprecated 6.3.0 + * + * @access private + * + * @param mixed $n Number of unknown type. + * @param int $max Upper value of the range to bound to. + * @return float Value in the range [0, 1]. + */ + function wp_tinycolor_bound01($n, $max) + { + } + /** + * Direct port of tinycolor's boundAlpha function to maintain consistency with + * how tinycolor works. + * + * @link https://github.com/bgrins/TinyColor + * + * @since 5.9.0 + * @deprecated 6.3.0 + * + * @access private + * + * @param mixed $n Number of unknown type. + * @return float Value in the range [0,1]. + */ + function _wp_tinycolor_bound_alpha($n) + { + } + /** + * Rounds and converts values of an RGB object. + * + * Direct port of TinyColor's function, lightly simplified to maintain + * consistency with TinyColor. + * + * @link https://github.com/bgrins/TinyColor + * + * @since 5.8.0 + * @deprecated 6.3.0 + * + * @access private + * + * @param array $rgb_color RGB object. + * @return array Rounded and converted RGB object. + */ + function wp_tinycolor_rgb_to_rgb($rgb_color) + { + } + /** + * Helper function for hsl to rgb conversion. + * + * Direct port of TinyColor's function, lightly simplified to maintain + * consistency with TinyColor. + * + * @link https://github.com/bgrins/TinyColor + * + * @since 5.8.0 + * @deprecated 6.3.0 + * + * @access private + * + * @param float $p first component. + * @param float $q second component. + * @param float $t third component. + * @return float R, G, or B component. + */ + function wp_tinycolor_hue_to_rgb($p, $q, $t) + { + } + /** + * Converts an HSL object to an RGB object with converted and rounded values. + * + * Direct port of TinyColor's function, lightly simplified to maintain + * consistency with TinyColor. + * + * @link https://github.com/bgrins/TinyColor + * + * @since 5.8.0 + * @deprecated 6.3.0 + * + * @access private + * + * @param array $hsl_color HSL object. + * @return array Rounded and converted RGB object. + */ + function wp_tinycolor_hsl_to_rgb($hsl_color) + { + } + /** + * Parses hex, hsl, and rgb CSS strings using the same regex as TinyColor v1.4.2 + * used in the JavaScript. Only colors output from react-color are implemented. + * + * Direct port of TinyColor's function, lightly simplified to maintain + * consistency with TinyColor. + * + * @link https://github.com/bgrins/TinyColor + * @link https://github.com/casesandberg/react-color/ + * + * @since 5.8.0 + * @since 5.9.0 Added alpha processing. + * @deprecated 6.3.0 + * + * @access private + * + * @param string $color_str CSS color string. + * @return array RGB object. + */ + function wp_tinycolor_string_to_rgb($color_str) + { + } + /** + * Returns the prefixed id for the duotone filter for use as a CSS id. + * + * @since 5.9.1 + * @deprecated 6.3.0 + * + * @access private + * + * @param array $preset Duotone preset value as seen in theme.json. + * @return string Duotone filter CSS id. + */ + function wp_get_duotone_filter_id($preset) + { + } + /** + * Returns the CSS filter property url to reference the rendered SVG. + * + * @since 5.9.0 + * @since 6.1.0 Allow unset for preset colors. + * @deprecated 6.3.0 + * + * @access private + * + * @param array $preset Duotone preset value as seen in theme.json. + * @return string Duotone CSS filter property url value. + */ + function wp_get_duotone_filter_property($preset) + { + } + /** + * Returns the duotone filter SVG string for the preset. + * + * @since 5.9.1 + * @deprecated 6.3.0 + * + * @access private + * + * @param array $preset Duotone preset value as seen in theme.json. + * @return string Duotone SVG filter. + */ + function wp_get_duotone_filter_svg($preset) + { + } + /** + * Registers the style and colors block attributes for block types that support it. + * + * @since 5.8.0 + * @deprecated 6.3.0 Use WP_Duotone::register_duotone_support() instead. + * + * @access private + * + * @param WP_Block_Type $block_type Block Type. + */ + function wp_register_duotone_support($block_type) + { + } + /** + * Renders out the duotone stylesheet and SVG. + * + * @since 5.8.0 + * @since 6.1.0 Allow unset for preset colors. + * @deprecated 6.3.0 Use WP_Duotone::render_duotone_support() instead. + * + * @access private + * + * @param string $block_content Rendered block content. + * @param array $block Block object. + * @return string Filtered block content. + */ + function wp_render_duotone_support($block_content, $block) + { + } + /** + * Returns a string containing the SVGs to be referenced as filters (duotone). + * + * @since 5.9.1 + * @deprecated 6.3.0 SVG generation is handled on a per-block basis in block supports. + * + * @return string + */ + function wp_get_global_styles_svg_filters() + { + } + /** + * Renders the SVG filters supplied by theme.json. + * + * Note that this doesn't render the per-block user-defined + * filters which are handled by wp_render_duotone_support, + * but it should be rendered before the filtered content + * in the body to satisfy Safari's rendering quirks. + * + * @since 5.9.1 + * @deprecated 6.3.0 SVG generation is handled on a per-block basis in block supports. + * @phpstan-return void + */ + function wp_global_styles_render_svg_filters() + { + } + /** + * Build an array with CSS classes and inline styles defining the colors + * which will be applied to the navigation markup in the front-end. + * + * @since 5.9.0 + * @deprecated 6.3.0 This was removed from the Navigation Submenu block in favour of `wp_apply_colors_support()`. + * `wp_apply_colors_support()` returns an array with similar class and style values, + * but with different keys: `class` and `style`. + * + * @param array $context Navigation block context. + * @param array $attributes Block attributes. + * @param bool $is_sub_menu Whether the block is a sub-menu. + * @return array Colors CSS classes and inline styles. + */ + function block_core_navigation_submenu_build_css_colors($context, $attributes, $is_sub_menu = \false) + { + } + /** + * Runs the theme.json webfonts handler. + * + * Using `WP_Theme_JSON_Resolver`, it gets the fonts defined + * in the `theme.json` for the current selection and style + * variations, validates the font-face properties, generates + * the '@font-face' style declarations, and then enqueues the + * styles for both the editor and front-end. + * + * Design Notes: + * This is not a public API, but rather an internal handler. + * A future public Webfonts API will replace this stopgap code. + * + * This code design is intentional. + * a. It hides the inner-workings. + * b. It does not expose API ins or outs for consumption. + * c. It only works with a theme's `theme.json`. + * + * Why? + * a. To avoid backwards-compatibility issues when + * the Webfonts API is introduced in Core. + * b. To make `fontFace` declarations in `theme.json` work. + * + * @link https://github.com/WordPress/gutenberg/issues/40472 + * + * @since 6.0.0 + * @deprecated 6.4.0 Use wp_print_font_faces() instead. + * @access private + */ + function _wp_theme_json_webfonts_handler() + { + } + /** + * Prints the CSS in the embed iframe header. + * + * @since 4.4.0 + * @deprecated 6.4.0 Use wp_enqueue_embed_styles() instead. + */ + function print_embed_styles() + { + } + /** + * Prints the important emoji-related styles. + * + * @since 4.2.0 + * @deprecated 6.4.0 Use wp_enqueue_emoji_styles() instead. + * @phpstan-return void + */ + function print_emoji_styles() + { + } + /** + * Prints style and scripts for the admin bar. + * + * @since 3.1.0 + * @deprecated 6.4.0 Use wp_enqueue_admin_bar_header_styles() instead. + */ + function wp_admin_bar_header() + { + } + /** + * Prints default admin bar callback. + * + * @since 3.1.0 + * @deprecated 6.4.0 Use wp_enqueue_admin_bar_bump_styles() instead. + */ + function _admin_bar_bump_cb() + { + } + /** + * Runs a remote HTTPS request to detect whether HTTPS supported, and stores potential errors. + * + * This internal function is called by a regular Cron hook to ensure HTTPS support is detected and maintained. + * + * @since 5.7.0 + * @deprecated 6.4.0 The `wp_update_https_detection_errors()` function is no longer used and has been replaced by + * `wp_get_https_detection_errors()`. Previously the function was called by a regular Cron hook to + * update the `https_detection_errors` option, but this is no longer necessary as the errors are + * retrieved directly in Site Health and no longer used outside of Site Health. + * @access private + * @phpstan-return void + */ + function wp_update_https_detection_errors() + { + } + /** + * Adds `decoding` attribute to an `img` HTML tag. + * + * The `decoding` attribute allows developers to indicate whether the + * browser can decode the image off the main thread (`async`), on the + * main thread (`sync`) or as determined by the browser (`auto`). + * + * By default WordPress adds `decoding="async"` to images but developers + * can use the {@see 'wp_img_tag_add_decoding_attr'} filter to modify this + * to remove the attribute or set it to another accepted value. + * + * @since 6.1.0 + * @deprecated 6.4.0 Use wp_img_tag_add_loading_optimization_attrs() instead. + * @see wp_img_tag_add_loading_optimization_attrs() + * + * @param string $image The HTML `img` tag where the attribute should be added. + * @param string $context Additional context to pass to the filters. + * @return string Converted `img` tag with `decoding` attribute added. + */ + function wp_img_tag_add_decoding_attr($image, $context) + { + } + /** + * Parses wp_template content and injects the active theme's + * stylesheet as a theme attribute into each wp_template_part + * + * @since 5.9.0 + * @deprecated 6.4.0 Use traverse_and_serialize_blocks( parse_blocks( $template_content ), '_inject_theme_attribute_in_template_part_block' ) instead. + * @access private + * + * @param string $template_content serialized wp_template content. + * @return string Updated 'wp_template' content. + */ + function _inject_theme_attribute_in_block_template_content($template_content) + { + } + /** + * Parses a block template and removes the theme attribute from each template part. + * + * @since 5.9.0 + * @deprecated 6.4.0 Use traverse_and_serialize_blocks( parse_blocks( $template_content ), '_remove_theme_attribute_from_template_part_block' ) instead. + * @access private + * + * @param string $template_content Serialized block template content. + * @return string Updated block template content. + */ + function _remove_theme_attribute_in_block_template_content($template_content) + { + } + /** + * Prints the skip-link script & styles. + * + * @since 5.8.0 + * @access private + * @deprecated 6.4.0 Use wp_enqueue_block_template_skip_link() instead. + * + * @global string $_wp_current_template_content + * @phpstan-return void + */ + function the_block_template_skip_link() + { + } + /** + * Ensure that the view script has the `wp-interactivity` dependency. + * + * @since 6.4.0 + * @deprecated 6.5.0 + */ + function block_core_query_ensure_interactivity_dependency() + { + } + /** + * Ensure that the view script has the `wp-interactivity` dependency. + * + * @since 6.4.0 + * @deprecated 6.5.0 + */ + function block_core_file_ensure_interactivity_dependency() + { + } + /** + * Ensures that the view script has the `wp-interactivity` dependency. + * + * @since 6.4.0 + * @deprecated 6.5.0 + */ + function block_core_image_ensure_interactivity_dependency() + { + } + /** + * Updates the block content with elements class names. + * + * @deprecated 6.6.0 Generation of element class name is handled via `render_block_data` filter. + * + * @since 5.8.0 + * @since 6.4.0 Added support for button and heading element styling. + * @access private + * + * @param string $block_content Rendered block content. + * @param array $block Block object. + * @return string Filtered block content. + */ + function wp_render_elements_support($block_content, $block) + { + } + /** + * Processes the directives on the rendered HTML of the interactive blocks. + * + * This processes only one root interactive block at a time because the + * rendered HTML of that block contains the rendered HTML of all its inner + * blocks, including any interactive block. It does so by ignoring all the + * interactive inner blocks until the root interactive block is processed. + * + * @since 6.5.0 + * @deprecated 6.6.0 + * + * @param array $parsed_block The parsed block. + * @return array The same parsed block. + */ + function wp_interactivity_process_directives_of_interactive_blocks(array $parsed_block) : array + { + } + /** + * oEmbed API: Top-level oEmbed functionality + * + * @package WordPress + * @subpackage oEmbed + * @since 4.4.0 + */ + /** + * Registers an embed handler. + * + * Should probably only be used for sites that do not support oEmbed. + * + * @since 2.9.0 + * + * @global WP_Embed $wp_embed WordPress Embed object. + * + * @param string $id An internal ID/name for the handler. Needs to be unique. + * @param string $regex The regex that will be used to see if this handler should be used for a URL. + * @param callable $callback The callback function that will be called if the regex is matched. + * @param int $priority Optional. Used to specify the order in which the registered handlers will + * be tested. Default 10. + */ + function wp_embed_register_handler($id, $regex, $callback, $priority = 10) + { + } + /** + * Unregisters a previously-registered embed handler. + * + * @since 2.9.0 + * + * @global WP_Embed $wp_embed WordPress Embed object. + * + * @param string $id The handler ID that should be removed. + * @param int $priority Optional. The priority of the handler to be removed. Default 10. + */ + function wp_embed_unregister_handler($id, $priority = 10) + { + } + /** + * Creates default array of embed parameters. + * + * The width defaults to the content width as specified by the theme. If the + * theme does not specify a content width, then 500px is used. + * + * The default height is 1.5 times the width, or 1000px, whichever is smaller. + * + * The {@see 'embed_defaults'} filter can be used to adjust either of these values. + * + * @since 2.9.0 + * + * @global int $content_width + * + * @param string $url Optional. The URL that should be embedded. Default empty. + * @return int[] { + * Indexed array of the embed width and height in pixels. + * + * @type int $0 The embed width. + * @type int $1 The embed height. + * } + * @phpstan-return array{ + * 0: int, + * 1: int, + * } + */ + function wp_embed_defaults($url = '') + { + } + /** + * Attempts to fetch the embed HTML for a provided URL using oEmbed. + * + * @since 2.9.0 + * + * @see WP_oEmbed + * + * @param string $url The URL that should be embedded. + * @param array|string $args { + * Optional. Additional arguments for retrieving embed HTML. Default empty. + * + * @type int|string $width Optional. The `maxwidth` value passed to the provider URL. + * @type int|string $height Optional. The `maxheight` value passed to the provider URL. + * @type bool $discover Optional. Determines whether to attempt to discover link tags + * at the given URL for an oEmbed provider when the provider URL + * is not found in the built-in providers list. Default true. + * } + * @return string|false The embed HTML on success, false on failure. + * @phpstan-param array{ + * width?: int|string, + * height?: int|string, + * discover?: bool, + * } $args + */ + function wp_oembed_get($url, $args = '') + { + } + /** + * Returns the initialized WP_oEmbed object. + * + * @since 2.9.0 + * @access private + * + * @return WP_oEmbed object. + */ + function _wp_oembed_get_object() + { + } + /** + * Adds a URL format and oEmbed provider URL pair. + * + * @since 2.9.0 + * + * @see WP_oEmbed + * + * @param string $format The format of URL that this provider can handle. You can use asterisks + * as wildcards. + * @param string $provider The URL to the oEmbed provider. + * @param bool $regex Optional. Whether the `$format` parameter is in a RegEx format. Default false. + */ + function wp_oembed_add_provider($format, $provider, $regex = \false) + { + } + /** + * Removes an oEmbed provider. + * + * @since 3.5.0 + * + * @see WP_oEmbed + * + * @param string $format The URL format for the oEmbed provider to remove. + * @return bool Was the provider removed successfully? + */ + function wp_oembed_remove_provider($format) + { + } + /** + * Determines if default embed handlers should be loaded. + * + * Checks to make sure that the embeds library hasn't already been loaded. If + * it hasn't, then it will load the embeds library. + * + * @since 2.9.0 + * + * @see wp_embed_register_handler() + * @phpstan-return void + */ + function wp_maybe_load_embeds() + { + } + /** + * YouTube iframe embed handler callback. + * + * Catches YouTube iframe embed URLs that are not parsable by oEmbed but can be translated into a URL that is. + * + * @since 4.0.0 + * + * @global WP_Embed $wp_embed WordPress Embed object. + * + * @param array $matches The RegEx matches from the provided regex when calling + * wp_embed_register_handler(). + * @param array $attr Embed attributes. + * @param string $url The original URL that was matched by the regex. + * @param array $rawattr The original unmodified attributes. + * @return string The embed HTML. + */ + function wp_embed_handler_youtube($matches, $attr, $url, $rawattr) + { + } + /** + * Audio embed handler callback. + * + * @since 3.6.0 + * + * @param array $matches The RegEx matches from the provided regex when calling wp_embed_register_handler(). + * @param array $attr Embed attributes. + * @param string $url The original URL that was matched by the regex. + * @param array $rawattr The original unmodified attributes. + * @return string The embed HTML. + */ + function wp_embed_handler_audio($matches, $attr, $url, $rawattr) + { + } + /** + * Video embed handler callback. + * + * @since 3.6.0 + * + * @param array $matches The RegEx matches from the provided regex when calling wp_embed_register_handler(). + * @param array $attr Embed attributes. + * @param string $url The original URL that was matched by the regex. + * @param array $rawattr The original unmodified attributes. + * @return string The embed HTML. + */ + function wp_embed_handler_video($matches, $attr, $url, $rawattr) + { + } + /** + * Registers the oEmbed REST API route. + * + * @since 4.4.0 + */ + function wp_oembed_register_route() + { + } + /** + * Adds oEmbed discovery links in the head element of the website. + * + * @since 4.4.0 + */ + function wp_oembed_add_discovery_links() + { + } + /** + * Adds the necessary JavaScript to communicate with the embedded iframes. + * + * This function is no longer used directly. For back-compat it exists exclusively as a way to indicate that the oEmbed + * host JS _should_ be added. In `default-filters.php` there remains this code: + * + * add_action( 'wp_head', 'wp_oembed_add_host_js' ) + * + * Historically a site has been able to disable adding the oEmbed host script by doing: + * + * remove_action( 'wp_head', 'wp_oembed_add_host_js' ) + * + * In order to ensure that such code still works as expected, this function remains. There is now a `has_action()` check + * in `wp_maybe_enqueue_oembed_host_js()` to see if `wp_oembed_add_host_js()` has not been unhooked from running at the + * `wp_head` action. + * + * @since 4.4.0 + * @deprecated 5.9.0 Use {@see wp_maybe_enqueue_oembed_host_js()} instead. + */ + function wp_oembed_add_host_js() + { + } + /** + * Enqueue the wp-embed script if the provided oEmbed HTML contains a post embed. + * + * In order to only enqueue the wp-embed script on pages that actually contain post embeds, this function checks if the + * provided HTML contains post embed markup and if so enqueues the script so that it will get printed in the footer. + * + * @since 5.9.0 + * + * @param string $html Embed markup. + * @return string Embed markup (without modifications). + */ + function wp_maybe_enqueue_oembed_host_js($html) + { + } + /** + * Retrieves the URL to embed a specific post in an iframe. + * + * @since 4.4.0 + * + * @param int|WP_Post $post Optional. Post ID or object. Defaults to the current post. + * @return string|false The post embed URL on success, false if the post doesn't exist. + */ + function get_post_embed_url($post = \null) + { + } + /** + * Retrieves the oEmbed endpoint URL for a given permalink. + * + * Pass an empty string as the first argument to get the endpoint base URL. + * + * @since 4.4.0 + * + * @param string $permalink Optional. The permalink used for the `url` query arg. Default empty. + * @param string $format Optional. The requested response format. Default 'json'. + * @return string The oEmbed endpoint URL. + */ + function get_oembed_endpoint_url($permalink = '', $format = 'json') + { + } + /** + * Retrieves the embed code for a specific post. + * + * @since 4.4.0 + * + * @param int $width The width for the response. + * @param int $height The height for the response. + * @param int|WP_Post $post Optional. Post ID or object. Default is global `$post`. + * @return string|false Embed code on success, false if post doesn't exist. + */ + function get_post_embed_html($width, $height, $post = \null) + { + } + /** + * Retrieves the oEmbed response data for a given post. + * + * @since 4.4.0 + * + * @param WP_Post|int $post Post ID or post object. + * @param int $width The requested width. + * @return array|false Response data on success, false if post doesn't exist + * or is not publicly viewable. + */ + function get_oembed_response_data($post, $width) + { + } + /** + * Retrieves the oEmbed response data for a given URL. + * + * @since 5.0.0 + * + * @param string $url The URL that should be inspected for discovery `<link>` tags. + * @param array $args oEmbed remote get arguments. + * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise. + */ + function get_oembed_response_data_for_url($url, $args) + { + } + /** + * Filters the oEmbed response data to return an iframe embed code. + * + * @since 4.4.0 + * + * @param array $data The response data. + * @param WP_Post $post The post object. + * @param int $width The requested width. + * @param int $height The calculated height. + * @return array The modified response data. + */ + function get_oembed_response_data_rich($data, $post, $width, $height) + { + } + /** + * Ensures that the specified format is either 'json' or 'xml'. + * + * @since 4.4.0 + * + * @param string $format The oEmbed response format. Accepts 'json' or 'xml'. + * @return string The format, either 'xml' or 'json'. Default 'json'. + * @phpstan-param 'json'|'xml' $format + * @phpstan-return 'xml'|'json' + */ + function wp_oembed_ensure_format($format) + { + } + /** + * Hooks into the REST API output to print XML instead of JSON. + * + * This is only done for the oEmbed API endpoint, + * which supports both formats. + * + * @access private + * @since 4.4.0 + * + * @param bool $served Whether the request has already been served. + * @param WP_HTTP_Response $result Result to send to the client. Usually a `WP_REST_Response`. + * @param WP_REST_Request $request Request used to generate the response. + * @param WP_REST_Server $server Server instance. + * @return true + */ + function _oembed_rest_pre_serve_request($served, $result, $request, $server) + { + } + /** + * Creates an XML string from a given array. + * + * @since 4.4.0 + * @access private + * + * @param array $data The original oEmbed response data. + * @param SimpleXMLElement $node Optional. XML node to append the result to recursively. + * @return string|false XML string on success, false on error. + */ + function _oembed_create_xml($data, $node = \null) + { + } + /** + * Filters the given oEmbed HTML to make sure iframes have a title attribute. + * + * @since 5.2.0 + * + * @param string $result The oEmbed HTML result. + * @param object $data A data object result from an oEmbed provider. + * @param string $url The URL of the content to be embedded. + * @return string The filtered oEmbed result. + */ + function wp_filter_oembed_iframe_title_attribute($result, $data, $url) + { + } + /** + * Filters the given oEmbed HTML. + * + * If the `$url` isn't on the trusted providers list, + * we need to filter the HTML heavily for security. + * + * Only filters 'rich' and 'video' response types. + * + * @since 4.4.0 + * + * @param string $result The oEmbed HTML result. + * @param object $data A data object result from an oEmbed provider. + * @param string $url The URL of the content to be embedded. + * @return string The filtered and sanitized oEmbed result. + */ + function wp_filter_oembed_result($result, $data, $url) + { + } + /** + * Filters the string in the 'more' link displayed after a trimmed excerpt. + * + * Replaces '[...]' (appended to automatically generated excerpts) with an + * ellipsis and a "Continue reading" link in the embed template. + * + * @since 4.4.0 + * + * @param string $more_string Default 'more' string. + * @return string 'Continue reading' link prepended with an ellipsis. + */ + function wp_embed_excerpt_more($more_string) + { + } + /** + * Displays the post excerpt for the embed template. + * + * Intended to be used in 'The Loop'. + * + * @since 4.4.0 + */ + function the_excerpt_embed() + { + } + /** + * Filters the post excerpt for the embed template. + * + * Shows players for video and audio attachments. + * + * @since 4.4.0 + * + * @param string $content The current post excerpt. + * @return string The modified post excerpt. + */ + function wp_embed_excerpt_attachment($content) + { + } + /** + * Enqueues embed iframe default CSS and JS. + * + * Enqueue PNG fallback CSS for embed iframe for legacy versions of IE. + * + * Allows plugins to queue scripts for the embed iframe end using wp_enqueue_script(). + * Runs first in oembed_head(). + * + * @since 4.4.0 + */ + function enqueue_embed_scripts() + { + } + /** + * Enqueues the CSS in the embed iframe header. + * + * @since 6.4.0 + * @phpstan-return void + */ + function wp_enqueue_embed_styles() + { + } + /** + * Prints the JavaScript in the embed iframe header. + * + * @since 4.4.0 + */ + function print_embed_scripts() + { + } + /** + * Prepare the oembed HTML to be displayed in an RSS feed. + * + * @since 4.4.0 + * @access private + * + * @param string $content The content to filter. + * @return string The filtered content. + */ + function _oembed_filter_feed_content($content) + { + } + /** + * Prints the necessary markup for the embed comments button. + * + * @since 4.4.0 + * @phpstan-return void + */ + function print_embed_comments_button() + { + } + /** + * Prints the necessary markup for the embed sharing button. + * + * @since 4.4.0 + * @phpstan-return void + */ + function print_embed_sharing_button() + { + } + /** + * Prints the necessary markup for the embed sharing dialog. + * + * @since 4.4.0 + * @phpstan-return void + */ + function print_embed_sharing_dialog() + { + } + /** + * Prints the necessary markup for the site title in an embed template. + * + * @since 4.5.0 + */ + function the_embed_site_title() + { + } + /** + * Filters the oEmbed result before any HTTP requests are made. + * + * If the URL belongs to the current site, the result is fetched directly instead of + * going through the oEmbed discovery process. + * + * @since 4.5.3 + * + * @param null|string $result The UNSANITIZED (and potentially unsafe) HTML that should be used to embed. Default null. + * @param string $url The URL that should be inspected for discovery `<link>` tags. + * @param array $args oEmbed remote get arguments. + * @return null|string The UNSANITIZED (and potentially unsafe) HTML that should be used to embed. + * Null if the URL does not belong to the current site. + */ + function wp_filter_pre_oembed_result($result, $url, $args) + { + } + /** + * Error Protection API: Functions + * + * @package WordPress + * @since 5.2.0 + */ + /** + * Get the instance for storing paused plugins. + * + * @return WP_Paused_Extensions_Storage + */ + function wp_paused_plugins() + { + } + /** + * Get the instance for storing paused extensions. + * + * @return WP_Paused_Extensions_Storage + */ + function wp_paused_themes() + { + } + /** + * Get a human readable description of an extension's error. + * + * @since 5.2.0 + * + * @param array $error Error details from `error_get_last()`. + * @return string Formatted error description. + */ + function wp_get_extension_error_description($error) + { + } + /** + * Registers the shutdown handler for fatal errors. + * + * The handler will only be registered if {@see wp_is_fatal_error_handler_enabled()} returns true. + * + * @since 5.2.0 + * @phpstan-return void + */ + function wp_register_fatal_error_handler() + { + } + /** + * Checks whether the fatal error handler is enabled. + * + * A constant `WP_DISABLE_FATAL_ERROR_HANDLER` can be set in `wp-config.php` to disable it, or alternatively the + * {@see 'wp_fatal_error_handler_enabled'} filter can be used to modify the return value. + * + * @since 5.2.0 + * + * @return bool True if the fatal error handler is enabled, false otherwise. + */ + function wp_is_fatal_error_handler_enabled() + { + } + /** + * Access the WordPress Recovery Mode instance. + * + * @since 5.2.0 + * + * @return WP_Recovery_Mode + */ + function wp_recovery_mode() + { + } + /** + * WordPress Feed API + * + * Many of the functions used in here belong in The Loop, or The Loop for the + * Feeds. + * + * @package WordPress + * @subpackage Feed + * @since 2.1.0 + */ + /** + * Retrieves RSS container for the bloginfo function. + * + * You can retrieve anything that you can using the get_bloginfo() function. + * Everything will be stripped of tags and characters converted, when the values + * are retrieved for use in the feeds. + * + * @since 1.5.1 + * + * @see get_bloginfo() For the list of possible values to display. + * + * @param string $show See get_bloginfo() for possible values. + * @return string + */ + function get_bloginfo_rss($show = '') + { + } + /** + * Displays RSS container for the bloginfo function. + * + * You can retrieve anything that you can using the get_bloginfo() function. + * Everything will be stripped of tags and characters converted, when the values + * are retrieved for use in the feeds. + * + * @since 0.71 + * + * @see get_bloginfo() For the list of possible values to display. + * + * @param string $show See get_bloginfo() for possible values. + */ + function bloginfo_rss($show = '') + { + } + /** + * Retrieves the default feed. + * + * The default feed is 'rss2', unless a plugin changes it through the + * {@see 'default_feed'} filter. + * + * @since 2.5.0 + * + * @return string Default feed, or for example 'rss2', 'atom', etc. + */ + function get_default_feed() + { + } + /** + * Retrieves the blog title for the feed title. + * + * @since 2.2.0 + * @since 4.4.0 The optional `$sep` parameter was deprecated and renamed to `$deprecated`. + * + * @param string $deprecated Unused. + * @return string The document title. + */ + function get_wp_title_rss($deprecated = '–') + { + } + /** + * Displays the blog title for display of the feed title. + * + * @since 2.2.0 + * @since 4.4.0 The optional `$sep` parameter was deprecated and renamed to `$deprecated`. + * + * @param string $deprecated Unused. + */ + function wp_title_rss($deprecated = '–') + { + } + /** + * Retrieves the current post title for the feed. + * + * @since 2.0.0 + * @since 6.6.0 Added the `$post` parameter. + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. + * @return string Current post title. + */ + function get_the_title_rss($post = 0) + { + } + /** + * Displays the post title in the feed. + * + * @since 0.71 + */ + function the_title_rss() + { + } + /** + * Retrieves the post content for feeds. + * + * @since 2.9.0 + * + * @see get_the_content() + * + * @param string $feed_type The type of feed. rss2 | atom | rss | rdf + * @return string The filtered content. + */ + function get_the_content_feed($feed_type = \null) + { + } + /** + * Displays the post content for feeds. + * + * @since 2.9.0 + * + * @param string $feed_type The type of feed. rss2 | atom | rss | rdf + */ + function the_content_feed($feed_type = \null) + { + } + /** + * Displays the post excerpt for the feed. + * + * @since 0.71 + */ + function the_excerpt_rss() + { + } + /** + * Displays the permalink to the post for use in feeds. + * + * @since 2.3.0 + */ + function the_permalink_rss() + { + } + /** + * Outputs the link to the comments for the current post in an XML safe way. + * + * @since 3.0.0 + */ + function comments_link_feed() + { + } + /** + * Displays the feed GUID for the current comment. + * + * @since 2.5.0 + * + * @param int|WP_Comment $comment_id Optional comment object or ID. Defaults to global comment object. + */ + function comment_guid($comment_id = \null) + { + } + /** + * Retrieves the feed GUID for the current comment. + * + * @since 2.5.0 + * + * @param int|WP_Comment $comment_id Optional comment object or ID. Defaults to global comment object. + * @return string|false GUID for comment on success, false on failure. + */ + function get_comment_guid($comment_id = \null) + { + } + /** + * Displays the link to the comments. + * + * @since 1.5.0 + * @since 4.4.0 Introduced the `$comment` argument. + * + * @param int|WP_Comment $comment Optional. Comment object or ID. Defaults to global comment object. + */ + function comment_link($comment = \null) + { + } + /** + * Retrieves the current comment author for use in the feeds. + * + * @since 2.0.0 + * + * @return string Comment Author. + */ + function get_comment_author_rss() + { + } + /** + * Displays the current comment author in the feed. + * + * @since 1.0.0 + */ + function comment_author_rss() + { + } + /** + * Displays the current comment content for use in the feeds. + * + * @since 1.0.0 + */ + function comment_text_rss() + { + } + /** + * Retrieves all of the post categories, formatted for use in feeds. + * + * All of the categories for the current post in the feed loop, will be + * retrieved and have feed markup added, so that they can easily be added to the + * RSS2, Atom, or RSS1 and RSS0.91 RDF feeds. + * + * @since 2.1.0 + * + * @param string $type Optional, default is the type returned by get_default_feed(). + * @return string All of the post categories for displaying in the feed. + */ + function get_the_category_rss($type = \null) + { + } + /** + * Displays the post categories in the feed. + * + * @since 0.71 + * + * @see get_the_category_rss() For better explanation. + * + * @param string $type Optional, default is the type returned by get_default_feed(). + */ + function the_category_rss($type = \null) + { + } + /** + * Displays the HTML type based on the blog setting. + * + * The two possible values are either 'xhtml' or 'html'. + * + * @since 2.2.0 + */ + function html_type_rss() + { + } + /** + * Displays the rss enclosure for the current post. + * + * Uses the global $post to check whether the post requires a password and if + * the user has the password for the post. If not then it will return before + * displaying. + * + * Also uses the function get_post_custom() to get the post's 'enclosure' + * metadata field and parses the value to display the enclosure(s). The + * enclosure(s) consist of enclosure HTML tag(s) with a URI and other + * attributes. + * + * @since 1.5.0 + * @phpstan-return void + */ + function rss_enclosure() + { + } + /** + * Displays the atom enclosure for the current post. + * + * Uses the global $post to check whether the post requires a password and if + * the user has the password for the post. If not then it will return before + * displaying. + * + * Also uses the function get_post_custom() to get the post's 'enclosure' + * metadata field and parses the value to display the enclosure(s). The + * enclosure(s) consist of link HTML tag(s) with a URI and other attributes. + * + * @since 2.2.0 + * @phpstan-return void + */ + function atom_enclosure() + { + } + /** + * Determines the type of a string of data with the data formatted. + * + * Tell whether the type is text, HTML, or XHTML, per RFC 4287 section 3.1. + * + * In the case of WordPress, text is defined as containing no markup, + * XHTML is defined as "well formed", and HTML as tag soup (i.e., the rest). + * + * Container div tags are added to XHTML values, per section 3.1.1.3. + * + * @link http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.3.1 + * + * @since 2.5.0 + * + * @param string $data Input string. + * @return array array(type, value) + */ + function prep_atom_text_construct($data) + { + } + /** + * Displays Site Icon in atom feeds. + * + * @since 4.3.0 + * + * @see get_site_icon_url() + */ + function atom_site_icon() + { + } + /** + * Displays Site Icon in RSS2. + * + * @since 4.3.0 + */ + function rss2_site_icon() + { + } + /** + * Returns the link for the currently displayed feed. + * + * @since 5.3.0 + * + * @return string Correct link for the atom:self element. + */ + function get_self_link() + { + } + /** + * Displays the link for the currently displayed feed in a XSS safe way. + * + * Generate a correct link for the atom:self element. + * + * @since 2.5.0 + */ + function self_link() + { + } + /** + * Gets the UTC time of the most recently modified post from WP_Query. + * + * If viewing a comment feed, the time of the most recently modified + * comment will be returned. + * + * @since 5.2.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param string $format Date format string to return the time in. + * @return string|false The time in requested format, or false on failure. + */ + function get_feed_build_date($format) + { + } + /** + * Returns the content type for specified feed type. + * + * @since 2.8.0 + * + * @param string $type Type of feed. Possible values include 'rss', rss2', 'atom', and 'rdf'. + * @return string Content type for specified feed type. + */ + function feed_content_type($type = '') + { + } + /** + * Builds SimplePie object based on RSS or Atom feed from URL. + * + * @since 2.8.0 + * + * @param string|string[] $url URL of feed to retrieve. If an array of URLs, the feeds are merged + * using SimplePie's multifeed feature. + * See also {@link http://simplepie.org/wiki/faq/typical_multifeed_gotchas} + * @return SimplePie|WP_Error SimplePie object on success or WP_Error object on failure. + */ + function fetch_feed($url) + { + } + /** + * Fonts functions. + * + * @package WordPress + * @subpackage Fonts + * @since 6.4.0 + */ + /** + * Generates and prints font-face styles for given fonts or theme.json fonts. + * + * @since 6.4.0 + * + * @param array[][] $fonts { + * Optional. The font-families and their font faces. Default empty array. + * + * @type array ...$0 { + * An indexed or associative (keyed by font-family) array of font variations for this font-family. + * Each font face has the following structure. + * + * @type array ...$0 { + * The font face properties. + * + * @type string $font-family The font-family property. + * @type string|string[] $src The URL(s) to each resource containing the font data. + * @type string $font-style Optional. The font-style property. Default 'normal'. + * @type string $font-weight Optional. The font-weight property. Default '400'. + * @type string $font-display Optional. The font-display property. Default 'fallback'. + * @type string $ascent-override Optional. The ascent-override property. + * @type string $descent-override Optional. The descent-override property. + * @type string $font-stretch Optional. The font-stretch property. + * @type string $font-variant Optional. The font-variant property. + * @type string $font-feature-settings Optional. The font-feature-settings property. + * @type string $font-variation-settings Optional. The font-variation-settings property. + * @type string $line-gap-override Optional. The line-gap-override property. + * @type string $size-adjust Optional. The size-adjust property. + * @type string $unicode-range Optional. The unicode-range property. + * } + * } + * } + * @phpstan-param array[]<int|string, array{ + * ?: array<array-key, array{ + * font-family: string, + * src: string|string[], + * font-style?: string, + * font-weight?: string, + * font-display?: string, + * ascent-override?: string, + * descent-override?: string, + * font-stretch?: string, + * font-variant?: string, + * font-feature-settings?: string, + * font-variation-settings?: string, + * line-gap-override?: string, + * size-adjust?: string, + * unicode-range?: string, + * }>, + * }> $fonts + * @phpstan-return void + */ + function wp_print_font_faces($fonts = array()) + { + } + /** + * Registers a new font collection in the font library. + * + * See {@link https://schemas.wp.org/trunk/font-collection.json} for the schema + * the font collection data must adhere to. + * + * @since 6.5.0 + * + * @param string $slug Font collection slug. May only contain alphanumeric characters, dashes, + * and underscores. See sanitize_title(). + * @param array $args { + * Font collection data. + * + * @type string $name Required. Name of the font collection shown in the Font Library. + * @type string $description Optional. A short descriptive summary of the font collection. Default empty. + * @type array|string $font_families Required. Array of font family definitions that are in the collection, + * or a string containing the path or URL to a JSON file containing the font collection. + * @type array $categories Optional. Array of categories, each with a name and slug, that are used by the + * fonts in the collection. Default empty. + * } + * @return WP_Font_Collection|WP_Error A font collection if it was registered + * successfully, or WP_Error object on failure. + * @phpstan-param array{ + * name?: string, + * description?: string, + * font_families?: array|string, + * categories?: array, + * } $args + */ + function wp_register_font_collection(string $slug, array $args) + { + } + /** + * Unregisters a font collection from the Font Library. + * + * @since 6.5.0 + * + * @param string $slug Font collection slug. + * @return bool True if the font collection was unregistered successfully, else false. + */ + function wp_unregister_font_collection(string $slug) + { + } + /** + * Retrieves font uploads directory information. + * + * Same as wp_font_dir() but "light weight" as it doesn't attempt to create the font uploads directory. + * Intended for use in themes, when only 'basedir' and 'baseurl' are needed, generally in all cases + * when not uploading files. + * + * @since 6.5.0 + * + * @see wp_font_dir() + * + * @return array See wp_font_dir() for description. + */ + function wp_get_font_dir() + { + } + /** + * Returns an array containing the current fonts upload directory's path and URL. + * + * @since 6.5.0 + * + * @param bool $create_dir Optional. Whether to check and create the font uploads directory. Default true. + * @return array { + * Array of information about the font upload directory. + * + * @type string $path Base directory and subdirectory or full path to the fonts upload directory. + * @type string $url Base URL and subdirectory or absolute URL to the fonts upload directory. + * @type string $subdir Subdirectory + * @type string $basedir Path without subdir. + * @type string $baseurl URL path without subdir. + * @type string|false $error False or error message. + * } + * @phpstan-return array{ + * path: string, + * url: string, + * subdir: string, + * basedir: string, + * baseurl: string, + * error: string|false, + * } + */ + function wp_font_dir($create_dir = \true) + { + } + /** + * A callback function for use in the {@see 'upload_dir'} filter. + * + * This function is intended for internal use only and should not be used by plugins and themes. + * Use wp_get_font_dir() instead. + * + * @since 6.5.0 + * @access private + * + * @param string $font_dir The font directory. + * @return string The modified font directory. + */ + function _wp_filter_font_directory($font_dir) + { + } + /** + * Deletes child font faces when a font family is deleted. + * + * @access private + * @since 6.5.0 + * + * @param int $post_id Post ID. + * @param WP_Post $post Post object. + * @phpstan-return void + */ + function _wp_after_delete_font_family($post_id, $post) + { + } + /** + * Deletes associated font files when a font face is deleted. + * + * @access private + * @since 6.5.0 + * + * @param int $post_id Post ID. + * @param WP_Post $post Post object. + * @phpstan-return void + */ + function _wp_before_delete_font_face($post_id, $post) + { + } + /** + * Register the default font collections. + * + * @access private + * @since 6.5.0 + */ + function _wp_register_default_font_collections() + { + } + /** + * Main WordPress Formatting API. + * + * Handles many functions for formatting output. + * + * @package WordPress + */ + /** + * Replaces common plain text characters with formatted entities. + * + * Returns given text with transformations of quotes into smart quotes, apostrophes, + * dashes, ellipses, the trademark symbol, and the multiplication symbol. + * + * As an example, + * + * 'cause today's effort makes it worth tomorrow's "holiday" ... + * + * Becomes: + * + * ’cause today’s effort makes it worth tomorrow’s “holiday” … + * + * Code within certain HTML blocks are skipped. + * + * Do not use this function before the {@see 'init'} action hook; everything will break. + * + * @since 0.71 + * + * @global array $wp_cockneyreplace Array of formatted entities for certain common phrases. + * @global array $shortcode_tags + * + * @param string $text The text to be formatted. + * @param bool $reset Set to true for unit testing. Translated patterns will reset. + * @return string The string replaced with HTML entities. + */ + function wptexturize($text, $reset = \false) + { + } + /** + * Implements a logic tree to determine whether or not "7'." represents seven feet, + * then converts the special char into either a prime char or a closing quote char. + * + * @since 4.3.0 + * + * @param string $haystack The plain text to be searched. + * @param string $needle The character to search for such as ' or ". + * @param string $prime The prime char to use for replacement. + * @param string $open_quote The opening quote char. Opening quote replacement must be + * accomplished already. + * @param string $close_quote The closing quote char to use for replacement. + * @return string The $haystack value after primes and quotes replacements. + */ + function wptexturize_primes($haystack, $needle, $prime, $open_quote, $close_quote) + { + } + /** + * Searches for disabled element tags. Pushes element to stack on tag open + * and pops on tag close. + * + * Assumes first char of `$text` is tag opening and last char is tag closing. + * Assumes second char of `$text` is optionally `/` to indicate closing as in `</html>`. + * + * @since 2.9.0 + * @access private + * + * @param string $text Text to check. Must be a tag like `<html>` or `[shortcode]`. + * @param string[] $stack Array of open tag elements. + * @param string[] $disabled_elements Array of tag names to match against. Spaces are not allowed in tag names. + * @phpstan-return void + */ + function _wptexturize_pushpop_element($text, &$stack, $disabled_elements) + { + } + /** + * Replaces double line breaks with paragraph elements. + * + * A group of regex replaces used to identify text formatted with newlines and + * replace double line breaks with HTML paragraph tags. The remaining line breaks + * after conversion become `<br />` tags, unless `$br` is set to '0' or 'false'. + * + * @since 0.71 + * + * @param string $text The text which has to be formatted. + * @param bool $br Optional. If set, this will convert all remaining line breaks + * after paragraphing. Line breaks within `<script>`, `<style>`, + * and `<svg>` tags are not affected. Default true. + * @return string Text which has been converted into correct paragraph tags. + */ + function wpautop($text, $br = \true) + { + } + /** + * Separates HTML elements and comments from the text. + * + * @since 4.2.4 + * + * @param string $input The text which has to be formatted. + * @return string[] Array of the formatted text. + */ + function wp_html_split($input) + { + } + /** + * Retrieves the regular expression for an HTML element. + * + * @since 4.4.0 + * + * @return string The regular expression + */ + function get_html_split_regex() + { + } + /** + * Retrieves the combined regular expression for HTML and shortcodes. + * + * @access private + * @ignore + * @internal This function will be removed in 4.5.0 per Shortcode API Roadmap. + * @since 4.4.0 + * + * @param string $shortcode_regex Optional. The result from _get_wptexturize_shortcode_regex(). + * @return string The regular expression + */ + function _get_wptexturize_split_regex($shortcode_regex = '') + { + } + /** + * Retrieves the regular expression for shortcodes. + * + * @access private + * @ignore + * @since 4.4.0 + * + * @param string[] $tagnames Array of shortcodes to find. + * @return string The regular expression + */ + function _get_wptexturize_shortcode_regex($tagnames) + { + } + /** + * Replaces characters or phrases within HTML elements only. + * + * @since 4.2.3 + * + * @param string $haystack The text which has to be formatted. + * @param array $replace_pairs In the form array('from' => 'to', ...). + * @return string The formatted text. + */ + function wp_replace_in_html_tags($haystack, $replace_pairs) + { + } + /** + * Newline preservation help function for wpautop(). + * + * @since 3.1.0 + * @access private + * + * @param array $matches preg_replace_callback matches array + * @return string + */ + function _autop_newline_preservation_helper($matches) + { + } + /** + * Don't auto-p wrap shortcodes that stand alone. + * + * Ensures that shortcodes are not wrapped in `<p>...</p>`. + * + * @since 2.9.0 + * + * @global array $shortcode_tags + * + * @param string $text The content. + * @return string The filtered content. + */ + function shortcode_unautop($text) + { + } + /** + * Checks to see if a string is utf8 encoded. + * + * NOTE: This function checks for 5-Byte sequences, UTF8 + * has Bytes Sequences with a maximum length of 4. + * + * @author bmorel at ssi dot fr (modified) + * @since 1.2.1 + * + * @param string $str The string to be checked + * @return bool True if $str fits a UTF-8 model, false otherwise. + */ + function seems_utf8($str) + { + } + /** + * Converts a number of special characters into their HTML entities. + * + * Specifically deals with: `&`, `<`, `>`, `"`, and `'`. + * + * `$quote_style` can be set to ENT_COMPAT to encode `"` to + * `"`, or ENT_QUOTES to do both. Default is ENT_NOQUOTES where no quotes are encoded. + * + * @since 1.2.2 + * @since 5.5.0 `$quote_style` also accepts `ENT_XML1`. + * @access private + * + * @param string $text The text which is to be encoded. + * @param int|string $quote_style Optional. Converts double quotes if set to ENT_COMPAT, + * both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES. + * Converts single and double quotes, as well as converting HTML + * named entities (that are not also XML named entities) to their + * code points if set to ENT_XML1. Also compatible with old values; + * converting single quotes if set to 'single', + * double if set to 'double' or both if otherwise set. + * Default is ENT_NOQUOTES. + * @param false|string $charset Optional. The character encoding of the string. Default false. + * @param bool $double_encode Optional. Whether to encode existing HTML entities. Default false. + * @return string The encoded text with HTML entities. + */ + function _wp_specialchars($text, $quote_style = \ENT_NOQUOTES, $charset = \false, $double_encode = \false) + { + } + /** + * Converts a number of HTML entities into their special characters. + * + * Specifically deals with: `&`, `<`, `>`, `"`, and `'`. + * + * `$quote_style` can be set to ENT_COMPAT to decode `"` entities, + * or ENT_QUOTES to do both `"` and `'`. Default is ENT_NOQUOTES where no quotes are decoded. + * + * @since 2.8.0 + * + * @param string $text The text which is to be decoded. + * @param string|int $quote_style Optional. Converts double quotes if set to ENT_COMPAT, + * both single and double if set to ENT_QUOTES or + * none if set to ENT_NOQUOTES. + * Also compatible with old _wp_specialchars() values; + * converting single quotes if set to 'single', + * double if set to 'double' or both if otherwise set. + * Default is ENT_NOQUOTES. + * @return string The decoded text without HTML entities. + */ + function wp_specialchars_decode($text, $quote_style = \ENT_NOQUOTES) + { + } + /** + * Checks for invalid UTF8 in a string. + * + * @since 2.8.0 + * + * @param string $text The text which is to be checked. + * @param bool $strip Optional. Whether to attempt to strip out invalid UTF8. Default false. + * @return string The checked text. + */ + function wp_check_invalid_utf8($text, $strip = \false) + { + } + /** + * Encodes the Unicode values to be used in the URI. + * + * @since 1.5.0 + * @since 5.8.3 Added the `encode_ascii_characters` parameter. + * + * @param string $utf8_string String to encode. + * @param int $length Max length of the string + * @param bool $encode_ascii_characters Whether to encode ascii characters such as < " ' + * @return string String with Unicode encoded for URI. + */ + function utf8_uri_encode($utf8_string, $length = 0, $encode_ascii_characters = \false) + { + } + /** + * Converts all accent characters to ASCII characters. + * + * If there are no accent characters, then the string given is just returned. + * + * **Accent characters converted:** + * + * Currency signs: + * + * | Code | Glyph | Replacement | Description | + * | -------- | ----- | ----------- | ------------------- | + * | U+00A3 | £ | (empty) | British Pound sign | + * | U+20AC | € | E | Euro sign | + * + * Decompositions for Latin-1 Supplement: + * + * | Code | Glyph | Replacement | Description | + * | ------- | ----- | ----------- | -------------------------------------- | + * | U+00AA | ª | a | Feminine ordinal indicator | + * | U+00BA | º | o | Masculine ordinal indicator | + * | U+00C0 | À | A | Latin capital letter A with grave | + * | U+00C1 | Á | A | Latin capital letter A with acute | + * | U+00C2 |  | A | Latin capital letter A with circumflex | + * | U+00C3 | à | A | Latin capital letter A with tilde | + * | U+00C4 | Ä | A | Latin capital letter A with diaeresis | + * | U+00C5 | Å | A | Latin capital letter A with ring above | + * | U+00C6 | Æ | AE | Latin capital letter AE | + * | U+00C7 | Ç | C | Latin capital letter C with cedilla | + * | U+00C8 | È | E | Latin capital letter E with grave | + * | U+00C9 | É | E | Latin capital letter E with acute | + * | U+00CA | Ê | E | Latin capital letter E with circumflex | + * | U+00CB | Ë | E | Latin capital letter E with diaeresis | + * | U+00CC | Ì | I | Latin capital letter I with grave | + * | U+00CD | Í | I | Latin capital letter I with acute | + * | U+00CE | Î | I | Latin capital letter I with circumflex | + * | U+00CF | Ï | I | Latin capital letter I with diaeresis | + * | U+00D0 | Ð | D | Latin capital letter Eth | + * | U+00D1 | Ñ | N | Latin capital letter N with tilde | + * | U+00D2 | Ò | O | Latin capital letter O with grave | + * | U+00D3 | Ó | O | Latin capital letter O with acute | + * | U+00D4 | Ô | O | Latin capital letter O with circumflex | + * | U+00D5 | Õ | O | Latin capital letter O with tilde | + * | U+00D6 | Ö | O | Latin capital letter O with diaeresis | + * | U+00D8 | Ø | O | Latin capital letter O with stroke | + * | U+00D9 | Ù | U | Latin capital letter U with grave | + * | U+00DA | Ú | U | Latin capital letter U with acute | + * | U+00DB | Û | U | Latin capital letter U with circumflex | + * | U+00DC | Ü | U | Latin capital letter U with diaeresis | + * | U+00DD | Ý | Y | Latin capital letter Y with acute | + * | U+00DE | Þ | TH | Latin capital letter Thorn | + * | U+00DF | ß | s | Latin small letter sharp s | + * | U+00E0 | à | a | Latin small letter a with grave | + * | U+00E1 | á | a | Latin small letter a with acute | + * | U+00E2 | â | a | Latin small letter a with circumflex | + * | U+00E3 | ã | a | Latin small letter a with tilde | + * | U+00E4 | ä | a | Latin small letter a with diaeresis | + * | U+00E5 | å | a | Latin small letter a with ring above | + * | U+00E6 | æ | ae | Latin small letter ae | + * | U+00E7 | ç | c | Latin small letter c with cedilla | + * | U+00E8 | è | e | Latin small letter e with grave | + * | U+00E9 | é | e | Latin small letter e with acute | + * | U+00EA | ê | e | Latin small letter e with circumflex | + * | U+00EB | ë | e | Latin small letter e with diaeresis | + * | U+00EC | ì | i | Latin small letter i with grave | + * | U+00ED | í | i | Latin small letter i with acute | + * | U+00EE | î | i | Latin small letter i with circumflex | + * | U+00EF | ï | i | Latin small letter i with diaeresis | + * | U+00F0 | ð | d | Latin small letter Eth | + * | U+00F1 | ñ | n | Latin small letter n with tilde | + * | U+00F2 | ò | o | Latin small letter o with grave | + * | U+00F3 | ó | o | Latin small letter o with acute | + * | U+00F4 | ô | o | Latin small letter o with circumflex | + * | U+00F5 | õ | o | Latin small letter o with tilde | + * | U+00F6 | ö | o | Latin small letter o with diaeresis | + * | U+00F8 | ø | o | Latin small letter o with stroke | + * | U+00F9 | ù | u | Latin small letter u with grave | + * | U+00FA | ú | u | Latin small letter u with acute | + * | U+00FB | û | u | Latin small letter u with circumflex | + * | U+00FC | ü | u | Latin small letter u with diaeresis | + * | U+00FD | ý | y | Latin small letter y with acute | + * | U+00FE | þ | th | Latin small letter Thorn | + * | U+00FF | ÿ | y | Latin small letter y with diaeresis | + * + * Decompositions for Latin Extended-A: + * + * | Code | Glyph | Replacement | Description | + * | ------- | ----- | ----------- | ------------------------------------------------- | + * | U+0100 | Ā | A | Latin capital letter A with macron | + * | U+0101 | ā | a | Latin small letter a with macron | + * | U+0102 | Ă | A | Latin capital letter A with breve | + * | U+0103 | ă | a | Latin small letter a with breve | + * | U+0104 | Ą | A | Latin capital letter A with ogonek | + * | U+0105 | ą | a | Latin small letter a with ogonek | + * | U+01006 | Ć | C | Latin capital letter C with acute | + * | U+0107 | ć | c | Latin small letter c with acute | + * | U+0108 | Ĉ | C | Latin capital letter C with circumflex | + * | U+0109 | ĉ | c | Latin small letter c with circumflex | + * | U+010A | Ċ | C | Latin capital letter C with dot above | + * | U+010B | ċ | c | Latin small letter c with dot above | + * | U+010C | Č | C | Latin capital letter C with caron | + * | U+010D | č | c | Latin small letter c with caron | + * | U+010E | Ď | D | Latin capital letter D with caron | + * | U+010F | ď | d | Latin small letter d with caron | + * | U+0110 | Đ | D | Latin capital letter D with stroke | + * | U+0111 | đ | d | Latin small letter d with stroke | + * | U+0112 | Ē | E | Latin capital letter E with macron | + * | U+0113 | ē | e | Latin small letter e with macron | + * | U+0114 | Ĕ | E | Latin capital letter E with breve | + * | U+0115 | ĕ | e | Latin small letter e with breve | + * | U+0116 | Ė | E | Latin capital letter E with dot above | + * | U+0117 | ė | e | Latin small letter e with dot above | + * | U+0118 | Ę | E | Latin capital letter E with ogonek | + * | U+0119 | ę | e | Latin small letter e with ogonek | + * | U+011A | Ě | E | Latin capital letter E with caron | + * | U+011B | ě | e | Latin small letter e with caron | + * | U+011C | Ĝ | G | Latin capital letter G with circumflex | + * | U+011D | ĝ | g | Latin small letter g with circumflex | + * | U+011E | Ğ | G | Latin capital letter G with breve | + * | U+011F | ğ | g | Latin small letter g with breve | + * | U+0120 | Ġ | G | Latin capital letter G with dot above | + * | U+0121 | ġ | g | Latin small letter g with dot above | + * | U+0122 | Ģ | G | Latin capital letter G with cedilla | + * | U+0123 | ģ | g | Latin small letter g with cedilla | + * | U+0124 | Ĥ | H | Latin capital letter H with circumflex | + * | U+0125 | ĥ | h | Latin small letter h with circumflex | + * | U+0126 | Ħ | H | Latin capital letter H with stroke | + * | U+0127 | ħ | h | Latin small letter h with stroke | + * | U+0128 | Ĩ | I | Latin capital letter I with tilde | + * | U+0129 | ĩ | i | Latin small letter i with tilde | + * | U+012A | Ī | I | Latin capital letter I with macron | + * | U+012B | ī | i | Latin small letter i with macron | + * | U+012C | Ĭ | I | Latin capital letter I with breve | + * | U+012D | ĭ | i | Latin small letter i with breve | + * | U+012E | Į | I | Latin capital letter I with ogonek | + * | U+012F | į | i | Latin small letter i with ogonek | + * | U+0130 | İ | I | Latin capital letter I with dot above | + * | U+0131 | ı | i | Latin small letter dotless i | + * | U+0132 | IJ | IJ | Latin capital ligature IJ | + * | U+0133 | ij | ij | Latin small ligature ij | + * | U+0134 | Ĵ | J | Latin capital letter J with circumflex | + * | U+0135 | ĵ | j | Latin small letter j with circumflex | + * | U+0136 | Ķ | K | Latin capital letter K with cedilla | + * | U+0137 | ķ | k | Latin small letter k with cedilla | + * | U+0138 | ĸ | k | Latin small letter Kra | + * | U+0139 | Ĺ | L | Latin capital letter L with acute | + * | U+013A | ĺ | l | Latin small letter l with acute | + * | U+013B | Ļ | L | Latin capital letter L with cedilla | + * | U+013C | ļ | l | Latin small letter l with cedilla | + * | U+013D | Ľ | L | Latin capital letter L with caron | + * | U+013E | ľ | l | Latin small letter l with caron | + * | U+013F | Ŀ | L | Latin capital letter L with middle dot | + * | U+0140 | ŀ | l | Latin small letter l with middle dot | + * | U+0141 | Ł | L | Latin capital letter L with stroke | + * | U+0142 | ł | l | Latin small letter l with stroke | + * | U+0143 | Ń | N | Latin capital letter N with acute | + * | U+0144 | ń | n | Latin small letter N with acute | + * | U+0145 | Ņ | N | Latin capital letter N with cedilla | + * | U+0146 | ņ | n | Latin small letter n with cedilla | + * | U+0147 | Ň | N | Latin capital letter N with caron | + * | U+0148 | ň | n | Latin small letter n with caron | + * | U+0149 | ʼn | n | Latin small letter n preceded by apostrophe | + * | U+014A | Ŋ | N | Latin capital letter Eng | + * | U+014B | ŋ | n | Latin small letter Eng | + * | U+014C | Ō | O | Latin capital letter O with macron | + * | U+014D | ō | o | Latin small letter o with macron | + * | U+014E | Ŏ | O | Latin capital letter O with breve | + * | U+014F | ŏ | o | Latin small letter o with breve | + * | U+0150 | Ő | O | Latin capital letter O with double acute | + * | U+0151 | ő | o | Latin small letter o with double acute | + * | U+0152 | Œ | OE | Latin capital ligature OE | + * | U+0153 | œ | oe | Latin small ligature oe | + * | U+0154 | Ŕ | R | Latin capital letter R with acute | + * | U+0155 | ŕ | r | Latin small letter r with acute | + * | U+0156 | Ŗ | R | Latin capital letter R with cedilla | + * | U+0157 | ŗ | r | Latin small letter r with cedilla | + * | U+0158 | Ř | R | Latin capital letter R with caron | + * | U+0159 | ř | r | Latin small letter r with caron | + * | U+015A | Ś | S | Latin capital letter S with acute | + * | U+015B | ś | s | Latin small letter s with acute | + * | U+015C | Ŝ | S | Latin capital letter S with circumflex | + * | U+015D | ŝ | s | Latin small letter s with circumflex | + * | U+015E | Ş | S | Latin capital letter S with cedilla | + * | U+015F | ş | s | Latin small letter s with cedilla | + * | U+0160 | Š | S | Latin capital letter S with caron | + * | U+0161 | š | s | Latin small letter s with caron | + * | U+0162 | Ţ | T | Latin capital letter T with cedilla | + * | U+0163 | ţ | t | Latin small letter t with cedilla | + * | U+0164 | Ť | T | Latin capital letter T with caron | + * | U+0165 | ť | t | Latin small letter t with caron | + * | U+0166 | Ŧ | T | Latin capital letter T with stroke | + * | U+0167 | ŧ | t | Latin small letter t with stroke | + * | U+0168 | Ũ | U | Latin capital letter U with tilde | + * | U+0169 | ũ | u | Latin small letter u with tilde | + * | U+016A | Ū | U | Latin capital letter U with macron | + * | U+016B | ū | u | Latin small letter u with macron | + * | U+016C | Ŭ | U | Latin capital letter U with breve | + * | U+016D | ŭ | u | Latin small letter u with breve | + * | U+016E | Ů | U | Latin capital letter U with ring above | + * | U+016F | ů | u | Latin small letter u with ring above | + * | U+0170 | Ű | U | Latin capital letter U with double acute | + * | U+0171 | ű | u | Latin small letter u with double acute | + * | U+0172 | Ų | U | Latin capital letter U with ogonek | + * | U+0173 | ų | u | Latin small letter u with ogonek | + * | U+0174 | Ŵ | W | Latin capital letter W with circumflex | + * | U+0175 | ŵ | w | Latin small letter w with circumflex | + * | U+0176 | Ŷ | Y | Latin capital letter Y with circumflex | + * | U+0177 | ŷ | y | Latin small letter y with circumflex | + * | U+0178 | Ÿ | Y | Latin capital letter Y with diaeresis | + * | U+0179 | Ź | Z | Latin capital letter Z with acute | + * | U+017A | ź | z | Latin small letter z with acute | + * | U+017B | Ż | Z | Latin capital letter Z with dot above | + * | U+017C | ż | z | Latin small letter z with dot above | + * | U+017D | Ž | Z | Latin capital letter Z with caron | + * | U+017E | ž | z | Latin small letter z with caron | + * | U+017F | ſ | s | Latin small letter long s | + * | U+01A0 | Ơ | O | Latin capital letter O with horn | + * | U+01A1 | ơ | o | Latin small letter o with horn | + * | U+01AF | Ư | U | Latin capital letter U with horn | + * | U+01B0 | ư | u | Latin small letter u with horn | + * | U+01CD | Ǎ | A | Latin capital letter A with caron | + * | U+01CE | ǎ | a | Latin small letter a with caron | + * | U+01CF | Ǐ | I | Latin capital letter I with caron | + * | U+01D0 | ǐ | i | Latin small letter i with caron | + * | U+01D1 | Ǒ | O | Latin capital letter O with caron | + * | U+01D2 | ǒ | o | Latin small letter o with caron | + * | U+01D3 | Ǔ | U | Latin capital letter U with caron | + * | U+01D4 | ǔ | u | Latin small letter u with caron | + * | U+01D5 | Ǖ | U | Latin capital letter U with diaeresis and macron | + * | U+01D6 | ǖ | u | Latin small letter u with diaeresis and macron | + * | U+01D7 | Ǘ | U | Latin capital letter U with diaeresis and acute | + * | U+01D8 | ǘ | u | Latin small letter u with diaeresis and acute | + * | U+01D9 | Ǚ | U | Latin capital letter U with diaeresis and caron | + * | U+01DA | ǚ | u | Latin small letter u with diaeresis and caron | + * | U+01DB | Ǜ | U | Latin capital letter U with diaeresis and grave | + * | U+01DC | ǜ | u | Latin small letter u with diaeresis and grave | + * + * Decompositions for Latin Extended-B: + * + * | Code | Glyph | Replacement | Description | + * | -------- | ----- | ----------- | ----------------------------------------- | + * | U+018F | Ə | E | Latin capital letter Ə | + * | U+0259 | ǝ | e | Latin small letter ǝ | + * | U+0218 | Ș | S | Latin capital letter S with comma below | + * | U+0219 | ș | s | Latin small letter s with comma below | + * | U+021A | Ț | T | Latin capital letter T with comma below | + * | U+021B | ț | t | Latin small letter t with comma below | + * + * Vowels with diacritic (Chinese, Hanyu Pinyin): + * + * | Code | Glyph | Replacement | Description | + * | -------- | ----- | ----------- | ----------------------------------------------------- | + * | U+0251 | ɑ | a | Latin small letter alpha | + * | U+1EA0 | Ạ | A | Latin capital letter A with dot below | + * | U+1EA1 | ạ | a | Latin small letter a with dot below | + * | U+1EA2 | Ả | A | Latin capital letter A with hook above | + * | U+1EA3 | ả | a | Latin small letter a with hook above | + * | U+1EA4 | Ấ | A | Latin capital letter A with circumflex and acute | + * | U+1EA5 | ấ | a | Latin small letter a with circumflex and acute | + * | U+1EA6 | Ầ | A | Latin capital letter A with circumflex and grave | + * | U+1EA7 | ầ | a | Latin small letter a with circumflex and grave | + * | U+1EA8 | Ẩ | A | Latin capital letter A with circumflex and hook above | + * | U+1EA9 | ẩ | a | Latin small letter a with circumflex and hook above | + * | U+1EAA | Ẫ | A | Latin capital letter A with circumflex and tilde | + * | U+1EAB | ẫ | a | Latin small letter a with circumflex and tilde | + * | U+1EA6 | Ậ | A | Latin capital letter A with circumflex and dot below | + * | U+1EAD | ậ | a | Latin small letter a with circumflex and dot below | + * | U+1EAE | Ắ | A | Latin capital letter A with breve and acute | + * | U+1EAF | ắ | a | Latin small letter a with breve and acute | + * | U+1EB0 | Ằ | A | Latin capital letter A with breve and grave | + * | U+1EB1 | ằ | a | Latin small letter a with breve and grave | + * | U+1EB2 | Ẳ | A | Latin capital letter A with breve and hook above | + * | U+1EB3 | ẳ | a | Latin small letter a with breve and hook above | + * | U+1EB4 | Ẵ | A | Latin capital letter A with breve and tilde | + * | U+1EB5 | ẵ | a | Latin small letter a with breve and tilde | + * | U+1EB6 | Ặ | A | Latin capital letter A with breve and dot below | + * | U+1EB7 | ặ | a | Latin small letter a with breve and dot below | + * | U+1EB8 | Ẹ | E | Latin capital letter E with dot below | + * | U+1EB9 | ẹ | e | Latin small letter e with dot below | + * | U+1EBA | Ẻ | E | Latin capital letter E with hook above | + * | U+1EBB | ẻ | e | Latin small letter e with hook above | + * | U+1EBC | Ẽ | E | Latin capital letter E with tilde | + * | U+1EBD | ẽ | e | Latin small letter e with tilde | + * | U+1EBE | Ế | E | Latin capital letter E with circumflex and acute | + * | U+1EBF | ế | e | Latin small letter e with circumflex and acute | + * | U+1EC0 | Ề | E | Latin capital letter E with circumflex and grave | + * | U+1EC1 | ề | e | Latin small letter e with circumflex and grave | + * | U+1EC2 | Ể | E | Latin capital letter E with circumflex and hook above | + * | U+1EC3 | ể | e | Latin small letter e with circumflex and hook above | + * | U+1EC4 | Ễ | E | Latin capital letter E with circumflex and tilde | + * | U+1EC5 | ễ | e | Latin small letter e with circumflex and tilde | + * | U+1EC6 | Ệ | E | Latin capital letter E with circumflex and dot below | + * | U+1EC7 | ệ | e | Latin small letter e with circumflex and dot below | + * | U+1EC8 | Ỉ | I | Latin capital letter I with hook above | + * | U+1EC9 | ỉ | i | Latin small letter i with hook above | + * | U+1ECA | Ị | I | Latin capital letter I with dot below | + * | U+1ECB | ị | i | Latin small letter i with dot below | + * | U+1ECC | Ọ | O | Latin capital letter O with dot below | + * | U+1ECD | ọ | o | Latin small letter o with dot below | + * | U+1ECE | Ỏ | O | Latin capital letter O with hook above | + * | U+1ECF | ỏ | o | Latin small letter o with hook above | + * | U+1ED0 | Ố | O | Latin capital letter O with circumflex and acute | + * | U+1ED1 | ố | o | Latin small letter o with circumflex and acute | + * | U+1ED2 | Ồ | O | Latin capital letter O with circumflex and grave | + * | U+1ED3 | ồ | o | Latin small letter o with circumflex and grave | + * | U+1ED4 | Ổ | O | Latin capital letter O with circumflex and hook above | + * | U+1ED5 | ổ | o | Latin small letter o with circumflex and hook above | + * | U+1ED6 | Ỗ | O | Latin capital letter O with circumflex and tilde | + * | U+1ED7 | ỗ | o | Latin small letter o with circumflex and tilde | + * | U+1ED8 | Ộ | O | Latin capital letter O with circumflex and dot below | + * | U+1ED9 | ộ | o | Latin small letter o with circumflex and dot below | + * | U+1EDA | Ớ | O | Latin capital letter O with horn and acute | + * | U+1EDB | ớ | o | Latin small letter o with horn and acute | + * | U+1EDC | Ờ | O | Latin capital letter O with horn and grave | + * | U+1EDD | ờ | o | Latin small letter o with horn and grave | + * | U+1EDE | Ở | O | Latin capital letter O with horn and hook above | + * | U+1EDF | ở | o | Latin small letter o with horn and hook above | + * | U+1EE0 | Ỡ | O | Latin capital letter O with horn and tilde | + * | U+1EE1 | ỡ | o | Latin small letter o with horn and tilde | + * | U+1EE2 | Ợ | O | Latin capital letter O with horn and dot below | + * | U+1EE3 | ợ | o | Latin small letter o with horn and dot below | + * | U+1EE4 | Ụ | U | Latin capital letter U with dot below | + * | U+1EE5 | ụ | u | Latin small letter u with dot below | + * | U+1EE6 | Ủ | U | Latin capital letter U with hook above | + * | U+1EE7 | ủ | u | Latin small letter u with hook above | + * | U+1EE8 | Ứ | U | Latin capital letter U with horn and acute | + * | U+1EE9 | ứ | u | Latin small letter u with horn and acute | + * | U+1EEA | Ừ | U | Latin capital letter U with horn and grave | + * | U+1EEB | ừ | u | Latin small letter u with horn and grave | + * | U+1EEC | Ử | U | Latin capital letter U with horn and hook above | + * | U+1EED | ử | u | Latin small letter u with horn and hook above | + * | U+1EEE | Ữ | U | Latin capital letter U with horn and tilde | + * | U+1EEF | ữ | u | Latin small letter u with horn and tilde | + * | U+1EF0 | Ự | U | Latin capital letter U with horn and dot below | + * | U+1EF1 | ự | u | Latin small letter u with horn and dot below | + * | U+1EF2 | Ỳ | Y | Latin capital letter Y with grave | + * | U+1EF3 | ỳ | y | Latin small letter y with grave | + * | U+1EF4 | Ỵ | Y | Latin capital letter Y with dot below | + * | U+1EF5 | ỵ | y | Latin small letter y with dot below | + * | U+1EF6 | Ỷ | Y | Latin capital letter Y with hook above | + * | U+1EF7 | ỷ | y | Latin small letter y with hook above | + * | U+1EF8 | Ỹ | Y | Latin capital letter Y with tilde | + * | U+1EF9 | ỹ | y | Latin small letter y with tilde | + * + * German (`de_DE`), German formal (`de_DE_formal`), German (Switzerland) formal (`de_CH`), + * German (Switzerland) informal (`de_CH_informal`), and German (Austria) (`de_AT`) locales: + * + * | Code | Glyph | Replacement | Description | + * | -------- | ----- | ----------- | --------------------------------------- | + * | U+00C4 | Ä | Ae | Latin capital letter A with diaeresis | + * | U+00E4 | ä | ae | Latin small letter a with diaeresis | + * | U+00D6 | Ö | Oe | Latin capital letter O with diaeresis | + * | U+00F6 | ö | oe | Latin small letter o with diaeresis | + * | U+00DC | Ü | Ue | Latin capital letter U with diaeresis | + * | U+00FC | ü | ue | Latin small letter u with diaeresis | + * | U+00DF | ß | ss | Latin small letter sharp s | + * + * Danish (`da_DK`) locale: + * + * | Code | Glyph | Replacement | Description | + * | -------- | ----- | ----------- | --------------------------------------- | + * | U+00C6 | Æ | Ae | Latin capital letter AE | + * | U+00E6 | æ | ae | Latin small letter ae | + * | U+00D8 | Ø | Oe | Latin capital letter O with stroke | + * | U+00F8 | ø | oe | Latin small letter o with stroke | + * | U+00C5 | Å | Aa | Latin capital letter A with ring above | + * | U+00E5 | å | aa | Latin small letter a with ring above | + * + * Catalan (`ca`) locale: + * + * | Code | Glyph | Replacement | Description | + * | -------- | ----- | ----------- | --------------------------------------- | + * | U+00B7 | l·l | ll | Flown dot (between two Ls) | + * + * Serbian (`sr_RS`) and Bosnian (`bs_BA`) locales: + * + * | Code | Glyph | Replacement | Description | + * | -------- | ----- | ----------- | --------------------------------------- | + * | U+0110 | Đ | DJ | Latin capital letter D with stroke | + * | U+0111 | đ | dj | Latin small letter d with stroke | + * + * @since 1.2.1 + * @since 4.6.0 Added locale support for `de_CH`, `de_CH_informal`, and `ca`. + * @since 4.7.0 Added locale support for `sr_RS`. + * @since 4.8.0 Added locale support for `bs_BA`. + * @since 5.7.0 Added locale support for `de_AT`. + * @since 6.0.0 Added the `$locale` parameter. + * @since 6.1.0 Added Unicode NFC encoding normalization support. + * + * @param string $text Text that might have accent characters. + * @param string $locale Optional. The locale to use for accent removal. Some character + * replacements depend on the locale being used (e.g. 'de_DE'). + * Defaults to the current locale. + * @return string Filtered string with replaced "nice" characters. + */ + function remove_accents($text, $locale = '') + { + } + /** + * Sanitizes a filename, replacing whitespace with dashes. + * + * Removes special characters that are illegal in filenames on certain + * operating systems and special characters requiring special escaping + * to manipulate at the command line. Replaces spaces and consecutive + * dashes with a single dash. Trims period, dash and underscore from beginning + * and end of filename. It is not guaranteed that this function will return a + * filename that is allowed to be uploaded. + * + * @since 2.1.0 + * + * @param string $filename The filename to be sanitized. + * @return string The sanitized filename. + */ + function sanitize_file_name($filename) + { + } + /** + * Sanitizes a username, stripping out unsafe characters. + * + * Removes tags, percent-encoded characters, HTML entities, and if strict is enabled, + * will only keep alphanumeric, _, space, ., -, @. After sanitizing, it passes the username, + * raw username (the username in the parameter), and the value of $strict as parameters + * for the {@see 'sanitize_user'} filter. + * + * @since 2.0.0 + * + * @param string $username The username to be sanitized. + * @param bool $strict Optional. If set to true, limits $username to specific characters. + * Default false. + * @return string The sanitized username, after passing through filters. + */ + function sanitize_user($username, $strict = \false) + { + } + /** + * Sanitizes a string key. + * + * Keys are used as internal identifiers. Lowercase alphanumeric characters, + * dashes, and underscores are allowed. + * + * @since 3.0.0 + * + * @param string $key String key. + * @return string Sanitized key. + */ + function sanitize_key($key) + { + } + /** + * Sanitizes a string into a slug, which can be used in URLs or HTML attributes. + * + * By default, converts accent characters to ASCII characters and further + * limits the output to alphanumeric characters, underscore (_) and dash (-) + * through the {@see 'sanitize_title'} filter. + * + * If `$title` is empty and `$fallback_title` is set, the latter will be used. + * + * @since 1.0.0 + * + * @param string $title The string to be sanitized. + * @param string $fallback_title Optional. A title to use if $title is empty. Default empty. + * @param string $context Optional. The operation for which the string is sanitized. + * When set to 'save', the string runs through remove_accents(). + * Default 'save'. + * @return string The sanitized string. + */ + function sanitize_title($title, $fallback_title = '', $context = 'save') + { + } + /** + * Sanitizes a title with the 'query' context. + * + * Used for querying the database for a value from URL. + * + * @since 3.1.0 + * + * @param string $title The string to be sanitized. + * @return string The sanitized string. + */ + function sanitize_title_for_query($title) + { + } + /** + * Sanitizes a title, replacing whitespace and a few other characters with dashes. + * + * Limits the output to alphanumeric characters, underscore (_) and dash (-). + * Whitespace becomes a dash. + * + * @since 1.2.0 + * + * @param string $title The title to be sanitized. + * @param string $raw_title Optional. Not used. Default empty. + * @param string $context Optional. The operation for which the string is sanitized. + * When set to 'save', additional entities are converted to hyphens + * or stripped entirely. Default 'display'. + * @return string The sanitized title. + */ + function sanitize_title_with_dashes($title, $raw_title = '', $context = 'display') + { + } + /** + * Ensures a string is a valid SQL 'order by' clause. + * + * Accepts one or more columns, with or without a sort order (ASC / DESC). + * e.g. 'column_1', 'column_1, column_2', 'column_1 ASC, column_2 DESC' etc. + * + * Also accepts 'RAND()'. + * + * @since 2.5.1 + * + * @param string $orderby Order by clause to be validated. + * @return string|false Returns $orderby if valid, false otherwise. + */ + function sanitize_sql_orderby($orderby) + { + } + /** + * Sanitizes an HTML classname to ensure it only contains valid characters. + * + * Strips the string down to A-Z,a-z,0-9,_,-. If this results in an empty + * string then it will return the alternative value supplied. + * + * @todo Expand to support the full range of CDATA that a class attribute can contain. + * + * @since 2.8.0 + * + * @param string $classname The classname to be sanitized. + * @param string $fallback Optional. The value to return if the sanitization ends up as an empty string. + * Default empty string. + * @return string The sanitized value. + */ + function sanitize_html_class($classname, $fallback = '') + { + } + /** + * Strips out all characters not allowed in a locale name. + * + * @since 6.2.1 + * + * @param string $locale_name The locale name to be sanitized. + * @return string The sanitized value. + */ + function sanitize_locale_name($locale_name) + { + } + /** + * Converts lone & characters into `&` (a.k.a. `&`) + * + * @since 0.71 + * + * @param string $content String of characters to be converted. + * @param string $deprecated Not used. + * @return string Converted string. + */ + function convert_chars($content, $deprecated = '') + { + } + /** + * Converts invalid Unicode references range to valid range. + * + * @since 4.3.0 + * + * @param string $content String with entities that need converting. + * @return string Converted string. + */ + function convert_invalid_entities($content) + { + } + /** + * Balances tags if forced to, or if the 'use_balanceTags' option is set to true. + * + * @since 0.71 + * + * @param string $text Text to be balanced + * @param bool $force If true, forces balancing, ignoring the value of the option. Default false. + * @return string Balanced text + */ + function balanceTags($text, $force = \false) + { + } + /** + * Balances tags of string using a modified stack. + * + * @since 2.0.4 + * @since 5.3.0 Improve accuracy and add support for custom element tags. + * + * @author Leonard Lin <leonard@acm.org> + * @license GPL + * @copyright November 4, 2001 + * @version 1.1 + * @todo Make better - change loop condition to $text in 1.2 + * @internal Modified by Scott Reilly (coffee2code) 02 Aug 2004 + * 1.1 Fixed handling of append/stack pop order of end text + * Added Cleaning Hooks + * 1.0 First Version + * + * @param string $text Text to be balanced. + * @return string Balanced text. + */ + function force_balance_tags($text) + { + } + /** + * Acts on text which is about to be edited. + * + * The $content is run through esc_textarea(), which uses htmlspecialchars() + * to convert special characters to HTML entities. If `$richedit` is set to true, + * it is simply a holder for the {@see 'format_to_edit'} filter. + * + * @since 0.71 + * @since 4.4.0 The `$richedit` parameter was renamed to `$rich_text` for clarity. + * + * @param string $content The text about to be edited. + * @param bool $rich_text Optional. Whether `$content` should be considered rich text, + * in which case it would not be passed through esc_textarea(). + * Default false. + * @return string The text after the filter (and possibly htmlspecialchars()) has been run. + */ + function format_to_edit($content, $rich_text = \false) + { + } + /** + * Add leading zeros when necessary. + * + * If you set the threshold to '4' and the number is '10', then you will get + * back '0010'. If you set the threshold to '4' and the number is '5000', then you + * will get back '5000'. + * + * Uses sprintf to append the amount of zeros based on the $threshold parameter + * and the size of the number. If the number is large enough, then no zeros will + * be appended. + * + * @since 0.71 + * + * @param int $number Number to append zeros to if not greater than threshold. + * @param int $threshold Digit places number needs to be to not have zeros added. + * @return string Adds leading zeros to number if needed. + */ + function zeroise($number, $threshold) + { + } + /** + * Adds backslashes before letters and before a number at the start of a string. + * + * @since 0.71 + * + * @param string $value Value to which backslashes will be added. + * @return string String with backslashes inserted. + */ + function backslashit($value) + { + } + /** + * Appends a trailing slash. + * + * Will remove trailing forward and backslashes if it exists already before adding + * a trailing forward slash. This prevents double slashing a string or path. + * + * The primary use of this is for paths and thus should be used for paths. It is + * not restricted to paths and offers no specific path support. + * + * @since 1.2.0 + * + * @param string $value Value to which trailing slash will be added. + * @return string String with trailing slash added. + */ + function trailingslashit($value) + { + } + /** + * Removes trailing forward slashes and backslashes if they exist. + * + * The primary use of this is for paths and thus should be used for paths. It is + * not restricted to paths and offers no specific path support. + * + * @since 2.2.0 + * + * @param string $text Value from which trailing slashes will be removed. + * @return string String without the trailing slashes. + */ + function untrailingslashit($value) + { + } + /** + * Adds slashes to a string or recursively adds slashes to strings within an array. + * + * @since 0.71 + * + * @param string|array $gpc String or array of data to slash. + * @return string|array Slashed `$gpc`. + * @phpstan-template T + * @phpstan-param T $gpc + * @phpstan-return T + */ + function addslashes_gpc($gpc) + { + } + /** + * Navigates through an array, object, or scalar, and removes slashes from the values. + * + * @since 2.0.0 + * + * @param mixed $value The value to be stripped. + * @return mixed Stripped value. + * @phpstan-template T + * @phpstan-param T $value + * @phpstan-return T + */ + function stripslashes_deep($value) + { + } + /** + * Callback function for `stripslashes_deep()` which strips slashes from strings. + * + * @since 4.4.0 + * + * @param mixed $value The array or string to be stripped. + * @return mixed The stripped value. + */ + function stripslashes_from_strings_only($value) + { + } + /** + * Navigates through an array, object, or scalar, and encodes the values to be used in a URL. + * + * @since 2.2.0 + * + * @param mixed $value The array or string to be encoded. + * @return mixed The encoded value. + * @phpstan-template T + * @phpstan-param T $value + * @phpstan-return T + */ + function urlencode_deep($value) + { + } + /** + * Navigates through an array, object, or scalar, and raw-encodes the values to be used in a URL. + * + * @since 3.4.0 + * + * @param mixed $value The array or string to be encoded. + * @return mixed The encoded value. + * @phpstan-template T + * @phpstan-param T $value + * @phpstan-return T + */ + function rawurlencode_deep($value) + { + } + /** + * Navigates through an array, object, or scalar, and decodes URL-encoded values + * + * @since 4.4.0 + * + * @param mixed $value The array or string to be decoded. + * @return mixed The decoded value. + * @phpstan-template T + * @phpstan-param T $value + * @phpstan-return T + */ + function urldecode_deep($value) + { + } + /** + * Converts email addresses characters to HTML entities to block spam bots. + * + * @since 0.71 + * + * @param string $email_address Email address. + * @param int $hex_encoding Optional. Set to 1 to enable hex encoding. + * @return string Converted email address. + */ + function antispambot($email_address, $hex_encoding = 0) + { + } + /** + * Callback to convert URI match to HTML A element. + * + * This function was backported from 2.5.0 to 2.3.2. Regex callback for make_clickable(). + * + * @since 2.3.2 + * @access private + * + * @param array $matches Single Regex Match. + * @return string HTML A element with URI address. + */ + function _make_url_clickable_cb($matches) + { + } + /** + * Callback to convert URL match to HTML A element. + * + * This function was backported from 2.5.0 to 2.3.2. Regex callback for make_clickable(). + * + * @since 2.3.2 + * @access private + * + * @param array $matches Single Regex Match. + * @return string HTML A element with URL address. + */ + function _make_web_ftp_clickable_cb($matches) + { + } + /** + * Callback to convert email address match to HTML A element. + * + * This function was backported from 2.5.0 to 2.3.2. Regex callback for make_clickable(). + * + * @since 2.3.2 + * @access private + * + * @param array $matches Single Regex Match. + * @return string HTML A element with email address. + */ + function _make_email_clickable_cb($matches) + { + } + /** + * Helper function used to build the "rel" attribute for a URL when creating an anchor using make_clickable(). + * + * @since 6.2.0 + * + * @param string $url The URL. + * @return string The rel attribute for the anchor or an empty string if no rel attribute should be added. + */ + function _make_clickable_rel_attr($url) + { + } + /** + * Converts plaintext URI to HTML links. + * + * Converts URI, www and ftp, and email addresses. Finishes by fixing links + * within links. + * + * @since 0.71 + * + * @param string $text Content to convert URIs. + * @return string Content with converted URIs. + */ + function make_clickable($text) + { + } + /** + * Breaks a string into chunks by splitting at whitespace characters. + * + * The length of each returned chunk is as close to the specified length goal as possible, + * with the caveat that each chunk includes its trailing delimiter. + * Chunks longer than the goal are guaranteed to not have any inner whitespace. + * + * Joining the returned chunks with empty delimiters reconstructs the input string losslessly. + * + * Input string must have no null characters (or eventual transformations on output chunks must not care about null characters) + * + * _split_str_by_whitespace( "1234 67890 1234 67890a cd 1234 890 123456789 1234567890a 45678 1 3 5 7 90 ", 10 ) == + * array ( + * 0 => '1234 67890 ', // 11 characters: Perfect split. + * 1 => '1234 ', // 5 characters: '1234 67890a' was too long. + * 2 => '67890a cd ', // 10 characters: '67890a cd 1234' was too long. + * 3 => '1234 890 ', // 11 characters: Perfect split. + * 4 => '123456789 ', // 10 characters: '123456789 1234567890a' was too long. + * 5 => '1234567890a ', // 12 characters: Too long, but no inner whitespace on which to split. + * 6 => ' 45678 ', // 11 characters: Perfect split. + * 7 => '1 3 5 7 90 ', // 11 characters: End of $text. + * ); + * + * @since 3.4.0 + * @access private + * + * @param string $text The string to split. + * @param int $goal The desired chunk length. + * @return array Numeric array of chunks. + */ + function _split_str_by_whitespace($text, $goal) + { + } + /** + * Callback to add a rel attribute to HTML A element. + * + * Will remove already existing string before adding to prevent invalidating (X)HTML. + * + * @since 5.3.0 + * + * @param array $matches Single match. + * @param string $rel The rel attribute to add. + * @return string HTML A element with the added rel attribute. + */ + function wp_rel_callback($matches, $rel) + { + } + /** + * Adds `rel="nofollow"` string to all HTML A elements in content. + * + * @since 1.5.0 + * + * @param string $text Content that may contain HTML A elements. + * @return string Converted content. + */ + function wp_rel_nofollow($text) + { + } + /** + * Callback to add `rel="nofollow"` string to HTML A element. + * + * @since 2.3.0 + * @deprecated 5.3.0 Use wp_rel_callback() + * + * @param array $matches Single match. + * @return string HTML A Element with `rel="nofollow"`. + */ + function wp_rel_nofollow_callback($matches) + { + } + /** + * Adds `rel="nofollow ugc"` string to all HTML A elements in content. + * + * @since 5.3.0 + * + * @param string $text Content that may contain HTML A elements. + * @return string Converted content. + */ + function wp_rel_ugc($text) + { + } + /** + * Adds `rel="noopener"` to all HTML A elements that have a target. + * + * @since 5.1.0 + * @since 5.6.0 Removed 'noreferrer' relationship. + * + * @param string $text Content that may contain HTML A elements. + * @return string Converted content. + */ + function wp_targeted_link_rel($text) + { + } + /** + * Callback to add `rel="noopener"` string to HTML A element. + * + * Will not duplicate an existing 'noopener' value to avoid invalidating the HTML. + * + * @since 5.1.0 + * @since 5.6.0 Removed 'noreferrer' relationship. + * + * @param array $matches Single match. + * @return string HTML A Element with `rel="noopener"` in addition to any existing values. + */ + function wp_targeted_link_rel_callback($matches) + { + } + /** + * Adds all filters modifying the rel attribute of targeted links. + * + * @since 5.1.0 + */ + function wp_init_targeted_link_rel_filters() + { + } + /** + * Removes all filters modifying the rel attribute of targeted links. + * + * @since 5.1.0 + */ + function wp_remove_targeted_link_rel_filters() + { + } + /** + * Converts one smiley code to the icon graphic file equivalent. + * + * Callback handler for convert_smilies(). + * + * Looks up one smiley code in the $wpsmiliestrans global array and returns an + * `<img>` string for that smiley. + * + * @since 2.8.0 + * + * @global array $wpsmiliestrans + * + * @param array $matches Single match. Smiley code to convert to image. + * @return string Image string for smiley. + */ + function translate_smiley($matches) + { + } + /** + * Converts text equivalent of smilies to images. + * + * Will only convert smilies if the option 'use_smilies' is true and the global + * used in the function isn't empty. + * + * @since 0.71 + * + * @global string|array $wp_smiliessearch + * + * @param string $text Content to convert smilies from text. + * @return string Converted content with text smilies replaced with images. + */ + function convert_smilies($text) + { + } + /** + * Verifies that an email is valid. + * + * Does not grok i18n domains. Not RFC compliant. + * + * @since 0.71 + * + * @param string $email Email address to verify. + * @param bool $deprecated Deprecated. + * @return string|false Valid email address on success, false on failure. + */ + function is_email($email, $deprecated = \false) + { + } + /** + * Converts to ASCII from email subjects. + * + * @since 1.2.0 + * + * @param string $subject Subject line. + * @return string Converted string to ASCII. + */ + function wp_iso_descrambler($subject) + { + } + /** + * Helper function to convert hex encoded chars to ASCII. + * + * @since 3.1.0 + * @access private + * + * @param array $matches The preg_replace_callback matches array. + * @return string Converted chars. + */ + function _wp_iso_convert($matches) + { + } + /** + * Given a date in the timezone of the site, returns that date in UTC. + * + * Requires and returns a date in the Y-m-d H:i:s format. + * Return format can be overridden using the $format parameter. + * + * @since 1.2.0 + * + * @param string $date_string The date to be converted, in the timezone of the site. + * @param string $format The format string for the returned date. Default 'Y-m-d H:i:s'. + * @return string Formatted version of the date, in UTC. + */ + function get_gmt_from_date($date_string, $format = 'Y-m-d H:i:s') + { + } + /** + * Given a date in UTC or GMT timezone, returns that date in the timezone of the site. + * + * Requires a date in the Y-m-d H:i:s format. + * Default return format of 'Y-m-d H:i:s' can be overridden using the `$format` parameter. + * + * @since 1.2.0 + * + * @param string $date_string The date to be converted, in UTC or GMT timezone. + * @param string $format The format string for the returned date. Default 'Y-m-d H:i:s'. + * @return string Formatted version of the date, in the site's timezone. + */ + function get_date_from_gmt($date_string, $format = 'Y-m-d H:i:s') + { + } + /** + * Given an ISO 8601 timezone, returns its UTC offset in seconds. + * + * @since 1.5.0 + * + * @param string $timezone Either 'Z' for 0 offset or '±hhmm'. + * @return int|float The offset in seconds. + */ + function iso8601_timezone_to_offset($timezone) + { + } + /** + * Given an ISO 8601 (Ymd\TH:i:sO) date, returns a MySQL DateTime (Y-m-d H:i:s) format used by post_date[_gmt]. + * + * @since 1.5.0 + * + * @param string $date_string Date and time in ISO 8601 format {@link https://en.wikipedia.org/wiki/ISO_8601}. + * @param string $timezone Optional. If set to 'gmt' returns the result in UTC. Default 'user'. + * @return string|false The date and time in MySQL DateTime format - Y-m-d H:i:s, or false on failure. + */ + function iso8601_to_datetime($date_string, $timezone = 'user') + { + } + /** + * Strips out all characters that are not allowable in an email. + * + * @since 1.5.0 + * + * @param string $email Email address to filter. + * @return string Filtered email address. + */ + function sanitize_email($email) + { + } + /** + * Determines the difference between two timestamps. + * + * The difference is returned in a human-readable format such as "1 hour", + * "5 mins", "2 days". + * + * @since 1.5.0 + * @since 5.3.0 Added support for showing a difference in seconds. + * + * @param int $from Unix timestamp from which the difference begins. + * @param int $to Optional. Unix timestamp to end the time difference. Default becomes time() if not set. + * @return string Human-readable time difference. + */ + function human_time_diff($from, $to = 0) + { + } + /** + * Generates an excerpt from the content, if needed. + * + * Returns a maximum of 55 words with an ellipsis appended if necessary. + * + * The 55-word limit can be modified by plugins/themes using the {@see 'excerpt_length'} filter + * The ' […]' string can be modified by plugins/themes using the {@see 'excerpt_more'} filter + * + * @since 1.5.0 + * @since 5.2.0 Added the `$post` parameter. + * @since 6.3.0 Removes footnotes markup from the excerpt content. + * + * @param string $text Optional. The excerpt. If set to empty, an excerpt is generated. + * @param WP_Post|object|int $post Optional. WP_Post instance or Post ID/object. Default null. + * @return string The excerpt. + */ + function wp_trim_excerpt($text = '', $post = \null) + { + } + /** + * Trims text to a certain number of words. + * + * This function is localized. For languages that count 'words' by the individual + * character (such as East Asian languages), the $num_words argument will apply + * to the number of individual characters. + * + * @since 3.3.0 + * + * @param string $text Text to trim. + * @param int $num_words Number of words. Default 55. + * @param string $more Optional. What to append if $text needs to be trimmed. Default '…'. + * @return string Trimmed text. + */ + function wp_trim_words($text, $num_words = 55, $more = \null) + { + } + /** + * Converts named entities into numbered entities. + * + * @since 1.5.1 + * + * @param string $text The text within which entities will be converted. + * @return string Text with converted entities. + */ + function ent2ncr($text) + { + } + /** + * Formats text for the editor. + * + * Generally the browsers treat everything inside a textarea as text, but + * it is still a good idea to HTML entity encode `<`, `>` and `&` in the content. + * + * The filter {@see 'format_for_editor'} is applied here. If `$text` is empty the + * filter will be applied to an empty string. + * + * @since 4.3.0 + * + * @see _WP_Editors::editor() + * + * @param string $text The text to be formatted. + * @param string $default_editor The default editor for the current user. + * It is usually either 'html' or 'tinymce'. + * @return string The formatted text after filter is applied. + * @phpstan-param 'html'|'tinymce' $default_editor + */ + function format_for_editor($text, $default_editor = \null) + { + } + /** + * Performs a deep string replace operation to ensure the values in $search are no longer present. + * + * Repeats the replacement operation until it no longer replaces anything to remove "nested" values + * e.g. $subject = '%0%0%0DDD', $search ='%0D', $result ='' rather than the '%0%0DD' that + * str_replace would return + * + * @since 2.8.1 + * @access private + * + * @param string|array $search The value being searched for, otherwise known as the needle. + * An array may be used to designate multiple needles. + * @param string $subject The string being searched and replaced on, otherwise known as the haystack. + * @return string The string with the replaced values. + */ + function _deep_replace($search, $subject) + { + } + /** + * Escapes data for use in a MySQL query. + * + * Usually you should prepare queries using wpdb::prepare(). + * Sometimes, spot-escaping is required or useful. One example + * is preparing an array for use in an IN clause. + * + * NOTE: Since 4.8.3, '%' characters will be replaced with a placeholder string, + * this prevents certain SQLi attacks from taking place. This change in behavior + * may cause issues for code that expects the return value of esc_sql() to be usable + * for other purposes. + * + * @since 2.8.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string|array $data Unescaped data. + * @return string|array Escaped data, in the same type as supplied. + */ + function esc_sql($data) + { + } + /** + * Checks and cleans a URL. + * + * A number of characters are removed from the URL. If the URL is for displaying + * (the default behavior) ampersands are also replaced. The {@see 'clean_url'} filter + * is applied to the returned cleaned URL. + * + * @since 2.8.0 + * + * @param string $url The URL to be cleaned. + * @param string[] $protocols Optional. An array of acceptable protocols. + * Defaults to return value of wp_allowed_protocols(). + * @param string $_context Private. Use sanitize_url() for database usage. + * @return string The cleaned URL after the {@see 'clean_url'} filter is applied. + * An empty string is returned if `$url` specifies a protocol other than + * those in `$protocols`, or if `$url` contains an empty string. + */ + function esc_url($url, $protocols = \null, $_context = 'display') + { + } + /** + * Sanitizes a URL for database or redirect usage. + * + * This function is an alias for sanitize_url(). + * + * @since 2.8.0 + * @since 6.1.0 Turned into an alias for sanitize_url(). + * + * @see sanitize_url() + * + * @param string $url The URL to be cleaned. + * @param string[] $protocols Optional. An array of acceptable protocols. + * Defaults to return value of wp_allowed_protocols(). + * @return string The cleaned URL after sanitize_url() is run. + */ + function esc_url_raw($url, $protocols = \null) + { + } + /** + * Sanitizes a URL for database or redirect usage. + * + * @since 2.3.1 + * @since 2.8.0 Deprecated in favor of esc_url_raw(). + * @since 5.9.0 Restored (un-deprecated). + * + * @see esc_url() + * + * @param string $url The URL to be cleaned. + * @param string[] $protocols Optional. An array of acceptable protocols. + * Defaults to return value of wp_allowed_protocols(). + * @return string The cleaned URL after esc_url() is run with the 'db' context. + */ + function sanitize_url($url, $protocols = \null) + { + } + /** + * Converts entities, while preserving already-encoded entities. + * + * @link https://www.php.net/htmlentities Borrowed from the PHP Manual user notes. + * + * @since 1.2.2 + * + * @param string $text The text to be converted. + * @return string Converted text. + */ + function htmlentities2($text) + { + } + /** + * Escapes single quotes, `"`, `<`, `>`, `&`, and fixes line endings. + * + * Escapes text strings for echoing in JS. It is intended to be used for inline JS + * (in a tag attribute, for example `onclick="..."`). Note that the strings have to + * be in single quotes. The {@see 'js_escape'} filter is also applied here. + * + * @since 2.8.0 + * + * @param string $text The text to be escaped. + * @return string Escaped text. + */ + function esc_js($text) + { + } + /** + * Escaping for HTML blocks. + * + * @since 2.8.0 + * + * @param string $text + * @return string + */ + function esc_html($text) + { + } + /** + * Escaping for HTML attributes. + * + * @since 2.8.0 + * + * @param string $text + * @return string + */ + function esc_attr($text) + { + } + /** + * Escaping for textarea values. + * + * @since 3.1.0 + * + * @param string $text + * @return string + */ + function esc_textarea($text) + { + } + /** + * Escaping for XML blocks. + * + * @since 5.5.0 + * + * @param string $text Text to escape. + * @return string Escaped text. + */ + function esc_xml($text) + { + } + /** + * Escapes an HTML tag name. + * + * @since 2.5.0 + * @since 6.5.5 Allow hyphens in tag names (i.e. custom elements). + * + * @param string $tag_name + * @return string + */ + function tag_escape($tag_name) + { + } + /** + * Converts full URL paths to absolute paths. + * + * Removes the http or https protocols and the domain. Keeps the path '/' at the + * beginning, so it isn't a true relative link, but from the web root base. + * + * @since 2.1.0 + * @since 4.1.0 Support was added for relative URLs. + * + * @param string $link Full URL path. + * @return string Absolute path. + */ + function wp_make_link_relative($link) + { + } + /** + * Sanitizes various option values based on the nature of the option. + * + * This is basically a switch statement which will pass $value through a number + * of functions depending on the $option. + * + * @since 2.0.5 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $option The name of the option. + * @param mixed $value The unsanitized value. + * @return mixed Sanitized value. + */ + function sanitize_option($option, $value) + { + } + /** + * Maps a function to all non-iterable elements of an array or an object. + * + * This is similar to `array_walk_recursive()` but acts upon objects too. + * + * @since 4.4.0 + * + * @param mixed $value The array, object, or scalar. + * @param callable $callback The function to map onto $value. + * @return mixed The value with the callback applied to all non-arrays and non-objects inside it. + */ + function map_deep($value, $callback) + { + } + /** + * Parses a string into variables to be stored in an array. + * + * @since 2.2.1 + * + * @param string $input_string The string to be parsed. + * @param array $result Variables will be stored in this array. + */ + function wp_parse_str($input_string, &$result) + { + } + /** + * Converts lone less than signs. + * + * KSES already converts lone greater than signs. + * + * @since 2.3.0 + * + * @param string $content Text to be converted. + * @return string Converted text. + */ + function wp_pre_kses_less_than($content) + { + } + /** + * Callback function used by preg_replace. + * + * @since 2.3.0 + * + * @param string[] $matches Populated by matches to preg_replace. + * @return string The text returned after esc_html if needed. + */ + function wp_pre_kses_less_than_callback($matches) + { + } + /** + * Removes non-allowable HTML from parsed block attribute values when filtering + * in the post context. + * + * @since 5.3.1 + * + * @param string $content Content to be run through KSES. + * @param array[]|string $allowed_html An array of allowed HTML elements + * and attributes, or a context name + * such as 'post'. + * @param string[] $allowed_protocols Array of allowed URL protocols. + * @return string Filtered text to run through KSES. + */ + function wp_pre_kses_block_attributes($content, $allowed_html, $allowed_protocols) + { + } + /** + * WordPress' implementation of PHP sprintf() with filters. + * + * @since 2.5.0 + * @since 5.3.0 Formalized the existing and already documented `...$args` parameter + * by adding it to the function signature. + * + * @link https://www.php.net/sprintf + * + * @param string $pattern The string which formatted args are inserted. + * @param mixed ...$args Arguments to be formatted into the $pattern string. + * @return string The formatted string. + */ + function wp_sprintf($pattern, ...$args) + { + } + /** + * Localizes list items before the rest of the content. + * + * The '%l' must be at the first characters can then contain the rest of the + * content. The list items will have ', ', ', and', and ' and ' added depending + * on the amount of list items in the $args parameter. + * + * @since 2.5.0 + * + * @param string $pattern Content containing '%l' at the beginning. + * @param array $args List items to prepend to the content and replace '%l'. + * @return string Localized list items and rest of the content. + */ + function wp_sprintf_l($pattern, $args) + { + } + /** + * Safely extracts not more than the first $count characters from HTML string. + * + * UTF-8, tags and entities safe prefix extraction. Entities inside will *NOT* + * be counted as one character. For example & will be counted as 4, < as + * 3, etc. + * + * @since 2.5.0 + * + * @param string $str String to get the excerpt from. + * @param int $count Maximum number of characters to take. + * @param string $more Optional. What to append if $str needs to be trimmed. Defaults to empty string. + * @return string The excerpt. + */ + function wp_html_excerpt($str, $count, $more = \null) + { + } + /** + * Adds a base URL to relative links in passed content. + * + * By default, this function supports the 'src' and 'href' attributes. + * However, this can be modified via the `$attrs` parameter. + * + * @since 2.7.0 + * + * @global string $_links_add_base + * + * @param string $content String to search for links in. + * @param string $base The base URL to prefix to links. + * @param array $attrs The attributes which should be processed. + * @return string The processed content. + */ + function links_add_base_url($content, $base, $attrs = array('src', 'href')) + { + } + /** + * Callback to add a base URL to relative links in passed content. + * + * @since 2.7.0 + * @access private + * + * @global string $_links_add_base + * + * @param string $m The matched link. + * @return string The processed link. + */ + function _links_add_base($m) + { + } + /** + * Adds a target attribute to all links in passed content. + * + * By default, this function only applies to `<a>` tags. + * However, this can be modified via the `$tags` parameter. + * + * *NOTE:* Any current target attribute will be stripped and replaced. + * + * @since 2.7.0 + * + * @global string $_links_add_target + * + * @param string $content String to search for links in. + * @param string $target The target to add to the links. + * @param string[] $tags An array of tags to apply to. + * @return string The processed content. + */ + function links_add_target($content, $target = '_blank', $tags = array('a')) + { + } + /** + * Callback to add a target attribute to all links in passed content. + * + * @since 2.7.0 + * @access private + * + * @global string $_links_add_target + * + * @param string $m The matched link. + * @return string The processed link. + */ + function _links_add_target($m) + { + } + /** + * Normalizes EOL characters and strips duplicate whitespace. + * + * @since 2.7.0 + * + * @param string $str The string to normalize. + * @return string The normalized string. + */ + function normalize_whitespace($str) + { + } + /** + * Properly strips all HTML tags including script and style + * + * This differs from strip_tags() because it removes the contents of + * the `<script>` and `<style>` tags. E.g. `strip_tags( '<script>something</script>' )` + * will return 'something'. wp_strip_all_tags will return '' + * + * @since 2.9.0 + * + * @param string $text String containing HTML tags + * @param bool $remove_breaks Optional. Whether to remove left over line breaks and white space chars + * @return string The processed string. + */ + function wp_strip_all_tags($text, $remove_breaks = \false) + { + } + /** + * Sanitizes a string from user input or from the database. + * + * - Checks for invalid UTF-8, + * - Converts single `<` characters to entities + * - Strips all tags + * - Removes line breaks, tabs, and extra whitespace + * - Strips percent-encoded characters + * + * @since 2.9.0 + * + * @see sanitize_textarea_field() + * @see wp_check_invalid_utf8() + * @see wp_strip_all_tags() + * + * @param string $str String to sanitize. + * @return string Sanitized string. + */ + function sanitize_text_field($str) + { + } + /** + * Sanitizes a multiline string from user input or from the database. + * + * The function is like sanitize_text_field(), but preserves + * new lines (\n) and other whitespace, which are legitimate + * input in textarea elements. + * + * @see sanitize_text_field() + * + * @since 4.7.0 + * + * @param string $str String to sanitize. + * @return string Sanitized string. + */ + function sanitize_textarea_field($str) + { + } + /** + * Internal helper function to sanitize a string from user input or from the database. + * + * @since 4.7.0 + * @access private + * + * @param string $str String to sanitize. + * @param bool $keep_newlines Optional. Whether to keep newlines. Default: false. + * @return string Sanitized string. + */ + function _sanitize_text_fields($str, $keep_newlines = \false) + { + } + /** + * i18n-friendly version of basename(). + * + * @since 3.1.0 + * + * @param string $path A path. + * @param string $suffix If the filename ends in suffix this will also be cut off. + * @return string + */ + function wp_basename($path, $suffix = '') + { + } + // phpcs:disable WordPress.WP.CapitalPDangit.MisspelledInComment,WordPress.WP.CapitalPDangit.MisspelledInText,WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid -- 8-) + /** + * Forever eliminate "Wordpress" from the planet (or at least the little bit we can influence). + * + * Violating our coding standards for a good function name. + * + * @since 3.0.0 + * + * @param string $text The text to be modified. + * @return string The modified text. + */ + function capital_P_dangit($text) + { + } + // phpcs:enable + /** + * Sanitizes a mime type + * + * @since 3.1.3 + * + * @param string $mime_type Mime type. + * @return string Sanitized mime type. + */ + function sanitize_mime_type($mime_type) + { + } + /** + * Sanitizes space or carriage return separated URLs that are used to send trackbacks. + * + * @since 3.4.0 + * + * @param string $to_ping Space or carriage return separated URLs + * @return string URLs starting with the http or https protocol, separated by a carriage return. + */ + function sanitize_trackback_urls($to_ping) + { + } + /** + * Adds slashes to a string or recursively adds slashes to strings within an array. + * + * This should be used when preparing data for core API that expects slashed data. + * This should not be used to escape data going directly into an SQL query. + * + * @since 3.6.0 + * @since 5.5.0 Non-string values are left untouched. + * + * @param string|array $value String or array of data to slash. + * @return string|array Slashed `$value`, in the same type as supplied. + * @phpstan-template T + * @phpstan-param T $value + * @phpstan-return T + */ + function wp_slash($value) + { + } + /** + * Removes slashes from a string or recursively removes slashes from strings within an array. + * + * This should be used to remove slashes from data passed to core API that + * expects data to be unslashed. + * + * @since 3.6.0 + * + * @param string|array $value String or array of data to unslash. + * @return string|array Unslashed `$value`, in the same type as supplied. + * @phpstan-template T + * @phpstan-param T $value + * @phpstan-return T + */ + function wp_unslash($value) + { + } + /** + * Extracts and returns the first URL from passed content. + * + * @since 3.6.0 + * + * @param string $content A string which might contain a URL. + * @return string|false The found URL. + */ + function get_url_in_content($content) + { + } + /** + * Returns the regexp for common whitespace characters. + * + * By default, spaces include new lines, tabs, nbsp entities, and the UTF-8 nbsp. + * This is designed to replace the PCRE \s sequence. In ticket #22692, that + * sequence was found to be unreliable due to random inclusion of the A0 byte. + * + * @since 4.0.0 + * + * @return string The spaces regexp. + */ + function wp_spaces_regexp() + { + } + /** + * Enqueues the important emoji-related styles. + * + * @since 6.4.0 + * @phpstan-return void + */ + function wp_enqueue_emoji_styles() + { + } + /** + * Prints the inline Emoji detection script if it is not already printed. + * + * @since 4.2.0 + * @phpstan-return void + */ + function print_emoji_detection_script() + { + } + /** + * Prints inline Emoji detection script. + * + * @ignore + * @since 4.6.0 + * @access private + */ + function _print_emoji_detection_script() + { + } + /** + * Converts emoji characters to their equivalent HTML entity. + * + * This allows us to store emoji in a DB using the utf8 character set. + * + * @since 4.2.0 + * + * @param string $content The content to encode. + * @return string The encoded content. + */ + function wp_encode_emoji($content) + { + } + /** + * Converts emoji to a static img element. + * + * @since 4.2.0 + * + * @param string $text The content to encode. + * @return string The encoded content. + */ + function wp_staticize_emoji($text) + { + } + /** + * Converts emoji in emails into static images. + * + * @since 4.2.0 + * + * @param array $mail The email data array. + * @return array The email data array, with emoji in the message staticized. + */ + function wp_staticize_emoji_for_email($mail) + { + } + /** + * Returns arrays of emoji data. + * + * These arrays are automatically built from the regex in twemoji.js - if they need to be updated, + * you should update the regex there, then run the `npm run grunt precommit:emoji` job. + * + * @since 4.9.0 + * @access private + * + * @param string $type Optional. Which array type to return. Accepts 'partials' or 'entities', default 'entities'. + * @return array An array to match all emoji that WordPress recognises. + * @phpstan-param 'partials'|'entities' $type + */ + function _wp_emoji_list($type = 'entities') + { + } + /** + * Shortens a URL, to be used as link text. + * + * @since 1.2.0 + * @since 4.4.0 Moved to wp-includes/formatting.php from wp-admin/includes/misc.php and added $length param. + * + * @param string $url URL to shorten. + * @param int $length Optional. Maximum length of the shortened URL. Default 35 characters. + * @return string Shortened URL. + */ + function url_shorten($url, $length = 35) + { + } + /** + * Sanitizes a hex color. + * + * Returns either '', a 3 or 6 digit hex color (with #), or nothing. + * For sanitizing values without a #, see sanitize_hex_color_no_hash(). + * + * @since 3.4.0 + * + * @param string $color + * @return string|void + */ + function sanitize_hex_color($color) + { + } + /** + * Sanitizes a hex color without a hash. Use sanitize_hex_color() when possible. + * + * Saving hex colors without a hash puts the burden of adding the hash on the + * UI, which makes it difficult to use or upgrade to other color types such as + * rgba, hsl, rgb, and HTML color names. + * + * Returns either '', a 3 or 6 digit hex color (without a #), or null. + * + * @since 3.4.0 + * + * @param string $color + * @return string|null + */ + function sanitize_hex_color_no_hash($color) + { + } + /** + * Ensures that any hex color is properly hashed. + * Otherwise, returns value untouched. + * + * This method should only be necessary if using sanitize_hex_color_no_hash(). + * + * @since 3.4.0 + * + * @param string $color + * @return string + */ + function maybe_hash_hex_color($color) + { + } + /** + * Converts given MySQL date string into a different format. + * + * - `$format` should be a PHP date format string. + * - 'U' and 'G' formats will return an integer sum of timestamp with timezone offset. + * - `$date` is expected to be local time in MySQL format (`Y-m-d H:i:s`). + * + * Historically UTC time could be passed to the function to produce Unix timestamp. + * + * If `$translate` is true then the given date and format string will + * be passed to `wp_date()` for translation. + * + * @since 0.71 + * + * @param string $format Format of the date to return. + * @param string $date Date string to convert. + * @param bool $translate Whether the return date should be translated. Default true. + * @return string|int|false Integer if `$format` is 'U' or 'G', string otherwise. + * False on failure. + * @phpstan-return ($format is 'G'|'U' ? int|false : string|false) + */ + function mysql2date($format, $date, $translate = \true) + { + } + /** + * Retrieves the current time based on specified type. + * + * - The 'mysql' type will return the time in the format for MySQL DATETIME field. + * - The 'timestamp' or 'U' types will return the current timestamp or a sum of timestamp + * and timezone offset, depending on `$gmt`. + * - Other strings will be interpreted as PHP date formats (e.g. 'Y-m-d'). + * + * If `$gmt` is a truthy value then both types will use GMT time, otherwise the + * output is adjusted with the GMT offset for the site. + * + * @since 1.0.0 + * @since 5.3.0 Now returns an integer if `$type` is 'U'. Previously a string was returned. + * + * @param string $type Type of time to retrieve. Accepts 'mysql', 'timestamp', 'U', + * or PHP date format string (e.g. 'Y-m-d'). + * @param int|bool $gmt Optional. Whether to use GMT timezone. Default false. + * @return int|string Integer if `$type` is 'timestamp' or 'U', string otherwise. + * @phpstan-return ($type is 'timestamp'|'U' ? int : string) + */ + function current_time($type, $gmt = 0) + { + } + /** + * Retrieves the current time as an object using the site's timezone. + * + * @since 5.3.0 + * + * @return DateTimeImmutable Date and time object. + */ + function current_datetime() + { + } + /** + * Retrieves the timezone of the site as a string. + * + * Uses the `timezone_string` option to get a proper timezone name if available, + * otherwise falls back to a manual UTC ± offset. + * + * Example return values: + * + * - 'Europe/Rome' + * - 'America/North_Dakota/New_Salem' + * - 'UTC' + * - '-06:30' + * - '+00:00' + * - '+08:45' + * + * @since 5.3.0 + * + * @return string PHP timezone name or a ±HH:MM offset. + */ + function wp_timezone_string() + { + } + /** + * Retrieves the timezone of the site as a `DateTimeZone` object. + * + * Timezone can be based on a PHP timezone string or a ±HH:MM offset. + * + * @since 5.3.0 + * + * @return DateTimeZone Timezone object. + */ + function wp_timezone() + { + } + /** + * Retrieves the date in localized format, based on a sum of Unix timestamp and + * timezone offset in seconds. + * + * If the locale specifies the locale month and weekday, then the locale will + * take over the format for the date. If it isn't, then the date format string + * will be used instead. + * + * Note that due to the way WP typically generates a sum of timestamp and offset + * with `strtotime()`, it implies offset added at a _current_ time, not at the time + * the timestamp represents. Storing such timestamps or calculating them differently + * will lead to invalid output. + * + * @since 0.71 + * @since 5.3.0 Converted into a wrapper for wp_date(). + * + * @param string $format Format to display the date. + * @param int|bool $timestamp_with_offset Optional. A sum of Unix timestamp and timezone offset + * in seconds. Default false. + * @param bool $gmt Optional. Whether to use GMT timezone. Only applies + * if timestamp is not provided. Default false. + * @return string The date, translated if locale specifies it. + */ + function date_i18n($format, $timestamp_with_offset = \false, $gmt = \false) + { + } + /** + * Retrieves the date, in localized format. + * + * This is a newer function, intended to replace `date_i18n()` without legacy quirks in it. + * + * Note that, unlike `date_i18n()`, this function accepts a true Unix timestamp, not summed + * with timezone offset. + * + * @since 5.3.0 + * + * @global WP_Locale $wp_locale WordPress date and time locale object. + * + * @param string $format PHP date format. + * @param int $timestamp Optional. Unix timestamp. Defaults to current time. + * @param DateTimeZone $timezone Optional. Timezone to output result in. Defaults to timezone + * from site settings. + * @return string|false The date, translated if locale specifies it. False on invalid timestamp input. + */ + function wp_date($format, $timestamp = \null, $timezone = \null) + { + } + /** + * Determines if the date should be declined. + * + * If the locale specifies that month names require a genitive case in certain + * formats (like 'j F Y'), the month name will be replaced with a correct form. + * + * @since 4.4.0 + * @since 5.4.0 The `$format` parameter was added. + * + * @global WP_Locale $wp_locale WordPress date and time locale object. + * + * @param string $date Formatted date string. + * @param string $format Optional. Date format to check. Default empty string. + * @return string The date, declined if locale specifies it. + */ + function wp_maybe_decline_date($date, $format = '') + { + } + /** + * Converts float number to format based on the locale. + * + * @since 2.3.0 + * + * @global WP_Locale $wp_locale WordPress date and time locale object. + * + * @param float $number The number to convert based on locale. + * @param int $decimals Optional. Precision of the number of decimal places. Default 0. + * @return string Converted number in string format. + */ + function number_format_i18n($number, $decimals = 0) + { + } + /** + * Converts a number of bytes to the largest unit the bytes will fit into. + * + * It is easier to read 1 KB than 1024 bytes and 1 MB than 1048576 bytes. Converts + * number of bytes to human readable number by taking the number of that unit + * that the bytes will go into it. Supports YB value. + * + * Please note that integers in PHP are limited to 32 bits, unless they are on + * 64 bit architecture, then they have 64 bit size. If you need to place the + * larger size then what PHP integer type will hold, then use a string. It will + * be converted to a double, which should always have 64 bit length. + * + * Technically the correct unit names for powers of 1024 are KiB, MiB etc. + * + * @since 2.3.0 + * @since 6.0.0 Support for PB, EB, ZB, and YB was added. + * + * @param int|string $bytes Number of bytes. Note max integer size for integers. + * @param int $decimals Optional. Precision of number of decimal places. Default 0. + * @return string|false Number string on success, false on failure. + */ + function size_format($bytes, $decimals = 0) + { + } + /** + * Converts a duration to human readable format. + * + * @since 5.1.0 + * + * @param string $duration Duration will be in string format (HH:ii:ss) OR (ii:ss), + * with a possible prepended negative sign (-). + * @return string|false A human readable duration string, false on failure. + */ + function human_readable_duration($duration = '') + { + } + /** + * Gets the week start and end from the datetime or date string from MySQL. + * + * @since 0.71 + * + * @param string $mysqlstring Date or datetime field type from MySQL. + * @param int|string $start_of_week Optional. Start of the week as an integer. Default empty string. + * @return int[] { + * Week start and end dates as Unix timestamps. + * + * @type int $start The week start date as a Unix timestamp. + * @type int $end The week end date as a Unix timestamp. + * } + * @phpstan-return array{ + * start: int, + * end: int, + * } + */ + function get_weekstartend($mysqlstring, $start_of_week = '') + { + } + /** + * Serializes data, if needed. + * + * @since 2.0.5 + * + * @param string|array|object $data Data that might be serialized. + * @return mixed A scalar data. + */ + function maybe_serialize($data) + { + } + /** + * Unserializes data only if it was serialized. + * + * @since 2.0.0 + * + * @param string $data Data that might be unserialized. + * @return mixed Unserialized data can be any type. + */ + function maybe_unserialize($data) + { + } + /** + * Checks value to find if it was serialized. + * + * If $data is not a string, then returned value will always be false. + * Serialized data is always a string. + * + * @since 2.0.5 + * @since 6.1.0 Added Enum support. + * + * @param string $data Value to check to see if was serialized. + * @param bool $strict Optional. Whether to be strict about the end of the string. Default true. + * @return bool False if not serialized and true if it was. + */ + function is_serialized($data, $strict = \true) + { + } + /** + * Checks whether serialized data is of string type. + * + * @since 2.0.5 + * + * @param string $data Serialized data. + * @return bool False if not a serialized string, true if it is. + */ + function is_serialized_string($data) + { + } + /** + * Retrieves post title from XMLRPC XML. + * + * If the title element is not part of the XML, then the default post title from + * the $post_default_title will be used instead. + * + * @since 0.71 + * + * @global string $post_default_title Default XML-RPC post title. + * + * @param string $content XMLRPC XML Request content + * @return string Post title + */ + function xmlrpc_getposttitle($content) + { + } + /** + * Retrieves the post category or categories from XMLRPC XML. + * + * If the category element is not found, then the default post category will be + * used. The return type then would be what $post_default_category. If the + * category is found, then it will always be an array. + * + * @since 0.71 + * + * @global string $post_default_category Default XML-RPC post category. + * + * @param string $content XMLRPC XML Request content + * @return string|array List of categories or category name. + */ + function xmlrpc_getpostcategory($content) + { + } + /** + * XMLRPC XML content without title and category elements. + * + * @since 0.71 + * + * @param string $content XML-RPC XML Request content. + * @return string XMLRPC XML Request content without title and category elements. + */ + function xmlrpc_removepostdata($content) + { + } + /** + * Uses RegEx to extract URLs from arbitrary content. + * + * @since 3.7.0 + * @since 6.0.0 Fixes support for HTML entities (Trac 30580). + * + * @param string $content Content to extract URLs from. + * @return string[] Array of URLs found in passed string. + */ + function wp_extract_urls($content) + { + } + /** + * Checks content for video and audio links to add as enclosures. + * + * Will not add enclosures that have already been added and will + * remove enclosures that are no longer in the post. This is called as + * pingbacks and trackbacks. + * + * @since 1.5.0 + * @since 5.3.0 The `$content` parameter was made optional, and the `$post` parameter was + * updated to accept a post ID or a WP_Post object. + * @since 5.6.0 The `$content` parameter is no longer optional, but passing `null` to skip it + * is still supported. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string|null $content Post content. If `null`, the `post_content` field from `$post` is used. + * @param int|WP_Post $post Post ID or post object. + * @return void|false Void on success, false if the post is not found. + */ + function do_enclose($content, $post) + { + } + /** + * Retrieves HTTP Headers from URL. + * + * @since 1.5.1 + * + * @param string $url URL to retrieve HTTP headers from. + * @param bool $deprecated Not Used. + * @return \WpOrg\Requests\Utility\CaseInsensitiveDictionary|false Headers on success, false on failure. + */ + function wp_get_http_headers($url, $deprecated = \false) + { + } + /** + * Determines whether the publish date of the current post in the loop is different + * from the publish date of the previous post in the loop. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 0.71 + * + * @global string $currentday The day of the current post in the loop. + * @global string $previousday The day of the previous post in the loop. + * + * @return int 1 when new day, 0 if not a new day. + */ + function is_new_day() + { + } + /** + * Builds URL query based on an associative and, or indexed array. + * + * This is a convenient function for easily building url queries. It sets the + * separator to '&' and uses _http_build_query() function. + * + * @since 2.3.0 + * + * @see _http_build_query() Used to build the query + * @link https://www.php.net/manual/en/function.http-build-query.php for more on what + * http_build_query() does. + * + * @param array $data URL-encode key/value pairs. + * @return string URL-encoded string. + */ + function build_query($data) + { + } + /** + * From php.net (modified by Mark Jaquith to behave like the native PHP5 function). + * + * @since 3.2.0 + * @access private + * + * @see https://www.php.net/manual/en/function.http-build-query.php + * + * @param array|object $data An array or object of data. Converted to array. + * @param string $prefix Optional. Numeric index. If set, start parameter numbering with it. + * Default null. + * @param string $sep Optional. Argument separator; defaults to 'arg_separator.output'. + * Default null. + * @param string $key Optional. Used to prefix key name. Default empty string. + * @param bool $urlencode Optional. Whether to use urlencode() in the result. Default true. + * @return string The query string. + */ + function _http_build_query($data, $prefix = \null, $sep = \null, $key = '', $urlencode = \true) + { + } + /** + * Retrieves a modified URL query string. + * + * You can rebuild the URL and append query variables to the URL query by using this function. + * There are two ways to use this function; either a single key and value, or an associative array. + * + * Using a single key and value: + * + * add_query_arg( 'key', 'value', 'http://example.com' ); + * + * Using an associative array: + * + * add_query_arg( array( + * 'key1' => 'value1', + * 'key2' => 'value2', + * ), 'http://example.com' ); + * + * Omitting the URL from either use results in the current URL being used + * (the value of `$_SERVER['REQUEST_URI']`). + * + * Values are expected to be encoded appropriately with urlencode() or rawurlencode(). + * + * Setting any query variable's value to boolean false removes the key (see remove_query_arg()). + * + * Important: The return value of add_query_arg() is not escaped by default. Output should be + * late-escaped with esc_url() or similar to help prevent vulnerability to cross-site scripting + * (XSS) attacks. + * + * @since 1.5.0 + * @since 5.3.0 Formalized the existing and already documented parameters + * by adding `...$args` to the function signature. + * + * @param string|array $key Either a query variable key, or an associative array of query variables. + * @param string $value Optional. Either a query variable value, or a URL to act upon. + * @param string $url Optional. A URL to act upon. + * @return string New URL query string (unescaped). + */ + function add_query_arg(...$args) + { + } + /** + * Removes an item or items from a query string. + * + * Important: The return value of remove_query_arg() is not escaped by default. Output should be + * late-escaped with esc_url() or similar to help prevent vulnerability to cross-site scripting + * (XSS) attacks. + * + * @since 1.5.0 + * + * @param string|string[] $key Query key or keys to remove. + * @param false|string $query Optional. When false uses the current URL. Default false. + * @return string New URL query string. + */ + function remove_query_arg($key, $query = \false) + { + } + /** + * Returns an array of single-use query variable names that can be removed from a URL. + * + * @since 4.4.0 + * + * @return string[] An array of query variable names to remove from the URL. + */ + function wp_removable_query_args() + { + } + /** + * Walks the array while sanitizing the contents. + * + * @since 0.71 + * @since 5.5.0 Non-string values are left untouched. + * + * @param array $input_array Array to walk while sanitizing contents. + * @return array Sanitized $input_array. + */ + function add_magic_quotes($input_array) + { + } + /** + * HTTP request for URI to retrieve content. + * + * @since 1.5.1 + * + * @see wp_safe_remote_get() + * + * @param string $uri URI/URL of web page to retrieve. + * @return string|false HTTP content. False on failure. + */ + function wp_remote_fopen($uri) + { + } + /** + * Sets up the WordPress query. + * + * @since 2.0.0 + * + * @global WP $wp Current WordPress environment instance. + * @global WP_Query $wp_query WordPress Query object. + * @global WP_Query $wp_the_query Copy of the WordPress Query object. + * + * @param string|array $query_vars Default WP_Query arguments. + */ + function wp($query_vars = '') + { + } + /** + * Retrieves the description for the HTTP status. + * + * @since 2.3.0 + * @since 3.9.0 Added status codes 418, 428, 429, 431, and 511. + * @since 4.5.0 Added status codes 308, 421, and 451. + * @since 5.1.0 Added status code 103. + * @since 6.6.0 Added status code 425. + * + * @global array $wp_header_to_desc + * + * @param int $code HTTP status code. + * @return string Status description if found, an empty string otherwise. + */ + function get_status_header_desc($code) + { + } + /** + * Sets HTTP status header. + * + * @since 2.0.0 + * @since 4.4.0 Added the `$description` parameter. + * + * @see get_status_header_desc() + * + * @param int $code HTTP status code. + * @param string $description Optional. A custom description for the HTTP status. + * Defaults to the result of get_status_header_desc() for the given code. + * @phpstan-return void + */ + function status_header($code, $description = '') + { + } + /** + * Gets the HTTP header information to prevent caching. + * + * The several different headers cover the different ways cache prevention + * is handled by different browsers. + * + * @since 2.8.0 + * @since 6.3.0 The `Cache-Control` header for logged in users now includes the + * `no-store` and `private` directives. + * + * @return array The associative array of header names and field values. + */ + function wp_get_nocache_headers() + { + } + /** + * Sets the HTTP headers to prevent caching for the different browsers. + * + * Different browsers support different nocache headers, so several + * headers must be sent so that all of them get the point that no + * caching should occur. + * + * @since 2.0.0 + * + * @see wp_get_nocache_headers() + * @phpstan-return void + */ + function nocache_headers() + { + } + /** + * Sets the HTTP headers for caching for 10 days with JavaScript content type. + * + * @since 2.1.0 + */ + function cache_javascript_headers() + { + } + /** + * Retrieves the number of database queries during the WordPress execution. + * + * @since 2.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return int Number of database queries. + */ + function get_num_queries() + { + } + /** + * Determines whether input is yes or no. + * + * Must be 'y' to be true. + * + * @since 1.0.0 + * + * @param string $yn Character string containing either 'y' (yes) or 'n' (no). + * @return bool True if 'y', false on anything else. + */ + function bool_from_yn($yn) + { + } + /** + * Loads the feed template from the use of an action hook. + * + * If the feed action does not have a hook, then the function will die with a + * message telling the visitor that the feed is not valid. + * + * It is better to only have one hook for each feed. + * + * @since 2.1.0 + * + * @global WP_Query $wp_query WordPress Query object. + */ + function do_feed() + { + } + /** + * Loads the RDF RSS 0.91 Feed template. + * + * @since 2.1.0 + * + * @see load_template() + */ + function do_feed_rdf() + { + } + /** + * Loads the RSS 1.0 Feed Template. + * + * @since 2.1.0 + * + * @see load_template() + */ + function do_feed_rss() + { + } + /** + * Loads either the RSS2 comment feed or the RSS2 posts feed. + * + * @since 2.1.0 + * + * @see load_template() + * + * @param bool $for_comments True for the comment feed, false for normal feed. + */ + function do_feed_rss2($for_comments) + { + } + /** + * Loads either Atom comment feed or Atom posts feed. + * + * @since 2.1.0 + * + * @see load_template() + * + * @param bool $for_comments True for the comment feed, false for normal feed. + */ + function do_feed_atom($for_comments) + { + } + /** + * Displays the default robots.txt file content. + * + * @since 2.1.0 + * @since 5.3.0 Remove the "Disallow: /" output if search engine visibility is + * discouraged in favor of robots meta HTML tag via wp_robots_no_robots() + * filter callback. + */ + function do_robots() + { + } + /** + * Displays the favicon.ico file content. + * + * @since 5.4.0 + * @phpstan-return never + */ + function do_favicon() + { + } + /** + * Determines whether WordPress is already installed. + * + * The cache will be checked first. If you have a cache plugin, which saves + * the cache values, then this will work. If you use the default WordPress + * cache, and the database goes away, then you might have problems. + * + * Checks for the 'siteurl' option for whether WordPress is installed. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 2.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return bool Whether the site is already installed. + */ + function is_blog_installed() + { + } + /** + * Retrieves URL with nonce added to URL query. + * + * @since 2.0.4 + * + * @param string $actionurl URL to add nonce action. + * @param int|string $action Optional. Nonce action name. Default -1. + * @param string $name Optional. Nonce name. Default '_wpnonce'. + * @return string Escaped URL with nonce action added. + */ + function wp_nonce_url($actionurl, $action = -1, $name = '_wpnonce') + { + } + /** + * Retrieves or display nonce hidden field for forms. + * + * The nonce field is used to validate that the contents of the form came from + * the location on the current site and not somewhere else. The nonce does not + * offer absolute protection, but should protect against most cases. It is very + * important to use nonce field in forms. + * + * The $action and $name are optional, but if you want to have better security, + * it is strongly suggested to set those two parameters. It is easier to just + * call the function without any parameters, because validation of the nonce + * doesn't require any parameters, but since crackers know what the default is + * it won't be difficult for them to find a way around your nonce and cause + * damage. + * + * The input name will be whatever $name value you gave. The input value will be + * the nonce creation value. + * + * @since 2.0.4 + * + * @param int|string $action Optional. Action name. Default -1. + * @param string $name Optional. Nonce name. Default '_wpnonce'. + * @param bool $referer Optional. Whether to set the referer field for validation. Default true. + * @param bool $display Optional. Whether to display or return hidden form field. Default true. + * @return string Nonce field HTML markup. + */ + function wp_nonce_field($action = -1, $name = '_wpnonce', $referer = \true, $display = \true) + { + } + /** + * Retrieves or displays referer hidden field for forms. + * + * The referer link is the current Request URI from the server super global. The + * input name is '_wp_http_referer', in case you wanted to check manually. + * + * @since 2.0.4 + * + * @param bool $display Optional. Whether to echo or return the referer field. Default true. + * @return string Referer field HTML markup. + */ + function wp_referer_field($display = \true) + { + } + /** + * Retrieves or displays original referer hidden field for forms. + * + * The input name is '_wp_original_http_referer' and will be either the same + * value of wp_referer_field(), if that was posted already or it will be the + * current page, if it doesn't exist. + * + * @since 2.0.4 + * + * @param bool $display Optional. Whether to echo the original http referer. Default true. + * @param string $jump_back_to Optional. Can be 'previous' or page you want to jump back to. + * Default 'current'. + * @return string Original referer field. + */ + function wp_original_referer_field($display = \true, $jump_back_to = 'current') + { + } + /** + * Retrieves referer from '_wp_http_referer' or HTTP referer. + * + * If it's the same as the current request URL, will return false. + * + * @since 2.0.4 + * + * @return string|false Referer URL on success, false on failure. + */ + function wp_get_referer() + { + } + /** + * Retrieves unvalidated referer from the '_wp_http_referer' URL query variable or the HTTP referer. + * + * If the value of the '_wp_http_referer' URL query variable is not a string then it will be ignored. + * + * Do not use for redirects, use wp_get_referer() instead. + * + * @since 4.5.0 + * + * @return string|false Referer URL on success, false on failure. + */ + function wp_get_raw_referer() + { + } + /** + * Retrieves original referer that was posted, if it exists. + * + * @since 2.0.4 + * + * @return string|false Original referer URL on success, false on failure. + */ + function wp_get_original_referer() + { + } + /** + * Recursive directory creation based on full path. + * + * Will attempt to set permissions on folders. + * + * @since 2.0.1 + * + * @param string $target Full path to attempt to create. + * @return bool Whether the path was created. True if path already exists. + */ + function wp_mkdir_p($target) + { + } + /** + * Tests if a given filesystem path is absolute. + * + * For example, '/foo/bar', or 'c:\windows'. + * + * @since 2.5.0 + * + * @param string $path File path. + * @return bool True if path is absolute, false is not absolute. + */ + function path_is_absolute($path) + { + } + /** + * Joins two filesystem paths together. + * + * For example, 'give me $path relative to $base'. If the $path is absolute, + * then it the full path is returned. + * + * @since 2.5.0 + * + * @param string $base Base path. + * @param string $path Path relative to $base. + * @return string The path with the base or absolute path. + */ + function path_join($base, $path) + { + } + /** + * Normalizes a filesystem path. + * + * On windows systems, replaces backslashes with forward slashes + * and forces upper-case drive letters. + * Allows for two leading slashes for Windows network shares, but + * ensures that all other duplicate slashes are reduced to a single. + * + * @since 3.9.0 + * @since 4.4.0 Ensures upper-case drive letters on Windows systems. + * @since 4.5.0 Allows for Windows network shares. + * @since 4.9.7 Allows for PHP file wrappers. + * + * @param string $path Path to normalize. + * @return string Normalized path. + */ + function wp_normalize_path($path) + { + } + /** + * Determines a writable directory for temporary files. + * + * Function's preference is the return value of sys_get_temp_dir(), + * followed by your PHP temporary upload directory, followed by WP_CONTENT_DIR, + * before finally defaulting to /tmp/ + * + * In the event that this function does not find a writable location, + * It may be overridden by the WP_TEMP_DIR constant in your wp-config.php file. + * + * @since 2.5.0 + * + * @return string Writable temporary directory. + */ + function get_temp_dir() + { + } + /** + * Determines if a directory is writable. + * + * This function is used to work around certain ACL issues in PHP primarily + * affecting Windows Servers. + * + * @since 3.6.0 + * + * @see win_is_writable() + * + * @param string $path Path to check for write-ability. + * @return bool Whether the path is writable. + */ + function wp_is_writable($path) + { + } + /** + * Workaround for Windows bug in is_writable() function + * + * PHP has issues with Windows ACL's for determine if a + * directory is writable or not, this works around them by + * checking the ability to open files rather than relying + * upon PHP to interpret the OS ACL. + * + * @since 2.8.0 + * + * @see https://bugs.php.net/bug.php?id=27609 + * @see https://bugs.php.net/bug.php?id=30931 + * + * @param string $path Windows path to check for write-ability. + * @return bool Whether the path is writable. + */ + function win_is_writable($path) + { + } + /** + * Retrieves uploads directory information. + * + * Same as wp_upload_dir() but "light weight" as it doesn't attempt to create the uploads directory. + * Intended for use in themes, when only 'basedir' and 'baseurl' are needed, generally in all cases + * when not uploading files. + * + * @since 4.5.0 + * + * @see wp_upload_dir() + * + * @return array See wp_upload_dir() for description. + */ + function wp_get_upload_dir() + { + } + /** + * Returns an array containing the current upload directory's path and URL. + * + * Checks the 'upload_path' option, which should be from the web root folder, + * and if it isn't empty it will be used. If it is empty, then the path will be + * 'WP_CONTENT_DIR/uploads'. If the 'UPLOADS' constant is defined, then it will + * override the 'upload_path' option and 'WP_CONTENT_DIR/uploads' path. + * + * The upload URL path is set either by the 'upload_url_path' option or by using + * the 'WP_CONTENT_URL' constant and appending '/uploads' to the path. + * + * If the 'uploads_use_yearmonth_folders' is set to true (checkbox if checked in + * the administration settings panel), then the time will be used. The format + * will be year first and then month. + * + * If the path couldn't be created, then an error will be returned with the key + * 'error' containing the error message. The error suggests that the parent + * directory is not writable by the server. + * + * @since 2.0.0 + * @uses _wp_upload_dir() + * + * @param string|null $time Optional. Time formatted in 'yyyy/mm'. Default null. + * @param bool $create_dir Optional. Whether to check and create the uploads directory. + * Default true for backward compatibility. + * @param bool $refresh_cache Optional. Whether to refresh the cache. Default false. + * @return array { + * Array of information about the upload directory. + * + * @type string $path Base directory and subdirectory or full path to upload directory. + * @type string $url Base URL and subdirectory or absolute URL to upload directory. + * @type string $subdir Subdirectory if uploads use year/month folders option is on. + * @type string $basedir Path without subdir. + * @type string $baseurl URL path without subdir. + * @type string|false $error False or error message. + * } + * @phpstan-return array{ + * path: string, + * url: string, + * subdir: string, + * basedir: string, + * baseurl: string, + * error: string|false, + * } + */ + function wp_upload_dir($time = \null, $create_dir = \true, $refresh_cache = \false) + { + } + /** + * A non-filtered, non-cached version of wp_upload_dir() that doesn't check the path. + * + * @since 4.5.0 + * @access private + * + * @param string|null $time Optional. Time formatted in 'yyyy/mm'. Default null. + * @return array See wp_upload_dir() + */ + function _wp_upload_dir($time = \null) + { + } + /** + * Gets a filename that is sanitized and unique for the given directory. + * + * If the filename is not unique, then a number will be added to the filename + * before the extension, and will continue adding numbers until the filename + * is unique. + * + * The callback function allows the caller to use their own method to create + * unique file names. If defined, the callback should take three arguments: + * - directory, base filename, and extension - and return a unique filename. + * + * @since 2.5.0 + * + * @param string $dir Directory. + * @param string $filename File name. + * @param callable $unique_filename_callback Callback. Default null. + * @return string New filename, if given wasn't unique. + */ + function wp_unique_filename($dir, $filename, $unique_filename_callback = \null) + { + } + /** + * Helper function to test if each of an array of file names could conflict with existing files. + * + * @since 5.8.1 + * @access private + * + * @param string[] $filenames Array of file names to check. + * @param string $dir The directory containing the files. + * @param array $files An array of existing files in the directory. May be empty. + * @return bool True if the tested file name could match an existing file, false otherwise. + */ + function _wp_check_alternate_file_names($filenames, $dir, $files) + { + } + /** + * Helper function to check if a file name could match an existing image sub-size file name. + * + * @since 5.3.1 + * @access private + * + * @param string $filename The file name to check. + * @param array $files An array of existing files in the directory. + * @return bool True if the tested file name could match an existing file, false otherwise. + */ + function _wp_check_existing_file_names($filename, $files) + { + } + /** + * Creates a file in the upload folder with given content. + * + * If there is an error, then the key 'error' will exist with the error message. + * If success, then the key 'file' will have the unique file path, the 'url' key + * will have the link to the new file. and the 'error' key will be set to false. + * + * This function will not move an uploaded file to the upload folder. It will + * create a new file with the content in $bits parameter. If you move the upload + * file, read the content of the uploaded file, and then you can give the + * filename and content to this function, which will add it to the upload + * folder. + * + * The permissions will be set on the new file automatically by this function. + * + * @since 2.0.0 + * + * @param string $name Filename. + * @param null|string $deprecated Never used. Set to null. + * @param string $bits File content + * @param string|null $time Optional. Time formatted in 'yyyy/mm'. Default null. + * @return array { + * Information about the newly-uploaded file. + * + * @type string $file Filename of the newly-uploaded file. + * @type string $url URL of the uploaded file. + * @type string $type File type. + * @type string|false $error Error message, if there has been an error. + * } + * @phpstan-return array{ + * file: string, + * url: string, + * type: string, + * error: string|false, + * } + */ + function wp_upload_bits($name, $deprecated, $bits, $time = \null) + { + } + /** + * Retrieves the file type based on the extension name. + * + * @since 2.5.0 + * + * @param string $ext The extension to search. + * @return string|void The file type, example: audio, video, document, spreadsheet, etc. + */ + function wp_ext2type($ext) + { + } + /** + * Returns first matched extension for the mime-type, + * as mapped from wp_get_mime_types(). + * + * @since 5.8.1 + * + * @param string $mime_type + * + * @return string|false + */ + function wp_get_default_extension_for_mime_type($mime_type) + { + } + /** + * Retrieves the file type from the file name. + * + * You can optionally define the mime array, if needed. + * + * @since 2.0.4 + * + * @param string $filename File name or path. + * @param string[]|null $mimes Optional. Array of allowed mime types keyed by their file extension regex. + * Defaults to the result of get_allowed_mime_types(). + * @return array { + * Values for the extension and mime type. + * + * @type string|false $ext File extension, or false if the file doesn't match a mime type. + * @type string|false $type File mime type, or false if the file doesn't match a mime type. + * } + * @phpstan-return array{ + * ext: string|false, + * type: string|false, + * } + */ + function wp_check_filetype($filename, $mimes = \null) + { + } + /** + * Attempts to determine the real file type of a file. + * + * If unable to, the file name extension will be used to determine type. + * + * If it's determined that the extension does not match the file's real type, + * then the "proper_filename" value will be set with a proper filename and extension. + * + * Currently this function only supports renaming images validated via wp_get_image_mime(). + * + * @since 3.0.0 + * + * @param string $file Full path to the file. + * @param string $filename The name of the file (may differ from $file due to $file being + * in a tmp directory). + * @param string[]|null $mimes Optional. Array of allowed mime types keyed by their file extension regex. + * Defaults to the result of get_allowed_mime_types(). + * @return array { + * Values for the extension, mime type, and corrected filename. + * + * @type string|false $ext File extension, or false if the file doesn't match a mime type. + * @type string|false $type File mime type, or false if the file doesn't match a mime type. + * @type string|false $proper_filename File name with its correct extension, or false if it cannot be determined. + * } + * @phpstan-return array{ + * ext: string|false, + * type: string|false, + * proper_filename: string|false, + * } + */ + function wp_check_filetype_and_ext($file, $filename, $mimes = \null) + { + } + /** + * Returns the real mime type of an image file. + * + * This depends on exif_imagetype() or getimagesize() to determine real mime types. + * + * @since 4.7.1 + * @since 5.8.0 Added support for WebP images. + * @since 6.5.0 Added support for AVIF images. + * + * @param string $file Full path to the file. + * @return string|false The actual mime type or false if the type cannot be determined. + */ + function wp_get_image_mime($file) + { + } + /** + * Retrieves the list of mime types and file extensions. + * + * @since 3.5.0 + * @since 4.2.0 Support was added for GIMP (.xcf) files. + * @since 4.9.2 Support was added for Flac (.flac) files. + * @since 4.9.6 Support was added for AAC (.aac) files. + * + * @return string[] Array of mime types keyed by the file extension regex corresponding to those types. + */ + function wp_get_mime_types() + { + } + /** + * Retrieves the list of common file extensions and their types. + * + * @since 4.6.0 + * + * @return array[] Multi-dimensional array of file extensions types keyed by the type of file. + */ + function wp_get_ext_types() + { + } + /** + * Wrapper for PHP filesize with filters and casting the result as an integer. + * + * @since 6.0.0 + * + * @link https://www.php.net/manual/en/function.filesize.php + * + * @param string $path Path to the file. + * @return int The size of the file in bytes, or 0 in the event of an error. + */ + function wp_filesize($path) + { + } + /** + * Retrieves the list of allowed mime types and file extensions. + * + * @since 2.8.6 + * + * @param int|WP_User $user Optional. User to check. Defaults to current user. + * @return string[] Array of mime types keyed by the file extension regex corresponding + * to those types. + */ + function get_allowed_mime_types($user = \null) + { + } + /** + * Displays "Are You Sure" message to confirm the action being taken. + * + * If the action has the nonce explain message, then it will be displayed + * along with the "Are you sure?" message. + * + * @since 2.0.4 + * + * @param string $action The nonce action. + */ + function wp_nonce_ays($action) + { + } + /** + * Kills WordPress execution and displays HTML page with an error message. + * + * This function complements the `die()` PHP function. The difference is that + * HTML will be displayed to the user. It is recommended to use this function + * only when the execution should not continue any further. It is not recommended + * to call this function very often, and try to handle as many errors as possible + * silently or more gracefully. + * + * As a shorthand, the desired HTTP response code may be passed as an integer to + * the `$title` parameter (the default title would apply) or the `$args` parameter. + * + * @since 2.0.4 + * @since 4.1.0 The `$title` and `$args` parameters were changed to optionally accept + * an integer to be used as the response code. + * @since 5.1.0 The `$link_url`, `$link_text`, and `$exit` arguments were added. + * @since 5.3.0 The `$charset` argument was added. + * @since 5.5.0 The `$text_direction` argument has a priority over get_language_attributes() + * in the default handler. + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param string|WP_Error $message Optional. Error message. If this is a WP_Error object, + * and not an Ajax or XML-RPC request, the error's messages are used. + * Default empty string. + * @param string|int $title Optional. Error title. If `$message` is a `WP_Error` object, + * error data with the key 'title' may be used to specify the title. + * If `$title` is an integer, then it is treated as the response code. + * Default empty string. + * @param string|array|int $args { + * Optional. Arguments to control behavior. If `$args` is an integer, then it is treated + * as the response code. Default empty array. + * + * @type int $response The HTTP response code. Default 200 for Ajax requests, 500 otherwise. + * @type string $link_url A URL to include a link to. Only works in combination with $link_text. + * Default empty string. + * @type string $link_text A label for the link to include. Only works in combination with $link_url. + * Default empty string. + * @type bool $back_link Whether to include a link to go back. Default false. + * @type string $text_direction The text direction. This is only useful internally, when WordPress is still + * loading and the site's locale is not set up yet. Accepts 'rtl' and 'ltr'. + * Default is the value of is_rtl(). + * @type string $charset Character set of the HTML output. Default 'utf-8'. + * @type string $code Error code to use. Default is 'wp_die', or the main error code if $message + * is a WP_Error. + * @type bool $exit Whether to exit the process after completion. Default true. + * } + * @phpstan-param int|array{ + * response?: int, + * link_url?: string, + * link_text?: string, + * back_link?: bool, + * text_direction?: string, + * charset?: string, + * code?: string, + * exit?: bool, + * } $args + */ + function wp_die($message = '', $title = '', $args = array()) + { + } + /** + * Kills WordPress execution and displays HTML page with an error message. + * + * This is the default handler for wp_die(). If you want a custom one, + * you can override this using the {@see 'wp_die_handler'} filter in wp_die(). + * + * @since 3.0.0 + * @access private + * + * @param string|WP_Error $message Error message or WP_Error object. + * @param string $title Optional. Error title. Default empty string. + * @param string|array $args Optional. Arguments to control behavior. Default empty array. + */ + function _default_wp_die_handler($message, $title = '', $args = array()) + { + } + /** + * Kills WordPress execution and displays Ajax response with an error message. + * + * This is the handler for wp_die() when processing Ajax requests. + * + * @since 3.4.0 + * @access private + * + * @param string $message Error message. + * @param string $title Optional. Error title (unused). Default empty string. + * @param string|array $args Optional. Arguments to control behavior. Default empty array. + */ + function _ajax_wp_die_handler($message, $title = '', $args = array()) + { + } + /** + * Kills WordPress execution and displays JSON response with an error message. + * + * This is the handler for wp_die() when processing JSON requests. + * + * @since 5.1.0 + * @access private + * + * @param string $message Error message. + * @param string $title Optional. Error title. Default empty string. + * @param string|array $args Optional. Arguments to control behavior. Default empty array. + */ + function _json_wp_die_handler($message, $title = '', $args = array()) + { + } + /** + * Kills WordPress execution and displays JSONP response with an error message. + * + * This is the handler for wp_die() when processing JSONP requests. + * + * @since 5.2.0 + * @access private + * + * @param string $message Error message. + * @param string $title Optional. Error title. Default empty string. + * @param string|array $args Optional. Arguments to control behavior. Default empty array. + */ + function _jsonp_wp_die_handler($message, $title = '', $args = array()) + { + } + /** + * Kills WordPress execution and displays XML response with an error message. + * + * This is the handler for wp_die() when processing XMLRPC requests. + * + * @since 3.2.0 + * @access private + * + * @global wp_xmlrpc_server $wp_xmlrpc_server + * + * @param string $message Error message. + * @param string $title Optional. Error title. Default empty string. + * @param string|array $args Optional. Arguments to control behavior. Default empty array. + */ + function _xmlrpc_wp_die_handler($message, $title = '', $args = array()) + { + } + /** + * Kills WordPress execution and displays XML response with an error message. + * + * This is the handler for wp_die() when processing XML requests. + * + * @since 5.2.0 + * @access private + * + * @param string $message Error message. + * @param string $title Optional. Error title. Default empty string. + * @param string|array $args Optional. Arguments to control behavior. Default empty array. + */ + function _xml_wp_die_handler($message, $title = '', $args = array()) + { + } + /** + * Kills WordPress execution and displays an error message. + * + * This is the handler for wp_die() when processing APP requests. + * + * @since 3.4.0 + * @since 5.1.0 Added the $title and $args parameters. + * @access private + * + * @param string $message Optional. Response to print. Default empty string. + * @param string $title Optional. Error title (unused). Default empty string. + * @param string|array $args Optional. Arguments to control behavior. Default empty array. + */ + function _scalar_wp_die_handler($message = '', $title = '', $args = array()) + { + } + /** + * Processes arguments passed to wp_die() consistently for its handlers. + * + * @since 5.1.0 + * @access private + * + * @param string|WP_Error $message Error message or WP_Error object. + * @param string $title Optional. Error title. Default empty string. + * @param string|array $args Optional. Arguments to control behavior. Default empty array. + * @return array { + * Processed arguments. + * + * @type string $0 Error message. + * @type string $1 Error title. + * @type array $2 Arguments to control behavior. + * } + * @phpstan-return array{ + * 0: string, + * 1: string, + * 2: array, + * } + */ + function _wp_die_process_input($message, $title = '', $args = array()) + { + } + /** + * Encodes a variable into JSON, with some confidence checks. + * + * @since 4.1.0 + * @since 5.3.0 No longer handles support for PHP < 5.6. + * @since 6.5.0 The `$data` parameter has been renamed to `$value` and + * the `$options` parameter to `$flags` for parity with PHP. + * + * @param mixed $value Variable (usually an array or object) to encode as JSON. + * @param int $flags Optional. Options to be passed to json_encode(). Default 0. + * @param int $depth Optional. Maximum depth to walk through $value. Must be + * greater than 0. Default 512. + * @return string|false The JSON encoded string, or false if it cannot be encoded. + */ + function wp_json_encode($value, $flags = 0, $depth = 512) + { + } + /** + * Performs confidence checks on data that shall be encoded to JSON. + * + * @ignore + * @since 4.1.0 + * @access private + * + * @see wp_json_encode() + * + * @throws Exception If depth limit is reached. + * + * @param mixed $value Variable (usually an array or object) to encode as JSON. + * @param int $depth Maximum depth to walk through $value. Must be greater than 0. + * @return mixed The sanitized data that shall be encoded to JSON. + */ + function _wp_json_sanity_check($value, $depth) + { + } + /** + * Converts a string to UTF-8, so that it can be safely encoded to JSON. + * + * @ignore + * @since 4.1.0 + * @access private + * + * @see _wp_json_sanity_check() + * + * @param string $input_string The string which is to be converted. + * @return string The checked string. + */ + function _wp_json_convert_string($input_string) + { + } + /** + * Prepares response data to be serialized to JSON. + * + * This supports the JsonSerializable interface for PHP 5.2-5.3 as well. + * + * @ignore + * @since 4.4.0 + * @deprecated 5.3.0 This function is no longer needed as support for PHP 5.2-5.3 + * has been dropped. + * @access private + * + * @param mixed $value Native representation. + * @return bool|int|float|null|string|array Data ready for `json_encode()`. + */ + function _wp_json_prepare_data($value) + { + } + /** + * Sends a JSON response back to an Ajax request. + * + * @since 3.5.0 + * @since 4.7.0 The `$status_code` parameter was added. + * @since 5.6.0 The `$flags` parameter was added. + * + * @param mixed $response Variable (usually an array or object) to encode as JSON, + * then print and die. + * @param int $status_code Optional. The HTTP status code to output. Default null. + * @param int $flags Optional. Options to be passed to json_encode(). Default 0. + */ + function wp_send_json($response, $status_code = \null, $flags = 0) + { + } + /** + * Sends a JSON response back to an Ajax request, indicating success. + * + * @since 3.5.0 + * @since 4.7.0 The `$status_code` parameter was added. + * @since 5.6.0 The `$flags` parameter was added. + * + * @param mixed $value Optional. Data to encode as JSON, then print and die. Default null. + * @param int $status_code Optional. The HTTP status code to output. Default null. + * @param int $flags Optional. Options to be passed to json_encode(). Default 0. + * @phpstan-return never + */ + function wp_send_json_success($value = \null, $status_code = \null, $flags = 0) + { + } + /** + * Sends a JSON response back to an Ajax request, indicating failure. + * + * If the `$value` parameter is a WP_Error object, the errors + * within the object are processed and output as an array of error + * codes and corresponding messages. All other types are output + * without further processing. + * + * @since 3.5.0 + * @since 4.1.0 The `$value` parameter is now processed if a WP_Error object is passed in. + * @since 4.7.0 The `$status_code` parameter was added. + * @since 5.6.0 The `$flags` parameter was added. + * + * @param mixed $value Optional. Data to encode as JSON, then print and die. Default null. + * @param int $status_code Optional. The HTTP status code to output. Default null. + * @param int $flags Optional. Options to be passed to json_encode(). Default 0. + * @phpstan-return never + */ + function wp_send_json_error($value = \null, $status_code = \null, $flags = 0) + { + } + /** + * Checks that a JSONP callback is a valid JavaScript callback name. + * + * Only allows alphanumeric characters and the dot character in callback + * function names. This helps to mitigate XSS attacks caused by directly + * outputting user input. + * + * @since 4.6.0 + * + * @param string $callback Supplied JSONP callback function name. + * @return bool Whether the callback function name is valid. + */ + function wp_check_jsonp_callback($callback) + { + } + /** + * Reads and decodes a JSON file. + * + * @since 5.9.0 + * + * @param string $filename Path to the JSON file. + * @param array $options { + * Optional. Options to be used with `json_decode()`. + * + * @type bool $associative Optional. When `true`, JSON objects will be returned as associative arrays. + * When `false`, JSON objects will be returned as objects. Default false. + * } + * + * @return mixed Returns the value encoded in JSON in appropriate PHP type. + * `null` is returned if the file is not found, or its content can't be decoded. + * @phpstan-param array{ + * associative?: bool, + * } $options + */ + function wp_json_file_decode($filename, $options = array()) + { + } + /** + * Retrieves the WordPress home page URL. + * + * If the constant named 'WP_HOME' exists, then it will be used and returned + * by the function. This can be used to counter the redirection on your local + * development environment. + * + * @since 2.2.0 + * @access private + * + * @see WP_HOME + * + * @param string $url URL for the home location. + * @return string Homepage location. + */ + function _config_wp_home($url = '') + { + } + /** + * Retrieves the WordPress site URL. + * + * If the constant named 'WP_SITEURL' is defined, then the value in that + * constant will always be returned. This can be used for debugging a site + * on your localhost while not having to change the database to your URL. + * + * @since 2.2.0 + * @access private + * + * @see WP_SITEURL + * + * @param string $url URL to set the WordPress site location. + * @return string The WordPress site URL. + */ + function _config_wp_siteurl($url = '') + { + } + /** + * Deletes the fresh site option. + * + * @since 4.7.0 + * @access private + */ + function _delete_option_fresh_site() + { + } + /** + * Sets the localized direction for MCE plugin. + * + * Will only set the direction to 'rtl', if the WordPress locale has + * the text direction set to 'rtl'. + * + * Fills in the 'directionality' setting, enables the 'directionality' + * plugin, and adds the 'ltr' button to 'toolbar1', formerly + * 'theme_advanced_buttons1' array keys. These keys are then returned + * in the $mce_init (TinyMCE settings) array. + * + * @since 2.1.0 + * @access private + * + * @param array $mce_init MCE settings array. + * @return array Direction set for 'rtl', if needed by locale. + */ + function _mce_set_direction($mce_init) + { + } + /** + * Determines whether WordPress is currently serving a REST API request. + * + * The function relies on the 'REST_REQUEST' global. As such, it only returns true when an actual REST _request_ is + * being made. It does not return true when a REST endpoint is hit as part of another request, e.g. for preloading a + * REST response. See {@see wp_is_rest_endpoint()} for that purpose. + * + * This function should not be called until the {@see 'parse_request'} action, as the constant is only defined then, + * even for an actual REST request. + * + * @since 6.5.0 + * + * @return bool True if it's a WordPress REST API request, false otherwise. + */ + function wp_is_serving_rest_request() + { + } + /** + * Converts smiley code to the icon graphic file equivalent. + * + * You can turn off smilies, by going to the write setting screen and unchecking + * the box, or by setting 'use_smilies' option to false or removing the option. + * + * Plugins may override the default smiley list by setting the $wpsmiliestrans + * to an array, with the key the code the blogger types in and the value the + * image file. + * + * The $wp_smiliessearch global is for the regular expression and is set each + * time the function is called. + * + * The full list of smilies can be found in the function and won't be listed in + * the description. Probably should create a Codex page for it, so that it is + * available. + * + * @since 2.2.0 + * + * @global array $wpsmiliestrans + * @global array $wp_smiliessearch + * @phpstan-return void + */ + function smilies_init() + { + } + /** + * Merges user defined arguments into defaults array. + * + * This function is used throughout WordPress to allow for both string or array + * to be merged into another array. + * + * @since 2.2.0 + * @since 2.3.0 `$args` can now also be an object. + * + * @param string|array|object $args Value to merge with $defaults. + * @param array $defaults Optional. Array that serves as the defaults. + * Default empty array. + * @return array Merged user defined values with defaults. + */ + function wp_parse_args($args, $defaults = array()) + { + } + /** + * Converts a comma- or space-separated list of scalar values to an array. + * + * @since 5.1.0 + * + * @param array|string $input_list List of values. + * @return array Array of values. + */ + function wp_parse_list($input_list) + { + } + /** + * Cleans up an array, comma- or space-separated list of IDs. + * + * @since 3.0.0 + * @since 5.1.0 Refactored to use wp_parse_list(). + * + * @param array|string $input_list List of IDs. + * @return int[] Sanitized array of IDs. + */ + function wp_parse_id_list($input_list) + { + } + /** + * Cleans up an array, comma- or space-separated list of slugs. + * + * @since 4.7.0 + * @since 5.1.0 Refactored to use wp_parse_list(). + * + * @param array|string $input_list List of slugs. + * @return string[] Sanitized array of slugs. + */ + function wp_parse_slug_list($input_list) + { + } + /** + * Extracts a slice of an array, given a list of keys. + * + * @since 3.1.0 + * + * @param array $input_array The original array. + * @param array $keys The list of keys. + * @return array The array slice. + */ + function wp_array_slice_assoc($input_array, $keys) + { + } + /** + * Sorts the keys of an array alphabetically. + * + * The array is passed by reference so it doesn't get returned + * which mimics the behavior of `ksort()`. + * + * @since 6.0.0 + * + * @param array $input_array The array to sort, passed by reference. + */ + function wp_recursive_ksort(&$input_array) + { + } + /** + * Accesses an array in depth based on a path of keys. + * + * It is the PHP equivalent of JavaScript's `lodash.get()` and mirroring it may help other components + * retain some symmetry between client and server implementations. + * + * Example usage: + * + * $input_array = array( + * 'a' => array( + * 'b' => array( + * 'c' => 1, + * ), + * ), + * ); + * _wp_array_get( $input_array, array( 'a', 'b', 'c' ) ); + * + * @internal + * + * @since 5.6.0 + * @access private + * + * @param array $input_array An array from which we want to retrieve some information. + * @param array $path An array of keys describing the path with which to retrieve information. + * @param mixed $default_value Optional. The return value if the path does not exist within the array, + * or if `$input_array` or `$path` are not arrays. Default null. + * @return mixed The value from the path specified. + */ + function _wp_array_get($input_array, $path, $default_value = \null) + { + } + /** + * Sets an array in depth based on a path of keys. + * + * It is the PHP equivalent of JavaScript's `lodash.set()` and mirroring it may help other components + * retain some symmetry between client and server implementations. + * + * Example usage: + * + * $input_array = array(); + * _wp_array_set( $input_array, array( 'a', 'b', 'c', 1 ) ); + * + * $input_array becomes: + * array( + * 'a' => array( + * 'b' => array( + * 'c' => 1, + * ), + * ), + * ); + * + * @internal + * + * @since 5.8.0 + * @access private + * + * @param array $input_array An array that we want to mutate to include a specific value in a path. + * @param array $path An array of keys describing the path that we want to mutate. + * @param mixed $value The value that will be set. + * @phpstan-return void + */ + function _wp_array_set(&$input_array, $path, $value = \null) + { + } + /** + * This function is trying to replicate what + * lodash's kebabCase (JS library) does in the client. + * + * The reason we need this function is that we do some processing + * in both the client and the server (e.g.: we generate + * preset classes from preset slugs) that needs to + * create the same output. + * + * We can't remove or update the client's library due to backward compatibility + * (some of the output of lodash's kebabCase is saved in the post content). + * We have to make the server behave like the client. + * + * Changes to this function should follow updates in the client + * with the same logic. + * + * @link https://github.com/lodash/lodash/blob/4.17/dist/lodash.js#L14369 + * @link https://github.com/lodash/lodash/blob/4.17/dist/lodash.js#L278 + * @link https://github.com/lodash-php/lodash-php/blob/master/src/String/kebabCase.php + * @link https://github.com/lodash-php/lodash-php/blob/master/src/internal/unicodeWords.php + * + * @param string $input_string The string to kebab-case. + * + * @return string kebab-cased-string. + */ + function _wp_to_kebab_case($input_string) + { + } + /** + * Determines if the variable is a numeric-indexed array. + * + * @since 4.4.0 + * + * @param mixed $data Variable to check. + * @return bool Whether the variable is a list. + */ + function wp_is_numeric_array($data) + { + } + /** + * Filters a list of objects, based on a set of key => value arguments. + * + * Retrieves the objects from the list that match the given arguments. + * Key represents property name, and value represents property value. + * + * If an object has more properties than those specified in arguments, + * that will not disqualify it. When using the 'AND' operator, + * any missing properties will disqualify it. + * + * When using the `$field` argument, this function can also retrieve + * a particular field from all matching objects, whereas wp_list_filter() + * only does the filtering. + * + * @since 3.0.0 + * @since 4.7.0 Uses `WP_List_Util` class. + * + * @param array $input_list An array of objects to filter. + * @param array $args Optional. An array of key => value arguments to match + * against each object. Default empty array. + * @param string $operator Optional. The logical operation to perform. 'AND' means + * all elements from the array must match. 'OR' means only + * one element needs to match. 'NOT' means no elements may + * match. Default 'AND'. + * @param bool|string $field Optional. A field from the object to place instead + * of the entire object. Default false. + * @return array A list of objects or object fields. + */ + function wp_filter_object_list($input_list, $args = array(), $operator = 'and', $field = \false) + { + } + /** + * Filters a list of objects, based on a set of key => value arguments. + * + * Retrieves the objects from the list that match the given arguments. + * Key represents property name, and value represents property value. + * + * If an object has more properties than those specified in arguments, + * that will not disqualify it. When using the 'AND' operator, + * any missing properties will disqualify it. + * + * If you want to retrieve a particular field from all matching objects, + * use wp_filter_object_list() instead. + * + * @since 3.1.0 + * @since 4.7.0 Uses `WP_List_Util` class. + * @since 5.9.0 Converted into a wrapper for `wp_filter_object_list()`. + * + * @param array $input_list An array of objects to filter. + * @param array $args Optional. An array of key => value arguments to match + * against each object. Default empty array. + * @param string $operator Optional. The logical operation to perform. 'AND' means + * all elements from the array must match. 'OR' means only + * one element needs to match. 'NOT' means no elements may + * match. Default 'AND'. + * @return array Array of found values. + */ + function wp_list_filter($input_list, $args = array(), $operator = 'AND') + { + } + /** + * Plucks a certain field out of each object or array in an array. + * + * This has the same functionality and prototype of + * array_column() (PHP 5.5) but also supports objects. + * + * @since 3.1.0 + * @since 4.0.0 $index_key parameter added. + * @since 4.7.0 Uses `WP_List_Util` class. + * + * @param array $input_list List of objects or arrays. + * @param int|string $field Field from the object to place instead of the entire object. + * @param int|string $index_key Optional. Field from the object to use as keys for the new array. + * Default null. + * @return array Array of found values. If `$index_key` is set, an array of found values with keys + * corresponding to `$index_key`. If `$index_key` is null, array keys from the original + * `$input_list` will be preserved in the results. + */ + function wp_list_pluck($input_list, $field, $index_key = \null) + { + } + /** + * Sorts an array of objects or arrays based on one or more orderby arguments. + * + * @since 4.7.0 + * + * @param array $input_list An array of objects or arrays to sort. + * @param string|array $orderby Optional. Either the field name to order by or an array + * of multiple orderby fields as `$orderby => $order`. + * Default empty array. + * @param string $order Optional. Either 'ASC' or 'DESC'. Only used if `$orderby` + * is a string. Default 'ASC'. + * @param bool $preserve_keys Optional. Whether to preserve keys. Default false. + * @return array The sorted array. + * @phpstan-param 'ASC'|'DESC' $order + */ + function wp_list_sort($input_list, $orderby = array(), $order = 'ASC', $preserve_keys = \false) + { + } + /** + * Determines if Widgets library should be loaded. + * + * Checks to make sure that the widgets library hasn't already been loaded. + * If it hasn't, then it will load the widgets library and run an action hook. + * + * @since 2.2.0 + * @phpstan-return void + */ + function wp_maybe_load_widgets() + { + } + /** + * Appends the Widgets menu to the themes main menu. + * + * @since 2.2.0 + * @since 5.9.3 Don't specify menu order when the active theme is a block theme. + * + * @global array $submenu + * @phpstan-return void + */ + function wp_widgets_add_menu() + { + } + /** + * Flushes all output buffers for PHP 5.2. + * + * Make sure all output buffers are flushed before our singletons are destroyed. + * + * @since 2.2.0 + */ + function wp_ob_end_flush_all() + { + } + /** + * Loads custom DB error or display WordPress DB error. + * + * If a file exists in the wp-content directory named db-error.php, then it will + * be loaded instead of displaying the WordPress DB error. If it is not found, + * then the WordPress DB error will be displayed instead. + * + * The WordPress DB error sets the HTTP status header to 500 to try to prevent + * search engines from caching the message. Custom DB messages should do the + * same. + * + * This function was backported to WordPress 2.3.2, but originally was added + * in WordPress 2.5.0. + * + * @since 2.3.2 + * + * @global wpdb $wpdb WordPress database abstraction object. + * @phpstan-return never + */ + function dead_db() + { + } + /** + * Converts a value to non-negative integer. + * + * @since 2.5.0 + * + * @param mixed $maybeint Data you wish to have converted to a non-negative integer. + * @return int A non-negative integer. + */ + function absint($maybeint) + { + } + /** + * Marks a function as deprecated and inform when it has been used. + * + * There is a {@see 'deprecated_function_run'} hook that will be called that can be used + * to get the backtrace up to what file and function called the deprecated function. + * + * The current behavior is to trigger a user error if `WP_DEBUG` is true. + * + * This function is to be used in every function that is deprecated. + * + * @since 2.5.0 + * @since 5.4.0 This function is no longer marked as "private". + * @since 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE). + * + * @param string $function_name The function that was called. + * @param string $version The version of WordPress that deprecated the function. + * @param string $replacement Optional. The function that should have been called. Default empty string. + */ + function _deprecated_function($function_name, $version, $replacement = '') + { + } + /** + * Marks a constructor as deprecated and informs when it has been used. + * + * Similar to _deprecated_function(), but with different strings. Used to + * remove PHP4-style constructors. + * + * The current behavior is to trigger a user error if `WP_DEBUG` is true. + * + * This function is to be used in every PHP4-style constructor method that is deprecated. + * + * @since 4.3.0 + * @since 4.5.0 Added the `$parent_class` parameter. + * @since 5.4.0 This function is no longer marked as "private". + * @since 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE). + * + * @param string $class_name The class containing the deprecated constructor. + * @param string $version The version of WordPress that deprecated the function. + * @param string $parent_class Optional. The parent class calling the deprecated constructor. + * Default empty string. + */ + function _deprecated_constructor($class_name, $version, $parent_class = '') + { + } + /** + * Marks a class as deprecated and informs when it has been used. + * + * There is a {@see 'deprecated_class_run'} hook that will be called that can be used + * to get the backtrace up to what file and function called the deprecated class. + * + * The current behavior is to trigger a user error if `WP_DEBUG` is true. + * + * This function is to be used in the class constructor for every deprecated class. + * See {@see _deprecated_constructor()} for deprecating PHP4-style constructors. + * + * @since 6.4.0 + * + * @param string $class_name The name of the class being instantiated. + * @param string $version The version of WordPress that deprecated the class. + * @param string $replacement Optional. The class or function that should have been called. + * Default empty string. + */ + function _deprecated_class($class_name, $version, $replacement = '') + { + } + /** + * Marks a file as deprecated and inform when it has been used. + * + * There is a {@see 'deprecated_file_included'} hook that will be called that can be used + * to get the backtrace up to what file and function included the deprecated file. + * + * The current behavior is to trigger a user error if `WP_DEBUG` is true. + * + * This function is to be used in every file that is deprecated. + * + * @since 2.5.0 + * @since 5.4.0 This function is no longer marked as "private". + * @since 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE). + * + * @param string $file The file that was included. + * @param string $version The version of WordPress that deprecated the file. + * @param string $replacement Optional. The file that should have been included based on ABSPATH. + * Default empty string. + * @param string $message Optional. A message regarding the change. Default empty string. + */ + function _deprecated_file($file, $version, $replacement = '', $message = '') + { + } + /** + * Marks a function argument as deprecated and inform when it has been used. + * + * This function is to be used whenever a deprecated function argument is used. + * Before this function is called, the argument must be checked for whether it was + * used by comparing it to its default value or evaluating whether it is empty. + * + * For example: + * + * if ( ! empty( $deprecated ) ) { + * _deprecated_argument( __FUNCTION__, '3.0.0' ); + * } + * + * There is a {@see 'deprecated_argument_run'} hook that will be called that can be used + * to get the backtrace up to what file and function used the deprecated argument. + * + * The current behavior is to trigger a user error if WP_DEBUG is true. + * + * @since 3.0.0 + * @since 5.4.0 This function is no longer marked as "private". + * @since 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE). + * + * @param string $function_name The function that was called. + * @param string $version The version of WordPress that deprecated the argument used. + * @param string $message Optional. A message regarding the change. Default empty string. + */ + function _deprecated_argument($function_name, $version, $message = '') + { + } + /** + * Marks a deprecated action or filter hook as deprecated and throws a notice. + * + * Use the {@see 'deprecated_hook_run'} action to get the backtrace describing where + * the deprecated hook was called. + * + * Default behavior is to trigger a user error if `WP_DEBUG` is true. + * + * This function is called by the do_action_deprecated() and apply_filters_deprecated() + * functions, and so generally does not need to be called directly. + * + * @since 4.6.0 + * @since 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE). + * @access private + * + * @param string $hook The hook that was used. + * @param string $version The version of WordPress that deprecated the hook. + * @param string $replacement Optional. The hook that should have been used. Default empty string. + * @param string $message Optional. A message regarding the change. Default empty. + */ + function _deprecated_hook($hook, $version, $replacement = '', $message = '') + { + } + /** + * Marks something as being incorrectly called. + * + * There is a {@see 'doing_it_wrong_run'} hook that will be called that can be used + * to get the backtrace up to what file and function called the deprecated function. + * + * The current behavior is to trigger a user error if `WP_DEBUG` is true. + * + * @since 3.1.0 + * @since 5.4.0 This function is no longer marked as "private". + * + * @param string $function_name The function that was called. + * @param string $message A message explaining what has been done incorrectly. + * @param string $version The version of WordPress where the message was added. + */ + function _doing_it_wrong($function_name, $message, $version) + { + } + /** + * Generates a user-level error/warning/notice/deprecation message. + * + * Generates the message when `WP_DEBUG` is true. + * + * @since 6.4.0 + * + * @param string $function_name The function that triggered the error. + * @param string $message The message explaining the error. + * The message can contain allowed HTML 'a' (with href), 'code', + * 'br', 'em', and 'strong' tags and http or https protocols. + * If it contains other HTML tags or protocols, the message should be escaped + * before passing to this function to avoid being stripped {@see wp_kses()}. + * @param int $error_level Optional. The designated error type for this error. + * Only works with E_USER family of constants. Default E_USER_NOTICE. + * @phpstan-return void + */ + function wp_trigger_error($function_name, $message, $error_level = \E_USER_NOTICE) + { + } + /** + * Determines whether the server is running an earlier than 1.5.0 version of lighttpd. + * + * @since 2.5.0 + * + * @return bool Whether the server is running lighttpd < 1.5.0. + */ + function is_lighttpd_before_150() + { + } + /** + * Determines whether the specified module exist in the Apache config. + * + * @since 2.5.0 + * + * @global bool $is_apache + * + * @param string $mod The module, e.g. mod_rewrite. + * @param bool $default_value Optional. The default return value if the module is not found. Default false. + * @return bool Whether the specified module is loaded. + */ + function apache_mod_loaded($mod, $default_value = \false) + { + } + /** + * Checks if IIS 7+ supports pretty permalinks. + * + * @since 2.8.0 + * + * @global bool $is_iis7 + * + * @return bool Whether IIS7 supports permalinks. + */ + function iis7_supports_permalinks() + { + } + /** + * Validates a file name and path against an allowed set of rules. + * + * A return value of `1` means the file path contains directory traversal. + * + * A return value of `2` means the file path contains a Windows drive path. + * + * A return value of `3` means the file is not in the allowed files list. + * + * @since 1.2.0 + * + * @param string $file File path. + * @param string[] $allowed_files Optional. Array of allowed files. Default empty array. + * @return int 0 means nothing is wrong, greater than 0 means something was wrong. + */ + function validate_file($file, $allowed_files = array()) + { + } + /** + * Determines whether to force SSL used for the Administration Screens. + * + * @since 2.6.0 + * + * @param string|bool $force Optional. Whether to force SSL in admin screens. Default null. + * @return bool True if forced, false if not forced. + */ + function force_ssl_admin($force = \null) + { + } + /** + * Guesses the URL for the site. + * + * Will remove wp-admin links to retrieve only return URLs not in the wp-admin + * directory. + * + * @since 2.6.0 + * + * @return string The guessed URL. + */ + function wp_guess_url() + { + } + /** + * Temporarily suspends cache additions. + * + * Stops more data being added to the cache, but still allows cache retrieval. + * This is useful for actions, such as imports, when a lot of data would otherwise + * be almost uselessly added to the cache. + * + * Suspension lasts for a single page load at most. Remember to call this + * function again if you wish to re-enable cache adds earlier. + * + * @since 3.3.0 + * + * @param bool $suspend Optional. Suspends additions if true, re-enables them if false. + * Defaults to not changing the current setting. + * @return bool The current suspend setting. + */ + function wp_suspend_cache_addition($suspend = \null) + { + } + /** + * Suspends cache invalidation. + * + * Turns cache invalidation on and off. Useful during imports where you don't want to do + * invalidations every time a post is inserted. Callers must be sure that what they are + * doing won't lead to an inconsistent cache when invalidation is suspended. + * + * @since 2.7.0 + * + * @global bool $_wp_suspend_cache_invalidation + * + * @param bool $suspend Optional. Whether to suspend or enable cache invalidation. Default true. + * @return bool The current suspend setting. + */ + function wp_suspend_cache_invalidation($suspend = \true) + { + } + /** + * Determines whether a site is the main site of the current network. + * + * @since 3.0.0 + * @since 4.9.0 The `$network_id` parameter was added. + * + * @param int $site_id Optional. Site ID to test. Defaults to current site. + * @param int $network_id Optional. Network ID of the network to check for. + * Defaults to current network. + * @return bool True if $site_id is the main site of the network, or if not + * running Multisite. + */ + function is_main_site($site_id = \null, $network_id = \null) + { + } + /** + * Gets the main site ID. + * + * @since 4.9.0 + * + * @param int $network_id Optional. The ID of the network for which to get the main site. + * Defaults to the current network. + * @return int The ID of the main site. + */ + function get_main_site_id($network_id = \null) + { + } + /** + * Determines whether a network is the main network of the Multisite installation. + * + * @since 3.7.0 + * + * @param int $network_id Optional. Network ID to test. Defaults to current network. + * @return bool True if $network_id is the main network, or if not running Multisite. + */ + function is_main_network($network_id = \null) + { + } + /** + * Gets the main network ID. + * + * @since 4.3.0 + * + * @return int The ID of the main network. + */ + function get_main_network_id() + { + } + /** + * Determines whether site meta is enabled. + * + * This function checks whether the 'blogmeta' database table exists. The result is saved as + * a setting for the main network, making it essentially a global setting. Subsequent requests + * will refer to this setting instead of running the query. + * + * @since 5.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return bool True if site meta is supported, false otherwise. + */ + function is_site_meta_supported() + { + } + /** + * Modifies gmt_offset for smart timezone handling. + * + * Overrides the gmt_offset option if we have a timezone_string available. + * + * @since 2.8.0 + * + * @return float|false Timezone GMT offset, false otherwise. + */ + function wp_timezone_override_offset() + { + } + /** + * Sort-helper for timezones. + * + * @since 2.9.0 + * @access private + * + * @param array $a + * @param array $b + * @return int + */ + function _wp_timezone_choice_usort_callback($a, $b) + { + } + /** + * Gives a nicely-formatted list of timezone strings. + * + * @since 2.9.0 + * @since 4.7.0 Added the `$locale` parameter. + * + * @param string $selected_zone Selected timezone. + * @param string $locale Optional. Locale to load the timezones in. Default current site locale. + * @return string + */ + function wp_timezone_choice($selected_zone, $locale = \null) + { + } + /** + * Strips close comment and close php tags from file headers used by WP. + * + * @since 2.8.0 + * @access private + * + * @see https://core.trac.wordpress.org/ticket/8497 + * + * @param string $str Header comment to clean up. + * @return string + */ + function _cleanup_header_comment($str) + { + } + /** + * Permanently deletes comments or posts of any type that have held a status + * of 'trash' for the number of days defined in EMPTY_TRASH_DAYS. + * + * The default value of `EMPTY_TRASH_DAYS` is 30 (days). + * + * @since 2.9.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + */ + function wp_scheduled_delete() + { + } + /** + * Retrieves metadata from a file. + * + * Searches for metadata in the first 8 KB of a file, such as a plugin or theme. + * Each piece of metadata must be on its own line. Fields can not span multiple + * lines, the value will get cut at the end of the first line. + * + * If the file data is not within that first 8 KB, then the author should correct + * their plugin file and move the data headers to the top. + * + * @link https://codex.wordpress.org/File_Header + * + * @since 2.9.0 + * + * @param string $file Absolute path to the file. + * @param array $default_headers List of headers, in the format `array( 'HeaderKey' => 'Header Name' )`. + * @param string $context Optional. If specified adds filter hook {@see 'extra_$context_headers'}. + * Default empty string. + * @return string[] Array of file header values keyed by header name. + */ + function get_file_data($file, $default_headers, $context = '') + { + } + /** + * Returns true. + * + * Useful for returning true to filters easily. + * + * @since 3.0.0 + * + * @see __return_false() + * + * @return true True. + */ + function __return_true() + { + } + /** + * Returns false. + * + * Useful for returning false to filters easily. + * + * @since 3.0.0 + * + * @see __return_true() + * + * @return false False. + */ + function __return_false() + { + } + /** + * Returns 0. + * + * Useful for returning 0 to filters easily. + * + * @since 3.0.0 + * + * @return int 0. + */ + function __return_zero() + { + } + /** + * Returns an empty array. + * + * Useful for returning an empty array to filters easily. + * + * @since 3.0.0 + * + * @return array Empty array. + */ + function __return_empty_array() + { + } + /** + * Returns null. + * + * Useful for returning null to filters easily. + * + * @since 3.4.0 + * + * @return null Null value. + */ + function __return_null() + { + } + /** + * Returns an empty string. + * + * Useful for returning an empty string to filters easily. + * + * @since 3.7.0 + * + * @see __return_null() + * + * @return string Empty string. + */ + function __return_empty_string() + { + } + /** + * Sends a HTTP header to disable content type sniffing in browsers which support it. + * + * @since 3.0.0 + * + * @see https://blogs.msdn.com/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx + * @see https://src.chromium.org/viewvc/chrome?view=rev&revision=6985 + */ + function send_nosniff_header() + { + } + /** + * Returns a MySQL expression for selecting the week number based on the start_of_week option. + * + * @ignore + * @since 3.0.0 + * + * @param string $column Database column. + * @return string SQL clause. + */ + function _wp_mysql_week($column) + { + } + /** + * Finds hierarchy loops using a callback function that maps object IDs to parent IDs. + * + * @since 3.1.0 + * @access private + * + * @param callable $callback Function that accepts ( ID, $callback_args ) and outputs parent_ID. + * @param int $start The ID to start the loop check at. + * @param int $start_parent The parent_ID of $start to use instead of calling $callback( $start ). + * Use null to always use $callback. + * @param array $callback_args Optional. Additional arguments to send to $callback. Default empty array. + * @return array IDs of all members of loop. + */ + function wp_find_hierarchy_loop($callback, $start, $start_parent, $callback_args = array()) + { + } + /** + * Uses the "The Tortoise and the Hare" algorithm to detect loops. + * + * For every step of the algorithm, the hare takes two steps and the tortoise one. + * If the hare ever laps the tortoise, there must be a loop. + * + * @since 3.1.0 + * @access private + * + * @param callable $callback Function that accepts ( ID, callback_arg, ... ) and outputs parent_ID. + * @param int $start The ID to start the loop check at. + * @param array $override Optional. An array of ( ID => parent_ID, ... ) to use instead of $callback. + * Default empty array. + * @param array $callback_args Optional. Additional arguments to send to $callback. Default empty array. + * @param bool $_return_loop Optional. Return loop members or just detect presence of loop? Only set + * to true if you already know the given $start is part of a loop (otherwise + * the returned array might include branches). Default false. + * @return mixed Scalar ID of some arbitrary member of the loop, or array of IDs of all members of loop if + * $_return_loop + */ + function wp_find_hierarchy_loop_tortoise_hare($callback, $start, $override = array(), $callback_args = array(), $_return_loop = \false) + { + } + /** + * Sends a HTTP header to limit rendering of pages to same origin iframes. + * + * @since 3.1.3 + * + * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options + */ + function send_frame_options_header() + { + } + /** + * Retrieves a list of protocols to allow in HTML attributes. + * + * @since 3.3.0 + * @since 4.3.0 Added 'webcal' to the protocols array. + * @since 4.7.0 Added 'urn' to the protocols array. + * @since 5.3.0 Added 'sms' to the protocols array. + * @since 5.6.0 Added 'irc6' and 'ircs' to the protocols array. + * + * @see wp_kses() + * @see esc_url() + * + * @return string[] Array of allowed protocols. Defaults to an array containing 'http', 'https', + * 'ftp', 'ftps', 'mailto', 'news', 'irc', 'irc6', 'ircs', 'gopher', 'nntp', 'feed', + * 'telnet', 'mms', 'rtsp', 'sms', 'svn', 'tel', 'fax', 'xmpp', 'webcal', and 'urn'. + * This covers all common link protocols, except for 'javascript' which should not + * be allowed for untrusted users. + */ + function wp_allowed_protocols() + { + } + /** + * Returns a comma-separated string or array of functions that have been called to get + * to the current point in code. + * + * @since 3.4.0 + * + * @see https://core.trac.wordpress.org/ticket/19589 + * + * @param string $ignore_class Optional. A class to ignore all function calls within - useful + * when you want to just give info about the callee. Default null. + * @param int $skip_frames Optional. A number of stack frames to skip - useful for unwinding + * back to the source of the issue. Default 0. + * @param bool $pretty Optional. Whether you want a comma separated string instead of + * the raw array returned. Default true. + * @return string|array Either a string containing a reversed comma separated trace or an array + * of individual calls. + * @phpstan-return ($pretty is true ? string : list<string>) + */ + function wp_debug_backtrace_summary($ignore_class = \null, $skip_frames = 0, $pretty = \true) + { + } + /** + * Retrieves IDs that are not already present in the cache. + * + * @since 3.4.0 + * @since 6.1.0 This function is no longer marked as "private". + * + * @param int[] $object_ids Array of IDs. + * @param string $cache_group The cache group to check against. + * @return int[] Array of IDs not present in the cache. + */ + function _get_non_cached_ids($object_ids, $cache_group) + { + } + /** + * Checks whether the given cache ID is either an integer or an integer-like string. + * + * Both `16` and `"16"` are considered valid, other numeric types and numeric strings + * (`16.3` and `"16.3"`) are considered invalid. + * + * @since 6.3.0 + * + * @param mixed $object_id The cache ID to validate. + * @return bool Whether the given $object_id is a valid cache ID. + */ + function _validate_cache_id($object_id) + { + } + /** + * Tests if the current device has the capability to upload files. + * + * @since 3.4.0 + * @access private + * + * @return bool Whether the device is able to upload files. + */ + function _device_can_upload() + { + } + /** + * Tests if a given path is a stream URL + * + * @since 3.5.0 + * + * @param string $path The resource path or URL. + * @return bool True if the path is a stream URL. + */ + function wp_is_stream($path) + { + } + /** + * Tests if the supplied date is valid for the Gregorian calendar. + * + * @since 3.5.0 + * + * @link https://www.php.net/manual/en/function.checkdate.php + * + * @param int $month Month number. + * @param int $day Day number. + * @param int $year Year number. + * @param string $source_date The date to filter. + * @return bool True if valid date, false if not valid date. + */ + function wp_checkdate($month, $day, $year, $source_date) + { + } + /** + * Loads the auth check for monitoring whether the user is still logged in. + * + * Can be disabled with remove_action( 'admin_enqueue_scripts', 'wp_auth_check_load' ); + * + * This is disabled for certain screens where a login screen could cause an + * inconvenient interruption. A filter called {@see 'wp_auth_check_load'} can be used + * for fine-grained control. + * + * @since 3.6.0 + * @phpstan-return void + */ + function wp_auth_check_load() + { + } + /** + * Outputs the HTML that shows the wp-login dialog when the user is no longer logged in. + * + * @since 3.6.0 + */ + function wp_auth_check_html() + { + } + /** + * Checks whether a user is still logged in, for the heartbeat. + * + * Send a result that shows a log-in box if the user is no longer logged in, + * or if their cookie is within the grace period. + * + * @since 3.6.0 + * + * @global int $login_grace_period + * + * @param array $response The Heartbeat response. + * @return array The Heartbeat response with 'wp-auth-check' value set. + */ + function wp_auth_check($response) + { + } + /** + * Returns RegEx body to liberally match an opening HTML tag. + * + * Matches an opening HTML tag that: + * 1. Is self-closing or + * 2. Has no body but has a closing tag of the same name or + * 3. Contains a body and a closing tag of the same name + * + * Note: this RegEx does not balance inner tags and does not attempt + * to produce valid HTML + * + * @since 3.6.0 + * + * @param string $tag An HTML tag name. Example: 'video'. + * @return string Tag RegEx. + */ + function get_tag_regex($tag) + { + } + /** + * Indicates if a given slug for a character set represents the UTF-8 + * text encoding. If not provided, examines the current blog's charset. + * + * A charset is considered to represent UTF-8 if it is a case-insensitive + * match of "UTF-8" with or without the hyphen. + * + * Example: + * + * true === is_utf8_charset( 'UTF-8' ); + * true === is_utf8_charset( 'utf8' ); + * false === is_utf8_charset( 'latin1' ); + * false === is_utf8_charset( 'UTF 8' ); + * + * // Only strings match. + * false === is_utf8_charset( [ 'charset' => 'utf-8' ] ); + * + * // Without a given charset, it depends on the site option "blog_charset". + * $is_utf8 = is_utf8_charset(); + * + * @since 6.6.0 + * + * @param ?string $blog_charset Slug representing a text character encoding, or "charset". + * E.g. "UTF-8", "Windows-1252", "ISO-8859-1", "SJIS". + * @return bool Whether the slug represents the UTF-8 encoding. + */ + function is_utf8_charset($blog_charset = \null) + { + } + /** + * Retrieves a canonical form of the provided charset appropriate for passing to PHP + * functions such as htmlspecialchars() and charset HTML attributes. + * + * @since 3.6.0 + * @access private + * + * @see https://core.trac.wordpress.org/ticket/23688 + * + * @param string $charset A charset name, e.g. "UTF-8", "Windows-1252", "SJIS". + * @return string The canonical form of the charset. + */ + function _canonical_charset($charset) + { + } + /** + * Sets the mbstring internal encoding to a binary safe encoding when func_overload + * is enabled. + * + * When mbstring.func_overload is in use for multi-byte encodings, the results from + * strlen() and similar functions respect the utf8 characters, causing binary data + * to return incorrect lengths. + * + * This function overrides the mbstring encoding to a binary-safe encoding, and + * resets it to the users expected encoding afterwards through the + * `reset_mbstring_encoding` function. + * + * It is safe to recursively call this function, however each + * `mbstring_binary_safe_encoding()` call must be followed up with an equal number + * of `reset_mbstring_encoding()` calls. + * + * @since 3.7.0 + * + * @see reset_mbstring_encoding() + * + * @param bool $reset Optional. Whether to reset the encoding back to a previously-set encoding. + * Default false. + * @phpstan-return void + */ + function mbstring_binary_safe_encoding($reset = \false) + { + } + /** + * Resets the mbstring internal encoding to a users previously set encoding. + * + * @see mbstring_binary_safe_encoding() + * + * @since 3.7.0 + */ + function reset_mbstring_encoding() + { + } + /** + * Filters/validates a variable as a boolean. + * + * Alternative to `filter_var( $value, FILTER_VALIDATE_BOOLEAN )`. + * + * @since 4.0.0 + * + * @param mixed $value Boolean value to validate. + * @return bool Whether the value is validated. + */ + function wp_validate_boolean($value) + { + } + /** + * Deletes a file. + * + * @since 4.2.0 + * + * @param string $file The path to the file to delete. + */ + function wp_delete_file($file) + { + } + /** + * Deletes a file if its path is within the given directory. + * + * @since 4.9.7 + * + * @param string $file Absolute path to the file to delete. + * @param string $directory Absolute path to a directory. + * @return bool True on success, false on failure. + */ + function wp_delete_file_from_directory($file, $directory) + { + } + /** + * Outputs a small JS snippet on preview tabs/windows to remove `window.name` when a user is navigating to another page. + * + * This prevents reusing the same tab for a preview when the user has navigated away. + * + * @since 4.3.0 + * + * @global WP_Post $post Global post object. + * @phpstan-return void + */ + function wp_post_preview_js() + { + } + /** + * Parses and formats a MySQL datetime (Y-m-d H:i:s) for ISO8601 (Y-m-d\TH:i:s). + * + * Explicitly strips timezones, as datetimes are not saved with any timezone + * information. Including any information on the offset could be misleading. + * + * Despite historical function name, the output does not conform to RFC3339 format, + * which must contain timezone. + * + * @since 4.4.0 + * + * @param string $date_string Date string to parse and format. + * @return string Date formatted for ISO8601 without time zone. + */ + function mysql_to_rfc3339($date_string) + { + } + /** + * Attempts to raise the PHP memory limit for memory intensive processes. + * + * Only allows raising the existing limit and prevents lowering it. + * + * @since 4.6.0 + * + * @param string $context Optional. Context in which the function is called. Accepts either 'admin', + * 'image', 'cron', or an arbitrary other context. If an arbitrary context is passed, + * the similarly arbitrary {@see '$context_memory_limit'} filter will be + * invoked. Default 'admin'. + * @return int|string|false The limit that was set or false on failure. + */ + function wp_raise_memory_limit($context = 'admin') + { + } + /** + * Generates a random UUID (version 4). + * + * @since 4.7.0 + * + * @return string UUID. + */ + function wp_generate_uuid4() + { + } + /** + * Validates that a UUID is valid. + * + * @since 4.9.0 + * + * @param mixed $uuid UUID to check. + * @param int $version Specify which version of UUID to check against. Default is none, + * to accept any UUID version. Otherwise, only version allowed is `4`. + * @return bool The string is a valid UUID or false on failure. + */ + function wp_is_uuid($uuid, $version = \null) + { + } + /** + * Gets unique ID. + * + * This is a PHP implementation of Underscore's uniqueId method. A static variable + * contains an integer that is incremented with each call. This number is returned + * with the optional prefix. As such the returned value is not universally unique, + * but it is unique across the life of the PHP process. + * + * @since 5.0.3 + * + * @param string $prefix Prefix for the returned ID. + * @return string Unique ID. + */ + function wp_unique_id($prefix = '') + { + } + /** + * Generates an incremental ID that is independent per each different prefix. + * + * It is similar to `wp_unique_id`, but each prefix has its own internal ID + * counter to make each prefix independent from each other. The ID starts at 1 + * and increments on each call. The returned value is not universally unique, + * but it is unique across the life of the PHP process and it's stable per + * prefix. + * + * @since 6.4.0 + * + * @param string $prefix Optional. Prefix for the returned ID. Default empty string. + * @return string Incremental ID per prefix. + */ + function wp_unique_prefixed_id($prefix = '') + { + } + /** + * Gets last changed date for the specified cache group. + * + * @since 4.7.0 + * + * @param string $group Where the cache contents are grouped. + * @return string UNIX timestamp with microseconds representing when the group was last changed. + */ + function wp_cache_get_last_changed($group) + { + } + /** + * Sets last changed date for the specified cache group to now. + * + * @since 6.3.0 + * + * @param string $group Where the cache contents are grouped. + * @return string UNIX timestamp when the group was last changed. + */ + function wp_cache_set_last_changed($group) + { + } + /** + * Sends an email to the old site admin email address when the site admin email address changes. + * + * @since 4.9.0 + * + * @param string $old_email The old site admin email address. + * @param string $new_email The new site admin email address. + * @param string $option_name The relevant database option name. + * @phpstan-return void + */ + function wp_site_admin_email_change_notification($old_email, $new_email, $option_name) + { + } + /** + * Returns an anonymized IPv4 or IPv6 address. + * + * @since 4.9.6 Abstracted from `WP_Community_Events::get_unsafe_client_ip()`. + * + * @param string $ip_addr The IPv4 or IPv6 address to be anonymized. + * @param bool $ipv6_fallback Optional. Whether to return the original IPv6 address if the needed functions + * to anonymize it are not present. Default false, return `::` (unspecified address). + * @return string The anonymized IP address. + */ + function wp_privacy_anonymize_ip($ip_addr, $ipv6_fallback = \false) + { + } + /** + * Returns uniform "anonymous" data by type. + * + * @since 4.9.6 + * + * @param string $type The type of data to be anonymized. + * @param string $data Optional. The data to be anonymized. Default empty string. + * @return string The anonymous data for the requested type. + */ + function wp_privacy_anonymize_data($type, $data = '') + { + } + /** + * Returns the directory used to store personal data export files. + * + * @since 4.9.6 + * + * @see wp_privacy_exports_url + * + * @return string Exports directory. + */ + function wp_privacy_exports_dir() + { + } + /** + * Returns the URL of the directory used to store personal data export files. + * + * @since 4.9.6 + * + * @see wp_privacy_exports_dir + * + * @return string Exports directory URL. + */ + function wp_privacy_exports_url() + { + } + /** + * Schedules a `WP_Cron` job to delete expired export files. + * + * @since 4.9.6 + * @phpstan-return void + */ + function wp_schedule_delete_old_privacy_export_files() + { + } + /** + * Cleans up export files older than three days old. + * + * The export files are stored in `wp-content/uploads`, and are therefore publicly + * accessible. A CSPRN is appended to the filename to mitigate the risk of an + * unauthorized person downloading the file, but it is still possible. Deleting + * the file after the data subject has had a chance to delete it adds an additional + * layer of protection. + * + * @since 4.9.6 + * @phpstan-return void + */ + function wp_privacy_delete_old_export_files() + { + } + /** + * Gets the URL to learn more about updating the PHP version the site is running on. + * + * This URL can be overridden by specifying an environment variable `WP_UPDATE_PHP_URL` or by using the + * {@see 'wp_update_php_url'} filter. Providing an empty string is not allowed and will result in the + * default URL being used. Furthermore the page the URL links to should preferably be localized in the + * site language. + * + * @since 5.1.0 + * + * @return string URL to learn more about updating PHP. + */ + function wp_get_update_php_url() + { + } + /** + * Gets the default URL to learn more about updating the PHP version the site is running on. + * + * Do not use this function to retrieve this URL. Instead, use {@see wp_get_update_php_url()} when relying on the URL. + * This function does not allow modifying the returned URL, and is only used to compare the actually used URL with the + * default one. + * + * @since 5.1.0 + * @access private + * + * @return string Default URL to learn more about updating PHP. + */ + function wp_get_default_update_php_url() + { + } + /** + * Prints the default annotation for the web host altering the "Update PHP" page URL. + * + * This function is to be used after {@see wp_get_update_php_url()} to display a consistent + * annotation if the web host has altered the default "Update PHP" page URL. + * + * @since 5.1.0 + * @since 5.2.0 Added the `$before` and `$after` parameters. + * @since 6.4.0 Added the `$display` parameter. + * + * @param string $before Markup to output before the annotation. Default `<p class="description">`. + * @param string $after Markup to output after the annotation. Default `</p>`. + * @param bool $display Whether to echo or return the markup. Default `true` for echo. + * + * @return string|void + */ + function wp_update_php_annotation($before = '<p class="description">', $after = '</p>', $display = \true) + { + } + /** + * Returns the default annotation for the web hosting altering the "Update PHP" page URL. + * + * This function is to be used after {@see wp_get_update_php_url()} to return a consistent + * annotation if the web host has altered the default "Update PHP" page URL. + * + * @since 5.2.0 + * + * @return string Update PHP page annotation. An empty string if no custom URLs are provided. + */ + function wp_get_update_php_annotation() + { + } + /** + * Gets the URL for directly updating the PHP version the site is running on. + * + * A URL will only be returned if the `WP_DIRECT_UPDATE_PHP_URL` environment variable is specified or + * by using the {@see 'wp_direct_php_update_url'} filter. This allows hosts to send users directly to + * the page where they can update PHP to a newer version. + * + * @since 5.1.1 + * + * @return string URL for directly updating PHP or empty string. + */ + function wp_get_direct_php_update_url() + { + } + /** + * Displays a button directly linking to a PHP update process. + * + * This provides hosts with a way for users to be sent directly to their PHP update process. + * + * The button is only displayed if a URL is returned by `wp_get_direct_php_update_url()`. + * + * @since 5.1.1 + * @phpstan-return void + */ + function wp_direct_php_update_button() + { + } + /** + * Gets the URL to learn more about updating the site to use HTTPS. + * + * This URL can be overridden by specifying an environment variable `WP_UPDATE_HTTPS_URL` or by using the + * {@see 'wp_update_https_url'} filter. Providing an empty string is not allowed and will result in the + * default URL being used. Furthermore the page the URL links to should preferably be localized in the + * site language. + * + * @since 5.7.0 + * + * @return string URL to learn more about updating to HTTPS. + */ + function wp_get_update_https_url() + { + } + /** + * Gets the default URL to learn more about updating the site to use HTTPS. + * + * Do not use this function to retrieve this URL. Instead, use {@see wp_get_update_https_url()} when relying on the URL. + * This function does not allow modifying the returned URL, and is only used to compare the actually used URL with the + * default one. + * + * @since 5.7.0 + * @access private + * + * @return string Default URL to learn more about updating to HTTPS. + */ + function wp_get_default_update_https_url() + { + } + /** + * Gets the URL for directly updating the site to use HTTPS. + * + * A URL will only be returned if the `WP_DIRECT_UPDATE_HTTPS_URL` environment variable is specified or + * by using the {@see 'wp_direct_update_https_url'} filter. This allows hosts to send users directly to + * the page where they can update their site to use HTTPS. + * + * @since 5.7.0 + * + * @return string URL for directly updating to HTTPS or empty string. + */ + function wp_get_direct_update_https_url() + { + } + /** + * Gets the size of a directory. + * + * A helper function that is used primarily to check whether + * a blog has exceeded its allowed upload space. + * + * @since MU (3.0.0) + * @since 5.2.0 $max_execution_time parameter added. + * + * @param string $directory Full path of a directory. + * @param int $max_execution_time Maximum time to run before giving up. In seconds. + * The timeout is global and is measured from the moment WordPress started to load. + * @return int|false|null Size in bytes if a valid directory. False if not. Null if timeout. + */ + function get_dirsize($directory, $max_execution_time = \null) + { + } + /** + * Gets the size of a directory recursively. + * + * Used by get_dirsize() to get a directory size when it contains other directories. + * + * @since MU (3.0.0) + * @since 4.3.0 The `$exclude` parameter was added. + * @since 5.2.0 The `$max_execution_time` parameter was added. + * @since 5.6.0 The `$directory_cache` parameter was added. + * + * @param string $directory Full path of a directory. + * @param string|string[] $exclude Optional. Full path of a subdirectory to exclude from the total, + * or array of paths. Expected without trailing slash(es). + * Default null. + * @param int $max_execution_time Optional. Maximum time to run before giving up. In seconds. + * The timeout is global and is measured from the moment + * WordPress started to load. Defaults to the value of + * `max_execution_time` PHP setting. + * @param array $directory_cache Optional. Array of cached directory paths. + * Defaults to the value of `dirsize_cache` transient. + * @return int|false|null Size in bytes if a valid directory. False if not. Null if timeout. + */ + function recurse_dirsize($directory, $exclude = \null, $max_execution_time = \null, &$directory_cache = \null) + { + } + /** + * Cleans directory size cache used by recurse_dirsize(). + * + * Removes the current directory and all parent directories from the `dirsize_cache` transient. + * + * @since 5.6.0 + * @since 5.9.0 Added input validation with a notice for invalid input. + * + * @param string $path Full path of a directory or file. + * @phpstan-return void + */ + function clean_dirsize_cache($path) + { + } + /** + * Checks compatibility with the current WordPress version. + * + * @since 5.2.0 + * + * @global string $wp_version The WordPress version string. + * + * @param string $required Minimum required WordPress version. + * @return bool True if required version is compatible or empty, false if not. + */ + function is_wp_version_compatible($required) + { + } + /** + * Checks compatibility with the current PHP version. + * + * @since 5.2.0 + * + * @param string $required Minimum required PHP version. + * @return bool True if required version is compatible or empty, false if not. + */ + function is_php_version_compatible($required) + { + } + /** + * Checks if two numbers are nearly the same. + * + * This is similar to using `round()` but the precision is more fine-grained. + * + * @since 5.3.0 + * + * @param int|float $expected The expected value. + * @param int|float $actual The actual number. + * @param int|float $precision Optional. The allowed variation. Default 1. + * @return bool Whether the numbers match within the specified precision. + */ + function wp_fuzzy_number_match($expected, $actual, $precision = 1) + { + } + /** + * Creates and returns the markup for an admin notice. + * + * @since 6.4.0 + * + * @param string $message The message. + * @param array $args { + * Optional. An array of arguments for the admin notice. Default empty array. + * + * @type string $type Optional. The type of admin notice. + * For example, 'error', 'success', 'warning', 'info'. + * Default empty string. + * @type bool $dismissible Optional. Whether the admin notice is dismissible. Default false. + * @type string $id Optional. The value of the admin notice's ID attribute. Default empty string. + * @type string[] $additional_classes Optional. A string array of class names. Default empty array. + * @type string[] $attributes Optional. Additional attributes for the notice div. Default empty array. + * @type bool $paragraph_wrap Optional. Whether to wrap the message in paragraph tags. Default true. + * } + * @return string The markup for an admin notice. + * @phpstan-param array{ + * type?: string, + * dismissible?: bool, + * id?: string, + * additional_classes?: string[], + * attributes?: string[], + * paragraph_wrap?: bool, + * } $args + */ + function wp_get_admin_notice($message, $args = array()) + { + } + /** + * Outputs an admin notice. + * + * @since 6.4.0 + * + * @param string $message The message to output. + * @param array $args { + * Optional. An array of arguments for the admin notice. Default empty array. + * + * @type string $type Optional. The type of admin notice. + * For example, 'error', 'success', 'warning', 'info'. + * Default empty string. + * @type bool $dismissible Optional. Whether the admin notice is dismissible. Default false. + * @type string $id Optional. The value of the admin notice's ID attribute. Default empty string. + * @type string[] $additional_classes Optional. A string array of class names. Default empty array. + * @type string[] $attributes Optional. Additional attributes for the notice div. Default empty array. + * @type bool $paragraph_wrap Optional. Whether to wrap the message in paragraph tags. Default true. + * } + * @phpstan-param array{ + * type?: string, + * dismissible?: bool, + * id?: string, + * additional_classes?: string[], + * attributes?: string[], + * paragraph_wrap?: bool, + * } $args + */ + function wp_admin_notice($message, $args = array()) + { + } + /** + * Dependencies API: Scripts functions + * + * @since 2.6.0 + * + * @package WordPress + * @subpackage Dependencies + */ + /** + * Initializes $wp_scripts if it has not been set. + * + * @since 4.2.0 + * + * @global WP_Scripts $wp_scripts + * + * @return WP_Scripts WP_Scripts instance. + */ + function wp_scripts() + { + } + /** + * Helper function to output a _doing_it_wrong message when applicable. + * + * @ignore + * @since 4.2.0 + * @since 5.5.0 Added the `$handle` parameter. + * + * @param string $function_name Function name. + * @param string $handle Optional. Name of the script or stylesheet that was + * registered or enqueued too early. Default empty. + * @phpstan-return void + */ + function _wp_scripts_maybe_doing_it_wrong($function_name, $handle = '') + { + } + /** + * Prints scripts in document head that are in the $handles queue. + * + * Called by admin-header.php and {@see 'wp_head'} hook. Since it is called by wp_head on every page load, + * the function does not instantiate the WP_Scripts object unless script names are explicitly passed. + * Makes use of already-instantiated `$wp_scripts` global if present. Use provided {@see 'wp_print_scripts'} + * hook to register/enqueue new scripts. + * + * @see WP_Scripts::do_item() + * @since 2.1.0 + * + * @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts. + * + * @param string|string[]|false $handles Optional. Scripts to be printed. Default 'false'. + * @return string[] On success, an array of handles of processed WP_Dependencies items; otherwise, an empty array. + */ + function wp_print_scripts($handles = \false) + { + } + /** + * Adds extra code to a registered script. + * + * Code will only be added if the script is already in the queue. + * Accepts a string `$data` containing the code. If two or more code blocks + * are added to the same script `$handle`, they will be printed in the order + * they were added, i.e. the latter added code can redeclare the previous. + * + * @since 4.5.0 + * + * @see WP_Scripts::add_inline_script() + * + * @param string $handle Name of the script to add the inline script to. + * @param string $data String containing the JavaScript to be added. + * @param string $position Optional. Whether to add the inline script before the handle + * or after. Default 'after'. + * @return bool True on success, false on failure. + */ + function wp_add_inline_script($handle, $data, $position = 'after') + { + } + /** + * Registers a new script. + * + * Registers a script to be enqueued later using the wp_enqueue_script() function. + * + * @see WP_Dependencies::add() + * @see WP_Dependencies::add_data() + * + * @since 2.1.0 + * @since 4.3.0 A return value was added. + * @since 6.3.0 The $in_footer parameter of type boolean was overloaded to be an $args parameter of type array. + * + * @param string $handle Name of the script. Should be unique. + * @param string|false $src Full URL of the script, or path of the script relative to the WordPress root directory. + * If source is set to false, script is an alias of other scripts it depends on. + * @param string[] $deps Optional. An array of registered script handles this script depends on. Default empty array. + * @param string|bool|null $ver Optional. String specifying script version number, if it has one, which is added to the URL + * as a query string for cache busting purposes. If version is set to false, a version + * number is automatically added equal to current installed WordPress version. + * If set to null, no version is added. + * @param array|bool $args { + * Optional. An array of additional script loading strategies. Default empty array. + * Otherwise, it may be a boolean in which case it determines whether the script is printed in the footer. Default false. + * + * @type string $strategy Optional. If provided, may be either 'defer' or 'async'. + * @type bool $in_footer Optional. Whether to print the script in the footer. Default 'false'. + * } + * @return bool Whether the script has been registered. True on success, false on failure. + * @phpstan-param bool|array{ + * strategy?: string, + * in_footer?: bool, + * } $args + */ + function wp_register_script($handle, $src, $deps = array(), $ver = \false, $args = array()) + { + } + /** + * Localizes a script. + * + * Works only if the script has already been registered. + * + * Accepts an associative array `$l10n` and creates a JavaScript object: + * + * "$object_name": { + * key: value, + * key: value, + * ... + * } + * + * @see WP_Scripts::localize() + * @link https://core.trac.wordpress.org/ticket/11520 + * + * @since 2.2.0 + * + * @todo Documentation cleanup + * + * @param string $handle Script handle the data will be attached to. + * @param string $object_name Name for the JavaScript object. Passed directly, so it should be qualified JS variable. + * Example: '/[a-zA-Z0-9_]+/'. + * @param array $l10n The data itself. The data can be either a single or multi-dimensional array. + * @return bool True if the script was successfully localized, false otherwise. + */ + function wp_localize_script($handle, $object_name, $l10n) + { + } + /** + * Sets translated strings for a script. + * + * Works only if the script has already been registered. + * + * @see WP_Scripts::set_translations() + * @since 5.0.0 + * @since 5.1.0 The `$domain` parameter was made optional. + * + * @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts. + * + * @param string $handle Script handle the textdomain will be attached to. + * @param string $domain Optional. Text domain. Default 'default'. + * @param string $path Optional. The full file path to the directory containing translation files. + * @return bool True if the text domain was successfully localized, false otherwise. + */ + function wp_set_script_translations($handle, $domain = 'default', $path = '') + { + } + /** + * Removes a registered script. + * + * Note: there are intentional safeguards in place to prevent critical admin scripts, + * such as jQuery core, from being unregistered. + * + * @see WP_Dependencies::remove() + * + * @since 2.1.0 + * + * @global string $pagenow The filename of the current screen. + * + * @param string $handle Name of the script to be removed. + * @phpstan-return void + */ + function wp_deregister_script($handle) + { + } + /** + * Enqueues a script. + * + * Registers the script if `$src` provided (does NOT overwrite), and enqueues it. + * + * @see WP_Dependencies::add() + * @see WP_Dependencies::add_data() + * @see WP_Dependencies::enqueue() + * + * @since 2.1.0 + * @since 6.3.0 The $in_footer parameter of type boolean was overloaded to be an $args parameter of type array. + * + * @param string $handle Name of the script. Should be unique. + * @param string $src Full URL of the script, or path of the script relative to the WordPress root directory. + * Default empty. + * @param string[] $deps Optional. An array of registered script handles this script depends on. Default empty array. + * @param string|bool|null $ver Optional. String specifying script version number, if it has one, which is added to the URL + * as a query string for cache busting purposes. If version is set to false, a version + * number is automatically added equal to current installed WordPress version. + * If set to null, no version is added. + * @param array|bool $args { + * Optional. An array of additional script loading strategies. Default empty array. + * Otherwise, it may be a boolean in which case it determines whether the script is printed in the footer. Default false. + * + * @type string $strategy Optional. If provided, may be either 'defer' or 'async'. + * @type bool $in_footer Optional. Whether to print the script in the footer. Default 'false'. + * } + * @phpstan-param bool|array{ + * strategy?: string, + * in_footer?: bool, + * } $args + */ + function wp_enqueue_script($handle, $src = '', $deps = array(), $ver = \false, $args = array()) + { + } + /** + * Removes a previously enqueued script. + * + * @see WP_Dependencies::dequeue() + * + * @since 3.1.0 + * + * @param string $handle Name of the script to be removed. + */ + function wp_dequeue_script($handle) + { + } + /** + * Determines whether a script has been added to the queue. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 2.8.0 + * @since 3.5.0 'enqueued' added as an alias of the 'queue' list. + * + * @param string $handle Name of the script. + * @param string $status Optional. Status of the script to check. Default 'enqueued'. + * Accepts 'enqueued', 'registered', 'queue', 'to_do', and 'done'. + * @return bool Whether the script is queued. + * @phpstan-param 'enqueued'|'registered'|'queue'|'to_do'|'done' $status + */ + function wp_script_is($handle, $status = 'enqueued') + { + } + /** + * Adds metadata to a script. + * + * Works only if the script has already been registered. + * + * Possible values for $key and $value: + * 'conditional' string Comments for IE 6, lte IE 7, etc. + * + * @since 4.2.0 + * + * @see WP_Dependencies::add_data() + * + * @param string $handle Name of the script. + * @param string $key Name of data point for which we're storing a value. + * @param mixed $value String containing the data to be added. + * @return bool True on success, false on failure. + */ + function wp_script_add_data($handle, $key, $value) + { + } + /** + * Dependencies API: Styles functions + * + * @since 2.6.0 + * + * @package WordPress + * @subpackage Dependencies + */ + /** + * Initializes $wp_styles if it has not been set. + * + * @since 4.2.0 + * + * @global WP_Styles $wp_styles + * + * @return WP_Styles WP_Styles instance. + */ + function wp_styles() + { + } + /** + * Displays styles that are in the $handles queue. + * + * Passing an empty array to $handles prints the queue, + * passing an array with one string prints that style, + * and passing an array of strings prints those styles. + * + * @since 2.6.0 + * + * @global WP_Styles $wp_styles The WP_Styles object for printing styles. + * + * @param string|bool|array $handles Styles to be printed. Default 'false'. + * @return string[] On success, an array of handles of processed WP_Dependencies items; otherwise, an empty array. + */ + function wp_print_styles($handles = \false) + { + } + /** + * Adds extra CSS styles to a registered stylesheet. + * + * Styles will only be added if the stylesheet is already in the queue. + * Accepts a string $data containing the CSS. If two or more CSS code blocks + * are added to the same stylesheet $handle, they will be printed in the order + * they were added, i.e. the latter added styles can redeclare the previous. + * + * @see WP_Styles::add_inline_style() + * + * @since 3.3.0 + * + * @param string $handle Name of the stylesheet to add the extra styles to. + * @param string $data String containing the CSS styles to be added. + * @return bool True on success, false on failure. + */ + function wp_add_inline_style($handle, $data) + { + } + /** + * Registers a CSS stylesheet. + * + * @see WP_Dependencies::add() + * @link https://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types. + * + * @since 2.6.0 + * @since 4.3.0 A return value was added. + * + * @param string $handle Name of the stylesheet. Should be unique. + * @param string|false $src Full URL of the stylesheet, or path of the stylesheet relative to the WordPress root directory. + * If source is set to false, stylesheet is an alias of other stylesheets it depends on. + * @param string[] $deps Optional. An array of registered stylesheet handles this stylesheet depends on. Default empty array. + * @param string|bool|null $ver Optional. String specifying stylesheet version number, if it has one, which is added to the URL + * as a query string for cache busting purposes. If version is set to false, a version + * number is automatically added equal to current installed WordPress version. + * If set to null, no version is added. + * @param string $media Optional. The media for which this stylesheet has been defined. + * Default 'all'. Accepts media types like 'all', 'print' and 'screen', or media queries like + * '(orientation: portrait)' and '(max-width: 640px)'. + * @return bool Whether the style has been registered. True on success, false on failure. + */ + function wp_register_style($handle, $src, $deps = array(), $ver = \false, $media = 'all') + { + } + /** + * Removes a registered stylesheet. + * + * @see WP_Dependencies::remove() + * + * @since 2.1.0 + * + * @param string $handle Name of the stylesheet to be removed. + */ + function wp_deregister_style($handle) + { + } + /** + * Enqueues a CSS stylesheet. + * + * Registers the style if source provided (does NOT overwrite) and enqueues. + * + * @see WP_Dependencies::add() + * @see WP_Dependencies::enqueue() + * @link https://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types. + * + * @since 2.6.0 + * + * @param string $handle Name of the stylesheet. Should be unique. + * @param string $src Full URL of the stylesheet, or path of the stylesheet relative to the WordPress root directory. + * Default empty. + * @param string[] $deps Optional. An array of registered stylesheet handles this stylesheet depends on. Default empty array. + * @param string|bool|null $ver Optional. String specifying stylesheet version number, if it has one, which is added to the URL + * as a query string for cache busting purposes. If version is set to false, a version + * number is automatically added equal to current installed WordPress version. + * If set to null, no version is added. + * @param string $media Optional. The media for which this stylesheet has been defined. + * Default 'all'. Accepts media types like 'all', 'print' and 'screen', or media queries like + * '(orientation: portrait)' and '(max-width: 640px)'. + */ + function wp_enqueue_style($handle, $src = '', $deps = array(), $ver = \false, $media = 'all') + { + } + /** + * Removes a previously enqueued CSS stylesheet. + * + * @see WP_Dependencies::dequeue() + * + * @since 3.1.0 + * + * @param string $handle Name of the stylesheet to be removed. + */ + function wp_dequeue_style($handle) + { + } + /** + * Checks whether a CSS stylesheet has been added to the queue. + * + * @since 2.8.0 + * + * @param string $handle Name of the stylesheet. + * @param string $status Optional. Status of the stylesheet to check. Default 'enqueued'. + * Accepts 'enqueued', 'registered', 'queue', 'to_do', and 'done'. + * @return bool Whether style is queued. + * @phpstan-param 'enqueued'|'registered'|'queue'|'to_do'|'done' $status + */ + function wp_style_is($handle, $status = 'enqueued') + { + } + /** + * Adds metadata to a CSS stylesheet. + * + * Works only if the stylesheet has already been registered. + * + * Possible values for $key and $value: + * 'conditional' string Comments for IE 6, lte IE 7 etc. + * 'rtl' bool|string To declare an RTL stylesheet. + * 'suffix' string Optional suffix, used in combination with RTL. + * 'alt' bool For rel="alternate stylesheet". + * 'title' string For preferred/alternate stylesheets. + * 'path' string The absolute path to a stylesheet. Stylesheet will + * load inline when 'path' is set. + * + * @see WP_Dependencies::add_data() + * + * @since 3.6.0 + * @since 5.8.0 Added 'path' as an official value for $key. + * See {@see wp_maybe_inline_styles()}. + * + * @param string $handle Name of the stylesheet. + * @param string $key Name of data point for which we're storing a value. + * Accepts 'conditional', 'rtl' and 'suffix', 'alt', 'title' and 'path'. + * @param mixed $value String containing the CSS data to be added. + * @return bool True on success, false on failure. + * @phpstan-param 'conditional'|'rtl'|'suffix'|'alt'|'title'|'path' $key + */ + function wp_style_add_data($handle, $key, $value) + { + } + /** + * General template tags that can go anywhere in a template. + * + * @package WordPress + * @subpackage Template + */ + /** + * Loads header template. + * + * Includes the header template for a theme or if a name is specified then a + * specialized header will be included. + * + * For the parameter, if the file is called "header-special.php" then specify + * "special". + * + * @since 1.5.0 + * @since 5.5.0 A return value was added. + * @since 5.5.0 The `$args` parameter was added. + * + * @param string $name The name of the specialized header. + * @param array $args Optional. Additional arguments passed to the header template. + * Default empty array. + * @return void|false Void on success, false if the template does not exist. + */ + function get_header($name = \null, $args = array()) + { + } + /** + * Loads footer template. + * + * Includes the footer template for a theme or if a name is specified then a + * specialized footer will be included. + * + * For the parameter, if the file is called "footer-special.php" then specify + * "special". + * + * @since 1.5.0 + * @since 5.5.0 A return value was added. + * @since 5.5.0 The `$args` parameter was added. + * + * @param string $name The name of the specialized footer. + * @param array $args Optional. Additional arguments passed to the footer template. + * Default empty array. + * @return void|false Void on success, false if the template does not exist. + */ + function get_footer($name = \null, $args = array()) + { + } + /** + * Loads sidebar template. + * + * Includes the sidebar template for a theme or if a name is specified then a + * specialized sidebar will be included. + * + * For the parameter, if the file is called "sidebar-special.php" then specify + * "special". + * + * @since 1.5.0 + * @since 5.5.0 A return value was added. + * @since 5.5.0 The `$args` parameter was added. + * + * @param string $name The name of the specialized sidebar. + * @param array $args Optional. Additional arguments passed to the sidebar template. + * Default empty array. + * @return void|false Void on success, false if the template does not exist. + */ + function get_sidebar($name = \null, $args = array()) + { + } + /** + * Loads a template part into a template. + * + * Provides a simple mechanism for child themes to overload reusable sections of code + * in the theme. + * + * Includes the named template part for a theme or if a name is specified then a + * specialized part will be included. If the theme contains no {slug}.php file + * then no template will be included. + * + * The template is included using require, not require_once, so you may include the + * same template part multiple times. + * + * For the $name parameter, if the file is called "{slug}-special.php" then specify + * "special". + * + * @since 3.0.0 + * @since 5.5.0 A return value was added. + * @since 5.5.0 The `$args` parameter was added. + * + * @param string $slug The slug name for the generic template. + * @param string|null $name Optional. The name of the specialized template. + * @param array $args Optional. Additional arguments passed to the template. + * Default empty array. + * @return void|false Void on success, false if the template does not exist. + */ + function get_template_part($slug, $name = \null, $args = array()) + { + } + /** + * Displays search form. + * + * Will first attempt to locate the searchform.php file in either the child or + * the parent, then load it. If it doesn't exist, then the default search form + * will be displayed. The default search form is HTML, which will be displayed. + * There is a filter applied to the search form HTML in order to edit or replace + * it. The filter is {@see 'get_search_form'}. + * + * This function is primarily used by themes which want to hardcode the search + * form into the sidebar and also by the search widget in WordPress. + * + * There is also an action that is called whenever the function is run called, + * {@see 'pre_get_search_form'}. This can be useful for outputting JavaScript that the + * search relies on or various formatting that applies to the beginning of the + * search. To give a few examples of what it can be used for. + * + * @since 2.7.0 + * @since 5.2.0 The `$args` array parameter was added in place of an `$echo` boolean flag. + * + * @param array $args { + * Optional. Array of display arguments. + * + * @type bool $echo Whether to echo or return the form. Default true. + * @type string $aria_label ARIA label for the search form. Useful to distinguish + * multiple search forms on the same page and improve + * accessibility. Default empty. + * } + * @return void|string Void if 'echo' argument is true, search form HTML if 'echo' is false. + * @phpstan-param array{ + * echo?: bool, + * aria_label?: string, + * } $args + */ + function get_search_form($args = array()) + { + } + /** + * Displays the Log In/Out link. + * + * Displays a link, which allows users to navigate to the Log In page to log in + * or log out depending on whether they are currently logged in. + * + * @since 1.5.0 + * + * @param string $redirect Optional path to redirect to on login/logout. + * @param bool $display Default to echo and not return the link. + * @return void|string Void if `$display` argument is true, log in/out link if `$display` is false. + * @phpstan-return ($display is true ? void : string) + */ + function wp_loginout($redirect = '', $display = \true) + { + } + /** + * Retrieves the logout URL. + * + * Returns the URL that allows the user to log out of the site. + * + * @since 2.7.0 + * + * @param string $redirect Path to redirect to on logout. + * @return string The logout URL. Note: HTML-encoded via esc_html() in wp_nonce_url(). + */ + function wp_logout_url($redirect = '') + { + } + /** + * Retrieves the login URL. + * + * @since 2.7.0 + * + * @param string $redirect Path to redirect to on log in. + * @param bool $force_reauth Whether to force reauthorization, even if a cookie is present. + * Default false. + * @return string The login URL. Not HTML-encoded. + */ + function wp_login_url($redirect = '', $force_reauth = \false) + { + } + /** + * Returns the URL that allows the user to register on the site. + * + * @since 3.6.0 + * + * @return string User registration URL. + */ + function wp_registration_url() + { + } + /** + * Provides a simple login form for use anywhere within WordPress. + * + * The login form HTML is echoed by default. Pass a false value for `$echo` to return it instead. + * + * @since 3.0.0 + * @since 6.6.0 Added `required_username` and `required_password` arguments. + * + * @param array $args { + * Optional. Array of options to control the form output. Default empty array. + * + * @type bool $echo Whether to display the login form or return the form HTML code. + * Default true (echo). + * @type string $redirect URL to redirect to. Must be absolute, as in "https://example.com/mypage/". + * Default is to redirect back to the request URI. + * @type string $form_id ID attribute value for the form. Default 'loginform'. + * @type string $label_username Label for the username or email address field. Default 'Username or Email Address'. + * @type string $label_password Label for the password field. Default 'Password'. + * @type string $label_remember Label for the remember field. Default 'Remember Me'. + * @type string $label_log_in Label for the submit button. Default 'Log In'. + * @type string $id_username ID attribute value for the username field. Default 'user_login'. + * @type string $id_password ID attribute value for the password field. Default 'user_pass'. + * @type string $id_remember ID attribute value for the remember field. Default 'rememberme'. + * @type string $id_submit ID attribute value for the submit button. Default 'wp-submit'. + * @type bool $remember Whether to display the "rememberme" checkbox in the form. + * @type string $value_username Default value for the username field. Default empty. + * @type bool $value_remember Whether the "Remember Me" checkbox should be checked by default. + * Default false (unchecked). + * @type bool $required_username Whether the username field has the 'required' attribute. + * Default false. + * @type bool $required_password Whether the password field has the 'required' attribute. + * Default false. + * + * } + * @return void|string Void if 'echo' argument is true, login form HTML if 'echo' is false. + * @phpstan-param array{ + * echo?: bool, + * redirect?: string, + * form_id?: string, + * label_username?: string, + * label_password?: string, + * label_remember?: string, + * label_log_in?: string, + * id_username?: string, + * id_password?: string, + * id_remember?: string, + * id_submit?: string, + * remember?: bool, + * value_username?: string, + * value_remember?: bool, + * required_username?: bool, + * required_password?: bool, + * } $args + */ + function wp_login_form($args = array()) + { + } + /** + * Returns the URL that allows the user to reset the lost password. + * + * @since 2.8.0 + * + * @param string $redirect Path to redirect to on login. + * @return string Lost password URL. + */ + function wp_lostpassword_url($redirect = '') + { + } + /** + * Displays the Registration or Admin link. + * + * Display a link which allows the user to navigate to the registration page if + * not logged in and registration is enabled or to the dashboard if logged in. + * + * @since 1.5.0 + * + * @param string $before Text to output before the link. Default `<li>`. + * @param string $after Text to output after the link. Default `</li>`. + * @param bool $display Default to echo and not return the link. + * @return void|string Void if `$display` argument is true, registration or admin link + * if `$display` is false. + * @phpstan-return ($display is true ? void : string) + */ + function wp_register($before = '<li>', $after = '</li>', $display = \true) + { + } + /** + * Theme container function for the 'wp_meta' action. + * + * The {@see 'wp_meta'} action can have several purposes, depending on how you use it, + * but one purpose might have been to allow for theme switching. + * + * @since 1.5.0 + * + * @link https://core.trac.wordpress.org/ticket/1458 Explanation of 'wp_meta' action. + */ + function wp_meta() + { + } + /** + * Displays information about the current site. + * + * @since 0.71 + * + * @see get_bloginfo() For possible `$show` values + * + * @param string $show Optional. Site information to display. Default empty. + */ + function bloginfo($show = '') + { + } + /** + * Retrieves information about the current site. + * + * Possible values for `$show` include: + * + * - 'name' - Site title (set in Settings > General) + * - 'description' - Site tagline (set in Settings > General) + * - 'wpurl' - The WordPress address (URL) (set in Settings > General) + * - 'url' - The Site address (URL) (set in Settings > General) + * - 'admin_email' - Admin email (set in Settings > General) + * - 'charset' - The "Encoding for pages and feeds" (set in Settings > Reading) + * - 'version' - The current WordPress version + * - 'html_type' - The Content-Type (default: "text/html"). Themes and plugins + * can override the default value using the {@see 'pre_option_html_type'} filter + * - 'text_direction' - The text direction determined by the site's language. is_rtl() + * should be used instead + * - 'language' - Language code for the current site + * - 'stylesheet_url' - URL to the stylesheet for the active theme. An active child theme + * will take precedence over this value + * - 'stylesheet_directory' - Directory path for the active theme. An active child theme + * will take precedence over this value + * - 'template_url' / 'template_directory' - URL of the active theme's directory. An active + * child theme will NOT take precedence over this value + * - 'pingback_url' - The pingback XML-RPC file URL (xmlrpc.php) + * - 'atom_url' - The Atom feed URL (/feed/atom) + * - 'rdf_url' - The RDF/RSS 1.0 feed URL (/feed/rdf) + * - 'rss_url' - The RSS 0.92 feed URL (/feed/rss) + * - 'rss2_url' - The RSS 2.0 feed URL (/feed) + * - 'comments_atom_url' - The comments Atom feed URL (/comments/feed) + * - 'comments_rss2_url' - The comments RSS 2.0 feed URL (/comments/feed) + * + * Some `$show` values are deprecated and will be removed in future versions. + * These options will trigger the _deprecated_argument() function. + * + * Deprecated arguments include: + * + * - 'siteurl' - Use 'url' instead + * - 'home' - Use 'url' instead + * + * @since 0.71 + * + * @global string $wp_version The WordPress version string. + * + * @param string $show Optional. Site info to retrieve. Default empty (site name). + * @param string $filter Optional. How to filter what is retrieved. Default 'raw'. + * @return string Mostly string values, might be empty. + */ + function get_bloginfo($show = '', $filter = 'raw') + { + } + /** + * Returns the Site Icon URL. + * + * @since 4.3.0 + * + * @param int $size Optional. Size of the site icon. Default 512 (pixels). + * @param string $url Optional. Fallback url if no site icon is found. Default empty. + * @param int $blog_id Optional. ID of the blog to get the site icon for. Default current blog. + * @return string Site Icon URL. + */ + function get_site_icon_url($size = 512, $url = '', $blog_id = 0) + { + } + /** + * Displays the Site Icon URL. + * + * @since 4.3.0 + * + * @param int $size Optional. Size of the site icon. Default 512 (pixels). + * @param string $url Optional. Fallback url if no site icon is found. Default empty. + * @param int $blog_id Optional. ID of the blog to get the site icon for. Default current blog. + */ + function site_icon_url($size = 512, $url = '', $blog_id = 0) + { + } + /** + * Determines whether the site has a Site Icon. + * + * @since 4.3.0 + * + * @param int $blog_id Optional. ID of the blog in question. Default current blog. + * @return bool Whether the site has a site icon or not. + */ + function has_site_icon($blog_id = 0) + { + } + /** + * Determines whether the site has a custom logo. + * + * @since 4.5.0 + * + * @param int $blog_id Optional. ID of the blog in question. Default is the ID of the current blog. + * @return bool Whether the site has a custom logo or not. + */ + function has_custom_logo($blog_id = 0) + { + } + /** + * Returns a custom logo, linked to home unless the theme supports removing the link on the home page. + * + * @since 4.5.0 + * @since 5.5.0 Added option to remove the link on the home page with `unlink-homepage-logo` theme support + * for the `custom-logo` theme feature. + * @since 5.5.1 Disabled lazy-loading by default. + * + * @param int $blog_id Optional. ID of the blog in question. Default is the ID of the current blog. + * @return string Custom logo markup. + */ + function get_custom_logo($blog_id = 0) + { + } + /** + * Displays a custom logo, linked to home unless the theme supports removing the link on the home page. + * + * @since 4.5.0 + * + * @param int $blog_id Optional. ID of the blog in question. Default is the ID of the current blog. + */ + function the_custom_logo($blog_id = 0) + { + } + /** + * Returns document title for the current page. + * + * @since 4.4.0 + * + * @global int $page Page number of a single post. + * @global int $paged Page number of a list of posts. + * + * @return string Tag with the document title. + */ + function wp_get_document_title() + { + } + /** + * Displays title tag with content. + * + * @ignore + * @since 4.1.0 + * @since 4.4.0 Improved title output replaced `wp_title()`. + * @access private + * @phpstan-return void + */ + function _wp_render_title_tag() + { + } + /** + * Displays or retrieves page title for all areas of blog. + * + * By default, the page title will display the separator before the page title, + * so that the blog title will be before the page title. This is not good for + * title display, since the blog title shows up on most tabs and not what is + * important, which is the page that the user is looking at. + * + * There are also SEO benefits to having the blog title after or to the 'right' + * of the page title. However, it is mostly common sense to have the blog title + * to the right with most browsers supporting tabs. You can achieve this by + * using the seplocation parameter and setting the value to 'right'. This change + * was introduced around 2.5.0, in case backward compatibility of themes is + * important. + * + * @since 1.0.0 + * + * @global WP_Locale $wp_locale WordPress date and time locale object. + * + * @param string $sep Optional. How to separate the various items within the page title. + * Default '»'. + * @param bool $display Optional. Whether to display or retrieve title. Default true. + * @param string $seplocation Optional. Location of the separator (either 'left' or 'right'). + * @return string|void String when `$display` is false, nothing otherwise. + * @phpstan-param 'left'|'right' $seplocation + * @phpstan-return ($display is true ? void : string) + */ + function wp_title($sep = '»', $display = \true, $seplocation = '') + { + } + /** + * Displays or retrieves page title for post. + * + * This is optimized for single.php template file for displaying the post title. + * + * It does not support placing the separator after the title, but by leaving the + * prefix parameter empty, you can set the title separator manually. The prefix + * does not automatically place a space between the prefix, so if there should + * be a space, the parameter value will need to have it at the end. + * + * @since 0.71 + * + * @param string $prefix Optional. What to display before the title. + * @param bool $display Optional. Whether to display or retrieve title. Default true. + * @return string|void Title when retrieving. + * @phpstan-return ($display is true ? void : string|void) + */ + function single_post_title($prefix = '', $display = \true) + { + } + /** + * Displays or retrieves title for a post type archive. + * + * This is optimized for archive.php and archive-{$post_type}.php template files + * for displaying the title of the post type. + * + * @since 3.1.0 + * + * @param string $prefix Optional. What to display before the title. + * @param bool $display Optional. Whether to display or retrieve title. Default true. + * @return string|void Title when retrieving, null when displaying or failure. + * @phpstan-return ($display is true ? void : string|void) + */ + function post_type_archive_title($prefix = '', $display = \true) + { + } + /** + * Displays or retrieves page title for category archive. + * + * Useful for category template files for displaying the category page title. + * The prefix does not automatically place a space between the prefix, so if + * there should be a space, the parameter value will need to have it at the end. + * + * @since 0.71 + * + * @param string $prefix Optional. What to display before the title. + * @param bool $display Optional. Whether to display or retrieve title. Default true. + * @return string|void Title when retrieving. + * @phpstan-return ($display is true ? void : string|void) + */ + function single_cat_title($prefix = '', $display = \true) + { + } + /** + * Displays or retrieves page title for tag post archive. + * + * Useful for tag template files for displaying the tag page title. The prefix + * does not automatically place a space between the prefix, so if there should + * be a space, the parameter value will need to have it at the end. + * + * @since 2.3.0 + * + * @param string $prefix Optional. What to display before the title. + * @param bool $display Optional. Whether to display or retrieve title. Default true. + * @return string|void Title when retrieving. + * @phpstan-return ($display is true ? void : string|void) + */ + function single_tag_title($prefix = '', $display = \true) + { + } + /** + * Displays or retrieves page title for taxonomy term archive. + * + * Useful for taxonomy term template files for displaying the taxonomy term page title. + * The prefix does not automatically place a space between the prefix, so if there should + * be a space, the parameter value will need to have it at the end. + * + * @since 3.1.0 + * + * @param string $prefix Optional. What to display before the title. + * @param bool $display Optional. Whether to display or retrieve title. Default true. + * @return string|void Title when retrieving. + * @phpstan-return ($display is true ? void : string|void) + */ + function single_term_title($prefix = '', $display = \true) + { + } + /** + * Displays or retrieves page title for post archive based on date. + * + * Useful for when the template only needs to display the month and year, + * if either are available. The prefix does not automatically place a space + * between the prefix, so if there should be a space, the parameter value + * will need to have it at the end. + * + * @since 0.71 + * + * @global WP_Locale $wp_locale WordPress date and time locale object. + * + * @param string $prefix Optional. What to display before the title. + * @param bool $display Optional. Whether to display or retrieve title. Default true. + * @return string|false|void False if there's no valid title for the month. Title when retrieving. + * @phpstan-return ($display is true ? false|void : false|string) + */ + function single_month_title($prefix = '', $display = \true) + { + } + /** + * Displays the archive title based on the queried object. + * + * @since 4.1.0 + * + * @see get_the_archive_title() + * + * @param string $before Optional. Content to prepend to the title. Default empty. + * @param string $after Optional. Content to append to the title. Default empty. + */ + function the_archive_title($before = '', $after = '') + { + } + /** + * Retrieves the archive title based on the queried object. + * + * @since 4.1.0 + * @since 5.5.0 The title part is wrapped in a `<span>` element. + * + * @return string Archive title. + */ + function get_the_archive_title() + { + } + /** + * Displays category, tag, term, or author description. + * + * @since 4.1.0 + * + * @see get_the_archive_description() + * + * @param string $before Optional. Content to prepend to the description. Default empty. + * @param string $after Optional. Content to append to the description. Default empty. + */ + function the_archive_description($before = '', $after = '') + { + } + /** + * Retrieves the description for an author, post type, or term archive. + * + * @since 4.1.0 + * @since 4.7.0 Added support for author archives. + * @since 4.9.0 Added support for post type archives. + * + * @see term_description() + * + * @return string Archive description. + */ + function get_the_archive_description() + { + } + /** + * Retrieves the description for a post type archive. + * + * @since 4.9.0 + * + * @return string The post type description. + */ + function get_the_post_type_description() + { + } + /** + * Retrieves archive link content based on predefined or custom code. + * + * The format can be one of four styles. The 'link' for head element, 'option' + * for use in the select element, 'html' for use in list (either ol or ul HTML + * elements). Custom content is also supported using the before and after + * parameters. + * + * The 'link' format uses the `<link>` HTML element with the **archives** + * relationship. The before and after parameters are not used. The text + * parameter is used to describe the link. + * + * The 'option' format uses the option HTML element for use in select element. + * The value is the url parameter and the before and after parameters are used + * between the text description. + * + * The 'html' format, which is the default, uses the li HTML element for use in + * the list HTML elements. The before parameter is before the link and the after + * parameter is after the closing link. + * + * The custom format uses the before parameter before the link ('a' HTML + * element) and the after parameter after the closing link tag. If the above + * three values for the format are not used, then custom format is assumed. + * + * @since 1.0.0 + * @since 5.2.0 Added the `$selected` parameter. + * + * @param string $url URL to archive. + * @param string $text Archive text description. + * @param string $format Optional. Can be 'link', 'option', 'html', or custom. Default 'html'. + * @param string $before Optional. Content to prepend to the description. Default empty. + * @param string $after Optional. Content to append to the description. Default empty. + * @param bool $selected Optional. Set to true if the current page is the selected archive page. + * @return string HTML link content for archive. + */ + function get_archives_link($url, $text, $format = 'html', $before = '', $after = '', $selected = \false) + { + } + /** + * Displays archive links based on type and format. + * + * @since 1.2.0 + * @since 4.4.0 The `$post_type` argument was added. + * @since 5.2.0 The `$year`, `$monthnum`, `$day`, and `$w` arguments were added. + * + * @see get_archives_link() + * + * @global wpdb $wpdb WordPress database abstraction object. + * @global WP_Locale $wp_locale WordPress date and time locale object. + * + * @param string|array $args { + * Default archive links arguments. Optional. + * + * @type string $type Type of archive to retrieve. Accepts 'daily', 'weekly', 'monthly', + * 'yearly', 'postbypost', or 'alpha'. Both 'postbypost' and 'alpha' + * display the same archive link list as well as post titles instead + * of displaying dates. The difference between the two is that 'alpha' + * will order by post title and 'postbypost' will order by post date. + * Default 'monthly'. + * @type string|int $limit Number of links to limit the query to. Default empty (no limit). + * @type string $format Format each link should take using the $before and $after args. + * Accepts 'link' (`<link>` tag), 'option' (`<option>` tag), 'html' + * (`<li>` tag), or a custom format, which generates a link anchor + * with $before preceding and $after succeeding. Default 'html'. + * @type string $before Markup to prepend to the beginning of each link. Default empty. + * @type string $after Markup to append to the end of each link. Default empty. + * @type bool $show_post_count Whether to display the post count alongside the link. Default false. + * @type bool|int $echo Whether to echo or return the links list. Default 1|true to echo. + * @type string $order Whether to use ascending or descending order. Accepts 'ASC', or 'DESC'. + * Default 'DESC'. + * @type string $post_type Post type. Default 'post'. + * @type string $year Year. Default current year. + * @type string $monthnum Month number. Default current month number. + * @type string $day Day. Default current day. + * @type string $w Week. Default current week. + * } + * @return void|string Void if 'echo' argument is true, archive links if 'echo' is false. + * @phpstan-param array{ + * type?: string, + * limit?: string|int, + * format?: string, + * before?: string, + * after?: string, + * show_post_count?: bool, + * echo?: bool|int, + * order?: string, + * post_type?: string, + * year?: string, + * monthnum?: string, + * day?: string, + * w?: string, + * } $args + */ + function wp_get_archives($args = '') + { + } + /** + * Gets number of days since the start of the week. + * + * @since 1.5.0 + * + * @param int $num Number of day. + * @return float Days since the start of the week. + */ + function calendar_week_mod($num) + { + } + /** + * Displays calendar with days that have posts as links. + * + * The calendar is cached, which will be retrieved, if it exists. If there are + * no posts for the month, then it will not be displayed. + * + * @since 1.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * @global int $m + * @global int $monthnum + * @global int $year + * @global WP_Locale $wp_locale WordPress date and time locale object. + * @global array $posts + * + * @param bool $initial Optional. Whether to use initial calendar names. Default true. + * @param bool $display Optional. Whether to display the calendar output. Default true. + * @return void|string Void if `$display` argument is true, calendar HTML if `$display` is false. + * @phpstan-return ($display is true ? void : string) + */ + function get_calendar($initial = \true, $display = \true) + { + } + /** + * Purges the cached results of get_calendar. + * + * @see get_calendar() + * @since 2.1.0 + */ + function delete_get_calendar_cache() + { + } + /** + * Displays all of the allowed tags in HTML format with attributes. + * + * This is useful for displaying in the comment area, which elements and + * attributes are supported. As well as any plugins which want to display it. + * + * @since 1.0.1 + * @since 4.4.0 No longer used in core. + * + * @global array $allowedtags + * + * @return string HTML allowed tags entity encoded. + */ + function allowed_tags() + { + } + /***** Date/Time tags */ + /** + * Outputs the date in iso8601 format for xml files. + * + * @since 1.0.0 + */ + function the_date_xml() + { + } + /** + * Displays or retrieves the date the current post was written (once per date) + * + * Will only output the date if the current post's date is different from the + * previous one output. + * + * i.e. Only one date listing will show per day worth of posts shown in the loop, even if the + * function is called several times for each post. + * + * HTML output can be filtered with 'the_date'. + * Date string output can be filtered with 'get_the_date'. + * + * @since 0.71 + * + * @global string $currentday The day of the current post in the loop. + * @global string $previousday The day of the previous post in the loop. + * + * @param string $format Optional. PHP date format. Defaults to the 'date_format' option. + * @param string $before Optional. Output before the date. Default empty. + * @param string $after Optional. Output after the date. Default empty. + * @param bool $display Optional. Whether to echo the date or return it. Default true. + * @return string|void String if retrieving. + * @phpstan-return ($display is true ? void : string) + */ + function the_date($format = '', $before = '', $after = '', $display = \true) + { + } + /** + * Retrieves the date on which the post was written. + * + * Unlike the_date() this function will always return the date. + * Modify output with the {@see 'get_the_date'} filter. + * + * @since 3.0.0 + * + * @param string $format Optional. PHP date format. Defaults to the 'date_format' option. + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post. + * @return string|int|false Date the current post was written. False on failure. + */ + function get_the_date($format = '', $post = \null) + { + } + /** + * Displays the date on which the post was last modified. + * + * @since 2.1.0 + * + * @param string $format Optional. PHP date format. Defaults to the 'date_format' option. + * @param string $before Optional. Output before the date. Default empty. + * @param string $after Optional. Output after the date. Default empty. + * @param bool $display Optional. Whether to echo the date or return it. Default true. + * @return string|void String if retrieving. + * @phpstan-return ($display is true ? void : string) + */ + function the_modified_date($format = '', $before = '', $after = '', $display = \true) + { + } + /** + * Retrieves the date on which the post was last modified. + * + * @since 2.1.0 + * @since 4.6.0 Added the `$post` parameter. + * + * @param string $format Optional. PHP date format. Defaults to the 'date_format' option. + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post. + * @return string|int|false Date the current post was modified. False on failure. + */ + function get_the_modified_date($format = '', $post = \null) + { + } + /** + * Displays the time at which the post was written. + * + * @since 0.71 + * + * @param string $format Optional. Format to use for retrieving the time the post + * was written. Accepts 'G', 'U', or PHP date format. + * Defaults to the 'time_format' option. + */ + function the_time($format = '') + { + } + /** + * Retrieves the time at which the post was written. + * + * @since 1.5.0 + * + * @param string $format Optional. Format to use for retrieving the time the post + * was written. Accepts 'G', 'U', or PHP date format. + * Defaults to the 'time_format' option. + * @param int|WP_Post $post Post ID or post object. Default is global `$post` object. + * @return string|int|false Formatted date string or Unix timestamp if `$format` is 'U' or 'G'. + * False on failure. + */ + function get_the_time($format = '', $post = \null) + { + } + /** + * Retrieves the time at which the post was written. + * + * @since 2.0.0 + * + * @param string $format Optional. Format to use for retrieving the time the post + * was written. Accepts 'G', 'U', or PHP date format. Default 'U'. + * @param bool $gmt Optional. Whether to retrieve the GMT time. Default false. + * @param int|WP_Post $post Post ID or post object. Default is global `$post` object. + * @param bool $translate Whether to translate the time string. Default false. + * @return string|int|false Formatted date string or Unix timestamp if `$format` is 'U' or 'G'. + * False on failure. + */ + function get_post_time($format = 'U', $gmt = \false, $post = \null, $translate = \false) + { + } + /** + * Retrieves post published or modified time as a `DateTimeImmutable` object instance. + * + * The object will be set to the timezone from WordPress settings. + * + * For legacy reasons, this function allows to choose to instantiate from local or UTC time in database. + * Normally this should make no difference to the result. However, the values might get out of sync in database, + * typically because of timezone setting changes. The parameter ensures the ability to reproduce backwards + * compatible behaviors in such cases. + * + * @since 5.3.0 + * + * @param int|WP_Post $post Optional. Post ID or post object. Default is global `$post` object. + * @param string $field Optional. Published or modified time to use from database. Accepts 'date' or 'modified'. + * Default 'date'. + * @param string $source Optional. Local or UTC time to use from database. Accepts 'local' or 'gmt'. + * Default 'local'. + * @return DateTimeImmutable|false Time object on success, false on failure. + * @phpstan-param 'date'|'modified' $field + * @phpstan-param 'local'|'gmt' $source + */ + function get_post_datetime($post = \null, $field = 'date', $source = 'local') + { + } + /** + * Retrieves post published or modified time as a Unix timestamp. + * + * Note that this function returns a true Unix timestamp, not summed with timezone offset + * like older WP functions. + * + * @since 5.3.0 + * + * @param int|WP_Post $post Optional. Post ID or post object. Default is global `$post` object. + * @param string $field Optional. Published or modified time to use from database. Accepts 'date' or 'modified'. + * Default 'date'. + * @return int|false Unix timestamp on success, false on failure. + * @phpstan-param 'date'|'modified' $field + */ + function get_post_timestamp($post = \null, $field = 'date') + { + } + /** + * Displays the time at which the post was last modified. + * + * @since 2.0.0 + * + * @param string $format Optional. Format to use for retrieving the time the post + * was modified. Accepts 'G', 'U', or PHP date format. + * Defaults to the 'time_format' option. + */ + function the_modified_time($format = '') + { + } + /** + * Retrieves the time at which the post was last modified. + * + * @since 2.0.0 + * @since 4.6.0 Added the `$post` parameter. + * + * @param string $format Optional. Format to use for retrieving the time the post + * was modified. Accepts 'G', 'U', or PHP date format. + * Defaults to the 'time_format' option. + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post. + * @return string|int|false Formatted date string or Unix timestamp. False on failure. + */ + function get_the_modified_time($format = '', $post = \null) + { + } + /** + * Retrieves the time at which the post was last modified. + * + * @since 2.0.0 + * + * @param string $format Optional. Format to use for retrieving the time the post + * was modified. Accepts 'G', 'U', or PHP date format. Default 'U'. + * @param bool $gmt Optional. Whether to retrieve the GMT time. Default false. + * @param int|WP_Post $post Post ID or post object. Default is global `$post` object. + * @param bool $translate Whether to translate the time string. Default false. + * @return string|int|false Formatted date string or Unix timestamp if `$format` is 'U' or 'G'. + * False on failure. + */ + function get_post_modified_time($format = 'U', $gmt = \false, $post = \null, $translate = \false) + { + } + /** + * Displays the weekday on which the post was written. + * + * @since 0.71 + * + * @global WP_Locale $wp_locale WordPress date and time locale object. + * @phpstan-return void + */ + function the_weekday() + { + } + /** + * Displays the weekday on which the post was written. + * + * Will only output the weekday if the current post's weekday is different from + * the previous one output. + * + * @since 0.71 + * + * @global WP_Locale $wp_locale WordPress date and time locale object. + * @global string $currentday The day of the current post in the loop. + * @global string $previousweekday The day of the previous post in the loop. + * + * @param string $before Optional. Output before the date. Default empty. + * @param string $after Optional. Output after the date. Default empty. + * @phpstan-return void + */ + function the_weekday_date($before = '', $after = '') + { + } + /** + * Fires the wp_head action. + * + * See {@see 'wp_head'}. + * + * @since 1.2.0 + */ + function wp_head() + { + } + /** + * Fires the wp_footer action. + * + * See {@see 'wp_footer'}. + * + * @since 1.5.1 + */ + function wp_footer() + { + } + /** + * Fires the wp_body_open action. + * + * See {@see 'wp_body_open'}. + * + * @since 5.2.0 + */ + function wp_body_open() + { + } + /** + * Displays the links to the general feeds. + * + * @since 2.8.0 + * + * @param array $args Optional arguments. + * @phpstan-return void + */ + function feed_links($args = array()) + { + } + /** + * Displays the links to the extra feeds such as category feeds. + * + * @since 2.8.0 + * + * @param array $args Optional arguments. + */ + function feed_links_extra($args = array()) + { + } + /** + * Displays the link to the Really Simple Discovery service endpoint. + * + * @link http://archipelago.phrasewise.com/rsd + * @since 2.0.0 + */ + function rsd_link() + { + } + /** + * Displays a referrer `strict-origin-when-cross-origin` meta tag. + * + * Outputs a referrer `strict-origin-when-cross-origin` meta tag that tells the browser not to send + * the full URL as a referrer to other sites when cross-origin assets are loaded. + * + * Typical usage is as a {@see 'wp_head'} callback: + * + * add_action( 'wp_head', 'wp_strict_cross_origin_referrer' ); + * + * @since 5.7.0 + */ + function wp_strict_cross_origin_referrer() + { + } + /** + * Displays site icon meta tags. + * + * @since 4.3.0 + * + * @link https://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#rel-icon HTML5 specification link icon. + * @phpstan-return void + */ + function wp_site_icon() + { + } + /** + * Prints resource hints to browsers for pre-fetching, pre-rendering + * and pre-connecting to websites. + * + * Gives hints to browsers to prefetch specific pages or render them + * in the background, to perform DNS lookups or to begin the connection + * handshake (DNS, TCP, TLS) in the background. + * + * These performance improving indicators work by using `<link rel"…">`. + * + * @since 4.6.0 + */ + function wp_resource_hints() + { + } + /** + * Prints resource preloads directives to browsers. + * + * Gives directive to browsers to preload specific resources that website will + * need very soon, this ensures that they are available earlier and are less + * likely to block the page's render. Preload directives should not be used for + * non-render-blocking elements, as then they would compete with the + * render-blocking ones, slowing down the render. + * + * These performance improving indicators work by using `<link rel="preload">`. + * + * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types/preload + * @link https://web.dev/preload-responsive-images/ + * + * @since 6.1.0 + * @phpstan-return void + */ + function wp_preload_resources() + { + } + /** + * Retrieves a list of unique hosts of all enqueued scripts and styles. + * + * @since 4.6.0 + * + * @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts. + * @global WP_Styles $wp_styles The WP_Styles object for printing styles. + * + * @return string[] A list of unique hosts of enqueued scripts and styles. + */ + function wp_dependencies_unique_hosts() + { + } + /** + * Determines whether the user can access the visual editor. + * + * Checks if the user can access the visual editor and that it's supported by the user's browser. + * + * @since 2.0.0 + * + * @global bool $wp_rich_edit Whether the user can access the visual editor. + * @global bool $is_gecko Whether the browser is Gecko-based. + * @global bool $is_opera Whether the browser is Opera. + * @global bool $is_safari Whether the browser is Safari. + * @global bool $is_chrome Whether the browser is Chrome. + * @global bool $is_IE Whether the browser is Internet Explorer. + * @global bool $is_edge Whether the browser is Microsoft Edge. + * + * @return bool True if the user can access the visual editor, false otherwise. + */ + function user_can_richedit() + { + } + /** + * Finds out which editor should be displayed by default. + * + * Works out which of the editors to display as the current editor for a + * user. The 'html' setting is for the "Text" editor tab. + * + * @since 2.5.0 + * + * @return string Either 'tinymce', 'html', or 'test' + * @phpstan-return 'tinymce'|'html'|'test' + */ + function wp_default_editor() + { + } + /** + * Renders an editor. + * + * Using this function is the proper way to output all needed components for both TinyMCE and Quicktags. + * _WP_Editors should not be used directly. See https://core.trac.wordpress.org/ticket/17144. + * + * NOTE: Once initialized the TinyMCE editor cannot be safely moved in the DOM. For that reason + * running wp_editor() inside of a meta box is not a good idea unless only Quicktags is used. + * On the post edit screen several actions can be used to include additional editors + * containing TinyMCE: 'edit_page_form', 'edit_form_advanced' and 'dbx_post_sidebar'. + * See https://core.trac.wordpress.org/ticket/19173 for more information. + * + * @see _WP_Editors::editor() + * @see _WP_Editors::parse_settings() + * @since 3.3.0 + * + * @param string $content Initial content for the editor. + * @param string $editor_id HTML ID attribute value for the textarea and TinyMCE. + * Should not contain square brackets. + * @param array $settings See _WP_Editors::parse_settings() for description. + * @phpstan-param array{ + * wpautop?: bool, + * media_buttons?: bool, + * default_editor?: string, + * drag_drop_upload?: bool, + * textarea_name?: string, + * textarea_rows?: int, + * tabindex?: string|int, + * tabfocus_elements?: string, + * editor_css?: string, + * editor_class?: string, + * teeny?: bool, + * dfw?: bool, + * tinymce?: bool|array, + * quicktags?: bool|array, + * } $settings See _WP_Editors::parse_settings() + */ + function wp_editor($content, $editor_id, $settings = array()) + { + } + /** + * Outputs the editor scripts, stylesheets, and default settings. + * + * The editor can be initialized when needed after page load. + * See wp.editor.initialize() in wp-admin/js/editor.js for initialization options. + * + * @uses _WP_Editors + * @since 4.8.0 + */ + function wp_enqueue_editor() + { + } + /** + * Enqueues assets needed by the code editor for the given settings. + * + * @since 4.9.0 + * + * @see wp_enqueue_editor() + * @see wp_get_code_editor_settings(); + * @see _WP_Editors::parse_settings() + * + * @param array $args { + * Args. + * + * @type string $type The MIME type of the file to be edited. + * @type string $file Filename to be edited. Extension is used to sniff the type. Can be supplied as alternative to `$type` param. + * @type WP_Theme $theme Theme being edited when on the theme file editor. + * @type string $plugin Plugin being edited when on the plugin file editor. + * @type array $codemirror Additional CodeMirror setting overrides. + * @type array $csslint CSSLint rule overrides. + * @type array $jshint JSHint rule overrides. + * @type array $htmlhint HTMLHint rule overrides. + * } + * @return array|false Settings for the enqueued code editor, or false if the editor was not enqueued. + * @phpstan-param array{ + * type?: string, + * file?: string, + * theme?: WP_Theme, + * plugin?: string, + * codemirror?: array, + * csslint?: array, + * jshint?: array, + * htmlhint?: array, + * } $args + */ + function wp_enqueue_code_editor($args) + { + } + /** + * Generates and returns code editor settings. + * + * @since 5.0.0 + * + * @see wp_enqueue_code_editor() + * + * @param array $args { + * Args. + * + * @type string $type The MIME type of the file to be edited. + * @type string $file Filename to be edited. Extension is used to sniff the type. Can be supplied as alternative to `$type` param. + * @type WP_Theme $theme Theme being edited when on the theme file editor. + * @type string $plugin Plugin being edited when on the plugin file editor. + * @type array $codemirror Additional CodeMirror setting overrides. + * @type array $csslint CSSLint rule overrides. + * @type array $jshint JSHint rule overrides. + * @type array $htmlhint HTMLHint rule overrides. + * } + * @return array|false Settings for the code editor. + * @phpstan-param array{ + * type?: string, + * file?: string, + * theme?: WP_Theme, + * plugin?: string, + * codemirror?: array, + * csslint?: array, + * jshint?: array, + * htmlhint?: array, + * } $args + */ + function wp_get_code_editor_settings($args) + { + } + /** + * Retrieves the contents of the search WordPress query variable. + * + * The search query string is passed through esc_attr() to ensure that it is safe + * for placing in an HTML attribute. + * + * @since 2.3.0 + * + * @param bool $escaped Whether the result is escaped. Default true. + * Only use when you are later escaping it. Do not use unescaped. + * @return string + */ + function get_search_query($escaped = \true) + { + } + /** + * Displays the contents of the search query variable. + * + * The search query string is passed through esc_attr() to ensure that it is safe + * for placing in an HTML attribute. + * + * @since 2.1.0 + */ + function the_search_query() + { + } + /** + * Gets the language attributes for the 'html' tag. + * + * Builds up a set of HTML attributes containing the text direction and language + * information for the page. + * + * @since 4.3.0 + * + * @param string $doctype Optional. The type of HTML document. Accepts 'xhtml' or 'html'. Default 'html'. + * @return string A space-separated list of language attributes. + * @phpstan-param 'xhtml'|'html' $doctype + */ + function get_language_attributes($doctype = 'html') + { + } + /** + * Displays the language attributes for the 'html' tag. + * + * Builds up a set of HTML attributes containing the text direction and language + * information for the page. + * + * @since 2.1.0 + * @since 4.3.0 Converted into a wrapper for get_language_attributes(). + * + * @param string $doctype Optional. The type of HTML document. Accepts 'xhtml' or 'html'. Default 'html'. + * @phpstan-param 'xhtml'|'html' $doctype + */ + function language_attributes($doctype = 'html') + { + } + /** + * Retrieves paginated links for archive post pages. + * + * Technically, the function can be used to create paginated link list for any + * area. The 'base' argument is used to reference the url, which will be used to + * create the paginated links. The 'format' argument is then used for replacing + * the page number. It is however, most likely and by default, to be used on the + * archive post pages. + * + * The 'type' argument controls format of the returned value. The default is + * 'plain', which is just a string with the links separated by a newline + * character. The other possible values are either 'array' or 'list'. The + * 'array' value will return an array of the paginated link list to offer full + * control of display. The 'list' value will place all of the paginated links in + * an unordered HTML list. + * + * The 'total' argument is the total amount of pages and is an integer. The + * 'current' argument is the current page number and is also an integer. + * + * An example of the 'base' argument is "http://example.com/all_posts.php%_%" + * and the '%_%' is required. The '%_%' will be replaced by the contents of in + * the 'format' argument. An example for the 'format' argument is "?page=%#%" + * and the '%#%' is also required. The '%#%' will be replaced with the page + * number. + * + * You can include the previous and next links in the list by setting the + * 'prev_next' argument to true, which it is by default. You can set the + * previous text, by using the 'prev_text' argument. You can set the next text + * by setting the 'next_text' argument. + * + * If the 'show_all' argument is set to true, then it will show all of the pages + * instead of a short list of the pages near the current page. By default, the + * 'show_all' is set to false and controlled by the 'end_size' and 'mid_size' + * arguments. The 'end_size' argument is how many numbers on either the start + * and the end list edges, by default is 1. The 'mid_size' argument is how many + * numbers to either side of current page, but not including current page. + * + * It is possible to add query vars to the link by using the 'add_args' argument + * and see add_query_arg() for more information. + * + * The 'before_page_number' and 'after_page_number' arguments allow users to + * augment the links themselves. Typically this might be to add context to the + * numbered links so that screen reader users understand what the links are for. + * The text strings are added before and after the page number - within the + * anchor tag. + * + * @since 2.1.0 + * @since 4.9.0 Added the `aria_current` argument. + * + * @global WP_Query $wp_query WordPress Query object. + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param string|array $args { + * Optional. Array or string of arguments for generating paginated links for archives. + * + * @type string $base Base of the paginated url. Default empty. + * @type string $format Format for the pagination structure. Default empty. + * @type int $total The total amount of pages. Default is the value WP_Query's + * `max_num_pages` or 1. + * @type int $current The current page number. Default is 'paged' query var or 1. + * @type string $aria_current The value for the aria-current attribute. Possible values are 'page', + * 'step', 'location', 'date', 'time', 'true', 'false'. Default is 'page'. + * @type bool $show_all Whether to show all pages. Default false. + * @type int $end_size How many numbers on either the start and the end list edges. + * Default 1. + * @type int $mid_size How many numbers to either side of the current pages. Default 2. + * @type bool $prev_next Whether to include the previous and next links in the list. Default true. + * @type string $prev_text The previous page text. Default '« Previous'. + * @type string $next_text The next page text. Default 'Next »'. + * @type string $type Controls format of the returned value. Possible values are 'plain', + * 'array' and 'list'. Default is 'plain'. + * @type array $add_args An array of query args to add. Default false. + * @type string $add_fragment A string to append to each link. Default empty. + * @type string $before_page_number A string to appear before the page number. Default empty. + * @type string $after_page_number A string to append after the page number. Default empty. + * } + * @return string|string[]|void String of page links or array of page links, depending on 'type' argument. + * Void if total number of pages is less than 2. + * @phpstan-param array{ + * base?: string, + * format?: string, + * total?: int, + * current?: int, + * aria_current?: string, + * show_all?: bool, + * end_size?: int, + * mid_size?: int, + * prev_next?: bool, + * prev_text?: string, + * next_text?: string, + * type?: string, + * add_args?: array, + * add_fragment?: string, + * before_page_number?: string, + * after_page_number?: string, + * } $args + */ + function paginate_links($args = '') + { + } + /** + * Registers an admin color scheme css file. + * + * Allows a plugin to register a new admin color scheme. For example: + * + * wp_admin_css_color( 'classic', __( 'Classic' ), admin_url( "css/colors-classic.css" ), array( + * '#07273E', '#14568A', '#D54E21', '#2683AE' + * ) ); + * + * @since 2.5.0 + * + * @global array $_wp_admin_css_colors + * + * @param string $key The unique key for this theme. + * @param string $name The name of the theme. + * @param string $url The URL of the CSS file containing the color scheme. + * @param array $colors Optional. An array of CSS color definition strings which are used + * to give the user a feel for the theme. + * @param array $icons { + * Optional. CSS color definitions used to color any SVG icons. + * + * @type string $base SVG icon base color. + * @type string $focus SVG icon color on focus. + * @type string $current SVG icon color of current admin menu link. + * } + * @phpstan-param array{ + * base?: string, + * focus?: string, + * current?: string, + * } $icons + */ + function wp_admin_css_color($key, $name, $url, $colors = array(), $icons = array()) + { + } + /** + * Registers the default admin color schemes. + * + * Registers the initial set of eight color schemes in the Profile section + * of the dashboard which allows for styling the admin menu and toolbar. + * + * @see wp_admin_css_color() + * + * @since 3.0.0 + */ + function register_admin_color_schemes() + { + } + /** + * Displays the URL of a WordPress admin CSS file. + * + * @see WP_Styles::_css_href() and its {@see 'style_loader_src'} filter. + * + * @since 2.3.0 + * + * @param string $file file relative to wp-admin/ without its ".css" extension. + * @return string + */ + function wp_admin_css_uri($file = 'wp-admin') + { + } + /** + * Enqueues or directly prints a stylesheet link to the specified CSS file. + * + * "Intelligently" decides to enqueue or to print the CSS file. If the + * {@see 'wp_print_styles'} action has *not* yet been called, the CSS file will be + * enqueued. If the {@see 'wp_print_styles'} action has been called, the CSS link will + * be printed. Printing may be forced by passing true as the $force_echo + * (second) parameter. + * + * For backward compatibility with WordPress 2.3 calling method: If the $file + * (first) parameter does not correspond to a registered CSS file, we assume + * $file is a file relative to wp-admin/ without its ".css" extension. A + * stylesheet link to that generated URL is printed. + * + * @since 2.3.0 + * + * @param string $file Optional. Style handle name or file name (without ".css" extension) relative + * to wp-admin/. Defaults to 'wp-admin'. + * @param bool $force_echo Optional. Force the stylesheet link to be printed rather than enqueued. + * @phpstan-return void + */ + function wp_admin_css($file = 'wp-admin', $force_echo = \false) + { + } + /** + * Enqueues the default ThickBox js and css. + * + * If any of the settings need to be changed, this can be done with another js + * file similar to media-upload.js. That file should + * require array('thickbox') to ensure it is loaded after. + * + * @since 2.5.0 + */ + function add_thickbox() + { + } + /** + * Displays the XHTML generator that is generated on the wp_head hook. + * + * See {@see 'wp_head'}. + * + * @since 2.5.0 + */ + function wp_generator() + { + } + /** + * Displays the generator XML or Comment for RSS, ATOM, etc. + * + * Returns the correct generator type for the requested output format. Allows + * for a plugin to filter generators overall the {@see 'the_generator'} filter. + * + * @since 2.5.0 + * + * @param string $type The type of generator to output - (html|xhtml|atom|rss2|rdf|comment|export). + */ + function the_generator($type) + { + } + /** + * Creates the generator XML or Comment for RSS, ATOM, etc. + * + * Returns the correct generator type for the requested output format. Allows + * for a plugin to filter generators on an individual basis using the + * {@see 'get_the_generator_$type'} filter. + * + * @since 2.5.0 + * + * @param string $type The type of generator to return - (html|xhtml|atom|rss2|rdf|comment|export). + * @return string|void The HTML content for the generator. + */ + function get_the_generator($type = '') + { + } + /** + * Outputs the HTML checked attribute. + * + * Compares the first two arguments and if identical marks as checked. + * + * @since 1.0.0 + * + * @param mixed $checked One of the values to compare. + * @param mixed $current Optional. The other value to compare if not just true. + * Default true. + * @param bool $display Optional. Whether to echo or just return the string. + * Default true. + * @return string HTML attribute or empty string. + */ + function checked($checked, $current = \true, $display = \true) + { + } + /** + * Outputs the HTML selected attribute. + * + * Compares the first two arguments and if identical marks as selected. + * + * @since 1.0.0 + * + * @param mixed $selected One of the values to compare. + * @param mixed $current Optional. The other value to compare if not just true. + * Default true. + * @param bool $display Optional. Whether to echo or just return the string. + * Default true. + * @return string HTML attribute or empty string. + */ + function selected($selected, $current = \true, $display = \true) + { + } + /** + * Outputs the HTML disabled attribute. + * + * Compares the first two arguments and if identical marks as disabled. + * + * @since 3.0.0 + * + * @param mixed $disabled One of the values to compare. + * @param mixed $current Optional. The other value to compare if not just true. + * Default true. + * @param bool $display Optional. Whether to echo or just return the string. + * Default true. + * @return string HTML attribute or empty string. + */ + function disabled($disabled, $current = \true, $display = \true) + { + } + /** + * Outputs the HTML readonly attribute. + * + * Compares the first two arguments and if identical marks as readonly. + * + * @since 5.9.0 + * + * @param mixed $readonly_value One of the values to compare. + * @param mixed $current Optional. The other value to compare if not just true. + * Default true. + * @param bool $display Optional. Whether to echo or just return the string. + * Default true. + * @return string HTML attribute or empty string. + */ + function wp_readonly($readonly_value, $current = \true, $display = \true) + { + } + /** + * Private helper function for checked, selected, disabled and readonly. + * + * Compares the first two arguments and if identical marks as `$type`. + * + * @since 2.8.0 + * @access private + * + * @param mixed $helper One of the values to compare. + * @param mixed $current The other value to compare if not just true. + * @param bool $display Whether to echo or just return the string. + * @param string $type The type of checked|selected|disabled|readonly we are doing. + * @return string HTML attribute or empty string. + */ + function __checked_selected_helper($helper, $current, $display, $type) + { + } + /** + * Assigns a visual indicator for required form fields. + * + * @since 6.1.0 + * + * @return string Indicator glyph wrapped in a `span` tag. + */ + function wp_required_field_indicator() + { + } + /** + * Creates a message to explain required form fields. + * + * @since 6.1.0 + * + * @return string Message text and glyph wrapped in a `span` tag. + */ + function wp_required_field_message() + { + } + /** + * Default settings for heartbeat. + * + * Outputs the nonce used in the heartbeat XHR. + * + * @since 3.6.0 + * + * @param array $settings + * @return array Heartbeat settings. + */ + function wp_heartbeat_settings($settings) + { + } + /** + * APIs to interact with global settings & styles. + * + * @package WordPress + */ + /** + * Gets the settings resulting of merging core, theme, and user data. + * + * @since 5.9.0 + * + * @param array $path Path to the specific setting to retrieve. Optional. + * If empty, will return all settings. + * @param array $context { + * Metadata to know where to retrieve the $path from. Optional. + * + * @type string $block_name Which block to retrieve the settings from. + * If empty, it'll return the settings for the global context. + * @type string $origin Which origin to take data from. + * Valid values are 'all' (core, theme, and user) or 'base' (core and theme). + * If empty or unknown, 'all' is used. + * } + * @return mixed The settings array or individual setting value to retrieve. + * @phpstan-param array{ + * block_name?: string, + * origin?: string, + * } $context + */ + function wp_get_global_settings($path = array(), $context = array()) + { + } + /** + * Gets the styles resulting of merging core, theme, and user data. + * + * @since 5.9.0 + * @since 6.3.0 the internal link format "var:preset|color|secondary" is resolved + * to "var(--wp--preset--font-size--small)" so consumers don't have to. + * @since 6.3.0 `transforms` is now usable in the `context` parameter. In case [`transforms`]['resolve_variables'] + * is defined, variables are resolved to their value in the styles. + * + * @param array $path Path to the specific style to retrieve. Optional. + * If empty, will return all styles. + * @param array $context { + * Metadata to know where to retrieve the $path from. Optional. + * + * @type string $block_name Which block to retrieve the styles from. + * If empty, it'll return the styles for the global context. + * @type string $origin Which origin to take data from. + * Valid values are 'all' (core, theme, and user) or 'base' (core and theme). + * If empty or unknown, 'all' is used. + * @type array $transforms Which transformation(s) to apply. + * Valid value is array( 'resolve-variables' ). + * If defined, variables are resolved to their value in the styles. + * } + * @return mixed The styles array or individual style value to retrieve. + * @phpstan-param array{ + * block_name?: string, + * origin?: string, + * transforms?: array, + * } $context + */ + function wp_get_global_styles($path = array(), $context = array()) + { + } + /** + * Returns the stylesheet resulting of merging core, theme, and user data. + * + * @since 5.9.0 + * @since 6.1.0 Added 'base-layout-styles' support. + * @since 6.6.0 Resolves relative paths in theme.json styles to theme absolute paths. + * + * @param array $types Optional. Types of styles to load. + * It accepts as values 'variables', 'presets', 'styles', 'base-layout-styles'. + * If empty, it'll load the following: + * - for themes without theme.json: 'variables', 'presets', 'base-layout-styles'. + * - for themes with theme.json: 'variables', 'presets', 'styles'. + * @return string Stylesheet. + */ + function wp_get_global_stylesheet($types = array()) + { + } + /** + * Gets the global styles custom CSS from theme.json. + * + * @since 6.2.0 + * + * @return string The global styles custom CSS. + */ + function wp_get_global_styles_custom_css() + { + } + /** + * Adds global style rules to the inline style for each block. + * + * @since 6.1.0 + * + * @global WP_Styles $wp_styles + */ + function wp_add_global_styles_for_blocks() + { + } + /** + * Gets the block name from a given theme.json path. + * + * @since 6.3.0 + * @access private + * + * @param array $path An array of keys describing the path to a property in theme.json. + * @return string Identified block name, or empty string if none found. + */ + function wp_get_block_name_from_theme_json_path($path) + { + } + /** + * Checks whether a theme or its parent has a theme.json file. + * + * @since 6.2.0 + * + * @return bool Returns true if theme or its parent has a theme.json file, false otherwise. + */ + function wp_theme_has_theme_json() + { + } + /** + * Cleans the caches under the theme_json group. + * + * @since 6.2.0 + */ + function wp_clean_theme_json_cache() + { + } + /** + * Returns the current theme's wanted patterns (slugs) to be + * registered from Pattern Directory. + * + * @since 6.3.0 + * + * @return string[] + */ + function wp_get_theme_directory_pattern_slugs() + { + } + /** + * Returns the metadata for the custom templates defined by the theme via theme.json. + * + * @since 6.4.0 + * + * @return array Associative array of `$template_name => $template_data` pairs, + * with `$template_data` having "title" and "postTypes" fields. + */ + function wp_get_theme_data_custom_templates() + { + } + /** + * Returns the metadata for the template parts defined by the theme. + * + * @since 6.4.0 + * + * @return array Associative array of `$part_name => $part_data` pairs, + * with `$part_data` having "title" and "area" fields. + */ + function wp_get_theme_data_template_parts() + { + } + /** + * Determines the CSS selector for the block type and property provided, + * returning it if available. + * + * @since 6.3.0 + * + * @param WP_Block_Type $block_type The block's type. + * @param string|array $target The desired selector's target, `root` or array path. + * @param boolean $fallback Whether to fall back to broader selector. + * + * @return string|null CSS selector or `null` if no selector available. + */ + function wp_get_block_css_selector($block_type, $target = 'root', $fallback = \false) + { + } + /** + * Core HTTP Request API + * + * Standardizes the HTTP requests for WordPress. Handles cookies, gzip encoding and decoding, chunk + * decoding, if HTTP 1.1 and various other difficult HTTP protocol implementations. + * + * @package WordPress + * @subpackage HTTP + */ + /** + * Returns the initialized WP_Http Object + * + * @since 2.7.0 + * @access private + * + * @return WP_Http HTTP Transport object. + */ + function _wp_http_get_object() + { + } + /** + * Retrieves the raw response from a safe HTTP request. + * + * This function is ideal when the HTTP request is being made to an arbitrary + * URL. The URL, and every URL it redirects to, are validated with wp_http_validate_url() + * to avoid Server Side Request Forgery attacks (SSRF). + * + * @since 3.6.0 + * + * @see wp_remote_request() For more information on the response array format. + * @see WP_Http::request() For default arguments information. + * @see wp_http_validate_url() For more information about how the URL is validated. + * + * @link https://owasp.org/www-community/attacks/Server_Side_Request_Forgery + * + * @param string $url URL to retrieve. + * @param array $args Optional. Request arguments. Default empty array. + * See WP_Http::request() for information on accepted arguments. + * @return array|WP_Error The response or WP_Error on failure. + * @phpstan-param array{ + * method?: string, + * timeout?: float, + * redirection?: int, + * httpversion?: string, + * user-agent?: string, + * reject_unsafe_urls?: bool, + * blocking?: bool, + * headers?: string|array, + * cookies?: array, + * body?: string|array, + * compress?: bool, + * decompress?: bool, + * sslverify?: bool, + * sslcertificates?: string, + * stream?: bool, + * filename?: string, + * limit_response_size?: int, + * } $args See WP_Http::request() + * @phpstan-return array{headers: \WpOrg\Requests\Utility\CaseInsensitiveDictionary, body: string, response: array{code: int,message: string}, cookies: array<int, \WP_Http_Cookie>, filename: string|null, http_response: \WP_HTTP_Requests_Response}|\WP_Error + */ + function wp_safe_remote_request($url, $args = array()) + { + } + /** + * Retrieves the raw response from a safe HTTP request using the GET method. + * + * This function is ideal when the HTTP request is being made to an arbitrary + * URL. The URL, and every URL it redirects to, are validated with wp_http_validate_url() + * to avoid Server Side Request Forgery attacks (SSRF). + * + * @since 3.6.0 + * + * @see wp_remote_request() For more information on the response array format. + * @see WP_Http::request() For default arguments information. + * @see wp_http_validate_url() For more information about how the URL is validated. + * + * @link https://owasp.org/www-community/attacks/Server_Side_Request_Forgery + * + * @param string $url URL to retrieve. + * @param array $args Optional. Request arguments. Default empty array. + * See WP_Http::request() for information on accepted arguments. + * @return array|WP_Error The response or WP_Error on failure. + * @phpstan-param array{ + * method?: string, + * timeout?: float, + * redirection?: int, + * httpversion?: string, + * user-agent?: string, + * reject_unsafe_urls?: bool, + * blocking?: bool, + * headers?: string|array, + * cookies?: array, + * body?: string|array, + * compress?: bool, + * decompress?: bool, + * sslverify?: bool, + * sslcertificates?: string, + * stream?: bool, + * filename?: string, + * limit_response_size?: int, + * } $args See WP_Http::request() + * @phpstan-return array{headers: \WpOrg\Requests\Utility\CaseInsensitiveDictionary, body: string, response: array{code: int,message: string}, cookies: array<int, \WP_Http_Cookie>, filename: string|null, http_response: \WP_HTTP_Requests_Response}|\WP_Error + */ + function wp_safe_remote_get($url, $args = array()) + { + } + /** + * Retrieves the raw response from a safe HTTP request using the POST method. + * + * This function is ideal when the HTTP request is being made to an arbitrary + * URL. The URL, and every URL it redirects to, are validated with wp_http_validate_url() + * to avoid Server Side Request Forgery attacks (SSRF). + * + * @since 3.6.0 + * + * @see wp_remote_request() For more information on the response array format. + * @see WP_Http::request() For default arguments information. + * @see wp_http_validate_url() For more information about how the URL is validated. + * + * @link https://owasp.org/www-community/attacks/Server_Side_Request_Forgery + * + * @param string $url URL to retrieve. + * @param array $args Optional. Request arguments. Default empty array. + * See WP_Http::request() for information on accepted arguments. + * @return array|WP_Error The response or WP_Error on failure. + * @phpstan-param array{ + * method?: string, + * timeout?: float, + * redirection?: int, + * httpversion?: string, + * user-agent?: string, + * reject_unsafe_urls?: bool, + * blocking?: bool, + * headers?: string|array, + * cookies?: array, + * body?: string|array, + * compress?: bool, + * decompress?: bool, + * sslverify?: bool, + * sslcertificates?: string, + * stream?: bool, + * filename?: string, + * limit_response_size?: int, + * } $args See WP_Http::request() + * @phpstan-return array{headers: \WpOrg\Requests\Utility\CaseInsensitiveDictionary, body: string, response: array{code: int,message: string}, cookies: array<int, \WP_Http_Cookie>, filename: string|null, http_response: \WP_HTTP_Requests_Response}|\WP_Error + */ + function wp_safe_remote_post($url, $args = array()) + { + } + /** + * Retrieves the raw response from a safe HTTP request using the HEAD method. + * + * This function is ideal when the HTTP request is being made to an arbitrary + * URL. The URL, and every URL it redirects to, are validated with wp_http_validate_url() + * to avoid Server Side Request Forgery attacks (SSRF). + * + * @since 3.6.0 + * + * @see wp_remote_request() For more information on the response array format. + * @see WP_Http::request() For default arguments information. + * @see wp_http_validate_url() For more information about how the URL is validated. + * + * @link https://owasp.org/www-community/attacks/Server_Side_Request_Forgery + * + * @param string $url URL to retrieve. + * @param array $args Optional. Request arguments. Default empty array. + * See WP_Http::request() for information on accepted arguments. + * @return array|WP_Error The response or WP_Error on failure. + * @phpstan-param array{ + * method?: string, + * timeout?: float, + * redirection?: int, + * httpversion?: string, + * user-agent?: string, + * reject_unsafe_urls?: bool, + * blocking?: bool, + * headers?: string|array, + * cookies?: array, + * body?: string|array, + * compress?: bool, + * decompress?: bool, + * sslverify?: bool, + * sslcertificates?: string, + * stream?: bool, + * filename?: string, + * limit_response_size?: int, + * } $args See WP_Http::request() + * @phpstan-return array{headers: \WpOrg\Requests\Utility\CaseInsensitiveDictionary, body: string, response: array{code: int,message: string}, cookies: array<int, \WP_Http_Cookie>, filename: string|null, http_response: \WP_HTTP_Requests_Response}|\WP_Error + */ + function wp_safe_remote_head($url, $args = array()) + { + } + /** + * Performs an HTTP request and returns its response. + * + * There are other API functions available which abstract away the HTTP method: + * + * - Default 'GET' for wp_remote_get() + * - Default 'POST' for wp_remote_post() + * - Default 'HEAD' for wp_remote_head() + * + * @since 2.7.0 + * + * @see WP_Http::request() For information on default arguments. + * + * @param string $url URL to retrieve. + * @param array $args Optional. Request arguments. Default empty array. + * See WP_Http::request() for information on accepted arguments. + * @return array|WP_Error { + * The response array or a WP_Error on failure. + * + * @type string[] $headers Array of response headers keyed by their name. + * @type string $body Response body. + * @type array $response { + * Data about the HTTP response. + * + * @type int|false $code HTTP response code. + * @type string|false $message HTTP response message. + * } + * @type WP_HTTP_Cookie[] $cookies Array of response cookies. + * @type WP_HTTP_Requests_Response|null $http_response Raw HTTP response object. + * } + * @phpstan-return \WP_Error|array{ + * headers: string[], + * body: string, + * response: array{ + * code: int|false, + * message: string|false, + * }, + * cookies: WP_HTTP_Cookie[], + * http_response: WP_HTTP_Requests_Response|null, + * } + * @phpstan-param array{ + * method?: string, + * timeout?: float, + * redirection?: int, + * httpversion?: string, + * user-agent?: string, + * reject_unsafe_urls?: bool, + * blocking?: bool, + * headers?: string|array, + * cookies?: array, + * body?: string|array, + * compress?: bool, + * decompress?: bool, + * sslverify?: bool, + * sslcertificates?: string, + * stream?: bool, + * filename?: string, + * limit_response_size?: int, + * } $args See WP_Http::request() + * @phpstan-return array{headers: \WpOrg\Requests\Utility\CaseInsensitiveDictionary, body: string, response: array{code: int,message: string}, cookies: array<int, \WP_Http_Cookie>, filename: string|null, http_response: \WP_HTTP_Requests_Response}|\WP_Error + */ + function wp_remote_request($url, $args = array()) + { + } + /** + * Performs an HTTP request using the GET method and returns its response. + * + * @since 2.7.0 + * + * @see wp_remote_request() For more information on the response array format. + * @see WP_Http::request() For default arguments information. + * + * @param string $url URL to retrieve. + * @param array $args Optional. Request arguments. Default empty array. + * See WP_Http::request() for information on accepted arguments. + * @return array|WP_Error The response or WP_Error on failure. + * @phpstan-param array{ + * method?: string, + * timeout?: float, + * redirection?: int, + * httpversion?: string, + * user-agent?: string, + * reject_unsafe_urls?: bool, + * blocking?: bool, + * headers?: string|array, + * cookies?: array, + * body?: string|array, + * compress?: bool, + * decompress?: bool, + * sslverify?: bool, + * sslcertificates?: string, + * stream?: bool, + * filename?: string, + * limit_response_size?: int, + * } $args See WP_Http::request() + * @phpstan-return array{headers: \WpOrg\Requests\Utility\CaseInsensitiveDictionary, body: string, response: array{code: int,message: string}, cookies: array<int, \WP_Http_Cookie>, filename: string|null, http_response: \WP_HTTP_Requests_Response}|\WP_Error + */ + function wp_remote_get($url, $args = array()) + { + } + /** + * Performs an HTTP request using the POST method and returns its response. + * + * @since 2.7.0 + * + * @see wp_remote_request() For more information on the response array format. + * @see WP_Http::request() For default arguments information. + * + * @param string $url URL to retrieve. + * @param array $args Optional. Request arguments. Default empty array. + * See WP_Http::request() for information on accepted arguments. + * @return array|WP_Error The response or WP_Error on failure. + * @phpstan-param array{ + * method?: string, + * timeout?: float, + * redirection?: int, + * httpversion?: string, + * user-agent?: string, + * reject_unsafe_urls?: bool, + * blocking?: bool, + * headers?: string|array, + * cookies?: array, + * body?: string|array, + * compress?: bool, + * decompress?: bool, + * sslverify?: bool, + * sslcertificates?: string, + * stream?: bool, + * filename?: string, + * limit_response_size?: int, + * } $args See WP_Http::request() + * @phpstan-return array{headers: \WpOrg\Requests\Utility\CaseInsensitiveDictionary, body: string, response: array{code: int,message: string}, cookies: array<int, \WP_Http_Cookie>, filename: string|null, http_response: \WP_HTTP_Requests_Response}|\WP_Error + */ + function wp_remote_post($url, $args = array()) + { + } + /** + * Performs an HTTP request using the HEAD method and returns its response. + * + * @since 2.7.0 + * + * @see wp_remote_request() For more information on the response array format. + * @see WP_Http::request() For default arguments information. + * + * @param string $url URL to retrieve. + * @param array $args Optional. Request arguments. Default empty array. + * See WP_Http::request() for information on accepted arguments. + * @return array|WP_Error The response or WP_Error on failure. + * @phpstan-param array{ + * method?: string, + * timeout?: float, + * redirection?: int, + * httpversion?: string, + * user-agent?: string, + * reject_unsafe_urls?: bool, + * blocking?: bool, + * headers?: string|array, + * cookies?: array, + * body?: string|array, + * compress?: bool, + * decompress?: bool, + * sslverify?: bool, + * sslcertificates?: string, + * stream?: bool, + * filename?: string, + * limit_response_size?: int, + * } $args See WP_Http::request() + * @phpstan-return array{headers: \WpOrg\Requests\Utility\CaseInsensitiveDictionary, body: string, response: array{code: int,message: string}, cookies: array<int, \WP_Http_Cookie>, filename: string|null, http_response: \WP_HTTP_Requests_Response}|\WP_Error + */ + function wp_remote_head($url, $args = array()) + { + } + /** + * Retrieves only the headers from the raw response. + * + * @since 2.7.0 + * @since 4.6.0 Return value changed from an array to an WpOrg\Requests\Utility\CaseInsensitiveDictionary instance. + * + * @see \WpOrg\Requests\Utility\CaseInsensitiveDictionary + * + * @param array|WP_Error $response HTTP response. + * @return \WpOrg\Requests\Utility\CaseInsensitiveDictionary|array The headers of the response, or empty array + * if incorrect parameter given. + */ + function wp_remote_retrieve_headers($response) + { + } + /** + * Retrieves a single header by name from the raw response. + * + * @since 2.7.0 + * + * @param array|WP_Error $response HTTP response. + * @param string $header Header name to retrieve value from. + * @return array|string The header(s) value(s). Array if multiple headers with the same name are retrieved. + * Empty string if incorrect parameter given, or if the header doesn't exist. + */ + function wp_remote_retrieve_header($response, $header) + { + } + /** + * Retrieves only the response code from the raw response. + * + * Will return an empty string if incorrect parameter value is given. + * + * @since 2.7.0 + * + * @param array|WP_Error $response HTTP response. + * @return int|string The response code as an integer. Empty string if incorrect parameter given. + */ + function wp_remote_retrieve_response_code($response) + { + } + /** + * Retrieves only the response message from the raw response. + * + * Will return an empty string if incorrect parameter value is given. + * + * @since 2.7.0 + * + * @param array|WP_Error $response HTTP response. + * @return string The response message. Empty string if incorrect parameter given. + */ + function wp_remote_retrieve_response_message($response) + { + } + /** + * Retrieves only the body from the raw response. + * + * @since 2.7.0 + * + * @param array|WP_Error $response HTTP response. + * @return string The body of the response. Empty string if no body or incorrect parameter given. + */ + function wp_remote_retrieve_body($response) + { + } + /** + * Retrieves only the cookies from the raw response. + * + * @since 4.4.0 + * + * @param array|WP_Error $response HTTP response. + * @return WP_Http_Cookie[] An array of `WP_Http_Cookie` objects from the response. + * Empty array if there are none, or the response is a WP_Error. + */ + function wp_remote_retrieve_cookies($response) + { + } + /** + * Retrieves a single cookie by name from the raw response. + * + * @since 4.4.0 + * + * @param array|WP_Error $response HTTP response. + * @param string $name The name of the cookie to retrieve. + * @return WP_Http_Cookie|string The `WP_Http_Cookie` object, or empty string + * if the cookie is not present in the response. + */ + function wp_remote_retrieve_cookie($response, $name) + { + } + /** + * Retrieves a single cookie's value by name from the raw response. + * + * @since 4.4.0 + * + * @param array|WP_Error $response HTTP response. + * @param string $name The name of the cookie to retrieve. + * @return string The value of the cookie, or empty string + * if the cookie is not present in the response. + */ + function wp_remote_retrieve_cookie_value($response, $name) + { + } + /** + * Determines if there is an HTTP Transport that can process this request. + * + * @since 3.2.0 + * + * @param array $capabilities Array of capabilities to test or a wp_remote_request() $args array. + * @param string $url Optional. If given, will check if the URL requires SSL and adds + * that requirement to the capabilities array. + * + * @return bool + */ + function wp_http_supports($capabilities = array(), $url = \null) + { + } + /** + * Gets the HTTP Origin of the current request. + * + * @since 3.4.0 + * + * @return string URL of the origin. Empty string if no origin. + */ + function get_http_origin() + { + } + /** + * Retrieves list of allowed HTTP origins. + * + * @since 3.4.0 + * + * @return string[] Array of origin URLs. + */ + function get_allowed_http_origins() + { + } + /** + * Determines if the HTTP origin is an authorized one. + * + * @since 3.4.0 + * + * @param string|null $origin Origin URL. If not provided, the value of get_http_origin() is used. + * @return string Origin URL if allowed, empty string if not. + */ + function is_allowed_http_origin($origin = \null) + { + } + /** + * Sends Access-Control-Allow-Origin and related headers if the current request + * is from an allowed origin. + * + * If the request is an OPTIONS request, the script exits with either access + * control headers sent, or a 403 response if the origin is not allowed. For + * other request methods, you will receive a return value. + * + * @since 3.4.0 + * + * @return string|false Returns the origin URL if headers are sent. Returns false + * if headers are not sent. + */ + function send_origin_headers() + { + } + /** + * Validates a URL for safe use in the HTTP API. + * + * Examples of URLs that are considered unsafe: + * + * - ftp://example.com/caniload.php - Invalid protocol - only http and https are allowed. + * - http:///example.com/caniload.php - Malformed URL. + * - http://user:pass@example.com/caniload.php - Login information. + * - http://exampleeeee.com/caniload.php - Invalid hostname, as the IP cannot be looked up in DNS. + * + * Examples of URLs that are considered unsafe by default: + * + * - http://192.168.0.1/caniload.php - IPs from LAN networks. + * This can be changed with the {@see 'http_request_host_is_external'} filter. + * - http://198.143.164.252:81/caniload.php - By default, only 80, 443, and 8080 ports are allowed. + * This can be changed with the {@see 'http_allowed_safe_ports'} filter. + * + * @since 3.5.2 + * + * @param string $url Request URL. + * @return string|false URL or false on failure. + */ + function wp_http_validate_url($url) + { + } + /** + * Marks allowed redirect hosts safe for HTTP requests as well. + * + * Attached to the {@see 'http_request_host_is_external'} filter. + * + * @since 3.6.0 + * + * @param bool $is_external + * @param string $host + * @return bool + */ + function allowed_http_request_hosts($is_external, $host) + { + } + /** + * Adds any domain in a multisite installation for safe HTTP requests to the + * allowed list. + * + * Attached to the {@see 'http_request_host_is_external'} filter. + * + * @since 3.6.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param bool $is_external + * @param string $host + * @return bool + */ + function ms_allowed_http_request_hosts($is_external, $host) + { + } + /** + * A wrapper for PHP's parse_url() function that handles consistency in the return values + * across PHP versions. + * + * PHP 5.4.7 expanded parse_url()'s ability to handle non-absolute URLs, including + * schemeless and relative URLs with "://" in the path. This function works around + * those limitations providing a standard output on PHP 5.2~5.4+. + * + * Secondly, across various PHP versions, schemeless URLs containing a ":" in the query + * are being handled inconsistently. This function works around those differences as well. + * + * @since 4.4.0 + * @since 4.7.0 The `$component` parameter was added for parity with PHP's `parse_url()`. + * + * @link https://www.php.net/manual/en/function.parse-url.php + * + * @param string $url The URL to parse. + * @param int $component The specific component to retrieve. Use one of the PHP + * predefined constants to specify which one. + * Defaults to -1 (= return all parts as an array). + * @return mixed False on parse failure; Array of URL components on success; + * When a specific component has been requested: null if the component + * doesn't exist in the given URL; a string or - in the case of + * PHP_URL_PORT - integer when it does. See parse_url()'s return values. + */ + function wp_parse_url($url, $component = -1) + { + } + /** + * Retrieves a specific component from a parsed URL array. + * + * @internal + * + * @since 4.7.0 + * @access private + * + * @link https://www.php.net/manual/en/function.parse-url.php + * + * @param array|false $url_parts The parsed URL. Can be false if the URL failed to parse. + * @param int $component The specific component to retrieve. Use one of the PHP + * predefined constants to specify which one. + * Defaults to -1 (= return all parts as an array). + * @return mixed False on parse failure; Array of URL components on success; + * When a specific component has been requested: null if the component + * doesn't exist in the given URL; a string or - in the case of + * PHP_URL_PORT - integer when it does. See parse_url()'s return values. + */ + function _get_component_from_parsed_url_array($url_parts, $component = -1) + { + } + /** + * Translates a PHP_URL_* constant to the named array keys PHP uses. + * + * @internal + * + * @since 4.7.0 + * @access private + * + * @link https://www.php.net/manual/en/url.constants.php + * + * @param int $constant PHP_URL_* constant. + * @return string|false The named key or false. + */ + function _wp_translate_php_url_constant_to_key($constant) + { + } + /** + * HTTPS detection functions. + * + * @package WordPress + * @since 5.7.0 + */ + /** + * Checks whether the website is using HTTPS. + * + * This is based on whether both the home and site URL are using HTTPS. + * + * @since 5.7.0 + * @see wp_is_home_url_using_https() + * @see wp_is_site_url_using_https() + * + * @return bool True if using HTTPS, false otherwise. + */ + function wp_is_using_https() + { + } + /** + * Checks whether the current site URL is using HTTPS. + * + * @since 5.7.0 + * @see home_url() + * + * @return bool True if using HTTPS, false otherwise. + */ + function wp_is_home_url_using_https() + { + } + /** + * Checks whether the current site's URL where WordPress is stored is using HTTPS. + * + * This checks the URL where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) + * are accessible. + * + * @since 5.7.0 + * @see site_url() + * + * @return bool True if using HTTPS, false otherwise. + */ + function wp_is_site_url_using_https() + { + } + /** + * Checks whether HTTPS is supported for the server and domain. + * + * @since 5.7.0 + * + * @return bool True if HTTPS is supported, false otherwise. + */ + function wp_is_https_supported() + { + } + /** + * Runs a remote HTTPS request to detect whether HTTPS supported, and stores potential errors. + * + * This internal function is called by a regular Cron hook to ensure HTTPS support is detected and maintained. + * + * @since 6.4.0 + * @access private + */ + function wp_get_https_detection_errors() + { + } + /** + * Checks whether a given HTML string is likely an output from this WordPress site. + * + * This function attempts to check for various common WordPress patterns whether they are included in the HTML string. + * Since any of these actions may be disabled through third-party code, this function may also return null to indicate + * that it was not possible to determine ownership. + * + * @since 5.7.0 + * @access private + * + * @param string $html Full HTML output string, e.g. from a HTTP response. + * @return bool|null True/false for whether HTML was generated by this site, null if unable to determine. + */ + function wp_is_local_html_output($html) + { + } + /** + * HTTPS migration functions. + * + * @package WordPress + * @since 5.7.0 + */ + /** + * Checks whether WordPress should replace old HTTP URLs to the site with their HTTPS counterpart. + * + * If a WordPress site had its URL changed from HTTP to HTTPS, by default this will return `true`, causing WordPress to + * add frontend filters to replace insecure site URLs that may be present in older database content. The + * {@see 'wp_should_replace_insecure_home_url'} filter can be used to modify that behavior. + * + * @since 5.7.0 + * + * @return bool True if insecure URLs should replaced, false otherwise. + */ + function wp_should_replace_insecure_home_url() + { + } + /** + * Replaces insecure HTTP URLs to the site in the given content, if configured to do so. + * + * This function replaces all occurrences of the HTTP version of the site's URL with its HTTPS counterpart, if + * determined via {@see wp_should_replace_insecure_home_url()}. + * + * @since 5.7.0 + * + * @param string $content Content to replace URLs in. + * @return string Filtered content. + */ + function wp_replace_insecure_home_url($content) + { + } + /** + * Update the 'home' and 'siteurl' option to use the HTTPS variant of their URL. + * + * If this update does not result in WordPress recognizing that the site is now using HTTPS (e.g. due to constants + * overriding the URLs used), the changes will be reverted. In such a case the function will return false. + * + * @since 5.7.0 + * + * @return bool True on success, false on failure. + */ + function wp_update_urls_to_https() + { + } + /** + * Updates the 'https_migration_required' option if needed when the given URL has been updated from HTTP to HTTPS. + * + * If this is a fresh site, a migration will not be required, so the option will be set as `false`. + * + * This is hooked into the {@see 'update_option_home'} action. + * + * @since 5.7.0 + * @access private + * + * @param mixed $old_url Previous value of the URL option. + * @param mixed $new_url New value of the URL option. + * @phpstan-return void + */ + function wp_update_https_migration_required($old_url, $new_url) + { + } + /** + * Interactivity API: Functions and hooks + * + * @package WordPress + * @subpackage Interactivity API + * @since 6.5.0 + */ + /** + * Retrieves the main WP_Interactivity_API instance. + * + * It provides access to the WP_Interactivity_API instance, creating one if it + * doesn't exist yet. + * + * @since 6.5.0 + * + * @global WP_Interactivity_API $wp_interactivity + * + * @return WP_Interactivity_API The main WP_Interactivity_API instance. + */ + function wp_interactivity() : \WP_Interactivity_API + { + } + /** + * Processes the interactivity directives contained within the HTML content + * and updates the markup accordingly. + * + * @since 6.5.0 + * + * @param string $html The HTML content to process. + * @return string The processed HTML content. It returns the original content when the HTML contains unbalanced tags. + */ + function wp_interactivity_process_directives(string $html) : string + { + } + /** + * Gets and/or sets the initial state of an Interactivity API store for a + * given namespace. + * + * If state for that store namespace already exists, it merges the new + * provided state with the existing one. + * + * The namespace can be omitted inside derived state getters, using the + * namespace where the getter is defined. + * + * @since 6.5.0 + * @since 6.6.0 The namespace can be omitted when called inside derived state getters. + * + * @param string $store_namespace The unique store namespace identifier. + * @param array $state Optional. The array that will be merged with the existing state for the specified + * store namespace. + * @return array The state for the specified store namespace. This will be the updated state if a $state argument was + * provided. + */ + function wp_interactivity_state(?string $store_namespace = \null, array $state = array()) : array + { + } + /** + * Gets and/or sets the configuration of the Interactivity API for a given + * store namespace. + * + * If configuration for that store namespace exists, it merges the new + * provided configuration with the existing one. + * + * @since 6.5.0 + * + * @param string $store_namespace The unique store namespace identifier. + * @param array $config Optional. The array that will be merged with the existing configuration for the + * specified store namespace. + * @return array The configuration for the specified store namespace. This will be the updated configuration if a + * $config argument was provided. + */ + function wp_interactivity_config(string $store_namespace, array $config = array()) : array + { + } + /** + * Generates a `data-wp-context` directive attribute by encoding a context + * array. + * + * This helper function simplifies the creation of `data-wp-context` directives + * by providing a way to pass an array of data, which encodes into a JSON string + * safe for direct use as a HTML attribute value. + * + * Example: + * + * <div <?php echo wp_interactivity_data_wp_context( array( 'isOpen' => true, 'count' => 0 ) ); ?>> + * + * @since 6.5.0 + * + * @param array $context The array of context data to encode. + * @param string $store_namespace Optional. The unique store namespace identifier. + * @return string A complete `data-wp-context` directive with a JSON encoded value representing the context array and + * the store namespace if specified. + */ + function wp_interactivity_data_wp_context(array $context, string $store_namespace = '') : string + { + } + /** + * Gets the current Interactivity API context for a given namespace. + * + * The function should be used only during directive processing. If the + * `$store_namespace` parameter is omitted, it uses the current namespace value + * on the internal namespace stack. + * + * It returns an empty array when the specified namespace is not defined. + * + * @since 6.6.0 + * + * @param string $store_namespace Optional. The unique store namespace identifier. + * @return array The context for the specified store namespace. + */ + function wp_interactivity_get_context(?string $store_namespace = \null) : array + { + } + function get_file($path) + { + } + /** + * Filters text content and strips out disallowed HTML. + * + * This function makes sure that only the allowed HTML element names, attribute + * names, attribute values, and HTML entities will occur in the given text string. + * + * This function expects unslashed data. + * + * @see wp_kses_post() for specifically filtering post content and fields. + * @see wp_allowed_protocols() for the default allowed protocols in link URLs. + * + * @since 1.0.0 + * + * @param string $content Text content to filter. + * @param array[]|string $allowed_html An array of allowed HTML elements and attributes, + * or a context name such as 'post'. See wp_kses_allowed_html() + * for the list of accepted context names. + * @param string[] $allowed_protocols Optional. Array of allowed URL protocols. + * Defaults to the result of wp_allowed_protocols(). + * @return string Filtered content containing only the allowed HTML. + */ + function wp_kses($content, $allowed_html, $allowed_protocols = array()) + { + } + /** + * Filters one HTML attribute and ensures its value is allowed. + * + * This function can escape data in some situations where `wp_kses()` must strip the whole attribute. + * + * @since 4.2.3 + * + * @param string $attr The 'whole' attribute, including name and value. + * @param string $element The HTML element name to which the attribute belongs. + * @return string Filtered attribute. + */ + function wp_kses_one_attr($attr, $element) + { + } + /** + * Returns an array of allowed HTML tags and attributes for a given context. + * + * @since 3.5.0 + * @since 5.0.1 `form` removed as allowable HTML tag. + * + * @global array $allowedposttags + * @global array $allowedtags + * @global array $allowedentitynames + * + * @param string|array $context The context for which to retrieve tags. Allowed values are 'post', + * 'strip', 'data', 'entities', or the name of a field filter such as + * 'pre_user_description', or an array of allowed HTML elements and attributes. + * @return array Array of allowed HTML tags and their allowed attributes. + */ + function wp_kses_allowed_html($context = '') + { + } + /** + * You add any KSES hooks here. + * + * There is currently only one KSES WordPress hook, {@see 'pre_kses'}, and it is called here. + * All parameters are passed to the hooks and expected to receive a string. + * + * @since 1.0.0 + * + * @param string $content Content to filter through KSES. + * @param array[]|string $allowed_html An array of allowed HTML elements and attributes, + * or a context name such as 'post'. See wp_kses_allowed_html() + * for the list of accepted context names. + * @param string[] $allowed_protocols Array of allowed URL protocols. + * @return string Filtered content through {@see 'pre_kses'} hook. + */ + function wp_kses_hook($content, $allowed_html, $allowed_protocols) + { + } + /** + * Returns the version number of KSES. + * + * @since 1.0.0 + * + * @return string KSES version number. + */ + function wp_kses_version() + { + } + /** + * Searches for HTML tags, no matter how malformed. + * + * It also matches stray `>` characters. + * + * @since 1.0.0 + * @since 6.6.0 Recognize additional forms of invalid HTML which convert into comments. + * + * @global array[]|string $pass_allowed_html An array of allowed HTML elements and attributes, + * or a context name such as 'post'. + * @global string[] $pass_allowed_protocols Array of allowed URL protocols. + * + * @param string $content Content to filter. + * @param array[]|string $allowed_html An array of allowed HTML elements and attributes, + * or a context name such as 'post'. See wp_kses_allowed_html() + * for the list of accepted context names. + * @param string[] $allowed_protocols Array of allowed URL protocols. + * @return string Content with fixed HTML tags + */ + function wp_kses_split($content, $allowed_html, $allowed_protocols) + { + } + /** + * Returns an array of HTML attribute names whose value contains a URL. + * + * This function returns a list of all HTML attributes that must contain + * a URL according to the HTML specification. + * + * This list includes URI attributes both allowed and disallowed by KSES. + * + * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes + * + * @since 5.0.1 + * + * @return string[] HTML attribute names whose value contains a URL. + */ + function wp_kses_uri_attributes() + { + } + /** + * Callback for `wp_kses_split()`. + * + * @since 3.1.0 + * @access private + * @ignore + * + * @global array[]|string $pass_allowed_html An array of allowed HTML elements and attributes, + * or a context name such as 'post'. + * @global string[] $pass_allowed_protocols Array of allowed URL protocols. + * + * @param array $matches preg_replace regexp matches + * @return string + */ + function _wp_kses_split_callback($matches) + { + } + /** + * Callback for `wp_kses_split()` for fixing malformed HTML tags. + * + * This function does a lot of work. It rejects some very malformed things like + * `<:::>`. It returns an empty string, if the element isn't allowed (look ma, no + * `strip_tags()`!). Otherwise it splits the tag into an element and an attribute + * list. + * + * After the tag is split into an element and an attribute list, it is run + * through another filter which will remove illegal attributes and once that is + * completed, will be returned. + * + * @access private + * @ignore + * @since 1.0.0 + * @since 6.6.0 Recognize additional forms of invalid HTML which convert into comments. + * + * @param string $content Content to filter. + * @param array[]|string $allowed_html An array of allowed HTML elements and attributes, + * or a context name such as 'post'. See wp_kses_allowed_html() + * for the list of accepted context names. + * @param string[] $allowed_protocols Array of allowed URL protocols. + * + * @return string Fixed HTML element + */ + function wp_kses_split2($content, $allowed_html, $allowed_protocols) + { + } + /** + * Removes all attributes, if none are allowed for this element. + * + * If some are allowed it calls `wp_kses_hair()` to split them further, and then + * it builds up new HTML code from the data that `wp_kses_hair()` returns. It also + * removes `<` and `>` characters, if there are any left. One more thing it does + * is to check if the tag has a closing XHTML slash, and if it does, it puts one + * in the returned code as well. + * + * An array of allowed values can be defined for attributes. If the attribute value + * doesn't fall into the list, the attribute will be removed from the tag. + * + * Attributes can be marked as required. If a required attribute is not present, + * KSES will remove all attributes from the tag. As KSES doesn't match opening and + * closing tags, it's not possible to safely remove the tag itself, the safest + * fallback is to strip all attributes from the tag, instead. + * + * @since 1.0.0 + * @since 5.9.0 Added support for an array of allowed values for attributes. + * Added support for required attributes. + * + * @param string $element HTML element/tag. + * @param string $attr HTML attributes from HTML element to closing HTML element tag. + * @param array[]|string $allowed_html An array of allowed HTML elements and attributes, + * or a context name such as 'post'. See wp_kses_allowed_html() + * for the list of accepted context names. + * @param string[] $allowed_protocols Array of allowed URL protocols. + * @return string Sanitized HTML element. + */ + function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols) + { + } + /** + * Determines whether an attribute is allowed. + * + * @since 4.2.3 + * @since 5.0.0 Added support for `data-*` wildcard attributes. + * + * @param string $name The attribute name. Passed by reference. Returns empty string when not allowed. + * @param string $value The attribute value. Passed by reference. Returns a filtered value. + * @param string $whole The `name=value` input. Passed by reference. Returns filtered input. + * @param string $vless Whether the attribute is valueless. Use 'y' or 'n'. + * @param string $element The name of the element to which this attribute belongs. + * @param array $allowed_html The full list of allowed elements and attributes. + * @return bool Whether or not the attribute is allowed. + */ + function wp_kses_attr_check(&$name, &$value, &$whole, $vless, $element, $allowed_html) + { + } + /** + * Builds an attribute list from string containing attributes. + * + * This function does a lot of work. It parses an attribute list into an array + * with attribute data, and tries to do the right thing even if it gets weird + * input. It will add quotes around attribute values that don't have any quotes + * or apostrophes around them, to make it easier to produce HTML code that will + * conform to W3C's HTML specification. It will also remove bad URL protocols + * from attribute values. It also reduces duplicate attributes by using the + * attribute defined first (`foo='bar' foo='baz'` will result in `foo='bar'`). + * + * @since 1.0.0 + * + * @param string $attr Attribute list from HTML element to closing HTML element tag. + * @param string[] $allowed_protocols Array of allowed URL protocols. + * @return array[] Array of attribute information after parsing. + */ + function wp_kses_hair($attr, $allowed_protocols) + { + } + /** + * Finds all attributes of an HTML element. + * + * Does not modify input. May return "evil" output. + * + * Based on `wp_kses_split2()` and `wp_kses_attr()`. + * + * @since 4.2.3 + * + * @param string $element HTML element. + * @return array|false List of attributes found in the element. Returns false on failure. + */ + function wp_kses_attr_parse($element) + { + } + /** + * Builds an attribute list from string containing attributes. + * + * Does not modify input. May return "evil" output. + * In case of unexpected input, returns false instead of stripping things. + * + * Based on `wp_kses_hair()` but does not return a multi-dimensional array. + * + * @since 4.2.3 + * + * @param string $attr Attribute list from HTML element to closing HTML element tag. + * @return array|false List of attributes found in $attr. Returns false on failure. + */ + function wp_kses_hair_parse($attr) + { + } + /** + * Performs different checks for attribute values. + * + * The currently implemented checks are "maxlen", "minlen", "maxval", "minval", + * and "valueless". + * + * @since 1.0.0 + * + * @param string $value Attribute value. + * @param string $vless Whether the attribute is valueless. Use 'y' or 'n'. + * @param string $checkname What $checkvalue is checking for. + * @param mixed $checkvalue What constraint the value should pass. + * @return bool Whether check passes. + */ + function wp_kses_check_attr_val($value, $vless, $checkname, $checkvalue) + { + } + /** + * Sanitizes a string and removed disallowed URL protocols. + * + * This function removes all non-allowed protocols from the beginning of the + * string. It ignores whitespace and the case of the letters, and it does + * understand HTML entities. It does its work recursively, so it won't be + * fooled by a string like `javascript:javascript:alert(57)`. + * + * @since 1.0.0 + * + * @param string $content Content to filter bad protocols from. + * @param string[] $allowed_protocols Array of allowed URL protocols. + * @return string Filtered content. + */ + function wp_kses_bad_protocol($content, $allowed_protocols) + { + } + /** + * Removes any invalid control characters in a text string. + * + * Also removes any instance of the `\0` string. + * + * @since 1.0.0 + * + * @param string $content Content to filter null characters from. + * @param array $options Set 'slash_zero' => 'keep' when '\0' is allowed. Default is 'remove'. + * @return string Filtered content. + */ + function wp_kses_no_null($content, $options = \null) + { + } + /** + * Strips slashes from in front of quotes. + * + * This function changes the character sequence `\"` to just `"`. It leaves all other + * slashes alone. The quoting from `preg_replace(//e)` requires this. + * + * @since 1.0.0 + * + * @param string $content String to strip slashes from. + * @return string Fixed string with quoted slashes. + */ + function wp_kses_stripslashes($content) + { + } + /** + * Converts the keys of an array to lowercase. + * + * @since 1.0.0 + * + * @param array $inarray Unfiltered array. + * @return array Fixed array with all lowercase keys. + */ + function wp_kses_array_lc($inarray) + { + } + /** + * Handles parsing errors in `wp_kses_hair()`. + * + * The general plan is to remove everything to and including some whitespace, + * but it deals with quotes and apostrophes as well. + * + * @since 1.0.0 + * + * @param string $attr + * @return string + */ + function wp_kses_html_error($attr) + { + } + /** + * Sanitizes content from bad protocols and other characters. + * + * This function searches for URL protocols at the beginning of the string, while + * handling whitespace and HTML entities. + * + * @since 1.0.0 + * + * @param string $content Content to check for bad protocols. + * @param string[] $allowed_protocols Array of allowed URL protocols. + * @param int $count Depth of call recursion to this function. + * @return string Sanitized content. + */ + function wp_kses_bad_protocol_once($content, $allowed_protocols, $count = 1) + { + } + /** + * Callback for `wp_kses_bad_protocol_once()` regular expression. + * + * This function processes URL protocols, checks to see if they're in the + * list of allowed protocols or not, and returns different data depending + * on the answer. + * + * @access private + * @ignore + * @since 1.0.0 + * + * @param string $scheme URI scheme to check against the list of allowed protocols. + * @param string[] $allowed_protocols Array of allowed URL protocols. + * @return string Sanitized content. + */ + function wp_kses_bad_protocol_once2($scheme, $allowed_protocols) + { + } + /** + * Converts and fixes HTML entities. + * + * This function normalizes HTML entities. It will convert `AT&T` to the correct + * `AT&T`, `:` to `:`, `&#XYZZY;` to `&#XYZZY;` and so on. + * + * When `$context` is set to 'xml', HTML entities are converted to their code points. For + * example, `AT&T…&#XYZZY;` is converted to `AT&T…&#XYZZY;`. + * + * @since 1.0.0 + * @since 5.5.0 Added `$context` parameter. + * + * @param string $content Content to normalize entities. + * @param string $context Context for normalization. Can be either 'html' or 'xml'. + * Default 'html'. + * @return string Content with normalized entities. + * @phpstan-param 'html'|'xml' $context + */ + function wp_kses_normalize_entities($content, $context = 'html') + { + } + /** + * Callback for `wp_kses_normalize_entities()` regular expression. + * + * This function only accepts valid named entity references, which are finite, + * case-sensitive, and highly scrutinized by HTML and XML validators. + * + * @since 3.0.0 + * + * @global array $allowedentitynames + * + * @param array $matches preg_replace_callback() matches array. + * @return string Correctly encoded entity. + */ + function wp_kses_named_entities($matches) + { + } + /** + * Callback for `wp_kses_normalize_entities()` regular expression. + * + * This function only accepts valid named entity references, which are finite, + * case-sensitive, and highly scrutinized by XML validators. HTML named entity + * references are converted to their code points. + * + * @since 5.5.0 + * + * @global array $allowedentitynames + * @global array $allowedxmlentitynames + * + * @param array $matches preg_replace_callback() matches array. + * @return string Correctly encoded entity. + */ + function wp_kses_xml_named_entities($matches) + { + } + /** + * Callback for `wp_kses_normalize_entities()` regular expression. + * + * This function helps `wp_kses_normalize_entities()` to only accept 16-bit + * values and nothing more for `&#number;` entities. + * + * @access private + * @ignore + * @since 1.0.0 + * + * @param array $matches `preg_replace_callback()` matches array. + * @return string Correctly encoded entity. + */ + function wp_kses_normalize_entities2($matches) + { + } + /** + * Callback for `wp_kses_normalize_entities()` for regular expression. + * + * This function helps `wp_kses_normalize_entities()` to only accept valid Unicode + * numeric entities in hex form. + * + * @since 2.7.0 + * @access private + * @ignore + * + * @param array $matches `preg_replace_callback()` matches array. + * @return string Correctly encoded entity. + */ + function wp_kses_normalize_entities3($matches) + { + } + /** + * Determines if a Unicode codepoint is valid. + * + * @since 2.7.0 + * + * @param int $i Unicode codepoint. + * @return bool Whether or not the codepoint is a valid Unicode codepoint. + */ + function valid_unicode($i) + { + } + /** + * Converts all numeric HTML entities to their named counterparts. + * + * This function decodes numeric HTML entities (`A` and `A`). + * It doesn't do anything with named entities like `ä`, but we don't + * need them in the allowed URL protocols system anyway. + * + * @since 1.0.0 + * + * @param string $content Content to change entities. + * @return string Content after decoded entities. + */ + function wp_kses_decode_entities($content) + { + } + /** + * Regex callback for `wp_kses_decode_entities()`. + * + * @since 2.9.0 + * @access private + * @ignore + * + * @param array $matches preg match + * @return string + */ + function _wp_kses_decode_entities_chr($matches) + { + } + /** + * Regex callback for `wp_kses_decode_entities()`. + * + * @since 2.9.0 + * @access private + * @ignore + * + * @param array $matches preg match + * @return string + */ + function _wp_kses_decode_entities_chr_hexdec($matches) + { + } + /** + * Sanitize content with allowed HTML KSES rules. + * + * This function expects slashed data. + * + * @since 1.0.0 + * + * @param string $data Content to filter, expected to be escaped with slashes. + * @return string Filtered content. + */ + function wp_filter_kses($data) + { + } + /** + * Sanitize content with allowed HTML KSES rules. + * + * This function expects unslashed data. + * + * @since 2.9.0 + * + * @param string $data Content to filter, expected to not be escaped. + * @return string Filtered content. + */ + function wp_kses_data($data) + { + } + /** + * Sanitizes content for allowed HTML tags for post content. + * + * Post content refers to the page contents of the 'post' type and not `$_POST` + * data from forms. + * + * This function expects slashed data. + * + * @since 2.0.0 + * + * @param string $data Post content to filter, expected to be escaped with slashes. + * @return string Filtered post content with allowed HTML tags and attributes intact. + */ + function wp_filter_post_kses($data) + { + } + /** + * Sanitizes global styles user content removing unsafe rules. + * + * @since 5.9.0 + * + * @param string $data Post content to filter. + * @return string Filtered post content with unsafe rules removed. + */ + function wp_filter_global_styles_post($data) + { + } + /** + * Sanitizes content for allowed HTML tags for post content. + * + * Post content refers to the page contents of the 'post' type and not `$_POST` + * data from forms. + * + * This function expects unslashed data. + * + * @since 2.9.0 + * + * @param string $data Post content to filter. + * @return string Filtered post content with allowed HTML tags and attributes intact. + */ + function wp_kses_post($data) + { + } + /** + * Navigates through an array, object, or scalar, and sanitizes content for + * allowed HTML tags for post content. + * + * @since 4.4.2 + * + * @see map_deep() + * + * @param mixed $data The array, object, or scalar value to inspect. + * @return mixed The filtered content. + */ + function wp_kses_post_deep($data) + { + } + /** + * Strips all HTML from a text string. + * + * This function expects slashed data. + * + * @since 2.1.0 + * + * @param string $data Content to strip all HTML from. + * @return string Filtered content without any HTML. + */ + function wp_filter_nohtml_kses($data) + { + } + /** + * Adds all KSES input form content filters. + * + * All hooks have default priority. The `wp_filter_kses()` function is added to + * the 'pre_comment_content' and 'title_save_pre' hooks. + * + * The `wp_filter_post_kses()` function is added to the 'content_save_pre', + * 'excerpt_save_pre', and 'content_filtered_save_pre' hooks. + * + * @since 2.0.0 + */ + function kses_init_filters() + { + } + /** + * Removes all KSES input form content filters. + * + * A quick procedural method to removing all of the filters that KSES uses for + * content in WordPress Loop. + * + * Does not remove the `kses_init()` function from {@see 'init'} hook (priority is + * default). Also does not remove `kses_init()` function from {@see 'set_current_user'} + * hook (priority is also default). + * + * @since 2.0.6 + */ + function kses_remove_filters() + { + } + /** + * Sets up most of the KSES filters for input form content. + * + * First removes all of the KSES filters in case the current user does not need + * to have KSES filter the content. If the user does not have `unfiltered_html` + * capability, then KSES filters are added. + * + * @since 2.0.0 + */ + function kses_init() + { + } + /** + * Filters an inline style attribute and removes disallowed rules. + * + * @since 2.8.1 + * @since 4.4.0 Added support for `min-height`, `max-height`, `min-width`, and `max-width`. + * @since 4.6.0 Added support for `list-style-type`. + * @since 5.0.0 Added support for `background-image`. + * @since 5.1.0 Added support for `text-transform`. + * @since 5.2.0 Added support for `background-position` and `grid-template-columns`. + * @since 5.3.0 Added support for `grid`, `flex` and `column` layout properties. + * Extended `background-*` support for individual properties. + * @since 5.3.1 Added support for gradient backgrounds. + * @since 5.7.1 Added support for `object-position`. + * @since 5.8.0 Added support for `calc()` and `var()` values. + * @since 6.1.0 Added support for `min()`, `max()`, `minmax()`, `clamp()`, + * nested `var()` values, and assigning values to CSS variables. + * Added support for `object-fit`, `gap`, `column-gap`, `row-gap`, and `flex-wrap`. + * Extended `margin-*` and `padding-*` support for logical properties. + * @since 6.2.0 Added support for `aspect-ratio`, `position`, `top`, `right`, `bottom`, `left`, + * and `z-index` CSS properties. + * @since 6.3.0 Extended support for `filter` to accept a URL and added support for repeat(). + * Added support for `box-shadow`. + * @since 6.4.0 Added support for `writing-mode`. + * @since 6.5.0 Added support for `background-repeat`. + * @since 6.6.0 Added support for `grid-column`, `grid-row`, and `container-type`. + * + * @param string $css A string of CSS rules. + * @param string $deprecated Not used. + * @return string Filtered string of CSS rules. + */ + function safecss_filter_attr($css, $deprecated = '') + { + } + /** + * Helper function to add global attributes to a tag in the allowed HTML list. + * + * @since 3.5.0 + * @since 5.0.0 Added support for `data-*` wildcard attributes. + * @since 6.0.0 Added `dir`, `lang`, and `xml:lang` to global attributes. + * @since 6.3.0 Added `aria-controls`, `aria-current`, and `aria-expanded` attributes. + * @since 6.4.0 Added `aria-live` and `hidden` attributes. + * + * @access private + * @ignore + * + * @param array $value An array of attributes. + * @return array The array of attributes with global attributes added. + */ + function _wp_add_global_attributes($value) + { + } + /** + * Helper function to check if this is a safe PDF URL. + * + * @since 5.9.0 + * @access private + * @ignore + * + * @param string $url The URL to check. + * @return bool True if the URL is safe, false otherwise. + */ + function _wp_kses_allow_pdf_objects($url) + { + } + /** + * Core Translation API + * + * @package WordPress + * @subpackage i18n + * @since 1.2.0 + */ + /** + * Retrieves the current locale. + * + * If the locale is set, then it will filter the locale in the {@see 'locale'} + * filter hook and return the value. + * + * If the locale is not set already, then the WPLANG constant is used if it is + * defined. Then it is filtered through the {@see 'locale'} filter hook and + * the value for the locale global set and the locale is returned. + * + * The process to get the locale should only be done once, but the locale will + * always be filtered using the {@see 'locale'} hook. + * + * @since 1.5.0 + * + * @global string $locale The current locale. + * @global string $wp_local_package Locale code of the package. + * + * @return string The locale of the blog or from the {@see 'locale'} hook. + */ + function get_locale() + { + } + /** + * Retrieves the locale of a user. + * + * If the user has a locale set to a non-empty string then it will be + * returned. Otherwise it returns the locale of get_locale(). + * + * @since 4.7.0 + * + * @param int|WP_User $user User's ID or a WP_User object. Defaults to current user. + * @return string The locale of the user. + */ + function get_user_locale($user = 0) + { + } + /** + * Determines the current locale desired for the request. + * + * @since 5.0.0 + * + * @global string $pagenow The filename of the current screen. + * + * @return string The determined locale. + */ + function determine_locale() + { + } + /** + * Retrieves the translation of $text. + * + * If there is no translation, or the text domain isn't loaded, the original text is returned. + * + * *Note:* Don't use translate() directly, use __() or related functions. + * + * @since 2.2.0 + * @since 5.5.0 Introduced `gettext-{$domain}` filter. + * + * @param string $text Text to translate. + * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. + * Default 'default'. + * @return string Translated text. + */ + function translate($text, $domain = 'default') + { + } + /** + * Removes last item on a pipe-delimited string. + * + * Meant for removing the last item in a string, such as 'Role name|User role'. The original + * string will be returned if no pipe '|' characters are found in the string. + * + * @since 2.8.0 + * + * @param string $text A pipe-delimited string. + * @return string Either $text or everything before the last pipe. + */ + function before_last_bar($text) + { + } + /** + * Retrieves the translation of $text in the context defined in $context. + * + * If there is no translation, or the text domain isn't loaded, the original text is returned. + * + * *Note:* Don't use translate_with_gettext_context() directly, use _x() or related functions. + * + * @since 2.8.0 + * @since 5.5.0 Introduced `gettext_with_context-{$domain}` filter. + * + * @param string $text Text to translate. + * @param string $context Context information for the translators. + * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. + * Default 'default'. + * @return string Translated text on success, original text on failure. + */ + function translate_with_gettext_context($text, $context, $domain = 'default') + { + } + /** + * Retrieves the translation of $text. + * + * If there is no translation, or the text domain isn't loaded, the original text is returned. + * + * @since 2.1.0 + * + * @param string $text Text to translate. + * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. + * Default 'default'. + * @return string Translated text. + */ + function __($text, $domain = 'default') + { + } + /** + * Retrieves the translation of $text and escapes it for safe use in an attribute. + * + * If there is no translation, or the text domain isn't loaded, the original text is returned. + * + * @since 2.8.0 + * + * @param string $text Text to translate. + * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. + * Default 'default'. + * @return string Translated text on success, original text on failure. + */ + function esc_attr__($text, $domain = 'default') + { + } + /** + * Retrieves the translation of $text and escapes it for safe use in HTML output. + * + * If there is no translation, or the text domain isn't loaded, the original text + * is escaped and returned. + * + * @since 2.8.0 + * + * @param string $text Text to translate. + * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. + * Default 'default'. + * @return string Translated text. + */ + function esc_html__($text, $domain = 'default') + { + } + /** + * Displays translated text. + * + * @since 1.2.0 + * + * @param string $text Text to translate. + * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. + * Default 'default'. + */ + function _e($text, $domain = 'default') + { + } + /** + * Displays translated text that has been escaped for safe use in an attribute. + * + * Encodes `< > & " '` (less than, greater than, ampersand, double quote, single quote). + * Will never double encode entities. + * + * If you need the value for use in PHP, use esc_attr__(). + * + * @since 2.8.0 + * + * @param string $text Text to translate. + * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. + * Default 'default'. + */ + function esc_attr_e($text, $domain = 'default') + { + } + /** + * Displays translated text that has been escaped for safe use in HTML output. + * + * If there is no translation, or the text domain isn't loaded, the original text + * is escaped and displayed. + * + * If you need the value for use in PHP, use esc_html__(). + * + * @since 2.8.0 + * + * @param string $text Text to translate. + * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. + * Default 'default'. + */ + function esc_html_e($text, $domain = 'default') + { + } + /** + * Retrieves translated string with gettext context. + * + * Quite a few times, there will be collisions with similar translatable text + * found in more than two places, but with different translated context. + * + * By including the context in the pot file, translators can translate the two + * strings differently. + * + * @since 2.8.0 + * + * @param string $text Text to translate. + * @param string $context Context information for the translators. + * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. + * Default 'default'. + * @return string Translated context string without pipe. + */ + function _x($text, $context, $domain = 'default') + { + } + /** + * Displays translated string with gettext context. + * + * @since 3.0.0 + * + * @param string $text Text to translate. + * @param string $context Context information for the translators. + * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. + * Default 'default'. + */ + function _ex($text, $context, $domain = 'default') + { + } + /** + * Translates string with gettext context, and escapes it for safe use in an attribute. + * + * If there is no translation, or the text domain isn't loaded, the original text + * is escaped and returned. + * + * @since 2.8.0 + * + * @param string $text Text to translate. + * @param string $context Context information for the translators. + * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. + * Default 'default'. + * @return string Translated text. + */ + function esc_attr_x($text, $context, $domain = 'default') + { + } + /** + * Translates string with gettext context, and escapes it for safe use in HTML output. + * + * If there is no translation, or the text domain isn't loaded, the original text + * is escaped and returned. + * + * @since 2.9.0 + * + * @param string $text Text to translate. + * @param string $context Context information for the translators. + * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. + * Default 'default'. + * @return string Translated text. + */ + function esc_html_x($text, $context, $domain = 'default') + { + } + /** + * Translates and retrieves the singular or plural form based on the supplied number. + * + * Used when you want to use the appropriate form of a string based on whether a + * number is singular or plural. + * + * Example: + * + * printf( _n( '%s person', '%s people', $count, 'text-domain' ), number_format_i18n( $count ) ); + * + * @since 2.8.0 + * @since 5.5.0 Introduced `ngettext-{$domain}` filter. + * + * @param string $single The text to be used if the number is singular. + * @param string $plural The text to be used if the number is plural. + * @param int $number The number to compare against to use either the singular or plural form. + * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. + * Default 'default'. + * @return string The translated singular or plural form. + */ + function _n($single, $plural, $number, $domain = 'default') + { + } + /** + * Translates and retrieves the singular or plural form based on the supplied number, with gettext context. + * + * This is a hybrid of _n() and _x(). It supports context and plurals. + * + * Used when you want to use the appropriate form of a string with context based on whether a + * number is singular or plural. + * + * Example of a generic phrase which is disambiguated via the context parameter: + * + * printf( _nx( '%s group', '%s groups', $people, 'group of people', 'text-domain' ), number_format_i18n( $people ) ); + * printf( _nx( '%s group', '%s groups', $animals, 'group of animals', 'text-domain' ), number_format_i18n( $animals ) ); + * + * @since 2.8.0 + * @since 5.5.0 Introduced `ngettext_with_context-{$domain}` filter. + * + * @param string $single The text to be used if the number is singular. + * @param string $plural The text to be used if the number is plural. + * @param int $number The number to compare against to use either the singular or plural form. + * @param string $context Context information for the translators. + * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. + * Default 'default'. + * @return string The translated singular or plural form. + */ + function _nx($single, $plural, $number, $context, $domain = 'default') + { + } + /** + * Registers plural strings in POT file, but does not translate them. + * + * Used when you want to keep structures with translatable plural + * strings and use them later when the number is known. + * + * Example: + * + * $message = _n_noop( '%s post', '%s posts', 'text-domain' ); + * ... + * printf( translate_nooped_plural( $message, $count, 'text-domain' ), number_format_i18n( $count ) ); + * + * @since 2.5.0 + * + * @param string $singular Singular form to be localized. + * @param string $plural Plural form to be localized. + * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. + * Default null. + * @return array { + * Array of translation information for the strings. + * + * @type string $0 Singular form to be localized. No longer used. + * @type string $1 Plural form to be localized. No longer used. + * @type string $singular Singular form to be localized. + * @type string $plural Plural form to be localized. + * @type null $context Context information for the translators. + * @type string|null $domain Text domain. + * } + * @phpstan-return array{ + * 0: string, + * 1: string, + * singular: string, + * plural: string, + * context: null, + * domain: string|null, + * } + */ + function _n_noop($singular, $plural, $domain = \null) + { + } + /** + * Registers plural strings with gettext context in POT file, but does not translate them. + * + * Used when you want to keep structures with translatable plural + * strings and use them later when the number is known. + * + * Example of a generic phrase which is disambiguated via the context parameter: + * + * $messages = array( + * 'people' => _nx_noop( '%s group', '%s groups', 'people', 'text-domain' ), + * 'animals' => _nx_noop( '%s group', '%s groups', 'animals', 'text-domain' ), + * ); + * ... + * $message = $messages[ $type ]; + * printf( translate_nooped_plural( $message, $count, 'text-domain' ), number_format_i18n( $count ) ); + * + * @since 2.8.0 + * + * @param string $singular Singular form to be localized. + * @param string $plural Plural form to be localized. + * @param string $context Context information for the translators. + * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. + * Default null. + * @return array { + * Array of translation information for the strings. + * + * @type string $0 Singular form to be localized. No longer used. + * @type string $1 Plural form to be localized. No longer used. + * @type string $2 Context information for the translators. No longer used. + * @type string $singular Singular form to be localized. + * @type string $plural Plural form to be localized. + * @type string $context Context information for the translators. + * @type string|null $domain Text domain. + * } + * @phpstan-return array{ + * 0: string, + * 1: string, + * 2: string, + * singular: string, + * plural: string, + * context: string, + * domain: string|null, + * } + */ + function _nx_noop($singular, $plural, $context, $domain = \null) + { + } + /** + * Translates and returns the singular or plural form of a string that's been registered + * with _n_noop() or _nx_noop(). + * + * Used when you want to use a translatable plural string once the number is known. + * + * Example: + * + * $message = _n_noop( '%s post', '%s posts', 'text-domain' ); + * ... + * printf( translate_nooped_plural( $message, $count, 'text-domain' ), number_format_i18n( $count ) ); + * + * @since 3.1.0 + * + * @param array $nooped_plural { + * Array that is usually a return value from _n_noop() or _nx_noop(). + * + * @type string $singular Singular form to be localized. + * @type string $plural Plural form to be localized. + * @type string|null $context Context information for the translators. + * @type string|null $domain Text domain. + * } + * @param int $count Number of objects. + * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. If $nooped_plural contains + * a text domain passed to _n_noop() or _nx_noop(), it will override this value. Default 'default'. + * @return string Either $singular or $plural translated text. + * @phpstan-param array{ + * singular?: string, + * plural?: string, + * context?: string|null, + * domain?: string|null, + * } $nooped_plural + */ + function translate_nooped_plural($nooped_plural, $count, $domain = 'default') + { + } + /** + * Loads a .mo file into the text domain $domain. + * + * If the text domain already exists, the translations will be merged. If both + * sets have the same string, the translation from the original value will be taken. + * + * On success, the .mo file will be placed in the $l10n global by $domain + * and will be a MO object. + * + * @since 1.5.0 + * @since 6.1.0 Added the `$locale` parameter. + * + * @global MO[] $l10n An array of all currently loaded text domains. + * @global MO[] $l10n_unloaded An array of all text domains that have been unloaded again. + * @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry. + * + * @param string $domain Text domain. Unique identifier for retrieving translated strings. + * @param string $mofile Path to the .mo file. + * @param string $locale Optional. Locale. Default is the current locale. + * @return bool True on success, false on failure. + */ + function load_textdomain($domain, $mofile, $locale = \null) + { + } + /** + * Unloads translations for a text domain. + * + * @since 3.0.0 + * @since 6.1.0 Added the `$reloadable` parameter. + * + * @global MO[] $l10n An array of all currently loaded text domains. + * @global MO[] $l10n_unloaded An array of all text domains that have been unloaded again. + * + * @param string $domain Text domain. Unique identifier for retrieving translated strings. + * @param bool $reloadable Whether the text domain can be loaded just-in-time again. + * @return bool Whether textdomain was unloaded. + */ + function unload_textdomain($domain, $reloadable = \false) + { + } + /** + * Loads default translated strings based on locale. + * + * Loads the .mo file in WP_LANG_DIR constant path from WordPress root. + * The translated (.mo) file is named based on the locale. + * + * @see load_textdomain() + * + * @since 1.5.0 + * + * @param string $locale Optional. Locale to load. Default is the value of get_locale(). + * @return bool Whether the textdomain was loaded. + */ + function load_default_textdomain($locale = \null) + { + } + /** + * Loads a plugin's translated strings. + * + * If the path is not given then it will be the root of the plugin directory. + * + * The .mo file should be named based on the text domain with a dash, and then the locale exactly. + * + * @since 1.5.0 + * @since 4.6.0 The function now tries to load the .mo file from the languages directory first. + * + * @param string $domain Unique identifier for retrieving translated strings + * @param string|false $deprecated Optional. Deprecated. Use the $plugin_rel_path parameter instead. + * Default false. + * @param string|false $plugin_rel_path Optional. Relative path to WP_PLUGIN_DIR where the .mo file resides. + * Default false. + * @return bool True when textdomain is successfully loaded, false otherwise. + */ + function load_plugin_textdomain($domain, $deprecated = \false, $plugin_rel_path = \false) + { + } + /** + * Loads the translated strings for a plugin residing in the mu-plugins directory. + * + * @since 3.0.0 + * @since 4.6.0 The function now tries to load the .mo file from the languages directory first. + * + * @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry. + * + * @param string $domain Text domain. Unique identifier for retrieving translated strings. + * @param string $mu_plugin_rel_path Optional. Relative to `WPMU_PLUGIN_DIR` directory in which the .mo + * file resides. Default empty string. + * @return bool True when textdomain is successfully loaded, false otherwise. + */ + function load_muplugin_textdomain($domain, $mu_plugin_rel_path = '') + { + } + /** + * Loads the theme's translated strings. + * + * If the current locale exists as a .mo file in the theme's root directory, it + * will be included in the translated strings by the $domain. + * + * The .mo files must be named based on the locale exactly. + * + * @since 1.5.0 + * @since 4.6.0 The function now tries to load the .mo file from the languages directory first. + * + * @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry. + * + * @param string $domain Text domain. Unique identifier for retrieving translated strings. + * @param string|false $path Optional. Path to the directory containing the .mo file. + * Default false. + * @return bool True when textdomain is successfully loaded, false otherwise. + */ + function load_theme_textdomain($domain, $path = \false) + { + } + /** + * Loads the child theme's translated strings. + * + * If the current locale exists as a .mo file in the child theme's + * root directory, it will be included in the translated strings by the $domain. + * + * The .mo files must be named based on the locale exactly. + * + * @since 2.9.0 + * + * @param string $domain Text domain. Unique identifier for retrieving translated strings. + * @param string|false $path Optional. Path to the directory containing the .mo file. + * Default false. + * @return bool True when the theme textdomain is successfully loaded, false otherwise. + */ + function load_child_theme_textdomain($domain, $path = \false) + { + } + /** + * Loads the script translated strings. + * + * @since 5.0.0 + * @since 5.0.2 Uses load_script_translations() to load translation data. + * @since 5.1.0 The `$domain` parameter was made optional. + * + * @see WP_Scripts::set_translations() + * + * @param string $handle Name of the script to register a translation domain to. + * @param string $domain Optional. Text domain. Default 'default'. + * @param string $path Optional. The full file path to the directory containing translation files. + * @return string|false The translated strings in JSON encoding on success, + * false if the script textdomain could not be loaded. + */ + function load_script_textdomain($handle, $domain = 'default', $path = '') + { + } + /** + * Loads the translation data for the given script handle and text domain. + * + * @since 5.0.2 + * + * @param string|false $file Path to the translation file to load. False if there isn't one. + * @param string $handle Name of the script to register a translation domain to. + * @param string $domain The text domain. + * @return string|false The JSON-encoded translated strings for the given script handle and text domain. + * False if there are none. + */ + function load_script_translations($file, $handle, $domain) + { + } + /** + * Loads plugin and theme text domains just-in-time. + * + * When a textdomain is encountered for the first time, we try to load + * the translation file from `wp-content/languages`, removing the need + * to call load_plugin_textdomain() or load_theme_textdomain(). + * + * @since 4.6.0 + * @access private + * + * @global MO[] $l10n_unloaded An array of all text domains that have been unloaded again. + * @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry. + * + * @param string $domain Text domain. Unique identifier for retrieving translated strings. + * @return bool True when the textdomain is successfully loaded, false otherwise. + */ + function _load_textdomain_just_in_time($domain) + { + } + /** + * Returns the Translations instance for a text domain. + * + * If there isn't one, returns empty Translations instance. + * + * @since 2.8.0 + * + * @global MO[] $l10n An array of all currently loaded text domains. + * + * @param string $domain Text domain. Unique identifier for retrieving translated strings. + * @return Translations|NOOP_Translations A Translations instance. + */ + function get_translations_for_domain($domain) + { + } + /** + * Determines whether there are translations for the text domain. + * + * @since 3.0.0 + * + * @global MO[] $l10n An array of all currently loaded text domains. + * + * @param string $domain Text domain. Unique identifier for retrieving translated strings. + * @return bool Whether there are translations. + */ + function is_textdomain_loaded($domain) + { + } + /** + * Translates role name. + * + * Since the role names are in the database and not in the source there + * are dummy gettext calls to get them into the POT file and this function + * properly translates them back. + * + * The before_last_bar() call is needed, because older installations keep the roles + * using the old context format: 'Role name|User role' and just skipping the + * content after the last bar is easier than fixing them in the DB. New installations + * won't suffer from that problem. + * + * @since 2.8.0 + * @since 5.2.0 Added the `$domain` parameter. + * + * @param string $name The role name. + * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. + * Default 'default'. + * @return string Translated role name on success, original name on failure. + */ + function translate_user_role($name, $domain = 'default') + { + } + /** + * Gets all available languages based on the presence of *.mo and *.l10n.php files in a given directory. + * + * The default directory is WP_LANG_DIR. + * + * @since 3.0.0 + * @since 4.7.0 The results are now filterable with the {@see 'get_available_languages'} filter. + * @since 6.5.0 The initial file list is now cached and also takes into account *.l10n.php files. + * + * @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry. + * + * @param string $dir A directory to search for language files. + * Default WP_LANG_DIR. + * @return string[] An array of language codes or an empty array if no languages are present. + * Language codes are formed by stripping the file extension from the language file names. + */ + function get_available_languages($dir = \null) + { + } + /** + * Gets installed translations. + * + * Looks in the wp-content/languages directory for translations of + * plugins or themes. + * + * @since 3.7.0 + * + * @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry. + * + * @param string $type What to search for. Accepts 'plugins', 'themes', 'core'. + * @return array Array of language data. + */ + function wp_get_installed_translations($type) + { + } + /** + * Extracts headers from a PO file. + * + * @since 3.7.0 + * + * @param string $po_file Path to PO file. + * @return string[] Array of PO file header values keyed by header name. + */ + function wp_get_pomo_file_data($po_file) + { + } + /** + * Extracts headers from a PHP translation file. + * + * @since 6.6.0 + * + * @param string $php_file Path to a `.l10n.php` file. + * @return string[] Array of file header values keyed by header name. + */ + function wp_get_l10n_php_file_data($php_file) + { + } + /** + * Displays or returns a Language selector. + * + * @since 4.0.0 + * @since 4.3.0 Introduced the `echo` argument. + * @since 4.7.0 Introduced the `show_option_site_default` argument. + * @since 5.1.0 Introduced the `show_option_en_us` argument. + * @since 5.9.0 Introduced the `explicit_option_en_us` argument. + * + * @see get_available_languages() + * @see wp_get_available_translations() + * + * @param string|array $args { + * Optional. Array or string of arguments for outputting the language selector. + * + * @type string $id ID attribute of the select element. Default 'locale'. + * @type string $name Name attribute of the select element. Default 'locale'. + * @type string[] $languages List of installed languages, contain only the locales. + * Default empty array. + * @type array $translations List of available translations. Default result of + * wp_get_available_translations(). + * @type string $selected Language which should be selected. Default empty. + * @type bool|int $echo Whether to echo the generated markup. Accepts 0, 1, or their + * boolean equivalents. Default 1. + * @type bool $show_available_translations Whether to show available translations. Default true. + * @type bool $show_option_site_default Whether to show an option to fall back to the site's locale. Default false. + * @type bool $show_option_en_us Whether to show an option for English (United States). Default true. + * @type bool $explicit_option_en_us Whether the English (United States) option uses an explicit value of en_US + * instead of an empty value. Default false. + * } + * @return string HTML dropdown list of languages. + * @phpstan-param array{ + * id?: string, + * name?: string, + * languages?: string[], + * translations?: array, + * selected?: string, + * echo?: bool|int, + * show_available_translations?: bool, + * show_option_site_default?: bool, + * show_option_en_us?: bool, + * explicit_option_en_us?: bool, + * } $args + */ + function wp_dropdown_languages($args = array()) + { + } + /** + * Determines whether the current locale is right-to-left (RTL). + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 3.0.0 + * + * @global WP_Locale $wp_locale WordPress date and time locale object. + * + * @return bool Whether locale is RTL. + */ + function is_rtl() + { + } + /** + * Switches the translations according to the given locale. + * + * @since 4.7.0 + * + * @global WP_Locale_Switcher $wp_locale_switcher WordPress locale switcher object. + * + * @param string $locale The locale. + * @return bool True on success, false on failure. + */ + function switch_to_locale($locale) + { + } + /** + * Switches the translations according to the given user's locale. + * + * @since 6.2.0 + * + * @global WP_Locale_Switcher $wp_locale_switcher WordPress locale switcher object. + * + * @param int $user_id User ID. + * @return bool True on success, false on failure. + */ + function switch_to_user_locale($user_id) + { + } + /** + * Restores the translations according to the previous locale. + * + * @since 4.7.0 + * + * @global WP_Locale_Switcher $wp_locale_switcher WordPress locale switcher object. + * + * @return string|false Locale on success, false on error. + */ + function restore_previous_locale() + { + } + /** + * Restores the translations according to the original locale. + * + * @since 4.7.0 + * + * @global WP_Locale_Switcher $wp_locale_switcher WordPress locale switcher object. + * + * @return string|false Locale on success, false on error. + */ + function restore_current_locale() + { + } + /** + * Determines whether switch_to_locale() is in effect. + * + * @since 4.7.0 + * + * @global WP_Locale_Switcher $wp_locale_switcher WordPress locale switcher object. + * + * @return bool True if the locale has been switched, false otherwise. + */ + function is_locale_switched() + { + } + /** + * Translates the provided settings value using its i18n schema. + * + * @since 5.9.0 + * @access private + * + * @param string|string[]|array[]|object $i18n_schema I18n schema for the setting. + * @param string|string[]|array[] $settings Value for the settings. + * @param string $textdomain Textdomain to use with translations. + * + * @return string|string[]|array[] Translated settings. + */ + function translate_settings_using_i18n_schema($i18n_schema, $settings, $textdomain) + { + } + /** + * Retrieves the list item separator based on the locale. + * + * @since 6.0.0 + * + * @global WP_Locale $wp_locale WordPress date and time locale object. + * + * @return string Locale-specific list item separator. + */ + function wp_get_list_item_separator() + { + } + /** + * Retrieves the word count type based on the locale. + * + * @since 6.2.0 + * + * @global WP_Locale $wp_locale WordPress date and time locale object. + * + * @return string Locale-specific word count type. Possible values are `characters_excluding_spaces`, + * `characters_including_spaces`, or `words`. Defaults to `words`. + */ + function wp_get_word_count_type() + { + } + /** + * WordPress Link Template Functions + * + * @package WordPress + * @subpackage Template + */ + /** + * Displays the permalink for the current post. + * + * @since 1.2.0 + * @since 4.4.0 Added the `$post` parameter. + * + * @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`. + */ + function the_permalink($post = 0) + { + } + /** + * Retrieves a trailing-slashed string if the site is set for adding trailing slashes. + * + * Conditionally adds a trailing slash if the permalink structure has a trailing + * slash, strips the trailing slash if not. The string is passed through the + * {@see 'user_trailingslashit'} filter. Will remove trailing slash from string, if + * site is not set to have them. + * + * @since 2.2.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param string $url URL with or without a trailing slash. + * @param string $type_of_url Optional. The type of URL being considered (e.g. single, category, etc) + * for use in the filter. Default empty string. + * @return string The URL with the trailing slash appended or stripped. + */ + function user_trailingslashit($url, $type_of_url = '') + { + } + /** + * Displays the permalink anchor for the current post. + * + * The permalink mode title will use the post title for the 'a' element 'id' + * attribute. The id mode uses 'post-' with the post ID for the 'id' attribute. + * + * @since 0.71 + * + * @param string $mode Optional. Permalink mode. Accepts 'title' or 'id'. Default 'id'. + * @phpstan-param 'title'|'id' $mode + */ + function permalink_anchor($mode = 'id') + { + } + /** + * Determine whether post should always use a plain permalink structure. + * + * @since 5.7.0 + * + * @param WP_Post|int|null $post Optional. Post ID or post object. Defaults to global $post. + * @param bool|null $sample Optional. Whether to force consideration based on sample links. + * If omitted, a sample link is generated if a post object is passed + * with the filter property set to 'sample'. + * @return bool Whether to use a plain permalink structure. + */ + function wp_force_plain_post_permalink($post = \null, $sample = \null) + { + } + /** + * Retrieves the full permalink for the current post or post ID. + * + * This function is an alias for get_permalink(). + * + * @since 3.9.0 + * + * @see get_permalink() + * + * @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`. + * @param bool $leavename Optional. Whether to keep post name or page name. Default false. + * @return string|false The permalink URL. False if the post does not exist. + * @phpstan-return ($post is \WP_Post ? string : string|false) + */ + function get_the_permalink($post = 0, $leavename = \false) + { + } + /** + * Retrieves the full permalink for the current post or post ID. + * + * @since 1.0.0 + * + * @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`. + * @param bool $leavename Optional. Whether to keep post name or page name. Default false. + * @return string|false The permalink URL. False if the post does not exist. + * @phpstan-return ($post is \WP_Post ? string : string|false) + */ + function get_permalink($post = 0, $leavename = \false) + { + } + /** + * Retrieves the permalink for a post of a custom post type. + * + * @since 3.0.0 + * @since 6.1.0 Returns false if the post does not exist. + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`. + * @param bool $leavename Optional. Whether to keep post name. Default false. + * @param bool $sample Optional. Is it a sample permalink. Default false. + * @return string|false The post permalink URL. False if the post does not exist. + * @phpstan-return ($post is \WP_Post ? string : string|false) + */ + function get_post_permalink($post = 0, $leavename = \false, $sample = \false) + { + } + /** + * Retrieves the permalink for the current page or page ID. + * + * Respects page_on_front. Use this one. + * + * @since 1.5.0 + * + * @param int|WP_Post $post Optional. Post ID or object. Default uses the global `$post`. + * @param bool $leavename Optional. Whether to keep the page name. Default false. + * @param bool $sample Optional. Whether it should be treated as a sample permalink. + * Default false. + * @return string The page permalink. + */ + function get_page_link($post = \false, $leavename = \false, $sample = \false) + { + } + /** + * Retrieves the page permalink. + * + * Ignores page_on_front. Internal use only. + * + * @since 2.1.0 + * @access private + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param int|WP_Post $post Optional. Post ID or object. Default uses the global `$post`. + * @param bool $leavename Optional. Whether to keep the page name. Default false. + * @param bool $sample Optional. Whether it should be treated as a sample permalink. + * Default false. + * @return string The page permalink. + */ + function _get_page_link($post = \false, $leavename = \false, $sample = \false) + { + } + /** + * Retrieves the permalink for an attachment. + * + * This can be used in the WordPress Loop or outside of it. + * + * @since 2.0.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param int|WP_Post $post Optional. Post ID or object. Default uses the global `$post`. + * @param bool $leavename Optional. Whether to keep the page name. Default false. + * @return string The attachment permalink. + */ + function get_attachment_link($post = \null, $leavename = \false) + { + } + /** + * Retrieves the permalink for the year archives. + * + * @since 1.5.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param int|false $year Integer of year. False for current year. + * @return string The permalink for the specified year archive. + */ + function get_year_link($year) + { + } + /** + * Retrieves the permalink for the month archives with year. + * + * @since 1.0.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param int|false $year Integer of year. False for current year. + * @param int|false $month Integer of month. False for current month. + * @return string The permalink for the specified month and year archive. + */ + function get_month_link($year, $month) + { + } + /** + * Retrieves the permalink for the day archives with year and month. + * + * @since 1.0.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param int|false $year Integer of year. False for current year. + * @param int|false $month Integer of month. False for current month. + * @param int|false $day Integer of day. False for current day. + * @return string The permalink for the specified day, month, and year archive. + */ + function get_day_link($year, $month, $day) + { + } + /** + * Displays the permalink for the feed type. + * + * @since 3.0.0 + * + * @param string $anchor The link's anchor text. + * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. + * Default is the value of get_default_feed(). + */ + function the_feed_link($anchor, $feed = '') + { + } + /** + * Retrieves the permalink for the feed type. + * + * @since 1.5.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. + * Default is the value of get_default_feed(). + * @return string The feed permalink. + */ + function get_feed_link($feed = '') + { + } + /** + * Retrieves the permalink for the post comments feed. + * + * @since 2.2.0 + * + * @param int $post_id Optional. Post ID. Default is the ID of the global `$post`. + * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. + * Default is the value of get_default_feed(). + * @return string The permalink for the comments feed for the given post on success, empty string on failure. + */ + function get_post_comments_feed_link($post_id = 0, $feed = '') + { + } + /** + * Displays the comment feed link for a post. + * + * Prints out the comment feed link for a post. Link text is placed in the + * anchor. If no link text is specified, default text is used. If no post ID is + * specified, the current post is used. + * + * @since 2.5.0 + * + * @param string $link_text Optional. Descriptive link text. Default 'Comments Feed'. + * @param int $post_id Optional. Post ID. Default is the ID of the global `$post`. + * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. + * Default is the value of get_default_feed(). + */ + function post_comments_feed_link($link_text = '', $post_id = '', $feed = '') + { + } + /** + * Retrieves the feed link for a given author. + * + * Returns a link to the feed for all posts by a given author. A specific feed + * can be requested or left blank to get the default feed. + * + * @since 2.5.0 + * + * @param int $author_id Author ID. + * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. + * Default is the value of get_default_feed(). + * @return string Link to the feed for the author specified by $author_id. + */ + function get_author_feed_link($author_id, $feed = '') + { + } + /** + * Retrieves the feed link for a category. + * + * Returns a link to the feed for all posts in a given category. A specific feed + * can be requested or left blank to get the default feed. + * + * @since 2.5.0 + * + * @param int|WP_Term|object $cat The ID or category object whose feed link will be retrieved. + * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. + * Default is the value of get_default_feed(). + * @return string Link to the feed for the category specified by `$cat`. + */ + function get_category_feed_link($cat, $feed = '') + { + } + /** + * Retrieves the feed link for a term. + * + * Returns a link to the feed for all posts in a given term. A specific feed + * can be requested or left blank to get the default feed. + * + * @since 3.0.0 + * + * @param int|WP_Term|object $term The ID or term object whose feed link will be retrieved. + * @param string $taxonomy Optional. Taxonomy of `$term_id`. + * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. + * Default is the value of get_default_feed(). + * @return string|false Link to the feed for the term specified by `$term` and `$taxonomy`. + */ + function get_term_feed_link($term, $taxonomy = '', $feed = '') + { + } + /** + * Retrieves the permalink for a tag feed. + * + * @since 2.3.0 + * + * @param int|WP_Term|object $tag The ID or term object whose feed link will be retrieved. + * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. + * Default is the value of get_default_feed(). + * @return string The feed permalink for the given tag. + */ + function get_tag_feed_link($tag, $feed = '') + { + } + /** + * Retrieves the edit link for a tag. + * + * @since 2.7.0 + * + * @param int|WP_Term|object $tag The ID or term object whose edit link will be retrieved. + * @param string $taxonomy Optional. Taxonomy slug. Default 'post_tag'. + * @return string The edit tag link URL for the given tag. + */ + function get_edit_tag_link($tag, $taxonomy = 'post_tag') + { + } + /** + * Displays or retrieves the edit link for a tag with formatting. + * + * @since 2.7.0 + * + * @param string $link Optional. Anchor text. If empty, default is 'Edit This'. Default empty. + * @param string $before Optional. Display before edit link. Default empty. + * @param string $after Optional. Display after edit link. Default empty. + * @param WP_Term $tag Optional. Term object. If null, the queried object will be inspected. + * Default null. + */ + function edit_tag_link($link = '', $before = '', $after = '', $tag = \null) + { + } + /** + * Retrieves the URL for editing a given term. + * + * @since 3.1.0 + * @since 4.5.0 The `$taxonomy` parameter was made optional. + * + * @param int|WP_Term|object $term The ID or term object whose edit link will be retrieved. + * @param string $taxonomy Optional. Taxonomy. Defaults to the taxonomy of the term identified + * by `$term`. + * @param string $object_type Optional. The object type. Used to highlight the proper post type + * menu on the linked page. Defaults to the first object_type associated + * with the taxonomy. + * @return string|null The edit term link URL for the given term, or null on failure. + */ + function get_edit_term_link($term, $taxonomy = '', $object_type = '') + { + } + /** + * Displays or retrieves the edit term link with formatting. + * + * @since 3.1.0 + * + * @param string $link Optional. Anchor text. If empty, default is 'Edit This'. Default empty. + * @param string $before Optional. Display before edit link. Default empty. + * @param string $after Optional. Display after edit link. Default empty. + * @param int|WP_Term|null $term Optional. Term ID or object. If null, the queried object will be inspected. Default null. + * @param bool $display Optional. Whether or not to echo the return. Default true. + * @return string|void HTML content. + * @phpstan-return ($display is true ? void : string|void) + */ + function edit_term_link($link = '', $before = '', $after = '', $term = \null, $display = \true) + { + } + /** + * Retrieves the permalink for a search. + * + * @since 3.0.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param string $query Optional. The query string to use. If empty the current query is used. Default empty. + * @return string The search permalink. + */ + function get_search_link($query = '') + { + } + /** + * Retrieves the permalink for the search results feed. + * + * @since 2.5.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param string $search_query Optional. Search query. Default empty. + * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. + * Default is the value of get_default_feed(). + * @return string The search results feed permalink. + */ + function get_search_feed_link($search_query = '', $feed = '') + { + } + /** + * Retrieves the permalink for the search results comments feed. + * + * @since 2.5.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param string $search_query Optional. Search query. Default empty. + * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. + * Default is the value of get_default_feed(). + * @return string The comments feed search results permalink. + */ + function get_search_comments_feed_link($search_query = '', $feed = '') + { + } + /** + * Retrieves the permalink for a post type archive. + * + * @since 3.1.0 + * @since 4.5.0 Support for posts was added. + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param string $post_type Post type. + * @return string|false The post type archive permalink. False if the post type + * does not exist or does not have an archive. + */ + function get_post_type_archive_link($post_type) + { + } + /** + * Retrieves the permalink for a post type archive feed. + * + * @since 3.1.0 + * + * @param string $post_type Post type. + * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. + * Default is the value of get_default_feed(). + * @return string|false The post type feed permalink. False if the post type + * does not exist or does not have an archive. + */ + function get_post_type_archive_feed_link($post_type, $feed = '') + { + } + /** + * Retrieves the URL used for the post preview. + * + * Allows additional query args to be appended. + * + * @since 4.4.0 + * + * @param int|WP_Post $post Optional. Post ID or `WP_Post` object. Defaults to global `$post`. + * @param array $query_args Optional. Array of additional query args to be appended to the link. + * Default empty array. + * @param string $preview_link Optional. Base preview link to be used if it should differ from the + * post permalink. Default empty. + * @return string|null URL used for the post preview, or null if the post does not exist. + */ + function get_preview_post_link($post = \null, $query_args = array(), $preview_link = '') + { + } + /** + * Retrieves the edit post link for post. + * + * Can be used within the WordPress loop or outside of it. Can be used with + * pages, posts, attachments, revisions, global styles, templates, and template parts. + * + * @since 2.3.0 + * @since 6.3.0 Adds custom link for wp_navigation post types. + * Adds custom links for wp_template_part and wp_template post types. + * + * @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`. + * @param string $context Optional. How to output the '&' character. Default '&'. + * @return string|null The edit post link for the given post. Null if the post type does not exist + * or does not allow an editing UI. + */ + function get_edit_post_link($post = 0, $context = 'display') + { + } + /** + * Displays the edit post link for post. + * + * @since 1.0.0 + * @since 4.4.0 The `$css_class` argument was added. + * + * @param string $text Optional. Anchor text. If null, default is 'Edit This'. Default null. + * @param string $before Optional. Display before edit link. Default empty. + * @param string $after Optional. Display after edit link. Default empty. + * @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`. + * @param string $css_class Optional. Add custom class to link. Default 'post-edit-link'. + * @phpstan-return void + */ + function edit_post_link($text = \null, $before = '', $after = '', $post = 0, $css_class = 'post-edit-link') + { + } + /** + * Retrieves the delete posts link for post. + * + * Can be used within the WordPress loop or outside of it, with any post type. + * + * @since 2.9.0 + * + * @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`. + * @param string $deprecated Not used. + * @param bool $force_delete Optional. Whether to bypass Trash and force deletion. Default false. + * @return string|void The delete post link URL for the given post. + */ + function get_delete_post_link($post = 0, $deprecated = '', $force_delete = \false) + { + } + /** + * Retrieves the edit comment link. + * + * @since 2.3.0 + * + * @param int|WP_Comment $comment_id Optional. Comment ID or WP_Comment object. + * @return string|void The edit comment link URL for the given comment. + */ + function get_edit_comment_link($comment_id = 0) + { + } + /** + * Displays the edit comment link with formatting. + * + * @since 1.0.0 + * + * @param string $text Optional. Anchor text. If null, default is 'Edit This'. Default null. + * @param string $before Optional. Display before edit link. Default empty. + * @param string $after Optional. Display after edit link. Default empty. + * @phpstan-return void + */ + function edit_comment_link($text = \null, $before = '', $after = '') + { + } + /** + * Displays the edit bookmark link. + * + * @since 2.7.0 + * + * @param int|stdClass $link Optional. Bookmark ID. Default is the ID of the current bookmark. + * @return string|void The edit bookmark link URL. + */ + function get_edit_bookmark_link($link = 0) + { + } + /** + * Displays the edit bookmark link anchor content. + * + * @since 2.7.0 + * + * @param string $link Optional. Anchor text. If empty, default is 'Edit This'. Default empty. + * @param string $before Optional. Display before edit link. Default empty. + * @param string $after Optional. Display after edit link. Default empty. + * @param int $bookmark Optional. Bookmark ID. Default is the current bookmark. + * @phpstan-return void + */ + function edit_bookmark_link($link = '', $before = '', $after = '', $bookmark = \null) + { + } + /** + * Retrieves the edit user link. + * + * @since 3.5.0 + * + * @param int $user_id Optional. User ID. Defaults to the current user. + * @return string URL to edit user page or empty string. + */ + function get_edit_user_link($user_id = \null) + { + } + // + // Navigation links. + // + /** + * Retrieves the previous post that is adjacent to the current post. + * + * @since 1.5.0 + * + * @param bool $in_same_term Optional. Whether post should be in the same taxonomy term. + * Default false. + * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. + * Default empty. + * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'. + * @return WP_Post|null|string Post object if successful. Null if global `$post` is not set. + * Empty string if no corresponding post exists. + */ + function get_previous_post($in_same_term = \false, $excluded_terms = '', $taxonomy = 'category') + { + } + /** + * Retrieves the next post that is adjacent to the current post. + * + * @since 1.5.0 + * + * @param bool $in_same_term Optional. Whether post should be in the same taxonomy term. + * Default false. + * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. + * Default empty. + * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'. + * @return WP_Post|null|string Post object if successful. Null if global `$post` is not set. + * Empty string if no corresponding post exists. + */ + function get_next_post($in_same_term = \false, $excluded_terms = '', $taxonomy = 'category') + { + } + /** + * Retrieves the adjacent post. + * + * Can either be next or previous post. + * + * @since 2.5.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param bool $in_same_term Optional. Whether post should be in the same taxonomy term. + * Default false. + * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. + * Default empty string. + * @param bool $previous Optional. Whether to retrieve previous post. + * Default true. + * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'. + * @return WP_Post|null|string Post object if successful. Null if global `$post` is not set. + * Empty string if no corresponding post exists. + */ + function get_adjacent_post($in_same_term = \false, $excluded_terms = '', $previous = \true, $taxonomy = 'category') + { + } + /** + * Retrieves the adjacent post relational link. + * + * Can either be next or previous post relational link. + * + * @since 2.8.0 + * + * @param string $title Optional. Link title format. Default '%title'. + * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term. + * Default false. + * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. + * Default empty. + * @param bool $previous Optional. Whether to display link to previous or next post. + * Default true. + * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'. + * @return string|void The adjacent post relational link URL. + */ + function get_adjacent_post_rel_link($title = '%title', $in_same_term = \false, $excluded_terms = '', $previous = \true, $taxonomy = 'category') + { + } + /** + * Displays the relational links for the posts adjacent to the current post. + * + * @since 2.8.0 + * + * @param string $title Optional. Link title format. Default '%title'. + * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term. + * Default false. + * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. + * Default empty. + * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'. + */ + function adjacent_posts_rel_link($title = '%title', $in_same_term = \false, $excluded_terms = '', $taxonomy = 'category') + { + } + /** + * Displays relational links for the posts adjacent to the current post for single post pages. + * + * This is meant to be attached to actions like 'wp_head'. Do not call this directly in plugins + * or theme templates. + * + * @since 3.0.0 + * @since 5.6.0 No longer used in core. + * + * @see adjacent_posts_rel_link() + * @phpstan-return void + */ + function adjacent_posts_rel_link_wp_head() + { + } + /** + * Displays the relational link for the next post adjacent to the current post. + * + * @since 2.8.0 + * + * @see get_adjacent_post_rel_link() + * + * @param string $title Optional. Link title format. Default '%title'. + * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term. + * Default false. + * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. + * Default empty. + * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'. + */ + function next_post_rel_link($title = '%title', $in_same_term = \false, $excluded_terms = '', $taxonomy = 'category') + { + } + /** + * Displays the relational link for the previous post adjacent to the current post. + * + * @since 2.8.0 + * + * @see get_adjacent_post_rel_link() + * + * @param string $title Optional. Link title format. Default '%title'. + * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term. + * Default false. + * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. + * Default true. + * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'. + */ + function prev_post_rel_link($title = '%title', $in_same_term = \false, $excluded_terms = '', $taxonomy = 'category') + { + } + /** + * Retrieves the boundary post. + * + * Boundary being either the first or last post by publish date within the constraints specified + * by `$in_same_term` or `$excluded_terms`. + * + * @since 2.8.0 + * + * @param bool $in_same_term Optional. Whether returned post should be in the same taxonomy term. + * Default false. + * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. + * Default empty. + * @param bool $start Optional. Whether to retrieve first or last post. + * Default true. + * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'. + * @return array|null Array containing the boundary post object if successful, null otherwise. + */ + function get_boundary_post($in_same_term = \false, $excluded_terms = '', $start = \true, $taxonomy = 'category') + { + } + /** + * Retrieves the previous post link that is adjacent to the current post. + * + * @since 3.7.0 + * + * @param string $format Optional. Link anchor format. Default '« %link'. + * @param string $link Optional. Link permalink format. Default '%title'. + * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term. + * Default false. + * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. + * Default empty. + * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'. + * @return string The link URL of the previous post in relation to the current post. + */ + function get_previous_post_link($format = '« %link', $link = '%title', $in_same_term = \false, $excluded_terms = '', $taxonomy = 'category') + { + } + /** + * Displays the previous post link that is adjacent to the current post. + * + * @since 1.5.0 + * + * @see get_previous_post_link() + * + * @param string $format Optional. Link anchor format. Default '« %link'. + * @param string $link Optional. Link permalink format. Default '%title'. + * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term. + * Default false. + * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. + * Default empty. + * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'. + */ + function previous_post_link($format = '« %link', $link = '%title', $in_same_term = \false, $excluded_terms = '', $taxonomy = 'category') + { + } + /** + * Retrieves the next post link that is adjacent to the current post. + * + * @since 3.7.0 + * + * @param string $format Optional. Link anchor format. Default '« %link'. + * @param string $link Optional. Link permalink format. Default '%title'. + * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term. + * Default false. + * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. + * Default empty. + * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'. + * @return string The link URL of the next post in relation to the current post. + */ + function get_next_post_link($format = '%link »', $link = '%title', $in_same_term = \false, $excluded_terms = '', $taxonomy = 'category') + { + } + /** + * Displays the next post link that is adjacent to the current post. + * + * @since 1.5.0 + * + * @see get_next_post_link() + * + * @param string $format Optional. Link anchor format. Default '« %link'. + * @param string $link Optional. Link permalink format. Default '%title'. + * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term. + * Default false. + * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. + * Default empty. + * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'. + */ + function next_post_link($format = '%link »', $link = '%title', $in_same_term = \false, $excluded_terms = '', $taxonomy = 'category') + { + } + /** + * Retrieves the adjacent post link. + * + * Can be either next post link or previous. + * + * @since 3.7.0 + * + * @param string $format Link anchor format. + * @param string $link Link permalink format. + * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term. + * Default false. + * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded terms IDs. + * Default empty. + * @param bool $previous Optional. Whether to display link to previous or next post. + * Default true. + * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'. + * @return string The link URL of the previous or next post in relation to the current post. + */ + function get_adjacent_post_link($format, $link, $in_same_term = \false, $excluded_terms = '', $previous = \true, $taxonomy = 'category') + { + } + /** + * Displays the adjacent post link. + * + * Can be either next post link or previous. + * + * @since 2.5.0 + * + * @param string $format Link anchor format. + * @param string $link Link permalink format. + * @param bool $in_same_term Optional. Whether link should be in the same taxonomy term. + * Default false. + * @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded category IDs. + * Default empty. + * @param bool $previous Optional. Whether to display link to previous or next post. + * Default true. + * @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'. + */ + function adjacent_post_link($format, $link, $in_same_term = \false, $excluded_terms = '', $previous = \true, $taxonomy = 'category') + { + } + /** + * Retrieves the link for a page number. + * + * @since 1.5.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param int $pagenum Optional. Page number. Default 1. + * @param bool $escape Optional. Whether to escape the URL for display, with esc_url(). + * If set to false, prepares the URL with sanitize_url(). Default true. + * @return string The link URL for the given page number. + */ + function get_pagenum_link($pagenum = 1, $escape = \true) + { + } + /** + * Retrieves the next posts page link. + * + * Backported from 2.1.3 to 2.0.10. + * + * @since 2.0.10 + * + * @global int $paged + * + * @param int $max_page Optional. Max pages. Default 0. + * @return string|void The link URL for next posts page. + */ + function get_next_posts_page_link($max_page = 0) + { + } + /** + * Displays or retrieves the next posts page link. + * + * @since 0.71 + * + * @param int $max_page Optional. Max pages. Default 0. + * @param bool $display Optional. Whether to echo the link. Default true. + * @return string|void The link URL for next posts page if `$display = false`. + * @phpstan-return ($display is true ? void : string) + */ + function next_posts($max_page = 0, $display = \true) + { + } + /** + * Retrieves the next posts page link. + * + * @since 2.7.0 + * + * @global int $paged + * @global WP_Query $wp_query WordPress Query object. + * + * @param string $label Content for link text. + * @param int $max_page Optional. Max pages. Default 0. + * @return string|void HTML-formatted next posts page link. + */ + function get_next_posts_link($label = \null, $max_page = 0) + { + } + /** + * Displays the next posts page link. + * + * @since 0.71 + * + * @param string $label Content for link text. + * @param int $max_page Optional. Max pages. Default 0. + */ + function next_posts_link($label = \null, $max_page = 0) + { + } + /** + * Retrieves the previous posts page link. + * + * Will only return string, if not on a single page or post. + * + * Backported to 2.0.10 from 2.1.3. + * + * @since 2.0.10 + * + * @global int $paged + * + * @return string|void The link for the previous posts page. + */ + function get_previous_posts_page_link() + { + } + /** + * Displays or retrieves the previous posts page link. + * + * @since 0.71 + * + * @param bool $display Optional. Whether to echo the link. Default true. + * @return string|void The previous posts page link if `$display = false`. + * @phpstan-return ($display is true ? void : string) + */ + function previous_posts($display = \true) + { + } + /** + * Retrieves the previous posts page link. + * + * @since 2.7.0 + * + * @global int $paged + * + * @param string $label Optional. Previous page link text. + * @return string|void HTML-formatted previous page link. + */ + function get_previous_posts_link($label = \null) + { + } + /** + * Displays the previous posts page link. + * + * @since 0.71 + * + * @param string $label Optional. Previous page link text. + */ + function previous_posts_link($label = \null) + { + } + /** + * Retrieves the post pages link navigation for previous and next pages. + * + * @since 2.8.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param string|array $args { + * Optional. Arguments to build the post pages link navigation. + * + * @type string $sep Separator character. Default '—'. + * @type string $prelabel Link text to display for the previous page link. + * Default '« Previous Page'. + * @type string $nxtlabel Link text to display for the next page link. + * Default 'Next Page »'. + * } + * @return string The posts link navigation. + * @phpstan-param array{ + * sep?: string, + * prelabel?: string, + * nxtlabel?: string, + * } $args + */ + function get_posts_nav_link($args = array()) + { + } + /** + * Displays the post pages link navigation for previous and next pages. + * + * @since 0.71 + * + * @param string $sep Optional. Separator for posts navigation links. Default empty. + * @param string $prelabel Optional. Label for previous pages. Default empty. + * @param string $nxtlabel Optional Label for next pages. Default empty. + */ + function posts_nav_link($sep = '', $prelabel = '', $nxtlabel = '') + { + } + /** + * Retrieves the navigation to next/previous post, when applicable. + * + * @since 4.1.0 + * @since 4.4.0 Introduced the `in_same_term`, `excluded_terms`, and `taxonomy` arguments. + * @since 5.3.0 Added the `aria_label` parameter. + * @since 5.5.0 Added the `class` parameter. + * + * @param array $args { + * Optional. Default post navigation arguments. Default empty array. + * + * @type string $prev_text Anchor text to display in the previous post link. + * Default '%title'. + * @type string $next_text Anchor text to display in the next post link. + * Default '%title'. + * @type bool $in_same_term Whether link should be in the same taxonomy term. + * Default false. + * @type int[]|string $excluded_terms Array or comma-separated list of excluded term IDs. + * Default empty. + * @type string $taxonomy Taxonomy, if `$in_same_term` is true. Default 'category'. + * @type string $screen_reader_text Screen reader text for the nav element. + * Default 'Post navigation'. + * @type string $aria_label ARIA label text for the nav element. Default 'Posts'. + * @type string $class Custom class for the nav element. Default 'post-navigation'. + * } + * @return string Markup for post links. + * @phpstan-param array{ + * prev_text?: string, + * next_text?: string, + * in_same_term?: bool, + * excluded_terms?: int[]|string, + * taxonomy?: string, + * screen_reader_text?: string, + * aria_label?: string, + * class?: string, + * } $args + */ + function get_the_post_navigation($args = array()) + { + } + /** + * Displays the navigation to next/previous post, when applicable. + * + * @since 4.1.0 + * + * @param array $args Optional. See get_the_post_navigation() for available arguments. + * Default empty array. + * @phpstan-param array{ + * prev_text?: string, + * next_text?: string, + * in_same_term?: bool, + * excluded_terms?: int[]|string, + * taxonomy?: string, + * screen_reader_text?: string, + * aria_label?: string, + * class?: string, + * } $args See get_the_post_navigation() + */ + function the_post_navigation($args = array()) + { + } + /** + * Returns the navigation to next/previous set of posts, when applicable. + * + * @since 4.1.0 + * @since 5.3.0 Added the `aria_label` parameter. + * @since 5.5.0 Added the `class` parameter. + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param array $args { + * Optional. Default posts navigation arguments. Default empty array. + * + * @type string $prev_text Anchor text to display in the previous posts link. + * Default 'Older posts'. + * @type string $next_text Anchor text to display in the next posts link. + * Default 'Newer posts'. + * @type string $screen_reader_text Screen reader text for the nav element. + * Default 'Posts navigation'. + * @type string $aria_label ARIA label text for the nav element. Default 'Posts'. + * @type string $class Custom class for the nav element. Default 'posts-navigation'. + * } + * @return string Markup for posts links. + * @phpstan-param array{ + * prev_text?: string, + * next_text?: string, + * screen_reader_text?: string, + * aria_label?: string, + * class?: string, + * } $args + */ + function get_the_posts_navigation($args = array()) + { + } + /** + * Displays the navigation to next/previous set of posts, when applicable. + * + * @since 4.1.0 + * + * @param array $args Optional. See get_the_posts_navigation() for available arguments. + * Default empty array. + * @phpstan-param array{ + * prev_text?: string, + * next_text?: string, + * screen_reader_text?: string, + * aria_label?: string, + * class?: string, + * } $args See get_the_posts_navigation() + */ + function the_posts_navigation($args = array()) + { + } + /** + * Retrieves a paginated navigation to next/previous set of posts, when applicable. + * + * @since 4.1.0 + * @since 5.3.0 Added the `aria_label` parameter. + * @since 5.5.0 Added the `class` parameter. + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param array $args { + * Optional. Default pagination arguments, see paginate_links(). + * + * @type string $screen_reader_text Screen reader text for navigation element. + * Default 'Posts navigation'. + * @type string $aria_label ARIA label text for the nav element. Default 'Posts'. + * @type string $class Custom class for the nav element. Default 'pagination'. + * } + * @return string Markup for pagination links. + * @phpstan-param array{ + * screen_reader_text?: string, + * aria_label?: string, + * class?: string, + * base?: string, + * format?: string, + * total?: int, + * current?: int, + * aria_current?: string, + * show_all?: bool, + * end_size?: int, + * mid_size?: int, + * prev_next?: bool, + * prev_text?: string, + * next_text?: string, + * type?: string, + * add_args?: array, + * add_fragment?: string, + * before_page_number?: string, + * after_page_number?: string, + * } $args + */ + function get_the_posts_pagination($args = array()) + { + } + /** + * Displays a paginated navigation to next/previous set of posts, when applicable. + * + * @since 4.1.0 + * + * @param array $args Optional. See get_the_posts_pagination() for available arguments. + * Default empty array. + * @phpstan-param array{ + * screen_reader_text?: string, + * aria_label?: string, + * class?: string, + * base?: string, + * format?: string, + * total?: int, + * current?: int, + * aria_current?: string, + * show_all?: bool, + * end_size?: int, + * mid_size?: int, + * prev_next?: bool, + * prev_text?: string, + * next_text?: string, + * type?: string, + * add_args?: array, + * add_fragment?: string, + * before_page_number?: string, + * after_page_number?: string, + * } $args See get_the_posts_pagination() + */ + function the_posts_pagination($args = array()) + { + } + /** + * Wraps passed links in navigational markup. + * + * @since 4.1.0 + * @since 5.3.0 Added the `aria_label` parameter. + * @access private + * + * @param string $links Navigational links. + * @param string $css_class Optional. Custom class for the nav element. + * Default 'posts-navigation'. + * @param string $screen_reader_text Optional. Screen reader text for the nav element. + * Default 'Posts navigation'. + * @param string $aria_label Optional. ARIA label for the nav element. + * Defaults to the value of `$screen_reader_text`. + * @return string Navigation template tag. + */ + function _navigation_markup($links, $css_class = 'posts-navigation', $screen_reader_text = '', $aria_label = '') + { + } + /** + * Retrieves the comments page number link. + * + * @since 2.7.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param int $pagenum Optional. Page number. Default 1. + * @param int $max_page Optional. The maximum number of comment pages. Default 0. + * @return string The comments page number link URL. + */ + function get_comments_pagenum_link($pagenum = 1, $max_page = 0) + { + } + /** + * Retrieves the link to the next comments page. + * + * @since 2.7.1 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param string $label Optional. Label for link text. Default empty. + * @param int $max_page Optional. Max page. Default 0. + * @return string|void HTML-formatted link for the next page of comments. + */ + function get_next_comments_link($label = '', $max_page = 0) + { + } + /** + * Displays the link to the next comments page. + * + * @since 2.7.0 + * + * @param string $label Optional. Label for link text. Default empty. + * @param int $max_page Optional. Max page. Default 0. + */ + function next_comments_link($label = '', $max_page = 0) + { + } + /** + * Retrieves the link to the previous comments page. + * + * @since 2.7.1 + * + * @param string $label Optional. Label for comments link text. Default empty. + * @return string|void HTML-formatted link for the previous page of comments. + */ + function get_previous_comments_link($label = '') + { + } + /** + * Displays the link to the previous comments page. + * + * @since 2.7.0 + * + * @param string $label Optional. Label for comments link text. Default empty. + */ + function previous_comments_link($label = '') + { + } + /** + * Displays or retrieves pagination links for the comments on the current post. + * + * @see paginate_links() + * @since 2.7.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param string|array $args Optional args. See paginate_links(). Default empty array. + * @return void|string|array Void if 'echo' argument is true and 'type' is not an array, + * or if the query is not for an existing single post of any post type. + * Otherwise, markup for comment page links or array of comment page links, + * depending on 'type' argument. + * @phpstan-param array{ + * base?: string, + * format?: string, + * total?: int, + * current?: int, + * aria_current?: string, + * show_all?: bool, + * end_size?: int, + * mid_size?: int, + * prev_next?: bool, + * prev_text?: string, + * next_text?: string, + * type?: string, + * add_args?: array, + * add_fragment?: string, + * before_page_number?: string, + * after_page_number?: string, + * } $args See paginate_links() + */ + function paginate_comments_links($args = array()) + { + } + /** + * Retrieves navigation to next/previous set of comments, when applicable. + * + * @since 4.4.0 + * @since 5.3.0 Added the `aria_label` parameter. + * @since 5.5.0 Added the `class` parameter. + * + * @param array $args { + * Optional. Default comments navigation arguments. + * + * @type string $prev_text Anchor text to display in the previous comments link. + * Default 'Older comments'. + * @type string $next_text Anchor text to display in the next comments link. + * Default 'Newer comments'. + * @type string $screen_reader_text Screen reader text for the nav element. Default 'Comments navigation'. + * @type string $aria_label ARIA label text for the nav element. Default 'Comments'. + * @type string $class Custom class for the nav element. Default 'comment-navigation'. + * } + * @return string Markup for comments links. + * @phpstan-param array{ + * prev_text?: string, + * next_text?: string, + * screen_reader_text?: string, + * aria_label?: string, + * class?: string, + * } $args + */ + function get_the_comments_navigation($args = array()) + { + } + /** + * Displays navigation to next/previous set of comments, when applicable. + * + * @since 4.4.0 + * + * @param array $args See get_the_comments_navigation() for available arguments. Default empty array. + * @phpstan-param array{ + * prev_text?: string, + * next_text?: string, + * screen_reader_text?: string, + * aria_label?: string, + * class?: string, + * } $args See get_the_comments_navigation() + */ + function the_comments_navigation($args = array()) + { + } + /** + * Retrieves a paginated navigation to next/previous set of comments, when applicable. + * + * @since 4.4.0 + * @since 5.3.0 Added the `aria_label` parameter. + * @since 5.5.0 Added the `class` parameter. + * + * @see paginate_comments_links() + * + * @param array $args { + * Optional. Default pagination arguments. + * + * @type string $screen_reader_text Screen reader text for the nav element. Default 'Comments navigation'. + * @type string $aria_label ARIA label text for the nav element. Default 'Comments'. + * @type string $class Custom class for the nav element. Default 'comments-pagination'. + * } + * @return string Markup for pagination links. + * @phpstan-param array{ + * screen_reader_text?: string, + * aria_label?: string, + * class?: string, + * } $args + */ + function get_the_comments_pagination($args = array()) + { + } + /** + * Displays a paginated navigation to next/previous set of comments, when applicable. + * + * @since 4.4.0 + * + * @param array $args See get_the_comments_pagination() for available arguments. Default empty array. + * @phpstan-param array{ + * screen_reader_text?: string, + * aria_label?: string, + * class?: string, + * } $args See get_the_comments_pagination() + */ + function the_comments_pagination($args = array()) + { + } + /** + * Retrieves the URL for the current site where the front end is accessible. + * + * Returns the 'home' option with the appropriate protocol. The protocol will be 'https' + * if is_ssl() evaluates to true; otherwise, it will be the same as the 'home' option. + * If `$scheme` is 'http' or 'https', is_ssl() is overridden. + * + * @since 3.0.0 + * + * @param string $path Optional. Path relative to the home URL. Default empty. + * @param string|null $scheme Optional. Scheme to give the home URL context. Accepts + * 'http', 'https', 'relative', 'rest', or null. Default null. + * @return string Home URL link with optional path appended. + */ + function home_url($path = '', $scheme = \null) + { + } + /** + * Retrieves the URL for a given site where the front end is accessible. + * + * Returns the 'home' option with the appropriate protocol. The protocol will be 'https' + * if is_ssl() evaluates to true; otherwise, it will be the same as the 'home' option. + * If `$scheme` is 'http' or 'https', is_ssl() is overridden. + * + * @since 3.0.0 + * + * @param int|null $blog_id Optional. Site ID. Default null (current site). + * @param string $path Optional. Path relative to the home URL. Default empty. + * @param string|null $scheme Optional. Scheme to give the home URL context. Accepts + * 'http', 'https', 'relative', 'rest', or null. Default null. + * @return string Home URL link with optional path appended. + */ + function get_home_url($blog_id = \null, $path = '', $scheme = \null) + { + } + /** + * Retrieves the URL for the current site where WordPress application files + * (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible. + * + * Returns the 'site_url' option with the appropriate protocol, 'https' if + * is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is + * overridden. + * + * @since 3.0.0 + * + * @param string $path Optional. Path relative to the site URL. Default empty. + * @param string|null $scheme Optional. Scheme to give the site URL context. See set_url_scheme(). + * @return string Site URL link with optional path appended. + */ + function site_url($path = '', $scheme = \null) + { + } + /** + * Retrieves the URL for a given site where WordPress application files + * (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible. + * + * Returns the 'site_url' option with the appropriate protocol, 'https' if + * is_ssl() and 'http' otherwise. If `$scheme` is 'http' or 'https', + * `is_ssl()` is overridden. + * + * @since 3.0.0 + * + * @param int|null $blog_id Optional. Site ID. Default null (current site). + * @param string $path Optional. Path relative to the site URL. Default empty. + * @param string|null $scheme Optional. Scheme to give the site URL context. Accepts + * 'http', 'https', 'login', 'login_post', 'admin', or + * 'relative'. Default null. + * @return string Site URL link with optional path appended. + */ + function get_site_url($blog_id = \null, $path = '', $scheme = \null) + { + } + /** + * Retrieves the URL to the admin area for the current site. + * + * @since 2.6.0 + * + * @param string $path Optional. Path relative to the admin URL. Default empty. + * @param string $scheme The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). + * 'http' or 'https' can be passed to force those schemes. + * @return string Admin URL link with optional path appended. + */ + function admin_url($path = '', $scheme = 'admin') + { + } + /** + * Retrieves the URL to the admin area for a given site. + * + * @since 3.0.0 + * + * @param int|null $blog_id Optional. Site ID. Default null (current site). + * @param string $path Optional. Path relative to the admin URL. Default empty. + * @param string $scheme Optional. The scheme to use. Accepts 'http' or 'https', + * to force those schemes. Default 'admin', which obeys + * force_ssl_admin() and is_ssl(). + * @return string Admin URL link with optional path appended. + * @phpstan-param 'http'|'https' $scheme + */ + function get_admin_url($blog_id = \null, $path = '', $scheme = 'admin') + { + } + /** + * Retrieves the URL to the includes directory. + * + * @since 2.6.0 + * + * @param string $path Optional. Path relative to the includes URL. Default empty. + * @param string|null $scheme Optional. Scheme to give the includes URL context. Accepts + * 'http', 'https', or 'relative'. Default null. + * @return string Includes URL link with optional path appended. + */ + function includes_url($path = '', $scheme = \null) + { + } + /** + * Retrieves the URL to the content directory. + * + * @since 2.6.0 + * + * @param string $path Optional. Path relative to the content URL. Default empty. + * @return string Content URL link with optional path appended. + */ + function content_url($path = '') + { + } + /** + * Retrieves a URL within the plugins or mu-plugins directory. + * + * Defaults to the plugins directory URL if no arguments are supplied. + * + * @since 2.6.0 + * + * @param string $path Optional. Extra path appended to the end of the URL, including + * the relative directory if $plugin is supplied. Default empty. + * @param string $plugin Optional. A full path to a file inside a plugin or mu-plugin. + * The URL will be relative to its directory. Default empty. + * Typically this is done by passing `__FILE__` as the argument. + * @return string Plugins URL link with optional paths appended. + */ + function plugins_url($path = '', $plugin = '') + { + } + /** + * Retrieves the site URL for the current network. + * + * Returns the site URL with the appropriate protocol, 'https' if + * is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is + * overridden. + * + * @since 3.0.0 + * + * @see set_url_scheme() + * + * @param string $path Optional. Path relative to the site URL. Default empty. + * @param string|null $scheme Optional. Scheme to give the site URL context. Accepts + * 'http', 'https', or 'relative'. Default null. + * @return string Site URL link with optional path appended. + */ + function network_site_url($path = '', $scheme = \null) + { + } + /** + * Retrieves the home URL for the current network. + * + * Returns the home URL with the appropriate protocol, 'https' is_ssl() + * and 'http' otherwise. If `$scheme` is 'http' or 'https', `is_ssl()` is + * overridden. + * + * @since 3.0.0 + * + * @param string $path Optional. Path relative to the home URL. Default empty. + * @param string|null $scheme Optional. Scheme to give the home URL context. Accepts + * 'http', 'https', or 'relative'. Default null. + * @return string Home URL link with optional path appended. + */ + function network_home_url($path = '', $scheme = \null) + { + } + /** + * Retrieves the URL to the admin area for the network. + * + * @since 3.0.0 + * + * @param string $path Optional path relative to the admin URL. Default empty. + * @param string $scheme Optional. The scheme to use. Default is 'admin', which obeys force_ssl_admin() + * and is_ssl(). 'http' or 'https' can be passed to force those schemes. + * @return string Admin URL link with optional path appended. + */ + function network_admin_url($path = '', $scheme = 'admin') + { + } + /** + * Retrieves the URL to the admin area for the current user. + * + * @since 3.0.0 + * + * @param string $path Optional. Path relative to the admin URL. Default empty. + * @param string $scheme Optional. The scheme to use. Default is 'admin', which obeys force_ssl_admin() + * and is_ssl(). 'http' or 'https' can be passed to force those schemes. + * @return string Admin URL link with optional path appended. + */ + function user_admin_url($path = '', $scheme = 'admin') + { + } + /** + * Retrieves the URL to the admin area for either the current site or the network depending on context. + * + * @since 3.1.0 + * + * @param string $path Optional. Path relative to the admin URL. Default empty. + * @param string $scheme Optional. The scheme to use. Default is 'admin', which obeys force_ssl_admin() + * and is_ssl(). 'http' or 'https' can be passed to force those schemes. + * @return string Admin URL link with optional path appended. + */ + function self_admin_url($path = '', $scheme = 'admin') + { + } + /** + * Sets the scheme for a URL. + * + * @since 3.4.0 + * @since 4.4.0 The 'rest' scheme was added. + * + * @param string $url Absolute URL that includes a scheme + * @param string|null $scheme Optional. Scheme to give $url. Currently 'http', 'https', 'login', + * 'login_post', 'admin', 'relative', 'rest', 'rpc', or null. Default null. + * @return string URL with chosen scheme. + */ + function set_url_scheme($url, $scheme = \null) + { + } + /** + * Retrieves the URL to the user's dashboard. + * + * If a user does not belong to any site, the global user dashboard is used. If the user + * belongs to the current site, the dashboard for the current site is returned. If the user + * cannot edit the current site, the dashboard to the user's primary site is returned. + * + * @since 3.1.0 + * + * @param int $user_id Optional. User ID. Defaults to current user. + * @param string $path Optional path relative to the dashboard. Use only paths known to + * both site and user admins. Default empty. + * @param string $scheme The scheme to use. Default is 'admin', which obeys force_ssl_admin() + * and is_ssl(). 'http' or 'https' can be passed to force those schemes. + * @return string Dashboard URL link with optional path appended. + */ + function get_dashboard_url($user_id = 0, $path = '', $scheme = 'admin') + { + } + /** + * Retrieves the URL to the user's profile editor. + * + * @since 3.1.0 + * + * @param int $user_id Optional. User ID. Defaults to current user. + * @param string $scheme Optional. The scheme to use. Default is 'admin', which obeys force_ssl_admin() + * and is_ssl(). 'http' or 'https' can be passed to force those schemes. + * @return string Dashboard URL link with optional path appended. + */ + function get_edit_profile_url($user_id = 0, $scheme = 'admin') + { + } + /** + * Returns the canonical URL for a post. + * + * When the post is the same as the current requested page the function will handle the + * pagination arguments too. + * + * @since 4.6.0 + * + * @param int|WP_Post $post Optional. Post ID or object. Default is global `$post`. + * @return string|false The canonical URL. False if the post does not exist + * or has not been published yet. + */ + function wp_get_canonical_url($post = \null) + { + } + /** + * Outputs rel=canonical for singular queries. + * + * @since 2.9.0 + * @since 4.6.0 Adjusted to use `wp_get_canonical_url()`. + * @phpstan-return void + */ + function rel_canonical() + { + } + /** + * Returns a shortlink for a post, page, attachment, or site. + * + * This function exists to provide a shortlink tag that all themes and plugins can target. + * A plugin must hook in to provide the actual shortlinks. Default shortlink support is + * limited to providing ?p= style links for posts. Plugins can short-circuit this function + * via the {@see 'pre_get_shortlink'} filter or filter the output via the {@see 'get_shortlink'} + * filter. + * + * @since 3.0.0 + * + * @param int $id Optional. A post or site ID. Default is 0, which means the current post or site. + * @param string $context Optional. Whether the ID is a 'site' ID, 'post' ID, or 'media' ID. If 'post', + * the post_type of the post is consulted. If 'query', the current query is consulted + * to determine the ID and context. Default 'post'. + * @param bool $allow_slugs Optional. Whether to allow post slugs in the shortlink. It is up to the plugin how + * and whether to honor this. Default true. + * @return string A shortlink or an empty string if no shortlink exists for the requested resource or if shortlinks + * are not enabled. + */ + function wp_get_shortlink($id = 0, $context = 'post', $allow_slugs = \true) + { + } + /** + * Injects rel=shortlink into the head if a shortlink is defined for the current page. + * + * Attached to the {@see 'wp_head'} action. + * + * @since 3.0.0 + * @phpstan-return void + */ + function wp_shortlink_wp_head() + { + } + /** + * Sends a Link: rel=shortlink header if a shortlink is defined for the current page. + * + * Attached to the {@see 'wp'} action. + * + * @since 3.0.0 + * @phpstan-return void + */ + function wp_shortlink_header() + { + } + /** + * Displays the shortlink for a post. + * + * Must be called from inside "The Loop" + * + * Call like the_shortlink( __( 'Shortlinkage FTW' ) ) + * + * @since 3.0.0 + * + * @param string $text Optional The link text or HTML to be displayed. Defaults to 'This is the short link.' + * @param string $title Optional The tooltip for the link. Must be sanitized. Defaults to the sanitized post title. + * @param string $before Optional HTML to display before the link. Default empty. + * @param string $after Optional HTML to display after the link. Default empty. + */ + function the_shortlink($text = '', $title = '', $before = '', $after = '') + { + } + /** + * Retrieves the avatar URL. + * + * @since 4.2.0 + * + * @param mixed $id_or_email The avatar to retrieve a URL for. Accepts a user ID, Gravatar MD5 hash, + * user email, WP_User object, WP_Post object, or WP_Comment object. + * @param array $args { + * Optional. Arguments to use instead of the default arguments. + * + * @type int $size Height and width of the avatar in pixels. Default 96. + * @type string $default URL for the default image or a default type. Accepts: + * - '404' (return a 404 instead of a default image) + * - 'retro' (a 8-bit arcade-style pixelated face) + * - 'robohash' (a robot) + * - 'monsterid' (a monster) + * - 'wavatar' (a cartoon face) + * - 'identicon' (the "quilt", a geometric pattern) + * - 'mystery', 'mm', or 'mysteryman' (The Oyster Man) + * - 'blank' (transparent GIF) + * - 'gravatar_default' (the Gravatar logo) + * Default is the value of the 'avatar_default' option, + * with a fallback of 'mystery'. + * @type bool $force_default Whether to always show the default image, never the Gravatar. + * Default false. + * @type string $rating What rating to display avatars up to. Accepts: + * - 'G' (suitable for all audiences) + * - 'PG' (possibly offensive, usually for audiences 13 and above) + * - 'R' (intended for adult audiences above 17) + * - 'X' (even more mature than above) + * Default is the value of the 'avatar_rating' option. + * @type string $scheme URL scheme to use. See set_url_scheme() for accepted values. + * Default null. + * @type array $processed_args When the function returns, the value will be the processed/sanitized $args + * plus a "found_avatar" guess. Pass as a reference. Default null. + * } + * @return string|false The URL of the avatar on success, false on failure. + * @phpstan-param array{ + * size?: int, + * default?: string, + * force_default?: bool, + * rating?: string, + * scheme?: string, + * processed_args?: array, + * } $args + */ + function get_avatar_url($id_or_email, $args = \null) + { + } + /** + * Check if this comment type allows avatars to be retrieved. + * + * @since 5.1.0 + * + * @param string $comment_type Comment type to check. + * @return bool Whether the comment type is allowed for retrieving avatars. + */ + function is_avatar_comment_type($comment_type) + { + } + /** + * Retrieves default data about the avatar. + * + * @since 4.2.0 + * + * @param mixed $id_or_email The avatar to retrieve. Accepts a user ID, Gravatar MD5 hash, + * user email, WP_User object, WP_Post object, or WP_Comment object. + * @param array $args { + * Optional. Arguments to use instead of the default arguments. + * + * @type int $size Height and width of the avatar in pixels. Default 96. + * @type int $height Display height of the avatar in pixels. Defaults to $size. + * @type int $width Display width of the avatar in pixels. Defaults to $size. + * @type string $default URL for the default image or a default type. Accepts: + * - '404' (return a 404 instead of a default image) + * - 'retro' (a 8-bit arcade-style pixelated face) + * - 'robohash' (a robot) + * - 'monsterid' (a monster) + * - 'wavatar' (a cartoon face) + * - 'identicon' (the "quilt", a geometric pattern) + * - 'mystery', 'mm', or 'mysteryman' (The Oyster Man) + * - 'blank' (transparent GIF) + * - 'gravatar_default' (the Gravatar logo) + * Default is the value of the 'avatar_default' option, + * with a fallback of 'mystery'. + * @type bool $force_default Whether to always show the default image, never the Gravatar. + * Default false. + * @type string $rating What rating to display avatars up to. Accepts: + * - 'G' (suitable for all audiences) + * - 'PG' (possibly offensive, usually for audiences 13 and above) + * - 'R' (intended for adult audiences above 17) + * - 'X' (even more mature than above) + * Default is the value of the 'avatar_rating' option. + * @type string $scheme URL scheme to use. See set_url_scheme() for accepted values. + * Default null. + * @type array $processed_args When the function returns, the value will be the processed/sanitized $args + * plus a "found_avatar" guess. Pass as a reference. Default null. + * @type string $extra_attr HTML attributes to insert in the IMG element. Is not sanitized. + * Default empty. + * } + * @return array { + * Along with the arguments passed in `$args`, this will contain a couple of extra arguments. + * + * @type bool $found_avatar True if an avatar was found for this user, + * false or not set if none was found. + * @type string|false $url The URL of the avatar that was found, or false. + * } + * @phpstan-param array{ + * size?: int, + * height?: int, + * width?: int, + * default?: string, + * force_default?: bool, + * rating?: string, + * scheme?: string, + * processed_args?: array, + * extra_attr?: string, + * } $args + * @phpstan-return array{ + * found_avatar: bool, + * url: string|false, + * } + */ + function get_avatar_data($id_or_email, $args = \null) + { + } + /** + * Retrieves the URL of a file in the theme. + * + * Searches in the stylesheet directory before the template directory so themes + * which inherit from a parent theme can just override one file. + * + * @since 4.7.0 + * + * @param string $file Optional. File to search for in the stylesheet directory. + * @return string The URL of the file. + */ + function get_theme_file_uri($file = '') + { + } + /** + * Retrieves the URL of a file in the parent theme. + * + * @since 4.7.0 + * + * @param string $file Optional. File to return the URL for in the template directory. + * @return string The URL of the file. + */ + function get_parent_theme_file_uri($file = '') + { + } + /** + * Retrieves the path of a file in the theme. + * + * Searches in the stylesheet directory before the template directory so themes + * which inherit from a parent theme can just override one file. + * + * @since 4.7.0 + * + * @param string $file Optional. File to search for in the stylesheet directory. + * @return string The path of the file. + */ + function get_theme_file_path($file = '') + { + } + /** + * Retrieves the path of a file in the parent theme. + * + * @since 4.7.0 + * + * @param string $file Optional. File to return the path for in the template directory. + * @return string The path of the file. + */ + function get_parent_theme_file_path($file = '') + { + } + /** + * Retrieves the URL to the privacy policy page. + * + * @since 4.9.6 + * + * @return string The URL to the privacy policy page. Empty string if it doesn't exist. + */ + function get_privacy_policy_url() + { + } + /** + * Displays the privacy policy link with formatting, when applicable. + * + * @since 4.9.6 + * + * @param string $before Optional. Display before privacy policy link. Default empty. + * @param string $after Optional. Display after privacy policy link. Default empty. + */ + function the_privacy_policy_link($before = '', $after = '') + { + } + /** + * Returns the privacy policy link with formatting, when applicable. + * + * @since 4.9.6 + * @since 6.2.0 Added 'privacy-policy' rel attribute. + * + * @param string $before Optional. Display before privacy policy link. Default empty. + * @param string $after Optional. Display after privacy policy link. Default empty. + * @return string Markup for the link and surrounding elements. Empty string if it + * doesn't exist. + */ + function get_the_privacy_policy_link($before = '', $after = '') + { + } + /** + * Returns an array of URL hosts which are considered to be internal hosts. + * + * By default the list of internal hosts is comprised of the host name of + * the site's home_url() (as parsed by wp_parse_url()). + * + * This list is used when determining if a specified URL is a link to a page on + * the site itself or a link offsite (to an external host). This is used, for + * example, when determining if the "nofollow" attribute should be applied to a + * link. + * + * @see wp_is_internal_link + * + * @since 6.2.0 + * + * @return string[] An array of URL hosts. + */ + function wp_internal_hosts() + { + } + /** + * Determines whether or not the specified URL is of a host included in the internal hosts list. + * + * @see wp_internal_hosts() + * + * @since 6.2.0 + * + * @param string $link The URL to test. + * @return bool Returns true for internal URLs and false for all other URLs. + */ + function wp_is_internal_link($link) + { + } + /** + * These functions are needed to load WordPress. + * + * @package WordPress + */ + /** + * Returns the HTTP protocol sent by the server. + * + * @since 4.4.0 + * + * @return string The HTTP protocol. Default: HTTP/1.0. + */ + function wp_get_server_protocol() + { + } + /** + * Fixes `$_SERVER` variables for various setups. + * + * @since 3.0.0 + * @access private + * + * @global string $PHP_SELF The filename of the currently executing script, + * relative to the document root. + */ + function wp_fix_server_vars() + { + } + /** + * Populates the Basic Auth server details from the Authorization header. + * + * Some servers running in CGI or FastCGI mode don't pass the Authorization + * header on to WordPress. If it's been rewritten to the `HTTP_AUTHORIZATION` header, + * fill in the proper $_SERVER variables instead. + * + * @since 5.6.0 + * @phpstan-return void + */ + function wp_populate_basic_auth_from_authorization_header() + { + } + /** + * Checks for the required PHP version, and the mysqli extension or + * a database drop-in. + * + * Dies if requirements are not met. + * + * @since 3.0.0 + * @access private + * + * @global string $required_php_version The required PHP version string. + * @global string $wp_version The WordPress version string. + */ + function wp_check_php_mysql_versions() + { + } + /** + * Retrieves the current environment type. + * + * The type can be set via the `WP_ENVIRONMENT_TYPE` global system variable, + * or a constant of the same name. + * + * Possible values are 'local', 'development', 'staging', and 'production'. + * If not set, the type defaults to 'production'. + * + * @since 5.5.0 + * @since 5.5.1 Added the 'local' type. + * @since 5.5.1 Removed the ability to alter the list of types. + * + * @return string The current environment type. + */ + function wp_get_environment_type() + { + } + /** + * Retrieves the current development mode. + * + * The development mode affects how certain parts of the WordPress application behave, + * which is relevant when developing for WordPress. + * + * Development mode can be set via the `WP_DEVELOPMENT_MODE` constant in `wp-config.php`. + * Possible values are 'core', 'plugin', 'theme', 'all', or an empty string to disable + * development mode. 'all' is a special value to signify that all three development modes + * ('core', 'plugin', and 'theme') are enabled. + * + * Development mode is considered separately from `WP_DEBUG` and wp_get_environment_type(). + * It does not affect debugging output, but rather functional nuances in WordPress. + * + * This function retrieves the currently set development mode value. To check whether + * a specific development mode is enabled, use wp_is_development_mode(). + * + * @since 6.3.0 + * + * @return string The current development mode. + */ + function wp_get_development_mode() + { + } + /** + * Checks whether the site is in the given development mode. + * + * @since 6.3.0 + * + * @param string $mode Development mode to check for. Either 'core', 'plugin', 'theme', or 'all'. + * @return bool True if the given mode is covered by the current development mode, false otherwise. + * @phpstan-param 'core'|'plugin'|'theme'|'all' $mode + */ + function wp_is_development_mode($mode) + { + } + /** + * Ensures all of WordPress is not loaded when handling a favicon.ico request. + * + * Instead, send the headers for a zero-length favicon and bail. + * + * @since 3.0.0 + * @deprecated 5.4.0 Deprecated in favor of do_favicon(). + */ + function wp_favicon_request() + { + } + /** + * Dies with a maintenance message when conditions are met. + * + * The default message can be replaced by using a drop-in (maintenance.php in + * the wp-content directory). + * + * @since 3.0.0 + * @access private + * @phpstan-return void + */ + function wp_maintenance() + { + } + /** + * Checks if maintenance mode is enabled. + * + * Checks for a file in the WordPress root directory named ".maintenance". + * This file will contain the variable $upgrading, set to the time the file + * was created. If the file was created less than 10 minutes ago, WordPress + * is in maintenance mode. + * + * @since 5.5.0 + * + * @global int $upgrading The Unix timestamp marking when upgrading WordPress began. + * + * @return bool True if maintenance mode is enabled, false otherwise. + */ + function wp_is_maintenance_mode() + { + } + /** + * Gets the time elapsed so far during this PHP script. + * + * Uses REQUEST_TIME_FLOAT that appeared in PHP 5.4.0. + * + * @since 5.8.0 + * + * @return float Seconds since the PHP script started. + */ + function timer_float() + { + } + /** + * Starts the WordPress micro-timer. + * + * @since 0.71 + * @access private + * + * @global float $timestart Unix timestamp set at the beginning of the page load. + * @see timer_stop() + * + * @return bool Always returns true. + */ + function timer_start() + { + } + /** + * Retrieves or displays the time from the page start to when function is called. + * + * @since 0.71 + * + * @global float $timestart Seconds from when timer_start() is called. + * @global float $timeend Seconds from when function is called. + * + * @param int|bool $display Whether to echo or return the results. Accepts 0|false for return, + * 1|true for echo. Default 0|false. + * @param int $precision The number of digits from the right of the decimal to display. + * Default 3. + * @return string The "second.microsecond" finished time calculation. The number is formatted + * for human consumption, both localized and rounded. + */ + function timer_stop($display = 0, $precision = 3) + { + } + /** + * Sets PHP error reporting based on WordPress debug settings. + * + * Uses three constants: `WP_DEBUG`, `WP_DEBUG_DISPLAY`, and `WP_DEBUG_LOG`. + * All three can be defined in wp-config.php. By default, `WP_DEBUG` and + * `WP_DEBUG_LOG` are set to false, and `WP_DEBUG_DISPLAY` is set to true. + * + * When `WP_DEBUG` is true, all PHP notices are reported. WordPress will also + * display internal notices: when a deprecated WordPress function, function + * argument, or file is used. Deprecated code may be removed from a later + * version. + * + * It is strongly recommended that plugin and theme developers use `WP_DEBUG` + * in their development environments. + * + * `WP_DEBUG_DISPLAY` and `WP_DEBUG_LOG` perform no function unless `WP_DEBUG` + * is true. + * + * When `WP_DEBUG_DISPLAY` is true, WordPress will force errors to be displayed. + * `WP_DEBUG_DISPLAY` defaults to true. Defining it as null prevents WordPress + * from changing the global configuration setting. Defining `WP_DEBUG_DISPLAY` + * as false will force errors to be hidden. + * + * When `WP_DEBUG_LOG` is true, errors will be logged to `wp-content/debug.log`. + * When `WP_DEBUG_LOG` is a valid path, errors will be logged to the specified file. + * + * Errors are never displayed for XML-RPC, REST, `ms-files.php`, and Ajax requests. + * + * @since 3.0.0 + * @since 5.1.0 `WP_DEBUG_LOG` can be a file path. + * @access private + * @phpstan-return void + */ + function wp_debug_mode() + { + } + /** + * Sets the location of the language directory. + * + * To set directory manually, define the `WP_LANG_DIR` constant + * in wp-config.php. + * + * If the language directory exists within `WP_CONTENT_DIR`, it + * is used. Otherwise the language directory is assumed to live + * in `WPINC`. + * + * @since 3.0.0 + * @access private + */ + function wp_set_lang_dir() + { + } + /** + * Loads the database class file and instantiates the `$wpdb` global. + * + * @since 2.5.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * @phpstan-return void + */ + function require_wp_db() + { + } + /** + * Sets the database table prefix and the format specifiers for database + * table columns. + * + * Columns not listed here default to `%s`. + * + * @since 3.0.0 + * @access private + * + * @global wpdb $wpdb WordPress database abstraction object. + * @global string $table_prefix The database table prefix. + */ + function wp_set_wpdb_vars() + { + } + /** + * Toggles `$_wp_using_ext_object_cache` on and off without directly + * touching global. + * + * @since 3.7.0 + * + * @global bool $_wp_using_ext_object_cache + * + * @param bool $using Whether external object cache is being used. + * @return bool The current 'using' setting. + */ + function wp_using_ext_object_cache($using = \null) + { + } + /** + * Starts the WordPress object cache. + * + * If an object-cache.php file exists in the wp-content directory, + * it uses that drop-in as an external object cache. + * + * @since 3.0.0 + * @access private + * + * @global array $wp_filter Stores all of the filters. + */ + function wp_start_object_cache() + { + } + /** + * Redirects to the installer if WordPress is not installed. + * + * Dies with an error message when Multisite is enabled. + * + * @since 3.0.0 + * @access private + * @phpstan-return void + */ + function wp_not_installed() + { + } + /** + * Retrieves an array of must-use plugin files. + * + * The default directory is wp-content/mu-plugins. To change the default + * directory manually, define `WPMU_PLUGIN_DIR` and `WPMU_PLUGIN_URL` + * in wp-config.php. + * + * @since 3.0.0 + * @access private + * + * @return string[] Array of absolute paths of files to include. + */ + function wp_get_mu_plugins() + { + } + /** + * Retrieves an array of active and valid plugin files. + * + * While upgrading or installing WordPress, no plugins are returned. + * + * The default directory is `wp-content/plugins`. To change the default + * directory manually, define `WP_PLUGIN_DIR` and `WP_PLUGIN_URL` + * in `wp-config.php`. + * + * @since 3.0.0 + * @access private + * + * @return string[] Array of paths to plugin files relative to the plugins directory. + */ + function wp_get_active_and_valid_plugins() + { + } + /** + * Filters a given list of plugins, removing any paused plugins from it. + * + * @since 5.2.0 + * + * @global WP_Paused_Extensions_Storage $_paused_plugins + * + * @param string[] $plugins Array of absolute plugin main file paths. + * @return string[] Filtered array of plugins, without any paused plugins. + */ + function wp_skip_paused_plugins(array $plugins) + { + } + /** + * Retrieves an array of active and valid themes. + * + * While upgrading or installing WordPress, no themes are returned. + * + * @since 5.1.0 + * @access private + * + * @global string $pagenow The filename of the current screen. + * @global string $wp_stylesheet_path Path to current theme's stylesheet directory. + * @global string $wp_template_path Path to current theme's template directory. + * + * @return string[] Array of absolute paths to theme directories. + */ + function wp_get_active_and_valid_themes() + { + } + /** + * Filters a given list of themes, removing any paused themes from it. + * + * @since 5.2.0 + * + * @global WP_Paused_Extensions_Storage $_paused_themes + * + * @param string[] $themes Array of absolute theme directory paths. + * @return string[] Filtered array of absolute paths to themes, without any paused themes. + */ + function wp_skip_paused_themes(array $themes) + { + } + /** + * Determines whether WordPress is in Recovery Mode. + * + * In this mode, plugins or themes that cause WSODs will be paused. + * + * @since 5.2.0 + * + * @return bool + */ + function wp_is_recovery_mode() + { + } + /** + * Determines whether we are currently on an endpoint that should be protected against WSODs. + * + * @since 5.2.0 + * + * @global string $pagenow The filename of the current screen. + * + * @return bool True if the current endpoint should be protected. + */ + function is_protected_endpoint() + { + } + /** + * Determines whether we are currently handling an Ajax action that should be protected against WSODs. + * + * @since 5.2.0 + * + * @return bool True if the current Ajax action should be protected. + */ + function is_protected_ajax_action() + { + } + /** + * Sets internal encoding. + * + * In most cases the default internal encoding is latin1, which is + * of no use, since we want to use the `mb_` functions for `utf-8` strings. + * + * @since 3.0.0 + * @access private + */ + function wp_set_internal_encoding() + { + } + /** + * Adds magic quotes to `$_GET`, `$_POST`, `$_COOKIE`, and `$_SERVER`. + * + * Also forces `$_REQUEST` to be `$_GET + $_POST`. If `$_SERVER`, + * `$_COOKIE`, or `$_ENV` are needed, use those superglobals directly. + * + * @since 3.0.0 + * @access private + */ + function wp_magic_quotes() + { + } + /** + * Runs just before PHP shuts down execution. + * + * @since 1.2.0 + * @access private + */ + function shutdown_action_hook() + { + } + /** + * Clones an object. + * + * @since 2.7.0 + * @deprecated 3.2.0 + * + * @param object $input_object The object to clone. + * @return object The cloned object. + */ + function wp_clone($input_object) + { + } + /** + * Determines whether the current request is for the login screen. + * + * @since 6.1.0 + * + * @see wp_login_url() + * + * @return bool True if inside WordPress login screen, false otherwise. + */ + function is_login() + { + } + /** + * Determines whether the current request is for an administrative interface page. + * + * Does not check if the user is an administrator; use current_user_can() + * for checking roles and capabilities. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 1.5.1 + * + * @global WP_Screen $current_screen WordPress current screen object. + * + * @return bool True if inside WordPress administration interface, false otherwise. + */ + function is_admin() + { + } + /** + * Determines whether the current request is for a site's administrative interface. + * + * e.g. `/wp-admin/` + * + * Does not check if the user is an administrator; use current_user_can() + * for checking roles and capabilities. + * + * @since 3.1.0 + * + * @global WP_Screen $current_screen WordPress current screen object. + * + * @return bool True if inside WordPress site administration pages. + */ + function is_blog_admin() + { + } + /** + * Determines whether the current request is for the network administrative interface. + * + * e.g. `/wp-admin/network/` + * + * Does not check if the user is an administrator; use current_user_can() + * for checking roles and capabilities. + * + * Does not check if the site is a Multisite network; use is_multisite() + * for checking if Multisite is enabled. + * + * @since 3.1.0 + * + * @global WP_Screen $current_screen WordPress current screen object. + * + * @return bool True if inside WordPress network administration pages. + */ + function is_network_admin() + { + } + /** + * Determines whether the current request is for a user admin screen. + * + * e.g. `/wp-admin/user/` + * + * Does not check if the user is an administrator; use current_user_can() + * for checking roles and capabilities. + * + * @since 3.1.0 + * + * @global WP_Screen $current_screen WordPress current screen object. + * + * @return bool True if inside WordPress user administration pages. + */ + function is_user_admin() + { + } + /** + * Determines whether Multisite is enabled. + * + * @since 3.0.0 + * + * @return bool True if Multisite is enabled, false otherwise. + */ + function is_multisite() + { + } + /** + * Retrieves the current site ID. + * + * @since 3.1.0 + * + * @global int $blog_id + * + * @return int Site ID. + */ + function get_current_blog_id() + { + } + /** + * Retrieves the current network ID. + * + * @since 4.6.0 + * + * @return int The ID of the current network. + */ + function get_current_network_id() + { + } + /** + * Attempts an early load of translations. + * + * Used for errors encountered during the initial loading process, before + * the locale has been properly detected and loaded. + * + * Designed for unusual load sequences (like setup-config.php) or for when + * the script will then terminate with an error, otherwise there is a risk + * that a file can be double-included. + * + * @since 3.4.0 + * @access private + * + * @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry. + * @global WP_Locale $wp_locale WordPress date and time locale object. + * @phpstan-return void + */ + function wp_load_translations_early() + { + } + /** + * Checks or sets whether WordPress is in "installation" mode. + * + * If the `WP_INSTALLING` constant is defined during the bootstrap, `wp_installing()` will default to `true`. + * + * @since 4.4.0 + * + * @param bool $is_installing Optional. True to set WP into Installing mode, false to turn Installing mode off. + * Omit this parameter if you only want to fetch the current status. + * @return bool True if WP is installing, otherwise false. When a `$is_installing` is passed, the function will + * report whether WP was in installing mode prior to the change to `$is_installing`. + */ + function wp_installing($is_installing = \null) + { + } + /** + * Determines if SSL is used. + * + * @since 2.6.0 + * @since 4.6.0 Moved from functions.php to load.php. + * + * @return bool True if SSL, otherwise false. + */ + function is_ssl() + { + } + /** + * Converts a shorthand byte value to an integer byte value. + * + * @since 2.3.0 + * @since 4.6.0 Moved from media.php to load.php. + * + * @link https://www.php.net/manual/en/function.ini-get.php + * @link https://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes + * + * @param string $value A (PHP ini) byte value, either shorthand or ordinary. + * @return int An integer byte value. + */ + function wp_convert_hr_to_bytes($value) + { + } + /** + * Determines whether a PHP ini value is changeable at runtime. + * + * @since 4.6.0 + * + * @link https://www.php.net/manual/en/function.ini-get-all.php + * + * @param string $setting The name of the ini setting to check. + * @return bool True if the value is changeable at runtime. False otherwise. + */ + function wp_is_ini_value_changeable($setting) + { + } + /** + * Determines whether the current request is a WordPress Ajax request. + * + * @since 4.7.0 + * + * @return bool True if it's a WordPress Ajax request, false otherwise. + */ + function wp_doing_ajax() + { + } + /** + * Determines whether the current request should use themes. + * + * @since 5.1.0 + * + * @return bool True if themes should be used, false otherwise. + */ + function wp_using_themes() + { + } + /** + * Determines whether the current request is a WordPress cron request. + * + * @since 4.8.0 + * + * @return bool True if it's a WordPress cron request, false otherwise. + */ + function wp_doing_cron() + { + } + /** + * Checks whether the given variable is a WordPress Error. + * + * Returns whether `$thing` is an instance of the `WP_Error` class. + * + * @since 2.1.0 + * + * @param mixed $thing The variable to check. + * @return bool Whether the variable is an instance of WP_Error. + * @phpstan-assert-if-true \WP_Error $thing + * @phpstan-return ($thing is \WP_Error ? true : false) + */ + function is_wp_error($thing) + { + } + /** + * Determines whether file modifications are allowed. + * + * @since 4.8.0 + * + * @param string $context The usage context. + * @return bool True if file modification is allowed, false otherwise. + */ + function wp_is_file_mod_allowed($context) + { + } + /** + * Starts scraping edited file errors. + * + * @since 4.9.0 + * @phpstan-return void + */ + function wp_start_scraping_edited_file_errors() + { + } + /** + * Finalizes scraping for edited file errors. + * + * @since 4.9.0 + * + * @param string $scrape_key Scrape key. + */ + function wp_finalize_scraping_edited_file_errors($scrape_key) + { + } + /** + * Checks whether current request is a JSON request, or is expecting a JSON response. + * + * @since 5.0.0 + * + * @return bool True if `Accepts` or `Content-Type` headers contain `application/json`. + * False otherwise. + */ + function wp_is_json_request() + { + } + /** + * Checks whether current request is a JSONP request, or is expecting a JSONP response. + * + * @since 5.2.0 + * + * @return bool True if JSONP request, false otherwise. + */ + function wp_is_jsonp_request() + { + } + /** + * Checks whether a string is a valid JSON Media Type. + * + * @since 5.6.0 + * + * @param string $media_type A Media Type string to check. + * @return bool True if string is a valid JSON Media Type. + */ + function wp_is_json_media_type($media_type) + { + } + /** + * Checks whether current request is an XML request, or is expecting an XML response. + * + * @since 5.2.0 + * + * @return bool True if `Accepts` or `Content-Type` headers contain `text/xml` + * or one of the related MIME types. False otherwise. + */ + function wp_is_xml_request() + { + } + /** + * Checks if this site is protected by HTTP Basic Auth. + * + * At the moment, this merely checks for the present of Basic Auth credentials. Therefore, calling + * this function with a context different from the current context may give inaccurate results. + * In a future release, this evaluation may be made more robust. + * + * Currently, this is only used by Application Passwords to prevent a conflict since it also utilizes + * Basic Auth. + * + * @since 5.6.1 + * + * @global string $pagenow The filename of the current screen. + * + * @param string $context The context to check for protection. Accepts 'login', 'admin', and 'front'. + * Defaults to the current context. + * @return bool Whether the site is protected by Basic Auth. + * @phpstan-param 'login'|'admin'|'front' $context + */ + function wp_is_site_protected_by_basic_auth($context = '') + { + } + /** + * WordPress media templates. + * + * @package WordPress + * @subpackage Media + * @since 3.5.0 + */ + /** + * Outputs the markup for an audio tag to be used in an Underscore template + * when data.model is passed. + * + * @since 3.9.0 + */ + function wp_underscore_audio_template() + { + } + /** + * Outputs the markup for a video tag to be used in an Underscore template + * when data.model is passed. + * + * @since 3.9.0 + */ + function wp_underscore_video_template() + { + } + /** + * Prints the templates used in the media manager. + * + * @since 3.5.0 + */ + function wp_print_media_templates() + { + } + /** + * WordPress API for media display. + * + * @package WordPress + * @subpackage Media + */ + /** + * Retrieves additional image sizes. + * + * @since 4.7.0 + * + * @global array $_wp_additional_image_sizes + * + * @return array Additional images size data. + */ + function wp_get_additional_image_sizes() + { + } + /** + * Scales down the default size of an image. + * + * This is so that the image is a better fit for the editor and theme. + * + * The `$size` parameter accepts either an array or a string. The supported string + * values are 'thumb' or 'thumbnail' for the given thumbnail size or defaults at + * 128 width and 96 height in pixels. Also supported for the string value is + * 'medium', 'medium_large' and 'full'. The 'full' isn't actually supported, but any value other + * than the supported will result in the content_width size or 500 if that is + * not set. + * + * Finally, there is a filter named {@see 'editor_max_image_size'}, that will be + * called on the calculated array for width and height, respectively. + * + * @since 2.5.0 + * + * @global int $content_width + * + * @param int $width Width of the image in pixels. + * @param int $height Height of the image in pixels. + * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array + * of width and height values in pixels (in that order). Default 'medium'. + * @param string $context Optional. Could be 'display' (like in a theme) or 'edit' + * (like inserting into an editor). Default null. + * @return int[] { + * An array of width and height values. + * + * @type int $0 The maximum width in pixels. + * @type int $1 The maximum height in pixels. + * } + * @phpstan-return array{ + * 0: int, + * 1: int, + * } + */ + function image_constrain_size_for_editor($width, $height, $size = 'medium', $context = \null) + { + } + /** + * Retrieves width and height attributes using given width and height values. + * + * Both attributes are required in the sense that both parameters must have a + * value, but are optional in that if you set them to false or null, then they + * will not be added to the returned string. + * + * You can set the value using a string, but it will only take numeric values. + * If you wish to put 'px' after the numbers, then it will be stripped out of + * the return. + * + * @since 2.5.0 + * + * @param int|string $width Image width in pixels. + * @param int|string $height Image height in pixels. + * @return string HTML attributes for width and, or height. + */ + function image_hwstring($width, $height) + { + } + /** + * Scales an image to fit a particular size (such as 'thumb' or 'medium'). + * + * The URL might be the original image, or it might be a resized version. This + * function won't create a new resized copy, it will just return an already + * resized one if it exists. + * + * A plugin may use the {@see 'image_downsize'} filter to hook into and offer image + * resizing services for images. The hook must return an array with the same + * elements that are normally returned from the function. + * + * @since 2.5.0 + * + * @param int $id Attachment ID for image. + * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array + * of width and height values in pixels (in that order). Default 'medium'. + * @return array|false { + * Array of image data, or boolean false if no image is available. + * + * @type string $0 Image source URL. + * @type int $1 Image width in pixels. + * @type int $2 Image height in pixels. + * @type bool $3 Whether the image is a resized image. + * } + * @phpstan-return false|array{ + * 0: string, + * 1: int, + * 2: int, + * 3: bool, + * } + */ + function image_downsize($id, $size = 'medium') + { + } + /** + * Registers a new image size. + * + * @since 2.9.0 + * + * @global array $_wp_additional_image_sizes Associative array of additional image sizes. + * + * @param string $name Image size identifier. + * @param int $width Optional. Image width in pixels. Default 0. + * @param int $height Optional. Image height in pixels. Default 0. + * @param bool|array $crop { + * Optional. Image cropping behavior. If false, the image will be scaled (default). + * If true, image will be cropped to the specified dimensions using center positions. + * If an array, the image will be cropped using the array to specify the crop location: + * + * @type string $0 The x crop position. Accepts 'left' 'center', or 'right'. + * @type string $1 The y crop position. Accepts 'top', 'center', or 'bottom'. + * } + * @phpstan-param bool|array{ + * 0: string, + * 1: string, + * } $crop + */ + function add_image_size($name, $width = 0, $height = 0, $crop = \false) + { + } + /** + * Checks if an image size exists. + * + * @since 3.9.0 + * + * @param string $name The image size to check. + * @return bool True if the image size exists, false if not. + */ + function has_image_size($name) + { + } + /** + * Removes a new image size. + * + * @since 3.9.0 + * + * @global array $_wp_additional_image_sizes + * + * @param string $name The image size to remove. + * @return bool True if the image size was successfully removed, false on failure. + */ + function remove_image_size($name) + { + } + /** + * Registers an image size for the post thumbnail. + * + * @since 2.9.0 + * + * @see add_image_size() for details on cropping behavior. + * + * @param int $width Image width in pixels. + * @param int $height Image height in pixels. + * @param bool|array $crop { + * Optional. Image cropping behavior. If false, the image will be scaled (default). + * If true, image will be cropped to the specified dimensions using center positions. + * If an array, the image will be cropped using the array to specify the crop location: + * + * @type string $0 The x crop position. Accepts 'left' 'center', or 'right'. + * @type string $1 The y crop position. Accepts 'top', 'center', or 'bottom'. + * } + * @phpstan-param bool|array{ + * 0: string, + * 1: string, + * } $crop + */ + function set_post_thumbnail_size($width = 0, $height = 0, $crop = \false) + { + } + /** + * Gets an img tag for an image attachment, scaling it down if requested. + * + * The {@see 'get_image_tag_class'} filter allows for changing the class name for the + * image without having to use regular expressions on the HTML content. The + * parameters are: what WordPress will use for the class, the Attachment ID, + * image align value, and the size the image should be. + * + * The second filter, {@see 'get_image_tag'}, has the HTML content, which can then be + * further manipulated by a plugin to change all attribute values and even HTML + * content. + * + * @since 2.5.0 + * + * @param int $id Attachment ID. + * @param string $alt Image description for the alt attribute. + * @param string $title Image description for the title attribute. + * @param string $align Part of the class name for aligning the image. + * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array of + * width and height values in pixels (in that order). Default 'medium'. + * @return string HTML IMG element for given image attachment. + */ + function get_image_tag($id, $alt, $title, $align, $size = 'medium') + { + } + /** + * Calculates the new dimensions for a down-sampled image. + * + * If either width or height are empty, no constraint is applied on + * that dimension. + * + * @since 2.5.0 + * + * @param int $current_width Current width of the image. + * @param int $current_height Current height of the image. + * @param int $max_width Optional. Max width in pixels to constrain to. Default 0. + * @param int $max_height Optional. Max height in pixels to constrain to. Default 0. + * @return int[] { + * An array of width and height values. + * + * @type int $0 The width in pixels. + * @type int $1 The height in pixels. + * } + * @phpstan-return array{ + * 0: int, + * 1: int, + * } + */ + function wp_constrain_dimensions($current_width, $current_height, $max_width = 0, $max_height = 0) + { + } + /** + * Retrieves calculated resize dimensions for use in WP_Image_Editor. + * + * Calculates dimensions and coordinates for a resized image that fits + * within a specified width and height. + * + * @since 2.5.0 + * + * @param int $orig_w Original width in pixels. + * @param int $orig_h Original height in pixels. + * @param int $dest_w New width in pixels. + * @param int $dest_h New height in pixels. + * @param bool|array $crop { + * Optional. Image cropping behavior. If false, the image will be scaled (default). + * If true, image will be cropped to the specified dimensions using center positions. + * If an array, the image will be cropped using the array to specify the crop location: + * + * @type string $0 The x crop position. Accepts 'left' 'center', or 'right'. + * @type string $1 The y crop position. Accepts 'top', 'center', or 'bottom'. + * } + * @return array|false Returned array matches parameters for `imagecopyresampled()`. False on failure. + * @phpstan-param bool|array{ + * 0: string, + * 1: string, + * } $crop + */ + function image_resize_dimensions($orig_w, $orig_h, $dest_w, $dest_h, $crop = \false) + { + } + /** + * Resizes an image to make a thumbnail or intermediate size. + * + * The returned array has the file size, the image width, and image height. The + * {@see 'image_make_intermediate_size'} filter can be used to hook in and change the + * values of the returned array. The only parameter is the resized file path. + * + * @since 2.5.0 + * + * @param string $file File path. + * @param int $width Image width. + * @param int $height Image height. + * @param bool|array $crop { + * Optional. Image cropping behavior. If false, the image will be scaled (default). + * If true, image will be cropped to the specified dimensions using center positions. + * If an array, the image will be cropped using the array to specify the crop location: + * + * @type string $0 The x crop position. Accepts 'left' 'center', or 'right'. + * @type string $1 The y crop position. Accepts 'top', 'center', or 'bottom'. + * } + * @return array|false Metadata array on success. False if no image was created. + * @phpstan-param bool|array{ + * 0: string, + * 1: string, + * } $crop + */ + function image_make_intermediate_size($file, $width, $height, $crop = \false) + { + } + /** + * Helper function to test if aspect ratios for two images match. + * + * @since 4.6.0 + * + * @param int $source_width Width of the first image in pixels. + * @param int $source_height Height of the first image in pixels. + * @param int $target_width Width of the second image in pixels. + * @param int $target_height Height of the second image in pixels. + * @return bool True if aspect ratios match within 1px. False if not. + */ + function wp_image_matches_ratio($source_width, $source_height, $target_width, $target_height) + { + } + /** + * Retrieves the image's intermediate size (resized) path, width, and height. + * + * The $size parameter can be an array with the width and height respectively. + * If the size matches the 'sizes' metadata array for width and height, then it + * will be used. If there is no direct match, then the nearest image size larger + * than the specified size will be used. If nothing is found, then the function + * will break out and return false. + * + * The metadata 'sizes' is used for compatible sizes that can be used for the + * parameter $size value. + * + * The url path will be given, when the $size parameter is a string. + * + * If you are passing an array for the $size, you should consider using + * add_image_size() so that a cropped version is generated. It's much more + * efficient than having to find the closest-sized image and then having the + * browser scale down the image. + * + * @since 2.5.0 + * + * @param int $post_id Attachment ID. + * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array + * of width and height values in pixels (in that order). Default 'thumbnail'. + * @return array|false { + * Array of file relative path, width, and height on success. Additionally includes absolute + * path and URL if registered size is passed to `$size` parameter. False on failure. + * + * @type string $file Filename of image. + * @type int $width Width of image in pixels. + * @type int $height Height of image in pixels. + * @type string $path Path of image relative to uploads directory. + * @type string $url URL of image. + * } + * @phpstan-return false|array{ + * file: string, + * width: int, + * height: int, + * path: string, + * url: string, + * } + */ + function image_get_intermediate_size($post_id, $size = 'thumbnail') + { + } + /** + * Gets the available intermediate image size names. + * + * @since 3.0.0 + * + * @return string[] An array of image size names. + */ + function get_intermediate_image_sizes() + { + } + /** + * Returns a normalized list of all currently registered image sub-sizes. + * + * @since 5.3.0 + * @uses wp_get_additional_image_sizes() + * @uses get_intermediate_image_sizes() + * + * @return array[] Associative array of arrays of image sub-size information, + * keyed by image size name. + */ + function wp_get_registered_image_subsizes() + { + } + /** + * Retrieves an image to represent an attachment. + * + * @since 2.5.0 + * + * @param int $attachment_id Image attachment ID. + * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array of + * width and height values in pixels (in that order). Default 'thumbnail'. + * @param bool $icon Optional. Whether the image should fall back to a mime type icon. Default false. + * @return array|false { + * Array of image data, or boolean false if no image is available. + * + * @type string $0 Image source URL. + * @type int $1 Image width in pixels. + * @type int $2 Image height in pixels. + * @type bool $3 Whether the image is a resized image. + * } + * @phpstan-return false|array{ + * 0: string, + * 1: int, + * 2: int, + * 3: bool, + * } + */ + function wp_get_attachment_image_src($attachment_id, $size = 'thumbnail', $icon = \false) + { + } + /** + * Gets an HTML img element representing an image attachment. + * + * While `$size` will accept an array, it is better to register a size with + * add_image_size() so that a cropped version is generated. It's much more + * efficient than having to find the closest-sized image and then having the + * browser scale down the image. + * + * @since 2.5.0 + * @since 4.4.0 The `$srcset` and `$sizes` attributes were added. + * @since 5.5.0 The `$loading` attribute was added. + * @since 6.1.0 The `$decoding` attribute was added. + * + * @param int $attachment_id Image attachment ID. + * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array + * of width and height values in pixels (in that order). Default 'thumbnail'. + * @param bool $icon Optional. Whether the image should be treated as an icon. Default false. + * @param string|array $attr { + * Optional. Attributes for the image markup. + * + * @type string $src Image attachment URL. + * @type string $class CSS class name or space-separated list of classes. + * Default `attachment-$size_class size-$size_class`, + * where `$size_class` is the image size being requested. + * @type string $alt Image description for the alt attribute. + * @type string $srcset The 'srcset' attribute value. + * @type string $sizes The 'sizes' attribute value. + * @type string|false $loading The 'loading' attribute value. Passing a value of false + * will result in the attribute being omitted for the image. + * Default determined by {@see wp_get_loading_optimization_attributes()}. + * @type string $decoding The 'decoding' attribute value. Possible values are + * 'async' (default), 'sync', or 'auto'. Passing false or an empty + * string will result in the attribute being omitted. + * @type string $fetchpriority The 'fetchpriority' attribute value, whether `high`, `low`, or `auto`. + * Default determined by {@see wp_get_loading_optimization_attributes()}. + * } + * @return string HTML img element or empty string on failure. + * @phpstan-param array{ + * src?: string, + * class?: string, + * alt?: string, + * srcset?: string, + * sizes?: string, + * loading?: string|false, + * decoding?: string, + * fetchpriority?: string, + * } $attr + */ + function wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = \false, $attr = '') + { + } + /** + * Gets the URL of an image attachment. + * + * @since 4.4.0 + * + * @param int $attachment_id Image attachment ID. + * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array of + * width and height values in pixels (in that order). Default 'thumbnail'. + * @param bool $icon Optional. Whether the image should be treated as an icon. Default false. + * @return string|false Attachment URL or false if no image is available. If `$size` does not match + * any registered image size, the original image URL will be returned. + */ + function wp_get_attachment_image_url($attachment_id, $size = 'thumbnail', $icon = \false) + { + } + /** + * Gets the attachment path relative to the upload directory. + * + * @since 4.4.1 + * @access private + * + * @param string $file Attachment file name. + * @return string Attachment path relative to the upload directory. + */ + function _wp_get_attachment_relative_path($file) + { + } + /** + * Gets the image size as array from its meta data. + * + * Used for responsive images. + * + * @since 4.4.0 + * @access private + * + * @param string $size_name Image size. Accepts any registered image size name. + * @param array $image_meta The image meta data. + * @return array|false { + * Array of width and height or false if the size isn't present in the meta data. + * + * @type int $0 Image width. + * @type int $1 Image height. + * } + * @phpstan-return false|array{ + * 0: int, + * 1: int, + * } + */ + function _wp_get_image_size_from_meta($size_name, $image_meta) + { + } + /** + * Retrieves the value for an image attachment's 'srcset' attribute. + * + * @since 4.4.0 + * + * @see wp_calculate_image_srcset() + * + * @param int $attachment_id Image attachment ID. + * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array of + * width and height values in pixels (in that order). Default 'medium'. + * @param array|null $image_meta Optional. The image meta data as returned by 'wp_get_attachment_metadata()'. + * Default null. + * @return string|false A 'srcset' value string or false. + */ + function wp_get_attachment_image_srcset($attachment_id, $size = 'medium', $image_meta = \null) + { + } + /** + * A helper function to calculate the image sources to include in a 'srcset' attribute. + * + * @since 4.4.0 + * + * @param int[] $size_array { + * An array of width and height values. + * + * @type int $0 The width in pixels. + * @type int $1 The height in pixels. + * } + * @param string $image_src The 'src' of the image. + * @param array $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'. + * @param int $attachment_id Optional. The image attachment ID. Default 0. + * @return string|false The 'srcset' attribute value. False on error or when only one source exists. + * @phpstan-param array{ + * 0: int, + * 1: int, + * } $size_array + */ + function wp_calculate_image_srcset($size_array, $image_src, $image_meta, $attachment_id = 0) + { + } + /** + * Retrieves the value for an image attachment's 'sizes' attribute. + * + * @since 4.4.0 + * + * @see wp_calculate_image_sizes() + * + * @param int $attachment_id Image attachment ID. + * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array of + * width and height values in pixels (in that order). Default 'medium'. + * @param array|null $image_meta Optional. The image meta data as returned by 'wp_get_attachment_metadata()'. + * Default null. + * @return string|false A valid source size value for use in a 'sizes' attribute or false. + */ + function wp_get_attachment_image_sizes($attachment_id, $size = 'medium', $image_meta = \null) + { + } + /** + * Creates a 'sizes' attribute value for an image. + * + * @since 4.4.0 + * + * @param string|int[] $size Image size. Accepts any registered image size name, or an array of + * width and height values in pixels (in that order). + * @param string|null $image_src Optional. The URL to the image file. Default null. + * @param array|null $image_meta Optional. The image meta data as returned by 'wp_get_attachment_metadata()'. + * Default null. + * @param int $attachment_id Optional. Image attachment ID. Either `$image_meta` or `$attachment_id` + * is needed when using the image size name as argument for `$size`. Default 0. + * @return string|false A valid source size value for use in a 'sizes' attribute or false. + */ + function wp_calculate_image_sizes($size, $image_src = \null, $image_meta = \null, $attachment_id = 0) + { + } + /** + * Determines if the image meta data is for the image source file. + * + * The image meta data is retrieved by attachment post ID. In some cases the post IDs may change. + * For example when the website is exported and imported at another website. Then the + * attachment post IDs that are in post_content for the exported website may not match + * the same attachments at the new website. + * + * @since 5.5.0 + * + * @param string $image_location The full path or URI to the image file. + * @param array $image_meta The attachment meta data as returned by 'wp_get_attachment_metadata()'. + * @param int $attachment_id Optional. The image attachment ID. Default 0. + * @return bool Whether the image meta is for this image file. + */ + function wp_image_file_matches_image_meta($image_location, $image_meta, $attachment_id = 0) + { + } + /** + * Determines an image's width and height dimensions based on the source file. + * + * @since 5.5.0 + * + * @param string $image_src The image source file. + * @param array $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'. + * @param int $attachment_id Optional. The image attachment ID. Default 0. + * @return array|false Array with first element being the width and second element being the height, + * or false if dimensions cannot be determined. + */ + function wp_image_src_get_dimensions($image_src, $image_meta, $attachment_id = 0) + { + } + /** + * Adds 'srcset' and 'sizes' attributes to an existing 'img' element. + * + * @since 4.4.0 + * + * @see wp_calculate_image_srcset() + * @see wp_calculate_image_sizes() + * + * @param string $image An HTML 'img' element to be filtered. + * @param array $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'. + * @param int $attachment_id Image attachment ID. + * @return string Converted 'img' element with 'srcset' and 'sizes' attributes added. + */ + function wp_image_add_srcset_and_sizes($image, $image_meta, $attachment_id) + { + } + /** + * Determines whether to add the `loading` attribute to the specified tag in the specified context. + * + * @since 5.5.0 + * @since 5.7.0 Now returns `true` by default for `iframe` tags. + * + * @param string $tag_name The tag name. + * @param string $context Additional context, like the current filter name + * or the function name from where this was called. + * @return bool Whether to add the attribute. + */ + function wp_lazy_loading_enabled($tag_name, $context) + { + } + /** + * Filters specific tags in post content and modifies their markup. + * + * Modifies HTML tags in post content to include new browser and HTML technologies + * that may not have existed at the time of post creation. These modifications currently + * include adding `srcset`, `sizes`, and `loading` attributes to `img` HTML tags, as well + * as adding `loading` attributes to `iframe` HTML tags. + * Future similar optimizations should be added/expected here. + * + * @since 5.5.0 + * @since 5.7.0 Now supports adding `loading` attributes to `iframe` tags. + * + * @see wp_img_tag_add_width_and_height_attr() + * @see wp_img_tag_add_srcset_and_sizes_attr() + * @see wp_img_tag_add_loading_optimization_attrs() + * @see wp_iframe_tag_add_loading_attr() + * + * @param string $content The HTML content to be filtered. + * @param string $context Optional. Additional context to pass to the filters. + * Defaults to `current_filter()` when not set. + * @return string Converted content with images modified. + */ + function wp_filter_content_tags($content, $context = \null) + { + } + /** + * Adds optimization attributes to an `img` HTML tag. + * + * @since 6.3.0 + * + * @param string $image The HTML `img` tag where the attribute should be added. + * @param string $context Additional context to pass to the filters. + * @return string Converted `img` tag with optimization attributes added. + */ + function wp_img_tag_add_loading_optimization_attrs($image, $context) + { + } + /** + * Adds `width` and `height` attributes to an `img` HTML tag. + * + * @since 5.5.0 + * + * @param string $image The HTML `img` tag where the attribute should be added. + * @param string $context Additional context to pass to the filters. + * @param int $attachment_id Image attachment ID. + * @return string Converted 'img' element with 'width' and 'height' attributes added. + */ + function wp_img_tag_add_width_and_height_attr($image, $context, $attachment_id) + { + } + /** + * Adds `srcset` and `sizes` attributes to an existing `img` HTML tag. + * + * @since 5.5.0 + * + * @param string $image The HTML `img` tag where the attribute should be added. + * @param string $context Additional context to pass to the filters. + * @param int $attachment_id Image attachment ID. + * @return string Converted 'img' element with 'loading' attribute added. + */ + function wp_img_tag_add_srcset_and_sizes_attr($image, $context, $attachment_id) + { + } + /** + * Adds `loading` attribute to an `iframe` HTML tag. + * + * @since 5.7.0 + * + * @param string $iframe The HTML `iframe` tag where the attribute should be added. + * @param string $context Additional context to pass to the filters. + * @return string Converted `iframe` tag with `loading` attribute added. + */ + function wp_iframe_tag_add_loading_attr($iframe, $context) + { + } + /** + * Adds a 'wp-post-image' class to post thumbnails. Internal use only. + * + * Uses the {@see 'begin_fetch_post_thumbnail_html'} and {@see 'end_fetch_post_thumbnail_html'} + * action hooks to dynamically add/remove itself so as to only filter post thumbnails. + * + * @ignore + * @since 2.9.0 + * + * @param string[] $attr Array of thumbnail attributes including src, class, alt, title, keyed by attribute name. + * @return string[] Modified array of attributes including the new 'wp-post-image' class. + */ + function _wp_post_thumbnail_class_filter($attr) + { + } + /** + * Adds '_wp_post_thumbnail_class_filter' callback to the 'wp_get_attachment_image_attributes' + * filter hook. Internal use only. + * + * @ignore + * @since 2.9.0 + * + * @param string[] $attr Array of thumbnail attributes including src, class, alt, title, keyed by attribute name. + */ + function _wp_post_thumbnail_class_filter_add($attr) + { + } + /** + * Removes the '_wp_post_thumbnail_class_filter' callback from the 'wp_get_attachment_image_attributes' + * filter hook. Internal use only. + * + * @ignore + * @since 2.9.0 + * + * @param string[] $attr Array of thumbnail attributes including src, class, alt, title, keyed by attribute name. + */ + function _wp_post_thumbnail_class_filter_remove($attr) + { + } + /** + * Overrides the context used in {@see wp_get_attachment_image()}. Internal use only. + * + * Uses the {@see 'begin_fetch_post_thumbnail_html'} and {@see 'end_fetch_post_thumbnail_html'} + * action hooks to dynamically add/remove itself so as to only filter post thumbnails. + * + * @ignore + * @since 6.3.0 + * @access private + * + * @param string $context The context for rendering an attachment image. + * @return string Modified context set to 'the_post_thumbnail'. + */ + function _wp_post_thumbnail_context_filter($context) + { + } + /** + * Adds the '_wp_post_thumbnail_context_filter' callback to the 'wp_get_attachment_image_context' + * filter hook. Internal use only. + * + * @ignore + * @since 6.3.0 + * @access private + */ + function _wp_post_thumbnail_context_filter_add() + { + } + /** + * Removes the '_wp_post_thumbnail_context_filter' callback from the 'wp_get_attachment_image_context' + * filter hook. Internal use only. + * + * @ignore + * @since 6.3.0 + * @access private + */ + function _wp_post_thumbnail_context_filter_remove() + { + } + /** + * Builds the Caption shortcode output. + * + * Allows a plugin to replace the content that would otherwise be returned. The + * filter is {@see 'img_caption_shortcode'} and passes an empty string, the attr + * parameter and the content parameter values. + * + * The supported attributes for the shortcode are 'id', 'caption_id', 'align', + * 'width', 'caption', and 'class'. + * + * @since 2.6.0 + * @since 3.9.0 The `class` attribute was added. + * @since 5.1.0 The `caption_id` attribute was added. + * @since 5.9.0 The `$content` parameter default value changed from `null` to `''`. + * + * @param array $attr { + * Attributes of the caption shortcode. + * + * @type string $id ID of the image and caption container element, i.e. `<figure>` or `<div>`. + * @type string $caption_id ID of the caption element, i.e. `<figcaption>` or `<p>`. + * @type string $align Class name that aligns the caption. Default 'alignnone'. Accepts 'alignleft', + * 'aligncenter', alignright', 'alignnone'. + * @type int $width The width of the caption, in pixels. + * @type string $caption The caption text. + * @type string $class Additional class name(s) added to the caption container. + * } + * @param string $content Optional. Shortcode content. Default empty string. + * @return string HTML content to display the caption. + * @phpstan-param array{ + * id?: string, + * caption_id?: string, + * align?: string, + * width?: int, + * caption?: string, + * class?: string, + * } $attr + */ + function img_caption_shortcode($attr, $content = '') + { + } + /** + * Builds the Gallery shortcode output. + * + * This implements the functionality of the Gallery Shortcode for displaying + * WordPress images on a post. + * + * @since 2.5.0 + * @since 2.8.0 Added the `$attr` parameter to set the shortcode output. New attributes included + * such as `size`, `itemtag`, `icontag`, `captiontag`, and columns. Changed markup from + * `div` tags to `dl`, `dt` and `dd` tags. Support more than one gallery on the + * same page. + * @since 2.9.0 Added support for `include` and `exclude` to shortcode. + * @since 3.5.0 Use get_post() instead of global `$post`. Handle mapping of `ids` to `include` + * and `orderby`. + * @since 3.6.0 Added validation for tags used in gallery shortcode. Add orientation information to items. + * @since 3.7.0 Introduced the `link` attribute. + * @since 3.9.0 `html5` gallery support, accepting 'itemtag', 'icontag', and 'captiontag' attributes. + * @since 4.0.0 Removed use of `extract()`. + * @since 4.1.0 Added attribute to `wp_get_attachment_link()` to output `aria-describedby`. + * @since 4.2.0 Passed the shortcode instance ID to `post_gallery` and `post_playlist` filters. + * @since 4.6.0 Standardized filter docs to match documentation standards for PHP. + * @since 5.1.0 Code cleanup for WPCS 1.0.0 coding standards. + * @since 5.3.0 Saved progress of intermediate image creation after upload. + * @since 5.5.0 Ensured that galleries can be output as a list of links in feeds. + * @since 5.6.0 Replaced order-style PHP type conversion functions with typecasts. Fix logic for + * an array of image dimensions. + * + * @param array $attr { + * Attributes of the gallery shortcode. + * + * @type string $order Order of the images in the gallery. Default 'ASC'. Accepts 'ASC', 'DESC'. + * @type string $orderby The field to use when ordering the images. Default 'menu_order ID'. + * Accepts any valid SQL ORDERBY statement. + * @type int $id Post ID. + * @type string $itemtag HTML tag to use for each image in the gallery. + * Default 'dl', or 'figure' when the theme registers HTML5 gallery support. + * @type string $icontag HTML tag to use for each image's icon. + * Default 'dt', or 'div' when the theme registers HTML5 gallery support. + * @type string $captiontag HTML tag to use for each image's caption. + * Default 'dd', or 'figcaption' when the theme registers HTML5 gallery support. + * @type int $columns Number of columns of images to display. Default 3. + * @type string|int[] $size Size of the images to display. Accepts any registered image size name, or an array + * of width and height values in pixels (in that order). Default 'thumbnail'. + * @type string $ids A comma-separated list of IDs of attachments to display. Default empty. + * @type string $include A comma-separated list of IDs of attachments to include. Default empty. + * @type string $exclude A comma-separated list of IDs of attachments to exclude. Default empty. + * @type string $link What to link each image to. Default empty (links to the attachment page). + * Accepts 'file', 'none'. + * } + * @return string HTML content to display gallery. + * @phpstan-param array{ + * order?: string, + * orderby?: string, + * id?: int, + * itemtag?: string, + * icontag?: string, + * captiontag?: string, + * columns?: int, + * size?: string|int[], + * ids?: string, + * include?: string, + * exclude?: string, + * link?: string, + * } $attr + */ + function gallery_shortcode($attr) + { + } + /** + * Outputs the templates used by playlists. + * + * @since 3.9.0 + */ + function wp_underscore_playlist_templates() + { + } + /** + * Outputs and enqueues default scripts and styles for playlists. + * + * @since 3.9.0 + * + * @param string $type Type of playlist. Accepts 'audio' or 'video'. + * @phpstan-param 'audio'|'video' $type + */ + function wp_playlist_scripts($type) + { + } + /** + * Builds the Playlist shortcode output. + * + * This implements the functionality of the playlist shortcode for displaying + * a collection of WordPress audio or video files in a post. + * + * @since 3.9.0 + * + * @global int $content_width + * + * @param array $attr { + * Array of default playlist attributes. + * + * @type string $type Type of playlist to display. Accepts 'audio' or 'video'. Default 'audio'. + * @type string $order Designates ascending or descending order of items in the playlist. + * Accepts 'ASC', 'DESC'. Default 'ASC'. + * @type string $orderby Any column, or columns, to sort the playlist. If $ids are + * passed, this defaults to the order of the $ids array ('post__in'). + * Otherwise default is 'menu_order ID'. + * @type int $id If an explicit $ids array is not present, this parameter + * will determine which attachments are used for the playlist. + * Default is the current post ID. + * @type array $ids Create a playlist out of these explicit attachment IDs. If empty, + * a playlist will be created from all $type attachments of $id. + * Default empty. + * @type array $exclude List of specific attachment IDs to exclude from the playlist. Default empty. + * @type string $style Playlist style to use. Accepts 'light' or 'dark'. Default 'light'. + * @type bool $tracklist Whether to show or hide the playlist. Default true. + * @type bool $tracknumbers Whether to show or hide the numbers next to entries in the playlist. Default true. + * @type bool $images Show or hide the video or audio thumbnail (Featured Image/post + * thumbnail). Default true. + * @type bool $artists Whether to show or hide artist name in the playlist. Default true. + * } + * + * @return string Playlist output. Empty string if the passed type is unsupported. + * @phpstan-param array{ + * type?: string, + * order?: string, + * orderby?: string, + * id?: int, + * ids?: array, + * exclude?: array, + * style?: string, + * tracklist?: bool, + * tracknumbers?: bool, + * images?: bool, + * artists?: bool, + * } $attr + */ + function wp_playlist_shortcode($attr) + { + } + /** + * Provides a No-JS Flash fallback as a last resort for audio / video. + * + * @since 3.6.0 + * + * @param string $url The media element URL. + * @return string Fallback HTML. + */ + function wp_mediaelement_fallback($url) + { + } + /** + * Returns a filtered list of supported audio formats. + * + * @since 3.6.0 + * + * @return string[] Supported audio formats. + */ + function wp_get_audio_extensions() + { + } + /** + * Returns useful keys to use to lookup data from an attachment's stored metadata. + * + * @since 3.9.0 + * + * @param WP_Post $attachment The current attachment, provided for context. + * @param string $context Optional. The context. Accepts 'edit', 'display'. Default 'display'. + * @return string[] Key/value pairs of field keys to labels. + */ + function wp_get_attachment_id3_keys($attachment, $context = 'display') + { + } + /** + * Builds the Audio shortcode output. + * + * This implements the functionality of the Audio Shortcode for displaying + * WordPress mp3s in a post. + * + * @since 3.6.0 + * + * @param array $attr { + * Attributes of the audio shortcode. + * + * @type string $src URL to the source of the audio file. Default empty. + * @type string $loop The 'loop' attribute for the `<audio>` element. Default empty. + * @type string $autoplay The 'autoplay' attribute for the `<audio>` element. Default empty. + * @type string $preload The 'preload' attribute for the `<audio>` element. Default 'none'. + * @type string $class The 'class' attribute for the `<audio>` element. Default 'wp-audio-shortcode'. + * @type string $style The 'style' attribute for the `<audio>` element. Default 'width: 100%;'. + * } + * @param string $content Shortcode content. + * @return string|void HTML content to display audio. + * @phpstan-param array{ + * src?: string, + * loop?: string, + * autoplay?: string, + * preload?: string, + * class?: string, + * style?: string, + * } $attr + */ + function wp_audio_shortcode($attr, $content = '') + { + } + /** + * Returns a filtered list of supported video formats. + * + * @since 3.6.0 + * + * @return string[] List of supported video formats. + */ + function wp_get_video_extensions() + { + } + /** + * Builds the Video shortcode output. + * + * This implements the functionality of the Video Shortcode for displaying + * WordPress mp4s in a post. + * + * @since 3.6.0 + * + * @global int $content_width + * + * @param array $attr { + * Attributes of the shortcode. + * + * @type string $src URL to the source of the video file. Default empty. + * @type int $height Height of the video embed in pixels. Default 360. + * @type int $width Width of the video embed in pixels. Default $content_width or 640. + * @type string $poster The 'poster' attribute for the `<video>` element. Default empty. + * @type string $loop The 'loop' attribute for the `<video>` element. Default empty. + * @type string $autoplay The 'autoplay' attribute for the `<video>` element. Default empty. + * @type string $muted The 'muted' attribute for the `<video>` element. Default false. + * @type string $preload The 'preload' attribute for the `<video>` element. + * Default 'metadata'. + * @type string $class The 'class' attribute for the `<video>` element. + * Default 'wp-video-shortcode'. + * } + * @param string $content Shortcode content. + * @return string|void HTML content to display video. + * @phpstan-param array{ + * src?: string, + * height?: int, + * width?: int, + * poster?: string, + * loop?: string, + * autoplay?: string, + * muted?: string, + * preload?: string, + * class?: string, + * } $attr + */ + function wp_video_shortcode($attr, $content = '') + { + } + /** + * Gets the previous image link that has the same post parent. + * + * @since 5.8.0 + * + * @see get_adjacent_image_link() + * + * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array + * of width and height values in pixels (in that order). Default 'thumbnail'. + * @param string|false $text Optional. Link text. Default false. + * @return string Markup for previous image link. + */ + function get_previous_image_link($size = 'thumbnail', $text = \false) + { + } + /** + * Displays previous image link that has the same post parent. + * + * @since 2.5.0 + * + * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array + * of width and height values in pixels (in that order). Default 'thumbnail'. + * @param string|false $text Optional. Link text. Default false. + */ + function previous_image_link($size = 'thumbnail', $text = \false) + { + } + /** + * Gets the next image link that has the same post parent. + * + * @since 5.8.0 + * + * @see get_adjacent_image_link() + * + * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array + * of width and height values in pixels (in that order). Default 'thumbnail'. + * @param string|false $text Optional. Link text. Default false. + * @return string Markup for next image link. + */ + function get_next_image_link($size = 'thumbnail', $text = \false) + { + } + /** + * Displays next image link that has the same post parent. + * + * @since 2.5.0 + * + * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array + * of width and height values in pixels (in that order). Default 'thumbnail'. + * @param string|false $text Optional. Link text. Default false. + */ + function next_image_link($size = 'thumbnail', $text = \false) + { + } + /** + * Gets the next or previous image link that has the same post parent. + * + * Retrieves the current attachment object from the $post global. + * + * @since 5.8.0 + * + * @param bool $prev Optional. Whether to display the next (false) or previous (true) link. Default true. + * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array + * of width and height values in pixels (in that order). Default 'thumbnail'. + * @param bool $text Optional. Link text. Default false. + * @return string Markup for image link. + */ + function get_adjacent_image_link($prev = \true, $size = 'thumbnail', $text = \false) + { + } + /** + * Displays next or previous image link that has the same post parent. + * + * Retrieves the current attachment object from the $post global. + * + * @since 2.5.0 + * + * @param bool $prev Optional. Whether to display the next (false) or previous (true) link. Default true. + * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array + * of width and height values in pixels (in that order). Default 'thumbnail'. + * @param bool $text Optional. Link text. Default false. + */ + function adjacent_image_link($prev = \true, $size = 'thumbnail', $text = \false) + { + } + /** + * Retrieves taxonomies attached to given the attachment. + * + * @since 2.5.0 + * @since 4.7.0 Introduced the `$output` parameter. + * + * @param int|array|object $attachment Attachment ID, data array, or data object. + * @param string $output Output type. 'names' to return an array of taxonomy names, + * or 'objects' to return an array of taxonomy objects. + * Default is 'names'. + * @return string[]|WP_Taxonomy[] List of taxonomies or taxonomy names. Empty array on failure. + * @phpstan-return ($output is 'names' ? array<int, string> : array<string, \WP_Taxonomy>) + */ + function get_attachment_taxonomies($attachment, $output = 'names') + { + } + /** + * Retrieves all of the taxonomies that are registered for attachments. + * + * Handles mime-type-specific taxonomies such as attachment:image and attachment:video. + * + * @since 3.5.0 + * + * @see get_taxonomies() + * + * @param string $output Optional. The type of taxonomy output to return. Accepts 'names' or 'objects'. + * Default 'names'. + * @return string[]|WP_Taxonomy[] Array of names or objects of registered taxonomies for attachments. + * @phpstan-param 'names'|'objects' $output + * @phpstan-return ($output is 'names' ? array<int, string> : array<string, \WP_Taxonomy>) + */ + function get_taxonomies_for_attachments($output = 'names') + { + } + /** + * Determines whether the value is an acceptable type for GD image functions. + * + * In PHP 8.0, the GD extension uses GdImage objects for its data structures. + * This function checks if the passed value is either a GdImage object instance + * or a resource of type `gd`. Any other type will return false. + * + * @since 5.6.0 + * + * @param resource|GdImage|false $image A value to check the type for. + * @return bool True if `$image` is either a GD image resource or a GdImage instance, + * false otherwise. + */ + function is_gd_image($image) + { + } + /** + * Creates a new GD image resource with transparency support. + * + * @todo Deprecate if possible. + * + * @since 2.9.0 + * + * @param int $width Image width in pixels. + * @param int $height Image height in pixels. + * @return resource|GdImage|false The GD image resource or GdImage instance on success. + * False on failure. + */ + function wp_imagecreatetruecolor($width, $height) + { + } + /** + * Based on a supplied width/height example, returns the biggest possible dimensions based on the max width/height. + * + * @since 2.9.0 + * + * @see wp_constrain_dimensions() + * + * @param int $example_width The width of an example embed. + * @param int $example_height The height of an example embed. + * @param int $max_width The maximum allowed width. + * @param int $max_height The maximum allowed height. + * @return int[] { + * An array of maximum width and height values. + * + * @type int $0 The maximum width in pixels. + * @type int $1 The maximum height in pixels. + * } + * @phpstan-return array{ + * 0: int, + * 1: int, + * } + */ + function wp_expand_dimensions($example_width, $example_height, $max_width, $max_height) + { + } + /** + * Determines the maximum upload size allowed in php.ini. + * + * @since 2.5.0 + * + * @return int Allowed upload size. + */ + function wp_max_upload_size() + { + } + /** + * Returns a WP_Image_Editor instance and loads file into it. + * + * @since 3.5.0 + * + * @param string $path Path to the file to load. + * @param array $args Optional. Additional arguments for retrieving the image editor. + * Default empty array. + * @return WP_Image_Editor|WP_Error The WP_Image_Editor object on success, + * a WP_Error object otherwise. + */ + function wp_get_image_editor($path, $args = array()) + { + } + /** + * Tests whether there is an editor that supports a given mime type or methods. + * + * @since 3.5.0 + * + * @param string|array $args Optional. Array of arguments to retrieve the image editor supports. + * Default empty array. + * @return bool True if an eligible editor is found; false otherwise. + */ + function wp_image_editor_supports($args = array()) + { + } + /** + * Tests which editors are capable of supporting the request. + * + * @ignore + * @since 3.5.0 + * + * @param array $args Optional. Array of arguments for choosing a capable editor. Default empty array. + * @return string|false Class name for the first editor that claims to support the request. + * False if no editor claims to support the request. + */ + function _wp_image_editor_choose($args = array()) + { + } + /** + * Prints default Plupload arguments. + * + * @since 3.4.0 + * @phpstan-return void + */ + function wp_plupload_default_settings() + { + } + /** + * Prepares an attachment post object for JS, where it is expected + * to be JSON-encoded and fit into an Attachment model. + * + * @since 3.5.0 + * + * @param int|WP_Post $attachment Attachment ID or object. + * @return array|void { + * Array of attachment details, or void if the parameter does not correspond to an attachment. + * + * @type string $alt Alt text of the attachment. + * @type string $author ID of the attachment author, as a string. + * @type string $authorName Name of the attachment author. + * @type string $caption Caption for the attachment. + * @type array $compat Containing item and meta. + * @type string $context Context, whether it's used as the site icon for example. + * @type int $date Uploaded date, timestamp in milliseconds. + * @type string $dateFormatted Formatted date (e.g. June 29, 2018). + * @type string $description Description of the attachment. + * @type string $editLink URL to the edit page for the attachment. + * @type string $filename File name of the attachment. + * @type string $filesizeHumanReadable Filesize of the attachment in human readable format (e.g. 1 MB). + * @type int $filesizeInBytes Filesize of the attachment in bytes. + * @type int $height If the attachment is an image, represents the height of the image in pixels. + * @type string $icon Icon URL of the attachment (e.g. /wp-includes/images/media/archive.png). + * @type int $id ID of the attachment. + * @type string $link URL to the attachment. + * @type int $menuOrder Menu order of the attachment post. + * @type array $meta Meta data for the attachment. + * @type string $mime Mime type of the attachment (e.g. image/jpeg or application/zip). + * @type int $modified Last modified, timestamp in milliseconds. + * @type string $name Name, same as title of the attachment. + * @type array $nonces Nonces for update, delete and edit. + * @type string $orientation If the attachment is an image, represents the image orientation + * (landscape or portrait). + * @type array $sizes If the attachment is an image, contains an array of arrays + * for the images sizes: thumbnail, medium, large, and full. + * @type string $status Post status of the attachment (usually 'inherit'). + * @type string $subtype Mime subtype of the attachment (usually the last part, e.g. jpeg or zip). + * @type string $title Title of the attachment (usually slugified file name without the extension). + * @type string $type Type of the attachment (usually first part of the mime type, e.g. image). + * @type int $uploadedTo Parent post to which the attachment was uploaded. + * @type string $uploadedToLink URL to the edit page of the parent post of the attachment. + * @type string $uploadedToTitle Post title of the parent of the attachment. + * @type string $url Direct URL to the attachment file (from wp-content). + * @type int $width If the attachment is an image, represents the width of the image in pixels. + * } + * + * @phpstan-return void|array{ + * alt: string, + * author: string, + * authorName: string, + * caption: string, + * compat: array, + * context: string, + * date: int, + * dateFormatted: string, + * description: string, + * editLink: string, + * filename: string, + * filesizeHumanReadable: string, + * filesizeInBytes: int, + * height: int, + * icon: string, + * id: int, + * link: string, + * menuOrder: int, + * meta: array, + * mime: string, + * modified: int, + * name: string, + * nonces: array, + * orientation: string, + * sizes: array, + * status: string, + * subtype: string, + * title: string, + * type: string, + * uploadedTo: int, + * uploadedToLink: string, + * uploadedToTitle: string, + * url: string, + * width: int, + * } + */ + function wp_prepare_attachment_for_js($attachment) + { + } + /** + * Enqueues all scripts, styles, settings, and templates necessary to use + * all media JS APIs. + * + * @since 3.5.0 + * + * @global int $content_width + * @global wpdb $wpdb WordPress database abstraction object. + * @global WP_Locale $wp_locale WordPress date and time locale object. + * + * @param array $args { + * Arguments for enqueuing media scripts. + * + * @type int|WP_Post $post Post ID or post object. + * } + * @phpstan-param array{ + * post?: int|WP_Post, + * } $args + * @phpstan-return void + */ + function wp_enqueue_media($args = array()) + { + } + /** + * Retrieves media attached to the passed post. + * + * @since 3.6.0 + * + * @param string $type Mime type. + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. + * @return WP_Post[] Array of media attached to the given post. + */ + function get_attached_media($type, $post = 0) + { + } + /** + * Checks the HTML content for an audio, video, object, embed, or iframe tags. + * + * @since 3.6.0 + * + * @param string $content A string of HTML which might contain media elements. + * @param string[] $types An array of media types: 'audio', 'video', 'object', 'embed', or 'iframe'. + * @return string[] Array of found HTML media elements. + */ + function get_media_embedded_in_content($content, $types = \null) + { + } + /** + * Retrieves galleries from the passed post's content. + * + * @since 3.6.0 + * + * @param int|WP_Post $post Post ID or object. + * @param bool $html Optional. Whether to return HTML or data in the array. Default true. + * @return array A list of arrays, each containing gallery data and srcs parsed + * from the expanded shortcode. + */ + function get_post_galleries($post, $html = \true) + { + } + /** + * Checks a specified post's content for gallery and, if present, return the first + * + * @since 3.6.0 + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. + * @param bool $html Optional. Whether to return HTML or data. Default is true. + * @return string|array Gallery data and srcs parsed from the expanded shortcode. + */ + function get_post_gallery($post = 0, $html = \true) + { + } + /** + * Retrieves the image srcs from galleries from a post's content, if present. + * + * @since 3.6.0 + * + * @see get_post_galleries() + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`. + * @return array A list of lists, each containing image srcs parsed. + * from an expanded shortcode + */ + function get_post_galleries_images($post = 0) + { + } + /** + * Checks a post's content for galleries and return the image srcs for the first found gallery. + * + * @since 3.6.0 + * + * @see get_post_gallery() + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`. + * @return string[] A list of a gallery's image srcs in order. + */ + function get_post_gallery_images($post = 0) + { + } + /** + * Maybe attempts to generate attachment metadata, if missing. + * + * @since 3.9.0 + * + * @param WP_Post $attachment Attachment object. + * @phpstan-return void + */ + function wp_maybe_generate_attachment_metadata($attachment) + { + } + /** + * Tries to convert an attachment URL into a post ID. + * + * @since 4.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $url The URL to resolve. + * @return int The found post ID, or 0 on failure. + */ + function attachment_url_to_postid($url) + { + } + /** + * Returns the URLs for CSS files used in an iframe-sandbox'd TinyMCE media view. + * + * @since 4.0.0 + * + * @return string[] The relevant CSS file URLs. + */ + function wpview_media_sandbox_styles() + { + } + /** + * Registers the personal data exporter for media. + * + * @param array[] $exporters An array of personal data exporters, keyed by their ID. + * @return array[] Updated array of personal data exporters. + */ + function wp_register_media_personal_data_exporter($exporters) + { + } + /** + * Finds and exports attachments associated with an email address. + * + * @since 4.9.6 + * + * @param string $email_address The attachment owner email address. + * @param int $page Attachment page number. + * @return array { + * An array of personal data. + * + * @type array[] $data An array of personal data arrays. + * @type bool $done Whether the exporter is finished. + * } + * @phpstan-return array{ + * data: array[], + * done: bool, + * } + */ + function wp_media_personal_data_exporter($email_address, $page = 1) + { + } + /** + * Adds additional default image sub-sizes. + * + * These sizes are meant to enhance the way WordPress displays images on the front-end on larger, + * high-density devices. They make it possible to generate more suitable `srcset` and `sizes` attributes + * when the users upload large images. + * + * The sizes can be changed or removed by themes and plugins but that is not recommended. + * The size "names" reflect the image dimensions, so changing the sizes would be quite misleading. + * + * @since 5.3.0 + * @access private + */ + function _wp_add_additional_image_sizes() + { + } + /** + * Callback to enable showing of the user error when uploading .heic images. + * + * @since 5.5.0 + * + * @param array[] $plupload_settings The settings for Plupload.js. + * @return array[] Modified settings for Plupload.js. + */ + function wp_show_heic_upload_error($plupload_settings) + { + } + /** + * Allows PHP's getimagesize() to be debuggable when necessary. + * + * @since 5.7.0 + * @since 5.8.0 Added support for WebP images. + * @since 6.5.0 Added support for AVIF images. + * + * @param string $filename The file path. + * @param array $image_info Optional. Extended image information (passed by reference). + * @return array|false Array of image information or false on failure. + */ + function wp_getimagesize($filename, ?array &$image_info = \null) + { + } + /** + * Extracts meta information about an AVIF file: width, height, bit depth, and number of channels. + * + * @since 6.5.0 + * + * @param string $filename Path to an AVIF file. + * @return array { + * An array of AVIF image information. + * + * @type int|false $width Image width on success, false on failure. + * @type int|false $height Image height on success, false on failure. + * @type int|false $bit_depth Image bit depth on success, false on failure. + * @type int|false $num_channels Image number of channels on success, false on failure. + * } + * @phpstan-return array{ + * width: int|false, + * height: int|false, + * bit_depth: int|false, + * num_channels: int|false, + * } + */ + function wp_get_avif_info($filename) + { + } + /** + * Extracts meta information about a WebP file: width, height, and type. + * + * @since 5.8.0 + * + * @param string $filename Path to a WebP file. + * @return array { + * An array of WebP image information. + * + * @type int|false $width Image width on success, false on failure. + * @type int|false $height Image height on success, false on failure. + * @type string|false $type The WebP type: one of 'lossy', 'lossless' or 'animated-alpha'. + * False on failure. + * } + * @phpstan-return array{ + * width: int|false, + * height: int|false, + * type: string|false, + * } + */ + function wp_get_webp_info($filename) + { + } + /** + * Gets loading optimization attributes. + * + * This function returns an array of attributes that should be merged into the given attributes array to optimize + * loading performance. Potential attributes returned by this function are: + * - `loading` attribute with a value of "lazy" + * - `fetchpriority` attribute with a value of "high" + * - `decoding` attribute with a value of "async" + * + * If any of these attributes are already present in the given attributes, they will not be modified. Note that no + * element should have both `loading="lazy"` and `fetchpriority="high"`, so the function will trigger a warning in case + * both attributes are present with those values. + * + * @since 6.3.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param string $tag_name The tag name. + * @param array $attr Array of the attributes for the tag. + * @param string $context Context for the element for which the loading optimization attribute is requested. + * @return array Loading optimization attributes. + */ + function wp_get_loading_optimization_attributes($tag_name, $attr, $context) + { + } + /** + * Gets the threshold for how many of the first content media elements to not lazy-load. + * + * This function runs the {@see 'wp_omit_loading_attr_threshold'} filter, which uses a default threshold value of 3. + * The filter is only run once per page load, unless the `$force` parameter is used. + * + * @since 5.9.0 + * + * @param bool $force Optional. If set to true, the filter will be (re-)applied even if it already has been before. + * Default false. + * @return int The number of content media elements to not lazy-load. + */ + function wp_omit_loading_attr_threshold($force = \false) + { + } + /** + * Increases an internal content media count variable. + * + * @since 5.9.0 + * @access private + * + * @param int $amount Optional. Amount to increase by. Default 1. + * @return int The latest content media count, after the increase. + */ + function wp_increase_content_media_count($amount = 1) + { + } + /** + * Determines whether to add `fetchpriority='high'` to loading attributes. + * + * @since 6.3.0 + * @access private + * + * @param array $loading_attrs Array of the loading optimization attributes for the element. + * @param string $tag_name The tag name. + * @param array $attr Array of the attributes for the element. + * @return array Updated loading optimization attributes for the element. + */ + function wp_maybe_add_fetchpriority_high_attr($loading_attrs, $tag_name, $attr) + { + } + /** + * Accesses a flag that indicates if an element is a possible candidate for `fetchpriority='high'`. + * + * @since 6.3.0 + * @access private + * + * @param bool $value Optional. Used to change the static variable. Default null. + * @return bool Returns true if high-priority element was marked already, otherwise false. + */ + function wp_high_priority_element_flag($value = \null) + { + } + /** + * Adds metadata for the specified object. + * + * @since 2.9.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', + * or any other object type with an associated meta table. + * @param int $object_id ID of the object metadata is for. + * @param string $meta_key Metadata key. + * @param mixed $meta_value Metadata value. Must be serializable if non-scalar. + * @param bool $unique Optional. Whether the specified metadata key should be unique for the object. + * If true, and the object already has a value for the specified metadata key, + * no change will be made. Default false. + * @return int|false The meta ID on success, false on failure. + */ + function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique = \false) + { + } + /** + * Updates metadata for the specified object. If no value already exists for the specified object + * ID and metadata key, the metadata will be added. + * + * @since 2.9.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', + * or any other object type with an associated meta table. + * @param int $object_id ID of the object metadata is for. + * @param string $meta_key Metadata key. + * @param mixed $meta_value Metadata value. Must be serializable if non-scalar. + * @param mixed $prev_value Optional. Previous value to check before updating. + * If specified, only update existing metadata entries with + * this value. Otherwise, update all entries. Default empty string. + * @return int|bool The new meta field ID if a field with the given key didn't exist + * and was therefore added, true on successful update, + * false on failure or if the value passed to the function + * is the same as the one that is already in the database. + */ + function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_value = '') + { + } + /** + * Deletes metadata for the specified object. + * + * @since 2.9.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', + * or any other object type with an associated meta table. + * @param int $object_id ID of the object metadata is for. + * @param string $meta_key Metadata key. + * @param mixed $meta_value Optional. Metadata value. Must be serializable if non-scalar. + * If specified, only delete metadata entries with this value. + * Otherwise, delete all entries with the specified meta_key. + * Pass `null`, `false`, or an empty string to skip this check. + * (For backward compatibility, it is not possible to pass an empty string + * to delete those entries with an empty string for a value.) + * Default empty string. + * @param bool $delete_all Optional. If true, delete matching metadata entries for all objects, + * ignoring the specified object_id. Otherwise, only delete + * matching metadata entries for the specified object_id. Default false. + * @return bool True on successful delete, false on failure. + */ + function delete_metadata($meta_type, $object_id, $meta_key, $meta_value = '', $delete_all = \false) + { + } + /** + * Retrieves the value of a metadata field for the specified object type and ID. + * + * If the meta field exists, a single value is returned if `$single` is true, + * or an array of values if it's false. + * + * If the meta field does not exist, the result depends on get_metadata_default(). + * By default, an empty string is returned if `$single` is true, or an empty array + * if it's false. + * + * @since 2.9.0 + * + * @see get_metadata_raw() + * @see get_metadata_default() + * + * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', + * or any other object type with an associated meta table. + * @param int $object_id ID of the object metadata is for. + * @param string $meta_key Optional. Metadata key. If not specified, retrieve all metadata for + * the specified object. Default empty string. + * @param bool $single Optional. If true, return only the first value of the specified `$meta_key`. + * This parameter has no effect if `$meta_key` is not specified. Default false. + * @return mixed An array of values if `$single` is false. + * The value of the meta field if `$single` is true. + * False for an invalid `$object_id` (non-numeric, zero, or negative value), + * or if `$meta_type` is not specified. + * An empty string if a valid but non-existing object ID is passed. + */ + function get_metadata($meta_type, $object_id, $meta_key = '', $single = \false) + { + } + /** + * Retrieves raw metadata value for the specified object. + * + * @since 5.5.0 + * + * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', + * or any other object type with an associated meta table. + * @param int $object_id ID of the object metadata is for. + * @param string $meta_key Optional. Metadata key. If not specified, retrieve all metadata for + * the specified object. Default empty string. + * @param bool $single Optional. If true, return only the first value of the specified `$meta_key`. + * This parameter has no effect if `$meta_key` is not specified. Default false. + * @return mixed An array of values if `$single` is false. + * The value of the meta field if `$single` is true. + * False for an invalid `$object_id` (non-numeric, zero, or negative value), + * or if `$meta_type` is not specified. + * Null if the value does not exist. + */ + function get_metadata_raw($meta_type, $object_id, $meta_key = '', $single = \false) + { + } + /** + * Retrieves default metadata value for the specified meta key and object. + * + * By default, an empty string is returned if `$single` is true, or an empty array + * if it's false. + * + * @since 5.5.0 + * + * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', + * or any other object type with an associated meta table. + * @param int $object_id ID of the object metadata is for. + * @param string $meta_key Metadata key. + * @param bool $single Optional. If true, return only the first value of the specified `$meta_key`. + * This parameter has no effect if `$meta_key` is not specified. Default false. + * @return mixed An array of default values if `$single` is false. + * The default value of the meta field if `$single` is true. + */ + function get_metadata_default($meta_type, $object_id, $meta_key, $single = \false) + { + } + /** + * Determines if a meta field with the given key exists for the given object ID. + * + * @since 3.3.0 + * + * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', + * or any other object type with an associated meta table. + * @param int $object_id ID of the object metadata is for. + * @param string $meta_key Metadata key. + * @return bool Whether a meta field with the given key exists. + */ + function metadata_exists($meta_type, $object_id, $meta_key) + { + } + /** + * Retrieves metadata by meta ID. + * + * @since 3.3.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', + * or any other object type with an associated meta table. + * @param int $meta_id ID for a specific meta row. + * @return stdClass|false { + * Metadata object, or boolean `false` if the metadata doesn't exist. + * + * @type string $meta_key The meta key. + * @type mixed $meta_value The unserialized meta value. + * @type string $meta_id Optional. The meta ID when the meta type is any value except 'user'. + * @type string $umeta_id Optional. The meta ID when the meta type is 'user'. + * @type string $post_id Optional. The object ID when the meta type is 'post'. + * @type string $comment_id Optional. The object ID when the meta type is 'comment'. + * @type string $term_id Optional. The object ID when the meta type is 'term'. + * @type string $user_id Optional. The object ID when the meta type is 'user'. + * } + * @phpstan-return false|object{ + * meta_key: string, + * meta_value: mixed, + * meta_id: string, + * umeta_id: string, + * post_id: string, + * comment_id: string, + * term_id: string, + * user_id: string, + * } + */ + function get_metadata_by_mid($meta_type, $meta_id) + { + } + /** + * Updates metadata by meta ID. + * + * @since 3.3.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', + * or any other object type with an associated meta table. + * @param int $meta_id ID for a specific meta row. + * @param string $meta_value Metadata value. Must be serializable if non-scalar. + * @param string|false $meta_key Optional. You can provide a meta key to update it. Default false. + * @return bool True on successful update, false on failure. + */ + function update_metadata_by_mid($meta_type, $meta_id, $meta_value, $meta_key = \false) + { + } + /** + * Deletes metadata by meta ID. + * + * @since 3.3.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', + * or any other object type with an associated meta table. + * @param int $meta_id ID for a specific meta row. + * @return bool True on successful delete, false on failure. + */ + function delete_metadata_by_mid($meta_type, $meta_id) + { + } + /** + * Updates the metadata cache for the specified objects. + * + * @since 2.9.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', + * or any other object type with an associated meta table. + * @param string|int[] $object_ids Array or comma delimited list of object IDs to update cache for. + * @return array|false Metadata cache for the specified objects, or false on failure. + */ + function update_meta_cache($meta_type, $object_ids) + { + } + /** + * Retrieves the queue for lazy-loading metadata. + * + * @since 4.5.0 + * + * @return WP_Metadata_Lazyloader Metadata lazyloader queue. + */ + function wp_metadata_lazyloader() + { + } + /** + * Given a meta query, generates SQL clauses to be appended to a main query. + * + * @since 3.2.0 + * + * @see WP_Meta_Query + * + * @param array $meta_query A meta query. + * @param string $type Type of meta. + * @param string $primary_table Primary database table name. + * @param string $primary_id_column Primary ID column name. + * @param object $context Optional. The main query object. Default null. + * @return string[]|false { + * Array containing JOIN and WHERE SQL clauses to append to the main query, + * or false if no table exists for the requested meta type. + * + * @type string $join SQL fragment to append to the main JOIN clause. + * @type string $where SQL fragment to append to the main WHERE clause. + * } + * @phpstan-return false|array{ + * join: string, + * where: string, + * } + */ + function get_meta_sql($meta_query, $type, $primary_table, $primary_id_column, $context = \null) + { + } + /** + * Retrieves the name of the metadata table for the specified object type. + * + * @since 2.9.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', + * or any other object type with an associated meta table. + * @return string|false Metadata table name, or false if no metadata table exists + */ + function _get_meta_table($type) + { + } + /** + * Determines whether a meta key is considered protected. + * + * @since 3.1.3 + * + * @param string $meta_key Metadata key. + * @param string $meta_type Optional. Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', + * or any other object type with an associated meta table. Default empty string. + * @return bool Whether the meta key is considered protected. + */ + function is_protected_meta($meta_key, $meta_type = '') + { + } + /** + * Sanitizes meta value. + * + * @since 3.1.3 + * @since 4.9.8 The `$object_subtype` parameter was added. + * + * @param string $meta_key Metadata key. + * @param mixed $meta_value Metadata value to sanitize. + * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', + * or any other object type with an associated meta table. + * @param string $object_subtype Optional. The subtype of the object type. Default empty string. + * @return mixed Sanitized $meta_value. + */ + function sanitize_meta($meta_key, $meta_value, $object_type, $object_subtype = '') + { + } + /** + * Registers a meta key. + * + * It is recommended to register meta keys for a specific combination of object type and object subtype. If passing + * an object subtype is omitted, the meta key will be registered for the entire object type, however it can be partly + * overridden in case a more specific meta key of the same name exists for the same object type and a subtype. + * + * If an object type does not support any subtypes, such as users or comments, you should commonly call this function + * without passing a subtype. + * + * @since 3.3.0 + * @since 4.6.0 {@link https://core.trac.wordpress.org/ticket/35658 Modified + * to support an array of data to attach to registered meta keys}. Previous arguments for + * `$sanitize_callback` and `$auth_callback` have been folded into this array. + * @since 4.9.8 The `$object_subtype` argument was added to the arguments array. + * @since 5.3.0 Valid meta types expanded to include "array" and "object". + * @since 5.5.0 The `$default` argument was added to the arguments array. + * @since 6.4.0 The `$revisions_enabled` argument was added to the arguments array. + * + * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', + * or any other object type with an associated meta table. + * @param string $meta_key Meta key to register. + * @param array $args { + * Data used to describe the meta key when registered. + * + * @type string $object_subtype A subtype; e.g. if the object type is "post", the post type. If left empty, + * the meta key will be registered on the entire object type. Default empty. + * @type string $type The type of data associated with this meta key. + * Valid values are 'string', 'boolean', 'integer', 'number', 'array', and 'object'. + * @type string $description A description of the data attached to this meta key. + * @type bool $single Whether the meta key has one value per object, or an array of values per object. + * @type mixed $default The default value returned from get_metadata() if no value has been set yet. + * When using a non-single meta key, the default value is for the first entry. + * In other words, when calling get_metadata() with `$single` set to `false`, + * the default value given here will be wrapped in an array. + * @type callable $sanitize_callback A function or method to call when sanitizing `$meta_key` data. + * @type callable $auth_callback Optional. A function or method to call when performing edit_post_meta, + * add_post_meta, and delete_post_meta capability checks. + * @type bool|array $show_in_rest Whether data associated with this meta key can be considered public and + * should be accessible via the REST API. A custom post type must also declare + * support for custom fields for registered meta to be accessible via REST. + * When registering complex meta values this argument may optionally be an + * array with 'schema' or 'prepare_callback' keys instead of a boolean. + * @type bool $revisions_enabled Whether to enable revisions support for this meta_key. Can only be used when the + * object type is 'post'. + * } + * @param string|array $deprecated Deprecated. Use `$args` instead. + * @return bool True if the meta key was successfully registered in the global array, false if not. + * Registering a meta key with distinct sanitize and auth callbacks will fire those callbacks, + * but will not add to the global registry. + * @phpstan-param array{ + * object_subtype?: string, + * type?: string, + * description?: string, + * single?: bool, + * default?: mixed, + * sanitize_callback?: callable, + * auth_callback?: callable, + * show_in_rest?: bool|array, + * revisions_enabled?: bool, + * } $args + */ + function register_meta($object_type, $meta_key, $args, $deprecated = \null) + { + } + /** + * Filters into default_{$object_type}_metadata and adds in default value. + * + * @since 5.5.0 + * + * @param mixed $value Current value passed to filter. + * @param int $object_id ID of the object metadata is for. + * @param string $meta_key Metadata key. + * @param bool $single If true, return only the first value of the specified `$meta_key`. + * This parameter has no effect if `$meta_key` is not specified. + * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', + * or any other object type with an associated meta table. + * @return mixed An array of default values if `$single` is false. + * The default value of the meta field if `$single` is true. + */ + function filter_default_metadata($value, $object_id, $meta_key, $single, $meta_type) + { + } + /** + * Checks if a meta key is registered. + * + * @since 4.6.0 + * @since 4.9.8 The `$object_subtype` parameter was added. + * + * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', + * or any other object type with an associated meta table. + * @param string $meta_key Metadata key. + * @param string $object_subtype Optional. The subtype of the object type. Default empty string. + * @return bool True if the meta key is registered to the object type and, if provided, + * the object subtype. False if not. + */ + function registered_meta_key_exists($object_type, $meta_key, $object_subtype = '') + { + } + /** + * Unregisters a meta key from the list of registered keys. + * + * @since 4.6.0 + * @since 4.9.8 The `$object_subtype` parameter was added. + * + * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', + * or any other object type with an associated meta table. + * @param string $meta_key Metadata key. + * @param string $object_subtype Optional. The subtype of the object type. Default empty string. + * @return bool True if successful. False if the meta key was not registered. + */ + function unregister_meta_key($object_type, $meta_key, $object_subtype = '') + { + } + /** + * Retrieves a list of registered metadata args for an object type, keyed by their meta keys. + * + * @since 4.6.0 + * @since 4.9.8 The `$object_subtype` parameter was added. + * + * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', + * or any other object type with an associated meta table. + * @param string $object_subtype Optional. The subtype of the object type. Default empty string. + * @return array[] List of registered metadata args, keyed by their meta keys. + */ + function get_registered_meta_keys($object_type, $object_subtype = '') + { + } + /** + * Retrieves registered metadata for a specified object. + * + * The results include both meta that is registered specifically for the + * object's subtype and meta that is registered for the entire object type. + * + * @since 4.6.0 + * + * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', + * or any other object type with an associated meta table. + * @param int $object_id ID of the object the metadata is for. + * @param string $meta_key Optional. Registered metadata key. If not specified, retrieve all registered + * metadata for the specified object. + * @return mixed A single value or array of values for a key if specified. An array of all registered keys + * and values for an object ID if not. False if a given $meta_key is not registered. + */ + function get_registered_metadata($object_type, $object_id, $meta_key = '') + { + } + /** + * Filters out `register_meta()` args based on an allowed list. + * + * `register_meta()` args may change over time, so requiring the allowed list + * to be explicitly turned off is a warranty seal of sorts. + * + * @access private + * @since 5.5.0 + * + * @param array $args Arguments from `register_meta()`. + * @param array $default_args Default arguments for `register_meta()`. + * @return array Filtered arguments. + */ + function _wp_register_meta_args_allowed_list($args, $default_args) + { + } + /** + * Returns the object subtype for a given object ID of a specific type. + * + * @since 4.9.8 + * + * @param string $object_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', + * or any other object type with an associated meta table. + * @param int $object_id ID of the object to retrieve its subtype. + * @return string The object subtype or an empty string if unspecified subtype. + */ + function get_object_subtype($object_type, $object_id) + { + } + /** + * Updates the last_updated field for the current site. + * + * @since MU (3.0.0) + */ + function wpmu_update_blogs_date() + { + } + /** + * Gets a full site URL, given a site ID. + * + * @since MU (3.0.0) + * + * @param int $blog_id Site ID. + * @return string Full site URL if found. Empty string if not. + */ + function get_blogaddress_by_id($blog_id) + { + } + /** + * Gets a full site URL, given a site name. + * + * @since MU (3.0.0) + * + * @param string $blogname Name of the subdomain or directory. + * @return string + */ + function get_blogaddress_by_name($blogname) + { + } + /** + * Retrieves a site's ID given its (subdomain or directory) slug. + * + * @since MU (3.0.0) + * @since 4.7.0 Converted to use `get_sites()`. + * + * @param string $slug A site's slug. + * @return int|null The site ID, or null if no site is found for the given slug. + */ + function get_id_from_blogname($slug) + { + } + /** + * Retrieves the details for a blog from the blogs table and blog options. + * + * @since MU (3.0.0) + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int|string|array $fields Optional. A blog ID, a blog slug, or an array of fields to query against. + * Defaults to the current blog ID. + * @param bool $get_all Whether to retrieve all details or only the details in the blogs table. + * Default is true. + * @return WP_Site|false Blog details on success. False on failure. + */ + function get_blog_details($fields = \null, $get_all = \true) + { + } + /** + * Clears the blog details cache. + * + * @since MU (3.0.0) + * + * @param int $blog_id Optional. Blog ID. Defaults to current blog. + */ + function refresh_blog_details($blog_id = 0) + { + } + /** + * Updates the details for a blog and the blogs table for a given blog ID. + * + * @since MU (3.0.0) + * + * @param int $blog_id Blog ID. + * @param array $details Array of details keyed by blogs table field names. + * @return bool True if update succeeds, false otherwise. + */ + function update_blog_details($blog_id, $details = array()) + { + } + /** + * Cleans the site details cache for a site. + * + * @since 4.7.4 + * + * @param int $site_id Optional. Site ID. Default is the current site ID. + */ + function clean_site_details_cache($site_id = 0) + { + } + /** + * Retrieves option value for a given blog id based on name of option. + * + * If the option does not exist or does not have a value, then the return value + * will be false. This is useful to check whether you need to install an option + * and is commonly used during installation of plugin options and to test + * whether upgrading is required. + * + * If the option was serialized then it will be unserialized when it is returned. + * + * @since MU (3.0.0) + * + * @param int $id A blog ID. Can be null to refer to the current blog. + * @param string $option Name of option to retrieve. Expected to not be SQL-escaped. + * @param mixed $default_value Optional. Default value to return if the option does not exist. + * @return mixed Value set for the option. + */ + function get_blog_option($id, $option, $default_value = \false) + { + } + /** + * Adds a new option for a given blog ID. + * + * You do not need to serialize values. If the value needs to be serialized, then + * it will be serialized before it is inserted into the database. Remember, + * resources can not be serialized or added as an option. + * + * You can create options without values and then update the values later. + * Existing options will not be updated and checks are performed to ensure that you + * aren't adding a protected WordPress option. Care should be taken to not name + * options the same as the ones which are protected. + * + * @since MU (3.0.0) + * + * @param int $id A blog ID. Can be null to refer to the current blog. + * @param string $option Name of option to add. Expected to not be SQL-escaped. + * @param mixed $value Option value, can be anything. Expected to not be SQL-escaped. + * @return bool True if the option was added, false otherwise. + */ + function add_blog_option($id, $option, $value) + { + } + /** + * Removes an option by name for a given blog ID. Prevents removal of protected WordPress options. + * + * @since MU (3.0.0) + * + * @param int $id A blog ID. Can be null to refer to the current blog. + * @param string $option Name of option to remove. Expected to not be SQL-escaped. + * @return bool True if the option was deleted, false otherwise. + */ + function delete_blog_option($id, $option) + { + } + /** + * Updates an option for a particular blog. + * + * @since MU (3.0.0) + * + * @param int $id The blog ID. + * @param string $option The option key. + * @param mixed $value The option value. + * @param mixed $deprecated Not used. + * @return bool True if the value was updated, false otherwise. + */ + function update_blog_option($id, $option, $value, $deprecated = \null) + { + } + /** + * Switches the current blog. + * + * This function is useful if you need to pull posts, or other information, + * from other blogs. You can switch back afterwards using restore_current_blog(). + * + * PHP code loaded with the originally requested site, such as code from a plugin or theme, does not switch. See #14941. + * + * @see restore_current_blog() + * @since MU (3.0.0) + * + * @global wpdb $wpdb WordPress database abstraction object. + * @global int $blog_id + * @global array $_wp_switched_stack + * @global bool $switched + * @global string $table_prefix The database table prefix. + * @global WP_Object_Cache $wp_object_cache + * + * @param int $new_blog_id The ID of the blog to switch to. Default: current blog. + * @param bool $deprecated Not used. + * @return true Always returns true. + */ + function switch_to_blog($new_blog_id, $deprecated = \null) + { + } + /** + * Restores the current blog, after calling switch_to_blog(). + * + * @see switch_to_blog() + * @since MU (3.0.0) + * + * @global wpdb $wpdb WordPress database abstraction object. + * @global array $_wp_switched_stack + * @global int $blog_id + * @global bool $switched + * @global string $table_prefix The database table prefix. + * @global WP_Object_Cache $wp_object_cache + * + * @return bool True on success, false if we're already on the current blog. + */ + function restore_current_blog() + { + } + /** + * Switches the initialized roles and current user capabilities to another site. + * + * @since 4.9.0 + * + * @param int $new_site_id New site ID. + * @param int $old_site_id Old site ID. + * @phpstan-return void + */ + function wp_switch_roles_and_user($new_site_id, $old_site_id) + { + } + /** + * Determines if switch_to_blog() is in effect. + * + * @since 3.5.0 + * + * @global array $_wp_switched_stack + * + * @return bool True if switched, false otherwise. + */ + function ms_is_switched() + { + } + /** + * Checks if a particular blog is archived. + * + * @since MU (3.0.0) + * + * @param int $id Blog ID. + * @return string Whether the blog is archived or not. + */ + function is_archived($id) + { + } + /** + * Updates the 'archived' status of a particular blog. + * + * @since MU (3.0.0) + * + * @param int $id Blog ID. + * @param string $archived The new status. + * @return string $archived + */ + function update_archived($id, $archived) + { + } + /** + * Updates a blog details field. + * + * @since MU (3.0.0) + * @since 5.1.0 Use wp_update_site() internally. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $blog_id Blog ID. + * @param string $pref Field name. + * @param string $value Field value. + * @param null $deprecated Not used. + * @return string|false $value + */ + function update_blog_status($blog_id, $pref, $value, $deprecated = \null) + { + } + /** + * Gets a blog details field. + * + * @since MU (3.0.0) + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $id Blog ID. + * @param string $pref Field name. + * @return bool|string|null $value + */ + function get_blog_status($id, $pref) + { + } + /** + * Gets a list of most recently updated blogs. + * + * @since MU (3.0.0) + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param mixed $deprecated Not used. + * @param int $start Optional. Number of blogs to offset the query. Used to build LIMIT clause. + * Can be used for pagination. Default 0. + * @param int $quantity Optional. The maximum number of blogs to retrieve. Default 40. + * @return array The list of blogs. + */ + function get_last_updated($deprecated = '', $start = 0, $quantity = 40) + { + } + /** + * Handler for updating the site's last updated date when a post is published or + * an already published post is changed. + * + * @since 3.3.0 + * + * @param string $new_status The new post status. + * @param string $old_status The old post status. + * @param WP_Post $post Post object. + * @phpstan-return void + */ + function _update_blog_date_on_post_publish($new_status, $old_status, $post) + { + } + /** + * Handler for updating the current site's last updated date when a published + * post is deleted. + * + * @since 3.4.0 + * + * @param int $post_id Post ID + * @phpstan-return void + */ + function _update_blog_date_on_post_delete($post_id) + { + } + /** + * Handler for updating the current site's posts count when a post is deleted. + * + * @since 4.0.0 + * @since 6.2.0 Added the `$post` parameter. + * + * @param int $post_id Post ID. + * @param WP_Post $post Post object. + * @phpstan-return void + */ + function _update_posts_count_on_delete($post_id, $post) + { + } + /** + * Handler for updating the current site's posts count when a post status changes. + * + * @since 4.0.0 + * @since 4.9.0 Added the `$post` parameter. + * + * @param string $new_status The status the post is changing to. + * @param string $old_status The status the post is changing from. + * @param WP_Post $post Post object + * @phpstan-return void + */ + function _update_posts_count_on_transition_post_status($new_status, $old_status, $post = \null) + { + } + /** + * Counts number of sites grouped by site status. + * + * @since 5.3.0 + * + * @param int $network_id Optional. The network to get counts for. Default is the current network ID. + * @return int[] { + * Numbers of sites grouped by site status. + * + * @type int $all The total number of sites. + * @type int $public The number of public sites. + * @type int $archived The number of archived sites. + * @type int $mature The number of mature sites. + * @type int $spam The number of spam sites. + * @type int $deleted The number of deleted sites. + * } + * @phpstan-return array{ + * all: int, + * public: int, + * archived: int, + * mature: int, + * spam: int, + * deleted: int, + * } + */ + function wp_count_sites($network_id = \null) + { + } + /** + * Defines constants and global variables that can be overridden, generally in wp-config.php. + * + * @package WordPress + * @subpackage Multisite + * @since 3.0.0 + */ + /** + * Defines Multisite upload constants. + * + * Exists for backward compatibility with legacy file-serving through + * wp-includes/ms-files.php (wp-content/blogs.php in MU). + * + * @since 3.0.0 + * @phpstan-return void + */ + function ms_upload_constants() + { + } + /** + * Defines Multisite cookie constants. + * + * @since 3.0.0 + */ + function ms_cookie_constants() + { + } + /** + * Defines Multisite file constants. + * + * Exists for backward compatibility with legacy file-serving through + * wp-includes/ms-files.php (wp-content/blogs.php in MU). + * + * @since 3.0.0 + */ + function ms_file_constants() + { + } + /** + * Defines Multisite subdomain constants and handles warnings and notices. + * + * VHOST is deprecated in favor of SUBDOMAIN_INSTALL, which is a bool. + * + * On first call, the constants are checked and defined. On second call, + * we will have translations loaded and can trigger warnings easily. + * + * @since 3.0.0 + * @phpstan-return void + */ + function ms_subdomain_constants() + { + } + /** + * Deprecated functions from WordPress MU and the multisite feature. You shouldn't + * use these functions and look for the alternatives instead. The functions will be + * removed in a later version. + * + * @package WordPress + * @subpackage Deprecated + * @since 3.0.0 + */ + /* + * Deprecated functions come here to die. + */ + /** + * Get the "dashboard blog", the blog where users without a blog edit their profile data. + * Dashboard blog functionality was removed in WordPress 3.1, replaced by the user admin. + * + * @since MU (3.0.0) + * @deprecated 3.1.0 Use get_site() + * @see get_site() + * + * @return WP_Site Current site object. + */ + function get_dashboard_blog() + { + } + /** + * Generates a random password. + * + * @since MU (3.0.0) + * @deprecated 3.0.0 Use wp_generate_password() + * @see wp_generate_password() + * + * @param int $len Optional. The length of password to generate. Default 8. + */ + function generate_random_password($len = 8) + { + } + /** + * Determine if user is a site admin. + * + * Plugins should use is_multisite() instead of checking if this function exists + * to determine if multisite is enabled. + * + * This function must reside in a file included only if is_multisite() due to + * legacy function_exists() checks to determine if multisite is enabled. + * + * @since MU (3.0.0) + * @deprecated 3.0.0 Use is_super_admin() + * @see is_super_admin() + * + * @param string $user_login Optional. Username for the user to check. Default empty. + */ + function is_site_admin($user_login = '') + { + } + /** + * Deprecated functionality to gracefully fail. + * + * @since MU (3.0.0) + * @deprecated 3.0.0 Use wp_die() + * @see wp_die() + * @phpstan-return never + */ + function graceful_fail($message) + { + } + /** + * Deprecated functionality to retrieve user information. + * + * @since MU (3.0.0) + * @deprecated 3.0.0 Use get_user_by() + * @see get_user_by() + * + * @param string $username Username. + */ + function get_user_details($username) + { + } + /** + * Deprecated functionality to clear the global post cache. + * + * @since MU (3.0.0) + * @deprecated 3.0.0 Use clean_post_cache() + * @see clean_post_cache() + * + * @param int $post_id Post ID. + */ + function clear_global_post_cache($post_id) + { + } + /** + * Deprecated functionality to determine if the current site is the main site. + * + * @since MU (3.0.0) + * @deprecated 3.0.0 Use is_main_site() + * @see is_main_site() + */ + function is_main_blog() + { + } + /** + * Deprecated functionality to validate an email address. + * + * @since MU (3.0.0) + * @deprecated 3.0.0 Use is_email() + * @see is_email() + * + * @param string $email Email address to verify. + * @param bool $check_domain Deprecated. + * @return string|false Valid email address on success, false on failure. + */ + function validate_email($email, $check_domain = \true) + { + } + /** + * Deprecated functionality to retrieve a list of all sites. + * + * @since MU (3.0.0) + * @deprecated 3.0.0 Use wp_get_sites() + * @see wp_get_sites() + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $start Optional. Offset for retrieving the blog list. Default 0. + * @param int $num Optional. Number of blogs to list. Default 10. + * @param string $deprecated Unused. + */ + function get_blog_list($start = 0, $num = 10, $deprecated = '') + { + } + /** + * Deprecated functionality to retrieve a list of the most active sites. + * + * @since MU (3.0.0) + * @deprecated 3.0.0 + * + * @param int $num Optional. Number of activate blogs to retrieve. Default 10. + * @param bool $display Optional. Whether or not to display the most active blogs list. Default true. + * @return array List of "most active" sites. + */ + function get_most_active_blogs($num = 10, $display = \true) + { + } + /** + * Redirect a user based on $_GET or $_POST arguments. + * + * The function looks for redirect arguments in the following order: + * 1) $_GET['ref'] + * 2) $_POST['ref'] + * 3) $_SERVER['HTTP_REFERER'] + * 4) $_GET['redirect'] + * 5) $_POST['redirect'] + * 6) $url + * + * @since MU (3.0.0) + * @deprecated 3.3.0 Use wp_redirect() + * @see wp_redirect() + * + * @param string $url Optional. Redirect URL. Default empty. + * @phpstan-return never + */ + function wpmu_admin_do_redirect($url = '') + { + } + /** + * Adds an 'updated=true' argument to a URL. + * + * @since MU (3.0.0) + * @deprecated 3.3.0 Use add_query_arg() + * @see add_query_arg() + * + * @param string $url Optional. Redirect URL. Default empty. + * @return string + */ + function wpmu_admin_redirect_add_updated_param($url = '') + { + } + /** + * Get a numeric user ID from either an email address or a login. + * + * A numeric string is considered to be an existing user ID + * and is simply returned as such. + * + * @since MU (3.0.0) + * @deprecated 3.6.0 Use get_user_by() + * @see get_user_by() + * + * @param string $email_or_login Either an email address or a login. + * @return int + */ + function get_user_id_from_string($email_or_login) + { + } + /** + * Get a full site URL, given a domain and a path. + * + * @since MU (3.0.0) + * @deprecated 3.7.0 + * + * @param string $domain + * @param string $path + * @return string + */ + function get_blogaddress_by_domain($domain, $path) + { + } + /** + * Create an empty blog. + * + * @since MU (3.0.0) + * @deprecated 4.4.0 + * + * @param string $domain The new blog's domain. + * @param string $path The new blog's path. + * @param string $weblog_title The new blog's title. + * @param int $site_id Optional. Defaults to 1. + * @return string|int The ID of the newly created blog + */ + function create_empty_blog($domain, $path, $weblog_title, $site_id = 1) + { + } + /** + * Get the admin for a domain/path combination. + * + * @since MU (3.0.0) + * @deprecated 4.4.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $domain Optional. Network domain. + * @param string $path Optional. Network path. + * @return array|false The network admins. + */ + function get_admin_users_for_domain($domain = '', $path = '') + { + } + /** + * Return an array of sites for a network or networks. + * + * @since 3.7.0 + * @deprecated 4.6.0 Use get_sites() + * @see get_sites() + * + * @param array $args { + * Array of default arguments. Optional. + * + * @type int|int[] $network_id A network ID or array of network IDs. Set to null to retrieve sites + * from all networks. Defaults to current network ID. + * @type int $public Retrieve public or non-public sites. Default null, for any. + * @type int $archived Retrieve archived or non-archived sites. Default null, for any. + * @type int $mature Retrieve mature or non-mature sites. Default null, for any. + * @type int $spam Retrieve spam or non-spam sites. Default null, for any. + * @type int $deleted Retrieve deleted or non-deleted sites. Default null, for any. + * @type int $limit Number of sites to limit the query to. Default 100. + * @type int $offset Exclude the first x sites. Used in combination with the $limit parameter. Default 0. + * } + * @return array[] An empty array if the installation is considered "large" via wp_is_large_network(). Otherwise, + * an associative array of WP_Site data as arrays. + * @phpstan-param array{ + * network_id?: int|int[], + * public?: int, + * archived?: int, + * mature?: int, + * spam?: int, + * deleted?: int, + * limit?: int, + * offset?: int, + * } $args + */ + function wp_get_sites($args = array()) + { + } + /** + * Check whether a usermeta key has to do with the current blog. + * + * @since MU (3.0.0) + * @deprecated 4.9.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $key + * @param int $user_id Optional. Defaults to current user. + * @param int $blog_id Optional. Defaults to current blog. + * @return bool + */ + function is_user_option_local($key, $user_id = 0, $blog_id = 0) + { + } + /** + * Store basic site info in the blogs table. + * + * This function creates a row in the wp_blogs table and returns + * the new blog's ID. It is the first step in creating a new blog. + * + * @since MU (3.0.0) + * @deprecated 5.1.0 Use wp_insert_site() + * @see wp_insert_site() + * + * @param string $domain The domain of the new site. + * @param string $path The path of the new site. + * @param int $site_id Unless you're running a multi-network install, be sure to set this value to 1. + * @return int|false The ID of the new row + */ + function insert_blog($domain, $path, $site_id) + { + } + /** + * Install an empty blog. + * + * Creates the new blog tables and options. If calling this function + * directly, be sure to use switch_to_blog() first, so that $wpdb + * points to the new blog. + * + * @since MU (3.0.0) + * @deprecated 5.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * @global WP_Roles $wp_roles WordPress role management object. + * + * @param int $blog_id The value returned by wp_insert_site(). + * @param string $blog_title The title of the new site. + */ + function install_blog($blog_id, $blog_title = '') + { + } + /** + * Set blog defaults. + * + * This function creates a row in the wp_blogs table. + * + * @since MU (3.0.0) + * @deprecated MU + * @deprecated Use wp_install_defaults() + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $blog_id Ignored in this function. + * @param int $user_id + */ + function install_blog_defaults($blog_id, $user_id) + { + } + /** + * Update the status of a user in the database. + * + * Previously used in core to mark a user as spam or "ham" (not spam) in Multisite. + * + * @since 3.0.0 + * @deprecated 5.3.0 Use wp_update_user() + * @see wp_update_user() + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $id The user ID. + * @param string $pref The column in the wp_users table to update the user's status + * in (presumably user_status, spam, or deleted). + * @param int $value The new status for the user. + * @param null $deprecated Deprecated as of 3.0.2 and should not be used. + * @return int The initially passed $value. + */ + function update_user_status($id, $pref, $value, $deprecated = \null) + { + } + /** + * Maintains a canonical list of terms by syncing terms created for each blog with the global terms table. + * + * @since 3.0.0 + * @since 6.1.0 This function no longer does anything. + * @deprecated 6.1.0 + * + * @param int $term_id An ID for a term on the current blog. + * @param string $deprecated Not used. + * @return int An ID from the global terms table mapped from $term_id. + */ + function global_terms($term_id, $deprecated = '') + { + } + /** + * Multisite WordPress API + * + * @package WordPress + * @subpackage Multisite + * @since 3.0.0 + */ + /** + * Gets the network's site and user counts. + * + * @since MU (3.0.0) + * + * @return int[] { + * Site and user count for the network. + * + * @type int $blogs Number of sites on the network. + * @type int $users Number of users on the network. + * } + * @phpstan-return array{ + * blogs: int, + * users: int, + * } + */ + function get_sitestats() + { + } + /** + * Gets one of a user's active blogs. + * + * Returns the user's primary blog, if they have one and + * it is active. If it's inactive, function returns another + * active blog of the user. If none are found, the user + * is added as a Subscriber to the Dashboard Blog and that blog + * is returned. + * + * @since MU (3.0.0) + * + * @param int $user_id The unique ID of the user + * @return WP_Site|void The blog object + */ + function get_active_blog_for_user($user_id) + { + } + /** + * Gets the number of active sites on the installation. + * + * The count is cached and updated twice daily. This is not a live count. + * + * @since MU (3.0.0) + * @since 3.7.0 The `$network_id` parameter has been deprecated. + * @since 4.8.0 The `$network_id` parameter is now being used. + * + * @param int|null $network_id ID of the network. Default is the current network. + * @return int Number of active sites on the network. + */ + function get_blog_count($network_id = \null) + { + } + /** + * Gets a blog post from any site on the network. + * + * This function is similar to get_post(), except that it can retrieve a post + * from any site on the network, not just the current site. + * + * @since MU (3.0.0) + * + * @param int $blog_id ID of the blog. + * @param int $post_id ID of the post being looked for. + * @return WP_Post|null WP_Post object on success, null on failure + */ + function get_blog_post($blog_id, $post_id) + { + } + /** + * Adds a user to a blog, along with specifying the user's role. + * + * Use the {@see 'add_user_to_blog'} action to fire an event when users are added to a blog. + * + * @since MU (3.0.0) + * + * @param int $blog_id ID of the blog the user is being added to. + * @param int $user_id ID of the user being added. + * @param string $role User role. + * @return true|WP_Error True on success or a WP_Error object if the user doesn't exist + * or could not be added. + */ + function add_user_to_blog($blog_id, $user_id, $role) + { + } + /** + * Removes a user from a blog. + * + * Use the {@see 'remove_user_from_blog'} action to fire an event when + * users are removed from a blog. + * + * Accepts an optional `$reassign` parameter, if you want to + * reassign the user's blog posts to another user upon removal. + * + * @since MU (3.0.0) + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $user_id ID of the user being removed. + * @param int $blog_id Optional. ID of the blog the user is being removed from. Default 0. + * @param int $reassign Optional. ID of the user to whom to reassign posts. Default 0. + * @return true|WP_Error True on success or a WP_Error object if the user doesn't exist. + */ + function remove_user_from_blog($user_id, $blog_id = 0, $reassign = 0) + { + } + /** + * Gets the permalink for a post on another blog. + * + * @since MU (3.0.0) 1.0 + * + * @param int $blog_id ID of the source blog. + * @param int $post_id ID of the desired post. + * @return string The post's permalink. + */ + function get_blog_permalink($blog_id, $post_id) + { + } + /** + * Gets a blog's numeric ID from its URL. + * + * On a subdirectory installation like example.com/blog1/, + * $domain will be the root 'example.com' and $path the + * subdirectory '/blog1/'. With subdomains like blog1.example.com, + * $domain is 'blog1.example.com' and $path is '/'. + * + * @since MU (3.0.0) + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $domain Website domain. + * @param string $path Optional. Not required for subdomain installations. Default '/'. + * @return int 0 if no blog found, otherwise the ID of the matching blog. + */ + function get_blog_id_from_url($domain, $path = '/') + { + } + // + // Admin functions. + // + /** + * Checks an email address against a list of banned domains. + * + * This function checks against the Banned Email Domains list + * at wp-admin/network/settings.php. The check is only run on + * self-registrations; user creation at wp-admin/network/users.php + * bypasses this check. + * + * @since MU (3.0.0) + * + * @param string $user_email The email provided by the user at registration. + * @return bool True when the email address is banned, false otherwise. + */ + function is_email_address_unsafe($user_email) + { + } + /** + * Sanitizes and validates data required for a user sign-up. + * + * Verifies the validity and uniqueness of user names and user email addresses, + * and checks email addresses against allowed and disallowed domains provided by + * administrators. + * + * The {@see 'wpmu_validate_user_signup'} hook provides an easy way to modify the sign-up + * process. The value $result, which is passed to the hook, contains both the user-provided + * info and the error messages created by the function. {@see 'wpmu_validate_user_signup'} + * allows you to process the data in any way you'd like, and unset the relevant errors if + * necessary. + * + * @since MU (3.0.0) + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $user_name The login name provided by the user. + * @param string $user_email The email provided by the user. + * @return array { + * The array of user name, email, and the error messages. + * + * @type string $user_name Sanitized and unique username. + * @type string $orig_username Original username. + * @type string $user_email User email address. + * @type WP_Error $errors WP_Error object containing any errors found. + * } + * @phpstan-return array{ + * user_name: string, + * orig_username: string, + * user_email: string, + * errors: WP_Error, + * } + */ + function wpmu_validate_user_signup($user_name, $user_email) + { + } + /** + * Processes new site registrations. + * + * Checks the data provided by the user during blog signup. Verifies + * the validity and uniqueness of blog paths and domains. + * + * This function prevents the current user from registering a new site + * with a blogname equivalent to another user's login name. Passing the + * $user parameter to the function, where $user is the other user, is + * effectively an override of this limitation. + * + * Filter {@see 'wpmu_validate_blog_signup'} if you want to modify + * the way that WordPress validates new site signups. + * + * @since MU (3.0.0) + * + * @global wpdb $wpdb WordPress database abstraction object. + * @global string $domain + * + * @param string $blogname The site name provided by the user. Must be unique. + * @param string $blog_title The site title provided by the user. + * @param WP_User|string $user Optional. The user object to check against the new site name. + * Default empty string. + * @return array { + * Array of domain, path, site name, site title, user and error messages. + * + * @type string $domain Domain for the site. + * @type string $path Path for the site. Used in subdirectory installations. + * @type string $blogname The unique site name (slug). + * @type string $blog_title Blog title. + * @type string|WP_User $user By default, an empty string. A user object if provided. + * @type WP_Error $errors WP_Error containing any errors found. + * } + * @phpstan-return array{ + * domain: string, + * path: string, + * blogname: string, + * blog_title: string, + * user: string|WP_User, + * errors: WP_Error, + * } + */ + function wpmu_validate_blog_signup($blogname, $blog_title, $user = '') + { + } + /** + * Records site signup information for future activation. + * + * @since MU (3.0.0) + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $domain The requested domain. + * @param string $path The requested path. + * @param string $title The requested site title. + * @param string $user The user's requested login name. + * @param string $user_email The user's email address. + * @param array $meta Optional. Signup meta data. By default, contains the requested privacy setting and lang_id. + */ + function wpmu_signup_blog($domain, $path, $title, $user, $user_email, $meta = array()) + { + } + /** + * Records user signup information for future activation. + * + * This function is used when user registration is open but + * new site registration is not. + * + * @since MU (3.0.0) + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $user The user's requested login name. + * @param string $user_email The user's email address. + * @param array $meta Optional. Signup meta data. Default empty array. + */ + function wpmu_signup_user($user, $user_email, $meta = array()) + { + } + /** + * Sends a confirmation request email to a user when they sign up for a new site. The new site will not become active + * until the confirmation link is clicked. + * + * This is the notification function used when site registration + * is enabled. + * + * Filter {@see 'wpmu_signup_blog_notification'} to bypass this function or + * replace it with your own notification behavior. + * + * Filter {@see 'wpmu_signup_blog_notification_email'} and + * {@see 'wpmu_signup_blog_notification_subject'} to change the content + * and subject line of the email sent to newly registered users. + * + * @since MU (3.0.0) + * + * @param string $domain The new blog domain. + * @param string $path The new blog path. + * @param string $title The site title. + * @param string $user_login The user's login name. + * @param string $user_email The user's email address. + * @param string $key The activation key created in wpmu_signup_blog(). + * @param array $meta Optional. Signup meta data. By default, contains the requested privacy setting and lang_id. + * @return bool + */ + function wpmu_signup_blog_notification($domain, $path, $title, $user_login, $user_email, $key, $meta = array()) + { + } + /** + * Sends a confirmation request email to a user when they sign up for a new user account (without signing up for a site + * at the same time). The user account will not become active until the confirmation link is clicked. + * + * This is the notification function used when no new site has + * been requested. + * + * Filter {@see 'wpmu_signup_user_notification'} to bypass this function or + * replace it with your own notification behavior. + * + * Filter {@see 'wpmu_signup_user_notification_email'} and + * {@see 'wpmu_signup_user_notification_subject'} to change the content + * and subject line of the email sent to newly registered users. + * + * @since MU (3.0.0) + * + * @param string $user_login The user's login name. + * @param string $user_email The user's email address. + * @param string $key The activation key created in wpmu_signup_user() + * @param array $meta Optional. Signup meta data. Default empty array. + * @return bool + */ + function wpmu_signup_user_notification($user_login, $user_email, $key, $meta = array()) + { + } + /** + * Activates a signup. + * + * Hook to {@see 'wpmu_activate_user'} or {@see 'wpmu_activate_blog'} for events + * that should happen only when users or sites are self-created (since + * those actions are not called when users and sites are created + * by a Super Admin). + * + * @since MU (3.0.0) + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $key The activation key provided to the user. + * @return array|WP_Error An array containing information about the activated user and/or blog. + */ + function wpmu_activate_signup($key) + { + } + /** + * Deletes an associated signup entry when a user is deleted from the database. + * + * @since 5.5.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $id ID of the user to delete. + * @param int|null $reassign ID of the user to reassign posts and links to. + * @param WP_User $user User object. + */ + function wp_delete_signup_on_user_delete($id, $reassign, $user) + { + } + /** + * Creates a user. + * + * This function runs when a user self-registers as well as when + * a Super Admin creates a new user. Hook to {@see 'wpmu_new_user'} for events + * that should affect all new users, but only on Multisite (otherwise + * use {@see 'user_register'}). + * + * @since MU (3.0.0) + * + * @param string $user_name The new user's login name. + * @param string $password The new user's password. + * @param string $email The new user's email address. + * @return int|false Returns false on failure, or int $user_id on success. + */ + function wpmu_create_user($user_name, $password, $email) + { + } + /** + * Creates a site. + * + * This function runs when a user self-registers a new site as well + * as when a Super Admin creates a new site. Hook to {@see 'wpmu_new_blog'} + * for events that should affect all new sites. + * + * On subdirectory installations, $domain is the same as the main site's + * domain, and the path is the subdirectory name (eg 'example.com' + * and '/blog1/'). On subdomain installations, $domain is the new subdomain + + * root domain (eg 'blog1.example.com'), and $path is '/'. + * + * @since MU (3.0.0) + * + * @param string $domain The new site's domain. + * @param string $path The new site's path. + * @param string $title The new site's title. + * @param int $user_id The user ID of the new site's admin. + * @param array $options Optional. Array of key=>value pairs used to set initial site options. + * If valid status keys are included ('public', 'archived', 'mature', + * 'spam', 'deleted', or 'lang_id') the given site status(es) will be + * updated. Otherwise, keys and values will be used to set options for + * the new site. Default empty array. + * @param int $network_id Optional. Network ID. Only relevant on multi-network installations. + * Default 1. + * @return int|WP_Error Returns WP_Error object on failure, the new site ID on success. + */ + function wpmu_create_blog($domain, $path, $title, $user_id, $options = array(), $network_id = 1) + { + } + /** + * Notifies the network admin that a new site has been activated. + * + * Filter {@see 'newblog_notify_siteadmin'} to change the content of + * the notification email. + * + * @since MU (3.0.0) + * @since 5.1.0 $blog_id now supports input from the {@see 'wp_initialize_site'} action. + * + * @param WP_Site|int $blog_id The new site's object or ID. + * @param string $deprecated Not used. + * @return bool + */ + function newblog_notify_siteadmin($blog_id, $deprecated = '') + { + } + /** + * Notifies the network admin that a new user has been activated. + * + * Filter {@see 'newuser_notify_siteadmin'} to change the content of + * the notification email. + * + * @since MU (3.0.0) + * + * @param int $user_id The new user's ID. + * @return bool + */ + function newuser_notify_siteadmin($user_id) + { + } + /** + * Checks whether a site name is already taken. + * + * The name is the site's subdomain or the site's subdirectory + * path depending on the network settings. + * + * Used during the new site registration process to ensure + * that each site name is unique. + * + * @since MU (3.0.0) + * + * @param string $domain The domain to be checked. + * @param string $path The path to be checked. + * @param int $network_id Optional. Network ID. Only relevant on multi-network installations. + * Default 1. + * @return int|null The site ID if the site name exists, null otherwise. + */ + function domain_exists($domain, $path, $network_id = 1) + { + } + /** + * Notifies the site administrator that their site activation was successful. + * + * Filter {@see 'wpmu_welcome_notification'} to disable or bypass. + * + * Filter {@see 'update_welcome_email'} and {@see 'update_welcome_subject'} to + * modify the content and subject line of the notification email. + * + * @since MU (3.0.0) + * + * @param int $blog_id Site ID. + * @param int $user_id User ID. + * @param string $password User password, or "N/A" if the user account is not new. + * @param string $title Site title. + * @param array $meta Optional. Signup meta data. By default, contains the requested privacy setting and lang_id. + * @return bool Whether the email notification was sent. + */ + function wpmu_welcome_notification($blog_id, $user_id, $password, $title, $meta = array()) + { + } + /** + * Notifies the Multisite network administrator that a new site was created. + * + * Filter {@see 'send_new_site_email'} to disable or bypass. + * + * Filter {@see 'new_site_email'} to filter the contents. + * + * @since 5.6.0 + * + * @param int $site_id Site ID of the new site. + * @param int $user_id User ID of the administrator of the new site. + * @return bool Whether the email notification was sent. + */ + function wpmu_new_site_admin_notification($site_id, $user_id) + { + } + /** + * Notifies a user that their account activation has been successful. + * + * Filter {@see 'wpmu_welcome_user_notification'} to disable or bypass. + * + * Filter {@see 'update_welcome_user_email'} and {@see 'update_welcome_user_subject'} to + * modify the content and subject line of the notification email. + * + * @since MU (3.0.0) + * + * @param int $user_id User ID. + * @param string $password User password. + * @param array $meta Optional. Signup meta data. Default empty array. + * @return bool + */ + function wpmu_welcome_user_notification($user_id, $password, $meta = array()) + { + } + /** + * Gets the current network. + * + * Returns an object containing the 'id', 'domain', 'path', and 'site_name' + * properties of the network being viewed. + * + * @see wpmu_current_site() + * + * @since MU (3.0.0) + * + * @global WP_Network $current_site The current network. + * + * @return WP_Network The current network. + */ + function get_current_site() + { + } + /** + * Gets a user's most recent post. + * + * Walks through each of a user's blogs to find the post with + * the most recent post_date_gmt. + * + * @since MU (3.0.0) + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $user_id User ID. + * @return array Contains the blog_id, post_id, post_date_gmt, and post_gmt_ts. + */ + function get_most_recent_post_of_user($user_id) + { + } + // + // Misc functions. + // + /** + * Checks an array of MIME types against a list of allowed types. + * + * WordPress ships with a set of allowed upload filetypes, + * which is defined in wp-includes/functions.php in + * get_allowed_mime_types(). This function is used to filter + * that list against the filetypes allowed provided by Multisite + * Super Admins at wp-admin/network/settings.php. + * + * @since MU (3.0.0) + * + * @param array $mimes + * @return array + */ + function check_upload_mimes($mimes) + { + } + /** + * Updates a blog's post count. + * + * WordPress MS stores a blog's post count as an option so as + * to avoid extraneous COUNTs when a blog's details are fetched + * with get_site(). This function is called when posts are published + * or unpublished to make sure the count stays current. + * + * @since MU (3.0.0) + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $deprecated Not used. + */ + function update_posts_count($deprecated = '') + { + } + /** + * Logs the user email, IP, and registration date of a new site. + * + * @since MU (3.0.0) + * @since 5.1.0 Parameters now support input from the {@see 'wp_initialize_site'} action. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param WP_Site|int $blog_id The new site's object or ID. + * @param int|array $user_id User ID, or array of arguments including 'user_id'. + */ + function wpmu_log_new_registrations($blog_id, $user_id) + { + } + /** + * Ensures that the current site's domain is listed in the allowed redirect host list. + * + * @see wp_validate_redirect() + * @since MU (3.0.0) + * + * @param array|string $deprecated Not used. + * @return string[] { + * An array containing the current site's domain. + * + * @type string $0 The current site's domain. + * } + * @phpstan-return array{ + * 0: string, + * } + */ + function redirect_this_site($deprecated = '') + { + } + /** + * Checks whether an upload is too big. + * + * @since MU (3.0.0) + * + * @param array $upload An array of information about the newly-uploaded file. + * @return string|array If the upload is under the size limit, $upload is returned. Otherwise returns an error message. + */ + function upload_is_file_too_big($upload) + { + } + /** + * Adds a nonce field to the signup page. + * + * @since MU (3.0.0) + */ + function signup_nonce_fields() + { + } + /** + * Processes the signup nonce created in signup_nonce_fields(). + * + * @since MU (3.0.0) + * + * @param array $result + * @return array + */ + function signup_nonce_check($result) + { + } + /** + * Corrects 404 redirects when NOBLOGREDIRECT is defined. + * + * @since MU (3.0.0) + */ + function maybe_redirect_404() + { + } + /** + * Adds a new user to a blog by visiting /newbloguser/{key}/. + * + * This will only work when the user's details are saved as an option + * keyed as 'new_user_{key}', where '{key}' is a hash generated for the user to be + * added, as when a user is invited through the regular WP Add User interface. + * + * @since MU (3.0.0) + * @phpstan-return void + */ + function maybe_add_existing_user_to_blog() + { + } + /** + * Adds a user to a blog based on details from maybe_add_existing_user_to_blog(). + * + * @since MU (3.0.0) + * + * @param array|false $details { + * User details. Must at least contain values for the keys listed below. + * + * @type int $user_id The ID of the user being added to the current blog. + * @type string $role The role to be assigned to the user. + * } + * @return true|WP_Error|void True on success or a WP_Error object if the user doesn't exist + * or could not be added. Void if $details array was not provided. + * @phpstan-param false|array{ + * user_id?: int, + * role?: string, + * } $details + */ + function add_existing_user_to_blog($details = \false) + { + } + /** + * Adds a newly created user to the appropriate blog + * + * To add a user in general, use add_user_to_blog(). This function + * is specifically hooked into the {@see 'wpmu_activate_user'} action. + * + * @since MU (3.0.0) + * + * @see add_user_to_blog() + * + * @param int $user_id User ID. + * @param string $password User password. Ignored. + * @param array $meta Signup meta data. + */ + function add_new_user_to_blog($user_id, $password, $meta) + { + } + /** + * Corrects From host on outgoing mail to match the site domain. + * + * @since MU (3.0.0) + * + * @param PHPMailer $phpmailer The PHPMailer instance (passed by reference). + */ + function fix_phpmailer_messageid($phpmailer) + { + } + /** + * Determines whether a user is marked as a spammer, based on user login. + * + * @since MU (3.0.0) + * + * @param string|WP_User $user Optional. Defaults to current user. WP_User object, + * or user login name as a string. + * @return bool + */ + function is_user_spammy($user = \null) + { + } + /** + * Updates this blog's 'public' setting in the global blogs table. + * + * Public blogs have a setting of 1, private blogs are 0. + * + * @since MU (3.0.0) + * + * @param int $old_value The old public value. + * @param int $value The new public value. + */ + function update_blog_public($old_value, $value) + { + } + /** + * Determines whether users can self-register, based on Network settings. + * + * @since MU (3.0.0) + * + * @return bool + */ + function users_can_register_signup_filter() + { + } + /** + * Ensures that the welcome message is not empty. Currently unused. + * + * @since MU (3.0.0) + * + * @param string $text + * @return string + */ + function welcome_user_msg_filter($text) + { + } + /** + * Determines whether to force SSL on content. + * + * @since 2.8.5 + * + * @param bool $force + * @return bool True if forced, false if not forced. + */ + function force_ssl_content($force = '') + { + } + /** + * Formats a URL to use https. + * + * Useful as a filter. + * + * @since 2.8.5 + * + * @param string $url URL. + * @return string URL with https as the scheme. + */ + function filter_SSL($url) + { + } + /** + * Schedules update of the network-wide counts for the current network. + * + * @since 3.1.0 + * @phpstan-return void + */ + function wp_schedule_update_network_counts() + { + } + /** + * Updates the network-wide counts for the current network. + * + * @since 3.1.0 + * @since 4.8.0 The `$network_id` parameter has been added. + * + * @param int|null $network_id ID of the network. Default is the current network. + */ + function wp_update_network_counts($network_id = \null) + { + } + /** + * Updates the count of sites for the current network. + * + * If enabled through the {@see 'enable_live_network_counts'} filter, update the sites count + * on a network when a site is created or its status is updated. + * + * @since 3.7.0 + * @since 4.8.0 The `$network_id` parameter has been added. + * + * @param int|null $network_id ID of the network. Default is the current network. + * @phpstan-return void + */ + function wp_maybe_update_network_site_counts($network_id = \null) + { + } + /** + * Updates the network-wide users count. + * + * If enabled through the {@see 'enable_live_network_counts'} filter, update the users count + * on a network when a user is created or its status is updated. + * + * @since 3.7.0 + * @since 4.8.0 The `$network_id` parameter has been added. + * + * @param int|null $network_id ID of the network. Default is the current network. + * @phpstan-return void + */ + function wp_maybe_update_network_user_counts($network_id = \null) + { + } + /** + * Updates the network-wide site count. + * + * @since 3.7.0 + * @since 4.8.0 The `$network_id` parameter has been added. + * + * @param int|null $network_id ID of the network. Default is the current network. + */ + function wp_update_network_site_counts($network_id = \null) + { + } + /** + * Updates the network-wide user count. + * + * @since 3.7.0 + * @since 4.8.0 The `$network_id` parameter has been added. + * @since 6.0.0 This function is now a wrapper for wp_update_user_counts(). + * + * @param int|null $network_id ID of the network. Default is the current network. + */ + function wp_update_network_user_counts($network_id = \null) + { + } + /** + * Returns the space used by the current site. + * + * @since 3.5.0 + * + * @return int Used space in megabytes. + */ + function get_space_used() + { + } + /** + * Returns the upload quota for the current blog. + * + * @since MU (3.0.0) + * + * @return int Quota in megabytes. + */ + function get_space_allowed() + { + } + /** + * Determines if there is any upload space left in the current blog's quota. + * + * @since 3.0.0 + * + * @return int of upload space available in bytes. + */ + function get_upload_space_available() + { + } + /** + * Determines if there is any upload space left in the current blog's quota. + * + * @since 3.0.0 + * @return bool True if space is available, false otherwise. + */ + function is_upload_space_available() + { + } + /** + * Filters the maximum upload file size allowed, in bytes. + * + * @since 3.0.0 + * + * @param int $size Upload size limit in bytes. + * @return int Upload size limit in bytes. + */ + function upload_size_limit_filter($size) + { + } + /** + * Determines whether or not we have a large network. + * + * The default criteria for a large network is either more than 10,000 users or more than 10,000 sites. + * Plugins can alter this criteria using the {@see 'wp_is_large_network'} filter. + * + * @since 3.3.0 + * @since 4.8.0 The `$network_id` parameter has been added. + * + * @param string $using 'sites' or 'users'. Default is 'sites'. + * @param int|null $network_id ID of the network. Default is the current network. + * @return bool True if the network meets the criteria for large. False otherwise. + */ + function wp_is_large_network($using = 'sites', $network_id = \null) + { + } + /** + * Retrieves a list of reserved site on a sub-directory Multisite installation. + * + * @since 4.4.0 + * + * @return string[] Array of reserved names. + */ + function get_subdirectory_reserved_names() + { + } + /** + * Sends a confirmation request email when a change of network admin email address is attempted. + * + * The new network admin address will not become active until confirmed. + * + * @since 4.9.0 + * + * @param string $old_value The old network admin email address. + * @param string $value The proposed new network admin email address. + * @phpstan-return void + */ + function update_network_option_new_admin_email($old_value, $value) + { + } + /** + * Sends an email to the old network admin email address when the network admin email address changes. + * + * @since 4.9.0 + * + * @param string $option_name The relevant database option name. + * @param string $new_email The new network admin email address. + * @param string $old_email The old network admin email address. + * @param int $network_id ID of the network. + * @phpstan-return void + */ + function wp_network_admin_email_change_notification($option_name, $new_email, $old_email, $network_id) + { + } + /** + * These functions are needed to load Multisite. + * + * @since 3.0.0 + * + * @package WordPress + * @subpackage Multisite + */ + /** + * Whether a subdomain configuration is enabled. + * + * @since 3.0.0 + * + * @return bool True if subdomain configuration is enabled, false otherwise. + */ + function is_subdomain_install() + { + } + /** + * Returns array of network plugin files to be included in global scope. + * + * The default directory is wp-content/plugins. To change the default directory + * manually, define `WP_PLUGIN_DIR` and `WP_PLUGIN_URL` in `wp-config.php`. + * + * @access private + * @since 3.1.0 + * + * @return string[] Array of absolute paths to files to include. + */ + function wp_get_active_network_plugins() + { + } + /** + * Checks status of current blog. + * + * Checks if the blog is deleted, inactive, archived, or spammed. + * + * Dies with a default message if the blog does not pass the check. + * + * To change the default message when a blog does not pass the check, + * use the wp-content/blog-deleted.php, blog-inactive.php and + * blog-suspended.php drop-ins. + * + * @since 3.0.0 + * + * @return true|string Returns true on success, or drop-in file to include. + */ + function ms_site_check() + { + } + /** + * Retrieves the closest matching network for a domain and path. + * + * @since 3.9.0 + * + * @internal In 4.4.0, converted to a wrapper for WP_Network::get_by_path() + * + * @param string $domain Domain to check. + * @param string $path Path to check. + * @param int|null $segments Path segments to use. Defaults to null, or the full path. + * @return WP_Network|false Network object if successful. False when no network is found. + */ + function get_network_by_path($domain, $path, $segments = \null) + { + } + /** + * Retrieves the closest matching site object by its domain and path. + * + * This will not necessarily return an exact match for a domain and path. Instead, it + * breaks the domain and path into pieces that are then used to match the closest + * possibility from a query. + * + * The intent of this method is to match a site object during bootstrap for a + * requested site address + * + * @since 3.9.0 + * @since 4.7.0 Updated to always return a `WP_Site` object. + * + * @param string $domain Domain to check. + * @param string $path Path to check. + * @param int|null $segments Path segments to use. Defaults to null, or the full path. + * @return WP_Site|false Site object if successful. False when no site is found. + */ + function get_site_by_path($domain, $path, $segments = \null) + { + } + /** + * Identifies the network and site of a requested domain and path and populates the + * corresponding network and site global objects as part of the multisite bootstrap process. + * + * Prior to 4.6.0, this was a procedural block in `ms-settings.php`. It was wrapped into + * a function to facilitate unit tests. It should not be used outside of core. + * + * Usually, it's easier to query the site first, which then declares its network. + * In limited situations, we either can or must find the network first. + * + * If a network and site are found, a `true` response will be returned so that the + * request can continue. + * + * If neither a network or site is found, `false` or a URL string will be returned + * so that either an error can be shown or a redirect can occur. + * + * @since 4.6.0 + * @access private + * + * @global WP_Network $current_site The current network. + * @global WP_Site $current_blog The current site. + * + * @param string $domain The requested domain. + * @param string $path The requested path. + * @param bool $subdomain Optional. Whether a subdomain (true) or subdirectory (false) configuration. + * Default false. + * @return bool|string True if bootstrap successfully populated `$current_blog` and `$current_site`. + * False if bootstrap could not be properly completed. + * Redirect URL if parts exist, but the request as a whole can not be fulfilled. + */ + function ms_load_current_site_and_network($domain, $path, $subdomain = \false) + { + } + /** + * Displays a failure message. + * + * Used when a blog's tables do not exist. Checks for a missing $wpdb->site table as well. + * + * @access private + * @since 3.0.0 + * @since 4.4.0 The `$domain` and `$path` parameters were added. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $domain The requested domain for the error to reference. + * @param string $path The requested path for the error to reference. + * @phpstan-return never + */ + function ms_not_installed($domain, $path) + { + } + /** + * This deprecated function formerly set the site_name property of the $current_site object. + * + * This function simply returns the object, as before. + * The bootstrap takes care of setting site_name. + * + * @access private + * @since 3.0.0 + * @deprecated 3.9.0 Use get_current_site() instead. + * + * @param WP_Network $current_site + * @return WP_Network + */ + function get_current_site_name($current_site) + { + } + /** + * This deprecated function managed much of the site and network loading in multisite. + * + * The current bootstrap code is now responsible for parsing the site and network load as + * well as setting the global $current_site object. + * + * @access private + * @since 3.0.0 + * @deprecated 3.9.0 + * + * @global WP_Network $current_site + * + * @return WP_Network + */ + function wpmu_current_site() + { + } + /** + * Retrieves an object containing information about the requested network. + * + * @since 3.9.0 + * @deprecated 4.7.0 Use get_network() + * @see get_network() + * + * @internal In 4.6.0, converted to use get_network() + * + * @param object|int $network The network's database row or ID. + * @return WP_Network|false Object containing network information if found, false if not. + */ + function wp_get_network($network) + { + } + /** + * Network API + * + * @package WordPress + * @subpackage Multisite + * @since 5.1.0 + */ + /** + * Retrieves network data given a network ID or network object. + * + * Network data will be cached and returned after being passed through a filter. + * If the provided network is empty, the current network global will be used. + * + * @since 4.6.0 + * + * @global WP_Network $current_site + * + * @param WP_Network|int|null $network Optional. Network to retrieve. Default is the current network. + * @return WP_Network|null The network object or null if not found. + */ + function get_network($network = \null) + { + } + /** + * Retrieves a list of networks. + * + * @since 4.6.0 + * + * @param string|array $args Optional. Array or string of arguments. See WP_Network_Query::parse_query() + * for information on accepted arguments. Default empty array. + * @return array|int List of WP_Network objects, a list of network IDs when 'fields' is set to 'ids', + * or the number of networks when 'count' is passed as a query var. + */ + function get_networks($args = array()) + { + } + /** + * Removes a network from the object cache. + * + * @since 4.6.0 + * + * @global bool $_wp_suspend_cache_invalidation + * + * @param int|array $ids Network ID or an array of network IDs to remove from cache. + * @phpstan-return void + */ + function clean_network_cache($ids) + { + } + /** + * Updates the network cache of given networks. + * + * Will add the networks in $networks to the cache. If network ID already exists + * in the network cache then it will not be updated. The network is added to the + * cache using the network group with the key using the ID of the networks. + * + * @since 4.6.0 + * + * @param array $networks Array of network row objects. + */ + function update_network_cache($networks) + { + } + /** + * Adds any networks from the given IDs to the cache that do not already exist in cache. + * + * @since 4.6.0 + * @since 6.1.0 This function is no longer marked as "private". + * + * @see update_network_cache() + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array $network_ids Array of network IDs. + */ + function _prime_network_caches($network_ids) + { + } + /** + * Site API + * + * @package WordPress + * @subpackage Multisite + * @since 5.1.0 + */ + /** + * Inserts a new site into the database. + * + * @since 5.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array $data { + * Data for the new site that should be inserted. + * + * @type string $domain Site domain. Default empty string. + * @type string $path Site path. Default '/'. + * @type int $network_id The site's network ID. Default is the current network ID. + * @type string $registered When the site was registered, in SQL datetime format. Default is + * the current time. + * @type string $last_updated When the site was last updated, in SQL datetime format. Default is + * the value of $registered. + * @type int $public Whether the site is public. Default 1. + * @type int $archived Whether the site is archived. Default 0. + * @type int $mature Whether the site is mature. Default 0. + * @type int $spam Whether the site is spam. Default 0. + * @type int $deleted Whether the site is deleted. Default 0. + * @type int $lang_id The site's language ID. Currently unused. Default 0. + * @type int $user_id User ID for the site administrator. Passed to the + * `wp_initialize_site` hook. + * @type string $title Site title. Default is 'Site %d' where %d is the site ID. Passed + * to the `wp_initialize_site` hook. + * @type array $options Custom option $key => $value pairs to use. Default empty array. Passed + * to the `wp_initialize_site` hook. + * @type array $meta Custom site metadata $key => $value pairs to use. Default empty array. + * Passed to the `wp_initialize_site` hook. + * } + * @return int|WP_Error The new site's ID on success, or error object on failure. + * @phpstan-param array{ + * domain?: string, + * path?: string, + * network_id?: int, + * registered?: string, + * last_updated?: string, + * public?: int, + * archived?: int, + * mature?: int, + * spam?: int, + * deleted?: int, + * lang_id?: int, + * user_id?: int, + * title?: string, + * options?: array, + * meta?: array, + * } $data + */ + function wp_insert_site(array $data) + { + } + /** + * Updates a site in the database. + * + * @since 5.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $site_id ID of the site that should be updated. + * @param array $data Site data to update. See {@see wp_insert_site()} for the list of supported keys. + * @return int|WP_Error The updated site's ID on success, or error object on failure. + * @phpstan-param array{ + * domain?: string, + * path?: string, + * network_id?: int, + * registered?: string, + * last_updated?: string, + * public?: int, + * archived?: int, + * mature?: int, + * spam?: int, + * deleted?: int, + * lang_id?: int, + * user_id?: int, + * title?: string, + * options?: array, + * meta?: array, + * } $data See wp_insert_site() + */ + function wp_update_site($site_id, array $data) + { + } + /** + * Deletes a site from the database. + * + * @since 5.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $site_id ID of the site that should be deleted. + * @return WP_Site|WP_Error The deleted site object on success, or error object on failure. + */ + function wp_delete_site($site_id) + { + } + /** + * Retrieves site data given a site ID or site object. + * + * Site data will be cached and returned after being passed through a filter. + * If the provided site is empty, the current site global will be used. + * + * @since 4.6.0 + * + * @param WP_Site|int|null $site Optional. Site to retrieve. Default is the current site. + * @return WP_Site|null The site object or null if not found. + */ + function get_site($site = \null) + { + } + /** + * Adds any sites from the given IDs to the cache that do not already exist in cache. + * + * @since 4.6.0 + * @since 5.1.0 Introduced the `$update_meta_cache` parameter. + * @since 6.1.0 This function is no longer marked as "private". + * @since 6.3.0 Use wp_lazyload_site_meta() for lazy-loading of site meta. + * + * @see update_site_cache() + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array $ids ID list. + * @param bool $update_meta_cache Optional. Whether to update the meta cache. Default true. + */ + function _prime_site_caches($ids, $update_meta_cache = \true) + { + } + /** + * Queue site meta for lazy-loading. + * + * @since 6.3.0 + * + * @param array $site_ids List of site IDs. + * @phpstan-return void + */ + function wp_lazyload_site_meta(array $site_ids) + { + } + /** + * Updates sites in cache. + * + * @since 4.6.0 + * @since 5.1.0 Introduced the `$update_meta_cache` parameter. + * + * @param array $sites Array of site objects. + * @param bool $update_meta_cache Whether to update site meta cache. Default true. + * @phpstan-return void + */ + function update_site_cache($sites, $update_meta_cache = \true) + { + } + /** + * Updates metadata cache for list of site IDs. + * + * Performs SQL query to retrieve all metadata for the sites matching `$site_ids` and stores them in the cache. + * Subsequent calls to `get_site_meta()` will not need to query the database. + * + * @since 5.1.0 + * + * @param array $site_ids List of site IDs. + * @return array|false An array of metadata on success, false if there is nothing to update. + */ + function update_sitemeta_cache($site_ids) + { + } + /** + * Retrieves a list of sites matching requested arguments. + * + * @since 4.6.0 + * @since 4.8.0 Introduced the 'lang_id', 'lang__in', and 'lang__not_in' parameters. + * + * @see WP_Site_Query::parse_query() + * + * @param string|array $args Optional. Array or string of arguments. See WP_Site_Query::__construct() + * for information on accepted arguments. Default empty array. + * @return array|int List of WP_Site objects, a list of site IDs when 'fields' is set to 'ids', + * or the number of sites when 'count' is passed as a query var. + * @phpstan-param array{ + * site__in?: int[], + * site__not_in?: int[], + * count?: bool, + * date_query?: array, + * fields?: string, + * ID?: int, + * number?: int, + * offset?: int, + * no_found_rows?: bool, + * orderby?: string|array, + * order?: string, + * network_id?: int, + * network__in?: int[], + * network__not_in?: int[], + * domain?: string, + * domain__in?: string[], + * domain__not_in?: string[], + * path?: string, + * path__in?: string[], + * path__not_in?: string[], + * public?: int, + * archived?: int, + * mature?: int, + * spam?: int, + * deleted?: int, + * lang_id?: int, + * lang__in?: string[], + * lang__not_in?: string[], + * search?: string, + * search_columns?: string[], + * update_site_cache?: bool, + * update_site_meta_cache?: bool, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * } $args See WP_Site_Query::__construct() + */ + function get_sites($args = array()) + { + } + /** + * Prepares site data for insertion or update in the database. + * + * @since 5.1.0 + * + * @param array $data Associative array of site data passed to the respective function. + * See {@see wp_insert_site()} for the possibly included data. + * @param array $defaults Site data defaults to parse $data against. + * @param WP_Site|null $old_site Optional. Old site object if an update, or null if an insertion. + * Default null. + * @return array|WP_Error Site data ready for a database transaction, or WP_Error in case a validation + * error occurred. + * @phpstan-param array{ + * domain?: string, + * path?: string, + * network_id?: int, + * registered?: string, + * last_updated?: string, + * public?: int, + * archived?: int, + * mature?: int, + * spam?: int, + * deleted?: int, + * lang_id?: int, + * user_id?: int, + * title?: string, + * options?: array, + * meta?: array, + * } $data See wp_insert_site() + */ + function wp_prepare_site_data($data, $defaults, $old_site = \null) + { + } + /** + * Normalizes data for a site prior to inserting or updating in the database. + * + * @since 5.1.0 + * + * @param array $data Associative array of site data passed to the respective function. + * See {@see wp_insert_site()} for the possibly included data. + * @return array Normalized site data. + * @phpstan-param array{ + * domain?: string, + * path?: string, + * network_id?: int, + * registered?: string, + * last_updated?: string, + * public?: int, + * archived?: int, + * mature?: int, + * spam?: int, + * deleted?: int, + * lang_id?: int, + * user_id?: int, + * title?: string, + * options?: array, + * meta?: array, + * } $data See wp_insert_site() + */ + function wp_normalize_site_data($data) + { + } + /** + * Validates data for a site prior to inserting or updating in the database. + * + * @since 5.1.0 + * + * @param WP_Error $errors Error object, passed by reference. Will contain validation errors if + * any occurred. + * @param array $data Associative array of complete site data. See {@see wp_insert_site()} + * for the included data. + * @param WP_Site|null $old_site The old site object if the data belongs to a site being updated, + * or null if it is a new site being inserted. + * @phpstan-param array{ + * domain?: string, + * path?: string, + * network_id?: int, + * registered?: string, + * last_updated?: string, + * public?: int, + * archived?: int, + * mature?: int, + * spam?: int, + * deleted?: int, + * lang_id?: int, + * user_id?: int, + * title?: string, + * options?: array, + * meta?: array, + * } $data See wp_insert_site() + * @phpstan-return void + */ + function wp_validate_site_data($errors, $data, $old_site = \null) + { + } + /** + * Runs the initialization routine for a given site. + * + * This process includes creating the site's database tables and + * populating them with defaults. + * + * @since 5.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * @global WP_Roles $wp_roles WordPress role management object. + * + * @param int|WP_Site $site_id Site ID or object. + * @param array $args { + * Optional. Arguments to modify the initialization behavior. + * + * @type int $user_id Required. User ID for the site administrator. + * @type string $title Site title. Default is 'Site %d' where %d is the + * site ID. + * @type array $options Custom option $key => $value pairs to use. Default + * empty array. + * @type array $meta Custom site metadata $key => $value pairs to use. + * Default empty array. + * } + * @return true|WP_Error True on success, or error object on failure. + * @phpstan-param array{ + * user_id?: int, + * title?: string, + * options?: array, + * meta?: array, + * } $args + */ + function wp_initialize_site($site_id, array $args = array()) + { + } + /** + * Runs the uninitialization routine for a given site. + * + * This process includes dropping the site's database tables and deleting its uploads directory. + * + * @since 5.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int|WP_Site $site_id Site ID or object. + * @return true|WP_Error True on success, or error object on failure. + */ + function wp_uninitialize_site($site_id) + { + } + /** + * Checks whether a site is initialized. + * + * A site is considered initialized when its database tables are present. + * + * @since 5.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int|WP_Site $site_id Site ID or object. + * @return bool True if the site is initialized, false otherwise. + */ + function wp_is_site_initialized($site_id) + { + } + /** + * Clean the blog cache + * + * @since 3.5.0 + * + * @global bool $_wp_suspend_cache_invalidation + * + * @param WP_Site|int $blog The site object or ID to be cleared from cache. + * @phpstan-return void + */ + function clean_blog_cache($blog) + { + } + /** + * Adds metadata to a site. + * + * @since 5.1.0 + * + * @param int $site_id Site ID. + * @param string $meta_key Metadata name. + * @param mixed $meta_value Metadata value. Must be serializable if non-scalar. + * @param bool $unique Optional. Whether the same key should not be added. + * Default false. + * @return int|false Meta ID on success, false on failure. + */ + function add_site_meta($site_id, $meta_key, $meta_value, $unique = \false) + { + } + /** + * Removes metadata matching criteria from a site. + * + * You can match based on the key, or key and value. Removing based on key and + * value, will keep from removing duplicate metadata with the same key. It also + * allows removing all metadata matching key, if needed. + * + * @since 5.1.0 + * + * @param int $site_id Site ID. + * @param string $meta_key Metadata name. + * @param mixed $meta_value Optional. Metadata value. If provided, + * rows will only be removed that match the value. + * Must be serializable if non-scalar. Default empty. + * @return bool True on success, false on failure. + */ + function delete_site_meta($site_id, $meta_key, $meta_value = '') + { + } + /** + * Retrieves metadata for a site. + * + * @since 5.1.0 + * + * @param int $site_id Site ID. + * @param string $key Optional. The meta key to retrieve. By default, + * returns data for all keys. Default empty. + * @param bool $single Optional. Whether to return a single value. + * This parameter has no effect if `$key` is not specified. + * Default false. + * @return mixed An array of values if `$single` is false. + * The value of meta data field if `$single` is true. + * False for an invalid `$site_id` (non-numeric, zero, or negative value). + * An empty string if a valid but non-existing site ID is passed. + */ + function get_site_meta($site_id, $key = '', $single = \false) + { + } + /** + * Updates metadata for a site. + * + * Use the $prev_value parameter to differentiate between meta fields with the + * same key and site ID. + * + * If the meta field for the site does not exist, it will be added. + * + * @since 5.1.0 + * + * @param int $site_id Site ID. + * @param string $meta_key Metadata key. + * @param mixed $meta_value Metadata value. Must be serializable if non-scalar. + * @param mixed $prev_value Optional. Previous value to check before updating. + * If specified, only update existing metadata entries with + * this value. Otherwise, update all entries. Default empty. + * @return int|bool Meta ID if the key didn't exist, true on successful update, + * false on failure or if the value passed to the function + * is the same as the one that is already in the database. + */ + function update_site_meta($site_id, $meta_key, $meta_value, $prev_value = '') + { + } + /** + * Deletes everything from site meta matching meta key. + * + * @since 5.1.0 + * + * @param string $meta_key Metadata key to search for when deleting. + * @return bool Whether the site meta key was deleted from the database. + */ + function delete_site_meta_by_key($meta_key) + { + } + /** + * Updates the count of sites for a network based on a changed site. + * + * @since 5.1.0 + * + * @param WP_Site $new_site The site object that has been inserted, updated or deleted. + * @param WP_Site|null $old_site Optional. If $new_site has been updated, this must be the previous + * state of that site. Default null. + * @phpstan-return void + */ + function wp_maybe_update_network_site_counts_on_update($new_site, $old_site = \null) + { + } + /** + * Triggers actions on site status updates. + * + * @since 5.1.0 + * + * @param WP_Site $new_site The site object after the update. + * @param WP_Site|null $old_site Optional. If $new_site has been updated, this must be the previous + * state of that site. Default null. + */ + function wp_maybe_transition_site_statuses_on_update($new_site, $old_site = \null) + { + } + /** + * Cleans the necessary caches after specific site data has been updated. + * + * @since 5.1.0 + * + * @param WP_Site $new_site The site object after the update. + * @param WP_Site $old_site The site object prior to the update. + */ + function wp_maybe_clean_new_site_cache_on_update($new_site, $old_site) + { + } + /** + * Updates the `blog_public` option for a given site ID. + * + * @since 5.1.0 + * + * @param int $site_id Site ID. + * @param string $is_public Whether the site is public. A numeric string, + * for compatibility reasons. Accepts '1' or '0'. + * @phpstan-param '1'|'0' $is_public + * @phpstan-return void + */ + function wp_update_blog_public_option_on_site_update($site_id, $is_public) + { + } + /** + * Sets the last changed time for the 'sites' cache group. + * + * @since 5.1.0 + */ + function wp_cache_set_sites_last_changed() + { + } + /** + * Aborts calls to site meta if it is not supported. + * + * @since 5.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param mixed $check Skip-value for whether to proceed site meta function execution. + * @return mixed Original value of $check, or false if site meta is not supported. + */ + function wp_check_site_meta_support_prefilter($check) + { + } + /** + * Displays a navigation menu. + * + * @since 3.0.0 + * @since 4.7.0 Added the `item_spacing` argument. + * @since 5.5.0 Added the `container_aria_label` argument. + * + * @param array $args { + * Optional. Array of nav menu arguments. + * + * @type int|string|WP_Term $menu Desired menu. Accepts a menu ID, slug, name, or object. + * Default empty. + * @type string $menu_class CSS class to use for the ul element which forms the menu. + * Default 'menu'. + * @type string $menu_id The ID that is applied to the ul element which forms the menu. + * Default is the menu slug, incremented. + * @type string $container Whether to wrap the ul, and what to wrap it with. + * Default 'div'. + * @type string $container_class Class that is applied to the container. + * Default 'menu-{menu slug}-container'. + * @type string $container_id The ID that is applied to the container. Default empty. + * @type string $container_aria_label The aria-label attribute that is applied to the container + * when it's a nav element. Default empty. + * @type callable|false $fallback_cb If the menu doesn't exist, a callback function will fire. + * Default is 'wp_page_menu'. Set to false for no fallback. + * @type string $before Text before the link markup. Default empty. + * @type string $after Text after the link markup. Default empty. + * @type string $link_before Text before the link text. Default empty. + * @type string $link_after Text after the link text. Default empty. + * @type bool $echo Whether to echo the menu or return it. Default true. + * @type int $depth How many levels of the hierarchy are to be included. + * 0 means all. Default 0. + * Default 0. + * @type object $walker Instance of a custom walker class. Default empty. + * @type string $theme_location Theme location to be used. Must be registered with + * register_nav_menu() in order to be selectable by the user. + * @type string $items_wrap How the list items should be wrapped. Uses printf() format with + * numbered placeholders. Default is a ul with an id and class. + * @type string $item_spacing Whether to preserve whitespace within the menu's HTML. + * Accepts 'preserve' or 'discard'. Default 'preserve'. + * } + * @return void|string|false Void if 'echo' argument is true, menu output if 'echo' is false. + * False if there are no items or no menu was found. + * @phpstan-param array{ + * menu?: int|string|WP_Term, + * menu_class?: string, + * menu_id?: string, + * container?: string, + * container_class?: string, + * container_id?: string, + * container_aria_label?: string, + * fallback_cb?: callable|false, + * before?: string, + * after?: string, + * link_before?: string, + * link_after?: string, + * echo?: bool, + * depth?: int, + * walker?: object, + * theme_location?: string, + * items_wrap?: string, + * item_spacing?: string, + * } $args + */ + function wp_nav_menu($args = array()) + { + } + /** + * Adds the class property classes for the current context, if applicable. + * + * @access private + * @since 3.0.0 + * + * @global WP_Query $wp_query WordPress Query object. + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param array $menu_items The current menu item objects to which to add the class property information. + */ + function _wp_menu_item_classes_by_context(&$menu_items) + { + } + /** + * Retrieves the HTML list content for nav menu items. + * + * @uses Walker_Nav_Menu to create HTML list content. + * @since 3.0.0 + * + * @param array $items The menu items, sorted by each menu item's menu order. + * @param int $depth Depth of the item in reference to parents. + * @param stdClass $args An object containing wp_nav_menu() arguments. + * @return string The HTML list content for the menu items. + */ + function walk_nav_menu_tree($items, $depth, $args) + { + } + /** + * Prevents a menu item ID from being used more than once. + * + * @since 3.0.1 + * @access private + * + * @param string $id + * @param object $item + * @return string + */ + function _nav_menu_item_id_use_once($id, $item) + { + } + /** + * Remove the `menu-item-has-children` class from bottom level menu items. + * + * This runs on the {@see 'nav_menu_css_class'} filter. The $args and $depth + * parameters were added after the filter was originally introduced in + * WordPress 3.0.0 so this needs to allow for cases in which the filter is + * called without them. + * + * @see https://core.trac.wordpress.org/ticket/56926 + * + * @since 6.2.0 + * + * @param string[] $classes Array of the CSS classes that are applied to the menu item's `<li>` element. + * @param WP_Post $menu_item The current menu item object. + * @param stdClass|false $args An object of wp_nav_menu() arguments. Default false ($args unspecified when filter is called). + * @param int|false $depth Depth of menu item. Default false ($depth unspecified when filter is called). + * @return string[] Modified nav menu classes. + */ + function wp_nav_menu_remove_menu_item_has_children_class($classes, $menu_item, $args = \false, $depth = \false) + { + } + /** + * Navigation Menu functions + * + * @package WordPress + * @subpackage Nav_Menus + * @since 3.0.0 + */ + /** + * Returns a navigation menu object. + * + * @since 3.0.0 + * + * @param int|string|WP_Term $menu Menu ID, slug, name, or object. + * @return WP_Term|false Menu object on success, false if $menu param isn't supplied or term does not exist. + */ + function wp_get_nav_menu_object($menu) + { + } + /** + * Determines whether the given ID is a navigation menu. + * + * Returns true if it is; false otherwise. + * + * @since 3.0.0 + * + * @param int|string|WP_Term $menu Menu ID, slug, name, or object of menu to check. + * @return bool Whether the menu exists. + */ + function is_nav_menu($menu) + { + } + /** + * Registers navigation menu locations for a theme. + * + * @since 3.0.0 + * + * @global array $_wp_registered_nav_menus + * + * @param string[] $locations Associative array of menu location identifiers (like a slug) and descriptive text. + */ + function register_nav_menus($locations = array()) + { + } + /** + * Unregisters a navigation menu location for a theme. + * + * @since 3.1.0 + * + * @global array $_wp_registered_nav_menus + * + * @param string $location The menu location identifier. + * @return bool True on success, false on failure. + */ + function unregister_nav_menu($location) + { + } + /** + * Registers a navigation menu location for a theme. + * + * @since 3.0.0 + * + * @param string $location Menu location identifier, like a slug. + * @param string $description Menu location descriptive text. + */ + function register_nav_menu($location, $description) + { + } + /** + * Retrieves all registered navigation menu locations in a theme. + * + * @since 3.0.0 + * + * @global array $_wp_registered_nav_menus + * + * @return string[] Associative array of registered navigation menu descriptions keyed + * by their location. If none are registered, an empty array. + */ + function get_registered_nav_menus() + { + } + /** + * Retrieves all registered navigation menu locations and the menus assigned to them. + * + * @since 3.0.0 + * + * @return int[] Associative array of registered navigation menu IDs keyed by their + * location name. If none are registered, an empty array. + */ + function get_nav_menu_locations() + { + } + /** + * Determines whether a registered nav menu location has a menu assigned to it. + * + * @since 3.0.0 + * + * @param string $location Menu location identifier. + * @return bool Whether location has a menu. + */ + function has_nav_menu($location) + { + } + /** + * Returns the name of a navigation menu. + * + * @since 4.9.0 + * + * @param string $location Menu location identifier. + * @return string Menu name. + */ + function wp_get_nav_menu_name($location) + { + } + /** + * Determines whether the given ID is a nav menu item. + * + * @since 3.0.0 + * + * @param int $menu_item_id The ID of the potential nav menu item. + * @return bool Whether the given ID is that of a nav menu item. + */ + function is_nav_menu_item($menu_item_id = 0) + { + } + /** + * Creates a navigation menu. + * + * Note that `$menu_name` is expected to be pre-slashed. + * + * @since 3.0.0 + * + * @param string $menu_name Menu name. + * @return int|WP_Error Menu ID on success, WP_Error object on failure. + */ + function wp_create_nav_menu($menu_name) + { + } + /** + * Deletes a navigation menu. + * + * @since 3.0.0 + * + * @param int|string|WP_Term $menu Menu ID, slug, name, or object. + * @return bool|WP_Error True on success, false or WP_Error object on failure. + */ + function wp_delete_nav_menu($menu) + { + } + /** + * Saves the properties of a menu or create a new menu with those properties. + * + * Note that `$menu_data` is expected to be pre-slashed. + * + * @since 3.0.0 + * + * @param int $menu_id The ID of the menu or "0" to create a new menu. + * @param array $menu_data The array of menu data. + * @return int|WP_Error Menu ID on success, WP_Error object on failure. + */ + function wp_update_nav_menu_object($menu_id = 0, $menu_data = array()) + { + } + /** + * Saves the properties of a menu item or create a new one. + * + * The menu-item-title, menu-item-description and menu-item-attr-title are expected + * to be pre-slashed since they are passed directly to APIs that expect slashed data. + * + * @since 3.0.0 + * @since 5.9.0 Added the `$fire_after_hooks` parameter. + * + * @param int $menu_id The ID of the menu. If 0, makes the menu item a draft orphan. + * @param int $menu_item_db_id The ID of the menu item. If 0, creates a new menu item. + * @param array $menu_item_data The menu item's data. + * @param bool $fire_after_hooks Whether to fire the after insert hooks. Default true. + * @return int|WP_Error The menu item's database ID or WP_Error object on failure. + */ + function wp_update_nav_menu_item($menu_id = 0, $menu_item_db_id = 0, $menu_item_data = array(), $fire_after_hooks = \true) + { + } + /** + * Returns all navigation menu objects. + * + * @since 3.0.0 + * @since 4.1.0 Default value of the 'orderby' argument was changed from 'none' + * to 'name'. + * + * @param array $args Optional. Array of arguments passed on to get_terms(). + * Default empty array. + * @return WP_Term[] An array of menu objects. + */ + function wp_get_nav_menus($args = array()) + { + } + /** + * Determines whether a menu item is valid. + * + * @link https://core.trac.wordpress.org/ticket/13958 + * + * @since 3.2.0 + * @access private + * + * @param object $item The menu item to check. + * @return bool False if invalid, otherwise true. + */ + function _is_valid_nav_menu_item($item) + { + } + /** + * Retrieves all menu items of a navigation menu. + * + * Note: Most arguments passed to the `$args` parameter – save for 'output_key' – are + * specifically for retrieving nav_menu_item posts from get_posts() and may only + * indirectly affect the ultimate ordering and content of the resulting nav menu + * items that get returned from this function. + * + * @since 3.0.0 + * + * @param int|string|WP_Term $menu Menu ID, slug, name, or object. + * @param array $args { + * Optional. Arguments to pass to get_posts(). + * + * @type string $order How to order nav menu items as queried with get_posts(). + * Will be ignored if 'output' is ARRAY_A. Default 'ASC'. + * @type string $orderby Field to order menu items by as retrieved from get_posts(). + * Supply an orderby field via 'output_key' to affect the + * output order of nav menu items. Default 'menu_order'. + * @type string $post_type Menu items post type. Default 'nav_menu_item'. + * @type string $post_status Menu items post status. Default 'publish'. + * @type string $output How to order outputted menu items. Default ARRAY_A. + * @type string $output_key Key to use for ordering the actual menu items that get + * returned. Note that that is not a get_posts() argument + * and will only affect output of menu items processed in + * this function. Default 'menu_order'. + * @type bool $nopaging Whether to retrieve all menu items (true) or paginate + * (false). Default true. + * @type bool $update_menu_item_cache Whether to update the menu item cache. Default true. + * } + * @return array|false Array of menu items, otherwise false. + * @phpstan-param array{ + * order?: string, + * orderby?: string, + * post_type?: string, + * post_status?: string, + * output?: string, + * output_key?: string, + * nopaging?: bool, + * update_menu_item_cache?: bool, + * } $args + */ + function wp_get_nav_menu_items($menu, $args = array()) + { + } + /** + * Updates post and term caches for all linked objects for a list of menu items. + * + * @since 6.1.0 + * + * @param WP_Post[] $menu_items Array of menu item post objects. + */ + function update_menu_item_cache($menu_items) + { + } + /** + * Decorates a menu item object with the shared navigation menu item properties. + * + * Properties: + * - ID: The term_id if the menu item represents a taxonomy term. + * - attr_title: The title attribute of the link element for this menu item. + * - classes: The array of class attribute values for the link element of this menu item. + * - db_id: The DB ID of this item as a nav_menu_item object, if it exists (0 if it doesn't exist). + * - description: The description of this menu item. + * - menu_item_parent: The DB ID of the nav_menu_item that is this item's menu parent, if any. 0 otherwise. + * - object: The type of object originally represented, such as 'category', 'post', or 'attachment'. + * - object_id: The DB ID of the original object this menu item represents, e.g. ID for posts and term_id for categories. + * - post_parent: The DB ID of the original object's parent object, if any (0 otherwise). + * - post_title: A "no title" label if menu item represents a post that lacks a title. + * - target: The target attribute of the link element for this menu item. + * - title: The title of this menu item. + * - type: The family of objects originally represented, such as 'post_type' or 'taxonomy'. + * - type_label: The singular label used to describe this type of menu item. + * - url: The URL to which this menu item points. + * - xfn: The XFN relationship expressed in the link of this menu item. + * - _invalid: Whether the menu item represents an object that no longer exists. + * + * @since 3.0.0 + * + * @param object $menu_item The menu item to modify. + * @return object The menu item with standard menu item properties. + */ + function wp_setup_nav_menu_item($menu_item) + { + } + /** + * Returns the menu items associated with a particular object. + * + * @since 3.0.0 + * + * @param int $object_id Optional. The ID of the original object. Default 0. + * @param string $object_type Optional. The type of object, such as 'post_type' or 'taxonomy'. + * Default 'post_type'. + * @param string $taxonomy Optional. If $object_type is 'taxonomy', $taxonomy is the name + * of the tax that $object_id belongs to. Default empty. + * @return int[] The array of menu item IDs; empty array if none. + */ + function wp_get_associated_nav_menu_items($object_id = 0, $object_type = 'post_type', $taxonomy = '') + { + } + /** + * Callback for handling a menu item when its original object is deleted. + * + * @since 3.0.0 + * @access private + * + * @param int $object_id The ID of the original object being trashed. + */ + function _wp_delete_post_menu_item($object_id) + { + } + /** + * Serves as a callback for handling a menu item when its original object is deleted. + * + * @since 3.0.0 + * @access private + * + * @param int $object_id The ID of the original object being trashed. + * @param int $tt_id Term taxonomy ID. Unused. + * @param string $taxonomy Taxonomy slug. + */ + function _wp_delete_tax_menu_item($object_id, $tt_id, $taxonomy) + { + } + /** + * Automatically add newly published page objects to menus with that as an option. + * + * @since 3.0.0 + * @access private + * + * @param string $new_status The new status of the post object. + * @param string $old_status The old status of the post object. + * @param WP_Post $post The post object being transitioned from one status to another. + * @phpstan-return void + */ + function _wp_auto_add_pages_to_menu($new_status, $old_status, $post) + { + } + /** + * Deletes auto-draft posts associated with the supplied changeset. + * + * @since 4.8.0 + * @access private + * + * @param int $post_id Post ID for the customize_changeset. + * @phpstan-return void + */ + function _wp_delete_customize_changeset_dependent_auto_drafts($post_id) + { + } + /** + * Handles menu config after theme change. + * + * @access private + * @since 4.9.0 + */ + function _wp_menus_changed() + { + } + /** + * Maps nav menu locations according to assignments in previously active theme. + * + * @since 4.9.0 + * + * @param array $new_nav_menu_locations New nav menu locations assignments. + * @param array $old_nav_menu_locations Old nav menu locations assignments. + * @return array Nav menus mapped to new nav menu locations. + */ + function wp_map_nav_menu_locations($new_nav_menu_locations, $old_nav_menu_locations) + { + } + /** + * Prevents menu items from being their own parent. + * + * Resets menu_item_parent to 0 when the parent is set to the item itself. + * For use before saving `_menu_item_menu_item_parent` in nav-menus.php. + * + * @since 6.2.0 + * @access private + * + * @param array $menu_item_data The menu item data array. + * @return array The menu item data with reset menu_item_parent. + */ + function _wp_reset_invalid_menu_item_parent($menu_item_data) + { + } + /** + * Option API + * + * @package WordPress + * @subpackage Option + */ + /** + * Retrieves an option value based on an option name. + * + * If the option does not exist, and a default value is not provided, + * boolean false is returned. This could be used to check whether you need + * to initialize an option during installation of a plugin, however that + * can be done better by using add_option() which will not overwrite + * existing options. + * + * Not initializing an option and using boolean `false` as a return value + * is a bad practice as it triggers an additional database query. + * + * The type of the returned value can be different from the type that was passed + * when saving or updating the option. If the option value was serialized, + * then it will be unserialized when it is returned. In this case the type will + * be the same. For example, storing a non-scalar value like an array will + * return the same array. + * + * In most cases non-string scalar and null values will be converted and returned + * as string equivalents. + * + * Exceptions: + * + * 1. When the option has not been saved in the database, the `$default_value` value + * is returned if provided. If not, boolean `false` is returned. + * 2. When one of the Options API filters is used: {@see 'pre_option_$option'}, + * {@see 'default_option_$option'}, or {@see 'option_$option'}, the returned + * value may not match the expected type. + * 3. When the option has just been saved in the database, and get_option() + * is used right after, non-string scalar and null values are not converted to + * string equivalents and the original type is returned. + * + * Examples: + * + * When adding options like this: `add_option( 'my_option_name', 'value' )` + * and then retrieving them with `get_option( 'my_option_name' )`, the returned + * values will be: + * + * - `false` returns `string(0) ""` + * - `true` returns `string(1) "1"` + * - `0` returns `string(1) "0"` + * - `1` returns `string(1) "1"` + * - `'0'` returns `string(1) "0"` + * - `'1'` returns `string(1) "1"` + * - `null` returns `string(0) ""` + * + * When adding options with non-scalar values like + * `add_option( 'my_array', array( false, 'str', null ) )`, the returned value + * will be identical to the original as it is serialized before saving + * it in the database: + * + * array(3) { + * [0] => bool(false) + * [1] => string(3) "str" + * [2] => NULL + * } + * + * @since 1.5.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $option Name of the option to retrieve. Expected to not be SQL-escaped. + * @param mixed $default_value Optional. Default value to return if the option does not exist. + * @return mixed Value of the option. A value of any type may be returned, including + * scalar (string, boolean, float, integer), null, array, object. + * Scalar and null values will be returned as strings as long as they originate + * from a database stored option value. If there is no option in the database, + * boolean `false` is returned. + */ + function get_option($option, $default_value = \false) + { + } + /** + * Primes specific options into the cache with a single database query. + * + * Only options that do not already exist in cache will be loaded. + * + * @since 6.4.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string[] $options An array of option names to be loaded. + * @phpstan-return void + */ + function wp_prime_option_caches($options) + { + } + /** + * Primes the cache of all options registered with a specific option group. + * + * @since 6.4.0 + * + * @global array $new_allowed_options + * + * @param string $option_group The option group to load options for. + */ + function wp_prime_option_caches_by_group($option_group) + { + } + /** + * Retrieves multiple options. + * + * Options are loaded as necessary first in order to use a single database query at most. + * + * @since 6.4.0 + * + * @param string[] $options An array of option names to retrieve. + * @return array An array of key-value pairs for the requested options. + */ + function get_options($options) + { + } + /** + * Sets the autoload values for multiple options in the database. + * + * Autoloading too many options can lead to performance problems, especially if the options are not frequently used. + * This function allows modifying the autoload value for multiple options without changing the actual option value. + * This is for example recommended for plugin activation and deactivation hooks, to ensure any options exclusively used + * by the plugin which are generally autoloaded can be set to not autoload when the plugin is inactive. + * + * @since 6.4.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array $options Associative array of option names and their autoload values to set. The option names are + * expected to not be SQL-escaped. The autoload values accept 'yes'|true to enable or 'no'|false + * to disable. + * @return array Associative array of all provided $options as keys and boolean values for whether their autoload value + * was updated. + */ + function wp_set_option_autoload_values(array $options) + { + } + /** + * Sets the autoload value for multiple options in the database. + * + * This is a wrapper for {@see wp_set_option_autoload_values()}, which can be used to set different autoload values for + * each option at once. + * + * @since 6.4.0 + * + * @see wp_set_option_autoload_values() + * + * @param string[] $options List of option names. Expected to not be SQL-escaped. + * @param string|bool $autoload Autoload value to control whether to load the options when WordPress starts up. + * Accepts 'yes'|true to enable or 'no'|false to disable. + * @return array Associative array of all provided $options as keys and boolean values for whether their autoload value + * was updated. + */ + function wp_set_options_autoload(array $options, $autoload) + { + } + /** + * Sets the autoload value for an option in the database. + * + * This is a wrapper for {@see wp_set_option_autoload_values()}, which can be used to set the autoload value for + * multiple options at once. + * + * @since 6.4.0 + * + * @see wp_set_option_autoload_values() + * + * @param string $option Name of the option. Expected to not be SQL-escaped. + * @param string|bool $autoload Autoload value to control whether to load the option when WordPress starts up. + * Accepts 'yes'|true to enable or 'no'|false to disable. + * @return bool True if the autoload value was modified, false otherwise. + */ + function wp_set_option_autoload($option, $autoload) + { + } + /** + * Protects WordPress special option from being modified. + * + * Will die if $option is in protected list. Protected options are 'alloptions' + * and 'notoptions' options. + * + * @since 2.2.0 + * + * @param string $option Option name. + */ + function wp_protect_special_option($option) + { + } + /** + * Prints option value after sanitizing for forms. + * + * @since 1.5.0 + * + * @param string $option Option name. + */ + function form_option($option) + { + } + /** + * Loads and caches all autoloaded options, if available or all options. + * + * @since 2.2.0 + * @since 5.3.1 The `$force_cache` parameter was added. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param bool $force_cache Optional. Whether to force an update of the local cache + * from the persistent cache. Default false. + * @return array List of all options. + */ + function wp_load_alloptions($force_cache = \false) + { + } + /** + * Primes specific network options for the current network into the cache with a single database query. + * + * Only network options that do not already exist in cache will be loaded. + * + * If site is not multisite, then call wp_prime_option_caches(). + * + * @since 6.6.0 + * + * @see wp_prime_network_option_caches() + * + * @param string[] $options An array of option names to be loaded. + */ + function wp_prime_site_option_caches(array $options) + { + } + /** + * Primes specific network options into the cache with a single database query. + * + * Only network options that do not already exist in cache will be loaded. + * + * If site is not multisite, then call wp_prime_option_caches(). + * + * @since 6.6.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $network_id ID of the network. Can be null to default to the current network ID. + * @param string[] $options An array of option names to be loaded. + * @phpstan-return void + */ + function wp_prime_network_option_caches($network_id, array $options) + { + } + /** + * Loads and primes caches of certain often requested network options if is_multisite(). + * + * @since 3.0.0 + * @since 6.3.0 Also prime caches for network options when persistent object cache is enabled. + * @since 6.6.0 Uses wp_prime_network_option_caches(). + * + * @param int $network_id Optional. Network ID of network for which to prime network options cache. Defaults to current network. + * @phpstan-return void + */ + function wp_load_core_site_options($network_id = \null) + { + } + /** + * Updates the value of an option that was already added. + * + * You do not need to serialize values. If the value needs to be serialized, + * then it will be serialized before it is inserted into the database. + * Remember, resources cannot be serialized or added as an option. + * + * If the option does not exist, it will be created. + * This function is designed to work with or without a logged-in user. In terms of security, + * plugin developers should check the current user's capabilities before updating any options. + * + * @since 1.0.0 + * @since 4.2.0 The `$autoload` parameter was added. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $option Name of the option to update. Expected to not be SQL-escaped. + * @param mixed $value Option value. Must be serializable if non-scalar. Expected to not be SQL-escaped. + * @param bool|null $autoload Optional. Whether to load the option when WordPress starts up. + * Accepts a boolean, or `null` to stick with the initial value or, if no initial value is set, + * to leave the decision up to default heuristics in WordPress. + * For existing options, + * `$autoload` can only be updated using `update_option()` if `$value` is also changed. + * For backward compatibility 'yes' and 'no' are also accepted. + * Autoloading too many options can lead to performance problems, especially if the + * options are not frequently used. For options which are accessed across several places + * in the frontend, it is recommended to autoload them, by using true. + * For options which are accessed only on few specific URLs, it is recommended + * to not autoload them, by using false. + * For non-existent options, the default is null, which means WordPress will determine + * the autoload value. + * @return bool True if the value was updated, false otherwise. + */ + function update_option($option, $value, $autoload = \null) + { + } + /** + * Adds a new option. + * + * You do not need to serialize values. If the value needs to be serialized, + * then it will be serialized before it is inserted into the database. + * Remember, resources cannot be serialized or added as an option. + * + * You can create options without values and then update the values later. + * Existing options will not be updated and checks are performed to ensure that you + * aren't adding a protected WordPress option. Care should be taken to not name + * options the same as the ones which are protected. + * + * @since 1.0.0 + * @since 6.6.0 The $autoload parameter's default value was changed to null. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $option Name of the option to add. Expected to not be SQL-escaped. + * @param mixed $value Optional. Option value. Must be serializable if non-scalar. + * Expected to not be SQL-escaped. + * @param string $deprecated Optional. Description. Not used anymore. + * @param bool|null $autoload Optional. Whether to load the option when WordPress starts up. + * Accepts a boolean, or `null` to leave the decision up to default heuristics in WordPress. + * For backward compatibility 'yes' and 'no' are also accepted. + * Autoloading too many options can lead to performance problems, especially if the + * options are not frequently used. For options which are accessed across several places + * in the frontend, it is recommended to autoload them, by using 'yes'|true. + * For options which are accessed only on few specific URLs, it is recommended + * to not autoload them, by using false. + * Default is null, which means WordPress will determine the autoload value. + * @return bool True if the option was added, false otherwise. + */ + function add_option($option, $value = '', $deprecated = '', $autoload = \null) + { + } + /** + * Removes an option by name. Prevents removal of protected WordPress options. + * + * @since 1.2.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $option Name of the option to delete. Expected to not be SQL-escaped. + * @return bool True if the option was deleted, false otherwise. + */ + function delete_option($option) + { + } + /** + * Determines the appropriate autoload value for an option based on input. + * + * This function checks the provided autoload value and returns a standardized value + * ('on', 'off', 'auto-on', 'auto-off', or 'auto') based on specific conditions. + * + * If no explicit autoload value is provided, the function will check for certain heuristics around the given option. + * It will return `auto-on` to indicate autoloading, `auto-off` to indicate not autoloading, or `auto` if no clear + * decision could be made. + * + * @since 6.6.0 + * @access private + * + * @param string $option The name of the option. + * @param mixed $value The value of the option to check its autoload value. + * @param mixed $serialized_value The serialized value of the option to check its autoload value. + * @param bool|null $autoload The autoload value to check. + * Accepts 'on'|true to enable or 'off'|false to disable, or + * 'auto-on', 'auto-off', or 'auto' for internal purposes. + * Any other autoload value will be forced to either 'auto-on', + * 'auto-off', or 'auto'. + * 'yes' and 'no' are supported for backward compatibility. + * @return string Returns the original $autoload value if explicit, or 'auto-on', 'auto-off', + * or 'auto' depending on default heuristics. + */ + function wp_determine_option_autoload_value($option, $value, $serialized_value, $autoload) + { + } + /** + * Filters the default autoload value to disable autoloading if the option value is too large. + * + * @since 6.6.0 + * @access private + * + * @param bool|null $autoload The default autoload value to set. + * @param string $option The passed option name. + * @param mixed $value The passed option value to be saved. + * @param mixed $serialized_value The passed option value to be saved, in serialized form. + * @return bool|null Potentially modified $default. + */ + function wp_filter_default_autoload_value_via_option_size($autoload, $option, $value, $serialized_value) + { + } + /** + * Deletes a transient. + * + * @since 2.8.0 + * + * @param string $transient Transient name. Expected to not be SQL-escaped. + * @return bool True if the transient was deleted, false otherwise. + */ + function delete_transient($transient) + { + } + /** + * Retrieves the value of a transient. + * + * If the transient does not exist, does not have a value, or has expired, + * then the return value will be false. + * + * @since 2.8.0 + * + * @param string $transient Transient name. Expected to not be SQL-escaped. + * @return mixed Value of transient. + */ + function get_transient($transient) + { + } + /** + * Sets/updates the value of a transient. + * + * You do not need to serialize values. If the value needs to be serialized, + * then it will be serialized before it is set. + * + * @since 2.8.0 + * + * @param string $transient Transient name. Expected to not be SQL-escaped. + * Must be 172 characters or fewer in length. + * @param mixed $value Transient value. Must be serializable if non-scalar. + * Expected to not be SQL-escaped. + * @param int $expiration Optional. Time until expiration in seconds. Default 0 (no expiration). + * @return bool True if the value was set, false otherwise. + */ + function set_transient($transient, $value, $expiration = 0) + { + } + /** + * Deletes all expired transients. + * + * Note that this function won't do anything if an external object cache is in use. + * + * The multi-table delete syntax is used to delete the transient record + * from table a, and the corresponding transient_timeout record from table b. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @since 4.9.0 + * + * @param bool $force_db Optional. Force cleanup to run against the database even when an external object cache is used. + * @phpstan-return void + */ + function delete_expired_transients($force_db = \false) + { + } + /** + * Saves and restores user interface settings stored in a cookie. + * + * Checks if the current user-settings cookie is updated and stores it. When no + * cookie exists (different browser used), adds the last saved cookie restoring + * the settings. + * + * @since 2.7.0 + * @phpstan-return void + */ + function wp_user_settings() + { + } + /** + * Retrieves user interface setting value based on setting name. + * + * @since 2.7.0 + * + * @param string $name The name of the setting. + * @param string|false $default_value Optional. Default value to return when $name is not set. Default false. + * @return mixed The last saved user setting or the default value/false if it doesn't exist. + */ + function get_user_setting($name, $default_value = \false) + { + } + /** + * Adds or updates user interface setting. + * + * Both `$name` and `$value` can contain only ASCII letters, numbers, hyphens, and underscores. + * + * This function has to be used before any output has started as it calls `setcookie()`. + * + * @since 2.8.0 + * + * @param string $name The name of the setting. + * @param string $value The value for the setting. + * @return bool|null True if set successfully, false otherwise. + * Null if the current user is not a member of the site. + */ + function set_user_setting($name, $value) + { + } + /** + * Deletes user interface settings. + * + * Deleting settings would reset them to the defaults. + * + * This function has to be used before any output has started as it calls `setcookie()`. + * + * @since 2.7.0 + * + * @param string $names The name or array of names of the setting to be deleted. + * @return bool|null True if deleted successfully, false otherwise. + * Null if the current user is not a member of the site. + */ + function delete_user_setting($names) + { + } + /** + * Retrieves all user interface settings. + * + * @since 2.7.0 + * + * @global array $_updated_user_settings + * + * @return array The last saved user settings or empty array. + */ + function get_all_user_settings() + { + } + /** + * Private. Sets all user interface settings. + * + * @since 2.8.0 + * @access private + * + * @global array $_updated_user_settings + * + * @param array $user_settings User settings. + * @return bool|null True if set successfully, false if the current user could not be found. + * Null if the current user is not a member of the site. + */ + function wp_set_all_user_settings($user_settings) + { + } + /** + * Deletes the user settings of the current user. + * + * @since 2.7.0 + * @phpstan-return void + */ + function delete_all_user_settings() + { + } + /** + * Retrieve an option value for the current network based on name of option. + * + * @since 2.8.0 + * @since 4.4.0 The `$use_cache` parameter was deprecated. + * @since 4.4.0 Modified into wrapper for get_network_option() + * + * @see get_network_option() + * + * @param string $option Name of the option to retrieve. Expected to not be SQL-escaped. + * @param mixed $default_value Optional. Value to return if the option doesn't exist. Default false. + * @param bool $deprecated Whether to use cache. Multisite only. Always set to true. + * @return mixed Value set for the option. + */ + function get_site_option($option, $default_value = \false, $deprecated = \true) + { + } + /** + * Adds a new option for the current network. + * + * Existing options will not be updated. Note that prior to 3.3 this wasn't the case. + * + * @since 2.8.0 + * @since 4.4.0 Modified into wrapper for add_network_option() + * + * @see add_network_option() + * + * @param string $option Name of the option to add. Expected to not be SQL-escaped. + * @param mixed $value Option value, can be anything. Expected to not be SQL-escaped. + * @return bool True if the option was added, false otherwise. + */ + function add_site_option($option, $value) + { + } + /** + * Removes an option by name for the current network. + * + * @since 2.8.0 + * @since 4.4.0 Modified into wrapper for delete_network_option() + * + * @see delete_network_option() + * + * @param string $option Name of the option to delete. Expected to not be SQL-escaped. + * @return bool True if the option was deleted, false otherwise. + */ + function delete_site_option($option) + { + } + /** + * Updates the value of an option that was already added for the current network. + * + * @since 2.8.0 + * @since 4.4.0 Modified into wrapper for update_network_option() + * + * @see update_network_option() + * + * @param string $option Name of the option. Expected to not be SQL-escaped. + * @param mixed $value Option value. Expected to not be SQL-escaped. + * @return bool True if the value was updated, false otherwise. + */ + function update_site_option($option, $value) + { + } + /** + * Retrieves a network's option value based on the option name. + * + * @since 4.4.0 + * + * @see get_option() + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $network_id ID of the network. Can be null to default to the current network ID. + * @param string $option Name of the option to retrieve. Expected to not be SQL-escaped. + * @param mixed $default_value Optional. Value to return if the option doesn't exist. Default false. + * @return mixed Value set for the option. + */ + function get_network_option($network_id, $option, $default_value = \false) + { + } + /** + * Adds a new network option. + * + * Existing options will not be updated. + * + * @since 4.4.0 + * + * @see add_option() + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $network_id ID of the network. Can be null to default to the current network ID. + * @param string $option Name of the option to add. Expected to not be SQL-escaped. + * @param mixed $value Option value, can be anything. Expected to not be SQL-escaped. + * @return bool True if the option was added, false otherwise. + */ + function add_network_option($network_id, $option, $value) + { + } + /** + * Removes a network option by name. + * + * @since 4.4.0 + * + * @see delete_option() + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $network_id ID of the network. Can be null to default to the current network ID. + * @param string $option Name of the option to delete. Expected to not be SQL-escaped. + * @return bool True if the option was deleted, false otherwise. + */ + function delete_network_option($network_id, $option) + { + } + /** + * Updates the value of a network option that was already added. + * + * @since 4.4.0 + * + * @see update_option() + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $network_id ID of the network. Can be null to default to the current network ID. + * @param string $option Name of the option. Expected to not be SQL-escaped. + * @param mixed $value Option value. Expected to not be SQL-escaped. + * @return bool True if the value was updated, false otherwise. + */ + function update_network_option($network_id, $option, $value) + { + } + /** + * Deletes a site transient. + * + * @since 2.9.0 + * + * @param string $transient Transient name. Expected to not be SQL-escaped. + * @return bool True if the transient was deleted, false otherwise. + */ + function delete_site_transient($transient) + { + } + /** + * Retrieves the value of a site transient. + * + * If the transient does not exist, does not have a value, or has expired, + * then the return value will be false. + * + * @since 2.9.0 + * + * @see get_transient() + * + * @param string $transient Transient name. Expected to not be SQL-escaped. + * @return mixed Value of transient. + */ + function get_site_transient($transient) + { + } + /** + * Sets/updates the value of a site transient. + * + * You do not need to serialize values. If the value needs to be serialized, + * then it will be serialized before it is set. + * + * @since 2.9.0 + * + * @see set_transient() + * + * @param string $transient Transient name. Expected to not be SQL-escaped. Must be + * 167 characters or fewer in length. + * @param mixed $value Transient value. Expected to not be SQL-escaped. + * @param int $expiration Optional. Time until expiration in seconds. Default 0 (no expiration). + * @return bool True if the value was set, false otherwise. + */ + function set_site_transient($transient, $value, $expiration = 0) + { + } + /** + * Registers default settings available in WordPress. + * + * The settings registered here are primarily useful for the REST API, so this + * does not encompass all settings available in WordPress. + * + * @since 4.7.0 + * @since 6.0.1 The `show_on_front`, `page_on_front`, and `page_for_posts` options were added. + */ + function register_initial_settings() + { + } + /** + * Registers a setting and its data. + * + * @since 2.7.0 + * @since 3.0.0 The `misc` option group was deprecated. + * @since 3.5.0 The `privacy` option group was deprecated. + * @since 4.7.0 `$args` can be passed to set flags on the setting, similar to `register_meta()`. + * @since 5.5.0 `$new_whitelist_options` was renamed to `$new_allowed_options`. + * Please consider writing more inclusive code. + * @since 6.6.0 Added the `label` argument. + * + * @global array $new_allowed_options + * @global array $wp_registered_settings + * + * @param string $option_group A settings group name. Should correspond to an allowed option key name. + * Default allowed option key names include 'general', 'discussion', 'media', + * 'reading', 'writing', and 'options'. + * @param string $option_name The name of an option to sanitize and save. + * @param array $args { + * Data used to describe the setting when registered. + * + * @type string $type The type of data associated with this setting. + * Valid values are 'string', 'boolean', 'integer', 'number', 'array', and 'object'. + * @type string $label A label of the data attached to this setting. + * @type string $description A description of the data attached to this setting. + * @type callable $sanitize_callback A callback function that sanitizes the option's value. + * @type bool|array $show_in_rest Whether data associated with this setting should be included in the REST API. + * When registering complex settings, this argument may optionally be an + * array with a 'schema' key. + * @type mixed $default Default value when calling `get_option()`. + * } + * @phpstan-param array{ + * type?: string, + * label?: string, + * description?: string, + * sanitize_callback?: callable, + * show_in_rest?: bool|array, + * default?: mixed, + * } $args + */ + function register_setting($option_group, $option_name, $args = array()) + { + } + /** + * Unregisters a setting. + * + * @since 2.7.0 + * @since 4.7.0 `$sanitize_callback` was deprecated. The callback from `register_setting()` is now used instead. + * @since 5.5.0 `$new_whitelist_options` was renamed to `$new_allowed_options`. + * Please consider writing more inclusive code. + * + * @global array $new_allowed_options + * @global array $wp_registered_settings + * + * @param string $option_group The settings group name used during registration. + * @param string $option_name The name of the option to unregister. + * @param callable $deprecated Optional. Deprecated. + */ + function unregister_setting($option_group, $option_name, $deprecated = '') + { + } + /** + * Retrieves an array of registered settings. + * + * @since 4.7.0 + * + * @global array $wp_registered_settings + * + * @return array List of registered settings, keyed by option name. + */ + function get_registered_settings() + { + } + /** + * Filters the default value for the option. + * + * For settings which register a default setting in `register_setting()`, this + * function is added as a filter to `default_option_{$option}`. + * + * @since 4.7.0 + * + * @param mixed $default_value Existing default value to return. + * @param string $option Option name. + * @param bool $passed_default Was `get_option()` passed a default value? + * @return mixed Filtered default value. + */ + function filter_default_option($default_value, $option, $passed_default) + { + } + /** + * Returns the values that trigger autoloading from the options table. + * + * @since 6.6.0 + * + * @return string[] The values that trigger autoloading. + */ + function wp_autoload_values_to_autoload() + { + } + /** + * Changes the current user by ID or name. + * + * Set $id to null and specify a name if you do not know a user's ID. + * + * @since 2.0.1 + * @deprecated 3.0.0 Use wp_set_current_user() + * @see wp_set_current_user() + * + * @param int|null $id User ID. + * @param string $name Optional. The user's username + * @return WP_User returns wp_set_current_user() + */ + function set_current_user($id, $name = '') + { + } + /** + * Populate global variables with information about the currently logged in user. + * + * @since 0.71 + * @deprecated 4.5.0 Use wp_get_current_user() + * @see wp_get_current_user() + * + * @return bool|WP_User False on XMLRPC Request and invalid auth cookie, WP_User instance otherwise. + */ + function get_currentuserinfo() + { + } + /** + * Retrieve user info by login name. + * + * @since 0.71 + * @deprecated 3.3.0 Use get_user_by() + * @see get_user_by() + * + * @param string $user_login User's username + * @return bool|object False on failure, User DB row object + */ + function get_userdatabylogin($user_login) + { + } + /** + * Retrieve user info by email. + * + * @since 2.5.0 + * @deprecated 3.3.0 Use get_user_by() + * @see get_user_by() + * + * @param string $email User's email address + * @return bool|object False on failure, User DB row object + */ + function get_user_by_email($email) + { + } + /** + * Sets a cookie for a user who just logged in. This function is deprecated. + * + * @since 1.5.0 + * @deprecated 2.5.0 Use wp_set_auth_cookie() + * @see wp_set_auth_cookie() + * + * @param string $username The user's username + * @param string $password Optional. The user's password + * @param bool $already_md5 Optional. Whether the password has already been through MD5 + * @param string $home Optional. Will be used instead of COOKIEPATH if set + * @param string $siteurl Optional. Will be used instead of SITECOOKIEPATH if set + * @param bool $remember Optional. Remember that the user is logged in + */ + function wp_setcookie($username, $password = '', $already_md5 = \false, $home = '', $siteurl = '', $remember = \false) + { + } + /** + * Clears the authentication cookie, logging the user out. This function is deprecated. + * + * @since 1.5.0 + * @deprecated 2.5.0 Use wp_clear_auth_cookie() + * @see wp_clear_auth_cookie() + */ + function wp_clearcookie() + { + } + /** + * Gets the user cookie login. This function is deprecated. + * + * This function is deprecated and should no longer be extended as it won't be + * used anywhere in WordPress. Also, plugins shouldn't use it either. + * + * @since 2.0.3 + * @deprecated 2.5.0 + * + * @return bool Always returns false + */ + function wp_get_cookie_login() + { + } + /** + * Checks a users login information and logs them in if it checks out. This function is deprecated. + * + * Use the global $error to get the reason why the login failed. If the username + * is blank, no error will be set, so assume blank username on that case. + * + * Plugins extending this function should also provide the global $error and set + * what the error is, so that those checking the global for why there was a + * failure can utilize it later. + * + * @since 1.2.2 + * @deprecated 2.5.0 Use wp_signon() + * @see wp_signon() + * + * @global string $error Error when false is returned + * + * @param string $username User's username + * @param string $password User's password + * @param string $deprecated Not used + * @return bool True on successful check, false on login failure. + */ + function wp_login($username, $password, $deprecated = '') + { + } + /** + * Changes the current user by ID or name. + * + * Set $id to null and specify a name if you do not know a user's ID. + * + * Some WordPress functionality is based on the current user and not based on + * the signed in user. Therefore, it opens the ability to edit and perform + * actions on users who aren't signed in. + * + * @since 2.0.3 + * + * @global WP_User $current_user The current user object which holds the user data. + * + * @param int|null $id User ID. + * @param string $name User's username. + * @return WP_User Current user User object. + */ + function wp_set_current_user($id, $name = '') + { + } + /** + * Retrieves the current user object. + * + * Will set the current user, if the current user is not set. The current user + * will be set to the logged-in person. If no user is logged-in, then it will + * set the current user to 0, which is invalid and won't have any permissions. + * + * @since 2.0.3 + * + * @see _wp_get_current_user() + * @global WP_User $current_user Checks if the current user is set. + * + * @return WP_User Current WP_User instance. + */ + function wp_get_current_user() + { + } + /** + * Retrieves user info by user ID. + * + * @since 0.71 + * + * @param int $user_id User ID + * @return WP_User|false WP_User object on success, false on failure. + */ + function get_userdata($user_id) + { + } + /** + * Retrieves user info by a given field. + * + * @since 2.8.0 + * @since 4.4.0 Added 'ID' as an alias of 'id' for the `$field` parameter. + * + * @global WP_User $current_user The current user object which holds the user data. + * + * @param string $field The field to retrieve the user with. id | ID | slug | email | login. + * @param int|string $value A value for $field. A user ID, slug, email address, or login name. + * @return WP_User|false WP_User object on success, false on failure. + */ + function get_user_by($field, $value) + { + } + /** + * Retrieves info for user lists to prevent multiple queries by get_userdata(). + * + * @since 3.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int[] $user_ids User ID numbers list + * @phpstan-return void + */ + function cache_users($user_ids) + { + } + /** + * Sends an email, similar to PHP's mail function. + * + * A true return value does not automatically mean that the user received the + * email successfully. It just only means that the method used was able to + * process the request without any errors. + * + * The default content type is `text/plain` which does not allow using HTML. + * However, you can set the content type of the email by using the + * {@see 'wp_mail_content_type'} filter. + * + * The default charset is based on the charset used on the blog. The charset can + * be set using the {@see 'wp_mail_charset'} filter. + * + * @since 1.2.1 + * @since 5.5.0 is_email() is used for email validation, + * instead of PHPMailer's default validator. + * + * @global PHPMailer\PHPMailer\PHPMailer $phpmailer + * + * @param string|string[] $to Array or comma-separated list of email addresses to send message. + * @param string $subject Email subject. + * @param string $message Message contents. + * @param string|string[] $headers Optional. Additional headers. + * @param string|string[] $attachments Optional. Paths to files to attach. + * @return bool Whether the email was sent successfully. + */ + function wp_mail($to, $subject, $message, $headers = '', $attachments = array()) + { + } + /** + * Authenticates a user, confirming the login credentials are valid. + * + * @since 2.5.0 + * @since 4.5.0 `$username` now accepts an email address. + * + * @param string $username User's username or email address. + * @param string $password User's password. + * @return WP_User|WP_Error WP_User object if the credentials are valid, + * otherwise WP_Error. + */ + function wp_authenticate($username, $password) + { + } + /** + * Logs the current user out. + * + * @since 2.5.0 + */ + function wp_logout() + { + } + /** + * Validates authentication cookie. + * + * The checks include making sure that the authentication cookie is set and + * pulling in the contents (if $cookie is not used). + * + * Makes sure the cookie is not expired. Verifies the hash in cookie is what is + * should be and compares the two. + * + * @since 2.5.0 + * + * @global int $login_grace_period + * + * @param string $cookie Optional. If used, will validate contents instead of cookie's. + * @param string $scheme Optional. The cookie scheme to use: 'auth', 'secure_auth', or 'logged_in'. + * @return int|false User ID if valid cookie, false if invalid. + * @phpstan-param 'auth'|'secure_auth'|'logged_in' $scheme + */ + function wp_validate_auth_cookie($cookie = '', $scheme = '') + { + } + /** + * Generates authentication cookie contents. + * + * @since 2.5.0 + * @since 4.0.0 The `$token` parameter was added. + * + * @param int $user_id User ID. + * @param int $expiration The time the cookie expires as a UNIX timestamp. + * @param string $scheme Optional. The cookie scheme to use: 'auth', 'secure_auth', or 'logged_in'. + * Default 'auth'. + * @param string $token User's session token to use for this cookie. + * @return string Authentication cookie contents. Empty string if user does not exist. + * @phpstan-param 'auth'|'secure_auth'|'logged_in' $scheme + */ + function wp_generate_auth_cookie($user_id, $expiration, $scheme = 'auth', $token = '') + { + } + /** + * Parses a cookie into its components. + * + * @since 2.7.0 + * @since 4.0.0 The `$token` element was added to the return value. + * + * @param string $cookie Authentication cookie. + * @param string $scheme Optional. The cookie scheme to use: 'auth', 'secure_auth', or 'logged_in'. + * @return string[]|false { + * Authentication cookie components. None of the components should be assumed + * to be valid as they come directly from a client-provided cookie value. If + * the cookie value is malformed, false is returned. + * + * @type string $username User's username. + * @type string $expiration The time the cookie expires as a UNIX timestamp. + * @type string $token User's session token used. + * @type string $hmac The security hash for the cookie. + * @type string $scheme The cookie scheme to use. + * } + * @phpstan-param 'auth'|'secure_auth'|'logged_in' $scheme + * @phpstan-return false|array{ + * username: string, + * expiration: string, + * token: string, + * hmac: string, + * scheme: string, + * } + */ + function wp_parse_auth_cookie($cookie = '', $scheme = '') + { + } + /** + * Sets the authentication cookies based on user ID. + * + * The $remember parameter increases the time that the cookie will be kept. The + * default the cookie is kept without remembering is two days. When $remember is + * set, the cookies will be kept for 14 days or two weeks. + * + * @since 2.5.0 + * @since 4.3.0 Added the `$token` parameter. + * + * @param int $user_id User ID. + * @param bool $remember Whether to remember the user. + * @param bool|string $secure Whether the auth cookie should only be sent over HTTPS. Default is an empty + * string which means the value of `is_ssl()` will be used. + * @param string $token Optional. User's session token to use for this cookie. + * @phpstan-return void + */ + function wp_set_auth_cookie($user_id, $remember = \false, $secure = '', $token = '') + { + } + /** + * Removes all of the cookies associated with authentication. + * + * @since 2.5.0 + * @phpstan-return void + */ + function wp_clear_auth_cookie() + { + } + /** + * Determines whether the current visitor is a logged in user. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 2.0.0 + * + * @return bool True if user is logged in, false if not logged in. + */ + function is_user_logged_in() + { + } + /** + * Checks if a user is logged in, if not it redirects them to the login page. + * + * When this code is called from a page, it checks to see if the user viewing the page is logged in. + * If the user is not logged in, they are redirected to the login page. The user is redirected + * in such a way that, upon logging in, they will be sent directly to the page they were originally + * trying to access. + * + * @since 1.5.0 + * @phpstan-return void + */ + function auth_redirect() + { + } + /** + * Ensures intent by verifying that a user was referred from another admin page with the correct security nonce. + * + * This function ensures the user intends to perform a given action, which helps protect against clickjacking style + * attacks. It verifies intent, not authorization, therefore it does not verify the user's capabilities. This should + * be performed with `current_user_can()` or similar. + * + * If the nonce value is invalid, the function will exit with an "Are You Sure?" style message. + * + * @since 1.2.0 + * @since 2.5.0 The `$query_arg` parameter was added. + * + * @param int|string $action The nonce action. + * @param string $query_arg Optional. Key to check for nonce in `$_REQUEST`. Default '_wpnonce'. + * @return int|false 1 if the nonce is valid and generated between 0-12 hours ago, + * 2 if the nonce is valid and generated between 12-24 hours ago. + * False if the nonce is invalid. + */ + function check_admin_referer($action = -1, $query_arg = '_wpnonce') + { + } + /** + * Verifies the Ajax request to prevent processing requests external of the blog. + * + * @since 2.0.3 + * + * @param int|string $action Action nonce. + * @param false|string $query_arg Optional. Key to check for the nonce in `$_REQUEST` (since 2.5). If false, + * `$_REQUEST` values will be evaluated for '_ajax_nonce', and '_wpnonce' + * (in that order). Default false. + * @param bool $stop Optional. Whether to stop early when the nonce cannot be verified. + * Default true. + * @return int|false 1 if the nonce is valid and generated between 0-12 hours ago, + * 2 if the nonce is valid and generated between 12-24 hours ago. + * False if the nonce is invalid. + */ + function check_ajax_referer($action = -1, $query_arg = \false, $stop = \true) + { + } + /** + * Redirects to another page. + * + * Note: wp_redirect() does not exit automatically, and should almost always be + * followed by a call to `exit;`: + * + * wp_redirect( $url ); + * exit; + * + * Exiting can also be selectively manipulated by using wp_redirect() as a conditional + * in conjunction with the {@see 'wp_redirect'} and {@see 'wp_redirect_status'} filters: + * + * if ( wp_redirect( $url ) ) { + * exit; + * } + * + * @since 1.5.1 + * @since 5.1.0 The `$x_redirect_by` parameter was added. + * @since 5.4.0 On invalid status codes, wp_die() is called. + * + * @global bool $is_IIS + * + * @param string $location The path or URL to redirect to. + * @param int $status Optional. HTTP response status code to use. Default '302' (Moved Temporarily). + * @param string|false $x_redirect_by Optional. The application doing the redirect or false to omit. Default 'WordPress'. + * @return bool False if the redirect was canceled, true otherwise. + */ + function wp_redirect($location, $status = 302, $x_redirect_by = 'WordPress') + { + } + /** + * Sanitizes a URL for use in a redirect. + * + * @since 2.3.0 + * + * @param string $location The path to redirect to. + * @return string Redirect-sanitized URL. + */ + function wp_sanitize_redirect($location) + { + } + /** + * URL encodes UTF-8 characters in a URL. + * + * @ignore + * @since 4.2.0 + * @access private + * + * @see wp_sanitize_redirect() + * + * @param array $matches RegEx matches against the redirect location. + * @return string URL-encoded version of the first RegEx match. + */ + function _wp_sanitize_utf8_in_redirect($matches) + { + } + /** + * Performs a safe (local) redirect, using wp_redirect(). + * + * Checks whether the $location is using an allowed host, if it has an absolute + * path. A plugin can therefore set or remove allowed host(s) to or from the + * list. + * + * If the host is not allowed, then the redirect defaults to wp-admin on the siteurl + * instead. This prevents malicious redirects which redirect to another host, + * but only used in a few places. + * + * Note: wp_safe_redirect() does not exit automatically, and should almost always be + * followed by a call to `exit;`: + * + * wp_safe_redirect( $url ); + * exit; + * + * Exiting can also be selectively manipulated by using wp_safe_redirect() as a conditional + * in conjunction with the {@see 'wp_redirect'} and {@see 'wp_redirect_status'} filters: + * + * if ( wp_safe_redirect( $url ) ) { + * exit; + * } + * + * @since 2.3.0 + * @since 5.1.0 The return value from wp_redirect() is now passed on, and the `$x_redirect_by` parameter was added. + * + * @param string $location The path or URL to redirect to. + * @param int $status Optional. HTTP response status code to use. Default '302' (Moved Temporarily). + * @param string|false $x_redirect_by Optional. The application doing the redirect or false to omit. Default 'WordPress'. + * @return bool False if the redirect was canceled, true otherwise. + */ + function wp_safe_redirect($location, $status = 302, $x_redirect_by = 'WordPress') + { + } + /** + * Validates a URL for use in a redirect. + * + * Checks whether the $location is using an allowed host, if it has an absolute + * path. A plugin can therefore set or remove allowed host(s) to or from the + * list. + * + * If the host is not allowed, then the redirect is to $fallback_url supplied. + * + * @since 2.8.1 + * + * @param string $location The redirect to validate. + * @param string $fallback_url The value to return if $location is not allowed. + * @return string Redirect-sanitized URL. + */ + function wp_validate_redirect($location, $fallback_url = '') + { + } + /** + * Notifies an author (and/or others) of a comment/trackback/pingback on a post. + * + * @since 1.0.0 + * + * @param int|WP_Comment $comment_id Comment ID or WP_Comment object. + * @param string $deprecated Not used. + * @return bool True on completion. False if no email addresses were specified. + */ + function wp_notify_postauthor($comment_id, $deprecated = \null) + { + } + /** + * Notifies the moderator of the site about a new comment that is awaiting approval. + * + * @since 1.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * Uses the {@see 'notify_moderator'} filter to determine whether the site moderator + * should be notified, overriding the site setting. + * + * @param int $comment_id Comment ID. + * @return true Always returns true. + */ + function wp_notify_moderator($comment_id) + { + } + /** + * Notifies the blog admin of a user changing password, normally via email. + * + * @since 2.7.0 + * + * @param WP_User $user User object. + */ + function wp_password_change_notification($user) + { + } + /** + * Emails login credentials to a newly-registered user. + * + * A new user registration notification is also sent to admin email. + * + * @since 2.0.0 + * @since 4.3.0 The `$plaintext_pass` parameter was changed to `$notify`. + * @since 4.3.1 The `$plaintext_pass` parameter was deprecated. `$notify` added as a third parameter. + * @since 4.6.0 The `$notify` parameter accepts 'user' for sending notification only to the user created. + * + * @param int $user_id User ID. + * @param null $deprecated Not used (argument deprecated). + * @param string $notify Optional. Type of notification that should happen. Accepts 'admin' or an empty + * string (admin only), 'user', or 'both' (admin and user). Default empty. + * @phpstan-param 'admin'|'user'|'both' $notify + * @phpstan-return void + */ + function wp_new_user_notification($user_id, $deprecated = \null, $notify = '') + { + } + /** + * Returns the time-dependent variable for nonce creation. + * + * A nonce has a lifespan of two ticks. Nonces in their second tick may be + * updated, e.g. by autosave. + * + * @since 2.5.0 + * @since 6.1.0 Added `$action` argument. + * + * @param string|int $action Optional. The nonce action. Default -1. + * @return float Float value rounded up to the next highest integer. + */ + function wp_nonce_tick($action = -1) + { + } + /** + * Verifies that a correct security nonce was used with time limit. + * + * A nonce is valid for 24 hours (by default). + * + * @since 2.0.3 + * + * @param string $nonce Nonce value that was used for verification, usually via a form field. + * @param string|int $action Should give context to what is taking place and be the same when nonce was created. + * @return int|false 1 if the nonce is valid and generated between 0-12 hours ago, + * 2 if the nonce is valid and generated between 12-24 hours ago. + * False if the nonce is invalid. + */ + function wp_verify_nonce($nonce, $action = -1) + { + } + /** + * Creates a cryptographic token tied to a specific action, user, user session, + * and window of time. + * + * @since 2.0.3 + * @since 4.0.0 Session tokens were integrated with nonce creation. + * + * @param string|int $action Scalar value to add context to the nonce. + * @return string The token. + */ + function wp_create_nonce($action = -1) + { + } + /** + * Returns a salt to add to hashes. + * + * Salts are created using secret keys. Secret keys are located in two places: + * in the database and in the wp-config.php file. The secret key in the database + * is randomly generated and will be appended to the secret keys in wp-config.php. + * + * The secret keys in wp-config.php should be updated to strong, random keys to maximize + * security. Below is an example of how the secret key constants are defined. + * Do not paste this example directly into wp-config.php. Instead, have a + * {@link https://api.wordpress.org/secret-key/1.1/salt/ secret key created} just + * for you. + * + * define('AUTH_KEY', ' Xakm<o xQy rw4EMsLKM-?!T+,PFF})H4lzcW57AF0U@N@< >M%G4Yt>f`z]MON'); + * define('SECURE_AUTH_KEY', 'LzJ}op]mr|6+![P}Ak:uNdJCJZd>(Hx.-Mh#Tz)pCIU#uGEnfFz|f ;;eU%/U^O~'); + * define('LOGGED_IN_KEY', '|i|Ux`9<p-h$aFf(qnT:sDO:D1P^wZ$$/Ra@miTJi9G;ddp_<q}6H1)o|a +&JCM'); + * define('NONCE_KEY', '%:R{[P|,s.KuMltH5}cI;/k<Gx~j!f0I)m_sIyu+&NJZ)-iO>z7X>QYR0Z_XnZ@|'); + * define('AUTH_SALT', 'eZyT)-Naw]F8CwA*VaW#q*|.)g@o}||wf~@C-YSt}(dh_r6EbI#A,y|nU2{B#JBW'); + * define('SECURE_AUTH_SALT', '!=oLUTXh,QW=H `}`L|9/^4-3 STz},T(w}W<I`.JjPi)<Bmf1v,HpGe}T1:Xt7n'); + * define('LOGGED_IN_SALT', '+XSqHc;@Q*K_b|Z?NC[3H!!EONbh.n<+=uKR:>*c(u`g~EJBf#8u#R{mUEZrozmm'); + * define('NONCE_SALT', 'h`GXHhD>SLWVfg1(1(N{;.V!MoE(SfbA_ksP@&`+AycHcAV$+?@3q+rxV{%^VyKT'); + * + * Salting passwords helps against tools which has stored hashed values of + * common dictionary strings. The added values makes it harder to crack. + * + * @since 2.5.0 + * + * @link https://api.wordpress.org/secret-key/1.1/salt/ Create secrets for wp-config.php + * + * @param string $scheme Authentication scheme (auth, secure_auth, logged_in, nonce). + * @return string Salt value + */ + function wp_salt($scheme = 'auth') + { + } + /** + * Gets hash of given string. + * + * @since 2.0.3 + * + * @param string $data Plain text to hash. + * @param string $scheme Authentication scheme (auth, secure_auth, logged_in, nonce). + * @return string Hash of $data. + */ + function wp_hash($data, $scheme = 'auth') + { + } + /** + * Creates a hash (encrypt) of a plain text password. + * + * For integration with other applications, this function can be overwritten to + * instead use the other package password checking algorithm. + * + * @since 2.5.0 + * + * @global PasswordHash $wp_hasher PHPass object. + * + * @param string $password Plain text user password to hash. + * @return string The hash string of the password. + */ + function wp_hash_password($password) + { + } + /** + * Checks the plaintext password against the encrypted Password. + * + * Maintains compatibility between old version and the new cookie authentication + * protocol using PHPass library. The $hash parameter is the encrypted password + * and the function compares the plain text password when encrypted similarly + * against the already encrypted password to see if they match. + * + * For integration with other applications, this function can be overwritten to + * instead use the other package password checking algorithm. + * + * @since 2.5.0 + * + * @global PasswordHash $wp_hasher PHPass object used for checking the password + * against the $hash + $password. + * @uses PasswordHash::CheckPassword + * + * @param string $password Plaintext user's password. + * @param string $hash Hash of the user's password to check against. + * @param string|int $user_id Optional. User ID. + * @return bool False, if the $password does not match the hashed password. + */ + function wp_check_password($password, $hash, $user_id = '') + { + } + /** + * Generates a random password drawn from the defined set of characters. + * + * Uses wp_rand() to create passwords with far less predictability + * than similar native PHP functions like `rand()` or `mt_rand()`. + * + * @since 2.5.0 + * + * @param int $length Optional. The length of password to generate. Default 12. + * @param bool $special_chars Optional. Whether to include standard special characters. + * Default true. + * @param bool $extra_special_chars Optional. Whether to include other special characters. + * Used when generating secret keys and salts. Default false. + * @return string The random password. + */ + function wp_generate_password($length = 12, $special_chars = \true, $extra_special_chars = \false) + { + } + /** + * Generates a random non-negative number. + * + * @since 2.6.2 + * @since 4.4.0 Uses PHP7 random_int() or the random_compat library if available. + * @since 6.1.0 Returns zero instead of a random number if both `$min` and `$max` are zero. + * + * @global string $rnd_value + * + * @param int $min Optional. Lower limit for the generated number. + * Accepts positive integers or zero. Defaults to 0. + * @param int $max Optional. Upper limit for the generated number. + * Accepts positive integers. Defaults to 4294967295. + * @return int A random non-negative number between min and max. + */ + function wp_rand($min = \null, $max = \null) + { + } + /** + * Updates the user's password with a new encrypted one. + * + * For integration with other applications, this function can be overwritten to + * instead use the other package password checking algorithm. + * + * Please note: This function should be used sparingly and is really only meant for single-time + * application. Leveraging this improperly in a plugin or theme could result in an endless loop + * of password resets if precautions are not taken to ensure it does not execute on every page load. + * + * @since 2.5.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $password The plaintext new user password. + * @param int $user_id User ID. + */ + function wp_set_password($password, $user_id) + { + } + /** + * Retrieves the avatar `<img>` tag for a user, email address, MD5 hash, comment, or post. + * + * @since 2.5.0 + * @since 4.2.0 Added the optional `$args` parameter. + * @since 5.5.0 Added the `loading` argument. + * @since 6.1.0 Added the `decoding` argument. + * @since 6.3.0 Added the `fetchpriority` argument. + * + * @param mixed $id_or_email The avatar to retrieve. Accepts a user ID, Gravatar MD5 hash, + * user email, WP_User object, WP_Post object, or WP_Comment object. + * @param int $size Optional. Height and width of the avatar in pixels. Default 96. + * @param string $default_value URL for the default image or a default type. Accepts: + * - '404' (return a 404 instead of a default image) + * - 'retro' (a 8-bit arcade-style pixelated face) + * - 'robohash' (a robot) + * - 'monsterid' (a monster) + * - 'wavatar' (a cartoon face) + * - 'identicon' (the "quilt", a geometric pattern) + * - 'mystery', 'mm', or 'mysteryman' (The Oyster Man) + * - 'blank' (transparent GIF) + * - 'gravatar_default' (the Gravatar logo) + * Default is the value of the 'avatar_default' option, + * with a fallback of 'mystery'. + * @param string $alt Optional. Alternative text to use in the avatar image tag. + * Default empty. + * @param array $args { + * Optional. Extra arguments to retrieve the avatar. + * + * @type int $height Display height of the avatar in pixels. Defaults to $size. + * @type int $width Display width of the avatar in pixels. Defaults to $size. + * @type bool $force_default Whether to always show the default image, never the Gravatar. + * Default false. + * @type string $rating What rating to display avatars up to. Accepts: + * - 'G' (suitable for all audiences) + * - 'PG' (possibly offensive, usually for audiences 13 and above) + * - 'R' (intended for adult audiences above 17) + * - 'X' (even more mature than above) + * Default is the value of the 'avatar_rating' option. + * @type string $scheme URL scheme to use. See set_url_scheme() for accepted values. + * Default null. + * @type array|string $class Array or string of additional classes to add to the img element. + * Default null. + * @type bool $force_display Whether to always show the avatar - ignores the show_avatars option. + * Default false. + * @type string $loading Value for the `loading` attribute. + * Default null. + * @type string $fetchpriority Value for the `fetchpriority` attribute. + * Default null. + * @type string $decoding Value for the `decoding` attribute. + * Default null. + * @type string $extra_attr HTML attributes to insert in the IMG element. Is not sanitized. + * Default empty. + * } + * @return string|false `<img>` tag for the user's avatar. False on failure. + * @phpstan-param array{ + * height?: int, + * width?: int, + * force_default?: bool, + * rating?: string, + * scheme?: string, + * class?: array|string, + * force_display?: bool, + * loading?: string, + * fetchpriority?: string, + * decoding?: string, + * extra_attr?: string, + * } $args + */ + function get_avatar($id_or_email, $size = 96, $default_value = '', $alt = '', $args = \null) + { + } + /** + * Displays a human readable HTML representation of the difference between two strings. + * + * The Diff is available for getting the changes between versions. The output is + * HTML, so the primary use is for displaying the changes. If the two strings + * are equivalent, then an empty string will be returned. + * + * @since 2.6.0 + * + * @see wp_parse_args() Used to change defaults to user defined settings. + * @uses Text_Diff + * @uses WP_Text_Diff_Renderer_Table + * + * @param string $left_string "old" (left) version of string. + * @param string $right_string "new" (right) version of string. + * @param string|array $args { + * Associative array of options to pass to WP_Text_Diff_Renderer_Table(). + * + * @type string $title Titles the diff in a manner compatible + * with the output. Default empty. + * @type string $title_left Change the HTML to the left of the title. + * Default empty. + * @type string $title_right Change the HTML to the right of the title. + * Default empty. + * @type bool $show_split_view True for split view (two columns), false for + * un-split view (single column). Default true. + * } + * @return string Empty string if strings are equivalent or HTML with differences. + * @phpstan-param array{ + * title?: string, + * title_left?: string, + * title_right?: string, + * show_split_view?: bool, + * } $args + */ + function wp_text_diff($left_string, $right_string, $args = \null) + { + } + /** + * Adds a callback function to a filter hook. + * + * WordPress offers filter hooks to allow plugins to modify + * various types of internal data at runtime. + * + * A plugin can modify data by binding a callback to a filter hook. When the filter + * is later applied, each bound callback is run in order of priority, and given + * the opportunity to modify a value by returning a new value. + * + * The following example shows how a callback function is bound to a filter hook. + * + * Note that `$example` is passed to the callback, (maybe) modified, then returned: + * + * function example_callback( $example ) { + * // Maybe modify $example in some way. + * return $example; + * } + * add_filter( 'example_filter', 'example_callback' ); + * + * Bound callbacks can accept from none to the total number of arguments passed as parameters + * in the corresponding apply_filters() call. + * + * In other words, if an apply_filters() call passes four total arguments, callbacks bound to + * it can accept none (the same as 1) of the arguments or up to four. The important part is that + * the `$accepted_args` value must reflect the number of arguments the bound callback *actually* + * opted to accept. If no arguments were accepted by the callback that is considered to be the + * same as accepting 1 argument. For example: + * + * // Filter call. + * $value = apply_filters( 'hook', $value, $arg2, $arg3 ); + * + * // Accepting zero/one arguments. + * function example_callback() { + * ... + * return 'some value'; + * } + * add_filter( 'hook', 'example_callback' ); // Where $priority is default 10, $accepted_args is default 1. + * + * // Accepting two arguments (three possible). + * function example_callback( $value, $arg2 ) { + * ... + * return $maybe_modified_value; + * } + * add_filter( 'hook', 'example_callback', 10, 2 ); // Where $priority is 10, $accepted_args is 2. + * + * *Note:* The function will return true whether or not the callback is valid. + * It is up to you to take care. This is done for optimization purposes, so + * everything is as quick as possible. + * + * @since 0.71 + * + * @global WP_Hook[] $wp_filter A multidimensional array of all hooks and the callbacks hooked to them. + * + * @param string $hook_name The name of the filter to add the callback to. + * @param callable $callback The callback to be run when the filter is applied. + * @param int $priority Optional. Used to specify the order in which the functions + * associated with a particular filter are executed. + * Lower numbers correspond with earlier execution, + * and functions with the same priority are executed + * in the order in which they were added to the filter. Default 10. + * @param int $accepted_args Optional. The number of arguments the function accepts. Default 1. + * @return true Always returns true. + */ + function add_filter($hook_name, $callback, $priority = 10, $accepted_args = 1) + { + } + /** + * Calls the callback functions that have been added to a filter hook. + * + * This function invokes all functions attached to filter hook `$hook_name`. + * It is possible to create new filter hooks by simply calling this function, + * specifying the name of the new hook using the `$hook_name` parameter. + * + * The function also allows for multiple additional arguments to be passed to hooks. + * + * Example usage: + * + * // The filter callback function. + * function example_callback( $string, $arg1, $arg2 ) { + * // (maybe) modify $string. + * return $string; + * } + * add_filter( 'example_filter', 'example_callback', 10, 3 ); + * + * /* + * * Apply the filters by calling the 'example_callback()' function + * * that's hooked onto `example_filter` above. + * * + * * - 'example_filter' is the filter hook. + * * - 'filter me' is the value being filtered. + * * - $arg1 and $arg2 are the additional arguments passed to the callback. + * $value = apply_filters( 'example_filter', 'filter me', $arg1, $arg2 ); + * + * @since 0.71 + * @since 6.0.0 Formalized the existing and already documented `...$args` parameter + * by adding it to the function signature. + * + * @global WP_Hook[] $wp_filter Stores all of the filters and actions. + * @global int[] $wp_filters Stores the number of times each filter was triggered. + * @global string[] $wp_current_filter Stores the list of current filters with the current one last. + * + * @param string $hook_name The name of the filter hook. + * @param mixed $value The value to filter. + * @param mixed ...$args Optional. Additional parameters to pass to the callback functions. + * @return mixed The filtered value after all hooked functions are applied to it. + */ + function apply_filters($hook_name, $value, ...$args) + { + } + /** + * Calls the callback functions that have been added to a filter hook, specifying arguments in an array. + * + * @since 3.0.0 + * + * @see apply_filters() This function is identical, but the arguments passed to the + * functions hooked to `$hook_name` are supplied using an array. + * + * @global WP_Hook[] $wp_filter Stores all of the filters and actions. + * @global int[] $wp_filters Stores the number of times each filter was triggered. + * @global string[] $wp_current_filter Stores the list of current filters with the current one last. + * + * @param string $hook_name The name of the filter hook. + * @param array $args The arguments supplied to the functions hooked to `$hook_name`. + * @return mixed The filtered value after all hooked functions are applied to it. + */ + function apply_filters_ref_array($hook_name, $args) + { + } + /** + * Checks if any filter has been registered for a hook. + * + * When using the `$callback` argument, this function may return a non-boolean value + * that evaluates to false (e.g. 0), so use the `===` operator for testing the return value. + * + * @since 2.5.0 + * + * @global WP_Hook[] $wp_filter Stores all of the filters and actions. + * + * @param string $hook_name The name of the filter hook. + * @param callable|string|array|false $callback Optional. The callback to check for. + * This function can be called unconditionally to speculatively check + * a callback that may or may not exist. Default false. + * @return bool|int If `$callback` is omitted, returns boolean for whether the hook has + * anything registered. When checking a specific function, the priority + * of that hook is returned, or false if the function is not attached. + * @phpstan-return ($callback is false ? bool : false|int) + */ + function has_filter($hook_name, $callback = \false) + { + } + /** + * Removes a callback function from a filter hook. + * + * This can be used to remove default functions attached to a specific filter + * hook and possibly replace them with a substitute. + * + * To remove a hook, the `$callback` and `$priority` arguments must match + * when the hook was added. This goes for both filters and actions. No warning + * will be given on removal failure. + * + * @since 1.2.0 + * + * @global WP_Hook[] $wp_filter Stores all of the filters and actions. + * + * @param string $hook_name The filter hook to which the function to be removed is hooked. + * @param callable|string|array $callback The callback to be removed from running when the filter is applied. + * This function can be called unconditionally to speculatively remove + * a callback that may or may not exist. + * @param int $priority Optional. The exact priority used when adding the original + * filter callback. Default 10. + * @return bool Whether the function existed before it was removed. + */ + function remove_filter($hook_name, $callback, $priority = 10) + { + } + /** + * Removes all of the callback functions from a filter hook. + * + * @since 2.7.0 + * + * @global WP_Hook[] $wp_filter Stores all of the filters and actions. + * + * @param string $hook_name The filter to remove callbacks from. + * @param int|false $priority Optional. The priority number to remove them from. + * Default false. + * @return true Always returns true. + */ + function remove_all_filters($hook_name, $priority = \false) + { + } + /** + * Retrieves the name of the current filter hook. + * + * @since 2.5.0 + * + * @global string[] $wp_current_filter Stores the list of current filters with the current one last + * + * @return string Hook name of the current filter. + */ + function current_filter() + { + } + /** + * Returns whether or not a filter hook is currently being processed. + * + * The function current_filter() only returns the most recent filter being executed. + * did_filter() returns the number of times a filter has been applied during + * the current request. + * + * This function allows detection for any filter currently being executed + * (regardless of whether it's the most recent filter to fire, in the case of + * hooks called from hook callbacks) to be verified. + * + * @since 3.9.0 + * + * @see current_filter() + * @see did_filter() + * @global string[] $wp_current_filter Current filter. + * + * @param string|null $hook_name Optional. Filter hook to check. Defaults to null, + * which checks if any filter is currently being run. + * @return bool Whether the filter is currently in the stack. + */ + function doing_filter($hook_name = \null) + { + } + /** + * Retrieves the number of times a filter has been applied during the current request. + * + * @since 6.1.0 + * + * @global int[] $wp_filters Stores the number of times each filter was triggered. + * + * @param string $hook_name The name of the filter hook. + * @return int The number of times the filter hook has been applied. + */ + function did_filter($hook_name) + { + } + /** + * Adds a callback function to an action hook. + * + * Actions are the hooks that the WordPress core launches at specific points + * during execution, or when specific events occur. Plugins can specify that + * one or more of its PHP functions are executed at these points, using the + * Action API. + * + * @since 1.2.0 + * + * @param string $hook_name The name of the action to add the callback to. + * @param callable $callback The callback to be run when the action is called. + * @param int $priority Optional. Used to specify the order in which the functions + * associated with a particular action are executed. + * Lower numbers correspond with earlier execution, + * and functions with the same priority are executed + * in the order in which they were added to the action. Default 10. + * @param int $accepted_args Optional. The number of arguments the function accepts. Default 1. + * @return true Always returns true. + */ + function add_action($hook_name, $callback, $priority = 10, $accepted_args = 1) + { + } + /** + * Calls the callback functions that have been added to an action hook. + * + * This function invokes all functions attached to action hook `$hook_name`. + * It is possible to create new action hooks by simply calling this function, + * specifying the name of the new hook using the `$hook_name` parameter. + * + * You can pass extra arguments to the hooks, much like you can with `apply_filters()`. + * + * Example usage: + * + * // The action callback function. + * function example_callback( $arg1, $arg2 ) { + * // (maybe) do something with the args. + * } + * add_action( 'example_action', 'example_callback', 10, 2 ); + * + * /* + * * Trigger the actions by calling the 'example_callback()' function + * * that's hooked onto `example_action` above. + * * + * * - 'example_action' is the action hook. + * * - $arg1 and $arg2 are the additional arguments passed to the callback. + * do_action( 'example_action', $arg1, $arg2 ); + * + * @since 1.2.0 + * @since 5.3.0 Formalized the existing and already documented `...$arg` parameter + * by adding it to the function signature. + * + * @global WP_Hook[] $wp_filter Stores all of the filters and actions. + * @global int[] $wp_actions Stores the number of times each action was triggered. + * @global string[] $wp_current_filter Stores the list of current filters with the current one last. + * + * @param string $hook_name The name of the action to be executed. + * @param mixed ...$arg Optional. Additional arguments which are passed on to the + * functions hooked to the action. Default empty. + * @phpstan-return void + */ + function do_action($hook_name, ...$arg) + { + } + /** + * Calls the callback functions that have been added to an action hook, specifying arguments in an array. + * + * @since 2.1.0 + * + * @see do_action() This function is identical, but the arguments passed to the + * functions hooked to `$hook_name` are supplied using an array. + * + * @global WP_Hook[] $wp_filter Stores all of the filters and actions. + * @global int[] $wp_actions Stores the number of times each action was triggered. + * @global string[] $wp_current_filter Stores the list of current filters with the current one last. + * + * @param string $hook_name The name of the action to be executed. + * @param array $args The arguments supplied to the functions hooked to `$hook_name`. + * @phpstan-return void + */ + function do_action_ref_array($hook_name, $args) + { + } + /** + * Checks if any action has been registered for a hook. + * + * When using the `$callback` argument, this function may return a non-boolean value + * that evaluates to false (e.g. 0), so use the `===` operator for testing the return value. + * + * @since 2.5.0 + * + * @see has_filter() This function is an alias of has_filter(). + * + * @param string $hook_name The name of the action hook. + * @param callable|string|array|false $callback Optional. The callback to check for. + * This function can be called unconditionally to speculatively check + * a callback that may or may not exist. Default false. + * @return bool|int If `$callback` is omitted, returns boolean for whether the hook has + * anything registered. When checking a specific function, the priority + * of that hook is returned, or false if the function is not attached. + * @phpstan-return ($callback is false ? bool : false|int) + */ + function has_action($hook_name, $callback = \false) + { + } + /** + * Removes a callback function from an action hook. + * + * This can be used to remove default functions attached to a specific action + * hook and possibly replace them with a substitute. + * + * To remove a hook, the `$callback` and `$priority` arguments must match + * when the hook was added. This goes for both filters and actions. No warning + * will be given on removal failure. + * + * @since 1.2.0 + * + * @param string $hook_name The action hook to which the function to be removed is hooked. + * @param callable|string|array $callback The name of the function which should be removed. + * This function can be called unconditionally to speculatively remove + * a callback that may or may not exist. + * @param int $priority Optional. The exact priority used when adding the original + * action callback. Default 10. + * @return bool Whether the function is removed. + */ + function remove_action($hook_name, $callback, $priority = 10) + { + } + /** + * Removes all of the callback functions from an action hook. + * + * @since 2.7.0 + * + * @param string $hook_name The action to remove callbacks from. + * @param int|false $priority Optional. The priority number to remove them from. + * Default false. + * @return true Always returns true. + */ + function remove_all_actions($hook_name, $priority = \false) + { + } + /** + * Retrieves the name of the current action hook. + * + * @since 3.9.0 + * + * @return string Hook name of the current action. + */ + function current_action() + { + } + /** + * Returns whether or not an action hook is currently being processed. + * + * The function current_action() only returns the most recent action being executed. + * did_action() returns the number of times an action has been fired during + * the current request. + * + * This function allows detection for any action currently being executed + * (regardless of whether it's the most recent action to fire, in the case of + * hooks called from hook callbacks) to be verified. + * + * @since 3.9.0 + * + * @see current_action() + * @see did_action() + * + * @param string|null $hook_name Optional. Action hook to check. Defaults to null, + * which checks if any action is currently being run. + * @return bool Whether the action is currently in the stack. + */ + function doing_action($hook_name = \null) + { + } + /** + * Retrieves the number of times an action has been fired during the current request. + * + * @since 2.1.0 + * + * @global int[] $wp_actions Stores the number of times each action was triggered. + * + * @param string $hook_name The name of the action hook. + * @return int The number of times the action hook has been fired. + */ + function did_action($hook_name) + { + } + /** + * Fires functions attached to a deprecated filter hook. + * + * When a filter hook is deprecated, the apply_filters() call is replaced with + * apply_filters_deprecated(), which triggers a deprecation notice and then fires + * the original filter hook. + * + * Note: the value and extra arguments passed to the original apply_filters() call + * must be passed here to `$args` as an array. For example: + * + * // Old filter. + * return apply_filters( 'wpdocs_filter', $value, $extra_arg ); + * + * // Deprecated. + * return apply_filters_deprecated( 'wpdocs_filter', array( $value, $extra_arg ), '4.9.0', 'wpdocs_new_filter' ); + * + * @since 4.6.0 + * + * @see _deprecated_hook() + * + * @param string $hook_name The name of the filter hook. + * @param array $args Array of additional function arguments to be passed to apply_filters(). + * @param string $version The version of WordPress that deprecated the hook. + * @param string $replacement Optional. The hook that should have been used. Default empty. + * @param string $message Optional. A message regarding the change. Default empty. + * @return mixed The filtered value after all hooked functions are applied to it. + */ + function apply_filters_deprecated($hook_name, $args, $version, $replacement = '', $message = '') + { + } + /** + * Fires functions attached to a deprecated action hook. + * + * When an action hook is deprecated, the do_action() call is replaced with + * do_action_deprecated(), which triggers a deprecation notice and then fires + * the original hook. + * + * @since 4.6.0 + * + * @see _deprecated_hook() + * + * @param string $hook_name The name of the action hook. + * @param array $args Array of additional function arguments to be passed to do_action(). + * @param string $version The version of WordPress that deprecated the hook. + * @param string $replacement Optional. The hook that should have been used. Default empty. + * @param string $message Optional. A message regarding the change. Default empty. + * @phpstan-return void + */ + function do_action_deprecated($hook_name, $args, $version, $replacement = '', $message = '') + { + } + // + // Functions for handling plugins. + // + /** + * Gets the basename of a plugin. + * + * This method extracts the name of a plugin from its filename. + * + * @since 1.5.0 + * + * @global array $wp_plugin_paths + * + * @param string $file The filename of plugin. + * @return string The name of a plugin. + */ + function plugin_basename($file) + { + } + /** + * Register a plugin's real path. + * + * This is used in plugin_basename() to resolve symlinked paths. + * + * @since 3.9.0 + * + * @see wp_normalize_path() + * + * @global array $wp_plugin_paths + * + * @param string $file Known path to the file. + * @return bool Whether the path was able to be registered. + */ + function wp_register_plugin_realpath($file) + { + } + /** + * Get the filesystem directory path (with trailing slash) for the plugin __FILE__ passed in. + * + * @since 2.8.0 + * + * @param string $file The filename of the plugin (__FILE__). + * @return string the filesystem path of the directory that contains the plugin. + */ + function plugin_dir_path($file) + { + } + /** + * Get the URL directory path (with trailing slash) for the plugin __FILE__ passed in. + * + * @since 2.8.0 + * + * @param string $file The filename of the plugin (__FILE__). + * @return string the URL path of the directory that contains the plugin. + */ + function plugin_dir_url($file) + { + } + /** + * Set the activation hook for a plugin. + * + * When a plugin is activated, the action 'activate_PLUGINNAME' hook is + * called. In the name of this hook, PLUGINNAME is replaced with the name + * of the plugin, including the optional subdirectory. For example, when the + * plugin is located in wp-content/plugins/sampleplugin/sample.php, then + * the name of this hook will become 'activate_sampleplugin/sample.php'. + * + * When the plugin consists of only one file and is (as by default) located at + * wp-content/plugins/sample.php the name of this hook will be + * 'activate_sample.php'. + * + * @since 2.0.0 + * + * @param string $file The filename of the plugin including the path. + * @param callable $callback The function hooked to the 'activate_PLUGIN' action. + */ + function register_activation_hook($file, $callback) + { + } + /** + * Sets the deactivation hook for a plugin. + * + * When a plugin is deactivated, the action 'deactivate_PLUGINNAME' hook is + * called. In the name of this hook, PLUGINNAME is replaced with the name + * of the plugin, including the optional subdirectory. For example, when the + * plugin is located in wp-content/plugins/sampleplugin/sample.php, then + * the name of this hook will become 'deactivate_sampleplugin/sample.php'. + * + * When the plugin consists of only one file and is (as by default) located at + * wp-content/plugins/sample.php the name of this hook will be + * 'deactivate_sample.php'. + * + * @since 2.0.0 + * + * @param string $file The filename of the plugin including the path. + * @param callable $callback The function hooked to the 'deactivate_PLUGIN' action. + */ + function register_deactivation_hook($file, $callback) + { + } + /** + * Sets the uninstallation hook for a plugin. + * + * Registers the uninstall hook that will be called when the user clicks on the + * uninstall link that calls for the plugin to uninstall itself. The link won't + * be active unless the plugin hooks into the action. + * + * The plugin should not run arbitrary code outside of functions, when + * registering the uninstall hook. In order to run using the hook, the plugin + * will have to be included, which means that any code laying outside of a + * function will be run during the uninstallation process. The plugin should not + * hinder the uninstallation process. + * + * If the plugin can not be written without running code within the plugin, then + * the plugin should create a file named 'uninstall.php' in the base plugin + * folder. This file will be called, if it exists, during the uninstallation process + * bypassing the uninstall hook. The plugin, when using the 'uninstall.php' + * should always check for the 'WP_UNINSTALL_PLUGIN' constant, before + * executing. + * + * @since 2.7.0 + * + * @param string $file Plugin file. + * @param callable $callback The callback to run when the hook is called. Must be + * a static method or function. + * @phpstan-return void + */ + function register_uninstall_hook($file, $callback) + { + } + /** + * Calls the 'all' hook, which will process the functions hooked into it. + * + * The 'all' hook passes all of the arguments or parameters that were used for + * the hook, which this function was called for. + * + * This function is used internally for apply_filters(), do_action(), and + * do_action_ref_array() and is not meant to be used from outside those + * functions. This function does not check for the existence of the all hook, so + * it will fail unless the all hook exists prior to this function call. + * + * @since 2.5.0 + * @access private + * + * @global WP_Hook[] $wp_filter Stores all of the filters and actions. + * + * @param array $args The collected parameters from the hook that was called. + */ + function _wp_call_all_hook($args) + { + } + /** + * Builds a unique string ID for a hook callback function. + * + * Functions and static method callbacks are just returned as strings and + * shouldn't have any speed penalty. + * + * @link https://core.trac.wordpress.org/ticket/3875 + * + * @since 2.2.3 + * @since 5.3.0 Removed workarounds for spl_object_hash(). + * `$hook_name` and `$priority` are no longer used, + * and the function always returns a string. + * + * @access private + * + * @param string $hook_name Unused. The name of the filter to build ID for. + * @param callable|string|array $callback The callback to generate ID for. The callback may + * or may not exist. + * @param int $priority Unused. The order in which the functions + * associated with a particular action are executed. + * @return string Unique function ID for usage as array key. + */ + function _wp_filter_build_unique_id($hook_name, $callback, $priority) + { + } + /** + * Post format functions. + * + * @package WordPress + * @subpackage Post + */ + /** + * Retrieve the format slug for a post + * + * @since 3.1.0 + * + * @param int|WP_Post|null $post Optional. Post ID or post object. Defaults to the current post in the loop. + * @return string|false The format if successful. False otherwise. + */ + function get_post_format($post = \null) + { + } + /** + * Check if a post has any of the given formats, or any format. + * + * @since 3.1.0 + * + * @param string|string[] $format Optional. The format or formats to check. Default empty array. + * @param WP_Post|int|null $post Optional. The post to check. Defaults to the current post in the loop. + * @return bool True if the post has any of the given formats (or any format, if no format specified), + * false otherwise. + */ + function has_post_format($format = array(), $post = \null) + { + } + /** + * Assign a format to a post + * + * @since 3.1.0 + * + * @param int|WP_Post $post The post for which to assign a format. + * @param string $format A format to assign. Use an empty string or array to remove all formats from the post. + * @return array|WP_Error|false Array of affected term IDs on success. WP_Error on error. + */ + function set_post_format($post, $format) + { + } + /** + * Returns an array of post format slugs to their translated and pretty display versions + * + * @since 3.1.0 + * + * @return string[] Array of post format labels keyed by format slug. + */ + function get_post_format_strings() + { + } + /** + * Retrieves the array of post format slugs. + * + * @since 3.1.0 + * + * @return string[] The array of post format slugs as both keys and values. + */ + function get_post_format_slugs() + { + } + /** + * Returns a pretty, translated version of a post format slug + * + * @since 3.1.0 + * + * @param string $slug A post format slug. + * @return string The translated post format name. + */ + function get_post_format_string($slug) + { + } + /** + * Returns a link to a post format index. + * + * @since 3.1.0 + * + * @param string $format The post format slug. + * @return string|WP_Error|false The post format term link. + */ + function get_post_format_link($format) + { + } + /** + * Filters the request to allow for the format prefix. + * + * @access private + * @since 3.1.0 + * + * @param array $qvs + * @return array + */ + function _post_format_request($qvs) + { + } + /** + * Filters the post format term link to remove the format prefix. + * + * @access private + * @since 3.1.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param string $link + * @param WP_Term $term + * @param string $taxonomy + * @return string + */ + function _post_format_link($link, $term, $taxonomy) + { + } + /** + * Remove the post format prefix from the name property of the term object created by get_term(). + * + * @access private + * @since 3.1.0 + * + * @param object $term + * @return object + */ + function _post_format_get_term($term) + { + } + /** + * Remove the post format prefix from the name property of the term objects created by get_terms(). + * + * @access private + * @since 3.1.0 + * + * @param array $terms + * @param string|array $taxonomies + * @param array $args + * @return array + */ + function _post_format_get_terms($terms, $taxonomies, $args) + { + } + /** + * Remove the post format prefix from the name property of the term objects created by wp_get_object_terms(). + * + * @access private + * @since 3.1.0 + * + * @param array $terms + * @return array + */ + function _post_format_wp_get_object_terms($terms) + { + } + /** + * WordPress Post Template Functions. + * + * Gets content for the current post in the loop. + * + * @package WordPress + * @subpackage Template + */ + /** + * Displays the ID of the current item in the WordPress Loop. + * + * @since 0.71 + */ + function the_ID() + { + } + /** + * Retrieves the ID of the current item in the WordPress Loop. + * + * @since 2.1.0 + * + * @return int|false The ID of the current item in the WordPress Loop. False if $post is not set. + */ + function get_the_ID() + { + } + /** + * Displays or retrieves the current post title with optional markup. + * + * @since 0.71 + * + * @param string $before Optional. Markup to prepend to the title. Default empty. + * @param string $after Optional. Markup to append to the title. Default empty. + * @param bool $display Optional. Whether to echo or return the title. Default true for echo. + * @return void|string Void if `$display` argument is true or the title is empty, + * current post title if `$display` is false. + * @phpstan-return ($display is true ? void : string|void) + */ + function the_title($before = '', $after = '', $display = \true) + { + } + /** + * Sanitizes the current title when retrieving or displaying. + * + * Works like the_title(), except the parameters can be in a string or + * an array. See the function for what can be override in the $args parameter. + * + * The title before it is displayed will have the tags stripped and esc_attr() + * before it is passed to the user or displayed. The default as with the_title(), + * is to display the title. + * + * @since 2.3.0 + * + * @param string|array $args { + * Title attribute arguments. Optional. + * + * @type string $before Markup to prepend to the title. Default empty. + * @type string $after Markup to append to the title. Default empty. + * @type bool $echo Whether to echo or return the title. Default true for echo. + * @type WP_Post $post Current post object to retrieve the title for. + * } + * @return void|string Void if 'echo' argument is true, the title attribute if 'echo' is false. + * @phpstan-param array{ + * before?: string, + * after?: string, + * echo?: bool, + * post?: WP_Post, + * } $args + */ + function the_title_attribute($args = '') + { + } + /** + * Retrieves the post title. + * + * If the post is protected and the visitor is not an admin, then "Protected" + * will be inserted before the post title. If the post is private, then + * "Private" will be inserted before the post title. + * + * @since 0.71 + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. + * @return string + */ + function get_the_title($post = 0) + { + } + /** + * Displays the Post Global Unique Identifier (guid). + * + * The guid will appear to be a link, but should not be used as a link to the + * post. The reason you should not use it as a link, is because of moving the + * blog across domains. + * + * URL is escaped to make it XML-safe. + * + * @since 1.5.0 + * + * @param int|WP_Post $post Optional. Post ID or post object. Default is global $post. + */ + function the_guid($post = 0) + { + } + /** + * Retrieves the Post Global Unique Identifier (guid). + * + * The guid will appear to be a link, but should not be used as an link to the + * post. The reason you should not use it as a link, is because of moving the + * blog across domains. + * + * @since 1.5.0 + * + * @param int|WP_Post $post Optional. Post ID or post object. Default is global $post. + * @return string + */ + function get_the_guid($post = 0) + { + } + /** + * Displays the post content. + * + * @since 0.71 + * + * @param string $more_link_text Optional. Content for when there is more text. + * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default false. + */ + function the_content($more_link_text = \null, $strip_teaser = \false) + { + } + /** + * Retrieves the post content. + * + * @since 0.71 + * @since 5.2.0 Added the `$post` parameter. + * + * @global int $page Page number of a single post/page. + * @global int $more Boolean indicator for whether single post/page is being viewed. + * @global bool $preview Whether post/page is in preview mode. + * @global array $pages Array of all pages in post/page. Each array element contains + * part of the content separated by the `<!--nextpage-->` tag. + * @global int $multipage Boolean indicator for whether multiple pages are in play. + * + * @param string $more_link_text Optional. Content for when there is more text. + * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default false. + * @param WP_Post|object|int $post Optional. WP_Post instance or Post ID/object. Default null. + * @return string + */ + function get_the_content($more_link_text = \null, $strip_teaser = \false, $post = \null) + { + } + /** + * Displays the post excerpt. + * + * @since 0.71 + */ + function the_excerpt() + { + } + /** + * Retrieves the post excerpt. + * + * @since 0.71 + * @since 4.5.0 Introduced the `$post` parameter. + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. + * @return string Post excerpt. + */ + function get_the_excerpt($post = \null) + { + } + /** + * Determines whether the post has a custom excerpt. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 2.3.0 + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. + * @return bool True if the post has a custom excerpt, false otherwise. + */ + function has_excerpt($post = 0) + { + } + /** + * Displays the classes for the post container element. + * + * @since 2.7.0 + * + * @param string|string[] $css_class Optional. One or more classes to add to the class list. + * Default empty. + * @param int|WP_Post $post Optional. Post ID or post object. Defaults to the global `$post`. + */ + function post_class($css_class = '', $post = \null) + { + } + /** + * Retrieves an array of the class names for the post container element. + * + * The class names are many: + * + * - If the post has a post thumbnail, `has-post-thumbnail` is added as a class. + * - If the post is sticky, then the `sticky` class name is added. + * - The class `hentry` is always added to each post. + * - For each taxonomy that the post belongs to, a class will be added of the format + * `{$taxonomy}-{$slug}`, e.g. `category-foo` or `my_custom_taxonomy-bar`. + * The `post_tag` taxonomy is a special case; the class has the `tag-` prefix + * instead of `post_tag-`. + * + * All class names are passed through the filter, {@see 'post_class'}, followed by + * `$css_class` parameter value, with the post ID as the last parameter. + * + * @since 2.7.0 + * @since 4.2.0 Custom taxonomy class names were added. + * + * @param string|string[] $css_class Optional. Space-separated string or array of class names + * to add to the class list. Default empty. + * @param int|WP_Post $post Optional. Post ID or post object. + * @return string[] Array of class names. + */ + function get_post_class($css_class = '', $post = \null) + { + } + /** + * Displays the class names for the body element. + * + * @since 2.8.0 + * + * @param string|string[] $css_class Optional. Space-separated string or array of class names + * to add to the class list. Default empty. + */ + function body_class($css_class = '') + { + } + /** + * Retrieves an array of the class names for the body element. + * + * @since 2.8.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param string|string[] $css_class Optional. Space-separated string or array of class names + * to add to the class list. Default empty. + * @return string[] Array of class names. + */ + function get_body_class($css_class = '') + { + } + /** + * Determines whether the post requires password and whether a correct password has been provided. + * + * @since 2.7.0 + * + * @param int|WP_Post|null $post An optional post. Global $post used if not provided. + * @return bool false if a password is not required or the correct password cookie is present, true otherwise. + */ + function post_password_required($post = \null) + { + } + // + // Page Template Functions for usage in Themes. + // + /** + * The formatted output of a list of pages. + * + * Displays page links for paginated posts (i.e. including the `<!--nextpage-->` + * Quicktag one or more times). This tag must be within The Loop. + * + * @since 1.2.0 + * @since 5.1.0 Added the `aria_current` argument. + * + * @global int $page + * @global int $numpages + * @global int $multipage + * @global int $more + * + * @param string|array $args { + * Optional. Array or string of default arguments. + * + * @type string $before HTML or text to prepend to each link. Default is `<p> Pages:`. + * @type string $after HTML or text to append to each link. Default is `</p>`. + * @type string $link_before HTML or text to prepend to each link, inside the `<a>` tag. + * Also prepended to the current item, which is not linked. Default empty. + * @type string $link_after HTML or text to append to each Pages link inside the `<a>` tag. + * Also appended to the current item, which is not linked. Default empty. + * @type string $aria_current The value for the aria-current attribute. Possible values are 'page', + * 'step', 'location', 'date', 'time', 'true', 'false'. Default is 'page'. + * @type string $next_or_number Indicates whether page numbers should be used. Valid values are number + * and next. Default is 'number'. + * @type string $separator Text between pagination links. Default is ' '. + * @type string $nextpagelink Link text for the next page link, if available. Default is 'Next Page'. + * @type string $previouspagelink Link text for the previous page link, if available. Default is 'Previous Page'. + * @type string $pagelink Format string for page numbers. The % in the parameter string will be + * replaced with the page number, so 'Page %' generates "Page 1", "Page 2", etc. + * Defaults to '%', just the page number. + * @type int|bool $echo Whether to echo or not. Accepts 1|true or 0|false. Default 1|true. + * } + * @return string Formatted output in HTML. + * @phpstan-param array{ + * before?: string, + * after?: string, + * link_before?: string, + * link_after?: string, + * aria_current?: string, + * next_or_number?: string, + * separator?: string, + * nextpagelink?: string, + * previouspagelink?: string, + * pagelink?: string, + * echo?: int|bool, + * } $args + */ + function wp_link_pages($args = '') + { + } + /** + * Helper function for wp_link_pages(). + * + * @since 3.1.0 + * @access private + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param int $i Page number. + * @return string Link. + */ + function _wp_link_page($i) + { + } + // + // Post-meta: Custom per-post fields. + // + /** + * Retrieves post custom meta data field. + * + * @since 1.5.0 + * + * @param string $key Meta data key name. + * @return array|string|false Array of values, or single value if only one element exists. + * False if the key does not exist. + */ + function post_custom($key = '') + { + } + /** + * Displays a list of post custom fields. + * + * @since 1.2.0 + * + * @deprecated 6.0.2 Use get_post_meta() to retrieve post meta and render manually. + */ + function the_meta() + { + } + // + // Pages. + // + /** + * Retrieves or displays a list of pages as a dropdown (select list). + * + * @since 2.1.0 + * @since 4.2.0 The `$value_field` argument was added. + * @since 4.3.0 The `$class` argument was added. + * + * @see get_pages() + * + * @param array|string $args { + * Optional. Array or string of arguments to generate a page dropdown. See get_pages() for additional arguments. + * + * @type int $depth Maximum depth. Default 0. + * @type int $child_of Page ID to retrieve child pages of. Default 0. + * @type int|string $selected Value of the option that should be selected. Default 0. + * @type bool|int $echo Whether to echo or return the generated markup. Accepts 0, 1, + * or their bool equivalents. Default 1. + * @type string $name Value for the 'name' attribute of the select element. + * Default 'page_id'. + * @type string $id Value for the 'id' attribute of the select element. + * @type string $class Value for the 'class' attribute of the select element. Default: none. + * Defaults to the value of `$name`. + * @type string $show_option_none Text to display for showing no pages. Default empty (does not display). + * @type string $show_option_no_change Text to display for "no change" option. Default empty (does not display). + * @type string $option_none_value Value to use when no page is selected. Default empty. + * @type string $value_field Post field used to populate the 'value' attribute of the option + * elements. Accepts any valid post field. Default 'ID'. + * } + * @return string HTML dropdown list of pages. + * @phpstan-param array{ + * depth?: int, + * child_of?: int, + * selected?: int|string, + * echo?: bool|int, + * name?: string, + * id?: string, + * class?: string, + * show_option_none?: string, + * show_option_no_change?: string, + * option_none_value?: string, + * value_field?: string, + * child_of?: int, + * sort_order?: string, + * sort_column?: string, + * hierarchical?: bool, + * exclude?: int[], + * include?: int[], + * meta_key?: string, + * meta_value?: string, + * authors?: string, + * parent?: int, + * exclude_tree?: string|int[], + * number?: int, + * offset?: int, + * post_type?: string, + * post_status?: string|array, + * } $args + */ + function wp_dropdown_pages($args = '') + { + } + /** + * Retrieves or displays a list of pages (or hierarchical post type items) in list (li) format. + * + * @since 1.5.0 + * @since 4.7.0 Added the `item_spacing` argument. + * + * @see get_pages() + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param array|string $args { + * Optional. Array or string of arguments to generate a list of pages. See get_pages() for additional arguments. + * + * @type int $child_of Display only the sub-pages of a single page by ID. Default 0 (all pages). + * @type string $authors Comma-separated list of author IDs. Default empty (all authors). + * @type string $date_format PHP date format to use for the listed pages. Relies on the 'show_date' parameter. + * Default is the value of 'date_format' option. + * @type int $depth Number of levels in the hierarchy of pages to include in the generated list. + * Accepts -1 (any depth), 0 (all pages), 1 (top-level pages only), and n (pages to + * the given n depth). Default 0. + * @type bool $echo Whether or not to echo the list of pages. Default true. + * @type string $exclude Comma-separated list of page IDs to exclude. Default empty. + * @type array $include Comma-separated list of page IDs to include. Default empty. + * @type string $link_after Text or HTML to follow the page link label. Default null. + * @type string $link_before Text or HTML to precede the page link label. Default null. + * @type string $post_type Post type to query for. Default 'page'. + * @type string|array $post_status Comma-separated list or array of post statuses to include. Default 'publish'. + * @type string $show_date Whether to display the page publish or modified date for each page. Accepts + * 'modified' or any other value. An empty value hides the date. Default empty. + * @type string $sort_column Comma-separated list of column names to sort the pages by. Accepts 'post_author', + * 'post_date', 'post_title', 'post_name', 'post_modified', 'post_modified_gmt', + * 'menu_order', 'post_parent', 'ID', 'rand', or 'comment_count'. Default 'post_title'. + * @type string $title_li List heading. Passing a null or empty value will result in no heading, and the list + * will not be wrapped with unordered list `<ul>` tags. Default 'Pages'. + * @type string $item_spacing Whether to preserve whitespace within the menu's HTML. Accepts 'preserve' or 'discard'. + * Default 'preserve'. + * @type Walker $walker Walker instance to use for listing pages. Default empty which results in a + * Walker_Page instance being used. + * } + * @return void|string Void if 'echo' argument is true, HTML list of pages if 'echo' is false. + * @phpstan-param array{ + * child_of?: int, + * authors?: string, + * date_format?: string, + * depth?: int, + * echo?: bool, + * exclude?: string, + * include?: array, + * link_after?: string, + * link_before?: string, + * post_type?: string, + * post_status?: string|array, + * show_date?: string, + * sort_column?: string, + * title_li?: string, + * item_spacing?: string, + * walker?: Walker, + * child_of?: int, + * sort_order?: string, + * sort_column?: string, + * hierarchical?: bool, + * exclude?: int[], + * include?: int[], + * meta_key?: string, + * meta_value?: string, + * authors?: string, + * parent?: int, + * exclude_tree?: string|int[], + * number?: int, + * offset?: int, + * post_type?: string, + * post_status?: string|array, + * } $args + */ + function wp_list_pages($args = '') + { + } + /** + * Displays or retrieves a list of pages with an optional home link. + * + * The arguments are listed below and part of the arguments are for wp_list_pages() function. + * Check that function for more info on those arguments. + * + * @since 2.7.0 + * @since 4.4.0 Added `menu_id`, `container`, `before`, `after`, and `walker` arguments. + * @since 4.7.0 Added the `item_spacing` argument. + * + * @param array|string $args { + * Optional. Array or string of arguments to generate a page menu. See wp_list_pages() for additional arguments. + * + * @type string $sort_column How to sort the list of pages. Accepts post column names. + * Default 'menu_order, post_title'. + * @type string $menu_id ID for the div containing the page list. Default is empty string. + * @type string $menu_class Class to use for the element containing the page list. Default 'menu'. + * @type string $container Element to use for the element containing the page list. Default 'div'. + * @type bool $echo Whether to echo the list or return it. Accepts true (echo) or false (return). + * Default true. + * @type int|bool|string $show_home Whether to display the link to the home page. Can just enter the text + * you'd like shown for the home link. 1|true defaults to 'Home'. + * @type string $link_before The HTML or text to prepend to $show_home text. Default empty. + * @type string $link_after The HTML or text to append to $show_home text. Default empty. + * @type string $before The HTML or text to prepend to the menu. Default is '<ul>'. + * @type string $after The HTML or text to append to the menu. Default is '</ul>'. + * @type string $item_spacing Whether to preserve whitespace within the menu's HTML. Accepts 'preserve' + * or 'discard'. Default 'discard'. + * @type Walker $walker Walker instance to use for listing pages. Default empty which results in a + * Walker_Page instance being used. + * } + * @return void|string Void if 'echo' argument is true, HTML menu if 'echo' is false. + * @phpstan-param array{ + * sort_column?: string, + * menu_id?: string, + * menu_class?: string, + * container?: string, + * echo?: bool, + * show_home?: int|bool|string, + * link_before?: string, + * link_after?: string, + * before?: string, + * after?: string, + * item_spacing?: string, + * walker?: Walker, + * child_of?: int, + * authors?: string, + * date_format?: string, + * depth?: int, + * echo?: bool, + * exclude?: string, + * include?: array, + * link_after?: string, + * link_before?: string, + * post_type?: string, + * post_status?: string|array, + * show_date?: string, + * sort_column?: string, + * title_li?: string, + * item_spacing?: string, + * walker?: Walker, + * child_of?: int, + * sort_order?: string, + * sort_column?: string, + * hierarchical?: bool, + * exclude?: int[], + * include?: int[], + * meta_key?: string, + * meta_value?: string, + * authors?: string, + * parent?: int, + * exclude_tree?: string|int[], + * number?: int, + * offset?: int, + * post_type?: string, + * post_status?: string|array, + * } $args + */ + function wp_page_menu($args = array()) + { + } + // + // Page helpers. + // + /** + * Retrieves HTML list content for page list. + * + * @uses Walker_Page to create HTML list content. + * @since 2.1.0 + * + * @param array $pages + * @param int $depth + * @param int $current_page + * @param array $args + * @return string + */ + function walk_page_tree($pages, $depth, $current_page, $args) + { + } + /** + * Retrieves HTML dropdown (select) content for page list. + * + * @since 2.1.0 + * @since 5.3.0 Formalized the existing `...$args` parameter by adding it + * to the function signature. + * + * @uses Walker_PageDropdown to create HTML dropdown content. + * @see Walker_PageDropdown::walk() for parameters and return description. + * + * @param mixed ...$args Elements array, maximum hierarchical depth and optional additional arguments. + * @return string + */ + function walk_page_dropdown_tree(...$args) + { + } + // + // Attachments. + // + /** + * Displays an attachment page link using an image or icon. + * + * @since 2.0.0 + * + * @param int|WP_Post $post Optional. Post ID or post object. + * @param bool $fullsize Optional. Whether to use full size. Default false. + * @param bool $deprecated Deprecated. Not used. + * @param bool $permalink Optional. Whether to include permalink. Default false. + */ + function the_attachment_link($post = 0, $fullsize = \false, $deprecated = \false, $permalink = \false) + { + } + /** + * Retrieves an attachment page link using an image or icon, if possible. + * + * @since 2.5.0 + * @since 4.4.0 The `$post` parameter can now accept either a post ID or `WP_Post` object. + * + * @param int|WP_Post $post Optional. Post ID or post object. + * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array + * of width and height values in pixels (in that order). Default 'thumbnail'. + * @param bool $permalink Optional. Whether to add permalink to image. Default false. + * @param bool $icon Optional. Whether the attachment is an icon. Default false. + * @param string|false $text Optional. Link text to use. Activated by passing a string, false otherwise. + * Default false. + * @param array|string $attr Optional. Array or string of attributes. Default empty. + * @return string HTML content. + */ + function wp_get_attachment_link($post = 0, $size = 'thumbnail', $permalink = \false, $icon = \false, $text = \false, $attr = '') + { + } + /** + * Wraps attachment in paragraph tag before content. + * + * @since 2.0.0 + * + * @param string $content + * @return string + */ + function prepend_attachment($content) + { + } + // + // Misc. + // + /** + * Retrieves protected post password form content. + * + * @since 1.0.0 + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. + * @return string HTML content for password form for password protected post. + */ + function get_the_password_form($post = 0) + { + } + /** + * Determines whether the current post uses a page template. + * + * This template tag allows you to determine if you are in a page template. + * You can optionally provide a template filename or array of template filenames + * and then the check will be specific to that template. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 2.5.0 + * @since 4.2.0 The `$template` parameter was changed to also accept an array of page templates. + * @since 4.7.0 Now works with any post type, not just pages. + * + * @param string|string[] $template The specific template filename or array of templates to match. + * @return bool True on success, false on failure. + */ + function is_page_template($template = '') + { + } + /** + * Gets the specific template filename for a given post. + * + * @since 3.4.0 + * @since 4.7.0 Now works with any post type, not just pages. + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. + * @return string|false Page template filename. Returns an empty string when the default page template + * is in use. Returns false if the post does not exist. + */ + function get_page_template_slug($post = \null) + { + } + /** + * Retrieves formatted date timestamp of a revision (linked to that revisions's page). + * + * @since 2.6.0 + * + * @param int|WP_Post $revision Revision ID or revision object. + * @param bool $link Optional. Whether to link to revision's page. Default true. + * @return string|false i18n formatted datetimestamp or localized 'Current Revision'. + */ + function wp_post_revision_title($revision, $link = \true) + { + } + /** + * Retrieves formatted date timestamp of a revision (linked to that revisions's page). + * + * @since 3.6.0 + * + * @param int|WP_Post $revision Revision ID or revision object. + * @param bool $link Optional. Whether to link to revision's page. Default true. + * @return string|false gravatar, user, i18n formatted datetimestamp or localized 'Current Revision'. + */ + function wp_post_revision_title_expanded($revision, $link = \true) + { + } + /** + * Displays a list of a post's revisions. + * + * Can output either a UL with edit links or a TABLE with diff interface, and + * restore action links. + * + * @since 2.6.0 + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. + * @param string $type 'all' (default), 'revision' or 'autosave' + * @phpstan-return void + */ + function wp_list_post_revisions($post = 0, $type = 'all') + { + } + /** + * Retrieves the parent post object for the given post. + * + * @since 5.7.0 + * + * @param int|WP_Post|null $post Optional. Post ID or WP_Post object. Default is global $post. + * @return WP_Post|null Parent post object, or null if there isn't one. + */ + function get_post_parent($post = \null) + { + } + /** + * Returns whether the given post has a parent post. + * + * @since 5.7.0 + * + * @param int|WP_Post|null $post Optional. Post ID or WP_Post object. Default is global $post. + * @return bool Whether the post has a parent post. + */ + function has_post_parent($post = \null) + { + } + /** + * WordPress Post Thumbnail Template Functions. + * + * Support for post thumbnails. + * Theme's functions.php must call add_theme_support( 'post-thumbnails' ) to use these. + * + * @package WordPress + * @subpackage Template + */ + /** + * Determines whether a post has an image attached. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 2.9.0 + * @since 4.4.0 `$post` can be a post ID or WP_Post object. + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`. + * @return bool Whether the post has an image attached. + */ + function has_post_thumbnail($post = \null) + { + } + /** + * Retrieves the post thumbnail ID. + * + * @since 2.9.0 + * @since 4.4.0 `$post` can be a post ID or WP_Post object. + * @since 5.5.0 The return value for a non-existing post + * was changed to false instead of an empty string. + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`. + * @return int|false Post thumbnail ID (which can be 0 if the thumbnail is not set), + * or false if the post does not exist. + */ + function get_post_thumbnail_id($post = \null) + { + } + /** + * Displays the post thumbnail. + * + * When a theme adds 'post-thumbnail' support, a special 'post-thumbnail' image size + * is registered, which differs from the 'thumbnail' image size managed via the + * Settings > Media screen. + * + * When using the_post_thumbnail() or related functions, the 'post-thumbnail' image + * size is used by default, though a different size can be specified instead as needed. + * + * @since 2.9.0 + * + * @see get_the_post_thumbnail() + * + * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array of + * width and height values in pixels (in that order). Default 'post-thumbnail'. + * @param string|array $attr Optional. Query string or array of attributes. Default empty. + */ + function the_post_thumbnail($size = 'post-thumbnail', $attr = '') + { + } + /** + * Updates cache for thumbnails in the current loop. + * + * @since 3.2.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param WP_Query $wp_query Optional. A WP_Query instance. Defaults to the $wp_query global. + * @phpstan-return void + */ + function update_post_thumbnail_cache($wp_query = \null) + { + } + /** + * Retrieves the post thumbnail. + * + * When a theme adds 'post-thumbnail' support, a special 'post-thumbnail' image size + * is registered, which differs from the 'thumbnail' image size managed via the + * Settings > Media screen. + * + * When using the_post_thumbnail() or related functions, the 'post-thumbnail' image + * size is used by default, though a different size can be specified instead as needed. + * + * @since 2.9.0 + * @since 4.4.0 `$post` can be a post ID or WP_Post object. + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`. + * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array of + * width and height values in pixels (in that order). Default 'post-thumbnail'. + * @param string|array $attr Optional. Query string or array of attributes. Default empty. + * @return string The post thumbnail image tag. + */ + function get_the_post_thumbnail($post = \null, $size = 'post-thumbnail', $attr = '') + { + } + /** + * Returns the post thumbnail URL. + * + * @since 4.4.0 + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`. + * @param string|int[] $size Optional. Registered image size to retrieve the source for or a flat array + * of height and width dimensions. Default 'post-thumbnail'. + * @return string|false Post thumbnail URL or false if no image is available. If `$size` does not match + * any registered image size, the original image URL will be returned. + */ + function get_the_post_thumbnail_url($post = \null, $size = 'post-thumbnail') + { + } + /** + * Displays the post thumbnail URL. + * + * @since 4.4.0 + * + * @param string|int[] $size Optional. Image size to use. Accepts any valid image size, + * or an array of width and height values in pixels (in that order). + * Default 'post-thumbnail'. + */ + function the_post_thumbnail_url($size = 'post-thumbnail') + { + } + /** + * Returns the post thumbnail caption. + * + * @since 4.6.0 + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`. + * @return string Post thumbnail caption. + */ + function get_the_post_thumbnail_caption($post = \null) + { + } + /** + * Displays the post thumbnail caption. + * + * @since 4.6.0 + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`. + */ + function the_post_thumbnail_caption($post = \null) + { + } + /** + * Core Post API + * + * @package WordPress + * @subpackage Post + */ + // + // Post Type registration. + // + /** + * Creates the initial post types when 'init' action is fired. + * + * See {@see 'init'}. + * + * @since 2.9.0 + */ + function create_initial_post_types() + { + } + /** + * Retrieves attached file path based on attachment ID. + * + * By default the path will go through the {@see 'get_attached_file'} filter, but + * passing `true` to the `$unfiltered` argument will return the file path unfiltered. + * + * The function works by retrieving the `_wp_attached_file` post meta value. + * This is a convenience function to prevent looking up the meta name and provide + * a mechanism for sending the attached filename through a filter. + * + * @since 2.0.0 + * + * @param int $attachment_id Attachment ID. + * @param bool $unfiltered Optional. Whether to skip the {@see 'get_attached_file'} filter. + * Default false. + * @return string|false The file path to where the attached file should be, false otherwise. + */ + function get_attached_file($attachment_id, $unfiltered = \false) + { + } + /** + * Updates attachment file path based on attachment ID. + * + * Used to update the file path of the attachment, which uses post meta name + * '_wp_attached_file' to store the path of the attachment. + * + * @since 2.1.0 + * + * @param int $attachment_id Attachment ID. + * @param string $file File path for the attachment. + * @return bool True on success, false on failure. + */ + function update_attached_file($attachment_id, $file) + { + } + /** + * Returns relative path to an uploaded file. + * + * The path is relative to the current upload dir. + * + * @since 2.9.0 + * @access private + * + * @param string $path Full path to the file. + * @return string Relative path on success, unchanged path on failure. + */ + function _wp_relative_upload_path($path) + { + } + /** + * Retrieves all children of the post parent ID. + * + * Normally, without any enhancements, the children would apply to pages. In the + * context of the inner workings of WordPress, pages, posts, and attachments + * share the same table, so therefore the functionality could apply to any one + * of them. It is then noted that while this function does not work on posts, it + * does not mean that it won't work on posts. It is recommended that you know + * what context you wish to retrieve the children of. + * + * Attachments may also be made the child of a post, so if that is an accurate + * statement (which needs to be verified), it would then be possible to get + * all of the attachments for a post. Attachments have since changed since + * version 2.5, so this is most likely inaccurate, but serves generally as an + * example of what is possible. + * + * The arguments listed as defaults are for this function and also of the + * get_posts() function. The arguments are combined with the get_children defaults + * and are then passed to the get_posts() function, which accepts additional arguments. + * You can replace the defaults in this function, listed below and the additional + * arguments listed in the get_posts() function. + * + * The 'post_parent' is the most important argument and important attention + * needs to be paid to the $args parameter. If you pass either an object or an + * integer (number), then just the 'post_parent' is grabbed and everything else + * is lost. If you don't specify any arguments, then it is assumed that you are + * in The Loop and the post parent will be grabbed for from the current post. + * + * The 'post_parent' argument is the ID to get the children. The 'numberposts' + * is the amount of posts to retrieve that has a default of '-1', which is + * used to get all of the posts. Giving a number higher than 0 will only + * retrieve that amount of posts. + * + * The 'post_type' and 'post_status' arguments can be used to choose what + * criteria of posts to retrieve. The 'post_type' can be anything, but WordPress + * post types are 'post', 'pages', and 'attachments'. The 'post_status' + * argument will accept any post status within the write administration panels. + * + * @since 2.0.0 + * + * @see get_posts() + * @todo Check validity of description. + * + * @global WP_Post $post Global post object. + * + * @param mixed $args Optional. User defined arguments for replacing the defaults. Default empty. + * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which + * correspond to a WP_Post object, an associative array, or a numeric array, + * respectively. Default OBJECT. + * @return WP_Post[]|array[]|int[] Array of post objects, arrays, or IDs, depending on `$output`. + */ + function get_children($args = '', $output = \OBJECT) + { + } + /** + * Gets extended entry info (<!--more-->). + * + * There should not be any space after the second dash and before the word + * 'more'. There can be text or space(s) after the word 'more', but won't be + * referenced. + * + * The returned array has 'main', 'extended', and 'more_text' keys. Main has the text before + * the `<!--more-->`. The 'extended' key has the content after the + * `<!--more-->` comment. The 'more_text' key has the custom "Read More" text. + * + * @since 1.0.0 + * + * @param string $post Post content. + * @return string[] { + * Extended entry info. + * + * @type string $main Content before the more tag. + * @type string $extended Content after the more tag. + * @type string $more_text Custom read more text, or empty string. + * } + * @phpstan-return array{ + * main: string, + * extended: string, + * more_text: string, + * } + */ + function get_extended($post) + { + } + /** + * Retrieves post data given a post ID or post object. + * + * See sanitize_post() for optional $filter values. Also, the parameter + * `$post`, must be given as a variable, since it is passed by reference. + * + * @since 1.5.1 + * + * @global WP_Post $post Global post object. + * + * @param int|WP_Post|null $post Optional. Post ID or post object. `null`, `false`, `0` and other PHP falsey values + * return the current global post inside the loop. A numerically valid post ID that + * points to a non-existent post returns `null`. Defaults to global $post. + * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which + * correspond to a WP_Post object, an associative array, or a numeric array, + * respectively. Default OBJECT. + * @param string $filter Optional. Type of filter to apply. Accepts 'raw', 'edit', 'db', + * or 'display'. Default 'raw'. + * @return WP_Post|array|null Type corresponding to $output on success or null on failure. + * When $output is OBJECT, a `WP_Post` instance is returned. + * @phpstan-param 'raw'|'edit'|'db'|'display' $filter + * @phpstan-param 'OBJECT'|'ARRAY_A'|'ARRAY_N' $output + * @phpstan-return ($post is \WP_Post ? array<array-key, mixed>|\WP_Post : array<array-key, mixed>|\WP_Post|null) & ($output is 'ARRAY_A' ? array<string, mixed>|null : ($output is 'ARRAY_N' ? array<int, mixed>|null : \WP_Post|null)) + */ + function get_post($post = \null, $output = \OBJECT, $filter = 'raw') + { + } + /** + * Retrieves the IDs of the ancestors of a post. + * + * @since 2.5.0 + * + * @param int|WP_Post $post Post ID or post object. + * @return int[] Array of ancestor IDs or empty array if there are none. + */ + function get_post_ancestors($post) + { + } + /** + * Retrieves data from a post field based on Post ID. + * + * Examples of the post field will be, 'post_type', 'post_status', 'post_content', + * etc and based off of the post object property or key names. + * + * The context values are based off of the taxonomy filter functions and + * supported values are found within those functions. + * + * @since 2.3.0 + * @since 4.5.0 The `$post` parameter was made optional. + * + * @see sanitize_post_field() + * + * @param string $field Post field name. + * @param int|WP_Post $post Optional. Post ID or post object. Defaults to global $post. + * @param string $context Optional. How to filter the field. Accepts 'raw', 'edit', 'db', + * or 'display'. Default 'display'. + * @return string The value of the post field on success, empty string on failure. + * @phpstan-param 'raw'|'edit'|'db'|'display' $context + */ + function get_post_field($field, $post = \null, $context = 'display') + { + } + /** + * Retrieves the mime type of an attachment based on the ID. + * + * This function can be used with any post type, but it makes more sense with + * attachments. + * + * @since 2.0.0 + * + * @param int|WP_Post $post Optional. Post ID or post object. Defaults to global $post. + * @return string|false The mime type on success, false on failure. + */ + function get_post_mime_type($post = \null) + { + } + /** + * Retrieves the post status based on the post ID. + * + * If the post ID is of an attachment, then the parent post status will be given + * instead. + * + * @since 2.0.0 + * + * @param int|WP_Post $post Optional. Post ID or post object. Defaults to global $post. + * @return string|false Post status on success, false on failure. + */ + function get_post_status($post = \null) + { + } + /** + * Retrieves all of the WordPress supported post statuses. + * + * Posts have a limited set of valid status values, this provides the + * post_status values and descriptions. + * + * @since 2.5.0 + * + * @return string[] Array of post status labels keyed by their status. + */ + function get_post_statuses() + { + } + /** + * Retrieves all of the WordPress support page statuses. + * + * Pages have a limited set of valid status values, this provides the + * post_status values and descriptions. + * + * @since 2.5.0 + * + * @return string[] Array of page status labels keyed by their status. + */ + function get_page_statuses() + { + } + /** + * Returns statuses for privacy requests. + * + * @since 4.9.6 + * @access private + * + * @return string[] Array of privacy request status labels keyed by their status. + */ + function _wp_privacy_statuses() + { + } + /** + * Registers a post status. Do not use before init. + * + * A simple function for creating or modifying a post status based on the + * parameters given. The function will accept an array (second optional + * parameter), along with a string for the post status name. + * + * Arguments prefixed with an _underscore shouldn't be used by plugins and themes. + * + * @since 3.0.0 + * + * @global stdClass[] $wp_post_statuses Inserts new post status object into the list + * + * @param string $post_status Name of the post status. + * @param array|string $args { + * Optional. Array or string of post status arguments. + * + * @type bool|string $label A descriptive name for the post status marked + * for translation. Defaults to value of $post_status. + * @type array|false $label_count Nooped plural text from _n_noop() to provide the singular + * and plural forms of the label for counts. Default false + * which means the `$label` argument will be used for both + * the singular and plural forms of this label. + * @type bool $exclude_from_search Whether to exclude posts with this post status + * from search results. Default is value of $internal. + * @type bool $_builtin Whether the status is built-in. Core-use only. + * Default false. + * @type bool $public Whether posts of this status should be shown + * in the front end of the site. Default false. + * @type bool $internal Whether the status is for internal use only. + * Default false. + * @type bool $protected Whether posts with this status should be protected. + * Default false. + * @type bool $private Whether posts with this status should be private. + * Default false. + * @type bool $publicly_queryable Whether posts with this status should be publicly- + * queryable. Default is value of $public. + * @type bool $show_in_admin_all_list Whether to include posts in the edit listing for + * their post type. Default is the opposite value + * of $internal. + * @type bool $show_in_admin_status_list Show in the list of statuses with post counts at + * the top of the edit listings, + * e.g. All (12) | Published (9) | My Custom Status (2) + * Default is the opposite value of $internal. + * @type bool $date_floating Whether the post has a floating creation date. + * Default to false. + * } + * @return object + * @phpstan-param array{ + * label?: bool|string, + * label_count?: array|false, + * exclude_from_search?: bool, + * _builtin?: bool, + * public?: bool, + * internal?: bool, + * protected?: bool, + * private?: bool, + * publicly_queryable?: bool, + * show_in_admin_all_list?: bool, + * show_in_admin_status_list?: bool, + * date_floating?: bool, + * } $args + */ + function register_post_status($post_status, $args = array()) + { + } + /** + * Retrieves a post status object by name. + * + * @since 3.0.0 + * + * @global stdClass[] $wp_post_statuses List of post statuses. + * + * @see register_post_status() + * + * @param string $post_status The name of a registered post status. + * @return stdClass|null A post status object. + */ + function get_post_status_object($post_status) + { + } + /** + * Gets a list of post statuses. + * + * @since 3.0.0 + * + * @global stdClass[] $wp_post_statuses List of post statuses. + * + * @see register_post_status() + * + * @param array|string $args Optional. Array or string of post status arguments to compare against + * properties of the global `$wp_post_statuses objects`. Default empty array. + * @param string $output Optional. The type of output to return, either 'names' or 'objects'. Default 'names'. + * @param string $operator Optional. The logical operation to perform. 'or' means only one element + * from the array needs to match; 'and' means all elements must match. + * Default 'and'. + * @return string[]|stdClass[] A list of post status names or objects. + * @phpstan-param 'names'|'objects' $output + * @phpstan-return ($output is 'names' ? array<string, string> : array<string, \stdClass>) + */ + function get_post_stati($args = array(), $output = 'names', $operator = 'and') + { + } + /** + * Determines whether the post type is hierarchical. + * + * A false return value might also mean that the post type does not exist. + * + * @since 3.0.0 + * + * @see get_post_type_object() + * + * @param string $post_type Post type name + * @return bool Whether post type is hierarchical. + */ + function is_post_type_hierarchical($post_type) + { + } + /** + * Determines whether a post type is registered. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 3.0.0 + * + * @see get_post_type_object() + * + * @param string $post_type Post type name. + * @return bool Whether post type is registered. + */ + function post_type_exists($post_type) + { + } + /** + * Retrieves the post type of the current post or of a given post. + * + * @since 2.1.0 + * + * @param int|WP_Post|null $post Optional. Post ID or post object. Default is global $post. + * @return string|false Post type on success, false on failure. + */ + function get_post_type($post = \null) + { + } + /** + * Retrieves a post type object by name. + * + * @since 3.0.0 + * @since 4.6.0 Object returned is now an instance of `WP_Post_Type`. + * + * @global array $wp_post_types List of post types. + * + * @see register_post_type() + * + * @param string $post_type The name of a registered post type. + * @return WP_Post_Type|null WP_Post_Type object if it exists, null otherwise. + */ + function get_post_type_object($post_type) + { + } + /** + * Gets a list of all registered post type objects. + * + * @since 2.9.0 + * + * @global array $wp_post_types List of post types. + * + * @see register_post_type() for accepted arguments. + * + * @param array|string $args Optional. An array of key => value arguments to match against + * the post type objects. Default empty array. + * @param string $output Optional. The type of output to return. Either 'names' + * or 'objects'. Default 'names'. + * @param string $operator Optional. The logical operation to perform. 'or' means only one + * element from the array needs to match; 'and' means all elements + * must match; 'not' means no elements may match. Default 'and'. + * @return string[]|WP_Post_Type[] An array of post type names or objects. + * @phpstan-param 'names'|'objects' $output + * @phpstan-return ($output is 'names' ? array<string, string> : array<string, \WP_Post_Type>) + */ + function get_post_types($args = array(), $output = 'names', $operator = 'and') + { + } + /** + * Registers a post type. + * + * Note: Post type registrations should not be hooked before the + * {@see 'init'} action. Also, any taxonomy connections should be + * registered via the `$taxonomies` argument to ensure consistency + * when hooks such as {@see 'parse_query'} or {@see 'pre_get_posts'} + * are used. + * + * Post types can support any number of built-in core features such + * as meta boxes, custom fields, post thumbnails, post statuses, + * comments, and more. See the `$supports` argument for a complete + * list of supported features. + * + * @since 2.9.0 + * @since 3.0.0 The `show_ui` argument is now enforced on the new post screen. + * @since 4.4.0 The `show_ui` argument is now enforced on the post type listing + * screen and post editing screen. + * @since 4.6.0 Post type object returned is now an instance of `WP_Post_Type`. + * @since 4.7.0 Introduced `show_in_rest`, `rest_base` and `rest_controller_class` + * arguments to register the post type in REST API. + * @since 5.0.0 The `template` and `template_lock` arguments were added. + * @since 5.3.0 The `supports` argument will now accept an array of arguments for a feature. + * @since 5.9.0 The `rest_namespace` argument was added. + * + * @global array $wp_post_types List of post types. + * + * @param string $post_type Post type key. Must not exceed 20 characters and may only contain + * lowercase alphanumeric characters, dashes, and underscores. See sanitize_key(). + * @param array|string $args { + * Array or string of arguments for registering a post type. + * + * @type string $label Name of the post type shown in the menu. Usually plural. + * Default is value of $labels['name']. + * @type string[] $labels An array of labels for this post type. If not set, post + * labels are inherited for non-hierarchical types and page + * labels for hierarchical ones. See get_post_type_labels() for a full + * list of supported labels. + * @type string $description A short descriptive summary of what the post type is. + * Default empty. + * @type bool $public Whether a post type is intended for use publicly either via + * the admin interface or by front-end users. While the default + * settings of $exclude_from_search, $publicly_queryable, $show_ui, + * and $show_in_nav_menus are inherited from $public, each does not + * rely on this relationship and controls a very specific intention. + * Default false. + * @type bool $hierarchical Whether the post type is hierarchical (e.g. page). Default false. + * @type bool $exclude_from_search Whether to exclude posts with this post type from front end search + * results. Default is the opposite value of $public. + * @type bool $publicly_queryable Whether queries can be performed on the front end for the post type + * as part of parse_request(). Endpoints would include: + * * ?post_type={post_type_key} + * * ?{post_type_key}={single_post_slug} + * * ?{post_type_query_var}={single_post_slug} + * If not set, the default is inherited from $public. + * @type bool $show_ui Whether to generate and allow a UI for managing this post type in the + * admin. Default is value of $public. + * @type bool|string $show_in_menu Where to show the post type in the admin menu. To work, $show_ui + * must be true. If true, the post type is shown in its own top level + * menu. If false, no menu is shown. If a string of an existing top + * level menu ('tools.php' or 'edit.php?post_type=page', for example), the + * post type will be placed as a sub-menu of that. + * Default is value of $show_ui. + * @type bool $show_in_nav_menus Makes this post type available for selection in navigation menus. + * Default is value of $public. + * @type bool $show_in_admin_bar Makes this post type available via the admin bar. Default is value + * of $show_in_menu. + * @type bool $show_in_rest Whether to include the post type in the REST API. Set this to true + * for the post type to be available in the block editor. + * @type string $rest_base To change the base URL of REST API route. Default is $post_type. + * @type string $rest_namespace To change the namespace URL of REST API route. Default is wp/v2. + * @type string $rest_controller_class REST API controller class name. Default is 'WP_REST_Posts_Controller'. + * @type string|bool $autosave_rest_controller_class REST API controller class name. Default is 'WP_REST_Autosaves_Controller'. + * @type string|bool $revisions_rest_controller_class REST API controller class name. Default is 'WP_REST_Revisions_Controller'. + * @type bool $late_route_registration A flag to direct the REST API controllers for autosave / revisions + * should be registered before/after the post type controller. + * @type int $menu_position The position in the menu order the post type should appear. To work, + * $show_in_menu must be true. Default null (at the bottom). + * @type string $menu_icon The URL to the icon to be used for this menu. Pass a base64-encoded + * SVG using a data URI, which will be colored to match the color scheme + * -- this should begin with 'data:image/svg+xml;base64,'. Pass the name + * of a Dashicons helper class to use a font icon, e.g. + * 'dashicons-chart-pie'. Pass 'none' to leave div.wp-menu-image empty + * so an icon can be added via CSS. Defaults to use the posts icon. + * @type string|array $capability_type The string to use to build the read, edit, and delete capabilities. + * May be passed as an array to allow for alternative plurals when using + * this argument as a base to construct the capabilities, e.g. + * array('story', 'stories'). Default 'post'. + * @type string[] $capabilities Array of capabilities for this post type. $capability_type is used + * as a base to construct capabilities by default. + * See get_post_type_capabilities(). + * @type bool $map_meta_cap Whether to use the internal default meta capability handling. + * Default false. + * @type array|false $supports Core feature(s) the post type supports. Serves as an alias for calling + * add_post_type_support() directly. Core features include 'title', + * 'editor', 'comments', 'revisions', 'trackbacks', 'author', 'excerpt', + * 'page-attributes', 'thumbnail', 'custom-fields', and 'post-formats'. + * Additionally, the 'revisions' feature dictates whether the post type + * will store revisions, the 'autosave' feature dictates whether the post type + * will be autosaved, and the 'comments' feature dictates whether the + * comments count will show on the edit screen. For backward compatibility reasons, + * adding 'editor' support implies 'autosave' support too. A feature can also be + * specified as an array of arguments to provide additional information + * about supporting that feature. + * Example: `array( 'my_feature', array( 'field' => 'value' ) )`. + * If false, no features will be added. + * Default is an array containing 'title' and 'editor'. + * @type callable $register_meta_box_cb Provide a callback function that sets up the meta boxes for the + * edit form. Do remove_meta_box() and add_meta_box() calls in the + * callback. Default null. + * @type string[] $taxonomies An array of taxonomy identifiers that will be registered for the + * post type. Taxonomies can be registered later with register_taxonomy() + * or register_taxonomy_for_object_type(). + * Default empty array. + * @type bool|string $has_archive Whether there should be post type archives, or if a string, the + * archive slug to use. Will generate the proper rewrite rules if + * $rewrite is enabled. Default false. + * @type bool|array $rewrite { + * Triggers the handling of rewrites for this post type. To prevent rewrite, set to false. + * Defaults to true, using $post_type as slug. To specify rewrite rules, an array can be + * passed with any of these keys: + * + * @type string $slug Customize the permastruct slug. Defaults to $post_type key. + * @type bool $with_front Whether the permastruct should be prepended with WP_Rewrite::$front. + * Default true. + * @type bool $feeds Whether the feed permastruct should be built for this post type. + * Default is value of $has_archive. + * @type bool $pages Whether the permastruct should provide for pagination. Default true. + * @type int $ep_mask Endpoint mask to assign. If not specified and permalink_epmask is set, + * inherits from $permalink_epmask. If not specified and permalink_epmask + * is not set, defaults to EP_PERMALINK. + * } + * @type string|bool $query_var Sets the query_var key for this post type. Defaults to $post_type + * key. If false, a post type cannot be loaded at + * ?{query_var}={post_slug}. If specified as a string, the query + * ?{query_var_string}={post_slug} will be valid. + * @type bool $can_export Whether to allow this post type to be exported. Default true. + * @type bool $delete_with_user Whether to delete posts of this type when deleting a user. + * * If true, posts of this type belonging to the user will be moved + * to Trash when the user is deleted. + * * If false, posts of this type belonging to the user will *not* + * be trashed or deleted. + * * If not set (the default), posts are trashed if post type supports + * the 'author' feature. Otherwise posts are not trashed or deleted. + * Default null. + * @type array $template Array of blocks to use as the default initial state for an editor + * session. Each item should be an array containing block name and + * optional attributes. Default empty array. + * @type string|false $template_lock Whether the block template should be locked if $template is set. + * * If set to 'all', the user is unable to insert new blocks, + * move existing blocks and delete blocks. + * * If set to 'insert', the user is able to move existing blocks + * but is unable to insert new blocks and delete blocks. + * Default false. + * @type bool $_builtin FOR INTERNAL USE ONLY! True if this post type is a native or + * "built-in" post_type. Default false. + * @type string $_edit_link FOR INTERNAL USE ONLY! URL segment to use for edit link of + * this post type. Default 'post.php?post=%d'. + * } + * @return WP_Post_Type|WP_Error The registered post type object on success, + * WP_Error object on failure. + * @phpstan-param array{ + * label?: string, + * labels?: string[], + * description?: string, + * public?: bool, + * hierarchical?: bool, + * exclude_from_search?: bool, + * publicly_queryable?: bool, + * show_ui?: bool, + * show_in_menu?: bool|string, + * show_in_nav_menus?: bool, + * show_in_admin_bar?: bool, + * show_in_rest?: bool, + * rest_base?: string, + * rest_namespace?: string, + * rest_controller_class?: string, + * autosave_rest_controller_class?: string|bool, + * revisions_rest_controller_class?: string|bool, + * late_route_registration?: bool, + * menu_position?: int, + * menu_icon?: string, + * capability_type?: string|array, + * capabilities?: string[], + * map_meta_cap?: bool, + * supports?: array|false, + * register_meta_box_cb?: callable, + * taxonomies?: string[], + * has_archive?: bool|string, + * rewrite?: bool|array{ + * slug?: string, + * with_front?: bool, + * feeds?: bool, + * pages?: bool, + * ep_mask?: int, + * }, + * query_var?: string|bool, + * can_export?: bool, + * delete_with_user?: bool, + * template?: array, + * template_lock?: string|false, + * _builtin?: bool, + * _edit_link?: string, + * } $args + */ + function register_post_type($post_type, $args = array()) + { + } + /** + * Unregisters a post type. + * + * Cannot be used to unregister built-in post types. + * + * @since 4.5.0 + * + * @global array $wp_post_types List of post types. + * + * @param string $post_type Post type to unregister. + * @return true|WP_Error True on success, WP_Error on failure or if the post type doesn't exist. + */ + function unregister_post_type($post_type) + { + } + /** + * Builds an object with all post type capabilities out of a post type object + * + * Post type capabilities use the 'capability_type' argument as a base, if the + * capability is not set in the 'capabilities' argument array or if the + * 'capabilities' argument is not supplied. + * + * The capability_type argument can optionally be registered as an array, with + * the first value being singular and the second plural, e.g. array('story, 'stories') + * Otherwise, an 's' will be added to the value for the plural form. After + * registration, capability_type will always be a string of the singular value. + * + * By default, eight keys are accepted as part of the capabilities array: + * + * - edit_post, read_post, and delete_post are meta capabilities, which are then + * generally mapped to corresponding primitive capabilities depending on the + * context, which would be the post being edited/read/deleted and the user or + * role being checked. Thus these capabilities would generally not be granted + * directly to users or roles. + * + * - edit_posts - Controls whether objects of this post type can be edited. + * - edit_others_posts - Controls whether objects of this type owned by other users + * can be edited. If the post type does not support an author, then this will + * behave like edit_posts. + * - delete_posts - Controls whether objects of this post type can be deleted. + * - publish_posts - Controls publishing objects of this post type. + * - read_private_posts - Controls whether private objects can be read. + * + * These five primitive capabilities are checked in core in various locations. + * There are also six other primitive capabilities which are not referenced + * directly in core, except in map_meta_cap(), which takes the three aforementioned + * meta capabilities and translates them into one or more primitive capabilities + * that must then be checked against the user or role, depending on the context. + * + * - read - Controls whether objects of this post type can be read. + * - delete_private_posts - Controls whether private objects can be deleted. + * - delete_published_posts - Controls whether published objects can be deleted. + * - delete_others_posts - Controls whether objects owned by other users can be + * can be deleted. If the post type does not support an author, then this will + * behave like delete_posts. + * - edit_private_posts - Controls whether private objects can be edited. + * - edit_published_posts - Controls whether published objects can be edited. + * + * These additional capabilities are only used in map_meta_cap(). Thus, they are + * only assigned by default if the post type is registered with the 'map_meta_cap' + * argument set to true (default is false). + * + * @since 3.0.0 + * @since 5.4.0 'delete_posts' is included in default capabilities. + * + * @see register_post_type() + * @see map_meta_cap() + * + * @param object $args Post type registration arguments. + * @return object Object with all the capabilities as member variables. + */ + function get_post_type_capabilities($args) + { + } + /** + * Stores or returns a list of post type meta caps for map_meta_cap(). + * + * @since 3.1.0 + * @access private + * + * @global array $post_type_meta_caps Used to store meta capabilities. + * + * @param string[] $capabilities Post type meta capabilities. + */ + function _post_type_meta_capabilities($capabilities = \null) + { + } + /** + * Builds an object with all post type labels out of a post type object. + * + * Accepted keys of the label array in the post type object: + * + * - `name` - General name for the post type, usually plural. The same and overridden + * by `$post_type_object->label`. Default is 'Posts' / 'Pages'. + * - `singular_name` - Name for one object of this post type. Default is 'Post' / 'Page'. + * - `add_new` - Label for adding a new item. Default is 'Add New Post' / 'Add New Page'. + * - `add_new_item` - Label for adding a new singular item. Default is 'Add New Post' / 'Add New Page'. + * - `edit_item` - Label for editing a singular item. Default is 'Edit Post' / 'Edit Page'. + * - `new_item` - Label for the new item page title. Default is 'New Post' / 'New Page'. + * - `view_item` - Label for viewing a singular item. Default is 'View Post' / 'View Page'. + * - `view_items` - Label for viewing post type archives. Default is 'View Posts' / 'View Pages'. + * - `search_items` - Label for searching plural items. Default is 'Search Posts' / 'Search Pages'. + * - `not_found` - Label used when no items are found. Default is 'No posts found' / 'No pages found'. + * - `not_found_in_trash` - Label used when no items are in the Trash. Default is 'No posts found in Trash' / + * 'No pages found in Trash'. + * - `parent_item_colon` - Label used to prefix parents of hierarchical items. Not used on non-hierarchical + * post types. Default is 'Parent Page:'. + * - `all_items` - Label to signify all items in a submenu link. Default is 'All Posts' / 'All Pages'. + * - `archives` - Label for archives in nav menus. Default is 'Post Archives' / 'Page Archives'. + * - `attributes` - Label for the attributes meta box. Default is 'Post Attributes' / 'Page Attributes'. + * - `insert_into_item` - Label for the media frame button. Default is 'Insert into post' / 'Insert into page'. + * - `uploaded_to_this_item` - Label for the media frame filter. Default is 'Uploaded to this post' / + * 'Uploaded to this page'. + * - `featured_image` - Label for the featured image meta box title. Default is 'Featured image'. + * - `set_featured_image` - Label for setting the featured image. Default is 'Set featured image'. + * - `remove_featured_image` - Label for removing the featured image. Default is 'Remove featured image'. + * - `use_featured_image` - Label in the media frame for using a featured image. Default is 'Use as featured image'. + * - `menu_name` - Label for the menu name. Default is the same as `name`. + * - `filter_items_list` - Label for the table views hidden heading. Default is 'Filter posts list' / + * 'Filter pages list'. + * - `filter_by_date` - Label for the date filter in list tables. Default is 'Filter by date'. + * - `items_list_navigation` - Label for the table pagination hidden heading. Default is 'Posts list navigation' / + * 'Pages list navigation'. + * - `items_list` - Label for the table hidden heading. Default is 'Posts list' / 'Pages list'. + * - `item_published` - Label used when an item is published. Default is 'Post published.' / 'Page published.' + * - `item_published_privately` - Label used when an item is published with private visibility. + * Default is 'Post published privately.' / 'Page published privately.' + * - `item_reverted_to_draft` - Label used when an item is switched to a draft. + * Default is 'Post reverted to draft.' / 'Page reverted to draft.' + * - `item_trashed` - Label used when an item is moved to Trash. Default is 'Post trashed.' / 'Page trashed.' + * - `item_scheduled` - Label used when an item is scheduled for publishing. Default is 'Post scheduled.' / + * 'Page scheduled.' + * - `item_updated` - Label used when an item is updated. Default is 'Post updated.' / 'Page updated.' + * - `item_link` - Title for a navigation link block variation. Default is 'Post Link' / 'Page Link'. + * - `item_link_description` - Description for a navigation link block variation. Default is 'A link to a post.' / + * 'A link to a page.' + * + * Above, the first default value is for non-hierarchical post types (like posts) + * and the second one is for hierarchical post types (like pages). + * + * Note: To set labels used in post type admin notices, see the {@see 'post_updated_messages'} filter. + * + * @since 3.0.0 + * @since 4.3.0 Added the `featured_image`, `set_featured_image`, `remove_featured_image`, + * and `use_featured_image` labels. + * @since 4.4.0 Added the `archives`, `insert_into_item`, `uploaded_to_this_item`, `filter_items_list`, + * `items_list_navigation`, and `items_list` labels. + * @since 4.6.0 Converted the `$post_type` parameter to accept a `WP_Post_Type` object. + * @since 4.7.0 Added the `view_items` and `attributes` labels. + * @since 5.0.0 Added the `item_published`, `item_published_privately`, `item_reverted_to_draft`, + * `item_scheduled`, and `item_updated` labels. + * @since 5.7.0 Added the `filter_by_date` label. + * @since 5.8.0 Added the `item_link` and `item_link_description` labels. + * @since 6.3.0 Added the `item_trashed` label. + * @since 6.4.0 Changed default values for the `add_new` label to include the type of content. + * This matches `add_new_item` and provides more context for better accessibility. + * @since 6.6.0 Added the `template_name` label. + * + * @access private + * + * @param object|WP_Post_Type $post_type_object Post type object. + * @return object Object with all the labels as member variables. + */ + function get_post_type_labels($post_type_object) + { + } + /** + * Builds an object with custom-something object (post type, taxonomy) labels + * out of a custom-something object + * + * @since 3.0.0 + * @access private + * + * @param object $data_object A custom-something object. + * @param array $nohier_vs_hier_defaults Hierarchical vs non-hierarchical default labels. + * @return object Object containing labels for the given custom-something object. + */ + function _get_custom_object_labels($data_object, $nohier_vs_hier_defaults) + { + } + /** + * Adds submenus for post types. + * + * @access private + * @since 3.1.0 + */ + function _add_post_type_submenus() + { + } + /** + * Registers support of certain features for a post type. + * + * All core features are directly associated with a functional area of the edit + * screen, such as the editor or a meta box. Features include: 'title', 'editor', + * 'comments', 'revisions', 'trackbacks', 'author', 'excerpt', 'page-attributes', + * 'thumbnail', 'custom-fields', and 'post-formats'. + * + * Additionally, the 'revisions' feature dictates whether the post type will + * store revisions, the 'autosave' feature dictates whether the post type + * will be autosaved, and the 'comments' feature dictates whether the comments + * count will show on the edit screen. + * + * A third, optional parameter can also be passed along with a feature to provide + * additional information about supporting that feature. + * + * Example usage: + * + * add_post_type_support( 'my_post_type', 'comments' ); + * add_post_type_support( 'my_post_type', array( + * 'author', 'excerpt', + * ) ); + * add_post_type_support( 'my_post_type', 'my_feature', array( + * 'field' => 'value', + * ) ); + * + * @since 3.0.0 + * @since 5.3.0 Formalized the existing and already documented `...$args` parameter + * by adding it to the function signature. + * + * @global array $_wp_post_type_features + * + * @param string $post_type The post type for which to add the feature. + * @param string|array $feature The feature being added, accepts an array of + * feature strings or a single string. + * @param mixed ...$args Optional extra arguments to pass along with certain features. + */ + function add_post_type_support($post_type, $feature, ...$args) + { + } + /** + * Removes support for a feature from a post type. + * + * @since 3.0.0 + * + * @global array $_wp_post_type_features + * + * @param string $post_type The post type for which to remove the feature. + * @param string $feature The feature being removed. + */ + function remove_post_type_support($post_type, $feature) + { + } + /** + * Gets all the post type features + * + * @since 3.4.0 + * + * @global array $_wp_post_type_features + * + * @param string $post_type The post type. + * @return array Post type supports list. + */ + function get_all_post_type_supports($post_type) + { + } + /** + * Checks a post type's support for a given feature. + * + * @since 3.0.0 + * + * @global array $_wp_post_type_features + * + * @param string $post_type The post type being checked. + * @param string $feature The feature being checked. + * @return bool Whether the post type supports the given feature. + */ + function post_type_supports($post_type, $feature) + { + } + /** + * Retrieves a list of post type names that support a specific feature. + * + * @since 4.5.0 + * + * @global array $_wp_post_type_features Post type features + * + * @param array|string $feature Single feature or an array of features the post types should support. + * @param string $operator Optional. The logical operation to perform. 'or' means + * only one element from the array needs to match; 'and' + * means all elements must match; 'not' means no elements may + * match. Default 'and'. + * @return string[] A list of post type names. + */ + function get_post_types_by_support($feature, $operator = 'and') + { + } + /** + * Updates the post type for the post ID. + * + * The page or post cache will be cleaned for the post ID. + * + * @since 2.5.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $post_id Optional. Post ID to change post type. Default 0. + * @param string $post_type Optional. Post type. Accepts 'post' or 'page' to + * name a few. Default 'post'. + * @return int|false Amount of rows changed. Should be 1 for success and 0 for failure. + * @phpstan-param 'post'|'page' $post_type + */ + function set_post_type($post_id = 0, $post_type = 'post') + { + } + /** + * Determines whether a post type is considered "viewable". + * + * For built-in post types such as posts and pages, the 'public' value will be evaluated. + * For all others, the 'publicly_queryable' value will be used. + * + * @since 4.4.0 + * @since 4.5.0 Added the ability to pass a post type name in addition to object. + * @since 4.6.0 Converted the `$post_type` parameter to accept a `WP_Post_Type` object. + * @since 5.9.0 Added `is_post_type_viewable` hook to filter the result. + * + * @param string|WP_Post_Type $post_type Post type name or object. + * @return bool Whether the post type should be considered viewable. + */ + function is_post_type_viewable($post_type) + { + } + /** + * Determines whether a post status is considered "viewable". + * + * For built-in post statuses such as publish and private, the 'public' value will be evaluated. + * For all others, the 'publicly_queryable' value will be used. + * + * @since 5.7.0 + * @since 5.9.0 Added `is_post_status_viewable` hook to filter the result. + * + * @param string|stdClass $post_status Post status name or object. + * @return bool Whether the post status should be considered viewable. + */ + function is_post_status_viewable($post_status) + { + } + /** + * Determines whether a post is publicly viewable. + * + * Posts are considered publicly viewable if both the post status and post type + * are viewable. + * + * @since 5.7.0 + * + * @param int|WP_Post|null $post Optional. Post ID or post object. Defaults to global $post. + * @return bool Whether the post is publicly viewable. + */ + function is_post_publicly_viewable($post = \null) + { + } + /** + * Retrieves an array of the latest posts, or posts matching the given criteria. + * + * For more information on the accepted arguments, see the + * {@link https://developer.wordpress.org/reference/classes/wp_query/ + * WP_Query} documentation in the Developer Handbook. + * + * The `$ignore_sticky_posts` and `$no_found_rows` arguments are ignored by + * this function and both are set to `true`. + * + * The defaults are as follows: + * + * @since 1.2.0 + * + * @see WP_Query + * @see WP_Query::parse_query() + * + * @param array $args { + * Optional. Arguments to retrieve posts. See WP_Query::parse_query() for all available arguments. + * + * @type int $numberposts Total number of posts to retrieve. Is an alias of `$posts_per_page` + * in WP_Query. Accepts -1 for all. Default 5. + * @type int|string $category Category ID or comma-separated list of IDs (this or any children). + * Is an alias of `$cat` in WP_Query. Default 0. + * @type int[] $include An array of post IDs to retrieve, sticky posts will be included. + * Is an alias of `$post__in` in WP_Query. Default empty array. + * @type int[] $exclude An array of post IDs not to retrieve. Default empty array. + * @type bool $suppress_filters Whether to suppress filters. Default true. + * } + * @return WP_Post[]|int[] Array of post objects or post IDs. + * @phpstan-param array{ + * numberposts?: int, + * category?: int|string, + * include?: int[], + * exclude?: int[], + * suppress_filters?: bool, + * attachment_id?: int, + * author?: int|string, + * author_name?: string, + * author__in?: int[], + * author__not_in?: int[], + * cache_results?: bool, + * cat?: int|string, + * category__and?: int[], + * category__in?: int[], + * category__not_in?: int[], + * category_name?: string, + * comment_count?: array|int, + * comment_status?: string, + * comments_per_page?: int, + * date_query?: array, + * day?: int, + * exact?: bool, + * fields?: string, + * hour?: int, + * ignore_sticky_posts?: int|bool, + * m?: int, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * menu_order?: int, + * minute?: int, + * monthnum?: int, + * name?: string, + * nopaging?: bool, + * no_found_rows?: bool, + * offset?: int, + * order?: string, + * orderby?: string|array, + * p?: int, + * page?: int, + * paged?: int, + * page_id?: int, + * pagename?: string, + * perm?: string, + * ping_status?: string, + * post__in?: int[], + * post__not_in?: int[], + * post_mime_type?: string, + * post_name__in?: string[], + * post_parent?: int, + * post_parent__in?: int[], + * post_parent__not_in?: int[], + * post_type?: string|string[], + * post_status?: string|string[], + * posts_per_page?: int, + * posts_per_archive_page?: int, + * s?: string, + * search_columns?: string[], + * second?: int, + * sentence?: bool, + * suppress_filters?: bool, + * tag?: string, + * tag__and?: int[], + * tag__in?: int[], + * tag__not_in?: int[], + * tag_id?: int, + * tag_slug__and?: string[], + * tag_slug__in?: string[], + * tax_query?: array, + * title?: string, + * update_post_meta_cache?: bool, + * update_post_term_cache?: bool, + * update_menu_item_cache?: bool, + * lazy_load_term_meta?: bool, + * w?: int, + * year?: int, + * } $args + */ + function get_posts($args = \null) + { + } + // + // Post meta functions. + // + /** + * Adds a meta field to the given post. + * + * Post meta data is called "Custom Fields" on the Administration Screen. + * + * @since 1.5.0 + * + * @param int $post_id Post ID. + * @param string $meta_key Metadata name. + * @param mixed $meta_value Metadata value. Must be serializable if non-scalar. + * @param bool $unique Optional. Whether the same key should not be added. + * Default false. + * @return int|false Meta ID on success, false on failure. + */ + function add_post_meta($post_id, $meta_key, $meta_value, $unique = \false) + { + } + /** + * Deletes a post meta field for the given post ID. + * + * You can match based on the key, or key and value. Removing based on key and + * value, will keep from removing duplicate metadata with the same key. It also + * allows removing all metadata matching the key, if needed. + * + * @since 1.5.0 + * + * @param int $post_id Post ID. + * @param string $meta_key Metadata name. + * @param mixed $meta_value Optional. Metadata value. If provided, + * rows will only be removed that match the value. + * Must be serializable if non-scalar. Default empty. + * @return bool True on success, false on failure. + */ + function delete_post_meta($post_id, $meta_key, $meta_value = '') + { + } + /** + * Retrieves a post meta field for the given post ID. + * + * @since 1.5.0 + * + * @param int $post_id Post ID. + * @param string $key Optional. The meta key to retrieve. By default, + * returns data for all keys. Default empty. + * @param bool $single Optional. Whether to return a single value. + * This parameter has no effect if `$key` is not specified. + * Default false. + * @return mixed An array of values if `$single` is false. + * The value of the meta field if `$single` is true. + * False for an invalid `$post_id` (non-numeric, zero, or negative value). + * An empty string if a valid but non-existing post ID is passed. + */ + function get_post_meta($post_id, $key = '', $single = \false) + { + } + /** + * Updates a post meta field based on the given post ID. + * + * Use the `$prev_value` parameter to differentiate between meta fields with the + * same key and post ID. + * + * If the meta field for the post does not exist, it will be added and its ID returned. + * + * Can be used in place of add_post_meta(). + * + * @since 1.5.0 + * + * @param int $post_id Post ID. + * @param string $meta_key Metadata key. + * @param mixed $meta_value Metadata value. Must be serializable if non-scalar. + * @param mixed $prev_value Optional. Previous value to check before updating. + * If specified, only update existing metadata entries with + * this value. Otherwise, update all entries. Default empty. + * @return int|bool Meta ID if the key didn't exist, true on successful update, + * false on failure or if the value passed to the function + * is the same as the one that is already in the database. + */ + function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') + { + } + /** + * Deletes everything from post meta matching the given meta key. + * + * @since 2.3.0 + * + * @param string $post_meta_key Key to search for when deleting. + * @return bool Whether the post meta key was deleted from the database. + */ + function delete_post_meta_by_key($post_meta_key) + { + } + /** + * Registers a meta key for posts. + * + * @since 4.9.8 + * + * @param string $post_type Post type to register a meta key for. Pass an empty string + * to register the meta key across all existing post types. + * @param string $meta_key The meta key to register. + * @param array $args Data used to describe the meta key when registered. See + * {@see register_meta()} for a list of supported arguments. + * @return bool True if the meta key was successfully registered, false if not. + * @phpstan-param array{ + * object_subtype?: string, + * type?: string, + * description?: string, + * single?: bool, + * default?: mixed, + * sanitize_callback?: callable, + * auth_callback?: callable, + * show_in_rest?: bool|array, + * revisions_enabled?: bool, + * } $args See register_meta() + */ + function register_post_meta($post_type, $meta_key, array $args) + { + } + /** + * Unregisters a meta key for posts. + * + * @since 4.9.8 + * + * @param string $post_type Post type the meta key is currently registered for. Pass + * an empty string if the meta key is registered across all + * existing post types. + * @param string $meta_key The meta key to unregister. + * @return bool True on success, false if the meta key was not previously registered. + */ + function unregister_post_meta($post_type, $meta_key) + { + } + /** + * Retrieves post meta fields, based on post ID. + * + * The post meta fields are retrieved from the cache where possible, + * so the function is optimized to be called more than once. + * + * @since 1.2.0 + * + * @param int $post_id Optional. Post ID. Default is the ID of the global `$post`. + * @return mixed An array of values. + * False for an invalid `$post_id` (non-numeric, zero, or negative value). + * An empty string if a valid but non-existing post ID is passed. + */ + function get_post_custom($post_id = 0) + { + } + /** + * Retrieves meta field names for a post. + * + * If there are no meta fields, then nothing (null) will be returned. + * + * @since 1.2.0 + * + * @param int $post_id Optional. Post ID. Default is the ID of the global `$post`. + * @return array|void Array of the keys, if retrieved. + */ + function get_post_custom_keys($post_id = 0) + { + } + /** + * Retrieves values for a custom post field. + * + * The parameters must not be considered optional. All of the post meta fields + * will be retrieved and only the meta field key values returned. + * + * @since 1.2.0 + * + * @param string $key Optional. Meta field key. Default empty. + * @param int $post_id Optional. Post ID. Default is the ID of the global `$post`. + * @return array|null Meta field values. + */ + function get_post_custom_values($key = '', $post_id = 0) + { + } + /** + * Determines whether a post is sticky. + * + * Sticky posts should remain at the top of The Loop. If the post ID is not + * given, then The Loop ID for the current post will be used. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 2.7.0 + * + * @param int $post_id Optional. Post ID. Default is the ID of the global `$post`. + * @return bool Whether post is sticky. + */ + function is_sticky($post_id = 0) + { + } + /** + * Sanitizes every post field. + * + * If the context is 'raw', then the post object or array will get minimal + * sanitization of the integer fields. + * + * @since 2.3.0 + * + * @see sanitize_post_field() + * + * @param object|WP_Post|array $post The post object or array + * @param string $context Optional. How to sanitize post fields. + * Accepts 'raw', 'edit', 'db', 'display', + * 'attribute', or 'js'. Default 'display'. + * @return object|WP_Post|array The now sanitized post object or array (will be the + * same type as `$post`). + * @phpstan-param 'raw'|'edit'|'db'|'display'|'attribute'|'js' $context + * @phpstan-template T of array|object + * @phpstan-param T $post + * @phpstan-return T + */ + function sanitize_post($post, $context = 'display') + { + } + /** + * Sanitizes a post field based on context. + * + * Possible context values are: 'raw', 'edit', 'db', 'display', 'attribute' and + * 'js'. The 'display' context is used by default. 'attribute' and 'js' contexts + * are treated like 'display' when calling filters. + * + * @since 2.3.0 + * @since 4.4.0 Like `sanitize_post()`, `$context` defaults to 'display'. + * + * @param string $field The Post Object field name. + * @param mixed $value The Post Object value. + * @param int $post_id Post ID. + * @param string $context Optional. How to sanitize the field. Possible values are 'raw', 'edit', + * 'db', 'display', 'attribute' and 'js'. Default 'display'. + * @return mixed Sanitized value. + * @phpstan-param 'raw'|'edit'|'db'|'display'|'attribute'|'js' $context + */ + function sanitize_post_field($field, $value, $post_id, $context = 'display') + { + } + /** + * Makes a post sticky. + * + * Sticky posts should be displayed at the top of the front page. + * + * @since 2.7.0 + * + * @param int $post_id Post ID. + */ + function stick_post($post_id) + { + } + /** + * Un-sticks a post. + * + * Sticky posts should be displayed at the top of the front page. + * + * @since 2.7.0 + * + * @param int $post_id Post ID. + * @phpstan-return void + */ + function unstick_post($post_id) + { + } + /** + * Returns the cache key for wp_count_posts() based on the passed arguments. + * + * @since 3.9.0 + * @access private + * + * @param string $type Optional. Post type to retrieve count Default 'post'. + * @param string $perm Optional. 'readable' or empty. Default empty. + * @return string The cache key. + */ + function _count_posts_cache_key($type = 'post', $perm = '') + { + } + /** + * Counts number of posts of a post type and if user has permissions to view. + * + * This function provides an efficient method of finding the amount of post's + * type a blog has. Another method is to count the amount of items in + * get_posts(), but that method has a lot of overhead with doing so. Therefore, + * when developing for 2.5+, use this function instead. + * + * The $perm parameter checks for 'readable' value and if the user can read + * private posts, it will display that for the user that is signed in. + * + * @since 2.5.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $type Optional. Post type to retrieve count. Default 'post'. + * @param string $perm Optional. 'readable' or empty. Default empty. + * @return stdClass An object containing the number of posts for each status, + * or an empty object if the post type does not exist. + */ + function wp_count_posts($type = 'post', $perm = '') + { + } + /** + * Counts number of attachments for the mime type(s). + * + * If you set the optional mime_type parameter, then an array will still be + * returned, but will only have the item you are looking for. It does not give + * you the number of attachments that are children of a post. You can get that + * by counting the number of children that post has. + * + * @since 2.5.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string|string[] $mime_type Optional. Array or comma-separated list of + * MIME patterns. Default empty. + * @return stdClass An object containing the attachment counts by mime type. + */ + function wp_count_attachments($mime_type = '') + { + } + /** + * Gets default post mime types. + * + * @since 2.9.0 + * @since 5.3.0 Added the 'Documents', 'Spreadsheets', and 'Archives' mime type groups. + * + * @return array List of post mime types. + */ + function get_post_mime_types() + { + } + /** + * Checks a MIME-Type against a list. + * + * If the `$wildcard_mime_types` parameter is a string, it must be comma separated + * list. If the `$real_mime_types` is a string, it is also comma separated to + * create the list. + * + * @since 2.5.0 + * + * @param string|string[] $wildcard_mime_types Mime types, e.g. `audio/mpeg`, `image` (same as `image/*`), + * or `flash` (same as `*flash*`). + * @param string|string[] $real_mime_types Real post mime type values. + * @return array array(wildcard=>array(real types)). + */ + function wp_match_mime_types($wildcard_mime_types, $real_mime_types) + { + } + /** + * Converts MIME types into SQL. + * + * @since 2.5.0 + * + * @param string|string[] $post_mime_types List of mime types or comma separated string + * of mime types. + * @param string $table_alias Optional. Specify a table alias, if needed. + * Default empty. + * @return string The SQL AND clause for mime searching. + */ + function wp_post_mime_type_where($post_mime_types, $table_alias = '') + { + } + /** + * Trashes or deletes a post or page. + * + * When the post and page is permanently deleted, everything that is tied to + * it is deleted also. This includes comments, post meta fields, and terms + * associated with the post. + * + * The post or page is moved to Trash instead of permanently deleted unless + * Trash is disabled, item is already in the Trash, or $force_delete is true. + * + * @since 1.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * @see wp_delete_attachment() + * @see wp_trash_post() + * + * @param int $post_id Optional. Post ID. Default 0. + * @param bool $force_delete Optional. Whether to bypass Trash and force deletion. + * Default false. + * @return WP_Post|false|null Post data on success, false or null on failure. + */ + function wp_delete_post($post_id = 0, $force_delete = \false) + { + } + /** + * Resets the page_on_front, show_on_front, and page_for_post settings when + * a linked page is deleted or trashed. + * + * Also ensures the post is no longer sticky. + * + * @since 3.7.0 + * @access private + * + * @param int $post_id Post ID. + */ + function _reset_front_page_settings_for_post($post_id) + { + } + /** + * Moves a post or page to the Trash + * + * If Trash is disabled, the post or page is permanently deleted. + * + * @since 2.9.0 + * + * @see wp_delete_post() + * + * @param int $post_id Optional. Post ID. Default is the ID of the global `$post` + * if `EMPTY_TRASH_DAYS` equals true. + * @return WP_Post|false|null Post data on success, false or null on failure. + */ + function wp_trash_post($post_id = 0) + { + } + /** + * Restores a post from the Trash. + * + * @since 2.9.0 + * @since 5.6.0 An untrashed post is now returned to 'draft' status by default, except for + * attachments which are returned to their original 'inherit' status. + * + * @param int $post_id Optional. Post ID. Default is the ID of the global `$post`. + * @return WP_Post|false|null Post data on success, false or null on failure. + */ + function wp_untrash_post($post_id = 0) + { + } + /** + * Moves comments for a post to the Trash. + * + * @since 2.9.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int|WP_Post|null $post Optional. Post ID or post object. Defaults to global $post. + * @return mixed|void False on failure. + */ + function wp_trash_post_comments($post = \null) + { + } + /** + * Restores comments for a post from the Trash. + * + * @since 2.9.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int|WP_Post|null $post Optional. Post ID or post object. Defaults to global $post. + * @return true|void + */ + function wp_untrash_post_comments($post = \null) + { + } + /** + * Retrieves the list of categories for a post. + * + * Compatibility layer for themes and plugins. Also an easy layer of abstraction + * away from the complexity of the taxonomy layer. + * + * @since 2.1.0 + * + * @see wp_get_object_terms() + * + * @param int $post_id Optional. The Post ID. Does not default to the ID of the + * global $post. Default 0. + * @param array $args Optional. Category query parameters. Default empty array. + * See WP_Term_Query::__construct() for supported arguments. + * @return array|WP_Error List of categories. If the `$fields` argument passed via `$args` is 'all' or + * 'all_with_object_id', an array of WP_Term objects will be returned. If `$fields` + * is 'ids', an array of category IDs. If `$fields` is 'names', an array of category names. + * WP_Error object if 'category' taxonomy doesn't exist. + * @phpstan-param array{ + * taxonomy?: string|string[], + * object_ids?: int|int[], + * orderby?: string, + * order?: string, + * hide_empty?: bool|int, + * include?: int[]|string, + * exclude?: int[]|string, + * exclude_tree?: int[]|string, + * number?: int|string, + * offset?: int, + * fields?: string, + * count?: bool, + * name?: string|string[], + * slug?: string|string[], + * term_taxonomy_id?: int|int[], + * hierarchical?: bool, + * search?: string, + * name__like?: string, + * description__like?: string, + * pad_counts?: bool, + * get?: string, + * child_of?: int, + * parent?: int, + * childless?: bool, + * cache_domain?: string, + * cache_results?: bool, + * update_term_meta_cache?: bool, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * } $args See WP_Term_Query::__construct() + */ + function wp_get_post_categories($post_id = 0, $args = array()) + { + } + /** + * Retrieves the tags for a post. + * + * There is only one default for this function, called 'fields' and by default + * is set to 'all'. There are other defaults that can be overridden in + * wp_get_object_terms(). + * + * @since 2.3.0 + * + * @param int $post_id Optional. The Post ID. Does not default to the ID of the + * global $post. Default 0. + * @param array $args Optional. Tag query parameters. Default empty array. + * See WP_Term_Query::__construct() for supported arguments. + * @return array|WP_Error Array of WP_Term objects on success or empty array if no tags were found. + * WP_Error object if 'post_tag' taxonomy doesn't exist. + * @phpstan-param array{ + * taxonomy?: string|string[], + * object_ids?: int|int[], + * orderby?: string, + * order?: string, + * hide_empty?: bool|int, + * include?: int[]|string, + * exclude?: int[]|string, + * exclude_tree?: int[]|string, + * number?: int|string, + * offset?: int, + * fields?: string, + * count?: bool, + * name?: string|string[], + * slug?: string|string[], + * term_taxonomy_id?: int|int[], + * hierarchical?: bool, + * search?: string, + * name__like?: string, + * description__like?: string, + * pad_counts?: bool, + * get?: string, + * child_of?: int, + * parent?: int, + * childless?: bool, + * cache_domain?: string, + * cache_results?: bool, + * update_term_meta_cache?: bool, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * } $args See WP_Term_Query::__construct() + */ + function wp_get_post_tags($post_id = 0, $args = array()) + { + } + /** + * Retrieves the terms for a post. + * + * @since 2.8.0 + * + * @param int $post_id Optional. The Post ID. Does not default to the ID of the + * global $post. Default 0. + * @param string|string[] $taxonomy Optional. The taxonomy slug or array of slugs for which + * to retrieve terms. Default 'post_tag'. + * @param array $args { + * Optional. Term query parameters. See WP_Term_Query::__construct() for supported arguments. + * + * @type string $fields Term fields to retrieve. Default 'all'. + * } + * @return array|WP_Error Array of WP_Term objects on success or empty array if no terms were found. + * WP_Error object if `$taxonomy` doesn't exist. + * @phpstan-param array{ + * fields?: string, + * taxonomy?: string|string[], + * object_ids?: int|int[], + * orderby?: string, + * order?: string, + * hide_empty?: bool|int, + * include?: int[]|string, + * exclude?: int[]|string, + * exclude_tree?: int[]|string, + * number?: int|string, + * offset?: int, + * fields?: string, + * count?: bool, + * name?: string|string[], + * slug?: string|string[], + * term_taxonomy_id?: int|int[], + * hierarchical?: bool, + * search?: string, + * name__like?: string, + * description__like?: string, + * pad_counts?: bool, + * get?: string, + * child_of?: int, + * parent?: int, + * childless?: bool, + * cache_domain?: string, + * cache_results?: bool, + * update_term_meta_cache?: bool, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * } $args + */ + function wp_get_post_terms($post_id = 0, $taxonomy = 'post_tag', $args = array()) + { + } + /** + * Retrieves a number of recent posts. + * + * @since 1.0.0 + * + * @see get_posts() + * + * @param array $args Optional. Arguments to retrieve posts. Default empty array. + * @param string $output Optional. The required return type. One of OBJECT or ARRAY_A, which + * correspond to a WP_Post object or an associative array, respectively. + * Default ARRAY_A. + * @return array|false Array of recent posts, where the type of each element is determined + * by the `$output` parameter. Empty array on failure. + */ + function wp_get_recent_posts($args = array(), $output = \ARRAY_A) + { + } + /** + * Inserts or update a post. + * + * If the $postarr parameter has 'ID' set to a value, then post will be updated. + * + * You can set the post date manually, by setting the values for 'post_date' + * and 'post_date_gmt' keys. You can close the comments or open the comments by + * setting the value for 'comment_status' key. + * + * @since 1.0.0 + * @since 2.6.0 Added the `$wp_error` parameter to allow a WP_Error to be returned on failure. + * @since 4.2.0 Support was added for encoding emoji in the post title, content, and excerpt. + * @since 4.4.0 A 'meta_input' array can now be passed to `$postarr` to add post meta data. + * @since 5.6.0 Added the `$fire_after_hooks` parameter. + * + * @see sanitize_post() + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array $postarr { + * An array of elements that make up a post to update or insert. + * + * @type int $ID The post ID. If equal to something other than 0, + * the post with that ID will be updated. Default 0. + * @type int $post_author The ID of the user who added the post. Default is + * the current user ID. + * @type string $post_date The date of the post. Default is the current time. + * @type string $post_date_gmt The date of the post in the GMT timezone. Default is + * the value of `$post_date`. + * @type string $post_content The post content. Default empty. + * @type string $post_content_filtered The filtered post content. Default empty. + * @type string $post_title The post title. Default empty. + * @type string $post_excerpt The post excerpt. Default empty. + * @type string $post_status The post status. Default 'draft'. + * @type string $post_type The post type. Default 'post'. + * @type string $comment_status Whether the post can accept comments. Accepts 'open' or 'closed'. + * Default is the value of 'default_comment_status' option. + * @type string $ping_status Whether the post can accept pings. Accepts 'open' or 'closed'. + * Default is the value of 'default_ping_status' option. + * @type string $post_password The password to access the post. Default empty. + * @type string $post_name The post name. Default is the sanitized post title + * when creating a new post. + * @type string $to_ping Space or carriage return-separated list of URLs to ping. + * Default empty. + * @type string $pinged Space or carriage return-separated list of URLs that have + * been pinged. Default empty. + * @type int $post_parent Set this for the post it belongs to, if any. Default 0. + * @type int $menu_order The order the post should be displayed in. Default 0. + * @type string $post_mime_type The mime type of the post. Default empty. + * @type string $guid Global Unique ID for referencing the post. Default empty. + * @type int $import_id The post ID to be used when inserting a new post. + * If specified, must not match any existing post ID. Default 0. + * @type int[] $post_category Array of category IDs. + * Defaults to value of the 'default_category' option. + * @type array $tags_input Array of tag names, slugs, or IDs. Default empty. + * @type array $tax_input An array of taxonomy terms keyed by their taxonomy name. + * If the taxonomy is hierarchical, the term list needs to be + * either an array of term IDs or a comma-separated string of IDs. + * If the taxonomy is non-hierarchical, the term list can be an array + * that contains term names or slugs, or a comma-separated string + * of names or slugs. This is because, in hierarchical taxonomy, + * child terms can have the same names with different parent terms, + * so the only way to connect them is using ID. Default empty. + * @type array $meta_input Array of post meta values keyed by their post meta key. Default empty. + * @type string $page_template Page template to use. + * } + * @param bool $wp_error Optional. Whether to return a WP_Error on failure. Default false. + * @param bool $fire_after_hooks Optional. Whether to fire the after insert hooks. Default true. + * @return int|WP_Error The post ID on success. The value 0 or WP_Error on failure. + * @phpstan-param array{ + * ID?: int, + * post_author?: int, + * post_date?: string, + * post_date_gmt?: string, + * post_content?: string, + * post_content_filtered?: string, + * post_title?: string, + * post_excerpt?: string, + * post_status?: string, + * post_type?: string, + * comment_status?: string, + * ping_status?: string, + * post_password?: string, + * post_name?: string, + * to_ping?: string, + * pinged?: string, + * post_parent?: int, + * menu_order?: int, + * post_mime_type?: string, + * guid?: string, + * import_id?: int, + * post_category?: int[], + * tags_input?: array, + * tax_input?: array, + * meta_input?: array, + * page_template?: string, + * } $postarr + * @phpstan-return ($wp_error is false ? 0|positive-int : positive-int|\WP_Error) + */ + function wp_insert_post($postarr, $wp_error = \false, $fire_after_hooks = \true) + { + } + /** + * Updates a post with new post data. + * + * The date does not have to be set for drafts. You can set the date and it will + * not be overridden. + * + * @since 1.0.0 + * @since 3.5.0 Added the `$wp_error` parameter to allow a WP_Error to be returned on failure. + * @since 5.6.0 Added the `$fire_after_hooks` parameter. + * + * @param array|object $postarr Optional. Post data. Arrays are expected to be escaped, + * objects are not. See wp_insert_post() for accepted arguments. + * Default array. + * @param bool $wp_error Optional. Whether to return a WP_Error on failure. Default false. + * @param bool $fire_after_hooks Optional. Whether to fire the after insert hooks. Default true. + * @return int|WP_Error The post ID on success. The value 0 or WP_Error on failure. + * @phpstan-param array{ + * ID?: int, + * post_author?: int, + * post_date?: string, + * post_date_gmt?: string, + * post_content?: string, + * post_content_filtered?: string, + * post_title?: string, + * post_excerpt?: string, + * post_status?: string, + * post_type?: string, + * comment_status?: string, + * ping_status?: string, + * post_password?: string, + * post_name?: string, + * to_ping?: string, + * pinged?: string, + * post_parent?: int, + * menu_order?: int, + * post_mime_type?: string, + * guid?: string, + * import_id?: int, + * post_category?: int[], + * tags_input?: array, + * tax_input?: array, + * meta_input?: array, + * page_template?: string, + * } $postarr See wp_insert_post() + * @phpstan-return ($wp_error is false ? 0|positive-int : positive-int|\WP_Error) + */ + function wp_update_post($postarr = array(), $wp_error = \false, $fire_after_hooks = \true) + { + } + /** + * Publishes a post by transitioning the post status. + * + * @since 2.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int|WP_Post $post Post ID or post object. + * @phpstan-return void + */ + function wp_publish_post($post) + { + } + /** + * Publishes future post and make sure post ID has future post status. + * + * Invoked by cron 'publish_future_post' event. This safeguard prevents cron + * from publishing drafts, etc. + * + * @since 2.5.0 + * + * @param int|WP_Post $post Post ID or post object. + * @phpstan-return void + */ + function check_and_publish_future_post($post) + { + } + /** + * Uses wp_checkdate to return a valid Gregorian-calendar value for post_date. + * If post_date is not provided, this first checks post_date_gmt if provided, + * then falls back to use the current time. + * + * For back-compat purposes in wp_insert_post, an empty post_date and an invalid + * post_date_gmt will continue to return '1970-01-01 00:00:00' rather than false. + * + * @since 5.7.0 + * + * @param string $post_date The date in mysql format (`Y-m-d H:i:s`). + * @param string $post_date_gmt The GMT date in mysql format (`Y-m-d H:i:s`). + * @return string|false A valid Gregorian-calendar date string, or false on failure. + */ + function wp_resolve_post_date($post_date = '', $post_date_gmt = '') + { + } + /** + * Computes a unique slug for the post, when given the desired slug and some post details. + * + * @since 2.8.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param string $slug The desired slug (post_name). + * @param int $post_id Post ID. + * @param string $post_status No uniqueness checks are made if the post is still draft or pending. + * @param string $post_type Post type. + * @param int $post_parent Post parent ID. + * @return string Unique slug for the post, based on $post_name (with a -1, -2, etc. suffix) + */ + function wp_unique_post_slug($slug, $post_id, $post_status, $post_type, $post_parent) + { + } + /** + * Truncates a post slug. + * + * @since 3.6.0 + * @access private + * + * @see utf8_uri_encode() + * + * @param string $slug The slug to truncate. + * @param int $length Optional. Max length of the slug. Default 200 (characters). + * @return string The truncated slug. + */ + function _truncate_post_slug($slug, $length = 200) + { + } + /** + * Adds tags to a post. + * + * @see wp_set_post_tags() + * + * @since 2.3.0 + * + * @param int $post_id Optional. The Post ID. Does not default to the ID of the global $post. + * @param string|array $tags Optional. An array of tags to set for the post, or a string of tags + * separated by commas. Default empty. + * @return array|false|WP_Error Array of affected term IDs. WP_Error or false on failure. + */ + function wp_add_post_tags($post_id = 0, $tags = '') + { + } + /** + * Sets the tags for a post. + * + * @since 2.3.0 + * + * @see wp_set_object_terms() + * + * @param int $post_id Optional. The Post ID. Does not default to the ID of the global $post. + * @param string|array $tags Optional. An array of tags to set for the post, or a string of tags + * separated by commas. Default empty. + * @param bool $append Optional. If true, don't delete existing tags, just add on. If false, + * replace the tags with the new tags. Default false. + * @return array|false|WP_Error Array of term taxonomy IDs of affected terms. WP_Error or false on failure. + */ + function wp_set_post_tags($post_id = 0, $tags = '', $append = \false) + { + } + /** + * Sets the terms for a post. + * + * @since 2.8.0 + * + * @see wp_set_object_terms() + * + * @param int $post_id Optional. The Post ID. Does not default to the ID of the global $post. + * @param string|array $terms Optional. An array of terms to set for the post, or a string of terms + * separated by commas. Hierarchical taxonomies must always pass IDs rather + * than names so that children with the same names but different parents + * aren't confused. Default empty. + * @param string $taxonomy Optional. Taxonomy name. Default 'post_tag'. + * @param bool $append Optional. If true, don't delete existing terms, just add on. If false, + * replace the terms with the new terms. Default false. + * @return array|false|WP_Error Array of term taxonomy IDs of affected terms. WP_Error or false on failure. + */ + function wp_set_post_terms($post_id = 0, $terms = '', $taxonomy = 'post_tag', $append = \false) + { + } + /** + * Sets categories for a post. + * + * If no categories are provided, the default category is used. + * + * @since 2.1.0 + * + * @param int $post_id Optional. The Post ID. Does not default to the ID + * of the global $post. Default 0. + * @param int[]|int $post_categories Optional. List of category IDs, or the ID of a single category. + * Default empty array. + * @param bool $append If true, don't delete existing categories, just add on. + * If false, replace the categories with the new categories. + * @return array|false|WP_Error Array of term taxonomy IDs of affected categories. WP_Error or false on failure. + */ + function wp_set_post_categories($post_id = 0, $post_categories = array(), $append = \false) + { + } + /** + * Fires actions related to the transitioning of a post's status. + * + * When a post is saved, the post status is "transitioned" from one status to another, + * though this does not always mean the status has actually changed before and after + * the save. This function fires a number of action hooks related to that transition: + * the generic {@see 'transition_post_status'} action, as well as the dynamic hooks + * {@see '$old_status_to_$new_status'} and {@see '$new_status_$post->post_type'}. Note + * that the function does not transition the post object in the database. + * + * For instance: When publishing a post for the first time, the post status may transition + * from 'draft' – or some other status – to 'publish'. However, if a post is already + * published and is simply being updated, the "old" and "new" statuses may both be 'publish' + * before and after the transition. + * + * @since 2.3.0 + * + * @param string $new_status Transition to this post status. + * @param string $old_status Previous post status. + * @param WP_Post $post Post data. + */ + function wp_transition_post_status($new_status, $old_status, $post) + { + } + /** + * Fires actions after a post, its terms and meta data has been saved. + * + * @since 5.6.0 + * + * @param int|WP_Post $post The post ID or object that has been saved. + * @param bool $update Whether this is an existing post being updated. + * @param null|WP_Post $post_before Null for new posts, the WP_Post object prior + * to the update for updated posts. + * @phpstan-return void + */ + function wp_after_insert_post($post, $update, $post_before) + { + } + // + // Comment, trackback, and pingback functions. + // + /** + * Adds a URL to those already pinged. + * + * @since 1.5.0 + * @since 4.7.0 `$post` can be a WP_Post object. + * @since 4.7.0 `$uri` can be an array of URIs. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int|WP_Post $post Post ID or post object. + * @param string|array $uri Ping URI or array of URIs. + * @return int|false How many rows were updated. + */ + function add_ping($post, $uri) + { + } + /** + * Retrieves enclosures already enclosed for a post. + * + * @since 1.5.0 + * + * @param int $post_id Post ID. + * @return string[] Array of enclosures for the given post. + */ + function get_enclosed($post_id) + { + } + /** + * Retrieves URLs already pinged for a post. + * + * @since 1.5.0 + * + * @since 4.7.0 `$post` can be a WP_Post object. + * + * @param int|WP_Post $post Post ID or object. + * @return string[]|false Array of URLs already pinged for the given post, false if the post is not found. + */ + function get_pung($post) + { + } + /** + * Retrieves URLs that need to be pinged. + * + * @since 1.5.0 + * @since 4.7.0 `$post` can be a WP_Post object. + * + * @param int|WP_Post $post Post ID or post object. + * @return string[]|false List of URLs yet to ping. + */ + function get_to_ping($post) + { + } + /** + * Does trackbacks for a list of URLs. + * + * @since 1.0.0 + * + * @param string $tb_list Comma separated list of URLs. + * @param int $post_id Post ID. + */ + function trackback_url_list($tb_list, $post_id) + { + } + // + // Page functions. + // + /** + * Gets a list of page IDs. + * + * @since 2.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @return string[] List of page IDs as strings. + */ + function get_all_page_ids() + { + } + /** + * Retrieves page data given a page ID or page object. + * + * Use get_post() instead of get_page(). + * + * @since 1.5.1 + * @deprecated 3.5.0 Use get_post() + * + * @param int|WP_Post $page Page object or page ID. Passed by reference. + * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which + * correspond to a WP_Post object, an associative array, or a numeric array, + * respectively. Default OBJECT. + * @param string $filter Optional. How the return value should be filtered. Accepts 'raw', + * 'edit', 'db', 'display'. Default 'raw'. + * @return WP_Post|array|null WP_Post or array on success, null on failure. + */ + function get_page($page, $output = \OBJECT, $filter = 'raw') + { + } + /** + * Retrieves a page given its path. + * + * @since 2.1.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $page_path Page path. + * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which + * correspond to a WP_Post object, an associative array, or a numeric array, + * respectively. Default OBJECT. + * @param string|array $post_type Optional. Post type or array of post types. Default 'page'. + * @return WP_Post|array|null WP_Post (or array) on success, or null on failure. + * @phpstan-return ($output is 'ARRAY_A' ? array<string, mixed>|null : ($output is 'ARRAY_N' ? array<int, mixed>|null : \WP_Post|null)) + */ + function get_page_by_path($page_path, $output = \OBJECT, $post_type = 'page') + { + } + /** + * Identifies descendants of a given page ID in a list of page objects. + * + * Descendants are identified from the `$pages` array passed to the function. No database queries are performed. + * + * @since 1.5.1 + * + * @param int $page_id Page ID. + * @param WP_Post[] $pages List of page objects from which descendants should be identified. + * @return WP_Post[] List of page children. + */ + function get_page_children($page_id, $pages) + { + } + /** + * Orders the pages with children under parents in a flat list. + * + * It uses auxiliary structure to hold parent-children relationships and + * runs in O(N) complexity + * + * @since 2.0.0 + * + * @param WP_Post[] $pages Posts array (passed by reference). + * @param int $page_id Optional. Parent page ID. Default 0. + * @return string[] Array of post names keyed by ID and arranged by hierarchy. Children immediately follow their parents. + */ + function get_page_hierarchy(&$pages, $page_id = 0) + { + } + /** + * Traverses and return all the nested children post names of a root page. + * + * $children contains parent-children relations + * + * @since 2.9.0 + * @access private + * + * @see _page_traverse_name() + * + * @param int $page_id Page ID. + * @param array $children Parent-children relations (passed by reference). + * @param string[] $result Array of page names keyed by ID (passed by reference). + */ + function _page_traverse_name($page_id, &$children, &$result) + { + } + /** + * Builds the URI path for a page. + * + * Sub pages will be in the "directory" under the parent page post name. + * + * @since 1.5.0 + * @since 4.6.0 The `$page` parameter was made optional. + * + * @param WP_Post|object|int $page Optional. Page ID or WP_Post object. Default is global $post. + * @return string|false Page URI, false on error. + */ + function get_page_uri($page = 0) + { + } + /** + * Retrieves an array of pages (or hierarchical post type items). + * + * @since 1.5.0 + * @since 6.3.0 Use WP_Query internally. + * + * @param array|string $args { + * Optional. Array or string of arguments to retrieve pages. + * + * @type int $child_of Page ID to return child and grandchild pages of. Note: The value + * of `$hierarchical` has no bearing on whether `$child_of` returns + * hierarchical results. Default 0, or no restriction. + * @type string $sort_order How to sort retrieved pages. Accepts 'ASC', 'DESC'. Default 'ASC'. + * @type string $sort_column What columns to sort pages by, comma-separated. Accepts 'post_author', + * 'post_date', 'post_title', 'post_name', 'post_modified', 'menu_order', + * 'post_modified_gmt', 'post_parent', 'ID', 'rand', 'comment_count'. + * 'post_' can be omitted for any values that start with it. + * Default 'post_title'. + * @type bool $hierarchical Whether to return pages hierarchically. If false in conjunction with + * `$child_of` also being false, both arguments will be disregarded. + * Default true. + * @type int[] $exclude Array of page IDs to exclude. Default empty array. + * @type int[] $include Array of page IDs to include. Cannot be used with `$child_of`, + * `$parent`, `$exclude`, `$meta_key`, `$meta_value`, or `$hierarchical`. + * Default empty array. + * @type string $meta_key Only include pages with this meta key. Default empty. + * @type string $meta_value Only include pages with this meta value. Requires `$meta_key`. + * Default empty. + * @type string $authors A comma-separated list of author IDs. Default empty. + * @type int $parent Page ID to return direct children of. Default -1, or no restriction. + * @type string|int[] $exclude_tree Comma-separated string or array of page IDs to exclude. + * Default empty array. + * @type int $number The number of pages to return. Default 0, or all pages. + * @type int $offset The number of pages to skip before returning. Requires `$number`. + * Default 0. + * @type string $post_type The post type to query. Default 'page'. + * @type string|array $post_status A comma-separated list or array of post statuses to include. + * Default 'publish'. + * } + * @return WP_Post[]|false Array of pages (or hierarchical post type items). Boolean false if the + * specified post type is not hierarchical or the specified status is not + * supported by the post type. + * @phpstan-param array{ + * child_of?: int, + * sort_order?: string, + * sort_column?: string, + * hierarchical?: bool, + * exclude?: int[], + * include?: int[], + * meta_key?: string, + * meta_value?: string, + * authors?: string, + * parent?: int, + * exclude_tree?: string|int[], + * number?: int, + * offset?: int, + * post_type?: string, + * post_status?: string|array, + * } $args + */ + function get_pages($args = array()) + { + } + // + // Attachment functions. + // + /** + * Determines whether an attachment URI is local and really an attachment. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 2.0.0 + * + * @param string $url URL to check + * @return bool True on success, false on failure. + */ + function is_local_attachment($url) + { + } + /** + * Inserts an attachment. + * + * If you set the 'ID' in the $args parameter, it will mean that you are + * updating and attempt to update the attachment. You can also set the + * attachment name or title by setting the key 'post_name' or 'post_title'. + * + * You can set the dates for the attachment manually by setting the 'post_date' + * and 'post_date_gmt' keys' values. + * + * By default, the comments will use the default settings for whether the + * comments are allowed. You can close them manually or keep them open by + * setting the value for the 'comment_status' key. + * + * @since 2.0.0 + * @since 4.7.0 Added the `$wp_error` parameter to allow a WP_Error to be returned on failure. + * @since 5.6.0 Added the `$fire_after_hooks` parameter. + * + * @see wp_insert_post() + * + * @param string|array $args Arguments for inserting an attachment. + * @param string|false $file Optional. Filename. Default false. + * @param int $parent_post_id Optional. Parent post ID or 0 for no parent. Default 0. + * @param bool $wp_error Optional. Whether to return a WP_Error on failure. Default false. + * @param bool $fire_after_hooks Optional. Whether to fire the after insert hooks. Default true. + * @return int|WP_Error The attachment ID on success. The value 0 or WP_Error on failure. + * @phpstan-return ($wp_error is false ? 0|positive-int : positive-int|\WP_Error) + */ + function wp_insert_attachment($args, $file = \false, $parent_post_id = 0, $wp_error = \false, $fire_after_hooks = \true) + { + } + /** + * Trashes or deletes an attachment. + * + * When an attachment is permanently deleted, the file will also be removed. + * Deletion removes all post meta fields, taxonomy, comments, etc. associated + * with the attachment (except the main post). + * + * The attachment is moved to the Trash instead of permanently deleted unless Trash + * for media is disabled, item is already in the Trash, or $force_delete is true. + * + * @since 2.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $post_id Attachment ID. + * @param bool $force_delete Optional. Whether to bypass Trash and force deletion. + * Default false. + * @return WP_Post|false|null Post data on success, false or null on failure. + */ + function wp_delete_attachment($post_id, $force_delete = \false) + { + } + /** + * Deletes all files that belong to the given attachment. + * + * @since 4.9.7 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $post_id Attachment ID. + * @param array $meta The attachment's meta data. + * @param array $backup_sizes The meta data for the attachment's backup images. + * @param string $file Absolute path to the attachment's file. + * @return bool True on success, false on failure. + */ + function wp_delete_attachment_files($post_id, $meta, $backup_sizes, $file) + { + } + /** + * Retrieves attachment metadata for attachment ID. + * + * @since 2.1.0 + * @since 6.0.0 The `$filesize` value was added to the returned array. + * + * @param int $attachment_id Attachment post ID. Defaults to global $post. + * @param bool $unfiltered Optional. If true, filters are not run. Default false. + * @return array|false { + * Attachment metadata. False on failure. + * + * @type int $width The width of the attachment. + * @type int $height The height of the attachment. + * @type string $file The file path relative to `wp-content/uploads`. + * @type array $sizes Keys are size slugs, each value is an array containing + * 'file', 'width', 'height', and 'mime-type'. + * @type array $image_meta Image metadata. + * @type int $filesize File size of the attachment. + * } + * @phpstan-return false|array{ + * width: int, + * height: int, + * file: string, + * sizes: array, + * image_meta: array, + * filesize: int, + * } + */ + function wp_get_attachment_metadata($attachment_id = 0, $unfiltered = \false) + { + } + /** + * Updates metadata for an attachment. + * + * @since 2.1.0 + * + * @param int $attachment_id Attachment post ID. + * @param array $data Attachment meta data. + * @return int|false False if $post is invalid. + */ + function wp_update_attachment_metadata($attachment_id, $data) + { + } + /** + * Retrieves the URL for an attachment. + * + * @since 2.1.0 + * + * @global string $pagenow The filename of the current screen. + * + * @param int $attachment_id Optional. Attachment post ID. Defaults to global $post. + * @return string|false Attachment URL, otherwise false. + */ + function wp_get_attachment_url($attachment_id = 0) + { + } + /** + * Retrieves the caption for an attachment. + * + * @since 4.6.0 + * + * @param int $post_id Optional. Attachment ID. Default is the ID of the global `$post`. + * @return string|false Attachment caption on success, false on failure. + */ + function wp_get_attachment_caption($post_id = 0) + { + } + /** + * Retrieves URL for an attachment thumbnail. + * + * @since 2.1.0 + * @since 6.1.0 Changed to use wp_get_attachment_image_url(). + * + * @param int $post_id Optional. Attachment ID. Default is the ID of the global `$post`. + * @return string|false Thumbnail URL on success, false on failure. + */ + function wp_get_attachment_thumb_url($post_id = 0) + { + } + /** + * Verifies an attachment is of a given type. + * + * @since 4.2.0 + * + * @param string $type Attachment type. Accepts `image`, `audio`, `video`, or a file extension. + * @param int|WP_Post $post Optional. Attachment ID or object. Default is global $post. + * @return bool True if an accepted type or a matching file extension, false otherwise. + */ + function wp_attachment_is($type, $post = \null) + { + } + /** + * Determines whether an attachment is an image. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 2.1.0 + * @since 4.2.0 Modified into wrapper for wp_attachment_is() and + * allowed WP_Post object to be passed. + * + * @param int|WP_Post $post Optional. Attachment ID or object. Default is global $post. + * @return bool Whether the attachment is an image. + */ + function wp_attachment_is_image($post = \null) + { + } + /** + * Retrieves the icon for a MIME type or attachment. + * + * @since 2.1.0 + * @since 6.5.0 Added the `$preferred_ext` parameter. + * + * @param string|int $mime MIME type or attachment ID. + * @param string $preferred_ext File format to prefer in return. Default '.png'. + * @return string|false Icon, false otherwise. + */ + function wp_mime_type_icon($mime = 0, $preferred_ext = '.png') + { + } + /** + * Checks for changed slugs for published post objects and save the old slug. + * + * The function is used when a post object of any type is updated, + * by comparing the current and previous post objects. + * + * If the slug was changed and not already part of the old slugs then it will be + * added to the post meta field ('_wp_old_slug') for storing old slugs for that + * post. + * + * The most logically usage of this function is redirecting changed post objects, so + * that those that linked to an changed post will be redirected to the new post. + * + * @since 2.1.0 + * + * @param int $post_id Post ID. + * @param WP_Post $post The post object. + * @param WP_Post $post_before The previous post object. + * @phpstan-return void + */ + function wp_check_for_changed_slugs($post_id, $post, $post_before) + { + } + /** + * Checks for changed dates for published post objects and save the old date. + * + * The function is used when a post object of any type is updated, + * by comparing the current and previous post objects. + * + * If the date was changed and not already part of the old dates then it will be + * added to the post meta field ('_wp_old_date') for storing old dates for that + * post. + * + * The most logically usage of this function is redirecting changed post objects, so + * that those that linked to an changed post will be redirected to the new post. + * + * @since 4.9.3 + * + * @param int $post_id Post ID. + * @param WP_Post $post The post object. + * @param WP_Post $post_before The previous post object. + * @phpstan-return void + */ + function wp_check_for_changed_dates($post_id, $post, $post_before) + { + } + /** + * Retrieves the private post SQL based on capability. + * + * This function provides a standardized way to appropriately select on the + * post_status of a post type. The function will return a piece of SQL code + * that can be added to a WHERE clause; this SQL is constructed to allow all + * published posts, and all private posts to which the user has access. + * + * @since 2.2.0 + * @since 4.3.0 Added the ability to pass an array to `$post_type`. + * + * @param string|array $post_type Single post type or an array of post types. Currently only supports 'post' or 'page'. + * @return string SQL code that can be added to a where clause. + */ + function get_private_posts_cap_sql($post_type) + { + } + /** + * Retrieves the post SQL based on capability, author, and type. + * + * @since 3.0.0 + * @since 4.3.0 Introduced the ability to pass an array of post types to `$post_type`. + * + * @see get_private_posts_cap_sql() + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string|string[] $post_type Single post type or an array of post types. + * @param bool $full Optional. Returns a full WHERE statement instead of just + * an 'andalso' term. Default true. + * @param int $post_author Optional. Query posts having a single author ID. Default null. + * @param bool $public_only Optional. Only return public posts. Skips cap checks for + * $current_user. Default false. + * @return string SQL WHERE code that can be added to a query. + */ + function get_posts_by_author_sql($post_type, $full = \true, $post_author = \null, $public_only = \false) + { + } + /** + * Retrieves the most recent time that a post on the site was published. + * + * The server timezone is the default and is the difference between GMT and + * server time. The 'blog' value is the date when the last post was posted. + * The 'gmt' is when the last post was posted in GMT formatted date. + * + * @since 0.71 + * @since 4.4.0 The `$post_type` argument was added. + * + * @param string $timezone Optional. The timezone for the timestamp. Accepts 'server', 'blog', or 'gmt'. + * 'server' uses the server's internal timezone. + * 'blog' uses the `post_date` field, which proxies to the timezone set for the site. + * 'gmt' uses the `post_date_gmt` field. + * Default 'server'. + * @param string $post_type Optional. The post type to check. Default 'any'. + * @return string The date of the last post, or false on failure. + * @phpstan-param 'server'|'blog'|'gmt' $timezone + */ + function get_lastpostdate($timezone = 'server', $post_type = 'any') + { + } + /** + * Gets the most recent time that a post on the site was modified. + * + * The server timezone is the default and is the difference between GMT and + * server time. The 'blog' value is just when the last post was modified. + * The 'gmt' is when the last post was modified in GMT time. + * + * @since 1.2.0 + * @since 4.4.0 The `$post_type` argument was added. + * + * @param string $timezone Optional. The timezone for the timestamp. See get_lastpostdate() + * for information on accepted values. + * Default 'server'. + * @param string $post_type Optional. The post type to check. Default 'any'. + * @return string The timestamp in 'Y-m-d H:i:s' format, or false on failure. + * @phpstan-param 'server'|'blog'|'gmt' $timezone + */ + function get_lastpostmodified($timezone = 'server', $post_type = 'any') + { + } + /** + * Gets the timestamp of the last time any post was modified or published. + * + * @since 3.1.0 + * @since 4.4.0 The `$post_type` argument was added. + * @access private + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $timezone The timezone for the timestamp. See get_lastpostdate(). + * for information on accepted values. + * @param string $field Post field to check. Accepts 'date' or 'modified'. + * @param string $post_type Optional. The post type to check. Default 'any'. + * @return string|false The timestamp in 'Y-m-d H:i:s' format, or false on failure. + * @phpstan-param 'date'|'modified' $field + * @phpstan-param 'server'|'blog'|'gmt' $timezone + */ + function _get_last_post_time($timezone, $field, $post_type = 'any') + { + } + /** + * Updates posts in cache. + * + * @since 1.5.1 + * + * @param WP_Post[] $posts Array of post objects (passed by reference). + * @phpstan-return void + */ + function update_post_cache(&$posts) + { + } + /** + * Will clean the post in the cache. + * + * Cleaning means delete from the cache of the post. Will call to clean the term + * object cache associated with the post ID. + * + * This function not run if $_wp_suspend_cache_invalidation is not empty. See + * wp_suspend_cache_invalidation(). + * + * @since 2.0.0 + * + * @global bool $_wp_suspend_cache_invalidation + * + * @param int|WP_Post $post Post ID or post object to remove from the cache. + * @phpstan-return void + */ + function clean_post_cache($post) + { + } + /** + * Updates post, term, and metadata caches for a list of post objects. + * + * @since 1.5.0 + * + * @param WP_Post[] $posts Array of post objects (passed by reference). + * @param string $post_type Optional. Post type. Default 'post'. + * @param bool $update_term_cache Optional. Whether to update the term cache. Default true. + * @param bool $update_meta_cache Optional. Whether to update the meta cache. Default true. + * @phpstan-return void + */ + function update_post_caches(&$posts, $post_type = 'post', $update_term_cache = \true, $update_meta_cache = \true) + { + } + /** + * Updates post author user caches for a list of post objects. + * + * @since 6.1.0 + * + * @param WP_Post[] $posts Array of post objects. + * @phpstan-return void + */ + function update_post_author_caches($posts) + { + } + /** + * Updates parent post caches for a list of post objects. + * + * @since 6.1.0 + * + * @param WP_Post[] $posts Array of post objects. + */ + function update_post_parent_caches($posts) + { + } + /** + * Updates metadata cache for a list of post IDs. + * + * Performs SQL query to retrieve the metadata for the post IDs and updates the + * metadata cache for the posts. Therefore, the functions, which call this + * function, do not need to perform SQL queries on their own. + * + * @since 2.1.0 + * + * @param int[] $post_ids Array of post IDs. + * @return array|false An array of metadata on success, false if there is nothing to update. + */ + function update_postmeta_cache($post_ids) + { + } + /** + * Will clean the attachment in the cache. + * + * Cleaning means delete from the cache. Optionally will clean the term + * object cache associated with the attachment ID. + * + * This function will not run if $_wp_suspend_cache_invalidation is not empty. + * + * @since 3.0.0 + * + * @global bool $_wp_suspend_cache_invalidation + * + * @param int $id The attachment ID in the cache to clean. + * @param bool $clean_terms Optional. Whether to clean terms cache. Default false. + * @phpstan-return void + */ + function clean_attachment_cache($id, $clean_terms = \false) + { + } + // + // Hooks. + // + /** + * Hook for managing future post transitions to published. + * + * @since 2.3.0 + * @access private + * + * @see wp_clear_scheduled_hook() + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $new_status New post status. + * @param string $old_status Previous post status. + * @param WP_Post $post Post object. + */ + function _transition_post_status($new_status, $old_status, $post) + { + } + /** + * Hook used to schedule publication for a post marked for the future. + * + * The $post properties used and must exist are 'ID' and 'post_date_gmt'. + * + * @since 2.3.0 + * @access private + * + * @param int $deprecated Not used. Can be set to null. Never implemented. Not marked + * as deprecated with _deprecated_argument() as it conflicts with + * wp_transition_post_status() and the default filter for _future_post_hook(). + * @param WP_Post $post Post object. + */ + function _future_post_hook($deprecated, $post) + { + } + /** + * Hook to schedule pings and enclosures when a post is published. + * + * Uses XMLRPC_REQUEST and WP_IMPORTING constants. + * + * @since 2.3.0 + * @access private + * + * @param int $post_id The ID of the post being published. + * @phpstan-return void + */ + function _publish_post_hook($post_id) + { + } + /** + * Returns the ID of the post's parent. + * + * @since 3.1.0 + * @since 5.9.0 The `$post` parameter was made optional. + * + * @param int|WP_Post|null $post Optional. Post ID or post object. Defaults to global $post. + * @return int|false Post parent ID (which can be 0 if there is no parent), + * or false if the post does not exist. + */ + function wp_get_post_parent_id($post = \null) + { + } + /** + * Checks the given subset of the post hierarchy for hierarchy loops. + * + * Prevents loops from forming and breaks those that it finds. Attached + * to the {@see 'wp_insert_post_parent'} filter. + * + * @since 3.1.0 + * + * @see wp_find_hierarchy_loop() + * + * @param int $post_parent ID of the parent for the post we're checking. + * @param int $post_id ID of the post we're checking. + * @return int The new post_parent for the post, 0 otherwise. + */ + function wp_check_post_hierarchy_for_loops($post_parent, $post_id) + { + } + /** + * Sets the post thumbnail (featured image) for the given post. + * + * @since 3.1.0 + * + * @param int|WP_Post $post Post ID or post object where thumbnail should be attached. + * @param int $thumbnail_id Thumbnail to attach. + * @return int|bool True on success, false on failure. + */ + function set_post_thumbnail($post, $thumbnail_id) + { + } + /** + * Removes the thumbnail (featured image) from the given post. + * + * @since 3.3.0 + * + * @param int|WP_Post $post Post ID or post object from which the thumbnail should be removed. + * @return bool True on success, false on failure. + */ + function delete_post_thumbnail($post) + { + } + /** + * Deletes auto-drafts for new posts that are > 7 days old. + * + * @since 3.4.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + */ + function wp_delete_auto_drafts() + { + } + /** + * Queues posts for lazy-loading of term meta. + * + * @since 4.5.0 + * + * @param WP_Post[] $posts Array of WP_Post objects. + */ + function wp_queue_posts_for_term_meta_lazyload($posts) + { + } + /** + * Updates the custom taxonomies' term counts when a post's status is changed. + * + * For example, default posts term counts (for custom taxonomies) don't include + * private / draft posts. + * + * @since 3.3.0 + * @access private + * + * @param string $new_status New post status. + * @param string $old_status Old post status. + * @param WP_Post $post Post object. + */ + function _update_term_count_on_transition_post_status($new_status, $old_status, $post) + { + } + /** + * Adds any posts from the given IDs to the cache that do not already exist in cache. + * + * @since 3.4.0 + * @since 6.1.0 This function is no longer marked as "private". + * + * @see update_post_cache() + * @see update_postmeta_cache() + * @see update_object_term_cache() + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int[] $ids ID list. + * @param bool $update_term_cache Optional. Whether to update the term cache. Default true. + * @param bool $update_meta_cache Optional. Whether to update the meta cache. Default true. + */ + function _prime_post_caches($ids, $update_term_cache = \true, $update_meta_cache = \true) + { + } + /** + * Prime the cache containing the parent ID of various post objects. + * + * @since 6.4.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int[] $ids ID list. + * @phpstan-return void + */ + function _prime_post_parent_id_caches(array $ids) + { + } + /** + * Adds a suffix if any trashed posts have a given slug. + * + * Store its desired (i.e. current) slug so it can try to reclaim it + * if the post is untrashed. + * + * For internal use. + * + * @since 4.5.0 + * @access private + * + * @param string $post_name Post slug. + * @param int $post_id Optional. Post ID that should be ignored. Default 0. + */ + function wp_add_trashed_suffix_to_post_name_for_trashed_posts($post_name, $post_id = 0) + { + } + /** + * Adds a trashed suffix for a given post. + * + * Store its desired (i.e. current) slug so it can try to reclaim it + * if the post is untrashed. + * + * For internal use. + * + * @since 4.5.0 + * @access private + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param WP_Post $post The post. + * @return string New slug for the post. + */ + function wp_add_trashed_suffix_to_post_name_for_post($post) + { + } + /** + * Sets the last changed time for the 'posts' cache group. + * + * @since 5.0.0 + */ + function wp_cache_set_posts_last_changed() + { + } + /** + * Gets all available post MIME types for a given post type. + * + * @since 2.5.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $type + * @return string[] An array of MIME types. + */ + function get_available_post_mime_types($type = 'attachment') + { + } + /** + * Retrieves the path to an uploaded image file. + * + * Similar to `get_attached_file()` however some images may have been processed after uploading + * to make them suitable for web use. In this case the attached "full" size file is usually replaced + * with a scaled down version of the original image. This function always returns the path + * to the originally uploaded image file. + * + * @since 5.3.0 + * @since 5.4.0 Added the `$unfiltered` parameter. + * + * @param int $attachment_id Attachment ID. + * @param bool $unfiltered Optional. Passed through to `get_attached_file()`. Default false. + * @return string|false Path to the original image file or false if the attachment is not an image. + */ + function wp_get_original_image_path($attachment_id, $unfiltered = \false) + { + } + /** + * Retrieves the URL to an original attachment image. + * + * Similar to `wp_get_attachment_url()` however some images may have been + * processed after uploading. In this case this function returns the URL + * to the originally uploaded image file. + * + * @since 5.3.0 + * + * @param int $attachment_id Attachment post ID. + * @return string|false Attachment image URL, false on error or if the attachment is not an image. + */ + function wp_get_original_image_url($attachment_id) + { + } + /** + * Filters callback which sets the status of an untrashed post to its previous status. + * + * This can be used as a callback on the `wp_untrash_post_status` filter. + * + * @since 5.6.0 + * + * @param string $new_status The new status of the post being restored. + * @param int $post_id The ID of the post being restored. + * @param string $previous_status The status of the post at the point where it was trashed. + * @return string The new status of the post. + */ + function wp_untrash_post_set_previous_status($new_status, $post_id, $previous_status) + { + } + /** + * Returns whether the post can be edited in the block editor. + * + * @since 5.0.0 + * @since 6.1.0 Moved to wp-includes from wp-admin. + * + * @param int|WP_Post $post Post ID or WP_Post object. + * @return bool Whether the post can be edited in the block editor. + */ + function use_block_editor_for_post($post) + { + } + /** + * Returns whether a post type is compatible with the block editor. + * + * The block editor depends on the REST API, and if the post type is not shown in the + * REST API, then it won't work with the block editor. + * + * @since 5.0.0 + * @since 6.1.0 Moved to wp-includes from wp-admin. + * + * @param string $post_type The post type. + * @return bool Whether the post type can be edited with the block editor. + */ + function use_block_editor_for_post_type($post_type) + { + } + /** + * Registers any additional post meta fields. + * + * @since 6.3.0 Adds `wp_pattern_sync_status` meta field to the wp_block post type so an unsynced option can be added. + * + * @link https://github.com/WordPress/gutenberg/pull/51144 + */ + function wp_create_initial_post_meta() + { + } + /** + * WordPress Query API + * + * The query API attempts to get which part of WordPress the user is on. It + * also provides functionality for getting URL query information. + * + * @link https://developer.wordpress.org/themes/basics/the-loop/ More information on The Loop. + * + * @package WordPress + * @subpackage Query + */ + /** + * Retrieves the value of a query variable in the WP_Query class. + * + * @since 1.5.0 + * @since 3.9.0 The `$default_value` argument was introduced. + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param string $query_var The variable key to retrieve. + * @param mixed $default_value Optional. Value to return if the query variable is not set. + * Default empty string. + * @return mixed Contents of the query variable. + */ + function get_query_var($query_var, $default_value = '') + { + } + /** + * Retrieves the currently queried object. + * + * Wrapper for WP_Query::get_queried_object(). + * + * @since 3.1.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @return WP_Term|WP_Post_Type|WP_Post|WP_User|null The queried object. + */ + function get_queried_object() + { + } + /** + * Retrieves the ID of the currently queried object. + * + * Wrapper for WP_Query::get_queried_object_id(). + * + * @since 3.1.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @return int ID of the queried object. + */ + function get_queried_object_id() + { + } + /** + * Sets the value of a query variable in the WP_Query class. + * + * @since 2.2.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param string $query_var Query variable key. + * @param mixed $value Query variable value. + */ + function set_query_var($query_var, $value) + { + } + /** + * Sets up The Loop with query parameters. + * + * Note: This function will completely override the main query and isn't intended for use + * by plugins or themes. Its overly-simplistic approach to modifying the main query can be + * problematic and should be avoided wherever possible. In most cases, there are better, + * more performant options for modifying the main query such as via the {@see 'pre_get_posts'} + * action within WP_Query. + * + * This must not be used within the WordPress Loop. + * + * @since 1.5.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param array|string $query Array or string of WP_Query arguments. + * @return WP_Post[]|int[] Array of post objects or post IDs. + */ + function query_posts($query) + { + } + /** + * Destroys the previous query and sets up a new query. + * + * This should be used after query_posts() and before another query_posts(). + * This will remove obscure bugs that occur when the previous WP_Query object + * is not destroyed properly before another is set up. + * + * @since 2.3.0 + * + * @global WP_Query $wp_query WordPress Query object. + * @global WP_Query $wp_the_query Copy of the global WP_Query instance created during wp_reset_query(). + */ + function wp_reset_query() + { + } + /** + * After looping through a separate query, this function restores + * the $post global to the current post in the main query. + * + * @since 3.0.0 + * + * @global WP_Query $wp_query WordPress Query object. + */ + function wp_reset_postdata() + { + } + /* + * Query type checks. + */ + /** + * Determines whether the query is for an existing archive page. + * + * Archive pages include category, tag, author, date, custom post type, + * and custom taxonomy based archives. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 1.5.0 + * + * @see is_category() + * @see is_tag() + * @see is_author() + * @see is_date() + * @see is_post_type_archive() + * @see is_tax() + * @global WP_Query $wp_query WordPress Query object. + * + * @return bool Whether the query is for an existing archive page. + */ + function is_archive() + { + } + /** + * Determines whether the query is for an existing post type archive page. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 3.1.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param string|string[] $post_types Optional. Post type or array of posts types + * to check against. Default empty. + * @return bool Whether the query is for an existing post type archive page. + */ + function is_post_type_archive($post_types = '') + { + } + /** + * Determines whether the query is for an existing attachment page. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 2.0.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param int|string|int[]|string[] $attachment Optional. Attachment ID, title, slug, or array of such + * to check against. Default empty. + * @return bool Whether the query is for an existing attachment page. + */ + function is_attachment($attachment = '') + { + } + /** + * Determines whether the query is for an existing author archive page. + * + * If the $author parameter is specified, this function will additionally + * check if the query is for one of the authors specified. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 1.5.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param int|string|int[]|string[] $author Optional. User ID, nickname, nicename, or array of such + * to check against. Default empty. + * @return bool Whether the query is for an existing author archive page. + */ + function is_author($author = '') + { + } + /** + * Determines whether the query is for an existing category archive page. + * + * If the $category parameter is specified, this function will additionally + * check if the query is for one of the categories specified. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 1.5.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param int|string|int[]|string[] $category Optional. Category ID, name, slug, or array of such + * to check against. Default empty. + * @return bool Whether the query is for an existing category archive page. + */ + function is_category($category = '') + { + } + /** + * Determines whether the query is for an existing tag archive page. + * + * If the $tag parameter is specified, this function will additionally + * check if the query is for one of the tags specified. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 2.3.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param int|string|int[]|string[] $tag Optional. Tag ID, name, slug, or array of such + * to check against. Default empty. + * @return bool Whether the query is for an existing tag archive page. + */ + function is_tag($tag = '') + { + } + /** + * Determines whether the query is for an existing custom taxonomy archive page. + * + * If the $taxonomy parameter is specified, this function will additionally + * check if the query is for that specific $taxonomy. + * + * If the $term parameter is specified in addition to the $taxonomy parameter, + * this function will additionally check if the query is for one of the terms + * specified. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 2.5.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param string|string[] $taxonomy Optional. Taxonomy slug or slugs to check against. + * Default empty. + * @param int|string|int[]|string[] $term Optional. Term ID, name, slug, or array of such + * to check against. Default empty. + * @return bool Whether the query is for an existing custom taxonomy archive page. + * True for custom taxonomy archive pages, false for built-in taxonomies + * (category and tag archives). + */ + function is_tax($taxonomy = '', $term = '') + { + } + /** + * Determines whether the query is for an existing date archive. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 1.5.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @return bool Whether the query is for an existing date archive. + */ + function is_date() + { + } + /** + * Determines whether the query is for an existing day archive. + * + * A conditional check to test whether the page is a date-based archive page displaying posts for the current day. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 1.5.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @return bool Whether the query is for an existing day archive. + */ + function is_day() + { + } + /** + * Determines whether the query is for a feed. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 1.5.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param string|string[] $feeds Optional. Feed type or array of feed types + * to check against. Default empty. + * @return bool Whether the query is for a feed. + */ + function is_feed($feeds = '') + { + } + /** + * Is the query for a comments feed? + * + * @since 3.0.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @return bool Whether the query is for a comments feed. + */ + function is_comment_feed() + { + } + /** + * Determines whether the query is for the front page of the site. + * + * This is for what is displayed at your site's main URL. + * + * Depends on the site's "Front page displays" Reading Settings 'show_on_front' and 'page_on_front'. + * + * If you set a static page for the front page of your site, this function will return + * true when viewing that page. + * + * Otherwise the same as {@see is_home()}. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 2.5.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @return bool Whether the query is for the front page of the site. + */ + function is_front_page() + { + } + /** + * Determines whether the query is for the blog homepage. + * + * The blog homepage is the page that shows the time-based blog content of the site. + * + * is_home() is dependent on the site's "Front page displays" Reading Settings 'show_on_front' + * and 'page_for_posts'. + * + * If a static page is set for the front page of the site, this function will return true only + * on the page you set as the "Posts page". + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 1.5.0 + * + * @see is_front_page() + * @global WP_Query $wp_query WordPress Query object. + * + * @return bool Whether the query is for the blog homepage. + */ + function is_home() + { + } + /** + * Determines whether the query is for the Privacy Policy page. + * + * The Privacy Policy page is the page that shows the Privacy Policy content of the site. + * + * is_privacy_policy() is dependent on the site's "Change your Privacy Policy page" Privacy Settings 'wp_page_for_privacy_policy'. + * + * This function will return true only on the page you set as the "Privacy Policy page". + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 5.2.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @return bool Whether the query is for the Privacy Policy page. + */ + function is_privacy_policy() + { + } + /** + * Determines whether the query is for an existing month archive. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 1.5.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @return bool Whether the query is for an existing month archive. + */ + function is_month() + { + } + /** + * Determines whether the query is for an existing single page. + * + * If the $page parameter is specified, this function will additionally + * check if the query is for one of the pages specified. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 1.5.0 + * + * @see is_single() + * @see is_singular() + * @global WP_Query $wp_query WordPress Query object. + * + * @param int|string|int[]|string[] $page Optional. Page ID, title, slug, or array of such + * to check against. Default empty. + * @return bool Whether the query is for an existing single page. + */ + function is_page($page = '') + { + } + /** + * Determines whether the query is for a paged result and not for the first page. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 1.5.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @return bool Whether the query is for a paged result. + */ + function is_paged() + { + } + /** + * Determines whether the query is for a post or page preview. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 2.0.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @return bool Whether the query is for a post or page preview. + */ + function is_preview() + { + } + /** + * Is the query for the robots.txt file? + * + * @since 2.1.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @return bool Whether the query is for the robots.txt file. + */ + function is_robots() + { + } + /** + * Is the query for the favicon.ico file? + * + * @since 5.4.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @return bool Whether the query is for the favicon.ico file. + */ + function is_favicon() + { + } + /** + * Determines whether the query is for a search. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 1.5.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @return bool Whether the query is for a search. + */ + function is_search() + { + } + /** + * Determines whether the query is for an existing single post. + * + * Works for any post type, except attachments and pages + * + * If the $post parameter is specified, this function will additionally + * check if the query is for one of the Posts specified. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 1.5.0 + * + * @see is_page() + * @see is_singular() + * @global WP_Query $wp_query WordPress Query object. + * + * @param int|string|int[]|string[] $post Optional. Post ID, title, slug, or array of such + * to check against. Default empty. + * @return bool Whether the query is for an existing single post. + */ + function is_single($post = '') + { + } + /** + * Determines whether the query is for an existing single post of any post type + * (post, attachment, page, custom post types). + * + * If the $post_types parameter is specified, this function will additionally + * check if the query is for one of the Posts Types specified. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 1.5.0 + * + * @see is_page() + * @see is_single() + * @global WP_Query $wp_query WordPress Query object. + * + * @param string|string[] $post_types Optional. Post type or array of post types + * to check against. Default empty. + * @return bool Whether the query is for an existing single post + * or any of the given post types. + */ + function is_singular($post_types = '') + { + } + /** + * Determines whether the query is for a specific time. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 1.5.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @return bool Whether the query is for a specific time. + */ + function is_time() + { + } + /** + * Determines whether the query is for a trackback endpoint call. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 1.5.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @return bool Whether the query is for a trackback endpoint call. + */ + function is_trackback() + { + } + /** + * Determines whether the query is for an existing year archive. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 1.5.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @return bool Whether the query is for an existing year archive. + */ + function is_year() + { + } + /** + * Determines whether the query has resulted in a 404 (returns no results). + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 1.5.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @return bool Whether the query is a 404 error. + */ + function is_404() + { + } + /** + * Is the query for an embedded post? + * + * @since 4.4.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @return bool Whether the query is for an embedded post. + */ + function is_embed() + { + } + /** + * Determines whether the query is the main query. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 3.3.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @return bool Whether the query is the main query. + */ + function is_main_query() + { + } + /* + * The Loop. Post loop control. + */ + /** + * Determines whether current WordPress query has posts to loop over. + * + * @since 1.5.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @return bool True if posts are available, false if end of the loop. + * @phpstan-impure + */ + function have_posts() + { + } + /** + * Determines whether the caller is in the Loop. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 2.0.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @return bool True if caller is within loop, false if loop hasn't started or ended. + */ + function in_the_loop() + { + } + /** + * Rewind the loop posts. + * + * @since 1.5.0 + * + * @global WP_Query $wp_query WordPress Query object. + * @phpstan-return void + */ + function rewind_posts() + { + } + /** + * Iterate the post index in the loop. + * + * @since 1.5.0 + * + * @global WP_Query $wp_query WordPress Query object. + * @phpstan-return void + */ + function the_post() + { + } + /* + * Comments loop. + */ + /** + * Determines whether current WordPress query has comments to loop over. + * + * @since 2.2.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @return bool True if comments are available, false if no more comments. + */ + function have_comments() + { + } + /** + * Iterate comment index in the comment loop. + * + * @since 2.2.0 + * + * @global WP_Query $wp_query WordPress Query object. + * @phpstan-return void + */ + function the_comment() + { + } + /** + * Redirect old slugs to the correct permalink. + * + * Attempts to find the current slug from the past slugs. + * + * @since 2.1.0 + * @phpstan-return void + */ + function wp_old_slug_redirect() + { + } + /** + * Find the post ID for redirecting an old slug. + * + * @since 4.9.3 + * @access private + * + * @see wp_old_slug_redirect() + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $post_type The current post type based on the query vars. + * @return int The Post ID. + */ + function _find_post_by_old_slug($post_type) + { + } + /** + * Find the post ID for redirecting an old date. + * + * @since 4.9.3 + * @access private + * + * @see wp_old_slug_redirect() + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $post_type The current post type based on the query vars. + * @return int The Post ID. + */ + function _find_post_by_old_date($post_type) + { + } + /** + * Set up global post data. + * + * @since 1.5.0 + * @since 4.4.0 Added the ability to pass a post ID to `$post`. + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param WP_Post|object|int $post WP_Post instance or Post ID/object. + * @return bool True when finished. + */ + function setup_postdata($post) + { + } + /** + * Generates post data. + * + * @since 5.2.0 + * + * @global WP_Query $wp_query WordPress Query object. + * + * @param WP_Post|object|int $post WP_Post instance or Post ID/object. + * @return array|false Elements of post, or false on failure. + */ + function generate_postdata($post) + { + } + /** + * Registers a REST API route. + * + * Note: Do not use before the {@see 'rest_api_init'} hook. + * + * @since 4.4.0 + * @since 5.1.0 Added a `_doing_it_wrong()` notice when not called on or after the `rest_api_init` hook. + * @since 5.5.0 Added a `_doing_it_wrong()` notice when the required `permission_callback` argument is not set. + * + * @param string $route_namespace The first URL segment after core prefix. Should be unique to your package/plugin. + * @param string $route The base URL for route you are adding. + * @param array $args Optional. Either an array of options for the endpoint, or an array of arrays for + * multiple methods. Default empty array. + * @param bool $override Optional. If the route already exists, should we override it? True overrides, + * false merges (with newer overriding if duplicate keys exist). Default false. + * @return bool True on success, false on error. + */ + function register_rest_route($route_namespace, $route, $args = array(), $override = \false) + { + } + /** + * Registers a new field on an existing WordPress object type. + * + * @since 4.7.0 + * + * @global array $wp_rest_additional_fields Holds registered fields, organized + * by object type. + * + * @param string|array $object_type Object(s) the field is being registered to, + * "post"|"term"|"comment" etc. + * @param string $attribute The attribute name. + * @param array $args { + * Optional. An array of arguments used to handle the registered field. + * + * @type callable|null $get_callback Optional. The callback function used to retrieve the field value. Default is + * 'null', the field will not be returned in the response. The function will + * be passed the prepared object data. + * @type callable|null $update_callback Optional. The callback function used to set and update the field value. Default + * is 'null', the value cannot be set or updated. The function will be passed + * the model object, like WP_Post. + * @type array|null $schema Optional. The schema for this field. + * Default is 'null', no schema entry will be returned. + * } + * @phpstan-param array{ + * get_callback?: callable|null, + * update_callback?: callable|null, + * schema?: array|null, + * } $args + */ + function register_rest_field($object_type, $attribute, $args = array()) + { + } + /** + * Registers rewrite rules for the REST API. + * + * @since 4.4.0 + * + * @see rest_api_register_rewrites() + * @global WP $wp Current WordPress environment instance. + */ + function rest_api_init() + { + } + /** + * Adds REST rewrite rules. + * + * @since 4.4.0 + * + * @see add_rewrite_rule() + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + */ + function rest_api_register_rewrites() + { + } + /** + * Registers the default REST API filters. + * + * Attached to the {@see 'rest_api_init'} action + * to make testing and disabling these filters easier. + * + * @since 4.4.0 + */ + function rest_api_default_filters() + { + } + /** + * Registers default REST API routes. + * + * @since 4.7.0 + */ + function create_initial_rest_routes() + { + } + /** + * Loads the REST API. + * + * @since 4.4.0 + * + * @global WP $wp Current WordPress environment instance. + * @phpstan-return void + */ + function rest_api_loaded() + { + } + /** + * Retrieves the URL prefix for any API resource. + * + * @since 4.4.0 + * + * @return string Prefix. + */ + function rest_get_url_prefix() + { + } + /** + * Retrieves the URL to a REST endpoint on a site. + * + * Note: The returned URL is NOT escaped. + * + * @since 4.4.0 + * + * @todo Check if this is even necessary + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param int|null $blog_id Optional. Blog ID. Default of null returns URL for current blog. + * @param string $path Optional. REST route. Default '/'. + * @param string $scheme Optional. Sanitization scheme. Default 'rest'. + * @return string Full URL to the endpoint. + */ + function get_rest_url($blog_id = \null, $path = '/', $scheme = 'rest') + { + } + /** + * Retrieves the URL to a REST endpoint. + * + * Note: The returned URL is NOT escaped. + * + * @since 4.4.0 + * + * @param string $path Optional. REST route. Default empty. + * @param string $scheme Optional. Sanitization scheme. Default 'rest'. + * @return string Full URL to the endpoint. + */ + function rest_url($path = '', $scheme = 'rest') + { + } + /** + * Do a REST request. + * + * Used primarily to route internal requests through WP_REST_Server. + * + * @since 4.4.0 + * + * @param WP_REST_Request|string $request Request. + * @return WP_REST_Response REST response. + */ + function rest_do_request($request) + { + } + /** + * Retrieves the current REST server instance. + * + * Instantiates a new instance if none exists already. + * + * @since 4.5.0 + * + * @global WP_REST_Server $wp_rest_server REST server instance. + * + * @return WP_REST_Server REST server instance. + */ + function rest_get_server() + { + } + /** + * Ensures request arguments are a request object (for consistency). + * + * @since 4.4.0 + * @since 5.3.0 Accept string argument for the request path. + * + * @param array|string|WP_REST_Request $request Request to check. + * @return WP_REST_Request REST request instance. + */ + function rest_ensure_request($request) + { + } + /** + * Ensures a REST response is a response object (for consistency). + * + * This implements WP_REST_Response, allowing usage of `set_status`/`header`/etc + * without needing to double-check the object. Will also allow WP_Error to indicate error + * responses, so users should immediately check for this value. + * + * @since 4.4.0 + * + * @param WP_REST_Response|WP_Error|WP_HTTP_Response|mixed $response Response to check. + * @return WP_REST_Response|WP_Error If response generated an error, WP_Error, if response + * is already an instance, WP_REST_Response, otherwise + * returns a new WP_REST_Response instance. + * @phpstan-return ($response is WP_Error ? WP_Error : WP_REST_Response) + */ + function rest_ensure_response($response) + { + } + /** + * Handles _deprecated_function() errors. + * + * @since 4.4.0 + * + * @param string $function_name The function that was called. + * @param string $replacement The function that should have been called. + * @param string $version Version. + * @phpstan-return void + */ + function rest_handle_deprecated_function($function_name, $replacement, $version) + { + } + /** + * Handles _deprecated_argument() errors. + * + * @since 4.4.0 + * + * @param string $function_name The function that was called. + * @param string $message A message regarding the change. + * @param string $version Version. + * @phpstan-return void + */ + function rest_handle_deprecated_argument($function_name, $message, $version) + { + } + /** + * Handles _doing_it_wrong errors. + * + * @since 5.5.0 + * + * @param string $function_name The function that was called. + * @param string $message A message explaining what has been done incorrectly. + * @param string|null $version The version of WordPress where the message was added. + * @phpstan-return void + */ + function rest_handle_doing_it_wrong($function_name, $message, $version) + { + } + /** + * Sends Cross-Origin Resource Sharing headers with API requests. + * + * @since 4.4.0 + * + * @param mixed $value Response data. + * @return mixed Response data. + */ + function rest_send_cors_headers($value) + { + } + /** + * Handles OPTIONS requests for the server. + * + * This is handled outside of the server code, as it doesn't obey normal route + * mapping. + * + * @since 4.4.0 + * + * @param mixed $response Current response, either response or `null` to indicate pass-through. + * @param WP_REST_Server $handler ResponseHandler instance (usually WP_REST_Server). + * @param WP_REST_Request $request The request that was used to make current response. + * @return WP_REST_Response Modified response, either response or `null` to indicate pass-through. + */ + function rest_handle_options_request($response, $handler, $request) + { + } + /** + * Sends the "Allow" header to state all methods that can be sent to the current route. + * + * @since 4.4.0 + * + * @param WP_REST_Response $response Current response being served. + * @param WP_REST_Server $server ResponseHandler instance (usually WP_REST_Server). + * @param WP_REST_Request $request The request that was used to make current response. + * @return WP_REST_Response Response to be served, with "Allow" header if route has allowed methods. + */ + function rest_send_allow_header($response, $server, $request) + { + } + /** + * Recursively computes the intersection of arrays using keys for comparison. + * + * @since 5.3.0 + * + * @param array $array1 The array with master keys to check. + * @param array $array2 An array to compare keys against. + * @return array An associative array containing all the entries of array1 which have keys + * that are present in all arguments. + */ + function _rest_array_intersect_key_recursive($array1, $array2) + { + } + /** + * Filters the REST API response to include only an allow-listed set of response object fields. + * + * @since 4.8.0 + * + * @param WP_REST_Response $response Current response being served. + * @param WP_REST_Server $server ResponseHandler instance (usually WP_REST_Server). + * @param WP_REST_Request $request The request that was used to make current response. + * @return WP_REST_Response Response to be served, trimmed down to contain a subset of fields. + */ + function rest_filter_response_fields($response, $server, $request) + { + } + /** + * Given an array of fields to include in a response, some of which may be + * `nested.fields`, determine whether the provided field should be included + * in the response body. + * + * If a parent field is passed in, the presence of any nested field within + * that parent will cause the method to return `true`. For example "title" + * will return true if any of `title`, `title.raw` or `title.rendered` is + * provided. + * + * @since 5.3.0 + * + * @param string $field A field to test for inclusion in the response body. + * @param array $fields An array of string fields supported by the endpoint. + * @return bool Whether to include the field or not. + */ + function rest_is_field_included($field, $fields) + { + } + /** + * Adds the REST API URL to the WP RSD endpoint. + * + * @since 4.4.0 + * + * @see get_rest_url() + * @phpstan-return void + */ + function rest_output_rsd() + { + } + /** + * Outputs the REST API link tag into page header. + * + * @since 4.4.0 + * + * @see get_rest_url() + * @phpstan-return void + */ + function rest_output_link_wp_head() + { + } + /** + * Sends a Link header for the REST API. + * + * @since 4.4.0 + * @phpstan-return void + */ + function rest_output_link_header() + { + } + /** + * Checks for errors when using cookie-based authentication. + * + * WordPress' built-in cookie authentication is always active + * for logged in users. However, the API has to check nonces + * for each request to ensure users are not vulnerable to CSRF. + * + * @since 4.4.0 + * + * @global mixed $wp_rest_auth_cookie + * + * @param WP_Error|mixed $result Error from another authentication handler, + * null if we should handle it, or another value if not. + * @return WP_Error|mixed|bool WP_Error if the cookie is invalid, the $result, otherwise true. + */ + function rest_cookie_check_errors($result) + { + } + /** + * Collects cookie authentication status. + * + * Collects errors from wp_validate_auth_cookie for use by rest_cookie_check_errors. + * + * @since 4.4.0 + * + * @see current_action() + * @global mixed $wp_rest_auth_cookie + * @phpstan-return void + */ + function rest_cookie_collect_status() + { + } + /** + * Collects the status of authenticating with an application password. + * + * @since 5.6.0 + * @since 5.7.0 Added the `$app_password` parameter. + * + * @global WP_User|WP_Error|null $wp_rest_application_password_status + * @global string|null $wp_rest_application_password_uuid + * + * @param WP_Error $user_or_error The authenticated user or error instance. + * @param array $app_password The Application Password used to authenticate. + */ + function rest_application_password_collect_status($user_or_error, $app_password = array()) + { + } + /** + * Gets the Application Password used for authenticating the request. + * + * @since 5.7.0 + * + * @global string|null $wp_rest_application_password_uuid + * + * @return string|null The Application Password UUID, or null if Application Passwords was not used. + */ + function rest_get_authenticated_app_password() + { + } + /** + * Checks for errors when using application password-based authentication. + * + * @since 5.6.0 + * + * @global WP_User|WP_Error|null $wp_rest_application_password_status + * + * @param WP_Error|null|true $result Error from another authentication handler, + * null if we should handle it, or another value if not. + * @return WP_Error|null|true WP_Error if the application password is invalid, the $result, otherwise true. + */ + function rest_application_password_check_errors($result) + { + } + /** + * Adds Application Passwords info to the REST API index. + * + * @since 5.6.0 + * + * @param WP_REST_Response $response The index response object. + * @return WP_REST_Response + */ + function rest_add_application_passwords_to_index($response) + { + } + /** + * Retrieves the avatar URLs in various sizes. + * + * @since 4.7.0 + * + * @see get_avatar_url() + * + * @param mixed $id_or_email The avatar to retrieve a URL for. Accepts a user ID, Gravatar MD5 hash, + * user email, WP_User object, WP_Post object, or WP_Comment object. + * @return (string|false)[] Avatar URLs keyed by size. Each value can be a URL string or boolean false. + */ + function rest_get_avatar_urls($id_or_email) + { + } + /** + * Retrieves the pixel sizes for avatars. + * + * @since 4.7.0 + * + * @return int[] List of pixel sizes for avatars. Default `[ 24, 48, 96 ]`. + */ + function rest_get_avatar_sizes() + { + } + /** + * Parses an RFC3339 time into a Unix timestamp. + * + * @since 4.4.0 + * + * @param string $date RFC3339 timestamp. + * @param bool $force_utc Optional. Whether to force UTC timezone instead of using + * the timestamp's timezone. Default false. + * @return int|false Unix timestamp on success, false on failure. + */ + function rest_parse_date($date, $force_utc = \false) + { + } + /** + * Parses a 3 or 6 digit hex color (with #). + * + * @since 5.4.0 + * + * @param string $color 3 or 6 digit hex color (with #). + * @return string|false Color value on success, false on failure. + */ + function rest_parse_hex_color($color) + { + } + /** + * Parses a date into both its local and UTC equivalent, in MySQL datetime format. + * + * @since 4.4.0 + * + * @see rest_parse_date() + * + * @param string $date RFC3339 timestamp. + * @param bool $is_utc Whether the provided date should be interpreted as UTC. Default false. + * @return array|null { + * Local and UTC datetime strings, in MySQL datetime format (Y-m-d H:i:s), + * null on failure. + * + * @type string $0 Local datetime string. + * @type string $1 UTC datetime string. + * } + * @phpstan-return null|array{ + * 0: string, + * 1: string, + * } + */ + function rest_get_date_with_gmt($date, $is_utc = \false) + { + } + /** + * Returns a contextual HTTP error code for authorization failure. + * + * @since 4.7.0 + * + * @return int 401 if the user is not logged in, 403 if the user is logged in. + */ + function rest_authorization_required_code() + { + } + /** + * Validate a request argument based on details registered to the route. + * + * @since 4.7.0 + * + * @param mixed $value + * @param WP_REST_Request $request + * @param string $param + * @return true|WP_Error + */ + function rest_validate_request_arg($value, $request, $param) + { + } + /** + * Sanitize a request argument based on details registered to the route. + * + * @since 4.7.0 + * + * @param mixed $value + * @param WP_REST_Request $request + * @param string $param + * @return mixed + */ + function rest_sanitize_request_arg($value, $request, $param) + { + } + /** + * Parse a request argument based on details registered to the route. + * + * Runs a validation check and sanitizes the value, primarily to be used via + * the `sanitize_callback` arguments in the endpoint args registration. + * + * @since 4.7.0 + * + * @param mixed $value + * @param WP_REST_Request $request + * @param string $param + * @return mixed + */ + function rest_parse_request_arg($value, $request, $param) + { + } + /** + * Determines if an IP address is valid. + * + * Handles both IPv4 and IPv6 addresses. + * + * @since 4.7.0 + * + * @param string $ip IP address. + * @return string|false The valid IP address, otherwise false. + */ + function rest_is_ip_address($ip) + { + } + /** + * Changes a boolean-like value into the proper boolean value. + * + * @since 4.7.0 + * + * @param bool|string|int $value The value being evaluated. + * @return bool Returns the proper associated boolean value. + */ + function rest_sanitize_boolean($value) + { + } + /** + * Determines if a given value is boolean-like. + * + * @since 4.7.0 + * + * @param bool|string $maybe_bool The value being evaluated. + * @return bool True if a boolean, otherwise false. + */ + function rest_is_boolean($maybe_bool) + { + } + /** + * Determines if a given value is integer-like. + * + * @since 5.5.0 + * + * @param mixed $maybe_integer The value being evaluated. + * @return bool True if an integer, otherwise false. + */ + function rest_is_integer($maybe_integer) + { + } + /** + * Determines if a given value is array-like. + * + * @since 5.5.0 + * + * @param mixed $maybe_array The value being evaluated. + * @return bool + */ + function rest_is_array($maybe_array) + { + } + /** + * Converts an array-like value to an array. + * + * @since 5.5.0 + * + * @param mixed $maybe_array The value being evaluated. + * @return array Returns the array extracted from the value. + */ + function rest_sanitize_array($maybe_array) + { + } + /** + * Determines if a given value is object-like. + * + * @since 5.5.0 + * + * @param mixed $maybe_object The value being evaluated. + * @return bool True if object like, otherwise false. + */ + function rest_is_object($maybe_object) + { + } + /** + * Converts an object-like value to an array. + * + * @since 5.5.0 + * + * @param mixed $maybe_object The value being evaluated. + * @return array Returns the object extracted from the value as an associative array. + */ + function rest_sanitize_object($maybe_object) + { + } + /** + * Gets the best type for a value. + * + * @since 5.5.0 + * + * @param mixed $value The value to check. + * @param string[] $types The list of possible types. + * @return string The best matching type, an empty string if no types match. + */ + function rest_get_best_type_for_value($value, $types) + { + } + /** + * Handles getting the best type for a multi-type schema. + * + * This is a wrapper for {@see rest_get_best_type_for_value()} that handles + * backward compatibility for schemas that use invalid types. + * + * @since 5.5.0 + * + * @param mixed $value The value to check. + * @param array $args The schema array to use. + * @param string $param The parameter name, used in error messages. + * @return string + */ + function rest_handle_multi_type_schema($value, $args, $param = '') + { + } + /** + * Checks if an array is made up of unique items. + * + * @since 5.5.0 + * + * @param array $input_array The array to check. + * @return bool True if the array contains unique items, false otherwise. + */ + function rest_validate_array_contains_unique_items($input_array) + { + } + /** + * Stabilizes a value following JSON Schema semantics. + * + * For lists, order is preserved. For objects, properties are reordered alphabetically. + * + * @since 5.5.0 + * + * @param mixed $value The value to stabilize. Must already be sanitized. Objects should have been converted to arrays. + * @return mixed The stabilized value. + */ + function rest_stabilize_value($value) + { + } + /** + * Validates if the JSON Schema pattern matches a value. + * + * @since 5.6.0 + * + * @param string $pattern The pattern to match against. + * @param string $value The value to check. + * @return bool True if the pattern matches the given value, false otherwise. + */ + function rest_validate_json_schema_pattern($pattern, $value) + { + } + /** + * Finds the schema for a property using the patternProperties keyword. + * + * @since 5.6.0 + * + * @param string $property The property name to check. + * @param array $args The schema array to use. + * @return array|null The schema of matching pattern property, or null if no patterns match. + */ + function rest_find_matching_pattern_property_schema($property, $args) + { + } + /** + * Formats a combining operation error into a WP_Error object. + * + * @since 5.6.0 + * + * @param string $param The parameter name. + * @param array $error The error details. + * @return WP_Error + */ + function rest_format_combining_operation_error($param, $error) + { + } + /** + * Gets the error of combining operation. + * + * @since 5.6.0 + * + * @param array $value The value to validate. + * @param string $param The parameter name, used in error messages. + * @param array $errors The errors array, to search for possible error. + * @return WP_Error The combining operation error. + */ + function rest_get_combining_operation_error($value, $param, $errors) + { + } + /** + * Finds the matching schema among the "anyOf" schemas. + * + * @since 5.6.0 + * + * @param mixed $value The value to validate. + * @param array $args The schema array to use. + * @param string $param The parameter name, used in error messages. + * @return array|WP_Error The matching schema or WP_Error instance if all schemas do not match. + */ + function rest_find_any_matching_schema($value, $args, $param) + { + } + /** + * Finds the matching schema among the "oneOf" schemas. + * + * @since 5.6.0 + * + * @param mixed $value The value to validate. + * @param array $args The schema array to use. + * @param string $param The parameter name, used in error messages. + * @param bool $stop_after_first_match Optional. Whether the process should stop after the first successful match. + * @return array|WP_Error The matching schema or WP_Error instance if the number of matching schemas is not equal to one. + */ + function rest_find_one_matching_schema($value, $args, $param, $stop_after_first_match = \false) + { + } + /** + * Checks the equality of two values, following JSON Schema semantics. + * + * Property order is ignored for objects. + * + * Values must have been previously sanitized/coerced to their native types. + * + * @since 5.7.0 + * + * @param mixed $value1 The first value to check. + * @param mixed $value2 The second value to check. + * @return bool True if the values are equal or false otherwise. + */ + function rest_are_values_equal($value1, $value2) + { + } + /** + * Validates that the given value is a member of the JSON Schema "enum". + * + * @since 5.7.0 + * + * @param mixed $value The value to validate. + * @param array $args The schema array to use. + * @param string $param The parameter name, used in error messages. + * @return true|WP_Error True if the "enum" contains the value or a WP_Error instance otherwise. + */ + function rest_validate_enum($value, $args, $param) + { + } + /** + * Get all valid JSON schema properties. + * + * @since 5.6.0 + * + * @return string[] All valid JSON schema properties. + */ + function rest_get_allowed_schema_keywords() + { + } + /** + * Validate a value based on a schema. + * + * @since 4.7.0 + * @since 4.9.0 Support the "object" type. + * @since 5.2.0 Support validating "additionalProperties" against a schema. + * @since 5.3.0 Support multiple types. + * @since 5.4.0 Convert an empty string to an empty object. + * @since 5.5.0 Add the "uuid" and "hex-color" formats. + * Support the "minLength", "maxLength" and "pattern" keywords for strings. + * Support the "minItems", "maxItems" and "uniqueItems" keywords for arrays. + * Validate required properties. + * @since 5.6.0 Support the "minProperties" and "maxProperties" keywords for objects. + * Support the "multipleOf" keyword for numbers and integers. + * Support the "patternProperties" keyword for objects. + * Support the "anyOf" and "oneOf" keywords. + * + * @param mixed $value The value to validate. + * @param array $args Schema array to use for validation. + * @param string $param The parameter name, used in error messages. + * @return true|WP_Error + */ + function rest_validate_value_from_schema($value, $args, $param = '') + { + } + /** + * Validates a null value based on a schema. + * + * @since 5.7.0 + * + * @param mixed $value The value to validate. + * @param string $param The parameter name, used in error messages. + * @return true|WP_Error + */ + function rest_validate_null_value_from_schema($value, $param) + { + } + /** + * Validates a boolean value based on a schema. + * + * @since 5.7.0 + * + * @param mixed $value The value to validate. + * @param string $param The parameter name, used in error messages. + * @return true|WP_Error + */ + function rest_validate_boolean_value_from_schema($value, $param) + { + } + /** + * Validates an object value based on a schema. + * + * @since 5.7.0 + * + * @param mixed $value The value to validate. + * @param array $args Schema array to use for validation. + * @param string $param The parameter name, used in error messages. + * @return true|WP_Error + */ + function rest_validate_object_value_from_schema($value, $args, $param) + { + } + /** + * Validates an array value based on a schema. + * + * @since 5.7.0 + * + * @param mixed $value The value to validate. + * @param array $args Schema array to use for validation. + * @param string $param The parameter name, used in error messages. + * @return true|WP_Error + */ + function rest_validate_array_value_from_schema($value, $args, $param) + { + } + /** + * Validates a number value based on a schema. + * + * @since 5.7.0 + * + * @param mixed $value The value to validate. + * @param array $args Schema array to use for validation. + * @param string $param The parameter name, used in error messages. + * @return true|WP_Error + */ + function rest_validate_number_value_from_schema($value, $args, $param) + { + } + /** + * Validates a string value based on a schema. + * + * @since 5.7.0 + * + * @param mixed $value The value to validate. + * @param array $args Schema array to use for validation. + * @param string $param The parameter name, used in error messages. + * @return true|WP_Error + */ + function rest_validate_string_value_from_schema($value, $args, $param) + { + } + /** + * Validates an integer value based on a schema. + * + * @since 5.7.0 + * + * @param mixed $value The value to validate. + * @param array $args Schema array to use for validation. + * @param string $param The parameter name, used in error messages. + * @return true|WP_Error + */ + function rest_validate_integer_value_from_schema($value, $args, $param) + { + } + /** + * Sanitize a value based on a schema. + * + * @since 4.7.0 + * @since 5.5.0 Added the `$param` parameter. + * @since 5.6.0 Support the "anyOf" and "oneOf" keywords. + * @since 5.9.0 Added `text-field` and `textarea-field` formats. + * + * @param mixed $value The value to sanitize. + * @param array $args Schema array to use for sanitization. + * @param string $param The parameter name, used in error messages. + * @return mixed|WP_Error The sanitized value or a WP_Error instance if the value cannot be safely sanitized. + */ + function rest_sanitize_value_from_schema($value, $args, $param = '') + { + } + /** + * Append result of internal request to REST API for purpose of preloading data to be attached to a page. + * Expected to be called in the context of `array_reduce`. + * + * @since 5.0.0 + * + * @param array $memo Reduce accumulator. + * @param string $path REST API path to preload. + * @return array Modified reduce accumulator. + */ + function rest_preload_api_request($memo, $path) + { + } + /** + * Parses the "_embed" parameter into the list of resources to embed. + * + * @since 5.4.0 + * + * @param string|array $embed Raw "_embed" parameter value. + * @return true|string[] Either true to embed all embeds, or a list of relations to embed. + */ + function rest_parse_embed_param($embed) + { + } + /** + * Filters the response to remove any fields not available in the given context. + * + * @since 5.5.0 + * @since 5.6.0 Support the "patternProperties" keyword for objects. + * Support the "anyOf" and "oneOf" keywords. + * + * @param array|object $response_data The response data to modify. + * @param array $schema The schema for the endpoint used to filter the response. + * @param string $context The requested context. + * @return array|object The filtered response data. + */ + function rest_filter_response_by_context($response_data, $schema, $context) + { + } + /** + * Sets the "additionalProperties" to false by default for all object definitions in the schema. + * + * @since 5.5.0 + * @since 5.6.0 Support the "patternProperties" keyword. + * + * @param array $schema The schema to modify. + * @return array The modified schema. + */ + function rest_default_additional_properties_to_false($schema) + { + } + /** + * Gets the REST API route for a post. + * + * @since 5.5.0 + * + * @param int|WP_Post $post Post ID or post object. + * @return string The route path with a leading slash for the given post, + * or an empty string if there is not a route. + */ + function rest_get_route_for_post($post) + { + } + /** + * Gets the REST API route for a post type. + * + * @since 5.9.0 + * + * @param string $post_type The name of a registered post type. + * @return string The route path with a leading slash for the given post type, + * or an empty string if there is not a route. + */ + function rest_get_route_for_post_type_items($post_type) + { + } + /** + * Gets the REST API route for a term. + * + * @since 5.5.0 + * + * @param int|WP_Term $term Term ID or term object. + * @return string The route path with a leading slash for the given term, + * or an empty string if there is not a route. + */ + function rest_get_route_for_term($term) + { + } + /** + * Gets the REST API route for a taxonomy. + * + * @since 5.9.0 + * + * @param string $taxonomy Name of taxonomy. + * @return string The route path with a leading slash for the given taxonomy. + */ + function rest_get_route_for_taxonomy_items($taxonomy) + { + } + /** + * Gets the REST route for the currently queried object. + * + * @since 5.5.0 + * + * @return string The REST route of the resource, or an empty string if no resource identified. + */ + function rest_get_queried_resource_route() + { + } + /** + * Retrieves an array of endpoint arguments from the item schema and endpoint method. + * + * @since 5.6.0 + * + * @param array $schema The full JSON schema for the endpoint. + * @param string $method Optional. HTTP method of the endpoint. The arguments for `CREATABLE` endpoints are + * checked for required values and may fall-back to a given default, this is not done + * on `EDITABLE` endpoints. Default WP_REST_Server::CREATABLE. + * @return array The endpoint arguments. + */ + function rest_get_endpoint_args_for_schema($schema, $method = \WP_REST_Server::CREATABLE) + { + } + /** + * Converts an error to a response object. + * + * This iterates over all error codes and messages to change it into a flat + * array. This enables simpler client behavior, as it is represented as a + * list in JSON rather than an object/map. + * + * @since 5.7.0 + * + * @param WP_Error $error WP_Error instance. + * + * @return WP_REST_Response List of associative arrays with code and message keys. + */ + function rest_convert_error_to_response($error) + { + } + /** + * Checks whether a REST API endpoint request is currently being handled. + * + * This may be a standalone REST API request, or an internal request dispatched from within a regular page load. + * + * @since 6.5.0 + * + * @global WP_REST_Server $wp_rest_server REST server instance. + * + * @return bool True if a REST endpoint request is currently being handled, false otherwise. + */ + function wp_is_rest_endpoint() + { + } + /** + * Post revision functions. + * + * @package WordPress + * @subpackage Post_Revisions + */ + /** + * Determines which fields of posts are to be saved in revisions. + * + * @since 2.6.0 + * @since 4.5.0 A `WP_Post` object can now be passed to the `$post` parameter. + * @since 4.5.0 The optional `$autosave` parameter was deprecated and renamed to `$deprecated`. + * @access private + * + * @param array|WP_Post $post Optional. A post array or a WP_Post object being processed + * for insertion as a post revision. Default empty array. + * @param bool $deprecated Not used. + * @return string[] Array of fields that can be versioned. + */ + function _wp_post_revision_fields($post = array(), $deprecated = \false) + { + } + /** + * Returns a post array ready to be inserted into the posts table as a post revision. + * + * @since 4.5.0 + * @access private + * + * @param array|WP_Post $post Optional. A post array or a WP_Post object to be processed + * for insertion as a post revision. Default empty array. + * @param bool $autosave Optional. Is the revision an autosave? Default false. + * @return array Post array ready to be inserted as a post revision. + */ + function _wp_post_revision_data($post = array(), $autosave = \false) + { + } + /** + * Saves revisions for a post after all changes have been made. + * + * @since 6.4.0 + * + * @param int $post_id The post id that was inserted. + * @param WP_Post $post The post object that was inserted. + * @param bool $update Whether this insert is updating an existing post. + * @phpstan-return void + */ + function wp_save_post_revision_on_insert($post_id, $post, $update) + { + } + /** + * Creates a revision for the current version of a post. + * + * Typically used immediately after a post update, as every update is a revision, + * and the most recent revision always matches the current post. + * + * @since 2.6.0 + * + * @param int $post_id The ID of the post to save as a revision. + * @return int|WP_Error|void Void or 0 if error, new revision ID, if success. + */ + function wp_save_post_revision($post_id) + { + } + /** + * Retrieves the autosaved data of the specified post. + * + * Returns a post object with the information that was autosaved for the specified post. + * If the optional $user_id is passed, returns the autosave for that user, otherwise + * returns the latest autosave. + * + * @since 2.6.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $post_id The post ID. + * @param int $user_id Optional. The post author ID. Default 0. + * @return WP_Post|false The autosaved data or false on failure or when no autosave exists. + */ + function wp_get_post_autosave($post_id, $user_id = 0) + { + } + /** + * Determines if the specified post is a revision. + * + * @since 2.6.0 + * + * @param int|WP_Post $post Post ID or post object. + * @return int|false ID of revision's parent on success, false if not a revision. + */ + function wp_is_post_revision($post) + { + } + /** + * Determines if the specified post is an autosave. + * + * @since 2.6.0 + * + * @param int|WP_Post $post Post ID or post object. + * @return int|false ID of autosave's parent on success, false if not a revision. + */ + function wp_is_post_autosave($post) + { + } + /** + * Inserts post data into the posts table as a post revision. + * + * @since 2.6.0 + * @access private + * + * @param int|WP_Post|array|null $post Post ID, post object OR post array. + * @param bool $autosave Optional. Whether the revision is an autosave or not. + * Default false. + * @return int|WP_Error WP_Error or 0 if error, new revision ID if success. + */ + function _wp_put_post_revision($post = \null, $autosave = \false) + { + } + /** + * Save the revisioned meta fields. + * + * @since 6.4.0 + * + * @param int $revision_id The ID of the revision to save the meta to. + * @param int $post_id The ID of the post the revision is associated with. + * @phpstan-return void + */ + function wp_save_revisioned_meta_fields($revision_id, $post_id) + { + } + /** + * Gets a post revision. + * + * @since 2.6.0 + * + * @param int|WP_Post $post Post ID or post object. + * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which + * correspond to a WP_Post object, an associative array, or a numeric array, + * respectively. Default OBJECT. + * @param string $filter Optional sanitization filter. See sanitize_post(). Default 'raw'. + * @return WP_Post|array|null WP_Post (or array) on success, or null on failure. + */ + function wp_get_post_revision(&$post, $output = \OBJECT, $filter = 'raw') + { + } + /** + * Restores a post to the specified revision. + * + * Can restore a past revision using all fields of the post revision, or only selected fields. + * + * @since 2.6.0 + * + * @param int|WP_Post $revision Revision ID or revision object. + * @param array $fields Optional. What fields to restore from. Defaults to all. + * @return int|false|null Null if error, false if no fields to restore, (int) post ID if success. + */ + function wp_restore_post_revision($revision, $fields = \null) + { + } + /** + * Restore the revisioned meta values for a post. + * + * @since 6.4.0 + * + * @param int $post_id The ID of the post to restore the meta to. + * @param int $revision_id The ID of the revision to restore the meta from. + * @phpstan-return void + */ + function wp_restore_post_revision_meta($post_id, $revision_id) + { + } + /** + * Copy post meta for the given key from one post to another. + * + * @since 6.4.0 + * + * @param int $source_post_id Post ID to copy meta value(s) from. + * @param int $target_post_id Post ID to copy meta value(s) to. + * @param string $meta_key Meta key to copy. + */ + function _wp_copy_post_meta($source_post_id, $target_post_id, $meta_key) + { + } + /** + * Determine which post meta fields should be revisioned. + * + * @since 6.4.0 + * + * @param string $post_type The post type being revisioned. + * @return array An array of meta keys to be revisioned. + */ + function wp_post_revision_meta_keys($post_type) + { + } + /** + * Check whether revisioned post meta fields have changed. + * + * @since 6.4.0 + * + * @param bool $post_has_changed Whether the post has changed. + * @param WP_Post $last_revision The last revision post object. + * @param WP_Post $post The post object. + * @return bool Whether the post has changed. + */ + function wp_check_revisioned_meta_fields_have_changed($post_has_changed, \WP_Post $last_revision, \WP_Post $post) + { + } + /** + * Deletes a revision. + * + * Deletes the row from the posts table corresponding to the specified revision. + * + * @since 2.6.0 + * + * @param int|WP_Post $revision Revision ID or revision object. + * @return WP_Post|false|null Null or false if error, deleted post object if success. + */ + function wp_delete_post_revision($revision) + { + } + /** + * Returns all revisions of specified post. + * + * @since 2.6.0 + * + * @see get_children() + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`. + * @param array|null $args Optional. Arguments for retrieving post revisions. Default null. + * @return WP_Post[]|int[] Array of revision objects or IDs, or an empty array if none. + */ + function wp_get_post_revisions($post = 0, $args = \null) + { + } + /** + * Returns the latest revision ID and count of revisions for a post. + * + * @since 6.1.0 + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. + * @return array|WP_Error { + * Returns associative array with latest revision ID and total count, + * or a WP_Error if the post does not exist or revisions are not enabled. + * + * @type int $latest_id The latest revision post ID or 0 if no revisions exist. + * @type int $count The total count of revisions for the given post. + * } + * @phpstan-return \WP_Error|array{ + * latest_id: int, + * count: int, + * } + */ + function wp_get_latest_revision_id_and_total_count($post = 0) + { + } + /** + * Returns the url for viewing and potentially restoring revisions of a given post. + * + * @since 5.9.0 + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`. + * @return string|null The URL for editing revisions on the given post, otherwise null. + */ + function wp_get_post_revisions_url($post = 0) + { + } + /** + * Determines whether revisions are enabled for a given post. + * + * @since 3.6.0 + * + * @param WP_Post $post The post object. + * @return bool True if number of revisions to keep isn't zero, false otherwise. + */ + function wp_revisions_enabled($post) + { + } + /** + * Determines how many revisions to retain for a given post. + * + * By default, an infinite number of revisions are kept. + * + * The constant WP_POST_REVISIONS can be set in wp-config to specify the limit + * of revisions to keep. + * + * @since 3.6.0 + * + * @param WP_Post $post The post object. + * @return int The number of revisions to keep. + */ + function wp_revisions_to_keep($post) + { + } + /** + * Sets up the post object for preview based on the post autosave. + * + * @since 2.7.0 + * @access private + * + * @param WP_Post $post + * @return WP_Post|false + */ + function _set_preview($post) + { + } + /** + * Filters the latest content for preview from the post autosave. + * + * @since 2.7.0 + * @access private + */ + function _show_post_preview() + { + } + /** + * Filters terms lookup to set the post format. + * + * @since 3.6.0 + * @access private + * + * @param array $terms + * @param int $post_id + * @param string $taxonomy + * @return array + */ + function _wp_preview_terms_filter($terms, $post_id, $taxonomy) + { + } + /** + * Filters post thumbnail lookup to set the post thumbnail. + * + * @since 4.6.0 + * @access private + * + * @param null|array|string $value The value to return - a single metadata value, or an array of values. + * @param int $post_id Post ID. + * @param string $meta_key Meta key. + * @return null|array The default return value or the post thumbnail meta array. + */ + function _wp_preview_post_thumbnail_filter($value, $post_id, $meta_key) + { + } + /** + * Gets the post revision version. + * + * @since 3.6.0 + * @access private + * + * @param WP_Post $revision + * @return int|false + */ + function _wp_get_post_revision_version($revision) + { + } + /** + * Upgrades the revisions author, adds the current post as a revision and sets the revisions version to 1. + * + * @since 3.6.0 + * @access private + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param WP_Post $post Post object. + * @param array $revisions Current revisions of the post. + * @return bool true if the revisions were upgraded, false if problems. + */ + function _wp_upgrade_revisions_of_post($post, $revisions) + { + } + /** + * Filters preview post meta retrieval to get values from the autosave. + * + * Filters revisioned meta keys only. + * + * @since 6.4.0 + * + * @param mixed $value Meta value to filter. + * @param int $object_id Object ID. + * @param string $meta_key Meta key to filter a value for. + * @param bool $single Whether to return a single value. Default false. + * @return mixed Original meta value if the meta key isn't revisioned, the object doesn't exist, + * the post type is a revision or the post ID doesn't match the object ID. + * Otherwise, the revisioned meta value is returned for the preview. + */ + function _wp_preview_meta_filter($value, $object_id, $meta_key, $single) + { + } + /** + * Adds a rewrite rule that transforms a URL structure to a set of query vars. + * + * Any value in the $after parameter that isn't 'bottom' will result in the rule + * being placed at the top of the rewrite rules. + * + * @since 2.1.0 + * @since 4.4.0 Array support was added to the `$query` parameter. + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param string $regex Regular expression to match request against. + * @param string|array $query The corresponding query vars for this rewrite rule. + * @param string $after Optional. Priority of the new rule. Accepts 'top' + * or 'bottom'. Default 'bottom'. + * @phpstan-param 'top'|'bottom' $after + */ + function add_rewrite_rule($regex, $query, $after = 'bottom') + { + } + /** + * Adds a new rewrite tag (like %postname%). + * + * The `$query` parameter is optional. If it is omitted you must ensure that you call + * this on, or before, the {@see 'init'} hook. This is because `$query` defaults to + * `$tag=`, and for this to work a new query var has to be added. + * + * @since 2.1.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * @global WP $wp Current WordPress environment instance. + * + * @param string $tag Name of the new rewrite tag. + * @param string $regex Regular expression to substitute the tag for in rewrite rules. + * @param string $query Optional. String to append to the rewritten query. Must end in '='. Default empty. + * @phpstan-return void + */ + function add_rewrite_tag($tag, $regex, $query = '') + { + } + /** + * Removes an existing rewrite tag (like %postname%). + * + * @since 4.5.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param string $tag Name of the rewrite tag. + */ + function remove_rewrite_tag($tag) + { + } + /** + * Adds a permalink structure. + * + * @since 3.0.0 + * + * @see WP_Rewrite::add_permastruct() + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param string $name Name for permalink structure. + * @param string $struct Permalink structure. + * @param array $args Optional. Arguments for building the rules from the permalink structure, + * see WP_Rewrite::add_permastruct() for full details. Default empty array. + * @phpstan-param array{ + * with_front?: bool, + * ep_mask?: int, + * paged?: bool, + * feed?: bool, + * forcomments?: bool, + * walk_dirs?: bool, + * endpoints?: bool, + * } $args See WP_Rewrite::add_permastruct() + */ + function add_permastruct($name, $struct, $args = array()) + { + } + /** + * Removes a permalink structure. + * + * Can only be used to remove permastructs that were added using add_permastruct(). + * Built-in permastructs cannot be removed. + * + * @since 4.5.0 + * + * @see WP_Rewrite::remove_permastruct() + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param string $name Name for permalink structure. + */ + function remove_permastruct($name) + { + } + /** + * Adds a new feed type like /atom1/. + * + * @since 2.1.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param string $feedname Feed name. + * @param callable $callback Callback to run on feed display. + * @return string Feed action name. + */ + function add_feed($feedname, $callback) + { + } + /** + * Removes rewrite rules and then recreate rewrite rules. + * + * @since 3.0.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param bool $hard Whether to update .htaccess (hard flush) or just update + * rewrite_rules option (soft flush). Default is true (hard). + */ + function flush_rewrite_rules($hard = \true) + { + } + /** + * Adds an endpoint, like /trackback/. + * + * Adding an endpoint creates extra rewrite rules for each of the matching + * places specified by the provided bitmask. For example: + * + * add_rewrite_endpoint( 'json', EP_PERMALINK | EP_PAGES ); + * + * will add a new rewrite rule ending with "json(/(.*))?/?$" for every permastruct + * that describes a permalink (post) or page. This is rewritten to "json=$match" + * where $match is the part of the URL matched by the endpoint regex (e.g. "foo" in + * "[permalink]/json/foo/"). + * + * A new query var with the same name as the endpoint will also be created. + * + * When specifying $places ensure that you are using the EP_* constants (or a + * combination of them using the bitwise OR operator) as their values are not + * guaranteed to remain static (especially `EP_ALL`). + * + * Be sure to flush the rewrite rules - see flush_rewrite_rules() - when your plugin gets + * activated and deactivated. + * + * @since 2.1.0 + * @since 4.3.0 Added support for skipping query var registration by passing `false` to `$query_var`. + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param string $name Name of the endpoint. + * @param int $places Endpoint mask describing the places the endpoint should be added. + * Accepts a mask of: + * - `EP_ALL` + * - `EP_NONE` + * - `EP_ALL_ARCHIVES` + * - `EP_ATTACHMENT` + * - `EP_AUTHORS` + * - `EP_CATEGORIES` + * - `EP_COMMENTS` + * - `EP_DATE` + * - `EP_DAY` + * - `EP_MONTH` + * - `EP_PAGES` + * - `EP_PERMALINK` + * - `EP_ROOT` + * - `EP_SEARCH` + * - `EP_TAGS` + * - `EP_YEAR` + * @param string|bool $query_var Name of the corresponding query variable. Pass `false` to skip registering a query_var + * for this endpoint. Defaults to the value of `$name`. + */ + function add_rewrite_endpoint($name, $places, $query_var = \true) + { + } + /** + * Filters the URL base for taxonomies. + * + * To remove any manually prepended /index.php/. + * + * @access private + * @since 2.6.0 + * + * @param string $base The taxonomy base that we're going to filter + * @return string + */ + function _wp_filter_taxonomy_base($base) + { + } + /** + * Resolves numeric slugs that collide with date permalinks. + * + * Permalinks of posts with numeric slugs can sometimes look to WP_Query::parse_query() + * like a date archive, as when your permalink structure is `/%year%/%postname%/` and + * a post with post_name '05' has the URL `/2015/05/`. + * + * This function detects conflicts of this type and resolves them in favor of the + * post permalink. + * + * Note that, since 4.3.0, wp_unique_post_slug() prevents the creation of post slugs + * that would result in a date archive conflict. The resolution performed in this + * function is primarily for legacy content, as well as cases when the admin has changed + * the site's permalink structure in a way that introduces URL conflicts. + * + * @since 4.3.0 + * + * @param array $query_vars Optional. Query variables for setting up the loop, as determined in + * WP::parse_request(). Default empty array. + * @return array Returns the original array of query vars, with date/post conflicts resolved. + */ + function wp_resolve_numeric_slug_conflicts($query_vars = array()) + { + } + /** + * Examines a URL and try to determine the post ID it represents. + * + * Checks are supposedly from the hosted site blog. + * + * @since 1.0.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * @global WP $wp Current WordPress environment instance. + * + * @param string $url Permalink to check. + * @return int Post ID, or 0 on failure. + */ + function url_to_postid($url) + { + } + /** + * Robots template functions. + * + * @package WordPress + * @subpackage Robots + * @since 5.7.0 + */ + /** + * Displays the robots meta tag as necessary. + * + * Gathers robots directives to include for the current context, using the + * {@see 'wp_robots'} filter. The directives are then sanitized, and the + * robots meta tag is output if there is at least one relevant directive. + * + * @since 5.7.0 + * @since 5.7.1 No longer prevents specific directives to occur together. + * @phpstan-return void + */ + function wp_robots() + { + } + /** + * Adds `noindex` to the robots meta tag if required by the site configuration. + * + * If a blog is marked as not being public then noindex will be output to + * tell web robots not to index the page content. Add this to the + * {@see 'wp_robots'} filter. + * + * Typical usage is as a {@see 'wp_robots'} callback: + * + * add_filter( 'wp_robots', 'wp_robots_noindex' ); + * + * @since 5.7.0 + * + * @see wp_robots_no_robots() + * + * @param array $robots Associative array of robots directives. + * @return array Filtered robots directives. + */ + function wp_robots_noindex(array $robots) + { + } + /** + * Adds `noindex` to the robots meta tag for embeds. + * + * Typical usage is as a {@see 'wp_robots'} callback: + * + * add_filter( 'wp_robots', 'wp_robots_noindex_embeds' ); + * + * @since 5.7.0 + * + * @see wp_robots_no_robots() + * + * @param array $robots Associative array of robots directives. + * @return array Filtered robots directives. + */ + function wp_robots_noindex_embeds(array $robots) + { + } + /** + * Adds `noindex` to the robots meta tag if a search is being performed. + * + * If a search is being performed then noindex will be output to + * tell web robots not to index the page content. Add this to the + * {@see 'wp_robots'} filter. + * + * Typical usage is as a {@see 'wp_robots'} callback: + * + * add_filter( 'wp_robots', 'wp_robots_noindex_search' ); + * + * @since 5.7.0 + * + * @see wp_robots_no_robots() + * + * @param array $robots Associative array of robots directives. + * @return array Filtered robots directives. + */ + function wp_robots_noindex_search(array $robots) + { + } + /** + * Adds `noindex` to the robots meta tag. + * + * This directive tells web robots not to index the page content. + * + * Typical usage is as a {@see 'wp_robots'} callback: + * + * add_filter( 'wp_robots', 'wp_robots_no_robots' ); + * + * @since 5.7.0 + * + * @param array $robots Associative array of robots directives. + * @return array Filtered robots directives. + */ + function wp_robots_no_robots(array $robots) + { + } + /** + * Adds `noindex` and `noarchive` to the robots meta tag. + * + * This directive tells web robots not to index or archive the page content and + * is recommended to be used for sensitive pages. + * + * Typical usage is as a {@see 'wp_robots'} callback: + * + * add_filter( 'wp_robots', 'wp_robots_sensitive_page' ); + * + * @since 5.7.0 + * + * @param array $robots Associative array of robots directives. + * @return array Filtered robots directives. + */ + function wp_robots_sensitive_page(array $robots) + { + } + /** + * Adds `max-image-preview:large` to the robots meta tag. + * + * This directive tells web robots that large image previews are allowed to be + * displayed, e.g. in search engines, unless the blog is marked as not being public. + * + * Typical usage is as a {@see 'wp_robots'} callback: + * + * add_filter( 'wp_robots', 'wp_robots_max_image_preview_large' ); + * + * @since 5.7.0 + * + * @param array $robots Associative array of robots directives. + * @return array Filtered robots directives. + */ + function wp_robots_max_image_preview_large(array $robots) + { + } + /** + * Registers TinyMCE scripts. + * + * @since 5.0.0 + * + * @global string $tinymce_version + * @global bool $concatenate_scripts + * @global bool $compress_scripts + * + * @param WP_Scripts $scripts WP_Scripts object. + * @param bool $force_uncompressed Whether to forcibly prevent gzip compression. Default false. + */ + function wp_register_tinymce_scripts($scripts, $force_uncompressed = \false) + { + } + /** + * Registers all the WordPress vendor scripts that are in the standardized + * `js/dist/vendor/` location. + * + * For the order of `$scripts->add` see `wp_default_scripts`. + * + * @since 5.0.0 + * + * @global WP_Locale $wp_locale WordPress date and time locale object. + * + * @param WP_Scripts $scripts WP_Scripts object. + */ + function wp_default_packages_vendor($scripts) + { + } + /** + * Returns contents of an inline script used in appending polyfill scripts for + * browsers which fail the provided tests. The provided array is a mapping from + * a condition to verify feature support to its polyfill script handle. + * + * @since 5.0.0 + * + * @param WP_Scripts $scripts WP_Scripts object. + * @param string[] $tests Features to detect. + * @return string Conditional polyfill inline script. + */ + function wp_get_script_polyfill($scripts, $tests) + { + } + /** + * Registers development scripts that integrate with `@wordpress/scripts`. + * + * @see https://github.com/WordPress/gutenberg/tree/trunk/packages/scripts#start + * + * @since 6.0.0 + * + * @param WP_Scripts $scripts WP_Scripts object. + * @phpstan-return void + */ + function wp_register_development_scripts($scripts) + { + } + /** + * Registers all the WordPress packages scripts that are in the standardized + * `js/dist/` location. + * + * For the order of `$scripts->add` see `wp_default_scripts`. + * + * @since 5.0.0 + * + * @param WP_Scripts $scripts WP_Scripts object. + */ + function wp_default_packages_scripts($scripts) + { + } + /** + * Adds inline scripts required for the WordPress JavaScript packages. + * + * @since 5.0.0 + * @since 6.4.0 Added relative time strings for the `wp-date` inline script output. + * + * @global WP_Locale $wp_locale WordPress date and time locale object. + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param WP_Scripts $scripts WP_Scripts object. + */ + function wp_default_packages_inline_scripts($scripts) + { + } + /** + * Adds inline scripts required for the TinyMCE in the block editor. + * + * These TinyMCE init settings are used to extend and override the default settings + * from `_WP_Editors::default_settings()` for the Classic block. + * + * @since 5.0.0 + * + * @global WP_Scripts $wp_scripts + */ + function wp_tinymce_inline_scripts() + { + } + /** + * Registers all the WordPress packages scripts. + * + * @since 5.0.0 + * + * @param WP_Scripts $scripts WP_Scripts object. + */ + function wp_default_packages($scripts) + { + } + /** + * Returns the suffix that can be used for the scripts. + * + * There are two suffix types, the normal one and the dev suffix. + * + * @since 5.0.0 + * + * @param string $type The type of suffix to retrieve. + * @return string The script suffix. + */ + function wp_scripts_get_suffix($type = '') + { + } + /** + * Registers all WordPress scripts. + * + * Localizes some of them. + * args order: `$scripts->add( 'handle', 'url', 'dependencies', 'query-string', 1 );` + * when last arg === 1 queues the script for the footer + * + * @since 2.6.0 + * + * @param WP_Scripts $scripts WP_Scripts object. + */ + function wp_default_scripts($scripts) + { + } + /** + * Assigns default styles to $styles object. + * + * Nothing is returned, because the $styles parameter is passed by reference. + * Meaning that whatever object is passed will be updated without having to + * reassign the variable that was passed back to the same value. This saves + * memory. + * + * Adding default styles is not the only task, it also assigns the base_url + * property, the default version, and text direction for the object. + * + * @since 2.6.0 + * + * @global array $editor_styles + * + * @param WP_Styles $styles + */ + function wp_default_styles($styles) + { + } + /** + * Reorders JavaScript scripts array to place prototype before jQuery. + * + * @since 2.3.1 + * + * @param string[] $js_array JavaScript scripts array + * @return string[] Reordered array, if needed. + */ + function wp_prototype_before_jquery($js_array) + { + } + /** + * Loads localized data on print rather than initialization. + * + * These localizations require information that may not be loaded even by init. + * + * @since 2.5.0 + * + * @global array $shortcode_tags + */ + function wp_just_in_time_script_localization() + { + } + /** + * Localizes the jQuery UI datepicker. + * + * @since 4.6.0 + * + * @link https://api.jqueryui.com/datepicker/#options + * + * @global WP_Locale $wp_locale WordPress date and time locale object. + * @phpstan-return void + */ + function wp_localize_jquery_ui_datepicker() + { + } + /** + * Localizes community events data that needs to be passed to dashboard.js. + * + * @since 4.8.0 + * @phpstan-return void + */ + function wp_localize_community_events() + { + } + /** + * Administration Screen CSS for changing the styles. + * + * If installing the 'wp-admin/' directory will be replaced with './'. + * + * The $_wp_admin_css_colors global manages the Administration Screens CSS + * stylesheet that is loaded. The option that is set is 'admin_color' and is the + * color and key for the array. The value for the color key is an object with + * a 'url' parameter that has the URL path to the CSS file. + * + * The query from $src parameter will be appended to the URL that is given from + * the $_wp_admin_css_colors array value URL. + * + * @since 2.6.0 + * + * @global array $_wp_admin_css_colors + * + * @param string $src Source URL. + * @param string $handle Either 'colors' or 'colors-rtl'. + * @return string|false URL path to CSS stylesheet for Administration Screens. + * @phpstan-param 'colors'|'colors-rtl' $handle + */ + function wp_style_loader_src($src, $handle) + { + } + /** + * Prints the script queue in the HTML head on admin pages. + * + * Postpones the scripts that were queued for the footer. + * print_footer_scripts() is called in the footer to print these scripts. + * + * @since 2.8.0 + * + * @see wp_print_scripts() + * + * @global bool $concatenate_scripts + * + * @return array + */ + function print_head_scripts() + { + } + /** + * Prints the scripts that were queued for the footer or too late for the HTML head. + * + * @since 2.8.0 + * + * @global WP_Scripts $wp_scripts + * @global bool $concatenate_scripts + * + * @return array + */ + function print_footer_scripts() + { + } + /** + * Prints scripts (internal use only) + * + * @ignore + * + * @global WP_Scripts $wp_scripts + * @global bool $compress_scripts + */ + function _print_scripts() + { + } + /** + * Prints the script queue in the HTML head on the front end. + * + * Postpones the scripts that were queued for the footer. + * wp_print_footer_scripts() is called in the footer to print these scripts. + * + * @since 2.8.0 + * + * @global WP_Scripts $wp_scripts + * + * @return array + */ + function wp_print_head_scripts() + { + } + /** + * Private, for use in *_footer_scripts hooks + * + * @since 3.3.0 + */ + function _wp_footer_scripts() + { + } + /** + * Hooks to print the scripts and styles in the footer. + * + * @since 2.8.0 + */ + function wp_print_footer_scripts() + { + } + /** + * Wrapper for do_action( 'wp_enqueue_scripts' ). + * + * Allows plugins to queue scripts for the front end using wp_enqueue_script(). + * Runs first in wp_head() where all is_home(), is_page(), etc. functions are available. + * + * @since 2.8.0 + */ + function wp_enqueue_scripts() + { + } + /** + * Prints the styles queue in the HTML head on admin pages. + * + * @since 2.8.0 + * + * @global bool $concatenate_scripts + * + * @return array + */ + function print_admin_styles() + { + } + /** + * Prints the styles that were queued too late for the HTML head. + * + * @since 3.3.0 + * + * @global WP_Styles $wp_styles + * @global bool $concatenate_scripts + * + * @return array|void + */ + function print_late_styles() + { + } + /** + * Prints styles (internal use only). + * + * @ignore + * @since 3.3.0 + * + * @global bool $compress_css + */ + function _print_styles() + { + } + /** + * Determines the concatenation and compression settings for scripts and styles. + * + * @since 2.8.0 + * + * @global bool $concatenate_scripts + * @global bool $compress_scripts + * @global bool $compress_css + */ + function script_concat_settings() + { + } + /** + * Handles the enqueueing of block scripts and styles that are common to both + * the editor and the front-end. + * + * @since 5.0.0 + * @phpstan-return void + */ + function wp_common_block_scripts_and_styles() + { + } + /** + * Applies a filter to the list of style nodes that comes from WP_Theme_JSON::get_style_nodes(). + * + * This particular filter removes all of the blocks from the array. + * + * We want WP_Theme_JSON to be ignorant of the implementation details of how the CSS is being used. + * This filter allows us to modify the output of WP_Theme_JSON depending on whether or not we are + * loading separate assets, without making the class aware of that detail. + * + * @since 6.1.0 + * + * @param array $nodes The nodes to filter. + * @return array A filtered array of style nodes. + */ + function wp_filter_out_block_nodes($nodes) + { + } + /** + * Enqueues the global styles defined via theme.json. + * + * @since 5.8.0 + * @phpstan-return void + */ + function wp_enqueue_global_styles() + { + } + /** + * Enqueues the global styles custom css defined via theme.json. + * + * @since 6.2.0 + * @phpstan-return void + */ + function wp_enqueue_global_styles_custom_css() + { + } + /** + * Checks if the editor scripts and styles for all registered block types + * should be enqueued on the current screen. + * + * @since 5.6.0 + * + * @global WP_Screen $current_screen WordPress current screen object. + * + * @return bool Whether scripts and styles should be enqueued. + */ + function wp_should_load_block_editor_scripts_and_styles() + { + } + /** + * Checks whether separate styles should be loaded for core blocks on-render. + * + * When this function returns true, other functions ensure that core blocks + * only load their assets on-render, and each block loads its own, individual + * assets. Third-party blocks only load their assets when rendered. + * + * When this function returns false, all core block assets are loaded regardless + * of whether they are rendered in a page or not, because they are all part of + * the `block-library/style.css` file. Assets for third-party blocks are always + * enqueued regardless of whether they are rendered or not. + * + * This only affects front end and not the block editor screens. + * + * @see wp_enqueue_registered_block_scripts_and_styles() + * @see register_block_style_handle() + * + * @since 5.8.0 + * + * @return bool Whether separate assets will be loaded. + */ + function wp_should_load_separate_core_block_assets() + { + } + /** + * Enqueues registered block scripts and styles, depending on current rendered + * context (only enqueuing editor scripts while in context of the editor). + * + * @since 5.0.0 + * + * @global WP_Screen $current_screen WordPress current screen object. + * @phpstan-return void + */ + function wp_enqueue_registered_block_scripts_and_styles() + { + } + /** + * Function responsible for enqueuing the styles required for block styles functionality on the editor and on the frontend. + * + * @since 5.3.0 + * + * @global WP_Styles $wp_styles + */ + function enqueue_block_styles_assets() + { + } + /** + * Function responsible for enqueuing the assets required for block styles functionality on the editor. + * + * @since 5.3.0 + */ + function enqueue_editor_block_styles_assets() + { + } + /** + * Enqueues the assets required for the block directory within the block editor. + * + * @since 5.5.0 + */ + function wp_enqueue_editor_block_directory_assets() + { + } + /** + * Enqueues the assets required for the format library within the block editor. + * + * @since 5.8.0 + */ + function wp_enqueue_editor_format_library_assets() + { + } + /** + * Sanitizes an attributes array into an attributes string to be placed inside a `<script>` tag. + * + * Automatically injects type attribute if needed. + * Used by {@see wp_get_script_tag()} and {@see wp_get_inline_script_tag()}. + * + * @since 5.7.0 + * + * @param array $attributes Key-value pairs representing `<script>` tag attributes. + * @return string String made of sanitized `<script>` tag attributes. + */ + function wp_sanitize_script_attributes($attributes) + { + } + /** + * Formats `<script>` loader tags. + * + * It is possible to inject attributes in the `<script>` tag via the {@see 'wp_script_attributes'} filter. + * Automatically injects type attribute if needed. + * + * @since 5.7.0 + * + * @param array $attributes Key-value pairs representing `<script>` tag attributes. + * @return string String containing `<script>` opening and closing tags. + */ + function wp_get_script_tag($attributes) + { + } + /** + * Prints formatted `<script>` loader tag. + * + * It is possible to inject attributes in the `<script>` tag via the {@see 'wp_script_attributes'} filter. + * Automatically injects type attribute if needed. + * + * @since 5.7.0 + * + * @param array $attributes Key-value pairs representing `<script>` tag attributes. + */ + function wp_print_script_tag($attributes) + { + } + /** + * Constructs an inline script tag. + * + * It is possible to inject attributes in the `<script>` tag via the {@see 'wp_script_attributes'} filter. + * Automatically injects type attribute if needed. + * + * @since 5.7.0 + * + * @param string $data Data for script tag: JavaScript, importmap, speculationrules, etc. + * @param array $attributes Optional. Key-value pairs representing `<script>` tag attributes. + * @return string String containing inline JavaScript code wrapped around `<script>` tag. + */ + function wp_get_inline_script_tag($data, $attributes = array()) + { + } + /** + * Prints an inline script tag. + * + * It is possible to inject attributes in the `<script>` tag via the {@see 'wp_script_attributes'} filter. + * Automatically injects type attribute if needed. + * + * @since 5.7.0 + * + * @param string $data Data for script tag: JavaScript, importmap, speculationrules, etc. + * @param array $attributes Optional. Key-value pairs representing `<script>` tag attributes. + */ + function wp_print_inline_script_tag($data, $attributes = array()) + { + } + /** + * Allows small styles to be inlined. + * + * This improves performance and sustainability, and is opt-in. Stylesheets can opt in + * by adding `path` data using `wp_style_add_data`, and defining the file's absolute path: + * + * wp_style_add_data( $style_handle, 'path', $file_path ); + * + * @since 5.8.0 + * + * @global WP_Styles $wp_styles + */ + function wp_maybe_inline_styles() + { + } + /** + * Makes URLs relative to the WordPress installation. + * + * @since 5.9.0 + * @access private + * + * @param string $css The CSS to make URLs relative to the WordPress installation. + * @param string $stylesheet_url The URL to the stylesheet. + * + * @return string The CSS with URLs made relative to the WordPress installation. + */ + function _wp_normalize_relative_css_links($css, $stylesheet_url) + { + } + /** + * Function that enqueues the CSS Custom Properties coming from theme.json. + * + * @since 5.9.0 + */ + function wp_enqueue_global_styles_css_custom_properties() + { + } + /** + * Hooks inline styles in the proper place, depending on the active theme. + * + * @since 5.9.1 + * @since 6.1.0 Added the `$priority` parameter. + * + * For block themes, styles are loaded in the head. + * For classic ones, styles are loaded in the body because the wp_head action happens before render_block. + * + * @link https://core.trac.wordpress.org/ticket/53494. + * + * @param string $style String containing the CSS styles to be added. + * @param int $priority To set the priority for the add_action. + */ + function wp_enqueue_block_support_styles($style, $priority = 10) + { + } + /** + * Fetches, processes and compiles stored core styles, then combines and renders them to the page. + * Styles are stored via the style engine API. + * + * @link https://developer.wordpress.org/block-editor/reference-guides/packages/packages-style-engine/ + * + * @since 6.1.0 + * + * @param array $options { + * Optional. An array of options to pass to wp_style_engine_get_stylesheet_from_context(). + * Default empty array. + * + * @type bool $optimize Whether to optimize the CSS output, e.g., combine rules. + * Default false. + * @type bool $prettify Whether to add new lines and indents to output. + * Default to whether the `SCRIPT_DEBUG` constant is defined. + * } + * @phpstan-param array{ + * optimize?: bool, + * prettify?: bool, + * } $options + * @phpstan-return void + */ + function wp_enqueue_stored_styles($options = array()) + { + } + /** + * Enqueues a stylesheet for a specific block. + * + * If the theme has opted-in to separate-styles loading, + * then the stylesheet will be enqueued on-render, + * otherwise when the block inits. + * + * @since 5.9.0 + * + * @param string $block_name The block-name, including namespace. + * @param array $args { + * An array of arguments. See wp_register_style() for full information about each argument. + * + * @type string $handle The handle for the stylesheet. + * @type string|false $src The source URL of the stylesheet. + * @type string[] $deps Array of registered stylesheet handles this stylesheet depends on. + * @type string|bool|null $ver Stylesheet version number. + * @type string $media The media for which this stylesheet has been defined. + * @type string|null $path Absolute path to the stylesheet, so that it can potentially be inlined. + * } + * @phpstan-param array{ + * handle?: string, + * src?: string|false, + * deps?: string[], + * ver?: string|bool|null, + * media?: string, + * path?: string|null, + * } $args + */ + function wp_enqueue_block_style($block_name, $args) + { + } + /** + * Loads classic theme styles on classic themes in the frontend. + * + * This is needed for backwards compatibility for button blocks specifically. + * + * @since 6.1.0 + */ + function wp_enqueue_classic_theme_styles() + { + } + /** + * Loads classic theme styles on classic themes in the editor. + * + * This is needed for backwards compatibility for button blocks specifically. + * + * @since 6.1.0 + * + * @param array $editor_settings The array of editor settings. + * @return array A filtered array of editor settings. + */ + function wp_add_editor_classic_theme_styles($editor_settings) + { + } + /** + * Removes leading and trailing _empty_ script tags. + * + * This is a helper meant to be used for literal script tag construction + * within `wp_get_inline_script_tag()` or `wp_print_inline_script_tag()`. + * It removes the literal values of "<script>" and "</script>" from + * around an inline script after trimming whitespace. Typically this + * is used in conjunction with output buffering, where `ob_get_clean()` + * is passed as the `$contents` argument. + * + * Example: + * + * // Strips exact literal empty SCRIPT tags. + * $js = '<script>sayHello();</script>; + * 'sayHello();' === wp_remove_surrounding_empty_script_tags( $js ); + * + * // Otherwise if anything is different it warns in the JS console. + * $js = '<script type="text/javascript">console.log( "hi" );</script>'; + * 'console.error( ... )' === wp_remove_surrounding_empty_script_tags( $js ); + * + * @since 6.4.0 + * @access private + * + * @see wp_print_inline_script_tag() + * @see wp_get_inline_script_tag() + * + * @param string $contents Script body with manually created SCRIPT tag literals. + * @return string Script body without surrounding script tag literals, or + * original contents if both exact literals aren't present. + */ + function wp_remove_surrounding_empty_script_tags($contents) + { + } + /** + * Script Modules API: Script Module functions + * + * @since 6.5.0 + * + * @package WordPress + * @subpackage Script Modules + */ + /** + * Retrieves the main WP_Script_Modules instance. + * + * This function provides access to the WP_Script_Modules instance, creating one + * if it doesn't exist yet. + * + * @since 6.5.0 + * + * @global WP_Script_Modules $wp_script_modules + * + * @return WP_Script_Modules The main WP_Script_Modules instance. + */ + function wp_script_modules() : \WP_Script_Modules + { + } + /** + * Registers the script module if no script module with that script module + * identifier has already been registered. + * + * @since 6.5.0 + * + * @param string $id The identifier of the script module. Should be unique. It will be used in the + * final import map. + * @param string $src Optional. Full URL of the script module, or path of the script module relative + * to the WordPress root directory. If it is provided and the script module has + * not been registered yet, it will be registered. + * @param array $deps { + * Optional. List of dependencies. + * + * @type string|array ...$0 { + * An array of script module identifiers of the dependencies of this script + * module. The dependencies can be strings or arrays. If they are arrays, + * they need an `id` key with the script module identifier, and can contain + * an `import` key with either `static` or `dynamic`. By default, + * dependencies that don't contain an `import` key are considered static. + * + * @type string $id The script module identifier. + * @type string $import Optional. Import type. May be either `static` or + * `dynamic`. Defaults to `static`. + * } + * } + * @param string|false|null $version Optional. String specifying the script module version number. Defaults to false. + * It is added to the URL as a query string for cache busting purposes. If $version + * is set to false, the version number is the currently installed WordPress version. + * If $version is set to null, no version is added. + * @phpstan-param array<int|string, array{ + * id: string, + * import?: string, + * }> $deps + */ + function wp_register_script_module(string $id, string $src, array $deps = array(), $version = \false) + { + } + /** + * Marks the script module to be enqueued in the page. + * + * If a src is provided and the script module has not been registered yet, it + * will be registered. + * + * @since 6.5.0 + * + * @param string $id The identifier of the script module. Should be unique. It will be used in the + * final import map. + * @param string $src Optional. Full URL of the script module, or path of the script module relative + * to the WordPress root directory. If it is provided and the script module has + * not been registered yet, it will be registered. + * @param array $deps { + * Optional. List of dependencies. + * + * @type string|array ...$0 { + * An array of script module identifiers of the dependencies of this script + * module. The dependencies can be strings or arrays. If they are arrays, + * they need an `id` key with the script module identifier, and can contain + * an `import` key with either `static` or `dynamic`. By default, + * dependencies that don't contain an `import` key are considered static. + * + * @type string $id The script module identifier. + * @type string $import Optional. Import type. May be either `static` or + * `dynamic`. Defaults to `static`. + * } + * } + * @param string|false|null $version Optional. String specifying the script module version number. Defaults to false. + * It is added to the URL as a query string for cache busting purposes. If $version + * is set to false, the version number is the currently installed WordPress version. + * If $version is set to null, no version is added. + * @phpstan-param array<int|string, array{ + * id: string, + * import?: string, + * }> $deps + */ + function wp_enqueue_script_module(string $id, string $src = '', array $deps = array(), $version = \false) + { + } + /** + * Unmarks the script module so it is no longer enqueued in the page. + * + * @since 6.5.0 + * + * @param string $id The identifier of the script module. + */ + function wp_dequeue_script_module(string $id) + { + } + /** + * Deregisters the script module. + * + * @since 6.5.0 + * + * @param string $id The identifier of the script module. + */ + function wp_deregister_script_module(string $id) + { + } + /** + * Adds a new shortcode. + * + * Care should be taken through prefixing or other means to ensure that the + * shortcode tag being added is unique and will not conflict with other, + * already-added shortcode tags. In the event of a duplicated tag, the tag + * loaded last will take precedence. + * + * @since 2.5.0 + * + * @global array $shortcode_tags + * + * @param string $tag Shortcode tag to be searched in post content. + * @param callable $callback The callback function to run when the shortcode is found. + * Every shortcode callback is passed three parameters by default, + * including an array of attributes (`$atts`), the shortcode content + * or null if not set (`$content`), and finally the shortcode tag + * itself (`$shortcode_tag`), in that order. + * @phpstan-return void + */ + function add_shortcode($tag, $callback) + { + } + /** + * Removes hook for shortcode. + * + * @since 2.5.0 + * + * @global array $shortcode_tags + * + * @param string $tag Shortcode tag to remove hook for. + */ + function remove_shortcode($tag) + { + } + /** + * Clears all shortcodes. + * + * This function clears all of the shortcode tags by replacing the shortcodes global with + * an empty array. This is actually an efficient method for removing all shortcodes. + * + * @since 2.5.0 + * + * @global array $shortcode_tags + */ + function remove_all_shortcodes() + { + } + /** + * Determines whether a registered shortcode exists named $tag. + * + * @since 3.6.0 + * + * @global array $shortcode_tags List of shortcode tags and their callback hooks. + * + * @param string $tag Shortcode tag to check. + * @return bool Whether the given shortcode exists. + */ + function shortcode_exists($tag) + { + } + /** + * Determines whether the passed content contains the specified shortcode. + * + * @since 3.6.0 + * + * @global array $shortcode_tags + * + * @param string $content Content to search for shortcodes. + * @param string $tag Shortcode tag to check. + * @return bool Whether the passed content contains the given shortcode. + */ + function has_shortcode($content, $tag) + { + } + /** + * Returns a list of registered shortcode names found in the given content. + * + * Example usage: + * + * get_shortcode_tags_in_content( '[audio src="file.mp3"][/audio] [foo] [gallery ids="1,2,3"]' ); + * // array( 'audio', 'gallery' ) + * + * @since 6.3.2 + * + * @param string $content The content to check. + * @return string[] An array of registered shortcode names found in the content. + */ + function get_shortcode_tags_in_content($content) + { + } + /** + * Searches content for shortcodes and filter shortcodes through their hooks. + * + * This function is an alias for do_shortcode(). + * + * @since 5.4.0 + * + * @see do_shortcode() + * + * @param string $content Content to search for shortcodes. + * @param bool $ignore_html When true, shortcodes inside HTML elements will be skipped. + * Default false. + * @return string Content with shortcodes filtered out. + */ + function apply_shortcodes($content, $ignore_html = \false) + { + } + /** + * Searches content for shortcodes and filter shortcodes through their hooks. + * + * If there are no shortcode tags defined, then the content will be returned + * without any filtering. This might cause issues when plugins are disabled but + * the shortcode will still show up in the post or content. + * + * @since 2.5.0 + * + * @global array $shortcode_tags List of shortcode tags and their callback hooks. + * + * @param string $content Content to search for shortcodes. + * @param bool $ignore_html When true, shortcodes inside HTML elements will be skipped. + * Default false. + * @return string Content with shortcodes filtered out. + */ + function do_shortcode($content, $ignore_html = \false) + { + } + /** + * Filter the `wp_get_attachment_image_context` hook during shortcode rendering. + * + * When wp_get_attachment_image() is called during shortcode rendering, we need to make clear + * that the context is a shortcode and not part of the theme's template rendering logic. + * + * @since 6.3.0 + * @access private + * + * @return string The filtered context value for wp_get_attachment_images when doing shortcodes. + */ + function _filter_do_shortcode_context() + { + } + /** + * Retrieves the shortcode regular expression for searching. + * + * The regular expression combines the shortcode tags in the regular expression + * in a regex class. + * + * The regular expression contains 6 different sub matches to help with parsing. + * + * 1 - An extra [ to allow for escaping shortcodes with double [[]] + * 2 - The shortcode name + * 3 - The shortcode argument list + * 4 - The self closing / + * 5 - The content of a shortcode when it wraps some content. + * 6 - An extra ] to allow for escaping shortcodes with double [[]] + * + * @since 2.5.0 + * @since 4.4.0 Added the `$tagnames` parameter. + * + * @global array $shortcode_tags + * + * @param array $tagnames Optional. List of shortcodes to find. Defaults to all registered shortcodes. + * @return string The shortcode search regular expression + */ + function get_shortcode_regex($tagnames = \null) + { + } + /** + * Regular Expression callable for do_shortcode() for calling shortcode hook. + * + * @see get_shortcode_regex() for details of the match array contents. + * + * @since 2.5.0 + * @access private + * + * @global array $shortcode_tags + * + * @param array $m { + * Regular expression match array. + * + * @type string $0 Entire matched shortcode text. + * @type string $1 Optional second opening bracket for escaping shortcodes. + * @type string $2 Shortcode name. + * @type string $3 Shortcode arguments list. + * @type string $4 Optional self closing slash. + * @type string $5 Content of a shortcode when it wraps some content. + * @type string $6 Optional second closing bracket for escaping shortcodes. + * } + * @return string Shortcode output. + * @phpstan-param array{ + * 0: string, + * 1: string, + * 2: string, + * 3: string, + * 4: string, + * 5: string, + * 6: string, + * } $m + */ + function do_shortcode_tag($m) + { + } + /** + * Searches only inside HTML elements for shortcodes and process them. + * + * Any [ or ] characters remaining inside elements will be HTML encoded + * to prevent interference with shortcodes that are outside the elements. + * Assumes $content processed by KSES already. Users with unfiltered_html + * capability may get unexpected output if angle braces are nested in tags. + * + * @since 4.2.3 + * + * @param string $content Content to search for shortcodes. + * @param bool $ignore_html When true, all square braces inside elements will be encoded. + * @param array $tagnames List of shortcodes to find. + * @return string Content with shortcodes filtered out. + */ + function do_shortcodes_in_html_tags($content, $ignore_html, $tagnames) + { + } + /** + * Removes placeholders added by do_shortcodes_in_html_tags(). + * + * @since 4.2.3 + * + * @param string $content Content to search for placeholders. + * @return string Content with placeholders removed. + */ + function unescape_invalid_shortcodes($content) + { + } + /** + * Retrieves the shortcode attributes regex. + * + * @since 4.4.0 + * + * @return string The shortcode attribute regular expression. + */ + function get_shortcode_atts_regex() + { + } + /** + * Retrieves all attributes from the shortcodes tag. + * + * The attributes list has the attribute name as the key and the value of the + * attribute as the value in the key/value pair. This allows for easier + * retrieval of the attributes, since all attributes have to be known. + * + * @since 2.5.0 + * @since 6.5.0 The function now always returns an array, + * even if the original arguments string cannot be parsed or is empty. + * + * @param string $text Shortcode arguments list. + * @return array Array of attribute values keyed by attribute name. + * Returns empty array if there are no attributes + * or if the original arguments string cannot be parsed. + */ + function shortcode_parse_atts($text) + { + } + /** + * Combines user attributes with known attributes and fill in defaults when needed. + * + * The pairs should be considered to be all of the attributes which are + * supported by the caller and given as a list. The returned attributes will + * only contain the attributes in the $pairs list. + * + * If the $atts list has unsupported attributes, then they will be ignored and + * removed from the final returned list. + * + * @since 2.5.0 + * + * @param array $pairs Entire list of supported attributes and their defaults. + * @param array $atts User defined attributes in shortcode tag. + * @param string $shortcode Optional. The name of the shortcode, provided for context to enable filtering + * @return array Combined and filtered attribute list. + */ + function shortcode_atts($pairs, $atts, $shortcode = '') + { + } + /** + * Removes all shortcode tags from the given content. + * + * @since 2.5.0 + * + * @global array $shortcode_tags + * + * @param string $content Content to remove shortcode tags. + * @return string Content without shortcode tags. + */ + function strip_shortcodes($content) + { + } + /** + * Strips a shortcode tag based on RegEx matches against post content. + * + * @since 3.3.0 + * + * @param array $m RegEx matches against post content. + * @return string|false The content stripped of the tag, otherwise false. + */ + function strip_shortcode_tag($m) + { + } + /** + * Sitemaps: Public functions + * + * This file contains a variety of public functions developers can use to interact with + * the XML Sitemaps API. + * + * @package WordPress + * @subpackage Sitemaps + * @since 5.5.0 + */ + /** + * Retrieves the current Sitemaps server instance. + * + * @since 5.5.0 + * + * @global WP_Sitemaps $wp_sitemaps Global Core Sitemaps instance. + * + * @return WP_Sitemaps Sitemaps instance. + */ + function wp_sitemaps_get_server() + { + } + /** + * Gets an array of sitemap providers. + * + * @since 5.5.0 + * + * @return WP_Sitemaps_Provider[] Array of sitemap providers. + */ + function wp_get_sitemap_providers() + { + } + /** + * Registers a new sitemap provider. + * + * @since 5.5.0 + * + * @param string $name Unique name for the sitemap provider. + * @param WP_Sitemaps_Provider $provider The `Sitemaps_Provider` instance implementing the sitemap. + * @return bool Whether the sitemap was added. + */ + function wp_register_sitemap_provider($name, \WP_Sitemaps_Provider $provider) + { + } + /** + * Gets the maximum number of URLs for a sitemap. + * + * @since 5.5.0 + * + * @param string $object_type Object type for sitemap to be filtered (e.g. 'post', 'term', 'user'). + * @return int The maximum number of URLs. + */ + function wp_sitemaps_get_max_urls($object_type) + { + } + /** + * Retrieves the full URL for a sitemap. + * + * @since 5.5.1 + * + * @param string $name The sitemap name. + * @param string $subtype_name The sitemap subtype name. Default empty string. + * @param int $page The page of the sitemap. Default 1. + * @return string|false The sitemap URL or false if the sitemap doesn't exist. + */ + function get_sitemap_url($name, $subtype_name = '', $page = 1) + { + } + /** + * Style engine: Public functions + * + * This file contains a variety of public functions developers can use to interact with + * the Style Engine API. + * + * @package WordPress + * @subpackage StyleEngine + * @since 6.1.0 + */ + /** + * Global public interface method to generate styles from a single style object, + * e.g. the value of a block's attributes.style object or the top level styles in theme.json. + * + * Example usage: + * + * $styles = wp_style_engine_get_styles( + * array( + * 'color' => array( 'text' => '#cccccc' ), + * ) + * ); + * + * Returns: + * + * array( + * 'css' => 'color: #cccccc', + * 'declarations' => array( 'color' => '#cccccc' ), + * 'classnames' => 'has-color', + * ) + * + * @since 6.1.0 + * + * @see https://developer.wordpress.org/block-editor/reference-guides/theme-json-reference/theme-json-living/#styles + * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/ + * + * @param array $block_styles The style object. + * @param array $options { + * Optional. An array of options. Default empty array. + * + * @type string|null $context An identifier describing the origin of the style object, + * e.g. 'block-supports' or 'global-styles'. Default null. + * When set, the style engine will attempt to store the CSS rules, + * where a selector is also passed. + * @type bool $convert_vars_to_classnames Whether to skip converting incoming CSS var patterns, + * e.g. `var:preset|<PRESET_TYPE>|<PRESET_SLUG>`, + * to `var( --wp--preset--* )` values. Default false. + * @type string $selector Optional. When a selector is passed, + * the value of `$css` in the return value will comprise + * a full CSS rule `$selector { ...$css_declarations }`, + * otherwise, the value will be a concatenated string + * of CSS declarations. + * } + * @return array { + * @type string $css A CSS ruleset or declarations block + * formatted to be placed in an HTML `style` attribute or tag. + * @type string[] $declarations An associative array of CSS definitions, + * e.g. `array( "$property" => "$value", "$property" => "$value" )`. + * @type string $classnames Classnames separated by a space. + * } + * @phpstan-param array{ + * context?: string|null, + * convert_vars_to_classnames?: bool, + * selector?: string, + * } $options + * @phpstan-return array{ + * css: string, + * declarations: string[], + * classnames: string, + * } + */ + function wp_style_engine_get_styles($block_styles, $options = array()) + { + } + /** + * Returns compiled CSS from a collection of selectors and declarations. + * Useful for returning a compiled stylesheet from any collection of CSS selector + declarations. + * + * Example usage: + * + * $css_rules = array( + * array( + * 'selector' => '.elephant-are-cool', + * 'declarations' => array( + * 'color' => 'gray', + * 'width' => '3em', + * ), + * ), + * ); + * + * $css = wp_style_engine_get_stylesheet_from_css_rules( $css_rules ); + * + * Returns: + * + * .elephant-are-cool{color:gray;width:3em} + * + * @since 6.1.0 + * @since 6.6.0 Added support for `$rules_group` in the `$css_rules` array. + * + * @param array $css_rules { + * Required. A collection of CSS rules. + * + * @type array ...$0 { + * @type string $rules_group A parent CSS selector in the case of nested CSS, + * or a CSS nested @rule, such as `@media (min-width: 80rem)` or `@layer module`. + * @type string $selector A CSS selector. + * @type string[] $declarations An associative array of CSS definitions, + * e.g. `array( "$property" => "$value", "$property" => "$value" )`. + * } + * } + * @param array $options { + * Optional. An array of options. Default empty array. + * + * @type string|null $context An identifier describing the origin of the style object, + * e.g. 'block-supports' or 'global-styles'. Default 'block-supports'. + * When set, the style engine will attempt to store the CSS rules. + * @type bool $optimize Whether to optimize the CSS output, e.g. combine rules. + * Default false. + * @type bool $prettify Whether to add new lines and indents to output. + * Defaults to whether the `SCRIPT_DEBUG` constant is defined. + * } + * @return string A string of compiled CSS declarations, or empty string. + * @phpstan-param array<int|string, array{ + * rules_group: string, + * selector: string, + * declarations: string[], + * }> $css_rules + * @phpstan-param array{ + * context?: string|null, + * optimize?: bool, + * prettify?: bool, + * } $options + */ + function wp_style_engine_get_stylesheet_from_css_rules($css_rules, $options = array()) + { + } + /** + * Returns compiled CSS from a store, if found. + * + * @since 6.1.0 + * + * @param string $context A valid context name, corresponding to an existing store key. + * @param array $options { + * Optional. An array of options. Default empty array. + * + * @type bool $optimize Whether to optimize the CSS output, e.g. combine rules. + * Default false. + * @type bool $prettify Whether to add new lines and indents to output. + * Defaults to whether the `SCRIPT_DEBUG` constant is defined. + * } + * @return string A compiled CSS string. + * @phpstan-param array{ + * optimize?: bool, + * prettify?: bool, + * } $options + */ + function wp_style_engine_get_stylesheet_from_context($context, $options = array()) + { + } + /** + * Core Taxonomy API + * + * @package WordPress + * @subpackage Taxonomy + */ + // + // Taxonomy registration. + // + /** + * Creates the initial taxonomies. + * + * This function fires twice: in wp-settings.php before plugins are loaded (for + * backward compatibility reasons), and again on the {@see 'init'} action. We must + * avoid registering rewrite rules before the {@see 'init'} action. + * + * @since 2.8.0 + * @since 5.9.0 Added `'wp_template_part_area'` taxonomy. + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + */ + function create_initial_taxonomies() + { + } + /** + * Retrieves a list of registered taxonomy names or objects. + * + * @since 3.0.0 + * + * @global WP_Taxonomy[] $wp_taxonomies The registered taxonomies. + * + * @param array $args Optional. An array of `key => value` arguments to match against the taxonomy objects. + * Default empty array. + * @param string $output Optional. The type of output to return in the array. Either 'names' + * or 'objects'. Default 'names'. + * @param string $operator Optional. The logical operation to perform. Accepts 'and' or 'or'. 'or' means only + * one element from the array needs to match; 'and' means all elements must match. + * Default 'and'. + * @return string[]|WP_Taxonomy[] An array of taxonomy names or objects. + * @phpstan-param 'names'|'objects' $output + * @phpstan-param 'and'|'or' $operator + * @phpstan-return ($output is 'names' ? array<int, string> : array<int, \WP_Taxonomy>) + */ + function get_taxonomies($args = array(), $output = 'names', $operator = 'and') + { + } + /** + * Returns the names or objects of the taxonomies which are registered for the requested object or object type, + * such as a post object or post type name. + * + * Example: + * + * $taxonomies = get_object_taxonomies( 'post' ); + * + * This results in: + * + * Array( 'category', 'post_tag' ) + * + * @since 2.3.0 + * + * @global WP_Taxonomy[] $wp_taxonomies The registered taxonomies. + * + * @param string|string[]|WP_Post $object_type Name of the type of taxonomy object, or an object (row from posts). + * @param string $output Optional. The type of output to return in the array. Accepts either + * 'names' or 'objects'. Default 'names'. + * @return string[]|WP_Taxonomy[] The names or objects of all taxonomies of `$object_type`. + * @phpstan-param 'names'|'objects' $output + * @phpstan-return ($output is 'names' ? array<int, string> : array<string, \WP_Taxonomy>) + */ + function get_object_taxonomies($object_type, $output = 'names') + { + } + /** + * Retrieves the taxonomy object of $taxonomy. + * + * The get_taxonomy function will first check that the parameter string given + * is a taxonomy object and if it is, it will return it. + * + * @since 2.3.0 + * + * @global WP_Taxonomy[] $wp_taxonomies The registered taxonomies. + * + * @param string $taxonomy Name of taxonomy object to return. + * @return WP_Taxonomy|false The taxonomy object or false if $taxonomy doesn't exist. + */ + function get_taxonomy($taxonomy) + { + } + /** + * Determines whether the taxonomy name exists. + * + * Formerly is_taxonomy(), introduced in 2.3.0. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 3.0.0 + * + * @global WP_Taxonomy[] $wp_taxonomies The registered taxonomies. + * + * @param string $taxonomy Name of taxonomy object. + * @return bool Whether the taxonomy exists. + */ + function taxonomy_exists($taxonomy) + { + } + /** + * Determines whether the taxonomy object is hierarchical. + * + * Checks to make sure that the taxonomy is an object first. Then Gets the + * object, and finally returns the hierarchical value in the object. + * + * A false return value might also mean that the taxonomy does not exist. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 2.3.0 + * + * @param string $taxonomy Name of taxonomy object. + * @return bool Whether the taxonomy is hierarchical. + */ + function is_taxonomy_hierarchical($taxonomy) + { + } + /** + * Creates or modifies a taxonomy object. + * + * Note: Do not use before the {@see 'init'} hook. + * + * A simple function for creating or modifying a taxonomy object based on + * the parameters given. If modifying an existing taxonomy object, note + * that the `$object_type` value from the original registration will be + * overwritten. + * + * @since 2.3.0 + * @since 4.2.0 Introduced `show_in_quick_edit` argument. + * @since 4.4.0 The `show_ui` argument is now enforced on the term editing screen. + * @since 4.4.0 The `public` argument now controls whether the taxonomy can be queried on the front end. + * @since 4.5.0 Introduced `publicly_queryable` argument. + * @since 4.7.0 Introduced `show_in_rest`, 'rest_base' and 'rest_controller_class' + * arguments to register the taxonomy in REST API. + * @since 5.1.0 Introduced `meta_box_sanitize_cb` argument. + * @since 5.4.0 Added the registered taxonomy object as a return value. + * @since 5.5.0 Introduced `default_term` argument. + * @since 5.9.0 Introduced `rest_namespace` argument. + * + * @global WP_Taxonomy[] $wp_taxonomies Registered taxonomies. + * + * @param string $taxonomy Taxonomy key. Must not exceed 32 characters and may only contain + * lowercase alphanumeric characters, dashes, and underscores. See sanitize_key(). + * @param array|string $object_type Object type or array of object types with which the taxonomy should be associated. + * @param array|string $args { + * Optional. Array or query string of arguments for registering a taxonomy. + * + * @type string[] $labels An array of labels for this taxonomy. By default, Tag labels are + * used for non-hierarchical taxonomies, and Category labels are used + * for hierarchical taxonomies. See accepted values in + * get_taxonomy_labels(). Default empty array. + * @type string $description A short descriptive summary of what the taxonomy is for. Default empty. + * @type bool $public Whether a taxonomy is intended for use publicly either via + * the admin interface or by front-end users. The default settings + * of `$publicly_queryable`, `$show_ui`, and `$show_in_nav_menus` + * are inherited from `$public`. + * @type bool $publicly_queryable Whether the taxonomy is publicly queryable. + * If not set, the default is inherited from `$public` + * @type bool $hierarchical Whether the taxonomy is hierarchical. Default false. + * @type bool $show_ui Whether to generate and allow a UI for managing terms in this taxonomy in + * the admin. If not set, the default is inherited from `$public` + * (default true). + * @type bool $show_in_menu Whether to show the taxonomy in the admin menu. If true, the taxonomy is + * shown as a submenu of the object type menu. If false, no menu is shown. + * `$show_ui` must be true. If not set, default is inherited from `$show_ui` + * (default true). + * @type bool $show_in_nav_menus Makes this taxonomy available for selection in navigation menus. If not + * set, the default is inherited from `$public` (default true). + * @type bool $show_in_rest Whether to include the taxonomy in the REST API. Set this to true + * for the taxonomy to be available in the block editor. + * @type string $rest_base To change the base url of REST API route. Default is $taxonomy. + * @type string $rest_namespace To change the namespace URL of REST API route. Default is wp/v2. + * @type string $rest_controller_class REST API Controller class name. Default is 'WP_REST_Terms_Controller'. + * @type bool $show_tagcloud Whether to list the taxonomy in the Tag Cloud Widget controls. If not set, + * the default is inherited from `$show_ui` (default true). + * @type bool $show_in_quick_edit Whether to show the taxonomy in the quick/bulk edit panel. It not set, + * the default is inherited from `$show_ui` (default true). + * @type bool $show_admin_column Whether to display a column for the taxonomy on its post type listing + * screens. Default false. + * @type bool|callable $meta_box_cb Provide a callback function for the meta box display. If not set, + * post_categories_meta_box() is used for hierarchical taxonomies, and + * post_tags_meta_box() is used for non-hierarchical. If false, no meta + * box is shown. + * @type callable $meta_box_sanitize_cb Callback function for sanitizing taxonomy data saved from a meta + * box. If no callback is defined, an appropriate one is determined + * based on the value of `$meta_box_cb`. + * @type string[] $capabilities { + * Array of capabilities for this taxonomy. + * + * @type string $manage_terms Default 'manage_categories'. + * @type string $edit_terms Default 'manage_categories'. + * @type string $delete_terms Default 'manage_categories'. + * @type string $assign_terms Default 'edit_posts'. + * } + * @type bool|array $rewrite { + * Triggers the handling of rewrites for this taxonomy. Default true, using $taxonomy as slug. To prevent + * rewrite, set to false. To specify rewrite rules, an array can be passed with any of these keys: + * + * @type string $slug Customize the permastruct slug. Default `$taxonomy` key. + * @type bool $with_front Should the permastruct be prepended with WP_Rewrite::$front. Default true. + * @type bool $hierarchical Either hierarchical rewrite tag or not. Default false. + * @type int $ep_mask Assign an endpoint mask. Default `EP_NONE`. + * } + * @type string|bool $query_var Sets the query var key for this taxonomy. Default `$taxonomy` key. If + * false, a taxonomy cannot be loaded at `?{query_var}={term_slug}`. If a + * string, the query `?{query_var}={term_slug}` will be valid. + * @type callable $update_count_callback Works much like a hook, in that it will be called when the count is + * updated. Default _update_post_term_count() for taxonomies attached + * to post types, which confirms that the objects are published before + * counting them. Default _update_generic_term_count() for taxonomies + * attached to other object types, such as users. + * @type string|array $default_term { + * Default term to be used for the taxonomy. + * + * @type string $name Name of default term. + * @type string $slug Slug for default term. Default empty. + * @type string $description Description for default term. Default empty. + * } + * @type bool $sort Whether terms in this taxonomy should be sorted in the order they are + * provided to `wp_set_object_terms()`. Default null which equates to false. + * @type array $args Array of arguments to automatically use inside `wp_get_object_terms()` + * for this taxonomy. + * @type bool $_builtin This taxonomy is a "built-in" taxonomy. INTERNAL USE ONLY! + * Default false. + * } + * @return WP_Taxonomy|WP_Error The registered taxonomy object on success, WP_Error object on failure. + * @phpstan-param array{ + * labels?: string[], + * description?: string, + * public?: bool, + * publicly_queryable?: bool, + * hierarchical?: bool, + * show_ui?: bool, + * show_in_menu?: bool, + * show_in_nav_menus?: bool, + * show_in_rest?: bool, + * rest_base?: string, + * rest_namespace?: string, + * rest_controller_class?: string, + * show_tagcloud?: bool, + * show_in_quick_edit?: bool, + * show_admin_column?: bool, + * meta_box_cb?: bool|callable, + * meta_box_sanitize_cb?: callable, + * capabilities?: array{ + * manage_terms?: string, + * edit_terms?: string, + * delete_terms?: string, + * assign_terms?: string, + * }, + * rewrite?: bool|array{ + * slug?: string, + * with_front?: bool, + * hierarchical?: bool, + * ep_mask?: int, + * }, + * query_var?: string|bool, + * update_count_callback?: callable, + * default_term?: string|array{ + * name?: string, + * slug?: string, + * description?: string, + * }, + * sort?: bool, + * args?: array, + * _builtin?: bool, + * } $args + */ + function register_taxonomy($taxonomy, $object_type, $args = array()) + { + } + /** + * Unregisters a taxonomy. + * + * Can not be used to unregister built-in taxonomies. + * + * @since 4.5.0 + * + * @global WP_Taxonomy[] $wp_taxonomies List of taxonomies. + * + * @param string $taxonomy Taxonomy name. + * @return true|WP_Error True on success, WP_Error on failure or if the taxonomy doesn't exist. + */ + function unregister_taxonomy($taxonomy) + { + } + /** + * Builds an object with all taxonomy labels out of a taxonomy object. + * + * @since 3.0.0 + * @since 4.3.0 Added the `no_terms` label. + * @since 4.4.0 Added the `items_list_navigation` and `items_list` labels. + * @since 4.9.0 Added the `most_used` and `back_to_items` labels. + * @since 5.7.0 Added the `filter_by_item` label. + * @since 5.8.0 Added the `item_link` and `item_link_description` labels. + * @since 5.9.0 Added the `name_field_description`, `slug_field_description`, + * `parent_field_description`, and `desc_field_description` labels. + * @since 6.6.0 Added the `template_name` label. + * + * @param WP_Taxonomy $tax Taxonomy object. + * @return object { + * Taxonomy labels object. The first default value is for non-hierarchical taxonomies + * (like tags) and the second one is for hierarchical taxonomies (like categories). + * + * @type string $name General name for the taxonomy, usually plural. The same + * as and overridden by `$tax->label`. Default 'Tags'/'Categories'. + * @type string $singular_name Name for one object of this taxonomy. Default 'Tag'/'Category'. + * @type string $search_items Default 'Search Tags'/'Search Categories'. + * @type string $popular_items This label is only used for non-hierarchical taxonomies. + * Default 'Popular Tags'. + * @type string $all_items Default 'All Tags'/'All Categories'. + * @type string $parent_item This label is only used for hierarchical taxonomies. Default + * 'Parent Category'. + * @type string $parent_item_colon The same as `parent_item`, but with colon `:` in the end. + * @type string $name_field_description Description for the Name field on Edit Tags screen. + * Default 'The name is how it appears on your site'. + * @type string $slug_field_description Description for the Slug field on Edit Tags screen. + * Default 'The “slug” is the URL-friendly version + * of the name. It is usually all lowercase and contains + * only letters, numbers, and hyphens'. + * @type string $parent_field_description Description for the Parent field on Edit Tags screen. + * Default 'Assign a parent term to create a hierarchy. + * The term Jazz, for example, would be the parent + * of Bebop and Big Band'. + * @type string $desc_field_description Description for the Description field on Edit Tags screen. + * Default 'The description is not prominent by default; + * however, some themes may show it'. + * @type string $edit_item Default 'Edit Tag'/'Edit Category'. + * @type string $view_item Default 'View Tag'/'View Category'. + * @type string $update_item Default 'Update Tag'/'Update Category'. + * @type string $add_new_item Default 'Add New Tag'/'Add New Category'. + * @type string $new_item_name Default 'New Tag Name'/'New Category Name'. + * @type string $template_name Default 'Tag Archives'/'Category Archives'. + * @type string $separate_items_with_commas This label is only used for non-hierarchical taxonomies. Default + * 'Separate tags with commas', used in the meta box. + * @type string $add_or_remove_items This label is only used for non-hierarchical taxonomies. Default + * 'Add or remove tags', used in the meta box when JavaScript + * is disabled. + * @type string $choose_from_most_used This label is only used on non-hierarchical taxonomies. Default + * 'Choose from the most used tags', used in the meta box. + * @type string $not_found Default 'No tags found'/'No categories found', used in + * the meta box and taxonomy list table. + * @type string $no_terms Default 'No tags'/'No categories', used in the posts and media + * list tables. + * @type string $filter_by_item This label is only used for hierarchical taxonomies. Default + * 'Filter by category', used in the posts list table. + * @type string $items_list_navigation Label for the table pagination hidden heading. + * @type string $items_list Label for the table hidden heading. + * @type string $most_used Title for the Most Used tab. Default 'Most Used'. + * @type string $back_to_items Label displayed after a term has been updated. + * @type string $item_link Used in the block editor. Title for a navigation link block variation. + * Default 'Tag Link'/'Category Link'. + * @type string $item_link_description Used in the block editor. Description for a navigation link block + * variation. Default 'A link to a tag'/'A link to a category'. + * } + * @phpstan-return object{ + * name: string, + * singular_name: string, + * search_items: string, + * popular_items: string, + * all_items: string, + * parent_item: string, + * parent_item_colon: string, + * name_field_description: string, + * slug_field_description: string, + * parent_field_description: string, + * desc_field_description: string, + * edit_item: string, + * view_item: string, + * update_item: string, + * add_new_item: string, + * new_item_name: string, + * template_name: string, + * separate_items_with_commas: string, + * add_or_remove_items: string, + * choose_from_most_used: string, + * not_found: string, + * no_terms: string, + * filter_by_item: string, + * items_list_navigation: string, + * items_list: string, + * most_used: string, + * back_to_items: string, + * item_link: string, + * item_link_description: string, + * } + */ + function get_taxonomy_labels($tax) + { + } + /** + * Adds an already registered taxonomy to an object type. + * + * @since 3.0.0 + * + * @global WP_Taxonomy[] $wp_taxonomies The registered taxonomies. + * + * @param string $taxonomy Name of taxonomy object. + * @param string $object_type Name of the object type. + * @return bool True if successful, false if not. + */ + function register_taxonomy_for_object_type($taxonomy, $object_type) + { + } + /** + * Removes an already registered taxonomy from an object type. + * + * @since 3.7.0 + * + * @global WP_Taxonomy[] $wp_taxonomies The registered taxonomies. + * + * @param string $taxonomy Name of taxonomy object. + * @param string $object_type Name of the object type. + * @return bool True if successful, false if not. + */ + function unregister_taxonomy_for_object_type($taxonomy, $object_type) + { + } + // + // Term API. + // + /** + * Retrieves object IDs of valid taxonomy and term. + * + * The strings of `$taxonomies` must exist before this function will continue. + * On failure of finding a valid taxonomy, it will return a WP_Error. + * + * The `$terms` aren't checked the same as `$taxonomies`, but still need to exist + * for object IDs to be returned. + * + * It is possible to change the order that object IDs are returned by using `$args` + * with either ASC or DESC array. The value should be in the key named 'order'. + * + * @since 2.3.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int|int[] $term_ids Term ID or array of term IDs of terms that will be used. + * @param string|string[] $taxonomies String of taxonomy name or Array of string values of taxonomy names. + * @param array|string $args { + * Change the order of the object IDs. + * + * @type string $order Order to retrieve terms. Accepts 'ASC' or 'DESC'. Default 'ASC'. + * } + * @return string[]|WP_Error An array of object IDs as numeric strings on success, + * WP_Error if the taxonomy does not exist. + * @phpstan-param array{ + * order?: string, + * } $args + */ + function get_objects_in_term($term_ids, $taxonomies, $args = array()) + { + } + /** + * Given a taxonomy query, generates SQL to be appended to a main query. + * + * @since 3.1.0 + * + * @see WP_Tax_Query + * + * @param array $tax_query A compact tax query + * @param string $primary_table + * @param string $primary_id_column + * @return string[] + */ + function get_tax_sql($tax_query, $primary_table, $primary_id_column) + { + } + /** + * Gets all term data from database by term ID. + * + * The usage of the get_term function is to apply filters to a term object. It + * is possible to get a term object from the database before applying the + * filters. + * + * $term ID must be part of $taxonomy, to get from the database. Failure, might + * be able to be captured by the hooks. Failure would be the same value as $wpdb + * returns for the get_row method. + * + * There are two hooks, one is specifically for each term, named 'get_term', and + * the second is for the taxonomy name, 'term_$taxonomy'. Both hooks gets the + * term object, and the taxonomy name as parameters. Both hooks are expected to + * return a term object. + * + * {@see 'get_term'} hook - Takes two parameters the term Object and the taxonomy name. + * Must return term object. Used in get_term() as a catch-all filter for every + * $term. + * + * {@see 'get_$taxonomy'} hook - Takes two parameters the term Object and the taxonomy + * name. Must return term object. $taxonomy will be the taxonomy name, so for + * example, if 'category', it would be 'get_category' as the filter name. Useful + * for custom taxonomies or plugging into default taxonomies. + * + * @todo Better formatting for DocBlock + * + * @since 2.3.0 + * @since 4.4.0 Converted to return a WP_Term object if `$output` is `OBJECT`. + * The `$taxonomy` parameter was made optional. + * + * @see sanitize_term_field() The $context param lists the available values for get_term_by() $filter param. + * + * @param int|WP_Term|object $term If integer, term data will be fetched from the database, + * or from the cache if available. + * If stdClass object (as in the results of a database query), + * will apply filters and return a `WP_Term` object with the `$term` data. + * If `WP_Term`, will return `$term`. + * @param string $taxonomy Optional. Taxonomy name that `$term` is part of. + * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which + * correspond to a WP_Term object, an associative array, or a numeric array, + * respectively. Default OBJECT. + * @param string $filter Optional. How to sanitize term fields. Default 'raw'. + * @return WP_Term|array|WP_Error|null WP_Term instance (or array) on success, depending on the `$output` value. + * WP_Error if `$taxonomy` does not exist. Null for miscellaneous failure. + * @phpstan-param 'OBJECT'|'ARRAY_A'|'ARRAY_N' $output + * @phpstan-return ($output is 'ARRAY_A' ? array<string, string|int>|\WP_Error|null : ($output is 'ARRAY_N' ? list<string|int>|\WP_Error|null : \WP_Term|\WP_Error|null)) + */ + function get_term($term, $taxonomy = '', $output = \OBJECT, $filter = 'raw') + { + } + /** + * Gets all term data from database by term field and data. + * + * Warning: $value is not escaped for 'name' $field. You must do it yourself, if + * required. + * + * The default $field is 'id', therefore it is possible to also use null for + * field, but not recommended that you do so. + * + * If $value does not exist, the return value will be false. If $taxonomy exists + * and $field and $value combinations exist, the term will be returned. + * + * This function will always return the first term that matches the `$field`- + * `$value`-`$taxonomy` combination specified in the parameters. If your query + * is likely to match more than one term (as is likely to be the case when + * `$field` is 'name', for example), consider using get_terms() instead; that + * way, you will get all matching terms, and can provide your own logic for + * deciding which one was intended. + * + * @todo Better formatting for DocBlock. + * + * @since 2.3.0 + * @since 4.4.0 `$taxonomy` is optional if `$field` is 'term_taxonomy_id'. Converted to return + * a WP_Term object if `$output` is `OBJECT`. + * @since 5.5.0 Added 'ID' as an alias of 'id' for the `$field` parameter. + * + * @see sanitize_term_field() The $context param lists the available values for get_term_by() $filter param. + * + * @param string $field Either 'slug', 'name', 'term_id' (or 'id', 'ID'), or 'term_taxonomy_id'. + * @param string|int $value Search for this term value. + * @param string $taxonomy Taxonomy name. Optional, if `$field` is 'term_taxonomy_id'. + * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which + * correspond to a WP_Term object, an associative array, or a numeric array, + * respectively. Default OBJECT. + * @param string $filter Optional. How to sanitize term fields. Default 'raw'. + * @return WP_Term|array|false WP_Term instance (or array) on success, depending on the `$output` value. + * False if `$taxonomy` does not exist or `$term` was not found. + * @phpstan-return ($output is 'ARRAY_A' ? array<string, string|int>|\WP_Error|false : ($output is 'ARRAY_N' ? list<string|int>|\WP_Error|false : \WP_Term|\WP_Error|false)) + */ + function get_term_by($field, $value, $taxonomy = '', $output = \OBJECT, $filter = 'raw') + { + } + /** + * Merges all term children into a single array of their IDs. + * + * This recursive function will merge all of the children of $term into the same + * array of term IDs. Only useful for taxonomies which are hierarchical. + * + * Will return an empty array if $term does not exist in $taxonomy. + * + * @since 2.3.0 + * + * @param int $term_id ID of term to get children. + * @param string $taxonomy Taxonomy name. + * @return array|WP_Error List of term IDs. WP_Error returned if `$taxonomy` does not exist. + */ + function get_term_children($term_id, $taxonomy) + { + } + /** + * Gets sanitized term field. + * + * The function is for contextual reasons and for simplicity of usage. + * + * @since 2.3.0 + * @since 4.4.0 The `$taxonomy` parameter was made optional. `$term` can also now accept a WP_Term object. + * + * @see sanitize_term_field() + * + * @param string $field Term field to fetch. + * @param int|WP_Term $term Term ID or object. + * @param string $taxonomy Optional. Taxonomy name. Default empty. + * @param string $context Optional. How to sanitize term fields. Look at sanitize_term_field() for available options. + * Default 'display'. + * @return string|int|null|WP_Error Will return an empty string if $term is not an object or if $field is not set in $term. + */ + function get_term_field($field, $term, $taxonomy = '', $context = 'display') + { + } + /** + * Sanitizes term for editing. + * + * Return value is sanitize_term() and usage is for sanitizing the term for + * editing. Function is for contextual and simplicity. + * + * @since 2.3.0 + * + * @param int|object $id Term ID or object. + * @param string $taxonomy Taxonomy name. + * @return string|int|null|WP_Error Will return empty string if $term is not an object. + */ + function get_term_to_edit($id, $taxonomy) + { + } + /** + * Retrieves the terms in a given taxonomy or list of taxonomies. + * + * You can fully inject any customizations to the query before it is sent, as + * well as control the output with a filter. + * + * The return type varies depending on the value passed to `$args['fields']`. See + * WP_Term_Query::get_terms() for details. In all cases, a `WP_Error` object will + * be returned if an invalid taxonomy is requested. + * + * The {@see 'get_terms'} filter will be called when the cache has the term and will + * pass the found term along with the array of $taxonomies and array of $args. + * This filter is also called before the array of terms is passed and will pass + * the array of terms, along with the $taxonomies and $args. + * + * The {@see 'list_terms_exclusions'} filter passes the compiled exclusions along with + * the $args. + * + * The {@see 'get_terms_orderby'} filter passes the `ORDER BY` clause for the query + * along with the $args array. + * + * Taxonomy or an array of taxonomies should be passed via the 'taxonomy' argument + * in the `$args` array: + * + * $terms = get_terms( array( + * 'taxonomy' => 'post_tag', + * 'hide_empty' => false, + * ) ); + * + * Prior to 4.5.0, taxonomy was passed as the first parameter of `get_terms()`. + * + * @since 2.3.0 + * @since 4.2.0 Introduced 'name' and 'childless' parameters. + * @since 4.4.0 Introduced the ability to pass 'term_id' as an alias of 'id' for the `orderby` parameter. + * Introduced the 'meta_query' and 'update_term_meta_cache' parameters. Converted to return + * a list of WP_Term objects. + * @since 4.5.0 Changed the function signature so that the `$args` array can be provided as the first parameter. + * Introduced 'meta_key' and 'meta_value' parameters. Introduced the ability to order results by metadata. + * @since 4.8.0 Introduced 'suppress_filter' parameter. + * + * @internal The `$deprecated` parameter is parsed for backward compatibility only. + * + * @param array|string $args Optional. Array or string of arguments. See WP_Term_Query::__construct() + * for information on accepted arguments. Default empty array. + * @param array|string $deprecated Optional. Argument array, when using the legacy function parameter format. + * If present, this parameter will be interpreted as `$args`, and the first + * function parameter will be parsed as a taxonomy or array of taxonomies. + * Default empty. + * @return WP_Term[]|int[]|string[]|string|WP_Error Array of terms, a count thereof as a numeric string, + * or WP_Error if any of the taxonomies do not exist. + * See the function description for more information. + * @phpstan-param array{ + * taxonomy?: string|string[], + * object_ids?: int|int[], + * orderby?: string, + * order?: string, + * hide_empty?: bool|int, + * include?: int[]|string, + * exclude?: int[]|string, + * exclude_tree?: int[]|string, + * number?: int|string, + * offset?: int, + * fields?: string, + * count?: bool, + * name?: string|string[], + * slug?: string|string[], + * term_taxonomy_id?: int|int[], + * hierarchical?: bool, + * search?: string, + * name__like?: string, + * description__like?: string, + * pad_counts?: bool, + * get?: string, + * child_of?: int, + * parent?: int, + * childless?: bool, + * cache_domain?: string, + * cache_results?: bool, + * update_term_meta_cache?: bool, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * } $args See WP_Term_Query::__construct() + */ + function get_terms($args = array(), $deprecated = '') + { + } + /** + * Adds metadata to a term. + * + * @since 4.4.0 + * + * @param int $term_id Term ID. + * @param string $meta_key Metadata name. + * @param mixed $meta_value Metadata value. Must be serializable if non-scalar. + * @param bool $unique Optional. Whether the same key should not be added. + * Default false. + * @return int|false|WP_Error Meta ID on success, false on failure. + * WP_Error when term_id is ambiguous between taxonomies. + */ + function add_term_meta($term_id, $meta_key, $meta_value, $unique = \false) + { + } + /** + * Removes metadata matching criteria from a term. + * + * @since 4.4.0 + * + * @param int $term_id Term ID. + * @param string $meta_key Metadata name. + * @param mixed $meta_value Optional. Metadata value. If provided, + * rows will only be removed that match the value. + * Must be serializable if non-scalar. Default empty. + * @return bool True on success, false on failure. + */ + function delete_term_meta($term_id, $meta_key, $meta_value = '') + { + } + /** + * Retrieves metadata for a term. + * + * @since 4.4.0 + * + * @param int $term_id Term ID. + * @param string $key Optional. The meta key to retrieve. By default, + * returns data for all keys. Default empty. + * @param bool $single Optional. Whether to return a single value. + * This parameter has no effect if `$key` is not specified. + * Default false. + * @return mixed An array of values if `$single` is false. + * The value of the meta field if `$single` is true. + * False for an invalid `$term_id` (non-numeric, zero, or negative value). + * An empty string if a valid but non-existing term ID is passed. + */ + function get_term_meta($term_id, $key = '', $single = \false) + { + } + /** + * Updates term metadata. + * + * Use the `$prev_value` parameter to differentiate between meta fields with the same key and term ID. + * + * If the meta field for the term does not exist, it will be added. + * + * @since 4.4.0 + * + * @param int $term_id Term ID. + * @param string $meta_key Metadata key. + * @param mixed $meta_value Metadata value. Must be serializable if non-scalar. + * @param mixed $prev_value Optional. Previous value to check before updating. + * If specified, only update existing metadata entries with + * this value. Otherwise, update all entries. Default empty. + * @return int|bool|WP_Error Meta ID if the key didn't exist. true on successful update, + * false on failure or if the value passed to the function + * is the same as the one that is already in the database. + * WP_Error when term_id is ambiguous between taxonomies. + */ + function update_term_meta($term_id, $meta_key, $meta_value, $prev_value = '') + { + } + /** + * Updates metadata cache for list of term IDs. + * + * Performs SQL query to retrieve all metadata for the terms matching `$term_ids` and stores them in the cache. + * Subsequent calls to `get_term_meta()` will not need to query the database. + * + * @since 4.4.0 + * + * @param array $term_ids List of term IDs. + * @return array|false An array of metadata on success, false if there is nothing to update. + */ + function update_termmeta_cache($term_ids) + { + } + /** + * Queue term meta for lazy-loading. + * + * @since 6.3.0 + * + * @param array $term_ids List of term IDs. + * @phpstan-return void + */ + function wp_lazyload_term_meta(array $term_ids) + { + } + /** + * Gets all meta data, including meta IDs, for the given term ID. + * + * @since 4.9.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $term_id Term ID. + * @return array|false Array with meta data, or false when the meta table is not installed. + */ + function has_term_meta($term_id) + { + } + /** + * Registers a meta key for terms. + * + * @since 4.9.8 + * + * @param string $taxonomy Taxonomy to register a meta key for. Pass an empty string + * to register the meta key across all existing taxonomies. + * @param string $meta_key The meta key to register. + * @param array $args Data used to describe the meta key when registered. See + * {@see register_meta()} for a list of supported arguments. + * @return bool True if the meta key was successfully registered, false if not. + * @phpstan-param array{ + * object_subtype?: string, + * type?: string, + * description?: string, + * single?: bool, + * default?: mixed, + * sanitize_callback?: callable, + * auth_callback?: callable, + * show_in_rest?: bool|array, + * revisions_enabled?: bool, + * } $args See register_meta() + */ + function register_term_meta($taxonomy, $meta_key, array $args) + { + } + /** + * Unregisters a meta key for terms. + * + * @since 4.9.8 + * + * @param string $taxonomy Taxonomy the meta key is currently registered for. Pass + * an empty string if the meta key is registered across all + * existing taxonomies. + * @param string $meta_key The meta key to unregister. + * @return bool True on success, false if the meta key was not previously registered. + */ + function unregister_term_meta($taxonomy, $meta_key) + { + } + /** + * Determines whether a taxonomy term exists. + * + * Formerly is_term(), introduced in 2.3.0. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 3.0.0 + * @since 6.0.0 Converted to use `get_terms()`. + * + * @global bool $_wp_suspend_cache_invalidation + * + * @param int|string $term The term to check. Accepts term ID, slug, or name. + * @param string $taxonomy Optional. The taxonomy name to use. + * @param int $parent_term Optional. ID of parent term under which to confine the exists search. + * @return mixed Returns null if the term does not exist. + * Returns the term ID if no taxonomy is specified and the term ID exists. + * Returns an array of the term ID and the term taxonomy ID if the taxonomy is specified and the pairing exists. + * Returns 0 if term ID 0 is passed to the function. + * @phpstan-return ($term is 0 ? 0 : ($term is '' ? null : ($taxonomy is '' ? string|null : array{term_id: string, term_taxonomy_id: string}|null))) + */ + function term_exists($term, $taxonomy = '', $parent_term = \null) + { + } + /** + * Checks if a term is an ancestor of another term. + * + * You can use either an ID or the term object for both parameters. + * + * @since 3.4.0 + * + * @param int|object $term1 ID or object to check if this is the parent term. + * @param int|object $term2 The child term. + * @param string $taxonomy Taxonomy name that $term1 and `$term2` belong to. + * @return bool Whether `$term2` is a child of `$term1`. + */ + function term_is_ancestor_of($term1, $term2, $taxonomy) + { + } + /** + * Sanitizes all term fields. + * + * Relies on sanitize_term_field() to sanitize the term. The difference is that + * this function will sanitize **all** fields. The context is based + * on sanitize_term_field(). + * + * The `$term` is expected to be either an array or an object. + * + * @since 2.3.0 + * + * @param array|object $term The term to check. + * @param string $taxonomy The taxonomy name to use. + * @param string $context Optional. Context in which to sanitize the term. + * Accepts 'raw', 'edit', 'db', 'display', 'rss', + * 'attribute', or 'js'. Default 'display'. + * @return array|object Term with all fields sanitized. + * @phpstan-param 'raw'|'edit'|'db'|'display'|'rss'|'attribute'|'js' $context + * @phpstan-template T of array|object + * @phpstan-param T $term + * @phpstan-return T + */ + function sanitize_term($term, $taxonomy, $context = 'display') + { + } + /** + * Sanitizes the field value in the term based on the context. + * + * Passing a term field value through the function should be assumed to have + * cleansed the value for whatever context the term field is going to be used. + * + * If no context or an unsupported context is given, then default filters will + * be applied. + * + * There are enough filters for each context to support a custom filtering + * without creating your own filter function. Simply create a function that + * hooks into the filter you need. + * + * @since 2.3.0 + * + * @param string $field Term field to sanitize. + * @param string $value Search for this term value. + * @param int $term_id Term ID. + * @param string $taxonomy Taxonomy name. + * @param string $context Context in which to sanitize the term field. + * Accepts 'raw', 'edit', 'db', 'display', 'rss', + * 'attribute', or 'js'. Default 'display'. + * @return mixed Sanitized field. + * @phpstan-param 'raw'|'edit'|'db'|'display'|'rss'|'attribute'|'js' $context + */ + function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) + { + } + /** + * Counts how many terms are in taxonomy. + * + * Default $args is 'hide_empty' which can be 'hide_empty=true' or array('hide_empty' => true). + * + * @since 2.3.0 + * @since 5.6.0 Changed the function signature so that the `$args` array can be provided as the first parameter. + * + * @internal The `$deprecated` parameter is parsed for backward compatibility only. + * + * @param array|string $args Optional. Array or string of arguments. See WP_Term_Query::__construct() + * for information on accepted arguments. Default empty array. + * @param array|string $deprecated Optional. Argument array, when using the legacy function parameter format. + * If present, this parameter will be interpreted as `$args`, and the first + * function parameter will be parsed as a taxonomy or array of taxonomies. + * Default empty. + * @return string|WP_Error Numeric string containing the number of terms in that + * taxonomy or WP_Error if the taxonomy does not exist. + * @phpstan-param array{ + * taxonomy?: string|string[], + * object_ids?: int|int[], + * orderby?: string, + * order?: string, + * hide_empty?: bool|int, + * include?: int[]|string, + * exclude?: int[]|string, + * exclude_tree?: int[]|string, + * number?: int|string, + * offset?: int, + * fields?: string, + * count?: bool, + * name?: string|string[], + * slug?: string|string[], + * term_taxonomy_id?: int|int[], + * hierarchical?: bool, + * search?: string, + * name__like?: string, + * description__like?: string, + * pad_counts?: bool, + * get?: string, + * child_of?: int, + * parent?: int, + * childless?: bool, + * cache_domain?: string, + * cache_results?: bool, + * update_term_meta_cache?: bool, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * } $args See WP_Term_Query::__construct() + */ + function wp_count_terms($args = array(), $deprecated = '') + { + } + /** + * Unlinks the object from the taxonomy or taxonomies. + * + * Will remove all relationships between the object and any terms in + * a particular taxonomy or taxonomies. Does not remove the term or + * taxonomy itself. + * + * @since 2.3.0 + * + * @param int $object_id The term object ID that refers to the term. + * @param string|array $taxonomies List of taxonomy names or single taxonomy name. + */ + function wp_delete_object_term_relationships($object_id, $taxonomies) + { + } + /** + * Removes a term from the database. + * + * If the term is a parent of other terms, then the children will be updated to + * that term's parent. + * + * Metadata associated with the term will be deleted. + * + * @since 2.3.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $term Term ID. + * @param string $taxonomy Taxonomy name. + * @param array|string $args { + * Optional. Array of arguments to override the default term ID. Default empty array. + * + * @type int $default The term ID to make the default term. This will only override + * the terms found if there is only one term found. Any other and + * the found terms are used. + * @type bool $force_default Optional. Whether to force the supplied term as default to be + * assigned even if the object was not going to be term-less. + * Default false. + * } + * @return bool|int|WP_Error True on success, false if term does not exist. Zero on attempted + * deletion of default Category. WP_Error if the taxonomy does not exist. + * @phpstan-param array{ + * default?: int, + * force_default?: bool, + * } $args + */ + function wp_delete_term($term, $taxonomy, $args = array()) + { + } + /** + * Deletes one existing category. + * + * @since 2.0.0 + * + * @param int $cat_id Category term ID. + * @return bool|int|WP_Error Returns true if completes delete action; false if term doesn't exist; + * Zero on attempted deletion of default Category; WP_Error object is + * also a possibility. + */ + function wp_delete_category($cat_id) + { + } + /** + * Retrieves the terms associated with the given object(s), in the supplied taxonomies. + * + * @since 2.3.0 + * @since 4.2.0 Added support for 'taxonomy', 'parent', and 'term_taxonomy_id' values of `$orderby`. + * Introduced `$parent` argument. + * @since 4.4.0 Introduced `$meta_query` and `$update_term_meta_cache` arguments. When `$fields` is 'all' or + * 'all_with_object_id', an array of `WP_Term` objects will be returned. + * @since 4.7.0 Refactored to use WP_Term_Query, and to support any WP_Term_Query arguments. + * @since 6.3.0 Passing `update_term_meta_cache` argument value false by default resulting in get_terms() to not + * prime the term meta cache. + * + * @param int|int[] $object_ids The ID(s) of the object(s) to retrieve. + * @param string|string[] $taxonomies The taxonomy names to retrieve terms from. + * @param array|string $args See WP_Term_Query::__construct() for supported arguments. + * @return WP_Term[]|int[]|string[]|string|WP_Error Array of terms, a count thereof as a numeric string, + * or WP_Error if any of the taxonomies do not exist. + * See WP_Term_Query::get_terms() for more information. + * @phpstan-param array{ + * taxonomy?: string|string[], + * object_ids?: int|int[], + * orderby?: string, + * order?: string, + * hide_empty?: bool|int, + * include?: int[]|string, + * exclude?: int[]|string, + * exclude_tree?: int[]|string, + * number?: int|string, + * offset?: int, + * fields?: string, + * count?: bool, + * name?: string|string[], + * slug?: string|string[], + * term_taxonomy_id?: int|int[], + * hierarchical?: bool, + * search?: string, + * name__like?: string, + * description__like?: string, + * pad_counts?: bool, + * get?: string, + * child_of?: int, + * parent?: int, + * childless?: bool, + * cache_domain?: string, + * cache_results?: bool, + * update_term_meta_cache?: bool, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * } $args See WP_Term_Query::__construct() + */ + function wp_get_object_terms($object_ids, $taxonomies, $args = array()) + { + } + /** + * Adds a new term to the database. + * + * A non-existent term is inserted in the following sequence: + * 1. The term is added to the term table, then related to the taxonomy. + * 2. If everything is correct, several actions are fired. + * 3. The 'term_id_filter' is evaluated. + * 4. The term cache is cleaned. + * 5. Several more actions are fired. + * 6. An array is returned containing the `term_id` and `term_taxonomy_id`. + * + * If the 'slug' argument is not empty, then it is checked to see if the term + * is invalid. If it is not a valid, existing term, it is added and the term_id + * is given. + * + * If the taxonomy is hierarchical, and the 'parent' argument is not empty, + * the term is inserted and the term_id will be given. + * + * Error handling: + * If `$taxonomy` does not exist or `$term` is empty, + * a WP_Error object will be returned. + * + * If the term already exists on the same hierarchical level, + * or the term slug and name are not unique, a WP_Error object will be returned. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @since 2.3.0 + * + * @param string $term The term name to add. + * @param string $taxonomy The taxonomy to which to add the term. + * @param array|string $args { + * Optional. Array or query string of arguments for inserting a term. + * + * @type string $alias_of Slug of the term to make this term an alias of. + * Default empty string. Accepts a term slug. + * @type string $description The term description. Default empty string. + * @type int $parent The id of the parent term. Default 0. + * @type string $slug The term slug to use. Default empty string. + * } + * @return array|WP_Error { + * An array of the new term data, WP_Error otherwise. + * + * @type int $term_id The new term ID. + * @type int|string $term_taxonomy_id The new term taxonomy ID. Can be a numeric string. + * } + * @phpstan-param array{ + * alias_of?: string, + * description?: string, + * parent?: int, + * slug?: string, + * } $args + * @phpstan-return \WP_Error|array{ + * term_id: int, + * term_taxonomy_id: int|string, + * } + */ + function wp_insert_term($term, $taxonomy, $args = array()) + { + } + /** + * Creates term and taxonomy relationships. + * + * Relates an object (post, link, etc.) to a term and taxonomy type. Creates the + * term and taxonomy relationship if it doesn't already exist. Creates a term if + * it doesn't exist (using the slug). + * + * A relationship means that the term is grouped in or belongs to the taxonomy. + * A term has no meaning until it is given context by defining which taxonomy it + * exists under. + * + * @since 2.3.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $object_id The object to relate to. + * @param string|int|array $terms A single term slug, single term ID, or array of either term slugs or IDs. + * Will replace all existing related terms in this taxonomy. Passing an + * empty array will remove all related terms. + * @param string $taxonomy The context in which to relate the term to the object. + * @param bool $append Optional. If false will delete difference of terms. Default false. + * @return array|WP_Error Term taxonomy IDs of the affected terms or WP_Error on failure. + */ + function wp_set_object_terms($object_id, $terms, $taxonomy, $append = \false) + { + } + /** + * Adds term(s) associated with a given object. + * + * @since 3.6.0 + * + * @param int $object_id The ID of the object to which the terms will be added. + * @param string|int|array $terms The slug(s) or ID(s) of the term(s) to add. + * @param array|string $taxonomy Taxonomy name. + * @return array|WP_Error Term taxonomy IDs of the affected terms. + */ + function wp_add_object_terms($object_id, $terms, $taxonomy) + { + } + /** + * Removes term(s) associated with a given object. + * + * @since 3.6.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $object_id The ID of the object from which the terms will be removed. + * @param string|int|array $terms The slug(s) or ID(s) of the term(s) to remove. + * @param string $taxonomy Taxonomy name. + * @return bool|WP_Error True on success, false or WP_Error on failure. + */ + function wp_remove_object_terms($object_id, $terms, $taxonomy) + { + } + /** + * Makes term slug unique, if it isn't already. + * + * The `$slug` has to be unique global to every taxonomy, meaning that one + * taxonomy term can't have a matching slug with another taxonomy term. Each + * slug has to be globally unique for every taxonomy. + * + * The way this works is that if the taxonomy that the term belongs to is + * hierarchical and has a parent, it will append that parent to the $slug. + * + * If that still doesn't return a unique slug, then it tries to append a number + * until it finds a number that is truly unique. + * + * The only purpose for `$term` is for appending a parent, if one exists. + * + * @since 2.3.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $slug The string that will be tried for a unique slug. + * @param object $term The term object that the `$slug` will belong to. + * @return string Will return a true unique slug. + */ + function wp_unique_term_slug($slug, $term) + { + } + /** + * Updates term based on arguments provided. + * + * The `$args` will indiscriminately override all values with the same field name. + * Care must be taken to not override important information need to update or + * update will fail (or perhaps create a new term, neither would be acceptable). + * + * Defaults will set 'alias_of', 'description', 'parent', and 'slug' if not + * defined in `$args` already. + * + * 'alias_of' will create a term group, if it doesn't already exist, and + * update it for the `$term`. + * + * If the 'slug' argument in `$args` is missing, then the 'name' will be used. + * If you set 'slug' and it isn't unique, then a WP_Error is returned. + * If you don't pass any slug, then a unique one will be created. + * + * @since 2.3.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $term_id The ID of the term. + * @param string $taxonomy The taxonomy of the term. + * @param array $args { + * Optional. Array of arguments for updating a term. + * + * @type string $alias_of Slug of the term to make this term an alias of. + * Default empty string. Accepts a term slug. + * @type string $description The term description. Default empty string. + * @type int $parent The id of the parent term. Default 0. + * @type string $slug The term slug to use. Default empty string. + * } + * @return array|WP_Error An array containing the `term_id` and `term_taxonomy_id`, + * WP_Error otherwise. + * @phpstan-param array{ + * alias_of?: string, + * description?: string, + * parent?: int, + * slug?: string, + * } $args + */ + function wp_update_term($term_id, $taxonomy, $args = array()) + { + } + /** + * Enables or disables term counting. + * + * @since 2.5.0 + * + * @param bool $defer Optional. Enable if true, disable if false. + * @return bool Whether term counting is enabled or disabled. + */ + function wp_defer_term_counting($defer = \null) + { + } + /** + * Updates the amount of terms in taxonomy. + * + * If there is a taxonomy callback applied, then it will be called for updating + * the count. + * + * The default action is to count what the amount of terms have the relationship + * of term ID. Once that is done, then update the database. + * + * @since 2.3.0 + * + * @param int|array $terms The term_taxonomy_id of the terms. + * @param string $taxonomy The context of the term. + * @param bool $do_deferred Whether to flush the deferred term counts too. Default false. + * @return bool If no terms will return false, and if successful will return true. + */ + function wp_update_term_count($terms, $taxonomy, $do_deferred = \false) + { + } + /** + * Performs term count update immediately. + * + * @since 2.5.0 + * + * @param array $terms The term_taxonomy_id of terms to update. + * @param string $taxonomy The context of the term. + * @return true Always true when complete. + */ + function wp_update_term_count_now($terms, $taxonomy) + { + } + // + // Cache. + // + /** + * Removes the taxonomy relationship to terms from the cache. + * + * Will remove the entire taxonomy relationship containing term `$object_id`. The + * term IDs have to exist within the taxonomy `$object_type` for the deletion to + * take place. + * + * @since 2.3.0 + * + * @global bool $_wp_suspend_cache_invalidation + * + * @see get_object_taxonomies() for more on $object_type. + * + * @param int|array $object_ids Single or list of term object ID(s). + * @param array|string $object_type The taxonomy object type. + * @phpstan-return void + */ + function clean_object_term_cache($object_ids, $object_type) + { + } + /** + * Removes all of the term IDs from the cache. + * + * @since 2.3.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * @global bool $_wp_suspend_cache_invalidation + * + * @param int|int[] $ids Single or array of term IDs. + * @param string $taxonomy Optional. Taxonomy slug. Can be empty, in which case the taxonomies of the passed + * term IDs will be used. Default empty. + * @param bool $clean_taxonomy Optional. Whether to clean taxonomy wide caches (true), or just individual + * term object caches (false). Default true. + * @phpstan-return void + */ + function clean_term_cache($ids, $taxonomy = '', $clean_taxonomy = \true) + { + } + /** + * Cleans the caches for a taxonomy. + * + * @since 4.9.0 + * + * @param string $taxonomy Taxonomy slug. + */ + function clean_taxonomy_cache($taxonomy) + { + } + /** + * Retrieves the cached term objects for the given object ID. + * + * Upstream functions (like get_the_terms() and is_object_in_term()) are + * responsible for populating the object-term relationship cache. The current + * function only fetches relationship data that is already in the cache. + * + * @since 2.3.0 + * @since 4.7.0 Returns a `WP_Error` object if there's an error with + * any of the matched terms. + * + * @param int $id Term object ID, for example a post, comment, or user ID. + * @param string $taxonomy Taxonomy name. + * @return bool|WP_Term[]|WP_Error Array of `WP_Term` objects, if cached. + * False if cache is empty for `$taxonomy` and `$id`. + * WP_Error if get_term() returns an error object for any term. + */ + function get_object_term_cache($id, $taxonomy) + { + } + /** + * Updates the cache for the given term object ID(s). + * + * Note: Due to performance concerns, great care should be taken to only update + * term caches when necessary. Processing time can increase exponentially depending + * on both the number of passed term IDs and the number of taxonomies those terms + * belong to. + * + * Caches will only be updated for terms not already cached. + * + * @since 2.3.0 + * + * @param string|int[] $object_ids Comma-separated list or array of term object IDs. + * @param string|string[] $object_type The taxonomy object type or array of the same. + * @return void|false Void on success or if the `$object_ids` parameter is empty, + * false if all of the terms in `$object_ids` are already cached. + */ + function update_object_term_cache($object_ids, $object_type) + { + } + /** + * Updates terms in cache. + * + * @since 2.3.0 + * + * @param WP_Term[] $terms Array of term objects to change. + * @param string $taxonomy Not used. + */ + function update_term_cache($terms, $taxonomy = '') + { + } + // + // Private. + // + /** + * Retrieves children of taxonomy as term IDs. + * + * @access private + * @since 2.3.0 + * + * @param string $taxonomy Taxonomy name. + * @return array Empty if $taxonomy isn't hierarchical or returns children as term IDs. + */ + function _get_term_hierarchy($taxonomy) + { + } + /** + * Gets the subset of $terms that are descendants of $term_id. + * + * If `$terms` is an array of objects, then _get_term_children() returns an array of objects. + * If `$terms` is an array of IDs, then _get_term_children() returns an array of IDs. + * + * @access private + * @since 2.3.0 + * + * @param int $term_id The ancestor term: all returned terms should be descendants of `$term_id`. + * @param array $terms The set of terms - either an array of term objects or term IDs - from which those that + * are descendants of $term_id will be chosen. + * @param string $taxonomy The taxonomy which determines the hierarchy of the terms. + * @param array $ancestors Optional. Term ancestors that have already been identified. Passed by reference, to keep + * track of found terms when recursing the hierarchy. The array of located ancestors is used + * to prevent infinite recursion loops. For performance, `term_ids` are used as array keys, + * with 1 as value. Default empty array. + * @return array|WP_Error The subset of $terms that are descendants of $term_id. + */ + function _get_term_children($term_id, $terms, $taxonomy, &$ancestors = array()) + { + } + /** + * Adds count of children to parent count. + * + * Recalculates term counts by including items from child terms. Assumes all + * relevant children are already in the $terms argument. + * + * @access private + * @since 2.3.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param object[]|WP_Term[] $terms List of term objects (passed by reference). + * @param string $taxonomy Term context. + * @phpstan-return void + */ + function _pad_term_counts(&$terms, $taxonomy) + { + } + /** + * Adds any terms from the given IDs to the cache that do not already exist in cache. + * + * @since 4.6.0 + * @since 6.1.0 This function is no longer marked as "private". + * @since 6.3.0 Use wp_lazyload_term_meta() for lazy-loading of term meta. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array $term_ids Array of term IDs. + * @param bool $update_meta_cache Optional. Whether to update the meta cache. Default true. + */ + function _prime_term_caches($term_ids, $update_meta_cache = \true) + { + } + // + // Default callbacks. + // + /** + * Updates term count based on object types of the current taxonomy. + * + * Private function for the default callback for post_tag and category + * taxonomies. + * + * @access private + * @since 2.3.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int[] $terms List of term taxonomy IDs. + * @param WP_Taxonomy $taxonomy Current taxonomy object of terms. + */ + function _update_post_term_count($terms, $taxonomy) + { + } + /** + * Updates term count based on number of objects. + * + * Default callback for the 'link_category' taxonomy. + * + * @since 3.3.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int[] $terms List of term taxonomy IDs. + * @param WP_Taxonomy $taxonomy Current taxonomy object of terms. + */ + function _update_generic_term_count($terms, $taxonomy) + { + } + /** + * Creates a new term for a term_taxonomy item that currently shares its term + * with another term_taxonomy. + * + * @ignore + * @since 4.2.0 + * @since 4.3.0 Introduced `$record` parameter. Also, `$term_id` and + * `$term_taxonomy_id` can now accept objects. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int|object $term_id ID of the shared term, or the shared term object. + * @param int|object $term_taxonomy_id ID of the term_taxonomy item to receive a new term, or the term_taxonomy object + * (corresponding to a row from the term_taxonomy table). + * @param bool $record Whether to record data about the split term in the options table. The recording + * process has the potential to be resource-intensive, so during batch operations + * it can be beneficial to skip inline recording and do it just once, after the + * batch is processed. Only set this to `false` if you know what you are doing. + * Default: true. + * @return int|WP_Error When the current term does not need to be split (or cannot be split on the current + * database schema), `$term_id` is returned. When the term is successfully split, the + * new term_id is returned. A WP_Error is returned for miscellaneous errors. + */ + function _split_shared_term($term_id, $term_taxonomy_id, $record = \true) + { + } + /** + * Splits a batch of shared taxonomy terms. + * + * @since 4.3.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * @phpstan-return void + */ + function _wp_batch_split_terms() + { + } + /** + * In order to avoid the _wp_batch_split_terms() job being accidentally removed, + * checks that it's still scheduled while we haven't finished splitting terms. + * + * @ignore + * @since 4.3.0 + */ + function _wp_check_for_scheduled_split_terms() + { + } + /** + * Checks default categories when a term gets split to see if any of them need to be updated. + * + * @ignore + * @since 4.2.0 + * + * @param int $term_id ID of the formerly shared term. + * @param int $new_term_id ID of the new term created for the $term_taxonomy_id. + * @param int $term_taxonomy_id ID for the term_taxonomy row affected by the split. + * @param string $taxonomy Taxonomy for the split term. + * @phpstan-return void + */ + function _wp_check_split_default_terms($term_id, $new_term_id, $term_taxonomy_id, $taxonomy) + { + } + /** + * Checks menu items when a term gets split to see if any of them need to be updated. + * + * @ignore + * @since 4.2.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $term_id ID of the formerly shared term. + * @param int $new_term_id ID of the new term created for the $term_taxonomy_id. + * @param int $term_taxonomy_id ID for the term_taxonomy row affected by the split. + * @param string $taxonomy Taxonomy for the split term. + */ + function _wp_check_split_terms_in_menus($term_id, $new_term_id, $term_taxonomy_id, $taxonomy) + { + } + /** + * If the term being split is a nav_menu, changes associations. + * + * @ignore + * @since 4.3.0 + * + * @param int $term_id ID of the formerly shared term. + * @param int $new_term_id ID of the new term created for the $term_taxonomy_id. + * @param int $term_taxonomy_id ID for the term_taxonomy row affected by the split. + * @param string $taxonomy Taxonomy for the split term. + * @phpstan-return void + */ + function _wp_check_split_nav_menu_terms($term_id, $new_term_id, $term_taxonomy_id, $taxonomy) + { + } + /** + * Gets data about terms that previously shared a single term_id, but have since been split. + * + * @since 4.2.0 + * + * @param int $old_term_id Term ID. This is the old, pre-split term ID. + * @return array Array of new term IDs, keyed by taxonomy. + */ + function wp_get_split_terms($old_term_id) + { + } + /** + * Gets the new term ID corresponding to a previously split term. + * + * @since 4.2.0 + * + * @param int $old_term_id Term ID. This is the old, pre-split term ID. + * @param string $taxonomy Taxonomy that the term belongs to. + * @return int|false If a previously split term is found corresponding to the old term_id and taxonomy, + * the new term_id will be returned. If no previously split term is found matching + * the parameters, returns false. + */ + function wp_get_split_term($old_term_id, $taxonomy) + { + } + /** + * Determines whether a term is shared between multiple taxonomies. + * + * Shared taxonomy terms began to be split in 4.3, but failed cron tasks or + * other delays in upgrade routines may cause shared terms to remain. + * + * @since 4.4.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $term_id Term ID. + * @return bool Returns false if a term is not shared between multiple taxonomies or + * if splitting shared taxonomy terms is finished. + */ + function wp_term_is_shared($term_id) + { + } + /** + * Generates a permalink for a taxonomy term archive. + * + * @since 2.5.0 + * + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * + * @param WP_Term|int|string $term The term object, ID, or slug whose link will be retrieved. + * @param string $taxonomy Optional. Taxonomy. Default empty. + * @return string|WP_Error URL of the taxonomy term archive on success, WP_Error if term does not exist. + */ + function get_term_link($term, $taxonomy = '') + { + } + /** + * Displays the taxonomies of a post with available options. + * + * This function can be used within the loop to display the taxonomies for a + * post without specifying the Post ID. You can also use it outside the Loop to + * display the taxonomies for a specific post. + * + * @since 2.5.0 + * + * @param array $args { + * Arguments about which post to use and how to format the output. Shares all of the arguments + * supported by get_the_taxonomies(), in addition to the following. + * + * @type int|WP_Post $post Post ID or object to get taxonomies of. Default current post. + * @type string $before Displays before the taxonomies. Default empty string. + * @type string $sep Separates each taxonomy. Default is a space. + * @type string $after Displays after the taxonomies. Default empty string. + * } + * @phpstan-param array{ + * post?: int|WP_Post, + * before?: string, + * sep?: string, + * after?: string, + * } $args + */ + function the_taxonomies($args = array()) + { + } + /** + * Retrieves all taxonomies associated with a post. + * + * This function can be used within the loop. It will also return an array of + * the taxonomies with links to the taxonomy and name. + * + * @since 2.5.0 + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. + * @param array $args { + * Optional. Arguments about how to format the list of taxonomies. Default empty array. + * + * @type string $template Template for displaying a taxonomy label and list of terms. + * Default is "Label: Terms." + * @type string $term_template Template for displaying a single term in the list. Default is the term name + * linked to its archive. + * } + * @return string[] List of taxonomies. + * @phpstan-param array{ + * template?: string, + * term_template?: string, + * } $args + */ + function get_the_taxonomies($post = 0, $args = array()) + { + } + /** + * Retrieves all taxonomy names for the given post. + * + * @since 2.5.0 + * + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. + * @return string[] An array of all taxonomy names for the given post. + */ + function get_post_taxonomies($post = 0) + { + } + /** + * Determines if the given object is associated with any of the given terms. + * + * The given terms are checked against the object's terms' term_ids, names and slugs. + * Terms given as integers will only be checked against the object's terms' term_ids. + * If no terms are given, determines if object is associated with any terms in the given taxonomy. + * + * @since 2.7.0 + * + * @param int $object_id ID of the object (post ID, link ID, ...). + * @param string $taxonomy Single taxonomy name. + * @param int|string|int[]|string[] $terms Optional. Term ID, name, slug, or array of such + * to check against. Default null. + * @return bool|WP_Error WP_Error on input error. + */ + function is_object_in_term($object_id, $taxonomy, $terms = \null) + { + } + /** + * Determines if the given object type is associated with the given taxonomy. + * + * @since 3.0.0 + * + * @param string $object_type Object type string. + * @param string $taxonomy Single taxonomy name. + * @return bool True if object is associated with the taxonomy, otherwise false. + */ + function is_object_in_taxonomy($object_type, $taxonomy) + { + } + /** + * Gets an array of ancestor IDs for a given object. + * + * @since 3.1.0 + * @since 4.1.0 Introduced the `$resource_type` argument. + * + * @param int $object_id Optional. The ID of the object. Default 0. + * @param string $object_type Optional. The type of object for which we'll be retrieving + * ancestors. Accepts a post type or a taxonomy name. Default empty. + * @param string $resource_type Optional. Type of resource $object_type is. Accepts 'post_type' + * or 'taxonomy'. Default empty. + * @return int[] An array of IDs of ancestors from lowest to highest in the hierarchy. + * @phpstan-param 'post_type'|'taxonomy' $resource_type + */ + function get_ancestors($object_id = 0, $object_type = '', $resource_type = '') + { + } + /** + * Returns the term's parent's term ID. + * + * @since 3.1.0 + * + * @param int $term_id Term ID. + * @param string $taxonomy Taxonomy name. + * @return int|false Parent term ID on success, false on failure. + */ + function wp_get_term_taxonomy_parent_id($term_id, $taxonomy) + { + } + /** + * Checks the given subset of the term hierarchy for hierarchy loops. + * Prevents loops from forming and breaks those that it finds. + * + * Attached to the {@see 'wp_update_term_parent'} filter. + * + * @since 3.1.0 + * + * @param int $parent_term `term_id` of the parent for the term we're checking. + * @param int $term_id The term we're checking. + * @param string $taxonomy The taxonomy of the term we're checking. + * @return int The new parent for the term. + */ + function wp_check_term_hierarchy_for_loops($parent_term, $term_id, $taxonomy) + { + } + /** + * Determines whether a taxonomy is considered "viewable". + * + * @since 5.1.0 + * + * @param string|WP_Taxonomy $taxonomy Taxonomy name or object. + * @return bool Whether the taxonomy should be considered viewable. + */ + function is_taxonomy_viewable($taxonomy) + { + } + /** + * Determines whether a term is publicly viewable. + * + * A term is considered publicly viewable if its taxonomy is viewable. + * + * @since 6.1.0 + * + * @param int|WP_Term $term Term ID or term object. + * @return bool Whether the term is publicly viewable. + */ + function is_term_publicly_viewable($term) + { + } + /** + * Sets the last changed time for the 'terms' cache group. + * + * @since 5.0.0 + */ + function wp_cache_set_terms_last_changed() + { + } + /** + * Aborts calls to term meta if it is not supported. + * + * @since 5.0.0 + * + * @param mixed $check Skip-value for whether to proceed term meta function execution. + * @return mixed Original value of $check, or false if term meta is not supported. + */ + function wp_check_term_meta_support_prefilter($check) + { + } + /** + * Template loading functions. + * + * @package WordPress + * @subpackage Template + */ + /** + * Retrieves path to a template. + * + * Used to quickly retrieve the path of a template without including the file + * extension. It will also check the parent theme, if the file exists, with + * the use of locate_template(). Allows for more generic template location + * without the use of the other get_*_template() functions. + * + * @since 1.5.0 + * + * @param string $type Filename without extension. + * @param string[] $templates An optional list of template candidates. + * @return string Full path to template file. + */ + function get_query_template($type, $templates = array()) + { + } + /** + * Retrieves path of index template in current or parent template. + * + * The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} + * and {@see '$type_template'} dynamic hooks, where `$type` is 'index'. + * + * @since 3.0.0 + * + * @see get_query_template() + * + * @return string Full path to index template file. + */ + function get_index_template() + { + } + /** + * Retrieves path of 404 template in current or parent template. + * + * The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} + * and {@see '$type_template'} dynamic hooks, where `$type` is '404'. + * + * @since 1.5.0 + * + * @see get_query_template() + * + * @return string Full path to 404 template file. + */ + function get_404_template() + { + } + /** + * Retrieves path of archive template in current or parent template. + * + * The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} + * and {@see '$type_template'} dynamic hooks, where `$type` is 'archive'. + * + * @since 1.5.0 + * + * @see get_query_template() + * + * @return string Full path to archive template file. + */ + function get_archive_template() + { + } + /** + * Retrieves path of post type archive template in current or parent template. + * + * The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} + * and {@see '$type_template'} dynamic hooks, where `$type` is 'archive'. + * + * @since 3.7.0 + * + * @see get_archive_template() + * + * @return string Full path to archive template file. + */ + function get_post_type_archive_template() + { + } + /** + * Retrieves path of author template in current or parent template. + * + * The hierarchy for this template looks like: + * + * 1. author-{nicename}.php + * 2. author-{id}.php + * 3. author.php + * + * An example of this is: + * + * 1. author-john.php + * 2. author-1.php + * 3. author.php + * + * The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} + * and {@see '$type_template'} dynamic hooks, where `$type` is 'author'. + * + * @since 1.5.0 + * + * @see get_query_template() + * + * @return string Full path to author template file. + */ + function get_author_template() + { + } + /** + * Retrieves path of category template in current or parent template. + * + * The hierarchy for this template looks like: + * + * 1. category-{slug}.php + * 2. category-{id}.php + * 3. category.php + * + * An example of this is: + * + * 1. category-news.php + * 2. category-2.php + * 3. category.php + * + * The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} + * and {@see '$type_template'} dynamic hooks, where `$type` is 'category'. + * + * @since 1.5.0 + * @since 4.7.0 The decoded form of `category-{slug}.php` was added to the top of the + * template hierarchy when the category slug contains multibyte characters. + * + * @see get_query_template() + * + * @return string Full path to category template file. + */ + function get_category_template() + { + } + /** + * Retrieves path of tag template in current or parent template. + * + * The hierarchy for this template looks like: + * + * 1. tag-{slug}.php + * 2. tag-{id}.php + * 3. tag.php + * + * An example of this is: + * + * 1. tag-wordpress.php + * 2. tag-3.php + * 3. tag.php + * + * The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} + * and {@see '$type_template'} dynamic hooks, where `$type` is 'tag'. + * + * @since 2.3.0 + * @since 4.7.0 The decoded form of `tag-{slug}.php` was added to the top of the + * template hierarchy when the tag slug contains multibyte characters. + * + * @see get_query_template() + * + * @return string Full path to tag template file. + */ + function get_tag_template() + { + } + /** + * Retrieves path of custom taxonomy term template in current or parent template. + * + * The hierarchy for this template looks like: + * + * 1. taxonomy-{taxonomy_slug}-{term_slug}.php + * 2. taxonomy-{taxonomy_slug}.php + * 3. taxonomy.php + * + * An example of this is: + * + * 1. taxonomy-location-texas.php + * 2. taxonomy-location.php + * 3. taxonomy.php + * + * The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} + * and {@see '$type_template'} dynamic hooks, where `$type` is 'taxonomy'. + * + * @since 2.5.0 + * @since 4.7.0 The decoded form of `taxonomy-{taxonomy_slug}-{term_slug}.php` was added to the top of the + * template hierarchy when the term slug contains multibyte characters. + * + * @see get_query_template() + * + * @return string Full path to custom taxonomy term template file. + */ + function get_taxonomy_template() + { + } + /** + * Retrieves path of date template in current or parent template. + * + * The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} + * and {@see '$type_template'} dynamic hooks, where `$type` is 'date'. + * + * @since 1.5.0 + * + * @see get_query_template() + * + * @return string Full path to date template file. + */ + function get_date_template() + { + } + /** + * Retrieves path of home template in current or parent template. + * + * The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} + * and {@see '$type_template'} dynamic hooks, where `$type` is 'home'. + * + * @since 1.5.0 + * + * @see get_query_template() + * + * @return string Full path to home template file. + */ + function get_home_template() + { + } + /** + * Retrieves path of front page template in current or parent template. + * + * The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} + * and {@see '$type_template'} dynamic hooks, where `$type` is 'frontpage'. + * + * @since 3.0.0 + * + * @see get_query_template() + * + * @return string Full path to front page template file. + */ + function get_front_page_template() + { + } + /** + * Retrieves path of Privacy Policy page template in current or parent template. + * + * The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} + * and {@see '$type_template'} dynamic hooks, where `$type` is 'privacypolicy'. + * + * @since 5.2.0 + * + * @see get_query_template() + * + * @return string Full path to privacy policy template file. + */ + function get_privacy_policy_template() + { + } + /** + * Retrieves path of page template in current or parent template. + * + * Note: For block themes, use locate_block_template() function instead. + * + * The hierarchy for this template looks like: + * + * 1. {Page Template}.php + * 2. page-{page_name}.php + * 3. page-{id}.php + * 4. page.php + * + * An example of this is: + * + * 1. page-templates/full-width.php + * 2. page-about.php + * 3. page-4.php + * 4. page.php + * + * The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} + * and {@see '$type_template'} dynamic hooks, where `$type` is 'page'. + * + * @since 1.5.0 + * @since 4.7.0 The decoded form of `page-{page_name}.php` was added to the top of the + * template hierarchy when the page name contains multibyte characters. + * + * @see get_query_template() + * + * @return string Full path to page template file. + */ + function get_page_template() + { + } + /** + * Retrieves path of search template in current or parent template. + * + * The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} + * and {@see '$type_template'} dynamic hooks, where `$type` is 'search'. + * + * @since 1.5.0 + * + * @see get_query_template() + * + * @return string Full path to search template file. + */ + function get_search_template() + { + } + /** + * Retrieves path of single template in current or parent template. Applies to single Posts, + * single Attachments, and single custom post types. + * + * The hierarchy for this template looks like: + * + * 1. {Post Type Template}.php + * 2. single-{post_type}-{post_name}.php + * 3. single-{post_type}.php + * 4. single.php + * + * An example of this is: + * + * 1. templates/full-width.php + * 2. single-post-hello-world.php + * 3. single-post.php + * 4. single.php + * + * The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} + * and {@see '$type_template'} dynamic hooks, where `$type` is 'single'. + * + * @since 1.5.0 + * @since 4.4.0 `single-{post_type}-{post_name}.php` was added to the top of the template hierarchy. + * @since 4.7.0 The decoded form of `single-{post_type}-{post_name}.php` was added to the top of the + * template hierarchy when the post name contains multibyte characters. + * @since 4.7.0 `{Post Type Template}.php` was added to the top of the template hierarchy. + * + * @see get_query_template() + * + * @return string Full path to single template file. + */ + function get_single_template() + { + } + /** + * Retrieves an embed template path in the current or parent template. + * + * The hierarchy for this template looks like: + * + * 1. embed-{post_type}-{post_format}.php + * 2. embed-{post_type}.php + * 3. embed.php + * + * An example of this is: + * + * 1. embed-post-audio.php + * 2. embed-post.php + * 3. embed.php + * + * The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} + * and {@see '$type_template'} dynamic hooks, where `$type` is 'embed'. + * + * @since 4.5.0 + * + * @see get_query_template() + * + * @return string Full path to embed template file. + */ + function get_embed_template() + { + } + /** + * Retrieves the path of the singular template in current or parent template. + * + * The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} + * and {@see '$type_template'} dynamic hooks, where `$type` is 'singular'. + * + * @since 4.3.0 + * + * @see get_query_template() + * + * @return string Full path to singular template file + */ + function get_singular_template() + { + } + /** + * Retrieves path of attachment template in current or parent template. + * + * The hierarchy for this template looks like: + * + * 1. {mime_type}-{sub_type}.php + * 2. {sub_type}.php + * 3. {mime_type}.php + * 4. attachment.php + * + * An example of this is: + * + * 1. image-jpeg.php + * 2. jpeg.php + * 3. image.php + * 4. attachment.php + * + * The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} + * and {@see '$type_template'} dynamic hooks, where `$type` is 'attachment'. + * + * @since 2.0.0 + * @since 4.3.0 The order of the mime type logic was reversed so the hierarchy is more logical. + * + * @see get_query_template() + * + * @return string Full path to attachment template file. + */ + function get_attachment_template() + { + } + /** + * Set up the globals used for template loading. + * + * @since 6.5.0 + * + * @global string $wp_stylesheet_path Path to current theme's stylesheet directory. + * @global string $wp_template_path Path to current theme's template directory. + */ + function wp_set_template_globals() + { + } + /** + * Retrieves the name of the highest priority template file that exists. + * + * Searches in the stylesheet directory before the template directory and + * wp-includes/theme-compat so that themes which inherit from a parent theme + * can just overload one file. + * + * @since 2.7.0 + * @since 5.5.0 The `$args` parameter was added. + * + * @global string $wp_stylesheet_path Path to current theme's stylesheet directory. + * @global string $wp_template_path Path to current theme's template directory. + * + * @param string|array $template_names Template file(s) to search for, in order. + * @param bool $load If true the template file will be loaded if it is found. + * @param bool $load_once Whether to require_once or require. Has no effect if `$load` is false. + * Default true. + * @param array $args Optional. Additional arguments passed to the template. + * Default empty array. + * @return string The template filename if one is located. + */ + function locate_template($template_names, $load = \false, $load_once = \true, $args = array()) + { + } + /** + * Requires the template file with WordPress environment. + * + * The globals are set up for the template file to ensure that the WordPress + * environment is available from within the function. The query variables are + * also available. + * + * @since 1.5.0 + * @since 5.5.0 The `$args` parameter was added. + * + * @global array $posts + * @global WP_Post $post Global post object. + * @global bool $wp_did_header + * @global WP_Query $wp_query WordPress Query object. + * @global WP_Rewrite $wp_rewrite WordPress rewrite component. + * @global wpdb $wpdb WordPress database abstraction object. + * @global string $wp_version + * @global WP $wp Current WordPress environment instance. + * @global int $id + * @global WP_Comment $comment Global comment object. + * @global int $user_ID + * + * @param string $_template_file Path to template file. + * @param bool $load_once Whether to require_once or require. Default true. + * @param array $args Optional. Additional arguments passed to the template. + * Default empty array. + */ + function load_template($_template_file, $load_once = \true, $args = array()) + { + } + /** + * Theme previews using the Site Editor for block themes. + * + * @package WordPress + */ + /** + * Filters the blog option to return the path for the previewed theme. + * + * @since 6.3.0 + * + * @param string $current_stylesheet The current theme's stylesheet or template path. + * @return string The previewed theme's stylesheet or template path. + */ + function wp_get_theme_preview_path($current_stylesheet = \null) + { + } + /** + * Adds a middleware to `apiFetch` to set the theme for the preview. + * This adds a `wp_theme_preview` URL parameter to API requests from the Site Editor, so they also respond as if the theme is set to the value of the parameter. + * + * @since 6.3.0 + * @phpstan-return void + */ + function wp_attach_theme_preview_middleware() + { + } + /** + * Set a JavaScript constant for theme activation. + * + * Sets the JavaScript global WP_BLOCK_THEME_ACTIVATE_NONCE containing the nonce + * required to activate a theme. For use within the site editor. + * + * @see https://github.com/WordPress/gutenberg/pull/41836 + * + * @since 6.3.0 + * @access private + */ + function wp_block_theme_activate_nonce() + { + } + /** + * Add filters and actions to enable Block Theme Previews in the Site Editor. + * + * The filters and actions should be added after `pluggable.php` is included as they may + * trigger code that uses `current_user_can()` which requires functionality from `pluggable.php`. + * + * @since 6.3.2 + */ + function wp_initialize_theme_preview_hooks() + { + } + /** + * Sets a custom slug when creating auto-draft template parts. + * + * This is only needed for auto-drafts created by the regular WP editor. + * If this page is to be removed, this will not be necessary. + * + * @since 5.9.0 + * + * @param int $post_id Post ID. + * @phpstan-return void + */ + function wp_set_unique_slug_on_create_template_part($post_id) + { + } + /** + * Generates a unique slug for templates. + * + * @access private + * @since 5.8.0 + * + * @param string $override_slug The filtered value of the slug (starts as `null` from apply_filter). + * @param string $slug The original/un-filtered slug (post_name). + * @param int $post_id Post ID. + * @param string $post_status No uniqueness checks are made if the post is still draft or pending. + * @param string $post_type Post type. + * @return string The original, desired slug. + */ + function wp_filter_wp_template_unique_post_slug($override_slug, $slug, $post_id, $post_status, $post_type) + { + } + /** + * Enqueues the skip-link script & styles. + * + * @access private + * @since 6.4.0 + * + * @global string $_wp_current_template_content + * @phpstan-return void + */ + function wp_enqueue_block_template_skip_link() + { + } + /** + * Enables the block templates (editor mode) for themes with theme.json by default. + * + * @access private + * @since 5.8.0 + */ + function wp_enable_block_templates() + { + } + /** + * Theme, template, and stylesheet functions. + * + * @package WordPress + * @subpackage Theme + */ + /** + * Returns an array of WP_Theme objects based on the arguments. + * + * Despite advances over get_themes(), this function is quite expensive, and grows + * linearly with additional themes. Stick to wp_get_theme() if possible. + * + * @since 3.4.0 + * + * @global array $wp_theme_directories + * + * @param array $args { + * Optional. The search arguments. + * + * @type mixed $errors True to return themes with errors, false to return + * themes without errors, null to return all themes. + * Default false. + * @type mixed $allowed (Multisite) True to return only allowed themes for a site. + * False to return only disallowed themes for a site. + * 'site' to return only site-allowed themes. + * 'network' to return only network-allowed themes. + * Null to return all themes. Default null. + * @type int $blog_id (Multisite) The blog ID used to calculate which themes + * are allowed. Default 0, synonymous for the current blog. + * } + * @return WP_Theme[] Array of WP_Theme objects. + * @phpstan-param array{ + * errors?: mixed, + * allowed?: mixed, + * blog_id?: int, + * } $args + */ + function wp_get_themes($args = array()) + { + } + /** + * Gets a WP_Theme object for a theme. + * + * @since 3.4.0 + * + * @global array $wp_theme_directories + * + * @param string $stylesheet Optional. Directory name for the theme. Defaults to active theme. + * @param string $theme_root Optional. Absolute path of the theme root to look in. + * If not specified, get_raw_theme_root() is used to calculate + * the theme root for the $stylesheet provided (or active theme). + * @return WP_Theme Theme object. Be sure to check the object's exists() method + * if you need to confirm the theme's existence. + */ + function wp_get_theme($stylesheet = '', $theme_root = '') + { + } + /** + * Clears the cache held by get_theme_roots() and WP_Theme. + * + * @since 3.5.0 + * @param bool $clear_update_cache Whether to clear the theme updates cache. + */ + function wp_clean_themes_cache($clear_update_cache = \true) + { + } + /** + * Whether a child theme is in use. + * + * @since 3.0.0 + * @since 6.5.0 Makes use of global template variables. + * + * @global string $wp_stylesheet_path Path to current theme's stylesheet directory. + * @global string $wp_template_path Path to current theme's template directory. + * + * @return bool True if a child theme is in use, false otherwise. + */ + function is_child_theme() + { + } + /** + * Retrieves name of the current stylesheet. + * + * The theme name that is currently set as the front end theme. + * + * For all intents and purposes, the template name and the stylesheet name + * are going to be the same for most cases. + * + * @since 1.5.0 + * + * @return string Stylesheet name. + */ + function get_stylesheet() + { + } + /** + * Retrieves stylesheet directory path for the active theme. + * + * @since 1.5.0 + * @since 6.4.0 Memoizes filter execution so that it only runs once for the current theme. + * @since 6.4.2 Memoization removed. + * + * @return string Path to active theme's stylesheet directory. + */ + function get_stylesheet_directory() + { + } + /** + * Retrieves stylesheet directory URI for the active theme. + * + * @since 1.5.0 + * + * @return string URI to active theme's stylesheet directory. + */ + function get_stylesheet_directory_uri() + { + } + /** + * Retrieves stylesheet URI for the active theme. + * + * The stylesheet file name is 'style.css' which is appended to the stylesheet directory URI path. + * See get_stylesheet_directory_uri(). + * + * @since 1.5.0 + * + * @return string URI to active theme's stylesheet. + */ + function get_stylesheet_uri() + { + } + /** + * Retrieves the localized stylesheet URI. + * + * The stylesheet directory for the localized stylesheet files are located, by + * default, in the base theme directory. The name of the locale file will be the + * locale followed by '.css'. If that does not exist, then the text direction + * stylesheet will be checked for existence, for example 'ltr.css'. + * + * The theme may change the location of the stylesheet directory by either using + * the {@see 'stylesheet_directory_uri'} or {@see 'locale_stylesheet_uri'} filters. + * + * If you want to change the location of the stylesheet files for the entire + * WordPress workflow, then change the former. If you just have the locale in a + * separate folder, then change the latter. + * + * @since 2.1.0 + * + * @global WP_Locale $wp_locale WordPress date and time locale object. + * + * @return string URI to active theme's localized stylesheet. + */ + function get_locale_stylesheet_uri() + { + } + /** + * Retrieves name of the active theme. + * + * @since 1.5.0 + * + * @return string Template name. + */ + function get_template() + { + } + /** + * Retrieves template directory path for the active theme. + * + * @since 1.5.0 + * @since 6.4.0 Memoizes filter execution so that it only runs once for the current theme. + * @since 6.4.1 Memoization removed. + * + * @return string Path to active theme's template directory. + */ + function get_template_directory() + { + } + /** + * Retrieves template directory URI for the active theme. + * + * @since 1.5.0 + * + * @return string URI to active theme's template directory. + */ + function get_template_directory_uri() + { + } + /** + * Retrieves theme roots. + * + * @since 2.9.0 + * + * @global array $wp_theme_directories + * + * @return array|string An array of theme roots keyed by template/stylesheet + * or a single theme root if all themes have the same root. + */ + function get_theme_roots() + { + } + /** + * Registers a directory that contains themes. + * + * @since 2.9.0 + * + * @global array $wp_theme_directories + * + * @param string $directory Either the full filesystem path to a theme folder + * or a folder within WP_CONTENT_DIR. + * @return bool True if successfully registered a directory that contains themes, + * false if the directory does not exist. + */ + function register_theme_directory($directory) + { + } + /** + * Searches all registered theme directories for complete and valid themes. + * + * @since 2.9.0 + * + * @global array $wp_theme_directories + * + * @param bool $force Optional. Whether to force a new directory scan. Default false. + * @return array|false Valid themes found on success, false on failure. + */ + function search_theme_directories($force = \false) + { + } + /** + * Retrieves path to themes directory. + * + * Does not have trailing slash. + * + * @since 1.5.0 + * + * @global array $wp_theme_directories + * + * @param string $stylesheet_or_template Optional. The stylesheet or template name of the theme. + * Default is to leverage the main theme root. + * @return string Themes directory path. + */ + function get_theme_root($stylesheet_or_template = '') + { + } + /** + * Retrieves URI for themes directory. + * + * Does not have trailing slash. + * + * @since 1.5.0 + * + * @global array $wp_theme_directories + * + * @param string $stylesheet_or_template Optional. The stylesheet or template name of the theme. + * Default is to leverage the main theme root. + * @param string $theme_root Optional. The theme root for which calculations will be based, + * preventing the need for a get_raw_theme_root() call. Default empty. + * @return string Themes directory URI. + */ + function get_theme_root_uri($stylesheet_or_template = '', $theme_root = '') + { + } + /** + * Gets the raw theme root relative to the content directory with no filters applied. + * + * @since 3.1.0 + * + * @global array $wp_theme_directories + * + * @param string $stylesheet_or_template The stylesheet or template name of the theme. + * @param bool $skip_cache Optional. Whether to skip the cache. + * Defaults to false, meaning the cache is used. + * @return string Theme root. + */ + function get_raw_theme_root($stylesheet_or_template, $skip_cache = \false) + { + } + /** + * Displays localized stylesheet link element. + * + * @since 2.1.0 + * @phpstan-return void + */ + function locale_stylesheet() + { + } + /** + * Switches the theme. + * + * Accepts one argument: $stylesheet of the theme. It also accepts an additional function signature + * of two arguments: $template then $stylesheet. This is for backward compatibility. + * + * @since 2.5.0 + * + * @global array $wp_theme_directories + * @global WP_Customize_Manager $wp_customize + * @global array $sidebars_widgets + * @global array $wp_registered_sidebars + * + * @param string $stylesheet Stylesheet name. + */ + function switch_theme($stylesheet) + { + } + /** + * Checks that the active theme has the required files. + * + * Standalone themes need to have a `templates/index.html` or `index.php` template file. + * Child themes need to have a `Template` header in the `style.css` stylesheet. + * + * Does not initially check the default theme, which is the fallback and should always exist. + * But if it doesn't exist, it'll fall back to the latest core default theme that does exist. + * Will switch theme to the fallback theme if active theme does not validate. + * + * You can use the {@see 'validate_current_theme'} filter to return false to disable + * this functionality. + * + * @since 1.5.0 + * @since 6.0.0 Removed the requirement for block themes to have an `index.php` template. + * + * @see WP_DEFAULT_THEME + * + * @return bool + */ + function validate_current_theme() + { + } + /** + * Validates the theme requirements for WordPress version and PHP version. + * + * Uses the information from `Requires at least` and `Requires PHP` headers + * defined in the theme's `style.css` file. + * + * @since 5.5.0 + * @since 5.8.0 Removed support for using `readme.txt` as a fallback. + * + * @param string $stylesheet Directory name for the theme. + * @return true|WP_Error True if requirements are met, WP_Error on failure. + */ + function validate_theme_requirements($stylesheet) + { + } + /** + * Retrieves all theme modifications. + * + * @since 3.1.0 + * @since 5.9.0 The return value is always an array. + * + * @return array Theme modifications. + */ + function get_theme_mods() + { + } + /** + * Retrieves theme modification value for the active theme. + * + * If the modification name does not exist and `$default_value` is a string, then the + * default will be passed through the {@link https://www.php.net/sprintf sprintf()} + * PHP function with the template directory URI as the first value and the + * stylesheet directory URI as the second value. + * + * @since 2.1.0 + * + * @param string $name Theme modification name. + * @param mixed $default_value Optional. Theme modification default value. Default false. + * @return mixed Theme modification value. + */ + function get_theme_mod($name, $default_value = \false) + { + } + /** + * Updates theme modification value for the active theme. + * + * @since 2.1.0 + * @since 5.6.0 A return value was added. + * + * @param string $name Theme modification name. + * @param mixed $value Theme modification value. + * @return bool True if the value was updated, false otherwise. + */ + function set_theme_mod($name, $value) + { + } + /** + * Removes theme modification name from active theme list. + * + * If removing the name also removes all elements, then the entire option + * will be removed. + * + * @since 2.1.0 + * + * @param string $name Theme modification name. + * @phpstan-return void + */ + function remove_theme_mod($name) + { + } + /** + * Removes theme modifications option for the active theme. + * + * @since 2.1.0 + */ + function remove_theme_mods() + { + } + /** + * Retrieves the custom header text color in 3- or 6-digit hexadecimal form. + * + * @since 2.1.0 + * + * @return string Header text color in 3- or 6-digit hexadecimal form (minus the hash symbol). + */ + function get_header_textcolor() + { + } + /** + * Displays the custom header text color in 3- or 6-digit hexadecimal form (minus the hash symbol). + * + * @since 2.1.0 + */ + function header_textcolor() + { + } + /** + * Whether to display the header text. + * + * @since 3.4.0 + * + * @return bool + */ + function display_header_text() + { + } + /** + * Checks whether a header image is set or not. + * + * @since 4.2.0 + * + * @see get_header_image() + * + * @return bool Whether a header image is set or not. + */ + function has_header_image() + { + } + /** + * Retrieves header image for custom header. + * + * @since 2.1.0 + * + * @return string|false + */ + function get_header_image() + { + } + /** + * Creates image tag markup for a custom header image. + * + * @since 4.4.0 + * + * @param array $attr Optional. Additional attributes for the image tag. Can be used + * to override the default attributes. Default empty. + * @return string HTML image element markup or empty string on failure. + */ + function get_header_image_tag($attr = array()) + { + } + /** + * Displays the image markup for a custom header image. + * + * @since 4.4.0 + * + * @param array $attr Optional. Attributes for the image markup. Default empty. + */ + function the_header_image_tag($attr = array()) + { + } + /** + * Gets random header image data from registered images in theme. + * + * @since 3.4.0 + * + * @access private + * + * @global array $_wp_default_headers + * + * @return object + */ + function _get_random_header_data() + { + } + /** + * Gets random header image URL from registered images in theme. + * + * @since 3.2.0 + * + * @return string Path to header image. + */ + function get_random_header_image() + { + } + /** + * Checks if random header image is in use. + * + * Always true if user expressly chooses the option in Appearance > Header. + * Also true if theme has multiple header images registered, no specific header image + * is chosen, and theme turns on random headers with add_theme_support(). + * + * @since 3.2.0 + * + * @param string $type The random pool to use. Possible values include 'any', + * 'default', 'uploaded'. Default 'any'. + * @return bool + */ + function is_random_header_image($type = 'any') + { + } + /** + * Displays header image URL. + * + * @since 2.1.0 + */ + function header_image() + { + } + /** + * Gets the header images uploaded for the active theme. + * + * @since 3.2.0 + * + * @return array + */ + function get_uploaded_header_images() + { + } + /** + * Gets the header image data. + * + * @since 3.4.0 + * + * @global array $_wp_default_headers + * + * @return object + */ + function get_custom_header() + { + } + /** + * Registers a selection of default headers to be displayed by the custom header admin UI. + * + * @since 3.0.0 + * + * @global array $_wp_default_headers + * + * @param array $headers Array of headers keyed by a string ID. The IDs point to arrays + * containing 'url', 'thumbnail_url', and 'description' keys. + */ + function register_default_headers($headers) + { + } + /** + * Unregisters default headers. + * + * This function must be called after register_default_headers() has already added the + * header you want to remove. + * + * @see register_default_headers() + * @since 3.0.0 + * + * @global array $_wp_default_headers + * + * @param string|array $header The header string id (key of array) to remove, or an array thereof. + * @return bool|void A single header returns true on success, false on failure. + * There is currently no return value for multiple headers. + */ + function unregister_default_headers($header) + { + } + /** + * Checks whether a header video is set or not. + * + * @since 4.7.0 + * + * @see get_header_video_url() + * + * @return bool Whether a header video is set or not. + */ + function has_header_video() + { + } + /** + * Retrieves header video URL for custom header. + * + * Uses a local video if present, or falls back to an external video. + * + * @since 4.7.0 + * + * @return string|false Header video URL or false if there is no video. + */ + function get_header_video_url() + { + } + /** + * Displays header video URL. + * + * @since 4.7.0 + */ + function the_header_video_url() + { + } + /** + * Retrieves header video settings. + * + * @since 4.7.0 + * + * @return array + */ + function get_header_video_settings() + { + } + /** + * Checks whether a custom header is set or not. + * + * @since 4.7.0 + * + * @return bool True if a custom header is set. False if not. + */ + function has_custom_header() + { + } + /** + * Checks whether the custom header video is eligible to show on the current page. + * + * @since 4.7.0 + * + * @return bool True if the custom header video should be shown. False if not. + */ + function is_header_video_active() + { + } + /** + * Retrieves the markup for a custom header. + * + * The container div will always be returned in the Customizer preview. + * + * @since 4.7.0 + * + * @return string The markup for a custom header on success. + */ + function get_custom_header_markup() + { + } + /** + * Prints the markup for a custom header. + * + * A container div will always be printed in the Customizer preview. + * + * @since 4.7.0 + * @phpstan-return void + */ + function the_custom_header_markup() + { + } + /** + * Retrieves background image for custom background. + * + * @since 3.0.0 + * + * @return string + */ + function get_background_image() + { + } + /** + * Displays background image path. + * + * @since 3.0.0 + */ + function background_image() + { + } + /** + * Retrieves value for custom background color. + * + * @since 3.0.0 + * + * @return string + */ + function get_background_color() + { + } + /** + * Displays background color value. + * + * @since 3.0.0 + */ + function background_color() + { + } + /** + * Default custom background callback. + * + * @since 3.0.0 + * @phpstan-return void + */ + function _custom_background_cb() + { + } + /** + * Renders the Custom CSS style element. + * + * @since 4.7.0 + */ + function wp_custom_css_cb() + { + } + /** + * Fetches the `custom_css` post for a given theme. + * + * @since 4.7.0 + * + * @param string $stylesheet Optional. A theme object stylesheet name. Defaults to the active theme. + * @return WP_Post|null The custom_css post or null if none exists. + */ + function wp_get_custom_css_post($stylesheet = '') + { + } + /** + * Fetches the saved Custom CSS content for rendering. + * + * @since 4.7.0 + * + * @param string $stylesheet Optional. A theme object stylesheet name. Defaults to the active theme. + * @return string The Custom CSS Post content. + */ + function wp_get_custom_css($stylesheet = '') + { + } + /** + * Updates the `custom_css` post for a given theme. + * + * Inserts a `custom_css` post when one doesn't yet exist. + * + * @since 4.7.0 + * + * @param string $css CSS, stored in `post_content`. + * @param array $args { + * Args. + * + * @type string $preprocessed Optional. Pre-processed CSS, stored in `post_content_filtered`. + * Normally empty string. + * @type string $stylesheet Optional. Stylesheet (child theme) to update. + * Defaults to active theme/stylesheet. + * } + * @return WP_Post|WP_Error Post on success, error on failure. + * @phpstan-param array{ + * preprocessed?: string, + * stylesheet?: string, + * } $args + */ + function wp_update_custom_css_post($css, $args = array()) + { + } + /** + * Adds callback for custom TinyMCE editor stylesheets. + * + * The parameter $stylesheet is the name of the stylesheet, relative to + * the theme root. It also accepts an array of stylesheets. + * It is optional and defaults to 'editor-style.css'. + * + * This function automatically adds another stylesheet with -rtl prefix, e.g. editor-style-rtl.css. + * If that file doesn't exist, it is removed before adding the stylesheet(s) to TinyMCE. + * If an array of stylesheets is passed to add_editor_style(), + * RTL is only added for the first stylesheet. + * + * Since version 3.4 the TinyMCE body has .rtl CSS class. + * It is a better option to use that class and add any RTL styles to the main stylesheet. + * + * @since 3.0.0 + * + * @global array $editor_styles + * + * @param array|string $stylesheet Optional. Stylesheet name or array thereof, relative to theme root. + * Defaults to 'editor-style.css' + */ + function add_editor_style($stylesheet = 'editor-style.css') + { + } + /** + * Removes all visual editor stylesheets. + * + * @since 3.1.0 + * + * @global array $editor_styles + * + * @return bool True on success, false if there were no stylesheets to remove. + */ + function remove_editor_styles() + { + } + /** + * Retrieves any registered editor stylesheet URLs. + * + * @since 4.0.0 + * + * @global array $editor_styles Registered editor stylesheets + * + * @return string[] If registered, a list of editor stylesheet URLs. + */ + function get_editor_stylesheets() + { + } + /** + * Expands a theme's starter content configuration using core-provided data. + * + * @since 4.7.0 + * + * @return array Array of starter content. + */ + function get_theme_starter_content() + { + } + /** + * Registers theme support for a given feature. + * + * Must be called in the theme's functions.php file to work. + * If attached to a hook, it must be {@see 'after_setup_theme'}. + * The {@see 'init'} hook may be too late for some features. + * + * Example usage: + * + * add_theme_support( 'title-tag' ); + * add_theme_support( 'custom-logo', array( + * 'height' => 480, + * 'width' => 720, + * ) ); + * + * @since 2.9.0 + * @since 3.4.0 The `custom-header-uploads` feature was deprecated. + * @since 3.6.0 The `html5` feature was added. + * @since 3.6.1 The `html5` feature requires an array of types to be passed. Defaults to + * 'comment-list', 'comment-form', 'search-form' for backward compatibility. + * @since 3.9.0 The `html5` feature now also accepts 'gallery' and 'caption'. + * @since 4.1.0 The `title-tag` feature was added. + * @since 4.5.0 The `customize-selective-refresh-widgets` feature was added. + * @since 4.7.0 The `starter-content` feature was added. + * @since 5.0.0 The `responsive-embeds`, `align-wide`, `dark-editor-style`, `disable-custom-colors`, + * `disable-custom-font-sizes`, `editor-color-palette`, `editor-font-sizes`, + * `editor-styles`, and `wp-block-styles` features were added. + * @since 5.3.0 The `html5` feature now also accepts 'script' and 'style'. + * @since 5.3.0 Formalized the existing and already documented `...$args` parameter + * by adding it to the function signature. + * @since 5.4.0 The `disable-custom-gradients` feature limits to default gradients or gradients added + * through `editor-gradient-presets` theme support. + * @since 5.5.0 The `core-block-patterns` feature was added and is enabled by default. + * @since 5.5.0 The `custom-logo` feature now also accepts 'unlink-homepage-logo'. + * @since 5.6.0 The `post-formats` feature warns if no array is passed as the second parameter. + * @since 5.8.0 The `widgets-block-editor` feature enables the Widgets block editor. + * @since 5.8.0 The `block-templates` feature indicates whether a theme uses block-based templates. + * @since 6.0.0 The `html5` feature warns if no array is passed as the second parameter. + * @since 6.1.0 The `block-template-parts` feature allows to edit any reusable template part from site editor. + * @since 6.1.0 The `disable-layout-styles` feature disables the default layout styles. + * @since 6.3.0 The `link-color` feature allows to enable the link color setting. + * @since 6.3.0 The `border` feature allows themes without theme.json to add border styles to blocks. + * @since 6.5.0 The `appearance-tools` feature enables a few design tools for blocks, + * see `WP_Theme_JSON::APPEARANCE_TOOLS_OPT_INS` for a complete list. + * @since 6.6.0 The `editor-spacing-sizes` feature was added. + * + * @global array $_wp_theme_features + * + * @param string $feature The feature being added. Likely core values include: + * - 'admin-bar' + * - 'align-wide' + * - 'appearance-tools' + * - 'automatic-feed-links' + * - 'block-templates' + * - 'block-template-parts' + * - 'border' + * - 'core-block-patterns' + * - 'custom-background' + * - 'custom-header' + * - 'custom-line-height' + * - 'custom-logo' + * - 'customize-selective-refresh-widgets' + * - 'custom-spacing' + * - 'custom-units' + * - 'dark-editor-style' + * - 'disable-custom-colors' + * - 'disable-custom-font-sizes' + * - 'disable-custom-gradients' + * - 'disable-layout-styles' + * - 'editor-color-palette' + * - 'editor-gradient-presets' + * - 'editor-font-sizes' + * - 'editor-spacing-sizes' + * - 'editor-styles' + * - 'featured-content' + * - 'html5' + * - 'link-color' + * - 'menus' + * - 'post-formats' + * - 'post-thumbnails' + * - 'responsive-embeds' + * - 'starter-content' + * - 'title-tag' + * - 'widgets' + * - 'widgets-block-editor' + * - 'wp-block-styles' + * @param mixed ...$args Optional extra arguments to pass along with certain features. + * @return void|false Void on success, false on failure. + */ + function add_theme_support($feature, ...$args) + { + } + /** + * Registers the internal custom header and background routines. + * + * @since 3.4.0 + * @access private + * + * @global Custom_Image_Header $custom_image_header + * @global Custom_Background $custom_background + */ + function _custom_header_background_just_in_time() + { + } + /** + * Adds CSS to hide header text for custom logo, based on Customizer setting. + * + * @since 4.5.0 + * @access private + */ + function _custom_logo_header_styles() + { + } + /** + * Gets the theme support arguments passed when registering that support. + * + * Example usage: + * + * get_theme_support( 'custom-logo' ); + * get_theme_support( 'custom-header', 'width' ); + * + * @since 3.1.0 + * @since 5.3.0 Formalized the existing and already documented `...$args` parameter + * by adding it to the function signature. + * + * @global array $_wp_theme_features + * + * @param string $feature The feature to check. See add_theme_support() for the list + * of possible values. + * @param mixed ...$args Optional extra arguments to be checked against certain features. + * @return mixed The array of extra arguments or the value for the registered feature. + */ + function get_theme_support($feature, ...$args) + { + } + /** + * Allows a theme to de-register its support of a certain feature + * + * Should be called in the theme's functions.php file. Generally would + * be used for child themes to override support from the parent theme. + * + * @since 3.0.0 + * + * @see add_theme_support() + * + * @param string $feature The feature being removed. See add_theme_support() for the list + * of possible values. + * @return bool|void Whether feature was removed. + */ + function remove_theme_support($feature) + { + } + /** + * Do not use. Removes theme support internally without knowledge of those not used + * by themes directly. + * + * @access private + * @since 3.1.0 + * @global array $_wp_theme_features + * @global Custom_Image_Header $custom_image_header + * @global Custom_Background $custom_background + * + * @param string $feature The feature being removed. See add_theme_support() for the list + * of possible values. + * @return bool True if support was removed, false if the feature was not registered. + */ + function _remove_theme_support($feature) + { + } + /** + * Checks a theme's support for a given feature. + * + * Example usage: + * + * current_theme_supports( 'custom-logo' ); + * current_theme_supports( 'html5', 'comment-form' ); + * + * @since 2.9.0 + * @since 5.3.0 Formalized the existing and already documented `...$args` parameter + * by adding it to the function signature. + * + * @global array $_wp_theme_features + * + * @param string $feature The feature being checked. See add_theme_support() for the list + * of possible values. + * @param mixed ...$args Optional extra arguments to be checked against certain features. + * @return bool True if the active theme supports the feature, false otherwise. + */ + function current_theme_supports($feature, ...$args) + { + } + /** + * Checks a theme's support for a given feature before loading the functions which implement it. + * + * @since 2.9.0 + * + * @param string $feature The feature being checked. See add_theme_support() for the list + * of possible values. + * @param string $file Path to the file. + * @return bool True if the active theme supports the supplied feature, false otherwise. + */ + function require_if_theme_supports($feature, $file) + { + } + /** + * Registers a theme feature for use in add_theme_support(). + * + * This does not indicate that the active theme supports the feature, it only describes + * the feature's supported options. + * + * @since 5.5.0 + * + * @see add_theme_support() + * + * @global array $_wp_registered_theme_features + * + * @param string $feature The name uniquely identifying the feature. See add_theme_support() + * for the list of possible values. + * @param array $args { + * Data used to describe the theme. + * + * @type string $type The type of data associated with this feature. + * Valid values are 'string', 'boolean', 'integer', + * 'number', 'array', and 'object'. Defaults to 'boolean'. + * @type bool $variadic Does this feature utilize the variadic support + * of add_theme_support(), or are all arguments specified + * as the second parameter. Must be used with the "array" type. + * @type string $description A short description of the feature. Included in + * the Themes REST API schema. Intended for developers. + * @type bool|array $show_in_rest { + * Whether this feature should be included in the Themes REST API endpoint. + * Defaults to not being included. When registering an 'array' or 'object' type, + * this argument must be an array with the 'schema' key. + * + * @type array $schema Specifies the JSON Schema definition describing + * the feature. If any objects in the schema do not include + * the 'additionalProperties' keyword, it is set to false. + * @type string $name An alternate name to be used as the property name + * in the REST API. + * @type callable $prepare_callback A function used to format the theme support in the REST API. + * Receives the raw theme support value. + * } + * } + * @return true|WP_Error True if the theme feature was successfully registered, a WP_Error object if not. + * @phpstan-param array{ + * type?: string, + * variadic?: bool, + * description?: string, + * show_in_rest?: bool|array{ + * schema: array, + * name: string, + * prepare_callback: callable, + * }, + * } $args + */ + function register_theme_feature($feature, $args = array()) + { + } + /** + * Gets the list of registered theme features. + * + * @since 5.5.0 + * + * @global array $_wp_registered_theme_features + * + * @return array[] List of theme features, keyed by their name. + */ + function get_registered_theme_features() + { + } + /** + * Gets the registration config for a theme feature. + * + * @since 5.5.0 + * + * @global array $_wp_registered_theme_features + * + * @param string $feature The feature name. See add_theme_support() for the list + * of possible values. + * @return array|null The registration args, or null if the feature was not registered. + */ + function get_registered_theme_feature($feature) + { + } + /** + * Checks an attachment being deleted to see if it's a header or background image. + * + * If true it removes the theme modification which would be pointing at the deleted + * attachment. + * + * @access private + * @since 3.0.0 + * @since 4.3.0 Also removes `header_image_data`. + * @since 4.5.0 Also removes custom logo theme mods. + * @since 6.6.0 Also removes `site_logo` option set by the site logo block. + * + * @param int $id The attachment ID. + */ + function _delete_attachment_theme_mod($id) + { + } + /** + * Checks if a theme has been changed and runs 'after_switch_theme' hook on the next WP load. + * + * See {@see 'after_switch_theme'}. + * + * @since 3.3.0 + */ + function check_theme_switched() + { + } + /** + * Includes and instantiates the WP_Customize_Manager class. + * + * Loads the Customizer at plugins_loaded when accessing the customize.php admin + * page or when any request includes a wp_customize=on param or a customize_changeset + * param (a UUID). This param is a signal for whether to bootstrap the Customizer when + * WordPress is loading, especially in the Customizer preview + * or when making Customizer Ajax requests for widgets or menus. + * + * @since 3.4.0 + * + * @global WP_Customize_Manager $wp_customize + * @phpstan-return void + */ + function _wp_customize_include() + { + } + /** + * Publishes a snapshot's changes. + * + * @since 4.7.0 + * @access private + * + * @global WP_Customize_Manager $wp_customize Customizer instance. + * + * @param string $new_status New post status. + * @param string $old_status Old post status. + * @param WP_Post $changeset_post Changeset post object. + * @phpstan-return void + */ + function _wp_customize_publish_changeset($new_status, $old_status, $changeset_post) + { + } + /** + * Filters changeset post data upon insert to ensure post_name is intact. + * + * This is needed to prevent the post_name from being dropped when the post is + * transitioned into pending status by a contributor. + * + * @since 4.7.0 + * + * @see wp_insert_post() + * + * @param array $post_data An array of slashed post data. + * @param array $supplied_post_data An array of sanitized, but otherwise unmodified post data. + * @return array Filtered data. + */ + function _wp_customize_changeset_filter_insert_post_data($post_data, $supplied_post_data) + { + } + /** + * Adds settings for the customize-loader script. + * + * @since 3.4.0 + */ + function _wp_customize_loader_settings() + { + } + /** + * Returns a URL to load the Customizer. + * + * @since 3.4.0 + * + * @param string $stylesheet Optional. Theme to customize. Defaults to active theme. + * The theme's stylesheet will be urlencoded if necessary. + * @return string + */ + function wp_customize_url($stylesheet = '') + { + } + /** + * Prints a script to check whether or not the Customizer is supported, + * and apply either the no-customize-support or customize-support class + * to the body. + * + * This function MUST be called inside the body tag. + * + * Ideally, call this function immediately after the body tag is opened. + * This prevents a flash of unstyled content. + * + * It is also recommended that you add the "no-customize-support" class + * to the body tag by default. + * + * @since 3.4.0 + * @since 4.7.0 Support for IE8 and below is explicitly removed via conditional comments. + * @since 5.5.0 IE8 and older are no longer supported. + */ + function wp_customize_support_script() + { + } + /** + * Whether the site is being previewed in the Customizer. + * + * @since 4.0.0 + * + * @global WP_Customize_Manager $wp_customize Customizer instance. + * + * @return bool True if the site is being previewed in the Customizer, false otherwise. + */ + function is_customize_preview() + { + } + /** + * Makes sure that auto-draft posts get their post_date bumped or status changed + * to draft to prevent premature garbage-collection. + * + * When a changeset is updated but remains an auto-draft, ensure the post_date + * for the auto-draft posts remains the same so that it will be + * garbage-collected at the same time by `wp_delete_auto_drafts()`. Otherwise, + * if the changeset is updated to be a draft then update the posts + * to have a far-future post_date so that they will never be garbage collected + * unless the changeset post itself is deleted. + * + * When a changeset is updated to be a persistent draft or to be scheduled for + * publishing, then transition any dependent auto-drafts to a draft status so + * that they likewise will not be garbage-collected but also so that they can + * be edited in the admin before publishing since there is not yet a post/page + * editing flow in the Customizer. See #39752. + * + * @link https://core.trac.wordpress.org/ticket/39752 + * + * @since 4.8.0 + * @access private + * @see wp_delete_auto_drafts() + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $new_status Transition to this post status. + * @param string $old_status Previous post status. + * @param \WP_Post $post Post data. + * @phpstan-return void + */ + function _wp_keep_alive_customize_changeset_dependent_auto_drafts($new_status, $old_status, $post) + { + } + /** + * Creates the initial theme features when the 'setup_theme' action is fired. + * + * See {@see 'setup_theme'}. + * + * @since 5.5.0 + * @since 6.0.1 The `block-templates` feature was added. + */ + function create_initial_theme_features() + { + } + /** + * Returns whether the active theme is a block-based theme or not. + * + * @since 5.9.0 + * + * @return bool Whether the active theme is a block-based theme or not. + */ + function wp_is_block_theme() + { + } + /** + * Given an element name, returns a class name. + * + * Alias of WP_Theme_JSON::get_element_class_name. + * + * @since 6.1.0 + * + * @param string $element The name of the element. + * + * @return string The name of the class. + */ + function wp_theme_get_element_class_name($element) + { + } + /** + * Adds default theme supports for block themes when the 'after_setup_theme' action fires. + * + * See {@see 'after_setup_theme'}. + * + * @since 5.9.0 + * @access private + */ + function _add_default_theme_supports() + { + } + /** + * A simple set of functions to check the WordPress.org Version Update service. + * + * @package WordPress + * @since 2.3.0 + */ + /** + * Checks WordPress version against the newest version. + * + * The WordPress version, PHP version, and locale is sent. + * + * Checks against the WordPress server at api.wordpress.org. Will only check + * if WordPress isn't installing. + * + * @since 2.3.0 + * + * @global string $wp_version Used to check against the newest WordPress version. + * @global wpdb $wpdb WordPress database abstraction object. + * @global string $wp_local_package Locale code of the package. + * + * @param array $extra_stats Extra statistics to report to the WordPress.org API. + * @param bool $force_check Whether to bypass the transient cache and force a fresh update check. + * Defaults to false, true if $extra_stats is set. + * @phpstan-return void + */ + function wp_version_check($extra_stats = array(), $force_check = \false) + { + } + /** + * Checks for available updates to plugins based on the latest versions hosted on WordPress.org. + * + * Despite its name this function does not actually perform any updates, it only checks for available updates. + * + * A list of all plugins installed is sent to WP, along with the site locale. + * + * Checks against the WordPress server at api.wordpress.org. Will only check + * if WordPress isn't installing. + * + * @since 2.3.0 + * + * @global string $wp_version The WordPress version string. + * + * @param array $extra_stats Extra statistics to report to the WordPress.org API. + */ + function wp_update_plugins($extra_stats = array()) + { + } + /** + * Checks for available updates to themes based on the latest versions hosted on WordPress.org. + * + * Despite its name this function does not actually perform any updates, it only checks for available updates. + * + * A list of all themes installed is sent to WP, along with the site locale. + * + * Checks against the WordPress server at api.wordpress.org. Will only check + * if WordPress isn't installing. + * + * @since 2.7.0 + * + * @global string $wp_version The WordPress version string. + * + * @param array $extra_stats Extra statistics to report to the WordPress.org API. + * @phpstan-return void + */ + function wp_update_themes($extra_stats = array()) + { + } + /** + * Performs WordPress automatic background updates. + * + * Updates WordPress core plus any plugins and themes that have automatic updates enabled. + * + * @since 3.7.0 + */ + function wp_maybe_auto_update() + { + } + /** + * Retrieves a list of all language updates available. + * + * @since 3.7.0 + * + * @return object[] Array of translation objects that have available updates. + */ + function wp_get_translation_updates() + { + } + /** + * Collects counts and UI strings for available updates. + * + * @since 3.3.0 + * + * @return array + */ + function wp_get_update_data() + { + } + /** + * Determines whether core should be updated. + * + * @since 2.8.0 + * + * @global string $wp_version The WordPress version string. + * @phpstan-return void + */ + function _maybe_update_core() + { + } + /** + * Checks the last time plugins were run before checking plugin versions. + * + * This might have been backported to WordPress 2.6.1 for performance reasons. + * This is used for the wp-admin to check only so often instead of every page + * load. + * + * @since 2.7.0 + * @access private + * @phpstan-return void + */ + function _maybe_update_plugins() + { + } + /** + * Checks themes versions only after a duration of time. + * + * This is for performance reasons to make sure that on the theme version + * checker is not run on every page load. + * + * @since 2.7.0 + * @access private + * @phpstan-return void + */ + function _maybe_update_themes() + { + } + /** + * Schedules core, theme, and plugin update checks. + * + * @since 3.1.0 + */ + function wp_schedule_update_checks() + { + } + /** + * Clears existing update caches for plugins, themes, and core. + * + * @since 4.1.0 + */ + function wp_clean_update_cache() + { + } + /** + * Schedules the removal of all contents in the temporary backup directory. + * + * @since 6.3.0 + * @phpstan-return void + */ + function wp_delete_all_temp_backups() + { + } + /** + * Deletes all contents in the temporary backup directory. + * + * @since 6.3.0 + * + * @access private + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * + * @return void|WP_Error Void on success, or a WP_Error object on failure. + */ + function _wp_delete_all_temp_backups() + { + } + /** + * Core User API + * + * @package WordPress + * @subpackage Users + */ + /** + * Authenticates and logs a user in with 'remember' capability. + * + * The credentials is an array that has 'user_login', 'user_password', and + * 'remember' indices. If the credentials is not given, then the log in form + * will be assumed and used if set. + * + * The various authentication cookies will be set by this function and will be + * set for a longer period depending on if the 'remember' credential is set to + * true. + * + * Note: wp_signon() doesn't handle setting the current user. This means that if the + * function is called before the {@see 'init'} hook is fired, is_user_logged_in() will + * evaluate as false until that point. If is_user_logged_in() is needed in conjunction + * with wp_signon(), wp_set_current_user() should be called explicitly. + * + * @since 2.5.0 + * + * @global string $auth_secure_cookie + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array $credentials { + * Optional. User info in order to sign on. + * + * @type string $user_login Username. + * @type string $user_password User password. + * @type bool $remember Whether to 'remember' the user. Increases the time + * that the cookie will be kept. Default false. + * } + * @param string|bool $secure_cookie Optional. Whether to use secure cookie. + * @return WP_User|WP_Error WP_User on success, WP_Error on failure. + * @phpstan-param array{ + * user_login?: string, + * user_password?: string, + * remember?: bool, + * } $credentials + */ + function wp_signon($credentials = array(), $secure_cookie = '') + { + } + /** + * Authenticates a user, confirming the username and password are valid. + * + * @since 2.8.0 + * + * @param WP_User|WP_Error|null $user WP_User or WP_Error object from a previous callback. Default null. + * @param string $username Username for authentication. + * @param string $password Password for authentication. + * @return WP_User|WP_Error WP_User on success, WP_Error on failure. + */ + function wp_authenticate_username_password($user, $username, $password) + { + } + /** + * Authenticates a user using the email and password. + * + * @since 4.5.0 + * + * @param WP_User|WP_Error|null $user WP_User or WP_Error object if a previous + * callback failed authentication. + * @param string $email Email address for authentication. + * @param string $password Password for authentication. + * @return WP_User|WP_Error WP_User on success, WP_Error on failure. + */ + function wp_authenticate_email_password($user, $email, $password) + { + } + /** + * Authenticates the user using the WordPress auth cookie. + * + * @since 2.8.0 + * + * @global string $auth_secure_cookie + * + * @param WP_User|WP_Error|null $user WP_User or WP_Error object from a previous callback. Default null. + * @param string $username Username. If not empty, cancels the cookie authentication. + * @param string $password Password. If not empty, cancels the cookie authentication. + * @return WP_User|WP_Error WP_User on success, WP_Error on failure. + */ + function wp_authenticate_cookie($user, $username, $password) + { + } + /** + * Authenticates the user using an application password. + * + * @since 5.6.0 + * + * @param WP_User|WP_Error|null $input_user WP_User or WP_Error object if a previous + * callback failed authentication. + * @param string $username Username for authentication. + * @param string $password Password for authentication. + * @return WP_User|WP_Error|null WP_User on success, WP_Error on failure, null if + * null is passed in and this isn't an API request. + */ + function wp_authenticate_application_password($input_user, $username, $password) + { + } + /** + * Validates the application password credentials passed via Basic Authentication. + * + * @since 5.6.0 + * + * @param int|false $input_user User ID if one has been determined, false otherwise. + * @return int|false The authenticated user ID if successful, false otherwise. + */ + function wp_validate_application_password($input_user) + { + } + /** + * For Multisite blogs, checks if the authenticated user has been marked as a + * spammer, or if the user's primary blog has been marked as spam. + * + * @since 3.7.0 + * + * @param WP_User|WP_Error|null $user WP_User or WP_Error object from a previous callback. Default null. + * @return WP_User|WP_Error WP_User on success, WP_Error if the user is considered a spammer. + */ + function wp_authenticate_spam_check($user) + { + } + /** + * Validates the logged-in cookie. + * + * Checks the logged-in cookie if the previous auth cookie could not be + * validated and parsed. + * + * This is a callback for the {@see 'determine_current_user'} filter, rather than API. + * + * @since 3.9.0 + * + * @param int|false $user_id The user ID (or false) as received from + * the `determine_current_user` filter. + * @return int|false User ID if validated, false otherwise. If a user ID from + * an earlier filter callback is received, that value is returned. + */ + function wp_validate_logged_in_cookie($user_id) + { + } + /** + * Gets the number of posts a user has written. + * + * @since 3.0.0 + * @since 4.1.0 Added `$post_type` argument. + * @since 4.3.0 Added `$public_only` argument. Added the ability to pass an array + * of post types to `$post_type`. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $userid User ID. + * @param array|string $post_type Optional. Single post type or array of post types to count the number of posts for. Default 'post'. + * @param bool $public_only Optional. Whether to only return counts for public posts. Default false. + * @return string Number of posts the user has written in this post type. + */ + function count_user_posts($userid, $post_type = 'post', $public_only = \false) + { + } + /** + * Gets the number of posts written by a list of users. + * + * @since 3.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int[] $users Array of user IDs. + * @param string|string[] $post_type Optional. Single post type or array of post types to check. Defaults to 'post'. + * @param bool $public_only Optional. Only return counts for public posts. Defaults to false. + * @return string[] Amount of posts each user has written, as strings, keyed by user ID. + */ + function count_many_users_posts($users, $post_type = 'post', $public_only = \false) + { + } + // + // User option functions. + // + /** + * Gets the current user's ID. + * + * @since MU (3.0.0) + * + * @return int The current user's ID, or 0 if no user is logged in. + */ + function get_current_user_id() + { + } + /** + * Retrieves user option that can be either per Site or per Network. + * + * If the user ID is not given, then the current user will be used instead. If + * the user ID is given, then the user data will be retrieved. The filter for + * the result, will also pass the original option name and finally the user data + * object as the third parameter. + * + * The option will first check for the per site name and then the per Network name. + * + * @since 2.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $option User option name. + * @param int $user Optional. User ID. + * @param string $deprecated Use get_option() to check for an option in the options table. + * @return mixed User option value on success, false on failure. + */ + function get_user_option($option, $user = 0, $deprecated = '') + { + } + /** + * Updates user option with global blog capability. + * + * User options are just like user metadata except that they have support for + * global blog options. If the 'is_global' parameter is false, which it is by default, + * it will prepend the WordPress table prefix to the option name. + * + * Deletes the user option if $newvalue is empty. + * + * @since 2.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $user_id User ID. + * @param string $option_name User option name. + * @param mixed $newvalue User option value. + * @param bool $is_global Optional. Whether option name is global or blog specific. + * Default false (blog specific). + * @return int|bool User meta ID if the option didn't exist, true on successful update, + * false on failure. + */ + function update_user_option($user_id, $option_name, $newvalue, $is_global = \false) + { + } + /** + * Deletes user option with global blog capability. + * + * User options are just like user metadata except that they have support for + * global blog options. If the 'is_global' parameter is false, which it is by default, + * it will prepend the WordPress table prefix to the option name. + * + * @since 3.0.0 + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $user_id User ID + * @param string $option_name User option name. + * @param bool $is_global Optional. Whether option name is global or blog specific. + * Default false (blog specific). + * @return bool True on success, false on failure. + */ + function delete_user_option($user_id, $option_name, $is_global = \false) + { + } + /** + * Retrieves list of users matching criteria. + * + * @since 3.1.0 + * + * @see WP_User_Query + * + * @param array $args Optional. Arguments to retrieve users. See WP_User_Query::prepare_query() + * for more information on accepted arguments. + * @return array List of users. + * @phpstan-param array{ + * blog_id?: int, + * role?: string|string[], + * role__in?: string[], + * role__not_in?: string[], + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * capability?: string|string[], + * capability__in?: string[], + * capability__not_in?: string[], + * include?: int[], + * exclude?: int[], + * search?: string, + * search_columns?: string[], + * orderby?: string|array, + * order?: string, + * offset?: int, + * number?: int, + * paged?: int, + * count_total?: bool, + * fields?: string|string[], + * who?: string, + * has_published_posts?: bool|string[], + * nicename?: string, + * nicename__in?: string[], + * nicename__not_in?: string[], + * login?: string, + * login__in?: string[], + * login__not_in?: string[], + * cache_results?: bool, + * } $args See WP_User_Query::prepare_query() + */ + function get_users($args = array()) + { + } + /** + * Lists all the users of the site, with several options available. + * + * @since 5.9.0 + * + * @param string|array $args { + * Optional. Array or string of default arguments. + * + * @type string $orderby How to sort the users. Accepts 'nicename', 'email', 'url', 'registered', + * 'user_nicename', 'user_email', 'user_url', 'user_registered', 'name', + * 'display_name', 'post_count', 'ID', 'meta_value', 'user_login'. Default 'name'. + * @type string $order Sorting direction for $orderby. Accepts 'ASC', 'DESC'. Default 'ASC'. + * @type int $number Maximum users to return or display. Default empty (all users). + * @type bool $exclude_admin Whether to exclude the 'admin' account, if it exists. Default false. + * @type bool $show_fullname Whether to show the user's full name. Default false. + * @type string $feed If not empty, show a link to the user's feed and use this text as the alt + * parameter of the link. Default empty. + * @type string $feed_image If not empty, show a link to the user's feed and use this image URL as + * clickable anchor. Default empty. + * @type string $feed_type The feed type to link to, such as 'rss2'. Defaults to default feed type. + * @type bool $echo Whether to output the result or instead return it. Default true. + * @type string $style If 'list', each user is wrapped in an `<li>` element, otherwise the users + * will be separated by commas. + * @type bool $html Whether to list the items in HTML form or plaintext. Default true. + * @type string $exclude An array, comma-, or space-separated list of user IDs to exclude. Default empty. + * @type string $include An array, comma-, or space-separated list of user IDs to include. Default empty. + * } + * @return string|null The output if echo is false. Otherwise null. + * @phpstan-param array{ + * orderby?: string, + * order?: string, + * number?: int, + * exclude_admin?: bool, + * show_fullname?: bool, + * feed?: string, + * feed_image?: string, + * feed_type?: string, + * echo?: bool, + * style?: string, + * html?: bool, + * exclude?: string, + * include?: string, + * } $args + */ + function wp_list_users($args = array()) + { + } + /** + * Gets the sites a user belongs to. + * + * @since 3.0.0 + * @since 4.7.0 Converted to use `get_sites()`. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $user_id User ID + * @param bool $all Whether to retrieve all sites, or only sites that are not + * marked as deleted, archived, or spam. + * @return object[] A list of the user's sites. An empty array if the user doesn't exist + * or belongs to no sites. + */ + function get_blogs_of_user($user_id, $all = \false) + { + } + /** + * Finds out whether a user is a member of a given blog. + * + * @since MU (3.0.0) + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int $user_id Optional. The unique ID of the user. Defaults to the current user. + * @param int $blog_id Optional. ID of the blog to check. Defaults to the current site. + * @return bool + */ + function is_user_member_of_blog($user_id = 0, $blog_id = 0) + { + } + /** + * Adds meta data to a user. + * + * @since 3.0.0 + * + * @param int $user_id User ID. + * @param string $meta_key Metadata name. + * @param mixed $meta_value Metadata value. Must be serializable if non-scalar. + * @param bool $unique Optional. Whether the same key should not be added. + * Default false. + * @return int|false Meta ID on success, false on failure. + */ + function add_user_meta($user_id, $meta_key, $meta_value, $unique = \false) + { + } + /** + * Removes metadata matching criteria from a user. + * + * You can match based on the key, or key and value. Removing based on key and + * value, will keep from removing duplicate metadata with the same key. It also + * allows removing all metadata matching key, if needed. + * + * @since 3.0.0 + * + * @link https://developer.wordpress.org/reference/functions/delete_user_meta/ + * + * @param int $user_id User ID + * @param string $meta_key Metadata name. + * @param mixed $meta_value Optional. Metadata value. If provided, + * rows will only be removed that match the value. + * Must be serializable if non-scalar. Default empty. + * @return bool True on success, false on failure. + */ + function delete_user_meta($user_id, $meta_key, $meta_value = '') + { + } + /** + * Retrieves user meta field for a user. + * + * @since 3.0.0 + * + * @link https://developer.wordpress.org/reference/functions/get_user_meta/ + * + * @param int $user_id User ID. + * @param string $key Optional. The meta key to retrieve. By default, + * returns data for all keys. + * @param bool $single Optional. Whether to return a single value. + * This parameter has no effect if `$key` is not specified. + * Default false. + * @return mixed An array of values if `$single` is false. + * The value of meta data field if `$single` is true. + * False for an invalid `$user_id` (non-numeric, zero, or negative value). + * An empty string if a valid but non-existing user ID is passed. + */ + function get_user_meta($user_id, $key = '', $single = \false) + { + } + /** + * Updates user meta field based on user ID. + * + * Use the $prev_value parameter to differentiate between meta fields with the + * same key and user ID. + * + * If the meta field for the user does not exist, it will be added. + * + * @since 3.0.0 + * + * @link https://developer.wordpress.org/reference/functions/update_user_meta/ + * + * @param int $user_id User ID. + * @param string $meta_key Metadata key. + * @param mixed $meta_value Metadata value. Must be serializable if non-scalar. + * @param mixed $prev_value Optional. Previous value to check before updating. + * If specified, only update existing metadata entries with + * this value. Otherwise, update all entries. Default empty. + * @return int|bool Meta ID if the key didn't exist, true on successful update, + * false on failure or if the value passed to the function + * is the same as the one that is already in the database. + */ + function update_user_meta($user_id, $meta_key, $meta_value, $prev_value = '') + { + } + /** + * Counts number of users who have each of the user roles. + * + * Assumes there are neither duplicated nor orphaned capabilities meta_values. + * Assumes role names are unique phrases. Same assumption made by WP_User_Query::prepare_query() + * Using $strategy = 'time' this is CPU-intensive and should handle around 10^7 users. + * Using $strategy = 'memory' this is memory-intensive and should handle around 10^5 users, but see WP Bug #12257. + * + * @since 3.0.0 + * @since 4.4.0 The number of users with no role is now included in the `none` element. + * @since 4.9.0 The `$site_id` parameter was added to support multisite. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param string $strategy Optional. The computational strategy to use when counting the users. + * Accepts either 'time' or 'memory'. Default 'time'. + * @param int|null $site_id Optional. The site ID to count users for. Defaults to the current site. + * @return array { + * User counts. + * + * @type int $total_users Total number of users on the site. + * @type int[] $avail_roles Array of user counts keyed by user role. + * } + * @phpstan-param 'time'|'memory' $strategy + * @phpstan-return array{ + * total_users: int, + * avail_roles: int[], + * } + */ + function count_users($strategy = 'time', $site_id = \null) + { + } + /** + * Returns the number of active users in your installation. + * + * Note that on a large site the count may be cached and only updated twice daily. + * + * @since MU (3.0.0) + * @since 4.8.0 The `$network_id` parameter has been added. + * @since 6.0.0 Moved to wp-includes/user.php. + * + * @param int|null $network_id ID of the network. Defaults to the current network. + * @return int Number of active users on the network. + */ + function get_user_count($network_id = \null) + { + } + /** + * Updates the total count of users on the site if live user counting is enabled. + * + * @since 6.0.0 + * + * @param int|null $network_id ID of the network. Defaults to the current network. + * @return bool Whether the update was successful. + */ + function wp_maybe_update_user_counts($network_id = \null) + { + } + /** + * Updates the total count of users on the site. + * + * @global wpdb $wpdb WordPress database abstraction object. + * @since 6.0.0 + * + * @param int|null $network_id ID of the network. Defaults to the current network. + * @return bool Whether the update was successful. + */ + function wp_update_user_counts($network_id = \null) + { + } + /** + * Schedules a recurring recalculation of the total count of users. + * + * @since 6.0.0 + * @phpstan-return void + */ + function wp_schedule_update_user_counts() + { + } + /** + * Determines whether the site has a large number of users. + * + * The default criteria for a large site is more than 10,000 users. + * + * @since 6.0.0 + * + * @param int|null $network_id ID of the network. Defaults to the current network. + * @return bool Whether the site has a large number of users. + */ + function wp_is_large_user_count($network_id = \null) + { + } + // + // Private helper functions. + // + /** + * Sets up global user vars. + * + * Used by wp_set_current_user() for back compat. Might be deprecated in the future. + * + * @since 2.0.4 + * + * @global string $user_login The user username for logging in + * @global WP_User $userdata User data. + * @global int $user_level The level of the user + * @global int $user_ID The ID of the user + * @global string $user_email The email address of the user + * @global string $user_url The url in the user's profile + * @global string $user_identity The display name of the user + * + * @param int $for_user_id Optional. User ID to set up global data. Default 0. + * @phpstan-return void + */ + function setup_userdata($for_user_id = 0) + { + } + /** + * Creates dropdown HTML content of users. + * + * The content can either be displayed, which it is by default or retrieved by + * setting the 'echo' argument. The 'include' and 'exclude' arguments do not + * need to be used; all users will be displayed in that case. Only one can be + * used, either 'include' or 'exclude', but not both. + * + * The available arguments are as follows: + * + * @since 2.3.0 + * @since 4.5.0 Added the 'display_name_with_login' value for 'show'. + * @since 4.7.0 Added the 'role', 'role__in', and 'role__not_in' parameters. + * @since 5.9.0 Added the 'capability', 'capability__in', and 'capability__not_in' parameters. + * Deprecated the 'who' parameter. + * + * @param array|string $args { + * Optional. Array or string of arguments to generate a drop-down of users. + * See WP_User_Query::prepare_query() for additional available arguments. + * + * @type string $show_option_all Text to show as the drop-down default (all). + * Default empty. + * @type string $show_option_none Text to show as the drop-down default when no + * users were found. Default empty. + * @type int|string $option_none_value Value to use for `$show_option_none` when no users + * were found. Default -1. + * @type string $hide_if_only_one_author Whether to skip generating the drop-down + * if only one user was found. Default empty. + * @type string $orderby Field to order found users by. Accepts user fields. + * Default 'display_name'. + * @type string $order Whether to order users in ascending or descending + * order. Accepts 'ASC' (ascending) or 'DESC' (descending). + * Default 'ASC'. + * @type int[]|string $include Array or comma-separated list of user IDs to include. + * Default empty. + * @type int[]|string $exclude Array or comma-separated list of user IDs to exclude. + * Default empty. + * @type bool|int $multi Whether to skip the ID attribute on the 'select' element. + * Accepts 1|true or 0|false. Default 0|false. + * @type string $show User data to display. If the selected item is empty + * then the 'user_login' will be displayed in parentheses. + * Accepts any user field, or 'display_name_with_login' to show + * the display name with user_login in parentheses. + * Default 'display_name'. + * @type int|bool $echo Whether to echo or return the drop-down. Accepts 1|true (echo) + * or 0|false (return). Default 1|true. + * @type int $selected Which user ID should be selected. Default 0. + * @type bool $include_selected Whether to always include the selected user ID in the drop- + * down. Default false. + * @type string $name Name attribute of select element. Default 'user'. + * @type string $id ID attribute of the select element. Default is the value of `$name`. + * @type string $class Class attribute of the select element. Default empty. + * @type int $blog_id ID of blog (Multisite only). Default is ID of the current blog. + * @type string $who Deprecated, use `$capability` instead. + * Which type of users to query. Accepts only an empty string or + * 'authors'. Default empty (all users). + * @type string|string[] $role An array or a comma-separated list of role names that users + * must match to be included in results. Note that this is + * an inclusive list: users must match *each* role. Default empty. + * @type string[] $role__in An array of role names. Matched users must have at least one + * of these roles. Default empty array. + * @type string[] $role__not_in An array of role names to exclude. Users matching one or more + * of these roles will not be included in results. Default empty array. + * @type string|string[] $capability An array or a comma-separated list of capability names that users + * must match to be included in results. Note that this is + * an inclusive list: users must match *each* capability. + * Does NOT work for capabilities not in the database or filtered + * via {@see 'map_meta_cap'}. Default empty. + * @type string[] $capability__in An array of capability names. Matched users must have at least one + * of these capabilities. + * Does NOT work for capabilities not in the database or filtered + * via {@see 'map_meta_cap'}. Default empty array. + * @type string[] $capability__not_in An array of capability names to exclude. Users matching one or more + * of these capabilities will not be included in results. + * Does NOT work for capabilities not in the database or filtered + * via {@see 'map_meta_cap'}. Default empty array. + * } + * @return string HTML dropdown list of users. + * @phpstan-param array{ + * show_option_all?: string, + * show_option_none?: string, + * option_none_value?: int|string, + * hide_if_only_one_author?: string, + * orderby?: string, + * order?: string, + * include?: int[]|string, + * exclude?: int[]|string, + * multi?: bool|int, + * show?: string, + * echo?: int|bool, + * selected?: int, + * include_selected?: bool, + * name?: string, + * id?: string, + * class?: string, + * blog_id?: int, + * who?: string, + * role?: string|string[], + * role__in?: string[], + * role__not_in?: string[], + * capability?: string|string[], + * capability__in?: string[], + * capability__not_in?: string[], + * blog_id?: int, + * role?: string|string[], + * role__in?: string[], + * role__not_in?: string[], + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * capability?: string|string[], + * capability__in?: string[], + * capability__not_in?: string[], + * include?: int[], + * exclude?: int[], + * search?: string, + * search_columns?: string[], + * orderby?: string|array, + * order?: string, + * offset?: int, + * number?: int, + * paged?: int, + * count_total?: bool, + * fields?: string|string[], + * who?: string, + * has_published_posts?: bool|string[], + * nicename?: string, + * nicename__in?: string[], + * nicename__not_in?: string[], + * login?: string, + * login__in?: string[], + * login__not_in?: string[], + * cache_results?: bool, + * } $args + */ + function wp_dropdown_users($args = '') + { + } + /** + * Sanitizes user field based on context. + * + * Possible context values are: 'raw', 'edit', 'db', 'display', 'attribute' and 'js'. The + * 'display' context is used by default. 'attribute' and 'js' contexts are treated like 'display' + * when calling filters. + * + * @since 2.3.0 + * + * @param string $field The user Object field name. + * @param mixed $value The user Object value. + * @param int $user_id User ID. + * @param string $context How to sanitize user fields. Looks for 'raw', 'edit', 'db', 'display', + * 'attribute' and 'js'. + * @return mixed Sanitized value. + */ + function sanitize_user_field($field, $value, $user_id, $context) + { + } + /** + * Updates all user caches. + * + * @since 3.0.0 + * + * @param object|WP_User $user User object or database row to be cached + * @return void|false Void on success, false on failure. + */ + function update_user_caches($user) + { + } + /** + * Cleans all user caches. + * + * @since 3.0.0 + * @since 4.4.0 'clean_user_cache' action was added. + * @since 6.2.0 User metadata caches are now cleared. + * + * @param WP_User|int $user User object or ID to be cleaned from the cache + * @phpstan-return void + */ + function clean_user_cache($user) + { + } + /** + * Determines whether the given username exists. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 2.0.0 + * + * @param string $username The username to check for existence. + * @return int|false The user ID on success, false on failure. + */ + function username_exists($username) + { + } + /** + * Determines whether the given email exists. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 2.1.0 + * + * @param string $email The email to check for existence. + * @return int|false The user ID on success, false on failure. + */ + function email_exists($email) + { + } + /** + * Checks whether a username is valid. + * + * @since 2.0.1 + * @since 4.4.0 Empty sanitized usernames are now considered invalid. + * + * @param string $username Username. + * @return bool Whether username given is valid. + */ + function validate_username($username) + { + } + /** + * Inserts a user into the database. + * + * Most of the `$userdata` array fields have filters associated with the values. Exceptions are + * 'ID', 'rich_editing', 'syntax_highlighting', 'comment_shortcuts', 'admin_color', 'use_ssl', + * 'user_registered', 'user_activation_key', 'spam', and 'role'. The filters have the prefix + * 'pre_user_' followed by the field name. An example using 'description' would have the filter + * called 'pre_user_description' that can be hooked into. + * + * @since 2.0.0 + * @since 3.6.0 The `aim`, `jabber`, and `yim` fields were removed as default user contact + * methods for new installations. See wp_get_user_contact_methods(). + * @since 4.7.0 The `locale` field can be passed to `$userdata`. + * @since 5.3.0 The `user_activation_key` field can be passed to `$userdata`. + * @since 5.3.0 The `spam` field can be passed to `$userdata` (Multisite only). + * @since 5.9.0 The `meta_input` field can be passed to `$userdata` to allow addition of user meta data. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param array|object|WP_User $userdata { + * An array, object, or WP_User object of user data arguments. + * + * @type int $ID User ID. If supplied, the user will be updated. + * @type string $user_pass The plain-text user password for new users. + * Hashed password for existing users. + * @type string $user_login The user's login username. + * @type string $user_nicename The URL-friendly user name. + * @type string $user_url The user URL. + * @type string $user_email The user email address. + * @type string $display_name The user's display name. + * Default is the user's username. + * @type string $nickname The user's nickname. + * Default is the user's username. + * @type string $first_name The user's first name. For new users, will be used + * to build the first part of the user's display name + * if `$display_name` is not specified. + * @type string $last_name The user's last name. For new users, will be used + * to build the second part of the user's display name + * if `$display_name` is not specified. + * @type string $description The user's biographical description. + * @type string $rich_editing Whether to enable the rich-editor for the user. + * Accepts 'true' or 'false' as a string literal, + * not boolean. Default 'true'. + * @type string $syntax_highlighting Whether to enable the rich code editor for the user. + * Accepts 'true' or 'false' as a string literal, + * not boolean. Default 'true'. + * @type string $comment_shortcuts Whether to enable comment moderation keyboard + * shortcuts for the user. Accepts 'true' or 'false' + * as a string literal, not boolean. Default 'false'. + * @type string $admin_color Admin color scheme for the user. Default 'fresh'. + * @type bool $use_ssl Whether the user should always access the admin over + * https. Default false. + * @type string $user_registered Date the user registered in UTC. Format is 'Y-m-d H:i:s'. + * @type string $user_activation_key Password reset key. Default empty. + * @type bool $spam Multisite only. Whether the user is marked as spam. + * Default false. + * @type string $show_admin_bar_front Whether to display the Admin Bar for the user + * on the site's front end. Accepts 'true' or 'false' + * as a string literal, not boolean. Default 'true'. + * @type string $role User's role. + * @type string $locale User's locale. Default empty. + * @type array $meta_input Array of custom user meta values keyed by meta key. + * Default empty. + * } + * @return int|WP_Error The newly created user's ID or a WP_Error object if the user could not + * be created. + * @phpstan-param \WP_User|object|array{ + * ID?: int, + * user_pass?: string, + * user_login?: string, + * user_nicename?: string, + * user_url?: string, + * user_email?: string, + * display_name?: string, + * nickname?: string, + * first_name?: string, + * last_name?: string, + * description?: string, + * rich_editing?: string, + * syntax_highlighting?: string, + * comment_shortcuts?: string, + * admin_color?: string, + * use_ssl?: bool, + * user_registered?: string, + * user_activation_key?: string, + * spam?: bool, + * show_admin_bar_front?: string, + * role?: string, + * locale?: string, + * meta_input?: array, + * } $userdata + */ + function wp_insert_user($userdata) + { + } + /** + * Updates a user in the database. + * + * It is possible to update a user's password by specifying the 'user_pass' + * value in the $userdata parameter array. + * + * If current user's password is being updated, then the cookies will be + * cleared. + * + * @since 2.0.0 + * + * @see wp_insert_user() For what fields can be set in $userdata. + * + * @param array|object|WP_User $userdata An array of user data or a user object of type stdClass or WP_User. + * @return int|WP_Error The updated user's ID or a WP_Error object if the user could not be updated. + */ + function wp_update_user($userdata) + { + } + /** + * Provides a simpler way of inserting a user into the database. + * + * Creates a new user with just the username, password, and email. For more + * complex user creation use wp_insert_user() to specify more information. + * + * @since 2.0.0 + * + * @see wp_insert_user() More complete way to create a new user. + * + * @param string $username The user's username. + * @param string $password The user's password. + * @param string $email Optional. The user's email. Default empty. + * @return int|WP_Error The newly created user's ID or a WP_Error object if the user could not + * be created. + */ + function wp_create_user($username, $password, $email = '') + { + } + /** + * Returns a list of meta keys to be (maybe) populated in wp_update_user(). + * + * The list of keys returned via this function are dependent on the presence + * of those keys in the user meta data to be set. + * + * @since 3.3.0 + * @access private + * + * @param WP_User $user WP_User instance. + * @return string[] List of user keys to be populated in wp_update_user(). + */ + function _get_additional_user_keys($user) + { + } + /** + * Sets up the user contact methods. + * + * Default contact methods were removed in 3.6. A filter dictates contact methods. + * + * @since 3.7.0 + * + * @param WP_User|null $user Optional. WP_User object. + * @return string[] Array of contact method labels keyed by contact method. + */ + function wp_get_user_contact_methods($user = \null) + { + } + /** + * The old private function for setting up user contact methods. + * + * Use wp_get_user_contact_methods() instead. + * + * @since 2.9.0 + * @access private + * + * @param WP_User|null $user Optional. WP_User object. Default null. + * @return string[] Array of contact method labels keyed by contact method. + */ + function _wp_get_user_contactmethods($user = \null) + { + } + /** + * Gets the text suggesting how to create strong passwords. + * + * @since 4.1.0 + * + * @return string The password hint text. + */ + function wp_get_password_hint() + { + } + /** + * Creates, stores, then returns a password reset key for user. + * + * @since 4.4.0 + * + * @global PasswordHash $wp_hasher Portable PHP password hashing framework instance. + * + * @param WP_User $user User to retrieve password reset key for. + * @return string|WP_Error Password reset key on success. WP_Error on error. + */ + function get_password_reset_key($user) + { + } + /** + * Retrieves a user row based on password reset key and login. + * + * A key is considered 'expired' if it exactly matches the value of the + * user_activation_key field, rather than being matched after going through the + * hashing process. This field is now hashed; old values are no longer accepted + * but have a different WP_Error code so good user feedback can be provided. + * + * @since 3.1.0 + * + * @global PasswordHash $wp_hasher Portable PHP password hashing framework instance. + * + * @param string $key Hash to validate sending user's password. + * @param string $login The user login. + * @return WP_User|WP_Error WP_User object on success, WP_Error object for invalid or expired keys. + */ + function check_password_reset_key($key, $login) + { + } + /** + * Handles sending a password retrieval email to a user. + * + * @since 2.5.0 + * @since 5.7.0 Added `$user_login` parameter. + * + * @global wpdb $wpdb WordPress database abstraction object. + * @global PasswordHash $wp_hasher Portable PHP password hashing framework instance. + * + * @param string $user_login Optional. Username to send a password retrieval email for. + * Defaults to `$_POST['user_login']` if not set. + * @return true|WP_Error True when finished, WP_Error object on error. + */ + function retrieve_password($user_login = \null) + { + } + /** + * Handles resetting the user's password. + * + * @since 2.5.0 + * + * @param WP_User $user The user + * @param string $new_pass New password for the user in plaintext + */ + function reset_password($user, $new_pass) + { + } + /** + * Handles registering a new user. + * + * @since 2.5.0 + * + * @param string $user_login User's username for logging in + * @param string $user_email User's email address to send password and add + * @return int|WP_Error Either user's ID or error on failure. + */ + function register_new_user($user_login, $user_email) + { + } + /** + * Initiates email notifications related to the creation of new users. + * + * Notifications are sent both to the site admin and to the newly created user. + * + * @since 4.4.0 + * @since 4.6.0 Converted the `$notify` parameter to accept 'user' for sending + * notifications only to the user created. + * + * @param int $user_id ID of the newly created user. + * @param string $notify Optional. Type of notification that should happen. Accepts 'admin' + * or an empty string (admin only), 'user', or 'both' (admin and user). + * Default 'both'. + * @phpstan-param 'admin'|'user'|'both' $notify + */ + function wp_send_new_user_notifications($user_id, $notify = 'both') + { + } + /** + * Retrieves the current session token from the logged_in cookie. + * + * @since 4.0.0 + * + * @return string Token. + */ + function wp_get_session_token() + { + } + /** + * Retrieves a list of sessions for the current user. + * + * @since 4.0.0 + * + * @return array Array of sessions. + */ + function wp_get_all_sessions() + { + } + /** + * Removes the current session token from the database. + * + * @since 4.0.0 + */ + function wp_destroy_current_session() + { + } + /** + * Removes all but the current session token for the current user for the database. + * + * @since 4.0.0 + */ + function wp_destroy_other_sessions() + { + } + /** + * Removes all session tokens for the current user from the database. + * + * @since 4.0.0 + */ + function wp_destroy_all_sessions() + { + } + /** + * Gets the user IDs of all users with no role on this site. + * + * @since 4.4.0 + * @since 4.9.0 The `$site_id` parameter was added to support multisite. + * + * @global wpdb $wpdb WordPress database abstraction object. + * + * @param int|null $site_id Optional. The site ID to get users with no role for. Defaults to the current site. + * @return string[] Array of user IDs as strings. + */ + function wp_get_users_with_no_role($site_id = \null) + { + } + /** + * Retrieves the current user object. + * + * Will set the current user, if the current user is not set. The current user + * will be set to the logged-in person. If no user is logged-in, then it will + * set the current user to 0, which is invalid and won't have any permissions. + * + * This function is used by the pluggable functions wp_get_current_user() and + * get_currentuserinfo(), the latter of which is deprecated but used for backward + * compatibility. + * + * @since 4.5.0 + * @access private + * + * @see wp_get_current_user() + * @global WP_User $current_user Checks if the current user is set. + * + * @return WP_User Current WP_User instance. + */ + function _wp_get_current_user() + { + } + /** + * Sends a confirmation request email when a change of user email address is attempted. + * + * @since 3.0.0 + * @since 4.9.0 This function was moved from wp-admin/includes/ms.php so it's no longer Multisite specific. + * + * @global WP_Error $errors WP_Error object. + */ + function send_confirmation_on_profile_email() + { + } + /** + * Adds an admin notice alerting the user to check for confirmation request email + * after email address change. + * + * @since 3.0.0 + * @since 4.9.0 This function was moved from wp-admin/includes/ms.php so it's no longer Multisite specific. + * + * @global string $pagenow The filename of the current screen. + */ + function new_user_email_admin_notice() + { + } + /** + * Gets all personal data request types. + * + * @since 4.9.6 + * @access private + * + * @return string[] List of core privacy action types. + */ + function _wp_privacy_action_request_types() + { + } + /** + * Registers the personal data exporter for users. + * + * @since 4.9.6 + * + * @param array[] $exporters An array of personal data exporters. + * @return array[] An array of personal data exporters. + */ + function wp_register_user_personal_data_exporter($exporters) + { + } + /** + * Finds and exports personal data associated with an email address from the user and user_meta table. + * + * @since 4.9.6 + * @since 5.4.0 Added 'Community Events Location' group to the export data. + * @since 5.4.0 Added 'Session Tokens' group to the export data. + * + * @param string $email_address The user's email address. + * @return array { + * An array of personal data. + * + * @type array[] $data An array of personal data arrays. + * @type bool $done Whether the exporter is finished. + * } + * @phpstan-return array{ + * data: array[], + * done: bool, + * } + */ + function wp_user_personal_data_exporter($email_address) + { + } + /** + * Updates log when privacy request is confirmed. + * + * @since 4.9.6 + * @access private + * + * @param int $request_id ID of the request. + * @phpstan-return void + */ + function _wp_privacy_account_request_confirmed($request_id) + { + } + /** + * Notifies the site administrator via email when a request is confirmed. + * + * Without this, the admin would have to manually check the site to see if any + * action was needed on their part yet. + * + * @since 4.9.6 + * + * @param int $request_id The ID of the request. + * @phpstan-return void + */ + function _wp_privacy_send_request_confirmation_notification($request_id) + { + } + /** + * Notifies the user when their erasure request is fulfilled. + * + * Without this, the user would never know if their data was actually erased. + * + * @since 4.9.6 + * + * @param int $request_id The privacy request post ID associated with this request. + * @phpstan-return void + */ + function _wp_privacy_send_erasure_fulfillment_notification($request_id) + { + } + /** + * Returns request confirmation message HTML. + * + * @since 4.9.6 + * @access private + * + * @param int $request_id The request ID being confirmed. + * @return string The confirmation message. + */ + function _wp_privacy_account_request_confirmed_message($request_id) + { + } + /** + * Creates and logs a user request to perform a specific action. + * + * Requests are stored inside a post type named `user_request` since they can apply to both + * users on the site, or guests without a user account. + * + * @since 4.9.6 + * @since 5.7.0 Added the `$status` parameter. + * + * @param string $email_address User email address. This can be the address of a registered + * or non-registered user. + * @param string $action_name Name of the action that is being confirmed. Required. + * @param array $request_data Misc data you want to send with the verification request and pass + * to the actions once the request is confirmed. + * @param string $status Optional request status (pending or confirmed). Default 'pending'. + * @return int|WP_Error Returns the request ID if successful, or a WP_Error object on failure. + */ + function wp_create_user_request($email_address = '', $action_name = '', $request_data = array(), $status = 'pending') + { + } + /** + * Gets action description from the name and return a string. + * + * @since 4.9.6 + * + * @param string $action_name Action name of the request. + * @return string Human readable action name. + */ + function wp_user_request_action_description($action_name) + { + } + /** + * Send a confirmation request email to confirm an action. + * + * If the request is not already pending, it will be updated. + * + * @since 4.9.6 + * + * @param string $request_id ID of the request created via wp_create_user_request(). + * @return true|WP_Error True on success, `WP_Error` on failure. + */ + function wp_send_user_request($request_id) + { + } + /** + * Returns a confirmation key for a user action and stores the hashed version for future comparison. + * + * @since 4.9.6 + * + * @global PasswordHash $wp_hasher Portable PHP password hashing framework instance. + * + * @param int $request_id Request ID. + * @return string Confirmation key. + */ + function wp_generate_user_request_key($request_id) + { + } + /** + * Validates a user request by comparing the key with the request's key. + * + * @since 4.9.6 + * + * @global PasswordHash $wp_hasher Portable PHP password hashing framework instance. + * + * @param string $request_id ID of the request being confirmed. + * @param string $key Provided key to validate. + * @return true|WP_Error True on success, WP_Error on failure. + */ + function wp_validate_user_request_key($request_id, $key) + { + } + /** + * Returns the user request object for the specified request ID. + * + * @since 4.9.6 + * + * @param int $request_id The ID of the user request. + * @return WP_User_Request|false + */ + function wp_get_user_request($request_id) + { + } + /** + * Checks if Application Passwords is supported. + * + * Application Passwords is supported only by sites using SSL or local environments + * but may be made available using the {@see 'wp_is_application_passwords_available'} filter. + * + * @since 5.9.0 + * + * @return bool + */ + function wp_is_application_passwords_supported() + { + } + /** + * Checks if Application Passwords is globally available. + * + * By default, Application Passwords is available to all sites using SSL or to local environments. + * Use the {@see 'wp_is_application_passwords_available'} filter to adjust its availability. + * + * @since 5.6.0 + * + * @return bool + */ + function wp_is_application_passwords_available() + { + } + /** + * Checks if Application Passwords is available for a specific user. + * + * By default all users can use Application Passwords. Use {@see 'wp_is_application_passwords_available_for_user'} + * to restrict availability to certain users. + * + * @since 5.6.0 + * + * @param int|WP_User $user The user to check. + * @return bool + */ + function wp_is_application_passwords_available_for_user($user) + { + } + /** + * Registers the user meta property for persisted preferences. + * + * This property is used to store user preferences across page reloads and is + * currently used by the block editor for preferences like 'fullscreenMode' and + * 'fixedToolbar'. + * + * @since 6.1.0 + * @access private + * + * @global wpdb $wpdb WordPress database abstraction object. + */ + function wp_register_persisted_preferences_meta() + { + } + /** + * Sets the last changed time for the 'users' cache group. + * + * @since 6.3.0 + */ + function wp_cache_set_users_last_changed() + { + } + /** + * Checks if password reset is allowed for a specific user. + * + * @since 6.3.0 + * + * @param int|WP_User $user The user to check. + * @return bool|WP_Error True if allowed, false or WP_Error otherwise. + */ + function wp_is_password_reset_allowed_for_user($user) + { + } + /** + * Test if the current browser runs on a mobile device (smart phone, tablet, etc.). + * + * @since 3.4.0 + * @since 6.4.0 Added checking for the Sec-CH-UA-Mobile request header. + * + * @return bool + */ + function wp_is_mobile() + { + } + // + // Template tags & API functions. + // + /** + * Register a widget + * + * Registers a WP_Widget widget + * + * @since 2.8.0 + * @since 4.6.0 Updated the `$widget` parameter to also accept a WP_Widget instance object + * instead of simply a `WP_Widget` subclass name. + * + * @see WP_Widget + * + * @global WP_Widget_Factory $wp_widget_factory + * + * @param string|WP_Widget $widget Either the name of a `WP_Widget` subclass or an instance of a `WP_Widget` subclass. + */ + function register_widget($widget) + { + } + /** + * Unregisters a widget. + * + * Unregisters a WP_Widget widget. Useful for un-registering default widgets. + * Run within a function hooked to the {@see 'widgets_init'} action. + * + * @since 2.8.0 + * @since 4.6.0 Updated the `$widget` parameter to also accept a WP_Widget instance object + * instead of simply a `WP_Widget` subclass name. + * + * @see WP_Widget + * + * @global WP_Widget_Factory $wp_widget_factory + * + * @param string|WP_Widget $widget Either the name of a `WP_Widget` subclass or an instance of a `WP_Widget` subclass. + */ + function unregister_widget($widget) + { + } + /** + * Creates multiple sidebars. + * + * If you wanted to quickly create multiple sidebars for a theme or internally. + * This function will allow you to do so. If you don't pass the 'name' and/or + * 'id' in `$args`, then they will be built for you. + * + * @since 2.2.0 + * + * @see register_sidebar() The second parameter is documented by register_sidebar() and is the same here. + * + * @global array $wp_registered_sidebars The new sidebars are stored in this array by sidebar ID. + * + * @param int $number Optional. Number of sidebars to create. Default 1. + * @param array|string $args { + * Optional. Array or string of arguments for building a sidebar. + * + * @type string $id The base string of the unique identifier for each sidebar. If provided, and multiple + * sidebars are being defined, the ID will have "-2" appended, and so on. + * Default 'sidebar-' followed by the number the sidebar creation is currently at. + * @type string $name The name or title for the sidebars displayed in the admin dashboard. If registering + * more than one sidebar, include '%d' in the string as a placeholder for the uniquely + * assigned number for each sidebar. + * Default 'Sidebar' for the first sidebar, otherwise 'Sidebar %d'. + * } + * @phpstan-param array{ + * id?: string, + * name?: string, + * } $args + */ + function register_sidebars($number = 1, $args = array()) + { + } + /** + * Builds the definition for a single sidebar and returns the ID. + * + * Accepts either a string or an array and then parses that against a set + * of default arguments for the new sidebar. WordPress will automatically + * generate a sidebar ID and name based on the current number of registered + * sidebars if those arguments are not included. + * + * When allowing for automatic generation of the name and ID parameters, keep + * in mind that the incrementor for your sidebar can change over time depending + * on what other plugins and themes are installed. + * + * If theme support for 'widgets' has not yet been added when this function is + * called, it will be automatically enabled through the use of add_theme_support() + * + * @since 2.2.0 + * @since 5.6.0 Added the `before_sidebar` and `after_sidebar` arguments. + * @since 5.9.0 Added the `show_in_rest` argument. + * + * @global array $wp_registered_sidebars The registered sidebars. + * + * @param array|string $args { + * Optional. Array or string of arguments for the sidebar being registered. + * + * @type string $name The name or title of the sidebar displayed in the Widgets + * interface. Default 'Sidebar $instance'. + * @type string $id The unique identifier by which the sidebar will be called. + * Default 'sidebar-$instance'. + * @type string $description Description of the sidebar, displayed in the Widgets interface. + * Default empty string. + * @type string $class Extra CSS class to assign to the sidebar in the Widgets interface. + * Default empty. + * @type string $before_widget HTML content to prepend to each widget's HTML output when assigned + * to this sidebar. Receives the widget's ID attribute as `%1$s` + * and class name as `%2$s`. Default is an opening list item element. + * @type string $after_widget HTML content to append to each widget's HTML output when assigned + * to this sidebar. Default is a closing list item element. + * @type string $before_title HTML content to prepend to the sidebar title when displayed. + * Default is an opening h2 element. + * @type string $after_title HTML content to append to the sidebar title when displayed. + * Default is a closing h2 element. + * @type string $before_sidebar HTML content to prepend to the sidebar when displayed. + * Receives the `$id` argument as `%1$s` and `$class` as `%2$s`. + * Outputs after the {@see 'dynamic_sidebar_before'} action. + * Default empty string. + * @type string $after_sidebar HTML content to append to the sidebar when displayed. + * Outputs before the {@see 'dynamic_sidebar_after'} action. + * Default empty string. + * @type bool $show_in_rest Whether to show this sidebar publicly in the REST API. + * Defaults to only showing the sidebar to administrator users. + * } + * @return string Sidebar ID added to $wp_registered_sidebars global. + * @phpstan-param array{ + * name?: string, + * id?: string, + * description?: string, + * class?: string, + * before_widget?: string, + * after_widget?: string, + * before_title?: string, + * after_title?: string, + * before_sidebar?: string, + * after_sidebar?: string, + * show_in_rest?: bool, + * } $args + */ + function register_sidebar($args = array()) + { + } + /** + * Removes a sidebar from the list. + * + * @since 2.2.0 + * + * @global array $wp_registered_sidebars The registered sidebars. + * + * @param string|int $sidebar_id The ID of the sidebar when it was registered. + */ + function unregister_sidebar($sidebar_id) + { + } + /** + * Checks if a sidebar is registered. + * + * @since 4.4.0 + * + * @global array $wp_registered_sidebars The registered sidebars. + * + * @param string|int $sidebar_id The ID of the sidebar when it was registered. + * @return bool True if the sidebar is registered, false otherwise. + */ + function is_registered_sidebar($sidebar_id) + { + } + /** + * Register an instance of a widget. + * + * The default widget option is 'classname' that can be overridden. + * + * The function can also be used to un-register widgets when `$output_callback` + * parameter is an empty string. + * + * @since 2.2.0 + * @since 5.3.0 Formalized the existing and already documented `...$params` parameter + * by adding it to the function signature. + * @since 5.8.0 Added show_instance_in_rest option. + * + * @global array $wp_registered_widgets Uses stored registered widgets. + * @global array $wp_registered_widget_controls Stores the registered widget controls (options). + * @global array $wp_registered_widget_updates The registered widget updates. + * @global array $_wp_deprecated_widgets_callbacks + * + * @param int|string $id Widget ID. + * @param string $name Widget display title. + * @param callable $output_callback Run when widget is called. + * @param array $options { + * Optional. An array of supplementary widget options for the instance. + * + * @type string $classname Class name for the widget's HTML container. Default is a shortened + * version of the output callback name. + * @type string $description Widget description for display in the widget administration + * panel and/or theme. + * @type bool $show_instance_in_rest Whether to show the widget's instance settings in the REST API. + * Only available for WP_Widget based widgets. + * } + * @param mixed ...$params Optional additional parameters to pass to the callback function when it's called. + * @phpstan-param array{ + * classname?: string, + * description?: string, + * show_instance_in_rest?: bool, + * } $options + * @phpstan-return void + */ + function wp_register_sidebar_widget($id, $name, $output_callback, $options = array(), ...$params) + { + } + /** + * Retrieve description for widget. + * + * When registering widgets, the options can also include 'description' that + * describes the widget for display on the widget administration panel or + * in the theme. + * + * @since 2.5.0 + * + * @global array $wp_registered_widgets The registered widgets. + * + * @param int|string $id Widget ID. + * @return string|void Widget description, if available. + */ + function wp_widget_description($id) + { + } + /** + * Retrieve description for a sidebar. + * + * When registering sidebars a 'description' parameter can be included that + * describes the sidebar for display on the widget administration panel. + * + * @since 2.9.0 + * + * @global array $wp_registered_sidebars The registered sidebars. + * + * @param string $id sidebar ID. + * @return string|void Sidebar description, if available. + */ + function wp_sidebar_description($id) + { + } + /** + * Remove widget from sidebar. + * + * @since 2.2.0 + * + * @param int|string $id Widget ID. + */ + function wp_unregister_sidebar_widget($id) + { + } + /** + * Registers widget control callback for customizing options. + * + * @since 2.2.0 + * @since 5.3.0 Formalized the existing and already documented `...$params` parameter + * by adding it to the function signature. + * + * @global array $wp_registered_widget_controls The registered widget controls. + * @global array $wp_registered_widget_updates The registered widget updates. + * @global array $wp_registered_widgets The registered widgets. + * @global array $_wp_deprecated_widgets_callbacks + * + * @param int|string $id Sidebar ID. + * @param string $name Sidebar display name. + * @param callable $control_callback Run when sidebar is displayed. + * @param array $options { + * Optional. Array or string of control options. Default empty array. + * + * @type int $height Never used. Default 200. + * @type int $width Width of the fully expanded control form (but try hard to use the default width). + * Default 250. + * @type int|string $id_base Required for multi-widgets, i.e widgets that allow multiple instances such as the + * text widget. The widget ID will end up looking like `{$id_base}-{$unique_number}`. + * } + * @param mixed ...$params Optional additional parameters to pass to the callback function when it's called. + * @phpstan-param array{ + * height?: int, + * width?: int, + * id_base?: int|string, + * } $options + * @phpstan-return void + */ + function wp_register_widget_control($id, $name, $control_callback, $options = array(), ...$params) + { + } + /** + * Registers the update callback for a widget. + * + * @since 2.8.0 + * @since 5.3.0 Formalized the existing and already documented `...$params` parameter + * by adding it to the function signature. + * + * @global array $wp_registered_widget_updates The registered widget updates. + * + * @param string $id_base The base ID of a widget created by extending WP_Widget. + * @param callable $update_callback Update callback method for the widget. + * @param array $options Optional. Widget control options. See wp_register_widget_control(). + * Default empty array. + * @param mixed ...$params Optional additional parameters to pass to the callback function when it's called. + * @phpstan-param array{ + * height?: int, + * width?: int, + * id_base?: int|string, + * } $options See wp_register_widget_control() + * @phpstan-return void + */ + function _register_widget_update_callback($id_base, $update_callback, $options = array(), ...$params) + { + } + /** + * Registers the form callback for a widget. + * + * @since 2.8.0 + * @since 5.3.0 Formalized the existing and already documented `...$params` parameter + * by adding it to the function signature. + * + * @global array $wp_registered_widget_controls The registered widget controls. + * + * @param int|string $id Widget ID. + * @param string $name Name attribute for the widget. + * @param callable $form_callback Form callback. + * @param array $options Optional. Widget control options. See wp_register_widget_control(). + * Default empty array. + * @param mixed ...$params Optional additional parameters to pass to the callback function when it's called. + * @phpstan-param array{ + * height?: int, + * width?: int, + * id_base?: int|string, + * } $options See wp_register_widget_control() + * @phpstan-return void + */ + function _register_widget_form_callback($id, $name, $form_callback, $options = array(), ...$params) + { + } + /** + * Remove control callback for widget. + * + * @since 2.2.0 + * + * @param int|string $id Widget ID. + */ + function wp_unregister_widget_control($id) + { + } + /** + * Display dynamic sidebar. + * + * By default this displays the default sidebar or 'sidebar-1'. If your theme specifies the 'id' or + * 'name' parameter for its registered sidebars you can pass an ID or name as the $index parameter. + * Otherwise, you can pass in a numerical index to display the sidebar at that index. + * + * @since 2.2.0 + * + * @global array $wp_registered_sidebars The registered sidebars. + * @global array $wp_registered_widgets The registered widgets. + * + * @param int|string $index Optional. Index, name or ID of dynamic sidebar. Default 1. + * @return bool True, if widget sidebar was found and called. False if not found or not called. + */ + function dynamic_sidebar($index = 1) + { + } + /** + * Determines whether a given widget is displayed on the front end. + * + * Either $callback or $id_base can be used + * $id_base is the first argument when extending WP_Widget class + * Without the optional $widget_id parameter, returns the ID of the first sidebar + * in which the first instance of the widget with the given callback or $id_base is found. + * With the $widget_id parameter, returns the ID of the sidebar where + * the widget with that callback/$id_base AND that ID is found. + * + * NOTE: $widget_id and $id_base are the same for single widgets. To be effective + * this function has to run after widgets have initialized, at action {@see 'init'} or later. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 2.2.0 + * + * @global array $wp_registered_widgets The registered widgets. + * + * @param callable|false $callback Optional. Widget callback to check. Default false. + * @param string|false $widget_id Optional. Widget ID. Optional, but needed for checking. + * Default false. + * @param string|false $id_base Optional. The base ID of a widget created by extending WP_Widget. + * Default false. + * @param bool $skip_inactive Optional. Whether to check in 'wp_inactive_widgets'. + * Default true. + * @return string|false ID of the sidebar in which the widget is active, + * false if the widget is not active. + */ + function is_active_widget($callback = \false, $widget_id = \false, $id_base = \false, $skip_inactive = \true) + { + } + /** + * Determines whether the dynamic sidebar is enabled and used by the theme. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 2.2.0 + * + * @global array $wp_registered_widgets The registered widgets. + * @global array $wp_registered_sidebars The registered sidebars. + * + * @return bool True if using widgets, false otherwise. + */ + function is_dynamic_sidebar() + { + } + /** + * Determines whether a sidebar contains widgets. + * + * For more information on this and similar theme functions, check out + * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ + * Conditional Tags} article in the Theme Developer Handbook. + * + * @since 2.8.0 + * + * @param string|int $index Sidebar name, id or number to check. + * @return bool True if the sidebar has widgets, false otherwise. + */ + function is_active_sidebar($index) + { + } + // + // Internal Functions. + // + /** + * Retrieve full list of sidebars and their widget instance IDs. + * + * Will upgrade sidebar widget list, if needed. Will also save updated list, if + * needed. + * + * @since 2.2.0 + * @access private + * + * @global array $_wp_sidebars_widgets + * @global array $sidebars_widgets + * + * @param bool $deprecated Not used (argument deprecated). + * @return array Upgraded list of widgets to version 3 array format when called from the admin. + */ + function wp_get_sidebars_widgets($deprecated = \true) + { + } + /** + * Retrieves the registered sidebar with the given ID. + * + * @since 5.9.0 + * + * @global array $wp_registered_sidebars The registered sidebars. + * + * @param string $id The sidebar ID. + * @return array|null The discovered sidebar, or null if it is not registered. + */ + function wp_get_sidebar($id) + { + } + /** + * Set the sidebar widget option to update sidebars. + * + * @since 2.2.0 + * @access private + * + * @global array $_wp_sidebars_widgets + * @param array $sidebars_widgets Sidebar widgets and their settings. + */ + function wp_set_sidebars_widgets($sidebars_widgets) + { + } + /** + * Retrieve default registered sidebars list. + * + * @since 2.2.0 + * @access private + * + * @global array $wp_registered_sidebars The registered sidebars. + * + * @return array + */ + function wp_get_widget_defaults() + { + } + /** + * Converts the widget settings from single to multi-widget format. + * + * @since 2.8.0 + * + * @global array $_wp_sidebars_widgets + * + * @param string $base_name Root ID for all widgets of this type. + * @param string $option_name Option name for this widget type. + * @param array $settings The array of widget instance settings. + * @return array The array of widget settings converted to multi-widget format. + */ + function wp_convert_widget_settings($base_name, $option_name, $settings) + { + } + /** + * Output an arbitrary widget as a template tag. + * + * @since 2.8.0 + * + * @global WP_Widget_Factory $wp_widget_factory + * + * @param string $widget The widget's PHP class name (see class-wp-widget.php). + * @param array $instance Optional. The widget's instance settings. Default empty array. + * @param array $args { + * Optional. Array of arguments to configure the display of the widget. + * + * @type string $before_widget HTML content that will be prepended to the widget's HTML output. + * Default `<div class="widget %s">`, where `%s` is the widget's class name. + * @type string $after_widget HTML content that will be appended to the widget's HTML output. + * Default `</div>`. + * @type string $before_title HTML content that will be prepended to the widget's title when displayed. + * Default `<h2 class="widgettitle">`. + * @type string $after_title HTML content that will be appended to the widget's title when displayed. + * Default `</h2>`. + * } + * @phpstan-param array{ + * before_widget?: string, + * after_widget?: string, + * before_title?: string, + * after_title?: string, + * } $args + * @phpstan-return void + */ + function the_widget($widget, $instance = array(), $args = array()) + { + } + /** + * Retrieves the widget ID base value. + * + * @since 2.8.0 + * + * @param string $id Widget ID. + * @return string Widget ID base. + */ + function _get_widget_id_base($id) + { + } + /** + * Handle sidebars config after theme change + * + * @access private + * @since 3.3.0 + * + * @global array $sidebars_widgets + */ + function _wp_sidebars_changed() + { + } + /** + * Validates and remaps any "orphaned" widgets to wp_inactive_widgets sidebar, + * and saves the widget settings. This has to run at least on each theme change. + * + * For example, let's say theme A has a "footer" sidebar, and theme B doesn't have one. + * After switching from theme A to theme B, all the widgets previously assigned + * to the footer would be inaccessible. This function detects this scenario, and + * moves all the widgets previously assigned to the footer under wp_inactive_widgets. + * + * Despite the word "retrieve" in the name, this function actually updates the database + * and the global `$sidebars_widgets`. For that reason it should not be run on front end, + * unless the `$theme_changed` value is 'customize' (to bypass the database write). + * + * @since 2.8.0 + * + * @global array $wp_registered_sidebars The registered sidebars. + * @global array $sidebars_widgets + * @global array $wp_registered_widgets The registered widgets. + * + * @param string|bool $theme_changed Whether the theme was changed as a boolean. A value + * of 'customize' defers updates for the Customizer. + * @return array Updated sidebars widgets. + */ + function retrieve_widgets($theme_changed = \false) + { + } + /** + * Compares a list of sidebars with their widgets against an allowed list. + * + * @since 4.9.0 + * @since 4.9.2 Always tries to restore widget assignments from previous data, not just if sidebars needed mapping. + * + * @global array $wp_registered_sidebars The registered sidebars. + * + * @param array $existing_sidebars_widgets List of sidebars and their widget instance IDs. + * @return array Mapped sidebars widgets. + */ + function wp_map_sidebars_widgets($existing_sidebars_widgets) + { + } + /** + * Compares a list of sidebars with their widgets against an allowed list. + * + * @since 4.9.0 + * + * @global array $wp_registered_widgets The registered widgets. + * + * @param array $sidebars_widgets List of sidebars and their widget instance IDs. + * @param array $allowed_widget_ids Optional. List of widget IDs to compare against. Default: Registered widgets. + * @return array Sidebars with allowed widgets. + */ + function _wp_remove_unregistered_widgets($sidebars_widgets, $allowed_widget_ids = array()) + { + } + /** + * Display the RSS entries in a list. + * + * @since 2.5.0 + * + * @param string|array|object $rss RSS url. + * @param array $args Widget arguments. + * @phpstan-return void + */ + function wp_widget_rss_output($rss, $args = array()) + { + } + /** + * Display RSS widget options form. + * + * The options for what fields are displayed for the RSS form are all booleans + * and are as follows: 'url', 'title', 'items', 'show_summary', 'show_author', + * 'show_date'. + * + * @since 2.5.0 + * + * @param array|string $args Values for input fields. + * @param array $inputs Override default display options. + * @phpstan-param array{number: int, error: bool, title?: string, url?: string, items?: int, show_summary?: int, show_author?: int, show_date?: int} $args + * @phpstan-param array{title?: bool, url?: bool, items?: bool, show_summary?: bool, show_author?: bool, show_date?: bool} $inputs + * @phpstan-return void + */ + function wp_widget_rss_form($args, $inputs = \null) + { + } + /** + * Process RSS feed widget data and optionally retrieve feed items. + * + * The feed widget can not have more than 20 items or it will reset back to the + * default, which is 10. + * + * The resulting array has the feed title, feed url, feed link (from channel), + * feed items, error (if any), and whether to show summary, author, and date. + * All respectively in the order of the array elements. + * + * @since 2.5.0 + * + * @param array $widget_rss RSS widget feed data. Expects unescaped data. + * @param bool $check_feed Optional. Whether to check feed for errors. Default true. + * @return array + */ + function wp_widget_rss_process($widget_rss, $check_feed = \true) + { + } + /** + * Registers all of the default WordPress widgets on startup. + * + * Calls {@see 'widgets_init'} action after all of the WordPress widgets have been registered. + * + * @since 2.2.0 + * @phpstan-return void + */ + function wp_widgets_init() + { + } + /** + * Enables the widgets block editor. This is hooked into 'after_setup_theme' so + * that the block editor is enabled by default but can be disabled by themes. + * + * @since 5.8.0 + * + * @access private + */ + function wp_setup_widgets_block_editor() + { + } + /** + * Whether or not to use the block editor to manage widgets. Defaults to true + * unless a theme has removed support for widgets-block-editor or a plugin has + * filtered the return value of this function. + * + * @since 5.8.0 + * + * @return bool Whether to use the block editor to manage widgets. + */ + function wp_use_widgets_block_editor() + { + } + /** + * Converts a widget ID into its id_base and number components. + * + * @since 5.8.0 + * + * @param string $id Widget ID. + * @return array Array containing a widget's id_base and number components. + */ + function wp_parse_widget_id($id) + { + } + /** + * Finds the sidebar that a given widget belongs to. + * + * @since 5.8.0 + * + * @param string $widget_id The widget ID to look for. + * @return string|null The found sidebar's ID, or null if it was not found. + */ + function wp_find_widgets_sidebar($widget_id) + { + } + /** + * Assigns a widget to the given sidebar. + * + * @since 5.8.0 + * + * @param string $widget_id The widget ID to assign. + * @param string $sidebar_id The sidebar ID to assign to. If empty, the widget won't be added to any sidebar. + */ + function wp_assign_widget_to_sidebar($widget_id, $sidebar_id) + { + } + /** + * Calls the render callback of a widget and returns the output. + * + * @since 5.8.0 + * + * @global array $wp_registered_widgets The registered widgets. + * @global array $wp_registered_sidebars The registered sidebars. + * + * @param string $widget_id Widget ID. + * @param string $sidebar_id Sidebar ID. + * @return string + */ + function wp_render_widget($widget_id, $sidebar_id) + { + } + /** + * Calls the control callback of a widget and returns the output. + * + * @since 5.8.0 + * + * @global array $wp_registered_widget_controls The registered widget controls. + * + * @param string $id Widget ID. + * @return string|null + */ + function wp_render_widget_control($id) + { + } + /** + * Displays a _doing_it_wrong() message for conflicting widget editor scripts. + * + * The 'wp-editor' script module is exposed as window.wp.editor. This overrides + * the legacy TinyMCE editor module which is required by the widgets editor. + * Because of that conflict, these two shouldn't be enqueued together. + * See https://core.trac.wordpress.org/ticket/53569. + * + * There is also another conflict related to styles where the block widgets + * editor is hidden if a block enqueues 'wp-edit-post' stylesheet. + * See https://core.trac.wordpress.org/ticket/53569. + * + * @since 5.8.0 + * @access private + * + * @global WP_Scripts $wp_scripts + * @global WP_Styles $wp_styles + */ + function wp_check_widget_editor_deps() + { + } + /** + * Registers the previous theme's sidebars for the block themes. + * + * @since 6.2.0 + * @access private + * + * @global array $wp_registered_sidebars The registered sidebars. + * @phpstan-return void + */ + function _wp_block_theme_register_classic_sidebars() + { + } + /** + * Outputs the login page header. + * + * @since 2.1.0 + * + * @global string $error Login error message set by deprecated pluggable wp_login() function + * or plugins replacing it. + * @global bool|string $interim_login Whether interim login modal is being displayed. String 'success' + * upon successful login. + * @global string $action The action that brought the visitor to the login page. + * + * @param string|null $title Optional. WordPress login page title to display in the `<title>` element. + * Defaults to 'Log In'. + * @param string $message Optional. Message to display in header. Default empty. + * @param WP_Error|null $wp_error Optional. The error to pass. Defaults to a WP_Error instance. + */ + function login_header($title = \null, $message = '', $wp_error = \null) + { + } + // End of login_header(). + /** + * Outputs the footer for the login page. + * + * @since 3.1.0 + * + * @global bool|string $interim_login Whether interim login modal is being displayed. String 'success' + * upon successful login. + * + * @param string $input_id Which input to auto-focus. + */ + function login_footer($input_id = '') + { + } + /** + * Outputs the JavaScript to handle the form shaking on the login page. + * + * @since 3.0.0 + */ + function wp_shake_js() + { + } + /** + * Outputs the viewport meta tag for the login page. + * + * @since 3.7.0 + */ + function wp_login_viewport_meta() + { + } + /** + * Prints signup_header via wp_head. + * + * @since MU (3.0.0) + */ + function do_signup_header() + { + } + /** + * Prints styles for front-end Multisite Sign-up pages. + * + * @since MU (3.0.0) + */ + function wpmu_signup_stylesheet() + { + } + /** + * Generates and displays the Sign-up and Create Site forms. + * + * @since MU (3.0.0) + * + * @param string $blogname The new site name. + * @param string $blog_title The new site title. + * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string. + */ + function show_blog_form($blogname = '', $blog_title = '', $errors = '') + { + } + /** + * Validates the new site sign-up. + * + * @since MU (3.0.0) + * + * @return array Contains the new site data and error messages. + * See wpmu_validate_blog_signup() for details. + */ + function validate_blog_form() + { + } + /** + * Displays the fields for the new user account registration form. + * + * @since MU (3.0.0) + * + * @param string $user_name The entered username. + * @param string $user_email The entered email address. + * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string. + */ + function show_user_form($user_name = '', $user_email = '', $errors = '') + { + } + /** + * Validates user sign-up name and email. + * + * @since MU (3.0.0) + * + * @return array Contains username, email, and error messages. + * See wpmu_validate_user_signup() for details. + */ + function validate_user_form() + { + } + /** + * Shows a form for returning users to sign up for another site. + * + * @since MU (3.0.0) + * + * @param string $blogname The new site name + * @param string $blog_title The new site title. + * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string. + */ + function signup_another_blog($blogname = '', $blog_title = '', $errors = '') + { + } + /** + * Validates a new site sign-up for an existing user. + * + * @since MU (3.0.0) + * + * @global string $blogname The new site's subdomain or directory name. + * @global string $blog_title The new site's title. + * @global WP_Error $errors Existing errors in the global scope. + * @global string $domain The new site's domain. + * @global string $path The new site's path. + * + * @return null|bool True if site signup was validated, false on error. + * The function halts all execution if the user is not logged in. + */ + function validate_another_blog_signup() + { + } + /** + * Shows a message confirming that the new site has been created. + * + * @since MU (3.0.0) + * @since 4.4.0 Added the `$blog_id` parameter. + * + * @param string $domain The domain URL. + * @param string $path The site root path. + * @param string $blog_title The site title. + * @param string $user_name The username. + * @param string $user_email The user's email address. + * @param array $meta Any additional meta from the {@see 'add_signup_meta'} filter in validate_blog_signup(). + * @param int $blog_id The site ID. + */ + function confirm_another_blog_signup($domain, $path, $blog_title, $user_name, $user_email = '', $meta = array(), $blog_id = 0) + { + } + /** + * Shows a form for a visitor to sign up for a new user account. + * + * @since MU (3.0.0) + * + * @global string $active_signup String that returns registration type. The value can be + * 'all', 'none', 'blog', or 'user'. + * + * @param string $user_name The username. + * @param string $user_email The user's email. + * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string. + */ + function signup_user($user_name = '', $user_email = '', $errors = '') + { + } + /** + * Validates the new user sign-up. + * + * @since MU (3.0.0) + * + * @return bool True if new user sign-up was validated, false on error. + */ + function validate_user_signup() + { + } + /** + * Shows a message confirming that the new user has been registered and is awaiting activation. + * + * @since MU (3.0.0) + * + * @param string $user_name The username. + * @param string $user_email The user's email address. + */ + function confirm_user_signup($user_name, $user_email) + { + } + /** + * Shows a form for a user or visitor to sign up for a new site. + * + * @since MU (3.0.0) + * + * @param string $user_name The username. + * @param string $user_email The user's email address. + * @param string $blogname The site name. + * @param string $blog_title The site title. + * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string. + */ + function signup_blog($user_name = '', $user_email = '', $blogname = '', $blog_title = '', $errors = '') + { + } + /** + * Validates new site signup. + * + * @since MU (3.0.0) + * + * @return bool True if the site sign-up was validated, false on error. + */ + function validate_blog_signup() + { + } + /** + * Shows a message confirming that the new site has been registered and is awaiting activation. + * + * @since MU (3.0.0) + * + * @param string $domain The domain or subdomain of the site. + * @param string $path The path of the site. + * @param string $blog_title The title of the new site. + * @param string $user_name The user's username. + * @param string $user_email The user's email address. + * @param array $meta Any additional meta from the {@see 'add_signup_meta'} filter in validate_blog_signup(). + */ + function confirm_blog_signup($domain, $path, $blog_title, $user_name = '', $user_email = '', $meta = array()) + { + } + /** + * Retrieves languages available during the site/user sign-up process. + * + * @since 4.4.0 + * + * @see get_available_languages() + * + * @return string[] Array of available language codes. Language codes are formed by + * stripping the .mo extension from the language file names. + */ + function signup_get_available_languages() + { + } + /** + * Response to a trackback. + * + * Responds with an error or success XML message. + * + * @since 0.71 + * + * @param int|bool $error Whether there was an error. + * Default '0'. Accepts '0' or '1', true or false. + * @param string $error_message Error message if an error occurred. Default empty string. + */ + function trackback_response($error = 0, $error_message = '') + { + } + /** + * logIO() - Writes logging info to a file. + * + * @since 1.2.0 + * @deprecated 3.4.0 Use error_log() + * @see error_log() + * + * @global int|bool $xmlrpc_logging Whether to enable XML-RPC logging. + * + * @param string $io Whether input or output. + * @param string $msg Information describing logging reason. + */ + function logIO($io, $msg) + { + } +} +namespace { +/** + * WordPress database abstraction object. + * @var wpdb + */ +$wpdb = \null; +} diff --git a/vendor/phpcompatibility/php-compatibility/CHANGELOG.md b/vendor/phpcompatibility/php-compatibility/CHANGELOG.md new file mode 100644 index 00000000..b92ae254 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/CHANGELOG.md @@ -0,0 +1,1488 @@ +# Change Log for the PHPCompatibility standard for PHP Codesniffer + +All notable changes to this project will be documented in this file. + +This projects adheres to [Keep a CHANGELOG](http://keepachangelog.com/). + +Up to version 8.0.0, the `major.minor` version numbers were based on the PHP version for which compatibility check support was added, with `patch` version numbers being specific to this library. +From version 8.0.0 onwards, [Semantic Versioning](http://semver.org/) is used. + +<!-- Legend to the icons used: https://github.com/PHPCompatibility/PHPCompatibility/pull/506#discussion_r131650488 --> + + +## [Unreleased] + +_Nothing yet._ + +## [9.3.5] - 2019-12-27 + +See all related issues and PRs in the [9.3.5 milestone]. + +### Added +- :star: `PHPCompatibility.Classes.NewClasses` sniff: recognize the new `FFI` extension related classes as introduced in PHP 7.4. [#949](https://github.com/PHPCompatibility/PHPCompatibility/pull/949) +- :star: `PHPCompatibility.IniDirectives.NewIniDirectives` sniff: detect use of the new `FFI` extension related ini directives as introduced in PHP 7.4. [#949](https://github.com/PHPCompatibility/PHPCompatibility/pull/949) + +### Changed +- :pencil: `PHPCompatibility.Syntax.NewShortArray`: improved clarity of the error message and made it consistent with other error messages in this standard. [#934](https://github.com/PHPCompatibility/PHPCompatibility/pull/934) +- :pencil: `PHPCompatibility.Interfaces.NewInterfaces`: updated the URL which is mentioned in select error messages. [#942](https://github.com/PHPCompatibility/PHPCompatibility/pull/942) +- :recycle: Another slew of code documentation fixes. [#937](https://github.com/PHPCompatibility/PHPCompatibility/pull/937), [#939](https://github.com/PHPCompatibility/PHPCompatibility/pull/939), [#940](https://github.com/PHPCompatibility/PHPCompatibility/pull/940), [#941](https://github.com/PHPCompatibility/PHPCompatibility/pull/941), [#943](https://github.com/PHPCompatibility/PHPCompatibility/pull/943), [#944](https://github.com/PHPCompatibility/PHPCompatibility/pull/944), [#951](https://github.com/PHPCompatibility/PHPCompatibility/pull/951), [#950](https://github.com/PHPCompatibility/PHPCompatibility/pull/950). Fixes [#734](https://github.com/PHPCompatibility/PHPCompatibility/issues/734). +- :green_heart: Travis: various tweaks. The builds against PHP 7.4 are no longer allowed to fail. [#935](https://github.com/PHPCompatibility/PHPCompatibility/pull/935), [#938](https://github.com/PHPCompatibility/PHPCompatibility/pull/938) + For running the sniffs on PHP 7.4, it is recommended to use PHP_CodeSniffer 3.5.0+ as PHP_CodeSniffer itself is + not compatible with PHP 7.4 until version 3.5.0. + +### Fixed +- :bug: `PHPCompatibility.Classes.NewClasses`: two new PHP 7.4 classes were being checked as if they were Exceptions. [#945](https://github.com/PHPCompatibility/PHPCompatibility/pull/945) + +### Credits +Thanks go out to [William Entriken] for their contribution to this version. :clap: + + +## [9.3.4] - 2019-11-15 + +See all related issues and PRs in the [9.3.4 milestone]. + +### Fixed +- :bug: `PHPCompatibility.Keywords.ForbiddenNames`: false positive for list when used in a `foreach()` condition. [#930](https://github.com/PHPCompatibility/PHPCompatibility/pull/930). Fixes [#928](https://github.com/PHPCompatibility/PHPCompatibility/issues/928), [#929](https://github.com/PHPCompatibility/PHPCompatibility/pull/929) + +### Credits +Thanks go out to [Sergii Bondarenko] for their contribution to this version. :clap: + + +## [9.3.3] - 2019-11-11 + +See all related issues and PRs in the [9.3.3 milestone]. + +### Added +- :star: `PHPCompatibility.Constants.NewConstants` sniff: detection of yet more (undocumented) PHP 7.2 Sodium constants. [#924](https://github.com/PHPCompatibility/PHPCompatibility/pull/924) +- :star: `PHPCompatibility.Keywords.ForbiddenNames` sniff: detect the use of more reserved keywords which are not allowed to be used to name certain constructs. [#923](https://github.com/PHPCompatibility/PHPCompatibility/pull/923). Fixes [#922](https://github.com/PHPCompatibility/PHPCompatibility/issues/922) + +### Fixed +- :bug: `PHPCompatibility.FunctionNameRestrictions.RemovedPHP4StyleConstructors`: false positive detecting PHP4-style constructors when declared in interfaces. The class implementing the interface will not have the same name as the interface, so the actual method would not be regarded as a PHP4 style constructor. [#921](https://github.com/PHPCompatibility/PHPCompatibility/pull/921) + +### Credits +Thanks go out to [Nikhil] for their contribution to this version. :clap: + + +## [9.3.2] - 2019-10-16 + +See all related issues and PRs in the [9.3.2 milestone]. + +### Added +- :star: `PHPCompatibility.Constants.NewConstants` sniff: detection of the PHP 7.2 `SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13` constant. [#915](https://github.com/PHPCompatibility/PHPCompatibility/pull/915) +- :books: Readme: a list of projects which are build upon or extend PHPCompatibility. [#904](https://github.com/PHPCompatibility/PHPCompatibility/pull/904) + +### Changed +- :pushpin: `PHPCompatibility.FunctionNameRestrictions.RemovedPHP4StyleConstructors`: minor efficiency fix to make the sniff faster. [#912](https://github.com/PHPCompatibility/PHPCompatibility/pull/912) +- :pushpin: `PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames`: functions marked as `@deprecated` in the function docblock will now be ignored by this sniff. [#917](https://github.com/PHPCompatibility/PHPCompatibility/pull/917). Fixes [#911](https://github.com/PHPCompatibility/PHPCompatibility/issues/911) +- :pencil: `PHPCompatibility.FunctionDeclarations.ForbiddenToStringParameters`: the `$ooScopeTokens` property is now `protected`, it should never have been `public` in the first place. [#907](https://github.com/PHPCompatibility/PHPCompatibility/pull/907) +- :recycle: More code documentation fixes. [#903](https://github.com/PHPCompatibility/PHPCompatibility/pull/903), [#916](https://github.com/PHPCompatibility/PHPCompatibility/pull/916) +- :books: Readme/Contributing: various tweaks. [#904](https://github.com/PHPCompatibility/PHPCompatibility/pull/904), [#905](https://github.com/PHPCompatibility/PHPCompatibility/pull/905) + +### Fixed +- :bug: `PHPCompatibility.FunctionUse.OptionalToRequiredFunctionParameters`: false positive when a class is instantiated which has the same name as one of the affected functions. [#914](https://github.com/PHPCompatibility/PHPCompatibility/pull/914). Fixes [#913](https://github.com/PHPCompatibility/PHPCompatibility/issues/913) +- :bug: `PHPCompatibility.FunctionUse.RequiredToOptionalFunctionParameters`: false positive when a class is instantiated which has the same name as one of the affected functions. [#914](https://github.com/PHPCompatibility/PHPCompatibility/pull/914) +- :bug: `PHPCompatibility.MethodUse.NewDirectCallsToClone`: false positive on calling `__clone()` from within the class being cloned [#910](https://github.com/PHPCompatibility/PHPCompatibility/pull/910). Fixes [#629 (comment)](https://github.com/PHPCompatibility/PHPCompatibility/issues/629#issuecomment-532607809) +- :bug: `PHPCompatibility.Miscellaneous.ValidIntegers`: binary numbers using an uppercase `B` were not always recognized correctly. [#909](https://github.com/PHPCompatibility/PHPCompatibility/pull/909) + + +## [9.3.1] - 2019-09-06 + +See all related issues and PRs in the [9.3.1 milestone]. + +### Changed +- :recycle: A whole slew of code documentation fixes. [#892](https://github.com/PHPCompatibility/PHPCompatibility/pull/892), [#895](https://github.com/PHPCompatibility/PHPCompatibility/pull/895), [#896](https://github.com/PHPCompatibility/PHPCompatibility/pull/896), [#897](https://github.com/PHPCompatibility/PHPCompatibility/pull/897), [#898](https://github.com/PHPCompatibility/PHPCompatibility/pull/898), [#899](https://github.com/PHPCompatibility/PHPCompatibility/pull/899), [#900](https://github.com/PHPCompatibility/PHPCompatibility/pull/900) +- :wrench: Travis: minor tweaks to the build script. [#893](https://github.com/PHPCompatibility/PHPCompatibility/pull/893) + +### Fixed +- :bug: `PHPCompatibility.ParameterValues.RemovedImplodeFlexibleParamOrder`: false positive when an array item in the second parameter contained a ternary. [#891](https://github.com/PHPCompatibility/PHPCompatibility/pull/891). Fixes [#890](https://github.com/PHPCompatibility/PHPCompatibility/issues/890) +- :bug: `PHPCompatibility.ParameterValues.RemovedImplodeFlexibleParamOrder`: will now take array casts into account when determining which parameter is `$pieces`. [#891](https://github.com/PHPCompatibility/PHPCompatibility/pull/891). +- :bug: `PHPCompatibility.ParameterValues.RemovedImplodeFlexibleParamOrder`: hardening of the logic to not examine the second parameter when the first is just and only a text string (`$glue`). [#891](https://github.com/PHPCompatibility/PHPCompatibility/pull/891). + + +## [9.3.0] - 2019-08-29 + +See all related issues and PRs in the [9.3.0 milestone]. + +To keep informed of the progress of covering "_everything PHP 7.4_" in PHPCompatibility, please subscribe to issue [#808](https://github.com/PHPCompatibility/PHPCompatibility/issues/808). + +### Changes expected in PHPCompatibility 10.0.0 +The next version of PHPCompatibility is expected to include a new external dependency. + +In this same release, support for PHP < 5.4 and PHP_CodeSniffer < 2.6.0 will be dropped. + +The `10.0.0` release is expected around the same time as the release of PHP 7.4 - end of November/beginning of December 2019. + +### Added +- :star2: New `PHPCompatibility.Miscellaneous.NewPHPOpenTagEOF` sniff to detect a stand-alone PHP open tag at the end of a file, without trailing newline, as will be supported as of PHP 7.4. [#843](https://github.com/PHPCompatibility/PHPCompatibility/pull/846) +- :star2: New `PHPCompatibility.ParameterValues.ForbiddenStripTagsSelfClosingXHTML` sniff to detect calls to `strip_tags()` passing self-closing XHTML tags in the `$allowable_tags` parameter. This has not been supported since PHP 5.3.4. [#866](https://github.com/PHPCompatibility/PHPCompatibility/pull/866) +- :star2: New `PHPCompatibility.ParameterValues.NewHTMLEntitiesEncodingDefault` sniff to detect calls to `html_entity_decode()`, `htmlentities()` and `htmlspecialchars()` which are impacted by the change to the default value of the `$encoding` parameter in PHP 5.4. [#862](https://github.com/PHPCompatibility/PHPCompatibility/pull/862) +- :star2: New `PHPCompatibility.ParameterValues.NewIconvMbstringCharsetDefault` sniff to detect code impacted by the change in the `default_charset` value in PHP 5.6. [#864](https://github.com/PHPCompatibility/PHPCompatibility/pull/864) Fixes [#839](https://github.com/PHPCompatibility/PHPCompatibility/issues/839) +- :star2: New `PHPCompatibility.ParameterValues.NewIDNVariantDefault` sniff to detect calls to `idn_to_ascii()` and `idn_to_utf8()` impacted by the PHP 7.4 change in the default value for the `$variant` parameter. [#861](https://github.com/PHPCompatibility/PHPCompatibility/pull/861) +- :star2: New `PHPCompatibility.ParameterValues.NewPasswordAlgoConstantValues` sniff to detect calls to `password_hash()` and `password_needs_rehash()` impacted by the changed value of the `PASSWORD_DEFAULT`, `PASSWORD_BCRYPT`, `PASSWORD_ARGON2I` and `PASSWORD_ARGON2ID` constants in PHP 7.4. [#865](https://github.com/PHPCompatibility/PHPCompatibility/pull/865) +- :star2: New `PHPCompatibility.ParameterValues.NewProcOpenCmdArray` sniff to detect calls to `proc_open()` passing an array for the `$cmd` parameter as supported as of PHP 7.4. [#869](https://github.com/PHPCompatibility/PHPCompatibility/pull/869) +- :star2: New `PHPCompatibility.ParameterValues.NewStripTagsAllowableTagsArray` sniff to detect calls to `strip_tags()` passing an array for the `$allowable_tags` parameter as will be supported as of PHP 7.4. [#867](https://github.com/PHPCompatibility/PHPCompatibility/pull/867) +- :star2: New `PHPCompatibility.ParameterValues.RemovedImplodeFlexibleParamOrder` sniff to detect `implode()` being called with `$glue` and `$pieces` in reverse order from the documented argument order. This was previously allowed for historical reasons, but will be deprecated in PHP 7.4. [#846](https://github.com/PHPCompatibility/PHPCompatibility/pull/846) +- :star2: New `PHPCompatibility.ParameterValues.RemovedMbStrrposEncodingThirdParam` sniff to detect the `$encoding` being passed as the third, instead of the fourth parameter, to `mb_strrpos()` as has been soft deprecated since PHP 5.2 and will be hard deprecated as of PHP 7.4. [#860](https://github.com/PHPCompatibility/PHPCompatibility/pull/860) +- :star2: New `PHPCompatibility.Syntax.RemovedCurlyBraceArrayAccess` sniff to detect array and string offset access using curly braces as will be deprecated as of PHP 7.4. [#855](https://github.com/PHPCompatibility/PHPCompatibility/pull/855) + - In contrast to any other sniff in the PHPCompatibility standard, this sniff contains an auto-fixer. +- :star2: New `PHPCompatibility.TextStrings.NewUnicodeEscapeSequence` sniff to detect use of the PHP 7.0+ unicode codepoint escape sequences and issues with invalid sequences. [#856](https://github.com/PHPCompatibility/PHPCompatibility/pull/856) +- :star2: New `PHPCompatibility.Upgrade.LowPHP` sniff to give users of old PHP versions advance warning when support will be dropped in the near future. [#838](https://github.com/PHPCompatibility/PHPCompatibility/pull/838) + At this moment, the intention is to drop support for PHP 5.3 by the end of this year. +- :star: `PHPCompatibility.Classes.NewClasses` sniff: recognize the new `WeakReference` class as introduced in PHP 7.4. [#857](https://github.com/PHPCompatibility/PHPCompatibility/pull/857) +- :star: `PHPCompatibility.Constants.NewConstants` sniff: detection of new Curl constants as introduced in PHP 7.3.5. [#878](https://github.com/PHPCompatibility/PHPCompatibility/pull/878) +- :star: `PHPCompatibility.Constants.NewConstants` sniff: detection of the revived `T_BAD_CHARACTER` constant as re-introduced in PHP 7.4. [#882](https://github.com/PHPCompatibility/PHPCompatibility/pull/882) +- :star: `PHPCompatibility.Constants.NewConstants` sniff: detection of the new `IMG_FILTER_SCATTER` and `PASSWORD_ARGON2_PROVIDER` constants as introduced in PHP 7.4. [#887](https://github.com/PHPCompatibility/PHPCompatibility/pull/887) +- :star: `PHPCompatibility.Constants.RemovedConstants` sniff: detection of use of the `CURLPIPE_HTTP1` constant which will be deprecated in PHP 7.4. [#879](https://github.com/PHPCompatibility/PHPCompatibility/pull/879) +- :star: `PHPCompatibility.Constants.RemovedConstants` sniff: detection of use of the `FILTER_SANITIZE_MAGIC_QUOTES` constant which will be deprecated in PHP 7.4. [#845](https://github.com/PHPCompatibility/PHPCompatibility/pull/845) +- :star: `PHPCompatibility.Constants.RemovedConstants` sniff: detection of use of the `T_CHARACTER` and `T_BAD_CHARACTER` constants which were removed in PHP 7.0. [#882](https://github.com/PHPCompatibility/PHPCompatibility/pull/882) +- :star: `PHPCompatibility.FunctionDeclarations.NewMagicMethods` sniff: recognize the new `__serialize()` and `__unserialize()` magic methods as introduced in PHP 7.4. [#868](https://github.com/PHPCompatibility/PHPCompatibility/pull/868) +- :star: `PHPCompatibility.FunctionDeclarations.NewMagicMethods` sniff: recognize the PHP 5.0 `__construct()` and `__destruct()` magic methods. [#884](https://github.com/PHPCompatibility/PHPCompatibility/pull/884) +- :star: `PHPCompatibility.FunctionDeclarations.NonStaticMagicMethods` sniff: recognize the new `__serialize()` and `__unserialize()` magic methods as introduced in PHP 7.4. [#868](https://github.com/PHPCompatibility/PHPCompatibility/pull/868) +- :star: `PHPCompatibility.FunctionUse.NewFunctions` sniff: recognize the new PHP 7.4 function `imagecreatefromtga()`. [#873](https://github.com/PHPCompatibility/PHPCompatibility/pull/873) +- :star: `PHPCompatibility.FunctionUse.RemovedFunctionParameters` sniff: recognize the deprecation of the `$age` parameter of the `curl_version()` function. [#874](https://github.com/PHPCompatibility/PHPCompatibility/pull/874) +- :star: `PHPCompatibility.FunctionUse.RemovedFunctions` sniff: recognize the PHP 7.4 deprecated `convert_cyr_string()()`, `ezmlm_hash()`, `get_magic_quotes_gpc()`, `get_magic_quotes_runtime()`, `hebrevc()`, `is_real()`, `money_format()` and `restore_include_path()` functions. [#847](https://github.com/PHPCompatibility/PHPCompatibility/pull/847) +- :star: `PHPCompatibility.IniDirectives.NewIniDirectives` sniff: detect use of the new PHP 7.4 `zend.exception_ignore_args` ini directive. [#871](https://github.com/PHPCompatibility/PHPCompatibility/pull/871) +- :star: `PHPCompatibility.IniDirectives.RemovedIniDirectives` sniff: detect use of the `allow_url_include` ini directive which is deprecated as of PHP 7.4. [#870](https://github.com/PHPCompatibility/PHPCompatibility/pull/870) +- :star: `PHPCompatibility.IniDirectives.RemovedIniDirectives` sniff: detection of use of the `opcache.load_comments` directive which was removed in PHP 7.0. [#883](https://github.com/PHPCompatibility/PHPCompatibility/pull/883) +- :star: `PHPCompatibility.ParameterValues.NewHashAlgorithms`: recognize use of the new PHP 7.4 `crc32c` hash algorithm. [#872](https://github.com/PHPCompatibility/PHPCompatibility/pull/872) +- :star: `PHPCompatibility.TypeCasts.RemovedTypeCasts` sniff: detect usage of the `(real)` type cast which will be deprecated in PHP 7.4. [#844](https://github.com/PHPCompatibility/PHPCompatibility/pull/844) +- :star: Recognize the `recode` extension functionality which will be removed in PHP 7.4 (moved to PECL) in the `RemovedExtensions` and `RemovedFunctions` sniffs. [#841](https://github.com/PHPCompatibility/PHPCompatibility/pull/841) +- :star: Recognize the `OPcache` extension functionality which was be introduced in PHP 5.5, but not yet fully accounted for in the `NewFunctions` and `NewIniDirectives` sniffs. [#883](https://github.com/PHPCompatibility/PHPCompatibility/pull/883) +- :star: New `getCompleteTextString()` utility method to the `PHPCompatibility\Sniff` class. [#856](https://github.com/PHPCompatibility/PHPCompatibility/pull/856) +- :umbrella: Unit test for the `PHPCompatibility.Upgrade.LowPHPCS` sniff. +- :umbrella: Some extra unit tests for the `PHPCompatibility.ParameterValues.NewNegativeStringOffset`, `PHPCompatibility.ParameterValues.RemovedMbStringModifiers` and sniffs. [#876](https://github.com/PHPCompatibility/PHPCompatibility/pull/876), [#877](https://github.com/PHPCompatibility/PHPCompatibility/pull/877) +- :books: `CONTRIBUTING.md`: Added a list of typical sources for information about changes to PHP. [#875](https://github.com/PHPCompatibility/PHPCompatibility/pull/875) + +### Changed +- :pushpin: `PHPCompatibility.FunctionDeclarations.NewExceptionsFromToString` sniff: the sniff will now also examine the function docblock, if available, and will throw an error when a `@throws` tag is found in the docblock. [#880](https://github.com/PHPCompatibility/PHPCompatibility/pull/880). Fixes [#863](https://github.com/PHPCompatibility/PHPCompatibility/issues/863) +- :pushpin: `PHPCompatibility.FunctionDeclarations.NonStaticMagicMethods` sniff: will now also check the visibility and `static` (or not) requirements of the magic `__construct()`, `__destruct()`, `__clone()`, `__debugInfo()`, `__invoke()` and `__set_state()` methods. [#885](https://github.com/PHPCompatibility/PHPCompatibility/pull/885) +- :pushpin: `PHPCompatibility.Syntax.NewArrayStringDereferencing` sniff: the sniff will now also recognize array string dereferencing using curly braces as was (silently) supported since PHP 7.0. [#851](https://github.com/PHPCompatibility/PHPCompatibility/pull/851) + - The sniff will now also throw errors for each dereference found on the array/string, not just the first one. +- :pushpin: `PHPCompatibility.Syntax.NewClassMemberAccess` sniff: the sniff will now also recognize class member access on instantiation and cloning using curly braces as was (silently) supported since PHP 7.0. [#852](https://github.com/PHPCompatibility/PHPCompatibility/pull/852) + - The sniff will now also throw errors for each access detected, not just the first one. + - The line number on which the error is thrown in now set more precisely. +- :pushpin: `PHPCompatibility.Syntax.NewFunctionArrayDereferencing` sniff: the sniff will now also recognize function array dereferencing using curly braces as was (silently) supported since PHP 7.0. [#853](https://github.com/PHPCompatibility/PHPCompatibility/pull/853) + - The sniff will now also throw errors for each access detected, not just the first one. + - The line number on which the error is thrown in now set more precisely. +- :recycle: Various code clean-up and improvements. [#849](https://github.com/PHPCompatibility/PHPCompatibility/pull/849), [#850](https://github.com/PHPCompatibility/PHPCompatibility/pull/850) +- :recycle: Various minor inline documentation fixes. [#854](https://github.com/PHPCompatibility/PHPCompatibility/pull/854), [#886](https://github.com/PHPCompatibility/PHPCompatibility/pull/886) +- :wrench: Travis: various tweaks to the build script. [#834](https://github.com/PHPCompatibility/PHPCompatibility/pull/834), [#842](https://github.com/PHPCompatibility/PHPCompatibility/pull/842) + +### Fixed +- :bug: `PHPCompatibility.FunctionDeclarations.ForbiddenParametersWithSameName` sniff: variable names are case-sensitive, so recognition of same named parameters should be done in a case-sensitive manner. [#848](https://github.com/PHPCompatibility/PHPCompatibility/pull/848) +- :bug: `PHPCompatibility.FunctionDeclarations.NewExceptionsFromToString` sniff: Exceptions thrown within a `try` should not trigger the sniff. [#880](https://github.com/PHPCompatibility/PHPCompatibility/pull/880). Fixes [#863](https://github.com/PHPCompatibility/PHPCompatibility/issues/863) +- :bug: `PHPCompatibility.FunctionDeclarations.NewExceptionsFromToString` sniff: the `$ooScopeTokens` property should never have been a public property. [#880](https://github.com/PHPCompatibility/PHPCompatibility/pull/880). +- :umbrella: Some of the unit tests for the `PHPCompatibility.Operators.RemovedTernaryAssociativity` sniff were not being run. [#836](https://github.com/PHPCompatibility/PHPCompatibility/pull/836) + + +## [9.2.0] - 2019-06-28 + +See all related issues and PRs in the [9.2.0 milestone]. + +To keep informed of the progress of covering "_everything PHP 7.4_" in PHPCompatibility, please subscribe to issue [#808](https://github.com/PHPCompatibility/PHPCompatibility/issues/808). + +### Added +- :star2: New `PHPCompatibility.Classes.ForbiddenAbstractPrivateMethods` sniff to detect methods declared as both `private` as well as `abstract`. This was allowed between PHP 5.0.0 and 5.0.4, but disallowed in PHP 5.1 as the behaviour of `private` and `abstract` are mutually exclusive. [#822](https://github.com/PHPCompatibility/PHPCompatibility/pull/822) +- :star2: New `PHPCompatibility.Classes.NewTypedProperties` sniff to detect PHP 7.4 typed property declarations. [#801](https://github.com/PHPCompatibility/PHPCompatibility/pull/801), [#829](https://github.com/PHPCompatibility/PHPCompatibility/pull/829) +- :star2: New `PHPCompatibility.Classes.RemovedOrphanedParent` sniff to detect the use of the `parent` keyword in classes without a parent (non-extended classes). This code pattern is deprecated in PHP 7.4 and will become a compile-error in PHP 8.0. [#818](https://github.com/PHPCompatibility/PHPCompatibility/pull/818) +- :star2: New `PHPCompatibility.FunctionDeclarations.NewExceptionsFromToString` sniff to detect throwing exceptions from `__toString()` methods. This would previously result in a fatal error, but will be allowed as of PHP 7.4. [#814](https://github.com/PHPCompatibility/PHPCompatibility/pull/814) +- :star2: New `PHPCompatibility.FunctionDeclarations.ForbiddenToStringParameters` sniff to detect `__toString()` function declarations expecting parameters. This was disallowed in PHP 5.3. [#815](https://github.com/PHPCompatibility/PHPCompatibility/pull/815) +- :star2: New `PHPCompatibility.MethodUse.ForbiddenToStringParameters` sniff to detect direct calls to `__toString()` magic methods passing parameters. This was disallowed in PHP 5.3. [#830](https://github.com/PHPCompatibility/PHPCompatibility/pull/830) +- :star2: New `PHPCompatibility.Operators.ChangedConcatOperatorPrecedence` sniff to detect code affected by the upcoming change in operator precedence for the concatenation operator. The concatenation operator precedence will be lowered in PHP 8.0, with deprecation notices for code affected being thrown in PHP 7.4. [#805](https://github.com/PHPCompatibility/PHPCompatibility/pull/805) +- :star2: New `PHPCompatibility.Operators.RemovedTernaryAssociativity` sniff to detect code relying on left-associativity of the ternary operator. This behaviour will be deprecated in PHP 7.4 and removed in PHP 8.0. [#810](https://github.com/PHPCompatibility/PHPCompatibility/pull/810) +- :star2: New `PHPCompatibility.Syntax.NewArrayUnpacking` sniff to detect the use of the spread operator to unpack arrays when declaring a new array, as introduced in PHP 7.4. [#804](https://github.com/PHPCompatibility/PHPCompatibility/pull/804) +- :star: `PHPCompatibility.Classes.NewClasses` sniff: recognize the new `ReflectionReference` class as introduced in PHP 7.4. [#820](https://github.com/PHPCompatibility/PHPCompatibility/pull/820) +- :star: `PHPCompatibility.Constants.NewConstants` sniff: detection of the new PHP 7.4 Core (Standard), MBString, Socket and Tidy constants. [#821](https://github.com/PHPCompatibility/PHPCompatibility/pull/821) +- :star: `PHPCompatibility.FunctionUse.NewFunctions` sniff: detect usage of the new PHP 7.4 `get_mangled_object_vars()`, `mb_str_split()`, `openssl_x509_verify()`, `password_algos()`, `pcntl_unshare()`, `sapi_windows_set_ctrl_handler()` and `sapi_windows_generate_ctrl_event()` functions. [#811](https://github.com/PHPCompatibility/PHPCompatibility/pull/811), [#819](https://github.com/PHPCompatibility/PHPCompatibility/pull/819), [#827](https://github.com/PHPCompatibility/PHPCompatibility/pull/827) +- :star: `PHPCompatibility.FunctionUse.NewFunctions` sniff: recognize the new OCI functions as introduced in PHP 7.2.14 and PHP 7.3.1. [#786](https://github.com/PHPCompatibility/PHPCompatibility/pull/786) +- :star: `PHPCompatibility.FunctionUse.RemovedFunctions` sniff: recognize the PHP 7.4 deprecated `ldap_control_paged_result_response()` and `ldap_control_paged_result()` functions. [#831](https://github.com/PHPCompatibility/PHPCompatibility/pull/831) +- :star: `PHPCompatibility.FunctionUse.RemovedFunctions` sniff: recognize the `Payflow Pro/pfpro` functions as removed in PHP 5.1. [#823](https://github.com/PHPCompatibility/PHPCompatibility/pull/823) +- :star: `PHPCompatibility.FunctionUse.RequiredToOptionalFunctionParameters` sniff: account for the parameters for `array_merge()` and `array_merge_recursive()` becoming optional in PHP 7.4. [#817](https://github.com/PHPCompatibility/PHPCompatibility/pull/817) +- :star: `PHPCompatibility.IniDirectives.RemovedIniDirectives` sniff: recognize the `Payflow Pro/pfpro` ini directives as removed in PHP 5.1. [#823](https://github.com/PHPCompatibility/PHPCompatibility/pull/823) +- :star: Recognize the `interbase/Firebird` extension functionality which will be removed in PHP 7.4 (moved to PECL) in the `RemovedConstants`, `RemovedExtensions`, `RemovedFunctions` and `RemovedIniDirectives` sniffs. [#807](https://github.com/PHPCompatibility/PHPCompatibility/pull/807) +- :star: Recognize the `wddx` extension functionality which will be removed in PHP 7.4 (moved to PECL) in the `RemovedExtensions` and `RemovedFunctions` sniffs. [#826](https://github.com/PHPCompatibility/PHPCompatibility/pull/826) +- :star: New `isShortTernary()` and `isUnaryPlusMinus()` utility methods to the `PHPCompatibility\Sniff` class. [#810](https://github.com/PHPCompatibility/PHPCompatibility/pull/810), [#805](https://github.com/PHPCompatibility/PHPCompatibility/pull/805) + +### Changed +- :pencil2: The `PHPCompatibility.Extensions.RemovedExtensions` sniff will now only report on the removed `Payflow Pro` extension when a function uses `pfpro_` as a prefix. Previously, it used the `pfpro` prefix (without underscore) for detection. [#812](https://github.com/PHPCompatibility/PHPCompatibility/pull/812) +- :pencil2: The error message thrown when the `T_ELLIPSIS` token, i.e. the spread operator, is detected. [#803](https://github.com/PHPCompatibility/PHPCompatibility/pull/803) + PHP 7.4 adds a third use-case for the spread operator. The adjusted error message accounts for this. +- :umbrella: `PHPCompatibility.FunctionDeclarations.NewParamTypeDeclarations` is now also tested with parameters using the splat operator. [#802](https://github.com/PHPCompatibility/PHPCompatibility/pull/802) +- :books: The documentation now uses the GitHub repo of `PHP_CodeSniffer` as the canonical entry point for `PHP_CodeSniffer`. Previously, it would point to the PEAR package. [#788](https://github.com/PHPCompatibility/PHPCompatibility/pull/788) +- :books: The links in the changelog now all point to the `PHPCompatibility/PHPCompatibility` repo and no longer to the (deprecated) `wimg/PHPCompatibility` repo. [#828](https://github.com/PHPCompatibility/PHPCompatibility/pull/828) +- :recycle: Various minor inline documentation improvements. [#825](https://github.com/PHPCompatibility/PHPCompatibility/pull/825) +- :wrench: Various performance optimizations and code simplifications. [#783](https://github.com/PHPCompatibility/PHPCompatibility/pull/783), [#784](https://github.com/PHPCompatibility/PHPCompatibility/pull/784), [#795](https://github.com/PHPCompatibility/PHPCompatibility/pull/795), [#813](https://github.com/PHPCompatibility/PHPCompatibility/pull/813) +- :green_heart: Travis: build tests are now being run against PHP 7.4 (unstable) as well. [#790](https://github.com/PHPCompatibility/PHPCompatibility/pull/790) + Note: the builds are currently not (yet) tested against PHP 8.0 (unstable) as there is no compatible PHPUnit version available (yet). +- :wrench: Travis: The build script has been refactored to use [stages](https://docs.travis-ci.com/user/build-stages/) to get the most relevant results faster. Additionally some more tweaks have been made to improve and/or simplify the build script. [#798](https://github.com/PHPCompatibility/PHPCompatibility/pull/798) +- :wrench: Build/PHPCS: warnings are no longer allowed for the PHPCompatibility native code. [#800](https://github.com/PHPCompatibility/PHPCompatibility/pull/800) +- :wrench: Build/PHPCS: added variable assignment alignment check and file include check to the PHPCompatibility native CS configuration. [#824](https://github.com/PHPCompatibility/PHPCompatibility/pull/824) +- :wrench: The minimum version for the recommended `DealerDirect/phpcodesniffer-composer-installer` Composer plugin has been upped to `0.5.0`. [#791](https://github.com/PHPCompatibility/PHPCompatibility/pull/791) + +### Fixed +- :bug: The `PHPCompatibility.Extensions.RemovedExtensions` sniff contained a typo in the alternative recommended for the removed `mcve` extension. [#806](https://github.com/PHPCompatibility/PHPCompatibility/pull/806) +- :bug: The `PHPCompatibility.Extensions.RemovedExtensions` sniff listed the wrong removal version number for the `Payflow Pro/pfpro` extension (PHP 5.3 instead of the correct 5.1). [#823](https://github.com/PHPCompatibility/PHPCompatibility/pull/823) + +### Credits +Thanks go out to [Yılmaz] and [Tim Millwood] for their contribution to this version. :clap: + + +## [9.1.1] - 2018-12-31 + +See all related issues and PRs in the [9.1.1 milestone]. + +### Fixed +- :bug: `ForbiddenThisUseContexts`: false positive for unsetting `$this['key']` on objects implementing `ArrayAccess`. [#781](https://github.com/PHPCompatibility/PHPCompatibility/pull/781). Fixes [#780](https://github.com/PHPCompatibility/PHPCompatibility/issues/780) + +## [9.1.0] - 2018-12-16 + +See all related issues and PRs in the [9.1.0 milestone]. + +### Added +- :star2: New `PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue` sniff to detect code which could be affected by the PHP 7.0 change in the values reported by `func_get_arg()`, `func_get_args()`, `debug_backtrace()` and exception backtraces. [#750](https://github.com/PHPCompatibility/PHPCompatibility/pull/750). Fixes [#585](https://github.com/PHPCompatibility/PHPCompatibility/pull/585). +- :star2: New `PHPCompatibility.MethodUse.NewDirectCallsToClone` sniff to detect direct call to a `__clone()` magic method which wasn't allowed prior to PHP 7.0. [#743](https://github.com/PHPCompatibility/PHPCompatibility/pull/743). Fixes [#629](https://github.com/PHPCompatibility/PHPCompatibility/issues/629). +- :star2: New `PHPCompatibility.Variables.ForbiddenThisUseContext` sniff to detect most of the inconsistencies surrounding the use of the `$this` variable, which were removed in PHP 7.1. [#762](https://github.com/PHPCompatibility/PHPCompatibility/pull/762), [#771](https://github.com/PHPCompatibility/PHPCompatibility/pull/771). Fixes [#262](https://github.com/PHPCompatibility/PHPCompatibility/issues/262) and [#740](https://github.com/PHPCompatibility/PHPCompatibility/issues/740). +- :star: `NewClasses`: detection of more native PHP Exceptions. [#743](https://github.com/PHPCompatibility/PHPCompatibility/pull/743), [#753](https://github.com/PHPCompatibility/PHPCompatibility/pull/753) +- :star: `NewConstants` : detection of the new PHP 7.3 Curl, Stream Crypto and LDAP constants and some more PHP 7.0 Tokenizer constants. [#752](https://github.com/PHPCompatibility/PHPCompatibility/pull/752), [#767](https://github.com/PHPCompatibility/PHPCompatibility/pull/767), [#778](https://github.com/PHPCompatibility/PHPCompatibility/pull/778) +- :star: `NewFunctions` sniff: recognize (more) new LDAP functions as introduced in PHP 7.3. [#768](https://github.com/PHPCompatibility/PHPCompatibility/pull/768) +- :star: `NewFunctionParameters` sniff: recognize the new `$serverctrls` parameter which was added to a number of LDAP functions in PHP 7.3. [#769](https://github.com/PHPCompatibility/PHPCompatibility/pull/769) +- :star: `NewIniDirectives` sniff: recognize the new `imap.enable_insecure_rsh` ini directive as introduced in PHP 7.1.25, 7.2.13 and 7.3.0. [#770](https://github.com/PHPCompatibility/PHPCompatibility/pull/770) +- :star: `NewInterfaces` sniff: recognize two more Session related interfaces which were introduced in PHP 5.5.1 and 7.0 respectively. [#748](https://github.com/PHPCompatibility/PHPCompatibility/pull/748) +- :star: Duplicate of upstream `findStartOfStatement()` method to the `PHPCompatibility\PHPCSHelper` class to allow for PHPCS cross-version usage of that method. [#750](https://github.com/PHPCompatibility/PHPCompatibility/pull/750) + +### Changed +- :pushpin: `RemovedPHP4StyleConstructors`: will now also detect PHP4-style constructors when declared in interfaces. [#751](https://github.com/PHPCompatibility/PHPCompatibility/pull/751) +- :pushpin: `Sniff::validDirectScope()`: the return value of this method has changed. Previously it would always be a boolean. It will stil return `false` when no valid direct scope has been found, but it will now return the `stackPtr` to the scope token if a _valid_ direct scope was encountered. [#758](https://github.com/PHPCompatibility/PHPCompatibility/pull/758) +- :rewind: `NewOperators` : updated the version number for `T_COALESCE_EQUAL`. [#746](https://github.com/PHPCompatibility/PHPCompatibility/pull/746) +- :pencil: Minor improvement to an error message in the unit test suite. [#742](https://github.com/PHPCompatibility/PHPCompatibility/pull/742) +- :recycle: Various code clean-up and improvements. [#745](https://github.com/PHPCompatibility/PHPCompatibility/pull/745), [#756](https://github.com/PHPCompatibility/PHPCompatibility/pull/756), [#774](https://github.com/PHPCompatibility/PHPCompatibility/pull/774) +- :recycle: Various minor inline documentation fixes. [#749](https://github.com/PHPCompatibility/PHPCompatibility/pull/749), [#757](https://github.com/PHPCompatibility/PHPCompatibility/pull/757) +- :umbrella: Improved code coverage recording. [#744](https://github.com/PHPCompatibility/PHPCompatibility/pull/744), [#776](https://github.com/PHPCompatibility/PHPCompatibility/pull/776) +- :green_heart: Travis: build tests are now being run against PHP 7.3 as well. [#511](https://github.com/PHPCompatibility/PHPCompatibility/pull/511) + Note: full PHP 7.3 support is only available in combination with PHP_CodeSniffer 2.9.2 or 3.3.1+ due to an incompatibility within PHP_CodeSniffer itself. + +### Fixed +- :white_check_mark: Compatibility with the upcoming release of PHPCS 3.4.0. Deal with changed behaviour of the PHPCS `Tokenizer` regarding binary type casts. [#760](https://github.com/PHPCompatibility/PHPCompatibility/pull/760) +- :bug: `InternalInterfaces`: false negative for implemented/extended interfaces prefixed with a namespace separator. [#775](https://github.com/PHPCompatibility/PHPCompatibility/pull/775) +- :bug: `NewClasses`: the introduction version of various native PHP Exceptions has been corrected. [#743](https://github.com/PHPCompatibility/PHPCompatibility/pull/743), [#753](https://github.com/PHPCompatibility/PHPCompatibility/pull/753) +- :bug: `NewInterfaces`: false negative for implemented/extended interfaces prefixed with a namespace separator. [#775](https://github.com/PHPCompatibility/PHPCompatibility/pull/775) +- :bug: `RemovedPHP4StyleConstructors`: the sniff would examine methods in nested anonymous classes as if they were methods of the higher level class. [#751](https://github.com/PHPCompatibility/PHPCompatibility/pull/751) +- :rewind: `RemovedPHP4StyleConstructors`: the sniff will no longer throw false positives for the first method in an anonymous class when used in combination with PHPCS 2.3.x. [#751](https://github.com/PHPCompatibility/PHPCompatibility/pull/751) +- :rewind: `ReservedFunctionNames`: fixed incorrect error message text for methods in anonymous classes when used in combination with PHPCS 2.3.x. [#755](https://github.com/PHPCompatibility/PHPCompatibility/pull/755) +- :bug: `ReservedFunctionNames`: prevent duplicate errors being thrown for methods in nested anonymous classes. [#755](https://github.com/PHPCompatibility/PHPCompatibility/pull/755) +- :bug: `PHPCSHelper::findEndOfStatement()`: minor bug fix. [#749](https://github.com/PHPCompatibility/PHPCompatibility/pull/749) +- :bug: `Sniff::isClassProperty()`: class properties for classes nested in conditions or function calls were not always recognized as class properties. [#758](https://github.com/PHPCompatibility/PHPCompatibility/pull/758) + +### Credits +Thanks go out to [Jonathan Champ] for his contribution to this version. :clap: + + +## [9.0.0] - 2018-10-07 + +**IMPORTANT**: This release contains **breaking changes**. Please read the below information carefully before upgrading! + +All sniffs have been placed in meaningful categories and a number of sniffs have been renamed to have more consistent, meaningful and future-proof names. + +Both the `PHPCompatibilityJoomla` [[GH](https://github.com/PHPCompatibility/PHPCompatibilityJoomla) | [Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-joomla)] as well as the `PHPCompatibilityWP` [[GH](https://github.com/PHPCompatibility/PHPCompatibilityWP)|[Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-wp)] rulesets have already been adjusted for this change and have released a new version which is compatible with this version of PHPCompatibility. + +Aside from those CMS-based rulesets, this project now also offers a number of polyfill-library specific rulesets, such as `PHPCompatibilityPasswordCompat` [[GH](https://github.com/PHPCompatibility/PHPCompatibilityPasswordCompat) | [Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-passwordcompat)] for @ircmaxell's [`password_compat`](https://github.com/ircmaxell/password_compat) libary, `PHPCompatibilityParagonieRandomCompat` and `PHPCompatibilityParagonieSodiumCompat` [[GH](https://github.com/PHPCompatibility/PHPCompatibilityParagonie)|[Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-paragonie)] for the [Paragonie polyfills](https://github.com/paragonie?utf8=?&q=polyfill) and a number of rulesets related to various [polyfills offered by the Symfony project](https://github.com/symfony?utf8=?&q=polyfill) [[GH](https://github.com/PHPCompatibility/PHPCompatibilitySymfony)|[Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-symfony)]. + +If your project uses one of these polyfills, please consider using these special polyfill rulesets to prevent false positives. + +Also as of this version, [Juliette Reinders Folmer] is now officially a co-maintainer of this package. + +### Upgrade instructions + +* If you have `<exclude name="..."/>` directives in your own project's custom ruleset which relate to sniffs from the PHPCompatibility library, you will need to update your ruleset to use the new sniff names. +* If you use the new [PHPCS 3.2+ inline annotations](https://github.com/squizlabs/PHP_CodeSniffer/releases/3.2.0), i.e. `// phpcs:ignore Standard.Category.SniffName`, in combination with PHPCompatibility sniff names, you will need to update these annotations. +* If you use neither of the above, you should be fine and upgrading should be painless. + +### Overview of all the sniff renames: + +Old Category.SniffName | New Category.SniffName +--- | --- +**PHP**.ArgumentFunctionsUsage | **FunctionUse**.ArgumentFunctionsUsage +**PHP**.CaseSensitiveKeywords | **Keywords**.CaseSensitiveKeywords +**PHP**.ConstantArraysUsingConst | **InitialValue**.**New**ConstantArraysUsingConst +**PHP**.ConstantArraysUsingDefine | **InitialValue**.**New**ConstantArraysUsingDefine +**PHP**.**Deprecated**Functions | **FunctionUse**.**Removed**Functions +**PHP**.**Deprecated**IniDirectives | **IniDirectives**.**Removed**IniDirectives +**PHP**.**Deprecated**MagicAutoload | **FunctionNameRestrictions**.**Removed**MagicAutoload +**PHP**.**Deprecated**NewReference | **Syntax**.**Removed**NewReference +**PHP**.**Deprecated**PHP4StyleConstructors | **FunctionNameRestrictions**.**Removed**PHP4StyleConstructors +**PHP**.**Deprecated**TypeCasts | **TypeCasts**.**Removed**TypeCasts +**PHP**.DiscouragedSwitchContinue | **ControlStructures**.DiscouragedSwitchContinue +**PHP**.DynamicAccessToStatic | **Syntax**.**New**DynamicAccessToStatic +**PHP**.EmptyNonVariable | **LanguageConstructs**.**New**EmptyNonVariable +**PHP**.ForbiddenBreakContinueOutsideLoop | **ControlStructures**.ForbiddenBreakContinueOutsideLoop +**PHP**.ForbiddenBreakContinueVariableArguments | **ControlStructures**.ForbiddenBreakContinueVariableArguments +**PHP**.ForbiddenCallTimePassByReference | **Syntax**.ForbiddenCallTimePassByReference +**PHP**.Forbidden**ClosureUseVariableNames** | **FunctionDeclarations**.Forbidden**VariableNamesInClosureUse** +**PHP**.ForbiddenEmptyListAssignment | **Lists**.ForbiddenEmptyListAssignment +**PHP**.Forbidden**Function**ParametersWithSameName | **FunctionDeclarations**.ForbiddenParametersWithSameName +**PHP**.ForbiddenGlobalVariableVariable | **Variables**.ForbiddenGlobalVariableVariable +**PHP**.ForbiddenNames | **Keywords**.ForbiddenNames +**PHP**.ForbiddenNamesAsDeclared | **Keywords**.ForbiddenNamesAsDeclared +**PHP**.ForbiddenNamesAsInvokedFunctions | **Keywords**.ForbiddenNamesAsInvokedFunctions +**PHP**.ForbiddenNegativeBitshift | **Operators**.ForbiddenNegativeBitshift +**PHP**.ForbiddenSwitchWithMultipleDefaultBlocks | **ControlStructures**.ForbiddenSwitchWithMultipleDefaultBlocks +**PHP**.InternalInterfaces | **Interfaces**.InternalInterfaces +**PHP**.LateStaticBinding | **Classes**.**New**LateStaticBinding +**PHP**.**MbstringReplaceE**Modifier | **ParameterValues**.**RemovedMbstring**Modifier**s** +**PHP**.NewAnonymousClasses | **Classes**.NewAnonymousClasses +**PHP**.NewArrayStringDereferencing | **Syntax**.NewArrayStringDereferencing +**PHP**.NewClasses | **Classes**.NewClasses +**PHP**.NewClassMemberAccess | **Syntax**.NewClassMemberAccess +**PHP**.NewClosure | **FunctionDeclarations**.NewClosure +**PHP**.NewConstants | **Constants**.NewConstants +**PHP**.NewConstantScalarExpressions | **InitialValue**.NewConstantScalarExpressions +**PHP**.NewConstVisibility | **Classes**.NewConstVisibility +**PHP**.NewExecutionDirectives | **ControlStructures**.NewExecutionDirectives +**PHP**.NewFunctionArrayDereferencing | **Syntax**.NewFunctionArrayDereferencing +**PHP**.NewFunctionParameters | **FunctionUse**.NewFunctionParameters +**PHP**.NewFunctions | **FunctionUse**.NewFunctions +**PHP**.NewGeneratorReturn | **Generators**.NewGeneratorReturn +**PHP**.NewGroupUseDeclarations | **UseDeclarations**.NewGroupUseDeclarations +**PHP**.NewHashAlgorithms | **ParameterValues**.NewHashAlgorithms +**PHP**.NewHeredoc**Initialize** | **InitialValue**.NewHeredoc +**PHP**.NewIniDirectives | **IniDirectives**.NewIniDirectives +**PHP**.NewInterfaces | **Interfaces**.NewInterfaces +**PHP**.NewKeywords | **Keywords**.NewKeywords +**PHP**.NewLanguageConstructs | **LanguageConstructs**.NewLanguageConstructs +**PHP**.NewMagicClassConstant | **Constants**.NewMagicClassConstant +**PHP**.NewMagicMethods | **FunctionNameRestrictions**.NewMagicMethods +**PHP**.NewMultiCatch | **ControlStructures**.NewMultiCatch +**PHP**.NewNullableTypes | **FunctionDeclarations**.NewNullableTypes +**PHP**.NewReturnTypeDeclarations | **FunctionDeclarations**.NewReturnTypeDeclarations +**PHP**.New**Scalar**TypeDeclarations | **FunctionDeclarations**.New**Param**TypeDeclarations +**PHP**.NewTrailingComma | **Syntax**.New**FunctionCall**TrailingComma +**PHP**.NewTypeCasts | **TypeCasts**.NewTypeCasts +**PHP**.NewUseConstFunction | **UseDeclarations**.NewUseConstFunction +**PHP**.NonStaticMagicMethods | **FunctionDeclarations**.NonStaticMagicMethods +**PHP**.OptionalRequiredFunctionParameters | **FunctionUse**.Optional**To**RequiredFunctionParameters +**PHP**.ParameterShadowSuperGlobals | **FunctionDeclarations**.**Forbidden**ParameterShadowSuperGlobals +**PHP**.**PCRENew**Modifiers | **ParameterValues**.**NewPCRE**Modifiers +**PHP**.**PregReplaceE**Modifier | **ParameterValues**.**RemovedPCRE**Modifier**s** +**PHP**.RemovedAlternativePHPTags | **Miscellaneous**.RemovedAlternativePHPTags +**PHP**.RemovedConstants | **Constants**.RemovedConstants +**PHP**.RemovedExtensions | **Extensions**.RemovedExtensions +**PHP**.RemovedFunctionParameters | **FunctionUse**.RemovedFunctionParameters +**PHP**.RemovedGlobalVariables | **Variables**.Removed**Predefined**GlobalVariables +**PHP**.RemovedHashAlgorithms | **ParameterValues**.RemovedHashAlgorithms +**PHP**.ReservedFunctionNames | **FunctionNameRestrictions**.ReservedFunctionNames +**PHP**.RequiredOptionalFunctionParameters | **FunctionUse**.Required**To**OptionalFunctionParameters +**PHP**.ShortArray | **Syntax**.**New**ShortArray +**PHP**.Ternary**Operators** | **Operators**.**NewShort**Ternary +**PHP**.ValidIntegers | **Miscellaneous**.ValidIntegers +**PHP**.**VariableVariables** | **Variables**.**NewUniformVariableSyntax** + +### Changelog for version 9.0.0 + +See all related issues and PRs in the [9.0.0 milestone]. + +### Added +- :star2: New `PHPCompatibility.ControlStructures.NewForeachExpressionReferencing` sniff to detect referencing of `$value` within a `foreach()` when the iterated array is not a variable. This was not supported prior to PHP 5.5. [#664](https://github.com/PHPCompatibility/PHPCompatibility/pull/664) +- :star2: New `PHPCompatibility.ControlStructures.NewListInForeach` sniff to detect unpacking nested arrays into separate variables via the `list()` construct in a `foreach()` statement. This was not supported prior to PHP 5.5. [#657](https://github.com/PHPCompatibility/PHPCompatibility/pull/657) +- :star2: New `PHPCompatibility.FunctionNameRestrictions.RemovedNamespacedAssert` sniff to detect declaring a function called `assert()` within a namespace. This has been deprecated as of PHP 7.3. [#735](https://github.com/PHPCompatibility/PHPCompatibility/pull/735). Partially fixes [#718](https://github.com/PHPCompatibility/PHPCompatibility/issues/718). +- :star2: New `PHPCompatibility.Lists.AssignmentOrder` sniff to detect `list()` constructs affected by the change in assignment order in PHP 7.0. [#656](https://github.com/PHPCompatibility/PHPCompatibility/pull/656) +- :star2: New `PHPCompatibility.Lists.NewKeyedList` sniff to detect usage of keys in `list()`, support for which was added in PHP 7.1. [#655](https://github.com/PHPCompatibility/PHPCompatibility/pull/655). Fixes [#252](https://github.com/PHPCompatibility/PHPCompatibility/issues/252). +- :star2: New `PHPCompatibility.Lists.NewListReferenceAssignment` sniff to detect reference assignments being used in `list()` constructs, support for which has been added in PHP 7.3. [#731](https://github.com/PHPCompatibility/PHPCompatibility/pull/731) +- :star2: New `PHPCompatibility.Lists.NewShortList` sniff to detect the shorthand array syntax `[]` being used for symmetric array destructuring as introduced in PHP 7.1. [#654](https://github.com/PHPCompatibility/PHPCompatibility/pull/654). Fixes [#248](https://github.com/PHPCompatibility/PHPCompatibility/issues/248). +- :star2: New `PHPCompatibility.Operators.NewOperators` sniff which checks for usage of the pow, pow equals, spaceship and coalesce (equals) operators. [#738](https://github.com/PHPCompatibility/PHPCompatibility/pull/738) + These checks were previously contained within the `PHPCompatibility.LanguageConstructs.NewLanguageConstructs` sniff. +- :star2: New `PHPCompatibility.ParameterValues.ForbiddenGetClassNull` sniff to detect `null` being passed to `get_class()`, support for which has been removed in PHP 7.2 [#659](https://github.com/PHPCompatibility/PHPCompatibility/pull/659). Fixes [#557](https://github.com/PHPCompatibility/PHPCompatibility/issues/557). +- :star2: New `PHPCompatibility.ParameterValues.NewArrayReduceInitialType` sniff to detect non-integers being passed as the `$initial` parameter to the `array_reduce()` function, which was not supported before PHP 5.3. [#666](https://github.com/PHPCompatibility/PHPCompatibility/pull/666). Fixes [#649](https://github.com/PHPCompatibility/PHPCompatibility/issues/649) +- :star2: New `PHPCompatibility.ParameterValues.NewFopenModes` sniff to examine the `$mode` parameter passed to `fopen()` for modes not available in older PHP versions. [#658](https://github.com/PHPCompatibility/PHPCompatibility/pull/658) +- :star2: New `PHPCompatibility.ParameterValues.NewNegativeStringOffset` sniff to detect negative string offsets being passed to string manipulation functions which was not supported before PHP 7.1. [#662](https://github.com/PHPCompatibility/PHPCompatibility/pull/662). Partially fixes [#253](https://github.com/PHPCompatibility/PHPCompatibility/issues/253). +- :star2: New `PHPCompatibility.ParameterValues.NewPackFormats` sniff to examine the `$format` parameter passed to `pack()` for formats not available in older PHP versions. [#665](https://github.com/PHPCompatibility/PHPCompatibility/pull/665) +- :star2: New `PHPCompatibility.ParameterValues.RemovedIconvEncoding` sniff to detect the PHP 5.6 deprecated encoding `$type`s being passed to `iconv_set_encoding()`. [#660](https://github.com/PHPCompatibility/PHPCompatibility/pull/660). Fixes [#475](https://github.com/PHPCompatibility/PHPCompatibility/issues/475). +- :star2: New `PHPCompatibility.ParameterValues.RemovedNonCryptoHashes` sniff to detect non-cryptographic hash algorithms being passed to various `hash_*()` functions. This is no longer accepted as of PHP 7.2. [#663](https://github.com/PHPCompatibility/PHPCompatibility/pull/663). Fixes [#559](https://github.com/PHPCompatibility/PHPCompatibility/issues/559) +- :star2: New `PHPCompatibility.ParameterValues.RemovedSetlocaleString` sniff to detect string literals being passed to the `$category` parameter of the `setlocale()` function. This behaviour was deprecated in PHP 4.2 and support has been removed in PHP 7.0. [#661](https://github.com/PHPCompatibility/PHPCompatibility/pull/661) +- :star2: New `PHPCompatibility.Syntax.NewFlexibleHeredocNowdoc` sniff to detect the new heredoc/nowdoc format as allowed as of PHP 7.3. [#736](https://github.com/PHPCompatibility/PHPCompatibility/pull/736). Fixes [#705](https://github.com/PHPCompatibility/PHPCompatibility/issues/705). + Note: This sniff is only supported in combination with PHP_CodeSniffer 2.6.0 and higher. +- :star: `PHPCompatibility.Classes.NewClasses` sniff: recognize the new `CompileError` and `JsonException` classes as introduced in PHP 7.3. [#676](https://github.com/PHPCompatibility/PHPCompatibility/pull/676) +- :star: `PHPCompatibility.Constants.NewConstants` sniff: recognize new constants which are being introduced in PHP 7.3. [#678](https://github.com/PHPCompatibility/PHPCompatibility/pull/678) +- :star: `PHPCompatibility.Constants.RemovedConstants` sniff: recognize constants which have been deprecated or removed in PHP 7.3. [#710](https://github.com/PHPCompatibility/PHPCompatibility/pull/710). Partially fixes [#718](https://github.com/PHPCompatibility/PHPCompatibility/issues/718). +- :star: `PHPCompatibility.FunctionUse.NewFunctions` sniff: recognize various new functions being introduced in PHP 7.3. [#679](https://github.com/PHPCompatibility/PHPCompatibility/pull/679) +- :star: `PHPCompatibility.FunctionUse.NewFunctions` sniff: recognize the `sapi_windows_*()`, `hash_hkdf()` and `pcntl_signal_get_handler()` functions as introduced in PHP 7.1. [#728](https://github.com/PHPCompatibility/PHPCompatibility/pull/728) +- :star: `PHPCompatibility.FunctionUse.RemovedFunctionParameters` sniff: recognize the deprecation of the `$case_insensitive` parameter for the `define()` function in PHP 7.3. [#706](https://github.com/PHPCompatibility/PHPCompatibility/pull/706) +- :star: `PHPCompatibility.FunctionUse.RemovedFunctions` sniff: recognize the PHP 7.3 deprecation of the `image2wbmp()`, `fgetss()` and `gzgetss()` functions, as well as the deprecation of undocumented Mbstring function aliases. [#681](https://github.com/PHPCompatibility/PHPCompatibility/pull/681), [#714](https://github.com/PHPCompatibility/PHPCompatibility/pull/714), [#720](https://github.com/PHPCompatibility/PHPCompatibility/pull/720). Partially fixes [#718](https://github.com/PHPCompatibility/PHPCompatibility/issues/718). +- :star: `PHPCompatibility.FunctionUse.RequiredToOptionalFunctionParameters` sniff: account for the second parameter for `array_push()` and `array_unshift()` becoming optional in PHP 7.3, as well as for the `$mode` parameter for a range of `ftp_*()` functions becoming optional. [#680](https://github.com/PHPCompatibility/PHPCompatibility/pull/680) +- :star: `PHPCompatibility.IniDirectives.NewIniDirectives` sniff: recognize new `syslog` and `session` ini directives as introduced in PHP 7.3. [#702](https://github.com/PHPCompatibility/PHPCompatibility/pull/702), [#719](https://github.com/PHPCompatibility/PHPCompatibility/pull/719), [#730](https://github.com/PHPCompatibility/PHPCompatibility/pull/730) +- :star: `PHPCompatibility.IniDirectives.NewIniDirectives` sniff: recognize some more ini directives which were introduced in PHP 7.1. [#727](https://github.com/PHPCompatibility/PHPCompatibility/pull/727) +- :star: `PHPCompatibility.IniDirectives.RemovedIniDirectived` sniff: recognize ini directives removed in PHP 7.3. [#677](https://github.com/PHPCompatibility/PHPCompatibility/pull/677), [#717](https://github.com/PHPCompatibility/PHPCompatibility/pull/717). Partially fixes [#718](https://github.com/PHPCompatibility/PHPCompatibility/issues/718). +- :star: New `isNumericCalculation()` and `isVariable()` utility methods to the `PHPCompatibility\Sniff` class. [#664](https://github.com/PHPCompatibility/PHPCompatibility/pull/664), [#666](https://github.com/PHPCompatibility/PHPCompatibility/pull/666) +- :books: A section about the new sniff naming conventions to the `Contributing` file. [#738](https://github.com/PHPCompatibility/PHPCompatibility/pull/738) + +### Changed +- :fire: All sniffs have been placed in meaningful categories and a number of sniffs have been renamed to have more consistent, meaningful and future-proof names. [#738](https://github.com/PHPCompatibility/PHPCompatibility/pull/738). Fixes [#601](https://github.com/PHPCompatibility/PHPCompatibility/issues/601), [#692](https://github.com/PHPCompatibility/PHPCompatibility/issues/692) + See the table at the top of this changelog for details of all the file renames. +- :umbrella: The unit test files have been moved about as well. [#738](https://github.com/PHPCompatibility/PHPCompatibility/pull/738) + * The directory structure for these now mirrors the default directory structure used by PHPCS itself. + * The file names of the unit test files have been adjusted for the changes made in the sniffs. + * The unit test case files have been renamed and moved to the same directory as the actual test file they apply to. + * The `BaseSniffTest::sniffFile()` method has been adjusted to match. The signature of this method has changed. Where it previously expected a relative path to the unit test case file, it now expects an absolute path. + * The unit tests for the utility methods in the `PHPCompatibility\Sniff` class have been moved to a new `PHPCompatibility\Util\Tests\Core` subdirectory. + * The bootstrap file used for PHPUnit has been moved to the project root directory and renamed `phpunit-bootstrap.php`. +- :twisted_rightwards_arrows: The `PHPCompatibility.LanguageConstructs.NewLanguageConstructs` sniff has been split into two sniffs. [#738](https://github.com/PHPCompatibility/PHPCompatibility/pull/738) + The `PHPCompatibility.LanguageConstructs.NewLanguageConstructs` sniff now contains just the checks for the namespace separator and the ellipsis. + The new `PHPCompatibility.Operators.NewOperators` sniff now contains the checks regarding the pow, pow equals, spaceship and coalesce (equals) operators. +- :pushpin: The `PHPCompatibility.ParameterValues.RemovedMbstringModifiers` sniff will now also recognize removed regex modifiers when used within a function call to one of the undocumented Mbstring function aliases for the Mbstring regex functions. [#715](https://github.com/PHPCompatibility/PHPCompatibility/pull/715) +- :pushpin: The `PHPCompatibility\Sniff::getFunctionCallParameter()` utility method now allows for closures called via a variable. [#723](https://github.com/PHPCompatibility/PHPCompatibility/pull/723) +- :pencil2: `PHPCompatibility.Upgrade.LowPHPCS`: the minimum supported PHPCS version is now 2.3.0. [#699](https://github.com/PHPCompatibility/PHPCompatibility/pull/699) +- :pencil2: Minor inline documentation improvements. [#738](https://github.com/PHPCompatibility/PHPCompatibility/pull/738) +- :umbrella: Minor improvements to the unit tests for the `PHPCompatibility.FunctionNameRestrctions.RemovedMagicAutoload` sniff. [#716](https://github.com/PHPCompatibility/PHPCompatibility/pull/716) +- :recycle: Minor other optimizations. [#698](https://github.com/PHPCompatibility/PHPCompatibility/pull/698), [#697](https://github.com/PHPCompatibility/PHPCompatibility/pull/697) +- :wrench: Minor improvements to the build tools. [#701](https://github.com/PHPCompatibility/PHPCompatibility/pull/701) +- :wrench: Removed some unnecessary inline annotations. [#700](https://github.com/PHPCompatibility/PHPCompatibility/pull/700) +- :books: Replaced some of the badges in the Readme file. [#721](https://github.com/PHPCompatibility/PHPCompatibility/pull/721), [#722](https://github.com/PHPCompatibility/PHPCompatibility/pull/722) +- :books: Composer: updated the list of package authors. [#739](https://github.com/PHPCompatibility/PHPCompatibility/pull/739) + +### Removed +- :no_entry_sign: Support for PHP_CodeSniffer 1.x and low 2.x versions. The new minimum version of PHP_CodeSniffer to be able to use this library is 2.3.0. [#699](https://github.com/PHPCompatibility/PHPCompatibility/pull/699). Fixes [#691](https://github.com/PHPCompatibility/PHPCompatibility/issues/691). + The minimum _recommended_ version of PHP_CodeSniffer remains the same, i.e. 2.6.0. +- :no_entry_sign: The `\PHPCompatibility\Sniff::inUseScope()` method has been removed as it is no longer needed now support for PHPCS 1.x has been dropped. [#699](https://github.com/PHPCompatibility/PHPCompatibility/pull/699) +- :no_entry_sign: Composer: The `autoload` section has been removed from the `composer.json` file. [#738](https://github.com/PHPCompatibility/PHPCompatibility/pull/738). Fixes [#568](https://github.com/PHPCompatibility/PHPCompatibility/issues/568). + Autoloading for this library is done via the PHP_CodeSniffer default mechanism, enhanced with our own autoloader, so the Composer autoloader shouldn't be needed and was causing issues in a particular use-case. + +### Fixed +- :bug: `PHPCompatibility.FunctionUse.NewFunctionParameters` sniff: The new `$mode` parameter of the `php_uname()` function was added in PHP 4.3, not in PHP 7.0 as was previously being reported. + The previous implementation of this check was based on an error in the PHP documentation. The error in the PHP documentation has been rectified and the sniff has followed suit. [#711](https://github.com/PHPCompatibility/PHPCompatibility/pull/711) +- :bug: `PHPCompatibility.Generators.NewGeneratorReturn` sniff: The sniff would throw false positives for `return` statements in nested constructs and did not correctly detect the scope which should be examined. [#725](https://github.com/PHPCompatibility/PHPCompatibility/pull/725). Fixes [#724](https://github.com/PHPCompatibility/PHPCompatibility/pull/724). +- :bug: `PHPCompatibility.Keywords.NewKeywords` sniff: PHP magic constants are case _in_sensitive. This sniff now accounts for this. [#707](https://github.com/PHPCompatibility/PHPCompatibility/pull/707) +- :bug: Various bugs in the `PHPCompatibility.Syntax.ForbiddenCallTimePassByReference` sniff [#723](https://github.com/PHPCompatibility/PHPCompatibility/pull/723): + - Closures called via a variable will now also be examined. (false negative) + - References within arrays/closures passed as function call parameters would incorrectly trigger an error. (false positive) +- :green_heart: Compatibility with PHPUnit 7.2. [#712](https://github.com/PHPCompatibility/PHPCompatibility/pull/712) + +### Credits +Thanks go out to [Jonathan Champ] for his contribution to this version. :clap: + + +## [8.2.0] - 2018-07-17 + +See all related issues and PRs in the [8.2.0 milestone]. + +### Important changes + +#### The repository has moved +As of July 13 2018, the PHPCompatibility repository has moved from the personal account of Wim Godden `wimg` to its own organization `PHPCompatibility`. +Composer users are advised to update their `composer.json`. The dependency is now called `phpcompatibility/php-compatibility`. + +#### Framework/CMS specific PHPCompatibility rulesets +Within this new organization, hosting will be offered for framework/CMS specific PHPCompatibility rulesets. + +The first two such repositories have been created and are now available for use: +* PHPCompatibilityJoomla [GitHub](https://github.com/PHPCompatibility/PHPCompatibilityJoomla)|[Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-joomla) +* PHPCompatibilityWP [GitHub](https://github.com/PHPCompatibility/PHPCompatibilityWP)|[Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-wp) + +If you want to make sure you have all PHPCompatibility rulesets available at any time, you can use the PHPCompatibilityAll package [GitHub](https://github.com/PHPCompatibility/PHPCompatibilityAll)|[Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-all). + +For more information, see the [Readme](https://github.com/PHPCompatibility/PHPCompatibility#using-a-frameworkcms-specific-ruleset) and [Contributing guidelines](https://github.com/PHPCompatibility/PHPCompatibility/blob/master/.github/CONTRIBUTING.md#frameworkcms-specific-rulesets). + +#### Changes expected in PHPCompatibility 9.0.0 +The next version of PHPCompatibility will include a major directory layout restructuring which means that the sniff codes of all sniffs will change. + +In this same release, support for PHP_CodeSniffer 1.5.x will be dropped. The new minimum supported PHPCS version will be 2.3.0. + +For more information about these upcoming changes, please read the [announcement](https://github.com/PHPCompatibility/PHPCompatibility/issues/688). + +The `9.0.0` release is expected to be ready later this summer. + + +### Added +- :star2: New `ArgumentFunctionsUsage` sniff to detect usage of the `func_get_args()`, `func_get_arg()` and `func_num_args()` functions and the changes regarding these functions introduced in PHP 5.3. [#596](https://github.com/PHPCompatibility/PHPCompatibility/pull/596). Fixes [#372](https://github.com/PHPCompatibility/PHPCompatibility/issues/372). +- :star2: New `DiscouragedSwitchContinue` sniff to detect `continue` targetting a `switch` control structure for which `E_WARNINGS` will be thrown as of PHP 7.3. [#687](https://github.com/PHPCompatibility/PHPCompatibility/pull/687) +- :star2: New `NewClassMemberAccess` sniff to detect class member access on instantiation as added in PHP 5.4 and class member access on cloning as added in PHP 7.0. [#619](https://github.com/PHPCompatibility/PHPCompatibility/pull/619). Fixes [#53](https://github.com/PHPCompatibility/PHPCompatibility/issues/53). +- :star2: New `NewConstantScalarExpressions` sniff to detect PHP 5.6 scalar expression in contexts where PHP previously only allowed static values. [#617](https://github.com/PHPCompatibility/PHPCompatibility/pull/617). Fixes [#399](https://github.com/PHPCompatibility/PHPCompatibility/issues/399). +- :star2: New `NewGeneratorReturn` sniff to detect `return` statements within generators as introduced in PHP 7.0. [#618](https://github.com/PHPCompatibility/PHPCompatibility/pull/618) +- :star2: New `PCRENewModifiers` sniff to initially detect the new `J` regex modifier as introduced in PHP 7.2. [#600](https://github.com/PHPCompatibility/PHPCompatibility/pull/600). Fixes [#556](https://github.com/PHPCompatibility/PHPCompatibility/issues/556). +- :star2: New `ReservedFunctionNames` sniff to report on double underscore prefixed functions and methods. This was previously reported via an upstream sniff. [#581](https://github.com/PHPCompatibility/PHPCompatibility/pull/581) +- :star2: New `NewTrailingComma` sniff to detect trailing comma's in function calls, method calls, `isset()` and `unset()` as will be introduced in PHP 7.3. [#632](https://github.com/PHPCompatibility/PHPCompatibility/pull/632) +- :star2: New `Upgrade/LowPHPCS` sniff to give users of old PHP_CodeSniffer versions advance warning when support will be dropped in the near future. [#693](https://github.com/PHPCompatibility/PHPCompatibility/pull/693) +- :star: `NewClasses` sniff: check for some 40+ additional PHP native classes added in various PHP versions. [#573](https://github.com/PHPCompatibility/PHPCompatibility/pull/573) +- :star: `NewClosure` sniff: check for usage of `self`/`parent`/`static::` being used within closures, support for which was only added in PHP 5.4. [#669](https://github.com/PHPCompatibility/PHPCompatibility/pull/669). Fixes [#668](https://github.com/PHPCompatibility/PHPCompatibility/pull/668). +- :star: `NewConstants` sniff: recognize constants added by the PHP 5.5+ password extension. [#626](https://github.com/PHPCompatibility/PHPCompatibility/pull/626) +- :star: `NewFunctionParameters` sniff: recognize a number of additional function parameters added in PHP 7.0, 7.1 and 7.2. [#602](https://github.com/PHPCompatibility/PHPCompatibility/pull/602) +- :star: `NewFunctions` sniff: recognize the PHP 5.1 SPL extension functions, the PHP 5.1.1 `hash_hmac()` function, the PHP 5.6 `pg_lo_truncate()` function, more PHP 7.2 Sodium functions and the new PHP 7.3 `is_countable()` function. [#606](https://github.com/PHPCompatibility/PHPCompatibility/pull/606), [#625](https://github.com/PHPCompatibility/PHPCompatibility/pull/625), [#640](https://github.com/PHPCompatibility/PHPCompatibility/pull/640), [#651](https://github.com/PHPCompatibility/PHPCompatibility/pull/651) +- :star: `NewHashAlgorithms` sniff: recognize the new hash algorithms which were added in PHP 7.1. [#599](https://github.com/PHPCompatibility/PHPCompatibility/pull/599) +- :star: `NewInterfaces` sniff: check for the PHP 5.0 `Reflector` interface. [#572](https://github.com/PHPCompatibility/PHPCompatibility/pull/572) +- :star: `OptionalRequiredFunctionParameters` sniff: detect missing `$salt` parameter in calls to the `crypt()` function (PHP 5.6+). [#605](https://github.com/PHPCompatibility/PHPCompatibility/pull/605) +- :star: `RequiredOptionalFunctionParameters` sniff: recognize that the `$varname` parameter of `getenv()` and the `$scale` parameter of `bcscale()` have become optional as of PHP 7.1 and 7.3 respectively. [#598](https://github.com/PHPCompatibility/PHPCompatibility/pull/598), [#612](https://github.com/PHPCompatibility/PHPCompatibility/pull/612) +- :star: New `AbstractFunctionCallParameterSniff` to be used as a basis for sniffs examining function call parameters. [#636](https://github.com/PHPCompatibility/PHPCompatibility/pull/636) +- :star: New `getReturnTypeHintName()` utility method to the `PHPCompatibility\Sniff` class. [#578](https://github.com/PHPCompatibility/PHPCompatibility/pull/578), [#642](https://github.com/PHPCompatibility/PHPCompatibility/pull/642) +- :star: New `isNumber()`, `isPositiveNumber()` and `isNegativeNumber()` utility methods to the `PHPCompatibility\Sniff` class. [#610](https://github.com/PHPCompatibility/PHPCompatibility/pull/610), [#650](https://github.com/PHPCompatibility/PHPCompatibility/pull/650) +- :star: New `isShortList()` utility method to the `PHPCompatibility\Sniff` class. [#635](https://github.com/PHPCompatibility/PHPCompatibility/pull/635) +- :star: New `getCommandLineData()` method to the `PHPCompatibility\PHPCSHelper` class to provide PHPCS cross-version compatible access to command line info at run time. [#693](https://github.com/PHPCompatibility/PHPCompatibility/pull/693) +- :star: Duplicate of upstream `findEndOfStatement()` method to the `PHPCompatibility\PHPCSHelper` class to allow for PHPCS cross-version usage of that method. [#614](https://github.com/PHPCompatibility/PHPCompatibility/pull/614) +- :umbrella: additional unit test to confirm that the `PHPCompatibility\Sniff::isUseOfGlobalConstant()` method handles multi-constant declarations correctly. [#587](https://github.com/PHPCompatibility/PHPCompatibility/pull/587) +- :umbrella: additional unit tests to confirm that the `PHPCompatibility\Sniff::isClassProperty()` method handles multi-property declarations correctly. [#583](https://github.com/PHPCompatibility/PHPCompatibility/pull/583) +- :books: [Readme](https://github.com/PHPCompatibility/PHPCompatibility#using-a-frameworkcms-specific-ruleset) & [Contributing](https://github.com/PHPCompatibility/PHPCompatibility/blob/master/.github/CONTRIBUTING.md#frameworkcms-specific-rulesets): add information about the framework/CMS specific rulesets. Related PRs: [#615](https://github.com/PHPCompatibility/PHPCompatibility/pull/615), [#624](https://github.com/PHPCompatibility/PHPCompatibility/pull/624), [#648](https://github.com/PHPCompatibility/PHPCompatibility/pull/648), [#674](https://github.com/PHPCompatibility/PHPCompatibility/pull/674), [#685](https://github.com/PHPCompatibility/PHPCompatibility/pull/685), [#694](https://github.com/PHPCompatibility/PHPCompatibility/pull/694). Related to issue [#530](https://github.com/PHPCompatibility/PHPCompatibility/issues/530). +- :books: Readme: information about the PHPCS 3.3.0 change which allows for a `testVersion` in a custom ruleset to be overruled by the command-line. [#607](https://github.com/PHPCompatibility/PHPCompatibility/pull/607) + +### Changed +- :books: Adjusted references to the old repository location throughout the codebase to reflect the move to a GitHub organization. [#689](https://github.com/PHPCompatibility/PHPCompatibility/pull/689) + This repository will now live in [https://github.com/PHPCompatibility/PHPCompatibility](https://github.com/PHPCompatibility/PHPCompatibility) and the Packagist reference will now be `phpcompatibility/php-compatibility`. +- :white_check_mark: The `getReturnTypeHintToken()` utility method has been made compatible with the changes in the PHPCS tokenizer which were introduced in PHP_CodeSniffer 3.3.0. [#642](https://github.com/PHPCompatibility/PHPCompatibility/pull/642). Fixes [#639](https://github.com/PHPCompatibility/PHPCompatibility/issues/639). +- :pushpin: `ConstantArrayUsingConst`: improved handling of multi-constant declarations. [#593](https://github.com/PHPCompatibility/PHPCompatibility/pull/593) +- :pushpin: `NewHeredocInitialize`: improved handling of constant declarations using the `const` keyword. + The sniff will now also report on multi-declarations for variables, constants and class properties and on using heredoc as a function parameter default. [#641](https://github.com/PHPCompatibility/PHPCompatibility/pull/641) +- :pushpin: `ForbiddenEmptyListAssignment`: this sniff will now also report on empty list assignments when the PHP 7.1 short list syntax is used. [#653](https://github.com/PHPCompatibility/PHPCompatibility/pull/653) +- :pushpin: The `ForbiddenNegativeBitshift` sniff would previously only report on "bitshift right". As of this version, "bitshift left" and bitshift assignments will also be recognized. [#614](https://github.com/PHPCompatibility/PHPCompatibility/pull/614) +- :pushpin: The `NewClasses` and `NewInterfaces` sniffs will now also report on new classes/interfaces when used as _return type_ declarations. [#578](https://github.com/PHPCompatibility/PHPCompatibility/pull/578) +- :pushpin: The `NewScalarTypeDeclarations` sniff will now recognize `parent` as a valid type declaration. + The sniff will now also throw an error about using `self` and `parent` when PHP < 5.2 needs to be supported as PHP 5.1 and lower would presume these to be class names instead of keywords. [#595](https://github.com/PHPCompatibility/PHPCompatibility/pull/595) +- :pushpin: The `PregReplaceEModifier` sniff - and the `PCRENewModifiers` sniff by extension - will now correctly examine and report on modifiers in regexes passed via calls to `preg_replace_callback_array()`. [#600](https://github.com/PHPCompatibility/PHPCompatibility/pull/600), [#636](https://github.com/PHPCompatibility/PHPCompatibility/pull/636) +- :pushpin: `getReturnTypeHintToken()` utility method: improved support for interface methods and abstract function declarations. [#652](https://github.com/PHPCompatibility/PHPCompatibility/pull/652) +- :pushpin: The `findExtendedClassName()`, `findImplementedInterfaceNames()`, `getMethodParameters()` utility methods which are duplicates of upstream PHPCS methods, have been moved from the `PHPCompatibility\Sniff` class to the `PHPCompatibility\PHPCSHelper` class and have become static methods. [#613](https://github.com/PHPCompatibility/PHPCompatibility/pull/613) +- :white_check_mark: `getReturnTypeHintToken()` utility method: align returned `$stackPtr` with native PHPCS behaviour by returning the last token of the type declaration. [#575](https://github.com/PHPCompatibility/PHPCompatibility/pull/575) +- :white_check_mark: PHPCS cross-version compatibility: sync `getMethodParameters()` method with improved upstream version. [#643](https://github.com/PHPCompatibility/PHPCompatibility/pull/643) +- :pencil2: The `MbstringReplaceEModifier`, `PregReplaceEModifier` and the `PregReplaceEModifier` sniffs now `extend` the new `AbstractFunctionCallParameterSniff` class. This should yield more accurate results when checking whether one of the target PHP functions was called. [#636](https://github.com/PHPCompatibility/PHPCompatibility/pull/636) +- :pencil2: `DeprecatedNewReference` sniff: minor change to the error text and code - was `Forbidden`, now `Removed` -. Custom rulesets which explicitly excluded this error code will need to be updated. [#594](https://github.com/PHPCompatibility/PHPCompatibility/pull/594) +- :pencil2: `NewScalarTypeDeclarations` sniff: minor change to the error message text.[#644](https://github.com/PHPCompatibility/PHPCompatibility/pull/644) +- :umbrella: The unit test framework now allows for sniffs in categories other than `PHP`. [#634](https://github.com/PHPCompatibility/PHPCompatibility/pull/634) +- :umbrella: Boyscouting: fixed up some (non-relevant) parse errors in a unit test case file. [#576](https://github.com/PHPCompatibility/PHPCompatibility/pull/576) +- :green_heart: Travis: build tests are now also being run against the lowest supported PHPCS 3.x version. Previously only the highest supported PHPCS 3.x version was tested against. [#633](https://github.com/PHPCompatibility/PHPCompatibility/pull/633) +- :books: Readme: Improved Composer install instructions. [#690](https://github.com/PHPCompatibility/PHPCompatibility/pull/690) +- :books: Minor documentation fixes. [#672](https://github.com/PHPCompatibility/PHPCompatibility/pull/672) +- :wrench: Minor performance optimizations and code simplifications. [#592](https://github.com/PHPCompatibility/PHPCompatibility/pull/592), [#630](https://github.com/PHPCompatibility/PHPCompatibility/pull/630), [#671](https://github.com/PHPCompatibility/PHPCompatibility/pull/671) +- :wrench: Composer: Various improvements, including improved information about the suggested packages, suggesting `roave/security-advisories`, allowing for PHPUnit 7.x. [#604](https://github.com/PHPCompatibility/PHPCompatibility/pull/604/files), [#616](https://github.com/PHPCompatibility/PHPCompatibility/pull/616), [#622](https://github.com/PHPCompatibility/PHPCompatibility/pull/622), [#646](https://github.com/PHPCompatibility/PHPCompatibility/pull/646) +- :wrench: Various Travis build script improvements, including tweaks for faster build time, validation of the `composer.json` file, validation of the framework specific rulesets. [#570](https://github.com/PHPCompatibility/PHPCompatibility/pull/570), [#571](https://github.com/PHPCompatibility/PHPCompatibility/pull/571), [#579](https://github.com/PHPCompatibility/PHPCompatibility/pull/579), [#621](https://github.com/PHPCompatibility/PHPCompatibility/pull/621), [#631](https://github.com/PHPCompatibility/PHPCompatibility/pull/631) +- :wrench: Build/PHPCS: made some more CS conventions explicit and start using PHPCS 3.x options for the PHPCompatibility native ruleset. [#586](https://github.com/PHPCompatibility/PHPCompatibility/pull/586), [#667](https://github.com/PHPCompatibility/PHPCompatibility/pull/667), [#673](https://github.com/PHPCompatibility/PHPCompatibility/pull/673) +- :wrench: Some code style clean up and start using the new inline PHPCS 3.2+ annotations where applicable. [#586](https://github.com/PHPCompatibility/PHPCompatibility/pull/586), [#591](https://github.com/PHPCompatibility/PHPCompatibility/pull/591), [#620](https://github.com/PHPCompatibility/PHPCompatibility/pull/620), [#673](https://github.com/PHPCompatibility/PHPCompatibility/pull/673) + +### Removed +- :no_entry_sign: PHPCompatibility no longer explicitly supports PHP_CodeSniffer 2.2.0. [#687](https://github.com/PHPCompatibility/PHPCompatibility/pull/687), [#690](https://github.com/PHPCompatibility/PHPCompatibility/pull/690) +- :no_entry_sign: The PHPCompatibility ruleset no longer includes the PHPCS native `Generic.NamingConventions.CamelCapsFunctionName`. Double underscore prefixed function names are now being reported on by a new dedicated sniff. [#581](https://github.com/PHPCompatibility/PHPCompatibility/pull/581) +- :no_entry_sign: PHPCompatibility no longer explicitly supports HHVM and builds are no longer tested against HHVM. + For now, running PHPCompatibility on HHVM to test PHP code may still work for a little while, but HHVM has announced they are [dropping PHP support](https://hhvm.com/blog/2017/09/18/the-future-of-hhvm.html). [#623](https://github.com/PHPCompatibility/PHPCompatibility/pull/623). Fixes [#603](https://github.com/PHPCompatibility/PHPCompatibility/issues/603). +- :books: Readme: badges from services which are no longer supported or inaccurate. [#609](https://github.com/PHPCompatibility/PHPCompatibility/pull/609), [#628](https://github.com/PHPCompatibility/PHPCompatibility/pull/628) + +### Fixed +- :bug: Previously, the PHPCS native `Generic.NamingConventions.CamelCapsFunctionName` sniff was included in PHPCompatibility. Some error codes of this sniff were excluded, as well as some error messages changed (via the ruleset). + If/when PHPCompatibility would be used in combination with a code style-type ruleset, this could inadvertently lead to underreporting of issues which the CS-type ruleset intends to have reported - i.e. the error codes excluded by PHPCompatibility -. This has now been fixed. [#581](https://github.com/PHPCompatibility/PHPCompatibility/pull/581) +- :bug: The `ForbiddenNegativeBitshift` sniff would incorrectly throw an error when a bitshift was based on a calculation which included a negative number, but would not necessarily result in a negative number. [#614](https://github.com/PHPCompatibility/PHPCompatibility/pull/614). Fixes [#294](https://github.com/PHPCompatibility/PHPCompatibility/issues/294), [#466](https://github.com/PHPCompatibility/PHPCompatibility/issues/466). +- :bug: The `NewClosure` sniff would report the same issue twice when the issue was encountered in a nested closure. [#669](https://github.com/PHPCompatibility/PHPCompatibility/pull/669) +- :bug: The `NewKeywords` sniff would underreport on non-lowercase keywords. [#627](https://github.com/PHPCompatibility/PHPCompatibility/pull/627) +- :bug: The `NewKeywords` sniff would incorrectly report on the use of class constants and class properties using the same name as a keyword. [#627](https://github.com/PHPCompatibility/PHPCompatibility/pull/627) +- :bug: The `NewNullableTypes` sniff would potentially underreport when comments where interspersed in the (return) type declarations. [#577](https://github.com/PHPCompatibility/PHPCompatibility/pull/577) +- :bug: The `Sniff::getFunctionCallParameters()` utility method would in rare cases return incorrect results when it encountered a closure as a parameter. [#682](https://github.com/PHPCompatibility/PHPCompatibility/pull/682) +- :bug: The `Sniff::getReturnTypeHintToken()` utility method would not always return a `$stackPtr`. [#645](https://github.com/PHPCompatibility/PHPCompatibility/pull/645) +- :bug: Minor miscellanous other bugfixes. [#670](https://github.com/PHPCompatibility/PHPCompatibility/pull/670) +- :umbrella: `PHPCompatibility\Tests\BaseClass\MethodTestFrame::getTargetToken()` could potentially not find the correct token to run a test against. [#588](https://github.com/PHPCompatibility/PHPCompatibility/pull/588) + +### Credits +Thanks go out to [Michael Babker] and [Juliette Reinders Folmer] for their contributions to this version. :clap: + + +## [8.1.0] - 2017-12-27 + +See all related issues and PRs in the [8.1.0 milestone]. + +### Added +- :star2: New `NewConstants` and `RemovedConstants` sniffs to detect usage of new/removed PHP constants for all PHP versions from PHP 5 up. [#526](https://github.com/PHPCompatibility/PHPCompatibility/pull/525), [#551](https://github.com/PHPCompatibility/PHPCompatibility/pull/551), [#566](https://github.com/PHPCompatibility/PHPCompatibility/pull/566). Fixes [#263](https://github.com/PHPCompatibility/PHPCompatibility/issues/263). +- :star2: New `MagicAutoloadDeprecation` sniff to detect deprecated `__autoload()` functions as deprecated in PHP 7.2. [#540](https://github.com/PHPCompatibility/PHPCompatibility/pull/540) +- :star2: New `OptionalRequiredFunctionParameter` sniff to check for missing function call parameters which were required and only became optional in a later PHP version. [#524](https://github.com/PHPCompatibility/PHPCompatibility/pull/524) +- :star2: New `DynamicAccessToStatic` sniff to detect dynamic access to static methods and properties, as well as class constants, prior to PHP 5.3. [#535](https://github.com/PHPCompatibility/PHPCompatibility/pull/535). Fixes [#534](https://github.com/PHPCompatibility/PHPCompatibility/issues/534). +- :star: `DeprecatedFunctions` sniff: recognize yet more PHP 7.2 deprecated functions. [#561](https://github.com/PHPCompatibility/PHPCompatibility/pull/561), [#566](https://github.com/PHPCompatibility/PHPCompatibility/pull/566) +- :star: `DeprecatedIniDirectives` sniff: recognize the last of the PHP 7.2 deprecated ini directives. [#566](https://github.com/PHPCompatibility/PHPCompatibility/pull/566), [#567](https://github.com/PHPCompatibility/PHPCompatibility/pull/567) +- :star: `NewFunctions` : detection of all new PHP 7.2 functions added. [#522](https://github.com/PHPCompatibility/PHPCompatibility/pull/522), [#545](https://github.com/PHPCompatibility/PHPCompatibility/pull/545), [#551](https://github.com/PHPCompatibility/PHPCompatibility/pull/551), [#565](https://github.com/PHPCompatibility/PHPCompatibility/pull/565) +- :star: `RemovedExtensions` : report on usage of the `mcrypt` extension which has been removed in PHP 7.2. [#566](https://github.com/PHPCompatibility/PHPCompatibility/pull/566) +- :star: `RemovedGlobalVariables` : detection of the use of `$php_errormsg` with `track_errors` which has been deprecated in PHP 7.2. [#528](https://github.com/PHPCompatibility/PHPCompatibility/pull/528) +- :books: Documentation : added reporting usage instructions. [#533](https://github.com/PHPCompatibility/PHPCompatibility/pull/533), [#552](https://github.com/PHPCompatibility/PHPCompatibility/pull/552) + +### Changed +- :pushpin: `NewClosures` : downgraded "$this found in closure outside class" to warning. [#536](https://github.com/PHPCompatibility/PHPCompatibility/pull/535). Fixes [#527](https://github.com/PHPCompatibility/PHPCompatibility/issues/527). +- :pushpin: `ForbiddenGlobalVariableVariable` : the sniff will now throw an error for each variable in a `global` statement which is no longer supported and show the variable found to make it easier to fix this. Previously only one error would be thrown per `global` statement. [#564](https://github.com/PHPCompatibility/PHPCompatibility/pull/564) +- :pushpin: `ForbiddenGlobalVariableVariable` : the sniff will now throw `warning`s for non-bare variables used in a `global` statement as those are discouraged since PHP 7.0. [#564](https://github.com/PHPCompatibility/PHPCompatibility/pull/564) +- :rewind: `NewLanguageConstructs` : updated the version number for `T_COALESCE_EQUAL`. [#523](https://github.com/PHPCompatibility/PHPCompatibility/pull/523) +- :pencil2: `Sniff::getTestVersion()` : simplified regex logic. [#520](https://github.com/PHPCompatibility/PHPCompatibility/pull/520) +- :green_heart: Travis : build tests are now being run against PHP 7.2 as well. [#511](https://github.com/PHPCompatibility/PHPCompatibility/pull/511) +- :wrench: Improved check for superfluous whitespaces in files. [#542](https://github.com/PHPCompatibility/PHPCompatibility/pull/542) +- :wrench: Build/PHPCS : stabilized the exclude patterns. [#529](https://github.com/PHPCompatibility/PHPCompatibility/pull/529) +- :wrench: Build/PHPCS : added array indentation check. [#538](https://github.com/PHPCompatibility/PHPCompatibility/pull/538) +- :white_check_mark: PHPCS cross-version compatibility : sync `FindExtendedClassname()` method with upstream. [#507](https://github.com/PHPCompatibility/PHPCompatibility/pull/507) +- :wrench: The minimum version for the recommended `DealerDirect/phpcodesniffer-composer-installer` Composer plugin has been upped to `0.4.3`. [#548](https://github.com/PHPCompatibility/PHPCompatibility/pull/548) + +### Fixed +- :bug: `ForbiddenCallTimePassByReference` : a false positive was being thrown when a global constant was followed by a _bitwise and_. [#562](https://github.com/PHPCompatibility/PHPCompatibility/pull/562). Fixes [#39](https://github.com/PHPCompatibility/PHPCompatibility/issues/39). +- :bug: `ForbiddenGlobalVariableVariable` : the sniff was overzealous and would also report on `global` in combination with variable variables which are still supported. [#564](https://github.com/PHPCompatibility/PHPCompatibility/pull/564). Fixes [#537](https://github.com/PHPCompatibility/PHPCompatibility/issues/537). +- :bug: `ForbiddenGlobalVariableVariable` : variables interspersed with whitespace and/or comments were not being reported. [#564](https://github.com/PHPCompatibility/PHPCompatibility/pull/564) +- :rewind: `ForbiddenNamesAsInvokedFunctions` : improved recognition of function invocations using forbidden words and prevent warnings for keywords which are no longer forbidden as method names in PHP 7.0+. [#516](https://github.com/PHPCompatibility/PHPCompatibility/pull/516). Fixes [#515](https://github.com/PHPCompatibility/PHPCompatibility/issues/515) +- :bug: `VariableVariables` : variables interspersed with whitespace and/or comments were not being reported. [#563](https://github.com/PHPCompatibility/PHPCompatibility/pull/563) +- :umbrella: Fixed some unintentional syntax errors in test files. [#539](https://github.com/PHPCompatibility/PHPCompatibility/pull/539) +- :umbrella: Tests : fixed case numbering error. [#525](https://github.com/PHPCompatibility/PHPCompatibility/pull/525) +- :books: Tests : added missing test skip explanation. [#521](https://github.com/PHPCompatibility/PHPCompatibility/pull/521) +- :wrench: Fixed PHPCS whitespaces. [#543](https://github.com/PHPCompatibility/PHPCompatibility/pull/543) +- :wrench: Fixed code test coverage verification. [#550](https://github.com/PHPCompatibility/PHPCompatibility/pull/550). Fixes [#549](https://github.com/PHPCompatibility/PHPCompatibility/issues/549). + +### Credits +Thanks go out to [Juliette Reinders Folmer] and [Jonathan Van Belle] for their contributions to this version. :clap: + + +## [8.0.1] - 2017-08-07 + +See all related issues and PRs in the [8.0.1 milestone]. + +### Added +- :star2: New `DeprecatedTypeCasts` sniff to detect deprecated and removed type casts, such as the `(unset)` type cast as deprecated in PHP 7.2. [#498](https://github.com/PHPCompatibility/PHPCompatibility/pull/498) +- :star2: New `NewTypeCasts` sniff to detect type casts not present in older PHP versions such as the `(binary)` type cast as added in PHP 5.2.1. [#497](https://github.com/PHPCompatibility/PHPCompatibility/pull/497) +- :star: `NewGroupUseDeclaration`: Detection of PHP 7.2 trailing comma's in group use statements. [#504](https://github.com/PHPCompatibility/PHPCompatibility/pull/504) +- :star: `DeprecatedFunctions` sniff: recognize some more PHP 7.2 deprecated functions. [#501](https://github.com/PHPCompatibility/PHPCompatibility/pull/501) +- :star: `DeprecatedIniDirectives` sniff: recognize more PHP 7.2 deprecated ini directives. [#500](https://github.com/PHPCompatibility/PHPCompatibility/pull/500) +- :star: `ForbiddenNames` sniff: recognize `object` as a forbidden keyword since PHP 7.2. [#499](https://github.com/PHPCompatibility/PHPCompatibility/pull/499) +- :star: `NewReturnTypeDeclarations` sniff: recognize generic `parent`, PHP 7.1 `iterable` and PHP 7.2 `object` return type declarations. [#505](https://github.com/PHPCompatibility/PHPCompatibility/pull/505), [#499](https://github.com/PHPCompatibility/PHPCompatibility/pull/499) +- :star: `NewScalarTypeDeclarations` sniff: recognize PHP 7.2 `object` type declarion. [#499](https://github.com/PHPCompatibility/PHPCompatibility/pull/499) + +### Changed +- :pencil2: Improved clarity of the deprecated functions alternative in the error message. [#502](https://github.com/PHPCompatibility/PHPCompatibility/pull/502) + +### Fixed +- :fire_engine: Temporary hotfix for installed_paths (pending [upstream fix](https://github.com/squizlabs/PHP_CodeSniffer/issues/1591).) [#503](https://github.com/PHPCompatibility/PHPCompatibility/pull/503) + +### Credits +Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap: + + + +## [8.0.0] - 2017-08-03 + +**IMPORTANT**: This release contains a **breaking change**. Please read the below information carefully before upgrading! + +The directory layout of the PHPCompatibility standard has been changed for improved compatibility with Composer. +This means that the PHPCompatibility standard no longer extends from the root directory of the repository, but now lives in its own subdirectory `/PHPCompatibility`. + +This release also bring compatibility with PHPCS 3.x to the PHPCompatibility standard. + +There are two things you will need to be aware of: +* The path to the PHPCompatibility standard has changed. +* If you intend to upgrade to PHPCS 3.x, the path to the `phpcs` script has changed (upstream change). + +Please follow the below upgrade instructions carefully. This should be a one-time only action. + +### Upgrade instructions + +### Before upgrading + +If you had previously made accommodations for the old directory layout, you should remove any such _"hacks"_ (meant in the kindest of ways) now. + +By this we mean: symlinks for the PHPCompatibility install to the `PHP_CodeSniffer/CodeSniffer/Standards` directory, scripts to move the sniffs files to the PHPCS directory, scripts which made symlinks etc. + +So, please remove those first. + +> **Side-note**: +> +> If you had previously forked this repository to solve this issue, please consider reverting your fork to the official version or removing it all together. + +### Upgrading: re-registering PHPCompatibility with PHP CodeSniffer + +External PHP CodeSniffer standards need to be registered with PHP CodeSniffer. You have probably done this the first time you used PHPCompatibility or have a script or Composer plugin in place to do this for you. + +As the directory layout of PHPCompatibility has changed, the path previously registered with PHP CodeSniffer will no longer work and running `phpcs -i` will **_not_** list PHPCompatibility as one of the registered standards. + +#### Using a Composer plugin + +If you use Composer, we recommend you use a Composer plugin to sort this out. In previous install instructions we recommended the SimplyAdmin plugin for this. This plugin has since been abandoned. We now recommend the DealerDirect plugin. +```bash +composer remove --dev simplyadmire/composer-plugins +composer require --dev dealerdirect/phpcodesniffer-composer-installer:^0.4.3 +composer install +composer update phpcompatibility/php-compatibility squizlabs/php_codesniffer +vendor/bin/phpcs -i +``` +If all went well, you should now see PHPCompatibility listed again in the list of installed standards. + +#### Manually re-registering PHPCompatibility + +1. First run `phpcs --config-show` to check which path(s) are currently registered with PHP CodeSniffer for external standards. +2. Check in the below table what the new path for PHPCompatibility will be - the path should point to the root directory of your PHPCompatibility install (not to the sub-directory of the same name): + + Install type | Old path | New path + ------------ | -------- | --------- + Composer | `vendor/wimg` | `vendor/phpcompatibility/php-compatibility` + Unzipped release to arbitrary directory | `path/to/dir/abovePHPCompatibility` | `path/to/dir/abovePHPCompatibility/PHPCompatibility` + Git checkout | `path/to/dir/abovePHPCompatibility` | `path/to/dir/abovePHPCompatibility/PHPCompatibility` + PEAR | If the old install instruction has been followed, not registered. | `path/to/PHPCompatibility` + + > **Side-note**: + > + > If you used the old install instructions for a PEAR install, i.e. checking out the latest release to the `PHP/CodeSniffer/Standards/PHPCompatibility` directory, and you intend to upgrade to PHP CodeSniffer 3.x, it is recommended you move the PHPCompatibility folder out of the PEAR directory now, as the layout of the PHPCS directory has changed with PHPCS 3.x and you may otherwise lose your PHPCompatibility install when you upgrade PHP CodeSniffer via PEAR. + +3. There are two ways in which you can register the new `installed_paths` value with PHP CodeSniffer. Choose your preferred method: + * Run `phpcs --config-set installed_paths ...` and include all previously installed paths including the _adjusted_ path for the PHPCompatibility standard. + + For example, if the previous value of `installed_paths` was + + `/path/to/MyStandard,/path/to/dir/abovePHPCompatibility` + + you should now set it using + + `phpcs --config-set installed_paths /path/to/MyStandard,/path/to/PHPCompatibility` + + * If you use a custom ruleset in combination with PHPCS 2.6.0 or higher, you can pass the value to PHPCS from your custom ruleset: + ```xml + <config name="installed_paths" value="vendor/phpcompatibility/php-compatibility" /> + ``` +4. Run `phpcs -i` to verify that the PHPCompatibility standard is now listed again in the list of installed standards. + + +### Upgrading to PHPCS 3.x + +The path to the `phpcs` script has changed in PHPCS 3.x which will impact how you call PHPCS. + +Version | PHPCS 2.x | PHPCS 3.x +------- | --------- | --------- +Generic `phpcs` Command | `path/to/PHP_CodeSniffer/scripts/phpcs ....` | `path/to/PHP_CodeSniffer/bin/phpcs ....` +Composer command | `vendor/bin/phpcs ...` | `vendor/bin/phpcs ...` + +So, for Composer users, nothing changes. For everyone else, you may want to add the `path/to/PHP_CodeSniffer/bin/phpcs` path to your PATH environment variable or adjust any scripts - like build scripts - which call PHPCS. + + +### Upgrading a Travis build script + +If you run PHPCompatibility against your code as part of your Travis build: +* If you use Composer to install PHP CodeSniffer and PHPCompatibility on the travis image and you've made the above mentioned changes, your build should pass again. +* If you use `git clone` to install PHP CodeSniffer and PHPCompatibility on the travis image, your build will fail until you make the following changes: + 1. Check which branch of PHPCS is being checked out. If you previously fixed this to a pre-PHPCS 3.x branch or tag, you can now change this (back) to `master` or a PHPCS 3 tag. + 2. Check to which path PHPCompatibility is being cloned and adjust the path if necessary. + 3. Adjust the `phpcs --config-set installed_paths` command as described above to point to the root of the cloned PHPCompatibility repo. + 4. If you switched to using PHPCS 3.x, adjust the call to PHPCS. + + + +### Changelog for version 8.0.0 + +See all related issues and PRs in the [8.0.0 milestone]. + +### Added +- :two_hearts: Support for PHP CodeSniffer 3.x. [#482](https://github.com/PHPCompatibility/PHPCompatibility/pull/482), [#481](https://github.com/PHPCompatibility/PHPCompatibility/pull/481), [#480](https://github.com/PHPCompatibility/PHPCompatibility/pull/480), [#488](https://github.com/PHPCompatibility/PHPCompatibility/pull/488), [#489](https://github.com/PHPCompatibility/PHPCompatibility/pull/489), [#495](https://github.com/PHPCompatibility/PHPCompatibility/pull/495) + +### Changed +- :gift: As of this version PHPCompatibility will use semantic versioning. +- :fire: The directory structure of the repository has changed for better compatibility with installation via Composer. [#446](https://github.com/PHPCompatibility/PHPCompatibility/pull/446). Fixes [#102](https://github.com/PHPCompatibility/PHPCompatibility/issues/102), [#107](https://github.com/PHPCompatibility/PHPCompatibility/issues/107) +- :pencil2: The custom `functionWhitelist` property for the `PHPCompatibility.PHP.RemovedExtensions` sniff is now only supported in combination with PHP CodeSniffer 2.6.0 or higher (due to an upstream bug which was fixed in PHPCS 2.6.0). [#482](https://github.com/PHPCompatibility/PHPCompatibility/pull/482) +- :wrench: Improved the information provided to Composer from the `composer.json` file. [#446](https://github.com/PHPCompatibility/PHPCompatibility/pull/446), [#482](https://github.com/PHPCompatibility/PHPCompatibility/pull/482), [#486](https://github.com/PHPCompatibility/PHPCompatibility/pull/486) +- :wrench: Release archives will no longer contain the unit tests and other typical development files. You can still get these by using Composer with `--prefer-source` or by checking out a git clone of the repository. [#494](https://github.com/PHPCompatibility/PHPCompatibility/pull/494) +- :wrench: A variety of minor improvements to the build process. [#485](https://github.com/PHPCompatibility/PHPCompatibility/pull/485), [#486](https://github.com/PHPCompatibility/PHPCompatibility/pull/486), [#487](https://github.com/PHPCompatibility/PHPCompatibility/pull/487) +- :wrench: Some files for use by contributors have been renamed to use `.dist` extensions or moved for easier access. [#478](https://github.com/PHPCompatibility/PHPCompatibility/pull/478), [#479](https://github.com/PHPCompatibility/PHPCompatibility/pull/479), [#483](https://github.com/PHPCompatibility/PHPCompatibility/pull/483), [#493](https://github.com/PHPCompatibility/PHPCompatibility/pull/493) +- :books: The installation instructions in the Readme. [#496](https://github.com/PHPCompatibility/PHPCompatibility/pull/496) +- :books: The unit test instructions in the Contributing file. [#496](https://github.com/PHPCompatibility/PHPCompatibility/pull/496) +- :books: Improved the example code in the Readme. [#490](https://github.com/PHPCompatibility/PHPCompatibility/pull/490) + +### Removed +- :no_entry_sign: Support for PHP 5.1 and 5.2. + + The sniffs can now only be run on PHP 5.3 or higher in combination with PHPCS 1.5.6 or 2.x and on PHP 5.4 or higher in combination with PHPCS 3.x. [#484](https://github.com/PHPCompatibility/PHPCompatibility/pull/484), [#482](https://github.com/PHPCompatibility/PHPCompatibility/pull/482) + +### Credits +Thanks go out to [Gary Jones] and [Juliette Reinders Folmer] for their contributions to this version. :clap: + + +## [7.1.5] - 2017-07-17 + +See all related issues and PRs in the [7.1.5 milestone]. + +### Added +- :star: The `NewKeywords` sniff will now also sniff for `yield from` which was introduced in PHP 7.0. [#477](https://github.com/PHPCompatibility/PHPCompatibility/pull/477). Fixes [#476](https://github.com/PHPCompatibility/PHPCompatibility/issues/476) +- :books: The LGPL-3.0 license. [#447](https://github.com/PHPCompatibility/PHPCompatibility/pull/447) + +### Changed +- :rewind: The `NewExecutionDirectives` sniff will now also report on execution directives when used in combination with PHPCS 2.0.0-2.3.3. [#451](https://github.com/PHPCompatibility/PHPCompatibility/pull/451) +- :rewind: The `getMethodParameters()` utility method will no longer break when used with PHPCS 1.5.x < 1.5.6. This affected a number of sniffs. [#452](https://github.com/PHPCompatibility/PHPCompatibility/pull/452) +- :rewind: The `inUseScope()` utility method will no longer break when used with PHPCS 2.0.0 - 2.2.0. This affected a number of sniffs. [#454](https://github.com/PHPCompatibility/PHPCompatibility/pull/454) +- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#443](https://github.com/PHPCompatibility/PHPCompatibility/pull/443), [#474](https://github.com/PHPCompatibility/PHPCompatibility/pull/474) +- :pencil2: Renamed a test file for consistency. [#453](https://github.com/PHPCompatibility/PHPCompatibility/pull/453) +- :wrench: Code style clean up. [#429](https://github.com/PHPCompatibility/PHPCompatibility/pull/429) +- :wrench: Prevent Composer installing PHPCS 3.x. **_PHPCS 3.x is not (yet) supported by the PHPCompatibility standard, but will be in the near future._** [#444](https://github.com/PHPCompatibility/PHPCompatibility/pull/444) +- :green_heart: The code base will now be checked for consistent code style during build testing. [#429](https://github.com/PHPCompatibility/PHPCompatibility/pull/429) +- :green_heart: The sniffs are now also tested against HHVM for consistent results. _Note: the sniffs do not contain any HHVM specific checks nor is there any intention to add them at this time._ [#450](https://github.com/PHPCompatibility/PHPCompatibility/pull/450) +- :books: Made it explicit that - at this moment - PHPCS 3.x is not (yet) supported. [#444](https://github.com/PHPCompatibility/PHPCompatibility/pull/444) +- :books: Minor improvements to the Readme. [#448](https://github.com/PHPCompatibility/PHPCompatibility/pull/448), [#449](https://github.com/PHPCompatibility/PHPCompatibility/pull/449), [#468](https://github.com/PHPCompatibility/PHPCompatibility/pull/468) +- :books: Minor improvements to the Contributing guidelines. [#467](https://github.com/PHPCompatibility/PHPCompatibility/pull/467) + +### Removed +- :no_entry_sign: The `DefaultTimeZoneRequired` sniff. This sniff was checking server settings rather than code. [#458](https://github.com/PHPCompatibility/PHPCompatibility/pull/458). Fixes [#457](https://github.com/PHPCompatibility/PHPCompatibility/issues/457) +- :no_entry_sign: The `NewMagicClassConstant` sniff as introduced in v 7.1.4 contained two additional checks for not strictly compatibility related issues. One of these was plainly wrong, the other opinionated. Both have been removed. [#442](https://github.com/PHPCompatibility/PHPCompatibility/pull/442). Fixes [#436](https://github.com/PHPCompatibility/PHPCompatibility/issues/436) + +### Fixed +- :bug: `NewClass` sniff: was reporting an incorrect introduction version number for a few of the Exception classes. [#441](https://github.com/PHPCompatibility/PHPCompatibility/pull/441). Fixes [#440](https://github.com/PHPCompatibility/PHPCompatibility/issues/440). +- :bug: `ForbiddenBreakContinueVariableArguments` sniff: was incorrectly reporting an error if the `break` or `continue` was followed by a PHP closing tag (breaking out of PHP). [#462](https://github.com/PHPCompatibility/PHPCompatibility/pull/462). Fixes [#460](https://github.com/PHPCompatibility/PHPCompatibility/issues/460) +- :bug: `ForbiddenGlobalVariableVariable` sniff: was incorrectly reporting an error if the `global` statement was followed by a PHP closing tag (breaking out of PHP). [#463](https://github.com/PHPCompatibility/PHPCompatibility/pull/463). +- :bug: `DeprecatedFunctions` sniff: was reporting false positives for classes using the same name as a deprecated function. [#465](https://github.com/PHPCompatibility/PHPCompatibility/pull/465). Fixes [#464](https://github.com/PHPCompatibility/PHPCompatibility/issues/464) + +### Credits +Thanks go out to [Juliette Reinders Folmer] and [Mark Clements] for their contributions to this version. :clap: + + +## [7.1.4] - 2017-05-06 + +See all related issues and PRs in the [7.1.4 milestone]. + +### Added +- :star2: New `CaseSensitiveKeywords` sniff to detect use of non-lowercase `self`, `static` and `parent` keywords which could cause compatibility issues pre-PHP 5.5. [#382](https://github.com/PHPCompatibility/PHPCompatibility/pull/382) +- :star2: New `ConstantArraysUsingConst` sniff to detect constants defined using the `const` keyword being assigned an array value which was not supported prior to PHP 5.6. [#397](https://github.com/PHPCompatibility/PHPCompatibility/pull/397) +- :star2: New `ForbiddenClosureUseVariableNames` sniff to detect PHP 7.1 forbidden variable names in closure use statements. [#386](https://github.com/PHPCompatibility/PHPCompatibility/pull/386). Fixes [#374](https://github.com/PHPCompatibility/PHPCompatibility/issues/374) +- :star2: New `NewArrayStringDereferencing` sniff to detect array and string literal dereferencing as introduced in PHP 5.5. [#388](https://github.com/PHPCompatibility/PHPCompatibility/pull/388) +- :star2: New `NewHeredocInitialize` sniff to detect initialization of static variables and class properties/constants using the heredoc syntax which is supported since PHP 5.3. [#391](https://github.com/PHPCompatibility/PHPCompatibility/pull/391). Fixes [#51](https://github.com/PHPCompatibility/PHPCompatibility/issues/51) +- :star2: New `NewMagicClassConstant` sniff to detect use of the magic `::class` constant as introduced in PHP 5.5. [#403](https://github.com/PHPCompatibility/PHPCompatibility/pull/403). Fixes [#364](https://github.com/PHPCompatibility/PHPCompatibility/issues/364). +- :star2: New `NewUseConstFunction` sniff to detect use statements importing constants and functions as introduced in PHP 5.6. [#401](https://github.com/PHPCompatibility/PHPCompatibility/pull/401) +- :star: `DeprecatedFunctions` sniff: recognize PHP 7.2 deprecated GD functions. [#392](https://github.com/PHPCompatibility/PHPCompatibility/pull/392) +- :star: `DeprecatedIniDirectives` sniff: recognize PHP 7.2 deprecated `mbstring.func_overload` directive. [#377](https://github.com/PHPCompatibility/PHPCompatibility/pull/377) +- :star: `NewClasses` sniff: check for the PHP 5.1 `libXMLError` class. [#412](https://github.com/PHPCompatibility/PHPCompatibility/pull/412) +- :star: `NewClasses` sniff: recognize all native PHP Exception classes. [#418](https://github.com/PHPCompatibility/PHPCompatibility/pull/418) +- :star: `NewClosure` sniff: check for closures being declared as static and closures using `$this`. Both of which was not supported pre-PHP 5.4. [#389](https://github.com/PHPCompatibility/PHPCompatibility/pull/389). Fixes [#24](https://github.com/PHPCompatibility/PHPCompatibility/issues/24). +- :star: `NewFunctionParameters` sniff: recognize new `exclude_disabled` parameter for the `get_defined_functions()` function as introduced in PHP 7.0.15. [#375](https://github.com/PHPCompatibility/PHPCompatibility/pull/375) +- :star: `NewFunctions` sniff: recognize new PHP 7.2 socket related functions. [#376](https://github.com/PHPCompatibility/PHPCompatibility/pull/376) +- :star: `NewInterfaces` sniff: check for some more PHP native interfaces. [#411](https://github.com/PHPCompatibility/PHPCompatibility/pull/411) +- :star: New `isClassProperty()`, `isClassConstant()` and `validDirectScope()` utility methods to the `PHPCompatibility_Sniff` class. [#393](https://github.com/PHPCompatibility/PHPCompatibility/pull/393), [#391](https://github.com/PHPCompatibility/PHPCompatibility/pull/391). +- :star: New `getTypeHintsFromFunctionDeclaration()` utility method to the `PHPCompatibility_Sniff` class. [#414](https://github.com/PHPCompatibility/PHPCompatibility/pull/414). +- :umbrella: Unit tests against false positives for the `NewMagicMethods` sniff. [#381](https://github.com/PHPCompatibility/PHPCompatibility/pull/381) +- :umbrella: More unit tests for the `getTestVersion()` utility method. [#405](https://github.com/PHPCompatibility/PHPCompatibility/pull/405), [#430](https://github.com/PHPCompatibility/PHPCompatibility/pull/430) +- :green_heart: The XML of the ruleset will now be validated and checked for consistent code style during the build testing by Travis. [#433](https://github.com/PHPCompatibility/PHPCompatibility/pull/433) +- :books: Readme: information about setting `installed_paths` via a custom ruleset. [#407](https://github.com/PHPCompatibility/PHPCompatibility/pull/407) +- :books: `Changelog.md` file containing a record of notable changes since the first tagged release. [#421](https://github.com/PHPCompatibility/PHPCompatibility/pull/421) + +### Changed +- :pushpin: The `ForbiddenNamesAsDeclared` sniff will now emit `warning`s for soft reserved keywords. [#406](https://github.com/PHPCompatibility/PHPCompatibility/pull/406), [#370](https://github.com/PHPCompatibility/PHPCompatibility/pull/370). +- :pushpin: The `ForbiddenNames` sniff will now allow for the more liberal rules for usage of reserved keywords as of PHP 7.0. [#417](https://github.com/PHPCompatibility/PHPCompatibility/pull/417) +- :pushpin: The `InternalInterfaces`, `NewClasses`, `NewConstVisibility`, `NewInterfaces`, `NewMagicMethods`, `NonStaticMagicMethods` and `RemovedGlobalVariables` sniffs will now also sniff for and correctly report violations in combination with anonymous classes. [#378](https://github.com/PHPCompatibility/PHPCompatibility/pull/378), [#383](https://github.com/PHPCompatibility/PHPCompatibility/pull/383), [#393](https://github.com/PHPCompatibility/PHPCompatibility/pull/393), [#394](https://github.com/PHPCompatibility/PHPCompatibility/pull/394), [#395](https://github.com/PHPCompatibility/PHPCompatibility/pull/395), [#396](https://github.com/PHPCompatibility/PHPCompatibility/pull/396). Fixes [#351](https://github.com/PHPCompatibility/PHPCompatibility/issues/351) and [#333](https://github.com/PHPCompatibility/PHPCompatibility/issues/333). +- :pushpin: The `NewClasses` and `NewInterfaces` sniffs will now also report on new classes/interfaces when used as type hints. [#414](https://github.com/PHPCompatibility/PHPCompatibility/pull/414), [#416](https://github.com/PHPCompatibility/PHPCompatibility/pull/416). Fixes [#352](https://github.com/PHPCompatibility/PHPCompatibility/issues/352) +- :pushpin: The `NewClasses` sniff will now also report on Exception classes when used in (multi-)`catch` statements. [#418](https://github.com/PHPCompatibility/PHPCompatibility/pull/418). Fixes [#373](https://github.com/PHPCompatibility/PHPCompatibility/issues/373). +- :pushpin: The `NewScalarTypeDeclarations` sniff will now report on new type hints even when the type hint is nullable. [#379](https://github.com/PHPCompatibility/PHPCompatibility/pull/379) +- :twisted_rightwards_arrows: The `NewNowdoc` sniff has been renamed to `NewNowdocQuotedHeredoc` and will now also check for double quoted heredoc identifiers as introduced in PHP 5.3. [#390](https://github.com/PHPCompatibility/PHPCompatibility/pull/390) +- :rewind: The `NewClasses` sniff will now also report anonymous classes which `extend` a new sniff when used in combination with PHPCS 2.4.0-2.8.0. [#432](https://github.com/PHPCompatibility/PHPCompatibility/pull/432). Fixes [#334](https://github.com/PHPCompatibility/PHPCompatibility/issues/334). +- :pencil2: `NewFunctionParameter` sniff: version number precision for two parameters. [#384](https://github.com/PHPCompatibility/PHPCompatibility/pull/384), [#428](https://github.com/PHPCompatibility/PHPCompatibility/pull/428) +- :umbrella: Skipping two unit tests for the `ForbiddenClosureUseVariable` sniff when run on PHPCS 2.5.1 as these cause an infinite loop due to an upstream bug. [#408](https://github.com/PHPCompatibility/PHPCompatibility/pull/408) +- :umbrella: Skipping unit tests involving `trait`s in combination with PHP < 5.4 and PHPCS < 2.4.0 as `trait`s are not recognized in those circumstances. [#431](https://github.com/PHPCompatibility/PHPCompatibility/pull/431) +- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#385](https://github.com/PHPCompatibility/PHPCompatibility/pull/385), [#387](https://github.com/PHPCompatibility/PHPCompatibility/pull/387), [#415](https://github.com/PHPCompatibility/PHPCompatibility/pull/415), [#423](https://github.com/PHPCompatibility/PHPCompatibility/pull/423), [#424](https://github.com/PHPCompatibility/PHPCompatibility/pull/424) +- :recycle: Minor simplification of the PHPUnit 6 compatibility layer and other test code. [#426](https://github.com/PHPCompatibility/PHPCompatibility/pull/426), [#425](https://github.com/PHPCompatibility/PHPCompatibility/pull/425) +- General housekeeping. [#398](https://github.com/PHPCompatibility/PHPCompatibility/pull/398), [#400](https://github.com/PHPCompatibility/PHPCompatibility/pull/400) +- :wrench: Minor tweaks to the Travis build script. [#409](https://github.com/PHPCompatibility/PHPCompatibility/pull/409) +- :green_heart: The sniffs are now also tested against PHP nightly for consistent results. [#380](https://github.com/PHPCompatibility/PHPCompatibility/pull/380) + +### Fixed +- :fire: Using unbounded ranges in `testVersion` resulted in unreported errors when used with sniffs using the `supportsBelow()` method. This affected the results of approximately half the sniffs. [#430](https://github.com/PHPCompatibility/PHPCompatibility/pull/430) +- :bug: The `ForbiddenNames` sniff would throw false positives for `use` statements with the `final` modifier in traits. [#402](https://github.com/PHPCompatibility/PHPCompatibility/pull/402). +- :bug: The `ForbiddenNames` sniff would fail to report on functions declared to return by reference using a reserved keyword as the function name. [#413](https://github.com/PHPCompatibility/PHPCompatibility/pull/413) +- :bug: The `ForbiddenNames` sniff would only examine the first part of a namespace and not report on reserved keywords used in subsequent parts of a nested namespace. [#419](https://github.com/PHPCompatibility/PHPCompatibility/pull/419) +- :bug: The `ForbiddenNames` sniff would not always correctly report on use statements importing constants or functions using reserved keywords. [#420](https://github.com/PHPCompatibility/PHPCompatibility/pull/420) +- :bug: The `NewKeywords` sniff would sometimes fail to report on the `const` keyword when used in a class, but not for a class constant. [#424](https://github.com/PHPCompatibility/PHPCompatibility/pull/424) +- :green_heart: PHPCS has released version 3.0 and updated the `master` branch to reflect this. This was causing the builds to fail. [#422](https://github.com/PHPCompatibility/PHPCompatibility/pull/422) + +### Credits +Thanks go out to [Juliette Reinders Folmer] and [Mark Clements] for their contributions to this version. :clap: + + +## [7.1.3] - 2017-04-02 + +See all related issues and PRs in the [7.1.3 milestone]. + +### Added +- :zap: The `testVersion` config parameter now allows for specifying unbounded ranges. + For example: specifying `-5.6` means: check for compatibility with all PHP versions up to and including PHP 5.6; + Specifying `7.0-` means: check for compatibility with all PHP versions from PHP 7.0 upwards. + For more information about setting the `testVersion`, see [Using the compatibility sniffs](https://github.com/PHPCompatibility/PHPCompatibility#using-the-compatibility-sniffs) in the readme. +- :umbrella: Unit test for multi-line short arrays for the `ShortArray` sniff. [#347](https://github.com/PHPCompatibility/PHPCompatibility/pull/347) +- :umbrella: Various additional unit tests against false positives. [#345](https://github.com/PHPCompatibility/PHPCompatibility/pull/345), [#369](https://github.com/PHPCompatibility/PHPCompatibility/pull/369) +- :umbrella: Unit tests for the `supportsBelow()`, `supportsAbove()` and `getTestVersion()` utility methods. [#363](https://github.com/PHPCompatibility/PHPCompatibility/pull/363) +- :books: Readme: information about installation of the standard using git check-out. [#349](https://github.com/PHPCompatibility/PHPCompatibility/pull/349) +- :books: `Contributing.md` file with information about reporting bugs, requesting features, making pull requests and running the unit tests. [#350](https://github.com/PHPCompatibility/PHPCompatibility/pull/350) + +### Changed +- :pushpin: The `ForbiddenFunctionParametersWithSameName`, `NewScalarTypeDeclarations`, `ParameterShadowSuperGlobals` sniff will now also sniff for and report violations in closures. [#331](https://github.com/PHPCompatibility/PHPCompatibility/pull/331) +- :twisted_rightwards_arrows: :rewind: The check for the PHP 5.3 `nowdoc` structure has been moved from the `NewKeywords` sniff to a new stand-alone `NewNowdoc` sniff which will now also recognize this structure when the sniffs are run on PHP 5.2. [#335](https://github.com/PHPCompatibility/PHPCompatibility/pull/335) +- :rewind: The `ForbiddenNames` sniff will now also correctly recognize reserved keywords used in a declared namespace when run on PHP 5.2. [#362](https://github.com/PHPCompatibility/PHPCompatibility/pull/362) +- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#360](https://github.com/PHPCompatibility/PHPCompatibility/pull/360) +- :recycle: The unit tests would previously run each test case file against all PHPCompatibility sniffs. Now, they will only be tested against the sniff which the test case file is intended to test. This allows for more test cases to be tested, more precise testing in combination with `testVersion` settings and makes the unit tests run ~6 x faster. + Relevant additional unit tests have been added and others adjusted. [#369](https://github.com/PHPCompatibility/PHPCompatibility/pull/369) +- :recycle: Refactoring/tidying up of some unit test code. [#343](https://github.com/PHPCompatibility/PHPCompatibility/pull/343), [#345](https://github.com/PHPCompatibility/PHPCompatibility/pull/345), [#356](https://github.com/PHPCompatibility/PHPCompatibility/pull/356), [#355](https://github.com/PHPCompatibility/PHPCompatibility/pull/355), [#359](https://github.com/PHPCompatibility/PHPCompatibility/pull/359) +- General housekeeping. [#346](https://github.com/PHPCompatibility/PHPCompatibility/pull/346) +- :books: Readme: Clarify minimum requirements and influence on the results. [#348](https://github.com/PHPCompatibility/PHPCompatibility/pull/348) + +### Removed +- :twisted_rightwards_arrows: Removed the `LongArrays` sniff. The checks it contained have been moved into the `RemovedGlobalVariables` sniff. Both sniffs essentially did the same thing, just for different PHP native superglobals. [#354](https://github.com/PHPCompatibility/PHPCompatibility/pull/354) + +### Fixed +- :bug: The `PregReplaceEModifier` sniff would throw a false positive if a quote character was used as the regex delimiter. [#357](https://github.com/PHPCompatibility/PHPCompatibility/pull/357) +- :bug: `RemovedGlobalVariables` sniff would report false positives for class properties shadowing the removed `$HTTP_RAW_POST_DATA` variables. [#354](https://github.com/PHPCompatibility/PHPCompatibility/pull/354). +- :bug: The `getFQClassNameFromNewToken()` utility function could go into an infinite loop causing PHP to run out of memory when examining unfinished code (examination during live coding). [#338](https://github.com/PHPCompatibility/PHPCompatibility/pull/338), [#342](https://github.com/PHPCompatibility/PHPCompatibility/pull/342) +- :bug: The `determineNamespace()` utility method would in certain cases not break out a loop. [#358](https://github.com/PHPCompatibility/PHPCompatibility/pull/358) +- :wrench: Travis script: Minor tweak for PHP 5.2 compatibility. [#341](https://github.com/PHPCompatibility/PHPCompatibility/pull/341) +- :wrench: The unit test suite is now also compatible with PHPUnit 6. [#365](https://github.com/PHPCompatibility/PHPCompatibility/pull/365) +- :books: Readme: Typo in the composer instructions. [#344](https://github.com/PHPCompatibility/PHPCompatibility/pull/344) + +### Credits +Thanks go out to [Arthur Edamov], [Juliette Reinders Folmer], [Mark Clements] and [Tadas Juozapaitis] for their contributions to this version. :clap: + + +## [7.1.2] - 2017-02-17 + +See all related issues and PRs in the [7.1.2 milestone]. + +### Added +- :star2: New `VariableVariables` sniff to detect variables variables for which the behaviour has changed in PHP 7.0. [#310](https://github.com/PHPCompatibility/PHPCompatibility/pull/310) Fixes [#309](https://github.com/PHPCompatibility/PHPCompatibility/issues/309). +- :star: The `NewReturnTypeDeclarations` sniff will now also sniff for non-scalar return type declarations, i.e. `array`, `callable`, `self` or a class name. [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323) +- :star: The `NewLanguageConstructs` sniff will now also sniff for the null coalesce equal operator `??=`. This operator is slated to be introduced in PHP 7.2 and PHPCS already accounts for it. [#340](https://github.com/PHPCompatibility/PHPCompatibility/pull/340) +- :star: New `getReturnTypeHintToken()` utility method to the `PHPCompatibility_Sniff` class to retrieve return type hints from function declarations in a cross-PHPCS-version compatible way. [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323). +- :star: New `stripVariables()` utility method to the `PHPCompatibility_Sniff` class to strip variables from interpolated text strings. [#341](https://github.com/PHPCompatibility/PHPCompatibility/pull/314). +- :umbrella: Additional unit tests covering previously uncovered code. [#308](https://github.com/PHPCompatibility/PHPCompatibility/pull/308) + +### Changed +- :pushpin: The `MbstringReplaceEModifier`, `PregReplaceEModifier` and `NewExecutionDirectives` sniffs will now also correctly interpret double quoted text strings with interpolated variables. [#341](https://github.com/PHPCompatibility/PHPCompatibility/pull/314), [#324](https://github.com/PHPCompatibility/PHPCompatibility/pull/324). +- :pushpin: The `NewNullableTypes` sniff will now also report on nullable (return) type hints when used with closures. [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323) +- :pushpin: The `NewReturnTypeDeclarations` sniff will now also report on return type hints when used with closures. [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323) +- :pushpin: Allow for anonymous classes in the `inClassScope()` utility method. [#315](https://github.com/PHPCompatibility/PHPCompatibility/pull/315) +- :pushpin: The function call parameter related utility functions can now also be used to get the individual items from an array declaration. [#300](https://github.com/PHPCompatibility/PHPCompatibility/pull/300) +- :twisted_rightwards_arrows: The `NewScalarReturnTypeDeclarations` sniff has been renamed to `NewReturnTypeDeclarations`. [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323) +- :rewind: The `ForbiddenNames` sniff will now also correctly ignore anonymous classes when used in combination with PHPCS < 2.3.4. [#319](https://github.com/PHPCompatibility/PHPCompatibility/pull/319) +- :rewind: The `NewAnonymousClasses` sniff will now correctly recognize and report on anonymous classes when used in combination with PHPCS < 2.5.2. [#325](https://github.com/PHPCompatibility/PHPCompatibility/pull/325) +- :rewind: The `NewGroupUseDeclarations` sniff will now correctly recognize and report on group use statements when used in combination with PHPCS < 2.6.0. [#320](https://github.com/PHPCompatibility/PHPCompatibility/pull/320) +- :rewind: The `NewNullableTypes` sniff will now correctly recognize and report on nullable return types when used in combination with PHPCS < 2.6.0. [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323) +- :rewind: The `NewReturnTypeDeclarations` sniff will now correctly recognize and report on new return types when used in combination with PHPCS < 2.6.0. [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323) +- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#317](https://github.com/PHPCompatibility/PHPCompatibility/pull/317) +- :recycle: Defer to upstream `hasCondition()` utility method where appropriate. [#315](https://github.com/PHPCompatibility/PHPCompatibility/pull/315) +- :recycle: Minor refactoring of some unit test code. [#304](https://github.com/PHPCompatibility/PHPCompatibility/pull/304), [#303](https://github.com/PHPCompatibility/PHPCompatibility/pull/303), [#318](https://github.com/PHPCompatibility/PHPCompatibility/pull/318) +- :wrench: All unit tests now have appropriate `@group` annotations allowing for quicker/easier testing of a select group of tests/sniffs. [#305](https://github.com/PHPCompatibility/PHPCompatibility/pull/305) +- :wrench: All unit tests now have appropriate `@covers` annotations to improve code coverage reporting and remove bleed through of accidental coverage. [#307](https://github.com/PHPCompatibility/PHPCompatibility/pull/307) +- :wrench: Minor tweaks to the travis script. [#322](https://github.com/PHPCompatibility/PHPCompatibility/pull/322) +- :green_heart: The PHPCompatibility code base itself will now be checked for cross-version compatibility during build testing. [#322](https://github.com/PHPCompatibility/PHPCompatibility/pull/322) + +### Fixed +- :bug: The `ConstantArraysUsingDefine` sniff would throw false positives if the value of the `define()` was retrieved via a function call and an array parameter was passed. [#327](https://github.com/PHPCompatibility/PHPCompatibility/pull/327) +- :bug: The `ForbiddenCallTimePassByReference` sniff would throw false positives on assign by reference within function calls or conditions. [#302](https://github.com/PHPCompatibility/PHPCompatibility/pull/302) Fixes the last two cases reported in [#68](https://github.com/PHPCompatibility/PHPCompatibility/issues/68#issuecomment-231366445) +- :bug: The `ForbiddenGlobalVariableVariableSniff` sniff would only examine the first variable in a `global ...` statement causing unreported issues if subsequent variables were variable variables. [#316](https://github.com/PHPCompatibility/PHPCompatibility/pull/316) +- :bug: The `NewKeywords` sniff would throw a false positive for the `const` keyword when encountered in an interface. [#312](https://github.com/PHPCompatibility/PHPCompatibility/pull/312) +- :bug: The `NewNullableTypes` sniff would not report on nullable return types for namespaced classnames used as a type hint. [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323) +- :bug: The `PregReplaceEModifier` sniff would always consider the first parameter passed as a single regex, while it could also be an array of regexes. This led to false positives and potentially unreported use of the `e` modifier when an array of regexes was passed. [#300](https://github.com/PHPCompatibility/PHPCompatibility/pull/300) +- :bug: The `PregReplaceEModifier` sniff could misidentify the regex delimiter when the regex to be examined was concatenated together from various text strings taken from a compound parameter leading to false positives. [#300](https://github.com/PHPCompatibility/PHPCompatibility/pull/300) +- :white_check_mark: Compatibility with PHPCS 2.7.x. Deal with changed behaviour of the upstream PHP tokenizer and utility function(s). [#313](https://github.com/PHPCompatibility/PHPCompatibility/pull/313), [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323), [#326](https://github.com/PHPCompatibility/PHPCompatibility/pull/326), [#340](https://github.com/PHPCompatibility/PHPCompatibility/pull/340) + +### Credits +Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap: + + +## [7.1.1] - 2016-12-14 + +See all related issues and PRs in the [7.1.1 milestone]. + +### Added +- :star: `ForbiddenNamesAsDeclared` sniff: detection of the PHP 7.1 `iterable` and `void` reserved keywords when used to name classes, interfaces or traits. [#298](https://github.com/PHPCompatibility/PHPCompatibility/pull/298) + +### Fixed +- :bug: The `ForbiddenNamesAsInvokedFunctions` sniff would incorrectly throw an error if the `clone` keyword was used with parenthesis. [#299](https://github.com/PHPCompatibility/PHPCompatibility/pull/299). Fixes [#284](https://github.com/PHPCompatibility/PHPCompatibility/issues/284) + +### Credits +Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap: + + +## [7.1.0] - 2016-12-14 + +See all related issues and PRs in the [7.1.0 milestone]. + +### Added +- :star: New `stringToErrorCode()`, `arrayKeysToLowercase()` and `addMessage()` utility methods to the `PHPCompatibility_Sniff` class. [#291](https://github.com/PHPCompatibility/PHPCompatibility/pull/291). + +### Changed +- :pushpin: All sniff error messages now have modular error codes allowing for selectively disabling individual checks - and even selectively disabling individual sniff for specific files - without disabling the complete sniff. [#291](https://github.com/PHPCompatibility/PHPCompatibility/pull/291) +- :pencil2: Minor changes to some of the error message texts for consistency across sniffs. [#291](https://github.com/PHPCompatibility/PHPCompatibility/pull/291) +- :recycle: Refactored the complex version sniffs to reduce code duplication. [#291](https://github.com/PHPCompatibility/PHPCompatibility/pull/291) +- :recycle: Miscellaneous other refactoring for improved performance and sniff accuracy. [#291](https://github.com/PHPCompatibility/PHPCompatibility/pull/291) +- :umbrella: The unit tests for the `RemovedExtensions` sniff now verify that the correct alternative extension is being suggested. [#291](https://github.com/PHPCompatibility/PHPCompatibility/pull/291) + +### Credits +Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap: + + +## [7.0.8] - 2016-10-31 - :ghost: Spooky! :jack_o_lantern: + +See all related issues and PRs in the [7.0.8 milestone]. + +### Added +- :star2: New `ForbiddenNamesAsDeclared` sniff: detection of the [other reserved keywords](http://php.net/manual/en/reserved.other-reserved-words.php) which are reserved as of PHP 7.0 (or higher). [#287](https://github.com/PHPCompatibility/PHPCompatibility/pull/287). Fixes [#115](https://github.com/PHPCompatibility/PHPCompatibility/issues/115). + These were previously sniffed for by the `ForbiddenNames` and `ForbiddenNamesAsInvokedFunctions` sniffs causing false positives as the rules for their reservation are different from the rules for "normal" [reserved keywords](http://php.net/manual/en/reserved.keywords.php). +- :star: New `inUseScope()` utility method to the `PHPCompatibility_Sniff` class which handles PHPCS cross-version compatibility when determining the scope of a `use` statement. [#271](https://github.com/PHPCompatibility/PHPCompatibility/pull/271). +- :umbrella: More unit tests for the `ForbiddenNames` sniff. [#271](https://github.com/PHPCompatibility/PHPCompatibility/pull/271). + +### Changed +- :pushpin: _Deprecated_ functionality should throw a `warning`. _Removed_ or otherwise unavailable functionality should throw an `error`. This distinction was previously not consistently applied everywhere. [#286](https://github.com/PHPCompatibility/PHPCompatibility/pull/286) + This change affects the following sniffs: + * `DeprecatedPHP4StyleConstructors` will now throw a `warning` instead of an `error` for deprecated PHP4 style class constructors. + * `ForbiddenCallTimePassByReference` will now throw a `warning` if the `testVersion` is `5.3` and an `error` if the `testVersion` if `5.4` or higher. + * `MbstringReplaceEModifier` will now throw a `warning` instead of an `error` for usage of the deprecated `e` modifier. + * `PregReplaceEModifier` will now throw a `warning` if the `testVersion` is `5.5` or `5.6` and an `error` if the `testVersion` if `7.0` or higher. Fixes [#290](https://github.com/PHPCompatibility/PHPCompatibility/issues/290). + * `TernaryOperators` will now throw an `error` when the `testVersion` < `5.3` and the middle part has been omitted. + * `ValidIntegers` will now throw a `warning` when an invalid binary integer is detected. +- :pencil2: `DeprecatedFunctions` and `DeprecatedIniDirectives` sniffs: minor change in the sniff error message text. Use _"removed"_ rather than the ominous _"forbidden"_. [#285](https://github.com/PHPCompatibility/PHPCompatibility/pull/285) + Also updated relevant internal variable names and documentation to match. + +### Fixed +- :bug: `ForbiddenNames` sniff would throw false positives for `use` statements which changed the visibility of methods in traits. [#271](https://github.com/PHPCompatibility/PHPCompatibility/pull/271). +- :bug: `ForbiddenNames` sniff would not report reserved keywords when used in combination with `use function` or `use const`. [#271](https://github.com/PHPCompatibility/PHPCompatibility/pull/271). +- :bug: `ForbiddenNames` sniff would potentially - unintentionally - skip over tokens, thereby - potentially - not reporting all errors. [#271](https://github.com/PHPCompatibility/PHPCompatibility/pull/271). +- :wrench: Composer config: `prefer-stable` should be a root element of the json file. Fixes [#277](https://github.com/PHPCompatibility/PHPCompatibility/issues/277). + +### Credits +Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap: + + +## [7.0.7] - 2016-10-20 + +See all related issues and PRs in the [7.0.7 milestone]. + +### Added +- :star2: New `ForbiddenBreakContinueOutsideLoop` sniff: verify that `break`/`continue` is not used outside of a loop structure. This will cause fatal errors since PHP 7.0. [#278](https://github.com/PHPCompatibility/PHPCompatibility/pull/278). Fixes [#275](https://github.com/PHPCompatibility/PHPCompatibility/issues/275) +- :star2: New `NewConstVisibility` sniff: detect visibility indicators for `class` and `interface` constants as introduced in PHP 7.1. [#280](https://github.com/PHPCompatibility/PHPCompatibility/pull/280). Fixes [#249](https://github.com/PHPCompatibility/PHPCompatibility/issues/249) +- :star2: New `NewHashAlgorithms` sniff to check used hash algorithms against the PHP version in which they were introduced. [#242](https://github.com/PHPCompatibility/PHPCompatibility/pull/242) +- :star2: New `NewMultiCatch` sniff: detect catch statements catching multiple Exceptions as introduced in PHP 7.1. [#281](https://github.com/PHPCompatibility/PHPCompatibility/pull/281). Fixes [#251](https://github.com/PHPCompatibility/PHPCompatibility/issues/251) +- :star2: New `NewNullableTypes` sniff: detect nullable parameter and return type hints (only supported in PHPCS >= 2.3.4) as introduced in PHP 7.1. [#282](https://github.com/PHPCompatibility/PHPCompatibility/pull/282). Fixes [#247](https://github.com/PHPCompatibility/PHPCompatibility/issues/247) +- :star: `DeprecatedIniDirectives` sniff: recognize PHP 7.1 removed `session` ini directives. [#256](https://github.com/PHPCompatibility/PHPCompatibility/pull/256) +- :star: `NewFunctions` sniff: recognize new `socket_export_stream()` function as introduced in PHP 7.0.7. [#264](https://github.com/PHPCompatibility/PHPCompatibility/pull/264) +- :star: `NewFunctions` sniff: recognize new `curl_...()`, `is_iterable()`, `pcntl_async_signals()`, `session_create_id()`, `session_gc()` functions as introduced in PHP 7.1. [#273](https://github.com/PHPCompatibility/PHPCompatibility/pull/273) +- :star: `NewFunctionParameters` sniff: recognize new OpenSSL function parameters as introduced in PHP 7.1. [#258](https://github.com/PHPCompatibility/PHPCompatibility/pull/258) +- :star: `NewIniDirectives` sniff: recognize new `session` ini directives as introduced in PHP 7.1. [#259](https://github.com/PHPCompatibility/PHPCompatibility/pull/259) +- :star: `NewScalarReturnTypeDeclarations` sniff: recognize PHP 7.1 `void` return type hint. [#250](https://github.com/PHPCompatibility/PHPCompatibility/pull/250) +- :star: `NewScalarTypeDeclarations` sniff: recognize PHP 7.1 `iterable` type hint. [#255](https://github.com/PHPCompatibility/PHPCompatibility/pull/255) +- :star: Recognize the PHP 7.1 deprecated `mcrypt` functionality in the `RemovedExtensions`, `DeprecatedFunctions` and `DeprecatedIniDirectives` sniffs. [#257](https://github.com/PHPCompatibility/PHPCompatibility/pull/257) + +### Changed +- :pushpin: `LongArrays` sniff used to only throw `warning`s. It will now throw `error`s for PHP versions in which the long superglobals have been removed. [#270](https://github.com/PHPCompatibility/PHPCompatibility/pull/270) +- :pushpin: The `NewIniDirectives` sniff used to always throw an `warning`. Now it will throw an `error` when a new ini directive is used in combination with `ini_set()`. [#246](https://github.com/PHPCompatibility/PHPCompatibility/pull/246). +- :pushpin: `RemovedHashAlgorithms` sniff: also recognize removed algorithms when used with the PHP 5.5+ `hash_pbkdf2()` function. [#240](https://github.com/PHPCompatibility/PHPCompatibility/pull/240) +- :pushpin: Properly recognize nullable type hints in the `getMethodParameters()` utility method. [#282](https://github.com/PHPCompatibility/PHPCompatibility/pull/282) +- :pencil2: `DeprecatedPHP4StyleConstructors` sniff: minor error message text fix. [#236](https://github.com/PHPCompatibility/PHPCompatibility/pull/236) +- :pencil2: `NewIniDirectives` sniff: improved precision for the introduction version numbers being reported. [#246](https://github.com/PHPCompatibility/PHPCompatibility/pull/246) +- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#238](https://github.com/PHPCompatibility/PHPCompatibility/pull/238), [#244](https://github.com/PHPCompatibility/PHPCompatibility/pull/244), [#240](https://github.com/PHPCompatibility/PHPCompatibility/pull/240), [#276](https://github.com/PHPCompatibility/PHPCompatibility/pull/276) +- :umbrella: Re-activate the unit tests for the `NewScalarReturnTypeDeclarations` sniff. [#250](https://github.com/PHPCompatibility/PHPCompatibility/pull/250) + +### Fixed +- :bug: The `DeprecatedPHP4StyleConstructors` sniff would not report errors when the case of the class name and the PHP4 constructor function name did not match. [#236](https://github.com/PHPCompatibility/PHPCompatibility/pull/236) +- :bug: `LongArrays` sniff would report false positives for class properties shadowing removed PHP superglobals. [#270](https://github.com/PHPCompatibility/PHPCompatibility/pull/270). Fixes [#268](https://github.com/PHPCompatibility/PHPCompatibility/issues/268). +- :bug: The `NewClasses` sniff would not report errors when the case of the class name used and "official" class name did not match. [#237](https://github.com/PHPCompatibility/PHPCompatibility/pull/237) +- :bug: The `NewIniDirectives` sniff would report violations against the PHP version in which the ini directive was introduced. This should be the version below it. [#246](https://github.com/PHPCompatibility/PHPCompatibility/pull/246) +- :bug: `PregReplaceEModifier` sniff would report false positives for compound regex parameters with different quote types. [#266](https://github.com/PHPCompatibility/PHPCompatibility/pull/266). Fixes [#265](https://github.com/PHPCompatibility/PHPCompatibility/issues/265). +- :bug: `RemovedGlobalVariables` sniff would report false positives for lowercase/mixed cased variables shadowing superglobals. [#245](https://github.com/PHPCompatibility/PHPCompatibility/pull/245). +- :bug: The `RemovedHashAlgorithms` sniff would not report errors when the case of the hash function name used and "official" class name did not match. [#240](https://github.com/PHPCompatibility/PHPCompatibility/pull/240) +- :bug: The `ShortArray` sniff would report all violations on the line of the PHP open tag, not on the lines of the short array open/close tags. [#238](https://github.com/PHPCompatibility/PHPCompatibility/pull/238) + +### Credits +Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap: + + +## [7.0.6] - 2016-09-23 + +See all related issues and PRs in the [7.0.6 milestone]. + +### Added +- :star: New `stripQuotes()` utility method in the `PHPCompatibility_Sniff` base class to strip quotes which surround text strings in a consistent manner. [#224](https://github.com/PHPCompatibility/PHPCompatibility/pull/224) +- :books: Readme: Add _PHP Version Support_ section. [#225](https://github.com/PHPCompatibility/PHPCompatibility/pull/225) + +### Changed +- :pushpin: The `ForbiddenCallTimePassByReference` sniff will now also report the deprecation as of PHP 5.3, not just its removal as of PHP 5.4. [#203](https://github.com/PHPCompatibility/PHPCompatibility/pull/203) +- :pushpin: The `NewFunctionArrayDereferencing` sniff will now also check _method_ calls for array dereferencing, not just function calls. [#229](https://github.com/PHPCompatibility/PHPCompatibility/pull/229). Fixes [#227](https://github.com/PHPCompatibility/PHPCompatibility/issues/227). +- :pencil2: The `NewExecutionDirectives` sniff will now throw `warning`s instead of `error`s for invalid values encountered in execution directives. [#223](https://github.com/PHPCompatibility/PHPCompatibility/pull/223) +- :pencil2: Minor miscellaneous fixes. [#231](https://github.com/PHPCompatibility/PHPCompatibility/pull/231) +- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#219](https://github.com/PHPCompatibility/PHPCompatibility/pull/219), [#203](https://github.com/PHPCompatibility/PHPCompatibility/pull/203) +- :recycle: Defer to upstream `findImplementedInterfaceNames()` utility method when it exists. [#222](https://github.com/PHPCompatibility/PHPCompatibility/pull/222) +- :wrench: Exclude the test files from analysis by Scrutinizer CI. [#230](https://github.com/PHPCompatibility/PHPCompatibility/pull/230) + +### Removed +- :no_entry_sign: Some redundant code. [#232](https://github.com/PHPCompatibility/PHPCompatibility/pull/232) + +### Fixed +- :bug: The `EmptyNonVariable` sniff would throw false positives for variable variables and for array access with a (partially) variable array index. [#212](https://github.com/PHPCompatibility/PHPCompatibility/pull/212). Fixes [#210](https://github.com/PHPCompatibility/PHPCompatibility/issues/210). +- :bug: The `NewFunctionArrayDereferencing` sniff would throw false positives for lines of code containing both a function call as well as square brackets, even when they were unrelated. [#228](https://github.com/PHPCompatibility/PHPCompatibility/pull/228). Fixes [#226](https://github.com/PHPCompatibility/PHPCompatibility/issues/226). +- :bug: `ParameterShadowSuperGlobals` sniff would report false positives for lowercase/mixed cased variables shadowing superglobals. [#218](https://github.com/PHPCompatibility/PHPCompatibility/pull/218). Fixes [#214](https://github.com/PHPCompatibility/PHPCompatibility/issues/214). +- :bug: The `determineNamespace()` utility method now accounts properly for namespaces within scoped `declare()` statements. [#221](https://github.com/PHPCompatibility/PHPCompatibility/pull/221) +- :books: Readme: Logo alignment in the Credits section. [#233](https://github.com/PHPCompatibility/PHPCompatibility/pull/233) + +### Credits +Thanks go out to [Jason Stallings], [Juliette Reinders Folmer] and [Mark Clements] for their contributions to this version. :clap: + + +## [7.0.5] - 2016-09-08 + +See all related issues and PRs in the [7.0.5 milestone]. + +### Added +- :star2: New `MbstringReplaceEModifier` sniff to detect the use of the PHP 7.1 deprecated `e` modifier in Mbstring regex functions. [#202](https://github.com/PHPCompatibility/PHPCompatibility/pull/202) +- :star: The `ForbiddenBreakContinueVariableArguments` sniff will now also report on `break 0`/`continue 0` which is not allowed since PHP 5.4. [#209](https://github.com/PHPCompatibility/PHPCompatibility/pull/209) +- :star: New `getFunctionCallParameters()`, `getFunctionCallParameter()` utility methods in the `PHPCompatibility_Sniff` base class. [#170](https://github.com/PHPCompatibility/PHPCompatibility/pull/170) +- :star: New `tokenHasScope()` utility method in the `PHPCompatibility_Sniff` base class. [#189](https://github.com/PHPCompatibility/PHPCompatibility/pull/189) +- :umbrella: Unit test for `goto` and `callable` detection and some other miscellanous extra unit tests for the `NewKeywords` sniff. [#189](https://github.com/PHPCompatibility/PHPCompatibility/pull/189) +- :books: Readme: Information for sniff developers about running unit tests for _other_ sniff libraries using the PHPCS native test framework without running into conflicts with the PHPCompatibility specific unit test framework. [#217](https://github.com/PHPCompatibility/PHPCompatibility/pull/217) + +### Changed +- :pushpin: The `ForbiddenNames` sniff will now also check interface declarations for usage of reserved keywords. [#200](https://github.com/PHPCompatibility/PHPCompatibility/pull/200) +- :pushpin: `PregReplaceEModifier` sniff: improved handling of regexes build up of a combination of variables, function calls and/or text strings. [#201](https://github.com/PHPCompatibility/PHPCompatibility/pull/201) +- :rewind: The `NewKeywords` sniff will now also correctly recognize new keywords when used in combination with older PHPCS versions and/or run on older PHP versions. [#189](https://github.com/PHPCompatibility/PHPCompatibility/pull/189) +- :pencil2: `PregReplaceEModifier` sniff: minor improvement to the error message text. [#201](https://github.com/PHPCompatibility/PHPCompatibility/pull/201) +- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#170](https://github.com/PHPCompatibility/PHPCompatibility/pull/170), [#188](https://github.com/PHPCompatibility/PHPCompatibility/pull/188), [#189](https://github.com/PHPCompatibility/PHPCompatibility/pull/189), [#199](https://github.com/PHPCompatibility/PHPCompatibility/pull/199), [#200](https://github.com/PHPCompatibility/PHPCompatibility/pull/200), [#201](https://github.com/PHPCompatibility/PHPCompatibility/pull/201), [#208](https://github.com/PHPCompatibility/PHPCompatibility/pull/208) +- :wrench: The unit tests for the utility methods have been moved to their own subdirectory within `Tests`. [#215](https://github.com/PHPCompatibility/PHPCompatibility/pull/215) +- :green_heart: The sniffs are now also tested against PHP 7.1 for consistent results. [#216](https://github.com/PHPCompatibility/PHPCompatibility/pull/216) + +### Removed +- :no_entry_sign: Some redundant code. [26d0b6](https://github.com/PHPCompatibility/PHPCompatibility/commit/26d0b6cf0921f75d93a4faaf09c390f386dde9ff) and [841616](https://github.com/PHPCompatibility/PHPCompatibility/commit/8416162ea81f4067226324f5948f4a50f7958a9b) + +### Fixed +- :bug: `ConstantArraysUsingDefine` sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. [#199](https://github.com/PHPCompatibility/PHPCompatibility/pull/199) +- :bug: The `DeprecatedIniDirectives` and `NewIniDirectives` sniffs could potentially trigger on the ini value instead of the ini directive name. [#170](https://github.com/PHPCompatibility/PHPCompatibility/pull/170) +- :bug: `ForbiddenNames` sniff: Reserved keywords when used as the name of a constant declared using `define()` would always be reported independently of the `testVersion` set. [#200](https://github.com/PHPCompatibility/PHPCompatibility/pull/200) +- :bug: `PregReplaceEModifier` sniff would not report errors when the function name used was not in lowercase. [#201](https://github.com/PHPCompatibility/PHPCompatibility/pull/201) +- :bug: `TernaryOperators` sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. [#188](https://github.com/PHPCompatibility/PHPCompatibility/pull/188) +- :bug: The `getFQClassNameFromNewToken()` and `getFQClassNameFromDoubleColonToken()` utility methods would get confused when the class name was a variable instead of being hard-coded, resulting in a PHP warning being thown. [#206](https://github.com/PHPCompatibility/PHPCompatibility/pull/206). Fixes [#205](https://github.com/PHPCompatibility/PHPCompatibility/issues/205). +- :bug: The `getFunctionCallParameters()` utility method would incorrectly identify an extra parameter if the last parameter passed to a function would have an - unnecessary - comma after it. The `getFunctionCallParameters()` utility method also did not handle parameters passed as short arrays correctly. [#213](https://github.com/PHPCompatibility/PHPCompatibility/pull/213). Fixes [#211](https://github.com/PHPCompatibility/PHPCompatibility/issues/211). +- :umbrella: Unit tests for the `NewFunctionArrayDereferencing` sniff were not being run due to a naming error. [#208](https://github.com/PHPCompatibility/PHPCompatibility/pull/208) +- :books: Readme: Information about setting the `testVersion` from a custom ruleset was incorrect. [#204](https://github.com/PHPCompatibility/PHPCompatibility/pull/204) +- :wrench: Path to PHPCS in the unit tests breaking for non-Composer installs. [#198](https://github.com/PHPCompatibility/PHPCompatibility/pull/198) + +### Credits +Thanks go out to [Juliette Reinders Folmer] and [Yoshiaki Yoshida] for their contributions to this version. :clap: + + +## [7.0.4] - 2016-08-20 + +See all related issues and PRs in the [7.0.4 milestone]. + +### Added +- :star2: New `EmptyNonVariable` sniff: detection of empty being used on non-variables for PHP < 5.5. [#187](https://github.com/PHPCompatibility/PHPCompatibility/pull/187) +- :star2: New `NewMagicMethods` sniff: detection of declaration of magic methods before the method became "magic". Includes a check for the changed behaviour for the `__toString()` magic method in PHP 5.2. [#176](https://github.com/PHPCompatibility/PHPCompatibility/pull/176). Fixes [#64](https://github.com/PHPCompatibility/PHPCompatibility/issues/64). +- :star2: New `RemovedAlternativePHPTags` sniff: detection of ASP and script open tags for which support was removed in PHP 7.0. [#184](https://github.com/PHPCompatibility/PHPCompatibility/pull/184), [#193](https://github.com/PHPCompatibility/PHPCompatibility/pull/193). Fixes [#127](https://github.com/PHPCompatibility/PHPCompatibility/issues/127). +- :star: `NonStaticMagicMethods` sniff: detection of the `__callStatic()`, `__sleep()`, `__toString()` and `__set_state()` magic methods. +- :green_heart: Lint all non-test case files for syntax errors during the build testing by Travis. [#192](https://github.com/PHPCompatibility/PHPCompatibility/pull/192) + +### Changed +- :pushpin: `NonStaticMagicMethods` sniff: will now also sniff `trait`s for magic methods. [#174](https://github.com/PHPCompatibility/PHPCompatibility/pull/174) +- :pushpin: `NonStaticMagicMethods` sniff: will now also check for magic methods which should be declared as `static`. [#174](https://github.com/PHPCompatibility/PHPCompatibility/pull/174) +- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#178](https://github.com/PHPCompatibility/PHPCompatibility/pull/178), [#179](https://github.com/PHPCompatibility/PHPCompatibility/pull/179), [#174](https://github.com/PHPCompatibility/PHPCompatibility/pull/174), [#171](https://github.com/PHPCompatibility/PHPCompatibility/pull/171) +- :recycle: The unit test suite now internally caches PHPCS run results in combination with a set `testVersion` to speed up the running of the unit tests. These are now ~3 x faster. [#148](https://github.com/PHPCompatibility/PHPCompatibility/pull/148) +- :books: Readme: Minor clarification of the minimum requirements. +- :books: Readme: Advise to use the latest stable version of this repository. +- :wrench: The unit tests can now be run with PHPCS installed in an arbitrary location by passing the location through an environment option. [#191](https://github.com/PHPCompatibility/PHPCompatibility/pull/191). +- :wrench: Improved coveralls configuration and compatibility. [#194](https://github.com/PHPCompatibility/PHPCompatibility/pull/194) +- :green_heart: The sniffs are now also tested against PHP 5.2 for consistent results. Except for namespace, trait and group use related errors, most sniffs work as intended on PHP 5.2. [#196](https://github.com/PHPCompatibility/PHPCompatibility/pull/196) + +### Fixed +- :bug: The `ForbiddenBreakContinueVariableArguments` sniff would not report on `break`/`continue` with a closure as an argument. [#171](https://github.com/PHPCompatibility/PHPCompatibility/pull/171) +- :bug: The `ForbiddenNamesAsInvokedFunctions` sniff would not report on reserved keywords which were not lowercase. [#186](https://github.com/PHPCompatibility/PHPCompatibility/pull/186) +- :bug: The `ForbiddenNamesAsInvokedFunctions` sniff would not report on the `goto` and `namespace` keywords when run on PHP 5.2. [#193](https://github.com/PHPCompatibility/PHPCompatibility/pull/193) +- :bug: `NewAnonymousClasses` sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. [#195](https://github.com/PHPCompatibility/PHPCompatibility/pull/195). +- :bug: `NewGroupUseDeclarations` sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. [#190](https://github.com/PHPCompatibility/PHPCompatibility/pull/190). +- :bug: The `NonStaticMagicMethods` sniff would not report on magic methods when the function name as declared was not in the same case as used in the PHP manual. [#174](https://github.com/PHPCompatibility/PHPCompatibility/pull/174) +- :wrench: The unit tests would exit with `0` if PHPCS could not be found. [#191](https://github.com/PHPCompatibility/PHPCompatibility/pull/191) +- :green_heart: The PHPCompatibility library itself was not fully compatible with PHP 5.2. [#193](https://github.com/PHPCompatibility/PHPCompatibility/pull/193) + +### Credits +Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap: + + +## [7.0.3] - 2016-08-18 + +See all related issues and PRs in the [7.0.3 milestone]. + +### Added +- :star2: New `InternalInterfaces` sniff: detection of internal PHP interfaces being which should not be implemented by user land classes. [#144](https://github.com/PHPCompatibility/PHPCompatibility/pull/144) +- :star2: New `LateStaticBinding` sniff: detection of PHP 5.3 late static binding. [#177](https://github.com/PHPCompatibility/PHPCompatibility/pull/177) +- :star2: New `NewExecutionDirectives` sniff: verify execution directives set with `declare()`. [#169](https://github.com/PHPCompatibility/PHPCompatibility/pull/169) +- :star2: New `NewInterfaces` sniff: detection of the use of newly introduced PHP native interfaces. This sniff will also detect unsupported methods when a class implements the `Serializable` interface. [#144](https://github.com/PHPCompatibility/PHPCompatibility/pull/144) +- :star2: New `RequiredOptionalFunctionParameters` sniff: detection of missing function parameters which were required in earlier PHP versions only to become optional in later versions. [#165](https://github.com/PHPCompatibility/PHPCompatibility/pull/165) +- :star2: New `ValidIntegers` sniff: detection of binary integers for PHP < 5.4, detection of hexademical numeric strings for which recognition as hex integers was removed in PHP 7.0, detection of invalid binary and octal integers. [#160](https://github.com/PHPCompatibility/PHPCompatibility/pull/160). Fixes [#55](https://github.com/PHPCompatibility/PHPCompatibility/issues/55). +- :star: `DeprecatedExtensions` sniff: detect removal of the `ereg` extension in PHP 7. [#149](https://github.com/PHPCompatibility/PHPCompatibility/pull/149) +- :star: `DeprecatedFunctions` sniff: detection of the PHP 5.0.5 deprecated `php_check_syntax()` and PHP 5.4 deprecated `mysqli_get_cache_stats()` functions. [#155](https://github.com/PHPCompatibility/PHPCompatibility/pull/155). +- :star: `DeprecatedFunctions` sniff: detect deprecation of a number of the `mysqli` functions in PHP 5.3. [#149](https://github.com/PHPCompatibility/PHPCompatibility/pull/149) +- :star: `DeprecatedFunctions` sniff: detect removal of the `call_user_method()`, `ldap_sort()`, `ereg_*()` and `mysql_*()` functions in PHP 7.0. [#149](https://github.com/PHPCompatibility/PHPCompatibility/pull/149) +- :star: `DeprecatedIniDirectives` sniff: detection of a _lot_ more deprecated/removed ini directives. [#146](https://github.com/PHPCompatibility/PHPCompatibility/pull/146) +- :star: `NewFunctionParameters` sniff: detection of a _lot_ more new function parameters. [#164](https://github.com/PHPCompatibility/PHPCompatibility/pull/164) +- :star: `NewFunctions` sniff: detection of numerous extra new functions. [#161](https://github.com/PHPCompatibility/PHPCompatibility/pull/161) +- :star: `NewIniDirectives` sniff: detection of a _lot_ more new ini directives. [#146](https://github.com/PHPCompatibility/PHPCompatibility/pull/146) +- :star: `NewLanguageConstructs` sniff: detection of the PHP 5.6 ellipsis `...` construct. [#175](https://github.com/PHPCompatibility/PHPCompatibility/pull/175) +- :star: `NewScalarTypeDeclarations` sniff: detection of PHP 5.1 `array` and PHP 5.4 `callable` type hints. [#168](https://github.com/PHPCompatibility/PHPCompatibility/pull/168) +- :star: `RemovedFunctionParameters` sniff: detection of a few extra removed function parameters. [#163](https://github.com/PHPCompatibility/PHPCompatibility/pull/163) +- :star: Detection of functions and methods with a double underscore prefix as these are reserved by PHP for future use. The existing upstream `Generic.NamingConventions.CamelCapsFunctionName` sniff is re-used for this with some customization. [#173](https://github.com/PHPCompatibility/PHPCompatibility/pull/173) +- :star: New `getFQClassNameFromNewToken()`, `getFQExtendedClassName()`, `getFQClassNameFromDoubleColonToken()`, `getFQName()`, `isNamespaced()`, `determineNamespace()` and `getDeclaredNamespaceName()` utility methods in the `PHPCompatibility_Sniff` base class for namespace determination. [#162](https://github.com/PHPCompatibility/PHPCompatibility/pull/162) +- :recycle: New `inClassScope()` utility method in the `PHPCompatibility_Sniff` base class. [#168](https://github.com/PHPCompatibility/PHPCompatibility/pull/168) +- :recycle: New `doesFunctionCallHaveParameters()` and `getFunctionCallParameterCount()` utility methods in the `PHPCompatibility_Sniff` base class. [#153](https://github.com/PHPCompatibility/PHPCompatibility/pull/153) +- :umbrella: Unit test for `__halt_compiler()` detection by the `NewKeywords` sniff. +- :umbrella: Unit tests for the `NewFunctions` sniff. [#161](https://github.com/PHPCompatibility/PHPCompatibility/pull/161) +- :umbrella: Unit tests for the `ParameterShadowSuperGlobals` sniff. [#180](https://github.com/PHPCompatibility/PHPCompatibility/pull/180) +- :wrench: Minimal config for Scrutinizer CI. [#145](https://github.com/PHPCompatibility/PHPCompatibility/pull/145). + +### Changed +- :pushpin: The `DeprecatedIniDirectives` and the `NewIniDirectives` sniffs will now indicate an alternative ini directive in case the directive has been renamed. [#146](https://github.com/PHPCompatibility/PHPCompatibility/pull/146) +- :pushpin: The `NewClasses` sniff will now also report on new classes being extended by child classes. [#140](https://github.com/PHPCompatibility/PHPCompatibility/pull/140). +- :pushpin: The `NewClasses` sniff will now also report on static use of new classes. [#162](https://github.com/PHPCompatibility/PHPCompatibility/pull/162). +- :pushpin: The `NewScalarTypeDeclarations` sniff will now throw an error on use of type hints pre-PHP 5.0. [#168](https://github.com/PHPCompatibility/PHPCompatibility/pull/168) +- :pushpin: The `NewScalarTypeDeclarations` sniff will now verify type hints used against typical mistakes. [#168](https://github.com/PHPCompatibility/PHPCompatibility/pull/168) +- :pushpin: The `ParameterShadowSuperGlobals` sniff will now do a case-insensitive variable name compare. [#180](https://github.com/PHPCompatibility/PHPCompatibility/pull/180) +- :pushpin: The `RemovedFunctionParameters` sniff will now also report `warning`s on deprecation of function parameters. [#163](https://github.com/PHPCompatibility/PHPCompatibility/pull/163) +- :twisted_rightwards_arrows: The check for `JsonSerializable` has been moved from the `NewClasses` sniff to the `NewInterfaces` sniff. [#162](https://github.com/PHPCompatibility/PHPCompatibility/pull/162) +- :rewind: The `NewLanguageConstructs` sniff will now also recognize new language constructs when used in combination with PHPCS 1.5.x. [#175](https://github.com/PHPCompatibility/PHPCompatibility/pull/175) +- :pencil2: `NewFunctionParameters` sniff: use correct name for the new parameter for the `dirname()` function. [#164](https://github.com/PHPCompatibility/PHPCompatibility/pull/164) +- :pencil2: `NewScalarTypeDeclarations` sniff: minor change in the sniff error message text. [#168](https://github.com/PHPCompatibility/PHPCompatibility/pull/168) +- :pencil2: `RemovedFunctionParameters` sniff: minor change in the sniff error message text. [#163](https://github.com/PHPCompatibility/PHPCompatibility/pull/163) +- :pencil2: The `ParameterShadowSuperGlobals` sniff now extends the `PHPCompatibility_Sniff` class. [#180](https://github.com/PHPCompatibility/PHPCompatibility/pull/180) +- :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#181](https://github.com/PHPCompatibility/PHPCompatibility/pull/181), [#182](https://github.com/PHPCompatibility/PHPCompatibility/pull/182), [#166](https://github.com/PHPCompatibility/PHPCompatibility/pull/166), [#167](https://github.com/PHPCompatibility/PHPCompatibility/pull/167), [#172](https://github.com/PHPCompatibility/PHPCompatibility/pull/172), [#180](https://github.com/PHPCompatibility/PHPCompatibility/pull/180), [#146](https://github.com/PHPCompatibility/PHPCompatibility/pull/146), [#138](https://github.com/PHPCompatibility/PHPCompatibility/pull/138) +- :recycle: Various refactoring to remove code duplication in the unit tests and add proper test skip notifications where relevant. [#139](https://github.com/PHPCompatibility/PHPCompatibility/pull/139), [#149](https://github.com/PHPCompatibility/PHPCompatibility/pull/149) + +### Fixed +- :bug: The `DeprecatedFunctions` sniff was reporting an incorrect deprecation/removal version number for a few functions. [#149](https://github.com/PHPCompatibility/PHPCompatibility/pull/149) +- :bug: The `DeprecatedIniDirectives` sniff was in select cases reporting deprecation of an ini directive prior to removal, while the ini directive was never deprecated prior to its removal. [#146](https://github.com/PHPCompatibility/PHPCompatibility/pull/146) +- :bug: The `DeprecatedPHP4StyleConstructors` sniff would cause false positives for methods with the same name as the class in namespaced classes. [#167](https://github.com/PHPCompatibility/PHPCompatibility/pull/167) +- :bug: The `ForbiddenEmptyListAssignment` sniff did not report errors when there were only comments or parentheses between the list parentheses. [#166](https://github.com/PHPCompatibility/PHPCompatibility/pull/166) +- :bug: The `ForbiddenEmptyListAssignment` sniff will no longer cause false positives during live coding. [#166](https://github.com/PHPCompatibility/PHPCompatibility/pull/166) +- :bug: The `NewClasses` sniff would potentially misidentify namespaced classes as PHP native classes. [#161](https://github.com/PHPCompatibility/PHPCompatibility/pull/162) +- :bug: The `NewFunctions` sniff would fail to identify called functions when the function call was not lowercase. [#161](https://github.com/PHPCompatibility/PHPCompatibility/pull/161) +- :bug: The `NewFunctions` sniff would potentially misidentify namespaced userland functions as new functions. [#161](https://github.com/PHPCompatibility/PHPCompatibility/pull/161) +- :bug: The `NewIniDirectives` sniff was reporting an incorrect introduction version number for a few ini directives. [#146](https://github.com/PHPCompatibility/PHPCompatibility/pull/146) +- :bug: `NewKeywords` sniff: the use of the `const` keyword should only be reported when used outside of a class for PHP < 5.3. [#147](https://github.com/PHPCompatibility/PHPCompatibility/pull/147). Fixes [#129](https://github.com/PHPCompatibility/PHPCompatibility/issues/129). +- :bug: The `RemovedExtensions` sniff was incorrectly reporting a number of extensions as being removed in PHP 5.3 while they were actually removed in PHP 5.1. [#156](https://github.com/PHPCompatibility/PHPCompatibility/pull/156) +- :bug: :recycle: The `NewFunctionParameters` and `RemovedFunctionParameters` now use the new `doesFunctionCallHaveParameters()` and `getFunctionCallParameterCount()` utility methods for improved accuracy in identifying function parameters. This fixes several false positives. [#153](https://github.com/PHPCompatibility/PHPCompatibility/pull/153) Fixes [#120](https://github.com/PHPCompatibility/PHPCompatibility/issues/120), [#151](https://github.com/PHPCompatibility/PHPCompatibility/issues/151), [#152](https://github.com/PHPCompatibility/PHPCompatibility/issues/152). +- :bug: A number of sniffs would return `false` if the examined construct was not found. This could potentially cause race conditions/infinite sniff loops. [#138](https://github.com/PHPCompatibility/PHPCompatibility/pull/138) +- :wrench: The unit tests would fail to run when used in combination with a PEAR install of PHPCS. [#157](https://github.com/PHPCompatibility/PHPCompatibility/pull/157). +- :green_heart: Unit tests failing against PHPCS 2.6.1. [#158](https://github.com/PHPCompatibility/PHPCompatibility/pull/158) + The unit tests *will* still fail against PHPCS 2.6.2 due to a bug in PHPCS itself. This bug does not affect the running of the sniffs outside of a unit test context. + +### Credits +Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap: + + +## [7.0.2] - 2016-08-03 + +See all related issues and PRs in the [7.0.2 milestone]. + +### Added +- :star: `RemovedExtensions` sniff: ability to whitelist userland functions for which the function prefix overlaps with a prefix of a deprecated/removed extension. [#130](https://github.com/PHPCompatibility/PHPCompatibility/pull/130). Fixes [#123](https://github.com/PHPCompatibility/PHPCompatibility/issues/123). + To use this feature, add the `functionWhitelist` property in your custom ruleset. For more information, see the [README](https://github.com/PHPCompatibility/PHPCompatibility#phpcompatibility-specific-options). + +### Changed +- :pencil2: A number of sniffs contained `public` class properties. Within PHPCS, `public` properties can be overruled via a custom ruleset. This was not the intention, so the visibility of these properties has been changed to `protected`. [#135](https://github.com/PHPCompatibility/PHPCompatibility/pull/135) +- :wrench: Composer config: Stable packages are preferred over unstable/dev. +- :pencil2: Ruleset name. [#134](https://github.com/PHPCompatibility/PHPCompatibility/pull/134) + +### Credits +Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap: + + +## [7.0.1] - 2016-08-02 + +See all related issues and PRs in the [7.0.1 milestone]. + +### Changed +- :pushpin: The `DeprecatedIniDirectives` sniff used to throw an `error` when a deprecated ini directive was used in combination with `ini_get()`. It will now throw a `warning` instead. [#122](https://github.com/PHPCompatibility/PHPCompatibility/pull/122) Fixes [#119](https://github.com/PHPCompatibility/PHPCompatibility/issues/119). + Usage of deprecated ini directives in combination with `ini_set()` will still throw an `error`. +- :pushpin: The `PregReplaceEModifier` sniff now also detects the `e` modifier when used with the `preg_filter()` function. While this is undocumented, the `e` modifier was supported by the `preg_filter()` function as well. [#128](https://github.com/PHPCompatibility/PHPCompatibility/pull/128) +- :pencil2: The `RemovedExtensions` sniff contained superfluous deprecation information in the error message. [#131](https://github.com/PHPCompatibility/PHPCompatibility/pull/131) + +### Removed +- :wrench: Duplicate builds from the Travis CI build matrix. [#132](https://github.com/PHPCompatibility/PHPCompatibility/pull/132) + +### Fixed +- :bug: The `ForbiddenNames` sniff did not allow for the PHP 5.6 `use function ...` and `use const ...` syntax. [#126](https://github.com/PHPCompatibility/PHPCompatibility/pull/126) Fixes [#124](https://github.com/PHPCompatibility/PHPCompatibility/issues/124). +- :bug: The `NewClasses` sniff failed to detect new classes when the class was instantiated without parenthesis, i.e. `new NewClass;`. [#121](https://github.com/PHPCompatibility/PHPCompatibility/pull/121) +- :bug: The `PregReplaceEModifier` sniff failed to detect the `e` modifier when using bracket delimiters for the regex other than the `{}` brackets. [#128](https://github.com/PHPCompatibility/PHPCompatibility/pull/128) +- :green_heart: Unit tests failing against PHPCS 2.6.1. + +### Credits +Thanks go out to [Jason Stallings], [Juliette Reinders Folmer] and [Ryan Neufeld] for their contributions to this version. :clap: + + +## [7.0] - 2016-07-02 + +See all related issues and PRs in the [7.0 milestone]. + +### Added +- :zap: Ability to specify a range of PHP versions against which to test your code base for compatibility, i.e. `--runtime-set testVersion 5.0-5.4` will now test your code for compatibility with PHP 5.0 up to PHP 5.4. [#99](https://github.com/PHPCompatibility/PHPCompatibility/pull/99) +- :star2: New `NewFunctionArrayDereferencing` sniff to detect function array dereferencing as introduced in PHP 5.4. Fixes [#52](https://github.com/PHPCompatibility/PHPCompatibility/issues/52). +- :star2: New `ShortArray` sniff to detect short array syntax as introduced in PHP 5.4. [#97](https://github.com/PHPCompatibility/PHPCompatibility/pull/97). Fixes [#47](https://github.com/PHPCompatibility/PHPCompatibility/issues/47). +- :star2: New `TernaryOperators` sniff to detect ternaries without the middle part (`elvis` operator) as introduced in PHP 5.3. [#101](https://github.com/PHPCompatibility/PHPCompatibility/pull/101), [#103](https://github.com/PHPCompatibility/PHPCompatibility/pull/103). Fixes [#49](https://github.com/PHPCompatibility/PHPCompatibility/issues/49). +- :star2: New `ConstantArraysUsingDefine` sniff to detect constants declared using `define()` being assigned an `array` value which was not allowed prior to PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110) +- :star2: New `DeprecatedPHP4StyleConstructors` sniff to detect PHP 4 style class constructor methods which are deprecated as of PHP 7. [#109](https://github.com/PHPCompatibility/PHPCompatibility/pull/109). +- :star2: New `ForbiddenEmptyListAssignment` sniff to detect empty list() assignments which have been removed in PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110) +- :star2: New `ForbiddenFunctionParametersWithSameName` sniff to detect functions declared with multiple same-named parameters which is no longer accepted since PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110) +- :star2: New `ForbiddenGlobalVariableVariable` sniff to detect variable variables being made `global` which is not allowed since PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110) +- :star2: New `ForbiddenNegativeBitshift` sniff to detect bitwise shifts by negative number which will throw an ArithmeticError in PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110) +- :star2: New `ForbiddenSwitchWithMultipleDefaultBlocks` sniff to detect switch statements with multiple default blocks which is not allowed since PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110) +- :star2: New `NewAnonymousClasses` sniff to detect anonymous classes as introduced in PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110) +- :star2: New `NewClosure` sniff to detect anonymous functions as introduced in PHP 5.3. Fixes [#35](https://github.com/PHPCompatibility/PHPCompatibility/issues/35) +- :star2: New `NewFunctionParameters` sniff to detect use of new parameters in build-in PHP functions. Initially only sniffing for the new PHP 7.0 function parameters and the new PHP 5.3+ `before_needle` parameter for the `strstr()` function. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110), [#112](https://github.com/PHPCompatibility/PHPCompatibility/pull/112). Fixes [#27](https://github.com/PHPCompatibility/PHPCompatibility/issues/27). +- :star2: New `NewGroupUseDeclarations` sniff to detect group use declarations as introduced in PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110) +- :star2: New `NewScalarReturnTypeDeclarations` sniff to detect scalar return type hints as introduced in PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110) +- :star2: New `NewScalarTypeDeclarations` sniff to detect scalar function parameter type hints as introduced in PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110) +- :star2: New `RemovedFunctionParameters` sniff to detect use of removed parameters in build-in PHP functions. Initially only sniffing for the function parameters removed in PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110) +- :star2: New `RemovedGlobalVariables` sniff to detect the PHP 7.0 removed `$HTTP_RAW_POST_DATA` superglobal. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110) +- :star: `DeprecatedFunctions` sniff: detection of the PHP 5.4 deprecated OCI8 functions. [#93](https://github.com/PHPCompatibility/PHPCompatibility/pull/93) +- :star: `ForbiddenNamesAsInvokedFunctions` sniff: recognize PHP 5.5 `finally` as a reserved keywords when invoked as a function. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110) +- :star: `NewKeywords` sniff: detection of the use of the PHP 5.1+ `__halt_compiler` keyword. Fixes [#50](https://github.com/PHPCompatibility/PHPCompatibility/issues/50). +- :star: `NewKeywords` sniff: detection of the PHP 5.3+ `nowdoc` syntax. Fixes [#48](https://github.com/PHPCompatibility/PHPCompatibility/issues/48). +- :star: `NewKeywords` sniff: detection of the use of the `const` keyword outside of a class for PHP < 5.3. Fixes [#50](https://github.com/PHPCompatibility/PHPCompatibility/issues/50). +- :star: `DeprecatedFunctions` sniff: recognize PHP 7.0 deprecated and removed functions. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110) +- :star: `DeprecatedIniDirectives` sniff: recognize PHP 7.0 removed ini directives. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110) +- :star: `ForbiddenNamesAsInvokedFunctions` sniff: recognize new PHP 7.0 reserved keywords when invoked as functions. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110) +- :star: `ForbiddenNames` sniff: recognize new PHP 7.0 reserved keywords. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110) +- :star: `NewFunctions` sniff: recognize new functions as introduced in PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110) +- :star: `NewLanguageConstructs` sniff: recognize new PHP 7.0 `<=>` "spaceship" and `??` null coalescing operators. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110) +- :star: `RemovedExtensions` sniff: recognize PHP 7.0 removed `ereg`, `mssql`, `mysql` and `sybase_ct` extensions. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110) +- :umbrella: Additional unit tests for the `NewLanguageConstructs` sniff. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110) +- :books: Readme: New section containing information about the use of the `testVersion` config variable. +- :books: Readme: Sponsor credits. + +### Changed +- :pushpin: The `DeprecatedIniDirectives` sniff used to always throw an `warning`. Now it will throw an `error` when a removed ini directive is used. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110). +- :pushpin: The `DeprecatedNewReference` sniff will now throw an error when the `testVersion` includes PHP 7.0 or higher. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110) +- :pushpin: The `ForbiddenNames` sniff now supports detection of reserved keywords when used in combination with PHP 7 anonymous classes. [#108](https://github.com/PHPCompatibility/PHPCompatibility/pull/108), [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110). +- :pushpin: The `PregReplaceEModifier` sniff will now throw an error when the `testVersion` includes PHP 7.0 or higher. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110) +- :pencil2: `NewKeywords` sniff: clarified the error message text for the `use` keyword. Fixes [#46](https://github.com/PHPCompatibility/PHPCompatibility/issues/46). +- :recycle: Minor refactor of the `testVersion` related utility functions. [#98](https://github.com/PHPCompatibility/PHPCompatibility/pull/98) +- :wrench: Add autoload to the `composer.json` file. [#96](https://github.com/PHPCompatibility/PHPCompatibility/pull/96) Fixes [#67](https://github.com/PHPCompatibility/PHPCompatibility/issues/67). +- :wrench: Minor other updates to the `composer.json` file. [#75](https://github.com/PHPCompatibility/PHPCompatibility/pull/75) +- :wrench: Improved creation of the code coverage reports needed by coveralls via Travis. +- :green_heart: The sniffs are now also tested against PHP 7.0 for consistent results. + +### Fixed +- :bug: The `ForbiddenCallTimePassByReference` sniff was throwing `Undefined index` notices when used in combination with PHPCS 2.2.0. [#100](https://github.com/PHPCompatibility/PHPCompatibility/pull/100). Fixes [#42](https://github.com/PHPCompatibility/PHPCompatibility/issues/42). +- :bug: The `ForbiddenNamesAsInvokedFunctions` sniff would incorrectly throw an error if the `throw` keyword was used with parenthesis. Fixes [#118](https://github.com/PHPCompatibility/PHPCompatibility/issues/118). +- :bug: The `PregReplaceEModifier` sniff incorrectly identified `e`'s in the pattern as the `e` modifier when using `{}` bracket delimiters for the regex. [#94](https://github.com/PHPCompatibility/PHPCompatibility/pull/94) +- :bug: The `RemovedExtensions` sniff was throwing an `error` instead of a `warning` for deprecated, but not (yet) removed extensions. Fixes [#62](https://github.com/PHPCompatibility/PHPCompatibility/issues/62). + +### Credits +Thanks go out to AlexMiroshnikov, [Chris Abernethy], [dgudgeon], [djaenecke], [Eugene Maslovich], [Ken Guest], Koen Eelen, [Komarov Alexey], [Mark Clements] and [Remko van Bezooijen] for their contributions to this version. :clap: + + +## [5.6] - 2015-09-14 + +See all related issues and PRs in the [5.6 milestone]. + +### Added +- :star2: New: `NewLanguageConstructs` sniff. The initial version of this sniff checks for the PHP 5.6 `**` power operator and the `**=` power assignment operator. [#87](https://github.com/PHPCompatibility/PHPCompatibility/pull/87). Fixes [#60](https://github.com/PHPCompatibility/PHPCompatibility/issues/60). +- :star2: New: `ParameterShadowSuperGlobals` sniff which covers the PHP 5.4 change _Parameter names that shadow super globals now cause a fatal error.`_. [#74](https://github.com/PHPCompatibility/PHPCompatibility/pull/74) +- :star2: New: `PregReplaceEModifier` sniff which detects usage of the `e` modifier in literal regular expressions used with `preg_replace()`. The `e` modifier will not (yet) be detected when the regex passed is a variable or constant. [#81](https://github.com/PHPCompatibility/PHPCompatibility/pull/81), [#84](https://github.com/PHPCompatibility/PHPCompatibility/pull/84). Fixes [#71](https://github.com/PHPCompatibility/PHPCompatibility/issues/71), [#83](https://github.com/PHPCompatibility/PHPCompatibility/issues/83). +- :star: `DeprecatedIniDirectives` sniff: PHP 5.6 deprecated ini directives. +- :star: `NewKeywords` sniff: detection of the `goto` keyword introduced in PHP 5.3 and the `callable` keyword introduced in PHP 5.4. [#57](https://github.com/PHPCompatibility/PHPCompatibility/pull/57) +- :recycle: `PHPCompatibility_Sniff` base class initially containing the `supportsAbove()` and `supportsBelow()` utility methods. (Nearly) All sniffs now extend this base class and use these methods to determine whether or not violations should be reported for a set `testVersion`. [#77](https://github.com/PHPCompatibility/PHPCompatibility/pull/77) +- :books: Readme: Composer installation instructions. [#32](https://github.com/PHPCompatibility/PHPCompatibility/pull/32), [#61](https://github.com/PHPCompatibility/PHPCompatibility/pull/61) +- :wrench: `.gitignore` to ignore vendor and IDE related directories. [#78](https://github.com/PHPCompatibility/PHPCompatibility/pull/78) +- :green_heart: Code coverage checking via coveralls. + +### Changed +- :twisted_rightwards_arrows: The check for the `\` namespace separator has been moved from the `NewKeywords` sniff to the `NewLanguageConstructs` sniff. [#88](https://github.com/PHPCompatibility/PHPCompatibility/pull/88) +- :pencil2: `DeprecatedIniDirectives` sniff: minor change in the sniff error message text. +- :pencil2: `DeprecatedFunctions` sniff: minor change in the sniff error message text. +- :wrench: Minor updates to the `composer.json` file. [#31](https://github.com/PHPCompatibility/PHPCompatibility/pull/31), [34](https://github.com/PHPCompatibility/PHPCompatibility/pull/34), [#70](https://github.com/PHPCompatibility/PHPCompatibility/pull/70) +- :wrench: Tests: The unit tests can now be run without configuration. +- :wrench: Tests: Skipped unit tests will now be annotated as such. [#85](https://github.com/PHPCompatibility/PHPCompatibility/pull/85) +- :green_heart: The sniffs are now also tested against PHP 5.6 for consistent results. +- :green_heart: The sniffs are now also tested against PHPCS 2.0+. +- :green_heart: The sniffs are now tested using the new container-based infrastructure in Travis CI. [#37](https://github.com/PHPCompatibility/PHPCompatibility/pull/37) + +### Fixed +- :bug: The `ForbiddenCallTimePassByReference` sniff was throwing false positives when a bitwise and `&` was used in combination with class constants and class properties within function calls. [#44](https://github.com/PHPCompatibility/PHPCompatibility/pull/44). Fixes [#39](https://github.com/PHPCompatibility/PHPCompatibility/issues/39). +- :bug: The `ForbiddenNamesAsInvokedFunctions` sniff was throwing false positives in certain cases when a comment separated a `try` from the `catch` block. [#29](https://github.com/PHPCompatibility/PHPCompatibility/pull/29) +- :bug: The `ForbiddenNamesAsInvokedFunctions` sniff was incorrectly reporting `instanceof` as being introduced in PHP 5.4 while it has been around since PHP 5.0. [#80](https://github.com/PHPCompatibility/PHPCompatibility/pull/80) +- :white_check_mark: Compatibility with PHPCS 2.0 - 2.3. [#63](https://github.com/PHPCompatibility/PHPCompatibility/pull/63), [#65](https://github.com/PHPCompatibility/PHPCompatibility/pull/65) + +### Credits +Thanks go out to Daniel Jänecke, [Declan Kelly], [Dominic], [Jaap van Otterdijk], [Marin Crnkovic], [Mark Clements], [Nick Pack], [Oliver Klee], [Rowan Collins] and [Sam Van der Borght] for their contributions to this version. :clap: + + +## 5.5 - 2014-04-04 + +First tagged release. + +See all related issues and PRs in the [5.5 milestone]. + + + +[Unreleased]: https://github.com/PHPCompatibility/PHPCompatibility/compare/master...HEAD +[9.3.5]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.3.4...9.3.5 +[9.3.4]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.3.3...9.3.4 +[9.3.3]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.3.2...9.3.3 +[9.3.2]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.3.1...9.3.2 +[9.3.1]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.3.0...9.3.1 +[9.3.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.2.0...9.3.0 +[9.2.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.1.1...9.2.0 +[9.1.1]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.1.0...9.1.1 +[9.1.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.0.0...9.1.0 +[9.0.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/8.2.0...9.0.0 +[8.2.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/8.1.0...8.2.0 +[8.1.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/8.0.1...8.1.0 +[8.0.1]: https://github.com/PHPCompatibility/PHPCompatibility/compare/8.0.0...8.0.1 +[8.0.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.1.5...8.0.0 +[7.1.5]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.1.4...7.1.5 +[7.1.4]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.1.3...7.1.4 +[7.1.3]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.1.2...7.1.3 +[7.1.2]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.1.1...7.1.2 +[7.1.1]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.1.0...7.1.1 +[7.1.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0.8...7.1.0 +[7.0.8]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0.7...7.0.8 +[7.0.7]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0.6...7.0.7 +[7.0.6]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0.5...7.0.6 +[7.0.5]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0.4...7.0.5 +[7.0.4]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0.3...7.0.4 +[7.0.3]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0.2...7.0.3 +[7.0.2]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0.1...7.0.2 +[7.0.1]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0...7.0.1 +[7.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/5.6...7.0 +[5.6]: https://github.com/PHPCompatibility/PHPCompatibility/compare/5.5...5.6 + +[9.3.5 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/34 +[9.3.4 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/33 +[9.3.3 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/32 +[9.3.2 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/31 +[9.3.1 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/30 +[9.3.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/29 +[9.2.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/28 +[9.1.1 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/27 +[9.1.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/25 +[9.0.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/24 +[8.2.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/22 +[8.1.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/21 +[8.0.1 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/20 +[8.0.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/19 +[7.1.5 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/17 +[7.1.4 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/15 +[7.1.3 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/14 +[7.1.2 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/13 +[7.1.1 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/12 +[7.1.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/11 +[7.0.8 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/10 +[7.0.7 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/9 +[7.0.6 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/8 +[7.0.5 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/7 +[7.0.4 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/6 +[7.0.3 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/5 +[7.0.2 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/4 +[7.0.1 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/3 +[7.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/2 +[5.6 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/1 +[5.5 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/16 + +[Arthur Edamov]: https://github.com/edamov +[Chris Abernethy]: https://github.com/cabernet-zerve +[Declan Kelly]: https://github.com/declank +[dgudgeon]: https://github.com/dgudgeon +[djaenecke]: https://github.com/djaenecke +[Dominic]: https://github.com/dol +[Eugene Maslovich]: https://github.com/ehpc +[Gary Jones]: https://github.com/GaryJones +[Jaap van Otterdijk]: https://github.com/jaapio +[Jason Stallings]: https://github.com/octalmage +[Jonathan Champ]: https://github.com/jrchamp +[Jonathan Van Belle]: https://github.com/Grummfy +[Juliette Reinders Folmer]: https://github.com/jrfnl +[Ken Guest]: https://github.com/kenguest +[Komarov Alexey]: https://github.com/erdraug +[Marin Crnkovic]: https://github.com/anorgan +[Mark Clements]: https://github.com/MarkMaldaba +[Michael Babker]: https://github.com/mbabker +[Nick Pack]: https://github.com/nickpack +[Nikhil]: https://github.com/Nikschavan +[Oliver Klee]: https://github.com/oliverklee +[Remko van Bezooijen]: https://github.com/emkookmer +[Rowan Collins]: https://github.com/IMSoP +[Ryan Neufeld]: https://github.com/ryanneufeld +[Sam Van der Borght]: https://github.com/samvdb +[Sergii Bondarenko]: https://github.com/BR0kEN- +[Tadas Juozapaitis]: https://github.com/kasp3r +[Tim Millwood]: https://github.com/timmillwood +[William Entriken]: https://github.com/fulldecent +[Yılmaz]: https://github.com/edigu +[Yoshiaki Yoshida]: https://github.com/kakakakakku diff --git a/vendor/phpcompatibility/php-compatibility/LICENSE b/vendor/phpcompatibility/php-compatibility/LICENSE new file mode 100644 index 00000000..65c5ca88 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/vendor/phpcompatibility/php-compatibility/PHPCSAliases.php b/vendor/phpcompatibility/php-compatibility/PHPCSAliases.php new file mode 100644 index 00000000..97591a3f --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCSAliases.php @@ -0,0 +1,73 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * PHPCS cross-version compatibility helper. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + * + * @since 8.0.0 + */ + +/* + * Alias a number of PHPCS 3.x classes to their PHPCS 2.x equivalents. + * + * This file is auto-loaded by PHPCS 3.x before any sniffs are loaded + * through the PHPCS 3.x `<autoload>` ruleset directive. + * + * {@internal The PHPCS file have been reorganized in PHPCS 3.x, quite + * a few "old" classes have been split and spread out over several "new" + * classes. In other words, this will only work for a limited number + * of classes.} + * + * {@internal The `class_exists` wrappers are needed to play nice with other + * external PHPCS standards creating cross-version compatibility in the same + * manner.} + */ +if (defined('PHPCOMPATIBILITY_PHPCS_ALIASES_SET') === false) { + if (interface_exists('\PHP_CodeSniffer_Sniff') === false) { + class_alias('PHP_CodeSniffer\Sniffs\Sniff', '\PHP_CodeSniffer_Sniff'); + } + if (class_exists('\PHP_CodeSniffer_File') === false) { + class_alias('PHP_CodeSniffer\Files\File', '\PHP_CodeSniffer_File'); + } + if (class_exists('\PHP_CodeSniffer_Tokens') === false) { + class_alias('PHP_CodeSniffer\Util\Tokens', '\PHP_CodeSniffer_Tokens'); + } + if (class_exists('\PHP_CodeSniffer_Exception') === false) { + class_alias('PHP_CodeSniffer\Exceptions\RuntimeException', '\PHP_CodeSniffer_Exception'); + } + if (class_exists('\PHP_CodeSniffer_Standards_AbstractScopeSniff') === false) { + class_alias('PHP_CodeSniffer\Sniffs\AbstractScopeSniff', '\PHP_CodeSniffer_Standards_AbstractScopeSniff'); + } + if (class_exists('\Generic_Sniffs_NamingConventions_CamelCapsFunctionNameSniff') === false) { + class_alias('PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff', '\Generic_Sniffs_NamingConventions_CamelCapsFunctionNameSniff'); + } + + define('PHPCOMPATIBILITY_PHPCS_ALIASES_SET', true); + + /* + * Register an autoloader. + * + * {@internal When `installed_paths` is set via the ruleset, this autoloader + * is needed to run the sniffs. + * Upstream issue: {@link https://github.com/squizlabs/PHP_CodeSniffer/issues/1591} } + * + * @since 8.0.0 + */ + spl_autoload_register(function ($class) { + // Only try & load our own classes. + if (stripos($class, 'PHPCompatibility') !== 0) { + return; + } + + $file = realpath(__DIR__) . DIRECTORY_SEPARATOR . strtr($class, '\\', DIRECTORY_SEPARATOR) . '.php'; + + if (file_exists($file)) { + include_once $file; + } + }); +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractComplexVersionSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractComplexVersionSniff.php new file mode 100644 index 00000000..95245b6a --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractComplexVersionSniff.php @@ -0,0 +1,147 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility; + +use PHP_CodeSniffer_File as File; + +/** + * Abstract base class for sniffs based on complex arrays with PHP version information. + * + * @since 7.1.0 + */ +abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersionInterface +{ + + + /** + * Handle the retrieval of relevant information and - if necessary - throwing of an + * error/warning for an item. + * + * @since 7.1.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the relevant token in + * the stack. + * @param array $itemInfo Base information about the item. + * + * @return void + */ + public function handleFeature(File $phpcsFile, $stackPtr, array $itemInfo) + { + $itemArray = $this->getItemArray($itemInfo); + $errorInfo = $this->getErrorInfo($itemArray, $itemInfo); + + if ($this->shouldThrowError($errorInfo) === true) { + $this->addError($phpcsFile, $stackPtr, $itemInfo, $errorInfo); + } + } + + + /** + * Determine whether an error/warning should be thrown for an item based on collected information. + * + * @since 7.1.0 + * + * @param array $errorInfo Detail information about an item. + * + * @return bool + */ + abstract protected function shouldThrowError(array $errorInfo); + + + /** + * Get an array of the non-PHP-version array keys used in a sub-array. + * + * @since 7.1.0 + * + * @return array + */ + protected function getNonVersionArrayKeys() + { + return array(); + } + + + /** + * Retrieve a subset of an item array containing only the array keys which + * contain PHP version information. + * + * @since 7.1.0 + * + * @param array $itemArray Version and other information about an item. + * + * @return array Array with only the version information. + */ + protected function getVersionArray(array $itemArray) + { + return array_diff_key($itemArray, array_flip($this->getNonVersionArrayKeys())); + } + + + /** + * Get the item name to be used for the creation of the error code and in the error message. + * + * @since 7.1.0 + * + * @param array $itemInfo Base information about the item. + * @param array $errorInfo Detail information about an item. + * + * @return string + */ + protected function getItemName(array $itemInfo, array $errorInfo) + { + return $itemInfo['name']; + } + + + /** + * Get the error message template for a specific sniff. + * + * @since 7.1.0 + * + * @return string + */ + abstract protected function getErrorMsgTemplate(); + + + /** + * Allow for concrete child classes to filter the error message before it's passed to PHPCS. + * + * @since 7.1.0 + * + * @param string $error The error message which was created. + * @param array $itemInfo Base information about the item this error message applies to. + * @param array $errorInfo Detail information about an item this error message applies to. + * + * @return string + */ + protected function filterErrorMsg($error, array $itemInfo, array $errorInfo) + { + return $error; + } + + + /** + * Allow for concrete child classes to filter the error data before it's passed to PHPCS. + * + * @since 7.1.0 + * + * @param array $data The error data array which was created. + * @param array $itemInfo Base information about the item this error message applies to. + * @param array $errorInfo Detail information about an item this error message applies to. + * + * @return array + */ + protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) + { + return $data; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractFunctionCallParameterSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractFunctionCallParameterSniff.php new file mode 100644 index 00000000..6db8cd08 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractFunctionCallParameterSniff.php @@ -0,0 +1,193 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Abstract class to use as a base for examining the parameter values passed to function calls. + * + * @since 8.2.0 + */ +abstract class AbstractFunctionCallParameterSniff extends Sniff +{ + /** + * Is the sniff looking for a function call or a method call ? + * + * Note: the child class may need to do additional checks to make sure that + * the method called is of the right class/object. + * Checking that is outside of the scope of this abstract sniff. + * + * @since 8.2.0 + * + * @var bool False (default) if the sniff is looking for function calls. + * True if the sniff is looking for method calls. + */ + protected $isMethod = false; + + /** + * Functions the sniff is looking for. Should be defined in the child class. + * + * @since 8.2.0 + * + * @var array The only requirement for this array is that the top level + * array keys are the names of the functions you're looking for. + * Other than that, the array can have arbitrary content + * depending on your needs. + */ + protected $targetFunctions = array(); + + /** + * List of tokens which when they preceed the $stackPtr indicate that this + * is not a function call. + * + * @since 8.2.0 + * + * @var array + */ + private $ignoreTokens = array( + \T_DOUBLE_COLON => true, + \T_OBJECT_OPERATOR => true, + \T_FUNCTION => true, + \T_NEW => true, + \T_CONST => true, + \T_USE => true, + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 8.2.0 + * + * @return array + */ + public function register() + { + // Handle case-insensitivity of function names. + $this->targetFunctions = $this->arrayKeysToLowercase($this->targetFunctions); + + return array(\T_STRING); + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->bowOutEarly() === true) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $function = $tokens[$stackPtr]['content']; + $functionLc = strtolower($function); + + if (isset($this->targetFunctions[$functionLc]) === false) { + return; + } + + $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); + + if ($this->isMethod === true) { + if ($tokens[$prevNonEmpty]['code'] !== \T_DOUBLE_COLON + && $tokens[$prevNonEmpty]['code'] !== \T_OBJECT_OPERATOR + ) { + // Not a call to a PHP method. + return; + } + } else { + if (isset($this->ignoreTokens[$tokens[$prevNonEmpty]['code']]) === true) { + // Not a call to a PHP function. + return; + } + + if ($tokens[$prevNonEmpty]['code'] === \T_NS_SEPARATOR + && $tokens[$prevNonEmpty - 1]['code'] === \T_STRING + ) { + // Namespaced function. + return; + } + } + + $parameters = $this->getFunctionCallParameters($phpcsFile, $stackPtr); + + if (empty($parameters)) { + return $this->processNoParameters($phpcsFile, $stackPtr, $function); + } else { + return $this->processParameters($phpcsFile, $stackPtr, $function, $parameters); + } + } + + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * @since 8.2.0 + * + * If the check done in a child class is not specific to one PHP version, + * this function should return `false`. + * + * @return bool + */ + abstract protected function bowOutEarly(); + + + /** + * Process the parameters of a matched function. + * + * This method has to be made concrete in child classes. + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the stack. + * @param string $functionName The token content (function name) which was matched. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + abstract public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters); + + + /** + * Process the function if no parameters were found. + * + * Defaults to doing nothing. Can be overloaded in child classes to handle functions + * were parameters are expected, but none found. + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the stack. + * @param string $functionName The token content (function name) which was matched. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function processNoParameters(File $phpcsFile, $stackPtr, $functionName) + { + return; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractNewFeatureSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractNewFeatureSniff.php new file mode 100644 index 00000000..25406fda --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractNewFeatureSniff.php @@ -0,0 +1,115 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility; + +use PHP_CodeSniffer_File as File; + +/** + * Base class for new feature sniffs. + * + * @since 7.1.0 + */ +abstract class AbstractNewFeatureSniff extends AbstractComplexVersionSniff +{ + + + /** + * Determine whether an error/warning should be thrown for an item based on collected information. + * + * @since 7.1.0 + * + * @param array $errorInfo Detail information about an item. + * + * @return bool + */ + protected function shouldThrowError(array $errorInfo) + { + return ($errorInfo['not_in_version'] !== ''); + } + + + /** + * Retrieve the relevant detail (version) information for use in an error message. + * + * @since 7.1.0 + * + * @param array $itemArray Version and other information about the item. + * @param array $itemInfo Base information about the item. + * + * @return array + */ + public function getErrorInfo(array $itemArray, array $itemInfo) + { + $errorInfo = array( + 'not_in_version' => '', + 'error' => true, + ); + + $versionArray = $this->getVersionArray($itemArray); + + if (empty($versionArray) === false) { + foreach ($versionArray as $version => $present) { + if ($errorInfo['not_in_version'] === '' && $present === false + && $this->supportsBelow($version) === true + ) { + $errorInfo['not_in_version'] = $version; + } + } + } + + return $errorInfo; + } + + + /** + * Get the error message template for this sniff. + * + * @since 7.1.0 + * + * @return string + */ + protected function getErrorMsgTemplate() + { + return '%s is not present in PHP version %s or earlier'; + } + + + /** + * Generates the error or warning for this item. + * + * @since 7.1.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the relevant token in + * the stack. + * @param array $itemInfo Base information about the item. + * @param array $errorInfo Array with detail (version) information + * relevant to the item. + * + * @return void + */ + public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo) + { + $itemName = $this->getItemName($itemInfo, $errorInfo); + $error = $this->getErrorMsgTemplate(); + + $errorCode = $this->stringToErrorCode($itemName) . 'Found'; + $data = array( + $itemName, + $errorInfo['not_in_version'], + ); + + $error = $this->filterErrorMsg($error, $itemInfo, $errorInfo); + $data = $this->filterErrorData($data, $itemInfo, $errorInfo); + + $this->addMessage($phpcsFile, $error, $stackPtr, $errorInfo['error'], $errorCode, $data); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractRemovedFeatureSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractRemovedFeatureSniff.php new file mode 100644 index 00000000..94103922 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractRemovedFeatureSniff.php @@ -0,0 +1,156 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility; + +use PHP_CodeSniffer_File as File; + +/** + * Base class for removed feature sniffs. + * + * @since 7.1.0 + */ +abstract class AbstractRemovedFeatureSniff extends AbstractComplexVersionSniff +{ + + + /** + * Determine whether an error/warning should be thrown for an item based on collected information. + * + * @since 7.1.0 + * + * @param array $errorInfo Detail information about an item. + * + * @return bool + */ + protected function shouldThrowError(array $errorInfo) + { + return ($errorInfo['deprecated'] !== '' || $errorInfo['removed'] !== ''); + } + + + /** + * Get an array of the non-PHP-version array keys used in a sub-array. + * + * By default, removed feature version arrays, contain an additional 'alternative' array key. + * + * @since 7.1.0 + * + * @return array + */ + protected function getNonVersionArrayKeys() + { + return array('alternative'); + } + + + /** + * Retrieve the relevant detail (version) information for use in an error message. + * + * @since 7.1.0 + * + * @param array $itemArray Version and other information about the item. + * @param array $itemInfo Base information about the item. + * + * @return array + */ + public function getErrorInfo(array $itemArray, array $itemInfo) + { + $errorInfo = array( + 'deprecated' => '', + 'removed' => '', + 'alternative' => '', + 'error' => false, + ); + + $versionArray = $this->getVersionArray($itemArray); + + if (empty($versionArray) === false) { + foreach ($versionArray as $version => $removed) { + if ($this->supportsAbove($version) === true) { + if ($removed === true && $errorInfo['removed'] === '') { + $errorInfo['removed'] = $version; + $errorInfo['error'] = true; + } elseif ($errorInfo['deprecated'] === '') { + $errorInfo['deprecated'] = $version; + } + } + } + } + + if (isset($itemArray['alternative']) === true) { + $errorInfo['alternative'] = $itemArray['alternative']; + } + + return $errorInfo; + } + + + /** + * Get the error message template for suggesting an alternative for a specific sniff. + * + * @since 7.1.0 + * + * @return string + */ + protected function getAlternativeOptionTemplate() + { + return '; Use %s instead'; + } + + + /** + * Generates the error or warning for this item. + * + * @since 7.1.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the relevant token in + * the stack. + * @param array $itemInfo Base information about the item. + * @param array $errorInfo Array with detail (version) information + * relevant to the item. + * + * @return void + */ + public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo) + { + $itemName = $this->getItemName($itemInfo, $errorInfo); + $error = $this->getErrorMsgTemplate(); + + $errorCode = $this->stringToErrorCode($itemName); + $data = array($itemName); + + if ($errorInfo['deprecated'] !== '') { + $error .= 'deprecated since PHP %s and '; + $errorCode .= 'Deprecated'; + $data[] = $errorInfo['deprecated']; + } + + if ($errorInfo['removed'] !== '') { + $error .= 'removed since PHP %s and '; + $errorCode .= 'Removed'; + $data[] = $errorInfo['removed']; + } + + // Remove the last 'and' from the message. + $error = substr($error, 0, (\strlen($error) - 5)); + + if ($errorInfo['alternative'] !== '') { + $error .= $this->getAlternativeOptionTemplate(); + $data[] = $errorInfo['alternative']; + } + + $error = $this->filterErrorMsg($error, $itemInfo, $errorInfo); + $data = $this->filterErrorData($data, $itemInfo, $errorInfo); + + $this->addMessage($phpcsFile, $error, $stackPtr, $errorInfo['error'], $errorCode, $data); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/ComplexVersionInterface.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/ComplexVersionInterface.php new file mode 100644 index 00000000..f5f63bbf --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/ComplexVersionInterface.php @@ -0,0 +1,84 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility; + +use PHP_CodeSniffer_File as File; + +/** + * Complex Version Interface. + * + * Interface to be implemented by sniffs using a multi-dimensional array of + * PHP features (functions, classes etc) being sniffed for with version + * information in sub-arrays. + * + * @since 7.1.0 + */ +interface ComplexVersionInterface +{ + + + /** + * Handle the retrieval of relevant information and - if necessary - throwing of an + * error/warning for an item. + * + * @since 7.1.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the relevant token in + * the stack. + * @param array $itemInfo Base information about the item. + * + * @return void + */ + public function handleFeature(File $phpcsFile, $stackPtr, array $itemInfo); + + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 7.1.0 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo); + + + /** + * Retrieve the relevant detail (version) information for use in an error message. + * + * @since 7.1.0 + * + * @param array $itemArray Version and other information about the item. + * @param array $itemInfo Base information about the item. + * + * @return array + */ + public function getErrorInfo(array $itemArray, array $itemInfo); + + + /** + * Generates the error or warning for this item. + * + * @since 7.1.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the relevant token in + * the stack. + * @param array $itemInfo Base information about the item. + * @param array $errorInfo Array with detail (version) information + * relevant to the item. + * + * @return void + */ + public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo); +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/PHPCSHelper.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/PHPCSHelper.php new file mode 100644 index 00000000..4204beaf --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/PHPCSHelper.php @@ -0,0 +1,678 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility; + +use PHP_CodeSniffer_Exception as PHPCS_Exception; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * PHPCS cross-version compatibility helper class. + * + * A number of PHPCS classes were split up into several classes in PHPCS 3.x + * Those classes cannot be aliased as they don't represent the same object. + * This class provides helper methods for functions which were contained in + * one of these classes and which are used within the PHPCompatibility library. + * + * Additionally, this class contains some duplicates of PHPCS native methods. + * These methods have received bug fixes or improved functionality between the + * lowest supported PHPCS version and the latest PHPCS stable version and + * to provide the same results cross-version, PHPCompatibility needs to use + * the up-to-date versions of these methods. + * + * @since 8.0.0 + * @since 8.2.0 The duplicate PHPCS methods have been moved from the `Sniff` + * base class to this class. + */ +class PHPCSHelper +{ + + /** + * Get the PHPCS version number. + * + * @since 8.0.0 + * + * @return string + */ + public static function getVersion() + { + if (\defined('\PHP_CodeSniffer\Config::VERSION')) { + // PHPCS 3.x. + return \PHP_CodeSniffer\Config::VERSION; + } else { + // PHPCS 2.x. + return \PHP_CodeSniffer::VERSION; + } + } + + + /** + * Pass config data to PHPCS. + * + * PHPCS cross-version compatibility helper. + * + * @since 8.0.0 + * + * @param string $key The name of the config value. + * @param string|null $value The value to set. If null, the config entry + * is deleted, reverting it to the default value. + * @param boolean $temp Set this config data temporarily for this script run. + * This will not write the config data to the config file. + * + * @return void + */ + public static function setConfigData($key, $value, $temp = false) + { + if (method_exists('\PHP_CodeSniffer\Config', 'setConfigData')) { + // PHPCS 3.x. + \PHP_CodeSniffer\Config::setConfigData($key, $value, $temp); + } else { + // PHPCS 2.x. + \PHP_CodeSniffer::setConfigData($key, $value, $temp); + } + } + + + /** + * Get the value of a single PHPCS config key. + * + * @since 8.0.0 + * + * @param string $key The name of the config value. + * + * @return string|null + */ + public static function getConfigData($key) + { + if (method_exists('\PHP_CodeSniffer\Config', 'getConfigData')) { + // PHPCS 3.x. + return \PHP_CodeSniffer\Config::getConfigData($key); + } else { + // PHPCS 2.x. + return \PHP_CodeSniffer::getConfigData($key); + } + } + + + /** + * Get the value of a single PHPCS config key. + * + * This config key can be set in the `CodeSniffer.conf` file, on the + * command-line or in a ruleset. + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param string $key The name of the config value. + * + * @return string|null + */ + public static function getCommandLineData(File $phpcsFile, $key) + { + if (class_exists('\PHP_CodeSniffer\Config')) { + // PHPCS 3.x. + $config = $phpcsFile->config; + if (isset($config->{$key})) { + return $config->{$key}; + } + } else { + // PHPCS 2.x. + $config = $phpcsFile->phpcs->cli->getCommandLineValues(); + if (isset($config[$key])) { + return $config[$key]; + } + } + + return null; + } + + + /** + * Returns the position of the first non-whitespace token in a statement. + * + * {@internal Duplicate of same method as contained in the `\PHP_CodeSniffer_File` + * class and introduced in PHPCS 2.1.0 and improved in PHPCS 2.7.1. + * + * Once the minimum supported PHPCS version for this standard goes beyond + * that, this method can be removed and calls to it replaced with + * `$phpcsFile->findStartOfStatement($start, $ignore)` calls. + * + * Last synced with PHPCS version: PHPCS 3.3.2 at commit 6ad28354c04b364c3c71a34e4a18b629cc3b231e} + * + * @since 9.1.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile. + * @param int $start The position to start searching from in the token stack. + * @param int|array $ignore Token types that should not be considered stop points. + * + * @return int + */ + public static function findStartOfStatement(File $phpcsFile, $start, $ignore = null) + { + if (version_compare(self::getVersion(), '2.7.1', '>=') === true) { + return $phpcsFile->findStartOfStatement($start, $ignore); + } + + $tokens = $phpcsFile->getTokens(); + $endTokens = Tokens::$blockOpeners; + + $endTokens[\T_COLON] = true; + $endTokens[\T_COMMA] = true; + $endTokens[\T_DOUBLE_ARROW] = true; + $endTokens[\T_SEMICOLON] = true; + $endTokens[\T_OPEN_TAG] = true; + $endTokens[\T_CLOSE_TAG] = true; + $endTokens[\T_OPEN_SHORT_ARRAY] = true; + + if ($ignore !== null) { + $ignore = (array) $ignore; + foreach ($ignore as $code) { + if (isset($endTokens[$code]) === true) { + unset($endTokens[$code]); + } + } + } + + $lastNotEmpty = $start; + + for ($i = $start; $i >= 0; $i--) { + if (isset($endTokens[$tokens[$i]['code']]) === true) { + // Found the end of the previous statement. + return $lastNotEmpty; + } + + if (isset($tokens[$i]['scope_opener']) === true + && $i === $tokens[$i]['scope_closer'] + ) { + // Found the end of the previous scope block. + return $lastNotEmpty; + } + + // Skip nested statements. + if (isset($tokens[$i]['bracket_opener']) === true + && $i === $tokens[$i]['bracket_closer'] + ) { + $i = $tokens[$i]['bracket_opener']; + } elseif (isset($tokens[$i]['parenthesis_opener']) === true + && $i === $tokens[$i]['parenthesis_closer'] + ) { + $i = $tokens[$i]['parenthesis_opener']; + } + + if (isset(Tokens::$emptyTokens[$tokens[$i]['code']]) === false) { + $lastNotEmpty = $i; + } + }//end for + + return 0; + } + + + /** + * Returns the position of the last non-whitespace token in a statement. + * + * {@internal Duplicate of same method as contained in the `\PHP_CodeSniffer_File` + * class and introduced in PHPCS 2.1.0 and improved in PHPCS 2.7.1 and 3.3.0. + * + * Once the minimum supported PHPCS version for this standard goes beyond + * that, this method can be removed and calls to it replaced with + * `$phpcsFile->findEndOfStatement($start, $ignore)` calls. + * + * Last synced with PHPCS version: PHPCS 3.3.0-alpha at commit f5d899dcb5c534a1c3cca34668624517856ba823} + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile. + * @param int $start The position to start searching from in the token stack. + * @param int|array $ignore Token types that should not be considered stop points. + * + * @return int + */ + public static function findEndOfStatement(File $phpcsFile, $start, $ignore = null) + { + if (version_compare(self::getVersion(), '3.3.0', '>=') === true) { + return $phpcsFile->findEndOfStatement($start, $ignore); + } + + $tokens = $phpcsFile->getTokens(); + $endTokens = array( + \T_COLON => true, + \T_COMMA => true, + \T_DOUBLE_ARROW => true, + \T_SEMICOLON => true, + \T_CLOSE_PARENTHESIS => true, + \T_CLOSE_SQUARE_BRACKET => true, + \T_CLOSE_CURLY_BRACKET => true, + \T_CLOSE_SHORT_ARRAY => true, + \T_OPEN_TAG => true, + \T_CLOSE_TAG => true, + ); + + if ($ignore !== null) { + $ignore = (array) $ignore; + foreach ($ignore as $code) { + if (isset($endTokens[$code]) === true) { + unset($endTokens[$code]); + } + } + } + + $lastNotEmpty = $start; + + for ($i = $start; $i < $phpcsFile->numTokens; $i++) { + if ($i !== $start && isset($endTokens[$tokens[$i]['code']]) === true) { + // Found the end of the statement. + if ($tokens[$i]['code'] === \T_CLOSE_PARENTHESIS + || $tokens[$i]['code'] === \T_CLOSE_SQUARE_BRACKET + || $tokens[$i]['code'] === \T_CLOSE_CURLY_BRACKET + || $tokens[$i]['code'] === \T_CLOSE_SHORT_ARRAY + || $tokens[$i]['code'] === \T_OPEN_TAG + || $tokens[$i]['code'] === \T_CLOSE_TAG + ) { + return $lastNotEmpty; + } + + return $i; + } + + // Skip nested statements. + if (isset($tokens[$i]['scope_closer']) === true + && ($i === $tokens[$i]['scope_opener'] + || $i === $tokens[$i]['scope_condition']) + ) { + if ($i === $start && isset(Tokens::$scopeOpeners[$tokens[$i]['code']]) === true) { + return $tokens[$i]['scope_closer']; + } + + $i = $tokens[$i]['scope_closer']; + } elseif (isset($tokens[$i]['bracket_closer']) === true + && $i === $tokens[$i]['bracket_opener'] + ) { + $i = $tokens[$i]['bracket_closer']; + } elseif (isset($tokens[$i]['parenthesis_closer']) === true + && $i === $tokens[$i]['parenthesis_opener'] + ) { + $i = $tokens[$i]['parenthesis_closer']; + } + + if (isset(Tokens::$emptyTokens[$tokens[$i]['code']]) === false) { + $lastNotEmpty = $i; + } + }//end for + + return ($phpcsFile->numTokens - 1); + } + + + /** + * Returns the name of the class that the specified class extends + * (works for classes, anonymous classes and interfaces). + * + * Returns FALSE on error or if there is no extended class name. + * + * {@internal Duplicate of same method as contained in the `\PHP_CodeSniffer_File` + * class, but with some improvements which have been introduced in + * PHPCS 2.8.0. + * {@link https://github.com/squizlabs/PHP_CodeSniffer/commit/0011d448119d4c568e3ac1f825ae78815bf2cc34}. + * + * Once the minimum supported PHPCS version for this standard goes beyond + * that, this method can be removed and calls to it replaced with + * `$phpcsFile->findExtendedClassName($stackPtr)` calls. + * + * Last synced with PHPCS version: PHPCS 3.1.0-alpha at commit a9efcc9b0703f3f9f4a900623d4e97128a6aafc6} + * + * @since 7.1.4 + * @since 8.2.0 Moved from the `Sniff` class to this class. + * + * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile. + * @param int $stackPtr The position of the class token in the stack. + * + * @return string|false + */ + public static function findExtendedClassName(File $phpcsFile, $stackPtr) + { + if (version_compare(self::getVersion(), '3.1.0', '>=') === true) { + return $phpcsFile->findExtendedClassName($stackPtr); + } + + $tokens = $phpcsFile->getTokens(); + + // Check for the existence of the token. + if (isset($tokens[$stackPtr]) === false) { + return false; + } + + if ($tokens[$stackPtr]['code'] !== \T_CLASS + && $tokens[$stackPtr]['type'] !== 'T_ANON_CLASS' + && $tokens[$stackPtr]['type'] !== 'T_INTERFACE' + ) { + return false; + } + + if (isset($tokens[$stackPtr]['scope_closer']) === false) { + return false; + } + + $classCloserIndex = $tokens[$stackPtr]['scope_closer']; + $extendsIndex = $phpcsFile->findNext(\T_EXTENDS, $stackPtr, $classCloserIndex); + if ($extendsIndex === false) { + return false; + } + + $find = array( + \T_NS_SEPARATOR, + \T_STRING, + \T_WHITESPACE, + ); + + $end = $phpcsFile->findNext($find, ($extendsIndex + 1), $classCloserIndex, true); + $name = $phpcsFile->getTokensAsString(($extendsIndex + 1), ($end - $extendsIndex - 1)); + $name = trim($name); + + if ($name === '') { + return false; + } + + return $name; + } + + + /** + * Returns the name(s) of the interface(s) that the specified class implements. + * + * Returns FALSE on error or if there are no implemented interface names. + * + * {@internal Duplicate of same method as introduced in PHPCS 2.7. + * This method also includes an improvement we use which was only introduced + * in PHPCS 2.8.0, so only defer to upstream for higher versions. + * Once the minimum supported PHPCS version for this sniff library goes beyond + * that, this method can be removed and calls to it replaced with + * `$phpcsFile->findImplementedInterfaceNames($stackPtr)` calls.} + * + * @since 7.0.3 + * @since 8.2.0 Moved from the `Sniff` class to this class. + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the class token. + * + * @return array|false + */ + public static function findImplementedInterfaceNames(File $phpcsFile, $stackPtr) + { + if (version_compare(self::getVersion(), '2.7.1', '>') === true) { + return $phpcsFile->findImplementedInterfaceNames($stackPtr); + } + + $tokens = $phpcsFile->getTokens(); + + // Check for the existence of the token. + if (isset($tokens[$stackPtr]) === false) { + return false; + } + + if ($tokens[$stackPtr]['code'] !== \T_CLASS + && $tokens[$stackPtr]['type'] !== 'T_ANON_CLASS' + ) { + return false; + } + + if (isset($tokens[$stackPtr]['scope_closer']) === false) { + return false; + } + + $classOpenerIndex = $tokens[$stackPtr]['scope_opener']; + $implementsIndex = $phpcsFile->findNext(\T_IMPLEMENTS, $stackPtr, $classOpenerIndex); + if ($implementsIndex === false) { + return false; + } + + $find = array( + \T_NS_SEPARATOR, + \T_STRING, + \T_WHITESPACE, + \T_COMMA, + ); + + $end = $phpcsFile->findNext($find, ($implementsIndex + 1), ($classOpenerIndex + 1), true); + $name = $phpcsFile->getTokensAsString(($implementsIndex + 1), ($end - $implementsIndex - 1)); + $name = trim($name); + + if ($name === '') { + return false; + } else { + $names = explode(',', $name); + $names = array_map('trim', $names); + return $names; + } + } + + + /** + * Returns the method parameters for the specified function token. + * + * Each parameter is in the following format: + * + * <code> + * 0 => array( + * 'name' => '$var', // The variable name. + * 'token' => integer, // The stack pointer to the variable name. + * 'content' => string, // The full content of the variable definition. + * 'pass_by_reference' => boolean, // Is the variable passed by reference? + * 'variable_length' => boolean, // Is the param of variable length through use of `...` ? + * 'type_hint' => string, // The type hint for the variable. + * 'type_hint_token' => integer, // The stack pointer to the type hint + * // or false if there is no type hint. + * 'nullable_type' => boolean, // Is the variable using a nullable type? + * ) + * </code> + * + * Parameters with default values have an additional array index of + * 'default' with the value of the default as a string. + * + * {@internal Duplicate of same method as contained in the `\PHP_CodeSniffer_File` + * class. + * + * Last synced with PHPCS version: PHPCS 3.3.0-alpha at commit 53a28408d345044c0360c2c1b4a2aaebf4a3b8c9} + * + * @since 7.0.3 + * @since 8.2.0 Moved from the `Sniff` class to this class. + * + * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile. + * @param int $stackPtr The position in the stack of the + * function token to acquire the + * parameters for. + * + * @return array|false + * @throws \PHP_CodeSniffer_Exception If the specified $stackPtr is not of + * type T_FUNCTION or T_CLOSURE. + */ + public static function getMethodParameters(File $phpcsFile, $stackPtr) + { + if (version_compare(self::getVersion(), '3.3.0', '>=') === true) { + return $phpcsFile->getMethodParameters($stackPtr); + } + + $tokens = $phpcsFile->getTokens(); + + // Check for the existence of the token. + if (isset($tokens[$stackPtr]) === false) { + return false; + } + + if ($tokens[$stackPtr]['code'] !== \T_FUNCTION + && $tokens[$stackPtr]['code'] !== \T_CLOSURE + ) { + throw new PHPCS_Exception('$stackPtr must be of type T_FUNCTION or T_CLOSURE'); + } + + $opener = $tokens[$stackPtr]['parenthesis_opener']; + $closer = $tokens[$stackPtr]['parenthesis_closer']; + + $vars = array(); + $currVar = null; + $paramStart = ($opener + 1); + $defaultStart = null; + $paramCount = 0; + $passByReference = false; + $variableLength = false; + $typeHint = ''; + $typeHintToken = false; + $nullableType = false; + + for ($i = $paramStart; $i <= $closer; $i++) { + // Check to see if this token has a parenthesis or bracket opener. If it does + // it's likely to be an array which might have arguments in it. This + // could cause problems in our parsing below, so lets just skip to the + // end of it. + if (isset($tokens[$i]['parenthesis_opener']) === true) { + // Don't do this if it's the close parenthesis for the method. + if ($i !== $tokens[$i]['parenthesis_closer']) { + $i = ($tokens[$i]['parenthesis_closer'] + 1); + } + } + + if (isset($tokens[$i]['bracket_opener']) === true) { + // Don't do this if it's the close parenthesis for the method. + if ($i !== $tokens[$i]['bracket_closer']) { + $i = ($tokens[$i]['bracket_closer'] + 1); + } + } + + switch ($tokens[$i]['type']) { + case 'T_BITWISE_AND': + if ($defaultStart === null) { + $passByReference = true; + } + break; + case 'T_VARIABLE': + $currVar = $i; + break; + case 'T_ELLIPSIS': + $variableLength = true; + break; + case 'T_ARRAY_HINT': // Pre-PHPCS 3.3.0. + case 'T_CALLABLE': + if ($typeHintToken === false) { + $typeHintToken = $i; + } + + $typeHint .= $tokens[$i]['content']; + break; + case 'T_SELF': + case 'T_PARENT': + case 'T_STATIC': + // Self and parent are valid, static invalid, but was probably intended as type hint. + if (isset($defaultStart) === false) { + if ($typeHintToken === false) { + $typeHintToken = $i; + } + + $typeHint .= $tokens[$i]['content']; + } + break; + case 'T_STRING': + // This is a string, so it may be a type hint, but it could + // also be a constant used as a default value. + $prevComma = false; + for ($t = $i; $t >= $opener; $t--) { + if ($tokens[$t]['code'] === \T_COMMA) { + $prevComma = $t; + break; + } + } + + if ($prevComma !== false) { + $nextEquals = false; + for ($t = $prevComma; $t < $i; $t++) { + if ($tokens[$t]['code'] === \T_EQUAL) { + $nextEquals = $t; + break; + } + } + + if ($nextEquals !== false) { + break; + } + } + + if ($defaultStart === null) { + if ($typeHintToken === false) { + $typeHintToken = $i; + } + + $typeHint .= $tokens[$i]['content']; + } + break; + case 'T_NS_SEPARATOR': + // Part of a type hint or default value. + if ($defaultStart === null) { + if ($typeHintToken === false) { + $typeHintToken = $i; + } + + $typeHint .= $tokens[$i]['content']; + } + break; + case 'T_NULLABLE': + case 'T_INLINE_THEN': // Pre-PHPCS 2.8.0. + if ($defaultStart === null) { + $nullableType = true; + $typeHint .= $tokens[$i]['content']; + } + break; + case 'T_CLOSE_PARENTHESIS': + case 'T_COMMA': + // If it's null, then there must be no parameters for this + // method. + if ($currVar === null) { + break; + } + + $vars[$paramCount] = array(); + $vars[$paramCount]['token'] = $currVar; + $vars[$paramCount]['name'] = $tokens[$currVar]['content']; + $vars[$paramCount]['content'] = trim($phpcsFile->getTokensAsString($paramStart, ($i - $paramStart))); + + if ($defaultStart !== null) { + $vars[$paramCount]['default'] = trim( + $phpcsFile->getTokensAsString( + $defaultStart, + ($i - $defaultStart) + ) + ); + } + + $vars[$paramCount]['pass_by_reference'] = $passByReference; + $vars[$paramCount]['variable_length'] = $variableLength; + $vars[$paramCount]['type_hint'] = $typeHint; + $vars[$paramCount]['type_hint_token'] = $typeHintToken; + $vars[$paramCount]['nullable_type'] = $nullableType; + + // Reset the vars, as we are about to process the next parameter. + $defaultStart = null; + $paramStart = ($i + 1); + $passByReference = false; + $variableLength = false; + $typeHint = ''; + $typeHintToken = false; + $nullableType = false; + + $paramCount++; + break; + case 'T_EQUAL': + $defaultStart = ($i + 1); + break; + }//end switch + }//end for + + return $vars; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniff.php new file mode 100644 index 00000000..38fb7092 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniff.php @@ -0,0 +1,2267 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility; + +use PHPCompatibility\PHPCSHelper; +use PHP_CodeSniffer_Exception as PHPCS_Exception; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Sniff as PHPCS_Sniff; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Base class from which all PHPCompatibility sniffs extend. + * + * @since 5.6 + */ +abstract class Sniff implements PHPCS_Sniff +{ + + /** + * Regex to match variables in a double quoted string. + * + * This matches plain variables, but also more complex variables, such + * as $obj->prop, self::prop and $var[]. + * + * @since 7.1.2 + * + * @var string + */ + const REGEX_COMPLEX_VARS = '`(?:(\{)?(?<!\\\\)\$)?(\{)?(?<!\\\\)\$(\{)?(?P<varname>[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)(?:->\$?(?P>varname)|\[[^\]]+\]|::\$?(?P>varname)|\([^\)]*\))*(?(3)\}|)(?(2)\}|)(?(1)\}|)`'; + + /** + * List of superglobals as an array of strings. + * + * Used by the ForbiddenParameterShadowSuperGlobals and ForbiddenClosureUseVariableNames sniffs. + * + * @since 7.0.0 + * @since 7.1.4 Moved from the `ForbiddenParameterShadowSuperGlobals` sniff to the base `Sniff` class. + * + * @var array + */ + protected $superglobals = array( + '$GLOBALS' => true, + '$_SERVER' => true, + '$_GET' => true, + '$_POST' => true, + '$_FILES' => true, + '$_COOKIE' => true, + '$_SESSION' => true, + '$_REQUEST' => true, + '$_ENV' => true, + ); + + /** + * List of functions using hash algorithm as parameter (always the first parameter). + * + * Used by the new/removed hash algorithm sniffs. + * Key is the function name, value is the 1-based parameter position in the function call. + * + * @since 5.5 + * @since 7.0.7 Moved from the `RemovedHashAlgorithms` sniff to the base `Sniff` class. + * + * @var array + */ + protected $hashAlgoFunctions = array( + 'hash_file' => 1, + 'hash_hmac_file' => 1, + 'hash_hmac' => 1, + 'hash_init' => 1, + 'hash_pbkdf2' => 1, + 'hash' => 1, + ); + + + /** + * List of functions which take an ini directive as parameter (always the first parameter). + * + * Used by the new/removed ini directives sniffs. + * Key is the function name, value is the 1-based parameter position in the function call. + * + * @since 7.1.0 + * + * @var array + */ + protected $iniFunctions = array( + 'ini_get' => 1, + 'ini_set' => 1, + ); + + + /** + * Get the testVersion configuration variable. + * + * The testVersion configuration variable may be in any of the following formats: + * 1) Omitted/empty, in which case no version is specified. This effectively + * disables all the checks for new PHP features provided by this standard. + * 2) A single PHP version number, e.g. "5.4" in which case the standard checks that + * the code will run on that version of PHP (no deprecated features or newer + * features being used). + * 3) A range, e.g. "5.0-5.5", in which case the standard checks the code will run + * on all PHP versions in that range, and that it doesn't use any features that + * were deprecated by the final version in the list, or which were not available + * for the first version in the list. + * We accept ranges where one of the components is missing, e.g. "-5.6" means + * all versions up to PHP 5.6, and "7.0-" means all versions above PHP 7.0. + * PHP version numbers should always be in Major.Minor format. Both "5", "5.3.2" + * would be treated as invalid, and ignored. + * + * @since 7.0.0 + * @since 7.1.3 Now allows for partial ranges such as `5.2-`. + * + * @return array $arrTestVersions will hold an array containing min/max version + * of PHP that we are checking against (see above). If only a + * single version number is specified, then this is used as + * both the min and max. + * + * @throws \PHP_CodeSniffer_Exception If testVersion is invalid. + */ + private function getTestVersion() + { + static $arrTestVersions = array(); + + $default = array(null, null); + $testVersion = trim(PHPCSHelper::getConfigData('testVersion')); + + if (empty($testVersion) === false && isset($arrTestVersions[$testVersion]) === false) { + + $arrTestVersions[$testVersion] = $default; + + if (preg_match('`^\d+\.\d+$`', $testVersion)) { + $arrTestVersions[$testVersion] = array($testVersion, $testVersion); + return $arrTestVersions[$testVersion]; + } + + if (preg_match('`^(\d+\.\d+)?\s*-\s*(\d+\.\d+)?$`', $testVersion, $matches)) { + if (empty($matches[1]) === false || empty($matches[2]) === false) { + // If no lower-limit is set, we set the min version to 4.0. + // Whilst development focuses on PHP 5 and above, we also accept + // sniffs for PHP 4, so we include that as the minimum. + // (It makes no sense to support PHP 3 as this was effectively a + // different language). + $min = empty($matches[1]) ? '4.0' : $matches[1]; + + // If no upper-limit is set, we set the max version to 99.9. + $max = empty($matches[2]) ? '99.9' : $matches[2]; + + if (version_compare($min, $max, '>')) { + trigger_error( + "Invalid range in testVersion setting: '" . $testVersion . "'", + \E_USER_WARNING + ); + return $default; + } else { + $arrTestVersions[$testVersion] = array($min, $max); + return $arrTestVersions[$testVersion]; + } + } + } + + trigger_error( + "Invalid testVersion setting: '" . $testVersion . "'", + \E_USER_WARNING + ); + return $default; + } + + if (isset($arrTestVersions[$testVersion])) { + return $arrTestVersions[$testVersion]; + } + + return $default; + } + + + /** + * Check whether a specific PHP version is equal to or higher than the maximum + * supported PHP version as provided by the user in `testVersion`. + * + * Should be used when sniffing for *old* PHP features (deprecated/removed). + * + * @since 5.6 + * + * @param string $phpVersion A PHP version number in 'major.minor' format. + * + * @return bool True if testVersion has not been provided or if the PHP version + * is equal to or higher than the highest supported PHP version + * in testVersion. False otherwise. + */ + public function supportsAbove($phpVersion) + { + $testVersion = $this->getTestVersion(); + $testVersion = $testVersion[1]; + + if (\is_null($testVersion) + || version_compare($testVersion, $phpVersion) >= 0 + ) { + return true; + } else { + return false; + } + } + + + /** + * Check whether a specific PHP version is equal to or lower than the minimum + * supported PHP version as provided by the user in `testVersion`. + * + * Should be used when sniffing for *new* PHP features. + * + * @since 5.6 + * + * @param string $phpVersion A PHP version number in 'major.minor' format. + * + * @return bool True if the PHP version is equal to or lower than the lowest + * supported PHP version in testVersion. + * False otherwise or if no testVersion is provided. + */ + public function supportsBelow($phpVersion) + { + $testVersion = $this->getTestVersion(); + $testVersion = $testVersion[0]; + + if (\is_null($testVersion) === false + && version_compare($testVersion, $phpVersion) <= 0 + ) { + return true; + } else { + return false; + } + } + + + /** + * Add a PHPCS message to the output stack as either a warning or an error. + * + * @since 7.1.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file the message applies to. + * @param string $message The message. + * @param int $stackPtr The position of the token + * the message relates to. + * @param bool $isError Whether to report the message as an + * 'error' or 'warning'. + * Defaults to true (error). + * @param string $code The error code for the message. + * Defaults to 'Found'. + * @param array $data Optional input for the data replacements. + * + * @return void + */ + public function addMessage(File $phpcsFile, $message, $stackPtr, $isError, $code = 'Found', $data = array()) + { + if ($isError === true) { + $phpcsFile->addError($message, $stackPtr, $code, $data); + } else { + $phpcsFile->addWarning($message, $stackPtr, $code, $data); + } + } + + + /** + * Convert an arbitrary string to an alphanumeric string with underscores. + * + * Pre-empt issues with arbitrary strings being used as error codes in XML and PHP. + * + * @since 7.1.0 + * + * @param string $baseString Arbitrary string. + * + * @return string + */ + public function stringToErrorCode($baseString) + { + return preg_replace('`[^a-z0-9_]`i', '_', strtolower($baseString)); + } + + + /** + * Strip quotes surrounding an arbitrary string. + * + * Intended for use with the contents of a T_CONSTANT_ENCAPSED_STRING / T_DOUBLE_QUOTED_STRING. + * + * @since 7.0.6 + * + * @param string $string The raw string. + * + * @return string String without quotes around it. + */ + public function stripQuotes($string) + { + return preg_replace('`^([\'"])(.*)\1$`Ds', '$2', $string); + } + + + /** + * Strip variables from an arbitrary double quoted string. + * + * Intended for use with the contents of a T_DOUBLE_QUOTED_STRING. + * + * @since 7.1.2 + * + * @param string $string The raw string. + * + * @return string String without variables in it. + */ + public function stripVariables($string) + { + if (strpos($string, '$') === false) { + return $string; + } + + return preg_replace(self::REGEX_COMPLEX_VARS, '', $string); + } + + + /** + * Make all top level array keys in an array lowercase. + * + * @since 7.1.0 + * + * @param array $array Initial array. + * + * @return array Same array, but with all lowercase top level keys. + */ + public function arrayKeysToLowercase($array) + { + return array_change_key_case($array, \CASE_LOWER); + } + + + /** + * Checks if a function call has parameters. + * + * Expects to be passed the T_STRING or T_VARIABLE stack pointer for the function call. + * If passed a T_STRING which is *not* a function call, the behaviour is unreliable. + * + * Extra feature: If passed an T_ARRAY or T_OPEN_SHORT_ARRAY stack pointer, it + * will detect whether the array has values or is empty. + * + * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/120 + * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/152 + * + * @since 7.0.3 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the function call token. + * + * @return bool + */ + public function doesFunctionCallHaveParameters(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + // Check for the existence of the token. + if (isset($tokens[$stackPtr]) === false) { + return false; + } + + // Is this one of the tokens this function handles ? + if (\in_array($tokens[$stackPtr]['code'], array(\T_STRING, \T_ARRAY, \T_OPEN_SHORT_ARRAY, \T_VARIABLE), true) === false) { + return false; + } + + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true); + + // Deal with short array syntax. + if ($tokens[$stackPtr]['code'] === \T_OPEN_SHORT_ARRAY) { + if (isset($tokens[$stackPtr]['bracket_closer']) === false) { + return false; + } + + if ($nextNonEmpty === $tokens[$stackPtr]['bracket_closer']) { + // No parameters. + return false; + } else { + return true; + } + } + + // Deal with function calls & long arrays. + // Next non-empty token should be the open parenthesis. + if ($nextNonEmpty === false && $tokens[$nextNonEmpty]['code'] !== \T_OPEN_PARENTHESIS) { + return false; + } + + if (isset($tokens[$nextNonEmpty]['parenthesis_closer']) === false) { + return false; + } + + $closeParenthesis = $tokens[$nextNonEmpty]['parenthesis_closer']; + $nextNextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $nextNonEmpty + 1, $closeParenthesis + 1, true); + + if ($nextNextNonEmpty === $closeParenthesis) { + // No parameters. + return false; + } + + return true; + } + + + /** + * Count the number of parameters a function call has been passed. + * + * Expects to be passed the T_STRING or T_VARIABLE stack pointer for the function call. + * If passed a T_STRING which is *not* a function call, the behaviour is unreliable. + * + * Extra feature: If passed an T_ARRAY or T_OPEN_SHORT_ARRAY stack pointer, + * it will return the number of values in the array. + * + * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/111 + * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/114 + * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/151 + * + * @since 7.0.3 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the function call token. + * + * @return int + */ + public function getFunctionCallParameterCount(File $phpcsFile, $stackPtr) + { + if ($this->doesFunctionCallHaveParameters($phpcsFile, $stackPtr) === false) { + return 0; + } + + return \count($this->getFunctionCallParameters($phpcsFile, $stackPtr)); + } + + + /** + * Get information on all parameters passed to a function call. + * + * Expects to be passed the T_STRING or T_VARIABLE stack pointer for the function call. + * If passed a T_STRING which is *not* a function call, the behaviour is unreliable. + * + * Will return an multi-dimentional array with the start token pointer, end token + * pointer and raw parameter value for all parameters. Index will be 1-based. + * If no parameters are found, will return an empty array. + * + * Extra feature: If passed an T_ARRAY or T_OPEN_SHORT_ARRAY stack pointer, + * it will tokenize the values / key/value pairs contained in the array call. + * + * @since 7.0.5 Split off from the `getFunctionCallParameterCount()` method. + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the function call token. + * + * @return array + */ + public function getFunctionCallParameters(File $phpcsFile, $stackPtr) + { + if ($this->doesFunctionCallHaveParameters($phpcsFile, $stackPtr) === false) { + return array(); + } + + // Ok, we know we have a T_STRING, T_VARIABLE, T_ARRAY or T_OPEN_SHORT_ARRAY with parameters + // and valid open & close brackets/parenthesis. + $tokens = $phpcsFile->getTokens(); + + // Mark the beginning and end tokens. + if ($tokens[$stackPtr]['code'] === \T_OPEN_SHORT_ARRAY) { + $opener = $stackPtr; + $closer = $tokens[$stackPtr]['bracket_closer']; + + $nestedParenthesisCount = 0; + + } else { + $opener = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true); + $closer = $tokens[$opener]['parenthesis_closer']; + + $nestedParenthesisCount = 1; + } + + // Which nesting level is the one we are interested in ? + if (isset($tokens[$opener]['nested_parenthesis'])) { + $nestedParenthesisCount += \count($tokens[$opener]['nested_parenthesis']); + } + + $parameters = array(); + $nextComma = $opener; + $paramStart = $opener + 1; + $cnt = 1; + while (($nextComma = $phpcsFile->findNext(array(\T_COMMA, $tokens[$closer]['code'], \T_OPEN_SHORT_ARRAY, \T_CLOSURE), $nextComma + 1, $closer + 1)) !== false) { + // Ignore anything within short array definition brackets. + if ($tokens[$nextComma]['type'] === 'T_OPEN_SHORT_ARRAY' + && (isset($tokens[$nextComma]['bracket_opener']) + && $tokens[$nextComma]['bracket_opener'] === $nextComma) + && isset($tokens[$nextComma]['bracket_closer']) + ) { + // Skip forward to the end of the short array definition. + $nextComma = $tokens[$nextComma]['bracket_closer']; + continue; + } + + // Skip past closures passed as function parameters. + if ($tokens[$nextComma]['type'] === 'T_CLOSURE' + && (isset($tokens[$nextComma]['scope_condition']) + && $tokens[$nextComma]['scope_condition'] === $nextComma) + && isset($tokens[$nextComma]['scope_closer']) + ) { + // Skip forward to the end of the closure declaration. + $nextComma = $tokens[$nextComma]['scope_closer']; + continue; + } + + // Ignore comma's at a lower nesting level. + if ($tokens[$nextComma]['type'] === 'T_COMMA' + && isset($tokens[$nextComma]['nested_parenthesis']) + && \count($tokens[$nextComma]['nested_parenthesis']) !== $nestedParenthesisCount + ) { + continue; + } + + // Ignore closing parenthesis/bracket if not 'ours'. + if ($tokens[$nextComma]['type'] === $tokens[$closer]['type'] && $nextComma !== $closer) { + continue; + } + + // Ok, we've reached the end of the parameter. + $parameters[$cnt]['start'] = $paramStart; + $parameters[$cnt]['end'] = $nextComma - 1; + $parameters[$cnt]['raw'] = trim($phpcsFile->getTokensAsString($paramStart, ($nextComma - $paramStart))); + + /* + * Check if there are more tokens before the closing parenthesis. + * Prevents code like the following from setting a third parameter: + * `functionCall( $param1, $param2, );`. + */ + $hasNextParam = $phpcsFile->findNext(Tokens::$emptyTokens, $nextComma + 1, $closer, true, null, true); + if ($hasNextParam === false) { + break; + } + + // Prepare for the next parameter. + $paramStart = $nextComma + 1; + $cnt++; + } + + return $parameters; + } + + + /** + * Get information on a specific parameter passed to a function call. + * + * Expects to be passed the T_STRING or T_VARIABLE stack pointer for the function call. + * If passed a T_STRING which is *not* a function call, the behaviour is unreliable. + * + * Will return a array with the start token pointer, end token pointer and the raw value + * of the parameter at a specific offset. + * If the specified parameter is not found, will return false. + * + * @since 7.0.5 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the function call token. + * @param int $paramOffset The 1-based index position of the parameter to retrieve. + * + * @return array|false + */ + public function getFunctionCallParameter(File $phpcsFile, $stackPtr, $paramOffset) + { + $parameters = $this->getFunctionCallParameters($phpcsFile, $stackPtr); + + if (isset($parameters[$paramOffset]) === false) { + return false; + } else { + return $parameters[$paramOffset]; + } + } + + + /** + * Verify whether a token is within a scoped condition. + * + * If the optional $validScopes parameter has been passed, the function + * will check that the token has at least one condition which is of a + * type defined in $validScopes. + * + * @since 7.0.5 Largely split off from the `inClassScope()` method. + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the token. + * @param array|int $validScopes Optional. Array of valid scopes + * or int value of a valid scope. + * Pass the T_.. constant(s) for the + * desired scope to this parameter. + * + * @return bool Without the optional $scopeTypes: True if within a scope, false otherwise. + * If the $scopeTypes are set: True if *one* of the conditions is a + * valid scope, false otherwise. + */ + public function tokenHasScope(File $phpcsFile, $stackPtr, $validScopes = null) + { + $tokens = $phpcsFile->getTokens(); + + // Check for the existence of the token. + if (isset($tokens[$stackPtr]) === false) { + return false; + } + + // No conditions = no scope. + if (empty($tokens[$stackPtr]['conditions'])) { + return false; + } + + // Ok, there are conditions, do we have to check for specific ones ? + if (isset($validScopes) === false) { + return true; + } + + return $phpcsFile->hasCondition($stackPtr, $validScopes); + } + + + /** + * Verify whether a token is within a class scope. + * + * @since 7.0.3 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the token. + * @param bool $strict Whether to strictly check for the T_CLASS + * scope or also accept interfaces and traits + * as scope. + * + * @return bool True if within class scope, false otherwise. + */ + public function inClassScope(File $phpcsFile, $stackPtr, $strict = true) + { + $validScopes = array(\T_CLASS); + if (\defined('T_ANON_CLASS') === true) { + $validScopes[] = \T_ANON_CLASS; + } + + if ($strict === false) { + $validScopes[] = \T_INTERFACE; + $validScopes[] = \T_TRAIT; + } + + return $phpcsFile->hasCondition($stackPtr, $validScopes); + } + + + /** + * Returns the fully qualified class name for a new class instantiation. + * + * Returns an empty string if the class name could not be reliably inferred. + * + * @since 7.0.3 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of a T_NEW token. + * + * @return string + */ + public function getFQClassNameFromNewToken(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + // Check for the existence of the token. + if (isset($tokens[$stackPtr]) === false) { + return ''; + } + + if ($tokens[$stackPtr]['code'] !== \T_NEW) { + return ''; + } + + $start = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true); + if ($start === false) { + return ''; + } + + // Bow out if the next token is a variable as we don't know where it was defined. + if ($tokens[$start]['code'] === \T_VARIABLE) { + return ''; + } + + // Bow out if the next token is the class keyword. + if ($tokens[$start]['type'] === 'T_ANON_CLASS' || $tokens[$start]['code'] === \T_CLASS) { + return ''; + } + + $find = array( + \T_NS_SEPARATOR, + \T_STRING, + \T_NAMESPACE, + \T_WHITESPACE, + ); + + $end = $phpcsFile->findNext($find, ($start + 1), null, true, null, true); + $className = $phpcsFile->getTokensAsString($start, ($end - $start)); + $className = trim($className); + + return $this->getFQName($phpcsFile, $stackPtr, $className); + } + + + /** + * Returns the fully qualified name of the class that the specified class extends. + * + * Returns an empty string if the class does not extend another class or if + * the class name could not be reliably inferred. + * + * @since 7.0.3 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of a T_CLASS token. + * + * @return string + */ + public function getFQExtendedClassName(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + // Check for the existence of the token. + if (isset($tokens[$stackPtr]) === false) { + return ''; + } + + if ($tokens[$stackPtr]['code'] !== \T_CLASS + && $tokens[$stackPtr]['type'] !== 'T_ANON_CLASS' + && $tokens[$stackPtr]['type'] !== 'T_INTERFACE' + ) { + return ''; + } + + $extends = PHPCSHelper::findExtendedClassName($phpcsFile, $stackPtr); + if (empty($extends) || \is_string($extends) === false) { + return ''; + } + + return $this->getFQName($phpcsFile, $stackPtr, $extends); + } + + + /** + * Returns the class name for the static usage of a class. + * This can be a call to a method, the use of a property or constant. + * + * Returns an empty string if the class name could not be reliably inferred. + * + * @since 7.0.3 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of a T_NEW token. + * + * @return string + */ + public function getFQClassNameFromDoubleColonToken(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + // Check for the existence of the token. + if (isset($tokens[$stackPtr]) === false) { + return ''; + } + + if ($tokens[$stackPtr]['code'] !== \T_DOUBLE_COLON) { + return ''; + } + + // Nothing to do if previous token is a variable as we don't know where it was defined. + if ($tokens[$stackPtr - 1]['code'] === \T_VARIABLE) { + return ''; + } + + // Nothing to do if 'parent' or 'static' as we don't know how far the class tree extends. + if (\in_array($tokens[$stackPtr - 1]['code'], array(\T_PARENT, \T_STATIC), true)) { + return ''; + } + + // Get the classname from the class declaration if self is used. + if ($tokens[$stackPtr - 1]['code'] === \T_SELF) { + $classDeclarationPtr = $phpcsFile->findPrevious(\T_CLASS, $stackPtr - 1); + if ($classDeclarationPtr === false) { + return ''; + } + $className = $phpcsFile->getDeclarationName($classDeclarationPtr); + return $this->getFQName($phpcsFile, $classDeclarationPtr, $className); + } + + $find = array( + \T_NS_SEPARATOR, + \T_STRING, + \T_NAMESPACE, + \T_WHITESPACE, + ); + + $start = $phpcsFile->findPrevious($find, $stackPtr - 1, null, true, null, true); + if ($start === false || isset($tokens[($start + 1)]) === false) { + return ''; + } + + $start = ($start + 1); + $className = $phpcsFile->getTokensAsString($start, ($stackPtr - $start)); + $className = trim($className); + + return $this->getFQName($phpcsFile, $stackPtr, $className); + } + + + /** + * Get the Fully Qualified name for a class/function/constant etc. + * + * Checks if a class/function/constant name is already fully qualified and + * if not, enrich it with the relevant namespace information. + * + * @since 7.0.3 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the token. + * @param string $name The class / function / constant name. + * + * @return string + */ + public function getFQName(File $phpcsFile, $stackPtr, $name) + { + if (strpos($name, '\\') === 0) { + // Already fully qualified. + return $name; + } + + // Remove the namespace keyword if used. + if (strpos($name, 'namespace\\') === 0) { + $name = substr($name, 10); + } + + $namespace = $this->determineNamespace($phpcsFile, $stackPtr); + + if ($namespace === '') { + return '\\' . $name; + } else { + return '\\' . $namespace . '\\' . $name; + } + } + + + /** + * Is the class/function/constant name namespaced or global ? + * + * @since 7.0.3 + * + * @param string $FQName Fully Qualified name of a class, function etc. + * I.e. should always start with a `\`. + * + * @return bool True if namespaced, false if global. + * + * @throws \PHP_CodeSniffer_Exception If the name in the passed parameter + * is not fully qualified. + */ + public function isNamespaced($FQName) + { + if (strpos($FQName, '\\') !== 0) { + throw new PHPCS_Exception('$FQName must be a fully qualified name'); + } + + return (strpos(substr($FQName, 1), '\\') !== false); + } + + + /** + * Determine the namespace name an arbitrary token lives in. + * + * @since 7.0.3 + * + * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile. + * @param int $stackPtr The token position for which to determine the namespace. + * + * @return string Namespace name or empty string if it couldn't be determined or no namespace applies. + */ + public function determineNamespace(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + // Check for the existence of the token. + if (isset($tokens[$stackPtr]) === false) { + return ''; + } + + // Check for scoped namespace {}. + if (empty($tokens[$stackPtr]['conditions']) === false) { + $namespacePtr = $phpcsFile->getCondition($stackPtr, \T_NAMESPACE); + if ($namespacePtr !== false) { + $namespace = $this->getDeclaredNamespaceName($phpcsFile, $namespacePtr); + if ($namespace !== false) { + return $namespace; + } + + // We are in a scoped namespace, but couldn't determine the name. Searching for a global namespace is futile. + return ''; + } + } + + /* + * Not in a scoped namespace, so let's see if we can find a non-scoped namespace instead. + * Keeping in mind that: + * - there can be multiple non-scoped namespaces in a file (bad practice, but it happens). + * - the namespace keyword can also be used as part of a function/method call and such. + * - that a non-named namespace resolves to the global namespace. + */ + $previousNSToken = $stackPtr; + $namespace = false; + do { + $previousNSToken = $phpcsFile->findPrevious(\T_NAMESPACE, ($previousNSToken - 1)); + + // Stop if we encounter a scoped namespace declaration as we already know we're not in one. + if (empty($tokens[$previousNSToken]['scope_condition']) === false && $tokens[$previousNSToken]['scope_condition'] === $previousNSToken) { + break; + } + + $namespace = $this->getDeclaredNamespaceName($phpcsFile, $previousNSToken); + + } while ($namespace === false && $previousNSToken !== false); + + // If we still haven't got a namespace, return an empty string. + if ($namespace === false) { + return ''; + } else { + return $namespace; + } + } + + /** + * Get the complete namespace name for a namespace declaration. + * + * For hierarchical namespaces, the name will be composed of several tokens, + * i.e. MyProject\Sub\Level which will be returned together as one string. + * + * @since 7.0.3 + * + * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile. + * @param int|bool $stackPtr The position of a T_NAMESPACE token. + * + * @return string|false Namespace name or false if not a namespace declaration. + * Namespace name can be an empty string for global namespace declaration. + */ + public function getDeclaredNamespaceName(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + // Check for the existence of the token. + if ($stackPtr === false || isset($tokens[$stackPtr]) === false) { + return false; + } + + if ($tokens[$stackPtr]['code'] !== \T_NAMESPACE) { + return false; + } + + if ($tokens[($stackPtr + 1)]['code'] === \T_NS_SEPARATOR) { + // Not a namespace declaration, but use of, i.e. `namespace\someFunction();`. + return false; + } + + $nextToken = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true, null, true); + if ($tokens[$nextToken]['code'] === \T_OPEN_CURLY_BRACKET) { + /* + * Declaration for global namespace when using multiple namespaces in a file. + * I.e.: `namespace {}`. + */ + return ''; + } + + // Ok, this should be a namespace declaration, so get all the parts together. + $validTokens = array( + \T_STRING => true, + \T_NS_SEPARATOR => true, + \T_WHITESPACE => true, + ); + + $namespaceName = ''; + while (isset($validTokens[$tokens[$nextToken]['code']]) === true) { + $namespaceName .= trim($tokens[$nextToken]['content']); + $nextToken++; + } + + return $namespaceName; + } + + + /** + * Get the stack pointer for a return type token for a given function. + * + * Compatible layer for older PHPCS versions which don't recognize + * return type hints correctly. + * + * Expects to be passed T_RETURN_TYPE, T_FUNCTION or T_CLOSURE token. + * + * @since 7.1.2 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the token. + * + * @return int|false Stack pointer to the return type token or false if + * no return type was found or the passed token was + * not of the correct type. + */ + public function getReturnTypeHintToken(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + if (\defined('T_RETURN_TYPE') && $tokens[$stackPtr]['code'] === \T_RETURN_TYPE) { + return $stackPtr; + } + + if ($tokens[$stackPtr]['code'] !== \T_FUNCTION && $tokens[$stackPtr]['code'] !== \T_CLOSURE) { + return false; + } + + if (isset($tokens[$stackPtr]['parenthesis_closer']) === false) { + return false; + } + + // Allow for interface and abstract method declarations. + $endOfFunctionDeclaration = null; + if (isset($tokens[$stackPtr]['scope_opener'])) { + $endOfFunctionDeclaration = $tokens[$stackPtr]['scope_opener']; + } else { + $nextSemiColon = $phpcsFile->findNext(\T_SEMICOLON, ($tokens[$stackPtr]['parenthesis_closer'] + 1), null, false, null, true); + if ($nextSemiColon !== false) { + $endOfFunctionDeclaration = $nextSemiColon; + } + } + + if (isset($endOfFunctionDeclaration) === false) { + return false; + } + + $hasColon = $phpcsFile->findNext( + array(\T_COLON, \T_INLINE_ELSE), + ($tokens[$stackPtr]['parenthesis_closer'] + 1), + $endOfFunctionDeclaration + ); + if ($hasColon === false) { + return false; + } + + /* + * - `self`, `parent` and `callable` are not being recognized as return types in PHPCS < 2.6.0. + * - Return types are not recognized at all in PHPCS < 2.4.0. + * - The T_RETURN_TYPE token is defined, but no longer in use since PHPCS 3.3.0+. + * The token will now be tokenized as T_STRING. + * - An `array` (return) type declaration was tokenized as `T_ARRAY_HINT` in PHPCS 2.3.3 - 3.2.3 + * to prevent confusing sniffs looking for array declarations. + * As of PHPCS 3.3.0 `array` as a type declaration will be tokenized as `T_STRING`. + */ + $unrecognizedTypes = array( + \T_CALLABLE, + \T_SELF, + \T_PARENT, + \T_ARRAY, // PHPCS < 2.4.0. + \T_STRING, + ); + + return $phpcsFile->findPrevious($unrecognizedTypes, ($endOfFunctionDeclaration - 1), $hasColon); + } + + + /** + * Get the complete return type declaration for a given function. + * + * Cross-version compatible way to retrieve the complete return type declaration. + * + * For a classname-based return type, PHPCS, as well as the Sniff::getReturnTypeHintToken() + * method will mark the classname as the return type token. + * This method will find preceeding namespaces and namespace separators and will return a + * string containing the qualified return type declaration. + * + * Expects to be passed a T_RETURN_TYPE token or the return value from a call to + * the Sniff::getReturnTypeHintToken() method. + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the return type token. + * + * @return string The name of the return type token. + */ + public function getReturnTypeHintName(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + // In older PHPCS versions, the nullable indicator will turn a return type colon into a T_INLINE_ELSE. + $colon = $phpcsFile->findPrevious(array(\T_COLON, \T_INLINE_ELSE, \T_FUNCTION, \T_CLOSE_PARENTHESIS), ($stackPtr - 1)); + if ($colon === false + || ($tokens[$colon]['code'] !== \T_COLON && $tokens[$colon]['code'] !== \T_INLINE_ELSE) + ) { + // Shouldn't happen, just in case. + return ''; + } + + $returnTypeHint = ''; + for ($i = ($colon + 1); $i <= $stackPtr; $i++) { + // As of PHPCS 3.3.0+, all tokens are tokenized as "normal", so T_CALLABLE, T_SELF etc are + // all possible, just exclude anything that's regarded as empty and the nullable indicator. + if (isset(Tokens::$emptyTokens[$tokens[$i]['code']])) { + continue; + } + + if ($tokens[$i]['type'] === 'T_NULLABLE') { + continue; + } + + if (\defined('T_NULLABLE') === false && $tokens[$i]['code'] === \T_INLINE_THEN) { + // Old PHPCS. + continue; + } + + $returnTypeHint .= $tokens[$i]['content']; + } + + return $returnTypeHint; + } + + + /** + * Check whether a T_VARIABLE token is a class property declaration. + * + * Compatibility layer for PHPCS cross-version compatibility + * as PHPCS 2.4.0 - 2.7.1 does not have good enough support for + * anonymous classes. Along the same lines, the`getMemberProperties()` + * method does not support the `var` prefix. + * + * @since 7.1.4 + * + * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile. + * @param int $stackPtr The position in the stack of the + * T_VARIABLE token to verify. + * + * @return bool + */ + public function isClassProperty(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + if (isset($tokens[$stackPtr]) === false || $tokens[$stackPtr]['code'] !== \T_VARIABLE) { + return false; + } + + // Note: interfaces can not declare properties. + $validScopes = array( + 'T_CLASS' => true, + 'T_ANON_CLASS' => true, + 'T_TRAIT' => true, + ); + + $scopePtr = $this->validDirectScope($phpcsFile, $stackPtr, $validScopes); + if ($scopePtr !== false) { + // Make sure it's not a method parameter. + if (empty($tokens[$stackPtr]['nested_parenthesis']) === true) { + return true; + } else { + $parenthesis = array_keys($tokens[$stackPtr]['nested_parenthesis']); + $deepestOpen = array_pop($parenthesis); + if ($deepestOpen < $scopePtr + || isset($tokens[$deepestOpen]['parenthesis_owner']) === false + || $tokens[$tokens[$deepestOpen]['parenthesis_owner']]['code'] !== \T_FUNCTION + ) { + return true; + } + } + } + + return false; + } + + + /** + * Check whether a T_CONST token is a class constant declaration. + * + * @since 7.1.4 + * + * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile. + * @param int $stackPtr The position in the stack of the + * T_CONST token to verify. + * + * @return bool + */ + public function isClassConstant(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + if (isset($tokens[$stackPtr]) === false || $tokens[$stackPtr]['code'] !== \T_CONST) { + return false; + } + + // Note: traits can not declare constants. + $validScopes = array( + 'T_CLASS' => true, + 'T_ANON_CLASS' => true, + 'T_INTERFACE' => true, + ); + if ($this->validDirectScope($phpcsFile, $stackPtr, $validScopes) !== false) { + return true; + } + + return false; + } + + + /** + * Check whether the direct wrapping scope of a token is within a limited set of + * acceptable tokens. + * + * Used to check, for instance, if a T_CONST is a class constant. + * + * @since 7.1.4 + * + * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile. + * @param int $stackPtr The position in the stack of the + * token to verify. + * @param array $validScopes Array of token types. + * Keys should be the token types in string + * format to allow for newer token types. + * Value is irrelevant. + * + * @return int|bool StackPtr to the scope if valid, false otherwise. + */ + protected function validDirectScope(File $phpcsFile, $stackPtr, $validScopes) + { + $tokens = $phpcsFile->getTokens(); + + if (empty($tokens[$stackPtr]['conditions']) === true) { + return false; + } + + /* + * Check only the direct wrapping scope of the token. + */ + $conditions = array_keys($tokens[$stackPtr]['conditions']); + $ptr = array_pop($conditions); + + if (isset($tokens[$ptr]) === false) { + return false; + } + + if (isset($validScopes[$tokens[$ptr]['type']]) === true) { + return $ptr; + } + + return false; + } + + + /** + * Get an array of just the type hints from a function declaration. + * + * Expects to be passed T_FUNCTION or T_CLOSURE token. + * + * Strips potential nullable indicator and potential global namespace + * indicator from the type hints before returning them. + * + * @since 7.1.4 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the token. + * + * @return array Array with type hints or an empty array if + * - the function does not have any parameters + * - no type hints were found + * - or the passed token was not of the correct type. + */ + public function getTypeHintsFromFunctionDeclaration(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + if ($tokens[$stackPtr]['code'] !== \T_FUNCTION && $tokens[$stackPtr]['code'] !== \T_CLOSURE) { + return array(); + } + + $parameters = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr); + if (empty($parameters) || \is_array($parameters) === false) { + return array(); + } + + $typeHints = array(); + + foreach ($parameters as $param) { + if ($param['type_hint'] === '') { + continue; + } + + // Strip off potential nullable indication. + $typeHint = ltrim($param['type_hint'], '?'); + + // Strip off potential (global) namespace indication. + $typeHint = ltrim($typeHint, '\\'); + + if ($typeHint !== '') { + $typeHints[] = $typeHint; + } + } + + return $typeHints; + } + + + /** + * Get the hash algorithm name from the parameter in a hash function call. + * + * @since 7.0.7 Logic was originally contained in the `RemovedHashAlgorithms` sniff. + * + * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile. + * @param int $stackPtr The position of the T_STRING function token. + * + * @return string|false The algorithm name without quotes if this was a relevant hash + * function call or false if it was not. + */ + public function getHashAlgorithmParameter(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + // Check for the existence of the token. + if (isset($tokens[$stackPtr]) === false) { + return false; + } + + if ($tokens[$stackPtr]['code'] !== \T_STRING) { + return false; + } + + $functionName = $tokens[$stackPtr]['content']; + $functionNameLc = strtolower($functionName); + + // Bow out if not one of the functions we're targetting. + if (isset($this->hashAlgoFunctions[$functionNameLc]) === false) { + return false; + } + + // Get the parameter from the function call which should contain the algorithm name. + $algoParam = $this->getFunctionCallParameter($phpcsFile, $stackPtr, $this->hashAlgoFunctions[$functionNameLc]); + if ($algoParam === false) { + return false; + } + + // Algorithm is a text string, so we need to remove the quotes. + $algo = strtolower(trim($algoParam['raw'])); + $algo = $this->stripQuotes($algo); + + return $algo; + } + + + /** + * Determine whether an arbitrary T_STRING token is the use of a global constant. + * + * @since 8.1.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the T_STRING token. + * + * @return bool + */ + public function isUseOfGlobalConstant(File $phpcsFile, $stackPtr) + { + static $isLowPHPCS, $isLowPHP; + + $tokens = $phpcsFile->getTokens(); + + // Check for the existence of the token. + if (isset($tokens[$stackPtr]) === false) { + return false; + } + + // Is this one of the tokens this function handles ? + if ($tokens[$stackPtr]['code'] !== \T_STRING) { + return false; + } + + // Check for older PHP, PHPCS version so we can compensate for misidentified tokens. + if (isset($isLowPHPCS, $isLowPHP) === false) { + $isLowPHP = false; + $isLowPHPCS = false; + if (version_compare(\PHP_VERSION_ID, '50400', '<')) { + $isLowPHP = true; + $isLowPHPCS = version_compare(PHPCSHelper::getVersion(), '2.4.0', '<'); + } + } + + $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($next !== false + && ($tokens[$next]['code'] === \T_OPEN_PARENTHESIS + || $tokens[$next]['code'] === \T_DOUBLE_COLON) + ) { + // Function call or declaration. + return false; + } + + // Array of tokens which if found preceding the $stackPtr indicate that a T_STRING is not a global constant. + $tokensToIgnore = array( + 'T_NAMESPACE' => true, + 'T_USE' => true, + 'T_CLASS' => true, + 'T_TRAIT' => true, + 'T_INTERFACE' => true, + 'T_EXTENDS' => true, + 'T_IMPLEMENTS' => true, + 'T_NEW' => true, + 'T_FUNCTION' => true, + 'T_DOUBLE_COLON' => true, + 'T_OBJECT_OPERATOR' => true, + 'T_INSTANCEOF' => true, + 'T_INSTEADOF' => true, + 'T_GOTO' => true, + 'T_AS' => true, + 'T_PUBLIC' => true, + 'T_PROTECTED' => true, + 'T_PRIVATE' => true, + ); + + $prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); + if ($prev !== false + && (isset($tokensToIgnore[$tokens[$prev]['type']]) === true + || ($tokens[$prev]['code'] === \T_STRING + && (($isLowPHPCS === true + && $tokens[$prev]['content'] === 'trait') + || ($isLowPHP === true + && $tokens[$prev]['content'] === 'insteadof')))) + ) { + // Not the use of a constant. + return false; + } + + if ($prev !== false + && $tokens[$prev]['code'] === \T_NS_SEPARATOR + && $tokens[($prev - 1)]['code'] === \T_STRING + ) { + // Namespaced constant of the same name. + return false; + } + + if ($prev !== false + && $tokens[$prev]['code'] === \T_CONST + && $this->isClassConstant($phpcsFile, $prev) === true + ) { + // Class constant declaration of the same name. + return false; + } + + /* + * Deal with a number of variations of use statements. + */ + for ($i = $stackPtr; $i > 0; $i--) { + if ($tokens[$i]['line'] !== $tokens[$stackPtr]['line']) { + break; + } + } + + $firstOnLine = $phpcsFile->findNext(Tokens::$emptyTokens, ($i + 1), null, true); + if ($firstOnLine !== false && $tokens[$firstOnLine]['code'] === \T_USE) { + $nextOnLine = $phpcsFile->findNext(Tokens::$emptyTokens, ($firstOnLine + 1), null, true); + if ($nextOnLine !== false) { + if (($tokens[$nextOnLine]['code'] === \T_STRING && $tokens[$nextOnLine]['content'] === 'const') + || $tokens[$nextOnLine]['code'] === \T_CONST // Happens in some PHPCS versions. + ) { + $hasNsSep = $phpcsFile->findNext(\T_NS_SEPARATOR, ($nextOnLine + 1), $stackPtr); + if ($hasNsSep !== false) { + // Namespaced const (group) use statement. + return false; + } + } else { + // Not a const use statement. + return false; + } + } + } + + return true; + } + + + /** + * Determine whether the tokens between $start and $end together form a positive number + * as recognized by PHP. + * + * The outcome of this function is reliable for `true`, `false` should be regarded as + * "undetermined". + * + * Note: Zero is *not* regarded as a positive number. + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $start Start of the snippet (inclusive), i.e. this + * token will be examined as part of the snippet. + * @param int $end End of the snippet (inclusive), i.e. this + * token will be examined as part of the snippet. + * @param bool $allowFloats Whether to only consider integers, or also floats. + * + * @return bool True if PHP would evaluate the snippet as a positive number. + * False if not or if it could not be reliably determined + * (variable or calculations and such). + */ + public function isPositiveNumber(File $phpcsFile, $start, $end, $allowFloats = false) + { + $number = $this->isNumber($phpcsFile, $start, $end, $allowFloats); + + if ($number === false) { + return false; + } + + return ($number > 0); + } + + + /** + * Determine whether the tokens between $start and $end together form a negative number + * as recognized by PHP. + * + * The outcome of this function is reliable for `true`, `false` should be regarded as + * "undetermined". + * + * Note: Zero is *not* regarded as a negative number. + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $start Start of the snippet (inclusive), i.e. this + * token will be examined as part of the snippet. + * @param int $end End of the snippet (inclusive), i.e. this + * token will be examined as part of the snippet. + * @param bool $allowFloats Whether to only consider integers, or also floats. + * + * @return bool True if PHP would evaluate the snippet as a negative number. + * False if not or if it could not be reliably determined + * (variable or calculations and such). + */ + public function isNegativeNumber(File $phpcsFile, $start, $end, $allowFloats = false) + { + $number = $this->isNumber($phpcsFile, $start, $end, $allowFloats); + + if ($number === false) { + return false; + } + + return ($number < 0); + } + + /** + * Determine whether the tokens between $start and $end together form a number + * as recognized by PHP. + * + * The outcome of this function is reliable for "true-ish" values, `false` should + * be regarded as "undetermined". + * + * @link https://3v4l.org/npTeM + * + * Mainly intended for examining variable assignments, function call parameters, array values + * where the start and end of the snippet to examine is very clear. + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $start Start of the snippet (inclusive), i.e. this + * token will be examined as part of the snippet. + * @param int $end End of the snippet (inclusive), i.e. this + * token will be examined as part of the snippet. + * @param bool $allowFloats Whether to only consider integers, or also floats. + * + * @return int|float|bool The number found if PHP would evaluate the snippet as a number. + * The return type will be int if $allowFloats is false, if + * $allowFloats is true, the return type will be float. + * False will be returned when the snippet does not evaluate to a + * number or if it could not be reliably determined + * (variable or calculations and such). + */ + protected function isNumber(File $phpcsFile, $start, $end, $allowFloats = false) + { + $stringTokens = Tokens::$heredocTokens + Tokens::$stringTokens; + + $validTokens = array(); + $validTokens[\T_LNUMBER] = true; + $validTokens[\T_TRUE] = true; // Evaluates to int 1. + $validTokens[\T_FALSE] = true; // Evaluates to int 0. + $validTokens[\T_NULL] = true; // Evaluates to int 0. + + if ($allowFloats === true) { + $validTokens[\T_DNUMBER] = true; + } + + $maybeValidTokens = $stringTokens + $validTokens; + + $tokens = $phpcsFile->getTokens(); + $searchEnd = ($end + 1); + $negativeNumber = false; + + if (isset($tokens[$start], $tokens[$searchEnd]) === false) { + return false; + } + + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $start, $searchEnd, true); + while ($nextNonEmpty !== false + && ($tokens[$nextNonEmpty]['code'] === \T_PLUS + || $tokens[$nextNonEmpty]['code'] === \T_MINUS) + ) { + + if ($tokens[$nextNonEmpty]['code'] === \T_MINUS) { + $negativeNumber = ($negativeNumber === false) ? true : false; + } + + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($nextNonEmpty + 1), $searchEnd, true); + } + + if ($nextNonEmpty === false || isset($maybeValidTokens[$tokens[$nextNonEmpty]['code']]) === false) { + return false; + } + + $content = false; + if ($tokens[$nextNonEmpty]['code'] === \T_LNUMBER + || $tokens[$nextNonEmpty]['code'] === \T_DNUMBER + ) { + $content = (float) $tokens[$nextNonEmpty]['content']; + } elseif ($tokens[$nextNonEmpty]['code'] === \T_TRUE) { + $content = 1.0; + } elseif ($tokens[$nextNonEmpty]['code'] === \T_FALSE + || $tokens[$nextNonEmpty]['code'] === \T_NULL + ) { + $content = 0.0; + } elseif (isset($stringTokens[$tokens[$nextNonEmpty]['code']]) === true) { + + if ($tokens[$nextNonEmpty]['code'] === \T_START_HEREDOC + || $tokens[$nextNonEmpty]['code'] === \T_START_NOWDOC + ) { + // Skip past heredoc/nowdoc opener to the first content. + $firstDocToken = $phpcsFile->findNext(array(\T_HEREDOC, \T_NOWDOC), ($nextNonEmpty + 1), $searchEnd); + if ($firstDocToken === false) { + // Live coding or parse error. + return false; + } + + $stringContent = $content = $tokens[$firstDocToken]['content']; + + // Skip forward to the end in preparation for the next part of the examination. + $nextNonEmpty = $phpcsFile->findNext(array(\T_END_HEREDOC, \T_END_NOWDOC), ($nextNonEmpty + 1), $searchEnd); + if ($nextNonEmpty === false) { + // Live coding or parse error. + return false; + } + } else { + // Gather subsequent lines for a multi-line string. + for ($i = $nextNonEmpty; $i < $searchEnd; $i++) { + if ($tokens[$i]['code'] !== $tokens[$nextNonEmpty]['code']) { + break; + } + $content .= $tokens[$i]['content']; + } + + $nextNonEmpty = --$i; + $content = $this->stripQuotes($content); + $stringContent = $content; + } + + /* + * Regexes based on the formats outlined in the manual, created by JRF. + * @link https://www.php.net/manual/en/language.types.float.php + */ + $regexInt = '`^\s*[0-9]+`'; + $regexFloat = '`^\s*(?:[+-]?(?:(?:(?P<LNUM>[0-9]+)|(?P<DNUM>([0-9]*\.(?P>LNUM)|(?P>LNUM)\.[0-9]*)))[eE][+-]?(?P>LNUM))|(?P>DNUM))`'; + + $intString = preg_match($regexInt, $content, $intMatch); + $floatString = preg_match($regexFloat, $content, $floatMatch); + + // Does the text string start with a number ? If so, PHP would juggle it and use it as a number. + if ($allowFloats === false) { + if ($intString !== 1 || $floatString === 1) { + if ($floatString === 1) { + // Found float. Only integers targetted. + return false; + } + + $content = 0.0; + } else { + $content = (float) trim($intMatch[0]); + } + } else { + if ($intString !== 1 && $floatString !== 1) { + $content = 0.0; + } else { + $content = ($floatString === 1) ? (float) trim($floatMatch[0]) : (float) trim($intMatch[0]); + } + } + + // Allow for different behaviour for hex numeric strings between PHP 5 vs PHP 7. + if ($intString === 1 && trim($intMatch[0]) === '0' + && preg_match('`^\s*(0x[A-Fa-f0-9]+)`', $stringContent, $hexNumberString) === 1 + && $this->supportsBelow('5.6') === true + ) { + // The filter extension still allows for hex numeric strings in PHP 7, so + // use that to get the numeric value if possible. + // If the filter extension is not available, the value will be zero, but so be it. + if (function_exists('filter_var')) { + $filtered = filter_var($hexNumberString[1], \FILTER_VALIDATE_INT, \FILTER_FLAG_ALLOW_HEX); + if ($filtered !== false) { + $content = $filtered; + } + } + } + } + + // OK, so we have a number, now is there still more code after it ? + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($nextNonEmpty + 1), $searchEnd, true); + if ($nextNonEmpty !== false) { + return false; + } + + if ($negativeNumber === true) { + $content = -$content; + } + + if ($allowFloats === false) { + return (int) $content; + } + + return $content; + } + + + /** + * Determine whether the tokens between $start and $end together form a numberic calculation + * as recognized by PHP. + * + * The outcome of this function is reliable for `true`, `false` should be regarded as "undetermined". + * + * Mainly intended for examining variable assignments, function call parameters, array values + * where the start and end of the snippet to examine is very clear. + * + * @since 9.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $start Start of the snippet (inclusive), i.e. this + * token will be examined as part of the snippet. + * @param int $end End of the snippet (inclusive), i.e. this + * token will be examined as part of the snippet. + * + * @return bool + */ + protected function isNumericCalculation(File $phpcsFile, $start, $end) + { + $arithmeticTokens = Tokens::$arithmeticTokens; + + // phpcs:disable PHPCompatibility.Constants.NewConstants.t_powFound + if (\defined('T_POW') && isset($arithmeticTokens[\T_POW]) === false) { + // T_POW was not added to the arithmetic array until PHPCS 2.9.0. + $arithmeticTokens[\T_POW] = \T_POW; + } + // phpcs:enable + + $skipTokens = Tokens::$emptyTokens; + $skipTokens[] = \T_MINUS; + $skipTokens[] = \T_PLUS; + + // Find the first arithmetic operator, but skip past +/- signs before numbers. + $nextNonEmpty = ($start - 1); + do { + $nextNonEmpty = $phpcsFile->findNext($skipTokens, ($nextNonEmpty + 1), ($end + 1), true); + $arithmeticOperator = $phpcsFile->findNext($arithmeticTokens, ($nextNonEmpty + 1), ($end + 1)); + } while ($nextNonEmpty !== false && $arithmeticOperator !== false && $nextNonEmpty === $arithmeticOperator); + + if ($arithmeticOperator === false) { + return false; + } + + $tokens = $phpcsFile->getTokens(); + $subsetStart = $start; + $subsetEnd = ($arithmeticOperator - 1); + + while ($this->isNumber($phpcsFile, $subsetStart, $subsetEnd, true) !== false + && isset($tokens[($arithmeticOperator + 1)]) === true + ) { + // Recognize T_POW for PHPCS < 2.4.0 on low PHP versions. + if (\defined('T_POW') === false + && $tokens[$arithmeticOperator]['code'] === \T_MULTIPLY + && $tokens[($arithmeticOperator + 1)]['code'] === \T_MULTIPLY + && isset($tokens[$arithmeticOperator + 2]) === true + ) { + // Move operator one forward to the second * in T_POW. + ++$arithmeticOperator; + } + + $subsetStart = ($arithmeticOperator + 1); + $nextNonEmpty = $arithmeticOperator; + do { + $nextNonEmpty = $phpcsFile->findNext($skipTokens, ($nextNonEmpty + 1), ($end + 1), true); + $arithmeticOperator = $phpcsFile->findNext($arithmeticTokens, ($nextNonEmpty + 1), ($end + 1)); + } while ($nextNonEmpty !== false && $arithmeticOperator !== false && $nextNonEmpty === $arithmeticOperator); + + if ($arithmeticOperator === false) { + // Last calculation operator already reached. + if ($this->isNumber($phpcsFile, $subsetStart, $end, true) !== false) { + return true; + } + + return false; + } + + $subsetEnd = ($arithmeticOperator - 1); + } + + return false; + } + + + + /** + * Determine whether a ternary is a short ternary, i.e. without "middle". + * + * N.B.: This is a back-fill for a new method which is expected to go into + * PHP_CodeSniffer 3.5.0. + * Once that method has been merged into PHPCS, this one should be moved + * to the PHPCSHelper.php file. + * + * @since 9.2.0 + * + * @codeCoverageIgnore Method as pulled upstream is accompanied by unit tests. + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the ternary operator + * in the stack. + * + * @return bool True if short ternary, or false otherwise. + */ + public function isShortTernary(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + if (isset($tokens[$stackPtr]) === false + || $tokens[$stackPtr]['code'] !== \T_INLINE_THEN + ) { + return false; + } + + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($nextNonEmpty === false) { + // Live coding or parse error. + return false; + } + + if ($tokens[$nextNonEmpty]['code'] === \T_INLINE_ELSE) { + return true; + } + + return false; + } + + + /** + * Determine whether a T_OPEN/CLOSE_SHORT_ARRAY token is a list() construct. + * + * Note: A variety of PHPCS versions have bugs in the tokenizing of short arrays. + * In that case, the tokens are identified as T_OPEN/CLOSE_SQUARE_BRACKET. + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the function call token. + * + * @return bool + */ + public function isShortList(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + // Check for the existence of the token. + if (isset($tokens[$stackPtr]) === false) { + return false; + } + + // Is this one of the tokens this function handles ? + if ($tokens[$stackPtr]['code'] !== \T_OPEN_SHORT_ARRAY + && $tokens[$stackPtr]['code'] !== \T_CLOSE_SHORT_ARRAY + ) { + return false; + } + + switch ($tokens[$stackPtr]['code']) { + case \T_OPEN_SHORT_ARRAY: + if (isset($tokens[$stackPtr]['bracket_closer']) === true) { + $opener = $stackPtr; + $closer = $tokens[$stackPtr]['bracket_closer']; + } + break; + + case \T_CLOSE_SHORT_ARRAY: + if (isset($tokens[$stackPtr]['bracket_opener']) === true) { + $opener = $tokens[$stackPtr]['bracket_opener']; + $closer = $stackPtr; + } + break; + } + + if (isset($opener, $closer) === false) { + // Parse error, live coding or real square bracket. + return false; + } + + /* + * PHPCS cross-version compatibility: work around for square brackets misidentified + * as short array when preceded by a variable variable in older PHPCS versions. + */ + $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($opener - 1), null, true, null, true); + + if ($prevNonEmpty !== false + && $tokens[$prevNonEmpty]['code'] === \T_CLOSE_CURLY_BRACKET + && isset($tokens[$prevNonEmpty]['bracket_opener']) === true + ) { + $maybeVariableVariable = $phpcsFile->findPrevious( + Tokens::$emptyTokens, + ($tokens[$prevNonEmpty]['bracket_opener'] - 1), + null, + true, + null, + true + ); + + if ($tokens[$maybeVariableVariable]['code'] === \T_VARIABLE + || $tokens[$maybeVariableVariable]['code'] === \T_DOLLAR + ) { + return false; + } + } + + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($closer + 1), null, true, null, true); + + if ($nextNonEmpty !== false && $tokens[$nextNonEmpty]['code'] === \T_EQUAL) { + return true; + } + + if ($prevNonEmpty !== false + && $tokens[$prevNonEmpty]['code'] === \T_AS + && isset($tokens[$prevNonEmpty]['nested_parenthesis']) === true + ) { + $parentheses = array_reverse($tokens[$prevNonEmpty]['nested_parenthesis'], true); + foreach ($parentheses as $open => $close) { + if (isset($tokens[$open]['parenthesis_owner']) + && $tokens[$tokens[$open]['parenthesis_owner']]['code'] === \T_FOREACH + ) { + return true; + } + } + } + + // Maybe this is a short list syntax nested inside another short list syntax ? + $parentOpener = $opener; + do { + $parentOpener = $phpcsFile->findPrevious( + array(\T_OPEN_SHORT_ARRAY, \T_OPEN_SQUARE_BRACKET), + ($parentOpener - 1), + null, + false, + null, + true + ); + + if ($parentOpener === false) { + return false; + } + + } while (isset($tokens[$parentOpener]['bracket_closer']) === true + && $tokens[$parentOpener]['bracket_closer'] < $opener + ); + + if (isset($tokens[$parentOpener]['bracket_closer']) === true + && $tokens[$parentOpener]['bracket_closer'] > $closer + ) { + // Work around tokenizer issue in PHPCS 2.0 - 2.7. + $phpcsVersion = PHPCSHelper::getVersion(); + if ((version_compare($phpcsVersion, '2.0', '>') === true + && version_compare($phpcsVersion, '2.8', '<') === true) + && $tokens[$parentOpener]['code'] === \T_OPEN_SQUARE_BRACKET + ) { + $nextNonEmpty = $phpcsFile->findNext( + Tokens::$emptyTokens, + ($tokens[$parentOpener]['bracket_closer'] + 1), + null, + true, + null, + true + ); + + if ($nextNonEmpty !== false && $tokens[$nextNonEmpty]['code'] === \T_EQUAL) { + return true; + } + + return false; + } + + return $this->isShortList($phpcsFile, $parentOpener); + } + + return false; + } + + + /** + * Determine whether the tokens between $start and $end could together represent a variable. + * + * @since 9.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $start Starting point stack pointer. Inclusive. + * I.e. this token should be taken into account. + * @param int $end End point stack pointer. Exclusive. + * I.e. this token should not be taken into account. + * @param int $targetNestingLevel The nesting level the variable should be at. + * + * @return bool + */ + public function isVariable(File $phpcsFile, $start, $end, $targetNestingLevel) + { + static $tokenBlackList, $bracketTokens; + + // Create the token arrays only once. + if (isset($tokenBlackList, $bracketTokens) === false) { + + $tokenBlackList = array( + \T_OPEN_PARENTHESIS => \T_OPEN_PARENTHESIS, + \T_STRING_CONCAT => \T_STRING_CONCAT, + ); + $tokenBlackList += Tokens::$assignmentTokens; + $tokenBlackList += Tokens::$equalityTokens; + $tokenBlackList += Tokens::$comparisonTokens; + $tokenBlackList += Tokens::$operators; + $tokenBlackList += Tokens::$booleanOperators; + $tokenBlackList += Tokens::$castTokens; + + /* + * List of brackets which can be part of a variable variable. + * + * Key is the open bracket token, value the close bracket token. + */ + $bracketTokens = array( + \T_OPEN_CURLY_BRACKET => \T_CLOSE_CURLY_BRACKET, + \T_OPEN_SQUARE_BRACKET => \T_CLOSE_SQUARE_BRACKET, + ); + } + + $tokens = $phpcsFile->getTokens(); + + // If no variable at all was found, then it's definitely a no-no. + $hasVariable = $phpcsFile->findNext(\T_VARIABLE, $start, $end); + if ($hasVariable === false) { + return false; + } + + // Check if the variable found is at the right level. Deeper levels are always an error. + if (isset($tokens[$hasVariable]['nested_parenthesis']) + && \count($tokens[$hasVariable]['nested_parenthesis']) !== $targetNestingLevel + ) { + return false; + } + + // Ok, so the first variable is at the right level, now are there any + // blacklisted tokens within the empty() ? + $hasBadToken = $phpcsFile->findNext($tokenBlackList, $start, $end); + if ($hasBadToken === false) { + return true; + } + + // If there are also bracket tokens, the blacklisted token might be part of a variable + // variable, but if there are no bracket tokens, we know we have an error. + $hasBrackets = $phpcsFile->findNext($bracketTokens, $start, $end); + if ($hasBrackets === false) { + return false; + } + + // Ok, we have both a blacklisted token as well as brackets, so we need to walk + // the tokens of the variable variable. + for ($i = $start; $i < $end; $i++) { + // If this is a bracket token, skip to the end of the bracketed expression. + if (isset($bracketTokens[$tokens[$i]['code']], $tokens[$i]['bracket_closer'])) { + $i = $tokens[$i]['bracket_closer']; + continue; + } + + // If it's a blacklisted token, not within brackets, we have an error. + if (isset($tokenBlackList[$tokens[$i]['code']])) { + return false; + } + } + + return true; + } + + /** + * Determine whether a T_MINUS/T_PLUS token is a unary operator. + * + * N.B.: This is a back-fill for a new method which is expected to go into + * PHP_CodeSniffer 3.5.0. + * Once that method has been merged into PHPCS, this one should be moved + * to the PHPCSHelper.php file. + * + * @since 9.2.0 + * + * @codeCoverageIgnore Method as pulled upstream is accompanied by unit tests. + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the plus/minus token. + * + * @return bool True if the token passed is a unary operator. + * False otherwise or if the token is not a T_PLUS/T_MINUS token. + */ + public static function isUnaryPlusMinus(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + if (isset($tokens[$stackPtr]) === false + || ($tokens[$stackPtr]['code'] !== \T_PLUS + && $tokens[$stackPtr]['code'] !== \T_MINUS) + ) { + return false; + } + + $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($next === false) { + // Live coding or parse error. + return false; + } + + if (isset(Tokens::$operators[$tokens[$next]['code']]) === true) { + // Next token is an operator, so this is not a unary. + return false; + } + + $prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); + + if ($tokens[$prev]['code'] === \T_RETURN) { + // Just returning a positive/negative value; eg. (return -1). + return true; + } + + if (isset(Tokens::$operators[$tokens[$prev]['code']]) === true) { + // Just trying to operate on a positive/negative value; eg. ($var * -1). + return true; + } + + if (isset(Tokens::$comparisonTokens[$tokens[$prev]['code']]) === true) { + // Just trying to compare a positive/negative value; eg. ($var === -1). + return true; + } + + if (isset(Tokens::$booleanOperators[$tokens[$prev]['code']]) === true) { + // Just trying to compare a positive/negative value; eg. ($var || -1 === $b). + return true; + } + + if (isset(Tokens::$assignmentTokens[$tokens[$prev]['code']]) === true) { + // Just trying to assign a positive/negative value; eg. ($var = -1). + return true; + } + + if (isset(Tokens::$castTokens[$tokens[$prev]['code']]) === true) { + // Just casting a positive/negative value; eg. (string) -$var. + return true; + } + + // Other indicators that a plus/minus sign is a unary operator. + $invalidTokens = array( + \T_COMMA => true, + \T_OPEN_PARENTHESIS => true, + \T_OPEN_SQUARE_BRACKET => true, + \T_OPEN_SHORT_ARRAY => true, + \T_COLON => true, + \T_INLINE_THEN => true, + \T_INLINE_ELSE => true, + \T_CASE => true, + \T_OPEN_CURLY_BRACKET => true, + \T_STRING_CONCAT => true, + ); + + if (isset($invalidTokens[$tokens[$prev]['code']]) === true) { + // Just trying to use a positive/negative value; eg. myFunction($var, -2). + return true; + } + + return false; + } + + /** + * Get the complete contents of a multi-line text string. + * + * N.B.: This is a back-fill for a new method which is expected to go into + * PHP_CodeSniffer 3.5.0. + * Once that method has been merged into PHPCS, this one should be moved + * to the PHPCSHelper.php file. + * + * @since 9.3.0 + * + * @codeCoverageIgnore Method as pulled upstream is accompanied by unit tests. + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr Pointer to the first text string token + * of a multi-line text string or to a + * Nowdoc/Heredoc opener. + * @param bool $stripQuotes Optional. Whether to strip text delimiter + * quotes off the resulting text string. + * Defaults to true. + * + * @return string + * + * @throws \PHP_CodeSniffer_Exception If the specified position is not a + * valid text string token or if the + * token is not the first text string token. + */ + public function getCompleteTextString(File $phpcsFile, $stackPtr, $stripQuotes = true) + { + $tokens = $phpcsFile->getTokens(); + + // Must be the start of a text string token. + if ($tokens[$stackPtr]['code'] !== \T_START_HEREDOC + && $tokens[$stackPtr]['code'] !== \T_START_NOWDOC + && $tokens[$stackPtr]['code'] !== \T_CONSTANT_ENCAPSED_STRING + && $tokens[$stackPtr]['code'] !== \T_DOUBLE_QUOTED_STRING + ) { + throw new PHPCS_Exception('$stackPtr must be of type T_START_HEREDOC, T_START_NOWDOC, T_CONSTANT_ENCAPSED_STRING or T_DOUBLE_QUOTED_STRING'); + } + + if ($tokens[$stackPtr]['code'] === \T_CONSTANT_ENCAPSED_STRING + || $tokens[$stackPtr]['code'] === \T_DOUBLE_QUOTED_STRING + ) { + $prev = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true); + if ($tokens[$stackPtr]['code'] === $tokens[$prev]['code']) { + throw new PHPCS_Exception('$stackPtr must be the start of the text string'); + } + } + + switch ($tokens[$stackPtr]['code']) { + case \T_START_HEREDOC: + $stripQuotes = false; + $targetType = \T_HEREDOC; + $current = ($stackPtr + 1); + break; + + case \T_START_NOWDOC: + $stripQuotes = false; + $targetType = \T_NOWDOC; + $current = ($stackPtr + 1); + break; + + default: + $targetType = $tokens[$stackPtr]['code']; + $current = $stackPtr; + break; + } + + $string = ''; + do { + $string .= $tokens[$current]['content']; + ++$current; + } while ($tokens[$current]['code'] === $targetType); + + if ($stripQuotes === true) { + return $this->stripQuotes($string); + } + + return $string; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/ForbiddenAbstractPrivateMethodsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/ForbiddenAbstractPrivateMethodsSniff.php new file mode 100644 index 00000000..d0d74dfe --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/ForbiddenAbstractPrivateMethodsSniff.php @@ -0,0 +1,90 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Classes; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; + +/** + * Abstract private methods are not allowed since PHP 5.1. + * + * Abstract private methods were supported between PHP 5.0.0 and PHP 5.0.4, but + * were then disallowed on the grounds that the behaviours of `private` and `abstract` + * are mutually exclusive. + * + * PHP version 5.1 + * + * @link https://www.php.net/manual/en/migration51.oop.php#migration51.oop-methods + * + * @since 9.2.0 + */ +class ForbiddenAbstractPrivateMethodsSniff extends Sniff +{ + + /** + * Valid scopes to check for abstract private methods. + * + * @since 9.2.0 + * + * @var array + */ + public $ooScopeTokens = array( + 'T_CLASS' => true, + 'T_TRAIT' => true, + 'T_ANON_CLASS' => true, + ); + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 9.2.0 + * + * @return array + */ + public function register() + { + return array(\T_FUNCTION); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 9.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('5.1') === false) { + return; + } + + if ($this->validDirectScope($phpcsFile, $stackPtr, $this->ooScopeTokens) === false) { + // Function, not method. + return; + } + + $properties = $phpcsFile->getMethodProperties($stackPtr); + if ($properties['scope'] !== 'private' || $properties['is_abstract'] !== true) { + return; + } + + $phpcsFile->addError( + 'Abstract methods cannot be declared as private since PHP 5.1', + $stackPtr, + 'Found' + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewAnonymousClassesSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewAnonymousClassesSniff.php new file mode 100644 index 00000000..572b6fcc --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewAnonymousClassesSniff.php @@ -0,0 +1,91 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Classes; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Anonymous classes are supported since PHP 7.0. + * + * PHP version 7.0 + * + * @link https://www.php.net/manual/en/language.oop5.anonymous.php + * @link https://wiki.php.net/rfc/anonymous_classes + * + * @since 7.0.0 + */ +class NewAnonymousClassesSniff extends Sniff +{ + + /** + * Tokens which in various PHP versions indicate the `class` keyword. + * + * The dedicated anonymous class token is added from the `register()` + * method if the token is available. + * + * @since 7.1.2 + * + * @var array + */ + private $indicators = array( + \T_CLASS => \T_CLASS, + ); + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.0 + * + * @return array + */ + public function register() + { + if (\defined('T_ANON_CLASS')) { + $this->indicators[\T_ANON_CLASS] = \T_ANON_CLASS; + } + + return array(\T_NEW); + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('5.6') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true); + if ($nextNonEmpty === false || isset($this->indicators[$tokens[$nextNonEmpty]['code']]) === false) { + return; + } + + // Still here ? In that case, it is an anonymous class. + $phpcsFile->addError( + 'Anonymous classes are not supported in PHP 5.6 or earlier', + $stackPtr, + 'Found' + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewClassesSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewClassesSniff.php new file mode 100644 index 00000000..19e5e439 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewClassesSniff.php @@ -0,0 +1,913 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Classes; + +use PHPCompatibility\AbstractNewFeatureSniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect use of new PHP native classes. + * + * The sniff analyses the following constructs to find usage of new classes: + * - Class instantiation using the `new` keyword. + * - (Anonymous) Class declarations to detect new classes being extended by userland classes. + * - Static use of class properties, constants or functions using the double colon. + * - Function/closure declarations to detect new classes used as parameter type declarations. + * - Function/closure declarations to detect new classes used as return type declarations. + * - Try/catch statements to detect new exception classes being caught. + * + * PHP version All + * + * @since 5.5 + * @since 5.6 Now extends the base `Sniff` class. + * @since 7.1.0 Now extends the `AbstractNewFeatureSniff` class. + */ +class NewClassesSniff extends AbstractNewFeatureSniff +{ + + /** + * A list of new classes, not present in older versions. + * + * The array lists : version number with false (not present) or true (present). + * If's sufficient to list the first version where the class appears. + * + * @since 5.5 + * + * @var array(string => array(string => bool)) + */ + protected $newClasses = array( + 'ArrayObject' => array( + '4.4' => false, + '5.0' => true, + ), + 'ArrayIterator' => array( + '4.4' => false, + '5.0' => true, + ), + 'CachingIterator' => array( + '4.4' => false, + '5.0' => true, + ), + 'DirectoryIterator' => array( + '4.4' => false, + '5.0' => true, + ), + 'RecursiveDirectoryIterator' => array( + '4.4' => false, + '5.0' => true, + ), + 'RecursiveIteratorIterator' => array( + '4.4' => false, + '5.0' => true, + ), + 'php_user_filter' => array( + '4.4' => false, + '5.0' => true, + ), + 'tidy' => array( + '4.4' => false, + '5.0' => true, + ), + + 'SimpleXMLElement' => array( + '5.0.0' => false, + '5.0.1' => true, + ), + 'tidyNode' => array( + '5.0.0' => false, + '5.0.1' => true, + ), + + 'libXMLError' => array( + '5.0' => false, + '5.1' => true, + ), + 'PDO' => array( + '5.0' => false, + '5.1' => true, + ), + 'PDOStatement' => array( + '5.0' => false, + '5.1' => true, + ), + 'AppendIterator' => array( + '5.0' => false, + '5.1' => true, + ), + 'EmptyIterator' => array( + '5.0' => false, + '5.1' => true, + ), + 'FilterIterator' => array( + '5.0' => false, + '5.1' => true, + ), + 'InfiniteIterator' => array( + '5.0' => false, + '5.1' => true, + ), + 'IteratorIterator' => array( + '5.0' => false, + '5.1' => true, + ), + 'LimitIterator' => array( + '5.0' => false, + '5.1' => true, + ), + 'NoRewindIterator' => array( + '5.0' => false, + '5.1' => true, + ), + 'ParentIterator' => array( + '5.0' => false, + '5.1' => true, + ), + 'RecursiveArrayIterator' => array( + '5.0' => false, + '5.1' => true, + ), + 'RecursiveCachingIterator' => array( + '5.0' => false, + '5.1' => true, + ), + 'RecursiveFilterIterator' => array( + '5.0' => false, + '5.1' => true, + ), + 'SimpleXMLIterator' => array( + '5.0' => false, + '5.1' => true, + ), + 'SplFileObject' => array( + '5.0' => false, + '5.1' => true, + ), + 'XMLReader' => array( + '5.0' => false, + '5.1' => true, + ), + + 'SplFileInfo' => array( + '5.1.1' => false, + '5.1.2' => true, + ), + 'SplTempFileObject' => array( + '5.1.1' => false, + '5.1.2' => true, + ), + 'XMLWriter' => array( + '5.1.1' => false, + '5.1.2' => true, + ), + + 'DateTime' => array( + '5.1' => false, + '5.2' => true, + ), + 'DateTimeZone' => array( + '5.1' => false, + '5.2' => true, + ), + 'RegexIterator' => array( + '5.1' => false, + '5.2' => true, + ), + 'RecursiveRegexIterator' => array( + '5.1' => false, + '5.2' => true, + ), + 'ReflectionFunctionAbstract' => array( + '5.1' => false, + '5.2' => true, + ), + 'ZipArchive' => array( + '5.1' => false, + '5.2' => true, + ), + + 'Closure' => array( + '5.2' => false, + '5.3' => true, + ), + 'DateInterval' => array( + '5.2' => false, + '5.3' => true, + ), + 'DatePeriod' => array( + '5.2' => false, + '5.3' => true, + ), + 'finfo' => array( + '5.2' => false, + '5.3' => true, + ), + 'Collator' => array( + '5.2' => false, + '5.3' => true, + ), + 'NumberFormatter' => array( + '5.2' => false, + '5.3' => true, + ), + 'Locale' => array( + '5.2' => false, + '5.3' => true, + ), + 'Normalizer' => array( + '5.2' => false, + '5.3' => true, + ), + 'MessageFormatter' => array( + '5.2' => false, + '5.3' => true, + ), + 'IntlDateFormatter' => array( + '5.2' => false, + '5.3' => true, + ), + 'Phar' => array( + '5.2' => false, + '5.3' => true, + ), + 'PharData' => array( + '5.2' => false, + '5.3' => true, + ), + 'PharFileInfo' => array( + '5.2' => false, + '5.3' => true, + ), + 'FilesystemIterator' => array( + '5.2' => false, + '5.3' => true, + ), + 'GlobIterator' => array( + '5.2' => false, + '5.3' => true, + ), + 'MultipleIterator' => array( + '5.2' => false, + '5.3' => true, + ), + 'RecursiveTreeIterator' => array( + '5.2' => false, + '5.3' => true, + ), + 'SplDoublyLinkedList' => array( + '5.2' => false, + '5.3' => true, + ), + 'SplFixedArray' => array( + '5.2' => false, + '5.3' => true, + ), + 'SplHeap' => array( + '5.2' => false, + '5.3' => true, + ), + 'SplMaxHeap' => array( + '5.2' => false, + '5.3' => true, + ), + 'SplMinHeap' => array( + '5.2' => false, + '5.3' => true, + ), + 'SplObjectStorage' => array( + '5.2' => false, + '5.3' => true, + ), + 'SplPriorityQueue' => array( + '5.2' => false, + '5.3' => true, + ), + 'SplQueue' => array( + '5.2' => false, + '5.3' => true, + ), + 'SplStack' => array( + '5.2' => false, + '5.3' => true, + ), + + 'ResourceBundle' => array( + '5.3.1' => false, + '5.3.2' => true, + ), + + 'CallbackFilterIterator' => array( + '5.3' => false, + '5.4' => true, + ), + 'RecursiveCallbackFilterIterator' => array( + '5.3' => false, + '5.4' => true, + ), + 'ReflectionZendExtension' => array( + '5.3' => false, + '5.4' => true, + ), + 'SessionHandler' => array( + '5.3' => false, + '5.4' => true, + ), + 'SNMP' => array( + '5.3' => false, + '5.4' => true, + ), + 'Transliterator' => array( + '5.3' => false, + '5.4' => true, + ), + 'Spoofchecker' => array( + '5.3' => false, + '5.4' => true, + ), + + 'Generator' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLFile' => array( + '5.4' => false, + '5.5' => true, + ), + 'DateTimeImmutable' => array( + '5.4' => false, + '5.5' => true, + ), + 'IntlCalendar' => array( + '5.4' => false, + '5.5' => true, + ), + 'IntlGregorianCalendar' => array( + '5.4' => false, + '5.5' => true, + ), + 'IntlTimeZone' => array( + '5.4' => false, + '5.5' => true, + ), + 'IntlBreakIterator' => array( + '5.4' => false, + '5.5' => true, + ), + 'IntlRuleBasedBreakIterator' => array( + '5.4' => false, + '5.5' => true, + ), + 'IntlCodePointBreakIterator' => array( + '5.4' => false, + '5.5' => true, + ), + 'UConverter' => array( + '5.4' => false, + '5.5' => true, + ), + + 'GMP' => array( + '5.5' => false, + '5.6' => true, + ), + + 'IntlChar' => array( + '5.6' => false, + '7.0' => true, + ), + 'ReflectionType' => array( + '5.6' => false, + '7.0' => true, + ), + 'ReflectionGenerator' => array( + '5.6' => false, + '7.0' => true, + ), + + 'ReflectionClassConstant' => array( + '7.0' => false, + '7.1' => true, + ), + + 'FFI' => array( + '7.3' => false, + '7.4' => true, + ), + 'FFI\CData' => array( + '7.3' => false, + '7.4' => true, + ), + 'FFI\CType' => array( + '7.3' => false, + '7.4' => true, + ), + 'ReflectionReference' => array( + '7.3' => false, + '7.4' => true, + ), + 'WeakReference' => array( + '7.3' => false, + '7.4' => true, + ), + ); + + /** + * A list of new Exception classes, not present in older versions. + * + * The array lists : version number with false (not present) or true (present). + * If's sufficient to list the first version where the class appears. + * + * {@internal Classes listed here do not need to be added to the $newClasses + * property as well. + * This list is automatically added to the $newClasses property + * in the `register()` method.} + * + * {@internal Helper to update this list: https://3v4l.org/MhlUp} + * + * @since 7.1.4 + * + * @var array(string => array(string => bool)) + */ + protected $newExceptions = array( + 'com_exception' => array( + '4.4' => false, + '5.0' => true, + ), + 'DOMException' => array( + '4.4' => false, + '5.0' => true, + ), + 'Exception' => array( + // According to the docs introduced in PHP 5.1, but this appears to be. + // an error. Class was introduced with try/catch keywords in PHP 5.0. + '4.4' => false, + '5.0' => true, + ), + 'ReflectionException' => array( + '4.4' => false, + '5.0' => true, + ), + 'SoapFault' => array( + '4.4' => false, + '5.0' => true, + ), + 'SQLiteException' => array( + '4.4' => false, + '5.0' => true, + ), + + 'ErrorException' => array( + '5.0' => false, + '5.1' => true, + ), + 'BadFunctionCallException' => array( + '5.0' => false, + '5.1' => true, + ), + 'BadMethodCallException' => array( + '5.0' => false, + '5.1' => true, + ), + 'DomainException' => array( + '5.0' => false, + '5.1' => true, + ), + 'InvalidArgumentException' => array( + '5.0' => false, + '5.1' => true, + ), + 'LengthException' => array( + '5.0' => false, + '5.1' => true, + ), + 'LogicException' => array( + '5.0' => false, + '5.1' => true, + ), + 'mysqli_sql_exception' => array( + '5.0' => false, + '5.1' => true, + ), + 'OutOfBoundsException' => array( + '5.0' => false, + '5.1' => true, + ), + 'OutOfRangeException' => array( + '5.0' => false, + '5.1' => true, + ), + 'OverflowException' => array( + '5.0' => false, + '5.1' => true, + ), + 'PDOException' => array( + '5.0' => false, + '5.1' => true, + ), + 'RangeException' => array( + '5.0' => false, + '5.1' => true, + ), + 'RuntimeException' => array( + '5.0' => false, + '5.1' => true, + ), + 'UnderflowException' => array( + '5.0' => false, + '5.1' => true, + ), + 'UnexpectedValueException' => array( + '5.0' => false, + '5.1' => true, + ), + + 'PharException' => array( + '5.2' => false, + '5.3' => true, + ), + + 'SNMPException' => array( + '5.3' => false, + '5.4' => true, + ), + + 'IntlException' => array( + '5.4' => false, + '5.5' => true, + ), + + 'Error' => array( + '5.6' => false, + '7.0' => true, + ), + 'ArithmeticError' => array( + '5.6' => false, + '7.0' => true, + ), + 'AssertionError' => array( + '5.6' => false, + '7.0' => true, + ), + 'DivisionByZeroError' => array( + '5.6' => false, + '7.0' => true, + ), + 'ParseError' => array( + '5.6' => false, + '7.0' => true, + ), + 'TypeError' => array( + '5.6' => false, + '7.0' => true, + ), + 'ClosedGeneratorException' => array( + '5.6' => false, + '7.0' => true, + ), + 'UI\Exception\InvalidArgumentException' => array( + '5.6' => false, + '7.0' => true, + ), + 'UI\Exception\RuntimeException' => array( + '5.6' => false, + '7.0' => true, + ), + + 'ArgumentCountError' => array( + '7.0' => false, + '7.1' => true, + ), + + 'SodiumException' => array( + '7.1' => false, + '7.2' => true, + ), + + 'CompileError' => array( + '7.2' => false, + '7.3' => true, + ), + 'JsonException' => array( + '7.2' => false, + '7.3' => true, + ), + + 'FFI\Exception' => array( + '7.3' => false, + '7.4' => true, + ), + 'FFI\ParserException' => array( + '7.3' => false, + '7.4' => true, + ), + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 5.5 + * @since 7.0.3 - Now also targets the `class` keyword to detect extended classes. + * - Now also targets double colons to detect static class use. + * @since 7.1.4 - Now also targets anonymous classes to detect extended classes. + * - Now also targets functions/closures to detect new classes used + * as parameter type declarations. + * - Now also targets the `catch` control structure to detect new + * exception classes being caught. + * @since 8.2.0 Now also targets the `T_RETURN_TYPE` token to detect new classes used + * as return type declarations. + * + * @return array + */ + public function register() + { + // Handle case-insensitivity of class names. + $this->newClasses = $this->arrayKeysToLowercase($this->newClasses); + $this->newExceptions = $this->arrayKeysToLowercase($this->newExceptions); + + // Add the Exception classes to the Classes list. + $this->newClasses = array_merge($this->newClasses, $this->newExceptions); + + $targets = array( + \T_NEW, + \T_CLASS, + \T_DOUBLE_COLON, + \T_FUNCTION, + \T_CLOSURE, + \T_CATCH, + ); + + if (\defined('T_ANON_CLASS')) { + $targets[] = \T_ANON_CLASS; + } + + if (\defined('T_RETURN_TYPE')) { + $targets[] = \T_RETURN_TYPE; + } + + return $targets; + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 5.5 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + switch ($tokens[$stackPtr]['type']) { + case 'T_FUNCTION': + case 'T_CLOSURE': + $this->processFunctionToken($phpcsFile, $stackPtr); + + // Deal with older PHPCS version which don't recognize return type hints + // as well as newer PHPCS versions (3.3.0+) where the tokenization has changed. + $returnTypeHint = $this->getReturnTypeHintToken($phpcsFile, $stackPtr); + if ($returnTypeHint !== false) { + $this->processReturnTypeToken($phpcsFile, $returnTypeHint); + } + break; + + case 'T_CATCH': + $this->processCatchToken($phpcsFile, $stackPtr); + break; + + case 'T_RETURN_TYPE': + $this->processReturnTypeToken($phpcsFile, $stackPtr); + break; + + default: + $this->processSingularToken($phpcsFile, $stackPtr); + break; + } + } + + + /** + * Processes this test for when a token resulting in a singular class name is encountered. + * + * @since 7.1.4 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + private function processSingularToken(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $FQClassName = ''; + + if ($tokens[$stackPtr]['type'] === 'T_NEW') { + $FQClassName = $this->getFQClassNameFromNewToken($phpcsFile, $stackPtr); + + } elseif ($tokens[$stackPtr]['type'] === 'T_CLASS' || $tokens[$stackPtr]['type'] === 'T_ANON_CLASS') { + $FQClassName = $this->getFQExtendedClassName($phpcsFile, $stackPtr); + + } elseif ($tokens[$stackPtr]['type'] === 'T_DOUBLE_COLON') { + $FQClassName = $this->getFQClassNameFromDoubleColonToken($phpcsFile, $stackPtr); + } + + if ($FQClassName === '') { + return; + } + + $className = substr($FQClassName, 1); // Remove global namespace indicator. + $classNameLc = strtolower($className); + + if (isset($this->newClasses[$classNameLc]) === false) { + return; + } + + $itemInfo = array( + 'name' => $className, + 'nameLc' => $classNameLc, + ); + $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); + } + + + /** + * Processes this test for when a function token is encountered. + * + * - Detect new classes when used as a parameter type declaration. + * + * @since 7.1.4 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + private function processFunctionToken(File $phpcsFile, $stackPtr) + { + // Retrieve typehints stripped of global NS indicator and/or nullable indicator. + $typeHints = $this->getTypeHintsFromFunctionDeclaration($phpcsFile, $stackPtr); + if (empty($typeHints) || \is_array($typeHints) === false) { + return; + } + + foreach ($typeHints as $hint) { + + $typeHintLc = strtolower($hint); + + if (isset($this->newClasses[$typeHintLc]) === true) { + $itemInfo = array( + 'name' => $hint, + 'nameLc' => $typeHintLc, + ); + $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); + } + } + } + + + /** + * Processes this test for when a catch token is encountered. + * + * - Detect exceptions when used in a catch statement. + * + * @since 7.1.4 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + private function processCatchToken(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + // Bow out during live coding. + if (isset($tokens[$stackPtr]['parenthesis_opener'], $tokens[$stackPtr]['parenthesis_closer']) === false) { + return; + } + + $opener = $tokens[$stackPtr]['parenthesis_opener']; + $closer = ($tokens[$stackPtr]['parenthesis_closer'] + 1); + $name = ''; + $listen = array( + // Parts of a (namespaced) class name. + \T_STRING => true, + \T_NS_SEPARATOR => true, + // End/split tokens. + \T_VARIABLE => false, + \T_BITWISE_OR => false, + \T_CLOSE_CURLY_BRACKET => false, // Shouldn't be needed as we expect a var before this. + ); + + for ($i = ($opener + 1); $i < $closer; $i++) { + if (isset($listen[$tokens[$i]['code']]) === false) { + continue; + } + + if ($listen[$tokens[$i]['code']] === true) { + $name .= $tokens[$i]['content']; + continue; + } else { + if (empty($name) === true) { + // Weird, we should have a name by the time we encounter a variable or |. + // So this may be the closer. + continue; + } + + $name = ltrim($name, '\\'); + $nameLC = strtolower($name); + + if (isset($this->newExceptions[$nameLC]) === true) { + $itemInfo = array( + 'name' => $name, + 'nameLc' => $nameLC, + ); + $this->handleFeature($phpcsFile, $i, $itemInfo); + } + + // Reset for a potential multi-catch. + $name = ''; + } + } + } + + + /** + * Processes this test for when a return type token is encountered. + * + * - Detect new classes when used as a return type declaration. + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + private function processReturnTypeToken(File $phpcsFile, $stackPtr) + { + $returnTypeHint = $this->getReturnTypeHintName($phpcsFile, $stackPtr); + if (empty($returnTypeHint)) { + return; + } + + $returnTypeHint = ltrim($returnTypeHint, '\\'); + $returnTypeHintLc = strtolower($returnTypeHint); + + if (isset($this->newClasses[$returnTypeHintLc]) === false) { + return; + } + + // Still here ? Then this is a return type declaration using a new class. + $itemInfo = array( + 'name' => $returnTypeHint, + 'nameLc' => $returnTypeHintLc, + ); + $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); + } + + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 7.1.0 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo) + { + return $this->newClasses[$itemInfo['nameLc']]; + } + + + /** + * Get the error message template for this sniff. + * + * @since 7.1.0 + * + * @return string + */ + protected function getErrorMsgTemplate() + { + return 'The built-in class ' . parent::getErrorMsgTemplate(); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewConstVisibilitySniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewConstVisibilitySniff.php new file mode 100644 index 00000000..d2cb3feb --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewConstVisibilitySniff.php @@ -0,0 +1,80 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Classes; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Visibility for class constants is available since PHP 7.1. + * + * PHP version 7.1 + * + * @link https://wiki.php.net/rfc/class_const_visibility + * @link https://www.php.net/manual/en/language.oop5.constants.php#language.oop5.basic.class.this + * + * @since 7.0.7 + */ +class NewConstVisibilitySniff extends Sniff +{ + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.7 + * + * @return array + */ + public function register() + { + return array(\T_CONST); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.7 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('7.0') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $prevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true); + + // Is the previous token a visibility indicator ? + if ($prevToken === false || isset(Tokens::$scopeModifiers[$tokens[$prevToken]['code']]) === false) { + return; + } + + // Is this a class constant ? + if ($this->isClassConstant($phpcsFile, $stackPtr) === false) { + // This may be a constant declaration in the global namespace with visibility, + // but that would throw a parse error, i.e. not our concern. + return; + } + + $phpcsFile->addError( + 'Visibility indicators for class constants are not supported in PHP 7.0 or earlier. Found "%s const"', + $stackPtr, + 'Found', + array($tokens[$prevToken]['content']) + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewLateStaticBindingSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewLateStaticBindingSniff.php new file mode 100644 index 00000000..9658a76f --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewLateStaticBindingSniff.php @@ -0,0 +1,88 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Classes; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect use of late static binding as introduced in PHP 5.3. + * + * Checks for: + * - Late static binding as introduced in PHP 5.3. + * - Late static binding being used outside of class scope (unsupported). + * + * PHP version 5.3 + * + * @link https://www.php.net/manual/en/language.oop5.late-static-bindings.php + * @link https://wiki.php.net/rfc/lsb_parentself_forwarding + * + * @since 7.0.3 + * @since 9.0.0 Renamed from `LateStaticBindingSniff` to `NewLateStaticBindingSniff`. + */ +class NewLateStaticBindingSniff extends Sniff +{ + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.3 + * + * @return array + */ + public function register() + { + return array(\T_STATIC); + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.3 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true); + if ($nextNonEmpty === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + if ($tokens[$nextNonEmpty]['code'] !== \T_DOUBLE_COLON) { + return; + } + + $inClass = $this->inClassScope($phpcsFile, $stackPtr, false); + + if ($inClass === true && $this->supportsBelow('5.2') === true) { + $phpcsFile->addError( + 'Late static binding is not supported in PHP 5.2 or earlier.', + $stackPtr, + 'Found' + ); + } + + if ($inClass === false) { + $phpcsFile->addError( + 'Late static binding is not supported outside of class scope.', + $stackPtr, + 'OutsideClassScope' + ); + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewTypedPropertiesSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewTypedPropertiesSniff.php new file mode 100644 index 00000000..a609acc1 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewTypedPropertiesSniff.php @@ -0,0 +1,132 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Classes; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Typed class property declarations are available since PHP 7.4. + * + * PHP version 7.4 + * + * @link https://www.php.net/manual/en/migration74.new-features.php#migration74.new-features.core.typed-properties + * @link https://wiki.php.net/rfc/typed_properties_v2 + * + * @since 9.2.0 + */ +class NewTypedPropertiesSniff extends Sniff +{ + + /** + * Valid property modifier keywords. + * + * @since 9.2.0 + * + * @var array + */ + private $modifierKeywords = array( + \T_PRIVATE => \T_PRIVATE, + \T_PROTECTED => \T_PROTECTED, + \T_PUBLIC => \T_PUBLIC, + \T_STATIC => \T_STATIC, + \T_VAR => \T_VAR, + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 9.2.0 + * + * @return array + */ + public function register() + { + return array(\T_VARIABLE); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 9.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->isClassProperty($phpcsFile, $stackPtr) === false) { + return; + } + + $find = $this->modifierKeywords; + $find += array( + \T_SEMICOLON => \T_SEMICOLON, + \T_OPEN_CURLY_BRACKET => \T_OPEN_CURLY_BRACKET, + ); + + $tokens = $phpcsFile->getTokens(); + $modifier = $phpcsFile->findPrevious($find, ($stackPtr - 1)); + if ($modifier === false + || $tokens[$modifier]['code'] === \T_SEMICOLON + || $tokens[$modifier]['code'] === \T_OPEN_CURLY_BRACKET + ) { + // Parse error. Ignore. + return; + } + + $type = $phpcsFile->findNext(Tokens::$emptyTokens, ($modifier + 1), null, true); + if ($tokens[$type]['code'] === \T_VARIABLE) { + return; + } + + // Still here ? In that case, this will be a typed property. + if ($this->supportsBelow('7.3') === true) { + $phpcsFile->addError( + 'Typed properties are not supported in PHP 7.3 or earlier', + $type, + 'Found' + ); + } + + if ($this->supportsAbove('7.4') === true) { + // Examine the type to verify it's valid. + if ($tokens[$type]['type'] === 'T_NULLABLE' + // Needed to support PHPCS < 3.5.0 which doesn't correct to the nullable token type yet. + || $tokens[$type]['code'] === \T_INLINE_THEN + ) { + $type = $phpcsFile->findNext(Tokens::$emptyTokens, ($type + 1), null, true); + } + + $content = $tokens[$type]['content']; + if ($content === 'void' || $content === 'callable') { + $phpcsFile->addError( + '%s is not supported as a type declaration for properties', + $type, + 'InvalidType', + array($content) + ); + } + } + + $endOfStatement = $phpcsFile->findNext(\T_SEMICOLON, ($stackPtr + 1)); + if ($endOfStatement !== false) { + // Don't throw the same error multiple times for multi-property declarations. + return ($endOfStatement + 1); + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/RemovedOrphanedParentSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/RemovedOrphanedParentSniff.php new file mode 100644 index 00000000..7ecfd6ca --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/RemovedOrphanedParentSniff.php @@ -0,0 +1,115 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Classes; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; + +/** + * Using `parent` inside a class without parent is deprecated since PHP 7.4. + * + * This will throw a compile-time error in the future. Currently an error will only + * be generated if/when the parent is accessed at run-time. + * + * PHP version 7.4 + * + * @link https://www.php.net/manual/en/migration74.deprecated.php#migration74.deprecated.core.parent + * + * @since 9.2.0 + */ +class RemovedOrphanedParentSniff extends Sniff +{ + + /** + * Class scopes to check the class declaration. + * + * @since 9.2.0 + * + * @var array + */ + public $classScopeTokens = array( + 'T_CLASS' => true, + 'T_ANON_CLASS' => true, + ); + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 9.2.0 + * + * @return array + */ + public function register() + { + return array(\T_PARENT); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 9.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('7.4') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + if (empty($tokens[$stackPtr]['conditions']) === true) { + // Use within the global namespace. Not our concern. + return; + } + + /* + * Find the class within which this parent keyword is used. + */ + $conditions = $tokens[$stackPtr]['conditions']; + $conditions = array_reverse($conditions, true); + $classPtr = false; + + foreach ($conditions as $ptr => $type) { + if (isset($this->classScopeTokens[$tokens[$ptr]['type']])) { + $classPtr = $ptr; + break; + } + } + + if ($classPtr === false) { + // Use outside of a class scope. Not our concern. + return; + } + + if (isset($tokens[$classPtr]['scope_opener']) === false) { + // No scope opener known. Probably a parse error. + return; + } + + $extends = $phpcsFile->findNext(\T_EXTENDS, ($classPtr + 1), $tokens[$classPtr]['scope_opener']); + if ($extends !== false) { + // Class has a parent. + return; + } + + $phpcsFile->addError( + 'Using "parent" inside a class without parent is deprecated since PHP 7.4', + $stackPtr, + 'Deprecated' + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Constants/NewConstantsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Constants/NewConstantsSniff.php new file mode 100644 index 00000000..27ec4217 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Constants/NewConstantsSniff.php @@ -0,0 +1,3756 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Constants; + +use PHPCompatibility\AbstractNewFeatureSniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect use of new PHP native global constants. + * + * PHP version All + * + * @since 8.1.0 + */ +class NewConstantsSniff extends AbstractNewFeatureSniff +{ + + /** + * A list of new PHP Constants, not present in older versions. + * + * The array lists : version number with false (not present) or true (present). + * If's sufficient to list the first version where the constant appears. + * + * Note: PHP constants are case-sensitive! + * + * @since 8.1.0 + * + * @var array(string => array(string => bool)) + */ + protected $newConstants = array( + 'E_STRICT' => array( + '4.4' => false, + '5.0' => true, + ), + // Curl: + 'CURLOPT_FTP_USE_EPRT' => array( + '4.4' => false, + '5.0' => true, + ), + 'CURLOPT_NOSIGNAL' => array( + '4.4' => false, + '5.0' => true, + ), + 'CURLOPT_UNRESTRICTED_AUTH' => array( + '4.4' => false, + '5.0' => true, + ), + 'CURLOPT_BUFFERSIZE' => array( + '4.4' => false, + '5.0' => true, + ), + 'CURLOPT_HTTPAUTH' => array( + '4.4' => false, + '5.0' => true, + ), + 'CURLOPT_PROXYPORT' => array( + '4.4' => false, + '5.0' => true, + ), + 'CURLOPT_PROXYTYPE' => array( + '4.4' => false, + '5.0' => true, + ), + 'CURLOPT_SSLCERTTYPE' => array( + '4.4' => false, + '5.0' => true, + ), + 'CURLOPT_HTTP200ALIASES' => array( + '4.4' => false, + '5.0' => true, + ), + // OpenSSL: + 'OPENSSL_ALGO_MD2' => array( + '4.4' => false, + '5.0' => true, + ), + 'OPENSSL_ALGO_MD4' => array( + '4.4' => false, + '5.0' => true, + ), + 'OPENSSL_ALGO_MD5' => array( + '4.4' => false, + '5.0' => true, + ), + 'OPENSSL_ALGO_SHA1' => array( + '4.4' => false, + '5.0' => true, + ), + 'OPENSSL_ALGO_DSS1' => array( + '4.4' => false, + '5.0' => true, + ), + // Tokenizer: + 'T_ABSTRACT' => array( + '4.4' => false, + '5.0' => true, + ), + 'T_CATCH' => array( + '4.4' => false, + '5.0' => true, + ), + + 'SORT_LOCALE_STRING' => array( + '5.0.1' => false, + '5.0.2' => true, + ), + 'PHP_EOL' => array( + '5.0.1' => false, + '5.0.2' => true, + ), + + 'PHP_INT_MAX' => array( + '5.0.4' => false, + '5.0.5' => true, + ), + 'PHP_INT_SIZE' => array( + '5.0.4' => false, + '5.0.5' => true, + ), + + '__COMPILER_HALT_OFFSET__' => array( + '5.0' => false, + '5.1' => true, + ), + 'GLOB_ERR' => array( + '5.0' => false, + '5.1' => true, + ), + // Curl: + 'CURLOPT_AUTOREFERER' => array( + '5.0' => false, + '5.1' => true, + ), + 'CURLOPT_BINARYTRANSFER' => array( + '5.0' => false, + '5.1' => true, + ), + 'CURLOPT_COOKIESESSION' => array( + '5.0' => false, + '5.1' => true, + ), + 'CURLOPT_FTPSSLAUTH' => array( + '5.0' => false, + '5.1' => true, + ), + 'CURLOPT_PROXYAUTH' => array( + '5.0' => false, + '5.1' => true, + ), + 'CURLOPT_TIMECONDITION' => array( + '5.0' => false, + '5.1' => true, + ), + // POSIX: + 'POSIX_F_OK' => array( + '5.0' => false, + '5.1' => true, + ), + 'POSIX_R_OK' => array( + '5.0' => false, + '5.1' => true, + ), + 'POSIX_W_OK' => array( + '5.0' => false, + '5.1' => true, + ), + 'POSIX_X_OK' => array( + '5.0' => false, + '5.1' => true, + ), + 'POSIX_S_IFBLK' => array( + '5.0' => false, + '5.1' => true, + ), + 'POSIX_S_IFCHR' => array( + '5.0' => false, + '5.1' => true, + ), + 'POSIX_S_IFIFO' => array( + '5.0' => false, + '5.1' => true, + ), + 'POSIX_S_IFREG' => array( + '5.0' => false, + '5.1' => true, + ), + 'POSIX_S_IFSOCK' => array( + '5.0' => false, + '5.1' => true, + ), + // Streams: + 'STREAM_IPPROTO_ICMP' => array( + '5.0' => false, + '5.1' => true, + ), + 'STREAM_IPPROTO_IP' => array( + '5.0' => false, + '5.1' => true, + ), + 'STREAM_IPPROTO_RAW' => array( + '5.0' => false, + '5.1' => true, + ), + 'STREAM_IPPROTO_TCP' => array( + '5.0' => false, + '5.1' => true, + ), + 'STREAM_IPPROTO_UDP' => array( + '5.0' => false, + '5.1' => true, + ), + 'STREAM_PF_INET' => array( + '5.0' => false, + '5.1' => true, + ), + 'STREAM_PF_INET6' => array( + '5.0' => false, + '5.1' => true, + ), + 'STREAM_PF_UNIX' => array( + '5.0' => false, + '5.1' => true, + ), + 'STREAM_SOCK_DGRAM' => array( + '5.0' => false, + '5.1' => true, + ), + 'STREAM_SOCK_RAW' => array( + '5.0' => false, + '5.1' => true, + ), + 'STREAM_SOCK_RDM' => array( + '5.0' => false, + '5.1' => true, + ), + 'STREAM_SOCK_SEQPACKET' => array( + '5.0' => false, + '5.1' => true, + ), + 'STREAM_SOCK_STREAM' => array( + '5.0' => false, + '5.1' => true, + ), + // Tokenizer: + 'T_HALT_COMPILER' => array( + '5.0' => false, + '5.1' => true, + ), + + // Date/Time: + 'DATE_ATOM' => array( + '5.1.0' => false, + '5.1.1' => true, + ), + 'DATE_COOKIE' => array( + '5.1.0' => false, + '5.1.1' => true, + ), + 'DATE_ISO8601' => array( + '5.1.0' => false, + '5.1.1' => true, + ), + 'DATE_RFC822' => array( + '5.1.0' => false, + '5.1.1' => true, + ), + 'DATE_RFC850' => array( + '5.1.0' => false, + '5.1.1' => true, + ), + 'DATE_RFC1036' => array( + '5.1.0' => false, + '5.1.1' => true, + ), + 'DATE_RFC1123' => array( + '5.1.0' => false, + '5.1.1' => true, + ), + 'DATE_RFC2822' => array( + '5.1.0' => false, + '5.1.1' => true, + ), + 'DATE_RFC3339' => array( + '5.1.0' => false, + '5.1.1' => true, + ), + 'DATE_RSS' => array( + '5.1.0' => false, + '5.1.1' => true, + ), + 'DATE_W3C' => array( + '5.1.0' => false, + '5.1.1' => true, + ), + + // Date/Time: + 'SUNFUNCS_RET_TIMESTAMP' => array( + '5.1.1' => false, + '5.1.2' => true, + ), + 'SUNFUNCS_RET_STRING' => array( + '5.1.1' => false, + '5.1.2' => true, + ), + 'SUNFUNCS_RET_DOUBLE' => array( + '5.1.1' => false, + '5.1.2' => true, + ), + // XSL: + 'LIBXSLT_VERSION' => array( + '5.1.1' => false, + '5.1.2' => true, + ), + 'LIBXSLT_DOTTED_VERSION' => array( + '5.1.1' => false, + '5.1.2' => true, + ), + 'LIBEXSLT_VERSION' => array( + '5.1.1' => false, + '5.1.2' => true, + ), + 'LIBEXSLT_DOTTED_VERSION' => array( + '5.1.1' => false, + '5.1.2' => true, + ), + // URL: + 'PHP_URL_SCHEME' => array( + '5.1.1' => false, + '5.1.2' => true, + ), + 'PHP_URL_HOST' => array( + '5.1.1' => false, + '5.1.2' => true, + ), + 'PHP_URL_PORT' => array( + '5.1.1' => false, + '5.1.2' => true, + ), + 'PHP_URL_USER' => array( + '5.1.1' => false, + '5.1.2' => true, + ), + 'PHP_URL_PASS' => array( + '5.1.1' => false, + '5.1.2' => true, + ), + 'PHP_URL_PATH' => array( + '5.1.1' => false, + '5.1.2' => true, + ), + 'PHP_URL_QUERY' => array( + '5.1.1' => false, + '5.1.2' => true, + ), + 'PHP_URL_FRAGMENT' => array( + '5.1.1' => false, + '5.1.2' => true, + ), + 'PHP_QUERY_RFC1738' => array( + '5.1.1' => false, + '5.1.2' => true, + ), + 'PHP_QUERY_RFC3986' => array( + '5.1.1' => false, + '5.1.2' => true, + ), + + // Curl: + 'CURLINFO_HEADER_OUT' => array( + '5.1.2' => false, + '5.1.3' => true, + ), + + // Core: + 'E_RECOVERABLE_ERROR' => array( + '5.1' => false, + '5.2' => true, + ), + // Math: + 'M_EULER' => array( + '5.1' => false, + '5.2' => true, + ), + 'M_LNPI' => array( + '5.1' => false, + '5.2' => true, + ), + 'M_SQRT3' => array( + '5.1' => false, + '5.2' => true, + ), + 'M_SQRTPI' => array( + '5.1' => false, + '5.2' => true, + ), + 'PATHINFO_FILENAME' => array( + '5.1' => false, + '5.2' => true, + ), + 'UPLOAD_ERR_EXTENSION' => array( + '5.1' => false, + '5.2' => true, + ), + // Curl: + 'CURLE_FILESIZE_EXCEEDED' => array( + '5.1' => false, + '5.2' => true, + ), + 'CURLE_FTP_SSL_FAILED' => array( + '5.1' => false, + '5.2' => true, + ), + 'CURLE_LDAP_INVALID_URL' => array( + '5.1' => false, + '5.2' => true, + ), + 'CURLFTPAUTH_DEFAULT' => array( + '5.1' => false, + '5.2' => true, + ), + 'CURLFTPAUTH_SSL' => array( + '5.1' => false, + '5.2' => true, + ), + 'CURLFTPAUTH_TLS' => array( + '5.1' => false, + '5.2' => true, + ), + 'CURLFTPSSL_ALL' => array( + '5.1' => false, + '5.2' => true, + ), + 'CURLFTPSSL_CONTROL' => array( + '5.1' => false, + '5.2' => true, + ), + 'CURLFTPSSL_NONE' => array( + '5.1' => false, + '5.2' => true, + ), + 'CURLFTPSSL_TRY' => array( + '5.1' => false, + '5.2' => true, + ), + 'CURLOPT_FTP_SSL' => array( + '5.1' => false, + '5.2' => true, + ), + // Ming: + 'SWFTEXTFIELD_USEFONT' => array( + '5.1' => false, + '5.2' => true, + ), + 'SWFTEXTFIELD_AUTOSIZE' => array( + '5.1' => false, + '5.2' => true, + ), + 'SWF_SOUND_NOT_COMPRESSED' => array( + '5.1' => false, + '5.2' => true, + ), + 'SWF_SOUND_ADPCM_COMPRESSED' => array( + '5.1' => false, + '5.2' => true, + ), + 'SWF_SOUND_MP3_COMPRESSED' => array( + '5.1' => false, + '5.2' => true, + ), + 'SWF_SOUND_NOT_COMPRESSED_LE' => array( + '5.1' => false, + '5.2' => true, + ), + 'SWF_SOUND_NELLY_COMPRESSED' => array( + '5.1' => false, + '5.2' => true, + ), + 'SWF_SOUND_5KHZ' => array( + '5.1' => false, + '5.2' => true, + ), + 'SWF_SOUND_11KHZ' => array( + '5.1' => false, + '5.2' => true, + ), + 'SWF_SOUND_22KHZ' => array( + '5.1' => false, + '5.2' => true, + ), + 'SWF_SOUND_44KHZ' => array( + '5.1' => false, + '5.2' => true, + ), + 'SWF_SOUND_8BITS' => array( + '5.1' => false, + '5.2' => true, + ), + 'SWF_SOUND_16BITS' => array( + '5.1' => false, + '5.2' => true, + ), + 'SWF_SOUND_MONO' => array( + '5.1' => false, + '5.2' => true, + ), + 'SWF_SOUND_STEREO' => array( + '5.1' => false, + '5.2' => true, + ), + // OpenSSL: + 'OPENSSL_KEYTYPE_EC' => array( + '5.1' => false, + '5.2' => true, + ), + 'OPENSSL_VERSION_NUMBER' => array( + '5.1' => false, + '5.2' => true, + ), + 'OPENSSL_VERSION_TEXT' => array( + '5.1' => false, + '5.2' => true, + ), + // PCRE: + 'PREG_BACKTRACK_LIMIT_ERROR' => array( + '5.1' => false, + '5.2' => true, + ), + 'PREG_BAD_UTF8_ERROR' => array( + '5.1' => false, + '5.2' => true, + ), + 'PREG_INTERNAL_ERROR' => array( + '5.1' => false, + '5.2' => true, + ), + 'PREG_NO_ERROR' => array( + '5.1' => false, + '5.2' => true, + ), + 'PREG_RECURSION_LIMIT_ERROR' => array( + '5.1' => false, + '5.2' => true, + ), + // Snmp: + 'SNMP_OID_OUTPUT_FULL' => array( + '5.1' => false, + '5.2' => true, + ), + 'SNMP_OID_OUTPUT_NUMERIC' => array( + '5.1' => false, + '5.2' => true, + ), + // Semaphore: + 'MSG_EAGAIN' => array( + '5.1' => false, + '5.2' => true, + ), + 'MSG_ENOMSG' => array( + '5.1' => false, + '5.2' => true, + ), + + // Curl: + 'CURLOPT_TCP_NODELAY' => array( + '5.2.0' => false, + '5.2.1' => true, + ), + + // Stream: + 'STREAM_SHUT_RD' => array( + '5.2.0' => false, + '5.2.1' => true, + ), + 'STREAM_SHUT_WR' => array( + '5.2.0' => false, + '5.2.1' => true, + ), + 'STREAM_SHUT_RDWR' => array( + '5.2.0' => false, + '5.2.1' => true, + ), + + 'GMP_VERSION' => array( + '5.2.1' => false, + '5.2.2' => true, + ), + + // Curl: + 'CURLOPT_TIMEOUT_MS' => array( + '5.2.2' => false, + '5.2.3' => true, + ), + 'CURLOPT_CONNECTTIMEOUT_MS' => array( + '5.2.2' => false, + '5.2.3' => true, + ), + + // Curl: + 'CURLOPT_PRIVATE' => array( + '5.2.3' => false, + '5.2.4' => true, + ), + 'CURLINFO_PRIVATE' => array( + '5.2.3' => false, + '5.2.4' => true, + ), + // GD: + 'GD_VERSION' => array( + '5.2.3' => false, + '5.2.4' => true, + ), + 'GD_MAJOR_VERSION' => array( + '5.2.3' => false, + '5.2.4' => true, + ), + 'GD_MINOR_VERSION' => array( + '5.2.3' => false, + '5.2.4' => true, + ), + 'GD_RELEASE_VERSION' => array( + '5.2.3' => false, + '5.2.4' => true, + ), + 'GD_EXTRA_VERSION' => array( + '5.2.3' => false, + '5.2.4' => true, + ), + // PCRE: + 'PCRE_VERSION' => array( + '5.2.3' => false, + '5.2.4' => true, + ), + + 'PHP_MAJOR_VERSION' => array( + '5.2.6' => false, + '5.2.7' => true, + ), + 'PHP_MINOR_VERSION' => array( + '5.2.6' => false, + '5.2.7' => true, + ), + 'PHP_RELEASE_VERSION' => array( + '5.2.6' => false, + '5.2.7' => true, + ), + 'PHP_VERSION_ID' => array( + '5.2.6' => false, + '5.2.7' => true, + ), + 'PHP_EXTRA_VERSION' => array( + '5.2.6' => false, + '5.2.7' => true, + ), + 'PHP_ZTS' => array( + '5.2.6' => false, + '5.2.7' => true, + ), + 'PHP_DEBUG' => array( + '5.2.6' => false, + '5.2.7' => true, + ), + 'FILE_BINARY' => array( + '5.2.6' => false, + '5.2.7' => true, + ), + 'FILE_TEXT' => array( + '5.2.6' => false, + '5.2.7' => true, + ), + // Sockets: + 'TCP_NODELAY' => array( + '5.2.6' => false, + '5.2.7' => true, + ), + + // Curl: + 'CURLOPT_PROTOCOLS' => array( + '5.2.9' => false, + '5.2.10' => true, + ), + 'CURLOPT_REDIR_PROTOCOLS' => array( + '5.2.9' => false, + '5.2.10' => true, + ), + 'CURLPROXY_SOCKS4' => array( + '5.2.9' => false, + '5.2.10' => true, + ), + + // Libxml: + 'LIBXML_PARSEHUGE' => array( + '5.2.11' => false, + '5.2.12' => true, + ), + + // Core: + 'ENT_IGNORE' => array( + '5.2' => false, + '5.3' => true, + ), + 'E_DEPRECATED' => array( + '5.2' => false, + '5.3' => true, + ), + 'E_USER_DEPRECATED' => array( + '5.2' => false, + '5.3' => true, + ), + 'INI_SCANNER_NORMAL' => array( + '5.2' => false, + '5.3' => true, + ), + 'INI_SCANNER_RAW' => array( + '5.2' => false, + '5.3' => true, + ), + 'PHP_MAXPATHLEN' => array( + '5.2' => false, + '5.3' => true, + ), + 'PHP_WINDOWS_NT_DOMAIN_CONTROLLER' => array( + '5.2' => false, + '5.3' => true, + ), + 'PHP_WINDOWS_NT_SERVER' => array( + '5.2' => false, + '5.3' => true, + ), + 'PHP_WINDOWS_NT_WORKSTATION' => array( + '5.2' => false, + '5.3' => true, + ), + 'PHP_WINDOWS_VERSION_BUILD' => array( + '5.2' => false, + '5.3' => true, + ), + 'PHP_WINDOWS_VERSION_MAJOR' => array( + '5.2' => false, + '5.3' => true, + ), + 'PHP_WINDOWS_VERSION_MINOR' => array( + '5.2' => false, + '5.3' => true, + ), + 'PHP_WINDOWS_VERSION_PLATFORM' => array( + '5.2' => false, + '5.3' => true, + ), + 'PHP_WINDOWS_VERSION_PRODUCTTYPE' => array( + '5.2' => false, + '5.3' => true, + ), + 'PHP_WINDOWS_VERSION_SP_MAJOR' => array( + '5.2' => false, + '5.3' => true, + ), + 'PHP_WINDOWS_VERSION_SP_MINOR' => array( + '5.2' => false, + '5.3' => true, + ), + 'PHP_WINDOWS_VERSION_SUITEMASK' => array( + '5.2' => false, + '5.3' => true, + ), + // Curl: + 'CURLINFO_CERTINFO' => array( + '5.2' => false, + '5.3' => true, + ), + 'CURLOPT_PROGRESSFUNCTION' => array( + '5.2' => false, + '5.3' => true, + ), + 'CURLE_SSH' => array( + '5.2' => false, + '5.3' => true, + ), + // GD: + 'IMG_FILTER_PIXELATE' => array( + '5.2' => false, + '5.3' => true, + ), + 'IMAGETYPE_ICO' => array( + '5.2' => false, + '5.3' => true, + ), + // Fileinfo: + 'FILEINFO_MIME_TYPE' => array( + '5.2' => false, + '5.3' => true, + ), + 'FILEINFO_MIME_ENCODING' => array( + '5.2' => false, + '5.3' => true, + ), + // JSON: + 'JSON_ERROR_CTRL_CHAR' => array( + '5.2' => false, + '5.3' => true, + ), + 'JSON_ERROR_DEPTH' => array( + '5.2' => false, + '5.3' => true, + ), + 'JSON_ERROR_NONE' => array( + '5.2' => false, + '5.3' => true, + ), + 'JSON_ERROR_STATE_MISMATCH' => array( + '5.2' => false, + '5.3' => true, + ), + 'JSON_ERROR_SYNTAX' => array( + '5.2' => false, + '5.3' => true, + ), + 'JSON_FORCE_OBJECT' => array( + '5.2' => false, + '5.3' => true, + ), + 'JSON_HEX_TAG' => array( + '5.2' => false, + '5.3' => true, + ), + 'JSON_HEX_AMP' => array( + '5.2' => false, + '5.3' => true, + ), + 'JSON_HEX_APOS' => array( + '5.2' => false, + '5.3' => true, + ), + 'JSON_HEX_QUOT' => array( + '5.2' => false, + '5.3' => true, + ), + // LDAP: + 'LDAP_OPT_NETWORK_TIMEOUT' => array( + '5.2' => false, + '5.3' => true, + ), + // Libxml: + 'LIBXML_LOADED_VERSION' => array( + '5.2' => false, + '5.3' => true, + ), + // Math: + 'PHP_ROUND_HALF_UP' => array( + '5.2' => false, + '5.3' => true, + ), + 'PHP_ROUND_HALF_DOWN' => array( + '5.2' => false, + '5.3' => true, + ), + 'PHP_ROUND_HALF_EVEN' => array( + '5.2' => false, + '5.3' => true, + ), + 'PHP_ROUND_HALF_ODD' => array( + '5.2' => false, + '5.3' => true, + ), + // Mysqli + 'MYSQLI_OPT_INT_AND_FLOAT_NATIVE' => array( + '5.2' => false, + '5.3' => true, + ), + 'MYSQLI_OPT_NET_CMD_BUFFER_SIZE' => array( + '5.2' => false, + '5.3' => true, + ), + 'MYSQLI_OPT_NET_READ_BUFFER_SIZE' => array( + '5.2' => false, + '5.3' => true, + ), + 'MYSQLI_OPT_SSL_VERIFY_SERVER_CERT' => array( + '5.2' => false, + '5.3' => true, + ), + // OCI8: + 'OCI_CRED_EXT' => array( + '5.2' => false, + '5.3' => true, + ), + // PCRE: + 'PREG_BAD_UTF8_OFFSET_ERROR' => array( + '5.2' => false, + '5.3' => true, + ), + // PCNTL: + 'BUS_ADRALN' => array( + '5.2' => false, + '5.3' => true, + ), + 'BUS_ADRERR' => array( + '5.2' => false, + '5.3' => true, + ), + 'BUS_OBJERR' => array( + '5.2' => false, + '5.3' => true, + ), + 'CLD_CONTIUNED' => array( + '5.2' => false, + '5.3' => true, + ), + 'CLD_DUMPED' => array( + '5.2' => false, + '5.3' => true, + ), + 'CLD_EXITED' => array( + '5.2' => false, + '5.3' => true, + ), + 'CLD_KILLED' => array( + '5.2' => false, + '5.3' => true, + ), + 'CLD_STOPPED' => array( + '5.2' => false, + '5.3' => true, + ), + 'CLD_TRAPPED' => array( + '5.2' => false, + '5.3' => true, + ), + 'FPE_FLTDIV' => array( + '5.2' => false, + '5.3' => true, + ), + 'FPE_FLTINV' => array( + '5.2' => false, + '5.3' => true, + ), + 'FPE_FLTOVF' => array( + '5.2' => false, + '5.3' => true, + ), + 'FPE_FLTRES' => array( + '5.2' => false, + '5.3' => true, + ), + 'FPE_FLTSUB' => array( + '5.2' => false, + '5.3' => true, + ), + 'FPE_FLTUND' => array( + '5.2' => false, + '5.3' => true, + ), + 'FPE_INTDIV' => array( + '5.2' => false, + '5.3' => true, + ), + 'FPE_INTOVF' => array( + '5.2' => false, + '5.3' => true, + ), + 'ILL_BADSTK' => array( + '5.2' => false, + '5.3' => true, + ), + 'ILL_COPROC' => array( + '5.2' => false, + '5.3' => true, + ), + 'ILL_ILLADR' => array( + '5.2' => false, + '5.3' => true, + ), + 'ILL_ILLOPC' => array( + '5.2' => false, + '5.3' => true, + ), + 'ILL_ILLOPN' => array( + '5.2' => false, + '5.3' => true, + ), + 'ILL_ILLTRP' => array( + '5.2' => false, + '5.3' => true, + ), + 'ILL_PRVOPC' => array( + '5.2' => false, + '5.3' => true, + ), + 'ILL_PRVREG' => array( + '5.2' => false, + '5.3' => true, + ), + 'POLL_ERR' => array( + '5.2' => false, + '5.3' => true, + ), + 'POLL_HUP' => array( + '5.2' => false, + '5.3' => true, + ), + 'POLL_IN' => array( + '5.2' => false, + '5.3' => true, + ), + 'POLL_MSG' => array( + '5.2' => false, + '5.3' => true, + ), + 'POLL_OUT' => array( + '5.2' => false, + '5.3' => true, + ), + 'POLL_PRI' => array( + '5.2' => false, + '5.3' => true, + ), + 'SEGV_ACCERR' => array( + '5.2' => false, + '5.3' => true, + ), + 'SEGV_MAPERR' => array( + '5.2' => false, + '5.3' => true, + ), + 'SI_ASYNCIO' => array( + '5.2' => false, + '5.3' => true, + ), + 'SI_KERNEL' => array( + '5.2' => false, + '5.3' => true, + ), + 'SI_MSGGQ' => array( + '5.2' => false, + '5.3' => true, + ), + 'SI_NOINFO' => array( + '5.2' => false, + '5.3' => true, + ), + 'SI_QUEUE' => array( + '5.2' => false, + '5.3' => true, + ), + 'SI_SIGIO' => array( + '5.2' => false, + '5.3' => true, + ), + 'SI_TIMER' => array( + '5.2' => false, + '5.3' => true, + ), + 'SI_TKILL' => array( + '5.2' => false, + '5.3' => true, + ), + 'SI_USER' => array( + '5.2' => false, + '5.3' => true, + ), + 'SIG_BLOCK' => array( + '5.2' => false, + '5.3' => true, + ), + 'SIG_SETMASK' => array( + '5.2' => false, + '5.3' => true, + ), + 'SIG_UNBLOCK' => array( + '5.2' => false, + '5.3' => true, + ), + 'TRAP_BRKPT' => array( + '5.2' => false, + '5.3' => true, + ), + 'TRAP_TRACE' => array( + '5.2' => false, + '5.3' => true, + ), + // Tokenizer: + 'T_DIR' => array( + '5.2' => false, + '5.3' => true, + ), + 'T_GOTO' => array( + '5.2' => false, + '5.3' => true, + ), + 'T_NAMESPACE' => array( + '5.2' => false, + '5.3' => true, + ), + 'T_NS_C' => array( + '5.2' => false, + '5.3' => true, + ), + 'T_NS_SEPARATOR' => array( + '5.2' => false, + '5.3' => true, + ), + 'T_USE' => array( + '5.2' => false, + '5.3' => true, + ), + + // OCI8: + 'OCI_NO_AUTO_COMMIT' => array( + '5.3.1' => false, + '5.3.2' => true, + ), + // OpenSSL: + 'OPENSSL_TLSEXT_SERVER_NAME' => array( + '5.3.1' => false, + '5.3.2' => true, + ), + + // JSON: + 'JSON_ERROR_UTF8' => array( + '5.3.2' => false, + '5.3.3' => true, + ), + 'JSON_NUMERIC_CHECK' => array( + '5.3.2' => false, + '5.3.3' => true, + ), + + 'DEBUG_BACKTRACE_IGNORE_ARGS' => array( + '5.3.5' => false, + '5.3.6' => true, + ), + + 'CURLINFO_REDIRECT_URL' => array( + '5.3.6' => false, + '5.3.7' => true, + ), + 'PHP_MANDIR' => array( + '5.3.6' => false, + '5.3.7' => true, + ), + + 'PHP_BINARY' => array( + '5.3' => false, + '5.4' => true, + ), + 'SORT_NATURAL' => array( + '5.3' => false, + '5.4' => true, + ), + 'SORT_FLAG_CASE' => array( + '5.3' => false, + '5.4' => true, + ), + 'ENT_HTML401' => array( + '5.3' => false, + '5.4' => true, + ), + 'ENT_XML1' => array( + '5.3' => false, + '5.4' => true, + ), + 'ENT_XHTML' => array( + '5.3' => false, + '5.4' => true, + ), + 'ENT_HTML5' => array( + '5.3' => false, + '5.4' => true, + ), + 'ENT_SUBSTITUTE' => array( + '5.3' => false, + '5.4' => true, + ), + 'ENT_DISALLOWED' => array( + '5.3' => false, + '5.4' => true, + ), + 'IPPROTO_IP' => array( + '5.3' => false, + '5.4' => true, + ), + 'IPPROTO_IPV6' => array( + '5.3' => false, + '5.4' => true, + ), + 'IPV6_MULTICAST_HOPS' => array( + '5.3' => false, + '5.4' => true, + ), + 'IPV6_MULTICAST_IF' => array( + '5.3' => false, + '5.4' => true, + ), + 'IPV6_MULTICAST_LOOP' => array( + '5.3' => false, + '5.4' => true, + ), + 'IP_MULTICAST_IF' => array( + '5.3' => false, + '5.4' => true, + ), + 'IP_MULTICAST_LOOP' => array( + '5.3' => false, + '5.4' => true, + ), + 'IP_MULTICAST_TTL' => array( + '5.3' => false, + '5.4' => true, + ), + 'MCAST_JOIN_GROUP' => array( + '5.3' => false, + '5.4' => true, + ), + 'MCAST_LEAVE_GROUP' => array( + '5.3' => false, + '5.4' => true, + ), + 'MCAST_BLOCK_SOURCE' => array( + '5.3' => false, + '5.4' => true, + ), + 'MCAST_UNBLOCK_SOURCE' => array( + '5.3' => false, + '5.4' => true, + ), + 'MCAST_JOIN_SOURCE_GROUP' => array( + '5.3' => false, + '5.4' => true, + ), + 'MCAST_LEAVE_SOURCE_GROUP' => array( + '5.3' => false, + '5.4' => true, + ), + // Curl: + 'CURLOPT_MAX_RECV_SPEED_LARGE' => array( + '5.3' => false, + '5.4' => true, + ), + 'CURLOPT_MAX_SEND_SPEED_LARGE' => array( + '5.3' => false, + '5.4' => true, + ), + // Directories: + 'SCANDIR_SORT_ASCENDING' => array( + '5.3' => false, + '5.4' => true, + ), + 'SCANDIR_SORT_DESCENDING' => array( + '5.3' => false, + '5.4' => true, + ), + 'SCANDIR_SORT_NONE' => array( + '5.3' => false, + '5.4' => true, + ), + // LibXML: + 'LIBXML_HTML_NODEFDTD' => array( + '5.3' => false, + '5.4' => true, + ), + 'LIBXML_HTML_NOIMPLIED' => array( + '5.3' => false, + '5.4' => true, + ), + 'LIBXML_PEDANTIC' => array( + '5.3' => false, + '5.4' => true, + ), + // OpenSSL: + 'OPENSSL_CIPHER_AES_128_CBC' => array( + '5.3' => false, + '5.4' => true, + ), + 'OPENSSL_CIPHER_AES_192_CBC' => array( + '5.3' => false, + '5.4' => true, + ), + 'OPENSSL_CIPHER_AES_256_CBC' => array( + '5.3' => false, + '5.4' => true, + ), + 'OPENSSL_RAW_DATA' => array( + '5.3' => false, + '5.4' => true, + ), + 'OPENSSL_ZERO_PADDING' => array( + '5.3' => false, + '5.4' => true, + ), + // Output buffering: + 'PHP_OUTPUT_HANDLER_CLEAN' => array( + '5.3' => false, + '5.4' => true, + ), + 'PHP_OUTPUT_HANDLER_CLEANABLE' => array( + '5.3' => false, + '5.4' => true, + ), + 'PHP_OUTPUT_HANDLER_DISABLED' => array( + '5.3' => false, + '5.4' => true, + ), + 'PHP_OUTPUT_HANDLER_FINAL' => array( + '5.3' => false, + '5.4' => true, + ), + 'PHP_OUTPUT_HANDLER_FLUSH' => array( + '5.3' => false, + '5.4' => true, + ), + 'PHP_OUTPUT_HANDLER_FLUSHABLE' => array( + '5.3' => false, + '5.4' => true, + ), + 'PHP_OUTPUT_HANDLER_REMOVABLE' => array( + '5.3' => false, + '5.4' => true, + ), + 'PHP_OUTPUT_HANDLER_STARTED' => array( + '5.3' => false, + '5.4' => true, + ), + 'PHP_OUTPUT_HANDLER_STDFLAGS' => array( + '5.3' => false, + '5.4' => true, + ), + 'PHP_OUTPUT_HANDLER_WRITE' => array( + '5.3' => false, + '5.4' => true, + ), + // Sessions: + 'PHP_SESSION_ACTIVE' => array( + '5.3' => false, + '5.4' => true, + ), + 'PHP_SESSION_DISABLED' => array( + '5.3' => false, + '5.4' => true, + ), + 'PHP_SESSION_NONE' => array( + '5.3' => false, + '5.4' => true, + ), + // Streams: + 'STREAM_META_ACCESS' => array( + '5.3' => false, + '5.4' => true, + ), + 'STREAM_META_GROUP' => array( + '5.3' => false, + '5.4' => true, + ), + 'STREAM_META_GROUP_NAME' => array( + '5.3' => false, + '5.4' => true, + ), + 'STREAM_META_OWNER' => array( + '5.3' => false, + '5.4' => true, + ), + 'STREAM_META_OWNER_NAME' => array( + '5.3' => false, + '5.4' => true, + ), + 'STREAM_META_TOUCH' => array( + '5.3' => false, + '5.4' => true, + ), + // Intl: + 'U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR' => array( + '5.3' => false, + '5.4' => true, + ), + 'IDNA_CHECK_BIDI' => array( + '5.3' => false, + '5.4' => true, + ), + 'IDNA_CHECK_CONTEXTJ' => array( + '5.3' => false, + '5.4' => true, + ), + 'IDNA_NONTRANSITIONAL_TO_ASCII' => array( + '5.3' => false, + '5.4' => true, + ), + 'IDNA_NONTRANSITIONAL_TO_UNICODE' => array( + '5.3' => false, + '5.4' => true, + ), + 'INTL_IDNA_VARIANT_2003' => array( + '5.3' => false, + '5.4' => true, + ), + 'INTL_IDNA_VARIANT_UTS46' => array( + '5.3' => false, + '5.4' => true, + ), + 'IDNA_ERROR_EMPTY_LABEL' => array( + '5.3' => false, + '5.4' => true, + ), + 'IDNA_ERROR_LABEL_TOO_LONG' => array( + '5.3' => false, + '5.4' => true, + ), + 'IDNA_ERROR_DOMAIN_NAME_TOO_LONG' => array( + '5.3' => false, + '5.4' => true, + ), + 'IDNA_ERROR_LEADING_HYPHEN' => array( + '5.3' => false, + '5.4' => true, + ), + 'IDNA_ERROR_TRAILING_HYPHEN' => array( + '5.3' => false, + '5.4' => true, + ), + 'IDNA_ERROR_HYPHEN_3_4' => array( + '5.3' => false, + '5.4' => true, + ), + 'IDNA_ERROR_LEADING_COMBINING_MARK' => array( + '5.3' => false, + '5.4' => true, + ), + 'IDNA_ERROR_DISALLOWED' => array( + '5.3' => false, + '5.4' => true, + ), + 'IDNA_ERROR_PUNYCODE' => array( + '5.3' => false, + '5.4' => true, + ), + 'IDNA_ERROR_LABEL_HAS_DOT' => array( + '5.3' => false, + '5.4' => true, + ), + 'IDNA_ERROR_INVALID_ACE_LABEL' => array( + '5.3' => false, + '5.4' => true, + ), + 'IDNA_ERROR_BIDI' => array( + '5.3' => false, + '5.4' => true, + ), + 'IDNA_ERROR_CONTEXTJ' => array( + '5.3' => false, + '5.4' => true, + ), + // Json: + 'JSON_PRETTY_PRINT' => array( + '5.3' => false, + '5.4' => true, + ), + 'JSON_UNESCAPED_SLASHES' => array( + '5.3' => false, + '5.4' => true, + ), + 'JSON_UNESCAPED_UNICODE' => array( + '5.3' => false, + '5.4' => true, + ), + 'JSON_BIGINT_AS_STRING' => array( + '5.3' => false, + '5.4' => true, + ), + 'JSON_OBJECT_AS_ARRAY' => array( + '5.3' => false, + '5.4' => true, + ), + // Snmp: + 'SNMP_OID_OUTPUT_SUFFIX' => array( + '5.3' => false, + '5.4' => true, + ), + 'SNMP_OID_OUTPUT_MODULE' => array( + '5.3' => false, + '5.4' => true, + ), + 'SNMP_OID_OUTPUT_UCD' => array( + '5.3' => false, + '5.4' => true, + ), + 'SNMP_OID_OUTPUT_NONE' => array( + '5.3' => false, + '5.4' => true, + ), + // Tokenizer: + 'T_INSTEADOF' => array( + '5.3' => false, + '5.4' => true, + ), + 'T_TRAIT' => array( + '5.3' => false, + '5.4' => true, + ), + 'T_TRAIT_C' => array( + '5.3' => false, + '5.4' => true, + ), + + // Curl: + 'CURLINFO_PRIMARY_IP' => array( + '5.4.6' => false, + '5.4.7' => true, + ), + 'CURLINFO_PRIMARY_PORT' => array( + '5.4.6' => false, + '5.4.7' => true, + ), + 'CURLINFO_LOCAL_IP' => array( + '5.4.6' => false, + '5.4.7' => true, + ), + 'CURLINFO_LOCAL_PORT' => array( + '5.4.6' => false, + '5.4.7' => true, + ), + + // OpenSSL: + 'OPENSSL_ALGO_RMD160' => array( + '5.4.7' => false, + '5.4.8' => true, + ), + 'OPENSSL_ALGO_SHA224' => array( + '5.4.7' => false, + '5.4.8' => true, + ), + 'OPENSSL_ALGO_SHA256' => array( + '5.4.7' => false, + '5.4.8' => true, + ), + 'OPENSSL_ALGO_SHA384' => array( + '5.4.7' => false, + '5.4.8' => true, + ), + 'OPENSSL_ALGO_SHA512' => array( + '5.4.7' => false, + '5.4.8' => true, + ), + + // Filter: + 'FILTER_VALIDATE_MAC' => array( + '5.4' => false, + '5.5' => true, + ), + // GD + 'IMG_AFFINE_TRANSLATE' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_AFFINE_SCALE' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_AFFINE_ROTATE' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_AFFINE_SHEAR_HORIZONTAL' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_AFFINE_SHEAR_VERTICAL' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_CROP_DEFAULT' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_CROP_TRANSPARENT' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_CROP_BLACK' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_CROP_WHITE' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_CROP_SIDES' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_FLIP_BOTH' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_FLIP_HORIZONTAL' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_FLIP_VERTICAL' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_BELL' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_BESSEL' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_BILINEAR_FIXED' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_BICUBIC' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_BICUBIC_FIXED' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_BLACKMAN' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_BOX' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_BSPLINE' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_CATMULLROM' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_GAUSSIAN' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_GENERALIZED_CUBIC' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_HERMITE' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_HAMMING' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_HANNING' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_MITCHELL' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_POWER' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_QUADRATIC' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_SINC' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_NEAREST_NEIGHBOUR' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_WEIGHTED4' => array( + '5.4' => false, + '5.5' => true, + ), + 'IMG_TRIANGLE' => array( + '5.4' => false, + '5.5' => true, + ), + // JSON: + 'JSON_ERROR_RECURSION' => array( + '5.4' => false, + '5.5' => true, + ), + 'JSON_ERROR_INF_OR_NAN' => array( + '5.4' => false, + '5.5' => true, + ), + 'JSON_ERROR_UNSUPPORTED_TYPE' => array( + '5.4' => false, + '5.5' => true, + ), + 'JSON_PARTIAL_OUTPUT_ON_ERROR' => array( + '5.4' => false, + '5.5' => true, + ), + // MySQLi + 'MYSQLI_SERVER_PUBLIC_KEY' => array( + '5.4' => false, + '5.5' => true, + ), + // Curl: + 'CURLOPT_SHARE' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLOPT_SSL_OPTIONS' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLSSLOPT_ALLOW_BEAST' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLOPT_USERNAME' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLINFO_RESPONSE_CODE' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLINFO_HTTP_CONNECTCODE' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLINFO_HTTPAUTH_AVAIL' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLINFO_PROXYAUTH_AVAIL' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLINFO_OS_ERRNO' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLINFO_NUM_CONNECTS' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLINFO_SSL_ENGINES' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLINFO_COOKIELIST' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLINFO_FTP_ENTRY_PATH' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLINFO_APPCONNECT_TIME' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLINFO_CONDITION_UNMET' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLINFO_RTSP_CLIENT_CSEQ' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLINFO_RTSP_CSEQ_RECV' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLINFO_RTSP_SERVER_CSEQ' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLINFO_RTSP_SESSION_ID' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLMOPT_PIPELINING' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLMOPT_MAXCONNECTS' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLPAUSE_ALL' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLPAUSE_CONT' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLPAUSE_RECV' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLPAUSE_RECV_CONT' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLPAUSE_SEND' => array( + '5.4' => false, + '5.5' => true, + ), + 'CURLPAUSE_SEND_CONT' => array( + '5.4' => false, + '5.5' => true, + ), + // Soap: + 'SOAP_SSL_METHOD_TLS' => array( + '5.4' => false, + '5.5' => true, + ), + 'SOAP_SSL_METHOD_SSLv2' => array( + '5.4' => false, + '5.5' => true, + ), + 'SOAP_SSL_METHOD_SSLv3' => array( + '5.4' => false, + '5.5' => true, + ), + 'SOAP_SSL_METHOD_SSLv23' => array( + '5.4' => false, + '5.5' => true, + ), + // Tokenizer: + 'T_FINALLY' => array( + '5.4' => false, + '5.5' => true, + ), + 'T_YIELD' => array( + '5.4' => false, + '5.5' => true, + ), + // Core/Password Hashing: + 'PASSWORD_BCRYPT' => array( + '5.4' => false, + '5.5' => true, + ), + 'PASSWORD_DEFAULT' => array( + '5.4' => false, + '5.5' => true, + ), + 'PASSWORD_BCRYPT_DEFAULT_COST' => array( + '5.4' => false, + '5.5' => true, + ), + + + // Libxml: + 'LIBXML_SCHEMA_CREATE' => array( + '5.5.1' => false, + '5.5.2' => true, + ), + + // Curl: + 'CURL_SSLVERSION_TLSv1_0' => array( + '5.5.18' => false, + '5.5.19' => true, + ), + 'CURL_SSLVERSION_TLSv1_1' => array( + '5.5.18' => false, + '5.5.19' => true, + ), + 'CURL_SSLVERSION_TLSv1_2' => array( + '5.5.18' => false, + '5.5.19' => true, + ), + + 'CURLPROXY_SOCKS4A' => array( + '5.5.22' => false, + '5.5.23' => true, + ), + 'CURLPROXY_SOCKS5_HOSTNAME' => array( + '5.5.22' => false, + '5.5.23' => true, + ), + + 'CURL_VERSION_HTTP2' => array( + '5.5.23' => false, + '5.5.24' => true, + ), + + 'ARRAY_FILTER_USE_KEY' => array( + '5.5' => false, + '5.6' => true, + ), + 'ARRAY_FILTER_USE_BOTH' => array( + '5.5' => false, + '5.6' => true, + ), + // LDAP: + 'LDAP_ESCAPE_DN' => array( + '5.5' => false, + '5.6' => true, + ), + 'LDAP_ESCAPE_FILTER' => array( + '5.5' => false, + '5.6' => true, + ), + // OpenSSL: + 'OPENSSL_DEFAULT_STREAM_CIPHERS' => array( + '5.5' => false, + '5.6' => true, + ), + 'STREAM_CRYPTO_METHOD_ANY_CLIENT' => array( + '5.5' => false, + '5.6' => true, + ), + 'STREAM_CRYPTO_METHOD_ANY_SERVER' => array( + '5.5' => false, + '5.6' => true, + ), + 'STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT' => array( + '5.5' => false, + '5.6' => true, + ), + 'STREAM_CRYPTO_METHOD_TLSv1_0_SERVER' => array( + '5.5' => false, + '5.6' => true, + ), + 'STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT' => array( + '5.5' => false, + '5.6' => true, + ), + 'STREAM_CRYPTO_METHOD_TLSv1_1_SERVER' => array( + '5.5' => false, + '5.6' => true, + ), + 'STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT' => array( + '5.5' => false, + '5.6' => true, + ), + 'STREAM_CRYPTO_METHOD_TLSv1_2_SERVER' => array( + '5.5' => false, + '5.6' => true, + ), + // PostgreSQL: + 'PGSQL_CONNECT_ASYNC' => array( + '5.5' => false, + '5.6' => true, + ), + 'PGSQL_CONNECTION_AUTH_OK' => array( + '5.5' => false, + '5.6' => true, + ), + 'PGSQL_CONNECTION_AWAITING_RESPONSE' => array( + '5.5' => false, + '5.6' => true, + ), + 'PGSQL_CONNECTION_MADE' => array( + '5.5' => false, + '5.6' => true, + ), + 'PGSQL_CONNECTION_SETENV' => array( + '5.5' => false, + '5.6' => true, + ), + 'PGSQL_CONNECTION_SSL_STARTUP' => array( + '5.5' => false, + '5.6' => true, + ), + 'PGSQL_CONNECTION_STARTED' => array( + '5.5' => false, + '5.6' => true, + ), + 'PGSQL_DML_ESCAPE' => array( + '5.5' => false, + '5.6' => true, + ), + 'PGSQL_POLLING_ACTIVE' => array( + '5.5' => false, + '5.6' => true, + ), + 'PGSQL_POLLING_FAILED' => array( + '5.5' => false, + '5.6' => true, + ), + 'PGSQL_POLLING_OK' => array( + '5.5' => false, + '5.6' => true, + ), + 'PGSQL_POLLING_READING' => array( + '5.5' => false, + '5.6' => true, + ), + 'PGSQL_POLLING_WRITING' => array( + '5.5' => false, + '5.6' => true, + ), + // Tokenizer: + 'T_ELLIPSIS' => array( + '5.5' => false, + '5.6' => true, + ), + 'T_POW' => array( + '5.5' => false, + '5.6' => true, + ), + 'T_POW_EQUAL' => array( + '5.5' => false, + '5.6' => true, + ), + + 'INI_SCANNER_TYPED' => array( + '5.6.0' => false, + '5.6.1' => true, + ), + + 'JSON_PRESERVE_ZERO_FRACTION' => array( + '5.6.5' => false, + '5.6.6' => true, + ), + + 'MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT' => array( + '5.6.15' => false, + '5.6.16' => true, + ), + + // GD: + // Also introduced in 7.0.10. + 'IMG_WEBP' => array( + '5.6.24' => false, + '5.6.25' => true, + ), + + + 'TOKEN_PARSE' => array( + '5.6' => false, + '7.0' => true, + ), + 'FILTER_VALIDATE_DOMAIN' => array( + '5.6' => false, + '7.0' => true, + ), + 'PHP_INT_MIN' => array( + '5.6' => false, + '7.0' => true, + ), + // Curl: + 'CURLPIPE_NOTHING' => array( + '5.6' => false, + '7.0' => true, + ), + 'CURLPIPE_HTTP1' => array( + '5.6' => false, + '7.0' => true, + ), + 'CURLPIPE_MULTIPLEX' => array( + '5.6' => false, + '7.0' => true, + ), + // JSON: + 'JSON_ERROR_INVALID_PROPERTY_NAME' => array( + '5.6' => false, + '7.0' => true, + ), + 'JSON_ERROR_UTF16' => array( + '5.6' => false, + '7.0' => true, + ), + // LibXML: + 'LIBXML_BIGLINES' => array( + '5.6' => false, + '7.0' => true, + ), + // PCRE: + 'PREG_JIT_STACKLIMIT_ERROR' => array( + '5.6' => false, + '7.0' => true, + ), + // POSIX: + 'POSIX_RLIMIT_AS' => array( + '5.6' => false, + '7.0' => true, + ), + 'POSIX_RLIMIT_CORE' => array( + '5.6' => false, + '7.0' => true, + ), + 'POSIX_RLIMIT_CPU' => array( + '5.6' => false, + '7.0' => true, + ), + 'POSIX_RLIMIT_DATA' => array( + '5.6' => false, + '7.0' => true, + ), + 'POSIX_RLIMIT_FSIZE' => array( + '5.6' => false, + '7.0' => true, + ), + 'POSIX_RLIMIT_LOCKS' => array( + '5.6' => false, + '7.0' => true, + ), + 'POSIX_RLIMIT_MEMLOCK' => array( + '5.6' => false, + '7.0' => true, + ), + 'POSIX_RLIMIT_MSGQUEUE' => array( + '5.6' => false, + '7.0' => true, + ), + 'POSIX_RLIMIT_NICE' => array( + '5.6' => false, + '7.0' => true, + ), + 'POSIX_RLIMIT_NOFILE' => array( + '5.6' => false, + '7.0' => true, + ), + 'POSIX_RLIMIT_NPROC' => array( + '5.6' => false, + '7.0' => true, + ), + 'POSIX_RLIMIT_RSS' => array( + '5.6' => false, + '7.0' => true, + ), + 'POSIX_RLIMIT_RTPRIO' => array( + '5.6' => false, + '7.0' => true, + ), + 'POSIX_RLIMIT_RTTIME' => array( + '5.6' => false, + '7.0' => true, + ), + 'POSIX_RLIMIT_SIGPENDING' => array( + '5.6' => false, + '7.0' => true, + ), + 'POSIX_RLIMIT_STACK' => array( + '5.6' => false, + '7.0' => true, + ), + 'POSIX_RLIMIT_INFINITY' => array( + '5.6' => false, + '7.0' => true, + ), + // Tokenizer: + 'T_COALESCE' => array( + '5.6' => false, + '7.0' => true, + ), + 'T_SPACESHIP' => array( + '5.6' => false, + '7.0' => true, + ), + 'T_YIELD_FROM' => array( + '5.6' => false, + '7.0' => true, + ), + + // Zlib: + // The first three are in the PHP 5.4 changelog, but the Extension constant page says 7.0. + 'ZLIB_ENCODING_RAW' => array( + '5.6' => false, + '7.0' => true, + ), + 'ZLIB_ENCODING_DEFLATE' => array( + '5.6' => false, + '7.0' => true, + ), + 'ZLIB_ENCODING_GZIP' => array( + '5.6' => false, + '7.0' => true, + ), + 'ZLIB_FILTERED' => array( + '5.6' => false, + '7.0' => true, + ), + 'ZLIB_HUFFMAN_ONLY' => array( + '5.6' => false, + '7.0' => true, + ), + 'ZLIB_FIXED' => array( + '5.6' => false, + '7.0' => true, + ), + 'ZLIB_RLE' => array( + '5.6' => false, + '7.0' => true, + ), + 'ZLIB_DEFAULT_STRATEGY' => array( + '5.6' => false, + '7.0' => true, + ), + 'ZLIB_BLOCK' => array( + '5.6' => false, + '7.0' => true, + ), + 'ZLIB_FINISH' => array( + '5.6' => false, + '7.0' => true, + ), + 'ZLIB_FULL_FLUSH' => array( + '5.6' => false, + '7.0' => true, + ), + 'ZLIB_NO_FLUSH' => array( + '5.6' => false, + '7.0' => true, + ), + 'ZLIB_PARTIAL_FLUSH' => array( + '5.6' => false, + '7.0' => true, + ), + 'ZLIB_SYNC_FLUSH' => array( + '5.6' => false, + '7.0' => true, + ), + + 'CURL_HTTP_VERSION_2' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURL_HTTP_VERSION_2TLS' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURL_REDIR_POST_301' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURL_REDIR_POST_302' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURL_REDIR_POST_303' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURL_REDIR_POST_ALL' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURL_VERSION_KERBEROS5' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURL_VERSION_PSL' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURL_VERSION_UNIX_SOCKETS' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLAUTH_NEGOTIATE' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLAUTH_NTLM_WB' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLFTP_CREATE_DIR' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLFTP_CREATE_DIR_NONE' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLFTP_CREATE_DIR_RETRY' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLHEADER_SEPARATE' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLHEADER_UNIFIED' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLMOPT_MAX_HOST_CONNECTIONS' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLMOPT_MAX_PIPELINE_LENGTH' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLMOPT_MAX_TOTAL_CONNECTIONS' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLOPT_CONNECT_TO' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLOPT_DEFAULT_PROTOCOL' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLOPT_DNS_INTERFACE' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLOPT_DNS_LOCAL_IP4' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLOPT_DNS_LOCAL_IP6' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLOPT_EXPECT_100_TIMEOUT_MS' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLOPT_HEADEROPT' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLOPT_LOGIN_OPTIONS' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLOPT_PATH_AS_IS' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLOPT_PINNEDPUBLICKEY' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLOPT_PIPEWAIT' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLOPT_PROXY_SERVICE_NAME' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLOPT_PROXYHEADER' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLOPT_SASL_IR' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLOPT_SERVICE_NAME' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLOPT_SSL_ENABLE_ALPN' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLOPT_SSL_ENABLE_NPN' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLOPT_SSL_FALSESTART' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLOPT_SSL_VERIFYSTATUS' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLOPT_STREAM_WEIGHT' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLOPT_TCP_FASTOPEN' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLOPT_TFTP_NO_OPTIONS' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLOPT_UNIX_SOCKET_PATH' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLOPT_XOAUTH2_BEARER' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLPROTO_SMB' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLPROTO_SMBS' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLPROXY_HTTP_1_0' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLSSH_AUTH_AGENT' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + 'CURLSSLOPT_NO_REVOKE' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + + 'PHP_FD_SETSIZE' => array( + '7.0' => false, + '7.1' => true, + ), + // Curl: + 'CURLMOPT_PUSHFUNCTION' => array( + '7.0' => false, + '7.1' => true, + ), + 'CURL_PUSH_OK' => array( + '7.0' => false, + '7.1' => true, + ), + 'CURL_PUSH_DENY' => array( + '7.0' => false, + '7.1' => true, + ), + // Filter: + 'FILTER_FLAG_EMAIL_UNICODE' => array( + '7.0' => false, + '7.1' => true, + ), + // GD: + 'IMAGETYPE_WEBP' => array( + '7.0' => false, + '7.1' => true, + ), + // Json: + 'JSON_UNESCAPED_LINE_TERMINATORS' => array( + '7.0' => false, + '7.1' => true, + ), + // LDAP: + 'LDAP_OPT_X_SASL_NOCANON' => array( + '7.0' => false, + '7.1' => true, + ), + 'LDAP_OPT_X_SASL_USERNAME' => array( + '7.0' => false, + '7.1' => true, + ), + 'LDAP_OPT_X_TLS_CACERTDIR' => array( + '7.0' => false, + '7.1' => true, + ), + 'LDAP_OPT_X_TLS_CACERTFILE' => array( + '7.0' => false, + '7.1' => true, + ), + 'LDAP_OPT_X_TLS_CERTFILE' => array( + '7.0' => false, + '7.1' => true, + ), + 'LDAP_OPT_X_TLS_CIPHER_SUITE' => array( + '7.0' => false, + '7.1' => true, + ), + 'LDAP_OPT_X_TLS_KEYFILE' => array( + '7.0' => false, + '7.1' => true, + ), + 'LDAP_OPT_X_TLS_RANDOM_FILE' => array( + '7.0' => false, + '7.1' => true, + ), + 'LDAP_OPT_X_TLS_CRLCHECK' => array( + '7.0' => false, + '7.1' => true, + ), + 'LDAP_OPT_X_TLS_CRL_NONE' => array( + '7.0' => false, + '7.1' => true, + ), + 'LDAP_OPT_X_TLS_CRL_PEER' => array( + '7.0' => false, + '7.1' => true, + ), + 'LDAP_OPT_X_TLS_CRL_ALL' => array( + '7.0' => false, + '7.1' => true, + ), + 'LDAP_OPT_X_TLS_DHFILE' => array( + '7.0' => false, + '7.1' => true, + ), + 'LDAP_OPT_X_TLS_CRLFILE' => array( + '7.0' => false, + '7.1' => true, + ), + 'LDAP_OPT_X_TLS_PROTOCOL_MIN' => array( + '7.0' => false, + '7.1' => true, + ), + 'LDAP_OPT_X_TLS_PROTOCOL_SSL2' => array( + '7.0' => false, + '7.1' => true, + ), + 'LDAP_OPT_X_TLS_PROTOCOL_SSL3' => array( + '7.0' => false, + '7.1' => true, + ), + 'LDAP_OPT_X_TLS_PROTOCOL_TLS1_0' => array( + '7.0' => false, + '7.1' => true, + ), + 'LDAP_OPT_X_TLS_PROTOCOL_TLS1_1' => array( + '7.0' => false, + '7.1' => true, + ), + 'LDAP_OPT_X_TLS_PROTOCOL_TLS1_2' => array( + '7.0' => false, + '7.1' => true, + ), + 'LDAP_OPT_X_TLS_PACKAGE' => array( + '7.0' => false, + '7.1' => true, + ), + 'LDAP_OPT_X_KEEPALIVE_IDLE' => array( + '7.0' => false, + '7.1' => true, + ), + 'LDAP_OPT_X_KEEPALIVE_PROBES' => array( + '7.0' => false, + '7.1' => true, + ), + 'LDAP_OPT_X_KEEPALIVE_INTERVAL' => array( + '7.0' => false, + '7.1' => true, + ), + // PostgreSQL: + 'PGSQL_NOTICE_LAST' => array( + '7.0' => false, + '7.1' => true, + ), + 'PGSQL_NOTICE_ALL' => array( + '7.0' => false, + '7.1' => true, + ), + 'PGSQL_NOTICE_CLEAR' => array( + '7.0' => false, + '7.1' => true, + ), + // SPL: + 'MT_RAND_PHP' => array( + '7.0' => false, + '7.1' => true, + ), + + // SQLite3: + 'SQLITE3_DETERMINISTIC' => array( + '7.1.3' => false, + '7.1.4' => true, + ), + + // Core: + 'PHP_OS_FAMILY' => array( + '7.1' => false, + '7.2' => true, + ), + 'PHP_FLOAT_DIG' => array( + '7.1' => false, + '7.2' => true, + ), + 'PHP_FLOAT_EPSILON' => array( + '7.1' => false, + '7.2' => true, + ), + 'PHP_FLOAT_MIN' => array( + '7.1' => false, + '7.2' => true, + ), + 'PHP_FLOAT_MAX' => array( + '7.1' => false, + '7.2' => true, + ), + + // Core/Password Hashing: + 'PASSWORD_ARGON2I' => array( + '7.1' => false, + '7.2' => true, + ), + 'PASSWORD_ARGON2_DEFAULT_MEMORY_COST' => array( + '7.1' => false, + '7.2' => true, + ), + 'PASSWORD_ARGON2_DEFAULT_TIME_COST' => array( + '7.1' => false, + '7.2' => true, + ), + 'PASSWORD_ARGON2_DEFAULT_THREADS' => array( + '7.1' => false, + '7.2' => true, + ), + + // Fileinfo: + 'FILEINFO_EXTENSION' => array( + '7.1' => false, + '7.2' => true, + ), + + // GD: + 'IMG_EFFECT_MULTIPLY' => array( + '7.1' => false, + '7.2' => true, + ), + 'IMG_BMP' => array( + '7.1' => false, + '7.2' => true, + ), + + // JSON: + 'JSON_INVALID_UTF8_IGNORE' => array( + '7.1' => false, + '7.2' => true, + ), + 'JSON_INVALID_UTF8_SUBSTITUTE' => array( + '7.1' => false, + '7.2' => true, + ), + + // LDAP: + 'LDAP_EXOP_START_TLS' => array( + '7.1' => false, + '7.2' => true, + ), + 'LDAP_EXOP_MODIFY_PASSWD' => array( + '7.1' => false, + '7.2' => true, + ), + 'LDAP_EXOP_REFRESH' => array( + '7.1' => false, + '7.2' => true, + ), + 'LDAP_EXOP_WHO_AM_I' => array( + '7.1' => false, + '7.2' => true, + ), + 'LDAP_EXOP_TURN' => array( + '7.1' => false, + '7.2' => true, + ), + + // PCRE: + 'PREG_UNMATCHED_AS_NULL' => array( + '7.1' => false, + '7.2' => true, + ), + + // Sodium: + 'SODIUM_LIBRARY_VERSION' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_LIBRARY_MAJOR_VERSION' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_LIBRARY_MINOR_VERSION' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_BASE64_VARIANT_ORIGINAL' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_BASE64_VARIANT_URLSAFE' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_AEAD_AES256GCM_KEYBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_AEAD_AES256GCM_NSECBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_AEAD_AES256GCM_NPUBBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_AEAD_AES256GCM_ABYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_NSECBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_ABYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_NSECBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_ABYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NSECBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_ABYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_AUTH_BYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_AUTH_KEYBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_BOX_SEALBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_BOX_SECRETKEYBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_BOX_PUBLICKEYBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_BOX_KEYPAIRBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_BOX_MACBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_BOX_NONCEBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_BOX_SEEDBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_KDF_BYTES_MIN' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_KDF_BYTES_MAX' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_KDF_CONTEXTBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_KDF_KEYBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_KX_SEEDBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_KX_SESSIONKEYBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_KX_PUBLICKEYBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_KX_SECRETKEYBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_KX_KEYPAIRBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_GENERICHASH_BYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_GENERICHASH_BYTES_MIN' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_GENERICHASH_BYTES_MAX' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_GENERICHASH_KEYBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_GENERICHASH_KEYBYTES_MIN' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_GENERICHASH_KEYBYTES_MAX' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_PWHASH_ALG_ARGON2I13' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_PWHASH_ALG_DEFAULT' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_PWHASH_SALTBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_PWHASH_STRPREFIX' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_PWHASH_OPSLIMIT_MODERATE' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_PWHASH_MEMLIMIT_MODERATE' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_PWHASH_OPSLIMIT_SENSITIVE' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_PWHASH_MEMLIMIT_SENSITIVE' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_SALTBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_STRPREFIX' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_INTERACTIVE' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_INTERACTIVE' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_SENSITIVE' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_SENSITIVE' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_SCALARMULT_BYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_SCALARMULT_SCALARBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_SHORTHASH_BYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_SHORTHASH_KEYBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_SECRETBOX_KEYBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_SECRETBOX_MACBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_SECRETBOX_NONCEBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_ABYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_HEADERBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_KEYBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_MESSAGEBYTES_MAX' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PUSH' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_REKEY' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_FINAL' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_SIGN_BYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_SIGN_SEEDBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_SIGN_PUBLICKEYBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_SIGN_SECRETKEYBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_SIGN_KEYPAIRBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_STREAM_NONCEBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + 'SODIUM_CRYPTO_STREAM_KEYBYTES' => array( + '7.1' => false, + '7.2' => true, + ), + + 'CURLAUTH_BEARER' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLAUTH_GSSAPI' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLE_WEIRD_SERVER_REPLY' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLINFO_APPCONNECT_TIME_T' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLINFO_CONNECT_TIME_T' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLINFO_CONTENT_LENGTH_DOWNLOAD_T' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLINFO_CONTENT_LENGTH_UPLOAD_T' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLINFO_FILETIME_T' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLINFO_HTTP_VERSION' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLINFO_NAMELOOKUP_TIME_T' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLINFO_PRETRANSFER_TIME_T' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLINFO_PROTOCOL' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLINFO_PROXY_SSL_VERIFYRESULT' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLINFO_REDIRECT_TIME_T' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLINFO_SCHEME' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLINFO_SIZE_DOWNLOAD_T' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLINFO_SIZE_UPLOAD_T' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLINFO_SPEED_DOWNLOAD_T' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLINFO_SPEED_UPLOAD_T' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLINFO_STARTTRANSFER_TIME_T' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLINFO_TOTAL_TIME_T' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_LOCK_DATA_CONNECT' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_LOCK_DATA_PSL' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_MAX_READ_SIZE' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_ABSTRACT_UNIX_SOCKET' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_DISALLOW_USERNAME_IN_URL' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_DNS_SHUFFLE_ADDRESSES' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_HAPROXYPROTOCOL' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_KEEP_SENDING_ON_ERROR' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_PRE_PROXY' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_PROXY_CAINFO' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_PROXY_CAPATH' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_PROXY_CRLFILE' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_PROXY_KEYPASSWD' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_PROXY_PINNEDPUBLICKEY' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_PROXY_SSLCERT' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_PROXY_SSLCERTTYPE' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_PROXY_SSL_CIPHER_LIST' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_PROXY_SSLKEY' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_PROXY_SSLKEYTYPE' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_PROXY_SSL_OPTIONS' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_PROXY_SSL_VERIFYHOST' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_PROXY_SSL_VERIFYPEER' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_PROXY_SSLVERSION' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_PROXY_TLS13_CIPHERS' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_PROXY_TLSAUTH_PASSWORD' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_PROXY_TLSAUTH_TYPE' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_PROXY_TLSAUTH_USERNAME' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_REQUEST_TARGET' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_SOCKS5_AUTH' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_SSH_COMPRESSION' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_SUPPRESS_CONNECT_HEADERS' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_TIMEVALUE_LARGE' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLOPT_TLS13_CIPHERS' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLPROXY_HTTPS' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURLSSH_AUTH_GSSAPI' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_SSLVERSION_MAX_DEFAULT' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_SSLVERSION_MAX_NONE' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_SSLVERSION_MAX_TLSv1_0' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_SSLVERSION_MAX_TLSv1_1' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_SSLVERSION_MAX_TLSv1_2' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_SSLVERSION_MAX_TLSv1_3' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_SSLVERSION_TLSv1_3' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_VERSION_ASYNCHDNS' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_VERSION_BROTLI' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_VERSION_CONV' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_VERSION_DEBUG' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_VERSION_GSSAPI' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_VERSION_GSSNEGOTIATE' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_VERSION_HTTPS_PROXY' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_VERSION_IDN' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_VERSION_LARGEFILE' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_VERSION_MULTI_SSL' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_VERSION_NTLM' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_VERSION_NTLM_WB' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_VERSION_SPNEGO' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_VERSION_SSPI' => array( + '7.2' => false, + '7.3' => true, + ), + 'CURL_VERSION_TLSAUTH_SRP' => array( + '7.2' => false, + '7.3' => true, + ), + 'FILTER_SANITIZE_ADD_SLASHES' => array( + '7.2' => false, + '7.3' => true, + ), + 'JSON_THROW_ON_ERROR' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_MANAGEDSAIT' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_PROXY_AUTHZ' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_SUBENTRIES' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_VALUESRETURNFILTER' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_ASSERT' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_PRE_READ' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_POST_READ' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_SORTREQUEST' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_SORTRESPONSE' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_PAGEDRESULTS' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_AUTHZID_REQUEST' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_AUTHZID_RESPONSE' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_SYNC' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_SYNC_STATE' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_SYNC_DONE' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_DONTUSECOPY' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_PASSWORDPOLICYREQUEST' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_PASSWORDPOLICYRESPONSE' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_X_INCREMENTAL_VALUES' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_X_DOMAIN_SCOPE' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_X_PERMISSIVE_MODIFY' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_X_SEARCH_OPTIONS' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_X_TREE_DELETE' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_X_EXTENDED_DN' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_VLVREQUEST' => array( + '7.2' => false, + '7.3' => true, + ), + 'LDAP_CONTROL_VLVRESPONSE' => array( + '7.2' => false, + '7.3' => true, + ), + 'MB_CASE_FOLD' => array( + '7.2' => false, + '7.3' => true, + ), + 'MB_CASE_UPPER_SIMPLE' => array( + '7.2' => false, + '7.3' => true, + ), + 'MB_CASE_LOWER_SIMPLE' => array( + '7.2' => false, + '7.3' => true, + ), + 'MB_CASE_TITLE_SIMPLE' => array( + '7.2' => false, + '7.3' => true, + ), + 'MB_CASE_FOLD_SIMPLE' => array( + '7.2' => false, + '7.3' => true, + ), + 'PGSQL_DIAG_SCHEMA_NAME' => array( + '7.2' => false, + '7.3' => true, + ), + 'PGSQL_DIAG_TABLE_NAME' => array( + '7.2' => false, + '7.3' => true, + ), + 'PGSQL_DIAG_COLUMN_NAME' => array( + '7.2' => false, + '7.3' => true, + ), + 'PGSQL_DIAG_DATATYPE_NAME' => array( + '7.2' => false, + '7.3' => true, + ), + 'PGSQL_DIAG_CONSTRAINT_NAME' => array( + '7.2' => false, + '7.3' => true, + ), + 'PGSQL_DIAG_SEVERITY_NONLOCALIZED' => array( + '7.2' => false, + '7.3' => true, + ), + 'PASSWORD_ARGON2ID' => array( + '7.2' => false, + '7.3' => true, + ), + 'STREAM_CRYPTO_PROTO_SSLv3' => array( + '7.2' => false, + '7.3' => true, + ), + 'STREAM_CRYPTO_PROTO_TLSv1_0' => array( + '7.2' => false, + '7.3' => true, + ), + 'STREAM_CRYPTO_PROTO_TLSv1_1' => array( + '7.2' => false, + '7.3' => true, + ), + 'STREAM_CRYPTO_PROTO_TLSv1_2' => array( + '7.2' => false, + '7.3' => true, + ), + + 'CURL_VERSION_ALTSVC' => array( + '7.3.5' => false, + '7.3.6' => true, + ), + 'CURL_VERSION_CURLDEBUG' => array( + '7.3.5' => false, + '7.3.6' => true, + ), + + 'IMG_FILTER_SCATTER' => array( + '7.3' => false, + '7.4' => true, + ), + 'MB_ONIGURUMA_VERSION' => array( + '7.3' => false, + '7.4' => true, + ), + 'SO_LABEL' => array( + '7.3' => false, + '7.4' => true, + ), + 'SO_PEERLABEL' => array( + '7.3' => false, + '7.4' => true, + ), + 'SO_LISTENQLIMIT' => array( + '7.3' => false, + '7.4' => true, + ), + 'SO_LISTENQLEN' => array( + '7.3' => false, + '7.4' => true, + ), + 'SO_USER_COOKIE' => array( + '7.3' => false, + '7.4' => true, + ), + 'PASSWORD_ARGON2_PROVIDER' => array( + '7.3' => false, + '7.4' => true, + ), + 'PHP_WINDOWS_EVENT_CTRL_C' => array( + '7.3' => false, + '7.4' => true, + ), + 'PHP_WINDOWS_EVENT_CTRL_BREAK' => array( + '7.3' => false, + '7.4' => true, + ), + 'T_BAD_CHARACTER' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_ARTICLE' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_ASIDE' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_AUDIO' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_BDI' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_CANVAS' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_COMMAND' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_DATALIST' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_DETAILS' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_DIALOG' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_FIGCAPTION' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_FIGURE' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_FOOTER' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_HEADER' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_HGROUP' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_MAIN' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_MARK' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_MENUITEM' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_METER' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_NAV' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_OUTPUT' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_PROGRESS' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_SECTION' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_SOURCE' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_SUMMARY' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_TEMPLATE' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_TIME' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_TRACK' => array( + '7.3' => false, + '7.4' => true, + ), + 'TIDY_TAG_VIDEO' => array( + '7.3' => false, + '7.4' => true, + ), + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 8.1.0 + * + * @return array + */ + public function register() + { + return array(\T_STRING); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 8.1.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $constantName = $tokens[$stackPtr]['content']; + + if (isset($this->newConstants[$constantName]) === false) { + return; + } + + if ($this->isUseOfGlobalConstant($phpcsFile, $stackPtr) === false) { + return; + } + + $itemInfo = array( + 'name' => $constantName, + ); + $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); + } + + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 8.1.0 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo) + { + return $this->newConstants[$itemInfo['name']]; + } + + + /** + * Get the error message template for this sniff. + * + * @since 8.1.0 + * + * @return string + */ + protected function getErrorMsgTemplate() + { + return 'The constant "%s" is not present in PHP version %s or earlier'; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Constants/NewMagicClassConstantSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Constants/NewMagicClassConstantSniff.php new file mode 100644 index 00000000..ccd58641 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Constants/NewMagicClassConstantSniff.php @@ -0,0 +1,80 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Constants; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect usage of the magic `::class` constant introduced in PHP 5.5. + * + * The special `ClassName::class` constant is available as of PHP 5.5.0, and allows + * for fully qualified class name resolution at compile time. + * + * PHP version 5.5 + * + * @link https://wiki.php.net/rfc/class_name_scalars + * @link https://www.php.net/manual/en/language.oop5.constants.php#example-186 + * + * @since 7.1.4 + * @since 7.1.5 Removed the incorrect checks against invalid usage of the constant. + */ +class NewMagicClassConstantSniff extends Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.1.4 + * + * @return array + */ + public function register() + { + return array(\T_STRING); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.1.4 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('5.4') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + if (strtolower($tokens[$stackPtr]['content']) !== 'class') { + return; + } + + $prevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true); + if ($prevToken === false || $tokens[$prevToken]['code'] !== \T_DOUBLE_COLON) { + return; + } + + $phpcsFile->addError( + 'The magic class constant ClassName::class was not available in PHP 5.4 or earlier', + $stackPtr, + 'Found' + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Constants/RemovedConstantsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Constants/RemovedConstantsSniff.php new file mode 100644 index 00000000..b6c8f8d7 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Constants/RemovedConstantsSniff.php @@ -0,0 +1,574 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Constants; + +use PHPCompatibility\AbstractRemovedFeatureSniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect use of deprecated and/or removed PHP native global constants. + * + * PHP version All + * + * @since 8.1.0 + */ +class RemovedConstantsSniff extends AbstractRemovedFeatureSniff +{ + + /** + * A list of removed PHP Constants. + * + * The array lists : version number with false (deprecated) or true (removed). + * If's sufficient to list the first version where the constant was deprecated/removed. + * + * Optional, the array can contain an `alternative` key listing an alternative constant + * to be used instead. + * + * Note: PHP Constants are case-sensitive! + * + * @since 8.1.0 + * + * @var array(string => array(string => bool|string)) + */ + protected $removedConstants = array( + // Disabled since PHP 5.3.0 due to thread safety issues. + 'FILEINFO_COMPRESS' => array( + '5.3' => true, + ), + + 'CURLOPT_CLOSEPOLICY' => array( + '5.6' => true, + ), + 'CURLCLOSEPOLICY_LEAST_RECENTLY_USED' => array( + '5.6' => true, + ), + 'CURLCLOSEPOLICY_LEAST_TRAFFIC' => array( + '5.6' => true, + ), + 'CURLCLOSEPOLICY_SLOWEST' => array( + '5.6' => true, + ), + 'CURLCLOSEPOLICY_CALLBACK' => array( + '5.6' => true, + ), + 'CURLCLOSEPOLICY_OLDEST' => array( + '5.6' => true, + ), + + 'PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT' => array( + '7.0' => true, + ), + 'T_CHARACTER' => array( + '7.0' => true, + ), + 'T_BAD_CHARACTER' => array( + '7.0' => true, + ), + + 'INTL_IDNA_VARIANT_2003' => array( + '7.2' => false, + ), + + 'MCRYPT_MODE_ECB' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_MODE_CBC' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_MODE_CFB' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_MODE_OFB' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_MODE_NOFB' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_MODE_STREAM' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_ENCRYPT' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_DECRYPT' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_DEV_RANDOM' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_DEV_URANDOM' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_RAND' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_3DES' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_ARCFOUR_IV' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_ARCFOUR' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_BLOWFISH' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_CAST_128' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_CAST_256' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_CRYPT' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_DES' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_DES_COMPAT' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_ENIGMA' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_GOST' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_IDEA' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_LOKI97' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_MARS' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_PANAMA' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_RIJNDAEL_128' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_RIJNDAEL_192' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_RIJNDAEL_256' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_RC2' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_RC4' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_RC6' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_RC6_128' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_RC6_192' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_RC6_256' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_SAFER64' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_SAFER128' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_SAFERPLUS' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_SERPENT' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_SERPENT_128' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_SERPENT_192' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_SERPENT_256' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_SKIPJACK' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_TEAN' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_THREEWAY' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_TRIPLEDES' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_TWOFISH' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_TWOFISH128' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_TWOFISH192' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_TWOFISH256' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_WAKE' => array( + '7.1' => false, + '7.2' => true, + ), + 'MCRYPT_XTEA' => array( + '7.1' => false, + '7.2' => true, + ), + + 'PHPDBG_FILE' => array( + '7.3' => true, + ), + 'PHPDBG_METHOD' => array( + '7.3' => true, + ), + 'PHPDBG_LINENO' => array( + '7.3' => true, + ), + 'PHPDBG_FUNC' => array( + '7.3' => true, + ), + 'FILTER_FLAG_SCHEME_REQUIRED' => array( + '7.3' => false, + ), + 'FILTER_FLAG_HOST_REQUIRED' => array( + '7.3' => false, + ), + + 'CURLPIPE_HTTP1' => array( + '7.4' => false, + ), + 'FILTER_SANITIZE_MAGIC_QUOTES' => array( + '7.4' => false, + 'alternative' => 'FILTER_SANITIZE_ADD_SLASHES', + ), + 'IBASE_BKP_CONVERT' => array( + '7.4' => true, + ), + 'IBASE_BKP_IGNORE_CHECKSUMS' => array( + '7.4' => true, + ), + 'IBASE_BKP_IGNORE_LIMBO' => array( + '7.4' => true, + ), + 'IBASE_BKP_METADATA_ONLY' => array( + '7.4' => true, + ), + 'IBASE_BKP_NO_GARBAGE_COLLECT' => array( + '7.4' => true, + ), + 'IBASE_BKP_NON_TRANSPORTABLE' => array( + '7.4' => true, + ), + 'IBASE_BKP_OLD_DESCRIPTIONS' => array( + '7.4' => true, + ), + 'IBASE_COMMITTED' => array( + '7.4' => true, + ), + 'IBASE_CONCURRENCY' => array( + '7.4' => true, + ), + 'IBASE_CONSISTENCY' => array( + '7.4' => true, + ), + 'IBASE_DEFAULT' => array( + '7.4' => true, + ), + 'IBASE_FETCH_ARRAYS' => array( + '7.4' => true, + ), + 'IBASE_FETCH_BLOBS' => array( + '7.4' => true, + ), + 'IBASE_NOWAIT' => array( + '7.4' => true, + ), + 'IBASE_PRP_ACCESS_MODE' => array( + '7.4' => true, + ), + 'IBASE_PRP_ACTIVATE' => array( + '7.4' => true, + ), + 'IBASE_PRP_AM_READONLY' => array( + '7.4' => true, + ), + 'IBASE_PRP_AM_READWRITE' => array( + '7.4' => true, + ), + 'IBASE_PRP_DENY_NEW_ATTACHMENTS' => array( + '7.4' => true, + ), + 'IBASE_PRP_DENY_NEW_TRANSACTIONS' => array( + '7.4' => true, + ), + 'IBASE_PRP_DB_ONLINE' => array( + '7.4' => true, + ), + 'IBASE_PRP_PAGE_BUFFERS' => array( + '7.4' => true, + ), + 'IBASE_PRP_RES' => array( + '7.4' => true, + ), + 'IBASE_PRP_RES_USE_FULL' => array( + '7.4' => true, + ), + 'IBASE_PRP_RESERVE_SPACE' => array( + '7.4' => true, + ), + 'IBASE_PRP_SET_SQL_DIALECT' => array( + '7.4' => true, + ), + 'IBASE_PRP_SHUTDOWN_DB' => array( + '7.4' => true, + ), + 'IBASE_PRP_SWEEP_INTERVAL' => array( + '7.4' => true, + ), + 'IBASE_PRP_WM_ASYNC' => array( + '7.4' => true, + ), + 'IBASE_PRP_WM_SYNC' => array( + '7.4' => true, + ), + 'IBASE_PRP_WRITE_MODE' => array( + '7.4' => true, + ), + 'IBASE_READ' => array( + '7.4' => true, + ), + 'IBASE_RES_CREATE' => array( + '7.4' => true, + ), + 'IBASE_RES_DEACTIVATE_IDX' => array( + '7.4' => true, + ), + 'IBASE_RES_NO_SHADOW' => array( + '7.4' => true, + ), + 'IBASE_RES_NO_VALIDITY' => array( + '7.4' => true, + ), + 'IBASE_RES_ONE_AT_A_TIME' => array( + '7.4' => true, + ), + 'IBASE_RES_REPLACE' => array( + '7.4' => true, + ), + 'IBASE_RES_USE_ALL_SPACE' => array( + '7.4' => true, + ), + 'IBASE_RPR_CHECK_DB' => array( + '7.4' => true, + ), + 'IBASE_RPR_FULL' => array( + '7.4' => true, + ), + 'IBASE_RPR_IGNORE_CHECKSUM' => array( + '7.4' => true, + ), + 'IBASE_RPR_KILL_SHADOWS' => array( + '7.4' => true, + ), + 'IBASE_RPR_MEND_DB' => array( + '7.4' => true, + ), + 'IBASE_RPR_SWEEP_DB' => array( + '7.4' => true, + ), + 'IBASE_RPR_VALIDATE_DB' => array( + '7.4' => true, + ), + 'IBASE_STS_DATA_PAGES' => array( + '7.4' => true, + ), + 'IBASE_STS_DB_LOG' => array( + '7.4' => true, + ), + 'IBASE_STS_HDR_PAGES' => array( + '7.4' => true, + ), + 'IBASE_STS_IDX_PAGES' => array( + '7.4' => true, + ), + 'IBASE_STS_SYS_RELATIONS' => array( + '7.4' => true, + ), + 'IBASE_SVC_GET_ENV' => array( + '7.4' => true, + ), + 'IBASE_SVC_GET_ENV_LOCK' => array( + '7.4' => true, + ), + 'IBASE_SVC_GET_ENV_MSG' => array( + '7.4' => true, + ), + 'IBASE_SVC_GET_USERS' => array( + '7.4' => true, + ), + 'IBASE_SVC_IMPLEMENTATION' => array( + '7.4' => true, + ), + 'IBASE_SVC_SERVER_VERSION' => array( + '7.4' => true, + ), + 'IBASE_SVC_SVR_DB_INFO' => array( + '7.4' => true, + ), + 'IBASE_SVC_USER_DBPATH' => array( + '7.4' => true, + ), + 'IBASE_UNIXTIME' => array( + '7.4' => true, + ), + 'IBASE_WAIT' => array( + '7.4' => true, + ), + 'IBASE_WRITE' => array( + '7.4' => true, + ), + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 8.1.0 + * + * @return array + */ + public function register() + { + return array(\T_STRING); + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 8.1.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $constantName = $tokens[$stackPtr]['content']; + + if (isset($this->removedConstants[$constantName]) === false) { + return; + } + + if ($this->isUseOfGlobalConstant($phpcsFile, $stackPtr) === false) { + return; + } + + $itemInfo = array( + 'name' => $constantName, + ); + $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); + } + + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 8.1.0 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo) + { + return $this->removedConstants[$itemInfo['name']]; + } + + + /** + * Get the error message template for this sniff. + * + * @since 8.1.0 + * + * @return string + */ + protected function getErrorMsgTemplate() + { + return 'The constant "%s" is '; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/DiscouragedSwitchContinueSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/DiscouragedSwitchContinueSniff.php new file mode 100644 index 00000000..8d56b93a --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/DiscouragedSwitchContinueSniff.php @@ -0,0 +1,238 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ControlStructures; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect use of `continue` in `switch` control structures. + * + * As of PHP 7.3, PHP will throw a warning when `continue` is used to target a `switch` + * control structure. + * The sniff takes numeric arguments used with `continue` into account. + * + * PHP version 7.3 + * + * @link https://www.php.net/manual/en/migration73.incompatible.php#migration73.incompatible.core.continue-targeting-switch + * @link https://wiki.php.net/rfc/continue_on_switch_deprecation + * @link https://github.com/php/php-src/commit/04e3523b7d095341f65ed5e71a3cac82fca690e4 + * (actual implementation which is different from the RFC). + * @link https://www.php.net/manual/en/control-structures.switch.php + * + * @since 8.2.0 + */ +class DiscouragedSwitchContinueSniff extends Sniff +{ + + /** + * Token codes of control structures which can be targeted using continue. + * + * @since 8.2.0 + * + * @var array + */ + protected $loopStructures = array( + \T_FOR => \T_FOR, + \T_FOREACH => \T_FOREACH, + \T_WHILE => \T_WHILE, + \T_DO => \T_DO, + \T_SWITCH => \T_SWITCH, + ); + + /** + * Tokens which start a new case within a switch. + * + * @since 8.2.0 + * + * @var array + */ + protected $caseTokens = array( + \T_CASE => \T_CASE, + \T_DEFAULT => \T_DEFAULT, + ); + + /** + * Token codes which are accepted to determine the level for the continue. + * + * This array is enriched with the arithmetic operators in the register() method. + * + * @since 8.2.0 + * + * @var array + */ + protected $acceptedLevelTokens = array( + \T_LNUMBER => \T_LNUMBER, + \T_OPEN_PARENTHESIS => \T_OPEN_PARENTHESIS, + \T_CLOSE_PARENTHESIS => \T_CLOSE_PARENTHESIS, + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 8.2.0 + * + * @return array + */ + public function register() + { + $this->acceptedLevelTokens += Tokens::$arithmeticTokens; + $this->acceptedLevelTokens += Tokens::$emptyTokens; + + return array(\T_SWITCH); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('7.3') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + if (isset($tokens[$stackPtr]['scope_opener'], $tokens[$stackPtr]['scope_closer']) === false) { + return; + } + + $switchOpener = $tokens[$stackPtr]['scope_opener']; + $switchCloser = $tokens[$stackPtr]['scope_closer']; + + // Quick check whether we need to bother with the more complex logic. + $hasContinue = $phpcsFile->findNext(\T_CONTINUE, ($switchOpener + 1), $switchCloser); + if ($hasContinue === false) { + return; + } + + $caseDefault = $switchOpener; + + do { + $caseDefault = $phpcsFile->findNext($this->caseTokens, ($caseDefault + 1), $switchCloser); + if ($caseDefault === false) { + break; + } + + if (isset($tokens[$caseDefault]['scope_opener']) === false) { + // Unknown start of the case, skip. + continue; + } + + $caseOpener = $tokens[$caseDefault]['scope_opener']; + $nextCaseDefault = $phpcsFile->findNext($this->caseTokens, ($caseDefault + 1), $switchCloser); + if ($nextCaseDefault === false) { + $caseCloser = $switchCloser; + } else { + $caseCloser = $nextCaseDefault; + } + + // Check for unscoped control structures within the case. + $controlStructure = $caseOpener; + $doCount = 0; + while (($controlStructure = $phpcsFile->findNext($this->loopStructures, ($controlStructure + 1), $caseCloser)) !== false) { + if ($tokens[$controlStructure]['code'] === \T_DO) { + $doCount++; + } + + if (isset($tokens[$controlStructure]['scope_opener'], $tokens[$controlStructure]['scope_closer']) === false) { + if ($tokens[$controlStructure]['code'] === \T_WHILE && $doCount > 0) { + // While in a do-while construct. + $doCount--; + continue; + } + + // Control structure without braces found within the case, ignore this case. + continue 2; + } + } + + // Examine the contents of the case. + $continue = $caseOpener; + + do { + $continue = $phpcsFile->findNext(\T_CONTINUE, ($continue + 1), $caseCloser); + if ($continue === false) { + break; + } + + $nextSemicolon = $phpcsFile->findNext(array(\T_SEMICOLON, \T_CLOSE_TAG), ($continue + 1), $caseCloser); + $codeString = ''; + for ($i = ($continue + 1); $i < $nextSemicolon; $i++) { + if (isset($this->acceptedLevelTokens[$tokens[$i]['code']]) === false) { + // Function call/variable or other token which make numeric level impossible to determine. + continue 2; + } + + if (isset(Tokens::$emptyTokens[$tokens[$i]['code']]) === true) { + continue; + } + + $codeString .= $tokens[$i]['content']; + } + + $level = null; + if ($codeString !== '') { + if (is_numeric($codeString)) { + $level = (int) $codeString; + } else { + // With the above logic, the string can only contain digits and operators, eval! + $level = eval("return ( $codeString );"); + } + } + + if (isset($level) === false || $level === 0) { + $level = 1; + } + + // Examine which control structure is being targeted by the continue statement. + if (isset($tokens[$continue]['conditions']) === false) { + continue; + } + + $conditions = array_reverse($tokens[$continue]['conditions'], true); + // PHPCS adds more structures to the conditions array than we want to take into + // consideration, so clean up the array. + foreach ($conditions as $tokenPtr => $tokenCode) { + if (isset($this->loopStructures[$tokenCode]) === false) { + unset($conditions[$tokenPtr]); + } + } + + $targetCondition = \array_slice($conditions, ($level - 1), 1, true); + if (empty($targetCondition)) { + continue; + } + + $conditionToken = key($targetCondition); + if ($conditionToken === $stackPtr) { + $phpcsFile->addWarning( + "Targeting a 'switch' control structure with a 'continue' statement is strongly discouraged and will throw a warning as of PHP 7.3.", + $continue, + 'Found' + ); + } + + } while ($continue < $caseCloser); + + } while ($caseDefault < $switchCloser); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/ForbiddenBreakContinueOutsideLoopSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/ForbiddenBreakContinueOutsideLoopSniff.php new file mode 100644 index 00000000..2cfbcc53 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/ForbiddenBreakContinueOutsideLoopSniff.php @@ -0,0 +1,116 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ControlStructures; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect using `break` and/or `continue` statements outside of a looping structure. + * + * PHP version 7.0 + * + * @link https://www.php.net/manual/en/migration70.incompatible.php#migration70.incompatible.other.break-continue + * @link https://www.php.net/manual/en/control-structures.break.php + * @link https://www.php.net/manual/en/control-structures.continue.php + * + * @since 7.0.7 + */ +class ForbiddenBreakContinueOutsideLoopSniff extends Sniff +{ + + /** + * Token codes of control structure in which usage of break/continue is valid. + * + * @since 7.0.7 + * + * @var array + */ + protected $validLoopStructures = array( + \T_FOR => true, + \T_FOREACH => true, + \T_WHILE => true, + \T_DO => true, + \T_SWITCH => true, + ); + + /** + * Token codes which did not correctly get a condition assigned in older PHPCS versions. + * + * @since 7.0.7 + * + * @var array + */ + protected $backCompat = array( + \T_CASE => true, + \T_DEFAULT => true, + ); + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.7 + * + * @return array + */ + public function register() + { + return array( + \T_BREAK, + \T_CONTINUE, + ); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.7 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $token = $tokens[$stackPtr]; + + // Check if the break/continue is within a valid loop structure. + if (empty($token['conditions']) === false) { + foreach ($token['conditions'] as $tokenCode) { + if (isset($this->validLoopStructures[$tokenCode]) === true) { + return; + } + } + } else { + // Deal with older PHPCS versions. + if (isset($token['scope_condition']) === true && isset($this->backCompat[$tokens[$token['scope_condition']]['code']]) === true) { + return; + } + } + + // If we're still here, no valid loop structure container has been found, so throw an error. + $error = "Using '%s' outside of a loop or switch structure is invalid"; + $isError = false; + $errorCode = 'Found'; + $data = array($token['content']); + + if ($this->supportsAbove('7.0')) { + $error .= ' and will throw a fatal error since PHP 7.0'; + $isError = true; + $errorCode = 'FatalError'; + } + + $this->addMessage($phpcsFile, $error, $stackPtr, $isError, $errorCode, $data); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/ForbiddenBreakContinueVariableArgumentsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/ForbiddenBreakContinueVariableArgumentsSniff.php new file mode 100644 index 00000000..f63c8488 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/ForbiddenBreakContinueVariableArgumentsSniff.php @@ -0,0 +1,110 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ControlStructures; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detects using 0 and variable numeric arguments on `break` and `continue` statements. + * + * This sniff checks for: + * - Using `break` and/or `continue` with a variable as the numeric argument. + * - Using `break` and/or `continue` with a zero - 0 - as the numeric argument. + * + * PHP version 5.4 + * + * @link https://www.php.net/manual/en/migration54.incompatible.php + * @link https://www.php.net/manual/en/control-structures.break.php + * @link https://www.php.net/manual/en/control-structures.continue.php + * + * @since 5.5 + * @since 5.6 Now extends the base `Sniff` class. + */ +class ForbiddenBreakContinueVariableArgumentsSniff extends Sniff +{ + /** + * Error types this sniff handles for forbidden break/continue arguments. + * + * Array key is the error code. Array value will be used as part of the error message. + * + * @since 7.0.5 + * @since 7.1.0 Changed from class constants to property. + * + * @var array + */ + private $errorTypes = array( + 'variableArgument' => 'a variable argument', + 'zeroArgument' => '0 as an argument', + ); + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 5.5 + * + * @return array + */ + public function register() + { + return array(\T_BREAK, \T_CONTINUE); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 5.5 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('5.4') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $nextSemicolonToken = $phpcsFile->findNext(array(\T_SEMICOLON, \T_CLOSE_TAG), ($stackPtr), null, false); + $errorType = ''; + for ($curToken = $stackPtr + 1; $curToken < $nextSemicolonToken; $curToken++) { + if ($tokens[$curToken]['type'] === 'T_STRING') { + // If the next non-whitespace token after the string + // is an opening parenthesis then it's a function call. + $openBracket = $phpcsFile->findNext(Tokens::$emptyTokens, $curToken + 1, null, true); + if ($tokens[$openBracket]['code'] === \T_OPEN_PARENTHESIS) { + $errorType = 'variableArgument'; + break; + } + + } elseif (\in_array($tokens[$curToken]['type'], array('T_VARIABLE', 'T_FUNCTION', 'T_CLOSURE'), true)) { + $errorType = 'variableArgument'; + break; + + } elseif ($tokens[$curToken]['type'] === 'T_LNUMBER' && $tokens[$curToken]['content'] === '0') { + $errorType = 'zeroArgument'; + break; + } + } + + if ($errorType !== '') { + $error = 'Using %s on break or continue is forbidden since PHP 5.4'; + $errorCode = $errorType . 'Found'; + $data = array($this->errorTypes[$errorType]); + + $phpcsFile->addError($error, $stackPtr, $errorCode, $data); + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/ForbiddenSwitchWithMultipleDefaultBlocksSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/ForbiddenSwitchWithMultipleDefaultBlocksSniff.php new file mode 100644 index 00000000..26f41c07 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/ForbiddenSwitchWithMultipleDefaultBlocksSniff.php @@ -0,0 +1,81 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ControlStructures; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; + +/** + * Switch statements can not have multiple default blocks since PHP 7.0. + * + * PHP version 7.0 + * + * @link https://wiki.php.net/rfc/switch.default.multiple + * @link https://www.php.net/manual/en/control-structures.switch.php + * + * @since 7.0.0 + */ +class ForbiddenSwitchWithMultipleDefaultBlocksSniff extends Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.0 + * + * @return array + */ + public function register() + { + return array(\T_SWITCH); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('7.0') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + if (isset($tokens[$stackPtr]['scope_closer']) === false) { + return; + } + + $defaultToken = $stackPtr; + $defaultCount = 0; + $targetLevel = $tokens[$stackPtr]['level'] + 1; + while ($defaultCount < 2 && ($defaultToken = $phpcsFile->findNext(array(\T_DEFAULT), $defaultToken + 1, $tokens[$stackPtr]['scope_closer'])) !== false) { + // Same level or one below (= two default cases after each other). + if ($tokens[$defaultToken]['level'] === $targetLevel || $tokens[$defaultToken]['level'] === ($targetLevel + 1)) { + $defaultCount++; + } + } + + if ($defaultCount > 1) { + $phpcsFile->addError( + 'Switch statements can not have multiple default blocks since PHP 7.0', + $stackPtr, + 'Found' + ); + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewExecutionDirectivesSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewExecutionDirectivesSniff.php new file mode 100644 index 00000000..0e71a261 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewExecutionDirectivesSniff.php @@ -0,0 +1,378 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ControlStructures; + +use PHPCompatibility\AbstractNewFeatureSniff; +use PHPCompatibility\PHPCSHelper; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Check for valid execution directives set with `declare()`. + * + * The sniff contains three distinct checks: + * - Check if the execution directive used is valid. PHP currently only supports + * three execution directives. + * - Check if the execution directive used is available in the PHP versions + * for which support is being checked. + * In the case of the `encoding` directive on PHP 5.3, support is conditional + * on the `--enable-zend-multibyte` compilation option. This will be indicated as such. + * - Check whether the value for the directive is valid. + * + * PHP version All + * + * @link https://www.php.net/manual/en/control-structures.declare.php + * @link https://wiki.php.net/rfc/scalar_type_hints_v5#strict_types_declare_directive + * + * @since 7.0.3 + * @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class. + */ +class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff +{ + + /** + * A list of new execution directives + * + * The array lists : version number with false (not present) or true (present). + * If the execution order is conditional, add the condition as a string to the version nr. + * If's sufficient to list the first version where the execution directive appears. + * + * @since 7.0.3 + * + * @var array(string => array(string => bool|string|array)) + */ + protected $newDirectives = array( + 'ticks' => array( + '3.1' => false, + '4.0' => true, + 'valid_value_callback' => 'isNumeric', + ), + 'encoding' => array( + '5.2' => false, + '5.3' => '--enable-zend-multibyte', // Directive ignored unless. + '5.4' => true, + 'valid_value_callback' => 'validEncoding', + ), + 'strict_types' => array( + '5.6' => false, + '7.0' => true, + 'valid_values' => array(1), + ), + ); + + + /** + * Tokens to ignore when trying to find the value for the directive. + * + * @since 7.0.3 + * + * @var array + */ + protected $ignoreTokens = array(); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.3 + * + * @return array + */ + public function register() + { + $this->ignoreTokens = Tokens::$emptyTokens; + $this->ignoreTokens[\T_EQUAL] = \T_EQUAL; + + return array(\T_DECLARE); + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.3 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + if (isset($tokens[$stackPtr]['parenthesis_opener'], $tokens[$stackPtr]['parenthesis_closer']) === true) { + $openParenthesis = $tokens[$stackPtr]['parenthesis_opener']; + $closeParenthesis = $tokens[$stackPtr]['parenthesis_closer']; + } else { + if (version_compare(PHPCSHelper::getVersion(), '2.3.4', '>=')) { + return; + } + + // Deal with PHPCS 2.3.0-2.3.3 which do not yet set the parenthesis properly for declare statements. + $openParenthesis = $phpcsFile->findNext(\T_OPEN_PARENTHESIS, ($stackPtr + 1), null, false, null, true); + if ($openParenthesis === false || isset($tokens[$openParenthesis]['parenthesis_closer']) === false) { + return; + } + $closeParenthesis = $tokens[$openParenthesis]['parenthesis_closer']; + } + + $directivePtr = $phpcsFile->findNext(\T_STRING, ($openParenthesis + 1), $closeParenthesis, false); + if ($directivePtr === false) { + return; + } + + $directiveContent = $tokens[$directivePtr]['content']; + + if (isset($this->newDirectives[$directiveContent]) === false) { + $error = 'Declare can only be used with the directives %s. Found: %s'; + $data = array( + implode(', ', array_keys($this->newDirectives)), + $directiveContent, + ); + + $phpcsFile->addError($error, $stackPtr, 'InvalidDirectiveFound', $data); + + } else { + // Check for valid directive for version. + $itemInfo = array( + 'name' => $directiveContent, + ); + $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); + + // Check for valid directive value. + $valuePtr = $phpcsFile->findNext($this->ignoreTokens, $directivePtr + 1, $closeParenthesis, true); + if ($valuePtr === false) { + return; + } + + $this->addWarningOnInvalidValue($phpcsFile, $valuePtr, $directiveContent); + } + } + + + /** + * Determine whether an error/warning should be thrown for an item based on collected information. + * + * @since 7.1.0 + * + * @param array $errorInfo Detail information about an item. + * + * @return bool + */ + protected function shouldThrowError(array $errorInfo) + { + return ($errorInfo['not_in_version'] !== '' || $errorInfo['conditional_version'] !== ''); + } + + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 7.1.0 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo) + { + return $this->newDirectives[$itemInfo['name']]; + } + + + /** + * Get an array of the non-PHP-version array keys used in a sub-array. + * + * @since 7.1.0 + * + * @return array + */ + protected function getNonVersionArrayKeys() + { + return array( + 'valid_value_callback', + 'valid_values', + ); + } + + + /** + * Retrieve the relevant detail (version) information for use in an error message. + * + * @since 7.1.0 + * + * @param array $itemArray Version and other information about the item. + * @param array $itemInfo Base information about the item. + * + * @return array + */ + public function getErrorInfo(array $itemArray, array $itemInfo) + { + $errorInfo = parent::getErrorInfo($itemArray, $itemInfo); + $errorInfo['conditional_version'] = ''; + $errorInfo['condition'] = ''; + + $versionArray = $this->getVersionArray($itemArray); + + if (empty($versionArray) === false) { + foreach ($versionArray as $version => $present) { + if (\is_string($present) === true && $this->supportsBelow($version) === true) { + // We cannot test for compilation option (ok, except by scraping the output of phpinfo...). + $errorInfo['conditional_version'] = $version; + $errorInfo['condition'] = $present; + } + } + } + + return $errorInfo; + } + + + /** + * Get the error message template for this sniff. + * + * @since 7.1.0 + * + * @return string + */ + protected function getErrorMsgTemplate() + { + return 'Directive ' . parent::getErrorMsgTemplate(); + } + + + /** + * Generates the error or warning for this item. + * + * @since 7.0.3 + * @since 7.1.0 This method now overloads the method from the `AbstractNewFeatureSniff` class. + * - Renamed from `maybeAddError()` to `addError()`. + * - Changed visibility from `protected` to `public`. + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the relevant token in + * the stack. + * @param array $itemInfo Base information about the item. + * @param array $errorInfo Array with detail (version) information + * relevant to the item. + * + * @return void + */ + public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo) + { + if ($errorInfo['not_in_version'] !== '') { + parent::addError($phpcsFile, $stackPtr, $itemInfo, $errorInfo); + } elseif ($errorInfo['conditional_version'] !== '') { + $error = 'Directive %s is present in PHP version %s but will be disregarded unless PHP is compiled with %s'; + $errorCode = $this->stringToErrorCode($itemInfo['name']) . 'WithConditionFound'; + $data = array( + $itemInfo['name'], + $errorInfo['conditional_version'], + $errorInfo['condition'], + ); + + $phpcsFile->addWarning($error, $stackPtr, $errorCode, $data); + } + } + + + /** + * Generates a error or warning for this sniff. + * + * @since 7.0.3 + * @since 7.0.6 Renamed from `addErrorOnInvalidValue()` to `addWarningOnInvalidValue()`. + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the execution directive value + * in the token array. + * @param string $directive The directive. + * + * @return void + */ + protected function addWarningOnInvalidValue(File $phpcsFile, $stackPtr, $directive) + { + $tokens = $phpcsFile->getTokens(); + + $value = $tokens[$stackPtr]['content']; + if (isset(Tokens::$stringTokens[$tokens[$stackPtr]['code']]) === true) { + $value = $this->stripQuotes($value); + } + + $isError = false; + if (isset($this->newDirectives[$directive]['valid_values'])) { + if (\in_array($value, $this->newDirectives[$directive]['valid_values']) === false) { + $isError = true; + } + } elseif (isset($this->newDirectives[$directive]['valid_value_callback'])) { + $valid = \call_user_func(array($this, $this->newDirectives[$directive]['valid_value_callback']), $value); + if ($valid === false) { + $isError = true; + } + } + + if ($isError === true) { + $error = 'The execution directive %s does not seem to have a valid value. Please review. Found: %s'; + $errorCode = $this->stringToErrorCode($directive) . 'InvalidValueFound'; + $data = array( + $directive, + $value, + ); + + $phpcsFile->addWarning($error, $stackPtr, $errorCode, $data); + } + } + + + /** + * Check whether a value is numeric. + * + * Callback function to test whether the value for an execution directive is valid. + * + * @since 7.0.3 + * + * @param mixed $value The value to test. + * + * @return bool + */ + protected function isNumeric($value) + { + return is_numeric($value); + } + + + /** + * Check whether a value is a valid encoding. + * + * Callback function to test whether the value for an execution directive is valid. + * + * @since 7.0.3 + * + * @param mixed $value The value to test. + * + * @return bool + */ + protected function validEncoding($value) + { + static $encodings; + if (isset($encodings) === false && function_exists('mb_list_encodings')) { + $encodings = mb_list_encodings(); + } + + if (empty($encodings) || \is_array($encodings) === false) { + // If we can't test the encoding, let it pass through. + return true; + } + + return \in_array($value, $encodings, true); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewForeachExpressionReferencingSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewForeachExpressionReferencingSniff.php new file mode 100644 index 00000000..a2227692 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewForeachExpressionReferencingSniff.php @@ -0,0 +1,99 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ControlStructures; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect `foreach` expression referencing. + * + * Before PHP 5.5.0, referencing `$value` in a `foreach` was only possible + * if the iterated array could be referenced (i.e. if it is a variable). + * + * PHP version 5.5 + * + * @link https://www.php.net/manual/en/control-structures.foreach.php + * + * @since 9.0.0 + */ +class NewForeachExpressionReferencingSniff extends Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 9.0.0 + * + * @return array + */ + public function register() + { + return array(\T_FOREACH); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 9.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('5.4') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + if (isset($tokens[$stackPtr]['parenthesis_opener'], $tokens[$stackPtr]['parenthesis_closer']) === false) { + return; + } + + $opener = $tokens[$stackPtr]['parenthesis_opener']; + $closer = $tokens[$stackPtr]['parenthesis_closer']; + + $asToken = $phpcsFile->findNext(\T_AS, ($opener + 1), $closer); + if ($asToken === false) { + return; + } + + /* + * Note: referencing $key is not allowed in any version, so this should only find referenced $values. + * If it does find a referenced key, it would be a parse error anyway. + */ + $hasReference = $phpcsFile->findNext(\T_BITWISE_AND, ($asToken + 1), $closer); + if ($hasReference === false) { + return; + } + + $nestingLevel = 0; + if ($asToken !== ($opener + 1) && isset($tokens[$opener + 1]['nested_parenthesis'])) { + $nestingLevel = \count($tokens[$opener + 1]['nested_parenthesis']); + } + + if ($this->isVariable($phpcsFile, ($opener + 1), $asToken, $nestingLevel) === true) { + return; + } + + // Non-variable detected before the `as` keyword. + $phpcsFile->addError( + 'Referencing $value is only possible if the iterated array is a variable in PHP 5.4 or earlier.', + $hasReference, + 'Found' + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewListInForeachSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewListInForeachSniff.php new file mode 100644 index 00000000..2398cf17 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewListInForeachSniff.php @@ -0,0 +1,84 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ControlStructures; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect unpacking nested arrays with `list()` in a `foreach()` as available since PHP 5.5. + * + * PHP version 5.5 + * + * @link https://www.php.net/manual/en/migration55.new-features.php#migration55.new-features.foreach-list + * @link https://wiki.php.net/rfc/foreachlist + * @link https://www.php.net/manual/en/control-structures.foreach.php#control-structures.foreach.list + * + * @since 9.0.0 + */ +class NewListInForeachSniff extends Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 9.0.0 + * + * @return array + */ + public function register() + { + return array(\T_FOREACH); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 9.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('5.4') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + if (isset($tokens[$stackPtr]['parenthesis_opener'], $tokens[$stackPtr]['parenthesis_closer']) === false) { + return; + } + + $opener = $tokens[$stackPtr]['parenthesis_opener']; + $closer = $tokens[$stackPtr]['parenthesis_closer']; + + $asToken = $phpcsFile->findNext(\T_AS, ($opener + 1), $closer); + if ($asToken === false) { + return; + } + + $hasList = $phpcsFile->findNext(array(\T_LIST, \T_OPEN_SHORT_ARRAY), ($asToken + 1), $closer); + if ($hasList === false) { + return; + } + + $phpcsFile->addError( + 'Unpacking nested arrays with list() in a foreach is not supported in PHP 5.4 or earlier.', + $hasList, + 'Found' + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewMultiCatchSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewMultiCatchSniff.php new file mode 100644 index 00000000..256f37ff --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewMultiCatchSniff.php @@ -0,0 +1,78 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ControlStructures; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; + +/** + * Catching multiple exception types in one statement is available since PHP 7.1. + * + * PHP version 7.1 + * + * @link https://www.php.net/manual/en/migration71.new-features.php#migration71.new-features.mulit-catch-exception-handling + * @link https://wiki.php.net/rfc/multiple-catch + * @link https://www.php.net/manual/en/language.exceptions.php#language.exceptions.catch + * + * @since 7.0.7 + */ +class NewMultiCatchSniff extends Sniff +{ + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.7 + * + * @return array + */ + public function register() + { + return array(\T_CATCH); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.7 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('7.0') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $token = $tokens[$stackPtr]; + + // Bow out during live coding. + if (isset($token['parenthesis_opener'], $token['parenthesis_closer']) === false) { + return; + } + + $hasBitwiseOr = $phpcsFile->findNext(\T_BITWISE_OR, $token['parenthesis_opener'], $token['parenthesis_closer']); + + if ($hasBitwiseOr === false) { + return; + } + + $phpcsFile->addError( + 'Catching multiple exceptions within one statement is not supported in PHP 7.0 or earlier.', + $hasBitwiseOr, + 'Found' + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Extensions/RemovedExtensionsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Extensions/RemovedExtensionsSniff.php new file mode 100644 index 00000000..13f5dfce --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Extensions/RemovedExtensionsSniff.php @@ -0,0 +1,346 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Extensions; + +use PHPCompatibility\AbstractRemovedFeatureSniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect the use of deprecated and/or removed PHP extensions. + * + * This sniff examines function calls made and flags function calls to functions + * prefixed with the dedicated prefix from a deprecated/removed native PHP extension. + * + * Suggests alternative extensions if available. + * + * As userland functions may be prefixed with a prefix also used by a native + * PHP extension, the sniff offers the ability to whitelist specific functions + * from being flagged by this sniff via a property in a custom ruleset + * (since PHPCompatibility 7.0.2). + * + * {@internal This sniff is a candidate for removal once all functions from all + * deprecated/removed extensions have been added to the RemovedFunctions sniff.} + * + * PHP version All + * + * @since 5.5 + * @since 7.1.0 Now extends the `AbstractRemovedFeatureSniff` instead of the base `Sniff` class. + */ +class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff +{ + /** + * A list of functions to whitelist, if any. + * + * This is intended for projects using functions which start with the same + * prefix as one of the removed extensions. + * + * This property can be set from the ruleset, like so: + * <rule ref="PHPCompatibility.Extensions.RemovedExtensions"> + * <properties> + * <property name="functionWhitelist" type="array" value="mysql_to_rfc3339,mysql_another_function" /> + * </properties> + * </rule> + * + * @since 7.0.2 + * + * @var array + */ + public $functionWhitelist; + + /** + * A list of removed extensions with their alternative, if any. + * + * The array lists : version number with false (deprecated) and true (removed). + * If's sufficient to list the first version where the extension was deprecated/removed. + * + * @since 5.5 + * + * @var array(string => array(string => bool|string|null)) + */ + protected $removedExtensions = array( + 'activescript' => array( + '5.1' => true, + 'alternative' => 'pecl/activescript', + ), + 'cpdf' => array( + '5.1' => true, + 'alternative' => 'pecl/pdflib', + ), + 'dbase' => array( + '5.3' => true, + 'alternative' => null, + ), + 'dbx' => array( + '5.1' => true, + 'alternative' => 'pecl/dbx', + ), + 'dio' => array( + '5.1' => true, + 'alternative' => 'pecl/dio', + ), + 'ereg' => array( + '5.3' => false, + '7.0' => true, + 'alternative' => 'pcre', + ), + 'fam' => array( + '5.1' => true, + 'alternative' => null, + ), + 'fbsql' => array( + '5.3' => true, + 'alternative' => null, + ), + 'fdf' => array( + '5.3' => true, + 'alternative' => 'pecl/fdf', + ), + 'filepro' => array( + '5.2' => true, + 'alternative' => null, + ), + 'hw_api' => array( + '5.2' => true, + 'alternative' => null, + ), + 'ibase' => array( + '7.4' => true, + 'alternative' => 'pecl/ibase', + ), + 'ingres' => array( + '5.1' => true, + 'alternative' => 'pecl/ingres', + ), + 'ircg' => array( + '5.1' => true, + 'alternative' => null, + ), + 'mcrypt' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'openssl (preferred) or pecl/mcrypt once available', + ), + 'mcve' => array( + '5.1' => true, + 'alternative' => 'pecl/mcve', + ), + 'ming' => array( + '5.3' => true, + 'alternative' => 'pecl/ming', + ), + 'mnogosearch' => array( + '5.1' => true, + 'alternative' => null, + ), + 'msql' => array( + '5.3' => true, + 'alternative' => null, + ), + 'mssql' => array( + '7.0' => true, + 'alternative' => null, + ), + 'mysql_' => array( + '5.5' => false, + '7.0' => true, + 'alternative' => 'mysqli', + ), + 'ncurses' => array( + '5.3' => true, + 'alternative' => 'pecl/ncurses', + ), + 'oracle' => array( + '5.1' => true, + 'alternative' => 'oci8 or pdo_oci', + ), + 'ovrimos' => array( + '5.1' => true, + 'alternative' => null, + ), + 'pfpro_' => array( + '5.1' => true, + 'alternative' => null, + ), + 'recode' => array( + '7.4' => true, + 'alternative' => 'iconv or mbstring', + ), + 'sqlite' => array( + '5.4' => true, + 'alternative' => null, + ), + // Has to be before `sybase` as otherwise it will never match. + 'sybase_ct' => array( + '7.0' => true, + 'alternative' => null, + ), + 'sybase' => array( + '5.3' => true, + 'alternative' => 'sybase_ct', + ), + 'w32api' => array( + '5.1' => true, + 'alternative' => 'pecl/ffi', + ), + 'wddx' => array( + '7.4' => true, + 'alternative' => 'pecl/wddx', + ), + 'yp' => array( + '5.1' => true, + 'alternative' => null, + ), + ); + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 5.5 + * + * @return array + */ + public function register() + { + // Handle case-insensitivity of function names. + $this->removedExtensions = $this->arrayKeysToLowercase($this->removedExtensions); + + return array(\T_STRING); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 5.5 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + // Find the next non-empty token. + $openBracket = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + + if ($tokens[$openBracket]['code'] !== \T_OPEN_PARENTHESIS) { + // Not a function call. + return; + } + + if (isset($tokens[$openBracket]['parenthesis_closer']) === false) { + // Not a function call. + return; + } + + // Find the previous non-empty token. + $search = Tokens::$emptyTokens; + $search[] = \T_BITWISE_AND; + $previous = $phpcsFile->findPrevious($search, ($stackPtr - 1), null, true); + if ($tokens[$previous]['code'] === \T_FUNCTION) { + // It's a function definition, not a function call. + return; + } + + if ($tokens[$previous]['code'] === \T_NEW) { + // We are creating an object, not calling a function. + return; + } + + if ($tokens[$previous]['code'] === \T_OBJECT_OPERATOR) { + // We are calling a method of an object. + return; + } + + $function = $tokens[$stackPtr]['content']; + $functionLc = strtolower($function); + + if ($this->isWhiteListed($functionLc) === true) { + // Function is whitelisted. + return; + } + + foreach ($this->removedExtensions as $extension => $versionList) { + if (strpos($functionLc, $extension) === 0) { + $itemInfo = array( + 'name' => $extension, + ); + $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); + break; + } + } + } + + + /** + * Is the current function being checked whitelisted ? + * + * Parsing the list late as it may be provided as a property, but also inline. + * + * @since 7.0.2 + * + * @param string $content Content of the current token. + * + * @return bool + */ + protected function isWhiteListed($content) + { + if (isset($this->functionWhitelist) === false) { + return false; + } + + if (\is_string($this->functionWhitelist) === true) { + if (strpos($this->functionWhitelist, ',') !== false) { + $this->functionWhitelist = explode(',', $this->functionWhitelist); + } else { + $this->functionWhitelist = (array) $this->functionWhitelist; + } + } + + if (\is_array($this->functionWhitelist) === true) { + $this->functionWhitelist = array_map('strtolower', $this->functionWhitelist); + return \in_array($content, $this->functionWhitelist, true); + } + + return false; + } + + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 7.1.0 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo) + { + return $this->removedExtensions[$itemInfo['name']]; + } + + + /** + * Get the error message template for this sniff. + * + * @since 7.1.0 + * + * @return string + */ + protected function getErrorMsgTemplate() + { + return "Extension '%s' is "; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenParameterShadowSuperGlobalsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenParameterShadowSuperGlobalsSniff.php new file mode 100644 index 00000000..0f52af71 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenParameterShadowSuperGlobalsSniff.php @@ -0,0 +1,79 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\FunctionDeclarations; + +use PHPCompatibility\Sniff; +use PHPCompatibility\PHPCSHelper; +use PHP_CodeSniffer_File as File; + +/** + * Detect the use of superglobals as parameters for functions, support for which was removed in PHP 5.4. + * + * {@internal List of superglobals is maintained in the parent class.} + * + * PHP version 5.4 + * + * @link https://www.php.net/manual/en/migration54.incompatible.php + * + * @since 7.0.0 + */ +class ForbiddenParameterShadowSuperGlobalsSniff extends Sniff +{ + + /** + * Register the tokens to listen for. + * + * @since 7.0.0 + * @since 7.1.3 Allows for closures. + * + * @return array + */ + public function register() + { + return array( + \T_FUNCTION, + \T_CLOSURE, + ); + } + + /** + * Processes the test. + * + * @since 7.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('5.4') === false) { + return; + } + + // Get all parameters from function signature. + $parameters = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr); + if (empty($parameters) || \is_array($parameters) === false) { + return; + } + + foreach ($parameters as $param) { + if (isset($this->superglobals[$param['name']]) === true) { + $error = 'Parameter shadowing super global (%s) causes fatal error since PHP 5.4'; + $errorCode = $this->stringToErrorCode(substr($param['name'], 1)) . 'Found'; + $data = array($param['name']); + + $phpcsFile->addError($error, $param['token'], $errorCode, $data); + } + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenParametersWithSameNameSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenParametersWithSameNameSniff.php new file mode 100644 index 00000000..e94461ca --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenParametersWithSameNameSniff.php @@ -0,0 +1,88 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\FunctionDeclarations; + +use PHPCompatibility\Sniff; +use PHPCompatibility\PHPCSHelper; +use PHP_CodeSniffer_File as File; + +/** + * Functions can not have multiple parameters with the same name since PHP 7.0. + * + * PHP version 7.0 + * + * @link https://www.php.net/manual/en/migration70.incompatible.php#migration70.incompatible.other.func-parameters + * + * @since 7.0.0 + */ +class ForbiddenParametersWithSameNameSniff extends Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.0 + * @since 7.1.3 Allows for closures. + * + * @return array + */ + public function register() + { + return array( + \T_FUNCTION, + \T_CLOSURE, + ); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('7.0') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $token = $tokens[$stackPtr]; + // Skip function without body. + if (isset($token['scope_opener']) === false) { + return; + } + + // Get all parameters from method signature. + $parameters = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr); + if (empty($parameters) || \is_array($parameters) === false) { + return; + } + + $paramNames = array(); + foreach ($parameters as $param) { + $paramNames[] = $param['name']; + } + + if (\count($paramNames) !== \count(array_unique($paramNames))) { + $phpcsFile->addError( + 'Functions can not have multiple parameters with the same name since PHP 7.0', + $stackPtr, + 'Found' + ); + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenToStringParametersSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenToStringParametersSniff.php new file mode 100644 index 00000000..1625a4fa --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenToStringParametersSniff.php @@ -0,0 +1,99 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\FunctionDeclarations; + +use PHPCompatibility\Sniff; +use PHPCompatibility\PHPCSHelper; +use PHP_CodeSniffer_File as File; + +/** + * As of PHP 5.3, the __toString() magic method can no longer accept arguments. + * + * Sister-sniff to `PHPCompatibility.MethodUse.ForbiddenToStringParameters`. + * + * PHP version 5.3 + * + * @link https://www.php.net/manual/en/migration53.incompatible.php + * @link https://www.php.net/manual/en/language.oop5.magic.php#object.tostring + * + * @since 9.2.0 + */ +class ForbiddenToStringParametersSniff extends Sniff +{ + + /** + * Valid scopes for the __toString() method to live in. + * + * @since 9.2.0 + * @since 9.3.2 Visibility changed from `public` to `protected`. + * + * @var array + */ + protected $ooScopeTokens = array( + 'T_CLASS' => true, + 'T_INTERFACE' => true, + 'T_TRAIT' => true, + 'T_ANON_CLASS' => true, + ); + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 9.2.0 + * + * @return array + */ + public function register() + { + return array(\T_FUNCTION); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 9.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('5.3') === false) { + return; + } + + $functionName = $phpcsFile->getDeclarationName($stackPtr); + if (strtolower($functionName) !== '__tostring') { + // Not the right function. + return; + } + + if ($this->validDirectScope($phpcsFile, $stackPtr, $this->ooScopeTokens) === false) { + // Function, not method. + return; + } + + $params = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr); + if (empty($params)) { + // Function declared without parameters. + return; + } + + $phpcsFile->addError( + 'The __toString() magic method can no longer accept arguments since PHP 5.3', + $stackPtr, + 'Declared' + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenVariableNamesInClosureUseSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenVariableNamesInClosureUseSniff.php new file mode 100644 index 00000000..2e72c05e --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenVariableNamesInClosureUseSniff.php @@ -0,0 +1,122 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\FunctionDeclarations; + +use PHPCompatibility\Sniff; +use PHPCompatibility\PHPCSHelper; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect variable names forbidden to be used in closure `use` statements. + * + * Variables bound to a closure via the `use` construct cannot use the same name + * as any superglobals, `$this`, or any parameter since PHP 7.1. + * + * PHP version 7.1 + * + * @link https://www.php.net/manual/en/migration71.incompatible.php#migration71.incompatible.lexical-names + * @link https://www.php.net/manual/en/functions.anonymous.php + * + * @since 7.1.4 + */ +class ForbiddenVariableNamesInClosureUseSniff extends Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.1.4 + * + * @return array + */ + public function register() + { + return array(\T_USE); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.1.4 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('7.1') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + // Verify this use statement is used with a closure - if so, it has to have parenthesis before it. + $previousNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true); + if ($previousNonEmpty === false || $tokens[$previousNonEmpty]['code'] !== \T_CLOSE_PARENTHESIS + || isset($tokens[$previousNonEmpty]['parenthesis_opener']) === false + ) { + return; + } + + // ... and (a variable within) parenthesis after it. + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true, null, true); + if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== \T_OPEN_PARENTHESIS) { + return; + } + + if (isset($tokens[$nextNonEmpty]['parenthesis_closer']) === false) { + // Live coding. + return; + } + + $closurePtr = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($tokens[$previousNonEmpty]['parenthesis_opener'] - 1), null, true); + if ($closurePtr === false || $tokens[$closurePtr]['code'] !== \T_CLOSURE) { + return; + } + + // Get the parameters declared by the closure. + $closureParams = PHPCSHelper::getMethodParameters($phpcsFile, $closurePtr); + + $errorMsg = 'Variables bound to a closure via the use construct cannot use the same name as superglobals, $this, or a declared parameter since PHP 7.1. Found: %s'; + + for ($i = ($nextNonEmpty + 1); $i < $tokens[$nextNonEmpty]['parenthesis_closer']; $i++) { + if ($tokens[$i]['code'] !== \T_VARIABLE) { + continue; + } + + $variableName = $tokens[$i]['content']; + + if ($variableName === '$this') { + $phpcsFile->addError($errorMsg, $i, 'FoundThis', array($variableName)); + continue; + } + + if (isset($this->superglobals[$variableName]) === true) { + $phpcsFile->addError($errorMsg, $i, 'FoundSuperglobal', array($variableName)); + continue; + } + + // Check whether it is one of the parameters declared by the closure. + if (empty($closureParams) === false) { + foreach ($closureParams as $param) { + if ($param['name'] === $variableName) { + $phpcsFile->addError($errorMsg, $i, 'FoundShadowParam', array($variableName)); + continue 2; + } + } + } + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewClosureSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewClosureSniff.php new file mode 100644 index 00000000..b71bb320 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewClosureSniff.php @@ -0,0 +1,264 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\FunctionDeclarations; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect closures and verify that the features used are supported. + * + * Version based checks: + * - Closures are available since PHP 5.3. + * - Closures can be declared as `static` since PHP 5.4. + * - Closures can use the `$this` variable within a class context since PHP 5.4. + * - Closures can use `self`/`parent`/`static` since PHP 5.4. + * + * Version independent checks: + * - Static closures don't have access to the `$this` variable. + * - Closures declared outside of a class context don't have access to the `$this` + * variable unless bound to an object. + * + * PHP version 5.3 + * PHP version 5.4 + * + * @link https://www.php.net/manual/en/functions.anonymous.php + * @link https://wiki.php.net/rfc/closures + * @link https://wiki.php.net/rfc/closures/object-extension + * + * @since 7.0.0 + */ +class NewClosureSniff extends Sniff +{ + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.0 + * + * @return array + */ + public function register() + { + return array(\T_CLOSURE); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.0 + * @since 7.1.4 - Added check for closure being declared as static < 5.4. + * - Added check for use of `$this` variable in class context < 5.4. + * - Added check for use of `$this` variable in static closures (unsupported). + * - Added check for use of `$this` variable outside class context (unsupported). + * @since 8.2.0 Added check for use of `self`/`static`/`parent` < 5.4. + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('5.2')) { + $phpcsFile->addError( + 'Closures / anonymous functions are not available in PHP 5.2 or earlier', + $stackPtr, + 'Found' + ); + } + + /* + * Closures can only be declared as static since PHP 5.4. + */ + $isStatic = $this->isClosureStatic($phpcsFile, $stackPtr); + if ($this->supportsBelow('5.3') && $isStatic === true) { + $phpcsFile->addError( + 'Closures / anonymous functions could not be declared as static in PHP 5.3 or earlier', + $stackPtr, + 'StaticFound' + ); + } + + $tokens = $phpcsFile->getTokens(); + + if (isset($tokens[$stackPtr]['scope_opener'], $tokens[$stackPtr]['scope_closer']) === false) { + // Live coding or parse error. + return; + } + + $scopeStart = ($tokens[$stackPtr]['scope_opener'] + 1); + $scopeEnd = $tokens[$stackPtr]['scope_closer']; + $usesThis = $this->findThisUsageInClosure($phpcsFile, $scopeStart, $scopeEnd); + + if ($this->supportsBelow('5.3')) { + /* + * Closures declared within classes only have access to $this since PHP 5.4. + */ + if ($usesThis !== false) { + $thisFound = $usesThis; + do { + $phpcsFile->addError( + 'Closures / anonymous functions did not have access to $this in PHP 5.3 or earlier', + $thisFound, + 'ThisFound' + ); + + $thisFound = $this->findThisUsageInClosure($phpcsFile, ($thisFound + 1), $scopeEnd); + + } while ($thisFound !== false); + } + + /* + * Closures declared within classes only have access to self/parent/static since PHP 5.4. + */ + $usesClassRef = $this->findClassRefUsageInClosure($phpcsFile, $scopeStart, $scopeEnd); + + if ($usesClassRef !== false) { + do { + $phpcsFile->addError( + 'Closures / anonymous functions could not use "%s::" in PHP 5.3 or earlier', + $usesClassRef, + 'ClassRefFound', + array(strtolower($tokens[$usesClassRef]['content'])) + ); + + $usesClassRef = $this->findClassRefUsageInClosure($phpcsFile, ($usesClassRef + 1), $scopeEnd); + + } while ($usesClassRef !== false); + } + } + + /* + * Check for correct usage. + */ + if ($this->supportsAbove('5.4') && $usesThis !== false) { + + $thisFound = $usesThis; + + do { + /* + * Closures only have access to $this if not declared as static. + */ + if ($isStatic === true) { + $phpcsFile->addError( + 'Closures / anonymous functions declared as static do not have access to $this', + $thisFound, + 'ThisFoundInStatic' + ); + } + + /* + * Closures only have access to $this if used within a class context. + */ + elseif ($this->inClassScope($phpcsFile, $stackPtr, false) === false) { + $phpcsFile->addWarning( + 'Closures / anonymous functions only have access to $this if used within a class or when bound to an object using bindTo(). Please verify.', + $thisFound, + 'ThisFoundOutsideClass' + ); + } + + $thisFound = $this->findThisUsageInClosure($phpcsFile, ($thisFound + 1), $scopeEnd); + + } while ($thisFound !== false); + } + + // Prevent double reporting for nested closures. + return $scopeEnd; + } + + + /** + * Check whether the closure is declared as static. + * + * @since 7.1.4 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return bool + */ + protected function isClosureStatic(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $prevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true); + + return ($prevToken !== false && $tokens[$prevToken]['code'] === \T_STATIC); + } + + + /** + * Check if the code within a closure uses the $this variable. + * + * @since 7.1.4 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $startToken The position within the closure to continue searching from. + * @param int $endToken The closure scope closer to stop searching at. + * + * @return int|false The stackPtr to the first $this usage if found or false if + * $this is not used. + */ + protected function findThisUsageInClosure(File $phpcsFile, $startToken, $endToken) + { + // Make sure the $startToken is valid. + if ($startToken >= $endToken) { + return false; + } + + return $phpcsFile->findNext( + \T_VARIABLE, + $startToken, + $endToken, + false, + '$this' + ); + } + + /** + * Check if the code within a closure uses "self/parent/static". + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $startToken The position within the closure to continue searching from. + * @param int $endToken The closure scope closer to stop searching at. + * + * @return int|false The stackPtr to the first classRef usage if found or false if + * they are not used. + */ + protected function findClassRefUsageInClosure(File $phpcsFile, $startToken, $endToken) + { + // Make sure the $startToken is valid. + if ($startToken >= $endToken) { + return false; + } + + $tokens = $phpcsFile->getTokens(); + $classRef = $phpcsFile->findNext(array(\T_SELF, \T_PARENT, \T_STATIC), $startToken, $endToken); + + if ($classRef === false || $tokens[$classRef]['code'] !== \T_STATIC) { + return $classRef; + } + + // T_STATIC, make sure it is used as a class reference. + $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($classRef + 1), $endToken, true); + if ($next === false || $tokens[$next]['code'] !== \T_DOUBLE_COLON) { + return false; + } + + return $classRef; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewExceptionsFromToStringSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewExceptionsFromToStringSniff.php new file mode 100644 index 00000000..05648961 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewExceptionsFromToStringSniff.php @@ -0,0 +1,171 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\FunctionDeclarations; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * As of PHP 7.4, throwing exceptions from a `__toString()` method is allowed. + * + * PHP version 7.4 + * + * @link https://wiki.php.net/rfc/tostring_exceptions + * @link https://www.php.net/manual/en/language.oop5.magic.php#object.tostring + * + * @since 9.2.0 + */ +class NewExceptionsFromToStringSniff extends Sniff +{ + + /** + * Valid scopes for the __toString() method to live in. + * + * @since 9.2.0 + * @since 9.3.0 Visibility changed from `public` to `protected`. + * + * @var array + */ + protected $ooScopeTokens = array( + 'T_CLASS' => true, + 'T_TRAIT' => true, + 'T_ANON_CLASS' => true, + ); + + /** + * Tokens which should be ignored when they preface a function declaration + * when trying to find the docblock (if any). + * + * Array will be added to in the register() method. + * + * @since 9.3.0 + * + * @var array + */ + private $docblockIgnoreTokens = array( + \T_WHITESPACE => \T_WHITESPACE, + ); + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 9.2.0 + * + * @return array + */ + public function register() + { + // Enhance the array of tokens to ignore for finding the docblock. + $this->docblockIgnoreTokens += Tokens::$methodPrefixes; + if (isset(Tokens::$phpcsCommentTokens)) { + $this->docblockIgnoreTokens += Tokens::$phpcsCommentTokens; + } + + return array(\T_FUNCTION); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 9.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('7.3') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + if (isset($tokens[$stackPtr]['scope_opener'], $tokens[$stackPtr]['scope_closer']) === false) { + // Abstract function, interface function, live coding or parse error. + return; + } + + $functionName = $phpcsFile->getDeclarationName($stackPtr); + if (strtolower($functionName) !== '__tostring') { + // Not the right function. + return; + } + + if ($this->validDirectScope($phpcsFile, $stackPtr, $this->ooScopeTokens) === false) { + // Function, not method. + return; + } + + /* + * Examine the content of the function. + */ + $error = 'Throwing exceptions from __toString() was not allowed prior to PHP 7.4'; + $throwPtr = $tokens[$stackPtr]['scope_opener']; + $errorThrown = false; + + do { + $throwPtr = $phpcsFile->findNext(\T_THROW, ($throwPtr + 1), $tokens[$stackPtr]['scope_closer']); + if ($throwPtr === false) { + break; + } + + $conditions = $tokens[$throwPtr]['conditions']; + $conditions = array_reverse($conditions, true); + $inTryCatch = false; + foreach ($conditions as $ptr => $type) { + if ($type === \T_TRY) { + $inTryCatch = true; + break; + } + + if ($ptr === $stackPtr) { + // Don't check the conditions outside the function scope. + break; + } + } + + if ($inTryCatch === false) { + $phpcsFile->addError($error, $throwPtr, 'Found'); + $errorThrown = true; + } + } while (true); + + if ($errorThrown === true) { + // We've already thrown an error for this method, no need to examine the docblock. + return; + } + + /* + * Check whether the function has a docblock and if so, whether it contains a @throws tag. + * + * {@internal This can be partially replaced by the findCommentAboveFunction() + * utility function in due time.} + */ + $commentEnd = $phpcsFile->findPrevious($this->docblockIgnoreTokens, ($stackPtr - 1), null, true); + if ($commentEnd === false || $tokens[$commentEnd]['code'] !== \T_DOC_COMMENT_CLOSE_TAG) { + return; + } + + $commentStart = $tokens[$commentEnd]['comment_opener']; + foreach ($tokens[$commentStart]['comment_tags'] as $tag) { + if ($tokens[$tag]['content'] !== '@throws') { + continue; + } + + // Found a throws tag. + $phpcsFile->addError($error, $stackPtr, 'ThrowsTagFoundInDocblock'); + break; + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewNullableTypesSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewNullableTypesSniff.php new file mode 100644 index 00000000..8dc0c416 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewNullableTypesSniff.php @@ -0,0 +1,169 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\FunctionDeclarations; + +use PHPCompatibility\Sniff; +use PHPCompatibility\PHPCSHelper; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Nullable parameter type declarations and return types are available since PHP 7.1. + * + * PHP version 7.1 + * + * @link https://www.php.net/manual/en/migration71.new-features.php#migration71.new-features.nullable-types + * @link https://wiki.php.net/rfc/nullable_types + * @link https://www.php.net/manual/en/functions.arguments.php#example-146 + * + * @since 7.0.7 + */ +class NewNullableTypesSniff extends Sniff +{ + /** + * Returns an array of tokens this test wants to listen for. + * + * {@internal Not sniffing for T_NULLABLE which was introduced in PHPCS 2.7.2 + * as in that case we can't distinguish between parameter type hints and + * return type hints for the error message.} + * + * @since 7.0.7 + * + * @return array + */ + public function register() + { + $tokens = array( + \T_FUNCTION, + \T_CLOSURE, + ); + + if (\defined('T_RETURN_TYPE')) { + $tokens[] = \T_RETURN_TYPE; + } + + return $tokens; + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.7 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('7.0') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $tokenCode = $tokens[$stackPtr]['code']; + + if ($tokenCode === \T_FUNCTION || $tokenCode === \T_CLOSURE) { + $this->processFunctionDeclaration($phpcsFile, $stackPtr); + + // Deal with older PHPCS version which don't recognize return type hints + // as well as newer PHPCS versions (3.3.0+) where the tokenization has changed. + $returnTypeHint = $this->getReturnTypeHintToken($phpcsFile, $stackPtr); + if ($returnTypeHint !== false) { + $this->processReturnType($phpcsFile, $returnTypeHint); + } + } else { + $this->processReturnType($phpcsFile, $stackPtr); + } + } + + + /** + * Process this test for function tokens. + * + * @since 7.0.7 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + protected function processFunctionDeclaration(File $phpcsFile, $stackPtr) + { + $params = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr); + + if (empty($params) === false && \is_array($params)) { + foreach ($params as $param) { + if ($param['nullable_type'] === true) { + $phpcsFile->addError( + 'Nullable type declarations are not supported in PHP 7.0 or earlier. Found: %s', + $param['token'], + 'typeDeclarationFound', + array($param['type_hint']) + ); + } + } + } + } + + + /** + * Process this test for return type tokens. + * + * @since 7.0.7 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + protected function processReturnType(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + if (isset($tokens[($stackPtr - 1)]['code']) === false) { + return; + } + + $previous = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); + + // Deal with namespaced class names. + if ($tokens[$previous]['code'] === \T_NS_SEPARATOR) { + $validTokens = Tokens::$emptyTokens; + $validTokens[\T_STRING] = true; + $validTokens[\T_NS_SEPARATOR] = true; + + $stackPtr--; + + while (isset($validTokens[$tokens[($stackPtr - 1)]['code']]) === true) { + $stackPtr--; + } + + $previous = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); + } + + // T_NULLABLE token was introduced in PHPCS 2.7.2. Before that it identified as T_INLINE_THEN. + if ((\defined('T_NULLABLE') === true && $tokens[$previous]['type'] === 'T_NULLABLE') + || (\defined('T_NULLABLE') === false && $tokens[$previous]['code'] === \T_INLINE_THEN) + ) { + $phpcsFile->addError( + 'Nullable return types are not supported in PHP 7.0 or earlier.', + $stackPtr, + 'returnTypeFound' + ); + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewParamTypeDeclarationsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewParamTypeDeclarationsSniff.php new file mode 100644 index 00000000..6ad98b6a --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewParamTypeDeclarationsSniff.php @@ -0,0 +1,237 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\FunctionDeclarations; + +use PHPCompatibility\AbstractNewFeatureSniff; +use PHPCompatibility\PHPCSHelper; +use PHP_CodeSniffer_File as File; + +/** + * Detect and verify the use of parameter type declarations in function declarations. + * + * Parameter type declarations - class/interface names only - is available since PHP 5.0. + * - Since PHP 5.1, the `array` keyword can be used. + * - Since PHP 5.2, `self` and `parent` can be used. Previously, those were interpreted as + * class names. + * - Since PHP 5.4, the `callable` keyword. + * - Since PHP 7.0, scalar type declarations are available. + * - Since PHP 7.1, the `iterable` pseudo-type is available. + * - Since PHP 7.2, the generic `object` type is available. + * + * Additionally, this sniff does a cursory check for typical invalid type declarations, + * such as: + * - `boolean` (should be `bool`), `integer` (should be `int`) and `static`. + * - `self`/`parent` as type declaration used outside class context throws a fatal error since PHP 7.0. + * + * PHP version 5.0+ + * + * @link https://www.php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration + * @link https://wiki.php.net/rfc/callable + * @link https://wiki.php.net/rfc/scalar_type_hints_v5 + * @link https://wiki.php.net/rfc/iterable + * @link https://wiki.php.net/rfc/object-typehint + * + * @since 7.0.0 + * @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class. + * @since 9.0.0 Renamed from `NewScalarTypeDeclarationsSniff` to `NewParamTypeDeclarationsSniff`. + */ +class NewParamTypeDeclarationsSniff extends AbstractNewFeatureSniff +{ + + /** + * A list of new types. + * + * The array lists : version number with false (not present) or true (present). + * If's sufficient to list the first version where the keyword appears. + * + * @since 7.0.0 + * @since 7.0.3 Now lists all param type declarations, not just the PHP 7+ scalar ones. + * + * @var array(string => array(string => bool)) + */ + protected $newTypes = array( + 'array' => array( + '5.0' => false, + '5.1' => true, + ), + 'self' => array( + '5.1' => false, + '5.2' => true, + ), + 'parent' => array( + '5.1' => false, + '5.2' => true, + ), + 'callable' => array( + '5.3' => false, + '5.4' => true, + ), + 'int' => array( + '5.6' => false, + '7.0' => true, + ), + 'float' => array( + '5.6' => false, + '7.0' => true, + ), + 'bool' => array( + '5.6' => false, + '7.0' => true, + ), + 'string' => array( + '5.6' => false, + '7.0' => true, + ), + 'iterable' => array( + '7.0' => false, + '7.1' => true, + ), + 'object' => array( + '7.1' => false, + '7.2' => true, + ), + ); + + + /** + * Invalid types + * + * The array lists : the invalid type hint => what was probably intended/alternative. + * + * @since 7.0.3 + * + * @var array(string => string) + */ + protected $invalidTypes = array( + 'static' => 'self', + 'boolean' => 'bool', + 'integer' => 'int', + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.0 + * @since 7.1.3 Now also checks closures. + * + * @return array + */ + public function register() + { + return array( + \T_FUNCTION, + \T_CLOSURE, + ); + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.0 + * @since 7.0.3 - Added check for non-scalar type declarations. + * - Added check for invalid type declarations. + * - Added check for usage of `self` type declaration outside + * class scope. + * @since 8.2.0 Added check for `parent` type declaration outside class scope. + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + // Get all parameters from method signature. + $paramNames = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr); + if (empty($paramNames)) { + return; + } + + $supportsPHP4 = $this->supportsBelow('4.4'); + + foreach ($paramNames as $param) { + if ($param['type_hint'] === '') { + continue; + } + + // Strip off potential nullable indication. + $typeHint = ltrim($param['type_hint'], '?'); + + if ($supportsPHP4 === true) { + $phpcsFile->addError( + 'Type declarations were not present in PHP 4.4 or earlier.', + $param['token'], + 'TypeHintFound' + ); + + } elseif (isset($this->newTypes[$typeHint])) { + $itemInfo = array( + 'name' => $typeHint, + ); + $this->handleFeature($phpcsFile, $param['token'], $itemInfo); + + // As of PHP 7.0, using `self` or `parent` outside class scope throws a fatal error. + // Only throw this error for PHP 5.2+ as before that the "type hint not supported" error + // will be thrown. + if (($typeHint === 'self' || $typeHint === 'parent') + && $this->inClassScope($phpcsFile, $stackPtr, false) === false + && $this->supportsAbove('5.2') !== false + ) { + $phpcsFile->addError( + "'%s' type cannot be used outside of class scope", + $param['token'], + ucfirst($typeHint) . 'OutsideClassScopeFound', + array($typeHint) + ); + } + } elseif (isset($this->invalidTypes[$typeHint])) { + $error = "'%s' is not a valid type declaration. Did you mean %s ?"; + $data = array( + $typeHint, + $this->invalidTypes[$typeHint], + ); + + $phpcsFile->addError($error, $param['token'], 'InvalidTypeHintFound', $data); + } + } + } + + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 7.1.0 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo) + { + return $this->newTypes[$itemInfo['name']]; + } + + + /** + * Get the error message template for this sniff. + * + * @since 7.1.0 + * + * @return string + */ + protected function getErrorMsgTemplate() + { + return "'%s' type declaration is not present in PHP version %s or earlier"; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewReturnTypeDeclarationsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewReturnTypeDeclarationsSniff.php new file mode 100644 index 00000000..3e225616 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewReturnTypeDeclarationsSniff.php @@ -0,0 +1,194 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\FunctionDeclarations; + +use PHPCompatibility\AbstractNewFeatureSniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect and verify the use of return type declarations in function declarations. + * + * Return type declarations are available since PHP 7.0. + * - Since PHP 7.1, the `iterable` and `void` pseudo-types are available. + * - Since PHP 7.2, the generic `object` type is available. + * + * PHP version 7.0+ + * + * @link https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.return-type-declarations + * @link https://www.php.net/manual/en/functions.returning-values.php#functions.returning-values.type-declaration + * @link https://wiki.php.net/rfc/return_types + * @link https://wiki.php.net/rfc/iterable + * @link https://wiki.php.net/rfc/void_return_type + * @link https://wiki.php.net/rfc/object-typehint + * + * @since 7.0.0 + * @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class. + * @since 7.1.2 Renamed from `NewScalarReturnTypeDeclarationsSniff` to `NewReturnTypeDeclarationsSniff`. + */ +class NewReturnTypeDeclarationsSniff extends AbstractNewFeatureSniff +{ + + /** + * A list of new types + * + * The array lists : version number with false (not present) or true (present). + * If's sufficient to list the first version where the keyword appears. + * + * @since 7.0.0 + * + * @var array(string => array(string => bool)) + */ + protected $newTypes = array( + 'int' => array( + '5.6' => false, + '7.0' => true, + ), + 'float' => array( + '5.6' => false, + '7.0' => true, + ), + 'bool' => array( + '5.6' => false, + '7.0' => true, + ), + 'string' => array( + '5.6' => false, + '7.0' => true, + ), + 'array' => array( + '5.6' => false, + '7.0' => true, + ), + 'callable' => array( + '5.6' => false, + '7.0' => true, + ), + 'parent' => array( + '5.6' => false, + '7.0' => true, + ), + 'self' => array( + '5.6' => false, + '7.0' => true, + ), + 'Class name' => array( + '5.6' => false, + '7.0' => true, + ), + + 'iterable' => array( + '7.0' => false, + '7.1' => true, + ), + 'void' => array( + '7.0' => false, + '7.1' => true, + ), + + 'object' => array( + '7.1' => false, + '7.2' => true, + ), + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.0 + * @since 7.1.2 Now also checks based on the function and closure keywords. + * + * @return array + */ + public function register() + { + $tokens = array( + \T_FUNCTION, + \T_CLOSURE, + ); + + if (\defined('T_RETURN_TYPE')) { + $tokens[] = \T_RETURN_TYPE; + } + + return $tokens; + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + // Deal with older PHPCS version which don't recognize return type hints + // as well as newer PHPCS versions (3.3.0+) where the tokenization has changed. + if ($tokens[$stackPtr]['code'] === \T_FUNCTION || $tokens[$stackPtr]['code'] === \T_CLOSURE) { + $returnTypeHint = $this->getReturnTypeHintToken($phpcsFile, $stackPtr); + if ($returnTypeHint !== false) { + $stackPtr = $returnTypeHint; + } + } + + if (isset($this->newTypes[$tokens[$stackPtr]['content']]) === true) { + $itemInfo = array( + 'name' => $tokens[$stackPtr]['content'], + ); + $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); + } + // Handle class name based return types. + elseif ($tokens[$stackPtr]['code'] === \T_STRING + || (\defined('T_RETURN_TYPE') && $tokens[$stackPtr]['code'] === \T_RETURN_TYPE) + ) { + $itemInfo = array( + 'name' => 'Class name', + ); + $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); + } + } + + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 7.1.0 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo) + { + return $this->newTypes[$itemInfo['name']]; + } + + + /** + * Get the error message template for this sniff. + * + * @since 7.1.0 + * + * @return string + */ + protected function getErrorMsgTemplate() + { + return '%s return type is not present in PHP version %s or earlier'; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NonStaticMagicMethodsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NonStaticMagicMethodsSniff.php new file mode 100644 index 00000000..a86d56ef --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NonStaticMagicMethodsSniff.php @@ -0,0 +1,216 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\FunctionDeclarations; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; + +/** + * Verifies the use of the correct visibility and static properties of magic methods. + * + * The requirements have always existed, but as of PHP 5.3, a warning will be thrown + * when magic methods have the wrong modifiers. + * + * PHP version 5.3 + * + * @link https://www.php.net/manual/en/language.oop5.magic.php + * + * @since 5.5 + * @since 5.6 Now extends the base `Sniff` class. + */ +class NonStaticMagicMethodsSniff extends Sniff +{ + + /** + * A list of PHP magic methods and their visibility and static requirements. + * + * Method names in the array should be all *lowercase*. + * Visibility can be either 'public', 'protected' or 'private'. + * Static can be either 'true' - *must* be static, or 'false' - *must* be non-static. + * When a method does not have a specific requirement for either visibility or static, + * do *not* add the key. + * + * @since 5.5 + * @since 5.6 The array format has changed to allow the sniff to also verify the + * use of the correct visibility for a magic method. + * + * @var array(string) + */ + protected $magicMethods = array( + '__construct' => array( + 'static' => false, + ), + '__destruct' => array( + 'visibility' => 'public', + 'static' => false, + ), + '__clone' => array( + 'static' => false, + ), + '__get' => array( + 'visibility' => 'public', + 'static' => false, + ), + '__set' => array( + 'visibility' => 'public', + 'static' => false, + ), + '__isset' => array( + 'visibility' => 'public', + 'static' => false, + ), + '__unset' => array( + 'visibility' => 'public', + 'static' => false, + ), + '__call' => array( + 'visibility' => 'public', + 'static' => false, + ), + '__callstatic' => array( + 'visibility' => 'public', + 'static' => true, + ), + '__sleep' => array( + 'visibility' => 'public', + ), + '__tostring' => array( + 'visibility' => 'public', + ), + '__set_state' => array( + 'visibility' => 'public', + 'static' => true, + ), + '__debuginfo' => array( + 'visibility' => 'public', + 'static' => false, + ), + '__invoke' => array( + 'visibility' => 'public', + 'static' => false, + ), + '__serialize' => array( + 'visibility' => 'public', + 'static' => false, + ), + '__unserialize' => array( + 'visibility' => 'public', + 'static' => false, + ), + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 5.5 + * @since 5.6 Now also checks traits. + * @since 7.1.4 Now also checks anonymous classes. + * + * @return array + */ + public function register() + { + $targets = array( + \T_CLASS, + \T_INTERFACE, + \T_TRAIT, + ); + + if (\defined('T_ANON_CLASS')) { + $targets[] = \T_ANON_CLASS; + } + + return $targets; + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 5.5 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + // Should be removed, the requirement was previously also there, 5.3 just started throwing a warning about it. + if ($this->supportsAbove('5.3') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + if (isset($tokens[$stackPtr]['scope_closer']) === false) { + return; + } + + $classScopeCloser = $tokens[$stackPtr]['scope_closer']; + $functionPtr = $stackPtr; + + // Find all the functions in this class or interface. + while (($functionToken = $phpcsFile->findNext(\T_FUNCTION, $functionPtr, $classScopeCloser)) !== false) { + /* + * Get the scope closer for this function in order to know how + * to advance to the next function. + * If no body of function (e.g. for interfaces), there is + * no closing curly brace; advance the pointer differently. + */ + if (isset($tokens[$functionToken]['scope_closer'])) { + $scopeCloser = $tokens[$functionToken]['scope_closer']; + } else { + $scopeCloser = ($functionToken + 1); + } + + $methodName = $phpcsFile->getDeclarationName($functionToken); + $methodNameLc = strtolower($methodName); + if (isset($this->magicMethods[$methodNameLc]) === false) { + $functionPtr = $scopeCloser; + continue; + } + + $methodProperties = $phpcsFile->getMethodProperties($functionToken); + $errorCodeBase = $this->stringToErrorCode($methodNameLc); + + if (isset($this->magicMethods[$methodNameLc]['visibility']) && $this->magicMethods[$methodNameLc]['visibility'] !== $methodProperties['scope']) { + $error = 'Visibility for magic method %s must be %s. Found: %s'; + $errorCode = $errorCodeBase . 'MethodVisibility'; + $data = array( + $methodName, + $this->magicMethods[$methodNameLc]['visibility'], + $methodProperties['scope'], + ); + + $phpcsFile->addError($error, $functionToken, $errorCode, $data); + } + + if (isset($this->magicMethods[$methodNameLc]['static']) && $this->magicMethods[$methodNameLc]['static'] !== $methodProperties['is_static']) { + $error = 'Magic method %s cannot be defined as static.'; + $errorCode = $errorCodeBase . 'MethodStatic'; + $data = array($methodName); + + if ($this->magicMethods[$methodNameLc]['static'] === true) { + $error = 'Magic method %s must be defined as static.'; + $errorCode = $errorCodeBase . 'MethodNonStatic'; + } + + $phpcsFile->addError($error, $functionToken, $errorCode, $data); + } + + // Advance to next function. + $functionPtr = $scopeCloser; + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/NewMagicMethodsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/NewMagicMethodsSniff.php new file mode 100644 index 00000000..4dc08f88 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/NewMagicMethodsSniff.php @@ -0,0 +1,231 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\FunctionNameRestrictions; + +use PHPCompatibility\AbstractNewFeatureSniff; +use PHP_CodeSniffer_File as File; + +/** + * Warns for non-magic behaviour of magic methods prior to becoming magic. + * + * PHP version 5.0+ + * + * @link https://www.php.net/manual/en/language.oop5.magic.php + * @link https://wiki.php.net/rfc/closures#additional_goodyinvoke + * @link https://wiki.php.net/rfc/debug-info + * + * @since 7.0.4 + * @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class. + */ +class NewMagicMethodsSniff extends AbstractNewFeatureSniff +{ + + /** + * A list of new magic methods, not considered magic in older versions. + * + * Method names in the array should be all *lowercase*. + * The array lists : version number with false (not magic) or true (magic). + * If's sufficient to list the first version where the method became magic. + * + * @since 7.0.4 + * + * @var array(string => array(string => bool|string)) + */ + protected $newMagicMethods = array( + '__construct' => array( + '4.4' => false, + '5.0' => true, + ), + '__destruct' => array( + '4.4' => false, + '5.0' => true, + ), + '__get' => array( + '4.4' => false, + '5.0' => true, + ), + + '__isset' => array( + '5.0' => false, + '5.1' => true, + ), + '__unset' => array( + '5.0' => false, + '5.1' => true, + ), + '__set_state' => array( + '5.0' => false, + '5.1' => true, + ), + + '__callstatic' => array( + '5.2' => false, + '5.3' => true, + ), + '__invoke' => array( + '5.2' => false, + '5.3' => true, + ), + + '__debuginfo' => array( + '5.5' => false, + '5.6' => true, + ), + + // Special case - only became properly magical in 5.2.0, + // before that it was only called for echo and print. + '__tostring' => array( + '5.1' => false, + '5.2' => true, + 'message' => 'The method %s() was not truly magical in PHP version %s and earlier. The associated magic functionality will only be called when directly combined with echo or print.', + ), + + '__serialize' => array( + '7.3' => false, + '7.4' => true, + ), + '__unserialize' => array( + '7.3' => false, + '7.4' => true, + ), + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.4 + * + * @return array + */ + public function register() + { + return array(\T_FUNCTION); + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.4 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $functionName = $phpcsFile->getDeclarationName($stackPtr); + $functionNameLc = strtolower($functionName); + + if (isset($this->newMagicMethods[$functionNameLc]) === false) { + return; + } + + if ($this->inClassScope($phpcsFile, $stackPtr, false) === false) { + return; + } + + $itemInfo = array( + 'name' => $functionName, + 'nameLc' => $functionNameLc, + ); + $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); + } + + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 7.1.0 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo) + { + return $this->newMagicMethods[$itemInfo['nameLc']]; + } + + + /** + * Get an array of the non-PHP-version array keys used in a sub-array. + * + * @since 7.1.0 + * + * @return array + */ + protected function getNonVersionArrayKeys() + { + return array('message'); + } + + + /** + * Retrieve the relevant detail (version) information for use in an error message. + * + * @since 7.1.0 + * + * @param array $itemArray Version and other information about the item. + * @param array $itemInfo Base information about the item. + * + * @return array + */ + public function getErrorInfo(array $itemArray, array $itemInfo) + { + $errorInfo = parent::getErrorInfo($itemArray, $itemInfo); + $errorInfo['error'] = false; // Warning, not error. + $errorInfo['message'] = ''; + + if (empty($itemArray['message']) === false) { + $errorInfo['message'] = $itemArray['message']; + } + + return $errorInfo; + } + + + /** + * Get the error message template for this sniff. + * + * @since 7.1.0 + * + * @return string + */ + protected function getErrorMsgTemplate() + { + return 'The method %s() was not magical in PHP version %s and earlier. The associated magic functionality will not be invoked.'; + } + + + /** + * Allow for concrete child classes to filter the error message before it's passed to PHPCS. + * + * @since 7.1.0 + * + * @param string $error The error message which was created. + * @param array $itemInfo Base information about the item this error message applies to. + * @param array $errorInfo Detail information about an item this error message applies to. + * + * @return string + */ + protected function filterErrorMsg($error, array $itemInfo, array $errorInfo) + { + if ($errorInfo['message'] !== '') { + $error = $errorInfo['message']; + } + + return $error; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/RemovedMagicAutoloadSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/RemovedMagicAutoloadSniff.php new file mode 100644 index 00000000..0ea5b0d6 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/RemovedMagicAutoloadSniff.php @@ -0,0 +1,92 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\FunctionNameRestrictions; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect declaration of the magic `__autoload()` method. + * + * This method has been deprecated in PHP 7.2 in favour of `spl_autoload_register()`. + * + * PHP version 7.2 + * + * @link https://www.php.net/manual/en/migration72.deprecated.php#migration72.deprecated.__autoload-method + * @link https://wiki.php.net/rfc/deprecations_php_7_2#autoload + * @link https://www.php.net/manual/en/function.autoload.php + * + * @since 8.1.0 + * @since 9.0.0 Renamed from `DeprecatedMagicAutoloadSniff` to `RemovedMagicAutoloadSniff`. + */ +class RemovedMagicAutoloadSniff extends Sniff +{ + /** + * Scopes to look for when testing using validDirectScope. + * + * @since 8.1.0 + * + * @var array + */ + private $checkForScopes = array( + 'T_CLASS' => true, + 'T_ANON_CLASS' => true, + 'T_INTERFACE' => true, + 'T_TRAIT' => true, + 'T_NAMESPACE' => true, + ); + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 8.1.0 + * + * @return array + */ + public function register() + { + return array(\T_FUNCTION); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 8.1.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('7.2') === false) { + return; + } + + $funcName = $phpcsFile->getDeclarationName($stackPtr); + + if (strtolower($funcName) !== '__autoload') { + return; + } + + if ($this->validDirectScope($phpcsFile, $stackPtr, $this->checkForScopes) !== false) { + return; + } + + if ($this->determineNamespace($phpcsFile, $stackPtr) !== '') { + return; + } + + $phpcsFile->addWarning('Use of __autoload() function is deprecated since PHP 7.2', $stackPtr, 'Found'); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/RemovedNamespacedAssertSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/RemovedNamespacedAssertSniff.php new file mode 100644 index 00000000..3c3feadc --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/RemovedNamespacedAssertSniff.php @@ -0,0 +1,101 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\FunctionNameRestrictions; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect declaration of a namespaced function called `assert()`. + * + * As of PHP 7.3, a compile-time deprecation warning will be thrown when a function + * called `assert()` is declared. In PHP 8 this will become a compile-error. + * + * Methods are unaffected. + * Global, non-namespaced, `assert()` function declarations were always a fatal + * "function already declared" error, so not the concern of this sniff. + * + * PHP version 7.3 + * + * @link https://www.php.net/manual/en/migration73.deprecated.php#migration73.deprecated.core.assert + * @link https://wiki.php.net/rfc/deprecations_php_7_3#defining_a_free-standing_assert_function + * @link https://www.php.net/manual/en/function.assert.php + * + * @since 9.0.0 + */ +class RemovedNamespacedAssertSniff extends Sniff +{ + /** + * Scopes in which an `assert` function can be declared without issue. + * + * @since 9.0.0 + * + * @var array + */ + private $scopes = array( + \T_CLASS, + \T_INTERFACE, + \T_TRAIT, + \T_CLOSURE, + ); + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 9.0.0 + * + * @return array + */ + public function register() + { + // Enrich the scopes list. + if (\defined('T_ANON_CLASS')) { + $this->scopes[] = \T_ANON_CLASS; + } + + return array(\T_FUNCTION); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 9.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('7.3') === false) { + return; + } + + $funcName = $phpcsFile->getDeclarationName($stackPtr); + + if (strtolower($funcName) !== 'assert') { + return; + } + + if ($phpcsFile->hasCondition($stackPtr, $this->scopes) === true) { + return; + } + + if ($this->determineNamespace($phpcsFile, $stackPtr) === '') { + // Not a namespaced function declaration. This may be a parse error, but not our concern. + return; + } + + $phpcsFile->addWarning('Declaring a free-standing function called assert() is deprecated since PHP 7.3.', $stackPtr, 'Found'); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/RemovedPHP4StyleConstructorsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/RemovedPHP4StyleConstructorsSniff.php new file mode 100644 index 00000000..a888f51d --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/RemovedPHP4StyleConstructorsSniff.php @@ -0,0 +1,158 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\FunctionNameRestrictions; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect declarations of PHP 4 style constructors which are deprecated as of PHP 7.0.0. + * + * PHP 4 style constructors - methods that have the same name as the class they are defined in - + * are deprecated as of PHP 7.0.0, and will be removed in the future. + * PHP 7 will emit `E_DEPRECATED` if a PHP 4 constructor is the only constructor defined + * within a class. Classes that implement a `__construct()` method are unaffected. + * + * Note: Methods with the same name as the class they are defined in _within a namespace_ + * are not recognized as constructors anyway and therefore outside the scope of this sniff. + * + * PHP version 7.0 + * + * @link https://www.php.net/manual/en/migration70.deprecated.php#migration70.deprecated.php4-constructors + * @link https://wiki.php.net/rfc/remove_php4_constructors + * @link https://www.php.net/manual/en/language.oop5.decon.php + * + * @since 7.0.0 + * @since 7.0.8 This sniff now throws a warning instead of an error as the functionality is + * only deprecated (for now). + * @since 9.0.0 Renamed from `DeprecatedPHP4StyleConstructorsSniff` to `RemovedPHP4StyleConstructorsSniff`. + */ +class RemovedPHP4StyleConstructorsSniff extends Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.0 + * + * @return array + */ + public function register() + { + return array( + \T_CLASS, + ); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.0 + * @since 7.0.8 The message is downgraded from error to warning as - for now - support + * for PHP4-style constructors is just deprecated, not yet removed. + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('7.0') === false) { + return; + } + + if ($this->determineNamespace($phpcsFile, $stackPtr) !== '') { + /* + * Namespaced methods with the same name as the class are treated as + * regular methods, so we can bow out if we're in a namespace. + * + * Note: the exception to this is PHP 5.3.0-5.3.2. This is currently + * not dealt with. + */ + return; + } + + $tokens = $phpcsFile->getTokens(); + + $class = $tokens[$stackPtr]; + + if (isset($class['scope_closer']) === false) { + return; + } + + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== \T_STRING) { + // Anonymous class in combination with PHPCS 2.3.x. + return; + } + + $scopeCloser = $class['scope_closer']; + $className = $tokens[$nextNonEmpty]['content']; + + if (empty($className) || \is_string($className) === false) { + return; + } + + $nextFunc = $stackPtr; + $classNameLc = strtolower($className); + $newConstructorFound = false; + $oldConstructorFound = false; + $oldConstructorPos = -1; + while (($nextFunc = $phpcsFile->findNext(array(\T_FUNCTION, \T_DOC_COMMENT_OPEN_TAG), ($nextFunc + 1), $scopeCloser)) !== false) { + // Skip over docblocks. + if ($tokens[$nextFunc]['code'] === \T_DOC_COMMENT_OPEN_TAG) { + $nextFunc = $tokens[$nextFunc]['comment_closer']; + continue; + } + + $functionScopeCloser = $nextFunc; + if (isset($tokens[$nextFunc]['scope_closer'])) { + // Normal (non-interface, non-abstract) method. + $functionScopeCloser = $tokens[$nextFunc]['scope_closer']; + } + + $funcName = $phpcsFile->getDeclarationName($nextFunc); + if (empty($funcName) || \is_string($funcName) === false) { + $nextFunc = $functionScopeCloser; + continue; + } + + $funcNameLc = strtolower($funcName); + + if ($funcNameLc === '__construct') { + $newConstructorFound = true; + } + + if ($funcNameLc === $classNameLc) { + $oldConstructorFound = true; + $oldConstructorPos = $nextFunc; + } + + // If both have been found, no need to continue looping through the functions. + if ($newConstructorFound === true && $oldConstructorFound === true) { + break; + } + + $nextFunc = $functionScopeCloser; + } + + if ($newConstructorFound === false && $oldConstructorFound === true) { + $phpcsFile->addWarning( + 'Use of deprecated PHP4 style class constructor is not supported since PHP 7.', + $oldConstructorPos, + 'Found' + ); + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/ReservedFunctionNamesSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/ReservedFunctionNamesSniff.php new file mode 100644 index 00000000..9ddb9e96 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/ReservedFunctionNamesSniff.php @@ -0,0 +1,205 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\FunctionNameRestrictions; + +use Generic_Sniffs_NamingConventions_CamelCapsFunctionNameSniff as PHPCS_CamelCapsFunctionNameSniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Standards_AbstractScopeSniff as PHPCS_AbstractScopeSniff; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * All function and method names starting with double underscore are reserved by PHP. + * + * PHP version All + * + * {@internal Extends an upstream sniff to benefit from the properties contained therein. + * The properties are lists of valid PHP magic function and method names, which + * should be ignored for the purposes of this sniff. + * As this sniff is not PHP version specific, we don't need access to the utility + * methods in the PHPCompatibility\Sniff, so extending the upstream sniff is fine. + * As the upstream sniff checks the same (and more, but we don't need the rest), + * the logic in this sniff is largely the same as used upstream. + * Extending the upstream sniff instead of including it via the ruleset, however, + * prevents hard to debug issues of errors not being reported from the upstream sniff + * if this library is used in combination with other rulesets.} + * + * @link https://www.php.net/manual/en/language.oop5.magic.php + * + * @since 8.2.0 This was previously, since 7.0.3, checked by the upstream sniff. + * @since 9.3.2 The sniff will now ignore functions marked as `@deprecated` by design. + */ +class ReservedFunctionNamesSniff extends PHPCS_CamelCapsFunctionNameSniff +{ + + /** + * Overload the constructor to work round various PHPCS cross-version compatibility issues. + * + * @since 8.2.0 + */ + public function __construct() + { + $scopeTokens = array(\T_CLASS, \T_INTERFACE, \T_TRAIT); + if (\defined('T_ANON_CLASS')) { + $scopeTokens[] = \T_ANON_CLASS; + } + + // Call the grand-parent constructor directly. + PHPCS_AbstractScopeSniff::__construct($scopeTokens, array(\T_FUNCTION), true); + + // Make sure debuginfo is included in the array. Upstream only includes it since 2.5.1. + $this->magicMethods['debuginfo'] = true; + } + + + /** + * Processes the tokens within the scope. + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being processed. + * @param int $stackPtr The position where this token was + * found. + * @param int $currScope The position of the current scope. + * + * @return void + */ + protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope) + { + $tokens = $phpcsFile->getTokens(); + + /* + * Determine if this is a function which needs to be examined. + * The `processTokenWithinScope()` is called for each valid scope a method is in, + * so for nested classes, we need to make sure we only examine the token for + * the lowest level valid scope. + */ + $conditions = $tokens[$stackPtr]['conditions']; + end($conditions); + $deepestScope = key($conditions); + if ($deepestScope !== $currScope) { + return; + } + + if ($this->isFunctionDeprecated($phpcsFile, $stackPtr) === true) { + /* + * Deprecated functions don't have to comply with the naming conventions, + * otherwise functions deprecated in favour of a function with a compliant + * name would still trigger an error. + */ + return; + } + + $methodName = $phpcsFile->getDeclarationName($stackPtr); + if ($methodName === null) { + // Ignore closures. + return; + } + + // Is this a magic method. i.e., is prefixed with "__" ? + if (preg_match('|^__[^_]|', $methodName) > 0) { + $magicPart = strtolower(substr($methodName, 2)); + if (isset($this->magicMethods[$magicPart]) === false + && isset($this->methodsDoubleUnderscore[$magicPart]) === false + ) { + $className = '[anonymous class]'; + $scopeNextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($currScope + 1), null, true); + if ($scopeNextNonEmpty !== false && $tokens[$scopeNextNonEmpty]['code'] === \T_STRING) { + $className = $tokens[$scopeNextNonEmpty]['content']; + } + + $phpcsFile->addWarning( + 'Method name "%s" is discouraged; PHP has reserved all method names with a double underscore prefix for future use.', + $stackPtr, + 'MethodDoubleUnderscore', + array($className . '::' . $methodName) + ); + } + } + } + + + /** + * Processes the tokens outside the scope. + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being processed. + * @param int $stackPtr The position where this token was + * found. + * + * @return void + */ + protected function processTokenOutsideScope(File $phpcsFile, $stackPtr) + { + if ($this->isFunctionDeprecated($phpcsFile, $stackPtr) === true) { + /* + * Deprecated functions don't have to comply with the naming conventions, + * otherwise functions deprecated in favour of a function with a compliant + * name would still trigger an error. + */ + return; + } + + $functionName = $phpcsFile->getDeclarationName($stackPtr); + if ($functionName === null) { + // Ignore closures. + return; + } + + // Is this a magic function. i.e., it is prefixed with "__". + if (preg_match('|^__[^_]|', $functionName) > 0) { + $magicPart = strtolower(substr($functionName, 2)); + if (isset($this->magicFunctions[$magicPart]) === false) { + $phpcsFile->addWarning( + 'Function name "%s" is discouraged; PHP has reserved all method names with a double underscore prefix for future use.', + $stackPtr, + 'FunctionDoubleUnderscore', + array($functionName) + ); + } + } + } + + + /** + * Check whether a function has been marked as deprecated via a @deprecated tag + * in the function docblock. + * + * @since 9.3.2 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of a T_FUNCTION + * token in the stack. + * + * @return bool + */ + private function isFunctionDeprecated(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $find = Tokens::$methodPrefixes; + $find[] = \T_WHITESPACE; + + $commentEnd = $phpcsFile->findPrevious($find, ($stackPtr - 1), null, true); + if ($tokens[$commentEnd]['code'] !== \T_DOC_COMMENT_CLOSE_TAG) { + // Function doesn't have a doc comment or is using the wrong type of comment. + return false; + } + + $commentStart = $tokens[$commentEnd]['comment_opener']; + foreach ($tokens[$commentStart]['comment_tags'] as $tag) { + if ($tokens[$tag]['content'] === '@deprecated') { + return true; + } + } + + return false; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/ArgumentFunctionsReportCurrentValueSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/ArgumentFunctionsReportCurrentValueSniff.php new file mode 100644 index 00000000..4e904dea --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/ArgumentFunctionsReportCurrentValueSniff.php @@ -0,0 +1,455 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\FunctionUse; + +use PHPCompatibility\Sniff; +use PHPCompatibility\PHPCSHelper; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Functions inspecting function arguments report the current parameter value + * instead of the original since PHP 7.0. + * + * `func_get_arg()`, `func_get_args()`, `debug_backtrace()` and exception backtraces + * will no longer report the original parameter value as was passed to the function, + * but will instead provide the current value (which might have been modified). + * + * PHP version 7.0 + * + * @link https://www.php.net/manual/en/migration70.incompatible.php#migration70.incompatible.other.func-parameter-modified + * + * @since 9.1.0 + */ +class ArgumentFunctionsReportCurrentValueSniff extends Sniff +{ + + /** + * A list of functions that, when called, can behave differently in PHP 7 + * when dealing with parameters of the function they're called in. + * + * @since 9.1.0 + * + * @var array + */ + protected $changedFunctions = array( + 'func_get_arg' => true, + 'func_get_args' => true, + 'debug_backtrace' => true, + 'debug_print_backtrace' => true, + ); + + /** + * Tokens to look out for to allow us to skip past nested scoped structures. + * + * @since 9.1.0 + * + * @var array + */ + private $skipPastNested = array( + 'T_CLASS' => true, + 'T_ANON_CLASS' => true, + 'T_INTERFACE' => true, + 'T_TRAIT' => true, + 'T_FUNCTION' => true, + 'T_CLOSURE' => true, + ); + + /** + * List of tokens which when they preceed a T_STRING *within a function* indicate + * this is not a call to a PHP native function. + * + * This list already takes into account that nested scoped structures are being + * skipped over, so doesn't check for those again. + * Similarly, as constants won't have parentheses, those don't need to be checked + * for either. + * + * @since 9.1.0 + * + * @var array + */ + private $noneFunctionCallIndicators = array( + \T_DOUBLE_COLON => true, + \T_OBJECT_OPERATOR => true, + ); + + /** + * The tokens for variable incrementing/decrementing. + * + * @since 9.1.0 + * + * @var array + */ + private $plusPlusMinusMinus = array( + \T_DEC => true, + \T_INC => true, + ); + + /** + * Tokens to ignore when determining the start of a statement. + * + * @since 9.1.0 + * + * @var array + */ + private $ignoreForStartOfStatement = array( + \T_COMMA, + \T_DOUBLE_ARROW, + \T_OPEN_SQUARE_BRACKET, + \T_OPEN_PARENTHESIS, + ); + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 9.1.0 + * + * @return array + */ + public function register() + { + return array( + \T_FUNCTION, + \T_CLOSURE, + ); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 9.1.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('7.0') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + if (isset($tokens[$stackPtr]['scope_opener'], $tokens[$stackPtr]['scope_closer']) === false) { + // Abstract function, interface function, live coding or parse error. + return; + } + + $scopeOpener = $tokens[$stackPtr]['scope_opener']; + $scopeCloser = $tokens[$stackPtr]['scope_closer']; + + // Does the function declaration have parameters ? + $params = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr); + if (empty($params)) { + // No named arguments found, so no risk of them being changed. + return; + } + + $paramNames = array(); + foreach ($params as $param) { + $paramNames[] = $param['name']; + } + + for ($i = ($scopeOpener + 1); $i < $scopeCloser; $i++) { + if (isset($this->skipPastNested[$tokens[$i]['type']]) && isset($tokens[$i]['scope_closer'])) { + // Skip past nested structures. + $i = $tokens[$i]['scope_closer']; + continue; + } + + if ($tokens[$i]['code'] !== \T_STRING) { + continue; + } + + $foundFunctionName = strtolower($tokens[$i]['content']); + + if (isset($this->changedFunctions[$foundFunctionName]) === false) { + // Not one of the target functions. + continue; + } + + /* + * Ok, so is this really a function call to one of the PHP native functions ? + */ + $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($i + 1), null, true); + if ($next === false || $tokens[$next]['code'] !== \T_OPEN_PARENTHESIS) { + // Live coding, parse error or not a function call. + continue; + } + + $prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($i - 1), null, true); + if ($prev !== false) { + if (isset($this->noneFunctionCallIndicators[$tokens[$prev]['code']])) { + continue; + } + + // Check for namespaced functions, ie: \foo\bar() not \bar(). + if ($tokens[ $prev ]['code'] === \T_NS_SEPARATOR) { + $pprev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($prev - 1), null, true); + if ($pprev !== false && $tokens[ $pprev ]['code'] === \T_STRING) { + continue; + } + } + } + + /* + * Address some special cases. + */ + if ($foundFunctionName !== 'func_get_args') { + $paramOne = $this->getFunctionCallParameter($phpcsFile, $i, 1); + if ($paramOne !== false) { + switch ($foundFunctionName) { + /* + * Check if `debug_(print_)backtrace()` is called with the + * `DEBUG_BACKTRACE_IGNORE_ARGS` option. + */ + case 'debug_backtrace': + case 'debug_print_backtrace': + $hasIgnoreArgs = $phpcsFile->findNext( + \T_STRING, + $paramOne['start'], + ($paramOne['end'] + 1), + false, + 'DEBUG_BACKTRACE_IGNORE_ARGS' + ); + + if ($hasIgnoreArgs !== false) { + // Debug_backtrace() called with ignore args option. + continue 2; + } + break; + + /* + * Collect the necessary information to only throw a notice if the argument + * touched/changed is in line with the passed $arg_num. + * + * Also, we can ignore `func_get_arg()` if the argument offset passed is + * higher than the number of named parameters. + * + * {@internal Note: This does not take calculations into account! + * Should be exceptionally rare and can - if needs be - be addressed at a later stage.} + */ + case 'func_get_arg': + $number = $phpcsFile->findNext(\T_LNUMBER, $paramOne['start'], ($paramOne['end'] + 1)); + if ($number !== false) { + $argNumber = $tokens[$number]['content']; + + if (isset($paramNames[$argNumber]) === false) { + // Requesting a non-named additional parameter. Ignore. + continue 2; + } + } + break; + } + } + } else { + /* + * Check if the call to func_get_args() happens to be in an array_slice() or + * array_splice() with an $offset higher than the number of named parameters. + * In that case, we can ignore it. + * + * {@internal Note: This does not take offset calculations into account! + * Should be exceptionally rare and can - if needs be - be addressed at a later stage.} + */ + if ($prev !== false && $tokens[$prev]['code'] === \T_OPEN_PARENTHESIS) { + + $maybeFunctionCall = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($prev - 1), null, true); + if ($maybeFunctionCall !== false + && $tokens[$maybeFunctionCall]['code'] === \T_STRING + && ($tokens[$maybeFunctionCall]['content'] === 'array_slice' + || $tokens[$maybeFunctionCall]['content'] === 'array_splice') + ) { + $parentFuncParamTwo = $this->getFunctionCallParameter($phpcsFile, $maybeFunctionCall, 2); + $number = $phpcsFile->findNext( + \T_LNUMBER, + $parentFuncParamTwo['start'], + ($parentFuncParamTwo['end'] + 1) + ); + + if ($number !== false && isset($paramNames[$tokens[$number]['content']]) === false) { + // Requesting non-named additional parameters. Ignore. + continue ; + } + + // Slice starts at a named argument, but we know which params are being accessed. + $paramNamesSubset = \array_slice($paramNames, $tokens[$number]['content']); + } + } + } + + /* + * For debug_backtrace(), check if the result is being dereferenced and if so, + * whether the `args` index is used. + * I.e. whether `$index` in `debug_backtrace()[$stackFrame][$index]` is a string + * with the content `args`. + * + * Note: We already know that $next is the open parenthesis of the function call. + */ + if ($foundFunctionName === 'debug_backtrace' && isset($tokens[$next]['parenthesis_closer'])) { + $afterParenthesis = $phpcsFile->findNext( + Tokens::$emptyTokens, + ($tokens[$next]['parenthesis_closer'] + 1), + null, + true + ); + + if ($tokens[$afterParenthesis]['code'] === \T_OPEN_SQUARE_BRACKET + && isset($tokens[$afterParenthesis]['bracket_closer']) + ) { + $afterStackFrame = $phpcsFile->findNext( + Tokens::$emptyTokens, + ($tokens[$afterParenthesis]['bracket_closer'] + 1), + null, + true + ); + + if ($tokens[$afterStackFrame]['code'] === \T_OPEN_SQUARE_BRACKET + && isset($tokens[$afterStackFrame]['bracket_closer']) + ) { + $arrayIndex = $phpcsFile->findNext( + \T_CONSTANT_ENCAPSED_STRING, + ($afterStackFrame + 1), + $tokens[$afterStackFrame]['bracket_closer'] + ); + + if ($arrayIndex !== false && $this->stripQuotes($tokens[$arrayIndex]['content']) !== 'args') { + continue; + } + } + } + } + + /* + * Only check for variables before the start of the statement to + * prevent false positives on the return value of the function call + * being assigned to one of the parameters, i.e.: + * `$param = func_get_args();`. + */ + $startOfStatement = PHPCSHelper::findStartOfStatement($phpcsFile, $i, $this->ignoreForStartOfStatement); + + /* + * Ok, so we've found one of the target functions in the right scope. + * Now, let's check if any of the passed parameters were touched. + */ + $scanResult = 'clean'; + for ($j = ($scopeOpener + 1); $j < $startOfStatement; $j++) { + if (isset($this->skipPastNested[$tokens[$j]['type']]) + && isset($tokens[$j]['scope_closer']) + ) { + // Skip past nested structures. + $j = $tokens[$j]['scope_closer']; + continue; + } + + if ($tokens[$j]['code'] !== \T_VARIABLE) { + continue; + } + + if ($foundFunctionName === 'func_get_arg' && isset($argNumber)) { + if (isset($paramNames[$argNumber]) + && $tokens[$j]['content'] !== $paramNames[$argNumber] + ) { + // Different param than the one requested by func_get_arg(). + continue; + } + } elseif ($foundFunctionName === 'func_get_args' && isset($paramNamesSubset)) { + if (\in_array($tokens[$j]['content'], $paramNamesSubset, true) === false) { + // Different param than the ones requested by func_get_args(). + continue; + } + } elseif (\in_array($tokens[$j]['content'], $paramNames, true) === false) { + // Variable is not one of the function parameters. + continue; + } + + /* + * Ok, so we've found a variable which was passed as one of the parameters. + * Now, is this variable being changed, i.e. incremented, decremented or + * assigned something ? + */ + $scanResult = 'warning'; + if (isset($variableToken) === false) { + $variableToken = $j; + } + + $beforeVar = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($j - 1), null, true); + if ($beforeVar !== false && isset($this->plusPlusMinusMinus[$tokens[$beforeVar]['code']])) { + // Variable is being (pre-)incremented/decremented. + $scanResult = 'error'; + $variableToken = $j; + break; + } + + $afterVar = $phpcsFile->findNext(Tokens::$emptyTokens, ($j + 1), null, true); + if ($afterVar === false) { + // Shouldn't be possible, but just in case. + continue; + } + + if (isset($this->plusPlusMinusMinus[$tokens[$afterVar]['code']])) { + // Variable is being (post-)incremented/decremented. + $scanResult = 'error'; + $variableToken = $j; + break; + } + + if ($tokens[$afterVar]['code'] === \T_OPEN_SQUARE_BRACKET + && isset($tokens[$afterVar]['bracket_closer']) + ) { + // Skip past array access on the variable. + while (($afterVar = $phpcsFile->findNext(Tokens::$emptyTokens, ($tokens[$afterVar]['bracket_closer'] + 1), null, true)) !== false) { + if ($tokens[$afterVar]['code'] !== \T_OPEN_SQUARE_BRACKET + || isset($tokens[$afterVar]['bracket_closer']) === false + ) { + break; + } + } + } + + if ($afterVar !== false + && isset(Tokens::$assignmentTokens[$tokens[$afterVar]['code']]) + ) { + // Variable is being assigned something. + $scanResult = 'error'; + $variableToken = $j; + break; + } + } + + unset($argNumber, $paramNamesSubset); + + if ($scanResult === 'clean') { + continue; + } + + $error = 'Since PHP 7.0, functions inspecting arguments, like %1$s(), no longer report the original value as passed to a parameter, but will instead provide the current value. The parameter "%2$s" was %4$s on line %3$s.'; + $data = array( + $foundFunctionName, + $tokens[$variableToken]['content'], + $tokens[$variableToken]['line'], + ); + + if ($scanResult === 'error') { + $data[] = 'changed'; + $phpcsFile->addError($error, $i, 'Changed', $data); + + } elseif ($scanResult === 'warning') { + $data[] = 'used, and possibly changed (by reference),'; + $phpcsFile->addWarning($error, $i, 'NeedsInspection', $data); + } + + unset($variableToken); + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/ArgumentFunctionsUsageSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/ArgumentFunctionsUsageSniff.php new file mode 100644 index 00000000..7c251119 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/ArgumentFunctionsUsageSniff.php @@ -0,0 +1,169 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\FunctionUse; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect usage of `func_get_args()`, `func_get_arg()` and `func_num_args()` in invalid context. + * + * Checks for: + * - Prior to PHP 5.3, these functions could not be used as a function call parameter. + * - Calling these functions from the outermost scope of a file which has been included by + * calling `include` or `require` from within a function in the calling file, worked + * prior to PHP 5.3. As of PHP 5.3, this will generate a warning and will always return false/-1. + * If the file was called directly or included in the global scope, calls to these + * functions would already generate a warning prior to PHP 5.3. + * + * PHP version 5.3 + * + * @link https://www.php.net/manual/en/migration53.incompatible.php + * + * @since 8.2.0 + */ +class ArgumentFunctionsUsageSniff extends Sniff +{ + + /** + * The target functions for this sniff. + * + * @since 8.2.0 + * + * @var array + */ + protected $targetFunctions = array( + 'func_get_args' => true, + 'func_get_arg' => true, + 'func_num_args' => true, + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 8.2.0 + * + * @return array + */ + public function register() + { + return array(\T_STRING); + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $functionLc = strtolower($tokens[$stackPtr]['content']); + if (isset($this->targetFunctions[$functionLc]) === false) { + return; + } + + // Next non-empty token should be the open parenthesis. + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true, null, true); + if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== \T_OPEN_PARENTHESIS) { + return; + } + + $ignore = array( + \T_DOUBLE_COLON => true, + \T_OBJECT_OPERATOR => true, + \T_FUNCTION => true, + \T_NEW => true, + ); + + $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); + if (isset($ignore[$tokens[$prevNonEmpty]['code']]) === true) { + // Not a call to a PHP function. + return; + } elseif ($tokens[$prevNonEmpty]['code'] === \T_NS_SEPARATOR && $tokens[$prevNonEmpty - 1]['code'] === \T_STRING) { + // Namespaced function. + return; + } + + $data = $tokens[$stackPtr]['content']; + + /* + * Check for use of the functions in the global scope. + * + * As PHPCS can not determine whether a file is included from within a function in + * another file, so always throw a warning/error. + */ + if ($phpcsFile->hasCondition($stackPtr, array(\T_FUNCTION, \T_CLOSURE)) === false) { + $isError = false; + $message = 'Use of %s() outside of a user-defined function is only supported if the file is included from within a user-defined function in another file prior to PHP 5.3.'; + + if ($this->supportsAbove('5.3') === true) { + $isError = true; + $message .= ' As of PHP 5.3, it is no longer supported at all.'; + } + + $this->addMessage($phpcsFile, $message, $stackPtr, $isError, 'OutsideFunctionScope', $data); + } + + /* + * Check for use of the functions as a parameter in a function call. + */ + if ($this->supportsBelow('5.2') === false) { + return; + } + + if (isset($tokens[$stackPtr]['nested_parenthesis']) === false) { + return; + } + + $throwError = false; + + $closer = end($tokens[$stackPtr]['nested_parenthesis']); + if (isset($tokens[$closer]['parenthesis_owner']) + && $tokens[$tokens[$closer]['parenthesis_owner']]['type'] === 'T_CLOSURE' + ) { + $throwError = true; + } else { + $opener = key($tokens[$stackPtr]['nested_parenthesis']); + $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($opener - 1), null, true); + if ($tokens[$prevNonEmpty]['code'] !== \T_STRING) { + return; + } + + $prevPrevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($prevNonEmpty - 1), null, true); + if ($tokens[$prevPrevNonEmpty]['code'] === \T_FUNCTION) { + return; + } + + $throwError = true; + } + + if ($throwError === false) { + return; + } + + $phpcsFile->addError( + '%s() could not be used in parameter lists prior to PHP 5.3.', + $stackPtr, + 'InParameterList', + $data + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/NewFunctionParametersSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/NewFunctionParametersSniff.php new file mode 100644 index 00000000..7b0d60bd --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/NewFunctionParametersSniff.php @@ -0,0 +1,1109 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\FunctionUse; + +use PHPCompatibility\AbstractNewFeatureSniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect use of new function parameters in calls to native PHP functions. + * + * PHP version All + * + * @link https://www.php.net/manual/en/doc.changelog.php + * + * @since 7.0.0 + * @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class.. + */ +class NewFunctionParametersSniff extends AbstractNewFeatureSniff +{ + /** + * A list of functions which have new parameters, not present in older versions. + * + * The array lists : version number with false (not present) or true (present). + * The index is the location of the parameter in the parameter list, starting at 0 ! + * If's sufficient to list the first version where the function appears. + * + * @since 7.0.0 + * @since 7.0.2 Visibility changed from `public` to `protected`. + * + * @var array + */ + protected $newFunctionParameters = array( + 'array_filter' => array( + 2 => array( + 'name' => 'flag', + '5.5' => false, + '5.6' => true, + ), + ), + 'array_slice' => array( + 1 => array( + 'name' => 'preserve_keys', + '5.0.1' => false, + '5.0.2' => true, + ), + ), + 'array_unique' => array( + 1 => array( + 'name' => 'sort_flags', + '5.2.8' => false, + '5.2.9' => true, + ), + ), + 'assert' => array( + 1 => array( + 'name' => 'description', + '5.4.7' => false, + '5.4.8' => true, + ), + ), + 'base64_decode' => array( + 1 => array( + 'name' => 'strict', + '5.1' => false, + '5.2' => true, + ), + ), + 'bcmod' => array( + 2 => array( + 'name' => 'scale', + '7.1' => false, + '7.2' => true, + ), + ), + 'class_implements' => array( + 1 => array( + 'name' => 'autoload', + '5.0' => false, + '5.1' => true, + ), + ), + 'class_parents' => array( + 1 => array( + 'name' => 'autoload', + '5.0' => false, + '5.1' => true, + ), + ), + 'clearstatcache' => array( + 0 => array( + 'name' => 'clear_realpath_cache', + '5.2' => false, + '5.3' => true, + ), + 1 => array( + 'name' => 'filename', + '5.2' => false, + '5.3' => true, + ), + ), + 'copy' => array( + 2 => array( + 'name' => 'context', + '5.2' => false, + '5.3' => true, + ), + ), + 'curl_multi_info_read' => array( + 1 => array( + 'name' => 'msgs_in_queue', + '5.1' => false, + '5.2' => true, + ), + ), + 'debug_backtrace' => array( + 0 => array( + 'name' => 'options', + '5.2.4' => false, + '5.2.5' => true, + ), + 1 => array( + 'name' => 'limit', + '5.3' => false, + '5.4' => true, + ), + ), + 'debug_print_backtrace' => array( + 0 => array( + 'name' => 'options', + '5.3.5' => false, + '5.3.6' => true, + ), + 1 => array( + 'name' => 'limit', + '5.3' => false, + '5.4' => true, + ), + ), + 'dirname' => array( + 1 => array( + 'name' => 'levels', + '5.6' => false, + '7.0' => true, + ), + ), + 'dns_get_record' => array( + 4 => array( + 'name' => 'raw', + '5.3' => false, + '5.4' => true, + ), + ), + 'fgetcsv' => array( + 4 => array( + 'name' => 'escape', + '5.2' => false, + '5.3' => true, + ), + ), + 'fputcsv' => array( + 4 => array( + 'name' => 'escape_char', + '5.5.3' => false, + '5.5.4' => true, + ), + ), + 'file_get_contents' => array( + 3 => array( + 'name' => 'offset', + '5.0' => false, + '5.1' => true, + ), + 4 => array( + 'name' => 'maxlen', + '5.0' => false, + '5.1' => true, + ), + ), + 'filter_input_array' => array( + 2 => array( + 'name' => 'add_empty', + '5.3' => false, + '5.4' => true, + ), + ), + 'filter_var_array' => array( + 2 => array( + 'name' => 'add_empty', + '5.3' => false, + '5.4' => true, + ), + ), + 'getenv' => array( + 1 => array( + 'name' => 'local_only', + '5.5.37' => false, + '5.5.38' => true, // Also introduced in PHP 5.6.24 and 7.0.9. + ), + ), + 'getopt' => array( + 2 => array( + 'name' => 'optind', + '7.0' => false, + '7.1' => true, + ), + ), + 'gettimeofday' => array( + 0 => array( + 'name' => 'return_float', + '5.0' => false, + '5.1' => true, + ), + ), + 'get_defined_functions' => array( + 0 => array( + 'name' => 'exclude_disabled', + '7.0.14' => false, + '7.0.15' => true, + ), + ), + 'get_headers' => array( + 2 => array( + 'name' => 'context', + '7.0' => false, + '7.1' => true, + ), + ), + 'get_html_translation_table' => array( + 2 => array( + 'name' => 'encoding', + '5.3.3' => false, + '5.3.4' => true, + ), + ), + 'get_loaded_extensions' => array( + 0 => array( + 'name' => 'zend_extensions', + '5.2.3' => false, + '5.2.4' => true, + ), + ), + 'gzcompress' => array( + 2 => array( + 'name' => 'encoding', + '5.3' => false, + '5.4' => true, + ), + ), + 'gzdeflate' => array( + 2 => array( + 'name' => 'encoding', + '5.3' => false, + '5.4' => true, + ), + ), + 'htmlentities' => array( + 3 => array( + 'name' => 'double_encode', + '5.2.2' => false, + '5.2.3' => true, + ), + ), + 'htmlspecialchars' => array( + 3 => array( + 'name' => 'double_encode', + '5.2.2' => false, + '5.2.3' => true, + ), + ), + 'http_build_query' => array( + 2 => array( + 'name' => 'arg_separator', + '5.1.1' => false, + '5.1.2' => true, + ), + 3 => array( + 'name' => 'enc_type', + '5.3' => false, + '5.4' => true, + ), + ), + 'idn_to_ascii' => array( + 2 => array( + 'name' => 'variant', + '5.3' => false, + '5.4' => true, + ), + 3 => array( + 'name' => 'idna_info', + '5.3' => false, + '5.4' => true, + ), + ), + 'idn_to_utf8' => array( + 2 => array( + 'name' => 'variant', + '5.3' => false, + '5.4' => true, + ), + 3 => array( + 'name' => 'idna_info', + '5.3' => false, + '5.4' => true, + ), + ), + 'imagecolorset' => array( + 5 => array( + 'name' => 'alpha', + '5.3' => false, + '5.4' => true, + ), + ), + 'imagepng' => array( + 2 => array( + 'name' => 'quality', + '5.1.1' => false, + '5.1.2' => true, + ), + 3 => array( + 'name' => 'filters', + '5.1.2' => false, + '5.1.3' => true, + ), + ), + 'imagerotate' => array( + 3 => array( + 'name' => 'ignore_transparent', + '5.0' => false, + '5.1' => true, + ), + ), + 'imap_open' => array( + 4 => array( + 'name' => 'n_retries', + '5.1' => false, + '5.2' => true, + ), + 5 => array( + 'name' => 'params', + '5.3.1' => false, + '5.3.2' => true, + ), + ), + 'imap_reopen' => array( + 3 => array( + 'name' => 'n_retries', + '5.1' => false, + '5.2' => true, + ), + ), + 'ini_get_all' => array( + 1 => array( + 'name' => 'details', + '5.2' => false, + '5.3' => true, + ), + ), + 'is_a' => array( + 2 => array( + 'name' => 'allow_string', + '5.3.8' => false, + '5.3.9' => true, + ), + ), + 'is_subclass_of' => array( + 2 => array( + 'name' => 'allow_string', + '5.3.8' => false, + '5.3.9' => true, + ), + ), + 'iterator_to_array' => array( + 1 => array( + 'name' => 'use_keys', + '5.2.0' => false, + '5.2.1' => true, + ), + ), + 'json_decode' => array( + 2 => array( + 'name' => 'depth', + '5.2' => false, + '5.3' => true, + ), + 3 => array( + 'name' => 'options', + '5.3' => false, + '5.4' => true, + ), + ), + 'json_encode' => array( + 1 => array( + 'name' => 'options', + '5.2' => false, + '5.3' => true, + ), + 2 => array( + 'name' => 'depth', + '5.4' => false, + '5.5' => true, + ), + ), + 'ldap_add' => array( + 3 => array( + 'name' => 'serverctrls', + '7.2' => false, + '7.3' => true, + ), + ), + 'ldap_compare' => array( + 4 => array( + 'name' => 'serverctrls', + '7.2' => false, + '7.3' => true, + ), + ), + 'ldap_delete' => array( + 2 => array( + 'name' => 'serverctrls', + '7.2' => false, + '7.3' => true, + ), + ), + 'ldap_list' => array( + 8 => array( + 'name' => 'serverctrls', + '7.2' => false, + '7.3' => true, + ), + ), + 'ldap_mod_add' => array( + 3 => array( + 'name' => 'serverctrls', + '7.2' => false, + '7.3' => true, + ), + ), + 'ldap_mod_del' => array( + 3 => array( + 'name' => 'serverctrls', + '7.2' => false, + '7.3' => true, + ), + ), + 'ldap_mod_replace' => array( + 3 => array( + 'name' => 'serverctrls', + '7.2' => false, + '7.3' => true, + ), + ), + 'ldap_modify_batch' => array( + 3 => array( + 'name' => 'serverctrls', + '7.2' => false, + '7.3' => true, + ), + ), + 'ldap_parse_result' => array( + 6 => array( + 'name' => 'serverctrls', + '7.2' => false, + '7.3' => true, + ), + ), + 'ldap_read' => array( + 8 => array( + 'name' => 'serverctrls', + '7.2' => false, + '7.3' => true, + ), + ), + 'ldap_rename' => array( + 5 => array( + 'name' => 'serverctrls', + '7.2' => false, + '7.3' => true, + ), + ), + 'ldap_search' => array( + 8 => array( + 'name' => 'serverctrls', + '7.2' => false, + '7.3' => true, + ), + ), + 'memory_get_peak_usage' => array( + 0 => array( + 'name' => 'real_usage', + '5.1' => false, + '5.2' => true, + ), + ), + 'memory_get_usage' => array( + 0 => array( + 'name' => 'real_usage', + '5.1' => false, + '5.2' => true, + ), + ), + 'mb_encode_numericentity' => array( + 3 => array( + 'name' => 'is_hex', + '5.3' => false, + '5.4' => true, + ), + ), + 'mb_strrpos' => array( + /* + * Note: the actual position is 2, but the original 3rd + * parameter 'encoding' was moved to the 4th position. + * So the only way to detect if offset is used is when + * both offset and encoding are set. + */ + 3 => array( + 'name' => 'offset', + '5.1' => false, + '5.2' => true, + ), + ), + 'mssql_connect' => array( + 3 => array( + 'name' => 'new_link', + '5.0' => false, + '5.1' => true, + ), + ), + 'mysqli_commit' => array( + 1 => array( + 'name' => 'flags', + '5.4' => false, + '5.5' => true, + ), + 2 => array( + 'name' => 'name', + '5.4' => false, + '5.5' => true, + ), + ), + 'mysqli_rollback' => array( + 1 => array( + 'name' => 'flags', + '5.4' => false, + '5.5' => true, + ), + 2 => array( + 'name' => 'name', + '5.4' => false, + '5.5' => true, + ), + ), + 'nl2br' => array( + 1 => array( + 'name' => 'is_xhtml', + '5.2' => false, + '5.3' => true, + ), + ), + 'openssl_decrypt' => array( + 4 => array( + 'name' => 'iv', + '5.3.2' => false, + '5.3.3' => true, + ), + 5 => array( + 'name' => 'tag', + '7.0' => false, + '7.1' => true, + ), + 6 => array( + 'name' => 'aad', + '7.0' => false, + '7.1' => true, + ), + ), + 'openssl_encrypt' => array( + 4 => array( + 'name' => 'iv', + '5.3.2' => false, + '5.3.3' => true, + ), + 5 => array( + 'name' => 'tag', + '7.0' => false, + '7.1' => true, + ), + 6 => array( + 'name' => 'aad', + '7.0' => false, + '7.1' => true, + ), + 7 => array( + 'name' => 'tag_length', + '7.0' => false, + '7.1' => true, + ), + ), + 'openssl_open' => array( + 4 => array( + 'name' => 'method', + '5.2' => false, + '5.3' => true, + ), + 5 => array( + 'name' => 'iv', + '5.6' => false, + '7.0' => true, + ), + ), + 'openssl_pkcs7_verify' => array( + 5 => array( + 'name' => 'content', + '5.0' => false, + '5.1' => true, + ), + 6 => array( + 'name' => 'p7bfilename', + '7.1' => false, + '7.2' => true, + ), + ), + 'openssl_seal' => array( + 4 => array( + 'name' => 'method', + '5.2' => false, + '5.3' => true, + ), + 5 => array( + 'name' => 'iv', + '5.6' => false, + '7.0' => true, + ), + ), + 'openssl_verify' => array( + 3 => array( + 'name' => 'signature_alg', + '5.1' => false, + '5.2' => true, + ), + ), + 'parse_ini_file' => array( + 2 => array( + 'name' => 'scanner_mode', + '5.2' => false, + '5.3' => true, + ), + ), + 'parse_url' => array( + 1 => array( + 'name' => 'component', + '5.1.1' => false, + '5.1.2' => true, + ), + ), + 'pg_fetch_all' => array( + 1 => array( + 'name' => 'result_type', + '7.0' => false, + '7.1' => true, + ), + ), + 'pg_last_notice' => array( + 1 => array( + 'name' => 'option', + '7.0' => false, + '7.1' => true, + ), + ), + 'pg_lo_create' => array( + 1 => array( + 'name' => 'object_id', + '5.2' => false, + '5.3' => true, + ), + ), + 'pg_lo_import' => array( + 2 => array( + 'name' => 'object_id', + '5.2' => false, + '5.3' => true, + ), + ), + 'pg_select' => array( + 4 => array( + 'name' => 'result_type', + '7.0' => false, + '7.1' => true, + ), + ), + 'php_uname' => array( + 0 => array( + 'name' => 'mode', + '4.2' => false, + '4.3' => true, + ), + ), + 'preg_replace' => array( + 4 => array( + 'name' => 'count', + '5.0' => false, + '5.1' => true, + ), + ), + 'preg_replace_callback' => array( + 4 => array( + 'name' => 'count', + '5.0' => false, + '5.1' => true, + ), + 5 => array( + 'name' => 'flags', + '7.3' => false, + '7.4' => true, + ), + ), + 'preg_replace_callback_array' => array( + 4 => array( + 'name' => 'flags', + '7.3' => false, + '7.4' => true, + ), + ), + 'round' => array( + 2 => array( + 'name' => 'mode', + '5.2' => false, + '5.3' => true, + ), + ), + 'sem_acquire' => array( + 1 => array( + 'name' => 'nowait', + '5.6' => false, + '5.6.1' => true, + ), + ), + 'session_regenerate_id' => array( + 0 => array( + 'name' => 'delete_old_session', + '5.0' => false, + '5.1' => true, + ), + ), + 'session_set_cookie_params' => array( + 4 => array( + 'name' => 'httponly', + '5.1' => false, + '5.2' => true, + ), + ), + 'session_set_save_handler' => array( + 6 => array( + 'name' => 'create_sid', + '5.5.0' => false, + '5.5.1' => true, + ), + 7 => array( + 'name' => 'validate_sid', + '5.6' => false, + '7.0' => true, + ), + 8 => array( + 'name' => 'update_timestamp', + '5.6' => false, + '7.0' => true, + ), + ), + 'session_start' => array( + 0 => array( + 'name' => 'options', + '5.6' => false, + '7.0' => true, + ), + ), + 'setcookie' => array( + 6 => array( + 'name' => 'httponly', + '5.1' => false, + '5.2' => true, + ), + ), + 'setrawcookie' => array( + 6 => array( + 'name' => 'httponly', + '5.1' => false, + '5.2' => true, + ), + ), + 'simplexml_load_file' => array( + 4 => array( + 'name' => 'is_prefix', + '5.1' => false, + '5.2' => true, + ), + ), + 'simplexml_load_string' => array( + 4 => array( + 'name' => 'is_prefix', + '5.1' => false, + '5.2' => true, + ), + ), + 'spl_autoload_register' => array( + 2 => array( + 'name' => 'prepend', + '5.2' => false, + '5.3' => true, + ), + ), + 'stream_context_create' => array( + 1 => array( + 'name' => 'params', + '5.2' => false, + '5.3' => true, + ), + ), + 'stream_copy_to_stream' => array( + 3 => array( + 'name' => 'offset', + '5.0' => false, + '5.1' => true, + ), + ), + 'stream_get_contents' => array( + 2 => array( + 'name' => 'offset', + '5.0' => false, + '5.1' => true, + ), + ), + 'stream_wrapper_register' => array( + 2 => array( + 'name' => 'flags', + '5.2.3' => false, + '5.2.4' => true, + ), + ), + 'stristr' => array( + 2 => array( + 'name' => 'before_needle', + '5.2' => false, + '5.3' => true, + ), + ), + 'strstr' => array( + 2 => array( + 'name' => 'before_needle', + '5.2' => false, + '5.3' => true, + ), + ), + 'str_word_count' => array( + 2 => array( + 'name' => 'charlist', + '5.0' => false, + '5.1' => true, + ), + ), + 'substr_count' => array( + 2 => array( + 'name' => 'offset', + '5.0' => false, + '5.1' => true, + ), + 3 => array( + 'name' => 'length', + '5.0' => false, + '5.1' => true, + ), + ), + 'sybase_connect' => array( + 5 => array( + 'name' => 'new', + '5.2' => false, + '5.3' => true, + ), + ), + 'timezone_transitions_get' => array( + 1 => array( + 'name' => 'timestamp_begin', + '5.2' => false, + '5.3' => true, + ), + 2 => array( + 'name' => 'timestamp_end', + '5.2' => false, + '5.3' => true, + ), + ), + 'timezone_identifiers_list' => array( + 0 => array( + 'name' => 'what', + '5.2' => false, + '5.3' => true, + ), + 1 => array( + 'name' => 'country', + '5.2' => false, + '5.3' => true, + ), + ), + 'token_get_all' => array( + 1 => array( + 'name' => 'flags', + '5.6' => false, + '7.0' => true, + ), + ), + 'ucwords' => array( + 1 => array( + 'name' => 'delimiters', + '5.4.31' => false, + '5.5.15' => false, + '5.4.32' => true, + '5.5.16' => true, + ), + ), + 'unpack' => array( + 2 => array( + 'name' => 'offset', + '7.0' => false, + '7.1' => true, + ), + ), + 'unserialize' => array( + 1 => array( + 'name' => 'options', + '5.6' => false, + '7.0' => true, + ), + ), + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.0 + * + * @return array + */ + public function register() + { + // Handle case-insensitivity of function names. + $this->newFunctionParameters = $this->arrayKeysToLowercase($this->newFunctionParameters); + + return array(\T_STRING); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + $ignore = array( + \T_DOUBLE_COLON => true, + \T_OBJECT_OPERATOR => true, + \T_FUNCTION => true, + \T_CONST => true, + ); + + $prevToken = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true); + if (isset($ignore[$tokens[$prevToken]['code']]) === true) { + // Not a call to a PHP function. + return; + } + + $function = $tokens[$stackPtr]['content']; + $functionLc = strtolower($function); + + if (isset($this->newFunctionParameters[$functionLc]) === false) { + return; + } + + $parameterCount = $this->getFunctionCallParameterCount($phpcsFile, $stackPtr); + if ($parameterCount === 0) { + return; + } + + // If the parameter count returned > 0, we know there will be valid open parenthesis. + $openParenthesis = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true); + $parameterOffsetFound = $parameterCount - 1; + + foreach ($this->newFunctionParameters[$functionLc] as $offset => $parameterDetails) { + if ($offset <= $parameterOffsetFound) { + $itemInfo = array( + 'name' => $function, + 'nameLc' => $functionLc, + 'offset' => $offset, + ); + $this->handleFeature($phpcsFile, $openParenthesis, $itemInfo); + } + } + } + + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 7.1.0 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo) + { + return $this->newFunctionParameters[$itemInfo['nameLc']][$itemInfo['offset']]; + } + + + /** + * Get an array of the non-PHP-version array keys used in a sub-array. + * + * @since 7.1.0 + * + * @return array + */ + protected function getNonVersionArrayKeys() + { + return array('name'); + } + + + /** + * Retrieve the relevant detail (version) information for use in an error message. + * + * @since 7.1.0 + * + * @param array $itemArray Version and other information about the item. + * @param array $itemInfo Base information about the item. + * + * @return array + */ + public function getErrorInfo(array $itemArray, array $itemInfo) + { + $errorInfo = parent::getErrorInfo($itemArray, $itemInfo); + $errorInfo['paramName'] = $itemArray['name']; + + return $errorInfo; + } + + + /** + * Get the item name to be used for the creation of the error code. + * + * @since 7.1.0 + * + * @param array $itemInfo Base information about the item. + * @param array $errorInfo Detail information about an item. + * + * @return string + */ + protected function getItemName(array $itemInfo, array $errorInfo) + { + return $itemInfo['name'] . '_' . $errorInfo['paramName']; + } + + + /** + * Get the error message template for this sniff. + * + * @since 7.1.0 + * + * @return string + */ + protected function getErrorMsgTemplate() + { + return 'The function %s() does not have a parameter "%s" in PHP version %s or earlier'; + } + + + /** + * Allow for concrete child classes to filter the error data before it's passed to PHPCS. + * + * @since 7.1.0 + * + * @param array $data The error data array which was created. + * @param array $itemInfo Base information about the item this error message applies to. + * @param array $errorInfo Detail information about an item this error message applies to. + * + * @return array + */ + protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) + { + array_shift($data); + array_unshift($data, $itemInfo['name'], $errorInfo['paramName']); + return $data; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/NewFunctionsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/NewFunctionsSniff.php new file mode 100644 index 00000000..c1a0ec4e --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/NewFunctionsSniff.php @@ -0,0 +1,2008 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\FunctionUse; + +use PHPCompatibility\AbstractNewFeatureSniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect calls to new native PHP functions. + * + * PHP version All + * + * @since 5.5 + * @since 5.6 Now extends the base `Sniff` class instead of the upstream + * `Generic.PHP.ForbiddenFunctions` sniff. + * @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class.. + */ +class NewFunctionsSniff extends AbstractNewFeatureSniff +{ + /** + * A list of new functions, not present in older versions. + * + * The array lists : version number with false (not present) or true (present). + * If's sufficient to list the first version where the function appears. + * + * @since 5.5 + * @since 5.6 Visibility changed from `protected` to `public`. + * @since 7.0.2 Visibility changed back from `public` to `protected`. + * The earlier change was made to be in line with the upstream sniff, + * but that sniff is no longer being extended. + * @since 7.0.8 Renamed from `$forbiddenFunctions` to the more descriptive `$newFunctions`. + * + * @var array(string => array(string => bool)) + */ + protected $newFunctions = array( + 'iterator_count' => array( + '5.0' => false, + '5.1' => true, + ), + 'iterator_to_array' => array( + '5.0' => false, + '5.1' => true, + ), + 'spl_autoload_call' => array( + '5.0' => false, + '5.1' => true, + ), + 'spl_autoload_extensions' => array( + '5.0' => false, + '5.1' => true, + ), + 'spl_autoload_functions' => array( + '5.0' => false, + '5.1' => true, + ), + 'spl_autoload_register' => array( + '5.0' => false, + '5.1' => true, + ), + 'spl_autoload_unregister' => array( + '5.0' => false, + '5.1' => true, + ), + 'spl_autoload' => array( + '5.0' => false, + '5.1' => true, + ), + 'hash_hmac' => array( + '5.1.1' => false, + '5.1.2' => true, + ), + 'array_fill_keys' => array( + '5.1' => false, + '5.2' => true, + ), + 'error_get_last' => array( + '5.1' => false, + '5.2' => true, + ), + 'image_type_to_extension' => array( + '5.1' => false, + '5.2' => true, + ), + 'memory_get_peak_usage' => array( + '5.1' => false, + '5.2' => true, + ), + 'sys_get_temp_dir' => array( + '5.1' => false, + '5.2' => true, + ), + 'timezone_abbreviations_list' => array( + '5.1' => false, + '5.2' => true, + ), + 'timezone_identifiers_list' => array( + '5.1' => false, + '5.2' => true, + ), + 'timezone_name_from_abbr' => array( + '5.1' => false, + '5.2' => true, + ), + 'stream_socket_shutdown' => array( + '5.1' => false, + '5.2' => true, + ), + 'imagegrabscreen' => array( + '5.1' => false, + '5.2' => true, + ), + 'imagegrabwindow' => array( + '5.1' => false, + '5.2' => true, + ), + 'libxml_disable_entity_loader' => array( + '5.1' => false, + '5.2' => true, + ), + 'mb_stripos' => array( + '5.1' => false, + '5.2' => true, + ), + 'mb_stristr' => array( + '5.1' => false, + '5.2' => true, + ), + 'mb_strrchr' => array( + '5.1' => false, + '5.2' => true, + ), + 'mb_strrichr' => array( + '5.1' => false, + '5.2' => true, + ), + 'mb_strripos' => array( + '5.1' => false, + '5.2' => true, + ), + 'ming_setSWFCompression' => array( + '5.1' => false, + '5.2' => true, + ), + 'openssl_csr_get_public_key' => array( + '5.1' => false, + '5.2' => true, + ), + 'openssl_csr_get_subject' => array( + '5.1' => false, + '5.2' => true, + ), + 'openssl_pkey_get_details' => array( + '5.1' => false, + '5.2' => true, + ), + 'spl_object_hash' => array( + '5.1' => false, + '5.2' => true, + ), + 'iterator_apply' => array( + '5.1' => false, + '5.2' => true, + ), + 'preg_last_error' => array( + '5.1' => false, + '5.2' => true, + ), + 'pg_field_table' => array( + '5.1' => false, + '5.2' => true, + ), + 'posix_initgroups' => array( + '5.1' => false, + '5.2' => true, + ), + 'gmp_nextprime' => array( + '5.1' => false, + '5.2' => true, + ), + 'xmlwriter_full_end_element' => array( + '5.1' => false, + '5.2' => true, + ), + 'xmlwriter_write_raw' => array( + '5.1' => false, + '5.2' => true, + ), + 'xmlwriter_start_dtd_entity' => array( + '5.1' => false, + '5.2' => true, + ), + 'xmlwriter_end_dtd_entity' => array( + '5.1' => false, + '5.2' => true, + ), + 'xmlwriter_write_dtd_entity' => array( + '5.1' => false, + '5.2' => true, + ), + 'filter_has_var' => array( + '5.1' => false, + '5.2' => true, + ), + 'filter_id' => array( + '5.1' => false, + '5.2' => true, + ), + 'filter_input_array' => array( + '5.1' => false, + '5.2' => true, + ), + 'filter_input' => array( + '5.1' => false, + '5.2' => true, + ), + 'filter_list' => array( + '5.1' => false, + '5.2' => true, + ), + 'filter_var_array' => array( + '5.1' => false, + '5.2' => true, + ), + 'filter_var' => array( + '5.1' => false, + '5.2' => true, + ), + 'json_decode' => array( + '5.1' => false, + '5.2' => true, + ), + 'json_encode' => array( + '5.1' => false, + '5.2' => true, + ), + 'zip_close' => array( + '5.1' => false, + '5.2' => true, + ), + 'zip_entry_close' => array( + '5.1' => false, + '5.2' => true, + ), + 'zip_entry_compressedsize' => array( + '5.1' => false, + '5.2' => true, + ), + 'zip_entry_compressionmethod' => array( + '5.1' => false, + '5.2' => true, + ), + 'zip_entry_filesize' => array( + '5.1' => false, + '5.2' => true, + ), + 'zip_entry_name' => array( + '5.1' => false, + '5.2' => true, + ), + 'zip_entry_open' => array( + '5.1' => false, + '5.2' => true, + ), + 'zip_entry_read' => array( + '5.1' => false, + '5.2' => true, + ), + 'zip_open' => array( + '5.1' => false, + '5.2' => true, + ), + 'zip_read' => array( + '5.1' => false, + '5.2' => true, + ), + + 'array_replace' => array( + '5.2' => false, + '5.3' => true, + ), + 'array_replace_recursive' => array( + '5.2' => false, + '5.3' => true, + ), + 'class_alias' => array( + '5.2' => false, + '5.3' => true, + ), + 'forward_static_call' => array( + '5.2' => false, + '5.3' => true, + ), + 'forward_static_call_array' => array( + '5.2' => false, + '5.3' => true, + ), + 'gc_collect_cycles' => array( + '5.2' => false, + '5.3' => true, + ), + 'gc_disable' => array( + '5.2' => false, + '5.3' => true, + ), + 'gc_enable' => array( + '5.2' => false, + '5.3' => true, + ), + 'gc_enabled' => array( + '5.2' => false, + '5.3' => true, + ), + 'get_called_class' => array( + '5.2' => false, + '5.3' => true, + ), + 'gethostname' => array( + '5.2' => false, + '5.3' => true, + ), + 'header_remove' => array( + '5.2' => false, + '5.3' => true, + ), + 'lcfirst' => array( + '5.2' => false, + '5.3' => true, + ), + 'parse_ini_string' => array( + '5.2' => false, + '5.3' => true, + ), + 'quoted_printable_encode' => array( + '5.2' => false, + '5.3' => true, + ), + 'str_getcsv' => array( + '5.2' => false, + '5.3' => true, + ), + 'stream_context_set_default' => array( + '5.2' => false, + '5.3' => true, + ), + 'stream_supports_lock' => array( + '5.2' => false, + '5.3' => true, + ), + 'stream_context_get_params' => array( + '5.2' => false, + '5.3' => true, + ), + 'date_add' => array( + '5.2' => false, + '5.3' => true, + ), + 'date_create_from_format' => array( + '5.2' => false, + '5.3' => true, + ), + 'date_diff' => array( + '5.2' => false, + '5.3' => true, + ), + 'date_get_last_errors' => array( + '5.2' => false, + '5.3' => true, + ), + 'date_parse_from_format' => array( + '5.2' => false, + '5.3' => true, + ), + 'date_sub' => array( + '5.2' => false, + '5.3' => true, + ), + 'timezone_version_get' => array( + '5.2' => false, + '5.3' => true, + ), + 'gmp_testbit' => array( + '5.2' => false, + '5.3' => true, + ), + 'hash_copy' => array( + '5.2' => false, + '5.3' => true, + ), + 'imap_gc' => array( + '5.2' => false, + '5.3' => true, + ), + 'imap_utf8_to_mutf7' => array( + '5.2' => false, + '5.3' => true, + ), + 'imap_mutf7_to_utf8' => array( + '5.2' => false, + '5.3' => true, + ), + 'json_last_error' => array( + '5.2' => false, + '5.3' => true, + ), + 'mysqli_get_cache_stats' => array( + '5.2' => false, + '5.3' => true, + ), + 'mysqli_fetch_all' => array( + '5.2' => false, + '5.3' => true, + ), + 'mysqli_get_connection_status' => array( + '5.2' => false, + '5.3' => true, + ), + 'mysqli_poll' => array( + '5.2' => false, + '5.3' => true, + ), + 'mysqli_read_async_query' => array( + '5.2' => false, + '5.3' => true, + ), + 'openssl_random_pseudo_bytes' => array( + '5.2' => false, + '5.3' => true, + ), + 'pcntl_signal_dispatch' => array( + '5.2' => false, + '5.3' => true, + ), + 'pcntl_sigprocmask' => array( + '5.2' => false, + '5.3' => true, + ), + 'pcntl_sigtimedwait' => array( + '5.2' => false, + '5.3' => true, + ), + 'pcntl_sigwaitinfo' => array( + '5.2' => false, + '5.3' => true, + ), + 'preg_filter' => array( + '5.2' => false, + '5.3' => true, + ), + 'msg_queue_exists' => array( + '5.2' => false, + '5.3' => true, + ), + 'shm_has_vars' => array( + '5.2' => false, + '5.3' => true, + ), + 'acosh' => array( + '5.2' => false, + '5.3' => true, + ), + 'asinh' => array( + '5.2' => false, + '5.3' => true, + ), + 'atanh' => array( + '5.2' => false, + '5.3' => true, + ), + 'expm1' => array( + '5.2' => false, + '5.3' => true, + ), + 'log1p' => array( + '5.2' => false, + '5.3' => true, + ), + 'enchant_broker_describe' => array( + '5.2' => false, + '5.3' => true, + ), + 'enchant_broker_dict_exists' => array( + '5.2' => false, + '5.3' => true, + ), + 'enchant_broker_free_dict' => array( + '5.2' => false, + '5.3' => true, + ), + 'enchant_broker_free' => array( + '5.2' => false, + '5.3' => true, + ), + 'enchant_broker_get_error' => array( + '5.2' => false, + '5.3' => true, + ), + 'enchant_broker_init' => array( + '5.2' => false, + '5.3' => true, + ), + 'enchant_broker_list_dicts' => array( + '5.2' => false, + '5.3' => true, + ), + 'enchant_broker_request_dict' => array( + '5.2' => false, + '5.3' => true, + ), + 'enchant_broker_request_pwl_dict' => array( + '5.2' => false, + '5.3' => true, + ), + 'enchant_broker_set_ordering' => array( + '5.2' => false, + '5.3' => true, + ), + 'enchant_dict_add_to_personal' => array( + '5.2' => false, + '5.3' => true, + ), + 'enchant_dict_add_to_session' => array( + '5.2' => false, + '5.3' => true, + ), + 'enchant_dict_check' => array( + '5.2' => false, + '5.3' => true, + ), + 'enchant_dict_describe' => array( + '5.2' => false, + '5.3' => true, + ), + 'enchant_dict_get_error' => array( + '5.2' => false, + '5.3' => true, + ), + 'enchant_dict_is_in_session' => array( + '5.2' => false, + '5.3' => true, + ), + 'enchant_dict_quick_check' => array( + '5.2' => false, + '5.3' => true, + ), + 'enchant_dict_store_replacement' => array( + '5.2' => false, + '5.3' => true, + ), + 'enchant_dict_suggest' => array( + '5.2' => false, + '5.3' => true, + ), + 'finfo_buffer' => array( + '5.2' => false, + '5.3' => true, + ), + 'finfo_close' => array( + '5.2' => false, + '5.3' => true, + ), + 'finfo_file' => array( + '5.2' => false, + '5.3' => true, + ), + 'finfo_open' => array( + '5.2' => false, + '5.3' => true, + ), + 'finfo_set_flags' => array( + '5.2' => false, + '5.3' => true, + ), + 'intl_error_name' => array( + '5.2' => false, + '5.3' => true, + ), + 'intl_get_error_code' => array( + '5.2' => false, + '5.3' => true, + ), + 'intl_get_error_message' => array( + '5.2' => false, + '5.3' => true, + ), + 'intl_is_failure' => array( + '5.2' => false, + '5.3' => true, + ), + + 'hex2bin' => array( + '5.3' => false, + '5.4' => true, + ), + 'http_response_code' => array( + '5.3' => false, + '5.4' => true, + ), + 'get_declared_traits' => array( + '5.3' => false, + '5.4' => true, + ), + 'getimagesizefromstring' => array( + '5.3' => false, + '5.4' => true, + ), + 'stream_set_chunk_size' => array( + '5.3' => false, + '5.4' => true, + ), + 'socket_import_stream' => array( + '5.3' => false, + '5.4' => true, + ), + 'trait_exists' => array( + '5.3' => false, + '5.4' => true, + ), + 'header_register_callback' => array( + '5.3' => false, + '5.4' => true, + ), + 'class_uses' => array( + '5.3' => false, + '5.4' => true, + ), + 'session_status' => array( + '5.3' => false, + '5.4' => true, + ), + 'session_register_shutdown' => array( + '5.3' => false, + '5.4' => true, + ), + 'mysqli_error_list' => array( + '5.3' => false, + '5.4' => true, + ), + 'mysqli_stmt_error_list' => array( + '5.3' => false, + '5.4' => true, + ), + 'libxml_set_external_entity_loader' => array( + '5.3' => false, + '5.4' => true, + ), + 'ldap_control_paged_result' => array( + '5.3' => false, + '5.4' => true, + ), + 'ldap_control_paged_result_response' => array( + '5.3' => false, + '5.4' => true, + ), + 'transliteral_create' => array( + '5.3' => false, + '5.4' => true, + ), + 'transliteral_create_from_rules' => array( + '5.3' => false, + '5.4' => true, + ), + 'transliteral_create_inverse' => array( + '5.3' => false, + '5.4' => true, + ), + 'transliteral_get_error_code' => array( + '5.3' => false, + '5.4' => true, + ), + 'transliteral_get_error_message' => array( + '5.3' => false, + '5.4' => true, + ), + 'transliteral_list_ids' => array( + '5.3' => false, + '5.4' => true, + ), + 'transliteral_transliterate' => array( + '5.3' => false, + '5.4' => true, + ), + 'zlib_decode' => array( + '5.3' => false, + '5.4' => true, + ), + 'zlib_encode' => array( + '5.3' => false, + '5.4' => true, + ), + + 'array_column' => array( + '5.4' => false, + '5.5' => true, + ), + 'boolval' => array( + '5.4' => false, + '5.5' => true, + ), + 'json_last_error_msg' => array( + '5.4' => false, + '5.5' => true, + ), + 'password_get_info' => array( + '5.4' => false, + '5.5' => true, + ), + 'password_hash' => array( + '5.4' => false, + '5.5' => true, + ), + 'password_needs_rehash' => array( + '5.4' => false, + '5.5' => true, + ), + 'password_verify' => array( + '5.4' => false, + '5.5' => true, + ), + 'hash_pbkdf2' => array( + '5.4' => false, + '5.5' => true, + ), + 'openssl_pbkdf2' => array( + '5.4' => false, + '5.5' => true, + ), + 'curl_escape' => array( + '5.4' => false, + '5.5' => true, + ), + 'curl_file_create' => array( + '5.4' => false, + '5.5' => true, + ), + 'curl_multi_setopt' => array( + '5.4' => false, + '5.5' => true, + ), + 'curl_multi_strerror' => array( + '5.4' => false, + '5.5' => true, + ), + 'curl_pause' => array( + '5.4' => false, + '5.5' => true, + ), + 'curl_reset' => array( + '5.4' => false, + '5.5' => true, + ), + 'curl_share_close' => array( + '5.4' => false, + '5.5' => true, + ), + 'curl_share_init' => array( + '5.4' => false, + '5.5' => true, + ), + 'curl_share_setopt' => array( + '5.4' => false, + '5.5' => true, + ), + 'curl_strerror' => array( + '5.4' => false, + '5.5' => true, + ), + 'curl_unescape' => array( + '5.4' => false, + '5.5' => true, + ), + 'imageaffinematrixconcat' => array( + '5.4' => false, + '5.5' => true, + ), + 'imageaffinematrixget' => array( + '5.4' => false, + '5.5' => true, + ), + 'imagecrop' => array( + '5.4' => false, + '5.5' => true, + ), + 'imagecropauto' => array( + '5.4' => false, + '5.5' => true, + ), + 'imageflip' => array( + '5.4' => false, + '5.5' => true, + ), + 'imagepalettetotruecolor' => array( + '5.4' => false, + '5.5' => true, + ), + 'imagescale' => array( + '5.4' => false, + '5.5' => true, + ), + 'mysqli_begin_transaction' => array( + '5.4' => false, + '5.5' => true, + ), + 'mysqli_release_savepoint' => array( + '5.4' => false, + '5.5' => true, + ), + 'mysqli_savepoint' => array( + '5.4' => false, + '5.5' => true, + ), + 'pg_escape_literal' => array( + '5.4' => false, + '5.5' => true, + ), + 'pg_escape_identifier' => array( + '5.4' => false, + '5.5' => true, + ), + 'socket_sendmsg' => array( + '5.4' => false, + '5.5' => true, + ), + 'socket_recvmsg' => array( + '5.4' => false, + '5.5' => true, + ), + 'socket_cmsg_space' => array( + '5.4' => false, + '5.5' => true, + ), + 'cli_get_process_title' => array( + '5.4' => false, + '5.5' => true, + ), + 'cli_set_process_title' => array( + '5.4' => false, + '5.5' => true, + ), + 'datefmt_format_object' => array( + '5.4' => false, + '5.5' => true, + ), + 'datefmt_get_calendar_object' => array( + '5.4' => false, + '5.5' => true, + ), + 'datefmt_get_timezone' => array( + '5.4' => false, + '5.5' => true, + ), + 'datefmt_set_timezone' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_create_instance' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_get_keyword_values_for_locale' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_get_now' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_get_available_locales' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_get' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_get_time' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_set_time' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_add' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_set_time_zone' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_after' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_before' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_set' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_roll' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_clear' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_field_difference' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_get_actual_maximum' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_get_actual_minumum' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_get_day_of_week_type' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_get_first_day_of_week' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_get_greatest_minimum' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_get_least_maximum' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_get_locale' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_get_maximum' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_get_minimal_days_in_first_week' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_get_minimum' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_get_time_zone' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_get_type' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_get_weekend_transition' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_in_daylight_time' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_is_equivalent_to' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_is_lenient' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_equals' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_get_repeated_wall_time_option' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_get_skipped_wall_time_option' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_set_repeated_wall_time_option' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_set_skipped_wall_time_option' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_from_date_time' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_to_date_time' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_get_error_code' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlcal_get_error_message' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlgregcal_create_instance' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlgregcal_set_gregorian_change' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlgregcal_get_gregorian_change' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlgregcal_is_leap_year' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlz_create_time_zone' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlz_create_default' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlz_get_id' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlz_get_gmt' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlz_get_unknown' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlz_create_enumeration' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlz_count_equivalent_ids' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlz_create_time_zone_id_enumeration' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlz_get_canonical_id' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlz_get_region' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlz_get_tz_data_version' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlz_get_equivalent_id' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlz_use_daylight_time' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlz_get_offset' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlz_get_raw_offset' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlz_has_same_rules' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlz_get_display_name' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlz_get_dst_savings' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlz_from_date_time_zone' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlz_to_date_time_zone' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlz_get_error_code' => array( + '5.4' => false, + '5.5' => true, + ), + 'intlz_get_error_message' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache_compile_file' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache_get_configuration' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache_get_status' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache_invalidate' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache_reset' => array( + '5.4' => false, + '5.5' => true, + ), + + 'opcache_is_script_cached' => array( + '5.5.10' => false, + '5.5.11' => true, + ), + + 'gmp_root' => array( + '5.5' => false, + '5.6' => true, + ), + 'gmp_rootrem' => array( + '5.5' => false, + '5.6' => true, + ), + 'hash_equals' => array( + '5.5' => false, + '5.6' => true, + ), + 'ldap_escape' => array( + '5.5' => false, + '5.6' => true, + ), + 'ldap_modify_batch' => array( + '5.4.25' => false, + '5.5.9' => false, + '5.4.26' => true, + '5.5.10' => true, + '5.6.0' => true, + ), + 'mysqli_get_links_stats' => array( + '5.5' => false, + '5.6' => true, + ), + 'openssl_get_cert_locations' => array( + '5.5' => false, + '5.6' => true, + ), + 'openssl_x509_fingerprint' => array( + '5.5' => false, + '5.6' => true, + ), + 'openssl_spki_new' => array( + '5.5' => false, + '5.6' => true, + ), + 'openssl_spki_verify' => array( + '5.5' => false, + '5.6' => true, + ), + 'openssl_spki_export_challenge' => array( + '5.5' => false, + '5.6' => true, + ), + 'openssl_spki_export' => array( + '5.5' => false, + '5.6' => true, + ), + 'pg_connect_poll' => array( + '5.5' => false, + '5.6' => true, + ), + 'pg_consume_input' => array( + '5.5' => false, + '5.6' => true, + ), + 'pg_flush' => array( + '5.5' => false, + '5.6' => true, + ), + 'pg_lo_truncate' => array( + '5.5' => false, + '5.6' => true, + ), + 'pg_socket' => array( + '5.5' => false, + '5.6' => true, + ), + 'session_abort' => array( + '5.5' => false, + '5.6' => true, + ), + 'session_reset' => array( + '5.5' => false, + '5.6' => true, + ), + + 'random_bytes' => array( + '5.6' => false, + '7.0' => true, + ), + 'random_int' => array( + '5.6' => false, + '7.0' => true, + ), + 'error_clear_last' => array( + '5.6' => false, + '7.0' => true, + ), + 'gmp_random_seed' => array( + '5.6' => false, + '7.0' => true, + ), + 'intdiv' => array( + '5.6' => false, + '7.0' => true, + ), + 'preg_replace_callback_array' => array( + '5.6' => false, + '7.0' => true, + ), + 'gc_mem_caches' => array( + '5.6' => false, + '7.0' => true, + ), + 'get_resources' => array( + '5.6' => false, + '7.0' => true, + ), + 'posix_setrlimit' => array( + '5.6' => false, + '7.0' => true, + ), + 'inflate_add' => array( + '5.6' => false, + '7.0' => true, + ), + 'deflate_add' => array( + '5.6' => false, + '7.0' => true, + ), + 'inflate_init' => array( + '5.6' => false, + '7.0' => true, + ), + 'deflate_init' => array( + '5.6' => false, + '7.0' => true, + ), + + 'socket_export_stream' => array( + '7.0.6' => false, + '7.0.7' => true, + ), + + 'curl_multi_errno' => array( + '7.0' => false, + '7.1' => true, + ), + 'curl_share_errno' => array( + '7.0' => false, + '7.1' => true, + ), + 'curl_share_strerror' => array( + '7.0' => false, + '7.1' => true, + ), + 'is_iterable' => array( + '7.0' => false, + '7.1' => true, + ), + 'pcntl_async_signals' => array( + '7.0' => false, + '7.1' => true, + ), + 'pcntl_signal_get_handler' => array( + '7.0' => false, + '7.1' => true, + ), + 'session_create_id' => array( + '7.0' => false, + '7.1' => true, + ), + 'session_gc' => array( + '7.0' => false, + '7.1' => true, + ), + 'sapi_windows_cp_set' => array( + '7.0' => false, + '7.1' => true, + ), + 'sapi_windows_cp_get' => array( + '7.0' => false, + '7.1' => true, + ), + 'sapi_windows_cp_is_utf8' => array( + '7.0' => false, + '7.1' => true, + ), + 'sapi_windows_cp_conv' => array( + '7.0' => false, + '7.1' => true, + ), + + 'hash_hkdf' => array( + '7.1.1' => false, + '7.1.2' => true, + ), + 'oci_register_taf_callback' => array( + '7.1.6' => false, + '7.1.7' => true, + ), + 'oci_unregister_taf_callback' => array( + '7.1.8' => false, + '7.1.9' => true, + ), + + 'stream_isatty' => array( + '7.1' => false, + '7.2' => true, + ), + 'sapi_windows_vt100_support' => array( + '7.1' => false, + '7.2' => true, + ), + 'ftp_append' => array( + '7.1' => false, + '7.2' => true, + ), + 'hash_hmac_algos' => array( + '7.1' => false, + '7.2' => true, + ), + 'imagebmp' => array( + '7.1' => false, + '7.2' => true, + ), + 'imagecreatefrombmp' => array( + '7.1' => false, + '7.2' => true, + ), + 'imagegetclip' => array( + '7.1' => false, + '7.2' => true, + ), + 'imageopenpolygon' => array( + '7.1' => false, + '7.2' => true, + ), + 'imageresolution' => array( + '7.1' => false, + '7.2' => true, + ), + 'imagesetclip' => array( + '7.1' => false, + '7.2' => true, + ), + 'ldap_exop' => array( + '7.1' => false, + '7.2' => true, + ), + 'ldap_exop_passwd' => array( + '7.1' => false, + '7.2' => true, + ), + 'ldap_exop_whoami' => array( + '7.1' => false, + '7.2' => true, + ), + 'ldap_parse_exop' => array( + '7.1' => false, + '7.2' => true, + ), + 'mb_chr' => array( + '7.1' => false, + '7.2' => true, + ), + 'mb_ord' => array( + '7.1' => false, + '7.2' => true, + ), + 'mb_scrub' => array( + '7.1' => false, + '7.2' => true, + ), + 'socket_addrinfo_lookup' => array( + '7.1' => false, + '7.2' => true, + ), + 'socket_addrinfo_connect' => array( + '7.1' => false, + '7.2' => true, + ), + 'socket_addrinfo_bind' => array( + '7.1' => false, + '7.2' => true, + ), + 'socket_addrinfo_explain' => array( + '7.1' => false, + '7.2' => true, + ), + 'spl_object_id' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_add' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_base642bin' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_bin2base64' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_bin2hex' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_compare' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_aead_aes256gcm_decrypt' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_aead_aes256gcm_encrypt' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_aead_aes256gcm_is_available' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_aead_aes256gcm_keygen' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_aead_chacha20poly1305_decrypt' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_aead_chacha20poly1305_encrypt' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_aead_chacha20poly1305_ietf_decrypt' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_aead_chacha20poly1305_ietf_encrypt' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_aead_chacha20poly1305_ietf_keygen' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_aead_chacha20poly1305_keygen' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_aead_xchacha20poly1305_ietf_decrypt' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_aead_xchacha20poly1305_ietf_encrypt' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_aead_xchacha20poly1305_ietf_keygen' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_auth_keygen' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_auth_verify' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_auth' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_box_keypair_from_secretkey_and_publickey' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_box_keypair' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_box_open' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_box_publickey_from_secretkey' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_box_publickey' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_box_seal_open' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_box_seal' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_box_secretkey' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_box_seed_keypair' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_box' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_generichash_final' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_generichash_init' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_generichash_keygen' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_generichash_update' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_generichash' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_kdf_derive_from_key' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_kdf_keygen' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_kx_client_session_keys' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_kx_keypair' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_kx_publickey' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_kx_secretkey' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_kx_seed_keypair' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_kx_server_session_keys' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_pwhash_scryptsalsa208sha256_str_verify' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_pwhash_scryptsalsa208sha256_str' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_pwhash_scryptsalsa208sha256' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_pwhash_str_needs_rehash' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_pwhash_str_verify' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_pwhash_str' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_pwhash' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_scalarmult_base' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_scalarmult' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_secretbox_keygen' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_secretbox_open' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_secretbox' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_secretstream_xchacha20poly1305_init_pull' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_secretstream_xchacha20poly1305_init_push' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_secretstream_xchacha20poly1305_keygen' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_secretstream_xchacha20poly1305_pull' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_secretstream_xchacha20poly1305_push' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_secretstream_xchacha20poly1305_rekey' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_shorthash_keygen' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_shorthash' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_sign_detached' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_sign_ed25519_pk_to_curve25519' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_sign_ed25519_sk_to_curve25519' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_sign_keypair_from_secretkey_and_publickey' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_sign_keypair' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_sign_open' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_sign_publickey_from_secretkey' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_sign_publickey' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_sign_secretkey' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_sign_seed_keypair' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_sign_verify_detached' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_sign' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_stream_keygen' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_stream_xor' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_crypto_stream' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_hex2bin' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_increment' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_memcmp' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_memzero' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_pad' => array( + '7.1' => false, + '7.2' => true, + ), + 'sodium_unpad' => array( + '7.1' => false, + '7.2' => true, + ), + // Introduced in 7.2.14 and 7.3.1 simultanously. + 'oci_set_call_timeout' => array( + '7.2.13' => false, + '7.2.14' => true, + ), + // Introduced in 7.2.14 and 7.3.1 simultanously. + 'oci_set_db_operation' => array( + '7.2.13' => false, + '7.2.14' => true, + ), + + 'hrtime' => array( + '7.2' => false, + '7.3' => true, + ), + 'is_countable' => array( + '7.2' => false, + '7.3' => true, + ), + 'array_key_first' => array( + '7.2' => false, + '7.3' => true, + ), + 'array_key_last' => array( + '7.2' => false, + '7.3' => true, + ), + 'fpm_get_status' => array( + '7.2' => false, + '7.3' => true, + ), + 'net_get_interfaces' => array( + '7.2' => false, + '7.3' => true, + ), + 'gmp_binomial' => array( + '7.2' => false, + '7.3' => true, + ), + 'gmp_lcm' => array( + '7.2' => false, + '7.3' => true, + ), + 'gmp_perfect_power' => array( + '7.2' => false, + '7.3' => true, + ), + 'gmp_kronecker' => array( + '7.2' => false, + '7.3' => true, + ), + 'ldap_add_ext' => array( + '7.2' => false, + '7.3' => true, + ), + 'ldap_bind_ext' => array( + '7.2' => false, + '7.3' => true, + ), + 'ldap_delete_ext' => array( + '7.2' => false, + '7.3' => true, + ), + 'ldap_exop_refresh' => array( + '7.2' => false, + '7.3' => true, + ), + 'ldap_mod_add_ext' => array( + '7.2' => false, + '7.3' => true, + ), + 'ldap_mod_replace_ext' => array( + '7.2' => false, + '7.3' => true, + ), + 'ldap_mod_del_ext' => array( + '7.2' => false, + '7.3' => true, + ), + 'ldap_rename_ext' => array( + '7.2' => false, + '7.3' => true, + ), + 'normalizer_get_raw_decomposition' => array( + '7.2' => false, + '7.3' => true, + ), + 'openssl_pkey_derive' => array( + '7.2' => false, + '7.3' => true, + ), + 'socket_wsaprotocol_info_export' => array( + '7.2' => false, + '7.3' => true, + ), + 'socket_wsaprotocol_info_import' => array( + '7.2' => false, + '7.3' => true, + ), + 'socket_wsaprotocol_info_release' => array( + '7.2' => false, + '7.3' => true, + ), + + 'get_mangled_object_vars' => array( + '7.3' => false, + '7.4' => true, + ), + 'imagecreatefromtga' => array( + '7.3' => false, + '7.4' => true, + ), + 'mb_str_split' => array( + '7.3' => false, + '7.4' => true, + ), + 'openssl_x509_verify' => array( + '7.3' => false, + '7.4' => true, + ), + 'password_algos' => array( + '7.3' => false, + '7.4' => true, + ), + 'pcntl_unshare' => array( + '7.3' => false, + '7.4' => true, + ), + 'sapi_windows_set_ctrl_handler' => array( + '7.3' => false, + '7.4' => true, + ), + 'sapi_windows_generate_ctrl_event' => array( + '7.3' => false, + '7.4' => true, + ), + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 5.6 + * + * @return array + */ + public function register() + { + // Handle case-insensitivity of function names. + $this->newFunctions = $this->arrayKeysToLowercase($this->newFunctions); + + return array(\T_STRING); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 5.5 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + $ignore = array( + \T_DOUBLE_COLON => true, + \T_OBJECT_OPERATOR => true, + \T_FUNCTION => true, + \T_CONST => true, + ); + + $prevToken = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true); + if (isset($ignore[$tokens[$prevToken]['code']]) === true) { + // Not a call to a PHP function. + return; + + } elseif ($tokens[$prevToken]['code'] === \T_NS_SEPARATOR && $tokens[$prevToken - 1]['code'] === \T_STRING) { + // Namespaced function. + return; + } + + $function = $tokens[$stackPtr]['content']; + $functionLc = strtolower($function); + + if (isset($this->newFunctions[$functionLc]) === false) { + return; + } + + $itemInfo = array( + 'name' => $function, + 'nameLc' => $functionLc, + ); + $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); + } + + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 7.1.0 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo) + { + return $this->newFunctions[$itemInfo['nameLc']]; + } + + + /** + * Get the error message template for this sniff. + * + * @since 7.1.0 + * + * @return string + */ + protected function getErrorMsgTemplate() + { + return 'The function %s() is not present in PHP version %s or earlier'; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/OptionalToRequiredFunctionParametersSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/OptionalToRequiredFunctionParametersSniff.php new file mode 100644 index 00000000..301e5e07 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/OptionalToRequiredFunctionParametersSniff.php @@ -0,0 +1,173 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\FunctionUse; + +use PHPCompatibility\Sniffs\FunctionUse\RequiredToOptionalFunctionParametersSniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect missing required function parameters in calls to native PHP functions. + * + * Specifically when those function parameters used to be optional in older PHP versions. + * + * PHP version All + * + * @link https://www.php.net/manual/en/doc.changelog.php + * + * @since 8.1.0 + * @since 9.0.0 Renamed from `OptionalRequiredFunctionParametersSniff` to `OptionalToRequiredFunctionParametersSniff`. + */ +class OptionalToRequiredFunctionParametersSniff extends RequiredToOptionalFunctionParametersSniff +{ + + /** + * A list of function parameters, which were optional in older versions and became required later on. + * + * The array lists : version number with true (required) and false (optional use deprecated). + * + * The index is the location of the parameter in the parameter list, starting at 0 ! + * If's sufficient to list the last version in which the parameter was not yet required. + * + * @since 8.1.0 + * + * @var array + */ + protected $functionParameters = array( + // Special case, the optional nature is not deprecated, but usage is recommended + // and leaving the parameter out will throw an E_NOTICE. + 'crypt' => array( + 1 => array( + 'name' => 'salt', + '5.6' => 'recommended', + ), + ), + 'parse_str' => array( + 1 => array( + 'name' => 'result', + '7.2' => false, + ), + ), + ); + + + /** + * Determine whether an error/warning should be thrown for an item based on collected information. + * + * @since 8.1.0 + * + * @param array $errorInfo Detail information about an item. + * + * @return bool + */ + protected function shouldThrowError(array $errorInfo) + { + return ($errorInfo['optionalDeprecated'] !== '' + || $errorInfo['optionalRemoved'] !== '' + || $errorInfo['optionalRecommended'] !== ''); + } + + + /** + * Retrieve the relevant detail (version) information for use in an error message. + * + * @since 8.1.0 + * + * @param array $itemArray Version and other information about the item. + * @param array $itemInfo Base information about the item. + * + * @return array + */ + public function getErrorInfo(array $itemArray, array $itemInfo) + { + $errorInfo = array( + 'paramName' => '', + 'optionalRecommended' => '', + 'optionalDeprecated' => '', + 'optionalRemoved' => '', + 'error' => false, + ); + + $versionArray = $this->getVersionArray($itemArray); + + if (empty($versionArray) === false) { + foreach ($versionArray as $version => $required) { + if ($this->supportsAbove($version) === true) { + if ($required === true && $errorInfo['optionalRemoved'] === '') { + $errorInfo['optionalRemoved'] = $version; + $errorInfo['error'] = true; + } elseif ($required === 'recommended' && $errorInfo['optionalRecommended'] === '') { + $errorInfo['optionalRecommended'] = $version; + } elseif ($errorInfo['optionalDeprecated'] === '') { + $errorInfo['optionalDeprecated'] = $version; + } + } + } + } + + $errorInfo['paramName'] = $itemArray['name']; + + return $errorInfo; + } + + + /** + * Generates the error or warning for this item. + * + * @since 8.1.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the relevant token in + * the stack. + * @param array $itemInfo Base information about the item. + * @param array $errorInfo Array with detail (version) information + * relevant to the item. + * + * @return void + */ + public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo) + { + $error = 'The "%s" parameter for function %s() is missing. Passing this parameter is '; + if ($errorInfo['optionalRecommended'] === '') { + $error .= 'no longer optional. The optional nature of the parameter is '; + } else { + $error .= 'strongly recommended '; + } + + $errorCode = $this->stringToErrorCode($itemInfo['name'] . '_' . $errorInfo['paramName']); + $data = array( + $errorInfo['paramName'], + $itemInfo['name'], + ); + + if ($errorInfo['optionalRecommended'] !== '') { + $error .= 'since PHP %s '; + $errorCode .= 'SoftRecommended'; + $data[] = $errorInfo['optionalRecommended']; + } else { + if ($errorInfo['optionalDeprecated'] !== '') { + $error .= 'deprecated since PHP %s and '; + $errorCode .= 'SoftRequired'; + $data[] = $errorInfo['optionalDeprecated']; + } + + if ($errorInfo['optionalRemoved'] !== '') { + $error .= 'removed since PHP %s and '; + $errorCode .= 'HardRequired'; + $data[] = $errorInfo['optionalRemoved']; + } + + // Remove the last 'and' from the message. + $error = substr($error, 0, (\strlen($error) - 5)); + } + + $this->addMessage($phpcsFile, $error, $stackPtr, $errorInfo['error'], $errorCode, $data); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/RemovedFunctionParametersSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/RemovedFunctionParametersSniff.php new file mode 100644 index 00000000..b4cad10b --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/RemovedFunctionParametersSniff.php @@ -0,0 +1,292 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\FunctionUse; + +use PHPCompatibility\AbstractRemovedFeatureSniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect use of deprecated/removed function parameters in calls to native PHP functions. + * + * PHP version All + * + * @link https://www.php.net/manual/en/doc.changelog.php + * + * @since 7.0.0 + * @since 7.1.0 Now extends the `AbstractRemovedFeatureSniff` instead of the base `Sniff` class. + */ +class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff +{ + /** + * A list of removed function parameters, which were present in older versions. + * + * The array lists : version number with false (deprecated) and true (removed). + * The index is the location of the parameter in the parameter list, starting at 0 ! + * If's sufficient to list the first version where the function parameter was deprecated/removed. + * + * The optional `callback` key can be used to pass a method name which should be called for an + * additional check. The method will be passed the parameter info and should return true + * if the notice should be thrown or false otherwise. + * + * @since 7.0.0 + * @since 7.0.2 Visibility changed from `public` to `protected`. + * @since 9.3.0 Optional `callback` key. + * + * @var array + */ + protected $removedFunctionParameters = array( + 'curl_version' => array( + 0 => array( + 'name' => 'age', + '7.4' => false, + 'callback' => 'curlVersionInvalidValue', + ), + ), + 'define' => array( + 2 => array( + 'name' => 'case_insensitive', + '7.3' => false, // Slated for removal in PHP 8.0.0. + ), + ), + 'gmmktime' => array( + 6 => array( + 'name' => 'is_dst', + '5.1' => false, + '7.0' => true, + ), + ), + 'ldap_first_attribute' => array( + 2 => array( + 'name' => 'ber_identifier', + '5.2.4' => true, + ), + ), + 'ldap_next_attribute' => array( + 2 => array( + 'name' => 'ber_identifier', + '5.2.4' => true, + ), + ), + 'mktime' => array( + 6 => array( + 'name' => 'is_dst', + '5.1' => false, + '7.0' => true, + ), + ), + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.0 + * + * @return array + */ + public function register() + { + // Handle case-insensitivity of function names. + $this->removedFunctionParameters = $this->arrayKeysToLowercase($this->removedFunctionParameters); + + return array(\T_STRING); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + $ignore = array( + \T_DOUBLE_COLON => true, + \T_OBJECT_OPERATOR => true, + \T_FUNCTION => true, + \T_CONST => true, + ); + + $prevToken = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true); + if (isset($ignore[$tokens[$prevToken]['code']]) === true) { + // Not a call to a PHP function. + return; + } + + $function = $tokens[$stackPtr]['content']; + $functionLc = strtolower($function); + + if (isset($this->removedFunctionParameters[$functionLc]) === false) { + return; + } + + $parameters = $this->getFunctionCallParameters($phpcsFile, $stackPtr); + $parameterCount = \count($parameters); + if ($parameterCount === 0) { + return; + } + + // If the parameter count returned > 0, we know there will be valid open parenthesis. + $openParenthesis = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true); + $parameterOffsetFound = $parameterCount - 1; + + foreach ($this->removedFunctionParameters[$functionLc] as $offset => $parameterDetails) { + if ($offset <= $parameterOffsetFound) { + if (isset($parameterDetails['callback']) && method_exists($this, $parameterDetails['callback'])) { + if ($this->{$parameterDetails['callback']}($phpcsFile, $parameters[($offset + 1)]) === false) { + continue; + } + } + + $itemInfo = array( + 'name' => $function, + 'nameLc' => $functionLc, + 'offset' => $offset, + ); + $this->handleFeature($phpcsFile, $openParenthesis, $itemInfo); + } + } + } + + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 7.1.0 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo) + { + return $this->removedFunctionParameters[$itemInfo['nameLc']][$itemInfo['offset']]; + } + + + /** + * Get an array of the non-PHP-version array keys used in a sub-array. + * + * @since 7.1.0 + * + * @return array + */ + protected function getNonVersionArrayKeys() + { + return array('name', 'callback'); + } + + + /** + * Retrieve the relevant detail (version) information for use in an error message. + * + * @since 7.1.0 + * + * @param array $itemArray Version and other information about the item. + * @param array $itemInfo Base information about the item. + * + * @return array + */ + public function getErrorInfo(array $itemArray, array $itemInfo) + { + $errorInfo = parent::getErrorInfo($itemArray, $itemInfo); + $errorInfo['paramName'] = $itemArray['name']; + + return $errorInfo; + } + + + /** + * Get the item name to be used for the creation of the error code. + * + * @since 7.1.0 + * + * @param array $itemInfo Base information about the item. + * @param array $errorInfo Detail information about an item. + * + * @return string + */ + protected function getItemName(array $itemInfo, array $errorInfo) + { + return $itemInfo['name'] . '_' . $errorInfo['paramName']; + } + + + /** + * Get the error message template for this sniff. + * + * @since 7.1.0 + * + * @return string + */ + protected function getErrorMsgTemplate() + { + return 'The "%s" parameter for function %s() is '; + } + + + /** + * Filter the error data before it's passed to PHPCS. + * + * @since 7.1.0 + * + * @param array $data The error data array which was created. + * @param array $itemInfo Base information about the item this error message applies to. + * @param array $errorInfo Detail information about an item this error message applies to. + * + * @return array + */ + protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) + { + array_shift($data); + array_unshift($data, $errorInfo['paramName'], $itemInfo['name']); + return $data; + } + + /** + * Check whether curl_version() was passed the default CURLVERSION_NOW. + * + * @since 9.3.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param array $parameter Parameter info array. + * + * @return bool True if the value was not CURLVERSION_NOW, false otherwise. + */ + protected function curlVersionInvalidValue(File $phpcsFile, array $parameter) + { + $tokens = $phpcsFile->getTokens(); + $raw = ''; + for ($i = $parameter['start']; $i <= $parameter['end']; $i++) { + if (isset(Tokens::$emptyTokens[$tokens[$i]['code']])) { + continue; + } + + $raw .= $tokens[$i]['content']; + } + + if ($raw !== 'CURLVERSION_NOW' + && $raw !== (string) \CURLVERSION_NOW + ) { + return true; + } + + return false; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/RemovedFunctionsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/RemovedFunctionsSniff.php new file mode 100644 index 00000000..33f3d393 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/RemovedFunctionsSniff.php @@ -0,0 +1,1104 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\FunctionUse; + +use PHPCompatibility\AbstractRemovedFeatureSniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect calls to deprecated/removed native PHP functions. + * + * Suggests alternative if available. + * + * PHP version All + * + * @since 5.5 + * @since 5.6 Now extends the base `Sniff` class instead of the upstream + * `Generic.PHP.ForbiddenFunctions` sniff. + * @since 7.1.0 Now extends the `AbstractRemovedFeatureSniff` instead of the base `Sniff` class. + * @since 9.0.0 Renamed from `DeprecatedFunctionsSniff` to `RemovedFunctionsSniff`. + */ +class RemovedFunctionsSniff extends AbstractRemovedFeatureSniff +{ + /** + * A list of deprecated and removed functions with their alternatives. + * + * The array lists : version number with false (deprecated) or true (removed) and an alternative function. + * If no alternative exists, it is NULL, i.e, the function should just not be used. + * + * @since 5.5 + * @since 5.6 Visibility changed from `protected` to `public`. + * @since 7.0.2 Visibility changed back from `public` to `protected`. + * The earlier change was made to be in line with the upstream sniff, + * but that sniff is no longer being extended. + * @since 7.0.8 Property renamed from `$forbiddenFunctions` to `$removedFunctions`. + * + * @var array(string => array(string => bool|string|null)) + */ + protected $removedFunctions = array( + 'php_check_syntax' => array( + '5.0.5' => true, + 'alternative' => null, + ), + + 'pfpro_cleanup' => array( + '5.1' => true, + 'alternative' => null, + ), + 'pfpro_init' => array( + '5.1' => true, + 'alternative' => null, + ), + 'pfpro_process_raw' => array( + '5.1' => true, + 'alternative' => null, + ), + 'pfpro_process' => array( + '5.1' => true, + 'alternative' => null, + ), + 'pfpro_version' => array( + '5.1' => true, + 'alternative' => null, + ), + + 'call_user_method' => array( + '5.3' => false, + '7.0' => true, + 'alternative' => 'call_user_func()', + ), + 'call_user_method_array' => array( + '5.3' => false, + '7.0' => true, + 'alternative' => 'call_user_func_array()', + ), + 'define_syslog_variables' => array( + '5.3' => false, + '5.4' => true, + 'alternative' => null, + ), + 'dl' => array( + '5.3' => false, + 'alternative' => null, + ), + 'ereg' => array( + '5.3' => false, + '7.0' => true, + 'alternative' => 'preg_match()', + ), + 'ereg_replace' => array( + '5.3' => false, + '7.0' => true, + 'alternative' => 'preg_replace()', + ), + 'eregi' => array( + '5.3' => false, + '7.0' => true, + 'alternative' => 'preg_match()', + ), + 'eregi_replace' => array( + '5.3' => false, + '7.0' => true, + 'alternative' => 'preg_replace()', + ), + 'imagepsbbox' => array( + '7.0' => true, + 'alternative' => null, + ), + 'imagepsencodefont' => array( + '7.0' => true, + 'alternative' => null, + ), + 'imagepsextendfont' => array( + '7.0' => true, + 'alternative' => null, + ), + 'imagepsfreefont' => array( + '7.0' => true, + 'alternative' => null, + ), + 'imagepsloadfont' => array( + '7.0' => true, + 'alternative' => null, + ), + 'imagepsslantfont' => array( + '7.0' => true, + 'alternative' => null, + ), + 'imagepstext' => array( + '7.0' => true, + 'alternative' => null, + ), + 'import_request_variables' => array( + '5.3' => false, + '5.4' => true, + 'alternative' => null, + ), + 'ldap_sort' => array( + '7.0' => false, + 'alternative' => null, + ), + 'mcrypt_generic_end' => array( + '5.3' => false, + '7.0' => true, + 'alternative' => 'mcrypt_generic_deinit()', + ), + 'mysql_db_query' => array( + '5.3' => false, + '7.0' => true, + 'alternative' => 'mysqli::select_db() and mysqli::query()', + ), + 'mysql_escape_string' => array( + '5.3' => false, + '7.0' => true, + 'alternative' => 'mysqli::real_escape_string()', + ), + 'mysql_list_dbs' => array( + '5.4' => false, + '7.0' => true, + 'alternative' => null, + ), + 'mysqli_bind_param' => array( + '5.3' => false, + '5.4' => true, + 'alternative' => 'mysqli_stmt::bind_param()', + ), + 'mysqli_bind_result' => array( + '5.3' => false, + '5.4' => true, + 'alternative' => 'mysqli_stmt::bind_result()', + ), + 'mysqli_client_encoding' => array( + '5.3' => false, + '5.4' => true, + 'alternative' => 'mysqli::character_set_name()', + ), + 'mysqli_fetch' => array( + '5.3' => false, + '5.4' => true, + 'alternative' => 'mysqli_stmt::fetch()', + ), + 'mysqli_param_count' => array( + '5.3' => false, + '5.4' => true, + 'alternative' => 'mysqli_stmt_param_count()', + ), + 'mysqli_get_metadata' => array( + '5.3' => false, + '5.4' => true, + 'alternative' => 'mysqli_stmt::result_metadata()', + ), + 'mysqli_send_long_data' => array( + '5.3' => false, + '5.4' => true, + 'alternative' => 'mysqli_stmt::send_long_data()', + ), + 'magic_quotes_runtime' => array( + '5.3' => false, + '7.0' => true, + 'alternative' => null, + ), + 'session_register' => array( + '5.3' => false, + '5.4' => true, + 'alternative' => '$_SESSION', + ), + 'session_unregister' => array( + '5.3' => false, + '5.4' => true, + 'alternative' => '$_SESSION', + ), + 'session_is_registered' => array( + '5.3' => false, + '5.4' => true, + 'alternative' => '$_SESSION', + ), + 'set_magic_quotes_runtime' => array( + '5.3' => false, + '7.0' => true, + 'alternative' => null, + ), + 'set_socket_blocking' => array( + '5.3' => false, + '7.0' => true, + 'alternative' => 'stream_set_blocking()', + ), + 'split' => array( + '5.3' => false, + '7.0' => true, + 'alternative' => 'preg_split()', + ), + 'spliti' => array( + '5.3' => false, + '7.0' => true, + 'alternative' => 'preg_split()', + ), + 'sql_regcase' => array( + '5.3' => false, + '7.0' => true, + 'alternative' => null, + ), + 'php_logo_guid' => array( + '5.5' => true, + 'alternative' => null, + ), + 'php_egg_logo_guid' => array( + '5.5' => true, + 'alternative' => null, + ), + 'php_real_logo_guid' => array( + '5.5' => true, + 'alternative' => null, + ), + 'zend_logo_guid' => array( + '5.5' => true, + 'alternative' => null, + ), + 'datefmt_set_timezone_id' => array( + '5.5' => false, + '7.0' => true, + 'alternative' => 'IntlDateFormatter::setTimeZone()', + ), + 'mcrypt_ecb' => array( + '5.5' => false, + '7.0' => true, + 'alternative' => null, + ), + 'mcrypt_cbc' => array( + '5.5' => false, + '7.0' => true, + 'alternative' => null, + ), + 'mcrypt_cfb' => array( + '5.5' => false, + '7.0' => true, + 'alternative' => null, + ), + 'mcrypt_ofb' => array( + '5.5' => false, + '7.0' => true, + 'alternative' => null, + ), + 'ocibindbyname' => array( + '5.4' => false, + 'alternative' => 'oci_bind_by_name()', + ), + 'ocicancel' => array( + '5.4' => false, + 'alternative' => 'oci_cancel()', + ), + 'ocicloselob' => array( + '5.4' => false, + 'alternative' => 'OCI-Lob::close()', + ), + 'ocicollappend' => array( + '5.4' => false, + 'alternative' => 'OCI-Collection::append()', + ), + 'ocicollassign' => array( + '5.4' => false, + 'alternative' => 'OCI-Collection::assign()', + ), + 'ocicollassignelem' => array( + '5.4' => false, + 'alternative' => 'OCI-Collection::assignElem()', + ), + 'ocicollgetelem' => array( + '5.4' => false, + 'alternative' => 'OCI-Collection::getElem()', + ), + 'ocicollmax' => array( + '5.4' => false, + 'alternative' => 'OCI-Collection::max()', + ), + 'ocicollsize' => array( + '5.4' => false, + 'alternative' => 'OCI-Collection::size()', + ), + 'ocicolltrim' => array( + '5.4' => false, + 'alternative' => 'OCI-Collection::trim()', + ), + 'ocicolumnisnull' => array( + '5.4' => false, + 'alternative' => 'oci_field_is_null()', + ), + 'ocicolumnname' => array( + '5.4' => false, + 'alternative' => 'oci_field_name()', + ), + 'ocicolumnprecision' => array( + '5.4' => false, + 'alternative' => 'oci_field_precision()', + ), + 'ocicolumnscale' => array( + '5.4' => false, + 'alternative' => 'oci_field_scale()', + ), + 'ocicolumnsize' => array( + '5.4' => false, + 'alternative' => 'oci_field_size()', + ), + 'ocicolumntype' => array( + '5.4' => false, + 'alternative' => 'oci_field_type()', + ), + 'ocicolumntyperaw' => array( + '5.4' => false, + 'alternative' => 'oci_field_type_raw()', + ), + 'ocicommit' => array( + '5.4' => false, + 'alternative' => 'oci_commit()', + ), + 'ocidefinebyname' => array( + '5.4' => false, + 'alternative' => 'oci_define_by_name()', + ), + 'ocierror' => array( + '5.4' => false, + 'alternative' => 'oci_error()', + ), + 'ociexecute' => array( + '5.4' => false, + 'alternative' => 'oci_execute()', + ), + 'ocifetch' => array( + '5.4' => false, + 'alternative' => 'oci_fetch()', + ), + 'ocifetchinto' => array( + '5.4' => false, + 'alternative' => null, + ), + 'ocifetchstatement' => array( + '5.4' => false, + 'alternative' => 'oci_fetch_all()', + ), + 'ocifreecollection' => array( + '5.4' => false, + 'alternative' => 'OCI-Collection::free()', + ), + 'ocifreecursor' => array( + '5.4' => false, + 'alternative' => 'oci_free_statement()', + ), + 'ocifreedesc' => array( + '5.4' => false, + 'alternative' => 'OCI-Lob::free()', + ), + 'ocifreestatement' => array( + '5.4' => false, + 'alternative' => 'oci_free_statement()', + ), + 'ociinternaldebug' => array( + '5.4' => false, + 'alternative' => 'oci_internal_debug()', + ), + 'ociloadlob' => array( + '5.4' => false, + 'alternative' => 'OCI-Lob::load()', + ), + 'ocilogoff' => array( + '5.4' => false, + 'alternative' => 'oci_close()', + ), + 'ocilogon' => array( + '5.4' => false, + 'alternative' => 'oci_connect()', + ), + 'ocinewcollection' => array( + '5.4' => false, + 'alternative' => 'oci_new_collection()', + ), + 'ocinewcursor' => array( + '5.4' => false, + 'alternative' => 'oci_new_cursor()', + ), + 'ocinewdescriptor' => array( + '5.4' => false, + 'alternative' => 'oci_new_descriptor()', + ), + 'ocinlogon' => array( + '5.4' => false, + 'alternative' => 'oci_new_connect()', + ), + 'ocinumcols' => array( + '5.4' => false, + 'alternative' => 'oci_num_fields()', + ), + 'ociparse' => array( + '5.4' => false, + 'alternative' => 'oci_parse()', + ), + 'ociplogon' => array( + '5.4' => false, + 'alternative' => 'oci_pconnect()', + ), + 'ociresult' => array( + '5.4' => false, + 'alternative' => 'oci_result()', + ), + 'ocirollback' => array( + '5.4' => false, + 'alternative' => 'oci_rollback()', + ), + 'ocirowcount' => array( + '5.4' => false, + 'alternative' => 'oci_num_rows()', + ), + 'ocisavelob' => array( + '5.4' => false, + 'alternative' => 'OCI-Lob::save()', + ), + 'ocisavelobfile' => array( + '5.4' => false, + 'alternative' => 'OCI-Lob::import()', + ), + 'ociserverversion' => array( + '5.4' => false, + 'alternative' => 'oci_server_version()', + ), + 'ocisetprefetch' => array( + '5.4' => false, + 'alternative' => 'oci_set_prefetch()', + ), + 'ocistatementtype' => array( + '5.4' => false, + 'alternative' => 'oci_statement_type()', + ), + 'ociwritelobtofile' => array( + '5.4' => false, + 'alternative' => 'OCI-Lob::export()', + ), + 'ociwritetemporarylob' => array( + '5.4' => false, + 'alternative' => 'OCI-Lob::writeTemporary()', + ), + 'mysqli_get_cache_stats' => array( + '5.4' => true, + 'alternative' => null, + ), + + 'mcrypt_create_iv' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'random_bytes() or OpenSSL', + ), + 'mcrypt_decrypt' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_enc_get_algorithms_name' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_enc_get_block_size' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_enc_get_iv_size' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_enc_get_key_size' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_enc_get_modes_name' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_enc_get_supported_key_sizes' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_enc_is_block_algorithm_mode' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_enc_is_block_algorithm' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_enc_is_block_mode' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_enc_self_test' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_encrypt' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_generic_deinit' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_generic_init' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_generic' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_get_block_size' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_get_cipher_name' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_get_iv_size' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_get_key_size' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_list_algorithms' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_list_modes' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_module_close' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_module_get_algo_block_size' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_module_get_algo_key_size' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_module_get_supported_key_sizes' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_module_is_block_algorithm_mode' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_module_is_block_algorithm' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_module_is_block_mode' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_module_open' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mcrypt_module_self_test' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'mdecrypt_generic' => array( + '7.1' => false, + '7.2' => true, + 'alternative' => 'OpenSSL', + ), + 'jpeg2wbmp' => array( + '7.2' => false, + 'alternative' => 'imagecreatefromjpeg() and imagewbmp()', + ), + 'png2wbmp' => array( + '7.2' => false, + 'alternative' => 'imagecreatefrompng() or imagewbmp()', + ), + 'create_function' => array( + '7.2' => false, + 'alternative' => 'an anonymous function', + ), + 'each' => array( + '7.2' => false, + 'alternative' => 'a foreach loop', + ), + 'gmp_random' => array( + '7.2' => false, + 'alternative' => 'gmp_random_bits() or gmp_random_range()', + ), + 'read_exif_data' => array( + '7.2' => false, + 'alternative' => 'exif_read_data()', + ), + + 'image2wbmp' => array( + '7.3' => false, + 'alternative' => 'imagewbmp()', + ), + 'mbregex_encoding' => array( + '7.3' => false, + 'alternative' => 'mb_regex_encoding()', + ), + 'mbereg' => array( + '7.3' => false, + 'alternative' => 'mb_ereg()', + ), + 'mberegi' => array( + '7.3' => false, + 'alternative' => 'mb_eregi()', + ), + 'mbereg_replace' => array( + '7.3' => false, + 'alternative' => 'mb_ereg_replace()', + ), + 'mberegi_replace' => array( + '7.3' => false, + 'alternative' => 'mb_eregi_replace()', + ), + 'mbsplit' => array( + '7.3' => false, + 'alternative' => 'mb_split()', + ), + 'mbereg_match' => array( + '7.3' => false, + 'alternative' => 'mb_ereg_match()', + ), + 'mbereg_search' => array( + '7.3' => false, + 'alternative' => 'mb_ereg_search()', + ), + 'mbereg_search_pos' => array( + '7.3' => false, + 'alternative' => 'mb_ereg_search_pos()', + ), + 'mbereg_search_regs' => array( + '7.3' => false, + 'alternative' => 'mb_ereg_search_regs()', + ), + 'mbereg_search_init' => array( + '7.3' => false, + 'alternative' => 'mb_ereg_search_init()', + ), + 'mbereg_search_getregs' => array( + '7.3' => false, + 'alternative' => 'mb_ereg_search_getregs()', + ), + 'mbereg_search_getpos' => array( + '7.3' => false, + 'alternative' => 'mb_ereg_search_getpos()', + ), + 'mbereg_search_setpos' => array( + '7.3' => false, + 'alternative' => 'mb_ereg_search_setpos()', + ), + 'fgetss' => array( + '7.3' => false, + 'alternative' => null, + ), + 'gzgetss' => array( + '7.3' => false, + 'alternative' => null, + ), + + 'convert_cyr_string' => array( + '7.4' => false, + 'alternative' => 'mb_convert_encoding(), iconv() or UConverter', + ), + 'ezmlm_hash' => array( + '7.4' => false, + 'alternative' => null, + ), + 'get_magic_quotes_gpc' => array( + '7.4' => false, + 'alternative' => null, + ), + 'get_magic_quotes_runtime' => array( + '7.4' => false, + 'alternative' => null, + ), + 'hebrevc' => array( + '7.4' => false, + 'alternative' => null, + ), + 'is_real' => array( + '7.4' => false, + 'alternative' => 'is_float()', + ), + 'money_format' => array( + '7.4' => false, + 'alternative' => 'NumberFormatter::formatCurrency()', + ), + 'restore_include_path' => array( + '7.4' => false, + 'alternative' => "ini_restore('include_path')", + ), + 'ibase_add_user' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_affected_rows' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_backup' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_blob_add' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_blob_cancel' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_blob_close' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_blob_create' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_blob_echo' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_blob_get' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_blob_import' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_blob_info' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_blob_open' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_close' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_commit_ret' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_commit' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_connect' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_db_info' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_delete_user' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_drop_db' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_errcode' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_errmsg' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_execute' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_fetch_assoc' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_fetch_object' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_fetch_row' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_field_info' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_free_event_handler' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_free_query' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_free_result' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_gen_id' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_maintain_db' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_modify_user' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_name_result' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_num_fields' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_num_params' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_param_info' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_pconnect' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_prepare' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_query' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_restore' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_rollback_ret' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_rollback' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_server_info' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_service_attach' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_service_detach' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_set_event_handler' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_trans' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ibase_wait_event' => array( + '7.4' => true, + 'alternative' => null, + ), + 'ldap_control_paged_result_response' => array( + '7.4' => false, + 'alternative' => 'ldap_search()', + ), + 'ldap_control_paged_result' => array( + '7.4' => false, + 'alternative' => 'ldap_search()', + ), + 'recode_file' => array( + '7.4' => true, + 'alternative' => 'the iconv or mbstring extension', + ), + 'recode_string' => array( + '7.4' => true, + 'alternative' => 'the iconv or mbstring extension', + ), + 'recode' => array( + '7.4' => true, + 'alternative' => 'the iconv or mbstring extension', + ), + 'wddx_add_vars' => array( + '7.4' => true, + 'alternative' => null, + ), + 'wddx_deserialize' => array( + '7.4' => true, + 'alternative' => null, + ), + 'wddx_packet_end' => array( + '7.4' => true, + 'alternative' => null, + ), + 'wddx_packet_start' => array( + '7.4' => true, + 'alternative' => null, + ), + 'wddx_serialize_value' => array( + '7.4' => true, + 'alternative' => null, + ), + 'wddx_serialize_vars' => array( + '7.4' => true, + 'alternative' => null, + ), + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 5.6 + * + * @return array + */ + public function register() + { + // Handle case-insensitivity of function names. + $this->removedFunctions = $this->arrayKeysToLowercase($this->removedFunctions); + + return array(\T_STRING); + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 5.5 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + $ignore = array( + \T_DOUBLE_COLON => true, + \T_OBJECT_OPERATOR => true, + \T_FUNCTION => true, + \T_CLASS => true, + \T_CONST => true, + \T_USE => true, + \T_NS_SEPARATOR => true, + ); + + $prevToken = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true); + if (isset($ignore[$tokens[$prevToken]['code']]) === true) { + // Not a call to a PHP function. + return; + } + + $function = $tokens[$stackPtr]['content']; + $functionLc = strtolower($function); + + if (isset($this->removedFunctions[$functionLc]) === false) { + return; + } + + $itemInfo = array( + 'name' => $function, + 'nameLc' => $functionLc, + ); + $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); + } + + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 7.1.0 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo) + { + return $this->removedFunctions[$itemInfo['nameLc']]; + } + + + /** + * Get the error message template for this sniff. + * + * @since 7.1.0 + * + * @return string + */ + protected function getErrorMsgTemplate() + { + return 'Function %s() is '; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/RequiredToOptionalFunctionParametersSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/RequiredToOptionalFunctionParametersSniff.php new file mode 100644 index 00000000..9c32ccca --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/RequiredToOptionalFunctionParametersSniff.php @@ -0,0 +1,350 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\FunctionUse; + +use PHPCompatibility\AbstractComplexVersionSniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect missing required function parameters in calls to native PHP functions. + * + * Specifically when those function parameters are no longer required in more recent PHP versions. + * + * PHP version All + * + * @link https://www.php.net/manual/en/doc.changelog.php + * + * @since 7.0.3 + * @since 7.1.0 Now extends the `AbstractComplexVersionSniff` instead of the base `Sniff` class. + * @since 9.0.0 Renamed from `RequiredOptionalFunctionParametersSniff` to `RequiredToOptionalFunctionParametersSniff`. + */ +class RequiredToOptionalFunctionParametersSniff extends AbstractComplexVersionSniff +{ + + /** + * A list of function parameters, which were required in older versions and became optional later on. + * + * The array lists : version number with true (required) and false (optional). + * + * The index is the location of the parameter in the parameter list, starting at 0 ! + * If's sufficient to list the last version in which the parameter was still required. + * + * @since 7.0.3 + * + * @var array + */ + protected $functionParameters = array( + 'array_merge' => array( + 0 => array( + 'name' => 'array(s) to merge', + '7.3' => true, + '7.4' => false, + ), + ), + 'array_merge_recursive' => array( + 0 => array( + 'name' => 'array(s) to merge', + '7.3' => true, + '7.4' => false, + ), + ), + 'array_push' => array( + 1 => array( + 'name' => 'element to push', + '7.2' => true, + '7.3' => false, + ), + ), + 'array_unshift' => array( + 1 => array( + 'name' => 'element to prepend', + '7.2' => true, + '7.3' => false, + ), + ), + 'bcscale' => array( + 0 => array( + 'name' => 'scale', + '7.2' => true, + '7.3' => false, + ), + ), + 'ftp_fget' => array( + 3 => array( + 'name' => 'mode', + '7.2' => true, + '7.3' => false, + ), + ), + 'ftp_fput' => array( + 3 => array( + 'name' => 'mode', + '7.2' => true, + '7.3' => false, + ), + ), + 'ftp_get' => array( + 3 => array( + 'name' => 'mode', + '7.2' => true, + '7.3' => false, + ), + ), + 'ftp_nb_fget' => array( + 3 => array( + 'name' => 'mode', + '7.2' => true, + '7.3' => false, + ), + ), + 'ftp_nb_fput' => array( + 3 => array( + 'name' => 'mode', + '7.2' => true, + '7.3' => false, + ), + ), + 'ftp_nb_get' => array( + 3 => array( + 'name' => 'mode', + '7.2' => true, + '7.3' => false, + ), + ), + 'ftp_nb_put' => array( + 3 => array( + 'name' => 'mode', + '7.2' => true, + '7.3' => false, + ), + ), + 'ftp_put' => array( + 3 => array( + 'name' => 'mode', + '7.2' => true, + '7.3' => false, + ), + ), + 'getenv' => array( + 0 => array( + 'name' => 'varname', + '7.0' => true, + '7.1' => false, + ), + ), + 'preg_match_all' => array( + 2 => array( + 'name' => 'matches', + '5.3' => true, + '5.4' => false, + ), + ), + 'stream_socket_enable_crypto' => array( + 2 => array( + 'name' => 'crypto_type', + '5.5' => true, + '5.6' => false, + ), + ), + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.3 + * + * @return array + */ + public function register() + { + // Handle case-insensitivity of function names. + $this->functionParameters = $this->arrayKeysToLowercase($this->functionParameters); + + return array(\T_STRING); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.3 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + $ignore = array( + \T_DOUBLE_COLON => true, + \T_OBJECT_OPERATOR => true, + \T_FUNCTION => true, + \T_CONST => true, + \T_NEW => true, + ); + + $prevToken = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true); + if (isset($ignore[$tokens[$prevToken]['code']]) === true) { + // Not a call to a PHP function. + return; + } + + $function = $tokens[$stackPtr]['content']; + $functionLc = strtolower($function); + + if (isset($this->functionParameters[$functionLc]) === false) { + return; + } + + $parameterCount = $this->getFunctionCallParameterCount($phpcsFile, $stackPtr); + $openParenthesis = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true); + + // If the parameter count returned > 0, we know there will be valid open parenthesis. + if ($parameterCount === 0 && $tokens[$openParenthesis]['code'] !== \T_OPEN_PARENTHESIS) { + return; + } + + $parameterOffsetFound = $parameterCount - 1; + + foreach ($this->functionParameters[$functionLc] as $offset => $parameterDetails) { + if ($offset > $parameterOffsetFound) { + $itemInfo = array( + 'name' => $function, + 'nameLc' => $functionLc, + 'offset' => $offset, + ); + $this->handleFeature($phpcsFile, $openParenthesis, $itemInfo); + } + } + } + + + /** + * Determine whether an error/warning should be thrown for an item based on collected information. + * + * @since 7.1.0 + * + * @param array $errorInfo Detail information about an item. + * + * @return bool + */ + protected function shouldThrowError(array $errorInfo) + { + return ($errorInfo['requiredVersion'] !== ''); + } + + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 7.1.0 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo) + { + return $this->functionParameters[$itemInfo['nameLc']][$itemInfo['offset']]; + } + + + /** + * Get an array of the non-PHP-version array keys used in a sub-array. + * + * @since 7.1.0 + * + * @return array + */ + protected function getNonVersionArrayKeys() + { + return array('name'); + } + + + /** + * Retrieve the relevant detail (version) information for use in an error message. + * + * @since 7.1.0 + * + * @param array $itemArray Version and other information about the item. + * @param array $itemInfo Base information about the item. + * + * @return array + */ + public function getErrorInfo(array $itemArray, array $itemInfo) + { + $errorInfo = array( + 'paramName' => '', + 'requiredVersion' => '', + ); + + $versionArray = $this->getVersionArray($itemArray); + + if (empty($versionArray) === false) { + foreach ($versionArray as $version => $required) { + if ($required === true && $this->supportsBelow($version) === true) { + $errorInfo['requiredVersion'] = $version; + } + } + } + + $errorInfo['paramName'] = $itemArray['name']; + + return $errorInfo; + } + + + /** + * Get the error message template for this sniff. + * + * @since 7.1.0 + * + * @return string + */ + protected function getErrorMsgTemplate() + { + return 'The "%s" parameter for function %s() is missing, but was required for PHP version %s and lower'; + } + + + /** + * Generates the error or warning for this item. + * + * @since 7.1.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the relevant token in + * the stack. + * @param array $itemInfo Base information about the item. + * @param array $errorInfo Array with detail (version) information + * relevant to the item. + * + * @return void + */ + public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo) + { + $error = $this->getErrorMsgTemplate(); + $errorCode = $this->stringToErrorCode($itemInfo['name'] . '_' . $errorInfo['paramName']) . 'Missing'; + $data = array( + $errorInfo['paramName'], + $itemInfo['name'], + $errorInfo['requiredVersion'], + ); + + $phpcsFile->addError($error, $stackPtr, $errorCode, $data); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Generators/NewGeneratorReturnSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Generators/NewGeneratorReturnSniff.php new file mode 100644 index 00000000..98ca2461 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Generators/NewGeneratorReturnSniff.php @@ -0,0 +1,158 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Generators; + +use PHPCompatibility\Sniff; +use PHPCompatibility\PHPCSHelper; +use PHP_CodeSniffer_File as File; + +/** + * As of PHP 7.0, a `return` statement can be used within a generator for a final expression to be returned. + * + * PHP version 7.0 + * + * @link https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.generator-return-expressions + * @link https://wiki.php.net/rfc/generator-return-expressions + * @link https://www.php.net/manual/en/language.generators.syntax.php + * + * @since 8.2.0 + */ +class NewGeneratorReturnSniff extends Sniff +{ + /** + * Scope conditions within which a yield can exist. + * + * @since 9.0.0 + * + * @var array + */ + private $validConditions = array( + \T_FUNCTION => \T_FUNCTION, + \T_CLOSURE => \T_CLOSURE, + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 8.2.0 + * + * @return array + */ + public function register() + { + $targets = array( + \T_YIELD, + ); + + /* + * The `yield` keyword was introduced in PHP 5.5 with the token T_YIELD. + * The `yield from` keyword was introduced in PHP 7.0 and tokenizes as + * "T_YIELD T_WHITESPACE T_STRING". + * + * Pre-PHPCS 3.1.0, the T_YIELD token was not correctly back-filled for PHP < 5.5. + * Also, as of PHPCS 3.1.0, the PHPCS tokenizer adds a new T_YIELD_FROM + * token. + * + * So for PHP 5.3-5.4 icw PHPCS < 3.1.0, we need to look for T_STRING with content "yield". + * For PHP 5.5+ we need to look for T_YIELD. + * For PHPCS 3.1.0+, we also need to look for T_YIELD_FROM. + */ + if (version_compare(\PHP_VERSION_ID, '50500', '<') === true + && version_compare(PHPCSHelper::getVersion(), '3.1.0', '<') === true + ) { + $targets[] = \T_STRING; + } + + if (\defined('T_YIELD_FROM')) { + $targets[] = \T_YIELD_FROM; + } + + return $targets; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void|int Void or a stack pointer to skip forward. + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('5.6') !== true) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + if ($tokens[$stackPtr]['code'] === \T_STRING + && $tokens[$stackPtr]['content'] !== 'yield' + ) { + return; + } + + if (empty($tokens[$stackPtr]['conditions']) === true) { + return; + } + + // Walk the condition from inner to outer to see if we can find a valid function/closure scope. + $conditions = array_reverse($tokens[$stackPtr]['conditions'], true); + foreach ($conditions as $ptr => $type) { + if (isset($this->validConditions[$type]) === true) { + $function = $ptr; + break; + } + } + + if (isset($function) === false) { + // Yield outside function scope, fatal error, but not our concern. + return; + } + + if (isset($tokens[$function]['scope_opener'], $tokens[$function]['scope_closer']) === false) { + // Can't reliably determine start/end of function scope. + return; + } + + $targets = array(\T_RETURN, \T_CLOSURE, \T_FUNCTION, \T_CLASS); + if (\defined('T_ANON_CLASS')) { + $targets[] = \T_ANON_CLASS; + } + + $current = $tokens[$function]['scope_opener']; + + while (($current = $phpcsFile->findNext($targets, ($current + 1), $tokens[$function]['scope_closer'])) !== false) { + if ($tokens[$current]['code'] === \T_RETURN) { + $phpcsFile->addError( + 'Returning a final expression from a generator was not supported in PHP 5.6 or earlier', + $current, + 'ReturnFound' + ); + + return $tokens[$function]['scope_closer']; + } + + // Found a nested scope in which return can exist without problems. + if (isset($tokens[$current]['scope_closer'])) { + // Skip past the nested scope. + $current = $tokens[$current]['scope_closer']; + } + } + + // Don't examine this function again. + return $tokens[$function]['scope_closer']; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/IniDirectives/NewIniDirectivesSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/IniDirectives/NewIniDirectivesSniff.php new file mode 100644 index 00000000..cd40fa68 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/IniDirectives/NewIniDirectivesSniff.php @@ -0,0 +1,855 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\IniDirectives; + +use PHPCompatibility\AbstractNewFeatureSniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect the use of new INI directives through `ini_set()` or `ini_get()`. + * + * PHP version All + * + * @link https://www.php.net/manual/en/ini.list.php + * @link https://www.php.net/manual/en/ini.core.php + * + * @since 5.5 + * @since 7.0.7 When a new directive is used with `ini_set()`, the sniff will now throw an error + * instead of a warning. + * @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class.. + */ +class NewIniDirectivesSniff extends AbstractNewFeatureSniff +{ + /** + * A list of new INI directives + * + * The array lists : version number with false (not present) or true (present). + * If's sufficient to list the first version where the ini directive appears. + * + * @since 5.5 + * @since 7.0.3 Support for 'alternative' has been added. + * + * @var array(string) + */ + protected $newIniDirectives = array( + 'auto_globals_jit' => array( + '4.4' => false, + '5.0' => true, + ), + 'com.code_page' => array( + '4.4' => false, + '5.0' => true, + ), + 'date.default_latitude' => array( + '4.4' => false, + '5.0' => true, + ), + 'date.default_longitude' => array( + '4.4' => false, + '5.0' => true, + ), + 'date.sunrise_zenith' => array( + '4.4' => false, + '5.0' => true, + ), + 'date.sunset_zenith' => array( + '4.4' => false, + '5.0' => true, + ), + 'ibase.default_charset' => array( + '4.4' => false, + '5.0' => true, + ), + 'ibase.default_db' => array( + '4.4' => false, + '5.0' => true, + ), + 'mail.force_extra_parameters' => array( + '4.4' => false, + '5.0' => true, + ), + 'mime_magic.debug' => array( + '4.4' => false, + '5.0' => true, + ), + 'mysqli.max_links' => array( + '4.4' => false, + '5.0' => true, + ), + 'mysqli.default_port' => array( + '4.4' => false, + '5.0' => true, + ), + 'mysqli.default_socket' => array( + '4.4' => false, + '5.0' => true, + ), + 'mysqli.default_host' => array( + '4.4' => false, + '5.0' => true, + ), + 'mysqli.default_user' => array( + '4.4' => false, + '5.0' => true, + ), + 'mysqli.default_pw' => array( + '4.4' => false, + '5.0' => true, + ), + 'report_zend_debug' => array( + '4.4' => false, + '5.0' => true, + ), + 'session.hash_bits_per_character' => array( + '4.4' => false, + '5.0' => true, + ), + 'session.hash_function' => array( + '4.4' => false, + '5.0' => true, + ), + 'soap.wsdl_cache_dir' => array( + '4.4' => false, + '5.0' => true, + ), + 'soap.wsdl_cache_enabled' => array( + '4.4' => false, + '5.0' => true, + ), + 'soap.wsdl_cache_ttl' => array( + '4.4' => false, + '5.0' => true, + ), + 'sqlite.assoc_case' => array( + '4.4' => false, + '5.0' => true, + ), + 'tidy.clean_output' => array( + '4.4' => false, + '5.0' => true, + ), + 'tidy.default_config' => array( + '4.4' => false, + '5.0' => true, + ), + 'zend.ze1_compatibility_mode' => array( + '4.4' => false, + '5.0' => true, + ), + + 'date.timezone' => array( + '5.0' => false, + '5.1' => true, + ), + 'detect_unicode' => array( + '5.0' => false, + '5.1' => true, + ), + 'fbsql.batchsize' => array( + '5.0' => false, + '5.1' => true, + 'alternative' => 'fbsql.batchSize', + ), + 'realpath_cache_size' => array( + '5.0' => false, + '5.1' => true, + ), + 'realpath_cache_ttl' => array( + '5.0' => false, + '5.1' => true, + ), + + 'mbstring.strict_detection' => array( + '5.1.1' => false, + '5.1.2' => true, + ), + 'mssql.charset' => array( + '5.1.1' => false, + '5.1.2' => true, + ), + + 'gd.jpeg_ignore_warning' => array( + '5.1.2' => false, + '5.1.3' => true, + ), + + 'fbsql.show_timestamp_decimals' => array( + '5.1.4' => false, + '5.1.5' => true, + ), + 'soap.wsdl_cache' => array( + '5.1.4' => false, + '5.1.5' => true, + ), + 'soap.wsdl_cache_limit' => array( + '5.1.4' => false, + '5.1.5' => true, + ), + + 'allow_url_include' => array( + '5.1' => false, + '5.2' => true, + ), + 'filter.default' => array( + '5.1' => false, + '5.2' => true, + ), + 'filter.default_flags' => array( + '5.1' => false, + '5.2' => true, + ), + 'pcre.backtrack_limit' => array( + '5.1' => false, + '5.2' => true, + ), + 'pcre.recursion_limit' => array( + '5.1' => false, + '5.2' => true, + ), + 'session.cookie_httponly' => array( + '5.1' => false, + '5.2' => true, + ), + + 'cgi.check_shebang_line' => array( + '5.2.0' => false, + '5.2.1' => true, + ), + + 'max_input_nesting_level' => array( + '5.2.2' => false, + '5.2.3' => true, + ), + + 'mysqli.allow_local_infile' => array( + '5.2.3' => false, + '5.2.4' => true, + ), + + 'max_file_uploads' => array( + '5.2.11' => false, + '5.2.12' => true, + ), + + 'cgi.discard_path' => array( + '5.2' => false, + '5.3' => true, + ), + 'exit_on_timeout' => array( + '5.2' => false, + '5.3' => true, + ), + 'intl.default_locale' => array( + '5.2' => false, + '5.3' => true, + ), + 'intl.error_level' => array( + '5.2' => false, + '5.3' => true, + ), + 'mail.add_x_header' => array( + '5.2' => false, + '5.3' => true, + ), + 'mail.log' => array( + '5.2' => false, + '5.3' => true, + ), + 'mbstring.http_output_conv_mimetype' => array( + '5.2' => false, + '5.3' => true, + ), + 'mysqli.allow_persistent' => array( + '5.2' => false, + '5.3' => true, + ), + 'mysqli.cache_size' => array( + '5.2' => false, + '5.3' => true, + ), + 'mysqli.max_persistent' => array( + '5.2' => false, + '5.3' => true, + ), + 'mysqlnd.collect_memory_statistics' => array( + '5.2' => false, + '5.3' => true, + ), + 'mysqlnd.collect_statistics' => array( + '5.2' => false, + '5.3' => true, + ), + 'mysqlnd.debug' => array( + '5.2' => false, + '5.3' => true, + ), + 'mysqlnd.net_read_buffer_size' => array( + '5.2' => false, + '5.3' => true, + ), + 'odbc.default_cursortype' => array( + '5.2' => false, + '5.3' => true, + ), + 'request_order' => array( + '5.2' => false, + '5.3' => true, + ), + 'user_ini.cache_ttl' => array( + '5.2' => false, + '5.3' => true, + ), + 'user_ini.filename' => array( + '5.2' => false, + '5.3' => true, + ), + 'zend.enable_gc' => array( + '5.2' => false, + '5.3' => true, + ), + + 'curl.cainfo' => array( + '5.3.6' => false, + '5.3.7' => true, + ), + + 'max_input_vars' => array( + '5.3.8' => false, + '5.3.9' => true, + ), + + 'sqlite3.extension_dir' => array( + '5.3.10' => false, + '5.3.11' => true, + ), + + 'cli.pager' => array( + '5.3' => false, + '5.4' => true, + ), + 'cli.prompt' => array( + '5.3' => false, + '5.4' => true, + ), + 'cli_server.color' => array( + '5.3' => false, + '5.4' => true, + ), + 'enable_post_data_reading' => array( + '5.3' => false, + '5.4' => true, + ), + 'mysqlnd.mempool_default_size' => array( + '5.3' => false, + '5.4' => true, + ), + 'mysqlnd.net_cmd_buffer_size' => array( + '5.3' => false, + '5.4' => true, + ), + 'mysqlnd.net_read_timeout' => array( + '5.3' => false, + '5.4' => true, + ), + 'phar.cache_list' => array( + '5.3' => false, + '5.4' => true, + ), + 'session.upload_progress.enabled' => array( + '5.3' => false, + '5.4' => true, + ), + 'session.upload_progress.cleanup' => array( + '5.3' => false, + '5.4' => true, + ), + 'session.upload_progress.name' => array( + '5.3' => false, + '5.4' => true, + ), + 'session.upload_progress.freq' => array( + '5.3' => false, + '5.4' => true, + ), + 'session.upload_progress.min_freq' => array( + '5.3' => false, + '5.4' => true, + ), + 'session.upload_progress.prefix' => array( + '5.3' => false, + '5.4' => true, + ), + 'windows_show_crt_warning' => array( + '5.3' => false, + '5.4' => true, + ), + 'zend.detect_unicode' => array( + '5.3' => false, + '5.4' => true, + 'alternative' => 'detect_unicode', + ), + 'zend.multibyte' => array( + '5.3' => false, + '5.4' => true, + ), + 'zend.script_encoding' => array( + '5.3' => false, + '5.4' => true, + ), + 'zend.signal_check' => array( + '5.3' => false, + '5.4' => true, + ), + 'mysqlnd.log_mask' => array( + '5.3' => false, + '5.4' => true, + ), + + 'intl.use_exceptions' => array( + '5.4' => false, + '5.5' => true, + ), + 'mysqlnd.sha256_server_public_key' => array( + '5.4' => false, + '5.5' => true, + ), + 'mysqlnd.trace_alloc' => array( + '5.4' => false, + '5.5' => true, + ), + 'sys_temp_dir' => array( + '5.4' => false, + '5.5' => true, + ), + 'xsl.security_prefs' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.enable' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.enable_cli' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.memory_consumption' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.interned_strings_buffer' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.max_accelerated_files' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.max_wasted_percentage' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.use_cwd' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.validate_timestamps' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.revalidate_freq' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.revalidate_path' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.save_comments' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.load_comments' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.fast_shutdown' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.enable_file_override' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.optimization_level' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.inherited_hack' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.dups_fix' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.blacklist_filename' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.max_file_size' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.consistency_checks' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.force_restart_timeout' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.error_log' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.log_verbosity_level' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.preferred_memory_model' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.protect_memory' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.mmap_base' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.restrict_api' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.file_update_protection' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.huge_code_pages' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.lockfile_path' => array( + '5.4' => false, + '5.5' => true, + ), + 'opcache.opt_debug_level' => array( + '5.4' => false, + '5.5' => true, + ), + + 'session.use_strict_mode' => array( + '5.5.1' => false, + '5.5.2' => true, + ), + + 'mysqli.rollback_on_cached_plink' => array( + '5.5' => false, + '5.6' => true, + ), + + 'assert.exception' => array( + '5.6' => false, + '7.0' => true, + ), + 'pcre.jit' => array( + '5.6' => false, + '7.0' => true, + ), + 'session.lazy_write' => array( + '5.6' => false, + '7.0' => true, + ), + 'zend.assertions' => array( + '5.6' => false, + '7.0' => true, + ), + 'opcache.file_cache' => array( + '5.6' => false, + '7.0' => true, + ), + 'opcache.file_cache_only' => array( + '5.6' => false, + '7.0' => true, + ), + 'opcache.file_cache_consistency_checks' => array( + '5.6' => false, + '7.0' => true, + ), + 'opcache.file_cache_fallback' => array( + '5.6' => false, + '7.0' => true, + ), // Windows only. + + 'opcache.validate_permission' => array( + '7.0.13' => false, + '7.0.14' => true, + ), + 'opcache.validate_root' => array( + '7.0.13' => false, + '7.0.14' => true, + ), + + 'hard_timeout' => array( + '7.0' => false, + '7.1' => true, + ), + 'session.sid_length' => array( + '7.0' => false, + '7.1' => true, + ), + 'session.sid_bits_per_character' => array( + '7.0' => false, + '7.1' => true, + ), + 'session.trans_sid_hosts' => array( + '7.0' => false, + '7.1' => true, + ), + 'session.trans_sid_tags' => array( + '7.0' => false, + '7.1' => true, + ), + 'url_rewriter.hosts' => array( + '7.0' => false, + '7.1' => true, + ), + + // Introduced in PHP 7.1.25, 7.2.13, 7.3.0. + 'imap.enable_insecure_rsh' => array( + '7.1.24' => false, + '7.1.25' => true, + ), + + 'syslog.facility' => array( + '7.2' => false, + '7.3' => true, + ), + 'syslog.filter' => array( + '7.2' => false, + '7.3' => true, + ), + 'syslog.ident' => array( + '7.2' => false, + '7.3' => true, + ), + 'session.cookie_samesite' => array( + '7.2' => false, + '7.3' => true, + ), + + 'ffi.enable' => array( + '7.3' => false, + '7.4' => true, + ), + 'ffi.preload' => array( + '7.3' => false, + '7.4' => true, + ), + 'opcache.cache_id' => array( + '7.3' => false, + '7.4' => true, + ), + 'opcache.preload' => array( + '7.3' => false, + '7.4' => true, + ), + 'zend.exception_ignore_args' => array( + '7.3' => false, + '7.4' => true, + ), + ); + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 5.5 + * + * @return array + */ + public function register() + { + return array(\T_STRING); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 5.5 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + $ignore = array( + \T_DOUBLE_COLON => true, + \T_OBJECT_OPERATOR => true, + \T_FUNCTION => true, + \T_CONST => true, + ); + + $prevToken = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true); + if (isset($ignore[$tokens[$prevToken]['code']]) === true) { + // Not a call to a PHP function. + return; + } + + $functionLc = strtolower($tokens[$stackPtr]['content']); + if (isset($this->iniFunctions[$functionLc]) === false) { + return; + } + + $iniToken = $this->getFunctionCallParameter($phpcsFile, $stackPtr, $this->iniFunctions[$functionLc]); + if ($iniToken === false) { + return; + } + + $filteredToken = $this->stripQuotes($iniToken['raw']); + if (isset($this->newIniDirectives[$filteredToken]) === false) { + return; + } + + $itemInfo = array( + 'name' => $filteredToken, + 'functionLc' => $functionLc, + ); + $this->handleFeature($phpcsFile, $iniToken['end'], $itemInfo); + } + + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 7.1.0 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo) + { + return $this->newIniDirectives[$itemInfo['name']]; + } + + + /** + * Get an array of the non-PHP-version array keys used in a sub-array. + * + * @since 7.1.0 + * + * @return array + */ + protected function getNonVersionArrayKeys() + { + return array('alternative'); + } + + + /** + * Retrieve the relevant detail (version) information for use in an error message. + * + * @since 7.1.0 + * + * @param array $itemArray Version and other information about the item. + * @param array $itemInfo Base information about the item. + * + * @return array + */ + public function getErrorInfo(array $itemArray, array $itemInfo) + { + $errorInfo = parent::getErrorInfo($itemArray, $itemInfo); + $errorInfo['alternative'] = ''; + + if (isset($itemArray['alternative']) === true) { + $errorInfo['alternative'] = $itemArray['alternative']; + } + + // Lower error level to warning if the function used was ini_get. + if ($errorInfo['error'] === true && $itemInfo['functionLc'] === 'ini_get') { + $errorInfo['error'] = false; + } + + return $errorInfo; + } + + + /** + * Get the error message template for this sniff. + * + * @since 7.1.0 + * + * @return string + */ + protected function getErrorMsgTemplate() + { + return "INI directive '%s' is not present in PHP version %s or earlier"; + } + + + /** + * Allow for concrete child classes to filter the error message before it's passed to PHPCS. + * + * @since 7.1.0 + * + * @param string $error The error message which was created. + * @param array $itemInfo Base information about the item this error message applies to. + * @param array $errorInfo Detail information about an item this error message applies to. + * + * @return string + */ + protected function filterErrorMsg($error, array $itemInfo, array $errorInfo) + { + if ($errorInfo['alternative'] !== '') { + $error .= ". This directive was previously called '%s'."; + } + + return $error; + } + + + /** + * Allow for concrete child classes to filter the error data before it's passed to PHPCS. + * + * @since 7.1.0 + * + * @param array $data The error data array which was created. + * @param array $itemInfo Base information about the item this error message applies to. + * @param array $errorInfo Detail information about an item this error message applies to. + * + * @return array + */ + protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) + { + if ($errorInfo['alternative'] !== '') { + $data[] = $errorInfo['alternative']; + } + + return $data; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/IniDirectives/RemovedIniDirectivesSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/IniDirectives/RemovedIniDirectivesSniff.php new file mode 100644 index 00000000..a6928ae0 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/IniDirectives/RemovedIniDirectivesSniff.php @@ -0,0 +1,424 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\IniDirectives; + +use PHPCompatibility\AbstractRemovedFeatureSniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect the use of deprecated and removed INI directives through `ini_set()` or `ini_get()`. + * + * PHP version All + * + * @link https://www.php.net/manual/en/ini.list.php + * @link https://www.php.net/manual/en/ini.core.php + * + * @since 5.5 + * @since 7.0.0 This sniff now throws a warning (deprecated) or an error (removed) depending + * on the `testVersion` set. Previously it would always throw a warning. + * @since 7.0.1 The sniff will now only throw warnings for `ini_get()`. + * @since 7.1.0 Now extends the `AbstractRemovedFeatureSniff` instead of the base `Sniff` class. + * @since 9.0.0 Renamed from `DeprecatedIniDirectivesSniff` to `RemovedIniDirectivesSniff`. + */ +class RemovedIniDirectivesSniff extends AbstractRemovedFeatureSniff +{ + /** + * A list of deprecated/removed INI directives. + * + * The array lists : version number with false (deprecated) and true (removed). + * If's sufficient to list the first version where the ini directive was deprecated/removed. + * + * @since 5.5 + * @since 7.0.3 Support for 'alternative' has been added. + * + * @var array(string) + */ + protected $deprecatedIniDirectives = array( + 'fbsql.batchSize' => array( + '5.1' => true, + 'alternative' => 'fbsql.batchsize', + ), + 'pfpro.defaulthost' => array( + '5.1' => true, + ), + 'pfpro.defaultport' => array( + '5.1' => true, + ), + 'pfpro.defaulttimeout' => array( + '5.1' => true, + ), + 'pfpro.proxyaddress' => array( + '5.1' => true, + ), + 'pfpro.proxyport' => array( + '5.1' => true, + ), + 'pfpro.proxylogon' => array( + '5.1' => true, + ), + 'pfpro.proxypassword' => array( + '5.1' => true, + ), + + 'ifx.allow_persistent' => array( + '5.2.1' => true, + ), + 'ifx.blobinfile' => array( + '5.2.1' => true, + ), + 'ifx.byteasvarchar' => array( + '5.2.1' => true, + ), + 'ifx.charasvarchar' => array( + '5.2.1' => true, + ), + 'ifx.default_host' => array( + '5.2.1' => true, + ), + 'ifx.default_password' => array( + '5.2.1' => true, + ), + 'ifx.default_user' => array( + '5.2.1' => true, + ), + 'ifx.max_links' => array( + '5.2.1' => true, + ), + 'ifx.max_persistent' => array( + '5.2.1' => true, + ), + 'ifx.nullformat' => array( + '5.2.1' => true, + ), + 'ifx.textasvarchar' => array( + '5.2.1' => true, + ), + + 'zend.ze1_compatibility_mode' => array( + '5.3' => true, + ), + + 'allow_call_time_pass_reference' => array( + '5.3' => false, + '5.4' => true, + ), + 'define_syslog_variables' => array( + '5.3' => false, + '5.4' => true, + ), + 'detect_unicode' => array( + '5.4' => true, + 'alternative' => 'zend.detect_unicode', + ), + 'highlight.bg' => array( + '5.3' => false, + '5.4' => true, + ), + 'magic_quotes_gpc' => array( + '5.3' => false, + '5.4' => true, + ), + 'magic_quotes_runtime' => array( + '5.3' => false, + '5.4' => true, + ), + 'magic_quotes_sybase' => array( + '5.3' => false, + '5.4' => true, + ), + 'mbstring.script_encoding' => array( + '5.4' => true, + 'alternative' => 'zend.script_encoding', + ), + 'register_globals' => array( + '5.3' => false, + '5.4' => true, + ), + 'register_long_arrays' => array( + '5.3' => false, + '5.4' => true, + ), + 'safe_mode' => array( + '5.3' => false, + '5.4' => true, + ), + 'safe_mode_allowed_env_vars' => array( + '5.3' => false, + '5.4' => true, + ), + 'safe_mode_exec_dir' => array( + '5.3' => false, + '5.4' => true, + ), + 'safe_mode_gid' => array( + '5.3' => false, + '5.4' => true, + ), + 'safe_mode_include_dir' => array( + '5.3' => false, + '5.4' => true, + ), + 'safe_mode_protected_env_vars' => array( + '5.3' => false, + '5.4' => true, + ), + 'session.bug_compat_42' => array( + '5.3' => false, + '5.4' => true, + ), + 'session.bug_compat_warn' => array( + '5.3' => false, + '5.4' => true, + ), + 'y2k_compliance' => array( + '5.3' => false, + '5.4' => true, + ), + + 'always_populate_raw_post_data' => array( + '5.6' => false, + '7.0' => true, + ), + 'iconv.input_encoding' => array( + '5.6' => false, + ), + 'iconv.output_encoding' => array( + '5.6' => false, + ), + 'iconv.internal_encoding' => array( + '5.6' => false, + ), + 'mbstring.http_input' => array( + '5.6' => false, + ), + 'mbstring.http_output' => array( + '5.6' => false, + ), + 'mbstring.internal_encoding' => array( + '5.6' => false, + ), + + 'asp_tags' => array( + '7.0' => true, + ), + 'xsl.security_prefs' => array( + '7.0' => true, + ), + 'opcache.load_comments' => array( + '7.0' => true, + ), + + 'mcrypt.algorithms_dir' => array( + '7.1' => false, + '7.2' => true, + ), + 'mcrypt.modes_dir' => array( + '7.1' => false, + '7.2' => true, + ), + 'session.entropy_file' => array( + '7.1' => true, + ), + 'session.entropy_length' => array( + '7.1' => true, + ), + 'session.hash_function' => array( + '7.1' => true, + ), + 'session.hash_bits_per_character' => array( + '7.1' => true, + ), + + 'mbstring.func_overload' => array( + '7.2' => false, + ), + 'sql.safe_mode' => array( + '7.2' => true, + ), + 'track_errors' => array( + '7.2' => false, + ), + 'opcache.fast_shutdown' => array( + '7.2' => true, + ), + + 'birdstep.max_links' => array( + '7.3' => true, + ), + 'opcache.inherited_hack' => array( + '5.3' => false, // Soft deprecated, i.e. ignored. + '7.3' => true, + ), + 'pdo_odbc.db2_instance_name' => array( + '7.3' => false, // Has been marked as deprecated in the manual from before this time. Now hard-deprecated. + ), + + 'allow_url_include' => array( + '7.4' => false, + ), + 'ibase.allow_persistent' => array( + '7.4' => true, + ), + 'ibase.max_persistent' => array( + '7.4' => true, + ), + 'ibase.max_links' => array( + '7.4' => true, + ), + 'ibase.default_db' => array( + '7.4' => true, + ), + 'ibase.default_user' => array( + '7.4' => true, + ), + 'ibase.default_password' => array( + '7.4' => true, + ), + 'ibase.default_charset' => array( + '7.4' => true, + ), + 'ibase.timestampformat' => array( + '7.4' => true, + ), + 'ibase.dateformat' => array( + '7.4' => true, + ), + 'ibase.timeformat' => array( + '7.4' => true, + ), + ); + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 5.5 + * + * @return array + */ + public function register() + { + return array(\T_STRING); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 5.5 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + $ignore = array( + \T_DOUBLE_COLON => true, + \T_OBJECT_OPERATOR => true, + \T_FUNCTION => true, + \T_CONST => true, + ); + + $prevToken = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true); + if (isset($ignore[$tokens[$prevToken]['code']]) === true) { + // Not a call to a PHP function. + return; + } + + $functionLc = strtolower($tokens[$stackPtr]['content']); + if (isset($this->iniFunctions[$functionLc]) === false) { + return; + } + + $iniToken = $this->getFunctionCallParameter($phpcsFile, $stackPtr, $this->iniFunctions[$functionLc]); + if ($iniToken === false) { + return; + } + + $filteredToken = $this->stripQuotes($iniToken['raw']); + if (isset($this->deprecatedIniDirectives[$filteredToken]) === false) { + return; + } + + $itemInfo = array( + 'name' => $filteredToken, + 'functionLc' => $functionLc, + ); + $this->handleFeature($phpcsFile, $iniToken['end'], $itemInfo); + } + + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 7.1.0 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo) + { + return $this->deprecatedIniDirectives[$itemInfo['name']]; + } + + + /** + * Retrieve the relevant detail (version) information for use in an error message. + * + * @since 7.1.0 + * + * @param array $itemArray Version and other information about the item. + * @param array $itemInfo Base information about the item. + * + * @return array + */ + public function getErrorInfo(array $itemArray, array $itemInfo) + { + $errorInfo = parent::getErrorInfo($itemArray, $itemInfo); + + // Lower error level to warning if the function used was ini_get. + if ($errorInfo['error'] === true && $itemInfo['functionLc'] === 'ini_get') { + $errorInfo['error'] = false; + } + + return $errorInfo; + } + + + /** + * Get the error message template for this sniff. + * + * @since 7.1.0 + * + * @return string + */ + protected function getErrorMsgTemplate() + { + return "INI directive '%s' is "; + } + + + /** + * Get the error message template for suggesting an alternative for a specific sniff. + * + * @since 7.1.0 + * + * @return string + */ + protected function getAlternativeOptionTemplate() + { + return str_replace('%s', "'%s'", parent::getAlternativeOptionTemplate()); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/InitialValue/NewConstantArraysUsingConstSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/InitialValue/NewConstantArraysUsingConstSniff.php new file mode 100644 index 00000000..c9c2225f --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/InitialValue/NewConstantArraysUsingConstSniff.php @@ -0,0 +1,82 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\InitialValue; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect declaration of constants using the `const` keyword with a (constant) array value + * as supported since PHP 5.6. + * + * PHP version 5.6 + * + * @link https://wiki.php.net/rfc/const_scalar_exprs + * @link https://www.php.net/manual/en/language.constants.syntax.php + * + * @since 7.1.4 + * @since 9.0.0 Renamed from `ConstantArraysUsingConstSniff` to `NewConstantArraysUsingConstSniff`. + */ +class NewConstantArraysUsingConstSniff extends Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.1.4 + * + * @return array + */ + public function register() + { + return array(\T_CONST); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.1.4 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('5.5') !== true) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $find = array( + \T_ARRAY => \T_ARRAY, + \T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY, + ); + + while (($hasArray = $phpcsFile->findNext($find, ($stackPtr + 1), null, false, null, true)) !== false) { + $phpcsFile->addError( + 'Constant arrays using the "const" keyword are not allowed in PHP 5.5 or earlier', + $hasArray, + 'Found' + ); + + // Skip past the content of the array. + $stackPtr = $hasArray; + if ($tokens[$hasArray]['code'] === \T_OPEN_SHORT_ARRAY && isset($tokens[$hasArray]['bracket_closer'])) { + $stackPtr = $tokens[$hasArray]['bracket_closer']; + } elseif ($tokens[$hasArray]['code'] === \T_ARRAY && isset($tokens[$hasArray]['parenthesis_closer'])) { + $stackPtr = $tokens[$hasArray]['parenthesis_closer']; + } + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/InitialValue/NewConstantArraysUsingDefineSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/InitialValue/NewConstantArraysUsingDefineSniff.php new file mode 100644 index 00000000..7b996728 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/InitialValue/NewConstantArraysUsingDefineSniff.php @@ -0,0 +1,101 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\InitialValue; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect declaration of constants using `define()` with a (constant) array value + * as supported since PHP 7.0. + * + * PHP version 7.0 + * + * @link https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.define-array + * @link https://www.php.net/manual/en/language.constants.syntax.php + * + * @since 7.0.0 + * @since 9.0.0 Renamed from `ConstantArraysUsingDefineSniff` to `NewConstantArraysUsingDefineSniff`. + */ +class NewConstantArraysUsingDefineSniff extends Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.0 + * + * @return array + */ + public function register() + { + return array(\T_STRING); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('5.6') !== true) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + $ignore = array( + \T_DOUBLE_COLON => true, + \T_OBJECT_OPERATOR => true, + \T_FUNCTION => true, + \T_CONST => true, + ); + + $prevToken = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true); + if (isset($ignore[$tokens[$prevToken]['code']]) === true) { + // Not a call to a PHP function. + return; + } + + $functionLc = strtolower($tokens[$stackPtr]['content']); + if ($functionLc !== 'define') { + return; + } + + $secondParam = $this->getFunctionCallParameter($phpcsFile, $stackPtr, 2); + if (isset($secondParam['start'], $secondParam['end']) === false) { + return; + } + + $targetNestingLevel = 0; + if (isset($tokens[$secondParam['start']]['nested_parenthesis'])) { + $targetNestingLevel = \count($tokens[$secondParam['start']]['nested_parenthesis']); + } + + $array = $phpcsFile->findNext(array(\T_ARRAY, \T_OPEN_SHORT_ARRAY), $secondParam['start'], ($secondParam['end'] + 1)); + if ($array !== false) { + if ((isset($tokens[$array]['nested_parenthesis']) === false && $targetNestingLevel === 0) || \count($tokens[$array]['nested_parenthesis']) === $targetNestingLevel) { + $phpcsFile->addError( + 'Constant arrays using define are not allowed in PHP 5.6 or earlier', + $array, + 'Found' + ); + } + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/InitialValue/NewConstantScalarExpressionsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/InitialValue/NewConstantScalarExpressionsSniff.php new file mode 100644 index 00000000..8e1cddca --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/InitialValue/NewConstantScalarExpressionsSniff.php @@ -0,0 +1,556 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\InitialValue; + +use PHPCompatibility\Sniff; +use PHPCompatibility\PHPCSHelper; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect constant scalar expressions being used to set an initial value. + * + * Since PHP 5.6, it is now possible to provide a scalar expression involving + * numeric and string literals and/or constants in contexts where PHP previously + * expected a static value, such as constant and property declarations and + * default values for function parameters. + * + * PHP version 5.6 + * + * @link https://www.php.net/manual/en/migration56.new-features.php#migration56.new-features.const-scalar-exprs + * @link https://wiki.php.net/rfc/const_scalar_exprs + * + * @since 8.2.0 + */ +class NewConstantScalarExpressionsSniff extends Sniff +{ + + /** + * Error message. + * + * @since 8.2.0 + * + * @var string + */ + const ERROR_PHRASE = 'Constant scalar expressions are not allowed %s in PHP 5.5 or earlier.'; + + /** + * Partial error phrases to be used in combination with the error message constant. + * + * @since 8.2.0 + * + * @var array + */ + protected $errorPhrases = array( + 'const' => 'when defining constants using the const keyword', + 'property' => 'in property declarations', + 'staticvar' => 'in static variable declarations', + 'default' => 'in default function arguments', + ); + + /** + * Tokens which were allowed to be used in these declarations prior to PHP 5.6. + * + * This list will be enriched in the setProperties() method. + * + * @since 8.2.0 + * + * @var array + */ + protected $safeOperands = array( + \T_LNUMBER => \T_LNUMBER, + \T_DNUMBER => \T_DNUMBER, + \T_CONSTANT_ENCAPSED_STRING => \T_CONSTANT_ENCAPSED_STRING, + \T_TRUE => \T_TRUE, + \T_FALSE => \T_FALSE, + \T_NULL => \T_NULL, + + \T_LINE => \T_LINE, + \T_FILE => \T_FILE, + \T_DIR => \T_DIR, + \T_FUNC_C => \T_FUNC_C, + \T_CLASS_C => \T_CLASS_C, + \T_TRAIT_C => \T_TRAIT_C, + \T_METHOD_C => \T_METHOD_C, + \T_NS_C => \T_NS_C, + + // Special cases: + \T_NS_SEPARATOR => \T_NS_SEPARATOR, + /* + * This can be neigh anything, but for any usage except constants, + * the T_STRING will be combined with non-allowed tokens, so we should be good. + */ + \T_STRING => \T_STRING, + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 8.2.0 + * + * @return array + */ + public function register() + { + // Set the properties up only once. + $this->setProperties(); + + return array( + \T_CONST, + \T_VARIABLE, + \T_FUNCTION, + \T_CLOSURE, + \T_STATIC, + ); + } + + + /** + * Make some adjustments to the $safeOperands property. + * + * @since 8.2.0 + * + * @return void + */ + public function setProperties() + { + $this->safeOperands += Tokens::$heredocTokens; + $this->safeOperands += Tokens::$emptyTokens; + } + + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * @since 8.2.0 + * + * @return bool + */ + protected function bowOutEarly() + { + return ($this->supportsBelow('5.5') !== true); + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void|int Null or integer stack pointer to skip forward. + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->bowOutEarly() === true) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + switch ($tokens[$stackPtr]['type']) { + case 'T_FUNCTION': + case 'T_CLOSURE': + $params = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr); + if (empty($params)) { + // No parameters. + return; + } + + $funcToken = $tokens[$stackPtr]; + + if (isset($funcToken['parenthesis_owner'], $funcToken['parenthesis_opener'], $funcToken['parenthesis_closer']) === false + || $funcToken['parenthesis_owner'] !== $stackPtr + || isset($tokens[$funcToken['parenthesis_opener']], $tokens[$funcToken['parenthesis_closer']]) === false + ) { + // Hmm.. something is going wrong as these should all be available & valid. + return; + } + + $opener = $funcToken['parenthesis_opener']; + $closer = $funcToken['parenthesis_closer']; + + // Which nesting level is the one we are interested in ? + $nestedParenthesisCount = 1; + if (isset($tokens[$opener]['nested_parenthesis'])) { + $nestedParenthesisCount += \count($tokens[$opener]['nested_parenthesis']); + } + + foreach ($params as $param) { + if (isset($param['default']) === false) { + continue; + } + + $end = $param['token']; + while (($end = $phpcsFile->findNext(array(\T_COMMA, \T_CLOSE_PARENTHESIS), ($end + 1), ($closer + 1))) !== false) { + $maybeSkipTo = $this->isRealEndOfDeclaration($tokens, $end, $nestedParenthesisCount); + if ($maybeSkipTo !== true) { + $end = $maybeSkipTo; + continue; + } + + // Ignore closing parenthesis/bracket if not 'ours'. + if ($tokens[$end]['code'] === \T_CLOSE_PARENTHESIS && $end !== $closer) { + continue; + } + + // Ok, we've found the end of the param default value declaration. + break; + } + + if ($this->isValidAssignment($phpcsFile, $param['token'], $end) === false) { + $this->throwError($phpcsFile, $param['token'], 'default', $param['content']); + } + } + + /* + * No need for the sniff to be triggered by the T_VARIABLEs in the function + * definition as we've already examined them above, so let's skip over them. + */ + return $closer; + + case 'T_VARIABLE': + case 'T_STATIC': + case 'T_CONST': + $type = 'const'; + + // Filter out non-property declarations. + if ($tokens[$stackPtr]['code'] === \T_VARIABLE) { + if ($this->isClassProperty($phpcsFile, $stackPtr) === false) { + return; + } + + $type = 'property'; + + // Move back one token to have the same starting point as the others. + $stackPtr = ($stackPtr - 1); + } + + // Filter out late static binding and class properties. + if ($tokens[$stackPtr]['code'] === \T_STATIC) { + $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true, null, true); + if ($next === false || $tokens[$next]['code'] !== \T_VARIABLE) { + // Late static binding. + return; + } + + if ($this->isClassProperty($phpcsFile, $next) === true) { + // Class properties are examined based on the T_VARIABLE token. + return; + } + unset($next); + + $type = 'staticvar'; + } + + $endOfStatement = $phpcsFile->findNext(array(\T_SEMICOLON, \T_CLOSE_TAG), ($stackPtr + 1)); + if ($endOfStatement === false) { + // No semi-colon - live coding. + return; + } + + $targetNestingLevel = 0; + if (isset($tokens[$stackPtr]['nested_parenthesis']) === true) { + $targetNestingLevel = \count($tokens[$stackPtr]['nested_parenthesis']); + } + + // Examine each variable/constant in multi-declarations. + $start = $stackPtr; + $end = $stackPtr; + while (($end = $phpcsFile->findNext(array(\T_COMMA, \T_SEMICOLON, \T_OPEN_SHORT_ARRAY, \T_CLOSE_TAG), ($end + 1), ($endOfStatement + 1))) !== false) { + + $maybeSkipTo = $this->isRealEndOfDeclaration($tokens, $end, $targetNestingLevel); + if ($maybeSkipTo !== true) { + $end = $maybeSkipTo; + continue; + } + + $start = $phpcsFile->findNext(Tokens::$emptyTokens, ($start + 1), $end, true); + if ($start === false + || ($tokens[$stackPtr]['code'] === \T_CONST && $tokens[$start]['code'] !== \T_STRING) + || ($tokens[$stackPtr]['code'] !== \T_CONST && $tokens[$start]['code'] !== \T_VARIABLE) + ) { + // Shouldn't be possible. + continue; + } + + if ($this->isValidAssignment($phpcsFile, $start, $end) === false) { + // Create the "found" snippet. + $content = ''; + $tokenCount = ($end - $start); + if ($tokenCount < 20) { + // Prevent large arrays from being added to the error message. + $content = $phpcsFile->getTokensAsString($start, ($tokenCount + 1)); + } + + $this->throwError($phpcsFile, $start, $type, $content); + } + + $start = $end; + } + + // Skip to the end of the statement to prevent duplicate messages for multi-declarations. + return $endOfStatement; + } + } + + + /** + * Is a value declared and is the value declared valid pre-PHP 5.6 ? + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * @param int $end The end of the value definition. + * This will normally be a comma or semi-colon. + * + * @return bool + */ + protected function isValidAssignment(File $phpcsFile, $stackPtr, $end) + { + $tokens = $phpcsFile->getTokens(); + $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), $end, true); + if ($next === false || $tokens[$next]['code'] !== \T_EQUAL) { + // No value assigned. + return true; + } + + return $this->isStaticValue($phpcsFile, $tokens, ($next + 1), ($end - 1)); + } + + + /** + * Is a value declared and is the value declared constant as accepted in PHP 5.5 and lower ? + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param array $tokens The token stack of the current file. + * @param int $start The stackPtr from which to start examining. + * @param int $end The end of the value definition (inclusive), + * i.e. this token will be examined as part of + * the snippet. + * @param int $nestedArrays Optional. Array nesting level when examining + * the content of an array. + * + * @return bool + */ + protected function isStaticValue(File $phpcsFile, $tokens, $start, $end, $nestedArrays = 0) + { + $nextNonSimple = $phpcsFile->findNext($this->safeOperands, $start, ($end + 1), true); + if ($nextNonSimple === false) { + return true; + } + + /* + * OK, so we have at least one token which needs extra examination. + */ + switch ($tokens[$nextNonSimple]['code']) { + case \T_MINUS: + case \T_PLUS: + if ($this->isNumber($phpcsFile, $start, $end, true) !== false) { + // Int or float with sign. + return true; + } + + return false; + + case \T_NAMESPACE: + case \T_PARENT: + case \T_SELF: + case \T_DOUBLE_COLON: + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($nextNonSimple + 1), ($end + 1), true); + + if ($tokens[$nextNonSimple]['code'] === \T_NAMESPACE) { + // Allow only `namespace\...`. + if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== \T_NS_SEPARATOR) { + return false; + } + } elseif ($tokens[$nextNonSimple]['code'] === \T_PARENT + || $tokens[$nextNonSimple]['code'] === \T_SELF + ) { + // Allow only `parent::` and `self::`. + if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== \T_DOUBLE_COLON) { + return false; + } + } elseif ($tokens[$nextNonSimple]['code'] === \T_DOUBLE_COLON) { + // Allow only `T_STRING::T_STRING`. + if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== \T_STRING) { + return false; + } + + $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($nextNonSimple - 1), null, true); + // No need to worry about parent/self, that's handled above and + // the double colon is skipped over in that case. + if ($prevNonEmpty === false || $tokens[$prevNonEmpty]['code'] !== \T_STRING) { + return false; + } + } + + // Examine what comes after the namespace/parent/self/double colon, if anything. + return $this->isStaticValue($phpcsFile, $tokens, ($nextNonEmpty + 1), $end, $nestedArrays); + + case \T_ARRAY: + case \T_OPEN_SHORT_ARRAY: + ++$nestedArrays; + + $arrayItems = $this->getFunctionCallParameters($phpcsFile, $nextNonSimple); + if (empty($arrayItems) === false) { + foreach ($arrayItems as $item) { + // Check for a double arrow, but only if it's for this array item, not for a nested array. + $doubleArrow = false; + + $maybeDoubleArrow = $phpcsFile->findNext( + array(\T_DOUBLE_ARROW, \T_ARRAY, \T_OPEN_SHORT_ARRAY), + $item['start'], + ($item['end'] + 1) + ); + if ($maybeDoubleArrow !== false && $tokens[$maybeDoubleArrow]['code'] === \T_DOUBLE_ARROW) { + // Double arrow is for this nesting level. + $doubleArrow = $maybeDoubleArrow; + } + + if ($doubleArrow === false) { + if ($this->isStaticValue($phpcsFile, $tokens, $item['start'], $item['end'], $nestedArrays) === false) { + return false; + } + + } else { + // Examine array key. + if ($this->isStaticValue($phpcsFile, $tokens, $item['start'], ($doubleArrow - 1), $nestedArrays) === false) { + return false; + } + + // Examine array value. + if ($this->isStaticValue($phpcsFile, $tokens, ($doubleArrow + 1), $item['end'], $nestedArrays) === false) { + return false; + } + } + } + } + + --$nestedArrays; + + /* + * Find the end of the array. + * We already know we will have a valid closer as otherwise we wouldn't have been + * able to get the array items. + */ + $closer = ($nextNonSimple + 1); + if ($tokens[$nextNonSimple]['code'] === \T_OPEN_SHORT_ARRAY + && isset($tokens[$nextNonSimple]['bracket_closer']) === true + ) { + $closer = $tokens[$nextNonSimple]['bracket_closer']; + } else { + $maybeOpener = $phpcsFile->findNext(Tokens::$emptyTokens, ($nextNonSimple + 1), ($end + 1), true); + if ($tokens[$maybeOpener]['code'] === \T_OPEN_PARENTHESIS) { + $opener = $maybeOpener; + if (isset($tokens[$opener]['parenthesis_closer']) === true) { + $closer = $tokens[$opener]['parenthesis_closer']; + } + } + } + + if ($closer === $end) { + return true; + } + + // Examine what comes after the array, if anything. + return $this->isStaticValue($phpcsFile, $tokens, ($closer + 1), $end, $nestedArrays); + + } + + // Ok, so this unsafe token was not one of the exceptions, i.e. this is a PHP 5.6+ syntax. + return false; + } + + + /** + * Throw an error if a scalar expression is found. + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the token to link the error to. + * @param string $type Type of usage found. + * @param string $content Optional. The value for the declaration as found. + * + * @return void + */ + protected function throwError(File $phpcsFile, $stackPtr, $type, $content = '') + { + $error = static::ERROR_PHRASE; + $phrase = ''; + $errorCode = 'Found'; + + if (isset($this->errorPhrases[$type]) === true) { + $errorCode = $this->stringToErrorCode($type) . 'Found'; + $phrase = $this->errorPhrases[$type]; + } + + $data = array($phrase); + + if (empty($content) === false) { + $error .= ' Found: %s'; + $data[] = $content; + } + + $phpcsFile->addError($error, $stackPtr, $errorCode, $data); + } + + + /** + * Helper function to find the end of multi variable/constant declarations. + * + * Checks whether a certain part of a declaration needs to be skipped over or + * if it is the real end of the declaration. + * + * @since 8.2.0 + * + * @param array $tokens Token stack of the current file. + * @param int $endPtr The token to examine as a candidate end pointer. + * @param int $targetLevel Target nesting level. + * + * @return bool|int True if this is the real end. Int stackPtr to skip to if not. + */ + private function isRealEndOfDeclaration($tokens, $endPtr, $targetLevel) + { + // Ignore anything within short array definition brackets for now. + if ($tokens[$endPtr]['code'] === \T_OPEN_SHORT_ARRAY + && (isset($tokens[$endPtr]['bracket_opener']) + && $tokens[$endPtr]['bracket_opener'] === $endPtr) + && isset($tokens[$endPtr]['bracket_closer']) + ) { + // Skip forward to the end of the short array definition. + return $tokens[$endPtr]['bracket_closer']; + } + + // Skip past comma's at a lower nesting level. + if ($tokens[$endPtr]['code'] === \T_COMMA) { + // Check if a comma is at the nesting level we're targetting. + $nestingLevel = 0; + if (isset($tokens[$endPtr]['nested_parenthesis']) === true) { + $nestingLevel = \count($tokens[$endPtr]['nested_parenthesis']); + } + if ($nestingLevel > $targetLevel) { + return $endPtr; + } + } + + return true; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/InitialValue/NewHeredocSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/InitialValue/NewHeredocSniff.php new file mode 100644 index 00000000..406237a5 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/InitialValue/NewHeredocSniff.php @@ -0,0 +1,100 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\InitialValue; + +use PHPCompatibility\Sniffs\InitialValue\NewConstantScalarExpressionsSniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect a heredoc being used to set an initial value. + * + * As of PHP 5.3.0, it's possible to initialize static variables, class properties + * and constants declared using the `const` keyword, using the Heredoc syntax. + * And while not documented, heredoc initialization can now also be used for function param defaults. + * See: https://3v4l.org/JVH8W + * + * These heredocs (still) cannot contain variables. That's, however, outside the scope of the + * PHPCompatibility library until such time as there is a PHP version in which this would be accepted. + * + * PHP version 5.3 + * + * @link https://www.php.net/manual/en/migration53.new-features.php + * @link https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc + * + * @since 7.1.4 + * @since 8.2.0 Now extends the NewConstantScalarExpressionsSniff instead of the base Sniff class. + * @since 9.0.0 Renamed from `NewHeredocInitializeSniff` to `NewHeredocSniff`. + */ +class NewHeredocSniff extends NewConstantScalarExpressionsSniff +{ + + /** + * Error message. + * + * @since 8.2.0 + * + * @var string + */ + const ERROR_PHRASE = 'Initializing %s using the Heredoc syntax was not supported in PHP 5.2 or earlier'; + + /** + * Partial error phrases to be used in combination with the error message constant. + * + * @since 8.2.0 + * + * @var array + */ + protected $errorPhrases = array( + 'const' => 'constants', + 'property' => 'class properties', + 'staticvar' => 'static variables', + 'default' => 'default parameter values', + ); + + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * @since 8.2.0 + * + * @return bool + */ + protected function bowOutEarly() + { + return ($this->supportsBelow('5.2') !== true); + } + + + /** + * Is a value declared and does the declared value not contain an heredoc ? + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * @param int $end The end of the value definition. + * + * @return bool True if no heredoc (or assignment) is found, false otherwise. + */ + protected function isValidAssignment(File $phpcsFile, $stackPtr, $end) + { + $tokens = $phpcsFile->getTokens(); + $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), $end, true); + if ($next === false || $tokens[$next]['code'] !== \T_EQUAL) { + // No value assigned. + return true; + } + + return ($phpcsFile->findNext(\T_START_HEREDOC, ($next + 1), $end, false, null, true) === false); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Interfaces/InternalInterfacesSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Interfaces/InternalInterfacesSniff.php new file mode 100644 index 00000000..e154a603 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Interfaces/InternalInterfacesSniff.php @@ -0,0 +1,103 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Interfaces; + +use PHPCompatibility\Sniff; +use PHPCompatibility\PHPCSHelper; +use PHP_CodeSniffer_File as File; + +/** + * Detect classes which implement PHP native interfaces intended only for PHP internal use. + * + * PHP version 5.0+ + * + * @link https://www.php.net/manual/en/class.traversable.php + * @link https://www.php.net/manual/en/class.throwable.php + * @link https://www.php.net/manual/en/class.datetimeinterface.php + * + * @since 7.0.3 + */ +class InternalInterfacesSniff extends Sniff +{ + + /** + * A list of PHP internal interfaces, not intended to be implemented by userland classes. + * + * The array lists : the error message to use. + * + * @since 7.0.3 + * + * @var array(string => string) + */ + protected $internalInterfaces = array( + 'Traversable' => 'shouldn\'t be implemented directly, implement the Iterator or IteratorAggregate interface instead.', + 'DateTimeInterface' => 'is intended for type hints only and is not implementable.', + 'Throwable' => 'cannot be implemented directly, extend the Exception class instead.', + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.3 + * + * @return array + */ + public function register() + { + // Handle case-insensitivity of interface names. + $this->internalInterfaces = $this->arrayKeysToLowercase($this->internalInterfaces); + + $targets = array(\T_CLASS); + + if (\defined('T_ANON_CLASS')) { + $targets[] = \T_ANON_CLASS; + } + + return $targets; + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.3 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $interfaces = PHPCSHelper::findImplementedInterfaceNames($phpcsFile, $stackPtr); + + if (\is_array($interfaces) === false || $interfaces === array()) { + return; + } + + foreach ($interfaces as $interface) { + $interface = ltrim($interface, '\\'); + $interfaceLc = strtolower($interface); + if (isset($this->internalInterfaces[$interfaceLc]) === true) { + $error = 'The interface %s %s'; + $errorCode = $this->stringToErrorCode($interfaceLc) . 'Found'; + $data = array( + $interface, + $this->internalInterfaces[$interfaceLc], + ); + + $phpcsFile->addError($error, $stackPtr, $errorCode, $data); + } + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Interfaces/NewInterfacesSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Interfaces/NewInterfacesSniff.php new file mode 100644 index 00000000..35c5939b --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Interfaces/NewInterfacesSniff.php @@ -0,0 +1,362 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Interfaces; + +use PHPCompatibility\AbstractNewFeatureSniff; +use PHPCompatibility\PHPCSHelper; +use PHP_CodeSniffer_File as File; + +/** + * Detect use of new PHP native interfaces and unsupported interface methods. + * + * PHP version 5.0+ + * + * @since 7.0.3 + * @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class.. + * @since 7.1.4 Now also detects new interfaces when used as parameter type declarations. + * @since 8.2.0 Now also detects new interfaces when used as return type declarations. + */ +class NewInterfacesSniff extends AbstractNewFeatureSniff +{ + + /** + * A list of new interfaces, not present in older versions. + * + * The array lists : version number with false (not present) or true (present). + * If's sufficient to list the first version where the interface appears. + * + * @since 7.0.3 + * + * @var array(string => array(string => bool)) + */ + protected $newInterfaces = array( + 'Traversable' => array( + '4.4' => false, + '5.0' => true, + ), + 'Reflector' => array( + '4.4' => false, + '5.0' => true, + ), + + 'Countable' => array( + '5.0' => false, + '5.1' => true, + ), + 'OuterIterator' => array( + '5.0' => false, + '5.1' => true, + ), + 'RecursiveIterator' => array( + '5.0' => false, + '5.1' => true, + ), + 'SeekableIterator' => array( + '5.0' => false, + '5.1' => true, + ), + 'Serializable' => array( + '5.0' => false, + '5.1' => true, + ), + 'SplObserver' => array( + '5.0' => false, + '5.1' => true, + ), + 'SplSubject' => array( + '5.0' => false, + '5.1' => true, + ), + + 'JsonSerializable' => array( + '5.3' => false, + '5.4' => true, + ), + 'SessionHandlerInterface' => array( + '5.3' => false, + '5.4' => true, + ), + + 'DateTimeInterface' => array( + '5.4' => false, + '5.5' => true, + ), + + 'SessionIdInterface' => array( + '5.5.0' => false, + '5.5.1' => true, + ), + + 'Throwable' => array( + '5.6' => false, + '7.0' => true, + ), + 'SessionUpdateTimestampHandlerInterface' => array( + '5.6' => false, + '7.0' => true, + ), + ); + + /** + * A list of methods which cannot be used in combination with particular interfaces. + * + * @since 7.0.3 + * + * @var array(string => array(string => string)) + */ + protected $unsupportedMethods = array( + 'Serializable' => array( + '__sleep' => 'https://www.php.net/serializable', + '__wakeup' => 'https://www.php.net/serializable', + ), + ); + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.3 + * + * @return array + */ + public function register() + { + // Handle case-insensitivity of interface names. + $this->newInterfaces = $this->arrayKeysToLowercase($this->newInterfaces); + $this->unsupportedMethods = $this->arrayKeysToLowercase($this->unsupportedMethods); + + $targets = array( + \T_CLASS, + \T_FUNCTION, + \T_CLOSURE, + ); + + if (\defined('T_ANON_CLASS')) { + $targets[] = \T_ANON_CLASS; + } + + if (\defined('T_RETURN_TYPE')) { + $targets[] = \T_RETURN_TYPE; + } + + return $targets; + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.3 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + switch ($tokens[$stackPtr]['type']) { + case 'T_CLASS': + case 'T_ANON_CLASS': + $this->processClassToken($phpcsFile, $stackPtr); + break; + + case 'T_FUNCTION': + case 'T_CLOSURE': + $this->processFunctionToken($phpcsFile, $stackPtr); + + // Deal with older PHPCS versions which don't recognize return type hints + // as well as newer PHPCS versions (3.3.0+) where the tokenization has changed. + $returnTypeHint = $this->getReturnTypeHintToken($phpcsFile, $stackPtr); + if ($returnTypeHint !== false) { + $this->processReturnTypeToken($phpcsFile, $returnTypeHint); + } + break; + + case 'T_RETURN_TYPE': + $this->processReturnTypeToken($phpcsFile, $stackPtr); + break; + + default: + // Deliberately left empty. + break; + } + } + + + /** + * Processes this test for when a class token is encountered. + * + * - Detect classes implementing the new interfaces. + * - Detect classes implementing the new interfaces with unsupported functions. + * + * @since 7.1.4 Split off from the `process()` method. + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + private function processClassToken(File $phpcsFile, $stackPtr) + { + $interfaces = PHPCSHelper::findImplementedInterfaceNames($phpcsFile, $stackPtr); + + if (\is_array($interfaces) === false || $interfaces === array()) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $checkMethods = false; + + if (isset($tokens[$stackPtr]['scope_closer'])) { + $checkMethods = true; + $scopeCloser = $tokens[$stackPtr]['scope_closer']; + } + + foreach ($interfaces as $interface) { + $interface = ltrim($interface, '\\'); + $interfaceLc = strtolower($interface); + + if (isset($this->newInterfaces[$interfaceLc]) === true) { + $itemInfo = array( + 'name' => $interface, + 'nameLc' => $interfaceLc, + ); + $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); + } + + if ($checkMethods === true && isset($this->unsupportedMethods[$interfaceLc]) === true) { + $nextFunc = $stackPtr; + while (($nextFunc = $phpcsFile->findNext(\T_FUNCTION, ($nextFunc + 1), $scopeCloser)) !== false) { + $funcName = $phpcsFile->getDeclarationName($nextFunc); + $funcNameLc = strtolower($funcName); + if ($funcNameLc === '') { + continue; + } + + if (isset($this->unsupportedMethods[$interfaceLc][$funcNameLc]) === true) { + $error = 'Classes that implement interface %s do not support the method %s(). See %s'; + $errorCode = $this->stringToErrorCode($interface) . 'UnsupportedMethod'; + $data = array( + $interface, + $funcName, + $this->unsupportedMethods[$interfaceLc][$funcNameLc], + ); + + $phpcsFile->addError($error, $nextFunc, $errorCode, $data); + } + } + } + } + } + + + /** + * Processes this test for when a function token is encountered. + * + * - Detect new interfaces when used as a type hint. + * + * @since 7.1.4 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + private function processFunctionToken(File $phpcsFile, $stackPtr) + { + $typeHints = $this->getTypeHintsFromFunctionDeclaration($phpcsFile, $stackPtr); + if (empty($typeHints) || \is_array($typeHints) === false) { + return; + } + + foreach ($typeHints as $hint) { + + $typeHintLc = strtolower($hint); + + if (isset($this->newInterfaces[$typeHintLc]) === true) { + $itemInfo = array( + 'name' => $hint, + 'nameLc' => $typeHintLc, + ); + $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); + } + } + } + + + /** + * Processes this test for when a return type token is encountered. + * + * - Detect new interfaces when used as a return type declaration. + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + private function processReturnTypeToken(File $phpcsFile, $stackPtr) + { + $returnTypeHint = $this->getReturnTypeHintName($phpcsFile, $stackPtr); + if (empty($returnTypeHint)) { + return; + } + + $returnTypeHint = ltrim($returnTypeHint, '\\'); + $returnTypeHintLc = strtolower($returnTypeHint); + + if (isset($this->newInterfaces[$returnTypeHintLc]) === false) { + return; + } + + // Still here ? Then this is a return type declaration using a new interface. + $itemInfo = array( + 'name' => $returnTypeHint, + 'nameLc' => $returnTypeHintLc, + ); + $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); + } + + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 7.1.0 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo) + { + return $this->newInterfaces[$itemInfo['nameLc']]; + } + + + /** + * Get the error message template for this sniff. + * + * @since 7.1.0 + * + * @return string + */ + protected function getErrorMsgTemplate() + { + return 'The built-in interface ' . parent::getErrorMsgTemplate(); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/CaseSensitiveKeywordsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/CaseSensitiveKeywordsSniff.php new file mode 100644 index 00000000..64002b4d --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/CaseSensitiveKeywordsSniff.php @@ -0,0 +1,76 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Keywords; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect usage of `self`, `parent` and `static` and verify they are lowercase. + * + * Prior to PHP 5.5, cases existed where the `self`, `parent`, and `static` keywords + * were treated in a case sensitive fashion. + * + * PHP version 5.5 + * + * @link https://www.php.net/manual/en/migration55.incompatible.php#migration55.incompatible.self-parent-static + * + * @since 7.1.4 + */ +class CaseSensitiveKeywordsSniff extends Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.1.4 + * + * @return array + */ + public function register() + { + return array( + \T_SELF, + \T_STATIC, + \T_PARENT, + ); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.1.4 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('5.4') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $tokenContentLC = strtolower($tokens[$stackPtr]['content']); + + if ($tokenContentLC !== $tokens[$stackPtr]['content']) { + $phpcsFile->addError( + 'The keyword \'%s\' was treated in a case-sensitive fashion in certain cases in PHP 5.4 or earlier. Use the lowercase version for consistent support.', + $stackPtr, + 'NonLowercaseFound', + array($tokenContentLC) + ); + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/ForbiddenNamesAsDeclaredSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/ForbiddenNamesAsDeclaredSniff.php new file mode 100644 index 00000000..7f4411bc --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/ForbiddenNamesAsDeclaredSniff.php @@ -0,0 +1,259 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Keywords; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detects the use of some reserved keywords to name a class, interface, trait or namespace. + * + * Emits errors for reserved words and warnings for soft-reserved words. + * + * PHP version 7.0+ + * + * @link https://www.php.net/manual/en/reserved.other-reserved-words.php + * @link https://wiki.php.net/rfc/reserve_more_types_in_php_7 + * + * @since 7.0.8 + * @since 7.1.4 This sniff now throws a warning (soft reserved) or an error (reserved) depending + * on the `testVersion` set. Previously it would always throw an error. + */ +class ForbiddenNamesAsDeclaredSniff extends Sniff +{ + + /** + * List of tokens which can not be used as class, interface, trait names or as part of a namespace. + * + * @since 7.0.8 + * + * @var array + */ + protected $forbiddenTokens = array( + \T_NULL => '7.0', + \T_TRUE => '7.0', + \T_FALSE => '7.0', + ); + + /** + * T_STRING keywords to recognize as forbidden names. + * + * @since 7.0.8 + * + * @var array + */ + protected $forbiddenNames = array( + 'null' => '7.0', + 'true' => '7.0', + 'false' => '7.0', + 'bool' => '7.0', + 'int' => '7.0', + 'float' => '7.0', + 'string' => '7.0', + 'iterable' => '7.1', + 'void' => '7.1', + 'object' => '7.2', + ); + + /** + * T_STRING keywords to recognize as soft reserved names. + * + * Using any of these keywords to name a class, interface, trait or namespace + * is highly discouraged since they may be used in future versions of PHP. + * + * @since 7.0.8 + * + * @var array + */ + protected $softReservedNames = array( + 'resource' => '7.0', + 'object' => '7.0', + 'mixed' => '7.0', + 'numeric' => '7.0', + ); + + /** + * Combined list of the two lists above. + * + * Used for quick check whether or not something is a reserved + * word. + * Set from the `register()` method. + * + * @since 7.0.8 + * + * @var array + */ + private $allForbiddenNames = array(); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.8 + * + * @return array + */ + public function register() + { + // Do the list merge only once. + $this->allForbiddenNames = array_merge($this->forbiddenNames, $this->softReservedNames); + + $targets = array( + \T_CLASS, + \T_INTERFACE, + \T_TRAIT, + \T_NAMESPACE, + \T_STRING, // Compat for PHPCS < 2.4.0 and PHP < 5.3. + ); + + return $targets; + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.8 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('7.0') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $tokenCode = $tokens[$stackPtr]['code']; + $tokenType = $tokens[$stackPtr]['type']; + $tokenContentLc = strtolower($tokens[$stackPtr]['content']); + + // For string tokens we only care about 'trait' as that is the only one + // which may not be correctly recognized as it's own token. + // This only happens in older versions of PHP where the token doesn't exist yet as a keyword. + if ($tokenCode === \T_STRING && $tokenContentLc !== 'trait') { + return; + } + + if (\in_array($tokenType, array('T_CLASS', 'T_INTERFACE', 'T_TRAIT'), true)) { + // Check for the declared name being a name which is not tokenized as T_STRING. + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($nextNonEmpty !== false && isset($this->forbiddenTokens[$tokens[$nextNonEmpty]['code']]) === true) { + $name = $tokens[$nextNonEmpty]['content']; + } else { + // Get the declared name if it's a T_STRING. + $name = $phpcsFile->getDeclarationName($stackPtr); + } + unset($nextNonEmpty); + + if (isset($name) === false || \is_string($name) === false || $name === '') { + return; + } + + $nameLc = strtolower($name); + if (isset($this->allForbiddenNames[$nameLc]) === false) { + return; + } + + } elseif ($tokenCode === \T_NAMESPACE) { + $namespaceName = $this->getDeclaredNamespaceName($phpcsFile, $stackPtr); + + if ($namespaceName === false || $namespaceName === '') { + return; + } + + $namespaceParts = explode('\\', $namespaceName); + foreach ($namespaceParts as $namespacePart) { + $partLc = strtolower($namespacePart); + if (isset($this->allForbiddenNames[$partLc]) === true) { + $name = $namespacePart; + $nameLc = $partLc; + break; + } + } + } elseif ($tokenCode === \T_STRING) { + // Traits which are not yet tokenized as T_TRAIT. + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($nextNonEmpty === false) { + return; + } + + $nextNonEmptyCode = $tokens[$nextNonEmpty]['code']; + + if ($nextNonEmptyCode !== \T_STRING && isset($this->forbiddenTokens[$nextNonEmptyCode]) === true) { + $name = $tokens[$nextNonEmpty]['content']; + $nameLc = strtolower($tokens[$nextNonEmpty]['content']); + } elseif ($nextNonEmptyCode === \T_STRING) { + $endOfStatement = $phpcsFile->findNext(array(\T_SEMICOLON, \T_OPEN_CURLY_BRACKET), ($stackPtr + 1)); + if ($endOfStatement === false) { + return; + } + + do { + $nextNonEmptyLc = strtolower($tokens[$nextNonEmpty]['content']); + + if (isset($this->allForbiddenNames[$nextNonEmptyLc]) === true) { + $name = $tokens[$nextNonEmpty]['content']; + $nameLc = $nextNonEmptyLc; + break; + } + + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($nextNonEmpty + 1), $endOfStatement, true); + } while ($nextNonEmpty !== false); + } + unset($nextNonEmptyCode, $nextNonEmptyLc, $endOfStatement); + } + + if (isset($name, $nameLc) === false) { + return; + } + + // Still here, so this is one of the reserved words. + // Build up the error message. + $error = "'%s' is a"; + $isError = null; + $errorCode = $this->stringToErrorCode($nameLc) . 'Found'; + $data = array( + $nameLc, + ); + + if (isset($this->softReservedNames[$nameLc]) === true + && $this->supportsAbove($this->softReservedNames[$nameLc]) === true + ) { + $error .= ' soft reserved keyword as of PHP version %s'; + $isError = false; + $data[] = $this->softReservedNames[$nameLc]; + } + + if (isset($this->forbiddenNames[$nameLc]) === true + && $this->supportsAbove($this->forbiddenNames[$nameLc]) === true + ) { + if (isset($isError) === true) { + $error .= ' and a'; + } + $error .= ' reserved keyword as of PHP version %s'; + $isError = true; + $data[] = $this->forbiddenNames[$nameLc]; + } + + if (isset($isError) === true) { + $error .= ' and should not be used to name a class, interface or trait or as part of a namespace (%s)'; + $data[] = $tokens[$stackPtr]['type']; + + $this->addMessage($phpcsFile, $error, $stackPtr, $isError, $errorCode, $data); + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/ForbiddenNamesAsInvokedFunctionsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/ForbiddenNamesAsInvokedFunctionsSniff.php new file mode 100644 index 00000000..c1c38281 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/ForbiddenNamesAsInvokedFunctionsSniff.php @@ -0,0 +1,188 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Keywords; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Prohibits the use of reserved keywords invoked as functions. + * + * PHP version All + * + * @link https://www.php.net/manual/en/reserved.keywords.php + * + * @since 5.5 + */ +class ForbiddenNamesAsInvokedFunctionsSniff extends Sniff +{ + + /** + * List of tokens to register. + * + * @since 5.5 + * + * @var array + */ + protected $targetedTokens = array( + \T_ABSTRACT => '5.0', + \T_CALLABLE => '5.4', + \T_CATCH => '5.0', + \T_FINAL => '5.0', + \T_FINALLY => '5.5', + \T_GOTO => '5.3', + \T_IMPLEMENTS => '5.0', + \T_INTERFACE => '5.0', + \T_INSTANCEOF => '5.0', + \T_INSTEADOF => '5.4', + \T_NAMESPACE => '5.3', + \T_PRIVATE => '5.0', + \T_PROTECTED => '5.0', + \T_PUBLIC => '5.0', + \T_TRAIT => '5.4', + \T_TRY => '5.0', + + ); + + /** + * T_STRING keywords to recognize as targetted tokens. + * + * Compatibility for PHP versions where the keyword is not yet recognized + * as its own token and for PHPCS versions which change the token to + * T_STRING when used in a method call. + * + * @since 5.5 + * + * @var array + */ + protected $targetedStringTokens = array( + 'abstract' => '5.0', + 'callable' => '5.4', + 'catch' => '5.0', + 'final' => '5.0', + 'finally' => '5.5', + 'goto' => '5.3', + 'implements' => '5.0', + 'interface' => '5.0', + 'instanceof' => '5.0', + 'insteadof' => '5.4', + 'namespace' => '5.3', + 'private' => '5.0', + 'protected' => '5.0', + 'public' => '5.0', + 'trait' => '5.4', + 'try' => '5.0', + ); + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 5.5 + * + * @return array + */ + public function register() + { + $tokens = array_keys($this->targetedTokens); + $tokens[] = \T_STRING; + + return $tokens; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 5.5 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $tokenCode = $tokens[$stackPtr]['code']; + $tokenContentLc = strtolower($tokens[$stackPtr]['content']); + $isString = false; + + /* + * For string tokens we only care if the string is a reserved word used + * as a function. This only happens in older versions of PHP where the + * token doesn't exist yet for that keyword or in later versions when the + * token is used in a method invocation. + */ + if ($tokenCode === \T_STRING + && (isset($this->targetedStringTokens[$tokenContentLc]) === false) + ) { + return; + } + + if ($tokenCode === \T_STRING) { + $isString = true; + } + + // Make sure this is a function call. + $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($next === false || $tokens[$next]['code'] !== \T_OPEN_PARENTHESIS) { + // Not a function call. + return; + } + + // This sniff isn't concerned about function declarations. + $prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); + if ($prev !== false && $tokens[$prev]['code'] === \T_FUNCTION) { + return; + } + + /* + * Deal with PHP 7 relaxing the rules. + * "As of PHP 7.0.0 these keywords are allowed as property, constant, and method names + * of classes, interfaces and traits...", i.e. they can be invoked as a method call. + * + * Only needed for those keywords which we sniff out via T_STRING. + */ + if (($tokens[$prev]['code'] === \T_OBJECT_OPERATOR || $tokens[$prev]['code'] === \T_DOUBLE_COLON) + && $this->supportsBelow('5.6') === false + ) { + return; + } + + // For the word catch, it is valid to have an open parenthesis + // after it, but only if it is preceded by a right curly brace. + if ($tokenCode === \T_CATCH) { + if ($prev !== false && $tokens[$prev]['code'] === \T_CLOSE_CURLY_BRACKET) { + // Ok, it's fine. + return; + } + } + + if ($isString === true) { + $version = $this->targetedStringTokens[$tokenContentLc]; + } else { + $version = $this->targetedTokens[$tokenCode]; + } + + if ($this->supportsAbove($version)) { + $error = "'%s' is a reserved keyword introduced in PHP version %s and cannot be invoked as a function (%s)"; + $errorCode = $this->stringToErrorCode($tokenContentLc) . 'Found'; + $data = array( + $tokenContentLc, + $version, + $tokens[$stackPtr]['type'], + ); + + $phpcsFile->addError($error, $stackPtr, $errorCode, $data); + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/ForbiddenNamesSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/ForbiddenNamesSniff.php new file mode 100644 index 00000000..6be1de4f --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/ForbiddenNamesSniff.php @@ -0,0 +1,442 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Keywords; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detects the use of reserved keywords as class, function, namespace or constant names. + * + * PHP version All + * + * @link https://www.php.net/manual/en/reserved.keywords.php + * + * @since 5.5 + */ +class ForbiddenNamesSniff extends Sniff +{ + + /** + * A list of keywords that can not be used as function, class and namespace name or constant name. + * Mentions since which version it's not allowed. + * + * @since 5.5 + * + * @var array(string => string) + */ + protected $invalidNames = array( + 'abstract' => '5.0', + 'and' => 'all', + 'array' => 'all', + 'as' => 'all', + 'break' => 'all', + 'callable' => '5.4', + 'case' => 'all', + 'catch' => '5.0', + 'class' => 'all', + 'clone' => '5.0', + 'const' => 'all', + 'continue' => 'all', + 'declare' => 'all', + 'default' => 'all', + 'die' => 'all', + 'do' => 'all', + 'echo' => 'all', + 'else' => 'all', + 'elseif' => 'all', + 'empty' => 'all', + 'enddeclare' => 'all', + 'endfor' => 'all', + 'endforeach' => 'all', + 'endif' => 'all', + 'endswitch' => 'all', + 'endwhile' => 'all', + 'eval' => 'all', + 'exit' => 'all', + 'extends' => 'all', + 'final' => '5.0', + 'finally' => '5.5', + 'for' => 'all', + 'foreach' => 'all', + 'function' => 'all', + 'global' => 'all', + 'goto' => '5.3', + 'if' => 'all', + 'implements' => '5.0', + 'include' => 'all', + 'include_once' => 'all', + 'instanceof' => '5.0', + 'insteadof' => '5.4', + 'interface' => '5.0', + 'isset' => 'all', + 'list' => 'all', + 'namespace' => '5.3', + 'new' => 'all', + 'or' => 'all', + 'print' => 'all', + 'private' => '5.0', + 'protected' => '5.0', + 'public' => '5.0', + 'require' => 'all', + 'require_once' => 'all', + 'return' => 'all', + 'static' => 'all', + 'switch' => 'all', + 'throw' => '5.0', + 'trait' => '5.4', + 'try' => '5.0', + 'unset' => 'all', + 'use' => 'all', + 'var' => 'all', + 'while' => 'all', + 'xor' => 'all', + 'yield' => '5.5', + '__class__' => 'all', + '__dir__' => '5.3', + '__file__' => 'all', + '__function__' => 'all', + '__method__' => 'all', + '__namespace__' => '5.3', + ); + + /** + * A list of keywords that can follow use statements. + * + * @since 7.0.1 + * + * @var array(string => string) + */ + protected $validUseNames = array( + 'const' => true, + 'function' => true, + ); + + /** + * Scope modifiers and other keywords allowed in trait use statements. + * + * @since 7.1.4 + * + * @var array + */ + private $allowedModifiers = array(); + + /** + * Targeted tokens. + * + * @since 5.5 + * + * @var array + */ + protected $targetedTokens = array( + \T_CLASS, + \T_FUNCTION, + \T_NAMESPACE, + \T_STRING, + \T_CONST, + \T_USE, + \T_AS, + \T_EXTENDS, + \T_INTERFACE, + \T_TRAIT, + ); + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 5.5 + * + * @return array + */ + public function register() + { + $this->allowedModifiers = Tokens::$scopeModifiers; + $this->allowedModifiers[\T_FINAL] = \T_FINAL; + + $tokens = $this->targetedTokens; + + if (\defined('T_ANON_CLASS')) { + $tokens[] = \T_ANON_CLASS; + } + + return $tokens; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 5.5 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + /* + * We distinguish between the class, function and namespace names vs the define statements. + */ + if ($tokens[$stackPtr]['type'] === 'T_STRING') { + $this->processString($phpcsFile, $stackPtr, $tokens); + } else { + $this->processNonString($phpcsFile, $stackPtr, $tokens); + } + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 5.5 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * @param array $tokens The stack of tokens that make up + * the file. + * + * @return void + */ + public function processNonString(File $phpcsFile, $stackPtr, $tokens) + { + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($nextNonEmpty === false) { + return; + } + + /* + * Deal with anonymous classes - `class` before a reserved keyword is sometimes + * misidentified as `T_ANON_CLASS`. + * In PHPCS < 2.3.4 these were tokenized as T_CLASS no matter what. + */ + if ($tokens[$stackPtr]['type'] === 'T_ANON_CLASS' || $tokens[$stackPtr]['type'] === 'T_CLASS') { + $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); + if ($prevNonEmpty !== false && $tokens[$prevNonEmpty]['type'] === 'T_NEW') { + return; + } + } + + /* + * PHP 5.6 allows for use const and use function, but only if followed by the function/constant name. + * - `use function HelloWorld` => move to the next token (HelloWorld) to verify. + * - `use const HelloWorld` => move to the next token (HelloWorld) to verify. + */ + elseif ($tokens[$stackPtr]['type'] === 'T_USE' + && isset($this->validUseNames[strtolower($tokens[$nextNonEmpty]['content'])]) === true + ) { + $maybeUseNext = $phpcsFile->findNext(Tokens::$emptyTokens, ($nextNonEmpty + 1), null, true, null, true); + if ($maybeUseNext !== false && $this->isEndOfUseStatement($tokens[$maybeUseNext]) === false) { + $nextNonEmpty = $maybeUseNext; + } + } + + /* + * Deal with visibility modifiers. + * - `use HelloWorld { sayHello as protected; }` => valid, bow out. + * - `use HelloWorld { sayHello as private myPrivateHello; }` => move to the next token to verify. + */ + elseif ($tokens[$stackPtr]['type'] === 'T_AS' + && isset($this->allowedModifiers[$tokens[$nextNonEmpty]['code']]) === true + && $phpcsFile->hasCondition($stackPtr, \T_USE) === true + ) { + $maybeUseNext = $phpcsFile->findNext(Tokens::$emptyTokens, ($nextNonEmpty + 1), null, true, null, true); + if ($maybeUseNext === false || $this->isEndOfUseStatement($tokens[$maybeUseNext]) === true) { + return; + } + + $nextNonEmpty = $maybeUseNext; + } + + /* + * Deal with foreach ( ... as list() ). + */ + elseif ($tokens[$stackPtr]['type'] === 'T_AS' + && isset($tokens[$stackPtr]['nested_parenthesis']) === true + && $tokens[$nextNonEmpty]['code'] === \T_LIST + ) { + $parentheses = array_reverse($tokens[$stackPtr]['nested_parenthesis'], true); + foreach ($parentheses as $open => $close) { + if (isset($tokens[$open]['parenthesis_owner']) + && $tokens[$tokens[$open]['parenthesis_owner']]['code'] === \T_FOREACH + ) { + return; + } + } + } + + /* + * Deal with functions declared to return by reference. + */ + elseif ($tokens[$stackPtr]['type'] === 'T_FUNCTION' + && $tokens[$nextNonEmpty]['type'] === 'T_BITWISE_AND' + ) { + $maybeUseNext = $phpcsFile->findNext(Tokens::$emptyTokens, ($nextNonEmpty + 1), null, true, null, true); + if ($maybeUseNext === false) { + // Live coding. + return; + } + + $nextNonEmpty = $maybeUseNext; + } + + /* + * Deal with nested namespaces. + */ + elseif ($tokens[$stackPtr]['type'] === 'T_NAMESPACE') { + if ($tokens[$stackPtr + 1]['code'] === \T_NS_SEPARATOR) { + // Not a namespace declaration, but use of, i.e. `namespace\someFunction();`. + return; + } + + $endToken = $phpcsFile->findNext(array(\T_SEMICOLON, \T_OPEN_CURLY_BRACKET), ($stackPtr + 1), null, false, null, true); + $namespaceName = trim($phpcsFile->getTokensAsString(($stackPtr + 1), ($endToken - $stackPtr - 1))); + if (empty($namespaceName) === true) { + return; + } + + $namespaceParts = explode('\\', $namespaceName); + foreach ($namespaceParts as $namespacePart) { + $partLc = strtolower($namespacePart); + if (isset($this->invalidNames[$partLc]) === false) { + continue; + } + + // Find the token position of the part which matched. + for ($i = ($stackPtr + 1); $i < $endToken; $i++) { + if ($tokens[$i]['content'] === $namespacePart) { + $nextNonEmpty = $i; + break; + } + } + } + unset($i, $namespacePart, $partLc); + } + + $nextContentLc = strtolower($tokens[$nextNonEmpty]['content']); + if (isset($this->invalidNames[$nextContentLc]) === false) { + return; + } + + /* + * Deal with PHP 7 relaxing the rules. + * "As of PHP 7.0.0 these keywords are allowed as property, constant, and method names + * of classes, interfaces and traits, except that class may not be used as constant name." + */ + if ((($tokens[$stackPtr]['type'] === 'T_FUNCTION' + && $this->inClassScope($phpcsFile, $stackPtr, false) === true) + || ($tokens[$stackPtr]['type'] === 'T_CONST' + && $this->isClassConstant($phpcsFile, $stackPtr) === true + && $nextContentLc !== 'class')) + && $this->supportsBelow('5.6') === false + ) { + return; + } + + if ($this->supportsAbove($this->invalidNames[$nextContentLc])) { + $data = array( + $tokens[$nextNonEmpty]['content'], + $this->invalidNames[$nextContentLc], + ); + $this->addError($phpcsFile, $stackPtr, $tokens[$nextNonEmpty]['content'], $data); + } + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 5.5 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * @param array $tokens The stack of tokens that make up + * the file. + * + * @return void + */ + public function processString(File $phpcsFile, $stackPtr, $tokens) + { + $tokenContentLc = strtolower($tokens[$stackPtr]['content']); + + /* + * Special case for PHP versions where the target is not yet identified as + * its own token, but presents as T_STRING. + * - trait keyword in PHP < 5.4 + */ + if (version_compare(\PHP_VERSION_ID, '50400', '<') && $tokenContentLc === 'trait') { + $this->processNonString($phpcsFile, $stackPtr, $tokens); + return; + } + + // Look for any define/defined tokens (both T_STRING ones, blame Tokenizer). + if ($tokenContentLc !== 'define' && $tokenContentLc !== 'defined') { + return; + } + + // Retrieve the define(d) constant name. + $firstParam = $this->getFunctionCallParameter($phpcsFile, $stackPtr, 1); + if ($firstParam === false) { + return; + } + + $defineName = $this->stripQuotes($firstParam['raw']); + $defineNameLc = strtolower($defineName); + + if (isset($this->invalidNames[$defineNameLc]) && $this->supportsAbove($this->invalidNames[$defineNameLc])) { + $data = array( + $defineName, + $this->invalidNames[$defineNameLc], + ); + $this->addError($phpcsFile, $stackPtr, $defineNameLc, $data); + } + } + + + /** + * Add the error message. + * + * @since 7.1.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * @param string $content The token content found. + * @param array $data The data to pass into the error message. + * + * @return void + */ + protected function addError(File $phpcsFile, $stackPtr, $content, $data) + { + $error = "Function name, class name, namespace name or constant name can not be reserved keyword '%s' (since version %s)"; + $errorCode = $this->stringToErrorCode($content) . 'Found'; + $phpcsFile->addError($error, $stackPtr, $errorCode, $data); + } + + + /** + * Check if the current token code is for a token which can be considered + * the end of a (partial) use statement. + * + * @since 7.0.8 + * + * @param int $token The current token information. + * + * @return bool + */ + protected function isEndOfUseStatement($token) + { + return \in_array($token['code'], array(\T_CLOSE_CURLY_BRACKET, \T_SEMICOLON, \T_COMMA), true); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/NewKeywordsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/NewKeywordsSniff.php new file mode 100644 index 00000000..61f79aa5 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/NewKeywordsSniff.php @@ -0,0 +1,391 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Keywords; + +use PHPCompatibility\AbstractNewFeatureSniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect use of new PHP keywords. + * + * PHP version All + * + * @link https://wiki.php.net/rfc/heredoc-with-double-quotes + * @link https://wiki.php.net/rfc/horizontalreuse (traits) + * @link https://wiki.php.net/rfc/generators + * @link https://wiki.php.net/rfc/finally + * @link https://wiki.php.net/rfc/generator-delegation + * + * @since 5.5 + * @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class.. + */ +class NewKeywordsSniff extends AbstractNewFeatureSniff +{ + + /** + * A list of new keywords, not present in older versions. + * + * The array lists : version number with false (not present) or true (present). + * If's sufficient to list the last version which did not contain the keyword. + * + * Description will be used as part of the error message. + * Condition is the name of a callback method within this class or the parent class + * which checks whether the token complies with a certain condition. + * The callback function will be passed the $phpcsFile and the $stackPtr. + * The callback function should return `true` if the condition is met and the + * error should *not* be thrown. + * + * @since 5.5 + * @since 7.0.3 Support for 'condition' has been added. + * + * @var array(string => array(string => bool|string)) + */ + protected $newKeywords = array( + 'T_HALT_COMPILER' => array( + '5.0' => false, + '5.1' => true, + 'description' => '"__halt_compiler" keyword', + ), + 'T_CONST' => array( + '5.2' => false, + '5.3' => true, + 'description' => '"const" keyword', + 'condition' => 'isClassConstant', // Keyword is only new when not in class context. + ), + 'T_CALLABLE' => array( + '5.3' => false, + '5.4' => true, + 'description' => '"callable" keyword', + 'content' => 'callable', + ), + 'T_DIR' => array( + '5.2' => false, + '5.3' => true, + 'description' => '__DIR__ magic constant', + 'content' => '__DIR__', + ), + 'T_GOTO' => array( + '5.2' => false, + '5.3' => true, + 'description' => '"goto" keyword', + 'content' => 'goto', + ), + 'T_INSTEADOF' => array( + '5.3' => false, + '5.4' => true, + 'description' => '"insteadof" keyword (for traits)', + 'content' => 'insteadof', + ), + 'T_NAMESPACE' => array( + '5.2' => false, + '5.3' => true, + 'description' => '"namespace" keyword', + 'content' => 'namespace', + ), + 'T_NS_C' => array( + '5.2' => false, + '5.3' => true, + 'description' => '__NAMESPACE__ magic constant', + 'content' => '__NAMESPACE__', + ), + 'T_USE' => array( + '5.2' => false, + '5.3' => true, + 'description' => '"use" keyword (for traits/namespaces/anonymous functions)', + ), + 'T_START_NOWDOC' => array( + '5.2' => false, + '5.3' => true, + 'description' => 'nowdoc functionality', + ), + 'T_END_NOWDOC' => array( + '5.2' => false, + '5.3' => true, + 'description' => 'nowdoc functionality', + ), + 'T_START_HEREDOC' => array( + '5.2' => false, + '5.3' => true, + 'description' => '(Double) quoted Heredoc identifier', + 'condition' => 'isNotQuoted', // Heredoc is only new with quoted identifier. + ), + 'T_TRAIT' => array( + '5.3' => false, + '5.4' => true, + 'description' => '"trait" keyword', + 'content' => 'trait', + ), + 'T_TRAIT_C' => array( + '5.3' => false, + '5.4' => true, + 'description' => '__TRAIT__ magic constant', + 'content' => '__TRAIT__', + ), + // The specifics for distinguishing between 'yield' and 'yield from' are dealt + // with in the translation logic. + // This token has to be placed above the `T_YIELD` token in this array to allow for this. + 'T_YIELD_FROM' => array( + '5.6' => false, + '7.0' => true, + 'description' => '"yield from" keyword (for generators)', + 'content' => 'yield', + ), + 'T_YIELD' => array( + '5.4' => false, + '5.5' => true, + 'description' => '"yield" keyword (for generators)', + 'content' => 'yield', + ), + 'T_FINALLY' => array( + '5.4' => false, + '5.5' => true, + 'description' => '"finally" keyword (in exception handling)', + 'content' => 'finally', + ), + ); + + /** + * Translation table for T_STRING tokens. + * + * Will be set up from the register() method. + * + * @since 7.0.5 + * + * @var array(string => string) + */ + protected $translateContentToToken = array(); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 5.5 + * + * @return array + */ + public function register() + { + $tokens = array(); + $translate = array(); + foreach ($this->newKeywords as $token => $versions) { + if (\defined($token)) { + $tokens[] = constant($token); + } + if (isset($versions['content'])) { + $translate[strtolower($versions['content'])] = $token; + } + } + + /* + * Deal with tokens not recognized by the PHP version the sniffer is run + * under and (not correctly) compensated for by PHPCS. + */ + if (empty($translate) === false) { + $this->translateContentToToken = $translate; + $tokens[] = \T_STRING; + } + + return $tokens; + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 5.5 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $tokenType = $tokens[$stackPtr]['type']; + + // Allow for dealing with multi-token keywords, like "yield from". + $end = $stackPtr; + + // Translate T_STRING token if necessary. + if ($tokens[$stackPtr]['type'] === 'T_STRING') { + $content = strtolower($tokens[$stackPtr]['content']); + + if (isset($this->translateContentToToken[$content]) === false) { + // Not one of the tokens we're looking for. + return; + } + + $tokenType = $this->translateContentToToken[$content]; + } + + /* + * Special case: distinguish between `yield` and `yield from`. + * + * PHPCS currently (at least up to v 3.0.1) does not backfill for the + * `yield` nor the `yield from` keywords. + * See: https://github.com/squizlabs/PHP_CodeSniffer/issues/1524 + * + * In PHP < 5.5, both `yield` as well as `from` are tokenized as T_STRING. + * In PHP 5.5 - 5.6, `yield` is tokenized as T_YIELD and `from` as T_STRING, + * but the `T_YIELD_FROM` token *is* defined in PHP. + * In PHP 7.0+ both are tokenized as their respective token, however, + * a multi-line "yield from" is tokenized as two tokens. + */ + if ($tokenType === 'T_YIELD') { + $nextToken = $phpcsFile->findNext(\T_WHITESPACE, ($end + 1), null, true); + if ($tokens[$nextToken]['code'] === \T_STRING + && $tokens[$nextToken]['content'] === 'from' + ) { + $tokenType = 'T_YIELD_FROM'; + $end = $nextToken; + } + unset($nextToken); + } + + if ($tokenType === 'T_YIELD_FROM' && $tokens[($stackPtr - 1)]['type'] === 'T_YIELD_FROM') { + // Multi-line "yield from", no need to report it twice. + return; + } + + if (isset($this->newKeywords[$tokenType]) === false) { + return; + } + + $nextToken = $phpcsFile->findNext(Tokens::$emptyTokens, ($end + 1), null, true); + $prevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); + + if ($prevToken !== false + && ($tokens[$prevToken]['code'] === \T_DOUBLE_COLON + || $tokens[$prevToken]['code'] === \T_OBJECT_OPERATOR) + ) { + // Class property of the same name as one of the keywords. Ignore. + return; + } + + // Skip attempts to use keywords as functions or class names - the former + // will be reported by ForbiddenNamesAsInvokedFunctionsSniff, whilst the + // latter will be (partially) reported by the ForbiddenNames sniff. + // Either type will result in false-positives when targetting lower versions + // of PHP where the name was not reserved, unless we explicitly check for + // them. + if (($nextToken === false + || $tokens[$nextToken]['type'] !== 'T_OPEN_PARENTHESIS') + && ($prevToken === false + || $tokens[$prevToken]['type'] !== 'T_CLASS' + || $tokens[$prevToken]['type'] !== 'T_INTERFACE') + ) { + // Skip based on token scope condition. + if (isset($this->newKeywords[$tokenType]['condition']) + && \call_user_func(array($this, $this->newKeywords[$tokenType]['condition']), $phpcsFile, $stackPtr) === true + ) { + return; + } + + $itemInfo = array( + 'name' => $tokenType, + ); + $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); + } + } + + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 7.1.0 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo) + { + return $this->newKeywords[$itemInfo['name']]; + } + + + /** + * Get an array of the non-PHP-version array keys used in a sub-array. + * + * @since 7.1.0 + * + * @return array + */ + protected function getNonVersionArrayKeys() + { + return array( + 'description', + 'condition', + 'content', + ); + } + + + /** + * Retrieve the relevant detail (version) information for use in an error message. + * + * @since 7.1.0 + * + * @param array $itemArray Version and other information about the item. + * @param array $itemInfo Base information about the item. + * + * @return array + */ + public function getErrorInfo(array $itemArray, array $itemInfo) + { + $errorInfo = parent::getErrorInfo($itemArray, $itemInfo); + $errorInfo['description'] = $itemArray['description']; + + return $errorInfo; + } + + + /** + * Allow for concrete child classes to filter the error data before it's passed to PHPCS. + * + * @since 7.1.0 + * + * @param array $data The error data array which was created. + * @param array $itemInfo Base information about the item this error message applies to. + * @param array $errorInfo Detail information about an item this error message applies to. + * + * @return array + */ + protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) + { + $data[0] = $errorInfo['description']; + return $data; + } + + + /** + * Callback for the quoted heredoc identifier condition. + * + * A double quoted identifier will have the opening quote on position 3 + * in the string: `<<<"ID"`. + * + * @since 8.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return bool + */ + public function isNotQuoted(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + return ($tokens[$stackPtr]['content'][3] !== '"'); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/LanguageConstructs/NewEmptyNonVariableSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/LanguageConstructs/NewEmptyNonVariableSniff.php new file mode 100644 index 00000000..ffb9ef28 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/LanguageConstructs/NewEmptyNonVariableSniff.php @@ -0,0 +1,91 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\LanguageConstructs; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Verify that nothing but variables are passed to empty(). + * + * Prior to PHP 5.5, `empty()` only supported variables; anything else resulted in a parse error. + * + * PHP version 5.5 + * + * @link https://wiki.php.net/rfc/empty_isset_exprs + * @link https://www.php.net/manual/en/function.empty.php + * + * @since 7.0.4 + * @since 9.0.0 The "is the parameter a variable" determination has been abstracted out + * and moved to a separate method `Sniff::isVariable()`. + * @since 9.0.0 Renamed from `EmptyNonVariableSniff` to `NewEmptyNonVariableSniff`. + */ +class NewEmptyNonVariableSniff extends Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.4 + * + * @return array + */ + public function register() + { + return array(\T_EMPTY); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.4 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('5.4') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + $open = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true, null, true); + if ($open === false + || $tokens[$open]['code'] !== \T_OPEN_PARENTHESIS + || isset($tokens[$open]['parenthesis_closer']) === false + ) { + return; + } + + $close = $tokens[$open]['parenthesis_closer']; + + $nestingLevel = 0; + if ($close !== ($open + 1) && isset($tokens[$open + 1]['nested_parenthesis'])) { + $nestingLevel = \count($tokens[$open + 1]['nested_parenthesis']); + } + + if ($this->isVariable($phpcsFile, ($open + 1), $close, $nestingLevel) === true) { + return; + } + + $phpcsFile->addError( + 'Only variables can be passed to empty() prior to PHP 5.5.', + $stackPtr, + 'Found' + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/LanguageConstructs/NewLanguageConstructsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/LanguageConstructs/NewLanguageConstructsSniff.php new file mode 100644 index 00000000..44488ed0 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/LanguageConstructs/NewLanguageConstructsSniff.php @@ -0,0 +1,159 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\LanguageConstructs; + +use PHPCompatibility\AbstractNewFeatureSniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect use of new PHP language constructs. + * + * PHP version All + * + * @link https://wiki.php.net/rfc/namespaceseparator + * @link https://wiki.php.net/rfc/variadics + * @link https://wiki.php.net/rfc/argument_unpacking + * + * @since 5.6 + * @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class.. + * @since 9.0.0 Detection for new operator tokens has been moved to the `NewOperators` sniff. + */ +class NewLanguageConstructsSniff extends AbstractNewFeatureSniff +{ + + /** + * A list of new language constructs, not present in older versions. + * + * The array lists : version number with false (not present) or true (present). + * If's sufficient to list the first version where the keyword appears. + * + * @since 5.6 + * + * @var array(string => array(string => bool|string)) + */ + protected $newConstructs = array( + 'T_NS_SEPARATOR' => array( + '5.2' => false, + '5.3' => true, + 'description' => 'the \ operator (for namespaces)', + ), + 'T_ELLIPSIS' => array( + '5.5' => false, + '5.6' => true, + 'description' => 'the ... spread operator', + ), + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 5.6 + * + * @return array + */ + public function register() + { + $tokens = array(); + foreach ($this->newConstructs as $token => $versions) { + $tokens[] = constant($token); + } + return $tokens; + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 5.6 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $tokenType = $tokens[$stackPtr]['type']; + + $itemInfo = array( + 'name' => $tokenType, + ); + $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); + } + + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 7.1.0 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo) + { + return $this->newConstructs[$itemInfo['name']]; + } + + + /** + * Get an array of the non-PHP-version array keys used in a sub-array. + * + * @since 7.1.0 + * + * @return array + */ + protected function getNonVersionArrayKeys() + { + return array('description'); + } + + + /** + * Retrieve the relevant detail (version) information for use in an error message. + * + * @since 7.1.0 + * + * @param array $itemArray Version and other information about the item. + * @param array $itemInfo Base information about the item. + * + * @return array + */ + public function getErrorInfo(array $itemArray, array $itemInfo) + { + $errorInfo = parent::getErrorInfo($itemArray, $itemInfo); + $errorInfo['description'] = $itemArray['description']; + + return $errorInfo; + } + + + /** + * Allow for concrete child classes to filter the error data before it's passed to PHPCS. + * + * @since 7.1.0 + * + * @param array $data The error data array which was created. + * @param array $itemInfo Base information about the item this error message applies to. + * @param array $errorInfo Detail information about an item this error message applies to. + * + * @return array + */ + protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) + { + $data[0] = $errorInfo['description']; + return $data; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/AssignmentOrderSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/AssignmentOrderSniff.php new file mode 100644 index 00000000..f5ba4772 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/AssignmentOrderSniff.php @@ -0,0 +1,188 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Lists; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect code affected by the changed list assignment order in PHP 7.0+. + * + * The `list()` construct no longer assigns variables in reverse order. + * This affects all list constructs where non-unique variables are used. + * + * PHP version 7.0 + * + * @link https://www.php.net/manual/en/migration70.incompatible.php#migration70.incompatible.variable-handling.list.order + * @link https://wiki.php.net/rfc/abstract_syntax_tree#changes_to_list + * @link https://www.php.net/manual/en/function.list.php + * + * @since 9.0.0 + */ +class AssignmentOrderSniff extends Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 9.0.0 + * + * @return array + */ + public function register() + { + return array( + \T_LIST, + \T_OPEN_SHORT_ARRAY, + ); + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 9.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void|int Void if not a valid list. If a list construct has been + * examined, the stack pointer to the list closer to skip + * passed any nested lists which don't need to be examined again. + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('7.0') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + if ($tokens[$stackPtr]['code'] === \T_OPEN_SHORT_ARRAY + && $this->isShortList($phpcsFile, $stackPtr) === false + ) { + // Short array, not short list. + return; + } + + if ($tokens[$stackPtr]['code'] === \T_LIST) { + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($nextNonEmpty === false + || $tokens[$nextNonEmpty]['code'] !== \T_OPEN_PARENTHESIS + || isset($tokens[$nextNonEmpty]['parenthesis_closer']) === false + ) { + // Parse error or live coding. + return; + } + + $opener = $nextNonEmpty; + $closer = $tokens[$nextNonEmpty]['parenthesis_closer']; + } else { + // Short list syntax. + $opener = $stackPtr; + + if (isset($tokens[$stackPtr]['bracket_closer'])) { + $closer = $tokens[$stackPtr]['bracket_closer']; + } + } + + if (isset($opener, $closer) === false) { + return; + } + + /* + * OK, so we have the opener & closer, now we need to check all the variables in the + * list() to see if there are duplicates as that's the problem. + */ + $hasVars = $phpcsFile->findNext(array(\T_VARIABLE, \T_DOLLAR), ($opener + 1), $closer); + if ($hasVars === false) { + // Empty list, not our concern. + return ($closer + 1); + } + + // Set the variable delimiters based on the list type being examined. + $stopPoints = array(\T_COMMA); + if ($tokens[$stackPtr]['code'] === \T_OPEN_SHORT_ARRAY) { + $stopPoints[] = \T_CLOSE_SHORT_ARRAY; + } else { + $stopPoints[] = \T_CLOSE_PARENTHESIS; + } + + $listVars = array(); + $lastStopPoint = $opener; + + /* + * Create a list of all variables used within the `list()` construct. + * We're not concerned with whether these are nested or not, as any duplicate + * variable name used will be problematic, independent of nesting. + */ + do { + $nextStopPoint = $phpcsFile->findNext($stopPoints, ($lastStopPoint + 1), $closer); + if ($nextStopPoint === false) { + $nextStopPoint = $closer; + } + + // Also detect this in PHP 7.1 keyed lists. + $hasDoubleArrow = $phpcsFile->findNext(\T_DOUBLE_ARROW, ($lastStopPoint + 1), $nextStopPoint); + if ($hasDoubleArrow !== false) { + $lastStopPoint = $hasDoubleArrow; + } + + // Find the start of the variable, allowing for variable variables. + $nextStartPoint = $phpcsFile->findNext(array(\T_VARIABLE, \T_DOLLAR), ($lastStopPoint + 1), $nextStopPoint); + if ($nextStartPoint === false) { + // Skip past empty bits in the list, i.e. `list( $a, , ,)`. + $lastStopPoint = $nextStopPoint; + continue; + } + + /* + * Gather the content of all non-empty tokens to determine the "variable name". + * Variable name in this context includes array or object property syntaxes, such + * as `$a['name']` and `$b->property`. + */ + $varContent = ''; + + for ($i = $nextStartPoint; $i < $nextStopPoint; $i++) { + if (isset(Tokens::$emptyTokens[$tokens[$i]['code']])) { + continue; + } + + $varContent .= $tokens[$i]['content']; + } + + if ($varContent !== '') { + $listVars[] = $varContent; + } + + $lastStopPoint = $nextStopPoint; + + } while ($lastStopPoint < $closer); + + if (empty($listVars)) { + // Shouldn't be possible, but just in case. + return ($closer + 1); + } + + // Verify that all variables used in the list() construct are unique. + if (\count($listVars) !== \count(array_unique($listVars))) { + $phpcsFile->addError( + 'list() will assign variable from left-to-right since PHP 7.0. Ensure all variables in list() are unique to prevent unexpected results.', + $stackPtr, + 'Affected' + ); + } + + return ($closer + 1); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/ForbiddenEmptyListAssignmentSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/ForbiddenEmptyListAssignmentSniff.php new file mode 100644 index 00000000..b9d4b7b0 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/ForbiddenEmptyListAssignmentSniff.php @@ -0,0 +1,116 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Lists; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Support for empty `list()` expressions has been removed in PHP 7.0. + * + * PHP version 7.0 + * + * @link https://www.php.net/manual/en/migration70.incompatible.php#migration70.incompatible.variable-handling.list.empty + * @link https://wiki.php.net/rfc/abstract_syntax_tree#changes_to_list + * @link https://www.php.net/manual/en/function.list.php + * + * @since 7.0.0 + */ +class ForbiddenEmptyListAssignmentSniff extends Sniff +{ + + /** + * List of tokens to disregard when determining whether the list() is empty. + * + * @since 7.0.3 + * + * @var array + */ + protected $ignoreTokens = array(); + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.0 + * + * @return array + */ + public function register() + { + // Set up a list of tokens to disregard when determining whether the list() is empty. + // Only needs to be set up once. + $this->ignoreTokens = Tokens::$emptyTokens; + $this->ignoreTokens[\T_COMMA] = \T_COMMA; + $this->ignoreTokens[\T_OPEN_PARENTHESIS] = \T_OPEN_PARENTHESIS; + $this->ignoreTokens[\T_CLOSE_PARENTHESIS] = \T_CLOSE_PARENTHESIS; + + return array( + \T_LIST, + \T_OPEN_SHORT_ARRAY, + ); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('7.0') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + if ($tokens[$stackPtr]['code'] === \T_OPEN_SHORT_ARRAY) { + if ($this->isShortList($phpcsFile, $stackPtr) === false) { + return; + } + + $open = $stackPtr; + $close = $tokens[$stackPtr]['bracket_closer']; + } else { + // T_LIST. + $open = $phpcsFile->findNext(\T_OPEN_PARENTHESIS, $stackPtr, null, false, null, true); + if ($open === false || isset($tokens[$open]['parenthesis_closer']) === false) { + return; + } + + $close = $tokens[$open]['parenthesis_closer']; + } + + $error = true; + if (($close - $open) > 1) { + for ($cnt = $open + 1; $cnt < $close; $cnt++) { + if (isset($this->ignoreTokens[$tokens[$cnt]['code']]) === false) { + $error = false; + break; + } + } + } + + if ($error === true) { + $phpcsFile->addError( + 'Empty list() assignments are not allowed since PHP 7.0', + $stackPtr, + 'Found' + ); + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/NewKeyedListSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/NewKeyedListSniff.php new file mode 100644 index 00000000..7111b125 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/NewKeyedListSniff.php @@ -0,0 +1,227 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Lists; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Since PHP 7.1, you can specify keys in `list()`, or its new shorthand `[]` syntax. + * + * PHP version 7.1 + * + * @link https://wiki.php.net/rfc/list_keys + * @link https://www.php.net/manual/en/function.list.php + * + * @since 9.0.0 + */ +class NewKeyedListSniff extends Sniff +{ + /** + * Tokens which represent the start of a list construct. + * + * @since 9.0.0 + * + * @var array + */ + protected $sniffTargets = array( + \T_LIST => \T_LIST, + \T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY, + ); + + /** + * The token(s) within the list construct which is being targeted. + * + * @since 9.0.0 + * + * @var array + */ + protected $targetsInList = array( + \T_DOUBLE_ARROW => \T_DOUBLE_ARROW, + ); + + /** + * All tokens needed to walk through the list construct and + * determine whether the target token is contained within. + * + * Set by the setUpAllTargets() method which is called from within register(). + * + * @since 9.0.0 + * + * @var array + */ + protected $allTargets; + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 9.0.0 + * + * @return array + */ + public function register() + { + $this->setUpAllTargets(); + + return $this->sniffTargets; + } + + /** + * Prepare the $allTargets array only once. + * + * @since 9.0.0 + * + * @return void + */ + public function setUpAllTargets() + { + $this->allTargets = $this->sniffTargets + $this->targetsInList; + } + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * @since 9.0.0 + * + * @return bool + */ + protected function bowOutEarly() + { + return ($this->supportsBelow('7.0') === false); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 9.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->bowOutEarly() === true) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + if ($tokens[$stackPtr]['code'] === \T_OPEN_SHORT_ARRAY + && $this->isShortList($phpcsFile, $stackPtr) === false + ) { + // Short array, not short list. + return; + } + + if ($tokens[$stackPtr]['code'] === \T_LIST) { + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($nextNonEmpty === false + || $tokens[$nextNonEmpty]['code'] !== \T_OPEN_PARENTHESIS + || isset($tokens[$nextNonEmpty]['parenthesis_closer']) === false + ) { + // Parse error or live coding. + return; + } + + $opener = $nextNonEmpty; + $closer = $tokens[$nextNonEmpty]['parenthesis_closer']; + } else { + // Short list syntax. + $opener = $stackPtr; + + if (isset($tokens[$stackPtr]['bracket_closer'])) { + $closer = $tokens[$stackPtr]['bracket_closer']; + } + } + + if (isset($opener, $closer) === false) { + return; + } + + $this->examineList($phpcsFile, $opener, $closer); + } + + + /** + * Examine the contents of a list construct to determine whether an error needs to be thrown. + * + * @since 9.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $opener The position of the list open token. + * @param int $closer The position of the list close token. + * + * @return void + */ + protected function examineList(File $phpcsFile, $opener, $closer) + { + $start = $opener; + while (($start = $this->hasTargetInList($phpcsFile, $start, $closer)) !== false) { + $phpcsFile->addError( + 'Specifying keys in list constructs is not supported in PHP 7.0 or earlier.', + $start, + 'Found' + ); + } + } + + + /** + * Check whether a certain target token exists within a list construct. + * + * Skips past nested list constructs, so these can be examined based on their own token. + * + * @since 9.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $start The position of the list open token or a token + * within the list to start (resume) the examination from. + * @param int $closer The position of the list close token. + * + * @return int|bool Stack pointer to the target token if encountered. False otherwise. + */ + protected function hasTargetInList(File $phpcsFile, $start, $closer) + { + $tokens = $phpcsFile->getTokens(); + + for ($i = ($start + 1); $i < $closer; $i++) { + if (isset($this->allTargets[$tokens[$i]['code']]) === false) { + continue; + } + + if (isset($this->targetsInList[$tokens[$i]['code']]) === true) { + return $i; + } + + // Skip past nested list constructs. + if ($tokens[$i]['code'] === \T_LIST) { + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($i + 1), null, true); + if ($nextNonEmpty !== false + && $tokens[$nextNonEmpty]['code'] === \T_OPEN_PARENTHESIS + && isset($tokens[$nextNonEmpty]['parenthesis_closer']) === true + ) { + $i = $tokens[$nextNonEmpty]['parenthesis_closer']; + } + } elseif ($tokens[$i]['code'] === \T_OPEN_SHORT_ARRAY + && isset($tokens[$i]['bracket_closer']) + ) { + $i = $tokens[$i]['bracket_closer']; + } + } + + return false; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/NewListReferenceAssignmentSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/NewListReferenceAssignmentSniff.php new file mode 100644 index 00000000..ebcd7c8e --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/NewListReferenceAssignmentSniff.php @@ -0,0 +1,74 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Lists; + +use PHPCompatibility\Sniffs\Lists\NewKeyedListSniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect reference assignments in array destructuring using (short) list. + * + * PHP version 7.3 + * + * @link https://www.php.net/manual/en/migration73.new-features.php#migration73.new-features.core.destruct-reference + * @link https://wiki.php.net/rfc/list_reference_assignment + * @link https://www.php.net/manual/en/function.list.php + * + * @since 9.0.0 + */ +class NewListReferenceAssignmentSniff extends NewKeyedListSniff +{ + /** + * The token(s) within the list construct which is being targeted. + * + * @since 9.0.0 + * + * @var array + */ + protected $targetsInList = array( + \T_BITWISE_AND => \T_BITWISE_AND, + ); + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * @since 9.0.0 + * + * @return bool + */ + protected function bowOutEarly() + { + return ($this->supportsBelow('7.2') === false); + } + + /** + * Examine the contents of a list construct to determine whether an error needs to be thrown. + * + * @since 9.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $opener The position of the list open token. + * @param int $closer The position of the list close token. + * + * @return void + */ + protected function examineList(File $phpcsFile, $opener, $closer) + { + $start = $opener; + while (($start = $this->hasTargetInList($phpcsFile, $start, $closer)) !== false) { + $phpcsFile->addError( + 'Reference assignments within list constructs are not supported in PHP 7.2 or earlier.', + $start, + 'Found' + ); + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/NewShortListSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/NewShortListSniff.php new file mode 100644 index 00000000..ee100fbe --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/NewShortListSniff.php @@ -0,0 +1,84 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Lists; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect short list syntax for symmetric array destructuring. + * + * "The shorthand array syntax (`[]`) may now be used to destructure arrays for + * assignments (including within `foreach`), as an alternative to the existing + * `list()` syntax, which is still supported." + * + * PHP version 7.1 + * + * @link https://www.php.net/manual/en/migration71.new-features.php#migration71.new-features.symmetric-array-destructuring + * @link https://wiki.php.net/rfc/short_list_syntax + * + * @since 9.0.0 + */ +class NewShortListSniff extends Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 9.0.0 + * + * @return array + */ + public function register() + { + return array(\T_OPEN_SHORT_ARRAY); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 9.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('7.0') === false) { + return; + } + + if ($this->isShortList($phpcsFile, $stackPtr) === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $closer = $tokens[$stackPtr]['bracket_closer']; + + $hasVariable = $phpcsFile->findNext(\T_VARIABLE, ($stackPtr + 1), $closer); + if ($hasVariable === false) { + // List syntax is only valid if there are variables in it. + return; + } + + $phpcsFile->addError( + 'The shorthand list syntax "[]" to destructure arrays is not available in PHP 7.0 or earlier.', + $stackPtr, + 'Found' + ); + + return ($closer + 1); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/MethodUse/ForbiddenToStringParametersSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/MethodUse/ForbiddenToStringParametersSniff.php new file mode 100644 index 00000000..d580bac7 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/MethodUse/ForbiddenToStringParametersSniff.php @@ -0,0 +1,103 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\MethodUse; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * As of PHP 5.3, the `__toString()` magic method can no longer be passed arguments. + * + * Sister-sniff to `PHPCompatibility.FunctionDeclarations.ForbiddenToStringParameters`. + * + * PHP version 5.3 + * + * @link https://www.php.net/manual/en/migration53.incompatible.php + * @link https://www.php.net/manual/en/language.oop5.magic.php#object.tostring + * + * @since 9.2.0 + */ +class ForbiddenToStringParametersSniff extends Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 9.2.0 + * + * @return array + */ + public function register() + { + return array( + \T_DOUBLE_COLON, + \T_OBJECT_OPERATOR, + ); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 9.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('5.3') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== \T_STRING) { + /* + * Not a method call. + * + * Note: This disregards method calls with the method name in a variable, like: + * $method = '__toString'; + * $obj->$method(); + * However, that would be very hard to examine reliably anyway. + */ + return; + } + + if (strtolower($tokens[$nextNonEmpty]['content']) !== '__tostring') { + // Not a call to the __toString() method. + return; + } + + $openParens = $phpcsFile->findNext(Tokens::$emptyTokens, ($nextNonEmpty + 1), null, true); + if ($openParens === false || $tokens[$openParens]['code'] !== \T_OPEN_PARENTHESIS) { + // Not a method call. + return; + } + + $closeParens = $phpcsFile->findNext(Tokens::$emptyTokens, ($openParens + 1), null, true); + if ($closeParens === false || $tokens[$closeParens]['code'] === \T_CLOSE_PARENTHESIS) { + // Not a method call. + return; + } + + // If we're still here, then this is a call to the __toString() magic method passing parameters. + $phpcsFile->addError( + 'The __toString() magic method will no longer accept passed arguments since PHP 5.3', + $stackPtr, + 'Passed' + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/MethodUse/NewDirectCallsToCloneSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/MethodUse/NewDirectCallsToCloneSniff.php new file mode 100644 index 00000000..873ef1d2 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/MethodUse/NewDirectCallsToCloneSniff.php @@ -0,0 +1,117 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\MethodUse; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect direct calls to the `__clone()` magic method, which is allowed since PHP 7.0. + * + * "Doing calls like `$obj->__clone()` is now allowed. This was the only magic method + * that had a compile-time check preventing some calls to it, which doesn't make sense. + * If we allow all other magic methods to be called, there's no reason to forbid this one." + * + * PHP version 7.0 + * + * @link https://wiki.php.net/rfc/abstract_syntax_tree#directly_calling_clone_is_allowed + * @link https://www.php.net/manual/en/language.oop5.cloning.php + * + * @since 9.1.0 + */ +class NewDirectCallsToCloneSniff extends Sniff +{ + + /** + * Tokens which indicate class internal use. + * + * @since 9.3.2 + * + * @var array + */ + protected $classInternal = array( + \T_PARENT => true, + \T_SELF => true, + \T_STATIC => true, + ); + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 9.1.0 + * + * @return array + */ + public function register() + { + return array( + \T_DOUBLE_COLON, + \T_OBJECT_OPERATOR, + ); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 9.1.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('5.6') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== \T_STRING) { + /* + * Not a method call. + * + * Note: This disregards method calls with the method name in a variable, like: + * $method = '__clone'; + * $obj->$method(); + * However, that would be very hard to examine reliably anyway. + */ + return; + } + + if (strtolower($tokens[$nextNonEmpty]['content']) !== '__clone') { + // Not a call to the __clone() method. + return; + } + + $nextNextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($nextNonEmpty + 1), null, true); + if ($nextNextNonEmpty === false || $tokens[$nextNextNonEmpty]['code'] !== \T_OPEN_PARENTHESIS) { + // Not a method call. + return; + } + + $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); + if ($prevNonEmpty === false || isset($this->classInternal[$tokens[$prevNonEmpty]['code']])) { + // Class internal call to __clone(). + return; + } + + $phpcsFile->addError( + 'Direct calls to the __clone() magic method are not allowed in PHP 5.6 or earlier.', + $nextNonEmpty, + 'Found' + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Miscellaneous/NewPHPOpenTagEOFSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Miscellaneous/NewPHPOpenTagEOFSniff.php new file mode 100644 index 00000000..85e10bcf --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Miscellaneous/NewPHPOpenTagEOFSniff.php @@ -0,0 +1,147 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Miscellaneous; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; + +/** + * PHP 7.4 now supports stand-alone PHP tags at the end of a file (without new line). + * + * > `<?php` at the end of the file (without trailing newline) will now be + * > interpreted as an opening PHP tag. Previously it was interpreted either as + * > `<? php` and resulted in a syntax error (with short_open_tag=1) or was + * > interpreted as a literal `<?php` string (with short_open_tag=0). + * + * {@internal Due to an issue with the Tokenizer, this sniff will not work correctly + * on PHP 5.3 in combination with PHPCS < 2.6.0 when short_open_tag is `On`. + * As this is causing "Undefined offset" notices, there is nothing we can + * do to work-around this.} + * + * PHP version 7.4 + * + * @link https://www.php.net/manual/en/migration74.incompatible.php#migration74.incompatible.core.php-tag + * @link https://github.com/php/php-src/blob/30de357fa14480468132bbc22a272aeb91789ba8/UPGRADING#L37-L40 + * + * @since 9.3.0 + */ +class NewPHPOpenTagEOFSniff extends Sniff +{ + + /** + * Whether or not short open tags is enabled on the install running the sniffs. + * + * @since 9.3.0 + * + * @var bool + */ + protected $shortOpenTags; + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 9.3.0 + * + * @return array + */ + public function register() + { + $targets = array( + \T_OPEN_TAG_WITH_ECHO, + ); + + $this->shortOpenTags = (bool) ini_get('short_open_tag'); + if ($this->shortOpenTags === false) { + $targets[] = \T_INLINE_HTML; + } else { + $targets[] = \T_STRING; + } + + if (version_compare(\PHP_VERSION_ID, '70399', '>')) { + $targets[] = \T_OPEN_TAG; + } + + return $targets; + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 9.3.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('7.3') === false) { + return; + } + + if ($stackPtr !== ($phpcsFile->numTokens - 1)) { + // We're only interested in the last token in the file. + return; + } + + $tokens = $phpcsFile->getTokens(); + $contents = $tokens[$stackPtr]['content']; + $error = false; + + switch ($tokens[$stackPtr]['code']) { + case \T_INLINE_HTML: + // PHP < 7.4 with short open tags off. + if ($contents === '<?php') { + $error = true; + } elseif ($contents === '<?=') { + // Also cover short open echo tags in PHP 5.3 with short open tags off. + $error = true; + } + break; + + case \T_STRING: + // PHP < 7.4 with short open tags on. + if ($contents === 'php' + && $tokens[($stackPtr - 1)]['code'] === \T_OPEN_TAG + && $tokens[($stackPtr - 1)]['content'] === '<?' + ) { + $error = true; + } + break; + + case \T_OPEN_TAG_WITH_ECHO: + // PHP 5.4+. + if (rtrim($contents) === '<?=') { + $error = true; + } + break; + + case \T_OPEN_TAG: + // PHP 7.4+. + if ($contents === '<?php') { + $error = true; + } + break; + } + + if ($error === true) { + $phpcsFile->addError( + 'A PHP open tag at the end of a file, without trailing newline, was not supported in PHP 7.3 or earlier and would result in a syntax error or be interpreted as a literal string', + $stackPtr, + 'Found' + ); + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Miscellaneous/RemovedAlternativePHPTagsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Miscellaneous/RemovedAlternativePHPTagsSniff.php new file mode 100644 index 00000000..47143a3d --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Miscellaneous/RemovedAlternativePHPTagsSniff.php @@ -0,0 +1,172 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Miscellaneous; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; + +/** + * Check for use of alternative PHP tags, support for which was removed in PHP 7.0. + * + * {@internal Based on `Generic.PHP.DisallowAlternativePHPTags` by Juliette Reinders Folmer + * (with permission) which was merged into PHPCS 2.7.0.} + * + * PHP version 7.0 + * + * @link https://wiki.php.net/rfc/remove_alternative_php_tags + * @link https://www.php.net/manual/en/language.basic-syntax.phptags.php + * + * @since 7.0.4 + */ +class RemovedAlternativePHPTagsSniff extends Sniff +{ + + /** + * Whether ASP tags are enabled or not. + * + * @since 7.0.4 + * + * @var bool + */ + private $aspTags = false; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.4 + * + * @return array + */ + public function register() + { + if (version_compare(\PHP_VERSION_ID, '70000', '<') === true) { + // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.asp_tagsRemoved + $this->aspTags = (bool) ini_get('asp_tags'); + } + + return array( + \T_OPEN_TAG, + \T_OPEN_TAG_WITH_ECHO, + \T_INLINE_HTML, + ); + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.4 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('7.0') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $openTag = $tokens[$stackPtr]; + $content = trim($openTag['content']); + + if ($content === '' || $content === '<?php') { + return; + } + + if ($openTag['code'] === \T_OPEN_TAG || $openTag['code'] === \T_OPEN_TAG_WITH_ECHO) { + + if ($content === '<%' || $content === '<%=') { + $data = array( + 'ASP', + $content, + ); + $errorCode = 'ASPOpenTagFound'; + + } elseif (strpos($content, '<script ') !== false) { + $data = array( + 'Script', + $content, + ); + $errorCode = 'ScriptOpenTagFound'; + } else { + return; + } + } + // Account for incorrect script open tags. + // The "(?:<s)?" in the regex is to work-around a bug in the tokenizer in PHP 5.2. + elseif ($openTag['code'] === \T_INLINE_HTML + && preg_match('`((?:<s)?cript (?:[^>]+)?language=[\'"]?php[\'"]?(?:[^>]+)?>)`i', $content, $match) === 1 + ) { + $found = $match[1]; + $data = array( + 'Script', + $found, + ); + $errorCode = 'ScriptOpenTagFound'; + } + + if (isset($errorCode, $data)) { + $phpcsFile->addError( + '%s style opening tags have been removed in PHP 7.0. Found "%s"', + $stackPtr, + $errorCode, + $data + ); + return; + } + + // If we're still here, we can't be sure if what we found was really intended as ASP open tags. + if ($openTag['code'] === \T_INLINE_HTML && $this->aspTags === false) { + if (strpos($content, '<%') !== false) { + $error = 'Possible use of ASP style opening tags detected. ASP style opening tags have been removed in PHP 7.0. Found: %s'; + $snippet = $this->getSnippet($content, '<%'); + $data = array('<%' . $snippet); + + $phpcsFile->addWarning($error, $stackPtr, 'MaybeASPOpenTagFound', $data); + } + } + } + + + /** + * Get a snippet from a HTML token. + * + * @since 7.0.4 + * + * @param string $content The content of the HTML token. + * @param string $startAt Partial string to use as a starting point for the snippet. + * @param int $length The target length of the snippet to get. Defaults to 25. + * + * @return string + */ + protected function getSnippet($content, $startAt = '', $length = 25) + { + $startPos = 0; + + if ($startAt !== '') { + $startPos = strpos($content, $startAt); + if ($startPos !== false) { + $startPos += \strlen($startAt); + } + } + + $snippet = substr($content, $startPos, $length); + if ((\strlen($content) - $startPos) > $length) { + $snippet .= '...'; + } + + return $snippet; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Miscellaneous/ValidIntegersSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Miscellaneous/ValidIntegersSniff.php new file mode 100644 index 00000000..53dce438 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Miscellaneous/ValidIntegersSniff.php @@ -0,0 +1,250 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Miscellaneous; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; + +/** + * Check for valid integer types and values. + * + * Checks: + * - PHP 5.4 introduced binary integers. + * - PHP 7.0 removed tolerance for invalid octals. These were truncated prior to PHP 7 + * and give a parse error since PHP 7. + * - PHP 7.0 removed support for recognizing hexadecimal numeric strings as numeric. + * Type juggling and recognition was inconsistent prior to PHP 7. As of PHP 7, they + * are no longer treated as numeric. + * + * PHP version 5.4+ + * + * @link https://wiki.php.net/rfc/binnotation4ints + * @link https://wiki.php.net/rfc/remove_hex_support_in_numeric_strings + * @link https://www.php.net/manual/en/language.types.integer.php + * + * @since 7.0.3 + * @since 7.0.8 This sniff now throws a warning instead of an error for invalid binary integers. + */ +class ValidIntegersSniff extends Sniff +{ + + /** + * Whether PHPCS is run on a PHP < 5.4. + * + * @since 7.0.3 + * + * @var bool + */ + protected $isLowPHPVersion = false; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.3 + * + * @return array + */ + public function register() + { + $this->isLowPHPVersion = version_compare(\PHP_VERSION_ID, '50400', '<'); + + return array( + \T_LNUMBER, // Binary, octal integers. + \T_CONSTANT_ENCAPSED_STRING, // Hex numeric string. + ); + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.3 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $token = $tokens[$stackPtr]; + + if ($this->couldBeBinaryInteger($tokens, $stackPtr) === true) { + if ($this->supportsBelow('5.3')) { + $error = 'Binary integer literals were not present in PHP version 5.3 or earlier. Found: %s'; + if ($this->isLowPHPVersion === false) { + $data = array($token['content']); + } else { + $data = array($this->getBinaryInteger($phpcsFile, $tokens, $stackPtr)); + } + $phpcsFile->addError($error, $stackPtr, 'BinaryIntegerFound', $data); + } + + if ($this->isInvalidBinaryInteger($tokens, $stackPtr) === true) { + $error = 'Invalid binary integer detected. Found: %s'; + $data = array($this->getBinaryInteger($phpcsFile, $tokens, $stackPtr)); + $phpcsFile->addWarning($error, $stackPtr, 'InvalidBinaryIntegerFound', $data); + } + return; + } + + $isError = $this->supportsAbove('7.0'); + $data = array( $token['content'] ); + + if ($this->isInvalidOctalInteger($tokens, $stackPtr) === true) { + $this->addMessage( + $phpcsFile, + 'Invalid octal integer detected. Prior to PHP 7 this would lead to a truncated number. From PHP 7 onwards this causes a parse error. Found: %s', + $stackPtr, + $isError, + 'InvalidOctalIntegerFound', + $data + ); + return; + } + + if ($this->isHexidecimalNumericString($tokens, $stackPtr) === true) { + $this->addMessage( + $phpcsFile, + 'The behaviour of hexadecimal numeric strings was inconsistent prior to PHP 7 and support has been removed in PHP 7. Found: %s', + $stackPtr, + $isError, + 'HexNumericStringFound', + $data + ); + return; + } + } + + + /** + * Could the current token potentially be a binary integer ? + * + * @since 7.0.3 + * + * @param array $tokens Token stack. + * @param int $stackPtr The current position in the token stack. + * + * @return bool + */ + private function couldBeBinaryInteger($tokens, $stackPtr) + { + $token = $tokens[$stackPtr]; + + if ($token['code'] !== \T_LNUMBER) { + return false; + } + + if ($this->isLowPHPVersion === false) { + return (preg_match('`^0b[0-1]+$`iD', $token['content']) === 1); + } + // Pre-5.4, binary strings are tokenized as T_LNUMBER (0) + T_STRING ("b01010101"). + // At this point, we don't yet care whether it's a valid binary int, that's a separate check. + else { + return($token['content'] === '0' && $tokens[$stackPtr + 1]['code'] === \T_STRING && preg_match('`^b[0-9]+$`iD', $tokens[$stackPtr + 1]['content']) === 1); + } + } + + /** + * Is the current token an invalid binary integer ? + * + * @since 7.0.3 + * + * @param array $tokens Token stack. + * @param int $stackPtr The current position in the token stack. + * + * @return bool + */ + private function isInvalidBinaryInteger($tokens, $stackPtr) + { + if ($this->couldBeBinaryInteger($tokens, $stackPtr) === false) { + return false; + } + + if ($this->isLowPHPVersion === false) { + // If it's an invalid binary int, the token will be split into two T_LNUMBER tokens. + return ($tokens[$stackPtr + 1]['code'] === \T_LNUMBER); + } else { + return (preg_match('`^b[0-1]+$`iD', $tokens[$stackPtr + 1]['content']) === 0); + } + } + + /** + * Retrieve the content of the tokens which together look like a binary integer. + * + * @since 7.0.3 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param array $tokens Token stack. + * @param int $stackPtr The position of the current token in + * the stack. + * + * @return string + */ + private function getBinaryInteger(File $phpcsFile, $tokens, $stackPtr) + { + $length = 2; // PHP < 5.4 T_LNUMBER + T_STRING. + + if ($this->isLowPHPVersion === false) { + $i = $stackPtr; + while ($tokens[$i]['code'] === \T_LNUMBER) { + $i++; + } + $length = ($i - $stackPtr); + } + + return $phpcsFile->getTokensAsString($stackPtr, $length); + } + + /** + * Is the current token an invalid octal integer ? + * + * @since 7.0.3 + * + * @param array $tokens Token stack. + * @param int $stackPtr The current position in the token stack. + * + * @return bool + */ + private function isInvalidOctalInteger($tokens, $stackPtr) + { + $token = $tokens[$stackPtr]; + + if ($token['code'] === \T_LNUMBER && preg_match('`^0[0-7]*[8-9]+[0-9]*$`D', $token['content']) === 1) { + return true; + } + + return false; + } + + /** + * Is the current token a hexidecimal numeric string ? + * + * @since 7.0.3 + * + * @param array $tokens Token stack. + * @param int $stackPtr The current position in the token stack. + * + * @return bool + */ + private function isHexidecimalNumericString($tokens, $stackPtr) + { + $token = $tokens[$stackPtr]; + + if ($token['code'] === \T_CONSTANT_ENCAPSED_STRING && preg_match('`^0x[a-f0-9]+$`iD', $this->stripQuotes($token['content'])) === 1) { + return true; + } + + return false; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/ChangedConcatOperatorPrecedenceSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/ChangedConcatOperatorPrecedenceSniff.php new file mode 100644 index 00000000..3dfe738c --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/ChangedConcatOperatorPrecedenceSniff.php @@ -0,0 +1,199 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Operators; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect code affected by the change in operator precedence of concatenation in PHP 8.0. + * + * In PHP < 8.0 the operator precedence of `.`, `+` and `-` are the same. + * As of PHP 8.0, the operator precedence of the concatenation operator will be + * lowered to be right below the `<<` and `>>` operators. + * + * As of PHP 7.4, a deprecation warning will be thrown upon encountering an + * unparenthesized expression containing an `.` before a `+` or `-`. + * + * PHP version 7.4 + * PHP version 8.0 + * + * @link https://wiki.php.net/rfc/concatenation_precedence + * @link https://www.php.net/manual/en/language.operators.precedence.php + * + * @since 9.2.0 + */ +class ChangedConcatOperatorPrecedenceSniff extends Sniff +{ + + /** + * List of tokens with a lower operator precedence than concatenation in PHP >= 8.0. + * + * @since 9.2.0 + * + * @var array + */ + private $tokensWithLowerPrecedence = array( + 'T_BITWISE_AND' => true, + 'T_BITWISE_XOR' => true, + 'T_BITWISE_OR' => true, + 'T_COALESCE' => true, + 'T_INLINE_THEN' => true, + 'T_INLINE_ELSE' => true, + 'T_YIELD_FROM' => true, + 'T_YIELD' => true, + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 9.2.0 + * + * @return array + */ + public function register() + { + return array( + \T_PLUS, + \T_MINUS, + ); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 9.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('7.4') === false) { + return; + } + + if ($this->isUnaryPlusMinus($phpcsFile, $stackPtr) === true) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + for ($i = ($stackPtr - 1); $stackPtr >= 0; $i--) { + if ($tokens[$i]['code'] === \T_STRING_CONCAT) { + // Found one. + break; + } + + if ($tokens[$i]['code'] === \T_SEMICOLON + || $tokens[$i]['code'] === \T_OPEN_CURLY_BRACKET + || $tokens[$i]['code'] === \T_OPEN_TAG + || $tokens[$i]['code'] === \T_OPEN_TAG_WITH_ECHO + || $tokens[$i]['code'] === \T_COMMA + || $tokens[$i]['code'] === \T_COLON + || $tokens[$i]['code'] === \T_CASE + ) { + // If we reached any of the above tokens, we've reached the end of + // the statement without encountering a concatenation operator. + return; + } + + if ($tokens[$i]['code'] === \T_OPEN_CURLY_BRACKET + && isset($tokens[$i]['bracket_closer']) + && $tokens[$i]['bracket_closer'] > $stackPtr + ) { + // No need to look any further, this is plus/minus within curly braces + // and we've reached the open curly. + return; + } + + if ($tokens[$i]['code'] === \T_OPEN_PARENTHESIS + && isset($tokens[$i]['parenthesis_closer']) + && $tokens[$i]['parenthesis_closer'] > $stackPtr + ) { + // No need to look any further, this is plus/minus within parenthesis + // and we've reached the open parenthesis. + return; + } + + if (($tokens[$i]['code'] === \T_OPEN_SHORT_ARRAY + || $tokens[$i]['code'] === \T_OPEN_SQUARE_BRACKET) + && isset($tokens[$i]['bracket_closer']) + && $tokens[$i]['bracket_closer'] > $stackPtr + ) { + // No need to look any further, this is plus/minus within a short array + // or array key square brackets and we've reached the opener. + return; + } + + if ($tokens[$i]['code'] === \T_CLOSE_CURLY_BRACKET) { + if (isset($tokens[$i]['scope_owner'])) { + // Different scope, we've passed the start of the statement. + return; + } + + if (isset($tokens[$i]['bracket_opener'])) { + $i = $tokens[$i]['bracket_opener']; + } + + continue; + } + + if ($tokens[$i]['code'] === \T_CLOSE_PARENTHESIS + && isset($tokens[$i]['parenthesis_opener']) + ) { + // Skip over statements in parenthesis, including long arrays. + $i = $tokens[$i]['parenthesis_opener']; + continue; + } + + if (($tokens[$i]['code'] === \T_CLOSE_SQUARE_BRACKET + || $tokens[$i]['code'] === \T_CLOSE_SHORT_ARRAY) + && isset($tokens[$i]['bracket_opener']) + ) { + // Skip over array keys and short arrays. + $i = $tokens[$i]['bracket_opener']; + continue; + } + + // Check for chain being broken by a token with a lower precedence. + if (isset(Tokens::$booleanOperators[$tokens[$i]['code']]) === true + || isset(Tokens::$assignmentTokens[$tokens[$i]['code']]) === true + ) { + return; + } + + if (isset($this->tokensWithLowerPrecedence[$tokens[$i]['type']]) === true) { + if ($tokens[$i]['code'] === \T_BITWISE_AND + && $phpcsFile->isReference($i) === true + ) { + continue; + } + + return; + } + } + + $message = 'Using an unparenthesized expression containing a "." before a "+" or "-" has been deprecated in PHP 7.4'; + $isError = false; + if ($this->supportsAbove('8.0') === true) { + $message .= ' and removed in PHP 8.0'; + $isError = true; + } + + $this->addMessage($phpcsFile, $message, $i, $isError); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/ForbiddenNegativeBitshiftSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/ForbiddenNegativeBitshiftSniff.php new file mode 100644 index 00000000..740e7dfd --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/ForbiddenNegativeBitshiftSniff.php @@ -0,0 +1,109 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Operators; + +use PHPCompatibility\Sniff; +use PHPCompatibility\PHPCSHelper; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Bitwise shifts by negative number will throw an ArithmeticError since PHP 7.0. + * + * PHP version 7.0 + * + * @link https://wiki.php.net/rfc/integer_semantics + * @link https://www.php.net/manual/en/migration70.incompatible.php#migration70.incompatible.integers.negative-bitshift + * + * @since 7.0.0 + */ +class ForbiddenNegativeBitshiftSniff extends Sniff +{ + /** + * Potential end tokens for which the end pointer has to be set back by one. + * + * {@internal The PHPCS `findEndOfStatement()` method is not completely consistent + * in how it returns the statement end. This is just a simple way to bypass + * the inconsistency for our purposes.} + * + * @since 8.2.0 + * + * @var array + */ + private $inclusiveStopPoints = array( + \T_COLON => true, + \T_COMMA => true, + \T_DOUBLE_ARROW => true, + \T_SEMICOLON => true, + ); + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.0 + * @since 8.2.0 Now registers all bitshift tokens, not just bitshift right (`T_SR`). + * + * @return array + */ + public function register() + { + return array( + \T_SL, + \T_SL_EQUAL, + \T_SR, + \T_SR_EQUAL, + ); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('7.0') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + // Determine the start and end of the part of the statement we need to examine. + $start = ($stackPtr + 1); + $next = $phpcsFile->findNext(Tokens::$emptyTokens, $start, null, true); + if ($next !== false && $tokens[$next]['code'] === \T_OPEN_PARENTHESIS) { + $start = ($next + 1); + } + + $end = PHPCSHelper::findEndOfStatement($phpcsFile, $start); + if (isset($this->inclusiveStopPoints[$tokens[$end]['code']]) === true) { + --$end; + } + + if ($this->isNegativeNumber($phpcsFile, $start, $end, true) !== true) { + // Not a negative number or undetermined. + return; + } + + $phpcsFile->addError( + 'Bitwise shifts by negative number will throw an ArithmeticError in PHP 7.0. Found: %s', + $stackPtr, + 'Found', + array($phpcsFile->getTokensAsString($start, ($end - $start + 1))) + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/NewOperatorsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/NewOperatorsSniff.php new file mode 100644 index 00000000..7c50ad86 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/NewOperatorsSniff.php @@ -0,0 +1,317 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Operators; + +use PHPCompatibility\AbstractNewFeatureSniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect use of new PHP operators. + * + * PHP version All + * + * @link https://wiki.php.net/rfc/pow-operator + * @link https://wiki.php.net/rfc/combined-comparison-operator + * @link https://wiki.php.net/rfc/isset_ternary + * @link https://wiki.php.net/rfc/null_coalesce_equal_operator + * + * @since 9.0.0 Detection of new operators was originally included in the + * `NewLanguageConstruct` sniff (since 5.6). + */ +class NewOperatorsSniff extends AbstractNewFeatureSniff +{ + + /** + * A list of new operators, not present in older versions. + * + * The array lists : version number with false (not present) or true (present). + * If's sufficient to list the first version where the operator appears. + * + * @since 5.6 + * + * @var array(string => array(string => bool|string)) + */ + protected $newOperators = array( + 'T_POW' => array( + '5.5' => false, + '5.6' => true, + 'description' => 'power operator (**)', + ), // Identified in PHP < 5.6 icw PHPCS < 2.4.0 as T_MULTIPLY + T_MULTIPLY. + 'T_POW_EQUAL' => array( + '5.5' => false, + '5.6' => true, + 'description' => 'power assignment operator (**=)', + ), // Identified in PHP < 5.6 icw PHPCS < 2.6.0 as T_MULTIPLY + T_MUL_EQUAL. + 'T_SPACESHIP' => array( + '5.6' => false, + '7.0' => true, + 'description' => 'spaceship operator (<=>)', + ), // Identified in PHP < 7.0 icw PHPCS < 2.5.1 as T_IS_SMALLER_OR_EQUAL + T_GREATER_THAN. + 'T_COALESCE' => array( + '5.6' => false, + '7.0' => true, + 'description' => 'null coalescing operator (??)', + ), // Identified in PHP < 7.0 icw PHPCS < 2.6.2 as T_INLINE_THEN + T_INLINE_THEN. + 'T_COALESCE_EQUAL' => array( + '7.3' => false, + '7.4' => true, + 'description' => 'null coalesce equal operator (??=)', + ), // Identified in PHP < 7.0 icw PHPCS < 2.6.2 as T_INLINE_THEN + T_INLINE_THEN + T_EQUAL and between PHPCS 2.6.2 and PHPCS 2.8.1 as T_COALESCE + T_EQUAL. + ); + + + /** + * A list of new operators which are not recognized in older PHPCS versions. + * + * The array lists an alternative token to listen for. + * + * @since 7.0.3 + * + * @var array(string => int) + */ + protected $newOperatorsPHPCSCompat = array( + 'T_POW' => \T_MULTIPLY, + 'T_POW_EQUAL' => \T_MUL_EQUAL, + 'T_SPACESHIP' => \T_GREATER_THAN, + 'T_COALESCE' => \T_INLINE_THEN, + 'T_COALESCE_EQUAL' => \T_EQUAL, + ); + + /** + * Token translation table for older PHPCS versions. + * + * The 'before' index lists the token which would have to be directly before the + * token found for it to be one of the new operators. + * The 'real_token' index indicates which operator was found in that case. + * + * If the token combination has multi-layer complexity, such as is the case + * with T_COALESCE(_EQUAL), a 'callback' index is added instead pointing to a + * separate function which can determine whether this is the targetted token across + * PHP and PHPCS versions. + * + * {@internal 'before' was chosen rather than 'after' as that allowed for a 1-on-1 + * translation list with the current tokens.} + * + * @since 7.0.3 + * + * @var array(string => array(string => string)) + */ + protected $PHPCSCompatTranslate = array( + 'T_MULTIPLY' => array( + 'before' => 'T_MULTIPLY', + 'real_token' => 'T_POW', + ), + 'T_MUL_EQUAL' => array( + 'before' => 'T_MULTIPLY', + 'real_token' => 'T_POW_EQUAL', + ), + 'T_GREATER_THAN' => array( + 'before' => 'T_IS_SMALLER_OR_EQUAL', + 'real_token' => 'T_SPACESHIP', + ), + 'T_INLINE_THEN' => array( + 'callback' => 'isTCoalesce', + 'real_token' => 'T_COALESCE', + ), + 'T_EQUAL' => array( + 'callback' => 'isTCoalesceEqual', + 'real_token' => 'T_COALESCE_EQUAL', + ), + ); + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 5.6 + * + * @return array + */ + public function register() + { + $tokens = array(); + foreach ($this->newOperators as $token => $versions) { + if (\defined($token)) { + $tokens[] = constant($token); + } elseif (isset($this->newOperatorsPHPCSCompat[$token])) { + $tokens[] = $this->newOperatorsPHPCSCompat[$token]; + } + } + return $tokens; + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 5.6 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $tokenType = $tokens[$stackPtr]['type']; + + // Translate older PHPCS token combis for new operators to the actual operator. + if (isset($this->newOperators[$tokenType]) === false) { + if (isset($this->PHPCSCompatTranslate[$tokenType]) + && ((isset($this->PHPCSCompatTranslate[$tokenType]['before'], $tokens[$stackPtr - 1]) === true + && $tokens[$stackPtr - 1]['type'] === $this->PHPCSCompatTranslate[$tokenType]['before']) + || (isset($this->PHPCSCompatTranslate[$tokenType]['callback']) === true + && \call_user_func(array($this, $this->PHPCSCompatTranslate[$tokenType]['callback']), $tokens, $stackPtr) === true)) + ) { + $tokenType = $this->PHPCSCompatTranslate[$tokenType]['real_token']; + } + } elseif ($tokenType === 'T_COALESCE') { + // Make sure that T_COALESCE is not confused with T_COALESCE_EQUAL. + if (isset($tokens[($stackPtr + 1)]) !== false && $tokens[($stackPtr + 1)]['code'] === \T_EQUAL) { + // Ignore as will be dealt with via the T_EQUAL token. + return; + } + } + + // If the translation did not yield one of the tokens we are looking for, bow out. + if (isset($this->newOperators[$tokenType]) === false) { + return; + } + + $itemInfo = array( + 'name' => $tokenType, + ); + $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); + } + + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 7.1.0 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo) + { + return $this->newOperators[$itemInfo['name']]; + } + + + /** + * Get an array of the non-PHP-version array keys used in a sub-array. + * + * @since 7.1.0 + * + * @return array + */ + protected function getNonVersionArrayKeys() + { + return array('description'); + } + + + /** + * Retrieve the relevant detail (version) information for use in an error message. + * + * @since 7.1.0 + * + * @param array $itemArray Version and other information about the item. + * @param array $itemInfo Base information about the item. + * + * @return array + */ + public function getErrorInfo(array $itemArray, array $itemInfo) + { + $errorInfo = parent::getErrorInfo($itemArray, $itemInfo); + $errorInfo['description'] = $itemArray['description']; + + return $errorInfo; + } + + + /** + * Filter the error data before it's passed to PHPCS. + * + * @since 7.1.0 + * + * @param array $data The error data array which was created. + * @param array $itemInfo Base information about the item this error message applies to. + * @param array $errorInfo Detail information about an item this error message applies to. + * + * @return array + */ + protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) + { + $data[0] = $errorInfo['description']; + return $data; + } + + + /** + * Callback function to determine whether a T_EQUAL token is really a T_COALESCE_EQUAL token. + * + * @since 7.1.2 + * + * @param array $tokens The token stack. + * @param int $stackPtr The current position in the token stack. + * + * @return bool + */ + private function isTCoalesceEqual($tokens, $stackPtr) + { + if ($tokens[$stackPtr]['code'] !== \T_EQUAL || isset($tokens[($stackPtr - 1)]) === false) { + // Function called for wrong token or token has no predecessor. + return false; + } + + if ($tokens[($stackPtr - 1)]['type'] === 'T_COALESCE') { + return true; + } + if ($tokens[($stackPtr - 1)]['type'] === 'T_INLINE_THEN' + && (isset($tokens[($stackPtr - 2)]) && $tokens[($stackPtr - 2)]['type'] === 'T_INLINE_THEN') + ) { + return true; + } + + return false; + } + + /** + * Callback function to determine whether a T_INLINE_THEN token is really a T_COALESCE token. + * + * @since 7.1.2 + * + * @param array $tokens The token stack. + * @param int $stackPtr The current position in the token stack. + * + * @return bool + */ + private function isTCoalesce($tokens, $stackPtr) + { + if ($tokens[$stackPtr]['code'] !== \T_INLINE_THEN || isset($tokens[($stackPtr - 1)]) === false) { + // Function called for wrong token or token has no predecessor. + return false; + } + + if ($tokens[($stackPtr - 1)]['code'] === \T_INLINE_THEN) { + // Make sure not to confuse it with the T_COALESCE_EQUAL token. + if (isset($tokens[($stackPtr + 1)]) === false || $tokens[($stackPtr + 1)]['code'] !== \T_EQUAL) { + return true; + } + } + + return false; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/NewShortTernarySniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/NewShortTernarySniff.php new file mode 100644 index 00000000..b65da597 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/NewShortTernarySniff.php @@ -0,0 +1,73 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Operators; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect usage of the short ternary (elvis) operator as introduced in PHP 5.3. + * + * Performs checks on ternary operators, specifically that the middle expression + * is not omitted for versions that don't support this. + * + * PHP version 5.3 + * + * @link https://www.php.net/manual/en/migration53.new-features.php + * @link https://www.php.net/manual/en/language.operators.comparison.php#language.operators.comparison.ternary + * + * @since 7.0.0 + * @since 7.0.8 This sniff now throws an error instead of a warning. + * @since 9.0.0 Renamed from `TernaryOperatorsSniff` to `NewShortTernarySniff`. + */ +class NewShortTernarySniff extends Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.0 + * + * @return array + */ + public function register() + { + return array(\T_INLINE_THEN); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('5.2') === false) { + return; + } + + if ($this->isShortTernary($phpcsFile, $stackPtr) === false) { + return; + } + + $phpcsFile->addError( + 'Middle may not be omitted from ternary operators in PHP < 5.3', + $stackPtr, + 'MiddleMissing' + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/RemovedTernaryAssociativitySniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/RemovedTernaryAssociativitySniff.php new file mode 100644 index 00000000..21eca02b --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/RemovedTernaryAssociativitySniff.php @@ -0,0 +1,157 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Operators; + +use PHPCompatibility\Sniff; +use PHPCompatibility\PHPCSHelper; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * The left-associativity of the ternary operator is deprecated in PHP 7.4 and + * removed in PHP 8.0. + * + * PHP version 7.4 + * PHP version 8.0 + * + * @link https://www.php.net/manual/en/migration74.deprecated.php#migration74.deprecated.core.nested-ternary + * @link https://wiki.php.net/rfc/ternary_associativity + * @link https://github.com/php/php-src/pull/4017 + * + * @since 9.2.0 + */ +class RemovedTernaryAssociativitySniff extends Sniff +{ + + /** + * List of tokens with a lower operator precedence than ternary. + * + * @since 9.2.0 + * + * @var array + */ + private $tokensWithLowerPrecedence = array( + 'T_YIELD_FROM' => true, + 'T_YIELD' => true, + 'T_LOGICAL_AND' => true, + 'T_LOGICAL_OR' => true, + 'T_LOGICAL_XOR' => true, + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 9.2.0 + * + * @return array + */ + public function register() + { + return array(\T_INLINE_THEN); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 9.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('7.4') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $endOfStatement = PHPCSHelper::findEndOfStatement($phpcsFile, $stackPtr); + if ($tokens[$endOfStatement]['code'] !== \T_SEMICOLON + && $tokens[$endOfStatement]['code'] !== \T_COLON + && $tokens[$endOfStatement]['code'] !== \T_COMMA + && $tokens[$endOfStatement]['code'] !== \T_DOUBLE_ARROW + && $tokens[$endOfStatement]['code'] !== \T_OPEN_TAG + && $tokens[$endOfStatement]['code'] !== \T_CLOSE_TAG + ) { + // End of statement is last non-empty before close brace, so make sure we examine that token too. + ++$endOfStatement; + } + + $ternaryCount = 0; + $elseCount = 0; + $shortTernaryCount = 0; + + // Start at $stackPtr so we don't need duplicate code for short ternary determination. + for ($i = $stackPtr; $i < $endOfStatement; $i++) { + if (($tokens[$i]['code'] === \T_OPEN_SHORT_ARRAY + || $tokens[$i]['code'] === \T_OPEN_SQUARE_BRACKET + || $tokens[$i]['code'] === \T_OPEN_CURLY_BRACKET) + && isset($tokens[$i]['bracket_closer']) + ) { + // Skip over short arrays, array access keys and curlies. + $i = $tokens[$i]['bracket_closer']; + continue; + } + + if ($tokens[$i]['code'] === \T_OPEN_PARENTHESIS + && isset($tokens[$i]['parenthesis_closer']) + ) { + // Skip over anything between parentheses. + $i = $tokens[$i]['parenthesis_closer']; + continue; + } + + // Check for operators with lower operator precedence. + if (isset(Tokens::$assignmentTokens[$tokens[$i]['code']]) + || isset($this->tokensWithLowerPrecedence[$tokens[$i]['code']]) + ) { + break; + } + + if ($tokens[$i]['code'] === \T_INLINE_THEN) { + ++$ternaryCount; + + if ($this->isShortTernary($phpcsFile, $i) === true) { + ++$shortTernaryCount; + } + + continue; + } + + if ($tokens[$i]['code'] === \T_INLINE_ELSE) { + if (($ternaryCount - $elseCount) >= 2) { + // This is the `else` for a ternary in the middle part of a previous ternary. + --$ternaryCount; + } else { + ++$elseCount; + } + continue; + } + } + + if ($ternaryCount > 1 && $ternaryCount === $elseCount && $ternaryCount > $shortTernaryCount) { + $message = 'The left-associativity of the ternary operator has been deprecated in PHP 7.4'; + $isError = false; + if ($this->supportsAbove('8.0') === true) { + $message .= ' and removed in PHP 8.0'; + $isError = true; + } + + $message .= '. Multiple consecutive ternaries detected. Use parenthesis to clarify the order in which the operations should be executed'; + + $this->addMessage($phpcsFile, $message, $stackPtr, $isError); + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/ForbiddenGetClassNullSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/ForbiddenGetClassNullSniff.php new file mode 100644 index 00000000..30452a09 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/ForbiddenGetClassNullSniff.php @@ -0,0 +1,84 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ParameterValues; + +use PHPCompatibility\AbstractFunctionCallParameterSniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect: Passing `null` to `get_class()` is no longer allowed as of PHP 7.2. + * This will now result in an `E_WARNING` being thrown. + * + * PHP version 7.2 + * + * @link https://wiki.php.net/rfc/get_class_disallow_null_parameter + * @link https://www.php.net/manual/en/function.get-class.php#refsect1-function.get-class-changelog + * + * @since 9.0.0 + */ +class ForbiddenGetClassNullSniff extends AbstractFunctionCallParameterSniff +{ + + /** + * Functions to check for. + * + * @since 9.0.0 + * + * @var array + */ + protected $targetFunctions = array( + 'get_class' => true, + ); + + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * @since 9.0.0 + * + * @return bool + */ + protected function bowOutEarly() + { + return ($this->supportsAbove('7.2') === false); + } + + + /** + * Process the parameters of a matched function. + * + * @since 9.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the stack. + * @param string $functionName The token content (function name) which was matched. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) + { + if (isset($parameters[1]) === false) { + return; + } + + if ($parameters[1]['raw'] !== 'null') { + return; + } + + $phpcsFile->addError( + 'Passing "null" as the $object to get_class() is not allowed since PHP 7.2.', + $parameters[1]['start'], + 'Found' + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/ForbiddenStripTagsSelfClosingXHTMLSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/ForbiddenStripTagsSelfClosingXHTMLSniff.php new file mode 100644 index 00000000..9ecae5c8 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/ForbiddenStripTagsSelfClosingXHTMLSniff.php @@ -0,0 +1,113 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ParameterValues; + +use PHPCompatibility\AbstractFunctionCallParameterSniff; +use PHP_CodeSniffer_File as File; + +/** + * Since PHP 5.3.4, `strip_tags()` ignores self-closing XHTML tags in allowable_tags + * + * PHP version 5.3.4 + * + * @link https://www.php.net/manual/en/function.strip-tags.php#refsect1-function.strip-tags-changelog + * + * @since 9.3.0 + */ +class ForbiddenStripTagsSelfClosingXHTMLSniff extends AbstractFunctionCallParameterSniff +{ + + /** + * Functions to check for. + * + * @since 9.3.0 + * + * @var array + */ + protected $targetFunctions = array( + 'strip_tags' => true, + ); + + /** + * Text string tokens to examine. + * + * @since 9.3.0 + * + * @var array + */ + private $textStringTokens = array( + \T_CONSTANT_ENCAPSED_STRING => true, + \T_DOUBLE_QUOTED_STRING => true, + \T_INLINE_HTML => true, + \T_HEREDOC => true, + \T_NOWDOC => true, + ); + + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * @since 9.3.0 + * + * @return bool + */ + protected function bowOutEarly() + { + return ($this->supportsAbove('5.4') === false); + } + + + /** + * Process the parameters of a matched function. + * + * @since 9.3.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the stack. + * @param string $functionName The token content (function name) which was matched. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) + { + if (isset($parameters[2]) === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $targetParam = $parameters[2]; + for ($i = $targetParam['start']; $i <= $targetParam['end']; $i++) { + if ($tokens[$i]['code'] === \T_STRING + || $tokens[$i]['code'] === \T_VARIABLE + ) { + // Variable, constant, function call. Ignore as undetermined. + return; + } + + if (isset($this->textStringTokens[$tokens[$i]['code']]) === true + && strpos($tokens[$i]['content'], '/>') !== false + ) { + + $phpcsFile->addError( + 'Self-closing XHTML tags are ignored. Only non-self-closing tags should be used in the strip_tags() $allowable_tags parameter since PHP 5.3.4. Found: %s', + $i, + 'Found', + array($targetParam['raw']) + ); + + // Only throw one error per function call. + return; + } + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewArrayReduceInitialTypeSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewArrayReduceInitialTypeSniff.php new file mode 100644 index 00000000..8045ac8a --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewArrayReduceInitialTypeSniff.php @@ -0,0 +1,116 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ParameterValues; + +use PHPCompatibility\AbstractFunctionCallParameterSniff; +use PHP_CodeSniffer_File as File; + +/** + * In PHP 5.2 and lower, the `$initial` parameter for `array_reduce()` had to be an integer. + * + * PHP version 5.3 + * + * @link https://www.php.net/manual/en/migration53.other.php#migration53.other + * @link https://www.php.net/manual/en/function.array-reduce.php#refsect1-function.array-reduce-changelog + * + * @since 9.0.0 + */ +class NewArrayReduceInitialTypeSniff extends AbstractFunctionCallParameterSniff +{ + + /** + * Functions to check for. + * + * @since 9.0.0 + * + * @var array + */ + protected $targetFunctions = array( + 'array_reduce' => true, + ); + + /** + * Tokens which, for the purposes of this sniff, indicate that there is + * a variable element to the value passed. + * + * @since 9.0.0 + * + * @var array + */ + private $variableValueTokens = array( + \T_VARIABLE, + \T_STRING, + \T_SELF, + \T_PARENT, + \T_STATIC, + \T_DOUBLE_QUOTED_STRING, + ); + + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * @since 9.0.0 + * + * @return bool + */ + protected function bowOutEarly() + { + return ($this->supportsBelow('5.2') === false); + } + + + /** + * Process the parameters of a matched function. + * + * @since 9.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the stack. + * @param string $functionName The token content (function name) which was matched. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) + { + if (isset($parameters[3]) === false) { + return; + } + + $targetParam = $parameters[3]; + if ($this->isNumber($phpcsFile, $targetParam['start'], $targetParam['end'], true) !== false) { + return; + } + + if ($this->isNumericCalculation($phpcsFile, $targetParam['start'], $targetParam['end']) === true) { + return; + } + + $error = 'Passing a non-integer as the value for $initial to array_reduce() is not supported in PHP 5.2 or lower.'; + if ($phpcsFile->findNext($this->variableValueTokens, $targetParam['start'], ($targetParam['end'] + 1)) === false) { + $phpcsFile->addError( + $error . ' Found %s', + $targetParam['start'], + 'InvalidTypeFound', + array($targetParam['raw']) + ); + } else { + $phpcsFile->addWarning( + $error . ' Variable value found. Found %s', + $targetParam['start'], + 'VariableFound', + array($targetParam['raw']) + ); + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewFopenModesSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewFopenModesSniff.php new file mode 100644 index 00000000..83299822 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewFopenModesSniff.php @@ -0,0 +1,119 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ParameterValues; + +use PHPCompatibility\AbstractFunctionCallParameterSniff; +use PHP_CodeSniffer_File as File; + +/** + * Check for valid values for the `fopen()` `$mode` parameter. + * + * PHP version 5.2+ + * + * @link https://www.php.net/manual/en/function.fopen.php#refsect1-function.fopen-changelog + * + * @since 9.0.0 + */ +class NewFopenModesSniff extends AbstractFunctionCallParameterSniff +{ + + /** + * Functions to check for. + * + * @since 9.0.0 + * + * @var array + */ + protected $targetFunctions = array( + 'fopen' => true, + ); + + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * @since 9.0.0 + * + * @return bool + */ + protected function bowOutEarly() + { + // Version used here should be (above) the highest version from the `newModes` control, + // structure below, i.e. the last PHP version in which a new mode was introduced. + return ($this->supportsBelow('7.1') === false); + } + + + /** + * Process the parameters of a matched function. + * + * @since 9.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the stack. + * @param string $functionName The token content (function name) which was matched. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) + { + if (isset($parameters[2]) === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $targetParam = $parameters[2]; + $errors = array(); + + for ($i = $targetParam['start']; $i <= $targetParam['end']; $i++) { + if ($tokens[$i]['code'] !== \T_CONSTANT_ENCAPSED_STRING) { + continue; + } + + if (strpos($tokens[$i]['content'], 'c+') !== false && $this->supportsBelow('5.2.5')) { + $errors['cplusFound'] = array( + 'c+', + '5.2.5', + $targetParam['raw'], + ); + } elseif (strpos($tokens[$i]['content'], 'c') !== false && $this->supportsBelow('5.2.5')) { + $errors['cFound'] = array( + 'c', + '5.2.5', + $targetParam['raw'], + ); + } + + if (strpos($tokens[$i]['content'], 'e') !== false && $this->supportsBelow('7.0.15')) { + $errors['eFound'] = array( + 'e', + '7.0.15', + $targetParam['raw'], + ); + } + } + + if (empty($errors) === true) { + return; + } + + foreach ($errors as $errorCode => $errorData) { + $phpcsFile->addError( + 'Passing "%s" as the $mode to fopen() is not supported in PHP %s or lower. Found %s', + $targetParam['start'], + $errorCode, + $errorData + ); + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewHTMLEntitiesEncodingDefaultSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewHTMLEntitiesEncodingDefaultSniff.php new file mode 100644 index 00000000..18895565 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewHTMLEntitiesEncodingDefaultSniff.php @@ -0,0 +1,92 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ParameterValues; + +use PHPCompatibility\AbstractFunctionCallParameterSniff; +use PHP_CodeSniffer_File as File; + +/** + * As of PHP 5.4, the default character set for `htmlspecialchars()`, `htmlentities()` + * and `html_entity_decode()` is now `UTF-8`, instead of `ISO-8859-1`. + * + * PHP version 5.4 + * + * @link https://www.php.net/manual/en/migration54.other.php + * @link https://www.php.net/manual/en/function.html-entity-decode.php#refsect1-function.html-entity-decode-changelog + * @link https://www.php.net/manual/en/function.htmlentities.php#refsect1-function.htmlentities-changelog + * @link https://www.php.net/manual/en/function.htmlspecialchars.php#refsect1-function.htmlspecialchars-changelog + * + * @since 9.3.0 + */ +class NewHTMLEntitiesEncodingDefaultSniff extends AbstractFunctionCallParameterSniff +{ + + /** + * Functions to check for. + * + * Key is the function name, value the 1-based parameter position of + * the $encoding parameter. + * + * @since 9.3.0 + * + * @var array + */ + protected $targetFunctions = array( + 'html_entity_decode' => 3, + 'htmlentities' => 3, + 'htmlspecialchars' => 3, + ); + + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * Note: This sniff should only trigger errors when both PHP 5.3 or lower, + * as well as PHP 5.4 or higher need to be supported within the application. + * + * @since 9.3.0 + * + * @return bool + */ + protected function bowOutEarly() + { + return ($this->supportsBelow('5.3') === false || $this->supportsAbove('5.4') === false); + } + + + /** + * Process the parameters of a matched function. + * + * @since 9.3.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the stack. + * @param string $functionName The token content (function name) which was matched. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) + { + $functionLC = strtolower($functionName); + if (isset($parameters[$this->targetFunctions[$functionLC]]) === true) { + return; + } + + $phpcsFile->addError( + 'The default value of the $encoding parameter for %s() was changed from ISO-8859-1 to UTF-8 in PHP 5.4. For cross-version compatibility, the $encoding parameter should be explicitly set.', + $stackPtr, + 'NotSet', + array($functionName) + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewHashAlgorithmsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewHashAlgorithmsSniff.php new file mode 100644 index 00000000..297f84ec --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewHashAlgorithmsSniff.php @@ -0,0 +1,185 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ParameterValues; + +use PHPCompatibility\AbstractNewFeatureSniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect the use of newly introduced hash algorithms. + * + * PHP version 5.2+ + * + * @link https://www.php.net/manual/en/function.hash-algos.php#refsect1-function.hash-algos-changelog + * + * @since 7.0.7 + * @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class.. + */ +class NewHashAlgorithmsSniff extends AbstractNewFeatureSniff +{ + /** + * A list of new hash algorithms, not present in older versions. + * + * The array lists : version number with false (not present) or true (present). + * If's sufficient to list the first version where the hash algorithm appears. + * + * @since 7.0.7 + * + * @var array(string => array(string => bool)) + */ + protected $newAlgorithms = array( + 'md2' => array( + '5.2' => false, + '5.3' => true, + ), + 'ripemd256' => array( + '5.2' => false, + '5.3' => true, + ), + 'ripemd320' => array( + '5.2' => false, + '5.3' => true, + ), + 'salsa10' => array( + '5.2' => false, + '5.3' => true, + ), + 'salsa20' => array( + '5.2' => false, + '5.3' => true, + ), + 'snefru256' => array( + '5.2' => false, + '5.3' => true, + ), + 'sha224' => array( + '5.2' => false, + '5.3' => true, + ), + 'joaat' => array( + '5.3' => false, + '5.4' => true, + ), + 'fnv132' => array( + '5.3' => false, + '5.4' => true, + ), + 'fnv164' => array( + '5.3' => false, + '5.4' => true, + ), + 'gost-crypto' => array( + '5.5' => false, + '5.6' => true, + ), + + 'sha512/224' => array( + '7.0' => false, + '7.1' => true, + ), + 'sha512/256' => array( + '7.0' => false, + '7.1' => true, + ), + 'sha3-224' => array( + '7.0' => false, + '7.1' => true, + ), + 'sha3-256' => array( + '7.0' => false, + '7.1' => true, + ), + 'sha3-384' => array( + '7.0' => false, + '7.1' => true, + ), + 'sha3-512' => array( + '7.0' => false, + '7.1' => true, + ), + 'crc32c' => array( + '7.3' => false, + '7.4' => true, + ), + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.7 + * + * @return array + */ + public function register() + { + return array(\T_STRING); + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.7 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $algo = $this->getHashAlgorithmParameter($phpcsFile, $stackPtr); + if (empty($algo) || \is_string($algo) === false) { + return; + } + + // Bow out if not one of the algorithms we're targetting. + if (isset($this->newAlgorithms[$algo]) === false) { + return; + } + + // Check if the algorithm used is new. + $itemInfo = array( + 'name' => $algo, + ); + $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); + } + + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 7.1.0 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo) + { + return $this->newAlgorithms[$itemInfo['name']]; + } + + + /** + * Get the error message template for this sniff. + * + * @since 7.1.0 + * + * @return string + */ + protected function getErrorMsgTemplate() + { + return 'The %s hash algorithm is not present in PHP version %s or earlier'; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewIDNVariantDefaultSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewIDNVariantDefaultSniff.php new file mode 100644 index 00000000..2c9748ca --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewIDNVariantDefaultSniff.php @@ -0,0 +1,91 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ParameterValues; + +use PHPCompatibility\AbstractFunctionCallParameterSniff; +use PHP_CodeSniffer_File as File; + +/** + * The default value for the `$variant` parameter has changed from `INTL_IDNA_VARIANT_2003` + * to `INTL_IDNA_VARIANT_UTS46` in PHP 7.4. + * + * PHP version 7.4 + * + * @link https://www.php.net/manual/en/migration74.incompatible.php#migration74.incompatible.intl + * @link https://wiki.php.net/rfc/deprecate-and-remove-intl_idna_variant_2003 + * @link https://www.php.net/manual/en/function.idn-to-ascii.php + * @link https://www.php.net/manual/en/function.idn-to-utf8.php + * + * @since 9.3.0 + */ +class NewIDNVariantDefaultSniff extends AbstractFunctionCallParameterSniff +{ + + /** + * Functions to check for. + * + * Key is the function name, value the 1-based parameter position of + * the $variant parameter. + * + * @since 9.3.0 + * + * @var array + */ + protected $targetFunctions = array( + 'idn_to_ascii' => 3, + 'idn_to_utf8' => 3, + ); + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * Note: This sniff should only trigger errors when both PHP 7.3 or lower, + * as well as PHP 7.4 or higher need to be supported within the application. + * + * @since 9.3.0 + * + * @return bool + */ + protected function bowOutEarly() + { + return ($this->supportsBelow('7.3') === false || $this->supportsAbove('7.4') === false); + } + + + /** + * Process the parameters of a matched function. + * + * @since 9.3.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the stack. + * @param string $functionName The token content (function name) which was matched. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) + { + $functionLC = strtolower($functionName); + if (isset($parameters[$this->targetFunctions[$functionLC]]) === true) { + return; + } + + $error = 'The default value of the %s() $variant parameter has changed from INTL_IDNA_VARIANT_2003 to INTL_IDNA_VARIANT_UTS46 in PHP 7.4. For optimal cross-version compatibility, the $variant parameter should be explicitly set.'; + $phpcsFile->addError( + $error, + $stackPtr, + 'NotSet', + array($functionName) + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewIconvMbstringCharsetDefaultSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewIconvMbstringCharsetDefaultSniff.php new file mode 100644 index 00000000..51cc894e --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewIconvMbstringCharsetDefaultSniff.php @@ -0,0 +1,231 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ParameterValues; + +use PHPCompatibility\AbstractFunctionCallParameterSniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect calls to Iconv and Mbstring functions with the optional `$charset`/`$encoding` parameter not set. + * + * The default value for the iconv `$charset` and the MbString $encoding` parameters was changed + * in PHP 5.6 to the value of `default_charset`, which defaults to `UTF-8`. + * + * Previously, the iconv functions would default to the value of `iconv.internal_encoding`; + * The Mbstring functions would default to the return value of `mb_internal_encoding()`. + * In both case, this would normally come down to `ISO-8859-1`. + * + * PHP version 5.6 + * + * @link https://www.php.net/manual/en/migration56.new-features.php#migration56.new-features.default-encoding + * @link https://www.php.net/manual/en/migration56.deprecated.php#migration56.deprecated.iconv-mbstring-encoding + * @link https://wiki.php.net/rfc/default_encoding + * + * @since 9.3.0 + */ +class NewIconvMbstringCharsetDefaultSniff extends AbstractFunctionCallParameterSniff +{ + + /** + * Functions to check for. + * + * Only those functions where the charset/encoding parameter is optional need to be listed. + * + * Key is the function name, value the 1-based parameter position of + * the $charset/$encoding parameter. + * + * @since 9.3.0 + * + * @var array + */ + protected $targetFunctions = array( + 'iconv_mime_decode_headers' => 3, + 'iconv_mime_decode' => 3, + 'iconv_mime_encode' => 3, // Special case. + 'iconv_strlen' => 2, + 'iconv_strpos' => 4, + 'iconv_strrpos' => 3, + 'iconv_substr' => 4, + + 'mb_check_encoding' => 2, + 'mb_chr' => 2, + 'mb_convert_case' => 3, + 'mb_convert_encoding' => 3, + 'mb_convert_kana' => 3, + 'mb_decode_numericentity' => 3, + 'mb_encode_numericentity' => 3, + 'mb_ord' => 2, + 'mb_scrub' => 2, + 'mb_strcut' => 4, + 'mb_stripos' => 4, + 'mb_stristr' => 4, + 'mb_strlen' => 2, + 'mb_strpos' => 4, + 'mb_strrchr' => 4, + 'mb_strrichr' => 4, + 'mb_strripos' => 4, + 'mb_strrpos' => 4, + 'mb_strstr' => 4, + 'mb_strtolower' => 2, + 'mb_strtoupper' => 2, + 'mb_strwidth' => 2, + 'mb_substr_count' => 3, + 'mb_substr' => 4, + ); + + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * Note: This sniff should only trigger errors when both PHP 5.5 or lower, + * as well as PHP 5.6 or higher need to be supported within the application. + * + * @since 9.3.0 + * + * @return bool + */ + protected function bowOutEarly() + { + return ($this->supportsBelow('5.5') === false || $this->supportsAbove('5.6') === false); + } + + + /** + * Process the parameters of a matched function. + * + * @since 9.3.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the stack. + * @param string $functionName The token content (function name) which was matched. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) + { + $functionLC = strtolower($functionName); + if ($functionLC === 'iconv_mime_encode') { + // Special case the iconv_mime_encode() function. + return $this->processIconvMimeEncode($phpcsFile, $stackPtr, $functionName, $parameters); + } + + if (isset($parameters[$this->targetFunctions[$functionLC]]) === true) { + return; + } + + $paramName = '$encoding'; + if (strpos($functionLC, 'iconv_') === 0) { + $paramName = '$charset'; + } elseif ($functionLC === 'mb_convert_encoding') { + $paramName = '$from_encoding'; + } + + $error = 'The default value of the %1$s parameter for %2$s() was changed from ISO-8859-1 to UTF-8 in PHP 5.6. For cross-version compatibility, the %1$s parameter should be explicitly set.'; + $data = array( + $paramName, + $functionName, + ); + + $phpcsFile->addError($error, $stackPtr, 'NotSet', $data); + } + + /** + * Process the parameters of a matched call to the iconv_mime_encode() function. + * + * @since 9.3.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the stack. + * @param string $functionName The token content (function name) which was matched. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function processIconvMimeEncode(File $phpcsFile, $stackPtr, $functionName, $parameters) + { + $error = 'The default value of the %s parameter index for iconv_mime_encode() was changed from ISO-8859-1 to UTF-8 in PHP 5.6. For cross-version compatibility, the %s should be explicitly set.'; + + $functionLC = strtolower($functionName); + if (isset($parameters[$this->targetFunctions[$functionLC]]) === false) { + $phpcsFile->addError( + $error, + $stackPtr, + 'PreferencesNotSet', + array( + '$preferences[\'input/output-charset\']', + '$preferences[\'input-charset\'] and $preferences[\'output-charset\'] indexes', + ) + ); + + return; + } + + $tokens = $phpcsFile->getTokens(); + $targetParam = $parameters[$this->targetFunctions[$functionLC]]; + $firstNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $targetParam['start'], ($targetParam['end'] + 1), true); + if ($firstNonEmpty === false) { + // Parse error or live coding. + return; + } + + if ($tokens[$firstNonEmpty]['code'] === \T_ARRAY + || $tokens[$firstNonEmpty]['code'] === \T_OPEN_SHORT_ARRAY + ) { + $hasInputCharset = preg_match('`([\'"])input-charset\1\s*=>`', $targetParam['raw']); + $hasOutputCharset = preg_match('`([\'"])output-charset\1\s*=>`', $targetParam['raw']); + if ($hasInputCharset === 1 && $hasOutputCharset === 1) { + // Both input as well as output charset are set. + return; + } + + if ($hasInputCharset !== 1) { + $phpcsFile->addError( + $error, + $firstNonEmpty, + 'InputPreferenceNotSet', + array( + '$preferences[\'input-charset\']', + '$preferences[\'input-charset\'] index', + ) + ); + } + + if ($hasOutputCharset !== 1) { + $phpcsFile->addError( + $error, + $firstNonEmpty, + 'OutputPreferenceNotSet', + array( + '$preferences[\'output-charset\']', + '$preferences[\'output-charset\'] index', + ) + ); + } + + return; + } + + // The $preferences parameter was passed, but it was a variable/constant/output of a function call. + $phpcsFile->addWarning( + $error, + $firstNonEmpty, + 'Undetermined', + array( + '$preferences[\'input/output-charset\']', + '$preferences[\'input-charset\'] and $preferences[\'output-charset\'] indexes', + ) + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewNegativeStringOffsetSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewNegativeStringOffsetSniff.php new file mode 100644 index 00000000..f2aea60e --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewNegativeStringOffsetSniff.php @@ -0,0 +1,129 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ParameterValues; + +use PHPCompatibility\AbstractFunctionCallParameterSniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect negative string offsets as parameters passed to functions where this + * was not allowed prior to PHP 7.1. + * + * PHP version 7.1 + * + * @link https://wiki.php.net/rfc/negative-string-offsets + * + * @since 9.0.0 + */ +class NewNegativeStringOffsetSniff extends AbstractFunctionCallParameterSniff +{ + + /** + * Functions to check for. + * + * @since 9.0.0 + * + * @var array Function name => 1-based parameter offset of the affected parameters => parameter name. + */ + protected $targetFunctions = array( + 'file_get_contents' => array( + 4 => 'offset', + ), + 'grapheme_extract' => array( + 4 => 'start', + ), + 'grapheme_stripos' => array( + 3 => 'offset', + ), + 'grapheme_strpos' => array( + 3 => 'offset', + ), + 'iconv_strpos' => array( + 3 => 'offset', + ), + 'mb_ereg_search_setpos' => array( + 1 => 'position', + ), + 'mb_strimwidth' => array( + 2 => 'start', + 3 => 'width', + ), + 'mb_stripos' => array( + 3 => 'offset', + ), + 'mb_strpos' => array( + 3 => 'offset', + ), + 'stripos' => array( + 3 => 'offset', + ), + 'strpos' => array( + 3 => 'offset', + ), + 'substr_count' => array( + 3 => 'offset', + 4 => 'length', + ), + ); + + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * @since 9.0.0 + * + * @return bool + */ + protected function bowOutEarly() + { + return ($this->supportsBelow('7.0') === false); + } + + /** + * Process the parameters of a matched function. + * + * @since 9.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the stack. + * @param string $functionName The token content (function name) which was matched. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) + { + $functionLC = strtolower($functionName); + foreach ($this->targetFunctions[$functionLC] as $pos => $name) { + if (isset($parameters[$pos]) === false) { + continue; + } + + $targetParam = $parameters[$pos]; + + if ($this->isNegativeNumber($phpcsFile, $targetParam['start'], $targetParam['end']) === false) { + continue; + } + + $phpcsFile->addError( + 'Negative string offsets were not supported for the $%s parameter in %s() in PHP 7.0 or lower. Found %s', + $targetParam['start'], + 'Found', + array( + $name, + $functionName, + $targetParam['raw'], + ) + ); + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewPCREModifiersSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewPCREModifiersSniff.php new file mode 100644 index 00000000..65339e50 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewPCREModifiersSniff.php @@ -0,0 +1,127 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ParameterValues; + +use PHPCompatibility\Sniffs\ParameterValues\RemovedPCREModifiersSniff; +use PHP_CodeSniffer_File as File; + +/** + * Check for the use of newly added regex modifiers for PCRE functions. + * + * Initially just checks for the PHP 7.2 new `J` modifier. + * + * PHP version 7.2+ + * + * @link https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php + * @link https://www.php.net/manual/en/migration72.new-features.php#migration72.new-features.pcre + * + * @since 8.2.0 + * @since 9.0.0 Renamed from `PCRENewModifiersSniff` to `NewPCREModifiersSniff`. + */ +class NewPCREModifiersSniff extends RemovedPCREModifiersSniff +{ + + /** + * Functions to check for. + * + * @since 8.2.0 + * + * @var array + */ + protected $targetFunctions = array( + 'preg_filter' => true, + 'preg_grep' => true, + 'preg_match_all' => true, + 'preg_match' => true, + 'preg_replace_callback_array' => true, + 'preg_replace_callback' => true, + 'preg_replace' => true, + 'preg_split' => true, + ); + + /** + * Array listing newly introduced regex modifiers. + * + * The key should be the modifier (case-sensitive!). + * The value should be the PHP version in which the modifier was introduced. + * + * @since 8.2.0 + * + * @var array + */ + protected $newModifiers = array( + 'J' => array( + '7.1' => false, + '7.2' => true, + ), + ); + + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * @since 8.2.0 + * + * @return bool + */ + protected function bowOutEarly() + { + // Version used here should be the highest version from the `$newModifiers` array, + // i.e. the last PHP version in which a new modifier was introduced. + return ($this->supportsBelow('7.2') === false); + } + + + /** + * Examine the regex modifier string. + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * @param string $functionName The function which contained the pattern. + * @param string $modifiers The regex modifiers found. + * + * @return void + */ + protected function examineModifiers(File $phpcsFile, $stackPtr, $functionName, $modifiers) + { + $error = 'The PCRE regex modifier "%s" is not present in PHP version %s or earlier'; + + foreach ($this->newModifiers as $modifier => $versionArray) { + if (strpos($modifiers, $modifier) === false) { + continue; + } + + $notInVersion = ''; + foreach ($versionArray as $version => $present) { + if ($notInVersion === '' && $present === false + && $this->supportsBelow($version) === true + ) { + $notInVersion = $version; + } + } + + if ($notInVersion === '') { + continue; + } + + $errorCode = $modifier . 'ModifierFound'; + $data = array( + $modifier, + $notInVersion, + ); + + $phpcsFile->addError($error, $stackPtr, $errorCode, $data); + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewPackFormatSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewPackFormatSniff.php new file mode 100644 index 00000000..7e42f3e9 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewPackFormatSniff.php @@ -0,0 +1,132 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ParameterValues; + +use PHPCompatibility\AbstractFunctionCallParameterSniff; +use PHP_CodeSniffer_File as File; + +/** + * Check for valid values for the `$format` passed to `pack()`. + * + * PHP version 5.4+ + * + * @link https://www.php.net/manual/en/function.pack.php#refsect1-function.pack-changelog + * + * @since 9.0.0 + */ +class NewPackFormatSniff extends AbstractFunctionCallParameterSniff +{ + + /** + * Functions to check for. + * + * @since 9.0.0 + * + * @var array + */ + protected $targetFunctions = array( + 'pack' => true, + ); + + /** + * List of new format character codes added to pack(). + * + * @since 9.0.0 + * + * @var array Regex pattern => Version array. + */ + protected $newFormats = array( + '`([Z])`' => array( + '5.4' => false, + '5.5' => true, + ), + '`([qQJP])`' => array( + '5.6.2' => false, + '5.6.3' => true, + ), + '`([eEgG])`' => array( + '7.0.14' => false, + '7.0.15' => true, // And 7.1.1. + ), + ); + + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * @since 9.0.0 + * + * @return bool + */ + protected function bowOutEarly() + { + return ($this->supportsBelow('7.1') === false); + } + + + /** + * Process the parameters of a matched function. + * + * @since 9.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the stack. + * @param string $functionName The token content (function name) which was matched. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) + { + if (isset($parameters[1]) === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $targetParam = $parameters[1]; + + for ($i = $targetParam['start']; $i <= $targetParam['end']; $i++) { + if ($tokens[$i]['code'] !== \T_CONSTANT_ENCAPSED_STRING + && $tokens[$i]['code'] !== \T_DOUBLE_QUOTED_STRING + ) { + continue; + } + + $content = $tokens[$i]['content']; + if ($tokens[$i]['code'] === \T_DOUBLE_QUOTED_STRING) { + $content = $this->stripVariables($content); + } + + foreach ($this->newFormats as $pattern => $versionArray) { + if (preg_match($pattern, $content, $matches) !== 1) { + continue; + } + + foreach ($versionArray as $version => $present) { + if ($present === false && $this->supportsBelow($version) === true) { + $phpcsFile->addError( + 'Passing the $format(s) "%s" to pack() is not supported in PHP %s or lower. Found %s', + $targetParam['start'], + 'NewFormatFound', + array( + $matches[1], + $version, + $targetParam['raw'], + ) + ); + continue 2; + } + } + } + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewPasswordAlgoConstantValuesSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewPasswordAlgoConstantValuesSniff.php new file mode 100644 index 00000000..94a1360d --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewPasswordAlgoConstantValuesSniff.php @@ -0,0 +1,125 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ParameterValues; + +use PHPCompatibility\AbstractFunctionCallParameterSniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * The constant value of the password hash algorithm constants has changed in PHP 7.4. + * + * Applications using the constants `PASSWORD_DEFAULT`, `PASSWORD_BCRYPT`, + * `PASSWORD_ARGON2I`, and `PASSWORD_ARGON2ID` will continue to function correctly. + * Using an integer will still work, but will produce a deprecation warning. + * + * PHP version 7.4 + * + * @link https://www.php.net/manual/en/migration74.incompatible.php#migration74.incompatible.core.password-algorithm-constants + * @link https://wiki.php.net/rfc/password_registry + * + * @since 9.3.0 + */ +class NewPasswordAlgoConstantValuesSniff extends AbstractFunctionCallParameterSniff +{ + + /** + * Functions to check for. + * + * Key is the function name, value the 1-based parameter position of + * the $algo parameter. + * + * @since 9.3.0 + * + * @var array + */ + protected $targetFunctions = array( + 'password_hash' => 2, + 'password_needs_rehash' => 2, + ); + + /** + * Tokens types which indicate that the parameter passed is not the PHP native constant. + * + * @since 9.3.0 + * + * @var array + */ + private $invalidTokenTypes = array( + \T_NULL => true, + \T_TRUE => true, + \T_FALSE => true, + \T_LNUMBER => true, + \T_DNUMBER => true, + \T_CONSTANT_ENCAPSED_STRING => true, + \T_DOUBLE_QUOTED_STRING => true, + \T_HEREDOC => true, + \T_NOWDOC => true, + ); + + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * @since 9.3.0 + * + * @return bool + */ + protected function bowOutEarly() + { + return ($this->supportsAbove('7.4') === false); + } + + + /** + * Process the parameters of a matched function. + * + * @since 9.3.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the stack. + * @param string $functionName The token content (function name) which was matched. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) + { + $functionLC = strtolower($functionName); + if (isset($parameters[$this->targetFunctions[$functionLC]]) === false) { + return; + } + + $targetParam = $parameters[$this->targetFunctions[$functionLC]]; + $tokens = $phpcsFile->getTokens(); + + for ($i = $targetParam['start']; $i <= $targetParam['end']; $i++) { + if (isset(Tokens::$emptyTokens[$tokens[$i]['code']]) === true) { + continue; + } + + if (isset($this->invalidTokenTypes[$tokens[$i]['code']]) === true) { + $phpcsFile->addWarning( + 'The value of the password hash algorithm constants has changed in PHP 7.4. Pass a PHP native constant to the %s() function instead of using the value of the constant. Found: %s', + $stackPtr, + 'NotAlgoConstant', + array( + $functionName, + $targetParam['raw'], + ) + ); + + break; + } + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewProcOpenCmdArraySniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewProcOpenCmdArraySniff.php new file mode 100644 index 00000000..4e9f1500 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewProcOpenCmdArraySniff.php @@ -0,0 +1,136 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ParameterValues; + +use PHPCompatibility\AbstractFunctionCallParameterSniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * As of PHP 7.4, `proc_open()` now also accepts an array instead of a string for the command. + * + * In that case, the process will be opened directly (without going through a shell) and + * PHP will take care of any necessary argument escaping. + * + * PHP version 7.4 + * + * @link https://www.php.net/manual/en/migration74.new-features.php#migration74.new-features.standard.proc-open + * @link https://www.php.net/manual/en/function.proc-open.php + * + * @since 9.3.0 + */ +class NewProcOpenCmdArraySniff extends AbstractFunctionCallParameterSniff +{ + + /** + * Functions to check for. + * + * @since 9.3.0 + * + * @var array + */ + protected $targetFunctions = array( + 'proc_open' => true, + ); + + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * @since 9.3.0 + * + * @return bool + */ + protected function bowOutEarly() + { + return false; + } + + + /** + * Process the parameters of a matched function. + * + * @since 9.3.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the stack. + * @param string $functionName The token content (function name) which was matched. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) + { + if (isset($parameters[1]) === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $targetParam = $parameters[1]; + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $targetParam['start'], $targetParam['end'], true); + + if ($nextNonEmpty === false) { + // Shouldn't be possible. + return; + } + + if ($tokens[$nextNonEmpty]['code'] !== \T_ARRAY + && $tokens[$nextNonEmpty]['code'] !== \T_OPEN_SHORT_ARRAY + ) { + // Not passed as an array. + return; + } + + if ($this->supportsBelow('7.3') === true) { + $phpcsFile->addError( + 'The proc_open() function did not accept $cmd to be passed in array format in PHP 7.3 and earlier.', + $nextNonEmpty, + 'Found' + ); + } + + if ($this->supportsAbove('7.4') === true) { + if (strpos($targetParam['raw'], 'escapeshellarg(') === false) { + // Efficiency: prevent needlessly walking the array. + return; + } + + $items = $this->getFunctionCallParameters($phpcsFile, $nextNonEmpty); + + if (empty($items)) { + return; + } + + foreach ($items as $item) { + for ($i = $item['start']; $i <= $item['end']; $i++) { + if ($tokens[$i]['code'] !== \T_STRING + || $tokens[$i]['content'] !== 'escapeshellarg' + ) { + continue; + } + + // @todo Potential future enhancement: check if it's a call to the PHP native function. + + $phpcsFile->addWarning( + 'When passing proc_open() the $cmd parameter as an array, PHP will take care of any necessary argument escaping. Found: %s', + $i, + 'Invalid', + array($item['raw']) + ); + + // Only throw one error per array item. + break; + } + } + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewStripTagsAllowableTagsArraySniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewStripTagsAllowableTagsArraySniff.php new file mode 100644 index 00000000..9d9ede05 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewStripTagsAllowableTagsArraySniff.php @@ -0,0 +1,152 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ParameterValues; + +use PHPCompatibility\AbstractFunctionCallParameterSniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * As of PHP 7.4, `strip_tags()` now also accepts an array of `$allowable_tags`. + * + * PHP version 7.4 + * + * @link https://www.php.net/manual/en/migration74.new-features.php#migration74.new-features.standard.strip-tags + * @link https://www.php.net/manual/en/function.strip-tags.php + * + * @since 9.3.0 + */ +class NewStripTagsAllowableTagsArraySniff extends AbstractFunctionCallParameterSniff +{ + + /** + * Functions to check for. + * + * @since 9.3.0 + * + * @var array + */ + protected $targetFunctions = array( + 'strip_tags' => true, + ); + + /** + * Text string tokens to examine. + * + * @since 9.3.0 + * + * @var array + */ + private $textStringTokens = array( + \T_CONSTANT_ENCAPSED_STRING => true, + \T_DOUBLE_QUOTED_STRING => true, + \T_INLINE_HTML => true, + \T_HEREDOC => true, + \T_NOWDOC => true, + ); + + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * @since 9.3.0 + * + * @return bool + */ + protected function bowOutEarly() + { + return false; + } + + + /** + * Process the parameters of a matched function. + * + * @since 9.3.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the stack. + * @param string $functionName The token content (function name) which was matched. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) + { + if (isset($parameters[2]) === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $targetParam = $parameters[2]; + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $targetParam['start'], $targetParam['end'], true); + + if ($nextNonEmpty === false) { + // Shouldn't be possible. + return; + } + + if ($tokens[$nextNonEmpty]['code'] !== \T_ARRAY + && $tokens[$nextNonEmpty]['code'] !== \T_OPEN_SHORT_ARRAY + ) { + // Not passed as a hard-coded array. + return; + } + + if ($this->supportsBelow('7.3') === true) { + $phpcsFile->addError( + 'The strip_tags() function did not accept $allowable_tags to be passed in array format in PHP 7.3 and earlier.', + $nextNonEmpty, + 'Found' + ); + } + + if ($this->supportsAbove('7.4') === true) { + if (strpos($targetParam['raw'], '>') === false) { + // Efficiency: prevent needlessly walking the array. + return; + } + + $items = $this->getFunctionCallParameters($phpcsFile, $nextNonEmpty); + + if (empty($items)) { + return; + } + + foreach ($items as $item) { + for ($i = $item['start']; $i <= $item['end']; $i++) { + if ($tokens[$i]['code'] === \T_STRING + || $tokens[$i]['code'] === \T_VARIABLE + ) { + // Variable, constant, function call. Ignore complete item as undetermined. + break; + } + + if (isset($this->textStringTokens[$tokens[$i]['code']]) === true + && strpos($tokens[$i]['content'], '>') !== false + ) { + + $phpcsFile->addWarning( + 'When passing strip_tags() the $allowable_tags parameter as an array, the tags should not be enclosed in <> brackets. Found: %s', + $i, + 'Invalid', + array($item['raw']) + ); + + // Only throw one error per array item. + break; + } + } + } + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedHashAlgorithmsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedHashAlgorithmsSniff.php new file mode 100644 index 00000000..83d4b8b3 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedHashAlgorithmsSniff.php @@ -0,0 +1,117 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ParameterValues; + +use PHPCompatibility\AbstractRemovedFeatureSniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect the use of deprecated and removed hash algorithms. + * + * PHP version 5.4 + * + * @link https://www.php.net/manual/en/function.hash-algos.php#refsect1-function.hash-algos-changelog + * + * @since 5.5 + * @since 7.1.0 Now extends the `AbstractRemovedFeatureSniff` instead of the base `Sniff` class. + */ +class RemovedHashAlgorithmsSniff extends AbstractRemovedFeatureSniff +{ + + /** + * A list of removed hash algorithms, which were present in older versions. + * + * The array lists : version number with false (deprecated) and true (removed). + * If's sufficient to list the first version where the hash algorithm was deprecated/removed. + * + * @since 7.0.7 + * + * @var array(string => array(string => bool)) + */ + protected $removedAlgorithms = array( + 'salsa10' => array( + '5.4' => true, + ), + 'salsa20' => array( + '5.4' => true, + ), + ); + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 5.5 + * + * @return array + */ + public function register() + { + return array(\T_STRING); + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 5.5 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $algo = $this->getHashAlgorithmParameter($phpcsFile, $stackPtr); + if (empty($algo) || \is_string($algo) === false) { + return; + } + + // Bow out if not one of the algorithms we're targetting. + if (isset($this->removedAlgorithms[$algo]) === false) { + return; + } + + $itemInfo = array( + 'name' => $algo, + ); + $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); + } + + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 7.1.0 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo) + { + return $this->removedAlgorithms[$itemInfo['name']]; + } + + + /** + * Get the error message template for this sniff. + * + * @since 7.1.0 + * + * @return string + */ + protected function getErrorMsgTemplate() + { + return 'The %s hash algorithm is '; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedIconvEncodingSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedIconvEncodingSniff.php new file mode 100644 index 00000000..d7c7c663 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedIconvEncodingSniff.php @@ -0,0 +1,86 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ParameterValues; + +use PHPCompatibility\AbstractFunctionCallParameterSniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect passing deprecated `$type` values to `iconv_get_encoding()`. + * + * "The iconv and mbstring configuration options related to encoding have been + * deprecated in favour of default_charset." + * + * {@internal It is unclear which mbstring functions should be targetted, so for now, + * only the iconv function is handled.} + * + * PHP version 5.6 + * + * @link https://www.php.net/manual/en/migration56.deprecated.php#migration56.deprecated.iconv-mbstring-encoding + * @link https://wiki.php.net/rfc/default_encoding + * + * @since 9.0.0 + */ +class RemovedIconvEncodingSniff extends AbstractFunctionCallParameterSniff +{ + + /** + * Functions to check for. + * + * @since 9.0.0 + * + * @var array + */ + protected $targetFunctions = array( + 'iconv_set_encoding' => true, + ); + + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * @since 9.0.0 + * + * @return bool + */ + protected function bowOutEarly() + { + return ($this->supportsAbove('5.6') === false); + } + + + /** + * Process the parameters of a matched function. + * + * @since 9.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the stack. + * @param string $functionName The token content (function name) which was matched. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) + { + if (isset($parameters[1]) === false) { + return; + } + + $phpcsFile->addWarning( + 'All previously accepted values for the $type parameter of iconv_set_encoding() have been deprecated since PHP 5.6. Found %s', + $parameters[1]['start'], + 'DeprecatedValueFound', + $parameters[1]['raw'] + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedImplodeFlexibleParamOrderSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedImplodeFlexibleParamOrderSniff.php new file mode 100644 index 00000000..1ff0f90f --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedImplodeFlexibleParamOrderSniff.php @@ -0,0 +1,323 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ParameterValues; + +use PHPCompatibility\AbstractFunctionCallParameterSniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Passing the `$glue` and `$pieces` parameters to `implode()` in reverse order has + * been deprecated in PHP 7.4. + * + * PHP version 7.4 + * + * @link https://www.php.net/manual/en/migration74.deprecated.php#migration74.deprecated.core.implode-reverse-parameters + * @link https://wiki.php.net/rfc/deprecations_php_7_4#implode_parameter_order_mix + * @link https://php.net/manual/en/function.implode.php + * + * @since 9.3.0 + */ +class RemovedImplodeFlexibleParamOrderSniff extends AbstractFunctionCallParameterSniff +{ + + /** + * Functions to check for. + * + * @since 9.3.0 + * + * @var array + */ + protected $targetFunctions = array( + 'implode' => true, + 'join' => true, + ); + + /** + * List of PHP native constants which should be recognized as text strings. + * + * @since 9.3.0 + * + * @var array + */ + private $constantStrings = array( + 'DIRECTORY_SEPARATOR' => true, + 'PHP_EOL' => true, + ); + + /** + * List of PHP native functions which should be recognized as returning an array. + * + * Note: The array_*() functions will always be taken into account. + * + * @since 9.3.0 + * + * @var array + */ + private $arrayFunctions = array( + 'compact' => true, + 'explode' => true, + 'range' => true, + ); + + /** + * List of PHP native array functions which should *not* be recognized as returning an array. + * + * @since 9.3.0 + * + * @var array + */ + private $arrayFunctionExceptions = array( + 'array_key_exists' => true, + 'array_key_first' => true, + 'array_key_last' => true, + 'array_multisort' => true, + 'array_pop' => true, + 'array_product' => true, + 'array_push' => true, + 'array_search' => true, + 'array_shift' => true, + 'array_sum' => true, + 'array_unshift' => true, + 'array_walk_recursive' => true, + 'array_walk' => true, + ); + + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * @since 9.3.0 + * + * @return bool + */ + protected function bowOutEarly() + { + return ($this->supportsAbove('7.4') === false); + } + + + /** + * Process the parameters of a matched function. + * + * @since 9.3.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the stack. + * @param string $functionName The token content (function name) which was matched. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) + { + if (isset($parameters[2]) === false) { + // Only one parameter, this must be $pieces. Bow out. + return; + } + + $tokens = $phpcsFile->getTokens(); + + /* + * Examine the first parameter. + * If there is any indication that this is an array declaration, we have an error. + */ + + $targetParam = $parameters[1]; + $start = $targetParam['start']; + $end = ($targetParam['end'] + 1); + $isOnlyText = true; + + $firstNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $start, $end, true); + if ($firstNonEmpty === false) { + // Parse error. Shouldn't be possible. + return; + } + + if ($tokens[$firstNonEmpty]['code'] === \T_OPEN_PARENTHESIS) { + $start = ($firstNonEmpty + 1); + $end = $tokens[$firstNonEmpty]['parenthesis_closer']; + } + + $hasTernary = $phpcsFile->findNext(\T_INLINE_THEN, $start, $end); + if ($hasTernary !== false + && isset($tokens[$start]['nested_parenthesis'], $tokens[$hasTernary]['nested_parenthesis']) + && count($tokens[$start]['nested_parenthesis']) === count($tokens[$hasTernary]['nested_parenthesis']) + ) { + $start = ($hasTernary + 1); + } + + for ($i = $start; $i < $end; $i++) { + $tokenCode = $tokens[$i]['code']; + + if (isset(Tokens::$emptyTokens[$tokenCode])) { + continue; + } + + if ($tokenCode === \T_STRING && isset($this->constantStrings[$tokens[$i]['content']])) { + continue; + } + + if ($hasTernary !== false && $tokenCode === \T_INLINE_ELSE) { + continue; + } + + if (isset(Tokens::$stringTokens[$tokenCode]) === false) { + $isOnlyText = false; + } + + if ($tokenCode === \T_ARRAY || $tokenCode === \T_OPEN_SHORT_ARRAY || $tokenCode === \T_ARRAY_CAST) { + $this->throwNotice($phpcsFile, $stackPtr, $functionName); + return; + } + + if ($tokenCode === \T_STRING) { + /* + * Check for specific functions which return an array (i.e. $pieces). + */ + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($i + 1), $end, true); + if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== \T_OPEN_PARENTHESIS) { + continue; + } + + $nameLc = strtolower($tokens[$i]['content']); + if (isset($this->arrayFunctions[$nameLc]) === false + && (strpos($nameLc, 'array_') !== 0 + || isset($this->arrayFunctionExceptions[$nameLc]) === true) + ) { + continue; + } + + // Now make sure it's the PHP native function being called. + $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($i - 1), $start, true); + if ($tokens[$prevNonEmpty]['code'] === \T_DOUBLE_COLON + || $tokens[$prevNonEmpty]['code'] === \T_OBJECT_OPERATOR + ) { + // Method call, not a call to the PHP native function. + continue; + } + + if ($tokens[$prevNonEmpty]['code'] === \T_NS_SEPARATOR + && $tokens[$prevNonEmpty - 1]['code'] === \T_STRING + ) { + // Namespaced function. + continue; + } + + // Ok, so we know that there is an array function in the first param. + // 99.9% chance that this is $pieces, not $glue. + $this->throwNotice($phpcsFile, $stackPtr, $functionName); + return; + } + } + + if ($isOnlyText === true) { + // First parameter only contained text string tokens, i.e. glue. + return; + } + + /* + * Examine the second parameter. + */ + + $targetParam = $parameters[2]; + $start = $targetParam['start']; + $end = ($targetParam['end'] + 1); + + $firstNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $start, $end, true); + if ($firstNonEmpty === false) { + // Parse error. Shouldn't be possible. + return; + } + + if ($tokens[$firstNonEmpty]['code'] === \T_OPEN_PARENTHESIS) { + $start = ($firstNonEmpty + 1); + $end = $tokens[$firstNonEmpty]['parenthesis_closer']; + } + + $hasTernary = $phpcsFile->findNext(\T_INLINE_THEN, $start, $end); + if ($hasTernary !== false + && isset($tokens[$start]['nested_parenthesis'], $tokens[$hasTernary]['nested_parenthesis']) + && count($tokens[$start]['nested_parenthesis']) === count($tokens[$hasTernary]['nested_parenthesis']) + ) { + $start = ($hasTernary + 1); + } + + for ($i = $start; $i < $end; $i++) { + $tokenCode = $tokens[$i]['code']; + + if (isset(Tokens::$emptyTokens[$tokenCode])) { + continue; + } + + if ($tokenCode === \T_ARRAY || $tokenCode === \T_OPEN_SHORT_ARRAY || $tokenCode === \T_ARRAY_CAST) { + // Found an array, $pieces is second. + return; + } + + if ($tokenCode === \T_STRING && isset($this->constantStrings[$tokens[$i]['content']])) { + // One of the special cased, PHP native string constants found. + $this->throwNotice($phpcsFile, $stackPtr, $functionName); + return; + } + + if ($tokenCode === \T_STRING || $tokenCode === \T_VARIABLE) { + // Function call, constant or variable encountered. + // No matter what this is combined with, we won't be able to reliably determine the value. + return; + } + + if ($tokenCode === \T_CONSTANT_ENCAPSED_STRING + || $tokenCode === \T_DOUBLE_QUOTED_STRING + || $tokenCode === \T_HEREDOC + || $tokenCode === \T_NOWDOC + ) { + $this->throwNotice($phpcsFile, $stackPtr, $functionName); + return; + } + } + } + + + /** + * Throw the error/warning. + * + * @since 9.3.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the stack. + * @param string $functionName The token content (function name) which was matched. + * + * @return void + */ + protected function throwNotice(File $phpcsFile, $stackPtr, $functionName) + { + $message = 'Passing the $glue and $pieces parameters in reverse order to %s has been deprecated since PHP 7.4'; + $isError = false; + $errorCode = 'Deprecated'; + $data = array($functionName); + + /* + Support for the deprecated behaviour is expected to be removed in PHP 8.0. + Once this has been implemented, this section should be uncommented. + if ($this->supportsAbove('8.0') === true) { + $message .= ' and is removed since PHP 8.0'; + $isError = true; + $errorCode = 'Removed'; + } + */ + + $message .= '; $glue should be the first parameter and $pieces the second'; + + $this->addMessage($phpcsFile, $message, $stackPtr, $isError, $errorCode, $data); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedMbStrrposEncodingThirdParamSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedMbStrrposEncodingThirdParamSniff.php new file mode 100644 index 00000000..7406d9a8 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedMbStrrposEncodingThirdParamSniff.php @@ -0,0 +1,149 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ParameterValues; + +use PHPCompatibility\AbstractFunctionCallParameterSniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect passing `$encoding` to `mb_strrpos()` as 3rd argument. + * + * The `$encoding` parameter was moved from the third position to the fourth in PHP 5.2.0. + * For backward compatibility, `$encoding` could be specified as the third parameter, but doing + * so is deprecated and will be removed in the future. + * + * Between PHP 5.2 and PHP 7.3, this was a deprecation in documentation only. + * As of PHP 7.4, a deprecation warning will be thrown if an encoding is passed as the 3rd + * argument. + * As of PHP 8, the argument is expected to change to accept an integer only. + * + * PHP version 5.2 + * PHP version 7.4 + * + * @link https://www.php.net/manual/en/migration74.deprecated.php#migration74.deprecated.mbstring + * @link https://wiki.php.net/rfc/deprecations_php_7_4#mb_strrpos_with_encoding_as_3rd_argument + * @link https://www.php.net/manual/en/function.mb-strrpos.php + * + * @since 9.3.0 + */ +class RemovedMbStrrposEncodingThirdParamSniff extends AbstractFunctionCallParameterSniff +{ + + /** + * Functions to check for. + * + * @since 9.3.0 + * + * @var array + */ + protected $targetFunctions = array( + 'mb_strrpos' => true, + ); + + /** + * Tokens which should be recognized as text. + * + * @since 9.3.0 + * + * @var array + */ + private $textStringTokens = array( + \T_CONSTANT_ENCAPSED_STRING, + \T_DOUBLE_QUOTED_STRING, + \T_HEREDOC, + \T_NOWDOC, + ); + + /** + * Tokens which should be recognized as numbers. + * + * @since 9.3.0 + * + * @var array + */ + private $numberTokens = array( + \T_LNUMBER => \T_LNUMBER, + \T_DNUMBER => \T_DNUMBER, + \T_MINUS => \T_MINUS, + \T_PLUS => \T_PLUS, + ); + + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * @since 9.3.0 + * + * @return bool + */ + protected function bowOutEarly() + { + return $this->supportsAbove('5.2') === false; + } + + + /** + * Process the parameters of a matched function. + * + * @since 9.3.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the stack. + * @param string $functionName The token content (function name) which was matched. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) + { + if (isset($parameters[3]) === false) { + // Optional third parameter not set. + return; + } + + if (isset($parameters[4]) === true) { + // Encoding set as fourth parameter. + return; + } + + $targetParam = $parameters[3]; + $targets = $this->numberTokens + Tokens::$emptyTokens; + $nonNumber = $phpcsFile->findNext($targets, $targetParam['start'], ($targetParam['end'] + 1), true); + if ($nonNumber === false) { + return; + } + + if ($this->isNumericCalculation($phpcsFile, $targetParam['start'], $targetParam['end']) === true) { + return; + } + + $hasString = $phpcsFile->findNext($this->textStringTokens, $targetParam['start'], ($targetParam['end'] + 1)); + if ($hasString === false) { + // No text strings found. Undetermined. + return; + } + + $error = 'Passing the encoding to mb_strrpos() as third parameter is soft deprecated since PHP 5.2'; + if ($this->supportsAbove('7.4') === true) { + $error .= ' and hard deprecated since PHP 7.4'; + } + + $error .= '. Use an explicit 0 as the offset in the third parameter.'; + + $phpcsFile->addWarning( + $error, + $targetParam['start'], + 'Deprecated' + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedMbstringModifiersSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedMbstringModifiersSniff.php new file mode 100644 index 00000000..83e4de97 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedMbstringModifiersSniff.php @@ -0,0 +1,135 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ParameterValues; + +use PHPCompatibility\AbstractFunctionCallParameterSniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Check for use of deprecated and removed regex modifiers for MbString regex functions. + * + * Initially just checks for the PHP 7.1 deprecated `e` modifier. + * + * PHP version 7.1 + * + * @link https://wiki.php.net/rfc/deprecate_mb_ereg_replace_eval_option + * @link https://www.php.net/manual/en/function.mb-regex-set-options.php + * + * @since 7.0.5 + * @since 7.0.8 This sniff now throws a warning instead of an error as the functionality is + * only deprecated (for now). + * @since 8.2.0 Now extends the `AbstractFunctionCallParameterSniff` instead of the base `Sniff` class. + * @since 9.0.0 Renamed from `MbstringReplaceEModifierSniff` to `RemovedMbstringModifiersSniff`. + */ +class RemovedMbstringModifiersSniff extends AbstractFunctionCallParameterSniff +{ + + /** + * Functions to check for. + * + * Key is the function name, value the parameter position of the options parameter. + * + * @since 7.0.5 + * @since 8.2.0 Renamed from `$functions` to `$targetFunctions`. + * + * @var array + */ + protected $targetFunctions = array( + 'mb_ereg_replace' => 4, + 'mb_eregi_replace' => 4, + 'mb_regex_set_options' => 1, + 'mbereg_replace' => 4, // Undocumented, but valid function alias. + 'mberegi_replace' => 4, // Undocumented, but valid function alias. + ); + + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * @since 8.2.0 + * + * @return bool + */ + protected function bowOutEarly() + { + // Version used here should be the highest version from the `$newModifiers` array, + // i.e. the last PHP version in which a new modifier was introduced. + return ($this->supportsAbove('7.1') === false); + } + + + /** + * Process the parameters of a matched function. + * + * @since 7.0.5 + * @since 8.2.0 Renamed from `process()` to `processParameters()` and removed + * logic superfluous now the sniff extends the abstract. + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the stack. + * @param string $functionName The token content (function name) which was matched. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) + { + $tokens = $phpcsFile->getTokens(); + $functionNameLc = strtolower($functionName); + + // Check whether the options parameter in the function call is passed. + if (isset($parameters[$this->targetFunctions[$functionNameLc]]) === false) { + return; + } + + $optionsParam = $parameters[$this->targetFunctions[$functionNameLc]]; + + $stringToken = $phpcsFile->findNext(Tokens::$stringTokens, $optionsParam['start'], $optionsParam['end'] + 1); + if ($stringToken === false) { + // No string token found in the options parameter, so skip it (e.g. variable passed in). + return; + } + + $options = ''; + + /* + * Get the content of any string tokens in the options parameter and remove the quotes and variables. + */ + for ($i = $stringToken; $i <= $optionsParam['end']; $i++) { + if (isset(Tokens::$stringTokens[$tokens[$i]['code']]) === false) { + continue; + } + + $content = $this->stripQuotes($tokens[$i]['content']); + if ($tokens[$i]['code'] === \T_DOUBLE_QUOTED_STRING) { + $content = $this->stripVariables($content); + } + $content = trim($content); + + if (empty($content) === false) { + $options .= $content; + } + } + + if (strpos($options, 'e') !== false) { + $error = 'The Mbstring regex "e" modifier is deprecated since PHP 7.1.'; + + // The alternative mb_ereg_replace_callback() function is only available since 5.4.1. + if ($this->supportsBelow('5.4.1') === false) { + $error .= ' Use mb_ereg_replace_callback() instead (PHP 5.4.1+).'; + } + + $phpcsFile->addWarning($error, $stackPtr, 'Deprecated'); + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedNonCryptoHashSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedNonCryptoHashSniff.php new file mode 100644 index 00000000..832a1f62 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedNonCryptoHashSniff.php @@ -0,0 +1,121 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ParameterValues; + +use PHPCompatibility\AbstractFunctionCallParameterSniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect usage of non-cryptographic hashes. + * + * "The `hash_hmac()`, `hash_hmac_file()`, `hash_pbkdf2()`, and `hash_init()` + * (with `HASH_HMAC`) functions no longer accept non-cryptographic hashes." + * + * PHP version 7.2 + * + * @link https://www.php.net/manual/en/migration72.incompatible.php#migration72.incompatible.hash-functions + * + * @since 9.0.0 + */ +class RemovedNonCryptoHashSniff extends AbstractFunctionCallParameterSniff +{ + + /** + * Functions to check for. + * + * @since 9.0.0 + * + * @var array + */ + protected $targetFunctions = array( + 'hash_hmac' => true, + 'hash_hmac_file' => true, + 'hash_init' => true, + 'hash_pbkdf2' => true, + ); + + /** + * List of the non-cryptographic hashes. + * + * @since 9.0.0 + * + * @var array + */ + protected $disabledCryptos = array( + 'adler32' => true, + 'crc32' => true, + 'crc32b' => true, + 'fnv132' => true, + 'fnv1a32' => true, + 'fnv164' => true, + 'fnv1a64' => true, + 'joaat' => true, + ); + + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * @since 9.0.0 + * + * @return bool + */ + protected function bowOutEarly() + { + return ($this->supportsAbove('7.2') === false); + } + + + /** + * Process the parameters of a matched function. + * + * @since 9.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the stack. + * @param string $functionName The token content (function name) which was matched. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) + { + if (isset($parameters[1]) === false) { + return; + } + + $targetParam = $parameters[1]; + + if (isset($this->disabledCryptos[$this->stripQuotes($targetParam['raw'])]) === false) { + return; + } + + if (strtolower($functionName) === 'hash_init' + && (isset($parameters[2]) === false + || ($parameters[2]['raw'] !== 'HASH_HMAC' + && $parameters[2]['raw'] !== (string) \HASH_HMAC)) + ) { + // For hash_init(), these hashes are only disabled with HASH_HMAC set. + return; + } + + $phpcsFile->addError( + 'Non-cryptographic hashes are no longer accepted by function %s() since PHP 7.2. Found: %s', + $targetParam['start'], + $this->stringToErrorCode($functionName), + array( + $functionName, + $targetParam['raw'], + ) + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedPCREModifiersSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedPCREModifiersSniff.php new file mode 100644 index 00000000..377ed79f --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedPCREModifiersSniff.php @@ -0,0 +1,241 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ParameterValues; + +use PHPCompatibility\AbstractFunctionCallParameterSniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Check for the use of deprecated and removed regex modifiers for PCRE regex functions. + * + * Initially just checks for the `e` modifier, which was deprecated since PHP 5.5 + * and removed as of PHP 7.0. + * + * {@internal If and when this sniff would need to start checking for other modifiers, a minor + * refactor will be needed as all references to the `e` modifier are currently hard-coded.} + * + * PHP version 5.5 + * PHP version 7.0 + * + * @link https://wiki.php.net/rfc/remove_preg_replace_eval_modifier + * @link https://wiki.php.net/rfc/remove_deprecated_functionality_in_php7 + * @link https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php + * + * @since 5.6 + * @since 7.0.8 This sniff now throws a warning (deprecated) or an error (removed) depending + * on the `testVersion` set. Previously it would always throw an error. + * @since 8.2.0 Now extends the `AbstractFunctionCallParameterSniff` instead of the base `Sniff` class. + * @since 9.0.0 Renamed from `PregReplaceEModifierSniff` to `RemovedPCREModifiersSniff`. + */ +class RemovedPCREModifiersSniff extends AbstractFunctionCallParameterSniff +{ + + /** + * Functions to check for. + * + * @since 7.0.1 + * @since 8.2.0 Renamed from `$functions` to `$targetFunctions`. + * + * @var array + */ + protected $targetFunctions = array( + 'preg_replace' => true, + 'preg_filter' => true, + ); + + /** + * Regex bracket delimiters. + * + * @since 7.0.5 This array was originally contained within the `process()` method. + * + * @var array + */ + protected $doublesSeparators = array( + '{' => '}', + '[' => ']', + '(' => ')', + '<' => '>', + ); + + + /** + * Process the parameters of a matched function. + * + * @since 5.6 + * @since 8.2.0 Renamed from `process()` to `processParameters()` and removed + * logic superfluous now the sniff extends the abstract. + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the stack. + * @param string $functionName The token content (function name) which was matched. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) + { + // Check the first parameter in the function call as that should contain the regex(es). + if (isset($parameters[1]) === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $functionNameLc = strtolower($functionName); + $firstParam = $parameters[1]; + + // Differentiate between an array of patterns passed and a single pattern. + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $firstParam['start'], ($firstParam['end'] + 1), true); + if ($nextNonEmpty !== false && ($tokens[$nextNonEmpty]['code'] === \T_ARRAY || $tokens[$nextNonEmpty]['code'] === \T_OPEN_SHORT_ARRAY)) { + $arrayValues = $this->getFunctionCallParameters($phpcsFile, $nextNonEmpty); + if ($functionNameLc === 'preg_replace_callback_array') { + // For preg_replace_callback_array(), the patterns will be in the array keys. + foreach ($arrayValues as $value) { + $hasKey = $phpcsFile->findNext(\T_DOUBLE_ARROW, $value['start'], ($value['end'] + 1)); + if ($hasKey === false) { + continue; + } + + $value['end'] = ($hasKey - 1); + $value['raw'] = trim($phpcsFile->getTokensAsString($value['start'], ($hasKey - $value['start']))); + $this->processRegexPattern($value, $phpcsFile, $value['end'], $functionName); + } + + } else { + // Otherwise, the patterns will be in the array values. + foreach ($arrayValues as $value) { + $hasKey = $phpcsFile->findNext(\T_DOUBLE_ARROW, $value['start'], ($value['end'] + 1)); + if ($hasKey !== false) { + $value['start'] = ($hasKey + 1); + $value['raw'] = trim($phpcsFile->getTokensAsString($value['start'], (($value['end'] + 1) - $value['start']))); + } + + $this->processRegexPattern($value, $phpcsFile, $value['end'], $functionName); + } + } + + } else { + $this->processRegexPattern($firstParam, $phpcsFile, $stackPtr, $functionName); + } + } + + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * @since 8.2.0 + * + * @return bool + */ + protected function bowOutEarly() + { + return ($this->supportsAbove('5.5') === false); + } + + + /** + * Analyse a potential regex pattern for use of the /e modifier. + * + * @since 7.1.2 This logic was originally contained within the `process()` method. + * + * @param array $pattern Array containing the start and end token + * pointer of the potential regex pattern and + * the raw string value of the pattern. + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * @param string $functionName The function which contained the pattern. + * + * @return void + */ + protected function processRegexPattern($pattern, File $phpcsFile, $stackPtr, $functionName) + { + $tokens = $phpcsFile->getTokens(); + + /* + * The pattern might be build up of a combination of strings, variables + * and function calls. We are only concerned with the strings. + */ + $regex = ''; + for ($i = $pattern['start']; $i <= $pattern['end']; $i++) { + if (isset(Tokens::$stringTokens[$tokens[$i]['code']]) === true) { + $content = $this->stripQuotes($tokens[$i]['content']); + if ($tokens[$i]['code'] === \T_DOUBLE_QUOTED_STRING) { + $content = $this->stripVariables($content); + } + + $regex .= trim($content); + } + } + + // Deal with multi-line regexes which were broken up in several string tokens. + if ($tokens[$pattern['start']]['line'] !== $tokens[$pattern['end']]['line']) { + $regex = $this->stripQuotes($regex); + } + + if ($regex === '') { + // No string token found in the first parameter, so skip it (e.g. if variable passed in). + return; + } + + $regexFirstChar = substr($regex, 0, 1); + + // Make sure that the character identified as the delimiter is valid. + // Otherwise, it is a false positive caused by the string concatenation. + if (preg_match('`[a-z0-9\\\\ ]`i', $regexFirstChar) === 1) { + return; + } + + if (isset($this->doublesSeparators[$regexFirstChar])) { + $regexEndPos = strrpos($regex, $this->doublesSeparators[$regexFirstChar]); + } else { + $regexEndPos = strrpos($regex, $regexFirstChar); + } + + if ($regexEndPos !== false) { + $modifiers = substr($regex, $regexEndPos + 1); + $this->examineModifiers($phpcsFile, $stackPtr, $functionName, $modifiers); + } + } + + + /** + * Examine the regex modifier string. + * + * @since 8.2.0 Split off from the `processRegexPattern()` method. + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * @param string $functionName The function which contained the pattern. + * @param string $modifiers The regex modifiers found. + * + * @return void + */ + protected function examineModifiers(File $phpcsFile, $stackPtr, $functionName, $modifiers) + { + if (strpos($modifiers, 'e') !== false) { + $error = '%s() - /e modifier is deprecated since PHP 5.5'; + $isError = false; + $errorCode = 'Deprecated'; + $data = array($functionName); + + if ($this->supportsAbove('7.0')) { + $error .= ' and removed since PHP 7.0'; + $isError = true; + $errorCode = 'Removed'; + } + + $this->addMessage($phpcsFile, $error, $stackPtr, $isError, $errorCode, $data); + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedSetlocaleStringSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedSetlocaleStringSniff.php new file mode 100644 index 00000000..6f1eced1 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedSetlocaleStringSniff.php @@ -0,0 +1,104 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\ParameterValues; + +use PHPCompatibility\AbstractFunctionCallParameterSniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect passing a string literal as `$category` to `setlocale()`. + * + * Support for the category parameter passed as a string has been removed. + * Only `LC_*` constants can be used as of PHP 7.0.0. + * + * PHP version 4.2 + * PHP version 7.0 + * + * @link https://wiki.php.net/rfc/remove_deprecated_functionality_in_php7 + * @link https://www.php.net/manual/en/function.setlocale.php#refsect1-function.setlocale-changelog + * + * @since 9.0.0 + */ +class RemovedSetlocaleStringSniff extends AbstractFunctionCallParameterSniff +{ + + /** + * Functions to check for. + * + * @since 9.0.0 + * + * @var array + */ + protected $targetFunctions = array( + 'setlocale' => true, + ); + + + /** + * Do a version check to determine if this sniff needs to run at all. + * + * @since 9.0.0 + * + * @return bool + */ + protected function bowOutEarly() + { + return ($this->supportsAbove('4.2') === false); + } + + + /** + * Process the parameters of a matched function. + * + * @since 9.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the stack. + * @param string $functionName The token content (function name) which was matched. + * @param array $parameters Array with information about the parameters. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) + { + if (isset($parameters[1]) === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $targetParam = $parameters[1]; + + for ($i = $targetParam['start']; $i <= $targetParam['end']; $i++) { + if ($tokens[$i]['code'] !== \T_CONSTANT_ENCAPSED_STRING + && $tokens[$i]['code'] !== \T_DOUBLE_QUOTED_STRING + ) { + continue; + } + + $message = 'Passing the $category as a string to setlocale() has been deprecated since PHP 4.2'; + $isError = false; + $errorCode = 'Deprecated'; + $data = array($targetParam['raw']); + + if ($this->supportsAbove('7.0') === true) { + $message .= ' and is removed since PHP 7.0'; + $isError = true; + $errorCode = 'Removed'; + } + + $message .= '; Pass one of the LC_* constants instead. Found: %s'; + + $this->addMessage($phpcsFile, $message, $i, $isError, $errorCode, $data); + break; + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/ForbiddenCallTimePassByReferenceSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/ForbiddenCallTimePassByReferenceSniff.php new file mode 100644 index 00000000..96b49827 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/ForbiddenCallTimePassByReferenceSniff.php @@ -0,0 +1,259 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2009-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Syntax; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect the use of call time pass by reference. + * + * This behaviour has been deprecated in PHP 5.3 and removed in PHP 5.4. + * + * PHP version 5.4 + * + * @link https://wiki.php.net/rfc/calltimebyref + * @link https://www.php.net/manual/en/language.references.pass.php + * + * @since 5.5 + * @since 7.0.8 This sniff now throws a warning (deprecated) or an error (removed) depending + * on the `testVersion` set. Previously it would always throw an error. + */ +class ForbiddenCallTimePassByReferenceSniff extends Sniff +{ + + /** + * Tokens that represent assignments or equality comparisons. + * + * Near duplicate of Tokens::$assignmentTokens + Tokens::$equalityTokens. + * Copied in for PHPCS cross-version compatibility. + * + * @since 8.1.0 + * + * @var array + */ + private $assignOrCompare = array( + // Equality tokens. + 'T_IS_EQUAL' => true, + 'T_IS_NOT_EQUAL' => true, + 'T_IS_IDENTICAL' => true, + 'T_IS_NOT_IDENTICAL' => true, + 'T_IS_SMALLER_OR_EQUAL' => true, + 'T_IS_GREATER_OR_EQUAL' => true, + + // Assignment tokens. + 'T_EQUAL' => true, + 'T_AND_EQUAL' => true, + 'T_OR_EQUAL' => true, + 'T_CONCAT_EQUAL' => true, + 'T_DIV_EQUAL' => true, + 'T_MINUS_EQUAL' => true, + 'T_POW_EQUAL' => true, + 'T_MOD_EQUAL' => true, + 'T_MUL_EQUAL' => true, + 'T_PLUS_EQUAL' => true, + 'T_XOR_EQUAL' => true, + 'T_DOUBLE_ARROW' => true, + 'T_SL_EQUAL' => true, + 'T_SR_EQUAL' => true, + 'T_COALESCE_EQUAL' => true, + 'T_ZSR_EQUAL' => true, + ); + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 5.5 + * + * @return array + */ + public function register() + { + return array( + \T_STRING, + \T_VARIABLE, + ); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 5.5 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('5.3') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + // Skip tokens that are the names of functions or classes + // within their definitions. For example: function myFunction... + // "myFunction" is T_STRING but we should skip because it is not a + // function or method *call*. + $findTokens = Tokens::$emptyTokens; + $findTokens[] = \T_BITWISE_AND; + + $prevNonEmpty = $phpcsFile->findPrevious( + $findTokens, + ($stackPtr - 1), + null, + true + ); + + if ($prevNonEmpty !== false && \in_array($tokens[$prevNonEmpty]['type'], array('T_FUNCTION', 'T_CLASS', 'T_INTERFACE', 'T_TRAIT'), true)) { + return; + } + + // If the next non-whitespace token after the function or method call + // is not an opening parenthesis then it can't really be a *call*. + $openBracket = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + + if ($openBracket === false || $tokens[$openBracket]['code'] !== \T_OPEN_PARENTHESIS + || isset($tokens[$openBracket]['parenthesis_closer']) === false + ) { + return; + } + + // Get the function call parameters. + $parameters = $this->getFunctionCallParameters($phpcsFile, $stackPtr); + if (\count($parameters) === 0) { + return; + } + + // Which nesting level is the one we are interested in ? + $nestedParenthesisCount = 1; + if (isset($tokens[$openBracket]['nested_parenthesis'])) { + $nestedParenthesisCount = \count($tokens[$openBracket]['nested_parenthesis']) + 1; + } + + foreach ($parameters as $parameter) { + if ($this->isCallTimePassByReferenceParam($phpcsFile, $parameter, $nestedParenthesisCount) === true) { + // T_BITWISE_AND represents a pass-by-reference. + $error = 'Using a call-time pass-by-reference is deprecated since PHP 5.3'; + $isError = false; + $errorCode = 'Deprecated'; + + if ($this->supportsAbove('5.4')) { + $error .= ' and prohibited since PHP 5.4'; + $isError = true; + $errorCode = 'NotAllowed'; + } + + $this->addMessage($phpcsFile, $error, $parameter['start'], $isError, $errorCode); + } + } + } + + + /** + * Determine whether a parameter is passed by reference. + * + * @since 7.0.6 Split off from the `process()` method. + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param array $parameter Information on the current parameter + * to be examined. + * @param int $nestingLevel Target nesting level. + * + * @return bool + */ + protected function isCallTimePassByReferenceParam(File $phpcsFile, $parameter, $nestingLevel) + { + $tokens = $phpcsFile->getTokens(); + + $searchStartToken = $parameter['start'] - 1; + $searchEndToken = $parameter['end'] + 1; + $nextVariable = $searchStartToken; + do { + $nextVariable = $phpcsFile->findNext(array(\T_VARIABLE, \T_OPEN_SHORT_ARRAY, \T_CLOSURE), ($nextVariable + 1), $searchEndToken); + if ($nextVariable === false) { + return false; + } + + // Ignore anything within short array definition brackets. + if ($tokens[$nextVariable]['type'] === 'T_OPEN_SHORT_ARRAY' + && (isset($tokens[$nextVariable]['bracket_opener']) + && $tokens[$nextVariable]['bracket_opener'] === $nextVariable) + && isset($tokens[$nextVariable]['bracket_closer']) + ) { + // Skip forward to the end of the short array definition. + $nextVariable = $tokens[$nextVariable]['bracket_closer']; + continue; + } + + // Skip past closures passed as function parameters. + if ($tokens[$nextVariable]['type'] === 'T_CLOSURE' + && (isset($tokens[$nextVariable]['scope_condition']) + && $tokens[$nextVariable]['scope_condition'] === $nextVariable) + && isset($tokens[$nextVariable]['scope_closer']) + ) { + // Skip forward to the end of the closure declaration. + $nextVariable = $tokens[$nextVariable]['scope_closer']; + continue; + } + + // Make sure the variable belongs directly to this function call + // and is not inside a nested function call or array. + if (isset($tokens[$nextVariable]['nested_parenthesis']) === false + || (\count($tokens[$nextVariable]['nested_parenthesis']) !== $nestingLevel) + ) { + continue; + } + + // Checking this: $value = my_function(...[*]$arg...). + $tokenBefore = $phpcsFile->findPrevious( + Tokens::$emptyTokens, + ($nextVariable - 1), + $searchStartToken, + true + ); + + if ($tokenBefore === false || $tokens[$tokenBefore]['code'] !== \T_BITWISE_AND) { + // Nothing before the token or no &. + continue; + } + + if ($phpcsFile->isReference($tokenBefore) === false) { + continue; + } + + // Checking this: $value = my_function(...[*]&$arg...). + $tokenBefore = $phpcsFile->findPrevious( + Tokens::$emptyTokens, + ($tokenBefore - 1), + $searchStartToken, + true + ); + + // Prevent false positive on assign by reference and compare with reference + // within function call parameters. + if (isset($this->assignOrCompare[$tokens[$tokenBefore]['type']])) { + continue; + } + + // The found T_BITWISE_AND represents a pass-by-reference. + return true; + + } while ($nextVariable < $searchEndToken); + + // This code should never be reached, but here in case of weird bugs. + return false; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewArrayStringDereferencingSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewArrayStringDereferencingSniff.php new file mode 100644 index 00000000..2cc1e551 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewArrayStringDereferencingSniff.php @@ -0,0 +1,199 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Syntax; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect array and string literal dereferencing. + * + * As of PHP 5.5, array and string literals can now be dereferenced directly to + * access individual elements and characters. + * + * As of PHP 7.0, this also works when using curly braces for the dereferencing. + * While unclear, this most likely has to do with the Uniform Variable Syntax changes. + * + * PHP version 5.5 + * PHP version 7.0 + * + * @link https://www.php.net/manual/en/migration55.new-features.php#migration55.new-features.const-dereferencing + * @link https://wiki.php.net/rfc/constdereference + * @link https://wiki.php.net/rfc/uniform_variable_syntax + * @link https://www.php.net/manual/en/language.types.array.php#example-63 + * + * {@internal The reason for splitting the logic of this sniff into different methods is + * to allow re-use of the logic by the PHP 7.4 `RemovedCurlyBraceArrayAccess` sniff.} + * + * @since 7.1.4 + * @since 9.3.0 Now also detects dereferencing using curly braces. + */ +class NewArrayStringDereferencingSniff extends Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.1.4 + * + * @return array + */ + public function register() + { + return array( + \T_ARRAY, + \T_OPEN_SHORT_ARRAY, + \T_CONSTANT_ENCAPSED_STRING, + ); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.1.4 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('5.6') === false) { + return; + } + + $dereferencing = $this->isArrayStringDereferencing($phpcsFile, $stackPtr); + if (empty($dereferencing)) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $supports54 = $this->supportsBelow('5.4'); + + foreach ($dereferencing['braces'] as $openBrace => $closeBrace) { + if ($supports54 === true + && ($tokens[$openBrace]['type'] === 'T_OPEN_SQUARE_BRACKET' + || $tokens[$openBrace]['type'] === 'T_OPEN_SHORT_ARRAY') // Work around bug #1381 in PHPCS 2.8.1 and lower. + ) { + $phpcsFile->addError( + 'Direct array dereferencing of %s is not present in PHP version 5.4 or earlier', + $openBrace, + 'Found', + array($dereferencing['type']) + ); + + continue; + } + + // PHP 7.0 Array/string dereferencing using curly braces. + if ($tokens[$openBrace]['type'] === 'T_OPEN_CURLY_BRACKET') { + $phpcsFile->addError( + 'Direct array dereferencing of %s using curly braces is not present in PHP version 5.6 or earlier', + $openBrace, + 'FoundUsingCurlies', + array($dereferencing['type']) + ); + } + } + } + + + /** + * Check if this string/array is being dereferenced. + * + * @since 9.3.0 Logic split off from the process method. + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return array Array containing the type of access and stack pointers to the + * open/close braces involved in the array/string dereferencing; + * or an empty array if no array/string dereferencing was detected. + */ + public function isArrayStringDereferencing(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + switch ($tokens[$stackPtr]['code']) { + case \T_CONSTANT_ENCAPSED_STRING: + $type = 'string literals'; + $end = $stackPtr; + break; + + case \T_ARRAY: + if (isset($tokens[$stackPtr]['parenthesis_closer']) === false) { + // Live coding. + return array(); + } else { + $type = 'arrays'; + $end = $tokens[$stackPtr]['parenthesis_closer']; + } + break; + + case \T_OPEN_SHORT_ARRAY: + if (isset($tokens[$stackPtr]['bracket_closer']) === false) { + // Live coding. + return array(); + } else { + $type = 'arrays'; + $end = $tokens[$stackPtr]['bracket_closer']; + } + break; + } + + if (isset($type, $end) === false) { + // Shouldn't happen, but for some reason did. + return array(); + } + + $braces = array(); + + do { + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($end + 1), null, true, null, true); + if ($nextNonEmpty === false) { + break; + } + + if ($tokens[$nextNonEmpty]['type'] === 'T_OPEN_SQUARE_BRACKET' + || $tokens[$nextNonEmpty]['type'] === 'T_OPEN_CURLY_BRACKET' // PHP 7.0+. + || $tokens[$nextNonEmpty]['type'] === 'T_OPEN_SHORT_ARRAY' // Work around bug #1381 in PHPCS 2.8.1 and lower. + ) { + if (isset($tokens[$nextNonEmpty]['bracket_closer']) === false) { + // Live coding or parse error. + break; + } + + $braces[$nextNonEmpty] = $tokens[$nextNonEmpty]['bracket_closer']; + + // Continue, just in case there is nested array access, i.e. `array(1, 2, 3)[$i][$j];`. + $end = $tokens[$nextNonEmpty]['bracket_closer']; + continue; + } + + // If we're still here, we've reached the end of the variable. + break; + + } while (true); + + if (empty($braces)) { + return array(); + } + + return array( + 'type' => $type, + 'braces' => $braces, + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewArrayUnpackingSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewArrayUnpackingSniff.php new file mode 100644 index 00000000..f0f66b86 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewArrayUnpackingSniff.php @@ -0,0 +1,142 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Syntax; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Using the spread operator for unpacking arrays in array expressions is available since PHP 7.4. + * + * PHP version 7.4 + * + * @link https://www.php.net/manual/en/migration74.new-features.php#migration74.new-features.core.unpack-inside-array + * @link https://wiki.php.net/rfc/spread_operator_for_array + * + * @since 9.2.0 + */ +class NewArrayUnpackingSniff extends Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 9.2.0 + * + * @return array + */ + public function register() + { + return array( + \T_ARRAY, + \T_OPEN_SHORT_ARRAY, + ); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 9.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('7.3') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + /* + * Determine the array opener & closer. + */ + $closer = $phpcsFile->numTokens; + if ($tokens[$stackPtr]['code'] === \T_ARRAY) { + if (isset($tokens[$stackPtr]['parenthesis_opener']) === false) { + return; + } + + $opener = $tokens[$stackPtr]['parenthesis_opener']; + + if (isset($tokens[$opener]['parenthesis_closer'])) { + $closer = $tokens[$opener]['parenthesis_closer']; + } + } else { + // Short array syntax. + $opener = $stackPtr; + + if (isset($tokens[$stackPtr]['bracket_closer'])) { + $closer = $tokens[$stackPtr]['bracket_closer']; + } + } + + $nestingLevel = 0; + if (isset($tokens[($opener + 1)]['nested_parenthesis'])) { + $nestingLevel = count($tokens[($opener + 1)]['nested_parenthesis']); + } + + for ($i = $opener; $i < $closer;) { + $i = $phpcsFile->findNext(array(\T_ELLIPSIS, \T_OPEN_SHORT_ARRAY, \T_ARRAY), ($i + 1), $closer); + if ($i === false) { + return; + } + + if ($tokens[$i]['code'] === \T_OPEN_SHORT_ARRAY) { + if (isset($tokens[$i]['bracket_closer']) === false) { + // Live coding, unfinished nested array, handle this when the array opener + // of the nested array is passed. + return; + } + + // Skip over nested short arrays. These will be handled when the array opener + // of the nested array is passed. + $i = $tokens[$i]['bracket_closer']; + continue; + } + + if ($tokens[$i]['code'] === \T_ARRAY) { + if (isset($tokens[$i]['parenthesis_closer']) === false) { + // Live coding, unfinished nested array, handle this when the array opener + // of the nested array is passed. + return; + } + + // Skip over nested long arrays. These will be handled when the array opener + // of the nested array is passed. + $i = $tokens[$i]['parenthesis_closer']; + continue; + } + + // Ensure this is not function call variable unpacking. + if (isset($tokens[$i]['nested_parenthesis']) + && count($tokens[$i]['nested_parenthesis']) > $nestingLevel + ) { + continue; + } + + // Ok, found one. + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($i + 1), null, true); + $snippet = trim($phpcsFile->getTokensAsString($i, (($nextNonEmpty - $i) + 1))); + $phpcsFile->addError( + 'Array unpacking within array declarations using the spread operator is not supported in PHP 7.3 or earlier. Found: %s', + $i, + 'Found', + array($snippet) + ); + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewClassMemberAccessSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewClassMemberAccessSniff.php new file mode 100644 index 00000000..218f0c9f --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewClassMemberAccessSniff.php @@ -0,0 +1,192 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Syntax; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect class member access on object instantiation/cloning. + * + * PHP 5.4: Class member access on instantiation has been added, e.g. `(new Foo)->bar()`. + * PHP 7.0: Class member access on cloning has been added, e.g. `(clone $foo)->bar()`. + * + * As of PHP 7.0, class member access on instantiation also works when using curly braces. + * While unclear, this most likely has to do with the Uniform Variable Syntax changes. + * + * PHP version 5.4 + * PHP version 7.0 + * + * @link https://www.php.net/manual/en/language.oop5.basic.php#example-177 + * @link https://www.php.net/manual/en/language.oop5.cloning.php#language.oop5.traits.properties.example + * @link https://www.php.net/manual/en/migration54.new-features.php + * @link https://wiki.php.net/rfc/instance-method-call + * @link https://wiki.php.net/rfc/uniform_variable_syntax + * + * {@internal The reason for splitting the logic of this sniff into different methods is + * to allow re-use of the logic by the PHP 7.4 `RemovedCurlyBraceArrayAccess` sniff.} + * + * @since 8.2.0 + * @since 9.3.0 Now also detects class member access on instantiation using curly braces. + */ +class NewClassMemberAccessSniff extends Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 8.2.0 + * + * @return array + */ + public function register() + { + return array( + \T_NEW, + \T_CLONE, + ); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('5.6') === false) { + return; + } + + $pointers = $this->isClassMemberAccess($phpcsFile, $stackPtr); + if (empty($pointers)) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $supports53 = $this->supportsBelow('5.3'); + + $error = 'Class member access on object %s was not supported in PHP %s or earlier'; + $data = array('instantiation', '5.3'); + $errorCode = 'OnNewFound'; + + if ($tokens[$stackPtr]['code'] === \T_CLONE) { + $data = array('cloning', '5.6'); + $errorCode = 'OnCloneFound'; + } + + foreach ($pointers as $open => $close) { + $itemData = $data; + $itemErrorCode = $errorCode; + + if ($tokens[$stackPtr]['code'] === \T_NEW + && $tokens[$open]['code'] !== \T_OPEN_CURLY_BRACKET + ) { + if ($supports53 === true) { + $phpcsFile->addError($error, $open, $itemErrorCode, $itemData); + } + continue; + } + + if ($tokens[$stackPtr]['code'] === \T_NEW + && $tokens[$open]['code'] === \T_OPEN_CURLY_BRACKET + ) { + // Non-curlies was already handled above. + $itemData = array('instantiation using curly braces', '5.6'); + $itemErrorCode = 'OnNewFoundUsingCurlies'; + } + + $phpcsFile->addError($error, $open, $itemErrorCode, $itemData); + } + } + + + /** + * Check if the class being instantiated/cloned is being dereferenced. + * + * @since 9.3.0 Logic split off from the process method. + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return array Array containing the stack pointers to the object operator or + * the open/close braces involved in the class member access; + * or an empty array if no class member access was detected. + */ + public function isClassMemberAccess(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + if (isset($tokens[$stackPtr]['nested_parenthesis']) === false) { + // The `new className/clone $a` has to be in parentheses, without is not supported. + return array(); + } + + $parenthesisCloser = end($tokens[$stackPtr]['nested_parenthesis']); + $parenthesisOpener = key($tokens[$stackPtr]['nested_parenthesis']); + + if (isset($tokens[$parenthesisOpener]['parenthesis_owner']) === true) { + // If there is an owner, these parentheses are for a different purpose. + return array(); + } + + $prevBeforeParenthesis = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($parenthesisOpener - 1), null, true); + if ($prevBeforeParenthesis !== false && $tokens[$prevBeforeParenthesis]['code'] === \T_STRING) { + // This is most likely a function call with the new/cloned object as a parameter. + return array(); + } + + $braces = array(); + $end = $parenthesisCloser; + + do { + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($end + 1), null, true, null, true); + if ($nextNonEmpty === false) { + break; + } + + if ($tokens[$nextNonEmpty]['code'] === \T_OBJECT_OPERATOR) { + // No need to walk any further if this is object access. + $braces[$nextNonEmpty] = true; + break; + } + + if ($tokens[$nextNonEmpty]['code'] === \T_OPEN_SQUARE_BRACKET + || $tokens[$nextNonEmpty]['code'] === \T_OPEN_CURLY_BRACKET // PHP 7.0+. + ) { + if (isset($tokens[$nextNonEmpty]['bracket_closer']) === false) { + // Live coding or parse error. + break; + } + + $braces[$nextNonEmpty] = $tokens[$nextNonEmpty]['bracket_closer']; + + // Continue, just in case there is nested array access, i.e. `(new Foo())[1][0];`. + $end = $tokens[$nextNonEmpty]['bracket_closer']; + continue; + } + + // If we're still here, we've reached the end. + break; + + } while (true); + + return $braces; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewDynamicAccessToStaticSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewDynamicAccessToStaticSniff.php new file mode 100644 index 00000000..4fd3b2fa --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewDynamicAccessToStaticSniff.php @@ -0,0 +1,89 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Syntax; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect dynamic access to static methods and properties, as well as class constants. + * + * As of PHP 5.3, static properties and methods as well as class constants + * can be accessed using a dynamic (variable) class name. + * + * PHP version 5.3 + * + * @link https://www.php.net/manual/en/migration53.new-features.php + * + * @since 8.1.0 + * @since 9.0.0 Renamed from `DynamicAccessToStaticSniff` to `NewDynamicAccessToStaticSniff`. + */ +class NewDynamicAccessToStaticSniff extends Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 8.1.0 + * + * @return array + */ + public function register() + { + return array( + \T_DOUBLE_COLON, + ); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 8.1.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('5.2') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); + + // Disregard `static::` as well. Late static binding is reported by another sniff. + if ($tokens[$prevNonEmpty]['code'] === \T_SELF + || $tokens[$prevNonEmpty]['code'] === \T_PARENT + || $tokens[$prevNonEmpty]['code'] === \T_STATIC + ) { + return; + } + + if ($tokens[$prevNonEmpty]['code'] === \T_STRING) { + $prevPrevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($prevNonEmpty - 1), null, true); + + if ($tokens[$prevPrevNonEmpty]['code'] !== \T_OBJECT_OPERATOR) { + return; + } + } + + $phpcsFile->addError( + 'Static class properties and methods, as well as class constants, could not be accessed using a dynamic (variable) classname in PHP 5.2 or earlier.', + $stackPtr, + 'Found' + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewFlexibleHeredocNowdocSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewFlexibleHeredocNowdocSniff.php new file mode 100644 index 00000000..b24590a6 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewFlexibleHeredocNowdocSniff.php @@ -0,0 +1,255 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Syntax; + +use PHPCompatibility\Sniff; +use PHPCompatibility\PHPCSHelper; +use PHP_CodeSniffer_File as File; + +/** + * Detect usage of flexible heredoc/nowdoc and related cross-version incompatibilities. + * + * As of PHP 7.3: + * - The body and the closing marker of a heredoc/nowdoc can be indented; + * - The closing marker no longer needs to be on a line by itself; + * - The heredoc/nowdoc body may no longer contain the closing marker at the + * start of any of its lines. + * + * PHP version 7.3 + * + * @link https://www.php.net/manual/en/migration73.new-features.php#migration73.new-features.core.heredoc + * @link https://wiki.php.net/rfc/flexible_heredoc_nowdoc_syntaxes + * + * @since 9.0.0 + */ +class NewFlexibleHeredocNowdocSniff extends Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 9.0.0 + * + * @return array + */ + public function register() + { + $targets = array( + \T_END_HEREDOC, + \T_END_NOWDOC, + ); + + if (version_compare(\PHP_VERSION_ID, '70299', '>') === false) { + // Start identifier of a PHP 7.3 flexible heredoc/nowdoc. + $targets[] = \T_STRING; + } + + return $targets; + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 9.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + /* + * Due to a tokenizer bug which gets hit when the PHP 7.3 heredoc/nowdoc syntax + * is used, this part of the sniff cannot possibly work on PHPCS < 2.6.0. + * See upstream issue #928. + */ + if ($this->supportsBelow('7.2') === true && version_compare(PHPCSHelper::getVersion(), '2.6.0', '>=')) { + $this->detectIndentedNonStandAloneClosingMarker($phpcsFile, $stackPtr); + } + + $tokens = $phpcsFile->getTokens(); + if ($this->supportsAbove('7.3') === true && $tokens[$stackPtr]['code'] !== \T_STRING) { + $this->detectClosingMarkerInBody($phpcsFile, $stackPtr); + } + } + + + /** + * Detect indented and/or non-stand alone closing markers. + * + * @since 9.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + protected function detectIndentedNonStandAloneClosingMarker(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $indentError = 'Heredoc/nowdoc with an indented closing marker is not supported in PHP 7.2 or earlier.'; + $indentErrorCode = 'IndentedClosingMarker'; + $trailingError = 'Having code - other than a semi-colon or new line - after the closing marker of a heredoc/nowdoc is not supported in PHP 7.2 or earlier.'; + $trailingErrorCode = 'ClosingMarkerNoNewLine'; + + if (version_compare(\PHP_VERSION_ID, '70299', '>') === true) { + + /* + * Check for indented closing marker. + */ + if (ltrim($tokens[$stackPtr]['content']) !== $tokens[$stackPtr]['content']) { + $phpcsFile->addError($indentError, $stackPtr, $indentErrorCode); + } + + /* + * Check for tokens after the closing marker. + */ + $nextNonWhitespace = $phpcsFile->findNext(array(\T_WHITESPACE, \T_SEMICOLON), ($stackPtr + 1), null, true); + if ($tokens[$stackPtr]['line'] === $tokens[$nextNonWhitespace]['line']) { + $phpcsFile->addError($trailingError, $stackPtr, $trailingErrorCode); + } + } else { + // For PHP < 7.3, we're only interested in T_STRING tokens. + if ($tokens[$stackPtr]['code'] !== \T_STRING) { + return; + } + + if (preg_match('`^<<<([\'"]?)([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)\1[\r\n]+`', $tokens[$stackPtr]['content'], $matches) !== 1) { + // Not the start of a PHP 7.3 flexible heredoc/nowdoc. + return; + } + + $identifier = $matches[2]; + + for ($i = ($stackPtr + 1); $i <= $phpcsFile->numTokens; $i++) { + if ($tokens[$i]['code'] !== \T_ENCAPSED_AND_WHITESPACE) { + continue; + } + + $trimmed = ltrim($tokens[$i]['content']); + + if (strpos($trimmed, $identifier) !== 0) { + continue; + } + + // OK, we've found the PHP 7.3 flexible heredoc/nowdoc closing marker. + + /* + * Check for indented closing marker. + */ + if ($trimmed !== $tokens[$i]['content']) { + // Indent found before closing marker. + $phpcsFile->addError($indentError, $i, $indentErrorCode); + } + + /* + * Check for tokens after the closing marker. + */ + // Remove the identifier. + $afterMarker = substr($trimmed, \strlen($identifier)); + // Remove a potential semi-colon at the beginning of what's left of the string. + $afterMarker = ltrim($afterMarker, ';'); + // Remove new line characters at the end of the string. + $afterMarker = rtrim($afterMarker, "\r\n"); + + if ($afterMarker !== '') { + $phpcsFile->addError($trailingError, $i, $trailingErrorCode); + } + + break; + } + } + } + + + /** + * Detect heredoc/nowdoc identifiers at the start of lines in the heredoc/nowdoc body. + * + * @since 9.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + protected function detectClosingMarkerInBody(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $error = 'The body of a heredoc/nowdoc can not contain the heredoc/nowdoc closing marker as text at the start of a line since PHP 7.3.'; + $errorCode = 'ClosingMarkerNoNewLine'; + + if (version_compare(\PHP_VERSION_ID, '70299', '>') === true) { + $nextNonWhitespace = $phpcsFile->findNext(\T_WHITESPACE, ($stackPtr + 1), null, true, null, true); + if ($nextNonWhitespace === false + || $tokens[$nextNonWhitespace]['code'] === \T_SEMICOLON + || (($tokens[$nextNonWhitespace]['code'] === \T_COMMA + || $tokens[$nextNonWhitespace]['code'] === \T_STRING_CONCAT) + && $tokens[$nextNonWhitespace]['line'] !== $tokens[$stackPtr]['line']) + ) { + // This is most likely a correctly identified closing marker. + return; + } + + // The real closing tag has to be before the next heredoc/nowdoc. + $nextHereNowDoc = $phpcsFile->findNext(array(\T_START_HEREDOC, \T_START_NOWDOC), ($stackPtr + 1)); + if ($nextHereNowDoc === false) { + $nextHereNowDoc = null; + } + + $identifier = trim($tokens[$stackPtr]['content']); + $realClosingMarker = $stackPtr; + + while (($realClosingMarker = $phpcsFile->findNext(\T_STRING, ($realClosingMarker + 1), $nextHereNowDoc, false, $identifier)) !== false) { + + $prevNonWhitespace = $phpcsFile->findPrevious(\T_WHITESPACE, ($realClosingMarker - 1), null, true); + if ($prevNonWhitespace === false + || $tokens[$prevNonWhitespace]['line'] === $tokens[$realClosingMarker]['line'] + ) { + // Marker text found, but not at the start of the line. + continue; + } + + // The original T_END_HEREDOC/T_END_NOWDOC was most likely incorrect as we've found + // a possible alternative closing marker. + $phpcsFile->addError($error, $stackPtr, $errorCode); + + break; + } + + } else { + if (isset($tokens[$stackPtr]['scope_closer'], $tokens[$stackPtr]['scope_opener']) === true + && $tokens[$stackPtr]['scope_closer'] === $stackPtr + ) { + $opener = $tokens[$stackPtr]['scope_opener']; + } else { + // PHPCS < 3.0.2 did not add scope_* values for Nowdocs. + $opener = $phpcsFile->findPrevious(\T_START_NOWDOC, ($stackPtr - 1)); + if ($opener === false) { + return; + } + } + + $quotedIdentifier = preg_quote($tokens[$stackPtr]['content'], '`'); + + // Throw an error for each line in the body which starts with the identifier. + for ($i = ($opener + 1); $i < $stackPtr; $i++) { + if (preg_match('`^[ \t]*' . $quotedIdentifier . '\b`', $tokens[$i]['content']) === 1) { + $phpcsFile->addError($error, $i, $errorCode); + } + } + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewFunctionArrayDereferencingSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewFunctionArrayDereferencingSniff.php new file mode 100644 index 00000000..ac5e6b72 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewFunctionArrayDereferencingSniff.php @@ -0,0 +1,187 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Syntax; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect function array dereferencing as introduced in PHP 5.4. + * + * PHP 5.4 supports direct array dereferencing on the return of a method/function call. + * + * As of PHP 7.0, this also works when using curly braces for the dereferencing. + * While unclear, this most likely has to do with the Uniform Variable Syntax changes. + * + * PHP version 5.4 + * PHP version 7.0 + * + * @link https://www.php.net/manual/en/language.types.array.php#example-63 + * @link https://www.php.net/manual/en/migration54.new-features.php + * @link https://wiki.php.net/rfc/functionarraydereferencing + * @link https://wiki.php.net/rfc/uniform_variable_syntax + * + * {@internal The reason for splitting the logic of this sniff into different methods is + * to allow re-use of the logic by the PHP 7.4 RemovedCurlyBraceArrayAccess sniff.} + * + * @since 7.0.0 + * @since 9.3.0 Now also detects dereferencing using curly braces. + */ +class NewFunctionArrayDereferencingSniff extends Sniff +{ + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.0 + * + * @return array + */ + public function register() + { + return array(\T_STRING); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('5.6') === false) { + return; + } + + $dereferencing = $this->isFunctionArrayDereferencing($phpcsFile, $stackPtr); + if (empty($dereferencing)) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $supports53 = $this->supportsBelow('5.3'); + + foreach ($dereferencing as $openBrace => $closeBrace) { + if ($supports53 === true + && $tokens[$openBrace]['type'] === 'T_OPEN_SQUARE_BRACKET' + ) { + $phpcsFile->addError( + 'Function array dereferencing is not present in PHP version 5.3 or earlier', + $openBrace, + 'Found' + ); + + continue; + } + + // PHP 7.0 function array dereferencing using curly braces. + if ($tokens[$openBrace]['type'] === 'T_OPEN_CURLY_BRACKET') { + $phpcsFile->addError( + 'Function array dereferencing using curly braces is not present in PHP version 5.6 or earlier', + $openBrace, + 'FoundUsingCurlies' + ); + } + } + } + + + /** + * Check if the return of a function/method call is being dereferenced. + * + * @since 9.3.0 Logic split off from the process method. + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return array Array containing stack pointers to the open/close braces + * involved in the function dereferencing; + * or an empty array if no function dereferencing was detected. + */ + public function isFunctionArrayDereferencing(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + // Next non-empty token should be the open parenthesis. + $openParenthesis = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true, null, true); + if ($openParenthesis === false || $tokens[$openParenthesis]['code'] !== \T_OPEN_PARENTHESIS) { + return array(); + } + + // Don't throw errors during live coding. + if (isset($tokens[$openParenthesis]['parenthesis_closer']) === false) { + return array(); + } + + // Is this T_STRING really a function or method call ? + $prevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); + if ($prevToken !== false + && \in_array($tokens[$prevToken]['code'], array(\T_DOUBLE_COLON, \T_OBJECT_OPERATOR), true) === false + ) { + if ($tokens[$prevToken]['code'] === \T_BITWISE_AND) { + // This may be a function declared by reference. + $prevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($prevToken - 1), null, true); + } + + $ignore = array( + \T_FUNCTION => true, + \T_CONST => true, + \T_USE => true, + \T_NEW => true, + \T_CLASS => true, + \T_INTERFACE => true, + ); + + if (isset($ignore[$tokens[$prevToken]['code']]) === true) { + // Not a call to a PHP function or method. + return array(); + } + } + + $current = $tokens[$openParenthesis]['parenthesis_closer']; + $braces = array(); + + do { + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($current + 1), null, true, null, true); + if ($nextNonEmpty === false) { + break; + } + + if ($tokens[$nextNonEmpty]['type'] === 'T_OPEN_SQUARE_BRACKET' + || $tokens[$nextNonEmpty]['type'] === 'T_OPEN_CURLY_BRACKET' // PHP 7.0+. + ) { + if (isset($tokens[$nextNonEmpty]['bracket_closer']) === false) { + // Live coding or parse error. + break; + } + + $braces[$nextNonEmpty] = $tokens[$nextNonEmpty]['bracket_closer']; + + // Continue, just in case there is nested array access, i.e. `echo $foo->bar()[0][2];`. + $current = $tokens[$nextNonEmpty]['bracket_closer']; + continue; + } + + // If we're still here, we've reached the end of the function call. + break; + + } while (true); + + return $braces; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewFunctionCallTrailingCommaSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewFunctionCallTrailingCommaSniff.php new file mode 100644 index 00000000..39208b35 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewFunctionCallTrailingCommaSniff.php @@ -0,0 +1,120 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Syntax; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect trailing comma's in function calls, `isset()` and `unset()` as allowed since PHP 7.3. + * + * PHP version 7.3 + * + * @link https://www.php.net/manual/en/migration73.new-features.php#migration73.new-features.core.trailing-commas + * @link https://wiki.php.net/rfc/trailing-comma-function-calls + * + * @since 8.2.0 + * @since 9.0.0 Renamed from `NewTrailingCommaSniff` to `NewFunctionCallTrailingCommaSniff`. + */ +class NewFunctionCallTrailingCommaSniff extends Sniff +{ + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 8.2.0 + * + * @return array + */ + public function register() + { + return array( + \T_STRING, + \T_VARIABLE, + \T_ISSET, + \T_UNSET, + ); + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('7.2') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($tokens[$nextNonEmpty]['code'] !== \T_OPEN_PARENTHESIS + || isset($tokens[$nextNonEmpty]['parenthesis_closer']) === false + ) { + return; + } + + if ($tokens[$stackPtr]['code'] === \T_STRING) { + $ignore = array( + \T_FUNCTION => true, + \T_CONST => true, + \T_USE => true, + ); + + $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); + if (isset($ignore[$tokens[$prevNonEmpty]['code']]) === true) { + // Not a function call. + return; + } + } + + $closer = $tokens[$nextNonEmpty]['parenthesis_closer']; + $lastInParenthesis = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($closer - 1), $nextNonEmpty, true); + + if ($tokens[$lastInParenthesis]['code'] !== \T_COMMA) { + return; + } + + $data = array(); + switch ($tokens[$stackPtr]['code']) { + case \T_ISSET: + $data[] = 'calls to isset()'; + $errorCode = 'FoundInIsset'; + break; + + case \T_UNSET: + $data[] = 'calls to unset()'; + $errorCode = 'FoundInUnset'; + break; + + default: + $data[] = 'function calls'; + $errorCode = 'FoundInFunctionCall'; + break; + } + + $phpcsFile->addError( + 'Trailing comma\'s are not allowed in %s in PHP 7.2 or earlier', + $lastInParenthesis, + $errorCode, + $data + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewShortArraySniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewShortArraySniff.php new file mode 100644 index 00000000..c60ba5c3 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewShortArraySniff.php @@ -0,0 +1,77 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Syntax; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect use of short array syntax which is available since PHP 5.4. + * + * PHP version 5.4 + * + * @link https://wiki.php.net/rfc/shortsyntaxforarrays + * @link https://www.php.net/manual/en/language.types.array.php#language.types.array.syntax + * + * @since 7.0.0 + * @since 9.0.0 Renamed from `ShortArraySniff` to `NewShortArraySniff`. + */ +class NewShortArraySniff extends Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.0 + * + * @return array + */ + public function register() + { + return array( + \T_OPEN_SHORT_ARRAY, + \T_CLOSE_SHORT_ARRAY, + ); + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('5.3') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $token = $tokens[$stackPtr]; + + $error = '%s is not supported in PHP 5.3 or lower'; + $data = array(); + + if ($token['type'] === 'T_OPEN_SHORT_ARRAY') { + $data[] = 'Short array syntax (open)'; + } elseif ($token['type'] === 'T_CLOSE_SHORT_ARRAY') { + $data[] = 'Short array syntax (close)'; + } + + $phpcsFile->addError($error, $stackPtr, 'Found', $data); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/RemovedCurlyBraceArrayAccessSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/RemovedCurlyBraceArrayAccessSniff.php new file mode 100644 index 00000000..b2c29e5f --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/RemovedCurlyBraceArrayAccessSniff.php @@ -0,0 +1,362 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Syntax; + +use PHPCompatibility\Sniff; +use PHPCompatibility\Sniffs\Syntax\NewArrayStringDereferencingSniff; +use PHPCompatibility\Sniffs\Syntax\NewClassMemberAccessSniff; +use PHPCompatibility\Sniffs\Syntax\NewFunctionArrayDereferencingSniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Using the curly brace syntax to access array or string offsets has been deprecated in PHP 7.4. + * + * PHP version 7.4 + * + * @link https://www.php.net/manual/en/migration74.deprecated.php#migration74.deprecated.core.array-string-access-curly-brace + * @link https://wiki.php.net/rfc/deprecate_curly_braces_array_access + * + * @since 9.3.0 + */ +class RemovedCurlyBraceArrayAccessSniff extends Sniff +{ + + /** + * Instance of the NewArrayStringDereferencing sniff. + * + * @since 9.3.0 + * + * @var \PHPCompatibility\Sniffs\Syntax\NewArrayStringDereferencingSniff + */ + private $newArrayStringDereferencing; + + /** + * Target tokens as register by the NewArrayStringDereferencing sniff. + * + * @since 9.3.0 + * + * @var array + */ + private $newArrayStringDereferencingTargets; + + /** + * Instance of the NewClassMemberAccess sniff. + * + * @since 9.3.0 + * + * @var \PHPCompatibility\Sniffs\Syntax\NewClassMemberAccessSniff + */ + private $newClassMemberAccess; + + /** + * Target tokens as register by the NewClassMemberAccess sniff. + * + * @since 9.3.0 + * + * @var array + */ + private $newClassMemberAccessTargets; + + /** + * Instance of the NewFunctionArrayDereferencing sniff. + * + * @since 9.3.0 + * + * @var \PHPCompatibility\Sniffs\Syntax\NewFunctionArrayDereferencingSniff + */ + private $newFunctionArrayDereferencing; + + /** + * Target tokens as register by the NewFunctionArrayDereferencing sniff. + * + * @since 9.3.0 + * + * @var array + */ + private $newFunctionArrayDereferencingTargets; + + + /** + * Constructor. + * + * @since 9.3.0 + */ + public function __construct() + { + $this->newArrayStringDereferencing = new NewArrayStringDereferencingSniff(); + $this->newClassMemberAccess = new NewClassMemberAccessSniff(); + $this->newFunctionArrayDereferencing = new NewFunctionArrayDereferencingSniff(); + } + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 9.3.0 + * + * @return array + */ + public function register() + { + $targets = array( + array( + \T_VARIABLE, + \T_STRING, // Constants. + ), + ); + + // Registers T_ARRAY, T_OPEN_SHORT_ARRAY and T_CONSTANT_ENCAPSED_STRING. + $additionalTargets = $this->newArrayStringDereferencing->register(); + $this->newArrayStringDereferencingTargets = array_flip($additionalTargets); + $targets[] = $additionalTargets; + + // Registers T_NEW and T_CLONE. + $additionalTargets = $this->newClassMemberAccess->register(); + $this->newClassMemberAccessTargets = array_flip($additionalTargets); + $targets[] = $additionalTargets; + + // Registers T_STRING. + $additionalTargets = $this->newFunctionArrayDereferencing->register(); + $this->newFunctionArrayDereferencingTargets = array_flip($additionalTargets); + $targets[] = $additionalTargets; + + return call_user_func_array('array_merge', $targets); + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 9.3.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('7.4') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $braces = array(); + + // Note: Overwriting braces in each `if` is fine as only one will match anyway. + if ($tokens[$stackPtr]['code'] === \T_VARIABLE) { + $braces = $this->isVariableArrayAccess($phpcsFile, $stackPtr); + } + + if (isset($this->newArrayStringDereferencingTargets[$tokens[$stackPtr]['code']])) { + $dereferencing = $this->newArrayStringDereferencing->isArrayStringDereferencing($phpcsFile, $stackPtr); + if (isset($dereferencing['braces'])) { + $braces = $dereferencing['braces']; + } + } + + if (isset($this->newClassMemberAccessTargets[$tokens[$stackPtr]['code']])) { + $braces = $this->newClassMemberAccess->isClassMemberAccess($phpcsFile, $stackPtr); + } + + if (isset($this->newFunctionArrayDereferencingTargets[$tokens[$stackPtr]['code']])) { + $braces = $this->newFunctionArrayDereferencing->isFunctionArrayDereferencing($phpcsFile, $stackPtr); + } + + if (empty($braces) && $tokens[$stackPtr]['code'] === \T_STRING) { + $braces = $this->isConstantArrayAccess($phpcsFile, $stackPtr); + } + + if (empty($braces)) { + return; + } + + foreach ($braces as $open => $close) { + // Some of the functions will sniff for both curlies as well as square braces. + if ($tokens[$open]['code'] !== \T_OPEN_CURLY_BRACKET) { + continue; + } + + // Make sure there is something between the braces, otherwise it's still not curly brace array access. + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($open + 1), $close, true); + if ($nextNonEmpty === false) { + // Nothing between the brackets. Parse error. Ignore. + continue; + } + + // OK, so we've found curly brace array access. + $snippet = $phpcsFile->getTokensAsString($stackPtr, (($close - $stackPtr) + 1)); + $fix = $phpcsFile->addFixableWarning( + 'Curly brace syntax for accessing array elements and string offsets has been deprecated in PHP 7.4. Found: %s', + $open, + 'Found', + array($snippet) + ); + + if ($fix === true) { + $phpcsFile->fixer->beginChangeset(); + $phpcsFile->fixer->replaceToken($open, '['); + $phpcsFile->fixer->replaceToken($close, ']'); + $phpcsFile->fixer->endChangeset(); + } + } + } + + + /** + * Determine whether a variable is being dereferenced using curly brace syntax. + * + * @since 9.3.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return array An array with the stack pointers to the open/close braces of + * the curly brace array access, or an empty array if no curly + * brace array access was detected. + */ + protected function isVariableArrayAccess(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $current = $stackPtr; + $braces = array(); + + do { + $current = $phpcsFile->findNext(Tokens::$emptyTokens, ($current + 1), null, true); + if ($current === false) { + break; + } + + // Skip over square bracket array access. Bracket styles can be mixed. + if ($tokens[$current]['code'] === \T_OPEN_SQUARE_BRACKET + && isset($tokens[$current]['bracket_closer']) === true + && $current === $tokens[$current]['bracket_opener'] + ) { + $current = $tokens[$current]['bracket_closer']; + continue; + } + + // Handle property access. + if ($tokens[$current]['code'] === \T_OBJECT_OPERATOR) { + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($current + 1), null, true); + if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== \T_STRING) { + // Live coding or parse error. + break; + } + + $current = $nextNonEmpty; + continue; + } + + if ($tokens[$current]['code'] === \T_OPEN_CURLY_BRACKET) { + if (isset($tokens[$current]['bracket_closer']) === false) { + // Live coding or parse error. + break; + } + + $braces[$current] = $tokens[$current]['bracket_closer']; + + // Continue, just in case there is nested access using curly braces, i.e. `$a{$i}{$j};`. + $current = $tokens[$current]['bracket_closer']; + continue; + } + + // If we're still here, we've reached the end of the variable. + break; + + } while (true); + + return $braces; + } + + + /** + * Determine whether a T_STRING is a constant being dereferenced using curly brace syntax. + * + * {@internal Note: the first braces for array access to a constant, for some unknown reason, + * can never be curlies, but have to be square brackets. + * Subsequent braces can be curlies.} + * + * @since 9.3.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return array An array with the stack pointers to the open/close braces of + * the curly brace array access, or an empty array if no curly + * brace array access was detected. + */ + protected function isConstantArrayAccess(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); + + if ($this->isUseOfGlobalConstant($phpcsFile, $stackPtr) === false + && $tokens[$prevNonEmpty]['code'] !== \T_DOUBLE_COLON // Class constant access. + ) { + return array(); + } + + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($nextNonEmpty === false) { + return array(); + } + + if ($tokens[$nextNonEmpty]['code'] !== \T_OPEN_SQUARE_BRACKET + || isset($tokens[$nextNonEmpty]['bracket_closer']) === false + ) { + // Array access for constants must start with square brackets. + return array(); + } + + $current = $tokens[$nextNonEmpty]['bracket_closer']; + $braces = array(); + + do { + $current = $phpcsFile->findNext(Tokens::$emptyTokens, ($current + 1), null, true); + if ($current === false) { + break; + } + + // Skip over square bracket array access. Bracket styles can be mixed. + if ($tokens[$current]['code'] === \T_OPEN_SQUARE_BRACKET + && isset($tokens[$current]['bracket_closer']) === true + && $current === $tokens[$current]['bracket_opener'] + ) { + $current = $tokens[$current]['bracket_closer']; + continue; + } + + if ($tokens[$current]['code'] === \T_OPEN_CURLY_BRACKET) { + if (isset($tokens[$current]['bracket_closer']) === false) { + // Live coding or parse error. + break; + } + + $braces[$current] = $tokens[$current]['bracket_closer']; + + // Continue, just in case there is nested access using curly braces, i.e. `$a{$i}{$j};`. + $current = $tokens[$current]['bracket_closer']; + continue; + } + + // If we're still here, we've reached the end of the variable. + break; + + } while (true); + + return $braces; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/RemovedNewReferenceSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/RemovedNewReferenceSniff.php new file mode 100644 index 00000000..ad76828c --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/RemovedNewReferenceSniff.php @@ -0,0 +1,80 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Syntax; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect the use of assigning the return value of `new` by reference. + * + * This syntax has been deprecated since PHP 5.3 and removed in PHP 7.0. + * + * PHP version 5.3 + * PHP version 7.0 + * + * @link https://wiki.php.net/rfc/remove_deprecated_functionality_in_php7 + * + * @since 5.5 + * @since 9.0.0 Renamed from `DeprecatedNewReferenceSniff` to `RemovedNewReferenceSniff`. + */ +class RemovedNewReferenceSniff extends Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 5.5 + * + * @return array + */ + public function register() + { + return array(\T_NEW); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 5.5 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('5.3') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); + if ($prevNonEmpty === false || $tokens[$prevNonEmpty]['type'] !== 'T_BITWISE_AND') { + return; + } + + $error = 'Assigning the return value of new by reference is deprecated in PHP 5.3'; + $isError = false; + $errorCode = 'Deprecated'; + + if ($this->supportsAbove('7.0') === true) { + $error .= ' and has been removed in PHP 7.0'; + $isError = true; + $errorCode = 'Removed'; + } + + $this->addMessage($phpcsFile, $error, $stackPtr, $isError, $errorCode); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/TextStrings/NewUnicodeEscapeSequenceSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/TextStrings/NewUnicodeEscapeSequenceSniff.php new file mode 100644 index 00000000..aa5a39a3 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/TextStrings/NewUnicodeEscapeSequenceSniff.php @@ -0,0 +1,162 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\TextStrings; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_Exception as PHPCS_Exception; +use PHP_CodeSniffer_File as File; + +/** + * PHP 7.0 introduced a Unicode codepoint escape sequence. + * + * Strings containing a literal `\u{` followed by an invalid sequence will cause a + * fatal error as of PHP 7.0. + * + * PHP version 7.0 + * + * @link https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.unicode-codepoint-escape-syntax + * @link https://www.php.net/manual/en/migration70.incompatible.php#migration70.incompatible.strings.unicode-escapes + * @link https://wiki.php.net/rfc/unicode_escape + * @link https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.double + * + * @since 9.3.0 + */ +class NewUnicodeEscapeSequenceSniff extends Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 9.3.0 + * + * @return array + */ + public function register() + { + return array( + \T_CONSTANT_ENCAPSED_STRING, + \T_DOUBLE_QUOTED_STRING, + \T_HEREDOC, + ); + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 9.3.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + // Check whether this is a single quoted or double quoted string. + if ($tokens[$stackPtr]['code'] === \T_CONSTANT_ENCAPSED_STRING) { + + // Find the start of the - potentially multi-line - text string. + $start = $stackPtr; + for ($i = ($stackPtr - 1); $i >= 0; $i--) { + if ($tokens[$i]['code'] === \T_WHITESPACE) { + continue; + } + + if ($tokens[$i]['code'] === \T_CONSTANT_ENCAPSED_STRING) { + $start = $i; + continue; + } + + break; + } + + try { + $textString = $this->getCompleteTextString($phpcsFile, $start, false); + } catch (PHPCS_Exception $e) { + // Something went wrong determining the start of the text string. + return; + } + + $startQuote = $textString[0]; + $endQuote = substr($textString, -1); + if (($startQuote === "'" && $endQuote === "'") + || $startQuote !== $endQuote + ) { + // Single quoted string, not our concern. + return; + } + } + + $content = $this->stripQuotes($tokens[$stackPtr]['content']); + $count = preg_match_all('`(?<!\\\\)\\\\u\{([^}\n\r]*)(\})?`', $content, $matches, \PREG_SET_ORDER); + if ($count === false || $count === 0) { + return; + } + + foreach ($matches as $match) { + $valid = false; // If the close curly is missing, we have an incomplete escape sequence. + if (isset($match[2])) { + $valid = $this->isValidUnicodeEscapeSequence($match[1]); + } + + if ($this->supportsBelow('5.6') === true && $valid === true) { + $phpcsFile->addError( + 'Unicode codepoint escape sequences are not supported in PHP 5.6 or earlier. Found: %s', + $stackPtr, + 'Found', + array($match[0]) + ); + } + + if ($this->supportsAbove('7.0') === true && $valid === false) { + $phpcsFile->addError( + 'Strings containing a literal \u{ followed by an invalid unicode codepoint escape sequence will cause a fatal error in PHP 7.0 and above. Escape the leading backslash to prevent this. Found: %s', + $stackPtr, + 'Invalid', + array($match[0]) + ); + } + } + } + + + /** + * Verify if the codepoint in a unicode escape sequence is valid. + * + * @since 9.3.0 + * + * @param string $codepoint The codepoint as a string. + * + * @return bool + */ + protected function isValidUnicodeEscapeSequence($codepoint) + { + if (trim($codepoint) === '') { + return false; + } + + // Check if it's a valid hex codepoint. + if (preg_match('`^[0-9A-F]+$`iD', $codepoint, $match) !== 1) { + return false; + } + + if (hexdec($codepoint) > 1114111) { + // Outside of the maximum permissable range. + return false; + } + + return true; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/TypeCasts/NewTypeCastsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/TypeCasts/NewTypeCastsSniff.php new file mode 100644 index 00000000..12e47318 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/TypeCasts/NewTypeCastsSniff.php @@ -0,0 +1,222 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\TypeCasts; + +use PHPCompatibility\AbstractNewFeatureSniff; +use PHPCompatibility\PHPCSHelper; +use PHP_CodeSniffer_File as File; + +/** + * Detect use of newly introduced type casts. + * + * PHP version All + * + * @link https://www.php.net/manual/en/language.types.type-juggling.php#language.types.typecasting + * + * @since 8.0.1 + */ +class NewTypeCastsSniff extends AbstractNewFeatureSniff +{ + + /** + * A list of new type casts, not present in older versions. + * + * The array lists : version number with false (not present) or true (present). + * If's sufficient to list the first version where the keyword appears. + * + * @since 8.0.1 + * + * @var array(string => array(string => bool|string)) + */ + protected $newTypeCasts = array( + 'T_UNSET_CAST' => array( + '4.4' => false, + '5.0' => true, + 'description' => 'The unset cast', + ), + 'T_BINARY_CAST' => array( + '5.2.0' => false, + '5.2.1' => true, + 'description' => 'The binary cast', + ), + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 8.0.1 + * + * @return array + */ + public function register() + { + $tokens = array(); + foreach ($this->newTypeCasts as $token => $versions) { + if (\defined($token)) { + $tokens[] = constant($token); + } + } + + /* + * Work around tokenizer issues. + * + * - (binary) cast is incorrectly tokenized as T_STRING_CAST by PHP and PHPCS. + * - b"something" binary cast is incorrectly tokenized as T_CONSTANT_ENCAPSED_STRING by PHP and PHPCS. + * - Since PHPCS 3.4.0, PHPCS *will* tokenize these correctly. + * + * @link https://github.com/squizlabs/PHP_CodeSniffer/issues/1574 + */ + if (version_compare(PHPCSHelper::getVersion(), '3.4.0', '<') === true) { + $tokens[] = \T_STRING_CAST; + $tokens[] = \T_CONSTANT_ENCAPSED_STRING; + } + + return $tokens; + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 8.0.1 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $tokenType = $tokens[$stackPtr]['type']; + + // Detect incorrectly tokenized binary casts. + if (isset($this->newTypeCasts[$tokenType]) === false) { + $tokenContent = $tokens[$stackPtr]['content']; + switch ($tokenType) { + case 'T_STRING_CAST': + if (preg_match('`^\(\s*binary\s*\)$`i', $tokenContent) !== 1) { + return; + } + + $tokenType = 'T_BINARY_CAST'; + break; + + case 'T_CONSTANT_ENCAPSED_STRING': + if ((strpos($tokenContent, 'b"') === 0 && substr($tokenContent, -1) === '"') + || (strpos($tokenContent, "b'") === 0 && substr($tokenContent, -1) === "'") + ) { + $tokenType = 'T_BINARY_CAST'; + } else { + return; + } + break; + + } + } + + // If the translation did not yield one of the tokens we are looking for, bow out. + if (isset($this->newTypeCasts[$tokenType]) === false) { + return; + } + + $itemInfo = array( + 'name' => $tokenType, + 'content' => $tokens[$stackPtr]['content'], + ); + $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); + } + + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 8.0.1 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo) + { + return $this->newTypeCasts[$itemInfo['name']]; + } + + + /** + * Get an array of the non-PHP-version array keys used in a sub-array. + * + * @since 8.0.1 + * + * @return array + */ + protected function getNonVersionArrayKeys() + { + return array('description'); + } + + + /** + * Retrieve the relevant detail (version) information for use in an error message. + * + * @since 8.0.1 + * + * @param array $itemArray Version and other information about the item. + * @param array $itemInfo Base information about the item. + * + * @return array + */ + public function getErrorInfo(array $itemArray, array $itemInfo) + { + $errorInfo = parent::getErrorInfo($itemArray, $itemInfo); + $errorInfo['description'] = $itemArray['description']; + + return $errorInfo; + } + + + /** + * Filter the error message before it's passed to PHPCS. + * + * @since 8.0.1 + * + * @param string $error The error message which was created. + * @param array $itemInfo Base information about the item this error message applies to. + * @param array $errorInfo Detail information about an item this error message applies to. + * + * @return string + */ + protected function filterErrorMsg($error, array $itemInfo, array $errorInfo) + { + return $error . '. Found: %s'; + } + + + /** + * Filter the error data before it's passed to PHPCS. + * + * @since 8.0.1 + * + * @param array $data The error data array which was created. + * @param array $itemInfo Base information about the item this error message applies to. + * @param array $errorInfo Detail information about an item this error message applies to. + * + * @return array + */ + protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) + { + $data[0] = $errorInfo['description']; + $data[] = $itemInfo['content']; + return $data; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/TypeCasts/RemovedTypeCastsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/TypeCasts/RemovedTypeCastsSniff.php new file mode 100644 index 00000000..3791f0b5 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/TypeCasts/RemovedTypeCastsSniff.php @@ -0,0 +1,158 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\TypeCasts; + +use PHPCompatibility\AbstractRemovedFeatureSniff; +use PHP_CodeSniffer_File as File; + +/** + * Detect use of deprecated/removed type casts. + * + * PHP version All + * + * @link https://www.php.net/manual/en/language.types.type-juggling.php#language.types.typecasting + * @link https://wiki.php.net/rfc/deprecations_php_7_2#unset_cast + * @link https://wiki.php.net/rfc/deprecations_php_7_4#the_real_type + * + * @since 8.0.1 + * @since 9.0.0 Renamed from `DeprecatedTypeCastsSniff` to `RemovedTypeCastsSniff`. + */ +class RemovedTypeCastsSniff extends AbstractRemovedFeatureSniff +{ + /** + * A list of deprecated and removed type casts with their alternatives. + * + * The array lists : version number with false (deprecated) or true (removed) and an alternative function. + * If no alternative exists, it is NULL, i.e, the function should just not be used. + * + * @since 8.0.1 + * + * @var array(string => array(string => bool|string)) + */ + protected $deprecatedTypeCasts = array( + 'T_UNSET_CAST' => array( + '7.2' => false, + 'alternative' => 'unset()', + 'description' => 'unset', + ), + 'T_DOUBLE_CAST' => array( + '7.4' => false, + 'alternative' => '(float)', + 'description' => 'real', + ), + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 8.0.1 + * + * @return array + */ + public function register() + { + $tokens = array(); + foreach ($this->deprecatedTypeCasts as $token => $versions) { + $tokens[] = constant($token); + } + + return $tokens; + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 8.0.1 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $tokenType = $tokens[$stackPtr]['type']; + + // Special case `T_DOUBLE_CAST` as the same token is used for (float) and (double) casts. + if ($tokenType === 'T_DOUBLE_CAST' && strpos($tokens[$stackPtr]['content'], 'real') === false) { + // Float/double casts, not (real) cast. + return; + } + + $itemInfo = array( + 'name' => $tokenType, + 'description' => $this->deprecatedTypeCasts[$tokenType]['description'], + ); + $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); + } + + + /** + * Get an array of the non-PHP-version array keys used in a sub-array. + * + * @since 8.0.1 + * + * @return array + */ + protected function getNonVersionArrayKeys() + { + return array('description', 'alternative'); + } + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 8.0.1 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo) + { + return $this->deprecatedTypeCasts[$itemInfo['name']]; + } + + + /** + * Get the error message template for this sniff. + * + * @since 8.0.1 + * + * @return string + */ + protected function getErrorMsgTemplate() + { + return 'The %s cast is '; + } + + + /** + * Filter the error data before it's passed to PHPCS. + * + * @since 8.0.1 + * + * @param array $data The error data array which was created. + * @param array $itemInfo Base information about the item this error message applies to. + * @param array $errorInfo Detail information about an item this error message applies to. + * + * @return array + */ + protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) + { + $data[0] = $itemInfo['description']; + return $data; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Upgrade/LowPHPCSSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Upgrade/LowPHPCSSniff.php new file mode 100644 index 00000000..1e79873c --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Upgrade/LowPHPCSSniff.php @@ -0,0 +1,187 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Upgrade; + +use PHPCompatibility\Sniff; +use PHPCompatibility\PHPCSHelper; +use PHP_CodeSniffer_File as File; + +/** + * Add a notification for users of low PHPCS versions. + * + * Originally PHPCompatibility supported PHPCS 1.5.x, 2.x and since PHPCompatibility 8.0.0, 3.x. + * Support for PHPCS < 2.3.0 has been dropped in PHPCompatibility 9.0.0. + * + * The standard will - up to a point - still work for users of lower + * PHPCS versions, but will give less accurate results and may throw + * notices and warnings (or even fatal out). + * + * This sniff adds an explicit error/warning for users of the standard + * using a PHPCS version below the recommended version. + * + * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/688 + * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/835 + * + * @since 8.2.0 + */ +class LowPHPCSSniff extends Sniff +{ + /** + * The minimum supported PHPCS version. + * + * Users on PHPCS versions below this will see an ERROR message. + * + * @since 8.2.0 + * @since 9.3.0 Changed from $minSupportedVersion property to a constant. + * + * @var string + */ + const MIN_SUPPORTED_VERSION = '2.3.0'; + + /** + * The minimum recommended PHPCS version. + * + * Users on PHPCS versions below this will see a WARNING. + * + * @since 8.2.0 + * @since 9.3.0 Changed from $minRecommendedVersion property to a constant. + * + * @var string + */ + const MIN_RECOMMENDED_VERSION = '2.6.0'; + + /** + * Keep track of whether this sniff needs to actually run. + * + * This will be set to `false` when either a high enough PHPCS + * version is detected or once the error/warning has been thrown, + * to make sure that the notice will only be thrown once per run. + * + * @since 8.2.0 + * + * @var bool + */ + private $examine = true; + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 8.2.0 + * + * @return array + */ + public function register() + { + return array( + \T_OPEN_TAG, + ); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 8.2.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function process(File $phpcsFile, $stackPtr) + { + // Don't do anything if the warning has already been thrown or is not necessary. + if ($this->examine === false) { + return ($phpcsFile->numTokens + 1); + } + + $phpcsVersion = PHPCSHelper::getVersion(); + + // Don't do anything if the PHPCS version used is above the minimum recommended version. + if (version_compare($phpcsVersion, self::MIN_RECOMMENDED_VERSION, '>=')) { + $this->examine = false; + return ($phpcsFile->numTokens + 1); + } + + if (version_compare($phpcsVersion, self::MIN_SUPPORTED_VERSION, '<')) { + $isError = true; + $message = 'IMPORTANT: Please be advised that the minimum PHP_CodeSniffer version the PHPCompatibility standard supports is %s. You are currently using PHP_CodeSniffer %s. Please upgrade your PHP_CodeSniffer installation. The recommended version of PHP_CodeSniffer for PHPCompatibility is %s or higher.'; + $errorCode = 'Unsupported_' . $this->stringToErrorCode(self::MIN_SUPPORTED_VERSION); + $replacements = array( + self::MIN_SUPPORTED_VERSION, + $phpcsVersion, + self::MIN_RECOMMENDED_VERSION, + $errorCode, + ); + } else { + $isError = false; + $message = 'IMPORTANT: Please be advised that for the most reliable PHPCompatibility results, PHP_CodeSniffer %s or higher should be used. Support for lower versions will be dropped in the foreseeable future. You are currently using PHP_CodeSniffer %s. Please upgrade your PHP_CodeSniffer installation to version %s or higher.'; + $errorCode = 'BelowRecommended_' . $this->stringToErrorCode(self::MIN_RECOMMENDED_VERSION); + $replacements = array( + self::MIN_RECOMMENDED_VERSION, + $phpcsVersion, + self::MIN_RECOMMENDED_VERSION, + $errorCode, + ); + } + + /* + * Figure out the report width to determine how long the delimiter lines should be. + * + * This is not an exact calculation as there are a number of unknowns at the time the + * notice is thrown (whether there are other notices for the file, whether those are + * warnings or errors, whether there are auto-fixable issues etc). + * + * In other words, this is just an approximation to get a reasonably stable and + * readable message layout format. + * + * {@internal + * PHPCS has had some changes as to how the messages display over the years. + * Most significantly in 2.4.0 it was attempted to solve an issue with messages + * containing new lines. Unfortunately, that solution is buggy. + * An improved version has been pulled upstream and will hopefully make it + * into PHPCS 3.3.1/3.4.0. + * + * Anyway, this means that instead of new lines, delimiter lines will be used to improved + * the readability of the (long) message. + * + * Also, as of PHPCS 2.2.0, the report width when using the `-s` option is 8 wider than + * it should be. A patch for that is included in the same upstream PR. + * + * If/when the upstream PR has been merged and the minimum supported/recommended version + * of PHPCompatibility would go beyond that, the below code should be adjusted.} + */ + $reportWidth = PHPCSHelper::getCommandLineData($phpcsFile, 'reportWidth'); + if (empty($reportWidth)) { + $reportWidth = 80; + } + $showSources = PHPCSHelper::getCommandLineData($phpcsFile, 'showSources'); + if ($showSources === true) { + $reportWidth += 6; + } + + $messageWidth = ($reportWidth - 15); // 15 is length of " # | WARNING | ". + $delimiterLine = str_repeat('-', ($messageWidth)); + $disableNotice = 'To disable this notice, add --exclude=PHPCompatibility.Upgrade.LowPHPCS to your command or add <exclude name="PHPCompatibility.Upgrade.LowPHPCS.%s"/> to your custom ruleset. '; + $thankYou = 'Thank you for using PHPCompatibility!'; + + $message .= ' ' . $delimiterLine; + $message .= ' ' . $disableNotice; + $message .= ' ' . $delimiterLine; + $message .= ' ' . $thankYou; + + $this->addMessage($phpcsFile, $message, 0, $isError, $errorCode, $replacements); + + $this->examine = false; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Upgrade/LowPHPSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Upgrade/LowPHPSniff.php new file mode 100644 index 00000000..7a171633 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Upgrade/LowPHPSniff.php @@ -0,0 +1,182 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Upgrade; + +use PHPCompatibility\Sniff; +use PHPCompatibility\PHPCSHelper; +use PHP_CodeSniffer_File as File; + +/** + * Add a notification for users of low PHP versions. + * + * Originally PHPCompatibility supported PHP 5.1 and higher. + * As of PHPCompatibility 8.0.0, support for PHP < 5.3 has been dropped. + * + * The intention is to drop support for PHP 5.3 in the (near) future. + * + * This sniff adds an explicit error/warning for users of the standard + * using a PHP version below the recommended version. + * + * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/835 + * + * @since 9.3.0 + */ +class LowPHPSniff extends Sniff +{ + /** + * The minimum supported PHP version. + * + * Users on PHP versions below this will see an ERROR message. + * + * @since 9.3.0 + * + * @var string + */ + const MIN_SUPPORTED_VERSION = '5.3'; + + /** + * The minimum recommended PHP version. + * + * Users on PHP versions below this will see a WARNING. + * + * @since 9.3.0 + * + * @var string + */ + const MIN_RECOMMENDED_VERSION = '5.4'; + + /** + * Keep track of whether this sniff needs to actually run. + * + * This will be set to `false` when either a high enough PHP + * version is detected or once the error/warning has been thrown, + * to make sure that the notice will only be thrown once per run. + * + * @since 9.3.0 + * + * @var bool + */ + private $examine = true; + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 9.3.0 + * + * @return array + */ + public function register() + { + return array( + \T_OPEN_TAG, + ); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 9.3.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function process(File $phpcsFile, $stackPtr) + { + // Don't do anything if the warning has already been thrown or is not necessary. + if ($this->examine === false) { + return ($phpcsFile->numTokens + 1); + } + + $phpVersion = phpversion(); + + // Don't do anything if the PHPCS version used is above the minimum recommended version. + if (version_compare($phpVersion, self::MIN_RECOMMENDED_VERSION, '>=')) { + $this->examine = false; + return ($phpcsFile->numTokens + 1); + } + + if (version_compare($phpVersion, self::MIN_SUPPORTED_VERSION, '<')) { + $isError = true; + $message = 'IMPORTANT: Please be advised that the minimum PHP version the PHPCompatibility standard supports is %s. You are currently using PHP %s. Please upgrade your PHP installation. The recommended version of PHP for PHPCompatibility is %s or higher.'; + $errorCode = 'Unsupported_' . $this->stringToErrorCode(self::MIN_SUPPORTED_VERSION); + $replacements = array( + self::MIN_SUPPORTED_VERSION, + $phpVersion, + self::MIN_RECOMMENDED_VERSION, + $errorCode, + ); + } else { + $isError = false; + $message = 'IMPORTANT: Please be advised that for the most reliable PHPCompatibility results, PHP %s or higher should be used. Support for lower versions will be dropped in the foreseeable future. You are currently using PHP %s. Please upgrade your PHP installation to version %s or higher.'; + $errorCode = 'BelowRecommended_' . $this->stringToErrorCode(self::MIN_RECOMMENDED_VERSION); + $replacements = array( + self::MIN_RECOMMENDED_VERSION, + $phpVersion, + self::MIN_RECOMMENDED_VERSION, + $errorCode, + ); + } + + /* + * Figure out the report width to determine how long the delimiter lines should be. + * + * This is not an exact calculation as there are a number of unknowns at the time the + * notice is thrown (whether there are other notices for the file, whether those are + * warnings or errors, whether there are auto-fixable issues etc). + * + * In other words, this is just an approximation to get a reasonably stable and + * readable message layout format. + * + * {@internal + * PHPCS has had some changes as to how the messages display over the years. + * Most significantly in 2.4.0 it was attempted to solve an issue with messages + * containing new lines. Unfortunately, that solution is buggy. + * An improved version has been pulled upstream and will hopefully make it + * into PHPCS 3.3.1/3.4.0. + * + * Anyway, this means that instead of new lines, delimiter lines will be used to improved + * the readability of the (long) message. + * + * Also, as of PHPCS 2.2.0, the report width when using the `-s` option is 8 wider than + * it should be. A patch for that is included in the same upstream PR. + * + * If/when the upstream PR has been merged and the minimum supported/recommended version + * of PHPCompatibility would go beyond that, the below code should be adjusted.} + */ + $reportWidth = PHPCSHelper::getCommandLineData($phpcsFile, 'reportWidth'); + if (empty($reportWidth)) { + $reportWidth = 80; + } + $showSources = PHPCSHelper::getCommandLineData($phpcsFile, 'showSources'); + if ($showSources === true) { + $reportWidth += 6; + } + + $messageWidth = ($reportWidth - 15); // 15 is length of " # | WARNING | ". + $delimiterLine = str_repeat('-', ($messageWidth)); + $disableNotice = 'To disable this notice, add --exclude=PHPCompatibility.Upgrade.LowPHP to your command or add <exclude name="PHPCompatibility.Upgrade.LowPHP.%s"/> to your custom ruleset. '; + $thankYou = 'Thank you for using PHPCompatibility!'; + + $message .= ' ' . $delimiterLine; + $message .= ' ' . $disableNotice; + $message .= ' ' . $delimiterLine; + $message .= ' ' . $thankYou; + + $this->addMessage($phpcsFile, $message, 0, $isError, $errorCode, $replacements); + + $this->examine = false; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/UseDeclarations/NewGroupUseDeclarationsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/UseDeclarations/NewGroupUseDeclarationsSniff.php new file mode 100644 index 00000000..a681a4a3 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/UseDeclarations/NewGroupUseDeclarationsSniff.php @@ -0,0 +1,118 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\UseDeclarations; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect group use declarations as introduced in PHP 7.0. + * + * Checks for: + * - Group use statements as introduced in PHP 7.0. + * - Trailing comma's in group use statements as allowed since PHP 7.2. + * + * PHP version 7.0 + * PHP version 7.2 + * + * @link https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.group-use-declarations + * @link https://www.php.net/manual/en/migration72.new-features.php#migration72.new-features.trailing-comma-in-grouped-namespaces + * @link https://wiki.php.net/rfc/group_use_declarations + * @link https://wiki.php.net/rfc/list-syntax-trailing-commas + * @link https://www.php.net/manual/en/language.namespaces.importing.php#language.namespaces.importing.group + * + * @since 7.0.0 + * @since 8.0.1 Now also checks for trailing comma's in group `use` declarations. + */ +class NewGroupUseDeclarationsSniff extends Sniff +{ + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.0 + * + * @return array + */ + public function register() + { + if (\defined('T_OPEN_USE_GROUP')) { + return array(\T_OPEN_USE_GROUP); + } else { + return array(\T_USE); + } + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('7.1') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $token = $tokens[$stackPtr]; + + // Deal with PHPCS pre-2.6.0. + if ($token['code'] === \T_USE) { + $hasCurlyBrace = $phpcsFile->findNext(\T_OPEN_CURLY_BRACKET, ($stackPtr + 1), null, false, null, true); + if ($hasCurlyBrace === false) { + return; + } + + $prevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($hasCurlyBrace - 1), null, true); + if ($prevToken === false || $tokens[$prevToken]['code'] !== \T_NS_SEPARATOR) { + return; + } + + $stackPtr = $hasCurlyBrace; + } + + // Still here ? In that case, it is a group use statement. + if ($this->supportsBelow('5.6') === true) { + $phpcsFile->addError( + 'Group use declarations are not allowed in PHP 5.6 or earlier', + $stackPtr, + 'Found' + ); + } + + $closers = array(\T_CLOSE_CURLY_BRACKET); + if (\defined('T_CLOSE_USE_GROUP')) { + $closers[] = \T_CLOSE_USE_GROUP; + } + + $closeCurly = $phpcsFile->findNext($closers, ($stackPtr + 1), null, false, null, true); + if ($closeCurly === false) { + return; + } + + $prevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($closeCurly - 1), null, true); + if ($tokens[$prevToken]['code'] === \T_COMMA) { + $phpcsFile->addError( + 'Trailing comma\'s are not allowed in group use statements in PHP 7.1 or earlier', + $prevToken, + 'TrailingCommaFound' + ); + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/UseDeclarations/NewUseConstFunctionSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/UseDeclarations/NewUseConstFunctionSniff.php new file mode 100644 index 00000000..2d166fb5 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/UseDeclarations/NewUseConstFunctionSniff.php @@ -0,0 +1,109 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\UseDeclarations; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect importing constants and functions via a `use` statement. + * + * The `use` operator has been extended to support importing functions and + * constants in addition to classes. This is achieved via the `use function` + * and `use const` constructs, respectively. + * + * PHP version 5.6 + * + * @link https://www.php.net/manual/en/migration56.new-features.php#migration56.new-features.use + * @link https://wiki.php.net/rfc/use_function + * @link https://www.php.net/manual/en/language.namespaces.importing.php + * + * @since 7.1.4 + */ +class NewUseConstFunctionSniff extends Sniff +{ + + /** + * A list of keywords that can follow use statements. + * + * @since 7.1.4 + * + * @var array(string => string) + */ + protected $validUseNames = array( + 'const' => true, + 'function' => true, + ); + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.1.4 + * + * @return array + */ + public function register() + { + return array(\T_USE); + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.1.4 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsBelow('5.5') !== true) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($nextNonEmpty === false) { + // Live coding. + return; + } + + if (isset($this->validUseNames[strtolower($tokens[$nextNonEmpty]['content'])]) === false) { + // Not a `use const` or `use function` statement. + return; + } + + // `use const` and `use function` have to be followed by the function/constant name. + $functionOrConstName = $phpcsFile->findNext(Tokens::$emptyTokens, ($nextNonEmpty + 1), null, true); + if ($functionOrConstName === false + // Identifies as T_AS or T_STRING, this covers both. + || ($tokens[$functionOrConstName]['content'] === 'as' + || $tokens[$functionOrConstName]['code'] === \T_COMMA) + ) { + // Live coding or incorrect use of reserved keyword, but that is + // covered by the ForbiddenNames sniff. + return; + } + + // Still here ? In that case we have encountered a `use const` or `use function` statement. + $phpcsFile->addError( + 'Importing functions and constants through a "use" statement is not supported in PHP 5.5 or lower.', + $nextNonEmpty, + 'Found' + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Variables/ForbiddenGlobalVariableVariableSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Variables/ForbiddenGlobalVariableVariableSniff.php new file mode 100644 index 00000000..c7f715d2 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Variables/ForbiddenGlobalVariableVariableSniff.php @@ -0,0 +1,125 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Variables; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect use of `global` with variable variables, support for which has been removed in PHP 7.0. + * + * PHP version 7.0 + * + * @link https://wiki.php.net/rfc/uniform_variable_syntax#global_keyword_takes_only_simple_variables + * + * @since 7.0.0 + */ +class ForbiddenGlobalVariableVariableSniff extends Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.0.0 + * + * @return array + */ + public function register() + { + return array(\T_GLOBAL); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.0.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('7.0') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $endOfStatement = $phpcsFile->findNext(array(\T_SEMICOLON, \T_CLOSE_TAG), ($stackPtr + 1)); + if ($endOfStatement === false) { + // No semi-colon - live coding. + return; + } + + for ($ptr = ($stackPtr + 1); $ptr <= $endOfStatement; $ptr++) { + $errorThrown = false; + $nextComma = $phpcsFile->findNext(\T_COMMA, $ptr, $endOfStatement, false, null, true); + $varEnd = ($nextComma === false) ? $endOfStatement : $nextComma; + $variable = $phpcsFile->findNext(\T_VARIABLE, $ptr, $varEnd); + $varString = trim($phpcsFile->getTokensAsString($ptr, ($varEnd - $ptr))); + $data = array($varString); + + if ($variable !== false) { + + $prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($variable - 1), $ptr, true); + + if ($prev !== false && $tokens[$prev]['type'] === 'T_DOLLAR') { + + $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($variable + 1), $varEnd, true); + + if ($next !== false + && \in_array($tokens[$next]['code'], array(\T_OPEN_SQUARE_BRACKET, \T_OBJECT_OPERATOR, \T_DOUBLE_COLON), true) === true + ) { + $phpcsFile->addError( + 'Global with variable variables is not allowed since PHP 7.0. Found %s', + $variable, + 'Found', + $data + ); + $errorThrown = true; + } else { + $phpcsFile->addWarning( + 'Global with anything other than bare variables is discouraged since PHP 7.0. Found %s', + $variable, + 'NonBareVariableFound', + $data + ); + $errorThrown = true; + } + } + } + + if ($errorThrown === false) { + $dollar = $phpcsFile->findNext(\T_DOLLAR, $ptr, $varEnd); + if ($dollar !== false) { + $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($dollar + 1), $varEnd, true); + if ($tokens[$next]['code'] === \T_OPEN_CURLY_BRACKET) { + $phpcsFile->addWarning( + 'Global with anything other than bare variables is discouraged since PHP 7.0. Found %s', + $dollar, + 'NonBareVariableFound', + $data + ); + } + } + } + + // Move the stack pointer forward to the next variable for multi-variable statements. + if ($nextComma === false) { + break; + } + $ptr = $nextComma; + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Variables/ForbiddenThisUseContextsSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Variables/ForbiddenThisUseContextsSniff.php new file mode 100644 index 00000000..fc0ddc65 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Variables/ForbiddenThisUseContextsSniff.php @@ -0,0 +1,425 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Variables; + +use PHPCompatibility\Sniff; +use PHPCompatibility\PHPCSHelper; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect using `$this` in incompatible contexts. + * + * "Whilst `$this` is considered a special variable in PHP, it lacked proper checks + * to ensure it wasn't used as a variable name or reassigned. This has now been + * rectified to ensure that `$this` cannot be a user-defined variable, reassigned + * to a different value, or be globalised." + * + * This sniff only addresses those situations which did *not* throw an error prior + * to PHP 7.1, either at all or only in PHP 7.0. + * In other words, the following situation, while mentioned in the RFC, will NOT + * be sniffed for: + * - Using $this as static variable. (error _message_ change only). + * + * Also, the changes with relation to assigning `$this` dynamically can not be + * sniffed for reliably, so are not covered by this sniff. + * - Disable ability to re-assign `$this` indirectly through `$$`. + * - Disable ability to re-assign `$this` indirectly through reference. + * - Disable ability to re-assign `$this` indirectly through `extract()` and `parse_str()`. + * + * Other changes not (yet) covered: + * - `get_defined_vars()` always doesn't show value of variable `$this`. + * - Always show true `$this` value in magic method `__call()`. + * {@internal This could possibly be covered. Similar logic as "outside object context", + * but with function name check and supportsBelow('7.0').} + * + * PHP version 7.1 + * + * @link https://www.php.net/manual/en/migration71.other-changes.php#migration71.other-changes.inconsistency-fixes-to-this + * @link https://wiki.php.net/rfc/this_var + * + * @since 9.1.0 + */ +class ForbiddenThisUseContextsSniff extends Sniff +{ + + /** + * OO scope tokens. + * + * Duplicate of Tokens::$ooScopeTokens array in PHPCS which was added in 3.1.0. + * + * @since 9.1.0 + * + * @var array + */ + private $ooScopeTokens = array( + 'T_CLASS' => \T_CLASS, + 'T_INTERFACE' => \T_INTERFACE, + 'T_TRAIT' => \T_TRAIT, + ); + + /** + * Scopes to skip over when examining the contents of functions. + * + * @since 9.1.0 + * + * @var array + */ + private $skipOverScopes = array( + 'T_FUNCTION' => true, + 'T_CLOSURE' => true, + ); + + /** + * Valid uses of $this in plain functions or methods outside object context. + * + * @since 9.1.0 + * + * @var array + */ + private $validUseOutsideObject = array( + \T_ISSET => true, + \T_EMPTY => true, + ); + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 9.1.0 + * + * @return array + */ + public function register() + { + if (\defined('T_ANON_CLASS')) { + $this->ooScopeTokens['T_ANON_CLASS'] = \T_ANON_CLASS; + } + + $this->skipOverScopes += $this->ooScopeTokens; + + return array( + \T_FUNCTION, + \T_CLOSURE, + \T_GLOBAL, + \T_CATCH, + \T_FOREACH, + \T_UNSET, + ); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 9.1.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('7.1') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + switch ($tokens[$stackPtr]['code']) { + case \T_FUNCTION: + $this->isThisUsedAsParameter($phpcsFile, $stackPtr); + $this->isThisUsedOutsideObjectContext($phpcsFile, $stackPtr); + break; + + case \T_CLOSURE: + $this->isThisUsedAsParameter($phpcsFile, $stackPtr); + break; + + case \T_GLOBAL: + /* + * $this can no longer be imported using the `global` keyword. + * This worked in PHP 7.0, though in PHP 5.x, it would throw a + * fatal "Cannot re-assign $this" error. + */ + $endOfStatement = $phpcsFile->findNext(array(\T_SEMICOLON, \T_CLOSE_TAG), ($stackPtr + 1)); + if ($endOfStatement === false) { + // No semi-colon - live coding. + return; + } + + for ($i = ($stackPtr + 1); $i < $endOfStatement; $i++) { + if ($tokens[$i]['code'] !== \T_VARIABLE || $tokens[$i]['content'] !== '$this') { + continue; + } + + $phpcsFile->addError( + '"$this" can no longer be used with the "global" keyword since PHP 7.1.', + $i, + 'Global' + ); + } + + break; + + case \T_CATCH: + /* + * $this can no longer be used as a catch variable. + */ + if (isset($tokens[$stackPtr]['parenthesis_opener'], $tokens[$stackPtr]['parenthesis_closer']) === false) { + return; + } + + $varPtr = $phpcsFile->findNext( + \T_VARIABLE, + ($tokens[$stackPtr]['parenthesis_opener'] + 1), + $tokens[$stackPtr]['parenthesis_closer'] + ); + + if ($varPtr === false || $tokens[$varPtr]['content'] !== '$this') { + return; + } + + $phpcsFile->addError( + '"$this" can no longer be used as a catch variable since PHP 7.1.', + $varPtr, + 'Catch' + ); + + break; + + case \T_FOREACH: + /* + * $this can no longer be used as a foreach *value* variable. + * This worked in PHP 7.0, though in PHP 5.x, it would throw a + * fatal "Cannot re-assign $this" error. + */ + if (isset($tokens[$stackPtr]['parenthesis_opener'], $tokens[$stackPtr]['parenthesis_closer']) === false) { + return; + } + + $stopPtr = $phpcsFile->findPrevious( + array(\T_AS, \T_DOUBLE_ARROW), + ($tokens[$stackPtr]['parenthesis_closer'] - 1), + $tokens[$stackPtr]['parenthesis_opener'] + ); + if ($stopPtr === false) { + return; + } + + $valueVarPtr = $phpcsFile->findNext( + \T_VARIABLE, + ($stopPtr + 1), + $tokens[$stackPtr]['parenthesis_closer'] + ); + if ($valueVarPtr === false || $tokens[$valueVarPtr]['content'] !== '$this') { + return; + } + + $afterThis = $phpcsFile->findNext( + Tokens::$emptyTokens, + ($valueVarPtr + 1), + $tokens[$stackPtr]['parenthesis_closer'], + true + ); + + if ($afterThis !== false + && ($tokens[$afterThis]['code'] === \T_OBJECT_OPERATOR + || $tokens[$afterThis]['code'] === \T_DOUBLE_COLON) + ) { + return; + } + + $phpcsFile->addError( + '"$this" can no longer be used as value variable in a foreach control structure since PHP 7.1.', + $valueVarPtr, + 'ForeachValueVar' + ); + + break; + + case \T_UNSET: + /* + * $this can no longer be unset. + */ + $openParenthesis = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($openParenthesis === false + || $tokens[$openParenthesis]['code'] !== \T_OPEN_PARENTHESIS + || isset($tokens[$openParenthesis]['parenthesis_closer']) === false + ) { + return; + } + + for ($i = ($openParenthesis + 1); $i < $tokens[$openParenthesis]['parenthesis_closer']; $i++) { + if ($tokens[$i]['code'] !== \T_VARIABLE || $tokens[$i]['content'] !== '$this') { + continue; + } + + $afterThis = $phpcsFile->findNext( + Tokens::$emptyTokens, + ($i + 1), + $tokens[$openParenthesis]['parenthesis_closer'], + true + ); + + if ($afterThis !== false + && ($tokens[$afterThis]['code'] === \T_OBJECT_OPERATOR + || $tokens[$afterThis]['code'] === \T_DOUBLE_COLON + || $tokens[$afterThis]['code'] === \T_OPEN_SQUARE_BRACKET) + ) { + $i = $afterThis; + continue; + } + + $phpcsFile->addError( + '"$this" can no longer be unset since PHP 7.1.', + $i, + 'Unset' + ); + } + + break; + } + } + + /** + * Check if $this is used as a parameter in a function declaration. + * + * $this can no longer be used as a parameter in a *global* function. + * Use as a parameter in a method was already an error prior to PHP 7.1. + * + * @since 9.1.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + protected function isThisUsedAsParameter(File $phpcsFile, $stackPtr) + { + if ($this->validDirectScope($phpcsFile, $stackPtr, $this->ooScopeTokens) !== false) { + return; + } + + $params = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr); + if (empty($params)) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + foreach ($params as $param) { + if ($param['name'] !== '$this') { + continue; + } + + if ($tokens[$stackPtr]['code'] === \T_FUNCTION) { + $phpcsFile->addError( + '"$this" can no longer be used as a parameter since PHP 7.1.', + $param['token'], + 'FunctionParam' + ); + } else { + $phpcsFile->addError( + '"$this" can no longer be used as a closure parameter since PHP 7.0.7.', + $param['token'], + 'ClosureParam' + ); + } + } + } + + /** + * Check if $this is used in a plain function or method. + * + * Prior to PHP 7.1, this would result in an "undefined variable" notice + * and execution would continue with $this regarded as `null`. + * As of PHP 7.1, this throws an exception. + * + * Note: use within isset() and empty() to check object context is still allowed. + * Note: $this can still be used within a closure. + * + * @since 9.1.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + protected function isThisUsedOutsideObjectContext(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + if (isset($tokens[$stackPtr]['scope_opener'], $tokens[$stackPtr]['scope_closer']) === false) { + return; + } + + if ($this->validDirectScope($phpcsFile, $stackPtr, $this->ooScopeTokens) !== false) { + $methodProps = $phpcsFile->getMethodProperties($stackPtr); + if ($methodProps['is_static'] === false) { + return; + } else { + $methodName = $phpcsFile->getDeclarationName($stackPtr); + if ($methodName === '__call') { + /* + * This is an exception. + * @link https://wiki.php.net/rfc/this_var#always_show_true_this_value_in_magic_method_call + */ + return; + } + } + } + + for ($i = ($tokens[$stackPtr]['scope_opener'] + 1); $i < $tokens[$stackPtr]['scope_closer']; $i++) { + if (isset($this->skipOverScopes[$tokens[$i]['type']])) { + if (isset($tokens[$i]['scope_closer']) === false) { + // Live coding or parse error, will only lead to inaccurate results. + return; + } + + // Skip over nested structures. + $i = $tokens[$i]['scope_closer']; + continue; + } + + if ($tokens[$i]['code'] !== \T_VARIABLE || $tokens[$i]['content'] !== '$this') { + continue; + } + + if (isset($tokens[$i]['nested_parenthesis']) === true) { + $nestedParenthesis = $tokens[$i]['nested_parenthesis']; + $nestedOpenParenthesis = array_keys($nestedParenthesis); + $lastOpenParenthesis = array_pop($nestedOpenParenthesis); + + $previousNonEmpty = $phpcsFile->findPrevious( + Tokens::$emptyTokens, + ($lastOpenParenthesis - 1), + null, + true, + null, + true + ); + + if (isset($this->validUseOutsideObject[$tokens[$previousNonEmpty]['code']])) { + continue; + } + } + + $phpcsFile->addError( + '"$this" can no longer be used in a plain function or method since PHP 7.1.', + $i, + 'OutsideObjectContext' + ); + } + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Variables/NewUniformVariableSyntaxSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Variables/NewUniformVariableSyntaxSniff.php new file mode 100644 index 00000000..f7948079 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Variables/NewUniformVariableSyntaxSniff.php @@ -0,0 +1,114 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Variables; + +use PHPCompatibility\Sniff; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * The interpretation of variable variables has changed in PHP 7.0. + * + * PHP version 7.0 + * + * @link https://www.php.net/manual/en/migration70.incompatible.php#migration70.incompatible.variable-handling.indirect + * @link https://wiki.php.net/rfc/uniform_variable_syntax + * + * @since 7.1.2 + * @since 9.0.0 Renamed from `VariableVariablesSniff` to `NewUniformVariableSyntaxSniff`. + */ +class NewUniformVariableSyntaxSniff extends Sniff +{ + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 7.1.2 + * + * @return array + */ + public function register() + { + return array(\T_VARIABLE); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 7.1.2 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('7.0') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + + // Verify that the next token is a square open bracket. If not, bow out. + $nextToken = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true, null, true); + + if ($nextToken === false || $tokens[$nextToken]['code'] !== \T_OPEN_SQUARE_BRACKET || isset($tokens[$nextToken]['bracket_closer']) === false) { + return; + } + + // The previous non-empty token has to be a $, -> or ::. + $prevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true); + if ($prevToken === false || \in_array($tokens[$prevToken]['code'], array(\T_DOLLAR, \T_OBJECT_OPERATOR, \T_DOUBLE_COLON), true) === false) { + return; + } + + // For static object calls, it only applies when this is a function call. + if ($tokens[$prevToken]['code'] === \T_DOUBLE_COLON) { + $hasBrackets = $tokens[$nextToken]['bracket_closer']; + while (($hasBrackets = $phpcsFile->findNext(Tokens::$emptyTokens, ($hasBrackets + 1), null, true, null, true)) !== false) { + if ($tokens[$hasBrackets]['code'] === \T_OPEN_SQUARE_BRACKET) { + if (isset($tokens[$hasBrackets]['bracket_closer'])) { + $hasBrackets = $tokens[$hasBrackets]['bracket_closer']; + continue; + } else { + // Live coding. + return; + } + + } elseif ($tokens[$hasBrackets]['code'] === \T_OPEN_PARENTHESIS) { + // Caught! + break; + + } else { + // Not a function call, so bow out. + return; + } + } + + // Now let's also prevent false positives when used with self and static which still work fine. + $classToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($prevToken - 1), null, true, null, true); + if ($classToken !== false) { + if ($tokens[$classToken]['code'] === \T_STATIC || $tokens[$classToken]['code'] === \T_SELF) { + return; + } elseif ($tokens[$classToken]['code'] === \T_STRING && $tokens[$classToken]['content'] === 'self') { + return; + } + } + } + + $phpcsFile->addError( + 'Indirect access to variables, properties and methods will be evaluated strictly in left-to-right order since PHP 7.0. Use curly braces to remove ambiguity.', + $stackPtr, + 'Found' + ); + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Variables/RemovedPredefinedGlobalVariablesSniff.php b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Variables/RemovedPredefinedGlobalVariablesSniff.php new file mode 100644 index 00000000..c814e7dc --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Variables/RemovedPredefinedGlobalVariablesSniff.php @@ -0,0 +1,318 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + */ + +namespace PHPCompatibility\Sniffs\Variables; + +use PHPCompatibility\AbstractRemovedFeatureSniff; +use PHPCompatibility\PHPCSHelper; +use PHP_CodeSniffer_File as File; +use PHP_CodeSniffer_Tokens as Tokens; + +/** + * Detect the use of removed global variables. Suggests alternatives if available. + * + * PHP version 5.3+ + * + * @link https://wiki.php.net/rfc/deprecations_php_7_2#php_errormsg + * + * @since 5.5 Introduced `LongArrays` sniff. + * @since 7.0 Introduced `RemovedGlobalVariables` sniff. + * @since 7.0.7 The `LongArrays` sniff now throws a warning for deprecated and an error for removed. + * Previously the `LongArrays` sniff would always throw a warning. + * @since 7.1.0 The `RemovedGlobalVariables` sniff now extends the `AbstractNewFeatureSniff` + * instead of the base `Sniff` class. + * @since 7.1.3 Merged the `LongArrays` sniff into the `RemovedGlobalVariables` sniff. + * @since 9.0.0 Renamed from `RemovedGlobalVariablesSniff` to `RemovedPredefinedGlobalVariablesSniff`. + */ +class RemovedPredefinedGlobalVariablesSniff extends AbstractRemovedFeatureSniff +{ + + /** + * A list of removed global variables with their alternative, if any. + * + * The array lists : version number with false (deprecated) and true (removed). + * If's sufficient to list the first version where the variable was deprecated/removed. + * + * @since 5.5 + * @since 7.0 + * + * @var array(string => array(string => bool|string)) + */ + protected $removedGlobalVariables = array( + 'HTTP_POST_VARS' => array( + '5.3' => false, + '5.4' => true, + 'alternative' => '$_POST', + ), + 'HTTP_GET_VARS' => array( + '5.3' => false, + '5.4' => true, + 'alternative' => '$_GET', + ), + 'HTTP_ENV_VARS' => array( + '5.3' => false, + '5.4' => true, + 'alternative' => '$_ENV', + ), + 'HTTP_SERVER_VARS' => array( + '5.3' => false, + '5.4' => true, + 'alternative' => '$_SERVER', + ), + 'HTTP_COOKIE_VARS' => array( + '5.3' => false, + '5.4' => true, + 'alternative' => '$_COOKIE', + ), + 'HTTP_SESSION_VARS' => array( + '5.3' => false, + '5.4' => true, + 'alternative' => '$_SESSION', + ), + 'HTTP_POST_FILES' => array( + '5.3' => false, + '5.4' => true, + 'alternative' => '$_FILES', + ), + + 'HTTP_RAW_POST_DATA' => array( + '5.6' => false, + '7.0' => true, + 'alternative' => 'php://input', + ), + + 'php_errormsg' => array( + '7.2' => false, + 'alternative' => 'error_get_last()', + ), + ); + + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 5.5 + * @since 7.0 + * + * @return array + */ + public function register() + { + return array(\T_VARIABLE); + } + + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 5.5 + * @since 7.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if ($this->supportsAbove('5.3') === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $varName = substr($tokens[$stackPtr]['content'], 1); + + if (isset($this->removedGlobalVariables[$varName]) === false) { + return; + } + + if ($this->isClassProperty($phpcsFile, $stackPtr) === true) { + // Ok, so this was a class property declaration, not our concern. + return; + } + + // Check for static usage of class properties shadowing the removed global variables. + if ($this->inClassScope($phpcsFile, $stackPtr, false) === true) { + $prevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true); + if ($prevToken !== false && $tokens[$prevToken]['code'] === \T_DOUBLE_COLON) { + return; + } + } + + // Do some additional checks for the $php_errormsg variable. + if ($varName === 'php_errormsg' + && $this->isTargetPHPErrormsgVar($phpcsFile, $stackPtr, $tokens) === false + ) { + return; + } + + // Still here, so throw an error/warning. + $itemInfo = array( + 'name' => $varName, + ); + $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); + } + + + /** + * Get the relevant sub-array for a specific item from a multi-dimensional array. + * + * @since 7.1.0 + * + * @param array $itemInfo Base information about the item. + * + * @return array Version and other information about the item. + */ + public function getItemArray(array $itemInfo) + { + return $this->removedGlobalVariables[$itemInfo['name']]; + } + + + /** + * Get the error message template for this sniff. + * + * @since 7.1.0 + * + * @return string + */ + protected function getErrorMsgTemplate() + { + return "Global variable '\$%s' is "; + } + + + /** + * Filter the error message before it's passed to PHPCS. + * + * @since 8.1.0 + * + * @param string $error The error message which was created. + * @param array $itemInfo Base information about the item this error message applies to. + * @param array $errorInfo Detail information about an item this error message applies to. + * + * @return string + */ + protected function filterErrorMsg($error, array $itemInfo, array $errorInfo) + { + if ($itemInfo['name'] === 'php_errormsg') { + $error = str_replace('Global', 'The', $error); + } + return $error; + } + + /** + * Run some additional checks for the `$php_errormsg` variable. + * + * @since 8.1.0 + * + * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * @param array $tokens Token array of the current file. + * + * @return bool + */ + private function isTargetPHPErrormsgVar(File $phpcsFile, $stackPtr, array $tokens) + { + $scopeStart = 0; + + /* + * If the variable is detected within the scope of a function/closure, limit the checking. + */ + $function = $phpcsFile->getCondition($stackPtr, \T_CLOSURE); + if ($function === false) { + $function = $phpcsFile->getCondition($stackPtr, \T_FUNCTION); + } + + // It could also be a function param, which is not in the function scope. + if ($function === false && isset($tokens[$stackPtr]['nested_parenthesis']) === true) { + $nestedParentheses = $tokens[$stackPtr]['nested_parenthesis']; + $parenthesisCloser = end($nestedParentheses); + if (isset($tokens[$parenthesisCloser]['parenthesis_owner']) + && ($tokens[$tokens[$parenthesisCloser]['parenthesis_owner']]['code'] === \T_FUNCTION + || $tokens[$tokens[$parenthesisCloser]['parenthesis_owner']]['code'] === \T_CLOSURE) + ) { + $function = $tokens[$parenthesisCloser]['parenthesis_owner']; + } + } + + if ($function !== false) { + $scopeStart = $tokens[$function]['scope_opener']; + } + + /* + * Now, let's do some additional checks. + */ + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + + // Is the variable being used as an array ? + if ($nextNonEmpty !== false && $tokens[$nextNonEmpty]['code'] === \T_OPEN_SQUARE_BRACKET) { + // The PHP native variable is a string, so this is probably not it + // (except for array access to string, but why would you in this case ?). + return false; + } + + // Is this a variable assignment ? + if ($nextNonEmpty !== false + && isset(Tokens::$assignmentTokens[$tokens[$nextNonEmpty]['code']]) === true + ) { + return false; + } + + // Is this a function param shadowing the PHP native one ? + if ($function !== false) { + $parameters = PHPCSHelper::getMethodParameters($phpcsFile, $function); + if (\is_array($parameters) === true && empty($parameters) === false) { + foreach ($parameters as $param) { + if ($param['name'] === '$php_errormsg') { + return false; + } + } + } + } + + $skipPast = array( + 'T_CLASS' => true, + 'T_ANON_CLASS' => true, + 'T_INTERFACE' => true, + 'T_TRAIT' => true, + 'T_FUNCTION' => true, + 'T_CLOSURE' => true, + ); + + // Walk back and see if there is an assignment to the variable within the same scope. + for ($i = ($stackPtr - 1); $i >= $scopeStart; $i--) { + if ($tokens[$i]['code'] === \T_CLOSE_CURLY_BRACKET + && isset($tokens[$i]['scope_condition']) + && isset($skipPast[$tokens[$tokens[$i]['scope_condition']]['type']]) + ) { + // Skip past functions, classes etc. + $i = $tokens[$i]['scope_condition']; + continue; + } + + if ($tokens[$i]['code'] !== \T_VARIABLE || $tokens[$i]['content'] !== '$php_errormsg') { + continue; + } + + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($i + 1), null, true); + + if ($nextNonEmpty !== false + && isset(Tokens::$assignmentTokens[$tokens[$nextNonEmpty]['code']]) === true + ) { + return false; + } + } + + return true; + } +} diff --git a/vendor/phpcompatibility/php-compatibility/PHPCompatibility/ruleset.xml b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/ruleset.xml new file mode 100644 index 00000000..3eb0b673 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/PHPCompatibility/ruleset.xml @@ -0,0 +1,7 @@ +<?xml version="1.0"?> +<ruleset name="PHPCompatibility"> + <description>Coding Standard that checks for PHP version compatibility.</description> + + <autoload>./../PHPCSAliases.php</autoload> + +</ruleset> diff --git a/vendor/phpcompatibility/php-compatibility/README.md b/vendor/phpcompatibility/php-compatibility/README.md new file mode 100644 index 00000000..9b1fd51b --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/README.md @@ -0,0 +1,250 @@ +PHP Compatibility Coding Standard for PHP CodeSniffer +===================================================== +[![Latest Stable Version](https://poser.pugx.org/phpcompatibility/php-compatibility/v/stable.png)](https://packagist.org/packages/phpcompatibility/php-compatibility) +[![Latest Unstable Version](https://poser.pugx.org/phpcompatibility/php-compatibility/v/unstable.png)](https://packagist.org/packages/phpcompatibility/php-compatibility) +![Awesome](https://img.shields.io/badge/awesome%3F-yes!-brightgreen.svg) +[![License](https://poser.pugx.org/phpcompatibility/php-compatibility/license.png)](https://github.com/PHPCompatibility/PHPCompatibility/blob/master/LICENSE) +[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=wimg&url=https://github.com/PHPCompatibility/PHPCompatibility&title=PHPCompatibility&language=&tags=github&category=software) + +[![Build Status](https://travis-ci.org/PHPCompatibility/PHPCompatibility.svg?branch=develop)](https://travis-ci.org/PHPCompatibility/PHPCompatibility) +[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/PHPCompatibility/PHPCompatibility/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/PHPCompatibility/PHPCompatibility/) +[![Coverage Status](https://coveralls.io/repos/github/PHPCompatibility/PHPCompatibility/badge.svg?branch=develop)](https://coveralls.io/github/PHPCompatibility/PHPCompatibility?branch=develop) + +[![Minimum PHP Version](https://img.shields.io/packagist/php-v/phpcompatibility/php-compatibility.svg?maxAge=3600)](https://packagist.org/packages/phpcompatibility/php-compatibility) +[![Tested on PHP 5.3 to nightly](https://img.shields.io/badge/tested%20on-PHP%205.3%20|%205.4%20|%205.5%20|%205.6%20|%207.0%20|%207.1%20|%207.2%20|%207.3%20|%207.4%20-brightgreen.svg?maxAge=2419200)](https://travis-ci.org/PHPCompatibility/PHPCompatibility) + + +This is a set of sniffs for [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) that checks for PHP cross-version compatibility. +It will allow you to analyse your code for compatibility with higher and lower versions of PHP. + +* [PHP Version Support](#php-version-support) +* [Requirements](#requirements) +* [Thank you](#thank-you) +* [Upgrading to PHPCompatibility 9.0.0](#warning-upgrading-to-phpcompatibility-900-warning) +* [Installation in a Composer project (method 1)](#installation-in-a-composer-project-method-1) +* [Installation via a git check-out to an arbitrary directory (method 2)](#installation-via-a-git-check-out-to-an-arbitrary-directory-method-2) +* [Sniffing your code for compatibility with specific PHP version(s)](#sniffing-your-code-for-compatibility-with-specific-php-versions) + + [Using a framework/CMS/polyfill specific ruleset](#using-a-frameworkcmspolyfill-specific-ruleset) +* [Using a custom ruleset](#using-a-custom-ruleset) + + [`testVersion` in the ruleset versus command-line](#testversion-in-the-ruleset-versus-command-line) + + [PHPCompatibility specific options](#phpcompatibility-specific-options) +* [Projects extending PHPCompatibility](#projects-extending-phpcompatibility) +* [Contributing](#contributing) +* [License](#license) + +PHP Version Support +------- + +The project aims to cover all PHP compatibility changes introduced since PHP 5.0 up to the latest PHP release. This is an ongoing process and coverage is not yet 100% (if, indeed, it ever could be). Progress is tracked on [our GitHub issue tracker](https://github.com/PHPCompatibility/PHPCompatibility/issues). + +Pull requests that check for compatibility issues in PHP 4 code - in particular between PHP 4 and PHP 5.0 - are very welcome as there are still situations where people need help upgrading legacy systems. However, coverage for changes introduced before PHP 5.1 will remain patchy as sniffs for this are not actively being developed at this time. + +Requirements +------- + +* PHP 5.3+ for use with PHP CodeSniffer 2.x. +* PHP 5.4+ for use with PHP CodeSniffer 3.x. + +PHP CodeSniffer: 2.3.0+ or 3.0.2+. + +The sniffs are designed to give the same results regardless of which PHP version you are using to run PHP CodeSniffer. You should get reasonably consistent results independently of the PHP version used in your test environment, though for the best results it is recommended to run the sniffs on PHP 5.4 or higher. + +PHP CodeSniffer 2.3.0 is required for 90% of the sniffs, PHP CodeSniffer 2.6.0 or later is required for full support, notices may be thrown on older versions. + +For running the sniffs on PHP 7.3, it is recommended to use PHP_CodeSniffer 3.3.1+, or, if needs be, PHP_CodeSniffer 2.9.2. +PHP_CodeSniffer < 2.9.2/3.3.1 is not fully compatible with PHP 7.3, which effectively means that PHPCompatibility can't be either. +While the sniffs will still work in _most_ cases, you can expect PHP warnings to be thrown. + +For running the sniffs on PHP 7.4, it is recommended to use PHP_CodeSniffer 3.5.0+. + +As of version 8.0.0, the PHPCompatibility standard can also be used with PHP CodeSniffer 3.x. + +As of version 9.0.0, support for PHP CodeSniffer 1.5.x and low 2.x versions < 2.3.0 has been dropped. + + +Thank you +--------- +Thanks to all [contributors](https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors) for their valuable contributions. + +Thanks to [WP Engine](https://wpengine.com) for their support on the PHP 7.0 sniffs. + + +:warning: Upgrading to PHPCompatibility 9.0.0 :warning: +-------- +This library has been reorganized. All sniffs have been placed in categories and a significant number of sniffs have been renamed. + +If you use the complete `PHPCompatibility` standard without `exclude` directives in a custom ruleset and do not (yet) use the new-style PHP_CodeSniffer annotation as introduced in [PHP_CodeSniffer 3.2.0](https://github.com/squizlabs/PHP_CodeSniffer/releases/tag/3.2.0), this will have no noticeable effect and everything should work as before. + +However, if you do use `exclude` directives for PHPCompatibility sniffs in a custom ruleset or if you use the [new-style PHP_CodeSniffer inline annotations](https://github.com/squizlabs/PHP_CodeSniffer/releases/3.2.0), you will need to update these when upgrading. This should be a one-time only change. +The changelog contains detailed information about all the sniff renames. + +Please read the changelog for version [9.0.0](https://github.com/PHPCompatibility/PHPCompatibility/releases/tag/9.0.0) carefully before upgrading. + + +Installation in a Composer project (method 1) +------------------------------------------- + +* Add the following lines to the `require-dev` section of your `composer.json` file. + ```json + "require-dev": { + "phpcompatibility/php-compatibility": "*" + }, + "prefer-stable" : true + ``` +* Next, PHP CodeSniffer has to be informed of the location of the standard. + - If PHPCompatibility is the **_only_** external PHP CodeSniffer standard you use, you can add the following to your `composer.json` file to automatically run the necessary command: + ```json + "scripts": { + "post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility", + "post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility" + } + ``` + - Alternatively - and **_strongly recommended_** if you use more than one external PHP CodeSniffer standard - you can use any of the following Composer plugins to handle this for you. + + Just add the Composer plugin you prefer to the `require-dev` section of your `composer.json` file. + + * [DealerDirect/phpcodesniffer-composer-installer](https://github.com/DealerDirect/phpcodesniffer-composer-installer):"^0.5.0" + * [higidi/composer-phpcodesniffer-standards-plugin](https://github.com/higidi/composer-phpcodesniffer-standards-plugin) + * [SimplyAdmire/ComposerPlugins](https://github.com/SimplyAdmire/ComposerPlugins). This plugin *might* still work, but appears to be abandoned. + - As a last alternative in case you use a custom ruleset, _and only if you use PHP CodeSniffer version 2.6.0 or higher_, you can tell PHP CodeSniffer the path to the PHPCompatibility standard by adding the following snippet to your custom ruleset: + ```xml + <config name="installed_paths" value="vendor/phpcompatibility/php-compatibility" /> + ``` +* Run `composer update --lock` to install both PHP CodeSniffer, the PHPCompatibility coding standard and - optionally - the Composer plugin. +* Verify that the PHPCompatibility standard is registered correctly by running `./vendor/bin/phpcs -i` on the command line. PHPCompatibility should be listed as one of the available standards. +* Now you can use the following command to inspect your code: + ```bash + ./vendor/bin/phpcs -p . --standard=PHPCompatibility + ``` + +Installation via a git check-out to an arbitrary directory (method 2) +----------------------- + +* Install [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) via [your preferred method](https://github.com/squizlabs/PHP_CodeSniffer#installation). + + PHP CodeSniffer offers a variety of installation methods to suit your work-flow: Composer, [PEAR](http://pear.php.net/PHP_CodeSniffer), a Phar file, zipped/tarred release archives or checking the repository out using Git. + + **Pro-tip:** Register the path to PHPCS in your system `$PATH` environment variable to make the `phpcs` command available from anywhere in your file system. +* Download the [latest PHPCompatibility release](https://github.com/PHPCompatibility/PHPCompatibility/releases) and unzip/untar it into an arbitrary directory. + + You can also choose to clone the repository using git to easily update your install regularly. +* Add the path to the directory in which you placed your copy of the PHPCompatibility repo to the PHP CodeSniffer configuration using the below command from the command line: + ```bash + phpcs --config-set installed_paths /path/to/PHPCompatibility + ``` + I.e. if you placed the `PHPCompatibility` repository in the `/my/custom/standards/PHPCompatibility` directory, you will need to add that directory to the PHP CodeSniffer [`installed_paths` configuration variable](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Configuration-Options#setting-the-installed-standard-paths). + + **Warning**: :warning: The `installed_paths` command overwrites any previously set `installed_paths`. If you have previously set `installed_paths` for other external standards, run `phpcs --config-show` first and then run the `installed_paths` command with all the paths you need separated by comma's, i.e.: + ```bash + phpcs --config-set installed_paths /path/1,/path/2,/path/3 + ``` + + **Pro-tip:** Alternatively, in case you use a custom ruleset _and only if you use PHP CodeSniffer version 2.6.0 or higher_, you can tell PHP CodeSniffer the path to the PHPCompatibility standard(s) by adding the following snippet to your custom ruleset: + ```xml + <config name="installed_paths" value="/path/to/PHPCompatibility" /> + ``` +* Verify that the PHPCompatibility standard is registered correctly by running `phpcs -i` on the command line. PHPCompatibility should be listed as one of the available standards. +* Now you can use the following command to inspect your code: + ```bash + phpcs -p . --standard=PHPCompatibility + ``` + +Sniffing your code for compatibility with specific PHP version(s) +------------------------------ +* Run the coding standard from the command-line with `phpcs -p . --standard=PHPCompatibility`. +* By default, you will only receive notifications about deprecated and/or removed PHP features. +* To get the most out of the PHPCompatibility standard, you should specify a `testVersion` to check against. That will enable the checks for both deprecated/removed PHP features as well as the detection of code using new PHP features. + - You can run the checks for just one specific PHP version by adding `--runtime-set testVersion 5.5` to your command line command. + - You can also specify a range of PHP versions that your code needs to support. In this situation, compatibility issues that affect any of the PHP versions in that range will be reported: `--runtime-set testVersion 5.3-5.5`. + - As of PHPCompatibility 7.1.3, you can omit one part of the range if you want to support everything above or below a particular version, i.e. use `--runtime-set testVersion 7.0-` to run all the checks for PHP 7.0 and above. +* By default the report will be sent to the console, if you want to save the report to a file, add the following to the command line command: `--report-full=path/to/report-file`. + For more information and other reporting options, check the [PHP CodeSniffer wiki](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Reporting). + + +### Using a framework/CMS/polyfill specific ruleset + +As of mid 2018, a limited set of framework/CMS specific rulesets is available. These rulesets are hosted in their own repositories. +* `PHPCompatibilityJoomla` [GitHub](https://github.com/PHPCompatibility/PHPCompatibilityJoomla) | [Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-joomla) +* `PHPCompatibilityWP` [GitHub](https://github.com/PHPCompatibility/PHPCompatibilityWP) | [Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-wp) + +Since the autumn of 2018, there are also a number of PHP polyfill specific rulesets available: +* `PHPCompatibilityPasswordCompat` [GitHub](https://github.com/PHPCompatibility/PHPCompatibilityPasswordCompat) | [Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-passwordcompat): accounts for @ircmaxell's [`password_compat`](https://github.com/ircmaxell/password_compat) polyfill library. +* `PHPCompatibilityParagonie` [GitHub](https://github.com/PHPCompatibility/PHPCompatibilityParagonie) | [Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-paragonie): contains two rulesets which account for the Paragonie [`random_compat`](https://github.com/paragonie/random_compat) and [`sodium_compat`](https://github.com/paragonie/sodium_compat) polyfill libraries respectively. +* `PHPCompatibilitySymfony` [GitHub](https://github.com/PHPCompatibility/PHPCompatibilitySymfony) | [Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-symfony): contains a number of rulesets which account for various PHP polyfill libraries offered by the Symfony project. For more details about the available rulesets, please check out the [README of the PHPCompatibilitySymfony](https://github.com/PHPCompatibility/PHPCompatibilitySymfony/blob/master/README.md) repository. + +If you want to make sure you have all PHPCompatibility rulesets available at any time, you can use the `PHPCompatibilityAll` package [GitHub](https://github.com/PHPCompatibility/PHPCompatibilityAll) | [Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-all). + +**IMPORTANT:** Framework/CMS/Polyfill specific rulesets do not set the minimum PHP version for your project, so you will still need to pass a `testVersion` to get the most accurate results. + + +Using a custom ruleset +------------------------------ +Like with any PHP CodeSniffer standard, you can add PHPCompatibility to a custom PHP CodeSniffer ruleset. + +```xml +<?xml version="1.0"?> +<ruleset name="Custom ruleset"> + <description>My rules for PHP CodeSniffer</description> + + <!-- Run against the PHPCompatibility ruleset --> + <rule ref="PHPCompatibility"/> + + <!-- Run against a second ruleset --> + <rule ref="PSR2"/> + +</ruleset> +``` + +You can also set the `testVersion` from within the ruleset: +```xml + <!-- Check for cross-version support for PHP 5.6 and higher. --> + <config name="testVersion" value="5.6-"/> +``` + +Other advanced options, such as changing the message type or severity of select sniffs, as described in the [PHPCS Annotated ruleset](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml) wiki page are, of course, also supported. + +### `testVersion` in the ruleset versus command-line + +In PHPCS 3.2.0 and lower, once you set the `testVersion` in the ruleset, you could not overrule it from the command-line anymore. +Starting with PHPCS 3.3.0, a `testVersion` set via the command-line will overrule the `testVersion` in the ruleset. + +This allows for more flexibility when, for instance, your project needs to comply with PHP `5.5-`, but you have a bootstrap file which needs to be compatible with PHP `5.2-`. + + +### PHPCompatibility specific options + +At this moment, there is one sniff which has a property which can be set via the ruleset. More custom properties may become available in the future. + +The `PHPCompatibility.Extensions.RemovedExtensions` sniff checks for removed extensions based on the function prefix used for these extensions. +This might clash with userland functions using the same function prefix. + +To whitelist userland functions, you can pass a comma-delimited list of function names to the sniff. +```xml + <!-- Whitelist the mysql_to_rfc3339() and mysql_another_function() functions. --> + <rule ref="PHPCompatibility.Extensions.RemovedExtensions"> + <properties> + <property name="functionWhitelist" type="array" value="mysql_to_rfc3339,mysql_another_function"/> + </properties> + </rule> +``` + +This property was added in PHPCompatibility version 7.0.1. +As of PHPCompatibility version 8.0.0, this custom property is only supported in combination with PHP CodeSniffer > 2.6.0 due to an upstream bug (which was fixed in PHPCS 2.6.0). + +Projects extending PHPCompatibility +-------------------------------------- +There are hundreds of public projects using PHPCompatibility or extending on top of it. A short list of some that you might know or have a look at : +* [adamculp/php-code-quality](https://github.com/adamculp/php-code-quality) - a Docker image doing a lot of code quality checks +* [VFAC/PHP7Compatibility](https://vfac.fr/projects/php7compatibility) - a Docker container to check PHP7 Compatibility +* [grumphp-php-compatibility](https://github.com/wunderio/grumphp-php-compatibility) - A plugin for [GrumPHP](https://github.com/phpro/grumphp) +* PHPCompatibility Checker WordPress plugin : [Wordpress site](https://wordpress.org/plugins/php-compatibility-checker/) and [Github](https://github.com/wpengine/phpcompat/) +* [WordPress Tide project](https://wptide.org/) +* [PHPStorm has built-in support for PHPCompatibility](https://www.jetbrains.com/help/phpstorm/using-php-code-sniffer.html#788c81b6) + +Contributing +------- +Contributions are very welcome. Please read the [CONTRIBUTING](.github/CONTRIBUTING.md) documentation to get started. + +License +------- +This code is released under the GNU Lesser General Public License (LGPL). For more information, visit http://www.gnu.org/copyleft/lesser.html diff --git a/vendor/phpcompatibility/php-compatibility/composer.json b/vendor/phpcompatibility/php-compatibility/composer.json new file mode 100644 index 00000000..38fbe637 --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/composer.json @@ -0,0 +1,44 @@ +{ + "name" : "phpcompatibility/php-compatibility", + "description" : "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.", + "type" : "phpcodesniffer-standard", + "keywords" : [ "compatibility", "phpcs", "standards" ], + "homepage" : "http://techblog.wimgodden.be/tag/codesniffer/", + "license" : "LGPL-3.0-or-later", + "authors" : [ { + "name" : "Wim Godden", + "role" : "lead", + "homepage" : "https://github.com/wimg" + }, + { + "name" : "Juliette Reinders Folmer", + "role" : "lead", + "homepage" : "https://github.com/jrfnl" + }, + { + "name" : "Contributors", + "homepage" : "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors" + } ], + "support" : { + "issues" : "https://github.com/PHPCompatibility/PHPCompatibility/issues", + "source" : "https://github.com/PHPCompatibility/PHPCompatibility" + }, + "require" : { + "php" : ">=5.3", + "squizlabs/php_codesniffer" : "^2.3 || ^3.0.2" + }, + "require-dev" : { + "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0" + }, + "conflict": { + "squizlabs/php_codesniffer": "2.6.2" + }, + "suggest" : { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "scripts" : { + "post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths ../../..", + "post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths ../../.." + } +} diff --git a/vendor/phpcompatibility/php-compatibility/phpunit-bootstrap.php b/vendor/phpcompatibility/php-compatibility/phpunit-bootstrap.php new file mode 100644 index 00000000..f66ec0cf --- /dev/null +++ b/vendor/phpcompatibility/php-compatibility/phpunit-bootstrap.php @@ -0,0 +1,86 @@ +<?php +/** + * PHPCompatibility, an external standard for PHP_CodeSniffer. + * + * Bootstrap file for tests. + * + * @package PHPCompatibility + * @copyright 2012-2019 PHPCompatibility Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCompatibility/PHPCompatibility + * + * @since 5.5 + */ + +if (defined('PHP_CODESNIFFER_IN_TESTS') === false) { + define('PHP_CODESNIFFER_IN_TESTS', true); +} + +// The below two defines are needed for PHPCS 3.x. +if (defined('PHP_CODESNIFFER_CBF') === false) { + define('PHP_CODESNIFFER_CBF', false); +} + +if (defined('PHP_CODESNIFFER_VERBOSITY') === false) { + define('PHP_CODESNIFFER_VERBOSITY', 0); +} + +$ds = DIRECTORY_SEPARATOR; + +// Get the PHPCS dir from an environment variable. +$phpcsDir = getenv('PHPCS_DIR'); + +// This may be a Composer install. +if ($phpcsDir === false && is_dir(__DIR__ . $ds . 'vendor' . $ds . 'squizlabs' . $ds . 'php_codesniffer')) { + $vendorDir = __DIR__ . $ds . 'vendor'; + $phpcsDir = $vendorDir . $ds . 'squizlabs' . $ds . 'php_codesniffer'; +} elseif ($phpcsDir !== false) { + $phpcsDir = realpath($phpcsDir); +} + +// Try and load the PHPCS autoloader. +if ($phpcsDir !== false && file_exists($phpcsDir . $ds . 'autoload.php')) { + // PHPCS 3.x. + require_once $phpcsDir . $ds . 'autoload.php'; + + /* + * Alias the PHPCS 3.x classes to their PHPCS 2.x equivalent if necessary. + * Also provide a custom autoloader for our abstract base classes as the PHPCS native autoloader + * has trouble with them in combination with the PHPCompatibility custom unit test suite. + */ + require_once __DIR__ . $ds . 'PHPCSAliases.php'; + +} elseif ($phpcsDir !== false && file_exists($phpcsDir . $ds . 'CodeSniffer.php')) { + // PHPCS 2.x. + require_once $phpcsDir . $ds . 'CodeSniffer.php'; + + if (isset($vendorDir) && file_exists($vendorDir . $ds . 'autoload.php')) { + require_once $vendorDir . $ds . 'autoload.php'; + } + +} else { + echo 'Uh oh... can\'t find PHPCS. + +If you use Composer, please run `composer install --prefer-source`. +Otherwise, make sure you set a `PHPCS_DIR` environment variable in your phpunit.xml file +pointing to the PHPCS directory. + +Please read the contributors guidelines for more information: +https://is.gd/PHPCompatibilityContrib +'; + + die(1); +} + + +// PHPUnit cross version compatibility. +if (class_exists('PHPUnit\Runner\Version') + && version_compare(PHPUnit\Runner\Version::id(), '6.0', '>=') + && class_exists('PHPUnit_Framework_TestCase') === false +) { + class_alias('PHPUnit\Framework\TestCase', 'PHPUnit_Framework_TestCase'); +} + +require_once __DIR__ . $ds . 'PHPCompatibility' . $ds . 'Tests' . $ds . 'BaseSniffTest.php'; +require_once __DIR__ . $ds . 'PHPCompatibility' . $ds . 'Util' . $ds . 'Tests' . $ds . 'CoreMethodTestFrame.php'; +unset($ds, $phpcsDir, $vendorDir); diff --git a/vendor/phpcompatibility/phpcompatibility-paragonie/LICENSE b/vendor/phpcompatibility/phpcompatibility-paragonie/LICENSE new file mode 100644 index 00000000..65c5ca88 --- /dev/null +++ b/vendor/phpcompatibility/phpcompatibility-paragonie/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/vendor/phpcompatibility/phpcompatibility-paragonie/PHPCompatibilityParagonieRandomCompat/ruleset.xml b/vendor/phpcompatibility/phpcompatibility-paragonie/PHPCompatibilityParagonieRandomCompat/ruleset.xml new file mode 100644 index 00000000..e67a12e0 --- /dev/null +++ b/vendor/phpcompatibility/phpcompatibility-paragonie/PHPCompatibilityParagonieRandomCompat/ruleset.xml @@ -0,0 +1,40 @@ +<?xml version="1.0"?> +<ruleset name="PHPCompatibilityParagonieRandomCompat"> + <description>PHPCompatibility ruleset for PHP_CodeSniffer which accounts for polyfills provided by the Paragonie random_compat library.</description> + + <rule ref="PHPCompatibility"> + <!-- https://github.com/paragonie/random_compat/blob/master/lib/random.php --> + <exclude name="PHPCompatibility.Constants.NewConstants.php_version_idFound"/> + + <!-- https://github.com/paragonie/random_compat/blob/master/lib/random_bytes_*.php --> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.random_bytesFound"/> + + <!-- https://github.com/paragonie/random_compat/blob/master/lib/random_int.php --> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.random_intFound"/> + + <!-- https://github.com/paragonie/random_compat/blob/master/lib/error_polyfill.php --> + <exclude name="PHPCompatibility.Classes.NewClasses.errorFound"/> + <exclude name="PHPCompatibility.Classes.NewClasses.typeerrorFound"/> + </rule> + + <!-- Prevent false positives being thrown when run over the code of random_compat itself. --> + <rule ref="PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated"> + <exclude-pattern>/random_compat/lib/byte_safe_strings\.php$</exclude-pattern> + </rule> + <rule ref="PHPCompatibility.FunctionUse.NewFunctions.stream_set_chunk_sizeFound"> + <exclude-pattern>/random_compat/lib/random_bytes_dev_urandom\.php$</exclude-pattern> + </rule> + <rule ref="PHPCompatibility.Constants.RemovedConstants.mcrypt_dev_urandomDeprecatedRemoved"> + <exclude-pattern>/random_compat/lib/random_bytes_mcrypt\.php$</exclude-pattern> + </rule> + <rule ref="PHPCompatibility.Extensions.RemovedExtensions.mcryptDeprecatedRemoved"> + <exclude-pattern>/random_compat/lib/random_bytes_mcrypt\.php$</exclude-pattern> + </rule> + <rule ref="PHPCompatibility.FunctionUse.RemovedFunctions.mcrypt_create_ivDeprecatedRemoved"> + <exclude-pattern>/random_compat/lib/random_bytes_mcrypt\.php$</exclude-pattern> + </rule> + <rule ref="PHPCompatibility.LanguageConstructs.NewLanguageConstructs.t_ns_separatorFound"> + <exclude-pattern>/random_compat/lib/random_bytes_libsodium\.php$</exclude-pattern> + </rule> + +</ruleset> diff --git a/vendor/phpcompatibility/phpcompatibility-paragonie/PHPCompatibilityParagonieSodiumCompat/ruleset.xml b/vendor/phpcompatibility/phpcompatibility-paragonie/PHPCompatibilityParagonieSodiumCompat/ruleset.xml new file mode 100644 index 00000000..ee1f6ab5 --- /dev/null +++ b/vendor/phpcompatibility/phpcompatibility-paragonie/PHPCompatibilityParagonieSodiumCompat/ruleset.xml @@ -0,0 +1,245 @@ +<?xml version="1.0"?> +<ruleset name="PHPCompatibilityParagonieSodiumCompat"> + <description>PHPCompatibility ruleset for PHP_CodeSniffer which accounts for polyfills provided by the Paragonie sodium_compat library.</description> + + <!-- + Note: this ruleset does **not** contain excludes for the `sodium_pwhash()` and + the sodium_memzero() functions as, while those functions do exist in the polyfill, + they do not work and are explicitly excluded features. + See: https://github.com/paragonie/sodium_compat#features-excluded-from-this-polyfill + + With that in mind, these functions should not be used in code which intends to be + PHP cross-version compatible. + --> + + <!-- https://github.com/paragonie/sodium_compat/blob/master/composer.json --> + <rule ref="PHPCompatibilityParagonieRandomCompat"/> + + <rule ref="PHPCompatibility"> + <!-- https://github.com/paragonie/sodium_compat/blob/master/src/SodiumException.php --> + <exclude name="PHPCompatibility.Classes.NewClasses.sodiumexceptionFound"/> + + <!-- https://github.com/paragonie/sodium_compat/blob/master/lib/php72compat.php --> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_base64_variant_originalFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_base64_variant_original_no_paddingFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_base64_variant_urlsafeFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_base64_variant_urlsafe_no_paddingFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_aes256gcm_keybytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_aes256gcm_nsecbytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_aes256gcm_npubbytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_aes256gcm_abytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_chacha20poly1305_keybytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_chacha20poly1305_nsecbytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_chacha20poly1305_npubbytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_chacha20poly1305_abytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_chacha20poly1305_ietf_keybytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_chacha20poly1305_ietf_nsecbytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_chacha20poly1305_ietf_npubbytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_chacha20poly1305_ietf_abytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_xchacha20poly1305_ietf_keybytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_xchacha20poly1305_ietf_nsecbytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_xchacha20poly1305_ietf_npubbytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_xchacha20poly1305_ietf_abytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_auth_bytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_auth_keybytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_box_sealbytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_box_secretkeybytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_box_publickeybytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_box_keypairbytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_box_macbytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_box_noncebytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_box_seedbytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_kdf_bytes_minFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_kdf_bytes_maxFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_kdf_contextbytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_kdf_keybytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_kx_bytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_kx_keypairbytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_kx_publickeybytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_kx_secretkeybytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_kx_seedbytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_kx_sessionkeybytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_generichash_bytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_generichash_bytes_minFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_generichash_bytes_maxFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_generichash_keybytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_generichash_keybytes_minFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_generichash_keybytes_maxFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_saltbytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_strprefixFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_alg_argon2i13Found"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_alg_argon2id13Found"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_memlimit_interactiveFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_opslimit_interactiveFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_memlimit_moderateFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_opslimit_moderateFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_memlimit_sensitiveFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_opslimit_sensitiveFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_scryptsalsa208sha256_saltbytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_scryptsalsa208sha256_strprefixFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_scryptsalsa208sha256_opslimit_interactiveFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_scryptsalsa208sha256_memlimit_interactiveFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_scryptsalsa208sha256_opslimit_sensitiveFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_scryptsalsa208sha256_memlimit_sensitiveFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_scalarmult_bytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_scalarmult_scalarbytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_secretstream_xchacha20poly1305_abytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_secretstream_xchacha20poly1305_headerbytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_secretstream_xchacha20poly1305_keybytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_secretstream_xchacha20poly1305_messagebytes_maxFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_secretstream_xchacha20poly1305_tag_pushFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_secretstream_xchacha20poly1305_tag_rekeyFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_secretstream_xchacha20poly1305_tag_finalFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_shorthash_bytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_shorthash_keybytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_secretbox_keybytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_secretbox_macbytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_secretbox_noncebytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_sign_bytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_sign_seedbytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_sign_publickeybytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_sign_secretkeybytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_sign_keypairbytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_stream_keybytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_stream_noncebytesFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_library_versionFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_library_major_versionFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.sodium_library_minor_versionFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_addFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_base642binFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_bin2base64Found"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_bin2hexFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_compareFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_aead_aes256gcm_decryptFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_aead_aes256gcm_encryptFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_aead_aes256gcm_is_availableFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_aead_chacha20poly1305_decryptFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_aead_chacha20poly1305_encryptFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_aead_chacha20poly1305_keygenFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_aead_chacha20poly1305_ietf_decryptFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_aead_chacha20poly1305_ietf_encryptFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_aead_chacha20poly1305_ietf_keygenFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_aead_xchacha20poly1305_ietf_decryptFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_aead_xchacha20poly1305_ietf_encryptFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_aead_xchacha20poly1305_ietf_keygenFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_authFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_auth_keygenFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_auth_verifyFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_boxFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_box_keypairFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_box_keypair_from_secretkey_and_publickeyFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_box_openFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_box_publickeyFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_box_publickey_from_secretkeyFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_box_sealFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_box_seal_openFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_box_secretkeyFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_box_seed_keypairFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_generichashFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_generichash_finalFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_generichash_initFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_generichash_keygenFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_generichash_updateFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kdf_derive_from_keyFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kdf_keygenFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kxFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kx_client_session_keysFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kx_keypairFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kx_publickeyFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kx_secretkeyFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kx_seed_keypairFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kx_server_session_keysFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_pwhash_strFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_pwhash_str_needs_rehashFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_pwhash_str_verifyFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_pwhash_scryptsalsa208sha256Found"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_pwhash_scryptsalsa208sha256_strFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_pwhash_scryptsalsa208sha256_str_verifyFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_scalarmultFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_scalarmult_baseFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretboxFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretbox_keygenFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretbox_openFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretstream_xchacha20poly1305_keygenFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretstream_xchacha20poly1305_init_pullFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretstream_xchacha20poly1305_init_pushFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretstream_xchacha20poly1305_pullFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretstream_xchacha20poly1305_pushFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretstream_xchacha20poly1305_rekeyFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_shorthashFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_shorthash_keygenFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_signFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_detachedFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_keypairFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_keypair_from_secretkey_and_publickeyFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_openFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_publickeyFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_publickey_from_secretkeyFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_secretkeyFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_seed_keypairFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_verify_detachedFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_ed25519_pk_to_curve25519Found"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_ed25519_sk_to_curve25519Found"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_streamFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_stream_keygenFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_stream_xorFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_hex2binFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_incrementFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_library_versionFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_library_version_majorFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_library_version_minorFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_version_stringFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_memcmpFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_padFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_randombytes_bufFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_randombytes_uniformFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_randombytes_random16Found"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_unpadFound"/> + </rule> + + <!-- Prevent false positives being thrown when run over the code of sodium_compat itself. --> + <rule ref="PHPCompatibility.FunctionUse.NewFunctionParameters.assert_descriptionFound"> + <exclude-pattern>/sodium_compat/autoload\.php$</exclude-pattern> + </rule> + <rule ref="PHPCompatibility.FunctionNameRestrictions.NewMagicMethods.__debuginfoFound"> + <exclude-pattern>/sodium_compat/src/Core(32)?/Curve25519/Fe\.php$</exclude-pattern> + <exclude-pattern>/sodium_compat/src/Core/AES/Block\.php$</exclude-pattern> + </rule> + <rule ref="PHPCompatibility.FunctionUse.NewFunctions.hash_equalsFound"> + <exclude-pattern>/sodium_compat/src/Core/Util\.php$</exclude-pattern> + </rule> + <rule ref="PHPCompatibility.ParameterValues.NewPackFormat.NewFormatFound"> + <exclude-pattern>/sodium_compat/src/Core/Util\.php$</exclude-pattern> + </rule> + <rule ref="PHPCompatibility.FunctionUse.NewFunctionParameters.openssl_decrypt_ivFound"> + <exclude-pattern>/sodium_compat/src/Compat\.php$</exclude-pattern> + </rule> + <rule ref="PHPCompatibility.FunctionUse.NewFunctionParameters.openssl_decrypt_tagFound"> + <exclude-pattern>/sodium_compat/src/Compat\.php$</exclude-pattern> + </rule> + <rule ref="PHPCompatibility.FunctionUse.NewFunctionParameters.openssl_decrypt_aadFound"> + <exclude-pattern>/sodium_compat/src/Compat\.php$</exclude-pattern> + </rule> + <rule ref="PHPCompatibility.FunctionUse.NewFunctionParameters.openssl_encrypt_ivFound"> + <exclude-pattern>/sodium_compat/src/Compat\.php$</exclude-pattern> + </rule> + <rule ref="PHPCompatibility.FunctionUse.NewFunctionParameters.openssl_encrypt_tagFound"> + <exclude-pattern>/sodium_compat/src/Compat\.php$</exclude-pattern> + </rule> + <rule ref="PHPCompatibility.FunctionUse.NewFunctionParameters.openssl_encrypt_aadFound"> + <exclude-pattern>/sodium_compat/src/Compat\.php$</exclude-pattern> + </rule> + <rule ref="PHPCompatibility.Constants.NewConstants.openssl_raw_dataFound"> + <exclude-pattern>/sodium_compat/src/Compat\.php$</exclude-pattern> + </rule> + <rule ref="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_pwhashFound"> + <exclude-pattern>/sodium_compat/src/Compat\.php$</exclude-pattern> + </rule> + <rule ref="PHPCompatibility.FunctionUse.NewFunctions.sodium_memzeroFound"> + <exclude-pattern>/sodium_compat/src/Compat\.php$</exclude-pattern> + </rule> + <rule ref="PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated"> + <exclude-pattern>/sodium_compat/src/Core/Util\.php$</exclude-pattern> + </rule> + +</ruleset> diff --git a/vendor/phpcompatibility/phpcompatibility-paragonie/README.md b/vendor/phpcompatibility/phpcompatibility-paragonie/README.md new file mode 100644 index 00000000..4bc90587 --- /dev/null +++ b/vendor/phpcompatibility/phpcompatibility-paragonie/README.md @@ -0,0 +1,150 @@ +[![Latest Stable Version](https://poser.pugx.org/phpcompatibility/phpcompatibility-paragonie/v/stable.png)](https://packagist.org/packages/phpcompatibility/phpcompatibility-paragonie) +[![Latest Unstable Version](https://poser.pugx.org/phpcompatibility/phpcompatibility-paragonie/v/unstable.png)](https://packagist.org/packages/phpcompatibility/phpcompatibility-paragonie) +[![License](https://poser.pugx.org/phpcompatibility/phpcompatibility-paragonie/license.png)](https://github.com/PHPCompatibility/PHPCompatibilityParagonie/blob/master/LICENSE) +[![Build Status](https://github.com/PHPCompatibility/PHPCompatibilityParagonie/workflows/CI/badge.svg?branch=master)](https://github.com/PHPCompatibility/PHPCompatibilityParagonie/actions) + +# PHPCompatibilityParagonie + +Using PHPCompatibilityParagonie, you can analyse the codebase of a project using either of the Paragonie polyfills, for PHP cross-version compatibility. + + +## What's in this repo ? + +Two rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries. + +These rulesets prevent false positives from the [PHPCompatibility standard](https://github.com/PHPCompatibility/PHPCompatibility) by excluding back-fills and poly-fills which are provided by those libraries. + +Paragonie Polyfill Library | Corresponding PHPCompatibility Ruleset | Includes +--- | --- | --- +[`random_compat`](https://github.com/paragonie/random_compat) | `PHPCompatibilityParagonieRandomCompat` +[`sodium_compat`](https://github.com/paragonie/sodium_compat) | `PHPCompatibilityParagonieSodiumCompat` | `PHPCompatibilityParagonieRandomCompat` + +> Note: +> As the `sodium_compat` library has `random_compat` [as a dependency](https://github.com/paragonie/sodium_compat/blob/master/composer.json), the `PHPCompatibilityParagonieSodiumCompat` ruleset includes the `PHPCompatibilityParagonieRandomCompat` ruleset. +> +> In practice, this means that if your project uses both libraries, you just need to use the `PHPCompatibilityParagonieSodiumCompat` ruleset to prevent false positives from both. + + +## Requirements + +* [PHP_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer). + * PHP 5.3+ for use with [PHP_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) 2.3.0+. + * PHP 5.4+ for use with [PHP_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) 3.0.2+. + + Use the latest stable release of PHP_CodeSniffer for the best results. + The minimum _recommended_ version of PHP_CodeSniffer is version 2.6.0. +* [PHPCompatibility](https://github.com/PHPCompatibility/PHPCompatibility) 9.0.0+. + + +## Installation instructions + +The only supported installation method is via [Composer](https://getcomposer.org/). + +If you don't have a Composer plugin installed to manage the `installed_paths` setting for PHP_CodeSniffer, run the following from the command-line: +```bash +composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true +composer require --dev dealerdirect/phpcodesniffer-composer-installer:"^0.7" phpcompatibility/phpcompatibility-paragonie:"*" +``` + +If you already have a Composer PHP_CodeSniffer plugin installed, run: +```bash +composer require --dev phpcompatibility/phpcompatibility-paragonie:"*" +``` + +Next, run: +```bash +vendor/bin/phpcs -i +``` +If all went well, you will now see that the `PHPCompatibility`, `PHPCompatibilityParagonieRandomCompat` and `PHPCompatibilityParagonieSodiumCompat` standards are installed for PHP_CodeSniffer. + + +## How to use + +Now you can use the following commands to inspect the code in your project for PHP cross-version compatibility: +```bash +./vendor/bin/phpcs -p . --standard=PHPCompatibilityParagonieRandomCompat + +./vendor/bin/phpcs -p . --standard=PHPCompatibilityParagonieSodiumCompat +``` + +By default, you will only receive notifications about deprecated and/or removed PHP features. + +To get the most out of the PHPCompatibilityParagonie rulesets, you should specify a `testVersion` to check against. That will enable the checks for both deprecated/removed PHP features as well as the detection of code using new PHP features. + +For example: +```bash +# For a project which should be compatible with PHP 5.3 up to and including PHP 7.0: +./vendor/bin/phpcs -p . --standard=PHPCompatibilityParagonieRandomCompat --runtime-set testVersion 5.3-7.0 + +# For a project which should be compatible with PHP 5.4 and higher: +./vendor/bin/phpcs -p . --standard=PHPCompatibilityParagonieSodiumCompat --runtime-set testVersion 5.4- +``` + +For more detailed information about setting the `testVersion`, see the README of the generic [PHPCompatibility](https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions) standard. + + +### Testing PHP files only + +By default PHP_CodeSniffer will analyse PHP, JavaScript and CSS files. As the PHPCompatibility sniffs only target PHP code, you can make the run slightly faster by telling PHP_CodeSniffer to only check PHP files, like so: +```bash +./vendor/bin/phpcs -p . --standard=PHPCompatibilityParagonieRandomCompat --extensions=php --runtime-set testVersion 5.3- +``` + +## License + +All code within the PHPCompatibility organisation is released under the GNU Lesser General Public License (LGPL). For more information, visit https://www.gnu.org/copyleft/lesser.html + + +## Changelog + +### 1.3.3 - 2024-04-25 + +* Prevent a new false positive when the ruleset is run over the code of the latest 1.x version of the `sodium_compat` polyfill itself. +* The recommended version of the [Composer PHPCS plugin] is now `^1.0`. +* Other housekeeping. Includes a contribution from [@fredden]. + +### 1.3.2 - 2022-10-25 + +- README: Updated the installation instructions for [compatibility with Composer >= 2.2][composer22announce]. +- Composer: The package will now identify itself as a static analysis tool. Thanks [@GaryJones]! +- Other housekeeping and minor documentation updates. + +[composer22announce]: https://blog.packagist.com/composer-2-2/#more-secure-plugin-execution + +### 1.3.1 - 2021-02-15 + +- The recommended version of the [Composer PHPCS plugin] is now `^0.7.0`, which offers compatibility with Composer 2.0. +- The rulesets are now also tested against PHP 7.4 and 8.0. + Note: full PHP 7.4 support is only available in combination with PHP_CodeSniffer >= 3.5.6. + Note: runtime PHP 8.0 support is only available in combination with PHP_CodeSniffer >= 3.5.7, full support is expected in PHP_CodeSniffer 3.6.0. + +### 1.3.0 - 2019-11-04 + +* Ruleset update for full compatibility with version [`1.12.0` of `sodium_compat`](https://github.com/paragonie/sodium_compat/releases/tag/v1.12.0). + +### 1.2.0 - 2019-10-16 + +* Ruleset update for full compatibility with version [`1.11.0` of `sodium_compat`](https://github.com/paragonie/sodium_compat/releases/tag/v1.11.0). + +### 1.1.0 - 2019-08-29 + +* The `PHPCompatibilityParagonieSodiumCompat` ruleset has been updated to account for the latest changes in the `sodium_compat` polyfill. +* Prevent false positives when the ruleset is run over the code of the `sodium_compat` polyfill itself. +* Composer: The recommended version of the [Composer PHPCS plugin] has been upped to `^0.5.0`. +* CI: Improved integration test for the `SodiumCompat` ruleset. +* CI: Added early warning system for false positives due to changes in the polyfill libraries themselves. + +### 1.0.1 - 2018-12-16 + +* Prevent false positives when the ruleset is run over the code of the `random_compat` polyfill itself. +* The rulesets are now also tested against PHP 7.3. + Note: full PHP 7.3 support is only available in combination with PHP_CodeSniffer 2.9.2 or 3.3.1+ due to an incompatibility within PHP_CodeSniffer itself. + +### 1.0.0 - 2018-10-07 + +Initial release of PHPCompatibilityParagonie containing rulesets covering the `random_compat` and `sodium_compat` polyfill libraries. + +[Composer PHPCS plugin]: https://github.com/PHPCSStandards/composer-installer/ + +[@fredden]: https://github.com/fredden +[@GaryJones]: https://github.com/GaryJones diff --git a/vendor/phpcompatibility/phpcompatibility-paragonie/composer.json b/vendor/phpcompatibility/phpcompatibility-paragonie/composer.json new file mode 100644 index 00000000..1cc902ae --- /dev/null +++ b/vendor/phpcompatibility/phpcompatibility-paragonie/composer.json @@ -0,0 +1,40 @@ +{ + "name" : "phpcompatibility/phpcompatibility-paragonie", + "description" : "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.", + "type" : "phpcodesniffer-standard", + "keywords" : [ "compatibility", "phpcs", "standards", "static analysis", "paragonie", "polyfill" ], + "homepage" : "http://phpcompatibility.com/", + "license" : "LGPL-3.0-or-later", + "authors" : [ { + "name" : "Wim Godden", + "role" : "lead" + }, + { + "name" : "Juliette Reinders Folmer", + "role" : "lead" + } ], + "support" : { + "issues" : "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues", + "source" : "https://github.com/PHPCompatibility/PHPCompatibilityParagonie", + "security": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/security/policy" + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + }, + "lock": false + }, + "require" : { + "phpcompatibility/php-compatibility" : "^9.0" + }, + "require-dev" : { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "paragonie/random_compat": "dev-master", + "paragonie/sodium_compat": "dev-master" + }, + "suggest" : { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "prefer-stable" : true +} diff --git a/vendor/phpcompatibility/phpcompatibility-wp/LICENSE b/vendor/phpcompatibility/phpcompatibility-wp/LICENSE new file mode 100644 index 00000000..65c5ca88 --- /dev/null +++ b/vendor/phpcompatibility/phpcompatibility-wp/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/vendor/phpcompatibility/phpcompatibility-wp/PHPCompatibilityWP/ruleset.xml b/vendor/phpcompatibility/phpcompatibility-wp/PHPCompatibilityWP/ruleset.xml new file mode 100644 index 00000000..7f797a19 --- /dev/null +++ b/vendor/phpcompatibility/phpcompatibility-wp/PHPCompatibilityWP/ruleset.xml @@ -0,0 +1,85 @@ +<?xml version="1.0"?> +<ruleset name="PHPCompatibilityWP"> + <description>WordPress specific ruleset which checks for PHP cross version compatibility.</description> + + <!-- + The WordPress minimum PHP requirement was 5.2.4 up to WP 5.1. + As of WP 5.2, the new minimum PHP requirement is PHP 5.6.20. + As of WP 6.3, the new minimum PHP requirement is PHP 7.0.0. + Add the following in your project PHP_CodeSniffer ruleset to enforce this: + <config name="testVersion" value="7.0-"/> + + This directive is not included in this ruleset as individual projects may use + a different (higher) minimum PHP version. + --> + + <rule ref="PHPCompatibility"> + <!-- + Contained in /wp-includes/compat.php. + + History of the polyfills in WP: + * hash_hmac(): since WP 3.2.0. + * json_encode() and json_decode(): since unknown. + * hash_equals(): since WP 3.9.2. + * JSON_PRETTY_PRINT: since WP 4.1.0. + * json_last_error_msg(): since WP 4.4.0. + * JsonSerializable: since WP 4.4.0. + * array_replace_recursive(): since WP 4.5.3 up to 5.2.x. The polyfill was removed in WP 5.3. + * is_iterable(): since WP 4.9.6 + * is_countable(): since WP 4.9.6 + * IMAGETYPE_WEBP and IMG_WEBP: since WP 5.8.0. + * array_key_first(): since WP 5.9.0 + * array_key_last(): since WP 5.9.0 + * str_contains(): since WP 5.9.0 + * str_starts_with(): since WP 5.9.0 + * str_ends_with(): since WP 5.9.0 + * array_is_list(): since WP 6.5.0 + --> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.hash_hmacFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.json_encodeFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.json_decodeFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.hash_equalsFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.json_pretty_printFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.json_last_error_msgFound"/> + <exclude name="PHPCompatibility.Interfaces.NewInterfaces.jsonserializableFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.array_replace_recursiveFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.is_iterableFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.is_countableFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.imagetype_webpFound"/> + <exclude name="PHPCompatibility.Constants.NewConstants.img_webpFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.array_key_firstFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.array_key_lastFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.str_containsFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.str_starts_withFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.str_ends_withFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.array_is_listFound"/> + + <!-- + Contained in /wp-includes/spl-autoload-compat.php. + + History of the polyfills in WP: + * spl_autoload_register(), spl_autoload_unregister() and spl_autoload_functions() were + introduced in WP 4.6.0 and available up to WP 5.2.x. The polyfills were removed in WP 5.3. + --> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.spl_autoload_registerFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.spl_autoload_unregisterFound"/> + <exclude name="PHPCompatibility.FunctionUse.NewFunctions.spl_autoload_functionsFound"/> + </rule> + + <!-- + The ParagonieSodiumCompat ruleset includes the ParagonieRandomCompat ruleset. + + RandomCompat is contained in /wp-includes/random_compat/ since WP 4.4.0 and removed in WP 6.3.0 + SodiumCompat is contained in /wp-includes/sodium_compat/ since WP 5.2.0 + --> + <rule ref="PHPCompatibilityParagonieSodiumCompat"/> + + <!-- Whitelist the WP Core mysql_to_rfc3339() function. --> + <rule ref="PHPCompatibility.Extensions.RemovedExtensions"> + <properties> + <!-- Contained in /wp-includes/functions.php. --> + <property name="functionWhitelist" type="array" value="mysql_to_rfc3339"/> + </properties> + </rule> + +</ruleset> diff --git a/vendor/phpcompatibility/phpcompatibility-wp/README.md b/vendor/phpcompatibility/phpcompatibility-wp/README.md new file mode 100644 index 00000000..6890031e --- /dev/null +++ b/vendor/phpcompatibility/phpcompatibility-wp/README.md @@ -0,0 +1,144 @@ +[![Latest Stable Version](https://poser.pugx.org/phpcompatibility/phpcompatibility-wp/v/stable.png)](https://packagist.org/packages/phpcompatibility/phpcompatibility-wp) +[![Latest Unstable Version](https://poser.pugx.org/phpcompatibility/phpcompatibility-wp/v/unstable.png)](https://packagist.org/packages/phpcompatibility/phpcompatibility-wp) +[![License](https://poser.pugx.org/phpcompatibility/phpcompatibility-wp/license.png)](https://github.com/PHPCompatibility/PHPCompatibilityWP/blob/master/LICENSE) +[![Build Status](https://github.com/PHPCompatibility/PHPCompatibilityWP/workflows/CI/badge.svg?branch=master)](https://github.com/PHPCompatibility/PHPCompatibilityWP/actions) + +# PHPCompatibilityWP + +Using PHPCompatibilityWP, you can analyse the codebase of a WordPress-based project for PHP cross-version compatibility. + + +## What's in this repo ? + +A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects based on the WordPress CMS. + +This WordPress specific ruleset prevents false positives from the [PHPCompatibility standard](https://github.com/PHPCompatibility/PHPCompatibility) by excluding back-fills and poly-fills which are provided by WordPress. + + +## Requirements + +* [PHP_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer). + * PHP 5.3+ for use with [PHP_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) 2.3.0+. + * PHP 5.4+ for use with [PHP_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) 3.0.2+. + + Use the latest stable release of PHP_CodeSniffer for the best results. + The minimum _recommended_ version of PHP_CodeSniffer is version 2.6.0. +* [PHPCompatibility](https://github.com/PHPCompatibility/PHPCompatibility) 9.0.0+. +* [PHPCompatibilityParagonie](https://github.com/PHPCompatibility/PHPCompatibilityParagonie) 1.0.0+. + + +## Installation instructions + +The only supported installation method is via [Composer](https://getcomposer.org/). + +If you don't have a Composer plugin installed to manage the `installed_paths` setting for PHP_CodeSniffer, run the following from the command-line: +```bash +composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true +composer require --dev dealerdirect/phpcodesniffer-composer-installer:"^0.7" phpcompatibility/phpcompatibility-wp:"*" +``` + +If you already have a Composer PHP_CodeSniffer plugin installed, run: +```bash +composer require --dev phpcompatibility/phpcompatibility-wp:"*" +``` + +Next, run: +```bash +vendor/bin/phpcs -i +``` +If all went well, you will now see that the `PHPCompatibility`, `PHPCompatibilityWP` and some more PHPCompatibility standards are installed for PHP_CodeSniffer. + + +## How to use + +Now you can use the following command to inspect your code: +```bash +./vendor/bin/phpcs -p . --standard=PHPCompatibilityWP +``` + +By default, you will only receive notifications about deprecated and/or removed PHP features. + +To get the most out of the PHPCompatibilityWP standard, you should specify a `testVersion` to check against. That will enable the checks for both deprecated/removed PHP features as well as the detection of code using new PHP features. + +The minimum PHP requirement of the WordPress project up to WP 5.1 was 5.2.4. As of WP 5.2 it will be PHP 5.6.20. If you want to enforce this, either add `--runtime-set testVersion 5.6-` to your command-line command or add `<config name="testVersion" value="5.6-"/>` to your [custom ruleset](https://github.com/PHPCompatibility/PHPCompatibility#using-a-custom-ruleset). + +For example: +```bash +# For a project which should be compatible with PHP 5.6 and higher: +./vendor/bin/phpcs -p . --standard=PHPCompatibilityWP --runtime-set testVersion 5.6- +``` + +For more detailed information about setting the `testVersion`, see the README of the generic [PHPCompatibility](https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions) standard. + + +### Testing PHP files only + +By default PHP_CodeSniffer will analyse PHP, JavaScript and CSS files. As the PHPCompatibility sniffs only target PHP code, you can make the run slightly faster by telling PHP_CodeSniffer to only check PHP files, like so: +```bash +./vendor/bin/phpcs -p . --standard=PHPCompatibilityWP --extensions=php --runtime-set testVersion 5.6- +``` + +## License + +All code within the PHPCompatibility organisation is released under the GNU Lesser General Public License (LGPL). For more information, visit https://www.gnu.org/copyleft/lesser.html + + +## Changelog + +### 2.1.5 - 2024-04-25 + +- Ruleset: Updated for compatibility with WordPress 6.5. Thanks [@swissspidy] +- The recommended version of the [Composer PHPCS plugin] is now `^1.0`. +- Other housekeeping and documentation updates. Includes contributions from [@fredden] and [@johnbillion]. + +### 2.1.4 - 2022-10-24 + +- Composer: The package will now identify itself as a static analysis tool. Thanks [@GaryJones]! +- Other housekeeping and minor documentation updates. + +### 2.1.3 - 2021-12-31 + +- Ruleset: Updated for compatibility with WordPress 5.9. +- README: Updated the installation instructions for [compatibility with Composer >= 2.2][composer22announce]. +- Minor housekeeping. + +[composer22announce]: https://blog.packagist.com/composer-2-2/#more-secure-plugin-execution + +### 2.1.2 - 2021-07-21 + +- Ruleset: Updated for compatibility with WordPress 5.8. +- Documentation: improved installation instructions. Props [Andy Fragen](https://github.com/afragen). + +### 2.1.1 - 2021-02-15 + +- The recommended version of the [Composer PHPCS plugin] is now `^0.7.0`, which offers compatibility with Composer 2.0. +- The ruleset is now also tested against PHP 7.4 and 8.0. + Note: full PHP 7.4 support is only available in combination with PHP_CodeSniffer >= 3.5.6. + Note: runtime PHP 8.0 support is only available in combination with PHP_CodeSniffer >= 3.5.7, full support is expected in PHP_CodeSniffer 3.6.0. + +### 2.1.0 - 2019-08-29 + +- Ruleset: Updated for the Sodium_Compat polyfill which is included in WordPress 5.2. +- Composer: The recommended version of the [Composer PHPCS plugin] has been upped to `^0.5.0`. +- Documentation: Updated the ruleset inline documentation and the Readme to reflect the change in minimum PHP requirements for WordPress as of WP 5.2. +- Documentation: Updated the ruleset inline documentation to include information on when each polyfill was added to/removed from WordPress. +- CI: The rulesets are now also tested against PHP 7.3. + Note: full PHP 7.3 support is only available in combination with PHP_CodeSniffer 2.9.2 or 3.3.1+ due to an incompatibility within PHP_CodeSniffer itself. + +### 2.0.0 - 2018-10-07 + +- Ruleset: Updated for compatibility with PHPCompatibility 9.0+. +- Composer: Added dependency for a dedicated polyfill-based PHPCompatibility ruleset. +- CI: Added a test for the ruleset. +- Readme: Removed the installation instructions for a non-Composer based install. + +### 1.0.0 - 2018-07-17 + +Initial release of the PHPCompatibilityWP ruleset. + +[Composer PHPCS plugin]: https://github.com/PHPCSStandards/composer-installer/ + +[@fredden]: https://github.com/fredden +[@GaryJones]: https://github.com/GaryJones +[@johnbillion]: https://github.com/johnbillion +[@swissspidy]: https://github.com/swissspidy diff --git a/vendor/phpcompatibility/phpcompatibility-wp/composer.json b/vendor/phpcompatibility/phpcompatibility-wp/composer.json new file mode 100644 index 00000000..ad2abfe1 --- /dev/null +++ b/vendor/phpcompatibility/phpcompatibility-wp/composer.json @@ -0,0 +1,39 @@ +{ + "name" : "phpcompatibility/phpcompatibility-wp", + "description" : "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.", + "type" : "phpcodesniffer-standard", + "keywords" : [ "compatibility", "phpcs", "standards", "static analysis", "wordpress" ], + "homepage" : "http://phpcompatibility.com/", + "license" : "LGPL-3.0-or-later", + "authors" : [ { + "name" : "Wim Godden", + "role" : "lead" + }, + { + "name" : "Juliette Reinders Folmer", + "role" : "lead" + } ], + "support" : { + "issues" : "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues", + "source" : "https://github.com/PHPCompatibility/PHPCompatibilityWP", + "security": "https://github.com/PHPCompatibility/PHPCompatibilityWP/security/policy" + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + }, + "lock": false + }, + "require" : { + "phpcompatibility/php-compatibility" : "^9.0", + "phpcompatibility/phpcompatibility-paragonie" : "^1.0" + }, + "require-dev" : { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0" + }, + "suggest" : { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "prefer-stable" : true +} diff --git a/vendor/phpcsstandards/phpcsextra/CHANGELOG.md b/vendor/phpcsstandards/phpcsextra/CHANGELOG.md new file mode 100644 index 00000000..3ee3258b --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/CHANGELOG.md @@ -0,0 +1,590 @@ +# Change Log for the PHPCSExtra standard for PHP CodeSniffer + +All notable changes to this project will be documented in this file. + +This projects adheres to [Keep a CHANGELOG](http://keepachangelog.com/) and uses [Semantic Versioning](http://semver.org/). + +**Legend**: +:wrench: = Includes auto-fixer. +:bar_chart: = Includes metrics. +:books: = Includes CLI documentation. + + +## [Unreleased] + +_Nothing yet._ + +## [1.2.1] - 2023-12-08 + +### Changed + +#### Other + +* Composer: The minimum `PHP_CodeSniffer` requirement has been updated to `^3.8.0` (was `^3.7.2`). [#298] +* Composer: The minimum `PHPCSUtils` requirement has been updated to `^1.0.9` (was `^1.0.8`). [#298] + +Please ensure you run `composer update phpcsstandards/phpcsextra --with-dependencies` to benefit from this. + +[#298]: https://github.com/PHPCSStandards/PHPCSExtra/pull/298 + + +## [1.2.0] - 2023-12-02 + +### Added + +#### Universal + +* :wrench: :books: New `Universal.CodeAnalysis.NoDoubleNegative` sniff to detect double negatives (!!) and advise to use a boolean cast instead. Thanks [@diedexx] for reviewing. [#277] +* :wrench: :books: New `Universal.Operators.ConcatPosition` sniff to enforce that the concatenation operator for multi-line concatenations is in a preferred position, either always at the start of the next line or always at the end of the previous line. [#294] +* :wrench: :bar_chart: :books: New `Universal.PHP.LowercasePHPTag` sniff to enforce that the "PHP" in a PHP open tag is lowercase. Thanks [@fredden] for reviewing. [#276] + +### Changed + +#### NormalizedArrays + +* `NormalizedArrays.Arrays.CommaAfterLast`: the sniff now has two extra error codes to distinguish between multi-line arrays with the last array item on the _same line_ as the array closer vs the last array item being on a line _before_ the array closer. Thanks [@stronk7] for suggesting and patching this. [#283], [#284] + These new error codes allow for selectively excluding that specific situation from triggering the sniff. + The new error codes are `FoundMultiLineCloserSameLine` (for `multiLine="forbid"`) and `MissingMultiLineCloserSameLine` (for `multiLine="enforce"`). + The pre-existing `FoundMultiLine` and `FoundSingleLine` error codes continue to be used for multi-line arrays with the last array item on a different line than the array closer. + +#### Other + +* Various housekeeping. + +[#276]: https://github.com/PHPCSStandards/PHPCSExtra/pull/276 +[#277]: https://github.com/PHPCSStandards/PHPCSExtra/pull/277 +[#283]: https://github.com/PHPCSStandards/PHPCSExtra/issues/283 +[#284]: https://github.com/PHPCSStandards/PHPCSExtra/pull/284 +[#294]: https://github.com/PHPCSStandards/PHPCSExtra/pull/294 + + +## [1.1.2] - 2023-09-21 + +### Changed + +#### Other + +* Various housekeeping. + +### Fixed + +#### Universal + +* `Universal.CodeAnalysis.ConstructorDestructorReturn`: the sniff will now correctly ignore methods mirroring the class name (PHP-4 style constructors) in namespaced code. [#207], [#272] + +[#272]: https://github.com/PHPCSStandards/PHPCSExtra/pull/272 + + +## [1.1.1] - 2023-08-26 + +### Changed + +#### Modernize + +* `Modernize.FunctionCalls.Dirname`: the sniff will now respect a potentially set [`php_version` configuration option][php_version-config] and only report on modernizations which are possible on the configured `php_version`. [#261] + If the `php_version` is not set, the sniff will continue to report on all modernization options. + +#### Other + +* Various documentation improvements. Props in part to [@szepeviktor]. +* Improved defensive coding in select places. +* Various housekeeping. + +[#261]: https://github.com/PHPCSStandards/PHPCSExtra/pull/261 + + +## [1.1.0] - 2023-07-19 + +### Added + +#### Universal + +* :wrench: :books: New `Universal.CodeAnalysis.NoEchoSprintf` sniff to detect use of the inefficient `echo [v]sprintf(...);` combi and recommends using `[v]printf()` instead. [#242] +* :bar_chart: :books: New `Universal.FunctionDeclarations.NoLongClosures` sniff to detect "long" closures and recommend using a named function instead. [#240] + The sniff offers the following properties to influence its behaviour: `recommendedLines` (defaults to `5`), `maxLines` (defaults to `8`), `ignoreCommentLines` (defaults to `true`) and `ignoreEmptyLines` (defaults to `true`). +* :wrench: :bar_chart: :books: New `Universal.FunctionDeclarations.RequireFinalMethodsInTraits` sniff to enforce non-private, non-abstract methods in traits to be declared as `final`. [#243], [#245] + There is a separate `NonFinalMagicMethodFound` error code for magic methods to allow those to be excluded from the check. +* :wrench: :bar_chart: :books: New `Universal.UseStatements.DisallowMixedGroupUse` sniff to disallow group use statements which import a combination of namespace/OO construct, functions and/or constants in one statement. [#241], [#246] + Note: the fixer will use a semi-standardized format for group use statements. If there are more specific requirements for the formatting of group use statements, the ruleset configurator should ensure that additional sniffs are included in the ruleset to enforce the required format. +* :wrench: :bar_chart: :books: New `Universal.UseStatements.KeywordSpacing` sniff to enforce the use of a single space after the `use`, `function`, `const` keywords and both before and after the `as` keyword in import `use` statements. [#247] + The sniff has modular error codes to allow for disabling individual checks. +* :wrench: :books: New `Universal.UseStatements.NoUselessAliases` sniff to detect useless aliases (aliasing something to its original name) in import use statements. [#244] + Note: as OO and function names in PHP are case-insensitive, aliasing to the same name, using a different case is also considered useless. +* :wrench: :bar_chart: :books: New `Universal.WhiteSpace.CommaSpacing` sniff to enforce that there is no space before a comma and exactly one space, or a new line, after a comma. [#254] + Additionally, the sniff also enforces that the comma should follow the code and not be placed after a trailing comment. + The sniff has modular error codes to allow for disabling individual checks and checks in certain contexts. + The sniff will respect a potentially set [`php_version` configuration option][php_version-config] when deciding how to handle the spacing after a heredoc/nowdoc closer. + +### Changed + +#### Universal + +* Minor performance improvements for the `Universal.Arrays.DuplicateArrayKey` and the `Universal.CodeAnalysis.ConstructorDestructorReturn` sniffs. [#251], [#252] + +#### Other + +* Composer: The minimum `PHPCSUtils` requirement has been updated to `^1.0.8` (was `^1.0.6`). [#249], [#254] +* Various housekeeping. + +[#240]: https://github.com/PHPCSStandards/PHPCSExtra/pull/240 +[#241]: https://github.com/PHPCSStandards/PHPCSExtra/pull/241 +[#242]: https://github.com/PHPCSStandards/PHPCSExtra/pull/242 +[#243]: https://github.com/PHPCSStandards/PHPCSExtra/pull/243 +[#244]: https://github.com/PHPCSStandards/PHPCSExtra/pull/244 +[#245]: https://github.com/PHPCSStandards/PHPCSExtra/pull/245 +[#246]: https://github.com/PHPCSStandards/PHPCSExtra/pull/246 +[#247]: https://github.com/PHPCSStandards/PHPCSExtra/pull/247 +[#249]: https://github.com/PHPCSStandards/PHPCSExtra/pull/249 +[#251]: https://github.com/PHPCSStandards/PHPCSExtra/pull/251 +[#252]: https://github.com/PHPCSStandards/PHPCSExtra/pull/252 +[#254]: https://github.com/PHPCSStandards/PHPCSExtra/pull/254 + + +## [1.0.4] - 2023-06-18 + +### Changed + +#### Other + +* Composer: The minimum `PHPCSUtils` requirement has been updated to `^1.0.6` (was `^1.0.0`). [#237] +* Various housekeeping. + +### Fixed + +#### Universal + +* `Universal.Constants.LowercaseClassResolutionKeyword`: prevent false positives for function calls to methods called `class`. [#226] + +[#226]: https://github.com/PHPCSStandards/PHPCSExtra/pull/226 +[#237]: https://github.com/PHPCSStandards/PHPCSExtra/pull/237 + + +## [1.0.3] - 2023-03-28 + +### Changed + +#### Universal + +* `Universal.WhiteSpace.DisallowInlineTabs`: significant performance improvement. [#216], [#217] + +#### Other + +* Various housekeeping. + +### Fixed + +#### Modernize + +* `Modernize.FunctionCalls.Dirname`: prevent false positives for attribute classes called `dirname`. [#211], [#213] + +[#211]: https://github.com/PHPCSStandards/PHPCSExtra/pull/211 +[#213]: https://github.com/PHPCSStandards/PHPCSExtra/pull/213 +[#216]: https://github.com/PHPCSStandards/PHPCSExtra/pull/216 +[#217]: https://github.com/PHPCSStandards/PHPCSExtra/pull/217 + + +## [1.0.2] - 2023-01-10 + +### Changed + +#### Universal + +* `Universal.CodeAnalysis.ConstructorDestructorReturn`: the sniff will now respect a potentially set [`php_version` configuration option][php_version-config] and only report on PHP4-style constructors when the `php_version` is below `'80000'`. Thanks [@anomiex] for reporting! [#207], [#208] + +[#207]: https://github.com/PHPCSStandards/PHPCSExtra/issues/207 +[#208]: https://github.com/PHPCSStandards/PHPCSExtra/pull/208 + + +## [1.0.1] - 2023-01-05 + +### Fixed + +#### Universal + +* `Universal.CodeAnalysis.ConstructorDestructorReturn`: fixed false positive for return statements in nested functions/closures declared within constructor/destructor methods. Thanks [@anomiex] for reporting! [#201], [#202] + +[#201]: https://github.com/PHPCSStandards/PHPCSExtra/issues/201 +[#202]: https://github.com/PHPCSStandards/PHPCSExtra/pull/202 + + +## [1.0.0] - 2023-01-04 + +:warning: Important: this package now requires [PHPCSUtils 1.0.0]. Please make sure you use `--with-[all-]dependencies` when running `composer update`. :exclamation: + +For the full list of features, please see the changelogs of the alpha/rc releases: +* [1.0.0-rc1](https://github.com/PHPCSStandards/PHPCSExtra/releases/tag/1.0.0-rc1) +* [1.0.0-alpha3](https://github.com/PHPCSStandards/PHPCSExtra/releases/tag/1.0.0-alpha3) +* [1.0.0-alpha2](https://github.com/PHPCSStandards/PHPCSExtra/releases/tag/1.0.0-alpha2) +* [1.0.0-alpha1](https://github.com/PHPCSStandards/PHPCSExtra/releases/tag/1.0.0-alpha1) + +### Changed + +#### Other + +* Updated various sniffs to take advantage of PHPCSUtils 1.0.0(-rc1). [#193], [#194], [#195] +* Minor documentation improvements. +* Various housekeeping. + +### Fixed + +#### Modernize + +* `Modernize.FunctionCalls.Dirname`: the sniff will now correctly recognize magic constants in a case-insensitive manner. [#187] + +[PHPCSUtils 1.0.0]: https://github.com/PHPCSStandards/PHPCSUtils/releases/tag/1.0.0 + +[#187]: https://github.com/PHPCSStandards/PHPCSExtra/pull/187 +[#193]: https://github.com/PHPCSStandards/PHPCSExtra/pull/193 +[#194]: https://github.com/PHPCSStandards/PHPCSExtra/pull/194 +[#195]: https://github.com/PHPCSStandards/PHPCSExtra/pull/195 + + +## [1.0.0-RC1] - 2022-12-07 + +:warning: Important: this package now requires [PHPCSUtils 1.0.0-alpha4]. Please make sure you use `--with-[all-]dependencies` when running `composer update`. :exclamation: + +### Added + +#### Modernize + +* This is a new standard with one sniff to start with. +* :wrench: :books: New `Modernize.FunctionCalls.Dirname` sniff to detect and auto-fix two typical code modernizations which can be made related to the [`dirname()`][php-manual-dirname] function. [#172] + +#### Universal + +* :wrench: :bar_chart: :books: New `Universal.Classes.DisallowAnonClassParentheses` sniff to disallow the use of parentheses when declaring an anonymous class without passing parameters. [#76], [#162] +* :wrench: :bar_chart: :books: New `Universal.Classes.RequireAnonClassParentheses` sniff to require the use of parentheses when declaring an anonymous class, whether parameters are passed or not. [#76], [#166] +* :wrench: :bar_chart: :books: New `Universal.Classes.DisallowFinalClass` sniff to disallow classes being declared `final`. [#108], [#114], [#148], [#163] +* :wrench: :bar_chart: :books: New `Universal.Classes.RequireFinalClass` sniff to require all non-`abstract` classes to be declared `final`. [#109], [#148], [#164] + Warning: the auto-fixer for this sniff _may_ have unintended side-effects for applications and should be used with care! This is considered a _risky_ fixer. +* :wrench: :bar_chart: :books: New `Universal.Classes.ModifierKeywordOrder` sniff to standardize the modifier keyword order for class declarations. [#142] + The sniff offers an `order` property to specify the preferred order. +* :wrench: :books: New `Universal.CodeAnalysis.ConstructorDestructorReturn` sniff to verify that class constructor/destructor methods 1) do not have a return type declaration and 2) do not return a value. [#137], [#140], [#146] Inspired by [@derickr]. +* :wrench: :books: New `Universal.CodeAnalysis.ForeachUniqueAssignment` sniff to detect `foreach` control structures which use the same variable for both the key as well as the value assignment as this will lead to unexpected - and most likely unintended - behaviour. [#110], [#175] + The fixer will maintain the existing behaviour of the code. Mind: this may not be the _intended_ behaviour. +* :wrench: :books: New `Universal.CodeAnalysis.StaticInFinalClass` sniff to detect using `static` instead of `self` in OO constructs which are `final`. [#116], [#180] + The sniff has modular error codes to allow for making exceptions based on the type of use for `static`. +* :wrench: :bar_chart: :books: New `Universal.Constants.LowercaseClassResolutionKeyword` sniff to enforce that the `class` keyword when used for class name resolution, i.e. `::class`, is in lowercase. [#72] +* :wrench: :bar_chart: :books: New `Universal.Constants.ModifierKeywordOrder` sniff to standardize the modifier keyword order for OO constant declarations. [#143] + The sniff offers an `order` property to specify the preferred order. +* :wrench: :books: New `Universal.ControlStructures.DisallowLonelyIf` sniff to disallow `if` statements as the only statement in an `else` block. [#85], [#168], [#169] + Inspired by the [ESLint "no lonely if"] rule. + Note: This sniff will not fix the indentation of the "inner" code. It is strongly recommended to run this sniff together with the `Generic.WhiteSpace.ScopeIndent` sniff to get the correct indentation. +* :bar_chart: :books: New `Universal.Files.SeparateFunctionsFromOO` sniff to enforce that a file should either declare (global/namespaced) functions or declare OO structures, but not both. [#95], [#170], [#171] + Nested function declarations, i.e. functions declared within a function/method will be disregarded for the purposes of this sniff. + The same goes for anonymous classes, closures and arrow functions. +* :books: New `Universal.NamingConventions.NoReservedKeywordParameterNames` sniff to verify that function parameters do not use reserved keywords as names, as this can quickly become confusing when people use them in function calls using named parameters. [#80], [#81], [#106], [#107], [#173] + The sniff has modular error codes to allow for making exceptions for specific keywords. +* :wrench: :bar_chart: :books: New `Universal.Operators.TypeSeparatorSpacing` sniff to enforce no spaces around union type and intersection type separators. [#117] +* :wrench: :books: New `Universal.PHP.OneStatementInShortEchoTag` sniff to disallow short open echo tags `<?=` containing more than one PHP statement. [#89], [#147], [#165] +* :wrench: :bar_chart: :books: New `Universal.WhiteSpace.AnonClassKeywordSpacing` sniff to standardize the amount of spacing between the `class` keyword and the open parenthesis (if any) for anonymous class declarations. [#120] + The sniff offers a `spacing` property to set the amount of spaces the sniff should check for. +* :wrench: :books: New `Universal.WhiteSpace.PrecisionAlignment` sniff to enforce indentation to always be a multiple of a tabstop, i.e. disallow precision alignment. [#119], [#122], [#123], [#124] + Note: + - This sniff does not concern itself with tabs versus spaces. + It is recommended to use the sniff in combination with the PHPCS native `Generic.WhiteSpace.DisallowTabIndent` or the `Generic.WhiteSpace.DisallowSpaceIndent` sniff. + - When using this sniff with tab-based standards, please ensure that the `tab-width` is set and either don't set the `$indent` property or set it to the tab-width (or a multiple thereof). + - The fixer works based on "best guess" and may not always result in the desired indentation. Combine this sniff with the `Generic.WhiteSpace.ScopeIndent` sniff for more precise indentation fixes. + - The behaviour of the sniff is customizable via the following properties: + - `indent`: the indent used for the codebase. + - `ignoreAlignmentBefore`: allows for providing a list of token names for which (preceding) precision alignment should be ignored. + - `ignoreBlankLines`: whether or not potential trailing whitespace on otherwise blank lines should be examined or ignored. + +### Changed + +#### Universal +* `Universal.Arrays.DisallowShortArraySyntax`: the sniff will now record metrics about long vs short array usage. [#154] +* `Universal.Arrays.DuplicateArrayKey`: where relevant, the sniff will now make a distinction between keys which will be duplicate in all PHP version and (numeric) keys which will only be a duplicate key in [PHP < 8.0 or PHP >= 8.0][php-rfc-negative_array_index]. [#177], [#178] + If a [`php_version` configuration option][php_version-config] has been passed to PHPCS, it will be respected by the sniff and only report duplicate keys for the configured PHP version. +* `Universal.ControlStructures.DisallowAlternativeSyntax`: the sniff will now also record a metric when single-line (no body) control structures are encountered. [#158] +* `Universal.ControlStructures.DisallowAlternativeSyntax`: the error message thrown by the sniff is now more descriptive. [#159] +* `Universal.ControlStructures.DisallowAlternativeSyntax`: metrics will no longer be recorded for `elseif` and `else` keywords, but only on the `if` keyword as the type of syntax used has to be the same for the whole "chain". [#161] +* `Universal.Lists.DisallowLongListSyntax`: the sniff will no longer record (incomplete) metrics about long vs short list usage. [#155] +* `Universal.Lists.DisallowShortListSyntax`: the sniff will now record (complete) metrics about long vs short list usage. [#155] +* `Universal.OOStructures.AlphabeticExtendsImplements`: documented support for `enum ... implements`. [#150] +* `Universal.UseStatements.DisallowUseClass`: updated error message and metric name to take PHP 8.1 `enum`s into account. [#149] +* `Universal.UseStatements.NoLeadingBackslash`: the sniff will now also flag and auto-fix leading backslashes in group use statements. [#167] + +#### Other +* Updated the sniffs for compatibility with PHPCSUtils 1.0.0-alpha4. [#134] +* Updated the sniffs to correctly handle PHP 8.0/8.1/8.2 features whenever relevant. +* Readme: Updated installation instructions for compatibility with Composer 2.2+. [#101] +* Composer: The minimum `PHP_CodeSniffer` requirement has been updated to `^3.7.1` (was `^3.3.1`). [#115], [#130] +* Composer: The package will now identify itself as a static analysis tool. Thanks [@GaryJones]! [#126] +* All non-`abstract` classes in this package are now `final`. [#121] +* All XML documentation now has a schema annotation. [#128] +* Various housekeeping. + +### Fixed + +The upgrade to PHPCSUtils 1.0.0-alpha4 took care of a number of bugs, which potentially could have affected sniffs in this package. + +#### NormalizedArrays +* `NormalizedArrays.Arrays.ArrayBraceSpacing`: the sniff now allows for trailing comments after the array opener in multi-line arrays. [#118] +* `NormalizedArrays.Arrays.ArrayBraceSpacing`: trailing comments at the end of an array, but before the closer, in multi-line arrays will no longer confuse the sniff. [#135] +* `NormalizedArrays.Arrays.CommaAfterLast`: the fixer will now recognize PHP 7.3+ flexible heredoc/nowdocs and in that case, will add the comma on the same line as the heredoc/nowdoc closer. [#144] + +#### Universal +* `Universal.Arrays.DisallowShortArraySyntax`: nested short arrays in short lists will now be detected and fixed correctly. [#153] +* `Universal.ControlStructures.DisallowAlternativeSyntax`: the sniff will no longer bow out indiscriminately when the `allowWithInlineHTML` property is set to `true`. [#90], [#161] +* `Universal.ControlStructures.DisallowAlternativeSyntax`: when alternative control structure syntax is allowed in combination with inline HTML (`allowWithInlineHTML` property set to `true`), inline HTML in functions declared within the control structure body will no longer be taken into account for determining whether or not the control structure contains inline HTML. [#160] +* `Universal.Lists.DisallowShortListSyntax`: the sniff will work around a tokenizer bug in PHPCS 3.7.1, which previously could lead to false negatives. [#151]. +* `Universal.Lists.DisallowShortListSyntax`: nested short lists in short arrays will now be detected and fixed correctly. [#152] +* `Universal.Operators.DisallowStandalonePostIncrementDecrement`: the sniff will now correctly recognize stand-alone statements which end on a PHP close tag. [#176] + +[#72]: https://github.com/PHPCSStandards/PHPCSExtra/pull/72 +[#76]: https://github.com/PHPCSStandards/PHPCSExtra/pull/76 +[#80]: https://github.com/PHPCSStandards/PHPCSExtra/pull/80 +[#81]: https://github.com/PHPCSStandards/PHPCSExtra/pull/81 +[#85]: https://github.com/PHPCSStandards/PHPCSExtra/pull/85 +[#89]: https://github.com/PHPCSStandards/PHPCSExtra/pull/89 +[#90]: https://github.com/PHPCSStandards/PHPCSExtra/pull/90 +[#95]: https://github.com/PHPCSStandards/PHPCSExtra/pull/95 +[#101]: https://github.com/PHPCSStandards/PHPCSExtra/pull/101 +[#106]: https://github.com/PHPCSStandards/PHPCSExtra/pull/106 +[#107]: https://github.com/PHPCSStandards/PHPCSExtra/pull/107 +[#108]: https://github.com/PHPCSStandards/PHPCSExtra/pull/108 +[#109]: https://github.com/PHPCSStandards/PHPCSExtra/pull/109 +[#110]: https://github.com/PHPCSStandards/PHPCSExtra/pull/110 +[#114]: https://github.com/PHPCSStandards/PHPCSExtra/pull/114 +[#115]: https://github.com/PHPCSStandards/PHPCSExtra/pull/115 +[#116]: https://github.com/PHPCSStandards/PHPCSExtra/pull/116 +[#117]: https://github.com/PHPCSStandards/PHPCSExtra/pull/117 +[#118]: https://github.com/PHPCSStandards/PHPCSExtra/pull/118 +[#119]: https://github.com/PHPCSStandards/PHPCSExtra/pull/119 +[#120]: https://github.com/PHPCSStandards/PHPCSExtra/pull/120 +[#121]: https://github.com/PHPCSStandards/PHPCSExtra/pull/121 +[#122]: https://github.com/PHPCSStandards/PHPCSExtra/pull/122 +[#123]: https://github.com/PHPCSStandards/PHPCSExtra/pull/123 +[#124]: https://github.com/PHPCSStandards/PHPCSExtra/pull/124 +[#126]: https://github.com/PHPCSStandards/PHPCSExtra/pull/126 +[#128]: https://github.com/PHPCSStandards/PHPCSExtra/pull/128 +[#130]: https://github.com/PHPCSStandards/PHPCSExtra/pull/130 +[#134]: https://github.com/PHPCSStandards/PHPCSExtra/pull/134 +[#135]: https://github.com/PHPCSStandards/PHPCSExtra/pull/135 +[#137]: https://github.com/PHPCSStandards/PHPCSExtra/pull/137 +[#140]: https://github.com/PHPCSStandards/PHPCSExtra/pull/140 +[#142]: https://github.com/PHPCSStandards/PHPCSExtra/pull/142 +[#143]: https://github.com/PHPCSStandards/PHPCSExtra/pull/143 +[#144]: https://github.com/PHPCSStandards/PHPCSExtra/pull/144 +[#146]: https://github.com/PHPCSStandards/PHPCSExtra/pull/146 +[#147]: https://github.com/PHPCSStandards/PHPCSExtra/pull/147 +[#148]: https://github.com/PHPCSStandards/PHPCSExtra/pull/148 +[#149]: https://github.com/PHPCSStandards/PHPCSExtra/pull/149 +[#150]: https://github.com/PHPCSStandards/PHPCSExtra/pull/150 +[#151]: https://github.com/PHPCSStandards/PHPCSExtra/pull/151 +[#152]: https://github.com/PHPCSStandards/PHPCSExtra/pull/152 +[#153]: https://github.com/PHPCSStandards/PHPCSExtra/pull/153 +[#154]: https://github.com/PHPCSStandards/PHPCSExtra/pull/154 +[#155]: https://github.com/PHPCSStandards/PHPCSExtra/pull/155 +[#158]: https://github.com/PHPCSStandards/PHPCSExtra/pull/158 +[#159]: https://github.com/PHPCSStandards/PHPCSExtra/pull/159 +[#160]: https://github.com/PHPCSStandards/PHPCSExtra/pull/160 +[#161]: https://github.com/PHPCSStandards/PHPCSExtra/pull/161 +[#162]: https://github.com/PHPCSStandards/PHPCSExtra/pull/162 +[#163]: https://github.com/PHPCSStandards/PHPCSExtra/pull/163 +[#164]: https://github.com/PHPCSStandards/PHPCSExtra/pull/164 +[#165]: https://github.com/PHPCSStandards/PHPCSExtra/pull/165 +[#166]: https://github.com/PHPCSStandards/PHPCSExtra/pull/166 +[#167]: https://github.com/PHPCSStandards/PHPCSExtra/pull/167 +[#168]: https://github.com/PHPCSStandards/PHPCSExtra/pull/168 +[#169]: https://github.com/PHPCSStandards/PHPCSExtra/pull/169 +[#170]: https://github.com/PHPCSStandards/PHPCSExtra/pull/170 +[#171]: https://github.com/PHPCSStandards/PHPCSExtra/pull/171 +[#172]: https://github.com/PHPCSStandards/PHPCSExtra/pull/172 +[#173]: https://github.com/PHPCSStandards/PHPCSExtra/pull/173 +[#175]: https://github.com/PHPCSStandards/PHPCSExtra/pull/175 +[#176]: https://github.com/PHPCSStandards/PHPCSExtra/pull/176 +[#177]: https://github.com/PHPCSStandards/PHPCSExtra/pull/177 +[#178]: https://github.com/PHPCSStandards/PHPCSExtra/pull/178 +[#180]: https://github.com/PHPCSStandards/PHPCSExtra/pull/180 + +[php-manual-dirname]: https://www.php.net/function.dirname +[php-rfc-negative_array_index]: https://wiki.php.net/rfc/negative_array_index +[ESLint "no lonely if"]: https://eslint.org/docs/rules/no-lonely-if +[PHPCSUtils 1.0.0-alpha4]: https://github.com/PHPCSStandards/PHPCSUtils/releases/tag/1.0.0-alpha4 + + +## [1.0.0-alpha3] - 2020-06-29 + +### Added + +#### Universal + +* :wrench: :books: New `Universal.Arrays.DisallowShortArraySyntax` sniff to disallow short array syntax. [#40] + In contrast to the PHPCS native `Generic.Arrays.DisallowShortArraySyntax` sniff, this sniff will ignore short list syntax and not cause parse errors when the fixer is used. +* :wrench: :bar_chart: :books: New `Universal.Constants.UppercaseMagicConstants` sniff to enforce that PHP native magic constants are in uppercase. [#64] +* :bar_chart: :books: New `Universal.Namespaces.DisallowDeclarationWithoutName` sniff to disallow namespace declarations without a namespace name. [#50] +* :bar_chart: :books: New `Universal.Operators.DisallowLogicalAndOr` sniff to enforce the use of the boolean `&&` and `||` operators instead of the logical `and`/`or` operators. [#52] + Note: as the [operator precedence] of the logical operators is significantly lower than the operator precedence of boolean operators, this sniff does not contain an auto-fixer. +* :bar_chart: :books: New `Universal.Operators.DisallowShortTernary` sniff to disallow the use of short ternaries `?:`. [#42] + While short ternaries are useful when used correctly, the principle of them is often misunderstood and they are more often than not used incorrectly, leading to hard to debug issues and/or PHP warnings/notices. +* :wrench: :bar_chart: :books: New `Universal.Operators.DisallowStandalonePostIncrementDecrement` sniff disallow the use of post-in/decrements in stand-alone statements and discourage the use of multiple increment/decrement operators in a stand-alone statement. [#65] +* :wrench: :bar_chart: :books: New `Universal.Operators.StrictComparisons` sniff to enforce the use of strict comparisons. [#48] + Warning: the auto-fixer for this sniff _may_ cause bugs in applications and should be used with care! This is considered a _risky_ fixer. +* :wrench: :bar_chart: :books: New `Universal.OOStructures.AlphabeticExtendsImplements` sniff to verify that the names used in a class "implements" statement or an interface "extends" statement are listed in alphabetic order. [#55] + * This sniff contains a public `orderby` property to determine the sort order to use for the statement. + If all names used are unqualified, the sort order won't make a difference. + However, if one or more of the names are partially or fully qualified, the chosen sort order will determine how the sorting between unqualified, partially and fully qualified names is handled. + The sniff supports two sort order options: + - _'name'_ : sort by the interface name only (default); + - _'full'_ : sort by the full name as used in the statement (without leading backslash). + In both cases, the sorting will be done using natural sort, case-insensitive. + * The sniff has modular error codes to allow for selective inclusion/exclusion: + - `ImplementsWrongOrder` - for "class implements" statements. + - `ImplementsWrongOrderWithComments` - for "class implements" statements interlaced with comments. These will not be auto-fixed. + - `ExtendsWrongOrder` - for "interface extends" statements. + - `ExtendsWrongOrderWithComments` - for "interface extends" statements interlaced with comments. These will not be auto-fixed. + * When fixing, the existing spacing between the names in an `implements`/`extends` statement will not be maintained. + The fixer will separate each name with a comma and one space. + If alternative formatting is desired, a sniff which will check and fix the formatting should be added to the ruleset. +* :wrench: :bar_chart: :books: New `Universal.UseStatements.LowercaseFunctionConst` sniff to enforce that `function` and `const` keywords when used in an import `use` statement are always lowercase. [#58] +* :wrench: :bar_chart: :books: New `Universal.UseStatements.NoLeadingBackslash` sniff to verify that a name being imported in an import `use` statement does not start with a leading backslash. [#46] + Names in import `use` statements should always be fully qualified, so a leading backslash is not needed and it is strongly recommended not to use one. + This sniff handles all types of import use statements supported by PHP, in contrast to other sniffs for the same in, for instance, the PSR12 or the Slevomat standard, which are incomplete. +* :wrench: :books: New `Universal.WhiteSpace.DisallowInlineTabs` sniff to enforce using spaces for mid-line alignment. [#43] + +### Changed + +#### Other +* The `master` branch has been renamed to `stable`. +* Composer: The version requirements for the [Composer PHPCS plugin] have been widened to allow for version 0.7.0 which supports Composer 2.0.0. [#62] +* Various housekeeping. + +[#40]: https://github.com/PHPCSStandards/PHPCSExtra/pull/40 +[#42]: https://github.com/PHPCSStandards/PHPCSExtra/pull/42 +[#43]: https://github.com/PHPCSStandards/PHPCSExtra/pull/43 +[#46]: https://github.com/PHPCSStandards/PHPCSExtra/pull/46 +[#48]: https://github.com/PHPCSStandards/PHPCSExtra/pull/48 +[#50]: https://github.com/PHPCSStandards/PHPCSExtra/pull/50 +[#52]: https://github.com/PHPCSStandards/PHPCSExtra/pull/52 +[#55]: https://github.com/PHPCSStandards/PHPCSExtra/pull/55 +[#58]: https://github.com/PHPCSStandards/PHPCSExtra/pull/58 +[#62]: https://github.com/PHPCSStandards/PHPCSExtra/pull/62 +[#64]: https://github.com/PHPCSStandards/PHPCSExtra/pull/64 +[#65]: https://github.com/PHPCSStandards/PHPCSExtra/pull/65 + +[operator precedence]: https://www.php.net/language.operators.precedence + + +## [1.0.0-alpha2] - 2020-02-18 + +### Added + +#### Universal +* :wrench: :bar_chart: :books: New `Universal.ControlStructures.DisallowAlternativeSyntax` sniff to disallow using the alternative syntax for control structures. [#23] + - This sniff contains a `allowWithInlineHTML` property to allow alternative syntax when inline HTML is used within the control structure. In all other cases, the use of the alternative syntax will still be disallowed. + - The sniff has modular error codes to allow for making exceptions based on specific control structures and/or specific control structures in combination with inline HTML. +* :bar_chart: `Universal.UseStatements.DisallowUseClass/Function/Const`: new, additional metrics about the import source will be shown in the `info` report. [#25] + +#### Other +* Readme: installation instructions and sniff list. [#26] + +### Changed + +#### Universal +* `Universal.Arrays.DuplicateArrayKey`: wording of the error message. [#18] +* `Universal.UseStatements.DisallowUseClass/Function/Const`: the error codes have been made more modular. [#25] + Each of these sniffs now has four additional error codes: + <ul> + <li><code>FoundSameNamespace</code>, <code>FoundSameNamespaceWithAlias</code> for <code>use</code> statements importing from the same namespace;</li> + <li><code>FoundGlobalNamespace</code>, <code>FoundGlobalNamespaceWithAlias</code> for <code>use</code> statements importing from the global namespace, like import statements for PHP native classes, functions and constants.</li> + </ul> + In all other circumstances, the existing error codes <code>FoundWithAlias</code> and <code>FoundWithoutAlias</code> will continue to be used. + +#### Other +* Improved formatting of the CLI documentation which can be viewed using `--generator=text`. [#17] +* Various housekeeping. + +### Fixed + +#### Universal +* `Universal.Arrays.DuplicateArrayKey`: improved handling of parse errors. [#34] +* `Universal.ControlStructures.IfElseDeclaration`: the fixer will now respect tab indentation. [#19] +* `Universal.UseStatements.DisallowUseClass/Function/Const`: the determination of whether a import is aliased in now done in a case-insensitive manner. [#25] +* `Universal.UseStatements.DisallowUseClass/Function/Const`: an import from the global namespace would previously always be seen as non-aliased, even when it was aliased. [#25] +* `Universal.UseStatements.DisallowUseClass/Function/Const`: improved tolerance for `use` import statements with leading backslashes. [#25] + +[#17]: https://github.com/PHPCSStandards/PHPCSExtra/pull/17 +[#18]: https://github.com/PHPCSStandards/PHPCSExtra/pull/18 +[#19]: https://github.com/PHPCSStandards/PHPCSExtra/pull/19 +[#23]: https://github.com/PHPCSStandards/PHPCSExtra/pull/23 +[#25]: https://github.com/PHPCSStandards/PHPCSExtra/pull/25 +[#26]: https://github.com/PHPCSStandards/PHPCSExtra/pull/26 +[#34]: https://github.com/PHPCSStandards/PHPCSExtra/pull/34 + + +## 1.0.0-alpha1 - 2020-01-23 + +Initial alpha release containing: +* A `NormalizedArrays` standard which will contain a full set of sniffs to check the formatting of array declarations. +* A `Universal` standard which will contain a collection of universal sniffs. + DO NOT INCLUDE THIS AS A STANDARD. + `Universal`, like the upstream PHPCS `Generic` standard, contains sniffs which contradict each other. + Include individual sniffs from this standard in a custom project/company ruleset to use them. + +This initial alpha release contains the following sniffs: + +### NormalizedArrays +* :wrench: :bar_chart: :books: `NormalizedArrays.Arrays.ArrayBraceSpacing`: enforce consistent spacing for the open/close braces of array declarations. + The sniff allows for having different settings for: + - Space between the array keyword and the open parenthesis for long arrays via the `keywordSpacing` property. + Accepted values: (int) number of spaces or `false` to turn this check off. Defaults to `0` spaces. + - Spaces on the inside of the braces for empty arrays via the `spacesWhenEmpty` property. + Accepted values: (string) `newline`, (int) number of spaces or `false` to turn this check off. Defaults to `0` spaces. + - Spaces on the inside of the braces for single-line arrays via the `spacesSingleLine` property; + Accepted values: (int) number of spaces or `false` to turn this check off. Defaults to `0` spaces. + - Spaces on the inside of the braces for multi-line arrays via the `spacesMultiLine` property. + Accepted values: (string) `newline`, (int) number of spaces or `false` to turn this check off. Defaults to `newline`. + Note: if any of the above properties are set to `newline`, it is recommended to also include an array indentation sniff. This sniff will not handle the indentation. +* :wrench: :bar_chart: :books: `NormalizedArrays.Arrays.CommaAfterLast`: enforce/forbid a comma after the last item in an array declaration. + By default, this sniff will: + <ul> + <li>forbid a comma after the last array item for single-line arrays.</li> + <li>enforce a comma after the last array item for multi-line arrays.</li> + </ul> + This can be changed for each type or array individually by setting the <code>singleLine</code> or <code>multiLine</code> properties in a custom ruleset. + The valid values are: <code>enforce</code>, <code>forbid</code> or <code>skip</code> to not check the comma after the last array item for a particular type of array. + +### Universal +* :books: `Universal.Arrays.DuplicateArrayKey`: detects duplicate array keys in array declarations. +* :books: `Universal.Arrays.MixedArrayKeyTypes`: best practice sniff: don't use a mix of integer and numeric keys for array items. +* :books: `Universal.Arrays.MixedKeyedUnkeyedArray`: best practice sniff: don't use a mix of keyed and unkeyed array items. +* :wrench: :bar_chart: :books: `Universal.ControlStructures.IfElseDeclaration`: verify that else(if) statements with braces are on a new line. +* :wrench: :bar_chart: :books: `Universal.Lists.DisallowLongListSyntax`: disallow the use of long `list`s. +* :wrench: :bar_chart: :books: `Universal.Lists.DisallowShortListSyntax`: disallow the use of short lists. +* :bar_chart: :books: `Universal.Namespaces.DisallowCurlyBraceSyntax`: disallow the use of the alternative namespace declaration syntax using curly braces. +* :bar_chart: :books: `Universal.Namespaces.EnforceCurlyBraceSyntax`: enforce the use of the alternative namespace syntax using curly braces. +* :books: `Universal.Namespaces.OneDeclarationPerFile`: disallow the use of multiple namespaces within a file. +* :bar_chart: :books: `Universal.UseStatements.DisallowUseClass`: forbid using import use statements for classes/traits/interfaces. + Individual sub-types can be allowed by excluding specific error codes. +* :bar_chart: :books: `Universal.UseStatements.DisallowUseConst`: forbid using import use statements for constants. + Individual sub-types can be allowed by excluding specific error codes. +* :bar_chart: :books: `Universal.UseStatements.DisallowUseFunction`: forbid using import use statements for functions. + Individual sub-types can be allowed by excluding specific error codes. + +[Composer PHPCS plugin]: https://github.com/PHPCSStandards/composer-installer +[php_version-config]: https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Configuration-Options#setting-the-php-version + +[Unreleased]: https://github.com/PHPCSStandards/PHPCSExtra/compare/stable...HEAD +[1.2.1]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.2.0...1.2.1 +[1.2.0]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.1.2...1.2.0 +[1.1.2]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.1.1...1.1.2 +[1.1.1]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.1.0...1.1.1 +[1.1.0]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.0.4...1.1.0 +[1.0.4]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.0.3...1.0.4 +[1.0.3]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.0.2...1.0.3 +[1.0.2]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.0.1...1.0.2 +[1.0.1]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.0.0...1.0.1 +[1.0.0]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.0.0-rc1...1.0.0 +[1.0.0-RC1]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.0.0-alpha3...1.0.0-rc1 +[1.0.0-alpha3]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.0.0-alpha2...1.0.0-alpha3 +[1.0.0-alpha2]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.0.0-alpha1...1.0.0-alpha2 + +[@anomiex]: https://github.com/anomiex +[@derickr]: https://github.com/derickr +[@diedexx]: https://github.com/diedexx +[@fredden]: https://github.com/fredden +[@GaryJones]: https://github.com/GaryJones +[@stronk7]: https://github.com/stronk7 +[@szepeviktor]: https://github.com/szepeviktor diff --git a/vendor/phpcsstandards/phpcsextra/LICENSE b/vendor/phpcsstandards/phpcsextra/LICENSE new file mode 100644 index 00000000..0a041280 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/vendor/phpcsstandards/phpcsextra/Modernize/Docs/FunctionCalls/DirnameStandard.xml b/vendor/phpcsstandards/phpcsextra/Modernize/Docs/FunctionCalls/DirnameStandard.xml new file mode 100644 index 00000000..5f486646 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Modernize/Docs/FunctionCalls/DirnameStandard.xml @@ -0,0 +1,40 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Function Calls to Dirname" + > + <standard> + <![CDATA[ + PHP >= 5.3: Usage of dirname(__FILE__) can be replaced with __DIR__. + ]]> + </standard> + <code_comparison> + <code title="Valid: Using __DIR__."> + <![CDATA[ +$path = <em>__DIR__</em>; + ]]> + </code> + <code title="Invalid: dirname(__FILE__)."> + <![CDATA[ +$path = <em>dirname(__FILE__)</em>; + ]]> + </code> + </code_comparison> + <standard> + <![CDATA[ + PHP >= 7.0: Nested calls to dirname() can be replaced by using dirname() with the $levels parameter. + ]]> + </standard> + <code_comparison> + <code title="Valid: Using dirname() with the $levels parameter."> + <![CDATA[ +$path = <em>dirname($file, 3)</em>; + ]]> + </code> + <code title="Invalid: Nested function calls to dirname()."> + <![CDATA[ +$path = <em>dirname(dirname(dirname($file)))</em>; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Modernize/Sniffs/FunctionCalls/DirnameSniff.php b/vendor/phpcsstandards/phpcsextra/Modernize/Sniffs/FunctionCalls/DirnameSniff.php new file mode 100644 index 00000000..b064b264 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Modernize/Sniffs/FunctionCalls/DirnameSniff.php @@ -0,0 +1,382 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Modernize\Sniffs\FunctionCalls; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\BackCompat\Helper; +use PHPCSUtils\Tokens\Collections; +use PHPCSUtils\Utils\Context; +use PHPCSUtils\Utils\PassedParameters; + +/** + * Detect `dirname(__FILE__)` and nested uses of `dirname()`. + * + * @since 1.0.0 + */ +final class DirnameSniff implements Sniff +{ + + /** + * PHP version as configured or 0 if unknown. + * + * @since 1.1.1 + * + * @var int + */ + private $phpVersion; + + /** + * Registers the tokens that this sniff wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_STRING]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if (isset($this->phpVersion) === false || \defined('PHP_CODESNIFFER_IN_TESTS')) { + // Set default value to prevent this code from running every time the sniff is triggered. + $this->phpVersion = 0; + + $phpVersion = Helper::getConfigData('php_version'); + if ($phpVersion !== null) { + $this->phpVersion = (int) $phpVersion; + } + } + + if ($this->phpVersion !== 0 && $this->phpVersion < 50300) { + // PHP version too low, nothing to do. + return; + } + + $tokens = $phpcsFile->getTokens(); + + if (\strtolower($tokens[$stackPtr]['content']) !== 'dirname') { + // Not our target. + return; + } + + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($nextNonEmpty === false + || $tokens[$nextNonEmpty]['code'] !== \T_OPEN_PARENTHESIS + || isset($tokens[$nextNonEmpty]['parenthesis_owner']) === true + ) { + // Not our target. + return; + } + + if (isset($tokens[$nextNonEmpty]['parenthesis_closer']) === false) { + // Live coding or parse error, ignore. + return; + } + + if (Context::inAttribute($phpcsFile, $stackPtr) === true) { + // Class instantiation in attribute, not function call. + return; + } + + // Check if it is really a function call to the global function. + $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); + + if (isset(Collections::objectOperators()[$tokens[$prevNonEmpty]['code']]) === true + || $tokens[$prevNonEmpty]['code'] === \T_NEW + ) { + // Method call, class instantiation or other "not our target". + return; + } + + if ($tokens[$prevNonEmpty]['code'] === \T_NS_SEPARATOR) { + $prevPrevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($prevNonEmpty - 1), null, true); + if ($tokens[$prevPrevToken]['code'] === \T_STRING + || $tokens[$prevPrevToken]['code'] === \T_NAMESPACE + ) { + // Namespaced function. + return; + } + } + + /* + * As of here, we can be pretty sure this is a function call to the global function. + */ + $opener = $nextNonEmpty; + $closer = $tokens[$nextNonEmpty]['parenthesis_closer']; + + $parameters = PassedParameters::getParameters($phpcsFile, $stackPtr); + $paramCount = \count($parameters); + if (empty($parameters) || $paramCount > 2) { + // No parameters or too many parameter. + return; + } + + $pathParam = PassedParameters::getParameterFromStack($parameters, 1, 'path'); + if ($pathParam === false) { + // If the path parameter doesn't exist, there's nothing to do. + return; + } + + $levelsParam = PassedParameters::getParameterFromStack($parameters, 2, 'levels'); + if ($levelsParam === false && $paramCount === 2) { + // There must be a typo in the param name or an otherwise stray parameter. Ignore. + return; + } + + /* + * PHP 5.3+: Detect use of dirname(__FILE__). + */ + if (\strtoupper($pathParam['clean']) === '__FILE__') { + $levelsValue = false; + + // Determine if the issue is auto-fixable. + $hasComment = $phpcsFile->findNext(Tokens::$commentTokens, ($opener + 1), $closer); + $fixable = ($hasComment === false); + + if ($fixable === true) { + $levelsValue = $this->getLevelsValue($phpcsFile, $levelsParam); + if ($levelsParam !== false && $levelsValue === false) { + // Can't autofix if we don't know the value of the $levels parameter. + $fixable = false; + } + } + + $error = 'Use the __DIR__ constant instead of calling dirname(__FILE__) (PHP >= 5.3)'; + $code = 'FileConstant'; + + // Throw the error. + if ($fixable === false) { + $phpcsFile->addError($error, $stackPtr, $code); + return; + } + + $fix = $phpcsFile->addFixableError($error, $stackPtr, $code); + if ($fix === true) { + if ($levelsParam === false || $levelsValue === 1) { + // No $levels or $levels set to 1: we can replace the complete function call. + $phpcsFile->fixer->beginChangeset(); + + $phpcsFile->fixer->replaceToken($stackPtr, '__DIR__'); + + for ($i = ($stackPtr + 1); $i <= $closer; $i++) { + $phpcsFile->fixer->replaceToken($i, ''); + } + + // Remove potential leading \. + if ($tokens[$prevNonEmpty]['code'] === \T_NS_SEPARATOR) { + $phpcsFile->fixer->replaceToken($prevNonEmpty, ''); + } + + $phpcsFile->fixer->endChangeset(); + } else { + // We can replace the $path parameter and will need to adjust the $levels parameter. + $filePtr = $phpcsFile->findNext(\T_FILE, $pathParam['start'], ($pathParam['end'] + 1)); + $levelsPtr = $phpcsFile->findNext(\T_LNUMBER, $levelsParam['start'], ($levelsParam['end'] + 1)); + + $phpcsFile->fixer->beginChangeset(); + $phpcsFile->fixer->replaceToken($filePtr, '__DIR__'); + $phpcsFile->fixer->replaceToken($levelsPtr, ($levelsValue - 1)); + $phpcsFile->fixer->endChangeset(); + } + } + + return; + } + + /* + * PHP 7.0+: Detect use of nested calls to dirname(). + */ + if ($this->phpVersion !== 0 && $this->phpVersion < 70000) { + // No need to check for this issue if the PHP version would not allow for it anyway. + return; + } + + if (\preg_match('`^\s*\\\\?dirname\s*\(`i', $pathParam['clean']) !== 1) { + return; + } + + /* + * Check if there is something _behind_ the nested dirname() call within the same parameter. + * + * Note: the findNext() calls are safe and will always match the dirname() function call + * as otherwise the above regex wouldn't have matched. + */ + $innerDirnamePtr = $phpcsFile->findNext(\T_STRING, $pathParam['start'], ($pathParam['end'] + 1)); + $innerOpener = $phpcsFile->findNext(\T_OPEN_PARENTHESIS, ($innerDirnamePtr + 1), ($pathParam['end'] + 1)); + if (isset($tokens[$innerOpener]['parenthesis_closer']) === false) { + // Shouldn't be possible. + return; // @codeCoverageIgnore + } + + $innerCloser = $tokens[$innerOpener]['parenthesis_closer']; + if ($innerCloser !== $pathParam['end']) { + $hasContentAfter = $phpcsFile->findNext( + Tokens::$emptyTokens, + ($innerCloser + 1), + ($pathParam['end'] + 1), + true + ); + if ($hasContentAfter !== false) { + // Matched code like: `dirname(dirname($file) . 'something')`. Ignore. + return; + } + } + + /* + * Determine if this is an auto-fixable error. + */ + + // Step 1: Are there comments ? If so, not auto-fixable as we don't want to remove comments. + $fixable = true; + $outerLevelsValue = false; + $innerParameters = []; + $innerLevelsParam = false; + $innerLevelsValue = false; + + for ($i = ($opener + 1); $i < $closer; $i++) { + if (isset(Tokens::$commentTokens[$tokens[$i]['code']])) { + $fixable = false; + break; + } + + if ($tokens[$i]['code'] === \T_OPEN_PARENTHESIS + && isset($tokens[$i]['parenthesis_closer']) + ) { + // Skip over everything within the nested dirname() function call. + $i = $tokens[$i]['parenthesis_closer']; + } + } + + // Step 2: Does the `$levels` parameter exist for the outer dirname() call and if so, is it usable ? + if ($fixable === true) { + $outerLevelsValue = $this->getLevelsValue($phpcsFile, $levelsParam); + if ($levelsParam !== false && $outerLevelsValue === false) { + // Can't autofix if we don't know the value of the $levels parameter. + $fixable = false; + } + } + + // Step 3: Does the `$levels` parameter exist for the inner dirname() call and if so, is it usable ? + if ($fixable === true) { + $innerParameters = PassedParameters::getParameters($phpcsFile, $innerDirnamePtr); + $innerLevelsParam = PassedParameters::getParameterFromStack($innerParameters, 2, 'levels'); + $innerLevelsValue = $this->getLevelsValue($phpcsFile, $innerLevelsParam); + if ($innerLevelsParam !== false && $innerLevelsValue === false) { + // Can't autofix if we don't know the value of the $levels parameter. + $fixable = false; + } + } + + /* + * Throw the error. + */ + $error = 'Pass the $levels parameter to the dirname() call instead of using nested dirname() calls'; + $error .= ' (PHP >= 7.0)'; + $code = 'Nested'; + + if ($fixable === false) { + $phpcsFile->addError($error, $stackPtr, $code); + return; + } + + $fix = $phpcsFile->addFixableError($error, $stackPtr, $code); + if ($fix === false) { + return; + } + + /* + * Fix the error. + */ + $phpcsFile->fixer->beginChangeset(); + + // Remove the info in the _outer_ param call. + for ($i = $opener; $i < $innerOpener; $i++) { + $phpcsFile->fixer->replaceToken($i, ''); + } + + for ($i = ($innerCloser + 1); $i <= $closer; $i++) { + $phpcsFile->fixer->replaceToken($i, ''); + } + + if ($innerLevelsParam !== false) { + // Inner $levels parameter already exists, just adjust the value. + $innerLevelsPtr = $phpcsFile->findNext( + \T_LNUMBER, + $innerLevelsParam['start'], + ($innerLevelsParam['end'] + 1) + ); + $phpcsFile->fixer->replaceToken($innerLevelsPtr, ($innerLevelsValue + $outerLevelsValue)); + } else { + // Inner $levels parameter does not exist yet. We need to add it. + $content = ', '; + + $prevBeforeCloser = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($innerCloser - 1), null, true); + if ($tokens[$prevBeforeCloser]['code'] === \T_COMMA) { + // Trailing comma found, no need to add the comma. + $content = ' '; + } + + $innerPathParam = PassedParameters::getParameterFromStack($innerParameters, 1, 'path'); + if (isset($innerPathParam['name_token']) === true) { + // Non-named param cannot follow named param, so add param name. + $content .= 'levels: '; + } + + $content .= ($innerLevelsValue + $outerLevelsValue); + $phpcsFile->fixer->addContentBefore($innerCloser, $content); + } + + $phpcsFile->fixer->endChangeset(); + } + + /** + * Determine the value of the $levels parameter passed to dirname(). + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param array<string, int|string>|false $levelsParam The information about the parameter as retrieved + * via PassedParameters::getParameterFromStack(). + * + * @return int|false Integer levels value or FALSE if the levels value couldn't be determined. + */ + private function getLevelsValue($phpcsFile, $levelsParam) + { + if ($levelsParam === false) { + return 1; + } + + $ignore = Tokens::$emptyTokens; + $ignore[] = \T_LNUMBER; + + $hasNonNumber = $phpcsFile->findNext($ignore, $levelsParam['start'], ($levelsParam['end'] + 1), true); + if ($hasNonNumber !== false) { + return false; + } + + return (int) $levelsParam['clean']; + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Modernize/ruleset.xml b/vendor/phpcsstandards/phpcsextra/Modernize/ruleset.xml new file mode 100644 index 00000000..c30d745d --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Modernize/ruleset.xml @@ -0,0 +1,5 @@ +<?xml version="1.0"?> +<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Modernize" namespace="PHPCSExtra\Modernize" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/PHPCSStandards/PHP_CodeSniffer/master/phpcs.xsd"> + + <description>A collection of sniffs to detect code modernization opportunities.</description> +</ruleset> diff --git a/vendor/phpcsstandards/phpcsextra/NormalizedArrays/Docs/Arrays/ArrayBraceSpacingStandard.xml b/vendor/phpcsstandards/phpcsextra/NormalizedArrays/Docs/Arrays/ArrayBraceSpacingStandard.xml new file mode 100644 index 00000000..e8a006f0 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/NormalizedArrays/Docs/Arrays/ArrayBraceSpacingStandard.xml @@ -0,0 +1,94 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Array Brace Spacing" + > + <standard> + <![CDATA[ + There should be no space between the "array" keyword and the array open brace. + ]]> + </standard> + <code_comparison> + <code title="Valid: No space between the keyword and the open brace."> + <![CDATA[ +$args = array(1, 2); + ]]> + </code> + <code title="Invalid: Space between the keyword and the open brace."> + <![CDATA[ +$args = array<em> </em>(1, 2); + ]]> + </code> + </code_comparison> + <standard> + <![CDATA[ + There should be no space between the array open brace and the array close brace for an empty array. + ]]> + </standard> + <code_comparison> + <code title="Valid: No space between the braces."> + <![CDATA[ +$args = array(); + +$args = []; + ]]> + </code> + <code title="Invalid: Space between the braces."> + <![CDATA[ +$args = array(<em> </em>); + +$args = [<em> </em>]; + ]]> + </code> + </code_comparison> + <standard> + <![CDATA[ + There should be no space after the array open brace and before the array close brace in a single-line array. + ]]> + </standard> + <code_comparison> + <code title="Valid: No space on the inside of the braces."> + <![CDATA[ +$args = array(1, 2); + +$args = [1, 2]; + ]]> + </code> + <code title="Invalid: Space on the inside of the braces."> + <![CDATA[ +$args = array(<em> </em>1, 2<em> </em>); + +$args = [<em> </em>1, 2<em> </em>]; + ]]> + </code> + </code_comparison> + <standard> + <![CDATA[ + There should be a new line after the array open brace and before the array close brace in a multi-line array. + ]]> + </standard> + <code_comparison> + <code title="Valid: One new line after the open brace and before the close brace."> + <![CDATA[ +$args = array(<em> +</em> 1, + 2<em> +</em>); + +$args = [<em> +</em> 1, + 2<em> +</em>]; + ]]> + </code> + <code title="Invalid: No new lines after the open brace and/or before the close brace."> + <![CDATA[ +$args = array(1, + 2); + +$args = [1, + 2]; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/NormalizedArrays/Docs/Arrays/CommaAfterLastStandard.xml b/vendor/phpcsstandards/phpcsextra/NormalizedArrays/Docs/Arrays/CommaAfterLastStandard.xml new file mode 100644 index 00000000..c5094c5c --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/NormalizedArrays/Docs/Arrays/CommaAfterLastStandard.xml @@ -0,0 +1,43 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Comma After Last Array Item" + > + <standard> + <![CDATA[ + For single-line arrays, there should be <em>no</em> comma after the last array item. + + However, for multi-line arrays, there <em>should</em> be a comma after the last array item. + ]]> + </standard> + <code_comparison> + <code title="Valid: Single-line array without a comma after the last item"> + <![CDATA[ +$args = array(1, 2, 3); + ]]> + </code> + <code title="Invalid: Single-line array with a comma after the last item"> + <![CDATA[ +$args = array(1, 2, 3<em>,</em> ); + ]]> + </code> + </code_comparison> + <code_comparison> + <code title="Valid: Multi-line array with a comma after the last item"> + <![CDATA[ +$args = [ + 1 => 'foo', + 2 => 'bar'<em>,</em> +]; + ]]> + </code> + <code title="Invalid: Multi-line array without a comma after the last item"> + <![CDATA[ +$args = [ + 1 => 'foo', + 2 => 'bar' +]; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/NormalizedArrays/Sniffs/Arrays/ArrayBraceSpacingSniff.php b/vendor/phpcsstandards/phpcsextra/NormalizedArrays/Sniffs/Arrays/ArrayBraceSpacingSniff.php new file mode 100644 index 00000000..b6317707 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/NormalizedArrays/Sniffs/Arrays/ArrayBraceSpacingSniff.php @@ -0,0 +1,305 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\NormalizedArrays\Sniffs\Arrays; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\Fixers\SpacesFixer; +use PHPCSUtils\Tokens\Collections; +use PHPCSUtils\Utils\Arrays; + +/** + * Enforce consistent spacing for the open/close braces of arrays. + * + * The sniff allows for having different settings for: + * - space between the `array` keyword and the open parenthesis for long arrays; + * - spaces on the inside of the braces for single-line arrays; + * - spaces on the inside of the braces for multi-line arrays; + * - spaces on the inside of the braces for empty arrays. + * + * Note: If 'newline' is expected and _no_ new line is encountered, a new line will be + * added, but no assumptions will be made about the intended indentation of the code. + * This should be handled by a (separate) indentation sniff. + * + * @since 1.0.0 + */ +final class ArrayBraceSpacingSniff implements Sniff +{ + + /** + * Number of spaces which should be between the `array` keyword and the open parenthesis for long arrays. + * + * Accepted values: + * - (int) number of spaces. + * - or `false` to turn this check off. + * + * Defaults to 0 spaces. + * + * @since 1.0.0 + * + * @var int|false + */ + public $keywordSpacing = 0; + + /** + * Number of spaces to enforce between the braces for an empty array. + * + * Accepted values: + * - (string) 'newline' + * - (int) number of spaces. + * - or `false` to turn this check off. + * + * Defaults to 0 spaces. + * + * @since 1.0.0 + * + * @var string|int|false + */ + public $spacesWhenEmpty = 0; + + /** + * Number of spaces which should be on the inside of array braces for a single-line array. + * + * Accepted values: + * - (int) number of spaces. + * - or `false` to turn this check off. + * + * Defaults to 0 spaces. + * + * @since 1.0.0 + * + * @var int|false + */ + public $spacesSingleLine = 0; + + /** + * Number of spaces which should be on the inside of array braces for a multi-line array. + * + * Accepted values: + * - (string) 'newline' + * - (int) number of spaces. + * - or `false` to turn this check off. + * + * Defaults to 'newline'. + * + * @since 1.0.0 + * + * @var string|int|false + */ + public $spacesMultiLine = 'newline'; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return Collections::arrayOpenTokensBC(); + } + + /** + * Processes this test when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The PHP_CodeSniffer file where the + * token was found. + * @param int $stackPtr The position in the PHP_CodeSniffer + * file's token stack where the token + * was found. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + /* + * Normalize the public settings. + */ + if ($this->keywordSpacing !== false) { + $this->keywordSpacing = \max((int) $this->keywordSpacing, 0); + } + + if ($this->spacesSingleLine !== false) { + $this->spacesSingleLine = \max((int) $this->spacesSingleLine, 0); + } + + if ($this->spacesMultiLine !== false && $this->spacesMultiLine !== 'newline') { + $this->spacesMultiLine = \max((int) $this->spacesMultiLine, 0); + } + + if ($this->spacesWhenEmpty !== false && $this->spacesWhenEmpty !== 'newline') { + $this->spacesWhenEmpty = \max((int) $this->spacesWhenEmpty, 0); + } + + if ($this->keywordSpacing === false + && $this->spacesSingleLine === false + && $this->spacesMultiLine === false + && $this->spacesWhenEmpty === false + ) { + // Nothing to do. Why was the sniff turned on at all ? + return; + } + + $openClose = Arrays::getOpenClose($phpcsFile, $stackPtr); + if ($openClose === false) { + // Live coding, short list or real square brackets. + return; + } + + $tokens = $phpcsFile->getTokens(); + $opener = $openClose['opener']; + $closer = $openClose['closer']; + + /* + * Check the spacing between the array keyword and the open parenthesis for long arrays. + */ + if ($tokens[$stackPtr]['code'] === \T_ARRAY && $this->keywordSpacing !== false) { + $error = 'There should be %s between the "array" keyword and the open parenthesis. Found: %s'; + $code = 'SpaceAfterKeyword'; + + SpacesFixer::checkAndFix( + $phpcsFile, + $stackPtr, + $opener, + $this->keywordSpacing, + $error, + $code, + 'error', + 0, + 'Space between array keyword and open brace' + ); + } + + /* + * Check for empty arrays. + */ + $nextNonWhiteSpace = $phpcsFile->findNext(\T_WHITESPACE, ($opener + 1), null, true); + if ($nextNonWhiteSpace === $closer) { + if ($this->spacesWhenEmpty === false) { + // Check was turned off. + return; + } + + $error = 'There should be %s between the array opener and closer for an empty array. Found: %s'; + $code = 'EmptyArraySpacing'; + + SpacesFixer::checkAndFix( + $phpcsFile, + $opener, + $closer, + $this->spacesWhenEmpty, + $error, + $code, + 'error', + 0, + 'Space between open and close brace for an empty array' + ); + + return; + } + + /* + * Check non-empty arrays. + */ + if ($tokens[$opener]['line'] === $tokens[$closer]['line']) { + // Single line array. + if ($this->spacesSingleLine === false) { + // Check was turned off. + return; + } + + $error = 'Expected %s after the array opener in a single line array. Found: %s'; + $code = 'SpaceAfterArrayOpenerSingleLine'; + + SpacesFixer::checkAndFix( + $phpcsFile, + $opener, + $phpcsFile->findNext(\T_WHITESPACE, ($opener + 1), null, true), + $this->spacesSingleLine, + $error, + $code, + 'error', + 0, + 'Space after array opener, single line array' + ); + + $error = 'Expected %s before the array closer in a single line array. Found: %s'; + $code = 'SpaceBeforeArrayCloserSingleLine'; + + SpacesFixer::checkAndFix( + $phpcsFile, + $closer, + $phpcsFile->findPrevious(\T_WHITESPACE, ($closer - 1), null, true), + $this->spacesSingleLine, + $error, + $code, + 'error', + 0, + 'Space before array closer, single line array' + ); + + return; + } + + // Multi-line array. + if ($this->spacesMultiLine === false) { + // Check was turned off. + return; + } + + $error = 'Expected %s after the array opener in a multi line array. Found: %s'; + $code = 'SpaceAfterArrayOpenerMultiLine'; + + $nextNonWhitespace = $phpcsFile->findNext(\T_WHITESPACE, ($opener + 1), null, true); + if ($this->spacesMultiLine === 'newline') { + // Check for a trailing comment after the array opener and allow for it. + if (($tokens[$nextNonWhitespace]['code'] === \T_COMMENT + || isset(Tokens::$phpcsCommentTokens[$tokens[$nextNonWhitespace]['code']]) === true) + && $tokens[$nextNonWhitespace]['line'] === $tokens[$opener]['line'] + ) { + // We found a trailing comment after array opener. Treat that as the opener instead. + $opener = $nextNonWhitespace; + $nextNonWhitespace = $phpcsFile->findNext(\T_WHITESPACE, ($opener + 1), null, true); + } + } + + SpacesFixer::checkAndFix( + $phpcsFile, + $opener, + $nextNonWhitespace, + $this->spacesMultiLine, + $error, + $code, + 'error', + 0, + 'Space after array opener, multi-line array' + ); + + $error = 'Expected %s before the array closer in a multi line array. Found: %s'; + $code = 'SpaceBeforeArrayCloserMultiLine'; + + SpacesFixer::checkAndFix( + $phpcsFile, + $closer, + $phpcsFile->findPrevious(\T_WHITESPACE, ($closer - 1), null, true), + $this->spacesMultiLine, + $error, + $code, + 'error', + 0, + 'Space before array closer, multi-line array' + ); + } +} diff --git a/vendor/phpcsstandards/phpcsextra/NormalizedArrays/Sniffs/Arrays/CommaAfterLastSniff.php b/vendor/phpcsstandards/phpcsextra/NormalizedArrays/Sniffs/Arrays/CommaAfterLastSniff.php new file mode 100644 index 00000000..7384421d --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/NormalizedArrays/Sniffs/Arrays/CommaAfterLastSniff.php @@ -0,0 +1,226 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\NormalizedArrays\Sniffs\Arrays; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\Tokens\Collections; +use PHPCSUtils\Utils\Arrays; + +/** + * Enforce/forbid a comma after the last item in an array declaration. + * + * Allows for different settings for single-line and multi-line arrays. + * + * @since 1.0.0 + */ +final class CommaAfterLastSniff implements Sniff +{ + + /** + * Name of the metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME = '%s array - comma after last item'; + + /** + * Whether or not to enforce a comma after the last array item in a single-line array. + * + * Valid values: + * - 'enforce' to always demand a comma after the last item in single-line arrays; + * - 'forbid' to disallow a comma after the last item in single-line arrays; + * - 'skip' to ignore single-line arrays. + * + * Defaults to: 'forbid'. + * + * @since 1.0.0 + * + * @var string + */ + public $singleLine = 'forbid'; + + /** + * Whether or not to enforce a comma after the last array item in a multi-line array. + * + * Valid values: + * - 'enforce' to always demand a comma after the last item in single-line arrays; + * - 'forbid' to disallow a comma after the last item in single-line arrays; + * - 'skip' to ignore multi-line arrays. + * + * Defaults to: 'enforce'. + * + * @since 1.0.0 + * + * @var string + */ + public $multiLine = 'enforce'; + + /** + * The input values to consider as valid for the public properties. + * + * Used for input validation. + * + * @since 1.0.0 + * + * @var array<string, true> + */ + private $validValues = [ + 'enforce' => true, + 'forbid' => true, + 'skip' => true, + ]; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return Collections::arrayOpenTokensBC(); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + // Validate the property input. Invalid values will result in the check being skipped. + if (isset($this->validValues[$this->singleLine]) === false) { + $this->singleLine = 'skip'; + } + if (isset($this->validValues[$this->multiLine]) === false) { + $this->multiLine = 'skip'; + } + + $openClose = Arrays::getOpenClose($phpcsFile, $stackPtr); + if ($openClose === false) { + // Short list, real square bracket, live coding or parse error. + return; + } + + $tokens = $phpcsFile->getTokens(); + $opener = $openClose['opener']; + $closer = $openClose['closer']; + + $action = $this->singleLine; + $phrase = 'single-line'; + $errorCode = 'SingleLine'; + if ($tokens[$opener]['line'] !== $tokens[$closer]['line']) { + $action = $this->multiLine; + $phrase = 'multi-line'; + $errorCode = 'MultiLine'; + } + + if ($action === 'skip') { + // Nothing to do. + return; + } + + $lastNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($closer - 1), $opener, true); + if ($lastNonEmpty === false || $lastNonEmpty === $opener) { + // Bow out: empty array. + return; + } + + // If the closer is on the same line as the last element, change the error code for multi-line arrays. + if ($errorCode === 'MultiLine' + && $tokens[$lastNonEmpty]['line'] === $tokens[$closer]['line'] + ) { + $errorCode .= 'CloserSameLine'; + } + + $isComma = ($tokens[$lastNonEmpty]['code'] === \T_COMMA); + + $phpcsFile->recordMetric( + $stackPtr, + \sprintf(self::METRIC_NAME, \ucfirst($phrase)), + ($isComma === true ? 'yes' : 'no') + ); + + switch ($action) { + case 'enforce': + if ($isComma === true) { + return; + } + + $error = 'There should be a comma after the last array item in a %s array.'; + $errorCode = 'Missing' . $errorCode; + $data = [$phrase]; + $fix = $phpcsFile->addFixableError($error, $lastNonEmpty, $errorCode, $data); + if ($fix === true) { + $extraContent = ','; + + if (($tokens[$lastNonEmpty]['code'] === \T_END_HEREDOC + || $tokens[$lastNonEmpty]['code'] === \T_END_NOWDOC) + // Check for indentation, if indented, it's a PHP 7.3+ heredoc/nowdoc. + && $tokens[$lastNonEmpty]['content'] === \ltrim($tokens[$lastNonEmpty]['content']) + ) { + // Prevent parse errors in PHP < 7.3 which doesn't support flexible heredoc/nowdoc. + $extraContent = $phpcsFile->eolChar . $extraContent; + } + + $phpcsFile->fixer->addContent($lastNonEmpty, $extraContent); + } + + return; + + case 'forbid': + if ($isComma === false) { + return; + } + + $error = 'A comma after the last array item in a %s array is not allowed.'; + $errorCode = 'Found' . $errorCode; + $data = [$phrase]; + $fix = $phpcsFile->addFixableError($error, $lastNonEmpty, $errorCode, $data); + if ($fix === true) { + $start = $lastNonEmpty; + $end = $lastNonEmpty; + + // Make sure we're not leaving a superfluous blank line behind. + $prevNonWhitespace = $phpcsFile->findPrevious(\T_WHITESPACE, ($lastNonEmpty - 1), $opener, true); + $nextNonWhitespace = $phpcsFile->findNext(\T_WHITESPACE, ($lastNonEmpty + 1), ($closer + 1), true); + if ($prevNonWhitespace !== false + && $tokens[$prevNonWhitespace]['line'] < $tokens[$lastNonEmpty]['line'] + && $nextNonWhitespace !== false + && $tokens[$nextNonWhitespace]['line'] > $tokens[$lastNonEmpty]['line'] + ) { + $start = ($prevNonWhitespace + 1); + } + + $phpcsFile->fixer->beginChangeset(); + + for ($i = $start; $i <= $end; $i++) { + $phpcsFile->fixer->replaceToken($i, ''); + } + + $phpcsFile->fixer->endChangeset(); + } + + return; + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/NormalizedArrays/ruleset.xml b/vendor/phpcsstandards/phpcsextra/NormalizedArrays/ruleset.xml new file mode 100644 index 00000000..69c54a8e --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/NormalizedArrays/ruleset.xml @@ -0,0 +1,5 @@ +<?xml version="1.0"?> +<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="NormalizedArrays" namespace="PHPCSExtra\NormalizedArrays" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/PHPCSStandards/PHP_CodeSniffer/master/phpcs.xsd"> + + <description>A ruleset for PHP_CodeSniffer to check arrays for normalized format.</description> +</ruleset> diff --git a/vendor/phpcsstandards/phpcsextra/README.md b/vendor/phpcsstandards/phpcsextra/README.md new file mode 100644 index 00000000..a82fa893 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/README.md @@ -0,0 +1,573 @@ +PHPCSExtra +===================================================== + +<div aria-hidden="true"> + +[![Latest Stable Version](https://poser.pugx.org/phpcsstandards/phpcsextra/v/stable)][phpcsextra-packagist] +[![Release Date of the Latest Version](https://img.shields.io/github/release-date/PHPCSStandards/PHPCSExtra.svg?maxAge=1800)](https://github.com/PHPCSStandards/PHPCSExtra/releases) +:construction: +[![Latest Unstable Version](https://img.shields.io/badge/unstable-dev--develop-e68718.svg?maxAge=2419200)](https://packagist.org/packages/phpcsstandards/phpcsextra#dev-develop) +[![Last Commit to Unstable](https://img.shields.io/github/last-commit/PHPCSStandards/PHPCSExtra/develop.svg)](https://github.com/PHPCSStandards/PHPCSExtra/commits/develop) + +[![CS Build Status](https://github.com/PHPCSStandards/PHPCSExtra/actions/workflows/basics.yml/badge.svg?branch=develop)][gha-qa-results] +[![Test Build Status](https://github.com/PHPCSStandards/PHPCSExtra/actions/workflows/test.yml/badge.svg?branch=develop)][gha-test-results] +[![Coverage Status](https://coveralls.io/repos/github/PHPCSStandards/PHPCSExtra/badge.svg)](https://coveralls.io/github/PHPCSStandards/PHPCSExtra) + +[![Minimum PHP Version](https://img.shields.io/packagist/php-v/phpcsstandards/phpcsextra.svg?maxAge=3600)][phpcsextra-packagist] +[![Tested on PHP 5.4 to 8.3](https://img.shields.io/badge/tested%20on-PHP%205.4%20|%205.5%20|%205.6%20|%207.0%20|%207.1%20|%207.2%20|%207.3%20|%207.4%20|%208.0%20|%208.1%20|%208.2%20|%208.3-brightgreen.svg?maxAge=2419200)][gha-test-results] + +[![License: LGPLv3](https://poser.pugx.org/phpcsstandards/phpcsextra/license)](https://github.com/PHPCSStandards/PHPCSExtra/blob/stable/LICENSE) +![Awesome](https://img.shields.io/badge/awesome%3F-yes!-brightgreen.svg) + +</div> + +* [Introduction](#introduction) +* [Minimum Requirements](#minimum-requirements) +* [Installation](#installation) + + [Composer Project-based Installation](#composer-project-based-installation) + + [Composer Global Installation](#composer-global-installation) + + [Updating to a newer version](#updating-to-a-newer-version) +* [Features](#features) +* [Sniffs](#sniffs) + + [Modernize](#modernize) + + [NormalizedArrays](#normalizedarrays) + + [Universal](#universal) +* [Contributing](#contributing) +* [License](#license) + + +Introduction +------------------------------------------- + +PHPCSExtra is a collection of sniffs and standards for use with [PHP_CodeSniffer][phpcs-gh]. + + +Minimum Requirements +------------------------------------------- + +* PHP 5.4 or higher. +* [PHP_CodeSniffer][phpcs-gh] version **3.8.0** or higher. +* [PHPCSUtils][phpcsutils-gh] version **1.0.9** or higher. + + +Installation +------------------------------------------- + +Installing via Composer is highly recommended. + +[Composer](http://getcomposer.org/) will automatically install the project dependencies and register the rulesets from PHPCSExtra and other external standards with PHP_CodeSniffer using the [Composer PHPCS plugin][composer-installer-gh]. + +### Composer Project-based Installation + +Run the following from the root of your project: +```bash +composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true +composer require --dev phpcsstandards/phpcsextra:"^1.2.0" +``` + +### Composer Global Installation + +Alternatively, you may want to install this standard globally: +```bash +composer global config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true +composer global require --dev phpcsstandards/phpcsextra:"^1.2.0" +``` + +### Updating to a newer version + +If you installed PHPCSExtra using either of the above commands, you can update to a newer version as follows: +```bash +# Project local install +composer update phpcsstandards/phpcsextra --with-dependencies + +# Global install +composer global update phpcsstandards/phpcsextra --with-dependencies +``` + +> If your project includes `require[-dev]`s for the `squizlabs/php_codesniffer`, `phpcsstandards/phpcsutils` or +> `dealerdirect/phpcodesniffer-composer-installer` packages in its `composer.json` file, you may need to use +> `--with-all-dependencies` instead of `--with-dependencies`. +> +> :bulb: **Pro-tip**: Unless your project is a PHPCS standard which actually uses any of these packages directly, +> it is recommended to remove these packages from your own `composer.json` file, in favour of letting PHPCSExtra +> (and potential other external PHPCS standards you use), manage the version requirements for these packages. + + +Features +------------------------------------------- + +Once this project is installed, you will see three new rulesets in the list of installed standards when you run `vendor/bin/phpcs -i`: `Modernize`, `NormalizedArrays` and `Universal`. + +* The `Modernize` ruleset is a standard which checks code for modernization opportunaties. +* The `NormalizedArrays` ruleset is a standard to check the formatting of array declarations. +* The `Universal` ruleset is **NOT** a standard, but a sniff collection. + It should **NOT** be included in custom rulesets as a standard as it contains contradictory rules. + Instead include individual sniffs from this standard in a custom project/company ruleset to use them. + + +Sniffs +------------------------------------------- + +**Legend**: +* :wrench: = Includes auto-fixer. + _Use the `phpcbf` command to run the fixers._ +* :bar_chart: = Includes metrics. + _Use `phpcs` with `--report=info` to see the metrics._ +* :books: = Includes CLI documentation. + _Use `phpcs` with `--generator=Text` to see the documentation._ + + +### Modernize + +#### `Modernize.FunctionCalls.Dirname` :wrench: :books: + +This sniff will detect and auto-fix two typical code modernizations which can be made related to the `dirname()` function: +1. Since PHP 5.3, calls to `dirname(__FILE__)` can be replaced by `__DIR__`. + Errorcode: `Modernize.FunctionCalls.Dirname.FileConstant`. +2. Since PHP 7.0, nested function calls to `dirname()` can be changed to use the `$levels` parameter. + Errorcode: `Modernize.FunctionCalls.Dirname.Nested`. + +If a [`php_version` configuration option][php_version-config] has been passed to PHPCS using either `--config-set` or `--runtime-set`, it will be respected by the sniff. +In effect, this means that the sniff will only report on modernizations which can be applied for the PHP version as configured. + + +### NormalizedArrays + +#### `NormalizedArrays.Arrays.ArrayBraceSpacing` :wrench: :bar_chart: :books: + +Enforce consistent spacing for the open/close braces of array declarations. + +The sniff allows for having different settings for: +- Space between the array keyword and the open parenthesis for long arrays via the `keywordSpacing` property. + Accepted values: (int) number of spaces or `false` to turn this check off. Defaults to `0` spaces. +- Spaces on the inside of the braces for empty arrays via the `spacesWhenEmpty` property. + Accepted values: (string) `newline`, (int) number of spaces or `false` to turn this check off. Defaults to `0` spaces. +- Spaces on the inside of the braces for single-line arrays via the `spacesSingleLine` property; + Accepted values: (int) number of spaces or `false` to turn this check off. Defaults to `0` spaces. +- Spaces on the inside of the braces for multi-line arrays via the `spacesMultiLine` property. + Accepted values: (string) `newline`, (int) number of spaces or `false` to turn this check off. Defaults to `newline`. + +Note: if any of the above properties are set to `newline`, it is recommended to also include an array indentation sniff. This sniff will not handle the indentation. + +#### `NormalizedArrays.Arrays.CommaAfterLast` :wrench: :bar_chart: :books: + +Enforce/forbid a comma after the last item in an array declaration. + +By default, this sniff will: +* Forbid a comma after the last array item for single-line arrays. +* Enforce a comma after the last array item for multi-line arrays. + +This can be changed for each type or array individually by setting the `singleLine` and/or `multiLine` properties in a custom ruleset. + +Use any of the following values to change the properties: `enforce`, `forbid` or `skip` to not check the comma after the last array item for a particular type of array. + +The default for the `singleLine` property is `forbid`. The default for the `multiLine` property is `enforce`. + + +### Universal + +#### `Universal.Arrays.DisallowShortArraySyntax` :wrench: :bar_chart: :books: + +Disallow short array syntax. + +In contrast to the PHPCS native `Generic.Arrays.DisallowShortArraySyntax` sniff, this sniff will ignore short list syntax and not cause parse errors when the fixer is used. + +#### `Universal.Arrays.DuplicateArrayKey` :books: + +Detects duplicate array keys in array declarations. + +The sniff will make a distinction between keys which will be duplicate in all PHP version and (numeric) keys which will only be a duplicate key in [PHP < 8.0 or PHP >= 8.0][php-rfc-negative_array_index]. + +If a [`php_version` configuration option][php_version-config] has been passed to PHPCS using either `--config-set` or `--runtime-set`, it will be respected by the sniff and only report duplicate keys for the configured PHP version. + +[php-rfc-negative_array_index]: https://wiki.php.net/rfc/negative_array_index + +#### `Universal.Arrays.MixedArrayKeyTypes` :books: + +Best practice sniff: don't use a mix of integer and string keys for array items. + +#### `Universal.Arrays.MixedKeyedUnkeyedArray` :books: + +Best practice sniff: don't use a mix of keyed and unkeyed array items. + +#### `Universal.Classes.DisallowAnonClassParentheses` :wrench: :bar_chart: :books: + +Disallow the use of parentheses when declaring an anonymous class without passing parameters. + +#### `Universal.Classes.RequireAnonClassParentheses` :wrench: :bar_chart: :books: + +Require the use of parentheses when declaring an anonymous class, whether parameters are passed or not. + +#### `Universal.Classes.DisallowFinalClass` :wrench: :bar_chart: :books: + +Disallow classes being declared `final`. + +#### `Universal.Classes.RequireFinalClass` :wrench: :bar_chart: :books: + +Require all non-`abstract` classes to be declared `final`. + +:warning: **Warning**: the auto-fixer for this sniff _may_ have unintended side-effects for applications and should be used with care! +This is considered a **_risky_ fixer**. + +#### `Universal.Classes.ModifierKeywordOrder` :wrench: :bar_chart: :books: + +Require a consistent modifier keyword order for class declarations. + +* This sniff contains an `order` property to specify the preferred order. + Accepted values: (string) `'extendability readonly'`|`'readonly extendability'`. Defaults to `'extendability readonly'`. + +#### `Universal.CodeAnalysis.ConstructorDestructorReturn` :wrench: :books: + +* Disallows return type declarations on constructor/destructor methods - error code: `ReturnTypeFound`, auto-fixable. +* Discourages constructor/destructor methods returning a value - error code: `ReturnValueFound`. + +If a [`php_version` configuration option][php_version-config] has been passed to PHPCS using either `--config-set` or `--runtime-set`, it will be respected by the sniff. +In effect, this means that the sniff will only report on PHP4-style constructors if the configured PHP version is less than 8.0. + +#### `Universal.CodeAnalysis.ForeachUniqueAssignment` :wrench: :books: + +Detects `foreach` control structures which use the same variable for both the key as well as the value assignment as this will lead to unexpected - and most likely unintended - behaviour. + +Note: The fixer will maintain the existing behaviour of the code. This may not be the _intended_ behaviour. + +#### `Universal.CodeAnalysis.NoDoubleNegative` :wrench: :books: + +Detects double negation `!!` in code, which is effectively the same as a boolean cast, but with a much higher cognitive load. +Also detects triple negation `!!!`, which is effectively the same as a single negation. + +The sniff has modular error codes to allow for disabling individual checks. The error codes are: `FoundDouble`, `FoundDoubleWithInstanceof` (not auto-fixable) and `FoundTriple`. + +#### `Universal.CodeAnalysis.NoEchoSprintf` :wrench: :books: + +Detects use of the inefficient `echo [v]sprintf(...);` combi. Use `[v]printf()` instead. + +#### `Universal.CodeAnalysis.StaticInFinalClass` :wrench: :books: + +Detects using `static` instead of `self` in OO constructs which are `final`. + +* The sniff has modular error codes to allow for making exceptions based on the type of use for `static`. + The available error codes are: `ReturnType`, `InstanceOf`, `NewInstance`, `ScopeResolution`. + +#### `Universal.Constants.LowercaseClassResolutionKeyword` :wrench: :bar_chart: :books: + +Enforce that the `class` keyword when used for class name resolution, i.e. `::class`, is in lowercase. + +#### `Universal.Constants.ModifierKeywordOrder` :wrench: :bar_chart: :books: + +Require a consistent modifier keyword order for OO constant declarations. + +* This sniff contains an `order` property to specify the preferred order. + Accepted values: (string) `'final visibility'`|`'visibility final'`. Defaults to `'final visibility'`. + +#### `Universal.Constants.UppercaseMagicConstants` :wrench: :bar_chart: :books: + +Enforce uppercase when using PHP native magic constants, like `__FILE__` et al. + +#### `Universal.ControlStructures.DisallowAlternativeSyntax` :wrench: :bar_chart: :books: + +Disallow using the alternative syntax for control structures. + +* This sniff contains an `allowWithInlineHTML` property to allow alternative syntax when inline HTML is used within the control structure. In all other cases, the use of the alternative syntax will still be disallowed. + Accepted values: (bool) `true`|`false`. Defaults to `false`. +* The sniff has modular error codes to allow for making exceptions based on specific control structures and/or specific control structures in combination with inline HTML. + The error codes follow the following pattern: `Found[ControlStructure][WithInlineHTML]`. Examples: `FoundIf`, `FoundSwitchWithInlineHTML`. + +#### `Universal.ControlStructures.DisallowLonelyIf` :wrench: :books: + +Disallow `if` statements as the only statement in an `else` block. + +Note: This sniff will not fix the indentation of the "inner" code. +It is strongly recommended to run this sniff together with the `Generic.WhiteSpace.ScopeIndent` sniff to get the correct indentation. + +#### `Universal.ControlStructures.IfElseDeclaration` :wrench: :bar_chart: :books: + +Verify that else(if) statements with braces are on a new line. + +#### `Universal.Files.SeparateFunctionsFromOO` :bar_chart: :books: + +Enforce for a file to either declare (global/namespaced) functions or declare OO structures, but not both. + +* Nested function declarations, i.e. functions declared within a function/method will be disregarded for the purposes of this sniff. + The same goes for anonymous classes, closures and arrow functions. +* Note: This sniff has no opinion on side effects. If you want to sniff for those, use the PHPCS native `PSR1.Files.SideEffects` sniff. +* Also note: This sniff has no opinion on multiple OO structures being declared in one file. + If you want to sniff for that, use the PHPCS native `Generic.Files.OneObjectStructurePerFile` sniff. + +#### `Universal.FunctionDeclarations.NoLongClosures` :bar_chart: :books: + +Detects "long" closures and recommends using a named function instead. + +The sniff is configurable by setting any of the following properties in a custom ruleset: +* `recommendedLines` (int): determines when a warning will be thrown. + Defaults to `5`, meaning a warning with the errorcode `ExceedsRecommended` will be thrown if the closure is more than 5 lines long. +* `maxLines` (int): determines when an error will be thrown. + Defaults to `8`, meaning that an error with the errorcode `ExceedsMaximum` will be thrown if the closure is more than 8 lines long. +* `ignoreCommentLines` (bool): whether or not comment-only lines should be ignored for the lines count. + Defaults to `true`. +* `ignoreEmptyLines` (bool): whether or not blank lines should be ignored for the lines count. + Defaults to `true`. + +#### `Universal.FunctionDeclarations.RequireFinalMethodsInTraits` :wrench: :bar_chart: :books: + +Enforce non-private, non-abstract methods in traits to be declared as `final`. + +The available error codes are: `NonFinalMethodFound` and `NonFinalMagicMethodFound`. + +#### `Universal.Lists.DisallowLongListSyntax` :wrench: :books: + +Disallow the use of long `list`s. + +> For metrics about the use of long lists vs short lists, please use the `Universal.Lists.DisallowShortListSyntax` sniff. + +#### `Universal.Lists.DisallowShortListSyntax` :wrench: :bar_chart: :books: + +Disallow the use of short lists. + +#### `Universal.Namespaces.DisallowDeclarationWithoutName` :bar_chart: :books: + +Disallow namespace declarations without a namespace name. + +This sniff only applies to namespace declarations using the curly brace syntax. + +#### `Universal.Namespaces.DisallowCurlyBraceSyntax` :bar_chart: :books: + +Disallow the use of the alternative namespace declaration syntax using curly braces. + +#### `Universal.Namespaces.EnforceCurlyBraceSyntax` :bar_chart: :books: + +Enforce the use of the alternative namespace syntax using curly braces. + +#### `Universal.Namespaces.OneDeclarationPerFile` :books: + +Disallow the use of multiple namespaces within a file. + +#### `Universal.NamingConventions.NoReservedKeywordParameterNames` :books: + +Disallow function parameters using reserved keywords as names, as this can quickly become confusing when people use them in function calls using named parameters + +* The sniff has modular error codes to allow for making exceptions for specific keywords. + The error codes follow the following pattern: `[keyword]Found`. + +#### `Universal.OOStructures.AlphabeticExtendsImplements` :wrench: :bar_chart: :books: + +Enforce that the names used in a class/enum "implements" statement or an interface "extends" statement are listed in alphabetic order. + +* This sniff contains a `orderby` property to determine the sort order to use for the statement. + If all names used are unqualified, the sort order won't make a difference. + However, if one or more of the names are partially or fully qualified, the chosen sort order will determine how the sorting between unqualified, partially and fully qualified names is handled. + The sniff supports two sort order options: + - _'name'_ : sort by the interface name only (default); + - _'full'_ : sort by the full name as used in the statement (without leading backslash). + In both cases, the sorting will be done using natural sort, case-insensitive. +* The sniff has modular error codes to allow for selective inclusion/exclusion: + - `ImplementsWrongOrder` - for "class implements" statements. + - `ImplementsWrongOrderWithComments` - for "class implements" statements interlaced with comments. These will not be auto-fixed. + - `ExtendsWrongOrder` - for "interface extends" statements. + - `ExtendsWrongOrderWithComments` - for "interface extends" statements interlaced with comments. These will not be auto-fixed. +* When fixing, the existing spacing between the names in an `implements`/`extends` statement will not be maintained. + The fixer will separate each name with a comma and one space. + If alternative formatting is desired, a sniff which will check and fix the formatting should be added to the ruleset. + +#### `Universal.Operators.ConcatPosition` :wrench: :bar_chart: :books: + +Enforce that the concatenation operator for multi-line concatenations is in a preferred position, either always at the start of the next line or always at the end of the previous line. + +* This sniff contains an `allowOnly` property to set the preferred position for the operator. + Accepted values: (string) `"start"` or `"end"`. Defaults to `"start"`. +* Note: mid-line concatenation is still allowed and will not be flagged by this sniff. + +#### `Universal.Operators.DisallowLogicalAndOr` :bar_chart: :books: + +Enforce the use of the boolean `&&` and `||` operators instead of the logical `and`/`or` operators. + +:information_source: Note: as the [operator precedence](https://www.php.net/language.operators.precedence) of the logical operators is significantly lower than the operator precedence of boolean operators, this sniff does not contain an auto-fixer. + +#### `Universal.Operators.DisallowShortTernary` :bar_chart: :books: + +Disallow the use of short ternaries `?:`. + +While short ternaries are useful when used correctly, the principle of them is often misunderstood and they are more often than not used incorrectly, leading to hard to debug issues and/or PHP warnings/notices. + +#### `Universal.Operators.DisallowStandalonePostIncrementDecrement` :wrench: :bar_chart: :books: + +* Disallow the use of post-in/decrements in stand-alone statements - error codes: `PostDecrementFound` and `PostIncrementFound`. + Using pre-in/decrement is more in line with the principle of least astonishment and prevents bugs when code gets moved around at a later point in time. +* Discourages the use of multiple increment/decrement operators in a stand-alone statement - error code: `MultipleOperatorsFound`. + +#### `Universal.Operators.StrictComparisons` :wrench: :bar_chart: :books: + +Enforce the use of strict comparisons. + +:warning: **Warning**: the auto-fixer for this sniff _may_ cause bugs in applications and should be used with care! +This is considered a **_risky_ fixer**. + +#### `Universal.Operators.TypeSeparatorSpacing` :wrench: :bar_chart: :books: + +Enforce no spaces around the union type and intersection type operators. + +The available error codes are: `UnionTypeSpacesBefore`, `UnionTypeSpacesAfter`, `IntersectionTypeSpacesBefore`, `IntersectionTypeSpacesAfter`. + +#### `Universal.PHP.LowercasePHPTag` :wrench: :bar_chart: :books: + +Enforces that the "PHP" in a PHP open tag is lowercase. + +#### `Universal.PHP.OneStatementInShortEchoTag` :wrench: :books: + +Disallow short open echo tags `<?=` containing more than one PHP statement. + +#### `Universal.UseStatements.DisallowMixedGroupUse` :wrench: :bar_chart: :books: + +Disallow group use statements which import a combination of namespace/OO construct, functions and/or constants in one statement. + +Note: the fixer will use a semi-standardized format for group use statements. +If there are more specific requirements for the formatting of group use statements, the ruleset configurator should ensure that additional sniffs are included in the ruleset to enforce the required format. + +#### `Universal.UseStatements.DisallowUseClass` :bar_chart: :books: + +Forbid using import `use` statements for classes/traits/interfaces/enums. + +Individual sub-types - with/without alias, global imports, imports from the same namespace - can be forbidden by including that specific error code and/or allowed including the whole sniff and excluding specific error codes. + +The available error codes are: `FoundWithoutAlias`, `FoundWithAlias`, `FromGlobalNamespace`, `FromGlobalNamespaceWithAlias`, `FromSameNamespace` and `FromSameNamespaceWithAlias`. + +#### `Universal.UseStatements.DisallowUseConst` :bar_chart: :books: + +Forbid using import `use` statements for constants. + +See [`Universal.UseStatements.DisallowUseClass`](#universalusestatementsdisallowuseclass-bar_chart-books) for information on the error codes. + +#### `Universal.UseStatements.DisallowUseFunction` :bar_chart: :books: + +Forbid using import `use` statements for functions. + +See [`Universal.UseStatements.DisallowUseClass`](#universalusestatementsdisallowuseclass-bar_chart-books) for information on the error codes. + +#### `Universal.UseStatements.KeywordSpacing` :wrench: :bar_chart: :books: + +Enforce the use of a single space after the `use`, `function`, `const` keywords and both before and after the `as` keyword in import `use` statements. + +Companion sniff to the PHPCS native `Generic.WhiteSpace.LanguageConstructSpacing` sniff which doesn't cover the `function`, `const` and `as` keywords when used in an import `use` statement. + +The sniff has modular error codes to allow for disabling individual checks. The error codes are: `SpaceAfterUse`, `SpaceAfterFunction`, `SpaceAfterConst`, `SpaceBeforeAs` and `SpaceAfterAs`. + +#### `Universal.UseStatements.LowercaseFunctionConst` :wrench: :bar_chart: :books: + +Enforce that `function` and `const` keywords when used in an import `use` statement are always lowercase. + +Companion sniff to the PHPCS native `Generic.PHP.LowerCaseKeyword` sniff which doesn't cover these keywords when used in an import `use` statement. + +#### `Universal.UseStatements.NoLeadingBackslash` :wrench: :bar_chart: :books: + +Verify that a name being imported in an import `use` statement does not start with a leading backslash. + +Names in import `use` statements should always be fully qualified, so a leading backslash is not needed and it is strongly recommended not to use one. + +This sniff handles all types of import use statements supported by PHP, in contrast to other sniffs for the same in, for instance, the PHPCS native `PSR12` or the Slevomat standard, which are incomplete. + +#### `Universal.UseStatements.NoUselessAliases` :wrench: :books: + +Detects useless aliases in import use statements. + +Aliasing something to the same name as the original construct is considered useless (though allowed in PHP). +Note: as OO and function names in PHP are case-insensitive, aliasing to the same name, using a different case is also considered useless. + +#### `Universal.WhiteSpace.AnonClassKeywordSpacing` :wrench: :bar_chart: :books: + +Standardize the amount of spacing between the `class` keyword and the open parenthesis (if any) for anonymous class declarations. + +* This sniff contains an `spacing` property to set the amount of spaces the sniff should check for. + Accepted values: (int) number of spaces. Defaults to `0` (spaces). + +#### `Universal.WhiteSpace.CommaSpacing` :wrench: :bar_chart: :books: + +Enforce that there is no space before a comma and exactly one space, or a new line, after a comma. + +Additionally, the sniff also enforces that the comma should follow the code and not be placed after a trailing comment. + +For the spacing part, the sniff makes the following exceptions: +1. A comma preceded or followed by a parenthesis, curly or square bracket. + These will not be flagged to prevent conflicts with sniffs handling spacing around braces. +2. A comma preceded or followed by another comma, like for skipping items in a list assignment. + These will not be flagged. + +* The sniff has a separate error code - `TooMuchSpaceAfterCommaBeforeTrailingComment` - for when a comma is found with more than one space after it, followed by a trailing comment. + Exclude this error code to allow trailing comment alignment. +* The other error codes the sniff uses, `SpaceBefore`, `TooMuchSpaceAfter` and `NoSpaceAfter`, may be suffixed with a context indicator - `*InFunctionDeclaration`, `*InFunctionCall`, `*InClosureUse` or `*InDeclare` -. + This allows for disabling the sniff in any of these contexts by excluding the specific suffixed error codes. +* The sniff will respect a potentially set [`php_version` configuration option][php_version-config] when deciding how to handle the spacing after a heredoc/nowdoc closer. + In effect, this means that the sniff will enforce a new line between the closer and a comma if the configured PHP version is less than 7.3. + When no `php_version` is passed, the sniff will handle the spacing between a heredoc/nowdoc closer and a comma based on whether it is a cross-version compatible heredoc/nowdoc (enforce new line) or a flexible heredoc/nowdoc (enforce no space). + +#### `Universal.WhiteSpace.DisallowInlineTabs` :wrench: :books: + +Enforce using spaces for mid-line alignment. + +While tab versus space based indentation is a question of preference, for mid-line alignment, spaces should always be preferred, as using tabs will result in inconsistent formatting depending on the dev-user's chosen tab width. + +> _This sniff is especially useful for tab-indentation based standards which use the `Generic.Whitespace.DisallowSpaceIndent` sniff to enforce this._ +> +> **DO** make sure to set the PHPCS native `tab-width` configuration for the best results. +> ```xml +> <arg name="tab-width" value="4"/> +> ``` +> +> The PHPCS native `Generic.Whitespace.DisallowTabIndent` sniff (used for space-based standards) oversteps its reach and silently does mid-line tab to space replacements as well. +> However, the sister-sniff `Generic.Whitespace.DisallowSpaceIndent` leaves mid-line tabs/spaces alone. +> This sniff fills that gap. + +#### `Universal.WhiteSpace.PrecisionAlignment` :wrench: :books: + +Enforce code indentation to always be a multiple of a tabstop, i.e. disallow precision alignment. + +Note: +* This sniff does not concern itself with tabs versus spaces. + It is recommended to use the sniff in combination with the PHPCS native `Generic.WhiteSpace.DisallowTabIndent` or the `Generic.WhiteSpace.DisallowSpaceIndent` sniff. +* When using this sniff with tab-based standards, please ensure that the `tab-width` is set and either don't set the `$indent` property or set it to the tab-width (or a multiple thereof). +* The fixer works based on "best guess" and may not always result in the desired indentation. Combine this sniff with the `Generic.WhiteSpace.ScopeIndent` sniff for more precise indentation fixes. + +The behaviour of the sniff is customizable via the following properties: +* `indent`: the indent used for the codebase. + Accepted values: (int|null) number of spaces. Defaults to `null`. + If this property is not set, the sniff will look to the `--tab-width` CLI value. + If that also isn't set, the default tab-width of `4` will be used. +* `ignoreAlignmentBefore`: allows for providing a list of token names for which (preceding) precision alignment should be ignored. + Accepted values: (array<string>) token constant names. Defaults to an empty array. + Usage example: + ```xml + <rule ref="Universal.WhiteSpace.PrecisionAlignment"> + <properties> + <property name="ignoreAlignmentBefore" type="array"> + <!-- Ignore precision alignment in inline HTML --> + <element value="T_INLINE_HTML"/> + <!-- Ignore precision alignment in multiline chained method calls. --> + <element value="T_OBJECT_OPERATOR"/> + <element value="T_NULLSAFE_OBJECT_OPERATOR"/> + </property> + </properties> + </rule> + ``` +* `ignoreBlankLines`: whether or not potential trailing whitespace on otherwise blank lines should be examined or ignored. + It is recommended to only set this to `false` if the standard including this sniff does not include the `Squiz.WhiteSpace.SuperfluousWhitespace` sniff (which is included in most standards). + Accepted values: (bool)`true`|`false`. Defaults to `true`. + + +Contributing +------- +Contributions to this project are welcome. Clone the repo, branch off from `develop`, make your changes, commit them and send in a pull request. + +If unsure whether the changes you are proposing would be welcome, open an issue first to discuss your proposal. + +License +------- +This code is released under the [GNU Lesser General Public License (LGPLv3)](LICENSE). + + +[phpcsextra-packagist]: https://packagist.org/packages/phpcsstandards/phpcsextra +[gha-qa-results]: https://github.com/PHPCSStandards/PHPCSExtra/actions/workflows/basics.yml +[gha-test-results]: https://github.com/PHPCSStandards/PHPCSExtra/actions/workflows/test.yml + +[phpcs-gh]: https://github.com/PHPCSStandards/PHP_CodeSniffer +[phpcsutils-gh]: https://github.com/PHPCSStandards/PHPCSUtils +[composer-installer-gh]: https://github.com/PHPCSStandards/composer-installer + +[php_version-config]: https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Configuration-Options#setting-the-php-version diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Arrays/DisallowShortArraySyntaxStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Arrays/DisallowShortArraySyntaxStandard.xml new file mode 100644 index 00000000..4a84b536 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Arrays/DisallowShortArraySyntaxStandard.xml @@ -0,0 +1,27 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Disallow Short Array Syntax" + > + <standard> + <![CDATA[ + The array keyword must be used to define arrays. + ]]> + </standard> + <code_comparison> + <code title="Valid: Using long form array syntax."> + <![CDATA[ +$arr = <em>array(</em> + 'foo' => 'bar', +<em>)</em>; + ]]> + </code> + <code title="Invalid: Using short array syntax."> + <![CDATA[ +$arr = <em>[</em> + 'foo' => 'bar', +<em>]</em>; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Arrays/DuplicateArrayKeyStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Arrays/DuplicateArrayKeyStandard.xml new file mode 100644 index 00000000..00f9b7bb --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Arrays/DuplicateArrayKeyStandard.xml @@ -0,0 +1,44 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Duplicate Array Key" + > + <standard> + <![CDATA[ + When a second array item with the same key is declared, it will overwrite the first. + This sniff detects when this is happening in array declarations. + ]]> + </standard> + <code_comparison> + <code title="Valid: Arrays with unique keys."> + <![CDATA[ +$args = array( + <em>'foo'</em> => 22, + <em>'bar'</em> => 25, + <em>'baz'</em> => 28, +); + +$args = array( + 22, + 25, + 2 => 28, +); + ]]> + </code> + <code title="Invalid: Array with duplicate keys."> + <![CDATA[ +$args = array( + <em>'foo'</em> => 22, + <em>'bar'</em> => 25, + <em>'bar'</em> => 28, +); + +$args = array( + 22, + 25, + 1 => 28, +); + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Arrays/MixedArrayKeyTypesStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Arrays/MixedArrayKeyTypesStandard.xml new file mode 100644 index 00000000..f7efdda1 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Arrays/MixedArrayKeyTypesStandard.xml @@ -0,0 +1,40 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Mixed Array Key Types" + > + <standard> + <![CDATA[ + In an array where the items have keys, all items should either have a numeric key assigned or a string key. A mix of numeric and string keys is not allowed. + ]]> + </standard> + <code_comparison> + <code title="Valid: Arrays with either numeric keys or string keys."> + <![CDATA[ +$args = array( + <em>'foo'</em> => 22, + <em>'bar'</em> => 25, +); + +$args = array( + <em>0</em> => 22, + <em>1</em> => 25, +); + ]]> + </code> + <code title="Invalid: Arrays with a mix of numeric and string keys."> + <![CDATA[ +$args = array( + 'foo' => 22, + 25, +); + +$args = array( + 'foo' => 22, + 12 => 25, +); + + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Arrays/MixedKeyedUnkeyedArrayStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Arrays/MixedKeyedUnkeyedArrayStandard.xml new file mode 100644 index 00000000..79897c19 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Arrays/MixedKeyedUnkeyedArrayStandard.xml @@ -0,0 +1,31 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Mixed Keyed Unkeyed Array" + > + <standard> + <![CDATA[ + All items in an array should either have an explicit key assigned or none. A mix of keyed and unkeyed items is not allowed. + ]]> + </standard> + <code_comparison> + <code title="Valid: Arrays with all items either keyed or unkeyed."> + <![CDATA[ +$args = array( + <em>'foo'</em> => 22, + <em>'bar'</em> => 25, +); + +$args = array(22, 25); + ]]> + </code> + <code title="Invalid: Array with a mix of keyed and unkeyed items."> + <![CDATA[ +$args = array( + 'foo' => 22, + 25, +); + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/DisallowAnonClassParenthesesStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/DisallowAnonClassParenthesesStandard.xml new file mode 100644 index 00000000..ebfd7c6c --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/DisallowAnonClassParenthesesStandard.xml @@ -0,0 +1,24 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Disallow Anonymous Class Parentheses" + > + <standard> + <![CDATA[ + Disallows the use of parentheses when declaring an anonymous class without passing parameters. + ]]> + </standard> + <code_comparison> + <code title="Valid: Anonymous class without parentheses or with parameters."> + <![CDATA[ +$anon = new class<em></em> {}; +$anon = new class<em>($param)</em> {}; + ]]> + </code> + <code title="Invalid: Anonymous class with parentheses."> + <![CDATA[ +$anon = new class<em>()</em> {}; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/DisallowFinalClassStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/DisallowFinalClassStandard.xml new file mode 100644 index 00000000..fd7ddb67 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/DisallowFinalClassStandard.xml @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Disallow Final Class" + > + <standard> + <![CDATA[ + Disallows the use of the `final` keyword for class declarations. + ]]> + </standard> + <code_comparison> + <code title="Valid: Non-final class."> + <![CDATA[ +<em>class</em> Foo {} +<em>abstract class</em> Bar implements MyInterface {} + ]]> + </code> + <code title="Invalid: Final class."> + <![CDATA[ +<em>final class</em> Foo {} +<em>final class</em> Bar extends MyAbstract {} + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/ModifierKeywordOrderStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/ModifierKeywordOrderStandard.xml new file mode 100644 index 00000000..a80ae0da --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/ModifierKeywordOrderStandard.xml @@ -0,0 +1,27 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Class Modifier Keyword Order" + > + <standard> + <![CDATA[ + Requires that class modifier keywords consistently use the same keyword order. + + By default the expected order is "abstract/final readonly", but this can be changed via the sniff configuration. + ]]> + </standard> + <code_comparison> + <code title="Valid: Modifier keywords ordered correctly."> + <![CDATA[ +<em>final readonly</em> class Foo {} +<em>abstract readonly</em> class Bar {} + ]]> + </code> + <code title="Invalid: Modifier keywords in reverse order."> + <![CDATA[ +<em>readonly final</em> class Foo {} +<em>readonly abstract</em> class Bar {} + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/RequireAnonClassParenthesesStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/RequireAnonClassParenthesesStandard.xml new file mode 100644 index 00000000..48fa148e --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/RequireAnonClassParenthesesStandard.xml @@ -0,0 +1,23 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Require Anonymous Class Parentheses" + > + <standard> + <![CDATA[ + Require the use of parentheses when declaring an anonymous class. + ]]> + </standard> + <code_comparison> + <code title="Valid: Anonymous class with parentheses."> + <![CDATA[ +$anon = new class<em>()</em> {}; + ]]> + </code> + <code title="Invalid: Anonymous class without parentheses."> + <![CDATA[ +$anon = new class<em></em> {}; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/RequireFinalClassStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/RequireFinalClassStandard.xml new file mode 100644 index 00000000..107b8f41 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/RequireFinalClassStandard.xml @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Require Final Class" + > + <standard> + <![CDATA[ + Requires the use of the `final` keyword for non-abstract class declarations. + ]]> + </standard> + <code_comparison> + <code title="Valid: Final class."> + <![CDATA[ +<em>final class</em> Foo {} +<em>final class</em> Bar extends MyAbstract {} + ]]> + </code> + <code title="Invalid: Non-final class."> + <![CDATA[ +<em>class</em> Foo {} +<em>abstract class</em> Bar implements MyInterface {} + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/ConstructorDestructorReturnStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/ConstructorDestructorReturnStandard.xml new file mode 100644 index 00000000..b44b4777 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/ConstructorDestructorReturnStandard.xml @@ -0,0 +1,64 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Constructor Destructor Return" + > + <standard> + <![CDATA[ + A class constructor/destructor can not have a return type declarations. This would result in a fatal error. + ]]> + </standard> + <code_comparison> + <code title="Valid: no return type declaration."> + <![CDATA[ +class Foo { + public function __construct() {} +} + ]]> + </code> + <code title="Invalid: return type declaration."> + <![CDATA[ +class Foo { + public function __construct()<em>: int</em> {} +} + ]]> + </code> + </code_comparison> + + <standard> + <![CDATA[ + A class constructor/destructor should not return anything. + ]]> + </standard> + <code_comparison> + <code title="Valid: class constructor/destructor doesn't return anything."> + <![CDATA[ +class Foo { + public function __construct() { + // Do something. + } + + public function __destruct() { + // Do something. + return; + } +} + ]]> + </code> + <code title="Invalid: class constructor/destructor returns a value."> + <![CDATA[ +class Foo { + public function __construct() { + // Do something. + return <em>$this</em>; + } + + public function __destruct() { + // Do something. + return <em>false</em>; + } +} + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/ForeachUniqueAssignmentStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/ForeachUniqueAssignmentStandard.xml new file mode 100644 index 00000000..6f9676ee --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/ForeachUniqueAssignmentStandard.xml @@ -0,0 +1,26 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Foreach Unique Assignment" + > + <standard> + <![CDATA[ + When a foreach control structure uses the same variable for both the $key as well as the $value assignment, the key will be disregarded and be inaccessible and the variable will contain the value. + Mix in reference assignments and the behaviour becomes even more unpredictable. + + This is a coding error. Either use unique variables for the key and the value or don't assign the key. + ]]> + </standard> + <code_comparison> + <code title="Valid: using unique variables."> + <![CDATA[ +foreach ($array as $k => $v ) {} + ]]> + </code> + <code title="Invalid: using the same variable for both the key as well as the value."> + <![CDATA[ +foreach ($array as $k => $k ) {} + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/NoDoubleNegativeStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/NoDoubleNegativeStandard.xml new file mode 100644 index 00000000..953149b7 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/NoDoubleNegativeStandard.xml @@ -0,0 +1,27 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="No Double Negative" + > + <standard> + <![CDATA[ + Detects double negation in code, which is effectively the same as a boolean cast, but with a much higher cognitive load. + ]]> + </standard> + <code_comparison> + <code title="Valid: using singular negation or a boolean cast."> + <![CDATA[ +$var = $a && <em>!</em> $b; + +if(<em>(bool)</em> callMe($a)) {} + ]]> + </code> + <code title="Invalid: using double negation (or more)."> + <![CDATA[ +$var = $a && <em>! !</em> $b; + +if(<em>! ! !</em> callMe($a)) {} + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/NoEchoSprintfStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/NoEchoSprintfStandard.xml new file mode 100644 index 00000000..914eb65d --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/NoEchoSprintfStandard.xml @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="No Echo Sprintf" + > + <standard> + <![CDATA[ + Detects use of `echo [v]sprintf(...);`. Use `[v]printf()` instead. + ]]> + </standard> + <code_comparison> + <code title="Valid: using [v]printf() or echo with anything but [v]sprintf()."> + <![CDATA[ +<em>printf</em>('text %s text', $var); +<em>echo callMe</em>('text %s text', $var); + ]]> + </code> + <code title="Invalid: using echo [v]sprintf()."> + <![CDATA[ +<em>echo sprintf</em>('text %s text', $var); +<em>echo vsprintf</em>('text %s text', [$var]); + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/StaticInFinalClassStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/StaticInFinalClassStandard.xml new file mode 100644 index 00000000..5f9f45bd --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/StaticInFinalClassStandard.xml @@ -0,0 +1,43 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Static in Final Class" + > + <standard> + <![CDATA[ + When a class is declared as final, using the `static` keyword for late static binding is unnecessary and redundant. + This rule also covers using `static` in a comparison with `instanceof`, using `static` for class instantiations or as a return type. + + `self` should be used instead. + + This applies to final classes, anonymous classes (final by nature) and enums (final by design). + ]]> + </standard> + <code_comparison> + <code title="Valid: Using 'self' in a final OO construct."> + <![CDATA[ +final class Foo +{ + public function myMethod($param) : <em>self</em> + { + $var = <em>self</em>::functionCall(); + $var = $obj instanceof <em>self</em>; + $var = new <em>self</em>; + } +} + ]]> + </code> + <code title="Invalid: Using 'static' in a final OO construct."> + <![CDATA[ +$anon = new class { + public function myMethod( + ): int|<em>static</em>|false { + $var = <em>static</em>::$prop; + $var = $obj instanceof <em>static</em>; + $var = new <em>static</em>(); + } +}; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Constants/LowercaseClassResolutionKeywordStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Constants/LowercaseClassResolutionKeywordStandard.xml new file mode 100644 index 00000000..7b61c8fa --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Constants/LowercaseClassResolutionKeywordStandard.xml @@ -0,0 +1,23 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Lowercase Class Resolution Keyword" + > + <standard> + <![CDATA[ + The "class" keyword when used for class name resolution, i.e. `::class`, must be in lowercase. + ]]> + </standard> + <code_comparison> + <code title="Valid: using lowercase."> + <![CDATA[ +echo MyClass::class; + ]]> + </code> + <code title="Invalid: using uppercase or mixed case."> + <![CDATA[ +echo <em>MyClass::CLASS</em>; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Constants/ModifierKeywordOrderStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Constants/ModifierKeywordOrderStandard.xml new file mode 100644 index 00000000..f42483a0 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Constants/ModifierKeywordOrderStandard.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Constant Modifier Keyword Order" + > + <standard> + <![CDATA[ + Requires that constant modifier keywords consistently use the same keyword order. + + By default the expected order is "final visibility", but this can be changed via the sniff configuration. + ]]> + </standard> + <code_comparison> + <code title="Valid: Modifier keywords ordered correctly."> + <![CDATA[ +class CorrectOrder { + <em>final public</em> const FOO = 'foo'; +} + ]]> + </code> + <code title="Invalid: Modifier keywords in reverse order."> + <![CDATA[ +class IncorrectOrder { + #[SomeAttribute] + <em>protected final</em> const BAR = 'foo'; +} + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Constants/UppercaseMagicConstantsStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Constants/UppercaseMagicConstantsStandard.xml new file mode 100644 index 00000000..2a9583fa --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Constants/UppercaseMagicConstantsStandard.xml @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Uppercase Magic Constants" + > + <standard> + <![CDATA[ + The PHP native `__...__` magic constant should be in uppercase. + ]]> + </standard> + <code_comparison> + <code title="Valid: using uppercase."> + <![CDATA[ +echo <em>__LINE__</em>; +include <em>__DIR__</em> . '/file.php'; + ]]> + </code> + <code title="Invalid: using lowercase or mixed case."> + <![CDATA[ +echo <em>__NameSpace__</em>; +include dirname(<em>__file__</em>) . '/file.php'; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/ControlStructures/DisallowAlternativeSyntaxStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/ControlStructures/DisallowAlternativeSyntaxStandard.xml new file mode 100644 index 00000000..4be7e6df --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/ControlStructures/DisallowAlternativeSyntaxStandard.xml @@ -0,0 +1,35 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Disallow Alternative Control Structure Syntax" + > + <standard> + <![CDATA[ + The use of the alternative syntax for control structures is not allowed. + ]]> + </standard> + <code_comparison> + <code title="Valid: using curly brace syntax for control structures."> + <![CDATA[ +if ($foo) <em>{</em> + $var = 1; +<em>}</em> + +while (++$i < 10) <em>{</em> + echo $i; +<em>}</em> + ]]> + </code> + <code title="Invalid: using the alternative syntax for control structures."> + <![CDATA[ +if ($foo) <em>:</em> + $var = 1; +<em>endif;</em> + +while (++$i < 10)<em>:</em> + echo $i; +<em>endwhile;</em> + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/ControlStructures/DisallowLonelyIfStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/ControlStructures/DisallowLonelyIfStandard.xml new file mode 100644 index 00000000..88d09228 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/ControlStructures/DisallowLonelyIfStandard.xml @@ -0,0 +1,49 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Disallow Lonely If" + > + <standard> + <![CDATA[ + Disallows `if` statements as the only statement in an `else` block. + + If an `if` statement is the only statement in the `else` block, use `elseif` instead. + ]]> + </standard> + <code_comparison> + <code title="Valid: use of elseif or if followed by another statement."> + <![CDATA[ +if ($foo) { + // ... +} <em>elseif ($bar)</em> { + // ... +} + +if ($foo) { + // ... +} else { + <em>if ($bar) { + // ... + } + + doSomethingElse(); + </em> +} + + ]]> + </code> + <code title="Invalid: lonely if in an else block."> + <![CDATA[ +if ($foo) { + // ... +} else { + <em>if ($bar) { + // ... + } else { + // ... + }</em> +} + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/ControlStructures/IfElseDeclarationStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/ControlStructures/IfElseDeclarationStandard.xml new file mode 100644 index 00000000..b1506f64 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/ControlStructures/IfElseDeclarationStandard.xml @@ -0,0 +1,37 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="If-else Declarations" + > + <standard> + <![CDATA[ + The `else` and `elseif` keywords should be on a new line. + ]]> + </standard> + <code_comparison> + <code title="Valid: `elseif` and `else` each on a new line."> + <![CDATA[ +if ($foo) { + $var = 1; +}<em> +elseif</em> ($bar) { + $var = 2; +} +else { + $var = 3; +} + ]]> + </code> + <code title="Invalid: `elseif` and `else` on the same line as the closing curly of the preceding (else)if."> + <![CDATA[ +if ($foo) { + $var = 1; +} <em>elseif</em> ($bar) { + $var = 2; +} <em>else</em> { + $var = 3; +} + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Files/SeparateFunctionsFromOOStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Files/SeparateFunctionsFromOOStandard.xml new file mode 100644 index 00000000..db0a2671 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Files/SeparateFunctionsFromOOStandard.xml @@ -0,0 +1,45 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Separate Functions From OO" + > + <standard> + <![CDATA[ + A file should either declare (global/namespaced) functions or declare OO structures, but not both. + + Nested function declarations, i.e. functions declared within a function/method will be disregarded for the purposes of this sniff. + The same goes for anonymous classes, closures and arrow functions. + ]]> + </standard> + <code_comparison> + <code title="Valid: Files containing only functions or only OO."> + <![CDATA[ +// Valid1.php +<?php +class Bar { + public function foo() {} +} + +// Valid2.php +<?php +function foo() {} +function bar() {} +function baz() {} + ]]> + </code> + <code title="Invalid: File containing both OO structure declarations as well as function declarations."> + <![CDATA[ +// Invalid.php +<?php +function foo() {} + +class Bar { + public function foo() {} +} + +function bar() {} +function baz() {} + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/FunctionDeclarations/NoLongClosuresStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/FunctionDeclarations/NoLongClosuresStandard.xml new file mode 100644 index 00000000..dc84e0b1 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/FunctionDeclarations/NoLongClosuresStandard.xml @@ -0,0 +1,42 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="No Long Closures" + > + <standard> + <![CDATA[ + Forbids the use of long closures and recommends using named functions instead. + + By default a closure is considered "longish" (warning) when it contains more than 5 lines of code and too long (error) when it contains more than 8 lines of code. + Also, by default only code lines are counted and blank lines and comment lines are ignored. + Each of these settings can be changed via the sniff configuration. + ]]> + </standard> + <code_comparison> + <code title="Valid: Short closure."> + <![CDATA[ +$closure = function() { + line1(); + line2(); + line3(); +}; + ]]> + </code> + <code title="Invalid: Long closure."> + <![CDATA[ +$closure = function() { + line1(); + line2(); + line3(); + line4(); + line5(); + line6(); + line7(); + line8(); + line9(); + line10(); +}; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/FunctionDeclarations/RequireFinalMethodsInTraitsStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/FunctionDeclarations/RequireFinalMethodsInTraitsStandard.xml new file mode 100644 index 00000000..4b2622de --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/FunctionDeclarations/RequireFinalMethodsInTraitsStandard.xml @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Require Final Methods in Traits" + > + <standard> + <![CDATA[ + Requires the use of the `final` keyword for non-abstract, non-private methods in traits. + ]]> + </standard> + <code_comparison> + <code title="Valid: Final methods in a trait."> + <![CDATA[ +trait Foo { + <em>final</em> public function bar() {} + <em>final</em> public static function baz() {} + + // Also valid (out of scope): + protected abstract function overload() {} + private function okay() {} +} + ]]> + </code> + <code title="Invalid: Non-final methods in a trait."> + <![CDATA[ +trait Foo { + <em>public function</em> bar() {} + <em>protected static function</em> baz() {} +} + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Lists/DisallowLongListSyntaxStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Lists/DisallowLongListSyntaxStandard.xml new file mode 100644 index 00000000..35475eab --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Lists/DisallowLongListSyntaxStandard.xml @@ -0,0 +1,23 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Disallow Long List Syntax" + > + <standard> + <![CDATA[ + Short list syntax must be used. + ]]> + </standard> + <code_comparison> + <code title="Valid: Short form of list."> + <![CDATA[ +<em>[</em>$a, $b<em>]</em> = $array; + ]]> + </code> + <code title="Invalid: Long form of list."> + <![CDATA[ +<em>list(</em>$a, $b<em>)</em> = $array; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Lists/DisallowShortListSyntaxStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Lists/DisallowShortListSyntaxStandard.xml new file mode 100644 index 00000000..214b6862 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Lists/DisallowShortListSyntaxStandard.xml @@ -0,0 +1,23 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Disallow Short List Syntax" + > + <standard> + <![CDATA[ + Long list syntax must be used. + ]]> + </standard> + <code_comparison> + <code title="Valid: Long form of list."> + <![CDATA[ +<em>list(</em>$a, $b<em>)</em> = $array; + ]]> + </code> + <code title="Invalid: Short form of list."> + <![CDATA[ +<em>[</em>$a, $b<em>]</em> = $array; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Namespaces/DisallowCurlyBraceSyntaxStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Namespaces/DisallowCurlyBraceSyntaxStandard.xml new file mode 100644 index 00000000..95174d73 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Namespaces/DisallowCurlyBraceSyntaxStandard.xml @@ -0,0 +1,27 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Disallow Curly Brace Namespace Syntax" + > + <standard> + <![CDATA[ + Namespace declarations using the curly brace syntax are not allowed. + ]]> + </standard> + <code_comparison> + <code title="Valid: Namespace declaration without braces."> + <![CDATA[ +namespace Vendor\Project\Sub<em>;</em> + +// Code + ]]> + </code> + <code title="Invalid: Namespace declaration with braces."> + <![CDATA[ +namespace Vendor\Project\Scoped <em>{</em> + // Code. +<em>}</em> + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Namespaces/DisallowDeclarationWithoutNameStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Namespaces/DisallowDeclarationWithoutNameStandard.xml new file mode 100644 index 00000000..465ea556 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Namespaces/DisallowDeclarationWithoutNameStandard.xml @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Disallow Namespace Declaration Without Name" + > + <standard> + <![CDATA[ + Namespace declarations without a namespace name are not allowed. + ]]> + </standard> + <code_comparison> + <code title="Valid: Named namespace declaration."> + <![CDATA[ +namespace <em>Vendor\Name</em> { +} + ]]> + </code> + <code title="Invalid: Namespace declaration without a name (=global namespace)."> + <![CDATA[ +namespace<em> </em>{ +} + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Namespaces/EnforceCurlyBraceSyntaxStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Namespaces/EnforceCurlyBraceSyntaxStandard.xml new file mode 100644 index 00000000..8e1892ca --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Namespaces/EnforceCurlyBraceSyntaxStandard.xml @@ -0,0 +1,27 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Enforce Curly Brace Namespace Syntax" + > + <standard> + <![CDATA[ + Namespace declarations without curly braces are not allowed. + ]]> + </standard> + <code_comparison> + <code title="Valid: Namespace declaration with braces."> + <![CDATA[ +namespace Vendor\Project\Scoped <em>{</em> + // Code. +<em>}</em> + ]]> + </code> + <code title="Invalid: Namespace declaration without braces."> + <![CDATA[ +namespace Vendor\Project\Sub<em>;</em> + +// Code + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Namespaces/OneDeclarationPerFileStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Namespaces/OneDeclarationPerFileStandard.xml new file mode 100644 index 00000000..6aa0f15c --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Namespaces/OneDeclarationPerFileStandard.xml @@ -0,0 +1,27 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="One Namespace Declaration Per File" + > + <standard> + <![CDATA[ + There should be only one namespace declaration per file. + ]]> + </standard> + <code_comparison> + <code title="Valid: One namespace declaration in a file."> + <![CDATA[ +namespace Vendor\Project\Sub; + ]]> + </code> + <code title="Invalid: Multiple namespace declarations in a file."> + <![CDATA[ +namespace Vendor\Project\Sub\A { +} + +<em>namespace Vendor\Project\Sub\B { +}</em> + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/NamingConventions/NoReservedKeywordParameterNamesStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/NamingConventions/NoReservedKeywordParameterNamesStandard.xml new file mode 100644 index 00000000..d44935cf --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/NamingConventions/NoReservedKeywordParameterNamesStandard.xml @@ -0,0 +1,23 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="No Reserved Keyword Parameter Names" + > + <standard> + <![CDATA[ + It is recommended not to use reserved keywords as parameter names as this can become confusing when people use them in function calls using named parameters. + ]]> + </standard> + <code_comparison> + <code title="Valid: parameter names do not use reserved keywords."> + <![CDATA[ +function foo( $input, $description ) {} + ]]> + </code> + <code title="Invalid: parameter names use reserved keywords."> + <![CDATA[ +function foo( $string, $echo = true ) {} + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/OOStructures/AlphabeticExtendsImplementsStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/OOStructures/AlphabeticExtendsImplementsStandard.xml new file mode 100644 index 00000000..f22a7193 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/OOStructures/AlphabeticExtendsImplementsStandard.xml @@ -0,0 +1,27 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Alphabetic Extends Implements" + > + <standard> + <![CDATA[ + The names used in class "implements" or interface "extends" statements should be listed in alphabetic order. + ]]> + </standard> + <code_comparison> + <code title="Valid: Names listed alphabetically."> + <![CDATA[ +class Baz implements <em>Bar, Foo</em> +{ +} + ]]> + </code> + <code title="Invalid: Names not listed alphabetically."> + <![CDATA[ +class Baz implements <em>Foo, Bar</em> +{ +} + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/ConcatPositionStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/ConcatPositionStandard.xml new file mode 100644 index 00000000..4d2761af --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/ConcatPositionStandard.xml @@ -0,0 +1,31 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Concatenation position" + > + <standard> + <![CDATA[ + Enforces that the concatenation operator for multi-line concatenations is in a preferred position, either always at the start of the next line or always at the end of the previous line. + + The preferred position is configurable and defaults to "start" for _start of the next line_. + + Note: mid-line concatenation is still allowed and will not be flagged by this sniff. + ]]> + </standard> + <code_comparison> + <code title="Valid: multi-line concatenation with the concatenation operator at the start of each line."> + <![CDATA[ +$var = 'text' . $a + <em>.</em> $b . 'text' + <em>.</em> $c; + ]]> + </code> + <code title="Invalid: multi-line concatenation with the concatenation operator not consistently at the start of each line."> + <![CDATA[ +$var = 'text' . $a <em>.</em> + $b . 'text' + <em>.</em> $c; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/DisallowLogicalAndOrStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/DisallowLogicalAndOrStandard.xml new file mode 100644 index 00000000..4e398784 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/DisallowLogicalAndOrStandard.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Disallow Logical And Or" + > + <standard> + <![CDATA[ + Using the logical "and" and "or" operators is not allowed. + + The logical "and" and "or" operators have a significantly lower operator precedence than their boolean "&&" and "||" counter-parts, which often leads to unexpected bugs. + The boolean "&&" and "||" operators are nearly always the better choice. + ]]> + </standard> + <code_comparison> + <code title="Valid: Using boolean operators."> + <![CDATA[ +if (isset($var) <em>&&</em> $var > 10) {} + +if (empty($var) <em>||</em> $var < 0) {} + ]]> + </code> + <code title="Invalid: Using logical operators."> + <![CDATA[ +if (isset($var) <em>and</em> $var > 10) {} + +if (empty($var) <em>or</em> $var < 0) {} + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/DisallowShortTernaryStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/DisallowShortTernaryStandard.xml new file mode 100644 index 00000000..0ef2ea31 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/DisallowShortTernaryStandard.xml @@ -0,0 +1,26 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Disallow Short Ternary" + > + <standard> + <![CDATA[ + Using short ternaries is not allowed. + + While short ternaries are useful when used correctly, the principle of them is often misunderstood and they are more often than not used incorrectly, leading to hard to debug issues and/or PHP warnings/notices. + ]]> + </standard> + <code_comparison> + <code title="Valid: Full ternary."> + <![CDATA[ +echo !empty($a) <em>?</em> $a <em>:</em> 'default'; + ]]> + </code> + <code title="Invalid: Short ternary."> + <![CDATA[ +echo !empty($a) <em>?:</em> 'default'; +echo $a <em>? :</em> 'default'; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/DisallowStandalonePostIncrementDecrementStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/DisallowStandalonePostIncrementDecrementStandard.xml new file mode 100644 index 00000000..06780034 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/DisallowStandalonePostIncrementDecrementStandard.xml @@ -0,0 +1,44 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Disallow Standalone Post-Increment/Decrement" + > + <standard> + <![CDATA[ + In a stand-alone in/decrement statement, pre-in/decrement should always be favoured over post-in/decrement. + + This reduces the chance of bugs when code gets moved around. + ]]> + </standard> + <code_comparison> + <code title="Valid: Pre-in/decrement in a stand-alone statement."> + <![CDATA[ +<em>++</em>$i; +<em>--</em>$j; + ]]> + </code> + <code title="Invalid: Post-in/decrement in a stand-alone statement."> + <![CDATA[ +$i<em>++</em>; +$j<em>--</em>; + ]]> + </code> + </code_comparison> + <standard> + <![CDATA[ + Using multiple increment/decrement operators in a stand-alone statement is strongly discouraged. + ]]> + </standard> + <code_comparison> + <code title="Valid: Single in/decrement operator in a stand-alone statement."> + <![CDATA[ +<em>++</em>$i; + ]]> + </code> + <code title="Invalid: Multiple in/decrement operators in a stand-alone statement."> + <![CDATA[ +<em>--</em>$i<em>++</em><em>++</em>; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/StrictComparisonsStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/StrictComparisonsStandard.xml new file mode 100644 index 00000000..b4507ede --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/StrictComparisonsStandard.xml @@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Strict Comparisons" + > + <standard> + <![CDATA[ + Using loose comparisons is not allowed. + + Loose comparisons will type juggle the values being compared, which often results in bugs. + ]]> + </standard> + <code_comparison> + <code title="Valid: Using strict comparisons."> + <![CDATA[ +if ($var <em>===</em> 'text') {} + +if ($var <em>!==</em> true) {} + ]]> + </code> + <code title="Invalid: Using loose comparisons."> + <![CDATA[ +if ($var <em>==</em> 'text') {} + +if ($var <em>!=</em> true) {} + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/TypeSeparatorSpacingStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/TypeSeparatorSpacingStandard.xml new file mode 100644 index 00000000..3d3c328e --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/TypeSeparatorSpacingStandard.xml @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Type Separator Spacing" + > + <standard> + <![CDATA[ + There should be no spacing around the union type separator or the intersection type separator. + + This applies to all locations where type declarations can be used, i.e. property types, parameter types and return types. + ]]> + </standard> + <code_comparison> + <code title="Valid: No space around the separators."> + <![CDATA[ +function foo( + int<em>|</em>string $paramA, + TypeA<em>&</em>TypeB $paramB +): int<em>|</em>false {} + ]]> + </code> + <code title="Invalid: Space around the separators."> + <![CDATA[ +function foo( + int<em> | </em>string $paramA, + TypeA<em> & </em>TypeB $paramB +): int<em> + | + </em>false {} + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/PHP/LowercasePHPTagStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/PHP/LowercasePHPTagStandard.xml new file mode 100644 index 00000000..261f93cd --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/PHP/LowercasePHPTagStandard.xml @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Lowercase PHP Tag" + > + <standard> + <![CDATA[ + Enforces that the PHP open tag is lowercase. + ]]> + </standard> + <code_comparison> + <code title="Valid: Lowercase open tag."> + <![CDATA[ +<?php +echo 'hello!'; + ]]> + </code> + <code title="Invalid: Uppercase open tag."> + <![CDATA[ +<?PHP +echo 'hello!'; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/PHP/OneStatementInShortEchoTagStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/PHP/OneStatementInShortEchoTagStandard.xml new file mode 100644 index 00000000..103ca13e --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/PHP/OneStatementInShortEchoTagStandard.xml @@ -0,0 +1,41 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="One Statement In Short Echo Tag" + > + <standard> + <![CDATA[ + Best practice: Short open echo tags should only ever contain *one* statement. + Use normal "<?php" tags for multi-statement PHP. + ]]> + </standard> + <code_comparison> + <code title="Valid: Using short open echo tag with one statement."> + <![CDATA[ +div><?= $text ?></div> + ]]> + </code> + <code title="Invalid: Using short open echo tag with multiple statements."> + <![CDATA[ +<div><em><?=</em> $text; <em>echo $moreText;</em> ?></div> + ]]> + </code> + </code_comparison> + <code_comparison> + <code title="Valid: Using normal PHP tag with multiple statements."> + <![CDATA[ +<div><em><?php</em> +echo $text; +echo $moreText; +?></div> + ]]> + </code> + <code title="Invalid: Using short open echo tag with multiple statements."> + <![CDATA[ +<div><em><?=</em> $text; +<em>echo $moreText;</em> +?></div> + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/DisallowMixedGroupUseStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/DisallowMixedGroupUseStandard.xml new file mode 100644 index 00000000..2b930f27 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/DisallowMixedGroupUseStandard.xml @@ -0,0 +1,39 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Disallow Mixed Group Use" + > + <standard> + <![CDATA[ + Disallow group use statements which combine imports for namespace/OO, functions and/or constants in one statement. + ]]> + </standard> + <code_comparison> + <code title="Valid: Single type group use statements."> + <![CDATA[ +use Some\NS\ { + ClassName, + AnotherClass, +}; +use function Some\NS\ { + SubLevel\functionName, + SubLevel\AnotherFunction, +}; +use const Some\NS\ { + Constants\MY_CONSTANT as SOME_CONSTANT, +}; + ]]> + </code> + <code title="Invalid: Mixed group use statement."> + <![CDATA[ +use Some\NS\ { + ClassName, + function SubLevel\functionName, + const MY_CONSTANT as SOME_CONSTANT, + function SubLevel\AnotherName, + AnotherLevel, +}; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/DisallowUseClassStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/DisallowUseClassStandard.xml new file mode 100644 index 00000000..1699d9db --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/DisallowUseClassStandard.xml @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Disallow Use Class/Trait/Interface" + > + <standard> + <![CDATA[ + Disallow the use of `use` import statements for classes, traits and interfaces, with or without alias. + ]]> + </standard> + <code_comparison> + <code title="Valid: Other type of use import statements."> + <![CDATA[ +use function Vendor\Sub\functionName; +use const Vendor\Sub\CONST; + ]]> + </code> + <code title="Invalid: Class/trait/interface use import statement."> + <![CDATA[ +use Vendor\Sub\ClassName; +use Vendor\Sub\InterfaceName as Other; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/DisallowUseConstStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/DisallowUseConstStandard.xml new file mode 100644 index 00000000..0dbec70b --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/DisallowUseConstStandard.xml @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Disallow Use Const" + > + <standard> + <![CDATA[ + Disallow the use of `use const` import statements, with or without alias. + ]]> + </standard> + <code_comparison> + <code title="Valid: Other type of use import statements."> + <![CDATA[ +use Vendor\Sub\ClassName; +use function Vendor\Sub\functionName; + ]]> + </code> + <code title="Invalid: use const import statements."> + <![CDATA[ +use const Vendor\Sub\CONST; +use const Vendor\Sub\BAR as otherConst; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/DisallowUseFunctionStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/DisallowUseFunctionStandard.xml new file mode 100644 index 00000000..f3cb1f67 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/DisallowUseFunctionStandard.xml @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Disallow Use Function" + > + <standard> + <![CDATA[ + Disallow the use of `use function` import statements, with or without alias. + ]]> + </standard> + <code_comparison> + <code title="Valid: Other type of use import statements."> + <![CDATA[ +use Vendor\Sub\ClassName; +use const Vendor\Sub\CONST; + ]]> + </code> + <code title="Invalid: use function import statements."> + <![CDATA[ +use function Vendor\Sub\functionName; +use function Vendor\Sub\functionName as other; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/KeywordSpacingStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/KeywordSpacingStandard.xml new file mode 100644 index 00000000..55d430e2 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/KeywordSpacingStandard.xml @@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Import Use Keyword Spacing" + > + <standard> + <![CDATA[ + Enforce a single space after the `use`, `function`, `const` keywords and both before and after the `as` keyword in import `use` statements. + ]]> + </standard> + <code_comparison> + <code title="Valid: Single space used around keywords."> + <![CDATA[ +use<em> </em>function<em> </em>strpos; +use<em> </em>const<em> </em>PHP_EOL<em> </em>as<em> </em>MY_EOL; + ]]> + </code> + <code title="Invalid: Incorrect spacing used around keywords."> + <![CDATA[ +use<em> </em>function<em> </em>strpos; +use<em> + </em>const<em> + </em>PHP_EOL<em> + </em>as<em> + </em>MY_EOL; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/LowercaseFunctionConstStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/LowercaseFunctionConstStandard.xml new file mode 100644 index 00000000..66acd83b --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/LowercaseFunctionConstStandard.xml @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Lowercase Function Const" + > + <standard> + <![CDATA[ + `function` and `const` keywords in import `use` statements should be in lowercase. + ]]> + </standard> + <code_comparison> + <code title="Valid: Lowercase keywords."> + <![CDATA[ +use <em>function</em> strpos; +use <em>const</em> PHP_EOL; + ]]> + </code> + <code title="Invalid: Non-lowercase keywords."> + <![CDATA[ +use <em>Function</em> strpos; +use <em>CONST</em> PHP_EOL; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/NoLeadingBackslashStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/NoLeadingBackslashStandard.xml new file mode 100644 index 00000000..ff0b786c --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/NoLeadingBackslashStandard.xml @@ -0,0 +1,23 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="No Leading Backslash" + > + <standard> + <![CDATA[ + Import `use` statements must never begin with a leading backslash as they should always be fully qualified. + ]]> + </standard> + <code_comparison> + <code title="Valid: Import use statement without leading backslash."> + <![CDATA[ +<em>use Package</em>\ClassName; + ]]> + </code> + <code title="Invalid: Import use statement with leading backslash."> + <![CDATA[ +use <em>\</em>Package\ClassName; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/NoUselessAliasesStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/NoUselessAliasesStandard.xml new file mode 100644 index 00000000..39bb90d1 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/NoUselessAliasesStandard.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="No Useless Aliases" + > + <standard> + <![CDATA[ + Detects useless aliases for import use statements. + + Aliasing something to the same name as the original construct is considered useless. + Note: as OO and function names in PHP are case-insensitive, aliasing to the same name, using a different case is also considered useless. + ]]> + </standard> + <code_comparison> + <code title="Valid: Import use statement with an alias to a different name."> + <![CDATA[ +use Vendor\Package\ClassName as AnotherName; +use function functionName as my_function; +use const SOME_CONSTANT as MY_CONSTANT; + ]]> + </code> + <code title="Invalid: Import use statement with an alias to the same name."> + <![CDATA[ +use Vendor\Package\ClassName as ClassName; +use function functionName as FunctionName; +use const SOME_CONSTANT as SOME_CONSTANT; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/WhiteSpace/AnonClassKeywordSpacingStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/WhiteSpace/AnonClassKeywordSpacingStandard.xml new file mode 100644 index 00000000..1770f747 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/WhiteSpace/AnonClassKeywordSpacingStandard.xml @@ -0,0 +1,31 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Anonymous Class Keyword Spacing" + > + <standard> + <![CDATA[ + Checks the spacing between the "class" keyword and the open parenthesis for anonymous classes with parentheses. + + The desired amount of spacing is configurable and defaults to no space. + ]]> + </standard> + <code_comparison> + <code title="Valid: No space between the class keyword and the open parenthesis."> + <![CDATA[ +$foo = new <em>class(</em>$param) +{ + public function __construct($p) {} +}; + ]]> + </code> + <code title="Invalid: Space between the class keyword and the open parenthesis."> + <![CDATA[ +$foo = new <em>class (</em>$param) +{ + public function __construct($p) {} +}; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/WhiteSpace/CommaSpacingStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/WhiteSpace/CommaSpacingStandard.xml new file mode 100644 index 00000000..503ae6f7 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/WhiteSpace/CommaSpacingStandard.xml @@ -0,0 +1,94 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Comma Spacing" + > + <standard> + <![CDATA[ + There should be no space before a comma and exactly one space, or a new line, after a comma. + + The sniff makes the following exceptions to this rule: + 1. A comma preceded or followed by a parenthesis, curly or square bracket. + These will not be flagged to prevent conflicts with sniffs handling spacing around braces. + 2. A comma preceded or followed by another comma, like for skipping items in a list assignment. + These will not be flagged. + 3. A comma preceded by a non-indented heredoc/nowdoc closer. + In that case, unless the `php_version` config directive is set to a version higher than PHP 7.3.0, + a new line before will be enforced to prevent parse errors on PHP < 7.3. + ]]> + </standard> + <code_comparison> + <code title="Valid: Correct spacing."> + <![CDATA[ +isset($param1<em>, </em>$param2<em>, </em>$param3); + +function_call( + $param1<em>,</em> + $param2<em>,</em> + $param3 +); + +$array = array($item1<em>, </em>$item2<em>, </em>$item3); +$array = [ + $item1<em>,</em> + $item2<em>,</em> +]; + +list(, $a<em>, </em>$b<em>,</em>,) = $array; +list( + , + $a<em>,</em> + $b<em>,</em> +) = $array; + ]]> + </code> + <code title="Invalid: Incorrect spacing."> + <![CDATA[ +unset($param1<em> , </em>$param2<em>,</em>$param3); + +function_call( + $a + <em>,</em>$b + <em>,</em>$c +); + +$array = array($item1<em>,</em>$item2<em> , </em>$item3); +$array = [ + $item1, + $item2<em> ,</em> +]; + +list( ,$a, $b<em> ,</em>,) = $array; +list( + , + $a, + $b<em> ,</em> +) = $array; + ]]> + </code> + </code_comparison> + <standard> + <![CDATA[ + A comma should follow the code and not be placed after a trailing comment. + ]]> + </standard> + <code_comparison> + <code title="Valid: Comma after the code."> + <![CDATA[ +function_call( + $param1<em>,</em> // Comment. + $param2<em>,</em> /* Comment. */ +); + ]]> + </code> + <code title="Invalid: Comma after a trailing comment."> + <![CDATA[ +function_call( + $param1 // Comment. + <em>,</em> + $param2 /* Comment. */<em>,</em> +); + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/WhiteSpace/DisallowInlineTabsStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/WhiteSpace/DisallowInlineTabsStandard.xml new file mode 100644 index 00000000..b259ab40 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/WhiteSpace/DisallowInlineTabsStandard.xml @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Disallow Inline Tabs" + > + <standard> + <![CDATA[ + Spaces must be used for mid-line alignment. + ]]> + </standard> + <code_comparison> + <code title="Valid: Spaces used for alignment."> + <![CDATA[ +$title<em>[space]</em>= 'text'; +$text<em>[space][space]</em>= 'more text'; + ]]> + </code> + <code title="Invalid: Tabs used for alignment."> + <![CDATA[ +$title<em>[tab]</em>= 'text'; +$text<em>[tab]</em>= 'more text'; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Docs/WhiteSpace/PrecisionAlignmentStandard.xml b/vendor/phpcsstandards/phpcsextra/Universal/Docs/WhiteSpace/PrecisionAlignmentStandard.xml new file mode 100644 index 00000000..cde20f25 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Docs/WhiteSpace/PrecisionAlignmentStandard.xml @@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Precision Alignment" + > + <standard> + <![CDATA[ + Detects when the indentation is not a multiple of a tab-width, i.e. when precision alignment is used. + ]]> + </standard> + <code_comparison> + <code title="Valid: indentation equals (a multiple of) the tab width."> + <![CDATA[ +// Code samples presume tab width = 4. +<em>[space][space][space][space]</em>$foo = 'bar'; + +<em>[tab]</em>$foo = 'bar'; + ]]> + </code> + <code title="Invalid: precision alignment used, indentation does not equal (a multiple of) the tab width."> + <![CDATA[ +// Code samples presume tab width = 4. +<em>[space][space]</em>$foo = 'bar'; + +<em>[tab][space]</em>$foo = 'bar'; + ]]> + </code> + </code_comparison> +</documentation> diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Helpers/DummyTokenizer.php b/vendor/phpcsstandards/phpcsextra/Universal/Helpers/DummyTokenizer.php new file mode 100644 index 00000000..7c172e34 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Helpers/DummyTokenizer.php @@ -0,0 +1,60 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Helpers; + +use PHP_CodeSniffer\Tokenizers\Tokenizer; + +/** + * Dummy tokenizer class to allow for accessing the replaceTabsInToken() method. + * + * @codeCoverageIgnore + * + * @since 1.0.0 + */ +final class DummyTokenizer extends Tokenizer +{ + + /** + * Initialise and (don't) run the tokenizer. + * + * @param string $content The content to tokenize, + * @param \PHP_CodeSniffer\Config | null $config The config data for the run. + * @param string $eolChar The EOL char used in the content. + * + * @return void + */ + public function __construct($content, $config, $eolChar = '\n') + { + $this->eolChar = $eolChar; + $this->config = $config; + } + + /** + * Creates an array of tokens when given some content. + * + * @param string $string The string to tokenize. + * + * @return array<int, array<string, mixed>> + */ + protected function tokenize($string) + { + return []; + } + + /** + * Performs additional processing after main tokenizing. + * + * @return void + */ + protected function processAdditional() + { + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Arrays/DisallowShortArraySyntaxSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Arrays/DisallowShortArraySyntaxSniff.php new file mode 100644 index 00000000..829daaa9 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Arrays/DisallowShortArraySyntaxSniff.php @@ -0,0 +1,89 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Arrays; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHPCSUtils\Tokens\Collections; +use PHPCSUtils\Utils\Arrays; + +/** + * Disallow the use of the short array syntax. + * + * Improved version of the upstream `Generic.Arrays.DisallowShortArraySyntax` sniff which does + * not account for short lists and because of this can cause parse errors when auto-fixing. + * + * Other related sniffs: + * - `Generic.Arrays.DisallowLongArraySyntax` Forbids the use of the long array syntax. + * + * @since 1.0.0 This sniff is loosely based on and inspired by the upstream + * `Generic.Arrays.DisallowShortArraySyntax` sniff. + */ +final class DisallowShortArraySyntaxSniff implements Sniff +{ + + /** + * The phrase to use for the metric recorded by this sniff. + * + * @var string + */ + const METRIC_NAME = 'Short array syntax used'; + + /** + * Registers the tokens that this sniff wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return Collections::arrayOpenTokensBC(); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + if ($tokens[$stackPtr]['code'] === \T_ARRAY) { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'no'); + return; + } + + if (Arrays::isShortArray($phpcsFile, $stackPtr) === false) { + // Square brackets, but not a short array. Probably short list or real square brackets. + return; + } + + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'yes'); + + $error = 'Short array syntax is not allowed'; + $fix = $phpcsFile->addFixableError($error, $stackPtr, 'Found'); + + if ($fix === true) { + $phpcsFile->fixer->beginChangeset(); + $phpcsFile->fixer->replaceToken($tokens[$stackPtr]['bracket_opener'], 'array('); + $phpcsFile->fixer->replaceToken($tokens[$stackPtr]['bracket_closer'], ')'); + $phpcsFile->fixer->endChangeset(); + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Arrays/DuplicateArrayKeySniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Arrays/DuplicateArrayKeySniff.php new file mode 100644 index 00000000..7097fad7 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Arrays/DuplicateArrayKeySniff.php @@ -0,0 +1,297 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Arrays; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\AbstractSniffs\AbstractArrayDeclarationSniff; +use PHPCSUtils\BackCompat\Helper; + +/** + * Detect duplicate array keys in array declarations. + * + * This sniff will detect duplicate keys with high precision, though any array key + * set via a variable/constant/function call is excluded from the examination. + * + * The sniff will handle the change in how numeric array keys are set + * since PHP 8.0 and will flag keys which would be duplicates cross-version. + * {@link https://wiki.php.net/rfc/negative_array_index} + * + * @since 1.0.0 + */ +final class DuplicateArrayKeySniff extends AbstractArrayDeclarationSniff +{ + + /** + * Keep track of which array keys have been seen already on PHP < 8.0. + * + * @since 1.0.0 + * + * @var array<int, array<string, int>> + */ + private $keysSeenLt8 = []; + + /** + * Keep track of which array keys have been seen already on PHP >= 8.0. + * + * @since 1.0.0 + * + * @var array<int, array<string, int>> + */ + private $keysSeenGt8 = []; + + /** + * Keep track of the maximum seen integer key to know what the next value will be for + * array items without a key on PHP < 8.0. + * + * @since 1.0.0 + * + * @var int + */ + private $currentMaxIntKeyLt8; + + /** + * Keep track of the maximum seen integer key to know what the next value will be for + * array items without a key on PHP >= 8.0. + * + * @since 1.0.0 + * + * @var int + */ + private $currentMaxIntKeyGt8; + + /** + * PHP version as configured or -1 if unknown. + * + * @since 1.0.0 + * + * @var int + */ + private $phpVersion; + + /** + * Process every part of the array declaration. + * + * This contains the default logic for the sniff, but can be overloaded in a concrete child class + * if needed. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The PHP_CodeSniffer file where the + * token was found. + * + * @return void + */ + public function processArray(File $phpcsFile) + { + // Reset properties before processing this array. + $this->keysSeenLt8 = []; + $this->keysSeenGt8 = []; + + if (isset($this->phpVersion) === false) { + // Set default value to prevent this code from running every time the sniff is triggered. + $this->phpVersion = -1; + + $phpVersion = Helper::getConfigData('php_version'); + if ($phpVersion !== null) { + $this->phpVersion = (int) $phpVersion; + } + } + + unset($this->currentMaxIntKeyLt8, $this->currentMaxIntKeyGt8); + + parent::processArray($phpcsFile); + } + + /** + * Process the tokens in an array key. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The PHP_CodeSniffer file where the + * token was found. + * @param int $startPtr The stack pointer to the first token in the "key" part of + * an array item. + * @param int $endPtr The stack pointer to the last token in the "key" part of + * an array item. + * @param int $itemNr Which item in the array is being handled. + * + * @return void + */ + public function processKey(File $phpcsFile, $startPtr, $endPtr, $itemNr) + { + $key = $this->getActualArrayKey($phpcsFile, $startPtr, $endPtr); + + if (isset($key) === false) { + // Key could not be determined. + return; + } + + $integerKey = \is_int($key); + + $errorMsg = 'Duplicate array key found. The value will be overwritten%s.' + . ' The %s array key "%s" was first seen on line %d'; + $errorCode = 'Found'; + $errors = []; + $baseData = [ + ($integerKey === true) ? 'integer' : 'string', + $key, + ]; + + /* + * Check if we've seen the key before. + */ + if (($this->phpVersion === -1 || $this->phpVersion < 80000) + && isset($this->keysSeenLt8[$key]) === true + ) { + $errors['phplt8'] = [ + 'data_subset' => $baseData, + 'error_suffix' => '', + 'code_suffix' => '', + ]; + + if ($integerKey === true) { + $errors['phplt8']['error_suffix'] = ' when using PHP < 8.0'; + $errors['phplt8']['code_suffix'] = 'ForPHPlt80'; + } + + $firstSeen = $this->keysSeenLt8[$key]; + $firstNonEmptyFirstSeen = $phpcsFile->findNext(Tokens::$emptyTokens, $firstSeen['ptr'], null, true); + + $errors['phplt8']['data_subset'][] = $this->tokens[$firstNonEmptyFirstSeen]['line']; + } + + if (($this->phpVersion === -1 || $this->phpVersion >= 80000) + && isset($this->keysSeenGt8[$key]) === true + ) { + $errors['phpgt8'] = [ + 'data_subset' => $baseData, + 'error_suffix' => '', + 'code_suffix' => '', + ]; + + if ($integerKey === true) { + $errors['phpgt8']['error_suffix'] = ' when using PHP >= 8.0'; + $errors['phpgt8']['code_suffix'] = 'ForPHPgte80'; + } + + $firstSeen = $this->keysSeenGt8[$key]; + $firstNonEmptyFirstSeen = $phpcsFile->findNext(Tokens::$emptyTokens, $firstSeen['ptr'], null, true); + + $errors['phpgt8']['data_subset'][] = $this->tokens[$firstNonEmptyFirstSeen]['line']; + } + + /* + * Throw the error(s). + * + * If no PHP version was passed, throw errors both for PHP < 8.0 and PHP >= 8.0. + * If a PHP version was set, only throw the error appropriate for the selected PHP version. + * If both errors would effectively be the same, only throw one. + */ + if ($errors !== []) { + $firstNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $startPtr, null, true); + + if (isset($errors['phplt8'], $errors['phpgt8']) + && $errors['phplt8']['data_subset'] === $errors['phpgt8']['data_subset'] + ) { + // Only throw the error once if it would be the same for PHP < 8.0 and PHP >= 8.0. + $data = $errors['phplt8']['data_subset']; + \array_unshift($data, ''); + + $phpcsFile->addError($errorMsg, $firstNonEmpty, $errorCode, $data); + return; + } + + if (isset($errors['phplt8'])) { + $code = $errorCode . $errors['phplt8']['code_suffix']; + $data = $errors['phplt8']['data_subset']; + \array_unshift($data, $errors['phplt8']['error_suffix']); + + $phpcsFile->addError($errorMsg, $firstNonEmpty, $code, $data); + } + + if (isset($errors['phpgt8'])) { + $code = $errorCode . $errors['phpgt8']['code_suffix']; + $data = $errors['phpgt8']['data_subset']; + \array_unshift($data, $errors['phpgt8']['error_suffix']); + + $phpcsFile->addError($errorMsg, $firstNonEmpty, $code, $data); + } + + return; + } + + /* + * Key not seen before. Add to arrays. + */ + $this->keysSeenLt8[$key] = [ + 'item' => $itemNr, + 'ptr' => $startPtr, + ]; + $this->keysSeenGt8[$key] = [ + 'item' => $itemNr, + 'ptr' => $startPtr, + ]; + + if ($integerKey === true) { + if ((isset($this->currentMaxIntKeyLt8) === false && $key > -1) + || (isset($this->currentMaxIntKeyLt8) === true && $key > $this->currentMaxIntKeyLt8) + ) { + $this->currentMaxIntKeyLt8 = $key; + } + + if (isset($this->currentMaxIntKeyGt8) === false + || $key > $this->currentMaxIntKeyGt8 + ) { + $this->currentMaxIntKeyGt8 = $key; + } + } + } + + /** + * Process an array item without an array key. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The PHP_CodeSniffer file where the + * token was found. + * @param int $startPtr The stack pointer to the first token in the array item, + * which in this case will be the first token of the array + * value part of the array item. + * @param int $itemNr Which item in the array is being handled. + * + * @return void + */ + public function processNoKey(File $phpcsFile, $startPtr, $itemNr) + { + // Track the key for PHP < 8.0. + if (isset($this->currentMaxIntKeyLt8) === false) { + $this->currentMaxIntKeyLt8 = -1; + } + + ++$this->currentMaxIntKeyLt8; + $this->keysSeenLt8[$this->currentMaxIntKeyLt8] = [ + 'item' => $itemNr, + 'ptr' => $startPtr, + ]; + + // Track the key for PHP 8.0+. + if (isset($this->currentMaxIntKeyGt8) === false) { + $this->currentMaxIntKeyGt8 = -1; + } + + ++$this->currentMaxIntKeyGt8; + $this->keysSeenGt8[$this->currentMaxIntKeyGt8] = [ + 'item' => $itemNr, + 'ptr' => $startPtr, + ]; + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Arrays/MixedArrayKeyTypesSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Arrays/MixedArrayKeyTypesSniff.php new file mode 100644 index 00000000..49d9260b --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Arrays/MixedArrayKeyTypesSniff.php @@ -0,0 +1,174 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Arrays; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\AbstractSniffs\AbstractArrayDeclarationSniff; + +/** + * Forbid arrays which contain both array items with numeric keys as well as array items with string keys. + * + * @since 1.0.0 + */ +final class MixedArrayKeyTypesSniff extends AbstractArrayDeclarationSniff +{ + + /** + * Whether a string key was encountered. + * + * @var bool + */ + private $seenStringKey = false; + + /** + * Whether a numeric key was encountered. + * + * @var bool + */ + private $seenNumericKey = false; + + /** + * Process the array declaration. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The PHP_CodeSniffer file where the + * token was found. + * + * @return void + */ + public function processArray(File $phpcsFile) + { + // Reset properties before processing this array. + $this->seenStringKey = false; + $this->seenNumericKey = false; + + parent::processArray($phpcsFile); + } + + /** + * Process the tokens in an array key. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The PHP_CodeSniffer file where the + * token was found. + * @param int $startPtr The stack pointer to the first token in the "key" part of + * an array item. + * @param int $endPtr The stack pointer to the last token in the "key" part of + * an array item. + * @param int $itemNr Which item in the array is being handled. + * + * @return true|void Returning `TRUE` will short-circuit the array item loop and stop processing. + * In effect, this means that the sniff will not examine the double arrow, the array + * value or comma for this array item and will not process any array items after this one. + */ + public function processKey(File $phpcsFile, $startPtr, $endPtr, $itemNr) + { + $key = $this->getActualArrayKey($phpcsFile, $startPtr, $endPtr); + if (isset($key) === false) { + // Key could not be determined. + return; + } + + $integerKey = \is_int($key); + + // Handle integer key. + if ($integerKey === true) { + if ($this->seenStringKey === false) { + if ($this->seenNumericKey !== false) { + // Already seen a numeric key before. + return; + } + + $this->seenNumericKey = true; + return; + } + + // Ok, so we've seen a string key before and now see an explicit numeric key. + $firstNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $startPtr, null, true); + $phpcsFile->addError( + 'Arrays should have either numeric keys or string keys. Explicit numeric key detected,' + . ' while all previous keys in this array were string keys.', + $firstNonEmpty, + 'ExplicitNumericKey' + ); + + // Stop the loop. + return true; + } + + // Handle string key. + if ($this->seenNumericKey === false) { + if ($this->seenStringKey !== false) { + // Already seen a string key before. + return; + } + + $this->seenStringKey = true; + return; + } + + // Ok, so we've seen a numeric key before and now see a string key. + $firstNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $startPtr, null, true); + $phpcsFile->addError( + 'Arrays should have either numeric keys or string keys. String key detected,' + . ' while all previous keys in this array were integer based keys.', + $firstNonEmpty, + 'StringKey' + ); + + // Stop the loop. + return true; + } + + /** + * Process an array item without an array key. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The PHP_CodeSniffer file where the + * token was found. + * @param int $startPtr The stack pointer to the first token in the array item, + * which in this case will be the first token of the array + * value part of the array item. + * @param int $itemNr Which item in the array is being handled. + * + * @return true|void Returning `TRUE` will short-circuit the array item loop and stop processing. + * In effect, this means that the sniff will not examine the array value or + * comma for this array item and will not process any array items after this one. + */ + public function processNoKey(File $phpcsFile, $startPtr, $itemNr) + { + if ($this->seenStringKey === false) { + if ($this->seenNumericKey !== false) { + // Already seen a numeric key before. + return; + } + + $this->seenNumericKey = true; + return; + } + + // Ok, so we've seen a string key before and now see an implicit numeric key. + $firstNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $startPtr, null, true); + $phpcsFile->addError( + 'Arrays should have either numeric keys or string keys. Implicit numeric key detected,' + . ' while all previous keys in this array were string keys.', + $firstNonEmpty, + 'ImplicitNumericKey' + ); + + // Stop the loop. + return true; + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Arrays/MixedKeyedUnkeyedArraySniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Arrays/MixedKeyedUnkeyedArraySniff.php new file mode 100644 index 00000000..c47f217f --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Arrays/MixedKeyedUnkeyedArraySniff.php @@ -0,0 +1,134 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Arrays; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\AbstractSniffs\AbstractArrayDeclarationSniff; + +/** + * Forbid arrays which contain both array items with an explicit key and array items without a key set. + * + * @since 1.0.0 + */ +final class MixedKeyedUnkeyedArraySniff extends AbstractArrayDeclarationSniff +{ + + /** + * Whether or not any array items with a key were encountered in the array. + * + * @since 1.0.0 + * + * @var bool + */ + private $hasKeys = false; + + /** + * Cache of any array items encountered without keys up to the time an array item _with_ a key is encountered. + * + * @since 1.0.0 + * + * @var array<int, int> Key is the item number; value the stack point to the first non empty token in the item. + */ + private $itemsWithoutKey = []; + + /** + * Process the array declaration. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The PHP_CodeSniffer file where the + * token was found. + * + * @return void + */ + public function processArray(File $phpcsFile) + { + // Reset properties before processing this array. + $this->hasKeys = false; + $this->itemsWithoutKey = []; + + parent::processArray($phpcsFile); + } + + /** + * Process the tokens in an array key. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The PHP_CodeSniffer file where the + * token was found. + * @param int $startPtr The stack pointer to the first token in the "key" part of + * an array item. + * @param int $endPtr The stack pointer to the last token in the "key" part of + * an array item. + * @param int $itemNr Which item in the array is being handled. + * + * @return void + */ + public function processKey(File $phpcsFile, $startPtr, $endPtr, $itemNr) + { + $this->hasKeys = true; + + // Process any previously encountered items without keys. + if (empty($this->itemsWithoutKey) === false) { + foreach ($this->itemsWithoutKey as $itemNr => $stackPtr) { + $phpcsFile->addError( + 'Inconsistent array detected. A mix of keyed and unkeyed array items is not allowed.' + . ' The array item in position %d does not have an array key.', + $stackPtr, + 'Found', + [$itemNr] + ); + } + + // No need to do this again. + $this->itemsWithoutKey = []; + } + } + + /** + * Process an array item without an array key. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The PHP_CodeSniffer file where the + * token was found. + * @param int $startPtr The stack pointer to the first token in the array item, + * which in this case will be the first token of the array + * value part of the array item. + * @param int $itemNr Which item in the array is being handled. + * + * @return void + */ + public function processNoKey(File $phpcsFile, $startPtr, $itemNr) + { + $firstNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $startPtr, null, true); + if ($firstNonEmpty === false || $this->tokens[$firstNonEmpty]['code'] === \T_COMMA) { + // Shouldn't really be possible, but this must be a parse error (empty array item). + return; + } + + // If we already know there are keys in the array, throw an error message straight away. + if ($this->hasKeys === true) { + $phpcsFile->addError( + 'Inconsistent array detected. A mix of keyed and unkeyed array items is not allowed.' + . ' The array item in position %d does not have an array key.', + $firstNonEmpty, + 'Found', + [$itemNr] + ); + } else { + // Save the array item info for later in case we do encounter an array key later on in the array. + $this->itemsWithoutKey[$itemNr] = $firstNonEmpty; + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/DisallowAnonClassParenthesesSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/DisallowAnonClassParenthesesSniff.php new file mode 100644 index 00000000..dae01252 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/DisallowAnonClassParenthesesSniff.php @@ -0,0 +1,112 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Classes; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; + +/** + * Forbid for an anonymous class declaration/instantiation to have parentheses, except when + * parameters are being passed. + * + * @since 1.0.0 + */ +final class DisallowAnonClassParenthesesSniff implements Sniff +{ + + /** + * Name of the metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME = 'Anon class declaration with parenthesis'; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_ANON_CLASS]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + + // Note: no need to check for `false` as PHPCS won't retokenize `class` to `T_ANON_CLASS` in that case. + if ($tokens[$nextNonEmpty]['code'] !== \T_OPEN_PARENTHESIS) { + // No parentheses found. + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'no'); + return; + } + + if (isset($tokens[$nextNonEmpty]['parenthesis_closer']) === false) { + /* + * Incomplete set of parentheses. Ignore. + * Shouldn't be possible as PHPCS won't retokenize `class` to `T_ANON_CLASS` in that case. + */ + // @codeCoverageIgnoreStart + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'yes'); + return; + // @codeCoverageIgnoreEnd + } + + $opener = $nextNonEmpty; + $closer = $tokens[$opener]['parenthesis_closer']; + $hasParams = $phpcsFile->findNext(Tokens::$emptyTokens, ($opener + 1), $closer, true); + if ($hasParams !== false) { + // There is something between the parentheses. Ignore. + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'yes, with parameter(s)'); + return; + } + + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'yes'); + + $fix = $phpcsFile->addFixableError( + 'Parenthesis not allowed when creating a new anonymous class without passing parameters', + $stackPtr, + 'Found' + ); + + if ($fix === true) { + $phpcsFile->fixer->beginChangeset(); + + for ($i = $opener; $i <= $closer; $i++) { + if (isset(Tokens::$commentTokens[$tokens[$i]['code']]) === true) { + continue; + } + + $phpcsFile->fixer->replaceToken($i, ''); + } + + $phpcsFile->fixer->endChangeset(); + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/DisallowFinalClassSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/DisallowFinalClassSniff.php new file mode 100644 index 00000000..4e3f4719 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/DisallowFinalClassSniff.php @@ -0,0 +1,116 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Classes; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\Utils\GetTokensAsString; +use PHPCSUtils\Utils\ObjectDeclarations; + +/** + * Forbids classes from being declared as "final". + * + * @since 1.0.0 + */ +final class DisallowFinalClassSniff implements Sniff +{ + + /** + * Name of the metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME = 'Class is abstract or final ?'; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_CLASS]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $classProp = ObjectDeclarations::getClassProperties($phpcsFile, $stackPtr); + if ($classProp['is_final'] === false) { + if ($classProp['is_abstract'] === true) { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'abstract'); + return; + } + + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'not abstract, not final'); + return; + } + + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'final'); + + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($nextNonEmpty === false) { + // Live coding or parse error. + return; + } + + // No extra safeguards needed, we know the keyword will exist based on the check above. + $finalKeyword = $phpcsFile->findPrevious(\T_FINAL, ($stackPtr - 1)); + $snippetEnd = $nextNonEmpty; + $classCloser = ''; + + $tokens = $phpcsFile->getTokens(); + if (isset($tokens[$stackPtr]['scope_opener']) === true) { + $snippetEnd = $tokens[$stackPtr]['scope_opener']; + $classCloser = '}'; + } + + $snippet = GetTokensAsString::compact($phpcsFile, $finalKeyword, $snippetEnd, true); + $fix = $phpcsFile->addFixableError( + 'Declaring a class as final is not allowed. Found: %s%s', + $finalKeyword, + 'FinalClassFound', + [$snippet, $classCloser] + ); + + if ($fix === true) { + $phpcsFile->fixer->beginChangeset(); + $phpcsFile->fixer->replaceToken($finalKeyword, ''); + + // Remove redundant whitespace. + for ($i = ($finalKeyword + 1); $i < $stackPtr; $i++) { + if ($tokens[$i]['code'] === \T_WHITESPACE) { + $phpcsFile->fixer->replaceToken($i, ''); + continue; + } + + break; + } + + $phpcsFile->fixer->endChangeset(); + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/ModifierKeywordOrderSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/ModifierKeywordOrderSniff.php new file mode 100644 index 00000000..88fdfe20 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/ModifierKeywordOrderSniff.php @@ -0,0 +1,188 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2022 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Classes; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHPCSUtils\Utils\ObjectDeclarations; + +/** + * Standardize the modifier keyword order for class declarations. + * + * @since 1.0.0 + */ +final class ModifierKeywordOrderSniff implements Sniff +{ + + /** + * Name of the metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME = 'Class modifier keyword order'; + + /** + * Order preference: abstract/final readonly. + * + * @since 1.0.0 + * + * @var string + */ + const EXTEND_READONLY = 'extendability readonly'; + + /** + * Order preference: readonly abstract/final. + * + * @since 1.0.0 + * + * @var string + */ + const READONLY_EXTEND = 'readonly extendability'; + + /** + * Preferred order for the modifier keywords. + * + * Accepted values: + * - "extendability readonly". + * - or "readonly extendability". + * + * Defaults to "extendability readonly". + * + * @since 1.0.0 + * + * @var string + */ + public $order = self::EXTEND_READONLY; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_CLASS]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $classProp = ObjectDeclarations::getClassProperties($phpcsFile, $stackPtr); + + if ($classProp['readonly_token'] === false + || ($classProp['final_token'] === false && $classProp['abstract_token'] === false) + ) { + /* + * Either no modifier keywords found at all; or only one type of modifier + * keyword (abstract/final or readonly) declared, but not both. No ordering needed. + */ + return; + } + + if ($classProp['final_token'] !== false && $classProp['abstract_token'] !== false) { + // Parse error. Ignore. + return; + } + + $readonly = $classProp['readonly_token']; + + if ($classProp['final_token'] !== false) { + $extendability = $classProp['final_token']; + } else { + $extendability = $classProp['abstract_token']; + } + + if ($readonly < $extendability) { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, self::READONLY_EXTEND); + } else { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, self::EXTEND_READONLY); + } + + $message = 'Class modifier keywords are not in the correct order. Expected: "%s", found: "%s"'; + + switch ($this->order) { + case self::READONLY_EXTEND: + if ($readonly < $extendability) { + // Order is correct. Nothing to do. + return; + } + + $this->handleError($phpcsFile, $extendability, $readonly); + break; + + case self::EXTEND_READONLY: + default: + if ($extendability < $readonly) { + // Order is correct. Nothing to do. + return; + } + + $this->handleError($phpcsFile, $readonly, $extendability); + break; + } + } + + /** + * Throw the error and potentially fix it. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $firstKeyword The position of the first keyword found. + * @param int $secondKeyword The position of the second keyword token. + * + * @return void + */ + private function handleError(File $phpcsFile, $firstKeyword, $secondKeyword) + { + $tokens = $phpcsFile->getTokens(); + + $message = 'Class modifier keywords are not in the correct order. Expected: "%s", found: "%s"'; + $data = [ + $tokens[$secondKeyword]['content'] . ' ' . $tokens[$firstKeyword]['content'], + $tokens[$firstKeyword]['content'] . ' ' . $tokens[$secondKeyword]['content'], + ]; + + $fix = $phpcsFile->addFixableError($message, $firstKeyword, 'Incorrect', $data); + + if ($fix === true) { + $phpcsFile->fixer->beginChangeset(); + + $phpcsFile->fixer->replaceToken($secondKeyword, ''); + + // Prevent leaving behind trailing whitespace. + $i = ($secondKeyword + 1); + while ($tokens[$i]['code'] === \T_WHITESPACE) { + $phpcsFile->fixer->replaceToken($i, ''); + ++$i; + } + + // Use the original token content as the case used for keywords is not the concern of this sniff. + $phpcsFile->fixer->addContentBefore($firstKeyword, $tokens[$secondKeyword]['content'] . ' '); + + $phpcsFile->fixer->endChangeset(); + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/RequireAnonClassParenthesesSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/RequireAnonClassParenthesesSniff.php new file mode 100644 index 00000000..2715b392 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/RequireAnonClassParenthesesSniff.php @@ -0,0 +1,81 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Classes; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; + +/** + * Require that an anonymous class declaration/instantiation has parentheses, i.e. `new class(). + * + * @since 1.0.0 + */ +final class RequireAnonClassParenthesesSniff implements Sniff +{ + + /** + * Name of the metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME = 'Anon class declaration with parenthesis'; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_ANON_CLASS]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + + // Note: no need to check for `false` as PHPCS won't retokenize `class` to `T_ANON_CLASS` in that case. + if ($tokens[$nextNonEmpty]['code'] === \T_OPEN_PARENTHESIS) { + // Parentheses found. + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'yes'); + return; + } + + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'no'); + + $fix = $phpcsFile->addFixableError( + 'Parenthesis required when creating a new anonymous class.', + $stackPtr, + 'Missing' + ); + + if ($fix === true) { + $phpcsFile->fixer->addContent($stackPtr, '()'); + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/RequireFinalClassSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/RequireFinalClassSniff.php new file mode 100644 index 00000000..843f1add --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/RequireFinalClassSniff.php @@ -0,0 +1,102 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Classes; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\Utils\GetTokensAsString; +use PHPCSUtils\Utils\ObjectDeclarations; + +/** + * Require classes being declared as "final". + * + * @since 1.0.0 + */ +final class RequireFinalClassSniff implements Sniff +{ + + /** + * Name of the metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME = 'Class is abstract or final ?'; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_CLASS]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $classProp = ObjectDeclarations::getClassProperties($phpcsFile, $stackPtr); + if ($classProp['is_final'] === true) { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'final'); + return; + } + + if ($classProp['is_abstract'] === true) { + // Abstract classes can't be final. + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'abstract'); + return; + } + + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'not abstract, not final'); + + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($nextNonEmpty === false) { + // Live coding or parse error. + return; + } + + $snippetEnd = $nextNonEmpty; + $classCloser = ''; + + $tokens = $phpcsFile->getTokens(); + if (isset($tokens[$stackPtr]['scope_opener']) === true) { + $snippetEnd = $tokens[$stackPtr]['scope_opener']; + $classCloser = '}'; + } + + $snippet = GetTokensAsString::compact($phpcsFile, $stackPtr, $snippetEnd, true); + $fix = $phpcsFile->addFixableError( + 'A non-abstract class should be declared as final. Found: %s%s', + $stackPtr, + 'NonFinalClassFound', + [$snippet, $classCloser] + ); + + if ($fix === true) { + $phpcsFile->fixer->addContentBefore($stackPtr, 'final '); + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/ConstructorDestructorReturnSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/ConstructorDestructorReturnSniff.php new file mode 100644 index 00000000..6f78cb66 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/ConstructorDestructorReturnSniff.php @@ -0,0 +1,211 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\CodeAnalysis; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\BackCompat\BCFile; +use PHPCSUtils\BackCompat\Helper; +use PHPCSUtils\Tokens\Collections; +use PHPCSUtils\Utils\FunctionDeclarations; +use PHPCSUtils\Utils\GetTokensAsString; +use PHPCSUtils\Utils\Namespaces; +use PHPCSUtils\Utils\NamingConventions; +use PHPCSUtils\Utils\ObjectDeclarations; +use PHPCSUtils\Utils\Scopes; + +/** + * Verify that a class constructor/destructor does not return anything, nor has a + * return type declaration (fatal error). + * + * @since 1.0.0 + */ +final class ConstructorDestructorReturnSniff implements Sniff +{ + + /** + * PHP version as configured or 0 if unknown. + * + * @since 1.1.0 + * + * @var int + */ + private $phpVersion; + + /** + * Registers the tokens that this sniff wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_FUNCTION]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if (isset($this->phpVersion) === false || \defined('PHP_CODESNIFFER_IN_TESTS')) { + // Set default value to prevent this code from running every time the sniff is triggered. + $this->phpVersion = 0; + + $phpVersion = Helper::getConfigData('php_version'); + if ($phpVersion !== null) { + $this->phpVersion = (int) $phpVersion; + } + } + + $scopePtr = Scopes::validDirectScope($phpcsFile, $stackPtr, Tokens::$ooScopeTokens); + if ($scopePtr === false) { + // Not an OO method. + return; + } + + $functionName = FunctionDeclarations::getName($phpcsFile, $stackPtr); + $functionNameLC = \strtolower($functionName); + + if ($functionNameLC === '__construct' || $functionNameLC === '__destruct') { + $functionType = \sprintf('A "%s()" magic method', $functionNameLC); + } else { + // If the PHP version is explicitly set to PHP 8.0 or higher, ignore PHP 4-style constructors. + if ($this->phpVersion >= 80000) { + return; + } + + // This may be a PHP 4-style constructor which should be handled. + $OOName = ObjectDeclarations::getName($phpcsFile, $scopePtr); + + if (empty($OOName) === true) { + // Anonymous class or parse error. The function can't be a PHP 4-style constructor. + return; + } + + if (NamingConventions::isEqual($functionName, $OOName) === false) { + // Class and function name not the same, so not a PHP 4-style constructor. + return; + } + + if (Namespaces::determineNamespace($phpcsFile, $stackPtr) !== '') { + /* + * Namespaced methods with the same name as the class are treated as + * regular methods, so we can bow out if we're in a namespace. + * + * Note: the exception to this is PHP 5.3.0-5.3.2. This is currently + * not dealt with. + */ + return; + } + + $functionType = 'A PHP 4-style constructor'; + } + + /* + * OK, so now we know for sure that this is a constructor/destructor method. + */ + + // Check for a return type. + $tokens = $phpcsFile->getTokens(); + $properties = FunctionDeclarations::getProperties($phpcsFile, $stackPtr); + if ($properties['return_type'] !== '' && $properties['return_type_token'] !== false) { + $data = [ + $functionType, + $properties['return_type'], + ]; + + $fix = $phpcsFile->addFixableError( + '%s can not declare a return type. Found: %s', + $properties['return_type_token'], + 'ReturnTypeFound', + $data + ); + + if ($fix === true) { + $phpcsFile->fixer->beginChangeset(); + + $parensCloser = $tokens[$stackPtr]['parenthesis_closer']; + for ($i = ($parensCloser + 1); $i <= $properties['return_type_end_token']; $i++) { + if (isset(Tokens::$commentTokens[$tokens[$i]['code']])) { + // Ignore comments and leave them be. + continue; + } + + $phpcsFile->fixer->replaceToken($i, ''); + } + + $phpcsFile->fixer->endChangeset(); + } + } + + if (isset($tokens[$stackPtr]['scope_opener'], $tokens[$stackPtr]['scope_closer']) === false) { + // Abstract/interface method, live coding or parse error. + return; + } + + // Check for a value being returned. + $current = $tokens[$stackPtr]['scope_opener']; + $end = $tokens[$stackPtr]['scope_closer']; + + // Not searching for arrow functions as those have an implicit return, so no + $search = Collections::functionDeclarationTokens(); + $search[\T_RETURN] = \T_RETURN; + + do { + $current = $phpcsFile->findNext($search, ($current + 1), $end); + if ($current === false) { + break; + } + + if (isset(Collections::functionDeclarationTokens()[$tokens[$current]['code']]) + && isset($tokens[$current]['scope_closer']) + ) { + // Skip over nested function/closure declarations. + $current = $tokens[$current]['scope_closer']; + continue; + } + + $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($current + 1), $end, true); + if ($next === false + || $tokens[$next]['code'] === \T_SEMICOLON + || $tokens[$next]['code'] === \T_CLOSE_TAG + ) { + // Return statement without value. + continue; + } + + $endOfStatement = BCFile::findEndOfStatement($phpcsFile, $next); + + $data = [ + $functionType, + GetTokensAsString::compact($phpcsFile, $current, $endOfStatement, true), + ]; + + $phpcsFile->addWarning( + '%s can not return a value. Found: "%s"', + $current, + 'ReturnValueFound', + $data + ); + } while ($current < $end); + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/ForeachUniqueAssignmentSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/ForeachUniqueAssignmentSniff.php new file mode 100644 index 00000000..8895c56c --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/ForeachUniqueAssignmentSniff.php @@ -0,0 +1,153 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\CodeAnalysis; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\Tokens\Collections; +use PHPCSUtils\Utils\GetTokensAsString; +use PHPCSUtils\Utils\Lists; + +/** + * Detects using the same variable for both the key as well as the value in a foreach assignment. + * + * @link https://twitter.com/exakat/status/1509103728934203397 + * @link https://3v4l.org/DdddX + * + * @since 1.0.0 + */ +final class ForeachUniqueAssignmentSniff implements Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_FOREACH]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + if (isset($tokens[$stackPtr]['parenthesis_opener'], $tokens[$stackPtr]['parenthesis_closer']) === false) { + // Parse error or live coding, not our concern. + return; + } + + $opener = $tokens[$stackPtr]['parenthesis_opener']; + $closer = $tokens[$stackPtr]['parenthesis_closer']; + + $asPtr = $phpcsFile->findNext(\T_AS, ($opener + 1), $closer); + if ($asPtr === false) { + // Parse error or live coding, not our concern. + return; + } + + // Real target. + $find = [\T_DOUBLE_ARROW]; + // Prevent matching on double arrows within a list assignment. + $find += Collections::listTokens(); + + $doubleArrowPtr = $phpcsFile->findNext($find, ($asPtr + 1), $closer); + if ($doubleArrowPtr === false + || $tokens[$doubleArrowPtr]['code'] !== \T_DOUBLE_ARROW + ) { + // No key assignment. + return; + } + + $isListAssignment = $phpcsFile->findNext(Tokens::$emptyTokens, ($doubleArrowPtr + 1), $closer, true); + if ($isListAssignment === false) { + // Parse error or live coding, not our concern. + } + + $keyAsString = \ltrim(GetTokensAsString::noEmpties($phpcsFile, ($asPtr + 1), ($doubleArrowPtr - 1)), '&'); + $valueAssignments = []; + if (isset(Collections::listTokens()[$tokens[$isListAssignment]['code']]) === false) { + // Single value assignment. + $valueAssignments[] = GetTokensAsString::noEmpties($phpcsFile, ($doubleArrowPtr + 1), ($closer - 1)); + } else { + // List assignment. + $assignments = Lists::getAssignments($phpcsFile, $isListAssignment); + foreach ($assignments as $listItem) { + if ($listItem['assignment'] === '') { + // Ignore empty list assignments. + continue; + } + + // Note: this doesn't take nested lists into account (yet). + $valueAssignments[] = $listItem['assignment']; + } + } + + if (empty($valueAssignments)) { + // No assignments found. + return; + } + + foreach ($valueAssignments as $valueAsString) { + $valueAsString = \ltrim($valueAsString, '&'); + + if ($keyAsString !== $valueAsString) { + // Key and value not the same. + continue; + } + + $error = 'The variables used for the key and the value in a foreach assignment should be unique.'; + $error .= 'Both the key and the value will currently be assigned to: "%s"'; + + $fix = $phpcsFile->addFixableError($error, $doubleArrowPtr, 'NotUnique', [$valueAsString]); + if ($fix === true) { + $phpcsFile->fixer->beginChangeset(); + + // Remove the key. + for ($i = ($asPtr + 1); $i < ($doubleArrowPtr + 1); $i++) { + if ($tokens[$i]['code'] === \T_WHITESPACE + && isset(Tokens::$commentTokens[$tokens[($i + 1)]['code']]) + ) { + // Don't remove whitespace when followed directly by a comment. + continue; + } + + if (isset(Tokens::$commentTokens[$tokens[$i]['code']])) { + // Don't remove comments. + continue; + } + + // Remove everything else. + $phpcsFile->fixer->replaceToken($i, ''); + } + + $phpcsFile->fixer->endChangeset(); + } + + break; + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/NoDoubleNegativeSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/NoDoubleNegativeSniff.php new file mode 100644 index 00000000..549c8cd3 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/NoDoubleNegativeSniff.php @@ -0,0 +1,269 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2023 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\CodeAnalysis; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\BackCompat\BCFile; +use PHPCSUtils\Utils\GetTokensAsString; +use PHPCSUtils\Utils\Parentheses; + +/** + * Detects double negation in code, which is effectively the same as a boolean cast, + * but with a much higher cognitive load. + * + * The sniff will only autofix if the precedence change from boolean not to boolean cast + * will not cause a behavioural change (as it would with instanceof). + * + * @since 1.2.0 + */ +final class NoDoubleNegativeSniff implements Sniff +{ + + /** + * Operators with lower precedence than the not-operator. + * + * Used to determine when to stop searching for `instanceof`. + * + * @since 1.2.0 + * + * @var array<int|string, int|string> + */ + private $operatorsWithLowerPrecedence; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.2.0 + * + * @return array<int|string> + */ + public function register() + { + // Collect all the operators only once. + $this->operatorsWithLowerPrecedence = Tokens::$assignmentTokens; + $this->operatorsWithLowerPrecedence += Tokens::$booleanOperators; + $this->operatorsWithLowerPrecedence += Tokens::$comparisonTokens; + $this->operatorsWithLowerPrecedence += Tokens::$operators; + $this->operatorsWithLowerPrecedence[\T_INLINE_THEN] = \T_INLINE_THEN; + $this->operatorsWithLowerPrecedence[\T_INLINE_ELSE] = \T_INLINE_ELSE; + + return [\T_BOOLEAN_NOT]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.2.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + $notCount = 1; + $lastNot = $stackPtr; + for ($afterNot = ($stackPtr + 1); $afterNot < $phpcsFile->numTokens; $afterNot++) { + if (isset(Tokens::$emptyTokens[$tokens[$afterNot]['code']])) { + continue; + } + + if ($tokens[$afterNot]['code'] === \T_BOOLEAN_NOT) { + $lastNot = $afterNot; + ++$notCount; + continue; + } + + break; + } + + if ($notCount === 1) { + // Singular unary not-operator. Nothing to do. + return; + } + + $found = \trim(GetTokensAsString::compact($phpcsFile, $stackPtr, $lastNot)); + $data = [$found]; + + if (($notCount % 2) === 1) { + /* + * Oh dear... silly code time, found a triple negative (or other uneven number), + * this should just be a singular not-operator. + */ + $fix = $phpcsFile->addFixableError( + 'Triple negative (or more) detected. Use a singular not (!) operator instead. Found: %s', + $stackPtr, + 'FoundTriple', + $data + ); + + if ($fix === true) { + $phpcsFile->fixer->beginChangeset(); + + $this->removeNotAndTrailingSpaces($phpcsFile, $stackPtr, $lastNot); + + $phpcsFile->fixer->endChangeset(); + } + + // Only throw one error, even if there are more than two not-operators. + return $lastNot; + } + + /* + * Found a double negative, which should be a boolean cast. + */ + + $fixable = true; + + /* + * If whatever is being "cast" is within parentheses, we're good. + * If not, we need to prevent creating a change in behaviour + * when what follows is an `$x instanceof ...` expression, as + * the "instanceof" operator is right between a boolean cast + * and the ! operator precedence-wise. + * + * Note: this only applies to double negative, not triple negative. + * + * @link https://www.php.net/language.operators.precedence + */ + if ($tokens[$afterNot]['code'] !== \T_OPEN_PARENTHESIS) { + $end = Parentheses::getLastCloser($phpcsFile, $stackPtr); + if ($end === false) { + $end = BCFile::findEndOfStatement($phpcsFile, $stackPtr); + } + + for ($nextRelevant = $afterNot; $nextRelevant < $end; $nextRelevant++) { + if (isset(Tokens::$emptyTokens[$tokens[$nextRelevant]['code']])) { + continue; + } + + if ($tokens[$nextRelevant]['code'] === \T_INSTANCEOF) { + $fixable = false; + break; + } + + if (isset($this->operatorsWithLowerPrecedence[$tokens[$nextRelevant]['code']])) { + // The expression the `!` belongs to has ended. + break; + } + + // Skip over anything within some form of brackets. + if (isset($tokens[$nextRelevant]['scope_closer']) + && ($nextRelevant === $tokens[$nextRelevant]['scope_opener'] + || $nextRelevant === $tokens[$nextRelevant]['scope_condition']) + ) { + $nextRelevant = $tokens[$nextRelevant]['scope_closer']; + continue; + } + + if (isset($tokens[$nextRelevant]['bracket_opener'], $tokens[$nextRelevant]['bracket_closer']) + && $nextRelevant === $tokens[$nextRelevant]['bracket_opener'] + ) { + $nextRelevant = $tokens[$nextRelevant]['bracket_closer']; + continue; + } + + if ($tokens[$nextRelevant]['code'] === \T_OPEN_PARENTHESIS + && isset($tokens[$nextRelevant]['parenthesis_closer']) + ) { + $nextRelevant = $tokens[$nextRelevant]['parenthesis_closer']; + continue; + } + + // Skip over attributes (just in case). + if ($tokens[$nextRelevant]['code'] === \T_ATTRIBUTE + && isset($tokens[$nextRelevant]['attribute_closer']) + ) { + $nextRelevant = $tokens[$nextRelevant]['attribute_closer']; + continue; + } + } + } + + $error = 'Double negative detected. Use a (bool) cast %s instead. Found: %s'; + $code = 'FoundDouble'; + $data = [ + '', + $found, + ]; + + if ($fixable === false) { + $code = 'FoundDoubleWithInstanceof'; + $data[0] = 'and parentheses around the instanceof expression'; + + // Don't auto-fix in combination with instanceof. + $phpcsFile->addError($error, $stackPtr, $code, $data); + + // Only throw one error, even if there are more than two not-operators. + return $lastNot; + } + + $fix = $phpcsFile->addFixableError($error, $stackPtr, $code, $data); + + if ($fix === true) { + $phpcsFile->fixer->beginChangeset(); + + $this->removeNotAndTrailingSpaces($phpcsFile, $stackPtr, $lastNot); + + $phpcsFile->fixer->replaceToken($lastNot, '(bool)'); + + $phpcsFile->fixer->endChangeset(); + } + + // Only throw one error, even if there are more than two not-operators. + return $lastNot; + } + + /** + * Remove boolean not-operators and trailing whitespace after those, + * but don't remove comments or trailing whitespace after comments. + * + * @since 1.2.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * @param int $lastNot The position of the last boolean not token + * in the chain. + * + * @return void + */ + private function removeNotAndTrailingSpaces(File $phpcsFile, $stackPtr, $lastNot) + { + $tokens = $phpcsFile->getTokens(); + $ignore = false; + + for ($i = $stackPtr; $i < $lastNot; $i++) { + if (isset(Tokens::$commentTokens[$tokens[$i]['code']])) { + // Ignore comments and whitespace after comments. + $ignore = true; + continue; + } + + if ($tokens[$i]['code'] === \T_WHITESPACE && $ignore === false) { + $phpcsFile->fixer->replaceToken($i, ''); + continue; + } + + if ($tokens[$i]['code'] === \T_BOOLEAN_NOT) { + $ignore = false; + $phpcsFile->fixer->replaceToken($i, ''); + } + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/NoEchoSprintfSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/NoEchoSprintfSniff.php new file mode 100644 index 00000000..67035f2a --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/NoEchoSprintfSniff.php @@ -0,0 +1,131 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2023 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\CodeAnalysis; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; + +/** + * Detects use of `echo [v]sprintf();. + * + * @link https://www.php.net/manual/en/function.printf.php + * @link https://www.php.net/manual/en/function.sprintf.php + * @link https://www.php.net/manual/en/function.vprintf.php + * @link https://www.php.net/manual/en/function.vsprintf.php + * + * @since 1.1.0 + */ +final class NoEchoSprintfSniff implements Sniff +{ + + /** + * Functions to look for with their replacements. + * + * @since 1.1.0 + * + * @var array<string, string> + */ + private $targetFunctions = [ + 'sprintf' => 'printf', + 'vsprintf' => 'vprintf', + ]; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.1.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_ECHO]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.1.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + $skip = Tokens::$emptyTokens; + $skip[] = \T_NS_SEPARATOR; + + $next = $phpcsFile->findNext($skip, ($stackPtr + 1), null, true); + if ($next === false + || $tokens[$next]['code'] !== \T_STRING + || isset($this->targetFunctions[\strtolower($tokens[$next]['content'])]) === false + ) { + // Not our target. + return; + } + + $detectedFunction = \strtolower($tokens[$next]['content']); + + $openParens = $phpcsFile->findNext(Tokens::$emptyTokens, ($next + 1), null, true); + if ($openParens === false + || $tokens[$openParens]['code'] !== \T_OPEN_PARENTHESIS + || isset($tokens[$openParens]['parenthesis_closer']) === false + ) { + // Live coding/parse error. + return; + } + + $closeParens = $tokens[$openParens]['parenthesis_closer']; + $afterFunctionCall = $phpcsFile->findNext(Tokens::$emptyTokens, ($closeParens + 1), null, true); + if ($afterFunctionCall === false + || ($tokens[$afterFunctionCall]['code'] !== \T_SEMICOLON + && $tokens[$afterFunctionCall]['code'] !== \T_CLOSE_TAG) + ) { + // Live coding/parse error or compound echo statement. + return; + } + + $fix = $phpcsFile->addFixableError( + 'Unnecessary "echo %s(...)" found. Use "%s(...)" instead.', + $next, + 'Found', + [ + $tokens[$next]['content'], + $this->targetFunctions[$detectedFunction], + ] + ); + + if ($fix === true) { + $phpcsFile->fixer->beginChangeset(); + + // Remove echo and whitespace. + $phpcsFile->fixer->replaceToken($stackPtr, ''); + + for ($i = ($stackPtr + 1); $i < $next; $i++) { + if ($tokens[$i]['code'] !== \T_WHITESPACE) { + break; + } + + $phpcsFile->fixer->replaceToken($i, ''); + } + + $phpcsFile->fixer->replaceToken($next, $this->targetFunctions[$detectedFunction]); + + $phpcsFile->fixer->endChangeset(); + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/StaticInFinalClassSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/StaticInFinalClassSniff.php new file mode 100644 index 00000000..2136bcdb --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/StaticInFinalClassSniff.php @@ -0,0 +1,216 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\CodeAnalysis; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\Utils\Conditions; +use PHPCSUtils\Utils\FunctionDeclarations; +use PHPCSUtils\Utils\GetTokensAsString; +use PHPCSUtils\Utils\ObjectDeclarations; +use PHPCSUtils\Utils\Scopes; + +/** + * Forbid the use of the `static` keyword for late static binding in OO constructs which are final. + * + * @since 1.0.0 + */ +final class StaticInFinalClassSniff implements Sniff +{ + + /** + * OO Scopes in which late static binding is useless. + * + * @var array<int|string> + */ + private $validOOScopes = [ + \T_CLASS, // Only if final. + \T_ANON_CLASS, // Final by nature. + \T_ENUM, // Final by design. + ]; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [ + // These tokens are used to retrieve return types reliably. + \T_FUNCTION, + \T_FN, + // While this is our "real" target. + \T_STATIC, + // But we also need this as after "instanceof", `static` is tokenized as `T_STRING in PHPCS < 4.0.0. + // See: https://github.com/squizlabs/PHP_CodeSniffer/pull/3121 + \T_STRING, + ]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + if ($tokens[$stackPtr]['code'] === \T_STRING + && \strtolower($tokens[$stackPtr]['content']) !== 'static' + ) { + return; + } + + if ($tokens[$stackPtr]['code'] === \T_FUNCTION + || $tokens[$stackPtr]['code'] === \T_FN + ) { + /* + * Check return types for methods in final classes, anon classes and enums. + * + * Will return the scope opener of the function to prevent potential duplicate notifications. + */ + $scopeOpener = $stackPtr; + if (isset($tokens[$stackPtr]['scope_opener']) === true) { + $scopeOpener = $tokens[$stackPtr]['scope_opener']; + } + + if ($tokens[$stackPtr]['code'] === \T_FUNCTION) { + $ooPtr = Scopes::validDirectScope($phpcsFile, $stackPtr, $this->validOOScopes); + if ($ooPtr === false) { + // Method in a trait (not known where it is used), interface (never final) or not in an OO scope. + return $scopeOpener; + } + } else { + $ooPtr = Conditions::getLastCondition($phpcsFile, $stackPtr, $this->validOOScopes); + if ($ooPtr === false) { + // Arrow function outside of OO. + return $scopeOpener; + } + } + + if ($tokens[$ooPtr]['code'] === \T_CLASS) { + $classProps = ObjectDeclarations::getClassProperties($phpcsFile, $ooPtr); + if ($classProps['is_final'] === false) { + // Method in a non-final class. + return $scopeOpener; + } + } + + $functionProps = FunctionDeclarations::getProperties($phpcsFile, $stackPtr); + if ($functionProps['return_type'] === '') { + return $scopeOpener; + } + + $staticPtr = $phpcsFile->findNext( + \T_STATIC, + $functionProps['return_type_token'], + ($functionProps['return_type_end_token'] + 1) + ); + + if ($staticPtr === false) { + return $scopeOpener; + } + + // Found a return type containing the `static` type. + $this->handleError($phpcsFile, $staticPtr, 'ReturnType', '"static" return type'); + + return $scopeOpener; + } + + /* + * Check other uses of static. + */ + $functionPtr = Conditions::getLastCondition($phpcsFile, $stackPtr, [\T_FUNCTION, \T_CLOSURE]); + if ($functionPtr === false || $tokens[$functionPtr]['code'] === \T_CLOSURE) { + /* + * When `false`, this code is absolutely invalid, but not something to be addressed via this sniff. + * When a closure, we're not interested in it. The closure class is final, but closures + * can be bound to other classes. This needs further research and should maybe get its own sniff. + */ + return; + } + + $ooPtr = Scopes::validDirectScope($phpcsFile, $functionPtr, $this->validOOScopes); + if ($ooPtr === false) { + // Not in an OO context. + return; + } + + if ($tokens[$ooPtr]['code'] === \T_CLASS) { + $classProps = ObjectDeclarations::getClassProperties($phpcsFile, $ooPtr); + if ($classProps['is_final'] === false) { + // Token in a non-final class. + return; + } + } + + $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); + if ($prevNonEmpty !== false) { + if ($tokens[$prevNonEmpty]['code'] === \T_INSTANCEOF) { + $prevPrevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($prevNonEmpty - 1), null, true); + $extraMsg = GetTokensAsString::compact($phpcsFile, $prevPrevNonEmpty, $stackPtr, true); + $this->handleError($phpcsFile, $stackPtr, 'InstanceOf', '"' . $extraMsg . '"'); + return; + } + + if ($tokens[$prevNonEmpty]['code'] === \T_NEW) { + $this->handleError($phpcsFile, $stackPtr, 'NewInstance', '"new static"'); + return; + } + } + + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($nextNonEmpty !== false && $tokens[$nextNonEmpty]['code'] === \T_DOUBLE_COLON) { + $nextNextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($nextNonEmpty + 1), null, true); + $extraMsg = GetTokensAsString::compact($phpcsFile, $stackPtr, $nextNextNonEmpty, true); + $this->handleError($phpcsFile, $stackPtr, 'ScopeResolution', '"' . $extraMsg . '"'); + return; + } + } + + /** + * Throw and potentially fix the error. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of erroneous `T_STATIC` token. + * @param string $errorCode The error code for the message. + * @param string $extraMsg Addition to the error message. + * + * @return void + */ + private function handleError($phpcsFile, $stackPtr, $errorCode, $extraMsg) + { + $fix = $phpcsFile->addFixableError( + 'Use "self" instead of "static" when using late static binding in a final OO construct. Found: %s', + $stackPtr, + $errorCode, + [$extraMsg] + ); + + if ($fix === true) { + $phpcsFile->fixer->replaceToken($stackPtr, 'self'); + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Constants/LowercaseClassResolutionKeywordSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Constants/LowercaseClassResolutionKeywordSniff.php new file mode 100644 index 00000000..7a67e479 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Constants/LowercaseClassResolutionKeywordSniff.php @@ -0,0 +1,106 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Constants; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; + +/** + * Verifies that the "::class" keyword when used for class name resolution is in lowercase. + * + * @link https://www.php.net/manual/en/language.constants.predefined.php + * @link https://www.php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.class + * + * @since 1.0.0 + */ +final class LowercaseClassResolutionKeywordSniff implements Sniff +{ + + /** + * Name of the metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME = 'Magic ::class constant case'; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_STRING]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $content = $tokens[$stackPtr]['content']; + $contentLC = \strtolower($content); + + if ($contentLC !== 'class') { + return; + } + + $nextToken = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($nextToken !== false && $tokens[$nextToken]['code'] === \T_OPEN_PARENTHESIS) { + // Function call or declaration for a function called "class". + return; + } + + $prevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); + if ($prevToken === false || $tokens[$prevToken]['code'] !== \T_DOUBLE_COLON) { + return; + } + + if ($contentLC === $content) { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'lowercase'); + return; + } + + $error = "The ::class keyword for class name resolution must be in lowercase. Expected: '::%s'; found: '::%s'"; + $data = [ + $contentLC, + $content, + ]; + + $errorCode = ''; + if (\strtoupper($content) === $content) { + $errorCode = 'Uppercase'; + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'uppercase'); + } else { + $errorCode = 'Mixedcase'; + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'mixed case'); + } + + $fix = $phpcsFile->addFixableError($error, $stackPtr, $errorCode, $data); + if ($fix === true) { + $phpcsFile->fixer->replaceToken($stackPtr, $contentLC); + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Constants/ModifierKeywordOrderSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Constants/ModifierKeywordOrderSniff.php new file mode 100644 index 00000000..4b2e7183 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Constants/ModifierKeywordOrderSniff.php @@ -0,0 +1,199 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2022 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Constants; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\Tokens\Collections; +use PHPCSUtils\Utils\Scopes; + +/** + * Standardize the modifier keyword order for OO constant declarations. + * + * @since 1.0.0 + */ +final class ModifierKeywordOrderSniff implements Sniff +{ + + /** + * Name of the metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME = 'OO constant modifier keyword order'; + + /** + * Order preference: final visibility. + * + * @since 1.0.0 + * + * @var string + */ + const FINAL_VISIBILITY = 'final visibility'; + + /** + * Order preference: visibility final. + * + * @since 1.0.0 + * + * @var string + */ + const VISIBILITY_FINAL = 'visibility final'; + + /** + * Preferred order for the modifier keywords. + * + * Accepted values: + * - "final visibility". + * - or "visibility final". + * + * Defaults to "final visibility". + * + * @since 1.0.0 + * + * @var string + */ + public $order = self::FINAL_VISIBILITY; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_CONST]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if (Scopes::isOOConstant($phpcsFile, $stackPtr) === false) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $valid = Collections::constantModifierKeywords() + Tokens::$emptyTokens; + + $finalPtr = false; + $visibilityPtr = false; + + for ($i = ($stackPtr - 1); $i > 0; $i--) { + if (isset($valid[$tokens[$i]['code']]) === false) { + break; + } + + if (isset(Tokens::$emptyTokens[$tokens[$i]['code']]) === true) { + continue; + } + + if ($tokens[$i]['code'] === \T_FINAL) { + $finalPtr = $i; + } else { + $visibilityPtr = $i; + } + } + + if ($finalPtr === false || $visibilityPtr === false) { + /* + * Either no modifier keywords found at all; or only one type of modifier + * keyword (final or visibility) declared, but not both. No ordering needed. + */ + return; + } + + if ($visibilityPtr < $finalPtr) { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, self::VISIBILITY_FINAL); + } else { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, self::FINAL_VISIBILITY); + } + + $message = 'OO constant modifier keywords are not in the correct order. Expected: "%s", found: "%s"'; + + switch ($this->order) { + case self::VISIBILITY_FINAL: + if ($visibilityPtr < $finalPtr) { + // Order is correct. Nothing to do. + return; + } + + $this->handleError($phpcsFile, $finalPtr, $visibilityPtr); + break; + + case self::FINAL_VISIBILITY: + default: + if ($finalPtr < $visibilityPtr) { + // Order is correct. Nothing to do. + return; + } + + $this->handleError($phpcsFile, $visibilityPtr, $finalPtr); + break; + } + } + + /** + * Throw the error and potentially fix it. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $firstKeyword The position of the first keyword found. + * @param int $secondKeyword The position of the second keyword token. + * + * @return void + */ + private function handleError(File $phpcsFile, $firstKeyword, $secondKeyword) + { + $tokens = $phpcsFile->getTokens(); + + $message = 'Constant modifier keywords are not in the correct order. Expected: "%s", found: "%s"'; + $data = [ + $tokens[$secondKeyword]['content'] . ' ' . $tokens[$firstKeyword]['content'], + $tokens[$firstKeyword]['content'] . ' ' . $tokens[$secondKeyword]['content'], + ]; + + $fix = $phpcsFile->addFixableError($message, $firstKeyword, 'Incorrect', $data); + + if ($fix === true) { + $phpcsFile->fixer->beginChangeset(); + + $phpcsFile->fixer->replaceToken($secondKeyword, ''); + + // Prevent leaving behind trailing whitespace. + $i = ($secondKeyword + 1); + while ($tokens[$i]['code'] === \T_WHITESPACE) { + $phpcsFile->fixer->replaceToken($i, ''); + ++$i; + } + + // Use the original token content as the case used for keywords is not the concern of this sniff. + $phpcsFile->fixer->addContentBefore($firstKeyword, $tokens[$secondKeyword]['content'] . ' '); + + $phpcsFile->fixer->endChangeset(); + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Constants/UppercaseMagicConstantsSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Constants/UppercaseMagicConstantsSniff.php new file mode 100644 index 00000000..348cf65e --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Constants/UppercaseMagicConstantsSniff.php @@ -0,0 +1,89 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Constants; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; + +/** + * Verifies that PHP native `__...__` magic constants are in uppercase when used. + * + * @link https://www.php.net/manual/en/language.constants.predefined.php + * + * @since 1.0.0 + */ +final class UppercaseMagicConstantsSniff implements Sniff +{ + + /** + * Name of the metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME = 'Magic constant case'; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return Tokens::$magicConstants; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $content = $tokens[$stackPtr]['content']; + $contentUC = \strtoupper($content); + if ($contentUC === $content) { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'uppercase'); + return; + } + + $error = 'Magic constants should be in uppercase. Expected: %s; found: %s'; + $errorCode = ''; + $data = [ + $contentUC, + $content, + ]; + + if (\strtolower($content) === $content) { + $errorCode = 'Lowercase'; + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'lowercase'); + } else { + $errorCode = 'Mixedcase'; + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'mixed case'); + } + + $fix = $phpcsFile->addFixableError($error, $stackPtr, $errorCode, $data); + if ($fix === true) { + $phpcsFile->fixer->replaceToken($stackPtr, $contentUC); + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/ControlStructures/DisallowAlternativeSyntaxSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/ControlStructures/DisallowAlternativeSyntaxSniff.php new file mode 100644 index 00000000..ab78a70a --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/ControlStructures/DisallowAlternativeSyntaxSniff.php @@ -0,0 +1,216 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\ControlStructures; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\Tokens\Collections; +use PHPCSUtils\Utils\ControlStructures; + +/** + * Forbid the use of the alternative syntax for control structures. + * + * @since 1.0.0 + */ +final class DisallowAlternativeSyntaxSniff implements Sniff +{ + + /** + * Name of the metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME = 'Control Structure Style'; + + /** + * Whether to allow the alternative syntax when it is wrapped around + * inline HTML, as is often seen in views. + * + * Note: inline HTML within "closed scopes" - like function declarations -, + * within the control structure body will not be taken into account. + * + * @since 1.0.0 + * + * @var bool + */ + public $allowWithInlineHTML = false; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + $targets = Collections::alternativeControlStructureSyntaxes(); + + // Don't look for elseif/else as they need to be dealt with in one go with the if. + unset($targets[\T_ELSEIF], $targets[\T_ELSE]); + + return $targets; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + /* + * Ignore control structures without body (i.e. single line control structures). + * This doesn't ignore _empty_ bodies. + */ + if (ControlStructures::hasBody($phpcsFile, $stackPtr, true) === false) { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'single line (without body)'); + return; + } + + $tokens = $phpcsFile->getTokens(); + + /* + * Check if the control structure uses alternative syntax. + */ + if (isset($tokens[$stackPtr]['scope_opener'], $tokens[$stackPtr]['scope_closer']) === false) { + // No scope opener found: inline control structure or parse error. + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'inline'); + return; + } + + $opener = $tokens[$stackPtr]['scope_opener']; + $closer = $tokens[$stackPtr]['scope_closer']; + + if ($tokens[$opener]['code'] !== \T_COLON) { + // Curly brace syntax (not our concern). + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'curly braces'); + return; + } + + /* + * As of here, we *know* the control structure must be using alternative syntax and + * must have all scope openers/closers set as, in case of parse errors, PHPCS wouldn't + * have set the scope opener, even for the first `if`. + * + * Also note that alternative syntax cannot be used with `else if`, so we don't need to take that + * into account. + */ + + /* + * Determine whether there is inline HTML. + * + * For "chained" control structures (if - elseif - else), the complete control structure + * needs to be examined in one go as these cannot be changed individually, only as a complete group. + */ + $closedScopes = Collections::closedScopes(); + $find = $closedScopes; + $find[\T_INLINE_HTML] = \T_INLINE_HTML; + + $chainedIssues = []; + $hasInlineHTML = false; + $currentPtr = $stackPtr; + + do { + $opener = $tokens[$currentPtr]['scope_opener']; + $closer = $tokens[$currentPtr]['scope_closer']; + $chainedIssues[$opener] = $closer; + + if ($hasInlineHTML === true) { + // No need to search the contents, we already know there is inline HTML. + $currentPtr = $closer; + continue; + } + + $inlineHTMLPtr = $opener; + + do { + $inlineHTMLPtr = $phpcsFile->findNext($find, ($inlineHTMLPtr + 1), $closer); + if ($tokens[$inlineHTMLPtr]['code'] === \T_INLINE_HTML) { + $hasInlineHTML = true; + break; + } + + if (isset($closedScopes[$tokens[$inlineHTMLPtr]['code']], $tokens[$inlineHTMLPtr]['scope_closer'])) { + $inlineHTMLPtr = $tokens[$inlineHTMLPtr]['scope_closer']; + } + } while ($inlineHTMLPtr !== false && $inlineHTMLPtr < $closer); + + $currentPtr = $closer; + } while (isset(Collections::alternativeControlStructureSyntaxes()[$tokens[$closer]['code']]) === true); + + if ($hasInlineHTML === true) { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'alternative syntax with inline HTML'); + } else { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'alternative syntax'); + } + + if ($hasInlineHTML === true && $this->allowWithInlineHTML === true) { + return; + } + + $error = 'Using control structures with the alternative syntax is not allowed'; + if ($this->allowWithInlineHTML === true) { + $error .= ' unless the control structure contains inline HTML'; + } + $error .= '. Found: %1$s(): ... end%1$s;'; + + $code = 'Found' . \ucfirst($tokens[$stackPtr]['content']); + if ($hasInlineHTML === true) { + $code .= 'WithInlineHTML'; + } + + $data = [$tokens[$stackPtr]['content']]; + + foreach ($chainedIssues as $opener => $closer) { + $fix = $phpcsFile->addFixableError($error, $opener, $code, $data); + } + + if ($fix === false) { + return; + } + + /* + * Fix all issues for this chain in one go to diminish the chance of conflicts. + */ + $phpcsFile->fixer->beginChangeset(); + + foreach ($chainedIssues as $opener => $closer) { + $phpcsFile->fixer->replaceToken($opener, '{'); + + if (isset(Collections::alternativeControlStructureSyntaxClosers()[$tokens[$closer]['code']]) === true) { + $phpcsFile->fixer->replaceToken($closer, '}'); + + $semicolon = $phpcsFile->findNext(Tokens::$emptyTokens, ($closer + 1), null, true); + if ($semicolon !== false && $tokens[$semicolon]['code'] === \T_SEMICOLON) { + $phpcsFile->fixer->replaceToken($semicolon, ''); + } + } else { + /* + * This must be an if/else using alternative syntax. + * The closer will be the next control structure keyword. + */ + $phpcsFile->fixer->addContentBefore($closer, '} '); + } + } + + $phpcsFile->fixer->endChangeset(); + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/ControlStructures/DisallowLonelyIfSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/ControlStructures/DisallowLonelyIfSniff.php new file mode 100644 index 00000000..58c81ae1 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/ControlStructures/DisallowLonelyIfSniff.php @@ -0,0 +1,348 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\ControlStructures; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\Utils\ControlStructures; +use PHPCSUtils\Utils\GetTokensAsString; + +/** + * Disallow `if` statements as the only statement in an `else` block. + * + * Note: This sniff will not fix the indentation of the "inner" code. It is strongly recommended to run + * this sniff together with the `Generic.WhiteSpace.ScopeIndent` sniff to get the correct indentation. + * + * Inspired by the {@link https://eslint.org/docs/rules/no-lonely-if ESLint "no lonely if"} rule + * in response to upstream {@link https://github.com/squizlabs/PHP_CodeSniffer/issues/3206 PHPCS issue 3206}. + * + * @since 1.0.0 + */ +final class DisallowLonelyIfSniff implements Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_ELSE]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + /* + * Deal with `else if`. + */ + if (ControlStructures::isElseIf($phpcsFile, $stackPtr) === true) { + // Ignore, not our real target. + return; + } + + if (isset($tokens[$stackPtr]['scope_opener'], $tokens[$stackPtr]['scope_closer']) === false) { + // Either an else without curly braces or a parse error. Ignore. + return; + } + + $outerScopeOpener = $tokens[$stackPtr]['scope_opener']; + $outerScopeCloser = $tokens[$stackPtr]['scope_closer']; + + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($outerScopeOpener + 1), $outerScopeCloser, true); + if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== \T_IF) { + // Definitely not a lonely if statement. + return; + } + + if (isset($tokens[$nextNonEmpty]['scope_closer']) === false) { + // Either a control structure without curly braces or a parse error. Ignore. + return; + } + + /* + * Find the end of an if - else chain. + */ + + $innerIfPtr = $nextNonEmpty; + $innerIfToken = $tokens[$innerIfPtr]; + $autoFixable = true; + $innerScopeCloser = $innerIfToken['scope_closer']; + + // For alternative syntax fixer only. + // Remember the individual inner scope opener and closers so the fixer doesn't need + // to do the same walking over the if/else chain again. + $innerScopes = [ + $innerIfToken['scope_opener'] => $innerScopeCloser, + ]; + + do { + /* + * Handle control structures using alternative syntax. + */ + if ($tokens[$innerScopeCloser]['code'] !== \T_CLOSE_CURLY_BRACKET) { + if ($tokens[$innerScopeCloser]['code'] === \T_ENDIF) { + $nextAfter = $phpcsFile->findNext( + Tokens::$emptyTokens, + ($innerScopeCloser + 1), + $outerScopeCloser, + true + ); + + if ($tokens[$nextAfter]['code'] === \T_CLOSE_TAG) { + // Not "lonely" as at the very least there must be a PHP open tag before the outer closer. + return; + } + + if ($tokens[$nextAfter]['code'] === \T_SEMICOLON) { + $innerScopeCloser = $nextAfter; + } else { + // Missing semi-colon. Report, but don't auto-fix. + $autoFixable = false; + } + } else { + // This must be an else[if]. + --$innerScopeCloser; + } + } + + $innerNextNonEmpty = $phpcsFile->findNext( + Tokens::$emptyTokens, + ($innerScopeCloser + 1), + $outerScopeCloser, + true + ); + if ($innerNextNonEmpty === false) { + // This was the last closer. + break; + } + + if ($tokens[$innerNextNonEmpty]['code'] !== \T_ELSE + && $tokens[$innerNextNonEmpty]['code'] !== \T_ELSEIF + ) { + // Found another statement after the control structure. The "if" is not lonely. + return; + } + + if (isset($tokens[$innerNextNonEmpty]['scope_closer']) === false) { + // This may still be an "else if"... + $nextAfter = $phpcsFile->findNext( + Tokens::$emptyTokens, + ($innerNextNonEmpty + 1), + $outerScopeCloser, + true + ); + + if ($nextAfter === false + || $tokens[$nextAfter]['code'] !== \T_IF + || isset($tokens[$nextAfter]['scope_closer']) === false + ) { + // Defense in depth. Either a control structure without curly braces or a parse error. Ignore. + return; + } + + $innerNextNonEmpty = $nextAfter; + } + + $innerScopeCloser = $tokens[$innerNextNonEmpty]['scope_closer']; + $innerScopes[$tokens[$innerNextNonEmpty]['scope_opener']] = $innerScopeCloser; + } while (true); + + /* + * As of now, we know we have an error. Check if it can be auto-fixed. + */ + if ($phpcsFile->findNext(\T_WHITESPACE, ($innerScopeCloser + 1), $outerScopeCloser, true) !== false) { + // Comment between the inner and outer closers. + $autoFixable = false; + } + + if ($tokens[$innerScopeCloser]['code'] === \T_SEMICOLON) { + $hasComment = $phpcsFile->findPrevious(\T_WHITESPACE, ($innerScopeCloser - 1), null, true); + if ($tokens[$hasComment]['code'] !== \T_ENDIF) { + // Comment between the "endif" and the semi-colon. + $autoFixable = false; + } + } + + if ($tokens[$outerScopeOpener]['line'] !== $innerIfToken['line']) { + for ($startOfNextLine = ($outerScopeOpener + 1); $startOfNextLine < $innerIfPtr; $startOfNextLine++) { + if ($tokens[$outerScopeOpener]['line'] !== $tokens[$startOfNextLine]['line']) { + break; + } + } + + if ($phpcsFile->findNext(\T_WHITESPACE, $startOfNextLine, $innerIfPtr, true) !== false) { + // Comment between the inner and outer openers. + $autoFixable = false; + } + } + + if (isset($innerIfToken['parenthesis_opener'], $innerIfToken['parenthesis_closer']) === false) { + // Start/end of the condition of the if unclear. Most likely a parse error. + $autoFixable = false; + } + + /* + * Throw the error and potentially fix it. + */ + $error = 'If control structure block found as the only statement within an "else" block. Use elseif instead.'; + $code = 'Found'; + + if ($autoFixable === false) { + $phpcsFile->addError($error, $stackPtr, $code); + return; + } + + $fix = $phpcsFile->addFixableError($error, $stackPtr, $code); + if ($fix === false) { + return; + } + + /* + * Fix it. + */ + $outerInnerSameType = false; + if (($tokens[$outerScopeCloser]['code'] === \T_CLOSE_CURLY_BRACKET + && $tokens[$innerScopeCloser]['code'] === \T_CLOSE_CURLY_BRACKET) + || ($tokens[$outerScopeCloser]['code'] === \T_ENDIF + && $tokens[$innerScopeCloser]['code'] === \T_SEMICOLON) + ) { + $outerInnerSameType = true; + } + + $targetIsCurly = ($tokens[$outerScopeCloser]['code'] === \T_CLOSE_CURLY_BRACKET); + + $innerScopeCount = \count($innerScopes); + + $condition = GetTokensAsString::origContent($phpcsFile, ($innerIfPtr + 1), ($innerIfToken['scope_opener'] - 1)); + if ($targetIsCurly === true) { + $condition = \rtrim($condition) . ' '; + } + + $phpcsFile->fixer->beginChangeset(); + + // Remove the inner if + condition up to and including the scope opener. + for ($i = $innerIfPtr; $i <= $innerIfToken['scope_opener']; $i++) { + $phpcsFile->fixer->replaceToken($i, ''); + } + + // Potentially remove trailing whitespace/new line if there is no comment after the inner condition. + while ($tokens[$i]['line'] === $innerIfToken['line'] + && $tokens[$i]['code'] === \T_WHITESPACE + ) { + $phpcsFile->fixer->replaceToken($i, ''); + ++$i; + } + + // Remove any potential indentation whitespace for the inner if. + if ($tokens[$outerScopeOpener]['line'] !== $innerIfToken['line'] + && $tokens[$i]['line'] !== $innerIfToken['line'] + ) { + $i = ($nextNonEmpty - 1); + while ($tokens[$i]['line'] === $innerIfToken['line'] + && $tokens[$i]['code'] === \T_WHITESPACE + ) { + $phpcsFile->fixer->replaceToken($i, ''); + --$i; + } + } + + // Remove the inner scope closer. + $phpcsFile->fixer->replaceToken($innerScopeCloser, ''); + $i = ($innerScopeCloser - 1); + + // Handle alternative syntax for the closer. + if ($tokens[$innerScopeCloser]['code'] === \T_SEMICOLON) { + // Remove potential whitespace between the "endif" and the semicolon. + while ($tokens[$i]['code'] === \T_WHITESPACE) { + $phpcsFile->fixer->replaceToken($i, ''); + --$i; + } + + // Remove the "endif". + $phpcsFile->fixer->replaceToken($i, ''); + --$i; + } + + // Remove superfluous whitespace before the inner scope closer. + while ($tokens[$i]['code'] === \T_WHITESPACE) { + $phpcsFile->fixer->replaceToken($i, ''); + --$i; + } + + // Replace the else. + $phpcsFile->fixer->replaceToken($stackPtr, 'elseif' . $condition); + + // Remove potential superfluous whitespace between the new condition and the scope opener. + $i = ($stackPtr + 1); + while ($tokens[$i]['line'] === $tokens[$stackPtr]['line'] + && $tokens[$i]['code'] === \T_WHITESPACE + ) { + $phpcsFile->fixer->replaceToken($i, ''); + ++$i; + } + + if ($outerInnerSameType === false + && $innerScopeCount > 1 + ) { + $loop = 1; + foreach ($innerScopes as $opener => $closer) { + if ($targetIsCurly === true) { + if ($loop !== 1) { + // Only handle the opener when it's not the first of the chain as that's already handled above. + $phpcsFile->fixer->replaceToken($opener, ' {'); + } + + if ($loop !== $innerScopeCount) { + // Only handle the closer when it's not the last of the chain as that's already handled above. + $phpcsFile->fixer->addContentBefore($closer, '} '); + } + } else { + if ($loop !== 1) { + // Only handle the opener when it's not the first of the chain as that's already handled above. + $phpcsFile->fixer->replaceToken($opener, ':'); + } + + if ($loop !== $innerScopeCount) { + // Only handle the closer when it's not the last of the chain as that's already handled above. + $phpcsFile->fixer->replaceToken($closer, ''); + + $j = ($closer + 1); + while ($tokens[$j]['code'] === \T_WHITESPACE) { + $phpcsFile->fixer->replaceToken($j, ''); + ++$j; + } + } + } + + ++$loop; + } + } + + $phpcsFile->fixer->endChangeset(); + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/ControlStructures/IfElseDeclarationSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/ControlStructures/IfElseDeclarationSniff.php new file mode 100644 index 00000000..fb2c39d4 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/ControlStructures/IfElseDeclarationSniff.php @@ -0,0 +1,164 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\ControlStructures; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; + +/** + * Verifies that `else(if)` statements with braces are on a new line. + * + * Sister-sniff to the following two PHPCS native sniffs which each demand that `else[]if` is on the + * same line as the closing curly of the preceding `(else)if`: + * - `PEAR.ControlStructures.ControlSignature[.Found]` + * - `Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace` + * + * Other related sniffs: + * - `Squiz.ControlStructures.ElseIfDeclaration` Forbids the use of "elseif", demands "else if". + * - `PSR2.ControlStructures.ElseIfDeclaration` Forbids the use of "else if", demands "elseif". + * + * @since 1.0.0 + */ +final class IfElseDeclarationSniff implements Sniff +{ + + /** + * Name of the metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME = 'Else(if) on a new line'; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [ + \T_ELSE, + \T_ELSEIF, + ]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + /* + * Check for control structures without braces and alternative syntax. + */ + $scopePtr = $stackPtr; + if (isset($tokens[$stackPtr]['scope_opener']) === false) { + // Deal with "else if". + $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($tokens[$next]['code'] === \T_IF) { + $scopePtr = $next; + } + } + + if (isset($tokens[$scopePtr]['scope_opener']) === false + || $tokens[$tokens[$scopePtr]['scope_opener']]['code'] === \T_COLON + ) { + // No scope opener found or alternative syntax (not our concern). + return; + } + + /* + * Check whether the else(if) is on a new line. + */ + $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); + if ($prevNonEmpty === false || $tokens[$prevNonEmpty]['code'] !== \T_CLOSE_CURLY_BRACKET) { + // Parse error or mixing braced and non-braced. Not our concern. + return; + } + + if ($tokens[$prevNonEmpty]['line'] !== $tokens[$stackPtr]['line']) { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'yes'); + return; + } + + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'no'); + + $errorBase = \strtoupper($tokens[$stackPtr]['content']); + $error = $errorBase . ' statement must be on a new line.'; + + $prevNonWhitespace = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true); + + if ($prevNonWhitespace !== $prevNonEmpty) { + // Comment found between previous scope closer and the keyword. + $fix = $phpcsFile->addError($error, $stackPtr, 'NoNewLine'); + return; + } + + $fix = $phpcsFile->addFixableError($error, $stackPtr, 'NoNewLine'); + if ($fix === false) { + return; + } + + /* + * Fix it. + */ + + // Figure out the indentation for the else(if). + $indentBase = $prevNonEmpty; + if (isset($tokens[$prevNonEmpty]['scope_condition']) === true + && ($tokens[$tokens[$prevNonEmpty]['scope_condition']]['column'] === 1 + || ($tokens[($tokens[$prevNonEmpty]['scope_condition'] - 1)]['code'] === \T_WHITESPACE + && $tokens[($tokens[$prevNonEmpty]['scope_condition'] - 1)]['column'] === 1)) + ) { + // Base the indentation off the previous if/elseif if on a line by itself. + $indentBase = $tokens[$prevNonEmpty]['scope_condition']; + } + + $indent = ''; + $firstOnIndentLine = $indentBase; + if ($tokens[$firstOnIndentLine]['column'] !== 1) { + while (isset($tokens[($firstOnIndentLine - 1)]) && $tokens[--$firstOnIndentLine]['column'] !== 1); + + if ($tokens[$firstOnIndentLine]['code'] === \T_WHITESPACE) { + $indent = $tokens[$firstOnIndentLine]['content']; + + // If tabs were replaced, use the original content. + if (isset($tokens[$firstOnIndentLine]['orig_content']) === true) { + $indent = $tokens[$firstOnIndentLine]['orig_content']; + } + } + } + + $phpcsFile->fixer->beginChangeset(); + + // Remove any whitespace between the previous scope closer and the else(if). + for ($i = ($prevNonEmpty + 1); $i < $stackPtr; $i++) { + $phpcsFile->fixer->replaceToken($i, ''); + } + + $phpcsFile->fixer->addContent($prevNonEmpty, $phpcsFile->eolChar . $indent); + $phpcsFile->fixer->endChangeset(); + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Files/SeparateFunctionsFromOOSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Files/SeparateFunctionsFromOOSniff.php new file mode 100644 index 00000000..c274e751 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Files/SeparateFunctionsFromOOSniff.php @@ -0,0 +1,190 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Files; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\Tokens\Collections; + +/** + * A file should either declare (global/namespaced) functions or declare OO structures, but not both. + * + * Nested function declarations, i.e. functions declared within a function/method will be disregarded + * for the purposes of this sniff. + * The same goes for anonymous classes, closures and arrow functions. + * + * Notes: + * - This sniff has no opinion on side effects. If you want to sniff for those, use the PHPCS + * native `PSR1.Files.SideEffects` sniff. + * - This sniff has no opinion on multiple OO structures being declared in one file. + * If you want to sniff for that, use the PHPCS native `Generic.Files.OneObjectStructurePerFile` sniff. + * + * @since 1.0.0 + */ +final class SeparateFunctionsFromOOSniff implements Sniff +{ + + /** + * Name of the metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME = 'Functions or OO declarations ?'; + + /** + * Tokens this sniff searches for. + * + * Enhanced from within the register() methods. + * + * @since 1.0.0 + * + * @var array<int|string> + */ + private $search = [ + // Some tokens to help skip over structures we're not interested in. + \T_START_HEREDOC => \T_START_HEREDOC, + \T_START_NOWDOC => \T_START_NOWDOC, + ]; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + $this->search += Tokens::$ooScopeTokens; + $this->search += Collections::functionDeclarationTokens(); + + return Collections::phpOpenTags(); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + $firstOO = null; + $firstFunction = null; + $functionCount = 0; + $OOCount = 0; + + for ($i = 0; $i < $phpcsFile->numTokens; $i++) { + // Ignore anything within square brackets. + if ($tokens[$i]['code'] !== \T_OPEN_CURLY_BRACKET + && isset($tokens[$i]['bracket_opener'], $tokens[$i]['bracket_closer']) + && $i === $tokens[$i]['bracket_opener'] + ) { + $i = $tokens[$i]['bracket_closer']; + continue; + } + + // Skip past nested arrays, function calls and arbitrary groupings. + if ($tokens[$i]['code'] === \T_OPEN_PARENTHESIS + && isset($tokens[$i]['parenthesis_closer']) + ) { + $i = $tokens[$i]['parenthesis_closer']; + continue; + } + + // Skip over potentially large docblocks. + if ($tokens[$i]['code'] === \T_DOC_COMMENT_OPEN_TAG + && isset($tokens[$i]['comment_closer']) + ) { + $i = $tokens[$i]['comment_closer']; + continue; + } + + // Ignore everything else we're not interested in. + if (isset($this->search[$tokens[$i]['code']]) === false) { + continue; + } + + // Skip over structures which won't contain anything we're interested in. + if (($tokens[$i]['code'] === \T_START_HEREDOC + || $tokens[$i]['code'] === \T_START_NOWDOC + || $tokens[$i]['code'] === \T_ANON_CLASS + || $tokens[$i]['code'] === \T_CLOSURE + || $tokens[$i]['code'] === \T_FN) + && isset($tokens[$i]['scope_condition'], $tokens[$i]['scope_closer']) + && $tokens[$i]['scope_condition'] === $i + ) { + $i = $tokens[$i]['scope_closer']; + continue; + } + + // This will be either a function declaration or an OO declaration token. + if ($tokens[$i]['code'] === \T_FUNCTION) { + if (isset($firstFunction) === false) { + $firstFunction = $i; + } + + ++$functionCount; + } else { + if (isset($firstOO) === false) { + $firstOO = $i; + } + + ++$OOCount; + } + + if (isset($tokens[$i]['scope_closer']) === true) { + $i = $tokens[$i]['scope_closer']; + } + } + + if ($functionCount > 0 && $OOCount > 0) { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'Both function and OO declarations'); + + $reportToken = \max($firstFunction, $firstOO); + + $phpcsFile->addError( + 'A file should either contain function declarations or OO structure declarations, but not both.' + . ' Found %d function declaration(s) and %d OO structure declaration(s).' + . ' The first function declaration was found on line %d;' + . ' the first OO declaration was found on line %d', + $reportToken, + 'Mixed', + [ + $functionCount, + $OOCount, + $tokens[$firstFunction]['line'], + $tokens[$firstOO]['line'], + ] + ); + } elseif ($functionCount > 0) { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'Only function(s)'); + } elseif ($OOCount > 0) { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'Only OO structure(s)'); + } else { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'Neither'); + } + + // Ignore the rest of the file. + return ($phpcsFile->numTokens + 1); + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/FunctionDeclarations/NoLongClosuresSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/FunctionDeclarations/NoLongClosuresSniff.php new file mode 100644 index 00000000..a9ccf78b --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/FunctionDeclarations/NoLongClosuresSniff.php @@ -0,0 +1,233 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\FunctionDeclarations; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; + +/** + * Forbids long closures. + * + * @since 1.1.0 + */ +final class NoLongClosuresSniff implements Sniff +{ + + /** + * Name of the metric. + * + * @since 1.1.0 + * + * @var string + */ + const METRIC_NAME_CODE = 'Closure length (code only)'; + + /** + * Name of the metric. + * + * @since 1.1.0 + * + * @var string + */ + const METRIC_NAME_COMMENTS = 'Closure length (code + comments)'; + + /** + * Name of the metric. + * + * @since 1.1.0 + * + * @var string + */ + const METRIC_NAME_ALL = 'Closure length (code + comments + blank lines)'; + + /** + * Maximum number of lines allowed before a closure is considered a "long" closure. + * + * Defaults to 5 lines, i.e. when a closure contains 6 lines, a warning will be thrown. + * + * @since 1.1.0 + * + * @var int + */ + public $recommendedLines = 5; + + /** + * Maximum number of lines allowed before a closure is considered a "long" closure. + * + * Defaults to 8 lines, i.e. when a closure contains 9 lines, an error will be thrown. + * + * @since 1.1.0 + * + * @var int + */ + public $maxLines = 8; + + /** + * Whether or not to exclude lines which only contain documentation in the line count. + * + * Defaults to `true`. + * + * @since 1.1.0 + * + * @var bool + */ + public $ignoreCommentLines = true; + + /** + * Whether or not to exclude empty lines from the line count. + * + * Defaults to `true`. + * + * @since 1.1.0 + * + * @var bool + */ + public $ignoreEmptyLines = true; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.1.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_CLOSURE]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.1.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $this->recommendedLines = (int) $this->recommendedLines; + $this->maxLines = (int) $this->maxLines; + + $tokens = $phpcsFile->getTokens(); + + if (isset($tokens[$stackPtr]['scope_opener'], $tokens[$stackPtr]['scope_closer']) === false) { + // Live coding/parse error. Shouldn't be possible as in that case tokenizer won't retokenize to T_CLOSURE. + return; // @codeCoverageIgnore + } + + $opener = $tokens[$stackPtr]['scope_opener']; + $closer = $tokens[$stackPtr]['scope_closer']; + + $currentLine = $tokens[$opener]['line']; + $closerLine = $tokens[$closer]['line']; + + $codeLines = 0; + $commentLines = 0; + $blankLines = 0; + + // Check whether the line of the scope opener needs to be counted, but ignore trailing comments on that line. + $firstNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($opener + 1), $closer, true); + if ($firstNonEmpty !== false && $tokens[$firstNonEmpty]['line'] === $currentLine) { + ++$codeLines; + } + + // Check whether the line of the scope closer needs to be counted. + if ($closerLine !== $currentLine) { + $hasCommentTokens = false; + $hasCodeTokens = false; + for ($i = ($closer - 1); $tokens[$i]['line'] === $closerLine && $i > $opener; $i--) { + if (isset(Tokens::$emptyTokens[$tokens[$i]['code']]) === false) { + $hasCodeTokens = true; + } elseif (isset(Tokens::$commentTokens[$tokens[$i]['code']]) === true) { + $hasCommentTokens = true; + } + } + + if ($hasCodeTokens === true) { + ++$codeLines; + } elseif ($hasCommentTokens === true) { + ++$commentLines; + } + } + + // We've already examined the opener line, so move to the next line. + for ($i = ($opener + 1); $tokens[$i]['line'] === $currentLine && $i < $closer; $i++); + $currentLine = $tokens[$i]['line']; + + // Walk tokens. + while ($currentLine !== $closerLine) { + $hasCommentTokens = false; + $hasCodeTokens = false; + + while ($tokens[$i]['line'] === $currentLine) { + if (isset(Tokens::$emptyTokens[$tokens[$i]['code']]) === false) { + $hasCodeTokens = true; + } elseif (isset(Tokens::$commentTokens[$tokens[$i]['code']]) === true) { + $hasCommentTokens = true; + } + + ++$i; + } + + if ($hasCodeTokens === true) { + ++$codeLines; + } elseif ($hasCommentTokens === true) { + ++$commentLines; + } else { + // Only option left is that this is an empty line. + ++$blankLines; + } + + $currentLine = $tokens[$i]['line']; + } + + $nonBlankLines = ($codeLines + $commentLines); + $totalLines = ($codeLines + $commentLines + $blankLines); + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME_CODE, $codeLines . ' lines'); + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME_COMMENTS, $nonBlankLines . ' lines'); + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME_ALL, $totalLines . ' lines'); + + $lines = $codeLines; + if ($this->ignoreCommentLines === false) { + $lines += $commentLines; + } + if ($this->ignoreEmptyLines === false) { + $lines += $blankLines; + } + + $errorSuffix = ' Declare a named function instead. Found closure containing %s lines'; + + if ($lines > $this->maxLines) { + $phpcsFile->addError( + 'Closures which are longer than %s lines are forbidden.' . $errorSuffix, + $stackPtr, + 'ExceedsMaximum', + [$this->maxLines, $lines] + ); + + return; + } + + if ($lines > $this->recommendedLines) { + $phpcsFile->addWarning( + 'It is recommended for closures to contain %s lines or less.' . $errorSuffix, + $stackPtr, + 'ExceedsRecommended', + [$this->recommendedLines, $lines] + ); + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/FunctionDeclarations/RequireFinalMethodsInTraitsSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/FunctionDeclarations/RequireFinalMethodsInTraitsSniff.php new file mode 100644 index 00000000..505c19b3 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/FunctionDeclarations/RequireFinalMethodsInTraitsSniff.php @@ -0,0 +1,120 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2023 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\FunctionDeclarations; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHPCSUtils\Utils\FunctionDeclarations; +use PHPCSUtils\Utils\ObjectDeclarations; +use PHPCSUtils\Utils\Scopes; + +/** + * Require non-abstract, non-private methods in traits to be declared as "final". + * + * @since 1.1.0 + */ +final class RequireFinalMethodsInTraitsSniff implements Sniff +{ + + /** + * Name of the metric. + * + * @since 1.1.0 + * + * @var string + */ + const METRIC_NAME = 'Non-private method in trait is abstract or final ?'; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.1.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_FUNCTION]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.1.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + if (isset($tokens[$stackPtr]['parenthesis_opener']) === false) { + // Parse error/live coding. + return; + } + + $scopePtr = Scopes::validDirectScope($phpcsFile, $stackPtr, \T_TRAIT); + if ($scopePtr === false) { + // Not a trait method. + return; + } + + $methodProps = FunctionDeclarations::getProperties($phpcsFile, $stackPtr); + if ($methodProps['scope'] === 'private') { + // Private methods can't be final. + return; + } + + if ($methodProps['is_final'] === true) { + // Already final, nothing to do. + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'final'); + return; + } + + if ($methodProps['is_abstract'] === true) { + // Abstract classes can't be final. + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'abstract'); + return; + } + + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'not abstract, not final'); + + $methodName = FunctionDeclarations::getName($phpcsFile, $stackPtr); + $magic = ''; + $code = 'NonFinalMethodFound'; + if (FunctionDeclarations::isMagicMethodName($methodName) === true) { + // Use separate error code for magic methods. + $magic = 'magic '; + $code = 'NonFinalMagicMethodFound'; + } + + $data = [ + $methodProps['scope'], + $magic, + $methodName, + ObjectDeclarations::getName($phpcsFile, $scopePtr), + ]; + + $fix = $phpcsFile->addFixableError( + 'The non-abstract, %s %smethod "%s()" in trait %s should be declared as final.', + $stackPtr, + $code, + $data + ); + + if ($fix === true) { + $phpcsFile->fixer->addContentBefore($stackPtr, 'final '); + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Lists/DisallowLongListSyntaxSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Lists/DisallowLongListSyntaxSniff.php new file mode 100644 index 00000000..de7447e0 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Lists/DisallowLongListSyntaxSniff.php @@ -0,0 +1,71 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Lists; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHPCSUtils\Utils\Lists; + +/** + * Bans the use of the PHP long list syntax. + * + * @since 1.0.0 + */ +final class DisallowLongListSyntaxSniff implements Sniff +{ + + /** + * Registers the tokens that this sniff wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_LIST]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $openClose = Lists::getOpenClose($phpcsFile, $stackPtr); + if ($openClose === false) { + // Live coding or parse error. + return; + } + + $fix = $phpcsFile->addFixableError('Long list syntax is not allowed', $stackPtr, 'Found'); + + if ($fix === true) { + $opener = $openClose['opener']; + $closer = $openClose['closer']; + + $phpcsFile->fixer->beginChangeset(); + + $phpcsFile->fixer->replaceToken($stackPtr, ''); + $phpcsFile->fixer->replaceToken($opener, '['); + $phpcsFile->fixer->replaceToken($closer, ']'); + + $phpcsFile->fixer->endChangeset(); + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Lists/DisallowShortListSyntaxSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Lists/DisallowShortListSyntaxSniff.php new file mode 100644 index 00000000..af2a9489 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Lists/DisallowShortListSyntaxSniff.php @@ -0,0 +1,86 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Lists; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHPCSUtils\Tokens\Collections; +use PHPCSUtils\Utils\Lists; + +/** + * Bans the use of the PHP short list syntax. + * + * @since 1.0.0 + */ +final class DisallowShortListSyntaxSniff implements Sniff +{ + + /** + * The phrase to use for the metric recorded by this sniff. + * + * @var string + */ + const METRIC_NAME = 'Short list syntax used'; + + /** + * Registers the tokens that this sniff wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return Collections::listOpenTokensBC(); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + if ($tokens[$stackPtr]['code'] === \T_LIST) { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'no'); + return; + } + + $openClose = Lists::getOpenClose($phpcsFile, $stackPtr); + + if ($openClose === false) { + // Not a short list, live coding or parse error. + return; + } + + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'yes'); + + $fix = $phpcsFile->addFixableError('Short list syntax is not allowed', $stackPtr, 'Found'); + + if ($fix === true) { + $opener = $openClose['opener']; + $closer = $openClose['closer']; + + $phpcsFile->fixer->beginChangeset(); + $phpcsFile->fixer->replaceToken($opener, 'list('); + $phpcsFile->fixer->replaceToken($closer, ')'); + $phpcsFile->fixer->endChangeset(); + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Namespaces/DisallowCurlyBraceSyntaxSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Namespaces/DisallowCurlyBraceSyntaxSniff.php new file mode 100644 index 00000000..3b6ad982 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Namespaces/DisallowCurlyBraceSyntaxSniff.php @@ -0,0 +1,81 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Namespaces; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHPCSUtils\Utils\Namespaces; + +/** + * Disallow the use of namespace declarations using the curly brace syntax. + * + * @since 1.0.0 + */ +final class DisallowCurlyBraceSyntaxSniff implements Sniff +{ + + /** + * Name of the metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME = 'Namespace declaration using curly brace syntax'; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_NAMESPACE]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if (Namespaces::isDeclaration($phpcsFile, $stackPtr) === false) { + // Namespace operator, not a declaration; or live coding/parse error. + return; + } + + $tokens = $phpcsFile->getTokens(); + + if (isset($tokens[$stackPtr]['scope_condition']) === false + || $tokens[$stackPtr]['scope_condition'] !== $stackPtr + ) { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'no'); + return; + } + + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'yes'); + + $phpcsFile->addError( + 'Namespace declarations using the curly brace syntax are not allowed.', + $stackPtr, + 'Forbidden' + ); + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Namespaces/DisallowDeclarationWithoutNameSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Namespaces/DisallowDeclarationWithoutNameSniff.php new file mode 100644 index 00000000..5348e707 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Namespaces/DisallowDeclarationWithoutNameSniff.php @@ -0,0 +1,80 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Namespaces; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHPCSUtils\Utils\Namespaces; + +/** + * Forbids the use of namespace declarations without a namespace name. + * + * @since 1.0.0 + */ +final class DisallowDeclarationWithoutNameSniff implements Sniff +{ + + /** + * Name of the metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME = 'Namespace declaration declares a name'; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_NAMESPACE]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $name = Namespaces::getDeclaredName($phpcsFile, $stackPtr); + if ($name === false) { + // Use of the namespace keyword as an operator or live coding/parse error. + return; + } + + if ($name !== '') { + // Named namespace. + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'yes'); + return; + } + + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'no'); + + // Namespace declaration without namespace name (= global namespace). + $phpcsFile->addError( + 'Namespace declarations without a namespace name are not allowed.', + $stackPtr, + 'Forbidden' + ); + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Namespaces/EnforceCurlyBraceSyntaxSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Namespaces/EnforceCurlyBraceSyntaxSniff.php new file mode 100644 index 00000000..78fa3261 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Namespaces/EnforceCurlyBraceSyntaxSniff.php @@ -0,0 +1,81 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Namespaces; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHPCSUtils\Utils\Namespaces; + +/** + * Enforce the use of namespace declarations using the curly brace syntax. + * + * @since 1.0.0 + */ +final class EnforceCurlyBraceSyntaxSniff implements Sniff +{ + + /** + * Name of the metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME = 'Namespace declaration using curly brace syntax'; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_NAMESPACE]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if (Namespaces::isDeclaration($phpcsFile, $stackPtr) === false) { + // Namespace operator, not a declaration; or live coding/parse error. + return; + } + + $tokens = $phpcsFile->getTokens(); + + if (isset($tokens[$stackPtr]['scope_condition']) === true + && $tokens[$stackPtr]['scope_condition'] === $stackPtr + ) { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'yes'); + return; + } + + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'no'); + + $phpcsFile->addError( + 'Namespace declarations without curly braces are not allowed.', + $stackPtr, + 'Forbidden' + ); + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Namespaces/OneDeclarationPerFileSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Namespaces/OneDeclarationPerFileSniff.php new file mode 100644 index 00000000..65f3e589 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Namespaces/OneDeclarationPerFileSniff.php @@ -0,0 +1,96 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Namespaces; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHPCSUtils\Utils\Namespaces; + +/** + * Disallow having more than one namespace declaration in a file. + * + * @since 1.0.0 + */ +final class OneDeclarationPerFileSniff implements Sniff +{ + + /** + * Current file being scanned. + * + * @since 1.0.0 + * + * @var string + */ + private $currentFile; + + /** + * Stack pointer to the first namespace declaration seen in the file. + * + * @since 1.0.0 + * + * @var int|false + */ + private $declarationSeen = false; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_NAMESPACE]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $fileName = $phpcsFile->getFilename(); + if ($this->currentFile !== $fileName) { + // Reset the properties for each new file. + $this->currentFile = $fileName; + $this->declarationSeen = false; + } + + if (Namespaces::isDeclaration($phpcsFile, $stackPtr) === false) { + // Namespace operator, not a declaration; or live coding/parse error. + return; + } + + if ($this->declarationSeen === false) { + // This is the first namespace declaration in the file. + $this->declarationSeen = $stackPtr; + return; + } + + $tokens = $phpcsFile->getTokens(); + + // OK, so this is a file with multiple namespace declarations. + $phpcsFile->addError( + 'There should be only one namespace declaration per file. The first declaration was found on line %d', + $stackPtr, + 'MultipleFound', + [$tokens[$this->declarationSeen]['line']] + ); + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/NamingConventions/NoReservedKeywordParameterNamesSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/NamingConventions/NoReservedKeywordParameterNamesSniff.php new file mode 100644 index 00000000..7815e7e0 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/NamingConventions/NoReservedKeywordParameterNamesSniff.php @@ -0,0 +1,190 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\NamingConventions; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHPCSUtils\Tokens\Collections; +use PHPCSUtils\Utils\FunctionDeclarations; + +/** + * Verifies that parameters in function declarations do not use PHP reserved keywords + * as this can lead to confusing code when using PHP 8.0+ named parameters in function calls. + * + * Note: while parameters (variables) are case-sensitive in PHP, keywords are not, + * so this sniff checks for the keywords used in parameter names in a + * case-insensitive manner to make this sniff independent of code style rules + * regarding the case for parameter names. + * + * @link https://www.php.net/manual/en/reserved.keywords.php + * + * @since 1.0.0 + */ +final class NoReservedKeywordParameterNamesSniff implements Sniff +{ + + /** + * A list of PHP reserved keywords. + * + * @since 1.0.0 + * + * @var array<string, string> Key is the lowercased keyword, value the "proper" cased keyword. + */ + private $reservedNames = [ + 'abstract' => 'abstract', + 'and' => 'and', + 'array' => 'array', + 'as' => 'as', + 'break' => 'break', + 'callable' => 'callable', + 'case' => 'case', + 'catch' => 'catch', + 'class' => 'class', + 'clone' => 'clone', + 'const' => 'const', + 'continue' => 'continue', + 'declare' => 'declare', + 'default' => 'default', + 'die' => 'die', + 'do' => 'do', + 'echo' => 'echo', + 'else' => 'else', + 'elseif' => 'elseif', + 'empty' => 'empty', + 'enddeclare' => 'enddeclare', + 'endfor' => 'endfor', + 'endforeach' => 'endforeach', + 'endif' => 'endif', + 'endswitch' => 'endswitch', + 'endwhile' => 'endwhile', + 'enum' => 'enum', + 'eval' => 'eval', + 'exit' => 'exit', + 'extends' => 'extends', + 'final' => 'final', + 'finally' => 'finally', + 'fn' => 'fn', + 'for' => 'for', + 'foreach' => 'foreach', + 'function' => 'function', + 'global' => 'global', + 'goto' => 'goto', + 'if' => 'if', + 'implements' => 'implements', + 'include' => 'include', + 'include_once' => 'include_once', + 'instanceof' => 'instanceof', + 'insteadof' => 'insteadof', + 'interface' => 'interface', + 'isset' => 'isset', + 'list' => 'list', + 'match' => 'match', + 'namespace' => 'namespace', + 'new' => 'new', + 'or' => 'or', + 'print' => 'print', + 'private' => 'private', + 'protected' => 'protected', + 'public' => 'public', + 'readonly' => 'readonly', + 'require' => 'require', + 'require_once' => 'require_once', + 'return' => 'return', + 'static' => 'static', + 'switch' => 'switch', + 'throw' => 'throw', + 'trait' => 'trait', + 'try' => 'try', + 'unset' => 'unset', + 'use' => 'use', + 'var' => 'var', + 'while' => 'while', + 'xor' => 'xor', + 'yield' => 'yield', + '__class__' => '__CLASS__', + '__dir__' => '__DIR__', + '__file__' => '__FILE__', + '__function__' => '__FUNCTION__', + '__line__' => '__LINE__', + '__method__' => '__METHOD__', + '__namespace__' => '__NAMESPACE__', + '__trait__' => '__TRAIT__', + 'int' => 'int', + 'float' => 'float', + 'bool' => 'bool', + 'string' => 'string', + 'true' => 'true', + 'false' => 'false', + 'null' => 'null', + 'void' => 'void', + 'iterable' => 'iterable', + 'object' => 'object', + 'resource' => 'resource', + 'mixed' => 'mixed', + 'numeric' => 'numeric', + 'never' => 'never', + + /* + * Not reserved keywords, but equally confusing when used in the context of function calls + * with named parameters. + */ + 'parent' => 'parent', + 'self' => 'self', + ]; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return Collections::functionDeclarationTokens(); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + // Get all parameters from method signature. + $parameters = FunctionDeclarations::getParameters($phpcsFile, $stackPtr); + if (empty($parameters)) { + return; + } + + $message = 'It is recommended not to use reserved keyword "%s" as function parameter name. Found: %s'; + + foreach ($parameters as $param) { + $name = \ltrim($param['name'], '$'); + $nameLC = \strtolower($name); + if (isset($this->reservedNames[$nameLC]) === true) { + $errorCode = $nameLC . 'Found'; + $data = [ + $this->reservedNames[$nameLC], + $param['name'], + ]; + + $phpcsFile->addWarning($message, $param['token'], $errorCode, $data); + } + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/OOStructures/AlphabeticExtendsImplementsSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/OOStructures/AlphabeticExtendsImplementsSniff.php new file mode 100644 index 00000000..4d765c2c --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/OOStructures/AlphabeticExtendsImplementsSniff.php @@ -0,0 +1,275 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\OOStructures; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\Tokens\Collections; +use PHPCSUtils\Utils\ObjectDeclarations; + +/** + * Verifies that the interface names used in a class/enum "implements" statement or an interface "extends" statement, + * are listed in alphabetic order. + * + * @since 1.0.0 + */ +final class AlphabeticExtendsImplementsSniff implements Sniff +{ + + /** + * Name of the "Alphabetically ordered" metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME_ALPHA = 'Interface names in implements/extends ordered alphabetically (%s)'; + + /** + * Name of the "interface count" metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME_COUNT = 'Number of interfaces being implemented/extended'; + + /** + * The sort order to use for the statement. + * + * If all names used are unqualified, the sort order won't make a difference. + * However, if one or more of the names are partially or fully qualified, the chosen + * sort order will determine how the sorting between unqualified, partially and + * fully qualified names is handled. + * + * The sniff supports two sort order options: + * - 'name' : sort by the interface name only (default); + * - 'full' : sort by the full name as used in the statement (without leading backslash). + * + * In both cases, the sorting will be done using natural sort, case-insensitive. + * + * Example: + * <code> + * class Foo implements \Vendor\DiffIterator, My\Count, DateTimeInterface {} + * </code> + * + * If sorted using the "name" sort-order, the sniff looks just at the interface name, i.e. + * `DiffIterator`, `Count` and `DateTimeInterface`, which for this example would mean + * the correct order would be `My\Count, DateTimeInterface, \Vendor\DiffIterator`. + * + * If sorted using the "full" sort-order, the sniff will look at the full name as used + * in the `implements` statement, without leading backslashes. + * For the example above, this would mean that the correct order would be: + * `DateTimeInterface, My\Count, \Vendor\DiffIterator`. + * + * @since 1.0.0 + * + * @var string + */ + public $orderby = 'name'; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return (Collections::ooCanExtend() + Collections::ooCanImplement()); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in + * the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + /* + * Validate the setting. + */ + if ($this->orderby !== 'full') { + // Use the default. + $this->orderby = 'name'; + } + $metricNameAlpha = \sprintf(self::METRIC_NAME_ALPHA, $this->orderby); + + $tokens = $phpcsFile->getTokens(); + if (isset($tokens[$stackPtr]['scope_opener']) === false) { + // Parse error or live coding. Ignore. + return; + } + + $scopeOpener = $tokens[$stackPtr]['scope_opener']; + + /* + * Get the names. + */ + if (isset(Collections::ooCanImplement()[$tokens[$stackPtr]['code']]) === true) { + $names = ObjectDeclarations::findImplementedInterfaceNames($phpcsFile, $stackPtr); + } else { + $names = ObjectDeclarations::findExtendedInterfaceNames($phpcsFile, $stackPtr); + } + + if (\is_array($names) === false) { + // Class/interface/enum doesn't extend or implement. + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME_COUNT, 0); + $phpcsFile->recordMetric($stackPtr, $metricNameAlpha, 'n/a'); + return; + } + + $count = \count($names); + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME_COUNT, $count); + + if ($count < 2) { + // Nothing to sort. + $phpcsFile->recordMetric($stackPtr, $metricNameAlpha, 'n/a'); + return; + } + + /* + * Check the order. + */ + if ($this->orderby === 'name') { + $sorted = $this->sortByName($names); + } else { + $sorted = $this->sortByFull($names); + } + + if ($sorted === $names) { + // Order is already correct. + $phpcsFile->recordMetric($stackPtr, $metricNameAlpha, 'yes'); + return; + } + + $phpcsFile->recordMetric($stackPtr, $metricNameAlpha, 'no'); + + /* + * Throw the error. + */ + $keyword = \T_IMPLEMENTS; + if (isset(Collections::ooCanImplement()[$tokens[$stackPtr]['code']]) === false) { + $keyword = \T_EXTENDS; + } + + $fixable = true; + $keywordPtr = $phpcsFile->findNext($keyword, ($stackPtr + 1), $scopeOpener); + $hasComment = $phpcsFile->findNext(Tokens::$commentTokens, ($keywordPtr + 1), $scopeOpener); + if ($hasComment !== false) { + $fixable = false; + } + + $error = "The interface names in a \"%s %s\" statement should be ordered alphabetically.\n"; + $error .= 'Expected: %s; Found: %s'; + $code = \ucfirst(\strtolower($tokens[$keywordPtr]['content'])) . 'WrongOrder'; + $data = [ + $tokens[$stackPtr]['content'], + $tokens[$keywordPtr]['content'], + \implode(', ', $names), + \implode(', ', $sorted), + ]; + + if ($fixable === false) { + $code .= 'WithComments'; + $phpcsFile->addError($error, $keywordPtr, $code, $data); + return; + } + + // OK, so we appear to have a fixable error. + $fix = $phpcsFile->addFixableError($error, $keywordPtr, $code, $data); + if ($fix === false) { + return; + } + + $phpcsFile->fixer->beginChangeset(); + + // Remove the complete previous extends/implements part. + for ($i = ($keywordPtr + 1); $i < $scopeOpener; $i++) { + $phpcsFile->fixer->replaceToken($i, ''); + } + + $phpcsFile->fixer->addContent($keywordPtr, ' ' . \implode(', ', $sorted) . ' '); + + $phpcsFile->fixer->endChangeset(); + } + + /** + * Sort an array of potentially mixed qualified and unqualified names by the interface name. + * + * @since 1.0.0 + * + * @param string[] $names Interface names, potentially mixed qualified and unqualified. + * + * @return string[] + */ + protected function sortByName(array $names) + { + $getLastName = function ($name) { + $last = \strrchr($name, '\\'); + if ($last === false) { + $last = $name; + } else { + $last = \substr($last, 1); + } + + return $last; + }; + + return $this->sortNames($names, $getLastName); + } + + /** + * Sort an array of potentially mixed qualified and unqualified names by the full name. + * + * @since 1.0.0 + * + * @param string[] $names Interface names, potentially mixed qualified and unqualified. + * + * @return string[] + */ + protected function sortByFull(array $names) + { + $trimLeadingBackslash = function ($name) { + return \ltrim($name, '\\'); + }; + + return $this->sortNames($names, $trimLeadingBackslash); + } + + /** + * Sort an array of names. + * + * @since 1.0.0 + * + * @param string[] $names Interface names, potentially mixed qualified and unqualified. + * @param callable $prepareNames Function to call to prepare the names before sorting. + * + * @return string[] + */ + private function sortNames(array $names, callable $prepareNames) + { + $preppedNames = \array_map($prepareNames, $names); + $names = \array_combine($names, $preppedNames); + + \natcasesort($names); + + return \array_keys($names); + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/ConcatPositionSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/ConcatPositionSniff.php new file mode 100644 index 00000000..093785ad --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/ConcatPositionSniff.php @@ -0,0 +1,204 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2023 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Operators; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; + +/** + * Enforces that the concatenation operator in multi-line concatenations is in a preferred position, + * either always at the start of the next line or always at the end of the previous line. + * + * Note: this sniff has no opinion on spacing before/after the concatenation operator. + * It will normalize based on the "one space before/after" PSR-12 industry standard. + * If different spacing is preferred, use the `Squiz.Strings.ConcatenationSpacing` to enforce/correct that. + * + * @since 1.2.0 + */ +final class ConcatPositionSniff implements Sniff +{ + + /** + * The phrase to use for the metric recorded by this sniff. + * + * @since 1.2.0 + * + * @var string + */ + const METRIC_NAME = 'Multi-line concatenation operator position'; + + /** + * Position indication: start of next line. + * + * @since 1.2.0 + * + * @var string + */ + const POSITION_START = 'start'; + + /** + * Position indication: end of previous line. + * + * @since 1.2.0 + * + * @var string + */ + const POSITION_END = 'end'; + + /** + * Position indication: neither start of next line nor end of previous line. + * + * @since 1.2.0 + * + * @var string + */ + const POSITION_STANDALONE = 'stand-alone'; + + /** + * Preferred position for the concatenation operator. + * + * Valid values are: 'start' and 'end'. + * Defaults to 'start'. + * + * @since 1.2.0 + * + * @var string + */ + public $allowOnly = self::POSITION_START; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.2.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_STRING_CONCAT]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.2.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function process(File $phpcsFile, $stackPtr) + { + /* + * Validate the setting. + */ + if ($this->allowOnly !== self::POSITION_END) { + // Use the default. + $this->allowOnly = self::POSITION_START; + } + + $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + + if ($nextNonEmpty === false) { + // Parse error/live coding. + return; + } + + $tokens = $phpcsFile->getTokens(); + if ($tokens[$prevNonEmpty]['line'] === $tokens[$nextNonEmpty]['line']) { + // Not multi-line concatenation. Not our target. + return; + } + + $position = self::POSITION_STANDALONE; + if ($tokens[$prevNonEmpty]['line'] === $tokens[$stackPtr]['line']) { + $position = self::POSITION_END; + } elseif ($tokens[$nextNonEmpty]['line'] === $tokens[$stackPtr]['line']) { + $position = self::POSITION_START; + } + + // Record metric. + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, $position); + + if ($this->allowOnly === $position) { + // All okay. + return; + } + + $fix = $phpcsFile->addFixableError( + 'The concatenation operator for multi-line concatenations should always be at the %s of a line.', + $stackPtr, + 'Incorrect', + [$this->allowOnly] + ); + + if ($fix === true) { + if ($this->allowOnly === self::POSITION_END) { + $phpcsFile->fixer->beginChangeset(); + + // Move the concat operator. + $phpcsFile->fixer->replaceToken($stackPtr, ''); + $phpcsFile->fixer->addContent($prevNonEmpty, ' .'); + + if ($position === self::POSITION_START + && $tokens[($stackPtr + 1)]['code'] === \T_WHITESPACE + ) { + // Remove trailing space. + $phpcsFile->fixer->replaceToken(($stackPtr + 1), ''); + } elseif ($position === self::POSITION_STANDALONE) { + // Remove potential indentation space. + if ($tokens[($stackPtr - 1)]['code'] === \T_WHITESPACE) { + $phpcsFile->fixer->replaceToken(($stackPtr - 1), ''); + } + + // Remove new line. + if ($tokens[($stackPtr + 1)]['code'] === \T_WHITESPACE) { + $phpcsFile->fixer->replaceToken(($stackPtr + 1), ''); + } + } + + $phpcsFile->fixer->endChangeset(); + return; + } + + // Fixer for allowOnly === self::POSITION_START. + $phpcsFile->fixer->beginChangeset(); + + // Move the concat operator. + $phpcsFile->fixer->replaceToken($stackPtr, ''); + $phpcsFile->fixer->addContentBefore($nextNonEmpty, '. '); + + if ($position === self::POSITION_END + && $tokens[($stackPtr - 1)]['code'] === \T_WHITESPACE + ) { + // Remove trailing space. + $phpcsFile->fixer->replaceToken(($stackPtr - 1), ''); + } elseif ($position === self::POSITION_STANDALONE) { + // Remove potential indentation space. + if ($tokens[($stackPtr - 1)]['code'] === \T_WHITESPACE) { + $phpcsFile->fixer->replaceToken(($stackPtr - 1), ''); + } + + // Remove new line. + if ($tokens[($stackPtr + 1)]['code'] === \T_WHITESPACE) { + $phpcsFile->fixer->replaceToken(($stackPtr + 1), ''); + } + } + + $phpcsFile->fixer->endChangeset(); + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/DisallowLogicalAndOrSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/DisallowLogicalAndOrSniff.php new file mode 100644 index 00000000..19e49717 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/DisallowLogicalAndOrSniff.php @@ -0,0 +1,112 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Operators; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; + +/** + * Enforce the use of the boolean `&&` and `||` operators instead of the logical `and`/`or` operators. + * + * Note: as the {@link https://www.php.net/manual/en/language.operators.precedence.php operator precedence} + * of the logical operators is significantly lower than the operator precedence of boolean operators, + * this sniff does not contain an auto-fixer. + * + * @since 1.0.0 + */ +final class DisallowLogicalAndOrSniff implements Sniff +{ + + /** + * Name of the metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME = 'Type of and/or operator used'; + + /** + * The tokens this sniff records metrics for. + * + * @since 1.0.0 + * + * @var array<int|string, string> + */ + private $metricType = [ + \T_LOGICAL_AND => 'logical (and/or)', + \T_LOGICAL_OR => 'logical (and/or)', + \T_BOOLEAN_AND => 'boolean (&&/||)', + \T_BOOLEAN_OR => 'boolean (&&/||)', + ]; + + /** + * The tokens this sniff targets with error code and replacements. + * + * @since 1.0.0 + * + * @var array<int|string, array<string, string>> + */ + private $targetTokenInfo = [ + \T_LOGICAL_AND => [ + 'error_code' => 'LogicalAnd', + 'replacement' => '&&', + ], + \T_LOGICAL_OR => [ + 'error_code' => 'LogicalOr', + 'replacement' => '||', + ], + ]; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return \array_keys($this->metricType); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $tokenCode = $tokens[$stackPtr]['code']; + + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, $this->metricType[$tokenCode]); + + if (isset($this->targetTokenInfo[$tokenCode]) === false) { + // Already using boolean operator. + return; + } + + $error = 'Using logical operators is not allowed. Expected: "%s"; Found: "%s"'; + $data = [ + $this->targetTokenInfo[$tokenCode]['replacement'], + $tokens[ $stackPtr ]['content'], + ]; + + $phpcsFile->addError($error, $stackPtr, $this->targetTokenInfo[$tokenCode]['error_code'], $data); + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/DisallowShortTernarySniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/DisallowShortTernarySniff.php new file mode 100644 index 00000000..37a39a18 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/DisallowShortTernarySniff.php @@ -0,0 +1,76 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Operators; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHPCSUtils\Utils\Operators; + +/** + * Disallow the use of short ternaries. + * + * While short ternaries are useful when used correctly, the principle of them is + * often misunderstood and they are more often than not used incorrectly, leading to + * hard to debug issues and/or PHP warnings/notices. + * + * @since 1.0.0 + */ +final class DisallowShortTernarySniff implements Sniff +{ + + /** + * Name of the metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME = 'Ternary usage'; + + /** + * Registers the tokens that this sniff wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_INLINE_THEN]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if (Operators::isShortTernary($phpcsFile, $stackPtr) === false) { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'long'); + return; + } + + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'short'); + + $phpcsFile->addError( + 'Using short ternaries is not allowed as they are rarely used correctly', + $stackPtr, + 'Found' + ); + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/DisallowStandalonePostIncrementDecrementSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/DisallowStandalonePostIncrementDecrementSniff.php new file mode 100644 index 00000000..b8538882 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/DisallowStandalonePostIncrementDecrementSniff.php @@ -0,0 +1,197 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Operators; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\BackCompat\BCFile; +use PHPCSUtils\Tokens\Collections; +use PHPCSUtils\Utils\GetTokensAsString; + +/** + * Disallow the use of post-in/decrements in stand-alone statements and discourage the use of + * multiple increment/decrement operators in a stand-alone statement. + * + * Post-in/decrement returns the value and in/decrements afterwards. + * Pre-in/decrement in/decrements the value and returns afterwards. + * Using pre-in/decrement is more in line with the principle of least astonishment + * and prevents bugs when code gets moved around at a later point in time. + * + * @since 1.0.0 + */ +final class DisallowStandalonePostIncrementDecrementSniff implements Sniff +{ + + /** + * Name of the metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME = 'In/decrement usage in stand-alone statements'; + + /** + * Tokens which can be expected in a stand-alone in/decrement statement. + * + * {@internal This array is enriched in the register() method.} + * + * @since 1.0.0 + * + * @var array<int|string> + */ + private $allowedTokens = [ + \T_VARIABLE => \T_VARIABLE, + ]; + + /** + * Registers the tokens that this sniff wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + $this->allowedTokens += Collections::ooHierarchyKeywords(); + $this->allowedTokens += Collections::objectOperators(); + $this->allowedTokens += Collections::namespacedNameTokens(); + + /* + * Remove nullsafe object operator. In/decrement not allowed in write context, + * so ignore. + */ + unset($this->allowedTokens[\T_NULLSAFE_OBJECT_OPERATOR]); + + return Collections::incrementDecrementOperators(); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return int|void Integer stack pointer to skip forward or void to continue + * normal file processing. + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + if (empty($tokens[$stackPtr]['nested_parenthesis']) === false) { + // Not a stand-alone statement. + return; + } + + $start = BCFile::findStartOfStatement($phpcsFile, $stackPtr); + $end = BCFile::findEndOfStatement($phpcsFile, $stackPtr); + + if (isset(Collections::incrementDecrementOperators()[$tokens[$end]['code']])) { + // Statement ends on a PHP close tag, set the end pointer to the close tag. + $end = $phpcsFile->findNext(Tokens::$emptyTokens, ($end + 1), null, true); + } + + if ($tokens[$end]['code'] !== \T_SEMICOLON + && $tokens[$end]['code'] !== \T_CLOSE_TAG + ) { + // Not a stand-alone statement. + return $end; + } + + $counter = 0; + $lastCode = null; + $operators = Collections::incrementDecrementOperators(); + for ($i = $start; $i < $end; $i++) { + if (isset(Tokens::$emptyTokens[$tokens[$i]['code']]) === true) { + continue; + } + + if (isset($operators[$tokens[$i]['code']]) === true) { + $lastCode = $tokens[$i]['code']; + ++$counter; + continue; + } + + if (isset($this->allowedTokens[$tokens[$i]['code']]) === true) { + $lastCode = $tokens[$i]['code']; + continue; + } + + if ($tokens[$i]['code'] === \T_OPEN_SQUARE_BRACKET + && isset($tokens[$i]['bracket_closer']) + && ($lastCode === \T_VARIABLE || $lastCode === \T_STRING) + ) { + // Array access. + $i = $tokens[$i]['bracket_closer']; + continue; + } + + // Came across an unexpected token. This is (probably) not a stand-alone statement. + return $end; + } + + if ($counter > 1) { + $phpcsFile->addWarning( + 'Using multiple increment/decrement operators in a stand-alone statement is strongly discouraged.' + . ' Found: %s', + $stackPtr, + 'MultipleOperatorsFound', + [GetTokensAsString::compact($phpcsFile, $start, ($end - 1), true)] + ); + + return $end; + } + + $type = 'increment'; + if ($tokens[$stackPtr]['code'] === \T_DEC) { + $type = 'decrement'; + } + + $lastNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($end - 1), $start, true); + if ($start === $stackPtr && $lastNonEmpty !== $stackPtr) { + // This is already pre-in/decrement. + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'pre-' . $type); + return $end; + } + + if ($lastNonEmpty === false || $lastNonEmpty === $start || $lastNonEmpty !== $stackPtr) { + // Parse error or otherwise unsupported syntax. Ignore. + return $end; + } + + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'post-' . $type); + + $error = 'Stand-alone post-%1$s statement found. Use pre-%1$s instead: %2$s.'; + $errorCode = 'Post' . \ucfirst($type) . 'Found'; + $replacement = $tokens[$stackPtr]['content']; + $replacement .= GetTokensAsString::compact($phpcsFile, $start, ($lastNonEmpty - 1), true); + $data = [ + $type, + $replacement, + ]; + + $fix = $phpcsFile->addFixableError($error, $stackPtr, $errorCode, $data); + + if ($fix === true) { + $phpcsFile->fixer->beginChangeset(); + $phpcsFile->fixer->replaceToken($stackPtr, ''); + $phpcsFile->fixer->addContentBefore($start, $tokens[$stackPtr]['content']); + $phpcsFile->fixer->endChangeset(); + } + + return $end; + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/StrictComparisonsSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/StrictComparisonsSniff.php new file mode 100644 index 00000000..c828df9e --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/StrictComparisonsSniff.php @@ -0,0 +1,116 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Operators; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; + +/** + * Enforce the use of strict comparisons. + * + * Warning: the auto-fixer for this sniff _may_ cause bugs in applications and should be used with care! + * This is considered a _risky_ fix. + * + * @since 1.0.0 + */ +final class StrictComparisonsSniff implements Sniff +{ + + /** + * Name of the metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME = 'Type of comparison used'; + + /** + * The tokens this sniff records metrics for. + * + * @since 1.0.0 + * + * @var array<int|string, string> + */ + private $metricType = [ + \T_IS_EQUAL => 'loose', + \T_IS_NOT_EQUAL => 'loose', + \T_IS_IDENTICAL => 'strict', + \T_IS_NOT_IDENTICAL => 'strict', + ]; + + /** + * The tokens this sniff targets with error code and replacements. + * + * @since 1.0.0 + * + * @var array<int|string, array<string, string>> + */ + private $targetTokenInfo = [ + \T_IS_EQUAL => [ + 'error_code' => 'LooseEqual', + 'replacement' => '===', + ], + \T_IS_NOT_EQUAL => [ + 'error_code' => 'LooseNotEqual', + 'replacement' => '!==', + ], + ]; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return \array_keys($this->metricType); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $tokenCode = $tokens[$stackPtr]['code']; + + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, $this->metricType[$tokenCode]); + + if (isset($this->targetTokenInfo[$tokenCode]) === false) { + // Already using strict comparison operator. + return; + } + + $error = 'Loose comparisons are not allowed. Expected: "%s"; Found: "%s"'; + $data = [ + $this->targetTokenInfo[$tokenCode]['replacement'], + $tokens[ $stackPtr ]['content'], + ]; + + $fix = $phpcsFile->addFixableError($error, $stackPtr, $this->targetTokenInfo[$tokenCode]['error_code'], $data); + if ($fix === false) { + return; + } + + $phpcsFile->fixer->replaceToken($stackPtr, $this->targetTokenInfo[$tokenCode]['replacement']); + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/TypeSeparatorSpacingSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/TypeSeparatorSpacingSniff.php new file mode 100644 index 00000000..440ecc86 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/TypeSeparatorSpacingSniff.php @@ -0,0 +1,85 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\Operators; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\Fixers\SpacesFixer; + +/** + * Enforce no space around union type and intersection type separators. + * + * @since 1.0.0 + */ +final class TypeSeparatorSpacingSniff implements Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [ + \T_TYPE_UNION, + \T_TYPE_INTERSECTION, + ]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + $type = ($tokens[$stackPtr]['code'] === \T_TYPE_UNION) ? 'union' : 'intersection'; + $code = \ucfirst($type) . 'Type'; + + $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); + SpacesFixer::checkAndFix( + $phpcsFile, + $stackPtr, + $prevNonEmpty, + 0, // Expected spaces. + 'Expected %s before the ' . $type . ' type separator. Found: %s', + $code . 'SpacesBefore', + 'error', + 0, // Severity. + 'Space before ' . $type . ' type separator' + ); + + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + SpacesFixer::checkAndFix( + $phpcsFile, + $stackPtr, + $nextNonEmpty, + 0, // Expected spaces. + 'Expected %s after the ' . $type . ' type separator. Found: %s', + $code . 'SpacesAfter', + 'error', + 0, // Severity. + 'Space after ' . $type . ' type separator' + ); + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/PHP/LowercasePHPTagSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/PHP/LowercasePHPTagSniff.php new file mode 100644 index 00000000..b231b225 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/PHP/LowercasePHPTagSniff.php @@ -0,0 +1,87 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\PHP; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; + +/** + * Enforce that the "PHP" in a PHP open tag is lowercase. + * + * @since 1.2.0 + */ +final class LowercasePHPTagSniff implements Sniff +{ + + /** + * Name of the metric. + * + * @since 1.2.0 + * + * @var string + */ + const METRIC_NAME = 'PHP open tag case'; + + /** + * Registers the tokens that this sniff wants to listen for. + * + * @since 1.2.0 + * + * @return array<int> + */ + public function register() + { + return [\T_OPEN_TAG]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.2.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $content = $tokens[$stackPtr]['content']; + $contentLC = \strtolower($content); + + if ($contentLC === $content) { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'lowercase'); + return; + } + + $errorCode = ''; + if (\strtoupper($content) === $content) { + $errorCode = 'Uppercase'; + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'uppercase'); + } else { + $errorCode = 'Mixedcase'; + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'mixed case'); + } + + $fix = $phpcsFile->addFixableError( + 'The php open tag should be in lowercase. Found: %s', + $stackPtr, + $errorCode, + [\trim($content)] + ); + + if ($fix === true) { + $phpcsFile->fixer->replaceToken($stackPtr, $contentLC); + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/PHP/OneStatementInShortEchoTagSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/PHP/OneStatementInShortEchoTagSniff.php new file mode 100644 index 00000000..cbccb4c6 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/PHP/OneStatementInShortEchoTagSniff.php @@ -0,0 +1,101 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\PHP; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; + +/** + * Disallows multiple statements when PHP is opened with a short open echo tag. + * + * When using short open echo tags, PHP will echo out the result of the first statement. + * Subsequent statements will not be echo-ed out, but will be treated as "normal" PHP. + * + * As a best practice, short open echo tags should contain only one statement. + * + * @since 1.0.0 + */ +final class OneStatementInShortEchoTagSniff implements Sniff +{ + + /** + * Registers the tokens that this sniff wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_OPEN_TAG_WITH_ECHO]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + for ($endOfStatement = ($stackPtr + 1); $endOfStatement < $phpcsFile->numTokens; $endOfStatement++) { + if ($tokens[$endOfStatement]['code'] === \T_CLOSE_TAG + || $tokens[$endOfStatement]['code'] === \T_SEMICOLON + ) { + break; + } + + // Skip over anything within parenthesis. + if ($tokens[$endOfStatement]['code'] === \T_OPEN_PARENTHESIS + && isset($tokens[$endOfStatement]['parenthesis_closer']) + ) { + $endOfStatement = $tokens[$endOfStatement]['parenthesis_closer']; + } + } + + if ($endOfStatement === $phpcsFile->numTokens + || $tokens[$endOfStatement]['code'] === \T_CLOSE_TAG + ) { + return; + } + + // Semi-colon, so check for any code between it and the close tag. + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($endOfStatement + 1), null, true); + if ($nextNonEmpty === false + || $tokens[$nextNonEmpty]['code'] === \T_CLOSE_TAG + ) { + return; + } + + $fix = $phpcsFile->addFixableError( + 'Only one statement is allowed when using short open echo PHP tags.' + . ' Use the "<?php" open tag for multi-statement PHP.', + $nextNonEmpty, + 'MultipleFound' + ); + + if ($fix === true) { + if ($tokens[($stackPtr + 1)]['code'] === \T_WHITESPACE) { + $phpcsFile->fixer->replaceToken($stackPtr, '<?php echo'); + } else { + $phpcsFile->fixer->replaceToken($stackPtr, '<?php echo '); + } + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/DisallowMixedGroupUseSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/DisallowMixedGroupUseSniff.php new file mode 100644 index 00000000..2bb240df --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/DisallowMixedGroupUseSniff.php @@ -0,0 +1,248 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\UseStatements; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\Utils\GetTokensAsString; +use PHPCSUtils\Utils\UseStatements; + +/** + * Disallow group use statements which combine imports for namespace/OO, functions + * and/or constants in one statement. + * + * Note: the fixer will use a semi-standardized format for group use statements. + * If there are more specific requirements for the formatting of group use statements, + * the ruleset configurator should ensure that additional sniffs are included in the + * ruleset to enforce the required format. + * + * @since 1.1.0 + */ +final class DisallowMixedGroupUseSniff implements Sniff +{ + + /** + * Name of the "Use import source" metric. + * + * @since 1.1.0 + * + * @var string + */ + const METRIC_NAME = 'Import use statement type'; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.1.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_USE]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.1.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if (UseStatements::isImportUse($phpcsFile, $stackPtr) === false) { + // Closure or trait use statement. Bow out. + return; + } + + $useStatements = UseStatements::splitImportUseStatement($phpcsFile, $stackPtr); + + $ooCount = \count($useStatements['name']); + $functionCount = \count($useStatements['function']); + $constantCount = \count($useStatements['const']); + $totalCount = $ooCount + $functionCount + $constantCount; + + if ($totalCount === 0) { + // There must have been a parse error. Bow out. + return; + } + + // End of statement will always be found, otherwise the import statement parsing would have failed. + $endOfStatement = $phpcsFile->findNext([\T_SEMICOLON, \T_CLOSE_TAG], ($stackPtr + 1)); + $groupStart = $phpcsFile->findNext(\T_OPEN_USE_GROUP, ($stackPtr + 1), $endOfStatement); + + if ($groupStart === false) { + // Not a group use statement. Just record the metric. + if ($totalCount === 1) { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'single import'); + } else { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'multi import'); + } + + return; + } + + if ($totalCount === 1 + || ($ooCount !== 0 && $functionCount === 0 && $constantCount === 0) + || ($ooCount === 0 && $functionCount !== 0 && $constantCount === 0) + || ($ooCount === 0 && $functionCount === 0 && $constantCount !== 0) + ) { + // Not a *mixed* group use statement. + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'group use, single type'); + return; + } + + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'group use, multi type'); + + // Build up the error message. + $foundPhrases = []; + if ($ooCount > 1) { + $foundPhrases[] = \sprintf('%d namespaces/OO names', $ooCount); + } elseif ($ooCount === 1) { + $foundPhrases[] = \sprintf('%d namespace/OO name', $ooCount); + } + + if ($functionCount > 1) { + $foundPhrases[] = \sprintf('%d functions', $functionCount); + } elseif ($functionCount === 1) { + $foundPhrases[] = \sprintf('%d function', $functionCount); + } + + if ($constantCount > 1) { + $foundPhrases[] = \sprintf('%d constants', $constantCount); + } elseif ($constantCount === 1) { + $foundPhrases[] = \sprintf('%d constant', $constantCount); + } + + if (\count($foundPhrases) === 2) { + $found = \implode(' and ', $foundPhrases); + } else { + $found = \array_shift($foundPhrases) . ', '; + $found .= \implode(' and ', $foundPhrases); + } + + $error = 'Group use statements should import one type of construct.' + . ' Mixed group use statement found importing %s.'; + $code = 'Found'; + $data = [$found]; + + $hasComment = $phpcsFile->findNext(Tokens::$commentTokens, ($stackPtr + 1), $endOfStatement); + if ($hasComment !== false) { + // Don't attempt to auto-fix is there are comments or PHPCS annotations in the statement. + $phpcsFile->addError($error, $stackPtr, $code, $data); + return; + } + + $fix = $phpcsFile->addFixableError($error, $stackPtr, $code, $data); + + if ($fix === false) { + return; + } + + /* + * Fix it. + * + * This fixer complies with the following (arbitrary) requirements: + * - It will re-use the original base "group" name, i.e. the part before \{. + * - It take take aliases into account, but only when something is aliased to a different name. + * Aliases re-using the original name will be removed. + * - The fix will not add a trailing comma after the last group use sub-statement. + * This is a PHP 7.2+ feature. + * If a standard wants to enforce trailing commas, they should use a separate sniff for that. + * - If there is only 1 statement of a certain type, the replacement will be a single + * import use statement, not a group use statement. + */ + + $phpcsFile->fixer->beginChangeset(); + + // Ensure that a potential close PHP tag ending the statement is not removed. + $tokens = $phpcsFile->getTokens(); + $endRemoval = $endOfStatement; + if ($tokens[$endOfStatement]['code'] !== \T_SEMICOLON) { + $endRemoval = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($endOfStatement - 1), null, true); + } + + // Remove old statement with the exception of the `use` keyword. + for ($i = ($stackPtr + 1); $i <= $endRemoval; $i++) { + $phpcsFile->fixer->replaceToken($i, ''); + } + + // Build up the new use import statements. + $newStatements = []; + + $useIndent = \str_repeat(' ', ($tokens[$stackPtr]['column'] - 1)); + $insideIndent = $useIndent . \str_repeat(' ', 4); + + $baseGroupName = GetTokensAsString::noEmpties($phpcsFile, ($stackPtr + 1), ($groupStart - 1)); + + foreach ($useStatements as $type => $statements) { + $count = \count($statements); + if ($count === 0) { + continue; + } + + $typeName = $type . ' '; + if ($type === 'name') { + $typeName = ''; + } + + if ($count === 1) { + $fqName = \reset($statements); + $alias = \key($statements); + + $newStatement = 'use ' . $typeName . $fqName; + + $unqualifiedName = \ltrim(\substr($fqName, \strrpos($fqName, '\\')), '\\'); + if ($unqualifiedName !== $alias) { + $newStatement .= ' as ' . $alias; + } + + $newStatement .= ';'; + + $newStatements[] = $newStatement; + continue; + } + + // Multiple statements, add a single-type group use statement. + $newStatement = 'use ' . $typeName . $baseGroupName . '{' . $phpcsFile->eolChar; + + foreach ($statements as $alias => $fqName) { + $partialName = \str_replace($baseGroupName, '', $fqName); + $newStatement .= $insideIndent . $partialName; + + $unqualifiedName = \ltrim(\substr($partialName, \strrpos($partialName, '\\')), '\\'); + if ($unqualifiedName !== $alias) { + $newStatement .= ' as ' . $alias; + } + + $newStatement .= ',' . $phpcsFile->eolChar; + } + + // Remove trailing comma after last statement as that's PHP 7.2+. + $newStatement = \rtrim($newStatement, ',' . $phpcsFile->eolChar); + + $newStatement .= $phpcsFile->eolChar . $useIndent . '};'; + $newStatements[] = $newStatement; + } + + $replacement = \implode($phpcsFile->eolChar . $useIndent, $newStatements); + + $phpcsFile->fixer->replaceToken($stackPtr, $replacement); + + $phpcsFile->fixer->endChangeset(); + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/DisallowUseClassSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/DisallowUseClassSniff.php new file mode 100644 index 00000000..8dcf8ddb --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/DisallowUseClassSniff.php @@ -0,0 +1,211 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\UseStatements; + +use PHP_CodeSniffer\Exceptions\RuntimeException; +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\Utils\Namespaces; +use PHPCSUtils\Utils\UseStatements; + +/** + * Disallow class/trait/interface/enum import `use` statements. + * + * Related sniffs: + * - `Universal.UseStatements.DisallowUseFunction` + * - `Universal.UseStatements.DisallowUseConst` + * + * @since 1.0.0 + */ +final class DisallowUseClassSniff implements Sniff +{ + + /** + * Name of the "Use import source" metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME_SRC = 'Use import statement source for class/interface/trait/enum'; + + /** + * Name of the "Use import with/without alias" metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME_ALIAS = 'Use import statement for class/interface/trait/enum'; + + /** + * Keep track of which file is being scanned. + * + * @since 1.0.0 + * + * @var string + */ + private $currentFile = ''; + + /** + * Keep track of the current namespace. + * + * @since 1.0.0 + * + * @var string + */ + private $currentNamespace = ''; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [ + \T_USE, + \T_NAMESPACE, + ]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $file = $phpcsFile->getFilename(); + if ($file !== $this->currentFile) { + // Reset the current namespace for each new file. + $this->currentFile = $file; + $this->currentNamespace = ''; + } + + $tokens = $phpcsFile->getTokens(); + + // Get the name of the current namespace. + if ($tokens[$stackPtr]['code'] === \T_NAMESPACE) { + $namespaceName = Namespaces::getDeclaredName($phpcsFile, $stackPtr); + if ($namespaceName !== false) { + $this->currentNamespace = $namespaceName; + } + + return; + } + + // Ok, so this is a T_USE token. + try { + $statements = UseStatements::splitImportUseStatement($phpcsFile, $stackPtr); + } catch (RuntimeException $e) { + // Not an import use statement. Bow out. + return; + } + + if (empty($statements['name'])) { + // No class/trait/interface/enum import statements found. + return; + } + + $endOfStatement = $phpcsFile->findNext([\T_SEMICOLON, \T_CLOSE_TAG], ($stackPtr + 1)); + + foreach ($statements['name'] as $alias => $fullName) { + $reportPtr = $stackPtr; + do { + $reportPtr = $phpcsFile->findNext(\T_STRING, ($reportPtr + 1), $endOfStatement, false, $alias); + if ($reportPtr === false) { + // Shouldn't be possible. + continue 2; // @codeCoverageIgnore + } + + $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($reportPtr + 1), $endOfStatement, true); + if ($next !== false && $tokens[$next]['code'] === \T_NS_SEPARATOR) { + // Namespace level with same name. Continue searching. + continue; + } + + break; + } while (true); + + /* + * Build the error message and code. + * + * Check whether this is a non-namespaced (global) import and check whether this is an + * import from within the same namespace. + * + * Takes incorrect use statements with leading backslash into account. + * Takes case-INsensitivity of namespaces names into account. + * + * The "GlobalNamespace" error code takes precedence over the "SameNamespace" error code + * in case this is a non-namespaced file. + */ + + $error = 'Use import statements for class/interface/trait/enum%s are not allowed.'; + $error .= ' Found import statement for: "%s"'; + $errorCode = 'Found'; + $data = [ + '', + $fullName, + ]; + + $globalNamespace = false; + $sameNamespace = false; + if (\strpos($fullName, '\\', 1) === false) { + $globalNamespace = true; + $errorCode = 'FromGlobalNamespace'; + $data[0] = ' from the global namespace'; + + $phpcsFile->recordMetric($reportPtr, self::METRIC_NAME_SRC, 'global namespace'); + } elseif ($this->currentNamespace !== '' + && (\stripos($fullName, $this->currentNamespace . '\\') === 0 + || \stripos($fullName, '\\' . $this->currentNamespace . '\\') === 0) + ) { + $sameNamespace = true; + $errorCode = 'FromSameNamespace'; + $data[0] = ' from the same namespace'; + + $phpcsFile->recordMetric($reportPtr, self::METRIC_NAME_SRC, 'same namespace'); + } else { + $phpcsFile->recordMetric($reportPtr, self::METRIC_NAME_SRC, 'different namespace'); + } + + $hasAlias = false; + $lastLeaf = \strtolower(\substr($fullName, -(\strlen($alias) + 1))); + $aliasLC = \strtolower($alias); + if ($lastLeaf !== $aliasLC && $lastLeaf !== '\\' . $aliasLC) { + $hasAlias = true; + $error .= ' with alias: "%s"'; + $errorCode .= 'WithAlias'; + $data[] = $alias; + + $phpcsFile->recordMetric($reportPtr, self::METRIC_NAME_ALIAS, 'with alias'); + } else { + $phpcsFile->recordMetric($reportPtr, self::METRIC_NAME_ALIAS, 'without alias'); + } + + if ($errorCode === 'Found') { + $errorCode = 'FoundWithoutAlias'; + } + + $phpcsFile->addError($error, $reportPtr, $errorCode, $data); + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/DisallowUseConstSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/DisallowUseConstSniff.php new file mode 100644 index 00000000..44388f6a --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/DisallowUseConstSniff.php @@ -0,0 +1,211 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\UseStatements; + +use PHP_CodeSniffer\Exceptions\RuntimeException; +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\Utils\Namespaces; +use PHPCSUtils\Utils\UseStatements; + +/** + * Disallow constant import `use` statements. + * + * Related sniffs: + * - `Universal.UseStatements.DisallowUseClass` + * - `Universal.UseStatements.DisallowUseFunction` + * + * @since 1.0.0 + */ +final class DisallowUseConstSniff implements Sniff +{ + + /** + * Name of the "Use import source" metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME_SRC = 'Use import statement source for constant'; + + /** + * Name of the "Use import with/without alias" metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME_ALIAS = 'Use import statement for constant'; + + /** + * Keep track of which file is being scanned. + * + * @since 1.0.0 + * + * @var string + */ + private $currentFile = ''; + + /** + * Keep track of the current namespace. + * + * @since 1.0.0 + * + * @var string + */ + private $currentNamespace = ''; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [ + \T_USE, + \T_NAMESPACE, + ]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $file = $phpcsFile->getFilename(); + if ($file !== $this->currentFile) { + // Reset the current namespace for each new file. + $this->currentFile = $file; + $this->currentNamespace = ''; + } + + $tokens = $phpcsFile->getTokens(); + + // Get the name of the current namespace. + if ($tokens[$stackPtr]['code'] === \T_NAMESPACE) { + $namespaceName = Namespaces::getDeclaredName($phpcsFile, $stackPtr); + if ($namespaceName !== false) { + $this->currentNamespace = $namespaceName; + } + + return; + } + + // Ok, so this is a T_USE token. + try { + $statements = UseStatements::splitImportUseStatement($phpcsFile, $stackPtr); + } catch (RuntimeException $e) { + // Not an import use statement. Bow out. + return; + } + + if (empty($statements['const'])) { + // No import statements for constants found. + return; + } + + $endOfStatement = $phpcsFile->findNext([\T_SEMICOLON, \T_CLOSE_TAG], ($stackPtr + 1)); + + foreach ($statements['const'] as $alias => $fullName) { + $reportPtr = $stackPtr; + do { + $reportPtr = $phpcsFile->findNext(\T_STRING, ($reportPtr + 1), $endOfStatement, false, $alias); + if ($reportPtr === false) { + // Shouldn't be possible. + continue 2; // @codeCoverageIgnore + } + + $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($reportPtr + 1), $endOfStatement, true); + if ($next !== false && $tokens[$next]['code'] === \T_NS_SEPARATOR) { + // Namespace level with same name. Continue searching. + continue; + } + + break; + } while (true); + + /* + * Build the error message and code. + * + * Check whether this is a non-namespaced (global) import and check whether this is an + * import from within the same namespace. + * + * Takes incorrect use statements with leading backslash into account. + * Takes case-INsensitivity of namespaces names into account. + * + * The "GlobalNamespace" error code takes precedence over the "SameNamespace" error code + * in case this is a non-namespaced file. + */ + + $error = 'Use import statements for constants%s are not allowed.'; + $error .= ' Found import statement for: "%s"'; + $errorCode = 'Found'; + $data = [ + '', + $fullName, + ]; + + $globalNamespace = false; + $sameNamespace = false; + if (\strpos($fullName, '\\', 1) === false) { + $globalNamespace = true; + $errorCode = 'FromGlobalNamespace'; + $data[0] = ' from the global namespace'; + + $phpcsFile->recordMetric($reportPtr, self::METRIC_NAME_SRC, 'global namespace'); + } elseif ($this->currentNamespace !== '' + && (\stripos($fullName, $this->currentNamespace . '\\') === 0 + || \stripos($fullName, '\\' . $this->currentNamespace . '\\') === 0) + ) { + $sameNamespace = true; + $errorCode = 'FromSameNamespace'; + $data[0] = ' from the same namespace'; + + $phpcsFile->recordMetric($reportPtr, self::METRIC_NAME_SRC, 'same namespace'); + } else { + $phpcsFile->recordMetric($reportPtr, self::METRIC_NAME_SRC, 'different namespace'); + } + + $hasAlias = false; + $lastLeaf = \strtolower(\substr($fullName, -(\strlen($alias) + 1))); + $aliasLC = \strtolower($alias); + if ($lastLeaf !== $aliasLC && $lastLeaf !== '\\' . $aliasLC) { + $hasAlias = true; + $error .= ' with alias: "%s"'; + $errorCode .= 'WithAlias'; + $data[] = $alias; + + $phpcsFile->recordMetric($reportPtr, self::METRIC_NAME_ALIAS, 'with alias'); + } else { + $phpcsFile->recordMetric($reportPtr, self::METRIC_NAME_ALIAS, 'without alias'); + } + + if ($errorCode === 'Found') { + $errorCode = 'FoundWithoutAlias'; + } + + $phpcsFile->addError($error, $reportPtr, $errorCode, $data); + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/DisallowUseFunctionSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/DisallowUseFunctionSniff.php new file mode 100644 index 00000000..46a39edb --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/DisallowUseFunctionSniff.php @@ -0,0 +1,211 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\UseStatements; + +use PHP_CodeSniffer\Exceptions\RuntimeException; +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\Utils\Namespaces; +use PHPCSUtils\Utils\UseStatements; + +/** + * Disallow function import `use` statements. + * + * Related sniffs: + * - `Universal.UseStatements.DisallowUseClass` + * - `Universal.UseStatements.DisallowUseConst` + * + * @since 1.0.0 + */ +final class DisallowUseFunctionSniff implements Sniff +{ + + /** + * Name of the "Use import source" metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME_SRC = 'Use import statement source for functions'; + + /** + * Name of the "Use import with/without alias" metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME_ALIAS = 'Use import statement for functions'; + + /** + * Keep track of which file is being scanned. + * + * @since 1.0.0 + * + * @var string + */ + private $currentFile = ''; + + /** + * Keep track of the current namespace. + * + * @since 1.0.0 + * + * @var string + */ + private $currentNamespace = ''; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [ + \T_USE, + \T_NAMESPACE, + ]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $file = $phpcsFile->getFilename(); + if ($file !== $this->currentFile) { + // Reset the current namespace for each new file. + $this->currentFile = $file; + $this->currentNamespace = ''; + } + + $tokens = $phpcsFile->getTokens(); + + // Get the name of the current namespace. + if ($tokens[$stackPtr]['code'] === \T_NAMESPACE) { + $namespaceName = Namespaces::getDeclaredName($phpcsFile, $stackPtr); + if ($namespaceName !== false) { + $this->currentNamespace = $namespaceName; + } + + return; + } + + // Ok, so this is a T_USE token. + try { + $statements = UseStatements::splitImportUseStatement($phpcsFile, $stackPtr); + } catch (RuntimeException $e) { + // Not an import use statement. Bow out. + return; + } + + if (empty($statements['function'])) { + // No import statements for functions found. + return; + } + + $endOfStatement = $phpcsFile->findNext([\T_SEMICOLON, \T_CLOSE_TAG], ($stackPtr + 1)); + + foreach ($statements['function'] as $alias => $fullName) { + $reportPtr = $stackPtr; + do { + $reportPtr = $phpcsFile->findNext(\T_STRING, ($reportPtr + 1), $endOfStatement, false, $alias); + if ($reportPtr === false) { + // Shouldn't be possible. + continue 2; // @codeCoverageIgnore + } + + $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($reportPtr + 1), $endOfStatement, true); + if ($next !== false && $tokens[$next]['code'] === \T_NS_SEPARATOR) { + // Namespace level with same name. Continue searching. + continue; + } + + break; + } while (true); + + /* + * Build the error message and code. + * + * Check whether this is a non-namespaced (global) import and check whether this is an + * import from within the same namespace. + * + * Takes incorrect use statements with leading backslash into account. + * Takes case-INsensitivity of namespaces names into account. + * + * The "GlobalNamespace" error code takes precedence over the "SameNamespace" error code + * in case this is a non-namespaced file. + */ + + $error = 'Use import statements for functions%s are not allowed.'; + $error .= ' Found import statement for: "%s"'; + $errorCode = 'Found'; + $data = [ + '', + $fullName, + ]; + + $globalNamespace = false; + $sameNamespace = false; + if (\strpos($fullName, '\\', 1) === false) { + $globalNamespace = true; + $errorCode = 'FromGlobalNamespace'; + $data[0] = ' from the global namespace'; + + $phpcsFile->recordMetric($reportPtr, self::METRIC_NAME_SRC, 'global namespace'); + } elseif ($this->currentNamespace !== '' + && (\stripos($fullName, $this->currentNamespace . '\\') === 0 + || \stripos($fullName, '\\' . $this->currentNamespace . '\\') === 0) + ) { + $sameNamespace = true; + $errorCode = 'FromSameNamespace'; + $data[0] = ' from the same namespace'; + + $phpcsFile->recordMetric($reportPtr, self::METRIC_NAME_SRC, 'same namespace'); + } else { + $phpcsFile->recordMetric($reportPtr, self::METRIC_NAME_SRC, 'different namespace'); + } + + $hasAlias = false; + $lastLeaf = \strtolower(\substr($fullName, -(\strlen($alias) + 1))); + $aliasLC = \strtolower($alias); + if ($lastLeaf !== $aliasLC && $lastLeaf !== '\\' . $aliasLC) { + $hasAlias = true; + $error .= ' with alias: "%s"'; + $errorCode .= 'WithAlias'; + $data[] = $alias; + + $phpcsFile->recordMetric($reportPtr, self::METRIC_NAME_ALIAS, 'with alias'); + } else { + $phpcsFile->recordMetric($reportPtr, self::METRIC_NAME_ALIAS, 'without alias'); + } + + if ($errorCode === 'Found') { + $errorCode = 'FoundWithoutAlias'; + } + + $phpcsFile->addError($error, $reportPtr, $errorCode, $data); + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/KeywordSpacingSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/KeywordSpacingSniff.php new file mode 100644 index 00000000..3dd47c03 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/KeywordSpacingSniff.php @@ -0,0 +1,207 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2023 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\UseStatements; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\Fixers\SpacesFixer; +use PHPCSUtils\Utils\UseStatements; + +/** + * Enforce a single space after the keywords in import `use` statements. + * + * The keywords this sniff check are `use`, `function`, `const` and `as`. + * For `as`, the space *before* the keyword is also checked to be a single space. + * + * @since 1.1.0 + */ +final class KeywordSpacingSniff implements Sniff +{ + + /** + * Name of the metric for spacing before. + * + * @since 1.1.0 + * + * @var string + */ + const METRIC_NAME_BEFORE = 'Space before "%s" keyword in import use statement'; + + /** + * Name of the metric for spacing after. + * + * @since 1.1.0 + * + * @var string + */ + const METRIC_NAME_AFTER = 'Space after "%s" keyword in import use statement'; + + /** + * A list of keywords that are tokenized as `T_STRING` in import `use` statements. + * + * @since 1.1.0 + * + * @var array<string, true> + */ + protected $keywords = [ + 'const' => true, + 'function' => true, + ]; + + /** + * Returns an array of tokens this sniff wants to listen for. + * + * @since 1.1.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_USE]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.1.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if (UseStatements::isImportUse($phpcsFile, $stackPtr) === false) { + // Trait or closure use statement. + return; + } + + $tokens = $phpcsFile->getTokens(); + $endOfStatement = $phpcsFile->findNext([\T_SEMICOLON, \T_CLOSE_TAG], ($stackPtr + 1)); + if ($endOfStatement === false) { + // Live coding or parse error. + return; + } + + // Check the spacing after the `use` keyword. + $this->checkSpacingAfterKeyword($phpcsFile, $stackPtr, $tokens[$stackPtr]['content']); + + // Check the spacing before and after each `as` keyword. + $current = $stackPtr; + do { + $current = $phpcsFile->findNext(\T_AS, ($current + 1), $endOfStatement); + if ($current === false) { + break; + } + + // Prevent false positives when "as" is used within a "name". + if (isset(Tokens::$emptyTokens[$tokens[($current - 1)]['code']]) === true) { + $this->checkSpacingBeforeKeyword($phpcsFile, $current, $tokens[$current]['content']); + $this->checkSpacingAfterKeyword($phpcsFile, $current, $tokens[$current]['content']); + } + } while (true); + + /* + * Check the spacing after `function` and `const` keywords. + */ + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if (isset($this->keywords[\strtolower($tokens[$nextNonEmpty]['content'])]) === true) { + // Keyword found at start of statement, applies to whole statement. + $this->checkSpacingAfterKeyword($phpcsFile, $nextNonEmpty, $tokens[$nextNonEmpty]['content']); + return; + } + + // This may still be a group use statement with function/const substatements. + $openGroup = $phpcsFile->findNext(\T_OPEN_USE_GROUP, ($stackPtr + 1), $endOfStatement); + if ($openGroup === false) { + // Not a group use statement. + return; + } + + $closeGroup = $phpcsFile->findNext(\T_CLOSE_USE_GROUP, ($openGroup + 1), $endOfStatement); + + $current = $openGroup; + do { + $current = $phpcsFile->findNext(Tokens::$emptyTokens, ($current + 1), $closeGroup, true); + if ($current === false) { + return; + } + + if (isset($this->keywords[\strtolower($tokens[$current]['content'])]) === true) { + $this->checkSpacingAfterKeyword($phpcsFile, $current, $tokens[$current]['content']); + } + + // We're within the use group, so find the next comma. + $current = $phpcsFile->findNext(\T_COMMA, ($current + 1), $closeGroup); + } while ($current !== false); + } + + /** + * Check the spacing before a found keyword. + * + * @since 1.1.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the keyword in the token stack. + * @param string $content The keyword as found. + * + * @return void + */ + public function checkSpacingBeforeKeyword(File $phpcsFile, $stackPtr, $content) + { + $contentLC = \strtolower($content); + $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); + + SpacesFixer::checkAndFix( + $phpcsFile, + $stackPtr, + $prevNonEmpty, + 1, // Expected spaces. + 'Expected %s before the "' . $contentLC . '" keyword. Found: %s', + 'SpaceBefore' . \ucfirst($contentLC), + 'error', + 0, // Severity. + \sprintf(self::METRIC_NAME_BEFORE, $contentLC) + ); + } + + /** + * Check the spacing after a found keyword. + * + * @since 1.1.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the keyword in the token stack. + * @param string $content The keyword as found. + * + * @return void + */ + public function checkSpacingAfterKeyword(File $phpcsFile, $stackPtr, $content) + { + $contentLC = \strtolower($content); + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + + SpacesFixer::checkAndFix( + $phpcsFile, + $stackPtr, + $nextNonEmpty, + 1, // Expected spaces. + 'Expected %s after the "' . $contentLC . '" keyword. Found: %s', + 'SpaceAfter' . \ucfirst($contentLC), + 'error', + 0, // Severity. + \sprintf(self::METRIC_NAME_AFTER, $contentLC) + ); + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/LowercaseFunctionConstSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/LowercaseFunctionConstSniff.php new file mode 100644 index 00000000..b9f87f24 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/LowercaseFunctionConstSniff.php @@ -0,0 +1,156 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\UseStatements; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\Utils\UseStatements; + +/** + * Verify that the `function` and `const` keyword in import `use` statements are lowercase. + * + * Companion sniff to the upstream `Generic.PHP.LowerCaseKeyword` sniff which doesn't cover + * these keywords as they are not tokenized as `T_FUNCTION`/`T_CONST`, but as `T_STRING`. + * + * @since 1.0.0 + */ +final class LowercaseFunctionConstSniff implements Sniff +{ + + /** + * Name of the metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME = 'Import use statement %s keyword case'; + + /** + * A list of keywords that can follow use statements. + * + * @since 1.0.0 + * + * @var array<string, true> + */ + protected $keywords = [ + 'const' => true, + 'function' => true, + ]; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_USE]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if (UseStatements::isImportUse($phpcsFile, $stackPtr) === false) { + // Trait or closure use statement. + return; + } + + $tokens = $phpcsFile->getTokens(); + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($nextNonEmpty === false) { + // Live coding or parse error. + return; + } + + if (isset($this->keywords[\strtolower($tokens[$nextNonEmpty]['content'])]) === true) { + // Keyword found at start of statement, applies to whole statement. + $this->processKeyword($phpcsFile, $nextNonEmpty, $tokens[$nextNonEmpty]['content']); + return; + } + + // This may still be a group use statement with function/const substatements. + $openGroup = $phpcsFile->findNext([\T_SEMICOLON, \T_CLOSE_TAG, \T_OPEN_USE_GROUP], ($stackPtr + 1)); + if ($openGroup === false || $tokens[$openGroup]['code'] !== \T_OPEN_USE_GROUP) { + // Not a group use statement. + return; + } + + $closeGroup = $phpcsFile->findNext([\T_SEMICOLON, \T_CLOSE_TAG, \T_CLOSE_USE_GROUP], ($openGroup + 1)); + if ($closeGroup === false || $tokens[$closeGroup]['code'] !== \T_CLOSE_USE_GROUP) { + // Live coding or parse error. + return; + } + + $current = $openGroup; + do { + $current = $phpcsFile->findNext(Tokens::$emptyTokens, ($current + 1), $closeGroup, true); + if ($current === false) { + return; + } + + if (isset($this->keywords[\strtolower($tokens[$current]['content'])]) === true) { + $this->processKeyword($phpcsFile, $current, $tokens[$current]['content']); + } + + // We're within the use group, so find the next comma. + $current = $phpcsFile->findNext(\T_COMMA, ($current + 1), $closeGroup); + } while ($current !== false); + } + + /** + * Processes a found keyword. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the keyword in the token stack. + * @param string $content The keyword as found. + * + * @return void + */ + public function processKeyword(File $phpcsFile, $stackPtr, $content) + { + $contentLC = \strtolower($content); + $metricName = \sprintf(self::METRIC_NAME, $contentLC); + if ($contentLC === $content) { + // Already lowercase. Bow out. + $phpcsFile->recordMetric($stackPtr, $metricName, 'lowercase'); + return; + } + + if (\strtoupper($content) === $content) { + $phpcsFile->recordMetric($stackPtr, $metricName, 'uppercase'); + } else { + $phpcsFile->recordMetric($stackPtr, $metricName, 'mixed case'); + } + + $error = 'The "%s" keyword when used in an import use statements must be lowercase.'; + $fix = $phpcsFile->addFixableError($error, $stackPtr, 'NotLowercase', [$contentLC]); + + if ($fix === true) { + $phpcsFile->fixer->replaceToken($stackPtr, $contentLC); + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/NoLeadingBackslashSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/NoLeadingBackslashSniff.php new file mode 100644 index 00000000..1fccc828 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/NoLeadingBackslashSniff.php @@ -0,0 +1,170 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\UseStatements; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\Utils\UseStatements; + +/** + * Verifies that names being imported in import use statements do not start with a leading backslash. + * + * This sniff handles all types of import use statements supported by PHP, in contrast to any + * of the other sniffs for the same in, for instance, the PSR12 or the Slevomat standard, + * all of which are incomplete. + * + * @since 1.0.0 + */ +final class NoLeadingBackslashSniff implements Sniff +{ + + /** + * Name of the metric. + * + * @since 1.0.0 + * + * @var string + */ + const METRIC_NAME = 'Import use with leading backslash'; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_USE]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if (UseStatements::isImportUse($phpcsFile, $stackPtr) === false) { + // Trait or closure use statement. + return; + } + + $endOfStatement = $phpcsFile->findNext([\T_SEMICOLON, \T_CLOSE_TAG, \T_OPEN_USE_GROUP], ($stackPtr + 1)); + if ($endOfStatement === false) { + // Live coding or parse error. + return; + } + + $tokens = $phpcsFile->getTokens(); + $current = $stackPtr; + + do { + $continue = $this->processImport($phpcsFile, $current, $endOfStatement); + if ($continue === false) { + break; + } + + // Move the stackPtr forward to the next part of the use statement, if any. + $current = $phpcsFile->findNext(\T_COMMA, ($current + 1), $endOfStatement); + } while ($current !== false); + + if ($tokens[$endOfStatement]['code'] !== \T_OPEN_USE_GROUP) { + // Finished the statement. + return; + } + + $current = $endOfStatement; // Group open brace. + $endOfStatement = $phpcsFile->findNext([\T_CLOSE_USE_GROUP], ($endOfStatement + 1)); + if ($endOfStatement === false) { + // Live coding or parse error. + return; + } + + do { + $continue = $this->processImport($phpcsFile, $current, $endOfStatement, true); + if ($continue === false) { + break; + } + + // Move the stackPtr forward to the next part of the use statement, if any. + $current = $phpcsFile->findNext(\T_COMMA, ($current + 1), $endOfStatement); + } while ($current !== false); + } + + /** + * Examine an individual import statement. + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token. + * @param int $endOfStatement End token for the current import statement. + * @param bool $groupUse Whether the current statement is a partial one + * within a group use statement. + * + * @return bool Whether or not to continue examining this import use statement. + */ + private function processImport(File $phpcsFile, $stackPtr, $endOfStatement, $groupUse = false) + { + $tokens = $phpcsFile->getTokens(); + + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), $endOfStatement, true); + if ($nextNonEmpty === false) { + // Reached the end of the statement. + return false; + } + + // Skip past 'function'/'const' keyword. + $contentLC = \strtolower($tokens[$nextNonEmpty]['content']); + if ($tokens[$nextNonEmpty]['code'] === \T_STRING + && ($contentLC === 'function' || $contentLC === 'const') + ) { + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($nextNonEmpty + 1), $endOfStatement, true); + if ($nextNonEmpty === false) { + // Reached the end of the statement. + return false; + } + } + + if ($tokens[$nextNonEmpty]['code'] === \T_NS_SEPARATOR) { + $phpcsFile->recordMetric($nextNonEmpty, self::METRIC_NAME, 'yes'); + + $error = 'An import use statement should never start with a leading backslash'; + $code = 'LeadingBackslashFound'; + + if ($groupUse === true) { + $error = 'Parse error: partial import use statement in a use group starting with a leading backslash'; + $code = 'LeadingBackslashFoundInGroup'; + } + + $fix = $phpcsFile->addFixableError($error, $nextNonEmpty, $code); + + if ($fix === true) { + if ($tokens[$nextNonEmpty - 1]['code'] !== \T_WHITESPACE) { + $phpcsFile->fixer->replaceToken($nextNonEmpty, ' '); + } else { + $phpcsFile->fixer->replaceToken($nextNonEmpty, ''); + } + } + } else { + $phpcsFile->recordMetric($nextNonEmpty, self::METRIC_NAME, 'no'); + } + + return true; + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/NoUselessAliasesSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/NoUselessAliasesSniff.php new file mode 100644 index 00000000..93de596c --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/NoUselessAliasesSniff.php @@ -0,0 +1,155 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2023 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\UseStatements; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\Utils\NamingConventions; +use PHPCSUtils\Utils\UseStatements; + +/** + * Detects useless aliases for import use statements. + * + * Aliasing something to the same name as the original construct is considered useless. + * Note: as OO and function names in PHP are case-insensitive, aliasing to the same name, + * using a different case is also considered useless. + * + * @since 1.1.0 + */ +final class NoUselessAliasesSniff implements Sniff +{ + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.1.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_USE]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.1.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if (UseStatements::isImportUse($phpcsFile, $stackPtr) === false) { + // Closure or trait use statement. Bow out. + return; + } + + $endOfStatement = $phpcsFile->findNext([\T_SEMICOLON, \T_CLOSE_TAG], ($stackPtr + 1)); + if ($endOfStatement === false) { + // Parse error or live coding. + return; + } + + $hasAliases = $phpcsFile->findNext(\T_AS, ($stackPtr + 1), $endOfStatement); + if ($hasAliases === false) { + // This use import statement does not alias anything, bow out. + return; + } + + $useStatements = UseStatements::splitImportUseStatement($phpcsFile, $stackPtr); + if (\count($useStatements, \COUNT_RECURSIVE) <= 3) { + // No statements found. Shouldn't be possible, but still. Bow out. + return; + } + + $tokens = $phpcsFile->getTokens(); + + // Collect all places where aliases are used in this use statement. + $aliasPtrs = []; + $currentAs = $hasAliases; + do { + $aliasPtr = $phpcsFile->findNext(Tokens::$emptyTokens, ($currentAs + 1), null, true); + if ($aliasPtr !== false && $tokens[$aliasPtr]['code'] === \T_STRING) { + $aliasPtrs[$currentAs] = $aliasPtr; + } + + $currentAs = $phpcsFile->findNext(\T_AS, ($currentAs + 1), $endOfStatement); + } while ($currentAs !== false); + + // Now check the names in each use statement for useless aliases. + foreach ($useStatements as $type => $statements) { + foreach ($statements as $alias => $fqName) { + $unqualifiedName = \ltrim(\substr($fqName, \strrpos($fqName, '\\')), '\\'); + + $uselessAlias = false; + if ($type === 'const') { + // Do a case-sensitive comparison for constants. + if ($unqualifiedName === $alias) { + $uselessAlias = true; + } + } elseif (NamingConventions::isEqual($unqualifiedName, $alias)) { + $uselessAlias = true; + } + + if ($uselessAlias === false) { + continue; + } + + // Now check if this is actually used as an alias or just the actual name. + foreach ($aliasPtrs as $asPtr => $aliasPtr) { + if ($tokens[$aliasPtr]['content'] !== $alias) { + continue; + } + + // Make sure this is really the right one. + $prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($asPtr - 1), null, true); + if ($tokens[$prev]['code'] !== \T_STRING + || $tokens[$prev]['content'] !== $unqualifiedName + ) { + continue; + } + + $error = 'Useless alias "%s" found for import of "%s"'; + $code = 'Found'; + $data = [$alias, $fqName]; + + // Okay, so this is the one which should be flagged. + $hasComments = $phpcsFile->findNext(Tokens::$commentTokens, ($prev + 1), $aliasPtr); + if ($hasComments !== false) { + // Don't auto-fix if there are comments. + $phpcsFile->addError($error, $aliasPtr, $code, $data); + break; + } + + $fix = $phpcsFile->addFixableError($error, $aliasPtr, $code, $data); + + if ($fix === true) { + $phpcsFile->fixer->beginChangeset(); + + for ($i = ($prev + 1); $i <= $aliasPtr; $i++) { + $phpcsFile->fixer->replaceToken($i, ''); + } + + $phpcsFile->fixer->endChangeset(); + } + + break; + } + } + } + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/WhiteSpace/AnonClassKeywordSpacingSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/WhiteSpace/AnonClassKeywordSpacingSniff.php new file mode 100644 index 00000000..31163165 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/WhiteSpace/AnonClassKeywordSpacingSniff.php @@ -0,0 +1,79 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\WhiteSpace; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\Fixers\SpacesFixer; + +/** + * Checks the spacing between the "class" keyword and the open parenthesis for anonymous classes with parentheses. + * + * @since 1.0.0 + */ +final class AnonClassKeywordSpacingSniff implements Sniff +{ + + /** + * The amount of spacing to demand between the class keyword and the open parenthesis. + * + * @since 1.0.0 + * + * @var int + */ + public $spacing = 0; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_ANON_CLASS]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== \T_OPEN_PARENTHESIS) { + // No parentheses, nothing to do. + return; + } + + SpacesFixer::checkAndFix( + $phpcsFile, + $stackPtr, + $nextNonEmpty, + (int) $this->spacing, + 'There must be %1$s between the class keyword and the open parenthesis for an anonymous class. Found: %2$s', + 'Incorrect', + 'error', + 0, + 'Anon class: space between keyword and open parenthesis' + ); + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/WhiteSpace/CommaSpacingSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/WhiteSpace/CommaSpacingSniff.php new file mode 100644 index 00000000..376e9046 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/WhiteSpace/CommaSpacingSniff.php @@ -0,0 +1,408 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\WhiteSpace; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\BackCompat\Helper; +use PHPCSUtils\Fixers\SpacesFixer; +use PHPCSUtils\Tokens\Collections; +use PHPCSUtils\Utils\Parentheses; + +/** + * Check spacing around commas. + * + * - Demands there is no whitespace between the preceeding code and the comma. + * - Demands exactly one space or a new line after a comma. + * - Demands that when there is a trailing comment, the comma follows the code, not the comment. + * + * The following exclusions are in place: + * - A comma preceded or followed by a parenthesis, curly or square bracket. + * These will not be flagged to prevent conflicts with sniffs handling spacing around braces. + * - A comma preceded or followed by another comma, like for skipping items in a list assignment. + * These will not be flagged. + * - A comma preceded by a non-indented heredoc/nowdoc closer. + * In that case, unless the `php_version` config directive is set to a version higher than PHP 7.3.0, + * a new line before will be enforced to prevent parse errors on PHP < 7.3. + * + * The sniff has a separate error code for when a comma is found with more than one space after it, followed + * by a trailing comment. That way trailing comment alignment can be allowed by excluding that error code. + * + * The sniff uses modular error code suffixes for select situations, like `*InFunctionDeclaration`, + * `*InFunctionCall`, to allow for preventing duplicate messages if another sniff is already + * handling the comma spacing. + * + * @since 1.1.0 + */ +final class CommaSpacingSniff implements Sniff +{ + + /** + * Name of the "Spacing before" metric. + * + * @since 1.1.0 + * + * @var string + */ + const METRIC_NAME_BEFORE = 'Spaces found before comma'; + + /** + * Name of the "Spacing after" metric. + * + * @since 1.1.0 + * + * @var string + */ + const METRIC_NAME_AFTER = 'Spaces found after comma'; + + /** + * PHP version as configured or 0 if unknown. + * + * @since 1.1.0 + * + * @var int + */ + private $phpVersion; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.1.0 + * + * @return array<int|string> + */ + public function register() + { + return [\T_COMMA]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.1.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + if (isset($this->phpVersion) === false || \defined('PHP_CODESNIFFER_IN_TESTS')) { + // Set default value to prevent this code from running every time the sniff is triggered. + $this->phpVersion = 0; + + $phpVersion = Helper::getConfigData('php_version'); + if ($phpVersion !== null) { + $this->phpVersion = (int) $phpVersion; + } + } + + $this->processSpacingBefore($phpcsFile, $stackPtr); + $this->processSpacingAfter($phpcsFile, $stackPtr); + } + + /** + * Check the spacing before the comma. + * + * @since 1.1.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + protected function processSpacingBefore(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + $prevNonWhitespace = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true); + $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + + if ($prevNonWhitespace !== $prevNonEmpty + && $tokens[$prevNonEmpty]['code'] !== \T_COMMA + && $tokens[$prevNonEmpty]['line'] !== $tokens[$nextNonEmpty]['line'] + ) { + // Special case: comma after a trailing comment - the comma should be moved to before the comment. + $fix = $phpcsFile->addFixableError( + 'Comma found after comment, expected the comma after the end of the code', + $stackPtr, + 'CommaAfterComment' + ); + + if ($fix === true) { + $phpcsFile->fixer->beginChangeset(); + + $phpcsFile->fixer->replaceToken($stackPtr, ''); + $phpcsFile->fixer->addContent($prevNonEmpty, ','); + + // Clean up potential trailing whitespace left behind, but don't remove blank lines. + $nextNonWhitespace = $phpcsFile->findNext(\T_WHITESPACE, ($stackPtr + 1), null, true); + if ($tokens[($stackPtr - 1)]['code'] === \T_WHITESPACE + && $tokens[($stackPtr - 1)]['line'] === $tokens[$stackPtr]['line'] + && $tokens[$stackPtr]['line'] !== $tokens[$nextNonWhitespace]['line'] + ) { + $phpcsFile->fixer->replaceToken(($stackPtr - 1), ''); + } + + $phpcsFile->fixer->endChangeset(); + } + return; + } + + if ($tokens[$prevNonWhitespace]['code'] === \T_COMMA) { + // This must be a list assignment with ignored items. Ignore. + return; + } + + if (isset(Tokens::$blockOpeners[$tokens[$prevNonWhitespace]['code']]) === true + || $tokens[$prevNonWhitespace]['code'] === \T_OPEN_SHORT_ARRAY + || $tokens[$prevNonWhitespace]['code'] === \T_OPEN_USE_GROUP + ) { + // Should only realistically be possible for lists. Leave for a block brace spacing sniff to sort out. + return; + } + + $expectedSpaces = 0; + + if ($tokens[$prevNonEmpty]['code'] === \T_END_HEREDOC + || $tokens[$prevNonEmpty]['code'] === \T_END_NOWDOC + ) { + /* + * If php_version is explicitly set to PHP < 7.3, enforce a new line between the closer and the comma. + * + * If php_version is *not* explicitly set, let the indent be leading and only enforce + * a new line between the closer and the comma when this is an old-style heredoc/nowdoc. + */ + if ($this->phpVersion !== 0 && $this->phpVersion < 70300) { + $expectedSpaces = 'newline'; + } + + if ($this->phpVersion === 0 + && \ltrim($tokens[$prevNonEmpty]['content']) === $tokens[$prevNonEmpty]['content'] + ) { + $expectedSpaces = 'newline'; + } + } + + $error = 'Expected %1$s between "' . $this->escapePlaceholders($tokens[$prevNonWhitespace]['content']) + . '" and the comma. Found: %2$s'; + $codeSuffix = $this->getSuffix($phpcsFile, $stackPtr); + $metricSuffix = $this->codeSuffixToMetric($codeSuffix); + + SpacesFixer::checkAndFix( + $phpcsFile, + $stackPtr, + $prevNonWhitespace, + $expectedSpaces, + $error, + 'SpaceBefore' . $codeSuffix, + 'error', + 0, + self::METRIC_NAME_BEFORE . $metricSuffix + ); + } + + /** + * Check the spacing after the comma. + * + * @since 1.1.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return void + */ + protected function processSpacingAfter(File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + $nextNonWhitespace = $phpcsFile->findNext(\T_WHITESPACE, ($stackPtr + 1), null, true); + if ($nextNonWhitespace === false) { + // Live coding/parse error. Ignore. + return; + } + + if ($tokens[$nextNonWhitespace]['code'] === \T_COMMA) { + // This must be a list assignment with ignored items. Ignore. + return; + } + + if ($tokens[$nextNonWhitespace]['code'] === \T_CLOSE_CURLY_BRACKET + || $tokens[$nextNonWhitespace]['code'] === \T_CLOSE_SQUARE_BRACKET + || $tokens[$nextNonWhitespace]['code'] === \T_CLOSE_PARENTHESIS + || $tokens[$nextNonWhitespace]['code'] === \T_CLOSE_SHORT_ARRAY + || $tokens[$nextNonWhitespace]['code'] === \T_CLOSE_USE_GROUP + ) { + // Ignore. Leave for a block spacing sniff to sort out. + return; + } + + $nextToken = $tokens[($stackPtr + 1)]; + + $error = 'Expected %1$s between the comma and "' + . $this->escapePlaceholders($tokens[$nextNonWhitespace]['content']) . '". Found: %2$s'; + + $codeSuffix = $this->getSuffix($phpcsFile, $stackPtr); + $metricSuffix = $this->codeSuffixToMetric($codeSuffix); + + if ($nextToken['code'] === \T_WHITESPACE) { + if ($nextToken['content'] === ' ') { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME_AFTER . $metricSuffix, '1 space'); + return; + } + + // Note: this check allows for trailing whitespace between the comma and a new line char. + // The trailing whitespace is not the concern of this sniff. + if (\ltrim($nextToken['content'], ' ') === $phpcsFile->eolChar) { + $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME_AFTER . $metricSuffix, 'a new line'); + return; + } + + $errorCode = 'TooMuchSpaceAfter' . $codeSuffix; + + $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if (isset(Tokens::$commentTokens[$tokens[$nextNonWhitespace]['code']]) === true + && ($nextNonEmpty === false || $tokens[$stackPtr]['line'] !== $tokens[$nextNonEmpty]['line']) + ) { + // Separate error code to allow for aligning trailing comments. + $errorCode = 'TooMuchSpaceAfterCommaBeforeTrailingComment'; + } + + SpacesFixer::checkAndFix( + $phpcsFile, + $stackPtr, + $nextNonWhitespace, + 1, + $error, + $errorCode, + 'error', + 0, + self::METRIC_NAME_AFTER . $metricSuffix + ); + return; + } + + SpacesFixer::checkAndFix( + $phpcsFile, + $stackPtr, + $nextNonWhitespace, + 1, + $error, + 'NoSpaceAfter' . $codeSuffix, + 'error', + 0, + self::METRIC_NAME_AFTER . $metricSuffix + ); + } + + /** + * Escape arbitrary token content for *printf() placeholders. + * + * @since 1.1.0 + * + * @param string $text Arbitrary text string. + * + * @return string + */ + private function escapePlaceholders($text) + { + return \preg_replace('`(?:^|[^%])(%)(?:[^%]|$)`', '%%', \trim($text)); + } + + /** + * Retrieve a text string for use as a suffix to an error code. + * + * This allows for modular error codes, which in turn allow for selectively excluding + * error codes. + * + * {@internal Closure use will be parentheses owner in PHPCS 4.x, this code will + * need an update for that in due time.} + * + * @since 1.1.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return string + */ + private function getSuffix($phpcsFile, $stackPtr) + { + $opener = Parentheses::getLastOpener($phpcsFile, $stackPtr); + if ($opener === false) { + return ''; + } + + $tokens = $phpcsFile->getTokens(); + + $owner = Parentheses::getOwner($phpcsFile, $opener); + if ($owner !== false) { + switch ($tokens[$owner]['code']) { + case \T_FUNCTION: + case \T_CLOSURE: + case \T_FN: + return 'InFunctionDeclaration'; + + case \T_DECLARE: + return 'InDeclare'; + + case \T_ANON_CLASS: + case \T_ISSET: + case \T_UNSET: + return 'InFunctionCall'; + + // Long array, long list, isset, unset, empty, exit, eval, control structures. + default: + return ''; + } + } + + $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($opener - 1), null, true); + + if (isset(Collections::nameTokens()[$tokens[$prevNonEmpty]['code']]) === true) { + return 'InFunctionCall'; + } + + switch ($tokens[$prevNonEmpty]['code']) { + case \T_USE: + return 'InClosureUse'; + + case \T_VARIABLE: + case \T_SELF: + case \T_STATIC: + case \T_PARENT: + return 'InFunctionCall'; + + default: + return ''; + } + } + + /** + * Transform a suffix for an error code into a suffix for a metric. + * + * @since 1.1.0 + * + * @param string $suffix Error code suffix. + * + * @return string + */ + private function codeSuffixToMetric($suffix) + { + return \strtolower(\preg_replace('`([A-Z])`', ' $1', $suffix)); + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/WhiteSpace/DisallowInlineTabsSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/WhiteSpace/DisallowInlineTabsSniff.php new file mode 100644 index 00000000..817a44e1 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/WhiteSpace/DisallowInlineTabsSniff.php @@ -0,0 +1,173 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\WhiteSpace; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSExtra\Universal\Helpers\DummyTokenizer; +use PHPCSUtils\BackCompat\Helper; +use PHPCSUtils\Tokens\Collections; + +/** + * Enforces using spaces for mid-line alignment. + * + * While tab versus space based indentation is a question of preference, for mid-line + * alignment, spaces should always be preferred, as using tabs will result in inconsistent + * formatting depending on the dev-user's chosen tab width. + * + * This sniff is especially useful for tab-indentation based standards which use the + * `Generic.Whitespace.DisallowSpaceIndent` sniff to enforce this. + * + * **DO** make sure to set the PHPCS native `tab-width` configuration for the best results. + * <code> + * <arg name="tab-width" value="4"/> + * </code> + * + * The PHPCS native `Generic.Whitespace.DisallowTabIndent` sniff oversteps its reach and silently + * does mid-line tab to space replacements as well. + * However, the sister-sniff `Generic.Whitespace.DisallowSpaceIndent` leaves mid-line tabs/spaces alone. + * This sniff fills that gap. + * + * @since 1.0.0 + */ +final class DisallowInlineTabsSniff implements Sniff +{ + + /** + * The --tab-width CLI value that is being used. + * + * @since 1.0.0 + * + * @var int + */ + private $tabWidth; + + /** + * Tokens to check for mid-line tabs. + * + * @since 1.0.0 + * + * @var array<int|string, true> + */ + private $find = [ + \T_WHITESPACE => true, + \T_DOC_COMMENT_WHITESPACE => true, + \T_DOC_COMMENT_STRING => true, + \T_COMMENT => true, + ]; + + /** + * Registers the tokens that this sniff wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + return Collections::phpOpenTags(); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return int Integer stack pointer to skip the rest of the file. + */ + public function process(File $phpcsFile, $stackPtr) + { + if (isset($this->tabWidth) === false) { + $this->tabWidth = (int) Helper::getTabWidth($phpcsFile); + } + + if (\defined('PHP_CODESNIFFER_IN_TESTS')) { + $this->tabWidth = (int) Helper::getCommandLineData($phpcsFile, 'tabWidth'); + } + + $tokens = $phpcsFile->getTokens(); + $dummy = new DummyTokenizer('', $phpcsFile->config); + + for ($i = 0; $i < $phpcsFile->numTokens; $i++) { + // Skip all non-whitespace tokens and skip whitespace at the start of a new line. + if (isset($this->find[$tokens[$i]['code']]) === false + || (($tokens[$i]['code'] === \T_WHITESPACE + || $tokens[$i]['code'] === \T_DOC_COMMENT_WHITESPACE) + && $tokens[$i]['column'] === 1) + ) { + continue; + } + + // If tabs haven't been converted to spaces by the tokenizer, do so now. + $token = $tokens[$i]; + if (isset($token['orig_content']) === false) { + if ($token['content'] === '' || \strpos($token['content'], "\t") === false) { + // If there are no tabs, we can continue, no matter what. + continue; + } + + $dummy->replaceTabsInToken($token); + } + + /* + * Tokens only have the 'orig_content' key if they contain tabs, + * so from here on out, we **know** there will be tabs in the content. + */ + $origContent = $token['orig_content']; + $commentOnly = ''; + + $multiLineComment = false; + if (($tokens[$i]['code'] === \T_COMMENT + || isset(Tokens::$phpcsCommentTokens[$tokens[$i]['code']])) + && $tokens[$i]['column'] === 1 + && ($tokens[($i - 1)]['code'] === \T_COMMENT + || isset(Tokens::$phpcsCommentTokens[$tokens[($i - 1)]['code']])) + ) { + $multiLineComment = true; + } + + if ($multiLineComment === true) { + // This is the subsequent line of a multi-line comment. Account for indentation. + $commentOnly = \ltrim($origContent); + if ($commentOnly === '' || \strpos($commentOnly, "\t") === false) { + continue; + } + } + + $fix = $phpcsFile->addFixableError( + 'Spaces must be used for mid-line alignment; tabs are not allowed', + $i, + 'NonIndentTabsUsed' + ); + + if ($fix === false) { + continue; + } + + $indent = ''; + if ($multiLineComment === true) { + // Take the original indent (tabs/spaces) and combine with the tab-replaced comment content. + $indent = \str_replace($commentOnly, '', $origContent); + $token['content'] = \ltrim($token['content']); + } + + $phpcsFile->fixer->replaceToken($i, $indent . $token['content']); + } + + // Scanned the whole file in one go. Don't scan this file again. + return $phpcsFile->numTokens; + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/WhiteSpace/PrecisionAlignmentSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/WhiteSpace/PrecisionAlignmentSniff.php new file mode 100644 index 00000000..af689684 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/WhiteSpace/PrecisionAlignmentSniff.php @@ -0,0 +1,445 @@ +<?php +/** + * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer. + * + * @package PHPCSExtra + * @copyright 2020 PHPCSExtra Contributors + * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 + * @link https://github.com/PHPCSStandards/PHPCSExtra + */ + +namespace PHPCSExtra\Universal\Sniffs\WhiteSpace; + +use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Sniffs\Sniff; +use PHP_CodeSniffer\Util\Tokens; +use PHPCSUtils\BackCompat\Helper; +use PHPCSUtils\Tokens\Collections; + +/** + * Detects when the indentation is not a multiple of a tab-width, i.e. when precision alignment is used. + * + * In rare cases, spaces for precision alignment can be intentional and acceptable, + * but more often than not, precision alignment is a typo. + * + * Notes: + * - When using this sniff with tab-based standards, please ensure that the `tab-width` is set + * and either don't set the `$indent` property or set it to the tab-width. + * - Precision alignment *within* text strings (multi-line text strings, heredocs, nowdocs) + * will NOT be flagged by this sniff. + * - The fixer works based on "best guess" and may not always result in the desired indentation. + * - This fixer will use tabs or spaces based on whether tabs were present in the original indent. + * Use the PHPCS native `Generic.WhiteSpace.DisallowTabIndent` or the + * `Generic.WhiteSpace.DisallowSpaceIndent` sniff to clean up the results if so desired. + * + * @since 1.0.0 + */ +final class PrecisionAlignmentSniff implements Sniff +{ + + /** + * A list of tokenizers this sniff supports. + * + * @since 1.0.0 + * + * @var string[] + */ + public $supportedTokenizers = [ + 'PHP', + 'JS', + 'CSS', + ]; + + /** + * The indent used for the codebase. + * + * This property is used to determine whether something is indentation or precision alignment. + * If this property is not set, the sniff will look to the `--tab-width` CLI value. + * If that also isn't set, the default tab-width of 4 will be used. + * + * @since 1.0.0 + * + * @var int|null + */ + public $indent = null; + + /** + * Allow for providing a list of tokens for which (preceding) precision alignment should be ignored. + * + * By default, precision alignment will always be flagged. + * + * Example usage: + * ```xml + * <rule ref="Universal.WhiteSpace.PrecisionAlignment"> + * <properties> + * <property name="ignoreAlignmentBefore" type="array"> + * <!-- Ignore precision alignment in inline HTML --> + * <element value="T_INLINE_HTML"/> + * <!-- Ignore precision alignment in multiline chained method calls. --> + * <element value="T_OBJECT_OPERATOR"/> + * </property> + * </properties> + * </rule> + * ``` + * + * @since 1.0.0 + * + * @var string[] + */ + public $ignoreAlignmentBefore = []; + + /** + * Whether or not potential trailing whitespace on otherwise blank lines should be examined or ignored. + * + * Defaults to `true`, i.e. ignore blank lines. + * + * It is recommended to only set this to `false` if the standard including this sniff does not + * include the `Squiz.WhiteSpace.SuperfluousWhitespace` sniff (which is included in most standards). + * + * @since 1.0.0 + * + * @var bool + */ + public $ignoreBlankLines = true; + + /** + * The --tab-width CLI value that is being used. + * + * @since 1.0.0 + * + * @var int + */ + private $tabWidth; + + /** + * Whitespace tokens and tokens which can contain leading whitespace. + * + * A few additional tokens will be added to this list in the register() method. + * + * @since 1.0.0 + * + * @var array<int|string, int|string> + */ + private $tokensToCheck = [ + \T_WHITESPACE => \T_WHITESPACE, + \T_INLINE_HTML => \T_INLINE_HTML, + \T_DOC_COMMENT_WHITESPACE => \T_DOC_COMMENT_WHITESPACE, + \T_COMMENT => \T_COMMENT, + \T_END_HEREDOC => \T_END_HEREDOC, + \T_END_NOWDOC => \T_END_NOWDOC, + ]; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @since 1.0.0 + * + * @return array<int|string> + */ + public function register() + { + // Add the ignore annotation tokens to the list of tokens to check. + $this->tokensToCheck += Tokens::$phpcsCommentTokens; + + return Collections::phpOpenTags(); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @since 1.0.0 + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token + * in the stack passed in $tokens. + * + * @return int Integer stack pointer to skip the rest of the file. + */ + public function process(File $phpcsFile, $stackPtr) + { + /* + * Handle the properties. + */ + if (isset($this->tabWidth) === false || \defined('PHP_CODESNIFFER_IN_TESTS') === true) { + $this->tabWidth = Helper::getTabWidth($phpcsFile); + } + + if (isset($this->indent) === true) { + $indent = (int) $this->indent; + } else { + $indent = $this->tabWidth; + } + + $ignoreTokens = (array) $this->ignoreAlignmentBefore; + if (empty($ignoreTokens) === false) { + $ignoreTokens = \array_flip($ignoreTokens); + } + + /* + * Check the whole file in one go. + */ + $tokens = $phpcsFile->getTokens(); + + for ($i = 0; $i < $phpcsFile->numTokens; $i++) { + if ($tokens[$i]['column'] !== 1) { + // Only interested in the first token on each line. + continue; + } + + if (isset($this->tokensToCheck[$tokens[$i]['code']]) === false) { + // Not one of the target tokens. + continue; + } + + if ($tokens[$i]['content'] === $phpcsFile->eolChar) { + // Skip completely blank lines. + continue; + } + + if (isset($ignoreTokens[$tokens[$i]['type']]) === true + || (isset($tokens[($i + 1)]) && isset($ignoreTokens[$tokens[($i + 1)]['type']])) + ) { + // This is one of the tokens being ignored. + continue; + } + + $origContent = null; + if (isset($tokens[$i]['orig_content']) === true) { + $origContent = $tokens[$i]['orig_content']; + } + + $spaces = 0; + $length = 0; + $content = ''; + $closer = ''; + + switch ($tokens[$i]['code']) { + case \T_WHITESPACE: + if ($this->ignoreBlankLines === true + && isset($tokens[($i + 1)]) + && $tokens[$i]['line'] !== $tokens[($i + 1)]['line'] + ) { + // Skip blank lines which only contain trailing whitespace. + continue 2; + } + + $spaces = ($tokens[$i]['length'] % $indent); + break; + + case \T_DOC_COMMENT_WHITESPACE: + /* + * Blank lines with trailing whitespace in docblocks are tokenized as + * two T_DOC_COMMENT_WHITESPACE tokens: one for the trailing whitespace, + * one for the new line character. + */ + if ($this->ignoreBlankLines === true + && isset($tokens[($i + 1)]) + && $tokens[($i + 1)]['content'] === $phpcsFile->eolChar + && isset($tokens[($i + 2)]) + && $tokens[$i]['line'] !== $tokens[($i + 2)]['line'] + ) { + // Skip blank lines which only contain trailing whitespace. + continue 2; + } + + $spaces = ($tokens[$i]['length'] % $indent); + + if (isset($tokens[($i + 1)]) === true + && ($tokens[($i + 1)]['code'] === \T_DOC_COMMENT_STAR + || $tokens[($i + 1)]['code'] === \T_DOC_COMMENT_CLOSE_TAG) + && $spaces !== 0 + ) { + // One alignment space expected before the *. + --$spaces; + } + break; + + case \T_COMMENT: + case \T_INLINE_HTML: + if ($this->ignoreBlankLines === true + && \trim($tokens[$i]['content']) === '' + && isset($tokens[($i + 1)]) + && $tokens[$i]['line'] !== $tokens[($i + 1)]['line'] + ) { + // Skip blank lines which only contain trailing whitespace. + continue 2; + } + + // Deliberate fall-through. + + case \T_PHPCS_ENABLE: + case \T_PHPCS_DISABLE: + case \T_PHPCS_SET: + case \T_PHPCS_IGNORE: + case \T_PHPCS_IGNORE_FILE: + /* + * Indentation is included in the contents of the token for: + * - inline HTML + * - PHP 7.3+ flexible heredoc/nowdoc closer identifiers (see below); + * - subsequent lines of multi-line comments; + * - PHPCS native annotations when part of a multi-line comment. + */ + $content = \ltrim($tokens[$i]['content']); + $whitespace = \str_replace($content, '', $tokens[$i]['content']); + + /* + * If there is no content, this is a blank line in a comment or in inline HTML. + * In that case, use the predetermined length as otherwise the new line character + * at the end of the whitespace will throw the count off. + */ + $length = ($content === '') ? $tokens[$i]['length'] : \strlen($whitespace); + $spaces = ($length % $indent); + + /* + * For multi-line star-comments, which use (aligned) stars on subsequent + * lines, we don't want to trigger on the one extra space before the star. + * + * While not 100% correct, don't exclude inline HTML from this check as + * otherwise the sniff would trigger on multi-line /*-style inline javascript comments. + * This may cause false negatives as there is no check for being in a + * <script> tag, but that will be rare. + */ + if (isset($content[0]) === true && $content[0] === '*' && $spaces !== 0) { + --$spaces; + } + break; + + case \T_END_HEREDOC: + case \T_END_NOWDOC: + /* + * PHPCS does not execute tab replacement in heredoc/nowdoc closer + * tokens prior to PHPCS 3.7.2, so handle this ourselves. + */ + $content = $tokens[$i]['content']; + if (\strpos($tokens[$i]['content'], "\t") !== false) { + $origContent = $content; + $content = \str_replace("\t", \str_repeat(' ', $this->tabWidth), $content); + } + + $closer = \ltrim($content); + $whitespace = \str_replace($closer, '', $content); + $length = \strlen($whitespace); + $spaces = ($length % $indent); + break; + } + + if ($spaces === 0) { + continue; + } + + $fix = $phpcsFile->addFixableWarning( + 'Found precision alignment of %s spaces.', + $i, + 'Found', + [$spaces] + ); + + if ($fix === true) { + if ($tokens[$i]['code'] === \T_END_HEREDOC || $tokens[$i]['code'] === \T_END_NOWDOC) { + // For heredoc/nowdoc, always round down to prevent introducing parse errors. + $tabstops = (int) \floor($spaces / $indent); + } else { + // For everything else, use "best guess". + $tabstops = (int) \round($spaces / $indent, 0); + } + + switch ($tokens[$i]['code']) { + case \T_WHITESPACE: + /* + * More complex than you'd think as "length" doesn't include new lines, + * but we don't want to remove new lines either. + */ + $replaceLength = (((int) ($tokens[$i]['length'] / $indent) + $tabstops) * $indent); + $replace = $this->getReplacement($replaceLength, $origContent); + $newContent = \substr_replace($tokens[$i]['content'], $replace, 0, $tokens[$i]['length']); + + $phpcsFile->fixer->replaceToken($i, $newContent); + break; + + case \T_DOC_COMMENT_WHITESPACE: + $replaceLength = (((int) ($tokens[$i]['length'] / $indent) + $tabstops) * $indent); + $replace = $this->getReplacement($replaceLength, $origContent); + + if (isset($tokens[($i + 1)]) === true + && ($tokens[($i + 1)]['code'] === \T_DOC_COMMENT_STAR + || $tokens[($i + 1)]['code'] === \T_DOC_COMMENT_CLOSE_TAG) + && $tabstops === 0 + ) { + // Maintain the extra space before the star. + $replace .= ' '; + } + + $newContent = \substr_replace($tokens[$i]['content'], $replace, 0, $tokens[$i]['length']); + + $phpcsFile->fixer->replaceToken($i, $newContent); + break; + + case \T_COMMENT: + case \T_INLINE_HTML: + case \T_PHPCS_ENABLE: + case \T_PHPCS_DISABLE: + case \T_PHPCS_SET: + case \T_PHPCS_IGNORE: + case \T_PHPCS_IGNORE_FILE: + $replaceLength = (((int) ($length / $indent) + $tabstops) * $indent); + $replace = $this->getReplacement($replaceLength, $origContent); + + if (isset($content[0]) === true && $content[0] === '*' && $tabstops === 0) { + // Maintain the extra space before the star. + $replace .= ' '; + } + + if ($content === '') { + // Preserve new lines in blank line comment tokens. + $newContent = \substr_replace($tokens[$i]['content'], $replace, 0, $length); + } else { + $newContent = $replace . $content; + } + + $phpcsFile->fixer->replaceToken($i, $newContent); + break; + + case \T_END_HEREDOC: + case \T_END_NOWDOC: + $replaceLength = (((int) ($length / $indent) + $tabstops) * $indent); + $replace = $this->getReplacement($replaceLength, $origContent); + + $phpcsFile->fixer->replaceToken($i, $replace . $closer); + break; + } + } + } + + // No need to look at this file again. + return $phpcsFile->numTokens; + } + + /** + * Get the whitespace replacement. Respect tabs vs spaces. + * + * @param int $length The target length of the replacement. + * @param string|null $origContent The original token content without tabs replaced (if available). + * + * @return string + */ + private function getReplacement($length, $origContent) + { + if ($origContent !== null) { + // Check whether tabs were part of the indent or inline alignment. + $content = \ltrim($origContent); + $whitespace = $origContent; + if ($content !== '') { + $whitespace = \str_replace($content, '', $origContent); + } + + if (\strpos($whitespace, "\t") !== false) { + // Original indent used tabs. Use tabs in replacement too. + $tabs = (int) ($length / $this->tabWidth); + $spaces = $length % $this->tabWidth; + return \str_repeat("\t", $tabs) . \str_repeat(' ', (int) $spaces); + } + } + + return \str_repeat(' ', $length); + } +} diff --git a/vendor/phpcsstandards/phpcsextra/Universal/ruleset.xml b/vendor/phpcsstandards/phpcsextra/Universal/ruleset.xml new file mode 100644 index 00000000..6c591eb7 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/Universal/ruleset.xml @@ -0,0 +1,5 @@ +<?xml version="1.0"?> +<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Universal" namespace="PHPCSExtra\Universal" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/PHPCSStandards/PHP_CodeSniffer/master/phpcs.xsd"> + + <description>A collection of universal sniffs. This standard is not designed to be used to check code. Include individual sniffs from this standard in a custom ruleset instead.</description> +</ruleset> diff --git a/vendor/phpcsstandards/phpcsextra/composer.json b/vendor/phpcsstandards/phpcsextra/composer.json new file mode 100644 index 00000000..92122571 --- /dev/null +++ b/vendor/phpcsstandards/phpcsextra/composer.json @@ -0,0 +1,69 @@ +{ + "name" : "phpcsstandards/phpcsextra", + "description" : "A collection of sniffs and standards for use with PHP_CodeSniffer.", + "type" : "phpcodesniffer-standard", + "keywords" : [ "phpcs", "phpcbf", "standards", "static analysis", "php_codesniffer", "phpcodesniffer-standard" ], + "license" : "LGPL-3.0-or-later", + "authors" : [ + { + "name" : "Juliette Reinders Folmer", + "role" : "lead", + "homepage" : "https://github.com/jrfnl" + }, + { + "name" : "Contributors", + "homepage" : "https://github.com/PHPCSStandards/PHPCSExtra/graphs/contributors" + } + ], + "support" : { + "issues" : "https://github.com/PHPCSStandards/PHPCSExtra/issues", + "source" : "https://github.com/PHPCSStandards/PHPCSExtra", + "security": "https://github.com/PHPCSStandards/PHPCSExtra/security/policy" + }, + "require" : { + "php" : ">=5.4", + "squizlabs/php_codesniffer" : "^3.8.0", + "phpcsstandards/phpcsutils" : "^1.0.9" + }, + "require-dev" : { + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "php-parallel-lint/php-console-highlighter": "^1.0", + "phpcsstandards/phpcsdevcs": "^1.1.6", + "phpcsstandards/phpcsdevtools": "^1.2.1", + "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "scripts" : { + "lint": [ + "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . --show-deprecated -e php --exclude vendor --exclude .git" + ], + "checkcs": [ + "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs" + ], + "fixcs": [ + "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf" + ], + "check-complete": [ + "@php ./vendor/phpcsstandards/phpcsdevtools/bin/phpcs-check-feature-completeness ./Modernize ./NormalizedArrays ./Universal" + ], + "test": [ + "@php ./vendor/phpunit/phpunit/phpunit --filter PHPCSExtra --no-coverage ./vendor/squizlabs/php_codesniffer/tests/AllTests.php" + ], + "coverage": [ + "@php ./vendor/phpunit/phpunit/phpunit --filter PHPCSExtra ./vendor/squizlabs/php_codesniffer/tests/AllTests.php" + ], + "coverage-local": [ + "@php ./vendor/phpunit/phpunit/phpunit --filter PHPCSExtra ./vendor/squizlabs/php_codesniffer/tests/AllTests.php --coverage-html ./build/coverage-html" + ] + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + } +} diff --git a/vendor/phpcsstandards/phpcsutils/.phpdoc.xml.dist b/vendor/phpcsstandards/phpcsutils/.phpdoc.xml.dist new file mode 100644 index 00000000..9ec6fd20 --- /dev/null +++ b/vendor/phpcsstandards/phpcsutils/.phpdoc.xml.dist @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<phpdocumentor + configVersion="3" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="https://www.phpdoc.org" + xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/phpDocumentor/phpDocumentor/master/data/xsd/phpdoc.xsd" +> + + <title>PHPCSUtils + + + docs/phpdoc/ + build/docs/structure/ + + + + + + phpcsutils-autoload.php + PHPCSUtils + + + public + protected + + codeCoverageIgnore + phpcs + + + + +